From 82b50fd37b676fde3b0e44dd009402396c5551e8 Mon Sep 17 00:00:00 2001 From: Pavel Smirnov Date: Fri, 23 Aug 2024 19:21:03 -0400 Subject: [PATCH] 0.11.0 --- .yarn/plugins/@yarnpkg/plugin-version.cjs | 550 + .yarnrc.yml | 2 + CHANGELOG.md | 7 + CONTRIBUTING.md | 18 +- package.json | 5 +- packages/miew-app/CHANGELOG.md | 22 + packages/miew-app/package.json | 2 +- packages/miew-react/CHANGELOG.md | 22 + packages/miew-react/package.json | 2 +- packages/miew/CHANGELOG.md | 66 +- packages/miew/dist/Miew.js | 73466 +++++++++----------- packages/miew/dist/Miew.js.map | 2 +- packages/miew/dist/Miew.min.css | 2 +- packages/miew/dist/Miew.min.css.map | 2 +- packages/miew/dist/Miew.min.js | 16 +- packages/miew/dist/Miew.min.js.map | 2 +- packages/miew/dist/Miew.module.js | 71319 +++++++++---------- packages/miew/dist/Miew.module.js.map | 2 +- packages/miew/package.json | 2 +- yarn.lock | 20 +- 20 files changed, 68398 insertions(+), 77131 deletions(-) create mode 100644 .yarn/plugins/@yarnpkg/plugin-version.cjs create mode 100644 CHANGELOG.md create mode 100644 packages/miew-app/CHANGELOG.md create mode 100644 packages/miew-react/CHANGELOG.md diff --git a/.yarn/plugins/@yarnpkg/plugin-version.cjs b/.yarn/plugins/@yarnpkg/plugin-version.cjs new file mode 100644 index 000000000..87de4f440 --- /dev/null +++ b/.yarn/plugins/@yarnpkg/plugin-version.cjs @@ -0,0 +1,550 @@ +/* eslint-disable */ +//prettier-ignore +module.exports = { +name: "@yarnpkg/plugin-version", +factory: function (require) { +var plugin=(()=>{var ZB=Object.create,zy=Object.defineProperty,$B=Object.defineProperties,eU=Object.getOwnPropertyDescriptor,tU=Object.getOwnPropertyDescriptors,nU=Object.getOwnPropertyNames,uS=Object.getOwnPropertySymbols,rU=Object.getPrototypeOf,oS=Object.prototype.hasOwnProperty,iU=Object.prototype.propertyIsEnumerable;var lS=(i,o,f)=>o in i?zy(i,o,{enumerable:!0,configurable:!0,writable:!0,value:f}):i[o]=f,E0=(i,o)=>{for(var f in o||(o={}))oS.call(o,f)&&lS(i,f,o[f]);if(uS)for(var f of uS(o))iU.call(o,f)&&lS(i,f,o[f]);return i},Gf=(i,o)=>$B(i,tU(o)),uU=i=>zy(i,"__esModule",{value:!0});var ce=(i,o)=>()=>(o||i((o={exports:{}}).exports,o),o.exports),sS=(i,o)=>{for(var f in o)zy(i,f,{get:o[f],enumerable:!0})},oU=(i,o,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of nU(o))!oS.call(i,p)&&p!=="default"&&zy(i,p,{get:()=>o[p],enumerable:!(f=eU(o,p))||f.enumerable});return i},Mi=i=>oU(uU(zy(i!=null?ZB(rU(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var eD=ce((F$,aS)=>{function lU(i,o){for(var f=-1,p=i==null?0:i.length,E=Array(p);++f{function sU(){this.__data__=[],this.size=0}fS.exports=sU});var tD=ce((P$,dS)=>{function aU(i,o){return i===o||i!==i&&o!==o}dS.exports=aU});var qy=ce((I$,pS)=>{var fU=tD();function cU(i,o){for(var f=i.length;f--;)if(fU(i[f][0],o))return f;return-1}pS.exports=cU});var vS=ce((B$,hS)=>{var dU=qy(),pU=Array.prototype,hU=pU.splice;function vU(i){var o=this.__data__,f=dU(o,i);if(f<0)return!1;var p=o.length-1;return f==p?o.pop():hU.call(o,f,1),--this.size,!0}hS.exports=vU});var yS=ce((U$,mS)=>{var mU=qy();function yU(i){var o=this.__data__,f=mU(o,i);return f<0?void 0:o[f][1]}mS.exports=yU});var _S=ce((j$,gS)=>{var gU=qy();function _U(i){return gU(this.__data__,i)>-1}gS.exports=_U});var DS=ce((z$,ES)=>{var EU=qy();function DU(i,o){var f=this.__data__,p=EU(f,i);return p<0?(++this.size,f.push([i,o])):f[p][1]=o,this}ES.exports=DU});var Hy=ce((q$,wS)=>{var wU=cS(),SU=vS(),TU=yS(),CU=_S(),xU=DS();function jv(i){var o=-1,f=i==null?0:i.length;for(this.clear();++o{var AU=Hy();function RU(){this.__data__=new AU,this.size=0}SS.exports=RU});var xS=ce((W$,CS)=>{function OU(i){var o=this.__data__,f=o.delete(i);return this.size=o.size,f}CS.exports=OU});var RS=ce((V$,AS)=>{function kU(i){return this.__data__.get(i)}AS.exports=kU});var kS=ce((G$,OS)=>{function MU(i){return this.__data__.has(i)}OS.exports=MU});var nD=ce((Y$,MS)=>{var NU=typeof global=="object"&&global&&global.Object===Object&&global;MS.exports=NU});var Yf=ce((K$,NS)=>{var LU=nD(),FU=typeof self=="object"&&self&&self.Object===Object&&self,bU=LU||FU||Function("return this")();NS.exports=bU});var zv=ce((X$,LS)=>{var PU=Yf(),IU=PU.Symbol;LS.exports=IU});var BS=ce((Q$,bS)=>{var PS=zv(),IS=Object.prototype,BU=IS.hasOwnProperty,UU=IS.toString,Wy=PS?PS.toStringTag:void 0;function jU(i){var o=BU.call(i,Wy),f=i[Wy];try{i[Wy]=void 0;var p=!0}catch(t){}var E=UU.call(i);return p&&(o?i[Wy]=f:delete i[Wy]),E}bS.exports=jU});var jS=ce((J$,US)=>{var zU=Object.prototype,qU=zU.toString;function HU(i){return qU.call(i)}US.exports=HU});var Qp=ce((Z$,zS)=>{var qS=zv(),WU=BS(),VU=jS(),GU="[object Null]",YU="[object Undefined]",HS=qS?qS.toStringTag:void 0;function KU(i){return i==null?i===void 0?YU:GU:HS&&HS in Object(i)?WU(i):VU(i)}zS.exports=KU});var qv=ce(($$,WS)=>{function XU(i){var o=typeof i;return i!=null&&(o=="object"||o=="function")}WS.exports=XU});var rD=ce((eee,VS)=>{var QU=Qp(),JU=qv(),ZU="[object AsyncFunction]",$U="[object Function]",ej="[object GeneratorFunction]",tj="[object Proxy]";function nj(i){if(!JU(i))return!1;var o=QU(i);return o==$U||o==ej||o==ZU||o==tj}VS.exports=nj});var YS=ce((tee,GS)=>{var rj=Yf(),ij=rj["__core-js_shared__"];GS.exports=ij});var QS=ce((nee,KS)=>{var iD=YS(),XS=function(){var i=/[^.]+$/.exec(iD&&iD.keys&&iD.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function uj(i){return!!XS&&XS in i}KS.exports=uj});var uD=ce((ree,JS)=>{var oj=Function.prototype,lj=oj.toString;function sj(i){if(i!=null){try{return lj.call(i)}catch(o){}try{return i+""}catch(o){}}return""}JS.exports=sj});var $S=ce((iee,ZS)=>{var aj=rD(),fj=QS(),cj=qv(),dj=uD(),pj=/[\\^$.*+?()[\]{}|]/g,hj=/^\[object .+?Constructor\]$/,vj=Function.prototype,mj=Object.prototype,yj=vj.toString,gj=mj.hasOwnProperty,_j=RegExp("^"+yj.call(gj).replace(pj,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ej(i){if(!cj(i)||fj(i))return!1;var o=aj(i)?_j:hj;return o.test(dj(i))}ZS.exports=Ej});var tT=ce((uee,eT)=>{function Dj(i,o){return i==null?void 0:i[o]}eT.exports=Dj});var sd=ce((oee,nT)=>{var wj=$S(),Sj=tT();function Tj(i,o){var f=Sj(i,o);return wj(f)?f:void 0}nT.exports=Tj});var L_=ce((lee,rT)=>{var Cj=sd(),xj=Yf(),Aj=Cj(xj,"Map");rT.exports=Aj});var Vy=ce((see,iT)=>{var Rj=sd(),Oj=Rj(Object,"create");iT.exports=Oj});var lT=ce((aee,uT)=>{var oT=Vy();function kj(){this.__data__=oT?oT(null):{},this.size=0}uT.exports=kj});var aT=ce((fee,sT)=>{function Mj(i){var o=this.has(i)&&delete this.__data__[i];return this.size-=o?1:0,o}sT.exports=Mj});var cT=ce((cee,fT)=>{var Nj=Vy(),Lj="__lodash_hash_undefined__",Fj=Object.prototype,bj=Fj.hasOwnProperty;function Pj(i){var o=this.__data__;if(Nj){var f=o[i];return f===Lj?void 0:f}return bj.call(o,i)?o[i]:void 0}fT.exports=Pj});var pT=ce((dee,dT)=>{var Ij=Vy(),Bj=Object.prototype,Uj=Bj.hasOwnProperty;function jj(i){var o=this.__data__;return Ij?o[i]!==void 0:Uj.call(o,i)}dT.exports=jj});var vT=ce((pee,hT)=>{var zj=Vy(),qj="__lodash_hash_undefined__";function Hj(i,o){var f=this.__data__;return this.size+=this.has(i)?0:1,f[i]=zj&&o===void 0?qj:o,this}hT.exports=Hj});var yT=ce((hee,mT)=>{var Wj=lT(),Vj=aT(),Gj=cT(),Yj=pT(),Kj=vT();function Hv(i){var o=-1,f=i==null?0:i.length;for(this.clear();++o{var _T=yT(),Xj=Hy(),Qj=L_();function Jj(){this.size=0,this.__data__={hash:new _T,map:new(Qj||Xj),string:new _T}}gT.exports=Jj});var wT=ce((mee,DT)=>{function Zj(i){var o=typeof i;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?i!=="__proto__":i===null}DT.exports=Zj});var Gy=ce((yee,ST)=>{var $j=wT();function ez(i,o){var f=i.__data__;return $j(o)?f[typeof o=="string"?"string":"hash"]:f.map}ST.exports=ez});var CT=ce((gee,TT)=>{var tz=Gy();function nz(i){var o=tz(this,i).delete(i);return this.size-=o?1:0,o}TT.exports=nz});var AT=ce((_ee,xT)=>{var rz=Gy();function iz(i){return rz(this,i).get(i)}xT.exports=iz});var OT=ce((Eee,RT)=>{var uz=Gy();function oz(i){return uz(this,i).has(i)}RT.exports=oz});var MT=ce((Dee,kT)=>{var lz=Gy();function sz(i,o){var f=lz(this,i),p=f.size;return f.set(i,o),this.size+=f.size==p?0:1,this}kT.exports=sz});var oD=ce((wee,NT)=>{var az=ET(),fz=CT(),cz=AT(),dz=OT(),pz=MT();function Wv(i){var o=-1,f=i==null?0:i.length;for(this.clear();++o{var hz=Hy(),vz=L_(),mz=oD(),yz=200;function gz(i,o){var f=this.__data__;if(f instanceof hz){var p=f.__data__;if(!vz||p.length{var _z=Hy(),Ez=TS(),Dz=xS(),wz=RS(),Sz=kS(),Tz=FT();function Vv(i){var o=this.__data__=new _z(i);this.size=o.size}Vv.prototype.clear=Ez;Vv.prototype.delete=Dz;Vv.prototype.get=wz;Vv.prototype.has=Sz;Vv.prototype.set=Tz;bT.exports=Vv});var BT=ce((Cee,IT)=>{function Cz(i,o){for(var f=-1,p=i==null?0:i.length;++f{var xz=sd(),Az=function(){try{var i=xz(Object,"defineProperty");return i({},"",{}),i}catch(o){}}();UT.exports=Az});var sD=ce((Aee,jT)=>{var zT=lD();function Rz(i,o,f){o=="__proto__"&&zT?zT(i,o,{configurable:!0,enumerable:!0,value:f,writable:!0}):i[o]=f}jT.exports=Rz});var aD=ce((Ree,qT)=>{var Oz=sD(),kz=tD(),Mz=Object.prototype,Nz=Mz.hasOwnProperty;function Lz(i,o,f){var p=i[o];(!(Nz.call(i,o)&&kz(p,f))||f===void 0&&!(o in i))&&Oz(i,o,f)}qT.exports=Lz});var Gv=ce((Oee,HT)=>{var Fz=aD(),bz=sD();function Pz(i,o,f,p){var E=!f;f||(f={});for(var t=-1,k=o.length;++t{function Iz(i,o){for(var f=-1,p=Array(i);++f{function Bz(i){return i!=null&&typeof i=="object"}GT.exports=Bz});var KT=ce((Nee,YT)=>{var Uz=Qp(),jz=ad(),zz="[object Arguments]";function qz(i){return jz(i)&&Uz(i)==zz}YT.exports=qz});var fD=ce((Lee,XT)=>{var QT=KT(),Hz=ad(),JT=Object.prototype,Wz=JT.hasOwnProperty,Vz=JT.propertyIsEnumerable,Gz=QT(function(){return arguments}())?QT:function(i){return Hz(i)&&Wz.call(i,"callee")&&!Vz.call(i,"callee")};XT.exports=Gz});var fd=ce((Fee,ZT)=>{var Yz=Array.isArray;ZT.exports=Yz});var eC=ce((bee,$T)=>{function Kz(){return!1}$T.exports=Kz});var cD=ce((Yy,Yv)=>{var Xz=Yf(),Qz=eC(),tC=typeof Yy=="object"&&Yy&&!Yy.nodeType&&Yy,nC=tC&&typeof Yv=="object"&&Yv&&!Yv.nodeType&&Yv,Jz=nC&&nC.exports===tC,rC=Jz?Xz.Buffer:void 0,Zz=rC?rC.isBuffer:void 0,$z=Zz||Qz;Yv.exports=$z});var uC=ce((Pee,iC)=>{var eq=9007199254740991,tq=/^(?:0|[1-9]\d*)$/;function nq(i,o){var f=typeof i;return o=o==null?eq:o,!!o&&(f=="number"||f!="symbol"&&tq.test(i))&&i>-1&&i%1==0&&i{var rq=9007199254740991;function iq(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=rq}oC.exports=iq});var sC=ce((Bee,lC)=>{var uq=Qp(),oq=dD(),lq=ad(),sq="[object Arguments]",aq="[object Array]",fq="[object Boolean]",cq="[object Date]",dq="[object Error]",pq="[object Function]",hq="[object Map]",vq="[object Number]",mq="[object Object]",yq="[object RegExp]",gq="[object Set]",_q="[object String]",Eq="[object WeakMap]",Dq="[object ArrayBuffer]",wq="[object DataView]",Sq="[object Float32Array]",Tq="[object Float64Array]",Cq="[object Int8Array]",xq="[object Int16Array]",Aq="[object Int32Array]",Rq="[object Uint8Array]",Oq="[object Uint8ClampedArray]",kq="[object Uint16Array]",Mq="[object Uint32Array]",o0={};o0[Sq]=o0[Tq]=o0[Cq]=o0[xq]=o0[Aq]=o0[Rq]=o0[Oq]=o0[kq]=o0[Mq]=!0;o0[sq]=o0[aq]=o0[Dq]=o0[fq]=o0[wq]=o0[cq]=o0[dq]=o0[pq]=o0[hq]=o0[vq]=o0[mq]=o0[yq]=o0[gq]=o0[_q]=o0[Eq]=!1;function Nq(i){return lq(i)&&oq(i.length)&&!!o0[uq(i)]}lC.exports=Nq});var F_=ce((Uee,aC)=>{function Lq(i){return function(o){return i(o)}}aC.exports=Lq});var b_=ce((Ky,Kv)=>{var Fq=nD(),fC=typeof Ky=="object"&&Ky&&!Ky.nodeType&&Ky,Xy=fC&&typeof Kv=="object"&&Kv&&!Kv.nodeType&&Kv,bq=Xy&&Xy.exports===fC,pD=bq&&Fq.process,Pq=function(){try{var i=Xy&&Xy.require&&Xy.require("util").types;return i||pD&&pD.binding&&pD.binding("util")}catch(o){}}();Kv.exports=Pq});var hC=ce((jee,cC)=>{var Iq=sC(),Bq=F_(),dC=b_(),pC=dC&&dC.isTypedArray,Uq=pC?Bq(pC):Iq;cC.exports=Uq});var hD=ce((zee,vC)=>{var jq=VT(),zq=fD(),qq=fd(),Hq=cD(),Wq=uC(),Vq=hC(),Gq=Object.prototype,Yq=Gq.hasOwnProperty;function Kq(i,o){var f=qq(i),p=!f&&zq(i),E=!f&&!p&&Hq(i),t=!f&&!p&&!E&&Vq(i),k=f||p||E||t,L=k?jq(i.length,String):[],N=L.length;for(var C in i)(o||Yq.call(i,C))&&!(k&&(C=="length"||E&&(C=="offset"||C=="parent")||t&&(C=="buffer"||C=="byteLength"||C=="byteOffset")||Wq(C,N)))&&L.push(C);return L}vC.exports=Kq});var P_=ce((qee,mC)=>{var Xq=Object.prototype;function Qq(i){var o=i&&i.constructor,f=typeof o=="function"&&o.prototype||Xq;return i===f}mC.exports=Qq});var vD=ce((Hee,yC)=>{function Jq(i,o){return function(f){return i(o(f))}}yC.exports=Jq});var _C=ce((Wee,gC)=>{var Zq=vD(),$q=Zq(Object.keys,Object);gC.exports=$q});var DC=ce((Vee,EC)=>{var eH=P_(),tH=_C(),nH=Object.prototype,rH=nH.hasOwnProperty;function iH(i){if(!eH(i))return tH(i);var o=[];for(var f in Object(i))rH.call(i,f)&&f!="constructor"&&o.push(f);return o}EC.exports=iH});var mD=ce((Gee,wC)=>{var uH=rD(),oH=dD();function lH(i){return i!=null&&oH(i.length)&&!uH(i)}wC.exports=lH});var I_=ce((Yee,SC)=>{var sH=hD(),aH=DC(),fH=mD();function cH(i){return fH(i)?sH(i):aH(i)}SC.exports=cH});var CC=ce((Kee,TC)=>{var dH=Gv(),pH=I_();function hH(i,o){return i&&dH(o,pH(o),i)}TC.exports=hH});var AC=ce((Xee,xC)=>{function vH(i){var o=[];if(i!=null)for(var f in Object(i))o.push(f);return o}xC.exports=vH});var OC=ce((Qee,RC)=>{var mH=qv(),yH=P_(),gH=AC(),_H=Object.prototype,EH=_H.hasOwnProperty;function DH(i){if(!mH(i))return gH(i);var o=yH(i),f=[];for(var p in i)p=="constructor"&&(o||!EH.call(i,p))||f.push(p);return f}RC.exports=DH});var B_=ce((Jee,kC)=>{var wH=hD(),SH=OC(),TH=mD();function CH(i){return TH(i)?wH(i,!0):SH(i)}kC.exports=CH});var NC=ce((Zee,MC)=>{var xH=Gv(),AH=B_();function RH(i,o){return i&&xH(o,AH(o),i)}MC.exports=RH});var IC=ce((Qy,Xv)=>{var OH=Yf(),LC=typeof Qy=="object"&&Qy&&!Qy.nodeType&&Qy,FC=LC&&typeof Xv=="object"&&Xv&&!Xv.nodeType&&Xv,kH=FC&&FC.exports===LC,bC=kH?OH.Buffer:void 0,PC=bC?bC.allocUnsafe:void 0;function MH(i,o){if(o)return i.slice();var f=i.length,p=PC?PC(f):new i.constructor(f);return i.copy(p),p}Xv.exports=MH});var UC=ce(($ee,BC)=>{function NH(i,o){var f=-1,p=i.length;for(o||(o=Array(p));++f{function LH(i,o){for(var f=-1,p=i==null?0:i.length,E=0,t=[];++f{function FH(){return[]}qC.exports=FH});var U_=ce((nte,HC)=>{var bH=zC(),PH=yD(),IH=Object.prototype,BH=IH.propertyIsEnumerable,WC=Object.getOwnPropertySymbols,UH=WC?function(i){return i==null?[]:(i=Object(i),bH(WC(i),function(o){return BH.call(i,o)}))}:PH;HC.exports=UH});var GC=ce((rte,VC)=>{var jH=Gv(),zH=U_();function qH(i,o){return jH(i,zH(i),o)}VC.exports=qH});var j_=ce((ite,YC)=>{function HH(i,o){for(var f=-1,p=o.length,E=i.length;++f{var WH=vD(),VH=WH(Object.getPrototypeOf,Object);KC.exports=VH});var gD=ce((ote,XC)=>{var GH=j_(),YH=z_(),KH=U_(),XH=yD(),QH=Object.getOwnPropertySymbols,JH=QH?function(i){for(var o=[];i;)GH(o,KH(i)),i=YH(i);return o}:XH;XC.exports=JH});var JC=ce((lte,QC)=>{var ZH=Gv(),$H=gD();function eW(i,o){return ZH(i,$H(i),o)}QC.exports=eW});var _D=ce((ste,ZC)=>{var tW=j_(),nW=fd();function rW(i,o,f){var p=o(i);return nW(i)?p:tW(p,f(i))}ZC.exports=rW});var e6=ce((ate,$C)=>{var iW=_D(),uW=U_(),oW=I_();function lW(i){return iW(i,oW,uW)}$C.exports=lW});var ED=ce((fte,t6)=>{var sW=_D(),aW=gD(),fW=B_();function cW(i){return sW(i,fW,aW)}t6.exports=cW});var r6=ce((cte,n6)=>{var dW=sd(),pW=Yf(),hW=dW(pW,"DataView");n6.exports=hW});var u6=ce((dte,i6)=>{var vW=sd(),mW=Yf(),yW=vW(mW,"Promise");i6.exports=yW});var l6=ce((pte,o6)=>{var gW=sd(),_W=Yf(),EW=gW(_W,"Set");o6.exports=EW});var a6=ce((hte,s6)=>{var DW=sd(),wW=Yf(),SW=DW(wW,"WeakMap");s6.exports=SW});var q_=ce((vte,f6)=>{var DD=r6(),wD=L_(),SD=u6(),TD=l6(),CD=a6(),c6=Qp(),Qv=uD(),d6="[object Map]",TW="[object Object]",p6="[object Promise]",h6="[object Set]",v6="[object WeakMap]",m6="[object DataView]",CW=Qv(DD),xW=Qv(wD),AW=Qv(SD),RW=Qv(TD),OW=Qv(CD),Jp=c6;(DD&&Jp(new DD(new ArrayBuffer(1)))!=m6||wD&&Jp(new wD)!=d6||SD&&Jp(SD.resolve())!=p6||TD&&Jp(new TD)!=h6||CD&&Jp(new CD)!=v6)&&(Jp=function(i){var o=c6(i),f=o==TW?i.constructor:void 0,p=f?Qv(f):"";if(p)switch(p){case CW:return m6;case xW:return d6;case AW:return p6;case RW:return h6;case OW:return v6}return o});f6.exports=Jp});var g6=ce((mte,y6)=>{var kW=Object.prototype,MW=kW.hasOwnProperty;function NW(i){var o=i.length,f=new i.constructor(o);return o&&typeof i[0]=="string"&&MW.call(i,"index")&&(f.index=i.index,f.input=i.input),f}y6.exports=NW});var E6=ce((yte,_6)=>{var LW=Yf(),FW=LW.Uint8Array;_6.exports=FW});var H_=ce((gte,D6)=>{var w6=E6();function bW(i){var o=new i.constructor(i.byteLength);return new w6(o).set(new w6(i)),o}D6.exports=bW});var T6=ce((_te,S6)=>{var PW=H_();function IW(i,o){var f=o?PW(i.buffer):i.buffer;return new i.constructor(f,i.byteOffset,i.byteLength)}S6.exports=IW});var x6=ce((Ete,C6)=>{var BW=/\w*$/;function UW(i){var o=new i.constructor(i.source,BW.exec(i));return o.lastIndex=i.lastIndex,o}C6.exports=UW});var M6=ce((Dte,A6)=>{var R6=zv(),O6=R6?R6.prototype:void 0,k6=O6?O6.valueOf:void 0;function jW(i){return k6?Object(k6.call(i)):{}}A6.exports=jW});var L6=ce((wte,N6)=>{var zW=H_();function qW(i,o){var f=o?zW(i.buffer):i.buffer;return new i.constructor(f,i.byteOffset,i.length)}N6.exports=qW});var b6=ce((Ste,F6)=>{var HW=H_(),WW=T6(),VW=x6(),GW=M6(),YW=L6(),KW="[object Boolean]",XW="[object Date]",QW="[object Map]",JW="[object Number]",ZW="[object RegExp]",$W="[object Set]",eV="[object String]",tV="[object Symbol]",nV="[object ArrayBuffer]",rV="[object DataView]",iV="[object Float32Array]",uV="[object Float64Array]",oV="[object Int8Array]",lV="[object Int16Array]",sV="[object Int32Array]",aV="[object Uint8Array]",fV="[object Uint8ClampedArray]",cV="[object Uint16Array]",dV="[object Uint32Array]";function pV(i,o,f){var p=i.constructor;switch(o){case nV:return HW(i);case KW:case XW:return new p(+i);case rV:return WW(i,f);case iV:case uV:case oV:case lV:case sV:case aV:case fV:case cV:case dV:return YW(i,f);case QW:return new p;case JW:case eV:return new p(i);case ZW:return VW(i);case $W:return new p;case tV:return GW(i)}}F6.exports=pV});var B6=ce((Tte,P6)=>{var hV=qv(),I6=Object.create,vV=function(){function i(){}return function(o){if(!hV(o))return{};if(I6)return I6(o);i.prototype=o;var f=new i;return i.prototype=void 0,f}}();P6.exports=vV});var j6=ce((Cte,U6)=>{var mV=B6(),yV=z_(),gV=P_();function _V(i){return typeof i.constructor=="function"&&!gV(i)?mV(yV(i)):{}}U6.exports=_V});var q6=ce((xte,z6)=>{var EV=q_(),DV=ad(),wV="[object Map]";function SV(i){return DV(i)&&EV(i)==wV}z6.exports=SV});var G6=ce((Ate,H6)=>{var TV=q6(),CV=F_(),W6=b_(),V6=W6&&W6.isMap,xV=V6?CV(V6):TV;H6.exports=xV});var K6=ce((Rte,Y6)=>{var AV=q_(),RV=ad(),OV="[object Set]";function kV(i){return RV(i)&&AV(i)==OV}Y6.exports=kV});var Z6=ce((Ote,X6)=>{var MV=K6(),NV=F_(),Q6=b_(),J6=Q6&&Q6.isSet,LV=J6?NV(J6):MV;X6.exports=LV});var rx=ce((kte,$6)=>{var FV=PT(),bV=BT(),PV=aD(),IV=CC(),BV=NC(),UV=IC(),jV=UC(),zV=GC(),qV=JC(),HV=e6(),WV=ED(),VV=q_(),GV=g6(),YV=b6(),KV=j6(),XV=fd(),QV=cD(),JV=G6(),ZV=qv(),$V=Z6(),eG=I_(),tG=B_(),nG=1,rG=2,iG=4,ex="[object Arguments]",uG="[object Array]",oG="[object Boolean]",lG="[object Date]",sG="[object Error]",tx="[object Function]",aG="[object GeneratorFunction]",fG="[object Map]",cG="[object Number]",nx="[object Object]",dG="[object RegExp]",pG="[object Set]",hG="[object String]",vG="[object Symbol]",mG="[object WeakMap]",yG="[object ArrayBuffer]",gG="[object DataView]",_G="[object Float32Array]",EG="[object Float64Array]",DG="[object Int8Array]",wG="[object Int16Array]",SG="[object Int32Array]",TG="[object Uint8Array]",CG="[object Uint8ClampedArray]",xG="[object Uint16Array]",AG="[object Uint32Array]",Wu={};Wu[ex]=Wu[uG]=Wu[yG]=Wu[gG]=Wu[oG]=Wu[lG]=Wu[_G]=Wu[EG]=Wu[DG]=Wu[wG]=Wu[SG]=Wu[fG]=Wu[cG]=Wu[nx]=Wu[dG]=Wu[pG]=Wu[hG]=Wu[vG]=Wu[TG]=Wu[CG]=Wu[xG]=Wu[AG]=!0;Wu[sG]=Wu[tx]=Wu[mG]=!1;function W_(i,o,f,p,E,t){var k,L=o&nG,N=o&rG,C=o&iG;if(f&&(k=E?f(i,p,E,t):f(i)),k!==void 0)return k;if(!ZV(i))return i;var U=XV(i);if(U){if(k=GV(i),!L)return jV(i,k)}else{var q=VV(i),W=q==tx||q==aG;if(QV(i))return UV(i,L);if(q==nx||q==ex||W&&!E){if(k=N||W?{}:KV(i),!L)return N?qV(i,BV(k,i)):zV(i,IV(k,i))}else{if(!Wu[q])return E?i:{};k=YV(i,q,L)}}t||(t=new FV);var ne=t.get(i);if(ne)return ne;t.set(i,k),$V(i)?i.forEach(function(Se){k.add(W_(Se,o,f,Se,i,t))}):JV(i)&&i.forEach(function(Se,he){k.set(he,W_(Se,o,f,he,i,t))});var m=C?N?WV:HV:N?tG:eG,we=U?void 0:m(i);return bV(we||i,function(Se,he){we&&(he=Se,Se=i[he]),PV(k,he,W_(Se,o,f,he,i,t))}),k}$6.exports=W_});var V_=ce((Mte,ix)=>{var RG=Qp(),OG=ad(),kG="[object Symbol]";function MG(i){return typeof i=="symbol"||OG(i)&&RG(i)==kG}ix.exports=MG});var ox=ce((Nte,ux)=>{var NG=fd(),LG=V_(),FG=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bG=/^\w*$/;function PG(i,o){if(NG(i))return!1;var f=typeof i;return f=="number"||f=="symbol"||f=="boolean"||i==null||LG(i)?!0:bG.test(i)||!FG.test(i)||o!=null&&i in Object(o)}ux.exports=PG});var ax=ce((Lte,lx)=>{var sx=oD(),IG="Expected a function";function xD(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(IG);var f=function(){var p=arguments,E=o?o.apply(this,p):p[0],t=f.cache;if(t.has(E))return t.get(E);var k=i.apply(this,p);return f.cache=t.set(E,k)||t,k};return f.cache=new(xD.Cache||sx),f}xD.Cache=sx;lx.exports=xD});var cx=ce((Fte,fx)=>{var BG=ax(),UG=500;function jG(i){var o=BG(i,function(p){return f.size===UG&&f.clear(),p}),f=o.cache;return o}fx.exports=jG});var px=ce((bte,dx)=>{var zG=cx(),qG=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,HG=/\\(\\)?/g,WG=zG(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(qG,function(f,p,E,t){o.push(E?t.replace(HG,"$1"):p||f)}),o});dx.exports=WG});var _x=ce((Pte,hx)=>{var vx=zv(),VG=eD(),GG=fd(),YG=V_(),KG=1/0,mx=vx?vx.prototype:void 0,yx=mx?mx.toString:void 0;function gx(i){if(typeof i=="string")return i;if(GG(i))return VG(i,gx)+"";if(YG(i))return yx?yx.call(i):"";var o=i+"";return o=="0"&&1/i==-KG?"-0":o}hx.exports=gx});var Dx=ce((Ite,Ex)=>{var XG=_x();function QG(i){return i==null?"":XG(i)}Ex.exports=QG});var G_=ce((Bte,wx)=>{var JG=fd(),ZG=ox(),$G=px(),eY=Dx();function tY(i,o){return JG(i)?i:ZG(i,o)?[i]:$G(eY(i))}wx.exports=tY});var Tx=ce((Ute,Sx)=>{function nY(i){var o=i==null?0:i.length;return o?i[o-1]:void 0}Sx.exports=nY});var AD=ce((jte,Cx)=>{var rY=V_(),iY=1/0;function uY(i){if(typeof i=="string"||rY(i))return i;var o=i+"";return o=="0"&&1/i==-iY?"-0":o}Cx.exports=uY});var Ax=ce((zte,xx)=>{var oY=G_(),lY=AD();function sY(i,o){o=oY(o,i);for(var f=0,p=o.length;i!=null&&f{function aY(i,o,f){var p=-1,E=i.length;o<0&&(o=-o>E?0:E+o),f=f>E?E:f,f<0&&(f+=E),E=o>f?0:f-o>>>0,o>>>=0;for(var t=Array(E);++p{var fY=Ax(),cY=Ox();function dY(i,o){return o.length<2?i:fY(i,cY(o,0,-1))}kx.exports=dY});var Lx=ce((Wte,Nx)=>{var pY=G_(),hY=Tx(),vY=Mx(),mY=AD();function yY(i,o){return o=pY(o,i),i=vY(i,o),i==null||delete i[mY(hY(o))]}Nx.exports=yY});var Px=ce((Vte,Fx)=>{var gY=Qp(),_Y=z_(),EY=ad(),DY="[object Object]",wY=Function.prototype,SY=Object.prototype,bx=wY.toString,TY=SY.hasOwnProperty,CY=bx.call(Object);function xY(i){if(!EY(i)||gY(i)!=DY)return!1;var o=_Y(i);if(o===null)return!0;var f=TY.call(o,"constructor")&&o.constructor;return typeof f=="function"&&f instanceof f&&bx.call(f)==CY}Fx.exports=xY});var Bx=ce((Gte,Ix)=>{var AY=Px();function RY(i){return AY(i)?void 0:i}Ix.exports=RY});var qx=ce((Yte,Ux)=>{var jx=zv(),OY=fD(),kY=fd(),zx=jx?jx.isConcatSpreadable:void 0;function MY(i){return kY(i)||OY(i)||!!(zx&&i&&i[zx])}Ux.exports=MY});var Vx=ce((Kte,Hx)=>{var NY=j_(),LY=qx();function Wx(i,o,f,p,E){var t=-1,k=i.length;for(f||(f=LY),E||(E=[]);++t0&&f(L)?o>1?Wx(L,o-1,f,p,E):NY(E,L):p||(E[E.length]=L)}return E}Hx.exports=Wx});var Yx=ce((Xte,Gx)=>{var FY=Vx();function bY(i){var o=i==null?0:i.length;return o?FY(i,1):[]}Gx.exports=bY});var Xx=ce((Qte,Kx)=>{function PY(i,o,f){switch(f.length){case 0:return i.call(o);case 1:return i.call(o,f[0]);case 2:return i.call(o,f[0],f[1]);case 3:return i.call(o,f[0],f[1],f[2])}return i.apply(o,f)}Kx.exports=PY});var Zx=ce((Jte,Qx)=>{var IY=Xx(),Jx=Math.max;function BY(i,o,f){return o=Jx(o===void 0?i.length-1:o,0),function(){for(var p=arguments,E=-1,t=Jx(p.length-o,0),k=Array(t);++E{function UY(i){return function(){return i}}$x.exports=UY});var n5=ce(($te,t5)=>{function jY(i){return i}t5.exports=jY});var u5=ce((ene,r5)=>{var zY=e5(),i5=lD(),qY=n5(),HY=i5?function(i,o){return i5(i,"toString",{configurable:!0,enumerable:!1,value:zY(o),writable:!0})}:qY;r5.exports=HY});var l5=ce((tne,o5)=>{var WY=800,VY=16,GY=Date.now;function YY(i){var o=0,f=0;return function(){var p=GY(),E=VY-(p-f);if(f=p,E>0){if(++o>=WY)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}o5.exports=YY});var a5=ce((nne,s5)=>{var KY=u5(),XY=l5(),QY=XY(KY);s5.exports=QY});var c5=ce((rne,f5)=>{var JY=Yx(),ZY=Zx(),$Y=a5();function eK(i){return $Y(ZY(i,void 0,JY),i+"")}f5.exports=eK});var p5=ce((ine,d5)=>{var tK=eD(),nK=rx(),rK=Lx(),iK=G_(),uK=Gv(),oK=Bx(),lK=c5(),sK=ED(),aK=1,fK=2,cK=4,dK=lK(function(i,o){var f={};if(i==null)return f;var p=!1;o=tK(o,function(t){return t=iK(t,i),p||(p=t.length>1),t}),uK(i,sK(i),f),p&&(f=nK(f,aK|fK|cK,oK));for(var E=o.length;E--;)rK(f,o[E]);return f});d5.exports=dK});var eg=ce((vne,y5)=>{"use strict";var g5=Object.getOwnPropertySymbols,_K=Object.prototype.hasOwnProperty,EK=Object.prototype.propertyIsEnumerable;function DK(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function wK(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var o={},f=0;f<10;f++)o["_"+String.fromCharCode(f)]=f;var p=Object.getOwnPropertyNames(o).map(function(t){return o[t]});if(p.join("")!=="0123456789")return!1;var E={};return"abcdefghijklmnopqrst".split("").forEach(function(t){E[t]=t}),Object.keys(Object.assign({},E)).join("")==="abcdefghijklmnopqrst"}catch(t){return!1}}y5.exports=wK()?Object.assign:function(i,o){for(var f,p=DK(i),E,t=1;t{"use strict";var LD=eg(),Kf=typeof Symbol=="function"&&Symbol.for,tg=Kf?Symbol.for("react.element"):60103,SK=Kf?Symbol.for("react.portal"):60106,TK=Kf?Symbol.for("react.fragment"):60107,CK=Kf?Symbol.for("react.strict_mode"):60108,xK=Kf?Symbol.for("react.profiler"):60114,AK=Kf?Symbol.for("react.provider"):60109,RK=Kf?Symbol.for("react.context"):60110,OK=Kf?Symbol.for("react.forward_ref"):60112,kK=Kf?Symbol.for("react.suspense"):60113,MK=Kf?Symbol.for("react.memo"):60115,NK=Kf?Symbol.for("react.lazy"):60116,_5=typeof Symbol=="function"&&Symbol.iterator;function ng(i){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+i,f=1;fJ_.length&&J_.push(i)}function BD(i,o,f,p){var E=typeof i;(E==="undefined"||E==="boolean")&&(i=null);var t=!1;if(i===null)t=!0;else switch(E){case"string":case"number":t=!0;break;case"object":switch(i.$$typeof){case tg:case SK:t=!0}}if(t)return f(p,i,o===""?"."+UD(i,0):o),1;if(t=0,o=o===""?".":o+":",Array.isArray(i))for(var k=0;k{"use strict";var BK="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";M5.exports=BK});var HD=ce((gne,L5)=>{"use strict";var qD=function(){};process.env.NODE_ENV!=="production"&&(F5=N5(),Z_={},b5=Function.call.bind(Object.prototype.hasOwnProperty),qD=function(i){var o="Warning: "+i;typeof console!="undefined"&&console.error(o);try{throw new Error(o)}catch(f){}});var F5,Z_,b5;function P5(i,o,f,p,E){if(process.env.NODE_ENV!=="production"){for(var t in i)if(b5(i,t)){var k;try{if(typeof i[t]!="function"){var L=Error((p||"React class")+": "+f+" type `"+t+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[t]+"`.");throw L.name="Invariant Violation",L}k=i[t](o,t,p,f,null,F5)}catch(C){k=C}if(k&&!(k instanceof Error)&&qD((p||"React class")+": type specification of "+f+" `"+t+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof k+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),k instanceof Error&&!(k.message in Z_)){Z_[k.message]=!0;var N=E?E():"";qD("Failed "+f+" type: "+k.message+(N!=null?N:""))}}}}P5.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(Z_={})};L5.exports=P5});var I5=ce(pu=>{"use strict";process.env.NODE_ENV!=="production"&&function(){"use strict";var i=eg(),o=HD(),f="16.13.1",p=typeof Symbol=="function"&&Symbol.for,E=p?Symbol.for("react.element"):60103,t=p?Symbol.for("react.portal"):60106,k=p?Symbol.for("react.fragment"):60107,L=p?Symbol.for("react.strict_mode"):60108,N=p?Symbol.for("react.profiler"):60114,C=p?Symbol.for("react.provider"):60109,U=p?Symbol.for("react.context"):60110,q=p?Symbol.for("react.concurrent_mode"):60111,W=p?Symbol.for("react.forward_ref"):60112,ne=p?Symbol.for("react.suspense"):60113,m=p?Symbol.for("react.suspense_list"):60120,we=p?Symbol.for("react.memo"):60115,Se=p?Symbol.for("react.lazy"):60116,he=p?Symbol.for("react.block"):60121,ge=p?Symbol.for("react.fundamental"):60117,ze=p?Symbol.for("react.responder"):60118,pe=p?Symbol.for("react.scope"):60119,Oe=typeof Symbol=="function"&&Symbol.iterator,le="@@iterator";function Ue(X){if(X===null||typeof X!="object")return null;var _e=Oe&&X[Oe]||X[le];return typeof _e=="function"?_e:null}var Ge={current:null},rt={suspense:null},wt={current:null},xt=/^(.*)[\\\/]/;function $e(X,_e,Ne){var Me="";if(_e){var dt=_e.fileName,Hn=dt.replace(xt,"");if(/^index\./.test(Hn)){var Dn=dt.match(xt);if(Dn){var or=Dn[1];if(or){var mi=or.replace(xt,"");Hn=mi+"/"+Hn}}}Me=" (at "+Hn+":"+_e.lineNumber+")"}else Ne&&(Me=" (created by "+Ne+")");return` + in `+(X||"Unknown")+Me}var ft=1;function Ke(X){return X._status===ft?X._result:null}function jt(X,_e,Ne){var Me=_e.displayName||_e.name||"";return X.displayName||(Me!==""?Ne+"("+Me+")":Ne)}function $t(X){if(X==null)return null;if(typeof X.tag=="number"&&ct("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof X=="function")return X.displayName||X.name||null;if(typeof X=="string")return X;switch(X){case k:return"Fragment";case t:return"Portal";case N:return"Profiler";case L:return"StrictMode";case ne:return"Suspense";case m:return"SuspenseList"}if(typeof X=="object")switch(X.$$typeof){case U:return"Context.Consumer";case C:return"Context.Provider";case W:return jt(X,X.render,"ForwardRef");case we:return $t(X.type);case he:return $t(X.render);case Se:{var _e=X,Ne=Ke(_e);if(Ne)return $t(Ne);break}}return null}var at={},Q=null;function ae(X){Q=X}at.getCurrentStack=null,at.getStackAddendum=function(){var X="";if(Q){var _e=$t(Q.type),Ne=Q._owner;X+=$e(_e,Q._source,Ne&&$t(Ne.type))}var Me=at.getCurrentStack;return Me&&(X+=Me()||""),X};var Ce={current:!1},ue={ReactCurrentDispatcher:Ge,ReactCurrentBatchConfig:rt,ReactCurrentOwner:wt,IsSomeRendererActing:Ce,assign:i};i(ue,{ReactDebugCurrentFrame:at,ReactComponentTreeHook:{}});function je(X){{for(var _e=arguments.length,Ne=new Array(_e>1?_e-1:0),Me=1;Me<_e;Me++)Ne[Me-1]=arguments[Me];At("warn",X,Ne)}}function ct(X){{for(var _e=arguments.length,Ne=new Array(_e>1?_e-1:0),Me=1;Me<_e;Me++)Ne[Me-1]=arguments[Me];At("error",X,Ne)}}function At(X,_e,Ne){{var Me=Ne.length>0&&typeof Ne[Ne.length-1]=="string"&&Ne[Ne.length-1].indexOf(` + in`)===0;if(!Me){var dt=ue.ReactDebugCurrentFrame,Hn=dt.getStackAddendum();Hn!==""&&(_e+="%s",Ne=Ne.concat([Hn]))}var Dn=Ne.map(function(Su){return""+Su});Dn.unshift("Warning: "+_e),Function.prototype.apply.call(console[X],console,Dn);try{var or=0,mi="Warning: "+_e.replace(/%s/g,function(){return Ne[or++]});throw new Error(mi)}catch(Su){}}}var en={};function ln(X,_e){{var Ne=X.constructor,Me=Ne&&(Ne.displayName||Ne.name)||"ReactClass",dt=Me+"."+_e;if(en[dt])return;ct("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",_e,Me),en[dt]=!0}}var An={isMounted:function(X){return!1},enqueueForceUpdate:function(X,_e,Ne){ln(X,"forceUpdate")},enqueueReplaceState:function(X,_e,Ne,Me){ln(X,"replaceState")},enqueueSetState:function(X,_e,Ne,Me){ln(X,"setState")}},nr={};Object.freeze(nr);function un(X,_e,Ne){this.props=X,this.context=_e,this.refs=nr,this.updater=Ne||An}un.prototype.isReactComponent={},un.prototype.setState=function(X,_e){if(!(typeof X=="object"||typeof X=="function"||X==null))throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,X,_e,"setState")},un.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};{var Wt={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},vr=function(X,_e){Object.defineProperty(un.prototype,X,{get:function(){je("%s(...) is deprecated in plain JavaScript React classes. %s",_e[0],_e[1])}})};for(var w in Wt)Wt.hasOwnProperty(w)&&vr(w,Wt[w])}function Ut(){}Ut.prototype=un.prototype;function Vn(X,_e,Ne){this.props=X,this.context=_e,this.refs=nr,this.updater=Ne||An}var fr=Vn.prototype=new Ut;fr.constructor=Vn,i(fr,un.prototype),fr.isPureReactComponent=!0;function Fr(){var X={current:null};return Object.seal(X),X}var ur=Object.prototype.hasOwnProperty,br={key:!0,ref:!0,__self:!0,__source:!0},Kt,vu,a0;a0={};function So(X){if(ur.call(X,"ref")){var _e=Object.getOwnPropertyDescriptor(X,"ref").get;if(_e&&_e.isReactWarning)return!1}return X.ref!==void 0}function Go(X){if(ur.call(X,"key")){var _e=Object.getOwnPropertyDescriptor(X,"key").get;if(_e&&_e.isReactWarning)return!1}return X.key!==void 0}function Os(X,_e){var Ne=function(){Kt||(Kt=!0,ct("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)",_e))};Ne.isReactWarning=!0,Object.defineProperty(X,"key",{get:Ne,configurable:!0})}function Yo(X,_e){var Ne=function(){vu||(vu=!0,ct("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)",_e))};Ne.isReactWarning=!0,Object.defineProperty(X,"ref",{get:Ne,configurable:!0})}function Ko(X){if(typeof X.ref=="string"&&wt.current&&X.__self&&wt.current.stateNode!==X.__self){var _e=$t(wt.current.type);a0[_e]||(ct('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://fb.me/react-strict-mode-string-ref',$t(wt.current.type),X.ref),a0[_e]=!0)}}var qt=function(X,_e,Ne,Me,dt,Hn,Dn){var or={$$typeof:E,type:X,key:_e,ref:Ne,props:Dn,_owner:Hn};return or._store={},Object.defineProperty(or._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(or,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Me}),Object.defineProperty(or,"_source",{configurable:!1,enumerable:!1,writable:!1,value:dt}),Object.freeze&&(Object.freeze(or.props),Object.freeze(or)),or};function _i(X,_e,Ne){var Me,dt={},Hn=null,Dn=null,or=null,mi=null;if(_e!=null){So(_e)&&(Dn=_e.ref,Ko(_e)),Go(_e)&&(Hn=""+_e.key),or=_e.__self===void 0?null:_e.__self,mi=_e.__source===void 0?null:_e.__source;for(Me in _e)ur.call(_e,Me)&&!br.hasOwnProperty(Me)&&(dt[Me]=_e[Me])}var Su=arguments.length-2;if(Su===1)dt.children=Ne;else if(Su>1){for(var bu=Array(Su),Pu=0;Pu1){for(var mu=Array(Pu),yi=0;yi is not supported and will be removed in a future major release. Did you mean to render instead?")),Ne.Provider},set:function(Dn){Ne.Provider=Dn}},_currentValue:{get:function(){return Ne._currentValue},set:function(Dn){Ne._currentValue=Dn}},_currentValue2:{get:function(){return Ne._currentValue2},set:function(Dn){Ne._currentValue2=Dn}},_threadCount:{get:function(){return Ne._threadCount},set:function(Dn){Ne._threadCount=Dn}},Consumer:{get:function(){return Me||(Me=!0,ct("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?")),Ne.Consumer}}}),Ne.Consumer=Hn}return Ne._currentRenderer=null,Ne._currentRenderer2=null,Ne}function Ht(X){var _e={$$typeof:Se,_ctor:X,_status:-1,_result:null};{var Ne,Me;Object.defineProperties(_e,{defaultProps:{configurable:!0,get:function(){return Ne},set:function(dt){ct("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),Ne=dt,Object.defineProperty(_e,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return Me},set:function(dt){ct("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),Me=dt,Object.defineProperty(_e,"propTypes",{enumerable:!0})}}})}return _e}function Du(X){return X!=null&&X.$$typeof===we?ct("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof X!="function"?ct("forwardRef requires a render function but was given %s.",X===null?"null":typeof X):X.length!==0&&X.length!==2&&ct("forwardRef render functions accept exactly two parameters: props and ref. %s",X.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),X!=null&&(X.defaultProps!=null||X.propTypes!=null)&&ct("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"),{$$typeof:W,render:X}}function Yi(X){return typeof X=="string"||typeof X=="function"||X===k||X===q||X===N||X===L||X===ne||X===m||typeof X=="object"&&X!==null&&(X.$$typeof===Se||X.$$typeof===we||X.$$typeof===C||X.$$typeof===U||X.$$typeof===W||X.$$typeof===ge||X.$$typeof===ze||X.$$typeof===pe||X.$$typeof===he)}function Y0(X,_e){return Yi(X)||ct("memo: The first argument must be a component. Instead received: %s",X===null?"null":typeof X),{$$typeof:we,type:X,compare:_e===void 0?null:_e}}function Ui(){var X=Ge.current;if(X===null)throw Error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: +1. You might have mismatching versions of React and the renderer (such as React DOM) +2. You might be breaking the Rules of Hooks +3. You might have more than one copy of React in the same app +See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.`);return X}function Wl(X,_e){var Ne=Ui();if(_e!==void 0&&ct("useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",_e,typeof _e=="number"&&Array.isArray(arguments[2])?` + +Did you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://fb.me/rules-of-hooks`:""),X._context!==void 0){var Me=X._context;Me.Consumer===X?ct("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):Me.Provider===X&&ct("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return Ne.useContext(X,_e)}function xo(X){var _e=Ui();return _e.useState(X)}function ni(X,_e,Ne){var Me=Ui();return Me.useReducer(X,_e,Ne)}function oo(X){var _e=Ui();return _e.useRef(X)}function Vl(X,_e){var Ne=Ui();return Ne.useEffect(X,_e)}function Ao(X,_e){var Ne=Ui();return Ne.useLayoutEffect(X,_e)}function Ms(X,_e){var Ne=Ui();return Ne.useCallback(X,_e)}function Xn(X,_e){var Ne=Ui();return Ne.useMemo(X,_e)}function Qo(X,_e,Ne){var Me=Ui();return Me.useImperativeHandle(X,_e,Ne)}function lo(X,_e){{var Ne=Ui();return Ne.useDebugValue(X,_e)}}var b0;b0=!1;function yl(){if(wt.current){var X=$t(wt.current.type);if(X)return` + +Check the render method of \``+X+"`."}return""}function Ro(X){if(X!==void 0){var _e=X.fileName.replace(/^.*[\\\/]/,""),Ne=X.lineNumber;return` + +Check your code at `+_e+":"+Ne+"."}return""}function Et(X){return X!=null?Ro(X.__source):""}var Pt={};function Bn(X){var _e=yl();if(!_e){var Ne=typeof X=="string"?X:X.displayName||X.name;Ne&&(_e=` + +Check the top-level render call using <`+Ne+">.")}return _e}function Ir(X,_e){if(!(!X._store||X._store.validated||X.key!=null)){X._store.validated=!0;var Ne=Bn(_e);if(!Pt[Ne]){Pt[Ne]=!0;var Me="";X&&X._owner&&X._owner!==wt.current&&(Me=" It was passed a child from "+$t(X._owner.type)+"."),ae(X),ct('Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',Ne,Me),ae(null)}}}function ji(X,_e){if(typeof X=="object"){if(Array.isArray(X))for(var Ne=0;Ne",dt=" Did you accidentally export a JSX literal instead of a component?"):Dn=typeof X,ct("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Dn,dt)}var or=_i.apply(this,arguments);if(or==null)return or;if(Me)for(var mi=2;mi{"use strict";process.env.NODE_ENV==="production"?WD.exports=k5():WD.exports=I5()});var B5=ce((nm,rg)=>{(function(){var i,o="4.17.21",f=200,p="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",E="Expected a function",t="Invalid `variable` option passed into `_.template`",k="__lodash_hash_undefined__",L=500,N="__lodash_placeholder__",C=1,U=2,q=4,W=1,ne=2,m=1,we=2,Se=4,he=8,ge=16,ze=32,pe=64,Oe=128,le=256,Ue=512,Ge=30,rt="...",wt=800,xt=16,$e=1,ft=2,Ke=3,jt=1/0,$t=9007199254740991,at=17976931348623157e292,Q=0/0,ae=4294967295,Ce=ae-1,ue=ae>>>1,je=[["ary",Oe],["bind",m],["bindKey",we],["curry",he],["curryRight",ge],["flip",Ue],["partial",ze],["partialRight",pe],["rearg",le]],ct="[object Arguments]",At="[object Array]",en="[object AsyncFunction]",ln="[object Boolean]",An="[object Date]",nr="[object DOMException]",un="[object Error]",Wt="[object Function]",vr="[object GeneratorFunction]",w="[object Map]",Ut="[object Number]",Vn="[object Null]",fr="[object Object]",Fr="[object Promise]",ur="[object Proxy]",br="[object RegExp]",Kt="[object Set]",vu="[object String]",a0="[object Symbol]",So="[object Undefined]",Go="[object WeakMap]",Os="[object WeakSet]",Yo="[object ArrayBuffer]",Ko="[object DataView]",qt="[object Float32Array]",_i="[object Float64Array]",eu="[object Int8Array]",ai="[object Int16Array]",mr="[object Int32Array]",Xo="[object Uint8Array]",W0="[object Uint8ClampedArray]",Lu="[object Uint16Array]",V0="[object Uint32Array]",Hr=/\b__p \+= '';/g,To=/\b(__p \+=) '' \+/g,Co=/(__e\(.*?\)|\b__t\)) \+\n'';/g,L0=/&(?:amp|lt|gt|quot|#39);/g,tu=/[&<>"']/g,Si=RegExp(L0.source),ks=RegExp(tu.source),Hl=/<%-([\s\S]+?)%>/g,F0=/<%([\s\S]+?)%>/g,f0=/<%=([\s\S]+?)%>/g,Pr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ei=/^\w*$/,G0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fi=/[\\^$.*+?()[\]{}|]/g,Zt=RegExp(fi.source),Ln=/^\s+/,Di=/\s/,ci=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ht=/\{\n\/\* \[wrapped with (.+)\] \*/,Du=/,? & /,Yi=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Y0=/[()=,{}\[\]\/\s]/,Ui=/\\(\\)?/g,Wl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,xo=/\w*$/,ni=/^[-+]0x[0-9a-f]+$/i,oo=/^0b[01]+$/i,Vl=/^\[object .+?Constructor\]$/,Ao=/^0o[0-7]+$/i,Ms=/^(?:0|[1-9]\d*)$/,Xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qo=/($^)/,lo=/['\n\r\u2028\u2029\\]/g,b0="\\ud800-\\udfff",yl="\\u0300-\\u036f",Ro="\\ufe20-\\ufe2f",Et="\\u20d0-\\u20ff",Pt=yl+Ro+Et,Bn="\\u2700-\\u27bf",Ir="a-z\\xdf-\\xf6\\xf8-\\xff",ji="\\xac\\xb1\\xd7\\xf7",Wr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",wu="\\u2000-\\u206f",c0=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ti="A-Z\\xc0-\\xd6\\xd8-\\xde",d0="\\ufe0e\\ufe0f",as=ji+Wr+wu+c0,St="['\u2019]",so="["+b0+"]",Jo="["+as+"]",Gl="["+Pt+"]",Fu="\\d+",fs="["+Bn+"]",P0="["+Ir+"]",X="[^"+b0+as+Fu+Bn+Ir+Ti+"]",_e="\\ud83c[\\udffb-\\udfff]",Ne="(?:"+Gl+"|"+_e+")",Me="[^"+b0+"]",dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Hn="[\\ud800-\\udbff][\\udc00-\\udfff]",Dn="["+Ti+"]",or="\\u200d",mi="(?:"+P0+"|"+X+")",Su="(?:"+Dn+"|"+X+")",bu="(?:"+St+"(?:d|ll|m|re|s|t|ve))?",Pu="(?:"+St+"(?:D|LL|M|RE|S|T|VE))?",mu=Ne+"?",yi="["+d0+"]?",Oo="(?:"+or+"(?:"+[Me,dt,Hn].join("|")+")"+yi+mu+")*",Tu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ao="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Iu=yi+mu+Oo,Oa="(?:"+[fs,dt,Hn].join("|")+")"+Iu,p0="(?:"+[Me+Gl+"?",Gl,dt,Hn,so].join("|")+")",Zs=RegExp(St,"g"),K0=RegExp(Gl,"g"),$s=RegExp(_e+"(?="+_e+")|"+p0+Iu,"g"),ka=RegExp([Dn+"?"+P0+"+"+bu+"(?="+[Jo,Dn,"$"].join("|")+")",Su+"+"+Pu+"(?="+[Jo,Dn+mi,"$"].join("|")+")",Dn+"?"+mi+"+"+bu,Dn+"+"+Pu,ao,Tu,Fu,Oa].join("|"),"g"),cs=RegExp("["+or+b0+Pt+d0+"]"),w0=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Gn=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ic=-1,ri={};ri[qt]=ri[_i]=ri[eu]=ri[ai]=ri[mr]=ri[Xo]=ri[W0]=ri[Lu]=ri[V0]=!0,ri[ct]=ri[At]=ri[Yo]=ri[ln]=ri[Ko]=ri[An]=ri[un]=ri[Wt]=ri[w]=ri[Ut]=ri[fr]=ri[br]=ri[Kt]=ri[vu]=ri[Go]=!1;var Gr={};Gr[ct]=Gr[At]=Gr[Yo]=Gr[Ko]=Gr[ln]=Gr[An]=Gr[qt]=Gr[_i]=Gr[eu]=Gr[ai]=Gr[mr]=Gr[w]=Gr[Ut]=Gr[fr]=Gr[br]=Gr[Kt]=Gr[vu]=Gr[a0]=Gr[Xo]=Gr[W0]=Gr[Lu]=Gr[V0]=!0,Gr[un]=Gr[Wt]=Gr[Go]=!1;var Yl={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},ea={"&":"&","<":"<",">":">",'"':""","'":"'"},lf={"&":"&","<":"<",">":">",""":'"',"'":"'"},Ns={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ma=parseFloat,Ls=parseInt,h0=typeof global=="object"&&global&&global.Object===Object&&global,Fs=typeof self=="object"&&self&&self.Object===Object&&self,Ni=h0||Fs||Function("return this")(),B=typeof nm=="object"&&nm&&!nm.nodeType&&nm,z=B&&typeof rg=="object"&&rg&&!rg.nodeType&&rg,G=z&&z.exports===B,$=G&&h0.process,De=function(){try{var Te=z&&z.require&&z.require("util").types;return Te||$&&$.binding&&$.binding("util")}catch(et){}}(),me=De&&De.isArrayBuffer,xe=De&&De.isDate,Z=De&&De.isMap,ke=De&&De.isRegExp,Xe=De&&De.isSet,ht=De&&De.isTypedArray;function ie(Te,et,Ve){switch(Ve.length){case 0:return Te.call(et);case 1:return Te.call(et,Ve[0]);case 2:return Te.call(et,Ve[0],Ve[1]);case 3:return Te.call(et,Ve[0],Ve[1],Ve[2])}return Te.apply(et,Ve)}function qe(Te,et,Ve,Gt){for(var Yt=-1,sr=Te==null?0:Te.length;++Yt-1}function tn(Te,et,Ve){for(var Gt=-1,Yt=Te==null?0:Te.length;++Gt-1;);return Ve}function gl(Te,et){for(var Ve=Te.length;Ve--&&_t(et,Te[Ve],0)>-1;);return Ve}function af(Te,et){for(var Ve=Te.length,Gt=0;Ve--;)Te[Ve]===et&&++Gt;return Gt}var Mo=Yn(Yl),ds=Yn(ea);function bs(Te){return"\\"+Ns[Te]}function No(Te,et){return Te==null?i:Te[et]}function Lo(Te){return cs.test(Te)}function ps(Te){return w0.test(Te)}function Vu(Te){for(var et,Ve=[];!(et=Te.next()).done;)Ve.push(et.value);return Ve}function yu(Te){var et=-1,Ve=Array(Te.size);return Te.forEach(function(Gt,Yt){Ve[++et]=[Yt,Gt]}),Ve}function pi(Te,et){return function(Ve){return Te(et(Ve))}}function T0(Te,et){for(var Ve=-1,Gt=Te.length,Yt=0,sr=[];++Ve-1}function ia(d,v){var x=this.__data__,b=Ql(x,d);return b<0?(++this.size,x.push([d,v])):x[b][1]=v,this}to.prototype.clear=Na,to.prototype.delete=pf,to.prototype.get=uc,to.prototype.has=ms,to.prototype.set=ia;function B0(d){var v=-1,x=d==null?0:d.length;for(this.clear();++v=v?d:v)),d}function U0(d,v,x,b,H,ee){var de,ye=v&C,be=v&U,gt=v&q;if(x&&(de=H?x(d,b,H,ee):x(d)),de!==i)return de;if(!ku(d))return d;var Dt=Jn(d);if(Dt){if(de=Es(d),!ye)return Ji(d,de)}else{var Rt=Ou(d),rn=Rt==Wt||Rt==vr;if(Gs(d))return fc(d,ye);if(Rt==fr||Rt==ct||rn&&!H){if(de=be||rn?{}:vc(d),!ye)return be?Jl(d,tl(de,d)):t0(d,hf(de,d))}else{if(!Gr[Rt])return H?d:{};de=Dh(d,Rt,ye)}}ee||(ee=new el);var Rn=ee.get(d);if(Rn)return Rn;ee.set(d,de),L2(d)?d.forEach(function(ir){de.add(U0(ir,v,x,ir,d,ee))}):gp(d)&&d.forEach(function(ir,Zr){de.set(Zr,U0(ir,v,x,Zr,d,ee))});var $n=gt?be?rr:$c:be?fn:M0,Nr=Dt?i:$n(d);return tt(Nr||d,function(ir,Zr){Nr&&(Zr=ir,ir=d[Zr]),gs(de,Zr,U0(ir,v,x,Zr,d,ee))}),de}function vf(d){var v=M0(d);return function(x){return jc(x,d,v)}}function jc(d,v,x){var b=x.length;if(d==null)return!b;for(d=wn(d);b--;){var H=x[b],ee=v[H],de=d[H];if(de===i&&!(H in d)||!ee(de))return!1}return!0}function lc(d,v,x){if(typeof d!="function")throw new Kr(E);return Wa(function(){d.apply(i,x)},v)}function Sl(d,v,x,b){var H=-1,ee=on,de=!0,ye=d.length,be=[],gt=v.length;if(!ye)return be;x&&(v=Lt(v,di(x))),b?(ee=tn,de=!1):v.length>=f&&(ee=Zo,de=!1,v=new ho(v));e:for(;++HH?0:H+x),b=b===i||b>H?H:Cr(b),b<0&&(b+=H),b=x>b?0:Ep(b);x0&&x(ye)?v>1?bi(ye,v-1,x,b,H):gn(H,ye):b||(H[H.length]=ye)}return H}var g=dc(),y=dc(!0);function A(d,v){return d&&g(d,v,M0)}function F(d,v){return d&&y(d,v,M0)}function I(d,v){return bt(v,function(x){return Ea(d[x])})}function J(d,v){v=Us(v,d);for(var x=0,b=v.length;d!=null&&xv}function Mt(d,v){return d!=null&&ei.call(d,v)}function Er(d,v){return d!=null&&v in wn(d)}function $u(d,v,x){return d>=Wn(v,x)&&d=120&&Dt.length>=120)?new ho(de&&Dt):i}Dt=d[0];var Rt=-1,rn=ye[0];e:for(;++Rt-1;)ye!==d&&R0.call(ye,be,1),R0.call(d,be,1);return d}function u2(d,v){for(var x=d?v.length:0,b=x-1;x--;){var H=v[x];if(x==b||H!==ee){var ee=H;go(H)?R0.call(d,H,1):Cd(d,H)}}return d}function o2(d,v){return d+vs(y0()*(v-d+1))}function wd(d,v,x,b){for(var H=-1,ee=Xr(Ku((v-d)/(x||1)),0),de=Ve(ee);ee--;)de[b?ee:++H]=d,d+=x;return de}function Hc(d,v){var x="";if(!d||v<1||v>$t)return x;do v%2&&(x+=d),v=vs(v/2),v&&(d+=d);while(v);return x}function Mr(d,v){return r1(Nd(d,v,r0),d+"")}function l2(d){return ba(Ac(d))}function s2(d,v){var x=Ac(d);return yc(x,Zu(v,0,x.length))}function ja(d,v,x,b){if(!ku(d))return d;v=Us(v,d);for(var H=-1,ee=v.length,de=ee-1,ye=d;ye!=null&&++HH?0:H+v),x=x>H?H:x,x<0&&(x+=H),H=v>x?0:x-v>>>0,v>>>=0;for(var ee=Ve(H);++b>>1,de=d[ee];de!==null&&!Nl(de)&&(x?de<=v:de=f){var gt=v?null:mm(d);if(gt)return Q0(gt);de=!1,H=Zo,be=new ho}else be=v?[]:ye;e:for(;++b=b?d:rl(d,v,x)}var Kc=hs||function(d){return Ni.clearTimeout(d)};function fc(d,v){if(v)return d.slice();var x=d.length,b=Fi?Fi(x):new d.constructor(x);return d.copy(b),b}function cc(d){var v=new d.constructor(d.byteLength);return new A0(v).set(new A0(d)),v}function f2(d,v){var x=v?cc(d.buffer):d.buffer;return new d.constructor(x,d.byteOffset,d.byteLength)}function yh(d){var v=new d.constructor(d.source,xo.exec(d));return v.lastIndex=d.lastIndex,v}function gf(d){return Sr?wn(Sr.call(d)):{}}function Xc(d,v){var x=v?cc(d.buffer):d.buffer;return new d.constructor(x,d.byteOffset,d.length)}function gh(d,v){if(d!==v){var x=d!==i,b=d===null,H=d===d,ee=Nl(d),de=v!==i,ye=v===null,be=v===v,gt=Nl(v);if(!ye&&!gt&&!ee&&d>v||ee&&de&&be&&!ye&&!gt||b&&de&&be||!x&&be||!H)return 1;if(!b&&!ee&&!gt&&d=ye)return be;var gt=x[b];return be*(gt=="desc"?-1:1)}}return d.index-v.index}function js(d,v,x,b){for(var H=-1,ee=d.length,de=x.length,ye=-1,be=v.length,gt=Xr(ee-de,0),Dt=Ve(be+gt),Rt=!b;++ye1?x[H-1]:i,de=H>2?x[2]:i;for(ee=d.length>3&&typeof ee=="function"?(H--,ee):i,de&&io(x[0],x[1],de)&&(ee=H<3?i:ee,H=1),v=wn(v);++b-1?H[ee?v[de]:de]:i}}function Jc(d){return ol(function(v){var x=v.length,b=x,H=Ur.prototype.thru;for(d&&v.reverse();b--;){var ee=v[b];if(typeof ee!="function")throw new Kr(E);if(H&&!de&&Bo(ee)=="wrapper")var de=new Ur([],!0)}for(b=de?b:x;++b1&&ui.reverse(),Dt&&beye))return!1;var gt=ee.get(d),Dt=ee.get(v);if(gt&&Dt)return gt==v&&Dt==d;var Rt=-1,rn=!0,Rn=x&ne?new ho:i;for(ee.set(d,v),ee.set(v,d);++Rt1?"& ":"")+v[b],v=v.join(x>2?", ":" "),d.replace(ci,`{ +/* [wrapped with `+v+`] */ +`)}function $l(d){return Jn(d)||sl(d)||!!(co&&d&&d[co])}function go(d,v){var x=typeof d;return v=v==null?$t:v,!!v&&(x=="number"||x!="symbol"&&Ms.test(d))&&d>-1&&d%1==0&&d0){if(++v>=wt)return arguments[0]}else v=0;return d.apply(i,arguments)}}function yc(d,v){var x=-1,b=d.length,H=b-1;for(v=v===i?b:v;++x1?d[v-1]:i;return x=typeof x=="function"?(d.pop(),x):i,E2(d,x)});function Bh(d){var v=Y(d);return v.__chain__=!0,v}function Uh(d,v){return v(d),d}function h1(d,v){return v(d)}var Qd=ol(function(d){var v=d.length,x=v?d[0]:0,b=this.__wrapped__,H=function(ee){return Ia(ee,d)};return v>1||this.__actions__.length||!(b instanceof lt)||!go(x)?this.thru(H):(b=b.slice(x,+x+(v?1:0)),b.__actions__.push({func:h1,args:[H],thisArg:i}),new Ur(b,this.__chain__).thru(function(ee){return v&&!ee.length&&ee.push(i),ee}))});function jh(){return Bh(this)}function Jd(){return new Ur(this.value(),this.__chain__)}function zh(){this.__values__===i&&(this.__values__=lv(this.value()));var d=this.__index__>=this.__values__.length,v=d?i:this.__values__[this.__index__++];return{done:d,value:v}}function Cm(){return this}function xm(d){for(var v,x=this;x instanceof Jr;){var b=Fd(x);b.__index__=0,b.__values__=i,v?H.__wrapped__=b:v=b;var H=b;x=x.__wrapped__}return H.__wrapped__=d,v}function Of(){var d=this.__wrapped__;if(d instanceof lt){var v=d;return this.__actions__.length&&(v=new lt(this)),v=v.reverse(),v.__actions__.push({func:h1,args:[Hd],thisArg:i}),new Ur(v,this.__chain__)}return this.thru(Hd)}function kf(){return mh(this.__wrapped__,this.__actions__)}var D2=za(function(d,v,x){ei.call(d,x)?++d[x]:ju(d,x,1)});function Am(d,v,x){var b=Jn(d)?kt:n2;return x&&io(d,v,x)&&(v=i),b(d,zn(v,3))}function Zd(d,v){var x=Jn(d)?bt:zc;return x(d,zn(v,3))}var w2=xl(Bd),$d=xl(u1);function qh(d,v){return bi(v1(d,v),1)}function ep(d,v){return bi(v1(d,v),jt)}function Hh(d,v,x){return x=x===i?1:Cr(x),bi(v1(d,v),x)}function Wh(d,v){var x=Jn(d)?tt:_s;return x(d,zn(v,3))}function tp(d,v){var x=Jn(d)?Tt:oa;return x(d,zn(v,3))}var Rm=za(function(d,v,x){ei.call(d,x)?d[x].push(v):ju(d,x,[v])});function Om(d,v,x,b){d=al(d)?d:Ac(d),x=x&&!b?Cr(x):0;var H=d.length;return x<0&&(x=Xr(H+x,0)),_1(d)?x<=H&&d.indexOf(v,x)>-1:!!H&&_t(d,v,x)>-1}var km=Mr(function(d,v,x){var b=-1,H=typeof v=="function",ee=al(d)?Ve(d.length):[];return _s(d,function(de){ee[++b]=H?ie(v,de,x):Tl(de,v,x)}),ee}),Vh=za(function(d,v,x){ju(d,x,v)});function v1(d,v){var x=Jn(d)?Lt:Ed;return x(d,zn(v,3))}function Mm(d,v,x,b){return d==null?[]:(Jn(v)||(v=v==null?[]:[v]),x=b?i:x,Jn(x)||(x=x==null?[]:[x]),vo(d,v,x))}var np=za(function(d,v,x){d[x?0:1].push(v)},function(){return[[],[]]});function rp(d,v,x){var b=Jn(d)?lr:yr,H=arguments.length<3;return b(d,zn(v,4),x,H,_s)}function Nm(d,v,x){var b=Jn(d)?Qn:yr,H=arguments.length<3;return b(d,zn(v,4),x,H,oa)}function Lm(d,v){var x=Jn(d)?bt:zc;return x(d,C2(zn(v,3)))}function Gh(d){var v=Jn(d)?ba:l2;return v(d)}function Fm(d,v,x){(x?io(d,v,x):v===i)?v=1:v=Cr(v);var b=Jn(d)?Pa:s2;return b(d,v)}function bm(d){var v=Jn(d)?ua:nl;return v(d)}function ip(d){if(d==null)return 0;if(al(d))return _1(d)?Ki(d):d.length;var v=Ou(d);return v==w||v==Kt?d.size:Ba(d).length}function up(d,v,x){var b=Jn(d)?_r:hh;return x&&io(d,v,x)&&(v=i),b(d,zn(v,3))}var ya=Mr(function(d,v){if(d==null)return[];var x=v.length;return x>1&&io(d,v[0],v[1])?v=[]:x>2&&io(v[0],v[1],v[2])&&(v=[v[0]]),vo(d,bi(v,1),[])}),m1=ra||function(){return Ni.Date.now()};function op(d,v){if(typeof v!="function")throw new Kr(E);return d=Cr(d),function(){if(--d<1)return v.apply(this,arguments)}}function Yh(d,v,x){return v=x?i:v,v=d&&v==null?d.length:v,dn(d,Oe,i,i,i,i,v)}function S2(d,v){var x;if(typeof v!="function")throw new Kr(E);return d=Cr(d),function(){return--d>0&&(x=v.apply(this,arguments)),d<=1&&(v=i),x}}var y1=Mr(function(d,v,x){var b=m;if(x.length){var H=T0(x,dr(y1));b|=ze}return dn(d,b,v,x,H)}),Kh=Mr(function(d,v,x){var b=m|we;if(x.length){var H=T0(x,dr(Kh));b|=ze}return dn(v,b,d,x,H)});function lp(d,v,x){v=x?i:v;var b=dn(d,he,i,i,i,i,i,v);return b.placeholder=lp.placeholder,b}function Xh(d,v,x){v=x?i:v;var b=dn(d,ge,i,i,i,i,i,v);return b.placeholder=Xh.placeholder,b}function sp(d,v,x){var b,H,ee,de,ye,be,gt=0,Dt=!1,Rt=!1,rn=!0;if(typeof d!="function")throw new Kr(E);v=fl(v)||0,ku(x)&&(Dt=!!x.leading,Rt="maxWait"in x,ee=Rt?Xr(fl(x.maxWait)||0,v):ee,rn="trailing"in x?!!x.trailing:rn);function Rn(i0){var Ts=b,wo=H;return b=H=i,gt=i0,de=d.apply(wo,Ts),de}function $n(i0){return gt=i0,ye=Wa(Zr,v),Dt?Rn(i0):de}function Nr(i0){var Ts=i0-be,wo=i0-gt,Rv=v-Ts;return Rt?Wn(Rv,ee-wo):Rv}function ir(i0){var Ts=i0-be,wo=i0-gt;return be===i||Ts>=v||Ts<0||Rt&&wo>=ee}function Zr(){var i0=m1();if(ir(i0))return ui(i0);ye=Wa(Zr,Nr(i0))}function ui(i0){return ye=i,rn&&b?Rn(i0):(b=H=i,de)}function bl(){ye!==i&&Kc(ye),gt=0,b=be=H=ye=i}function Wi(){return ye===i?de:ui(m1())}function uo(){var i0=m1(),Ts=ir(i0);if(b=arguments,H=this,be=i0,Ts){if(ye===i)return $n(be);if(Rt)return Kc(ye),ye=Wa(Zr,v),Rn(be)}return ye===i&&(ye=Wa(Zr,v)),de}return uo.cancel=bl,uo.flush=Wi,uo}var Qh=Mr(function(d,v){return lc(d,1,v)}),Jh=Mr(function(d,v,x){return lc(d,fl(v)||0,x)});function ap(d){return dn(d,Ue)}function T2(d,v){if(typeof d!="function"||v!=null&&typeof v!="function")throw new Kr(E);var x=function(){var b=arguments,H=v?v.apply(this,b):b[0],ee=x.cache;if(ee.has(H))return ee.get(H);var de=d.apply(this,b);return x.cache=ee.set(H,de)||ee,de};return x.cache=new(T2.Cache||B0),x}T2.Cache=B0;function C2(d){if(typeof d!="function")throw new Kr(E);return function(){var v=arguments;switch(v.length){case 0:return!d.call(this);case 1:return!d.call(this,v[0]);case 2:return!d.call(this,v[0],v[1]);case 3:return!d.call(this,v[0],v[1],v[2])}return!d.apply(this,v)}}function z0(d){return S2(2,d)}var x2=Rd(function(d,v){v=v.length==1&&Jn(v[0])?Lt(v[0],di(zn())):Lt(bi(v,1),di(zn()));var x=v.length;return Mr(function(b){for(var H=-1,ee=Wn(b.length,x);++H=v}),sl=e0(function(){return arguments}())?e0:function(d){return zu(d)&&ei.call(d,"callee")&&!I0.call(d,"callee")},Jn=Ve.isArray,Vs=me?di(me):He;function al(d){return d!=null&&M2(d.length)&&!Ea(d)}function n0(d){return zu(d)&&al(d)}function ev(d){return d===!0||d===!1||zu(d)&&mt(d)==ln}var Gs=$0||Ip,hp=xe?di(xe):Be;function jm(d){return zu(d)&&d.nodeType===1&&!Ec(d)}function tv(d){if(d==null)return!0;if(al(d)&&(Jn(d)||typeof d=="string"||typeof d.splice=="function"||Gs(d)||Da(d)||sl(d)))return!d.length;var v=Ou(d);if(v==w||v==Kt)return!d.size;if(xf(d))return!Ba(d).length;for(var x in d)if(ei.call(d,x))return!1;return!0}function vp(d,v){return ut(d,v)}function zm(d,v,x){x=typeof x=="function"?x:i;var b=x?x(d,v):i;return b===i?ut(d,v,i,x):!!b}function mp(d){if(!zu(d))return!1;var v=mt(d);return v==un||v==nr||typeof d.message=="string"&&typeof d.name=="string"&&!Ec(d)}function _c(d){return typeof d=="number"&&Xi(d)}function Ea(d){if(!ku(d))return!1;var v=mt(d);return v==Wt||v==vr||v==en||v==ur}function yp(d){return typeof d=="number"&&d==Cr(d)}function M2(d){return typeof d=="number"&&d>-1&&d%1==0&&d<=$t}function ku(d){var v=typeof d;return d!=null&&(v=="object"||v=="function")}function zu(d){return d!=null&&typeof d=="object"}var gp=Z?di(Z):jn;function _p(d,v){return d===v||ti(d,v,Pn(v))}function nv(d,v,x){return x=typeof x=="function"?x:i,ti(d,v,Pn(v),x)}function qm(d){return rv(d)&&d!=+d}function Hm(d){if(Al(d))throw new Yt(p);return tr(d)}function Wm(d){return d===null}function N2(d){return d==null}function rv(d){return typeof d=="number"||zu(d)&&mt(d)==Ut}function Ec(d){if(!zu(d)||mt(d)!=fr)return!1;var v=$o(d);if(v===null)return!0;var x=ei.call(v,"constructor")&&v.constructor;return typeof x=="function"&&x instanceof x&&Au.call(x)==na}var g1=ke?di(ke):ii;function Vm(d){return yp(d)&&d>=-$t&&d<=$t}var L2=Xe?di(Xe):qi;function _1(d){return typeof d=="string"||!Jn(d)&&zu(d)&&mt(d)==vu}function Nl(d){return typeof d=="symbol"||zu(d)&&mt(d)==a0}var Da=ht?di(ht):jr;function iv(d){return d===i}function Gm(d){return zu(d)&&Ou(d)==Go}function uv(d){return zu(d)&&mt(d)==Os}var ov=p2(r2),Ym=p2(function(d,v){return d<=v});function lv(d){if(!d)return[];if(al(d))return _1(d)?Yr(d):Ji(d);if(Ru&&d[Ru])return Vu(d[Ru]());var v=Ou(d),x=v==w?yu:v==Kt?Q0:Ac;return x(d)}function wa(d){if(!d)return d===0?d:0;if(d=fl(d),d===jt||d===-jt){var v=d<0?-1:1;return v*at}return d===d?d:0}function Cr(d){var v=wa(d),x=v%1;return v===v?x?v-x:v:0}function Ep(d){return d?Zu(Cr(d),0,ae):0}function fl(d){if(typeof d=="number")return d;if(Nl(d))return Q;if(ku(d)){var v=typeof d.valueOf=="function"?d.valueOf():d;d=ku(v)?v+"":v}if(typeof d!="string")return d===0?d:+d;d=xu(d);var x=oo.test(d);return x||Ao.test(d)?Ls(d.slice(2),x?2:8):ni.test(d)?Q:+d}function cu(d){return O0(d,fn(d))}function E1(d){return d?Zu(Cr(d),-$t,$t):d===0?d:0}function ki(d){return d==null?"":il(d)}var Dp=no(function(d,v){if(xf(v)||al(v)){O0(v,M0(v),d);return}for(var x in v)ei.call(v,x)&&gs(d,x,v[x])}),F2=no(function(d,v){O0(v,fn(v),d)}),Do=no(function(d,v,x,b){O0(v,fn(v),d,b)}),Ss=no(function(d,v,x,b){O0(v,M0(v),d,b)}),Mf=ol(Ia);function b2(d,v){var x=Qr(d);return v==null?x:hf(x,v)}var wp=Mr(function(d,v){d=wn(d);var x=-1,b=v.length,H=b>2?v[2]:i;for(H&&io(v[0],v[1],H)&&(b=1);++x1),ee}),O0(d,rr(d),x),b&&(x=U0(x,C|U|q,ym));for(var H=v.length;H--;)Cd(x,v[H]);return x});function T1(d,v){return Ka(d,C2(zn(v)))}var Cp=ol(function(d,v){return d==null?{}:dh(d,v)});function Ka(d,v){if(d==null)return{};var x=Lt(rr(d),function(b){return[b]});return v=zn(v),ph(d,x,function(b,H){return v(b,H[0])})}function Km(d,v,x){v=Us(v,d);var b=-1,H=v.length;for(H||(H=1,d=i);++bv){var b=d;d=v,v=b}if(x||d%1||v%1){var H=y0();return Wn(d+H*(v-d+Ma("1e-"+((H+"").length-1))),v)}return o2(d,v)}var q2=_f(function(d,v,x){return v=v.toLowerCase(),d+(x?Uo(v):v)});function Uo(d){return Rp(ki(d).toLowerCase())}function H2(d){return d=ki(d),d&&d.replace(Xn,Mo).replace(K0,"")}function Qm(d,v,x){d=ki(d),v=il(v);var b=d.length;x=x===i?b:Zu(Cr(x),0,b);var H=x;return x-=v.length,x>=0&&d.slice(x,H)==v}function A1(d){return d=ki(d),d&&ks.test(d)?d.replace(tu,ds):d}function Jm(d){return d=ki(d),d&&Zt.test(d)?d.replace(fi,"\\$&"):d}var Zm=_f(function(d,v,x){return d+(x?"-":"")+v.toLowerCase()}),av=_f(function(d,v,x){return d+(x?" ":"")+v.toLowerCase()}),$m=_h("toLowerCase");function fv(d,v,x){d=ki(d),v=Cr(v);var b=v?Ki(d):0;if(!v||b>=v)return d;var H=(v-b)/2;return da(vs(H),x)+d+da(Ku(H),x)}function ey(d,v,x){d=ki(d),v=Cr(v);var b=v?Ki(d):0;return v&&b>>0,x?(d=ki(d),d&&(typeof v=="string"||v!=null&&!g1(v))&&(v=il(v),!v&&Lo(d))?aa(Yr(d),0,x):d.split(v,x)):[]}var bf=_f(function(d,v,x){return d+(x?" ":"")+Rp(v)});function dv(d,v,x){return d=ki(d),x=x==null?0:Zu(Cr(x),0,d.length),v=il(v),d.slice(x,x+v.length)==v}function pv(d,v,x){var b=Y.templateSettings;x&&io(d,v,x)&&(v=i),d=ki(d),v=Do({},v,b,Df);var H=Do({},v.imports,b.imports,Df),ee=M0(H),de=ko(H,ee),ye,be,gt=0,Dt=v.interpolate||Qo,Rt="__p += '",rn=fu((v.escape||Qo).source+"|"+Dt.source+"|"+(Dt===f0?Wl:Qo).source+"|"+(v.evaluate||Qo).source+"|$","g"),Rn="//# sourceURL="+(ei.call(v,"sourceURL")?(v.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ic+"]")+` +`;d.replace(rn,function(ir,Zr,ui,bl,Wi,uo){return ui||(ui=bl),Rt+=d.slice(gt,uo).replace(lo,bs),Zr&&(ye=!0,Rt+=`' + +__e(`+Zr+`) + +'`),Wi&&(be=!0,Rt+=`'; +`+Wi+`; +__p += '`),ui&&(Rt+=`' + +((__t = (`+ui+`)) == null ? '' : __t) + +'`),gt=uo+ir.length,ir}),Rt+=`'; +`;var $n=ei.call(v,"variable")&&v.variable;if(!$n)Rt=`with (obj) { +`+Rt+` +} +`;else if(Y0.test($n))throw new Yt(t);Rt=(be?Rt.replace(Hr,""):Rt).replace(To,"$1").replace(Co,"$1;"),Rt="function("+($n||"obj")+`) { +`+($n?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(ye?", __e = _.escape":"")+(be?`, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +`:`; +`)+Rt+`return __p +}`;var Nr=_v(function(){return sr(ee,Rn+"return "+Rt).apply(i,de)});if(Nr.source=Rt,mp(Nr))throw Nr;return Nr}function hv(d){return ki(d).toLowerCase()}function W2(d){return ki(d).toUpperCase()}function V2(d,v,x){if(d=ki(d),d&&(x||v===i))return xu(d);if(!d||!(v=il(v)))return d;var b=Yr(d),H=Yr(v),ee=sf(b,H),de=gl(b,H)+1;return aa(b,ee,de).join("")}function Ap(d,v,x){if(d=ki(d),d&&(x||v===i))return d.slice(0,fo(d)+1);if(!d||!(v=il(v)))return d;var b=Yr(d),H=gl(b,Yr(v))+1;return aa(b,0,H).join("")}function vv(d,v,x){if(d=ki(d),d&&(x||v===i))return d.replace(Ln,"");if(!d||!(v=il(v)))return d;var b=Yr(d),H=sf(b,Yr(v));return aa(b,H).join("")}function G2(d,v){var x=Ge,b=rt;if(ku(v)){var H="separator"in v?v.separator:H;x="length"in v?Cr(v.length):x,b="omission"in v?il(v.omission):b}d=ki(d);var ee=d.length;if(Lo(d)){var de=Yr(d);ee=de.length}if(x>=ee)return d;var ye=x-Ki(b);if(ye<1)return b;var be=de?aa(de,0,ye).join(""):d.slice(0,ye);if(H===i)return be+b;if(de&&(ye+=be.length-ye),g1(H)){if(d.slice(ye).search(H)){var gt,Dt=be;for(H.global||(H=fu(H.source,ki(xo.exec(H))+"g")),H.lastIndex=0;gt=H.exec(Dt);)var Rt=gt.index;be=be.slice(0,Rt===i?ye:Rt)}}else if(d.indexOf(il(H),ye)!=ye){var rn=be.lastIndexOf(H);rn>-1&&(be=be.slice(0,rn))}return be+b}function mv(d){return d=ki(d),d&&Si.test(d)?d.replace(L0,Oi):d}var yv=_f(function(d,v,x){return d+(x?" ":"")+v.toUpperCase()}),Rp=_h("toUpperCase");function gv(d,v,x){return d=ki(d),v=x?i:v,v===i?ps(d)?cf(d):v0(d):d.match(v)||[]}var _v=Mr(function(d,v){try{return ie(d,i,v)}catch(x){return mp(x)?x:new Yt(x)}}),uy=ol(function(d,v){return tt(v,function(x){x=Rl(x),ju(d,x,y1(d[x],d))}),d});function Ev(d){var v=d==null?0:d.length,x=zn();return d=v?Lt(d,function(b){if(typeof b[1]!="function")throw new Kr(E);return[x(b[0]),b[1]]}):[],Mr(function(b){for(var H=-1;++H$t)return[];var x=ae,b=Wn(d,ae);v=zn(v),d-=ae;for(var H=S0(b,v);++x0||v<0)?new lt(x):(d<0?x=x.takeRight(-d):d&&(x=x.drop(d)),v!==i&&(v=Cr(v),x=v<0?x.dropRight(-v):x.take(v-d)),x)},lt.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},lt.prototype.toArray=function(){return this.take(ae)},A(lt.prototype,function(d,v){var x=/^(?:filter|find|map|reject)|While$/.test(v),b=/^(?:head|last)$/.test(v),H=Y[b?"take"+(v=="last"?"Right":""):v],ee=b||/^find/.test(v);!H||(Y.prototype[v]=function(){var de=this.__wrapped__,ye=b?[1]:arguments,be=de instanceof lt,gt=ye[0],Dt=be||Jn(de),Rt=function(Zr){var ui=H.apply(Y,gn([Zr],ye));return b&&rn?ui[0]:ui};Dt&&x&&typeof gt=="function"&>.length!=1&&(be=Dt=!1);var rn=this.__chain__,Rn=!!this.__actions__.length,$n=ee&&!rn,Nr=be&&!Rn;if(!ee&&Dt){de=Nr?de:new lt(this);var ir=d.apply(de,ye);return ir.__actions__.push({func:h1,args:[Rt],thisArg:i}),new Ur(ir,rn)}return $n&&Nr?d.apply(this,ye):(ir=this.thru(Rt),$n?b?ir.value()[0]:ir.value():ir)})}),tt(["pop","push","shift","sort","splice","unshift"],function(d){var v=Vr[d],x=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",b=/^(?:pop|shift)$/.test(d);Y.prototype[d]=function(){var H=arguments;if(b&&!this.__chain__){var ee=this.value();return v.apply(Jn(ee)?ee:[],H)}return this[x](function(de){return v.apply(Jn(de)?de:[],H)})}}),A(lt.prototype,function(d,v){var x=Y[v];if(x){var b=x.name+"";ei.call(xn,b)||(xn[b]=[]),xn[b].push({name:v,func:x})}}),xn[ca(i,we).name]=[{name:"wrapper",func:i}],lt.prototype.clone=hi,lt.prototype.reverse=Qi,lt.prototype.value=g0,Y.prototype.at=Qd,Y.prototype.chain=jh,Y.prototype.commit=Jd,Y.prototype.next=zh,Y.prototype.plant=xm,Y.prototype.reverse=Of,Y.prototype.toJSON=Y.prototype.valueOf=Y.prototype.value=kf,Y.prototype.first=Y.prototype.head,Ru&&(Y.prototype[Ru]=Cm),Y},Z0=J0();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ni._=Z0,define(function(){return Z0})):z?((z.exports=Z0)._=Z0,B._=Z0):Ni._=Z0}).call(nm)});var GD=ce((Dne,VD)=>{"use strict";var Ai=VD.exports;VD.exports.default=Ai;var hu="[",ig="]",rm="\x07",$_=";",U5=process.env.TERM_PROGRAM==="Apple_Terminal";Ai.cursorTo=(i,o)=>{if(typeof i!="number")throw new TypeError("The `x` argument is required");return typeof o!="number"?hu+(i+1)+"G":hu+(o+1)+";"+(i+1)+"H"};Ai.cursorMove=(i,o)=>{if(typeof i!="number")throw new TypeError("The `x` argument is required");let f="";return i<0?f+=hu+-i+"D":i>0&&(f+=hu+i+"C"),o<0?f+=hu+-o+"A":o>0&&(f+=hu+o+"B"),f};Ai.cursorUp=(i=1)=>hu+i+"A";Ai.cursorDown=(i=1)=>hu+i+"B";Ai.cursorForward=(i=1)=>hu+i+"C";Ai.cursorBackward=(i=1)=>hu+i+"D";Ai.cursorLeft=hu+"G";Ai.cursorSavePosition=U5?"7":hu+"s";Ai.cursorRestorePosition=U5?"8":hu+"u";Ai.cursorGetPosition=hu+"6n";Ai.cursorNextLine=hu+"E";Ai.cursorPrevLine=hu+"F";Ai.cursorHide=hu+"?25l";Ai.cursorShow=hu+"?25h";Ai.eraseLines=i=>{let o="";for(let f=0;f[ig,"8",$_,$_,o,rm,i,ig,"8",$_,$_,rm].join("");Ai.image=(i,o={})=>{let f=`${ig}1337;File=inline=1`;return o.width&&(f+=`;width=${o.width}`),o.height&&(f+=`;height=${o.height}`),o.preserveAspectRatio===!1&&(f+=";preserveAspectRatio=0"),f+":"+i.toString("base64")+rm};Ai.iTerm={setCwd:(i=process.cwd())=>`${ig}50;CurrentDir=${i}${rm}`,annotation:(i,o={})=>{let f=`${ig}1337;`,p=typeof o.x!="undefined",E=typeof o.y!="undefined";if((p||E)&&!(p&&E&&typeof o.length!="undefined"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return i=i.replace(/\|/g,""),f+=o.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",o.length>0?f+=(p?[i,o.length,o.x,o.y]:[o.length,i]).join("|"):f+=i,f+rm}}});var z5=ce((wne,YD)=>{"use strict";var j5=(i,o)=>{for(let f of Reflect.ownKeys(o))Object.defineProperty(i,f,Object.getOwnPropertyDescriptor(o,f));return i};YD.exports=j5;YD.exports.default=j5});var H5=ce((Sne,e4)=>{"use strict";var UK=z5(),t4=new WeakMap,q5=(i,o={})=>{if(typeof i!="function")throw new TypeError("Expected a function");let f,p=0,E=i.displayName||i.name||"",t=function(...k){if(t4.set(t,++p),p===1)f=i.apply(this,k),i=null;else if(o.throw===!0)throw new Error(`Function \`${E}\` can only be called once`);return f};return UK(t,i),t4.set(t,p),t};e4.exports=q5;e4.exports.default=q5;e4.exports.callCount=i=>{if(!t4.has(i))throw new Error(`The given function \`${i.name}\` is not wrapped by the \`onetime\` package`);return t4.get(i)}});var W5=ce((Tne,n4)=>{n4.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&n4.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&n4.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var JD=ce((Cne,ug)=>{var jK=require("assert"),og=W5(),zK=/^win/i.test(process.platform),r4=require("events");typeof r4!="function"&&(r4=r4.EventEmitter);var zl;process.__signal_exit_emitter__?zl=process.__signal_exit_emitter__:(zl=process.__signal_exit_emitter__=new r4,zl.count=0,zl.emitted={});zl.infinite||(zl.setMaxListeners(Infinity),zl.infinite=!0);ug.exports=function(i,o){jK.equal(typeof i,"function","a callback must be provided for exit handler"),lg===!1&&V5();var f="exit";o&&o.alwaysLast&&(f="afterexit");var p=function(){zl.removeListener(f,i),zl.listeners("exit").length===0&&zl.listeners("afterexit").length===0&&KD()};return zl.on(f,i),p};ug.exports.unload=KD;function KD(){!lg||(lg=!1,og.forEach(function(i){try{process.removeListener(i,XD[i])}catch(o){}}),process.emit=QD,process.reallyExit=G5,zl.count-=1)}function im(i,o,f){zl.emitted[i]||(zl.emitted[i]=!0,zl.emit(i,o,f))}var XD={};og.forEach(function(i){XD[i]=function(){var f=process.listeners(i);f.length===zl.count&&(KD(),im("exit",null,i),im("afterexit",null,i),zK&&i==="SIGHUP"&&(i="SIGINT"),process.kill(process.pid,i))}});ug.exports.signals=function(){return og};ug.exports.load=V5;var lg=!1;function V5(){lg||(lg=!0,zl.count+=1,og=og.filter(function(i){try{return process.on(i,XD[i]),!0}catch(o){return!1}}),process.emit=HK,process.reallyExit=qK)}var G5=process.reallyExit;function qK(i){process.exitCode=i||0,im("exit",process.exitCode,null),im("afterexit",process.exitCode,null),G5.call(process,process.exitCode)}var QD=process.emit;function HK(i,o){if(i==="exit"){o!==void 0&&(process.exitCode=o);var f=QD.apply(this,arguments);return im("exit",process.exitCode,null),im("afterexit",process.exitCode,null),f}else return QD.apply(this,arguments)}});var K5=ce((xne,Y5)=>{"use strict";var WK=H5(),VK=JD();Y5.exports=WK(()=>{VK(()=>{process.stderr.write("[?25h")},{alwaysLast:!0})})});var ZD=ce(um=>{"use strict";var GK=K5(),i4=!1;um.show=(i=process.stderr)=>{!i.isTTY||(i4=!1,i.write("[?25h"))};um.hide=(i=process.stderr)=>{!i.isTTY||(GK(),i4=!0,i.write("[?25l"))};um.toggle=(i,o)=>{i!==void 0&&(i4=i),i4?um.show(o):um.hide(o)}});var Z5=ce(sg=>{"use strict";var X5=sg&&sg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(sg,"__esModule",{value:!0});var Q5=X5(GD()),J5=X5(ZD()),YK=(i,{showCursor:o=!1}={})=>{let f=0,p="",E=!1,t=k=>{!o&&!E&&(J5.default.hide(),E=!0);let L=k+` +`;L!==p&&(p=L,i.write(Q5.default.eraseLines(f)+L),f=L.split(` +`).length)};return t.clear=()=>{i.write(Q5.default.eraseLines(f)),p="",f=0},t.done=()=>{p="",f=0,o||(J5.default.show(),E=!1)},t};sg.default={create:YK}});var e9=ce((One,$5)=>{$5.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY_BUILD_BASE",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}}]});var r9=ce(Ra=>{"use strict";var t9=e9(),bc=process.env;Object.defineProperty(Ra,"_vendors",{value:t9.map(function(i){return i.constant})});Ra.name=null;Ra.isPR=null;t9.forEach(function(i){var o=Array.isArray(i.env)?i.env:[i.env],f=o.every(function(p){return n9(p)});if(Ra[i.constant]=f,f)switch(Ra.name=i.name,typeof i.pr){case"string":Ra.isPR=!!bc[i.pr];break;case"object":"env"in i.pr?Ra.isPR=i.pr.env in bc&&bc[i.pr.env]!==i.pr.ne:"any"in i.pr?Ra.isPR=i.pr.any.some(function(p){return!!bc[p]}):Ra.isPR=n9(i.pr);break;default:Ra.isPR=null}});Ra.isCI=!!(bc.CI||bc.CONTINUOUS_INTEGRATION||bc.BUILD_NUMBER||bc.RUN_ID||Ra.name);function n9(i){return typeof i=="string"?!!bc[i]:Object.keys(i).every(function(o){return bc[o]===i[o]})}});var u9=ce((Mne,i9)=>{"use strict";i9.exports=r9().isCI});var l9=ce((Nne,o9)=>{"use strict";var KK=i=>{let o=new Set;do for(let f of Reflect.ownKeys(i))o.add([i,f]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return o};o9.exports=(i,{include:o,exclude:f}={})=>{let p=E=>{let t=k=>typeof k=="string"?E===k:k.test(E);return o?o.some(t):f?!f.some(t):!0};for(let[E,t]of KK(i.constructor.prototype)){if(t==="constructor"||!p(t))continue;let k=Reflect.getOwnPropertyDescriptor(E,t);k&&typeof k.value=="function"&&(i[t]=i[t].bind(i))}return i}});var h9=ce($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});var om,ag,u4,o4,$D;typeof window=="undefined"||typeof MessageChannel!="function"?(lm=null,ew=null,tw=function(){if(lm!==null)try{var i=$i.unstable_now();lm(!0,i),lm=null}catch(o){throw setTimeout(tw,0),o}},s9=Date.now(),$i.unstable_now=function(){return Date.now()-s9},om=function(i){lm!==null?setTimeout(om,0,i):(lm=i,setTimeout(tw,0))},ag=function(i,o){ew=setTimeout(i,o)},u4=function(){clearTimeout(ew)},o4=function(){return!1},$D=$i.unstable_forceFrameRate=function(){}):(l4=window.performance,nw=window.Date,a9=window.setTimeout,f9=window.clearTimeout,typeof console!="undefined"&&(c9=window.cancelAnimationFrame,typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),typeof c9!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")),typeof l4=="object"&&typeof l4.now=="function"?$i.unstable_now=function(){return l4.now()}:(d9=nw.now(),$i.unstable_now=function(){return nw.now()-d9}),fg=!1,cg=null,s4=-1,rw=5,iw=0,o4=function(){return $i.unstable_now()>=iw},$D=function(){},$i.unstable_forceFrameRate=function(i){0>i||125f4(k,f))N!==void 0&&0>f4(N,k)?(i[p]=N,i[L]=f,p=L):(i[p]=k,i[t]=f,p=t);else if(N!==void 0&&0>f4(N,f))i[p]=N,i[L]=f,p=L;else break e}}return o}return null}function f4(i,o){var f=i.sortIndex-o.sortIndex;return f!==0?f:i.id-o.id}var Xf=[],dd=[],XK=1,Rs=null,ls=3,d4=!1,$p=!1,dg=!1;function p4(i){for(var o=uf(dd);o!==null;){if(o.callback===null)c4(dd);else if(o.startTime<=i)c4(dd),o.sortIndex=o.expirationTime,ow(Xf,o);else break;o=uf(dd)}}function lw(i){if(dg=!1,p4(i),!$p)if(uf(Xf)!==null)$p=!0,om(sw);else{var o=uf(dd);o!==null&&ag(lw,o.startTime-i)}}function sw(i,o){$p=!1,dg&&(dg=!1,u4()),d4=!0;var f=ls;try{for(p4(o),Rs=uf(Xf);Rs!==null&&(!(Rs.expirationTime>o)||i&&!o4());){var p=Rs.callback;if(p!==null){Rs.callback=null,ls=Rs.priorityLevel;var E=p(Rs.expirationTime<=o);o=$i.unstable_now(),typeof E=="function"?Rs.callback=E:Rs===uf(Xf)&&c4(Xf),p4(o)}else c4(Xf);Rs=uf(Xf)}if(Rs!==null)var t=!0;else{var k=uf(dd);k!==null&&ag(lw,k.startTime-o),t=!1}return t}finally{Rs=null,ls=f,d4=!1}}function p9(i){switch(i){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var QK=$D;$i.unstable_ImmediatePriority=1;$i.unstable_UserBlockingPriority=2;$i.unstable_NormalPriority=3;$i.unstable_IdlePriority=5;$i.unstable_LowPriority=4;$i.unstable_runWithPriority=function(i,o){switch(i){case 1:case 2:case 3:case 4:case 5:break;default:i=3}var f=ls;ls=i;try{return o()}finally{ls=f}};$i.unstable_next=function(i){switch(ls){case 1:case 2:case 3:var o=3;break;default:o=ls}var f=ls;ls=o;try{return i()}finally{ls=f}};$i.unstable_scheduleCallback=function(i,o,f){var p=$i.unstable_now();if(typeof f=="object"&&f!==null){var E=f.delay;E=typeof E=="number"&&0p?(i.sortIndex=E,ow(dd,i),uf(Xf)===null&&i===uf(dd)&&(dg?u4():dg=!0,ag(lw,E-p))):(i.sortIndex=f,ow(Xf,i),$p||d4||($p=!0,om(sw))),i};$i.unstable_cancelCallback=function(i){i.callback=null};$i.unstable_wrapCallback=function(i){var o=ls;return function(){var f=ls;ls=o;try{return i.apply(this,arguments)}finally{ls=f}}};$i.unstable_getCurrentPriorityLevel=function(){return ls};$i.unstable_shouldYield=function(){var i=$i.unstable_now();p4(i);var o=uf(Xf);return o!==Rs&&Rs!==null&&o!==null&&o.callback!==null&&o.startTime<=i&&o.expirationTime{"use strict";process.env.NODE_ENV!=="production"&&function(){"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var i=!1,o=!1,f=!0,p,E,t,k,L;if(typeof window=="undefined"||typeof MessageChannel!="function"){var N=null,C=null,U=function(){if(N!==null)try{var Et=Ri.unstable_now(),Pt=!0;N(Pt,Et),N=null}catch(Bn){throw setTimeout(U,0),Bn}},q=Date.now();Ri.unstable_now=function(){return Date.now()-q},p=function(Et){N!==null?setTimeout(p,0,Et):(N=Et,setTimeout(U,0))},E=function(Et,Pt){C=setTimeout(Et,Pt)},t=function(){clearTimeout(C)},k=function(){return!1},L=Ri.unstable_forceFrameRate=function(){}}else{var W=window.performance,ne=window.Date,m=window.setTimeout,we=window.clearTimeout;if(typeof console!="undefined"){var Se=window.requestAnimationFrame,he=window.cancelAnimationFrame;typeof Se!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),typeof he!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if(typeof W=="object"&&typeof W.now=="function")Ri.unstable_now=function(){return W.now()};else{var ge=ne.now();Ri.unstable_now=function(){return ne.now()-ge}}var ze=!1,pe=null,Oe=-1,le=5,Ue=0,Ge=300,rt=!1;if(o&&navigator!==void 0&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0){var wt=navigator.scheduling;k=function(){var Et=Ri.unstable_now();return Et>=Ue?rt||wt.isInputPending()?!0:Et>=Ge:!1},L=function(){rt=!0}}else k=function(){return Ri.unstable_now()>=Ue},L=function(){};Ri.unstable_forceFrameRate=function(Et){if(Et<0||Et>125){console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported");return}Et>0?le=Math.floor(1e3/Et):le=5};var xt=function(){if(pe!==null){var Et=Ri.unstable_now();Ue=Et+le;var Pt=!0;try{var Bn=pe(Pt,Et);Bn?ft.postMessage(null):(ze=!1,pe=null)}catch(Ir){throw ft.postMessage(null),Ir}}else ze=!1;rt=!1},$e=new MessageChannel,ft=$e.port2;$e.port1.onmessage=xt,p=function(Et){pe=Et,ze||(ze=!0,ft.postMessage(null))},E=function(Et,Pt){Oe=m(function(){Et(Ri.unstable_now())},Pt)},t=function(){we(Oe),Oe=-1}}function Ke(Et,Pt){var Bn=Et.length;Et.push(Pt),at(Et,Pt,Bn)}function jt(Et){var Pt=Et[0];return Pt===void 0?null:Pt}function $t(Et){var Pt=Et[0];if(Pt!==void 0){var Bn=Et.pop();return Bn!==Pt&&(Et[0]=Bn,Q(Et,Bn,0)),Pt}else return null}function at(Et,Pt,Bn){for(var Ir=Bn;;){var ji=Math.floor((Ir-1)/2),Wr=Et[ji];if(Wr!==void 0&&ae(Wr,Pt)>0)Et[ji]=Pt,Et[Ir]=Wr,Ir=ji;else return}}function Q(Et,Pt,Bn){for(var Ir=Bn,ji=Et.length;Irur){if(ur*=2,ur>Fr){console.error("Scheduler Profiling: Event log exceeded maximum size. Don't forget to call `stopLoggingProfilingEvents()`."),mr();return}var Bn=new Int32Array(ur*4);Bn.set(Kt),br=Bn.buffer,Kt=Bn}Kt.set(Et,Pt)}}function ai(){ur=fr,br=new ArrayBuffer(ur*4),Kt=new Int32Array(br),vu=0}function mr(){var Et=br;return ur=0,br=null,Kt=null,vu=0,Et}function Xo(Et,Pt){f&&(Wt[Vn]++,Kt!==null&&eu([a0,Pt*1e3,Et.id,Et.priorityLevel]))}function W0(Et,Pt){f&&(Wt[vr]=Ce,Wt[w]=0,Wt[Vn]--,Kt!==null&&eu([So,Pt*1e3,Et.id]))}function Lu(Et,Pt){f&&(Wt[Vn]--,Kt!==null&&eu([Os,Pt*1e3,Et.id]))}function V0(Et,Pt){f&&(Wt[vr]=Ce,Wt[w]=0,Wt[Vn]--,Kt!==null&&eu([Go,Pt*1e3,Et.id]))}function Hr(Et,Pt){f&&(ln++,Wt[vr]=Et.priorityLevel,Wt[w]=Et.id,Wt[Ut]=ln,Kt!==null&&eu([Yo,Pt*1e3,Et.id,ln]))}function To(Et,Pt){f&&(Wt[vr]=Ce,Wt[w]=0,Wt[Ut]=0,Kt!==null&&eu([Ko,Pt*1e3,Et.id,ln]))}function Co(Et){f&&(An++,Kt!==null&&eu([qt,Et*1e3,An]))}function L0(Et){f&&Kt!==null&&eu([_i,Et*1e3,An])}var tu=1073741823,Si=-1,ks=250,Hl=5e3,F0=1e4,f0=tu,Pr=[],Ei=[],G0=1,fi=!1,Zt=null,Ln=ct,Di=!1,ci=!1,Ht=!1;function Du(Et){for(var Pt=jt(Ei);Pt!==null;){if(Pt.callback===null)$t(Ei);else if(Pt.startTime<=Et)$t(Ei),Pt.sortIndex=Pt.expirationTime,Ke(Pr,Pt),f&&(Xo(Pt,Et),Pt.isQueued=!0);else return;Pt=jt(Ei)}}function Yi(Et){if(Ht=!1,Du(Et),!ci)if(jt(Pr)!==null)ci=!0,p(Y0);else{var Pt=jt(Ei);Pt!==null&&E(Yi,Pt.startTime-Et)}}function Y0(Et,Pt){f&&L0(Pt),ci=!1,Ht&&(Ht=!1,t()),Di=!0;var Bn=Ln;try{if(f)try{return Ui(Et,Pt)}catch(Wr){if(Zt!==null){var Ir=Ri.unstable_now();V0(Zt,Ir),Zt.isQueued=!1}throw Wr}else return Ui(Et,Pt)}finally{if(Zt=null,Ln=Bn,Di=!1,f){var ji=Ri.unstable_now();Co(ji)}}}function Ui(Et,Pt){var Bn=Pt;for(Du(Bn),Zt=jt(Pr);Zt!==null&&!(i&&fi)&&!(Zt.expirationTime>Bn&&(!Et||k()));){var Ir=Zt.callback;if(Ir!==null){Zt.callback=null,Ln=Zt.priorityLevel;var ji=Zt.expirationTime<=Bn;Hr(Zt,Bn);var Wr=Ir(ji);Bn=Ri.unstable_now(),typeof Wr=="function"?(Zt.callback=Wr,To(Zt,Bn)):(f&&(W0(Zt,Bn),Zt.isQueued=!1),Zt===jt(Pr)&&$t(Pr)),Du(Bn)}else $t(Pr);Zt=jt(Pr)}if(Zt!==null)return!0;var wu=jt(Ei);return wu!==null&&E(Yi,wu.startTime-Bn),!1}function Wl(Et,Pt){switch(Et){case ue:case je:case ct:case At:case en:break;default:Et=ct}var Bn=Ln;Ln=Et;try{return Pt()}finally{Ln=Bn}}function xo(Et){var Pt;switch(Ln){case ue:case je:case ct:Pt=ct;break;default:Pt=Ln;break}var Bn=Ln;Ln=Pt;try{return Et()}finally{Ln=Bn}}function ni(Et){var Pt=Ln;return function(){var Bn=Ln;Ln=Pt;try{return Et.apply(this,arguments)}finally{Ln=Bn}}}function oo(Et){switch(Et){case ue:return Si;case je:return ks;case en:return f0;case At:return F0;case ct:default:return Hl}}function Vl(Et,Pt,Bn){var Ir=Ri.unstable_now(),ji,Wr;if(typeof Bn=="object"&&Bn!==null){var wu=Bn.delay;typeof wu=="number"&&wu>0?ji=Ir+wu:ji=Ir,Wr=typeof Bn.timeout=="number"?Bn.timeout:oo(Et)}else Wr=oo(Et),ji=Ir;var c0=ji+Wr,Ti={id:G0++,callback:Pt,priorityLevel:Et,startTime:ji,expirationTime:c0,sortIndex:-1};return f&&(Ti.isQueued=!1),ji>Ir?(Ti.sortIndex=ji,Ke(Ei,Ti),jt(Pr)===null&&Ti===jt(Ei)&&(Ht?t():Ht=!0,E(Yi,ji-Ir))):(Ti.sortIndex=c0,Ke(Pr,Ti),f&&(Xo(Ti,Ir),Ti.isQueued=!0),!ci&&!Di&&(ci=!0,p(Y0))),Ti}function Ao(){fi=!0}function Ms(){fi=!1,!ci&&!Di&&(ci=!0,p(Y0))}function Xn(){return jt(Pr)}function Qo(Et){if(f&&Et.isQueued){var Pt=Ri.unstable_now();Lu(Et,Pt),Et.isQueued=!1}Et.callback=null}function lo(){return Ln}function b0(){var Et=Ri.unstable_now();Du(Et);var Pt=jt(Pr);return Pt!==Zt&&Zt!==null&&Pt!==null&&Pt.callback!==null&&Pt.startTime<=Et&&Pt.expirationTime{"use strict";process.env.NODE_ENV==="production"?aw.exports=h9():aw.exports=v9()});var m9=ce((Pne,pg)=>{pg.exports=function i(o){"use strict";var f=eg(),p=su(),E=h4();function t(g){for(var y="https://reactjs.org/docs/error-decoder.html?invariant="+g,A=1;AG0||(g.current=Ei[G0],Ei[G0]=null,G0--)}function Zt(g,y){G0++,Ei[G0]=g.current,g.current=y}var Ln={},Di={current:Ln},ci={current:!1},Ht=Ln;function Du(g,y){var A=g.type.contextTypes;if(!A)return Ln;var F=g.stateNode;if(F&&F.__reactInternalMemoizedUnmaskedChildContext===y)return F.__reactInternalMemoizedMaskedChildContext;var I={},J;for(J in A)I[J]=y[J];return F&&(g=g.stateNode,g.__reactInternalMemoizedUnmaskedChildContext=y,g.__reactInternalMemoizedMaskedChildContext=I),I}function Yi(g){return g=g.childContextTypes,g!=null}function Y0(g){fi(ci,g),fi(Di,g)}function Ui(g){fi(ci,g),fi(Di,g)}function Wl(g,y,A){if(Di.current!==Ln)throw Error(t(168));Zt(Di,y,g),Zt(ci,A,g)}function xo(g,y,A){var F=g.stateNode;if(g=y.childContextTypes,typeof F.getChildContext!="function")return A;F=F.getChildContext();for(var I in F)if(!(I in g))throw Error(t(108,Ge(y)||"Unknown",I));return f({},A,{},F)}function ni(g){var y=g.stateNode;return y=y&&y.__reactInternalMemoizedMergedChildContext||Ln,Ht=Di.current,Zt(Di,y,g),Zt(ci,ci.current,g),!0}function oo(g,y,A){var F=g.stateNode;if(!F)throw Error(t(169));A?(y=xo(g,y,Ht),F.__reactInternalMemoizedMergedChildContext=y,fi(ci,g),fi(Di,g),Zt(Di,y,g)):fi(ci,g),Zt(ci,A,g)}var Vl=E.unstable_runWithPriority,Ao=E.unstable_scheduleCallback,Ms=E.unstable_cancelCallback,Xn=E.unstable_shouldYield,Qo=E.unstable_requestPaint,lo=E.unstable_now,b0=E.unstable_getCurrentPriorityLevel,yl=E.unstable_ImmediatePriority,Ro=E.unstable_UserBlockingPriority,Et=E.unstable_NormalPriority,Pt=E.unstable_LowPriority,Bn=E.unstable_IdlePriority,Ir={},ji=Qo!==void 0?Qo:function(){},Wr=null,wu=null,c0=!1,Ti=lo(),d0=1e4>Ti?lo:function(){return lo()-Ti};function as(){switch(b0()){case yl:return 99;case Ro:return 98;case Et:return 97;case Pt:return 96;case Bn:return 95;default:throw Error(t(332))}}function St(g){switch(g){case 99:return yl;case 98:return Ro;case 97:return Et;case 96:return Pt;case 95:return Bn;default:throw Error(t(332))}}function so(g,y){return g=St(g),Vl(g,y)}function Jo(g,y,A){return g=St(g),Ao(g,y,A)}function Gl(g){return Wr===null?(Wr=[g],wu=Ao(yl,fs)):Wr.push(g),Ir}function Fu(){if(wu!==null){var g=wu;wu=null,Ms(g)}fs()}function fs(){if(!c0&&Wr!==null){c0=!0;var g=0;try{var y=Wr;so(99,function(){for(;g=y&&(fo=!0),g.firstContext=null)}function Tu(g,y){if(Su!==g&&y!==!1&&y!==0)if((typeof y!="number"||y===1073741823)&&(Su=g,y=1073741823),y={context:g,observedBits:y,next:null},mi===null){if(or===null)throw Error(t(308));mi=y,or.dependencies={expirationTime:0,firstContext:y,responders:null}}else mi=mi.next=y;return un?g._currentValue:g._currentValue2}var ao=!1;function Iu(g){return{baseState:g,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Oa(g){return{baseState:g.baseState,firstUpdate:g.firstUpdate,lastUpdate:g.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function p0(g,y){return{expirationTime:g,suspenseConfig:y,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function Zs(g,y){g.lastUpdate===null?g.firstUpdate=g.lastUpdate=y:(g.lastUpdate.next=y,g.lastUpdate=y)}function K0(g,y){var A=g.alternate;if(A===null){var F=g.updateQueue,I=null;F===null&&(F=g.updateQueue=Iu(g.memoizedState))}else F=g.updateQueue,I=A.updateQueue,F===null?I===null?(F=g.updateQueue=Iu(g.memoizedState),I=A.updateQueue=Iu(A.memoizedState)):F=g.updateQueue=Oa(I):I===null&&(I=A.updateQueue=Oa(F));I===null||F===I?Zs(F,y):F.lastUpdate===null||I.lastUpdate===null?(Zs(F,y),Zs(I,y)):(Zs(F,y),I.lastUpdate=y)}function $s(g,y){var A=g.updateQueue;A=A===null?g.updateQueue=Iu(g.memoizedState):ka(g,A),A.lastCapturedUpdate===null?A.firstCapturedUpdate=A.lastCapturedUpdate=y:(A.lastCapturedUpdate.next=y,A.lastCapturedUpdate=y)}function ka(g,y){var A=g.alternate;return A!==null&&y===A.updateQueue&&(y=g.updateQueue=Oa(y)),y}function cs(g,y,A,F,I,J){switch(A.tag){case 1:return g=A.payload,typeof g=="function"?g.call(J,F,I):g;case 3:g.effectTag=g.effectTag&-4097|64;case 0:if(g=A.payload,I=typeof g=="function"?g.call(J,F,I):g,I==null)break;return f({},F,I);case 2:ao=!0}return F}function w0(g,y,A,F,I){ao=!1,y=ka(g,y);for(var J=y.baseState,fe=null,mt=0,Ct=y.firstUpdate,Mt=J;Ct!==null;){var Er=Ct.expirationTime;Erii?(qi=tr,tr=null):qi=tr.sibling;var jr=iu(He,tr,ut[ii],Jt);if(jr===null){tr===null&&(tr=qi);break}g&&tr&&jr.alternate===null&&y(He,tr),Be=J(jr,Be,ii),ti===null?jn=jr:ti.sibling=jr,ti=jr,tr=qi}if(ii===ut.length)return A(He,tr),jn;if(tr===null){for(;iiii?(qi=tr,tr=null):qi=tr.sibling;var gu=iu(He,tr,jr.value,Jt);if(gu===null){tr===null&&(tr=qi);break}g&&tr&&gu.alternate===null&&y(He,tr),Be=J(gu,Be,ii),ti===null?jn=gu:ti.sibling=gu,ti=gu,tr=qi}if(jr.done)return A(He,tr),jn;if(tr===null){for(;!jr.done;ii++,jr=ut.next())jr=$u(He,jr.value,Jt),jr!==null&&(Be=J(jr,Be,ii),ti===null?jn=jr:ti.sibling=jr,ti=jr);return jn}for(tr=F(He,tr);!jr.done;ii++,jr=ut.next())jr=j0(tr,He,ii,jr.value,Jt),jr!==null&&(g&&jr.alternate!==null&&tr.delete(jr.key===null?ii:jr.key),Be=J(jr,Be,ii),ti===null?jn=jr:ti.sibling=jr,ti=jr);return g&&tr.forEach(function(Ba){return y(He,Ba)}),jn}return function(He,Be,ut,Jt){var jn=typeof ut=="object"&&ut!==null&&ut.type===U&&ut.key===null;jn&&(ut=ut.props.children);var ti=typeof ut=="object"&&ut!==null;if(ti)switch(ut.$$typeof){case N:e:{for(ti=ut.key,jn=Be;jn!==null;){if(jn.key===ti)if(jn.tag===7?ut.type===U:jn.elementType===ut.type){A(He,jn.sibling),Be=I(jn,ut.type===U?ut.props.children:ut.props,Jt),Be.ref=Fs(He,jn,ut),Be.return=He,He=Be;break e}else{A(He,jn);break}else y(He,jn);jn=jn.sibling}ut.type===U?(Be=Zu(ut.props.children,He.mode,Jt,ut.key),Be.return=He,He=Be):(Jt=Ia(ut.type,ut.key,ut.props,null,He.mode,Jt),Jt.ref=Fs(He,Be,ut),Jt.return=He,He=Jt)}return fe(He);case C:e:{for(jn=ut.key;Be!==null;){if(Be.key===jn)if(Be.tag===4&&Be.stateNode.containerInfo===ut.containerInfo&&Be.stateNode.implementation===ut.implementation){A(He,Be.sibling),Be=I(Be,ut.children||[],Jt),Be.return=He,He=Be;break e}else{A(He,Be);break}else y(He,Be);Be=Be.sibling}Be=vf(ut,He.mode,Jt),Be.return=He,He=Be}return fe(He)}if(typeof ut=="string"||typeof ut=="number")return ut=""+ut,Be!==null&&Be.tag===6?(A(He,Be.sibling),Be=I(Be,ut,Jt),Be.return=He,He=Be):(A(He,Be),Be=U0(ut,He.mode,Jt),Be.return=He,He=Be),fe(He);if(h0(ut))return Tl(He,Be,ut,Jt);if(le(ut))return e0(He,Be,ut,Jt);if(ti&&Ni(He,ut),typeof ut=="undefined"&&!jn)switch(He.tag){case 1:case 0:throw He=He.type,Error(t(152,He.displayName||He.name||"Component"))}return A(He,Be)}}var z=B(!0),G=B(!1),$={},De={current:$},me={current:$},xe={current:$};function Z(g){if(g===$)throw Error(t(174));return g}function ke(g,y){Zt(xe,y,g),Zt(me,g,g),Zt(De,$,g),y=jt(y),fi(De,g),Zt(De,y,g)}function Xe(g){fi(De,g),fi(me,g),fi(xe,g)}function ht(g){var y=Z(xe.current),A=Z(De.current);y=$t(A,g.type,y),A!==y&&(Zt(me,g,g),Zt(De,y,g))}function ie(g){me.current===g&&(fi(De,g),fi(me,g))}var qe={current:0};function tt(g){for(var y=g;y!==null;){if(y.tag===13){var A=y.memoizedState;if(A!==null&&(A=A.dehydrated,A===null||Hr(A)||To(A)))return y}else if(y.tag===19&&y.memoizedProps.revealOrder!==void 0){if((y.effectTag&64)!=0)return y}else if(y.child!==null){y.child.return=y,y=y.child;continue}if(y===g)break;for(;y.sibling===null;){if(y.return===null||y.return===g)return null;y=y.return}y.sibling.return=y.return,y=y.sibling}return null}function Tt(g,y){return{responder:g,props:y}}var kt=k.ReactCurrentDispatcher,bt=k.ReactCurrentBatchConfig,on=0,tn=null,Lt=null,gn=null,lr=null,Qn=null,_r=null,Cn=0,Ar=null,v0=0,Rr=!1,nt=null,_t=0;function Ze(){throw Error(t(321))}function Ft(g,y){if(y===null)return!1;for(var A=0;ACn&&(Cn=Er,La(Cn))):(oc(Er,Ct.suspenseConfig),J=Ct.eagerReducer===g?Ct.eagerState:g(J,Ct.action)),fe=Ct,Ct=Ct.next}while(Ct!==null&&Ct!==F);Mt||(mt=fe,I=J),Ne(J,y.memoizedState)||(fo=!0),y.memoizedState=J,y.baseUpdate=mt,y.baseState=I,A.lastRenderedState=J}return[y.memoizedState,A.dispatch]}function S0(g){var y=Yn();return typeof g=="function"&&(g=g()),y.memoizedState=y.baseState=g,g=y.queue={last:null,dispatch:null,lastRenderedReducer:nu,lastRenderedState:g},g=g.dispatch=bs.bind(null,tn,g),[y.memoizedState,g]}function X0(g){return Cu(nu,g)}function xu(g,y,A,F){return g={tag:g,create:y,destroy:A,deps:F,next:null},Ar===null?(Ar={lastEffect:null},Ar.lastEffect=g.next=g):(y=Ar.lastEffect,y===null?Ar.lastEffect=g.next=g:(A=y.next,y.next=g,g.next=A,Ar.lastEffect=g)),g}function di(g,y,A,F){var I=Yn();v0|=g,I.memoizedState=xu(y,A,void 0,F===void 0?null:F)}function ko(g,y,A,F){var I=yr();F=F===void 0?null:F;var J=void 0;if(Lt!==null){var fe=Lt.memoizedState;if(J=fe.destroy,F!==null&&Ft(F,fe.deps)){xu(0,A,J,F);return}}v0|=g,I.memoizedState=xu(y,A,J,F)}function Zo(g,y){return di(516,192,g,y)}function sf(g,y){return ko(516,192,g,y)}function gl(g,y){if(typeof y=="function")return g=g(),y(g),function(){y(null)};if(y!=null)return g=g(),y.current=g,function(){y.current=null}}function af(){}function Mo(g,y){return Yn().memoizedState=[g,y===void 0?null:y],g}function ds(g,y){var A=yr();y=y===void 0?null:y;var F=A.memoizedState;return F!==null&&y!==null&&Ft(y,F[1])?F[0]:(A.memoizedState=[g,y],g)}function bs(g,y,A){if(!(25>_t))throw Error(t(301));var F=g.alternate;if(g===tn||F!==null&&F===tn)if(Rr=!0,g={expirationTime:on,suspenseConfig:null,action:A,eagerReducer:null,eagerState:null,next:null},nt===null&&(nt=new Map),A=nt.get(y),A===void 0)nt.set(y,g);else{for(y=A;y.next!==null;)y=y.next;y.next=g}else{var I=g0(),J=ri.suspense;I=bn(I,g,J),J={expirationTime:I,suspenseConfig:J,action:A,eagerReducer:null,eagerState:null,next:null};var fe=y.last;if(fe===null)J.next=J;else{var mt=fe.next;mt!==null&&(J.next=mt),fe.next=J}if(y.last=J,g.expirationTime===0&&(F===null||F.expirationTime===0)&&(F=y.lastRenderedReducer,F!==null))try{var Ct=y.lastRenderedState,Mt=F(Ct,A);if(J.eagerReducer=F,J.eagerState=Mt,Ne(Mt,Ct))return}catch(Er){}finally{}Qu(g,I)}}var No={readContext:Tu,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useLayoutEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useResponder:Ze,useDeferredValue:Ze,useTransition:Ze},Lo={readContext:Tu,useCallback:Mo,useContext:Tu,useEffect:Zo,useImperativeHandle:function(g,y,A){return A=A!=null?A.concat([g]):null,di(4,36,gl.bind(null,y,g),A)},useLayoutEffect:function(g,y){return di(4,36,g,y)},useMemo:function(g,y){var A=Yn();return y=y===void 0?null:y,g=g(),A.memoizedState=[g,y],g},useReducer:function(g,y,A){var F=Yn();return y=A!==void 0?A(y):y,F.memoizedState=F.baseState=y,g=F.queue={last:null,dispatch:null,lastRenderedReducer:g,lastRenderedState:y},g=g.dispatch=bs.bind(null,tn,g),[F.memoizedState,g]},useRef:function(g){var y=Yn();return g={current:g},y.memoizedState=g},useState:S0,useDebugValue:af,useResponder:Tt,useDeferredValue:function(g,y){var A=S0(g),F=A[0],I=A[1];return Zo(function(){E.unstable_next(function(){var J=bt.suspense;bt.suspense=y===void 0?null:y;try{I(g)}finally{bt.suspense=J}})},[g,y]),F},useTransition:function(g){var y=S0(!1),A=y[0],F=y[1];return[Mo(function(I){F(!0),E.unstable_next(function(){var J=bt.suspense;bt.suspense=g===void 0?null:g;try{F(!1),I()}finally{bt.suspense=J}})},[g,A]),A]}},ps={readContext:Tu,useCallback:ds,useContext:Tu,useEffect:sf,useImperativeHandle:function(g,y,A){return A=A!=null?A.concat([g]):null,ko(4,36,gl.bind(null,y,g),A)},useLayoutEffect:function(g,y){return ko(4,36,g,y)},useMemo:function(g,y){var A=yr();y=y===void 0?null:y;var F=A.memoizedState;return F!==null&&y!==null&&Ft(y,F[1])?F[0]:(g=g(),A.memoizedState=[g,y],g)},useReducer:Cu,useRef:function(){return yr().memoizedState},useState:X0,useDebugValue:af,useResponder:Tt,useDeferredValue:function(g,y){var A=X0(g),F=A[0],I=A[1];return sf(function(){E.unstable_next(function(){var J=bt.suspense;bt.suspense=y===void 0?null:y;try{I(g)}finally{bt.suspense=J}})},[g,y]),F},useTransition:function(g){var y=X0(!1),A=y[0],F=y[1];return[ds(function(I){F(!0),E.unstable_next(function(){var J=bt.suspense;bt.suspense=g===void 0?null:g;try{F(!1),I()}finally{bt.suspense=J}})},[g,A]),A]}},Vu=null,yu=null,pi=!1;function T0(g,y){var A=Io(5,null,null,0);A.elementType="DELETED",A.type="DELETED",A.stateNode=y,A.return=g,A.effectTag=8,g.lastEffect!==null?(g.lastEffect.nextEffect=A,g.lastEffect=A):g.firstEffect=g.lastEffect=A}function Q0(g,y){switch(g.tag){case 5:return y=Lu(y,g.type,g.pendingProps),y!==null?(g.stateNode=y,!0):!1;case 6:return y=V0(y,g.pendingProps),y!==null?(g.stateNode=y,!0):!1;case 13:return!1;default:return!1}}function Fo(g){if(pi){var y=yu;if(y){var A=y;if(!Q0(g,y)){if(y=Co(A),!y||!Q0(g,y)){g.effectTag=g.effectTag&-1025|2,pi=!1,Vu=g;return}T0(Vu,A)}Vu=g,yu=L0(y)}else g.effectTag=g.effectTag&-1025|2,pi=!1,Vu=g}}function ta(g){for(g=g.return;g!==null&&g.tag!==5&&g.tag!==3&&g.tag!==13;)g=g.return;Vu=g}function Kl(g){if(!w||g!==Vu)return!1;if(!pi)return ta(g),pi=!0,!1;var y=g.type;if(g.tag!==5||y!=="head"&&y!=="body"&&!ct(y,g.memoizedProps))for(y=yu;y;)T0(g,y),y=Co(y);if(ta(g),g.tag===13){if(!w)throw Error(t(316));if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(t(317));yu=ks(g)}else yu=Vu?Co(g.stateNode):null;return!0}function Ki(){w&&(yu=Vu=null,pi=!1)}var Yr=k.ReactCurrentOwner,fo=!1;function Oi(g,y,A,F){y.child=g===null?G(y,null,A,F):z(y,g.child,A,F)}function gi(g,y,A,F,I){A=A.render;var J=y.ref;return Oo(y,I),F=nn(g,y,A,F,J,I),g!==null&&!fo?(y.updateQueue=g.updateQueue,y.effectTag&=-517,g.expirationTime<=I&&(g.expirationTime=0),fu(g,y,I)):(y.effectTag|=1,Oi(g,y,F,I),y.child)}function ff(g,y,A,F,I,J){if(g===null){var fe=A.type;return typeof fe=="function"&&!hf(fe)&&fe.defaultProps===void 0&&A.compare===null&&A.defaultProps===void 0?(y.tag=15,y.type=fe,cf(g,y,fe,F,I,J)):(g=Ia(A.type,null,F,null,y.mode,J),g.ref=y.ref,g.return=y,y.child=g)}return fe=g.child,Iy)&&Ur.set(g,y)))}}function eo(g,y){g.expirationTimeg?y:g)}function Ju(g){if(g.lastExpiredTime!==0)g.callbackExpirationTime=1073741823,g.callbackPriority=99,g.callbackNode=Gl(to.bind(null,g));else{var y=po(g),A=g.callbackNode;if(y===0)A!==null&&(g.callbackNode=null,g.callbackExpirationTime=0,g.callbackPriority=90);else{var F=g0();if(y===1073741823?F=99:y===1||y===2?F=95:(F=10*(1073741821-y)-10*(1073741821-F),F=0>=F?99:250>=F?98:5250>=F?97:95),A!==null){var I=g.callbackPriority;if(g.callbackExpirationTime===y&&I>=F)return;A!==Ir&&Ms(A)}g.callbackExpirationTime=y,g.callbackPriority=F,y=y===1073741823?Gl(to.bind(null,g)):Jo(F,bo.bind(null,g),{timeout:10*(1073741821-y)-d0()}),g.callbackNode=y}}}function bo(g,y){if(Qi=0,y)return y=g0(),oa(g,y),Ju(g),null;var A=po(g);if(A!==0){if(y=g.callbackNode,(kn&(Xi|ru))!==wr)throw Error(t(327));if(Bs(),g===se&&A===Le||ms(g,A),re!==null){var F=kn;kn|=Xi;var I=B0(g);do try{$1();break}catch(mt){ia(g,mt)}while(1);if(bu(),kn=F,Ku.current=I,Ae===Xr)throw y=ot,ms(g,A),Sl(g,A),Ju(g),y;if(re===null)switch(I=g.finishedWork=g.current.alternate,g.finishedExpirationTime=A,F=Ae,se=null,F){case Ci:case Xr:throw Error(t(345));case Wn:oa(g,2=A){g.lastPingedTime=A,ms(g,A);break}}if(J=po(g),J!==0&&J!==A)break;if(F!==0&&F!==A){g.lastPingedTime=F;break}g.timeoutHandle=ln(Dl.bind(null,g),I);break}Dl(g);break;case m0:if(Sl(g,A),F=g.lastSuspendedTime,A===F&&(g.nextKnownPendingLevel=Uc(I)),yn&&(I=g.lastPingedTime,I===0||I>=A)){g.lastPingedTime=A,ms(g,A);break}if(I=po(g),I!==0&&I!==A)break;if(F!==0&&F!==A){g.lastPingedTime=F;break}if(Xt!==1073741823?F=10*(1073741821-Xt)-d0():vt===1073741823?F=0:(F=10*(1073741821-vt)-5e3,I=d0(),A=10*(1073741821-A)-I,F=I-F,0>F&&(F=0),F=(120>F?120:480>F?480:1080>F?1080:1920>F?1920:3e3>F?3e3:4320>F?4320:1960*df(F/1960))-F,A=F?F=0:(I=fe.busyDelayMs|0,J=d0()-(10*(1073741821-J)-(fe.timeoutMs|0||5e3)),F=J<=I?0:I+F-J),10 component higher in the tree to provide a loading indicator or placeholder to display.`+Pr(I))}Ae!==y0&&(Ae=Wn),J=_l(J,I),Ct=F;do{switch(Ct.tag){case 3:fe=J,Ct.effectTag|=4096,Ct.expirationTime=y;var Be=hs(Ct,fe,y);$s(Ct,Be);break e;case 1:fe=J;var ut=Ct.type,Jt=Ct.stateNode;if((Ct.effectTag&64)==0&&(typeof ut.getDerivedStateFromError=="function"||Jt!==null&&typeof Jt.componentDidCatch=="function"&&(cr===null||!cr.has(Jt)))){Ct.effectTag|=4096,Ct.expirationTime=y;var jn=ra(Ct,fe,y);$s(Ct,jn);break e}}Ct=Ct.return}while(Ct!==null)}re=ho(re)}catch(ti){y=ti;continue}break}while(1)}function B0(){var g=Ku.current;return Ku.current=No,g===null?No:g}function oc(g,y){g_n&&(_n=g)}function gd(){for(;re!==null;)re=e2(re)}function $1(){for(;re!==null&&!Xn();)re=e2(re)}function e2(g){var y=Pa(g.alternate,g,Le);return g.memoizedProps=g.pendingProps,y===null&&(y=ho(g)),vs.current=null,y}function ho(g){re=g;do{var y=re.alternate;if(g=re.return,(re.effectTag&2048)==0){e:{var A=y;y=re;var F=Le,I=y.pendingProps;switch(y.tag){case 2:break;case 16:break;case 15:case 0:break;case 1:Yi(y.type)&&Y0(y);break;case 3:Xe(y),Ui(y),I=y.stateNode,I.pendingContext&&(I.context=I.pendingContext,I.pendingContext=null),(A===null||A.child===null)&&Kl(y)&&Gu(y),Vr(y);break;case 5:ie(y);var J=Z(xe.current);if(F=y.type,A!==null&&y.stateNode!=null)Bu(A,y,F,I,J),A.ref!==y.ref&&(y.effectTag|=128);else if(I){if(A=Z(De.current),Kl(y)){if(I=y,!w)throw Error(t(175));A=tu(I.stateNode,I.type,I.memoizedProps,J,A,I),I.updateQueue=A,A=A!==null,A&&Gu(y)}else{var fe=ae(F,I,J,A,y);Kr(fe,y,!1,!1),y.stateNode=fe,ue(fe,F,I,J,A)&&Gu(y)}y.ref!==null&&(y.effectTag|=128)}else if(y.stateNode===null)throw Error(t(166));break;case 6:if(A&&y.stateNode!=null)Sn(A,y,A.memoizedProps,I);else{if(typeof I!="string"&&y.stateNode===null)throw Error(t(166));if(A=Z(xe.current),J=Z(De.current),Kl(y)){if(A=y,!w)throw Error(t(176));(A=Si(A.stateNode,A.memoizedProps,A))&&Gu(y)}else y.stateNode=en(I,A,J,y)}break;case 11:break;case 13:if(fi(qe,y),I=y.memoizedState,(y.effectTag&64)!=0){y.expirationTime=F;break e}I=I!==null,J=!1,A===null?y.memoizedProps.fallback!==void 0&&Kl(y):(F=A.memoizedState,J=F!==null,I||F===null||(F=A.child.sibling,F!==null&&(fe=y.firstEffect,fe!==null?(y.firstEffect=F,F.nextEffect=fe):(y.firstEffect=y.lastEffect=F,F.nextEffect=null),F.effectTag=8))),I&&!J&&(y.mode&2)!=0&&(A===null&&y.memoizedProps.unstable_avoidThisFallback!==!0||(qe.current&1)!=0?Ae===Ci&&(Ae=Xu):((Ae===Ci||Ae===Xu)&&(Ae=m0),_n!==0&&se!==null&&(Sl(se,Le),_s(se,_n)))),vr&&I&&(y.effectTag|=4),Wt&&(I||J)&&(y.effectTag|=4);break;case 7:break;case 8:break;case 12:break;case 4:Xe(y),Vr(y);break;case 10:mu(y);break;case 9:break;case 14:break;case 17:Yi(y.type)&&Y0(y);break;case 19:if(fi(qe,y),I=y.memoizedState,I===null)break;if(J=(y.effectTag&64)!=0,fe=I.rendering,fe===null){if(J)Au(I,!1);else if(Ae!==Ci||A!==null&&(A.effectTag&64)!=0)for(A=y.child;A!==null;){if(fe=tt(A),fe!==null){for(y.effectTag|=64,Au(I,!1),A=fe.updateQueue,A!==null&&(y.updateQueue=A,y.effectTag|=4),I.lastEffect===null&&(y.firstEffect=null),y.lastEffect=I.lastEffect,A=F,I=y.child;I!==null;)J=I,F=A,J.effectTag&=2,J.nextEffect=null,J.firstEffect=null,J.lastEffect=null,fe=J.alternate,fe===null?(J.childExpirationTime=0,J.expirationTime=F,J.child=null,J.memoizedProps=null,J.memoizedState=null,J.updateQueue=null,J.dependencies=null):(J.childExpirationTime=fe.childExpirationTime,J.expirationTime=fe.expirationTime,J.child=fe.child,J.memoizedProps=fe.memoizedProps,J.memoizedState=fe.memoizedState,J.updateQueue=fe.updateQueue,F=fe.dependencies,J.dependencies=F===null?null:{expirationTime:F.expirationTime,firstContext:F.firstContext,responders:F.responders}),I=I.sibling;Zt(qe,qe.current&1|2,y),y=y.child;break e}A=A.sibling}}else{if(!J)if(A=tt(fe),A!==null){if(y.effectTag|=64,J=!0,A=A.updateQueue,A!==null&&(y.updateQueue=A,y.effectTag|=4),Au(I,!0),I.tail===null&&I.tailMode==="hidden"&&!fe.alternate){y=y.lastEffect=I.lastEffect,y!==null&&(y.nextEffect=null);break}}else d0()>I.tailExpiration&&1I&&(I=F),fe>I&&(I=fe),J=J.sibling;A.childExpirationTime=I}if(y!==null)return y;g!==null&&(g.effectTag&2048)==0&&(g.firstEffect===null&&(g.firstEffect=re.firstEffect),re.lastEffect!==null&&(g.lastEffect!==null&&(g.lastEffect.nextEffect=re.firstEffect),g.lastEffect=re.lastEffect),1g?y:g}function Dl(g){var y=as();return so(99,el.bind(null,g,y)),null}function el(g,y){do Bs();while(Qr!==null);if((kn&(Xi|ru))!==wr)throw Error(t(327));var A=g.finishedWork,F=g.finishedExpirationTime;if(A===null)return null;if(g.finishedWork=null,g.finishedExpirationTime=0,A===g.current)throw Error(t(177));g.callbackNode=null,g.callbackExpirationTime=0,g.callbackPriority=90,g.nextKnownPendingLevel=0;var I=Uc(A);if(g.firstPendingTime=I,F<=g.lastSuspendedTime?g.firstSuspendedTime=g.lastSuspendedTime=g.nextKnownPendingLevel=0:F<=g.firstSuspendedTime&&(g.firstSuspendedTime=F-1),F<=g.lastPingedTime&&(g.lastPingedTime=0),F<=g.lastExpiredTime&&(g.lastExpiredTime=0),g===se&&(re=se=null,Le=0),1=A?Yt(g,y,A):(Zt(qe,qe.current&1,y),y=fu(g,y,A),y!==null?y.sibling:null);Zt(qe,qe.current&1,y);break;case 19:if(F=y.childExpirationTime>=A,(g.effectTag&64)!=0){if(F)return wn(g,y,A);y.effectTag|=64}if(I=y.memoizedState,I!==null&&(I.rendering=null,I.tail=null),Zt(qe,qe.current,y),!F)return null}return fu(g,y,A)}fo=!1}}else fo=!1;switch(y.expirationTime=0,y.tag){case 2:if(F=y.type,g!==null&&(g.alternate=null,y.alternate=null,y.effectTag|=2),g=y.pendingProps,I=Du(y,Di.current),Oo(y,A),I=nn(null,y,F,g,I,A),y.effectTag|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0){if(y.tag=1,sn(),Yi(F)){var J=!0;ni(y)}else J=!1;y.memoizedState=I.state!==null&&I.state!==void 0?I.state:null;var fe=F.getDerivedStateFromProps;typeof fe=="function"&&Yl(y,F,fe,g),I.updater=ea,y.stateNode=I,I._reactInternalFiber=y,Ls(y,F,g,A),y=et(null,y,F,!0,J,A)}else y.tag=0,Oi(null,y,I,A),y=y.child;return y;case 16:if(I=y.elementType,g!==null&&(g.alternate=null,y.alternate=null,y.effectTag|=2),g=y.pendingProps,Ue(I),I._status!==1)throw I._result;switch(I=I._result,y.type=I,J=y.tag=tl(I),g=Hn(I,g),J){case 0:y=Z0(null,y,I,g,A);break;case 1:y=Te(null,y,I,g,A);break;case 11:y=gi(null,y,I,g,A);break;case 14:y=ff(null,y,I,Hn(I.type,g),F,A);break;default:throw Error(t(306,I,""))}return y;case 0:return F=y.type,I=y.pendingProps,I=y.elementType===F?I:Hn(F,I),Z0(g,y,F,I,A);case 1:return F=y.type,I=y.pendingProps,I=y.elementType===F?I:Hn(F,I),Te(g,y,F,I,A);case 3:if(Ve(y),F=y.updateQueue,F===null)throw Error(t(282));if(I=y.memoizedState,I=I!==null?I.element:null,w0(y,F,y.pendingProps,null,A),F=y.memoizedState.element,F===I)Ki(),y=fu(g,y,A);else{if((I=y.stateNode.hydrate)&&(w?(yu=L0(y.stateNode.containerInfo),Vu=y,I=pi=!0):I=!1),I)for(A=G(y,null,F,A),y.child=A;A;)A.effectTag=A.effectTag&-3|1024,A=A.sibling;else Oi(g,y,F,A),Ki();y=y.child}return y;case 5:return ht(y),g===null&&Fo(y),F=y.type,I=y.pendingProps,J=g!==null?g.memoizedProps:null,fe=I.children,ct(F,I)?fe=null:J!==null&&ct(F,J)&&(y.effectTag|=16),J0(g,y),y.mode&4&&A!==1&&At(F,I)?(y.expirationTime=y.childExpirationTime=1,y=null):(Oi(g,y,fe,A),y=y.child),y;case 6:return g===null&&Fo(y),null;case 13:return Yt(g,y,A);case 4:return ke(y,y.stateNode.containerInfo),F=y.pendingProps,g===null?y.child=z(y,null,F,A):Oi(g,y,F,A),y.child;case 11:return F=y.type,I=y.pendingProps,I=y.elementType===F?I:Hn(F,I),gi(g,y,F,I,A);case 7:return Oi(g,y,y.pendingProps,A),y.child;case 8:return Oi(g,y,y.pendingProps.children,A),y.child;case 12:return Oi(g,y,y.pendingProps.children,A),y.child;case 10:e:{if(F=y.type._context,I=y.pendingProps,fe=y.memoizedProps,J=I.value,Pu(y,J),fe!==null){var mt=fe.value;if(J=Ne(mt,J)?0:(typeof F._calculateChangedBits=="function"?F._calculateChangedBits(mt,J):1073741823)|0,J===0){if(fe.children===I.children&&!ci.current){y=fu(g,y,A);break e}}else for(mt=y.child,mt!==null&&(mt.return=y);mt!==null;){var Ct=mt.dependencies;if(Ct!==null){fe=mt.child;for(var Mt=Ct.firstContext;Mt!==null;){if(Mt.context===F&&(Mt.observedBits&J)!=0){mt.tag===1&&(Mt=p0(A,null),Mt.tag=2,K0(mt,Mt)),mt.expirationTime=y&&g<=y}function Sl(g,y){var A=g.firstSuspendedTime,F=g.lastSuspendedTime;Ay||A===0)&&(g.lastSuspendedTime=y),y<=g.lastPingedTime&&(g.lastPingedTime=0),y<=g.lastExpiredTime&&(g.lastExpiredTime=0)}function _s(g,y){y>g.firstPendingTime&&(g.firstPendingTime=y);var A=g.firstSuspendedTime;A!==0&&(y>=A?g.firstSuspendedTime=g.lastSuspendedTime=g.nextKnownPendingLevel=0:y>=g.lastSuspendedTime&&(g.lastSuspendedTime=y+1),y>g.nextKnownPendingLevel&&(g.nextKnownPendingLevel=y))}function oa(g,y){var A=g.lastExpiredTime;(A===0||A>y)&&(g.lastExpiredTime=y)}function n2(g){var y=g._reactInternalFiber;if(y===void 0)throw typeof g.render=="function"?Error(t(188)):Error(t(268,Object.keys(g)));return g=$e(y),g===null?null:g.stateNode}function la(g,y){g=g.memoizedState,g!==null&&g.dehydrated!==null&&g.retryTime{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});var JK=0;Qf.__interactionsRef=null;Qf.__subscriberRef=null;Qf.unstable_clear=function(i){return i()};Qf.unstable_getCurrent=function(){return null};Qf.unstable_getThreadID=function(){return++JK};Qf.unstable_trace=function(i,o,f){return f()};Qf.unstable_wrap=function(i){return i};Qf.unstable_subscribe=function(){};Qf.unstable_unsubscribe=function(){}});var g9=ce(au=>{"use strict";process.env.NODE_ENV!=="production"&&function(){"use strict";Object.defineProperty(au,"__esModule",{value:!0});var i=!0,o=0,f=0,p=0;au.__interactionsRef=null,au.__subscriberRef=null,i&&(au.__interactionsRef={current:new Set},au.__subscriberRef={current:null});function E(ge){if(!i)return ge();var ze=au.__interactionsRef.current;au.__interactionsRef.current=new Set;try{return ge()}finally{au.__interactionsRef.current=ze}}function t(){return i?au.__interactionsRef.current:null}function k(){return++p}function L(ge,ze,pe){var Oe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:o;if(!i)return pe();var le={__count:1,id:f++,name:ge,timestamp:ze},Ue=au.__interactionsRef.current,Ge=new Set(Ue);Ge.add(le),au.__interactionsRef.current=Ge;var rt=au.__subscriberRef.current,wt;try{rt!==null&&rt.onInteractionTraced(le)}finally{try{rt!==null&&rt.onWorkStarted(Ge,Oe)}finally{try{wt=pe()}finally{au.__interactionsRef.current=Ue;try{rt!==null&&rt.onWorkStopped(Ge,Oe)}finally{le.__count--,rt!==null&&le.__count===0&&rt.onInteractionScheduledWorkCompleted(le)}}}}return wt}function N(ge){var ze=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o;if(!i)return ge;var pe=au.__interactionsRef.current,Oe=au.__subscriberRef.current;Oe!==null&&Oe.onWorkScheduled(pe,ze),pe.forEach(function(Ge){Ge.__count++});var le=!1;function Ue(){var Ge=au.__interactionsRef.current;au.__interactionsRef.current=pe,Oe=au.__subscriberRef.current;try{var rt;try{Oe!==null&&Oe.onWorkStarted(pe,ze)}finally{try{rt=ge.apply(void 0,arguments)}finally{au.__interactionsRef.current=Ge,Oe!==null&&Oe.onWorkStopped(pe,ze)}}return rt}finally{le||(le=!0,pe.forEach(function(wt){wt.__count--,Oe!==null&&wt.__count===0&&Oe.onInteractionScheduledWorkCompleted(wt)}))}}return Ue.cancel=function(){Oe=au.__subscriberRef.current;try{Oe!==null&&Oe.onWorkCanceled(pe,ze)}finally{pe.forEach(function(rt){rt.__count--,Oe&&rt.__count===0&&Oe.onInteractionScheduledWorkCompleted(rt)})}},Ue}var C=null;i&&(C=new Set);function U(ge){i&&(C.add(ge),C.size===1&&(au.__subscriberRef.current={onInteractionScheduledWorkCompleted:ne,onInteractionTraced:W,onWorkCanceled:he,onWorkScheduled:m,onWorkStarted:we,onWorkStopped:Se}))}function q(ge){i&&(C.delete(ge),C.size===0&&(au.__subscriberRef.current=null))}function W(ge){var ze=!1,pe=null;if(C.forEach(function(Oe){try{Oe.onInteractionTraced(ge)}catch(le){ze||(ze=!0,pe=le)}}),ze)throw pe}function ne(ge){var ze=!1,pe=null;if(C.forEach(function(Oe){try{Oe.onInteractionScheduledWorkCompleted(ge)}catch(le){ze||(ze=!0,pe=le)}}),ze)throw pe}function m(ge,ze){var pe=!1,Oe=null;if(C.forEach(function(le){try{le.onWorkScheduled(ge,ze)}catch(Ue){pe||(pe=!0,Oe=Ue)}}),pe)throw Oe}function we(ge,ze){var pe=!1,Oe=null;if(C.forEach(function(le){try{le.onWorkStarted(ge,ze)}catch(Ue){pe||(pe=!0,Oe=Ue)}}),pe)throw Oe}function Se(ge,ze){var pe=!1,Oe=null;if(C.forEach(function(le){try{le.onWorkStopped(ge,ze)}catch(Ue){pe||(pe=!0,Oe=Ue)}}),pe)throw Oe}function he(ge,ze){var pe=!1,Oe=null;if(C.forEach(function(le){try{le.onWorkCanceled(ge,ze)}catch(Ue){pe||(pe=!0,Oe=Ue)}}),pe)throw Oe}au.unstable_clear=E,au.unstable_getCurrent=t,au.unstable_getThreadID=k,au.unstable_trace=L,au.unstable_wrap=N,au.unstable_subscribe=U,au.unstable_unsubscribe=q}()});var _9=ce((Une,fw)=>{"use strict";process.env.NODE_ENV==="production"?fw.exports=y9():fw.exports=g9()});var E9=ce((jne,hg)=>{"use strict";process.env.NODE_ENV!=="production"&&(hg.exports=function i(o){"use strict";var f=eg(),p=su(),E=HD(),t=h4(),k=_9(),L=0,N=1,C=2,U=3,q=4,W=5,ne=6,m=7,we=8,Se=9,he=10,ge=11,ze=12,pe=13,Oe=14,le=15,Ue=16,Ge=17,rt=18,wt=19,xt=20,$e=21,ft=function(){};ft=function(a,c){for(var _=arguments.length,T=new Array(_>2?_-2:0),R=2;R<_;R++)T[R-2]=arguments[R];if(c===void 0)throw new Error("`warningWithoutStack(condition, format, ...args)` requires a warning message argument");if(T.length>8)throw new Error("warningWithoutStack() currently supports at most 8 arguments.");if(!a){if(typeof console!="undefined"){var j=T.map(function(oe){return""+oe});j.unshift("Warning: "+c),Function.prototype.apply.call(console.error,console,j)}try{var V=0,te="Warning: "+c.replace(/%s/g,function(){return T[V++]});throw new Error(te)}catch(oe){}}};var Ke=ft;function jt(a){return a._reactInternalFiber}function $t(a,c){a._reactInternalFiber=c}var at=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;at.hasOwnProperty("ReactCurrentDispatcher")||(at.ReactCurrentDispatcher={current:null}),at.hasOwnProperty("ReactCurrentBatchConfig")||(at.ReactCurrentBatchConfig={suspense:null});var Q=typeof Symbol=="function"&&Symbol.for,ae=Q?Symbol.for("react.element"):60103,Ce=Q?Symbol.for("react.portal"):60106,ue=Q?Symbol.for("react.fragment"):60107,je=Q?Symbol.for("react.strict_mode"):60108,ct=Q?Symbol.for("react.profiler"):60114,At=Q?Symbol.for("react.provider"):60109,en=Q?Symbol.for("react.context"):60110,ln=Q?Symbol.for("react.concurrent_mode"):60111,An=Q?Symbol.for("react.forward_ref"):60112,nr=Q?Symbol.for("react.suspense"):60113,un=Q?Symbol.for("react.suspense_list"):60120,Wt=Q?Symbol.for("react.memo"):60115,vr=Q?Symbol.for("react.lazy"):60116,w=Q?Symbol.for("react.fundamental"):60117,Ut=Q?Symbol.for("react.responder"):60118,Vn=Q?Symbol.for("react.scope"):60119,fr=typeof Symbol=="function"&&Symbol.iterator,Fr="@@iterator";function ur(a){if(a===null||typeof a!="object")return null;var c=fr&&a[fr]||a[Fr];return typeof c=="function"?c:null}var br=Ke;br=function(a,c){if(!a){for(var _=at.ReactDebugCurrentFrame,T=_.getStackAddendum(),R=arguments.length,j=new Array(R>2?R-2:0),V=2;V import('./MyComponent'))`,T),a._status=So,a._result=R}},function(T){a._status===a0&&(a._status=Go,a._result=T)})}}function Ko(a,c,_){var T=c.displayName||c.name||"";return a.displayName||(T!==""?_+"("+T+")":_)}function qt(a){if(a==null)return null;if(typeof a.tag=="number"&&Ke(!1,"Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case ue:return"Fragment";case Ce:return"Portal";case ct:return"Profiler";case je:return"StrictMode";case nr:return"Suspense";case un:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case en:return"Context.Consumer";case At:return"Context.Provider";case An:return Ko(a,a.render,"ForwardRef");case Wt:return qt(a.type);case vr:{var c=a,_=Os(c);if(_)return qt(_);break}}return null}var _i=0,eu=1,ai=2,mr=4,Xo=6,W0=8,Lu=16,V0=32,Hr=64,To=128,Co=256,L0=512,tu=1024,Si=1028,ks=932,Hl=2047,F0=2048,f0=4096,Pr=!0,Ei=!0,G0=!0,fi=!0,Zt=!0,Ln=!0,Di=!1,ci=!1,Ht=!1,Du=!1,Yi=!1,Y0=!0,Ui=!1,Wl=!1,xo=!1,ni=!1,oo=!1,Vl=at.ReactCurrentOwner;function Ao(a){var c=a,_=a;if(a.alternate)for(;c.return;)c=c.return;else{var T=c;do c=T,(c.effectTag&(ai|tu))!==_i&&(_=c.return),T=c.return;while(T)}return c.tag===U?_:null}function Ms(a){return Ao(a)===a}function Xn(a){{var c=Vl.current;if(c!==null&&c.tag===N){var _=c,T=_.stateNode;T._warnedAboutRefsInRender||Ke(!1,"%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",qt(_.type)||"A component"),T._warnedAboutRefsInRender=!0}}var R=jt(a);return R?Ao(R)===R:!1}function Qo(a){if(Ao(a)!==a)throw Error("Unable to find node on an unmounted component.")}function lo(a){var c=a.alternate;if(!c){var _=Ao(a);if(_===null)throw Error("Unable to find node on an unmounted component.");return _!==a?null:a}for(var T=a,R=c;;){var j=T.return;if(j===null)break;var V=j.alternate;if(V===null){var te=j.return;if(te!==null){T=R=te;continue}break}if(j.child===V.child){for(var oe=j.child;oe;){if(oe===T)return Qo(j),a;if(oe===R)return Qo(j),c;oe=oe.sibling}throw Error("Unable to find node on an unmounted component.")}if(T.return!==R.return)T=j,R=V;else{for(var Ie=!1,Ye=j.child;Ye;){if(Ye===T){Ie=!0,T=j,R=V;break}if(Ye===R){Ie=!0,R=j,T=V;break}Ye=Ye.sibling}if(!Ie){for(Ye=V.child;Ye;){if(Ye===T){Ie=!0,T=V,R=j;break}if(Ye===R){Ie=!0,R=V,T=j;break}Ye=Ye.sibling}if(!Ie)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(T.alternate!==R)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(T.tag!==U)throw Error("Unable to find node on an unmounted component.");return T.stateNode.current===T?a:c}function b0(a){var c=lo(a);if(!c)return null;for(var _=c;;){if(_.tag===W||_.tag===ne)return _;if(_.child){_.child.return=_,_=_.child;continue}if(_===c)return null;for(;!_.sibling;){if(!_.return||_.return===c)return null;_=_.return}_.sibling.return=_.return,_=_.sibling}return null}function yl(a){var c=lo(a);if(!c)return null;for(var _=c;;){if(_.tag===W||_.tag===ne||Ht&&_.tag===xt)return _;if(_.child&&_.tag!==q){_.child.return=_,_=_.child;continue}if(_===c)return null;for(;!_.sibling;){if(!_.return||_.return===c)return null;_=_.return}_.sibling.return=_.return,_=_.sibling}return null}var Ro=o.getPublicInstance,Et=o.getRootHostContext,Pt=o.getChildHostContext,Bn=o.prepareForCommit,Ir=o.resetAfterCommit,ji=o.createInstance,Wr=o.appendInitialChild,wu=o.finalizeInitialChildren,c0=o.prepareUpdate,Ti=o.shouldSetTextContent,d0=o.shouldDeprioritizeSubtree,as=o.createTextInstance,St=o.setTimeout,so=o.clearTimeout,Jo=o.noTimeout,Gl=o.now,Fu=o.isPrimaryRenderer,fs=o.warnsIfNotActing,P0=o.supportsMutation,X=o.supportsPersistence,_e=o.supportsHydration,Ne=o.mountResponderInstance,Me=o.unmountResponderInstance,dt=o.getFundamentalComponentInstance,Hn=o.mountFundamentalComponent,Dn=o.shouldUpdateFundamentalComponent,or=o.getInstanceFromNode,mi=o.appendChild,Su=o.appendChildToContainer,bu=o.commitTextUpdate,Pu=o.commitMount,mu=o.commitUpdate,yi=o.insertBefore,Oo=o.insertInContainerBefore,Tu=o.removeChild,ao=o.removeChildFromContainer,Iu=o.resetTextContent,Oa=o.hideInstance,p0=o.hideTextInstance,Zs=o.unhideInstance,K0=o.unhideTextInstance,$s=o.updateFundamentalComponent,ka=o.unmountFundamentalComponent,cs=o.cloneInstance,w0=o.createContainerChildSet,Gn=o.appendChildToContainerChildSet,ic=o.finalizeContainerChildren,ri=o.replaceContainerChildren,Gr=o.cloneHiddenInstance,Yl=o.cloneHiddenTextInstance,ea=o.cloneInstance,lf=o.canHydrateInstance,Ns=o.canHydrateTextInstance,Ma=o.canHydrateSuspenseInstance,Ls=o.isSuspenseInstancePending,h0=o.isSuspenseInstanceFallback,Fs=o.registerSuspenseInstanceRetry,Ni=o.getNextHydratableSibling,B=o.getFirstHydratableChild,z=o.hydrateInstance,G=o.hydrateTextInstance,$=o.hydrateSuspenseInstance,De=o.getNextHydratableInstanceAfterSuspenseInstance,me=o.commitHydratedContainer,xe=o.commitHydratedSuspenseInstance,Z=o.clearSuspenseBoundary,ke=o.clearSuspenseBoundaryFromContainer,Xe=o.didNotMatchHydratedContainerTextInstance,ht=o.didNotMatchHydratedTextInstance,ie=o.didNotHydrateContainerInstance,qe=o.didNotHydrateInstance,tt=o.didNotFindHydratableContainerInstance,Tt=o.didNotFindHydratableContainerTextInstance,kt=o.didNotFindHydratableContainerSuspenseInstance,bt=o.didNotFindHydratableInstance,on=o.didNotFindHydratableTextInstance,tn=o.didNotFindHydratableSuspenseInstance,Lt=/^(.*)[\\\/]/,gn=function(a,c,_){var T="";if(c){var R=c.fileName,j=R.replace(Lt,"");if(/^index\./.test(j)){var V=R.match(Lt);if(V){var te=V[1];if(te){var oe=te.replace(Lt,"");j=oe+"/"+j}}}T=" (at "+j+":"+c.lineNumber+")"}else _&&(T=" (created by "+_+")");return` + in `+(a||"Unknown")+T},lr=at.ReactDebugCurrentFrame;function Qn(a){switch(a.tag){case U:case q:case ne:case m:case he:case Se:return"";default:var c=a._debugOwner,_=a._debugSource,T=qt(a.type),R=null;return c&&(R=qt(c.type)),gn(T,_,R)}}function _r(a){var c="",_=a;do c+=Qn(_),_=_.return;while(_);return c}var Cn=null,Ar=null;function v0(){{if(Cn===null)return null;var a=Cn._debugOwner;if(a!==null&&typeof a!="undefined")return qt(a.type)}return null}function Rr(){return Cn===null?"":_r(Cn)}function nt(){lr.getCurrentStack=null,Cn=null,Ar=null}function _t(a){lr.getCurrentStack=Rr,Cn=a,Ar=null}function Ze(a){Ar=a}var Ft="\u269B",nn="\u26D4",sn=typeof performance!="undefined"&&typeof performance.mark=="function"&&typeof performance.clearMarks=="function"&&typeof performance.measure=="function"&&typeof performance.clearMeasures=="function",Yn=null,yr=null,nu=null,Cu=!1,S0=!1,X0=!1,xu=0,di=0,ko=new Set,Zo=function(a){return Ft+" "+a},sf=function(a,c){var _=c?nn+" ":Ft+" ",T=c?" Warning: "+c:"";return""+_+a+T},gl=function(a){performance.mark(Zo(a))},af=function(a){performance.clearMarks(Zo(a))},Mo=function(a,c,_){var T=Zo(c),R=sf(a,_);try{performance.measure(R,T)}catch(j){}performance.clearMarks(T),performance.clearMeasures(R)},ds=function(a,c){return a+" (#"+c+")"},bs=function(a,c,_){return _===null?a+" ["+(c?"update":"mount")+"]":a+"."+_},No=function(a,c){var _=qt(a.type)||"Unknown",T=a._debugID,R=a.alternate!==null,j=bs(_,R,c);if(Cu&&ko.has(j))return!1;ko.add(j);var V=ds(j,T);return gl(V),!0},Lo=function(a,c){var _=qt(a.type)||"Unknown",T=a._debugID,R=a.alternate!==null,j=bs(_,R,c),V=ds(j,T);af(V)},ps=function(a,c,_){var T=qt(a.type)||"Unknown",R=a._debugID,j=a.alternate!==null,V=bs(T,j,c),te=ds(V,R);Mo(V,te,_)},Vu=function(a){switch(a.tag){case U:case W:case ne:case q:case m:case he:case Se:case we:return!0;default:return!1}},yu=function(){yr!==null&&nu!==null&&Lo(nu,yr),nu=null,yr=null,X0=!1},pi=function(){for(var a=Yn;a;)a._debugIsCurrentlyTiming&&ps(a,null,null),a=a.return},T0=function(a){a.return!==null&&T0(a.return),a._debugIsCurrentlyTiming&&No(a,null)},Q0=function(){Yn!==null&&T0(Yn)};function Fo(){Pr&&di++}function ta(){Pr&&(Cu&&(S0=!0),yr!==null&&yr!=="componentWillMount"&&yr!=="componentWillReceiveProps"&&(X0=!0))}function Kl(a){if(Pr){if(!sn||Vu(a)||(Yn=a,!No(a,null)))return;a._debugIsCurrentlyTiming=!0}}function Ki(a){if(Pr){if(!sn||Vu(a))return;a._debugIsCurrentlyTiming=!1,Lo(a,null)}}function Yr(a){if(Pr){if(!sn||Vu(a)||(Yn=a.return,!a._debugIsCurrentlyTiming))return;a._debugIsCurrentlyTiming=!1,ps(a,null,null)}}function fo(a){if(Pr){if(!sn||Vu(a)||(Yn=a.return,!a._debugIsCurrentlyTiming))return;a._debugIsCurrentlyTiming=!1;var c=a.tag===pe?"Rendering was suspended":"An error was thrown inside this error boundary";ps(a,null,c)}}function Oi(a,c){if(Pr){if(!sn||(yu(),!No(a,c)))return;nu=a,yr=c}}function gi(){if(Pr){if(!sn)return;if(yr!==null&&nu!==null){var a=X0?"Scheduled a cascading update":null;ps(nu,yr,a)}yr=null,nu=null}}function ff(a){if(Pr){if(Yn=a,!sn)return;xu=0,gl("(React Tree Reconciliation)"),Q0()}}function cf(a,c){if(Pr){if(!sn)return;var _=null;if(a!==null)if(a.tag===U)_="A top-level update interrupted the previous render";else{var T=qt(a.type)||"Unknown";_="An update to "+T+" interrupted the previous render"}else xu>1&&(_="There were cascading updates");xu=0;var R=c?"(React Tree Reconciliation: Completed Root)":"(React Tree Reconciliation: Yielded)";pi(),Mo(R,"(React Tree Reconciliation)",_)}}function J0(){if(Pr){if(!sn)return;Cu=!0,S0=!1,ko.clear(),gl("(Committing Changes)")}}function Z0(){if(Pr){if(!sn)return;var a=null;S0?a="Lifecycle hook scheduled a cascading update":xu>0&&(a="Caused by a cascading update in earlier commit"),S0=!1,xu++,Cu=!1,ko.clear(),Mo("(Committing Changes)","(Committing Changes)",a)}}function Te(){if(Pr){if(!sn)return;di=0,gl("(Committing Snapshot Effects)")}}function et(){if(Pr){if(!sn)return;var a=di;di=0,Mo("(Committing Snapshot Effects: "+a+" Total)","(Committing Snapshot Effects)",null)}}function Ve(){if(Pr){if(!sn)return;di=0,gl("(Committing Host Effects)")}}function Gt(){if(Pr){if(!sn)return;var a=di;di=0,Mo("(Committing Host Effects: "+a+" Total)","(Committing Host Effects)",null)}}function Yt(){if(Pr){if(!sn)return;di=0,gl("(Calling Lifecycle Methods)")}}function sr(){if(Pr){if(!sn)return;var a=di;di=0,Mo("(Calling Lifecycle Methods: "+a+" Total)","(Calling Lifecycle Methods)",null)}}var Br=[],wn;wn=[];var fu=-1;function Gu(a){return{current:a}}function Kr(a,c){if(fu<0){Ke(!1,"Unexpected pop.");return}c!==wn[fu]&&Ke(!1,"Unexpected Fiber popped."),a.current=Br[fu],Br[fu]=null,wn[fu]=null,fu--}function Vr(a,c,_){fu++,Br[fu]=a.current,wn[fu]=_,a.current=c}var Bu;Bu={};var Sn={};Object.freeze(Sn);var C0=Gu(Sn),Au=Gu(!1),ei=Sn;function _l(a,c,_){return ni?Sn:_&&zi(c)?ei:C0.current}function Ps(a,c,_){if(!ni){var T=a.stateNode;T.__reactInternalMemoizedUnmaskedChildContext=c,T.__reactInternalMemoizedMaskedChildContext=_}}function Uu(a,c){if(ni)return Sn;var _=a.type,T=_.contextTypes;if(!T)return Sn;var R=a.stateNode;if(R&&R.__reactInternalMemoizedUnmaskedChildContext===c)return R.__reactInternalMemoizedMaskedChildContext;var j={};for(var V in T)j[V]=c[V];{var te=qt(_)||"Unknown";E(T,j,"context",te,Rr)}return R&&Ps(a,c,j),j}function na(){return ni?!1:Au.current}function zi(a){if(ni)return!1;var c=a.childContextTypes;return c!=null}function Is(a){ni||(Kr(Au,a),Kr(C0,a))}function x0(a){ni||(Kr(Au,a),Kr(C0,a))}function Li(a,c,_){if(!ni){if(C0.current!==Sn)throw Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");Vr(C0,c,a),Vr(Au,_,a)}}function A0(a,c,_){if(ni)return _;var T=a.stateNode,R=c.childContextTypes;if(typeof T.getChildContext!="function"){{var j=qt(c)||"Unknown";Bu[j]||(Bu[j]=!0,Ke(!1,"%s.childContextTypes is specified but there is no getChildContext() method on the instance. You can either define getChildContext() on %s or remove childContextTypes from it.",j,j))}return _}var V;Ze("getChildContext"),Oi(a,"getChildContext"),V=T.getChildContext(),gi(),Ze(null);for(var te in V)if(!(te in R))throw Error((qt(c)||"Unknown")+'.getChildContext(): key "'+te+'" is not defined in childContextTypes.');{var oe=qt(c)||"Unknown";E(R,V,"child context",oe,Rr)}return f({},_,{},V)}function Fi(a){if(ni)return!1;var c=a.stateNode,_=c&&c.__reactInternalMemoizedMergedChildContext||Sn;return ei=C0.current,Vr(C0,_,a),Vr(Au,Au.current,a),!0}function $o(a,c,_){if(!ni){var T=a.stateNode;if(!T)throw Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");if(_){var R=A0(a,c,ei);T.__reactInternalMemoizedMergedChildContext=R,Kr(Au,a),Kr(C0,a),Vr(C0,R,a),Vr(Au,_,a)}else Kr(Au,a),Vr(Au,_,a)}}function El(a){if(ni)return Sn;if(!(Ms(a)&&a.tag===N))throw Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");var c=a;do{switch(c.tag){case U:return c.stateNode.context;case N:{var _=c.type;if(zi(_))return c.stateNode.__reactInternalMemoizedMergedChildContext;break}}c=c.return}while(c!==null);throw Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.")}var I0=1,R0=2,co=t.unstable_runWithPriority,Ru=t.unstable_scheduleCallback,Yu=t.unstable_cancelCallback,Xl=t.unstable_shouldYield,hs=t.unstable_requestPaint,ra=t.unstable_now,df=t.unstable_getCurrentPriorityLevel,Ku=t.unstable_ImmediatePriority,vs=t.unstable_UserBlockingPriority,wr=t.unstable_NormalPriority,$0=t.unstable_LowPriority,Xi=t.unstable_IdlePriority;if(Ln&&!(k.__interactionsRef!=null&&k.__interactionsRef.current!=null))throw Error("It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling");var ru={},Ci=99,Xr=98,Wn=97,Xu=96,m0=95,y0=90,kn=Xl,se=hs!==void 0?hs:function(){},re=null,Le=null,Ae=!1,ot=ra(),vt=ot<1e4?ra:function(){return ra()-ot};function Xt(){switch(df()){case Ku:return Ci;case vs:return Xr;case wr:return Wn;case $0:return Xu;case Xi:return m0;default:throw Error("Unknown priority level.")}}function xn(a){switch(a){case Ci:return Ku;case Xr:return vs;case Wn:return wr;case Xu:return $0;case m0:return Xi;default:throw Error("Unknown priority level.")}}function _n(a,c){var _=xn(a);return co(_,c)}function yn(a,c,_){var T=xn(a);return Ru(T,c,_)}function En(a){return re===null?(re=[a],Le=Ru(Ku,xi)):re.push(a),ru}function er(a){a!==ru&&Yu(a)}function It(){if(Le!==null){var a=Le;Le=null,Yu(a)}xi()}function xi(){if(!Ae&&re!==null){Ae=!0;var a=0;try{var c=!0,_=re;_n(Ci,function(){for(;a<_.length;a++){var T=_[a];do T=T(c);while(T!==null)}}),re=null}catch(T){throw re!==null&&(re=re.slice(a+1)),Ru(Ku,It),T}finally{Ae=!1}}}var Sr=0,cr=1,Y=2,Qr=4,Jr=8,Ur=1073741823,lt=0,hi=1,Qi=2,g0=3,bn=Ur,Qu=bn-1,eo=10,po=Qu-1;function Ju(a){return po-(a/eo|0)}function bo(a){return(po-a)*eo}function to(a,c){return((a/c|0)+1)*c}function Na(a,c,_){return po-to(po-a+c/eo,_/eo)}var pf=5e3,uc=250;function ms(a){return Na(a,pf,uc)}function ia(a,c){return Na(a,c,uc)}var B0=500,oc=100;function La(a){return Na(a,B0,oc)}function gd(a){return g0++}function $1(a,c){if(c===bn)return Ci;if(c===hi||c===Qi)return m0;var _=bo(c)-bo(a);return _<=0?Ci:_<=B0+oc?Xr:_<=pf+uc?Wn:m0}function e2(a,c){return a===c&&(a!==0||1/a==1/c)||a!==a&&c!==c}var ho=typeof Object.is=="function"?Object.is:e2,Uc=Object.prototype.hasOwnProperty;function Dl(a,c){if(ho(a,c))return!0;if(typeof a!="object"||a===null||typeof c!="object"||c===null)return!1;var _=Object.keys(a),T=Object.keys(c);if(_.length!==T.length)return!1;for(var R=0;R<_.length;R++)if(!Uc.call(c,_[R])||!ho(a[_[R]],c[_[R]]))return!1;return!0}var el=function(){};{var _d=function(a){for(var c=arguments.length,_=new Array(c>1?c-1:0),T=1;T2?_-2:0),R=2;R<_;R++)T[R-2]=arguments[R];_d.apply(void 0,[c].concat(T))}}}var Bs=el,wl={recordUnsafeLifecycleWarnings:function(a,c){},flushPendingUnsafeLifecycleWarnings:function(){},recordLegacyContextWarning:function(a,c){},flushLegacyContextWarning:function(){},discardPendingWarnings:function(){}};{var t2=function(a){for(var c=null,_=a;_!==null;)_.mode&cr&&(c=_),_=_.return;return c},Po=function(a){var c=[];return a.forEach(function(_){c.push(_)}),c.sort().join(", ")},Fa=[],ba=[],Pa=[],ua=[],ys=[],gs=[],Ql=new Set;wl.recordUnsafeLifecycleWarnings=function(a,c){Ql.has(a.type)||(typeof c.componentWillMount=="function"&&c.componentWillMount.__suppressDeprecationWarning!==!0&&Fa.push(a),a.mode&cr&&typeof c.UNSAFE_componentWillMount=="function"&&ba.push(a),typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps.__suppressDeprecationWarning!==!0&&Pa.push(a),a.mode&cr&&typeof c.UNSAFE_componentWillReceiveProps=="function"&&ua.push(a),typeof c.componentWillUpdate=="function"&&c.componentWillUpdate.__suppressDeprecationWarning!==!0&&ys.push(a),a.mode&cr&&typeof c.UNSAFE_componentWillUpdate=="function"&&gs.push(a))},wl.flushPendingUnsafeLifecycleWarnings=function(){var a=new Set;Fa.length>0&&(Fa.forEach(function(Nt){a.add(qt(Nt.type)||"Component"),Ql.add(Nt.type)}),Fa=[]);var c=new Set;ba.length>0&&(ba.forEach(function(Nt){c.add(qt(Nt.type)||"Component"),Ql.add(Nt.type)}),ba=[]);var _=new Set;Pa.length>0&&(Pa.forEach(function(Nt){_.add(qt(Nt.type)||"Component"),Ql.add(Nt.type)}),Pa=[]);var T=new Set;ua.length>0&&(ua.forEach(function(Nt){T.add(qt(Nt.type)||"Component"),Ql.add(Nt.type)}),ua=[]);var R=new Set;ys.length>0&&(ys.forEach(function(Nt){R.add(qt(Nt.type)||"Component"),Ql.add(Nt.type)}),ys=[]);var j=new Set;if(gs.length>0&&(gs.forEach(function(Nt){j.add(qt(Nt.type)||"Component"),Ql.add(Nt.type)}),gs=[]),c.size>0){var V=Po(c);Ke(!1,`Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details. + +* Move code with side effects to componentDidMount, and set initial state in the constructor. + +Please update the following components: %s`,V)}if(T.size>0){var te=Po(T);Ke(!1,`Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details. + +* Move data fetching code or side effects to componentDidUpdate. +* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state + +Please update the following components: %s`,te)}if(j.size>0){var oe=Po(j);Ke(!1,`Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details. + +* Move data fetching code or side effects to componentDidUpdate. + +Please update the following components: %s`,oe)}if(a.size>0){var Ie=Po(a);Bs(!1,`componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. + +* Move code with side effects to componentDidMount, and set initial state in the constructor. +* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. + +Please update the following components: %s`,Ie)}if(_.size>0){var Ye=Po(_);Bs(!1,`componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. + +* Move data fetching code or side effects to componentDidUpdate. +* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state +* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. + +Please update the following components: %s`,Ye)}if(R.size>0){var pt=Po(R);Bs(!1,`componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. + +* Move data fetching code or side effects to componentDidUpdate. +* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. + +Please update the following components: %s`,pt)}};var Io=new Map,hf=new Set;wl.recordLegacyContextWarning=function(a,c){var _=t2(a);if(_===null){Ke(!1,"Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue.");return}if(!hf.has(a.type)){var T=Io.get(_);(a.type.contextTypes!=null||a.type.childContextTypes!=null||c!==null&&typeof c.getChildContext=="function")&&(T===void 0&&(T=[],Io.set(_,T)),T.push(a))}},wl.flushLegacyContextWarning=function(){Io.forEach(function(a,c){var _=new Set;a.forEach(function(j){_.add(qt(j.type)||"Component"),hf.add(j.type)});var T=Po(_),R=_r(c);Ke(!1,`Legacy context API has been detected within a strict-mode tree. + +The old API will be supported in all 16.x releases, but applications using it should migrate to the new version. + +Please update the following components: %s + +Learn more about this warning here: https://fb.me/react-legacy-context%s`,T,R)})},wl.discardPendingWarnings=function(){Fa=[],ba=[],Pa=[],ua=[],ys=[],gs=[],Io=new Map}}var tl=null,ju=null,Ia=function(a){tl=a};function Zu(a){{if(tl===null)return a;var c=tl(a);return c===void 0?a:c.current}}function U0(a){return Zu(a)}function vf(a){{if(tl===null)return a;var c=tl(a);if(c===void 0){if(a!=null&&typeof a.render=="function"){var _=Zu(a.render);if(a.render!==_){var T={$$typeof:An,render:_};return a.displayName!==void 0&&(T.displayName=a.displayName),T}}return a}return c.current}}function jc(a,c){{if(tl===null)return!1;var _=a.elementType,T=c.type,R=!1,j=typeof T=="object"&&T!==null?T.$$typeof:null;switch(a.tag){case N:{typeof T=="function"&&(R=!0);break}case L:{(typeof T=="function"||j===vr)&&(R=!0);break}case ge:{(j===An||j===vr)&&(R=!0);break}case Oe:case le:{(j===Wt||j===vr)&&(R=!0);break}default:return!1}if(R){var V=tl(_);if(V!==void 0&&V===tl(T))return!0}return!1}}function lc(a){{if(tl===null||typeof WeakSet!="function")return;ju===null&&(ju=new WeakSet),ju.add(a)}}var Sl=function(a,c){{if(tl===null)return;var _=c.staleFamilies,T=c.updatedFamilies;Xa(),xp(function(){oa(a.current,T,_)})}},_s=function(a,c){{if(a.context!==Sn)return;Xa(),fv(function(){l_(c,a,null,null)})}};function oa(a,c,_){{var T=a.alternate,R=a.child,j=a.sibling,V=a.tag,te=a.type,oe=null;switch(V){case L:case le:case N:oe=te;break;case ge:oe=te.render;break;default:break}if(tl===null)throw new Error("Expected resolveFamily to be set during hot reload.");var Ie=!1,Ye=!1;if(oe!==null){var pt=tl(oe);pt!==void 0&&(_.has(pt)?Ye=!0:c.has(pt)&&(V===N?Ye=!0:Ie=!0))}ju!==null&&(ju.has(a)||T!==null&&ju.has(T))&&(Ye=!0),Ye&&(a._debugNeedsRemount=!0),(Ye||Ie)&&dl(a,bn),R!==null&&!Ye&&oa(R,c,_),j!==null&&oa(j,c,_)}}var n2=function(a,c){{var _=new Set,T=new Set(c.map(function(R){return R.current}));return la(a.current,T,_),_}};function la(a,c,_){{var T=a.child,R=a.sibling,j=a.tag,V=a.type,te=null;switch(j){case L:case le:case N:te=V;break;case ge:te=V.render;break;default:break}var oe=!1;te!==null&&c.has(te)&&(oe=!0),oe?sc(a,_):T!==null&&la(T,c,_),R!==null&&la(R,c,_)}}function sc(a,c){{var _=zc(a,c);if(_)return;for(var T=a;;){switch(T.tag){case W:c.add(T.stateNode);return;case q:c.add(T.stateNode.containerInfo);return;case U:c.add(T.stateNode.containerInfo);return}if(T.return===null)throw new Error("Expected to reach root first.");T=T.return}}}function zc(a,c){for(var _=a,T=!1;;){if(_.tag===W)T=!0,c.add(_.stateNode);else if(_.child!==null){_.child.return=_,_=_.child;continue}if(_===a)return T;for(;_.sibling===null;){if(_.return===null||_.return===a)return T;_=_.return}_.sibling.return=_.return,_=_.sibling}return!1}function bi(a,c){if(a&&a.defaultProps){var _=f({},c),T=a.defaultProps;for(var R in T)_[R]===void 0&&(_[R]=T[R]);return _}return c}function g(a){if(Yo(a),a._status!==So)throw a._result;return a._result}var y=Gu(null),A;A={};var F=null,I=null,J=null,fe=!1;function mt(){F=null,I=null,J=null,fe=!1}function Ct(){fe=!0}function Mt(){fe=!1}function Er(a,c){var _=a.type._context;Fu?(Vr(y,_._currentValue,a),_._currentValue=c,_._currentRenderer===void 0||_._currentRenderer===null||_._currentRenderer===A||Ke(!1,"Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),_._currentRenderer=A):(Vr(y,_._currentValue2,a),_._currentValue2=c,_._currentRenderer2===void 0||_._currentRenderer2===null||_._currentRenderer2===A||Ke(!1,"Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),_._currentRenderer2=A)}function $u(a){var c=y.current;Kr(y,a);var _=a.type._context;Fu?_._currentValue=c:_._currentValue2=c}function iu(a,c,_){if(ho(_,c))return 0;var T=typeof a._calculateChangedBits=="function"?a._calculateChangedBits(_,c):Ur;return(T&Ur)!==T&&Kt(!1,"calculateChangedBits: Expected the return value to be a 31-bit integer. Instead received: %s",T),T|0}function j0(a,c){for(var _=a;_!==null;){var T=_.alternate;if(_.childExpirationTime=c&&up(),_.firstContext=null)}}function He(a,c){if(fe&&Kt(!1,"Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."),J!==a){if(!(c===!1||c===0)){var _;typeof c!="number"||c===Ur?(J=a,_=Ur):_=c;var T={context:a,observedBits:_,next:null};if(I===null){if(F===null)throw Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");I=T,F.dependencies={expirationTime:lt,firstContext:T,responders:null}}else I=I.next=T}}return Fu?a._currentValue:a._currentValue2}var Be=0,ut=1,Jt=2,jn=3,ti=!1,tr,ii;tr=!1,ii=null;function qi(a){var c={baseState:a,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null};return c}function jr(a){var c={baseState:a.baseState,firstUpdate:a.firstUpdate,lastUpdate:a.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null};return c}function gu(a,c){var _={expirationTime:a,suspenseConfig:c,tag:Be,payload:null,callback:null,next:null,nextEffect:null};return _.priority=Xt(),_}function Ba(a,c){a.lastUpdate===null?a.firstUpdate=a.lastUpdate=c:(a.lastUpdate.next=c,a.lastUpdate=c)}function Ua(a,c){var _=a.alternate,T,R;_===null?(T=a.updateQueue,R=null,T===null&&(T=a.updateQueue=qi(a.memoizedState))):(T=a.updateQueue,R=_.updateQueue,T===null?R===null?(T=a.updateQueue=qi(a.memoizedState),R=_.updateQueue=qi(_.memoizedState)):T=a.updateQueue=jr(R):R===null&&(R=_.updateQueue=jr(T))),R===null||T===R?Ba(T,c):T.lastUpdate===null||R.lastUpdate===null?(Ba(T,c),Ba(R,c)):(Ba(T,c),R.lastUpdate=c),a.tag===N&&(ii===T||R!==null&&ii===R)&&!tr&&(Ke(!1,"An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects. Consider using componentDidUpdate or a callback."),tr=!0)}function r2(a,c){var _=a.updateQueue;_===null?_=a.updateQueue=qi(a.memoizedState):_=Ed(a,_),_.lastCapturedUpdate===null?_.firstCapturedUpdate=_.lastCapturedUpdate=c:(_.lastCapturedUpdate.next=c,_.lastCapturedUpdate=c)}function Ed(a,c){var _=a.alternate;return _!==null&&c===_.updateQueue&&(c=a.updateQueue=jr(c)),c}function Dd(a,c,_,T,R,j){switch(_.tag){case ut:{var V=_.payload;if(typeof V=="function"){Ct(),Ei&&a.mode&cr&&V.call(j,T,R);var te=V.call(j,T,R);return Mt(),te}return V}case jn:a.effectTag=a.effectTag&~f0|Hr;case Be:{var oe=_.payload,Ie;return typeof oe=="function"?(Ct(),Ei&&a.mode&cr&&oe.call(j,T,R),Ie=oe.call(j,T,R),Mt()):Ie=oe,Ie==null?T:f({},T,Ie)}case Jt:return ti=!0,T}return T}function mf(a,c,_,T,R){ti=!1,c=Ed(a,c),ii=c;for(var j=c.baseState,V=null,te=lt,oe=c.firstUpdate,Ie=j;oe!==null;){var Ye=oe.expirationTime;if(Ye from render. Or maybe you meant to call this function rather than return it."))}function yh(a){function c(it,Ot){if(!!a){var Je=it.lastEffect;Je!==null?(Je.nextEffect=Ot,it.lastEffect=Ot):it.firstEffect=it.lastEffect=Ot,Ot.nextEffect=null,Ot.effectTag=W0}}function _(it,Ot){if(!a)return null;for(var Je=Ot;Je!==null;)c(it,Je),Je=Je.sibling;return null}function T(it,Ot){for(var Je=new Map,Bt=Ot;Bt!==null;)Bt.key!==null?Je.set(Bt.key,Bt):Je.set(Bt.index,Bt),Bt=Bt.sibling;return Je}function R(it,Ot,Je){var Bt=wo(it,Ot,Je);return Bt.index=0,Bt.sibling=null,Bt}function j(it,Ot,Je){if(it.index=Je,!a)return Ot;var Bt=it.alternate;if(Bt!==null){var Mn=Bt.index;return Mnqr?(_u=ar,ar=null):_u=ar.sibling;var _0=Nt(it,ar,Je[qr],Bt);if(_0===null){ar===null&&(ar=_u);break}a&&ar&&_0.alternate===null&&c(it,ar),ou=j(_0,ou,qr),qu===null?oi=_0:qu.sibling=_0,qu=_0,ar=_u}if(qr===Je.length)return _(it,ar),oi;if(ar===null){for(;qrH0?(Cs=_u,_u=null):Cs=_u.sibling;var pl=Nt(it,_u,Hu.value,Bt);if(pl===null){_u===null&&(_u=Cs);break}a&&_u&&pl.alternate===null&&c(it,_u),_0=j(pl,_0,H0),qr===null?ou=pl:qr.sibling=pl,qr=pl,_u=Cs}if(Hu.done)return _(it,_u),ou;if(_u===null){for(;!Hu.done;H0++,Hu=ar.next()){var Ja=pt(it,Hu.value,Bt);Ja!==null&&(_0=j(Ja,_0,H0),qr===null?ou=Ja:qr.sibling=Ja,qr=Ja)}return ou}for(var jo=T(it,_u);!Hu.done;H0++,Hu=ar.next()){var xs=Vt(jo,it,H0,Hu.value,Bt);xs!==null&&(a&&xs.alternate!==null&&jo.delete(xs.key===null?H0:xs.key),_0=j(xs,_0,H0),qr===null?ou=xs:qr.sibling=xs,qr=xs)}return a&&jo.forEach(function(X2){return c(it,X2)}),ou}function $r(it,Ot,Je,Bt){if(Ot!==null&&Ot.tag===ne){_(it,Ot.sibling);var Mn=R(Ot,Je,Bt);return Mn.return=it,Mn}_(it,Ot);var pn=Cy(Je,it.mode,Bt);return pn.return=it,pn}function wi(it,Ot,Je,Bt){for(var Mn=Je.key,pn=Ot;pn!==null;){if(pn.key===Mn)if(pn.tag===m?Je.type===ue:pn.elementType===Je.type||jc(pn,Je)){_(it,pn.sibling);var Pi=R(pn,Je.type===ue?Je.props.children:Je.props,Bt);return Pi.ref=fc(it,pn,Je),Pi.return=it,Pi._debugSource=Je._source,Pi._debugOwner=Je._owner,Pi}else{_(it,pn);break}else c(it,pn);pn=pn.sibling}if(Je.type===ue){var oi=Qa(Je.props.children,it.mode,Bt,Je.key);return oi.return=it,oi}else{var qu=Ty(Je,it.mode,Bt);return qu.ref=fc(it,Ot,Je),qu.return=it,qu}}function N0(it,Ot,Je,Bt){for(var Mn=Je.key,pn=Ot;pn!==null;){if(pn.key===Mn)if(pn.tag===q&&pn.stateNode.containerInfo===Je.containerInfo&&pn.stateNode.implementation===Je.implementation){_(it,pn.sibling);var Pi=R(pn,Je.children||[],Bt);return Pi.return=it,Pi}else{_(it,pn);break}else c(it,pn);pn=pn.sibling}var oi=xy(Je,it.mode,Bt);return oi.return=it,oi}function Vi(it,Ot,Je,Bt){var Mn=typeof Je=="object"&&Je!==null&&Je.type===ue&&Je.key===null;Mn&&(Je=Je.props.children);var pn=typeof Je=="object"&&Je!==null;if(pn)switch(Je.$$typeof){case ae:return V(wi(it,Ot,Je,Bt));case Ce:return V(N0(it,Ot,Je,Bt))}if(typeof Je=="string"||typeof Je=="number")return V($r(it,Ot,""+Je,Bt));if(Kc(Je))return vn(it,Ot,Je,Bt);if(ur(Je))return xr(it,Ot,Je,Bt);if(pn&&cc(it,Je),typeof Je=="function"&&f2(),typeof Je=="undefined"&&!Mn)switch(it.tag){case N:{var Pi=it.stateNode;if(Pi.render._isMockFunction)break}case L:{var oi=it.type;throw Error((oi.displayName||oi.name||"Component")+"(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.")}}return _(it,Ot)}return Vi}var gf=yh(!0),Xc=yh(!1);function gh(a,c){if(!(a===null||c.child===a.child))throw Error("Resuming work not yet implemented.");if(c.child!==null){var _=c.child,T=wo(_,_.pendingProps,_.expirationTime);for(c.child=T,T.return=c;_.sibling!==null;)_=_.sibling,T=T.sibling=wo(_,_.pendingProps,_.expirationTime),T.return=c;T.sibling=null}}function vm(a,c){for(var _=a.child;_!==null;)Rv(_,c),_=_.sibling}var js={},fa=Gu(js),Ji=Gu(js),O0=Gu(js);function t0(a){if(a===js)throw Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");return a}function Jl(){var a=t0(O0.current);return a}function za(a,c){Vr(O0,c,a),Vr(Ji,a,a),Vr(fa,js,a);var _=Et(c);Kr(fa,a),Vr(fa,_,a)}function no(a){Kr(fa,a),Kr(Ji,a),Kr(O0,a)}function ul(){var a=t0(fa.current);return a}function dc(a){var c=t0(O0.current),_=t0(fa.current),T=Pt(_,a.type,c);_!==T&&(Vr(Ji,a,a),Vr(fa,T,a))}function Od(a){Ji.current===a&&(Kr(fa,a),Kr(Ji,a))}var _h=0,_f=1,Ef=1,Qc=2,xl=Gu(_h);function Jc(a,c){return(a&c)!=0}function ca(a){return a&_f}function c2(a,c){return a&_f|c}function d2(a,c){return a|c}function Or(a,c){Vr(xl,c,a)}function da(a){Kr(xl,a)}function kd(a,c){var _=a.memoizedState;if(_!==null)return _.dehydrated!==null;var T=a.memoizedProps;return T.fallback===void 0?!1:T.unstable_avoidThisFallback!==!0?!0:!c}function Zc(a){for(var c=a;c!==null;){if(c.tag===pe){var _=c.memoizedState;if(_!==null){var T=_.dehydrated;if(T===null||Ls(T)||h0(T))return c}}else if(c.tag===wt&&c.memoizedProps.revealOrder!==void 0){var R=(c.effectTag&Hr)!==_i;if(R)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)return null;for(;c.sibling===null;){if(c.return===null||c.return===a)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var p2={},vi=Array.isArray;function Md(a,c,_,T){return{fiber:T,props:c,responder:a,rootEventTypes:null,state:_}}function mm(a,c,_,T,R){var j=p2,V=a.getInitialState;V!==null&&(j=V(c));var te=Md(a,c,j,_);if(!R)for(var oe=_;oe!==null;){var Ie=oe.tag;if(Ie===W){R=oe.stateNode;break}else if(Ie===U){R=oe.stateNode.containerInfo;break}oe=oe.return}Ne(a,te,c,j,R),T.set(a,te)}function h2(a,c,_,T,R){var j,V;if(a&&(j=a.responder,V=a.props),!(j&&j.$$typeof===Ut))throw Error("An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponder().");var te=V;if(_.has(j)){Kt(!1,'Duplicate event responder "%s" found in event listeners. Event listeners passed to elements cannot use the same event responder more than once.',j.displayName);return}_.add(j);var oe=T.get(j);oe===void 0?mm(j,te,c,T,R):(oe.props=te,oe.fiber=c)}function dn(a,c,_){var T=new Set,R=c.dependencies;if(a!=null){R===null&&(R=c.dependencies={expirationTime:lt,firstContext:null,responders:new Map});var j=R.responders;if(j===null&&(j=new Map),vi(a))for(var V=0,te=a.length;V0){var j=R.dispatch;if(Es!==null){var V=Es.get(R);if(V!==void 0){Es.delete(R);var te=T.memoizedState,oe=V;do{var Ie=oe.action;te=a(te,Ie),oe=oe.next}while(oe!==null);return ho(te,T.memoizedState)||up(),T.memoizedState=te,T.baseUpdate===R.last&&(T.baseState=te),R.lastRenderedState=te,[te,j]}}return[T.memoizedState,j]}var Ye=R.last,pt=T.baseUpdate,Nt=T.baseState,Vt;if(pt!==null?(Ye!==null&&(Ye.next=null),Vt=pt.next):Vt=Ye!==null?Ye.next:null,Vt!==null){var zt=Nt,vn=null,xr=null,$r=pt,wi=Vt,N0=!1;do{var Vi=wi.expirationTime;if(ViOu&&(Ou=Vi,G2(Ou));else if(vv(Vi,wi.suspenseConfig),wi.eagerReducer===a)zt=wi.eagerState;else{var it=wi.action;zt=a(zt,it)}$r=wi,wi=wi.next}while(wi!==null&&wi!==Vt);N0||(xr=$r,vn=zt),ho(zt,T.memoizedState)||up(),T.memoizedState=zt,T.baseUpdate=xr,T.baseState=vn,R.lastRenderedState=zt}var Ot=R.dispatch;return[T.memoizedState,Ot]}function Rf(a){var c=mc();typeof a=="function"&&(a=a()),c.memoizedState=c.baseState=a;var _=c.queue={last:null,dispatch:null,lastRenderedReducer:Nd,lastRenderedState:a},T=_.dispatch=u1.bind(null,ll,_);return[c.memoizedState,T]}function n1(a){return t1(Nd,a)}function Wa(a,c,_,T){var R={tag:a,create:c,destroy:_,deps:T,next:null};if(Zl===null)Zl=Ha(),Zl.lastEffect=R.next=R;else{var j=Zl.lastEffect;if(j===null)Zl.lastEffect=R.next=R;else{var V=j.next;j.next=R,R.next=V,Zl.lastEffect=R}}return R}function r1(a){var c=mc(),_={current:a};return Object.seal(_),c.memoizedState=_,_}function Ld(a){var c=e1();return c.memoizedState}function g2(a,c,_,T){var R=mc(),j=T===void 0?null:T;Tf|=a,R.memoizedState=Wa(c,_,void 0,j)}function yc(a,c,_,T){var R=e1(),j=T===void 0?null:T,V=void 0;if(Pn!==null){var te=Pn.memoizedState;if(V=te.destroy,j!==null){var oe=te.deps;if(xf(j,oe)){Wa(wf,_,V,j);return}}}Tf|=a,R.memoizedState=Wa(c,_,V,j)}function i1(a,c){return typeof jest!="undefined"&&Av(ll),g2(mr|L0,rr|$c,a,c)}function Rl(a,c){return typeof jest!="undefined"&&Av(ll),yc(mr|L0,rr|$c,a,c)}function pa(a,c){return g2(mr,Sf|ol,a,c)}function wh(a,c){return yc(mr,Sf|ol,a,c)}function Fd(a,c){if(typeof c=="function"){var _=c,T=a();return _(T),function(){_(null)}}else if(c!=null){var R=c;R.hasOwnProperty("current")||Kt(!1,"Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.","an object with keys {"+Object.keys(R).join(", ")+"}");var j=a();return R.current=j,function(){R.current=null}}}function bd(a,c,_){typeof c!="function"&&Kt(!1,"Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",c!==null?typeof c:"null");var T=_!=null?_.concat([a]):null;return g2(mr,Sf|ol,Fd.bind(null,c,a),T)}function Sh(a,c,_){typeof c!="function"&&Kt(!1,"Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",c!==null?typeof c:"null");var T=_!=null?_.concat([a]):null;return yc(mr,Sf|ol,Fd.bind(null,c,a),T)}function _2(a,c){}var Th=_2;function Ol(a,c){var _=mc(),T=c===void 0?null:c;return _.memoizedState=[a,T],a}function es(a,c){var _=e1(),T=c===void 0?null:c,R=_.memoizedState;if(R!==null&&T!==null){var j=R[1];if(xf(T,j))return R[0]}return _.memoizedState=[a,T],a}function Ds(a,c){var _=mc(),T=c===void 0?null:c,R=a();return _.memoizedState=[R,T],R}function zs(a,c){var _=e1(),T=c===void 0?null:c,R=_.memoizedState;if(R!==null&&T!==null){var j=R[1];if(xf(T,j))return R[0]}var V=a();return _.memoizedState=[V,T],V}function Pd(a,c){var _=Rf(a),T=_[0],R=_[1];return i1(function(){t.unstable_next(function(){var j=Bo.suspense;Bo.suspense=c===void 0?null:c;try{R(a)}finally{Bo.suspense=j}})},[a,c]),T}function Ch(a,c){var _=n1(a),T=_[0],R=_[1];return Rl(function(){t.unstable_next(function(){var j=Bo.suspense;Bo.suspense=c===void 0?null:c;try{R(a)}finally{Bo.suspense=j}})},[a,c]),T}function Id(a){var c=Rf(!1),_=c[0],T=c[1],R=Ol(function(j){T(!0),t.unstable_next(function(){var V=Bo.suspense;Bo.suspense=a===void 0?null:a;try{T(!1),j()}finally{Bo.suspense=V}})},[a,_]);return[R,_]}function Bd(a){var c=n1(!1),_=c[0],T=c[1],R=es(function(j){T(!0),t.unstable_next(function(){var V=Bo.suspense;Bo.suspense=a===void 0?null:a;try{T(!1),j()}finally{Bo.suspense=V}})},[a,_]);return[R,_]}function u1(a,c,_){if(!(vc=0){var _=l1()-s1;a.actualDuration+=_,c&&(a.selfBaseDuration=_),s1=-1}}var Ml=null,Ga=null,ha=!1;function qd(){ha&&Kt(!1,"We should not be hydrating here. This is a bug in React. Please file a bug.")}function Hd(a){if(!_e)return!1;var c=a.stateNode.containerInfo;return Ga=B(c),Ml=a,ha=!0,!0}function Em(a,c){return _e?(Ga=Ni(c),Gd(a),ha=!0,!0):!1}function Wd(a,c){switch(a.tag){case U:ie(a.stateNode.containerInfo,c);break;case W:qe(a.type,a.memoizedProps,a.stateNode,c);break}var _=eE();_.stateNode=c,_.return=a,_.effectTag=W0,a.lastEffect!==null?(a.lastEffect.nextEffect=_,a.lastEffect=_):a.firstEffect=a.lastEffect=_}function Mh(a,c){switch(c.effectTag=c.effectTag&~tu|ai,a.tag){case U:{var _=a.stateNode.containerInfo;switch(c.tag){case W:var T=c.type,R=c.pendingProps;tt(_,T,R);break;case ne:var j=c.pendingProps;Tt(_,j);break;case pe:kt(_);break}break}case W:{var V=a.type,te=a.memoizedProps,oe=a.stateNode;switch(c.tag){case W:var Ie=c.type,Ye=c.pendingProps;bt(V,te,oe,Ie,Ye);break;case ne:var pt=c.pendingProps;on(V,te,oe,pt);break;case pe:tn(V,te,oe);break}break}default:return}}function Nh(a,c){switch(a.tag){case W:{var _=a.type,T=a.pendingProps,R=lf(c,_,T);return R!==null?(a.stateNode=R,!0):!1}case ne:{var j=a.pendingProps,V=Ns(c,j);return V!==null?(a.stateNode=V,!0):!1}case pe:{if(Di){var te=Ma(c);if(te!==null){var oe={dehydrated:te,retryTime:hi};a.memoizedState=oe;var Ie=tE(te);return Ie.return=a,a.child=Ie,!0}}return!1}default:return!1}}function Vd(a){if(!!ha){var c=Ga;if(!c){Mh(Ml,a),ha=!1,Ml=a;return}var _=c;if(!Nh(a,c)){if(c=Ni(_),!c||!Nh(a,c)){Mh(Ml,a),ha=!1,Ml=a;return}Wd(Ml,_)}Ml=a,Ga=B(c)}}function Dm(a,c,_){if(!_e)throw Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");var T=a.stateNode,R=z(T,a.type,a.memoizedProps,c,_,a);return a.updateQueue=R,R!==null}function wm(a){if(!_e)throw Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");var c=a.stateNode,_=a.memoizedProps,T=G(c,_,a);if(T){var R=Ml;if(R!==null)switch(R.tag){case U:{var j=R.stateNode.containerInfo;Xe(j,c,_);break}case W:{var V=R.type,te=R.memoizedProps,oe=R.stateNode;ht(V,te,oe,c,_);break}}}return T}function Lh(a){if(!_e)throw Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");var c=a.memoizedState,_=c!==null?c.dehydrated:null;if(!_)throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");$(_,a)}function Sm(a){if(!_e)throw Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");var c=a.memoizedState,_=c!==null?c.dehydrated:null;if(!_)throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");return De(_)}function Gd(a){for(var c=a.return;c!==null&&c.tag!==W&&c.tag!==U&&c.tag!==pe;)c=c.return;Ml=c}function f1(a){if(!_e||a!==Ml)return!1;if(!ha)return Gd(a),ha=!0,!1;var c=a.type;if(a.tag!==W||c!=="head"&&c!=="body"&&!Ti(c,a.memoizedProps))for(var _=Ga;_;)Wd(a,_),_=Ni(_);return Gd(a),a.tag===pe?Ga=Sm(a):Ga=Ml?Ni(a.stateNode):null,!0}function c1(){!_e||(Ml=null,Ga=null,ha=!1)}var d1=at.ReactCurrentOwner,va=!1,Yd,qs,Hs,Ws,Kd,ma,p1,E2,gc,Xd;Yd={},qs={},Hs={},Ws={},Kd={},ma=!1,p1=!1,E2={},gc={},Xd={};function _o(a,c,_,T){a===null?c.child=Xc(c,null,_,T):c.child=gf(c,a.child,_,T)}function Fh(a,c,_,T){c.child=gf(c,a.child,null,T),c.child=gf(c,null,_,T)}function bh(a,c,_,T,R){if(c.type!==c.elementType){var j=_.propTypes;j&&E(j,T,"prop",qt(_),Rr)}var V=_.render,te=c.ref,oe;return e0(c,R),d1.current=c,Ze("render"),oe=Af(a,c,V,T,te,R),Ei&&c.mode&cr&&c.memoizedState!==null&&(oe=Af(a,c,V,T,te,R)),Ze(null),a!==null&&!va?(v2(a,c,R),ya(a,c,R)):(c.effectTag|=eu,_o(a,c,oe,R),c.child)}function Ph(a,c,_,T,R,j){if(a===null){var V=_.type;if(i0(V)&&_.compare===null&&_.defaultProps===void 0){var te=V;return te=Zu(V),c.tag=le,c.type=te,Zd(c,V),Ih(a,c,te,T,R,j)}{var oe=V.propTypes;oe&&E(oe,T,"prop",qt(V),Rr)}var Ie=Sy(_.type,null,T,null,c.mode,j);return Ie.ref=c.ref,Ie.return=c,c.child=Ie,Ie}{var Ye=_.type,pt=Ye.propTypes;pt&&E(pt,T,"prop",qt(Ye),Rr)}var Nt=a.child;if(R component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.",oe,oe),Yd[oe]=!0)}c.mode&cr&&wl.recordLegacyContextWarning(c,null),d1.current=c,te=Af(null,c,_,R,j,T)}if(c.effectTag|=eu,typeof te=="object"&&te!==null&&typeof te.render=="function"&&te.$$typeof===void 0){{var Ie=qt(_)||"Unknown";qs[Ie]||(Ke(!1,"The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",Ie,Ie,Ie),qs[Ie]=!0)}c.tag=N,m2();var Ye=!1;zi(_)?(Ye=!0,Fi(c)):Ye=!1,c.memoizedState=te.state!==null&&te.state!==void 0?te.state:null;var pt=_.getDerivedStateFromProps;return typeof pt=="function"&&yf(c,_,pt,R),il(c,te),ac(c,_,R,T),Jd(null,c,_,!0,Ye,T)}else return c.tag=L,ni&&_.contextTypes&&Ke(!1,"%s uses the legacy contextTypes API which is no longer supported. Use React.createContext() with React.useContext() instead.",qt(_)||"Unknown"),Ei&&c.mode&cr&&c.memoizedState!==null&&(te=Af(null,c,_,R,j,T)),_o(null,c,te,T),Zd(c,_),c.child}function Zd(a,c){if(c&&c.childContextTypes&&Ke(!1,"%s(...): childContextTypes cannot be defined on a function component.",c.displayName||c.name||"Component"),a.ref!==null){var _="",T=v0();T&&(_+=` + +Check the render method of \``+T+"`.");var R=T||a._debugID||"",j=a._debugSource;j&&(R=j.fileName+":"+j.lineNumber),Kd[R]||(Kd[R]=!0,Kt(!1,"Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s",_))}if(Wl&&c.defaultProps!==void 0){var V=qt(c)||"Unknown";Xd[V]||(Ke(!1,"%s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.",V),Xd[V]=!0)}if(typeof c.getDerivedStateFromProps=="function"){var te=qt(c)||"Unknown";Ws[te]||(Ke(!1,"%s: Function components do not support getDerivedStateFromProps.",te),Ws[te]=!0)}if(typeof c.contextType=="object"&&c.contextType!==null){var oe=qt(c)||"Unknown";Hs[oe]||(Ke(!1,"%s: Function components do not support contextType.",oe),Hs[oe]=!0)}}var w2={dehydrated:null,retryTime:lt};function $d(a,c,_){return Jc(a,Qc)&&(c===null||c.memoizedState!==null)}function qh(a,c,_){var T=c.mode,R=c.pendingProps;a_(c)&&(c.effectTag|=Hr);var j=xl.current,V=!1,te=(c.effectTag&Hr)!==_i;if(te||$d(j,a,c)?(V=!0,c.effectTag&=~Hr):(a===null||a.memoizedState!==null)&&R.fallback!==void 0&&R.unstable_avoidThisFallback!==!0&&(j=d2(j,Ef)),j=ca(j),Or(c,j),"maxDuration"in R&&(p1||(p1=!0,Kt(!1,"maxDuration has been removed from React. Remove the maxDuration prop."))),a===null){if(R.fallback!==void 0&&(Vd(c),Di)){var oe=c.memoizedState;if(oe!==null){var Ie=oe.dehydrated;if(Ie!==null)return Hh(c,Ie,_)}}if(V){var Ye=R.fallback,pt=Qa(null,T,lt,null);if(pt.return=c,(c.mode&Y)===Sr){var Nt=c.memoizedState,Vt=Nt!==null?c.child.child:c.child;pt.child=Vt;for(var zt=Vt;zt!==null;)zt.return=pt,zt=zt.sibling}var vn=Qa(Ye,T,_,null);return vn.return=c,pt.sibling=vn,c.memoizedState=w2,c.child=pt,vn}else{var xr=R.children;return c.memoizedState=null,c.child=Xc(c,null,xr,_)}}else{var $r=a.memoizedState;if($r!==null){if(Di){var wi=$r.dehydrated;if(wi!==null)if(te){if(c.memoizedState!==null)return c.child=a.child,c.effectTag|=Hr,null;var N0=R.fallback,Vi=Qa(null,T,lt,null);if(Vi.return=c,Vi.child=null,(c.mode&Y)===Sr)for(var it=Vi.child=c.child;it!==null;)it.return=Vi,it=it.sibling;else gf(c,a.child,null,_);if(Zt&&c.mode&Jr){for(var Ot=0,Je=Vi.child;Je!==null;)Ot+=Je.treeBaseDuration,Je=Je.sibling;Vi.treeBaseDuration=Ot}var Bt=Qa(N0,T,_,null);return Bt.return=c,Vi.sibling=Bt,Bt.effectTag|=ai,Vi.childExpirationTime=lt,c.memoizedState=w2,c.child=Vi,Bt}else return Wh(a,c,wi,$r,_)}var Mn=a.child,pn=Mn.sibling;if(V){var Pi=R.fallback,oi=wo(Mn,Mn.pendingProps,lt);if(oi.return=c,(c.mode&Y)===Sr){var qu=c.memoizedState,ar=qu!==null?c.child.child:c.child;if(ar!==Mn.child){oi.child=ar;for(var ou=ar;ou!==null;)ou.return=oi,ou=ou.sibling}}if(Zt&&c.mode&Jr){for(var qr=0,_u=oi.child;_u!==null;)qr+=_u.treeBaseDuration,_u=_u.sibling;oi.treeBaseDuration=qr}var _0=wo(pn,Pi,pn.expirationTime);return _0.return=c,oi.sibling=_0,oi.childExpirationTime=lt,c.memoizedState=w2,c.child=oi,_0}else{var H0=R.children,Cs=Mn.child,Hu=gf(c,Cs,H0,_);return c.memoizedState=null,c.child=Hu}}else{var pl=a.child;if(V){var Ja=R.fallback,jo=Qa(null,T,lt,null);if(jo.return=c,jo.child=pl,pl!==null&&(pl.return=jo),(c.mode&Y)===Sr){var xs=c.memoizedState,X2=xs!==null?c.child.child:c.child;jo.child=X2;for(var Uf=X2;Uf!==null;)Uf.return=jo,Uf=Uf.sibling}if(Zt&&c.mode&Jr){for(var Rc=0,Pl=jo.child;Pl!==null;)Rc+=Pl.treeBaseDuration,Pl=Pl.sibling;jo.treeBaseDuration=Rc}var zo=Qa(Ja,T,_,null);return zo.return=c,jo.sibling=zo,zo.effectTag|=ai,jo.childExpirationTime=lt,c.memoizedState=w2,c.child=jo,zo}else{c.memoizedState=null;var O1=R.children;return c.child=gf(c,pl,O1,_)}}}}function ep(a,c,_){c.memoizedState=null;var T=c.pendingProps,R=T.children;return _o(a,c,R,_),c.child}function Hh(a,c,_){if((a.mode&Y)===Sr)Kt(!1,"Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOM.createBlockingRoot(container, { hydrate: true }).render(element) or remove the Suspense components from the server rendered components."),a.expirationTime=bn;else if(h0(c)){var T=Fl(),R=ms(T);Ln&&x(R),a.expirationTime=R}else a.expirationTime=hi,Ln&&x(hi);return null}function Wh(a,c,_,T,R){if(qd(),(c.mode&Y)===Sr||h0(_))return ep(a,c,R);var j=a.childExpirationTime>=R;if(va||j){if(R. Use lowercase "%s" instead.',a,a.toLowerCase());break}case"forward":case"backward":{Kt(!1,'"%s" is not a valid value for revealOrder on . React uses the -s suffix in the spelling. Use "%ss" instead.',a,a.toLowerCase());break}default:Kt(!1,'"%s" is not a supported revealOrder on . Did you mean "together", "forwards" or "backwards"?',a);break}else Kt(!1,'%s is not a supported value for revealOrder on . Did you mean "together", "forwards" or "backwards"?',a)}function Vh(a,c){a!==void 0&&!gc[a]&&(a!=="collapsed"&&a!=="hidden"?(gc[a]=!0,Kt(!1,'"%s" is not a supported value for tail on . Did you mean "collapsed" or "hidden"?',a)):c!=="forwards"&&c!=="backwards"&&(gc[a]=!0,Kt(!1,' is only valid if revealOrder is "forwards" or "backwards". Did you mean to specify revealOrder="forwards"?',a)))}function v1(a,c){{var _=Array.isArray(a),T=!_&&typeof ur(a)=="function";if(_||T){var R=_?"array":"iterable";return Kt(!1,"A nested %s was passed to row #%s in . Wrap it in an additional SuspenseList to configure its revealOrder: ... {%s} ... ",R,c,R),!1}}return!0}function Mm(a,c){if((c==="forwards"||c==="backwards")&&a!==void 0&&a!==null&&a!==!1)if(Array.isArray(a)){for(var _=0;_. This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?',c)}}function np(a,c,_,T,R,j){var V=a.memoizedState;V===null?a.memoizedState={isBackwards:c,rendering:null,last:T,tail:_,tailExpiration:0,tailMode:R,lastEffect:j}:(V.isBackwards=c,V.rendering=null,V.last=T,V.tail=_,V.tailExpiration=0,V.tailMode=R,V.lastEffect=j)}function rp(a,c,_){var T=c.pendingProps,R=T.revealOrder,j=T.tail,V=T.children;km(R),Vh(j,R),Mm(V,R),_o(a,c,V,_);var te=xl.current,oe=Jc(te,Qc);if(oe)te=c2(te,Qc),c.effectTag|=Hr;else{var Ie=a!==null&&(a.effectTag&Hr)!==_i;Ie&&Rm(c,c.child,_),te=ca(te)}if(Or(c,te),(c.mode&Y)===Sr)c.memoizedState=null;else switch(R){case"forwards":{var Ye=Om(c.child),pt;Ye===null?(pt=c.child,c.child=null):(pt=Ye.sibling,Ye.sibling=null),np(c,!1,pt,Ye,j,c.lastEffect);break}case"backwards":{var Nt=null,Vt=c.child;for(c.child=null;Vt!==null;){var zt=Vt.alternate;if(zt!==null&&Zc(zt)===null){c.child=Vt;break}var vn=Vt.sibling;Vt.sibling=Nt,Nt=Vt,Vt=vn}np(c,!0,Nt,null,j,c.lastEffect);break}case"together":{np(c,!1,null,null,void 0,c.lastEffect);break}default:c.memoizedState=null}return c.child}function Nm(a,c,_){za(c,c.stateNode.containerInfo);var T=c.pendingProps;return a===null?c.child=gf(c,null,T,_):_o(a,c,T,_),c.child}function Lm(a,c,_){var T=c.type,R=T._context,j=c.pendingProps,V=c.memoizedProps,te=j.value;{var oe=c.type.propTypes;oe&&E(oe,j,"prop","Context.Provider",Rr)}if(Er(c,te),V!==null){var Ie=V.value,Ye=iu(R,te,Ie);if(Ye===0){if(V.children===j.children&&!na())return ya(a,c,_)}else Tl(c,R,Ye,_)}var pt=j.children;return _o(a,c,pt,_),c.child}var Gh=!1;function Fm(a,c,_){var T=c.type;T._context===void 0?T!==T.Consumer&&(Gh||(Gh=!0,Kt(!1,"Rendering directly is not supported and will be removed in a future major release. Did you mean to render instead?"))):T=T._context;var R=c.pendingProps,j=R.children;typeof j!="function"&&Ke(!1,"A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it."),e0(c,_);var V=He(T,R.unstable_observedBits),te;return d1.current=c,Ze("render"),te=j(V),Ze(null),c.effectTag|=eu,_o(a,c,te,_),c.child}function bm(a,c,_){var T=c.type.impl;if(T.reconcileChildren===!1)return null;var R=c.pendingProps,j=R.children;return _o(a,c,j,_),c.child}function ip(a,c,_){var T=c.pendingProps,R=T.children;return _o(a,c,R,_),c.child}function up(){va=!0}function ya(a,c,_){Ki(c),a!==null&&(c.dependencies=a.dependencies),Zt&&kh(c);var T=c.expirationTime;T!==lt&&G2(T);var R=c.childExpirationTime;return R<_?null:(gh(a,c),c.child)}function m1(a,c,_){{var T=c.return;if(T===null)throw new Error("Cannot swap the root fiber.");if(a.alternate=null,c.alternate=null,_.index=c.index,_.sibling=c.sibling,_.return=c.return,_.ref=c.ref,c===T.child)T.child=_;else{var R=T.child;if(R===null)throw new Error("Expected parent to have a child.");for(;R.sibling!==c;)if(R=R.sibling,R===null)throw new Error("Expected to find the previous sibling.");R.sibling=_}var j=T.lastEffect;return j!==null?(j.nextEffect=a,T.lastEffect=a):T.firstEffect=T.lastEffect=a,a.nextEffect=null,a.effectTag=W0,_.effectTag|=ai,_}}function op(a,c,_){var T=c.expirationTime;if(c._debugNeedsRemount&&a!==null)return m1(a,c,Sy(c.type,c.key,c.pendingProps,c._debugOwner||null,c.mode,c.expirationTime));if(a!==null){var R=a.memoizedProps,j=c.pendingProps;if(R!==j||na()||c.type!==a.type)va=!0;else if(T<_){switch(va=!1,c.tag){case U:zh(c),c1();break;case W:if(dc(c),c.mode&Qr&&_!==hi&&d0(c.type,j))return Ln&&x(hi),c.expirationTime=c.childExpirationTime=hi,null;break;case N:{var V=c.type;zi(V)&&Fi(c);break}case q:za(c,c.stateNode.containerInfo);break;case he:{var te=c.memoizedProps.value;Er(c,te);break}case ze:if(Zt){var oe=c.childExpirationTime>=_;oe&&(c.effectTag|=mr)}break;case pe:{var Ie=c.memoizedState;if(Ie!==null){if(Di&&Ie.dehydrated!==null){Or(c,ca(xl.current)),c.effectTag|=Hr;break}var Ye=c.child,pt=Ye.childExpirationTime;if(pt!==lt&&pt>=_)return qh(a,c,_);Or(c,ca(xl.current));var Nt=ya(a,c,_);return Nt!==null?Nt.sibling:null}else Or(c,ca(xl.current));break}case wt:{var Vt=(a.effectTag&Hr)!==_i,zt=c.childExpirationTime>=_;if(Vt){if(zt)return rp(a,c,_);c.effectTag|=Hr}var vn=c.memoizedState;if(vn!==null&&(vn.rendering=null,vn.tail=null),Or(c,xl.current),zt)break;return null}}return ya(a,c,_)}else va=!1}else va=!1;switch(c.expirationTime=lt,c.tag){case C:return Am(a,c,c.type,_);case Ue:{var xr=c.elementType;return kf(a,c,xr,T,_)}case L:{var $r=c.type,wi=c.pendingProps,N0=c.elementType===$r?wi:bi($r,wi);return Qd(a,c,$r,N0,_)}case N:{var Vi=c.type,it=c.pendingProps,Ot=c.elementType===Vi?it:bi(Vi,it);return jh(a,c,Vi,Ot,_)}case U:return Cm(a,c,_);case W:return xm(a,c,_);case ne:return Of(a,c);case pe:return qh(a,c,_);case q:return Nm(a,c,_);case ge:{var Je=c.type,Bt=c.pendingProps,Mn=c.elementType===Je?Bt:bi(Je,Bt);return bh(a,c,Je,Mn,_)}case m:return Tm(a,c,_);case we:return Bh(a,c,_);case ze:return Uh(a,c,_);case he:return Lm(a,c,_);case Se:return Fm(a,c,_);case Oe:{var pn=c.type,Pi=c.pendingProps,oi=bi(pn,Pi);if(c.type!==c.elementType){var qu=pn.propTypes;qu&&E(qu,oi,"prop",qt(pn),Rr)}return oi=bi(pn.type,oi),Ph(a,c,pn,oi,T,_)}case le:return Ih(a,c,c.type,c.pendingProps,T,_);case Ge:{var ar=c.type,ou=c.pendingProps,qr=c.elementType===ar?ou:bi(ar,ou);return D2(a,c,ar,qr,_)}case wt:return rp(a,c,_);case xt:{if(Ht)return bm(a,c,_);break}case $e:{if(Du)return ip(a,c,_);break}}throw Error("Unknown unit of work tag ("+c.tag+"). This error is likely caused by a bug in React. Please file an issue.")}function Yh(a,c,_,T){return{currentFiber:a,impl:_,instance:null,prevProps:null,props:c,state:T}}function S2(a){return a.tag===pe&&a.memoizedState!==null}function y1(a){return a.child.sibling.child}var Kh={};function lp(a,c,_){if(Du){if(a.tag===W){var T=a.type,R=a.memoizedProps,j=a.stateNode,V=Ro(j);V!==null&&c(T,R||Kh,V)===!0&&_.push(V)}var te=a.child;S2(a)&&(te=y1(a)),te!==null&&sp(te,c,_)}}function Xh(a,c){if(Du){if(a.tag===W){var _=a.type,T=a.memoizedProps,R=a.stateNode,j=Ro(R);if(j!==null&&c(_,T,j)===!0)return j}var V=a.child;if(S2(a)&&(V=y1(a)),V!==null)return Qh(V,c)}return null}function sp(a,c,_){for(var T=a;T!==null;)lp(T,c,_),T=T.sibling}function Qh(a,c){for(var _=a;_!==null;){var T=Xh(_,c);if(T!==null)return T;_=_.sibling}return null}function Jh(a,c,_){if(T2(a,c))_.push(a.stateNode.methods);else{var T=a.child;S2(a)&&(T=y1(a)),T!==null&&ap(T,c,_)}}function ap(a,c,_){for(var T=a;T!==null;)Jh(T,c,_),T=T.sibling}function T2(a,c){return a.tag===$e&&a.type===c&&a.stateNode!==null}function C2(a,c){return{getChildren:function(){var _=c.fiber,T=_.child,R=[];return T!==null&&ap(T,a,R),R.length===0?null:R},getChildrenFromRoot:function(){for(var _=c.fiber,T=_;T!==null;){var R=T.return;if(R===null||(T=R,T.tag===$e&&T.type===a))break}var j=[];return ap(T.child,a,j),j.length===0?null:j},getParent:function(){for(var _=c.fiber.return;_!==null;){if(_.tag===$e&&_.type===a)return _.stateNode.methods;_=_.return}return null},getProps:function(){var _=c.fiber;return _.memoizedProps},queryAllNodes:function(_){var T=c.fiber,R=T.child,j=[];return R!==null&&sp(R,_,j),j.length===0?null:j},queryFirstNode:function(_){var T=c.fiber,R=T.child;return R!==null?Qh(R,_):null},containsNode:function(_){for(var T=or(_);T!==null;){if(T.tag===$e&&T.type===a&&T.stateNode===c)return!0;T=T.return}return!1}}}function z0(a){a.effectTag|=mr}function x2(a){a.effectTag|=To}var ga,Ya,A2,R2;if(P0)ga=function(a,c,_,T){for(var R=c.child;R!==null;){if(R.tag===W||R.tag===ne)Wr(a,R.stateNode);else if(Ht&&R.tag===xt)Wr(a,R.stateNode.instance);else if(R.tag!==q){if(R.child!==null){R.child.return=R,R=R.child;continue}}if(R===c)return;for(;R.sibling===null;){if(R.return===null||R.return===c)return;R=R.return}R.sibling.return=R.return,R=R.sibling}},Ya=function(a){},A2=function(a,c,_,T,R){var j=a.memoizedProps;if(j!==T){var V=c.stateNode,te=ul(),oe=c0(V,_,j,T,R,te);c.updateQueue=oe,oe&&z0(c)}},R2=function(a,c,_,T){_!==T&&z0(c)};else if(X){ga=function(a,c,_,T){for(var R=c.child;R!==null;){e:if(R.tag===W){var j=R.stateNode;if(_&&T){var V=R.memoizedProps,te=R.type;j=Gr(j,te,V,R)}Wr(a,j)}else if(R.tag===ne){var oe=R.stateNode;if(_&&T){var Ie=R.memoizedProps;oe=Yl(oe,Ie,R)}Wr(a,oe)}else if(Ht&&R.tag===xt){var Ye=R.stateNode.instance;if(_&&T){var pt=R.memoizedProps,Nt=R.type;Ye=Gr(Ye,Nt,pt,R)}Wr(a,Ye)}else if(R.tag!==q){if(R.tag===pe){if((R.effectTag&mr)!==_i){var Vt=R.memoizedState!==null;if(Vt){var zt=R.child;if(zt!==null){zt.child!==null&&(zt.child.return=zt,ga(a,zt,!0,Vt));var vn=zt.sibling;if(vn!==null){vn.return=R,R=vn;continue}}}}if(R.child!==null){R.child.return=R,R=R.child;continue}}else if(R.child!==null){R.child.return=R,R=R.child;continue}}if(R=R,R===c)return;for(;R.sibling===null;){if(R.return===null||R.return===c)return;R=R.return}R.sibling.return=R.return,R=R.sibling}};var fp=function(a,c,_,T){for(var R=c.child;R!==null;){e:if(R.tag===W){var j=R.stateNode;if(_&&T){var V=R.memoizedProps,te=R.type;j=Gr(j,te,V,R)}Gn(a,j)}else if(R.tag===ne){var oe=R.stateNode;if(_&&T){var Ie=R.memoizedProps;oe=Yl(oe,Ie,R)}Gn(a,oe)}else if(Ht&&R.tag===xt){var Ye=R.stateNode.instance;if(_&&T){var pt=R.memoizedProps,Nt=R.type;Ye=Gr(Ye,Nt,pt,R)}Gn(a,Ye)}else if(R.tag!==q){if(R.tag===pe){if((R.effectTag&mr)!==_i){var Vt=R.memoizedState!==null;if(Vt){var zt=R.child;if(zt!==null){zt.child!==null&&(zt.child.return=zt,fp(a,zt,!0,Vt));var vn=zt.sibling;if(vn!==null){vn.return=R,R=vn;continue}}}}if(R.child!==null){R.child.return=R,R=R.child;continue}}else if(R.child!==null){R.child.return=R,R=R.child;continue}}if(R=R,R===c)return;for(;R.sibling===null;){if(R.return===null||R.return===c)return;R=R.return}R.sibling.return=R.return,R=R.sibling}};Ya=function(a){var c=a.stateNode,_=a.firstEffect===null;if(!_){var T=c.containerInfo,R=w0(T);fp(R,a,!1,!1),c.pendingChildren=R,z0(a),ic(T,R)}},A2=function(a,c,_,T,R){var j=a.stateNode,V=a.memoizedProps,te=c.firstEffect===null;if(te&&V===T){c.stateNode=j;return}var oe=c.stateNode,Ie=ul(),Ye=null;if(V!==T&&(Ye=c0(oe,_,V,T,R,Ie)),te&&Ye===null){c.stateNode=j;return}var pt=cs(j,Ye,_,V,T,c,te,oe);wu(pt,_,T,R,Ie)&&z0(c),c.stateNode=pt,te?z0(c):ga(pt,c,!1,!1)},R2=function(a,c,_,T){if(_!==T){var R=Jl(),j=ul();c.stateNode=as(T,R,j,c),z0(c)}}}else Ya=function(a){},A2=function(a,c,_,T,R){},R2=function(a,c,_,T){};function O2(a,c){switch(a.tailMode){case"hidden":{for(var _=a.tail,T=null;_!==null;)_.alternate!==null&&(T=_),_=_.sibling;T===null?a.tail=null:T.sibling=null;break}case"collapsed":{for(var R=a.tail,j=null;R!==null;)R.alternate!==null&&(j=R),R=R.sibling;j===null?!c&&a.tail!==null?a.tail.sibling=null:a.tail=null:j.sibling=null;break}}}function Zh(a,c,_){var T=c.pendingProps;switch(c.tag){case C:break;case Ue:break;case le:case L:break;case N:{var R=c.type;zi(R)&&Is(c);break}case U:{no(c),x0(c);var j=c.stateNode;if(j.pendingContext&&(j.context=j.pendingContext,j.pendingContext=null),a===null||a.child===null){var V=f1(c);V&&z0(c)}Ya(c);break}case W:{Od(c);var te=Jl(),oe=c.type;if(a!==null&&c.stateNode!=null){if(A2(a,c,oe,T,te),ci){var Ie=a.memoizedProps.listeners,Ye=T.listeners;Ie!==Ye&&z0(c)}a.ref!==c.ref&&x2(c)}else{if(!T){if(c.stateNode===null)throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");break}var pt=ul(),Nt=f1(c);if(Nt){if(Dm(c,te,pt)&&z0(c),ci){var Vt=T.listeners;Vt!=null&&dn(Vt,c,te)}}else{var zt=ji(oe,T,te,pt,c);if(ga(zt,c,!1,!1),c.stateNode=zt,ci){var vn=T.listeners;vn!=null&&dn(vn,c,te)}wu(zt,oe,T,te,pt)&&z0(c)}c.ref!==null&&x2(c)}break}case ne:{var xr=T;if(a&&c.stateNode!=null){var $r=a.memoizedProps;R2(a,c,$r,xr)}else{if(typeof xr!="string"&&c.stateNode===null)throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");var wi=Jl(),N0=ul(),Vi=f1(c);Vi?wm(c)&&z0(c):c.stateNode=as(xr,wi,N0,c)}break}case ge:break;case pe:{da(c);var it=c.memoizedState;if(Di&&it!==null&&it.dehydrated!==null)if(a===null){var Ot=f1(c);if(!Ot)throw Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");return Lh(c),Ln&&x(hi),null}else return c1(),(c.effectTag&Hr)===_i&&(c.memoizedState=null),c.effectTag|=mr,null;if((c.effectTag&Hr)!==_i)return c.expirationTime=_,c;var Je=it!==null,Bt=!1;if(a===null)c.memoizedProps.fallback!==void 0&&f1(c);else{var Mn=a.memoizedState;if(Bt=Mn!==null,!Je&&Mn!==null){var pn=a.child.sibling;if(pn!==null){var Pi=c.firstEffect;Pi!==null?(c.firstEffect=pn,pn.nextEffect=Pi):(c.firstEffect=c.lastEffect=pn,pn.nextEffect=null),pn.effectTag=W0}}}if(Je&&!Bt&&(c.mode&Y)!==Sr){var oi=a===null&&c.memoizedProps.unstable_avoidThisFallback!==!0;oi||Jc(xl.current,Ef)?mv():yv()}X&&Je&&(c.effectTag|=mr),P0&&(Je||Bt)&&(c.effectTag|=mr),Ui&&c.updateQueue!==null&&c.memoizedProps.suspenseCallback!=null&&(c.effectTag|=mr);break}case m:break;case we:break;case ze:break;case q:no(c),Ya(c);break;case he:$u(c);break;case Se:break;case Oe:break;case Ge:{var qu=c.type;zi(qu)&&Is(c);break}case wt:{da(c);var ar=c.memoizedState;if(ar===null)break;var ou=(c.effectTag&Hr)!==_i,qr=ar.rendering;if(qr===null)if(ou)O2(ar,!1);else{var _u=gv()&&(a===null||(a.effectTag&Hr)===_i);if(!_u)for(var _0=c.child;_0!==null;){var H0=Zc(_0);if(H0!==null){ou=!0,c.effectTag|=Hr,O2(ar,!1);var Cs=H0.updateQueue;return Cs!==null&&(c.updateQueue=Cs,c.effectTag|=mr),ar.lastEffect===null&&(c.firstEffect=null),c.lastEffect=ar.lastEffect,vm(c,_),Or(c,c2(xl.current,Qc)),c.child}_0=_0.sibling}}else{if(!ou){var Hu=Zc(qr);if(Hu!==null){c.effectTag|=Hr,ou=!0;var pl=Hu.updateQueue;if(pl!==null&&(c.updateQueue=pl,c.effectTag|=mr),O2(ar,!0),ar.tail===null&&ar.tailMode==="hidden"&&!qr.alternate){var Ja=c.lastEffect=ar.lastEffect;return Ja!==null&&(Ja.nextEffect=null),null}}else if(vt()>ar.tailExpiration&&_>hi){c.effectTag|=Hr,ou=!0,O2(ar,!1);var jo=_-1;c.expirationTime=c.childExpirationTime=jo,Ln&&x(jo)}}if(ar.isBackwards)qr.sibling=c.child,c.child=qr;else{var xs=ar.last;xs!==null?xs.sibling=qr:c.child=qr,ar.last=qr}}if(ar.tail!==null){if(ar.tailExpiration===0){var X2=500;ar.tailExpiration=vt()+X2}var Uf=ar.tail;ar.rendering=Uf,ar.tail=Uf.sibling,ar.lastEffect=c.lastEffect,Uf.sibling=null;var Rc=xl.current;return ou?Rc=c2(Rc,Qc):Rc=ca(Rc),Or(c,Rc),Uf}break}case xt:{if(Ht){var Pl=c.type.impl,zo=c.stateNode;if(zo===null){var O1=Pl.getInitialState,m_;O1!==void 0&&(m_=O1(T)),zo=c.stateNode=Yh(c,T,Pl,m_||{});var y_=dt(zo);if(zo.instance=y_,Pl.reconcileChildren===!1)return null;ga(y_,c,!1,!1),Hn(zo)}else{var yE=zo.props;if(zo.prevProps=yE,zo.props=T,zo.currentFiber=c,X){var g_=ea(zo);zo.instance=g_,ga(g_,c,!1,!1)}var gE=Dn(zo);gE&&z0(c)}}break}case $e:{if(Du)if(a===null){var _E=c.type,Ly={fiber:c,methods:null};if(c.stateNode=Ly,Ly.methods=C2(_E,Ly),ci){var __=T.listeners;if(__!=null){var EE=Jl();dn(__,c,EE)}}c.ref!==null&&(x2(c),z0(c))}else{if(ci){var DE=a.memoizedProps.listeners,wE=T.listeners;(DE!==wE||c.ref!==null)&&z0(c)}else c.ref!==null&&z0(c);a.ref!==c.ref&&x2(c)}break}default:throw Error("Unknown unit of work tag ("+c.tag+"). This error is likely caused by a bug in React. Please file an issue.")}return null}function Pm(a,c){switch(a.tag){case N:{var _=a.type;zi(_)&&Is(a);var T=a.effectTag;return T&f0?(a.effectTag=T&~f0|Hr,a):null}case U:{no(a),x0(a);var R=a.effectTag;if((R&Hr)!==_i)throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");return a.effectTag=R&~f0|Hr,a}case W:return Od(a),null;case pe:{if(da(a),Di){var j=a.memoizedState;if(j!==null&&j.dehydrated!==null){if(a.alternate===null)throw Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");c1()}}var V=a.effectTag;return V&f0?(a.effectTag=V&~f0|Hr,a):null}case wt:return da(a),null;case q:return no(a),null;case he:return $u(a),null;default:return null}}function $h(a){switch(a.tag){case N:{var c=a.type.childContextTypes;c!=null&&Is(a);break}case U:{no(a),x0(a);break}case W:{Od(a);break}case q:no(a);break;case pe:da(a);break;case wt:da(a);break;case he:$u(a);break;default:break}}function cp(a,c){return{value:a,source:c,stack:_r(c)}}var dp=function(a,c,_,T,R,j,V,te,oe){var Ie=Array.prototype.slice.call(arguments,3);try{c.apply(_,Ie)}catch(Ye){this.onError(Ye)}};if(typeof window!="undefined"&&typeof window.dispatchEvent=="function"&&typeof document!="undefined"&&typeof document.createEvent=="function"){var pp=document.createElement("react"),Im=function(a,c,_,T,R,j,V,te,oe){if(typeof document=="undefined")throw Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.");var Ie=document.createEvent("Event"),Ye=!0,pt=window.event,Nt=Object.getOwnPropertyDescriptor(window,"event"),Vt=Array.prototype.slice.call(arguments,3);function zt(){pp.removeEventListener(N0,zt,!1),typeof window.event!="undefined"&&window.hasOwnProperty("event")&&(window.event=pt),c.apply(_,Vt),Ye=!1}var vn,xr=!1,$r=!1;function wi(Vi){if(vn=Vi.error,xr=!0,vn===null&&Vi.colno===0&&Vi.lineno===0&&($r=!0),Vi.defaultPrevented&&vn!=null&&typeof vn=="object")try{vn._suppressLogging=!0}catch(it){}}var N0="react-"+(a||"invokeguardedcallback");window.addEventListener("error",wi),pp.addEventListener(N0,zt,!1),Ie.initEvent(N0,!1,!1),pp.dispatchEvent(Ie),Nt&&Object.defineProperty(window,"event",Nt),Ye&&(xr?$r&&(vn=new Error("A cross-origin error was thrown. React doesn't have access to the actual error object in development. See https://fb.me/react-crossorigin-error for more information.")):vn=new Error(`An error was thrown inside one of your components, but React doesn't know what it was. This is likely due to browser flakiness. React does its best to preserve the "Pause on exceptions" behavior of the DevTools, which requires some DEV-mode only tricks. It's possible that these don't work in your browser. Try triggering the error in production mode, or switching to a modern browser. If you suspect that this is actually an issue with React, please file an issue.`),this.onError(vn)),window.removeEventListener("error",wi)};dp=Im}var Bm=dp,Eo=!1,k2=null,Um={onError:function(a){Eo=!0,k2=a}};function sl(a,c,_,T,R,j,V,te,oe){Eo=!1,k2=null,Bm.apply(Um,arguments)}function Jn(){return Eo}function Vs(){if(Eo){var a=k2;return Eo=!1,k2=null,a}else throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.")}function al(a){return!0}function n0(a){var c=al(a);if(c!==!1){var _=a.error;{var T=a.componentName,R=a.componentStack,j=a.errorBoundaryName,V=a.errorBoundaryFound,te=a.willRetry;if(_!=null&&_._suppressLogging){if(V&&te)return;console.error(_)}var oe=T?"The above error occurred in the <"+T+"> component:":"The above error occurred in one of your React components:",Ie;V&&j?te?Ie="React will try to recreate this component tree from scratch "+("using the error boundary you provided, "+j+"."):Ie="This error was initially handled by the error boundary "+j+`. +Recreating the tree from scratch failed so React will unmount the tree.`:Ie=`Consider adding an error boundary to your tree to customize error handling behavior. +Visit https://fb.me/react-error-boundaries to learn more about error boundaries.`;var Ye=""+oe+R+` + +`+(""+Ie);console.error(Ye)}}}var ev=null;ev=new Set;var Gs=typeof WeakSet=="function"?WeakSet:Set;function hp(a,c){var _=c.source,T=c.stack;T===null&&_!==null&&(T=_r(_));var R={componentName:_!==null?qt(_.type):null,componentStack:T!==null?T:"",error:c.value,errorBoundary:null,errorBoundaryName:null,errorBoundaryFound:!1,willRetry:!1};a!==null&&a.tag===N&&(R.errorBoundary=a.stateNode,R.errorBoundaryName=qt(a.type),R.errorBoundaryFound=!0,R.willRetry=!0);try{n0(R)}catch(j){setTimeout(function(){throw j})}}var jm=function(a,c){Oi(a,"componentWillUnmount"),c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount(),gi()};function tv(a,c){if(sl(null,jm,null,a,c),Jn()){var _=Vs();Pf(a,_)}}function vp(a){var c=a.ref;if(c!==null)if(typeof c=="function"){if(sl(null,c,null,null),Jn()){var _=Vs();Pf(a,_)}}else c.current=null}function zm(a,c){if(sl(null,c,null),Jn()){var _=Vs();Pf(a,_)}}function mp(a,c){switch(c.tag){case L:case ge:case le:{_c(ym,wf,c);return}case N:{if(c.effectTag&Co&&a!==null){var _=a.memoizedProps,T=a.memoizedState;Oi(c,"getSnapshotBeforeUpdate");var R=c.stateNode;c.type===c.elementType&&!ma&&(R.props!==c.memoizedProps&&Kt(!1,"Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(c.type)||"instance"),R.state!==c.memoizedState&&Kt(!1,"Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(c.type)||"instance"));var j=R.getSnapshotBeforeUpdate(c.elementType===c.type?_:bi(c.type,_),T);{var V=ev;j===void 0&&!V.has(c.type)&&(V.add(c.type),Ke(!1,"%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.",qt(c.type)))}R.__reactInternalSnapshotBeforeUpdate=j,gi()}return}case U:case W:case ne:case q:case Ge:return;default:throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}}function _c(a,c,_){var T=_.updateQueue,R=T!==null?T.lastEffect:null;if(R!==null){var j=R.next,V=j;do{if((V.tag&a)!==wf){var te=V.destroy;V.destroy=void 0,te!==void 0&&te()}if((V.tag&c)!==wf){var oe=V.create;V.destroy=oe();{var Ie=V.destroy;if(Ie!==void 0&&typeof Ie!="function"){var Ye=void 0;Ie===null?Ye=" You returned null. If your effect does not require clean up, return undefined (or nothing).":typeof Ie.then=="function"?Ye=` + +It looks like you wrote useEffect(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately: + +useEffect(() => { + async function fetchData() { + // You can await here + const response = await MyAPI.getData(someId); + // ... + } + fetchData(); +}, [someId]); // Or [] if effect doesn't need props or state + +Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching`:Ye=" You returned: "+Ie,Ke(!1,"An effect function must not return anything besides a function, which is used for clean-up.%s%s",Ye,_r(_))}}}V=V.next}while(V!==j)}}function Ea(a){if((a.effectTag&L0)!==_i)switch(a.tag){case L:case ge:case le:{_c(rr,wf,a),_c(wf,$c,a);break}default:break}}function yp(a,c,_,T){switch(_.tag){case L:case ge:case le:{_c(gm,ol,_);break}case N:{var R=_.stateNode;if(_.effectTag&mr)if(c===null)Oi(_,"componentDidMount"),_.type===_.elementType&&!ma&&(R.props!==_.memoizedProps&&Kt(!1,"Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance"),R.state!==_.memoizedState&&Kt(!1,"Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance")),R.componentDidMount(),gi();else{var j=_.elementType===_.type?c.memoizedProps:bi(_.type,c.memoizedProps),V=c.memoizedState;Oi(_,"componentDidUpdate"),_.type===_.elementType&&!ma&&(R.props!==_.memoizedProps&&Kt(!1,"Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance"),R.state!==_.memoizedState&&Kt(!1,"Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance")),R.componentDidUpdate(j,V,R.__reactInternalSnapshotBeforeUpdate),gi()}var te=_.updateQueue;te!==null&&(_.type===_.elementType&&!ma&&(R.props!==_.memoizedProps&&Kt(!1,"Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance"),R.state!==_.memoizedState&&Kt(!1,"Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance")),vo(_,te,R,T));return}case U:{var oe=_.updateQueue;if(oe!==null){var Ie=null;if(_.child!==null)switch(_.child.tag){case W:Ie=Ro(_.child.stateNode);break;case N:Ie=_.child.stateNode;break}vo(_,oe,Ie,T)}return}case W:{var Ye=_.stateNode;if(c===null&&_.effectTag&mr){var pt=_.type,Nt=_.memoizedProps;Pu(Ye,pt,Nt,_)}return}case ne:return;case q:return;case ze:{if(Zt){var Vt=_.memoizedProps.onRender;typeof Vt=="function"&&(Ln?Vt(_.memoizedProps.id,c===null?"mount":"update",_.actualDuration,_.treeBaseDuration,_.actualStartTime,kl(),a.memoizedInteractions):Vt(_.memoizedProps.id,c===null?"mount":"update",_.actualDuration,_.treeBaseDuration,_.actualStartTime,kl()))}return}case pe:{Nl(a,_);return}case wt:case Ge:case xt:case $e:return;default:throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}}function M2(a,c){if(P0)for(var _=a;;){if(_.tag===W){var T=_.stateNode;c?Oa(T):Zs(_.stateNode,_.memoizedProps)}else if(_.tag===ne){var R=_.stateNode;c?p0(R):K0(R,_.memoizedProps)}else if(_.tag===pe&&_.memoizedState!==null&&_.memoizedState.dehydrated===null){var j=_.child.sibling;j.return=_,_=j;continue}else if(_.child!==null){_.child.return=_,_=_.child;continue}if(_===a)return;for(;_.sibling===null;){if(_.return===null||_.return===a)return;_=_.return}_.sibling.return=_.return,_=_.sibling}}function ku(a){var c=a.ref;if(c!==null){var _=a.stateNode,T;switch(a.tag){case W:T=Ro(_);break;default:T=_}Du&&a.tag===$e&&(T=_.methods),typeof c=="function"?c(T):(c.hasOwnProperty("current")||Ke(!1,"Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().%s",qt(a.type),_r(a)),c.current=T)}}function zu(a){var c=a.ref;c!==null&&(typeof c=="function"?c(null):c.current=null)}function gp(a,c,_){switch(Rn(c),c.tag){case L:case ge:case Oe:case le:{var T=c.updateQueue;if(T!==null){var R=T.lastEffect;if(R!==null){var j=R.next,V=_>Wn?Wn:_;_n(V,function(){var $r=j;do{var wi=$r.destroy;wi!==void 0&&zm(c,wi),$r=$r.next}while($r!==j)})}}break}case N:{vp(c);var te=c.stateNode;typeof te.componentWillUnmount=="function"&&tv(c,te);return}case W:{if(ci){var oe=c.dependencies;if(oe!==null){var Ie=oe.responders;if(Ie!==null){for(var Ye=Array.from(Ie.values()),pt=0,Nt=Ye.length;pt component higher in the tree to provide a loading indicator or placeholder to display.`+_r(_))}Rp(),T=cp(T,_);var Nt=c;do{switch(Nt.tag){case U:{var Vt=T;Nt.effectTag|=f0,Nt.expirationTime=R;var zt=uv(Nt,Vt,R);r2(Nt,zt);return}case N:var vn=T,xr=Nt.type,$r=Nt.stateNode;if((Nt.effectTag&Hr)===_i&&(typeof xr.getDerivedStateFromError=="function"||$r!==null&&typeof $r.componentDidCatch=="function"&&!Lp($r))){Nt.effectTag|=f0,Nt.expirationTime=R;var wi=ov(Nt,vn,R);r2(Nt,wi);return}break;default:break}Nt=Nt.return}while(Nt!==null)}var wa=Math.ceil,Cr=at.ReactCurrentDispatcher,Ep=at.ReactCurrentOwner,fl=at.IsSomeRendererActing,cu=0,E1=1,ki=2,Dp=4,F2=8,Do=16,Ss=32,Mf=0,b2=1,wp=2,D1=3,w1=4,Sp=5,Zn=cu,cl=null,qn=null,q0=lt,k0=Mf,P2=null,Ll=bn,S1=bn,Dc=null,wc=lt,I2=!1,Tp=0,M0=500,fn=null,B2=!1,U2=null,Sc=null,Tc=!1,Cc=null,T1=y0,Cp=lt,Ka=null,Km=50,xc=0,j2=null,sv=50,C1=0,Nf=null,Lf=null,x1=lt;function Fl(){return(Zn&(Do|Ss))!==cu?Ju(vt()):(x1!==lt||(x1=Ju(vt())),x1)}function Ac(){return Ju(vt())}function Ff(a,c,_){var T=c.mode;if((T&Y)===Sr)return bn;var R=Xt();if((T&Qr)===Sr)return R===Ci?bn:Qu;if((Zn&Do)!==cu)return q0;var j;if(_!==null)j=ia(a,_.timeoutMs|0||pf);else switch(R){case Ci:j=bn;break;case Xr:j=La(a);break;case Wn:case Xu:j=ms(a);break;case m0:j=Qi;break;default:throw Error("Expected a valid priority level")}return cl!==null&&j===q0&&(j-=1),j}function Xm(a,c){hy(),gy(a);var _=z2(a,c);if(_===null){my(a);return}Up(a,c),ta();var T=Xt();if(c===bn?(Zn&F2)!==cu&&(Zn&(Do|Ss))===cu?(H(_,c),A1(_)):(Uo(_),H(_,c),Zn===cu&&It()):(Uo(_),H(_,c)),(Zn&Dp)!==cu&&(T===Xr||T===Ci))if(Ka===null)Ka=new Map([[_,c]]);else{var R=Ka.get(_);(R===void 0||R>c)&&Ka.set(_,c)}}var dl=Xm;function z2(a,c){a.expirationTimeR?T:R}function Uo(a){var c=a.lastExpiredTime;if(c!==lt){a.callbackExpirationTime=bn,a.callbackPriority=Ci,a.callbackNode=En(A1.bind(null,a));return}var _=q2(a),T=a.callbackNode;if(_===lt){T!==null&&(a.callbackNode=null,a.callbackExpirationTime=lt,a.callbackPriority=y0);return}var R=Fl(),j=$1(R,_);if(T!==null){var V=a.callbackPriority,te=a.callbackExpirationTime;if(te===_&&V>=j)return;er(T)}a.callbackExpirationTime=_,a.callbackPriority=j;var oe;_===bn?oe=En(A1.bind(null,a)):oo?oe=yn(j,H2.bind(null,a)):oe=yn(j,H2.bind(null,a),{timeout:bo(_)-vt()}),a.callbackNode=oe}function H2(a,c){if(x1=lt,c){var _=Fl();return qp(a,_),Uo(a),null}var T=q2(a);if(T!==lt){var R=a.callbackNode;if((Zn&(Do|Ss))!==cu)throw Error("Should not already be working.");if(Xa(),(a!==cl||T!==q0)&&(bf(a,T),ee(a,T)),qn!==null){var j=Zn;Zn|=Do;var V=pv(a),te=W2(a);ff(qn);do try{oy();break}catch(Ye){dv(a,Ye)}while(!0);if(mt(),Zn=j,hv(V),Ln&&V2(te),k0===b2){var oe=P2;throw Bp(),bf(a,T),Bf(a,T),Uo(a),oe}if(qn!==null)Bp();else{Tv();var Ie=a.finishedWork=a.current.alternate;a.finishedExpirationTime=T,Qm(a,Ie,k0,T)}if(Uo(a),a.callbackNode===R)return H2.bind(null,a)}}return null}function Qm(a,c,_,T){switch(cl=null,_){case Mf:case b2:throw Error("Root did not complete. This is a bug in React.");case wp:{qp(a,T>Qi?Qi:T);break}case D1:{Bf(a,T);var R=a.lastSuspendedTime;T===R&&(a.nextKnownPendingLevel=Op(c)),d();var j=Ll===bn;if(j&&!(Y0&&If.current)){var V=Tp+M0-vt();if(V>10){if(I2){var te=a.lastPingedTime;if(te===lt||te>=T){a.lastPingedTime=T,bf(a,T);break}}var oe=q2(a);if(oe!==lt&&oe!==T)break;if(R!==lt&&R!==T){a.lastPingedTime=R;break}a.timeoutHandle=St(r0.bind(null,a),V);break}}r0(a);break}case w1:{Bf(a,T);var Ie=a.lastSuspendedTime;if(T===Ie&&(a.nextKnownPendingLevel=Op(c)),d(),!(Y0&&If.current)){if(I2){var Ye=a.lastPingedTime;if(Ye===lt||Ye>=T){a.lastPingedTime=T,bf(a,T);break}}var pt=q2(a);if(pt!==lt&&pt!==T)break;if(Ie!==lt&&Ie!==T){a.lastPingedTime=Ie;break}var Nt;if(S1!==bn)Nt=bo(S1)-vt();else if(Ll===bn)Nt=0;else{var Vt=_v(Ll),zt=vt(),vn=bo(T)-zt,xr=zt-Vt;xr<0&&(xr=0),Nt=Pp(xr)-xr,vn10){a.timeoutHandle=St(r0.bind(null,a),Nt);break}}r0(a);break}case Sp:{if(!(Y0&&If.current)&&Ll!==bn&&Dc!==null){var $r=Ip(Ll,T,Dc);if($r>10){Bf(a,T),a.timeoutHandle=St(r0.bind(null,a),$r);break}}r0(a);break}default:throw Error("Unknown root exit status.")}}function A1(a){var c=a.lastExpiredTime,_=c!==lt?c:bn;if(a.finishedExpirationTime===_)r0(a);else{if((Zn&(Do|Ss))!==cu)throw Error("Should not already be working.");if(Xa(),(a!==cl||_!==q0)&&(bf(a,_),ee(a,_)),qn!==null){var T=Zn;Zn|=Do;var R=pv(a),j=W2(a);ff(qn);do try{Ev();break}catch(te){dv(a,te)}while(!0);if(mt(),Zn=T,hv(R),Ln&&V2(j),k0===b2){var V=P2;throw Bp(),bf(a,_),Bf(a,_),Uo(a),V}if(qn!==null)throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");Tv(),a.finishedWork=a.current.alternate,a.finishedExpirationTime=_,Jm(a,k0,_),Uo(a)}}return null}function Jm(a,c,_){cl=null,(c===D1||c===w1)&&d(),r0(a)}function Zm(a,c){qp(a,c),Uo(a),(Zn&(Do|Ss))===cu&&It()}function av(){if((Zn&(E1|Do|Ss))!==cu){(Zn&Do)!==cu&&Kt(!1,"unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering.");return}ey(),Xa()}function $m(a){return _n(Wn,a)}function fv(a,c,_,T){return _n(Ci,a.bind(null,c,_,T))}function ey(){if(Ka!==null){var a=Ka;Ka=null,a.forEach(function(c,_){qp(_,c),Uo(_)}),It()}}function ty(a,c){var _=Zn;Zn|=E1;try{return a(c)}finally{Zn=_,Zn===cu&&It()}}function ny(a,c){var _=Zn;Zn|=ki;try{return a(c)}finally{Zn=_,Zn===cu&&It()}}function cv(a,c,_,T){var R=Zn;Zn|=Dp;try{return _n(Xr,a.bind(null,c,_,T))}finally{Zn=R,Zn===cu&&It()}}function ry(a,c){var _=Zn;Zn&=~E1,Zn|=F2;try{return a(c)}finally{Zn=_,Zn===cu&&It()}}function xp(a,c){if((Zn&(Do|Ss))!==cu)throw Error("flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.");var _=Zn;Zn|=E1;try{return _n(Ci,a.bind(null,c))}finally{Zn=_,It()}}function iy(a){var c=Zn;Zn|=E1;try{_n(Ci,a)}finally{Zn=c,Zn===cu&&It()}}function bf(a,c){a.finishedWork=null,a.finishedExpirationTime=lt;var _=a.timeoutHandle;if(_!==Jo&&(a.timeoutHandle=Jo,so(_)),qn!==null)for(var T=qn.return;T!==null;)$h(T),T=T.return;cl=a,qn=wo(a.current,null,c),q0=c,k0=Mf,P2=null,Ll=bn,S1=bn,Dc=null,wc=lt,I2=!1,Ln&&(Lf=null),wl.discardPendingWarnings(),Ys=null}function dv(a,c){do{try{if(mt(),m2(),nt(),qn===null||qn.return===null)return k0=b2,P2=c,null;Zt&&qn.mode&Jr&&a1(qn,!0),lv(a,qn.return,qn,c,q0),qn=Dv(qn)}catch(_){c=_;continue}return}while(!0)}function pv(a){var c=Cr.current;return Cr.current=o1,c===null?o1:c}function hv(a){Cr.current=a}function W2(a){if(Ln){var c=k.__interactionsRef.current;return k.__interactionsRef.current=a.memoizedInteractions,c}return null}function V2(a){Ln&&(k.__interactionsRef.current=a)}function Ap(){Tp=vt()}function vv(a,c){aQi&&(Ll=a),c!==null&&aQi&&(S1=a,Dc=c)}function G2(a){a>wc&&(wc=a)}function mv(){k0===Mf&&(k0=D1)}function yv(){(k0===Mf||k0===D1)&&(k0=w1),wc!==lt&&cl!==null&&(Bf(cl,q0),o_(cl,wc))}function Rp(){k0!==Sp&&(k0=wp)}function gv(){return k0===Mf}function _v(a){var c=bo(a);return c-pf}function uy(a,c){var _=bo(a);return _-(c.timeoutMs|0||pf)}function Ev(){for(;qn!==null;)qn=Y2(qn)}function oy(){for(;qn!==null&&!kn();)qn=Y2(qn)}function Y2(a){var c=a.alternate;Kl(a),_t(a);var _;return Zt&&(a.mode&Jr)!==Sr?(zd(a),_=R1(c,a,q0),a1(a,!0)):_=R1(c,a,q0),nt(),a.memoizedProps=a.pendingProps,_===null&&(_=Dv(a)),Ep.current=null,_}function Dv(a){qn=a;do{var c=qn.alternate,_=qn.return;if((qn.effectTag&F0)===_i){_t(qn);var T=void 0;if(!Zt||(qn.mode&Jr)===Sr?T=Zh(c,qn,q0):(zd(qn),T=Zh(c,qn,q0),a1(qn,!1)),Yr(qn),nt(),ly(qn),T!==null)return T;if(_!==null&&(_.effectTag&F0)===_i){_.firstEffect===null&&(_.firstEffect=qn.firstEffect),qn.lastEffect!==null&&(_.lastEffect!==null&&(_.lastEffect.nextEffect=qn.firstEffect),_.lastEffect=qn.lastEffect);var R=qn.effectTag;R>eu&&(_.lastEffect!==null?_.lastEffect.nextEffect=qn:_.firstEffect=qn,_.lastEffect=qn)}}else{var j=Pm(qn,q0);if(Zt&&(qn.mode&Jr)!==Sr){a1(qn,!1);for(var V=qn.actualDuration,te=qn.child;te!==null;)V+=te.actualDuration,te=te.sibling;qn.actualDuration=V}if(j!==null)return fo(qn),j.effectTag&=Hl,j;Yr(qn),_!==null&&(_.firstEffect=_.lastEffect=null,_.effectTag|=F0)}var oe=qn.sibling;if(oe!==null)return oe;qn=_}while(qn!==null);return k0===Mf&&(k0=Sp),null}function Op(a){var c=a.expirationTime,_=a.childExpirationTime;return c>_?c:_}function ly(a){if(!(q0!==hi&&a.childExpirationTime===hi)){var c=lt;if(Zt&&(a.mode&Jr)!==Sr){for(var _=a.actualDuration,T=a.selfBaseDuration,R=a.alternate===null||a.child!==a.alternate.child,j=a.child;j!==null;){var V=j.expirationTime,te=j.childExpirationTime;V>c&&(c=V),te>c&&(c=te),R&&(_+=j.actualDuration),T+=j.treeBaseDuration,j=j.sibling}a.actualDuration=_,a.treeBaseDuration=T}else for(var oe=a.child;oe!==null;){var Ie=oe.expirationTime,Ye=oe.childExpirationTime;Ie>c&&(c=Ie),Ye>c&&(c=Ye),oe=oe.sibling}a.childExpirationTime=c}}function r0(a){var c=Xt();return _n(Ci,kp.bind(null,a,c)),null}function kp(a,c){do Xa();while(Cc!==null);if(vy(),(Zn&(Do|Ss))!==cu)throw Error("Should not already be working.");var _=a.finishedWork,T=a.finishedExpirationTime;if(_===null)return null;if(a.finishedWork=null,a.finishedExpirationTime=lt,_===a.current)throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");a.callbackNode=null,a.callbackExpirationTime=lt,a.callbackPriority=y0,a.nextKnownPendingLevel=lt,J0();var R=Op(_);iE(a,T,R),a===cl&&(cl=null,qn=null,q0=lt);var j;if(_.effectTag>eu?_.lastEffect!==null?(_.lastEffect.nextEffect=_,j=_.firstEffect):j=_:j=_.firstEffect,j!==null){var V=Zn;Zn|=Ss;var te=W2(a);Ep.current=null,Te(),Bn(a.containerInfo),fn=j;do if(sl(null,sy,null),Jn()){if(fn===null)throw Error("Should be working on an effect.");var oe=Vs();Pf(fn,oe),fn=fn.nextEffect}while(fn!==null);et(),Zt&&Oh(),Ve(),fn=j;do if(sl(null,ay,null,a,c),Jn()){if(fn===null)throw Error("Should be working on an effect.");var Ie=Vs();Pf(fn,Ie),fn=fn.nextEffect}while(fn!==null);Gt(),Ir(a.containerInfo),a.current=_,Yt(),fn=j;do if(sl(null,Mp,null,a,T),Jn()){if(fn===null)throw Error("Should be working on an effect.");var Ye=Vs();Pf(fn,Ye),fn=fn.nextEffect}while(fn!==null);sr(),fn=null,se(),Ln&&V2(te),Zn=V}else a.current=_,Te(),et(),Zt&&Oh(),Ve(),Gt(),Yt(),sr();Z0();var pt=Tc;if(Tc)Tc=!1,Cc=a,Cp=T,T1=c;else for(fn=j;fn!==null;){var Nt=fn.nextEffect;fn.nextEffect=null,fn=Nt}var Vt=a.firstPendingTime;if(Vt!==lt){if(Ln){if(Lf!==null){var zt=Lf;Lf=null;for(var vn=0;vnWn?Wn:T1;return T1=y0,_n(a,Np)}}function Np(){if(Cc===null)return!1;var a=Cc,c=Cp;if(Cc=null,Cp=lt,(Zn&(Do|Ss))!==cu)throw Error("Cannot flush passive effects while already rendering.");var _=Zn;Zn|=Ss;for(var T=W2(a),R=a.current.firstEffect;R!==null;){{if(_t(R),sl(null,Ea,null,R),Jn()){if(R===null)throw Error("Should be working on an effect.");var j=Vs();Pf(R,j)}nt()}var V=R.nextEffect;R.nextEffect=null,R=V}return Ln&&(V2(T),de(a,c)),Zn=_,It(),C1=Cc===null?0:C1+1,!0}function Lp(a){return Sc!==null&&Sc.has(a)}function Fp(a){Sc===null?Sc=new Set([a]):Sc.add(a)}function fy(a){B2||(B2=!0,U2=a)}var cy=fy;function wv(a,c,_){var T=cp(_,c),R=uv(a,T,bn);Ua(a,R);var j=z2(a,bn);j!==null&&(Uo(j),H(j,bn))}function Pf(a,c){if(a.tag===U){wv(a,a,c);return}for(var _=a.return;_!==null;){if(_.tag===U){wv(_,a,c);return}else if(_.tag===N){var T=_.type,R=_.stateNode;if(typeof T.getDerivedStateFromError=="function"||typeof R.componentDidCatch=="function"&&!Lp(R)){var j=cp(c,a),V=ov(_,j,bn);Ua(_,V);var te=z2(_,bn);te!==null&&(Uo(te),H(te,bn));return}}_=_.return}}function bp(a,c,_){var T=a.pingCache;if(T!==null&&T.delete(c),cl===a&&q0===_){k0===w1||k0===D1&&Ll===bn&&vt()-TpKm)throw xc=0,j2=null,Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.");C1>sv&&(C1=0,Kt(!1,"Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render."))}function vy(){wl.flushLegacyContextWarning(),fi&&wl.flushPendingUnsafeLifecycleWarnings()}function Tv(){var a=!0;cf(Nf,a),Nf=null}function Bp(){var a=!1;cf(Nf,a),Nf=null}function Up(a,c){Pr&&cl!==null&&c>q0&&(Nf=a)}var K2=null;function my(a){{var c=a.tag;if(c!==U&&c!==N&&c!==L&&c!==ge&&c!==Oe&&c!==le)return;var _=qt(a.type)||"ReactComponent";if(K2!==null){if(K2.has(_))return;K2.add(_)}else K2=new Set([_]);Ke(!1,"Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in %s.%s",c===N?"the componentWillUnmount method":"a useEffect cleanup function",_r(a))}}var R1;if(G0){var yy=null;R1=function(a,c,_){var T=i_(yy,c);try{return op(a,c,_)}catch(j){if(j!==null&&typeof j=="object"&&typeof j.then=="function")throw j;if(mt(),m2(),$h(c),i_(c,T),Zt&&c.mode&Jr&&zd(c),sl(null,op,null,a,c,_),Jn()){var R=Vs();throw R}else throw j}}}else R1=op;var Cv=!1,xv=!1;function gy(a){if(a.tag===N)switch(Ar){case"getChildContext":if(xv)return;Ke(!1,"setState(...): Cannot call setState() inside getChildContext()"),xv=!0;break;case"render":if(Cv)return;Ke(!1,"Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state."),Cv=!0;break}}var If={current:!1};function jp(a){fs===!0&&fl.current===!0&&If.current!==!0&&Ke(!1,`It looks like you're using the wrong act() around your test interactions. +Be sure to use the matching version of act() corresponding to your renderer: + +// for react-dom: +import {act} from 'react-dom/test-utils'; +// ... +act(() => ...); + +// for react-test-renderer: +import TestRenderer from 'react-test-renderer'; +const {act} = TestRenderer; +// ... +act(() => ...);%s`,_r(a))}function Av(a){fs===!0&&(a.mode&cr)!==Sr&&fl.current===!1&&If.current===!1&&Ke(!1,`An update to %s ran an effect, but was not wrapped in act(...). + +When testing, code that causes React state updates should be wrapped into act(...): + +act(() => { + /* fire events that update state */ +}); +/* assert on the output */ + +This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act%s`,qt(a.type),_r(a))}function _y(a){fs===!0&&Zn===cu&&fl.current===!1&&If.current===!1&&Ke(!1,`An update to %s inside a test was not wrapped in act(...). + +When testing, code that causes React state updates should be wrapped into act(...): + +act(() => { + /* fire events that update state */ +}); +/* assert on the output */ + +This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act%s`,qt(a.type),_r(a))}var Ey=_y,zp=!1;function Dy(a){zp===!1&&t.unstable_flushAllWithoutAsserting===void 0&&(a.mode&Y||a.mode&Qr?(zp=!0,Ke(!1,`In Concurrent or Sync modes, the "scheduler" module needs to be mocked to guarantee consistent behaviour across tests and browsers. For example, with jest: +jest.mock('scheduler', () => require('scheduler/unstable_mock')); + +For more info, visit https://fb.me/react-mock-scheduler`)):Yi===!0&&(zp=!0,Ke(!1,`Starting from React v17, the "scheduler" module will need to be mocked to guarantee consistent behaviour across tests and browsers. For example, with jest: +jest.mock('scheduler', () => require('scheduler/unstable_mock')); + +For more info, visit https://fb.me/react-mock-scheduler`)))}var Ys=null;function wy(a){{var c=Xt();if((a.mode&Qr)!==_i&&(c===Xr||c===Ci))for(var _=a;_!==null;){var T=_.alternate;if(T!==null)switch(_.tag){case N:var R=T.updateQueue;if(R!==null)for(var j=R.firstUpdate;j!==null;){var V=j.priority;if(V===Xr||V===Ci){Ys===null?Ys=new Set([qt(_.type)]):Ys.add(qt(_.type));break}j=j.next}break;case L:case ge:case le:if(_.memoizedState!==null&&_.memoizedState.baseUpdate!==null)for(var te=_.memoizedState.baseUpdate;te!==null;){var oe=te.priority;if(oe===Xr||oe===Ci){Ys===null?Ys=new Set([qt(_.type)]):Ys.add(qt(_.type));break}if(te.next===_.memoizedState.baseUpdate)break;te=te.next}break;default:break}_=_.return}}}function d(){if(Ys!==null){var a=[];Ys.forEach(function(c){return a.push(c)}),Ys=null,a.length>0&&Ke(!1,`%s triggered a user-blocking update that suspended. + +The fix is to split the update into multiple parts: a user-blocking update to provide immediate feedback, and another update that triggers the bulk of the changes. + +Refer to the documentation for useTransition to learn how to implement this pattern.`,a.sort().join(", "))}}function v(a,c){return c*1e3+a.interactionThreadID}function x(a){!Ln||(Lf===null?Lf=[a]:Lf.push(a))}function b(a,c,_){if(!!Ln&&_.size>0){var T=a.pendingInteractionMap,R=T.get(c);R!=null?_.forEach(function(te){R.has(te)||te.__count++,R.add(te)}):(T.set(c,new Set(_)),_.forEach(function(te){te.__count++}));var j=k.__subscriberRef.current;if(j!==null){var V=v(a,c);j.onWorkScheduled(_,V)}}}function H(a,c){!Ln||b(a,c,k.__interactionsRef.current)}function ee(a,c){if(!!Ln){var _=new Set;if(a.pendingInteractionMap.forEach(function(j,V){V>=c&&j.forEach(function(te){return _.add(te)})}),a.memoizedInteractions=_,_.size>0){var T=k.__subscriberRef.current;if(T!==null){var R=v(a,c);try{T.onWorkStarted(_,R)}catch(j){yn(Ci,function(){throw j})}}}}}function de(a,c){if(!!Ln){var _=a.firstPendingTime,T;try{if(T=k.__subscriberRef.current,T!==null&&a.memoizedInteractions.size>0){var R=v(a,c);T.onWorkStopped(a.memoizedInteractions,R)}}catch(V){yn(Ci,function(){throw V})}finally{var j=a.pendingInteractionMap;j.forEach(function(V,te){te>_&&(j.delete(te),V.forEach(function(oe){if(oe.__count--,T!==null&&oe.__count===0)try{T.onInteractionScheduledWorkCompleted(oe)}catch(Ie){yn(Ci,function(){throw Ie})}}))})}}}var ye=null,be=null,gt=!1,Dt=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined";function Rt(a){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined")return!1;var c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(c.isDisabled)return!0;if(!c.supportsFiber)return Ke(!1,"The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://fb.me/react-devtools"),!0;try{var _=c.inject(a);ye=function(T,R){try{var j=(T.current.effectTag&Hr)===Hr;if(Zt){var V=Ac(),te=$1(V,R);c.onCommitFiberRoot(_,T,te,j)}else c.onCommitFiberRoot(_,T,void 0,j)}catch(oe){gt||(gt=!0,Ke(!1,"React DevTools encountered an error: %s",oe))}},be=function(T){try{c.onCommitFiberUnmount(_,T)}catch(R){gt||(gt=!0,Ke(!1,"React DevTools encountered an error: %s",R))}}}catch(T){Ke(!1,"React DevTools encountered an error: %s.",T)}return!0}function rn(a,c){typeof ye=="function"&&ye(a,c)}function Rn(a){typeof be=="function"&&be(a)}var $n;{$n=!1;try{var Nr=Object.preventExtensions({}),ir=new Map([[Nr,null]]),Zr=new Set([Nr]);ir.set(0,0),Zr.add(0)}catch(a){$n=!0}}var ui=1;function bl(a,c,_,T){this.tag=a,this.key=_,this.elementType=null,this.type=null,this.stateNode=null,this.return=null,this.child=null,this.sibling=null,this.index=0,this.ref=null,this.pendingProps=c,this.memoizedProps=null,this.updateQueue=null,this.memoizedState=null,this.dependencies=null,this.mode=T,this.effectTag=_i,this.nextEffect=null,this.firstEffect=null,this.lastEffect=null,this.expirationTime=lt,this.childExpirationTime=lt,this.alternate=null,Zt&&(this.actualDuration=Number.NaN,this.actualStartTime=Number.NaN,this.selfBaseDuration=Number.NaN,this.treeBaseDuration=Number.NaN,this.actualDuration=0,this.actualStartTime=-1,this.selfBaseDuration=0,this.treeBaseDuration=0),Pr&&(this._debugID=ui++,this._debugIsCurrentlyTiming=!1),this._debugSource=null,this._debugOwner=null,this._debugNeedsRemount=!1,this._debugHookTypes=null,!$n&&typeof Object.preventExtensions=="function"&&Object.preventExtensions(this)}var Wi=function(a,c,_,T){return new bl(a,c,_,T)};function uo(a){var c=a.prototype;return!!(c&&c.isReactComponent)}function i0(a){return typeof a=="function"&&!uo(a)&&a.defaultProps===void 0}function Ts(a){if(typeof a=="function")return uo(a)?N:L;if(a!=null){var c=a.$$typeof;if(c===An)return ge;if(c===Wt)return Oe}return C}function wo(a,c,_){var T=a.alternate;T===null?(T=Wi(a.tag,c,a.key,a.mode),T.elementType=a.elementType,T.type=a.type,T.stateNode=a.stateNode,T._debugID=a._debugID,T._debugSource=a._debugSource,T._debugOwner=a._debugOwner,T._debugHookTypes=a._debugHookTypes,T.alternate=a,a.alternate=T):(T.pendingProps=c,T.effectTag=_i,T.nextEffect=null,T.firstEffect=null,T.lastEffect=null,Zt&&(T.actualDuration=0,T.actualStartTime=-1)),T.childExpirationTime=a.childExpirationTime,T.expirationTime=a.expirationTime,T.child=a.child,T.memoizedProps=a.memoizedProps,T.memoizedState=a.memoizedState,T.updateQueue=a.updateQueue;var R=a.dependencies;switch(T.dependencies=R===null?null:{expirationTime:R.expirationTime,firstContext:R.firstContext,responders:R.responders},T.sibling=a.sibling,T.index=a.index,T.ref=a.ref,Zt&&(T.selfBaseDuration=a.selfBaseDuration,T.treeBaseDuration=a.treeBaseDuration),T._debugNeedsRemount=a._debugNeedsRemount,T.tag){case C:case L:case le:T.type=Zu(a.type);break;case N:T.type=U0(a.type);break;case ge:T.type=vf(a.type);break;default:break}return T}function Rv(a,c){a.effectTag&=ai,a.nextEffect=null,a.firstEffect=null,a.lastEffect=null;var _=a.alternate;if(_===null)a.childExpirationTime=lt,a.expirationTime=c,a.child=null,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,Zt&&(a.selfBaseDuration=0,a.treeBaseDuration=0);else{a.childExpirationTime=_.childExpirationTime,a.expirationTime=_.expirationTime,a.child=_.child,a.memoizedProps=_.memoizedProps,a.memoizedState=_.memoizedState,a.updateQueue=_.updateQueue;var T=_.dependencies;a.dependencies=T===null?null:{expirationTime:T.expirationTime,firstContext:T.firstContext,responders:T.responders},Zt&&(a.selfBaseDuration=_.selfBaseDuration,a.treeBaseDuration=_.treeBaseDuration)}return a}function X4(a){var c;return a===R0?c=Qr|Y|cr:a===I0?c=Y|cr:c=Sr,Zt&&Dt&&(c|=Jr),Wi(U,null,null,c)}function Sy(a,c,_,T,R,j){var V,te=C,oe=a;if(typeof a=="function")uo(a)?(te=N,oe=U0(oe)):oe=Zu(oe);else if(typeof a=="string")te=W;else{e:switch(a){case ue:return Qa(_.children,R,j,c);case ln:te=we,R|=Qr|Y|cr;break;case je:te=we,R|=cr;break;case ct:return J4(_,R,j,c);case nr:return Z4(_,R,j,c);case un:return $4(_,R,j,c);default:{if(typeof a=="object"&&a!==null)switch(a.$$typeof){case At:te=he;break e;case en:te=Se;break e;case An:te=ge,oe=vf(oe);break e;case Wt:te=Oe;break e;case vr:te=Ue,oe=null;break e;case w:if(Ht)return r_(a,_,R,j,c);break;case Vn:if(Du)return Q4(a,_,R,j,c)}var Ie="";{(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(Ie+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ye=T?qt(T.type):null;Ye&&(Ie+=` + +Check the render method of \``+Ye+"`.")}throw Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: "+(a==null?a:typeof a)+"."+Ie)}}}return V=Wi(te,_,c,R),V.elementType=a,V.type=oe,V.expirationTime=j,V}function Ty(a,c,_){var T=null;T=a._owner;var R=a.type,j=a.key,V=a.props,te=Sy(R,j,V,T,c,_);return te._debugSource=a._source,te._debugOwner=a._owner,te}function Qa(a,c,_,T){var R=Wi(m,a,T,c);return R.expirationTime=_,R}function r_(a,c,_,T,R){var j=Wi(xt,c,R,_);return j.elementType=a,j.type=a,j.expirationTime=T,j}function Q4(a,c,_,T,R){var j=Wi($e,c,R,_);return j.type=a,j.elementType=a,j.expirationTime=T,j}function J4(a,c,_,T){(typeof a.id!="string"||typeof a.onRender!="function")&&Ke(!1,'Profiler must specify an "id" string and "onRender" function as props');var R=Wi(ze,a,T,c|Jr);return R.elementType=ct,R.type=ct,R.expirationTime=_,R}function Z4(a,c,_,T){var R=Wi(pe,a,T,c);return R.type=nr,R.elementType=nr,R.expirationTime=_,R}function $4(a,c,_,T){var R=Wi(wt,a,T,c);return R.type=un,R.elementType=un,R.expirationTime=_,R}function Cy(a,c,_){var T=Wi(ne,a,null,c);return T.expirationTime=_,T}function eE(){var a=Wi(W,null,null,Sr);return a.elementType="DELETED",a.type="DELETED",a}function tE(a){var c=Wi(rt,null,null,Sr);return c.stateNode=a,c}function xy(a,c,_){var T=a.children!==null?a.children:[],R=Wi(q,T,a.key,c);return R.expirationTime=_,R.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},R}function i_(a,c){return a===null&&(a=Wi(C,null,null,Sr)),a.tag=c.tag,a.key=c.key,a.elementType=c.elementType,a.type=c.type,a.stateNode=c.stateNode,a.return=c.return,a.child=c.child,a.sibling=c.sibling,a.index=c.index,a.ref=c.ref,a.pendingProps=c.pendingProps,a.memoizedProps=c.memoizedProps,a.updateQueue=c.updateQueue,a.memoizedState=c.memoizedState,a.dependencies=c.dependencies,a.mode=c.mode,a.effectTag=c.effectTag,a.nextEffect=c.nextEffect,a.firstEffect=c.firstEffect,a.lastEffect=c.lastEffect,a.expirationTime=c.expirationTime,a.childExpirationTime=c.childExpirationTime,a.alternate=c.alternate,Zt&&(a.actualDuration=c.actualDuration,a.actualStartTime=c.actualStartTime,a.selfBaseDuration=c.selfBaseDuration,a.treeBaseDuration=c.treeBaseDuration),a._debugID=c._debugID,a._debugSource=c._debugSource,a._debugOwner=c._debugOwner,a._debugIsCurrentlyTiming=c._debugIsCurrentlyTiming,a._debugNeedsRemount=c._debugNeedsRemount,a._debugHookTypes=c._debugHookTypes,a}function nE(a,c,_){this.tag=c,this.current=null,this.containerInfo=a,this.pendingChildren=null,this.pingCache=null,this.finishedExpirationTime=lt,this.finishedWork=null,this.timeoutHandle=Jo,this.context=null,this.pendingContext=null,this.hydrate=_,this.callbackNode=null,this.callbackPriority=y0,this.firstPendingTime=lt,this.firstSuspendedTime=lt,this.lastSuspendedTime=lt,this.nextKnownPendingLevel=lt,this.lastPingedTime=lt,this.lastExpiredTime=lt,Ln&&(this.interactionThreadID=k.unstable_getThreadID(),this.memoizedInteractions=new Set,this.pendingInteractionMap=new Map),Ui&&(this.hydrationCallbacks=null)}function rE(a,c,_,T){var R=new nE(a,c,_);Ui&&(R.hydrationCallbacks=T);var j=X4(c);return R.current=j,j.stateNode=R,R}function u_(a,c){var _=a.firstSuspendedTime,T=a.lastSuspendedTime;return _!==lt&&_>=c&&T<=c}function Bf(a,c){var _=a.firstSuspendedTime,T=a.lastSuspendedTime;_c||_===lt)&&(a.lastSuspendedTime=c),c<=a.lastPingedTime&&(a.lastPingedTime=lt),c<=a.lastExpiredTime&&(a.lastExpiredTime=lt)}function o_(a,c){var _=a.firstPendingTime;c>_&&(a.firstPendingTime=c);var T=a.firstSuspendedTime;T!==lt&&(c>=T?a.firstSuspendedTime=a.lastSuspendedTime=a.nextKnownPendingLevel=lt:c>=a.lastSuspendedTime&&(a.lastSuspendedTime=c+1),c>a.nextKnownPendingLevel&&(a.nextKnownPendingLevel=c))}function iE(a,c,_){a.firstPendingTime=_,c<=a.lastSuspendedTime?a.firstSuspendedTime=a.lastSuspendedTime=a.nextKnownPendingLevel=lt:c<=a.firstSuspendedTime&&(a.firstSuspendedTime=c-1),c<=a.lastPingedTime&&(a.lastPingedTime=lt),c<=a.lastExpiredTime&&(a.lastExpiredTime=lt)}function qp(a,c){var _=a.lastExpiredTime;(_===lt||_>c)&&(a.lastExpiredTime=c)}var uE={debugTool:null},Ov=uE,Ay,Ry;Ay=!1,Ry={};function oE(a){if(!a)return Sn;var c=jt(a),_=El(c);if(c.tag===N){var T=c.type;if(zi(T))return A0(c,T,_)}return _}function Oy(a){var c=jt(a);if(c===void 0)throw typeof a.render=="function"?Error("Unable to find node on an unmounted component."):Error("Argument appears to not be a ReactComponent. Keys: "+Object.keys(a));var _=b0(c);return _===null?null:_.stateNode}function lE(a,c){{var _=jt(a);if(_===void 0)throw typeof a.render=="function"?Error("Unable to find node on an unmounted component."):Error("Argument appears to not be a ReactComponent. Keys: "+Object.keys(a));var T=b0(_);if(T===null)return null;if(T.mode&cr){var R=qt(_.type)||"Component";Ry[R]||(Ry[R]=!0,_.mode&cr?Ke(!1,"%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://fb.me/react-strict-mode-find-node%s",c,c,R,_r(T)):Ke(!1,"%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://fb.me/react-strict-mode-find-node%s",c,c,R,_r(T)))}return T.stateNode}return Oy(a)}function sE(a,c,_,T){return rE(a,c,_,T)}function l_(a,c,_,T){var R=c.current,j=Fl();typeof jest!="undefined"&&(Dy(R),jp(R));var V=mo(),te=Ff(j,R,V);Ov.debugTool&&(R.alternate===null?Ov.debugTool.onMountContainer(c):a===null?Ov.debugTool.onUnmountContainer(c):Ov.debugTool.onUpdateContainer(c));var oe=oE(_);c.context===null?c.context=oe:c.pendingContext=oe,Ar==="render"&&Cn!==null&&!Ay&&(Ay=!0,Ke(!1,`Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate. + +Check the render method of %s.`,qt(Cn.type)||"Unknown"));var Ie=gu(te,V);return Ie.payload={element:a},T=T===void 0?null:T,T!==null&&(typeof T!="function"&&Ke(!1,"render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",T),Ie.callback=T),Ua(R,Ie),dl(R,te),te}function aE(a){var c=a.current;if(!c.child)return null;switch(c.child.tag){case W:return Ro(c.child.stateNode);default:return c.child.stateNode}}function fE(a){switch(a.tag){case U:var c=a.stateNode;c.hydrate&&Zm(c,c.firstPendingTime);break;case pe:xp(function(){return dl(a,bn)});var _=La(Fl());kv(a,_);break}}function s_(a,c){var _=a.memoizedState;_!==null&&_.dehydrated!==null&&_.retryTime=c.length)return T;var R=c[_],j=Array.isArray(a)?a.slice():f({},a);return j[R]=Ny(a[R],c,_+1,T),j},h_=function(a,c,_){return Ny(a,c,0,_)};f_=function(a,c,_,T){for(var R=a.memoizedState;R!==null&&c>0;)R=R.next,c--;if(R!==null){var j=h_(R.memoizedState,_,T);R.memoizedState=j,R.baseState=j,a.memoizedProps=f({},a.memoizedProps),dl(a,bn)}},c_=function(a,c,_){a.pendingProps=h_(a.memoizedProps,c,_),a.alternate&&(a.alternate.pendingProps=a.pendingProps),dl(a,bn)},d_=function(a){dl(a,bn)},p_=function(a){My=a}}function hE(a){var c=a.findFiberByHostInstance,_=at.ReactCurrentDispatcher;return Rt(f({},a,{overrideHookState:f_,overrideProps:c_,setSuspenseHandler:p_,scheduleUpdate:d_,currentDispatcherRef:_,findHostInstanceByFiber:function(T){var R=b0(T);return R===null?null:R.stateNode},findFiberByHostInstance:function(T){return c?c(T):null},findHostInstancesForRefresh:n2,scheduleRefresh:Sl,scheduleRoot:_s,setRefreshHandler:Ia,getCurrentFiber:function(){return Cn}}))}var v_=Object.freeze({createContainer:sE,updateContainer:l_,batchedEventUpdates:ny,batchedUpdates:ty,unbatchedUpdates:ry,deferredUpdates:$m,syncUpdates:fv,discreteUpdates:cv,flushDiscreteUpdates:av,flushControlled:iy,flushSync:xp,flushPassiveEffects:Xa,IsThisRendererActing:If,getPublicRootInstance:aE,attemptSynchronousHydration:fE,attemptUserBlockingHydration:cE,attemptContinuousHydration:ky,attemptHydrationAtCurrentPriority:dE,findHostInstance:Oy,findHostInstanceWithWarning:lE,findHostInstanceWithNoPortals:pE,shouldSuspend:a_,injectIntoDevTools:hE}),vE=v_.default||v_;hg.exports=vE;var mE=hg.exports;return hg.exports=i,mE})});var D9=ce((zne,cw)=>{"use strict";process.env.NODE_ENV==="production"?cw.exports=m9():cw.exports=E9()});var S9=ce((qne,w9)=>{"use strict";var ZK={ALIGN_COUNT:8,ALIGN_AUTO:0,ALIGN_FLEX_START:1,ALIGN_CENTER:2,ALIGN_FLEX_END:3,ALIGN_STRETCH:4,ALIGN_BASELINE:5,ALIGN_SPACE_BETWEEN:6,ALIGN_SPACE_AROUND:7,DIMENSION_COUNT:2,DIMENSION_WIDTH:0,DIMENSION_HEIGHT:1,DIRECTION_COUNT:3,DIRECTION_INHERIT:0,DIRECTION_LTR:1,DIRECTION_RTL:2,DISPLAY_COUNT:2,DISPLAY_FLEX:0,DISPLAY_NONE:1,EDGE_COUNT:9,EDGE_LEFT:0,EDGE_TOP:1,EDGE_RIGHT:2,EDGE_BOTTOM:3,EDGE_START:4,EDGE_END:5,EDGE_HORIZONTAL:6,EDGE_VERTICAL:7,EDGE_ALL:8,EXPERIMENTAL_FEATURE_COUNT:1,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:0,FLEX_DIRECTION_COUNT:4,FLEX_DIRECTION_COLUMN:0,FLEX_DIRECTION_COLUMN_REVERSE:1,FLEX_DIRECTION_ROW:2,FLEX_DIRECTION_ROW_REVERSE:3,JUSTIFY_COUNT:6,JUSTIFY_FLEX_START:0,JUSTIFY_CENTER:1,JUSTIFY_FLEX_END:2,JUSTIFY_SPACE_BETWEEN:3,JUSTIFY_SPACE_AROUND:4,JUSTIFY_SPACE_EVENLY:5,LOG_LEVEL_COUNT:6,LOG_LEVEL_ERROR:0,LOG_LEVEL_WARN:1,LOG_LEVEL_INFO:2,LOG_LEVEL_DEBUG:3,LOG_LEVEL_VERBOSE:4,LOG_LEVEL_FATAL:5,MEASURE_MODE_COUNT:3,MEASURE_MODE_UNDEFINED:0,MEASURE_MODE_EXACTLY:1,MEASURE_MODE_AT_MOST:2,NODE_TYPE_COUNT:2,NODE_TYPE_DEFAULT:0,NODE_TYPE_TEXT:1,OVERFLOW_COUNT:3,OVERFLOW_VISIBLE:0,OVERFLOW_HIDDEN:1,OVERFLOW_SCROLL:2,POSITION_TYPE_COUNT:2,POSITION_TYPE_RELATIVE:0,POSITION_TYPE_ABSOLUTE:1,PRINT_OPTIONS_COUNT:3,PRINT_OPTIONS_LAYOUT:1,PRINT_OPTIONS_STYLE:2,PRINT_OPTIONS_CHILDREN:4,UNIT_COUNT:4,UNIT_UNDEFINED:0,UNIT_POINT:1,UNIT_PERCENT:2,UNIT_AUTO:3,WRAP_COUNT:3,WRAP_NO_WRAP:0,WRAP_WRAP:1,WRAP_WRAP_REVERSE:2};w9.exports=ZK});var A9=ce((Hne,T9)=>{"use strict";var $K=Object.assign||function(i){for(var o=1;o"}}]),i}(),C9=function(){v4(i,null,[{key:"fromJS",value:function(f){var p=f.width,E=f.height;return new i(p,E)}}]);function i(o,f){pw(this,i),this.width=o,this.height=f}return v4(i,[{key:"fromJS",value:function(f){f(this.width,this.height)}},{key:"toString",value:function(){return""}}]),i}(),x9=function(){function i(o,f){pw(this,i),this.unit=o,this.value=f}return v4(i,[{key:"fromJS",value:function(f){f(this.unit,this.value)}},{key:"toString",value:function(){switch(this.unit){case Jf.UNIT_POINT:return String(this.value);case Jf.UNIT_PERCENT:return this.value+"%";case Jf.UNIT_AUTO:return"auto";default:return this.value+"?"}}},{key:"valueOf",value:function(){return this.value}}]),i}();T9.exports=function(i,o){function f(k,L,N){var C=k[L];k[L]=function(){for(var U=arguments.length,q=Array(U),W=0;W1?q-1:0),ne=1;ne1&&arguments[1]!==void 0?arguments[1]:NaN,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,C=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Jf.DIRECTION_LTR;return k.call(this,L,N,C)}),$K({Config:o.Config,Node:o.Node,Layout:i("Layout",eX),Size:i("Size",C9),Value:i("Value",x9),getInstanceCount:function(){return o.getInstanceCount.apply(o,arguments)}},Jf)}});var R9=ce((exports,module)=>{(function(i,o){typeof define=="function"&&define.amd?define([],function(){return o}):typeof module=="object"&&module.exports?module.exports=o:(i.nbind=i.nbind||{}).init=o})(exports,function(Module,cb){typeof Module=="function"&&(cb=Module,Module={}),Module.onRuntimeInitialized=function(i,o){return function(){i&&i.apply(this,arguments);try{Module.ccall("nbind_init")}catch(f){o(f);return}o(null,{bind:Module._nbind_value,reflect:Module.NBind.reflect,queryType:Module.NBind.queryType,toggleLightGC:Module.toggleLightGC,lib:Module})}}(Module.onRuntimeInitialized,cb);var Module;Module||(Module=(typeof Module!="undefined"?Module:null)||{});var moduleOverrides={};for(var key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1;if(Module.ENVIRONMENT)if(Module.ENVIRONMENT==="WEB")ENVIRONMENT_IS_WEB=!0;else if(Module.ENVIRONMENT==="WORKER")ENVIRONMENT_IS_WORKER=!0;else if(Module.ENVIRONMENT==="NODE")ENVIRONMENT_IS_NODE=!0;else if(Module.ENVIRONMENT==="SHELL")ENVIRONMENT_IS_SHELL=!0;else throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");else ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof importScripts=="function",ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof require=="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){Module.print||(Module.print=console.log),Module.printErr||(Module.printErr=console.warn);var nodeFS,nodePath;Module.read=function(o,f){nodeFS||(nodeFS={}("")),nodePath||(nodePath={}("")),o=nodePath.normalize(o);var p=nodeFS.readFileSync(o);return f?p:p.toString()},Module.readBinary=function(o){var f=Module.read(o,!0);return f.buffer||(f=new Uint8Array(f)),assert(f.buffer),f},Module.load=function(o){globalEval(read(o))},Module.thisProgram||(process.argv.length>1?Module.thisProgram=process.argv[1].replace(/\\/g,"/"):Module.thisProgram="unknown-program"),Module.arguments=process.argv.slice(2),typeof module!="undefined"&&(module.exports=Module),Module.inspect=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL)Module.print||(Module.print=print),typeof printErr!="undefined"&&(Module.printErr=printErr),typeof read!="undefined"?Module.read=read:Module.read=function(){throw"no read() available"},Module.readBinary=function(o){if(typeof readbuffer=="function")return new Uint8Array(readbuffer(o));var f=read(o,"binary");return assert(typeof f=="object"),f},typeof scriptArgs!="undefined"?Module.arguments=scriptArgs:typeof arguments!="undefined"&&(Module.arguments=arguments),typeof quit=="function"&&(Module.quit=function(i,o){quit(i)});else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(Module.read=function(o){var f=new XMLHttpRequest;return f.open("GET",o,!1),f.send(null),f.responseText},ENVIRONMENT_IS_WORKER&&(Module.readBinary=function(o){var f=new XMLHttpRequest;return f.open("GET",o,!1),f.responseType="arraybuffer",f.send(null),new Uint8Array(f.response)}),Module.readAsync=function(o,f,p){var E=new XMLHttpRequest;E.open("GET",o,!0),E.responseType="arraybuffer",E.onload=function(){E.status==200||E.status==0&&E.response?f(E.response):p()},E.onerror=p,E.send(null)},typeof arguments!="undefined"&&(Module.arguments=arguments),typeof console!="undefined")Module.print||(Module.print=function(o){console.log(o)}),Module.printErr||(Module.printErr=function(o){console.warn(o)});else{var TRY_USE_DUMP=!1;Module.print||(Module.print=TRY_USE_DUMP&&typeof dump!="undefined"?function(i){dump(i)}:function(i){})}ENVIRONMENT_IS_WORKER&&(Module.load=importScripts),typeof Module.setWindowTitle=="undefined"&&(Module.setWindowTitle=function(i){document.title=i})}else throw"Unknown runtime environment. Where are we?";function globalEval(i){eval.call(null,i)}!Module.load&&Module.read&&(Module.load=function(o){globalEval(Module.read(o))}),Module.print||(Module.print=function(){}),Module.printErr||(Module.printErr=Module.print),Module.arguments||(Module.arguments=[]),Module.thisProgram||(Module.thisProgram="./this.program"),Module.quit||(Module.quit=function(i,o){throw o}),Module.print=Module.print,Module.printErr=Module.printErr,Module.preRun=[],Module.postRun=[];for(var key in moduleOverrides)moduleOverrides.hasOwnProperty(key)&&(Module[key]=moduleOverrides[key]);moduleOverrides=void 0;var Runtime={setTempRet0:function(i){return tempRet0=i,i},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(i){STACKTOP=i},getNativeTypeSize:function(i){switch(i){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(i[i.length-1]==="*")return Runtime.QUANTUM_SIZE;if(i[0]==="i"){var o=parseInt(i.substr(1));return assert(o%8==0),o/8}else return 0}}},getNativeFieldSize:function(i){return Math.max(Runtime.getNativeTypeSize(i),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(i,o){return o==="double"||o==="i64"?i&7&&(assert((i&7)==4),i+=4):assert((i&3)==0),i},getAlignSize:function(i,o,f){return!f&&(i=="i64"||i=="double")?8:i?Math.min(o||(i?Runtime.getNativeFieldSize(i):0),Runtime.QUANTUM_SIZE):Math.min(o,8)},dynCall:function(i,o,f){return f&&f.length?Module["dynCall_"+i].apply(null,[o].concat(f)):Module["dynCall_"+i].call(null,o)},functionPointers:[],addFunction:function(i){for(var o=0;o>2],f=(o+i+15|0)&-16;if(HEAP32[DYNAMICTOP_PTR>>2]=f,f>=TOTAL_MEMORY){var p=enlargeMemory();if(!p)return HEAP32[DYNAMICTOP_PTR>>2]=o,0}return o},alignMemory:function(i,o){var f=i=Math.ceil(i/(o||16))*(o||16);return f},makeBigInt:function(i,o,f){var p=f?+(i>>>0)+ +(o>>>0)*4294967296:+(i>>>0)+ +(o|0)*4294967296;return p},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=0,EXITSTATUS=0;function assert(i,o){i||abort("Assertion failed: "+o)}function getCFunc(ident){var func=Module["_"+ident];if(!func)try{func=eval("_"+ident)}catch(i){}return assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)"),func}var cwrap,ccall;(function(){var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(i){var o=Runtime.stackAlloc(i.length);return writeArrayToMemory(i,o),o},stringToC:function(i){var o=0;if(i!=null&&i!==0){var f=(i.length<<2)+1;o=Runtime.stackAlloc(f),stringToUTF8(i,o,f)}return o}},toC={string:JSfuncs.stringToC,array:JSfuncs.arrayToC};ccall=function(o,f,p,E,t){var k=getCFunc(o),L=[],N=0;if(E)for(var C=0;C>0]=o;break;case"i8":HEAP8[i>>0]=o;break;case"i16":HEAP16[i>>1]=o;break;case"i32":HEAP32[i>>2]=o;break;case"i64":tempI64=[o>>>0,(tempDouble=o,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[i>>2]=tempI64[0],HEAP32[i+4>>2]=tempI64[1];break;case"float":HEAPF32[i>>2]=o;break;case"double":HEAPF64[i>>3]=o;break;default:abort("invalid type for setValue: "+f)}}Module.setValue=setValue;function getValue(i,o,f){switch(o=o||"i8",o.charAt(o.length-1)==="*"&&(o="i32"),o){case"i1":return HEAP8[i>>0];case"i8":return HEAP8[i>>0];case"i16":return HEAP16[i>>1];case"i32":return HEAP32[i>>2];case"i64":return HEAP32[i>>2];case"float":return HEAPF32[i>>2];case"double":return HEAPF64[i>>3];default:abort("invalid type for setValue: "+o)}return null}Module.getValue=getValue;var ALLOC_NORMAL=0,ALLOC_STACK=1,ALLOC_STATIC=2,ALLOC_DYNAMIC=3,ALLOC_NONE=4;Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE;function allocate(i,o,f,p){var E,t;typeof i=="number"?(E=!0,t=i):(E=!1,t=i.length);var k=typeof o=="string"?o:null,L;if(f==ALLOC_NONE?L=p:L=[typeof _malloc=="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][f===void 0?ALLOC_STATIC:f](Math.max(t,k?1:o.length)),E){var p=L,N;for(assert((L&3)==0),N=L+(t&~3);p>2]=0;for(N=L+t;p>0]=0;return L}if(k==="i8")return i.subarray||i.slice?HEAPU8.set(i,L):HEAPU8.set(new Uint8Array(i),L),L;for(var C=0,U,q,W;C>0],f|=p,!(p==0&&!o||(E++,o&&E==o)););o||(o=E);var t="";if(f<128){for(var k=1024,L;o>0;)L=String.fromCharCode.apply(String,HEAPU8.subarray(i,i+Math.min(o,k))),t=t?t+L:L,i+=k,o-=k;return t}return Module.UTF8ToString(i)}Module.Pointer_stringify=Pointer_stringify;function AsciiToString(i){for(var o="";;){var f=HEAP8[i++>>0];if(!f)return o;o+=String.fromCharCode(f)}}Module.AsciiToString=AsciiToString;function stringToAscii(i,o){return writeAsciiToMemory(i,o,!1)}Module.stringToAscii=stringToAscii;var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function UTF8ArrayToString(i,o){for(var f=o;i[f];)++f;if(f-o>16&&i.subarray&&UTF8Decoder)return UTF8Decoder.decode(i.subarray(o,f));for(var p,E,t,k,L,N,C="";;){if(p=i[o++],!p)return C;if(!(p&128)){C+=String.fromCharCode(p);continue}if(E=i[o++]&63,(p&224)==192){C+=String.fromCharCode((p&31)<<6|E);continue}if(t=i[o++]&63,(p&240)==224?p=(p&15)<<12|E<<6|t:(k=i[o++]&63,(p&248)==240?p=(p&7)<<18|E<<12|t<<6|k:(L=i[o++]&63,(p&252)==248?p=(p&3)<<24|E<<18|t<<12|k<<6|L:(N=i[o++]&63,p=(p&1)<<30|E<<24|t<<18|k<<12|L<<6|N))),p<65536)C+=String.fromCharCode(p);else{var U=p-65536;C+=String.fromCharCode(55296|U>>10,56320|U&1023)}}}Module.UTF8ArrayToString=UTF8ArrayToString;function UTF8ToString(i){return UTF8ArrayToString(HEAPU8,i)}Module.UTF8ToString=UTF8ToString;function stringToUTF8Array(i,o,f,p){if(!(p>0))return 0;for(var E=f,t=f+p-1,k=0;k=55296&&L<=57343&&(L=65536+((L&1023)<<10)|i.charCodeAt(++k)&1023),L<=127){if(f>=t)break;o[f++]=L}else if(L<=2047){if(f+1>=t)break;o[f++]=192|L>>6,o[f++]=128|L&63}else if(L<=65535){if(f+2>=t)break;o[f++]=224|L>>12,o[f++]=128|L>>6&63,o[f++]=128|L&63}else if(L<=2097151){if(f+3>=t)break;o[f++]=240|L>>18,o[f++]=128|L>>12&63,o[f++]=128|L>>6&63,o[f++]=128|L&63}else if(L<=67108863){if(f+4>=t)break;o[f++]=248|L>>24,o[f++]=128|L>>18&63,o[f++]=128|L>>12&63,o[f++]=128|L>>6&63,o[f++]=128|L&63}else{if(f+5>=t)break;o[f++]=252|L>>30,o[f++]=128|L>>24&63,o[f++]=128|L>>18&63,o[f++]=128|L>>12&63,o[f++]=128|L>>6&63,o[f++]=128|L&63}}return o[f]=0,f-E}Module.stringToUTF8Array=stringToUTF8Array;function stringToUTF8(i,o,f){return stringToUTF8Array(i,HEAPU8,o,f)}Module.stringToUTF8=stringToUTF8;function lengthBytesUTF8(i){for(var o=0,f=0;f=55296&&p<=57343&&(p=65536+((p&1023)<<10)|i.charCodeAt(++f)&1023),p<=127?++o:p<=2047?o+=2:p<=65535?o+=3:p<=2097151?o+=4:p<=67108863?o+=5:o+=6}return o}Module.lengthBytesUTF8=lengthBytesUTF8;var UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0;function demangle(i){var o=Module.___cxa_demangle||Module.__cxa_demangle;if(o){try{var f=i.substr(1),p=lengthBytesUTF8(f)+1,E=_malloc(p);stringToUTF8(f,E,p);var t=_malloc(4),k=o(E,0,0,t);if(getValue(t,"i32")===0&&k)return Pointer_stringify(k)}catch(L){}finally{E&&_free(E),t&&_free(t),k&&_free(k)}return i}return Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),i}function demangleAll(i){var o=/__Z[\w\d_]+/g;return i.replace(o,function(f){var p=demangle(f);return f===p?f:f+" ["+p+"]"})}function jsStackTrace(){var i=new Error;if(!i.stack){try{throw new Error(0)}catch(o){i=o}if(!i.stack)return"(no stack trace available)"}return i.stack.toString()}function stackTrace(){var i=jsStackTrace();return Module.extraStackTrace&&(i+=` +`+Module.extraStackTrace()),demangleAll(i)}Module.stackTrace=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed,STACK_BASE,STACKTOP,STACK_MAX,DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||134217728;TOTAL_MEMORY0;){var o=i.shift();if(typeof o=="function"){o();continue}var f=o.func;typeof f=="number"?o.arg===void 0?Module.dynCall_v(f):Module.dynCall_vi(f,o.arg):f(o.arg===void 0?null:o.arg)}}var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1,runtimeExited=!1;function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(i){__ATPRERUN__.unshift(i)}Module.addOnPreRun=addOnPreRun;function addOnInit(i){__ATINIT__.unshift(i)}Module.addOnInit=addOnInit;function addOnPreMain(i){__ATMAIN__.unshift(i)}Module.addOnPreMain=addOnPreMain;function addOnExit(i){__ATEXIT__.unshift(i)}Module.addOnExit=addOnExit;function addOnPostRun(i){__ATPOSTRUN__.unshift(i)}Module.addOnPostRun=addOnPostRun;function intArrayFromString(i,o,f){var p=f>0?f:lengthBytesUTF8(i)+1,E=new Array(p),t=stringToUTF8Array(i,E,0,E.length);return o&&(E.length=t),E}Module.intArrayFromString=intArrayFromString;function intArrayToString(i){for(var o=[],f=0;f255&&(p&=255),o.push(String.fromCharCode(p))}return o.join("")}Module.intArrayToString=intArrayToString;function writeStringToMemory(i,o,f){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var p,E;f&&(E=o+lengthBytesUTF8(i),p=HEAP8[E]),stringToUTF8(i,o,Infinity),f&&(HEAP8[E]=p)}Module.writeStringToMemory=writeStringToMemory;function writeArrayToMemory(i,o){HEAP8.set(i,o)}Module.writeArrayToMemory=writeArrayToMemory;function writeAsciiToMemory(i,o,f){for(var p=0;p>0]=i.charCodeAt(p);f||(HEAP8[o>>0]=0)}if(Module.writeAsciiToMemory=writeAsciiToMemory,(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function(o,f){var p=o>>>16,E=o&65535,t=f>>>16,k=f&65535;return E*k+(p*k+E*t<<16)|0}),Math.imul=Math.imul,!Math.fround){var froundBuffer=new Float32Array(1);Math.fround=function(i){return froundBuffer[0]=i,froundBuffer[0]}}Math.fround=Math.fround,Math.clz32||(Math.clz32=function(i){i=i>>>0;for(var o=0;o<32;o++)if(i&1<<31-o)return o;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(i){return i<0?Math.ceil(i):Math.floor(i)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_round=Math.round,Math_min=Math.min,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function getUniqueRunDependency(i){return i}function addRunDependency(i){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies)}Module.addRunDependency=addRunDependency;function removeRunDependency(i){if(runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),runDependencies==0&&(runDependencyWatcher!==null&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled)){var o=dependenciesFulfilled;dependenciesFulfilled=null,o()}}Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[function(i,o,f,p,E,t,k,L){return _nbind.callbackSignatureList[i].apply(this,arguments)}];function _emscripten_asm_const_iiiiiiii(i,o,f,p,E,t,k,L){return ASM_CONSTS[i](o,f,p,E,t,k,L)}function _emscripten_asm_const_iiiii(i,o,f,p,E){return ASM_CONSTS[i](o,f,p,E)}function _emscripten_asm_const_iiidddddd(i,o,f,p,E,t,k,L,N){return ASM_CONSTS[i](o,f,p,E,t,k,L,N)}function _emscripten_asm_const_iiididi(i,o,f,p,E,t,k){return ASM_CONSTS[i](o,f,p,E,t,k)}function _emscripten_asm_const_iiii(i,o,f,p){return ASM_CONSTS[i](o,f,p)}function _emscripten_asm_const_iiiid(i,o,f,p,E){return ASM_CONSTS[i](o,f,p,E)}function _emscripten_asm_const_iiiiii(i,o,f,p,E,t){return ASM_CONSTS[i](o,f,p,E,t)}STATIC_BASE=Runtime.GLOBAL_BASE,STATICTOP=STATIC_BASE+12800,__ATINIT__.push({func:function(){__GLOBAL__sub_I_Yoga_cpp()}},{func:function(){__GLOBAL__sub_I_nbind_cc()}},{func:function(){__GLOBAL__sub_I_common_cc()}},{func:function(){__GLOBAL__sub_I_Binding_cc()}}),allocate([0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,4,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,192,127,0,0,192,127,0,0,192,127,0,0,192,127,3,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,3,0,0,0,0,0,192,127,3,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,192,127,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,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,192,127,0,0,0,0,0,0,0,0,255,255,255,255,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,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,0,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0,181,45,0,0,181,45,0,0,181,45,0,0,184,45,0,0,185,45,0,0,181,45,0,0,181,45,0,0,182,45,0,0,186,45,0,0,185,45,0,0,148,4,0,0,3,0,0,0,187,45,0,0,164,4,0,0,188,45,0,0,2,0,0,0,189,45,0,0,164,4,0,0,188,45,0,0,185,45,0,0,164,4,0,0,185,45,0,0,164,4,0,0,188,45,0,0,181,45,0,0,182,45,0,0,181,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,6,0,0,0,1,0,0,0,7,0,0,0,183,45,0,0,182,45,0,0,181,45,0,0,190,45,0,0,190,45,0,0,182,45,0,0,182,45,0,0,185,45,0,0,181,45,0,0,185,45,0,0,182,45,0,0,181,45,0,0,185,45,0,0,182,45,0,0,185,45,0,0,48,5,0,0,3,0,0,0,56,5,0,0,1,0,0,0,189,45,0,0,185,45,0,0,164,4,0,0,76,5,0,0,2,0,0,0,191,45,0,0,186,45,0,0,182,45,0,0,185,45,0,0,192,45,0,0,185,45,0,0,182,45,0,0,186,45,0,0,185,45,0,0,76,5,0,0,76,5,0,0,136,5,0,0,182,45,0,0,181,45,0,0,2,0,0,0,190,45,0,0,136,5,0,0,56,19,0,0,156,5,0,0,2,0,0,0,184,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,8,0,0,0,9,0,0,0,1,0,0,0,10,0,0,0,204,5,0,0,181,45,0,0,181,45,0,0,2,0,0,0,180,45,0,0,204,5,0,0,2,0,0,0,195,45,0,0,236,5,0,0,97,19,0,0,198,45,0,0,211,45,0,0,212,45,0,0,213,45,0,0,214,45,0,0,215,45,0,0,188,45,0,0,182,45,0,0,216,45,0,0,217,45,0,0,218,45,0,0,219,45,0,0,192,45,0,0,181,45,0,0,0,0,0,0,185,45,0,0,110,19,0,0,186,45,0,0,115,19,0,0,221,45,0,0,120,19,0,0,148,4,0,0,132,19,0,0,96,6,0,0,145,19,0,0,222,45,0,0,164,19,0,0,223,45,0,0,173,19,0,0,0,0,0,0,3,0,0,0,104,6,0,0,1,0,0,0,187,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,11,0,0,0,12,0,0,0,1,0,0,0,13,0,0,0,185,45,0,0,224,45,0,0,164,6,0,0,188,45,0,0,172,6,0,0,180,6,0,0,2,0,0,0,188,6,0,0,7,0,0,0,224,45,0,0,7,0,0,0,164,6,0,0,1,0,0,0,213,45,0,0,185,45,0,0,224,45,0,0,172,6,0,0,185,45,0,0,224,45,0,0,164,6,0,0,185,45,0,0,224,45,0,0,211,45,0,0,211,45,0,0,222,45,0,0,211,45,0,0,224,45,0,0,222,45,0,0,211,45,0,0,224,45,0,0,172,6,0,0,222,45,0,0,211,45,0,0,224,45,0,0,188,45,0,0,222,45,0,0,211,45,0,0,40,7,0,0,188,45,0,0,2,0,0,0,224,45,0,0,185,45,0,0,188,45,0,0,188,45,0,0,188,45,0,0,188,45,0,0,222,45,0,0,224,45,0,0,148,4,0,0,185,45,0,0,148,4,0,0,148,4,0,0,148,4,0,0,148,4,0,0,148,4,0,0,185,45,0,0,164,6,0,0,148,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,14,0,0,0,15,0,0,0,1,0,0,0,16,0,0,0,148,7,0,0,2,0,0,0,225,45,0,0,183,45,0,0,188,45,0,0,168,7,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,234,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,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,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,148,45,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,0,0,0,0,0,0,0,0,0,0,0,28,9,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,242,45,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,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,0,67,111,117,108,100,32,110,111,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,102,111,114,32,110,111,100,101,0,67,97,110,110,111,116,32,114,101,115,101,116,32,97,32,110,111,100,101,32,119,104,105,99,104,32,115,116,105,108,108,32,104,97,115,32,99,104,105,108,100,114,101,110,32,97,116,116,97,99,104,101,100,0,67,97,110,110,111,116,32,114,101,115,101,116,32,97,32,110,111,100,101,32,115,116,105,108,108,32,97,116,116,97,99,104,101,100,32,116,111,32,97,32,112,97,114,101,110,116,0,67,111,117,108,100,32,110,111,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,102,111,114,32,99,111,110,102,105,103,0,67,97,110,110,111,116,32,115,101,116,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,58,32,78,111,100,101,115,32,119,105,116,104,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,32,99,97,110,110,111,116,32,104,97,118,101,32,99,104,105,108,100,114,101,110,46,0,67,104,105,108,100,32,97,108,114,101,97,100,121,32,104,97,115,32,97,32,112,97,114,101,110,116,44,32,105,116,32,109,117,115,116,32,98,101,32,114,101,109,111,118,101,100,32,102,105,114,115,116,46,0,67,97,110,110,111,116,32,97,100,100,32,99,104,105,108,100,58,32,78,111,100,101,115,32,119,105,116,104,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,32,99,97,110,110,111,116,32,104,97,118,101,32,99,104,105,108,100,114,101,110,46,0,79,110,108,121,32,108,101,97,102,32,110,111,100,101,115,32,119,105,116,104,32,99,117,115,116,111,109,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,115,104,111,117,108,100,32,109,97,110,117,97,108,108,121,32,109,97,114,107,32,116,104,101,109,115,101,108,118,101,115,32,97,115,32,100,105,114,116,121,0,67,97,110,110,111,116,32,103,101,116,32,108,97,121,111,117,116,32,112,114,111,112,101,114,116,105,101,115,32,111,102,32,109,117,108,116,105,45,101,100,103,101,32,115,104,111,114,116,104,97,110,100,115,0,37,115,37,100,46,123,91,115,107,105,112,112,101,100,93,32,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,97,119,58,32,37,102,32,97,104,58,32,37,102,32,61,62,32,100,58,32,40,37,102,44,32,37,102,41,32,37,115,10,0,37,115,37,100,46,123,37,115,0,42,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,97,119,58,32,37,102,32,97,104,58,32,37,102,32,37,115,10,0,37,115,37,100,46,125,37,115,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,100,58,32,40,37,102,44,32,37,102,41,32,37,115,10,0,79,117,116,32,111,102,32,99,97,99,104,101,32,101,110,116,114,105,101,115,33,10,0,83,99,97,108,101,32,102,97,99,116,111,114,32,115,104,111,117,108,100,32,110,111,116,32,98,101,32,108,101,115,115,32,116,104,97,110,32,122,101,114,111,0,105,110,105,116,105,97,108,0,37,115,10,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,85,78,68,69,70,73,78,69,68,0,69,88,65,67,84,76,89,0,65,84,95,77,79,83,84,0,76,65,89,95,85,78,68,69,70,73,78,69,68,0,76,65,89,95,69,88,65,67,84,76,89,0,76,65,89,95,65,84,95,77,79,83,84,0,97,118,97,105,108,97,98,108,101,87,105,100,116,104,32,105,115,32,105,110,100,101,102,105,110,105,116,101,32,115,111,32,119,105,100,116,104,77,101,97,115,117,114,101,77,111,100,101,32,109,117,115,116,32,98,101,32,89,71,77,101,97,115,117,114,101,77,111,100,101,85,110,100,101,102,105,110,101,100,0,97,118,97,105,108,97,98,108,101,72,101,105,103,104,116,32,105,115,32,105,110,100,101,102,105,110,105,116,101,32,115,111,32,104,101,105,103,104,116,77,101,97,115,117,114,101,77,111,100,101,32,109,117,115,116,32,98,101,32,89,71,77,101,97,115,117,114,101,77,111,100,101,85,110,100,101,102,105,110,101,100,0,102,108,101,120,0,115,116,114,101,116,99,104,0,109,117,108,116,105,108,105,110,101,45,115,116,114,101,116,99,104,0,69,120,112,101,99,116,101,100,32,110,111,100,101,32,116,111,32,104,97,118,101,32,99,117,115,116,111,109,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,0,109,101,97,115,117,114,101,0,69,120,112,101,99,116,32,99,117,115,116,111,109,32,98,97,115,101,108,105,110,101,32,102,117,110,99,116,105,111,110,32,116,111,32,110,111,116,32,114,101,116,117,114,110,32,78,97,78,0,97,98,115,45,109,101,97,115,117,114,101,0,97,98,115,45,108,97,121,111,117,116,0,78,111,100,101,0,99,114,101,97,116,101,68,101,102,97,117,108,116,0,99,114,101,97,116,101,87,105,116,104,67,111,110,102,105,103,0,100,101,115,116,114,111,121,0,114,101,115,101,116,0,99,111,112,121,83,116,121,108,101,0,115,101,116,80,111,115,105,116,105,111,110,84,121,112,101,0,115,101,116,80,111,115,105,116,105,111,110,0,115,101,116,80,111,115,105,116,105,111,110,80,101,114,99,101,110,116,0,115,101,116,65,108,105,103,110,67,111,110,116,101,110,116,0,115,101,116,65,108,105,103,110,73,116,101,109,115,0,115,101,116,65,108,105,103,110,83,101,108,102,0,115,101,116,70,108,101,120,68,105,114,101,99,116,105,111,110,0,115,101,116,70,108,101,120,87,114,97,112,0,115,101,116,74,117,115,116,105,102,121,67,111,110,116,101,110,116,0,115,101,116,77,97,114,103,105,110,0,115,101,116,77,97,114,103,105,110,80,101,114,99,101,110,116,0,115,101,116,77,97,114,103,105,110,65,117,116,111,0,115,101,116,79,118,101,114,102,108,111,119,0,115,101,116,68,105,115,112,108,97,121,0,115,101,116,70,108,101,120,0,115,101,116,70,108,101,120,66,97,115,105,115,0,115,101,116,70,108,101,120,66,97,115,105,115,80,101,114,99,101,110,116,0,115,101,116,70,108,101,120,71,114,111,119,0,115,101,116,70,108,101,120,83,104,114,105,110,107,0,115,101,116,87,105,100,116,104,0,115,101,116,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,87,105,100,116,104,65,117,116,111,0,115,101,116,72,101,105,103,104,116,0,115,101,116,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,72,101,105,103,104,116,65,117,116,111,0,115,101,116,77,105,110,87,105,100,116,104,0,115,101,116,77,105,110,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,77,105,110,72,101,105,103,104,116,0,115,101,116,77,105,110,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,77,97,120,87,105,100,116,104,0,115,101,116,77,97,120,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,77,97,120,72,101,105,103,104,116,0,115,101,116,77,97,120,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,65,115,112,101,99,116,82,97,116,105,111,0,115,101,116,66,111,114,100,101,114,0,115,101,116,80,97,100,100,105,110,103,0,115,101,116,80,97,100,100,105,110,103,80,101,114,99,101,110,116,0,103,101,116,80,111,115,105,116,105,111,110,84,121,112,101,0,103,101,116,80,111,115,105,116,105,111,110,0,103,101,116,65,108,105,103,110,67,111,110,116,101,110,116,0,103,101,116,65,108,105,103,110,73,116,101,109,115,0,103,101,116,65,108,105,103,110,83,101,108,102,0,103,101,116,70,108,101,120,68,105,114,101,99,116,105,111,110,0,103,101,116,70,108,101,120,87,114,97,112,0,103,101,116,74,117,115,116,105,102,121,67,111,110,116,101,110,116,0,103,101,116,77,97,114,103,105,110,0,103,101,116,70,108,101,120,66,97,115,105,115,0,103,101,116,70,108,101,120,71,114,111,119,0,103,101,116,70,108,101,120,83,104,114,105,110,107,0,103,101,116,87,105,100,116,104,0,103,101,116,72,101,105,103,104,116,0,103,101,116,77,105,110,87,105,100,116,104,0,103,101,116,77,105,110,72,101,105,103,104,116,0,103,101,116,77,97,120,87,105,100,116,104,0,103,101,116,77,97,120,72,101,105,103,104,116,0,103,101,116,65,115,112,101,99,116,82,97,116,105,111,0,103,101,116,66,111,114,100,101,114,0,103,101,116,79,118,101,114,102,108,111,119,0,103,101,116,68,105,115,112,108,97,121,0,103,101,116,80,97,100,100,105,110,103,0,105,110,115,101,114,116,67,104,105,108,100,0,114,101,109,111,118,101,67,104,105,108,100,0,103,101,116,67,104,105,108,100,67,111,117,110,116,0,103,101,116,80,97,114,101,110,116,0,103,101,116,67,104,105,108,100,0,115,101,116,77,101,97,115,117,114,101,70,117,110,99,0,117,110,115,101,116,77,101,97,115,117,114,101,70,117,110,99,0,109,97,114,107,68,105,114,116,121,0,105,115,68,105,114,116,121,0,99,97,108,99,117,108,97,116,101,76,97,121,111,117,116,0,103,101,116,67,111,109,112,117,116,101,100,76,101,102,116,0,103,101,116,67,111,109,112,117,116,101,100,82,105,103,104,116,0,103,101,116,67,111,109,112,117,116,101,100,84,111,112,0,103,101,116,67,111,109,112,117,116,101,100,66,111,116,116,111,109,0,103,101,116,67,111,109,112,117,116,101,100,87,105,100,116,104,0,103,101,116,67,111,109,112,117,116,101,100,72,101,105,103,104,116,0,103,101,116,67,111,109,112,117,116,101,100,76,97,121,111,117,116,0,103,101,116,67,111,109,112,117,116,101,100,77,97,114,103,105,110,0,103,101,116,67,111,109,112,117,116,101,100,66,111,114,100,101,114,0,103,101,116,67,111,109,112,117,116,101,100,80,97,100,100,105,110,103,0,67,111,110,102,105,103,0,99,114,101,97,116,101,0,115,101,116,69,120,112,101,114,105,109,101,110,116,97,108,70,101,97,116,117,114,101,69,110,97,98,108,101,100,0,115,101,116,80,111,105,110,116,83,99,97,108,101,70,97,99,116,111,114,0,105,115,69,120,112,101,114,105,109,101,110,116,97,108,70,101,97,116,117,114,101,69,110,97,98,108,101,100,0,86,97,108,117,101,0,76,97,121,111,117,116,0,83,105,122,101,0,103,101,116,73,110,115,116,97,110,99,101,67,111,117,110,116,0,73,110,116,54,52,0,1,1,1,2,2,4,4,4,4,8,8,4,8,118,111,105,100,0,98,111,111,108,0,115,116,100,58,58,115,116,114,105,110,103,0,99,98,70,117,110,99,116,105,111,110,32,38,0,99,111,110,115,116,32,99,98,70,117,110,99,116,105,111,110,32,38,0,69,120,116,101,114,110,97,108,0,66,117,102,102,101,114,0,78,66,105,110,100,73,68,0,78,66,105,110,100,0,98,105,110,100,95,118,97,108,117,101,0,114,101,102,108,101,99,116,0,113,117,101,114,121,84,121,112,101,0,108,97,108,108,111,99,0,108,114,101,115,101,116,0,123,114,101,116,117,114,110,40,95,110,98,105,110,100,46,99,97,108,108,98,97,99,107,83,105,103,110,97,116,117,114,101,76,105,115,116,91,36,48,93,46,97,112,112,108,121,40,116,104,105,115,44,97,114,103,117,109,101,110,116,115,41,41,59,125,0,95,110,98,105,110,100,95,110,101,119,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,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,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,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,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,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,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,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,18,0,0,0,18,18,18,0,0,0,0,0,0,9,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,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,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,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,46,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);var tempDoublePtr=STATICTOP;STATICTOP+=16;function _atexit(i,o){__ATEXIT__.unshift({func:i,arg:o})}function ___cxa_atexit(){return _atexit.apply(null,arguments)}function _abort(){Module.abort()}function __ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj(){Module.printErr("missing function: _ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj"),abort(-1)}function __decorate(i,o,f,p){var E=arguments.length,t=E<3?o:p===null?p=Object.getOwnPropertyDescriptor(o,f):p,k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(i,o,f,p);else for(var L=i.length-1;L>=0;L--)(k=i[L])&&(t=(E<3?k(t):E>3?k(o,f,t):k(o,f))||t);return E>3&&t&&Object.defineProperty(o,f,t),t}function _defineHidden(i){return function(o,f){Object.defineProperty(o,f,{configurable:!1,enumerable:!1,value:i,writable:!0})}}var _nbind={};function __nbind_free_external(i){_nbind.externalList[i].dereference(i)}function __nbind_reference_external(i){_nbind.externalList[i].reference()}function _llvm_stackrestore(i){var o=_llvm_stacksave,f=o.LLVM_SAVEDSTACKS[i];o.LLVM_SAVEDSTACKS.splice(i,1),Runtime.stackRestore(f)}function __nbind_register_pool(i,o,f,p){_nbind.Pool.pageSize=i,_nbind.Pool.usedPtr=o/4,_nbind.Pool.rootPtr=f,_nbind.Pool.pagePtr=p/4,HEAP32[o/4]=16909060,HEAP8[o]==1&&(_nbind.bigEndian=!0),HEAP32[o/4]=0,_nbind.makeTypeKindTbl=(t={},t[1024]=_nbind.PrimitiveType,t[64]=_nbind.Int64Type,t[2048]=_nbind.BindClass,t[3072]=_nbind.BindClassPtr,t[4096]=_nbind.SharedClassPtr,t[5120]=_nbind.ArrayType,t[6144]=_nbind.ArrayType,t[7168]=_nbind.CStringType,t[9216]=_nbind.CallbackType,t[10240]=_nbind.BindType,t),_nbind.makeTypeNameTbl={Buffer:_nbind.BufferType,External:_nbind.ExternalType,Int64:_nbind.Int64Type,_nbind_new:_nbind.CreateValueType,bool:_nbind.BooleanType,"cbFunction &":_nbind.CallbackType,"const cbFunction &":_nbind.CallbackType,"const std::string &":_nbind.StringType,"std::string":_nbind.StringType},Module.toggleLightGC=_nbind.toggleLightGC,_nbind.callUpcast=Module.dynCall_ii;var E=_nbind.makeType(_nbind.constructType,{flags:2048,id:0,name:""});E.proto=Module,_nbind.BindClass.list.push(E);var t}function _emscripten_set_main_loop_timing(i,o){if(Browser.mainLoop.timingMode=i,Browser.mainLoop.timingValue=o,!Browser.mainLoop.func)return 1;if(i==0)Browser.mainLoop.scheduler=function(){var k=Math.max(0,Browser.mainLoop.tickStartTime+o-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,k)},Browser.mainLoop.method="timeout";else if(i==1)Browser.mainLoop.scheduler=function(){Browser.requestAnimationFrame(Browser.mainLoop.runner)},Browser.mainLoop.method="rAF";else if(i==2){if(!window.setImmediate){let t=function(k){k.source===window&&k.data===p&&(k.stopPropagation(),f.shift()())};var E=t,f=[],p="setimmediate";window.addEventListener("message",t,!0),window.setImmediate=function(L){f.push(L),ENVIRONMENT_IS_WORKER?(Module.setImmediates===void 0&&(Module.setImmediates=[]),Module.setImmediates.push(L),window.postMessage({target:p})):window.postMessage(p,"*")}}Browser.mainLoop.scheduler=function(){window.setImmediate(Browser.mainLoop.runner)},Browser.mainLoop.method="immediate"}return 0}function _emscripten_get_now(){abort()}function _emscripten_set_main_loop(i,o,f,p,E){Module.noExitRuntime=!0,assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Browser.mainLoop.func=i,Browser.mainLoop.arg=p;var t;typeof p!="undefined"?t=function(){Module.dynCall_vi(i,p)}:t=function(){Module.dynCall_v(i)};var k=Browser.mainLoop.currentlyRunningMainloop;if(Browser.mainLoop.runner=function(){if(!ABORT){if(Browser.mainLoop.queue.length>0){var N=Date.now(),C=Browser.mainLoop.queue.shift();if(C.func(C.arg),Browser.mainLoop.remainingBlockers){var U=Browser.mainLoop.remainingBlockers,q=U%1==0?U-1:Math.floor(U);C.counted?Browser.mainLoop.remainingBlockers=q:(q=q+.5,Browser.mainLoop.remainingBlockers=(8*U+q)/9)}if(console.log('main loop blocker "'+C.name+'" took '+(Date.now()-N)+" ms"),Browser.mainLoop.updateStatus(),k1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else Browser.mainLoop.timingMode==0&&(Browser.mainLoop.tickStartTime=_emscripten_get_now());Browser.mainLoop.method==="timeout"&&Module.ctx&&(Module.printErr("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"),Browser.mainLoop.method=""),Browser.mainLoop.runIter(t),!(k0?_emscripten_set_main_loop_timing(0,1e3/o):_emscripten_set_main_loop_timing(1,1),Browser.mainLoop.scheduler()),f)throw"SimulateInfiniteLoop"}var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null,Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var i=Browser.mainLoop.timingMode,o=Browser.mainLoop.timingValue,f=Browser.mainLoop.func;Browser.mainLoop.func=null,_emscripten_set_main_loop(f,0,!1,Browser.mainLoop.arg,!0),_emscripten_set_main_loop_timing(i,o),Browser.mainLoop.scheduler()},updateStatus:function(){if(Module.setStatus){var i=Module.statusMessage||"Please wait...",o=Browser.mainLoop.remainingBlockers,f=Browser.mainLoop.expectedBlockers;o?o=6;){var rt=le>>Ue-6&63;Ue-=6,Oe+=ze[rt]}return Ue==2?(Oe+=ze[(le&3)<<4],Oe+=pe+pe):Ue==4&&(Oe+=ze[(le&15)<<2],Oe+=pe),Oe}m.src="data:audio/x-"+k.substr(-3)+";base64,"+he(t),U(m)},m.src=ne,Browser.safeSetTimeout(function(){U(m)},1e4)}else return q()},Module.preloadPlugins.push(o);function f(){Browser.pointerLock=document.pointerLockElement===Module.canvas||document.mozPointerLockElement===Module.canvas||document.webkitPointerLockElement===Module.canvas||document.msPointerLockElement===Module.canvas}var p=Module.canvas;p&&(p.requestPointerLock=p.requestPointerLock||p.mozRequestPointerLock||p.webkitRequestPointerLock||p.msRequestPointerLock||function(){},p.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},p.exitPointerLock=p.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",f,!1),document.addEventListener("mozpointerlockchange",f,!1),document.addEventListener("webkitpointerlockchange",f,!1),document.addEventListener("mspointerlockchange",f,!1),Module.elementPointerLock&&p.addEventListener("click",function(E){!Browser.pointerLock&&Module.canvas.requestPointerLock&&(Module.canvas.requestPointerLock(),E.preventDefault())},!1))},createContext:function(i,o,f,p){if(o&&Module.ctx&&i==Module.canvas)return Module.ctx;var E,t;if(o){var k={antialias:!1,alpha:!1};if(p)for(var L in p)k[L]=p[L];t=GL.createContext(i,k),t&&(E=GL.getContext(t).GLctx)}else E=i.getContext("2d");return E?(f&&(o||assert(typeof GLctx=="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),Module.ctx=E,o&&GL.makeContextCurrent(t),Module.useWebGL=o,Browser.moduleContextCreatedCallbacks.forEach(function(N){N()}),Browser.init()),E):null},destroyContext:function(i,o,f){},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen:function(i,o,f){Browser.lockPointer=i,Browser.resizeCanvas=o,Browser.vrDevice=f,typeof Browser.lockPointer=="undefined"&&(Browser.lockPointer=!0),typeof Browser.resizeCanvas=="undefined"&&(Browser.resizeCanvas=!1),typeof Browser.vrDevice=="undefined"&&(Browser.vrDevice=null);var p=Module.canvas;function E(){Browser.isFullscreen=!1;var k=p.parentNode;(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===k?(p.exitFullscreen=document.exitFullscreen||document.cancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen||document.webkitCancelFullScreen||function(){},p.exitFullscreen=p.exitFullscreen.bind(document),Browser.lockPointer&&p.requestPointerLock(),Browser.isFullscreen=!0,Browser.resizeCanvas&&Browser.setFullscreenCanvasSize()):(k.parentNode.insertBefore(p,k),k.parentNode.removeChild(k),Browser.resizeCanvas&&Browser.setWindowedCanvasSize()),Module.onFullScreen&&Module.onFullScreen(Browser.isFullscreen),Module.onFullscreen&&Module.onFullscreen(Browser.isFullscreen),Browser.updateCanvasDimensions(p)}Browser.fullscreenHandlersInstalled||(Browser.fullscreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",E,!1),document.addEventListener("mozfullscreenchange",E,!1),document.addEventListener("webkitfullscreenchange",E,!1),document.addEventListener("MSFullscreenChange",E,!1));var t=document.createElement("div");p.parentNode.insertBefore(t,p),t.appendChild(p),t.requestFullscreen=t.requestFullscreen||t.mozRequestFullScreen||t.msRequestFullscreen||(t.webkitRequestFullscreen?function(){t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}:null)||(t.webkitRequestFullScreen?function(){t.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),f?t.requestFullscreen({vrDisplay:f}):t.requestFullscreen()},requestFullScreen:function(i,o,f){return Module.printErr("Browser.requestFullScreen() is deprecated. Please call Browser.requestFullscreen instead."),Browser.requestFullScreen=function(p,E,t){return Browser.requestFullscreen(p,E,t)},Browser.requestFullscreen(i,o,f)},nextRAF:0,fakeRequestAnimationFrame:function(i){var o=Date.now();if(Browser.nextRAF===0)Browser.nextRAF=o+1e3/60;else for(;o+2>=Browser.nextRAF;)Browser.nextRAF+=1e3/60;var f=Math.max(Browser.nextRAF-o,0);setTimeout(i,f)},requestAnimationFrame:function(o){typeof window=="undefined"?Browser.fakeRequestAnimationFrame(o):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||Browser.fakeRequestAnimationFrame),window.requestAnimationFrame(o))},safeCallback:function(i){return function(){if(!ABORT)return i.apply(null,arguments)}},allowAsyncCallbacks:!0,queuedAsyncCallbacks:[],pauseAsyncCallbacks:function(){Browser.allowAsyncCallbacks=!1},resumeAsyncCallbacks:function(){if(Browser.allowAsyncCallbacks=!0,Browser.queuedAsyncCallbacks.length>0){var i=Browser.queuedAsyncCallbacks;Browser.queuedAsyncCallbacks=[],i.forEach(function(o){o()})}},safeRequestAnimationFrame:function(i){return Browser.requestAnimationFrame(function(){ABORT||(Browser.allowAsyncCallbacks?i():Browser.queuedAsyncCallbacks.push(i))})},safeSetTimeout:function(i,o){return Module.noExitRuntime=!0,setTimeout(function(){ABORT||(Browser.allowAsyncCallbacks?i():Browser.queuedAsyncCallbacks.push(i))},o)},safeSetInterval:function(i,o){return Module.noExitRuntime=!0,setInterval(function(){ABORT||Browser.allowAsyncCallbacks&&i()},o)},getMimetype:function(i){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[i.substr(i.lastIndexOf(".")+1)]},getUserMedia:function(i){window.getUserMedia||(window.getUserMedia=navigator.getUserMedia||navigator.mozGetUserMedia),window.getUserMedia(i)},getMovementX:function(i){return i.movementX||i.mozMovementX||i.webkitMovementX||0},getMovementY:function(i){return i.movementY||i.mozMovementY||i.webkitMovementY||0},getMouseWheelDelta:function(i){var o=0;switch(i.type){case"DOMMouseScroll":o=i.detail;break;case"mousewheel":o=i.wheelDelta;break;case"wheel":o=i.deltaY;break;default:throw"unrecognized mouse wheel event: "+i.type}return o},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(i){if(Browser.pointerLock)i.type!="mousemove"&&"mozMovementX"in i?Browser.mouseMovementX=Browser.mouseMovementY=0:(Browser.mouseMovementX=Browser.getMovementX(i),Browser.mouseMovementY=Browser.getMovementY(i)),typeof SDL!="undefined"?(Browser.mouseX=SDL.mouseX+Browser.mouseMovementX,Browser.mouseY=SDL.mouseY+Browser.mouseMovementY):(Browser.mouseX+=Browser.mouseMovementX,Browser.mouseY+=Browser.mouseMovementY);else{var o=Module.canvas.getBoundingClientRect(),f=Module.canvas.width,p=Module.canvas.height,E=typeof window.scrollX!="undefined"?window.scrollX:window.pageXOffset,t=typeof window.scrollY!="undefined"?window.scrollY:window.pageYOffset;if(i.type==="touchstart"||i.type==="touchend"||i.type==="touchmove"){var k=i.touch;if(k===void 0)return;var L=k.pageX-(E+o.left),N=k.pageY-(t+o.top);L=L*(f/o.width),N=N*(p/o.height);var C={x:L,y:N};if(i.type==="touchstart")Browser.lastTouches[k.identifier]=C,Browser.touches[k.identifier]=C;else if(i.type==="touchend"||i.type==="touchmove"){var U=Browser.touches[k.identifier];U||(U=C),Browser.lastTouches[k.identifier]=U,Browser.touches[k.identifier]=C}return}var q=i.pageX-(E+o.left),W=i.pageY-(t+o.top);q=q*(f/o.width),W=W*(p/o.height),Browser.mouseMovementX=q-Browser.mouseX,Browser.mouseMovementY=W-Browser.mouseY,Browser.mouseX=q,Browser.mouseY=W}},asyncLoad:function(i,o,f,p){var E=p?"":getUniqueRunDependency("al "+i);Module.readAsync(i,function(t){assert(t,'Loading data file "'+i+'" failed (no arrayBuffer).'),o(new Uint8Array(t)),E&&removeRunDependency(E)},function(t){if(f)f();else throw'Loading data file "'+i+'" failed.'}),E&&addRunDependency(E)},resizeListeners:[],updateResizeListeners:function(){var i=Module.canvas;Browser.resizeListeners.forEach(function(o){o(i.width,i.height)})},setCanvasSize:function(i,o,f){var p=Module.canvas;Browser.updateCanvasDimensions(p,i,o),f||Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize:function(){if(typeof SDL!="undefined"){var i=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];i=i|8388608,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=i}Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL!="undefined"){var i=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];i=i&~8388608,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=i}Browser.updateResizeListeners()},updateCanvasDimensions:function(i,o,f){o&&f?(i.widthNative=o,i.heightNative=f):(o=i.widthNative,f=i.heightNative);var p=o,E=f;if(Module.forcedAspectRatio&&Module.forcedAspectRatio>0&&(p/E>2];return o},getStr:function(){var i=Pointer_stringify(SYSCALLS.get());return i},get64:function(){var i=SYSCALLS.get(),o=SYSCALLS.get();return i>=0?assert(o===0):assert(o===-1),i},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall6(i,o){SYSCALLS.varargs=o;try{var f=SYSCALLS.getStreamFromFD();return FS.close(f),0}catch(p){return(typeof FS=="undefined"||!(p instanceof FS.ErrnoError))&&abort(p),-p.errno}}function ___syscall54(i,o){SYSCALLS.varargs=o;try{return 0}catch(f){return(typeof FS=="undefined"||!(f instanceof FS.ErrnoError))&&abort(f),-f.errno}}function _typeModule(i){var o=[[0,1,"X"],[1,1,"const X"],[128,1,"X *"],[256,1,"X &"],[384,1,"X &&"],[512,1,"std::shared_ptr"],[640,1,"std::unique_ptr"],[5120,1,"std::vector"],[6144,2,"std::array"],[9216,-1,"std::function"]];function f(N,C,U,q,W,ne){if(C==1){var m=q&896;(m==128||m==256||m==384)&&(N="X const")}var we;return ne?we=U.replace("X",N).replace("Y",W):we=N.replace("X",U).replace("Y",W),we.replace(/([*&]) (?=[*&])/g,"$1")}function p(N,C,U,q,W){throw new Error(N+" type "+U.replace("X",C+"?")+(q?" with flag "+q:"")+" in "+W)}function E(N,C,U,q,W,ne,m,we){ne===void 0&&(ne="X"),we===void 0&&(we=1);var Se=U(N);if(Se)return Se;var he=q(N),ge=he.placeholderFlag,ze=o[ge];m&&ze&&(ne=f(m[2],m[0],ne,ze[0],"?",!0));var pe;ge==0&&(pe="Unbound"),ge>=10&&(pe="Corrupt"),we>20&&(pe="Deeply nested"),pe&&p(pe,N,ne,ge,W||"?");var Oe=he.paramList[0],le=E(Oe,C,U,q,W,ne,ze,we+1),Ue,Ge={flags:ze[0],id:N,name:"",paramList:[le]},rt=[],wt="?";switch(he.placeholderFlag){case 1:Ue=le.spec;break;case 2:if((le.flags&15360)==1024&&le.spec.ptrSize==1){Ge.flags=7168;break}case 3:case 6:case 5:Ue=le.spec,(le.flags&15360)!=2048;break;case 8:wt=""+he.paramList[1],Ge.paramList.push(he.paramList[1]);break;case 9:for(var xt=0,$e=he.paramList[1];xt<$e.length;xt++){var ft=$e[xt],Ke=E(ft,C,U,q,W,ne,ze,we+1);rt.push(Ke.name),Ge.paramList.push(Ke)}wt=rt.join(", ");break;default:break}if(Ge.name=f(ze[2],ze[0],le.name,le.flags,wt),Ue){for(var jt=0,$t=Object.keys(Ue);jt<$t.length;jt++){var at=$t[jt];Ge[at]=Ge[at]||Ue[at]}Ge.flags|=Ue.flags}return t(C,Ge)}function t(N,C){var U=C.flags,q=U&896,W=U&15360;return!C.name&&W==1024&&(C.ptrSize==1?C.name=(U&16?"":(U&8?"un":"")+"signed ")+"char":C.name=(U&8?"u":"")+(U&32?"float":"int")+(C.ptrSize*8+"_t")),C.ptrSize==8&&!(U&32)&&(W=64),W==2048&&(q==512||q==640?W=4096:q&&(W=3072)),N(W,C)}var k=function(){function N(C){this.id=C.id,this.name=C.name,this.flags=C.flags,this.spec=C}return N.prototype.toString=function(){return this.name},N}(),L={Type:k,getComplexType:E,makeType:t,structureList:o};return i.output=L,i.output||L}function __nbind_register_type(i,o){var f=_nbind.readAsciiString(o),p={flags:10240,id:i,name:f};_nbind.makeType(_nbind.constructType,p)}function __nbind_register_callback_signature(i,o){var f=_nbind.readTypeIdList(i,o),p=_nbind.callbackSignatureList.length;return _nbind.callbackSignatureList[p]=_nbind.makeJSCaller(f),p}function __extends(i,o){for(var f in o)o.hasOwnProperty(f)&&(i[f]=o[f]);function p(){this.constructor=i}p.prototype=o.prototype,i.prototype=new p}function __nbind_register_class(i,o,f,p,E,t,k){var L=_nbind.readAsciiString(k),N=_nbind.readPolicyList(o),C=HEAPU32.subarray(i/4,i/4+2),U={flags:2048|(N.Value?2:0),id:C[0],name:L},q=_nbind.makeType(_nbind.constructType,U);q.ptrType=_nbind.getComplexType(C[1],_nbind.constructType,_nbind.getType,_nbind.queryType),q.destroy=_nbind.makeMethodCaller(q.ptrType,{boundID:U.id,flags:0,name:"destroy",num:0,ptr:t,title:q.name+".free",typeList:["void","uint32_t","uint32_t"]}),E&&(q.superIdList=Array.prototype.slice.call(HEAPU32.subarray(f/4,f/4+E)),q.upcastList=Array.prototype.slice.call(HEAPU32.subarray(p/4,p/4+E))),Module[q.name]=q.makeBound(N),_nbind.BindClass.list.push(q)}function _removeAccessorPrefix(i){var o=/^[Gg]et_?([A-Z]?([A-Z]?))/;return i.replace(o,function(f,p,E){return E?p:p.toLowerCase()})}function __nbind_register_function(i,o,f,p,E,t,k,L,N,C){var U=_nbind.getType(i),q=_nbind.readPolicyList(o),W=_nbind.readTypeIdList(f,p),ne;if(k==5)ne=[{direct:E,name:"__nbindConstructor",ptr:0,title:U.name+" constructor",typeList:["uint32_t"].concat(W.slice(1))},{direct:t,name:"__nbindValueConstructor",ptr:0,title:U.name+" value constructor",typeList:["void","uint32_t"].concat(W.slice(1))}];else{var m=_nbind.readAsciiString(L),we=(U.name&&U.name+".")+m;(k==3||k==4)&&(m=_removeAccessorPrefix(m)),ne=[{boundID:i,direct:t,name:m,ptr:E,title:we,typeList:W}]}for(var Se=0,he=ne;Se>2]=i),i}function _llvm_stacksave(){var i=_llvm_stacksave;return i.LLVM_SAVEDSTACKS||(i.LLVM_SAVEDSTACKS=[]),i.LLVM_SAVEDSTACKS.push(Runtime.stackSave()),i.LLVM_SAVEDSTACKS.length-1}function ___syscall140(i,o){SYSCALLS.varargs=o;try{var f=SYSCALLS.getStreamFromFD(),p=SYSCALLS.get(),E=SYSCALLS.get(),t=SYSCALLS.get(),k=SYSCALLS.get(),L=E;return FS.llseek(f,L,k),HEAP32[t>>2]=f.position,f.getdents&&L===0&&k===0&&(f.getdents=null),0}catch(N){return(typeof FS=="undefined"||!(N instanceof FS.ErrnoError))&&abort(N),-N.errno}}function ___syscall146(i,o){SYSCALLS.varargs=o;try{var f=SYSCALLS.get(),p=SYSCALLS.get(),E=SYSCALLS.get(),t=0;___syscall146.buffer||(___syscall146.buffers=[null,[],[]],___syscall146.printChar=function(U,q){var W=___syscall146.buffers[U];assert(W),q===0||q===10?((U===1?Module.print:Module.printErr)(UTF8ArrayToString(W,0)),W.length=0):W.push(q)});for(var k=0;k>2],N=HEAP32[p+(k*8+4)>>2],C=0;Ci.pageSize/2||o>i.pageSize-f){var p=_nbind.typeNameTbl.NBind.proto;return p.lalloc(o)}else return HEAPU32[i.usedPtr]=f+o,i.rootPtr+f},i.lreset=function(o,f){var p=HEAPU32[i.pagePtr];if(p){var E=_nbind.typeNameTbl.NBind.proto;E.lreset(o,f)}else HEAPU32[i.usedPtr]=o},i}();_nbind.Pool=Pool;function constructType(i,o){var f=i==10240?_nbind.makeTypeNameTbl[o.name]||_nbind.BindType:_nbind.makeTypeKindTbl[i],p=new f(o);return typeIdTbl[o.id]=p,_nbind.typeNameTbl[o.name]=p,p}_nbind.constructType=constructType;function getType(i){return typeIdTbl[i]}_nbind.getType=getType;function queryType(i){var o=HEAPU8[i],f=_nbind.structureList[o][1];i/=4,f<0&&(++i,f=HEAPU32[i]+1);var p=Array.prototype.slice.call(HEAPU32.subarray(i+1,i+1+f));return o==9&&(p=[p[0],p.slice(1)]),{paramList:p,placeholderFlag:o}}_nbind.queryType=queryType;function getTypes(i,o){return i.map(function(f){return typeof f=="number"?_nbind.getComplexType(f,constructType,getType,queryType,o):_nbind.typeNameTbl[f]})}_nbind.getTypes=getTypes;function readTypeIdList(i,o){return Array.prototype.slice.call(HEAPU32,i/4,i/4+o)}_nbind.readTypeIdList=readTypeIdList;function readAsciiString(i){for(var o=i;HEAPU8[o++];);return String.fromCharCode.apply("",HEAPU8.subarray(i,o-1))}_nbind.readAsciiString=readAsciiString;function readPolicyList(i){var o={};if(i)for(;;){var f=HEAPU32[i/4];if(!f)break;o[readAsciiString(f)]=!0,i+=4}return o}_nbind.readPolicyList=readPolicyList;function getDynCall(i,o){var f={float32_t:"d",float64_t:"d",int64_t:"d",uint64_t:"d",void:"v"},p=i.map(function(t){return f[t.name]||"i"}).join(""),E=Module["dynCall_"+p];if(!E)throw new Error("dynCall_"+p+" not found for "+o+"("+i.map(function(t){return t.name}).join(", ")+")");return E}_nbind.getDynCall=getDynCall;function addMethod(i,o,f,p){var E=i[o];i.hasOwnProperty(o)&&E?((E.arity||E.arity===0)&&(E=_nbind.makeOverloader(E,E.arity),i[o]=E),E.addMethod(f,p)):(f.arity=p,i[o]=f)}_nbind.addMethod=addMethod;function throwError(i){throw new Error(i)}_nbind.throwError=throwError,_nbind.bigEndian=!1,_a=_typeModule(_typeModule),_nbind.Type=_a.Type,_nbind.makeType=_a.makeType,_nbind.getComplexType=_a.getComplexType,_nbind.structureList=_a.structureList;var BindType=function(i){__extends(o,i);function o(){var f=i!==null&&i.apply(this,arguments)||this;return f.heap=HEAPU32,f.ptrSize=4,f}return o.prototype.needsWireRead=function(f){return!!this.wireRead||!!this.makeWireRead},o.prototype.needsWireWrite=function(f){return!!this.wireWrite||!!this.makeWireWrite},o}(_nbind.Type);_nbind.BindType=BindType;var PrimitiveType=function(i){__extends(o,i);function o(f){var p=i.call(this,f)||this,E=f.flags&32?{32:HEAPF32,64:HEAPF64}:f.flags&8?{8:HEAPU8,16:HEAPU16,32:HEAPU32}:{8:HEAP8,16:HEAP16,32:HEAP32};return p.heap=E[f.ptrSize*8],p.ptrSize=f.ptrSize,p}return o.prototype.needsWireWrite=function(f){return!!f&&!!f.Strict},o.prototype.makeWireWrite=function(f,p){return p&&p.Strict&&function(E){if(typeof E=="number")return E;throw new Error("Type mismatch")}},o}(BindType);_nbind.PrimitiveType=PrimitiveType;function pushCString(i,o){if(i==null){if(o&&o.Nullable)return 0;throw new Error("Type mismatch")}if(o&&o.Strict){if(typeof i!="string")throw new Error("Type mismatch")}else i=i.toString();var f=Module.lengthBytesUTF8(i)+1,p=_nbind.Pool.lalloc(f);return Module.stringToUTF8Array(i,HEAPU8,p,f),p}_nbind.pushCString=pushCString;function popCString(i){return i===0?null:Module.Pointer_stringify(i)}_nbind.popCString=popCString;var CStringType=function(i){__extends(o,i);function o(){var f=i!==null&&i.apply(this,arguments)||this;return f.wireRead=popCString,f.wireWrite=pushCString,f.readResources=[_nbind.resources.pool],f.writeResources=[_nbind.resources.pool],f}return o.prototype.makeWireWrite=function(f,p){return function(E){return pushCString(E,p)}},o}(BindType);_nbind.CStringType=CStringType;var BooleanType=function(i){__extends(o,i);function o(){var f=i!==null&&i.apply(this,arguments)||this;return f.wireRead=function(p){return!!p},f}return o.prototype.needsWireWrite=function(f){return!!f&&!!f.Strict},o.prototype.makeWireRead=function(f){return"!!("+f+")"},o.prototype.makeWireWrite=function(f,p){return p&&p.Strict&&function(E){if(typeof E=="boolean")return E;throw new Error("Type mismatch")}||f},o}(BindType);_nbind.BooleanType=BooleanType;var Wrapper=function(){function i(){}return i.prototype.persist=function(){this.__nbindState|=1},i}();_nbind.Wrapper=Wrapper;function makeBound(i,o){var f=function(p){__extends(E,p);function E(t,k,L,N){var C=p.call(this)||this;if(!(C instanceof E))return new(Function.prototype.bind.apply(E,Array.prototype.concat.apply([null],arguments)));var U=k,q=L,W=N;if(t!==_nbind.ptrMarker){var ne=C.__nbindConstructor.apply(C,arguments);U=4096|512,W=HEAPU32[ne/4],q=HEAPU32[ne/4+1]}var m={configurable:!0,enumerable:!1,value:null,writable:!1},we={__nbindFlags:U,__nbindPtr:q};W&&(we.__nbindShared=W,_nbind.mark(C));for(var Se=0,he=Object.keys(we);Se>=1;var f=_nbind.valueList[i];return _nbind.valueList[i]=firstFreeValue,firstFreeValue=i,f}else{if(o)return _nbind.popShared(i,o);throw new Error("Invalid value slot "+i)}}_nbind.popValue=popValue;var valueBase=18446744073709552e3;function push64(i){return typeof i=="number"?i:pushValue(i)*4096+valueBase}function pop64(i){return i=3?k=Buffer.from(t):k=new Buffer(t),k.copy(p)}else getBuffer(p).set(t)}}_nbind.commitBuffer=commitBuffer;var dirtyList=[],gcTimer=0;function sweep(){for(var i=0,o=dirtyList;i>2]=DYNAMIC_BASE,staticSealed=!0;function invoke_viiiii(i,o,f,p,E,t){try{Module.dynCall_viiiii(i,o,f,p,E,t)}catch(k){if(typeof k!="number"&&k!=="longjmp")throw k;Module.setThrew(1,0)}}function invoke_vif(i,o,f){try{Module.dynCall_vif(i,o,f)}catch(p){if(typeof p!="number"&&p!=="longjmp")throw p;Module.setThrew(1,0)}}function invoke_vid(i,o,f){try{Module.dynCall_vid(i,o,f)}catch(p){if(typeof p!="number"&&p!=="longjmp")throw p;Module.setThrew(1,0)}}function invoke_fiff(i,o,f,p){try{return Module.dynCall_fiff(i,o,f,p)}catch(E){if(typeof E!="number"&&E!=="longjmp")throw E;Module.setThrew(1,0)}}function invoke_vi(i,o){try{Module.dynCall_vi(i,o)}catch(f){if(typeof f!="number"&&f!=="longjmp")throw f;Module.setThrew(1,0)}}function invoke_vii(i,o,f){try{Module.dynCall_vii(i,o,f)}catch(p){if(typeof p!="number"&&p!=="longjmp")throw p;Module.setThrew(1,0)}}function invoke_ii(i,o){try{return Module.dynCall_ii(i,o)}catch(f){if(typeof f!="number"&&f!=="longjmp")throw f;Module.setThrew(1,0)}}function invoke_viddi(i,o,f,p,E){try{Module.dynCall_viddi(i,o,f,p,E)}catch(t){if(typeof t!="number"&&t!=="longjmp")throw t;Module.setThrew(1,0)}}function invoke_vidd(i,o,f,p){try{Module.dynCall_vidd(i,o,f,p)}catch(E){if(typeof E!="number"&&E!=="longjmp")throw E;Module.setThrew(1,0)}}function invoke_iiii(i,o,f,p){try{return Module.dynCall_iiii(i,o,f,p)}catch(E){if(typeof E!="number"&&E!=="longjmp")throw E;Module.setThrew(1,0)}}function invoke_diii(i,o,f,p){try{return Module.dynCall_diii(i,o,f,p)}catch(E){if(typeof E!="number"&&E!=="longjmp")throw E;Module.setThrew(1,0)}}function invoke_di(i,o){try{return Module.dynCall_di(i,o)}catch(f){if(typeof f!="number"&&f!=="longjmp")throw f;Module.setThrew(1,0)}}function invoke_iid(i,o,f){try{return Module.dynCall_iid(i,o,f)}catch(p){if(typeof p!="number"&&p!=="longjmp")throw p;Module.setThrew(1,0)}}function invoke_iii(i,o,f){try{return Module.dynCall_iii(i,o,f)}catch(p){if(typeof p!="number"&&p!=="longjmp")throw p;Module.setThrew(1,0)}}function invoke_viiddi(i,o,f,p,E,t){try{Module.dynCall_viiddi(i,o,f,p,E,t)}catch(k){if(typeof k!="number"&&k!=="longjmp")throw k;Module.setThrew(1,0)}}function invoke_viiiiii(i,o,f,p,E,t,k){try{Module.dynCall_viiiiii(i,o,f,p,E,t,k)}catch(L){if(typeof L!="number"&&L!=="longjmp")throw L;Module.setThrew(1,0)}}function invoke_dii(i,o,f){try{return Module.dynCall_dii(i,o,f)}catch(p){if(typeof p!="number"&&p!=="longjmp")throw p;Module.setThrew(1,0)}}function invoke_i(i){try{return Module.dynCall_i(i)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_iiiiii(i,o,f,p,E,t){try{return Module.dynCall_iiiiii(i,o,f,p,E,t)}catch(k){if(typeof k!="number"&&k!=="longjmp")throw k;Module.setThrew(1,0)}}function invoke_viiid(i,o,f,p,E){try{Module.dynCall_viiid(i,o,f,p,E)}catch(t){if(typeof t!="number"&&t!=="longjmp")throw t;Module.setThrew(1,0)}}function invoke_viififi(i,o,f,p,E,t,k){try{Module.dynCall_viififi(i,o,f,p,E,t,k)}catch(L){if(typeof L!="number"&&L!=="longjmp")throw L;Module.setThrew(1,0)}}function invoke_viii(i,o,f,p){try{Module.dynCall_viii(i,o,f,p)}catch(E){if(typeof E!="number"&&E!=="longjmp")throw E;Module.setThrew(1,0)}}function invoke_v(i){try{Module.dynCall_v(i)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_viid(i,o,f,p){try{Module.dynCall_viid(i,o,f,p)}catch(E){if(typeof E!="number"&&E!=="longjmp")throw E;Module.setThrew(1,0)}}function invoke_idd(i,o,f){try{return Module.dynCall_idd(i,o,f)}catch(p){if(typeof p!="number"&&p!=="longjmp")throw p;Module.setThrew(1,0)}}function invoke_viiii(i,o,f,p,E){try{Module.dynCall_viiii(i,o,f,p,E)}catch(t){if(typeof t!="number"&&t!=="longjmp")throw t;Module.setThrew(1,0)}}Module.asmGlobalArg={Math,Int8Array,Int16Array,Int32Array,Uint8Array,Uint16Array,Uint32Array,Float32Array,Float64Array,NaN:NaN,Infinity:Infinity},Module.asmLibraryArg={abort,assert,enlargeMemory,getTotalMemory,abortOnCannotGrowMemory,invoke_viiiii,invoke_vif,invoke_vid,invoke_fiff,invoke_vi,invoke_vii,invoke_ii,invoke_viddi,invoke_vidd,invoke_iiii,invoke_diii,invoke_di,invoke_iid,invoke_iii,invoke_viiddi,invoke_viiiiii,invoke_dii,invoke_i,invoke_iiiiii,invoke_viiid,invoke_viififi,invoke_viii,invoke_v,invoke_viid,invoke_idd,invoke_viiii,_emscripten_asm_const_iiiii,_emscripten_asm_const_iiidddddd,_emscripten_asm_const_iiiid,__nbind_reference_external,_emscripten_asm_const_iiiiiiii,_removeAccessorPrefix,_typeModule,__nbind_register_pool,__decorate,_llvm_stackrestore,___cxa_atexit,__extends,__nbind_get_value_object,__ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj,_emscripten_set_main_loop_timing,__nbind_register_primitive,__nbind_register_type,_emscripten_memcpy_big,__nbind_register_function,___setErrNo,__nbind_register_class,__nbind_finish,_abort,_nbind_value,_llvm_stacksave,___syscall54,_defineHidden,_emscripten_set_main_loop,_emscripten_get_now,__nbind_register_callback_signature,_emscripten_asm_const_iiiiii,__nbind_free_external,_emscripten_asm_const_iiii,_emscripten_asm_const_iiididi,___syscall6,_atexit,___syscall140,___syscall146,DYNAMICTOP_PTR,tempDoublePtr,ABORT,STACKTOP,STACK_MAX,cttz_i8,___dso_handle};var asm=function(i,o,f){var p=new i.Int8Array(f),E=new i.Int16Array(f),t=new i.Int32Array(f),k=new i.Uint8Array(f),L=new i.Uint16Array(f),N=new i.Uint32Array(f),C=new i.Float32Array(f),U=new i.Float64Array(f),q=o.DYNAMICTOP_PTR|0,W=o.tempDoublePtr|0,ne=o.ABORT|0,m=o.STACKTOP|0,we=o.STACK_MAX|0,Se=o.cttz_i8|0,he=o.___dso_handle|0,ge=0,ze=0,pe=0,Oe=0,le=i.NaN,Ue=i.Infinity,Ge=0,rt=0,wt=0,xt=0,$e=0,ft=0,Ke=i.Math.floor,jt=i.Math.abs,$t=i.Math.sqrt,at=i.Math.pow,Q=i.Math.cos,ae=i.Math.sin,Ce=i.Math.tan,ue=i.Math.acos,je=i.Math.asin,ct=i.Math.atan,At=i.Math.atan2,en=i.Math.exp,ln=i.Math.log,An=i.Math.ceil,nr=i.Math.imul,un=i.Math.min,Wt=i.Math.max,vr=i.Math.clz32,w=i.Math.fround,Ut=o.abort,Vn=o.assert,fr=o.enlargeMemory,Fr=o.getTotalMemory,ur=o.abortOnCannotGrowMemory,br=o.invoke_viiiii,Kt=o.invoke_vif,vu=o.invoke_vid,a0=o.invoke_fiff,So=o.invoke_vi,Go=o.invoke_vii,Os=o.invoke_ii,Yo=o.invoke_viddi,Ko=o.invoke_vidd,qt=o.invoke_iiii,_i=o.invoke_diii,eu=o.invoke_di,ai=o.invoke_iid,mr=o.invoke_iii,Xo=o.invoke_viiddi,W0=o.invoke_viiiiii,Lu=o.invoke_dii,V0=o.invoke_i,Hr=o.invoke_iiiiii,To=o.invoke_viiid,Co=o.invoke_viififi,L0=o.invoke_viii,tu=o.invoke_v,Si=o.invoke_viid,ks=o.invoke_idd,Hl=o.invoke_viiii,F0=o._emscripten_asm_const_iiiii,f0=o._emscripten_asm_const_iiidddddd,Pr=o._emscripten_asm_const_iiiid,Ei=o.__nbind_reference_external,G0=o._emscripten_asm_const_iiiiiiii,fi=o._removeAccessorPrefix,Zt=o._typeModule,Ln=o.__nbind_register_pool,Di=o.__decorate,ci=o._llvm_stackrestore,Ht=o.___cxa_atexit,Du=o.__extends,Yi=o.__nbind_get_value_object,Y0=o.__ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj,Ui=o._emscripten_set_main_loop_timing,Wl=o.__nbind_register_primitive,xo=o.__nbind_register_type,ni=o._emscripten_memcpy_big,oo=o.__nbind_register_function,Vl=o.___setErrNo,Ao=o.__nbind_register_class,Ms=o.__nbind_finish,Xn=o._abort,Qo=o._nbind_value,lo=o._llvm_stacksave,b0=o.___syscall54,yl=o._defineHidden,Ro=o._emscripten_set_main_loop,Et=o._emscripten_get_now,Pt=o.__nbind_register_callback_signature,Bn=o._emscripten_asm_const_iiiiii,Ir=o.__nbind_free_external,ji=o._emscripten_asm_const_iiii,Wr=o._emscripten_asm_const_iiididi,wu=o.___syscall6,c0=o._atexit,Ti=o.___syscall140,d0=o.___syscall146,as=w(0);let St=w(0);function so(e){e=e|0;var n=0;return n=m,m=m+e|0,m=m+15&-16,n|0}function Jo(){return m|0}function Gl(e){e=e|0,m=e}function Fu(e,n){e=e|0,n=n|0,m=e,we=n}function fs(e,n){e=e|0,n=n|0,ge||(ge=e,ze=n)}function P0(e){e=e|0,ft=e}function X(){return ft|0}function _e(){var e=0,n=0;pr(8104,8,400)|0,pr(8504,408,540)|0,e=9044,n=e+44|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));p[9088]=0,p[9089]=1,t[2273]=0,t[2274]=948,t[2275]=948,Ht(17,8104,he|0)|0}function Ne(e){e=e|0,ic(e+948|0)}function Me(e){return e=w(e),((cr(e)|0)&2147483647)>>>0>2139095040|0}function dt(e,n,r){e=e|0,n=n|0,r=r|0;e:do if(t[e+(n<<3)+4>>2]|0)e=e+(n<<3)|0;else{if((n|2|0)==3?t[e+60>>2]|0:0){e=e+56|0;break}switch(n|0){case 0:case 2:case 4:case 5:{if(t[e+52>>2]|0){e=e+48|0;break e}break}default:}if(t[e+68>>2]|0){e=e+64|0;break}else{e=(n|1|0)==5?948:r;break}}while(0);return e|0}function Hn(e){e=e|0;var n=0;return n=C_(1e3)|0,Dn(e,(n|0)!=0,2456),t[2276]=(t[2276]|0)+1,pr(n|0,8104,1e3)|0,p[e+2>>0]|0&&(t[n+4>>2]=2,t[n+12>>2]=4),t[n+976>>2]=e,n|0}function Dn(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0;l=m,m=m+16|0,u=l,n||(t[u>>2]=r,_l(e,5,3197,u)),m=l}function or(){return Hn(956)|0}function mi(e){e=e|0;var n=0;return n=cn(1e3)|0,Su(n,e),Dn(t[e+976>>2]|0,1,2456),t[2276]=(t[2276]|0)+1,t[n+944>>2]=0,n|0}function Su(e,n){e=e|0,n=n|0;var r=0;pr(e|0,n|0,948)|0,na(e+948|0,n+948|0),r=e+960|0,e=n+960|0,n=r+40|0;do t[r>>2]=t[e>>2],r=r+4|0,e=e+4|0;while((r|0)<(n|0))}function bu(e){e=e|0;var n=0,r=0,u=0,l=0;if(n=e+944|0,r=t[n>>2]|0,r|0&&(Pu(r+948|0,e)|0,t[n>>2]=0),r=mu(e)|0,r|0){n=0;do t[(yi(e,n)|0)+944>>2]=0,n=n+1|0;while((n|0)!=(r|0))}r=e+948|0,u=t[r>>2]|0,l=e+952|0,n=t[l>>2]|0,(n|0)!=(u|0)&&(t[l>>2]=n+(~((n+-4-u|0)>>>2)<<2)),Oo(r),x_(e),t[2276]=(t[2276]|0)+-1}function Pu(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0;u=t[e>>2]|0,D=e+4|0,r=t[D>>2]|0,s=r;e:do if((u|0)==(r|0))l=u,h=4;else for(e=u;;){if((t[e>>2]|0)==(n|0)){l=e,h=4;break e}if(e=e+4|0,(e|0)==(r|0)){e=0;break}}while(0);return(h|0)==4&&((l|0)!=(r|0)?(u=l+4|0,e=s-u|0,n=e>>2,n&&(Iy(l|0,u|0,e|0)|0,r=t[D>>2]|0),e=l+(n<<2)|0,(r|0)==(e|0)||(t[D>>2]=r+(~((r+-4-e|0)>>>2)<<2)),e=1):e=0),e|0}function mu(e){return e=e|0,(t[e+952>>2]|0)-(t[e+948>>2]|0)>>2|0}function yi(e,n){e=e|0,n=n|0;var r=0;return r=t[e+948>>2]|0,(t[e+952>>2]|0)-r>>2>>>0>n>>>0?e=t[r+(n<<2)>>2]|0:e=0,e|0}function Oo(e){e=e|0;var n=0,r=0,u=0,l=0;u=m,m=m+32|0,n=u,l=t[e>>2]|0,r=(t[e+4>>2]|0)-l|0,((t[e+8>>2]|0)-l|0)>>>0>r>>>0&&(l=r>>2,Y(n,l,l,e+8|0),Qr(e,n),Jr(n)),m=u}function Tu(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0;M=mu(e)|0;do if(M|0){if((t[(yi(e,0)|0)+944>>2]|0)==(e|0)){if(!(Pu(e+948|0,n)|0))break;pr(n+400|0,8504,540)|0,t[n+944>>2]=0,Gn(e);break}h=t[(t[e+976>>2]|0)+12>>2]|0,D=e+948|0,S=(h|0)==0,r=0,s=0;do u=t[(t[D>>2]|0)+(s<<2)>>2]|0,(u|0)==(n|0)?Gn(e):(l=mi(u)|0,t[(t[D>>2]|0)+(r<<2)>>2]=l,t[l+944>>2]=e,S||$E[h&15](u,l,e,r),r=r+1|0),s=s+1|0;while((s|0)!=(M|0));if(r>>>0>>0){S=e+948|0,D=e+952|0,h=r,r=t[D>>2]|0;do s=(t[S>>2]|0)+(h<<2)|0,u=s+4|0,l=r-u|0,n=l>>2,n&&(Iy(s|0,u|0,l|0)|0,r=t[D>>2]|0),l=r,u=s+(n<<2)|0,(l|0)!=(u|0)&&(r=l+(~((l+-4-u|0)>>>2)<<2)|0,t[D>>2]=r),h=h+1|0;while((h|0)!=(M|0))}}while(0)}function ao(e){e=e|0;var n=0,r=0,u=0,l=0;Iu(e,(mu(e)|0)==0,2491),Iu(e,(t[e+944>>2]|0)==0,2545),n=e+948|0,r=t[n>>2]|0,u=e+952|0,l=t[u>>2]|0,(l|0)!=(r|0)&&(t[u>>2]=l+(~((l+-4-r|0)>>>2)<<2)),Oo(n),n=e+976|0,r=t[n>>2]|0,pr(e|0,8104,1e3)|0,p[r+2>>0]|0&&(t[e+4>>2]=2,t[e+12>>2]=4),t[n>>2]=r}function Iu(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0;l=m,m=m+16|0,u=l,n||(t[u>>2]=r,sr(e,5,3197,u)),m=l}function Oa(){return t[2276]|0}function p0(){var e=0;return e=C_(20)|0,Zs((e|0)!=0,2592),t[2277]=(t[2277]|0)+1,t[e>>2]=t[239],t[e+4>>2]=t[240],t[e+8>>2]=t[241],t[e+12>>2]=t[242],t[e+16>>2]=t[243],e|0}function Zs(e,n){e=e|0,n=n|0;var r=0,u=0;u=m,m=m+16|0,r=u,e||(t[r>>2]=n,sr(0,5,3197,r)),m=u}function K0(e){e=e|0,x_(e),t[2277]=(t[2277]|0)+-1}function $s(e,n){e=e|0,n=n|0;var r=0;n?(Iu(e,(mu(e)|0)==0,2629),r=1):(r=0,n=0),t[e+964>>2]=n,t[e+988>>2]=r}function ka(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;u=m,m=m+16|0,s=u+8|0,l=u+4|0,h=u,t[l>>2]=n,Iu(e,(t[n+944>>2]|0)==0,2709),Iu(e,(t[e+964>>2]|0)==0,2763),cs(e),n=e+948|0,t[h>>2]=(t[n>>2]|0)+(r<<2),t[s>>2]=t[h>>2],w0(n,s,l)|0,t[(t[l>>2]|0)+944>>2]=e,Gn(e),m=u}function cs(e){e=e|0;var n=0,r=0,u=0,l=0,s=0,h=0,D=0;if(r=mu(e)|0,r|0?(t[(yi(e,0)|0)+944>>2]|0)!=(e|0):0){u=t[(t[e+976>>2]|0)+12>>2]|0,l=e+948|0,s=(u|0)==0,n=0;do h=t[(t[l>>2]|0)+(n<<2)>>2]|0,D=mi(h)|0,t[(t[l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t[O>>2]|0;break}s=u,h=((s-l>>2)+1|0)/-2|0,D=u+(h<<2)|0,l=S-s|0,s=l>>2,s&&(Iy(D|0,u|0,l|0)|0,u=t[M>>2]|0),We=D+(s<<2)|0,t[O>>2]=We,t[M>>2]=u+(h<<2),u=We}while(0);t[u>>2]=t[r>>2],t[O>>2]=(t[O>>2]|0)+4,n=lt(e,ve,n)|0,Jr(ve)}while(0);return m=Qe,n|0}function Gn(e){e=e|0;var n=0;do{if(n=e+984|0,p[n>>0]|0)break;p[n>>0]=1,C[e+504>>2]=w(le),e=t[e+944>>2]|0}while((e|0)!=0)}function ic(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-4-u|0)>>>2)<<2)),yt(r))}function ri(e){return e=e|0,t[e+944>>2]|0}function Gr(e){e=e|0,Iu(e,(t[e+964>>2]|0)!=0,2832),Gn(e)}function Yl(e){return e=e|0,(p[e+984>>0]|0)!=0|0}function ea(e,n){e=e|0,n=n|0,MI(e,n,400)|0&&(pr(e|0,n|0,400)|0,Gn(e))}function lf(e){e=e|0;var n=St;return n=w(C[e+44>>2]),e=Me(n)|0,w(e?w(0):n)}function Ns(e){e=e|0;var n=St;return n=w(C[e+48>>2]),Me(n)|0&&(n=p[(t[e+976>>2]|0)+2>>0]|0?w(1):w(0)),w(n)}function Ma(e,n){e=e|0,n=n|0,t[e+980>>2]=n}function Ls(e){return e=e|0,t[e+980>>2]|0}function h0(e,n){e=e|0,n=n|0;var r=0;r=e+4|0,(t[r>>2]|0)!=(n|0)&&(t[r>>2]=n,Gn(e))}function Fs(e){return e=e|0,t[e+4>>2]|0}function Ni(e,n){e=e|0,n=n|0;var r=0;r=e+8|0,(t[r>>2]|0)!=(n|0)&&(t[r>>2]=n,Gn(e))}function B(e){return e=e|0,t[e+8>>2]|0}function z(e,n){e=e|0,n=n|0;var r=0;r=e+12|0,(t[r>>2]|0)!=(n|0)&&(t[r>>2]=n,Gn(e))}function G(e){return e=e|0,t[e+12>>2]|0}function $(e,n){e=e|0,n=n|0;var r=0;r=e+16|0,(t[r>>2]|0)!=(n|0)&&(t[r>>2]=n,Gn(e))}function De(e){return e=e|0,t[e+16>>2]|0}function me(e,n){e=e|0,n=n|0;var r=0;r=e+20|0,(t[r>>2]|0)!=(n|0)&&(t[r>>2]=n,Gn(e))}function xe(e){return e=e|0,t[e+20>>2]|0}function Z(e,n){e=e|0,n=n|0;var r=0;r=e+24|0,(t[r>>2]|0)!=(n|0)&&(t[r>>2]=n,Gn(e))}function ke(e){return e=e|0,t[e+24>>2]|0}function Xe(e,n){e=e|0,n=n|0;var r=0;r=e+28|0,(t[r>>2]|0)!=(n|0)&&(t[r>>2]=n,Gn(e))}function ht(e){return e=e|0,t[e+28>>2]|0}function ie(e,n){e=e|0,n=n|0;var r=0;r=e+32|0,(t[r>>2]|0)!=(n|0)&&(t[r>>2]=n,Gn(e))}function qe(e){return e=e|0,t[e+32>>2]|0}function tt(e,n){e=e|0,n=n|0;var r=0;r=e+36|0,(t[r>>2]|0)!=(n|0)&&(t[r>>2]=n,Gn(e))}function Tt(e){return e=e|0,t[e+36>>2]|0}function kt(e,n){e=e|0,n=w(n);var r=0;r=e+40|0,w(C[r>>2])!=n&&(C[r>>2]=n,Gn(e))}function bt(e,n){e=e|0,n=w(n);var r=0;r=e+44|0,w(C[r>>2])!=n&&(C[r>>2]=n,Gn(e))}function on(e,n){e=e|0,n=w(n);var r=0;r=e+48|0,w(C[r>>2])!=n&&(C[r>>2]=n,Gn(e))}function tn(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=(s^1)&1,u=e+52|0,l=e+56|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function Lt(e,n){e=e|0,n=w(n);var r=0,u=0;u=e+52|0,r=e+56|0,(w(C[u>>2])==n?(t[r>>2]|0)==2:0)||(C[u>>2]=n,u=Me(n)|0,t[r>>2]=u?3:2,Gn(e))}function gn(e,n){e=e|0,n=n|0;var r=0,u=0;u=n+52|0,r=t[u+4>>2]|0,n=e,t[n>>2]=t[u>>2],t[n+4>>2]=r}function lr(e,n,r){e=e|0,n=n|0,r=w(r);var u=0,l=0,s=0;s=Me(r)|0,u=(s^1)&1,l=e+132+(n<<3)|0,n=e+132+(n<<3)+4|0,(s|w(C[l>>2])==r?(t[n>>2]|0)==(u|0):0)||(C[l>>2]=r,t[n>>2]=u,Gn(e))}function Qn(e,n,r){e=e|0,n=n|0,r=w(r);var u=0,l=0,s=0;s=Me(r)|0,u=s?0:2,l=e+132+(n<<3)|0,n=e+132+(n<<3)+4|0,(s|w(C[l>>2])==r?(t[n>>2]|0)==(u|0):0)||(C[l>>2]=r,t[n>>2]=u,Gn(e))}function _r(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=n+132+(r<<3)|0,n=t[u+4>>2]|0,r=e,t[r>>2]=t[u>>2],t[r+4>>2]=n}function Cn(e,n,r){e=e|0,n=n|0,r=w(r);var u=0,l=0,s=0;s=Me(r)|0,u=(s^1)&1,l=e+60+(n<<3)|0,n=e+60+(n<<3)+4|0,(s|w(C[l>>2])==r?(t[n>>2]|0)==(u|0):0)||(C[l>>2]=r,t[n>>2]=u,Gn(e))}function Ar(e,n,r){e=e|0,n=n|0,r=w(r);var u=0,l=0,s=0;s=Me(r)|0,u=s?0:2,l=e+60+(n<<3)|0,n=e+60+(n<<3)+4|0,(s|w(C[l>>2])==r?(t[n>>2]|0)==(u|0):0)||(C[l>>2]=r,t[n>>2]=u,Gn(e))}function v0(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=n+60+(r<<3)|0,n=t[u+4>>2]|0,r=e,t[r>>2]=t[u>>2],t[r+4>>2]=n}function Rr(e,n){e=e|0,n=n|0;var r=0;r=e+60+(n<<3)+4|0,(t[r>>2]|0)!=3&&(C[e+60+(n<<3)>>2]=w(le),t[r>>2]=3,Gn(e))}function nt(e,n,r){e=e|0,n=n|0,r=w(r);var u=0,l=0,s=0;s=Me(r)|0,u=(s^1)&1,l=e+204+(n<<3)|0,n=e+204+(n<<3)+4|0,(s|w(C[l>>2])==r?(t[n>>2]|0)==(u|0):0)||(C[l>>2]=r,t[n>>2]=u,Gn(e))}function _t(e,n,r){e=e|0,n=n|0,r=w(r);var u=0,l=0,s=0;s=Me(r)|0,u=s?0:2,l=e+204+(n<<3)|0,n=e+204+(n<<3)+4|0,(s|w(C[l>>2])==r?(t[n>>2]|0)==(u|0):0)||(C[l>>2]=r,t[n>>2]=u,Gn(e))}function Ze(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=n+204+(r<<3)|0,n=t[u+4>>2]|0,r=e,t[r>>2]=t[u>>2],t[r+4>>2]=n}function Ft(e,n,r){e=e|0,n=n|0,r=w(r);var u=0,l=0,s=0;s=Me(r)|0,u=(s^1)&1,l=e+276+(n<<3)|0,n=e+276+(n<<3)+4|0,(s|w(C[l>>2])==r?(t[n>>2]|0)==(u|0):0)||(C[l>>2]=r,t[n>>2]=u,Gn(e))}function nn(e,n){return e=e|0,n=n|0,w(C[e+276+(n<<3)>>2])}function sn(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=(s^1)&1,u=e+348|0,l=e+352|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function Yn(e,n){e=e|0,n=w(n);var r=0,u=0;u=e+348|0,r=e+352|0,(w(C[u>>2])==n?(t[r>>2]|0)==2:0)||(C[u>>2]=n,u=Me(n)|0,t[r>>2]=u?3:2,Gn(e))}function yr(e){e=e|0;var n=0;n=e+352|0,(t[n>>2]|0)!=3&&(C[e+348>>2]=w(le),t[n>>2]=3,Gn(e))}function nu(e,n){e=e|0,n=n|0;var r=0,u=0;u=n+348|0,r=t[u+4>>2]|0,n=e,t[n>>2]=t[u>>2],t[n+4>>2]=r}function Cu(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=(s^1)&1,u=e+356|0,l=e+360|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function S0(e,n){e=e|0,n=w(n);var r=0,u=0;u=e+356|0,r=e+360|0,(w(C[u>>2])==n?(t[r>>2]|0)==2:0)||(C[u>>2]=n,u=Me(n)|0,t[r>>2]=u?3:2,Gn(e))}function X0(e){e=e|0;var n=0;n=e+360|0,(t[n>>2]|0)!=3&&(C[e+356>>2]=w(le),t[n>>2]=3,Gn(e))}function xu(e,n){e=e|0,n=n|0;var r=0,u=0;u=n+356|0,r=t[u+4>>2]|0,n=e,t[n>>2]=t[u>>2],t[n+4>>2]=r}function di(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=(s^1)&1,u=e+364|0,l=e+368|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function ko(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=s?0:2,u=e+364|0,l=e+368|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function Zo(e,n){e=e|0,n=n|0;var r=0,u=0;u=n+364|0,r=t[u+4>>2]|0,n=e,t[n>>2]=t[u>>2],t[n+4>>2]=r}function sf(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=(s^1)&1,u=e+372|0,l=e+376|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function gl(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=s?0:2,u=e+372|0,l=e+376|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function af(e,n){e=e|0,n=n|0;var r=0,u=0;u=n+372|0,r=t[u+4>>2]|0,n=e,t[n>>2]=t[u>>2],t[n+4>>2]=r}function Mo(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=(s^1)&1,u=e+380|0,l=e+384|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function ds(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=s?0:2,u=e+380|0,l=e+384|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function bs(e,n){e=e|0,n=n|0;var r=0,u=0;u=n+380|0,r=t[u+4>>2]|0,n=e,t[n>>2]=t[u>>2],t[n+4>>2]=r}function No(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=(s^1)&1,u=e+388|0,l=e+392|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function Lo(e,n){e=e|0,n=w(n);var r=0,u=0,l=0,s=0;s=Me(n)|0,r=s?0:2,u=e+388|0,l=e+392|0,(s|w(C[u>>2])==n?(t[l>>2]|0)==(r|0):0)||(C[u>>2]=n,t[l>>2]=r,Gn(e))}function ps(e,n){e=e|0,n=n|0;var r=0,u=0;u=n+388|0,r=t[u+4>>2]|0,n=e,t[n>>2]=t[u>>2],t[n+4>>2]=r}function Vu(e,n){e=e|0,n=w(n);var r=0;r=e+396|0,w(C[r>>2])!=n&&(C[r>>2]=n,Gn(e))}function yu(e){return e=e|0,w(C[e+396>>2])}function pi(e){return e=e|0,w(C[e+400>>2])}function T0(e){return e=e|0,w(C[e+404>>2])}function Q0(e){return e=e|0,w(C[e+408>>2])}function Fo(e){return e=e|0,w(C[e+412>>2])}function ta(e){return e=e|0,w(C[e+416>>2])}function Kl(e){return e=e|0,w(C[e+420>>2])}function Ki(e,n){switch(e=e|0,n=n|0,Iu(e,(n|0)<6,2918),n|0){case 0:{n=(t[e+496>>2]|0)==2?5:4;break}case 2:{n=(t[e+496>>2]|0)==2?4:5;break}default:}return w(C[e+424+(n<<2)>>2])}function Yr(e,n){switch(e=e|0,n=n|0,Iu(e,(n|0)<6,2918),n|0){case 0:{n=(t[e+496>>2]|0)==2?5:4;break}case 2:{n=(t[e+496>>2]|0)==2?4:5;break}default:}return w(C[e+448+(n<<2)>>2])}function fo(e,n){switch(e=e|0,n=n|0,Iu(e,(n|0)<6,2918),n|0){case 0:{n=(t[e+496>>2]|0)==2?5:4;break}case 2:{n=(t[e+496>>2]|0)==2?4:5;break}default:}return w(C[e+472+(n<<2)>>2])}function Oi(e,n){e=e|0,n=n|0;var r=0,u=St;return r=t[e+4>>2]|0,(r|0)==(t[n+4>>2]|0)?r?(u=w(C[e>>2]),e=w(jt(w(u-w(C[n>>2]))))>2]=0,t[u+4>>2]=0,t[u+8>>2]=0,Y0(u|0,e|0,n|0,0),sr(e,3,(p[u+11>>0]|0)<0?t[u>>2]|0:u,r),eB(u),m=r}function J0(e,n,r,u){e=w(e),n=w(n),r=r|0,u=u|0;var l=St;e=w(e*n),l=w(YE(e,w(1)));do if(gi(l,w(0))|0)e=w(e-l);else{if(e=w(e-l),gi(l,w(1))|0){e=w(e+w(1));break}if(r){e=w(e+w(1));break}u||(l>w(.5)?l=w(1):(u=gi(l,w(.5))|0,l=w(u?1:0)),e=w(e+l))}while(0);return w(e/n)}function Z0(e,n,r,u,l,s,h,D,S,M,O,P,K){e=e|0,n=w(n),r=r|0,u=w(u),l=l|0,s=w(s),h=h|0,D=w(D),S=w(S),M=w(M),O=w(O),P=w(P),K=K|0;var Pe=0,Ee=St,ve=St,Qe=St,We=St,st=St,Re=St;return S>2]),Ee!=w(0)):0)?(Qe=w(J0(n,Ee,0,0)),We=w(J0(u,Ee,0,0)),ve=w(J0(s,Ee,0,0)),Ee=w(J0(D,Ee,0,0))):(ve=s,Qe=n,Ee=D,We=u),(l|0)==(e|0)?Pe=gi(ve,Qe)|0:Pe=0,(h|0)==(r|0)?K=gi(Ee,We)|0:K=0,((Pe?0:(st=w(n-O),!(Te(e,st,S)|0)))?!(et(e,st,l,S)|0):0)?Pe=Ve(e,st,l,s,S)|0:Pe=1,((K?0:(Re=w(u-P),!(Te(r,Re,M)|0)))?!(et(r,Re,h,M)|0):0)?K=Ve(r,Re,h,D,M)|0:K=1,K=Pe&K),K|0}function Te(e,n,r){return e=e|0,n=w(n),r=w(r),(e|0)==1?e=gi(n,r)|0:e=0,e|0}function et(e,n,r,u){return e=e|0,n=w(n),r=r|0,u=w(u),(e|0)==2&(r|0)==0?n>=u?e=1:e=gi(n,u)|0:e=0,e|0}function Ve(e,n,r,u,l){return e=e|0,n=w(n),r=r|0,u=w(u),l=w(l),(e|0)==2&(r|0)==2&u>n?l<=n?e=1:e=gi(n,l)|0:e=0,e|0}function Gt(e,n,r,u,l,s,h,D,S,M,O){e=e|0,n=w(n),r=w(r),u=u|0,l=l|0,s=s|0,h=w(h),D=w(D),S=S|0,M=M|0,O=O|0;var P=0,K=0,Pe=0,Ee=0,ve=St,Qe=St,We=0,st=0,Re=0,Fe=0,Qt=0,Lr=0,Nn=0,mn=0,hr=0,kr=0,On=0,Zi=St,ts=St,ns=St,rs=0,Xs=0;On=m,m=m+160|0,mn=On+152|0,Nn=On+120|0,Lr=On+104|0,Re=On+72|0,Ee=On+56|0,Qt=On+8|0,st=On,Fe=(t[2279]|0)+1|0,t[2279]=Fe,hr=e+984|0,((p[hr>>0]|0)!=0?(t[e+512>>2]|0)!=(t[2278]|0):0)?We=4:(t[e+516>>2]|0)==(u|0)?kr=0:We=4,(We|0)==4&&(t[e+520>>2]=0,t[e+924>>2]=-1,t[e+928>>2]=-1,C[e+932>>2]=w(-1),C[e+936>>2]=w(-1),kr=1);e:do if(t[e+964>>2]|0)if(ve=w(Yt(e,2,h)),Qe=w(Yt(e,0,h)),P=e+916|0,ns=w(C[P>>2]),ts=w(C[e+920>>2]),Zi=w(C[e+932>>2]),Z0(l,n,s,r,t[e+924>>2]|0,ns,t[e+928>>2]|0,ts,Zi,w(C[e+936>>2]),ve,Qe,O)|0)We=22;else if(Pe=t[e+520>>2]|0,!Pe)We=21;else for(K=0;;){if(P=e+524+(K*24|0)|0,Zi=w(C[P>>2]),ts=w(C[e+524+(K*24|0)+4>>2]),ns=w(C[e+524+(K*24|0)+16>>2]),Z0(l,n,s,r,t[e+524+(K*24|0)+8>>2]|0,Zi,t[e+524+(K*24|0)+12>>2]|0,ts,ns,w(C[e+524+(K*24|0)+20>>2]),ve,Qe,O)|0){We=22;break e}if(K=K+1|0,K>>>0>=Pe>>>0){We=21;break}}else{if(S){if(P=e+916|0,!(gi(w(C[P>>2]),n)|0)){We=21;break}if(!(gi(w(C[e+920>>2]),r)|0)){We=21;break}if((t[e+924>>2]|0)!=(l|0)){We=21;break}P=(t[e+928>>2]|0)==(s|0)?P:0,We=22;break}if(Pe=t[e+520>>2]|0,!Pe)We=21;else for(K=0;;){if(P=e+524+(K*24|0)|0,((gi(w(C[P>>2]),n)|0?gi(w(C[e+524+(K*24|0)+4>>2]),r)|0:0)?(t[e+524+(K*24|0)+8>>2]|0)==(l|0):0)?(t[e+524+(K*24|0)+12>>2]|0)==(s|0):0){We=22;break e}if(K=K+1|0,K>>>0>=Pe>>>0){We=21;break}}}while(0);do if((We|0)==21)p[11697]|0?(P=0,We=28):(P=0,We=31);else if((We|0)==22){if(K=(p[11697]|0)!=0,!((P|0)!=0&(kr^1)))if(K){We=28;break}else{We=31;break}Ee=P+16|0,t[e+908>>2]=t[Ee>>2],Pe=P+20|0,t[e+912>>2]=t[Pe>>2],(p[11698]|0)==0|K^1||(t[st>>2]=Br(Fe)|0,t[st+4>>2]=Fe,sr(e,4,2972,st),K=t[e+972>>2]|0,K|0&&M1[K&127](e),l=wn(l,S)|0,s=wn(s,S)|0,Xs=+w(C[Ee>>2]),rs=+w(C[Pe>>2]),t[Qt>>2]=l,t[Qt+4>>2]=s,U[Qt+8>>3]=+n,U[Qt+16>>3]=+r,U[Qt+24>>3]=Xs,U[Qt+32>>3]=rs,t[Qt+40>>2]=M,sr(e,4,2989,Qt))}while(0);return(We|0)==28&&(K=Br(Fe)|0,t[Ee>>2]=K,t[Ee+4>>2]=Fe,t[Ee+8>>2]=kr?3047:11699,sr(e,4,3038,Ee),K=t[e+972>>2]|0,K|0&&M1[K&127](e),Qt=wn(l,S)|0,We=wn(s,S)|0,t[Re>>2]=Qt,t[Re+4>>2]=We,U[Re+8>>3]=+n,U[Re+16>>3]=+r,t[Re+24>>2]=M,sr(e,4,3049,Re),We=31),(We|0)==31&&(fu(e,n,r,u,l,s,h,D,S,O),p[11697]|0&&(K=t[2279]|0,Qt=Br(K)|0,t[Lr>>2]=Qt,t[Lr+4>>2]=K,t[Lr+8>>2]=kr?3047:11699,sr(e,4,3083,Lr),K=t[e+972>>2]|0,K|0&&M1[K&127](e),Qt=wn(l,S)|0,Lr=wn(s,S)|0,rs=+w(C[e+908>>2]),Xs=+w(C[e+912>>2]),t[Nn>>2]=Qt,t[Nn+4>>2]=Lr,U[Nn+8>>3]=rs,U[Nn+16>>3]=Xs,t[Nn+24>>2]=M,sr(e,4,3092,Nn)),t[e+516>>2]=u,P||(K=e+520|0,P=t[K>>2]|0,(P|0)==16&&(p[11697]|0&&sr(e,4,3124,mn),t[K>>2]=0,P=0),S?P=e+916|0:(t[K>>2]=P+1,P=e+524+(P*24|0)|0),C[P>>2]=n,C[P+4>>2]=r,t[P+8>>2]=l,t[P+12>>2]=s,t[P+16>>2]=t[e+908>>2],t[P+20>>2]=t[e+912>>2],P=0)),S&&(t[e+416>>2]=t[e+908>>2],t[e+420>>2]=t[e+912>>2],p[e+985>>0]=1,p[hr>>0]=0),t[2279]=(t[2279]|0)+-1,t[e+512>>2]=t[2278],m=On,kr|(P|0)==0|0}function Yt(e,n,r){e=e|0,n=n|0,r=w(r);var u=St;return u=w(Li(e,n,r)),w(u+w(A0(e,n,r)))}function sr(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=m,m=m+16|0,l=s,t[l>>2]=u,e?u=t[e+976>>2]|0:u=0,Ps(u,e,n,r,l),m=s}function Br(e){return e=e|0,(e>>>0>60?3201:3201+(60-e)|0)|0}function wn(e,n){e=e|0,n=n|0;var r=0,u=0,l=0;return l=m,m=m+32|0,r=l+12|0,u=l,t[r>>2]=t[254],t[r+4>>2]=t[255],t[r+8>>2]=t[256],t[u>>2]=t[257],t[u+4>>2]=t[258],t[u+8>>2]=t[259],(e|0)>2?e=11699:e=t[(n?u:r)+(e<<2)>>2]|0,m=l,e|0}function fu(e,n,r,u,l,s,h,D,S,M){e=e|0,n=w(n),r=w(r),u=u|0,l=l|0,s=s|0,h=w(h),D=w(D),S=S|0,M=M|0;var O=0,P=0,K=0,Pe=0,Ee=St,ve=St,Qe=St,We=St,st=St,Re=St,Fe=St,Qt=0,Lr=0,Nn=0,mn=St,hr=St,kr=0,On=St,Zi=0,ts=0,ns=0,rs=0,Xs=0,$2=0,ed=0,Za=0,td=0,Oc=0,kc=0,nd=0,rd=0,id=0,si=0,$a=0,ud=0,zf=0,od=St,ld=St,Mc=St,Nc=St,qf=St,Il=0,Aa=0,As=0,ef=0,L1=0,F1=St,Lc=St,b1=St,P1=St,Bl=St,vl=St,tf=0,lu=St,I1=St,is=St,Hf=St,us=St,Wf=St,B1=0,U1=0,Vf=St,Ul=St,nf=0,j1=0,z1=0,q1=0,gr=St,Mu=0,ml=0,os=0,jl=0,Tr=0,Fn=0,rf=0,hn=St,H1=0,u0=0;rf=m,m=m+16|0,Il=rf+12|0,Aa=rf+8|0,As=rf+4|0,ef=rf,Iu(e,(l|0)==0|(Me(n)|0)^1,3326),Iu(e,(s|0)==0|(Me(r)|0)^1,3406),ml=El(e,u)|0,t[e+496>>2]=ml,Tr=I0(2,ml)|0,Fn=I0(0,ml)|0,C[e+440>>2]=w(Li(e,Tr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w(0)?w(ru(O))>w(0):0)?u=O:u=0;else if($0(O)|0){Pe=0;break e}if(P=P+1|0,P>>>0>=jl>>>0){Pe=u;break}}else Pe=0;while(0);Qt=Pe+500|0,Lr=Pe+504|0,u=0,O=0,n=w(0),K=0;do{if(P=t[(t[os>>2]|0)+(K<<2)>>2]|0,(t[P+36>>2]|0)==1)Ci(P),p[P+985>>0]=1,p[P+984>>0]=0;else{Vr(P),S&&C0(P,El(P,ml)|0,ve,lu,gr);do if((t[P+24>>2]|0)!=1)if((P|0)==(Pe|0)){t[Qt>>2]=t[2278],C[Lr>>2]=w(0);break}else{Xr(e,P,gr,l,is,gr,is,s,ml,M);break}else O|0&&(t[O+960>>2]=P),t[P+960>>2]=0,O=P,u=(u|0)==0?P:u;while(0);vl=w(C[P+504>>2]),n=w(n+w(vl+w(Yt(P,Tr,gr))))}K=K+1|0}while((K|0)!=(jl|0));for(ns=n>ve,tf=zf&((Nn|0)==2&ns)?1:Nn,Zi=(nf|0)==1,Xs=Zi&(S^1),$2=(tf|0)==1,ed=(tf|0)==2,Za=976+(Tr<<2)|0,td=(nf|2|0)==2,id=Zi&(zf^1),Oc=1040+(Fn<<2)|0,kc=1040+(Tr<<2)|0,nd=976+(Fn<<2)|0,rd=(nf|0)!=1,ns=zf&((Nn|0)!=0&ns),ts=e+976|0,Zi=Zi^1,n=ve,kr=0,rs=0,vl=w(0),qf=w(0);;){e:do if(kr>>>0>>0)for(Lr=t[os>>2]|0,K=0,Fe=w(0),Re=w(0),Qe=w(0),ve=w(0),P=0,O=0,Pe=kr;;){if(Qt=t[Lr+(Pe<<2)>>2]|0,(t[Qt+36>>2]|0)!=1?(t[Qt+940>>2]=rs,(t[Qt+24>>2]|0)!=1):0){if(We=w(Yt(Qt,Tr,gr)),si=t[Za>>2]|0,r=w(Sn(Qt+380+(si<<3)|0,us)),st=w(C[Qt+504>>2]),r=w(Yp(r,st)),r=w(Eu(w(Sn(Qt+364+(si<<3)|0,us)),r)),zf&(K|0)!=0&w(We+w(Re+r))>n){s=K,We=Fe,Nn=Pe;break e}We=w(We+r),r=w(Re+We),We=w(Fe+We),$0(Qt)|0&&(Qe=w(Qe+w(Xi(Qt))),ve=w(ve-w(st*w(ru(Qt))))),O|0&&(t[O+960>>2]=Qt),t[Qt+960>>2]=0,K=K+1|0,O=Qt,P=(P|0)==0?Qt:P}else We=Fe,r=Re;if(Pe=Pe+1|0,Pe>>>0>>0)Fe=We,Re=r;else{s=K,Nn=Pe;break}}else s=0,We=w(0),Qe=w(0),ve=w(0),P=0,Nn=kr;while(0);si=Qe>w(0)&Qew(0)&veNc&((Me(Nc)|0)^1))n=Nc,si=51;else if(p[(t[ts>>2]|0)+3>>0]|0)si=51;else{if(mn!=w(0)?w(Xi(e))!=w(0):0){si=53;break}n=We,si=53}while(0);if((si|0)==51&&(si=0,Me(n)|0?si=53:(hr=w(n-We),On=n)),(si|0)==53&&(si=0,We>2]|0,Pe=hrw(0),Re=w(hr/mn),Qe=w(0),We=w(0),n=w(0),O=P;do r=w(Sn(O+380+(K<<3)|0,us)),ve=w(Sn(O+364+(K<<3)|0,us)),ve=w(Yp(r,w(Eu(ve,w(C[O+504>>2]))))),Pe?(r=w(ve*w(ru(O))),(r!=w(-0)?(hn=w(ve-w(st*r)),F1=w(Wn(O,Tr,hn,On,gr)),hn!=F1):0)&&(Qe=w(Qe-w(F1-ve)),n=w(n+r))):((Qt?(Lc=w(Xi(O)),Lc!=w(0)):0)?(hn=w(ve+w(Re*Lc)),b1=w(Wn(O,Tr,hn,On,gr)),hn!=b1):0)&&(Qe=w(Qe-w(b1-ve)),We=w(We-Lc)),O=t[O+960>>2]|0;while((O|0)!=0);if(n=w(Fe+n),ve=w(hr+Qe),L1)n=w(0);else{st=w(mn+We),Pe=t[Za>>2]|0,Qt=vew(0),st=w(ve/st),n=w(0);do{hn=w(Sn(P+380+(Pe<<3)|0,us)),Qe=w(Sn(P+364+(Pe<<3)|0,us)),Qe=w(Yp(hn,w(Eu(Qe,w(C[P+504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]=u0|k[$a>>0],ed&n>w(0)?(O=t[Za>>2]|0,((t[e+364+(O<<3)+4>>2]|0)!=0?(Bl=w(Sn(e+364+(O<<3)|0,us)),Bl>=w(0)):0)?ve=w(Eu(w(0),w(Bl-w(On-n)))):ve=w(0)):ve=n,Qt=kr>>>0>>0,Qt){Pe=t[os>>2]|0,K=kr,O=0;do P=t[Pe+(K<<2)>>2]|0,t[P+24>>2]|0||(O=((t[(m0(P,Tr)|0)+4>>2]|0)==3&1)+O|0,O=O+((t[(y0(P,Tr)|0)+4>>2]|0)==3&1)|0),K=K+1|0;while((K|0)!=(Nn|0));O?(We=w(0),r=w(0)):si=101}else si=101;e:do if((si|0)==101)switch(si=0,ud|0){case 1:{O=0,We=w(ve*w(.5)),r=w(0);break e}case 2:{O=0,We=ve,r=w(0);break e}case 3:{if(s>>>0<=1){O=0,We=w(0),r=w(0);break e}r=w((s+-1|0)>>>0),O=0,We=w(0),r=w(w(Eu(ve,w(0)))/r);break e}case 5:{r=w(ve/w((s+1|0)>>>0)),O=0,We=r;break e}case 4:{r=w(ve/w(s>>>0)),O=0,We=w(r*w(.5));break e}default:{O=0,We=w(0),r=w(0);break e}}while(0);if(n=w(od+We),Qt){Qe=w(ve/w(O|0)),K=t[os>>2]|0,P=kr,ve=w(0);do{O=t[K+(P<<2)>>2]|0;e:do if((t[O+36>>2]|0)!=1){switch(t[O+24>>2]|0){case 1:{if(se(O,Tr)|0){if(!S)break e;hn=w(re(O,Tr,On)),hn=w(hn+w(R0(e,Tr))),hn=w(hn+w(Li(O,Tr,gr))),C[O+400+(t[kc>>2]<<2)>>2]=hn;break e}break}case 0:if(u0=(t[(m0(O,Tr)|0)+4>>2]|0)==3,hn=w(Qe+n),n=u0?hn:n,S&&(u0=O+400+(t[kc>>2]<<2)|0,C[u0>>2]=w(n+w(C[u0>>2]))),u0=(t[(y0(O,Tr)|0)+4>>2]|0)==3,hn=w(Qe+n),n=u0?hn:n,Xs){hn=w(r+w(Yt(O,Tr,gr))),ve=lu,n=w(n+w(hn+w(C[O+504>>2])));break e}else{n=w(n+w(r+w(Le(O,Tr,gr)))),ve=w(Eu(ve,w(Le(O,Fn,gr))));break e}default:}S&&(hn=w(We+w(R0(e,Tr))),u0=O+400+(t[kc>>2]<<2)|0,C[u0>>2]=w(hn+w(C[u0>>2])))}while(0);P=P+1|0}while((P|0)!=(Nn|0))}else ve=w(0);if(r=w(ld+n),td?We=w(w(Wn(e,Fn,w(Ul+ve),Vf,h))-Ul):We=lu,Qe=w(w(Wn(e,Fn,w(Ul+(id?lu:ve)),Vf,h))-Ul),Qt&S){P=kr;do{K=t[(t[os>>2]|0)+(P<<2)>>2]|0;do if((t[K+36>>2]|0)!=1){if((t[K+24>>2]|0)==1){if(se(K,Fn)|0){if(hn=w(re(K,Fn,lu)),hn=w(hn+w(R0(e,Fn))),hn=w(hn+w(Li(K,Fn,gr))),O=t[Oc>>2]|0,C[K+400+(O<<2)>>2]=hn,!(Me(hn)|0))break}else O=t[Oc>>2]|0;hn=w(R0(e,Fn)),C[K+400+(O<<2)>>2]=w(hn+w(Li(K,Fn,gr)));break}O=Xu(e,K)|0;do if((O|0)==4){if((t[(m0(K,Fn)|0)+4>>2]|0)==3){si=139;break}if((t[(y0(K,Fn)|0)+4>>2]|0)==3){si=139;break}if(Bu(K,Fn,lu)|0){n=Ee;break}H1=t[K+908+(t[Za>>2]<<2)>>2]|0,t[Il>>2]=H1,n=w(C[K+396>>2]),u0=Me(n)|0,ve=(t[W>>2]=H1,w(C[W>>2])),u0?n=Qe:(hr=w(Yt(K,Fn,gr)),hn=w(ve/n),n=w(n*ve),n=w(hr+(Mu?hn:n))),C[Aa>>2]=n,C[Il>>2]=w(w(Yt(K,Tr,gr))+ve),t[As>>2]=1,t[ef>>2]=1,kn(K,Tr,On,gr,As,Il),kn(K,Fn,lu,gr,ef,Aa),n=w(C[Il>>2]),hr=w(C[Aa>>2]),hn=Mu?n:hr,n=Mu?hr:n,u0=((Me(hn)|0)^1)&1,Gt(K,hn,n,ml,u0,((Me(n)|0)^1)&1,gr,is,1,3493,M)|0,n=Ee}else si=139;while(0);e:do if((si|0)==139){si=0,n=w(We-w(Le(K,Fn,gr)));do if((t[(m0(K,Fn)|0)+4>>2]|0)==3){if((t[(y0(K,Fn)|0)+4>>2]|0)!=3)break;n=w(Ee+w(Eu(w(0),w(n*w(.5)))));break e}while(0);if((t[(y0(K,Fn)|0)+4>>2]|0)==3){n=Ee;break}if((t[(m0(K,Fn)|0)+4>>2]|0)==3){n=w(Ee+w(Eu(w(0),n)));break}switch(O|0){case 1:{n=Ee;break e}case 2:{n=w(Ee+w(n*w(.5)));break e}default:{n=w(Ee+n);break e}}}while(0);hn=w(vl+n),u0=K+400+(t[Oc>>2]<<2)|0,C[u0>>2]=w(hn+w(C[u0>>2]))}while(0);P=P+1|0}while((P|0)!=(Nn|0))}if(vl=w(vl+Qe),qf=w(Eu(qf,r)),s=rs+1|0,Nn>>>0>=jl>>>0)break;n=On,kr=Nn,rs=s}do if(S){if(O=s>>>0>1,O?0:!(Ae(e)|0))break;if(!(Me(lu)|0)){n=w(lu-vl);e:do switch(t[e+12>>2]|0){case 3:{Ee=w(Ee+n),Re=w(0);break}case 2:{Ee=w(Ee+w(n*w(.5))),Re=w(0);break}case 4:{lu>vl?Re=w(n/w(s>>>0)):Re=w(0);break}case 7:if(lu>vl){Ee=w(Ee+w(n/w(s<<1>>>0))),Re=w(n/w(s>>>0)),Re=O?Re:w(0);break e}else{Ee=w(Ee+w(n*w(.5))),Re=w(0);break e}case 6:{Re=w(n/w(rs>>>0)),Re=lu>vl&O?Re:w(0);break}default:Re=w(0)}while(0);if(s|0)for(Qt=1040+(Fn<<2)|0,Lr=976+(Fn<<2)|0,Pe=0,P=0;;){e:do if(P>>>0>>0)for(ve=w(0),Qe=w(0),n=w(0),K=P;;){O=t[(t[os>>2]|0)+(K<<2)>>2]|0;do if((t[O+36>>2]|0)!=1?(t[O+24>>2]|0)==0:0){if((t[O+940>>2]|0)!=(Pe|0))break e;if(ot(O,Fn)|0&&(hn=w(C[O+908+(t[Lr>>2]<<2)>>2]),n=w(Eu(n,w(hn+w(Yt(O,Fn,gr)))))),(Xu(e,O)|0)!=5)break;Bl=w(vt(O)),Bl=w(Bl+w(Li(O,0,gr))),hn=w(C[O+912>>2]),hn=w(w(hn+w(Yt(O,0,gr)))-Bl),Bl=w(Eu(Qe,Bl)),hn=w(Eu(ve,hn)),ve=hn,Qe=Bl,n=w(Eu(n,w(Bl+hn)))}while(0);if(O=K+1|0,O>>>0>>0)K=O;else{K=O;break}}else Qe=w(0),n=w(0),K=P;while(0);if(st=w(Re+n),r=Ee,Ee=w(Ee+st),P>>>0>>0){We=w(r+Qe),O=P;do{P=t[(t[os>>2]|0)+(O<<2)>>2]|0;e:do if((t[P+36>>2]|0)!=1?(t[P+24>>2]|0)==0:0)switch(Xu(e,P)|0){case 1:{hn=w(r+w(Li(P,Fn,gr))),C[P+400+(t[Qt>>2]<<2)>>2]=hn;break e}case 3:{hn=w(w(Ee-w(A0(P,Fn,gr)))-w(C[P+908+(t[Lr>>2]<<2)>>2])),C[P+400+(t[Qt>>2]<<2)>>2]=hn;break e}case 2:{hn=w(r+w(w(st-w(C[P+908+(t[Lr>>2]<<2)>>2]))*w(.5))),C[P+400+(t[Qt>>2]<<2)>>2]=hn;break e}case 4:{if(hn=w(r+w(Li(P,Fn,gr))),C[P+400+(t[Qt>>2]<<2)>>2]=hn,Bu(P,Fn,lu)|0||(Mu?(ve=w(C[P+908>>2]),n=w(ve+w(Yt(P,Tr,gr))),Qe=st):(Qe=w(C[P+912>>2]),Qe=w(Qe+w(Yt(P,Fn,gr))),n=st,ve=w(C[P+908>>2])),gi(n,ve)|0?gi(Qe,w(C[P+912>>2]))|0:0))break e;Gt(P,n,Qe,ml,1,1,gr,is,1,3501,M)|0;break e}case 5:{C[P+404>>2]=w(w(We-w(vt(P)))+w(re(P,0,lu)));break e}default:break e}while(0);O=O+1|0}while((O|0)!=(K|0))}if(Pe=Pe+1|0,(Pe|0)==(s|0))break;P=K}}}while(0);if(C[e+908>>2]=w(Wn(e,2,Hf,h,h)),C[e+912>>2]=w(Wn(e,0,I1,D,h)),((tf|0)!=0?(B1=t[e+32>>2]|0,U1=(tf|0)==2,!(U1&(B1|0)!=2)):0)?U1&(B1|0)==2&&(n=w(Wf+On),n=w(Eu(w(Yp(n,w(Xt(e,Tr,qf,us)))),Wf)),si=198):(n=w(Wn(e,Tr,qf,us,h)),si=198),(si|0)==198&&(C[e+908+(t[976+(Tr<<2)>>2]<<2)>>2]=n),((nf|0)!=0?(z1=t[e+32>>2]|0,q1=(nf|0)==2,!(q1&(z1|0)!=2)):0)?q1&(z1|0)==2&&(n=w(Ul+lu),n=w(Eu(w(Yp(n,w(Xt(e,Fn,w(Ul+vl),Vf)))),Ul)),si=204):(n=w(Wn(e,Fn,w(Ul+vl),Vf,h)),si=204),(si|0)==204&&(C[e+908+(t[976+(Fn<<2)>>2]<<2)>>2]=n),S){if((t[j1>>2]|0)==2){P=976+(Fn<<2)|0,K=1040+(Fn<<2)|0,O=0;do Pe=yi(e,O)|0,t[Pe+24>>2]|0||(H1=t[P>>2]|0,hn=w(C[e+908+(H1<<2)>>2]),u0=Pe+400+(t[K>>2]<<2)|0,hn=w(hn-w(C[u0>>2])),C[u0>>2]=w(hn-w(C[Pe+908+(H1<<2)>>2]))),O=O+1|0;while((O|0)!=(jl|0))}if(u|0){O=Mu?tf:l;do xn(e,u,gr,O,is,ml,M),u=t[u+960>>2]|0;while((u|0)!=0)}if(O=(Tr|2|0)==3,P=(Fn|2|0)==3,O|P){u=0;do K=t[(t[os>>2]|0)+(u<<2)>>2]|0,(t[K+36>>2]|0)!=1&&(O&&_n(e,K,Tr),P&&_n(e,K,Fn)),u=u+1|0;while((u|0)!=(jl|0))}}}while(0);m=rf}function Gu(e,n){e=e|0,n=w(n);var r=0;Dn(e,n>=w(0),3147),r=n==w(0),C[e+4>>2]=r?w(0):n}function Kr(e,n,r,u){e=e|0,n=w(n),r=w(r),u=u|0;var l=St,s=St,h=0,D=0,S=0;t[2278]=(t[2278]|0)+1,Vr(e),Bu(e,2,n)|0?(l=w(Sn(t[e+992>>2]|0,n)),S=1,l=w(l+w(Yt(e,2,n)))):(l=w(Sn(e+380|0,n)),l>=w(0)?S=2:(S=((Me(n)|0)^1)&1,l=n)),Bu(e,0,r)|0?(s=w(Sn(t[e+996>>2]|0,r)),D=1,s=w(s+w(Yt(e,0,n)))):(s=w(Sn(e+388|0,r)),s>=w(0)?D=2:(D=((Me(r)|0)^1)&1,s=r)),h=e+976|0,(Gt(e,l,s,u,S,D,n,r,1,3189,t[h>>2]|0)|0?(C0(e,t[e+496>>2]|0,n,r,n),Au(e,w(C[(t[h>>2]|0)+4>>2]),w(0),w(0)),p[11696]|0):0)&&ff(e,7)}function Vr(e){e=e|0;var n=0,r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;D=m,m=m+32|0,h=D+24|0,s=D+16|0,u=D+8|0,l=D,r=0;do n=e+380+(r<<3)|0,((t[e+380+(r<<3)+4>>2]|0)!=0?(S=n,M=t[S+4>>2]|0,O=u,t[O>>2]=t[S>>2],t[O+4>>2]=M,O=e+364+(r<<3)|0,M=t[O+4>>2]|0,S=l,t[S>>2]=t[O>>2],t[S+4>>2]=M,t[s>>2]=t[u>>2],t[s+4>>2]=t[u+4>>2],t[h>>2]=t[l>>2],t[h+4>>2]=t[l+4>>2],Oi(s,h)|0):0)||(n=e+348+(r<<3)|0),t[e+992+(r<<2)>>2]=n,r=r+1|0;while((r|0)!=2);m=D}function Bu(e,n,r){e=e|0,n=n|0,r=w(r);var u=0;switch(e=t[e+992+(t[976+(n<<2)>>2]<<2)>>2]|0,t[e+4>>2]|0){case 0:case 3:{e=0;break}case 1:{w(C[e>>2])>2])>2]|0){case 2:{n=w(w(w(C[e>>2])*n)/w(100));break}case 1:{n=w(C[e>>2]);break}default:n=w(le)}return w(n)}function C0(e,n,r,u,l){e=e|0,n=n|0,r=w(r),u=w(u),l=w(l);var s=0,h=St;n=t[e+944>>2]|0?n:1,s=I0(t[e+4>>2]|0,n)|0,n=df(s,n)|0,r=w(Sr(e,s,r)),u=w(Sr(e,n,u)),h=w(r+w(Li(e,s,l))),C[e+400+(t[1040+(s<<2)>>2]<<2)>>2]=h,r=w(r+w(A0(e,s,l))),C[e+400+(t[1e3+(s<<2)>>2]<<2)>>2]=r,r=w(u+w(Li(e,n,l))),C[e+400+(t[1040+(n<<2)>>2]<<2)>>2]=r,l=w(u+w(A0(e,n,l))),C[e+400+(t[1e3+(n<<2)>>2]<<2)>>2]=l}function Au(e,n,r,u){e=e|0,n=w(n),r=w(r),u=w(u);var l=0,s=0,h=St,D=St,S=0,M=0,O=St,P=0,K=St,Pe=St,Ee=St,ve=St;if(n!=w(0)&&(l=e+400|0,ve=w(C[l>>2]),s=e+404|0,Ee=w(C[s>>2]),P=e+416|0,Pe=w(C[P>>2]),M=e+420|0,h=w(C[M>>2]),K=w(ve+r),O=w(Ee+u),u=w(K+Pe),D=w(O+h),S=(t[e+988>>2]|0)==1,C[l>>2]=w(J0(ve,n,0,S)),C[s>>2]=w(J0(Ee,n,0,S)),r=w(YE(w(Pe*n),w(1))),gi(r,w(0))|0?s=0:s=(gi(r,w(1))|0)^1,r=w(YE(w(h*n),w(1))),gi(r,w(0))|0?l=0:l=(gi(r,w(1))|0)^1,ve=w(J0(u,n,S&s,S&(s^1))),C[P>>2]=w(ve-w(J0(K,n,0,S))),ve=w(J0(D,n,S&l,S&(l^1))),C[M>>2]=w(ve-w(J0(O,n,0,S))),s=(t[e+952>>2]|0)-(t[e+948>>2]|0)>>2,s|0)){l=0;do Au(yi(e,l)|0,n,K,O),l=l+1|0;while((l|0)!=(s|0))}}function ei(e,n,r,u,l){switch(e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,r|0){case 5:case 0:{e=F8(t[489]|0,u,l)|0;break}default:e=QI(u,l)|0}return e|0}function _l(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;l=m,m=m+16|0,s=l,t[s>>2]=u,Ps(e,0,n,r,s),m=l}function Ps(e,n,r,u,l){if(e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,e=e|0?e:956,tS[t[e+8>>2]&1](e,n,r,u,l)|0,(r|0)==5)Xn();else return}function Uu(e,n,r){e=e|0,n=n|0,r=r|0,p[e+n>>0]=r&1}function na(e,n){e=e|0,n=n|0;var r=0,u=0;t[e>>2]=0,t[e+4>>2]=0,t[e+8>>2]=0,r=n+4|0,u=(t[r>>2]|0)-(t[n>>2]|0)>>2,u|0&&(zi(e,u),Is(e,t[n>>2]|0,t[r>>2]|0,u))}function zi(e,n){e=e|0,n=n|0;var r=0;if((x0(e)|0)>>>0>>0&&li(e),n>>>0>1073741823)Xn();else{r=cn(n<<2)|0,t[e+4>>2]=r,t[e>>2]=r,t[e+8>>2]=r+(n<<2);return}}function Is(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,u=e+4|0,e=r-n|0,(e|0)>0&&(pr(t[u>>2]|0,n|0,e|0)|0,t[u>>2]=(t[u>>2]|0)+(e>>>2<<2))}function x0(e){return e=e|0,1073741823}function Li(e,n,r){return e=e|0,n=n|0,r=w(r),(Fi(n)|0?(t[e+96>>2]|0)!=0:0)?e=e+92|0:e=dt(e+60|0,t[1040+(n<<2)>>2]|0,992)|0,w($o(e,r))}function A0(e,n,r){return e=e|0,n=n|0,r=w(r),(Fi(n)|0?(t[e+104>>2]|0)!=0:0)?e=e+100|0:e=dt(e+60|0,t[1e3+(n<<2)>>2]|0,992)|0,w($o(e,r))}function Fi(e){return e=e|0,(e|1|0)==3|0}function $o(e,n){return e=e|0,n=w(n),(t[e+4>>2]|0)==3?n=w(0):n=w(Sn(e,n)),w(n)}function El(e,n){return e=e|0,n=n|0,e=t[e>>2]|0,((e|0)==0?(n|0)>1?n:1:e)|0}function I0(e,n){e=e|0,n=n|0;var r=0;e:do if((n|0)==2){switch(e|0){case 2:{e=3;break e}case 3:break;default:{r=4;break e}}e=2}else r=4;while(0);return e|0}function R0(e,n){e=e|0,n=n|0;var r=St;return((Fi(n)|0?(t[e+312>>2]|0)!=0:0)?(r=w(C[e+308>>2]),r>=w(0)):0)||(r=w(Eu(w(C[(dt(e+276|0,t[1040+(n<<2)>>2]|0,992)|0)>>2]),w(0)))),w(r)}function co(e,n){e=e|0,n=n|0;var r=St;return((Fi(n)|0?(t[e+320>>2]|0)!=0:0)?(r=w(C[e+316>>2]),r>=w(0)):0)||(r=w(Eu(w(C[(dt(e+276|0,t[1e3+(n<<2)>>2]|0,992)|0)>>2]),w(0)))),w(r)}function Ru(e,n,r){e=e|0,n=n|0,r=w(r);var u=St;return((Fi(n)|0?(t[e+240>>2]|0)!=0:0)?(u=w(Sn(e+236|0,r)),u>=w(0)):0)||(u=w(Eu(w(Sn(dt(e+204|0,t[1040+(n<<2)>>2]|0,992)|0,r)),w(0)))),w(u)}function Yu(e,n,r){e=e|0,n=n|0,r=w(r);var u=St;return((Fi(n)|0?(t[e+248>>2]|0)!=0:0)?(u=w(Sn(e+244|0,r)),u>=w(0)):0)||(u=w(Eu(w(Sn(dt(e+204|0,t[1e3+(n<<2)>>2]|0,992)|0,r)),w(0)))),w(u)}function Xl(e,n,r,u,l,s,h){e=e|0,n=w(n),r=w(r),u=u|0,l=l|0,s=w(s),h=w(h);var D=St,S=St,M=St,O=St,P=St,K=St,Pe=0,Ee=0,ve=0;ve=m,m=m+16|0,Pe=ve,Ee=e+964|0,Iu(e,(t[Ee>>2]|0)!=0,3519),D=w(wr(e,2,n)),S=w(wr(e,0,n)),M=w(Yt(e,2,n)),O=w(Yt(e,0,n)),Me(n)|0?P=n:P=w(Eu(w(0),w(w(n-M)-D))),Me(r)|0?K=r:K=w(Eu(w(0),w(w(r-O)-S))),(u|0)==1&(l|0)==1?(C[e+908>>2]=w(Wn(e,2,w(n-M),s,s)),n=w(Wn(e,0,w(r-O),h,s))):(nS[t[Ee>>2]&1](Pe,e,P,u,K,l),P=w(D+w(C[Pe>>2])),K=w(n-M),C[e+908>>2]=w(Wn(e,2,(u|2|0)==2?P:K,s,s)),K=w(S+w(C[Pe+4>>2])),n=w(r-O),n=w(Wn(e,0,(l|2|0)==2?K:n,h,s))),C[e+912>>2]=n,m=ve}function hs(e,n,r,u,l,s,h){e=e|0,n=w(n),r=w(r),u=u|0,l=l|0,s=w(s),h=w(h);var D=St,S=St,M=St,O=St;M=w(wr(e,2,s)),D=w(wr(e,0,s)),O=w(Yt(e,2,s)),S=w(Yt(e,0,s)),n=w(n-O),C[e+908>>2]=w(Wn(e,2,(u|2|0)==2?M:n,s,s)),r=w(r-S),C[e+912>>2]=w(Wn(e,0,(l|2|0)==2?D:r,h,s))}function ra(e,n,r,u,l,s,h){e=e|0,n=w(n),r=w(r),u=u|0,l=l|0,s=w(s),h=w(h);var D=0,S=St,M=St;return D=(u|0)==2,((n<=w(0)&D?0:!(r<=w(0)&(l|0)==2))?!((u|0)==1&(l|0)==1):0)?e=0:(S=w(Yt(e,0,s)),M=w(Yt(e,2,s)),D=n>2]=w(Wn(e,2,D?w(0):n,s,s)),n=w(r-S),D=r>2]=w(Wn(e,0,D?w(0):n,h,s)),e=1),e|0}function df(e,n){return e=e|0,n=n|0,yn(e)|0?e=I0(2,n)|0:e=0,e|0}function Ku(e,n,r){return e=e|0,n=n|0,r=w(r),r=w(Ru(e,n,r)),w(r+w(R0(e,n)))}function vs(e,n,r){return e=e|0,n=n|0,r=w(r),r=w(Yu(e,n,r)),w(r+w(co(e,n)))}function wr(e,n,r){e=e|0,n=n|0,r=w(r);var u=St;return u=w(Ku(e,n,r)),w(u+w(vs(e,n,r)))}function $0(e){return e=e|0,t[e+24>>2]|0?e=0:w(Xi(e))!=w(0)?e=1:e=w(ru(e))!=w(0),e|0}function Xi(e){e=e|0;var n=St;if(t[e+944>>2]|0){if(n=w(C[e+44>>2]),Me(n)|0)return n=w(C[e+40>>2]),e=n>w(0)&((Me(n)|0)^1),w(e?n:w(0))}else n=w(0);return w(n)}function ru(e){e=e|0;var n=St,r=0,u=St;do if(t[e+944>>2]|0){if(n=w(C[e+48>>2]),Me(n)|0){if(r=p[(t[e+976>>2]|0)+2>>0]|0,r<<24>>24==0?(u=w(C[e+40>>2]),u>24?w(1):w(0)}}else n=w(0);while(0);return w(n)}function Ci(e){e=e|0;var n=0,r=0;if(Iv(e+400|0,0,540)|0,p[e+985>>0]=1,cs(e),r=mu(e)|0,r|0){n=e+948|0,e=0;do Ci(t[(t[n>>2]|0)+(e<<2)>>2]|0),e=e+1|0;while((e|0)!=(r|0))}}function Xr(e,n,r,u,l,s,h,D,S,M){e=e|0,n=n|0,r=w(r),u=u|0,l=w(l),s=w(s),h=w(h),D=D|0,S=S|0,M=M|0;var O=0,P=St,K=0,Pe=0,Ee=St,ve=St,Qe=0,We=St,st=0,Re=St,Fe=0,Qt=0,Lr=0,Nn=0,mn=0,hr=0,kr=0,On=0,Zi=0,ts=0;Zi=m,m=m+16|0,Lr=Zi+12|0,Nn=Zi+8|0,mn=Zi+4|0,hr=Zi,On=I0(t[e+4>>2]|0,S)|0,Fe=Fi(On)|0,P=w(Sn(En(n)|0,Fe?s:h)),Qt=Bu(n,2,s)|0,kr=Bu(n,0,h)|0;do if(Me(P)|0?0:!(Me(Fe?r:l)|0)){if(O=n+504|0,!(Me(w(C[O>>2]))|0)&&(!(er(t[n+976>>2]|0,0)|0)||(t[n+500>>2]|0)==(t[2278]|0)))break;C[O>>2]=w(Eu(P,w(wr(n,On,s))))}else K=7;while(0);do if((K|0)==7){if(st=Fe^1,!(st|Qt^1)){h=w(Sn(t[n+992>>2]|0,s)),C[n+504>>2]=w(Eu(h,w(wr(n,2,s))));break}if(!(Fe|kr^1)){h=w(Sn(t[n+996>>2]|0,h)),C[n+504>>2]=w(Eu(h,w(wr(n,0,s))));break}C[Lr>>2]=w(le),C[Nn>>2]=w(le),t[mn>>2]=0,t[hr>>2]=0,We=w(Yt(n,2,s)),Re=w(Yt(n,0,s)),Qt?(Ee=w(We+w(Sn(t[n+992>>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|0)==0?e+16|0:n)>>2]|0,((n|0)==5?yn(t[e+4>>2]|0)|0:0)&&(n=1),n|0}function m0(e,n){return e=e|0,n=n|0,(Fi(n)|0?(t[e+96>>2]|0)!=0:0)?n=4:n=t[1040+(n<<2)>>2]|0,e+60+(n<<3)|0}function y0(e,n){return e=e|0,n=n|0,(Fi(n)|0?(t[e+104>>2]|0)!=0:0)?n=5:n=t[1e3+(n<<2)>>2]|0,e+60+(n<<3)|0}function kn(e,n,r,u,l,s){switch(e=e|0,n=n|0,r=w(r),u=w(u),l=l|0,s=s|0,r=w(Sn(e+380+(t[976+(n<<2)>>2]<<3)|0,r)),r=w(r+w(Yt(e,n,u))),t[l>>2]|0){case 2:case 1:{l=Me(r)|0,u=w(C[s>>2]),C[s>>2]=l|u>2]=2,C[s>>2]=r);break}default:}}function se(e,n){return e=e|0,n=n|0,e=e+132|0,(Fi(n)|0?(t[(dt(e,4,948)|0)+4>>2]|0)!=0:0)?e=1:e=(t[(dt(e,t[1040+(n<<2)>>2]|0,948)|0)+4>>2]|0)!=0,e|0}function re(e,n,r){e=e|0,n=n|0,r=w(r);var u=0,l=0;return e=e+132|0,(Fi(n)|0?(u=dt(e,4,948)|0,(t[u+4>>2]|0)!=0):0)?l=4:(u=dt(e,t[1040+(n<<2)>>2]|0,948)|0,t[u+4>>2]|0?l=4:r=w(0)),(l|0)==4&&(r=w(Sn(u,r))),w(r)}function Le(e,n,r){e=e|0,n=n|0,r=w(r);var u=St;return u=w(C[e+908+(t[976+(n<<2)>>2]<<2)>>2]),u=w(u+w(Li(e,n,r))),w(u+w(A0(e,n,r)))}function Ae(e){e=e|0;var n=0,r=0,u=0;e:do if(yn(t[e+4>>2]|0)|0)n=0;else if((t[e+16>>2]|0)!=5)if(r=mu(e)|0,!r)n=0;else for(n=0;;){if(u=yi(e,n)|0,(t[u+24>>2]|0)==0?(t[u+20>>2]|0)==5:0){n=1;break e}if(n=n+1|0,n>>>0>=r>>>0){n=0;break}}else n=1;while(0);return n|0}function ot(e,n){e=e|0,n=n|0;var r=St;return r=w(C[e+908+(t[976+(n<<2)>>2]<<2)>>2]),r>=w(0)&((Me(r)|0)^1)|0}function vt(e){e=e|0;var n=St,r=0,u=0,l=0,s=0,h=0,D=0,S=St;if(r=t[e+968>>2]|0,r)S=w(C[e+908>>2]),n=w(C[e+912>>2]),n=w(J8[r&0](e,S,n)),Iu(e,(Me(n)|0)^1,3573);else{s=mu(e)|0;do if(s|0){for(r=0,l=0;;){if(u=yi(e,l)|0,t[u+940>>2]|0){h=8;break}if((t[u+24>>2]|0)!=1)if(D=(Xu(e,u)|0)==5,D){r=u;break}else r=(r|0)==0?u:r;if(l=l+1|0,l>>>0>=s>>>0){h=8;break}}if((h|0)==8&&!r)break;return n=w(vt(r)),w(n+w(C[r+404>>2]))}while(0);n=w(C[e+912>>2])}return w(n)}function Xt(e,n,r,u){e=e|0,n=n|0,r=w(r),u=w(u);var l=St,s=0;return yn(n)|0?(n=1,s=3):Fi(n)|0?(n=0,s=3):(u=w(le),l=w(le)),(s|0)==3&&(l=w(Sn(e+364+(n<<3)|0,u)),u=w(Sn(e+380+(n<<3)|0,u))),s=u=w(0)&((Me(u)|0)^1)),r=s?u:r,s=l>=w(0)&((Me(l)|0)^1)&r>2]|0,s)|0,Ee=df(Qe,s)|0,ve=Fi(Qe)|0,P=w(Yt(n,2,r)),K=w(Yt(n,0,r)),Bu(n,2,r)|0?D=w(P+w(Sn(t[n+992>>2]|0,r))):(se(n,2)|0?It(n,2)|0:0)?(D=w(C[e+908>>2]),S=w(R0(e,2)),S=w(D-w(S+w(co(e,2)))),D=w(re(n,2,r)),D=w(Wn(n,2,w(S-w(D+w(xi(n,2,r)))),r,r))):D=w(le),Bu(n,0,l)|0?S=w(K+w(Sn(t[n+996>>2]|0,l))):(se(n,0)|0?It(n,0)|0:0)?(S=w(C[e+912>>2]),st=w(R0(e,0)),st=w(S-w(st+w(co(e,0)))),S=w(re(n,0,l)),S=w(Wn(n,0,w(st-w(S+w(xi(n,0,l)))),l,r))):S=w(le),M=Me(D)|0,O=Me(S)|0;do if(M^O?(Pe=w(C[n+396>>2]),!(Me(Pe)|0)):0)if(M){D=w(P+w(w(S-K)*Pe));break}else{st=w(K+w(w(D-P)/Pe)),S=O?st:S;break}while(0);O=Me(D)|0,M=Me(S)|0,O|M&&(Re=(O^1)&1,u=r>w(0)&((u|0)!=0&O),D=ve?D:u?r:D,Gt(n,D,S,s,ve?Re:u?2:Re,O&(M^1)&1,D,S,0,3623,h)|0,D=w(C[n+908>>2]),D=w(D+w(Yt(n,2,r))),S=w(C[n+912>>2]),S=w(S+w(Yt(n,0,r)))),Gt(n,D,S,s,1,1,D,S,1,3635,h)|0,(It(n,Qe)|0?!(se(n,Qe)|0):0)?(Re=t[976+(Qe<<2)>>2]|0,st=w(C[e+908+(Re<<2)>>2]),st=w(st-w(C[n+908+(Re<<2)>>2])),st=w(st-w(co(e,Qe))),st=w(st-w(A0(n,Qe,r))),st=w(st-w(xi(n,Qe,ve?r:l))),C[n+400+(t[1040+(Qe<<2)>>2]<<2)>>2]=st):We=21;do if((We|0)==21){if(se(n,Qe)|0?0:(t[e+8>>2]|0)==1){Re=t[976+(Qe<<2)>>2]|0,st=w(C[e+908+(Re<<2)>>2]),st=w(w(st-w(C[n+908+(Re<<2)>>2]))*w(.5)),C[n+400+(t[1040+(Qe<<2)>>2]<<2)>>2]=st;break}(se(n,Qe)|0?0:(t[e+8>>2]|0)==2)&&(Re=t[976+(Qe<<2)>>2]|0,st=w(C[e+908+(Re<<2)>>2]),st=w(st-w(C[n+908+(Re<<2)>>2])),C[n+400+(t[1040+(Qe<<2)>>2]<<2)>>2]=st)}while(0);(It(n,Ee)|0?!(se(n,Ee)|0):0)?(Re=t[976+(Ee<<2)>>2]|0,st=w(C[e+908+(Re<<2)>>2]),st=w(st-w(C[n+908+(Re<<2)>>2])),st=w(st-w(co(e,Ee))),st=w(st-w(A0(n,Ee,r))),st=w(st-w(xi(n,Ee,ve?l:r))),C[n+400+(t[1040+(Ee<<2)>>2]<<2)>>2]=st):We=30;do if((We|0)==30?!(se(n,Ee)|0):0){if((Xu(e,n)|0)==2){Re=t[976+(Ee<<2)>>2]|0,st=w(C[e+908+(Re<<2)>>2]),st=w(w(st-w(C[n+908+(Re<<2)>>2]))*w(.5)),C[n+400+(t[1040+(Ee<<2)>>2]<<2)>>2]=st;break}Re=(Xu(e,n)|0)==3,Re^(t[e+28>>2]|0)==2&&(Re=t[976+(Ee<<2)>>2]|0,st=w(C[e+908+(Re<<2)>>2]),st=w(st-w(C[n+908+(Re<<2)>>2])),C[n+400+(t[1040+(Ee<<2)>>2]<<2)>>2]=st)}while(0)}function _n(e,n,r){e=e|0,n=n|0,r=r|0;var u=St,l=0;l=t[976+(r<<2)>>2]|0,u=w(C[n+908+(l<<2)>>2]),u=w(w(C[e+908+(l<<2)>>2])-u),u=w(u-w(C[n+400+(t[1040+(r<<2)>>2]<<2)>>2])),C[n+400+(t[1e3+(r<<2)>>2]<<2)>>2]=u}function yn(e){return e=e|0,(e|1|0)==1|0}function En(e){e=e|0;var n=St;switch(t[e+56>>2]|0){case 0:case 3:{n=w(C[e+40>>2]),n>w(0)&((Me(n)|0)^1)?e=p[(t[e+976>>2]|0)+2>>0]|0?1056:992:e=1056;break}default:e=e+52|0}return e|0}function er(e,n){return e=e|0,n=n|0,(p[e+n>>0]|0)!=0|0}function It(e,n){return e=e|0,n=n|0,e=e+132|0,(Fi(n)|0?(t[(dt(e,5,948)|0)+4>>2]|0)!=0:0)?e=1:e=(t[(dt(e,t[1e3+(n<<2)>>2]|0,948)|0)+4>>2]|0)!=0,e|0}function xi(e,n,r){e=e|0,n=n|0,r=w(r);var u=0,l=0;return e=e+132|0,(Fi(n)|0?(u=dt(e,5,948)|0,(t[u+4>>2]|0)!=0):0)?l=4:(u=dt(e,t[1e3+(n<<2)>>2]|0,948)|0,t[u+4>>2]|0?l=4:r=w(0)),(l|0)==4&&(r=w(Sn(u,r))),w(r)}function Sr(e,n,r){return e=e|0,n=n|0,r=w(r),se(e,n)|0?r=w(re(e,n,r)):r=w(-w(xi(e,n,r))),w(r)}function cr(e){return e=w(e),C[W>>2]=e,t[W>>2]|0|0}function Y(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>1073741823)Xn();else{l=cn(n<<2)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<2)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<2)}function Qr(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>2)<<2)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Jr(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-4-n|0)>>>2)<<2)),e=t[e>>2]|0,e|0&&yt(e)}function Ur(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0;if(h=e+4|0,D=t[h>>2]|0,l=D-u|0,s=l>>2,e=n+(s<<2)|0,e>>>0>>0){u=D;do t[u>>2]=t[e>>2],e=e+4|0,u=(t[h>>2]|0)+4|0,t[h>>2]=u;while(e>>>0>>0)}s|0&&Iy(D+(0-s<<2)|0,n|0,l|0)|0}function lt(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0;return D=n+4|0,S=t[D>>2]|0,l=t[e>>2]|0,h=r,s=h-l|0,u=S+(0-(s>>2)<<2)|0,t[D>>2]=u,(s|0)>0&&pr(u|0,l|0,s|0)|0,l=e+4|0,s=n+8|0,u=(t[l>>2]|0)-h|0,(u|0)>0&&(pr(t[s>>2]|0,r|0,u|0)|0,t[s>>2]=(t[s>>2]|0)+(u>>>2<<2)),h=t[e>>2]|0,t[e>>2]=t[D>>2],t[D>>2]=h,h=t[l>>2]|0,t[l>>2]=t[s>>2],t[s>>2]=h,h=e+8|0,r=n+12|0,e=t[h>>2]|0,t[h>>2]=t[r>>2],t[r>>2]=e,t[n>>2]=t[D>>2],S|0}function hi(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;if(h=t[n>>2]|0,s=t[r>>2]|0,(h|0)!=(s|0)){l=e+8|0,r=((s+-4-h|0)>>>2)+1|0,e=h,u=t[l>>2]|0;do t[u>>2]=t[e>>2],u=(t[l>>2]|0)+4|0,t[l>>2]=u,e=e+4|0;while((e|0)!=(s|0));t[n>>2]=h+(r<<2)}}function Qi(){_e()}function g0(){var e=0;return e=cn(4)|0,bn(e),e|0}function bn(e){e=e|0,t[e>>2]=p0()|0}function Qu(e){e=e|0,e|0&&(eo(e),yt(e))}function eo(e){e=e|0,K0(t[e>>2]|0)}function po(e,n,r){e=e|0,n=n|0,r=r|0,Uu(t[e>>2]|0,n,r)}function Ju(e,n){e=e|0,n=w(n),Gu(t[e>>2]|0,n)}function bo(e,n){return e=e|0,n=n|0,er(t[e>>2]|0,n)|0}function to(){var e=0;return e=cn(8)|0,Na(e,0),e|0}function Na(e,n){e=e|0,n=n|0,n?n=Hn(t[n>>2]|0)|0:n=or()|0,t[e>>2]=n,t[e+4>>2]=0,Ma(n,e)}function pf(e){e=e|0;var n=0;return n=cn(8)|0,Na(n,e),n|0}function uc(e){e=e|0,e|0&&(ms(e),yt(e))}function ms(e){e=e|0;var n=0;bu(t[e>>2]|0),n=e+4|0,e=t[n>>2]|0,t[n>>2]=0,e|0&&(ia(e),yt(e))}function ia(e){e=e|0,B0(e)}function B0(e){e=e|0,e=t[e>>2]|0,e|0&&Ir(e|0)}function oc(e){return e=e|0,Ls(e)|0}function La(e){e=e|0;var n=0,r=0;r=e+4|0,n=t[r>>2]|0,t[r>>2]=0,n|0&&(ia(n),yt(n)),ao(t[e>>2]|0)}function gd(e,n){e=e|0,n=n|0,ea(t[e>>2]|0,t[n>>2]|0)}function $1(e,n){e=e|0,n=n|0,Z(t[e>>2]|0,n)}function e2(e,n,r){e=e|0,n=n|0,r=+r,lr(t[e>>2]|0,n,w(r))}function ho(e,n,r){e=e|0,n=n|0,r=+r,Qn(t[e>>2]|0,n,w(r))}function Uc(e,n){e=e|0,n=n|0,z(t[e>>2]|0,n)}function Dl(e,n){e=e|0,n=n|0,$(t[e>>2]|0,n)}function el(e,n){e=e|0,n=n|0,me(t[e>>2]|0,n)}function _d(e,n){e=e|0,n=n|0,h0(t[e>>2]|0,n)}function Bs(e,n){e=e|0,n=n|0,Xe(t[e>>2]|0,n)}function wl(e,n){e=e|0,n=n|0,Ni(t[e>>2]|0,n)}function t2(e,n,r){e=e|0,n=n|0,r=+r,Cn(t[e>>2]|0,n,w(r))}function Po(e,n,r){e=e|0,n=n|0,r=+r,Ar(t[e>>2]|0,n,w(r))}function Fa(e,n){e=e|0,n=n|0,Rr(t[e>>2]|0,n)}function ba(e,n){e=e|0,n=n|0,ie(t[e>>2]|0,n)}function Pa(e,n){e=e|0,n=n|0,tt(t[e>>2]|0,n)}function ua(e,n){e=e|0,n=+n,kt(t[e>>2]|0,w(n))}function ys(e,n){e=e|0,n=+n,tn(t[e>>2]|0,w(n))}function gs(e,n){e=e|0,n=+n,Lt(t[e>>2]|0,w(n))}function Ql(e,n){e=e|0,n=+n,bt(t[e>>2]|0,w(n))}function Io(e,n){e=e|0,n=+n,on(t[e>>2]|0,w(n))}function hf(e,n){e=e|0,n=+n,sn(t[e>>2]|0,w(n))}function tl(e,n){e=e|0,n=+n,Yn(t[e>>2]|0,w(n))}function ju(e){e=e|0,yr(t[e>>2]|0)}function Ia(e,n){e=e|0,n=+n,Cu(t[e>>2]|0,w(n))}function Zu(e,n){e=e|0,n=+n,S0(t[e>>2]|0,w(n))}function U0(e){e=e|0,X0(t[e>>2]|0)}function vf(e,n){e=e|0,n=+n,di(t[e>>2]|0,w(n))}function jc(e,n){e=e|0,n=+n,ko(t[e>>2]|0,w(n))}function lc(e,n){e=e|0,n=+n,sf(t[e>>2]|0,w(n))}function Sl(e,n){e=e|0,n=+n,gl(t[e>>2]|0,w(n))}function _s(e,n){e=e|0,n=+n,Mo(t[e>>2]|0,w(n))}function oa(e,n){e=e|0,n=+n,ds(t[e>>2]|0,w(n))}function n2(e,n){e=e|0,n=+n,No(t[e>>2]|0,w(n))}function la(e,n){e=e|0,n=+n,Lo(t[e>>2]|0,w(n))}function sc(e,n){e=e|0,n=+n,Vu(t[e>>2]|0,w(n))}function zc(e,n,r){e=e|0,n=n|0,r=+r,Ft(t[e>>2]|0,n,w(r))}function bi(e,n,r){e=e|0,n=n|0,r=+r,nt(t[e>>2]|0,n,w(r))}function g(e,n,r){e=e|0,n=n|0,r=+r,_t(t[e>>2]|0,n,w(r))}function y(e){return e=e|0,ke(t[e>>2]|0)|0}function A(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0;u=m,m=m+16|0,l=u,_r(l,t[n>>2]|0,r),F(e,l),m=u}function F(e,n){e=e|0,n=n|0,I(e,t[n+4>>2]|0,+w(C[n>>2]))}function I(e,n,r){e=e|0,n=n|0,r=+r,t[e>>2]=n,U[e+8>>3]=r}function J(e){return e=e|0,G(t[e>>2]|0)|0}function fe(e){return e=e|0,De(t[e>>2]|0)|0}function mt(e){return e=e|0,xe(t[e>>2]|0)|0}function Ct(e){return e=e|0,Fs(t[e>>2]|0)|0}function Mt(e){return e=e|0,ht(t[e>>2]|0)|0}function Er(e){return e=e|0,B(t[e>>2]|0)|0}function $u(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0;u=m,m=m+16|0,l=u,v0(l,t[n>>2]|0,r),F(e,l),m=u}function iu(e){return e=e|0,qe(t[e>>2]|0)|0}function j0(e){return e=e|0,Tt(t[e>>2]|0)|0}function Tl(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,gn(u,t[n>>2]|0),F(e,u),m=r}function e0(e){return e=e|0,+ +w(lf(t[e>>2]|0))}function He(e){return e=e|0,+ +w(Ns(t[e>>2]|0))}function Be(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,nu(u,t[n>>2]|0),F(e,u),m=r}function ut(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,xu(u,t[n>>2]|0),F(e,u),m=r}function Jt(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,Zo(u,t[n>>2]|0),F(e,u),m=r}function jn(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,af(u,t[n>>2]|0),F(e,u),m=r}function ti(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,bs(u,t[n>>2]|0),F(e,u),m=r}function tr(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,ps(u,t[n>>2]|0),F(e,u),m=r}function ii(e){return e=e|0,+ +w(yu(t[e>>2]|0))}function qi(e,n){return e=e|0,n=n|0,+ +w(nn(t[e>>2]|0,n))}function jr(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0;u=m,m=m+16|0,l=u,Ze(l,t[n>>2]|0,r),F(e,l),m=u}function gu(e,n,r){e=e|0,n=n|0,r=r|0,ka(t[e>>2]|0,t[n>>2]|0,r)}function Ba(e,n){e=e|0,n=n|0,Tu(t[e>>2]|0,t[n>>2]|0)}function Ua(e){return e=e|0,mu(t[e>>2]|0)|0}function r2(e){return e=e|0,e=ri(t[e>>2]|0)|0,e?e=oc(e)|0:e=0,e|0}function Ed(e,n){return e=e|0,n=n|0,e=yi(t[e>>2]|0,n)|0,e?e=oc(e)|0:e=0,e|0}function Dd(e,n){e=e|0,n=n|0;var r=0,u=0;u=cn(4)|0,mf(u,n),r=e+4|0,n=t[r>>2]|0,t[r>>2]=u,n|0&&(ia(n),yt(n)),$s(t[e>>2]|0,1)}function mf(e,n){e=e|0,n=n|0,rl(e,n)}function i2(e,n,r,u,l,s){e=e|0,n=n|0,r=w(r),u=u|0,l=w(l),s=s|0;var h=0,D=0;h=m,m=m+16|0,D=h,ch(D,Ls(n)|0,+r,u,+l,s),C[e>>2]=w(+U[D>>3]),C[e+4>>2]=w(+U[D+8>>3]),m=h}function ch(e,n,r,u,l,s){e=e|0,n=n|0,r=+r,u=u|0,l=+l,s=s|0;var h=0,D=0,S=0,M=0,O=0;h=m,m=m+32|0,O=h+8|0,M=h+20|0,S=h,D=h+16|0,U[O>>3]=r,t[M>>2]=u,U[S>>3]=l,t[D>>2]=s,qc(e,t[n+4>>2]|0,O,M,S,D),m=h}function qc(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0;var h=0,D=0;h=m,m=m+16|0,D=h,Ta(D),n=vo(n)|0,dh(e,n,+U[r>>3],t[u>>2]|0,+U[l>>3],t[s>>2]|0),Ca(D),m=h}function vo(e){return e=e|0,t[e>>2]|0}function dh(e,n,r,u,l,s){e=e|0,n=n|0,r=+r,u=u|0,l=+l,s=s|0;var h=0;h=mo(ph()|0)|0,r=+Cl(r),u=u2(u)|0,l=+Cl(l),o2(e,Wr(0,h|0,n|0,+r,u|0,+l,u2(s)|0)|0)}function ph(){var e=0;return p[7608]|0||(Wc(9120),e=7608,t[e>>2]=1,t[e+4>>2]=0),9120}function mo(e){return e=e|0,t[e+8>>2]|0}function Cl(e){return e=+e,+ +ja(e)}function u2(e){return e=e|0,s2(e)|0}function o2(e,n){e=e|0,n=n|0;var r=0,u=0,l=0;l=m,m=m+32|0,r=l,u=n,u&1?(wd(r,0),Yi(u|0,r|0)|0,Hc(e,r),Mr(r)):(t[e>>2]=t[n>>2],t[e+4>>2]=t[n+4>>2],t[e+8>>2]=t[n+8>>2],t[e+12>>2]=t[n+12>>2]),m=l}function wd(e,n){e=e|0,n=n|0,l2(e,n),t[e+8>>2]=0,p[e+24>>0]=0}function Hc(e,n){e=e|0,n=n|0,n=n+8|0,t[e>>2]=t[n>>2],t[e+4>>2]=t[n+4>>2],t[e+8>>2]=t[n+8>>2],t[e+12>>2]=t[n+12>>2]}function Mr(e){e=e|0,p[e+24>>0]=0}function l2(e,n){e=e|0,n=n|0,t[e>>2]=n}function s2(e){return e=e|0,e|0}function ja(e){return e=+e,+e}function Wc(e){e=e|0,nl(e,Sd()|0,4)}function Sd(){return 1064}function nl(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r,t[e+8>>2]=Pt(n|0,r+1|0)|0}function rl(e,n){e=e|0,n=n|0,n=t[n>>2]|0,t[e>>2]=n,Ei(n|0)}function hh(e){e=e|0;var n=0,r=0;r=e+4|0,n=t[r>>2]|0,t[r>>2]=0,n|0&&(ia(n),yt(n)),$s(t[e>>2]|0,0)}function yf(e){e=e|0,Gr(t[e>>2]|0)}function Vc(e){return e=e|0,Yl(t[e>>2]|0)|0}function Td(e,n,r,u){e=e|0,n=+n,r=+r,u=u|0,Kr(t[e>>2]|0,w(n),w(r),u)}function vh(e){return e=e|0,+ +w(pi(t[e>>2]|0))}function il(e){return e=e|0,+ +w(Q0(t[e>>2]|0))}function sa(e){return e=e|0,+ +w(T0(t[e>>2]|0))}function Cd(e){return e=e|0,+ +w(Fo(t[e>>2]|0))}function xd(e){return e=e|0,+ +w(ta(t[e>>2]|0))}function ac(e){return e=e|0,+ +w(Kl(t[e>>2]|0))}function mh(e,n){e=e|0,n=n|0,U[e>>3]=+w(pi(t[n>>2]|0)),U[e+8>>3]=+w(Q0(t[n>>2]|0)),U[e+16>>3]=+w(T0(t[n>>2]|0)),U[e+24>>3]=+w(Fo(t[n>>2]|0)),U[e+32>>3]=+w(ta(t[n>>2]|0)),U[e+40>>3]=+w(Kl(t[n>>2]|0))}function Ad(e,n){return e=e|0,n=n|0,+ +w(Ki(t[e>>2]|0,n))}function a2(e,n){return e=e|0,n=n|0,+ +w(Yr(t[e>>2]|0,n))}function Gc(e,n){return e=e|0,n=n|0,+ +w(fo(t[e>>2]|0,n))}function Yc(){return Oa()|0}function Us(){Rd(),aa(),Kc(),fc(),cc(),f2()}function Rd(){bN(11713,4938,1)}function aa(){eN(10448)}function Kc(){bM(10408)}function fc(){iM(10324)}function cc(){yE(10096)}function f2(){yh(9132)}function yh(e){e=e|0;var n=0,r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0,Ee=0,ve=0,Qe=0,We=0,st=0,Re=0,Fe=0,Qt=0,Lr=0,Nn=0,mn=0,hr=0,kr=0,On=0,Zi=0,ts=0,ns=0,rs=0,Xs=0,$2=0,ed=0,Za=0,td=0,Oc=0,kc=0,nd=0,rd=0,id=0,si=0,$a=0,ud=0,zf=0,od=0,ld=0,Mc=0,Nc=0,qf=0,Il=0,Aa=0,As=0,ef=0,L1=0,F1=0,Lc=0,b1=0,P1=0,Bl=0,vl=0,tf=0,lu=0,I1=0,is=0,Hf=0,us=0,Wf=0,B1=0,U1=0,Vf=0,Ul=0,nf=0,j1=0,z1=0,q1=0,gr=0,Mu=0,ml=0,os=0,jl=0,Tr=0,Fn=0,rf=0;n=m,m=m+672|0,r=n+656|0,rf=n+648|0,Fn=n+640|0,Tr=n+632|0,jl=n+624|0,os=n+616|0,ml=n+608|0,Mu=n+600|0,gr=n+592|0,q1=n+584|0,z1=n+576|0,j1=n+568|0,nf=n+560|0,Ul=n+552|0,Vf=n+544|0,U1=n+536|0,B1=n+528|0,Wf=n+520|0,us=n+512|0,Hf=n+504|0,is=n+496|0,I1=n+488|0,lu=n+480|0,tf=n+472|0,vl=n+464|0,Bl=n+456|0,P1=n+448|0,b1=n+440|0,Lc=n+432|0,F1=n+424|0,L1=n+416|0,ef=n+408|0,As=n+400|0,Aa=n+392|0,Il=n+384|0,qf=n+376|0,Nc=n+368|0,Mc=n+360|0,ld=n+352|0,od=n+344|0,zf=n+336|0,ud=n+328|0,$a=n+320|0,si=n+312|0,id=n+304|0,rd=n+296|0,nd=n+288|0,kc=n+280|0,Oc=n+272|0,td=n+264|0,Za=n+256|0,ed=n+248|0,$2=n+240|0,Xs=n+232|0,rs=n+224|0,ns=n+216|0,ts=n+208|0,Zi=n+200|0,On=n+192|0,kr=n+184|0,hr=n+176|0,mn=n+168|0,Nn=n+160|0,Lr=n+152|0,Qt=n+144|0,Fe=n+136|0,Re=n+128|0,st=n+120|0,We=n+112|0,Qe=n+104|0,ve=n+96|0,Ee=n+88|0,Pe=n+80|0,K=n+72|0,P=n+64|0,O=n+56|0,M=n+48|0,S=n+40|0,D=n+32|0,h=n+24|0,s=n+16|0,l=n+8|0,u=n,gf(e,3646),Xc(e,3651,2)|0,gh(e,3665,2)|0,vm(e,3682,18)|0,t[rf>>2]=19,t[rf+4>>2]=0,t[r>>2]=t[rf>>2],t[r+4>>2]=t[rf+4>>2],js(e,3690,r)|0,t[Fn>>2]=1,t[Fn+4>>2]=0,t[r>>2]=t[Fn>>2],t[r+4>>2]=t[Fn+4>>2],fa(e,3696,r)|0,t[Tr>>2]=2,t[Tr+4>>2]=0,t[r>>2]=t[Tr>>2],t[r+4>>2]=t[Tr+4>>2],Ji(e,3706,r)|0,t[jl>>2]=1,t[jl+4>>2]=0,t[r>>2]=t[jl>>2],t[r+4>>2]=t[jl+4>>2],O0(e,3722,r)|0,t[os>>2]=2,t[os+4>>2]=0,t[r>>2]=t[os>>2],t[r+4>>2]=t[os+4>>2],O0(e,3734,r)|0,t[ml>>2]=3,t[ml+4>>2]=0,t[r>>2]=t[ml>>2],t[r+4>>2]=t[ml+4>>2],Ji(e,3753,r)|0,t[Mu>>2]=4,t[Mu+4>>2]=0,t[r>>2]=t[Mu>>2],t[r+4>>2]=t[Mu+4>>2],Ji(e,3769,r)|0,t[gr>>2]=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0,t[D>>2]=9,t[D+4>>2]=0,t[r>>2]=t[D>>2],t[r+4>>2]=t[D+4>>2],ul(e,4736,r)|0,t[h>>2]=21,t[h+4>>2]=0,t[r>>2]=t[h>>2],t[r+4>>2]=t[h+4>>2],c2(e,4754,r)|0,t[s>>2]=2,t[s+4>>2]=0,t[r>>2]=t[s>>2],t[r+4>>2]=t[s+4>>2],dc(e,4772,r)|0,t[l>>2]=3,t[l+4>>2]=0,t[r>>2]=t[l>>2],t[r+4>>2]=t[l+4>>2],dc(e,4790,r)|0,t[u>>2]=4,t[u+4>>2]=0,t[r>>2]=t[u>>2],t[r+4>>2]=t[u+4>>2],dc(e,4808,r)|0,m=n}function gf(e,n){e=e|0,n=n|0;var r=0;r=Ja()|0,t[e>>2]=r,jo(r,n),Q2(t[e>>2]|0)}function Xc(e,n,r){return e=e|0,n=n|0,r=r|0,Ot(e,Or(n)|0,r,0),e|0}function gh(e,n,r){return e=e|0,n=n|0,r=r|0,c(e,Or(n)|0,r,0),e|0}function vm(e,n,r){return e=e|0,n=n|0,r=r|0,cE(e,Or(n)|0,r,0),e|0}function js(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],rE(e,n,l),m=u,e|0}function fa(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],bl(e,n,l),m=u,e|0}function Ji(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],d(e,n,l),m=u,e|0}function O0(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Tv(e,n,l),m=u,e|0}function t0(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],sy(e,n,l),m=u,e|0}function Jl(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],W2(e,n,l),m=u,e|0}function za(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],H2(e,n,l),m=u,e|0}function no(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],k0(e,n,l),m=u,e|0}function ul(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Ep(e,n,l),m=u,e|0}function dc(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Hm(e,n,l),m=u,e|0}function Od(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],n0(e,n,l),m=u,e|0}function _h(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],x2(e,n,l),m=u,e|0}function _f(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Fm(e,n,l),m=u,e|0}function Ef(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Zd(e,n,l),m=u,e|0}function Qc(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],p1(e,n,l),m=u,e|0}function xl(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Ga(e,n,l),m=u,e|0}function Jc(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Id(e,n,l),m=u,e|0}function ca(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Nd(e,n,l),m=u,e|0}function c2(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],d2(e,n,l),m=u,e|0}function d2(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],da(e,r,l,1),m=u}function Or(e){return e=e|0,e|0}function da(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=kd()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=Zc(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,p2(s,u)|0,u),m=l}function kd(){var e=0,n=0;if(p[7616]|0||(ol(9136),Ht(24,9136,he|0)|0,n=7616,t[n>>2]=1,t[n+4>>2]=0),!(rr(9136)|0)){e=9136,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));ol(9136)}return 9136}function Zc(e){return e=e|0,0}function p2(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=kd()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],Df(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(wf(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function vi(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0;var h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0;h=m,m=m+32|0,K=h+24|0,P=h+20|0,S=h+16|0,O=h+12|0,M=h+8|0,D=h+4|0,Pe=h,t[P>>2]=n,t[S>>2]=r,t[O>>2]=u,t[M>>2]=l,t[D>>2]=s,s=e+28|0,t[Pe>>2]=t[s>>2],t[K>>2]=t[Pe>>2],Md(e+24|0,K,P,O,M,S,D)|0,t[s>>2]=t[t[s>>2]>>2],m=h}function Md(e,n,r,u,l,s,h){return e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,h=h|0,e=mm(n)|0,n=cn(24)|0,h2(n+4|0,t[r>>2]|0,t[u>>2]|0,t[l>>2]|0,t[s>>2]|0,t[h>>2]|0),t[n>>2]=t[e>>2],t[e>>2]=n,n|0}function mm(e){return e=e|0,t[e>>2]|0}function h2(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,t[e>>2]=n,t[e+4>>2]=r,t[e+8>>2]=u,t[e+12>>2]=l,t[e+16>>2]=s}function dn(e,n){return e=e|0,n=n|0,n|e|0}function Df(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function wf(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=ym(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,Sf(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],Df(s,u,r),t[S>>2]=(t[S>>2]|0)+12,Eh(e,D),gm(D),m=M;return}}function ym(e){return e=e|0,357913941}function Sf(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function Eh(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function gm(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function ol(e){e=e|0,Bo(e)}function $c(e){e=e|0,Un(e+24|0)}function rr(e){return e=e|0,t[e>>2]|0}function Un(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function Bo(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,3,n,zn()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function dr(){return 9228}function zn(){return 1140}function ll(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0;return r=m,m=m+16|0,u=r+8|0,l=r,s=yo(e)|0,e=t[s+4>>2]|0,t[l>>2]=t[s>>2],t[l+4>>2]=e,t[u>>2]=t[l>>2],t[u+4>>2]=t[l+4>>2],n=pc(n,u)|0,m=r,n|0}function Pn(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,t[e>>2]=n,t[e+4>>2]=r,t[e+8>>2]=u,t[e+12>>2]=l,t[e+16>>2]=s}function yo(e){return e=e|0,(t[(kd()|0)+24>>2]|0)+(e*12|0)|0}function pc(e,n){e=e|0,n=n|0;var r=0,u=0,l=0;return l=m,m=m+48|0,u=l,r=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(r=t[(t[e>>2]|0)+r>>2]|0),N1[r&31](u,e),u=ro(u)|0,m=l,u|0}function ro(e){e=e|0;var n=0,r=0,u=0,l=0;return l=m,m=m+32|0,n=l+12|0,r=l,u=Ou(qa()|0)|0,u?(Zl(n,u),Tf(r,n),hc(e,r),e=Es(n)|0):e=vc(e)|0,m=l,e|0}function qa(){var e=0;return p[7632]|0||(xf(9184),Ht(25,9184,he|0)|0,e=7632,t[e>>2]=1,t[e+4>>2]=0),9184}function Ou(e){return e=e|0,t[e+36>>2]|0}function Zl(e,n){e=e|0,n=n|0,t[e>>2]=n,t[e+4>>2]=e,t[e+8>>2]=0}function Tf(e,n){e=e|0,n=n|0,t[e>>2]=t[n>>2],t[e+4>>2]=t[n+4>>2],t[e+8>>2]=0}function hc(e,n){e=e|0,n=n|0,io(n,e,e+8|0,e+16|0,e+24|0,e+32|0,e+40|0)|0}function Es(e){return e=e|0,t[(t[e+4>>2]|0)+8>>2]|0}function vc(e){e=e|0;var n=0,r=0,u=0,l=0,s=0,h=0,D=0,S=0;S=m,m=m+16|0,r=S+4|0,u=S,l=Sa(8)|0,s=l,h=cn(48)|0,D=h,n=D+48|0;do t[D>>2]=t[e>>2],D=D+4|0,e=e+4|0;while((D|0)<(n|0));return n=s+4|0,t[n>>2]=h,D=cn(8)|0,h=t[n>>2]|0,t[u>>2]=0,t[r>>2]=t[u>>2],Dh(D,h,r),t[l>>2]=D,m=S,s|0}function Dh(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,r=cn(16)|0,t[r+4>>2]=0,t[r+8>>2]=0,t[r>>2]=1092,t[r+12>>2]=n,t[e+4>>2]=r}function an(e){e=e|0,Pv(e),yt(e)}function $l(e){e=e|0,e=t[e+12>>2]|0,e|0&&yt(e)}function go(e){e=e|0,yt(e)}function io(e,n,r,u,l,s,h){return e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,h=h|0,s=Hi(t[e>>2]|0,n,r,u,l,s,h)|0,h=e+4|0,t[(t[h>>2]|0)+8>>2]=s,t[(t[h>>2]|0)+8>>2]|0}function Hi(e,n,r,u,l,s,h){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,h=h|0;var D=0,S=0;return D=m,m=m+16|0,S=D,Ta(S),e=vo(e)|0,h=zr(e,+U[n>>3],+U[r>>3],+U[u>>3],+U[l>>3],+U[s>>3],+U[h>>3])|0,Ca(S),m=D,h|0}function zr(e,n,r,u,l,s,h){e=e|0,n=+n,r=+r,u=+u,l=+l,s=+s,h=+h;var D=0;return D=mo(Cf()|0)|0,n=+Cl(n),r=+Cl(r),u=+Cl(u),l=+Cl(l),s=+Cl(s),f0(0,D|0,e|0,+n,+r,+u,+l,+s,+ +Cl(h))|0}function Cf(){var e=0;return p[7624]|0||(_m(9172),e=7624,t[e>>2]=1,t[e+4>>2]=0),9172}function _m(e){e=e|0,nl(e,Al()|0,6)}function Al(){return 1112}function xf(e){e=e|0,Ha(e)}function Af(e){e=e|0,v2(e+24|0),m2(e+16|0)}function v2(e){e=e|0,e1(e)}function m2(e){e=e|0,mc(e)}function mc(e){e=e|0;var n=0,r=0;if(n=t[e>>2]|0,n|0)do r=n,n=t[n>>2]|0,yt(r);while((n|0)!=0);t[e>>2]=0}function e1(e){e=e|0;var n=0,r=0;if(n=t[e>>2]|0,n|0)do r=n,n=t[n>>2]|0,yt(r);while((n|0)!=0);t[e>>2]=0}function Ha(e){e=e|0;var n=0;t[e+16>>2]=0,t[e+20>>2]=0,n=e+24|0,t[n>>2]=0,t[e+28>>2]=n,t[e+36>>2]=0,p[e+40>>0]=0,p[e+41>>0]=0}function Nd(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],y2(e,r,l,0),m=u}function y2(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=t1()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=Rf(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,n1(s,u)|0,u),m=l}function t1(){var e=0,n=0;if(p[7640]|0||(Rl(9232),Ht(26,9232,he|0)|0,n=7640,t[n>>2]=1,t[n+4>>2]=0),!(rr(9232)|0)){e=9232,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));Rl(9232)}return 9232}function Rf(e){return e=e|0,0}function n1(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=t1()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],Wa(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(r1(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function Wa(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function r1(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Ld(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,g2(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],Wa(s,u,r),t[S>>2]=(t[S>>2]|0)+12,yc(e,D),i1(D),m=M;return}}function Ld(e){return e=e|0,357913941}function g2(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function yc(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function i1(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function Rl(e){e=e|0,Fd(e)}function pa(e){e=e|0,wh(e+24|0)}function wh(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function Fd(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,1,n,bd()|0,3),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function bd(){return 1144}function Sh(e,n,r,u,l){e=e|0,n=n|0,r=+r,u=+u,l=l|0;var s=0,h=0,D=0,S=0;s=m,m=m+16|0,h=s+8|0,D=s,S=_2(e)|0,e=t[S+4>>2]|0,t[D>>2]=t[S>>2],t[D+4>>2]=e,t[h>>2]=t[D>>2],t[h+4>>2]=t[D+4>>2],Th(n,h,r,u,l),m=s}function _2(e){return e=e|0,(t[(t1()|0)+24>>2]|0)+(e*12|0)|0}function Th(e,n,r,u,l){e=e|0,n=n|0,r=+r,u=+u,l=l|0;var s=0,h=0,D=0,S=0,M=0;M=m,m=m+16|0,h=M+2|0,D=M+1|0,S=M,s=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(s=t[(t[e>>2]|0)+s>>2]|0),Ol(h,r),r=+es(h,r),Ol(D,u),u=+es(D,u),Ds(S,l),S=zs(S,l)|0,Z8[s&1](e,r,u,S),m=M}function Ol(e,n){e=e|0,n=+n}function es(e,n){return e=e|0,n=+n,+ +Ch(n)}function Ds(e,n){e=e|0,n=n|0}function zs(e,n){return e=e|0,n=n|0,Pd(n)|0}function Pd(e){return e=e|0,e|0}function Ch(e){return e=+e,+e}function Id(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Bd(e,r,l,1),m=u}function Bd(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=u1()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=o1(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,xh(s,u)|0,u),m=l}function u1(){var e=0,n=0;if(p[7648]|0||(l1(9268),Ht(27,9268,he|0)|0,n=7648,t[n>>2]=1,t[n+4>>2]=0),!(rr(9268)|0)){e=9268,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));l1(9268)}return 9268}function o1(e){return e=e|0,0}function xh(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=u1()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],Ud(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(jd(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function Ud(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function jd(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=ws(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,Va(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],Ud(s,u,r),t[S>>2]=(t[S>>2]|0)+12,Ah(e,D),uu(D),m=M;return}}function ws(e){return e=e|0,357913941}function Va(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function Ah(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function uu(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function l1(e){e=e|0,kl(e)}function Rh(e){e=e|0,s1(e+24|0)}function s1(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function kl(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,4,n,Oh()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Oh(){return 1160}function zd(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0;return r=m,m=m+16|0,u=r+8|0,l=r,s=kh(e)|0,e=t[s+4>>2]|0,t[l>>2]=t[s>>2],t[l+4>>2]=e,t[u>>2]=t[l>>2],t[u+4>>2]=t[l+4>>2],n=a1(n,u)|0,m=r,n|0}function kh(e){return e=e|0,(t[(u1()|0)+24>>2]|0)+(e*12|0)|0}function a1(e,n){e=e|0,n=n|0;var r=0;return r=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(r=t[(t[e>>2]|0)+r>>2]|0),Ml(Xp[r&31](e)|0)|0}function Ml(e){return e=e|0,e&1|0}function Ga(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],ha(e,r,l,0),m=u}function ha(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=qd()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=Hd(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,Em(s,u)|0,u),m=l}function qd(){var e=0,n=0;if(p[7656]|0||(Lh(9304),Ht(28,9304,he|0)|0,n=7656,t[n>>2]=1,t[n+4>>2]=0),!(rr(9304)|0)){e=9304,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));Lh(9304)}return 9304}function Hd(e){return e=e|0,0}function Em(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=qd()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],Wd(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(Mh(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function Wd(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function Mh(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Nh(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,Vd(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],Wd(s,u,r),t[S>>2]=(t[S>>2]|0)+12,Dm(e,D),wm(D),m=M;return}}function Nh(e){return e=e|0,357913941}function Vd(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function Dm(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function wm(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function Lh(e){e=e|0,f1(e)}function Sm(e){e=e|0,Gd(e+24|0)}function Gd(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function f1(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,5,n,c1()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function c1(){return 1164}function d1(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;u=m,m=m+16|0,l=u+8|0,s=u,h=va(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Yd(n,l,r),m=u}function va(e){return e=e|0,(t[(qd()|0)+24>>2]|0)+(e*12|0)|0}function Yd(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;s=m,m=m+16|0,l=s,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),qs(l,r),r=Hs(l,r)|0,N1[u&31](e,r),Ws(l),m=s}function qs(e,n){e=e|0,n=n|0,Kd(e,n)}function Hs(e,n){return e=e|0,n=n|0,e|0}function Ws(e){e=e|0,ia(e)}function Kd(e,n){e=e|0,n=n|0,ma(e,n)}function ma(e,n){e=e|0,n=n|0,t[e>>2]=n}function p1(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],E2(e,r,l,0),m=u}function E2(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=gc()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=Xd(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,_o(s,u)|0,u),m=l}function gc(){var e=0,n=0;if(p[7664]|0||(Uh(9340),Ht(29,9340,he|0)|0,n=7664,t[n>>2]=1,t[n+4>>2]=0),!(rr(9340)|0)){e=9340,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));Uh(9340)}return 9340}function Xd(e){return e=e|0,0}function _o(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=gc()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],Fh(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(bh(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function Fh(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function bh(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Ph(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,Ih(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],Fh(s,u,r),t[S>>2]=(t[S>>2]|0)+12,Tm(e,D),Bh(D),m=M;return}}function Ph(e){return e=e|0,357913941}function Ih(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function Tm(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Bh(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function Uh(e){e=e|0,jh(e)}function h1(e){e=e|0,Qd(e+24|0)}function Qd(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function jh(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,4,n,Jd()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Jd(){return 1180}function zh(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=Cm(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],r=xm(n,l,r)|0,m=u,r|0}function Cm(e){return e=e|0,(t[(gc()|0)+24>>2]|0)+(e*12|0)|0}function xm(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;return s=m,m=m+16|0,l=s,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),Of(l,r),l=kf(l,r)|0,l=D2(ZE[u&15](e,l)|0)|0,m=s,l|0}function Of(e,n){e=e|0,n=n|0}function kf(e,n){return e=e|0,n=n|0,Am(n)|0}function D2(e){return e=e|0,e|0}function Am(e){return e=e|0,e|0}function Zd(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],w2(e,r,l,0),m=u}function w2(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=$d()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=qh(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,ep(s,u)|0,u),m=l}function $d(){var e=0,n=0;if(p[7672]|0||(Vh(9376),Ht(30,9376,he|0)|0,n=7672,t[n>>2]=1,t[n+4>>2]=0),!(rr(9376)|0)){e=9376,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));Vh(9376)}return 9376}function qh(e){return e=e|0,0}function ep(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=$d()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],Hh(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(Wh(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function Hh(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function Wh(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=tp(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,Rm(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],Hh(s,u,r),t[S>>2]=(t[S>>2]|0)+12,Om(e,D),km(D),m=M;return}}function tp(e){return e=e|0,357913941}function Rm(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function Om(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function km(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function Vh(e){e=e|0,np(e)}function v1(e){e=e|0,Mm(e+24|0)}function Mm(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function np(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,5,n,rp()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function rp(){return 1196}function Nm(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0;return r=m,m=m+16|0,u=r+8|0,l=r,s=Lm(e)|0,e=t[s+4>>2]|0,t[l>>2]=t[s>>2],t[l+4>>2]=e,t[u>>2]=t[l>>2],t[u+4>>2]=t[l+4>>2],n=Gh(n,u)|0,m=r,n|0}function Lm(e){return e=e|0,(t[($d()|0)+24>>2]|0)+(e*12|0)|0}function Gh(e,n){e=e|0,n=n|0;var r=0;return r=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(r=t[(t[e>>2]|0)+r>>2]|0),D2(Xp[r&31](e)|0)|0}function Fm(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],bm(e,r,l,1),m=u}function bm(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=ip()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=up(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,ya(s,u)|0,u),m=l}function ip(){var e=0,n=0;if(p[7680]|0||(lp(9412),Ht(31,9412,he|0)|0,n=7680,t[n>>2]=1,t[n+4>>2]=0),!(rr(9412)|0)){e=9412,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));lp(9412)}return 9412}function up(e){return e=e|0,0}function ya(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=ip()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],m1(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(op(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function m1(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function op(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Yh(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,S2(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],m1(s,u,r),t[S>>2]=(t[S>>2]|0)+12,y1(e,D),Kh(D),m=M;return}}function Yh(e){return e=e|0,357913941}function S2(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function y1(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Kh(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function lp(e){e=e|0,Qh(e)}function Xh(e){e=e|0,sp(e+24|0)}function sp(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function Qh(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,6,n,Jh()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Jh(){return 1200}function ap(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0;return r=m,m=m+16|0,u=r+8|0,l=r,s=T2(e)|0,e=t[s+4>>2]|0,t[l>>2]=t[s>>2],t[l+4>>2]=e,t[u>>2]=t[l>>2],t[u+4>>2]=t[l+4>>2],n=C2(n,u)|0,m=r,n|0}function T2(e){return e=e|0,(t[(ip()|0)+24>>2]|0)+(e*12|0)|0}function C2(e,n){e=e|0,n=n|0;var r=0;return r=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(r=t[(t[e>>2]|0)+r>>2]|0),z0(Xp[r&31](e)|0)|0}function z0(e){return e=e|0,e|0}function x2(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],ga(e,r,l,0),m=u}function ga(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=Ya()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=A2(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,R2(s,u)|0,u),m=l}function Ya(){var e=0,n=0;if(p[7688]|0||(dp(9448),Ht(32,9448,he|0)|0,n=7688,t[n>>2]=1,t[n+4>>2]=0),!(rr(9448)|0)){e=9448,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));dp(9448)}return 9448}function A2(e){return e=e|0,0}function R2(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=Ya()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],fp(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(O2(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function fp(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function O2(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Zh(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,Pm(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],fp(s,u,r),t[S>>2]=(t[S>>2]|0)+12,$h(e,D),cp(D),m=M;return}}function Zh(e){return e=e|0,357913941}function Pm(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function $h(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function cp(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function dp(e){e=e|0,Bm(e)}function pp(e){e=e|0,Im(e+24|0)}function Im(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function Bm(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,6,n,Eo()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Eo(){return 1204}function k2(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;u=m,m=m+16|0,l=u+8|0,s=u,h=Um(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],sl(n,l,r),m=u}function Um(e){return e=e|0,(t[(Ya()|0)+24>>2]|0)+(e*12|0)|0}function sl(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;s=m,m=m+16|0,l=s,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),Jn(l,r),l=Vs(l,r)|0,N1[u&31](e,l),m=s}function Jn(e,n){e=e|0,n=n|0}function Vs(e,n){return e=e|0,n=n|0,al(n)|0}function al(e){return e=e|0,e|0}function n0(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],ev(e,r,l,0),m=u}function ev(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=Gs()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=hp(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,jm(s,u)|0,u),m=l}function Gs(){var e=0,n=0;if(p[7696]|0||(yp(9484),Ht(33,9484,he|0)|0,n=7696,t[n>>2]=1,t[n+4>>2]=0),!(rr(9484)|0)){e=9484,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));yp(9484)}return 9484}function hp(e){return e=e|0,0}function jm(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=Gs()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],tv(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(vp(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function tv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function vp(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=zm(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,mp(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],tv(s,u,r),t[S>>2]=(t[S>>2]|0)+12,_c(e,D),Ea(D),m=M;return}}function zm(e){return e=e|0,357913941}function mp(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function _c(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Ea(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function yp(e){e=e|0,zu(e)}function M2(e){e=e|0,ku(e+24|0)}function ku(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function zu(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,1,n,gp()|0,2),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function gp(){return 1212}function _p(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0;l=m,m=m+16|0,s=l+8|0,h=l,D=nv(e)|0,e=t[D+4>>2]|0,t[h>>2]=t[D>>2],t[h+4>>2]=e,t[s>>2]=t[h>>2],t[s+4>>2]=t[h+4>>2],qm(n,s,r,u),m=l}function nv(e){return e=e|0,(t[(Gs()|0)+24>>2]|0)+(e*12|0)|0}function qm(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0;D=m,m=m+16|0,s=D+1|0,h=D,l=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(l=t[(t[e>>2]|0)+l>>2]|0),Jn(s,r),s=Vs(s,r)|0,Of(h,u),h=kf(h,u)|0,jy[l&15](e,s,h),m=D}function Hm(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Wm(e,r,l,1),m=u}function Wm(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=N2()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=rv(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,Ec(s,u)|0,u),m=l}function N2(){var e=0,n=0;if(p[7704]|0||(iv(9520),Ht(34,9520,he|0)|0,n=7704,t[n>>2]=1,t[n+4>>2]=0),!(rr(9520)|0)){e=9520,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));iv(9520)}return 9520}function rv(e){return e=e|0,0}function Ec(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=N2()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],g1(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(Vm(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function g1(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function Vm(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=L2(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,_1(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],g1(s,u,r),t[S>>2]=(t[S>>2]|0)+12,Nl(e,D),Da(D),m=M;return}}function L2(e){return e=e|0,357913941}function _1(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function Nl(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Da(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function iv(e){e=e|0,ov(e)}function Gm(e){e=e|0,uv(e+24|0)}function uv(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function ov(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,1,n,Ym()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Ym(){return 1224}function lv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;return l=m,m=m+16|0,s=l+8|0,h=l,D=wa(e)|0,e=t[D+4>>2]|0,t[h>>2]=t[D>>2],t[h+4>>2]=e,t[s>>2]=t[h>>2],t[s+4>>2]=t[h+4>>2],u=+Cr(n,s,r),m=l,+u}function wa(e){return e=e|0,(t[(N2()|0)+24>>2]|0)+(e*12|0)|0}function Cr(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return s=m,m=m+16|0,l=s,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),Ds(l,r),l=zs(l,r)|0,h=+ja(+eS[u&7](e,l)),m=s,+h}function Ep(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],fl(e,r,l,1),m=u}function fl(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=cu()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=E1(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,ki(s,u)|0,u),m=l}function cu(){var e=0,n=0;if(p[7712]|0||(wp(9556),Ht(35,9556,he|0)|0,n=7712,t[n>>2]=1,t[n+4>>2]=0),!(rr(9556)|0)){e=9556,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));wp(9556)}return 9556}function E1(e){return e=e|0,0}function ki(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=cu()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],Dp(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(F2(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function Dp(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function F2(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Do(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,Ss(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],Dp(s,u,r),t[S>>2]=(t[S>>2]|0)+12,Mf(e,D),b2(D),m=M;return}}function Do(e){return e=e|0,357913941}function Ss(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function Mf(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function b2(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function wp(e){e=e|0,Sp(e)}function D1(e){e=e|0,w1(e+24|0)}function w1(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function Sp(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,5,n,Zn()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Zn(){return 1232}function cl(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=qn(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],r=+q0(n,l),m=u,+r}function qn(e){return e=e|0,(t[(cu()|0)+24>>2]|0)+(e*12|0)|0}function q0(e,n){e=e|0,n=n|0;var r=0;return r=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(r=t[(t[e>>2]|0)+r>>2]|0),+ +ja(+$8[r&15](e))}function k0(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],P2(e,r,l,1),m=u}function P2(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=Ll()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=S1(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,Dc(s,u)|0,u),m=l}function Ll(){var e=0,n=0;if(p[7720]|0||(U2(9592),Ht(36,9592,he|0)|0,n=7720,t[n>>2]=1,t[n+4>>2]=0),!(rr(9592)|0)){e=9592,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));U2(9592)}return 9592}function S1(e){return e=e|0,0}function Dc(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=Ll()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],wc(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(I2(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function wc(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function I2(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Tp(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,M0(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],wc(s,u,r),t[S>>2]=(t[S>>2]|0)+12,fn(e,D),B2(D),m=M;return}}function Tp(e){return e=e|0,357913941}function M0(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function fn(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function B2(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function U2(e){e=e|0,Cc(e)}function Sc(e){e=e|0,Tc(e+24|0)}function Tc(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function Cc(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,7,n,T1()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function T1(){return 1276}function Cp(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0;return r=m,m=m+16|0,u=r+8|0,l=r,s=Ka(e)|0,e=t[s+4>>2]|0,t[l>>2]=t[s>>2],t[l+4>>2]=e,t[u>>2]=t[l>>2],t[u+4>>2]=t[l+4>>2],n=Km(n,u)|0,m=r,n|0}function Ka(e){return e=e|0,(t[(Ll()|0)+24>>2]|0)+(e*12|0)|0}function Km(e,n){e=e|0,n=n|0;var r=0,u=0,l=0;return l=m,m=m+16|0,u=l,r=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(r=t[(t[e>>2]|0)+r>>2]|0),N1[r&31](u,e),u=xc(u)|0,m=l,u|0}function xc(e){e=e|0;var n=0,r=0,u=0,l=0;return l=m,m=m+32|0,n=l+12|0,r=l,u=Ou(j2()|0)|0,u?(Zl(n,u),Tf(r,n),sv(e,r),e=Es(n)|0):e=C1(e)|0,m=l,e|0}function j2(){var e=0;return p[7736]|0||(Uo(9640),Ht(25,9640,he|0)|0,e=7736,t[e>>2]=1,t[e+4>>2]=0),9640}function sv(e,n){e=e|0,n=n|0,Ac(n,e,e+8|0)|0}function C1(e){e=e|0;var n=0,r=0,u=0,l=0,s=0,h=0,D=0;return r=m,m=m+16|0,l=r+4|0,h=r,u=Sa(8)|0,n=u,D=cn(16)|0,t[D>>2]=t[e>>2],t[D+4>>2]=t[e+4>>2],t[D+8>>2]=t[e+8>>2],t[D+12>>2]=t[e+12>>2],s=n+4|0,t[s>>2]=D,e=cn(8)|0,s=t[s>>2]|0,t[h>>2]=0,t[l>>2]=t[h>>2],Nf(e,s,l),t[u>>2]=e,m=r,n|0}function Nf(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,r=cn(16)|0,t[r+4>>2]=0,t[r+8>>2]=0,t[r>>2]=1244,t[r+12>>2]=n,t[e+4>>2]=r}function Lf(e){e=e|0,Pv(e),yt(e)}function x1(e){e=e|0,e=t[e+12>>2]|0,e|0&&yt(e)}function Fl(e){e=e|0,yt(e)}function Ac(e,n,r){return e=e|0,n=n|0,r=r|0,n=Ff(t[e>>2]|0,n,r)|0,r=e+4|0,t[(t[r>>2]|0)+8>>2]=n,t[(t[r>>2]|0)+8>>2]|0}function Ff(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0;return u=m,m=m+16|0,l=u,Ta(l),e=vo(e)|0,r=Xm(e,t[n>>2]|0,+U[r>>3])|0,Ca(l),m=u,r|0}function Xm(e,n,r){e=e|0,n=n|0,r=+r;var u=0;return u=mo(dl()|0)|0,n=u2(n)|0,Pr(0,u|0,e|0,n|0,+ +Cl(r))|0}function dl(){var e=0;return p[7728]|0||(z2(9628),e=7728,t[e>>2]=1,t[e+4>>2]=0),9628}function z2(e){e=e|0,nl(e,q2()|0,2)}function q2(){return 1264}function Uo(e){e=e|0,Ha(e)}function H2(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Qm(e,r,l,1),m=u}function Qm(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=A1()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=Jm(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,Zm(s,u)|0,u),m=l}function A1(){var e=0,n=0;if(p[7744]|0||(cv(9684),Ht(37,9684,he|0)|0,n=7744,t[n>>2]=1,t[n+4>>2]=0),!(rr(9684)|0)){e=9684,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));cv(9684)}return 9684}function Jm(e){return e=e|0,0}function Zm(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=A1()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],av(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):($m(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function av(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function $m(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=fv(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,ey(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],av(s,u,r),t[S>>2]=(t[S>>2]|0)+12,ty(e,D),ny(D),m=M;return}}function fv(e){return e=e|0,357913941}function ey(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function ty(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function ny(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function cv(e){e=e|0,iy(e)}function ry(e){e=e|0,xp(e+24|0)}function xp(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function iy(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,5,n,bf()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function bf(){return 1280}function dv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=pv(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],r=hv(n,l,r)|0,m=u,r|0}function pv(e){return e=e|0,(t[(A1()|0)+24>>2]|0)+(e*12|0)|0}function hv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return h=m,m=m+32|0,l=h,s=h+16|0,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),Ds(s,r),s=zs(s,r)|0,jy[u&15](l,e,s),s=xc(l)|0,m=h,s|0}function W2(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],V2(e,r,l,1),m=u}function V2(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=Ap()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=vv(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,G2(s,u)|0,u),m=l}function Ap(){var e=0,n=0;if(p[7752]|0||(Ev(9720),Ht(38,9720,he|0)|0,n=7752,t[n>>2]=1,t[n+4>>2]=0),!(rr(9720)|0)){e=9720,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));Ev(9720)}return 9720}function vv(e){return e=e|0,0}function G2(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=Ap()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],mv(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(yv(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function mv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function yv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Rp(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,gv(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],mv(s,u,r),t[S>>2]=(t[S>>2]|0)+12,_v(e,D),uy(D),m=M;return}}function Rp(e){return e=e|0,357913941}function gv(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function _v(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function uy(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function Ev(e){e=e|0,Dv(e)}function oy(e){e=e|0,Y2(e+24|0)}function Y2(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function Dv(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,8,n,Op()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Op(){return 1288}function ly(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0;return r=m,m=m+16|0,u=r+8|0,l=r,s=r0(e)|0,e=t[s+4>>2]|0,t[l>>2]=t[s>>2],t[l+4>>2]=e,t[u>>2]=t[l>>2],t[u+4>>2]=t[l+4>>2],n=kp(n,u)|0,m=r,n|0}function r0(e){return e=e|0,(t[(Ap()|0)+24>>2]|0)+(e*12|0)|0}function kp(e,n){e=e|0,n=n|0;var r=0;return r=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(r=t[(t[e>>2]|0)+r>>2]|0),s2(Xp[r&31](e)|0)|0}function sy(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],ay(e,r,l,0),m=u}function ay(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=Mp()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=Xa(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,Np(s,u)|0,u),m=l}function Mp(){var e=0,n=0;if(p[7760]|0||(bp(9756),Ht(39,9756,he|0)|0,n=7760,t[n>>2]=1,t[n+4>>2]=0),!(rr(9756)|0)){e=9756,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));bp(9756)}return 9756}function Xa(e){return e=e|0,0}function Np(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=Mp()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],Lp(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(Fp(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function Lp(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function Fp(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=fy(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,cy(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],Lp(s,u,r),t[S>>2]=(t[S>>2]|0)+12,wv(e,D),Pf(D),m=M;return}}function fy(e){return e=e|0,357913941}function cy(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function wv(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Pf(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function bp(e){e=e|0,py(e)}function Sv(e){e=e|0,dy(e+24|0)}function dy(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function py(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,8,n,Pp()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Pp(){return 1292}function Ip(e,n,r){e=e|0,n=n|0,r=+r;var u=0,l=0,s=0,h=0;u=m,m=m+16|0,l=u+8|0,s=u,h=hy(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],vy(n,l,r),m=u}function hy(e){return e=e|0,(t[(Mp()|0)+24>>2]|0)+(e*12|0)|0}function vy(e,n,r){e=e|0,n=n|0,r=+r;var u=0,l=0,s=0;s=m,m=m+16|0,l=s,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),Ol(l,r),r=+es(l,r),Q8[u&31](e,r),m=s}function Tv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Bp(e,r,l,0),m=u}function Bp(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=Up()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=K2(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,my(s,u)|0,u),m=l}function Up(){var e=0,n=0;if(p[7768]|0||(jp(9792),Ht(40,9792,he|0)|0,n=7768,t[n>>2]=1,t[n+4>>2]=0),!(rr(9792)|0)){e=9792,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));jp(9792)}return 9792}function K2(e){return e=e|0,0}function my(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=Up()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],R1(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(yy(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function R1(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function yy(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Cv(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,xv(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],R1(s,u,r),t[S>>2]=(t[S>>2]|0)+12,gy(e,D),If(D),m=M;return}}function Cv(e){return e=e|0,357913941}function xv(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function gy(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function If(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function jp(e){e=e|0,Ey(e)}function Av(e){e=e|0,_y(e+24|0)}function _y(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function Ey(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,1,n,zp()|0,2),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function zp(){return 1300}function Dy(e,n,r,u){e=e|0,n=n|0,r=r|0,u=+u;var l=0,s=0,h=0,D=0;l=m,m=m+16|0,s=l+8|0,h=l,D=Ys(e)|0,e=t[D+4>>2]|0,t[h>>2]=t[D>>2],t[h+4>>2]=e,t[s>>2]=t[h>>2],t[s+4>>2]=t[h+4>>2],wy(n,s,r,u),m=l}function Ys(e){return e=e|0,(t[(Up()|0)+24>>2]|0)+(e*12|0)|0}function wy(e,n,r,u){e=e|0,n=n|0,r=r|0,u=+u;var l=0,s=0,h=0,D=0;D=m,m=m+16|0,s=D+1|0,h=D,l=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(l=t[(t[e>>2]|0)+l>>2]|0),Ds(s,r),s=zs(s,r)|0,Ol(h,u),u=+es(h,u),iS[l&15](e,s,u),m=D}function d(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],v(e,r,l,0),m=u}function v(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=x()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=b(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,H(s,u)|0,u),m=l}function x(){var e=0,n=0;if(p[7776]|0||(Rt(9828),Ht(41,9828,he|0)|0,n=7776,t[n>>2]=1,t[n+4>>2]=0),!(rr(9828)|0)){e=9828,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));Rt(9828)}return 9828}function b(e){return e=e|0,0}function H(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=x()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],ee(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(de(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function ee(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function de(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=ye(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,be(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],ee(s,u,r),t[S>>2]=(t[S>>2]|0)+12,gt(e,D),Dt(D),m=M;return}}function ye(e){return e=e|0,357913941}function be(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function gt(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Dt(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function Rt(e){e=e|0,$n(e)}function rn(e){e=e|0,Rn(e+24|0)}function Rn(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function $n(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,7,n,Nr()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Nr(){return 1312}function ir(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;u=m,m=m+16|0,l=u+8|0,s=u,h=Zr(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],ui(n,l,r),m=u}function Zr(e){return e=e|0,(t[(x()|0)+24>>2]|0)+(e*12|0)|0}function ui(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;s=m,m=m+16|0,l=s,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),Ds(l,r),l=zs(l,r)|0,N1[u&31](e,l),m=s}function bl(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],Wi(e,r,l,0),m=u}function Wi(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=uo()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=i0(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,Ts(s,u)|0,u),m=l}function uo(){var e=0,n=0;if(p[7784]|0||(r_(9864),Ht(42,9864,he|0)|0,n=7784,t[n>>2]=1,t[n+4>>2]=0),!(rr(9864)|0)){e=9864,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));r_(9864)}return 9864}function i0(e){return e=e|0,0}function Ts(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=uo()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],wo(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(Rv(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function wo(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function Rv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=X4(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,Sy(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],wo(s,u,r),t[S>>2]=(t[S>>2]|0)+12,Ty(e,D),Qa(D),m=M;return}}function X4(e){return e=e|0,357913941}function Sy(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function Ty(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Qa(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function r_(e){e=e|0,Z4(e)}function Q4(e){e=e|0,J4(e+24|0)}function J4(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function Z4(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,8,n,$4()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function $4(){return 1320}function Cy(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;u=m,m=m+16|0,l=u+8|0,s=u,h=eE(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],tE(n,l,r),m=u}function eE(e){return e=e|0,(t[(uo()|0)+24>>2]|0)+(e*12|0)|0}function tE(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;s=m,m=m+16|0,l=s,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),xy(l,r),l=i_(l,r)|0,N1[u&31](e,l),m=s}function xy(e,n){e=e|0,n=n|0}function i_(e,n){return e=e|0,n=n|0,nE(n)|0}function nE(e){return e=e|0,e|0}function rE(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],u_(e,r,l,0),m=u}function u_(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=Bf()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=o_(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,iE(s,u)|0,u),m=l}function Bf(){var e=0,n=0;if(p[7792]|0||(Oy(9900),Ht(43,9900,he|0)|0,n=7792,t[n>>2]=1,t[n+4>>2]=0),!(rr(9900)|0)){e=9900,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));Oy(9900)}return 9900}function o_(e){return e=e|0,0}function iE(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=Bf()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],qp(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(uE(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function qp(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function uE(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=Ov(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,Ay(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],qp(s,u,r),t[S>>2]=(t[S>>2]|0)+12,Ry(e,D),oE(D),m=M;return}}function Ov(e){return e=e|0,357913941}function Ay(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function Ry(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function oE(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function Oy(e){e=e|0,l_(e)}function lE(e){e=e|0,sE(e+24|0)}function sE(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function l_(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,22,n,aE()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function aE(){return 1344}function fE(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0;r=m,m=m+16|0,u=r+8|0,l=r,s=s_(e)|0,e=t[s+4>>2]|0,t[l>>2]=t[s>>2],t[l+4>>2]=e,t[u>>2]=t[l>>2],t[u+4>>2]=t[l+4>>2],kv(n,u),m=r}function s_(e){return e=e|0,(t[(Bf()|0)+24>>2]|0)+(e*12|0)|0}function kv(e,n){e=e|0,n=n|0;var r=0;r=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(r=t[(t[e>>2]|0)+r>>2]|0),M1[r&127](e)}function cE(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=ky()|0,e=dE(r)|0,vi(s,n,l,e,pE(r,u)|0,u)}function ky(){var e=0,n=0;if(p[7800]|0||(Ny(9936),Ht(44,9936,he|0)|0,n=7800,t[n>>2]=1,t[n+4>>2]=0),!(rr(9936)|0)){e=9936,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));Ny(9936)}return 9936}function dE(e){return e=e|0,e|0}function pE(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=ky()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(My(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(a_(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function My(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function a_(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=f_(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,c_(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,My(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,d_(e,l),p_(l),m=D;return}}function f_(e){return e=e|0,536870911}function c_(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function d_(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function p_(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function Ny(e){e=e|0,v_(e)}function h_(e){e=e|0,hE(e+24|0)}function hE(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function v_(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,23,n,Eo()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function vE(e,n){e=e|0,n=n|0,a(t[(mE(e)|0)>>2]|0,n)}function mE(e){return e=e|0,(t[(ky()|0)+24>>2]|0)+(e<<3)|0}function a(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,Jn(u,n),n=Vs(u,n)|0,M1[e&127](n),m=r}function c(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=_()|0,e=T(r)|0,vi(s,n,l,e,R(r,u)|0,u)}function _(){var e=0,n=0;if(p[7808]|0||(pt(9972),Ht(45,9972,he|0)|0,n=7808,t[n>>2]=1,t[n+4>>2]=0),!(rr(9972)|0)){e=9972,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));pt(9972)}return 9972}function T(e){return e=e|0,e|0}function R(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=_()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(j(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(V(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function j(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function V(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=te(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,oe(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,j(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,Ie(e,l),Ye(l),m=D;return}}function te(e){return e=e|0,536870911}function oe(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function Ie(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Ye(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function pt(e){e=e|0,zt(e)}function Nt(e){e=e|0,Vt(e+24|0)}function Vt(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function zt(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,9,n,vn()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function vn(){return 1348}function xr(e,n){return e=e|0,n=n|0,wi(t[($r(e)|0)>>2]|0,n)|0}function $r(e){return e=e|0,(t[(_()|0)+24>>2]|0)+(e<<3)|0}function wi(e,n){e=e|0,n=n|0;var r=0,u=0;return r=m,m=m+16|0,u=r,N0(u,n),n=Vi(u,n)|0,n=D2(Xp[e&31](n)|0)|0,m=r,n|0}function N0(e,n){e=e|0,n=n|0}function Vi(e,n){return e=e|0,n=n|0,it(n)|0}function it(e){return e=e|0,e|0}function Ot(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=Je()|0,e=Bt(r)|0,vi(s,n,l,e,Mn(r,u)|0,u)}function Je(){var e=0,n=0;if(p[7816]|0||(qr(10008),Ht(46,10008,he|0)|0,n=7816,t[n>>2]=1,t[n+4>>2]=0),!(rr(10008)|0)){e=10008,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));qr(10008)}return 10008}function Bt(e){return e=e|0,e|0}function Mn(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=Je()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(pn(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(Pi(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function pn(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function Pi(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=oi(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,qu(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,pn(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,ar(e,l),ou(l),m=D;return}}function oi(e){return e=e|0,536870911}function qu(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function ar(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function ou(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function qr(e){e=e|0,H0(e)}function _u(e){e=e|0,_0(e+24|0)}function _0(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function H0(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,15,n,rp()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Cs(e){return e=e|0,pl(t[(Hu(e)|0)>>2]|0)|0}function Hu(e){return e=e|0,(t[(Je()|0)+24>>2]|0)+(e<<3)|0}function pl(e){return e=e|0,D2(N_[e&7]()|0)|0}function Ja(){var e=0;return p[7832]|0||(y_(10052),Ht(25,10052,he|0)|0,e=7832,t[e>>2]=1,t[e+4>>2]=0),10052}function jo(e,n){e=e|0,n=n|0,t[e>>2]=xs()|0,t[e+4>>2]=X2()|0,t[e+12>>2]=n,t[e+8>>2]=Uf()|0,t[e+32>>2]=2}function xs(){return 11709}function X2(){return 1188}function Uf(){return O1()|0}function Rc(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,(Pl(u,896)|0)==512?r|0&&(zo(r),yt(r)):n|0&&(ms(n),yt(n))}function Pl(e,n){return e=e|0,n=n|0,n&e|0}function zo(e){e=e|0,e=t[e+4>>2]|0,e|0&&J2(e)}function O1(){var e=0;return p[7824]|0||(t[2511]=m_()|0,t[2512]=0,e=7824,t[e>>2]=1,t[e+4>>2]=0),10044}function m_(){return 0}function y_(e){e=e|0,Ha(e)}function yE(e){e=e|0;var n=0,r=0,u=0,l=0,s=0;n=m,m=m+32|0,r=n+24|0,s=n+16|0,l=n+8|0,u=n,g_(e,4827),gE(e,4834,3)|0,_E(e,3682,47)|0,t[s>>2]=9,t[s+4>>2]=0,t[r>>2]=t[s>>2],t[r+4>>2]=t[s+4>>2],Ly(e,4841,r)|0,t[l>>2]=1,t[l+4>>2]=0,t[r>>2]=t[l>>2],t[r+4>>2]=t[l+4>>2],__(e,4871,r)|0,t[u>>2]=10,t[u+4>>2]=0,t[r>>2]=t[u>>2],t[r+4>>2]=t[u+4>>2],EE(e,4891,r)|0,m=n}function g_(e,n){e=e|0,n=n|0;var r=0;r=Qk()|0,t[e>>2]=r,Jk(r,n),Q2(t[e>>2]|0)}function gE(e,n,r){return e=e|0,n=n|0,r=r|0,Fk(e,Or(n)|0,r,0),e|0}function _E(e,n,r){return e=e|0,n=n|0,r=r|0,_k(e,Or(n)|0,r,0),e|0}function Ly(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],ek(e,n,l),m=u,e|0}function __(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],bO(e,n,l),m=u,e|0}function EE(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=t[r+4>>2]|0,t[s>>2]=t[r>>2],t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],DE(e,n,l),m=u,e|0}function DE(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],wE(e,r,l,1),m=u}function wE(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=SE()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=DO(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,wO(s,u)|0,u),m=l}function SE(){var e=0,n=0;if(p[7840]|0||(L3(10100),Ht(48,10100,he|0)|0,n=7840,t[n>>2]=1,t[n+4>>2]=0),!(rr(10100)|0)){e=10100,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));L3(10100)}return 10100}function DO(e){return e=e|0,0}function wO(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=SE()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],N3(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(SO(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function N3(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function SO(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=TO(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,CO(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],N3(s,u,r),t[S>>2]=(t[S>>2]|0)+12,xO(e,D),AO(D),m=M;return}}function TO(e){return e=e|0,357913941}function CO(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function xO(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function AO(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function L3(e){e=e|0,kO(e)}function RO(e){e=e|0,OO(e+24|0)}function OO(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function kO(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,6,n,MO()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function MO(){return 1364}function NO(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;return u=m,m=m+16|0,l=u+8|0,s=u,h=LO(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],r=FO(n,l,r)|0,m=u,r|0}function LO(e){return e=e|0,(t[(SE()|0)+24>>2]|0)+(e*12|0)|0}function FO(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;return s=m,m=m+16|0,l=s,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),Ds(l,r),l=zs(l,r)|0,l=Ml(ZE[u&15](e,l)|0)|0,m=s,l|0}function bO(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],PO(e,r,l,0),m=u}function PO(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=TE()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=IO(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,BO(s,u)|0,u),m=l}function TE(){var e=0,n=0;if(p[7848]|0||(b3(10136),Ht(49,10136,he|0)|0,n=7848,t[n>>2]=1,t[n+4>>2]=0),!(rr(10136)|0)){e=10136,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));b3(10136)}return 10136}function IO(e){return e=e|0,0}function BO(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=TE()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],F3(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(UO(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function F3(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function UO(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=jO(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,zO(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],F3(s,u,r),t[S>>2]=(t[S>>2]|0)+12,qO(e,D),HO(D),m=M;return}}function jO(e){return e=e|0,357913941}function zO(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function qO(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function HO(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function b3(e){e=e|0,GO(e)}function WO(e){e=e|0,VO(e+24|0)}function VO(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function GO(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,9,n,YO()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function YO(){return 1372}function KO(e,n,r){e=e|0,n=n|0,r=+r;var u=0,l=0,s=0,h=0;u=m,m=m+16|0,l=u+8|0,s=u,h=XO(e)|0,e=t[h+4>>2]|0,t[s>>2]=t[h>>2],t[s+4>>2]=e,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],QO(n,l,r),m=u}function XO(e){return e=e|0,(t[(TE()|0)+24>>2]|0)+(e*12|0)|0}function QO(e,n,r){e=e|0,n=n|0,r=+r;var u=0,l=0,s=0,h=St;s=m,m=m+16|0,l=s,u=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(u=t[(t[e>>2]|0)+u>>2]|0),JO(l,r),h=w(ZO(l,r)),X8[u&1](e,h),m=s}function JO(e,n){e=e|0,n=+n}function ZO(e,n){return e=e|0,n=+n,w($O(n))}function $O(e){return e=+e,w(e)}function ek(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,l=u+8|0,s=u,D=t[r>>2]|0,h=t[r+4>>2]|0,r=Or(n)|0,t[s>>2]=D,t[s+4>>2]=h,t[l>>2]=t[s>>2],t[l+4>>2]=t[s+4>>2],tk(e,r,l,0),m=u}function tk(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0,S=0,M=0,O=0;l=m,m=m+32|0,s=l+16|0,O=l+8|0,D=l,M=t[r>>2]|0,S=t[r+4>>2]|0,h=t[e>>2]|0,e=CE()|0,t[O>>2]=M,t[O+4>>2]=S,t[s>>2]=t[O>>2],t[s+4>>2]=t[O+4>>2],r=nk(s)|0,t[D>>2]=M,t[D+4>>2]=S,t[s>>2]=t[D>>2],t[s+4>>2]=t[D+4>>2],vi(h,n,e,r,rk(s,u)|0,u),m=l}function CE(){var e=0,n=0;if(p[7856]|0||(I3(10172),Ht(50,10172,he|0)|0,n=7856,t[n>>2]=1,t[n+4>>2]=0),!(rr(10172)|0)){e=10172,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));I3(10172)}return 10172}function nk(e){return e=e|0,0}function rk(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0;return O=m,m=m+32|0,l=O+24|0,h=O+16|0,D=O,S=O+8|0,s=t[e>>2]|0,u=t[e+4>>2]|0,t[D>>2]=s,t[D+4>>2]=u,P=CE()|0,M=P+24|0,e=dn(n,4)|0,t[S>>2]=e,n=P+28|0,r=t[n>>2]|0,r>>>0<(t[P+32>>2]|0)>>>0?(t[h>>2]=s,t[h+4>>2]=u,t[l>>2]=t[h>>2],t[l+4>>2]=t[h+4>>2],P3(r,l,e),e=(t[n>>2]|0)+12|0,t[n>>2]=e):(ik(M,D,S),e=t[n>>2]|0),m=O,((e-(t[M>>2]|0)|0)/12|0)+-1|0}function P3(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=t[n+4>>2]|0,t[e>>2]=t[n>>2],t[e+4>>2]=u,t[e+8>>2]=r}function ik(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;if(M=m,m=m+48|0,u=M+32|0,h=M+24|0,D=M,S=e+4|0,l=(((t[S>>2]|0)-(t[e>>2]|0)|0)/12|0)+1|0,s=uk(e)|0,s>>>0>>0)li(e);else{O=t[e>>2]|0,K=((t[e+8>>2]|0)-O|0)/12|0,P=K<<1,ok(D,K>>>0>>1>>>0?P>>>0>>0?l:P:s,((t[S>>2]|0)-O|0)/12|0,e+8|0),S=D+8|0,s=t[S>>2]|0,l=t[n+4>>2]|0,r=t[r>>2]|0,t[h>>2]=t[n>>2],t[h+4>>2]=l,t[u>>2]=t[h>>2],t[u+4>>2]=t[h+4>>2],P3(s,u,r),t[S>>2]=(t[S>>2]|0)+12,lk(e,D),sk(D),m=M;return}}function uk(e){return e=e|0,357913941}function ok(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>357913941)Xn();else{l=cn(n*12|0)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r*12|0)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n*12|0)}function lk(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(((l|0)/-12|0)*12|0)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function sk(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~(((u+-12-n|0)>>>0)/12|0)*12|0)),e=t[e>>2]|0,e|0&&yt(e)}function I3(e){e=e|0,ck(e)}function ak(e){e=e|0,fk(e+24|0)}function fk(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~(((n+-12-u|0)>>>0)/12|0)*12|0)),yt(r))}function ck(e){e=e|0;var n=0;n=dr()|0,Pn(e,2,3,n,dk()|0,2),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function dk(){return 1380}function pk(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0;l=m,m=m+16|0,s=l+8|0,h=l,D=hk(e)|0,e=t[D+4>>2]|0,t[h>>2]=t[D>>2],t[h+4>>2]=e,t[s>>2]=t[h>>2],t[s+4>>2]=t[h+4>>2],vk(n,s,r,u),m=l}function hk(e){return e=e|0,(t[(CE()|0)+24>>2]|0)+(e*12|0)|0}function vk(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0;D=m,m=m+16|0,s=D+1|0,h=D,l=t[n>>2]|0,n=t[n+4>>2]|0,e=e+(n>>1)|0,n&1&&(l=t[(t[e>>2]|0)+l>>2]|0),Ds(s,r),s=zs(s,r)|0,mk(h,u),h=yk(h,u)|0,jy[l&15](e,s,h),m=D}function mk(e,n){e=e|0,n=n|0}function yk(e,n){return e=e|0,n=n|0,gk(n)|0}function gk(e){return e=e|0,(e|0)!=0|0}function _k(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=xE()|0,e=Ek(r)|0,vi(s,n,l,e,Dk(r,u)|0,u)}function xE(){var e=0,n=0;if(p[7864]|0||(U3(10208),Ht(51,10208,he|0)|0,n=7864,t[n>>2]=1,t[n+4>>2]=0),!(rr(10208)|0)){e=10208,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));U3(10208)}return 10208}function Ek(e){return e=e|0,e|0}function Dk(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=xE()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(B3(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(wk(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function B3(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function wk(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=Sk(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,Tk(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,B3(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,Ck(e,l),xk(l),m=D;return}}function Sk(e){return e=e|0,536870911}function Tk(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function Ck(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function xk(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function U3(e){e=e|0,Ok(e)}function Ak(e){e=e|0,Rk(e+24|0)}function Rk(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function Ok(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,24,n,kk()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function kk(){return 1392}function Mk(e,n){e=e|0,n=n|0,Lk(t[(Nk(e)|0)>>2]|0,n)}function Nk(e){return e=e|0,(t[(xE()|0)+24>>2]|0)+(e<<3)|0}function Lk(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,N0(u,n),n=Vi(u,n)|0,M1[e&127](n),m=r}function Fk(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=AE()|0,e=bk(r)|0,vi(s,n,l,e,Pk(r,u)|0,u)}function AE(){var e=0,n=0;if(p[7872]|0||(z3(10244),Ht(52,10244,he|0)|0,n=7872,t[n>>2]=1,t[n+4>>2]=0),!(rr(10244)|0)){e=10244,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));z3(10244)}return 10244}function bk(e){return e=e|0,e|0}function Pk(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=AE()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(j3(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(Ik(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function j3(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function Ik(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=Bk(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,Uk(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,j3(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,jk(e,l),zk(l),m=D;return}}function Bk(e){return e=e|0,536870911}function Uk(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function jk(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function zk(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function z3(e){e=e|0,Wk(e)}function qk(e){e=e|0,Hk(e+24|0)}function Hk(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function Wk(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,16,n,Vk()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Vk(){return 1400}function Gk(e){return e=e|0,Kk(t[(Yk(e)|0)>>2]|0)|0}function Yk(e){return e=e|0,(t[(AE()|0)+24>>2]|0)+(e<<3)|0}function Kk(e){return e=e|0,Xk(N_[e&7]()|0)|0}function Xk(e){return e=e|0,e|0}function Qk(){var e=0;return p[7880]|0||(rM(10280),Ht(25,10280,he|0)|0,e=7880,t[e>>2]=1,t[e+4>>2]=0),10280}function Jk(e,n){e=e|0,n=n|0,t[e>>2]=Zk()|0,t[e+4>>2]=$k()|0,t[e+12>>2]=n,t[e+8>>2]=eM()|0,t[e+32>>2]=4}function Zk(){return 11711}function $k(){return 1356}function eM(){return O1()|0}function tM(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,(Pl(u,896)|0)==512?r|0&&(nM(r),yt(r)):n|0&&(eo(n),yt(n))}function nM(e){e=e|0,e=t[e+4>>2]|0,e|0&&J2(e)}function rM(e){e=e|0,Ha(e)}function iM(e){e=e|0,uM(e,4920),oM(e)|0,lM(e)|0}function uM(e,n){e=e|0,n=n|0;var r=0;r=j2()|0,t[e>>2]=r,RM(r,n),Q2(t[e>>2]|0)}function oM(e){e=e|0;var n=0;return n=t[e>>2]|0,Hp(n,gM()|0),e|0}function lM(e){e=e|0;var n=0;return n=t[e>>2]|0,Hp(n,sM()|0),e|0}function sM(){var e=0;return p[7888]|0||(q3(10328),Ht(53,10328,he|0)|0,e=7888,t[e>>2]=1,t[e+4>>2]=0),rr(10328)|0||q3(10328),10328}function Hp(e,n){e=e|0,n=n|0,vi(e,0,n,0,0,0)}function q3(e){e=e|0,cM(e),Wp(e,10)}function aM(e){e=e|0,fM(e+24|0)}function fM(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function cM(e){e=e|0;var n=0;n=dr()|0,Pn(e,5,1,n,vM()|0,2),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function dM(e,n,r){e=e|0,n=n|0,r=+r,pM(e,n,r)}function Wp(e,n){e=e|0,n=n|0,t[e+20>>2]=n}function pM(e,n,r){e=e|0,n=n|0,r=+r;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+16|0,s=u+8|0,D=u+13|0,l=u,h=u+12|0,Ds(D,n),t[s>>2]=zs(D,n)|0,Ol(h,r),U[l>>3]=+es(h,r),hM(e,s,l),m=u}function hM(e,n,r){e=e|0,n=n|0,r=r|0,I(e+8|0,t[n>>2]|0,+U[r>>3]),p[e+24>>0]=1}function vM(){return 1404}function mM(e,n){return e=e|0,n=+n,yM(e,n)|0}function yM(e,n){e=e|0,n=+n;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return u=m,m=m+16|0,s=u+4|0,h=u+8|0,D=u,l=Sa(8)|0,r=l,S=cn(16)|0,Ds(s,e),e=zs(s,e)|0,Ol(h,n),I(S,e,+es(h,n)),h=r+4|0,t[h>>2]=S,e=cn(8)|0,h=t[h>>2]|0,t[D>>2]=0,t[s>>2]=t[D>>2],Nf(e,h,s),t[l>>2]=e,m=u,r|0}function gM(){var e=0;return p[7896]|0||(H3(10364),Ht(54,10364,he|0)|0,e=7896,t[e>>2]=1,t[e+4>>2]=0),rr(10364)|0||H3(10364),10364}function H3(e){e=e|0,DM(e),Wp(e,55)}function _M(e){e=e|0,EM(e+24|0)}function EM(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function DM(e){e=e|0;var n=0;n=dr()|0,Pn(e,5,4,n,CM()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function wM(e){e=e|0,SM(e)}function SM(e){e=e|0,TM(e)}function TM(e){e=e|0,W3(e+8|0),p[e+24>>0]=1}function W3(e){e=e|0,t[e>>2]=0,U[e+8>>3]=0}function CM(){return 1424}function xM(){return AM()|0}function AM(){var e=0,n=0,r=0,u=0,l=0,s=0,h=0;return n=m,m=m+16|0,l=n+4|0,h=n,r=Sa(8)|0,e=r,u=cn(16)|0,W3(u),s=e+4|0,t[s>>2]=u,u=cn(8)|0,s=t[s>>2]|0,t[h>>2]=0,t[l>>2]=t[h>>2],Nf(u,s,l),t[r>>2]=u,m=n,e|0}function RM(e,n){e=e|0,n=n|0,t[e>>2]=OM()|0,t[e+4>>2]=kM()|0,t[e+12>>2]=n,t[e+8>>2]=MM()|0,t[e+32>>2]=5}function OM(){return 11710}function kM(){return 1416}function MM(){return E_()|0}function NM(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,(Pl(u,896)|0)==512?r|0&&(LM(r),yt(r)):n|0&&yt(n)}function LM(e){e=e|0,e=t[e+4>>2]|0,e|0&&J2(e)}function E_(){var e=0;return p[7904]|0||(t[2600]=FM()|0,t[2601]=0,e=7904,t[e>>2]=1,t[e+4>>2]=0),10400}function FM(){return t[357]|0}function bM(e){e=e|0,PM(e,4926),IM(e)|0}function PM(e,n){e=e|0,n=n|0;var r=0;r=qa()|0,t[e>>2]=r,KM(r,n),Q2(t[e>>2]|0)}function IM(e){e=e|0;var n=0;return n=t[e>>2]|0,Hp(n,BM()|0),e|0}function BM(){var e=0;return p[7912]|0||(V3(10412),Ht(56,10412,he|0)|0,e=7912,t[e>>2]=1,t[e+4>>2]=0),rr(10412)|0||V3(10412),10412}function V3(e){e=e|0,zM(e),Wp(e,57)}function UM(e){e=e|0,jM(e+24|0)}function jM(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function zM(e){e=e|0;var n=0;n=dr()|0,Pn(e,5,5,n,VM()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function qM(e){e=e|0,HM(e)}function HM(e){e=e|0,WM(e)}function WM(e){e=e|0;var n=0,r=0;n=e+8|0,r=n+48|0;do t[n>>2]=0,n=n+4|0;while((n|0)<(r|0));p[e+56>>0]=1}function VM(){return 1432}function GM(){return YM()|0}function YM(){var e=0,n=0,r=0,u=0,l=0,s=0,h=0,D=0;h=m,m=m+16|0,e=h+4|0,n=h,r=Sa(8)|0,u=r,l=cn(48)|0,s=l,D=s+48|0;do t[s>>2]=0,s=s+4|0;while((s|0)<(D|0));return s=u+4|0,t[s>>2]=l,D=cn(8)|0,s=t[s>>2]|0,t[n>>2]=0,t[e>>2]=t[n>>2],Dh(D,s,e),t[r>>2]=D,m=h,u|0}function KM(e,n){e=e|0,n=n|0,t[e>>2]=XM()|0,t[e+4>>2]=QM()|0,t[e+12>>2]=n,t[e+8>>2]=JM()|0,t[e+32>>2]=6}function XM(){return 11704}function QM(){return 1436}function JM(){return E_()|0}function ZM(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,(Pl(u,896)|0)==512?r|0&&($M(r),yt(r)):n|0&&yt(n)}function $M(e){e=e|0,e=t[e+4>>2]|0,e|0&&J2(e)}function eN(e){e=e|0,tN(e,4933),nN(e)|0,rN(e)|0}function tN(e,n){e=e|0,n=n|0;var r=0;r=AN()|0,t[e>>2]=r,RN(r,n),Q2(t[e>>2]|0)}function nN(e){e=e|0;var n=0;return n=t[e>>2]|0,Hp(n,yN()|0),e|0}function rN(e){e=e|0;var n=0;return n=t[e>>2]|0,Hp(n,iN()|0),e|0}function iN(){var e=0;return p[7920]|0||(G3(10452),Ht(58,10452,he|0)|0,e=7920,t[e>>2]=1,t[e+4>>2]=0),rr(10452)|0||G3(10452),10452}function G3(e){e=e|0,lN(e),Wp(e,1)}function uN(e){e=e|0,oN(e+24|0)}function oN(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function lN(e){e=e|0;var n=0;n=dr()|0,Pn(e,5,1,n,cN()|0,2),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function sN(e,n,r){e=e|0,n=+n,r=+r,aN(e,n,r)}function aN(e,n,r){e=e|0,n=+n,r=+r;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+32|0,s=u+8|0,D=u+17|0,l=u,h=u+16|0,Ol(D,n),U[s>>3]=+es(D,n),Ol(h,r),U[l>>3]=+es(h,r),fN(e,s,l),m=u}function fN(e,n,r){e=e|0,n=n|0,r=r|0,Y3(e+8|0,+U[n>>3],+U[r>>3]),p[e+24>>0]=1}function Y3(e,n,r){e=e|0,n=+n,r=+r,U[e>>3]=n,U[e+8>>3]=r}function cN(){return 1472}function dN(e,n){return e=+e,n=+n,pN(e,n)|0}function pN(e,n){e=+e,n=+n;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return u=m,m=m+16|0,h=u+4|0,D=u+8|0,S=u,l=Sa(8)|0,r=l,s=cn(16)|0,Ol(h,e),e=+es(h,e),Ol(D,n),Y3(s,e,+es(D,n)),D=r+4|0,t[D>>2]=s,s=cn(8)|0,D=t[D>>2]|0,t[S>>2]=0,t[h>>2]=t[S>>2],K3(s,D,h),t[l>>2]=s,m=u,r|0}function K3(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,r=cn(16)|0,t[r+4>>2]=0,t[r+8>>2]=0,t[r>>2]=1452,t[r+12>>2]=n,t[e+4>>2]=r}function hN(e){e=e|0,Pv(e),yt(e)}function vN(e){e=e|0,e=t[e+12>>2]|0,e|0&&yt(e)}function mN(e){e=e|0,yt(e)}function yN(){var e=0;return p[7928]|0||(X3(10488),Ht(59,10488,he|0)|0,e=7928,t[e>>2]=1,t[e+4>>2]=0),rr(10488)|0||X3(10488),10488}function X3(e){e=e|0,EN(e),Wp(e,60)}function gN(e){e=e|0,_N(e+24|0)}function _N(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function EN(e){e=e|0;var n=0;n=dr()|0,Pn(e,5,6,n,TN()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function DN(e){e=e|0,wN(e)}function wN(e){e=e|0,SN(e)}function SN(e){e=e|0,Q3(e+8|0),p[e+24>>0]=1}function Q3(e){e=e|0,t[e>>2]=0,t[e+4>>2]=0,t[e+8>>2]=0,t[e+12>>2]=0}function TN(){return 1492}function CN(){return xN()|0}function xN(){var e=0,n=0,r=0,u=0,l=0,s=0,h=0;return n=m,m=m+16|0,l=n+4|0,h=n,r=Sa(8)|0,e=r,u=cn(16)|0,Q3(u),s=e+4|0,t[s>>2]=u,u=cn(8)|0,s=t[s>>2]|0,t[h>>2]=0,t[l>>2]=t[h>>2],K3(u,s,l),t[r>>2]=u,m=n,e|0}function AN(){var e=0;return p[7936]|0||(FN(10524),Ht(25,10524,he|0)|0,e=7936,t[e>>2]=1,t[e+4>>2]=0),10524}function RN(e,n){e=e|0,n=n|0,t[e>>2]=ON()|0,t[e+4>>2]=kN()|0,t[e+12>>2]=n,t[e+8>>2]=MN()|0,t[e+32>>2]=7}function ON(){return 11700}function kN(){return 1484}function MN(){return E_()|0}function NN(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,(Pl(u,896)|0)==512?r|0&&(LN(r),yt(r)):n|0&&yt(n)}function LN(e){e=e|0,e=t[e+4>>2]|0,e|0&&J2(e)}function FN(e){e=e|0,Ha(e)}function bN(e,n,r){e=e|0,n=n|0,r=r|0,e=Or(n)|0,n=PN(r)|0,r=IN(r,0)|0,pL(e,n,r,RE()|0,0)}function PN(e){return e=e|0,e|0}function IN(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=RE()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(Z3(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(WN(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function RE(){var e=0,n=0;if(p[7944]|0||(J3(10568),Ht(61,10568,he|0)|0,n=7944,t[n>>2]=1,t[n+4>>2]=0),!(rr(10568)|0)){e=10568,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));J3(10568)}return 10568}function J3(e){e=e|0,jN(e)}function BN(e){e=e|0,UN(e+24|0)}function UN(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function jN(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,17,n,Jh()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function zN(e){return e=e|0,HN(t[(qN(e)|0)>>2]|0)|0}function qN(e){return e=e|0,(t[(RE()|0)+24>>2]|0)+(e<<3)|0}function HN(e){return e=e|0,z0(N_[e&7]()|0)|0}function Z3(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function WN(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=VN(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,GN(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,Z3(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,YN(e,l),KN(l),m=D;return}}function VN(e){return e=e|0,536870911}function GN(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function YN(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function KN(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function XN(){QN()}function QN(){JN(10604)}function JN(e){e=e|0,ZN(e,4955)}function ZN(e,n){e=e|0,n=n|0;var r=0;r=$N()|0,t[e>>2]=r,eL(r,n),Q2(t[e>>2]|0)}function $N(){var e=0;return p[7952]|0||(aL(10612),Ht(25,10612,he|0)|0,e=7952,t[e>>2]=1,t[e+4>>2]=0),10612}function eL(e,n){e=e|0,n=n|0,t[e>>2]=iL()|0,t[e+4>>2]=uL()|0,t[e+12>>2]=n,t[e+8>>2]=oL()|0,t[e+32>>2]=8}function Q2(e){e=e|0;var n=0,r=0;n=m,m=m+16|0,r=n,Mv()|0,t[r>>2]=e,tL(10608,r),m=n}function Mv(){return p[11714]|0||(t[2652]=0,Ht(62,10608,he|0)|0,p[11714]=1),10608}function tL(e,n){e=e|0,n=n|0;var r=0;r=cn(8)|0,t[r+4>>2]=t[n>>2],t[r>>2]=t[e>>2],t[e>>2]=r}function nL(e){e=e|0,rL(e)}function rL(e){e=e|0;var n=0,r=0;if(n=t[e>>2]|0,n|0)do r=n,n=t[n>>2]|0,yt(r);while((n|0)!=0);t[e>>2]=0}function iL(){return 11715}function uL(){return 1496}function oL(){return O1()|0}function lL(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,(Pl(u,896)|0)==512?r|0&&(sL(r),yt(r)):n|0&&yt(n)}function sL(e){e=e|0,e=t[e+4>>2]|0,e|0&&J2(e)}function aL(e){e=e|0,Ha(e)}function fL(e,n){e=e|0,n=n|0;var r=0,u=0;Mv()|0,r=t[2652]|0;e:do if(r|0){for(;u=t[r+4>>2]|0,!(u|0?(L8(OE(u)|0,e)|0)==0:0);)if(r=t[r>>2]|0,!r)break e;cL(u,n)}while(0)}function OE(e){return e=e|0,t[e+12>>2]|0}function cL(e,n){e=e|0,n=n|0;var r=0;e=e+36|0,r=t[e>>2]|0,r|0&&(ia(r),yt(r)),r=cn(4)|0,mf(r,n),t[e>>2]=r}function kE(){return p[11716]|0||(t[2664]=0,Ht(63,10656,he|0)|0,p[11716]=1),10656}function $3(){var e=0;return p[11717]|0?e=t[2665]|0:(dL(),t[2665]=1504,p[11717]=1,e=1504),e|0}function dL(){p[11740]|0||(p[11718]=dn(dn(8,0)|0,0)|0,p[11719]=dn(dn(0,0)|0,0)|0,p[11720]=dn(dn(0,16)|0,0)|0,p[11721]=dn(dn(8,0)|0,0)|0,p[11722]=dn(dn(0,0)|0,0)|0,p[11723]=dn(dn(8,0)|0,0)|0,p[11724]=dn(dn(0,0)|0,0)|0,p[11725]=dn(dn(8,0)|0,0)|0,p[11726]=dn(dn(0,0)|0,0)|0,p[11727]=dn(dn(8,0)|0,0)|0,p[11728]=dn(dn(0,0)|0,0)|0,p[11729]=dn(dn(0,0)|0,32)|0,p[11730]=dn(dn(0,0)|0,32)|0,p[11740]=1)}function e8(){return 1572}function pL(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0;var s=0,h=0,D=0,S=0,M=0,O=0;s=m,m=m+32|0,O=s+16|0,M=s+12|0,S=s+8|0,D=s+4|0,h=s,t[O>>2]=e,t[M>>2]=n,t[S>>2]=r,t[D>>2]=u,t[h>>2]=l,kE()|0,hL(10656,O,M,S,D,h),m=s}function hL(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0;var h=0;h=cn(24)|0,h2(h+4|0,t[n>>2]|0,t[r>>2]|0,t[u>>2]|0,t[l>>2]|0,t[s>>2]|0),t[h>>2]=t[e>>2],t[e>>2]=h}function t8(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0,Ee=0,ve=0,Qe=0,We=0,st=0;if(st=m,m=m+32|0,Ee=st+20|0,ve=st+8|0,Qe=st+4|0,We=st,n=t[n>>2]|0,n|0){Pe=Ee+4|0,S=Ee+8|0,M=ve+4|0,O=ve+8|0,P=ve+8|0,K=Ee+8|0;do{if(h=n+4|0,D=ME(h)|0,D|0){if(l=Fy(D)|0,t[Ee>>2]=0,t[Pe>>2]=0,t[S>>2]=0,u=(by(D)|0)+1|0,vL(Ee,u),u|0)for(;u=u+-1|0,jf(ve,t[l>>2]|0),s=t[Pe>>2]|0,s>>>0<(t[K>>2]|0)>>>0?(t[s>>2]=t[ve>>2],t[Pe>>2]=(t[Pe>>2]|0)+4):NE(Ee,ve),u;)l=l+4|0;u=Py(D)|0,t[ve>>2]=0,t[M>>2]=0,t[O>>2]=0;e:do if(t[u>>2]|0)for(l=0,s=0;;){if((l|0)==(s|0)?mL(ve,u):(t[l>>2]=t[u>>2],t[M>>2]=(t[M>>2]|0)+4),u=u+4|0,!(t[u>>2]|0))break e;l=t[M>>2]|0,s=t[P>>2]|0}while(0);t[Qe>>2]=D_(h)|0,t[We>>2]=rr(D)|0,yL(r,e,Qe,We,Ee,ve),LE(ve),k1(Ee)}n=t[n>>2]|0}while((n|0)!=0)}m=st}function ME(e){return e=e|0,t[e+12>>2]|0}function Fy(e){return e=e|0,t[e+12>>2]|0}function by(e){return e=e|0,t[e+16>>2]|0}function vL(e,n){e=e|0,n=n|0;var r=0,u=0,l=0;l=m,m=m+32|0,r=l,u=t[e>>2]|0,(t[e+8>>2]|0)-u>>2>>>0>>0&&(a8(r,n,(t[e+4>>2]|0)-u>>2,e+8|0),f8(e,r),c8(r)),m=l}function NE(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0;if(h=m,m=m+32|0,r=h,u=e+4|0,l=((t[u>>2]|0)-(t[e>>2]|0)>>2)+1|0,s=s8(e)|0,s>>>0>>0)li(e);else{D=t[e>>2]|0,M=(t[e+8>>2]|0)-D|0,S=M>>1,a8(r,M>>2>>>0>>1>>>0?S>>>0>>0?l:S:s,(t[u>>2]|0)-D>>2,e+8|0),s=r+8|0,t[t[s>>2]>>2]=t[n>>2],t[s>>2]=(t[s>>2]|0)+4,f8(e,r),c8(r),m=h;return}}function Py(e){return e=e|0,t[e+8>>2]|0}function mL(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0;if(h=m,m=m+32|0,r=h,u=e+4|0,l=((t[u>>2]|0)-(t[e>>2]|0)>>2)+1|0,s=l8(e)|0,s>>>0>>0)li(e);else{D=t[e>>2]|0,M=(t[e+8>>2]|0)-D|0,S=M>>1,PL(r,M>>2>>>0>>1>>>0?S>>>0>>0?l:S:s,(t[u>>2]|0)-D>>2,e+8|0),s=r+8|0,t[t[s>>2]>>2]=t[n>>2],t[s>>2]=(t[s>>2]|0)+4,IL(e,r),BL(r),m=h;return}}function D_(e){return e=e|0,t[e>>2]|0}function yL(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,gL(e,n,r,u,l,s)}function LE(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-4-u|0)>>>2)<<2)),yt(r))}function k1(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-4-u|0)>>>2)<<2)),yt(r))}function gL(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0;var h=0,D=0,S=0,M=0,O=0,P=0;h=m,m=m+48|0,O=h+40|0,D=h+32|0,P=h+24|0,S=h+12|0,M=h,Ta(D),e=vo(e)|0,t[P>>2]=t[n>>2],r=t[r>>2]|0,u=t[u>>2]|0,FE(S,l),_L(M,s),t[O>>2]=t[P>>2],EL(e,O,r,u,S,M),LE(M),k1(S),Ca(D),m=h}function FE(e,n){e=e|0,n=n|0;var r=0,u=0;t[e>>2]=0,t[e+4>>2]=0,t[e+8>>2]=0,r=n+4|0,u=(t[r>>2]|0)-(t[n>>2]|0)>>2,u|0&&(FL(e,u),bL(e,t[n>>2]|0,t[r>>2]|0,u))}function _L(e,n){e=e|0,n=n|0;var r=0,u=0;t[e>>2]=0,t[e+4>>2]=0,t[e+8>>2]=0,r=n+4|0,u=(t[r>>2]|0)-(t[n>>2]|0)>>2,u|0&&(NL(e,u),LL(e,t[n>>2]|0,t[r>>2]|0,u))}function EL(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0;var h=0,D=0,S=0,M=0,O=0,P=0;h=m,m=m+32|0,O=h+28|0,P=h+24|0,D=h+12|0,S=h,M=mo(DL()|0)|0,t[P>>2]=t[n>>2],t[O>>2]=t[P>>2],n=Vp(O)|0,r=n8(r)|0,u=bE(u)|0,t[D>>2]=t[l>>2],O=l+4|0,t[D+4>>2]=t[O>>2],P=l+8|0,t[D+8>>2]=t[P>>2],t[P>>2]=0,t[O>>2]=0,t[l>>2]=0,l=PE(D)|0,t[S>>2]=t[s>>2],O=s+4|0,t[S+4>>2]=t[O>>2],P=s+8|0,t[S+8>>2]=t[P>>2],t[P>>2]=0,t[O>>2]=0,t[s>>2]=0,G0(0,M|0,e|0,n|0,r|0,u|0,l|0,wL(S)|0)|0,LE(S),k1(D),m=h}function DL(){var e=0;return p[7968]|0||(kL(10708),e=7968,t[e>>2]=1,t[e+4>>2]=0),10708}function Vp(e){return e=e|0,i8(e)|0}function n8(e){return e=e|0,r8(e)|0}function bE(e){return e=e|0,z0(e)|0}function PE(e){return e=e|0,TL(e)|0}function wL(e){return e=e|0,SL(e)|0}function SL(e){e=e|0;var n=0,r=0,u=0;if(u=(t[e+4>>2]|0)-(t[e>>2]|0)|0,r=u>>2,u=Sa(u+4|0)|0,t[u>>2]=r,r|0){n=0;do t[u+4+(n<<2)>>2]=r8(t[(t[e>>2]|0)+(n<<2)>>2]|0)|0,n=n+1|0;while((n|0)!=(r|0))}return u|0}function r8(e){return e=e|0,e|0}function TL(e){e=e|0;var n=0,r=0,u=0;if(u=(t[e+4>>2]|0)-(t[e>>2]|0)|0,r=u>>2,u=Sa(u+4|0)|0,t[u>>2]=r,r|0){n=0;do t[u+4+(n<<2)>>2]=i8((t[e>>2]|0)+(n<<2)|0)|0,n=n+1|0;while((n|0)!=(r|0))}return u|0}function i8(e){e=e|0;var n=0,r=0,u=0,l=0;return l=m,m=m+32|0,n=l+12|0,r=l,u=Ou(u8()|0)|0,u?(Zl(n,u),Tf(r,n),lI(e,r),e=Es(n)|0):e=CL(e)|0,m=l,e|0}function u8(){var e=0;return p[7960]|0||(OL(10664),Ht(25,10664,he|0)|0,e=7960,t[e>>2]=1,t[e+4>>2]=0),10664}function CL(e){e=e|0;var n=0,r=0,u=0,l=0,s=0,h=0,D=0;return r=m,m=m+16|0,l=r+4|0,h=r,u=Sa(8)|0,n=u,D=cn(4)|0,t[D>>2]=t[e>>2],s=n+4|0,t[s>>2]=D,e=cn(8)|0,s=t[s>>2]|0,t[h>>2]=0,t[l>>2]=t[h>>2],o8(e,s,l),t[u>>2]=e,m=r,n|0}function o8(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,r=cn(16)|0,t[r+4>>2]=0,t[r+8>>2]=0,t[r>>2]=1656,t[r+12>>2]=n,t[e+4>>2]=r}function xL(e){e=e|0,Pv(e),yt(e)}function AL(e){e=e|0,e=t[e+12>>2]|0,e|0&&yt(e)}function RL(e){e=e|0,yt(e)}function OL(e){e=e|0,Ha(e)}function kL(e){e=e|0,nl(e,ML()|0,5)}function ML(){return 1676}function NL(e,n){e=e|0,n=n|0;var r=0;if((l8(e)|0)>>>0>>0&&li(e),n>>>0>1073741823)Xn();else{r=cn(n<<2)|0,t[e+4>>2]=r,t[e>>2]=r,t[e+8>>2]=r+(n<<2);return}}function LL(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,u=e+4|0,e=r-n|0,(e|0)>0&&(pr(t[u>>2]|0,n|0,e|0)|0,t[u>>2]=(t[u>>2]|0)+(e>>>2<<2))}function l8(e){return e=e|0,1073741823}function FL(e,n){e=e|0,n=n|0;var r=0;if((s8(e)|0)>>>0>>0&&li(e),n>>>0>1073741823)Xn();else{r=cn(n<<2)|0,t[e+4>>2]=r,t[e>>2]=r,t[e+8>>2]=r+(n<<2);return}}function bL(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,u=e+4|0,e=r-n|0,(e|0)>0&&(pr(t[u>>2]|0,n|0,e|0)|0,t[u>>2]=(t[u>>2]|0)+(e>>>2<<2))}function s8(e){return e=e|0,1073741823}function PL(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>1073741823)Xn();else{l=cn(n<<2)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<2)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<2)}function IL(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>2)<<2)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function BL(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-4-n|0)>>>2)<<2)),e=t[e>>2]|0,e|0&&yt(e)}function a8(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>1073741823)Xn();else{l=cn(n<<2)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<2)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<2)}function f8(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4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[K>>2]|0,h|0){t[O>>2]=0,t[e>>2]=0,t[n>>2]=0;do jf(Pe,t[(Nv(t[h+4>>2]|0)|0)>>2]|0),D=t[e>>2]|0,D>>>0<(t[r>>2]|0)>>>0?(t[D>>2]=t[Pe>>2],t[e>>2]=(t[e>>2]|0)+4):NE(O,Pe),h=t[h>>2]|0;while((h|0)!=0);WL(u,P,O),k1(O)}t[Ee>>2]=t[P>>2],M=p8(S)|0,t[O>>2]=t[Ee>>2],t8(O,M,l),m2(K),s=t[s>>2]|0}while((s|0)!=0)}m=ve}function jL(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,rF(e,n,r,u)}function zL(e,n,r){e=e|0,n=n|0,r=r|0,nF(e,n,r)}function Nv(e){return e=e|0,e|0}function qL(e,n,r){e=e|0,n=n|0,r=r|0,ZL(e,n,r)}function d8(e){return e=e|0,e+16|0}function HL(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;if(s=m,m=m+16|0,l=s+8|0,r=s,t[e>>2]=0,u=t[n>>2]|0,t[l>>2]=u,t[r>>2]=e,r=JL(r)|0,u|0){if(u=cn(12)|0,h=(h8(l)|0)+4|0,e=t[h+4>>2]|0,n=u+4|0,t[n>>2]=t[h>>2],t[n+4>>2]=e,n=t[t[l>>2]>>2]|0,t[l>>2]=n,!n)e=u;else for(n=u;e=cn(12)|0,S=(h8(l)|0)+4|0,D=t[S+4>>2]|0,h=e+4|0,t[h>>2]=t[S>>2],t[h+4>>2]=D,t[n>>2]=e,h=t[t[l>>2]>>2]|0,t[l>>2]=h,h;)n=e;t[e>>2]=t[r>>2],t[r>>2]=u}m=s}function WL(e,n,r){e=e|0,n=n|0,r=r|0,VL(e,n,r)}function p8(e){return e=e|0,e+24|0}function VL(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+32|0,h=u+24|0,l=u+16|0,D=u+12|0,s=u,Ta(l),e=vo(e)|0,t[D>>2]=t[n>>2],FE(s,r),t[h>>2]=t[D>>2],YL(e,h,s),k1(s),Ca(l),m=u}function YL(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=m,m=m+32|0,h=u+16|0,D=u+12|0,l=u,s=mo(KL()|0)|0,t[D>>2]=t[n>>2],t[h>>2]=t[D>>2],n=Vp(h)|0,t[l>>2]=t[r>>2],h=r+4|0,t[l+4>>2]=t[h>>2],D=r+8|0,t[l+8>>2]=t[D>>2],t[D>>2]=0,t[h>>2]=0,t[r>>2]=0,F0(0,s|0,e|0,n|0,PE(l)|0)|0,k1(l),m=u}function KL(){var e=0;return p[7976]|0||(XL(10720),e=7976,t[e>>2]=1,t[e+4>>2]=0),10720}function XL(e){e=e|0,nl(e,QL()|0,2)}function QL(){return 1732}function JL(e){return e=e|0,t[e>>2]|0}function h8(e){return e=e|0,t[e>>2]|0}function ZL(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;u=m,m=m+32|0,s=u+16|0,l=u+8|0,h=u,Ta(l),e=vo(e)|0,t[h>>2]=t[n>>2],r=t[r>>2]|0,t[s>>2]=t[h>>2],v8(e,s,r),Ca(l),m=u}function v8(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;u=m,m=m+16|0,s=u+4|0,h=u,l=mo($L()|0)|0,t[h>>2]=t[n>>2],t[s>>2]=t[h>>2],n=Vp(s)|0,F0(0,l|0,e|0,n|0,n8(r)|0)|0,m=u}function $L(){var e=0;return p[7984]|0||(eF(10732),e=7984,t[e>>2]=1,t[e+4>>2]=0),10732}function eF(e){e=e|0,nl(e,tF()|0,2)}function tF(){return 1744}function nF(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;u=m,m=m+32|0,s=u+16|0,l=u+8|0,h=u,Ta(l),e=vo(e)|0,t[h>>2]=t[n>>2],r=t[r>>2]|0,t[s>>2]=t[h>>2],v8(e,s,r),Ca(l),m=u}function rF(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0;l=m,m=m+32|0,h=l+16|0,s=l+8|0,D=l,Ta(s),e=vo(e)|0,t[D>>2]=t[n>>2],r=p[r>>0]|0,u=p[u>>0]|0,t[h>>2]=t[D>>2],iF(e,h,r,u),Ca(s),m=l}function iF(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0;l=m,m=m+16|0,h=l+4|0,D=l,s=mo(uF()|0)|0,t[D>>2]=t[n>>2],t[h>>2]=t[D>>2],n=Vp(h)|0,r=Lv(r)|0,Bn(0,s|0,e|0,n|0,r|0,Lv(u)|0)|0,m=l}function uF(){var e=0;return p[7992]|0||(lF(10744),e=7992,t[e>>2]=1,t[e+4>>2]=0),10744}function Lv(e){return e=e|0,oF(e)|0}function oF(e){return e=e|0,e&255|0}function lF(e){e=e|0,nl(e,sF()|0,3)}function sF(){return 1756}function aF(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;switch(K=m,m=m+32|0,D=K+8|0,S=K+4|0,M=K+20|0,O=K,ma(e,0),u=oI(n)|0,t[D>>2]=0,P=D+4|0,t[P>>2]=0,t[D+8>>2]=0,u<<24>>24){case 0:{p[M>>0]=0,fF(S,r,M),w_(e,S)|0,B0(S);break}case 8:{P=qE(n)|0,p[M>>0]=8,jf(O,t[P+4>>2]|0),cF(S,r,M,O,P+8|0),w_(e,S)|0,B0(S);break}case 9:{if(s=qE(n)|0,n=t[s+4>>2]|0,n|0)for(h=D+8|0,l=s+12|0;n=n+-1|0,jf(S,t[l>>2]|0),u=t[P>>2]|0,u>>>0<(t[h>>2]|0)>>>0?(t[u>>2]=t[S>>2],t[P>>2]=(t[P>>2]|0)+4):NE(D,S),n;)l=l+4|0;p[M>>0]=9,jf(O,t[s+8>>2]|0),dF(S,r,M,O,D),w_(e,S)|0,B0(S);break}default:P=qE(n)|0,p[M>>0]=u,jf(O,t[P+4>>2]|0),pF(S,r,M,O),w_(e,S)|0,B0(S)}k1(D),m=K}function fF(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0;u=m,m=m+16|0,l=u,Ta(l),n=vo(n)|0,xF(e,n,p[r>>0]|0),Ca(l),m=u}function w_(e,n){e=e|0,n=n|0;var r=0;return r=t[e>>2]|0,r|0&&Ir(r|0),t[e>>2]=t[n>>2],t[n>>2]=0,e|0}function cF(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0;var s=0,h=0,D=0,S=0;s=m,m=m+32|0,D=s+16|0,h=s+8|0,S=s,Ta(h),n=vo(n)|0,r=p[r>>0]|0,t[S>>2]=t[u>>2],l=t[l>>2]|0,t[D>>2]=t[S>>2],wF(e,n,r,D,l),Ca(h),m=s}function dF(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0;var s=0,h=0,D=0,S=0,M=0;s=m,m=m+32|0,S=s+24|0,h=s+16|0,M=s+12|0,D=s,Ta(h),n=vo(n)|0,r=p[r>>0]|0,t[M>>2]=t[u>>2],FE(D,l),t[S>>2]=t[M>>2],gF(e,n,r,S,D),k1(D),Ca(h),m=s}function pF(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0;l=m,m=m+32|0,h=l+16|0,s=l+8|0,D=l,Ta(s),n=vo(n)|0,r=p[r>>0]|0,t[D>>2]=t[u>>2],t[h>>2]=t[D>>2],hF(e,n,r,h),Ca(s),m=l}function hF(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0,h=0,D=0;l=m,m=m+16|0,s=l+4|0,D=l,h=mo(vF()|0)|0,r=Lv(r)|0,t[D>>2]=t[u>>2],t[s>>2]=t[D>>2],S_(e,F0(0,h|0,n|0,r|0,Vp(s)|0)|0),m=l}function vF(){var e=0;return p[8e3]|0||(mF(10756),e=8e3,t[e>>2]=1,t[e+4>>2]=0),10756}function S_(e,n){e=e|0,n=n|0,ma(e,n)}function mF(e){e=e|0,nl(e,yF()|0,2)}function yF(){return 1772}function gF(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0;var s=0,h=0,D=0,S=0,M=0;s=m,m=m+32|0,S=s+16|0,M=s+12|0,h=s,D=mo(_F()|0)|0,r=Lv(r)|0,t[M>>2]=t[u>>2],t[S>>2]=t[M>>2],u=Vp(S)|0,t[h>>2]=t[l>>2],S=l+4|0,t[h+4>>2]=t[S>>2],M=l+8|0,t[h+8>>2]=t[M>>2],t[M>>2]=0,t[S>>2]=0,t[l>>2]=0,S_(e,Bn(0,D|0,n|0,r|0,u|0,PE(h)|0)|0),k1(h),m=s}function _F(){var e=0;return p[8008]|0||(EF(10768),e=8008,t[e>>2]=1,t[e+4>>2]=0),10768}function EF(e){e=e|0,nl(e,DF()|0,3)}function DF(){return 1784}function wF(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0;var s=0,h=0,D=0,S=0;s=m,m=m+16|0,D=s+4|0,S=s,h=mo(SF()|0)|0,r=Lv(r)|0,t[S>>2]=t[u>>2],t[D>>2]=t[S>>2],u=Vp(D)|0,S_(e,Bn(0,h|0,n|0,r|0,u|0,bE(l)|0)|0),m=s}function SF(){var e=0;return p[8016]|0||(TF(10780),e=8016,t[e>>2]=1,t[e+4>>2]=0),10780}function TF(e){e=e|0,nl(e,CF()|0,3)}function CF(){return 1800}function xF(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;u=mo(AF()|0)|0,S_(e,ji(0,u|0,n|0,Lv(r)|0)|0)}function AF(){var e=0;return p[8024]|0||(RF(10792),e=8024,t[e>>2]=1,t[e+4>>2]=0),10792}function RF(e){e=e|0,nl(e,OF()|0,1)}function OF(){return 1816}function kF(){MF(),NF(),LF()}function MF(){t[2702]=H8(65536)|0}function NF(){$F(10856)}function LF(){FF(10816)}function FF(e){e=e|0,bF(e,5044),PF(e)|0}function bF(e,n){e=e|0,n=n|0;var r=0;r=u8()|0,t[e>>2]=r,YF(r,n),Q2(t[e>>2]|0)}function PF(e){e=e|0;var n=0;return n=t[e>>2]|0,Hp(n,IF()|0),e|0}function IF(){var e=0;return p[8032]|0||(m8(10820),Ht(64,10820,he|0)|0,e=8032,t[e>>2]=1,t[e+4>>2]=0),rr(10820)|0||m8(10820),10820}function m8(e){e=e|0,jF(e),Wp(e,25)}function BF(e){e=e|0,UF(e+24|0)}function UF(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function jF(e){e=e|0;var n=0;n=dr()|0,Pn(e,5,18,n,WF()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function zF(e,n){e=e|0,n=n|0,qF(e,n)}function qF(e,n){e=e|0,n=n|0;var r=0,u=0,l=0;r=m,m=m+16|0,u=r,l=r+4|0,Of(l,n),t[u>>2]=kf(l,n)|0,HF(e,u),m=r}function HF(e,n){e=e|0,n=n|0,y8(e+4|0,t[n>>2]|0),p[e+8>>0]=1}function y8(e,n){e=e|0,n=n|0,t[e>>2]=n}function WF(){return 1824}function VF(e){return e=e|0,GF(e)|0}function GF(e){e=e|0;var n=0,r=0,u=0,l=0,s=0,h=0,D=0;return r=m,m=m+16|0,l=r+4|0,h=r,u=Sa(8)|0,n=u,D=cn(4)|0,Of(l,e),y8(D,kf(l,e)|0),s=n+4|0,t[s>>2]=D,e=cn(8)|0,s=t[s>>2]|0,t[h>>2]=0,t[l>>2]=t[h>>2],o8(e,s,l),t[u>>2]=e,m=r,n|0}function Sa(e){e=e|0;var n=0,r=0;return e=e+7&-8,(e>>>0<=32768?(n=t[2701]|0,e>>>0<=(65536-n|0)>>>0):0)?(r=(t[2702]|0)+n|0,t[2701]=n+e,e=r):(e=H8(e+8|0)|0,t[e>>2]=t[2703],t[2703]=e,e=e+8|0),e|0}function YF(e,n){e=e|0,n=n|0,t[e>>2]=KF()|0,t[e+4>>2]=XF()|0,t[e+12>>2]=n,t[e+8>>2]=QF()|0,t[e+32>>2]=9}function KF(){return 11744}function XF(){return 1832}function QF(){return E_()|0}function JF(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,(Pl(u,896)|0)==512?r|0&&(ZF(r),yt(r)):n|0&&yt(n)}function ZF(e){e=e|0,e=t[e+4>>2]|0,e|0&&J2(e)}function $F(e){e=e|0,eb(e,5052),tb(e)|0,nb(e,5058,26)|0,rb(e,5069,1)|0,ib(e,5077,10)|0,ub(e,5087,19)|0,ob(e,5094,27)|0}function eb(e,n){e=e|0,n=n|0;var r=0;r=ZP()|0,t[e>>2]=r,$P(r,n),Q2(t[e>>2]|0)}function tb(e){e=e|0;var n=0;return n=t[e>>2]|0,Hp(n,BP()|0),e|0}function nb(e,n,r){return e=e|0,n=n|0,r=r|0,EP(e,Or(n)|0,r,0),e|0}function rb(e,n,r){return e=e|0,n=n|0,r=r|0,uP(e,Or(n)|0,r,0),e|0}function ib(e,n,r){return e=e|0,n=n|0,r=r|0,Ib(e,Or(n)|0,r,0),e|0}function ub(e,n,r){return e=e|0,n=n|0,r=r|0,wb(e,Or(n)|0,r,0),e|0}function g8(e,n){e=e|0,n=n|0;var r=0,u=0;e:for(;;){for(r=t[2703]|0;;){if((r|0)==(n|0))break e;if(u=t[r>>2]|0,t[2703]=u,!r)r=u;else break}yt(r)}t[2701]=e}function ob(e,n,r){return e=e|0,n=n|0,r=r|0,lb(e,Or(n)|0,r,0),e|0}function lb(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=IE()|0,e=sb(r)|0,vi(s,n,l,e,ab(r,u)|0,u)}function IE(){var e=0,n=0;if(p[8040]|0||(E8(10860),Ht(65,10860,he|0)|0,n=8040,t[n>>2]=1,t[n+4>>2]=0),!(rr(10860)|0)){e=10860,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));E8(10860)}return 10860}function sb(e){return e=e|0,e|0}function ab(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=IE()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(_8(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(fb(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function _8(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function fb(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=cb(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,db(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,_8(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,pb(e,l),hb(l),m=D;return}}function cb(e){return e=e|0,536870911}function db(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function pb(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function hb(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function E8(e){e=e|0,yb(e)}function vb(e){e=e|0,mb(e+24|0)}function mb(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function yb(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,11,n,gb()|0,2),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function gb(){return 1840}function _b(e,n,r){e=e|0,n=n|0,r=r|0,Db(t[(Eb(e)|0)>>2]|0,n,r)}function Eb(e){return e=e|0,(t[(IE()|0)+24>>2]|0)+(e<<3)|0}function Db(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;u=m,m=m+16|0,s=u+1|0,l=u,Of(s,n),n=kf(s,n)|0,Of(l,r),r=kf(l,r)|0,N1[e&31](n,r),m=u}function wb(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=BE()|0,e=Sb(r)|0,vi(s,n,l,e,Tb(r,u)|0,u)}function BE(){var e=0,n=0;if(p[8048]|0||(w8(10896),Ht(66,10896,he|0)|0,n=8048,t[n>>2]=1,t[n+4>>2]=0),!(rr(10896)|0)){e=10896,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));w8(10896)}return 10896}function Sb(e){return e=e|0,e|0}function Tb(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=BE()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(D8(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(Cb(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function D8(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function Cb(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=xb(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,Ab(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,D8(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,Rb(e,l),Ob(l),m=D;return}}function xb(e){return e=e|0,536870911}function Ab(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function Rb(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Ob(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function w8(e){e=e|0,Nb(e)}function kb(e){e=e|0,Mb(e+24|0)}function Mb(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function Nb(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,11,n,Lb()|0,1),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Lb(){return 1852}function Fb(e,n){return e=e|0,n=n|0,Pb(t[(bb(e)|0)>>2]|0,n)|0}function bb(e){return e=e|0,(t[(BE()|0)+24>>2]|0)+(e<<3)|0}function Pb(e,n){e=e|0,n=n|0;var r=0,u=0;return r=m,m=m+16|0,u=r,Of(u,n),n=kf(u,n)|0,n=z0(Xp[e&31](n)|0)|0,m=r,n|0}function Ib(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=UE()|0,e=Bb(r)|0,vi(s,n,l,e,Ub(r,u)|0,u)}function UE(){var e=0,n=0;if(p[8056]|0||(T8(10932),Ht(67,10932,he|0)|0,n=8056,t[n>>2]=1,t[n+4>>2]=0),!(rr(10932)|0)){e=10932,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));T8(10932)}return 10932}function Bb(e){return e=e|0,e|0}function Ub(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=UE()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(S8(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(jb(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function S8(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function jb(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=zb(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,qb(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,S8(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,Hb(e,l),Wb(l),m=D;return}}function zb(e){return e=e|0,536870911}function qb(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function Hb(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function Wb(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function T8(e){e=e|0,Yb(e)}function Vb(e){e=e|0,Gb(e+24|0)}function Gb(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function Yb(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,7,n,Kb()|0,2),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function Kb(){return 1860}function Xb(e,n,r){return e=e|0,n=n|0,r=r|0,Jb(t[(Qb(e)|0)>>2]|0,n,r)|0}function Qb(e){return e=e|0,(t[(UE()|0)+24>>2]|0)+(e<<3)|0}function Jb(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0;return u=m,m=m+32|0,h=u+12|0,s=u+8|0,D=u,S=u+16|0,l=u+4|0,Zb(S,n),$b(D,S,n),qs(l,r),r=Hs(l,r)|0,t[h>>2]=t[D>>2],jy[e&15](s,h,r),r=eP(s)|0,B0(s),Ws(l),m=u,r|0}function Zb(e,n){e=e|0,n=n|0}function $b(e,n,r){e=e|0,n=n|0,r=r|0,tP(e,r)}function eP(e){return e=e|0,vo(e)|0}function tP(e,n){e=e|0,n=n|0;var r=0,u=0,l=0;l=m,m=m+16|0,r=l,u=n,u&1?(nP(r,0),Yi(u|0,r|0)|0,rP(e,r),iP(r)):t[e>>2]=t[n>>2],m=l}function nP(e,n){e=e|0,n=n|0,l2(e,n),t[e+4>>2]=0,p[e+8>>0]=0}function rP(e,n){e=e|0,n=n|0,t[e>>2]=t[n+4>>2]}function iP(e){e=e|0,p[e+8>>0]=0}function uP(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=jE()|0,e=oP(r)|0,vi(s,n,l,e,lP(r,u)|0,u)}function jE(){var e=0,n=0;if(p[8064]|0||(x8(10968),Ht(68,10968,he|0)|0,n=8064,t[n>>2]=1,t[n+4>>2]=0),!(rr(10968)|0)){e=10968,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));x8(10968)}return 10968}function oP(e){return e=e|0,e|0}function lP(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=jE()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(C8(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(sP(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function C8(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function sP(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=aP(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,fP(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,C8(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,cP(e,l),dP(l),m=D;return}}function aP(e){return e=e|0,536870911}function fP(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function cP(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function dP(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function x8(e){e=e|0,vP(e)}function pP(e){e=e|0,hP(e+24|0)}function hP(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function vP(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,1,n,mP()|0,5),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function mP(){return 1872}function yP(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,_P(t[(gP(e)|0)>>2]|0,n,r,u,l,s)}function gP(e){return e=e|0,(t[(jE()|0)+24>>2]|0)+(e<<3)|0}function _P(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0;var h=0,D=0,S=0,M=0,O=0,P=0;h=m,m=m+32|0,D=h+16|0,S=h+12|0,M=h+8|0,O=h+4|0,P=h,qs(D,n),n=Hs(D,n)|0,qs(S,r),r=Hs(S,r)|0,qs(M,u),u=Hs(M,u)|0,qs(O,l),l=Hs(O,l)|0,qs(P,s),s=Hs(P,s)|0,K8[e&1](n,r,u,l,s),Ws(P),Ws(O),Ws(M),Ws(S),Ws(D),m=h}function EP(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;s=t[e>>2]|0,l=zE()|0,e=DP(r)|0,vi(s,n,l,e,wP(r,u)|0,u)}function zE(){var e=0,n=0;if(p[8072]|0||(R8(11004),Ht(69,11004,he|0)|0,n=8072,t[n>>2]=1,t[n+4>>2]=0),!(rr(11004)|0)){e=11004,n=e+36|0;do t[e>>2]=0,e=e+4|0;while((e|0)<(n|0));R8(11004)}return 11004}function DP(e){return e=e|0,e|0}function wP(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0,D=0,S=0;return D=m,m=m+16|0,l=D,s=D+4|0,t[l>>2]=e,S=zE()|0,h=S+24|0,n=dn(n,4)|0,t[s>>2]=n,r=S+28|0,u=t[r>>2]|0,u>>>0<(t[S+32>>2]|0)>>>0?(A8(u,e,n),n=(t[r>>2]|0)+8|0,t[r>>2]=n):(SP(h,l,s),n=t[r>>2]|0),m=D,(n-(t[h>>2]|0)>>3)+-1|0}function A8(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,t[e+4>>2]=r}function SP(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0;if(D=m,m=m+32|0,l=D,s=e+4|0,h=((t[s>>2]|0)-(t[e>>2]|0)>>3)+1|0,u=TP(e)|0,u>>>0>>0)li(e);else{S=t[e>>2]|0,O=(t[e+8>>2]|0)-S|0,M=O>>2,CP(l,O>>3>>>0>>1>>>0?M>>>0>>0?h:M:u,(t[s>>2]|0)-S>>3,e+8|0),h=l+8|0,A8(t[h>>2]|0,t[n>>2]|0,t[r>>2]|0),t[h>>2]=(t[h>>2]|0)+8,xP(e,l),AP(l),m=D;return}}function TP(e){return e=e|0,536870911}function CP(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0;t[e+12>>2]=0,t[e+16>>2]=u;do if(n)if(n>>>0>536870911)Xn();else{l=cn(n<<3)|0;break}else l=0;while(0);t[e>>2]=l,u=l+(r<<3)|0,t[e+8>>2]=u,t[e+4>>2]=u,t[e+12>>2]=l+(n<<3)}function xP(e,n){e=e|0,n=n|0;var r=0,u=0,l=0,s=0,h=0;u=t[e>>2]|0,h=e+4|0,s=n+4|0,l=(t[h>>2]|0)-u|0,r=(t[s>>2]|0)+(0-(l>>3)<<3)|0,t[s>>2]=r,(l|0)>0?(pr(r|0,u|0,l|0)|0,u=s,r=t[s>>2]|0):u=s,s=t[e>>2]|0,t[e>>2]=r,t[u>>2]=s,s=n+8|0,l=t[h>>2]|0,t[h>>2]=t[s>>2],t[s>>2]=l,s=e+8|0,h=n+12|0,e=t[s>>2]|0,t[s>>2]=t[h>>2],t[h>>2]=e,t[n>>2]=t[u>>2]}function AP(e){e=e|0;var n=0,r=0,u=0;n=t[e+4>>2]|0,r=e+8|0,u=t[r>>2]|0,(u|0)!=(n|0)&&(t[r>>2]=u+(~((u+-8-n|0)>>>3)<<3)),e=t[e>>2]|0,e|0&&yt(e)}function R8(e){e=e|0,kP(e)}function RP(e){e=e|0,OP(e+24|0)}function OP(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function kP(e){e=e|0;var n=0;n=dr()|0,Pn(e,1,12,n,MP()|0,2),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function MP(){return 1896}function NP(e,n,r){e=e|0,n=n|0,r=r|0,FP(t[(LP(e)|0)>>2]|0,n,r)}function LP(e){return e=e|0,(t[(zE()|0)+24>>2]|0)+(e<<3)|0}function FP(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;u=m,m=m+16|0,s=u+4|0,l=u,bP(s,n),n=PP(s,n)|0,qs(l,r),r=Hs(l,r)|0,N1[e&31](n,r),Ws(l),m=u}function bP(e,n){e=e|0,n=n|0}function PP(e,n){return e=e|0,n=n|0,IP(n)|0}function IP(e){return e=e|0,e|0}function BP(){var e=0;return p[8080]|0||(O8(11040),Ht(70,11040,he|0)|0,e=8080,t[e>>2]=1,t[e+4>>2]=0),rr(11040)|0||O8(11040),11040}function O8(e){e=e|0,zP(e),Wp(e,71)}function UP(e){e=e|0,jP(e+24|0)}function jP(e){e=e|0;var n=0,r=0,u=0;r=t[e>>2]|0,u=r,r|0&&(e=e+4|0,n=t[e>>2]|0,(n|0)!=(r|0)&&(t[e>>2]=n+(~((n+-8-u|0)>>>3)<<3)),yt(r))}function zP(e){e=e|0;var n=0;n=dr()|0,Pn(e,5,7,n,VP()|0,0),t[e+24>>2]=0,t[e+28>>2]=0,t[e+32>>2]=0}function qP(e){e=e|0,HP(e)}function HP(e){e=e|0,WP(e)}function WP(e){e=e|0,p[e+8>>0]=1}function VP(){return 1936}function GP(){return YP()|0}function YP(){var e=0,n=0,r=0,u=0,l=0,s=0,h=0;return n=m,m=m+16|0,l=n+4|0,h=n,r=Sa(8)|0,e=r,s=e+4|0,t[s>>2]=cn(1)|0,u=cn(8)|0,s=t[s>>2]|0,t[h>>2]=0,t[l>>2]=t[h>>2],KP(u,s,l),t[r>>2]=u,m=n,e|0}function KP(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]=n,r=cn(16)|0,t[r+4>>2]=0,t[r+8>>2]=0,t[r>>2]=1916,t[r+12>>2]=n,t[e+4>>2]=r}function XP(e){e=e|0,Pv(e),yt(e)}function QP(e){e=e|0,e=t[e+12>>2]|0,e|0&&yt(e)}function JP(e){e=e|0,yt(e)}function ZP(){var e=0;return p[8088]|0||(uI(11076),Ht(25,11076,he|0)|0,e=8088,t[e>>2]=1,t[e+4>>2]=0),11076}function $P(e,n){e=e|0,n=n|0,t[e>>2]=eI()|0,t[e+4>>2]=tI()|0,t[e+12>>2]=n,t[e+8>>2]=nI()|0,t[e+32>>2]=10}function eI(){return 11745}function tI(){return 1940}function nI(){return O1()|0}function rI(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,(Pl(u,896)|0)==512?r|0&&(iI(r),yt(r)):n|0&&yt(n)}function iI(e){e=e|0,e=t[e+4>>2]|0,e|0&&J2(e)}function uI(e){e=e|0,Ha(e)}function jf(e,n){e=e|0,n=n|0,t[e>>2]=n}function qE(e){return e=e|0,t[e>>2]|0}function oI(e){return e=e|0,p[t[e>>2]>>0]|0}function lI(e,n){e=e|0,n=n|0;var r=0,u=0;r=m,m=m+16|0,u=r,t[u>>2]=t[e>>2],sI(n,u)|0,m=r}function sI(e,n){e=e|0,n=n|0;var r=0;return r=aI(t[e>>2]|0,n)|0,n=e+4|0,t[(t[n>>2]|0)+8>>2]=r,t[(t[n>>2]|0)+8>>2]|0}function aI(e,n){e=e|0,n=n|0;var r=0,u=0;return r=m,m=m+16|0,u=r,Ta(u),e=vo(e)|0,n=fI(e,t[n>>2]|0)|0,Ca(u),m=r,n|0}function Ta(e){e=e|0,t[e>>2]=t[2701],t[e+4>>2]=t[2703]}function fI(e,n){e=e|0,n=n|0;var r=0;return r=mo(cI()|0)|0,ji(0,r|0,e|0,bE(n)|0)|0}function Ca(e){e=e|0,g8(t[e>>2]|0,t[e+4>>2]|0)}function cI(){var e=0;return p[8096]|0||(dI(11120),e=8096,t[e>>2]=1,t[e+4>>2]=0),11120}function dI(e){e=e|0,nl(e,pI()|0,1)}function pI(){return 1948}function hI(){vI()}function vI(){var e=0,n=0,r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0,Ee=0,ve=0;if(Ee=m,m=m+16|0,O=Ee+4|0,P=Ee,Ln(65536,10804,t[2702]|0,10812),r=$3()|0,n=t[r>>2]|0,e=t[n>>2]|0,e|0)for(u=t[r+8>>2]|0,r=t[r+4>>2]|0;Wl(e|0,k[r>>0]|0|0,p[u>>0]|0),n=n+4|0,e=t[n>>2]|0,e;)u=u+1|0,r=r+1|0;if(e=e8()|0,n=t[e>>2]|0,n|0)do xo(n|0,t[e+4>>2]|0),e=e+8|0,n=t[e>>2]|0;while((n|0)!=0);xo(mI()|0,5167),M=Mv()|0,e=t[M>>2]|0;e:do if(e|0){do yI(t[e+4>>2]|0),e=t[e>>2]|0;while((e|0)!=0);if(e=t[M>>2]|0,e|0){S=M;do{for(;l=e,e=t[e>>2]|0,l=t[l+4>>2]|0,!!(gI(l)|0);)if(t[P>>2]=S,t[O>>2]=t[P>>2],_I(M,O)|0,!e)break e;if(EI(l),S=t[S>>2]|0,n=k8(l)|0,s=lo()|0,h=m,m=m+((1*(n<<2)|0)+15&-16)|0,D=m,m=m+((1*(n<<2)|0)+15&-16)|0,n=t[(d8(l)|0)>>2]|0,n|0)for(r=h,u=D;t[r>>2]=t[(Nv(t[n+4>>2]|0)|0)>>2],t[u>>2]=t[n+8>>2],n=t[n>>2]|0,n;)r=r+4|0,u=u+4|0;ve=Nv(l)|0,n=DI(l)|0,r=k8(l)|0,u=wI(l)|0,Ao(ve|0,n|0,h|0,D|0,r|0,u|0,OE(l)|0),ci(s|0)}while((e|0)!=0)}}while(0);if(e=t[(kE()|0)>>2]|0,e|0)do ve=e+4|0,M=ME(ve)|0,l=Py(M)|0,s=Fy(M)|0,h=(by(M)|0)+1|0,D=T_(M)|0,S=M8(ve)|0,M=rr(M)|0,O=D_(ve)|0,P=HE(ve)|0,oo(0,l|0,s|0,h|0,D|0,S|0,M|0,O|0,P|0,WE(ve)|0),e=t[e>>2]|0;while((e|0)!=0);e=t[(Mv()|0)>>2]|0;e:do if(e|0){t:for(;;){if(n=t[e+4>>2]|0,n|0?(K=t[(Nv(n)|0)>>2]|0,Pe=t[(p8(n)|0)>>2]|0,Pe|0):0){r=Pe;do{n=r+4|0,u=ME(n)|0;n:do if(u|0)switch(rr(u)|0){case 0:break t;case 4:case 3:case 2:{D=Py(u)|0,S=Fy(u)|0,M=(by(u)|0)+1|0,O=T_(u)|0,P=rr(u)|0,ve=D_(n)|0,oo(K|0,D|0,S|0,M|0,O|0,0,P|0,ve|0,HE(n)|0,WE(n)|0);break n}case 1:{h=Py(u)|0,D=Fy(u)|0,S=(by(u)|0)+1|0,M=T_(u)|0,O=M8(n)|0,P=rr(u)|0,ve=D_(n)|0,oo(K|0,h|0,D|0,S|0,M|0,O|0,P|0,ve|0,HE(n)|0,WE(n)|0);break n}case 5:{M=Py(u)|0,O=Fy(u)|0,P=(by(u)|0)+1|0,ve=T_(u)|0,oo(K|0,M|0,O|0,P|0,ve|0,SI(u)|0,rr(u)|0,0,0,0);break n}default:break n}while(0);r=t[r>>2]|0}while((r|0)!=0)}if(e=t[e>>2]|0,!e)break e}Xn()}while(0);Ms(),m=Ee}function mI(){return 11703}function yI(e){e=e|0,p[e+40>>0]=0}function gI(e){return e=e|0,(p[e+40>>0]|0)!=0|0}function _I(e,n){return e=e|0,n=n|0,n=TI(n)|0,e=t[n>>2]|0,t[n>>2]=t[e>>2],yt(e),t[n>>2]|0}function EI(e){e=e|0,p[e+40>>0]=1}function k8(e){return e=e|0,t[e+20>>2]|0}function DI(e){return e=e|0,t[e+8>>2]|0}function wI(e){return e=e|0,t[e+32>>2]|0}function T_(e){return e=e|0,t[e+4>>2]|0}function M8(e){return e=e|0,t[e+4>>2]|0}function HE(e){return e=e|0,t[e+8>>2]|0}function WE(e){return e=e|0,t[e+16>>2]|0}function SI(e){return e=e|0,t[e+20>>2]|0}function TI(e){return e=e|0,t[e>>2]|0}function C_(e){e=e|0;var n=0,r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0,Ee=0,ve=0,Qe=0,We=0,st=0,Re=0,Fe=0,Qt=0;Qt=m,m=m+16|0,K=Qt;do if(e>>>0<245){if(M=e>>>0<11?16:e+11&-8,e=M>>>3,P=t[2783]|0,r=P>>>e,r&3|0)return n=(r&1^1)+e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|0,n=t[e>>2]|0,!n&&(e=S+16|0,n=t[e>>2]|0,!n)){r=0;break}for(;;){if(r=n+20|0,u=t[r>>2]|0,u|0){n=u,e=r;continue}if(r=n+16|0,u=t[r>>2]|0,u)n=u,e=r;else break}t[e>>2]=0,r=n}else r=t[S+8>>2]|0,t[r+12>>2]=n,t[n+8>>2]=r,r=n;while(0);do if(l|0){if(n=t[S+28>>2]|0,e=11436+(n<<2)|0,(S|0)==(t[e>>2]|0)){if(t[e>>2]=r,!r){t[2784]=D&~(1<>2]|0)!=(S|0)&1)<<2)>>2]=r,!r)break;t[r+24>>2]=l,n=t[S+16>>2]|0,n|0&&(t[r+16>>2]=n,t[n+24>>2]=r),n=t[S+20>>2]|0,n|0&&(t[r+20>>2]=n,t[n+24>>2]=r)}while(0);return s>>>0<16?(Fe=s+M|0,t[S+4>>2]=Fe|3,Fe=S+Fe+4|0,t[Fe>>2]=t[Fe>>2]|1):(t[S+4>>2]=M|3,t[h+4>>2]=s|1,t[h+s>>2]=s,O|0&&(u=t[2788]|0,n=O>>>3,r=11172+(n<<1<<2)|0,n=1<>2]|0):(t[2783]=P|n,n=r,e=r+8|0),t[e>>2]=u,t[n+12>>2]=u,t[u+8>>2]=n,t[u+12>>2]=r),t[2785]=s,t[2788]=h),Fe=S+8|0,m=Qt,Fe|0}else P=M}else P=M}else P=M}else if(e>>>0<=4294967231)if(e=e+11|0,M=e&-8,S=t[2784]|0,S){u=0-M|0,e=e>>>8,e?M>>>0>16777215?D=31:(P=(e+1048320|0)>>>16&8,Re=e<>>16&4,Re=Re<>>16&2,D=14-(O|P|D)+(Re<>>15)|0,D=M>>>(D+7|0)&1|D<<1):D=0,r=t[11436+(D<<2)>>2]|0;e:do if(!r)r=0,e=0,Re=57;else for(e=0,h=M<<((D|0)==31?0:25-(D>>>1)|0),s=0;;){if(l=(t[r+4>>2]&-8)-M|0,l>>>0>>0)if(l)e=r,u=l;else{e=r,u=0,l=r,Re=61;break e}if(l=t[r+20>>2]|0,r=t[r+16+(h>>>31<<2)>>2]|0,s=(l|0)==0|(l|0)==(r|0)?s:l,l=(r|0)==0,l){r=s,Re=57;break}else h=h<<((l^1)&1)}while(0);if((Re|0)==57){if((r|0)==0&(e|0)==0){if(e=2<>>12&16,P=P>>>h,s=P>>>5&8,P=P>>>s,D=P>>>2&4,P=P>>>D,O=P>>>1&2,P=P>>>O,r=P>>>1&1,e=0,r=t[11436+((s|h|D|O|r)+(P>>>r)<<2)>>2]|0}r?(l=r,Re=61):(D=e,h=u)}if((Re|0)==61)for(;;)if(Re=0,r=(t[l+4>>2]&-8)-M|0,P=r>>>0>>0,r=P?r:u,e=P?l:e,l=t[l+16+(((t[l+16>>2]|0)==0&1)<<2)>>2]|0,l)u=r,Re=61;else{D=e,h=r;break}if((D|0)!=0?h>>>0<((t[2785]|0)-M|0)>>>0:0){if(s=D+M|0,D>>>0>=s>>>0)return Fe=0,m=Qt,Fe|0;l=t[D+24>>2]|0,n=t[D+12>>2]|0;do if((n|0)==(D|0)){if(e=D+20|0,n=t[e>>2]|0,!n&&(e=D+16|0,n=t[e>>2]|0,!n)){n=0;break}for(;;){if(r=n+20|0,u=t[r>>2]|0,u|0){n=u,e=r;continue}if(r=n+16|0,u=t[r>>2]|0,u)n=u,e=r;else break}t[e>>2]=0}else Fe=t[D+8>>2]|0,t[Fe+12>>2]=n,t[n+8>>2]=Fe;while(0);do if(l){if(e=t[D+28>>2]|0,r=11436+(e<<2)|0,(D|0)==(t[r>>2]|0)){if(t[r>>2]=n,!n){u=S&~(1<>2]|0)!=(D|0)&1)<<2)>>2]=n,!n){u=S;break}t[n+24>>2]=l,e=t[D+16>>2]|0,e|0&&(t[n+16>>2]=e,t[e+24>>2]=n),e=t[D+20>>2]|0,e&&(t[n+20>>2]=e,t[e+24>>2]=n),u=S}else u=S;while(0);do if(h>>>0>=16){if(t[D+4>>2]=M|3,t[s+4>>2]=h|1,t[s+h>>2]=h,n=h>>>3,h>>>0<256){r=11172+(n<<1<<2)|0,e=t[2783]|0,n=1<>2]|0):(t[2783]=e|n,n=r,e=r+8|0),t[e>>2]=s,t[n+12>>2]=s,t[s+8>>2]=n,t[s+12>>2]=r;break}if(n=h>>>8,n?h>>>0>16777215?n=31:(Re=(n+1048320|0)>>>16&8,Fe=n<>>16&4,Fe=Fe<>>16&2,n=14-(st|Re|n)+(Fe<>>15)|0,n=h>>>(n+7|0)&1|n<<1):n=0,r=11436+(n<<2)|0,t[s+28>>2]=n,e=s+16|0,t[e+4>>2]=0,t[e>>2]=0,e=1<>2]=s,t[s+24>>2]=r,t[s+12>>2]=s,t[s+8>>2]=s;break}for(e=h<<((n|0)==31?0:25-(n>>>1)|0),r=t[r>>2]|0;;){if((t[r+4>>2]&-8|0)==(h|0)){Re=97;break}if(u=r+16+(e>>>31<<2)|0,n=t[u>>2]|0,n)e=e<<1,r=n;else{Re=96;break}}if((Re|0)==96){t[u>>2]=s,t[s+24>>2]=r,t[s+12>>2]=s,t[s+8>>2]=s;break}else if((Re|0)==97){Re=r+8|0,Fe=t[Re>>2]|0,t[Fe+12>>2]=s,t[Re>>2]=s,t[s+8>>2]=Fe,t[s+12>>2]=r,t[s+24>>2]=0;break}}else Fe=h+M|0,t[D+4>>2]=Fe|3,Fe=D+Fe+4|0,t[Fe>>2]=t[Fe>>2]|1;while(0);return Fe=D+8|0,m=Qt,Fe|0}else P=M}else P=M;else P=-1;while(0);if(r=t[2785]|0,r>>>0>=P>>>0)return n=r-P|0,e=t[2788]|0,n>>>0>15?(Fe=e+P|0,t[2788]=Fe,t[2785]=n,t[Fe+4>>2]=n|1,t[Fe+n>>2]=n,t[e+4>>2]=P|3):(t[2785]=0,t[2788]=0,t[e+4>>2]=r|3,Fe=e+r+4|0,t[Fe>>2]=t[Fe>>2]|1),Fe=e+8|0,m=Qt,Fe|0;if(h=t[2786]|0,h>>>0>P>>>0)return st=h-P|0,t[2786]=st,Fe=t[2789]|0,Re=Fe+P|0,t[2789]=Re,t[Re+4>>2]=st|1,t[Fe+4>>2]=P|3,Fe=Fe+8|0,m=Qt,Fe|0;if(t[2901]|0?e=t[2903]|0:(t[2903]=4096,t[2902]=4096,t[2904]=-1,t[2905]=-1,t[2906]=0,t[2894]=0,e=K&-16^1431655768,t[K>>2]=e,t[2901]=e,e=4096),D=P+48|0,S=P+47|0,s=e+S|0,l=0-e|0,M=s&l,M>>>0<=P>>>0||(e=t[2893]|0,e|0?(O=t[2891]|0,K=O+M|0,K>>>0<=O>>>0|K>>>0>e>>>0):0))return Fe=0,m=Qt,Fe|0;e:do if(t[2894]&4)n=0,Re=133;else{r=t[2789]|0;t:do if(r){for(u=11580;e=t[u>>2]|0,!(e>>>0<=r>>>0?(ve=u+4|0,(e+(t[ve>>2]|0)|0)>>>0>r>>>0):0);)if(e=t[u+8>>2]|0,e)u=e;else{Re=118;break t}if(n=s-h&l,n>>>0<2147483647)if(e=Z2(n|0)|0,(e|0)==((t[u>>2]|0)+(t[ve>>2]|0)|0)){if((e|0)!=(-1|0)){h=n,s=e,Re=135;break e}}else u=e,Re=126;else n=0}else Re=118;while(0);do if((Re|0)==118)if(r=Z2(0)|0,(r|0)!=(-1|0)?(n=r,Pe=t[2902]|0,Ee=Pe+-1|0,n=((Ee&n|0)==0?0:(Ee+n&0-Pe)-n|0)+M|0,Pe=t[2891]|0,Ee=n+Pe|0,n>>>0>P>>>0&n>>>0<2147483647):0){if(ve=t[2893]|0,ve|0?Ee>>>0<=Pe>>>0|Ee>>>0>ve>>>0:0){n=0;break}if(e=Z2(n|0)|0,(e|0)==(r|0)){h=n,s=r,Re=135;break e}else u=e,Re=126}else n=0;while(0);do if((Re|0)==126){if(r=0-n|0,!(D>>>0>n>>>0&(n>>>0<2147483647&(u|0)!=(-1|0))))if((u|0)==(-1|0)){n=0;break}else{h=n,s=u,Re=135;break e}if(e=t[2903]|0,e=S-n+e&0-e,e>>>0>=2147483647){h=n,s=u,Re=135;break e}if((Z2(e|0)|0)==(-1|0)){Z2(r|0)|0,n=0;break}else{h=e+n|0,s=u,Re=135;break e}}while(0);t[2894]=t[2894]|4,Re=133}while(0);if((((Re|0)==133?M>>>0<2147483647:0)?(st=Z2(M|0)|0,ve=Z2(0)|0,Qe=ve-st|0,We=Qe>>>0>(P+40|0)>>>0,!((st|0)==(-1|0)|We^1|st>>>0>>0&((st|0)!=(-1|0)&(ve|0)!=(-1|0))^1)):0)&&(h=We?Qe:n,s=st,Re=135),(Re|0)==135){n=(t[2891]|0)+h|0,t[2891]=n,n>>>0>(t[2892]|0)>>>0&&(t[2892]=n),S=t[2789]|0;do if(S){for(n=11580;;){if(e=t[n>>2]|0,r=n+4|0,u=t[r>>2]|0,(s|0)==(e+u|0)){Re=145;break}if(l=t[n+8>>2]|0,l)n=l;else break}if(((Re|0)==145?(t[n+12>>2]&8|0)==0:0)?S>>>0>>0&S>>>0>=e>>>0:0){t[r>>2]=u+h,Fe=S+8|0,Fe=(Fe&7|0)==0?0:0-Fe&7,Re=S+Fe|0,Fe=(t[2786]|0)+(h-Fe)|0,t[2789]=Re,t[2786]=Fe,t[Re+4>>2]=Fe|1,t[Re+Fe+4>>2]=40,t[2790]=t[2905];break}for(s>>>0<(t[2787]|0)>>>0&&(t[2787]=s),r=s+h|0,n=11580;;){if((t[n>>2]|0)==(r|0)){Re=153;break}if(e=t[n+8>>2]|0,e)n=e;else break}if((Re|0)==153?(t[n+12>>2]&8|0)==0:0){t[n>>2]=s,O=n+4|0,t[O>>2]=(t[O>>2]|0)+h,O=s+8|0,O=s+((O&7|0)==0?0:0-O&7)|0,n=r+8|0,n=r+((n&7|0)==0?0:0-n&7)|0,M=O+P|0,D=n-O-P|0,t[O+4>>2]=P|3;do if((n|0)!=(S|0)){if((n|0)==(t[2788]|0)){Fe=(t[2785]|0)+D|0,t[2785]=Fe,t[2788]=M,t[M+4>>2]=Fe|1,t[M+Fe>>2]=Fe;break}if(e=t[n+4>>2]|0,(e&3|0)==1){h=e&-8,u=e>>>3;e:do if(e>>>0<256)if(e=t[n+8>>2]|0,r=t[n+12>>2]|0,(r|0)==(e|0)){t[2783]=t[2783]&~(1<>2]=r,t[r+8>>2]=e;break}else{s=t[n+24>>2]|0,e=t[n+12>>2]|0;do if((e|0)==(n|0)){if(u=n+16|0,r=u+4|0,e=t[r>>2]|0,!e)if(e=t[u>>2]|0,e)r=u;else{e=0;break}for(;;){if(u=e+20|0,l=t[u>>2]|0,l|0){e=l,r=u;continue}if(u=e+16|0,l=t[u>>2]|0,l)e=l,r=u;else break}t[r>>2]=0}else Fe=t[n+8>>2]|0,t[Fe+12>>2]=e,t[e+8>>2]=Fe;while(0);if(!s)break;r=t[n+28>>2]|0,u=11436+(r<<2)|0;do if((n|0)!=(t[u>>2]|0)){if(t[s+16+(((t[s+16>>2]|0)!=(n|0)&1)<<2)>>2]=e,!e)break e}else{if(t[u>>2]=e,e|0)break;t[2784]=t[2784]&~(1<>2]=s,r=n+16|0,u=t[r>>2]|0,u|0&&(t[e+16>>2]=u,t[u+24>>2]=e),r=t[r+4>>2]|0,!r)break;t[e+20>>2]=r,t[r+24>>2]=e}while(0);n=n+h|0,l=h+D|0}else l=D;if(n=n+4|0,t[n>>2]=t[n>>2]&-2,t[M+4>>2]=l|1,t[M+l>>2]=l,n=l>>>3,l>>>0<256){r=11172+(n<<1<<2)|0,e=t[2783]|0,n=1<>2]|0):(t[2783]=e|n,n=r,e=r+8|0),t[e>>2]=M,t[n+12>>2]=M,t[M+8>>2]=n,t[M+12>>2]=r;break}n=l>>>8;do if(!n)n=0;else{if(l>>>0>16777215){n=31;break}Re=(n+1048320|0)>>>16&8,Fe=n<>>16&4,Fe=Fe<>>16&2,n=14-(st|Re|n)+(Fe<>>15)|0,n=l>>>(n+7|0)&1|n<<1}while(0);if(u=11436+(n<<2)|0,t[M+28>>2]=n,e=M+16|0,t[e+4>>2]=0,t[e>>2]=0,e=t[2784]|0,r=1<>2]=M,t[M+24>>2]=u,t[M+12>>2]=M,t[M+8>>2]=M;break}for(e=l<<((n|0)==31?0:25-(n>>>1)|0),r=t[u>>2]|0;;){if((t[r+4>>2]&-8|0)==(l|0)){Re=194;break}if(u=r+16+(e>>>31<<2)|0,n=t[u>>2]|0,n)e=e<<1,r=n;else{Re=193;break}}if((Re|0)==193){t[u>>2]=M,t[M+24>>2]=r,t[M+12>>2]=M,t[M+8>>2]=M;break}else if((Re|0)==194){Re=r+8|0,Fe=t[Re>>2]|0,t[Fe+12>>2]=M,t[Re>>2]=M,t[M+8>>2]=Fe,t[M+12>>2]=r,t[M+24>>2]=0;break}}else Fe=(t[2786]|0)+D|0,t[2786]=Fe,t[2789]=M,t[M+4>>2]=Fe|1;while(0);return Fe=O+8|0,m=Qt,Fe|0}for(n=11580;e=t[n>>2]|0,!(e>>>0<=S>>>0?(Fe=e+(t[n+4>>2]|0)|0,Fe>>>0>S>>>0):0);)n=t[n+8>>2]|0;l=Fe+-47|0,e=l+8|0,e=l+((e&7|0)==0?0:0-e&7)|0,l=S+16|0,e=e>>>0>>0?S:e,n=e+8|0,r=s+8|0,r=(r&7|0)==0?0:0-r&7,Re=s+r|0,r=h+-40-r|0,t[2789]=Re,t[2786]=r,t[Re+4>>2]=r|1,t[Re+r+4>>2]=40,t[2790]=t[2905],r=e+4|0,t[r>>2]=27,t[n>>2]=t[2895],t[n+4>>2]=t[2896],t[n+8>>2]=t[2897],t[n+12>>2]=t[2898],t[2895]=s,t[2896]=h,t[2898]=0,t[2897]=n,n=e+24|0;do Re=n,n=n+4|0,t[n>>2]=7;while((Re+8|0)>>>0>>0);if((e|0)!=(S|0)){if(s=e-S|0,t[r>>2]=t[r>>2]&-2,t[S+4>>2]=s|1,t[e>>2]=s,n=s>>>3,s>>>0<256){r=11172+(n<<1<<2)|0,e=t[2783]|0,n=1<>2]|0):(t[2783]=e|n,n=r,e=r+8|0),t[e>>2]=S,t[n+12>>2]=S,t[S+8>>2]=n,t[S+12>>2]=r;break}if(n=s>>>8,n?s>>>0>16777215?r=31:(Re=(n+1048320|0)>>>16&8,Fe=n<>>16&4,Fe=Fe<>>16&2,r=14-(st|Re|r)+(Fe<>>15)|0,r=s>>>(r+7|0)&1|r<<1):r=0,u=11436+(r<<2)|0,t[S+28>>2]=r,t[S+20>>2]=0,t[l>>2]=0,n=t[2784]|0,e=1<>2]=S,t[S+24>>2]=u,t[S+12>>2]=S,t[S+8>>2]=S;break}for(e=s<<((r|0)==31?0:25-(r>>>1)|0),r=t[u>>2]|0;;){if((t[r+4>>2]&-8|0)==(s|0)){Re=216;break}if(u=r+16+(e>>>31<<2)|0,n=t[u>>2]|0,n)e=e<<1,r=n;else{Re=215;break}}if((Re|0)==215){t[u>>2]=S,t[S+24>>2]=r,t[S+12>>2]=S,t[S+8>>2]=S;break}else if((Re|0)==216){Re=r+8|0,Fe=t[Re>>2]|0,t[Fe+12>>2]=S,t[Re>>2]=S,t[S+8>>2]=Fe,t[S+12>>2]=r,t[S+24>>2]=0;break}}}else{Fe=t[2787]|0,(Fe|0)==0|s>>>0>>0&&(t[2787]=s),t[2895]=s,t[2896]=h,t[2898]=0,t[2792]=t[2901],t[2791]=-1,n=0;do Fe=11172+(n<<1<<2)|0,t[Fe+12>>2]=Fe,t[Fe+8>>2]=Fe,n=n+1|0;while((n|0)!=32);Fe=s+8|0,Fe=(Fe&7|0)==0?0:0-Fe&7,Re=s+Fe|0,Fe=h+-40-Fe|0,t[2789]=Re,t[2786]=Fe,t[Re+4>>2]=Fe|1,t[Re+Fe+4>>2]=40,t[2790]=t[2905]}while(0);if(n=t[2786]|0,n>>>0>P>>>0)return st=n-P|0,t[2786]=st,Fe=t[2789]|0,Re=Fe+P|0,t[2789]=Re,t[Re+4>>2]=st|1,t[Fe+4>>2]=P|3,Fe=Fe+8|0,m=Qt,Fe|0}return t[(Fv()|0)>>2]=12,Fe=0,m=Qt,Fe|0}function x_(e){e=e|0;var n=0,r=0,u=0,l=0,s=0,h=0,D=0,S=0;if(!!e){r=e+-8|0,l=t[2787]|0,e=t[e+-4>>2]|0,n=e&-8,S=r+n|0;do if(e&1)D=r,h=r;else{if(u=t[r>>2]|0,!(e&3)||(h=r+(0-u)|0,s=u+n|0,h>>>0>>0))return;if((h|0)==(t[2788]|0)){if(e=S+4|0,n=t[e>>2]|0,(n&3|0)!=3){D=h,n=s;break}t[2785]=s,t[e>>2]=n&-2,t[h+4>>2]=s|1,t[h+s>>2]=s;return}if(r=u>>>3,u>>>0<256)if(e=t[h+8>>2]|0,n=t[h+12>>2]|0,(n|0)==(e|0)){t[2783]=t[2783]&~(1<>2]=n,t[n+8>>2]=e,D=h,n=s;break}l=t[h+24>>2]|0,e=t[h+12>>2]|0;do if((e|0)==(h|0)){if(r=h+16|0,n=r+4|0,e=t[n>>2]|0,!e)if(e=t[r>>2]|0,e)n=r;else{e=0;break}for(;;){if(r=e+20|0,u=t[r>>2]|0,u|0){e=u,n=r;continue}if(r=e+16|0,u=t[r>>2]|0,u)e=u,n=r;else break}t[n>>2]=0}else D=t[h+8>>2]|0,t[D+12>>2]=e,t[e+8>>2]=D;while(0);if(l){if(n=t[h+28>>2]|0,r=11436+(n<<2)|0,(h|0)==(t[r>>2]|0)){if(t[r>>2]=e,!e){t[2784]=t[2784]&~(1<>2]|0)!=(h|0)&1)<<2)>>2]=e,!e){D=h,n=s;break}t[e+24>>2]=l,n=h+16|0,r=t[n>>2]|0,r|0&&(t[e+16>>2]=r,t[r+24>>2]=e),n=t[n+4>>2]|0,n?(t[e+20>>2]=n,t[n+24>>2]=e,D=h,n=s):(D=h,n=s)}else D=h,n=s}while(0);if(!(h>>>0>=S>>>0)&&(e=S+4|0,u=t[e>>2]|0,!!(u&1))){if(u&2)t[e>>2]=u&-2,t[D+4>>2]=n|1,t[h+n>>2]=n,l=n;else{if(e=t[2788]|0,(S|0)==(t[2789]|0)){if(S=(t[2786]|0)+n|0,t[2786]=S,t[2789]=D,t[D+4>>2]=S|1,(D|0)!=(e|0))return;t[2788]=0,t[2785]=0;return}if((S|0)==(e|0)){S=(t[2785]|0)+n|0,t[2785]=S,t[2788]=h,t[D+4>>2]=S|1,t[h+S>>2]=S;return}l=(u&-8)+n|0,r=u>>>3;do if(u>>>0<256)if(n=t[S+8>>2]|0,e=t[S+12>>2]|0,(e|0)==(n|0)){t[2783]=t[2783]&~(1<>2]=e,t[e+8>>2]=n;break}else{s=t[S+24>>2]|0,e=t[S+12>>2]|0;do if((e|0)==(S|0)){if(r=S+16|0,n=r+4|0,e=t[n>>2]|0,!e)if(e=t[r>>2]|0,e)n=r;else{r=0;break}for(;;){if(r=e+20|0,u=t[r>>2]|0,u|0){e=u,n=r;continue}if(r=e+16|0,u=t[r>>2]|0,u)e=u,n=r;else break}t[n>>2]=0,r=e}else r=t[S+8>>2]|0,t[r+12>>2]=e,t[e+8>>2]=r,r=e;while(0);if(s|0){if(e=t[S+28>>2]|0,n=11436+(e<<2)|0,(S|0)==(t[n>>2]|0)){if(t[n>>2]=r,!r){t[2784]=t[2784]&~(1<>2]|0)!=(S|0)&1)<<2)>>2]=r,!r)break;t[r+24>>2]=s,e=S+16|0,n=t[e>>2]|0,n|0&&(t[r+16>>2]=n,t[n+24>>2]=r),e=t[e+4>>2]|0,e|0&&(t[r+20>>2]=e,t[e+24>>2]=r)}}while(0);if(t[D+4>>2]=l|1,t[h+l>>2]=l,(D|0)==(t[2788]|0)){t[2785]=l;return}}if(e=l>>>3,l>>>0<256){r=11172+(e<<1<<2)|0,n=t[2783]|0,e=1<>2]|0):(t[2783]=n|e,e=r,n=r+8|0),t[n>>2]=D,t[e+12>>2]=D,t[D+8>>2]=e,t[D+12>>2]=r;return}e=l>>>8,e?l>>>0>16777215?e=31:(h=(e+1048320|0)>>>16&8,S=e<>>16&4,S=S<>>16&2,e=14-(s|h|e)+(S<>>15)|0,e=l>>>(e+7|0)&1|e<<1):e=0,u=11436+(e<<2)|0,t[D+28>>2]=e,t[D+20>>2]=0,t[D+16>>2]=0,n=t[2784]|0,r=1<>>1)|0),r=t[u>>2]|0;;){if((t[r+4>>2]&-8|0)==(l|0)){e=73;break}if(u=r+16+(n>>>31<<2)|0,e=t[u>>2]|0,e)n=n<<1,r=e;else{e=72;break}}if((e|0)==72){t[u>>2]=D,t[D+24>>2]=r,t[D+12>>2]=D,t[D+8>>2]=D;break}else if((e|0)==73){h=r+8|0,S=t[h>>2]|0,t[S+12>>2]=D,t[h>>2]=D,t[D+8>>2]=S,t[D+12>>2]=r,t[D+24>>2]=0;break}}else t[2784]=n|r,t[u>>2]=D,t[D+24>>2]=u,t[D+12>>2]=D,t[D+8>>2]=D;while(0);if(S=(t[2791]|0)+-1|0,t[2791]=S,!S)e=11588;else return;for(;e=t[e>>2]|0,e;)e=e+8|0;t[2791]=-1}}}function CI(){return 11628}function xI(e){e=e|0;var n=0,r=0;return n=m,m=m+16|0,r=n,t[r>>2]=OI(t[e+60>>2]|0)|0,e=A_(wu(6,r|0)|0)|0,m=n,e|0}function N8(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0;P=m,m=m+48|0,M=P+16|0,s=P,l=P+32|0,D=e+28|0,u=t[D>>2]|0,t[l>>2]=u,S=e+20|0,u=(t[S>>2]|0)-u|0,t[l+4>>2]=u,t[l+8>>2]=n,t[l+12>>2]=r,u=u+r|0,h=e+60|0,t[s>>2]=t[h>>2],t[s+4>>2]=l,t[s+8>>2]=2,s=A_(d0(146,s|0)|0)|0;e:do if((u|0)!=(s|0)){for(n=2;!((s|0)<0);)if(u=u-s|0,Pe=t[l+4>>2]|0,K=s>>>0>Pe>>>0,l=K?l+8|0:l,n=(K<<31>>31)+n|0,Pe=s-(K?Pe:0)|0,t[l>>2]=(t[l>>2]|0)+Pe,K=l+4|0,t[K>>2]=(t[K>>2]|0)-Pe,t[M>>2]=t[h>>2],t[M+4>>2]=l,t[M+8>>2]=n,s=A_(d0(146,M|0)|0)|0,(u|0)==(s|0)){O=3;break e}t[e+16>>2]=0,t[D>>2]=0,t[S>>2]=0,t[e>>2]=t[e>>2]|32,(n|0)==2?r=0:r=r-(t[l+4>>2]|0)|0}else O=3;while(0);return(O|0)==3&&(Pe=t[e+44>>2]|0,t[e+16>>2]=Pe+(t[e+48>>2]|0),t[D>>2]=Pe,t[S>>2]=Pe),m=P,r|0}function AI(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;return l=m,m=m+32|0,s=l,u=l+20|0,t[s>>2]=t[e+60>>2],t[s+4>>2]=0,t[s+8>>2]=n,t[s+12>>2]=u,t[s+16>>2]=r,(A_(Ti(140,s|0)|0)|0)<0?(t[u>>2]=-1,e=-1):e=t[u>>2]|0,m=l,e|0}function A_(e){return e=e|0,e>>>0>4294963200&&(t[(Fv()|0)>>2]=0-e,e=-1),e|0}function Fv(){return(RI()|0)+64|0}function RI(){return VE()|0}function VE(){return 2084}function OI(e){return e=e|0,e|0}function kI(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0;return l=m,m=m+32|0,u=l,t[e+36>>2]=1,((t[e>>2]&64|0)==0?(t[u>>2]=t[e+60>>2],t[u+4>>2]=21523,t[u+8>>2]=l+16,b0(54,u|0)|0):0)&&(p[e+75>>0]=-1),u=N8(e,n,r)|0,m=l,u|0}function L8(e,n){e=e|0,n=n|0;var r=0,u=0;if(r=p[e>>0]|0,u=p[n>>0]|0,r<<24>>24==0?1:r<<24>>24!=u<<24>>24)e=u;else{do e=e+1|0,n=n+1|0,r=p[e>>0]|0,u=p[n>>0]|0;while(!(r<<24>>24==0?1:r<<24>>24!=u<<24>>24));e=u}return(r&255)-(e&255)|0}function MI(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0;e:do if(!r)e=0;else{for(;u=p[e>>0]|0,l=p[n>>0]|0,u<<24>>24==l<<24>>24;)if(r=r+-1|0,r)e=e+1|0,n=n+1|0;else{e=0;break e}e=(u&255)-(l&255)|0}while(0);return e|0}function F8(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0,Ee=0,ve=0;ve=m,m=m+224|0,O=ve+120|0,P=ve+80|0,Pe=ve,Ee=ve+136|0,u=P,l=u+40|0;do t[u>>2]=0,u=u+4|0;while((u|0)<(l|0));return t[O>>2]=t[r>>2],(GE(0,n,O,Pe,P)|0)<0?r=-1:((t[e+76>>2]|0)>-1?K=NI(e)|0:K=0,r=t[e>>2]|0,M=r&32,(p[e+74>>0]|0)<1&&(t[e>>2]=r&-33),u=e+48|0,t[u>>2]|0?r=GE(e,n,O,Pe,P)|0:(l=e+44|0,s=t[l>>2]|0,t[l>>2]=Ee,h=e+28|0,t[h>>2]=Ee,D=e+20|0,t[D>>2]=Ee,t[u>>2]=80,S=e+16|0,t[S>>2]=Ee+80,r=GE(e,n,O,Pe,P)|0,s&&(M_[t[e+36>>2]&7](e,0,0)|0,r=(t[D>>2]|0)==0?-1:r,t[l>>2]=s,t[u>>2]=0,t[S>>2]=0,t[h>>2]=0,t[D>>2]=0)),u=t[e>>2]|0,t[e>>2]=u|M,K|0&&LI(e),r=(u&32|0)==0?r:-1),m=ve,r|0}function GE(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0;var s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0,Ee=0,ve=0,Qe=0,We=0,st=0,Re=0,Fe=0,Qt=0,Lr=0,Nn=0,mn=0,hr=0,kr=0,On=0;On=m,m=m+64|0,Nn=On+16|0,mn=On,Qt=On+24|0,hr=On+8|0,kr=On+20|0,t[Nn>>2]=n,st=(e|0)!=0,Re=Qt+40|0,Fe=Re,Qt=Qt+39|0,Lr=hr+4|0,h=0,s=0,O=0;e:for(;;){do if((s|0)>-1)if((h|0)>(2147483647-s|0)){t[(Fv()|0)>>2]=75,s=-1;break}else{s=h+s|0;break}while(0);if(h=p[n>>0]|0,h<<24>>24)D=n;else{We=87;break}t:for(;;){switch(h<<24>>24){case 37:{h=D,We=9;break t}case 0:{h=D;break t}default:}Qe=D+1|0,t[Nn>>2]=Qe,h=p[Qe>>0]|0,D=Qe}t:do if((We|0)==9)for(;;){if(We=0,(p[D+1>>0]|0)!=37)break t;if(h=h+1|0,D=D+2|0,t[Nn>>2]=D,(p[D>>0]|0)==37)We=9;else break}while(0);if(h=h-n|0,st&&qo(e,n,h),h|0){n=D;continue}S=D+1|0,h=(p[S>>0]|0)+-48|0,h>>>0<10?(Qe=(p[D+2>>0]|0)==36,ve=Qe?h:-1,O=Qe?1:O,S=Qe?D+3|0:S):ve=-1,t[Nn>>2]=S,h=p[S>>0]|0,D=(h<<24>>24)+-32|0;t:do if(D>>>0<32)for(M=0,P=h;;){if(h=1<>2]=S,h=p[S>>0]|0,D=(h<<24>>24)+-32|0,D>>>0>=32)break;P=h}else M=0;while(0);if(h<<24>>24==42){if(D=S+1|0,h=(p[D>>0]|0)+-48|0,h>>>0<10?(p[S+2>>0]|0)==36:0)t[l+(h<<2)>>2]=10,h=t[u+((p[D>>0]|0)+-48<<3)>>2]|0,O=1,S=S+3|0;else{if(O|0){s=-1;break}st?(O=(t[r>>2]|0)+(4-1)&~(4-1),h=t[O>>2]|0,t[r>>2]=O+4,O=0,S=D):(h=0,O=0,S=D)}t[Nn>>2]=S,Qe=(h|0)<0,h=Qe?0-h|0:h,M=Qe?M|8192:M}else{if(h=b8(Nn)|0,(h|0)<0){s=-1;break}S=t[Nn>>2]|0}do if((p[S>>0]|0)==46){if((p[S+1>>0]|0)!=42){t[Nn>>2]=S+1,D=b8(Nn)|0,S=t[Nn>>2]|0;break}if(P=S+2|0,D=(p[P>>0]|0)+-48|0,D>>>0<10?(p[S+3>>0]|0)==36:0){t[l+(D<<2)>>2]=10,D=t[u+((p[P>>0]|0)+-48<<3)>>2]|0,S=S+4|0,t[Nn>>2]=S;break}if(O|0){s=-1;break e}st?(Qe=(t[r>>2]|0)+(4-1)&~(4-1),D=t[Qe>>2]|0,t[r>>2]=Qe+4):D=0,t[Nn>>2]=P,S=P}else D=-1;while(0);for(Ee=0;;){if(((p[S>>0]|0)+-65|0)>>>0>57){s=-1;break e}if(Qe=S+1|0,t[Nn>>2]=Qe,P=p[(p[S>>0]|0)+-65+(5178+(Ee*58|0))>>0]|0,K=P&255,(K+-1|0)>>>0<8)Ee=K,S=Qe;else break}if(!(P<<24>>24)){s=-1;break}Pe=(ve|0)>-1;do if(P<<24>>24==19)if(Pe){s=-1;break e}else We=49;else{if(Pe){t[l+(ve<<2)>>2]=K,Pe=u+(ve<<3)|0,ve=t[Pe+4>>2]|0,We=mn,t[We>>2]=t[Pe>>2],t[We+4>>2]=ve,We=49;break}if(!st){s=0;break e}P8(mn,K,r)}while(0);if((We|0)==49?(We=0,!st):0){h=0,n=Qe;continue}S=p[S>>0]|0,S=(Ee|0)!=0&(S&15|0)==3?S&-33:S,Pe=M&-65537,ve=(M&8192|0)==0?M:Pe;t:do switch(S|0){case 110:switch((Ee&255)<<24>>24){case 0:{t[t[mn>>2]>>2]=s,h=0,n=Qe;continue e}case 1:{t[t[mn>>2]>>2]=s,h=0,n=Qe;continue e}case 2:{h=t[mn>>2]|0,t[h>>2]=s,t[h+4>>2]=((s|0)<0)<<31>>31,h=0,n=Qe;continue e}case 3:{E[t[mn>>2]>>1]=s,h=0,n=Qe;continue e}case 4:{p[t[mn>>2]>>0]=s,h=0,n=Qe;continue e}case 6:{t[t[mn>>2]>>2]=s,h=0,n=Qe;continue e}case 7:{h=t[mn>>2]|0,t[h>>2]=s,t[h+4>>2]=((s|0)<0)<<31>>31,h=0,n=Qe;continue e}default:{h=0,n=Qe;continue e}}case 112:{S=120,D=D>>>0>8?D:8,n=ve|8,We=61;break}case 88:case 120:{n=ve,We=61;break}case 111:{S=mn,n=t[S>>2]|0,S=t[S+4>>2]|0,K=bI(n,S,Re)|0,Pe=Fe-K|0,M=0,P=5642,D=(ve&8|0)==0|(D|0)>(Pe|0)?D:Pe+1|0,Pe=ve,We=67;break}case 105:case 100:if(S=mn,n=t[S>>2]|0,S=t[S+4>>2]|0,(S|0)<0){n=R_(0,0,n|0,S|0)|0,S=ft,M=mn,t[M>>2]=n,t[M+4>>2]=S,M=1,P=5642,We=66;break t}else{M=(ve&2049|0)!=0&1,P=(ve&2048|0)==0?(ve&1|0)==0?5642:5644:5643,We=66;break t}case 117:{S=mn,M=0,P=5642,n=t[S>>2]|0,S=t[S+4>>2]|0,We=66;break}case 99:{p[Qt>>0]=t[mn>>2],n=Qt,M=0,P=5642,K=Re,S=1,D=Pe;break}case 109:{S=PI(t[(Fv()|0)>>2]|0)|0,We=71;break}case 115:{S=t[mn>>2]|0,S=S|0?S:5652,We=71;break}case 67:{t[hr>>2]=t[mn>>2],t[Lr>>2]=0,t[mn>>2]=hr,K=-1,S=hr,We=75;break}case 83:{n=t[mn>>2]|0,D?(K=D,S=n,We=75):(hl(e,32,h,0,ve),n=0,We=84);break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{h=BI(e,+U[mn>>3],h,D,ve,S)|0,n=Qe;continue e}default:M=0,P=5642,K=Re,S=D,D=ve}while(0);t:do if((We|0)==61)ve=mn,Ee=t[ve>>2]|0,ve=t[ve+4>>2]|0,K=FI(Ee,ve,Re,S&32)|0,P=(n&8|0)==0|(Ee|0)==0&(ve|0)==0,M=P?0:2,P=P?5642:5642+(S>>4)|0,Pe=n,n=Ee,S=ve,We=67;else if((We|0)==66)K=bv(n,S,Re)|0,Pe=ve,We=67;else if((We|0)==71)We=0,ve=II(S,0,D)|0,Ee=(ve|0)==0,n=S,M=0,P=5642,K=Ee?S+D|0:ve,S=Ee?D:ve-S|0,D=Pe;else if((We|0)==75){for(We=0,P=S,n=0,D=0;M=t[P>>2]|0,!(!M||(D=I8(kr,M)|0,(D|0)<0|D>>>0>(K-n|0)>>>0));)if(n=D+n|0,K>>>0>n>>>0)P=P+4|0;else break;if((D|0)<0){s=-1;break e}if(hl(e,32,h,n,ve),!n)n=0,We=84;else for(M=0;;){if(D=t[S>>2]|0,!D){We=84;break t}if(D=I8(kr,D)|0,M=D+M|0,(M|0)>(n|0)){We=84;break t}if(qo(e,kr,D),M>>>0>=n>>>0){We=84;break}else S=S+4|0}}while(0);if((We|0)==67)We=0,S=(n|0)!=0|(S|0)!=0,ve=(D|0)!=0|S,S=((S^1)&1)+(Fe-K)|0,n=ve?K:Re,K=Re,S=ve?(D|0)>(S|0)?D:S:D,D=(D|0)>-1?Pe&-65537:Pe;else if((We|0)==84){We=0,hl(e,32,h,n,ve^8192),h=(h|0)>(n|0)?h:n,n=Qe;continue}Ee=K-n|0,Pe=(S|0)<(Ee|0)?Ee:S,ve=Pe+M|0,h=(h|0)<(ve|0)?ve:h,hl(e,32,h,ve,D),qo(e,P,M),hl(e,48,h,ve,D^65536),hl(e,48,Pe,Ee,0),qo(e,n,Ee),hl(e,32,h,ve,D^8192),n=Qe}e:do if((We|0)==87&&!e)if(!O)s=0;else{for(s=1;n=t[l+(s<<2)>>2]|0,!!n;)if(P8(u+(s<<3)|0,n,r),s=s+1|0,(s|0)>=10){s=1;break e}for(;;){if(t[l+(s<<2)>>2]|0){s=-1;break e}if(s=s+1|0,(s|0)>=10){s=1;break}}}while(0);return m=On,s|0}function NI(e){return e=e|0,0}function LI(e){e=e|0}function qo(e,n,r){e=e|0,n=n|0,r=r|0,t[e>>2]&32||YI(n,r,e)|0}function b8(e){e=e|0;var n=0,r=0,u=0;if(r=t[e>>2]|0,u=(p[r>>0]|0)+-48|0,u>>>0<10){n=0;do n=u+(n*10|0)|0,r=r+1|0,t[e>>2]=r,u=(p[r>>0]|0)+-48|0;while(u>>>0<10)}else n=0;return n|0}function P8(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;e:do if(n>>>0<=20)do switch(n|0){case 9:{u=(t[r>>2]|0)+(4-1)&~(4-1),n=t[u>>2]|0,t[r>>2]=u+4,t[e>>2]=n;break e}case 10:{u=(t[r>>2]|0)+(4-1)&~(4-1),n=t[u>>2]|0,t[r>>2]=u+4,u=e,t[u>>2]=n,t[u+4>>2]=((n|0)<0)<<31>>31;break e}case 11:{u=(t[r>>2]|0)+(4-1)&~(4-1),n=t[u>>2]|0,t[r>>2]=u+4,u=e,t[u>>2]=n,t[u+4>>2]=0;break e}case 12:{u=(t[r>>2]|0)+(8-1)&~(8-1),n=u,l=t[n>>2]|0,n=t[n+4>>2]|0,t[r>>2]=u+8,u=e,t[u>>2]=l,t[u+4>>2]=n;break e}case 13:{l=(t[r>>2]|0)+(4-1)&~(4-1),u=t[l>>2]|0,t[r>>2]=l+4,u=(u&65535)<<16>>16,l=e,t[l>>2]=u,t[l+4>>2]=((u|0)<0)<<31>>31;break e}case 14:{l=(t[r>>2]|0)+(4-1)&~(4-1),u=t[l>>2]|0,t[r>>2]=l+4,l=e,t[l>>2]=u&65535,t[l+4>>2]=0;break e}case 15:{l=(t[r>>2]|0)+(4-1)&~(4-1),u=t[l>>2]|0,t[r>>2]=l+4,u=(u&255)<<24>>24,l=e,t[l>>2]=u,t[l+4>>2]=((u|0)<0)<<31>>31;break e}case 16:{l=(t[r>>2]|0)+(4-1)&~(4-1),u=t[l>>2]|0,t[r>>2]=l+4,l=e,t[l>>2]=u&255,t[l+4>>2]=0;break e}case 17:{l=(t[r>>2]|0)+(8-1)&~(8-1),s=+U[l>>3],t[r>>2]=l+8,U[e>>3]=s;break e}case 18:{l=(t[r>>2]|0)+(8-1)&~(8-1),s=+U[l>>3],t[r>>2]=l+8,U[e>>3]=s;break e}default:break e}while(0);while(0)}function FI(e,n,r,u){if(e=e|0,n=n|0,r=r|0,u=u|0,!((e|0)==0&(n|0)==0))do r=r+-1|0,p[r>>0]=k[5694+(e&15)>>0]|0|u,e=O_(e|0,n|0,4)|0,n=ft;while(!((e|0)==0&(n|0)==0));return r|0}function bI(e,n,r){if(e=e|0,n=n|0,r=r|0,!((e|0)==0&(n|0)==0))do r=r+-1|0,p[r>>0]=e&7|48,e=O_(e|0,n|0,3)|0,n=ft;while(!((e|0)==0&(n|0)==0));return r|0}function bv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;if(n>>>0>0|(n|0)==0&e>>>0>4294967295){for(;u=QE(e|0,n|0,10,0)|0,r=r+-1|0,p[r>>0]=u&255|48,u=e,e=XE(e|0,n|0,10,0)|0,n>>>0>9|(n|0)==9&u>>>0>4294967295;)n=ft;n=e}else n=e;if(n)for(;r=r+-1|0,p[r>>0]=(n>>>0)%10|0|48,!(n>>>0<10);)n=(n>>>0)/10|0;return r|0}function PI(e){return e=e|0,HI(e,t[(qI()|0)+188>>2]|0)|0}function II(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;s=n&255,u=(r|0)!=0;e:do if(u&(e&3|0)!=0)for(l=n&255;;){if((p[e>>0]|0)==l<<24>>24){h=6;break e}if(e=e+1|0,r=r+-1|0,u=(r|0)!=0,!(u&(e&3|0)!=0)){h=5;break}}else h=5;while(0);(h|0)==5&&(u?h=6:r=0);e:do if((h|0)==6&&(l=n&255,(p[e>>0]|0)!=l<<24>>24)){u=nr(s,16843009)|0;t:do if(r>>>0>3){for(;s=t[e>>2]^u,!((s&-2139062144^-2139062144)&s+-16843009|0);)if(e=e+4|0,r=r+-4|0,r>>>0<=3){h=11;break t}}else h=11;while(0);if((h|0)==11&&!r){r=0;break}for(;;){if((p[e>>0]|0)==l<<24>>24)break e;if(e=e+1|0,r=r+-1|0,!r){r=0;break}}}while(0);return(r|0?e:0)|0}function hl(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0;var s=0,h=0;if(h=m,m=m+256|0,s=h,(r|0)>(u|0)&(l&73728|0)==0){if(l=r-u|0,Iv(s|0,n|0,(l>>>0<256?l:256)|0)|0,l>>>0>255){n=r-u|0;do qo(e,s,256),l=l+-256|0;while(l>>>0>255);l=n&255}qo(e,s,l)}m=h}function I8(e,n){return e=e|0,n=n|0,e?e=jI(e,n,0)|0:e=0,e|0}function BI(e,n,r,u,l,s){e=e|0,n=+n,r=r|0,u=u|0,l=l|0,s=s|0;var h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0,Ee=0,ve=0,Qe=0,We=0,st=0,Re=0,Fe=0,Qt=0,Lr=0,Nn=0,mn=0,hr=0,kr=0,On=0,Zi=0;Zi=m,m=m+560|0,S=Zi+8|0,Qe=Zi,On=Zi+524|0,kr=On,M=Zi+512|0,t[Qe>>2]=0,hr=M+12|0,B8(n)|0,(ft|0)<0?(n=-n,Nn=1,Lr=5659):(Nn=(l&2049|0)!=0&1,Lr=(l&2048|0)==0?(l&1|0)==0?5660:5665:5662),B8(n)|0,mn=ft&2146435072;do if(mn>>>0<2146435072|(mn|0)==2146435072&0<0){if(Pe=+UI(n,Qe)*2,h=Pe!=0,h&&(t[Qe>>2]=(t[Qe>>2]|0)+-1),st=s|32,(st|0)==97){Ee=s&32,K=(Ee|0)==0?Lr:Lr+9|0,P=Nn|2,h=12-u|0;do if(u>>>0>11|(h|0)==0)n=Pe;else{n=8;do h=h+-1|0,n=n*16;while((h|0)!=0);if((p[K>>0]|0)==45){n=-(n+(-Pe-n));break}else{n=Pe+n-n;break}}while(0);D=t[Qe>>2]|0,h=(D|0)<0?0-D|0:D,h=bv(h,((h|0)<0)<<31>>31,hr)|0,(h|0)==(hr|0)&&(h=M+11|0,p[h>>0]=48),p[h+-1>>0]=(D>>31&2)+43,O=h+-2|0,p[O>>0]=s+15,M=(u|0)<1,S=(l&8|0)==0,h=On;do mn=~~n,D=h+1|0,p[h>>0]=k[5694+mn>>0]|Ee,n=(n-+(mn|0))*16,((D-kr|0)==1?!(S&(M&n==0)):0)?(p[D>>0]=46,h=h+2|0):h=D;while(n!=0);mn=h-kr|0,kr=hr-O|0,hr=(u|0)!=0&(mn+-2|0)<(u|0)?u+2|0:mn,h=kr+P+hr|0,hl(e,32,r,h,l),qo(e,K,P),hl(e,48,r,h,l^65536),qo(e,On,mn),hl(e,48,hr-mn|0,0,0),qo(e,O,kr),hl(e,32,r,h,l^8192);break}D=(u|0)<0?6:u,h?(h=(t[Qe>>2]|0)+-28|0,t[Qe>>2]=h,n=Pe*268435456):(n=Pe,h=t[Qe>>2]|0),mn=(h|0)<0?S:S+288|0,S=mn;do Fe=~~n>>>0,t[S>>2]=Fe,S=S+4|0,n=(n-+(Fe>>>0))*1e9;while(n!=0);if((h|0)>0)for(M=mn,P=S;;){if(O=(h|0)<29?h:29,h=P+-4|0,h>>>0>=M>>>0){S=0;do Re=W8(t[h>>2]|0,0,O|0)|0,Re=KE(Re|0,ft|0,S|0,0)|0,Fe=ft,We=QE(Re|0,Fe|0,1e9,0)|0,t[h>>2]=We,S=XE(Re|0,Fe|0,1e9,0)|0,h=h+-4|0;while(h>>>0>=M>>>0);S&&(M=M+-4|0,t[M>>2]=S)}for(S=P;!(S>>>0<=M>>>0);)if(h=S+-4|0,!(t[h>>2]|0))S=h;else break;if(h=(t[Qe>>2]|0)-O|0,t[Qe>>2]=h,(h|0)>0)P=S;else break}else M=mn;if((h|0)<0){u=((D+25|0)/9|0)+1|0,ve=(st|0)==102;do{if(Ee=0-h|0,Ee=(Ee|0)<9?Ee:9,M>>>0>>0){O=(1<>>Ee,K=0,h=M;do Fe=t[h>>2]|0,t[h>>2]=(Fe>>>Ee)+K,K=nr(Fe&O,P)|0,h=h+4|0;while(h>>>0>>0);h=(t[M>>2]|0)==0?M+4|0:M,K?(t[S>>2]=K,M=h,h=S+4|0):(M=h,h=S)}else M=(t[M>>2]|0)==0?M+4|0:M,h=S;S=ve?mn:M,S=(h-S>>2|0)>(u|0)?S+(u<<2)|0:h,h=(t[Qe>>2]|0)+Ee|0,t[Qe>>2]=h}while((h|0)<0);h=M,u=S}else h=M,u=S;if(Fe=mn,h>>>0>>0){if(S=(Fe-h>>2)*9|0,O=t[h>>2]|0,O>>>0>=10){M=10;do M=M*10|0,S=S+1|0;while(O>>>0>=M>>>0)}}else S=0;if(ve=(st|0)==103,We=(D|0)!=0,M=D-((st|0)!=102?S:0)+((We&ve)<<31>>31)|0,(M|0)<(((u-Fe>>2)*9|0)+-9|0)){if(M=M+9216|0,Ee=mn+4+(((M|0)/9|0)+-1024<<2)|0,M=((M|0)%9|0)+1|0,(M|0)<9){O=10;do O=O*10|0,M=M+1|0;while((M|0)!=9)}else O=10;if(P=t[Ee>>2]|0,K=(P>>>0)%(O>>>0)|0,M=(Ee+4|0)==(u|0),M&(K|0)==0)M=Ee;else if(Pe=(((P>>>0)/(O>>>0)|0)&1|0)==0?9007199254740992:9007199254740994,Re=(O|0)/2|0,n=K>>>0>>0?.5:M&(K|0)==(Re|0)?1:1.5,Nn&&(Re=(p[Lr>>0]|0)==45,n=Re?-n:n,Pe=Re?-Pe:Pe),M=P-K|0,t[Ee>>2]=M,Pe+n!=Pe){if(Re=M+O|0,t[Ee>>2]=Re,Re>>>0>999999999)for(S=Ee;M=S+-4|0,t[S>>2]=0,M>>>0>>0&&(h=h+-4|0,t[h>>2]=0),Re=(t[M>>2]|0)+1|0,t[M>>2]=Re,Re>>>0>999999999;)S=M;else M=Ee;if(S=(Fe-h>>2)*9|0,P=t[h>>2]|0,P>>>0>=10){O=10;do O=O*10|0,S=S+1|0;while(P>>>0>=O>>>0)}}else M=Ee;M=M+4|0,M=u>>>0>M>>>0?M:u,Re=h}else M=u,Re=h;for(st=M;;){if(st>>>0<=Re>>>0){Qe=0;break}if(h=st+-4|0,!(t[h>>2]|0))st=h;else{Qe=1;break}}u=0-S|0;do if(ve)if(h=((We^1)&1)+D|0,(h|0)>(S|0)&(S|0)>-5?(O=s+-1|0,D=h+-1-S|0):(O=s+-2|0,D=h+-1|0),h=l&8,h)Ee=h;else{if(Qe?(Qt=t[st+-4>>2]|0,(Qt|0)!=0):0)if((Qt>>>0)%10|0)M=0;else{M=0,h=10;do h=h*10|0,M=M+1|0;while(!((Qt>>>0)%(h>>>0)|0|0))}else M=9;if(h=((st-Fe>>2)*9|0)+-9|0,(O|32|0)==102){Ee=h-M|0,Ee=(Ee|0)>0?Ee:0,D=(D|0)<(Ee|0)?D:Ee,Ee=0;break}else{Ee=h+S-M|0,Ee=(Ee|0)>0?Ee:0,D=(D|0)<(Ee|0)?D:Ee,Ee=0;break}}else O=s,Ee=l&8;while(0);if(ve=D|Ee,P=(ve|0)!=0&1,K=(O|32|0)==102,K)We=0,h=(S|0)>0?S:0;else{if(h=(S|0)<0?u:S,h=bv(h,((h|0)<0)<<31>>31,hr)|0,M=hr,(M-h|0)<2)do h=h+-1|0,p[h>>0]=48;while((M-h|0)<2);p[h+-1>>0]=(S>>31&2)+43,h=h+-2|0,p[h>>0]=O,We=h,h=M-h|0}if(h=Nn+1+D+P+h|0,hl(e,32,r,h,l),qo(e,Lr,Nn),hl(e,48,r,h,l^65536),K){O=Re>>>0>mn>>>0?mn:Re,Ee=On+9|0,P=Ee,K=On+8|0,M=O;do{if(S=bv(t[M>>2]|0,0,Ee)|0,(M|0)==(O|0))(S|0)==(Ee|0)&&(p[K>>0]=48,S=K);else if(S>>>0>On>>>0){Iv(On|0,48,S-kr|0)|0;do S=S+-1|0;while(S>>>0>On>>>0)}qo(e,S,P-S|0),M=M+4|0}while(M>>>0<=mn>>>0);if(ve|0&&qo(e,5710,1),M>>>0>>0&(D|0)>0)for(;;){if(S=bv(t[M>>2]|0,0,Ee)|0,S>>>0>On>>>0){Iv(On|0,48,S-kr|0)|0;do S=S+-1|0;while(S>>>0>On>>>0)}if(qo(e,S,(D|0)<9?D:9),M=M+4|0,S=D+-9|0,M>>>0>>0&(D|0)>9)D=S;else{D=S;break}}hl(e,48,D+9|0,9,0)}else{if(ve=Qe?st:Re+4|0,(D|0)>-1){Qe=On+9|0,Ee=(Ee|0)==0,u=Qe,P=0-kr|0,K=On+8|0,O=Re;do{S=bv(t[O>>2]|0,0,Qe)|0,(S|0)==(Qe|0)&&(p[K>>0]=48,S=K);do if((O|0)==(Re|0)){if(M=S+1|0,qo(e,S,1),Ee&(D|0)<1){S=M;break}qo(e,5710,1),S=M}else{if(S>>>0<=On>>>0)break;Iv(On|0,48,S+P|0)|0;do S=S+-1|0;while(S>>>0>On>>>0)}while(0);kr=u-S|0,qo(e,S,(D|0)>(kr|0)?kr:D),D=D-kr|0,O=O+4|0}while(O>>>0>>0&(D|0)>-1)}hl(e,48,D+18|0,18,0),qo(e,We,hr-We|0)}hl(e,32,r,h,l^8192)}else On=(s&32|0)!=0,h=Nn+3|0,hl(e,32,r,h,l&-65537),qo(e,Lr,Nn),qo(e,n!=n|!1?On?5686:5690:On?5678:5682,3),hl(e,32,r,h,l^8192);while(0);return m=Zi,((h|0)<(r|0)?r:h)|0}function B8(e){e=+e;var n=0;return U[W>>3]=e,n=t[W>>2]|0,ft=t[W+4>>2]|0,n|0}function UI(e,n){return e=+e,n=n|0,+ +U8(e,n)}function U8(e,n){e=+e,n=n|0;var r=0,u=0,l=0;switch(U[W>>3]=e,r=t[W>>2]|0,u=t[W+4>>2]|0,l=O_(r|0,u|0,52)|0,l&2047){case 0:{e!=0?(e=+U8(e*18446744073709552e3,n),r=(t[n>>2]|0)+-64|0):r=0,t[n>>2]=r;break}case 2047:break;default:t[n>>2]=(l&2047)+-1022,t[W>>2]=r,t[W+4>>2]=u&-2146435073|1071644672,e=+U[W>>3]}return+e}function jI(e,n,r){e=e|0,n=n|0,r=r|0;do if(e){if(n>>>0<128){p[e>>0]=n,e=1;break}if(!(t[t[(zI()|0)+188>>2]>>2]|0))if((n&-128|0)==57216){p[e>>0]=n,e=1;break}else{t[(Fv()|0)>>2]=84,e=-1;break}if(n>>>0<2048){p[e>>0]=n>>>6|192,p[e+1>>0]=n&63|128,e=2;break}if(n>>>0<55296|(n&-8192|0)==57344){p[e>>0]=n>>>12|224,p[e+1>>0]=n>>>6&63|128,p[e+2>>0]=n&63|128,e=3;break}if((n+-65536|0)>>>0<1048576){p[e>>0]=n>>>18|240,p[e+1>>0]=n>>>12&63|128,p[e+2>>0]=n>>>6&63|128,p[e+3>>0]=n&63|128,e=4;break}else{t[(Fv()|0)>>2]=84,e=-1;break}}else e=1;while(0);return e|0}function zI(){return VE()|0}function qI(){return VE()|0}function HI(e,n){e=e|0,n=n|0;var r=0,u=0;for(u=0;;){if((k[5712+u>>0]|0)==(e|0)){e=2;break}if(r=u+1|0,(r|0)==87){r=5800,u=87,e=5;break}else u=r}if((e|0)==2&&(u?(r=5800,e=5):r=5800),(e|0)==5)for(;;){do e=r,r=r+1|0;while((p[e>>0]|0)!=0);if(u=u+-1|0,u)e=5;else break}return WI(r,t[n+20>>2]|0)|0}function WI(e,n){return e=e|0,n=n|0,VI(e,n)|0}function VI(e,n){return e=e|0,n=n|0,n?n=GI(t[n>>2]|0,t[n+4>>2]|0,e)|0:n=0,(n|0?n:e)|0}function GI(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0;K=(t[e>>2]|0)+1794895138|0,s=Gp(t[e+8>>2]|0,K)|0,u=Gp(t[e+12>>2]|0,K)|0,l=Gp(t[e+16>>2]|0,K)|0;e:do if((s>>>0>>2>>>0?(P=n-(s<<2)|0,u>>>0

>>0&l>>>0

>>0):0)?((l|u)&3|0)==0:0){for(P=u>>>2,O=l>>>2,M=0;;){if(D=s>>>1,S=M+D|0,h=S<<1,l=h+P|0,u=Gp(t[e+(l<<2)>>2]|0,K)|0,l=Gp(t[e+(l+1<<2)>>2]|0,K)|0,!(l>>>0>>0&u>>>0<(n-l|0)>>>0)){u=0;break e}if(p[e+(l+u)>>0]|0){u=0;break e}if(u=L8(r,e+l|0)|0,!u)break;if(u=(u|0)<0,(s|0)==1){u=0;break e}else M=u?M:S,s=u?D:s-D|0}u=h+O|0,l=Gp(t[e+(u<<2)>>2]|0,K)|0,u=Gp(t[e+(u+1<<2)>>2]|0,K)|0,u>>>0>>0&l>>>0<(n-u|0)>>>0?u=(p[e+(u+l)>>0]|0)==0?e+u|0:0:u=0}else u=0;while(0);return u|0}function Gp(e,n){e=e|0,n=n|0;var r=0;return r=Y8(e|0)|0,((n|0)==0?e:r)|0}function YI(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0,D=0;u=r+16|0,l=t[u>>2]|0,l?s=5:KI(r)|0?u=0:(l=t[u>>2]|0,s=5);e:do if((s|0)==5){if(D=r+20|0,h=t[D>>2]|0,u=h,(l-h|0)>>>0>>0){u=M_[t[r+36>>2]&7](r,e,n)|0;break}t:do if((p[r+75>>0]|0)>-1){for(h=n;;){if(!h){s=0,l=e;break t}if(l=h+-1|0,(p[e+l>>0]|0)==10)break;h=l}if(u=M_[t[r+36>>2]&7](r,e,h)|0,u>>>0>>0)break e;s=h,l=e+h|0,n=n-h|0,u=t[D>>2]|0}else s=0,l=e;while(0);pr(u|0,l|0,n|0)|0,t[D>>2]=(t[D>>2]|0)+n,u=s+n|0}while(0);return u|0}function KI(e){e=e|0;var n=0,r=0;return n=e+74|0,r=p[n>>0]|0,p[n>>0]=r+255|r,n=t[e>>2]|0,n&8?(t[e>>2]=n|32,e=-1):(t[e+8>>2]=0,t[e+4>>2]=0,r=t[e+44>>2]|0,t[e+28>>2]=r,t[e+20>>2]=r,t[e+16>>2]=r+(t[e+48>>2]|0),e=0),e|0}function Eu(e,n){e=w(e),n=w(n);var r=0,u=0;r=j8(e)|0;do if((r&2147483647)>>>0<=2139095040){if(u=j8(n)|0,(u&2147483647)>>>0<=2139095040)if((u^r|0)<0){e=(r|0)<0?n:e;break}else{e=e>2]=e,t[W>>2]|0|0}function Yp(e,n){e=w(e),n=w(n);var r=0,u=0;r=z8(e)|0;do if((r&2147483647)>>>0<=2139095040){if(u=z8(n)|0,(u&2147483647)>>>0<=2139095040)if((u^r|0)<0){e=(r|0)<0?e:n;break}else{e=e>2]=e,t[W>>2]|0|0}function YE(e,n){e=w(e),n=w(n);var r=0,u=0,l=0,s=0,h=0,D=0,S=0,M=0;s=(C[W>>2]=e,t[W>>2]|0),D=(C[W>>2]=n,t[W>>2]|0),r=s>>>23&255,h=D>>>23&255,S=s&-2147483648,l=D<<1;e:do if((l|0)!=0?!((r|0)==255|((XI(n)|0)&2147483647)>>>0>2139095040):0){if(u=s<<1,u>>>0<=l>>>0)return n=w(e*w(0)),w((u|0)==(l|0)?n:e);if(r)u=s&8388607|8388608;else{if(r=s<<9,(r|0)>-1){u=r,r=0;do r=r+-1|0,u=u<<1;while((u|0)>-1)}else r=0;u=s<<1-r}if(h)D=D&8388607|8388608;else{if(s=D<<9,(s|0)>-1){l=0;do l=l+-1|0,s=s<<1;while((s|0)>-1)}else l=0;h=l,D=D<<1-l}l=u-D|0,s=(l|0)>-1;t:do if((r|0)>(h|0)){for(;;){if(s)if(l)u=l;else break;if(u=u<<1,r=r+-1|0,l=u-D|0,s=(l|0)>-1,(r|0)<=(h|0))break t}n=w(e*w(0));break e}while(0);if(s)if(l)u=l;else{n=w(e*w(0));break}if(u>>>0<8388608)do u=u<<1,r=r+-1|0;while(u>>>0<8388608);(r|0)>0?r=u+-8388608|r<<23:r=u>>>(1-r|0),n=(t[W>>2]=r|S,w(C[W>>2]))}else M=3;while(0);return(M|0)==3&&(n=w(e*n),n=w(n/n)),w(n)}function XI(e){return e=w(e),C[W>>2]=e,t[W>>2]|0|0}function QI(e,n){return e=e|0,n=n|0,F8(t[582]|0,e,n)|0}function li(e){e=e|0,Xn()}function Pv(e){e=e|0}function JI(e,n){return e=e|0,n=n|0,0}function ZI(e){return e=e|0,(q8(e+4|0)|0)==-1?(M1[t[(t[e>>2]|0)+8>>2]&127](e),e=1):e=0,e|0}function q8(e){e=e|0;var n=0;return n=t[e>>2]|0,t[e>>2]=n+-1,n+-1|0}function J2(e){e=e|0,ZI(e)|0&&$I(e)}function $I(e){e=e|0;var n=0;n=e+8|0,((t[n>>2]|0)!=0?(q8(n)|0)!=-1:0)||M1[t[(t[e>>2]|0)+16>>2]&127](e)}function cn(e){e=e|0;var n=0;for(n=(e|0)==0?1:e;e=C_(n)|0,!(e|0);){if(e=tB()|0,!e){e=0;break}rS[e&0]()}return e|0}function H8(e){return e=e|0,cn(e)|0}function yt(e){e=e|0,x_(e)}function eB(e){e=e|0,(p[e+11>>0]|0)<0&&yt(t[e>>2]|0)}function tB(){var e=0;return e=t[2923]|0,t[2923]=e+0,e|0}function nB(){}function R_(e,n,r,u){return e=e|0,n=n|0,r=r|0,u=u|0,u=n-u-(r>>>0>e>>>0|0)>>>0,ft=u,e-r>>>0|0|0}function KE(e,n,r,u){return e=e|0,n=n|0,r=r|0,u=u|0,r=e+r>>>0,ft=n+u+(r>>>0>>0|0)>>>0,r|0|0}function Iv(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0,h=0;if(s=e+r|0,n=n&255,(r|0)>=67){for(;e&3;)p[e>>0]=n,e=e+1|0;for(u=s&-4|0,l=u-64|0,h=n|n<<8|n<<16|n<<24;(e|0)<=(l|0);)t[e>>2]=h,t[e+4>>2]=h,t[e+8>>2]=h,t[e+12>>2]=h,t[e+16>>2]=h,t[e+20>>2]=h,t[e+24>>2]=h,t[e+28>>2]=h,t[e+32>>2]=h,t[e+36>>2]=h,t[e+40>>2]=h,t[e+44>>2]=h,t[e+48>>2]=h,t[e+52>>2]=h,t[e+56>>2]=h,t[e+60>>2]=h,e=e+64|0;for(;(e|0)<(u|0);)t[e>>2]=h,e=e+4|0}for(;(e|0)<(s|0);)p[e>>0]=n,e=e+1|0;return s-r|0}function W8(e,n,r){return e=e|0,n=n|0,r=r|0,(r|0)<32?(ft=n<>>32-r,e<>>r,e>>>r|(n&(1<>>r-32|0)}function pr(e,n,r){e=e|0,n=n|0,r=r|0;var u=0,l=0,s=0;if((r|0)>=8192)return ni(e|0,n|0,r|0)|0;if(s=e|0,l=e+r|0,(e&3)==(n&3)){for(;e&3;){if(!r)return s|0;p[e>>0]=p[n>>0]|0,e=e+1|0,n=n+1|0,r=r-1|0}for(r=l&-4|0,u=r-64|0;(e|0)<=(u|0);)t[e>>2]=t[n>>2],t[e+4>>2]=t[n+4>>2],t[e+8>>2]=t[n+8>>2],t[e+12>>2]=t[n+12>>2],t[e+16>>2]=t[n+16>>2],t[e+20>>2]=t[n+20>>2],t[e+24>>2]=t[n+24>>2],t[e+28>>2]=t[n+28>>2],t[e+32>>2]=t[n+32>>2],t[e+36>>2]=t[n+36>>2],t[e+40>>2]=t[n+40>>2],t[e+44>>2]=t[n+44>>2],t[e+48>>2]=t[n+48>>2],t[e+52>>2]=t[n+52>>2],t[e+56>>2]=t[n+56>>2],t[e+60>>2]=t[n+60>>2],e=e+64|0,n=n+64|0;for(;(e|0)<(r|0);)t[e>>2]=t[n>>2],e=e+4|0,n=n+4|0}else for(r=l-4|0;(e|0)<(r|0);)p[e>>0]=p[n>>0]|0,p[e+1>>0]=p[n+1>>0]|0,p[e+2>>0]=p[n+2>>0]|0,p[e+3>>0]=p[n+3>>0]|0,e=e+4|0,n=n+4|0;for(;(e|0)<(l|0);)p[e>>0]=p[n>>0]|0,e=e+1|0,n=n+1|0;return s|0}function V8(e){e=e|0;var n=0;return n=p[Se+(e&255)>>0]|0,(n|0)<8?n|0:(n=p[Se+(e>>8&255)>>0]|0,(n|0)<8?n+8|0:(n=p[Se+(e>>16&255)>>0]|0,(n|0)<8?n+16|0:(p[Se+(e>>>24)>>0]|0)+24|0))}function G8(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0;var s=0,h=0,D=0,S=0,M=0,O=0,P=0,K=0,Pe=0,Ee=0;if(O=e,S=n,M=S,h=r,K=u,D=K,!M)return s=(l|0)!=0,D?s?(t[l>>2]=e|0,t[l+4>>2]=n&0,K=0,l=0,ft=K,l|0):(K=0,l=0,ft=K,l|0):(s&&(t[l>>2]=(O>>>0)%(h>>>0),t[l+4>>2]=0),K=0,l=(O>>>0)/(h>>>0)>>>0,ft=K,l|0);s=(D|0)==0;do if(h){if(!s){if(s=(vr(D|0)|0)-(vr(M|0)|0)|0,s>>>0<=31){P=s+1|0,D=31-s|0,n=s-31>>31,h=P,e=O>>>(P>>>0)&n|M<>>(P>>>0)&n,s=0,D=O<>2]=e|0,t[l+4>>2]=S|n&0,K=0,l=0,ft=K,l|0):(K=0,l=0,ft=K,l|0)}if(s=h-1|0,s&h|0){D=(vr(h|0)|0)+33-(vr(M|0)|0)|0,Ee=64-D|0,P=32-D|0,S=P>>31,Pe=D-32|0,n=Pe>>31,h=D,e=P-1>>31&M>>>(Pe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&0|S,Ee=(s<<1|0>>>31)&-2|D,ft=Pe,Ee|0}function XE(e,n,r,u){return e=e|0,n=n|0,r=r|0,u=u|0,G8(e,n,r,u,0)|0}function Z2(e){e=e|0;var n=0,r=0;return r=e+15&-16|0,n=t[q>>2]|0,e=n+r|0,(r|0)>0&(e|0)<(n|0)|(e|0)<0?(ur()|0,Vl(12),-1):(t[q>>2]=e,((e|0)>(Fr()|0)?(fr()|0)==0:0)?(t[q>>2]=n,Vl(12),-1):n|0)}function Iy(e,n,r){e=e|0,n=n|0,r=r|0;var u=0;if((n|0)<(e|0)&(e|0)<(n+r|0)){for(u=e,n=n+r|0,e=e+r|0;(r|0)>0;)e=e-1|0,n=n-1|0,r=r-1|0,p[e>>0]=p[n>>0]|0;e=u}else pr(e,n,r)|0;return e|0}function QE(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0;var l=0,s=0;return s=m,m=m+16|0,l=s|0,G8(e,n,r,u,l)|0,m=s,ft=t[l+4>>2]|0,t[l>>2]|0|0}function Y8(e){return e=e|0,(e&255)<<24|(e>>8&255)<<16|(e>>16&255)<<8|e>>>24|0}function rB(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,K8[e&1](n|0,r|0,u|0,l|0,s|0)}function iB(e,n,r){e=e|0,n=n|0,r=w(r),X8[e&1](n|0,w(r))}function uB(e,n,r){e=e|0,n=n|0,r=+r,Q8[e&31](n|0,+r)}function oB(e,n,r,u){return e=e|0,n=n|0,r=w(r),u=w(u),w(J8[e&0](n|0,w(r),w(u)))}function lB(e,n){e=e|0,n=n|0,M1[e&127](n|0)}function sB(e,n,r){e=e|0,n=n|0,r=r|0,N1[e&31](n|0,r|0)}function aB(e,n){return e=e|0,n=n|0,Xp[e&31](n|0)|0}function fB(e,n,r,u,l){e=e|0,n=n|0,r=+r,u=+u,l=l|0,Z8[e&1](n|0,+r,+u,l|0)}function cB(e,n,r,u){e=e|0,n=n|0,r=+r,u=+u,VB[e&1](n|0,+r,+u)}function dB(e,n,r,u){return e=e|0,n=n|0,r=r|0,u=u|0,M_[e&7](n|0,r|0,u|0)|0}function pB(e,n,r,u){return e=e|0,n=n|0,r=r|0,u=u|0,+GB[e&1](n|0,r|0,u|0)}function hB(e,n){return e=e|0,n=n|0,+$8[e&15](n|0)}function vB(e,n,r){return e=e|0,n=n|0,r=+r,YB[e&1](n|0,+r)|0}function mB(e,n,r){return e=e|0,n=n|0,r=r|0,ZE[e&15](n|0,r|0)|0}function yB(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=+u,l=+l,s=s|0,KB[e&1](n|0,r|0,+u,+l,s|0)}function gB(e,n,r,u,l,s,h){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,h=h|0,XB[e&1](n|0,r|0,u|0,l|0,s|0,h|0)}function _B(e,n,r){return e=e|0,n=n|0,r=r|0,+eS[e&7](n|0,r|0)}function EB(e){return e=e|0,N_[e&7]()|0}function DB(e,n,r,u,l,s){return e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,tS[e&1](n|0,r|0,u|0,l|0,s|0)|0}function wB(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=+l,QB[e&1](n|0,r|0,u|0,+l)}function SB(e,n,r,u,l,s,h){e=e|0,n=n|0,r=r|0,u=w(u),l=l|0,s=w(s),h=h|0,nS[e&1](n|0,r|0,w(u),l|0,w(s),h|0)}function TB(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,jy[e&15](n|0,r|0,u|0)}function CB(e){e=e|0,rS[e&0]()}function xB(e,n,r,u){e=e|0,n=n|0,r=r|0,u=+u,iS[e&15](n|0,r|0,+u)}function AB(e,n,r){return e=e|0,n=+n,r=+r,JB[e&1](+n,+r)|0}function RB(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,$E[e&15](n|0,r|0,u|0,l|0)}function OB(e,n,r,u,l){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,Ut(0)}function kB(e,n){e=e|0,n=w(n),Ut(1)}function Ks(e,n){e=e|0,n=+n,Ut(2)}function MB(e,n,r){return e=e|0,n=w(n),r=w(r),Ut(3),St}function Kn(e){e=e|0,Ut(4)}function By(e,n){e=e|0,n=n|0,Ut(5)}function xa(e){return e=e|0,Ut(6),0}function NB(e,n,r,u){e=e|0,n=+n,r=+r,u=u|0,Ut(7)}function LB(e,n,r){e=e|0,n=+n,r=+r,Ut(8)}function FB(e,n,r){return e=e|0,n=n|0,r=r|0,Ut(9),0}function bB(e,n,r){return e=e|0,n=n|0,r=r|0,Ut(10),0}function Kp(e){return e=e|0,Ut(11),0}function PB(e,n){return e=e|0,n=+n,Ut(12),0}function Uy(e,n){return e=e|0,n=n|0,Ut(13),0}function IB(e,n,r,u,l){e=e|0,n=n|0,r=+r,u=+u,l=l|0,Ut(14)}function BB(e,n,r,u,l,s){e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,s=s|0,Ut(15)}function JE(e,n){return e=e|0,n=n|0,Ut(16),0}function UB(){return Ut(17),0}function jB(e,n,r,u,l){return e=e|0,n=n|0,r=r|0,u=u|0,l=l|0,Ut(18),0}function zB(e,n,r,u){e=e|0,n=n|0,r=r|0,u=+u,Ut(19)}function qB(e,n,r,u,l,s){e=e|0,n=n|0,r=w(r),u=u|0,l=w(l),s=s|0,Ut(20)}function k_(e,n,r){e=e|0,n=n|0,r=r|0,Ut(21)}function HB(){Ut(22)}function Bv(e,n,r){e=e|0,n=n|0,r=+r,Ut(23)}function WB(e,n){return e=+e,n=+n,Ut(24),0}function Uv(e,n,r,u){e=e|0,n=n|0,r=r|0,u=u|0,Ut(25)}var K8=[OB,UL],X8=[kB,Ju],Q8=[Ks,ua,ys,gs,Ql,Io,hf,tl,Ia,Zu,vf,jc,lc,Sl,_s,oa,n2,la,sc,Ks,Ks,Ks,Ks,Ks,Ks,Ks,Ks,Ks,Ks,Ks,Ks,Ks],J8=[MB],M1=[Kn,Pv,an,$l,go,Lf,x1,Fl,hN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,KO,dM,Bv,Bv,Bv,Bv,Bv],JB=[WB,dN],$E=[Uv,_p,Rc,pk,tM,NM,ZM,NN,lL,JF,rI,Uv,Uv,Uv,Uv,Uv];return{_llvm_bswap_i32:Y8,dynCall_idd:AB,dynCall_i:EB,_i64Subtract:R_,___udivdi3:XE,dynCall_vif:iB,setThrew:fs,dynCall_viii:TB,_bitshift64Lshr:O_,_bitshift64Shl:W8,dynCall_vi:lB,dynCall_viiddi:yB,dynCall_diii:pB,dynCall_iii:mB,_memset:Iv,_sbrk:Z2,_memcpy:pr,__GLOBAL__sub_I_Yoga_cpp:Qi,dynCall_vii:sB,___uremdi3:QE,dynCall_vid:uB,stackAlloc:so,_nbind_init:hI,getTempRet0:X,dynCall_di:hB,dynCall_iid:vB,setTempRet0:P0,_i64Add:KE,dynCall_fiff:oB,dynCall_iiii:dB,_emscripten_get_global_libc:CI,dynCall_viid:xB,dynCall_viiid:wB,dynCall_viififi:SB,dynCall_ii:aB,__GLOBAL__sub_I_Binding_cc:kF,dynCall_viiii:RB,dynCall_iiiiii:DB,stackSave:Jo,dynCall_viiiii:rB,__GLOBAL__sub_I_nbind_cc:Us,dynCall_vidd:cB,_free:x_,runPostSets:nB,dynCall_viiiiii:gB,establishStackSpace:Fu,_memmove:Iy,stackRestore:Gl,_malloc:C_,__GLOBAL__sub_I_common_cc:XN,dynCall_viddi:fB,dynCall_dii:_B,dynCall_v:CB}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer),_llvm_bswap_i32=Module._llvm_bswap_i32=asm._llvm_bswap_i32,getTempRet0=Module.getTempRet0=asm.getTempRet0,___udivdi3=Module.___udivdi3=asm.___udivdi3,setThrew=Module.setThrew=asm.setThrew,_bitshift64Lshr=Module._bitshift64Lshr=asm._bitshift64Lshr,_bitshift64Shl=Module._bitshift64Shl=asm._bitshift64Shl,_memset=Module._memset=asm._memset,_sbrk=Module._sbrk=asm._sbrk,_memcpy=Module._memcpy=asm._memcpy,stackAlloc=Module.stackAlloc=asm.stackAlloc,___uremdi3=Module.___uremdi3=asm.___uremdi3,_nbind_init=Module._nbind_init=asm._nbind_init,_i64Subtract=Module._i64Subtract=asm._i64Subtract,setTempRet0=Module.setTempRet0=asm.setTempRet0,_i64Add=Module._i64Add=asm._i64Add,_emscripten_get_global_libc=Module._emscripten_get_global_libc=asm._emscripten_get_global_libc,__GLOBAL__sub_I_Yoga_cpp=Module.__GLOBAL__sub_I_Yoga_cpp=asm.__GLOBAL__sub_I_Yoga_cpp,__GLOBAL__sub_I_Binding_cc=Module.__GLOBAL__sub_I_Binding_cc=asm.__GLOBAL__sub_I_Binding_cc,stackSave=Module.stackSave=asm.stackSave,__GLOBAL__sub_I_nbind_cc=Module.__GLOBAL__sub_I_nbind_cc=asm.__GLOBAL__sub_I_nbind_cc,_free=Module._free=asm._free,runPostSets=Module.runPostSets=asm.runPostSets,establishStackSpace=Module.establishStackSpace=asm.establishStackSpace,_memmove=Module._memmove=asm._memmove,stackRestore=Module.stackRestore=asm.stackRestore,_malloc=Module._malloc=asm._malloc,__GLOBAL__sub_I_common_cc=Module.__GLOBAL__sub_I_common_cc=asm.__GLOBAL__sub_I_common_cc,dynCall_viiiii=Module.dynCall_viiiii=asm.dynCall_viiiii,dynCall_vif=Module.dynCall_vif=asm.dynCall_vif,dynCall_vid=Module.dynCall_vid=asm.dynCall_vid,dynCall_fiff=Module.dynCall_fiff=asm.dynCall_fiff,dynCall_vi=Module.dynCall_vi=asm.dynCall_vi,dynCall_vii=Module.dynCall_vii=asm.dynCall_vii,dynCall_ii=Module.dynCall_ii=asm.dynCall_ii,dynCall_viddi=Module.dynCall_viddi=asm.dynCall_viddi,dynCall_vidd=Module.dynCall_vidd=asm.dynCall_vidd,dynCall_iiii=Module.dynCall_iiii=asm.dynCall_iiii,dynCall_diii=Module.dynCall_diii=asm.dynCall_diii,dynCall_di=Module.dynCall_di=asm.dynCall_di,dynCall_iid=Module.dynCall_iid=asm.dynCall_iid,dynCall_iii=Module.dynCall_iii=asm.dynCall_iii,dynCall_viiddi=Module.dynCall_viiddi=asm.dynCall_viiddi,dynCall_viiiiii=Module.dynCall_viiiiii=asm.dynCall_viiiiii,dynCall_dii=Module.dynCall_dii=asm.dynCall_dii,dynCall_i=Module.dynCall_i=asm.dynCall_i,dynCall_iiiiii=Module.dynCall_iiiiii=asm.dynCall_iiiiii,dynCall_viiid=Module.dynCall_viiid=asm.dynCall_viiid,dynCall_viififi=Module.dynCall_viififi=asm.dynCall_viififi,dynCall_viii=Module.dynCall_viii=asm.dynCall_viii,dynCall_v=Module.dynCall_v=asm.dynCall_v,dynCall_viid=Module.dynCall_viid=asm.dynCall_viid,dynCall_idd=Module.dynCall_idd=asm.dynCall_idd,dynCall_viiii=Module.dynCall_viiii=asm.dynCall_viiii;Runtime.stackAlloc=Module.stackAlloc,Runtime.stackSave=Module.stackSave,Runtime.stackRestore=Module.stackRestore,Runtime.establishStackSpace=Module.establishStackSpace,Runtime.setTempRet0=Module.setTempRet0,Runtime.getTempRet0=Module.getTempRet0,Module.asm=asm;function ExitStatus(i){this.name="ExitStatus",this.message="Program terminated with exit("+i+")",this.status=i}ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop,preloadStartTime=null,calledMain=!1;dependenciesFulfilled=function i(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=i)},Module.callMain=Module.callMain=function(o){o=o||[],ensureInitRuntime();var f=o.length+1;function p(){for(var N=0;N<4-1;N++)E.push(0)}var E=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];p();for(var t=0;t0||(preRun(),runDependencies>0)||Module.calledRun)return;function o(){Module.calledRun||(Module.calledRun=!0,!ABORT&&(ensureInitRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Module._main&&shouldRunNow&&Module.callMain(i),postRun()))}Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),o()},1)):o()}Module.run=Module.run=run;function exit(i,o){o&&Module.noExitRuntime||(Module.noExitRuntime||(ABORT=!0,EXITSTATUS=i,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(i)),ENVIRONMENT_IS_NODE&&process.exit(i),Module.quit(i,new ExitStatus(i)))}Module.exit=Module.exit=exit;var abortDecorators=[];function abort(i){Module.onAbort&&Module.onAbort(i),i!==void 0?(Module.print(i),Module.printErr(i),i=JSON.stringify(i)):i="",ABORT=!0,EXITSTATUS=1;var o=` +If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.`,f="abort("+i+") at "+stackTrace()+o;throw abortDecorators&&abortDecorators.forEach(function(p){f=p(f,i)}),f}if(Module.abort=Module.abort=abort,Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run()})});var eh=ce((Wne,O9)=>{"use strict";var tX=A9(),nX=R9(),hw=!1,vw=null;nX({},function(i,o){if(!hw){if(hw=!0,i)throw i;vw=o}});if(!hw)throw new Error("Failed to load the yoga module - it needed to be loaded synchronously, but didn't");O9.exports=tX(vw.bind,vw.lib)});var M9=ce((Vne,k9)=>{"use strict";k9.exports=({onlyFirst:i=!1}={})=>{let o=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(o,i?void 0:"g")}});var mw=ce((Gne,N9)=>{"use strict";var rX=M9();N9.exports=i=>typeof i=="string"?i.replace(rX(),""):i});var gw=ce((Yne,yw)=>{"use strict";var L9=i=>Number.isNaN(i)?!1:i>=4352&&(i<=4447||i===9001||i===9002||11904<=i&&i<=12871&&i!==12351||12880<=i&&i<=19903||19968<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65131||65281<=i&&i<=65376||65504<=i&&i<=65510||110592<=i&&i<=110593||127488<=i&&i<=127569||131072<=i&&i<=262141);yw.exports=L9;yw.exports.default=L9});var b9=ce((Kne,F9)=>{"use strict";F9.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-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8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD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=>{"use strict";var iX=mw(),uX=gw(),oX=b9(),P9=i=>{if(i=i.replace(oX()," "),typeof i!="string"||i.length===0)return 0;i=iX(i);let o=0;for(let f=0;f=127&&p<=159||p>=768&&p<=879||(p>65535&&f++,o+=uX(p)?2:1)}return o};_w.exports=P9;_w.exports.default=P9});var Dw=ce((Qne,Ew)=>{"use strict";var lX=m4(),I9=i=>{let o=0;for(let f of i.split(` +`))o=Math.max(o,lX(f));return o};Ew.exports=I9;Ew.exports.default=I9});var B9=ce(vg=>{"use strict";var sX=vg&&vg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(vg,"__esModule",{value:!0});var aX=sX(Dw()),ww={};vg.default=i=>{if(i.length===0)return{width:0,height:0};if(ww[i])return ww[i];let o=aX.default(i),f=i.split(` +`).length;return ww[i]={width:o,height:f},{width:o,height:f}}});var U9=ce(mg=>{"use strict";var fX=mg&&mg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(mg,"__esModule",{value:!0});var Ii=fX(eh()),cX=(i,o)=>{"position"in o&&i.setPositionType(o.position==="absolute"?Ii.default.POSITION_TYPE_ABSOLUTE:Ii.default.POSITION_TYPE_RELATIVE)},dX=(i,o)=>{"marginLeft"in o&&i.setMargin(Ii.default.EDGE_START,o.marginLeft||0),"marginRight"in o&&i.setMargin(Ii.default.EDGE_END,o.marginRight||0),"marginTop"in o&&i.setMargin(Ii.default.EDGE_TOP,o.marginTop||0),"marginBottom"in o&&i.setMargin(Ii.default.EDGE_BOTTOM,o.marginBottom||0)},pX=(i,o)=>{"paddingLeft"in o&&i.setPadding(Ii.default.EDGE_LEFT,o.paddingLeft||0),"paddingRight"in o&&i.setPadding(Ii.default.EDGE_RIGHT,o.paddingRight||0),"paddingTop"in o&&i.setPadding(Ii.default.EDGE_TOP,o.paddingTop||0),"paddingBottom"in o&&i.setPadding(Ii.default.EDGE_BOTTOM,o.paddingBottom||0)},hX=(i,o)=>{var f;"flexGrow"in o&&i.setFlexGrow((f=o.flexGrow)!==null&&f!==void 0?f:0),"flexShrink"in o&&i.setFlexShrink(typeof o.flexShrink=="number"?o.flexShrink:1),"flexDirection"in o&&(o.flexDirection==="row"&&i.setFlexDirection(Ii.default.FLEX_DIRECTION_ROW),o.flexDirection==="row-reverse"&&i.setFlexDirection(Ii.default.FLEX_DIRECTION_ROW_REVERSE),o.flexDirection==="column"&&i.setFlexDirection(Ii.default.FLEX_DIRECTION_COLUMN),o.flexDirection==="column-reverse"&&i.setFlexDirection(Ii.default.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in o&&(typeof o.flexBasis=="number"?i.setFlexBasis(o.flexBasis):typeof o.flexBasis=="string"?i.setFlexBasisPercent(Number.parseInt(o.flexBasis,10)):i.setFlexBasis(NaN)),"alignItems"in o&&((o.alignItems==="stretch"||!o.alignItems)&&i.setAlignItems(Ii.default.ALIGN_STRETCH),o.alignItems==="flex-start"&&i.setAlignItems(Ii.default.ALIGN_FLEX_START),o.alignItems==="center"&&i.setAlignItems(Ii.default.ALIGN_CENTER),o.alignItems==="flex-end"&&i.setAlignItems(Ii.default.ALIGN_FLEX_END)),"alignSelf"in o&&((o.alignSelf==="auto"||!o.alignSelf)&&i.setAlignSelf(Ii.default.ALIGN_AUTO),o.alignSelf==="flex-start"&&i.setAlignSelf(Ii.default.ALIGN_FLEX_START),o.alignSelf==="center"&&i.setAlignSelf(Ii.default.ALIGN_CENTER),o.alignSelf==="flex-end"&&i.setAlignSelf(Ii.default.ALIGN_FLEX_END)),"justifyContent"in o&&((o.justifyContent==="flex-start"||!o.justifyContent)&&i.setJustifyContent(Ii.default.JUSTIFY_FLEX_START),o.justifyContent==="center"&&i.setJustifyContent(Ii.default.JUSTIFY_CENTER),o.justifyContent==="flex-end"&&i.setJustifyContent(Ii.default.JUSTIFY_FLEX_END),o.justifyContent==="space-between"&&i.setJustifyContent(Ii.default.JUSTIFY_SPACE_BETWEEN),o.justifyContent==="space-around"&&i.setJustifyContent(Ii.default.JUSTIFY_SPACE_AROUND))},vX=(i,o)=>{var f,p;"width"in o&&(typeof o.width=="number"?i.setWidth(o.width):typeof o.width=="string"?i.setWidthPercent(Number.parseInt(o.width,10)):i.setWidthAuto()),"height"in o&&(typeof o.height=="number"?i.setHeight(o.height):typeof o.height=="string"?i.setHeightPercent(Number.parseInt(o.height,10)):i.setHeightAuto()),"minWidth"in o&&(typeof o.minWidth=="string"?i.setMinWidthPercent(Number.parseInt(o.minWidth,10)):i.setMinWidth((f=o.minWidth)!==null&&f!==void 0?f:0)),"minHeight"in o&&(typeof o.minHeight=="string"?i.setMinHeightPercent(Number.parseInt(o.minHeight,10)):i.setMinHeight((p=o.minHeight)!==null&&p!==void 0?p:0))},mX=(i,o)=>{"display"in o&&i.setDisplay(o.display==="flex"?Ii.default.DISPLAY_FLEX:Ii.default.DISPLAY_NONE)},yX=(i,o)=>{if("borderStyle"in o){let f=typeof o.borderStyle=="string"?1:0;i.setBorder(Ii.default.EDGE_TOP,f),i.setBorder(Ii.default.EDGE_BOTTOM,f),i.setBorder(Ii.default.EDGE_LEFT,f),i.setBorder(Ii.default.EDGE_RIGHT,f)}};mg.default=(i,o={})=>{cX(i,o),dX(i,o),pX(i,o),hX(i,o),vX(i,o),mX(i,o),yX(i,o)}});var z9=ce(($ne,j9)=>{"use strict";j9.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Sw=ce((ere,q9)=>{var yg=z9(),H9={};for(let i of Object.keys(yg))H9[yg[i]]=i;var In={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};q9.exports=In;for(let i of Object.keys(In)){if(!("channels"in In[i]))throw new Error("missing channels property: "+i);if(!("labels"in In[i]))throw new Error("missing channel labels property: "+i);if(In[i].labels.length!==In[i].channels)throw new Error("channel and label counts mismatch: "+i);let{channels:o,labels:f}=In[i];delete In[i].channels,delete In[i].labels,Object.defineProperty(In[i],"channels",{value:o}),Object.defineProperty(In[i],"labels",{value:f})}In.rgb.hsl=function(i){let o=i[0]/255,f=i[1]/255,p=i[2]/255,E=Math.min(o,f,p),t=Math.max(o,f,p),k=t-E,L,N;t===E?L=0:o===t?L=(f-p)/k:f===t?L=2+(p-o)/k:p===t&&(L=4+(o-f)/k),L=Math.min(L*60,360),L<0&&(L+=360);let C=(E+t)/2;return t===E?N=0:C<=.5?N=k/(t+E):N=k/(2-t-E),[L,N*100,C*100]};In.rgb.hsv=function(i){let o,f,p,E,t,k=i[0]/255,L=i[1]/255,N=i[2]/255,C=Math.max(k,L,N),U=C-Math.min(k,L,N),q=function(W){return(C-W)/6/U+1/2};return U===0?(E=0,t=0):(t=U/C,o=q(k),f=q(L),p=q(N),k===C?E=p-f:L===C?E=1/3+o-p:N===C&&(E=2/3+f-o),E<0?E+=1:E>1&&(E-=1)),[E*360,t*100,C*100]};In.rgb.hwb=function(i){let o=i[0],f=i[1],p=i[2],E=In.rgb.hsl(i)[0],t=1/255*Math.min(o,Math.min(f,p));return p=1-1/255*Math.max(o,Math.max(f,p)),[E,t*100,p*100]};In.rgb.cmyk=function(i){let o=i[0]/255,f=i[1]/255,p=i[2]/255,E=Math.min(1-o,1-f,1-p),t=(1-o-E)/(1-E)||0,k=(1-f-E)/(1-E)||0,L=(1-p-E)/(1-E)||0;return[t*100,k*100,L*100,E*100]};function gX(i,o){return(i[0]-o[0])**2+(i[1]-o[1])**2+(i[2]-o[2])**2}In.rgb.keyword=function(i){let o=H9[i];if(o)return o;let f=Infinity,p;for(let E of Object.keys(yg)){let t=yg[E],k=gX(i,t);k.04045?((o+.055)/1.055)**2.4:o/12.92,f=f>.04045?((f+.055)/1.055)**2.4:f/12.92,p=p>.04045?((p+.055)/1.055)**2.4:p/12.92;let E=o*.4124+f*.3576+p*.1805,t=o*.2126+f*.7152+p*.0722,k=o*.0193+f*.1192+p*.9505;return[E*100,t*100,k*100]};In.rgb.lab=function(i){let o=In.rgb.xyz(i),f=o[0],p=o[1],E=o[2];f/=95.047,p/=100,E/=108.883,f=f>.008856?f**(1/3):7.787*f+16/116,p=p>.008856?p**(1/3):7.787*p+16/116,E=E>.008856?E**(1/3):7.787*E+16/116;let t=116*p-16,k=500*(f-p),L=200*(p-E);return[t,k,L]};In.hsl.rgb=function(i){let o=i[0]/360,f=i[1]/100,p=i[2]/100,E,t,k;if(f===0)return k=p*255,[k,k,k];p<.5?E=p*(1+f):E=p+f-p*f;let L=2*p-E,N=[0,0,0];for(let C=0;C<3;C++)t=o+1/3*-(C-1),t<0&&t++,t>1&&t--,6*t<1?k=L+(E-L)*6*t:2*t<1?k=E:3*t<2?k=L+(E-L)*(2/3-t)*6:k=L,N[C]=k*255;return N};In.hsl.hsv=function(i){let o=i[0],f=i[1]/100,p=i[2]/100,E=f,t=Math.max(p,.01);p*=2,f*=p<=1?p:2-p,E*=t<=1?t:2-t;let k=(p+f)/2,L=p===0?2*E/(t+E):2*f/(p+f);return[o,L*100,k*100]};In.hsv.rgb=function(i){let o=i[0]/60,f=i[1]/100,p=i[2]/100,E=Math.floor(o)%6,t=o-Math.floor(o),k=255*p*(1-f),L=255*p*(1-f*t),N=255*p*(1-f*(1-t));switch(p*=255,E){case 0:return[p,N,k];case 1:return[L,p,k];case 2:return[k,p,N];case 3:return[k,L,p];case 4:return[N,k,p];case 5:return[p,k,L]}};In.hsv.hsl=function(i){let o=i[0],f=i[1]/100,p=i[2]/100,E=Math.max(p,.01),t,k;k=(2-f)*p;let L=(2-f)*E;return t=f*E,t/=L<=1?L:2-L,t=t||0,k/=2,[o,t*100,k*100]};In.hwb.rgb=function(i){let o=i[0]/360,f=i[1]/100,p=i[2]/100,E=f+p,t;E>1&&(f/=E,p/=E);let k=Math.floor(6*o),L=1-p;t=6*o-k,(k&1)!=0&&(t=1-t);let N=f+t*(L-f),C,U,q;switch(k){default:case 6:case 0:C=L,U=N,q=f;break;case 1:C=N,U=L,q=f;break;case 2:C=f,U=L,q=N;break;case 3:C=f,U=N,q=L;break;case 4:C=N,U=f,q=L;break;case 5:C=L,U=f,q=N;break}return[C*255,U*255,q*255]};In.cmyk.rgb=function(i){let o=i[0]/100,f=i[1]/100,p=i[2]/100,E=i[3]/100,t=1-Math.min(1,o*(1-E)+E),k=1-Math.min(1,f*(1-E)+E),L=1-Math.min(1,p*(1-E)+E);return[t*255,k*255,L*255]};In.xyz.rgb=function(i){let o=i[0]/100,f=i[1]/100,p=i[2]/100,E,t,k;return E=o*3.2406+f*-1.5372+p*-.4986,t=o*-.9689+f*1.8758+p*.0415,k=o*.0557+f*-.204+p*1.057,E=E>.0031308?1.055*E**(1/2.4)-.055:E*12.92,t=t>.0031308?1.055*t**(1/2.4)-.055:t*12.92,k=k>.0031308?1.055*k**(1/2.4)-.055:k*12.92,E=Math.min(Math.max(0,E),1),t=Math.min(Math.max(0,t),1),k=Math.min(Math.max(0,k),1),[E*255,t*255,k*255]};In.xyz.lab=function(i){let o=i[0],f=i[1],p=i[2];o/=95.047,f/=100,p/=108.883,o=o>.008856?o**(1/3):7.787*o+16/116,f=f>.008856?f**(1/3):7.787*f+16/116,p=p>.008856?p**(1/3):7.787*p+16/116;let E=116*f-16,t=500*(o-f),k=200*(f-p);return[E,t,k]};In.lab.xyz=function(i){let o=i[0],f=i[1],p=i[2],E,t,k;t=(o+16)/116,E=f/500+t,k=t-p/200;let L=t**3,N=E**3,C=k**3;return t=L>.008856?L:(t-16/116)/7.787,E=N>.008856?N:(E-16/116)/7.787,k=C>.008856?C:(k-16/116)/7.787,E*=95.047,t*=100,k*=108.883,[E,t,k]};In.lab.lch=function(i){let o=i[0],f=i[1],p=i[2],E;E=Math.atan2(p,f)*360/2/Math.PI,E<0&&(E+=360);let k=Math.sqrt(f*f+p*p);return[o,k,E]};In.lch.lab=function(i){let o=i[0],f=i[1],E=i[2]/360*2*Math.PI,t=f*Math.cos(E),k=f*Math.sin(E);return[o,t,k]};In.rgb.ansi16=function(i,o=null){let[f,p,E]=i,t=o===null?In.rgb.hsv(i)[2]:o;if(t=Math.round(t/50),t===0)return 30;let k=30+(Math.round(E/255)<<2|Math.round(p/255)<<1|Math.round(f/255));return t===2&&(k+=60),k};In.hsv.ansi16=function(i){return In.rgb.ansi16(In.hsv.rgb(i),i[2])};In.rgb.ansi256=function(i){let o=i[0],f=i[1],p=i[2];return o===f&&f===p?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(f/255*5)+Math.round(p/255*5)};In.ansi16.rgb=function(i){let o=i%10;if(o===0||o===7)return i>50&&(o+=3.5),o=o/10.5*255,[o,o,o];let f=(~~(i>50)+1)*.5,p=(o&1)*f*255,E=(o>>1&1)*f*255,t=(o>>2&1)*f*255;return[p,E,t]};In.ansi256.rgb=function(i){if(i>=232){let t=(i-232)*10+8;return[t,t,t]}i-=16;let o,f=Math.floor(i/36)/5*255,p=Math.floor((o=i%36)/6)/5*255,E=o%6/5*255;return[f,p,E]};In.rgb.hex=function(i){let f=(((Math.round(i[0])&255)<<16)+((Math.round(i[1])&255)<<8)+(Math.round(i[2])&255)).toString(16).toUpperCase();return"000000".substring(f.length)+f};In.hex.rgb=function(i){let o=i.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!o)return[0,0,0];let f=o[0];o[0].length===3&&(f=f.split("").map(L=>L+L).join(""));let p=parseInt(f,16),E=p>>16&255,t=p>>8&255,k=p&255;return[E,t,k]};In.rgb.hcg=function(i){let o=i[0]/255,f=i[1]/255,p=i[2]/255,E=Math.max(Math.max(o,f),p),t=Math.min(Math.min(o,f),p),k=E-t,L,N;return k<1?L=t/(1-k):L=0,k<=0?N=0:E===o?N=(f-p)/k%6:E===f?N=2+(p-o)/k:N=4+(o-f)/k,N/=6,N%=1,[N*360,k*100,L*100]};In.hsl.hcg=function(i){let o=i[1]/100,f=i[2]/100,p=f<.5?2*o*f:2*o*(1-f),E=0;return p<1&&(E=(f-.5*p)/(1-p)),[i[0],p*100,E*100]};In.hsv.hcg=function(i){let o=i[1]/100,f=i[2]/100,p=o*f,E=0;return p<1&&(E=(f-p)/(1-p)),[i[0],p*100,E*100]};In.hcg.rgb=function(i){let o=i[0]/360,f=i[1]/100,p=i[2]/100;if(f===0)return[p*255,p*255,p*255];let E=[0,0,0],t=o%1*6,k=t%1,L=1-k,N=0;switch(Math.floor(t)){case 0:E[0]=1,E[1]=k,E[2]=0;break;case 1:E[0]=L,E[1]=1,E[2]=0;break;case 2:E[0]=0,E[1]=1,E[2]=k;break;case 3:E[0]=0,E[1]=L,E[2]=1;break;case 4:E[0]=k,E[1]=0,E[2]=1;break;default:E[0]=1,E[1]=0,E[2]=L}return N=(1-f)*p,[(f*E[0]+N)*255,(f*E[1]+N)*255,(f*E[2]+N)*255]};In.hcg.hsv=function(i){let o=i[1]/100,f=i[2]/100,p=o+f*(1-o),E=0;return p>0&&(E=o/p),[i[0],E*100,p*100]};In.hcg.hsl=function(i){let o=i[1]/100,p=i[2]/100*(1-o)+.5*o,E=0;return p>0&&p<.5?E=o/(2*p):p>=.5&&p<1&&(E=o/(2*(1-p))),[i[0],E*100,p*100]};In.hcg.hwb=function(i){let o=i[1]/100,f=i[2]/100,p=o+f*(1-o);return[i[0],(p-o)*100,(1-p)*100]};In.hwb.hcg=function(i){let o=i[1]/100,f=i[2]/100,p=1-f,E=p-o,t=0;return E<1&&(t=(p-E)/(1-E)),[i[0],E*100,t*100]};In.apple.rgb=function(i){return[i[0]/65535*255,i[1]/65535*255,i[2]/65535*255]};In.rgb.apple=function(i){return[i[0]/255*65535,i[1]/255*65535,i[2]/255*65535]};In.gray.rgb=function(i){return[i[0]/100*255,i[0]/100*255,i[0]/100*255]};In.gray.hsl=function(i){return[0,0,i[0]]};In.gray.hsv=In.gray.hsl;In.gray.hwb=function(i){return[0,100,i[0]]};In.gray.cmyk=function(i){return[0,0,0,i[0]]};In.gray.lab=function(i){return[i[0],0,0]};In.gray.hex=function(i){let o=Math.round(i[0]/100*255)&255,p=((o<<16)+(o<<8)+o).toString(16).toUpperCase();return"000000".substring(p.length)+p};In.rgb.gray=function(i){return[(i[0]+i[1]+i[2])/3/255*100]}});var V9=ce((tre,W9)=>{var y4=Sw();function _X(){let i={},o=Object.keys(y4);for(let f=o.length,p=0;p{var Tw=Sw(),SX=V9(),sm={},TX=Object.keys(Tw);function CX(i){let o=function(...f){let p=f[0];return p==null?p:(p.length>1&&(f=p),i(f))};return"conversion"in i&&(o.conversion=i.conversion),o}function xX(i){let o=function(...f){let p=f[0];if(p==null)return p;p.length>1&&(f=p);let E=i(f);if(typeof E=="object")for(let t=E.length,k=0;k{sm[i]={},Object.defineProperty(sm[i],"channels",{value:Tw[i].channels}),Object.defineProperty(sm[i],"labels",{value:Tw[i].labels});let o=SX(i);Object.keys(o).forEach(p=>{let E=o[p];sm[i][p]=xX(E),sm[i][p].raw=CX(E)})});G9.exports=sm});var _4=ce((rre,K9)=>{"use strict";var X9=(i,o)=>(...f)=>`[${i(...f)+o}m`,Q9=(i,o)=>(...f)=>{let p=i(...f);return`[${38+o};5;${p}m`},J9=(i,o)=>(...f)=>{let p=i(...f);return`[${38+o};2;${p[0]};${p[1]};${p[2]}m`},g4=i=>i,Z9=(i,o,f)=>[i,o,f],am=(i,o,f)=>{Object.defineProperty(i,o,{get:()=>{let p=f();return Object.defineProperty(i,o,{value:p,enumerable:!0,configurable:!0}),p},enumerable:!0,configurable:!0})},Cw,fm=(i,o,f,p)=>{Cw===void 0&&(Cw=Y9());let E=p?10:0,t={};for(let[k,L]of Object.entries(Cw)){let N=k==="ansi16"?"ansi":k;k===o?t[N]=i(f,E):typeof L=="object"&&(t[N]=i(L[o],E))}return t};function AX(){let i=new Map,o={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};o.color.gray=o.color.blackBright,o.bgColor.bgGray=o.bgColor.bgBlackBright,o.color.grey=o.color.blackBright,o.bgColor.bgGrey=o.bgColor.bgBlackBright;for(let[f,p]of Object.entries(o)){for(let[E,t]of Object.entries(p))o[E]={open:`[${t[0]}m`,close:`[${t[1]}m`},p[E]=o[E],i.set(t[0],t[1]);Object.defineProperty(o,f,{value:p,enumerable:!1})}return Object.defineProperty(o,"codes",{value:i,enumerable:!1}),o.color.close="",o.bgColor.close="",am(o.color,"ansi",()=>fm(X9,"ansi16",g4,!1)),am(o.color,"ansi256",()=>fm(Q9,"ansi256",g4,!1)),am(o.color,"ansi16m",()=>fm(J9,"rgb",Z9,!1)),am(o.bgColor,"ansi",()=>fm(X9,"ansi16",g4,!0)),am(o.bgColor,"ansi256",()=>fm(Q9,"ansi256",g4,!0)),am(o.bgColor,"ansi16m",()=>fm(J9,"rgb",Z9,!0)),o}Object.defineProperty(K9,"exports",{enumerable:!0,get:AX})});var tA=ce((ire,$9)=>{"use strict";var gg=m4(),RX=mw(),OX=_4(),xw=new Set(["","\x9B"]),kX=39,eA=i=>`${xw.values().next().value}[${i}m`,MX=i=>i.split(" ").map(o=>gg(o)),Aw=(i,o,f)=>{let p=[...o],E=!1,t=gg(RX(i[i.length-1]));for(let[k,L]of p.entries()){let N=gg(L);if(t+N<=f?i[i.length-1]+=L:(i.push(L),t=0),xw.has(L))E=!0;else if(E&&L==="m"){E=!1;continue}E||(t+=N,t===f&&k0&&i.length>1&&(i[i.length-2]+=i.pop())},NX=i=>{let o=i.split(" "),f=o.length;for(;f>0&&!(gg(o[f-1])>0);)f--;return f===o.length?i:o.slice(0,f).join(" ")+o.slice(f).join("")},LX=(i,o,f={})=>{if(f.trim!==!1&&i.trim()==="")return"";let p="",E="",t,k=MX(i),L=[""];for(let[N,C]of i.split(" ").entries()){f.trim!==!1&&(L[L.length-1]=L[L.length-1].trimLeft());let U=gg(L[L.length-1]);if(N!==0&&(U>=o&&(f.wordWrap===!1||f.trim===!1)&&(L.push(""),U=0),(U>0||f.trim===!1)&&(L[L.length-1]+=" ",U++)),f.hard&&k[N]>o){let q=o-U,W=1+Math.floor((k[N]-q-1)/o);Math.floor((k[N]-1)/o)o&&U>0&&k[N]>0){if(f.wordWrap===!1&&Uo&&f.wordWrap===!1){Aw(L,C,o);continue}L[L.length-1]+=C}f.trim!==!1&&(L=L.map(NX)),p=L.join(` +`);for(let[N,C]of[...p].entries()){if(E+=C,xw.has(C)){let q=parseFloat(/\d[^m]*/.exec(p.slice(N,N+4)));t=q===kX?null:q}let U=OX.codes.get(Number(t));t&&U&&(p[N+1]===` +`?E+=eA(U):C===` +`&&(E+=eA(t)))}return E};$9.exports=(i,o,f)=>String(i).normalize().replace(/\r\n/g,` +`).split(` +`).map(p=>LX(p,o,f)).join(` +`)});var iA=ce((ure,nA)=>{"use strict";var rA="[\uD800-\uDBFF][\uDC00-\uDFFF]",FX=i=>i&&i.exact?new RegExp(`^${rA}$`):new RegExp(rA,"g");nA.exports=FX});var Rw=ce((ore,uA)=>{"use strict";var bX=gw(),PX=iA(),oA=_4(),lA=["","\x9B"],E4=i=>`${lA[0]}[${i}m`,sA=(i,o,f)=>{let p=[];i=[...i];for(let E of i){let t=E;E.match(";")&&(E=E.split(";")[0][0]+"0");let k=oA.codes.get(parseInt(E,10));if(k){let L=i.indexOf(k.toString());L>=0?i.splice(L,1):p.push(E4(o?k:t))}else if(o){p.push(E4(0));break}else p.push(E4(t))}if(o&&(p=p.filter((E,t)=>p.indexOf(E)===t),f!==void 0)){let E=E4(oA.codes.get(parseInt(f,10)));p=p.reduce((t,k)=>k===E?[k,...t]:[...t,k],[])}return p.join("")};uA.exports=(i,o,f)=>{let p=[...i.normalize()],E=[];f=typeof f=="number"?f:p.length;let t=!1,k,L=0,N="";for(let[C,U]of p.entries()){let q=!1;if(lA.includes(U)){let W=/\d[^m]*/.exec(i.slice(C,C+18));k=W&&W.length>0?W[0]:void 0,Lo&&L<=f)N+=U;else if(L===o&&!t&&k!==void 0)N=sA(E);else if(L>=f){N+=sA(E,!0,k);break}}return N}});var fA=ce((lre,aA)=>{"use strict";var pd=Rw(),IX=m4();function D4(i,o,f){if(i.charAt(o)===" ")return o;for(let p=1;p<=3;p++)if(f){if(i.charAt(o+p)===" ")return o+p}else if(i.charAt(o-p)===" ")return o-p;return o}aA.exports=(i,o,f)=>{f=E0({position:"end",preferTruncationOnSpace:!1},f);let{position:p,space:E,preferTruncationOnSpace:t}=f,k="\u2026",L=1;if(typeof i!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof i}`);if(typeof o!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof o}`);if(o<1)return"";if(o===1)return k;let N=IX(i);if(N<=o)return i;if(p==="start"){if(t){let C=D4(i,N-o+1,!0);return k+pd(i,C,N).trim()}return E===!0&&(k+=" ",L=2),k+pd(i,N-o+L,N)}if(p==="middle"){E===!0&&(k=" "+k+" ",L=3);let C=Math.floor(o/2);if(t){let U=D4(i,C),q=D4(i,N-(o-C)+1,!0);return pd(i,0,U)+k+pd(i,q,N).trim()}return pd(i,0,C)+k+pd(i,N-(o-C)+L,N)}if(p==="end"){if(t){let C=D4(i,o-1);return pd(i,0,C)+k}return E===!0&&(k=" "+k,L=2),pd(i,0,o-L)+k}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${p}`)}});var kw=ce(_g=>{"use strict";var cA=_g&&_g.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(_g,"__esModule",{value:!0});var BX=cA(tA()),UX=cA(fA()),Ow={};_g.default=(i,o,f)=>{let p=i+String(o)+String(f);if(Ow[p])return Ow[p];let E=i;if(f==="wrap"&&(E=BX.default(i,o,{trim:!1,hard:!0})),f.startsWith("truncate")){let t="end";f==="truncate-middle"&&(t="middle"),f==="truncate-start"&&(t="start"),E=UX.default(i,o,{position:t})}return Ow[p]=E,E}});var Nw=ce(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});var dA=i=>{let o="";if(i.childNodes.length>0)for(let f of i.childNodes){let p="";f.nodeName==="#text"?p=f.nodeValue:((f.nodeName==="ink-text"||f.nodeName==="ink-virtual-text")&&(p=dA(f)),p.length>0&&typeof f.internal_transform=="function"&&(p=f.internal_transform(p))),o+=p}return o};Mw.default=dA});var Lw=ce(l0=>{"use strict";var Eg=l0&&l0.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(l0,"__esModule",{value:!0});l0.setTextNodeValue=l0.createTextNode=l0.setStyle=l0.setAttribute=l0.removeChildNode=l0.insertBeforeNode=l0.appendChildNode=l0.createNode=l0.TEXT_NAME=void 0;var jX=Eg(eh()),pA=Eg(B9()),zX=Eg(U9()),qX=Eg(kw()),HX=Eg(Nw());l0.TEXT_NAME="#text";l0.createNode=i=>{var o;let f={nodeName:i,style:{},attributes:{},childNodes:[],parentNode:null,yogaNode:i==="ink-virtual-text"?void 0:jX.default.Node.create()};return i==="ink-text"&&((o=f.yogaNode)===null||o===void 0||o.setMeasureFunc(WX.bind(null,f))),f};l0.appendChildNode=(i,o)=>{var f;o.parentNode&&l0.removeChildNode(o.parentNode,o),o.parentNode=i,i.childNodes.push(o),o.yogaNode&&((f=i.yogaNode)===null||f===void 0||f.insertChild(o.yogaNode,i.yogaNode.getChildCount())),(i.nodeName==="ink-text"||i.nodeName==="ink-virtual-text")&&w4(i)};l0.insertBeforeNode=(i,o,f)=>{var p,E;o.parentNode&&l0.removeChildNode(o.parentNode,o),o.parentNode=i;let t=i.childNodes.indexOf(f);if(t>=0){i.childNodes.splice(t,0,o),o.yogaNode&&((p=i.yogaNode)===null||p===void 0||p.insertChild(o.yogaNode,t));return}i.childNodes.push(o),o.yogaNode&&((E=i.yogaNode)===null||E===void 0||E.insertChild(o.yogaNode,i.yogaNode.getChildCount())),(i.nodeName==="ink-text"||i.nodeName==="ink-virtual-text")&&w4(i)};l0.removeChildNode=(i,o)=>{var f,p;o.yogaNode&&((p=(f=o.parentNode)===null||f===void 0?void 0:f.yogaNode)===null||p===void 0||p.removeChild(o.yogaNode)),o.parentNode=null;let E=i.childNodes.indexOf(o);E>=0&&i.childNodes.splice(E,1),(i.nodeName==="ink-text"||i.nodeName==="ink-virtual-text")&&w4(i)};l0.setAttribute=(i,o,f)=>{i.attributes[o]=f};l0.setStyle=(i,o)=>{i.style=o,i.yogaNode&&zX.default(i.yogaNode,o)};l0.createTextNode=i=>{let o={nodeName:"#text",nodeValue:i,yogaNode:void 0,parentNode:null,style:{}};return l0.setTextNodeValue(o,i),o};var WX=function(i,o){var f,p;let E=i.nodeName==="#text"?i.nodeValue:HX.default(i),t=pA.default(E);if(t.width<=o||t.width>=1&&o>0&&o<1)return t;let k=(p=(f=i.style)===null||f===void 0?void 0:f.textWrap)!==null&&p!==void 0?p:"wrap",L=qX.default(E,o,k);return pA.default(L)},hA=i=>{var o;if(!(!i||!i.parentNode))return(o=i.yogaNode)!==null&&o!==void 0?o:hA(i.parentNode)},w4=i=>{let o=hA(i);o==null||o.markDirty()};l0.setTextNodeValue=(i,o)=>{typeof o!="string"&&(o=String(o)),i.nodeValue=o,w4(i)}});var th=ce((cre,vA)=>{"use strict";vA.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),EMPTY_BUFFER:Buffer.alloc(0),NOOP:()=>{}}});var Dg=ce((dre,Fw)=>{"use strict";var{EMPTY_BUFFER:VX}=th();function mA(i,o){if(i.length===0)return VX;if(i.length===1)return i[0];let f=Buffer.allocUnsafe(o),p=0;for(let E=0;E{"use strict";var DA=Symbol("kDone"),bw=Symbol("kRun"),wA=class{constructor(o){this[DA]=()=>{this.pending--,this[bw]()},this.concurrency=o||Infinity,this.jobs=[],this.pending=0}add(o){this.jobs.push(o),this[bw]()}[bw](){if(this.pending!==this.concurrency&&this.jobs.length){let o=this.jobs.shift();this.pending++,o(this[DA])}}};EA.exports=wA});var Tg=ce((hre,TA)=>{"use strict";var wg=require("zlib"),CA=Dg(),GX=SA(),{kStatusCode:xA,NOOP:YX}=th(),KX=Buffer.from([0,0,255,255]),T4=Symbol("permessage-deflate"),G1=Symbol("total-length"),Sg=Symbol("callback"),hd=Symbol("buffers"),Pw=Symbol("error"),C4,AA=class{constructor(o,f,p){if(this._maxPayload=p|0,this._options=o||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!f,this._deflate=null,this._inflate=null,this.params=null,!C4){let E=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;C4=new GX(E)}}static get extensionName(){return"permessage-deflate"}offer(){let o={};return this._options.serverNoContextTakeover&&(o.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(o.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(o.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?o.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(o.client_max_window_bits=!0),o}accept(o){return o=this.normalizeParams(o),this.params=this._isServer?this.acceptAsServer(o):this.acceptAsClient(o),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let o=this._deflate[Sg];this._deflate.close(),this._deflate=null,o&&o(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(o){let f=this._options,p=o.find(E=>!(f.serverNoContextTakeover===!1&&E.server_no_context_takeover||E.server_max_window_bits&&(f.serverMaxWindowBits===!1||typeof f.serverMaxWindowBits=="number"&&f.serverMaxWindowBits>E.server_max_window_bits)||typeof f.clientMaxWindowBits=="number"&&!E.client_max_window_bits));if(!p)throw new Error("None of the extension offers can be accepted");return f.serverNoContextTakeover&&(p.server_no_context_takeover=!0),f.clientNoContextTakeover&&(p.client_no_context_takeover=!0),typeof f.serverMaxWindowBits=="number"&&(p.server_max_window_bits=f.serverMaxWindowBits),typeof f.clientMaxWindowBits=="number"?p.client_max_window_bits=f.clientMaxWindowBits:(p.client_max_window_bits===!0||f.clientMaxWindowBits===!1)&&delete p.client_max_window_bits,p}acceptAsClient(o){let f=o[0];if(this._options.clientNoContextTakeover===!1&&f.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!f.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(f.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&f.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return f}normalizeParams(o){return o.forEach(f=>{Object.keys(f).forEach(p=>{let E=f[p];if(E.length>1)throw new Error(`Parameter "${p}" must have only a single value`);if(E=E[0],p==="client_max_window_bits"){if(E!==!0){let t=+E;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${p}": ${E}`);E=t}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${p}": ${E}`)}else if(p==="server_max_window_bits"){let t=+E;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${p}": ${E}`);E=t}else if(p==="client_no_context_takeover"||p==="server_no_context_takeover"){if(E!==!0)throw new TypeError(`Invalid value for parameter "${p}": ${E}`)}else throw new Error(`Unknown parameter "${p}"`);f[p]=E})}),o}decompress(o,f,p){C4.add(E=>{this._decompress(o,f,(t,k)=>{E(),p(t,k)})})}compress(o,f,p){C4.add(E=>{this._compress(o,f,(t,k)=>{E(),p(t,k)})})}_decompress(o,f,p){let E=this._isServer?"client":"server";if(!this._inflate){let t=`${E}_max_window_bits`,k=typeof this.params[t]!="number"?wg.Z_DEFAULT_WINDOWBITS:this.params[t];this._inflate=wg.createInflateRaw(Gf(E0({},this._options.zlibInflateOptions),{windowBits:k})),this._inflate[T4]=this,this._inflate[G1]=0,this._inflate[hd]=[],this._inflate.on("error",QX),this._inflate.on("data",RA)}this._inflate[Sg]=p,this._inflate.write(o),f&&this._inflate.write(KX),this._inflate.flush(()=>{let t=this._inflate[Pw];if(t){this._inflate.close(),this._inflate=null,p(t);return}let k=CA.concat(this._inflate[hd],this._inflate[G1]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[G1]=0,this._inflate[hd]=[],f&&this.params[`${E}_no_context_takeover`]&&this._inflate.reset()),p(null,k)})}_compress(o,f,p){let E=this._isServer?"server":"client";if(!this._deflate){let t=`${E}_max_window_bits`,k=typeof this.params[t]!="number"?wg.Z_DEFAULT_WINDOWBITS:this.params[t];this._deflate=wg.createDeflateRaw(Gf(E0({},this._options.zlibDeflateOptions),{windowBits:k})),this._deflate[G1]=0,this._deflate[hd]=[],this._deflate.on("error",YX),this._deflate.on("data",XX)}this._deflate[Sg]=p,this._deflate.write(o),this._deflate.flush(wg.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let t=CA.concat(this._deflate[hd],this._deflate[G1]);f&&(t=t.slice(0,t.length-4)),this._deflate[Sg]=null,this._deflate[G1]=0,this._deflate[hd]=[],f&&this.params[`${E}_no_context_takeover`]&&this._deflate.reset(),p(null,t)})}};TA.exports=AA;function XX(i){this[hd].push(i),this[G1]+=i.length}function RA(i){if(this[G1]+=i.length,this[T4]._maxPayload<1||this[G1]<=this[T4]._maxPayload){this[hd].push(i);return}this[Pw]=new RangeError("Max payload size exceeded"),this[Pw][xA]=1009,this.removeListener("data",RA),this.reset()}function QX(i){this[T4]._inflate=null,i[xA]=1007,this[Sg](i)}});var Bw=ce((vre,Iw)=>{"use strict";function OA(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function kA(i){let o=i.length,f=0;for(;f=o||(i[f+1]&192)!=128||(i[f+2]&192)!=128||i[f]===224&&(i[f+1]&224)==128||i[f]===237&&(i[f+1]&224)==160)return!1;f+=3}else if((i[f]&248)==240){if(f+3>=o||(i[f+1]&192)!=128||(i[f+2]&192)!=128||(i[f+3]&192)!=128||i[f]===240&&(i[f+1]&240)==128||i[f]===244&&i[f+1]>143||i[f]>244)return!1;f+=4}else return!1;return!0}try{let i=require("utf-8-validate");typeof i=="object"&&(i=i.Validation.isValidUTF8),Iw.exports={isValidStatusCode:OA,isValidUTF8(o){return o.length<150?kA(o):i(o)}}}catch(i){Iw.exports={isValidStatusCode:OA,isValidUTF8:kA}}});var zw=ce((mre,MA)=>{"use strict";var{Writable:JX}=require("stream"),NA=Tg(),{BINARY_TYPES:ZX,EMPTY_BUFFER:$X,kStatusCode:eQ,kWebSocket:tQ}=th(),{concat:Uw,toArrayBuffer:nQ,unmask:rQ}=Dg(),{isValidStatusCode:iQ,isValidUTF8:LA}=Bw(),Cg=0,FA=1,bA=2,PA=3,jw=4,uQ=5,IA=class extends JX{constructor(o,f,p,E){super();this._binaryType=o||ZX[0],this[tQ]=void 0,this._extensions=f||{},this._isServer=!!p,this._maxPayload=E|0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=Cg,this._loop=!1}_write(o,f,p){if(this._opcode===8&&this._state==Cg)return p();this._bufferedBytes+=o.length,this._buffers.push(o),this.startLoop(p)}consume(o){if(this._bufferedBytes-=o,o===this._buffers[0].length)return this._buffers.shift();if(o=p.length?f.set(this._buffers.shift(),E):(f.set(new Uint8Array(p.buffer,p.byteOffset,o),E),this._buffers[0]=p.slice(o)),o-=p.length}while(o>0);return f}startLoop(o){let f;this._loop=!0;do switch(this._state){case Cg:f=this.getInfo();break;case FA:f=this.getPayloadLength16();break;case bA:f=this.getPayloadLength64();break;case PA:this.getMask();break;case jw:f=this.getData(o);break;default:this._loop=!1;return}while(this._loop);o(f)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let o=this.consume(2);if((o[0]&48)!=0)return this._loop=!1,Ho(RangeError,"RSV2 and RSV3 must be clear",!0,1002);let f=(o[0]&64)==64;if(f&&!this._extensions[NA.extensionName])return this._loop=!1,Ho(RangeError,"RSV1 must be clear",!0,1002);if(this._fin=(o[0]&128)==128,this._opcode=o[0]&15,this._payloadLength=o[1]&127,this._opcode===0){if(f)return this._loop=!1,Ho(RangeError,"RSV1 must be clear",!0,1002);if(!this._fragmented)return this._loop=!1,Ho(RangeError,"invalid opcode 0",!0,1002);this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,Ho(RangeError,`invalid opcode ${this._opcode}`,!0,1002);this._compressed=f}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,Ho(RangeError,"FIN must be set",!0,1002);if(f)return this._loop=!1,Ho(RangeError,"RSV1 must be clear",!0,1002);if(this._payloadLength>125)return this._loop=!1,Ho(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002)}else return this._loop=!1,Ho(RangeError,`invalid opcode ${this._opcode}`,!0,1002);if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(o[1]&128)==128,this._isServer){if(!this._masked)return this._loop=!1,Ho(RangeError,"MASK must be set",!0,1002)}else if(this._masked)return this._loop=!1,Ho(RangeError,"MASK must be clear",!0,1002);if(this._payloadLength===126)this._state=FA;else if(this._payloadLength===127)this._state=bA;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let o=this.consume(8),f=o.readUInt32BE(0);return f>Math.pow(2,53-32)-1?(this._loop=!1,Ho(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009)):(this._payloadLength=f*Math.pow(2,32)+o.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,Ho(RangeError,"Max payload size exceeded",!1,1009);this._masked?this._state=PA:this._state=jw}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=jw}getData(o){let f=$X;if(this._payloadLength){if(this._bufferedBytes7)return this.controlMessage(f);if(this._compressed){this._state=uQ,this.decompress(f,o);return}return f.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(f)),this.dataMessage()}decompress(o,f){this._extensions[NA.extensionName].decompress(o,this._fin,(E,t)=>{if(E)return f(E);if(t.length){if(this._messageLength+=t.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return f(Ho(RangeError,"Max payload size exceeded",!1,1009));this._fragments.push(t)}let k=this.dataMessage();if(k)return f(k);this.startLoop(f)})}dataMessage(){if(this._fin){let o=this._messageLength,f=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let p;this._binaryType==="nodebuffer"?p=Uw(f,o):this._binaryType==="arraybuffer"?p=nQ(Uw(f,o)):p=f,this.emit("message",p)}else{let p=Uw(f,o);if(!LA(p))return this._loop=!1,Ho(Error,"invalid UTF-8 sequence",!0,1007);this.emit("message",p.toString())}}this._state=Cg}controlMessage(o){if(this._opcode===8)if(this._loop=!1,o.length===0)this.emit("conclude",1005,""),this.end();else{if(o.length===1)return Ho(RangeError,"invalid payload length 1",!0,1002);{let f=o.readUInt16BE(0);if(!iQ(f))return Ho(RangeError,`invalid status code ${f}`,!0,1002);let p=o.slice(2);if(!LA(p))return Ho(Error,"invalid UTF-8 sequence",!0,1007);this.emit("conclude",f,p.toString()),this.end()}}else this._opcode===9?this.emit("ping",o):this.emit("pong",o);this._state=Cg}};MA.exports=IA;function Ho(i,o,f,p){let E=new i(f?`Invalid WebSocket frame: ${o}`:o);return Error.captureStackTrace(E,Ho),E[eQ]=p,E}});var qw=ce((yre,BA)=>{"use strict";var{randomFillSync:oQ}=require("crypto"),UA=Tg(),{EMPTY_BUFFER:lQ}=th(),{isValidStatusCode:sQ}=Bw(),{mask:jA,toBuffer:Y1}=Dg(),nh=Buffer.alloc(4),K1=class{constructor(o,f){this._extensions=f||{},this._socket=o,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(o,f){let p=f.mask&&f.readOnly,E=f.mask?6:2,t=o.length;o.length>=65536?(E+=8,t=127):o.length>125&&(E+=2,t=126);let k=Buffer.allocUnsafe(p?o.length+E:E);return k[0]=f.fin?f.opcode|128:f.opcode,f.rsv1&&(k[0]|=64),k[1]=t,t===126?k.writeUInt16BE(o.length,2):t===127&&(k.writeUInt32BE(0,2),k.writeUInt32BE(o.length,6)),f.mask?(oQ(nh,0,4),k[1]|=128,k[E-4]=nh[0],k[E-3]=nh[1],k[E-2]=nh[2],k[E-1]=nh[3],p?(jA(o,nh,k,E,o.length),[k]):(jA(o,nh,o,0,o.length),[k,o])):[k,o]}close(o,f,p,E){let t;if(o===void 0)t=lQ;else{if(typeof o!="number"||!sQ(o))throw new TypeError("First argument must be a valid error code number");if(f===void 0||f==="")t=Buffer.allocUnsafe(2),t.writeUInt16BE(o,0);else{let k=Buffer.byteLength(f);if(k>123)throw new RangeError("The message must not be greater than 123 bytes");t=Buffer.allocUnsafe(2+k),t.writeUInt16BE(o,0),t.write(f,2)}}this._deflating?this.enqueue([this.doClose,t,p,E]):this.doClose(t,p,E)}doClose(o,f,p){this.sendFrame(K1.frame(o,{fin:!0,rsv1:!1,opcode:8,mask:f,readOnly:!1}),p)}ping(o,f,p){let E=Y1(o);if(E.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPing,E,f,Y1.readOnly,p]):this.doPing(E,f,Y1.readOnly,p)}doPing(o,f,p,E){this.sendFrame(K1.frame(o,{fin:!0,rsv1:!1,opcode:9,mask:f,readOnly:p}),E)}pong(o,f,p){let E=Y1(o);if(E.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPong,E,f,Y1.readOnly,p]):this.doPong(E,f,Y1.readOnly,p)}doPong(o,f,p,E){this.sendFrame(K1.frame(o,{fin:!0,rsv1:!1,opcode:10,mask:f,readOnly:p}),E)}send(o,f,p){let E=Y1(o),t=this._extensions[UA.extensionName],k=f.binary?2:1,L=f.compress;if(this._firstFragment?(this._firstFragment=!1,L&&t&&(L=E.length>=t._threshold),this._compress=L):(L=!1,k=0),f.fin&&(this._firstFragment=!0),t){let N={fin:f.fin,rsv1:L,opcode:k,mask:f.mask,readOnly:Y1.readOnly};this._deflating?this.enqueue([this.dispatch,E,this._compress,N,p]):this.dispatch(E,this._compress,N,p)}else this.sendFrame(K1.frame(E,{fin:f.fin,rsv1:!1,opcode:k,mask:f.mask,readOnly:Y1.readOnly}),p)}dispatch(o,f,p,E){if(!f){this.sendFrame(K1.frame(o,p),E);return}let t=this._extensions[UA.extensionName];this._bufferedBytes+=o.length,this._deflating=!0,t.compress(o,p.fin,(k,L)=>{if(this._socket.destroyed){let N=new Error("The socket was closed while data was being compressed");typeof E=="function"&&E(N);for(let C=0;C{"use strict";var xg=class{constructor(o,f){this.target=f,this.type=o}},qA=class extends xg{constructor(o,f){super("message",f);this.data=o}},HA=class extends xg{constructor(o,f,p){super("close",p);this.wasClean=p._closeFrameReceived&&p._closeFrameSent,this.reason=f,this.code=o}},WA=class extends xg{constructor(o){super("open",o)}},VA=class extends xg{constructor(o,f){super("error",f);this.message=o.message,this.error=o}},aQ={addEventListener(i,o,f){if(typeof o!="function")return;function p(N){o.call(this,new qA(N,this))}function E(N,C){o.call(this,new HA(N,C,this))}function t(N){o.call(this,new VA(N,this))}function k(){o.call(this,new WA(this))}let L=f&&f.once?"once":"on";i==="message"?(p._listener=o,this[L](i,p)):i==="close"?(E._listener=o,this[L](i,E)):i==="error"?(t._listener=o,this[L](i,t)):i==="open"?(k._listener=o,this[L](i,k)):this[L](i,o)},removeEventListener(i,o){let f=this.listeners(i);for(let p=0;p{"use strict";var Ag=[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,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Pc(i,o,f){i[o]===void 0?i[o]=[f]:i[o].push(f)}function fQ(i){let o=Object.create(null);if(i===void 0||i==="")return o;let f=Object.create(null),p=!1,E=!1,t=!1,k,L,N=-1,C=-1,U=0;for(;U{let f=i[o];return Array.isArray(f)||(f=[f]),f.map(p=>[o].concat(Object.keys(p).map(E=>{let t=p[E];return Array.isArray(t)||(t=[t]),t.map(k=>k===!0?E:`${E}=${k}`).join("; ")})).join("; ")).join(", ")}).join(", ")}YA.exports={format:cQ,parse:fQ}});var Kw=ce((Ere,KA)=>{"use strict";var dQ=require("events"),pQ=require("https"),hQ=require("http"),XA=require("net"),vQ=require("tls"),{randomBytes:mQ,createHash:yQ}=require("crypto"),{URL:Ww}=require("url"),vd=Tg(),gQ=zw(),_Q=qw(),{BINARY_TYPES:QA,EMPTY_BUFFER:Vw,GUID:EQ,kStatusCode:DQ,kWebSocket:Qs,NOOP:JA}=th(),{addEventListener:wQ,removeEventListener:SQ}=GA(),{format:TQ,parse:CQ}=Hw(),{toBuffer:xQ}=Dg(),ZA=["CONNECTING","OPEN","CLOSING","CLOSED"],Gw=[8,13],AQ=30*1e3,Bi=class extends dQ{constructor(o,f,p){super();this._binaryType=QA[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage="",this._closeTimer=null,this._extensions={},this._protocol="",this._readyState=Bi.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,o!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,Array.isArray(f)?f=f.join(", "):typeof f=="object"&&f!==null&&(p=f,f=void 0),$A(this,o,f,p)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(o){!QA.includes(o)||(this._binaryType=o,this._receiver&&(this._receiver._binaryType=o))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(o,f,p){let E=new gQ(this.binaryType,this._extensions,this._isServer,p);this._sender=new _Q(o,this._extensions),this._receiver=E,this._socket=o,E[Qs]=this,o[Qs]=this,E.on("conclude",RQ),E.on("drain",OQ),E.on("error",kQ),E.on("message",MQ),E.on("ping",NQ),E.on("pong",LQ),o.setTimeout(0),o.setNoDelay(),f.length>0&&o.unshift(f),o.on("close",eR),o.on("data",x4),o.on("end",tR),o.on("error",nR),this._readyState=Bi.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=Bi.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[vd.extensionName]&&this._extensions[vd.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=Bi.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(o,f){if(this.readyState!==Bi.CLOSED){if(this.readyState===Bi.CONNECTING){let p="WebSocket was closed before the connection was established";return X1(this,this._req,p)}if(this.readyState===Bi.CLOSING){this._closeFrameSent&&this._closeFrameReceived&&this._socket.end();return}this._readyState=Bi.CLOSING,this._sender.close(o,f,!this._isServer,p=>{p||(this._closeFrameSent=!0,this._closeFrameReceived&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),AQ)}}ping(o,f,p){if(this.readyState===Bi.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof o=="function"?(p=o,o=f=void 0):typeof f=="function"&&(p=f,f=void 0),typeof o=="number"&&(o=o.toString()),this.readyState!==Bi.OPEN){Yw(this,o,p);return}f===void 0&&(f=!this._isServer),this._sender.ping(o||Vw,f,p)}pong(o,f,p){if(this.readyState===Bi.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof o=="function"?(p=o,o=f=void 0):typeof f=="function"&&(p=f,f=void 0),typeof o=="number"&&(o=o.toString()),this.readyState!==Bi.OPEN){Yw(this,o,p);return}f===void 0&&(f=!this._isServer),this._sender.pong(o||Vw,f,p)}send(o,f,p){if(this.readyState===Bi.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof f=="function"&&(p=f,f={}),typeof o=="number"&&(o=o.toString()),this.readyState!==Bi.OPEN){Yw(this,o,p);return}let E=E0({binary:typeof o!="string",mask:!this._isServer,compress:!0,fin:!0},f);this._extensions[vd.extensionName]||(E.compress=!1),this._sender.send(o||Vw,E,p)}terminate(){if(this.readyState!==Bi.CLOSED){if(this.readyState===Bi.CONNECTING){let o="WebSocket was closed before the connection was established";return X1(this,this._req,o)}this._socket&&(this._readyState=Bi.CLOSING,this._socket.destroy())}}};ZA.forEach((i,o)=>{let f={enumerable:!0,value:o};Object.defineProperty(Bi.prototype,i,f),Object.defineProperty(Bi,i,f)});["binaryType","bufferedAmount","extensions","protocol","readyState","url"].forEach(i=>{Object.defineProperty(Bi.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(Bi.prototype,`on${i}`,{configurable:!0,enumerable:!0,get(){let o=this.listeners(i);for(let f=0;f{X1(i,W,"Opening handshake has timed out")}),W.on("error",ne=>{W===null||W.aborted||(W=i._req=null,i._readyState=Bi.CLOSING,i.emit("error",ne),i.emitClose())}),W.on("response",ne=>{let m=ne.headers.location,we=ne.statusCode;if(m&&E.followRedirects&&we>=300&&we<400){if(++i._redirects>E.maxRedirects){X1(i,W,"Maximum redirects exceeded");return}W.abort();let Se=new Ww(m,o);$A(i,Se,f,p)}else i.emit("unexpected-response",W,ne)||X1(i,W,`Unexpected server response: ${ne.statusCode}`)}),W.on("upgrade",(ne,m,we)=>{if(i.emit("upgrade",ne),i.readyState!==Bi.CONNECTING)return;W=i._req=null;let Se=yQ("sha1").update(C+EQ).digest("base64");if(ne.headers["sec-websocket-accept"]!==Se){X1(i,m,"Invalid Sec-WebSocket-Accept header");return}let he=ne.headers["sec-websocket-protocol"],ge=(f||"").split(/, */),ze;if(!f&&he?ze="Server sent a subprotocol but none was requested":f&&!he?ze="Server sent no subprotocol":he&&!ge.includes(he)&&(ze="Server sent an invalid subprotocol"),ze){X1(i,m,ze);return}if(he&&(i._protocol=he),q)try{let pe=CQ(ne.headers["sec-websocket-extensions"]);pe[vd.extensionName]&&(q.accept(pe[vd.extensionName]),i._extensions[vd.extensionName]=q)}catch(pe){X1(i,m,"Invalid Sec-WebSocket-Extensions header");return}i.setSocket(m,we,E.maxPayload)})}function FQ(i){return i.path=i.socketPath,XA.connect(i)}function bQ(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=XA.isIP(i.host)?"":i.host),vQ.connect(i)}function X1(i,o,f){i._readyState=Bi.CLOSING;let p=new Error(f);Error.captureStackTrace(p,X1),o.setHeader?(o.abort(),o.socket&&!o.socket.destroyed&&o.socket.destroy(),o.once("abort",i.emitClose.bind(i)),i.emit("error",p)):(o.destroy(p),o.once("error",i.emit.bind(i,"error")),o.once("close",i.emitClose.bind(i)))}function Yw(i,o,f){if(o){let p=xQ(o).length;i._socket?i._sender._bufferedBytes+=p:i._bufferedAmount+=p}if(f){let p=new Error(`WebSocket is not open: readyState ${i.readyState} (${ZA[i.readyState]})`);f(p)}}function RQ(i,o){let f=this[Qs];f._socket.removeListener("data",x4),f._socket.resume(),f._closeFrameReceived=!0,f._closeMessage=o,f._closeCode=i,i===1005?f.close():f.close(i,o)}function OQ(){this[Qs]._socket.resume()}function kQ(i){let o=this[Qs];o._socket.removeListener("data",x4),o._readyState=Bi.CLOSING,o._closeCode=i[DQ],o.emit("error",i),o._socket.destroy()}function rR(){this[Qs].emitClose()}function MQ(i){this[Qs].emit("message",i)}function NQ(i){let o=this[Qs];o.pong(i,!o._isServer,JA),o.emit("ping",i)}function LQ(i){this[Qs].emit("pong",i)}function eR(){let i=this[Qs];this.removeListener("close",eR),this.removeListener("end",tR),i._readyState=Bi.CLOSING,i._socket.read(),i._receiver.end(),this.removeListener("data",x4),this[Qs]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",rR),i._receiver.on("finish",rR))}function x4(i){this[Qs]._receiver.write(i)||this.pause()}function tR(){let i=this[Qs];i._readyState=Bi.CLOSING,i._receiver.end(),this.end()}function nR(){let i=this[Qs];this.removeListener("error",nR),this.on("error",JA),i&&(i._readyState=Bi.CLOSING,this.destroy())}});var lR=ce((Dre,iR)=>{"use strict";var{Duplex:PQ}=require("stream");function uR(i){i.emit("close")}function IQ(){!this.destroyed&&this._writableState.finished&&this.destroy()}function oR(i){this.removeListener("error",oR),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function BQ(i,o){let f=!0;function p(){f&&i._socket.resume()}i.readyState===i.CONNECTING?i.once("open",function(){i._receiver.removeAllListeners("drain"),i._receiver.on("drain",p)}):(i._receiver.removeAllListeners("drain"),i._receiver.on("drain",p));let E=new PQ(Gf(E0({},o),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return i.on("message",function(k){E.push(k)||(f=!1,i._socket.pause())}),i.once("error",function(k){E.destroyed||E.destroy(k)}),i.once("close",function(){E.destroyed||E.push(null)}),E._destroy=function(t,k){if(i.readyState===i.CLOSED){k(t),process.nextTick(uR,E);return}let L=!1;i.once("error",function(C){L=!0,k(C)}),i.once("close",function(){L||k(t),process.nextTick(uR,E)}),i.terminate()},E._final=function(t){if(i.readyState===i.CONNECTING){i.once("open",function(){E._final(t)});return}i._socket!==null&&(i._socket._writableState.finished?(t(),E._readableState.endEmitted&&E.destroy()):(i._socket.once("finish",function(){t()}),i.close()))},E._read=function(){i.readyState===i.OPEN&&!f&&(f=!0,i._receiver._writableState.needDrain||i._socket.resume())},E._write=function(t,k,L){if(i.readyState===i.CONNECTING){i.once("open",function(){E._write(t,k,L)});return}i.send(t,L)},E.on("end",IQ),E.on("error",oR),E}iR.exports=BQ});var fR=ce((wre,sR)=>{"use strict";var UQ=require("events"),{createHash:jQ}=require("crypto"),{createServer:zQ,STATUS_CODES:Xw}=require("http"),rh=Tg(),qQ=Kw(),{format:HQ,parse:WQ}=Hw(),{GUID:VQ,kWebSocket:GQ}=th(),YQ=/^[+/0-9A-Za-z]{22}==$/,aR=class extends UQ{constructor(o,f){super();if(o=E0({maxPayload:100*1024*1024,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null},o),o.port==null&&!o.server&&!o.noServer)throw new TypeError('One of the "port", "server", or "noServer" options must be specified');if(o.port!=null?(this._server=zQ((p,E)=>{let t=Xw[426];E.writeHead(426,{"Content-Length":t.length,"Content-Type":"text/plain"}),E.end(t)}),this._server.listen(o.port,o.host,o.backlog,f)):o.server&&(this._server=o.server),this._server){let p=this.emit.bind(this,"connection");this._removeListeners=KQ(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(E,t,k)=>{this.handleUpgrade(E,t,k,p)}})}o.perMessageDeflate===!0&&(o.perMessageDeflate={}),o.clientTracking&&(this.clients=new Set),this.options=o}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(o){if(o&&this.once("close",o),this.clients)for(let p of this.clients)p.terminate();let f=this._server;if(f&&(this._removeListeners(),this._removeListeners=this._server=null,this.options.port!=null)){f.close(()=>this.emit("close"));return}process.nextTick(XQ,this)}shouldHandle(o){if(this.options.path){let f=o.url.indexOf("?");if((f!==-1?o.url.slice(0,f):o.url)!==this.options.path)return!1}return!0}handleUpgrade(o,f,p,E){f.on("error",Qw);let t=o.headers["sec-websocket-key"]!==void 0?o.headers["sec-websocket-key"].trim():!1,k=+o.headers["sec-websocket-version"],L={};if(o.method!=="GET"||o.headers.upgrade.toLowerCase()!=="websocket"||!t||!YQ.test(t)||k!==8&&k!==13||!this.shouldHandle(o))return A4(f,400);if(this.options.perMessageDeflate){let N=new rh(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let C=WQ(o.headers["sec-websocket-extensions"]);C[rh.extensionName]&&(N.accept(C[rh.extensionName]),L[rh.extensionName]=N)}catch(C){return A4(f,400)}}if(this.options.verifyClient){let N={origin:o.headers[`${k===8?"sec-websocket-origin":"origin"}`],secure:!!(o.socket.authorized||o.socket.encrypted),req:o};if(this.options.verifyClient.length===2){this.options.verifyClient(N,(C,U,q,W)=>{if(!C)return A4(f,U||401,q,W);this.completeUpgrade(t,L,o,f,p,E)});return}if(!this.options.verifyClient(N))return A4(f,401)}this.completeUpgrade(t,L,o,f,p,E)}completeUpgrade(o,f,p,E,t,k){if(!E.readable||!E.writable)return E.destroy();if(E[GQ])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");let L=jQ("sha1").update(o+VQ).digest("base64"),N=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${L}`],C=new qQ(null),U=p.headers["sec-websocket-protocol"];if(U&&(U=U.split(",").map(QQ),this.options.handleProtocols?U=this.options.handleProtocols(U,p):U=U[0],U&&(N.push(`Sec-WebSocket-Protocol: ${U}`),C._protocol=U)),f[rh.extensionName]){let q=f[rh.extensionName].params,W=HQ({[rh.extensionName]:[q]});N.push(`Sec-WebSocket-Extensions: ${W}`),C._extensions=f}this.emit("headers",N,p),E.write(N.concat(`\r +`).join(`\r +`)),E.removeListener("error",Qw),C.setSocket(E,t,this.options.maxPayload),this.clients&&(this.clients.add(C),C.on("close",()=>this.clients.delete(C))),k(C,p)}};sR.exports=aR;function KQ(i,o){for(let f of Object.keys(o))i.on(f,o[f]);return function(){for(let p of Object.keys(o))i.removeListener(p,o[p])}}function XQ(i){i.emit("close")}function Qw(){this.destroy()}function A4(i,o,f,p){i.writable&&(f=f||Xw[o],p=E0({Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(f)},p),i.write(`HTTP/1.1 ${o} ${Xw[o]}\r +`+Object.keys(p).map(E=>`${E}: ${p[E]}`).join(`\r +`)+`\r +\r +`+f)),i.removeListener("error",Qw),i.destroy()}function QQ(i){return i.trim()}});var dR=ce((Sre,cR)=>{"use strict";var Rg=Kw();Rg.createWebSocketStream=lR();Rg.Server=fR();Rg.Receiver=zw();Rg.Sender=qw();cR.exports=Rg});var pR=ce(R4=>{"use strict";var JQ=R4&&R4.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(R4,"__esModule",{value:!0});var ZQ=JQ(dR()),Og=global;Og.WebSocket||(Og.WebSocket=ZQ.default);Og.window||(Og.window=global);Og.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:"InternalApp",isEnabled:!0,isValid:!0},{type:2,value:"InternalAppContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdoutContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStderrContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdinContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalFocusContext",isEnabled:!0,isValid:!0}]});var hR=ce((O4,Jw)=>{(function(i,o){typeof O4=="object"&&typeof Jw=="object"?Jw.exports=o():typeof define=="function"&&define.amd?define([],o):typeof O4=="object"?O4.ReactDevToolsBackend=o():i.ReactDevToolsBackend=o()})(window,function(){return function(i){var o={};function f(p){if(o[p])return o[p].exports;var E=o[p]={i:p,l:!1,exports:{}};return i[p].call(E.exports,E,E.exports,f),E.l=!0,E.exports}return f.m=i,f.c=o,f.d=function(p,E,t){f.o(p,E)||Object.defineProperty(p,E,{enumerable:!0,get:t})},f.r=function(p){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},f.t=function(p,E){if(1&E&&(p=f(p)),8&E||4&E&&typeof p=="object"&&p&&p.__esModule)return p;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:p}),2&E&&typeof p!="string")for(var k in p)f.d(t,k,function(L){return p[L]}.bind(null,k));return t},f.n=function(p){var E=p&&p.__esModule?function(){return p.default}:function(){return p};return f.d(E,"a",E),E},f.o=function(p,E){return Object.prototype.hasOwnProperty.call(p,E)},f.p="",f(f.s=20)}([function(i,o,f){"use strict";i.exports=f(12)},function(i,o,f){"use strict";var p=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function k(L){if(L==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(L)}i.exports=function(){try{if(!Object.assign)return!1;var L=new String("abc");if(L[5]="de",Object.getOwnPropertyNames(L)[0]==="5")return!1;for(var N={},C=0;C<10;C++)N["_"+String.fromCharCode(C)]=C;if(Object.getOwnPropertyNames(N).map(function(q){return N[q]}).join("")!=="0123456789")return!1;var U={};return"abcdefghijklmnopqrst".split("").forEach(function(q){U[q]=q}),Object.keys(Object.assign({},U)).join("")==="abcdefghijklmnopqrst"}catch(q){return!1}}()?Object.assign:function(L,N){for(var C,U,q=k(L),W=1;W=le||en<0||$t&&At-Ke>=wt}function ue(){var At=Se();if(Ce(At))return je(At);$e=setTimeout(ue,function(en){var ln=le-(en-ft);return $t?we(ln,wt-(en-Ke)):ln}(At))}function je(At){return $e=void 0,at&&Ge?Q(At):(Ge=rt=void 0,xt)}function ct(){var At=Se(),en=Ce(At);if(Ge=arguments,rt=this,ft=At,en){if($e===void 0)return ae(ft);if($t)return $e=setTimeout(ue,le),Q(ft)}return $e===void 0&&($e=setTimeout(ue,le)),xt}return le=pe(le)||0,ge(Ue)&&(jt=!!Ue.leading,wt=($t="maxWait"in Ue)?m(pe(Ue.maxWait)||0,le):wt,at="trailing"in Ue?!!Ue.trailing:at),ct.cancel=function(){$e!==void 0&&clearTimeout($e),Ke=0,Ge=ft=rt=$e=void 0},ct.flush=function(){return $e===void 0?xt:je(Se())},ct}function ge(Oe){var le=E(Oe);return!!Oe&&(le=="object"||le=="function")}function ze(Oe){return E(Oe)=="symbol"||function(le){return!!le&&E(le)=="object"}(Oe)&&ne.call(Oe)=="[object Symbol]"}function pe(Oe){if(typeof Oe=="number")return Oe;if(ze(Oe))return NaN;if(ge(Oe)){var le=typeof Oe.valueOf=="function"?Oe.valueOf():Oe;Oe=ge(le)?le+"":le}if(typeof Oe!="string")return Oe===0?Oe:+Oe;Oe=Oe.replace(t,"");var Ue=L.test(Oe);return Ue||N.test(Oe)?C(Oe.slice(2),Ue?2:8):k.test(Oe)?NaN:+Oe}i.exports=function(Oe,le,Ue){var Ge=!0,rt=!0;if(typeof Oe!="function")throw new TypeError("Expected a function");return ge(Ue)&&(Ge="leading"in Ue?!!Ue.leading:Ge,rt="trailing"in Ue?!!Ue.trailing:rt),he(Oe,le,{leading:Ge,maxWait:le,trailing:rt})}}).call(this,f(4))},function(i,o,f){(function(p){function E(Q){return(E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ae){return typeof ae}:function(ae){return ae&&typeof Symbol=="function"&&ae.constructor===Symbol&&ae!==Symbol.prototype?"symbol":typeof ae})(Q)}var t;o=i.exports=m,t=(p===void 0?"undefined":E(p))==="object"&&p.env&&p.env.NODE_DEBUG&&/\bsemver\b/i.test(p.env.NODE_DEBUG)?function(){var Q=Array.prototype.slice.call(arguments,0);Q.unshift("SEMVER"),console.log.apply(console,Q)}:function(){},o.SEMVER_SPEC_VERSION="2.0.0";var k=Number.MAX_SAFE_INTEGER||9007199254740991,L=o.re=[],N=o.src=[],C=o.tokens={},U=0;function q(Q){C[Q]=U++}q("NUMERICIDENTIFIER"),N[C.NUMERICIDENTIFIER]="0|[1-9]\\d*",q("NUMERICIDENTIFIERLOOSE"),N[C.NUMERICIDENTIFIERLOOSE]="[0-9]+",q("NONNUMERICIDENTIFIER"),N[C.NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-][a-zA-Z0-9-]*",q("MAINVERSION"),N[C.MAINVERSION]="("+N[C.NUMERICIDENTIFIER]+")\\.("+N[C.NUMERICIDENTIFIER]+")\\.("+N[C.NUMERICIDENTIFIER]+")",q("MAINVERSIONLOOSE"),N[C.MAINVERSIONLOOSE]="("+N[C.NUMERICIDENTIFIERLOOSE]+")\\.("+N[C.NUMERICIDENTIFIERLOOSE]+")\\.("+N[C.NUMERICIDENTIFIERLOOSE]+")",q("PRERELEASEIDENTIFIER"),N[C.PRERELEASEIDENTIFIER]="(?:"+N[C.NUMERICIDENTIFIER]+"|"+N[C.NONNUMERICIDENTIFIER]+")",q("PRERELEASEIDENTIFIERLOOSE"),N[C.PRERELEASEIDENTIFIERLOOSE]="(?:"+N[C.NUMERICIDENTIFIERLOOSE]+"|"+N[C.NONNUMERICIDENTIFIER]+")",q("PRERELEASE"),N[C.PRERELEASE]="(?:-("+N[C.PRERELEASEIDENTIFIER]+"(?:\\."+N[C.PRERELEASEIDENTIFIER]+")*))",q("PRERELEASELOOSE"),N[C.PRERELEASELOOSE]="(?:-?("+N[C.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+N[C.PRERELEASEIDENTIFIERLOOSE]+")*))",q("BUILDIDENTIFIER"),N[C.BUILDIDENTIFIER]="[0-9A-Za-z-]+",q("BUILD"),N[C.BUILD]="(?:\\+("+N[C.BUILDIDENTIFIER]+"(?:\\."+N[C.BUILDIDENTIFIER]+")*))",q("FULL"),q("FULLPLAIN"),N[C.FULLPLAIN]="v?"+N[C.MAINVERSION]+N[C.PRERELEASE]+"?"+N[C.BUILD]+"?",N[C.FULL]="^"+N[C.FULLPLAIN]+"$",q("LOOSEPLAIN"),N[C.LOOSEPLAIN]="[v=\\s]*"+N[C.MAINVERSIONLOOSE]+N[C.PRERELEASELOOSE]+"?"+N[C.BUILD]+"?",q("LOOSE"),N[C.LOOSE]="^"+N[C.LOOSEPLAIN]+"$",q("GTLT"),N[C.GTLT]="((?:<|>)?=?)",q("XRANGEIDENTIFIERLOOSE"),N[C.XRANGEIDENTIFIERLOOSE]=N[C.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*",q("XRANGEIDENTIFIER"),N[C.XRANGEIDENTIFIER]=N[C.NUMERICIDENTIFIER]+"|x|X|\\*",q("XRANGEPLAIN"),N[C.XRANGEPLAIN]="[v=\\s]*("+N[C.XRANGEIDENTIFIER]+")(?:\\.("+N[C.XRANGEIDENTIFIER]+")(?:\\.("+N[C.XRANGEIDENTIFIER]+")(?:"+N[C.PRERELEASE]+")?"+N[C.BUILD]+"?)?)?",q("XRANGEPLAINLOOSE"),N[C.XRANGEPLAINLOOSE]="[v=\\s]*("+N[C.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+N[C.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+N[C.XRANGEIDENTIFIERLOOSE]+")(?:"+N[C.PRERELEASELOOSE]+")?"+N[C.BUILD]+"?)?)?",q("XRANGE"),N[C.XRANGE]="^"+N[C.GTLT]+"\\s*"+N[C.XRANGEPLAIN]+"$",q("XRANGELOOSE"),N[C.XRANGELOOSE]="^"+N[C.GTLT]+"\\s*"+N[C.XRANGEPLAINLOOSE]+"$",q("COERCE"),N[C.COERCE]="(^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])",q("COERCERTL"),L[C.COERCERTL]=new RegExp(N[C.COERCE],"g"),q("LONETILDE"),N[C.LONETILDE]="(?:~>?)",q("TILDETRIM"),N[C.TILDETRIM]="(\\s*)"+N[C.LONETILDE]+"\\s+",L[C.TILDETRIM]=new RegExp(N[C.TILDETRIM],"g"),q("TILDE"),N[C.TILDE]="^"+N[C.LONETILDE]+N[C.XRANGEPLAIN]+"$",q("TILDELOOSE"),N[C.TILDELOOSE]="^"+N[C.LONETILDE]+N[C.XRANGEPLAINLOOSE]+"$",q("LONECARET"),N[C.LONECARET]="(?:\\^)",q("CARETTRIM"),N[C.CARETTRIM]="(\\s*)"+N[C.LONECARET]+"\\s+",L[C.CARETTRIM]=new RegExp(N[C.CARETTRIM],"g"),q("CARET"),N[C.CARET]="^"+N[C.LONECARET]+N[C.XRANGEPLAIN]+"$",q("CARETLOOSE"),N[C.CARETLOOSE]="^"+N[C.LONECARET]+N[C.XRANGEPLAINLOOSE]+"$",q("COMPARATORLOOSE"),N[C.COMPARATORLOOSE]="^"+N[C.GTLT]+"\\s*("+N[C.LOOSEPLAIN]+")$|^$",q("COMPARATOR"),N[C.COMPARATOR]="^"+N[C.GTLT]+"\\s*("+N[C.FULLPLAIN]+")$|^$",q("COMPARATORTRIM"),N[C.COMPARATORTRIM]="(\\s*)"+N[C.GTLT]+"\\s*("+N[C.LOOSEPLAIN]+"|"+N[C.XRANGEPLAIN]+")",L[C.COMPARATORTRIM]=new RegExp(N[C.COMPARATORTRIM],"g"),q("HYPHENRANGE"),N[C.HYPHENRANGE]="^\\s*("+N[C.XRANGEPLAIN]+")\\s+-\\s+("+N[C.XRANGEPLAIN]+")\\s*$",q("HYPHENRANGELOOSE"),N[C.HYPHENRANGELOOSE]="^\\s*("+N[C.XRANGEPLAINLOOSE]+")\\s+-\\s+("+N[C.XRANGEPLAINLOOSE]+")\\s*$",q("STAR"),N[C.STAR]="(<|>)?=?\\s*\\*";for(var W=0;W256||!(ae.loose?L[C.LOOSE]:L[C.FULL]).test(Q))return null;try{return new m(Q,ae)}catch(Ce){return null}}function m(Q,ae){if(ae&&E(ae)==="object"||(ae={loose:!!ae,includePrerelease:!1}),Q instanceof m){if(Q.loose===ae.loose)return Q;Q=Q.version}else if(typeof Q!="string")throw new TypeError("Invalid Version: "+Q);if(Q.length>256)throw new TypeError("version is longer than 256 characters");if(!(this instanceof m))return new m(Q,ae);t("SemVer",Q,ae),this.options=ae,this.loose=!!ae.loose;var Ce=Q.trim().match(ae.loose?L[C.LOOSE]:L[C.FULL]);if(!Ce)throw new TypeError("Invalid Version: "+Q);if(this.raw=Q,this.major=+Ce[1],this.minor=+Ce[2],this.patch=+Ce[3],this.major>k||this.major<0)throw new TypeError("Invalid major version");if(this.minor>k||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>k||this.patch<0)throw new TypeError("Invalid patch version");Ce[4]?this.prerelease=Ce[4].split(".").map(function(ue){if(/^[0-9]+$/.test(ue)){var je=+ue;if(je>=0&&je=0;)typeof this.prerelease[Ce]=="number"&&(this.prerelease[Ce]++,Ce=-2);Ce===-1&&this.prerelease.push(0)}ae&&(this.prerelease[0]===ae?isNaN(this.prerelease[1])&&(this.prerelease=[ae,0]):this.prerelease=[ae,0]);break;default:throw new Error("invalid increment argument: "+Q)}return this.format(),this.raw=this.version,this},o.inc=function(Q,ae,Ce,ue){typeof Ce=="string"&&(ue=Ce,Ce=void 0);try{return new m(Q,Ce).inc(ae,ue).version}catch(je){return null}},o.diff=function(Q,ae){if(pe(Q,ae))return null;var Ce=ne(Q),ue=ne(ae),je="";if(Ce.prerelease.length||ue.prerelease.length){je="pre";var ct="prerelease"}for(var At in Ce)if((At==="major"||At==="minor"||At==="patch")&&Ce[At]!==ue[At])return je+At;return ct},o.compareIdentifiers=Se;var we=/^[0-9]+$/;function Se(Q,ae){var Ce=we.test(Q),ue=we.test(ae);return Ce&&ue&&(Q=+Q,ae=+ae),Q===ae?0:Ce&&!ue?-1:ue&&!Ce?1:Q0}function ze(Q,ae,Ce){return he(Q,ae,Ce)<0}function pe(Q,ae,Ce){return he(Q,ae,Ce)===0}function Oe(Q,ae,Ce){return he(Q,ae,Ce)!==0}function le(Q,ae,Ce){return he(Q,ae,Ce)>=0}function Ue(Q,ae,Ce){return he(Q,ae,Ce)<=0}function Ge(Q,ae,Ce,ue){switch(ae){case"===":return E(Q)==="object"&&(Q=Q.version),E(Ce)==="object"&&(Ce=Ce.version),Q===Ce;case"!==":return E(Q)==="object"&&(Q=Q.version),E(Ce)==="object"&&(Ce=Ce.version),Q!==Ce;case"":case"=":case"==":return pe(Q,Ce,ue);case"!=":return Oe(Q,Ce,ue);case">":return ge(Q,Ce,ue);case">=":return le(Q,Ce,ue);case"<":return ze(Q,Ce,ue);case"<=":return Ue(Q,Ce,ue);default:throw new TypeError("Invalid operator: "+ae)}}function rt(Q,ae){if(ae&&E(ae)==="object"||(ae={loose:!!ae,includePrerelease:!1}),Q instanceof rt){if(Q.loose===!!ae.loose)return Q;Q=Q.value}if(!(this instanceof rt))return new rt(Q,ae);t("comparator",Q,ae),this.options=ae,this.loose=!!ae.loose,this.parse(Q),this.semver===wt?this.value="":this.value=this.operator+this.semver.version,t("comp",this)}o.rcompareIdentifiers=function(Q,ae){return Se(ae,Q)},o.major=function(Q,ae){return new m(Q,ae).major},o.minor=function(Q,ae){return new m(Q,ae).minor},o.patch=function(Q,ae){return new m(Q,ae).patch},o.compare=he,o.compareLoose=function(Q,ae){return he(Q,ae,!0)},o.compareBuild=function(Q,ae,Ce){var ue=new m(Q,Ce),je=new m(ae,Ce);return ue.compare(je)||ue.compareBuild(je)},o.rcompare=function(Q,ae,Ce){return he(ae,Q,Ce)},o.sort=function(Q,ae){return Q.sort(function(Ce,ue){return o.compareBuild(Ce,ue,ae)})},o.rsort=function(Q,ae){return Q.sort(function(Ce,ue){return o.compareBuild(ue,Ce,ae)})},o.gt=ge,o.lt=ze,o.eq=pe,o.neq=Oe,o.gte=le,o.lte=Ue,o.cmp=Ge,o.Comparator=rt;var wt={};function xt(Q,ae){if(ae&&E(ae)==="object"||(ae={loose:!!ae,includePrerelease:!1}),Q instanceof xt)return Q.loose===!!ae.loose&&Q.includePrerelease===!!ae.includePrerelease?Q:new xt(Q.raw,ae);if(Q instanceof rt)return new xt(Q.value,ae);if(!(this instanceof xt))return new xt(Q,ae);if(this.options=ae,this.loose=!!ae.loose,this.includePrerelease=!!ae.includePrerelease,this.raw=Q,this.set=Q.split(/\s*\|\|\s*/).map(function(Ce){return this.parseRange(Ce.trim())},this).filter(function(Ce){return Ce.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+Q);this.format()}function $e(Q,ae){for(var Ce=!0,ue=Q.slice(),je=ue.pop();Ce&&ue.length;)Ce=ue.every(function(ct){return je.intersects(ct,ae)}),je=ue.pop();return Ce}function ft(Q){return!Q||Q.toLowerCase()==="x"||Q==="*"}function Ke(Q,ae,Ce,ue,je,ct,At,en,ln,An,nr,un,Wt){return((ae=ft(Ce)?"":ft(ue)?">="+Ce+".0.0":ft(je)?">="+Ce+"."+ue+".0":">="+ae)+" "+(en=ft(ln)?"":ft(An)?"<"+(+ln+1)+".0.0":ft(nr)?"<"+ln+"."+(+An+1)+".0":un?"<="+ln+"."+An+"."+nr+"-"+un:"<="+en)).trim()}function jt(Q,ae,Ce){for(var ue=0;ue0){var je=Q[ue].semver;if(je.major===ae.major&&je.minor===ae.minor&&je.patch===ae.patch)return!0}return!1}return!0}function $t(Q,ae,Ce){try{ae=new xt(ae,Ce)}catch(ue){return!1}return ae.test(Q)}function at(Q,ae,Ce,ue){var je,ct,At,en,ln;switch(Q=new m(Q,ue),ae=new xt(ae,ue),Ce){case">":je=ge,ct=Ue,At=ze,en=">",ln=">=";break;case"<":je=ze,ct=le,At=ge,en="<",ln="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if($t(Q,ae,ue))return!1;for(var An=0;An=0.0.0")),un=un||vr,Wt=Wt||vr,je(vr.semver,un.semver,ue)?un=vr:At(vr.semver,Wt.semver,ue)&&(Wt=vr)}),un.operator===en||un.operator===ln||(!Wt.operator||Wt.operator===en)&&ct(Q,Wt.semver)||Wt.operator===ln&&At(Q,Wt.semver))return!1}return!0}rt.prototype.parse=function(Q){var ae=this.options.loose?L[C.COMPARATORLOOSE]:L[C.COMPARATOR],Ce=Q.match(ae);if(!Ce)throw new TypeError("Invalid comparator: "+Q);this.operator=Ce[1]!==void 0?Ce[1]:"",this.operator==="="&&(this.operator=""),Ce[2]?this.semver=new m(Ce[2],this.options.loose):this.semver=wt},rt.prototype.toString=function(){return this.value},rt.prototype.test=function(Q){if(t("Comparator.test",Q,this.options.loose),this.semver===wt||Q===wt)return!0;if(typeof Q=="string")try{Q=new m(Q,this.options)}catch(ae){return!1}return Ge(Q,this.operator,this.semver,this.options)},rt.prototype.intersects=function(Q,ae){if(!(Q instanceof rt))throw new TypeError("a Comparator is required");var Ce;if(ae&&E(ae)==="object"||(ae={loose:!!ae,includePrerelease:!1}),this.operator==="")return this.value===""||(Ce=new xt(Q.value,ae),$t(this.value,Ce,ae));if(Q.operator==="")return Q.value===""||(Ce=new xt(this.value,ae),$t(Q.semver,Ce,ae));var ue=!(this.operator!==">="&&this.operator!==">"||Q.operator!==">="&&Q.operator!==">"),je=!(this.operator!=="<="&&this.operator!=="<"||Q.operator!=="<="&&Q.operator!=="<"),ct=this.semver.version===Q.semver.version,At=!(this.operator!==">="&&this.operator!=="<="||Q.operator!==">="&&Q.operator!=="<="),en=Ge(this.semver,"<",Q.semver,ae)&&(this.operator===">="||this.operator===">")&&(Q.operator==="<="||Q.operator==="<"),ln=Ge(this.semver,">",Q.semver,ae)&&(this.operator==="<="||this.operator==="<")&&(Q.operator===">="||Q.operator===">");return ue||je||ct&&At||en||ln},o.Range=xt,xt.prototype.format=function(){return this.range=this.set.map(function(Q){return Q.join(" ").trim()}).join("||").trim(),this.range},xt.prototype.toString=function(){return this.range},xt.prototype.parseRange=function(Q){var ae=this.options.loose;Q=Q.trim();var Ce=ae?L[C.HYPHENRANGELOOSE]:L[C.HYPHENRANGE];Q=Q.replace(Ce,Ke),t("hyphen replace",Q),Q=Q.replace(L[C.COMPARATORTRIM],"$1$2$3"),t("comparator trim",Q,L[C.COMPARATORTRIM]),Q=(Q=(Q=Q.replace(L[C.TILDETRIM],"$1~")).replace(L[C.CARETTRIM],"$1^")).split(/\s+/).join(" ");var ue=ae?L[C.COMPARATORLOOSE]:L[C.COMPARATOR],je=Q.split(" ").map(function(ct){return function(At,en){return t("comp",At,en),At=function(ln,An){return ln.trim().split(/\s+/).map(function(nr){return function(un,Wt){t("caret",un,Wt);var vr=Wt.loose?L[C.CARETLOOSE]:L[C.CARET];return un.replace(vr,function(w,Ut,Vn,fr,Fr){var ur;return t("caret",un,w,Ut,Vn,fr,Fr),ft(Ut)?ur="":ft(Vn)?ur=">="+Ut+".0.0 <"+(+Ut+1)+".0.0":ft(fr)?ur=Ut==="0"?">="+Ut+"."+Vn+".0 <"+Ut+"."+(+Vn+1)+".0":">="+Ut+"."+Vn+".0 <"+(+Ut+1)+".0.0":Fr?(t("replaceCaret pr",Fr),ur=Ut==="0"?Vn==="0"?">="+Ut+"."+Vn+"."+fr+"-"+Fr+" <"+Ut+"."+Vn+"."+(+fr+1):">="+Ut+"."+Vn+"."+fr+"-"+Fr+" <"+Ut+"."+(+Vn+1)+".0":">="+Ut+"."+Vn+"."+fr+"-"+Fr+" <"+(+Ut+1)+".0.0"):(t("no pr"),ur=Ut==="0"?Vn==="0"?">="+Ut+"."+Vn+"."+fr+" <"+Ut+"."+Vn+"."+(+fr+1):">="+Ut+"."+Vn+"."+fr+" <"+Ut+"."+(+Vn+1)+".0":">="+Ut+"."+Vn+"."+fr+" <"+(+Ut+1)+".0.0"),t("caret return",ur),ur})}(nr,An)}).join(" ")}(At,en),t("caret",At),At=function(ln,An){return ln.trim().split(/\s+/).map(function(nr){return function(un,Wt){var vr=Wt.loose?L[C.TILDELOOSE]:L[C.TILDE];return un.replace(vr,function(w,Ut,Vn,fr,Fr){var ur;return t("tilde",un,w,Ut,Vn,fr,Fr),ft(Ut)?ur="":ft(Vn)?ur=">="+Ut+".0.0 <"+(+Ut+1)+".0.0":ft(fr)?ur=">="+Ut+"."+Vn+".0 <"+Ut+"."+(+Vn+1)+".0":Fr?(t("replaceTilde pr",Fr),ur=">="+Ut+"."+Vn+"."+fr+"-"+Fr+" <"+Ut+"."+(+Vn+1)+".0"):ur=">="+Ut+"."+Vn+"."+fr+" <"+Ut+"."+(+Vn+1)+".0",t("tilde return",ur),ur})}(nr,An)}).join(" ")}(At,en),t("tildes",At),At=function(ln,An){return t("replaceXRanges",ln,An),ln.split(/\s+/).map(function(nr){return function(un,Wt){un=un.trim();var vr=Wt.loose?L[C.XRANGELOOSE]:L[C.XRANGE];return un.replace(vr,function(w,Ut,Vn,fr,Fr,ur){t("xRange",un,w,Ut,Vn,fr,Fr,ur);var br=ft(Vn),Kt=br||ft(fr),vu=Kt||ft(Fr),a0=vu;return Ut==="="&&a0&&(Ut=""),ur=Wt.includePrerelease?"-0":"",br?w=Ut===">"||Ut==="<"?"<0.0.0-0":"*":Ut&&a0?(Kt&&(fr=0),Fr=0,Ut===">"?(Ut=">=",Kt?(Vn=+Vn+1,fr=0,Fr=0):(fr=+fr+1,Fr=0)):Ut==="<="&&(Ut="<",Kt?Vn=+Vn+1:fr=+fr+1),w=Ut+Vn+"."+fr+"."+Fr+ur):Kt?w=">="+Vn+".0.0"+ur+" <"+(+Vn+1)+".0.0"+ur:vu&&(w=">="+Vn+"."+fr+".0"+ur+" <"+Vn+"."+(+fr+1)+".0"+ur),t("xRange return",w),w})}(nr,An)}).join(" ")}(At,en),t("xrange",At),At=function(ln,An){return t("replaceStars",ln,An),ln.trim().replace(L[C.STAR],"")}(At,en),t("stars",At),At}(ct,this.options)},this).join(" ").split(/\s+/);return this.options.loose&&(je=je.filter(function(ct){return!!ct.match(ue)})),je=je.map(function(ct){return new rt(ct,this.options)},this)},xt.prototype.intersects=function(Q,ae){if(!(Q instanceof xt))throw new TypeError("a Range is required");return this.set.some(function(Ce){return $e(Ce,ae)&&Q.set.some(function(ue){return $e(ue,ae)&&Ce.every(function(je){return ue.every(function(ct){return je.intersects(ct,ae)})})})})},o.toComparators=function(Q,ae){return new xt(Q,ae).set.map(function(Ce){return Ce.map(function(ue){return ue.value}).join(" ").trim().split(" ")})},xt.prototype.test=function(Q){if(!Q)return!1;if(typeof Q=="string")try{Q=new m(Q,this.options)}catch(Ce){return!1}for(var ae=0;ae":ct.prerelease.length===0?ct.patch++:ct.prerelease.push(0),ct.raw=ct.format();case"":case">=":Ce&&!ge(Ce,ct)||(Ce=ct);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+je.operator)}});return Ce&&Q.test(Ce)?Ce:null},o.validRange=function(Q,ae){try{return new xt(Q,ae).range||"*"}catch(Ce){return null}},o.ltr=function(Q,ae,Ce){return at(Q,ae,"<",Ce)},o.gtr=function(Q,ae,Ce){return at(Q,ae,">",Ce)},o.outside=at,o.prerelease=function(Q,ae){var Ce=ne(Q,ae);return Ce&&Ce.prerelease.length?Ce.prerelease:null},o.intersects=function(Q,ae,Ce){return Q=new xt(Q,Ce),ae=new xt(ae,Ce),Q.intersects(ae)},o.coerce=function(Q,ae){if(Q instanceof m)return Q;if(typeof Q=="number"&&(Q=String(Q)),typeof Q!="string")return null;var Ce=null;if((ae=ae||{}).rtl){for(var ue;(ue=L[C.COERCERTL].exec(Q))&&(!Ce||Ce.index+Ce[0].length!==Q.length);)Ce&&ue.index+ue[0].length===Ce.index+Ce[0].length||(Ce=ue),L[C.COERCERTL].lastIndex=ue.index+ue[1].length+ue[2].length;L[C.COERCERTL].lastIndex=-1}else Ce=Q.match(L[C.COERCE]);return Ce===null?null:ne(Ce[2]+"."+(Ce[3]||"0")+"."+(Ce[4]||"0"),ae)}}).call(this,f(5))},function(i,o){function f(E){return(f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(E)}var p;p=function(){return this}();try{p=p||new Function("return this")()}catch(E){(typeof window=="undefined"?"undefined":f(window))==="object"&&(p=window)}i.exports=p},function(i,o){var f,p,E=i.exports={};function t(){throw new Error("setTimeout has not been defined")}function k(){throw new Error("clearTimeout has not been defined")}function L(Se){if(f===setTimeout)return setTimeout(Se,0);if((f===t||!f)&&setTimeout)return f=setTimeout,setTimeout(Se,0);try{return f(Se,0)}catch(he){try{return f.call(null,Se,0)}catch(ge){return f.call(this,Se,0)}}}(function(){try{f=typeof setTimeout=="function"?setTimeout:t}catch(Se){f=t}try{p=typeof clearTimeout=="function"?clearTimeout:k}catch(Se){p=k}})();var N,C=[],U=!1,q=-1;function W(){U&&N&&(U=!1,N.length?C=N.concat(C):q=-1,C.length&&ne())}function ne(){if(!U){var Se=L(W);U=!0;for(var he=C.length;he;){for(N=C,C=[];++q1)for(var ge=1;gethis[k])return Oe(this,this[m].get($e)),!1;var at=this[m].get($e).value;return this[q]&&(this[W]||this[q]($e,at.value)),at.now=jt,at.maxAge=Ke,at.value=ft,this[L]+=$t-at.length,at.length=$t,this.get($e),pe(this),!0}var Q=new le($e,ft,$t,jt,Ke);return Q.length>this[k]?(this[q]&&this[q]($e,ft),!1):(this[L]+=Q.length,this[ne].unshift(Q),this[m].set($e,this[ne].head),pe(this),!0)}},{key:"has",value:function($e){if(!this[m].has($e))return!1;var ft=this[m].get($e).value;return!ze(this,ft)}},{key:"get",value:function($e){return ge(this,$e,!0)}},{key:"peek",value:function($e){return ge(this,$e,!1)}},{key:"pop",value:function(){var $e=this[ne].tail;return $e?(Oe(this,$e),$e.value):null}},{key:"del",value:function($e){Oe(this,this[m].get($e))}},{key:"load",value:function($e){this.reset();for(var ft=Date.now(),Ke=$e.length-1;Ke>=0;Ke--){var jt=$e[Ke],$t=jt.e||0;if($t===0)this.set(jt.k,jt.v);else{var at=$t-ft;at>0&&this.set(jt.k,jt.v,at)}}}},{key:"prune",value:function(){var $e=this;this[m].forEach(function(ft,Ke){return ge($e,Ke,!1)})}},{key:"max",set:function($e){if(typeof $e!="number"||$e<0)throw new TypeError("max must be a non-negative number");this[k]=$e||1/0,pe(this)},get:function(){return this[k]}},{key:"allowStale",set:function($e){this[C]=!!$e},get:function(){return this[C]}},{key:"maxAge",set:function($e){if(typeof $e!="number")throw new TypeError("maxAge must be a non-negative number");this[U]=$e,pe(this)},get:function(){return this[U]}},{key:"lengthCalculator",set:function($e){var ft=this;typeof $e!="function"&&($e=Se),$e!==this[N]&&(this[N]=$e,this[L]=0,this[ne].forEach(function(Ke){Ke.length=ft[N](Ke.value,Ke.key),ft[L]+=Ke.length})),pe(this)},get:function(){return this[N]}},{key:"length",get:function(){return this[L]}},{key:"itemCount",get:function(){return this[ne].length}}])&&E(rt.prototype,wt),xt&&E(rt,xt),Ge}(),ge=function(Ge,rt,wt){var xt=Ge[m].get(rt);if(xt){var $e=xt.value;if(ze(Ge,$e)){if(Oe(Ge,xt),!Ge[C])return}else wt&&(Ge[we]&&(xt.value.now=Date.now()),Ge[ne].unshiftNode(xt));return $e.value}},ze=function(Ge,rt){if(!rt||!rt.maxAge&&!Ge[U])return!1;var wt=Date.now()-rt.now;return rt.maxAge?wt>rt.maxAge:Ge[U]&&wt>Ge[U]},pe=function(Ge){if(Ge[L]>Ge[k])for(var rt=Ge[ne].tail;Ge[L]>Ge[k]&&rt!==null;){var wt=rt.prev;Oe(Ge,rt),rt=wt}},Oe=function(Ge,rt){if(rt){var wt=rt.value;Ge[q]&&Ge[q](wt.key,wt.value),Ge[L]-=wt.length,Ge[m].delete(wt.key),Ge[ne].removeNode(rt)}},le=function Ge(rt,wt,xt,$e,ft){p(this,Ge),this.key=rt,this.value=wt,this.length=xt,this.now=$e,this.maxAge=ft||0},Ue=function(Ge,rt,wt,xt){var $e=wt.value;ze(Ge,$e)&&(Oe(Ge,wt),Ge[C]||($e=void 0)),$e&&rt.call(xt,$e.value,$e.key,Ge)};i.exports=he},function(i,o,f){(function(p){function E(t){return(E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(k){return typeof k}:function(k){return k&&typeof Symbol=="function"&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k})(t)}i.exports=function(){if(typeof document=="undefined"||!document.addEventListener)return null;var t,k,L,N={};return N.copy=function(){var C=!1,U=null,q=!1;function W(){C=!1,U=null,q&&window.getSelection().removeAllRanges(),q=!1}return document.addEventListener("copy",function(ne){if(C){for(var m in U)ne.clipboardData.setData(m,U[m]);ne.preventDefault()}}),function(ne){return new Promise(function(m,we){C=!0,typeof ne=="string"?U={"text/plain":ne}:ne instanceof Node?U={"text/html":new XMLSerializer().serializeToString(ne)}:ne instanceof Object?U=ne:we("Invalid data type. Must be string, DOM node, or an object mapping MIME types to strings."),function Se(he){try{if(document.execCommand("copy"))W(),m();else{if(he)throw W(),new Error("Unable to copy. Perhaps it's not available in your browser?");(function(){var ge=document.getSelection();if(!document.queryCommandEnabled("copy")&&ge.isCollapsed){var ze=document.createRange();ze.selectNodeContents(document.body),ge.removeAllRanges(),ge.addRange(ze),q=!0}})(),Se(!0)}}catch(ge){W(),we(ge)}}(!1)})}}(),N.paste=(L=!1,document.addEventListener("paste",function(C){if(L){L=!1,C.preventDefault();var U=t;t=null,U(C.clipboardData.getData(k))}}),function(C){return new Promise(function(U,q){L=!0,t=U,k=C||"text/plain";try{document.execCommand("paste")||(L=!1,q(new Error("Unable to paste. Pasting only works in Internet Explorer at the moment.")))}catch(W){L=!1,q(new Error(W))}})}),typeof ClipboardEvent=="undefined"&&window.clipboardData!==void 0&&window.clipboardData.setData!==void 0&&(function(C){function U(pe,Oe){return function(){pe.apply(Oe,arguments)}}function q(pe){if(E(this)!="object")throw new TypeError("Promises must be constructed via new");if(typeof pe!="function")throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],he(pe,U(ne,this),U(m,this))}function W(pe){var Oe=this;return this._state===null?void this._deferreds.push(pe):void ge(function(){var le=Oe._state?pe.onFulfilled:pe.onRejected;if(le!==null){var Ue;try{Ue=le(Oe._value)}catch(Ge){return void pe.reject(Ge)}pe.resolve(Ue)}else(Oe._state?pe.resolve:pe.reject)(Oe._value)})}function ne(pe){try{if(pe===this)throw new TypeError("A promise cannot be resolved with itself.");if(pe&&(E(pe)=="object"||typeof pe=="function")){var Oe=pe.then;if(typeof Oe=="function")return void he(U(Oe,pe),U(ne,this),U(m,this))}this._state=!0,this._value=pe,we.call(this)}catch(le){m.call(this,le)}}function m(pe){this._state=!1,this._value=pe,we.call(this)}function we(){for(var pe=0,Oe=this._deferreds.length;Oe>pe;pe++)W.call(this,this._deferreds[pe]);this._deferreds=null}function Se(pe,Oe,le,Ue){this.onFulfilled=typeof pe=="function"?pe:null,this.onRejected=typeof Oe=="function"?Oe:null,this.resolve=le,this.reject=Ue}function he(pe,Oe,le){var Ue=!1;try{pe(function(Ge){Ue||(Ue=!0,Oe(Ge))},function(Ge){Ue||(Ue=!0,le(Ge))})}catch(Ge){if(Ue)return;Ue=!0,le(Ge)}}var ge=q.immediateFn||typeof p=="function"&&p||function(pe){setTimeout(pe,1)},ze=Array.isArray||function(pe){return Object.prototype.toString.call(pe)==="[object Array]"};q.prototype.catch=function(pe){return this.then(null,pe)},q.prototype.then=function(pe,Oe){var le=this;return new q(function(Ue,Ge){W.call(le,new Se(pe,Oe,Ue,Ge))})},q.all=function(){var pe=Array.prototype.slice.call(arguments.length===1&&ze(arguments[0])?arguments[0]:arguments);return new q(function(Oe,le){function Ue(wt,xt){try{if(xt&&(E(xt)=="object"||typeof xt=="function")){var $e=xt.then;if(typeof $e=="function")return void $e.call(xt,function(ft){Ue(wt,ft)},le)}pe[wt]=xt,--Ge==0&&Oe(pe)}catch(ft){le(ft)}}if(pe.length===0)return Oe([]);for(var Ge=pe.length,rt=0;rtUe;Ue++)pe[Ue].then(Oe,le)})},i.exports?i.exports=q:C.Promise||(C.Promise=q)}(this),N.copy=function(C){return new Promise(function(U,q){if(typeof C!="string"&&!("text/plain"in C))throw new Error("You must provide a text/plain type.");var W=typeof C=="string"?C:C["text/plain"];window.clipboardData.setData("Text",W)?U():q(new Error("Copying was rejected."))})},N.paste=function(){return new Promise(function(C,U){var q=window.clipboardData.getData("Text");q?C(q):U(new Error("Pasting was rejected."))})}),N}()}).call(this,f(13).setImmediate)},function(i,o,f){"use strict";i.exports=f(15)},function(i,o,f){"use strict";f.r(o),o.default=`:root { + /** + * IMPORTANT: When new theme variables are added below\u2013 also add them to SettingsContext updateThemeVariables() + */ + + /* Light theme */ + --light-color-attribute-name: #ef6632; + --light-color-attribute-name-not-editable: #23272f; + --light-color-attribute-name-inverted: rgba(255, 255, 255, 0.7); + --light-color-attribute-value: #1a1aa6; + --light-color-attribute-value-inverted: #ffffff; + --light-color-attribute-editable-value: #1a1aa6; + --light-color-background: #ffffff; + --light-color-background-hover: rgba(0, 136, 250, 0.1); + --light-color-background-inactive: #e5e5e5; + --light-color-background-invalid: #fff0f0; + --light-color-background-selected: #0088fa; + --light-color-button-background: #ffffff; + --light-color-button-background-focus: #ededed; + --light-color-button: #5f6673; + --light-color-button-disabled: #cfd1d5; + --light-color-button-active: #0088fa; + --light-color-button-focus: #23272f; + --light-color-button-hover: #23272f; + --light-color-border: #eeeeee; + --light-color-commit-did-not-render-fill: #cfd1d5; + --light-color-commit-did-not-render-fill-text: #000000; + --light-color-commit-did-not-render-pattern: #cfd1d5; + --light-color-commit-did-not-render-pattern-text: #333333; + --light-color-commit-gradient-0: #37afa9; + --light-color-commit-gradient-1: #63b19e; + --light-color-commit-gradient-2: #80b393; + --light-color-commit-gradient-3: #97b488; + --light-color-commit-gradient-4: #abb67d; + --light-color-commit-gradient-5: #beb771; + --light-color-commit-gradient-6: #cfb965; + --light-color-commit-gradient-7: #dfba57; + --light-color-commit-gradient-8: #efbb49; + --light-color-commit-gradient-9: #febc38; + --light-color-commit-gradient-text: #000000; + --light-color-component-name: #6a51b2; + --light-color-component-name-inverted: #ffffff; + --light-color-component-badge-background: rgba(0, 0, 0, 0.1); + --light-color-component-badge-background-inverted: rgba(255, 255, 255, 0.25); + --light-color-component-badge-count: #777d88; + --light-color-component-badge-count-inverted: rgba(255, 255, 255, 0.7); + --light-color-context-background: rgba(0,0,0,.9); + --light-color-context-background-hover: rgba(255, 255, 255, 0.1); + --light-color-context-background-selected: #178fb9; + --light-color-context-border: #3d424a; + --light-color-context-text: #ffffff; + --light-color-context-text-selected: #ffffff; + --light-color-dim: #777d88; + --light-color-dimmer: #cfd1d5; + --light-color-dimmest: #eff0f1; + --light-color-error-background: hsl(0, 100%, 97%); + --light-color-error-border: hsl(0, 100%, 92%); + --light-color-error-text: #ff0000; + --light-color-expand-collapse-toggle: #777d88; + --light-color-link: #0000ff; + --light-color-modal-background: rgba(255, 255, 255, 0.75); + --light-color-record-active: #fc3a4b; + --light-color-record-hover: #3578e5; + --light-color-record-inactive: #0088fa; + --light-color-scroll-thumb: #c2c2c2; + --light-color-scroll-track: #fafafa; + --light-color-search-match: yellow; + --light-color-search-match-current: #f7923b; + --light-color-selected-tree-highlight-active: rgba(0, 136, 250, 0.1); + --light-color-selected-tree-highlight-inactive: rgba(0, 0, 0, 0.05); + --light-color-shadow: rgba(0, 0, 0, 0.25); + --light-color-tab-selected-border: #0088fa; + --light-color-text: #000000; + --light-color-text-invalid: #ff0000; + --light-color-text-selected: #ffffff; + --light-color-toggle-background-invalid: #fc3a4b; + --light-color-toggle-background-on: #0088fa; + --light-color-toggle-background-off: #cfd1d5; + --light-color-toggle-text: #ffffff; + --light-color-tooltip-background: rgba(0, 0, 0, 0.9); + --light-color-tooltip-text: #ffffff; + + /* Dark theme */ + --dark-color-attribute-name: #9d87d2; + --dark-color-attribute-name-not-editable: #ededed; + --dark-color-attribute-name-inverted: #282828; + --dark-color-attribute-value: #cedae0; + --dark-color-attribute-value-inverted: #ffffff; + --dark-color-attribute-editable-value: yellow; + --dark-color-background: #282c34; + --dark-color-background-hover: rgba(255, 255, 255, 0.1); + --dark-color-background-inactive: #3d424a; + --dark-color-background-invalid: #5c0000; + --dark-color-background-selected: #178fb9; + --dark-color-button-background: #282c34; + --dark-color-button-background-focus: #3d424a; + --dark-color-button: #afb3b9; + --dark-color-button-active: #61dafb; + --dark-color-button-disabled: #4f5766; + --dark-color-button-focus: #a2e9fc; + --dark-color-button-hover: #ededed; + --dark-color-border: #3d424a; + --dark-color-commit-did-not-render-fill: #777d88; + --dark-color-commit-did-not-render-fill-text: #000000; + --dark-color-commit-did-not-render-pattern: #666c77; + --dark-color-commit-did-not-render-pattern-text: #ffffff; + --dark-color-commit-gradient-0: #37afa9; + --dark-color-commit-gradient-1: #63b19e; + --dark-color-commit-gradient-2: #80b393; + --dark-color-commit-gradient-3: #97b488; + --dark-color-commit-gradient-4: #abb67d; + --dark-color-commit-gradient-5: #beb771; + --dark-color-commit-gradient-6: #cfb965; + --dark-color-commit-gradient-7: #dfba57; + --dark-color-commit-gradient-8: #efbb49; + --dark-color-commit-gradient-9: #febc38; + --dark-color-commit-gradient-text: #000000; + --dark-color-component-name: #61dafb; + --dark-color-component-name-inverted: #282828; + --dark-color-component-badge-background: rgba(255, 255, 255, 0.25); + --dark-color-component-badge-background-inverted: rgba(0, 0, 0, 0.25); + --dark-color-component-badge-count: #8f949d; + --dark-color-component-badge-count-inverted: rgba(255, 255, 255, 0.7); + --dark-color-context-background: rgba(255,255,255,.9); + --dark-color-context-background-hover: rgba(0, 136, 250, 0.1); + --dark-color-context-background-selected: #0088fa; + --dark-color-context-border: #eeeeee; + --dark-color-context-text: #000000; + --dark-color-context-text-selected: #ffffff; + --dark-color-dim: #8f949d; + --dark-color-dimmer: #777d88; + --dark-color-dimmest: #4f5766; + --dark-color-error-background: #200; + --dark-color-error-border: #900; + --dark-color-error-text: #f55; + --dark-color-expand-collapse-toggle: #8f949d; + --dark-color-link: #61dafb; + --dark-color-modal-background: rgba(0, 0, 0, 0.75); + --dark-color-record-active: #fc3a4b; + --dark-color-record-hover: #a2e9fc; + --dark-color-record-inactive: #61dafb; + --dark-color-scroll-thumb: #afb3b9; + --dark-color-scroll-track: #313640; + --dark-color-search-match: yellow; + --dark-color-search-match-current: #f7923b; + --dark-color-selected-tree-highlight-active: rgba(23, 143, 185, 0.15); + --dark-color-selected-tree-highlight-inactive: rgba(255, 255, 255, 0.05); + --dark-color-shadow: rgba(0, 0, 0, 0.5); + --dark-color-tab-selected-border: #178fb9; + --dark-color-text: #ffffff; + --dark-color-text-invalid: #ff8080; + --dark-color-text-selected: #ffffff; + --dark-color-toggle-background-invalid: #fc3a4b; + --dark-color-toggle-background-on: #178fb9; + --dark-color-toggle-background-off: #777d88; + --dark-color-toggle-text: #ffffff; + --dark-color-tooltip-background: rgba(255, 255, 255, 0.9); + --dark-color-tooltip-text: #000000; + + /* Font smoothing */ + --light-font-smoothing: auto; + --dark-font-smoothing: antialiased; + --font-smoothing: auto; + + /* Compact density */ + --compact-font-size-monospace-small: 9px; + --compact-font-size-monospace-normal: 11px; + --compact-font-size-monospace-large: 15px; + --compact-font-size-sans-small: 10px; + --compact-font-size-sans-normal: 12px; + --compact-font-size-sans-large: 14px; + --compact-line-height-data: 18px; + --compact-root-font-size: 16px; + + /* Comfortable density */ + --comfortable-font-size-monospace-small: 10px; + --comfortable-font-size-monospace-normal: 13px; + --comfortable-font-size-monospace-large: 17px; + --comfortable-font-size-sans-small: 12px; + --comfortable-font-size-sans-normal: 14px; + --comfortable-font-size-sans-large: 16px; + --comfortable-line-height-data: 22px; + --comfortable-root-font-size: 20px; + + /* GitHub.com system fonts */ + --font-family-monospace: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, + Courier, monospace; + --font-family-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, + Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; + + /* Constant values shared between JS and CSS */ + --interaction-commit-size: 10px; + --interaction-label-width: 200px; +} +`},function(i,o,f){"use strict";function p(N){var C=this;if(C instanceof p||(C=new p),C.tail=null,C.head=null,C.length=0,N&&typeof N.forEach=="function")N.forEach(function(W){C.push(W)});else if(arguments.length>0)for(var U=0,q=arguments.length;U1)U=C;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");q=this.head.next,U=this.head.value}for(var W=0;q!==null;W++)U=N(U,q.value,W),q=q.next;return U},p.prototype.reduceReverse=function(N,C){var U,q=this.tail;if(arguments.length>1)U=C;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");q=this.tail.prev,U=this.tail.value}for(var W=this.length-1;q!==null;W--)U=N(U,q.value,W),q=q.prev;return U},p.prototype.toArray=function(){for(var N=new Array(this.length),C=0,U=this.head;U!==null;C++)N[C]=U.value,U=U.next;return N},p.prototype.toArrayReverse=function(){for(var N=new Array(this.length),C=0,U=this.tail;U!==null;C++)N[C]=U.value,U=U.prev;return N},p.prototype.slice=function(N,C){(C=C||this.length)<0&&(C+=this.length),(N=N||0)<0&&(N+=this.length);var U=new p;if(Cthis.length&&(C=this.length);for(var q=0,W=this.head;W!==null&&qthis.length&&(C=this.length);for(var q=this.length,W=this.tail;W!==null&&q>C;q--)W=W.prev;for(;W!==null&&q>N;q--,W=W.prev)U.push(W.value);return U},p.prototype.splice=function(N,C){N>this.length&&(N=this.length-1),N<0&&(N=this.length+N);for(var U=0,q=this.head;q!==null&&U=0&&(L._idleTimeoutId=setTimeout(function(){L._onTimeout&&L._onTimeout()},N))},f(14),o.setImmediate=typeof self!="undefined"&&self.setImmediate||p!==void 0&&p.setImmediate||this&&this.setImmediate,o.clearImmediate=typeof self!="undefined"&&self.clearImmediate||p!==void 0&&p.clearImmediate||this&&this.clearImmediate}).call(this,f(4))},function(i,o,f){(function(p,E){(function(t,k){"use strict";if(!t.setImmediate){var L,N,C,U,q,W=1,ne={},m=!1,we=t.document,Se=Object.getPrototypeOf&&Object.getPrototypeOf(t);Se=Se&&Se.setTimeout?Se:t,{}.toString.call(t.process)==="[object process]"?L=function(ze){E.nextTick(function(){ge(ze)})}:function(){if(t.postMessage&&!t.importScripts){var ze=!0,pe=t.onmessage;return t.onmessage=function(){ze=!1},t.postMessage("","*"),t.onmessage=pe,ze}}()?(U="setImmediate$"+Math.random()+"$",q=function(ze){ze.source===t&&typeof ze.data=="string"&&ze.data.indexOf(U)===0&&ge(+ze.data.slice(U.length))},t.addEventListener?t.addEventListener("message",q,!1):t.attachEvent("onmessage",q),L=function(ze){t.postMessage(U+ze,"*")}):t.MessageChannel?((C=new MessageChannel).port1.onmessage=function(ze){ge(ze.data)},L=function(ze){C.port2.postMessage(ze)}):we&&"onreadystatechange"in we.createElement("script")?(N=we.documentElement,L=function(ze){var pe=we.createElement("script");pe.onreadystatechange=function(){ge(ze),pe.onreadystatechange=null,N.removeChild(pe),pe=null},N.appendChild(pe)}):L=function(ze){setTimeout(ge,0,ze)},Se.setImmediate=function(ze){typeof ze!="function"&&(ze=new Function(""+ze));for(var pe=new Array(arguments.length-1),Oe=0;Oeae;ae++)if((Q=he(at,jt,ae))!==-1){Se=ae,jt=Q;break e}jt=-1}}e:{if(at=$t,(Q=W().get(Ke.primitive))!==void 0){for(ae=0;aejt-at?null:$t.slice(at,jt-1))!==null){if(jt=0,rt!==null){for(;jt<$t.length&&jtjt;rt--)wt=$e.pop()}for(rt=$t.length-jt-1;1<=rt;rt--)jt=[],wt.push({id:null,isStateEditable:!1,name:ze($t[rt-1].functionName),value:void 0,subHooks:jt}),$e.push(wt),wt=jt;rt=$t}jt=($t=Ke.primitive)==="Context"||$t==="DebugValue"?null:xt++,wt.push({id:jt,isStateEditable:$t==="Reducer"||$t==="State",name:$t,value:Ke.value,subHooks:[]})}return function Ce(ue,je){for(var ct=[],At=0;At-1&&(ne=ne.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var m=ne.replace(/^\s+/,"").replace(/\(eval code/g,"("),we=m.match(/ (\((.+):(\d+):(\d+)\)$)/),Se=(m=we?m.replace(we[0],""):m).split(/\s+/).slice(1),he=this.extractLocation(we?we[1]:Se.pop()),ge=Se.join(" ")||void 0,ze=["eval",""].indexOf(he[0])>-1?void 0:he[0];return new N({functionName:ge,fileName:ze,lineNumber:he[1],columnNumber:he[2],source:ne})},this)},parseFFOrSafari:function(W){return W.stack.split(` +`).filter(function(ne){return!ne.match(q)},this).map(function(ne){if(ne.indexOf(" > eval")>-1&&(ne=ne.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),ne.indexOf("@")===-1&&ne.indexOf(":")===-1)return new N({functionName:ne});var m=/((.*".+"[^@]*)?[^@]*)(?:@)/,we=ne.match(m),Se=we&&we[1]?we[1]:void 0,he=this.extractLocation(ne.replace(m,""));return new N({functionName:Se,fileName:he[0],lineNumber:he[1],columnNumber:he[2],source:ne})},this)},parseOpera:function(W){return!W.stacktrace||W.message.indexOf(` +`)>-1&&W.message.split(` +`).length>W.stacktrace.split(` +`).length?this.parseOpera9(W):W.stack?this.parseOpera11(W):this.parseOpera10(W)},parseOpera9:function(W){for(var ne=/Line (\d+).*script (?:in )?(\S+)/i,m=W.message.split(` +`),we=[],Se=2,he=m.length;Se/,"$2").replace(/\([^)]*\)/g,"")||void 0;he.match(/\(([^)]*)\)/)&&(m=he.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var ze=m===void 0||m==="[arguments not available]"?void 0:m.split(",");return new N({functionName:ge,args:ze,fileName:Se[0],lineNumber:Se[1],columnNumber:Se[2],source:ne})},this)}}})=="function"?p.apply(o,E):p)===void 0||(i.exports=t)})()},function(i,o,f){var p,E,t;(function(k,L){"use strict";E=[],(t=typeof(p=function(){function N(ge){return ge.charAt(0).toUpperCase()+ge.substring(1)}function C(ge){return function(){return this[ge]}}var U=["isConstructor","isEval","isNative","isToplevel"],q=["columnNumber","lineNumber"],W=["fileName","functionName","source"],ne=U.concat(q,W,["args"]);function m(ge){if(ge)for(var ze=0;ze1?xe-1:0),ke=1;ke=0&&xe.splice(Z,1)}}}])&&p(z.prototype,G),$&&p(z,$),B}(),t=f(2),k=f.n(t);try{var L=f(9).default,N=function(B){var z=new RegExp("".concat(B,": ([0-9]+)")),G=L.match(z);return parseInt(G[1],10)};N("comfortable-line-height-data"),N("compact-line-height-data")}catch(B){}function C(B){try{return sessionStorage.getItem(B)}catch(z){return null}}function U(B){try{sessionStorage.removeItem(B)}catch(z){}}function q(B,z){try{return sessionStorage.setItem(B,z)}catch(G){}}var W=function(B,z){return B===z},ne=f(1),m=f.n(ne);function we(B){return B.ownerDocument?B.ownerDocument.defaultView:null}function Se(B){var z=we(B);return z?z.frameElement:null}function he(B){var z=pe(B);return ge([B.getBoundingClientRect(),{top:z.borderTop,left:z.borderLeft,bottom:z.borderBottom,right:z.borderRight,width:0,height:0}])}function ge(B){return B.reduce(function(z,G){return z==null?G:{top:z.top+G.top,left:z.left+G.left,width:z.width,height:z.height,bottom:z.bottom+G.bottom,right:z.right+G.right}})}function ze(B,z){var G=Se(B);if(G&&G!==z){for(var $=[B.getBoundingClientRect()],De=G,me=!1;De;){var xe=he(De);if($.push(xe),De=Se(De),me)break;De&&we(De)===z&&(me=!0)}return ge($)}return B.getBoundingClientRect()}function pe(B){var z=window.getComputedStyle(B);return{borderLeft:parseInt(z.borderLeftWidth,10),borderRight:parseInt(z.borderRightWidth,10),borderTop:parseInt(z.borderTopWidth,10),borderBottom:parseInt(z.borderBottomWidth,10),marginLeft:parseInt(z.marginLeft,10),marginRight:parseInt(z.marginRight,10),marginTop:parseInt(z.marginTop,10),marginBottom:parseInt(z.marginBottom,10),paddingLeft:parseInt(z.paddingLeft,10),paddingRight:parseInt(z.paddingRight,10),paddingTop:parseInt(z.paddingTop,10),paddingBottom:parseInt(z.paddingBottom,10)}}function Oe(B,z){var G;if(typeof Symbol=="undefined"||B[Symbol.iterator]==null){if(Array.isArray(B)||(G=function(ke,Xe){if(!!ke){if(typeof ke=="string")return le(ke,Xe);var ht=Object.prototype.toString.call(ke).slice(8,-1);if(ht==="Object"&&ke.constructor&&(ht=ke.constructor.name),ht==="Map"||ht==="Set")return Array.from(ke);if(ht==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ht))return le(ke,Xe)}}(B))||z&&B&&typeof B.length=="number"){G&&(B=G);var $=0,De=function(){};return{s:De,n:function(){return $>=B.length?{done:!0}:{done:!1,value:B[$++]}},e:function(ke){throw ke},f:De}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var me,xe=!0,Z=!1;return{s:function(){G=B[Symbol.iterator]()},n:function(){var ke=G.next();return xe=ke.done,ke},e:function(ke){Z=!0,me=ke},f:function(){try{xe||G.return==null||G.return()}finally{if(Z)throw me}}}}function le(B,z){(z==null||z>B.length)&&(z=B.length);for(var G=0,$=new Array(z);Gxe.left+xe.width&&(ie=xe.left+xe.width-ht-5),{style:{top:ke+="px",left:ie+="px"}}}(z,G,{width:$.width,height:$.height});m()(this.tip.style,De.style)}}]),B}(),$e=function(){function B(){Ue(this,B);var z=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.window=z;var G=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.tipBoundsWindow=G;var $=z.document;this.container=$.createElement("div"),this.container.style.zIndex="10000000",this.tip=new xt($,this.container),this.rects=[],$.body.appendChild(this.container)}return rt(B,[{key:"remove",value:function(){this.tip.remove(),this.rects.forEach(function(z){z.remove()}),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}},{key:"inspect",value:function(z,G){for(var $=this,De=z.filter(function(Tt){return Tt.nodeType===Node.ELEMENT_NODE});this.rects.length>De.length;)this.rects.pop().remove();if(De.length!==0){for(;this.rects.length1&&arguments[1]!==void 0?arguments[1]:W,tt=void 0,Tt=[],kt=void 0,bt=!1,on=function(Lt,gn){return qe(Lt,Tt[gn])},tn=function(){for(var Lt=arguments.length,gn=Array(Lt),lr=0;lr5&&arguments[5]!==void 0?arguments[5]:0,Z=Co(B);switch(Z){case"html_element":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:B.tagName,type:Z};case"function":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:typeof B.name!="function"&&B.name?B.name:"function",type:Z};case"string":return B.length<=500?B:B.slice(0,500)+"...";case"bigint":case"symbol":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:B.toString(),type:Z};case"react_element":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:L0(B)||"Unknown",type:Z};case"array_buffer":case"data_view":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:Z==="data_view"?"DataView":"ArrayBuffer",size:B.byteLength,type:Z};case"array":return me=De($),xe>=2&&!me?a0(Z,!0,B,z,$):B.map(function(ht,ie){return So(ht,z,G,$.concat([ie]),De,me?1:xe+1)});case"html_all_collection":case"typed_array":case"iterator":if(me=De($),xe>=2&&!me)return a0(Z,!0,B,z,$);var ke={unserializable:!0,type:Z,readonly:!0,size:Z==="typed_array"?B.length:void 0,preview_short:Si(B,!1),preview_long:Si(B,!0),name:B.constructor&&B.constructor.name!=="Object"?B.constructor.name:""};return Kt(B[Symbol.iterator])&&Array.from(B).forEach(function(ht,ie){return ke[ie]=So(ht,z,G,$.concat([ie]),De,me?1:xe+1)}),G.push($),ke;case"opaque_iterator":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:B[Symbol.toStringTag],type:Z};case"date":case"regexp":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:B.toString(),type:Z};case"object":if(me=De($),xe>=2&&!me)return a0(Z,!0,B,z,$);var Xe={};return eu(B).forEach(function(ht){var ie=ht.toString();Xe[ie]=So(B[ht],z,G,$.concat([ie]),De,me?1:xe+1)}),Xe;case"infinity":case"nan":case"undefined":return z.push($),{type:Z};default:return B}}function Go(B){return(Go=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z})(B)}function Os(B){return function(z){if(Array.isArray(z))return Yo(z)}(B)||function(z){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(z))return Array.from(z)}(B)||function(z,G){if(!!z){if(typeof z=="string")return Yo(z,G);var $=Object.prototype.toString.call(z).slice(8,-1);if($==="Object"&&z.constructor&&($=z.constructor.name),$==="Map"||$==="Set")return Array.from(z);if($==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test($))return Yo(z,G)}}(B)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Yo(B,z){(z==null||z>B.length)&&(z=B.length);for(var G=0,$=new Array(z);Gz.toString()?1:z.toString()>B.toString()?-1:0}function eu(B){for(var z=[],G=B,$=function(){var De=[].concat(Os(Object.keys(G)),Os(Object.getOwnPropertySymbols(G))),me=Object.getOwnPropertyDescriptors(G);De.forEach(function(xe){me[xe].enumerable&&z.push(xe)}),G=Object.getPrototypeOf(G)};G!=null;)$();return z}function ai(B){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Anonymous",G=Ko.get(B);if(G!=null)return G;var $=z;return typeof B.displayName=="string"?$=B.displayName:typeof B.name=="string"&&B.name!==""&&($=B.name),Ko.set(B,$),$}var mr=0;function Xo(){return++mr}function W0(B){var z=qt.get(B);if(z!==void 0)return z;for(var G=new Array(B.length),$=0;$1&&arguments[1]!==void 0?arguments[1]:50;return B.length>z?B.substr(0,z)+"\u2026":B}function Si(B,z){if(B!=null&&hasOwnProperty.call(B,vu.type))return z?B[vu.preview_long]:B[vu.preview_short];switch(Co(B)){case"html_element":return"<".concat(tu(B.tagName.toLowerCase())," />");case"function":return tu("\u0192 ".concat(typeof B.name=="function"?"":B.name,"() {}"));case"string":return'"'.concat(B,'"');case"bigint":return tu(B.toString()+"n");case"regexp":case"symbol":return tu(B.toString());case"react_element":return"<".concat(tu(L0(B)||"Unknown")," />");case"array_buffer":return"ArrayBuffer(".concat(B.byteLength,")");case"data_view":return"DataView(".concat(B.buffer.byteLength,")");case"array":if(z){for(var G="",$=0;$0&&(G+=", "),!((G+=Si(B[$],!1)).length>50));$++);return"[".concat(tu(G),"]")}var De=hasOwnProperty.call(B,vu.size)?B[vu.size]:B.length;return"Array(".concat(De,")");case"typed_array":var me="".concat(B.constructor.name,"(").concat(B.length,")");if(z){for(var xe="",Z=0;Z0&&(xe+=", "),!((xe+=B[Z]).length>50));Z++);return"".concat(me," [").concat(tu(xe),"]")}return me;case"iterator":var ke=B.constructor.name;if(z){for(var Xe=Array.from(B),ht="",ie=0;ie0&&(ht+=", "),Array.isArray(qe)){var tt=Si(qe[0],!0),Tt=Si(qe[1],!1);ht+="".concat(tt," => ").concat(Tt)}else ht+=Si(qe,!1);if(ht.length>50)break}return"".concat(ke,"(").concat(B.size,") {").concat(tu(ht),"}")}return"".concat(ke,"(").concat(B.size,")");case"opaque_iterator":return B[Symbol.toStringTag];case"date":return B.toString();case"object":if(z){for(var kt=eu(B).sort(_i),bt="",on=0;on0&&(bt+=", "),(bt+="".concat(tn.toString(),": ").concat(Si(B[tn],!1))).length>50)break}return"{".concat(tu(bt),"}")}return"{\u2026}";case"boolean":case"number":case"infinity":case"nan":case"null":case"undefined":return B;default:try{return tu(""+B)}catch(Lt){return"unserializable"}}}var ks=f(7);function Hl(B){return(Hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z})(B)}function F0(B,z){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(B);z&&($=$.filter(function(De){return Object.getOwnPropertyDescriptor(B,De).enumerable})),G.push.apply(G,$)}return G}function f0(B){for(var z=1;z2&&arguments[2]!==void 0?arguments[2]:[];if(B!==null){var $=[],De=[],me=So(B,$,De,G,z);return{data:me,cleaned:$,unserializable:De}}return null}function G0(B){var z,G,$=(z=B,G=new Set,JSON.stringify(z,function(xe,Z){if(Hl(Z)==="object"&&Z!==null){if(G.has(Z))return;G.add(Z)}return typeof Z=="bigint"?Z.toString()+"n":Z})),De=$===void 0?"undefined":$,me=window.__REACT_DEVTOOLS_GLOBAL_HOOK__.clipboardCopyText;typeof me=="function"?me(De).catch(function(xe){}):Object(ks.copy)(De)}function fi(B,z){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,$=z[G],De=Array.isArray(B)?B.slice():f0({},B);return G+1===z.length?Array.isArray(De)?De.splice($,1):delete De[$]:De[$]=fi(B[$],z,G+1),De}function Zt(B,z,G){var $=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,De=z[$],me=Array.isArray(B)?B.slice():f0({},B);if($+1===z.length){var xe=G[$];me[xe]=me[De],Array.isArray(me)?me.splice(De,1):delete me[De]}else me[De]=Zt(B[De],z,G,$+1);return me}function Ln(B,z,G){var $=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if($>=z.length)return G;var De=z[$],me=Array.isArray(B)?B.slice():f0({},B);return me[De]=Ln(B[De],z,G,$+1),me}var Di=f(8);function ci(B,z){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(B);z&&($=$.filter(function(De){return Object.getOwnPropertyDescriptor(B,De).enumerable})),G.push.apply(G,$)}return G}function Ht(B){for(var z=1;z=B.length?{done:!0}:{done:!1,value:B[$++]}},e:function(ke){throw ke},f:De}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var me,xe=!0,Z=!1;return{s:function(){G=B[Symbol.iterator]()},n:function(){var ke=G.next();return xe=ke.done,ke},e:function(ke){Z=!0,me=ke},f:function(){try{xe||G.return==null||G.return()}finally{if(Z)throw me}}}}function Wl(B,z){if(B){if(typeof B=="string")return xo(B,z);var G=Object.prototype.toString.call(B).slice(8,-1);return G==="Object"&&B.constructor&&(G=B.constructor.name),G==="Map"||G==="Set"?Array.from(B):G==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(G)?xo(B,z):void 0}}function xo(B,z){(z==null||z>B.length)&&(z=B.length);for(var G=0,$=new Array(z);G0){var vt=me(se);if(vt!=null){var Xt,xn=Ui(Mo);try{for(xn.s();!(Xt=xn.n()).done;)if(Xt.value.test(vt))return!0}catch(er){xn.e(er)}finally{xn.f()}}}if(re!=null&&ds.size>0){var _n,yn=re.fileName,En=Ui(ds);try{for(En.s();!(_n=En.n()).done;)if(_n.value.test(yn))return!0}catch(er){En.e(er)}finally{En.f()}}return!1}function yu(se){var re=se.type;switch(se.tag){case Tt:case _r:return 1;case tt:case Cn:return 5;case tn:return 6;case Lt:return 11;case lr:return 7;case gn:case Qn:case on:return 9;case Ar:case Rr:return 8;case nt:return 12;case _t:return 13;default:switch(xe(re)){case 60111:case"Symbol(react.concurrent_mode)":case"Symbol(react.async_mode)":return 9;case 60109:case"Symbol(react.provider)":return 2;case 60110:case"Symbol(react.context)":return 2;case 60108:case"Symbol(react.strict_mode)":return 9;case 60114:case"Symbol(react.profiler)":return 10;default:return 9}}}function pi(se){if(Fo.has(se))return se;var re=se.alternate;return re!=null&&Fo.has(re)?re:(Fo.add(se),se)}window.__REACT_DEVTOOLS_COMPONENT_FILTERS__!=null?ps(window.__REACT_DEVTOOLS_COMPONENT_FILTERS__):ps([{type:1,value:7,isEnabled:!0}]);var T0=new Map,Q0=new Map,Fo=new Set,ta=new Map,Kl=new Map,Ki=-1;function Yr(se){if(!T0.has(se)){var re=Xo();T0.set(se,re),Q0.set(re,se)}return T0.get(se)}function fo(se){switch(yu(se)){case 1:if(I0!==null){var re=Yr(pi(se)),Le=gi(se);Le!==null&&I0.set(re,Le)}}}var Oi={};function gi(se){switch(yu(se)){case 1:var re=se.stateNode,Le=Oi,Ae=Oi;return re!=null&&(re.constructor&&re.constructor.contextType!=null?Ae=re.context:(Le=re.context)&&Object.keys(Le).length===0&&(Le=Oi)),[Le,Ae];default:return null}}function ff(se){switch(yu(se)){case 1:if(I0!==null){var re=Yr(pi(se)),Le=I0.has(re)?I0.get(re):null,Ae=gi(se);if(Le==null||Ae==null)return null;var ot=Y0(Le,2),vt=ot[0],Xt=ot[1],xn=Y0(Ae,2),_n=xn[0],yn=xn[1];if(_n!==Oi)return J0(vt,_n);if(yn!==Oi)return Xt!==yn}}return null}function cf(se,re){if(se==null||re==null)return!1;if(re.hasOwnProperty("baseState")&&re.hasOwnProperty("memoizedState")&&re.hasOwnProperty("next")&&re.hasOwnProperty("queue"))for(;re!==null;){if(re.memoizedState!==se.memoizedState)return!0;re=re.next,se=se.next}return!1}function J0(se,re){if(se==null||re==null||re.hasOwnProperty("baseState")&&re.hasOwnProperty("memoizedState")&&re.hasOwnProperty("next")&&re.hasOwnProperty("queue"))return null;var Le,Ae=[],ot=Ui(new Set([].concat(Yi(Object.keys(se)),Yi(Object.keys(re)))));try{for(ot.s();!(Le=ot.n()).done;){var vt=Le.value;se[vt]!==re[vt]&&Ae.push(vt)}}catch(Xt){ot.e(Xt)}finally{ot.f()}return Ae}function Z0(se,re){switch(re.tag){case Tt:case tt:case kt:case Ar:case Rr:return(oo(re)&ie)===ie;default:return se.memoizedProps!==re.memoizedProps||se.memoizedState!==re.memoizedState||se.ref!==re.ref}}var Te=[],et=[],Ve=[],Gt=[],Yt=new Map,sr=0,Br=null;function wn(se){Te.push(se)}function fu(se){if(Te.length!==0||et.length!==0||Ve.length!==0||Br!==null||Ru){var re=et.length+Ve.length+(Br===null?0:1),Le=new Array(3+sr+(re>0?2+re:0)+Te.length),Ae=0;if(Le[Ae++]=z,Le[Ae++]=Ki,Le[Ae++]=sr,Yt.forEach(function(xn,_n){Le[Ae++]=_n.length;for(var yn=W0(_n),En=0;En0){Le[Ae++]=2,Le[Ae++]=re;for(var ot=et.length-1;ot>=0;ot--)Le[Ae++]=et[ot];for(var vt=0;vt0?se.forEach(function(re){B.emit("operations",re)}):(wr!==null&&(ru=!0),B.getFiberRoots(z).forEach(function(re){Xu(Ki=Yr(pi(re.current)),re.current),Ru&&re.memoizedInteractions!=null&&($o={changeDescriptions:Xl?new Map:null,durations:[],commitTime:Vl()-Yu,interactions:Array.from(re.memoizedInteractions).map(function(Le){return Ht(Ht({},Le),{},{timestamp:Le.timestamp-Yu})}),maxActualDuration:0,priorityLevel:null}),Vr(re.current,null,!1,!1),fu(),Ki=-1}))},getBestMatchForTrackedPath:function(){if(wr===null||$0===null)return null;for(var se=$0;se!==null&&Vu(se);)se=se.return;return se===null?null:{id:Yr(pi(se)),isFullMatch:Xi===wr.length-1}},getDisplayNameForFiberID:function(se){var re=Q0.get(se);return re!=null?me(re):null},getFiberIDForNative:function(se){var re=arguments.length>1&&arguments[1]!==void 0&&arguments[1],Le=G.findFiberByHostInstance(se);if(Le!=null){if(re)for(;Le!==null&&Vu(Le);)Le=Le.return;return Yr(pi(Le))}return null},getInstanceAndStyle:function(se){var re=null,Le=null,Ae=Uu(se);return Ae!==null&&(re=Ae.stateNode,Ae.memoizedProps!==null&&(Le=Ae.memoizedProps.style)),{instance:re,style:Le}},getOwnersList:function(se){var re=Uu(se);if(re==null)return null;var Le=re._debugOwner,Ae=[{displayName:me(re)||"Anonymous",id:se,type:yu(re)}];if(Le)for(var ot=Le;ot!==null;)Ae.unshift({displayName:me(ot)||"Anonymous",id:Yr(pi(ot)),type:yu(ot)}),ot=ot._debugOwner||null;return Ae},getPathForElement:function(se){var re=Q0.get(se);if(re==null)return null;for(var Le=[];re!==null;)Le.push(y0(re)),re=re.return;return Le.reverse(),Le},getProfilingData:function(){var se=[];if(hs===null)throw Error("getProfilingData() called before any profiling data was recorded");return hs.forEach(function(re,Le){var Ae=[],ot=[],vt=new Map,Xt=new Map,xn=El!==null&&El.get(Le)||"Unknown";R0!=null&&R0.forEach(function(_n,yn){co!=null&&co.get(yn)===Le&&ot.push([yn,_n])}),re.forEach(function(_n,yn){var En=_n.changeDescriptions,er=_n.durations,It=_n.interactions,xi=_n.maxActualDuration,Sr=_n.priorityLevel,cr=_n.commitTime,Y=[];It.forEach(function(hi){vt.has(hi.id)||vt.set(hi.id,hi),Y.push(hi.id);var Qi=Xt.get(hi.id);Qi!=null?Qi.push(yn):Xt.set(hi.id,[yn])});for(var Qr=[],Jr=[],Ur=0;Ur1?Wn.set(En,er-1):Wn.delete(En),Xr.delete(_n)}(Ki),Kr(Le,!1))}else Xu(Ki,Le),Vr(Le,null,!1,!1);if(Ru&&ot){var xn=hs.get(Ki);xn!=null?xn.push($o):hs.set(Ki,[$o])}fu(),No&&B.emit("traceUpdates",Lo),Ki=-1},handleCommitFiberUnmount:function(se){Kr(se,!1)},inspectElement:function(se,re){if(Li(se)){if(re!=null){A0(re);var Le=null;return re[0]==="hooks"&&(Le="hooks"),{id:se,type:"hydrated-path",path:re,value:Ei(Lu(zi,re),Fi(null,Le),re)}}return{id:se,type:"no-change"}}if(Is=!1,zi!==null&&zi.id===se||(x0={}),(zi=na(se))===null)return{id:se,type:"not-found"};re!=null&&A0(re),function(ot){var vt=ot.hooks,Xt=ot.id,xn=ot.props,_n=Q0.get(Xt);if(_n!=null){var yn=_n.elementType,En=_n.stateNode,er=_n.tag,It=_n.type;switch(er){case Tt:case _r:case Cn:$.$r=En;break;case tt:$.$r={hooks:vt,props:xn,type:It};break;case tn:$.$r={props:xn,type:It.render};break;case Ar:case Rr:$.$r={props:xn,type:yn!=null&&yn.type!=null?yn.type:It};break;default:$.$r=null}}else console.warn('Could not find Fiber with id "'.concat(Xt,'"'))}(zi);var Ae=Ht({},zi);return Ae.context=Ei(Ae.context,Fi("context",null)),Ae.hooks=Ei(Ae.hooks,Fi("hooks","hooks")),Ae.props=Ei(Ae.props,Fi("props",null)),Ae.state=Ei(Ae.state,Fi("state",null)),{id:se,type:"full-data",value:Ae}},logElementToConsole:function(se){var re=Li(se)?zi:na(se);if(re!==null){var Le=typeof console.groupCollapsed=="function";Le&&console.groupCollapsed("[Click to expand] %c<".concat(re.displayName||"Component"," />"),"color: var(--dom-tag-name-color); font-weight: normal;"),re.props!==null&&console.log("Props:",re.props),re.state!==null&&console.log("State:",re.state),re.hooks!==null&&console.log("Hooks:",re.hooks);var Ae=_l(se);Ae!==null&&console.log("Nodes:",Ae),re.source!==null&&console.log("Location:",re.source),(window.chrome||/firefox/i.test(navigator.userAgent))&&console.log("Right-click any value to save it as a global variable for further inspection."),Le&&console.groupEnd()}else console.warn('Could not find Fiber with id "'.concat(se,'"'))},prepareViewAttributeSource:function(se,re){Li(se)&&(window.$attribute=Lu(zi,re))},prepareViewElementSource:function(se){var re=Q0.get(se);if(re!=null){var Le=re.elementType,Ae=re.tag,ot=re.type;switch(Ae){case Tt:case _r:case Cn:case tt:$.$type=ot;break;case tn:$.$type=ot.render;break;case Ar:case Rr:$.$type=Le!=null&&Le.type!=null?Le.type:ot;break;default:$.$type=null}}else console.warn('Could not find Fiber with id "'.concat(se,'"'))},overrideSuspense:function(se,re){if(typeof ko!="function"||typeof Zo!="function")throw new Error("Expected overrideSuspense() to not get called for earlier React versions.");re?(Ku.add(se),Ku.size===1&&ko(vs)):(Ku.delete(se),Ku.size===0&&ko(df));var Le=Q0.get(se);Le!=null&&Zo(Le)},overrideValueAtPath:function(se,re,Le,Ae,ot){var vt=Uu(re);if(vt!==null){var Xt=vt.stateNode;switch(se){case"context":switch(Ae=Ae.slice(1),vt.tag){case Tt:Ae.length===0?Xt.context=ot:To(Xt.context,Ae,ot),Xt.forceUpdate()}break;case"hooks":typeof nu=="function"&&nu(vt,Le,Ae,ot);break;case"props":switch(vt.tag){case Tt:vt.pendingProps=Ln(Xt.props,Ae,ot),Xt.forceUpdate();break;default:typeof X0=="function"&&X0(vt,Ae,ot)}break;case"state":switch(vt.tag){case Tt:To(Xt.state,Ae,ot),Xt.forceUpdate()}}}},renamePath:function(se,re,Le,Ae,ot){var vt=Uu(re);if(vt!==null){var Xt=vt.stateNode;switch(se){case"context":switch(Ae=Ae.slice(1),ot=ot.slice(1),vt.tag){case Tt:Ae.length===0||Hr(Xt.context,Ae,ot),Xt.forceUpdate()}break;case"hooks":typeof S0=="function"&&S0(vt,Le,Ae,ot);break;case"props":Xt===null?typeof di=="function"&&di(vt,Ae,ot):(vt.pendingProps=Zt(Xt.props,Ae,ot),Xt.forceUpdate());break;case"state":Hr(Xt.state,Ae,ot),Xt.forceUpdate()}}},renderer:G,setTraceUpdatesEnabled:function(se){No=se},setTrackedPath:Ci,startProfiling:ra,stopProfiling:function(){Ru=!1,Xl=!1},storeAsGlobal:function(se,re,Le){if(Li(se)){var Ae=Lu(zi,re),ot="$reactTemp".concat(Le);window[ot]=Ae,console.log(ot),console.log(Ae)}},updateComponentFilters:function(se){if(Ru)throw Error("Cannot modify filter preferences while profiling");B.getFiberRoots(z).forEach(function(re){Ki=Yr(pi(re.current)),Bu(re.current),Kr(re.current,!1),Ki=-1}),ps(se),Wn.clear(),B.getFiberRoots(z).forEach(function(re){Xu(Ki=Yr(pi(re.current)),re.current),Vr(re.current,null,!1,!1),fu(re),Ki=-1})}}}var Xn;function Qo(B){return(Qo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z})(B)}function lo(B,z,G){if(Xn===void 0)try{throw Error()}catch(De){var $=De.stack.trim().match(/\n( *(at )?)/);Xn=$&&$[1]||""}return` +`+Xn+B}var b0=!1;function yl(B,z,G){if(!B||b0)return"";var $,De=Error.prepareStackTrace;Error.prepareStackTrace=void 0,b0=!0;var me=G.current;G.current=null;try{if(z){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),(typeof Reflect=="undefined"?"undefined":Qo(Reflect))==="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(qe){$=qe}Reflect.construct(B,[],xe)}else{try{xe.call()}catch(qe){$=qe}B.call(xe.prototype)}}else{try{throw Error()}catch(qe){$=qe}B()}}catch(qe){if(qe&&$&&typeof qe.stack=="string"){for(var Z=qe.stack.split(` +`),ke=$.stack.split(` +`),Xe=Z.length-1,ht=ke.length-1;Xe>=1&&ht>=0&&Z[Xe]!==ke[ht];)ht--;for(;Xe>=1&&ht>=0;Xe--,ht--)if(Z[Xe]!==ke[ht]){if(Xe!==1||ht!==1)do if(Xe--,--ht<0||Z[Xe]!==ke[ht])return` +`+Z[Xe].replace(" at new "," at ");while(Xe>=1&&ht>=0);break}}}finally{b0=!1,Error.prepareStackTrace=De,G.current=me}var ie=B?B.displayName||B.name:"";return ie?lo(ie):""}function Ro(B,z,G,$){return yl(B,!1,$)}function Et(B,z,G){var $=B.HostComponent,De=B.LazyComponent,me=B.SuspenseComponent,xe=B.SuspenseListComponent,Z=B.FunctionComponent,ke=B.IndeterminateComponent,Xe=B.SimpleMemoComponent,ht=B.ForwardRef,ie=B.Block,qe=B.ClassComponent;switch(z.tag){case $:return lo(z.type);case De:return lo("Lazy");case me:return lo("Suspense");case xe:return lo("SuspenseList");case Z:case ke:case Xe:return Ro(z.type,0,0,G);case ht:return Ro(z.type.render,0,0,G);case ie:return Ro(z.type._render,0,0,G);case qe:return function(tt,Tt,kt,bt){return yl(tt,!0,bt)}(z.type,0,0,G);default:return""}}function Pt(B,z,G){try{var $="",De=z;do $+=Et(B,De,G),De=De.return;while(De);return $}catch(me){return` +Error generating stack: `+me.message+` +`+me.stack}}function Bn(B,z){var G;if(typeof Symbol=="undefined"||B[Symbol.iterator]==null){if(Array.isArray(B)||(G=function(ke,Xe){if(!!ke){if(typeof ke=="string")return Ir(ke,Xe);var ht=Object.prototype.toString.call(ke).slice(8,-1);if(ht==="Object"&&ke.constructor&&(ht=ke.constructor.name),ht==="Map"||ht==="Set")return Array.from(ke);if(ht==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ht))return Ir(ke,Xe)}}(B))||z&&B&&typeof B.length=="number"){G&&(B=G);var $=0,De=function(){};return{s:De,n:function(){return $>=B.length?{done:!0}:{done:!1,value:B[$++]}},e:function(ke){throw ke},f:De}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var me,xe=!0,Z=!1;return{s:function(){G=B[Symbol.iterator]()},n:function(){var ke=G.next();return xe=ke.done,ke},e:function(ke){Z=!0,me=ke},f:function(){try{xe||G.return==null||G.return()}finally{if(Z)throw me}}}}function Ir(B,z){(z==null||z>B.length)&&(z=B.length);for(var G=0,$=new Array(z);G0?Xe[Xe.length-1]:null,qe=ie!==null&&(Wr.test(ie)||wu.test(ie));if(!qe){var tt,Tt=Bn(c0.values());try{for(Tt.s();!(tt=Tt.n()).done;){var kt=tt.value,bt=kt.currentDispatcherRef,on=kt.getCurrentFiber,tn=kt.workTagMap,Lt=on();if(Lt!=null){var gn=Pt(tn,Lt,bt);gn!==""&&Xe.push(gn);break}}}catch(lr){Tt.e(lr)}finally{Tt.f()}}}catch(lr){}me.apply(void 0,Xe)};xe.__REACT_DEVTOOLS_ORIGINAL_METHOD__=me,Ti[De]=xe}catch(Z){}})}}function Fu(B){return(Fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z})(B)}function fs(B,z){for(var G=0;GB.length)&&(z=B.length);for(var G=0,$=new Array(z);G1?Z-1:0),Xe=1;Xe0?ie[ie.length-1]:0),ie.push(nn),Z.set(Ze,Xe(Ft._topLevelWrapper));try{var sn=nt.apply(this,_t);return ie.pop(),sn}catch(yr){throw ie=[],yr}finally{if(ie.length===0){var Yn=Z.get(Ze);if(Yn===void 0)throw new Error("Expected to find root ID.");lr(Yn)}}},performUpdateIfNecessary:function(nt,_t){var Ze=_t[0];if(w0(Ze)===9)return nt.apply(this,_t);var Ft=Xe(Ze);ie.push(Ft);var nn=Gn(Ze);try{var sn=nt.apply(this,_t),Yn=Gn(Ze);return ht(nn,Yn)||Tt(Ze,Ft,Yn),ie.pop(),sn}catch(nu){throw ie=[],nu}finally{if(ie.length===0){var yr=Z.get(Ze);if(yr===void 0)throw new Error("Expected to find root ID.");lr(yr)}}},receiveComponent:function(nt,_t){var Ze=_t[0];if(w0(Ze)===9)return nt.apply(this,_t);var Ft=Xe(Ze);ie.push(Ft);var nn=Gn(Ze);try{var sn=nt.apply(this,_t),Yn=Gn(Ze);return ht(nn,Yn)||Tt(Ze,Ft,Yn),ie.pop(),sn}catch(nu){throw ie=[],nu}finally{if(ie.length===0){var yr=Z.get(Ze);if(yr===void 0)throw new Error("Expected to find root ID.");lr(yr)}}},unmountComponent:function(nt,_t){var Ze=_t[0];if(w0(Ze)===9)return nt.apply(this,_t);var Ft=Xe(Ze);ie.push(Ft);try{var nn=nt.apply(this,_t);return ie.pop(),function(Yn,yr){tn.push(yr),me.delete(yr)}(0,Ft),nn}catch(Yn){throw ie=[],Yn}finally{if(ie.length===0){var sn=Z.get(Ze);if(sn===void 0)throw new Error("Expected to find root ID.");lr(sn)}}}}));var bt=[],on=new Map,tn=[],Lt=0,gn=null;function lr(nt){if(bt.length!==0||tn.length!==0||gn!==null){var _t=tn.length+(gn===null?0:1),Ze=new Array(3+Lt+(_t>0?2+_t:0)+bt.length),Ft=0;if(Ze[Ft++]=z,Ze[Ft++]=nt,Ze[Ft++]=Lt,on.forEach(function(Yn,yr){Ze[Ft++]=yr.length;for(var nu=W0(yr),Cu=0;Cu0){Ze[Ft++]=2,Ze[Ft++]=_t;for(var nn=0;nn"),"color: var(--dom-tag-name-color); font-weight: normal;"),_t.props!==null&&console.log("Props:",_t.props),_t.state!==null&&console.log("State:",_t.state),_t.context!==null&&console.log("Context:",_t.context);var Ft=De(nt);Ft!==null&&console.log("Node:",Ft),(window.chrome||/firefox/i.test(navigator.userAgent))&&console.log("Right-click any value to save it as a global variable for further inspection."),Ze&&console.groupEnd()}else console.warn('Could not find element with id "'.concat(nt,'"'))},overrideSuspense:function(){throw new Error("overrideSuspense not supported by this renderer")},overrideValueAtPath:function(nt,_t,Ze,Ft,nn){var sn=me.get(_t);if(sn!=null){var Yn=sn._instance;if(Yn!=null)switch(nt){case"context":To(Yn.context,Ft,nn),p0(Yn);break;case"hooks":throw new Error("Hooks not supported by this renderer");case"props":var yr=sn._currentElement;sn._currentElement=K0(K0({},yr),{},{props:Ln(yr.props,Ft,nn)}),p0(Yn);break;case"state":To(Yn.state,Ft,nn),p0(Yn)}}},renamePath:function(nt,_t,Ze,Ft,nn){var sn=me.get(_t);if(sn!=null){var Yn=sn._instance;if(Yn!=null)switch(nt){case"context":Hr(Yn.context,Ft,nn),p0(Yn);break;case"hooks":throw new Error("Hooks not supported by this renderer");case"props":var yr=sn._currentElement;sn._currentElement=K0(K0({},yr),{},{props:Zt(yr.props,Ft,nn)}),p0(Yn);break;case"state":Hr(Yn.state,Ft,nn),p0(Yn)}}},prepareViewAttributeSource:function(nt,_t){var Ze=Rr(nt);Ze!==null&&(window.$attribute=Lu(Ze,_t))},prepareViewElementSource:function(nt){var _t=me.get(nt);if(_t!=null){var Ze=_t._currentElement;Ze!=null?$.$type=Ze.type:console.warn('Could not find element with id "'.concat(nt,'"'))}else console.warn('Could not find instance with id "'.concat(nt,'"'))},renderer:G,setTraceUpdatesEnabled:function(nt){},setTrackedPath:function(nt){},startProfiling:function(){},stopProfiling:function(){},storeAsGlobal:function(nt,_t,Ze){var Ft=Rr(nt);if(Ft!==null){var nn=Lu(Ft,_t),sn="$reactTemp".concat(Ze);window[sn]=nn,console.log(sn),console.log(nn)}},updateComponentFilters:function(nt){}}}function ri(B,z){var G=!1,$={bottom:0,left:0,right:0,top:0},De=z[B];if(De!=null){for(var me=0,xe=Object.keys($);me0?"development":"production";var bt=Function.prototype.toString;if(kt.Mount&&kt.Mount._renderNewRootComponent){var on=bt.call(kt.Mount._renderNewRootComponent);return on.indexOf("function")!==0?"production":on.indexOf("storedMeasure")!==-1?"development":on.indexOf("should be a pure function")!==-1?on.indexOf("NODE_ENV")!==-1||on.indexOf("development")!==-1||on.indexOf("true")!==-1?"development":on.indexOf("nextElement")!==-1||on.indexOf("nextComponent")!==-1?"unminified":"development":on.indexOf("nextElement")!==-1||on.indexOf("nextComponent")!==-1?"unminified":"outdated"}}catch(tn){}return"production"}(ke);try{var ie=window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__!==!1,qe=window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__===!0;(ie||qe)&&(so(ke),Gl({appendComponentStack:ie,breakOnConsoleErrors:qe}))}catch(kt){}var tt=B.__REACT_DEVTOOLS_ATTACH__;if(typeof tt=="function"){var Tt=tt(Z,Xe,ke,B);Z.rendererInterfaces.set(Xe,Tt)}return Z.emit("renderer",{id:Xe,renderer:ke,reactBuildType:ht}),Xe},on:function(ke,Xe){me[ke]||(me[ke]=[]),me[ke].push(Xe)},off:function(ke,Xe){if(me[ke]){var ht=me[ke].indexOf(Xe);ht!==-1&&me[ke].splice(ht,1),me[ke].length||delete me[ke]}},sub:function(ke,Xe){return Z.on(ke,Xe),function(){return Z.off(ke,Xe)}},supportsFiber:!0,checkDCE:function(ke){try{Function.prototype.toString.call(ke).indexOf("^_^")>-1&&(G=!0,setTimeout(function(){throw new Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build")}))}catch(Xe){}},onCommitFiberUnmount:function(ke,Xe){var ht=De.get(ke);ht!=null&&ht.handleCommitFiberUnmount(Xe)},onCommitFiberRoot:function(ke,Xe,ht){var ie=Z.getFiberRoots(ke),qe=Xe.current,tt=ie.has(Xe),Tt=qe.memoizedState==null||qe.memoizedState.element==null;tt||Tt?tt&&Tt&&ie.delete(Xe):ie.add(Xe);var kt=De.get(ke);kt!=null&&kt.handleCommitFiberRoot(Xe,ht)}};Object.defineProperty(B,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{configurable:!1,enumerable:!1,get:function(){return Z}})})(window);var h0=window.__REACT_DEVTOOLS_GLOBAL_HOOK__,Fs=[{type:1,value:7,isEnabled:!0}];function Ni(B){if(h0!=null){var z=B||{},G=z.host,$=G===void 0?"localhost":G,De=z.nativeStyleEditorValidAttributes,me=z.useHttps,xe=me!==void 0&&me,Z=z.port,ke=Z===void 0?8097:Z,Xe=z.websocket,ht=z.resolveRNStyle,ie=ht===void 0?null:ht,qe=z.isAppActive,tt=xe?"wss":"ws",Tt=null;if((qe===void 0?function(){return!0}:qe)()){var kt=null,bt=[],on=tt+"://"+$+":"+ke,tn=Xe||new window.WebSocket(on);tn.onclose=function(){kt!==null&&kt.emit("shutdown"),Lt()},tn.onerror=function(){Lt()},tn.onmessage=function(gn){var lr;try{if(typeof gn.data!="string")throw Error();lr=JSON.parse(gn.data)}catch(Qn){return void console.error("[React DevTools] Failed to parse JSON: "+gn.data)}bt.forEach(function(Qn){try{Qn(lr)}catch(_r){throw console.log("[React DevTools] Error calling listener",lr),console.log("error:",_r),_r}})},tn.onopen=function(){(kt=new ao({listen:function(Cn){return bt.push(Cn),function(){var Ar=bt.indexOf(Cn);Ar>=0&&bt.splice(Ar,1)}},send:function(Cn,Ar,v0){tn.readyState===tn.OPEN?tn.send(JSON.stringify({event:Cn,payload:Ar})):(kt!==null&&kt.shutdown(),Lt())}})).addListener("inspectElement",function(Cn){var Ar=Cn.id,v0=Cn.rendererID,Rr=gn.rendererInterfaces[v0];if(Rr!=null){var nt=Rr.findNativeNodesForFiberID(Ar);nt!=null&&nt[0]!=null&&gn.emit("showNativeHighlight",nt[0])}}),kt.addListener("updateComponentFilters",function(Cn){Fs=Cn}),window.__REACT_DEVTOOLS_COMPONENT_FILTERS__==null&&kt.send("overrideComponentFilters",Fs);var gn=new Hn(kt);if(gn.addListener("shutdown",function(){h0.emit("shutdown")}),function(Cn,Ar,v0){if(Cn==null)return function(){};var Rr=[Cn.sub("renderer-attached",function(Ze){var Ft=Ze.id,nn=(Ze.renderer,Ze.rendererInterface);Ar.setRendererInterface(Ft,nn),nn.flushInitialOperations()}),Cn.sub("unsupported-renderer-version",function(Ze){Ar.onUnsupportedRenderer(Ze)}),Cn.sub("operations",Ar.onHookOperations),Cn.sub("traceUpdates",Ar.onTraceUpdates)],nt=function(Ze,Ft){var nn=Cn.rendererInterfaces.get(Ze);nn==null&&(typeof Ft.findFiberByHostInstance=="function"?nn=Ms(Cn,Ze,Ft,v0):Ft.ComponentTree&&(nn=ic(Cn,Ze,Ft,v0)),nn!=null&&Cn.rendererInterfaces.set(Ze,nn)),nn!=null?Cn.emit("renderer-attached",{id:Ze,renderer:Ft,rendererInterface:nn}):Cn.emit("unsupported-renderer-version",Ze)};Cn.renderers.forEach(function(Ze,Ft){nt(Ft,Ze)}),Rr.push(Cn.sub("renderer",function(Ze){var Ft=Ze.id,nn=Ze.renderer;nt(Ft,nn)})),Cn.emit("react-devtools",Ar),Cn.reactDevtoolsAgent=Ar;var _t=function(){Rr.forEach(function(Ze){return Ze()}),Cn.rendererInterfaces.forEach(function(Ze){Ze.cleanup()}),Cn.reactDevtoolsAgent=null};Ar.addListener("shutdown",_t),Rr.push(function(){Ar.removeListener("shutdown",_t)})}(h0,gn,window),ie!=null||h0.resolveRNStyle!=null)ea(kt,gn,ie||h0.resolveRNStyle,De||h0.nativeStyleEditorValidAttributes||null);else{var lr,Qn,_r=function(){kt!==null&&ea(kt,gn,lr,Qn)};h0.hasOwnProperty("resolveRNStyle")||Object.defineProperty(h0,"resolveRNStyle",{enumerable:!1,get:function(){return lr},set:function(Cn){lr=Cn,_r()}}),h0.hasOwnProperty("nativeStyleEditorValidAttributes")||Object.defineProperty(h0,"nativeStyleEditorValidAttributes",{enumerable:!1,get:function(){return Qn},set:function(Cn){Qn=Cn,_r()}})}}}else Lt()}function Lt(){Tt===null&&(Tt=setTimeout(function(){return Ni(B)},2e3))}}}])})});var mR=ce(vR=>{"use strict";Object.defineProperty(vR,"__esModule",{value:!0});pR();var $Q=hR();$Q.connectToDevTools()});var DR=ce(kg=>{"use strict";var yR=kg&&kg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(kg,"__esModule",{value:!0});var gR=h4(),eJ=yR(D9()),_R=yR(eh()),ss=Lw();process.env.DEV==="true"&&mR();var ER=i=>{i==null||i.unsetMeasureFunc(),i==null||i.freeRecursive()};kg.default=eJ.default({schedulePassiveEffects:gR.unstable_scheduleCallback,cancelPassiveEffects:gR.unstable_cancelCallback,now:Date.now,getRootHostContext:()=>({isInsideText:!1}),prepareForCommit:()=>{},resetAfterCommit:i=>{if(i.isStaticDirty){i.isStaticDirty=!1,typeof i.onImmediateRender=="function"&&i.onImmediateRender();return}typeof i.onRender=="function"&&i.onRender()},getChildHostContext:(i,o)=>{let f=i.isInsideText,p=o==="ink-text"||o==="ink-virtual-text";return f===p?i:{isInsideText:p}},shouldSetTextContent:()=>!1,createInstance:(i,o,f,p)=>{if(p.isInsideText&&i==="ink-box")throw new Error(" can\u2019t be nested inside component");let E=i==="ink-text"&&p.isInsideText?"ink-virtual-text":i,t=ss.createNode(E);for(let[k,L]of Object.entries(o))k!=="children"&&(k==="style"?ss.setStyle(t,L):k==="internal_transform"?t.internal_transform=L:k==="internal_static"?t.internal_static=!0:ss.setAttribute(t,k,L));return t},createTextInstance:(i,o,f)=>{if(!f.isInsideText)throw new Error(`Text string "${i}" must be rendered inside component`);return ss.createTextNode(i)},resetTextContent:()=>{},hideTextInstance:i=>{ss.setTextNodeValue(i,"")},unhideTextInstance:(i,o)=>{ss.setTextNodeValue(i,o)},getPublicInstance:i=>i,hideInstance:i=>{var o;(o=i.yogaNode)===null||o===void 0||o.setDisplay(_R.default.DISPLAY_NONE)},unhideInstance:i=>{var o;(o=i.yogaNode)===null||o===void 0||o.setDisplay(_R.default.DISPLAY_FLEX)},appendInitialChild:ss.appendChildNode,appendChild:ss.appendChildNode,insertBefore:ss.insertBeforeNode,finalizeInitialChildren:(i,o,f,p)=>(i.internal_static&&(p.isStaticDirty=!0,p.staticNode=i),!1),supportsMutation:!0,appendChildToContainer:ss.appendChildNode,insertInContainerBefore:ss.insertBeforeNode,removeChildFromContainer:(i,o)=>{ss.removeChildNode(i,o),ER(o.yogaNode)},prepareUpdate:(i,o,f,p,E)=>{i.internal_static&&(E.isStaticDirty=!0);let t={},k=Object.keys(p);for(let L of k)if(p[L]!==f[L]){if(L==="style"&&typeof p.style=="object"&&typeof f.style=="object"){let C=p.style,U=f.style,q=Object.keys(C);for(let W of q){if(W==="borderStyle"||W==="borderColor"){if(typeof t.style!="object"){let ne={};t.style=ne}t.style.borderStyle=C.borderStyle,t.style.borderColor=C.borderColor}if(C[W]!==U[W]){if(typeof t.style!="object"){let ne={};t.style=ne}t.style[W]=C[W]}}continue}t[L]=p[L]}return t},commitUpdate:(i,o)=>{for(let[f,p]of Object.entries(o))f!=="children"&&(f==="style"?ss.setStyle(i,p):f==="internal_transform"?i.internal_transform=p:f==="internal_static"?i.internal_static=!0:ss.setAttribute(i,f,p))},commitTextUpdate:(i,o,f)=>{ss.setTextNodeValue(i,f)},removeChild:(i,o)=>{ss.removeChildNode(i,o),ER(o.yogaNode)}})});var SR=ce((Are,wR)=>{"use strict";wR.exports=(i,o=1,f)=>{if(f=E0({indent:" ",includeEmptyLines:!1},f),typeof i!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof i}\``);if(typeof o!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof o}\``);if(typeof f.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof f.indent}\``);if(o===0)return i;let p=f.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return i.replace(p,f.indent.repeat(o))}});var TR=ce(Mg=>{"use strict";var tJ=Mg&&Mg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Mg,"__esModule",{value:!0});var k4=tJ(eh());Mg.default=i=>i.getComputedWidth()-i.getComputedPadding(k4.default.EDGE_LEFT)-i.getComputedPadding(k4.default.EDGE_RIGHT)-i.getComputedBorder(k4.default.EDGE_LEFT)-i.getComputedBorder(k4.default.EDGE_RIGHT)});var xR=ce((Ore,CR)=>{CR.exports={single:{topLeft:"\u250C",topRight:"\u2510",bottomRight:"\u2518",bottomLeft:"\u2514",vertical:"\u2502",horizontal:"\u2500"},double:{topLeft:"\u2554",topRight:"\u2557",bottomRight:"\u255D",bottomLeft:"\u255A",vertical:"\u2551",horizontal:"\u2550"},round:{topLeft:"\u256D",topRight:"\u256E",bottomRight:"\u256F",bottomLeft:"\u2570",vertical:"\u2502",horizontal:"\u2500"},bold:{topLeft:"\u250F",topRight:"\u2513",bottomRight:"\u251B",bottomLeft:"\u2517",vertical:"\u2503",horizontal:"\u2501"},singleDouble:{topLeft:"\u2553",topRight:"\u2556",bottomRight:"\u255C",bottomLeft:"\u2559",vertical:"\u2551",horizontal:"\u2500"},doubleSingle:{topLeft:"\u2552",topRight:"\u2555",bottomRight:"\u255B",bottomLeft:"\u2558",vertical:"\u2502",horizontal:"\u2550"},classic:{topLeft:"+",topRight:"+",bottomRight:"+",bottomLeft:"+",vertical:"|",horizontal:"-"}}});var RR=ce((kre,Zw)=>{"use strict";var AR=xR();Zw.exports=AR;Zw.exports.default=AR});var kR=ce((Mre,OR)=>{"use strict";OR.exports=(i,o=process.argv)=>{let f=i.startsWith("-")?"":i.length===1?"-":"--",p=o.indexOf(f+i),E=o.indexOf("--");return p!==-1&&(E===-1||p{"use strict";var nJ=require("os"),NR=require("tty"),of=kR(),{env:Wo}=process,md;of("no-color")||of("no-colors")||of("color=false")||of("color=never")?md=0:(of("color")||of("colors")||of("color=true")||of("color=always"))&&(md=1);"FORCE_COLOR"in Wo&&(Wo.FORCE_COLOR==="true"?md=1:Wo.FORCE_COLOR==="false"?md=0:md=Wo.FORCE_COLOR.length===0?1:Math.min(parseInt(Wo.FORCE_COLOR,10),3));function $w(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function e3(i,o){if(md===0)return 0;if(of("color=16m")||of("color=full")||of("color=truecolor"))return 3;if(of("color=256"))return 2;if(i&&!o&&md===void 0)return 0;let f=md||0;if(Wo.TERM==="dumb")return f;if(process.platform==="win32"){let p=nJ.release().split(".");return Number(p[0])>=10&&Number(p[2])>=10586?Number(p[2])>=14931?3:2:1}if("CI"in Wo)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(p=>p in Wo)||Wo.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in Wo)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Wo.TEAMCITY_VERSION)?1:0;if("GITHUB_ACTIONS"in Wo)return 1;if(Wo.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Wo){let p=parseInt((Wo.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Wo.TERM_PROGRAM){case"iTerm.app":return p>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Wo.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Wo.TERM)||"COLORTERM"in Wo?1:f}function rJ(i){let o=e3(i,i&&i.isTTY);return $w(o)}MR.exports={supportsColor:rJ,stdout:$w(e3(!0,NR.isatty(1))),stderr:$w(e3(!0,NR.isatty(2)))}});var bR=ce((Lre,FR)=>{"use strict";var iJ=(i,o,f)=>{let p=i.indexOf(o);if(p===-1)return i;let E=o.length,t=0,k="";do k+=i.substr(t,p-t)+o+f,t=p+E,p=i.indexOf(o,t);while(p!==-1);return k+=i.substr(t),k},uJ=(i,o,f,p)=>{let E=0,t="";do{let k=i[p-1]==="\r";t+=i.substr(E,(k?p-1:p)-E)+o+(k?`\r +`:` +`)+f,E=p+1,p=i.indexOf(` +`,E)}while(p!==-1);return t+=i.substr(E),t};FR.exports={stringReplaceAll:iJ,stringEncaseCRLFWithFirstIndex:uJ}});var jR=ce((Fre,PR)=>{"use strict";var oJ=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,IR=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,lJ=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,sJ=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,aJ=new Map([["n",` +`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a","\x07"]]);function BR(i){let o=i[0]==="u",f=i[1]==="{";return o&&!f&&i.length===5||i[0]==="x"&&i.length===3?String.fromCharCode(parseInt(i.slice(1),16)):o&&f?String.fromCodePoint(parseInt(i.slice(2,-1),16)):aJ.get(i)||i}function fJ(i,o){let f=[],p=o.trim().split(/\s*,\s*/g),E;for(let t of p){let k=Number(t);if(!Number.isNaN(k))f.push(k);else if(E=t.match(lJ))f.push(E[2].replace(sJ,(L,N,C)=>N?BR(N):C));else throw new Error(`Invalid Chalk template style argument: ${t} (in style '${i}')`)}return f}function cJ(i){IR.lastIndex=0;let o=[],f;for(;(f=IR.exec(i))!==null;){let p=f[1];if(f[2]){let E=fJ(p,f[2]);o.push([p].concat(E))}else o.push([p])}return o}function UR(i,o){let f={};for(let E of o)for(let t of E.styles)f[t[0]]=E.inverse?null:t.slice(1);let p=i;for(let[E,t]of Object.entries(f))if(!!Array.isArray(t)){if(!(E in p))throw new Error(`Unknown Chalk style: ${E}`);p=t.length>0?p[E](...t):p[E]}return p}PR.exports=(i,o)=>{let f=[],p=[],E=[];if(o.replace(oJ,(t,k,L,N,C,U)=>{if(k)E.push(BR(k));else if(N){let q=E.join("");E=[],p.push(f.length===0?q:UR(i,f)(q)),f.push({inverse:L,styles:cJ(N)})}else if(C){if(f.length===0)throw new Error("Found extraneous } in Chalk template literal");p.push(UR(i,f)(E.join(""))),E=[],f.pop()}else E.push(U)}),p.push(E.join("")),f.length>0){let t=`Chalk template literal is missing ${f.length} closing bracket${f.length===1?"":"s"} (\`}\`)`;throw new Error(t)}return p.join("")}});var u3=ce((bre,zR)=>{"use strict";var Ng=_4(),{stdout:t3,stderr:n3}=LR(),{stringReplaceAll:dJ,stringEncaseCRLFWithFirstIndex:pJ}=bR(),{isArray:M4}=Array,qR=["ansi","ansi","ansi256","ansi16m"],cm=Object.create(null),hJ=(i,o={})=>{if(o.level&&!(Number.isInteger(o.level)&&o.level>=0&&o.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let f=t3?t3.level:0;i.level=o.level===void 0?f:o.level},HR=class{constructor(o){return WR(o)}},WR=i=>{let o={};return hJ(o,i),o.template=(...f)=>VR(o.template,...f),Object.setPrototypeOf(o,N4.prototype),Object.setPrototypeOf(o.template,o),o.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},o.template.Instance=HR,o.template};function N4(i){return WR(i)}for(let[i,o]of Object.entries(Ng))cm[i]={get(){let f=L4(this,r3(o.open,o.close,this._styler),this._isEmpty);return Object.defineProperty(this,i,{value:f}),f}};cm.visible={get(){let i=L4(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:i}),i}};var GR=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let i of GR)cm[i]={get(){let{level:o}=this;return function(...f){let p=r3(Ng.color[qR[o]][i](...f),Ng.color.close,this._styler);return L4(this,p,this._isEmpty)}}};for(let i of GR){let o="bg"+i[0].toUpperCase()+i.slice(1);cm[o]={get(){let{level:f}=this;return function(...p){let E=r3(Ng.bgColor[qR[f]][i](...p),Ng.bgColor.close,this._styler);return L4(this,E,this._isEmpty)}}}}var vJ=Object.defineProperties(()=>{},Gf(E0({},cm),{level:{enumerable:!0,get(){return this._generator.level},set(i){this._generator.level=i}}})),r3=(i,o,f)=>{let p,E;return f===void 0?(p=i,E=o):(p=f.openAll+i,E=o+f.closeAll),{open:i,close:o,openAll:p,closeAll:E,parent:f}},L4=(i,o,f)=>{let p=(...E)=>M4(E[0])&&M4(E[0].raw)?YR(p,VR(p,...E)):YR(p,E.length===1?""+E[0]:E.join(" "));return Object.setPrototypeOf(p,vJ),p._generator=i,p._styler=o,p._isEmpty=f,p},YR=(i,o)=>{if(i.level<=0||!o)return i._isEmpty?"":o;let f=i._styler;if(f===void 0)return o;let{openAll:p,closeAll:E}=f;if(o.indexOf("")!==-1)for(;f!==void 0;)o=dJ(o,f.close,f.open),f=f.parent;let t=o.indexOf(` +`);return t!==-1&&(o=pJ(o,E,p,t)),p+o+E},i3,VR=(i,...o)=>{let[f]=o;if(!M4(f)||!M4(f.raw))return o.join(" ");let p=o.slice(1),E=[f.raw[0]];for(let t=1;t{"use strict";var mJ=Lg&&Lg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Lg,"__esModule",{value:!0});var Fg=mJ(u3()),yJ=/^(rgb|hsl|hsv|hwb)\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,gJ=/^(ansi|ansi256)\(\s?(\d+)\s?\)$/,b4=(i,o)=>o==="foreground"?i:"bg"+i[0].toUpperCase()+i.slice(1);Lg.default=(i,o,f)=>{if(!o)return i;if(o in Fg.default){let E=b4(o,f);return Fg.default[E](i)}if(o.startsWith("#")){let E=b4("hex",f);return Fg.default[E](o)(i)}if(o.startsWith("ansi")){let E=gJ.exec(o);if(!E)return i;let t=b4(E[1],f),k=Number(E[2]);return Fg.default[t](k)(i)}if(o.startsWith("rgb")||o.startsWith("hsl")||o.startsWith("hsv")||o.startsWith("hwb")){let E=yJ.exec(o);if(!E)return i;let t=b4(E[1],f),k=Number(E[2]),L=Number(E[3]),N=Number(E[4]);return Fg.default[t](k,L,N)(i)}return i}});var XR=ce(bg=>{"use strict";var KR=bg&&bg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(bg,"__esModule",{value:!0});var _J=KR(RR()),l3=KR(o3());bg.default=(i,o,f,p)=>{if(typeof f.style.borderStyle=="string"){let E=f.yogaNode.getComputedWidth(),t=f.yogaNode.getComputedHeight(),k=f.style.borderColor,L=_J.default[f.style.borderStyle],N=l3.default(L.topLeft+L.horizontal.repeat(E-2)+L.topRight,k,"foreground"),C=(l3.default(L.vertical,k,"foreground")+` +`).repeat(t-2),U=l3.default(L.bottomLeft+L.horizontal.repeat(E-2)+L.bottomRight,k,"foreground");p.write(i,o,N,{transformers:[]}),p.write(i,o+1,C,{transformers:[]}),p.write(i+E-1,o+1,C,{transformers:[]}),p.write(i,o+t-1,U,{transformers:[]})}}});var JR=ce(Pg=>{"use strict";var ih=Pg&&Pg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Pg,"__esModule",{value:!0});var EJ=ih(eh()),DJ=ih(Dw()),wJ=ih(SR()),SJ=ih(kw()),TJ=ih(TR()),CJ=ih(Nw()),xJ=ih(XR()),AJ=(i,o)=>{var f;let p=(f=i.childNodes[0])===null||f===void 0?void 0:f.yogaNode;if(p){let E=p.getComputedLeft(),t=p.getComputedTop();o=` +`.repeat(t)+wJ.default(o,E)}return o},QR=(i,o,f)=>{var p;let{offsetX:E=0,offsetY:t=0,transformers:k=[],skipStaticElements:L}=f;if(L&&i.internal_static)return;let{yogaNode:N}=i;if(N){if(N.getDisplay()===EJ.default.DISPLAY_NONE)return;let C=E+N.getComputedLeft(),U=t+N.getComputedTop(),q=k;if(typeof i.internal_transform=="function"&&(q=[i.internal_transform,...k]),i.nodeName==="ink-text"){let W=CJ.default(i);if(W.length>0){let ne=DJ.default(W),m=TJ.default(N);if(ne>m){let we=(p=i.style.textWrap)!==null&&p!==void 0?p:"wrap";W=SJ.default(W,m,we)}W=AJ(i,W),o.write(C,U,W,{transformers:q})}return}if(i.nodeName==="ink-box"&&xJ.default(C,U,i,o),i.nodeName==="ink-root"||i.nodeName==="ink-box")for(let W of i.childNodes)QR(W,o,{offsetX:C,offsetY:U,transformers:q,skipStaticElements:L})}};Pg.default=QR});var $R=ce((Ure,ZR)=>{"use strict";ZR.exports=i=>{i=Object.assign({onlyFirst:!1},i);let o=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(o,i.onlyFirst?void 0:"g")}});var t7=ce((jre,s3)=>{"use strict";var RJ=$R(),e7=i=>typeof i=="string"?i.replace(RJ(),""):i;s3.exports=e7;s3.exports.default=e7});var i7=ce((zre,n7)=>{"use strict";var r7="[\uD800-\uDBFF][\uDC00-\uDFFF]";n7.exports=i=>i&&i.exact?new RegExp(`^${r7}$`):new RegExp(r7,"g")});var o7=ce((qre,a3)=>{"use strict";var OJ=t7(),kJ=i7(),u7=i=>OJ(i).replace(kJ()," ").length;a3.exports=u7;a3.exports.default=u7});var f7=ce(Ig=>{"use strict";var l7=Ig&&Ig.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ig,"__esModule",{value:!0});var s7=l7(Rw()),MJ=l7(o7()),a7=class{constructor(o){this.writes=[];let{width:f,height:p}=o;this.width=f,this.height=p}write(o,f,p,E){let{transformers:t}=E;!p||this.writes.push({x:o,y:f,text:p,transformers:t})}get(){let o=[];for(let p=0;pp.trimRight()).join(` +`),height:o.length}}};Ig.default=a7});var p7=ce(Bg=>{"use strict";var f3=Bg&&Bg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Bg,"__esModule",{value:!0});var NJ=f3(eh()),c7=f3(JR()),d7=f3(f7());Bg.default=(i,o)=>{var f;if(i.yogaNode.setWidth(o),i.yogaNode){i.yogaNode.calculateLayout(void 0,void 0,NJ.default.DIRECTION_LTR);let p=new d7.default({width:i.yogaNode.getComputedWidth(),height:i.yogaNode.getComputedHeight()});c7.default(i,p,{skipStaticElements:!0});let E;((f=i.staticNode)===null||f===void 0?void 0:f.yogaNode)&&(E=new d7.default({width:i.staticNode.yogaNode.getComputedWidth(),height:i.staticNode.yogaNode.getComputedHeight()}),c7.default(i.staticNode,E,{skipStaticElements:!1}));let{output:t,height:k}=p.get();return{output:t,outputHeight:k,staticOutput:E?`${E.get().output} +`:""}}return{output:"",outputHeight:0,staticOutput:""}}});var y7=ce((Vre,h7)=>{"use strict";var v7=require("stream"),m7=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],c3={},LJ=i=>{let o=new v7.PassThrough,f=new v7.PassThrough;o.write=E=>i("stdout",E),f.write=E=>i("stderr",E);let p=new console.Console(o,f);for(let E of m7)c3[E]=console[E],console[E]=p[E];return()=>{for(let E of m7)console[E]=c3[E];c3={}}};h7.exports=LJ});var p3=ce(d3=>{"use strict";Object.defineProperty(d3,"__esModule",{value:!0});d3.default=new WeakMap});var v3=ce(h3=>{"use strict";Object.defineProperty(h3,"__esModule",{value:!0});var FJ=su(),g7=FJ.createContext({exit:()=>{}});g7.displayName="InternalAppContext";h3.default=g7});var y3=ce(m3=>{"use strict";Object.defineProperty(m3,"__esModule",{value:!0});var bJ=su(),_7=bJ.createContext({stdin:void 0,setRawMode:()=>{},isRawModeSupported:!1,internal_exitOnCtrlC:!0});_7.displayName="InternalStdinContext";m3.default=_7});var _3=ce(g3=>{"use strict";Object.defineProperty(g3,"__esModule",{value:!0});var PJ=su(),E7=PJ.createContext({stdout:void 0,write:()=>{}});E7.displayName="InternalStdoutContext";g3.default=E7});var D3=ce(E3=>{"use strict";Object.defineProperty(E3,"__esModule",{value:!0});var IJ=su(),D7=IJ.createContext({stderr:void 0,write:()=>{}});D7.displayName="InternalStderrContext";E3.default=D7});var P4=ce(w3=>{"use strict";Object.defineProperty(w3,"__esModule",{value:!0});var BJ=su(),w7=BJ.createContext({activeId:void 0,add:()=>{},remove:()=>{},activate:()=>{},deactivate:()=>{},enableFocus:()=>{},disableFocus:()=>{},focusNext:()=>{},focusPrevious:()=>{}});w7.displayName="InternalFocusContext";w3.default=w7});var T7=ce((Zre,S7)=>{"use strict";var UJ=/[|\\{}()[\]^$+*?.-]/g;S7.exports=i=>{if(typeof i!="string")throw new TypeError("Expected a string");return i.replace(UJ,"\\$&")}});var R7=ce(($re,C7)=>{"use strict";var jJ=T7(),x7=[].concat(require("module").builtinModules,"bootstrap_node","node").map(i=>new RegExp(`(?:\\(${i}\\.js:\\d+:\\d+\\)$|^\\s*at ${i}\\.js:\\d+:\\d+$)`));x7.push(/\(internal\/[^:]+:\d+:\d+\)$/,/\s*at internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var I4=class{constructor(o){o=E0({ignoredPackages:[]},o),"internals"in o||(o.internals=I4.nodeInternals()),"cwd"in o||(o.cwd=process.cwd()),this._cwd=o.cwd.replace(/\\/g,"/"),this._internals=[].concat(o.internals,zJ(o.ignoredPackages)),this._wrapCallSite=o.wrapCallSite||!1}static nodeInternals(){return[...x7]}clean(o,f=0){f=" ".repeat(f),Array.isArray(o)||(o=o.split(` +`)),!/^\s*at /.test(o[0])&&/^\s*at /.test(o[1])&&(o=o.slice(1));let p=!1,E=null,t=[];return o.forEach(k=>{if(k=k.replace(/\\/g,"/"),this._internals.some(N=>N.test(k)))return;let L=/^\s*at /.test(k);p?k=k.trimEnd().replace(/^(\s+)at /,"$1"):(k=k.trim(),L&&(k=k.slice(3))),k=k.replace(`${this._cwd}/`,""),k&&(L?(E&&(t.push(E),E=null),t.push(k)):(p=!0,E=k))}),t.map(k=>`${f}${k} +`).join("")}captureString(o,f=this.captureString){typeof o=="function"&&(f=o,o=Infinity);let{stackTraceLimit:p}=Error;o&&(Error.stackTraceLimit=o);let E={};Error.captureStackTrace(E,f);let{stack:t}=E;return Error.stackTraceLimit=p,this.clean(t)}capture(o,f=this.capture){typeof o=="function"&&(f=o,o=Infinity);let{prepareStackTrace:p,stackTraceLimit:E}=Error;Error.prepareStackTrace=(L,N)=>this._wrapCallSite?N.map(this._wrapCallSite):N,o&&(Error.stackTraceLimit=o);let t={};Error.captureStackTrace(t,f);let{stack:k}=t;return Object.assign(Error,{prepareStackTrace:p,stackTraceLimit:E}),k}at(o=this.at){let[f]=this.capture(1,o);if(!f)return{};let p={line:f.getLineNumber(),column:f.getColumnNumber()};A7(p,f.getFileName(),this._cwd),f.isConstructor()&&(p.constructor=!0),f.isEval()&&(p.evalOrigin=f.getEvalOrigin()),f.isNative()&&(p.native=!0);let E;try{E=f.getTypeName()}catch(L){}E&&E!=="Object"&&E!=="[object Object]"&&(p.type=E);let t=f.getFunctionName();t&&(p.function=t);let k=f.getMethodName();return k&&t!==k&&(p.method=k),p}parseLine(o){let f=o&&o.match(qJ);if(!f)return null;let p=f[1]==="new",E=f[2],t=f[3],k=f[4],L=Number(f[5]),N=Number(f[6]),C=f[7],U=f[8],q=f[9],W=f[10]==="native",ne=f[11]===")",m,we={};if(U&&(we.line=Number(U)),q&&(we.column=Number(q)),ne&&C){let Se=0;for(let he=C.length-1;he>0;he--)if(C.charAt(he)===")")Se++;else if(C.charAt(he)==="("&&C.charAt(he-1)===" "&&(Se--,Se===-1&&C.charAt(he-1)===" ")){let ge=C.slice(0,he-1);C=C.slice(he+1),E+=` (${ge}`;break}}if(E){let Se=E.match(HJ);Se&&(E=Se[1],m=Se[2])}return A7(we,C,this._cwd),p&&(we.constructor=!0),t&&(we.evalOrigin=t,we.evalLine=L,we.evalColumn=N,we.evalFile=k&&k.replace(/\\/g,"/")),W&&(we.native=!0),E&&(we.function=E),m&&E!==m&&(we.method=m),we}};function A7(i,o,f){o&&(o=o.replace(/\\/g,"/"),o.startsWith(`${f}/`)&&(o=o.slice(f.length+1)),i.file=o)}function zJ(i){if(i.length===0)return[];let o=i.map(f=>jJ(f));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${o.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var qJ=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),HJ=/^(.*?) \[as (.*?)\]$/;C7.exports=I4});var k7=ce((eie,O7)=>{"use strict";O7.exports=(i,o)=>i.replace(/^\t+/gm,f=>" ".repeat(f.length*(o||2)))});var N7=ce((tie,M7)=>{"use strict";var WJ=k7(),VJ=(i,o)=>{let f=[],p=i-o,E=i+o;for(let t=p;t<=E;t++)f.push(t);return f};M7.exports=(i,o,f)=>{if(typeof i!="string")throw new TypeError("Source code is missing.");if(!o||o<1)throw new TypeError("Line number must start from `1`.");if(i=WJ(i).split(/\r?\n/),!(o>i.length))return f=E0({around:3},f),VJ(o,f.around).filter(p=>i[p-1]!==void 0).map(p=>({line:p,value:i[p-1]}))}});var B4=ce(Zf=>{"use strict";var GJ=Zf&&Zf.__createBinding||(Object.create?function(i,o,f,p){p===void 0&&(p=f),Object.defineProperty(i,p,{enumerable:!0,get:function(){return o[f]}})}:function(i,o,f,p){p===void 0&&(p=f),i[p]=o[f]}),YJ=Zf&&Zf.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),KJ=Zf&&Zf.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null)for(var f in i)f!=="default"&&Object.hasOwnProperty.call(i,f)&&GJ(o,i,f);return YJ(o,i),o},XJ=Zf&&Zf.__rest||function(i,o){var f={};for(var p in i)Object.prototype.hasOwnProperty.call(i,p)&&o.indexOf(p)<0&&(f[p]=i[p]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var E=0,p=Object.getOwnPropertySymbols(i);E{var{children:f}=i,p=XJ(i,["children"]);let E=Object.assign(Object.assign({},p),{marginLeft:p.marginLeft||p.marginX||p.margin||0,marginRight:p.marginRight||p.marginX||p.margin||0,marginTop:p.marginTop||p.marginY||p.margin||0,marginBottom:p.marginBottom||p.marginY||p.margin||0,paddingLeft:p.paddingLeft||p.paddingX||p.padding||0,paddingRight:p.paddingRight||p.paddingX||p.padding||0,paddingTop:p.paddingTop||p.paddingY||p.padding||0,paddingBottom:p.paddingBottom||p.paddingY||p.padding||0});return L7.default.createElement("ink-box",{ref:o,style:E},f)});S3.displayName="Box";S3.defaultProps={flexDirection:"row",flexGrow:0,flexShrink:1};Zf.default=S3});var x3=ce(Ug=>{"use strict";var T3=Ug&&Ug.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ug,"__esModule",{value:!0});var QJ=T3(su()),dm=T3(u3()),F7=T3(o3()),C3=({color:i,backgroundColor:o,dimColor:f,bold:p,italic:E,underline:t,strikethrough:k,inverse:L,wrap:N,children:C})=>{if(C==null)return null;let U=q=>(f&&(q=dm.default.dim(q)),i&&(q=F7.default(q,i,"foreground")),o&&(q=F7.default(q,o,"background")),p&&(q=dm.default.bold(q)),E&&(q=dm.default.italic(q)),t&&(q=dm.default.underline(q)),k&&(q=dm.default.strikethrough(q)),L&&(q=dm.default.inverse(q)),q);return QJ.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row",textWrap:N},internal_transform:U},C)};C3.displayName="Text";C3.defaultProps={dimColor:!1,bold:!1,italic:!1,underline:!1,strikethrough:!1,wrap:"wrap"};Ug.default=C3});var B7=ce($f=>{"use strict";var JJ=$f&&$f.__createBinding||(Object.create?function(i,o,f,p){p===void 0&&(p=f),Object.defineProperty(i,p,{enumerable:!0,get:function(){return o[f]}})}:function(i,o,f,p){p===void 0&&(p=f),i[p]=o[f]}),ZJ=$f&&$f.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),$J=$f&&$f.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null)for(var f in i)f!=="default"&&Object.hasOwnProperty.call(i,f)&&JJ(o,i,f);return ZJ(o,i),o},jg=$f&&$f.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty($f,"__esModule",{value:!0});var b7=$J(require("fs")),Vo=jg(su()),P7=jg(R7()),eZ=jg(N7()),Q1=jg(B4()),Ic=jg(x3()),I7=new P7.default({cwd:process.cwd(),internals:P7.default.nodeInternals()}),tZ=({error:i})=>{let o=i.stack?i.stack.split(` +`).slice(1):void 0,f=o?I7.parseLine(o[0]):void 0,p,E=0;if((f==null?void 0:f.file)&&(f==null?void 0:f.line)&&b7.existsSync(f.file)){let t=b7.readFileSync(f.file,"utf8");if(p=eZ.default(t,f.line),p)for(let{line:k}of p)E=Math.max(E,String(k).length)}return Vo.default.createElement(Q1.default,{flexDirection:"column",padding:1},Vo.default.createElement(Q1.default,null,Vo.default.createElement(Ic.default,{backgroundColor:"red",color:"white"}," ","ERROR"," "),Vo.default.createElement(Ic.default,null," ",i.message)),f&&Vo.default.createElement(Q1.default,{marginTop:1},Vo.default.createElement(Ic.default,{dimColor:!0},f.file,":",f.line,":",f.column)),f&&p&&Vo.default.createElement(Q1.default,{marginTop:1,flexDirection:"column"},p.map(({line:t,value:k})=>Vo.default.createElement(Q1.default,{key:t},Vo.default.createElement(Q1.default,{width:E+1},Vo.default.createElement(Ic.default,{dimColor:t!==f.line,backgroundColor:t===f.line?"red":void 0,color:t===f.line?"white":void 0},String(t).padStart(E," "),":")),Vo.default.createElement(Ic.default,{key:t,backgroundColor:t===f.line?"red":void 0,color:t===f.line?"white":void 0}," "+k)))),i.stack&&Vo.default.createElement(Q1.default,{marginTop:1,flexDirection:"column"},i.stack.split(` +`).slice(1).map(t=>{let k=I7.parseLine(t);return k?Vo.default.createElement(Q1.default,{key:t},Vo.default.createElement(Ic.default,{dimColor:!0},"- "),Vo.default.createElement(Ic.default,{dimColor:!0,bold:!0},k.function),Vo.default.createElement(Ic.default,{dimColor:!0,color:"gray"}," ","(",k.file,":",k.line,":",k.column,")")):Vo.default.createElement(Q1.default,{key:t},Vo.default.createElement(Ic.default,{dimColor:!0},"- "),Vo.default.createElement(Ic.default,{dimColor:!0,bold:!0},t))})))};$f.default=tZ});var j7=ce(ec=>{"use strict";var nZ=ec&&ec.__createBinding||(Object.create?function(i,o,f,p){p===void 0&&(p=f),Object.defineProperty(i,p,{enumerable:!0,get:function(){return o[f]}})}:function(i,o,f,p){p===void 0&&(p=f),i[p]=o[f]}),rZ=ec&&ec.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),iZ=ec&&ec.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null)for(var f in i)f!=="default"&&Object.hasOwnProperty.call(i,f)&&nZ(o,i,f);return rZ(o,i),o},uh=ec&&ec.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ec,"__esModule",{value:!0});var oh=iZ(su()),U7=uh(ZD()),uZ=uh(v3()),oZ=uh(y3()),lZ=uh(_3()),sZ=uh(D3()),aZ=uh(P4()),fZ=uh(B7()),cZ=" ",dZ="",pZ="",A3=class extends oh.PureComponent{constructor(){super(...arguments);this.state={isFocusEnabled:!0,activeFocusId:void 0,focusables:[],error:void 0},this.rawModeEnabledCount=0,this.handleSetRawMode=o=>{let{stdin:f}=this.props;if(!this.isRawModeSupported())throw f===process.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default. +Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink. +Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(f.setEncoding("utf8"),o){this.rawModeEnabledCount===0&&(f.addListener("data",this.handleInput),f.resume(),f.setRawMode(!0)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount==0&&(f.setRawMode(!1),f.removeListener("data",this.handleInput),f.pause())},this.handleInput=o=>{o===""&&this.props.exitOnCtrlC&&this.handleExit(),o===pZ&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(o===cZ&&this.focusNext(),o===dZ&&this.focusPrevious())},this.handleExit=o=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(o)},this.enableFocus=()=>{this.setState({isFocusEnabled:!0})},this.disableFocus=()=>{this.setState({isFocusEnabled:!1})},this.focusNext=()=>{this.setState(o=>{let f=o.focusables[0].id;return{activeFocusId:this.findNextFocusable(o)||f}})},this.focusPrevious=()=>{this.setState(o=>{let f=o.focusables[o.focusables.length-1].id;return{activeFocusId:this.findPreviousFocusable(o)||f}})},this.addFocusable=(o,{autoFocus:f})=>{this.setState(p=>{let E=p.activeFocusId;return!E&&f&&(E=o),{activeFocusId:E,focusables:[...p.focusables,{id:o,isActive:!0}]}})},this.removeFocusable=o=>{this.setState(f=>({activeFocusId:f.activeFocusId===o?void 0:f.activeFocusId,focusables:f.focusables.filter(p=>p.id!==o)}))},this.activateFocusable=o=>{this.setState(f=>({focusables:f.focusables.map(p=>p.id!==o?p:{id:o,isActive:!0})}))},this.deactivateFocusable=o=>{this.setState(f=>({activeFocusId:f.activeFocusId===o?void 0:f.activeFocusId,focusables:f.focusables.map(p=>p.id!==o?p:{id:o,isActive:!1})}))},this.findNextFocusable=o=>{let f=o.focusables.findIndex(p=>p.id===o.activeFocusId);for(let p=f+1;p{let f=o.focusables.findIndex(p=>p.id===o.activeFocusId);for(let p=f-1;p>=0;p--)if(o.focusables[p].isActive)return o.focusables[p].id}}static getDerivedStateFromError(o){return{error:o}}isRawModeSupported(){return this.props.stdin.isTTY}render(){return oh.default.createElement(uZ.default.Provider,{value:{exit:this.handleExit}},oh.default.createElement(oZ.default.Provider,{value:{stdin:this.props.stdin,setRawMode:this.handleSetRawMode,isRawModeSupported:this.isRawModeSupported(),internal_exitOnCtrlC:this.props.exitOnCtrlC}},oh.default.createElement(lZ.default.Provider,{value:{stdout:this.props.stdout,write:this.props.writeToStdout}},oh.default.createElement(sZ.default.Provider,{value:{stderr:this.props.stderr,write:this.props.writeToStderr}},oh.default.createElement(aZ.default.Provider,{value:{activeId:this.state.activeFocusId,add:this.addFocusable,remove:this.removeFocusable,activate:this.activateFocusable,deactivate:this.deactivateFocusable,enableFocus:this.enableFocus,disableFocus:this.disableFocus,focusNext:this.focusNext,focusPrevious:this.focusPrevious}},this.state.error?oh.default.createElement(fZ.default,{error:this.state.error}):this.props.children)))))}componentDidMount(){U7.default.hide(this.props.stdout)}componentWillUnmount(){U7.default.show(this.props.stdout),this.isRawModeSupported()&&this.handleSetRawMode(!1)}componentDidCatch(o){this.handleExit(o)}};ec.default=A3;A3.displayName="InternalApp"});var W7=ce(tc=>{"use strict";var hZ=tc&&tc.__createBinding||(Object.create?function(i,o,f,p){p===void 0&&(p=f),Object.defineProperty(i,p,{enumerable:!0,get:function(){return o[f]}})}:function(i,o,f,p){p===void 0&&(p=f),i[p]=o[f]}),vZ=tc&&tc.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),mZ=tc&&tc.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null)for(var f in i)f!=="default"&&Object.hasOwnProperty.call(i,f)&&hZ(o,i,f);return vZ(o,i),o},nc=tc&&tc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(tc,"__esModule",{value:!0});var yZ=nc(su()),z7=B5(),gZ=nc(Z5()),_Z=nc(GD()),EZ=nc(u9()),DZ=nc(l9()),U4=nc(DR()),wZ=nc(p7()),SZ=nc(JD()),TZ=nc(y7()),CZ=mZ(Lw()),xZ=nc(p3()),AZ=nc(j7()),pm=process.env.CI==="false"?!1:EZ.default,q7=()=>{},H7=class{constructor(o){this.resolveExitPromise=()=>{},this.rejectExitPromise=()=>{},this.unsubscribeExit=()=>{},this.onRender=()=>{if(this.isUnmounted)return;let{output:f,outputHeight:p,staticOutput:E}=wZ.default(this.rootNode,this.options.stdout.columns||80),t=E&&E!==` +`;if(this.options.debug){t&&(this.fullStaticOutput+=E),this.options.stdout.write(this.fullStaticOutput+f);return}if(pm){t&&this.options.stdout.write(E),this.lastOutput=f;return}if(t&&(this.fullStaticOutput+=E),p>=this.options.stdout.rows){this.options.stdout.write(_Z.default.clearTerminal+this.fullStaticOutput+f),this.lastOutput=f;return}t&&(this.log.clear(),this.options.stdout.write(E),this.log(f)),!t&&f!==this.lastOutput&&this.throttledLog(f),this.lastOutput=f},DZ.default(this),this.options=o,this.rootNode=CZ.createNode("ink-root"),this.rootNode.onRender=o.debug?this.onRender:z7.throttle(this.onRender,32,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=gZ.default.create(o.stdout),this.throttledLog=o.debug?this.log:z7.throttle(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.fullStaticOutput="",this.container=U4.default.createContainer(this.rootNode,!1,!1),this.unsubscribeExit=SZ.default(this.unmount,{alwaysLast:!1}),process.env.DEV==="true"&&U4.default.injectIntoDevTools({bundleType:0,version:"16.13.1",rendererPackageName:"ink"}),o.patchConsole&&this.patchConsole(),pm||(o.stdout.on("resize",this.onRender),this.unsubscribeResize=()=>{o.stdout.off("resize",this.onRender)})}render(o){let f=yZ.default.createElement(AZ.default,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,exitOnCtrlC:this.options.exitOnCtrlC,onExit:this.unmount},o);U4.default.updateContainer(f,this.container,null,q7)}writeToStdout(o){if(!this.isUnmounted){if(this.options.debug){this.options.stdout.write(o+this.fullStaticOutput+this.lastOutput);return}if(pm){this.options.stdout.write(o);return}this.log.clear(),this.options.stdout.write(o),this.log(this.lastOutput)}}writeToStderr(o){if(!this.isUnmounted){if(this.options.debug){this.options.stderr.write(o),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(pm){this.options.stderr.write(o);return}this.log.clear(),this.options.stderr.write(o),this.log(this.lastOutput)}}unmount(o){this.isUnmounted||(this.onRender(),this.unsubscribeExit(),typeof this.restoreConsole=="function"&&this.restoreConsole(),typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),pm?this.options.stdout.write(this.lastOutput+` +`):this.options.debug||this.log.done(),this.isUnmounted=!0,U4.default.updateContainer(null,this.container,null,q7),xZ.default.delete(this.options.stdout),o instanceof Error?this.rejectExitPromise(o):this.resolveExitPromise())}waitUntilExit(){return this.exitPromise||(this.exitPromise=new Promise((o,f)=>{this.resolveExitPromise=o,this.rejectExitPromise=f})),this.exitPromise}clear(){!pm&&!this.options.debug&&this.log.clear()}patchConsole(){this.options.debug||(this.restoreConsole=TZ.default((o,f)=>{o==="stdout"&&this.writeToStdout(f),o==="stderr"&&(f.startsWith("The above error occurred")||this.writeToStderr(f))}))}};tc.default=H7});var G7=ce(zg=>{"use strict";var V7=zg&&zg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(zg,"__esModule",{value:!0});var RZ=V7(W7()),j4=V7(p3()),OZ=require("stream"),NZ=(i,o)=>{let f=Object.assign({stdout:process.stdout,stdin:process.stdin,stderr:process.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0},kZ(o)),p=MZ(f.stdout,()=>new RZ.default(f));return p.render(i),{rerender:p.render,unmount:()=>p.unmount(),waitUntilExit:p.waitUntilExit,cleanup:()=>j4.default.delete(f.stdout),clear:p.clear}};zg.default=NZ;var kZ=(i={})=>i instanceof OZ.Stream?{stdout:i,stdin:process.stdin}:i,MZ=(i,o)=>{let f;return j4.default.has(i)?f=j4.default.get(i):(f=o(),j4.default.set(i,f)),f}});var K7=ce(J1=>{"use strict";var LZ=J1&&J1.__createBinding||(Object.create?function(i,o,f,p){p===void 0&&(p=f),Object.defineProperty(i,p,{enumerable:!0,get:function(){return o[f]}})}:function(i,o,f,p){p===void 0&&(p=f),i[p]=o[f]}),FZ=J1&&J1.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),bZ=J1&&J1.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null)for(var f in i)f!=="default"&&Object.hasOwnProperty.call(i,f)&&LZ(o,i,f);return FZ(o,i),o};Object.defineProperty(J1,"__esModule",{value:!0});var qg=bZ(su()),Y7=i=>{let{items:o,children:f,style:p}=i,[E,t]=qg.useState(0),k=qg.useMemo(()=>o.slice(E),[o,E]);qg.useLayoutEffect(()=>{t(o.length)},[o.length]);let L=k.map((C,U)=>f(C,E+U)),N=qg.useMemo(()=>Object.assign({position:"absolute",flexDirection:"column"},p),[p]);return qg.default.createElement("ink-box",{internal_static:!0,style:N},L)};Y7.displayName="Static";J1.default=Y7});var Q7=ce(Hg=>{"use strict";var PZ=Hg&&Hg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Hg,"__esModule",{value:!0});var IZ=PZ(su()),X7=({children:i,transform:o})=>i==null?null:IZ.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row"},internal_transform:o},i);X7.displayName="Transform";Hg.default=X7});var Z7=ce(Wg=>{"use strict";var BZ=Wg&&Wg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Wg,"__esModule",{value:!0});var UZ=BZ(su()),J7=({count:i=1})=>UZ.default.createElement("ink-text",null,` +`.repeat(i));J7.displayName="Newline";Wg.default=J7});var tO=ce(Vg=>{"use strict";var $7=Vg&&Vg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Vg,"__esModule",{value:!0});var jZ=$7(su()),zZ=$7(B4()),eO=()=>jZ.default.createElement(zZ.default,{flexGrow:1});eO.displayName="Spacer";Vg.default=eO});var z4=ce(Gg=>{"use strict";var qZ=Gg&&Gg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Gg,"__esModule",{value:!0});var HZ=su(),WZ=qZ(y3()),VZ=()=>HZ.useContext(WZ.default);Gg.default=VZ});var rO=ce(Yg=>{"use strict";var GZ=Yg&&Yg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Yg,"__esModule",{value:!0});var nO=su(),YZ=GZ(z4()),KZ=(i,o={})=>{let{stdin:f,setRawMode:p,internal_exitOnCtrlC:E}=YZ.default();nO.useEffect(()=>{if(o.isActive!==!1)return p(!0),()=>{p(!1)}},[o.isActive,p]),nO.useEffect(()=>{if(o.isActive===!1)return;let t=k=>{let L=String(k),N={upArrow:L==="",downArrow:L==="",leftArrow:L==="",rightArrow:L==="",pageDown:L==="[6~",pageUp:L==="[5~",return:L==="\r",escape:L==="",ctrl:!1,shift:!1,tab:L===" "||L==="",backspace:L==="\b",delete:L==="\x7F"||L==="[3~",meta:!1};L<=""&&!N.return&&(L=String.fromCharCode(L.charCodeAt(0)+"a".charCodeAt(0)-1),N.ctrl=!0),L.startsWith("")&&(L=L.slice(1),N.meta=!0);let C=L>="A"&&L<="Z",U=L>="\u0410"&&L<="\u042F";L.length===1&&(C||U)&&(N.shift=!0),N.tab&&L==="[Z"&&(N.shift=!0),(N.tab||N.backspace||N.delete)&&(L=""),(!(L==="c"&&N.ctrl)||!E)&&i(L,N)};return f==null||f.on("data",t),()=>{f==null||f.off("data",t)}},[o.isActive,f,E,i])};Yg.default=KZ});var iO=ce(Kg=>{"use strict";var XZ=Kg&&Kg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Kg,"__esModule",{value:!0});var QZ=su(),JZ=XZ(v3()),ZZ=()=>QZ.useContext(JZ.default);Kg.default=ZZ});var uO=ce(Xg=>{"use strict";var $Z=Xg&&Xg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Xg,"__esModule",{value:!0});var e$=su(),t$=$Z(_3()),n$=()=>e$.useContext(t$.default);Xg.default=n$});var oO=ce(Qg=>{"use strict";var r$=Qg&&Qg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Qg,"__esModule",{value:!0});var i$=su(),u$=r$(D3()),o$=()=>i$.useContext(u$.default);Qg.default=o$});var sO=ce(Jg=>{"use strict";var lO=Jg&&Jg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Jg,"__esModule",{value:!0});var Zg=su(),l$=lO(P4()),s$=lO(z4()),a$=({isActive:i=!0,autoFocus:o=!1}={})=>{let{isRawModeSupported:f,setRawMode:p}=s$.default(),{activeId:E,add:t,remove:k,activate:L,deactivate:N}=Zg.useContext(l$.default),C=Zg.useMemo(()=>Math.random().toString().slice(2,7),[]);return Zg.useEffect(()=>(t(C,{autoFocus:o}),()=>{k(C)}),[C,o]),Zg.useEffect(()=>{i?L(C):N(C)},[i,C]),Zg.useEffect(()=>{if(!(!f||!i))return p(!0),()=>{p(!1)}},[i]),{isFocused:Boolean(C)&&E===C}};Jg.default=a$});var aO=ce($g=>{"use strict";var f$=$g&&$g.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty($g,"__esModule",{value:!0});var c$=su(),d$=f$(P4()),p$=()=>{let i=c$.useContext(d$.default);return{enableFocus:i.enableFocus,disableFocus:i.disableFocus,focusNext:i.focusNext,focusPrevious:i.focusPrevious}};$g.default=p$});var fO=ce(R3=>{"use strict";Object.defineProperty(R3,"__esModule",{value:!0});R3.default=i=>{var o,f,p,E;return{width:(f=(o=i.yogaNode)===null||o===void 0?void 0:o.getComputedWidth())!==null&&f!==void 0?f:0,height:(E=(p=i.yogaNode)===null||p===void 0?void 0:p.getComputedHeight())!==null&&E!==void 0?E:0}}});var lh=ce(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});var h$=G7();Object.defineProperty(ql,"render",{enumerable:!0,get:function(){return h$.default}});var v$=B4();Object.defineProperty(ql,"Box",{enumerable:!0,get:function(){return v$.default}});var m$=x3();Object.defineProperty(ql,"Text",{enumerable:!0,get:function(){return m$.default}});var y$=K7();Object.defineProperty(ql,"Static",{enumerable:!0,get:function(){return y$.default}});var g$=Q7();Object.defineProperty(ql,"Transform",{enumerable:!0,get:function(){return g$.default}});var _$=Z7();Object.defineProperty(ql,"Newline",{enumerable:!0,get:function(){return _$.default}});var E$=tO();Object.defineProperty(ql,"Spacer",{enumerable:!0,get:function(){return E$.default}});var D$=rO();Object.defineProperty(ql,"useInput",{enumerable:!0,get:function(){return D$.default}});var w$=iO();Object.defineProperty(ql,"useApp",{enumerable:!0,get:function(){return w$.default}});var S$=z4();Object.defineProperty(ql,"useStdin",{enumerable:!0,get:function(){return S$.default}});var T$=uO();Object.defineProperty(ql,"useStdout",{enumerable:!0,get:function(){return T$.default}});var C$=oO();Object.defineProperty(ql,"useStderr",{enumerable:!0,get:function(){return C$.default}});var x$=sO();Object.defineProperty(ql,"useFocus",{enumerable:!0,get:function(){return x$.default}});var A$=aO();Object.defineProperty(ql,"useFocusManager",{enumerable:!0,get:function(){return A$.default}});var R$=fO();Object.defineProperty(ql,"measureElement",{enumerable:!0,get:function(){return R$.default}})});var k$={};sS(k$,{default:()=>N$,versionUtils:()=>RD});var M3=Mi(require("@yarnpkg/core"));var X_=Mi(require("@yarnpkg/cli")),em=Mi(require("@yarnpkg/core")),Q_=Mi(require("@yarnpkg/core")),cd=Mi(require("clipanion"));var RD={};sS(RD,{Decision:()=>Nu,applyPrerelease:()=>v5,applyReleases:()=>ND,applyStrategy:()=>Y_,clearVersionFiles:()=>OD,fetchBase:()=>pK,fetchChangedFiles:()=>vK,fetchRoot:()=>hK,getUndecidedDependentWorkspaces:()=>Zy,getUndecidedWorkspaces:()=>K_,openVersionFile:()=>$v,requireMoreDecisions:()=>yK,resolveVersionFiles:()=>Jy,suggestStrategy:()=>MD,updateVersionFiles:()=>kD,validateReleaseDecision:()=>Zv});var Gi=Mi(require("@yarnpkg/core")),D0=Mi(require("@yarnpkg/fslib")),W1=Mi(require("@yarnpkg/parsers")),Zp=Mi(require("@yarnpkg/plugin-git")),Jv=Mi(require("clipanion")),h5=Mi(p5()),Fc=Mi(require("semver")),pK=Zp.gitUtils.fetchBase,hK=Zp.gitUtils.fetchRoot,vK=Zp.gitUtils.fetchChangedFiles,mK=/^(>=|[~^]|)(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/,Nu;(function(k){k.UNDECIDED="undecided",k.DECLINE="decline",k.MAJOR="major",k.MINOR="minor",k.PATCH="patch",k.PRERELEASE="prerelease"})(Nu||(Nu={}));function Zv(i){let o=Fc.default.valid(i);return o||Gi.miscUtils.validateEnum((0,h5.default)(Nu,"UNDECIDED"),i)}async function Jy(i,{prerelease:o=null}={}){var t;let f=new Map,p=i.configuration.get("deferredVersionFolder");if(!D0.xfs.existsSync(p))return new Map;let E=await D0.xfs.readdirPromise(p);for(let k of E){if(!k.endsWith(".yml"))continue;let L=D0.ppath.join(p,k),N=await D0.xfs.readFilePromise(L,"utf8"),C=(0,W1.parseSyml)(N);for(let[U,q]of Object.entries(C.releases||{})){if(q===Nu.DECLINE)continue;let W=Gi.structUtils.parseIdent(U),ne=i.tryWorkspaceByIdent(W);if(ne===null)throw new Error(`Assertion failed: Expected a release definition file to only reference existing workspaces (${D0.ppath.basename(L)} references ${U})`);if(ne.manifest.version===null)throw new Error(`Assertion failed: Expected the workspace to have a version (${Gi.structUtils.prettyLocator(i.configuration,ne.anchoredLocator)})`);let m=(t=ne.manifest.raw.stableVersion)!=null?t:ne.manifest.version,we=f.get(ne),Se=Y_(m,Zv(q));if(Se===null)throw new Error(`Assertion failed: Expected ${m} to support being bumped via strategy ${q}`);let he=typeof we!="undefined"?Fc.default.gt(Se,we)?Se:we:Se;f.set(ne,he)}}return o&&(f=new Map([...f].map(([k,L])=>[k,v5(L,{current:k.manifest.version,prerelease:o})]))),f}async function OD(i){let o=i.configuration.get("deferredVersionFolder");!D0.xfs.existsSync(o)||await D0.xfs.removePromise(o)}async function kD(i){let o=i.configuration.get("deferredVersionFolder");if(!D0.xfs.existsSync(o))return;let f=await D0.xfs.readdirPromise(o);for(let p of f){if(!p.endsWith(".yml"))continue;let E=D0.ppath.join(o,p),t=await D0.xfs.readFilePromise(E,"utf8"),k=(0,W1.parseSyml)(t),L=k==null?void 0:k.releases;if(!!L){for(let N of Object.keys(L)){let C=Gi.structUtils.parseLocator(N);i.tryWorkspaceByLocator(C)===null&&delete k.releases[N]}await D0.xfs.changeFilePromise(E,(0,W1.stringifySyml)(new W1.stringifySyml.PreserveOrdering(k)))}}}async function $v(i,{allowEmpty:o=!1}={}){let f=i.configuration;if(f.projectCwd===null)throw new Jv.UsageError("This command can only be run from within a Yarn project");let p=await Zp.gitUtils.fetchRoot(f.projectCwd),E=p!==null?await Zp.gitUtils.fetchBase(p,{baseRefs:f.get("changesetBaseRefs")}):null,t=p!==null?await Zp.gitUtils.fetchChangedFiles(p,{base:E.hash,project:i}):[],k=f.get("deferredVersionFolder"),L=t.filter(ne=>D0.ppath.contains(k,ne)!==null);if(L.length>1)throw new Jv.UsageError(`Your current branch contains multiple versioning files; this isn't supported: +- ${L.map(ne=>D0.npath.fromPortablePath(ne)).join(` +- `)}`);let N=new Set(Gi.miscUtils.mapAndFilter(t,ne=>{let m=i.tryWorkspaceByFilePath(ne);return m===null?Gi.miscUtils.mapAndFilter.skip:m}));if(L.length===0&&N.size===0&&!o)return null;let C=L.length===1?L[0]:D0.ppath.join(k,`${Gi.hashUtils.makeHash(Math.random().toString()).slice(0,8)}.yml`),U=D0.xfs.existsSync(C)?await D0.xfs.readFilePromise(C,"utf8"):"{}",q=(0,W1.parseSyml)(U),W=new Map;for(let ne of q.declined||[]){let m=Gi.structUtils.parseIdent(ne),we=i.getWorkspaceByIdent(m);W.set(we,Nu.DECLINE)}for(let[ne,m]of Object.entries(q.releases||{})){let we=Gi.structUtils.parseIdent(ne),Se=i.getWorkspaceByIdent(we);W.set(Se,Zv(m))}return{project:i,root:p,baseHash:E!==null?E.hash:null,baseTitle:E!==null?E.title:null,changedFiles:new Set(t),changedWorkspaces:N,releaseRoots:new Set([...N].filter(ne=>ne.manifest.version!==null)),releases:W,async saveAll(){let ne={},m=[],we=[];for(let Se of i.workspaces){if(Se.manifest.version===null)continue;let he=Gi.structUtils.stringifyIdent(Se.locator),ge=W.get(Se);ge===Nu.DECLINE?m.push(he):typeof ge!="undefined"?ne[he]=Zv(ge):N.has(Se)&&we.push(he)}await D0.xfs.mkdirPromise(D0.ppath.dirname(C),{recursive:!0}),await D0.xfs.changeFilePromise(C,(0,W1.stringifySyml)(new W1.stringifySyml.PreserveOrdering({releases:Object.keys(ne).length>0?ne:void 0,declined:m.length>0?m:void 0,undecided:we.length>0?we:void 0})))}}}function yK(i){return K_(i).size>0||Zy(i).length>0}function K_(i){let o=new Set;for(let f of i.changedWorkspaces)f.manifest.version!==null&&(i.releases.has(f)||o.add(f));return o}function Zy(i,{include:o=new Set}={}){let f=[],p=new Map(Gi.miscUtils.mapAndFilter([...i.releases],([t,k])=>k===Nu.DECLINE?Gi.miscUtils.mapAndFilter.skip:[t.anchoredLocator.locatorHash,t])),E=new Map(Gi.miscUtils.mapAndFilter([...i.releases],([t,k])=>k!==Nu.DECLINE?Gi.miscUtils.mapAndFilter.skip:[t.anchoredLocator.locatorHash,t]));for(let t of i.project.workspaces)if(!(!o.has(t)&&(E.has(t.anchoredLocator.locatorHash)||p.has(t.anchoredLocator.locatorHash)))&&t.manifest.version!==null)for(let k of Gi.Manifest.hardDependencies)for(let L of t.manifest.getForScope(k).values()){let N=i.project.tryWorkspaceByDescriptor(L);N!==null&&p.has(N.anchoredLocator.locatorHash)&&f.push([t,N])}return f}function MD(i,o){let f=Fc.default.clean(o);for(let p of Object.values(Nu))if(p!==Nu.UNDECIDED&&p!==Nu.DECLINE&&Fc.default.inc(i,p)===f)return p;return null}function Y_(i,o){if(Fc.default.valid(o))return o;if(i===null)throw new Jv.UsageError(`Cannot apply the release strategy "${o}" unless the workspace already has a valid version`);if(!Fc.default.valid(i))throw new Jv.UsageError(`Cannot apply the release strategy "${o}" on a non-semver version (${i})`);let f=Fc.default.inc(i,o);if(f===null)throw new Jv.UsageError(`Cannot apply the release strategy "${o}" on the specified version (${i})`);return f}function ND(i,o,{report:f}){let p=new Map;for(let E of i.workspaces)for(let t of Gi.Manifest.allDependencies)for(let k of E.manifest[t].values()){let L=i.tryWorkspaceByDescriptor(k);if(L===null||!o.has(L))continue;Gi.miscUtils.getArrayWithDefault(p,L).push([E,t,k.identHash])}for(let[E,t]of o){let k=E.manifest.version;E.manifest.version=t,Fc.default.prerelease(t)===null?delete E.manifest.raw.stableVersion:E.manifest.raw.stableVersion||(E.manifest.raw.stableVersion=k);let L=E.manifest.name!==null?Gi.structUtils.stringifyIdent(E.manifest.name):null;f.reportInfo(Gi.MessageName.UNNAMED,`${Gi.structUtils.prettyLocator(i.configuration,E.anchoredLocator)}: Bumped to ${t}`),f.reportJson({cwd:D0.npath.fromPortablePath(E.cwd),ident:L,oldVersion:k,newVersion:t});let N=p.get(E);if(typeof N!="undefined")for(let[C,U,q]of N){let W=C.manifest[U].get(q);if(typeof W=="undefined")throw new Error("Assertion failed: The dependency should have existed");let ne=W.range,m=!1;if(ne.startsWith(Gi.WorkspaceResolver.protocol)&&(ne=ne.slice(Gi.WorkspaceResolver.protocol.length),m=!0,ne===E.relativeCwd))continue;let we=ne.match(mK);if(!we){f.reportWarning(Gi.MessageName.UNNAMED,`Couldn't auto-upgrade range ${ne} (in ${Gi.structUtils.prettyLocator(i.configuration,C.anchoredLocator)})`);continue}let Se=`${we[1]}${t}`;m&&(Se=`${Gi.WorkspaceResolver.protocol}${Se}`);let he=Gi.structUtils.makeDescriptor(W,Se);C.manifest[U].set(q,he)}}}var gK=new Map([["%n",{extract:i=>i.length>=1?[i[0],i.slice(1)]:null,generate:(i=0)=>`${i+1}`}]]);function v5(i,{current:o,prerelease:f}){let p=new Fc.default.SemVer(o),E=p.prerelease.slice(),t=[];p.prerelease=[],p.format()!==i&&(E.length=0);let k=!0,L=f.split(/\./g);for(let N of L){let C=gK.get(N);if(typeof C=="undefined")t.push(N),E[0]===N?E.shift():k=!1;else{let U=k?C.extract(E):null;U!==null&&typeof U[0]=="number"?(t.push(C.generate(U[0])),E=U[1]):(t.push(C.generate()),k=!1)}}return p.prerelease&&(p.prerelease=[]),`${i}-${t.join(".")}`}var $y=class extends X_.BaseCommand{constructor(){super(...arguments);this.all=cd.Option.Boolean("--all",!1,{description:"Apply the deferred version changes on all workspaces"});this.dryRun=cd.Option.Boolean("--dry-run",!1,{description:"Print the versions without actually generating the package archive"});this.prerelease=cd.Option.String("--prerelease",{description:"Add a prerelease identifier to new versions",tolerateBoolean:!0});this.recursive=cd.Option.Boolean("-R,--recursive",{description:"Release the transitive workspaces as well"});this.json=cd.Option.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let o=await em.Configuration.find(this.context.cwd,this.context.plugins),{project:f,workspace:p}=await Q_.Project.find(o,this.context.cwd),E=await em.Cache.find(o);if(!p)throw new X_.WorkspaceRequiredError(f.cwd,this.context.cwd);return await f.restoreInstallState({restoreResolutions:!1}),(await Q_.StreamReport.start({configuration:o,json:this.json,stdout:this.context.stdout},async k=>{let L=this.prerelease?typeof this.prerelease!="boolean"?this.prerelease:"rc.%n":null,N=await Jy(f,{prerelease:L}),C=new Map;if(this.all)C=N;else{let U=this.recursive?p.getRecursiveWorkspaceDependencies():[p];for(let q of U){let W=N.get(q);typeof W!="undefined"&&C.set(q,W)}}if(C.size===0){let U=N.size>0?" Did you want to add --all?":"";k.reportWarning(em.MessageName.UNNAMED,`The current workspace doesn't seem to require a version bump.${U}`);return}ND(f,C,{report:k}),this.dryRun||(L||(this.all?await OD(f):await kD(f)),k.reportSeparator(),await f.install({cache:E,report:k}))})).exitCode()}};$y.paths=[["version","apply"]],$y.usage=cd.Command.Usage({category:"Release-related commands",description:"apply all the deferred version bumps at once",details:` + This command will apply the deferred version changes and remove their definitions from the repository. + + Note that if \`--prerelease\` is set, the given prerelease identifier (by default \`rc.%d\`) will be used on all new versions and the version definitions will be kept as-is. + + By default only the current workspace will be bumped, but you can configure this behavior by using one of: + + - \`--recursive\` to also apply the version bump on its dependencies + - \`--all\` to apply the version bump on all packages in the repository + + Note that this command will also update the \`workspace:\` references across all your local workspaces, thus ensuring that they keep referring to the same workspaces even after the version bump. + `,examples:[["Apply the version change to the local workspace","yarn version apply"],["Apply the version change to all the workspaces in the local workspace","yarn version apply --all"]]});var m5=$y;var e_=Mi(require("@yarnpkg/cli")),s0=Mi(require("@yarnpkg/core")),rc=Mi(require("@yarnpkg/fslib"));var cO=Mi(lh()),sh=Mi(su()),dO=(0,sh.memo)(({active:i})=>{let o=(0,sh.useMemo)(()=>i?"\u25C9":"\u25EF",[i]),f=(0,sh.useMemo)(()=>i?"green":"yellow",[i]);return sh.default.createElement(cO.Text,{color:f},o)});var yd=Mi(lh()),Js=Mi(su());var pO=Mi(lh()),q4=Mi(su());function hm({active:i},o,f){let{stdin:p}=(0,pO.useStdin)(),E=(0,q4.useCallback)((t,k)=>o(t,k),f);(0,q4.useEffect)(()=>{if(!(!i||!p))return p.on("keypress",E),()=>{p.off("keypress",E)}},[i,E,p])}var ah;(function(f){f.BEFORE="before",f.AFTER="after"})(ah||(ah={}));var hO=function({active:i},o,f){hm({active:i},(p,E)=>{E.name==="tab"&&(E.shift?o(ah.BEFORE):o(ah.AFTER))},f)};var H4=function(i,o,{active:f,minus:p,plus:E,set:t,loop:k=!0}){hm({active:f},(L,N)=>{let C=o.indexOf(i);switch(N.name){case p:{let U=C-1;if(k){t(o[(o.length+U)%o.length]);return}if(U<0)return;t(o[U])}break;case E:{let U=C+1;if(k){t(o[U%o.length]);return}if(U>=o.length)return;t(o[U])}break}},[o,i,E,t,k])};var O3=({active:i=!0,children:o=[],radius:f=10,size:p=1,loop:E=!0,onFocusRequest:t,willReachEnd:k})=>{let L=Se=>{if(Se.key===null)throw new Error("Expected all children to have a key");return Se.key},N=Js.default.Children.map(o,Se=>L(Se)),C=N[0],[U,q]=(0,Js.useState)(C),W=N.indexOf(U);(0,Js.useEffect)(()=>{N.includes(U)||q(C)},[o]),(0,Js.useEffect)(()=>{k&&W>=N.length-2&&k()},[W]),hO({active:i&&!!t},Se=>{t==null||t(Se)},[t]),H4(U,N,{active:i,minus:"up",plus:"down",set:q,loop:E});let ne=W-f,m=W+f;m>N.length&&(ne-=m-N.length,m=N.length),ne<0&&(m+=-ne,ne=0),m>=N.length&&(m=N.length-1);let we=[];for(let Se=ne;Se<=m;++Se){let he=N[Se],ge=i&&he===U;we.push(Js.default.createElement(yd.Box,{key:he,height:p},Js.default.createElement(yd.Box,{marginLeft:1,marginRight:1},Js.default.createElement(yd.Text,null,ge?Js.default.createElement(yd.Text,{color:"cyan",bold:!0},">"):" ")),Js.default.createElement(yd.Box,null,Js.default.cloneElement(o[Se],{active:ge}))))}return Js.default.createElement(yd.Box,{flexDirection:"column",width:"100%"},we)};var W4=Mi(lh()),k3=Mi(su());var vO=Mi(lh()),Z1=Mi(su()),mO=Mi(require("readline")),O$=Z1.default.createContext(null),yO=({children:i})=>{let{stdin:o,setRawMode:f}=(0,vO.useStdin)();(0,Z1.useEffect)(()=>{f&&f(!0),o&&(0,mO.emitKeypressEvents)(o)},[o,f]);let[p,E]=(0,Z1.useState)(new Map),t=(0,Z1.useMemo)(()=>({getAll:()=>p,get:k=>p.get(k),set:(k,L)=>E(new Map([...p,[k,L]]))}),[p,E]);return Z1.default.createElement(O$.Provider,{value:t,children:i})};async function gO(i,o,{stdin:f,stdout:p,stderr:E}={}){let t,k=N=>{let{exit:C}=(0,W4.useApp)();hm({active:!0},(U,q)=>{q.name==="return"&&(t=N,C())},[C,N])},{waitUntilExit:L}=(0,W4.render)(k3.default.createElement(yO,null,k3.default.createElement(i,Gf(E0({},o),{useSubmit:k}))),{stdin:f,stdout:p,stderr:E});return await L(),t}var fh=Mi(require("clipanion")),Dr=Mi(lh()),Tn=Mi(su()),V4=Mi(require("semver"));var t_=class extends e_.BaseCommand{constructor(){super(...arguments);this.interactive=fh.Option.Boolean("-i,--interactive",{description:"Open an interactive interface used to set version bumps"})}async execute(){return this.interactive?await this.executeInteractive():await this.executeStandard()}async executeInteractive(){let o=await s0.Configuration.find(this.context.cwd,this.context.plugins),{project:f,workspace:p}=await s0.Project.find(o,this.context.cwd);if(!p)throw new e_.WorkspaceRequiredError(f.cwd,this.context.cwd);await f.restoreInstallState();let E=await $v(f);if(E===null||E.releaseRoots.size===0)return 0;if(E.root===null)throw new fh.UsageError("This command can only be run on Git repositories");let t=()=>Tn.default.createElement(Dr.Box,{flexDirection:"row",paddingBottom:1},Tn.default.createElement(Dr.Box,{flexDirection:"column",width:60},Tn.default.createElement(Dr.Box,null,Tn.default.createElement(Dr.Text,null,"Press ",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},""),"/",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"")," to select workspaces.")),Tn.default.createElement(Dr.Box,null,Tn.default.createElement(Dr.Text,null,"Press ",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},""),"/",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"")," to select release strategies."))),Tn.default.createElement(Dr.Box,{flexDirection:"column"},Tn.default.createElement(Dr.Box,{marginLeft:1},Tn.default.createElement(Dr.Text,null,"Press ",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"")," to save.")),Tn.default.createElement(Dr.Box,{marginLeft:1},Tn.default.createElement(Dr.Text,null,"Press ",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"")," to abort.")))),k=({workspace:W,active:ne,decision:m,setDecision:we})=>{var ze;let Se=(ze=W.manifest.raw.stableVersion)!=null?ze:W.manifest.version;if(Se===null)throw new Error(`Assertion failed: The version should have been set (${s0.structUtils.prettyLocator(o,W.anchoredLocator)})`);if(V4.default.prerelease(Se)!==null)throw new Error(`Assertion failed: Prerelease identifiers shouldn't be found (${Se})`);let he=[Nu.UNDECIDED,Nu.DECLINE,Nu.PATCH,Nu.MINOR,Nu.MAJOR];H4(m,he,{active:ne,minus:"left",plus:"right",set:we});let ge=m===Nu.UNDECIDED?Tn.default.createElement(Dr.Text,{color:"yellow"},Se):m===Nu.DECLINE?Tn.default.createElement(Dr.Text,{color:"green"},Se):Tn.default.createElement(Dr.Text,null,Tn.default.createElement(Dr.Text,{color:"magenta"},Se)," \u2192 ",Tn.default.createElement(Dr.Text,{color:"green"},V4.default.valid(m)?m:V4.default.inc(Se,m)));return Tn.default.createElement(Dr.Box,{flexDirection:"column"},Tn.default.createElement(Dr.Box,null,Tn.default.createElement(Dr.Text,null,s0.structUtils.prettyLocator(o,W.anchoredLocator)," - ",ge)),Tn.default.createElement(Dr.Box,null,he.map(pe=>Tn.default.createElement(Dr.Box,{key:pe,paddingLeft:2},Tn.default.createElement(Dr.Text,null,Tn.default.createElement(dO,{active:pe===m})," ",pe)))))},L=W=>{let ne=new Set(E.releaseRoots),m=new Map([...W].filter(([we])=>ne.has(we)));for(;;){let we=Zy({project:E.project,releases:m}),Se=!1;if(we.length>0){for(let[he]of we)if(!ne.has(he)){ne.add(he),Se=!0;let ge=W.get(he);typeof ge!="undefined"&&m.set(he,ge)}}if(!Se)break}return{relevantWorkspaces:ne,relevantReleases:m}},N=()=>{let[W,ne]=(0,Tn.useState)(()=>new Map(E.releases)),m=(0,Tn.useCallback)((we,Se)=>{let he=new Map(W);Se!==Nu.UNDECIDED?he.set(we,Se):he.delete(we);let{relevantReleases:ge}=L(he);ne(ge)},[W,ne]);return[W,m]},C=({workspaces:W,releases:ne})=>{let m=[];m.push(`${W.size} total`);let we=0,Se=0;for(let he of W){let ge=ne.get(he);typeof ge=="undefined"?Se+=1:ge!==Nu.DECLINE&&(we+=1)}return m.push(`${we} release${we===1?"":"s"}`),m.push(`${Se} remaining`),Tn.default.createElement(Dr.Text,{color:"yellow"},m.join(", "))},q=await gO(({useSubmit:W})=>{let[ne,m]=N();W(ne);let{relevantWorkspaces:we}=L(ne),Se=new Set([...we].filter(pe=>!E.releaseRoots.has(pe))),[he,ge]=(0,Tn.useState)(0),ze=(0,Tn.useCallback)(pe=>{switch(pe){case ah.BEFORE:ge(he-1);break;case ah.AFTER:ge(he+1);break}},[he,ge]);return Tn.default.createElement(Dr.Box,{flexDirection:"column"},Tn.default.createElement(t,null),Tn.default.createElement(Dr.Box,null,Tn.default.createElement(Dr.Text,{wrap:"wrap"},"The following files have been modified in your local checkout.")),Tn.default.createElement(Dr.Box,{flexDirection:"column",marginTop:1,paddingLeft:2},[...E.changedFiles].map(pe=>Tn.default.createElement(Dr.Box,{key:pe},Tn.default.createElement(Dr.Text,null,Tn.default.createElement(Dr.Text,{color:"grey"},rc.npath.fromPortablePath(E.root)),rc.npath.sep,rc.npath.relative(rc.npath.fromPortablePath(E.root),rc.npath.fromPortablePath(pe)))))),E.releaseRoots.size>0&&Tn.default.createElement(Tn.default.Fragment,null,Tn.default.createElement(Dr.Box,{marginTop:1},Tn.default.createElement(Dr.Text,{wrap:"wrap"},"Because of those files having been modified, the following workspaces may need to be released again (note that private workspaces are also shown here, because even though they won't be published, releasing them will allow us to flag their dependents for potential re-release):")),Se.size>3?Tn.default.createElement(Dr.Box,{marginTop:1},Tn.default.createElement(C,{workspaces:E.releaseRoots,releases:ne})):null,Tn.default.createElement(Dr.Box,{marginTop:1,flexDirection:"column"},Tn.default.createElement(O3,{active:he%2==0,radius:1,size:2,onFocusRequest:ze},[...E.releaseRoots].map(pe=>Tn.default.createElement(k,{key:pe.cwd,workspace:pe,decision:ne.get(pe)||Nu.UNDECIDED,setDecision:Oe=>m(pe,Oe)}))))),Se.size>0?Tn.default.createElement(Tn.default.Fragment,null,Tn.default.createElement(Dr.Box,{marginTop:1},Tn.default.createElement(Dr.Text,{wrap:"wrap"},"The following workspaces depend on other workspaces that have been marked for release, and thus may need to be released as well:")),Tn.default.createElement(Dr.Box,null,Tn.default.createElement(Dr.Text,null,"(Press ",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"")," to move the focus between the workspace groups.)")),Se.size>5?Tn.default.createElement(Dr.Box,{marginTop:1},Tn.default.createElement(C,{workspaces:Se,releases:ne})):null,Tn.default.createElement(Dr.Box,{marginTop:1,flexDirection:"column"},Tn.default.createElement(O3,{active:he%2==1,radius:2,size:2,onFocusRequest:ze},[...Se].map(pe=>Tn.default.createElement(k,{key:pe.cwd,workspace:pe,decision:ne.get(pe)||Nu.UNDECIDED,setDecision:Oe=>m(pe,Oe)}))))):null)},{versionFile:E},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof q=="undefined")return 1;E.releases.clear();for(let[W,ne]of q)E.releases.set(W,ne);await E.saveAll()}async executeStandard(){let o=await s0.Configuration.find(this.context.cwd,this.context.plugins),{project:f,workspace:p}=await s0.Project.find(o,this.context.cwd);if(!p)throw new e_.WorkspaceRequiredError(f.cwd,this.context.cwd);return await f.restoreInstallState(),(await s0.StreamReport.start({configuration:o,stdout:this.context.stdout},async t=>{let k=await $v(f);if(k===null||k.releaseRoots.size===0)return;if(k.root===null)throw new fh.UsageError("This command can only be run on Git repositories");if(t.reportInfo(s0.MessageName.UNNAMED,`Your PR was started right after ${s0.formatUtils.pretty(o,k.baseHash.slice(0,7),"yellow")} ${s0.formatUtils.pretty(o,k.baseTitle,"magenta")}`),k.changedFiles.size>0){t.reportInfo(s0.MessageName.UNNAMED,"You have changed the following files since then:"),t.reportSeparator();for(let q of k.changedFiles)t.reportInfo(null,`${s0.formatUtils.pretty(o,rc.npath.fromPortablePath(k.root),"gray")}${rc.npath.sep}${rc.npath.relative(rc.npath.fromPortablePath(k.root),rc.npath.fromPortablePath(q))}`)}let L=!1,N=!1,C=K_(k);if(C.size>0){L||t.reportSeparator();for(let q of C)t.reportError(s0.MessageName.UNNAMED,`${s0.structUtils.prettyLocator(o,q.anchoredLocator)} has been modified but doesn't have a release strategy attached`);L=!0}let U=Zy(k);for(let[q,W]of U)N||t.reportSeparator(),t.reportError(s0.MessageName.UNNAMED,`${s0.structUtils.prettyLocator(o,q.anchoredLocator)} doesn't have a release strategy attached, but depends on ${s0.structUtils.prettyWorkspace(o,W)} which is planned for release.`),N=!0;(L||N)&&(t.reportSeparator(),t.reportInfo(s0.MessageName.UNNAMED,"This command detected that at least some workspaces have received modifications without explicit instructions as to how they had to be released (if needed)."),t.reportInfo(s0.MessageName.UNNAMED,"To correct these errors, run `yarn version check --interactive` then follow the instructions."))})).exitCode()}};t_.paths=[["version","check"]],t_.usage=fh.Command.Usage({category:"Release-related commands",description:"check that all the relevant packages have been bumped",details:"\n **Warning:** This command currently requires Git.\n\n This command will check that all the packages covered by the files listed in argument have been properly bumped or declined to bump.\n\n In the case of a bump, the check will also cover transitive packages - meaning that should `Foo` be bumped, a package `Bar` depending on `Foo` will require a decision as to whether `Bar` will need to be bumped. This check doesn't cross packages that have declined to bump.\n\n In case no arguments are passed to the function, the list of modified files will be generated by comparing the HEAD against `master`.\n ",examples:[["Check whether the modified packages need a bump","yarn version check"]]});var _O=t_;var G4=Mi(require("@yarnpkg/cli")),Y4=Mi(require("@yarnpkg/core")),Bc=Mi(require("clipanion")),K4=Mi(require("semver"));var n_=class extends G4.BaseCommand{constructor(){super(...arguments);this.deferred=Bc.Option.Boolean("-d,--deferred",{description:"Prepare the version to be bumped during the next release cycle"});this.immediate=Bc.Option.Boolean("-i,--immediate",{description:"Bump the version immediately"});this.strategy=Bc.Option.String()}async execute(){let o=await Y4.Configuration.find(this.context.cwd,this.context.plugins),{project:f,workspace:p}=await Y4.Project.find(o,this.context.cwd);if(!p)throw new G4.WorkspaceRequiredError(f.cwd,this.context.cwd);let E=o.get("preferDeferredVersions");this.deferred&&(E=!0),this.immediate&&(E=!1);let t=K4.default.valid(this.strategy),k=this.strategy===Nu.DECLINE,L;if(t)if(p.manifest.version!==null){let C=MD(p.manifest.version,this.strategy);C!==null?L=C:L=this.strategy}else L=this.strategy;else{let C=p.manifest.version;if(!k){if(C===null)throw new Bc.UsageError("Can't bump the version if there wasn't a version to begin with - use 0.0.0 as initial version then run the command again.");if(typeof C!="string"||!K4.default.valid(C))throw new Bc.UsageError(`Can't bump the version (${C}) if it's not valid semver`)}L=Zv(this.strategy)}if(!E){let U=(await Jy(f)).get(p);if(typeof U!="undefined"&&L!==Nu.DECLINE){let q=Y_(p.manifest.version,L);if(K4.default.lt(q,U))throw new Bc.UsageError(`Can't bump the version to one that would be lower than the current deferred one (${U})`)}}let N=await $v(f,{allowEmpty:!0});return N.releases.set(p,L),await N.saveAll(),E?0:await this.cli.run(["version","apply"])}};n_.paths=[["version"]],n_.usage=Bc.Command.Usage({category:"Release-related commands",description:"apply a new version to the current package",details:"\n This command will bump the version number for the given package, following the specified strategy:\n\n - If `major`, the first number from the semver range will be increased (`X.0.0`).\n - If `minor`, the second number from the semver range will be increased (`0.X.0`).\n - If `patch`, the third number from the semver range will be increased (`0.0.X`).\n - If prefixed by `pre` (`premajor`, ...), a `-0` suffix will be set (`0.0.0-0`).\n - If `prerelease`, the suffix will be increased (`0.0.0-X`); the third number from the semver range will also be increased if there was no suffix in the previous version.\n - If `decline`, the nonce will be increased for `yarn version check` to pass without version bump.\n - If a valid semver range, it will be used as new version.\n - If unspecified, Yarn will ask you for guidance.\n\n For more information about the `--deferred` flag, consult our documentation (https://yarnpkg.com/features/release-workflow#deferred-versioning).\n ",examples:[["Immediately bump the version to the next major","yarn version major"],["Prepare the version to be bumped to the next major","yarn version major --deferred"]]});var EO=n_;var M$={configuration:{deferredVersionFolder:{description:"Folder where are stored the versioning files",type:M3.SettingsType.ABSOLUTE_PATH,default:"./.yarn/versions"},preferDeferredVersions:{description:"If true, running `yarn version` will assume the `--deferred` flag unless `--immediate` is set",type:M3.SettingsType.BOOLEAN,default:!1}},commands:[m5,_O,EO]},N$=M$;return k$;})(); +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +/** @license React v0.0.0-experimental-51a3aa6af + * react-debug-tools.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v0.0.0-experimental-51a3aa6af + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v0.0.0-experimental-51a3aa6af + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v0.18.0 + * scheduler-tracing.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v0.18.0 + * scheduler-tracing.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v0.18.0 + * scheduler.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v0.18.0 + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v0.24.0 + * react-reconciler.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v0.24.0 + * react-reconciler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v16.13.1 + * react.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v16.13.1 + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +return plugin; +} +}; diff --git a/.yarnrc.yml b/.yarnrc.yml index 057bb9e1e..5b9c141ea 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -7,5 +7,7 @@ plugins: spec: "@yarnpkg/plugin-interactive-tools" - path: .yarn/plugins/@yarnpkg/plugin-engines.cjs spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js" + - path: .yarn/plugins/@yarnpkg/plugin-version.cjs + spec: "@yarnpkg/plugin-version" yarnPath: .yarn/releases/yarn-3.6.3.cjs diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..2fc8d9629 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +Please refer to the individual packages: + +- [miew](packages/miew/CHANGELOG.md) +- [miew-react](packages/miew-react/CHANGELOG.md) +- [miew-app](packages/miew-app/CHANGELOG.md) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f0bdc4ae8..0b251f3be 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -177,7 +177,7 @@ git fetch upstream git rebase upstream/main # lint, test and build -npm run ci +yarn run ci # run automated and manual tests, etc. ... @@ -190,7 +190,7 @@ Unfortunately, it is still a semi-manual process. 1. Ensure that you have a clean repo. Check the build pipeline etc. git status - npm run ci + yarn run ci ... 2. Use npm to automatically increment version (patch, minor or major). @@ -201,9 +201,15 @@ Unfortunately, it is still a semi-manual process. - Increment product version in the `sonar-project.properties` file. + - Examine the changes since the last version. Check the commit log and follow the external + links (PRs, issues) to refresh the knowledge. + + git log v0.0.1..HEAD --reverse \ + --first-parent --pretty=format:"%as - %s (%an)" + - Update `CHANGELOG.md` file. Don't copy the git log blindly, summarize, reword and reorder. Use the following groups order: - ## [0.0.1] - 2000-01-01 + ## [0.0.2] - 2000-01-01 ### Added ### Changed ### Deprecated @@ -214,13 +220,13 @@ Unfortunately, it is still a semi-manual process. - Update unreleased link in `CHANGELOG.md` file. - [Unreleased]: https://github.com/epam/miew/compare/v0.0.1...HEAD + [Unreleased]: https://github.com/epam/miew/compare/v0.0.2...HEAD - Replace the automatic commit and move the tag. git add sonar-project.properties CHANGELOG.md git commit --amend - git tag -fa v0.0.1 -m "0.0.1" + git tag -fa v0.0.2 -m "0.0.2" 4. Merge `main` into `latest` branch. @@ -239,4 +245,4 @@ Unfortunately, it is still a semi-manual process. * Select the new version tag among existing and fill in a description text box with new release link and list of changes (see `CHANGELOG.md`) * Press `Publish`. -Upon push, GitHub Actions build `main`, `latest` branches and `v0.0.1` tag. The tag automatically initiates NPM publish process if the build is successful. +Upon push, GitHub Actions build `main`, `latest` branches and `v0.0.2` tag. The tag automatically initiates NPM publish process if the build is successful. diff --git a/package.json b/package.json index e61a07a37..36603732b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { - "name": "monorepo", - "version": "1.0.0", - "main": "packages/miew/dist/Miew.js", + "name": "miew-monorepo", + "version": "0.11.0-0", "license": "MIT", "private": true, "workspaces": [ diff --git a/packages/miew-app/CHANGELOG.md b/packages/miew-app/CHANGELOG.md new file mode 100644 index 000000000..1f4c5359e --- /dev/null +++ b/packages/miew-app/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +TBD + +## [0.11.0] - 2024-08-26 + +### Added + +- Add a [`miew-app`][] package with a new demo application code. The goal is to rewrite the old + monolith plain JavaScript demo in modular React.js + +[`miew-app`]: https://github.com/epam/miew/tree/main/packages/miew-app + +[Unreleased]: https://github.com/epam/miew/compare/v0.11.0...HEAD +[0.11.0]: https://github.com/epam/miew/compare/v0.9.0...v0.11.0 diff --git a/packages/miew-app/package.json b/packages/miew-app/package.json index 0df973a65..0ebf137a5 100644 --- a/packages/miew-app/package.json +++ b/packages/miew-app/package.json @@ -1,6 +1,6 @@ { "name": "miew-app", - "version": "0.0.1", + "version": "0.11.0-0", "description": "React application demonstrating capabilities of Miew library", "author": "EPAM Systems, Inc.", "private": true, diff --git a/packages/miew-react/CHANGELOG.md b/packages/miew-react/CHANGELOG.md new file mode 100644 index 000000000..533a62b0b --- /dev/null +++ b/packages/miew-react/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +TBD + +## [0.11.0] - 2024-08-26 + +### Added + +- Add a [`miew-react`][] package that contains a React.js wrapper component. It is published + as a separate [miew-react](https://www.npmjs.com/package/miew-react) package on npm. + +[`miew-react`]: https://github.com/epam/miew/tree/main/packages/miew-react + +[Unreleased]: https://github.com/epam/miew/compare/v0.11.0...HEAD +[0.11.0]: https://github.com/epam/miew/compare/v0.9.0...v0.11.0 diff --git a/packages/miew-react/package.json b/packages/miew-react/package.json index 99135fa77..93d32019b 100644 --- a/packages/miew-react/package.json +++ b/packages/miew-react/package.json @@ -1,6 +1,6 @@ { "name": "miew-react", - "version": "1.1.0-dev", + "version": "0.11.0-0", "description": "Miew - 3D Molecular Viewer (React component)", "author": "EPAM Systems, Inc.", "homepage": "https://github.com/epam/miew#readme", diff --git a/packages/miew/CHANGELOG.md b/packages/miew/CHANGELOG.md index 0165bc236..9df01e754 100644 --- a/packages/miew/CHANGELOG.md +++ b/packages/miew/CHANGELOG.md @@ -1,11 +1,71 @@ # Changelog + All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +TBD + +## [0.11.0] - 2024-08-26 + +### Added + +- Add a [`miew-react`][] package that contains a React.js wrapper component. It is published + as a separate [miew-react](https://www.npmjs.com/package/miew-react) package on npm. +- Add a [`miew-app`][] package with a new demo application code. The goal is to rewrite the old + monolith plain JavaScript demo in modular React.js + +[`miew-react`]: https://github.com/epam/miew/tree/main/packages/miew-react +[`miew-app`]: https://github.com/epam/miew/tree/main/packages/miew-app + +### Changed + +- Support shadows in sprite-based modes (Licorice, Balls and Sticks, VDW, and Trace). +- Clip sprites with near plane instead of culling them. +- Color residue names in the "sequence" example according to the secondary structure. +- Use CIF format in the demo and examples instead of discontinued MMTF. +- **BREAKING CHANGE:** Bump tree.js to r153. Can break your code only if you rely on specific + three.js API yourself. + +### Removed + +- **BREAKING CHANGE:** Remove support for `mmtf:` prefix during loading because the format + is discontinued and files are not served anymore. Parsing local files or specific URLs + is still supported. +- **BREAKING CHANGE:** The `miew` library no longer intercepts the `S` key. Numpad plus and minus + are still processed but require the `Alt` key pressed to avoid conflicts. The keys will likely + be removed in the future versions in favor of event handlers and API calls. + +### Fixed + +- Don't crash on `addEventListener` call if embedded in a cross-origin IFRAME. +- Create empty molecules correctly. +- Fix `HydrophobicityColorer` behavior. +- Rebuild the geometry after enabling or disabling `zSprite` setting. +- Change event name in the docs: `rebuildingDone` to `buildingDone`. +- Fix "sequence" example to use the proper event. + +### Internal + +- Use the `main` branch as the main instead of the abandoned `master`. +- Reorganize the project as a monorepo. +- Migrate to Yarn 3. +- Migrate to GitHub Actions for CI builds instead if TravisCI. +- Migrate to Webpack instead of Rollup for building the library. +- Remove IDE files from the repository. +- Support the current Node LTS 18 and 20 for development. +- Create a Dockerfile for building an image. +- Convert several remaining old-style JS files to ES2015 classes. +- Update babel and eslint configurations and fix issues. +- Add more tests. +- Regenerate golden images. +- Translate help document for beginners into English. + +## [0.10.0] - 2022-01-25 \[YANKED] + ## [0.9.0] - 2020-03-23 ### Added - Add unittests for Atom and Molecule @@ -584,7 +644,9 @@ in [0.7.7+hotfix] and later releases. - Update dependencies to the latest supported versions. - Move the project to GitHub. -[Unreleased]: https://github.com/epam/miew/compare/v0.9.0...HEAD +[Unreleased]: https://github.com/epam/miew/compare/v0.11.0...HEAD +[0.11.0]: https://github.com/epam/miew/compare/v0.9.0...v0.11.0 +[0.10.0]: https://github.com/epam/miew/compare/v0.9.0...v0.10.0 [0.9.0]: https://github.com/epam/miew/compare/v0.8.7...v0.9.0 [0.8.7]: https://github.com/epam/miew/compare/v0.8.6...v0.8.7 [0.8.6]: https://github.com/epam/miew/compare/v0.8.5...v0.8.6 diff --git a/packages/miew/dist/Miew.js b/packages/miew/dist/Miew.js index 7dfa3b8f4..7120d7e14 100644 --- a/packages/miew/dist/Miew.js +++ b/packages/miew/dist/Miew.js @@ -1,40696 +1,36006 @@ -/** Miew - 3D Molecular Viewer v0.9.0 Copyright (c) 2015-2020 EPAM Systems, Inc. */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('lodash'), require('three')) : - typeof define === 'function' && define.amd ? define(['lodash', 'three'], factory) : - (global = global || self, global.Miew = factory(global._, global.THREE)); -}(this, (function (_, THREE) { 'use strict'; - - _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _; - - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; +/*! Miew - 3D Molecular Viewer v0.11.0-0 Copyright (c) 2015-2024 EPAM Systems, Inc. */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("lodash"), require("three")); + else if(typeof define === 'function' && define.amd) + define(["lodash", "three"], factory); + else if(typeof exports === 'object') + exports["Miew"] = factory(require("lodash"), require("three")); + else + root["Miew"] = factory(root["_"], root["THREE"]); +})(this, (__WEBPACK_EXTERNAL_MODULE__535__, __WEBPACK_EXTERNAL_MODULE__698__) => { +return /******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 89: +/***/ ((module) => { + +/* eslint-disable */ +// DO NOT EDIT! Automatically generated from .jison +/* parser generated by jison 0.4.18 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} } - var arrayWithHoles = _arrayWithHoles; - - function _iterableToArrayLimit(arr, i) { - if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { - return; - } - - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, } - - return _arr; } - var iterableToArrayLimit = _iterableToArrayLimit; - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } - var nonIterableRest = _nonIterableRest; - function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest(); + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + } +*/ +var parser = function () { + var o = function (k, v, o, l) { + for (o = o || {}, l = k.length; l--; o[k[l]] = v); + return o; + }, + $V0 = [1, 60], + $V1 = [1, 62], + $V2 = [1, 63], + $V3 = [1, 65], + $V4 = [1, 66], + $V5 = [1, 67], + $V6 = [1, 68], + $V7 = [1, 69], + $V8 = [1, 80], + $V9 = [1, 72], + $Va = [1, 73], + $Vb = [1, 74], + $Vc = [1, 75], + $Vd = [1, 99], + $Ve = [1, 76], + $Vf = [1, 100], + $Vg = [1, 79], + $Vh = [1, 51], + $Vi = [1, 81], + $Vj = [1, 82], + $Vk = [1, 84], + $Vl = [1, 83], + $Vm = [1, 85], + $Vn = [1, 96], + $Vo = [1, 97], + $Vp = [1, 98], + $Vq = [1, 86], + $Vr = [1, 87], + $Vs = [1, 64], + $Vt = [1, 70], + $Vu = [1, 71], + $Vv = [1, 77], + $Vw = [1, 78], + $Vx = [1, 53], + $Vy = [1, 54], + $Vz = [1, 55], + $VA = [1, 61], + $VB = [1, 88], + $VC = [1, 89], + $VD = [1, 90], + $VE = [1, 91], + $VF = [1, 92], + $VG = [1, 93], + $VH = [1, 94], + $VI = [1, 95], + $VJ = [1, 101], + $VK = [1, 102], + $VL = [1, 103], + $VM = [1, 104], + $VN = [1, 105], + $VO = [1, 56], + $VP = [1, 57], + $VQ = [1, 58], + $VR = [1, 59], + $VS = [1, 115], + $VT = [1, 111], + $VU = [1, 114], + $VV = [1, 112], + $VW = [1, 113], + $VX = [1, 118], + $VY = [1, 117], + $VZ = [1, 134], + $V_ = [1, 149], + $V$ = [1, 150], + $V01 = [1, 157], + $V11 = [5, 6, 7, 9, 13, 14, 15, 17, 18, 19, 20, 23, 25, 26, 27, 30, 33, 34, 35, 37, 38, 41, 43, 45, 46, 49, 52, 54, 55, 56, 58, 59, 62, 64, 65, 66, 70, 72, 74, 77, 78, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101], + $V21 = [5, 6, 7, 9, 13, 14, 15, 17, 18, 19, 20, 23, 25, 26, 27, 30, 33, 34, 35, 37, 38, 41, 43, 45, 46, 49, 52, 54, 55, 56, 58, 59, 62, 64, 65, 66, 70, 71, 72, 74, 77, 78, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101], + $V31 = [5, 6, 7, 9, 13, 15, 17, 18, 19, 20, 23, 25, 26, 27, 30, 33, 34, 37, 38, 41, 43, 45, 46, 49, 52, 54, 55, 56, 58, 59, 62, 64, 65, 66, 70, 72, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + $V41 = [5, 70, 72], + $V51 = [5, 74], + $V61 = [71, 101]; + var parser = { + trace: function trace() {}, + yy: {}, + symbols_: { + "error": 2, + "Program": 3, + "Command": 4, + "EOF": 5, + "RESET": 6, + "BUILD": 7, + "ALL": 8, + "HELP": 9, + "Path": 10, + "MOTM": 11, + "OneArgCommand": 12, + "GET": 13, + "STRING": 14, + "SET": 15, + "Value": 16, + "SET_SAVE": 17, + "SET_RESTORE": 18, + "SET_RESET": 19, + "PRESET": 20, + "AddRepresentation": 21, + "EditRepresentation": 22, + "REMOVE": 23, + "RepresentationReference": 24, + "HIDE": 25, + "SHOW": 26, + "LIST": 27, + "EXPAND_KEY": 28, + "SELECTOR_KEY": 29, + "SELECT": 30, + "AS": 31, + "WordAll": 32, + "SELECTOR": 33, + "WITHIN": 34, + "NUMBER": 35, + "OF": 36, + "MATERIAL": 37, + "IDENTIFIER": 38, + "ModeCMD": 39, + "ColorCMD": 40, + "VIEW": 41, + "BASE_64": 42, + "UNIT": 43, + "DSSP": 44, + "SCALE": 45, + "ROTATE": 46, + "AxesList": 47, + "TRANSLATE": 48, + "CENTER": 49, + "GetURLBranch": 50, + "Screenshot": 51, + "LINE": 52, + "ArgList": 53, + "LISTOBJ": 54, + "REMOVEOBJ": 55, + "URL": 56, + "VIEW_KEY": 57, + "SCREENSHOT": 58, + "LOAD": 59, + "Url": 60, + "FILE_KEY": 61, + "ADD": 62, + "Description": 63, + "REP": 64, + "MODE": 65, + "COLOR": 66, + "Descriptor": 67, + "RepresentationOwnProperty": 68, + "RepresentationOwnPropertyOpts": 69, + "DESC_KEY": 70, + "=": 71, + "DESC_KEY_OPTS": 72, + "AxesArg": 73, + "DESC_KEY_AXES": 74, + "Arg": 75, + "PathWoDescKey": 76, + "HEX": 77, + "BOOL": 78, + "Word": 79, + "CommandSetWoDESC_KEY": 80, + "DescKeys": 81, + "CLEAR": 82, + "FILE_LIST": 83, + "FILE_REGISTER": 84, + "FILE_DELETE": 85, + "PRESET_ADD": 86, + "PRESET_DELETE": 87, + "PRESET_UPDATE": 88, + "PRESET_RENAME": 89, + "PRESET_OPEN": 90, + "CREATE_SCENARIO": 91, + "RESET_SCENARIO": 92, + "DELETE_SCENARIO": 93, + "ADD_SCENARIO_ITEM": 94, + "LIST_SCENARIO": 95, + "PDB_KEY": 96, + "DELAY_KEY": 97, + "PRST_KEY": 98, + "DESCRIPTION_KEY": 99, + "CommandSet": 100, + ".": 101, + "PresetPath": 102, + "/": 103, + "HexOrNumber": 104, + "$accept": 0, + "$end": 1 + }, + terminals_: { + 2: "error", + 5: "EOF", + 6: "RESET", + 7: "BUILD", + 8: "ALL", + 9: "HELP", + 11: "MOTM", + 13: "GET", + 14: "STRING", + 15: "SET", + 17: "SET_SAVE", + 18: "SET_RESTORE", + 19: "SET_RESET", + 20: "PRESET", + 23: "REMOVE", + 25: "HIDE", + 26: "SHOW", + 27: "LIST", + 28: "EXPAND_KEY", + 29: "SELECTOR_KEY", + 30: "SELECT", + 31: "AS", + 33: "SELECTOR", + 34: "WITHIN", + 35: "NUMBER", + 36: "OF", + 37: "MATERIAL", + 38: "IDENTIFIER", + 41: "VIEW", + 42: "BASE_64", + 43: "UNIT", + 44: "DSSP", + 45: "SCALE", + 46: "ROTATE", + 48: "TRANSLATE", + 49: "CENTER", + 52: "LINE", + 54: "LISTOBJ", + 55: "REMOVEOBJ", + 56: "URL", + 57: "VIEW_KEY", + 58: "SCREENSHOT", + 59: "LOAD", + 61: "FILE_KEY", + 62: "ADD", + 64: "REP", + 65: "MODE", + 66: "COLOR", + 70: "DESC_KEY", + 71: "=", + 72: "DESC_KEY_OPTS", + 74: "DESC_KEY_AXES", + 77: "HEX", + 78: "BOOL", + 82: "CLEAR", + 83: "FILE_LIST", + 84: "FILE_REGISTER", + 85: "FILE_DELETE", + 86: "PRESET_ADD", + 87: "PRESET_DELETE", + 88: "PRESET_UPDATE", + 89: "PRESET_RENAME", + 90: "PRESET_OPEN", + 91: "CREATE_SCENARIO", + 92: "RESET_SCENARIO", + 93: "DELETE_SCENARIO", + 94: "ADD_SCENARIO_ITEM", + 95: "LIST_SCENARIO", + 96: "PDB_KEY", + 97: "DELAY_KEY", + 98: "PRST_KEY", + 99: "DESCRIPTION_KEY", + 101: ".", + 103: "/" + }, + productions_: [0, [3, 2], [3, 1], [4, 1], [4, 1], [4, 2], [4, 1], [4, 2], [4, 1], [4, 1], [4, 2], [4, 2], [4, 3], [4, 3], [4, 1], [4, 1], [4, 1], [4, 1], [4, 2], [4, 1], [4, 1], [4, 2], [4, 2], [4, 2], [4, 2], [4, 1], [4, 2], [4, 2], [4, 2], [4, 4], [4, 2], [4, 6], [4, 2], [4, 1], [4, 1], [4, 1], [4, 2], [4, 2], [4, 1], [4, 2], [4, 1], [4, 2], [4, 2], [4, 2], [4, 1], [4, 2], [4, 1], [4, 1], [4, 3], [4, 3], [4, 4], [4, 4], [4, 1], [4, 2], [50, 1], [50, 2], [50, 2], [50, 3], [50, 3], [51, 1], [51, 2], [51, 3], [12, 2], [12, 2], [12, 2], [21, 1], [21, 2], [21, 2], [21, 3], [22, 2], [22, 3], [39, 2], [39, 3], [40, 2], [40, 3], [24, 1], [24, 1], [63, 1], [63, 2], [63, 3], [63, 4], [67, 1], [67, 1], [67, 2], [68, 3], [69, 3], [47, 1], [47, 2], [73, 2], [53, 1], [53, 2], [75, 3], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [79, 1], [79, 1], [32, 1], [32, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [81, 1], [81, 1], [81, 1], [81, 1], [81, 1], [81, 1], [81, 1], [100, 1], [100, 1], [76, 1], [76, 3], [76, 3], [10, 1], [10, 1], [10, 3], [10, 3], [10, 3], [60, 1], [102, 1], [102, 3], [104, 1], [104, 1]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { + /* this == yyval */ - var slicedToArray = _slicedToArray; - - var __assign = (undefined && undefined.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - var defaults = { - lines: 12, - length: 7, - width: 5, - radius: 10, - scale: 1.0, - corners: 1, - color: '#000', - fadeColor: 'transparent', - animation: 'spinner-line-fade-default', - rotate: 0, - direction: 1, - speed: 1, - zIndex: 2e9, - className: 'spinner', - top: '50%', - left: '50%', - shadow: '0 0 1px transparent', - position: 'absolute', - }; - var Spinner = /** @class */ (function () { - function Spinner(opts) { - if (opts === void 0) { opts = {}; } - this.opts = __assign(__assign({}, defaults), opts); - } - /** - * Adds the spinner to the given target element. If this instance is already - * spinning, it is automatically removed from its previous target by calling - * stop() internally. - */ - Spinner.prototype.spin = function (target) { - this.stop(); - this.el = document.createElement('div'); - this.el.className = this.opts.className; - this.el.setAttribute('role', 'progressbar'); - css(this.el, { - position: this.opts.position, - width: 0, - zIndex: this.opts.zIndex, - left: this.opts.left, - top: this.opts.top, - transform: "scale(" + this.opts.scale + ")", + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 3: + this.$ = yy.miew.reset(false); + yy.ClearContext(); + yy.miew.resetReps("empty"); + break; + case 4: + this.$ = yy.miew.rebuild(); + break; + case 5: + this.$ = yy.miew.rebuildAll(); + yy.miew.rebuild(); + break; + case 6: + this.$ = yy.echo(yy.utils.help().toString()); + break; + case 7: + this.$ = yy.echo(yy.utils.help($$[$0]).toString()); + break; + case 8: + this.$ = yy.miew.motm(); + break; + case 10: + case 11: + this.$ = yy.utils.propagateProp($$[$0]); + yy.echo(yy.miew.get($$[$0]).toString()); + break; + case 12: + case 13: + this.$ = yy.miew.set($$[$0 - 1], yy.utils.propagateProp($$[$0 - 1], $$[$0])); + ; + break; + case 14: + this.$ = yy.miew.saveSettings(); + ; + break; + case 15: + this.$ = yy.miew.restoreSettings(); + ; + break; + case 16: + this.$ = yy.miew.resetSettings(); + ; + break; + case 17: + this.$ = yy.miew.resetReps(); + break; + case 18: + this.$ = yy.miew.applyPreset($$[$0]); + break; + case 21: + this.$ = yy.miew.repRemove($$[$0]); + yy.representations.remove($$[$0]); + break; + case 22: + this.$ = yy.miew.repHide($$[$0]); + break; + case 23: + this.$ = yy.miew.repHide($$[$0], false); + break; + case 24: + this.$ = yy.echo(yy.utils.listRep(yy.miew, yy.representations, $$[$0], '-e')); + break; + case 25: + this.$ = yy.echo(yy.utils.list(yy.miew, yy.representations)); + break; + case 26: + this.$ = yy.echo(yy.utils.list(yy.miew, yy.representations, $$[$0])); + break; + case 27: + this.$ = yy.echo(yy.utils.listSelector(yy.miew, yy.Context)); + break; + case 28: + this.$ = yy.miew.select(yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0], true)); + break; + case 29: + this.$ = yy.Context[$$[$0].toLowerCase()] = yy.utils.checkArg($$[$0 - 3].toLowerCase(), $$[$0 - 2], true); + yy.miew.select(yy.Context[$$[$0].toLowerCase()]); + break; + case 30: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + selector: yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0]) + }); + break; + case 31: + this.$ = yy.Context[$$[$0].toLowerCase()] = yy.miew.within(yy.utils.checkArg("select", $$[$0 - 2], true), Number($$[$0 - 4])); + break; + case 32: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + material: yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0].toUpperCase()) }); - if (target) { - target.insertBefore(this.el, target.firstChild || null); + break; + case 35: + this.$ = yy.echo(yy.miew.view()); + break; + case 36: + case 37: + this.$ = yy.miew.view($$[$0]); + break; + case 38: + this.$ = yy.echo(yy.miew.changeUnit()); + break; + case 39: + this.$ = yy.echo(yy.miew.changeUnit($$[$0])); + break; + case 40: + this.$ = yy.miew.dssp(); + break; + case 41: + this.$ = yy.miew.scale($$[$0]); + break; + case 42: + for (var i = 0, n = $$[$0].length; i < n; i++) { + yy.miew.rotate($$[$0][i]['x'] * Math.PI / 180.0, $$[$0][i]['y'] * Math.PI / 180.0, $$[$0][i]['z'] * Math.PI / 180.0); } - drawLines(this.el, this.opts); - return this; - }; - /** - * Stops and removes the Spinner. - * Stopped spinners may be reused by calling spin() again. - */ - Spinner.prototype.stop = function () { - if (this.el) { - if (typeof requestAnimationFrame !== 'undefined') { - cancelAnimationFrame(this.animateId); - } - else { - clearTimeout(this.animateId); - } - if (this.el.parentNode) { - this.el.parentNode.removeChild(this.el); - } - this.el = undefined; + break; + case 43: + for (var i = 0, n = $$[$0].length; i < n; i++) { + yy.miew.translate($$[$0][i]['x'] || 0, $$[$0][i]['y'] || 0, $$[$0][i]['z'] || 0); } - return this; - }; - return Spinner; - }()); - /** - * Sets multiple style properties at once. - */ - function css(el, props) { - for (var prop in props) { - el.style[prop] = props[prop]; - } - return el; - } - /** - * Returns the line color from the given string or array. - */ - function getColor(color, idx) { - return typeof color == 'string' ? color : color[idx % color.length]; - } - /** - * Internal method that draws the individual lines. - */ - function drawLines(el, opts) { - var borderRadius = (Math.round(opts.corners * opts.width * 500) / 1000) + 'px'; - var shadow = 'none'; - if (opts.shadow === true) { - shadow = '0 2px 4px #000'; // default shadow - } - else if (typeof opts.shadow === 'string') { - shadow = opts.shadow; - } - var shadows = parseBoxShadow(shadow); - for (var i = 0; i < opts.lines; i++) { - var degrees = ~~(360 / opts.lines * i + opts.rotate); - var backgroundLine = css(document.createElement('div'), { - position: 'absolute', - top: -opts.width / 2 + "px", - width: (opts.length + opts.width) + 'px', - height: opts.width + 'px', - background: getColor(opts.fadeColor, i), - borderRadius: borderRadius, - transformOrigin: 'left', - transform: "rotate(" + degrees + "deg) translateX(" + opts.radius + "px)", + break; + case 44: + this.$ = yy.miew.center(); + break; + case 45: + this.$ = yy.miew.center($$[$0]); + break; + case 48: + case 49: + this.$ = yy.miew.addObject({ + type: 'line', + params: [$$[$0 - 1], $$[$0]] + }, true); + break; + case 50: + case 51: + this.$ = yy.miew.addObject({ + type: 'line', + params: [$$[$0 - 2], $$[$0 - 1]], + opts: $$[$0].toJSO(yy.utils, 'objects', 'line') + }, true); + break; + case 52: + this.$ = yy.echo(yy.utils.listObjs(yy.miew)); + break; + case 53: + this.$ = yy.miew.removeObject($$[$0]); + break; + case 54: + this.$ = yy.echo(yy.miew.getURL({ + view: false, + settings: false + })); + break; + case 55: + this.$ = yy.echo(yy.miew.getURL({ + view: false, + settings: true + })); + break; + case 56: + this.$ = yy.echo(yy.miew.getURL({ + view: true, + settings: false + })); + break; + case 57: + case 58: + this.$ = yy.echo(yy.miew.getURL({ + view: true, + settings: true + })); + break; + case 59: + this.$ = yy.miew.screenshotSave(); + break; + case 60: + this.$ = yy.miew.screenshotSave('', Number($$[$0])); + break; + case 61: + this.$ = yy.miew.screenshotSave('', Number($$[$0 - 1]), Number($$[$0])); + break; + case 62: + case 63: + case 64: + this.$ = yy.utils.load(yy.miew, $$[$0]); + yy.representations.clear(); + break; + case 65: + this.$ = yy.echo(yy.representations.add(yy.miew.repAdd())); + break; + case 66: + this.$ = yy.echo(yy.representations.add($$[$0], yy.miew.repAdd())); + break; + case 67: + this.$ = yy.echo(yy.representations.add(yy.miew.repAdd($$[$0]))); + break; + case 68: + this.$ = yy.echo(yy.representations.add($$[$0 - 1], yy.miew.repAdd($$[$0]))); + break; + case 69: + this.$ = yy.miew.rep($$[$0]); + yy.miew.repCurrent($$[$0]); + break; + case 70: + this.$ = yy.miew.rep($$[$0 - 1], $$[$0]); + yy.miew.repCurrent($$[$0 - 1]); + break; + case 71: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + mode: yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0].toUpperCase()) }); - var delay = i * opts.direction / opts.lines / opts.speed; - delay -= 1 / opts.speed; // so initial animation state will include trail - var line = css(document.createElement('div'), { - width: '100%', - height: '100%', - background: getColor(opts.color, i), - borderRadius: borderRadius, - boxShadow: normalizeShadow(shadows, degrees), - animation: 1 / opts.speed + "s linear " + delay + "s infinite " + opts.animation, + break; + case 72: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + mode: new Array(yy.utils.checkArg($$[$0 - 2].toLowerCase(), $$[$0 - 1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0 - 2], $$[$0 - 1].toUpperCase())) }); - backgroundLine.appendChild(line); - el.appendChild(backgroundLine); - } - } - function parseBoxShadow(boxShadow) { - var regex = /^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/; - var shadows = []; - for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) { - var shadow = _a[_i]; - var matches = shadow.match(regex); - if (matches === null) { - continue; // invalid syntax - } - var x = +matches[2]; - var y = +matches[5]; - var xUnits = matches[4]; - var yUnits = matches[7]; - if (x === 0 && !xUnits) { - xUnits = yUnits; - } - if (y === 0 && !yUnits) { - yUnits = xUnits; - } - if (xUnits !== yUnits) { - continue; // units must match to use as coordinates - } - shadows.push({ - prefix: matches[1] || '', - x: x, - y: y, - xUnits: xUnits, - yUnits: yUnits, - end: matches[8], + break; + case 73: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + colorer: yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0].toUpperCase()) }); + break; + case 74: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + colorer: new Array(yy.utils.checkArg($$[$0 - 2].toLowerCase(), $$[$0 - 1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0 - 2], $$[$0 - 1].toUpperCase())) + }); + break; + case 75: + this.$ = Number(yy.representations.get($$[$0])); + break; + case 76: + case 92: + this.$ = Number($$[$0]); + break; + case 77: + this.$ = $$[$0]; + break; + case 78: + this.$ = yy._.assign($$[$0 - 1], $$[$0]); + break; + case 79: + this.$ = yy._.assign($$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 80: + this.$ = yy._.assign($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 81: + case 82: + this.$ = yy.CreateObjectPair($$[$0].key, $$[$0].val); + break; + case 83: + this.$ = yy.CreateObjectPair($$[$0 - 1].key, new Array($$[$0 - 1].val, $$[$0].toJSO(yy.utils, $$[$0 - 1].key, $$[$0 - 1].val))); + break; + case 84: + case 85: + this.$ = Object.create({ + 'key': yy.keyRemap($$[$0 - 2]), + 'val': yy.utils.checkArg($$[$0 - 2], $$[$0]) + }); + break; + case 86: + this.$ = [$$[$0]]; + break; + case 87: + this.$ = $$[$0 - 1].concat($$[$0]); + break; + case 88: + this.$ = yy.CreateObjectPair($$[$0 - 1].toLowerCase(), Number($$[$0])); + break; + case 89: + this.$ = new yy.ArgList($$[$0]); + break; + case 90: + this.$ = $$[$0 - 1].append($$[$0]); + break; + case 91: + this.$ = new yy.Arg($$[$0 - 2], $$[$0]); + break; + case 93: + this.$ = parseInt($$[$0]); + break; + case 94: + this.$ = JSON.parse($$[$0]); + break; + case 95: + case 96: + this.$ = String($$[$0]); + break; + case 157: + case 158: + case 161: + case 162: + case 163: + this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; //cause of could be color word in path; + break; + case 166: + this.$ = $$[$0 - 2] = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + break; } - return shadows; - } - /** - * Modify box-shadow x/y offsets to counteract rotation - */ - function normalizeShadow(shadows, degrees) { - var normalized = []; - for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) { - var shadow = shadows_1[_i]; - var xy = convertOffset(shadow.x, shadow.y, degrees); - normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end); - } - return normalized.join(', '); - } - function convertOffset(x, y, degrees) { - var radians = degrees * Math.PI / 180; - var sin = Math.sin(radians); - var cos = Math.cos(radians); - return [ - Math.round((x * cos + y * sin) * 1000) / 1000, - Math.round((-x * sin + y * cos) * 1000) / 1000, - ]; - } - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - var classCallCheck = _classCallCheck; - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - var createClass = _createClass; - - //---------------------------------------------------------------------------- - // Timer - var Timer = /*#__PURE__*/function () { - function Timer() { - classCallCheck(this, Timer); - - this.startTime = 0; - this.oldTime = 0; - this.elapsedTime = 0; - this.running = false; - } - - createClass(Timer, [{ - key: "start", - value: function start() { - this.startTime = Timer.now(); - this.oldTime = this.startTime; - this.running = true; + }, + table: [{ + 3: 1, + 4: 2, + 5: [1, 3], + 6: [1, 4], + 7: [1, 5], + 9: [1, 6], + 11: [1, 7], + 12: 8, + 13: [1, 9], + 15: [1, 10], + 17: [1, 11], + 18: [1, 12], + 19: [1, 13], + 20: [1, 14], + 21: 15, + 22: 16, + 23: [1, 17], + 25: [1, 18], + 26: [1, 19], + 27: [1, 20], + 30: [1, 21], + 33: [1, 22], + 34: [1, 23], + 37: [1, 24], + 39: 25, + 40: 26, + 41: [1, 27], + 43: [1, 28], + 44: [1, 29], + 45: [1, 30], + 46: [1, 31], + 48: [1, 32], + 49: [1, 33], + 50: 34, + 51: 35, + 52: [1, 36], + 54: [1, 37], + 55: [1, 38], + 56: [1, 44], + 58: [1, 45], + 59: [1, 39], + 62: [1, 40], + 64: [1, 41], + 65: [1, 42], + 66: [1, 43] + }, { + 1: [3] + }, { + 5: [1, 46] + }, { + 1: [2, 2] + }, { + 5: [2, 3] + }, { + 5: [2, 4], + 8: [1, 47] + }, { + 5: [2, 6], + 6: $V0, + 7: $V1, + 9: $V2, + 10: 48, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 8] + }, { + 5: [2, 9] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 10: 106, + 13: $V3, + 14: [1, 107], + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 10: 108, + 13: $V3, + 14: [1, 109], + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 14] + }, { + 5: [2, 15] + }, { + 5: [2, 16] + }, { + 5: [2, 17], + 14: $VS, + 16: 110, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 5: [2, 19] + }, { + 5: [2, 20] + }, { + 24: 116, + 35: $VX, + 38: $VY + }, { + 24: 119, + 35: $VX, + 38: $VY + }, { + 24: 120, + 35: $VX, + 38: $VY + }, { + 5: [2, 25], + 24: 121, + 28: [1, 122], + 29: [1, 123], + 35: $VX, + 38: $VY + }, { + 14: [1, 124] + }, { + 14: [1, 125] + }, { + 35: [1, 126] + }, { + 38: [1, 127] + }, { + 5: [2, 33] + }, { + 5: [2, 34] + }, { + 5: [2, 35], + 14: [1, 128], + 42: [1, 129] + }, { + 5: [2, 38], + 35: [1, 130] + }, { + 5: [2, 40] + }, { + 35: [1, 131] + }, { + 47: 132, + 73: 133, + 74: $VZ + }, { + 47: 135, + 73: 133, + 74: $VZ + }, { + 5: [2, 44], + 14: [1, 136] + }, { + 5: [2, 46] + }, { + 5: [2, 47] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 10: 138, + 13: $V3, + 14: [1, 137], + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 52] + }, { + 35: [1, 139] + }, { + 14: [1, 143], + 38: [1, 141], + 60: 140, + 61: [1, 142] + }, { + 5: [2, 65], + 38: [1, 144], + 63: 145, + 67: 146, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, { + 24: 151, + 35: $VX, + 38: $VY + }, { + 38: [1, 152] + }, { + 38: [1, 153] + }, { + 5: [2, 54], + 29: [1, 154], + 57: [1, 155] + }, { + 5: [2, 59], + 35: [1, 156] + }, { + 1: [2, 1] + }, { + 5: [2, 5] + }, { + 5: [2, 7], + 101: $V01 + }, o($V11, [2, 159]), o($V11, [2, 160]), o($V21, [2, 97]), o($V21, [2, 98]), o($V11, [2, 147]), o($V11, [2, 148]), o($V11, [2, 149]), o($V11, [2, 150]), o($V11, [2, 151]), o($V11, [2, 152]), o($V11, [2, 153]), o($V21, [2, 101]), o($V21, [2, 102]), o($V21, [2, 103]), o($V21, [2, 104]), o($V21, [2, 105]), o($V21, [2, 106]), o($V21, [2, 107]), o($V21, [2, 108]), o($V21, [2, 109]), o($V21, [2, 110]), o($V21, [2, 111]), o($V21, [2, 112]), o($V21, [2, 113]), o($V21, [2, 114]), o($V21, [2, 115]), o($V21, [2, 116]), o($V21, [2, 117]), o($V21, [2, 118]), o($V21, [2, 119]), o($V21, [2, 120]), o($V21, [2, 121]), o($V21, [2, 122]), o($V21, [2, 123]), o($V21, [2, 124]), o($V21, [2, 125]), o($V21, [2, 126]), o($V21, [2, 127]), o($V21, [2, 128]), o($V21, [2, 129]), o($V21, [2, 130]), o($V21, [2, 131]), o($V21, [2, 132]), o($V21, [2, 133]), o($V21, [2, 134]), o($V21, [2, 135]), o($V21, [2, 136]), o($V21, [2, 137]), o($V21, [2, 138]), o($V21, [2, 139]), o($V21, [2, 140]), o($V21, [2, 141]), o($V21, [2, 142]), o($V21, [2, 143]), o($V21, [2, 144]), o($V21, [2, 145]), o($V21, [2, 146]), { + 5: [2, 10], + 101: $V01 + }, { + 5: [2, 11] + }, { + 14: $VS, + 16: 158, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW, + 101: $V01 + }, { + 14: $VS, + 16: 159, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 5: [2, 18] + }, o($V31, [2, 92]), o($V31, [2, 93]), o($V31, [2, 94]), o($V31, [2, 95]), o($V31, [2, 96]), { + 5: [2, 21] + }, o($V41, [2, 75]), o($V41, [2, 76]), { + 5: [2, 22] + }, { + 5: [2, 23] + }, { + 5: [2, 24] + }, { + 5: [2, 26] + }, { + 5: [2, 27] + }, { + 5: [2, 28], + 31: [1, 160] + }, { + 5: [2, 30] + }, { + 36: [1, 161] + }, { + 5: [2, 32] + }, { + 5: [2, 36] + }, { + 5: [2, 37] + }, { + 5: [2, 39] + }, { + 5: [2, 41] + }, { + 5: [2, 42], + 73: 162, + 74: $VZ + }, o($V51, [2, 86]), { + 35: [1, 163] + }, { + 5: [2, 43], + 73: 162, + 74: $VZ + }, { + 5: [2, 45] + }, { + 14: [1, 164] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 10: 165, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR, + 101: $V01 + }, { + 5: [2, 53] + }, { + 5: [2, 62] + }, { + 5: [2, 63] + }, { + 5: [2, 64] + }, { + 5: [2, 164] + }, { + 5: [2, 66], + 63: 166, + 67: 146, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, { + 5: [2, 67] + }, { + 5: [2, 77], + 67: 167, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, o($V41, [2, 81]), o($V41, [2, 82], { + 80: 52, + 53: 168, + 75: 169, + 76: 170, + 79: 171, + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }), { + 71: [1, 172] + }, { + 71: [1, 173] + }, { + 5: [2, 69], + 63: 174, + 67: 146, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, { + 5: [2, 71], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 53: 175, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 169, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 73], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 53: 176, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 169, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 55], + 57: [1, 177] + }, { + 5: [2, 56], + 29: [1, 178] + }, { + 5: [2, 60], + 35: [1, 179] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 35: [1, 181], + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 180, + 80: 52, + 81: 182, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 12] + }, { + 5: [2, 13] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 32: 183, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 184, + 80: 52, + 81: 185, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 14: [1, 186] + }, o($V51, [2, 87]), o($V51, [2, 88]), { + 5: [2, 48], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 53: 187, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 169, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 49], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 53: 188, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 169, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 101: $V01 + }, { + 5: [2, 68] + }, { + 5: [2, 78], + 67: 189, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, o($V41, [2, 83], { + 80: 52, + 76: 170, + 79: 171, + 75: 190, + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }), o($V31, [2, 89]), { + 71: [1, 191], + 101: [1, 192] + }, o($V61, [2, 156]), { + 14: $VS, + 16: 193, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 14: $VS, + 16: 194, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 5: [2, 70] + }, { + 5: [2, 72], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 190, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 74], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 190, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 57] + }, { + 5: [2, 58] + }, { + 5: [2, 61] + }, o($V11, [2, 161]), o($V11, [2, 162]), o($V11, [2, 163]), { + 5: [2, 29] + }, { + 5: [2, 99] + }, { + 5: [2, 100] + }, { + 31: [1, 195] + }, { + 5: [2, 50], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 190, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 51], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 190, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 79], + 67: 196, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, o($V31, [2, 90]), { + 14: $VS, + 16: 197, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 35: [1, 199], + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 79: 198, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, o($V41, [2, 84]), o($V31, [2, 85]), { + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 32: 200, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 184, + 80: 52, + 81: 185, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 80] + }, o($V31, [2, 91]), o($V61, [2, 157]), o($V61, [2, 158]), { + 5: [2, 31] + }], + defaultActions: { + 3: [2, 2], + 4: [2, 3], + 7: [2, 8], + 8: [2, 9], + 11: [2, 14], + 12: [2, 15], + 13: [2, 16], + 15: [2, 19], + 16: [2, 20], + 25: [2, 33], + 26: [2, 34], + 29: [2, 40], + 34: [2, 46], + 35: [2, 47], + 37: [2, 52], + 46: [2, 1], + 47: [2, 5], + 107: [2, 11], + 110: [2, 18], + 116: [2, 21], + 119: [2, 22], + 120: [2, 23], + 121: [2, 24], + 122: [2, 26], + 123: [2, 27], + 125: [2, 30], + 127: [2, 32], + 128: [2, 36], + 129: [2, 37], + 130: [2, 39], + 131: [2, 41], + 136: [2, 45], + 139: [2, 53], + 140: [2, 62], + 141: [2, 63], + 142: [2, 64], + 143: [2, 164], + 145: [2, 67], + 158: [2, 12], + 159: [2, 13], + 166: [2, 68], + 174: [2, 70], + 177: [2, 57], + 178: [2, 58], + 179: [2, 61], + 183: [2, 29], + 184: [2, 99], + 185: [2, 100], + 196: [2, 80], + 200: [2, 31] + }, + parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; } - }, { - key: "stop", - value: function stop() { - this.getElapsedTime(); - this.running = false; + }, + parse: function parse(input) { + var self = this, + stack = [0], + tstack = [], + vstack = [null], + lstack = [], + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer = Object.create(this.lexer); + var sharedState = { + yy: {} + }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } } - }, { - key: "getElapsedTime", - value: function getElapsedTime() { - this.update(); - return this.elapsedTime; + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc == 'undefined') { + lexer.yylloc = {}; } - }, { - key: "update", - value: function update() { - var delta = 0; - - if (this.running) { - var newTime = Timer.now(); - delta = 0.001 * (newTime - this.oldTime); - this.oldTime = newTime; - this.elapsedTime += delta; + var yyloc = lexer.yylloc; + lstack.push(yyloc); + var ranges = lexer.options && lexer.options.ranges; + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = tstack.pop() || lexer.lex() || EOF; + if (typeof token !== 'number') { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); + } + token = self.symbols_[token] || token; + } + return token; + } + var symbol, + preErrorSymbol, + state, + action, + a, + r, + yyval = {}, + p, + len, + newState, + expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); + } + } + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); + } + this.parseError(errStr, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; } - - return delta; } - }]); - - return Timer; - }(); - - Timer.now = function () { - var p = typeof window !== 'undefined' && window.performance; - return p && p.now ? p.now.bind(p) : Date.now; - }(); - - var now = Timer.now; - - function createElement(tag, id, css) { - var element = document.createElement(tag); - element.id = id; - element.style.cssText = css; - return element; - } - - var Stats = /*#__PURE__*/function () { - function Stats() { - classCallCheck(this, Stats); - - this.domElement = createElement('div', 'stats', 'padding:8px'); - this._text = createElement('p', 'fps', 'margin:0;color:silver;font-size:large'); - this.domElement.appendChild(this._text); - this._startTime = now(); - this._prevTime = this._startTime; - this._deltas = new Array(20); - this._index = 0; - this._total = 0.0; - this._count = 0; + return true; } + }; - createClass(Stats, [{ - key: "end", - value: function end() { - var time = now(); - var delta = time - this._startTime; - - if (this._count < this._deltas.length) { - this._count++; + /* generated by jison-lex 0.3.4 */ + var lexer = function () { + var lexer = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); } else { - this._total -= this._deltas[this._index]; + throw new Error(str); } - - this._total += delta; - this._deltas[this._index] = delta; - this._index = (this._index + 1) % this._deltas.length; - this.ms = this._total / this._count; - this.fps = 1000 / this.ms; - - if (time > this._prevTime + 1000) { - this._text.textContent = this.fps.toPrecision(2); - this._prevTime = time; + }, + // resets the lexer, sets new input + setInput: function (input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; } - - return time; - } - }, { - key: "update", - value: function update() { - this._startTime = this.end(); - } - }, { - key: "show", - value: function show(on) { - if (on === undefined) { - on = true; + this.offset = 0; + return this; + }, + // consumes and returns one char from the input + input: function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, + // unshifts one char (or a string) into the input + unput: function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + // When called from action, caches matched text and appends it on next action + more: function () { + this._more = true; + return this; + }, + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, + // retain first n characters of the match + less: function (n) { + this.unput(this.match.slice(n)); + }, + // displays already matched input, i.e. for error messages + pastInput: function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); + }, + // displays upcoming input, i.e. for error messages + upcomingInput: function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: function (match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. + } + return false; + }, + // return next match in input + next: function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + // return next match that has a token + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + // pop the previously active lexer condition state off the condition stack + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + // alias for begin(condition) + pushState: function pushState(condition) { + this.begin(condition); + }, + // return the number of states currently on the stack + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: { + "case-insensitive": true + }, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + /* ignore whitespace */ + break; + case 1: + return ''; + break; + case 2: + return ''; + break; + case 3: + return 42; + break; + case 4: + return 35; + break; + case 5: + return 77; + break; + case 6: + return 78; + break; + case 7: + return 78; + break; + case 8: + return 8; + break; + case 9: + return 6; + break; + case 10: + return 82; + break; + case 11: + return 7; + break; + case 12: + return 9; + break; + case 13: + return 59; + break; + case 14: + return 13; + break; + case 15: + return 15; + break; + case 16: + return 17; + break; + case 17: + return 18; + break; + case 18: + return 19; + break; + case 19: + return 20; + break; + case 20: + return 11; + break; + case 21: + return 62; + break; + case 22: + return 64; + break; + case 23: + return 23; + break; + case 24: + return 25; + break; + case 25: + return 26; + break; + case 26: + return 27; + break; + case 27: + return 30; + break; + case 28: + return 34; + break; + case 29: + return 33; + break; + case 30: + return 65; + break; + case 31: + return 66; + break; + case 32: + return 37; + break; + case 33: + return 41; + break; + case 34: + return 43; + break; + case 35: + return 52; + break; + case 36: + return 54; + break; + case 37: + return 55; + break; + case 38: + return 46; + break; + case 39: + return 48; + break; + case 40: + return 45; + break; + case 41: + return 49; + break; + case 42: + return 56; + break; + case 43: + return 58; + break; + case 44: + return 44; + break; + case 45: + return 83; + break; + case 46: + return 84; + break; + case 47: + return 85; + break; + case 48: + return 86; + break; + case 49: + return 87; + break; + case 50: + return 88; + break; + case 51: + return 89; + break; + case 52: + return 90; + break; + case 53: + return 91; + break; + case 54: + return 92; + break; + case 55: + return 93; + break; + case 56: + return 94; + break; + case 57: + return 95; + break; + case 58: + return 70; + break; + case 59: + return 70; + break; + case 60: + return 72; + break; + case 61: + return 72; + break; + case 62: + return 74; + break; + case 63: + return 74; + break; + case 64: + return 74; + break; + case 65: + return 31; + break; + case 66: + return 36; + break; + case 67: + return 96; + break; + case 68: + return 97; + break; + case 69: + return 98; + break; + case 70: + return 99; + break; + case 71: + yy_.yytext = yy.utils.unquoteString(yy_.yytext); + return 14; + break; + case 72: + return 38; + break; + case 73: + return 5; + break; + case 74: + return 101; + break; + case 75: + return 103; + break; + case 76: + return '\\'; + break; + case 77: + return 28; + break; + case 78: + return 61; + break; + case 79: + return 29; + break; + case 80: + return 57; + break; + case 81: + return 71; + break; + } + }, + rules: [/^(?:\s+)/i, /^(?:[#].*)/i, /^(?:\/\/.*)/i, /^(?:([_A-Z0-9\/\+]+==))/i, /^(?:-?[0-9]+(\.[0-9]+)?\b)/i, /^(?:0[xX][0-9A-F]+\b)/i, /^(?:false\b)/i, /^(?:true\b)/i, /^(?:all\b)/i, /^(?:reset\b)/i, /^(?:clear\b)/i, /^(?:build\b)/i, /^(?:help\b)/i, /^(?:load\b)/i, /^(?:get\b)/i, /^(?:set\b)/i, /^(?:set_save\b)/i, /^(?:set_restore\b)/i, /^(?:set_reset\b)/i, /^(?:preset\b)/i, /^(?:motm\b)/i, /^(?:add\b)/i, /^(?:rep\b)/i, /^(?:remove\b)/i, /^(?:hide\b)/i, /^(?:show\b)/i, /^(?:list\b)/i, /^(?:select\b)/i, /^(?:within\b)/i, /^(?:selector\b)/i, /^(?:mode\b)/i, /^(?:color\b)/i, /^(?:material\b)/i, /^(?:view\b)/i, /^(?:unit\b)/i, /^(?:line\b)/i, /^(?:listobj\b)/i, /^(?:removeobj\b)/i, /^(?:rotate\b)/i, /^(?:translate\b)/i, /^(?:scale\b)/i, /^(?:center\b)/i, /^(?:url\b)/i, /^(?:screenshot\b)/i, /^(?:dssp\b)/i, /^(?:file_list\b)/i, /^(?:file_register\b)/i, /^(?:file_delete\b)/i, /^(?:preset_add\b)/i, /^(?:preset_delete\b)/i, /^(?:preset_update\b)/i, /^(?:preset_rename\b)/i, /^(?:preset_open\b)/i, /^(?:create_scenario\b)/i, /^(?:reset_scenario\b)/i, /^(?:delete_scenario\b)/i, /^(?:add_scenario_item\b)/i, /^(?:list_scenario\b)/i, /^(?:s\b)/i, /^(?:mt\b)/i, /^(?:m\b)/i, /^(?:c\b)/i, /^(?:x\b)/i, /^(?:y\b)/i, /^(?:z\b)/i, /^(?:as\b)/i, /^(?:of\b)/i, /^(?:pdb\b)/i, /^(?:delay\b)/i, /^(?:prst\b)/i, /^(?:desc\b)/i, /^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i, /^(?:([_A-Z0-9]+))/i, /^(?:$)/i, /^(?:\.)/i, /^(?:\/)/i, /^(?:\\)/i, /^(?:-e\b)/i, /^(?:-f\b)/i, /^(?:-s\b)/i, /^(?:-v\b)/i, /^(?:=)/i], + conditions: { + "INITIAL": { + "rules": [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, 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, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81], + "inclusive": true } - - this.domElement.style.display = on ? 'block' : 'none'; - } - }]); - - return Stats; - }(); - - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - var _typeof_1 = createCommonjsModule(function (module) { - function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - module.exports = _typeof = function _typeof(obj) { - return typeof obj; - }; - } else { - module.exports = _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); - } - - module.exports = _typeof; - }); - - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; - } - - var assertThisInitialized = _assertThisInitialized; - - function _possibleConstructorReturn(self, call) { - if (call && (_typeof_1(call) === "object" || typeof call === "function")) { - return call; - } - - return assertThisInitialized(self); - } - - var possibleConstructorReturn = _possibleConstructorReturn; - - var getPrototypeOf = createCommonjsModule(function (module) { - function _getPrototypeOf(o) { - module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); - } - - module.exports = _getPrototypeOf; - }); - - var setPrototypeOf = createCommonjsModule(function (module) { - function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); - } - - module.exports = _setPrototypeOf; - }); - - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true } - }); - if (superClass) setPrototypeOf(subClass, superClass); + }; + return lexer; + }(); + parser.lexer = lexer; + function Parser() { + this.yy = {}; } - - var inherits = _inherits; - - function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; + Parser.prototype = parser; + parser.Parser = Parser; + return new Parser(); +}(); +module.exports = { + parser: parser +}; + +/***/ }), + +/***/ 99: +/***/ ((module) => { + +/* eslint-disable */ +// DO NOT EDIT! Automatically generated from .jison +/* parser generated by jison 0.4.18 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} } - var isNativeFunction = _isNativeFunction; + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), - var construct = createCommonjsModule(function (module) { - function isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, - try { - Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); - return true; - } catch (e) { - return false; + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, } } - function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - module.exports = _construct = Reflect.construct; - } else { - module.exports = _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - return _construct.apply(null, arguments); + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } - module.exports = _construct; - }); - - var wrapNativeSuper = createCommonjsModule(function (module) { - function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !isNativeFunction(Class)) return Class; + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + } +*/ +var parser = function () { + var o = function (k, v, o, l) { + for (o = o || {}, l = k.length; l--; o[k[l]] = v); + return o; + }, + $V0 = [1, 4], + $V1 = [1, 5], + $V2 = [1, 6], + $V3 = [1, 7], + $V4 = [1, 8], + $V5 = [1, 9], + $V6 = [1, 11], + $V7 = [1, 12], + $V8 = [5, 7, 8, 11], + $V9 = [1, 17], + $Va = [1, 22], + $Vb = [1, 20], + $Vc = [1, 21], + $Vd = [5, 7, 8, 11, 19]; + var parser = { + trace: function trace() {}, + yy: {}, + symbols_: { + "error": 2, + "Program": 3, + "Expression": 4, + "EOF": 5, + "Selector": 6, + "OR": 7, + "AND": 8, + "NOT": 9, + "(": 10, + ")": 11, + "SELECTOR": 12, + "NAMED_SELECTOR": 13, + "SELECTOR_RANGED": 14, + "RangeList": 15, + "SELECTOR_NAMED": 16, + "NameList": 17, + "Range": 18, + ",": 19, + "NUMBER": 20, + ":": 21, + "Name": 22, + "IDENTIFIER": 23, + "STRING": 24, + "$accept": 0, + "$end": 1 + }, + terminals_: { + 2: "error", + 5: "EOF", + 7: "OR", + 8: "AND", + 9: "NOT", + 10: "(", + 11: ")", + 12: "SELECTOR", + 13: "NAMED_SELECTOR", + 14: "SELECTOR_RANGED", + 16: "SELECTOR_NAMED", + 19: ",", + 20: "NUMBER", + 21: ":", + 23: "IDENTIFIER", + 24: "STRING" + }, + productions_: [0, [3, 2], [4, 1], [4, 3], [4, 3], [4, 2], [4, 3], [6, 1], [6, 1], [6, 2], [6, 2], [15, 1], [15, 3], [18, 1], [18, 3], [17, 1], [17, 3], [22, 1], [22, 1], [22, 1]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { + /* this == yyval */ - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 3: + this.$ = yy.keyword('or')($$[$0 - 2], $$[$0]); + break; + case 4: + this.$ = yy.keyword('and')($$[$0 - 2], $$[$0]); + break; + case 5: + this.$ = yy.keyword('not')($$[$0]); + break; + case 6: + this.$ = $$[$0 - 1]; + break; + case 7: + this.$ = yy.keyword($$[$0])(); + break; + case 8: + this.$ = yy.GetSelector($$[$0].toLowerCase().slice(1, $$[$0].length)); + break; + case 9: + case 10: + this.$ = yy.keyword($$[$0 - 1])($$[$0]); + break; + case 11: + this.$ = new yy.RangeList($$[$0]); + break; + case 12: + case 16: + this.$ = $$[$0 - 2].append($$[$0]); + break; + case 13: + this.$ = new yy.Range(Number($$[$0])); + break; + case 14: + this.$ = new yy.Range(Number($$[$0 - 2]), Number($$[$0])); + break; + case 15: + this.$ = new yy.ValueList($$[$0]); + break; } - - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - - _cache.set(Class, Wrapper); + }, + table: [{ + 3: 1, + 4: 2, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, { + 1: [3] + }, { + 5: [1, 10], + 7: $V6, + 8: $V7 + }, o($V8, [2, 2]), { + 4: 13, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, { + 4: 14, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, o($V8, [2, 7]), o($V8, [2, 8]), { + 15: 15, + 18: 16, + 20: $V9 + }, { + 17: 18, + 20: $Va, + 22: 19, + 23: $Vb, + 24: $Vc + }, { + 1: [2, 1] + }, { + 4: 23, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, { + 4: 24, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, o($V8, [2, 5]), { + 7: $V6, + 8: $V7, + 11: [1, 25] + }, o($V8, [2, 9], { + 19: [1, 26] + }), o($Vd, [2, 11]), o($Vd, [2, 13], { + 21: [1, 27] + }), o($V8, [2, 10], { + 19: [1, 28] + }), o($Vd, [2, 15]), o($Vd, [2, 17]), o($Vd, [2, 18]), o($Vd, [2, 19]), o([5, 7, 11], [2, 3], { + 8: $V7 + }), o($V8, [2, 4]), o($V8, [2, 6]), { + 18: 29, + 20: $V9 + }, { + 20: [1, 30] + }, { + 20: $Va, + 22: 31, + 23: $Vb, + 24: $Vc + }, o($Vd, [2, 12]), o($Vd, [2, 14]), o($Vd, [2, 16])], + defaultActions: { + 10: [2, 1] + }, + parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; } - - function Wrapper() { - return construct(Class, arguments, getPrototypeOf(this).constructor); + }, + parse: function parse(input) { + var self = this, + stack = [0], + tstack = [], + vstack = [null], + lstack = [], + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer = Object.create(this.lexer); + var sharedState = { + yy: {} + }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } } - - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc == 'undefined') { + lexer.yylloc = {}; + } + var yyloc = lexer.yylloc; + lstack.push(yyloc); + var ranges = lexer.options && lexer.options.ranges; + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = tstack.pop() || lexer.lex() || EOF; + if (typeof token !== 'number') { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); + } + token = self.symbols_[token] || token; + } + return token; + } + var symbol, + preErrorSymbol, + state, + action, + a, + r, + yyval = {}, + p, + len, + newState, + expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); + } + action = table[state] && table[state][symbol]; } - }); - return setPrototypeOf(Wrapper, Class); - }; - - return _wrapNativeSuper(Class); - } - - module.exports = _wrapNativeSuper; - }); - - /** - * This class introduces the simplest event system. - */ - - function isUndefOrEqual(param, value) { - return !param || param === value; - } - /** - * Creates empty dispatcher. - * - * @exports EventDispatcher - * @constructor - */ - + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); + } + } + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); + } + this.parseError(errStr, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; - function EventDispatcher() { - this._handlers = {}; + /* generated by jison-lex 0.3.4 */ + var lexer = function () { + var lexer = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + // resets the lexer, sets new input + setInput: function (input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + // consumes and returns one char from the input + input: function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, + // unshifts one char (or a string) into the input + unput: function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + // When called from action, caches matched text and appends it on next action + more: function () { + this._more = true; + return this; + }, + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, + // retain first n characters of the match + less: function (n) { + this.unput(this.match.slice(n)); + }, + // displays already matched input, i.e. for error messages + pastInput: function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); + }, + // displays upcoming input, i.e. for error messages + upcomingInput: function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: function (match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. + } + return false; + }, + // return next match in input + next: function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + // return next match that has a token + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + // pop the previously active lexer condition state off the condition stack + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + // alias for begin(condition) + pushState: function pushState(condition) { + this.begin(condition); + }, + // return the number of states currently on the stack + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: { + "case-insensitive": true + }, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + /* skip whitespace */ + break; + case 1: + return 20; + break; + case 2: + return 7; + break; + case 3: + return 8; + break; + case 4: + return 9; + break; + case 5: + return 12; + break; + case 6: + return 16; + break; + case 7: + return 14; + break; + case 8: + return 10; + break; + case 9: + return 11; + break; + case 10: + return 19; + break; + case 11: + return 21; + break; + case 12: + return '<='; + break; + case 13: + return '>='; + break; + case 14: + return '<'; + break; + case 15: + return '>'; + break; + case 16: + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); + return 24; + break; + case 17: + return 13; + break; + case 18: + return 23; + break; + case 19: + return 5; + break; + case 20: + return 'INVALID'; + break; + } + }, + rules: [/^(?:\s+)/i, /^(?:(-?(?:[1-9][0-9]+|[0-9]))\b)/i, /^(?:OR\b)/i, /^(?:AND\b)/i, /^(?:NOT\b)/i, /^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\b)/i, /^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\b)/i, /^(?:((SERIAL|SEQUENCE|RESIDX))\b)/i, /^(?:\()/i, /^(?:\))/i, /^(?:,)/i, /^(?::)/i, /^(?:<=)/i, /^(?:>=)/i, /^(?:<)/i, /^(?:>)/i, /^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i, /^(?:(@[_A-Z0-9]+))/i, /^(?:([_A-Z0-9]+))/i, /^(?:$)/i, /^(?:.)/i], + conditions: { + "INITIAL": { + "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], + "inclusive": true + } + } + }; + return lexer; + }(); + parser.lexer = lexer; + function Parser() { + this.yy = {}; } - /** - * Binds callback on specific event type. Optional `context` parameter - * could be used as 'this' for the `callback`. - * @param {string} type Event name. - * @param {function} callback Callback function. - * @param {Object} [context] 'This' object for the callback. - */ - + Parser.prototype = parser; + parser.Parser = Parser; + return new Parser(); +}(); +module.exports = { + parser: parser +}; + +/***/ }), + +/***/ 690: +/***/ (function(__unused_webpack_module, exports) { + +/* +Smooth.js version 0.1.7 + +Turn arrays into smooth functions. + +Copyright 2012 Spencer Cohen +Licensed under MIT license (see "Smooth.js MIT license.txt") +*/ + +/*Constants (these are accessible by Smooth.WHATEVER in user space) +*/ + +(function () { + var AbstractInterpolator, + CubicInterpolator, + Enum, + LinearInterpolator, + NearestInterpolator, + PI, + SincFilterInterpolator, + Smooth, + clipClamp, + clipMirror, + clipPeriodic, + defaultConfig, + getColumn, + getType, + isValidNumber, + k, + makeLanczosWindow, + makeScaledFunction, + makeSincKernel, + normalizeScaleTo, + shallowCopy, + sin, + sinc, + v, + validateNumber, + validateVector, + __hasProp = Object.prototype.hasOwnProperty, + __extends = function (child, parent) { + for (var key in parent) { + if (__hasProp.call(parent, key)) child[key] = parent[key]; + } + function ctor() { + this.constructor = child; + } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + child.__super__ = parent.prototype; + return child; + }; + Enum = { + /*Interpolation methods + */ + METHOD_NEAREST: 'nearest', + METHOD_LINEAR: 'linear', + METHOD_CUBIC: 'cubic', + METHOD_LANCZOS: 'lanczos', + METHOD_SINC: 'sinc', + /*Input clipping modes + */ + CLIP_CLAMP: 'clamp', + CLIP_ZERO: 'zero', + CLIP_PERIODIC: 'periodic', + CLIP_MIRROR: 'mirror', + /* Constants for control over the cubic interpolation tension + */ + CUBIC_TENSION_DEFAULT: 0, + CUBIC_TENSION_CATMULL_ROM: 0 + }; + defaultConfig = { + method: Enum.METHOD_CUBIC, + cubicTension: Enum.CUBIC_TENSION_DEFAULT, + clip: Enum.CLIP_CLAMP, + scaleTo: 0, + sincFilterSize: 2, + sincWindow: void 0 + }; - EventDispatcher.prototype.addEventListener = function (type, callback, context) { - var handlers = this._handlers[type]; + /*Index clipping functions + */ - if (!handlers) { - this._handlers[type] = []; - handlers = this._handlers[type]; - } + clipClamp = function (i, n) { + return Math.max(0, Math.min(i, n - 1)); + }; + clipPeriodic = function (i, n) { + i = i % n; + if (i < 0) i += n; + return i; + }; + clipMirror = function (i, n) { + var period; + period = 2 * (n - 1); + i = clipPeriodic(i, period); + if (i > n - 1) i = period - i; + return i; + }; - var params = [callback, context]; + /* + Abstract scalar interpolation class which provides common functionality for all interpolators + + Subclasses must override interpolate(). + */ - function _checkPar(par) { - return par[0] === params[0] && par[1] === params[1]; + AbstractInterpolator = function () { + function AbstractInterpolator(array, config) { + this.array = array.slice(0); + this.length = this.array.length; + if (!(this.clipHelper = { + clamp: this.clipHelperClamp, + zero: this.clipHelperZero, + periodic: this.clipHelperPeriodic, + mirror: this.clipHelperMirror + }[config.clip])) { + throw "Invalid clip: " + config.clip; + } + } + AbstractInterpolator.prototype.getClippedInput = function (i) { + if (0 <= i && i < this.length) { + return this.array[i]; + } else { + return this.clipHelper(i); + } + }; + AbstractInterpolator.prototype.clipHelperClamp = function (i) { + return this.array[clipClamp(i, this.length)]; + }; + AbstractInterpolator.prototype.clipHelperZero = function (i) { + return 0; + }; + AbstractInterpolator.prototype.clipHelperPeriodic = function (i) { + return this.array[clipPeriodic(i, this.length)]; + }; + AbstractInterpolator.prototype.clipHelperMirror = function (i) { + return this.array[clipMirror(i, this.length)]; + }; + AbstractInterpolator.prototype.interpolate = function (t) { + throw 'Subclasses of AbstractInterpolator must override the interpolate() method.'; + }; + return AbstractInterpolator; + }(); + NearestInterpolator = function (_super) { + __extends(NearestInterpolator, _super); + function NearestInterpolator() { + NearestInterpolator.__super__.constructor.apply(this, arguments); } - - if (_.find(handlers, _checkPar) === undefined) { - handlers.push(params); + NearestInterpolator.prototype.interpolate = function (t) { + return this.getClippedInput(Math.round(t)); + }; + return NearestInterpolator; + }(AbstractInterpolator); + LinearInterpolator = function (_super) { + __extends(LinearInterpolator, _super); + function LinearInterpolator() { + LinearInterpolator.__super__.constructor.apply(this, arguments); + } + LinearInterpolator.prototype.interpolate = function (t) { + var k; + k = Math.floor(t); + t -= k; + return (1 - t) * this.getClippedInput(k) + t * this.getClippedInput(k + 1); + }; + return LinearInterpolator; + }(AbstractInterpolator); + CubicInterpolator = function (_super) { + __extends(CubicInterpolator, _super); + function CubicInterpolator(array, config) { + this.tangentFactor = 1 - Math.max(-1, Math.min(1, config.cubicTension)); + CubicInterpolator.__super__.constructor.apply(this, arguments); + } + CubicInterpolator.prototype.getTangent = function (k) { + return this.tangentFactor * (this.getClippedInput(k + 1) - this.getClippedInput(k - 1)) / 2; + }; + CubicInterpolator.prototype.interpolate = function (t) { + var k, m, p, t2, t3; + k = Math.floor(t); + m = [this.getTangent(k), this.getTangent(k + 1)]; + p = [this.getClippedInput(k), this.getClippedInput(k + 1)]; + t -= k; + t2 = t * t; + t3 = t * t2; + return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + (-2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1]; + }; + return CubicInterpolator; + }(AbstractInterpolator); + sin = Math.sin, PI = Math.PI; + sinc = function (x) { + if (x === 0) { + return 1; + } else { + return sin(PI * x) / (PI * x); } }; - /** - * Removes a previously-bound callback function from an object. - * If no `context` is specified, all versions of the `callback` with different - * contexts will be removed. - * If no `callback` is specified, all callbacks of the `type` will be removed. - * If no `type` is specified, callbacks for all events will be removed. - * @param {?string} [type] Event type. - * @param {function} [callback] Callback function. - * @param {Object} [context] 'This' object for the callback. - */ - - - EventDispatcher.prototype.removeEventListener = function (type, callback, context) { - var self = this; - - _.forEach(self._handlers, function (handler, ev) { - _.remove(handler, function (values) { - return isUndefOrEqual(type, ev) && isUndefOrEqual(callback, values[0]) && isUndefOrEqual(context, values[1] || self); - }); - }); - - this._handlers = _.omitBy(self._handlers, function (handler) { - return handler.length === 0; - }); + makeLanczosWindow = function (a) { + return function (x) { + return sinc(x / a); + }; }; - /** - * Makes all the callbacks for the specific `event` to trigger. - * @param {Object} event Event. - * @param {string} event.type Type of the event. - */ - - - EventDispatcher.prototype.dispatchEvent = function (event) { - var self = this; - - _.forEach(this._handlers[event.type], function (callback) { - var context = callback[1] || self; - callback[0].apply(context, [event]); - }); + makeSincKernel = function (window) { + return function (x) { + return sinc(x) * window(x); + }; }; - - /** - * This module contains class for logging. - * Returns an instance of a logger that have already been created. - * Allows users to log messages for five different levels, - * enable console output and catch signal on each message. - */ - var priorities = { - debug: 0, - info: 1, - report: 2, - warn: 3, - error: 4 + SincFilterInterpolator = function (_super) { + __extends(SincFilterInterpolator, _super); + function SincFilterInterpolator(array, config) { + SincFilterInterpolator.__super__.constructor.apply(this, arguments); + this.a = config.sincFilterSize; + if (!config.sincWindow) throw 'No sincWindow provided'; + this.kernel = makeSincKernel(config.sincWindow); + } + SincFilterInterpolator.prototype.interpolate = function (t) { + var k, n, sum, _ref, _ref2; + k = Math.floor(t); + sum = 0; + for (n = _ref = k - this.a + 1, _ref2 = k + this.a; _ref <= _ref2 ? n <= _ref2 : n >= _ref2; _ref <= _ref2 ? n++ : n--) { + sum += this.kernel(t - n) * this.getClippedInput(n); + } + return sum; + }; + return SincFilterInterpolator; + }(AbstractInterpolator); + getColumn = function (arr, i) { + var row, _i, _len, _results; + _results = []; + for (_i = 0, _len = arr.length; _i < _len; _i++) { + row = arr[_i]; + _results.push(row[i]); + } + return _results; + }; + makeScaledFunction = function (f, baseScale, scaleRange) { + var scaleFactor, translation; + if (scaleRange.join === '0,1') { + return f; + } else { + scaleFactor = baseScale / (scaleRange[1] - scaleRange[0]); + translation = scaleRange[0]; + return function (t) { + return f(scaleFactor * (t - translation)); + }; + } }; - /** - * Create new Logger. - * - * @exports Logger - * @extends EventDispatcher - * @constructor - */ - - function Logger() { - EventDispatcher.call(this); - /** Boolean flag that toggles output to browser console. - * @type {boolean} - */ - - this.console = false; - this._priority = priorities.warn; - } - - Logger.prototype = Object.create(EventDispatcher.prototype); - Logger.prototype.constructor = Logger; - /** - * Create new clean instance of the logger. - * @returns {Logger} - */ - - Logger.prototype.instantiate = function () { - return new Logger(); + getType = function (x) { + return Object.prototype.toString.call(x).slice('[object '.length, -1); }; - - function verify(number) { - if (!_.isNumber(number)) { - throw new Error('Wrong log level specified!'); + validateNumber = function (n) { + if (isNaN(n)) throw 'NaN in Smooth() input'; + if (getType(n) !== 'Number') throw 'Non-number in Smooth() input'; + if (!isFinite(n)) throw 'Infinity in Smooth() input'; + }; + validateVector = function (v, dimension) { + var n, _i, _len; + if (getType(v) !== 'Array') throw 'Non-vector in Smooth() input'; + if (v.length !== dimension) throw 'Inconsistent dimension in Smooth() input'; + for (_i = 0, _len = v.length; _i < _len; _i++) { + n = v[_i]; + validateNumber(n); } - - return number; - } - /** - * @property {string} current threshold for signals and console output. - * @name Logger#level - */ - - - Object.defineProperty(Logger.prototype, 'level', { - get: function get() { - var _this = this; - - return _.findKey(priorities, function (value) { - return value === _this._priority; - }); - }, - set: function set(level) { - this._priority = verify(priorities[level]); + }; + isValidNumber = function (n) { + return getType(n) === 'Number' && isFinite(n) && !isNaN(n); + }; + normalizeScaleTo = function (s) { + var invalidErr; + invalidErr = "scaleTo param must be number or array of two numbers"; + switch (getType(s)) { + case 'Number': + if (!isValidNumber(s)) throw invalidErr; + s = [0, s]; + break; + case 'Array': + if (s.length !== 2) throw invalidErr; + if (!(isValidNumber(s[0]) && isValidNumber(s[1]))) throw invalidErr; + break; + default: + throw invalidErr; + } + return s; + }; + shallowCopy = function (obj) { + var copy, k, v; + copy = {}; + for (k in obj) { + if (!__hasProp.call(obj, k)) continue; + v = obj[k]; + copy[k] = v; + } + return copy; + }; + Smooth = function (arr, config) { + var baseDomainEnd, dimension, i, interpolator, interpolatorClass, interpolators, k, n, properties, smoothFunc, v; + if (config == null) config = {}; + properties = {}; + config = shallowCopy(config); + properties.config = shallowCopy(config); + if (config.scaleTo == null) config.scaleTo = config.period; + if (config.sincFilterSize == null) { + config.sincFilterSize = config.lanczosFilterSize; + } + for (k in defaultConfig) { + if (!__hasProp.call(defaultConfig, k)) continue; + v = defaultConfig[k]; + if (config[k] == null) config[k] = v; + } + if (!(interpolatorClass = { + nearest: NearestInterpolator, + linear: LinearInterpolator, + cubic: CubicInterpolator, + lanczos: SincFilterInterpolator, + sinc: SincFilterInterpolator + }[config.method])) { + throw "Invalid method: " + config.method; + } + if (config.method === 'lanczos') { + config.sincWindow = makeLanczosWindow(config.sincFilterSize); + } + if (arr.length < 2) throw 'Array must have at least two elements'; + properties.count = arr.length; + smoothFunc = function () { + var _i, _j, _len, _len2; + switch (getType(arr[0])) { + case 'Number': + properties.dimension = 'scalar'; + if (Smooth.deepValidation) { + for (_i = 0, _len = arr.length; _i < _len; _i++) { + n = arr[_i]; + validateNumber(n); + } + } + interpolator = new interpolatorClass(arr, config); + return function (t) { + return interpolator.interpolate(t); + }; + case 'Array': + properties.dimension = dimension = arr[0].length; + if (!dimension) throw 'Vectors must be non-empty'; + if (Smooth.deepValidation) { + for (_j = 0, _len2 = arr.length; _j < _len2; _j++) { + v = arr[_j]; + validateVector(v, dimension); + } + } + interpolators = function () { + var _results; + _results = []; + for (i = 0; 0 <= dimension ? i < dimension : i > dimension; 0 <= dimension ? i++ : i--) { + _results.push(new interpolatorClass(getColumn(arr, i), config)); + } + return _results; + }(); + return function (t) { + var interpolator, _k, _len3, _results; + _results = []; + for (_k = 0, _len3 = interpolators.length; _k < _len3; _k++) { + interpolator = interpolators[_k]; + _results.push(interpolator.interpolate(t)); + } + return _results; + }; + default: + throw "Invalid element type: " + getType(arr[0]); + } + }(); + if (config.clip === 'periodic') { + baseDomainEnd = arr.length; + } else { + baseDomainEnd = arr.length - 1; } - }); - /** - * Returns the list of all possible level values. - * @returns {Array} - */ - - Logger.prototype.levels = function () { - return Object.keys(priorities); + config.scaleTo || (config.scaleTo = baseDomainEnd); + properties.domain = normalizeScaleTo(config.scaleTo); + smoothFunc = makeScaledFunction(smoothFunc, baseDomainEnd, properties.domain); + properties.domain.sort(); + /*copy properties + */ + for (k in properties) { + if (!__hasProp.call(properties, k)) continue; + v = properties[k]; + smoothFunc[k] = v; + } + return smoothFunc; }; - /** - * Add new message with specified level. - * @param {string} level - level of the message, must be one of the - * {'debug' | 'info' | 'report' | 'warn' | 'error'} - * @param {string} message - */ - + for (k in Enum) { + if (!__hasProp.call(Enum, k)) continue; + v = Enum[k]; + Smooth[k] = v; + } + Smooth.deepValidation = true; + ( true && exports !== null ? exports : window).Smooth = Smooth; +}).call(this); - Logger.prototype.message = function (level, message) { - var priority = verify(priorities[level]); +/***/ }), - this._message(priority, message); - }; - /** - * Shortcut for message('debug', ...); - * @param message - */ +/***/ 660: +/***/ (function(module, exports) { +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!function (r, t) { + if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (t), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {} +}(this, function (r) { + "use strict"; - Logger.prototype.debug = function (message) { - this._message(priorities.debug, message); - }; - /** - * Shortcut for message('info', ...); - * @param message - */ - - - Logger.prototype.info = function (message) { - this._message(priorities.info, message); - }; - /** - * Shortcut for message('report', ...); - * @param message - */ - - - Logger.prototype.report = function (message) { - this._message(priorities.report, message); - }; - /** - * Shortcut for message('warn', ...); - * @param message - */ - - - Logger.prototype.warn = function (message) { - this._message(priorities.warn, message); - }; + function t(r, t, n) { + for (var e = (r.byteLength, 0), i = n.length; i > e; e++) { + var o = n.charCodeAt(e); + if (128 > o) r.setUint8(t++, o >>> 0 & 127 | 0);else if (2048 > o) r.setUint8(t++, o >>> 6 & 31 | 192), r.setUint8(t++, o >>> 0 & 63 | 128);else if (65536 > o) r.setUint8(t++, o >>> 12 & 15 | 224), r.setUint8(t++, o >>> 6 & 63 | 128), r.setUint8(t++, o >>> 0 & 63 | 128);else { + if (!(1114112 > o)) throw new Error("bad codepoint " + o); + r.setUint8(t++, o >>> 18 & 7 | 240), r.setUint8(t++, o >>> 12 & 63 | 128), r.setUint8(t++, o >>> 6 & 63 | 128), r.setUint8(t++, o >>> 0 & 63 | 128); + } + } + } + function n(r) { + for (var t = 0, n = 0, e = r.length; e > n; n++) { + var i = r.charCodeAt(n); + if (128 > i) t += 1;else if (2048 > i) t += 2;else if (65536 > i) t += 3;else { + if (!(1114112 > i)) throw new Error("bad codepoint " + i); + t += 4; + } + } + return t; + } + function e(r, i, o) { + var a = typeof r; + if ("string" === a) { + var u = n(r); + if (32 > u) return i.setUint8(o, 160 | u), t(i, o + 1, r), 1 + u; + if (256 > u) return i.setUint8(o, 217), i.setUint8(o + 1, u), t(i, o + 2, r), 2 + u; + if (65536 > u) return i.setUint8(o, 218), i.setUint16(o + 1, u), t(i, o + 3, r), 3 + u; + if (4294967296 > u) return i.setUint8(o, 219), i.setUint32(o + 1, u), t(i, o + 5, r), 5 + u; + } + if (r instanceof Uint8Array) { + var u = r.byteLength, + s = new Uint8Array(i.buffer); + if (256 > u) return i.setUint8(o, 196), i.setUint8(o + 1, u), s.set(r, o + 2), 2 + u; + if (65536 > u) return i.setUint8(o, 197), i.setUint16(o + 1, u), s.set(r, o + 3), 3 + u; + if (4294967296 > u) return i.setUint8(o, 198), i.setUint32(o + 1, u), s.set(r, o + 5), 5 + u; + } + if ("number" === a) { + if (!isFinite(r)) throw new Error("Number not finite: " + r); + if (Math.floor(r) !== r) return i.setUint8(o, 203), i.setFloat64(o + 1, r), 9; + if (r >= 0) { + if (128 > r) return i.setUint8(o, r), 1; + if (256 > r) return i.setUint8(o, 204), i.setUint8(o + 1, r), 2; + if (65536 > r) return i.setUint8(o, 205), i.setUint16(o + 1, r), 3; + if (4294967296 > r) return i.setUint8(o, 206), i.setUint32(o + 1, r), 5; + throw new Error("Number too big 0x" + r.toString(16)); + } + if (r >= -32) return i.setInt8(o, r), 1; + if (r >= -128) return i.setUint8(o, 208), i.setInt8(o + 1, r), 2; + if (r >= -32768) return i.setUint8(o, 209), i.setInt16(o + 1, r), 3; + if (r >= -2147483648) return i.setUint8(o, 210), i.setInt32(o + 1, r), 5; + throw new Error("Number too small -0x" + (-r).toString(16).substr(1)); + } + if (null === r) return i.setUint8(o, 192), 1; + if ("boolean" === a) return i.setUint8(o, r ? 195 : 194), 1; + if ("object" === a) { + var u, + f = 0, + c = Array.isArray(r); + if (c) u = r.length;else { + var d = Object.keys(r); + u = d.length; + } + var f; + if (16 > u ? (i.setUint8(o, u | (c ? 144 : 128)), f = 1) : 65536 > u ? (i.setUint8(o, c ? 220 : 222), i.setUint16(o + 1, u), f = 3) : 4294967296 > u && (i.setUint8(o, c ? 221 : 223), i.setUint32(o + 1, u), f = 5), c) for (var l = 0; u > l; l++) f += e(r[l], i, o + f);else for (var l = 0; u > l; l++) { + var v = d[l]; + f += e(v, i, o + f), f += e(r[v], i, o + f); + } + return f; + } + throw new Error("Unknown type " + a); + } + function i(r) { + var t = typeof r; + if ("string" === t) { + var e = n(r); + if (32 > e) return 1 + e; + if (256 > e) return 2 + e; + if (65536 > e) return 3 + e; + if (4294967296 > e) return 5 + e; + } + if (r instanceof Uint8Array) { + var e = r.byteLength; + if (256 > e) return 2 + e; + if (65536 > e) return 3 + e; + if (4294967296 > e) return 5 + e; + } + if ("number" === t) { + if (Math.floor(r) !== r) return 9; + if (r >= 0) { + if (128 > r) return 1; + if (256 > r) return 2; + if (65536 > r) return 3; + if (4294967296 > r) return 5; + throw new Error("Number too big 0x" + r.toString(16)); + } + if (r >= -32) return 1; + if (r >= -128) return 2; + if (r >= -32768) return 3; + if (r >= -2147483648) return 5; + throw new Error("Number too small -0x" + r.toString(16).substr(1)); + } + if ("boolean" === t || null === r) return 1; + if ("object" === t) { + var e, + o = 0; + if (Array.isArray(r)) { + e = r.length; + for (var a = 0; e > a; a++) o += i(r[a]); + } else { + var u = Object.keys(r); + e = u.length; + for (var a = 0; e > a; a++) { + var s = u[a]; + o += i(s) + i(r[s]); + } + } + if (16 > e) return 1 + o; + if (65536 > e) return 3 + o; + if (4294967296 > e) return 5 + o; + throw new Error("Array or object too long 0x" + e.toString(16)); + } + throw new Error("Unknown type " + t); + } + function o(r) { + var t = new ArrayBuffer(i(r)), + n = new DataView(t); + return e(r, n, 0), new Uint8Array(t); + } + function a(r, t, n) { + return t ? new r(t.buffer, t.byteOffset, t.byteLength / (n || 1)) : void 0; + } + function u(r) { + return a(DataView, r); + } + function s(r) { + return a(Uint8Array, r); + } + function f(r) { + return a(Int8Array, r); + } + function c(r) { + return a(Int32Array, r, 4); + } + function d(r) { + return a(Float32Array, r, 4); + } + function l(r, t) { + var n = r.length / 2; + t || (t = new Int16Array(n)); + for (var e = 0, i = 0; n > e; ++e, i += 2) t[e] = r[i] << 8 ^ r[i + 1] << 0; + return t; + } + function v(r, t) { + var n = r.length; + t || (t = new Uint8Array(2 * n)); + for (var e = u(t), i = 0; n > i; ++i) e.setInt16(2 * i, r[i]); + return s(t); + } + function g(r, t) { + var n = r.length / 4; + t || (t = new Int32Array(n)); + for (var e = 0, i = 0; n > e; ++e, i += 4) t[e] = r[i] << 24 ^ r[i + 1] << 16 ^ r[i + 2] << 8 ^ r[i + 3] << 0; + return t; + } + function L(r, t) { + var n = r.length; + t || (t = new Uint8Array(4 * n)); + for (var e = u(t), i = 0; n > i; ++i) e.setInt32(4 * i, r[i]); + return s(t); + } + function h(r, t) { + var n = r.length; + t || (t = new Float32Array(n / 4)); + for (var e = u(t), i = u(r), o = 0, a = 0, s = n / 4; s > o; ++o, a += 4) e.setFloat32(a, i.getFloat32(a), !0); + return t; + } + function y(r, t, n) { + var e = r.length, + i = 1 / t; + n || (n = new Float32Array(e)); + for (var o = 0; e > o; ++o) n[o] = r[o] * i; + return n; + } + function m(r, t, n) { + var e = r.length; + n || (n = new Int32Array(e)); + for (var i = 0; e > i; ++i) n[i] = Math.round(r[i] * t); + return n; + } + function p(r, t) { + var n, e; + if (!t) { + var i = 0; + for (n = 0, e = r.length; e > n; n += 2) i += r[n + 1]; + t = new r.constructor(i); + } + var o = 0; + for (n = 0, e = r.length; e > n; n += 2) for (var a = r[n], u = r[n + 1], s = 0; u > s; ++s) t[o] = a, ++o; + return t; + } + function U(r) { + if (0 === r.length) return new Int32Array(); + var t, + n, + e = 2; + for (t = 1, n = r.length; n > t; ++t) r[t - 1] !== r[t] && (e += 2); + var i = new Int32Array(e), + o = 0, + a = 1; + for (t = 1, n = r.length; n > t; ++t) r[t - 1] !== r[t] ? (i[o] = r[t - 1], i[o + 1] = a, a = 1, o += 2) : ++a; + return i[o] = r[r.length - 1], i[o + 1] = a, i; + } + function b(r, t) { + var n = r.length; + t || (t = new r.constructor(n)), n && (t[0] = r[0]); + for (var e = 1; n > e; ++e) t[e] = r[e] + t[e - 1]; + return t; + } + function I(r, t) { + var n = r.length; + t || (t = new r.constructor(n)), t[0] = r[0]; + for (var e = 1; n > e; ++e) t[e] = r[e] - r[e - 1]; + return t; + } + function w(r, t) { + var n, + e, + i = r instanceof Int8Array ? 127 : 32767, + o = -i - 1, + a = r.length; + if (!t) { + var u = 0; + for (n = 0; a > n; ++n) r[n] < i && r[n] > o && ++u; + t = new Int32Array(u); + } + for (n = 0, e = 0; a > n;) { + for (var s = 0; r[n] === i || r[n] === o;) s += r[n], ++n; + s += r[n], ++n, t[e] = s, ++e; + } + return t; + } + function C(r, t) { + var n, + e = t ? 127 : 32767, + i = -e - 1, + o = r.length, + a = 0; + for (n = 0; o > n; ++n) { + var u = r[n]; + 0 === u ? ++a : a += u === e || u === i ? 2 : u > 0 ? Math.ceil(u / e) : Math.ceil(u / i); + } + var s = t ? new Int8Array(a) : new Int16Array(a), + f = 0; + for (n = 0; o > n; ++n) { + var u = r[n]; + if (u >= 0) for (; u >= e;) s[f] = e, ++f, u -= e;else for (; i >= u;) s[f] = i, ++f, u -= i; + s[f] = u, ++f; + } + return s; + } + function A(r, t) { + return b(p(r), t); + } + function x(r) { + return U(I(r)); + } + function M(r, t, n) { + return y(p(r, c(n)), t, n); + } + function F(r, t) { + return U(m(r, t)); + } + function S(r, t, n) { + return y(b(r, c(n)), t, n); + } + function E(r, t, n) { + return I(m(r, t), n); + } + function N(r, t, n) { + return y(w(r, c(n)), t, n); + } + function O(r, t, n) { + var e = w(r, c(n)); + return S(e, t, d(e)); + } + function T(r, t, n) { + return C(E(r, t), n); + } + function k(r) { + var t = u(r), + n = t.getInt32(0), + e = t.getInt32(4), + i = r.subarray(8, 12), + r = r.subarray(12); + return [n, r, e, i]; + } + function j(r, t, n, e) { + var i = new ArrayBuffer(12 + e.byteLength), + o = new Uint8Array(i), + a = new DataView(i); + return a.setInt32(0, r), a.setInt32(4, t), n && o.set(n, 8), o.set(e, 12), o; + } + function q(r) { + var t = r.length, + n = s(r); + return j(2, t, void 0, n); + } + function D(r) { + var t = r.length, + n = L(r); + return j(4, t, void 0, n); + } + function P(r, t) { + var n = r.length / t, + e = L([t]), + i = s(r); + return j(5, n, e, i); + } + function z(r) { + var t = r.length, + n = L(U(r)); + return j(6, t, void 0, n); + } + function B(r) { + var t = r.length, + n = L(x(r)); + return j(8, t, void 0, n); + } + function V(r, t) { + var n = r.length, + e = L([t]), + i = L(F(r, t)); + return j(9, n, e, i); + } + function G(r, t) { + var n = r.length, + e = L([t]), + i = v(T(r, t)); + return j(10, n, e, i); + } + function R(r) { + var t = {}; + return rr.forEach(function (n) { + void 0 !== r[n] && (t[n] = r[n]); + }), r.bondAtomList && (t.bondAtomList = D(r.bondAtomList)), r.bondOrderList && (t.bondOrderList = q(r.bondOrderList)), t.xCoordList = G(r.xCoordList, 1e3), t.yCoordList = G(r.yCoordList, 1e3), t.zCoordList = G(r.zCoordList, 1e3), r.bFactorList && (t.bFactorList = G(r.bFactorList, 100)), r.atomIdList && (t.atomIdList = B(r.atomIdList)), r.altLocList && (t.altLocList = z(r.altLocList)), r.occupancyList && (t.occupancyList = V(r.occupancyList, 100)), t.groupIdList = B(r.groupIdList), t.groupTypeList = D(r.groupTypeList), r.secStructList && (t.secStructList = q(r.secStructList, 1)), r.insCodeList && (t.insCodeList = z(r.insCodeList)), r.sequenceIndexList && (t.sequenceIndexList = B(r.sequenceIndexList)), t.chainIdList = P(r.chainIdList, 4), r.chainNameList && (t.chainNameList = P(r.chainNameList, 4)), t; + } + function H(r) { + function t(r) { + for (var t = {}, n = 0; r > n; n++) { + var e = o(); + t[e] = o(); + } + return t; + } + function n(t) { + var n = r.subarray(a, a + t); + return a += t, n; + } + function e(t) { + var n = r.subarray(a, a + t); + a += t; + var e = 65535; + if (t > e) { + for (var i = [], o = 0; o < n.length; o += e) i.push(String.fromCharCode.apply(null, n.subarray(o, o + e))); + return i.join(""); + } + return String.fromCharCode.apply(null, n); + } + function i(r) { + for (var t = new Array(r), n = 0; r > n; n++) t[n] = o(); + return t; + } + function o() { + var o, + s, + f = r[a]; + if (0 === (128 & f)) return a++, f; + if (128 === (240 & f)) return s = 15 & f, a++, t(s); + if (144 === (240 & f)) return s = 15 & f, a++, i(s); + if (160 === (224 & f)) return s = 31 & f, a++, e(s); + if (224 === (224 & f)) return o = u.getInt8(a), a++, o; + switch (f) { + case 192: + return a++, null; + case 194: + return a++, !1; + case 195: + return a++, !0; + case 196: + return s = u.getUint8(a + 1), a += 2, n(s); + case 197: + return s = u.getUint16(a + 1), a += 3, n(s); + case 198: + return s = u.getUint32(a + 1), a += 5, n(s); + case 202: + return o = u.getFloat32(a + 1), a += 5, o; + case 203: + return o = u.getFloat64(a + 1), a += 9, o; + case 204: + return o = r[a + 1], a += 2, o; + case 205: + return o = u.getUint16(a + 1), a += 3, o; + case 206: + return o = u.getUint32(a + 1), a += 5, o; + case 208: + return o = u.getInt8(a + 1), a += 2, o; + case 209: + return o = u.getInt16(a + 1), a += 3, o; + case 210: + return o = u.getInt32(a + 1), a += 5, o; + case 217: + return s = u.getUint8(a + 1), a += 2, e(s); + case 218: + return s = u.getUint16(a + 1), a += 3, e(s); + case 219: + return s = u.getUint32(a + 1), a += 5, e(s); + case 220: + return s = u.getUint16(a + 1), a += 3, i(s); + case 221: + return s = u.getUint32(a + 1), a += 5, i(s); + case 222: + return s = u.getUint16(a + 1), a += 3, t(s); + case 223: + return s = u.getUint32(a + 1), a += 5, t(s); + } + throw new Error("Unknown type 0x" + f.toString(16)); + } + var a = 0, + u = new DataView(r.buffer); + return o(); + } + function W(r, t, n, e) { + switch (r) { + case 1: + return h(t); + case 2: + return f(t); + case 3: + return l(t); + case 4: + return g(t); + case 5: + return s(t); + case 6: + return p(g(t), new Uint8Array(n)); + case 7: + return p(g(t)); + case 8: + return A(g(t)); + case 9: + return M(g(t), g(e)[0]); + case 10: + return O(l(t), g(e)[0]); + case 11: + return y(l(t), g(e)[0]); + case 12: + return N(l(t), g(e)[0]); + case 13: + return N(f(t), g(e)[0]); + case 14: + return w(l(t)); + case 15: + return w(f(t)); + } + } + function X(r, t) { + t = t || {}; + var n = t.ignoreFields, + e = {}; + return nr.forEach(function (t) { + var i = n ? -1 !== n.indexOf(t) : !1, + o = r[t]; + i || void 0 === o || (o instanceof Uint8Array ? e[t] = W.apply(null, k(o)) : e[t] = o); + }), e; + } + function J(r) { + return String.fromCharCode.apply(null, r).replace(/\0/g, ""); + } + function K(r, t, n) { + n = n || {}; + var e, + i, + o, + a, + u, + s, + f = n.firstModelOnly, + c = t.onModel, + d = t.onChain, + l = t.onGroup, + v = t.onAtom, + g = t.onBond, + L = 0, + h = 0, + y = 0, + m = 0, + p = 0, + U = -1, + b = r.chainNameList, + I = r.secStructList, + w = r.insCodeList, + C = r.sequenceIndexList, + A = r.atomIdList, + x = r.bFactorList, + M = r.altLocList, + F = r.occupancyList, + S = r.bondAtomList, + E = r.bondOrderList; + for (e = 0, i = r.chainsPerModel.length; i > e && !(f && L > 0); ++e) { + var N = r.chainsPerModel[L]; + for (c && c({ + chainCount: N, + modelIndex: L + }), o = 0; N > o; ++o) { + var O = r.groupsPerChain[h]; + if (d) { + var T = J(r.chainIdList.subarray(4 * h, 4 * h + 4)), + k = null; + b && (k = J(b.subarray(4 * h, 4 * h + 4))), d({ + groupCount: O, + chainIndex: h, + modelIndex: L, + chainId: T, + chainName: k + }); + } + for (a = 0; O > a; ++a) { + var j = r.groupList[r.groupTypeList[y]], + q = j.atomNameList.length; + if (l) { + var D = null; + I && (D = I[y]); + var P = null; + r.insCodeList && (P = String.fromCharCode(w[y])); + var z = null; + C && (z = C[y]), l({ + atomCount: q, + groupIndex: y, + chainIndex: h, + modelIndex: L, + groupId: r.groupIdList[y], + groupType: r.groupTypeList[y], + groupName: j.groupName, + singleLetterCode: j.singleLetterCode, + chemCompType: j.chemCompType, + secStruct: D, + insCode: P, + sequenceIndex: z + }); + } + for (u = 0; q > u; ++u) { + if (v) { + var B = null; + A && (B = A[m]); + var V = null; + x && (V = x[m]); + var G = null; + M && (G = String.fromCharCode(M[m])); + var R = null; + F && (R = F[m]), v({ + atomIndex: m, + groupIndex: y, + chainIndex: h, + modelIndex: L, + atomId: B, + element: j.elementList[u], + atomName: j.atomNameList[u], + formalCharge: j.formalChargeList[u], + xCoord: r.xCoordList[m], + yCoord: r.yCoordList[m], + zCoord: r.zCoordList[m], + bFactor: V, + altLoc: G, + occupancy: R + }); + } + m += 1; + } + if (g) { + var H = j.bondAtomList; + for (u = 0, s = j.bondOrderList.length; s > u; ++u) g({ + atomIndex1: m - q + H[2 * u], + atomIndex2: m - q + H[2 * u + 1], + bondOrder: j.bondOrderList[u] + }); + } + y += 1; + } + h += 1; + } + if (p = U + 1, U = m - 1, g && S) for (u = 0, s = S.length; s > u; u += 2) { + var W = S[u], + X = S[u + 1]; + (W >= p && U >= W || X >= p && U >= X) && g({ + atomIndex1: W, + atomIndex2: X, + bondOrder: E ? E[u / 2] : null + }); + } + L += 1; + } + } + function Q(r) { + return o(R(r)); + } + function Y(r, t) { + r instanceof ArrayBuffer && (r = new Uint8Array(r)); + var n; + return n = r instanceof Uint8Array ? H(r) : r, X(n, t); + } + function Z(r, t, n, e) { + function i() { + try { + var r = Y(o.response); + n(r); + } catch (t) { + e(t); + } + } + var o = new XMLHttpRequest(); + o.addEventListener("load", i, !0), o.addEventListener("error", e, !0), o.responseType = "arraybuffer", o.open("GET", t + r.toUpperCase()), o.send(); + } + function $(r, t, n) { + Z(r, or, t, n); + } + function _(r, t, n) { + Z(r, ar, t, n); + } + var rr = ["mmtfVersion", "mmtfProducer", "unitCell", "spaceGroup", "structureId", "title", "depositionDate", "releaseDate", "experimentalMethods", "resolution", "rFree", "rWork", "bioAssemblyList", "ncsOperatorList", "entityList", "groupList", "numBonds", "numAtoms", "numGroups", "numChains", "numModels", "groupsPerChain", "chainsPerModel"], + tr = ["xCoordList", "yCoordList", "zCoordList", "groupIdList", "groupTypeList", "chainIdList", "bFactorList", "atomIdList", "altLocList", "occupancyList", "secStructList", "insCodeList", "sequenceIndexList", "chainNameList", "bondAtomList", "bondOrderList"], + nr = rr.concat(tr), + er = "v1.1.0dev", + ir = "//mmtf.rcsb.org/v1.0/", + or = ir + "full/", + ar = ir + "reduced/"; + r.encode = Q, r.decode = Y, r.traverse = K, r.fetch = $, r.fetchReduced = _, r.version = er, r.fetchUrl = or, r.fetchReducedUrl = ar, r.encodeMsgpack = o, r.encodeMmtf = R, r.decodeMsgpack = H, r.decodeMmtf = X; +}); + +/***/ }), + +/***/ 535: +/***/ ((module) => { + +"use strict"; +module.exports = __WEBPACK_EXTERNAL_MODULE__535__; + +/***/ }), + +/***/ 698: +/***/ ((module) => { + +"use strict"; +module.exports = __WEBPACK_EXTERNAL_MODULE__698__; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "default": () => (/* binding */ src) +}); + +// EXTERNAL MODULE: external {"module":"lodash","commonjs":"lodash","commonjs2":"lodash","amd":"lodash","root":"_"} +var external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_ = __webpack_require__(535); +var external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default = /*#__PURE__*/__webpack_require__.n(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_); +// EXTERNAL MODULE: external {"module":"three","commonjs":"three","commonjs2":"three","amd":"three","root":"THREE"} +var external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_ = __webpack_require__(698); +;// CONCATENATED MODULE: ../../node_modules/spin.js/spin.js +var __assign = undefined && undefined.__assign || function () { + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var defaults = { + lines: 12, + length: 7, + width: 5, + radius: 10, + scale: 1.0, + corners: 1, + color: '#000', + fadeColor: 'transparent', + animation: 'spinner-line-fade-default', + rotate: 0, + direction: 1, + speed: 1, + zIndex: 2e9, + className: 'spinner', + top: '50%', + left: '50%', + shadow: '0 0 1px transparent', + // prevent aliased lines + position: 'absolute' +}; +var Spinner = /** @class */function () { + function Spinner(opts) { + if (opts === void 0) { + opts = {}; + } + this.opts = __assign(__assign({}, defaults), opts); + } /** - * Shortcut for message('error', ...); - * @param message + * Adds the spinner to the given target element. If this instance is already + * spinning, it is automatically removed from its previous target by calling + * stop() internally. */ - - - Logger.prototype.error = function (message) { - this._message(priorities.error, message); + Spinner.prototype.spin = function (target) { + this.stop(); + this.el = document.createElement('div'); + this.el.className = this.opts.className; + this.el.setAttribute('role', 'progressbar'); + this.el.style.position = this.opts.position; + this.el.style.width = "0"; + this.el.style.zIndex = this.opts.zIndex.toString(); + this.el.style.left = this.opts.left; + this.el.style.top = this.opts.top; + this.el.style.transform = "scale(".concat(this.opts.scale, ")"); + if (target) { + target.insertBefore(this.el, target.firstChild || null); + } + drawLines(this.el, this.opts); + return this; }; /** - * Add new message with specified priority. - * @param {number} priority - priority of the message - * @param {string} message - * @private + * Stops and removes the Spinner. + * Stopped spinners may be reused by calling spin() again. */ - - - Logger.prototype._message = function (priority, message) { - if (priority < this._priority) { - return; - } - - var level = _.findKey(priorities, function (value) { - return value === priority; - }); - - message = String(message); - - if (this.console) { - var output = "miew:".concat(level, ": ").concat(message); - - if (level === 'error') { - console.error(output); // NOSONAR - } else if (level === 'warn') { - console.warn(output); // NOSONAR - } else { - console.log(output); // NOSONAR + Spinner.prototype.stop = function () { + if (this.el) { + if (this.el.parentNode) { + this.el.parentNode.removeChild(this.el); } + this.el = undefined; } - - this.dispatchEvent({ - type: 'message', - level: level, - message: message - }); + return this; }; - - var logger = new Logger(); - - var browserType = { - DEFAULT: 0, - SAFARI: 1 - }; //---------------------------------------------------------------------------- - // Query string - - /** - * Escape only dangerous chars in a query string component, use a plus instead of a space. - * - * [RFC 3986](https://tools.ietf.org/html/rfc3986) allows the following chars in the query (see 3.4): - * - * A-Z a-z 0-9 - _ . ~ ! $ & ' ( ) * + , ; = : @ / ? - * - * For query string elements we need to escape ampersand, equal sign, and plus, - * but encodeURIComponent() function encodes anything except for the following: - * - * A-Z a-z 0-9 - _ . ~ ! ' ( ) * - * - * @param {string} text - key or value to encode - * @param {string} excludeExp - regexp for symbols to exclude from encoding - * @returns {string} encoded string - */ - - function encodeQueryComponent(text, excludeExp) { - var encode = function encode(code) { - return String.fromCharCode(parseInt(code.substr(1), 16)); - }; - - return encodeURIComponent(text).replace(excludeExp, encode).replace(/%20/g, '+'); + return Spinner; +}(); + +/** + * Returns the line color from the given string or array. + */ +function getColor(color, idx) { + return typeof color == 'string' ? color : color[idx % color.length]; +} +/** + * Internal method that draws the individual lines. + */ +function drawLines(el, opts) { + var borderRadius = Math.round(opts.corners * opts.width * 500) / 1000 + 'px'; + var shadow = 'none'; + if (opts.shadow === true) { + shadow = '0 2px 4px #000'; // default shadow + } else if (typeof opts.shadow === 'string') { + shadow = opts.shadow; } - /** - * Unescape dangerous chars in a query string component. - * - * @param {string} text - encoded key or value - * @returns {string} decoded string - * @see {@link encodeQueryComponent} - */ - - - function decodeQueryComponent(text) { - return decodeURIComponent(text.replace(/\+/g, ' ')); + var shadows = parseBoxShadow(shadow); + for (var i = 0; i < opts.lines; i++) { + var degrees = ~~(360 / opts.lines * i + opts.rotate); + var backgroundLine = document.createElement('div'); + backgroundLine.style.position = 'absolute'; + backgroundLine.style.top = "".concat(-opts.width / 2, "px"); + backgroundLine.style.width = opts.length + opts.width + 'px'; + backgroundLine.style.height = opts.width + 'px'; + backgroundLine.style.background = getColor(opts.fadeColor, i); + backgroundLine.style.borderRadius = borderRadius; + backgroundLine.style.transformOrigin = 'left'; + backgroundLine.style.transform = "rotate(".concat(degrees, "deg) translateX(").concat(opts.radius, "px)"); + var delay = i * opts.direction / opts.lines / opts.speed; + delay -= 1 / opts.speed; // so initial animation state will include trail + var line = document.createElement('div'); + line.style.width = '100%'; + line.style.height = '100%'; + line.style.background = getColor(opts.color, i); + line.style.borderRadius = borderRadius; + line.style.boxShadow = normalizeShadow(shadows, degrees); + line.style.animation = "".concat(1 / opts.speed, "s linear ").concat(delay, "s infinite ").concat(opts.animation); + backgroundLine.appendChild(line); + el.appendChild(backgroundLine); } - /** - * Parse URL and extract an array of parameters. - * @param {string?} url - URL or query string to parse - * @returns {Array} array of (key, value) pairs. - */ - - - function getUrlParameters(url) { - url = url || window.location.search; - var query = url.substring(url.indexOf('?') + 1); - var search = /([^&=]+)=?([^&]*)/g; - var result = []; - var match; - - while ((match = search.exec(query)) !== null) { - // eslint-disable-line no-cond-assign - result.push([decodeQueryComponent(match[1]), decodeQueryComponent(match[2])]); +} +function parseBoxShadow(boxShadow) { + var regex = /^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/; + var shadows = []; + for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) { + var shadow = _a[_i]; + var matches = shadow.match(regex); + if (matches === null) { + continue; // invalid syntax + } + var x = +matches[2]; + var y = +matches[5]; + var xUnits = matches[4]; + var yUnits = matches[7]; + if (x === 0 && !xUnits) { + xUnits = yUnits; + } + if (y === 0 && !yUnits) { + yUnits = xUnits; + } + if (xUnits !== yUnits) { + continue; // units must match to use as coordinates + } + shadows.push({ + prefix: matches[1] || '', + // could have value of 'inset' or undefined + x: x, + y: y, + xUnits: xUnits, + yUnits: yUnits, + end: matches[8] + }); + } + return shadows; +} +/** + * Modify box-shadow x/y offsets to counteract rotation + */ +function normalizeShadow(shadows, degrees) { + var normalized = []; + for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) { + var shadow = shadows_1[_i]; + var xy = convertOffset(shadow.x, shadow.y, degrees); + normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end); + } + return normalized.join(', '); +} +function convertOffset(x, y, degrees) { + var radians = degrees * Math.PI / 180; + var sin = Math.sin(radians); + var cos = Math.cos(radians); + return [Math.round((x * cos + y * sin) * 1000) / 1000, Math.round((-x * sin + y * cos) * 1000) / 1000]; +} +;// CONCATENATED MODULE: ./src/Timer.js +//---------------------------------------------------------------------------- +// Timer + +class Timer { + constructor() { + this.startTime = 0; + this.oldTime = 0; + this.elapsedTime = 0; + this.running = false; + } + start() { + this.startTime = Timer.now(); + this.oldTime = this.startTime; + this.running = true; + } + stop() { + this.getElapsedTime(); + this.running = false; + } + getElapsedTime() { + this.update(); + return this.elapsedTime; + } + update() { + let delta = 0; + if (this.running) { + const newTime = Timer.now(); + delta = 0.001 * (newTime - this.oldTime); + this.oldTime = newTime; + this.elapsedTime += delta; + } + return delta; + } +} +Timer.now = function () { + const p = typeof window !== 'undefined' && window.performance; + return p && p.now ? p.now.bind(p) : Date.now; +}(); +;// CONCATENATED MODULE: ./src/gfx/Stats.js + +const { + now +} = Timer; +function createElement(tag, id, css) { + const element = document.createElement(tag); + element.id = id; + element.style.cssText = css; + return element; +} +class Stats { + constructor() { + this.domElement = createElement('div', 'stats', 'padding:8px'); + this._text = createElement('p', 'fps', 'margin:0;color:silver;font-size:large'); + this.domElement.appendChild(this._text); + this._startTime = now(); + this._prevTime = this._startTime; + this._deltas = new Array(20); + this._index = 0; + this._total = 0.0; + this._count = 0; + } + end() { + const time = now(); + const delta = time - this._startTime; + if (this._count < this._deltas.length) { + this._count++; + } else { + this._total -= this._deltas[this._index]; + } + this._total += delta; + this._deltas[this._index] = delta; + this._index = (this._index + 1) % this._deltas.length; + this.ms = this._total / this._count; + this.fps = 1000 / this.ms; + if (time > this._prevTime + 1000) { + this._text.textContent = this.fps.toPrecision(2); + this._prevTime = time; + } + return time; + } + update() { + this._startTime = this.end(); + } + show(on) { + if (on === undefined) { + on = true; } - - return result; + this.domElement.style.display = on ? 'block' : 'none'; } - /** - * Parse URL and extract an array of parameters as a hash. - * @param {string?} url - URL or query string to parse - * @returns {Object} +} +/* harmony default export */ const gfx_Stats = (Stats); +;// CONCATENATED MODULE: ./src/utils/EventDispatcher.js +/** + * This class introduces the simplest event system. + */ + + +function isUndefOrEqual(param, value) { + return !param || param === value; +} + +/** + * Creates empty dispatcher. + * + * @exports EventDispatcher + * @constructor + */ +function EventDispatcher() { + this._handlers = {}; +} + +/** + * Binds callback on specific event type. Optional `context` parameter + * could be used as 'this' for the `callback`. + * @param {string} type Event name. + * @param {function} callback Callback function. + * @param {Object} [context] 'This' object for the callback. + */ +EventDispatcher.prototype.addEventListener = function (type, callback, context) { + let handlers = this._handlers[type]; + if (!handlers) { + this._handlers[type] = []; + handlers = this._handlers[type]; + } + const params = [callback, context]; + function _checkPar(par) { + return par[0] === params[0] && par[1] === params[1]; + } + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().find(handlers, _checkPar) === undefined) { + handlers.push(params); + } +}; + +/** + * Removes a previously-bound callback function from an object. + * If no `context` is specified, all versions of the `callback` with different + * contexts will be removed. + * If no `callback` is specified, all callbacks of the `type` will be removed. + * If no `type` is specified, callbacks for all events will be removed. + * @param {?string} [type] Event type. + * @param {function} [callback] Callback function. + * @param {Object} [context] 'This' object for the callback. + */ +EventDispatcher.prototype.removeEventListener = function (type, callback, context) { + const self = this; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().forEach(self._handlers, (handler, ev) => { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().remove(handler, values => isUndefOrEqual(type, ev) && isUndefOrEqual(callback, values[0]) && isUndefOrEqual(context, values[1] || self)); + }); + this._handlers = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().omitBy(self._handlers, handler => handler.length === 0); +}; + +/** + * Makes all the callbacks for the specific `event` to trigger. + * @param {Object} event Event. + * @param {string} event.type Type of the event. + */ +EventDispatcher.prototype.dispatchEvent = function (event) { + const self = this; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().forEach(this._handlers[event.type], callback => { + const context = callback[1] || self; + callback[0].apply(context, [event]); + }); +}; +/* harmony default export */ const utils_EventDispatcher = (EventDispatcher); +;// CONCATENATED MODULE: ./src/utils/logger.js +/** + * This module contains class for logging. + * Returns an instance of a logger that have already been created. + * Allows users to log messages for five different levels, + * enable console output and catch signal on each message. + */ + + +const priorities = { + debug: 0, + info: 1, + report: 2, + warn: 3, + error: 4 +}; + +/** + * Create new Logger. + * + * @exports Logger + * @extends EventDispatcher + * @constructor + */ +function Logger() { + utils_EventDispatcher.call(this); + /** Boolean flag that toggles output to browser console. + * @type {boolean} */ - - - function getUrlParametersAsDict(url) { - var result = {}; - var a = getUrlParameters(url); - - for (var i = 0; i < a.length; ++i) { - var _a$i = slicedToArray(a[i], 2), - key = _a$i[0], - value = _a$i[1]; - - result[key] = value; + this.console = false; + this._priority = priorities.warn; +} +Logger.prototype = Object.create(utils_EventDispatcher.prototype); +Logger.prototype.constructor = Logger; + +/** + * Create new clean instance of the logger. + * @returns {Logger} + */ +Logger.prototype.instantiate = function () { + return new Logger(); +}; +function verify(number) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isNumber(number)) { + throw new Error('Wrong log level specified!'); + } + return number; +} + +/** + * @property {string} current threshold for signals and console output. + * @name Logger#level + */ +Object.defineProperty(Logger.prototype, 'level', { + get() { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().findKey(priorities, value => value === this._priority); + }, + set(level) { + this._priority = verify(priorities[level]); + } +}); + +/** + * Returns the list of all possible level values. + * @returns {Array} + */ +Logger.prototype.levels = function () { + return Object.keys(priorities); +}; + +/** + * Add new message with specified level. + * @param {string} level - level of the message, must be one of the + * {'debug' | 'info' | 'report' | 'warn' | 'error'} + * @param {string} message + */ +Logger.prototype.message = function (level, message) { + const priority = verify(priorities[level]); + this._message(priority, message); +}; + +/** + * Shortcut for message('debug', ...); + * @param message + */ +Logger.prototype.debug = function (message) { + this._message(priorities.debug, message); +}; + +/** + * Shortcut for message('info', ...); + * @param message + */ +Logger.prototype.info = function (message) { + this._message(priorities.info, message); +}; + +/** + * Shortcut for message('report', ...); + * @param message + */ +Logger.prototype.report = function (message) { + this._message(priorities.report, message); +}; + +/** + * Shortcut for message('warn', ...); + * @param message + */ +Logger.prototype.warn = function (message) { + this._message(priorities.warn, message); +}; + +/** + * Shortcut for message('error', ...); + * @param message + */ +Logger.prototype.error = function (message) { + this._message(priorities.error, message); +}; + +/** + * Add new message with specified priority. + * @param {number} priority - priority of the message + * @param {string} message + * @private + */ +Logger.prototype._message = function (priority, message) { + if (priority < this._priority) { + return; + } + const level = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().findKey(priorities, value => value === priority); + message = String(message); + if (this.console) { + const output = `miew:${level}: ${message}`; + if (level === 'error') { + console.error(output); // NOSONAR + } else if (level === 'warn') { + console.warn(output); // NOSONAR + } else { + console.log(output); // NOSONAR } - - return result; } - - function resolveURL(str) { - if (typeof URL !== 'undefined') { - try { - if (typeof window !== 'undefined') { - return new URL(str, window.location).href; - } - - return new URL(str).href; - } catch (error) {// IE 11 has a URL object with no constructor available so just try a different approach instead + this.dispatchEvent({ + type: 'message', + level, + message + }); +}; +/* harmony default export */ const logger = (new Logger()); +;// CONCATENATED MODULE: ./src/utils.js + + +const browserType = { + DEFAULT: 0, + SAFARI: 1 +}; +//---------------------------------------------------------------------------- +// Query string + +/** + * Escape only dangerous chars in a query string component, use a plus instead of a space. + * + * [RFC 3986](https://tools.ietf.org/html/rfc3986) allows the following chars in the query (see 3.4): + * + * A-Z a-z 0-9 - _ . ~ ! $ & ' ( ) * + , ; = : @ / ? + * + * For query string elements we need to escape ampersand, equal sign, and plus, + * but encodeURIComponent() function encodes anything except for the following: + * + * A-Z a-z 0-9 - _ . ~ ! ' ( ) * + * + * @param {string} text - key or value to encode + * @param {string} excludeExp - regexp for symbols to exclude from encoding + * @returns {string} encoded string + */ +function encodeQueryComponent(text, excludeExp) { + const encode = code => String.fromCharCode(parseInt(code.substr(1), 16)); + return encodeURIComponent(text).replace(excludeExp, encode).replace(/%20/g, '+'); +} + +/** + * Unescape dangerous chars in a query string component. + * + * @param {string} text - encoded key or value + * @returns {string} decoded string + * @see {@link encodeQueryComponent} + */ +function decodeQueryComponent(text) { + return decodeURIComponent(text.replace(/\+/g, ' ')); +} + +/** + * Parse URL and extract an array of parameters. + * @param {string?} url - URL or query string to parse + * @returns {Array} array of (key, value) pairs. + */ +function getUrlParameters(url) { + url = url || window.location.search; + const query = url.substring(url.indexOf('?') + 1); + const search = /([^&=]+)=?([^&]*)/g; + const result = []; + let match; + while ((match = search.exec(query)) !== null) { + // eslint-disable-line no-cond-assign + result.push([decodeQueryComponent(match[1]), decodeQueryComponent(match[2])]); + } + return result; +} + +/** + * Parse URL and extract an array of parameters as a hash. + * @param {string?} url - URL or query string to parse + * @returns {Object} + */ +function getUrlParametersAsDict(url) { + const result = {}; + const a = getUrlParameters(url); + for (let i = 0; i < a.length; ++i) { + const [key, value] = a[i]; + result[key] = value; + } + return result; +} +function resolveURL(str) { + if (typeof URL !== 'undefined') { + try { + if (typeof window !== 'undefined') { + return new URL(str, window.location).href; } + return new URL(str).href; + } catch (error) { + // IE 11 has a URL object with no constructor available so just try a different approach instead } - - if (typeof document !== 'undefined') { - var anchor = document.createElement('a'); - anchor.href = str; - return anchor.href; + } + if (typeof document !== 'undefined') { + const anchor = document.createElement('a'); + anchor.href = str; + return anchor.href; + } + return str; +} + +/** + * Generates regular expression object that includes all symbols + * listed in the argument + * @param symbolStr {string} - String containing characters list. + * @returns {RegExp} - Regular expression. + */ +function generateRegExp(symbolStr) { + const symbolList = []; + for (let i = 0, n = symbolStr.length; i < n; ++i) { + symbolList[symbolList.length] = symbolStr[i].charCodeAt(0).toString(16); + } + const listStr = symbolList.join('|'); + return new RegExp(`%(?:${listStr})`, 'gi'); +} + +//---------------------------------------------------------------------------- +// Create HTML element + +function utils_createElement(tag, attrs, content) { + const element = document.createElement(tag); + let i; + let n; + if (attrs) { + const keys = Object.keys(attrs); + for (i = 0, n = keys.length; i < n; ++i) { + const key = keys[i]; + element.setAttribute(key, attrs[key]); } - - return str; } - /** - * Generates regular expression object that includes all symbols - * listed in the argument - * @param symbolStr {string} - String containing characters list. - * @returns {RegExp} - Regular expression. - */ - - - function generateRegExp(symbolStr) { - var symbolList = []; - - for (var i = 0, n = symbolStr.length; i < n; ++i) { - symbolList[symbolList.length] = symbolStr[i].charCodeAt(0).toString(16); + if (content) { + if (!(content instanceof Array)) { + content = [content]; } + for (i = 0, n = content.length; i < n; ++i) { + const child = content[i]; + if (typeof child === 'string') { + element.appendChild(document.createTextNode(child)); + } else if (child instanceof HTMLElement) { + element.appendChild(child); + } + } + } + return element; +} + +//---------------------------------------------------------------------------- +// Easy inheritance + +/** + * Derive the class from the base. + * @param cls {function} - Class (constructor) to derive. + * @param base {function} - Class (constructor) to derive from. + * @param members {object=} - Optional instance members to add. + * @param statics {object=} - Optional static class members to add. + * @returns {function} Original class. + */ +function deriveClass(cls, base, members, statics) { + cls.prototype = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().assign(Object.create(base.prototype), { + constructor: cls + }, members); + if (statics) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().assign(cls, statics); + } + return cls; +} + +//---------------------------------------------------------------------------- +// Deep prototyping + +function deriveDeep(obj, needZeroOwnProperties) { + let res = obj; + let i; + let n; + if (obj instanceof Array) { + res = new Array(obj.length); + for (i = 0, n = obj.length; i < n; ++i) { + res[i] = deriveDeep(obj[i]); + } + } else if (obj instanceof Object) { + res = Object.create(obj); + const keys = Object.keys(obj); + for (i = 0, n = keys.length; i < n; ++i) { + const key = keys[i]; + const value = obj[key]; + const copy = deriveDeep(value); + if (copy !== value) { + res[key] = copy; + } + } + if (needZeroOwnProperties && Object.keys(res).length > 0) { + res = Object.create(res); + } + } + return res; +} - var listStr = symbolList.join('|'); - return new RegExp("%(?:".concat(listStr, ")"), 'gi'); - } //---------------------------------------------------------------------------- - // Create HTML element - +//---------------------------------------------------------------------------- +// Colors - function createElement$1(tag, attrs, content) { - var element = document.createElement(tag); - var i; - var n; +function hexColor(color) { + const hex = `0000000${color.toString(16)}`.substr(-6); + return `#${hex}`; +} - if (attrs) { - var keys = Object.keys(attrs); +//---------------------------------------------------------------------------- +// Debug tracing - for (i = 0, n = keys.length; i < n; ++i) { - var key = keys[i]; - element.setAttribute(key, attrs[key]); +function DebugTracer(namespace) { + let enabled = false; + this.enable = function (on) { + enabled = on; + }; + let indent = 0; + const methods = Object.keys(namespace); + function wrap(method_, name_) { + return function () { + const spaces = DebugTracer.spaces.substr(0, indent * 2); + if (enabled) { + logger.debug(`${spaces + name_} {`); } - } - - if (content) { - if (!(content instanceof Array)) { - content = [content]; + indent++; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } + const result = method_.apply(this, args); // eslint-disable-line no-invalid-this + indent--; + if (enabled) { + logger.debug(`${spaces}} // ${name_}`); + } + return result; + }; + } + for (let i = 0, n = methods.length; i < n; ++i) { + const name = methods[i]; + const method = namespace[name]; + if (method instanceof Function && name !== 'constructor') { + namespace[name] = wrap(method, name); + } + } +} +DebugTracer.spaces = ' '; +class OutOfMemoryError extends Error { + constructor(message) { + super(); + this.name = 'OutOfMemoryError'; + this.message = message; + } +} +function allocateTyped(TypedArrayName, size) { + let result = null; + try { + result = new TypedArrayName(size); + } catch (e) { + if (e instanceof RangeError) { + throw new OutOfMemoryError(e.message); + } else { + throw e; + } + } + return result; +} - for (i = 0, n = content.length; i < n; ++i) { - var child = content[i]; +//---------------------------------------------------------------------------- +// Float array conversion - if (typeof child === 'string') { - element.appendChild(document.createTextNode(child)); - } else if (child instanceof HTMLElement) { - element.appendChild(child); - } +function bytesToBase64( /** ArrayBuffer */buffer) { + const bytes = new Uint8Array(buffer); + let binary = ''; + for (let i = 0; i < bytes.byteLength; i++) { + binary += String.fromCharCode(bytes[i]); + } + return window.btoa(binary); +} +function bytesFromBase64( /** string */str) { + const binary = window.atob(str); + const bytes = new Uint8Array(binary.length); + for (let i = 0; i < bytes.length; ++i) { + bytes[i] = binary[i].charCodeAt(0); + } + return bytes.buffer; +} +function arrayToBase64( /** number[] */array, /** function */TypedArrayClass) { + return bytesToBase64(new TypedArrayClass(array).buffer); +} +function arrayFromBase64( /** string */str, /** function */TypedArrayClass) { + return Array.prototype.slice.call(new TypedArrayClass(bytesFromBase64(str))); +} + +// NOTE: this is 1-level comparison +function compareOptionsWithDefaults(opts, defOpts) { + const optsStr = []; + if (defOpts && opts) { + const keys = Object.keys(opts); + for (let p = 0; p < keys.length; ++p) { + const key = keys[p]; + const value = opts[key]; + // TODO add processing for tree structure + if (!(value instanceof Object) && typeof defOpts[key] !== 'undefined' && defOpts[key] !== value) { + optsStr.push(`${key}:${value}`); + } + } + if (optsStr.length > 0) { + return `!${optsStr.join()}`; + } + } + return ''; +} +function isAlmostPlainObject(o) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isPlainObject(o)) { + return true; + } + const proto = o && Object.getPrototypeOf(o); + return !!proto && !proto.hasOwnProperty('constructor') && isAlmostPlainObject(proto); +} + +/** + * Build an object that contains properties (and subproperties) of `src` different from those + * in `dst`. Objects are parsed recursively, other values (including arrays) are compared for + * equality using `_.isEqual()`. + * @param {!object} src - a new object to compare, may contain changed or new properties + * @param {!object} dst - an old reference object + */ +function objectsDiff(src, dst) { + const diff = {}; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().forIn(src, (srcValue, key) => { + const dstValue = dst[key]; + if (isAlmostPlainObject(srcValue) && isAlmostPlainObject(dstValue)) { + const deepDiff = objectsDiff(srcValue, dstValue); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(deepDiff)) { + diff[key] = deepDiff; + } + } else if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEqual(srcValue, dstValue)) { + diff[key] = srcValue; + } + }); + return diff; +} +function forInRecursive(object, callback) { + function iterateThrough(obj, prefix) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().forIn(obj, (value, key) => { + const newPref = prefix + (prefix.length > 0 ? '.' : ''); + if (value instanceof Object) { + iterateThrough(value, newPref + key); + } else if (value !== undefined) { + callback(value, newPref + key); } + }); + } + iterateThrough(object, ''); +} +function enquoteString(value) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(value)) { + return `"${value.replace(/"/g, '\\"')}"`; + } + return value; +} +function unquoteString(value) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(value)) { + return value; + } + if (value[0] === '"' && value[value.length - 1] === '"') { + value = value.slice(1, value.length - 1); + return value.replace(/\\"/g, '"'); + } + if (value[0] === "'" && value[value.length - 1] === "'") { + value = value.slice(1, value.length - 1); + return value.replace(/\\'/g, "'"); + } + throw new SyntaxError('Incorrect string format, can\'t unqute it'); +} +function getFileExtension(fileName) { + return fileName.slice(Math.max(0, fileName.lastIndexOf('.')) || Infinity); +} +function splitFileName(fileName) { + const ext = getFileExtension(fileName); + const name = fileName.slice(0, fileName.length - ext.length); + return [name, ext]; +} +function dataUrlToBlob(url) { + const parts = url.split(/[:;,]/); + const partsCount = parts.length; + if (partsCount >= 3 && parts[partsCount - 2] === 'base64') { + return new Blob([bytesFromBase64(parts[partsCount - 1])]); + } + return null; +} +function getBrowser() { + if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') === -1 && navigator.userAgent.indexOf('FxiOS') === -1) { + return browserType.SAFARI; + } + return browserType.DEFAULT; +} +function shotOpen(url) { + if (typeof window !== 'undefined') { + window.open().document.write(``); + } +} +function shotDownload(dataUrl, filename) { + if (!dataUrl || dataUrl.substr(0, 5) !== 'data:') { + return; + } + if (!filename) { + filename = ['screenshot-', +new Date(), '.png'].join(''); + } + if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) { + window.navigator.msSaveBlob(dataUrlToBlob(dataUrl), filename); + } else if (typeof document !== 'undefined') { + const link = document.createElement('a'); + link.download = filename; + link.innerHTML = 'download'; + link.href = window.URL.createObjectURL(dataUrlToBlob(dataUrl)); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } +} +function download(data, filename, type) { + const blobData = new Blob([data]); + if (!filename) { + filename = ['data', +new Date()].join(''); + } + if (!type) { + filename += blobData.type || '.bin'; + } else { + filename += `.${type}`; + } + if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) { + window.navigator.msSaveBlob(blobData, filename); + } else if (typeof document !== 'undefined') { + const link = document.createElement('a'); + link.download = filename; + link.innerHTML = 'download'; + link.href = window.URL.createObjectURL(blobData); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } +} +function copySubArrays(src, dst, indices, itemSize) { + for (let i = 0, n = indices.length; i < n; ++i) { + for (let j = 0; j < itemSize; ++j) { + dst[i * itemSize + j] = src[indices[i] * itemSize + j]; } + } +} +function shallowCloneNode(node) { + const newNode = node.cloneNode(true); + newNode.worldPos = node.worldPos; + // .style property is readonly, so "newNode.style = node.style;" won't work (and we don't need it, right?) + return newNode; +} +const unquotedStringRE = /^[a-zA-Z0-9_]*$/; +const enquoteHelper = ['"', '', '"']; + +// verify and correct if needed selctor identifier +function correctSelectorIdentifier(value) { + if (unquotedStringRE.test(value)) { + return value; + } + // quote incorrect identifier + enquoteHelper[1] = value; + return enquoteHelper.join(''); +} + +/** + * Concatenates two TypedArray. Doesn't check null refs o type equality + * Attention! It must be use very rarely because requires memory reallocation every time. Use MergeTypedArraysUnsafe to + * unite array of subarrays. + * @param{TypedArray} first - destination array + * @param{TypedArray} second - source array + * @returns{TypedArray} resulting concatenated array + */ +function concatTypedArraysUnsafe(first, second) { + const result = new first.constructor(first.length + second.length); + result.set(first); + result.set(second, first.length); + return result; +} + +/** + * Merges array of TypedArray into TypedArray. Doesn't check null refs o type equality + * @param{array} array - source array of subarrays + * @returns{TypedArray} resulting merged array + */ +function mergeTypedArraysUnsafe(array) { + if (array.length <= 0) { + return null; + } + // count the size + const size = array.reduce((acc, cur) => acc + cur.length, 0); + // create combined array + const result = new array[0].constructor(size); + for (let i = 0, start = 0; i < array.length; i++) { + const count = array[i].length; + result.set(array[i], start); + start += count; + } + return result; +} + +//---------------------------------------------------------------------------- +// Exports + +/* harmony default export */ const utils = ({ + browserType, + encodeQueryComponent, + decodeQueryComponent, + getUrlParameters, + getUrlParametersAsDict, + resolveURL, + generateRegExp, + createElement: utils_createElement, + deriveClass, + deriveDeep, + hexColor, + DebugTracer, + OutOfMemoryError, + allocateTyped, + bytesFromBase64, + bytesToBase64, + arrayFromBase64, + arrayToBase64, + compareOptionsWithDefaults, + objectsDiff, + forInRecursive, + enquoteString, + unquoteString, + getBrowser, + shotOpen, + shotDownload, + copySubArrays, + shallowCloneNode, + correctSelectorIdentifier, + getFileExtension, + splitFileName, + download, + concatTypedArraysUnsafe, + mergeTypedArraysUnsafe +}); +;// CONCATENATED MODULE: ./src/utils/JobHandle.js + +class JobHandle extends utils_EventDispatcher { + constructor() { + super(); + this._shouldCancel = false; + } + cancel() { + this._shouldCancel = true; + this.dispatchEvent({ + type: 'cancel' + }); + } + shouldCancel() { + return this._shouldCancel; + } - return element; - } //---------------------------------------------------------------------------- - // Easy inheritance - - /** - * Derive the class from the base. - * @param cls {function} - Class (constructor) to derive. - * @param base {function} - Class (constructor) to derive from. - * @param members {object=} - Optional instance members to add. - * @param statics {object=} - Optional static class members to add. - * @returns {function} Original class. - */ + // slaves use this to notify master about their events + // master routes these notifications to a single event slot + notify(event) { + this.dispatchEvent({ + type: 'notification', + slaveEvent: event + }); + } +} +;// CONCATENATED MODULE: ./src/settings.js - function deriveClass(cls, base, members, statics) { - cls.prototype = _.assign(Object.create(base.prototype), { - constructor: cls - }, members); - if (statics) { - _.assign(cls, statics); - } +const VERSION = 0; - return cls; - } //---------------------------------------------------------------------------- - // Deep prototyping +//---------------------------------------------------------------------------- +// DEFAULT SETTINGS +//---------------------------------------------------------------------------- +/** + * Polygonal complexity settings. + * + * @typedef PolyComplexity + * @property {number} poor + * @property {number} low + * @property {number} medium + * @property {number} high + * @property {number} ultra + */ - function deriveDeep(obj, needZeroOwnProperties) { - var res = obj; - var i; - var n; +/** + * @alias SettingsObject + * @namespace + */ +const settings_defaults = { + /** + * Default options for all available modes. + * Use {@link Mode.id} as a dictionary key to access mode options. + * + * Usually you don't need to override these settings. You may specify mode options as a parameter during + * {@link Mode} construction. + * + * @memberof SettingsObject# + * @type {Object.} + * + * @property {LinesModeOptions} LN - Lines mode options. + * @property {LicoriceModeOptions} LC - Licorice mode options. + * @property {BallsAndSticksModeOptions} BS - Balls and Sticks mode options. + * @property {VanDerWaalsModeOptions} VW - Van der Waals mode options. + * @property {TraceModeOptions} TR - Trace mode options. + * @property {TubeModeOptions} TU - Tube mode options. + * @property {CartoonModeOptions} CA - Cartoon mode options. + * @property {QuickSurfaceModeOptions} QS - Contact Surface mode options. + * @property {IsoSurfaceSASModeOptions} SA - Solvent Accessible Surface mode options. + * @property {IsoSurfaceSESModeOptions} SE - Solvent Excluded Surface mode options. + * @property {ContactSurfaceModeOptions} CS - Contact Surface mode options. + * @property {TextModeOptions} TX - Text mode options. + * @property {VolumeDensityModeOptions} VD - Volume Density mode options. + */ + modes: { + //---------------------------------------------------------------------------- + // BALLS AND STICKS + //---------------------------------------------------------------------------- - if (obj instanceof Array) { - res = new Array(obj.length); + /** + * Balls and Sticks mode options. + * + * @typedef BallsAndSticksModeOptions + * + * @property {number} atom - Sphere radius as a fraction of Van der Waals atom radius. + * @property {number} bond - Cylinder radius in angstroms. + * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all + * available space. + * @property {boolean} multibond - Toggles rendering of multiple ordered bonds. + * @property {number} aromrad - Minor radius of a torus for aromatic loops. + * @property {boolean} showarom - Toggles rendering of aromatic loops. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + BS: { + atom: 0.23, + bond: 0.15, + space: 0.5, + multibond: true, + aromrad: 0.1, + showarom: true, + polyComplexity: { + poor: 3, + low: 4, + medium: 6, + high: 12, + ultra: 32 + } + }, + //---------------------------------------------------------------------------- + // VAN DER WAALS + //---------------------------------------------------------------------------- - for (i = 0, n = obj.length; i < n; ++i) { - res[i] = deriveDeep(obj[i]); + /** + * Van der Waals mode options. + * + * @typedef VanDerWaalsModeOptions + * + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + VW: { + polyComplexity: { + poor: 4, + low: 6, + medium: 8, + high: 16, + ultra: 32 } - } else if (obj instanceof Object) { - res = Object.create(obj); - var keys = Object.keys(obj); + }, + //---------------------------------------------------------------------------- + // LINES + //---------------------------------------------------------------------------- - for (i = 0, n = keys.length; i < n; ++i) { - var key = keys[i]; - var value = obj[key]; - var copy = deriveDeep(value); + /** + * Lines mode options. + * + * @typedef LinesModeOptions + * + * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds. + * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops. + * @property {number} offsarom - Offset between bonds and aromatic cycle. + * @property {number} chunkarom - Number of pieces in a-loop arc, corresponding to atom. + * @property {number} atom - Collision radius for atoms picking. + * @property {number} lineWidth - Line width in pixels (not used in thin lines). + */ + LN: { + multibond: true, + showarom: true, + offsarom: 0.2, + chunkarom: 10, + atom: 0.23, + lineWidth: 2 + }, + //---------------------------------------------------------------------------- + // LICORICE + //---------------------------------------------------------------------------- - if (copy !== value) { - res[key] = copy; - } + /** + * Licorice mode options. + * + * @typedef LicoriceModeOptions + * + * @property {number} bond - Bond cylinder radius. + * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all + * available space. + * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds. + * @property {number} aromrad - Minor radius of a torus for aromatic loops. + * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops. + * @property {PolyComplexity} polyComplexity - Poly complexity values for render modes. + */ + LC: { + bond: 0.20, + space: 0.0, + multibond: true, + aromrad: 0.1, + showarom: true, + polyComplexity: { + poor: 3, + low: 4, + medium: 6, + high: 12, + ultra: 32 } + }, + //---------------------------------------------------------------------------- + // SURFACE SAS + //---------------------------------------------------------------------------- - if (needZeroOwnProperties && Object.keys(res).length > 0) { - res = Object.create(res); + /** + * Solvent Accessible Surface mode options. + * + * @typedef IsoSurfaceSASModeOptions + * + * @property {boolean} zClip - Flag, that toggles z-clipping. + * @property {number} probeRadius - Radius of the probe. + * @property {string} subset - Only parts of surface close to selected atoms will be visible. + * Empty string means whole surface is visible. + * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + SA: { + zClip: false, + probeRadius: 1.5, + subset: '', + wireframe: false, + polyComplexity: { + poor: 6, + low: 8, + medium: 16, + high: 30, + ultra: 60 } - } - - return res; - } //---------------------------------------------------------------------------- - // Colors - - - function hexColor(color) { - var hex = "0000000".concat(color.toString(16)).substr(-6); - return "#".concat(hex); - } //---------------------------------------------------------------------------- - // Debug tracing - - - function DebugTracer(namespace) { - var enabled = false; - - this.enable = function (on) { - enabled = on; - }; - - var indent = 0; - var methods = Object.keys(namespace); - - function wrap(method_, name_) { - return function () { - var spaces = DebugTracer.spaces.substr(0, indent * 2); - - if (enabled) { - logger.debug("".concat(spaces + name_, " {")); - } - - indent++; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var result = method_.apply(this, args); // eslint-disable-line no-invalid-this - - indent--; - - if (enabled) { - logger.debug("".concat(spaces, "} // ").concat(name_)); - } - - return result; - }; - } - - for (var i = 0, n = methods.length; i < n; ++i) { - var name = methods[i]; - var method = namespace[name]; + }, + //---------------------------------------------------------------------------- + // SURFACE SES + //---------------------------------------------------------------------------- - if (method instanceof Function && name !== 'constructor') { - namespace[name] = wrap(method, name); + /** + * Solvent Excluded Surface mode options. + * + * @typedef IsoSurfaceSESModeOptions + * + * @property {boolean} zClip - Flag, that toggles z-clipping. + * @property {number} probeRadius - Radius of the probe. + * @property {string} subset - Only parts of surface close to selected atoms will be visible. + * Empty string means whole surface is visible. + * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + SE: { + zClip: false, + probeRadius: 1.5, + subset: '', + wireframe: false, + polyComplexity: { + poor: 6, + low: 8, + medium: 16, + high: 30, + ultra: 60 } - } - } - - DebugTracer.spaces = ' '; - - var OutOfMemoryError = /*#__PURE__*/function (_Error) { - inherits(OutOfMemoryError, _Error); - - function OutOfMemoryError(message) { - var _this; - - classCallCheck(this, OutOfMemoryError); - - _this = possibleConstructorReturn(this, getPrototypeOf(OutOfMemoryError).call(this)); - _this.name = 'OutOfMemoryError'; - _this.message = message; - return _this; - } + }, + //---------------------------------------------------------------------------- + // QUICK SURFACE + //---------------------------------------------------------------------------- - return OutOfMemoryError; - }( /*#__PURE__*/wrapNativeSuper(Error)); + /** + * Quick Surface mode options. + * + * @typedef QuickSurfaceModeOptions + * + * @property {number} isoValue - Isovalue of the surface to extract. + * @property {number} scale - Radius scale for the surface being built. + * @property {boolean} zClip - Flag, that toggles z-clipping. + * @property {string} subset - Only parts of surface close to selected atoms will be visible. + * Empty string means whole surface is visible. + * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. + * @property {PolyComplexity} gaussLim - Gauss lim for coloring the bigger the value, the smoother our colors are. + * @property {PolyComplexity} gridSpacing - Poly complexity values for render modes. In this case the value + * corresponds to the grid density. + */ + QS: { + isoValue: 0.5, + gaussLim: { + poor: 1.5, + low: 2.0, + medium: 2.5, + high: 3.0, + ultra: 4.0 + }, + scale: 1.0, + wireframe: false, + gridSpacing: { + poor: 2, + low: 1.5, + medium: 1, + high: 0.5, + ultra: 0.25 + }, + subset: '', + zClip: false + }, + //---------------------------------------------------------------------------- + // CONTACT SURFACE + //---------------------------------------------------------------------------- - function allocateTyped(TypedArrayName, size) { - var result = null; + /** + * Contact Surface mode options. + * + * @typedef ContactSurfaceModeOptions + * + * @property {number} isoValue - Isovalue of the surface to extract. + * @property {number} probeRadius - Probe radius. + * @property {number} probePositions + * @property {boolean} zClip - Flag, that toggles z-clipping. + * @property {string} subset - Only parts of surface close to selected atoms will be visible. + * Empty string means whole surface is visible. + * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. + * @property {PolyComplexity} polyComplexity - Radius scale for the surface being built. + * Poly complexity values for render modes. In this case the value corresponds to the grid density. + */ + CS: { + probeRadius: 1.4, + isoValue: 1.5, + wireframe: false, + probePositions: 30, + polyComplexity: { + poor: 0.5, + low: 1.0, + medium: 1.5, + high: 1.75, + ultra: 2.0 + }, + subset: '', + zClip: false + }, + //---------------------------------------------------------------------------- + // TRACE + //---------------------------------------------------------------------------- - try { - result = new TypedArrayName(size); - } catch (e) { - if (e instanceof RangeError) { - throw new OutOfMemoryError(e.message); - } else { - throw e; + /** + * Trace mode options. + * + * @typedef TraceModeOptions + * + * @property {number} radius - Cylinder radius. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + TR: { + radius: 0.30, + polyComplexity: { + poor: 12, + low: 16, + medium: 32, + high: 64, + ultra: 64 } - } - - return result; - } //---------------------------------------------------------------------------- - // Float array conversion - - - function bytesToBase64( - /** ArrayBuffer */ - buffer) { - var bytes = new Uint8Array(buffer); - var binary = ''; - - for (var i = 0; i < bytes.byteLength; i++) { - binary += String.fromCharCode(bytes[i]); - } - - return window.btoa(binary); - } - - function bytesFromBase64( - /** string */ - str) { - var binary = window.atob(str); - var bytes = new Uint8Array(binary.length); - - for (var i = 0; i < bytes.length; ++i) { - bytes[i] = binary[i].charCodeAt(0); - } - - return bytes.buffer; - } - - function arrayToBase64( - /** number[] */ - array, - /** function */ - TypedArrayClass) { - return bytesToBase64(new TypedArrayClass(array).buffer); - } - - function arrayFromBase64( - /** string */ - str, - /** function */ - TypedArrayClass) { - return Array.prototype.slice.call(new TypedArrayClass(bytesFromBase64(str))); - } // NOTE: this is 1-level comparison - - - function compareOptionsWithDefaults(opts, defOpts) { - var optsStr = []; - - if (defOpts && opts) { - var keys = Object.keys(opts); + }, + //---------------------------------------------------------------------------- + // TUBE + //---------------------------------------------------------------------------- - for (var p = 0; p < keys.length; ++p) { - var key = keys[p]; - var value = opts[key]; // TODO add processing for tree structure + /** + * Tube mode options. + * + * @typedef TubeModeOptions + * + * @property {number} radius - Cylinder radius. + * @property {number} tension - Tension for interpolation. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments. + */ + TU: { + radius: 0.30, + heightSegmentsRatio: 1.5, + tension: -0.7, + polyComplexity: { + poor: 4, + low: 6, + medium: 10, + high: 18, + ultra: 34 + } + }, + //---------------------------------------------------------------------------- + // CARTOON + //---------------------------------------------------------------------------- - if (!(value instanceof Object) && typeof defOpts[key] !== 'undefined' && defOpts[key] !== value) { - optsStr.push("".concat(key, ":").concat(value)); + /** + * Cartoon mode options. + * + * @typedef CartoonModeOptions + * + * @property {number} radius - Standard tube radius. + * @property {number} depth - Height of the secondary structure ribbon. + * @property {number} tension - Tension for interpolation. + * @proprety {object} ss - Secondary structure parameters. + * @proprety {object} ss.helix - Options for helices render. + * @proprety {number} ss.helix.width - Width of the secondary structure ribbon. + * @proprety {number} ss.helix.arrow - Secondary structure's arrow width. + * @proprety {object} ss.strand - Options for strands render. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + * polyComplexity must be even for producing symmetric arrows. + * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments. + */ + CA: { + radius: 0.30, + depth: 0.25, + ss: { + helix: { + width: 1.0, + arrow: 2.0 + }, + strand: { + width: 1.0, + arrow: 2.0 } + }, + heightSegmentsRatio: 1.5, + tension: -0.7, + polyComplexity: { + poor: 4, + low: 6, + medium: 10, + high: 18, + ultra: 34 } + }, + //---------------------------------------------------------------------------- + // TEXT + //---------------------------------------------------------------------------- - if (optsStr.length > 0) { - return "!".concat(optsStr.join()); + /** + * Text mode options. + * + * @typedef TextModeOptions + * + * @property {string} template - Format string for building output text. + * @property {string} horizontalAlign - Text alignment ('left', 'right', 'center'). + * @property {string} verticalAlign - Vertical text box alignment ('top', 'bottom', 'middle'). + * @property {number} dx - Text offset x in angstroms. + * @property {number} dy - Text offset y in angstroms. + * @property {number} dz - Text offset z in angstroms. + * @property {string} fg - Color rule for foreground. + * @property {string} bg - Color rule for background. + * @property {boolean} showBg - Flag, that toggles background rendering. + * + */ + TX: { + template: '{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}', + horizontalAlign: 'center', + verticalAlign: 'middle', + dx: 0, + dy: 0, + dz: 1, + fg: 'none', + bg: '0x202020', + showBg: true + }, + //---------------------------------------------------------------------------- + // VOLUME DENSITY + //---------------------------------------------------------------------------- + + /** + * Volume density mode options. + * + * @typedef VolumeDensityModeOptions + * + * @property {number} kSigma - Noise threshold coefficient. + * @property {boolean} frame - flag, that turns on box frame painting. + * @property {boolean} isoMode - flag, that turns on IsoSurface mode instead of Volume Rendering. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + VD: { + kSigma: 1.0, + kSigmaMed: 2.0, + kSigmaMax: 4.0, + frame: true, + isoMode: false, + polyComplexity: { + poor: 2, + low: 3, + medium: 4, + high: 8, + ultra: 10 } } - - return ''; - } - - function isAlmostPlainObject(o) { - if (_.isPlainObject(o)) { - return true; + }, + /** + * Default options for all available colorers. + * Use {@link Colorer.id} as a dictionary key to access colorer options. + * + * Usually you don't need to override these settings. You may specify colorer options as a parameter during + * {@link Colorer} construction. + * + * Not all colorers have options. + * + * @memberof SettingsObject# + * @type {Object.} + * + * @property {ElementColorerOptions} EL - Element colorer options. + * @property {SequenceColorerOptions} SQ - Sequence colorer options. + * @property {MoleculeColorerOptions} MO - Molecule colorer options. + * @property {UniformColorerOptions} UN - Uniform colorer options. + * @property {ConditionalColorerOptions} CO - Conditional colorer options. + * @property {TemperatureColorerOptions} TM - Temperature colorer options. + * @property {OccupancyColorerOptions} OC - Occupancy colorer options. + * @property {HydrophobicityColorerOptions} HY - Hydrophobicity colorer options. + */ + colorers: { + /** + * Element colorer options. + * + * @typedef ElementColorerOptions + * + * @property {number} carbon - Carbon color or -1 to use default. + */ + EL: { + carbon: -1 + }, + /** + * Uniform colorer options. + * + * @typedef UniformColorerOptions + * + * @property {number} color - Single color to paint with. + */ + UN: { + color: 0xFFFFFF + }, + /** + * Conditional colorer options. + * + * @typedef ConditionalColorerOptions + * + * @property {string} subset - Selector string. + * @property {number} color - Color of selected atoms. + * @property {number} baseColor - Color of other atoms. + */ + CO: { + subset: 'charged', + color: 0xFF0000, + baseColor: 0xFFFFFF + }, + /** + * Carbon colorer options. + * + * @typedef CarbonColorerOptions + * + * @property {number} color - Single color to paint carbons + * @property {number} factor - Color factor for not carbon atoms. + */ + CB: { + color: 0x909090, + factor: 0.6 + }, + /** + * Sequence colorer options. + * + * @typedef SequenceColorerOptions + * + * @property {string} gradient - Name of gradient to use. + */ + SQ: { + gradient: 'rainbow' + }, + /** + * Temperature colorer options. + * + * @typedef TemperatureColorerOptions + * + * @property {string} gradient - Name of gradient to use. + * @property {number} min - Minimal temperature. + * @property {number} max - Maximal temperature. + */ + TM: { + gradient: 'temp', + min: 5, + max: 40 + }, + /** + * Occupancy colorer options. + * + * @typedef OccupancyColorerOptions + * + * @property {string} gradient - Name of gradient to use. + */ + OC: { + gradient: 'reds' + }, + /** + * Hydrophobicity colorer options. + * + * @typedef HydrophobicityColorerOptions + * + * @property {string} gradient - Name of gradient to use. + */ + HY: { + gradient: 'blue-red' + }, + /** + * Molecule colorer options. + * + * @typedef MoleculeColorerOptions + * + * @property {string} gradient - Name of gradient to use. + */ + MO: { + gradient: 'rainbow' } - - var proto = o && Object.getPrototypeOf(o); - return !!proto && !proto.hasOwnProperty('constructor') && isAlmostPlainObject(proto); - } + }, + /* + * Use antialiasing in WebGL. + * @type {boolean} + */ + antialias: true, + /* + * Camera field of view in degrees. + * @type {number} + */ + camFov: 45.0, + /* + * Camera near plane distance. + * @type {number} + */ + camNear: 0.5, + /* + * Camera far plane distance. + * @type {number} + */ + camFar: 100.0, + camDistance: 2.5, + radiusToFit: 1.0, /** - * Build an object that contains properties (and subproperties) of `src` different from those - * in `dst`. Objects are parsed recursively, other values (including arrays) are compared for - * equality using `_.isEqual()`. - * @param {!object} src - a new object to compare, may contain changed or new properties - * @param {!object} dst - an old reference object + * @type {number} + * @instance */ + fogNearFactor: 0.5, + // [0, 1] + /** + * @type {number} + * @instance + */ + fogFarFactor: 1, + // [0, 1] + fogAlpha: 1.0, + fogColor: 0x000000, + fogColorEnable: false, + /** + * Palette used for molecule coloring. + * @type {string} + */ + palette: 'JM', + /* + * Geometry resolution. + * @type {string} + */ + resolution: 'medium', + autoResolution: false /* true */, + + autoPreset: true, + preset: 'default', + // TODO: remove 'preset' from settings, implement autodetection + + presets: { + // Default + default: [{ + mode: 'BS', + colorer: 'EL', + selector: 'all', + material: 'SF' + }], + empty: [], + // Wireframe + wire: [{ + mode: 'LN', + colorer: 'EL', + selector: 'all', + material: 'SF' + }], + // Small molecules + small: [{ + mode: 'BS', + colorer: 'EL', + selector: 'all', + material: 'SF' + }], + // Proteins, nucleic acids etc. + macro: [{ + mode: 'CA', + colorer: 'SS', + selector: 'not hetatm', + material: 'SF' + }, { + mode: 'BS', + colorer: 'EL', + selector: 'hetatm and not water', + material: 'SF' + }] + }, + objects: { + line: { + color: 0xFFFFFFFF, + dashSize: 0.3, + gapSize: 0.05 + } + }, + //---------------------------------------------------------------------------- - function objectsDiff(src, dst) { - var diff = {}; - - _.forIn(src, function (srcValue, key) { - var dstValue = dst[key]; - - if (isAlmostPlainObject(srcValue) && isAlmostPlainObject(dstValue)) { - var deepDiff = objectsDiff(srcValue, dstValue); - - if (!_.isEmpty(deepDiff)) { - diff[key] = deepDiff; - } - } else if (!_.isEqual(srcValue, dstValue)) { - diff[key] = srcValue; + bg: { + color: 0x202020, + transparent: false + }, + draft: { + clipPlane: false, + clipPlaneFactor: 0.5, + clipPlaneSpeed: 0.00003 + }, + /* + * Separate group for plugins. + * Each plugin handles its field by itself. + */ + plugins: {}, + /** + * @type {boolean} + * @instance + */ + axes: true, + /** + * @type {boolean} + * @instance + */ + fog: true, + /** + * @type {boolean} + * @instance + */ + fps: true, + /** + * Switch using of z-sprites for sphere and cylinder geometry + * @type {boolean} + * @instance + */ + zSprites: true, + isoSurfaceFakeOpacity: true, + /** + * @type {boolean} + * @instance + */ + suspendRender: true, + nowater: false, + /** + * @type {boolean} + * @instance + */ + autobuild: true, + /** + * Anti-aliasing. + * @type {boolean} + * @instance + */ + fxaa: true, + /** + * Outline depths + * @type {boolean} + * @instance + */ + outline: { + on: false, + color: 0x000000, + threshold: 0.1, + thickness: 1 + }, + /** + * Ambient Occlusion special effect. + * @type {boolean} + * @instance + */ + ao: false, + /** + * Shadows options. + * + * @property {boolean} shadowMap - enable/disable. + * @property {string} basic/percentage-closer filtering/non-uniform randomizing pcf. + * @property {number} radius for percentage-closer filtering. + */ + shadow: { + on: false, + type: 'random' /* basic, pcf, random */, + radius: 1.0 + }, + /** + * Auto-rotation with constant speed. + * @type {number} + * @instance + */ + autoRotation: 0.0, + /** + * Set maximum fps for animation. + * @type {number} + * @instance + */ + maxfps: 30, + /** + * Set fbx output precision. + * @type {number} + * @instance + */ + fbxprec: 4, + /** + * Auto-rotation axis. + * + * - true: complex auto-rotation is about vertical axis + * - false: rotation axis is defined by last user rotation + * + * @type {boolean} + * @instance + */ + autoRotationAxisFixed: true, + /** + * Enable zooming with mouse wheel or pinch gesture. + * @type {boolean} + * @instance + */ + zooming: true, + /** + * Enable picking atoms & residues with left mouse button or touch. + * @type {boolean} + * @instance + */ + picking: true, + /** + * Set picking mode ('atom', 'residue', 'chain', 'molecule'). + * @type {string} + * @instance + */ + pick: 'atom', + /** + * Make "component" and "fragment" editing modes available. + * @type {boolean} + * @instance + */ + editing: false, + /** + * Detect aromatic loops. + * @type {boolean} + * @instance + */ + aromatic: false, + /** + * Load only one biological unit from all those described in PDB file. + * @type {boolean} + * @instance + */ + singleUnit: true, + /** + * Set stereo mode ('NONE', 'SIMPLE', 'DISTORTED', 'ANAGLYPH', 'WEBVR'). + * @type {string} + * @instance + */ + stereo: 'NONE', + /** + * Enable smooth transition between views + * @type {boolean} + * @instance + */ + interpolateViews: true, + /** + * Set transparency mode ('standard', 'prepass'). + * @type {string} + * @instance + */ + transparency: 'prepass', + /** + * Mouse translation speed. + * @type {number} + * @instance + */ + translationSpeed: 2, + debug: { + example: 3.5, + text: 'hello!', + good: true, + ssaoKernelRadius: 0.7, + ssaoFactor: 0.7, + stereoBarrel: 0.25 + }, + use: { + multiFile: false + } +}; + +//---------------------------------------------------------------------------- +// SETTINGS CLASS +//---------------------------------------------------------------------------- + +function Settings() { + utils_EventDispatcher.call(this); + this.old = null; + this.now = {}; + this._changed = {}; + this.reset(); +} +utils.deriveClass(Settings, utils_EventDispatcher, { + defaults: settings_defaults, + set(path, value) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(path)) { + const oldValue = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(this.now, path); + if (oldValue !== value) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().set(this.now, path, value); + this._notifyChange(path, value); } + } else { + const diff = utils.objectsDiff(path, this.now); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(diff)) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge(this.now, diff); + this._notifyChanges(diff); + } + } + }, + get(path, defaultValue) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(this.now, path, defaultValue); + }, + reset() { + const diff = utils.objectsDiff(settings_defaults, this.now); + this.now = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().cloneDeep(settings_defaults); + this.old = null; + this._notifyChanges(diff); + this._changed = {}; + }, + checkpoint() { + this.old = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().cloneDeep(this.now); + this._changed = {}; + }, + _notifyChange(path, value) { + this._changed[path] = true; + this.dispatchEvent({ + type: `change:${path}`, + value }); - - return diff; - } - - function forInRecursive(object, callback) { - function iterateThrough(obj, prefix) { - _.forIn(obj, function (value, key) { - var newPref = prefix + (prefix.length > 0 ? '.' : ''); - - if (value instanceof Object) { - iterateThrough(value, newPref + key); - } else if (value !== undefined) { - callback(value, newPref + key); - } - }); + }, + _notifyChanges(diff) { + utils.forInRecursive(diff, (deepValue, deepPath) => { + this._notifyChange(deepPath, deepValue); + }); + }, + changed() { + if (!this.old) { + return []; + } + const { + old, + now + } = this; + const keys = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().filter(Object.keys(this._changed), key => external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(old, key) !== external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(now, key)); + return keys; + }, + applyDiffs(diffs) { + if (diffs.hasOwnProperty('VERSION') && diffs.VERSION !== VERSION) { + throw new Error('Settings version does not match!'); } - - iterateThrough(object, ''); + // VERSION shouldn't be presented inside settings structure + delete diffs.VERSION; + this.reset(); + this.set(diffs); + }, + getDiffs(versioned) { + const diffs = utils.objectsDiff(this.now, settings_defaults); + if (versioned) { + diffs.VERSION = VERSION; + } + return diffs; + }, + setPluginOpts(plugin, opts) { + settings_defaults.plugins[plugin] = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().cloneDeep(opts); + this.now.plugins[plugin] = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().cloneDeep(opts); } - - function enquoteString(value) { - if (_.isString(value)) { - return "\"".concat(value.replace(/"/g, '\\"'), "\""); +}); +/* harmony default export */ const settings = (new Settings()); +;// CONCATENATED MODULE: ./src/options.js + + + + +let repIndex = 0; +function asBoolean(value) { + return !(!value || value === '0' || external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(value) && value.toLowerCase() === 'false'); +} +const adapters = { + string: String, + number: Number, + boolean: asBoolean +}; + +// Level 1 assignment symbol +const cL1Ass = '='; +const cOptsSep = '!'; +// Level 2 (options) assignment symbol +const cL2Ass = ':'; +// Level 2 (options) separator symbol +const cLSep = ','; +const cCommonIgnoreSymbols = '$;@/?'; +/** + * We may (and should) leave as is for better readability: + * + * $ , ; : @ / ? + */ +/** + * Generate regular expression for symbols excluded for first level encryption + */ +function getLevel1ExcludedExpr() { + const cLevel1Ignores = ':,'; + return utils.generateRegExp(cCommonIgnoreSymbols + cLevel1Ignores); +} + +/** + * Generate regular expression for symbols excluded for first level encryption + * (options, etc, ..) + */ +function getLevel2ExcludedExpr() { + const cLevel2Ignores = ' '; + return utils.generateRegExp(cCommonIgnoreSymbols + cLevel2Ignores); +} +const cL1ExclExpr = getLevel1ExcludedExpr(); +function encodeQueryComponentL1(value) { + return utils.encodeQueryComponent(value, cL1ExclExpr); +} +const cL2ExclExpr = getLevel2ExcludedExpr(); +function encodeQueryComponentL2(value) { + return utils.encodeQueryComponent(value, cL2ExclExpr); +} +function ensureRepList(opts) { + let { + reps + } = opts; + if (!reps) { + const { + presets + } = settings.now; + let preset = opts.preset || settings.now.preset; + reps = presets[preset]; + if (!reps) { + logger.warn(`Unknown preset "${preset}"`); + [preset] = Object.keys(presets); + reps = presets[preset]; // fall back to any preset } - - return value; + opts.preset = preset; + opts.reps = utils.deriveDeep(reps, true); } - - function unquoteString(value) { - if (!_.isString(value)) { - return value; +} +function ensureRepAssign(opts, prop, value) { + ensureRepList(opts); + const rep = opts.reps[repIndex]; + // prop specified twice therefore start new rep by cloning the current + if (rep.hasOwnProperty(prop)) { + repIndex = opts.reps.length; + opts.reps[repIndex] = utils.deriveDeep(rep, true); + } + if (value !== undefined) { + opts.reps[repIndex][prop] = value; + } +} +function addObject(opts, params, options) { + if (opts._objects === undefined) { + opts._objects = []; + } + const [type, newOpts] = options; + const newObj = { + type, + params + }; + if (newOpts !== undefined) { + newObj.opts = newOpts; + } + opts._objects[opts._objects.length] = newObj; +} +function parseParams(str, params) { + const sep = str.indexOf(','); + if (sep >= 0) { + params.push(str.substr(sep + 1).split(',')); + return str.substr(0, sep); + } + // keep this untouched if no params were extracted + return str; +} +function extractArgs(input, defaultsDict, params) { + if (input) { + const bang = input.indexOf(cOptsSep); + const inputVal = parseParams(input.substr(0, bang >= 0 ? bang : undefined), params); + if (bang >= 0) { + const args = input.substr(bang + 1).split(cLSep); + input = inputVal; + if (defaultsDict) { + const defaults = defaultsDict[input]; + const opts = utils.deriveDeep(defaults, true); + args.forEach(arg => { + const pair = arg.split(cL2Ass, 2); + const key = decodeURIComponent(pair[0]); + const value = decodeURIComponent(pair[1]); + const adapter = adapters[typeof external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(defaults, key)]; + if (adapter) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().set(opts, key, adapter(value)); + } else { + logger.warn(`Unknown argument "${key}" for option "${input}"`); + } + }); + if (Object.keys(opts).length > 0) { + input = [input, opts]; + } + } + } else { + input = inputVal; } - - if (value[0] === '"' && value[value.length - 1] === '"') { - value = value.slice(1, value.length - 1); - return value.replace(/\\"/g, '"'); + } + return input; +} +const actions = { + l: 'load', + load: String, + t: 'type', + type: String, + v: 'view', + view: String, + u: 'unit', + unit: Number, + menu: asBoolean, + // Commands + + o: 'object', + object(value, opts) { + const params = []; + let options = extractArgs(value, settings.defaults.objects, params); + if (!Array.isArray(options)) { + options = [options]; + } + addObject(opts, params[0], options); + }, + p: 'preset', + preset(value, opts) { + opts.preset = value; + opts.reps = null; + ensureRepList(opts); + }, + r: 'rep', + rep(value, opts) { + ensureRepList(opts); + repIndex = Number(value); + // clamp the index to one greater than the last + repIndex = repIndex <= opts.reps.length ? repIndex < 0 ? 0 : repIndex : opts.reps.length; + // create a new rep if it is adjacent to the existing ones + if (repIndex === opts.reps.length) { + // if there is no rep to derive from, derive from the first rep of the default + opts.reps[repIndex] = repIndex > 0 ? utils.deriveDeep(opts.reps[repIndex - 1], true) : utils.deriveDeep(settings.defaults.presets.default[0], true); } - - if (value[0] === "'" && value[value.length - 1] === "'") { - value = value.slice(1, value.length - 1); - return value.replace(/\\'/g, "'"); + }, + s: 'select', + select(value, opts) { + ensureRepAssign(opts, 'selector', value); + }, + m: 'mode', + mode(value, opts) { + ensureRepAssign(opts, 'mode', extractArgs(value, settings.defaults.modes)); + }, + c: 'color', + color(value, opts) { + ensureRepAssign(opts, 'colorer', extractArgs(value, settings.defaults.colorers)); + }, + mt: 'material', + material(value, opts) { + ensureRepAssign(opts, 'material', extractArgs(value, settings.defaults.materials)); + }, + dup(value, opts) { + ensureRepList(opts); + const { + reps + } = opts; + const rep = reps[repIndex]; + repIndex = reps.length; + reps[repIndex] = utils.deriveDeep(rep, true); + }, + // Settings shortcuts + + ar: 'autoResolution' +}; +function _fromArray(entries) { + repIndex = 0; + const opts = {}; + for (let i = 0, n = entries.length; i < n; ++i) { + const /** string[] */entry = entries[i]; + let /** string? */key = entry[0]; + const /** string? */value = entry[1]; + let /** function|string? */action = actions[key]; + + // unwind shortcuts and aliases + while (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(action)) { + key = action; + action = actions[key]; + } + + // either set a property or use specialized parser + if (!action) { + const adapter = adapters[typeof external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(settings.defaults, key)]; + if (adapter) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().set(opts, `settings.${key}`, adapter(value)); + } else { + logger.warn(`Unknown option "${key}"`); + } + } else if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isFunction(action)) { + const result = action(value, opts); + if (result !== undefined) { + opts[key] = result; + } } - - throw new SyntaxError('Incorrect string format, can\'t unqute it'); } - - function getFileExtension(fileName) { - return fileName.slice(Math.max(0, fileName.lastIndexOf('.')) || Infinity); + return opts; +} +function fromAttr(attr) { + return _fromArray(utils.getUrlParameters(`?${attr || ''}`)); +} +function fromURL(url) { + return _fromArray(utils.getUrlParameters(url)); +} +function _processOptsForURL(opts) { + const str = []; + let i = 0; + utils.forInRecursive(opts, (value, key) => { + str[i++] = encodeQueryComponentL2(key) + cL2Ass + encodeQueryComponentL2(value); + }); + return str.join(cLSep); +} +function _processArgsForURL(args) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isArray(args)) { + return args; } - - function splitFileName(fileName) { - var ext = getFileExtension(fileName); - var name = fileName.slice(0, fileName.length - ext.length); - return [name, ext]; + if (args.length < 2) { + return args[0]; } - - function dataUrlToBlob(url) { - var parts = url.split(/[:;,]/); - var partsCount = parts.length; - - if (partsCount >= 3 && parts[partsCount - 2] === 'base64') { - return new Blob([bytesFromBase64(parts[partsCount - 1])]); - } - - return null; + return `${args[0]}${cOptsSep}${_processOptsForURL(args[1])}`; +} +function _processObjForURL(objOpts) { + if (!objOpts || !objOpts.type) { + return undefined; } - - function getBrowser() { - if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') === -1 && navigator.userAgent.indexOf('FxiOS') === -1) { - return browserType.SAFARI; - } - - return browserType.DEFAULT; + let res = objOpts.type; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isArray(objOpts.params) && objOpts.params.length > 0) { + res += `,${objOpts.params.join(',')}`; } - - function shotOpen(url) { - if (typeof window !== 'undefined') { - window.open().document.write("")); + if (objOpts.opts) { + res += cOptsSep + _processOptsForURL(objOpts.opts); + } + return res; +} +function toURL(opts) { + const stringList = []; + let idx = 0; + function checkAndAdd(prefix, value) { + if (value !== null && value !== undefined) { + stringList[idx++] = encodeQueryComponentL1(prefix) + cL1Ass + encodeQueryComponentL1(value); } } - - function shotDownload(dataUrl, filename) { - if (!dataUrl || dataUrl.substr(0, 5) !== 'data:') { + function addReps(repList) { + if (!repList) { return; } - - if (!filename) { - filename = ['screenshot-', +new Date(), '.png'].join(''); - } - - if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) { - window.navigator.msSaveBlob(dataUrlToBlob(dataUrl), filename); - } else if (typeof document !== 'undefined') { - var link = document.createElement('a'); - link.download = filename; - link.innerHTML = 'download'; - link.href = window.URL.createObjectURL(dataUrlToBlob(dataUrl)); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); + for (let i = 0, n = repList.length; i < n; ++i) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(repList[i])) { + continue; + } + checkAndAdd('r', i); + checkAndAdd('s', repList[i].selector); + checkAndAdd('m', _processArgsForURL(repList[i].mode)); + checkAndAdd('c', _processArgsForURL(repList[i].colorer)); + checkAndAdd('mt', _processArgsForURL(repList[i].material)); } } - - function download(data, filename, type) { - var blobData = new Blob([data]); - - if (!filename) { - filename = ['data', +new Date()].join(''); + function addObjects(objList) { + if (!objList) { + return; } - - if (!type) { - filename += blobData.type || '.bin'; - } else { - filename += ".".concat(type); + for (let i = 0, n = objList.length; i < n; ++i) { + checkAndAdd('o', _processObjForURL(objList[i])); } - - if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) { - window.navigator.msSaveBlob(blobData, filename); - } else if (typeof document !== 'undefined') { - var link = document.createElement('a'); - link.download = filename; - link.innerHTML = 'download'; - link.href = window.URL.createObjectURL(blobData); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); + } + checkAndAdd('l', opts.load); + checkAndAdd('u', opts.unit); + checkAndAdd('p', opts.preset); + addReps(opts.reps); + addObjects(opts._objects); + checkAndAdd('v', opts.view); + utils.forInRecursive(opts.settings, (value, key) => { + // I heard these lines in the whispers of the Gods + // Handle preset setting in reps + if (key === 'preset') { + return; } + checkAndAdd(key, value); + }); + let url = ''; + if (typeof window !== 'undefined') { + const { + location + } = window; + url = `${location.protocol}//${location.host}${location.pathname}`; } - - function copySubArrays(src, dst, indices, itemSize) { - for (var i = 0, n = indices.length; i < n; ++i) { - for (var j = 0; j < itemSize; ++j) { - dst[i * itemSize + j] = src[indices[i] * itemSize + j]; - } + if (stringList.length > 0) { + url += `?${stringList.join('&')}`; + } + return url; +} +function _processOptsForScript(opts) { + const str = []; + let i = 0; + utils.forInRecursive(opts, (value, key) => { + str[i++] = `${key}=${utils.enquoteString(value)}`; + }); + return str.join(' '); +} +function _processArgsForScript(args) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isArray(args)) { + return args; + } + if (args.length < 2) { + return args[0]; + } + return `${args[0]} ${_processOptsForScript(args[1])}`; +} +function _processObjForScript(objOpts) { + if (!objOpts || !objOpts.type) { + return undefined; + } + let res = objOpts.type; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isArray(objOpts.params) && objOpts.params.length > 0) { + res += ` ${objOpts.params.map(utils.enquoteString).join(' ')}`; + } + if (objOpts.opts) { + res += ` ${_processOptsForScript(objOpts.opts)}`; + } + return res; +} +function _processRepsForScript(rep, index) { + const repString = []; + let strIdx = 0; + function localAdd(prefix, value) { + if (value !== null && value !== undefined) { + repString[strIdx++] = prefix + value; } } - - function shallowCloneNode(node) { - var newNode = node.cloneNode(true); - newNode.worldPos = node.worldPos; // .style property is readonly, so "newNode.style = node.style;" won't work (and we don't need it, right?) - - return newNode; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(rep)) { + return null; } - - var unquotedStringRE = /^[a-zA-Z0-9_]*$/; - var enquoteHelper = ['"', '', '"']; // verify and correct if needed selctor identifier - - function correctSelectorIdentifier(value) { - if (unquotedStringRE.test(value)) { - return value; - } // quote incorrect identifier - - - enquoteHelper[1] = value; - return enquoteHelper.join(''); + localAdd('', index); + localAdd('s=', utils.enquoteString(rep.selector)); + localAdd('m=', _processArgsForScript(rep.mode)); + localAdd('c=', _processArgsForScript(rep.colorer)); + localAdd('mt=', _processArgsForScript(rep.material)); + return repString.join(' '); +} +function toScript(opts) { + const commandsList = []; + let idx = 0; + function checkAndAdd(command, value, saveQuotes) { + if (value !== null && value !== undefined) { + const quote = typeof value === 'string' && saveQuotes ? '"' : ''; + commandsList[idx++] = `${command} ${quote}${value}${quote}`.trim(); + } } - /** - * Concatenates two TypedArray. Doesn't check null refs o type equality - * Attention! It must be use very rarely because requires memory reallocation every time. Use MergeTypedArraysUnsafe to - * unite array of subarrays. - * @param{TypedArray} first - destination array - * @param{TypedArray} second - source array - * @returns{TypedArray} resulting concatenated array - */ - - - function concatTypedArraysUnsafe(first, second) { - var result = new first.constructor(first.length + second.length); - result.set(first); - result.set(second, first.length); - return result; + function addReps(repList) { + if (!repList) { + return; + } + for (let i = 0, n = repList.length; i < n; ++i) { + checkAndAdd('rep', _processRepsForScript(repList[i], i)); + } } - /** - * Merges array of TypedArray into TypedArray. Doesn't check null refs o type equality - * @param{array} array - source array of subarrays - * @returns{TypedArray} resulting merged array - */ - - - function mergeTypedArraysUnsafe(array) { - if (array.length <= 0) { - return null; - } // count the size - - - var size = array.reduce(function (acc, cur) { - return acc + cur.length; - }, 0); // create combined array - - var result = new array[0].constructor(size); - - for (var i = 0, start = 0; i < array.length; i++) { - var count = array[i].length; - result.set(array[i], start); - start += count; + function addObjects(objList) { + if (!objList) { + return; } - - return result; - } //---------------------------------------------------------------------------- - // Exports - - - var utils = { - browserType: browserType, - encodeQueryComponent: encodeQueryComponent, - decodeQueryComponent: decodeQueryComponent, - getUrlParameters: getUrlParameters, - getUrlParametersAsDict: getUrlParametersAsDict, - resolveURL: resolveURL, - generateRegExp: generateRegExp, - createElement: createElement$1, - deriveClass: deriveClass, - deriveDeep: deriveDeep, - hexColor: hexColor, - DebugTracer: DebugTracer, - OutOfMemoryError: OutOfMemoryError, - allocateTyped: allocateTyped, - bytesFromBase64: bytesFromBase64, - bytesToBase64: bytesToBase64, - arrayFromBase64: arrayFromBase64, - arrayToBase64: arrayToBase64, - compareOptionsWithDefaults: compareOptionsWithDefaults, - objectsDiff: objectsDiff, - forInRecursive: forInRecursive, - enquoteString: enquoteString, - unquoteString: unquoteString, - getBrowser: getBrowser, - shotOpen: shotOpen, - shotDownload: shotDownload, - copySubArrays: copySubArrays, - shallowCloneNode: shallowCloneNode, - correctSelectorIdentifier: correctSelectorIdentifier, - getFileExtension: getFileExtension, - splitFileName: splitFileName, - download: download, - concatTypedArraysUnsafe: concatTypedArraysUnsafe, - mergeTypedArraysUnsafe: mergeTypedArraysUnsafe - }; - - var JobHandle = /*#__PURE__*/function (_EventDispatcher) { - inherits(JobHandle, _EventDispatcher); - - function JobHandle() { - var _this; - - classCallCheck(this, JobHandle); - - _this = possibleConstructorReturn(this, getPrototypeOf(JobHandle).call(this)); - _this._shouldCancel = false; - return _this; + for (let i = 0, n = objList.length; i < n; ++i) { + checkAndAdd('', _processObjForScript(objList[i])); } - - createClass(JobHandle, [{ - key: "cancel", - value: function cancel() { - this._shouldCancel = true; - this.dispatchEvent({ - type: 'cancel' - }); - } - }, { - key: "shouldCancel", - value: function shouldCancel() { - return this._shouldCancel; - } // slaves use this to notify master about their events - // master routes these notifications to a single event slot - - }, { - key: "notify", - value: function notify(event) { - this.dispatchEvent({ - type: 'notification', - slaveEvent: event - }); - } - }]); - - return JobHandle; - }(EventDispatcher); - - var VERSION = 0; //---------------------------------------------------------------------------- - // DEFAULT SETTINGS - //---------------------------------------------------------------------------- - - /** - * Polygonal complexity settings. - * - * @typedef PolyComplexity - * @property {number} poor - * @property {number} low - * @property {number} medium - * @property {number} high - * @property {number} ultra - */ - - /** - * @alias SettingsObject - * @namespace - */ - - var defaults$1 = { - /** - * Default options for all available modes. - * Use {@link Mode.id} as a dictionary key to access mode options. - * - * Usually you don't need to override these settings. You may specify mode options as a parameter during - * {@link Mode} construction. - * - * @memberof SettingsObject# - * @type {Object.} - * - * @property {LinesModeOptions} LN - Lines mode options. - * @property {LicoriceModeOptions} LC - Licorice mode options. - * @property {BallsAndSticksModeOptions} BS - Balls and Sticks mode options. - * @property {VanDerWaalsModeOptions} VW - Van der Waals mode options. - * @property {TraceModeOptions} TR - Trace mode options. - * @property {TubeModeOptions} TU - Tube mode options. - * @property {CartoonModeOptions} CA - Cartoon mode options. - * @property {QuickSurfaceModeOptions} QS - Contact Surface mode options. - * @property {IsoSurfaceSASModeOptions} SA - Solvent Accessible Surface mode options. - * @property {IsoSurfaceSESModeOptions} SE - Solvent Excluded Surface mode options. - * @property {ContactSurfaceModeOptions} CS - Contact Surface mode options. - * @property {TextModeOptions} TX - Text mode options. - * @property {VolumeDensityModeOptions} VD - Volume Density mode options. - */ - modes: { - //---------------------------------------------------------------------------- - // BALLS AND STICKS - //---------------------------------------------------------------------------- - - /** - * Balls and Sticks mode options. - * - * @typedef BallsAndSticksModeOptions - * - * @property {number} atom - Sphere radius as a fraction of Van der Waals atom radius. - * @property {number} bond - Cylinder radius in angstroms. - * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all - * available space. - * @property {boolean} multibond - Toggles rendering of multiple ordered bonds. - * @property {number} aromrad - Minor radius of a torus for aromatic loops. - * @property {boolean} showarom - Toggles rendering of aromatic loops. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - BS: { - atom: 0.23, - bond: 0.15, - space: 0.5, - multibond: true, - aromrad: 0.1, - showarom: true, - polyComplexity: { - poor: 3, - low: 4, - medium: 6, - high: 12, - ultra: 32 - } - }, - //---------------------------------------------------------------------------- - // VAN DER WAALS - //---------------------------------------------------------------------------- - - /** - * Van der Waals mode options. - * - * @typedef VanDerWaalsModeOptions - * - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - VW: { - polyComplexity: { - poor: 4, - low: 6, - medium: 8, - high: 16, - ultra: 32 - } - }, - //---------------------------------------------------------------------------- - // LINES - //---------------------------------------------------------------------------- - - /** - * Lines mode options. - * - * @typedef LinesModeOptions - * - * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds. - * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops. - * @property {number} offsarom - Offset between bonds and aromatic cycle. - * @property {number} chunkarom - Number of pieces in a-loop arc, corresponding to atom. - * @property {number} atom - Collision radius for atoms picking. - * @property {number} lineWidth - Line width in pixels (not used in thin lines). - */ - LN: { - multibond: true, - showarom: true, - offsarom: 0.2, - chunkarom: 10, - atom: 0.23, - lineWidth: 2 - }, - //---------------------------------------------------------------------------- - // LICORICE - //---------------------------------------------------------------------------- - - /** - * Licorice mode options. - * - * @typedef LicoriceModeOptions - * - * @property {number} bond - Bond cylinder radius. - * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all - * available space. - * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds. - * @property {number} aromrad - Minor radius of a torus for aromatic loops. - * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops. - * @property {PolyComplexity} polyComplexity - Poly complexity values for render modes. - */ - LC: { - bond: 0.20, - space: 0.0, - multibond: true, - aromrad: 0.1, - showarom: true, - polyComplexity: { - poor: 3, - low: 4, - medium: 6, - high: 12, - ultra: 32 - } - }, - //---------------------------------------------------------------------------- - // SURFACE SAS - //---------------------------------------------------------------------------- - - /** - * Solvent Accessible Surface mode options. - * - * @typedef IsoSurfaceSASModeOptions - * - * @property {boolean} zClip - Flag, that toggles z-clipping. - * @property {number} probeRadius - Radius of the probe. - * @property {string} subset - Only parts of surface close to selected atoms will be visible. - * Empty string means whole surface is visible. - * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - SA: { - zClip: false, - probeRadius: 1.5, - subset: '', - wireframe: false, - polyComplexity: { - poor: 6, - low: 8, - medium: 16, - high: 30, - ultra: 60 - } - }, - //---------------------------------------------------------------------------- - // SURFACE SES - //---------------------------------------------------------------------------- - - /** - * Solvent Excluded Surface mode options. - * - * @typedef IsoSurfaceSESModeOptions - * - * @property {boolean} zClip - Flag, that toggles z-clipping. - * @property {number} probeRadius - Radius of the probe. - * @property {string} subset - Only parts of surface close to selected atoms will be visible. - * Empty string means whole surface is visible. - * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - SE: { - zClip: false, - probeRadius: 1.5, - subset: '', - wireframe: false, - polyComplexity: { - poor: 6, - low: 8, - medium: 16, - high: 30, - ultra: 60 - } - }, - //---------------------------------------------------------------------------- - // QUICK SURFACE - //---------------------------------------------------------------------------- - - /** - * Quick Surface mode options. - * - * @typedef QuickSurfaceModeOptions - * - * @property {number} isoValue - Isovalue of the surface to extract. - * @property {number} scale - Radius scale for the surface being built. - * @property {boolean} zClip - Flag, that toggles z-clipping. - * @property {string} subset - Only parts of surface close to selected atoms will be visible. - * Empty string means whole surface is visible. - * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. - * @property {PolyComplexity} gaussLim - Gauss lim for coloring the bigger the value, the smoother our colors are. - * @property {PolyComplexity} gridSpacing - Poly complexity values for render modes. In this case the value - * corresponds to the grid density. - */ - QS: { - isoValue: 0.5, - gaussLim: { - poor: 1.5, - low: 2.0, - medium: 2.5, - high: 3.0, - ultra: 4.0 - }, - scale: 1.0, - wireframe: false, - gridSpacing: { - poor: 2, - low: 1.5, - medium: 1, - high: 0.5, - ultra: 0.25 - }, - subset: '', - zClip: false - }, - //---------------------------------------------------------------------------- - // CONTACT SURFACE - //---------------------------------------------------------------------------- - - /** - * Contact Surface mode options. - * - * @typedef ContactSurfaceModeOptions - * - * @property {number} isoValue - Isovalue of the surface to extract. - * @property {number} probeRadius - Probe radius. - * @property {number} probePositions - * @property {boolean} zClip - Flag, that toggles z-clipping. - * @property {string} subset - Only parts of surface close to selected atoms will be visible. - * Empty string means whole surface is visible. - * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. - * @property {PolyComplexity} polyComplexity - Radius scale for the surface being built. - * Poly complexity values for render modes. In this case the value corresponds to the grid density. - */ - CS: { - probeRadius: 1.4, - isoValue: 1.5, - wireframe: false, - probePositions: 30, - polyComplexity: { - poor: 0.5, - low: 1.0, - medium: 1.5, - high: 1.75, - ultra: 2.0 - }, - subset: '', - zClip: false - }, - //---------------------------------------------------------------------------- - // TRACE - //---------------------------------------------------------------------------- - - /** - * Trace mode options. - * - * @typedef TraceModeOptions - * - * @property {number} radius - Cylinder radius. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - TR: { - radius: 0.30, - polyComplexity: { - poor: 12, - low: 16, - medium: 32, - high: 64, - ultra: 64 - } - }, - //---------------------------------------------------------------------------- - // TUBE - //---------------------------------------------------------------------------- - - /** - * Tube mode options. - * - * @typedef TubeModeOptions - * - * @property {number} radius - Cylinder radius. - * @property {number} tension - Tension for interpolation. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments. - */ - TU: { - radius: 0.30, - heightSegmentsRatio: 1.5, - tension: -0.7, - polyComplexity: { - poor: 4, - low: 6, - medium: 10, - high: 18, - ultra: 34 - } - }, - //---------------------------------------------------------------------------- - // CARTOON - //---------------------------------------------------------------------------- - - /** - * Cartoon mode options. - * - * @typedef CartoonModeOptions - * - * @property {number} radius - Standard tube radius. - * @property {number} depth - Height of the secondary structure ribbon. - * @property {number} tension - Tension for interpolation. - * @proprety {object} ss - Secondary structure parameters. - * @proprety {object} ss.helix - Options for helices render. - * @proprety {number} ss.helix.width - Width of the secondary structure ribbon. - * @proprety {number} ss.helix.arrow - Secondary structure's arrow width. - * @proprety {object} ss.strand - Options for strands render. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - * polyComplexity must be even for producing symmetric arrows. - * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments. - */ - CA: { - radius: 0.30, - depth: 0.25, - ss: { - helix: { - width: 1.0, - arrow: 2.0 - }, - strand: { - width: 1.0, - arrow: 2.0 - } - }, - heightSegmentsRatio: 1.5, - tension: -0.7, - polyComplexity: { - poor: 4, - low: 6, - medium: 10, - high: 18, - ultra: 34 - } - }, - //---------------------------------------------------------------------------- - // TEXT - //---------------------------------------------------------------------------- - - /** - * Text mode options. - * - * @typedef TextModeOptions - * - * @property {string} template - Format string for building output text. - * @property {string} horizontalAlign - Text alignment ('left', 'right', 'center'). - * @property {string} verticalAlign - Vertical text box alignment ('top', 'bottom', 'middle'). - * @property {number} dx - Text offset x in angstroms. - * @property {number} dy - Text offset y in angstroms. - * @property {number} dz - Text offset z in angstroms. - * @property {string} fg - Color rule for foreground. - * @property {string} bg - Color rule for background. - * @property {boolean} showBg - Flag, that toggles background rendering. - * - */ - TX: { - template: '{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}', - horizontalAlign: 'center', - verticalAlign: 'middle', - dx: 0, - dy: 0, - dz: 1, - fg: 'none', - bg: '0x202020', - showBg: true - }, - //---------------------------------------------------------------------------- - // VOLUME DENSITY - //---------------------------------------------------------------------------- - - /** - * Volume density mode options. - * - * @typedef VolumeDensityModeOptions - * - * @property {number} kSigma - Noise threshold coefficient. - * @property {boolean} frame - flag, that turns on box frame painting. - * @property {boolean} isoMode - flag, that turns on IsoSurface mode instead of Volume Rendering. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - VD: { - kSigma: 1.0, - kSigmaMed: 2.0, - kSigmaMax: 4.0, - frame: true, - isoMode: false, - polyComplexity: { - poor: 2, - low: 3, - medium: 4, - high: 8, - ultra: 10 - } - } - }, - - /** - * Default options for all available colorers. - * Use {@link Colorer.id} as a dictionary key to access colorer options. - * - * Usually you don't need to override these settings. You may specify colorer options as a parameter during - * {@link Colorer} construction. - * - * Not all colorers have options. - * - * @memberof SettingsObject# - * @type {Object.} - * - * @property {ElementColorerOptions} EL - Element colorer options. - * @property {SequenceColorerOptions} SQ - Sequence colorer options. - * @property {MoleculeColorerOptions} MO - Molecule colorer options. - * @property {UniformColorerOptions} UN - Uniform colorer options. - * @property {ConditionalColorerOptions} CO - Conditional colorer options. - * @property {TemperatureColorerOptions} TM - Temperature colorer options. - * @property {OccupancyColorerOptions} OC - Occupancy colorer options. - * @property {HydrophobicityColorerOptions} HY - Hydrophobicity colorer options. - */ - colorers: { - /** - * Element colorer options. - * - * @typedef ElementColorerOptions - * - * @property {number} carbon - Carbon color or -1 to use default. - */ - EL: { - carbon: -1 - }, - - /** - * Uniform colorer options. - * - * @typedef UniformColorerOptions - * - * @property {number} color - Single color to paint with. - */ - UN: { - color: 0xFFFFFF - }, - - /** - * Conditional colorer options. - * - * @typedef ConditionalColorerOptions - * - * @property {string} subset - Selector string. - * @property {number} color - Color of selected atoms. - * @property {number} baseColor - Color of other atoms. - */ - CO: { - subset: 'charged', - color: 0xFF0000, - baseColor: 0xFFFFFF - }, - - /** - * Carbon colorer options. - * - * @typedef CarbonColorerOptions - * - * @property {number} color - Single color to paint carbons - * @property {number} factor - Color factor for not carbon atoms. - */ - CB: { - color: 0x909090, - factor: 0.6 - }, - - /** - * Sequence colorer options. - * - * @typedef SequenceColorerOptions - * - * @property {string} gradient - Name of gradient to use. - */ - SQ: { - gradient: 'rainbow' - }, - - /** - * Temperature colorer options. - * - * @typedef TemperatureColorerOptions - * - * @property {string} gradient - Name of gradient to use. - * @property {number} min - Minimal temperature. - * @property {number} max - Maximal temperature. - */ - TM: { - gradient: 'temp', - min: 5, - max: 40 - }, - - /** - * Occupancy colorer options. - * - * @typedef OccupancyColorerOptions - * - * @property {string} gradient - Name of gradient to use. - */ - OC: { - gradient: 'reds' - }, - - /** - * Hydrophobicity colorer options. - * - * @typedef HydrophobicityColorerOptions - * - * @property {string} gradient - Name of gradient to use. - */ - HY: { - gradient: 'blue-red' - }, - - /** - * Molecule colorer options. - * - * @typedef MoleculeColorerOptions - * - * @property {string} gradient - Name of gradient to use. - */ - MO: { - gradient: 'rainbow' - } - }, - - /* - * Use antialiasing in WebGL. - * @type {boolean} - */ - antialias: true, - - /* - * Camera field of view in degrees. - * @type {number} - */ - camFov: 45.0, - - /* - * Camera near plane distance. - * @type {number} - */ - camNear: 0.5, - - /* - * Camera far plane distance. - * @type {number} - */ - camFar: 100.0, - camDistance: 2.5, - radiusToFit: 1.0, - - /** - * @type {number} - * @instance - */ - fogNearFactor: 0.5, - // [0, 1] - - /** - * @type {number} - * @instance - */ - fogFarFactor: 1, - // [0, 1] - fogAlpha: 1.0, - fogColor: 0x000000, - fogColorEnable: false, - - /** - * Palette used for molecule coloring. - * @type {string} - */ - palette: 'JM', - - /* - * Geometry resolution. - * @type {string} - */ - resolution: 'medium', - autoResolution: false - /* true */ - , - autoPreset: true, - preset: 'default', - // TODO: remove 'preset' from settings, implement autodetection - presets: { - // Default - "default": [{ - mode: 'BS', - colorer: 'EL', - selector: 'all', - material: 'SF' - }], - empty: [], - // Wireframe - wire: [{ - mode: 'LN', - colorer: 'EL', - selector: 'all', - material: 'SF' - }], - // Small molecules - small: [{ - mode: 'BS', - colorer: 'EL', - selector: 'all', - material: 'SF' - }], - // Proteins, nucleic acids etc. - macro: [{ - mode: 'CA', - colorer: 'SS', - selector: 'not hetatm', - material: 'SF' - }, { - mode: 'BS', - colorer: 'EL', - selector: 'hetatm and not water', - material: 'SF' - }] - }, - objects: { - line: { - color: 0xFFFFFFFF, - dashSize: 0.3, - gapSize: 0.05 - } - }, - //---------------------------------------------------------------------------- - bg: { - color: 0x202020, - transparent: false - }, - draft: { - clipPlane: false, - clipPlaneFactor: 0.5, - clipPlaneSpeed: 0.00003 - }, - - /* - * Separate group for plugins. - * Each plugin handles its field by itself. - */ - plugins: {}, - - /** - * @type {boolean} - * @instance - */ - axes: true, - - /** - * @type {boolean} - * @instance - */ - fog: true, - - /** - * @type {boolean} - * @instance - */ - fps: true, - - /** - * Switch using of z-sprites for sphere and cylinder geometry - * @type {boolean} - * @instance - */ - zSprites: true, - isoSurfaceFakeOpacity: true, - - /** - * @type {boolean} - * @instance - */ - suspendRender: true, - nowater: false, - - /** - * @type {boolean} - * @instance - */ - autobuild: true, - - /** - * Anti-aliasing. - * @type {boolean} - * @instance - */ - fxaa: true, - - /** - * Outline depths - * @type {boolean} - * @instance - */ - outline: { - on: false, - color: 0x000000, - threshold: 0.1, - thickness: 1 - }, - - /** - * Ambient Occlusion special effect. - * @type {boolean} - * @instance - */ - ao: false, - - /** - * Shadows options. - * - * @property {boolean} shadowMap - enable/disable. - * @property {string} basic/percentage-closer filtering/non-uniform randomizing pcf. - * @property {number} radius for percentage-closer filtering. - */ - shadow: { - on: false, - type: 'random' - /* basic, pcf, random */ - , - radius: 1.0 - }, - - /** - * Auto-rotation with constant speed. - * @type {number} - * @instance - */ - autoRotation: 0.0, - - /** - * Set maximum fps for animation. - * @type {number} - * @instance - */ - maxfps: 30, - - /** - * Set fbx output precision. - * @type {number} - * @instance - */ - fbxprec: 4, - - /** - * Auto-rotation axis. - * - * - true: complex auto-rotation is about vertical axis - * - false: rotation axis is defined by last user rotation - * - * @type {boolean} - * @instance - */ - autoRotationAxisFixed: true, - - /** - * Enable zooming with mouse wheel or pinch gesture. - * @type {boolean} - * @instance - */ - zooming: true, - - /** - * Enable picking atoms & residues with left mouse button or touch. - * @type {boolean} - * @instance - */ - picking: true, - - /** - * Set picking mode ('atom', 'residue', 'chain', 'molecule'). - * @type {string} - * @instance - */ - pick: 'atom', - - /** - * Make "component" and "fragment" editing modes available. - * @type {boolean} - * @instance - */ - editing: false, - - /** - * Detect aromatic loops. - * @type {boolean} - * @instance - */ - aromatic: false, - - /** - * Load only one biological unit from all those described in PDB file. - * @type {boolean} - * @instance - */ - singleUnit: true, - - /** - * Set stereo mode ('NONE', 'SIMPLE', 'DISTORTED', 'ANAGLYPH', 'WEBVR'). - * @type {string} - * @instance - */ - stereo: 'NONE', - - /** - * Enable smooth transition between views - * @type {boolean} - * @instance - */ - interpolateViews: true, - - /** - * Set transparency mode ('standard', 'prepass'). - * @type {string} - * @instance - */ - transparency: 'prepass', - - /** - * Mouse translation speed. - * @type {number} - * @instance - */ - translationSpeed: 2, - debug: { - example: 3.5, - text: 'hello!', - good: true, - ssaoKernelRadius: 0.7, - ssaoFactor: 0.7, - stereoBarrel: 0.25 - }, - use: { - multiFile: false - } - }; //---------------------------------------------------------------------------- - // SETTINGS CLASS - //---------------------------------------------------------------------------- - - function Settings() { - EventDispatcher.call(this); - this.old = null; - this.now = {}; - this._changed = {}; - this.reset(); } - - utils.deriveClass(Settings, EventDispatcher, { - defaults: defaults$1, - set: function set(path, value) { - if (_.isString(path)) { - var oldValue = _.get(this.now, path); - - if (oldValue !== value) { - _.set(this.now, path, value); - - this._notifyChange(path, value); - } - } else { - var diff = utils.objectsDiff(path, this.now); - - if (!_.isEmpty(diff)) { - _.merge(this.now, diff); - - this._notifyChanges(diff); - } - } - }, - get: function get(path, defaultValue) { - return _.get(this.now, path, defaultValue); - }, - reset: function reset() { - var diff = utils.objectsDiff(defaults$1, this.now); - this.now = _.cloneDeep(defaults$1); - this.old = null; - - this._notifyChanges(diff); - - this._changed = {}; - }, - checkpoint: function checkpoint() { - this.old = _.cloneDeep(this.now); - this._changed = {}; - }, - _notifyChange: function _notifyChange(path, value) { - this._changed[path] = true; - this.dispatchEvent({ - type: "change:".concat(path), - value: value - }); - }, - _notifyChanges: function _notifyChanges(diff) { - var _this = this; - - utils.forInRecursive(diff, function (deepValue, deepPath) { - _this._notifyChange(deepPath, deepValue); - }); - }, - changed: function changed() { - if (!this.old) { - return []; - } - - var old = this.old, - now = this.now; - - var keys = _.filter(Object.keys(this._changed), function (key) { - return _.get(old, key) !== _.get(now, key); - }); - - return keys; - }, - applyDiffs: function applyDiffs(diffs) { - if (diffs.hasOwnProperty('VERSION') && diffs.VERSION !== VERSION) { - throw new Error('Settings version does not match!'); - } // VERSION shouldn't be presented inside settings structure - - - delete diffs.VERSION; - this.reset(); - this.set(diffs); - }, - getDiffs: function getDiffs(versioned) { - var diffs = utils.objectsDiff(this.now, defaults$1); - - if (versioned) { - diffs.VERSION = VERSION; - } - - return diffs; - }, - setPluginOpts: function setPluginOpts(plugin, opts) { - defaults$1.plugins[plugin] = _.cloneDeep(opts); - this.now.plugins[plugin] = _.cloneDeep(opts); + checkAndAdd('set', 'autobuild false'); + checkAndAdd('load', opts.load, true); + checkAndAdd('unit', opts.unit); + checkAndAdd('preset', opts.preset); + addReps(opts.reps); + addObjects(opts._objects); + utils.forInRecursive(opts.settings, (value, key) => { + // I heard these lines in the whispers of the Gods + // Handle preset setting in reps + if (key === 'preset') { + return; } + checkAndAdd(`set ${key}`, value, true); }); - var settings = new Settings(); - - var repIndex = 0; - - function asBoolean(value) { - return !(!value || value === '0' || _.isString(value) && value.toLowerCase() === 'false'); - } - - var adapters = { - string: String, - number: Number, - "boolean": asBoolean - }; // Level 1 assignment symbol - - var cL1Ass = '='; - var cOptsSep = '!'; // Level 2 (options) assignment symbol - - var cL2Ass = ':'; // Level 2 (options) separator symbol - - var cLSep = ','; - var cCommonIgnoreSymbols = '$;@/?'; - /** - * We may (and should) leave as is for better readability: - * - * $ , ; : @ / ? - */ - - /** - * Generate regular expression for symbols excluded for first level encryption - */ - - function getLevel1ExcludedExpr() { - var cLevel1Ignores = ':,'; - return utils.generateRegExp(cCommonIgnoreSymbols + cLevel1Ignores); - } - /** - * Generate regular expression for symbols excluded for first level encryption - * (options, etc, ..) - */ - - - function getLevel2ExcludedExpr() { - var cLevel2Ignores = ' '; - return utils.generateRegExp(cCommonIgnoreSymbols + cLevel2Ignores); - } - - var cL1ExclExpr = getLevel1ExcludedExpr(); - - function encodeQueryComponentL1(value) { - return utils.encodeQueryComponent(value, cL1ExclExpr); - } - - var cL2ExclExpr = getLevel2ExcludedExpr(); - - function encodeQueryComponentL2(value) { - return utils.encodeQueryComponent(value, cL2ExclExpr); - } - - function ensureRepList(opts) { - var reps = opts.reps; - - if (!reps) { - var presets = settings.now.presets; - var preset = opts.preset || settings.now.preset; - reps = presets[preset]; - - if (!reps) { - logger.warn("Unknown preset \"".concat(preset, "\"")); - - var _Object$keys = Object.keys(presets); - - var _Object$keys2 = slicedToArray(_Object$keys, 1); - - preset = _Object$keys2[0]; - reps = presets[preset]; // fall back to any preset - } - - opts.preset = preset; - opts.reps = utils.deriveDeep(reps, true); - } - } - - function ensureRepAssign(opts, prop, value) { - ensureRepList(opts); - var rep = opts.reps[repIndex]; // prop specified twice therefore start new rep by cloning the current - - if (rep.hasOwnProperty(prop)) { - repIndex = opts.reps.length; - opts.reps[repIndex] = utils.deriveDeep(rep, true); - } - - if (value !== undefined) { - opts.reps[repIndex][prop] = value; - } - } - - function addObject(opts, params, options) { - if (opts._objects === undefined) { - opts._objects = []; - } - - var _options = slicedToArray(options, 2), - type = _options[0], - newOpts = _options[1]; - - var newObj = { - type: type, - params: params - }; - - if (newOpts !== undefined) { - newObj.opts = newOpts; + checkAndAdd('view', opts.view); + checkAndAdd('set', 'autobuild true'); + return commandsList.join('\n'); +} +/* harmony default export */ const options = ({ + fromURL, + fromAttr, + adapters, + toURL, + toScript +}); +;// CONCATENATED MODULE: ./src/chem/Atom.js +/** + * Atom measurements. + * + * @param {Residue} residue - (required) Residue containing the atom + * @param {string} name - (required) Name, unique in the residue + * @param {Element} type - (required) Chemical element reference + * @param {THREE.Vector3} position - Registered coordinates + * + * @param {number} role - Role of atom inside monomer: Lead and wing are particularity interesting + * @param {boolean} het - Non-standard residue indicator + * + * @param {number} serial - Serial number, unique in the model + * @param {string} location - Alternative location indicator (usually space or A-Z) + * @param {number} occupancy - Occupancy percentage, from 0 to 1 + * @param {number} temperature - Temperature + * @param {number} charge - Charge + * + * @exports Atom + * @constructor + */ + +class Atom { + constructor(residue, name, type, position, role, het, serial, location, occupancy, temperature, charge) { + this.index = -1; + this.residue = residue; + this.name = name; + this.element = type; + this.position = position; + this.role = role; + this.mask = 1 | 0; + this.het = het; + this.serial = serial; + this.location = (location || ' ').charCodeAt(0); + this.occupancy = occupancy || 1; + this.temperature = temperature; + this.charge = charge; + this.hydrogenCount = -1; // explicitly invalid + this.radicalCount = 0; + this.valence = -1; // explicitly invalid + + this.bonds = []; + this.flags = 0x0000; + if (type.name === 'H') { + this.flags |= Atom.Flags.HYDROGEN; + } else if (type.name === 'C') { + this.flags |= Atom.Flags.CARBON; } - - opts._objects[opts._objects.length] = newObj; } - - function parseParams(str, params) { - var sep = str.indexOf(','); - - if (sep >= 0) { - params.push(str.substr(sep + 1).split(',')); - return str.substr(0, sep); - } // keep this untouched if no params were extracted - - - return str; + isHet() { + return this.het; } - - function extractArgs(input, defaultsDict, params) { - if (input) { - var bang = input.indexOf(cOptsSep); - var inputVal = parseParams(input.substr(0, bang >= 0 ? bang : undefined), params); - - if (bang >= 0) { - var args = input.substr(bang + 1).split(cLSep); - input = inputVal; - - if (defaultsDict) { - var defaults = defaultsDict[input]; - var opts = utils.deriveDeep(defaults, true); - args.forEach(function (arg) { - var pair = arg.split(cL2Ass, 2); - var key = decodeURIComponent(pair[0]); - var value = decodeURIComponent(pair[1]); - - var adapter = adapters[_typeof_1(_.get(defaults, key))]; - - if (adapter) { - _.set(opts, key, adapter(value)); - } else { - logger.warn("Unknown argument \"".concat(key, "\" for option \"").concat(input, "\"")); - } - }); - - if (Object.keys(opts).length > 0) { - input = [input, opts]; - } - } - } else { - input = inputVal; - } - } - - return input; - } - - var actions = { - l: 'load', - load: String, - t: 'type', - type: String, - v: 'view', - view: String, - u: 'unit', - unit: Number, - menu: asBoolean, - // Commands - o: 'object', - object: function object(value, opts) { - var params = []; - var options = extractArgs(value, settings.defaults.objects, params); - - if (!Array.isArray(options)) { - options = [options]; - } - - addObject(opts, params[0], options); - }, - p: 'preset', - preset: function preset(value, opts) { - opts.preset = value; - opts.reps = null; - ensureRepList(opts); - }, - r: 'rep', - rep: function rep(value, opts) { - ensureRepList(opts); - repIndex = Number(value); // clamp the index to one greater than the last - - repIndex = repIndex <= opts.reps.length ? repIndex < 0 ? 0 : repIndex : opts.reps.length; // create a new rep if it is adjacent to the existing ones - - if (repIndex === opts.reps.length) { - // if there is no rep to derive from, derive from the first rep of the default - opts.reps[repIndex] = repIndex > 0 ? utils.deriveDeep(opts.reps[repIndex - 1], true) : utils.deriveDeep(settings.defaults.presets["default"][0], true); - } - }, - s: 'select', - select: function select(value, opts) { - ensureRepAssign(opts, 'selector', value); - }, - m: 'mode', - mode: function mode(value, opts) { - ensureRepAssign(opts, 'mode', extractArgs(value, settings.defaults.modes)); - }, - c: 'color', - color: function color(value, opts) { - ensureRepAssign(opts, 'colorer', extractArgs(value, settings.defaults.colorers)); - }, - mt: 'material', - material: function material(value, opts) { - ensureRepAssign(opts, 'material', extractArgs(value, settings.defaults.materials)); - }, - dup: function dup(value, opts) { - ensureRepList(opts); - var reps = opts.reps; - var rep = reps[repIndex]; - repIndex = reps.length; - reps[repIndex] = utils.deriveDeep(rep, true); - }, - // Settings shortcuts - ar: 'autoResolution' - }; - - function _fromArray(entries) { - repIndex = 0; - var opts = {}; - - for (var i = 0, n = entries.length; i < n; ++i) { - var - /** string[] */ - entry = entries[i]; - var - /** string? */ - key = entry[0]; - var - /** string? */ - value = entry[1]; - var - /** function|string? */ - action = actions[key]; // unwind shortcuts and aliases - - while (_.isString(action)) { - key = action; - action = actions[key]; - } // either set a property or use specialized parser - - - if (!action) { - var adapter = adapters[_typeof_1(_.get(settings.defaults, key))]; - - if (adapter) { - _.set(opts, "settings.".concat(key), adapter(value)); - } else { - logger.warn("Unknown option \"".concat(key, "\"")); - } - } else if (_.isFunction(action)) { - var result = action(value, opts); - - if (result !== undefined) { - opts[key] = result; - } - } - } - - return opts; - } - - function fromAttr(attr) { - return _fromArray(utils.getUrlParameters("?".concat(attr || ''))); - } - - function fromURL(url) { - return _fromArray(utils.getUrlParameters(url)); - } - - function _processOptsForURL(opts) { - var str = []; - var i = 0; - utils.forInRecursive(opts, function (value, key) { - str[i++] = encodeQueryComponentL2(key) + cL2Ass + encodeQueryComponentL2(value); - }); - return str.join(cLSep); - } - - function _processArgsForURL(args) { - if (!_.isArray(args)) { - return args; - } - - if (args.length < 2) { - return args[0]; - } - - return "".concat(args[0]).concat(cOptsSep).concat(_processOptsForURL(args[1])); - } - - function _processObjForURL(objOpts) { - if (!objOpts || !objOpts.type) { - return undefined; - } - - var res = objOpts.type; - - if (_.isArray(objOpts.params) && objOpts.params.length > 0) { - res += ",".concat(objOpts.params.join(',')); - } - - if (objOpts.opts) { - res += cOptsSep + _processOptsForURL(objOpts.opts); - } - - return res; - } - - function toURL(opts) { - var stringList = []; - var idx = 0; - - function checkAndAdd(prefix, value) { - if (value !== null && value !== undefined) { - stringList[idx++] = encodeQueryComponentL1(prefix) + cL1Ass + encodeQueryComponentL1(value); - } - } - - function addReps(repList) { - if (!repList) { - return; - } - - for (var i = 0, n = repList.length; i < n; ++i) { - if (_.isEmpty(repList[i])) { - continue; - } - - checkAndAdd('r', i); - checkAndAdd('s', repList[i].selector); - checkAndAdd('m', _processArgsForURL(repList[i].mode)); - checkAndAdd('c', _processArgsForURL(repList[i].colorer)); - checkAndAdd('mt', _processArgsForURL(repList[i].material)); - } - } - - function addObjects(objList) { - if (!objList) { - return; - } - - for (var i = 0, n = objList.length; i < n; ++i) { - checkAndAdd('o', _processObjForURL(objList[i])); - } - } - - checkAndAdd('l', opts.load); - checkAndAdd('u', opts.unit); - checkAndAdd('p', opts.preset); - addReps(opts.reps); - addObjects(opts._objects); - checkAndAdd('v', opts.view); - utils.forInRecursive(opts.settings, function (value, key) { - // I heard these lines in the whispers of the Gods - // Handle preset setting in reps - if (key === 'preset') { - return; - } - - checkAndAdd(key, value); - }); - var url = ''; - - if (typeof window !== 'undefined') { - var _window = window, - location = _window.location; - url = "".concat(location.protocol, "//").concat(location.host).concat(location.pathname); - } - - if (stringList.length > 0) { - url += "?".concat(stringList.join('&')); - } - - return url; - } - - function _processOptsForScript(opts) { - var str = []; - var i = 0; - utils.forInRecursive(opts, function (value, key) { - str[i++] = "".concat(key, "=").concat(utils.enquoteString(value)); - }); - return str.join(' '); - } - - function _processArgsForScript(args) { - if (!_.isArray(args)) { - return args; - } - - if (args.length < 2) { - return args[0]; - } - - return "".concat(args[0], " ").concat(_processOptsForScript(args[1])); - } - - function _processObjForScript(objOpts) { - if (!objOpts || !objOpts.type) { - return undefined; - } - - var res = objOpts.type; - - if (_.isArray(objOpts.params) && objOpts.params.length > 0) { - res += " ".concat(objOpts.params.map(utils.enquoteString).join(' ')); - } - - if (objOpts.opts) { - res += " ".concat(_processOptsForScript(objOpts.opts)); - } - - return res; - } - - function _processRepsForScript(rep, index) { - var repString = []; - var strIdx = 0; - - function localAdd(prefix, value) { - if (value !== null && value !== undefined) { - repString[strIdx++] = prefix + value; - } - } - - if (_.isEmpty(rep)) { - return null; - } - - localAdd('', index); - localAdd('s=', utils.enquoteString(rep.selector)); - localAdd('m=', _processArgsForScript(rep.mode)); - localAdd('c=', _processArgsForScript(rep.colorer)); - localAdd('mt=', _processArgsForScript(rep.material)); - return repString.join(' '); - } - - function toScript(opts) { - var commandsList = []; - var idx = 0; - - function checkAndAdd(command, value, saveQuotes) { - if (value !== null && value !== undefined) { - var quote = typeof value === 'string' && saveQuotes ? '"' : ''; - commandsList[idx++] = "".concat(command, " ").concat(quote).concat(value).concat(quote).trim(); - } - } - - function addReps(repList) { - if (!repList) { - return; - } - - for (var i = 0, n = repList.length; i < n; ++i) { - checkAndAdd('rep', _processRepsForScript(repList[i], i)); - } - } - - function addObjects(objList) { - if (!objList) { - return; - } - - for (var i = 0, n = objList.length; i < n; ++i) { - checkAndAdd('', _processObjForScript(objList[i])); - } - } - - checkAndAdd('set', 'autobuild false'); - checkAndAdd('load', opts.load, true); - checkAndAdd('unit', opts.unit); - checkAndAdd('preset', opts.preset); - addReps(opts.reps); - addObjects(opts._objects); - utils.forInRecursive(opts.settings, function (value, key) { - // I heard these lines in the whispers of the Gods - // Handle preset setting in reps - if (key === 'preset') { - return; - } - - checkAndAdd("set ".concat(key), value, true); - }); - checkAndAdd('view', opts.view); - checkAndAdd('set', 'autobuild true'); - return commandsList.join('\n'); - } - - var options = { - fromURL: fromURL, - fromAttr: fromAttr, - adapters: adapters, - toURL: toURL, - toScript: toScript - }; - - function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; - } - - var defineProperty = _defineProperty; - - /** - * Atom measurements. - * - * @param {Residue} residue - (required) Residue containing the atom - * @param {string} name - (required) Name, unique in the residue - * @param {Element} type - (required) Chemical element reference - * @param {THREE.Vector3} position - Registered coordinates - * - * @param {number} role - Role of atom inside monomer: Lead and wing are particularity interesting - * @param {boolean} het - Non-standard residue indicator - * - * @param {number} serial - Serial number, unique in the model - * @param {string} location - Alternative location indicator (usually space or A-Z) - * @param {number} occupancy - Occupancy percentage, from 0 to 1 - * @param {number} temperature - Temperature - * @param {number} charge - Charge - * - * @exports Atom - * @constructor - */ - var Atom = /*#__PURE__*/function () { - function Atom(residue, name, type, position, role, het, serial, location, occupancy, temperature, charge) { - classCallCheck(this, Atom); - - this.index = -1; - this.residue = residue; - this.name = name; - this.element = type; - this.position = position; - this.role = role; - this.mask = 1 | 0; - this.het = het; - this.serial = serial; - this.location = (location || ' ').charCodeAt(0); - this.occupancy = occupancy || 1; - this.temperature = temperature; - this.charge = charge; - this.hydrogenCount = -1; // explicitly invalid - - this.radicalCount = 0; - this.valence = -1; // explicitly invalid - - this.bonds = []; - this.flags = 0x0000; - - if (type.name === 'H') { - this.flags |= Atom.Flags.HYDROGEN; - } else if (type.name === 'C') { - this.flags |= Atom.Flags.CARBON; - } - } - - createClass(Atom, [{ - key: "isHet", - value: function isHet() { - return this.het; - } - }, { - key: "isHydrogen", - value: function isHydrogen() { - return this.element.number === 1; - } - }, { - key: "getVisualName", - value: function getVisualName() { - var name = this.name; - - if (name.length > 0) { - return name; - } - - return this.element.name.trim(); - } - }, { - key: "forEachBond", - value: function forEachBond(process) { - var bonds = this.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - process(bonds[i]); - } - } - }, { - key: "getFullName", - value: function getFullName() { - var name = ''; - - if (this.residue !== null) { - if (this.residue._chain !== null) { - name += "".concat(this.residue._chain.getName(), "."); - } - - name += "".concat(this.residue._sequence, "."); - } - - name += this.name; - return name; - } - /** - * Enumeration of atom flag values. - * - * @enum {number} - * @readonly - */ - - }]); - - return Atom; - }(); - - defineProperty(Atom, "Flags", { - CARBON: 0x0001, - // OXYGEN: 0x0002, - // NITROGEN: 0x0004, - HYDROGEN: 0x0008, - - /** Non-polar hydrogen (it is also a HYDROGEN) */ - NONPOLARH: 0x1008 - }); - - var Element = function Element(number, name, fullName, weight, radius, radiusBonding, hValency) { - classCallCheck(this, Element); - - this.number = number; - this.name = name; - this.fullName = fullName; - this.weight = weight; - this.radius = radius; - this.radiusBonding = radiusBonding; - this.hydrogenValency = hValency; - }; - - defineProperty(Element, "Constants", { - /* eslint-disable no-magic-numbers */ - U1: 1, - Lead: 2, - U2: 3, - Wing: 4, - U18: 18 - /* eslint-enable no-magic-numbers */ - - }); - - defineProperty(Element, "Role", { - /* eslint-disable no-magic-numbers */ - N: Element.Constants.U1, - CA: Element.Constants.Lead, - C: Element.Constants.U2, - O: Element.Constants.Wing, - SG: Element.Constants.U18 - /* eslint-enable no-magic-numbers */ - - }); - - defineProperty(Element, "ByAtomicNumber", [ - /* eslint-disable no-magic-numbers */ - null, new Element(1, 'H', 'Hydrogen', 1.008, 1.2, 0.23, [1]), new Element(2, 'HE', 'Helium', 4.003, 1.4, 0.93, [0]), new Element(3, 'LI', 'Lithium', 6.941, 1.82, 0.68, [1]), new Element(4, 'BE', 'Beryllium', 9.012, 1.7, 0.35, [2]), new Element(5, 'B', 'Boron', 10.81, 2.08, 0.83, [3]), new Element(6, 'C', 'Carbon', 12.011, 1.95, 0.68, [4]), new Element(7, 'N', 'Nitrogen', 14.007, 1.85, 0.68, [3, 5]), new Element(8, 'O', 'Oxygen', 15.999, 1.7, 0.68, [2, 4]), new Element(9, 'F', 'Fluorine', 18.998, 1.73, 0.64, [1]), new Element(10, 'NE', 'Neon', 20.18, 1.54, 1.12, [0]), new Element(11, 'NA', 'Sodium', 22.99, 2.27, 0.97, [1]), new Element(12, 'MG', 'Magnesium', 24.305, 1.73, 1.1, [2]), new Element(13, 'AL', 'Aluminum', 26.981, 2.05, 1.35, [3]), new Element(14, 'SI', 'Silicon', 28.086, 2.1, 1.2, [4]), new Element(15, 'P', 'Phosphorus', 30.974, 2.08, 0.75, [3, 5]), new Element(16, 'S', 'Sulfur', 32.07, 2, 1.02, [2, 4, 6]), new Element(17, 'CL', 'Chlorine', 35.453, 1.97, 0.99, [1, 3, 5, 7]), new Element(18, 'AR', 'Argon', 39.948, 1.88, 1.57, [0]), new Element(19, 'K', 'Potassium', 39.1, 2.75, 1.33, [1]), new Element(20, 'CA', 'Calcium', 40.08, 1.973, 0.99, [2]), new Element(21, 'SC', 'Scandium', 44.956, 1.7, 1.44, [0]), new Element(22, 'TI', 'Titanium', 47.88, 1.7, 1.47, [0]), new Element(23, 'V', 'Vanadium', 50.941, 1.7, 1.33, [0]), new Element(24, 'CR', 'Chromium', 52, 1.7, 1.35, [0]), new Element(25, 'MN', 'Manganese', 54.938, 1.7, 1.35, [0]), new Element(26, 'FE', 'Iron', 55.847, 1.7, 1.34, [0]), new Element(27, 'CO', 'Cobalt', 58.93, 1.7, 1.33, [0]), new Element(28, 'NI', 'Nickel', 58.69, 1.63, 1.5, [0]), new Element(29, 'CU', 'Copper', 63.55, 1.4, 1.52, [0]), new Element(30, 'ZN', 'Zinc', 65.39, 1.39, 1.45, [0]), new Element(31, 'GA', 'Gallium', 69.72, 1.87, 1.22, [3]), new Element(32, 'GE', 'Germanium', 72.61, 1.7, 1.17, [4]), new Element(33, 'AS', 'Arsenic', 74.92, 1.85, 1.21, [3, 5]), new Element(34, 'SE', 'Selenium', 78.96, 1.9, 1.22, [2, 4, 6]), new Element(35, 'BR', 'Bromine', 79.9, 2.1, 1.21, [1, 3, 5, 7]), new Element(36, 'KR', 'Krypton', 83.8, 2.02, 1.91, [0]), new Element(37, 'RB', 'Rubidium', 85.47, 1.7, 1.47, [1]), new Element(38, 'SR', 'Strontium', 87.62, 1.7, 1.12, [2]), new Element(39, 'Y', 'Yttrium', 88.91, 1.7, 1.78, [0]), new Element(40, 'ZR', 'Zirconium', 91.22, 1.7, 1.56, [0]), new Element(41, 'NB', 'Niobium', 92.91, 1.7, 1.48, [0]), new Element(42, 'MO', 'Molybdenum', 95.94, 1.7, 1.47, [0]), new Element(43, 'TC', 'Technetium', 98.91, 1.7, 1.35, [0]), new Element(44, 'RU', 'Ruthenium', 101.07, 1.7, 1.4, [0]), new Element(45, 'RH', 'Rhodium', 102.91, 1.7, 1.45, [0]), new Element(46, 'PD', 'Palladium', 106.42, 1.63, 1.5, [0]), new Element(47, 'AG', 'Silver', 107.87, 1.72, 1.59, [0]), new Element(48, 'CD', 'Cadmium', 112.41, 1.58, 1.69, [0]), new Element(49, 'IN', 'Indium', 114.82, 1.93, 1.63, [3]), new Element(50, 'SN', 'Tin', 118.71, 2.17, 1.46, [2, 4]), new Element(51, 'SB', 'Antimony', 121.75, 2.2, 1.46, [3, 5]), new Element(52, 'TE', 'Tellurium', 127.6, 2.06, 1.47, [2, 4, 6]), new Element(53, 'I', 'Iodine', 126.91, 2.15, 1.4, [1, 3, 5, 7]), new Element(54, 'XE', 'Xenon', 131.29, 2.16, 1.98, [0]), new Element(55, 'CS', 'Cesium', 132.91, 1.7, 1.67, [1]), new Element(56, 'BA', 'Barium', 137.33, 1.7, 1.34, [2]), new Element(57, 'LA', 'Lanthanum', 138.91, 1.7, 1.87, [0]), new Element(58, 'CE', 'Cerium', 140.12, 1.7, 1.83, [0]), new Element(59, 'PR', 'Praseodymium', 140.91, 1.7, 1.82, [0]), new Element(60, 'ND', 'Neodymium', 144.24, 1.7, 1.81, [0]), new Element(61, 'PM', 'Promethium', 144.9, 1.7, 1.8, [0]), new Element(62, 'SM', 'Samarium', 150.36, 1.7, 1.8, [0]), new Element(63, 'EU', 'Europium', 151.96, 1.7, 1.99, [0]), new Element(64, 'GD', 'Gadolinium', 157.25, 1.7, 1.79, [0]), new Element(65, 'TB', 'Terbium', 158.93, 1.7, 1.76, [0]), new Element(66, 'DY', 'Dysprosium', 162.5, 1.7, 1.75, [0]), new Element(67, 'HO', 'Holmium', 164.93, 1.7, 1.74, [0]), new Element(68, 'ER', 'Erbium', 167.26, 1.7, 1.73, [0]), new Element(69, 'TM', 'Thulium', 168.93, 1.7, 1.72, [0]), new Element(70, 'YB', 'Ytterbium', 173.04, 1.7, 1.94, [0]), new Element(71, 'LU', 'Lutetium', 174.97, 1.7, 1.72, [0]), new Element(72, 'HF', 'Hafnium', 178.49, 1.7, 1.57, [0]), new Element(73, 'TA', 'Tantalum', 180.95, 1.7, 1.43, [0]), new Element(74, 'W', 'Tungsten', 183.85, 1.7, 1.37, [0]), new Element(75, 'RE', 'Rhenium', 186.21, 1.7, 1.35, [0]), new Element(76, 'OS', 'Osmium', 190.2, 1.7, 1.37, [0]), new Element(77, 'IR', 'Iridium', 192.22, 1.7, 1.32, [0]), new Element(78, 'PT', 'Platinum', 195.08, 1.72, 1.5, [0]), new Element(79, 'AU', 'Gold', 196.97, 1.66, 1.5, [0]), new Element(80, 'HG', 'Mercury', 200.59, 1.55, 1.7, [0]), new Element(81, 'TL', 'Thallium', 204.38, 1.96, 1.55, [1, 3]), new Element(82, 'PB', 'Lead', 207.2, 2.02, 1.54, [2, 4]), new Element(83, 'BI', 'Bismuth', 208.98, 1.7, 1.54, [3, 5]), new Element(84, 'PO', 'Polonium', 210, 1.7, 1.68, [2, 4, 6]), new Element(85, 'AT', 'Astatine', 210, 1.7, 1.7, [1, 3, 5, 7]), new Element(86, 'RN', 'Radon', 222, 1.7, 2.4, [0]), new Element(87, 'FR', 'Francium', 223, 1.7, 2, [1]), new Element(88, 'RA', 'Radium', 226.03, 1.7, 1.9, [2]), new Element(89, 'AC', 'Actinium', 227.03, 1.7, 1.88, [0]), new Element(90, 'TH', 'Thorium', 232.04, 1.7, 1.79, [0]), new Element(91, 'PA', 'Protactinium', 231.04, 1.7, 1.61, [0]), new Element(92, 'U', 'Uranium', 238.03, 1.86, 1.58, [0]), new Element(93, 'NP', 'Neptunium', 237.05, 1.7, 1.55, [0]), new Element(94, 'PU', 'Plutonium', 239.1, 1.7, 1.53, [0]), new Element(95, 'AM', 'Americium', 243.1, 1.7, 1.51, [0]), new Element(96, 'CM', 'Curium', 247.1, 1.7, 1.5, [0]), new Element(97, 'BK', 'Berkelium', 247.1, 1.7, 1.5, [0]), new Element(98, 'CF', 'Californium', 252.1, 1.7, 1.5, [0]), new Element(99, 'ES', 'Einsteinium', 252.1, 1.7, 1.5, [0]), new Element(100, 'FM', 'Fermium', 257.1, 1.7, 1.5, [0]), new Element(101, 'MD', 'Mendelevium', 256.1, 1.7, 1.5, [0]), new Element(102, 'NO', 'Nobelium', 259.1, 1.7, 1.5, [0]), new Element(103, 'LR', 'Lawrencium', 260.1, 1.7, 1.5, [0]), new Element(104, 'RF', 'Rutherfordium', 261, 1.7, 1.6, [0]), new Element(105, 'DB', 'Dubnium', 262, 1.7, 1.6, [0]), new Element(106, 'SG', 'Seaborgium', 263, 1.7, 1.6, [0]), new Element(107, 'BH', 'Bohrium', 262, 1.7, 1.6, [0]), new Element(108, 'HS', 'Hassium', 265, 1.7, 1.6, [0]), new Element(109, 'MT', 'Meitnerium', 268, 1.7, 1.6, [0]) - /* eslint-enable no-magic-numbers */ - ]); - - defineProperty(Element, "ByName", { - // Duplicate atomic numbers (isotopes) - - /* eslint-disable no-magic-numbers */ - D: new Element(1, 'D', 'Deuterium', 2.014, 1.2, 0.23, [1]), - T: new Element(1, 'T', 'Tritium', 3.016, 1.2, 0.23, [1]) - /* eslint-enable no-magic-numbers */ - // All regular elements will be added later, automatically - - }); - - (function () { - var byAtomicNumber = Element.ByAtomicNumber; - var byName = Element.ByName; - - for (var i = 0, n = byAtomicNumber.length; i < n; ++i) { - var element = byAtomicNumber[i]; - - if (element) { - byName[element.name] = element; - } - } - })(); // find atom type by chemical element (or create if missing) - - - Element.getByName = function (element) { - var type = Element.ByName[element]; - - if (!type) { - type = Element.ByName[element] = new Element(0, element, 'Unknown', 0, 1.0, 0.01, [0]); - } - - return type; - }; - - var cBondTypes = { - /** Was generated manually */ - UNKNOWN: 0, - - /** Simple covalent bond */ - COVALENT: 1, - - /** Aromatic bond */ - AROMATIC: 2 - }; - - function getAtomPos(atom) { - return atom.position; - } - /** - * Bond between atoms. - * - * @param {Atom} left - The first atom. - * @param {Atom} right - The second atom. - * @param {number} order - Order of current bond. - * @param {number} type - Bond type. - * @param {boolean} fixed - Indicator of a pre-specified connection (in contrast with guessed one). - * - * @exports Bond - * @constructor - */ - - - var Bond = /*#__PURE__*/function () { - function Bond(left, right, order, type, fixed) { - classCallCheck(this, Bond); - - this._left = left; - this._right = right; - this._fixed = fixed; - this._index = -1; - - if (left > right) { - throw new Error('In a bond atom indices must be in increasing order'); - } - - this._order = order; - this._type = type; - } - - createClass(Bond, [{ - key: "getLeft", - value: function getLeft() { - return this._left; - } - }, { - key: "getRight", - value: function getRight() { - return this._right; - } - }, { - key: "getOrder", - value: function getOrder() { - return this._order; - } - }, { - key: "calcLength", - value: function calcLength() { - return this._left.position.distanceTo(this._right.position); - } - }, { - key: "_forEachNeighbour", - value: function _forEachNeighbour(currAtom, process) { - var bonds = currAtom.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - process(bonds[i]._left !== currAtom ? bonds[i]._left : bonds[i]._right); - } - } - }, { - key: "forEachLevelOne", - value: function forEachLevelOne(process) { - var left = this._left; - var right = this._right; - - this._forEachNeighbour(left, function (atom) { - if (atom === right) { - return; - } - - process(atom); - }); - - this._forEachNeighbour(right, function (atom) { - if (atom === left) { - return; - } - - process(atom); - }); - } - }, { - key: "forEachLevelTwo", - value: function forEachLevelTwo(process) { - // TODO refactor this piece of an art? - var left = this._left; - var right = this._right; - var self = this; - - self._forEachNeighbour(left, function (atom) { - if (atom === right) { - return; - } - - self._forEachNeighbour(atom, function (l2Atom) { - if (l2Atom === left) { - return; - } - - process(l2Atom); - }); - }); - - self._forEachNeighbour(right, function (atom) { - if (atom === left) { - return; - } - - self._forEachNeighbour(atom, function (l2Atom) { - if (l2Atom === right) { - return; - } - - process(l2Atom); - }); - }); - } - }, { - key: "_fixDir", - value: function _fixDir(refPoint, currDir, posGetter) { - // count atoms to the right and to the left of the current plane - var rightCount = 0; - var leftCount = 0; - var tmpVec = refPoint.clone(); - - function checkDir(atom) { - tmpVec.copy(posGetter(atom)); - tmpVec.sub(refPoint); - var dotProd = currDir.dot(tmpVec); - - if (dotProd > 0) { - ++rightCount; - } else { - ++leftCount; - } - } - - function checkCarbon(atom) { - if (atom.element.name === 'C') { - checkDir(atom); - } - } // count all atoms to the left and right of our plane, start from level 1 and carbons - - - var stages = [[this.forEachLevelOne, checkCarbon], [this.forEachLevelOne, checkDir], [this.forEachLevelTwo, checkCarbon], [this.forEachLevelTwo, checkDir]]; - - for (var stageId = 0; stageId < stages.length; ++stageId) { - stages[stageId][0].call(this, stages[stageId][1]); - - if (leftCount > rightCount) { - return currDir.multiplyScalar(-1); - } - - if (leftCount < rightCount) { - return currDir; - } - } - - return currDir; - } - }, { - key: "calcNormalDir", - value: function calcNormalDir(posGetter) { - var left = this._left; - var right = this._right; - var first = left; - var second = right; - posGetter = posGetter === undefined ? getAtomPos : posGetter; - - if (left.bonds.length > right.bonds.length) { - first = right; - second = left; - } - - var third = first; - var maxNeibs = 0; - var _second = second, - bonds = _second.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - var another = bonds[i]._left; - - if (bonds[i]._left === second) { - another = bonds[i]._right; - } - - if (another.bonds.length > maxNeibs && another !== first) { - third = another; - maxNeibs = another.bonds.length; - } - } - - var secondPos = posGetter(second); - var firstV = posGetter(first).clone().sub(secondPos); - var secondV = posGetter(third).clone().sub(secondPos); - secondV.crossVectors(firstV, secondV); - - if (secondV.lengthSq() < 0.0001) { - secondV.set(0, 1, 0); - } - - firstV.normalize(); - secondV.normalize(); - firstV.crossVectors(secondV, firstV); - - if (firstV.lengthSq() < 0.0001) { - firstV.set(0, 1, 0); - } - - firstV.normalize(); - return this._fixDir(secondPos, firstV, posGetter); - } - }]); - - return Bond; - }(); - - defineProperty(Bond, "BondType", cBondTypes); - - Bond.prototype.BondType = cBondTypes; - - var cNucleicControlNames = ['C3\'', 'C3*', 'P', 'H5T', 'H3T']; - var cNucleicWing1Names = ['OP1', 'O1P']; - var cNucleicWing2Names = ['OP2', 'O2P']; - var cCylinderSource = ['C3\'', 'C3*', 'C1', 'C1\'', 'C1*', 'P']; - var cCylinderTarget = [{ - types: ['A', 'DA', 'G', 'DG'], - atoms: ['N1'] - }, { - types: ['C', 'DC'], - atoms: ['N3'] - }, { - types: ['T', 'DT', 'U', 'DU'], - atoms: ['O4'] - }]; - /** - * Residue instance. - * - * @param {Chain} chain - Chain this residue belongs to. - * @param {ResidueType} type - Generic residue instance type. - * @param {number} sequence - Sequence ID. - * @param {string} icode - One character insertion code (usually space or A-Z). - * - * @exports Residue - * @constructor - */ - - var Residue = /*#__PURE__*/function () { - function Residue(chain, type, sequence, icode) { - classCallCheck(this, Residue); - - this._chain = chain; - this._component = null; - this._type = type; - this._sequence = sequence; - this._icode = icode; - this._mask = 1 | 0; - this._index = -1; - this._atoms = []; - this._secondary = null; - this._firstAtom = null; - this._leadAtom = null; - this._wingAtom = null; - this._lastAtom = null; - this._controlPoint = null; - this._midPoint = null; - this._wingVector = null; - this._cylinders = null; - this._isValid = true; - this._het = false; - this._molecule = null; - this.temperature = null; - this.occupancy = null; - } // Getters and setters - - - createClass(Residue, [{ - key: "getChain", - value: function getChain() { - return this._chain; - } - }, { - key: "getMolecule", - value: function getMolecule() { - return this._molecule; - } - }, { - key: "getType", - value: function getType() { - return this._type; - } - }, { - key: "getSequence", - value: function getSequence() { - return this._sequence; - } - }, { - key: "getSecondary", - value: function getSecondary() { - return this._secondary; - } - }, { - key: "getICode", - value: function getICode() { - return this._icode; - } // Other methods - - }, { - key: "addAtom", - value: function addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge) { - var atom = new Atom(this, name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); - - var complex = this._chain.getComplex(); - - complex.addAtom(atom); - - this._atoms.push(atom); - - this._het = this._het || het; - return atom; - } - }, { - key: "getAtomCount", - value: function getAtomCount() { - return this._atoms.length; - } - }, { - key: "forEachAtom", - value: function forEachAtom(process) { - var atoms = this._atoms; - - for (var i = 0, n = atoms.length; i < n; ++i) { - if (process(atoms[i])) { - break; - } - } - } - }, { - key: "_findAtomByName", - value: function _findAtomByName(name) { - var res = null; - this.forEachAtom(function (atom) { - if (atom.name === name) { - res = atom; - return true; - } - - return false; - }); - return res; - } - }, { - key: "_findFirstAtomInList", - value: function _findFirstAtomInList(names) { - var res = null; - - for (var i = 0; i < names.length; ++i) { - res = this._findAtomByName(names[i]); - - if (res !== null) { - return res; - } - } - - return res; - } - }, { - key: "collectMask", - value: function collectMask() { - var mask = 0xffffffff; - var atoms = this._atoms; - - for (var i = 0, n = atoms.length; i < n; ++i) { - mask &= atoms[i].mask; - } - - this._mask = mask; - } - }, { - key: "getCylinderTargetList", - value: function getCylinderTargetList() { - var type = this._type._name; - - for (var i = 0, n = cCylinderTarget.length; i < n; ++i) { - for (var j = 0, m = cCylinderTarget[i].types.length; j < m; ++j) { - if (type === cCylinderTarget[i].types[j]) { - return cCylinderTarget[i].atoms; - } - } - } - - return null; - } - }, { - key: "_detectLeadWing", - value: function _detectLeadWing(dst, next, getAtomPosition) { - var leadAtom = this._findFirstAtomInList(cNucleicControlNames); - - var wingStart = this._findFirstAtomInList(cNucleicWing1Names); - - var wingEnd = this._findFirstAtomInList(cNucleicWing2Names); - - if (wingStart === null && next !== null) { - wingStart = next._findFirstAtomInList(cNucleicWing1Names); - } - - if (wingEnd === null && next !== null) { - wingEnd = next._findFirstAtomInList(cNucleicWing2Names); - } - - if (leadAtom === null || wingStart === null || wingEnd === null) { - return; - } - - dst._leadAtom = leadAtom; - dst._controlPoint = getAtomPosition(leadAtom); - dst._wingVector = getAtomPosition(wingEnd).clone().sub(getAtomPosition(wingStart)); - dst._isValid = true; - - var cylSource = this._findFirstAtomInList(cCylinderSource); - - var targetList = this.getCylinderTargetList(); - var cylTarget = targetList !== null ? this._findFirstAtomInList(targetList) : null; - - if (cylSource === null || cylTarget === null) { - return; - } - - dst._cylinders = [getAtomPosition(cylSource), getAtomPosition(cylTarget)]; - } - }, { - key: "calcWing", - value: function calcWing(prevLeadPos, currLeadPos, prevWingPos, prevWing) { - var vectorA = currLeadPos.clone().sub(prevLeadPos); - var vectorB = prevLeadPos.clone().sub(prevWingPos); - vectorB.crossVectors(vectorA, vectorB); - vectorB.crossVectors(vectorA, vectorB).normalize(); - - if (prevWing !== null && prevWing.length() > 0.0001) { - var needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2; - - if (needToNegate) { - vectorB.negate(); - } - } - - return vectorB; - } - }, { - key: "_innerFinalize", - value: function _innerFinalize(prevRes, prev, nextRes, dst, chainAsNucleic, getAtomPosition) { - var bFirstInChain = prev === null; - var lp = getAtomPosition(this._leadAtom); - var currLeadPos = new THREE.Vector3(lp.x, lp.y, lp.z); - - if (chainAsNucleic) { - this._detectLeadWing(dst, nextRes, getAtomPosition); - - return; - } - - if (bFirstInChain) { - // for first one in chain - dst._midPoint = getAtomPosition(this._firstAtom).clone(); - } else { - var prevLeadPos = prev._controlPoint; // lead point of previous monomer - - dst._midPoint = prevLeadPos.clone().lerp(currLeadPos, 0.5); - dst._wingVector = this.calcWing(prevLeadPos, currLeadPos, getAtomPosition(prevRes._wingAtom), prev._wingVector); - } - - dst._controlPoint = currLeadPos; - } - }, { - key: "_finalize2", - value: function _finalize2(prev, next, asNucleic) { - // Should be called AFTER first finalize - this._innerFinalize(prev, prev, next, this, asNucleic, function (atom) { - return atom.position; - }); - } - }, { - key: "isConnected", - value: function isConnected(anotherResidue) { - if (this._chain !== anotherResidue._chain) { - return false; - } - - if (this === anotherResidue) { - return true; - } - - var res = false; - this.forEachAtom(function (atom) { - var bonds = atom.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - var bond = bonds[i]; - - if (bond._left.residue === anotherResidue || bond._right.residue === anotherResidue) { - res = true; - return true; - } - } - - return false; - }); - return res; - } - }, { - key: "_finalize", - value: function _finalize() { - var self = this; - - var _this$_atoms = slicedToArray(this._atoms, 1); - - this._firstAtom = _this$_atoms[0]; - this._lastAtom = this._atoms[this._atoms.length - 1]; - this._leadAtom = null; - this._wingAtom = null; - var tempCount = 0; - var temperature = 0; // average temperature - - var occupCount = 0; - var occupancy = 0; // average occupancy - - this.forEachAtom(function (a) { - if (self._leadAtom === null) { - if (a.role === Element.Constants.Lead) { - self._leadAtom = a; - } - } - - if (self._wingAtom === null) { - if (a.role === Element.Constants.Wing) { - self._wingAtom = a; - } - } - - if (a.temperature) { - temperature += a.temperature; - tempCount++; - } - - if (a.occupancy) { - occupancy += a.occupancy; - occupCount++; - } - - return self._leadAtom !== null && self._wingAtom !== null; - }); - - if (tempCount > 0) { - this.temperature = temperature / tempCount; - } - - if (occupCount > 0) { - this.occupancy = occupancy / occupCount; - } // Still try to make monomer look valid - - - if (this._leadAtom === null || this._wingAtom === null) { - this._isValid = false; - } - - if (this._leadAtom === null) { - this._leadAtom = this._firstAtom; - } - - if (this._wingAtom === null) { - this._wingAtom = this._lastAtom; - } - } - }]); - - return Residue; - }(); - - /** - * Residue type. - * - * Predefined acid or created with HET, HETNAM, etc. - * - * @param {string} name - Short name, either standard (ALA, MET, etc.) or non-standard one. - * @param {string} fullName - Full residue name. - * @param {string} letterCode - 1-letter symbol. - * - * @exports ResidueType - * @constructor - */ - var ResidueType = /*#__PURE__*/function () { - function ResidueType(name, fullName, letterCode) { - classCallCheck(this, ResidueType); - - this._name = name; - this._fullName = fullName; - this.letterCode = letterCode; - this.flags = 0x0000; - } - - createClass(ResidueType, [{ - key: "getName", - value: function getName() { - return this._name; - } // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. - - }]); - - return ResidueType; - }(); // Flag combinations - - - defineProperty(ResidueType, "StandardTypes", { - /* eslint-disable no-magic-numbers */ - ALA: new ResidueType('ALA', 'Alanine', 'A'), - ARG: new ResidueType('ARG', 'Arginine', 'R'), - ASN: new ResidueType('ASN', 'Asparagine', 'N'), - ASP: new ResidueType('ASP', 'Aspartic Acid', 'D'), - CYS: new ResidueType('CYS', 'Cysteine', 'C'), - GLN: new ResidueType('GLN', 'Glutamine', 'Q'), - GLU: new ResidueType('GLU', 'Glutamic Acid', 'E'), - GLY: new ResidueType('GLY', 'Glycine', 'G'), - HIS: new ResidueType('HIS', 'Histidine', 'H'), - ILE: new ResidueType('ILE', 'Isoleucine', 'I'), - LEU: new ResidueType('LEU', 'Leucine', 'L'), - LYS: new ResidueType('LYS', 'Lysine', 'K'), - MET: new ResidueType('MET', 'Methionine', 'M'), - PHE: new ResidueType('PHE', 'Phenylalanine', 'F'), - PRO: new ResidueType('PRO', 'Proline', 'P'), - PYL: new ResidueType('PYL', 'Pyrrolysine', 'O'), - SEC: new ResidueType('SEC', 'Selenocysteine', 'U'), - SER: new ResidueType('SER', 'Serine', 'S'), - THR: new ResidueType('THR', 'Threonine', 'T'), - TRP: new ResidueType('TRP', 'Tryptophan', 'W'), - TYR: new ResidueType('TYR', 'Tyrosine', 'Y'), - VAL: new ResidueType('VAL', 'Valine', 'V'), - A: new ResidueType('A', 'Adenine', 'A'), - C: new ResidueType('C', 'Cytosine', 'C'), - G: new ResidueType('G', 'Guanine', 'G'), - I: new ResidueType('I', 'Inosine', 'I'), - T: new ResidueType('T', 'Thymine', 'T'), - U: new ResidueType('U', 'Uracil', 'U'), - DA: new ResidueType('DA', 'Adenine', 'A'), - DC: new ResidueType('DC', 'Cytosine', 'C'), - DG: new ResidueType('DG', 'Guanine', 'G'), - DI: new ResidueType('DI', 'Inosine', 'I'), - DT: new ResidueType('DT', 'Thymine', 'T'), - DU: new ResidueType('DU', 'Uracil', 'U'), - '+A': new ResidueType('+A', 'Adenine', 'A'), - '+C': new ResidueType('+C', 'Cytosine', 'C'), - '+G': new ResidueType('+G', 'Guanine', 'G'), - '+I': new ResidueType('+I', 'Inosine', 'I'), - '+T': new ResidueType('+T', 'Thymine', 'T'), - '+U': new ResidueType('+U', 'Uracil', 'U'), - WAT: new ResidueType('WAT', 'Water', ''), - H2O: new ResidueType('H2O', 'Water', ''), - HOH: new ResidueType('HOH', 'Water', ''), - DOD: new ResidueType('DOD', 'Water', ''), - UNK: new ResidueType('UNK', 'Unknown', ''), - UNL: new ResidueType('UNL', 'Unknown Ligand', '') - /* eslint-enable no-magic-numbers */ - - }); - - defineProperty(ResidueType, "Flags", { - // Amino acids - - /** Amino acid residue */ - PROTEIN: 0x0001, - - /** Basic amino acid residue */ - BASIC: 0x0002, - - /** Acidic amino acid residue */ - ACIDIC: 0x0004, - - /** Polar uncharged side chain amino acid residue */ - POLAR: 0x0008, - - /** Non-polar hydrophobic side chain amino acid residue */ - NONPOLAR: 0x0010, - - /** Aromatic amino acid residue */ - AROMATIC: 0x0020, - // Nucleic acids - - /** Nucleic residue */ - NUCLEIC: 0x0100, - - /** Purine nucleic residue */ - PURINE: 0x0200, - - /** Pyrimidine nucleic residue */ - PYRIMIDINE: 0x0400, - - /** DNA */ - DNA: 0x0800, - - /** RNA */ - RNA: 0x1000, - - /** Water */ - WATER: 0x10000 - }); - - function _addFlag(flag, list) { - for (var i = 0, n = list.length; i < n; ++i) { - var res = ResidueType.StandardTypes[list[i]]; - - if (res) { - res.flags |= flag; - } - } - } - - var Flags = ResidueType.Flags; - - _addFlag(Flags.WATER, ['WAT', 'H2O', 'HOH', 'DOD']); - - _addFlag(Flags.PROTEIN, ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLY', 'GLU', 'GLN', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'PYL', 'SEC', 'SER', 'THR', 'TRP', 'TYR', 'VAL']); - - _addFlag(Flags.BASIC, ['ARG', 'HIS', 'LYS']); - - _addFlag(Flags.ACIDIC, ['ASP', 'GLU']); - - _addFlag(Flags.POLAR, ['ASN', 'CYS', 'GLN', 'SER', 'THR', 'TYR']); - - _addFlag(Flags.NONPOLAR, ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'VAL', 'GLY']); - - _addFlag(Flags.AROMATIC, ['PHE', 'TRP', 'TYR']); - - _addFlag(Flags.NUCLEIC, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I', 'C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']); - - _addFlag(Flags.PURINE, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I']); - - _addFlag(Flags.PYRIMIDINE, ['C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']); - - _addFlag(Flags.DNA, ['DA', 'DG', 'DI', 'DC', 'DT', 'DU']); - - _addFlag(Flags.RNA, ['A', 'G', 'I', 'C', 'T', 'U']); // Table of kdHydrophobicity - - - var hydro = { - ILE: 4.5, - VAL: 4.2, - LEU: 3.8, - PHE: 2.8, - CYS: 2.5, - MET: 1.9, - ALA: 1.8, - GLY: -0.4, - THR: -0.7, - SER: -0.8, - TRP: -0.9, - TYR: -1.3, - PRO: -1.6, - HIS: -3.2, - GLU: -3.5, - GLN: -3.5, - ASP: -3.5, - ASN: -3.5, - LYS: -3.9, - ARG: -4.5 - }; - - function _addParam(param, list) { - var keys = Object.keys(list); - - for (var i = 0, n = keys.length; i < n; ++i) { - var key = keys[i]; - var value = list[key]; - ResidueType.StandardTypes[key][param] = value; - } - } - - _addParam('hydrophobicity', hydro); - - /** - * Residues in chain are either amino acid either nucleic acid (and water) - * There might be some modified/mutated residues, which type could not be determined by their name (nucleic or amino); In this - * case firstly program definites the chain type (by well-known residues) and then definites modified/mutated residues - */ - - var ChainType = { - UNKNOWN: 0, - PROTEIN: 1, - NUCLEIC: 2 - }; - /** - * Residue chain. - * - * @param {Complex} complex - Molecular complex this chain belongs to. - * @param {string} name - One character identifier (usually space, A-Z, 0-9, or a-z). - * - * @exports Chain - * @constructor - */ - - var Chain = /*#__PURE__*/function () { - function Chain(complex, name) { - classCallCheck(this, Chain); - - this._complex = complex; - this._name = name; - this._mask = 1 | 0; - this._index = -1; - this._residues = []; - this.minSequence = Number.POSITIVE_INFINITY; - this.maxSequence = Number.NEGATIVE_INFINITY; - } - - createClass(Chain, [{ - key: "getComplex", - value: function getComplex() { - return this._complex; - } - }, { - key: "getName", - value: function getName() { - return this._name; - } - }, { - key: "getResidues", - value: function getResidues() { - return this._residues; - } - }, { - key: "_determineType", - value: function _determineType() { - var residues = this._residues; - var _ResidueType$Flags = ResidueType.Flags, - PROTEIN = _ResidueType$Flags.PROTEIN, - NUCLEIC = _ResidueType$Flags.NUCLEIC; - this.type = ChainType.UNKNOWN; - - for (var i = 0, n = residues.length; i < n; ++i) { - var flags = residues[i]._type.flags; - - if ((flags & NUCLEIC) !== 0) { - this.type = ChainType.NUCLEIC; - break; - } else if ((flags & PROTEIN) !== 0) { - this.type = ChainType.PROTEIN; - break; - } - } - } - /** - * Finds thre residue with specified sequence number and inserion code - * @param {Number} seqNum sequence number - * @param {string} iCode insertion code - * @returns {*} Residue or null if not found - */ - - }, { - key: "findResidue", - value: function findResidue(seqNum, iCode) { - var residues = this._residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - var res = residues[i]; - - if (res._sequence === seqNum && res._icode === iCode) { - return [res, i]; - } - } - - return null; - } - }, { - key: "_finalize", - value: function _finalize() { - this._determineType(); - - var residues = this._residues; - var prev = null; - - for (var i = 0, n = residues.length; i < n; ++i) { - var next = i + 1 < n ? residues[i + 1] : null; - var curr = residues[i]; // TODO: skip invalid residues - - { - // eslint-disable-line no-constant-condition - curr._finalize2(prev, next, this.type === ChainType.NUCLEIC); - - prev = curr; - } - } // fix very first wing - - - if (residues.length > 1 && residues[1]._wingVector) { - var p = residues[1]._wingVector; - residues[0]._wingVector = new THREE.Vector3(p.x, p.y, p.z); - } else if (residues.length > 0) { - residues[0]._wingVector = new THREE.Vector3(1, 0, 0); - } - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - var residues = this._residues; - var prev = null; - var prevData = null; - var frameRes = frameData._residues; - var n = residues.length; - - function getAtomPos(atom) { - return frameData.getAtomPos(atom.index); - } - - for (var i = 0; i < n; ++i) { - var curr = residues[i]; - var currData = frameRes[curr._index]; - var nextRes = i + 1 < n ? residues[i + 1] : null; - - curr._innerFinalize(prev, prevData, nextRes, currData, this.type === ChainType.NUCLEIC, getAtomPos); - - prev = curr; - prevData = currData; - } - - frameRes[residues[0]._index]._wingVector = n > 1 ? frameRes[residues[1]._index]._wingVector : new THREE.Vector3(1, 0, 0); - } - /** - * Create a new residue. - * - * @param {string} name - Residue name. - * @param {number} sequence - Residue sequence number. - * @param {string} iCode - Insertion code. - * @returns {Residue} - Newly created residue instance. - */ - - }, { - key: "addResidue", - value: function addResidue(name, sequence, iCode) { - var type = this._complex.getResidueType(name); - - if (type === null) { - type = this._complex.addResidueType(name); - } - - var residue = new Residue(this, type, sequence, iCode); - - this._complex.addResidue(residue); - - this._residues.push(residue); - - if (type.flags & (ResidueType.Flags.NUCLEIC | ResidueType.Flags.PROTEIN)) { - if (this.maxSequence < sequence) { - this.maxSequence = sequence; - } - - if (this.minSequence > sequence) { - this.minSequence = sequence; - } - } - - return residue; - } - }, { - key: "getResidueCount", - value: function getResidueCount() { - return this._residues.length; - } - }, { - key: "forEachResidue", - value: function forEachResidue(process) { - var residues = this._residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - process(residues[i]); - } - } - }, { - key: "collectMask", - value: function collectMask() { - var mask = 0xffffffff; - var residues = this._residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - mask &= residues[i]._mask; - } - - this._mask = mask; - } - }]); - - return Chain; - }(); - - var _StructuralElement$ge; - /** An element of protein secondary structure. */ - - var StructuralElement = /*#__PURE__*/function () { - /** - * Create a secondary structural element of the specified type. - * - * @param {StructuralElement.Type} type Secondary structure type. - * @param {Residue} init Initial residue. - * @param {Residue} term Terminal residue. - */ - function StructuralElement(type, init, term) { - classCallCheck(this, StructuralElement); - - /** - * Secondary structure type. - * @type {StructuralElement.Type} - */ - this.type = type; - /** - * Generic secondary structure type. - * @type {StructuralElement.Generic} - */ - - this.generic = StructuralElement.genericByType[this.type] || 'loop'; - /** - * Initial residue. - * @type Residue - */ - - this.init = init; - /** - * Terminal residue. - * @type Residue - */ - - this.term = term; - } - /** - * An internal method for making a final pass over the complex to set all required references. - * - * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring. - * Just copying it as-is right now and hoping for the best. - * - * @param {object} serialAtomMap A dictionary of atoms - * @param {object} residueHash A dictionary of hashed residues to check. - * @param {Complex} complex The molecular complex this element belongs to. - */ - - - createClass(StructuralElement, [{ - key: "_finalize", - value: function _finalize(serialAtomMap, residueHash, complex) { - if (this.init instanceof Residue && this.term instanceof Residue) { - return; - } // Link all intermediate residues to this structural element - - - var start = complex.splitUnifiedSerial(this.init); - var end = complex.splitUnifiedSerial(this.term); - - for (var chainId = start.chain; chainId <= end.chain; chainId++) { - for (var serialId = start.serial; serialId <= end.serial; serialId++) { - for (var iCode = start.iCode; iCode <= end.iCode; iCode++) { - var hashCode = complex.getUnifiedSerial(chainId, serialId, iCode); - - if (residueHash[hashCode]) { - residueHash[hashCode]._secondary = this; - } - } - } - } // Replace unfined serials by objects - - - this.init = residueHash[this.init]; - this.term = residueHash[this.term]; - } - }]); - - return StructuralElement; - }(); - /** - * Specific type of a secondary structural element. - * @enum {string} - * @see StructuralElement.Generic - */ - - - StructuralElement.Type = { - /** A strand of a [beta-sheet](https://en.wikipedia.org/wiki/Beta_sheet). */ - STRAND: 'E', - - /** An isolated beta-bridge (too small for a beta-sheet). */ - BRIDGE: 'B', - - /** A [3/10 helix](https://en.wikipedia.org/wiki/310_helix) (hydrogen bonding is 3 residues apart). */ - HELIX_310: 'G', - - /** An [alpha-helix](https://en.wikipedia.org/wiki/Alpha_helix) (hydrogen bonding is 4 residues apart). */ - HELIX_ALPHA: 'H', - - /** A [pi-helix](https://en.wikipedia.org/wiki/Pi_helix) (hydrogen bonding is 5 residues apart). */ - HELIX_PI: 'I', - - /** A generic helix of unspecified bonding distance. */ - HELIX: 'X', - - /** An isolated 3/10-like helical turn. */ - TURN_310: '3', - - /** An isolated alpha-like helical turn. */ - TURN_ALPHA: '4', - - /** An isolated pi-like helical turn. */ - TURN_PI: '5', - - /** An isolated helical [turn](https://en.wikipedia.org/wiki/Turn_(biochemistry)) of unspecified bonding distance. */ - TURN: 'T', - - /** A bend (a region of high curvature). */ - BEND: 'S', - - /** Just a protein section with no particular conformation. */ - COIL: 'C' - }; - /** - * Generic type of a secondary structural element. - * @enum {string} - * @see StructuralElement.Type - */ - - StructuralElement.Generic = { - /** A strand of a sheet. */ - STRAND: 'strand', - - /** A helix. */ - HELIX: 'helix', - - /** Just a protein section with no particular conformation. */ - LOOP: 'loop' - }; - var StructuralElementType = StructuralElement.Type; - var StructuralElementGeneric = StructuralElement.Generic; - /** - * A mapping from specific types to generic ones. - * @type {Object} - */ - - StructuralElement.genericByType = (_StructuralElement$ge = {}, defineProperty(_StructuralElement$ge, StructuralElementType.STRAND, StructuralElementGeneric.STRAND), defineProperty(_StructuralElement$ge, StructuralElementType.HELIX_310, StructuralElementGeneric.HELIX), defineProperty(_StructuralElement$ge, StructuralElementType.HELIX_ALPHA, StructuralElementGeneric.HELIX), defineProperty(_StructuralElement$ge, StructuralElementType.HELIX_PI, StructuralElementGeneric.HELIX), defineProperty(_StructuralElement$ge, StructuralElementType.HELIX, StructuralElementGeneric.HELIX), _StructuralElement$ge); - - var StructuralElementType$1 = StructuralElement.Type; - var typeByPDBHelixClass = { - 1: StructuralElementType$1.HELIX_ALPHA, - 3: StructuralElementType$1.HELIX_PI, - 5: StructuralElementType$1.HELIX_310 - }; - /** - * Helical secondary structure of a protein. - * @extends StructuralElement - */ - - var Helix = /*#__PURE__*/function (_StructuralElement) { - inherits(Helix, _StructuralElement); - - /** - * Create a helix. - * - * @param {number} helixClass A helix class according to the - * [PDB Format](http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX). - * @param {Residue} init Initial residue. - * @param {Residue} term Terminal residue. - * @param {number} serial Serial number of the helix (see PDB Format). - * @param {string} name Helix identifier (see PDB Format). - * @param {string} comment Comment about this helix (see PDB Format). - * @param {number} length Length of this helix, in residues (see PDB Format). - */ - function Helix(helixClass, init, term, serial, name, comment, length) { - var _this; - - classCallCheck(this, Helix); - - _this = possibleConstructorReturn(this, getPrototypeOf(Helix).call(this, typeByPDBHelixClass[helixClass] || StructuralElement.Type.HELIX, init, term)); - /** - * Serial number of the helix (see PDB Format). - * @type {number} - */ - - _this.serial = serial; - /** - * Helix identifier (see PDB Format). - * @type {string} - */ - - _this.name = name; - /** - * Comment about this helix (see PDB Format). - * @type {string} - */ - - _this.comment = comment; - /** - * Length of this helix, in residues (see PDB Format). - * @type {number} - */ - - _this.length = length; - return _this; - } - - return Helix; - }(StructuralElement); - - function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - - return object; - } - - var superPropBase = _superPropBase; - - var get = createCommonjsModule(function (module) { - function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - module.exports = _get = Reflect.get; - } else { - module.exports = _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - } - - return _get(target, property, receiver || target); - } - - module.exports = _get; - }); - - /** - * A single strand of a sheet in a protein secondary structure. - * @extends StructuralElement - */ - - var Strand = /*#__PURE__*/function (_StructuralElement) { - inherits(Strand, _StructuralElement); - - /** - * Create a strand. - * - * @param {Sheet} sheet Parent sheet this strand belongs to. - * @param {Residue} init Initial residue. - * @param {Residue} term Terminal residue. - * @param {number} sense Sense of strand with respect to previous strand in the sheet. - * - 0 if the first strand, - * - 1 if parallel, and - * - -1 if anti-parallel. - * @param {Atom} atomCur Atom in current strand (see PDB Format). - * @param {Atom} atomPrev Atom in previous strand (see PDB Format). - */ - function Strand(sheet, init, term, sense, atomCur, atomPrev) { - var _this; - - classCallCheck(this, Strand); - - _this = possibleConstructorReturn(this, getPrototypeOf(Strand).call(this, StructuralElement.Type.STRAND, init, term)); - /** - * Parent sheet this strand belongs to. - * @type {Sheet} - */ - - _this.sheet = sheet; - /** - * Sense of strand with respect to previous strand in the sheet. - * - 0 if the first strand, - * - 1 if parallel, and - * - -1 if anti-parallel. - * @type {number} - */ - - _this.sense = sense; - /** - * Atom in current strand (see PDB Format). - * @type {Atom} - */ - - _this.atomCur = atomCur; - /** - * Atom in previous strand (see PDB Format). - * @type {Atom} - */ - - _this.atomPrev = atomPrev; - return _this; - } - /** - * An internal method for making a final pass over the complex to set all required references. - * - * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring. - * Just copying it as-is right now and hoping for the best. - * - * @param {object} serialAtomMap A dictionary of atoms - * @param {object} residueHash A dictionary of hashed residues to check. - * @param {Complex} complex The molecular complex this element belongs to. - * - * @override - */ - - - createClass(Strand, [{ - key: "_finalize", - value: function _finalize(serialAtomMap, residueHash, complex) { - get(getPrototypeOf(Strand.prototype), "_finalize", this).call(this, serialAtomMap, residueHash, complex); - - var as = this.atomCur; - - if (as !== null && !Number.isNaN(as)) { - this.atomCur = serialAtomMap[as]; - } - - as = this.atomPrev; - - if (as !== null && !Number.isNaN(as)) { - this.atomPrev = serialAtomMap[as]; - } - } - }]); - - return Strand; - }(StructuralElement); - - /** - * Sheet secondary structure of a protein. - * - * @param {string} name - - * @param {number} width - - * - * @exports Sheet - * @constructor - */ - - var Sheet = /*#__PURE__*/function () { - function Sheet(name, width) { - classCallCheck(this, Sheet); - - this._name = name; - this._width = width; - this._strands = []; - } // Getters and setters - - - createClass(Sheet, [{ - key: "getName", - value: function getName() { - return this._name; - } - }, { - key: "getWidth", - value: function getWidth() { - return this._width; - } - }, { - key: "addStrand", - value: function addStrand(strand) { - this._strands.push(strand); - - this._width = this._strands.length; - } - }, { - key: "addEmptyStrand", - value: function addEmptyStrand() { - this._strands.push(new Strand(null, null, null, null, null, null)); - } - }, { - key: "_finalize", - value: function _finalize(serialAtomMap, residueHash, complex) { - var s = this._strands; - - for (var i = 0, n = s.length; i < n; ++i) { - s[i]._finalize(serialAtomMap, residueHash, complex); - } - - if (!this._width) { - this._width = s.length; - } - - if (s.length !== this._width) { - throw new Error("Sheet ".concat(this._name, " is inconsistent.")); - } - } - }]); - - return Sheet; - }(); - - /** - * Atom measurements. - * - * @param {string} id - SGroup id - * @param {string} name - Name of the group - * @param {THREE.Vector3} position - Registered coordinates - * @param {array} atoms - Atoms group consists of - * @param {object} saveNode - XML node from file for saving - * - * @exports SGroup - * @constructor - */ - - var SGroup = /*#__PURE__*/function () { - function SGroup(id, name, position, atoms, saveNode) { - classCallCheck(this, SGroup); - - this._id = id; - this._name = name; - this._position = position || new THREE.Vector3(); - this._atoms = atoms || []; - this._charge = 0; // default group charge - - this._repeat = 1; // how many times group repeated: always > 0 - - this._center = null; - this.xmlNodeRef = saveNode || null; - } - /** - * Get atom full name. - * @returns {string} Atom full name. - */ - - - createClass(SGroup, [{ - key: "getName", - value: function getName() { - return this._name; - } - }, { - key: "getPosition", - value: function getPosition() { - return this._position; - } - }, { - key: "getCentralPoint", - value: function getCentralPoint() { - return this._center; - } - }, { - key: "_rebuildSGroupOnAtomChange", - value: function _rebuildSGroupOnAtomChange() { - var nLimon = 100000000; - - if (this._center === null) { - return; // nothing to do if we are not relative - } - - var bLow = new THREE.Vector3(nLimon, nLimon, nLimon); - var bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon); - - for (var j = 0, n = this._atoms.length; j < n; j++) { - var aPos = this._atoms[j].position; - bLow.set(Math.min(bLow.x, aPos.x), Math.min(bLow.y, aPos.y), Math.min(bLow.z, aPos.z)); - bHight.set(Math.max(bHight.x, aPos.x), Math.max(bHight.y, aPos.y), Math.max(bHight.z, aPos.z)); - } - - this._center.addVectors(bLow, bHight); - - this._center.multiplyScalar(0.5); - } - }]); - - return SGroup; - }(); - - /* eslint-disable */ - // DO NOT EDIT! Automatically generated from .jison - - /* parser generated by jison 0.4.18 */ - - /* - Returns a Parser object of the following structure: - - Parser: { - yy: {} - } - - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), - - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), - - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, - - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } - - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) - } - */ - var parser = function () { - var o = function o(k, v, _o, l) { - for (_o = _o || {}, l = k.length; l--; _o[k[l]] = v) { - } - - return _o; - }, - $V0 = [1, 4], - $V1 = [1, 5], - $V2 = [1, 6], - $V3 = [1, 7], - $V4 = [1, 8], - $V5 = [1, 9], - $V6 = [1, 11], - $V7 = [1, 12], - $V8 = [5, 7, 8, 11], - $V9 = [1, 17], - $Va = [1, 22], - $Vb = [1, 20], - $Vc = [1, 21], - $Vd = [5, 7, 8, 11, 19]; - - var parser = { - trace: function trace() {}, - yy: {}, - symbols_: { - "error": 2, - "Program": 3, - "Expression": 4, - "EOF": 5, - "Selector": 6, - "OR": 7, - "AND": 8, - "NOT": 9, - "(": 10, - ")": 11, - "SELECTOR": 12, - "NAMED_SELECTOR": 13, - "SELECTOR_RANGED": 14, - "RangeList": 15, - "SELECTOR_NAMED": 16, - "NameList": 17, - "Range": 18, - ",": 19, - "NUMBER": 20, - ":": 21, - "Name": 22, - "IDENTIFIER": 23, - "STRING": 24, - "$accept": 0, - "$end": 1 - }, - terminals_: { - 2: "error", - 5: "EOF", - 7: "OR", - 8: "AND", - 9: "NOT", - 10: "(", - 11: ")", - 12: "SELECTOR", - 13: "NAMED_SELECTOR", - 14: "SELECTOR_RANGED", - 16: "SELECTOR_NAMED", - 19: ",", - 20: "NUMBER", - 21: ":", - 23: "IDENTIFIER", - 24: "STRING" - }, - productions_: [0, [3, 2], [4, 1], [4, 3], [4, 3], [4, 2], [4, 3], [6, 1], [6, 1], [6, 2], [6, 2], [15, 1], [15, 3], [18, 1], [18, 3], [17, 1], [17, 3], [22, 1], [22, 1], [22, 1]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate - /* action[1] */ - , $$ - /* vstack */ - , _$ - /* lstack */ - ) { - /* this == yyval */ - var $0 = $$.length - 1; - - switch (yystate) { - case 1: - return $$[$0 - 1]; - - case 3: - this.$ = yy.keyword('or')($$[$0 - 2], $$[$0]); - break; - - case 4: - this.$ = yy.keyword('and')($$[$0 - 2], $$[$0]); - break; - - case 5: - this.$ = yy.keyword('not')($$[$0]); - break; - - case 6: - this.$ = $$[$0 - 1]; - break; - - case 7: - this.$ = yy.keyword($$[$0])(); - break; - - case 8: - this.$ = yy.GetSelector($$[$0].toLowerCase().slice(1, $$[$0].length)); - break; - - case 9: - case 10: - this.$ = yy.keyword($$[$0 - 1])($$[$0]); - break; - - case 11: - this.$ = new yy.RangeList($$[$0]); - break; - - case 12: - case 16: - this.$ = $$[$0 - 2].append($$[$0]); - break; - - case 13: - this.$ = new yy.Range(Number($$[$0])); - break; - - case 14: - this.$ = new yy.Range(Number($$[$0 - 2]), Number($$[$0])); - break; - - case 15: - this.$ = new yy.ValueList($$[$0]); - break; - } - }, - table: [{ - 3: 1, - 4: 2, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, { - 1: [3] - }, { - 5: [1, 10], - 7: $V6, - 8: $V7 - }, o($V8, [2, 2]), { - 4: 13, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, { - 4: 14, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, o($V8, [2, 7]), o($V8, [2, 8]), { - 15: 15, - 18: 16, - 20: $V9 - }, { - 17: 18, - 20: $Va, - 22: 19, - 23: $Vb, - 24: $Vc - }, { - 1: [2, 1] - }, { - 4: 23, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, { - 4: 24, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, o($V8, [2, 5]), { - 7: $V6, - 8: $V7, - 11: [1, 25] - }, o($V8, [2, 9], { - 19: [1, 26] - }), o($Vd, [2, 11]), o($Vd, [2, 13], { - 21: [1, 27] - }), o($V8, [2, 10], { - 19: [1, 28] - }), o($Vd, [2, 15]), o($Vd, [2, 17]), o($Vd, [2, 18]), o($Vd, [2, 19]), o([5, 7, 11], [2, 3], { - 8: $V7 - }), o($V8, [2, 4]), o($V8, [2, 6]), { - 18: 29, - 20: $V9 - }, { - 20: [1, 30] - }, { - 20: $Va, - 22: 31, - 23: $Vb, - 24: $Vc - }, o($Vd, [2, 12]), o($Vd, [2, 14]), o($Vd, [2, 16])], - defaultActions: { - 10: [2, 1] - }, - parseError: function parseError(str, hash) { - if (hash.recoverable) { - this.trace(str); - } else { - var error = new Error(str); - error.hash = hash; - throw error; - } - }, - parse: function parse(input) { - var self = this, - stack = [0], - tstack = [], - vstack = [null], - lstack = [], - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - TERROR = 2, - EOF = 1; - var args = lstack.slice.call(arguments, 1); - var lexer = Object.create(this.lexer); - var sharedState = { - yy: {} - }; - - for (var k in this.yy) { - if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState.yy[k] = this.yy[k]; - } - } - - lexer.setInput(input, sharedState.yy); - sharedState.yy.lexer = lexer; - sharedState.yy.parser = this; - - if (typeof lexer.yylloc == 'undefined') { - lexer.yylloc = {}; - } - - var yyloc = lexer.yylloc; - lstack.push(yyloc); - var ranges = lexer.options && lexer.options.ranges; - - if (typeof sharedState.yy.parseError === 'function') { - this.parseError = sharedState.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).parseError; - } - - function lex() { - var token; - token = tstack.pop() || lexer.lex() || EOF; - - if (typeof token !== 'number') { - if (token instanceof Array) { - tstack = token; - token = tstack.pop(); - } - - token = self.symbols_[token] || token; - } - - return token; - } - - var symbol, - state, - action, - r, - yyval = {}, - p, - len, - newState, - expected; - - while (true) { - state = stack[stack.length - 1]; - - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); - } - - action = table[state] && table[state][symbol]; - } - - if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr = ''; - expected = []; - - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push('\'' + this.terminals_[p] + '\''); - } - } - - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); - } - - this.parseError(errStr, { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected - }); - } - - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); - } - - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(lexer.yytext); - lstack.push(lexer.yylloc); - stack.push(action[1]); - symbol = null; - - { - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - } - - break; - - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - - r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); - - if (typeof r !== 'undefined') { - return r; - } - - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - - case 3: - return true; - } - } - - return true; - } - }; - /* generated by jison-lex 0.3.4 */ - - var lexer = function () { - var lexer = { - EOF: 1, - parseError: function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, - // resets the lexer, sets new input - setInput: function setInput(input, yy) { - this.yy = yy || this.yy || {}; - this._input = input; - this._more = this._backtrack = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - - if (this.options.ranges) { - this.yylloc.range = [0, 0]; - } - - this.offset = 0; - return this; - }, - // consumes and returns one char from the input - input: function input() { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - - if (this.options.ranges) { - this.yylloc.range[1]++; - } - - this._input = this._input.slice(1); - return ch; - }, - // unshifts one char (or a string) into the input - unput: function unput(ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; - - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - - var r = this.yylloc.range; - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - - this.yyleng = this.yytext.length; - return this; - }, - // When called from action, caches matched text and appends it on next action - more: function more() { - this._more = true; - return this; - }, - // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. - reject: function reject() { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - } - - return this; - }, - // retain first n characters of the match - less: function less(n) { - this.unput(this.match.slice(n)); - }, - // displays already matched input, i.e. for error messages - pastInput: function pastInput() { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); - }, - // displays upcoming input, i.e. for error messages - upcomingInput: function upcomingInput() { - var next = this.match; - - if (next.length < 20) { - next += this._input.substr(0, 20 - next.length); - } - - return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); - }, - // displays the character position where the lexing error occurred, i.e. for error messages - showPosition: function showPosition() { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; - }, - // test the lexed token: return FALSE when not a match, otherwise return token - test_match: function test_match(match, indexed_rule) { - var token, lines, backup; - - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } - - lines = match[0].match(/(?:\r\n?|\n).*/g); - - if (lines) { - this.yylineno += lines.length; - } - - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length - }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); - - if (this.done && this._input) { - this.done = false; - } - - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - - return false; // rule action called reject() implying the next rule should be tested instead. - } - - return false; - }, - // return next match in input - next: function next() { - if (this.done) { - return this.EOF; - } - - if (!this._input) { - this.done = true; - } - - var token, match, tempMatch, index; - - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - - var rules = this._currentRules(); - - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); - - if (token !== false) { - return token; - } else if (this._backtrack) { - match = false; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - - if (match) { - token = this.test_match(match, rules[index]); - - if (token !== false) { - return token; - } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - - - return false; - } - - if (this._input === "") { - return this.EOF; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - } - }, - // return next match that has a token - lex: function lex() { - var r = this.next(); - - if (r) { - return r; - } else { - return this.lex(); - } - }, - // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) - begin: function begin(condition) { - this.conditionStack.push(condition); - }, - // pop the previously active lexer condition state off the condition stack - popState: function popState() { - var n = this.conditionStack.length - 1; - - if (n > 0) { - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } - }, - // produce the lexer rule set which is active for the currently active lexer condition state - _currentRules: function _currentRules() { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions["INITIAL"].rules; - } - }, - // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available - topState: function topState(n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - - if (n >= 0) { - return this.conditionStack[n]; - } else { - return "INITIAL"; - } - }, - // alias for begin(condition) - pushState: function pushState(condition) { - this.begin(condition); - }, - // return the number of states currently on the stack - stateStackSize: function stateStackSize() { - return this.conditionStack.length; - }, - options: { - "case-insensitive": true - }, - performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { - - switch ($avoiding_name_collisions) { - case 0: - /* skip whitespace */ - break; - - case 1: - return 20; - - case 2: - return 7; - - case 3: - return 8; - - case 4: - return 9; - - case 5: - return 12; - - case 6: - return 16; - - case 7: - return 14; - - case 8: - return 10; - - case 9: - return 11; - - case 10: - return 19; - - case 11: - return 21; - - case 12: - return '<='; - - case 13: - return '>='; - - case 14: - return '<'; - - case 15: - return '>'; - - case 16: - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); - return 24; - - case 17: - return 13; - - case 18: - return 23; - - case 19: - return 5; - - case 20: - return 'INVALID'; - } - }, - rules: [/^(?:\s+)/i, /^(?:(-?(?:[1-9][0-9]+|[0-9]))\b)/i, /^(?:OR\b)/i, /^(?:AND\b)/i, /^(?:NOT\b)/i, /^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\b)/i, /^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\b)/i, /^(?:((SERIAL|SEQUENCE|RESIDX))\b)/i, /^(?:\()/i, /^(?:\))/i, /^(?:,)/i, /^(?::)/i, /^(?:<=)/i, /^(?:>=)/i, /^(?:<)/i, /^(?:>)/i, /^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i, /^(?:(@[_A-Z0-9]+))/i, /^(?:([_A-Z0-9]+))/i, /^(?:$)/i, /^(?:.)/i], - conditions: { - "INITIAL": { - "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], - "inclusive": true - } - } - }; - return lexer; - }(); - - parser.lexer = lexer; - - function Parser() { - this.yy = {}; - } - - Parser.prototype = parser; - parser.Parser = Parser; - return new Parser(); - }(); - - var SelectionParser = { - parser: parser - }; - var SelectionParser_1 = SelectionParser.parser; - - var Range = /*#__PURE__*/function () { - function Range(min, max) { - classCallCheck(this, Range); - - this.min = min; - this.max = typeof max === 'undefined' ? min : max; - } - - createClass(Range, [{ - key: "includes", - value: function includes(value) { - return this.min <= value && value <= this.max; - } - }, { - key: "toString", - value: function toString() { - var min = this.min, - max = this.max; - return min === max ? String(min) : [min, max].join(':'); - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.min, this.max]; - } - }]); - - return Range; - }(); // //////////////////////////////////////////////////////////////////////////// - - - var List = /*#__PURE__*/function () { - function List(arg) { - classCallCheck(this, List); - - if (arg instanceof this.constructor) { - return arg; - } - - if (arg instanceof Array) { - this._values = arg.slice(0); - } else if (arg) { - this._values = [arg]; - } else { - this._values = []; - } - } - - createClass(List, [{ - key: "append", - value: function append(value) { - var values = this._values; - values[values.length] = value; - return this; - } - }, { - key: "remove", - value: function remove(value) { - var values = this._values; - var index = values.indexOf(value); - - if (index >= 0) { - values.splice(index, 1); - } - - return this; - } - }, { - key: "toString", - value: function toString() { - return this._values.join(','); - } - }, { - key: "toJSON", - value: function toJSON() { - var values = this._values; - var result = []; - - for (var i = 0, n = values.length; i < n; ++i) { - var value = values[i]; - result[i] = value.toJSON ? value.toJSON() : value; - } - - return result; - } - }]); - - return List; - }(); //---------------------------------------------------------------------------- - - - var RangeList = /*#__PURE__*/function (_List) { - inherits(RangeList, _List); - - function RangeList() { - classCallCheck(this, RangeList); - - return possibleConstructorReturn(this, getPrototypeOf(RangeList).apply(this, arguments)); - } - - createClass(RangeList, [{ - key: "includes", - value: function includes(value) { - var list = this._values; - - for (var i = 0, n = list.length; i < n; ++i) { - if (list[i].includes(value)) { - return true; - } - } - - return false; - } - }]); - - return RangeList; - }(List); //---------------------------------------------------------------------------- - - - var valuesArray = []; - - var ValueList = /*#__PURE__*/function (_List2) { - inherits(ValueList, _List2); - - function ValueList(arg, upperOnly) { - var _this; - - classCallCheck(this, ValueList); - - var list = _this = possibleConstructorReturn(this, getPrototypeOf(ValueList).call(this, arg)); - - if (upperOnly) { - _this.upperOnly = true; - var values = list._values; - - for (var i = 0, n = values.length; i < n; ++i) { - var value = values[i]; - - if (typeof value === 'string') { - values[i] = value.toUpperCase(); - } - } - } else { - _this.upperOnly = false; - } - - return possibleConstructorReturn(_this, list); - } - - createClass(ValueList, [{ - key: "includes", - value: function includes(value) { - // we do not convert to upper case here for perfomance reasons - // if list is upper case only, value must be converted before it is sent up to here - return this._values.indexOf(value) !== -1; - } - }, { - key: "toString", - value: function toString() { - // Quote values that are not correct identifiers - var values = this._values; - valuesArray.length = 0; - - for (var i = 0, n = values.length; i < n; ++i) { - valuesArray[i] = utils.correctSelectorIdentifier(String(values[i])); - } - - return valuesArray.join(','); - } - }, { - key: "_validate", - value: function _validate(value) { - return this.upperOnly && typeof value === 'string' ? value.toUpperCase() : value; - } - }, { - key: "append", - value: function append(value) { - get(getPrototypeOf(ValueList.prototype), "append", this).call(this, this._validate(value)); - - return this; - } - }, { - key: "remove", - value: function remove(value) { - get(getPrototypeOf(ValueList.prototype), "remove", this).call(this, this._validate(value)); - - return this; - } - }]); - - return ValueList; - }(List); - - /** Base class for atom selectors. */ - - var Selector = /*#__PURE__*/function () { - function Selector() { - classCallCheck(this, Selector); - } - - createClass(Selector, [{ - key: "toString", - value: function toString() { - return this.keyword; - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.name]; - } - }]); - - return Selector; - }(); - - Selector.prototype.name = 'Error'; - Selector.prototype.keyword = 'error'; - /** Base class for list-based atom selectors. */ - - var ListSelector = /*#__PURE__*/function (_Selector) { - inherits(ListSelector, _Selector); - - function ListSelector(list) { - var _this; - - classCallCheck(this, ListSelector); - - _this = possibleConstructorReturn(this, getPrototypeOf(ListSelector).call(this)); - _this.list = list; - return _this; - } - - createClass(ListSelector, [{ - key: "toString", - value: function toString() { - return "".concat(this.keyword, " ").concat(this.list); - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.name, this.list.toJSON()]; - } - }]); - - return ListSelector; - }(Selector); - - var RangeListSelector = /*#__PURE__*/function (_ListSelector) { - inherits(RangeListSelector, _ListSelector); - - function RangeListSelector(arg) { - classCallCheck(this, RangeListSelector); - - return possibleConstructorReturn(this, getPrototypeOf(RangeListSelector).call(this, new RangeList(arg))); - } - - return RangeListSelector; - }(ListSelector); - - var ValueListSelector = /*#__PURE__*/function (_ListSelector2) { - inherits(ValueListSelector, _ListSelector2); - - function ValueListSelector(arg, caseSensitive) { - classCallCheck(this, ValueListSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ValueListSelector).call(this, new ValueList(arg, !caseSensitive))); - } - - return ValueListSelector; - }(ListSelector); - - var NoneSelector = /*#__PURE__*/function (_Selector2) { - inherits(NoneSelector, _Selector2); - - function NoneSelector() { - classCallCheck(this, NoneSelector); - - return possibleConstructorReturn(this, getPrototypeOf(NoneSelector).apply(this, arguments)); - } - - createClass(NoneSelector, [{ - key: "includesAtom", - value: function includesAtom(_atom) { - return false; - } - }]); - - return NoneSelector; - }(Selector); - - NoneSelector.prototype.name = 'None'; - NoneSelector.prototype.keyword = 'none'; - - var AllSelector = /*#__PURE__*/function (_Selector3) { - inherits(AllSelector, _Selector3); - - function AllSelector() { - classCallCheck(this, AllSelector); - - return possibleConstructorReturn(this, getPrototypeOf(AllSelector).apply(this, arguments)); - } - - createClass(AllSelector, [{ - key: "includesAtom", - value: function includesAtom(_atom) { - return true; - } - }]); - - return AllSelector; - }(Selector); - - AllSelector.prototype.name = 'All'; - AllSelector.prototype.keyword = 'all'; - - // Operators - //---------------------------------------------------------------------------- - - var none = new NoneSelector(); - - var PrefixOperator = /*#__PURE__*/function (_Selector) { - inherits(PrefixOperator, _Selector); - - function PrefixOperator(rhs) { - var _this; - - classCallCheck(this, PrefixOperator); - - _this = possibleConstructorReturn(this, getPrototypeOf(PrefixOperator).call(this)); - _this.rhs = rhs || none; - return _this; - } - - createClass(PrefixOperator, [{ - key: "toString", - value: function toString() { - var rhs = this.rhs.priority && this.rhs.priority > this.priority ? "(".concat(this.rhs, ")") : this.rhs; - return "".concat(this.keyword, " ").concat(rhs); - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.name, this.rhs.toJSON()]; - } - }]); - - return PrefixOperator; - }(Selector); - - PrefixOperator.prototype.priority = 1; - - var InfixOperator = /*#__PURE__*/function (_Selector2) { - inherits(InfixOperator, _Selector2); - - function InfixOperator(lhs, rhs) { - var _this2; - - classCallCheck(this, InfixOperator); - - _this2 = possibleConstructorReturn(this, getPrototypeOf(InfixOperator).call(this)); - _this2.lhs = lhs || none; - _this2.rhs = rhs || none; - return _this2; - } - - createClass(InfixOperator, [{ - key: "toString", - value: function toString() { - var lhs = this.lhs.priority && this.lhs.priority > this.priority ? "(".concat(this.lhs, ")") : this.lhs; - var rhs = this.rhs.priority && this.rhs.priority > this.priority ? "(".concat(this.rhs, ")") : this.rhs; - return "".concat(lhs, " ").concat(this.keyword, " ").concat(rhs); - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.name, this.lhs.toJSON(), this.rhs.toJSON()]; - } - }]); - - return InfixOperator; - }(Selector); - - InfixOperator.prototype.priority = 1000; - - var keywords = {}; //---------------------------------------------------------------------------- - // Named selectors - //---------------------------------------------------------------------------- - - function defineSelector(name, SelectorClass) { - var keyword = name.toLowerCase(); - SelectorClass.prototype.keyword = keyword; - SelectorClass.prototype.name = name; - - var factory = function factory() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return construct(SelectorClass, args); - }; - - factory.SelectorClass = SelectorClass; - keywords[keyword] = factory; - return SelectorClass; - } - - defineSelector('Serial', /*#__PURE__*/function (_RangeListSelector) { - inherits(SerialSelector, _RangeListSelector); - - function SerialSelector() { - classCallCheck(this, SerialSelector); - - return possibleConstructorReturn(this, getPrototypeOf(SerialSelector).apply(this, arguments)); - } - - createClass(SerialSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.serial); - } - }]); - - return SerialSelector; - }(RangeListSelector)); - defineSelector('Name', /*#__PURE__*/function (_ValueListSelector) { - inherits(NameSelector, _ValueListSelector); - - function NameSelector() { - classCallCheck(this, NameSelector); - - return possibleConstructorReturn(this, getPrototypeOf(NameSelector).apply(this, arguments)); - } - - createClass(NameSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.name); - } - }]); - - return NameSelector; - }(ValueListSelector)); - defineSelector('AltLoc', /*#__PURE__*/function (_ValueListSelector2) { - inherits(AltLocSelector, _ValueListSelector2); - - function AltLocSelector() { - classCallCheck(this, AltLocSelector); - - return possibleConstructorReturn(this, getPrototypeOf(AltLocSelector).apply(this, arguments)); - } - - createClass(AltLocSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(String.fromCharCode(atom.location)); - } - }]); - - return AltLocSelector; - }(ValueListSelector)); - defineSelector('Elem', /*#__PURE__*/function (_ValueListSelector3) { - inherits(ElemSelector, _ValueListSelector3); - - function ElemSelector() { - classCallCheck(this, ElemSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ElemSelector).apply(this, arguments)); - } - - createClass(ElemSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.element.name); - } - }]); - - return ElemSelector; - }(ValueListSelector)); - defineSelector('Residue', /*#__PURE__*/function (_ValueListSelector4) { - inherits(ResidueSelector, _ValueListSelector4); - - function ResidueSelector() { - classCallCheck(this, ResidueSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ResidueSelector).apply(this, arguments)); - } - - createClass(ResidueSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._type._name); - } - }]); - - return ResidueSelector; - }(ValueListSelector)); - defineSelector('Sequence', /*#__PURE__*/function (_RangeListSelector2) { - inherits(SequenceSelector, _RangeListSelector2); - - function SequenceSelector() { - classCallCheck(this, SequenceSelector); - - return possibleConstructorReturn(this, getPrototypeOf(SequenceSelector).apply(this, arguments)); - } - - createClass(SequenceSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._sequence); - } - }]); - - return SequenceSelector; - }(RangeListSelector)); - defineSelector('ICode', /*#__PURE__*/function (_ValueListSelector5) { - inherits(ICodeSelector, _ValueListSelector5); - - function ICodeSelector(arg) { - classCallCheck(this, ICodeSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ICodeSelector).call(this, arg, true)); - } - - createClass(ICodeSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._icode); - } - }]); - - return ICodeSelector; - }(ValueListSelector)); - defineSelector('ResIdx', /*#__PURE__*/function (_RangeListSelector3) { - inherits(ResIdxSelector, _RangeListSelector3); - - function ResIdxSelector() { - classCallCheck(this, ResIdxSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ResIdxSelector).apply(this, arguments)); - } - - createClass(ResIdxSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._index); - } - }]); - - return ResIdxSelector; - }(RangeListSelector)); - defineSelector('Chain', /*#__PURE__*/function (_ValueListSelector6) { - inherits(ChainSelector, _ValueListSelector6); - - function ChainSelector(arg) { - classCallCheck(this, ChainSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ChainSelector).call(this, arg, true)); - } - - createClass(ChainSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._chain._name); - } - }]); - - return ChainSelector; - }(ValueListSelector)); - defineSelector('Hetatm', /*#__PURE__*/function (_Selector) { - inherits(HetatmSelector, _Selector); - - function HetatmSelector() { - classCallCheck(this, HetatmSelector); - - return possibleConstructorReturn(this, getPrototypeOf(HetatmSelector).apply(this, arguments)); - } - - createClass(HetatmSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return atom.het; - } - }]); - - return HetatmSelector; - }(Selector)); - defineSelector('PolarH', /*#__PURE__*/function (_Selector2) { - inherits(PolarHSelector, _Selector2); - - function PolarHSelector() { - classCallCheck(this, PolarHSelector); - - return possibleConstructorReturn(this, getPrototypeOf(PolarHSelector).apply(this, arguments)); - } - - createClass(PolarHSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.HYDROGEN; - } - }]); - - return PolarHSelector; - }(Selector)); - defineSelector('NonPolarH', /*#__PURE__*/function (_Selector3) { - inherits(NonPolarHSelector, _Selector3); - - function NonPolarHSelector() { - classCallCheck(this, NonPolarHSelector); - - return possibleConstructorReturn(this, getPrototypeOf(NonPolarHSelector).apply(this, arguments)); - } - - createClass(NonPolarHSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.NONPOLARH; - } - }]); - - return NonPolarHSelector; - }(Selector)); - defineSelector('All', AllSelector); - defineSelector('None', NoneSelector); - var NULL_SELECTOR = keywords.none(); //---------------------------------------------------------------------------- - // Named operators - //---------------------------------------------------------------------------- - - function defineOperator(name, priority, OperatorClass) { - OperatorClass.prototype.priority = priority; - return defineSelector(name, OperatorClass); - } - - defineOperator('Not', 1, /*#__PURE__*/function (_PrefixOperator) { - inherits(NotOperator, _PrefixOperator); - - function NotOperator() { - classCallCheck(this, NotOperator); - - return possibleConstructorReturn(this, getPrototypeOf(NotOperator).apply(this, arguments)); - } - - createClass(NotOperator, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return !this.rhs.includesAtom(atom); - } - }]); - - return NotOperator; - }(PrefixOperator)); - defineOperator('And', 2, /*#__PURE__*/function (_InfixOperator) { - inherits(AndOperator, _InfixOperator); - - function AndOperator() { - classCallCheck(this, AndOperator); - - return possibleConstructorReturn(this, getPrototypeOf(AndOperator).apply(this, arguments)); - } - - createClass(AndOperator, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.lhs.includesAtom(atom) && this.rhs.includesAtom(atom); - } - }]); - - return AndOperator; - }(InfixOperator)); - defineOperator('Or', 3, /*#__PURE__*/function (_InfixOperator2) { - inherits(OrOperator, _InfixOperator2); - - function OrOperator() { - classCallCheck(this, OrOperator); - - return possibleConstructorReturn(this, getPrototypeOf(OrOperator).apply(this, arguments)); - } - - createClass(OrOperator, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.lhs.includesAtom(atom) || this.rhs.includesAtom(atom); - } - }]); - - return OrOperator; - }(InfixOperator)); //---------------------------------------------------------------------------- - // Flag selectors - //---------------------------------------------------------------------------- - - function byResidueTypeFlag(flag, name) { - return defineSelector(name, /*#__PURE__*/function (_Selector4) { - inherits(_class, _Selector4); - - function _class() { - classCallCheck(this, _class); - - return possibleConstructorReturn(this, getPrototypeOf(_class).apply(this, arguments)); - } - - createClass(_class, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return (atom.residue._type.flags & flag) !== 0; - } - }]); - - return _class; - }(Selector)); - } - - byResidueTypeFlag(ResidueType.Flags.PROTEIN, 'Protein'); - byResidueTypeFlag(ResidueType.Flags.BASIC, 'Basic'); - byResidueTypeFlag(ResidueType.Flags.ACIDIC, 'Acidic'); - byResidueTypeFlag(ResidueType.Flags.BASIC | ResidueType.Flags.ACIDIC, 'Charged'); - byResidueTypeFlag(ResidueType.Flags.POLAR, 'Polar'); - byResidueTypeFlag(ResidueType.Flags.NONPOLAR, 'NonPolar'); - byResidueTypeFlag(ResidueType.Flags.AROMATIC, 'Aromatic'); - byResidueTypeFlag(ResidueType.Flags.NUCLEIC, 'Nucleic'); - byResidueTypeFlag(ResidueType.Flags.PURINE, 'Purine'); - byResidueTypeFlag(ResidueType.Flags.PYRIMIDINE, 'Pyrimidine'); - byResidueTypeFlag(ResidueType.Flags.WATER, 'Water'); //---------------------------------------------------------------------------- - - var selectors = Object.create(keywords); - selectors.Selector = Selector; - selectors.RangeListSelector = RangeListSelector; - selectors.ValueListSelector = ValueListSelector; - selectors.Range = Range; - selectors.RangeList = RangeList; - selectors.ValueList = ValueList; - selectors.PrefixOperator = PrefixOperator; - selectors.InfixOperator = InfixOperator; - selectors.Context = Object.create({}); - - selectors.GetSelector = function (key) { - if (!selectors.Context.hasOwnProperty(key)) { - var exc = { - message: "selector ".concat(key, " is not registered") - }; - throw exc; - } - - return selectors.Context[key] || NULL_SELECTOR; - }; - - selectors.ClearContext = function () { - Object.keys(selectors.Context).forEach(function (k) { - delete selectors.Context[k]; - }); - }; - - selectors.keyword = function (key) { - return keywords[key.toLowerCase()] || keywords.none; - }; - - selectors.parse = function (str) { - var res = {}; - - try { - res.selector = SelectionParser_1.parse(str); - } catch (e) { - res.selector = NULL_SELECTOR; - res.error = e.message; - } - - return res; - }; - - SelectionParser_1.yy = selectors; - SelectionParser_1.yy.parseError = SelectionParser_1.parseError; // workaround for incorrect JISON parser generator for AMD module - - /** - * Basic biological unit class. - * - * @exports BiologicalUnit - * @constructor - */ - - var BiologicalUnit = /*#__PURE__*/function () { - function BiologicalUnit(complex) { - classCallCheck(this, BiologicalUnit); - - this._complex = complex; - this._selector = selectors.keyword('All')(); - this._boundaries = { - boundingBox: new THREE.Box3(), - boundingSphere: new THREE.Sphere() - }; - } - - createClass(BiologicalUnit, [{ - key: "computeBoundaries", - value: function computeBoundaries() { - var atoms = this._complex._atoms; - var n = atoms.length; - var selector = this._selector; - var boundingBox = this._boundaries.boundingBox; - boundingBox.makeEmpty(); - - if (n === 1) { - boundingBox.expandByPoint(atoms[0].position); - var bbc = new THREE.Vector3(); - boundingBox.getCenter(bbc); - var s = 2 * atoms[0].element.radius; - boundingBox.setFromCenterAndSize(bbc, new THREE.Vector3(s, s, s)); - } else { - for (var i = 0; i < n; ++i) { - if (selector.includesAtom(atoms[i])) { - boundingBox.expandByPoint(atoms[i].position); - } - } - } // Build bounding sphere - - - var radiusSquared = 0.0; - var center = new THREE.Vector3(); - boundingBox.getCenter(center); - - if (n === 1) { - this._boundaries.boundingSphere.set(center, atoms[0].element.radius); - } else { - for (var _i = 0; _i < n; ++_i) { - if (!selector.includesAtom(atoms[_i])) { - continue; - } - - var pos = atoms[_i].position; - var lengthSquared = center.distanceToSquared(pos); - - if (radiusSquared < lengthSquared) { - radiusSquared = lengthSquared; - } - } - - this._boundaries.boundingSphere.set(center, Math.sqrt(radiusSquared)); - } - } - }, { - key: "getTransforms", - value: function getTransforms() { - return []; - } - }, { - key: "getSelector", - value: function getSelector() { - return this._selector; - } - }, { - key: "getBoundaries", - value: function getBoundaries() { - return this._boundaries; - } - }, { - key: "finalize", - value: function finalize() {} - }]); - - return BiologicalUnit; - }(); - - /** - * Biological assembly. - * - * @exports Assembly - * @constructor - */ - - var Assembly = /*#__PURE__*/function (_BiologicalUnit) { - inherits(Assembly, _BiologicalUnit); - - function Assembly(complex) { - var _this; - - classCallCheck(this, Assembly); - - _this = possibleConstructorReturn(this, getPrototypeOf(Assembly).call(this, complex)); - _this.chains = []; - _this.matrices = []; - return _this; - } - - createClass(Assembly, [{ - key: "computeBoundaries", - value: function computeBoundaries() { - get(getPrototypeOf(Assembly.prototype), "computeBoundaries", this).call(this); // fix up the boundaries - - - var matrices = this.matrices; - var oldCenter = this._boundaries.boundingSphere.center; - var oldRad = this._boundaries.boundingSphere.radius; - var boundingBox = this._boundaries.boundingBox = new THREE.Box3(); - boundingBox.makeEmpty(); - - for (var i = 0, n = matrices.length; i < n; ++i) { - boundingBox.expandByPoint(oldCenter.clone().applyMatrix4(matrices[i])); - } - - var newRad = boundingBox.max.distanceTo(boundingBox.min) / 2 + oldRad; - var center = new THREE.Vector3(); - boundingBox.getCenter(center); - this._boundaries.boundingSphere = new THREE.Sphere().set(center, newRad); - boundingBox.max.addScalar(oldRad); - boundingBox.min.subScalar(oldRad); - } - /** - * Mark a chain as belonging to this biological assembly. - * @param {string} chain - chain identifier, usually a single letter - */ - - }, { - key: "addChain", - value: function addChain(chain) { - this.chains[this.chains.length] = chain; - } - /** - * Add a transformation matrix. - * @param {THREE.Matrix4} matrix - transformation matrix - */ - - }, { - key: "addMatrix", - value: function addMatrix(matrix) { - this.matrices[this.matrices.length] = matrix; - } - }, { - key: "getTransforms", - value: function getTransforms() { - return this.matrices; - } - }, { - key: "finalize", - value: function finalize() { - if (this.chains.length > 0) { - this._selector = selectors.keyword('Chain')(this.chains); - } else { - this._selector = selectors.keyword('None')(); - } - } - }]); - - return Assembly; - }(BiologicalUnit); - - /** - * This class represents connected component as a part of a complex. - * WARNING! The whole component entity is build under the assumption that residues - * are placed in the chains and complex in ascending order of indices - * - * @param {Complex} complex - Molecular complex this chain belongs to. - * - * @exports Component - * @constructor - */ - var Component = /*#__PURE__*/function () { - function Component(complex) { - classCallCheck(this, Component); - - this._complex = complex; - this._index = -1; - this._residueIndices = []; - this._cycles = []; - this._subDivs = []; - this._residueCount = 0; - } - - createClass(Component, [{ - key: "getResidues", - value: function getResidues() { - return this._complex._residues; - } - }, { - key: "getResidueCount", - value: function getResidueCount() { - return this._residueCount; - } - }, { - key: "forEachResidue", - value: function forEachResidue(process) { - var residues = this._complex._residues; - var resIdc = this._residueIndices; - - for (var idIdc = 0, idCount = resIdc.length; idIdc < idCount; ++idIdc) { - for (var idx = resIdc[idIdc].start, last = resIdc[idIdc].end; idx <= last; ++idx) { - process(residues[idx]); - } - } - } - }, { - key: "setSubDivs", - value: function setSubDivs(subDivs) { - this._subDivs = subDivs; - var curr = 0; - var resIdc = []; - var resCnt = 0; - - for (var i = 0, n = subDivs.length; i < n; ++i) { - if (i === n - 1 || subDivs[i].end + 1 !== subDivs[i + 1].start) { - var start = subDivs[curr].start; - var end = subDivs[i].end; - resIdc[resIdc.length] = { - start: start, - end: end - }; - resCnt += end - start + 1; - curr = i + 1; - } - } - - this._residueIndices = resIdc; - this._residueCount = resCnt; - } - }, { - key: "getComplex", - value: function getComplex() { - return this._complex; - } - }, { - key: "forEachBond", - value: function forEachBond(process) { - var bonds = this._complex._bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - var bond = bonds[i]; - - if (bond._left.residue._component === this) { - process(bond); - } - } - } - }, { - key: "update", - value: function update() { - this.forEachCycle(function (cycle) { - cycle.update(); - }); - } - }, { - key: "forEachAtom", - value: function forEachAtom(process) { - this.forEachResidue(function (residue) { - residue.forEachAtom(process); - }); - } - }, { - key: "addCycle", - value: function addCycle(cycle) { - this._cycles.push(cycle); - } - }, { - key: "forEachCycle", - value: function forEachCycle(process) { - var cycles = this._cycles; - - for (var i = 0, n = cycles.length; i < n; ++i) { - process(cycles[i]); - } - } - }, { - key: "markResidues", - value: function markResidues() { - var self = this; - self.forEachResidue(function (residue) { - residue._component = self; - }); - } - }, { - key: "_forEachSubChain", - value: function _forEachSubChain(mask, process) { - var residues = this._complex._residues; - var subs = this._subDivs; - - for (var i = 0, n = subs.length; i < n; ++i) { - for (var idx = subs[i].start, last = subs[i].end; idx <= last; ++idx) { - var currRes = residues[idx]; - - if (mask & currRes._mask && currRes._isValid) { - var end = idx + 1; - - for (; end <= last; ++end) { - var endRes = residues[end]; - - if (!(mask & endRes._mask && endRes._isValid)) { - break; - } - } - - process(i, idx, end - 1); - idx = end; - } - } - } - } - }, { - key: "getMaskedSequences", - value: function getMaskedSequences(mask) { - var subs = []; - var idx = 0; - - this._forEachSubChain(mask, function (_subIdx, start, end) { - subs[idx++] = { - start: start, - end: end - }; - }); - - return subs; - } - }, { - key: "getMaskedSubdivSequences", - value: function getMaskedSubdivSequences(mask) { - var subs = []; - var currIdx = -1; - var lastSubIdx = -1; - var subDivs = this._subDivs; - - this._forEachSubChain(mask, function (subIdx, start, end) { - if (lastSubIdx !== subIdx) { - ++currIdx; - subs[currIdx] = { - arr: [], - boundaries: subDivs[subIdx] - }; - lastSubIdx = subIdx; - } - - subs[currIdx].arr[subs[currIdx].arr.length] = { - start: start, - end: end - }; - }); - - return subs; - } - }]); - - return Component; - }(); - - var cMaxPairsForHashCode = 32; - var cHashTableSize = 1024 * 1024; - var cNumbersPerPair = 4; - var cMaxNeighbours = 14; - var cInvalidVal = -1; // 89237 is a large simple number, can be used for pseudo random hash code create - - var cBigPrime = 89237; - - var AtomPairs = /*#__PURE__*/function () { - function AtomPairs(maxPairsEstimate) { - classCallCheck(this, AtomPairs); - - this.numPairs = 0; - this.numMaxPairs = maxPairsEstimate; - this.intBuffer = utils.allocateTyped(Int32Array, maxPairsEstimate * cNumbersPerPair); - - for (var i = 0; i < maxPairsEstimate * cNumbersPerPair; i++) { - this.intBuffer[i] = cInvalidVal; - } - - this.hashBuffer = utils.allocateTyped(Int32Array, cHashTableSize * cMaxPairsForHashCode); - - for (var _i = 0; _i < cHashTableSize * cMaxPairsForHashCode; _i++) { - this.hashBuffer[_i] = cInvalidVal; - } - } - /** - * Destroy all pairs memory - */ - - - createClass(AtomPairs, [{ - key: "destroy", - value: function destroy() { - this.intBuffer = null; - this.hashBuffer = null; - } - /** - * Add pair of atoms to collection - * @param {number} indexA - Index of the 1st vertex. - * @param {number} indexB - Index of the 2nd vertex. - */ - - }, { - key: "addPair", - value: function addPair(indexA, indexB) { - var ia = indexA < indexB ? indexA : indexB; - var ib = indexA > indexB ? indexA : indexB; - var codeToAdd = ia + (ib << cMaxNeighbours); - var hashCode = ia + ib * cBigPrime & cHashTableSize - 1; - var j = hashCode * cMaxPairsForHashCode; - var apI = 0; - - for (; apI < cMaxPairsForHashCode; apI++) { - var code = this.hashBuffer[j + apI]; - - if (code === cInvalidVal) { - break; - } - - if (code === codeToAdd) { - return false; - } - } // add this new hash code - - - if (apI >= cMaxPairsForHashCode) { - throw new Error('addPair: increase cMaxPairsForHashCode'); - } - - this.hashBuffer[j + apI] = codeToAdd; // actually add - - if (this.numPairs >= this.numMaxPairs) { - throw new Error('addPair: increase num pairs'); - } - - j = this.numPairs * cNumbersPerPair; - this.intBuffer[j] = ia; - this.intBuffer[j + 1] = ib; - this.intBuffer[j + 2] = codeToAdd; - this.numPairs++; - return true; - } - }]); - - return AtomPairs; - }(); - - var cEstBondsMultiplier = 4; - var cSpaceCode = 32; - var cBondTolerance = 0.45; - var cEpsilon = 0.001; - /** - * Get radius used for building bonds. - * - * @param {Atom} atom - Atom object. - * @returns {number} special value for bonding radius for this atom - */ - - function _getBondingRadius(atom) { - var element = atom.element; - - if (element) { - return element.radiusBonding; - } - - throw new Error('_getBondingRadius: Logic error.'); - } - - function _isAtomEligible(atom) { - // build for all non-hetatm and for hetatm without bonds - return !atom.isHet() || atom.bonds && atom.bonds.length === 0; - } - /** - * Bond between atoms. - * - * @param {Complex} complex molecular complex - - * @exports AutoBond - * @constructor - */ - - - var AutoBond = /*#__PURE__*/function () { - function AutoBond(complex) { - classCallCheck(this, AutoBond); - - this._complex = complex; - this._maxRad = 1.8; - - var bBox = this._complex.getDefaultBoundaries().boundingBox; - - this._vBoxMin = bBox.min.clone(); - this._vBoxMax = bBox.max.clone(); - this._pairCollection = null; - } - /** - * Add existing pairs of connectors (from pdb file after its reading) - * @returns {number} 0 - */ - - - createClass(AutoBond, [{ - key: "_addExistingPairs", - value: function _addExistingPairs() { - var atoms = this._complex.getAtoms(); - - var numAtoms = atoms.length; - var aInd = 0; - var collection = this._pairCollection; - - for (; aInd < numAtoms; aInd++) { - var bonds = atoms[aInd].bonds; - var numBondsForAtom = bonds.length; - - for (var bInd = 0; bInd < numBondsForAtom; bInd++) { - var bond = bonds[bInd]; - var indTo = bond._left.index; - - if (indTo === aInd) { - collection.addPair(aInd, bond._right.index); - } - } // for (b) all bonds in atom - - } // for (a) - - - return 0; - } - }, { - key: "_findPairs", - value: function _findPairs() { - var vw = this._complex.getVoxelWorld(); - - if (vw === null) { - return; - } - - var atoms = this._complex._atoms; - var atomsNum = atoms.length; - var self = this; - var rA; - var isHydrogenA; - var posA; - var locationA; - var atomA; - - var processAtom = function processAtom(atomB) { - if (isHydrogenA && atomB.isHydrogen()) { - return; - } - - var locationB = atomB.location; - - if (locationA !== cSpaceCode && locationB !== cSpaceCode && locationA !== locationB) { - return; - } - - var dist2 = posA.distanceToSquared(atomB.position); - var rB = atomB.element.radiusBonding; - var maxAcceptable = rA + rB + cBondTolerance ; - - if (dist2 > maxAcceptable * maxAcceptable) { - return; - } - - if (dist2 < cEpsilon) { - return; - } - - self._pairCollection.addPair(atomA.index, atomB.index); - }; - - for (var i = 0; i < atomsNum; ++i) { - atomA = atoms[i]; - - if (!_isAtomEligible(atomA)) { - continue; - } - - rA = atomA.element.radiusBonding; - isHydrogenA = atomA.isHydrogen(); - posA = atomA.position; - locationA = atomA.location; - vw.forEachAtomWithinRadius(posA, 2 * this._maxRad + cBondTolerance, processAtom); - } - } - }, { - key: "_addPairs", - value: function _addPairs() { - var atoms = this._complex._atoms; - - for (var i = 0, k = 0; i < this._pairCollection.numPairs; i++, k += 4) { - var iA = this._pairCollection.intBuffer[k]; - var iB = this._pairCollection.intBuffer[k + 1]; - - this._addPair(atoms[iA], atoms[iB]); - } - } - }, { - key: "_addPair", - value: function _addPair(atomA, atomB) { - var bondsA = atomA.bonds; - var indexA = atomA.index; - var indexB = atomB.index; - - for (var j = 0, numBonds = bondsA.length; j < numBonds; ++j) { - var bond = bondsA[j]; - - if (bond._left.index === indexB || bond._right.index === indexB) { - return; - } - } - - var left = indexA < indexB ? atomA : atomB; - var right = indexA < indexB ? atomB : atomA; - - var newBond = this._complex.addBond(left, right, 0, Bond.BondType.UNKNOWN, false); - - bondsA.push(newBond); - atomB.bonds.push(newBond); - } - }, { - key: "build", - value: function build() { - - this._buildInner(); - } - }, { - key: "_buildInner", - value: function _buildInner() { - var atoms = this._complex._atoms; - - if (atoms.length < 2) { - return; - } - - if (atoms[0].index < 0) { - throw new Error('AutoBond: Atoms in complex were not indexed.'); - } - - this._calcBoundingBox(); - - this._pairCollection = new AtomPairs(atoms.length * cEstBondsMultiplier); - - this._addExistingPairs(); - - this._findPairs(); - - this._addPairs(); - } - }, { - key: "_calcBoundingBox", - value: function _calcBoundingBox() { - var atoms = this._complex._atoms; - var nAtoms = atoms.length; - - var maxRad = _getBondingRadius(atoms[0]); - - for (var i = 1; i < nAtoms; ++i) { - maxRad = Math.max(maxRad, _getBondingRadius(atoms[i])); - } - - this._vBoxMax.addScalar(maxRad); - - this._vBoxMin.addScalar(-maxRad); - - this._maxRad = maxRad * 1.2; - } - }, { - key: "destroy", - value: function destroy() { - if (this._pairCollection) { - this._pairCollection.destroy(); - } - } - }]); - - return AutoBond; - }(); - - var cCrossThresh = 0.1; - var cAromaticType = Bond.BondType.AROMATIC; - var cAromaticAtoms = [Element.ByName.C.number, Element.ByName.N.number // Element.ByName.O.number, - // Element.ByName.S.number, - ]; - /** Conditions for bonds: - * - Cross product with each subsequent bond to add is collinear and point to the same direction - * - Each pair of a adjacent bonds belong to not more than one cycle - * - If there is more than one candidates we try them in ascending order of angle values - */ - - var _coDirVectors = function () { - var v1Tmp = new THREE.Vector3(); - var v2Tmp = new THREE.Vector3(); - var cp = new THREE.Vector3(); - return function (v1, v2) { - v1Tmp.copy(v1).normalize(); - v2Tmp.copy(v2).normalize(); - cp.crossVectors(v1Tmp, v2Tmp); - - if (cp.length() > cCrossThresh) { - return false; - } // zero vector in out terms must be collinear to any - - - return v1Tmp.dot(v2Tmp) >= 0; - }; - }(); - - function _insertAscending(arr, val) { - var idx = 0; - - while (idx < arr.length && arr[idx] < val) { - ++idx; - } - - arr.splice(idx, 0, val); - } - - function _anotherAtom(bond, currAtom) { - return bond._left === currAtom ? bond._right : bond._left; - } - - function _cosBetween(v1, v2) { - var theta = v1.dot(v2) / Math.sqrt(v1.lengthSq() * v2.lengthSq()); - return THREE.Math.clamp(theta, -1, 1); - } - - function _markAromatic(bond) { - bond._type = cAromaticType; - } - - var Cycle = /*#__PURE__*/function () { - function Cycle(atomsList) { - classCallCheck(this, Cycle); - - this.atoms = atomsList; - this.update(); - } - - createClass(Cycle, [{ - key: "update", - value: function update() { - var atoms = this.atoms; - var center = new THREE.Vector3(); - var nA = atoms.length; - - for (var j = 0; j < nA; ++j) { - center.add(atoms[j].position); - } - - center.multiplyScalar(1.0 / nA); - this.center = center; - this.radius = center.distanceTo(atoms[0].position.clone().lerp(atoms[1].position, 0.5)); - } - }, { - key: "forEachBond", - value: function forEachBond(process) { - var atoms = this.atoms; - var nA = atoms.length; - var currAtom = atoms[0]; - var nextAtom; - - function checkBond(bond) { - if (bond._left === nextAtom || bond._right === nextAtom) { - process(bond); - } - } - - for (var i = 0; i < nA; ++i) { - nextAtom = atoms[(i + 1) % nA]; - currAtom.forEachBond(checkBond); - currAtom = nextAtom; - } - } - }]); - - return Cycle; - }(); - - function _isAromatic(bond) { - return bond._type === cAromaticType; - } - - function _isPossibleAromatic(bond) { - if (bond.type === cAromaticType) { - return true; - } - - var rightIdx = cAromaticAtoms.indexOf(bond._right.element.number); - var leftIdx = cAromaticAtoms.indexOf(bond._left.element.number); - return rightIdx !== -1 && leftIdx !== -1; - } - - function _checkCycleSimple(cycle) { - return cycle.length > 3; - } - - function _checkCycleComplex(cycle) { - console.assert(cycle.length > 2); - return true; - } - - var AromaticLoopsMarker = /*#__PURE__*/function () { - function AromaticLoopsMarker(complex) { - classCallCheck(this, AromaticLoopsMarker); - - this._complex = complex; - var bondsData = new Array(complex._bonds.length); - var bondMarks = new Array(complex._bonds.length); - - for (var i = 0, n = bondsData.length; i < n; ++i) { - bondsData[i] = []; - bondMarks[i] = false; - } - - this._bondsData = bondsData; - this._bondMarks = bondMarks; - - this._resetCycles(); - } - - createClass(AromaticLoopsMarker, [{ - key: "_resetCycles", - value: function _resetCycles() { - this._cycles = []; - this._currIdx = -1; - } - }, { - key: "_haveSameCycle", - value: function _haveSameCycle(bondsData, bond1, bond2) { - var arr1 = bondsData[bond1._index]; - var arr2 = bondsData[bond2._index]; - var n1 = arr1.length; - var n2 = arr2.length; - var i1 = 0; - var i2 = 0; - - while (i1 < n1 && i2 < n2) { - if (arr1[i1] === arr2[i2]) { - return true; - } - - if (arr1[i1] > arr2[i2]) { - ++i2; - } else { - ++i1; - } - } - - return false; - } - }, { - key: "_tryBond", - value: function _tryBond(prevBond, currRight, currDir) { - var bondsOrder = []; - var bondsData = this._bondsData; - - var currLeft = _anotherAtom(prevBond, currRight); - - var currVec = currRight.position.clone().sub(currLeft.position); - var startAtomRef = this._currStart; - var self = this; - var bondMarks = this._bondMarks; - var checkAromatic = this._checkBond; - bondMarks[prevBond._index] = true; - checkAromatic = checkAromatic === undefined ? _isAromatic : checkAromatic; - currRight.forEachBond(function (newBond) { - if (!checkAromatic(newBond) || newBond === prevBond || bondMarks[newBond._index] || self._haveSameCycle(bondsData, prevBond, newBond)) { - return; - } - - var anotherAtom = _anotherAtom(newBond, currRight); - - var anotherVec = anotherAtom.position.clone().sub(currRight.position); - var val = anotherAtom === startAtomRef ? -2.0 : 1 - _cosBetween(currVec, anotherVec); - var newDir = anotherVec.cross(currVec); - - if (!_coDirVectors(newDir, currDir)) { - return; - } - - var idx = 0; - - while (idx < bondsOrder.length && bondsOrder[idx].val < val) { - ++idx; - } - - bondsOrder.splice(idx, 0, { - bond: newBond, - val: val, - dir: newDir - }); - }); - - for (var i = 0, n = bondsOrder.length; i < n; ++i) { - var bond = bondsOrder[i].bond; - var newRight = bond._left === currRight ? bond._right : bond._left; - - if (newRight === startAtomRef) { - ++this._currIdx; - - this._cycles.push([currRight]); - - bondMarks[prevBond._index] = false; - return true; - } - - if (this._tryBond(bond, newRight, bondsOrder[i].dir)) { - _insertAscending(bondsData[bond._index], this._currIdx); - - this._cycles[this._currIdx].push(currRight); - - bondMarks[prevBond._index] = false; - return true; - } - } - - bondMarks[prevBond._index] = false; - return false; - } - }, { - key: "_startCycle", - value: function _startCycle(bond) { - // start from left to right - this._currStart = bond._left; - - if (this._tryBond(bond, bond._right, new THREE.Vector3())) { - _insertAscending(this._bondsData[bond._index], this._currIdx); - - this._cycles[this._currIdx].push(bond._left); - } - } - }, { - key: "_findLoops", - value: function _findLoops(checkBond, checkCycle) { - this._checkBond = checkBond; - var complex = this._complex; - var self = this; - complex.forEachComponent(function (component) { - self._resetCycles(); - - component.forEachBond(function (bond) { - if (checkBond(bond)) { - self._startCycle(bond); - } - }); - var cycles = self._cycles; - - for (var i = 0, n = cycles.length; i < n; ++i) { - var cycle = cycles[i]; - - if (!checkCycle(cycle)) { - continue; - } - - var newCycle = new Cycle(cycle); - newCycle.forEachBond(_markAromatic); - component.addCycle(newCycle); - } - }); - } - }, { - key: "markCycles", - value: function markCycles() { - this._findLoops(_isAromatic, _checkCycleSimple); - } - }, { - key: "detectCycles", - value: function detectCycles() { - this._findLoops(_isPossibleAromatic, _checkCycleComplex); - } - }]); - - return AromaticLoopsMarker; - }(); - - /** - * Calculate min & max radius of a sphere slice between zMin & zMax - * - * @param {Vector3} center - center of the sphere - * @param {number} radius - sphere radius - * @param {number} zMin - lower bound of the slice - * @param {number} zMax - upper bound of the slice - */ - - function _getSphereSliceRadiusRange(center, radius, zMin, zMax) { - var dzMin = zMin - center.z; - var dzMax = zMax - center.z; - var rzMin = Math.sqrt(Math.max(radius * radius - dzMin * dzMin, 0.0)); - var rzMax = Math.sqrt(Math.max(radius * radius - dzMax * dzMax, 0.0)); - var rMin = Math.min(rzMin, rzMax); - var rMax; - - if (zMin <= center.z && zMax >= center.z) { - // sphere's main diameter is inside slice - rMax = radius; - } else { - rMax = Math.max(rzMin, rzMax); - } - - return [rMin, rMax]; - } - /** - * Calculate min & max radius of a circle slice between yMin & yMax. - * - * To maintain analogy with _getSphereSliceRadiusRange we call radius what in fact is - * half-width (along X axis) of the slice, i.e. 1D-sphere radius. - * - * @param {Vector3} center - center of the circle (z can be ignored) - * @param {number} radius - circle radius - * @param {number} yMin - lower bound of the slice - * @param {number} yMax - upper bound of the slice - * @returns {Array} - array of two numbers (min & max radius, or half-width) - */ - - - function _getCircleSliceRadiusRange(center, radius, yMin, yMax) { - var dyMin = yMin - center.y; - var dyMax = yMax - center.y; - var ryMin = Math.sqrt(Math.max(radius * radius - dyMin * dyMin, 0.0)); - var ryMax = Math.sqrt(Math.max(radius * radius - dyMax * dyMax, 0.0)); - var rMin = Math.min(ryMin, ryMax); - var rMax; - - if (yMin <= center.y && yMax >= center.y) { - // slice's main diameter is inside slice - rMax = radius; - } else { - rMax = Math.max(ryMin, ryMax); - } - - return [rMin, rMax]; - } - /** - * VoxelWorld constructor - * - * @param {Box3} box - bounding box of the volume to be partitioned - * @param {Vector3} vCellSizeHint - target voxel size (actual voxel size may differ from this) - */ - - - var VoxelWorld = /*#__PURE__*/function () { - function VoxelWorld(box, vCellSizeHint) { - classCallCheck(this, VoxelWorld); - - this._box = box.clone(); - var size = new THREE.Vector3(); - box.getSize(size); - this._count = size.clone().divide(vCellSizeHint).floor().max(new THREE.Vector3(1, 1, 1)); - this._last = this._count.clone().subScalar(1); - this._cellSize = size.clone().divide(this._count); - this._cellInnerR = 0.5 * Math.min(Math.min(this._cellSize.x, this._cellSize.y), this._cellSize.z); - this._cellOuterR = 0.5 * Math.sqrt(this._cellSize.dot(this._cellSize)); // array of voxels, each element contains index of first atom in voxel - - var numVoxels = this._count.x * this._count.y * this._count.z; - this._voxels = utils.allocateTyped(Int32Array, numVoxels); - - for (var i = 0; i < numVoxels; ++i) { - this._voxels[i] = -1; - } // array of atoms that stores multiple single-linked lists - // two elements for each atom: Atom ref, index of next atom (in this array - - - this._atoms = []; - } - /** - * Add all atoms from a complex to voxel world - * - * @param {Complex} complex - complex - */ - - - createClass(VoxelWorld, [{ - key: "addAtoms", - value: function addAtoms(complex) { - var self = this; - var idx = this._atoms.length; // resize array of atoms - - this._atoms.length += 2 * complex.getAtomCount(); - complex.forEachAtom(function (atom) { - // find which voxel contains this atom - var voxelIdx = self._findVoxel(atom.position); // push current atom to the head of voxel's atom list - - - self._atoms[idx] = atom; - self._atoms[idx + 1] = self._voxels[voxelIdx]; - self._voxels[voxelIdx] = idx; - idx += 2; - }); - } - /** - * Get voxel that contains specified 3D point (we use clamp at the edges) - * - * @param {Vector3} point - a point in 3D - * @returns {number} - index of voxel - */ - - }, { - key: "_findVoxel", - value: function _findVoxel(point) { - var zero = VoxelWorld._zero; - var voxel = VoxelWorld._voxel; - voxel.copy(point).sub(this._box.min).divide(this._cellSize).floor().clamp(zero, this._last); - return voxel.x + this._count.x * (voxel.y + this._count.y * voxel.z); - } - /** - * Call a function for each atom in voxel - * - * @param {number} voxel - index of voxel - * @param {function(Atom)} process - function to call - */ - - }, { - key: "_forEachAtomInVoxel", - value: function _forEachAtomInVoxel(voxel, process) { - for (var i = this._voxels[voxel]; i >= 0; i = this._atoms[i + 1]) { - process(this._atoms[i]); - } - } - /** - * Call a function for each voxel that is touched by given sphere. Callback also takes flag - * isInside specifying whether voxel lies inside the sphere entirely. - * - * @param {Vector3} center - center of the sphere - * @param {number} radius - sphere radius - * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside - */ - - }, { - key: "_forEachVoxelWithinRadius", - value: function _forEachVoxelWithinRadius(center, radius, process) { - var xRange = VoxelWorld._xRange; - var yRange = VoxelWorld._yRange; - var zRange = VoxelWorld._zRange; // switch to a faster method unless cell size is much smaller than sphere radius - - if (radius / this._cellInnerR < 10) { - this._forEachVoxelWithinRadiusSimple(center, radius, process); - - return; - } - - var rRangeXY; - var rRangeX; - var xVal; - var yVal; - var zVal; - var isInsideX; - var isInsideY; - var isInsideZ; - zRange.set(center.z - radius, center.z + radius); - zRange.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor().clampScalar(0, this._count.z - 1); - - for (var z = zRange.x; z <= zRange.y; ++z) { - zVal = [this._box.min.z + z * this._cellSize.z, this._box.min.z + (z + 1) * this._cellSize.z]; - isInsideZ = center.z - radius <= zVal[0] && zVal[1] <= center.z + radius; - rRangeXY = _getSphereSliceRadiusRange(center, radius, zVal[0], zVal[1]); - yRange.set(center.y - rRangeXY[1], center.y + rRangeXY[1]); - yRange.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor().clampScalar(0, this._count.y - 1); - - for (var y = yRange.x; y <= yRange.y; ++y) { - yVal = [this._box.min.y + y * this._cellSize.y, this._box.min.y + (y + 1) * this._cellSize.y]; - isInsideY = center.y - rRangeXY[0] <= yVal[0] && yVal[1] <= center.y + rRangeXY[0]; - rRangeX = _getCircleSliceRadiusRange(center, rRangeXY[1], yVal[0], yVal[1]); - xRange.set(center.x - rRangeX[1], center.x + rRangeX[1]); - xRange.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor().clampScalar(0, this._count.x - 1); - - for (var x = xRange.x; x <= xRange.y; ++x) { - xVal = [this._box.min.x + x * this._cellSize.x, this._box.min.x + (x + 1) * this._cellSize.x]; - isInsideX = center.x - rRangeX[0] <= xVal[0] && xVal[1] <= center.x + rRangeX[0]; - process(x + this._count.x * (y + this._count.y * z), isInsideX && isInsideY && isInsideZ); - } - } - } - } - /** - * Call a function for each voxel that is touched by given sphere. Callback also takes flag - * isInside specifying whether voxel lies inside the sphere entirely. - * This is a version of method that doesn't try to "calculate" what voxels fall inside radius - * but instead just checks all voxels inside sphere's bounding box. This should be faster - * unless cell size is much smaller than sphere radius. - * - * @param {Vector3} center - center of the sphere - * @param {number} radius - sphere radius - * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside - */ - - }, { - key: "_forEachVoxelWithinRadiusSimple", - value: function _forEachVoxelWithinRadiusSimple(center, radius, process) { - var xRange = VoxelWorld._xRange; - var yRange = VoxelWorld._yRange; - var zRange = VoxelWorld._zRange; - var vCenter = VoxelWorld._vCenter; - var distTouch2 = (radius + this._cellOuterR) * (radius + this._cellOuterR); - var distInside2 = -1.0; - - if (radius > this._cellOuterR) { - distInside2 = (radius - this._cellOuterR) * (radius - this._cellOuterR); - } // calculate bounding box for the sphere - - - xRange.set(center.x - radius, center.x + radius); - xRange.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor(); - xRange.x = Math.min(Math.max(xRange.x, 0), this._count.x - 1); - xRange.y = Math.min(Math.max(xRange.y, 0), this._count.x - 1); - yRange.set(center.y - radius, center.y + radius); - yRange.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor(); - yRange.x = Math.min(Math.max(yRange.x, 0), this._count.y - 1); - yRange.y = Math.min(Math.max(yRange.y, 0), this._count.y - 1); - zRange.set(center.z - radius, center.z + radius); - zRange.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor(); - zRange.x = Math.min(Math.max(zRange.x, 0), this._count.z - 1); - zRange.y = Math.min(Math.max(zRange.y, 0), this._count.z - 1); - - for (var z = zRange.x; z <= zRange.y; ++z) { - var zVal = [this._box.min.z + z * this._cellSize.z, this._box.min.z + (z + 1) * this._cellSize.z]; - vCenter.z = 0.5 * (zVal[0] + zVal[1]); - - for (var y = yRange.x; y <= yRange.y; ++y) { - var yVal = [this._box.min.y + y * this._cellSize.y, this._box.min.y + (y + 1) * this._cellSize.y]; - vCenter.y = 0.5 * (yVal[0] + yVal[1]); - - for (var x = xRange.x; x <= xRange.y; ++x) { - var xVal = [this._box.min.x + x * this._cellSize.x, this._box.min.x + (x + 1) * this._cellSize.x]; - vCenter.x = 0.5 * (xVal[0] + xVal[1]); - var d2 = center.distanceToSquared(vCenter); - - if (d2 <= distTouch2) { - process(x + this._count.x * (y + this._count.y * z), d2 <= distInside2); - } - } - } - } - } - /** - * Call a function for each atom within given sphere - * - * @param {Vector3} center - center of the sphere - * @param {number} radius - sphere radius - * @param {function(Atom)} process - function to call - */ - - }, { - key: "forEachAtomWithinRadius", - value: function forEachAtomWithinRadius(center, radius, process) { - var self = this; - var r2 = radius * radius; - - self._forEachVoxelWithinRadius(center, radius, function (voxel, isInside) { - if (isInside) { - self._forEachAtomInVoxel(voxel, process); - } else { - self._forEachAtomInVoxel(voxel, function (atom) { - if (center.distanceToSquared(atom.position) <= r2) { - process(atom); - } - }); - } - }); - } - /** - * Call a function for each atom of given complex within given distance from group of atoms defined by mask - * - * @param {Complex} complex - complex - * @param {number} mask - bit mask - * @param {number} dist - distance - * @param {function(Atom)} process - function to call - */ - - }, { - key: "forEachAtomWithinDistFromMasked", - value: function forEachAtomWithinDistFromMasked(complex, mask, dist, process) { - this._forEachAtomWithinDistFromGroup(function (atomProc) { - complex.forEachAtom(function (atom) { - if ((atom.mask & mask) !== 0) { - atomProc(atom); - } - }); - }, dist, process); - } - /** - * Call a function for each atom of given complex within given distance from group of atoms defined by selector - * - * @param {Complex} complex - complex - * @param {number} selector - selector - * @param {number} dist - distance - * @param {function(Atom)} process - function to call - */ - - }, { - key: "forEachAtomWithinDistFromSelected", - value: function forEachAtomWithinDistFromSelected(complex, selector, dist, process) { - this._forEachAtomWithinDistFromGroup(function (atomProc) { - complex.forEachAtom(function (atom) { - if (selector.includesAtom(atom)) { - atomProc(atom); - } - }); - }, dist, process); - } - /** - * Call a function for each atom of given complex within given distance from group of atoms - * - * @param {function} forEachAtom - enumerator of atoms in the group - * @param {number} dist - distance - * @param {function(Atom)} process - function to call - */ - - }, { - key: "_forEachAtomWithinDistFromGroup", - value: function _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) { - var self = this; - var r2 = dist * dist; - var voxels = []; - var atoms = []; - var idx = 0; // build "within radius" atom list for each voxel - - forEachAtom(function (atom) { - self._forEachVoxelWithinRadius(atom.position, dist, function (voxel, isInside) { - if (isInside) { - // this voxel is inside circle -- no check will be required - voxels[voxel] = -1; - } else if (typeof voxels[voxel] === 'undefined') { - // this voxel isn't covered yet -- start building list of atoms - atoms.push(atom); - atoms.push(-1); - voxels[voxel] = idx; - idx += 2; - } else if (voxels[voxel] !== -1) { - // this voxel has a list of atoms required for distance check -- add atom to the list - atoms.push(atom); - atoms.push(voxels[voxel]); - voxels[voxel] = idx; - idx += 2; - } - }); - }); - var voxel; - - var processIfWithin = function processIfWithin(atom) { - if (typeof voxels[voxel] === 'undefined') { - return; - } - - idx = voxels[voxel]; - - if (idx === -1) { - // this voxel is fully covered - process(atom); - return; - } // check distance to each atom within radius from this voxel - - - for (; idx >= 0; idx = atoms[idx + 1]) { - if (atom.position.distanceToSquared(atoms[idx].position) < r2) { - process(atom); - break; - } - } - }; // for each marked voxel - - - for (voxel in voxels) { - if (voxels.hasOwnProperty(voxel)) { - self._forEachAtomInVoxel(voxel, processIfWithin); - } - } - } - }]); - - return VoxelWorld; - }(); - - defineProperty(VoxelWorld, "_zero", new THREE.Vector3(0, 0, 0)); - - defineProperty(VoxelWorld, "_voxel", new THREE.Vector3()); - - defineProperty(VoxelWorld, "_xRange", new THREE.Vector2()); - - defineProperty(VoxelWorld, "_yRange", new THREE.Vector2()); - - defineProperty(VoxelWorld, "_zRange", new THREE.Vector2()); - - defineProperty(VoxelWorld, "_vCenter", new THREE.Vector3()); - - var MINIMAL_DISTANCE = 0.5; - var MIN_HBOND_ENERGY = -9.9; - var MAX_HBOND_ENERGY = -0.5; - var COUPLING_CONSTANT = -27.888; // = -332 * 0.42 * 0.2 - - var MAX_COUPLING_DISTANCE = 5.0; // how far is the closest atom of a potential partner residue from CA atom - - var MAX_RESIDUES_THRESHOLD = 1000; - - var HBondInfo = /*#__PURE__*/function () { - function HBondInfo(complex) { - classCallCheck(this, HBondInfo); - - this._complex = complex; - this._hbonds = []; // array of bond info for each residue - - if (this._complex._residues.length > MAX_RESIDUES_THRESHOLD) { - this._buildVW(); // optimized version using voxel grid - - } else { - this._build(); // test all pairs of residues - - } - } - - createClass(HBondInfo, [{ - key: "isBond", - value: function isBond(from, to) { - if (this._hbonds[from]) { - var _this$_hbonds$from$ac = slicedToArray(this._hbonds[from].acceptor, 2), - acc0 = _this$_hbonds$from$ac[0], - acc1 = _this$_hbonds$from$ac[1]; - - if (acc0 && acc0.residue === to && acc0.energy < MAX_HBOND_ENERGY) { - return true; - } - - if (acc1 && acc1.residue === to && acc1.energy < MAX_HBOND_ENERGY) { - return true; - } - } - - return false; - } - }, { - key: "_build", - value: function _build() { - var self = this; - - for (var i = 0; i < this._complex._residues.length - 1; ++i) { - var ri = this._complex._residues[i]; - - if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) { - continue; - } // get predecessor in chain - - - var preri = null; - - if (i > 0 && this._complex._residues[i - 1].getType().flags & ResidueType.Flags.PROTEIN && ri._sequence === this._complex._residues[i - 1]._sequence + 1) { - preri = this._complex._residues[i - 1]; - } - - for (var j = i + 1; j < this._complex._residues.length; ++j) { - var rj = this._complex._residues[j]; - - if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) { - continue; - } // get predecessor in chain - - - var prerj = null; - - if (this._complex._residues[j - 1].getType().flags & ResidueType.Flags.PROTEIN && rj._sequence === this._complex._residues[j - 1]._sequence + 1) { - prerj = this._complex._residues[j - 1]; - } - - self._calcHBondEnergy(preri, ri, rj); - - if (j !== i + 1) { - self._calcHBondEnergy(prerj, rj, ri); - } - } - } - } - }, { - key: "_buildVW", - value: function _buildVW() { - var self = this; - var residues = this._complex._residues; - var ri; - var preri; - - var vw = this._complex.getVoxelWorld(); - - if (vw === null) { - return; - } - - var pairs = new AtomPairs(this._complex._residues.length * this._complex._residues.length / 2); - - function processAtom(atom) { - var rj = atom.residue; - - if (rj._index === ri._index) { - return; - } - - if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) { - return; - } - - if (!pairs.addPair(ri._index, rj._index)) { - // we've seen this pair - return; - } // get predecessor in chain - - - var prerj = rj._index > 0 ? residues[rj._index - 1] : null; - - if (prerj && ((prerj.getType().flags & ResidueType.Flags.PROTEIN) === 0 || rj._sequence !== prerj._sequence + 1)) { - prerj = null; - } - - self._calcHBondEnergy(preri, ri, rj); - - if (rj._index !== ri._index + 1) { - self._calcHBondEnergy(prerj, rj, ri); - } - } - - for (var i = 0; i < residues.length - 1; ++i) { - ri = residues[i]; - - if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) { - continue; - } // get predecessor in chain - - - preri = i > 0 ? residues[i - 1] : null; - - if (preri && ((preri.getType().flags & ResidueType.Flags.PROTEIN) === 0 || ri._sequence !== preri._sequence + 1)) { - preri = null; - } - - vw.forEachAtomWithinRadius(this._residueGetCAlpha(ri), MAX_COUPLING_DISTANCE, processAtom); - } - } - }, { - key: "_residueGetCAlpha", - value: function _residueGetCAlpha(res) { - for (var i = 0; i < res._atoms.length; ++i) { - var name = res._atoms[i].name; - - if (name === 'CA' || name === 'C1') { - return res._atoms[i].position; - } - } - - return null; - } - }, { - key: "_residueGetCO", - value: function _residueGetCO(res) { - var c = null; - var o = null; - res.forEachAtom(function (a) { - if (a.name === 'C') { - c = a.position; - } else if (a.name === 'O') { - o = a.position; - } - }); - return [c, o]; - } // TODO Support hydrogen defined in complex - - }, { - key: "_residueGetNH", - value: function _residueGetNH(prev, res) { - var _this$_residueGetCO = this._residueGetCO(prev), - _this$_residueGetCO2 = slicedToArray(_this$_residueGetCO, 2), - c = _this$_residueGetCO2[0], - o = _this$_residueGetCO2[1]; - - var n; - res.forEachAtom(function (a) { - if (a.name === 'N') { - n = a.position; - } - }); - - if (c && o && n) { - // calculate hydrogen position - var h = c.clone(); - h.sub(o); - h.multiplyScalar(1.0 / h.length()); - h.add(n); - return [n, h]; - } - - return [null, null]; - } - }, { - key: "_calcHBondEnergy", - value: function _calcHBondEnergy(predonor, donor, acceptor) { - var result = 0; - - if (predonor === null) { - return result; - } - - if (donor.getType().getName() !== 'PRO') { - var _this$_residueGetNH = this._residueGetNH(predonor, donor), - _this$_residueGetNH2 = slicedToArray(_this$_residueGetNH, 2), - n = _this$_residueGetNH2[0], - h = _this$_residueGetNH2[1]; - - var _this$_residueGetCO3 = this._residueGetCO(acceptor), - _this$_residueGetCO4 = slicedToArray(_this$_residueGetCO3, 2), - c = _this$_residueGetCO4[0], - o = _this$_residueGetCO4[1]; - - if (n === null || h === null || c === null || o === null) { - return result; - } - - var distanceHO = h.distanceTo(o); - var distanceHC = h.distanceTo(c); - var distanceNC = n.distanceTo(c); - var distanceNO = n.distanceTo(o); - - if (distanceHO < MINIMAL_DISTANCE || distanceHC < MINIMAL_DISTANCE || distanceNC < MINIMAL_DISTANCE || distanceNO < MINIMAL_DISTANCE) { - result = MIN_HBOND_ENERGY; - } else { - result = COUPLING_CONSTANT / distanceHO - COUPLING_CONSTANT / distanceHC + COUPLING_CONSTANT / distanceNC - COUPLING_CONSTANT / distanceNO; - } // DSSP compatibility mode: - - - result = Math.round(result * 1000) / 1000; - - if (result < MIN_HBOND_ENERGY) { - result = MIN_HBOND_ENERGY; - } - } // update donor - - - if (typeof this._hbonds[donor._index] === 'undefined') { - this._hbonds[donor._index] = { - donor: [], - acceptor: [] - }; - } - - var donorInfo = this._hbonds[donor._index]; - - if (donorInfo.acceptor.length < 2) { - donorInfo.acceptor.push({ - residue: acceptor._index, - energy: result - }); - } - - if (donorInfo.acceptor.length > 1) { - if (result < donorInfo.acceptor[0].energy) { - donorInfo.acceptor[1].residue = donorInfo.acceptor[0].residue; - donorInfo.acceptor[1].energy = donorInfo.acceptor[0].energy; - donorInfo.acceptor[0].residue = acceptor._index; - donorInfo.acceptor[0].energy = result; - } else if (result < donorInfo.acceptor[1].energy) { - donorInfo.acceptor[1].residue = acceptor._index; - donorInfo.acceptor[1].energy = result; - } - } // update acceptor - - - if (typeof this._hbonds[acceptor._index] === 'undefined') { - this._hbonds[acceptor._index] = { - donor: [], - acceptor: [] - }; - } - - var accInfo = this._hbonds[acceptor._index]; - - if (accInfo.donor.length < 2) { - accInfo.donor.push({ - residue: donor._index, - energy: result - }); - } - - if (accInfo.donor.length > 1) { - if (result < accInfo.donor[0].energy) { - accInfo.donor[1].residue = accInfo.donor[0].residue; - accInfo.donor[1].energy = accInfo.donor[0].energy; - accInfo.donor[0].residue = donor._index; - accInfo.donor[0].energy = result; - } else if (result < accInfo.donor[1].energy) { - accInfo.donor[1].residue = donor._index; - accInfo.donor[1].energy = result; - } - } - - return result; - } - }]); - - return HBondInfo; - }(); - - var BridgeType = Object.freeze({ - NO_BRIDGE: 0, - PARALLEL: 1, - ANTI_PARALLEL: 2 - }); - var HelixFlag = Object.freeze({ - START: 1, - MIDDLE: 2, - END: 3, - START_AND_END: 4 - }); - var StructureType = Object.freeze({ - STRAND: 'E', - BRIDGE: 'B', - HELIX_310: 'G', - HELIX_ALPHA: 'H', - HELIX_PI: 'I', - TURN: 'T', - BEND: 'S', - LOOP: ' ' - }); - - var SecondaryStructureMap = /*#__PURE__*/function () { - function SecondaryStructureMap(complex) { - classCallCheck(this, SecondaryStructureMap); - - this._complex = complex; - - this._build(); - } - - createClass(SecondaryStructureMap, [{ - key: "_build", - value: function _build() { - var self = this; - this._hbonds = new HBondInfo(this._complex); - this._ss = []; // DSSP map by residue - // auxilliary data - - this._sheet = []; - this._betaPartners = []; - this._bend = []; - - for (var i = 0; i < this._complex.getResidues().length; ++i) { - this._betaPartners[i] = []; - } - - this._helixFlags = []; - this._helixFlags[3] = []; - this._helixFlags[4] = []; - this._helixFlags[5] = []; // calculate peptide chain lengths - - this._chainLengths = []; - - for (var _i = 0; _i < this._complex._chains.length; ++_i) { - var chain = this._complex._chains[_i].getResidues(); - - var len = 0; - - for (; len < chain.length; ++len) { - if ((chain[len].getType().flags & ResidueType.Flags.PROTEIN) === 0) { - break; - } - } - - this._chainLengths[_i] = len; - } - - this._buildBetaSheets(); - - for (var _i2 = 0; _i2 < this._complex._chains.length; ++_i2) { - self._buildAlphaHelices(this._complex._chains[_i2].getResidues(), this._chainLengths[_i2], false); - } - } - }, { - key: "_buildAlphaHelices", - value: function _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) { - // Helix and Turn - for (var stride = 3; stride <= 5; ++stride) { - if (inResidues.length < stride) { - break; - } - - for (var i = 0; i + stride < chainLength; ++i) { - if (this._hbonds.isBond(inResidues[i + stride]._index, inResidues[i]._index) - /* && NoChainBreak(res[i], res[i + stride]) */ - ) { - this._helixFlags[stride][inResidues[i + stride]._index] = HelixFlag.END; - - for (var j = i + 1; j < i + stride; ++j) { - if (typeof this._helixFlags[stride][inResidues[j]._index] === 'undefined') { - this._helixFlags[stride][inResidues[j]._index] = HelixFlag.MIDDLE; - } - } - - if (this._helixFlags[stride][inResidues[i]._index] === HelixFlag.END) { - this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START_AND_END; - } else { - this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START; - } - } - } - } - - for (var _i3 = 2; _i3 < chainLength - 2; ++_i3) { - var kappa = this._kappa(inResidues[_i3 - 2], inResidues[_i3], inResidues[_i3 + 2]); - - this._bend[inResidues[_i3]._index] = kappa !== 360 && kappa > 70; - } - - for (var _i4 = 1; _i4 + 4 < chainLength; ++_i4) { - if (this._isHelixStart(inResidues[_i4]._index, 4) && this._isHelixStart(inResidues[_i4 - 1]._index, 4)) { - for (var _j = _i4; _j <= _i4 + 3; ++_j) { - this._ss[inResidues[_j]._index] = StructureType.HELIX_ALPHA; - } - } - } - - for (var _i5 = 1; _i5 + 3 < chainLength; ++_i5) { - if (this._isHelixStart(inResidues[_i5]._index, 3) && this._isHelixStart(inResidues[_i5 - 1]._index, 3)) { - var empty = true; - - for (var _j2 = _i5; empty && _j2 <= _i5 + 2; ++_j2) { - empty = typeof this._ss[inResidues[_j2]._index] === 'undefined' || this._ss[inResidues[_j2]._index] === StructureType.HELIX_310; - } - - if (empty) { - for (var _j3 = _i5; _j3 <= _i5 + 2; ++_j3) { - this._ss[inResidues[_j3]._index] = StructureType.HELIX_310; - } - } - } - } - - for (var _i6 = 1; _i6 + 5 < chainLength; ++_i6) { - if (this._isHelixStart(inResidues[_i6]._index, 5) && this._isHelixStart(inResidues[_i6 - 1]._index, 5)) { - var _empty = true; - - for (var _j4 = _i6; _empty && _j4 <= _i6 + 4; ++_j4) { - _empty = typeof this._ss[inResidues[_j4]._index] === 'undefined' || this._ss[inResidues[_j4]._index] === StructureType.HELIX_PI || inPreferPiHelices && this._ss[inResidues[_j4]._index] === StructureType.HELIX_ALPHA; - } - - if (_empty) { - for (var _j5 = _i6; _j5 <= _i6 + 4; ++_j5) { - this._ss[inResidues[_j5]._index] = StructureType.HELIX_PI; - } - } - } - } - - for (var _i7 = 1; _i7 + 1 < chainLength; ++_i7) { - if (typeof this._ss[inResidues[_i7]._index] === 'undefined') { - var isTurn = false; - - for (var _stride = 3; _stride <= 5 && !isTurn; ++_stride) { - for (var k = 1; k < _stride && !isTurn; ++k) { - isTurn = _i7 >= k && this._isHelixStart(inResidues[_i7 - k]._index, _stride); - } - } - - if (isTurn) { - this._ss[inResidues[_i7]._index] = StructureType.TURN; - } else if (this._bend[inResidues[_i7]._index]) { - this._ss[inResidues[_i7]._index] = StructureType.BEND; - } - } - } - } - }, { - key: "_residueGetCAlpha", - value: function _residueGetCAlpha(res) { - for (var i = 0; i < res._atoms.length; ++i) { - var name = res._atoms[i].name; - - if (name === 'CA' || name === 'C1') { - return res._atoms[i].position; - } - } - - return null; - } - }, { - key: "_cosinusAngle", - value: function _cosinusAngle(p1, p2, p3, p4) { - var v12 = p1.clone().sub(p2); - var v34 = p3.clone().sub(p4); - var result = 0; - var x = v12.dot(v12) * v34.dot(v34); - - if (x > 0) { - result = v12.dot(v34) / Math.sqrt(x); - } - - return result; - } - }, { - key: "_kappa", - value: function _kappa(prevPrev, res, nextNext) { - var curCA = this._residueGetCAlpha(res); - - var ppCA = this._residueGetCAlpha(prevPrev); - - var nnCA = this._residueGetCAlpha(nextNext); - - if (curCA === null || ppCA === null || nnCA === null) { - return 180; - } - - var ckap = this._cosinusAngle(curCA, ppCA, nnCA, curCA); - - var skap = Math.sqrt(1 - ckap * ckap); - return Math.atan2(skap, ckap) * 180 / Math.PI; - } - }, { - key: "_isHelixStart", - value: function _isHelixStart(res, stride) { - return this._helixFlags[stride][res] === HelixFlag.START || this._helixFlags[stride][res] === HelixFlag.START_AND_END; - } - }, { - key: "_buildBetaSheets", - value: function _buildBetaSheets() { - // find bridges - // check each chain against each other chain, and against itself - var bridges = []; - - for (var a = 0; a < this._complex._chains.length; ++a) { - var lenA = this._chainLengths[a]; - - if (lenA <= 4) { - continue; - } - - var chainA = this._complex._chains[a].getResidues(); - - for (var b = a; b < this._complex._chains.length; ++b) { - var lenB = this._chainLengths[b]; - - if (lenB <= 4) { - continue; - } - - var chainB = this._complex._chains[b].getResidues(); - - for (var i = 1; i + 1 < lenA; ++i) { - var ri = chainA[i]; - var j = 1; - - if (b === a) { - j = i + 3; // check for self-bridges forward down the chain - } - - for (; j + 1 < lenB; ++j) { - var rj = chainB[j]; - - var type = this._testBridge(chainA, i, chainB, j); - - if (type === BridgeType.NO_BRIDGE) { - continue; - } // there is a bridge, try to attach it to previously found sequence - - - var found = false; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = bridges[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var bridge = _step.value; - - if (type !== bridge.type || ri._index !== bridge.i[bridge.i.length - 1] + 1) { - continue; - } - - if (type === BridgeType.PARALLEL && bridge.j[bridge.j.length - 1] + 1 === rj._index) { - bridge.i.push(ri._index); - bridge.j.push(rj._index); - found = true; - break; - } - - if (type === BridgeType.ANTI_PARALLEL && bridge.j[0] - 1 === rj._index) { - bridge.i.push(ri._index); - bridge.j.unshift(rj._index); - found = true; - break; - } - } // this bridge cannot be attached anywhere, start a new sequence - - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator["return"] != null) { - _iterator["return"](); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - if (!found) { - bridges.push({ - type: type, - i: [ri._index], - chainI: ri.getChain()._index, - j: [rj._index], - chainJ: rj.getChain()._index - }); - } - } - } - } - } // extend ladders - - - bridges.sort(function (a, b) { - if (a.chainI < b.chainI || a.chainI === b.chainI && a.i[0] < b.i[0]) { - return -1; - } - - return 1; - }); - - for (var _i8 = 0; _i8 < bridges.length; ++_i8) { - for (var _j6 = _i8 + 1; _j6 < bridges.length; ++_j6) { - var ibi = bridges[_i8].i[0]; - var iei = bridges[_i8].i[bridges[_i8].i.length - 1]; - var jbi = bridges[_i8].j[0]; - var jei = bridges[_i8].j[bridges[_i8].j.length - 1]; - var ibj = bridges[_j6].i[0]; - var iej = bridges[_j6].i[bridges[_j6].i.length - 1]; - var jbj = bridges[_j6].j[0]; - var jej = bridges[_j6].j[bridges[_j6].j.length - 1]; - - if (bridges[_i8].type !== bridges[_j6].type || this._hasChainBreak(Math.min(ibi, ibj), Math.max(iei, iej)) || this._hasChainBreak(Math.min(jbi, jbj), Math.max(jei, jej)) || ibj - iei >= 6 || iei >= ibj && ibi <= iej) { - continue; - } - - var bulge = false; - - if (bridges[_i8].type === BridgeType.PARALLEL) { - bulge = jbj - jei < 6 && ibj - iei < 3 || jbj - jei < 3; - } else { - bulge = jbi - jej < 6 && ibj - iei < 3 || jbi - jej < 3; - } - - if (bulge) { - bridges[_i8].i = bridges[_i8].i.concat(bridges[_j6].i); - - if (bridges[_i8].type === BridgeType.PARALLEL) { - bridges[_i8].j = bridges[_i8].j.concat(bridges[_j6].j); - } else { - bridges[_i8].j = bridges[_j6].j.concat(bridges[_i8].j); - } - - bridges.splice(_j6--, 1); - } - } - } // Sheet - - - var ladderset = new Set(); - - for (var _i9 = 0; _i9 < bridges.length; ++_i9) { - ladderset.add(bridges[_i9]); - } - - var sheet = 1; - var ladder = 0; - - while (ladderset.size > 0) { - var _bridge = ladderset.values().next().value; - ladderset["delete"](_bridge); - var sheetset = new Set(); - sheetset.add(_bridge); - var toMove = void 0; - - do { - toMove = new Set(); - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = sheetset.values()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var _a = _step2.value; - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; - - try { - for (var _iterator4 = ladderset.values()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { - var _b = _step4.value; - - if (this._areBridgesLinked(_a, _b)) { - toMove.add(_b); - } - } - } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; - } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) { - _iterator4["return"](); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } - } - } - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) { - _iterator2["return"](); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = toMove.values()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - _bridge = _step3.value; - sheetset.add(_bridge); - ladderset["delete"](_bridge); - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) { - _iterator3["return"](); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } - } while (toMove.size > 0); - - var _iteratorNormalCompletion5 = true; - var _didIteratorError5 = false; - var _iteratorError5 = undefined; - - try { - for (var _iterator5 = sheetset.values()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { - _bridge = _step5.value; - _bridge.ladder = ladder; - _bridge.sheet = sheet; - _bridge.link = sheetset; - ++ladder; - } - } catch (err) { - _didIteratorError5 = true; - _iteratorError5 = err; - } finally { - try { - if (!_iteratorNormalCompletion5 && _iterator5["return"] != null) { - _iterator5["return"](); - } - } finally { - if (_didIteratorError5) { - throw _iteratorError5; - } - } - } - - ++sheet; - } - - for (var _i10 = 0; _i10 < bridges.length; ++_i10) { - var _bridge2 = bridges[_i10]; // find out if any of the i and j set members already have - // a bridge assigned, if so, we're assigning bridge 2 - - var betai = 0; - var betaj = 0; - - for (var l = 0; l < _bridge2.i.length; ++l) { - if (this._betaPartners[_bridge2.i[l]][0]) { - betai = 1; - break; - } - } - - for (var _l = 0; _l < _bridge2.j.length; ++_l) { - if (this._betaPartners[_bridge2.j[_l]][0]) { - betaj = 1; - break; - } - } - - var ss = StructureType.BRIDGE; - - if (_bridge2.i.length > 1) { - ss = StructureType.STRAND; - } - - if (_bridge2.type === BridgeType.PARALLEL) { - var _j7 = 0; - - for (var k = 0; k < _bridge2.i.length; ++k) { - this._betaPartners[_bridge2.i[k]][betai] = { - residue: _bridge2.j[_j7++], - ladder: _bridge2.ladder, - parallel: true - }; - } - - _j7 = 0; - - for (var _k = 0; _k < _bridge2.j.length; ++_k) { - this._betaPartners[_bridge2.j[_k]][betaj] = { - residue: _bridge2.i[_j7++], - ladder: _bridge2.ladder, - parallel: true - }; - } - } else { - var _j8 = _bridge2.j.length - 1; - - for (var _k2 = 0; _k2 < _bridge2.i.length; ++_k2) { - this._betaPartners[_bridge2.i[_k2]][betai] = { - residue: _bridge2.j[_j8--], - ladder: _bridge2.ladder, - parallel: false - }; - } - - _j8 = _bridge2.i.length - 1; - - for (var _k3 = 0; _k3 < _bridge2.j.length; ++_k3) { - this._betaPartners[_bridge2.j[_k3]][betaj] = { - residue: _bridge2.i[_j8--], - ladder: _bridge2.ladder, - parallel: false - }; - } - } - - for (var _k4 = _bridge2.i[0]; _k4 <= _bridge2.i[_bridge2.i.length - 1]; ++_k4) { - if (this._ss[_k4] !== StructureType.STRAND) { - this._ss[_k4] = ss; - this._sheet[_k4] = _bridge2.sheet; - } - } - - for (var _k5 = _bridge2.j[0]; _k5 <= _bridge2.j[_bridge2.j.length - 1]; ++_k5) { - if (this._ss[_k5] !== StructureType.STRAND) { - this._ss[_k5] = ss; - this._sheet[_k5] = _bridge2.sheet; - } - } - } - } - }, { - key: "_testBridge", - value: function _testBridge(chainA, from, chainB, to) { - var result = BridgeType.NO_BRIDGE; - var a = chainA[from - 1]._index; - var b = chainA[from]._index; - var c = chainA[from + 1]._index; - var d = chainB[to - 1]._index; - var e = chainB[to]._index; - var f = chainB[to + 1]._index; - - var isBond = this._hbonds.isBond.bind(this._hbonds); - - if (isBond(c, e) && isBond(e, a) || isBond(f, b) && isBond(b, d)) { - result = BridgeType.PARALLEL; - } else if (isBond(c, d) && isBond(f, a) || isBond(e, b) && isBond(b, e)) { - result = BridgeType.ANTI_PARALLEL; - } - - return result; - } // return true if any of the residues in bridge a is identical to any of the residues in bridge b - - }, { - key: "_areBridgesLinked", - value: function _areBridgesLinked(a, b) { - var ai = new Set(a.i); - var aj = new Set(a.j); - var _iteratorNormalCompletion6 = true; - var _didIteratorError6 = false; - var _iteratorError6 = undefined; - - try { - for (var _iterator6 = b.i[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { - var i = _step6.value; - - if (ai.has(i) || aj.has(i)) { - return true; - } - } - } catch (err) { - _didIteratorError6 = true; - _iteratorError6 = err; - } finally { - try { - if (!_iteratorNormalCompletion6 && _iterator6["return"] != null) { - _iterator6["return"](); - } - } finally { - if (_didIteratorError6) { - throw _iteratorError6; - } - } - } - - var _iteratorNormalCompletion7 = true; - var _didIteratorError7 = false; - var _iteratorError7 = undefined; - - try { - for (var _iterator7 = b.j[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { - var _i11 = _step7.value; - - if (ai.has(_i11) || aj.has(_i11)) { - return true; - } - } - } catch (err) { - _didIteratorError7 = true; - _iteratorError7 = err; - } finally { - try { - if (!_iteratorNormalCompletion7 && _iterator7["return"] != null) { - _iterator7["return"](); - } - } finally { - if (_didIteratorError7) { - throw _iteratorError7; - } - } - } - - return false; - } - }, { - key: "_hasChainBreak", - value: function _hasChainBreak(from, to) { - for (var i = from + 1; i <= to; ++i) { - if (this._complex._residues[i]._sequence !== this._complex._residues[i - 1]._sequence + 1) { - return true; - } - } - - return false; - } - }]); - - return SecondaryStructureMap; - }(); - SecondaryStructureMap.StructureType = StructureType; - - var _helixClassMap, _loopMap; - var VOXEL_SIZE = 5.0; - var StructureType$1 = SecondaryStructureMap.StructureType; - var StructuralElementType$2 = StructuralElement.Type; // see http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX - - var helixClassMap = (_helixClassMap = {}, defineProperty(_helixClassMap, StructureType$1.HELIX_ALPHA, 1), defineProperty(_helixClassMap, StructureType$1.HELIX_PI, 3), defineProperty(_helixClassMap, StructureType$1.HELIX_310, 5), _helixClassMap); - var loopMap = (_loopMap = {}, defineProperty(_loopMap, StructureType$1.BRIDGE, StructuralElementType$2.BRIDGE), defineProperty(_loopMap, StructureType$1.TURN, StructuralElementType$2.TURN), defineProperty(_loopMap, StructureType$1.BEND, StructuralElementType$2.BEND), defineProperty(_loopMap, StructureType$1.LOOP, StructuralElementType$2.COIL), _loopMap); - /** - * The entire complex of the molecules under study. - * - * @exports Complex - * @constructor - */ - - var Complex = /*#__PURE__*/function () { - function Complex() { - classCallCheck(this, Complex); - - this._chains = []; - this._components = []; - this._helices = []; - this._sheets = []; - this.structures = []; - this._residueTypes = Object.create(ResidueType.StandardTypes); - this._atoms = []; - this._residues = []; - this._bonds = []; - this._sgroups = []; - this._molecules = []; - this._maskNeedsUpdate = false; - this.metadata = {}; - this.symmetry = []; - this.units = [new BiologicalUnit(this)]; - this._currentUnit = 0; // default biological unit is the asymmetric unit - } - - createClass(Complex, [{ - key: "addAtom", - value: function addAtom(atom) { - var index = this._atoms.length; - - this._atoms.push(atom); - - return index; - } - }, { - key: "addSheet", - value: function addSheet(sheet) { - var index = this._sheets.length; - - this._sheets.push(sheet); - - return index; - } - }, { - key: "addHelix", - value: function addHelix(helix) { - var index = this._helices.length; - - this._helices.push(helix); - - return index; - } - }, { - key: "getAtoms", - value: function getAtoms() { - return this._atoms; - } - }, { - key: "getBonds", - value: function getBonds() { - return this._bonds; - } - }, { - key: "getAtomCount", - value: function getAtomCount() { - return this._atoms.length; - } - }, { - key: "addResidue", - value: function addResidue(residue) { - var index = this._residues.length; - - this._residues.push(residue); - - return index; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - this.forEachChain(function (chain) { - chain.updateToFrame(frameData); - }); - } - }, { - key: "addResidueType", - value: function addResidueType(resName) { - var rt = this._residueTypes[resName] = new ResidueType(resName, 'Unknown', ''); - return rt; - } - }, { - key: "getResidueCount", - value: function getResidueCount() { - return this._residues.length; - } - }, { - key: "getResidues", - value: function getResidues() { - return this._residues; - } - }, { - key: "getSGroupCount", - value: function getSGroupCount() { - return this._sgroups.length; - } - }, { - key: "getSGroups", - value: function getSGroups() { - return this._sgroups; - } - /* - Extract atom by its fullname: #chainName#.#residueId#.#atomName# - */ - - }, { - key: "getAtomByFullname", - value: function getAtomByFullname(fullName) { - var parts = fullName.split('.'); - - if (parts.length !== 3) { - return null; - } - - var chainName = parts[0]; - var resId = parseInt(parts[1], 10); - - if (Number.isNaN(resId)) { - return null; - } - - var atomName = parts[2].toUpperCase(); - var currAtom = null; - this.forEachChain(function (chain) { - if (currAtom) { - return; - } - - if (chain._name.localeCompare(chainName) === 0) { - chain.forEachResidue(function (residue) { - if (currAtom) { - return; - } - - if (residue._sequence === resId) { - residue.forEachAtom(function (atom) { - if (currAtom) { - return; - } - - if (atomName.localeCompare(atom.name) === 0) { - currAtom = atom; - } - }); - } - }); - } - }); - return currAtom; - } - /** - * Create a new chain. - * - * @param {string} name - Chain name. - * @returns {Chain} - Newly created chain. - */ - - }, { - key: "addChain", - value: function addChain(name) { - var result = new Chain(this, name); - - this._chains.push(result); - - return result; - } - }, { - key: "getChain", - value: function getChain(name) { - for (var i = 0, n = this._chains.length; i < n; ++i) { - var chain = this._chains[i]; - - if (chain.getName() === name) { - return chain; - } - } - - return null; - } - }, { - key: "getChainCount", - value: function getChainCount() { - return this._chains.length; - } - }, { - key: "getMolecules", - value: function getMolecules() { - return this._molecules; - } - }, { - key: "getMoleculeCount", - value: function getMoleculeCount() { - return this._molecules.length; - } - }, { - key: "forEachAtom", - value: function forEachAtom(process) { - var atoms = this._atoms; - - for (var i = 0, n = atoms.length; i < n; ++i) { - process(atoms[i]); - } - } - }, { - key: "forEachBond", - value: function forEachBond(process) { - var bonds = this._bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - process(bonds[i]); - } - } - }, { - key: "forEachResidue", - value: function forEachResidue(process) { - var residues = this._residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - process(residues[i]); - } - } - }, { - key: "forEachChain", - value: function forEachChain(process) { - var chains = this._chains; - - for (var i = 0, n = chains.length; i < n; ++i) { - process(chains[i]); - } - } - }, { - key: "forEachMolecule", - value: function forEachMolecule(process) { - var molecules = this._molecules; - var n = molecules.length; - - for (var i = 0; i < n; ++i) { - process(molecules[i]); - } - } - }, { - key: "forEachSGroup", - value: function forEachSGroup(process) { - var groups = this._sgroups; - - for (var i = 0, n = groups.length; i < n; ++i) { - process(groups[i]); - } - } - }, { - key: "forEachComponent", - value: function forEachComponent(process) { - var components = this._components; - - for (var i = 0, n = components.length; i < n; ++i) { - process(components[i]); - } - } - }, { - key: "forEachVisibleComponent", - value: function forEachVisibleComponent(process) { - var components = this._components; - - for (var i = 0, n = components.length; i < n; ++i) { - process(components[i]); - } - } - }, { - key: "addBond", - value: function addBond(left, right, order, type, fixed) { - var bond = new Bond(left, right, order, type, fixed); - - this._bonds.push(bond); - - return bond; - } - }, { - key: "getBondCount", - value: function getBondCount() { - return this._bonds.length; - } - }, { - key: "getResidueType", - value: function getResidueType(name) { - return this._residueTypes[name] || null; - } - }, { - key: "getUnifiedSerial", - value: function getUnifiedSerial(chain, serial, iCode) { - /* eslint-disable no-magic-numbers */ - var maxSerial = 65536; - var chainShift = maxSerial * 256; - /* eslint-enable no-magic-numbers */ - - return serial + iCode * maxSerial + chain * chainShift; - } - }, { - key: "splitUnifiedSerial", - value: function splitUnifiedSerial(uniSerial) { - /* eslint-disable no-magic-numbers */ - var maxSerial = 65536; - var chainShift = maxSerial * 256; - /* eslint-enable no-magic-numbers */ - - var chainId = Math.floor(uniSerial / chainShift); - var remnant = uniSerial - chainId * chainShift; - var insCode = Math.floor(remnant / maxSerial); - var ser = remnant - insCode * maxSerial; - return { - chain: chainId, - serial: ser, - iCode: insCode - }; - } - }, { - key: "_fillCmpEdit", - value: function _fillCmpEdit() { - var self = this; - var components = this._components; - - function addComp() { - var comp = new Component(self); - comp._index = components.length; - components[comp._index] = comp; - return comp; - } - - this.forEachChain(function (chain) { - var residues = chain._residues; - var resCount = residues.length; - - if (resCount < 1) { - return; - } - - var comp = addComp(); - var currStart = residues[0]._index; - - for (var i = 0; i < resCount; ++i) { - var currRes = residues[i]; - currRes._component = comp; - var nextRes = i === resCount - 1 ? null : residues[i + 1]; - - if (!nextRes || !currRes.isConnected(nextRes) || currRes._index !== nextRes._index - 1) { - // the last condition is broken and incorrect - // the refactoring of the Component is required in order to fix this issue - comp.setSubDivs([{ - start: currStart, - end: currRes._index - }]); - - if (nextRes) { - currStart = nextRes._index; - comp = addComp(); - } - } - } - }); - } // This function was added in the moment of despair - // It was the dark times for miew - - }, { - key: "_fillCmpNoedit", - value: function _fillCmpNoedit() { - var comp = new Component(this); - comp._index = 0; - var residues = this._residues; - var resCount = residues.length; - - if (resCount === 0) { - return; - } - - var currSubDivs = []; - var currStart = 0; - - for (var i = 0; i < resCount; ++i) { - var currRes = residues[i]; - currRes._component = comp; - var nextRes = i === resCount - 1 ? null : residues[i + 1]; - - if (!nextRes || !currRes.isConnected(nextRes)) { - // wrap up this interval - currSubDivs[currSubDivs.length] = { - start: currStart, - end: i - }; - - if (nextRes) { - currStart = i + 1; - } - } - } - - comp.setSubDivs(currSubDivs); - this._components[comp._index] = comp; - } - /** - * Fill components information. - * @param {boolean} enableEditing - Restructure Complex to enable per-component editing. - */ - - }, { - key: "_fillComponents", - value: function _fillComponents(enableEditing) { - if (enableEditing) { - this._fillCmpEdit(); - } else { - this._fillCmpNoedit(); - } - } - }, { - key: "getCurrentUnit", - value: function getCurrentUnit() { - return this._currentUnit; - } - }, { - key: "getDefaultBoundaries", - value: function getDefaultBoundaries() { - return this.units[0].getBoundaries(); - } - }, { - key: "getBoundaries", - value: function getBoundaries() { - return this.units[this._currentUnit].getBoundaries(); - } - }, { - key: "getTransforms", - value: function getTransforms() { - return this.units[this._currentUnit].getTransforms(); - } - }, { - key: "getSelector", - value: function getSelector() { - return this.units[this._currentUnit].getSelector(); - } - }, { - key: "resetCurrentUnit", - value: function resetCurrentUnit() { - this._currentUnit = 0; - this.setCurrentUnit(1); - } - }, { - key: "setCurrentUnit", - value: function setCurrentUnit(newUnit) { - if (newUnit !== null && newUnit !== undefined && newUnit !== this._currentUnit && newUnit >= 0 && newUnit < this.units.length) { - this._currentUnit = newUnit; - return true; - } - - return false; - } - }, { - key: "_computeBounds", - value: function _computeBounds() { - var units = this.units; - - for (var i = 0, n = units.length; i < n; ++i) { - units[i].computeBoundaries(); - } - } - }, { - key: "onAtomPositionChanged", - value: function onAtomPositionChanged() { - this.forEachChain(function (a) { - a._finalize(); - }); - this.forEachComponent(function (c) { - c.update(); - }); // Update bounding sphere and box - - this._computeBounds(); - - this._finalizeBonds(); - - this.forEachSGroup(function (s) { - s._rebuildSGroupOnAtomChange(); - }); - } - }, { - key: "update", - value: function update() { - if (this._maskNeedsUpdate) { - this.updateStructuresMask(); - this._maskNeedsUpdate = false; - } - } - }, { - key: "_finalizeBonds", - value: function _finalizeBonds() { - var bonds = this.getBonds(); - var n = bonds.length; - - for (var i = 0; i < n; ++i) { - bonds[i]._index = i; - } - } - /** - * Finalizes complex's inner data(i.e. after parsing). - * @param {objects} opts - Build bonds automatically. - * @param {boolean} opts.needAutoBonding - Build bonds automatically. - * @param {boolean} opts.detectAromaticLoops - Find/mark aromatic loops. - * @param {boolean} opts.enableEditing - Restructure Complex to enable per-component editing. - * @param {Array} [opts.serialAtomMap] - Array of atoms ordered by their serials. - */ - - }, { - key: "finalize", - value: function finalize(opts) { - opts = opts || {}; // Put bonds into atoms - - var bonds = this._bonds; - var i; - var n; // remove invalid bonds - - for (i = bonds.length - 1; i >= 0; i--) { - var bond = bonds[i]; - - if (bond._left === null || bond._right === null) { - bonds.splice(i, 1); - } else { - bond._left.bonds.push(bond); - - bond._right.bonds.push(bond); - } - } - - var residues = this._residues; - - for (i = 0, n = residues.length; i < n; ++i) { - residues[i]._finalize(); - } - - this.forEachChain(function (a) { - a._finalize(); - }); // WARNING! this MUST be done BEFORE computeBounds is called - - var units = this.units; - - for (i = 0, n = units.length; i < n; ++i) { - units[i].finalize(); - } // try setting first biomolecule by defaults - - - this.setCurrentUnit(1); - var residueHash = {}; - - for (i = 0, n = residues.length; i < n; ++i) { - var res = residues[i]; // This code is extremely dangerous for non-PDB formats - - residueHash[this.getUnifiedSerial(res.getChain().getName().charCodeAt(0), res.getSequence(), res.getICode().charCodeAt(0))] = res; - } - - var structures = this.structures; - - for (i = 0, n = structures.length; i < n; ++i) { - structures[i]._finalize(opts.serialAtomMap, residueHash, this); - } - - var helices = this._helices; - - for (i = 0, n = helices.length; i < n; ++i) { - helices[i]._finalize(opts.serialAtomMap, residueHash, this); - } - - var sheets = this._sheets; - - for (i = 0, n = sheets.length; i < n; ++i) { - sheets[i]._finalize(opts.serialAtomMap, residueHash, this); - } // Update bounding sphere and box - - - this._computeBounds(); - - var atoms = this._atoms; - - for (i = 0, n = atoms.length; i < n; ++i) { - var currAtom = atoms[i]; - currAtom.index = i; - } - - if (opts.needAutoBonding) { - var autoConnector = new AutoBond(this); - autoConnector.build(); - autoConnector.destroy(); - } - - var chains = this._chains; - - for (i = 0, n = chains.length; i < n; ++i) { - chains[i]._index = i; - } - - for (i = 0, n = residues.length; i < n; ++i) { - residues[i]._index = i; - } // mark non-polar hydrogens - - - for (i = 0, n = atoms.length; i < n; ++i) { - var atom = atoms[i]; - - if (atom.flags & Atom.Flags.HYDROGEN && atom.bonds.length === 1) { - var _bond = atom.bonds[0]; - var other = _bond._left !== atom && _bond._left || _bond._right; - - if (other.flags & Atom.Flags.CARBON) { - atom.flags |= Atom.Flags.NONPOLARH; - } - } - } - - this._finalizeBonds(); - - this._fillComponents(opts.enableEditing); - - var marker = new AromaticLoopsMarker(this); - marker.markCycles(); - - if (opts.detectAromaticLoops) { - // TODO remove this condition clause, it is for debug purposes only! - marker.detectCycles(); // TODO add conditional detection - } - - this._finalizeMolecules(); - } - }, { - key: "_finalizeMolecules", - value: function _finalizeMolecules() { - // add reference to molecule into residue - for (var i = 0; i < this._molecules.length; i++) { - var molecule = this._molecules[i]; - var count = molecule.residues.length; - - for (var j = 0; j < count; j++) { - var residue = molecule.residues[j]; - residue._molecule = molecule; - } - } - } - }, { - key: "updateStructuresMask", - value: function updateStructuresMask() { - var updater = function updater(structure) { - return structure.collectMask(); - }; - - this.forEachResidue(updater); - this.forEachChain(updater); - this.forEachMolecule(updater); - } - }, { - key: "countAtomsByMask", - value: function countAtomsByMask(mask) { - var count = 0; - this.forEachAtom(function (atom) { - if ((atom.mask & mask) !== 0) { - count++; - } - }); - return count; - } - }, { - key: "getNumAtomsBySelector", - value: function getNumAtomsBySelector(selector) { - var count = 0; - this.forEachAtom(function (atom) { - if (selector.includesAtom(atom)) { - count++; - } - }); - return count; - } - }, { - key: "resetAtomMask", - value: function resetAtomMask(mask) { - this.forEachAtom(function (atom) { - atom.mask = mask; - }); - } - }, { - key: "markAtoms", - value: function markAtoms(selector, mask) { - var setMask = mask; - var clearMask = ~setMask; - var count = 0; - var totalSelector = selectors.keyword('And')(selector, this.getSelector()); - this.forEachAtom(function (atom) { - if (totalSelector.includesAtom(atom)) { - atom.mask |= setMask; - count++; - } else { - atom.mask &= clearMask; - } - }); - this._maskNeedsUpdate = true; - return count; - } - }, { - key: "markAtomsAdditionally", - value: function markAtomsAdditionally(selector, mask) { - var setMask = mask; - var count = 0; - this.forEachAtom(function (atom) { - if (selector.includesAtom(atom) && (atom.mask & mask) !== mask) { - atom.mask |= setMask; - count++; - } - }); - return count; - } - }, { - key: "clearAtomBits", - value: function clearAtomBits(mask) { - var clearMask = ~mask; - this.forEachAtom(function (atom) { - atom.mask &= clearMask; - }); - - var reseter = function reseter(a) { - a._mask &= clearMask; - }; - - this.forEachAtom(reseter); - this.forEachResidue(reseter); - this.forEachChain(reseter); - this.forEachMolecule(reseter); - } - }, { - key: "getAtomNames", - value: function getAtomNames() { - if (this.hasOwnProperty('_atomNames')) { - return this._atomNames; - } - - var dict = {}; - this.forEachAtom(function (atom) { - dict[atom.name] = 1; - }); - this._atomNames = Object.keys(dict); - return this._atomNames; - } - }, { - key: "getElements", - value: function getElements() { - if (this.hasOwnProperty('_elements')) { - return this._elements; - } - - var dict = {}; - this.forEachAtom(function (atom) { - dict[atom.element.name] = 1; - }); - this._elements = Object.keys(dict); - return this._elements; - } - }, { - key: "getResidueNames", - value: function getResidueNames() { - if (this.hasOwnProperty('_residueNames')) { - return this._residueNames; - } - - var dict = {}; - this.forEachResidue(function (res) { - dict[res._type._name] = 1; - }); - this._residueNames = Object.keys(dict); - return this._residueNames; - } - }, { - key: "getChainNames", - value: function getChainNames() { - if (this.hasOwnProperty('_chainNames')) { - return this._chainNames; - } - - var dict = {}; - this.forEachChain(function (chain) { - dict[chain._name] = 1; - }); - this._chainNames = Object.keys(dict); - return this._chainNames; - } - }, { - key: "getAltLocNames", - value: function getAltLocNames() { - if (this.hasOwnProperty('_altlocNames')) { - return this._altlocNames; - } - - var dict = {}; - this.forEachAtom(function (atom) { - dict[String.fromCharCode(atom.location)] = 1; - }); - this._altlocNames = Object.keys(dict); - return this._altlocNames; - } - }, { - key: "getVoxelWorld", - value: function getVoxelWorld() { - if (!this.hasOwnProperty('_voxelWorld')) { - try { - this._voxelWorld = new VoxelWorld(this.getDefaultBoundaries().boundingBox, new THREE.Vector3(VOXEL_SIZE, VOXEL_SIZE, VOXEL_SIZE)); - - this._voxelWorld.addAtoms(this); - } catch (e) { - logger.warn('Unable to create voxel world'); - this._voxelWorld = null; - } - } - - return this._voxelWorld; - } - /** - * Simple function to make unified routine procedure without code duplication. - * @param {Array} srcArray - Source chemical structure array (will be part of resulting chemical structure array). - * @param {Array} dstArray - Resulting chemical structure array. - * @param {number} param - Parameter for processor. - * @param {function} functor - Processor for every element in array. - */ - - }, { - key: "addElement", - value: function addElement(srcArray, dstArray, param, functor) { - var length = srcArray.length; - - for (var i = 0; i < length; ++i) { - var elem = srcArray[i]; - functor(elem, param); - dstArray.push(elem); - } - } // this function joins multiple complexes into one (this) - // atom, bond, ... objects are reused -- so input complexes are no longer valid - - }, { - key: "joinComplexes", - value: function joinComplexes(complexes) { - // clear target complex - this._chains = []; - this._components = []; - this._helices = []; - this._sheets = []; - this.structures = []; - this._atoms = []; - this._residues = []; - this._bonds = []; - this._sgroups = []; - var self = this; - var atomBias = 0; - var bondBias = 0; - var residueBias = 0; - var chainBias = 0; - var componentBias = 0; - - function processAtom(atom, bias) { - atom.serial += bias; - atom.index += bias; - } - - function processBond(bond, bias) { - bond._index += bias; - } - - function processResidue(residue, bias) { - residue._index += bias; - } - - function processChain(chain, bias) { - chain._complex = self; - chain._index += bias; - } - - function processComponent(component, bias) { - component._complex = self; - component._index += bias; - } - /** - * Simple function to do nothing. - */ - - - function doNothing() {} - - for (var i = 0; i < complexes.length; ++i) { - var c = complexes[i]; - this.addElement(c._atoms, this._atoms, atomBias, processAtom); - this.addElement(c._bonds, this._bonds, bondBias, processBond); - this.addElement(c._residues, this._residues, residueBias, processResidue); - this.addElement(c._chains, this._chains, chainBias, processChain); - this.addElement(c._sheets, this._sheets, 0, doNothing); - this.addElement(c._helices, this._helices, 0, doNothing); - this.addElement(c._sgroups, this._sgroups, 0, doNothing); - this.addElement(c._components, this._components, componentBias, processComponent); - this.addElement(c.structures, this.structures, 0, doNothing); // merge residue types - - for (var rt in c._residueTypes) { - if (c._residueTypes.hasOwnProperty(rt)) { - this._residueTypes[rt] = c._residueTypes[rt]; - } - } - - atomBias += c._atoms.length; - bondBias += c._bonds.length; - residueBias += c._residues.length; - chainBias += c._chains.length; - componentBias += c._components.length; - } - - this._computeBounds(); - } - /** - * Replace secondary structure with calculated one. - * - * DSSP algorithm implementation is used. - * - * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and - * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211. - */ - - }, { - key: "dssp", - value: function dssp() { - var ssMap = new SecondaryStructureMap(this); - var structures = this.structures = []; - var helices = this._helices = []; - var sheets = this._sheets = []; - - var getSheet = function getSheet(index) { - var item = sheets[index]; - - if (!item) { - item = sheets[index] = new Sheet(String(index), 0); - } - - return item; - }; - - var lastCode; - var lastSheetIndex; - var lastHelixIndex = 0; - var curStructure = null; - - for (var i = 0, n = this._residues.length; i < n; ++i) { - var curCode = ssMap._ss[i]; - var curResidue = this._residues[i]; - var curSheetIndex = ssMap._sheet[i]; // expand the last structure - - if (curCode === lastCode && curSheetIndex === lastSheetIndex) { - curResidue._secondary = curStructure; - - if (curStructure) { - curStructure.term = curResidue; - } - - if (curStructure instanceof Helix) { - curStructure.length++; - } - - continue; - } // create a new structure - - - var helixClass = helixClassMap[curCode]; - var loopType = loopMap[curCode]; - - if (curCode === StructureType$1.STRAND) { - var curSheet = getSheet(curSheetIndex); - curStructure = new Strand(curSheet, curResidue, curResidue, 0, null, null); - curSheet.addStrand(curStructure); - } else if (helixClass !== undefined) { - lastHelixIndex++; - curStructure = new Helix(helixClass, curResidue, curResidue, lastHelixIndex, String(lastHelixIndex), '', 1); - helices.push(curStructure); - } else if (loopType !== undefined) { - curStructure = new StructuralElement(loopType, curResidue, curResidue); - } else { - curStructure = null; - } - - if (curStructure) { - structures.push(curStructure); - } - - curResidue._secondary = curStructure; - lastCode = curCode; - lastSheetIndex = curSheetIndex; - } - - this._sheets = sheets.filter(function (_sheet) { - return true; - }); // squeeze sheets array - } - }]); - - return Complex; - }(); - - Complex.prototype.id = 'Complex'; - Complex.prototype.name = ''; - - function pow2ceil(v) { - var p = 2; - v = v - 1 >> 1; - - while (v) { - p <<= 1; - v >>= 1; - } - - return p; - } - /** - * Volume constructor - * - * @param {Object} type - Float32Array, Int8Array, etc... - * @param {Object|Array} dimensions - number of data points on each axis (x, y, z) - * @param {Box3} box - bounding box defining data place in metric space, - * it's corners correspond to extreme data points - * @param {Number} vecSize - dimension of the field data point (1 = scalar, 3 = 3D vector) - * @param {Object} data - typed array of the same type as specified by the 1st parameter, - * layout: point by point along X, - * row by row along Y, - * plane by plane along Z - * @param {Number} volumeInfo - volume info values to define threshold to filter the noise - */ - - - var Volume = /*#__PURE__*/function () { - function Volume(type, dimensions, box, vecSize, data, volumeInfo) { - classCallCheck(this, Volume); - - this._box = box.clone(); - this._dimVec = Math.max(Math.floor(vecSize || 1), 1); - this._volumeInfo = volumeInfo; - - if (dimensions instanceof Array) { - var _dimensions = slicedToArray(dimensions, 3); - - this._dimX = _dimensions[0]; - this._dimY = _dimensions[1]; - this._dimZ = _dimensions[2]; - } else { - this._dimX = dimensions.x; - this._dimY = dimensions.y; - this._dimZ = dimensions.z; - } - - this._dimX = Math.max(Math.floor(this._dimX), 1); - this._dimY = Math.max(Math.floor(this._dimY), 1); - this._dimZ = Math.max(Math.floor(this._dimZ), 1); - this._rowElements = this._dimVec * this._dimX; - this._planeElements = this._rowElements * this._dimY; - this._totalElements = this._planeElements * this._dimZ; - this._data = data || utils.allocateTyped(type, this._totalElements); // override getter/setter for vector fields - - switch (this._dimVec) { - case 1: - break; - - case 2: - this.getValue = function (x, y, z) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - return [this._data[idx], this._data[idx + 1]]; - }; - - this.setValue = function (x, y, z, a, b) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - this._data[idx] = a; - this._data[idx + 1] = b; - }; - - this.addValue = function (x, y, z, a, b) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - this._data[idx] += a; - this._data[idx + 1] += b; - }; - - break; - - case 3: - this.getValue = function (x, y, z) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - return [this._data[idx], this._data[idx + 1], this._data[idx + 2]]; - }; - - this.setValue = function (x, y, z, a, b, c) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - this._data[idx] = a; - this._data[idx + 1] = b; - this._data[idx + 2] = c; - }; - - this.addValue = function (x, y, z, a, b, c) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - this._data[idx] += a; - this._data[idx + 1] += b; - this._data[idx + 2] += c; - }; - - break; - - default: - throw new Error('Volume: invalid vector dimension'); - } - } // default getter assumes it's a scalar field - - - createClass(Volume, [{ - key: "getValue", - value: function getValue(x, y, z) { - return this._data[x + y * this._rowElements + z * this._planeElements]; - } // default setter assumes it's a scalar field - - }, { - key: "setValue", - value: function setValue(x, y, z, val) { - this._data[x + y * this._rowElements + z * this._planeElements] = val; - } // default adder assumes it's a scalar field - - }, { - key: "addValue", - value: function addValue(x, y, z, val) { - this._data[x + y * this._rowElements + z * this._planeElements] += val; - } - }, { - key: "getDimensions", - value: function getDimensions() { - return [this._dimX, this._dimY, this._dimZ]; - } - }, { - key: "getBox", - value: function getBox() { - return this._box; - } - }, { - key: "getVolumeInfo", - value: function getVolumeInfo() { - return this._volumeInfo; - } - }, { - key: "getCellSize", - value: function getCellSize() { - var boxSize = new THREE.Vector3(); - - this._box.getSize(boxSize); - - var res = new THREE.Vector3(); - res.x = this._dimX > 1 ? boxSize.x / (this._dimX - 1) : 0; - res.y = this._dimY > 1 ? boxSize.y / (this._dimY - 1) : 0; - res.z = this._dimZ > 1 ? boxSize.z / (this._dimZ - 1) : 0; - return res; - } - }, { - key: "computeGradient", - value: function computeGradient() { - if (this._dimVec !== 1) { - // gradient can only be computed for scalar fields - return null; - } // create a 3D vector field of gradients - - - var gradient = new Volume(Float32Array, [this._dimX, this._dimY, this._dimZ], this._box, 3); // calculate cell side lengths - - var vl = this.getCellSize(); // gradient axis scaling values and averaging factors, to correctly - // calculate the gradient for volumes with irregular cell spacing - - var vs = new THREE.Vector3(-0.5 / vl.x, -0.5 / vl.y, -0.5 / vl.z); // TODO Check for intended bug in VMD (min is zero) - - function clamp(val, min, max) { - return Math.min(max, Math.max(min, val)); - } - - var xSize = this._dimX; - var ySize = this._dimY; - var zSize = this._dimZ; - var volMap = this._data; - - function _voxelValue(x, y, z) { - return volMap[z * xSize * ySize + y * xSize + x]; - } - - for (var zi = 0; zi < zSize; ++zi) { - var zm = clamp(zi - 1, 0, zSize - 1); - var zp = clamp(zi + 1, 0, zSize - 1); - - for (var yi = 0; yi < ySize; ++yi) { - var ym = clamp(yi - 1, 0, ySize - 1); - var yp = clamp(yi + 1, 0, ySize - 1); - - for (var xi = 0; xi < xSize; ++xi) { - var xm = clamp(xi - 1, 0, xSize - 1); - var xp = clamp(xi + 1, 0, xSize - 1); // Calculate the volume gradient at each grid cell. - // Gradients are now stored unnormalized, since we need them in pure - // form in order to draw field lines etc. Shading code will now have - // to do renormalization for itself on-the-fly. - // XXX this gradient is only correct for orthogonal grids, since - // we're using the array index offsets rather to calculate the gradient - // rather than voxel coordinate offsets. This will have to be - // re-worked for non-orthogonal datasets. - - gradient.setValue(xi, yi, zi, (_voxelValue(xp, yi, zi) - _voxelValue(xm, yi, zi)) * vs.x, (_voxelValue(xi, yp, zi) - _voxelValue(xi, ym, zi)) * vs.y, (_voxelValue(xi, yi, zp) - _voxelValue(xi, yi, zm)) * vs.z); - } - } - } - - return gradient; - } - }, { - key: "normalize", - value: function normalize() { - var data = this._data; // get min/max - - var min = data[0]; - var max = data[0]; - - for (var i = 1; i < data.length; ++i) { - min = Math.min(min, data[i]); - max = Math.max(max, data[i]); - } - - var d = 1.0 / (max - min); - - if (d === 0) { - return; - } // normalize - - - for (var _i = 0; _i < data.length; ++_i) { - data[_i] = d * (data[_i] - min); - } - } - }, { - key: "getTiledTextureStride", - value: function getTiledTextureStride() { - return [this._dimX + 2, this._dimY + 2]; - } - }, { - key: "buildTiledTexture", - value: function buildTiledTexture() { - var tilesX = Math.ceil(Math.sqrt(this._dimZ * this._dimY / this._dimX)); - var width = tilesX * (this._dimX + 2) - 1; - width = pow2ceil(width); - tilesX = Math.floor(width / (this._dimX + 2)); - var tilesY = Math.ceil(this._dimZ / tilesX); - var height = tilesY * (this._dimY + 2) - 1; - height = pow2ceil(height); - var data = new Uint8Array(width * height); - var src; - var dst; - - for (var tileRow = 0; tileRow < tilesY; ++tileRow) { - // process each pixel row of this tile row - for (var row = 0; row < this._dimY; ++row) { - src = tileRow * tilesX * this._planeElements + row * this._rowElements; - dst = width * (tileRow * (this._dimY + 2) + row); // copy a series of rows through several XY planes - - for (var t = 0; t < tilesX; ++t) { - // copy one row of one XY plane - for (var x = 0; x < this._dimX; ++x) { - data[dst++] = 255.0 * this._data[src++]; - } // repeat last pixel of previous tile - - - data[dst++] = 255.0 * this._data[src - 1]; - - if (t < tilesX - 1) { - // skip to the same row of next XY plane - src += this._planeElements - this._rowElements; // repeat first pixel of next tile - - data[dst++] = 255.0 * this._data[src]; - } - } - } - } // fill pixels between tile rows with copy of edge pixels - - - for (var _tileRow = 0; _tileRow < tilesY; ++_tileRow) { - // copy last pixel row of this tile row to the following pixel row of the texture - src = width * (_tileRow * (this._dimY + 2) + this._dimY - 1); - dst = src + width; - - for (var _x = 0; _x < width; ++_x) { - data[dst++] = data[src++]; - } - - if (_tileRow < tilesY - 1) { - // copy first pixel row of next tile row to the preceding pixel row of the texture - src = width * (_tileRow + 1) * (this._dimY + 2); - dst = src - width; - - for (var _x2 = 0; _x2 < width; ++_x2) { - data[dst++] = data[src++]; - } - } - } - - var texture = new THREE.DataTexture(data, width, height, THREE.LuminanceFormat, THREE.UnsignedByteType, THREE.UVMapping, THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping, THREE.LinearFilter, THREE.LinearFilter); - texture.needsUpdate = true; - return texture; - } - /* ******************************************************************************** - * - * Methods that provide direct access to internal array (for better performance) - * - ******************************************************************************** */ - - }, { - key: "getData", - value: function getData() { - return this._data; - } - }, { - key: "getDirectIdx", - value: function getDirectIdx(x, y, z) { - return x * this._dimVec + y * this._rowElements + z * this._planeElements; - } - }, { - key: "getStrideX", - value: function getStrideX() { - return this._dimVec; - } - }, { - key: "getStrideY", - value: function getStrideY() { - return this._rowElements; - } - }, { - key: "getStrideZ", - value: function getStrideZ() { - return this._planeElements; - } - }]); - - return Volume; - }(); - - Volume.prototype.id = 'Volume'; - - /** - * Residue Molecule. - * - * @param {Complex} complex - Molecular complex this Molecule belongs to. - * @param {String} name - Molecule's name. - * @param {Integer} index - Molecule's index in file. - * - * @exports Molecule - * @constructor - */ - var Molecule = /*#__PURE__*/function () { - function Molecule(complex, name, index) { - classCallCheck(this, Molecule); - - this.complex = complex; - this.name = name || ''; - this.residues = []; - this.mask = 1 | 0; - this.index = index || -1; // start with 1 - } - - createClass(Molecule, [{ - key: "forEachResidue", - value: function forEachResidue(process) { - var residues = this.residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - process(residues[i]); - } - } - }, { - key: "collectMask", - value: function collectMask() { - var mask = 0xffffffff; - var residues = this.residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - mask &= residues[i]._mask; - } - - this.mask = mask; - } - }]); - - return Molecule; - }(); - - var chem = { - Atom: Atom, - Element: Element, - Bond: Bond, - Residue: Residue, - ResidueType: ResidueType, - Chain: Chain, - Helix: Helix, - Strand: Strand, - Sheet: Sheet, - SGroup: SGroup, - Assembly: Assembly, - Complex: Complex, - Volume: Volume, - VoxelWorld: VoxelWorld, - selectors: selectors, - Molecule: Molecule - }; - - var CSS2DObject = /*#__PURE__*/function (_THREE$Object3D) { - inherits(CSS2DObject, _THREE$Object3D); - - function CSS2DObject(element) { - var _this; - - classCallCheck(this, CSS2DObject); - - _this = possibleConstructorReturn(this, getPrototypeOf(CSS2DObject).call(this)); - - var self = assertThisInitialized(_this); - - _this._element = element; - _this._element.style.position = 'absolute'; - - _this.addEventListener('removed', function () { - if (self._element.parentNode !== null) { - self._element.parentNode.removeChild(self._element); - } - }); - - return _this; - } - - createClass(CSS2DObject, [{ - key: "getElement", - value: function getElement() { - return this._element; - } - /** - * Sets label transparency. - * - * @param {number} transp - in [0; 1] 1 means fully transparent - */ - - }, { - key: "setTransparency", - value: function setTransparency(transp) { - var el = this.getElement(); - - if (el === null) { - return; - } - - if (transp === 1.0) { - el.style.display = 'none'; - return; - } - - el.style.display = 'inline'; - var op = 1.0 - transp; - var top = op.toString(); - var op100 = op * 100; - el.style.opacity = top; - el.style.filter = "alpha(opacity=".concat(op100, ")"); // IE fallback - } - }, { - key: "clone", - value: function clone() { - var obj = new CSS2DObject(this._element); - obj.copy(this); - return obj; - } - }]); - - return CSS2DObject; - }(THREE.Object3D); - - var RCGroup = /*#__PURE__*/function (_THREE$Group) { - inherits(RCGroup, _THREE$Group); - - function RCGroup() { - classCallCheck(this, RCGroup); - - return possibleConstructorReturn(this, getPrototypeOf(RCGroup).apply(this, arguments)); - } - - createClass(RCGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - if (!this.visible) { - return; - } - - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - children[i].raycast(raycaster, intersects); - } - } - }, { - key: "enableSubset", - value: function enableSubset(mask, innerOnly) { - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].enableSubset) { - children[i].enableSubset(mask, innerOnly); - } - } - } - }, { - key: "disableSubset", - value: function disableSubset(mask, innerOnly) { - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].disableSubset) { - children[i].disableSubset(mask, innerOnly); - } - } - } - }, { - key: "isEmpty", - value: function isEmpty() { - return this.children.length === 0; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].updateToFrame) { - children[i].updateToFrame(frameData); - } - } - } - }, { - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - Array.prototype.push.apply(totalSubset, children[i].getSubset(mask, innerOnly)); - } - } - - return totalSubset; - } - }]); - - return RCGroup; - }(THREE.Group); - - var vertexScreenQuadShader = "uniform mat4 projectionMatrix;\r\nuniform mat4 modelViewMatrix;\r\n\r\nattribute vec2 uv;\r\nattribute vec3 position;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vUv = uv;\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\r\n}\r\n"; - - var fragmentScreenQuadFromTex = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform float opacity;\r\n\r\nvoid main() {\r\n vec4 color = texture2D(srcTex, vUv);\r\n gl_FragColor = vec4(color.xyz, color.a * opacity);\r\n}\r\n"; - - var fragmentScreenQuadFromTexWithDistortion = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform float coef;\r\n\r\nvoid main() {\r\n vec2 uv = vUv * 2.0 - 1.0;\r\n float r2 = dot(uv, uv);\r\n vec2 tc = uv * (1.0 + coef * r2);\r\n if (!all(lessThan(abs(tc), vec2(1.0))))\r\n discard;\r\n tc = 0.5 * (tc + 1.0);\r\n gl_FragColor = texture2D(srcTex, tc);\r\n}\r\n"; - - var vertexShader = "float INSTANCED_SPRITE_OVERSCALE = 1.3;\r\n\r\nattribute vec3 normal;\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n varying vec3 viewNormal;\r\n#endif\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n varying vec3 vNormal;\r\n#endif\r\n\r\n#ifdef THICK_LINE\r\n attribute vec4 position; // W contains vert pos or neg offset\r\n#else\r\n attribute vec3 position;\r\n#endif\r\n\r\nvarying vec3 vWorldPosition;\r\nvarying vec3 vViewPosition;\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n attribute float alphaColor;\r\n varying float alphaCol;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n attribute vec3 color;\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n attribute vec3 color2;\r\n varying vec3 vColor2;\r\n attribute vec2 uv;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_POS\r\n attribute vec4 offset;\r\n #ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n varying vec4 spritePosEye;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n attribute vec4 matVector1;\r\n attribute vec4 matVector2;\r\n attribute vec4 matVector3;\r\n attribute vec4 invmatVector1;\r\n attribute vec4 invmatVector2;\r\n attribute vec4 invmatVector3;\r\n\r\n #ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n #endif\r\n#endif\r\n\r\nuniform mat4 modelViewMatrix; // optional\r\nuniform mat4 projectionMatrix; // optional\r\nuniform mat3 normalMatrix; // optional\r\nuniform mat4 modelMatrix; // optional\r\n\r\n#ifdef DASHED_LINE\r\n attribute float lineDistance;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n#ifdef THICK_LINE\r\n attribute vec3 direction;\r\n uniform mat4 projMatrixInv;\r\n uniform vec2 viewport;\r\n uniform float lineWidth;\r\n\r\n vec4 transform(vec4 coord){\r\n return projectionMatrix * modelViewMatrix * coord;\r\n }\r\n\r\n vec2 project(vec4 device){\r\n vec3 device_normal = device.xyz/device.w;\r\n vec2 clip_pos = (device_normal*0.5+0.5).xy;\r\n return clip_pos * viewport;\r\n }\r\n\r\n vec4 unproject(vec2 screen, float z, float w){\r\n vec2 clip_pos = screen/viewport;\r\n vec2 device_normal = clip_pos*2.0-1.0;\r\n return vec4(device_normal*w, z, w);\r\n }\r\n#endif\r\n\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n alphaCol = alphaColor;\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n vec3 objectNormal = vec3(\r\n dot(normal, matVector1.xyz),\r\n dot(normal, matVector2.xyz),\r\n dot(normal, matVector3.xyz));\r\n#else\r\n vec3 objectNormal = vec3( normal );\r\n#endif\r\n\r\nvec3 transformedNormal = normalMatrix * objectNormal;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n vNormal = normalize(transformedNormal);\r\n#endif\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n viewNormal = normalize(mat3(modelViewMatrix)*objectNormal);\r\n#endif\r\n\r\n vec4 localPos = vec4(position.xyz, 1.0);\r\n vec4 worldPos = modelMatrix * localPos;\r\n vec4 mvPosition = modelViewMatrix * localPos;\r\n\r\n// make thick line offset\r\n#ifdef THICK_LINE\r\n // get screen pos\r\n vec4 dPos = transform(vec4(position.xyz, 1.0));\r\n vec2 sPos = project(dPos);\r\n // move pos forward\r\n vec3 position2 = position.xyz + direction.xyz * 0.5;\r\n // get screen offset pos\r\n vec4 dPos2 = transform(vec4(position2.xyz, 1.0));\r\n vec2 sPos2 = project(dPos2);\r\n // screen line direction\r\n vec2 sDir = normalize(sPos2 - sPos);\r\n // vertex offset (orthogonal to line direction)\r\n vec2 offset1 = vec2(-sDir.y, sDir.x);\r\n // move screen vertex\r\n vec2 newPos = sPos + offset1 * position.w * lineWidth;\r\n // get moved pos in view space\r\n vec4 dNewPos = unproject(newPos, dPos.z, dPos.w);\r\n mvPosition.xyz = (projMatrixInv * dNewPos).xyz;\r\n#endif // THICK_LINE\r\n\r\n#ifdef INSTANCED_POS\r\n #ifdef SPHERE_SPRITE\r\n instOffset = offset;\r\n\r\n vec4 posEye = modelViewMatrix * vec4( offset.xyz, 1.0 );\r\n float scale = length(modelViewMatrix[0]);\r\n mvPosition = posEye + vec4( position.xyz * offset.w * scale * INSTANCED_SPRITE_OVERSCALE, 0.0 );\r\n posEye.w = offset.w * scale;\r\n\r\n spritePosEye = posEye;\r\n #else\r\n localPos = vec4( offset.xyz + position.xyz * offset.w, 1.0 );\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n #ifdef CYLINDER_SPRITE\r\n matVec1 = matVector1;\r\n matVec2 = matVector2;\r\n matVec3 = matVector3;\r\n invmatVec1 = invmatVector1;\r\n invmatVec2 = invmatVector2;\r\n invmatVec3 = invmatVector3;\r\n\r\n // calculate eye coords of cylinder endpoints\r\n vec4 v = vec4(0, -0.5, 0, 1);\r\n vec4 p1 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n v.y = 0.5;\r\n vec4 p2 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n\r\n // sprite is placed at the center of cylinder\r\n vec4 posEye;\r\n posEye.xyz = mix(p1.xyz, p2.xyz, 0.5);\r\n posEye.w = 1.0;\r\n\r\n // basic sprite size at screen plane (covers only cylinder axis)\r\n vec2 spriteSizeScreen = abs(p2.xy / p2.z - p1.xy / p1.z);\r\n\r\n // cylinder radius in eye space\r\n float rad = length(modelViewMatrix[0]) * length(vec3(matVector1.x, matVector2.x, matVector3.x));\r\n\r\n // full sprite size in eye coords\r\n float minZ = min(abs(p1.z), abs(p2.z));\r\n vec2 spriteSize = INSTANCED_SPRITE_OVERSCALE * abs(posEye.z) *\r\n (spriteSizeScreen + 2.0 * rad / minZ);\r\n\r\n mvPosition = posEye + vec4( position.xy * 0.5 * spriteSize, 0, 0 );\r\n #else\r\n localPos = vec4(dot(localPos, matVector1), dot(localPos, matVector2), dot(localPos, matVector3), 1.0);\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n gl_Position = projectionMatrix * mvPosition;\r\n\r\n vWorldPosition = worldPos.xyz;\r\n vViewPosition = - mvPosition.xyz;\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t vec4 worldPosition;\r\n\t // see THREE.WebGLProgram.unrollLoops\r\n\t #pragma unroll_loop\r\n\t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * vec4(vWorldPosition, 1.0);\r\n vDirectionalShadowNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(objectNormal, 0.0))).xyz;\r\n\t }\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n vColor = color.xyz;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n vColor2 = color2;\r\n #ifndef CYLINDER_SPRITE\r\n vUv = uv;\r\n #endif\r\n#endif\r\n\r\n#ifdef DASHED_LINE\r\n vLineDistance = lineDistance;\r\n#endif\r\n}\r\n"; - - var fragmentShader = "#if defined (NORMALS_TO_G_BUFFER)\r\n #define fragColor gl_FragData[0]\r\n#else\r\n #define fragColor gl_FragColor\r\n#endif\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n varying float alphaCol;\r\n#endif\r\n\r\n#ifdef COLOR_FROM_POS\r\n uniform mat4 world2colorMatrix;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n // We use 4 instead uniform variable or define because this value is used in for(... i < value; ...) with\r\n // unroll_loop and unroll_loop has pattern:\r\n // /#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g\r\n uniform vec2 samplesKernel[4]; // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n uniform sampler2D noiseTex;\r\n uniform vec2 noiseTexelSize;\r\n uniform vec2 srcTexelSize;\r\n uniform mat4 projectionMatrix;\r\n #endif\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n varying vec3 vColor2;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\nuniform vec3 diffuse;\r\nuniform vec3 emissive;\r\nuniform vec3 specular;\r\nuniform float shininess;\r\nuniform vec3 fixedColor;\r\nuniform float opacity;\r\nuniform float zClipValue;\r\nuniform float clipPlaneValue;\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n varying vec3 viewNormal;\r\n#endif\r\n\r\n#define PI 3.14159265359\r\n#define RECIPROCAL_PI 0.31830988618\r\n#define saturate(a) clamp( a, 0.0, 1.0 )\r\n\r\n#ifdef USE_FOG\r\n uniform vec3 fogColor;\r\n uniform float fogAlpha;\r\n uniform float fogNear;\r\n uniform float fogFar;\r\n#endif\r\n\r\nvarying vec3 vWorldPosition; // world position of the pixel (invalid when INSTANCED_SPRITE is defined)\r\nvarying vec3 vViewPosition;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n varying vec3 vNormal;\r\n#endif\r\n\r\n/////////////////////////////////////////// ZSprites ////////////////////////////////////////////////\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 spritePosEye;\r\n#endif\r\n\r\n#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n uniform float zOffset;\r\n uniform mat4 projectionMatrix;\r\n\r\n float calcDepthForSprites(vec4 pixelPosEye, float zOffset, mat4 projMatrix) {\r\n vec4 pixelPosScreen = projMatrix * pixelPosEye;\r\n return 0.5 * (pixelPosScreen.z / pixelPosScreen.w + 1.0) + zOffset;\r\n }\r\n#endif\r\n\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n float intersect_ray_sphere(in vec3 origin, in vec3 ray, out vec3 point) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray, ray);\r\n float b = dot(ray, origin);\r\n float c = dot(origin, origin) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return -1.0;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n // choose nearest point\r\n if (t1 >= 0.0) {\r\n point = p1;\r\n return t1;\r\n }\r\n if (t2 >= 0.0) {\r\n point = p2;\r\n return t2;\r\n }\r\n\r\n return -1.0;\r\n }\r\n\r\n float get_sphere_point(in vec3 pixelPosEye, out vec3 point) {\r\n // transform camera pos into sphere local coords\r\n vec4 v = invModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\r\n vec3 origin = (v.xyz - instOffset.xyz) / instOffset.w;\r\n\r\n // transform (camera -> pixel) ray into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye, 0.0);\r\n vec3 ray = normalize(v.xyz);\r\n\r\n return intersect_ray_sphere(origin, ray, point);\r\n }\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n float intersect_ray_cylinder(in vec3 origin, in vec3 ray, out vec3 point) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray.xz, ray.xz);\r\n float b = dot(ray.xz, origin.xz);\r\n float c = dot(origin.xz, origin.xz) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return -1.0;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n // choose nearest point\r\n float halfHeight = 0.5;\r\n if (t1 >= 0.0 && p1.y >= -halfHeight && p1.y <= halfHeight) {\r\n point = p1;\r\n return t1;\r\n }\r\n if (t2 >= 0.0 && p2.y >= -halfHeight && p2.y <= halfHeight) {\r\n point = p2;\r\n return t2;\r\n }\r\n\r\n return -1.0;\r\n }\r\n\r\n float get_cylinder_point(in vec3 pixelPosEye, out vec3 point) {\r\n // transform camera pos into cylinder local coords\r\n vec4 v = invModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\r\n vec3 origin = vec3(\r\n dot(v, invmatVec1),\r\n dot(v, invmatVec2),\r\n dot(v, invmatVec3));\r\n\r\n // transform (camera -> pixel) ray into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye, 0.0);\r\n vec3 ray = vec3(\r\n dot(v, invmatVec1),\r\n dot(v, invmatVec2),\r\n dot(v, invmatVec3));\r\n ray = normalize(ray);\r\n\r\n return intersect_ray_cylinder(origin, ray, point);\r\n }\r\n#endif\r\n\r\n///////////////////////////////////// Pack and unpack ///////////////////////////////////////////////\r\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\r\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\r\n\r\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\r\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\r\n\r\n\r\nconst float ShiftRight8 = 1. / 256.;\r\n\r\nvec4 packDepthToRGBA( const in float v ) {\r\n vec4 r = vec4( fract( v * PackFactors ), v );\r\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\r\n return r * PackUpscale;\r\n}\r\n\r\nfloat unpackRGBAToDepth( const in vec4 v ) {\r\n return dot( v, UnpackFactors );\r\n}\r\n\r\n////////////////////////////////////////// All Lighting /////////////////////////////////////////////////\r\n#ifdef TOON_SHADING\r\n #define LOW_TOON_BORDER 0.0\r\n #define MEDIUM_TOON_BORDER 0.7\r\n #define HIGH_TOON_BORDER 1.0\r\n\r\n #define MEDIUM_TOON_RANGE 0.5\r\n #define HIGH_TOON_RANGE 0.95\r\n#endif\r\n#if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n struct ReflectedLight {\r\n vec3 directDiffuse;\r\n vec3 directSpecular;\r\n vec3 indirectDiffuse;\r\n };\r\n\r\n struct BlinnPhongMaterial {\r\n vec3 diffuseColor;\r\n vec3 specularColor;\r\n float specularShininess;\r\n };\r\n\r\n struct GeometricContext {\r\n vec3 normal;\r\n vec3 viewDir;\r\n };\r\n\r\n struct DirectionalLight {\r\n vec3 direction;\r\n vec3 color;\r\n\r\n int shadow;\r\n vec2 shadowMapSize;\r\n float shadowBias;\r\n float shadowRadius;\r\n };\r\n\r\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\r\n uniform vec3 ambientLightColor;\r\n\r\n /////////////////////////////////////////// Shadowmap ////////////////////////////////////////////////\r\n\r\n #if defined(SHADOWMAP)\r\n \tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\r\n \t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\r\n \t}\r\n\r\n float getShadow( sampler2D shadowMap, DirectionalLight dirLight, vec4 shadowCoord, vec3 vViewPosition, vec3 vNormal ) {\r\n \t float shadow = 0.0;\r\n\r\n // When shadows for sprites will appear use here for them normals as it done for G-buffer\r\n shadowCoord.xyz += dirLight.shadowBias * vNormal;\r\n shadowCoord.xyz /= shadowCoord.w;\r\n\r\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\r\n bool inFrustum = all( inFrustumVec );\r\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\r\n bool frustumTest = all( frustumTestVec );\r\n\r\n if ( frustumTest ) {\r\n #ifdef SHADOWMAP_BASIC\r\n \t shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\r\n \t#endif\r\n\r\n \t#ifdef SHADOWMAP_PCF_SHARP\r\n \t vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n float dx0 = - texelSize.x * dirLight.shadowRadius;\r\n float dy0 = - texelSize.y * dirLight.shadowRadius;\r\n float dx1 = + texelSize.x * dirLight.shadowRadius;\r\n float dy1 = + texelSize.y * dirLight.shadowRadius;\r\n\r\n shadow = (\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\r\n ) * ( 1.0 / 9.0 );\r\n #endif\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n vec4 vUv = ((projectionMatrix * vec4(vViewPosition, 1.0)) + 1.0) / 2.0;\r\n vec2 vUvNoise = vUv.xy / srcTexelSize * noiseTexelSize;\r\n\r\n vec2 noiseVec = normalize(texture2D(noiseTex, vUvNoise).rg);\r\n mat2 mNoise = mat2(noiseVec.x, noiseVec.y, -noiseVec.y, noiseVec.x);\r\n\r\n vec2 offset;\r\n #pragma unroll_loop\r\n for ( int i = 0; i < 4; i ++ ) { // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n offset = mNoise * ( normalize( samplesKernel[ i ]) * texelSize * dirLight.shadowRadius );\r\n shadow += texture2DCompare( shadowMap, shadowCoord.xy + offset, shadowCoord.z );\r\n }\r\n shadow /= float( 4 ); // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n #endif\r\n }\r\n return shadow;//(shadow != 1.0) ? 0.5 : 1.0;//vec4(shadow, shadow, shadow, 1.0);\r\n }\r\n #endif\r\n\r\n /////////////////////////////////////////// Lighting /////////////////////////////////////////////////\r\n\r\n vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\r\n return RECIPROCAL_PI * diffuseColor;\r\n } // validated\r\n\r\n vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\r\n // Original approximation by Christophe Schlick '94\r\n //;float fresnel = pow( 1.0 - dotLH, 5.0 );\r\n // Optimized variant (presented by Epic at SIGGRAPH '13)\r\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\r\n return ( 1.0 - specularColor ) * fresnel + specularColor;\r\n } // validated\r\n\r\n float G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\r\n // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\r\n return 0.25;\r\n }\r\n\r\n float D_BlinnPhong( const in float shininess, const in float dotNH ) {\r\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\r\n }\r\n\r\n vec3 BRDF_Specular_BlinnPhong( const in DirectionalLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\r\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\r\n float dotNH = saturate(dot( geometry.normal, halfDir ));\r\n float dotLH = saturate(dot( incidentLight.direction, halfDir ));\r\n\r\n vec3 F = F_Schlick( specularColor, dotLH );\r\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\r\n float D = D_BlinnPhong( shininess, dotNH );\r\n\r\n return F * ( G * D );\r\n } // validated\r\n\r\n void RE_Direct_BlinnPhong( const in DirectionalLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight, float penumbra ) {\r\n\r\n float dotNL = saturate( dot( geometry.normal, directLight.direction ));\r\n #ifdef TOON_SHADING\r\n if(dotNL < MEDIUM_TOON_RANGE){\r\n dotNL = LOW_TOON_BORDER;\r\n }\r\n else if(dotNL < HIGH_TOON_RANGE){\r\n dotNL = MEDIUM_TOON_BORDER;\r\n }\r\n else{\r\n dotNL = HIGH_TOON_BORDER;\r\n }\r\n #endif\r\n\r\n vec3 irradiance = dotNL * directLight.color * PI;\r\n reflectedLight.directDiffuse += penumbra * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n reflectedLight.directSpecular += penumbra * irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess );\r\n }\r\n\r\n void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\r\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n }\r\n\r\n vec3 calcLighting(const in GeometricContext geometry, const in BlinnPhongMaterial material, vec3 vViewPosition) {\r\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\r\n vec3 irradiance = ambientLightColor * PI;\r\n\r\n float shadowMask = 1.0;\r\n // see THREE.WebGLProgram.unrollLoops\r\n \t#pragma unroll_loop\r\n \t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n \t #ifdef SHADOWMAP\r\n \t if ( directionalLights[ i ].shadow > 0 ) shadowMask = getShadow( directionalShadowMap[ i ], directionalLights[ i ], vDirectionalShadowCoord[ i ], vViewPosition, vDirectionalShadowNormal[ i ] );\r\n \t #endif\r\n\r\n \t\t if ( shadowMask > 0.0 ) RE_Direct_BlinnPhong( directionalLights[ i ], geometry, material, reflectedLight, shadowMask );\r\n \t\t}\r\n\r\n RE_IndirectDiffuse_BlinnPhong(irradiance, material, reflectedLight);\r\n\r\n return saturate(reflectedLight.indirectDiffuse + reflectedLight.directDiffuse + reflectedLight.directSpecular);\r\n }\r\n#endif\r\n\r\n/////////////////////////////////////////// Dashed Line ///////////////////////////////////////////////\r\n#ifdef DASHED_LINE\r\n uniform float dashedLineSize;\r\n uniform float dashedLinePeriod;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef CLIP_PLANE\r\n if (vViewPosition.z < clipPlaneValue) discard;\r\n#endif\r\n\r\n#ifdef ZCLIP\r\n if (vViewPosition.z < zClipValue) discard;\r\n#endif\r\n\r\n vec4 pixelPosWorld = vec4(vWorldPosition, 1.0);\r\n vec4 pixelPosEye;\r\n\r\n#ifdef SPHERE_SPRITE\r\n\r\n vec3 viewNormalSprites;\r\n vec3 normal;\r\n\r\n/* quick-and-dirty method\r\n normal.xy = ' + INSTANCED_SPRITE_OVERSCALE + ' * (2.0 * vUv - 1.0);\r\n float r2 = dot(normal.xy, normal.xy);\r\n if (r2 > 1.0) discard;\r\n float normalZ = sqrt(1.0 - r2);\r\n normal.z = normalZ;\r\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\r\n pixelPosEye = vec4(spritePosEye.xyz, 1.0);\r\n pixelPosEye.z += spritePosEye.w * normalZ;\r\n*/\r\n\r\n // ray-trace sphere surface\r\n {\r\n vec3 p;\r\n if (get_sphere_point(-vViewPosition, p) < 0.0) discard;\r\n pixelPosWorld = modelMatrix * vec4(instOffset.xyz + p * instOffset.w, 1.0);\r\n // pixelPosEye = modelViewMatrix * vec4(instOffset.xyz + p * instOffset.w, 1.0);\r\n pixelPosEye = vec4(spritePosEye.xyz, 1.0);\r\n pixelPosEye.z += instOffset.w *\r\n (modelViewMatrix[0][2] * p.x +\r\n modelViewMatrix[1][2] * p.y +\r\n modelViewMatrix[2][2] * p.z);\r\n normal = normalize(normalMatrix * p);\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*p);\r\n #endif\r\n }\r\n\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n vec3 normal;\r\n vec3 viewNormalSprites;\r\n float cylinderY = 0.0;\r\n\r\n // ray-trace cylinder surface\r\n {\r\n vec3 p;\r\n if (get_cylinder_point(-vViewPosition, p) < 0.0) discard;\r\n\r\n cylinderY = 0.5 * (p.y + 1.0);\r\n\r\n vec4 v = vec4(p, 1.0);\r\n v = vec4(dot(v, matVec1), dot(v, matVec2), dot(v, matVec3), 1.0);\r\n pixelPosWorld = modelMatrix * v;\r\n pixelPosEye = modelViewMatrix * v;\r\n\r\n vec3 localNormal = normalize(vec3(p.x, 0.0, p.z));\r\n normal = vec3(\r\n dot(localNormal, matVec1.xyz),\r\n dot(localNormal, matVec2.xyz),\r\n dot(localNormal, matVec3.xyz));\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*normal);\r\n #endif\r\n normal = normalize(normalMatrix * normal);\r\n }\r\n#endif\r\n\r\n #ifdef ATTR_COLOR\r\n vec3 vertexColor = vColor;\r\n #else\r\n vec3 vertexColor = vec3(1.0, 1.0, 1.0);\r\n #endif\r\n\r\n #ifdef ATTR_COLOR2\r\n #ifdef CYLINDER_SPRITE\r\n float colorCoef = cylinderY; // cylinder parameter is calculated from ray-tracing\r\n #else\r\n float colorCoef = vUv.y; // cylinder parameter is interpolated as tex coord\r\n #endif\r\n // choose either color or color2\r\n vertexColor = mix(vColor2, vColor, step(0.5, colorCoef));\r\n #endif\r\n\r\n // negative red component is a special condition\r\n if (vertexColor.x < 0.0) discard;\r\n\r\n #ifdef DASHED_LINE\r\n if ( mod( vLineDistance, dashedLinePeriod ) > dashedLineSize ) discard;\r\n #endif\r\n\r\n // transparency prepass writes only z, so we don't need to calc the color\r\n #ifdef PREPASS_TRANSP\r\n fragColor = vec4(1.0, 1.0, 1.0, 1.0);\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n return;\r\n #endif\r\n\r\n float totalOpacity = opacity;\r\n\r\n #ifdef ATTR_ALPHA_COLOR\r\n totalOpacity *= alphaCol;\r\n #endif\r\n\r\n // discard fully transparent pixels\r\n if (totalOpacity == 0.0) discard;\r\n\r\n #ifdef FAKE_OPACITY\r\n // discard pixels in checker pattern\r\n vec2 dm_coord = floor(gl_FragCoord.xy);\r\n dm_coord = fract(dm_coord * 0.5);\r\n if (totalOpacity < 1.0 && (dm_coord.x < 0.5 ^^ dm_coord.y < 0.5)) discard;\r\n vec4 diffuseColor = vec4(diffuse, 1.0);\r\n #else\r\n vec4 diffuseColor = vec4(diffuse, totalOpacity);\r\n #endif\r\n\r\n float flipNormal;\r\n #if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n flipNormal = 1.0;\r\n #ifdef DOUBLE_SIDED\r\n flipNormal = float( gl_FrontFacing );\r\n #endif\r\n vec3 normal = normalize( vNormal ) * flipNormal;\r\n #endif\r\n\r\n diffuseColor.rgb *= vertexColor;\r\n\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n\r\n #ifdef NORMALS_TO_G_BUFFER\r\n #if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r\n vec3 viewNormaInColor = viewNormalSprites;\r\n float frontFaced = 1.0;\r\n #else\r\n vec3 viewNormaInColor = viewNormal;\r\n float frontFaced = float( gl_FrontFacing );\r\n #endif\r\n // [-1, 1] -> [0, 1]\r\n viewNormaInColor = 0.5 * viewNormaInColor + 0.5;\r\n gl_FragData[1] = vec4(viewNormaInColor, frontFaced);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n GeometricContext geometry = GeometricContext(normal, normalize( vViewPosition ));\r\n BlinnPhongMaterial material = BlinnPhongMaterial(diffuseColor.rgb, specular, shininess);\r\n vec3 outgoingLight = calcLighting(geometry, material, vViewPosition);\r\n #else\r\n vec3 outgoingLight = diffuseColor.rgb;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_DEPTH\r\n float depth = 0.0;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n depth = gl_FragDepthEXT;\r\n #else\r\n depth = gl_FragCoord.z;\r\n #endif\r\n fragColor = packDepthToRGBA(depth);\r\n return;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_POS\r\n fragColor = world2colorMatrix * pixelPosWorld;\r\n #else\r\n #ifdef OVERRIDE_COLOR\r\n fragColor = vec4(fixedColor, diffuseColor.a);\r\n #else\r\n fragColor = vec4(outgoingLight, diffuseColor.a);//vec4(vNormal, 1.0);\r\n #endif\r\n\r\n #ifdef USE_FOG\r\n float viewDistance;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n viewDistance = abs(pixelPosEye.z);\r\n #else\r\n viewDistance = vViewPosition.z;\r\n #endif\r\n float fogFactor = smoothstep( fogNear, fogFar, viewDistance) * fogAlpha;\r\n #ifdef FOG_TRANSPARENT\r\n fragColor.a = fragColor.a * (1.0 - fogFactor);\r\n #else\r\n fragColor.rgb = mix( fragColor.rgb, fogColor, fogFactor );\r\n #endif\r\n #endif\r\n\r\n #endif\r\n}\r\n"; - - var capabilities = { - precision: 'mediump', - - /** - * - * @param {THREE.WebGLRenderer} renderer - */ - init: function init(renderer) { - this.precision = renderer.capabilities.getMaxPrecision('highp'); - } - }; - - var noiseWidth = 4; - var noiseHeight = 4; - - var _noiseData = new Uint8Array([24, 52, 0, 254, 145, 0, 122, 0, 0, 7, 170, 0, 34, 214, 0, 173, 8, 0, 86, 249, 0, 160, 4, 0, 226, 46, 0, 224, 211, 0, 3, 157, 0, 174, 247, 0, 12, 182, 0, 220, 216, 0, 1, 109, 0, 253, 154, 0]); - - var _noiseWrapS = THREE.RepeatWrapping; - var _noiseWrapT = THREE.RepeatWrapping; - var _noiseMinFilter = THREE.NearestFilter; - var _noiseMagFilter = THREE.NearestFilter; - var _noiseMapping = THREE.UVMapping; - var noiseTexture = new THREE.DataTexture(_noiseData, noiseWidth, noiseHeight, THREE.RGBFormat, THREE.UnsignedByteType, _noiseMapping, _noiseWrapS, _noiseWrapT, _noiseMagFilter, _noiseMinFilter, 1); - noiseTexture.needsUpdate = true; - var noise = { - noiseWidth: noiseWidth, - noiseHeight: noiseHeight, - noiseTexture: noiseTexture - }; - - function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - // If you want to change length of _samplesKernel, please, remember change it in Uber.frag too. - // You can easy find places for replace using word:_samplesKernel - - var _samplesKernel = [new THREE.Vector2(-0.541978, 0.840393), new THREE.Vector2(0.125533, -0.992089), new THREE.Vector2(0.374329, 0.927296), new THREE.Vector2(-0.105475, 0.994422)]; - var defaultUniforms = THREE.UniformsUtils.merge([THREE.UniformsLib.fog, THREE.UniformsLib.lights, { - // are updated automatically by three.js (see THREE.ShaderLib.common) - diffuse: { - value: new THREE.Color(0xeeeeee) - }, - opacity: { - value: 1.0 - }, - specular: { - type: 'c', - value: new THREE.Color(0x111111) - }, - shininess: { - type: 'f', - value: 30 - }, - fixedColor: { - type: 'c', - value: new THREE.Color(0xffffff) - }, - zOffset: { - type: 'f', - value: 0.0 - }, - zClipValue: { - type: 'f', - value: 0.0 - }, - clipPlaneValue: { - type: 'f', - value: 0.0 - }, - invModelViewMatrix: { - type: '4fv', - value: new THREE.Matrix4() - }, - world2colorMatrix: { - type: '4fv', - value: new THREE.Matrix4() - }, - dashedLineSize: { - type: 'f', - value: 0.1 - }, - dashedLinePeriod: { - type: 'f', - value: 0.2 - }, - projMatrixInv: { - type: '4fv', - value: new THREE.Matrix4() - }, - viewport: { - type: 'v2', - value: new THREE.Vector2() - }, - lineWidth: { - type: 'f', - value: 2.0 - }, - // default value must be the same as settings - fogAlpha: { - type: 'f', - value: 1.0 - }, - samplesKernel: { - type: 'v2v', - value: null - }, - noiseTex: { - type: 't', - value: null - }, - noiseTexelSize: { - type: 'v2', - value: null - }, - srcTexelSize: { - type: 'v2', - value: null - } - }]); - var uberOptionNames = ['shininess', 'opacity', 'zOffset', 'diffuse', 'specular', 'fixedColor', 'zClipCoef', 'zClipValue', 'clipPlaneValue', 'world2colorMatrix', 'dashedLineSize', 'dashedLinePeriod', 'projMatrixInv', 'viewport', 'lineWidth', 'fogAlpha', 'samplesKernel', 'noiseTex', 'noiseTexelSize', 'srcTexelSize']; - - function UberMaterial(params) { - THREE.RawShaderMaterial.call(this); // add fog - - this.fog = true; // used for instanced geometry - - this.instancedPos = false; - this.instancedMatrix = false; // atoms and links color - - this.attrColor = false; // second link color for cylinders - - this.attrColor2 = false; // - - this.attrAlphaColor = false; // overrides color for all vertices (used in selection) - - this.overrideColor = false; // zsrpites - - this.sphereSprite = false; - this.cylinderSprite = false; // clip Surfs individually - - this.zClip = false; // clip scene with global clip plane - - this.clipPlane = false; // enable fake (chess-like) opacity - - this.fakeOpacity = false; // render only depth, don't take care about the pixel color (used for transparency depth prepass) - - this.prepassTransparancy = false; // used to render pixel positions - - this.colorFromPos = false; // used to render shadowmap - - this.shadowmap = false; // used to describe shadowmap type - - this.shadowmapType = 'random'; // used to render pixel view deph - - this.colorFromDepth = false; // used to render dashed line - - this.dashedLine = false; // mark as transparent - - this.transparent = true; // mark as thick lines - - this.thickLine = false; // makes fog begin transparency (required for transparent background) - - this.fogTransparent = false; // used to render surface normals to G buffer for ssao effect - - this.normalsToGBuffer = false; // used for toon material - - this.toonShading = false; // uber options of "root" materials are inherited from single uber-options object that resides in prototype - - this.uberOptions = Object.create(UberMaterial.prototype.uberOptions); // set default values - - THREE.RawShaderMaterial.prototype.setValues.call(this, { - uniforms: THREE.UniformsUtils.clone(defaultUniforms), - vertexShader: this.precisionString() + vertexShader, - fragmentShader: this.precisionString() + fragmentShader, - lights: true, - fog: true, - side: THREE.DoubleSide - }); - this.setValues(params); - } - - UberMaterial.prototype = Object.create(THREE.RawShaderMaterial.prototype); - UberMaterial.prototype.constructor = UberMaterial; - - UberMaterial.prototype.precisionString = function () { - var precision = capabilities.precision; - var str = "precision ".concat(precision, " float;\n") + "precision ".concat(precision, " int;\n\n"); - return str; - }; // properties that convert to uniforms - - - UberMaterial.prototype.uberOptions = { - diffuse: new THREE.Color(0xffffff), - // used in phong lighting - specular: new THREE.Color(0x111111), - // used in phong lighting - shininess: 30, - // used in phong lighting - opacity: 1, - // set mesh opacity - fixedColor: new THREE.Color(0xffffff), - // color to override (see OVERRIDE_COLOR) - zOffset: 0.0, - // used fo zsprites (see SPHERE_SPRITE CYLINDER_SPRITE) - zClipCoef: 2.0, - // use for Surfs clipping (mesh param, isn't used in shader) FIXME move to representation param - zClipValue: 0.0, - // value to clip Surfs in shader (see ZCLIP) - clipPlaneValue: 0.0, - // value to clip scene globally (see CLIPPLANE) - world2colorMatrix: new THREE.Matrix4(), - dashedLineSize: 0.1, - dashedLinePeriod: 0.3, - projMatrixInv: new THREE.Matrix4(), - viewport: new THREE.Vector2(800, 600), - lineWidth: 2.0, - fogAlpha: 1.0, - samplesKernel: _samplesKernel, - noiseTex: noise.noiseTexture, - noiseTexelSize: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight), - srcTexelSize: new THREE.Vector2(1.0 / 800.0, 1.0 / 600.0), - copy: function copy(source) { - this.diffuse.copy(source.diffuse); - this.specular.copy(source.specular); - this.shininess = source.shininess; - this.opacity = source.opacity; - this.fixedColor.copy(source.fixedColor); - this.zOffset = source.zOffset; - this.zClipCoef = source.zClipCoef; - this.zClipValue = source.zClipValue; - this.clipPlaneValue = source.clipPlaneValue; - this.world2colorMatrix.copy(source.world2colorMatrix); - this.dashedLineSize = source.dashedLineSize; - this.dashedLinePeriod = source.dashedLinePeriod; - this.projMatrixInv = source.projMatrixInv; - this.viewport = source.viewport; - this.lineWidth = source.lineWidth; // used for thick lines only - - this.toonShading = source.toonShading; - this.fogAlpha = source.fogAlpha; - this.samplesKernel = source.samplesKernel; - this.noiseTex = source.noiseTex; - this.noiseTexelSize = source.noiseTexelSize; - this.srcTexelSize = source.srcTexelSize; - } - }; - - UberMaterial.prototype.copy = function (source) { - THREE.RawShaderMaterial.prototype.copy.call(this, source); - this.fragmentShader = source.fragmentShader; - this.vertexShader = source.vertexShader; - this.uniforms = THREE.UniformsUtils.clone(source.uniforms); - this.defines = _objectSpread({}, source.defines); - this.extensions = source.extensions; - this.fog = source.fog; - this.instancedPos = source.instancedPos; - this.instancedMatrix = source.instancedMatrix; - this.attrColor = source.attrColor; - this.attrColor2 = source.attrColor2; - this.attrAlphaColor = source.attrAlphaColor; - this.overrideColor = source.overrideColor; - this.sphereSprite = source.sphereSprite; - this.cylinderSprite = source.cylinderSprite; - this.zClip = source.zClip; - this.clipPlane = source.clipPlane; - this.fakeOpacity = source.fakeOpacity; - this.colorFromPos = source.colorFromPos; - this.shadowmap = source.shadowmap; - this.shadowmapType = source.shadowmapType; - this.colorFromDepth = source.colorFromDepth; - this.prepassTransparancy = source.prepassTransparancy; - this.dashedLine = source.dashedLine; - this.thickLine = source.thickLine; - this.fogTransparent = source.fogTransparent; - this.normalsToGBuffer = source.normalsToGBuffer; - this.toonShading = source.toonShading; - this.uberOptions.copy(source.uberOptions); - return this; - }; // create copy of this material - // its options are prototyped after this material's options - - - UberMaterial.prototype.createInstance = function () { - var inst = new UberMaterial(); - inst.copy(this); - inst.uberOptions = Object.create(this.uberOptions); - return inst; - }; - - UberMaterial.prototype.setValues = function (values) { - if (typeof values === 'undefined') { - return; - } // set direct values - - - THREE.RawShaderMaterial.prototype.setValues.call(this, values); - var defines = {}; - var extensions = {}; - - if (this.fog) { - defines.USE_FOG = 1; - } - - if (this.instancedPos) { - defines.INSTANCED_POS = 1; - } - - if (this.instancedMatrix) { - defines.INSTANCED_MATRIX = 1; - } - - if (this.attrColor) { - defines.ATTR_COLOR = 1; - } - - if (this.attrColor2) { - defines.ATTR_COLOR2 = 1; - } - - if (this.attrAlphaColor) { - defines.ATTR_ALPHA_COLOR = 1; - } - - if (this.overrideColor) { - defines.OVERRIDE_COLOR = 1; - } - - if (this.sphereSprite) { - defines.SPHERE_SPRITE = 1; - extensions.fragDepth = 1; - } - - if (this.cylinderSprite) { - defines.CYLINDER_SPRITE = 1; - extensions.fragDepth = 1; - } - - if (this.zClip) { - defines.ZCLIP = 1; - } - - if (this.clipPlane) { - defines.CLIP_PLANE = 1; - } - - if (this.fakeOpacity) { - defines.FAKE_OPACITY = 1; - } - - if (this.lights) { - defines.USE_LIGHTS = 1; - } - - if (this.colorFromPos) { - defines.COLOR_FROM_POS = 1; - } - - if (this.shadowmap) { - defines.SHADOWMAP = 1; - - if (this.shadowmapType === 'pcf') { - defines.SHADOWMAP_PCF_SHARP = 1; - } else if (this.shadowmapType === 'random') { - defines.SHADOWMAP_PCF_RAND = 1; - } else { - defines.SHADOWMAP_BASIC = 1; - } - } - - if (this.colorFromDepth) { - defines.COLOR_FROM_DEPTH = 1; - } - - if (this.prepassTransparancy) { - defines.PREPASS_TRANSP = 1; - } - - if (this.dashedLine) { - defines.DASHED_LINE = 1; - } - - if (this.thickLine) { - defines.THICK_LINE = 1; - } - - if (this.fogTransparent) { - defines.FOG_TRANSPARENT = 1; - } - - if (this.normalsToGBuffer) { - extensions.drawBuffers = 1; - defines.NORMALS_TO_G_BUFFER = 1; - } - - if (this.toonShading) { - defines.TOON_SHADING = 1; - } // set dependent values - - - this.defines = defines; - this.extensions = extensions; - }; - - UberMaterial.prototype.setUberOptions = function (values) { - if (typeof values === 'undefined') { - return; - } - - for (var key in values) { - if (!values.hasOwnProperty(key)) { - continue; - } - - if (this.uberOptions[key] instanceof THREE.Color) { - this.uberOptions[key] = values[key].clone(); - } else { - this.uberOptions[key] = values[key]; - } - } - }; - - UberMaterial.prototype.clone = function (shallow) { - if (!shallow) { - return THREE.Material.prototype.clone.call(this); - } - - return this.createInstance(); - }; - - UberMaterial.prototype.updateUniforms = function () { - var self = this; - uberOptionNames.forEach(function (p) { - if (self.uniforms.hasOwnProperty(p)) { - if (self.uberOptions[p] instanceof THREE.Color || self.uberOptions[p] instanceof THREE.Matrix4) { - self.uniforms[p].value = self.uberOptions[p].clone(); - } else { - self.uniforms[p].value = self.uberOptions[p]; - } - } - }); - }; - - var LAYERS = { - DEFAULT: 0, - VOLUME: 1, - TRANSPARENT: 2, - PREPASS_TRANSPARENT: 3, - VOLUME_BFPLANE: 4, - COLOR_FROM_POSITION: 5, - SHADOWMAP: 6 - }; - var SELECTION_LAYERS = [// These layers, that are used in the selection by ray casting - LAYERS.DEFAULT, LAYERS.TRANSPARENT]; - - THREE.Object3D.prototype.resetTransform = function () { - this.position.set(0, 0, 0); - this.quaternion.set(0, 0, 0, 1); - this.scale.set(1, 1, 1); - }; // update world matrix of this object and all its ancestors - - - THREE.Object3D.prototype.updateMatrixWorldRecursive = function () { - if (this.parent != null) { - this.parent.updateMatrixWorldRecursive(); - } - - this.updateMatrixWorld(); - }; // add object to parent, saving objects' world transform - - - THREE.Object3D.prototype.addSavingWorldTransform = function () { - var _worldMatrixInverse = new THREE.Matrix4(); - - return function (object) { - if (object instanceof THREE.Object3D) { - _worldMatrixInverse.getInverse(this.matrixWorld); - - _worldMatrixInverse.multiply(object.matrixWorld); - - object.matrix.copy(_worldMatrixInverse); - object.matrix.decompose(object.position, object.quaternion, object.scale); - this.add(object); - } - }; - }(); // render a tiny transparent quad in the center of the screen - - - THREE.WebGLRenderer.prototype.renderDummyQuad = function () { - var _material = new THREE.MeshBasicMaterial({ - transparent: true, - opacity: 0.0, - depthWrite: false - }); - - var _scene = new THREE.Scene(); - - var _quad = new THREE.Mesh(new THREE.PlaneBufferGeometry(0.01, 0.01), _material); - - _scene.add(_quad); - - var _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000); - - _camera.position.z = 100; - return function () { - this.render(_scene, _camera); - }; - }(); - - THREE.WebGLRenderer.prototype.renderScreenQuad = function () { - var _scene = new THREE.Scene(); - - var _quad = new THREE.Mesh(new THREE.PlaneBufferGeometry(1.0, 1.0)); - - _scene.add(_quad); - - var _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000); - - _camera.position.z = 100; - return function (material) { - _quad.material = material; - this.render(_scene, _camera); - }; - }(); - - THREE.Matrix4.prototype.isIdentity = function () { - var identity = new THREE.Matrix4(); - return function () { - return identity.equals(this); - }; - }(); - - THREE.Matrix4.prototype.applyToPointsArray = function (array, stride, w) { - if (!array || !stride || stride < 3) { - return array; - } - - w = w || 0; // use point as normal by default - - var e = this.elements; - - for (var i = 0; i < array.length; i += stride) { - var x = array[i]; - var y = array[i + 1]; - var z = array[i + 2]; - var persp = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]); - array[i] = (e[0] * x + e[4] * y + e[8] * z + e[12] * w) * persp; - array[i + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13] * w) * persp; - array[i + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14] * w) * persp; - } - - return array; - }; - - var ScreenQuadMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(ScreenQuadMaterial, _THREE$RawShaderMater); - - function ScreenQuadMaterial(params) { - classCallCheck(this, ScreenQuadMaterial); - - if (params.uniforms === undefined) { - params.uniforms = {}; - } - - params.uniforms.srcTex = { - type: 't', - value: null - }; - params.vertexShader = vertexScreenQuadShader; - params.transparent = false; - params.depthTest = false; - params.depthWrite = false; - return possibleConstructorReturn(this, getPrototypeOf(ScreenQuadMaterial).call(this, params)); - } - - return ScreenQuadMaterial; - }(THREE.RawShaderMaterial); - - THREE.WebGLRenderer.prototype.renderScreenQuadFromTex = function () { - var _material = new ScreenQuadMaterial({ - uniforms: { - opacity: { - type: 'f', - value: 1.0 - } - }, - fragmentShader: fragmentScreenQuadFromTex, - transparent: true - }); - - return function (srcTex, opacity) { - _material.uniforms.srcTex.value = srcTex; - _material.transparent = opacity < 1.0; - _material.uniforms.opacity.value = opacity; - this.renderScreenQuad(_material); - }; - }(); - - THREE.WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion = function () { - var _material = new ScreenQuadMaterial({ - uniforms: { - coef: { - type: 'f', - value: 1.0 - } - }, - fragmentShader: fragmentScreenQuadFromTexWithDistortion - }); - - return function (srcTex, coef) { - _material.uniforms.srcTex.value = srcTex; - _material.uniforms.coef.value = coef; - this.renderScreenQuad(_material); - }; - }(); - /** - * @param {number} angle - Field of view in degrees. - */ - - - THREE.PerspectiveCamera.prototype.setMinimalFov = function (angle) { - if (this.aspect >= 1.0) { - this.fov = angle; - } else { - this.fov = THREE.Math.radToDeg(2 * Math.atan(Math.tan(THREE.Math.degToRad(angle) * 0.5) / this.aspect)); - } - }; - /** - * @param {THREE.PerspectiveCamera} camera - Base camera for this stereo camera. - * @param {number} angle - Field of view in degrees. - */ - - - THREE.StereoCamera.prototype.updateHalfSized = function (camera, angle) { - var originalAspect = camera.aspect; - var originalFov = camera.fov; - camera.aspect = originalAspect / 2.0; - camera.setMinimalFov(angle); - camera.updateProjectionMatrix(); - this.update(camera); - camera.aspect = originalAspect; - camera.fov = originalFov; - camera.updateProjectionMatrix(); - }; - /** - * @param {number} radius - Radius of bounding sphere in angstroms to fit on screen. - * @param {number} angle - Field of view in degrees. - */ - - - THREE.PerspectiveCamera.prototype.setDistanceToFit = function (radius, angle) { - this.position.z = radius / Math.sin(0.5 * THREE.Math.degToRad(angle)); - }; - /** - * @param {RCGroup} gfxObj - All objects on scene. - * @param {THREE.PerspectiveCamera} camera - Camera used for rendering. - * @param {number} clipPlane - Distance to clip plane. - * @param {number} fogFarPlane - Distance to fog far plane. - */ - - - THREE.Raycaster.prototype.intersectVisibleObject = function (gfxObj, camera, clipPlane, fogFarPlane) { - var intersects = this.intersectObject(gfxObj, false); - - if (intersects.length === 0) { - return null; - } // find point closest to camera that doesn't get clipped by camera near plane or clipPlane (if it exists) - - - var nearPlane = Math.min(camera.near, clipPlane); - var i; - var p = intersects[0]; - var v = new THREE.Vector3(); - - for (i = 0; i < intersects.length; ++i) { - p = intersects[i]; - v.copy(p.point); - v.applyMatrix4(camera.matrixWorldInverse); - - if (v.z <= -nearPlane) { - break; - } - } - - if (i === intersects.length) { - return null; - } // check that selected intersection point is not clipped by camera far plane or occluded by fog (if it exists) - - - var farPlane = Math.min(camera.far, fogFarPlane); - v.copy(p.point); - v.applyMatrix4(camera.matrixWorldInverse); - - if (v.z <= -farPlane) { - return null; - } - - return p; - }; - - THREE.Matrix4.prototype.extractScale = function () { - var _v = new THREE.Vector3(); - - return function (scale) { - if (scale === undefined) { - logger.debug('extractScale(): new is too expensive operation to do it on-the-fly'); - scale = _v.clone(); - } - - var te = this.elements; - scale.x = _v.set(te[0], te[1], te[2]).length(); - scale.y = _v.set(te[4], te[5], te[6]).length(); - scale.z = _v.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale - - var det = this.determinant(); - - if (det < 0) { - scale.x = -scale.x; - } - - return scale; - }; - }(); - - function _calcCylinderMatrix(posBegin, posEnd, radius) { - var posCenter = posBegin.clone().lerp(posEnd, 0.5); - var matScale = new THREE.Matrix4(); - matScale.makeScale(radius, posBegin.distanceTo(posEnd), radius); - var matRotHalf = new THREE.Matrix4(); - matRotHalf.makeRotationX(Math.PI / 2); - var matRotLook = new THREE.Matrix4(); - var vUp = new THREE.Vector3(0, 1, 0); - matRotLook.lookAt(posCenter, posEnd, vUp); - matRotLook.multiply(matRotHalf); - matRotLook.multiply(matScale); - matRotLook.setPosition(posCenter); - return matRotLook; - } - - function _calcChunkMatrix(eye, target, up, rad) { - var matScale = new THREE.Matrix4(); - matScale.makeScale(rad.x, rad.y, 0); - var matRotLook = new THREE.Matrix4(); - matRotLook.lookAt(eye, target, up); - matRotLook.multiply(matScale); - matRotLook.setPosition(eye); - return matRotLook; - } - - function _forEachMeshInGroup(group, process) { - function processObj(object) { - if (object instanceof THREE.Mesh) { - process(object); - } - - for (var i = 0, l = object.children.length; i < l; i++) { - processObj(object.children[i]); - } - } - - processObj(group); - } - - function _countMeshTriangles(mesh) { - var geom = mesh.geometry; - - if (geom instanceof THREE.InstancedBufferGeometry) { - var attribs = geom.attributes; - - for (var property in attribs) { - if (attribs.hasOwnProperty(property) && attribs[property] instanceof THREE.InstancedBufferAttribute) { - var currAttr = attribs[property]; - var indexSize = geom.index ? geom.index.array.length / 3 : 0; - return indexSize * currAttr.array.length / currAttr.itemSize; - } - } - - return 0; - } - - if (geom instanceof THREE.BufferGeometry) { - return geom.index ? geom.index.array.length / 3 : 0; - } - - return geom.faces ? geom.faces.length : 0; - } - - function _countTriangles(group) { - var totalCount = 0; - - _forEachMeshInGroup(group, function (mesh) { - totalCount += _countMeshTriangles(mesh); - }); - - return totalCount; - } - - function _groupHasGeometryToRender(group) { - var hasGeoms = false; - group.traverse(function (node) { - if (node.hasOwnProperty('geometry') || node instanceof CSS2DObject) { - hasGeoms = true; - } - }); - return hasGeoms; - } - - function _buildDistorionMesh(widthSegments, heightSegements, coef) { - // solve equation r_u = r_d * (1 + k * r_d^2) - // for r_d using iterations - // takes: r_u^2 - // returns: r_d / r_u factor that can be used to distort point coords - function calcInverseBarrel(r2) { - var epsilon = 1e-5; - var prevR2 = 0.0; - var curR2 = r2; - var dr = 1.0; - - while (Math.abs(curR2 - prevR2) > epsilon) { - dr = 1.0 + coef * curR2; - prevR2 = curR2; - curR2 = r2 / (dr * dr); - } - - return 1.0 / dr; - } - - var geo = new THREE.PlaneBufferGeometry(2.0, 2.0, widthSegments, heightSegements); - var pos = geo.getAttribute('position'); - - for (var i = 0; i < pos.count; ++i) { - var x = pos.array[3 * i]; - var y = pos.array[3 * i + 1]; - var c = calcInverseBarrel(x * x + y * y); - pos.setXY(i, c * x, c * y); - } - - return geo; - } - - THREE.BufferAttribute.prototype.copyAtList = function (attribute, indexList) { - console.assert(this.itemSize === attribute.itemSize, 'false: BufferAttribute.copyAtList buffers have different item size.'); - var itemSize = this.itemSize; - - for (var i = 0, n = indexList.length; i < n; ++i) { - for (var j = 0; j < itemSize; ++j) { - this.array[i * itemSize + j] = attribute.array[indexList[i] * itemSize + j]; - } - } - - return this; - }; - - function fillArray(array, value, startIndex, endIndex) { - startIndex = typeof startIndex !== 'undefined' ? startIndex : 0; - endIndex = typeof endIndex !== 'undefined' ? endIndex : array.length; - - for (var i = startIndex; i < endIndex; ++i) { - array[i] = value; - } - } - /** @param {THREE.Object3D} object - Parent object. */ - - - function removeChildren(object) { - var children = object.children; - - for (var i = 0, n = children.length; i < n; ++i) { - var child = children[i]; - child.parent = null; - child.dispatchEvent({ - type: 'removed' - }); - } - - object.children = []; - } - - function clearTree(object) { - object.traverse(function (obj) { - if (obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line) { - obj.geometry.dispose(); - } - }); - removeChildren(object); - } - - function destroyObject(object) { - clearTree(object); - - if (object.parent) { - object.parent.remove(object); - } else { - object.dispatchEvent({ - type: 'removed' - }); - } - } - - function belongToSelectLayers(object) { - for (var i = 0; i < SELECTION_LAYERS.length; i++) { - if ((object.layers.mask >> SELECTION_LAYERS[i] & 1) === 1) { - return true; - } - } - - return false; - } - - function _getMeshesArr(root, meshTypes) { - var meshes = []; - root.traverse(function (object) { - for (var i = 0; i < meshTypes.length; i++) { - if (object instanceof meshTypes[i]) { - meshes[meshes.length] = object; - break; - } - } - }); - return meshes; - } - - function applyTransformsToMeshes(root, mtc) { - var mtcCount = mtc.length; - - if (mtcCount < 1) { - return; - } - - var meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments, THREE.Line]); - - for (var i = 0, n = meshes.length; i < n; ++i) { - var mesh = meshes[i]; - var parent = mesh.parent; - - if (!parent) { - continue; - } - - mesh.applyMatrix(mtc[0]); - - for (var j = 1; j < mtcCount; ++j) { - var newMesh = new mesh.constructor(mesh.geometry, mesh.material); - parent.add(newMesh); - newMesh.applyMatrix(mtc[j]); - } - } - } - - function processTransparentMaterial(root, material) { - if (!(material instanceof UberMaterial)) { - return; - } - - var meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]); - - var _loop = function _loop(i, n) { - var mesh = meshes[i]; - var parent = mesh.parent; - - if (!parent) { - return "continue"; - } - - mesh.material.setValues({ - prepassTransparancy: false, - fakeOpacity: false - }); - mesh.material.needsUpdate = true; - mesh.layers.set(LAYERS.TRANSPARENT); // copy of geometry with prepass material - - var prepassMat = mesh.material.createInstance(); - prepassMat.setValues({ - prepassTransparancy: true, - fakeOpacity: false - }); - var prepassMesh = new mesh.constructor(mesh.geometry, prepassMat); - - _.forEach(['transparent', 'colorFromDepth', 'lights', 'shadowmap', 'fog'], function (value) { - prepassMesh.material[value] = false; - }); - - prepassMesh.material.needsUpdate = true; - prepassMesh.applyMatrix(mesh.matrix); - prepassMesh.layers.set(LAYERS.PREPASS_TRANSPARENT); - parent.add(prepassMesh); - }; - - for (var i = 0, n = meshes.length; i < n; ++i) { - var _ret = _loop(i); - - if (_ret === "continue") continue; - } - } - - function processColFromPosMaterial(root, material) { - if (!(material instanceof UberMaterial)) { - return; - } - - var meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]); - - var _loop2 = function _loop2(i, n) { - var mesh = meshes[i]; - var parent = mesh.parent; - - if (!parent) { - return "continue"; - } // copy of geometry with colFromPosMat material - - - var colFromPosMat = mesh.material.createInstance(); - colFromPosMat.setValues({ - colorFromPos: true - }); - var colFromPosMesh = new mesh.constructor(mesh.geometry, colFromPosMat); - - _.forEach(['transparent', 'colorFromDepth', 'lights', 'shadowmap', 'fog', 'overrideColor', 'fogTransparent', 'attrColor', 'attrColor2', 'attrAlphaColor', 'fakeOpacity'], function (value) { - colFromPosMesh.material[value] = false; - }); - - colFromPosMesh.material.needsUpdate = true; - colFromPosMesh.applyMatrix(mesh.matrix); - colFromPosMesh.layers.set(LAYERS.COLOR_FROM_POSITION); - parent.add(colFromPosMesh); - }; - - for (var i = 0, n = meshes.length; i < n; ++i) { - var _ret2 = _loop2(i); - - if (_ret2 === "continue") continue; - } - } - - function createShadowmapMaterial(root, material) { - if (!(material instanceof UberMaterial)) { - return; - } - - var meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]); - - var _loop3 = function _loop3(i, n) { - var mesh = meshes[i]; - - if (!mesh.receiveShadow && mesh.material.shadowmap) { - // remove shadow from non-receivers - mesh.material.setValues({ - shadowmap: false - }); - } - - if (!mesh.castShadow) { - // skip creating shadowmap meshes for non-casters - return "continue"; - } // create special mesh for shadowmap - - - var parent = mesh.parent; - - if (!parent) { - return "continue"; - } // copy of geometry with shadowmap material - - - var shadowmapMat = mesh.material.createInstance(); - shadowmapMat.setValues({ - colorFromDepth: true - }); - var shadowmapMesh = new mesh.constructor(mesh.geometry, shadowmapMat); - - _.forEach(['lights', 'shadowmap', 'fog'], function (value) { - shadowmapMesh.material[value] = false; - }); - - shadowmapMesh.isShadowmapMesh = true; - shadowmapMesh.material.needsUpdate = true; - shadowmapMesh.applyMatrix(mesh.matrix); - shadowmapMesh.layers.set(LAYERS.SHADOWMAP); - parent.add(shadowmapMesh); - }; - - for (var i = 0, n = meshes.length; i < n; ++i) { - var _ret3 = _loop3(i); - - if (_ret3 === "continue") continue; - } - } - - function removeShadowmapMaterial(root, material) { - if (!(material instanceof UberMaterial)) { - return; - } - - var meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]); - - for (var i = 0, n = meshes.length; i < n; ++i) { - var mesh = meshes[i]; - - if (mesh.isShadowmapMesh && mesh.parent) { - mesh.parent.remove(mesh); - } - } - } - - function processObjRenderOrder(root, idMaterial) { - // set renderOrder to 0 for Backdrop and to 1 in other cases to render Backdrop earlier all other materials - var renderOrder = +(idMaterial !== 'BA'); - root.traverse(function (object) { - if (object.isGroup) { - object.renderOrder = renderOrder; - } - }); - } - /** Traverse tree and make visible only needed meshes */ - - - function makeVisibleMeshes(object, checker) { - if (object && object.traverse) { - object.traverse(function (obj) { - if (obj instanceof THREE.Mesh) { - obj.visible = checker(obj); - } - }); - } - } - - function applySelectionMaterial(geo) { - geo.traverse(function (node) { - if ('material' in node) { - node.material = node.material.clone(true); // using z-offset to magically fix selection rendering artifact (on z-sprites) - - node.material.setValues({ - depthFunc: THREE.LessEqualDepth, - overrideColor: true, - fog: false - }); - node.material.setUberOptions({ - fixedColor: new THREE.Color(0xFFFF00), - zOffset: -1e-6 - }); - } - }); - } - - function getMiddlePoint(point1, point2, optionalTarget) { - var result = optionalTarget || new THREE.Vector3(); - result.set(0, 0, 0); - result.addScaledVector(point1, 0.5); - result.addScaledVector(point2, 0.5); - return result; - } - - var gfxutils = { - calcCylinderMatrix: _calcCylinderMatrix, - calcChunkMatrix: _calcChunkMatrix, - forEachMeshInGroup: _forEachMeshInGroup, - countTriangles: _countTriangles, - groupHasGeometryToRender: _groupHasGeometryToRender, - buildDistorionMesh: _buildDistorionMesh, - RCGroup: RCGroup, - fillArray: fillArray, - clearTree: clearTree, - destroyObject: destroyObject, - belongToSelectLayers: belongToSelectLayers, - applyTransformsToMeshes: applyTransformsToMeshes, - processTransparentMaterial: processTransparentMaterial, - processColFromPosMaterial: processColFromPosMaterial, - createShadowmapMaterial: createShadowmapMaterial, - removeShadowmapMaterial: removeShadowmapMaterial, - processObjRenderOrder: processObjRenderOrder, - makeVisibleMeshes: makeVisibleMeshes, - applySelectionMaterial: applySelectionMaterial, - getMiddlePoint: getMiddlePoint, - LAYERS: LAYERS - }; - - var _defaultBoundaries = { - boundingBox: new THREE.Box3(new THREE.Vector3(-1, -1, -1), new THREE.Vector3(1, 1, 1)), - boundingSphere: new THREE.Sphere(new THREE.Vector3(0, 0, 0), 1) - }; - - function Visual(name, dataSource) { - gfxutils.RCGroup.call(this); - this.name = name; - this._dataSource = dataSource; - } - - utils.deriveClass(Visual, gfxutils.RCGroup); - - Visual.prototype.release = function () { - if (this.parent) { - this.parent.remove(this); - } - }; - - Visual.prototype.getDataSource = function () { - return this._dataSource; - }; - - Visual.prototype.getBoundaries = function () { - return _defaultBoundaries; - }; - - function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { - arr2[i] = arr[i]; - } - - return arr2; - } - } - - var arrayWithoutHoles = _arrayWithoutHoles; - - function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); - } - - var iterableToArray = _iterableToArray; - - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); - } - - var nonIterableSpread = _nonIterableSpread; - - function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); - } - - var toConsumableArray = _toConsumableArray; - - function _ensureArray(x) { - if (x === null || x === undefined || Array.isArray(x)) { - return x; - } - - return [x]; - } - /** An indexed list of objects or classes. */ - - - var EntityList = /*#__PURE__*/function () { - /** - * Create a list of objects. - * The objects can be indexed by one or more properties for the later retrieval. - * - * @param {!Array=} entities A list of objects to automatically register at creation time. - * @param {!Array=} indices A list of property names to use for case-insensitive indexing. - * By default, a single `.id` property is used. - * @see EntityList#register - */ - function EntityList() { - var _this = this; - - var entities = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var indices = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['id']; - - classCallCheck(this, EntityList); - - this._list = []; - this._dict = {}; - this._indices = toConsumableArray(indices); - - this._indices.forEach(function (index) { - _this._dict[index] = {}; - }); - - entities.forEach(function (entity) { - return _this.register(entity); - }); - } - /** - * Add a value to the end of a list. - * The list will contain only one copy of the value. - * - * @param {!Array} list An array. - * @param {*} value A value to add. - * @see EntityList.unregisterFromList - * @see EntityList.registerInDict - */ - - - createClass(EntityList, [{ - key: "register", - - /** - * Add an entity to this list. - * - * @param {!Object} entity An object or a class to register. The object must include all - * properties specified as indices on construction. - * @see EntityList#unregister - */ - value: function register(entity) { - var _this2 = this; - - EntityList.registerInList(this._list, entity); - - this._indices.forEach(function (index) { - EntityList.registerInDict(_this2._dict[index], _ensureArray(entity[index]), entity); - }); - } - /** - * Remove an entity from this list. - * - * @param {!Object} entity An object or a class to unregister. The object may be - * missing from the list but it must include all properties specified as indices - * on construction. - * @see EntityList#register - */ - - }, { - key: "unregister", - value: function unregister(entity) { - var _this3 = this; - - EntityList.unregisterFromList(this._list, entity); - - this._indices.forEach(function (index) { - EntityList.unregisterFromDict(_this3._dict[index], _ensureArray(entity[index]), entity); - }); - } - /** - * An ordered list of all registered entities. - * It is a read-only copy, use {@link EntityList#register} and {@link EntityList#unregister} - * to modify it. - * - * @type {!Array} - */ - - }, { - key: "keys", - - /** - * Retrieve a list of keys for the index. - * - * @param {string=} index One of the indices specified during the list construction. If omitted, - * the first of the indices is used. - * @returns {!Array} An unordered list of keys in the index, i.e. particular property - * values for all registered entities. - */ - value: function keys(index) { - return Object.keys(this._dict[index || this._indices[0]]); - } - /** - * Retrieve an entity by its key. - * - * @param {string} key A case-insensitive property value to look-up. - * @param {string=} index One of the indices specified during the list construction. If omitted, - * the first of the indices is used. - * @returns {Object=} An object registered in the index under the key. If there are multiple - * objects under the same key, the first one is returned. - */ - - }, { - key: "get", - value: function get(key, index) { - var dict = this._dict[index || this._indices[0]]; - - if (dict) { - var values = dict[key && key.toLowerCase()]; - return values && values.length > 0 ? values[0] : undefined; - } - - return undefined; - } - }, { - key: "all", - get: function get() { - return toConsumableArray(this._list); - } - /** - * The first registered entity. - * Use it if you do not care which entity you are referring to. - * - * @type {Object=} - */ - - }, { - key: "first", - get: function get() { - return this._list[0]; - } - }], [{ - key: "registerInList", - value: function registerInList(list, value) { - if (!list.includes(value)) { - list.push(value); - } - } - /** - * Remove a value from a list if it is there. - * - * @param {!Array} list An array. - * @param {*} value A value to remove. - * @see EntityList.registerInList - */ - - }, { - key: "unregisterFromList", - value: function unregisterFromList(list, value) { - var pos = list.indexOf(value); - - if (pos !== -1) { - list.splice(pos, 1); - } - } - /** - * Add a value to a dictionary. - * The value may be stored under multiple different keys (aliases). - * There might be multiples values stored under the same key. - * - * @param {!Object} dict A dictionary. - * @param {!Array} keys An array of keys. - * @param {*} value A value to add. - * @see EntityList.unregisterFromDict - * @see EntityList.registerInList - */ - - }, { - key: "registerInDict", - value: function registerInDict(dict, keys, value) { - keys.forEach(function (key) { - key = key.toLowerCase(); - var list = dict[key] = dict[key] || []; - - if (!list.includes(value)) { - list.push(value); - } - }); - } - /** - * Remove a value from a dictionary. - * The value may be stored under multiple different keys (aliases). - * There might be multiples values stored under the same key. - * - * @param {!Object} dict A dictionary. - * @param {!Array} keys An array of keys. - * @param {*} value A value to add. - * @see EntityList.registerInDict - */ - - }, { - key: "unregisterFromDict", - value: function unregisterFromDict(dict, keys, value) { - keys.forEach(function (key) { - key = key.toLowerCase(); - var list = dict[key]; - - if (list) { - var pos = list.indexOf(value); - - if (pos !== -1) { - list.splice(pos, 1); - } - - if (list.length === 0) { - delete dict[key]; - } - } - }); - } - }]); - - return EntityList; - }(); - - function makeContextDependent(prototype) { - Object.defineProperties(prototype, { - logger: { - get: function get() { - return this.context && this.context.logger ? this.context.logger : logger; - } - }, - settings: { - get: function get() { - return this.context && this.context.settings ? this.context.settings : settings; - } - } - }); - } - - var CollisionSphere = /*#__PURE__*/function () { - function CollisionSphere(position, radius) { - classCallCheck(this, CollisionSphere); - - this._position = position; - this._radius = radius; - } - - createClass(CollisionSphere, [{ - key: "raycast", - value: function raycast(raycaster) { - var sphere = CollisionSphere._sphere; - sphere.set(this._position, this._radius); - var p = new THREE.Vector3(); - - if (raycaster.ray.intersectSphere(sphere, p)) { - return { - distance: raycaster.ray.origin.distanceTo(p), - point: p - }; - } - - return null; - } - }]); - - return CollisionSphere; - }(); - - defineProperty(CollisionSphere, "_sphere", new THREE.Sphere()); - - var SphereCollisionGeo = function SphereCollisionGeo(base) { - return (/*#__PURE__*/function (_base) { - inherits(_class, _base); - - function _class(count) { - var _getPrototypeOf2; - - var _this; - - classCallCheck(this, _class); - - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - _this = possibleConstructorReturn(this, (_getPrototypeOf2 = getPrototypeOf(_class)).call.apply(_getPrototypeOf2, [this].concat(args))); - _this._objects = new Array(count); - _this.boundingSphere = null; - _this.boundingBox = null; - return _this; - } - - createClass(_class, [{ - key: "setSphere", - value: function setSphere(idx, position, radius) { - this._objects[idx] = new CollisionSphere(position, radius); - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - // TODO raycast with bounding sphere? How to deal with updates? - for (var i = 0, n = this._objects.length; i < n; ++i) { - var inters = this._objects[i].raycast(raycaster); - - if (inters) { - inters.chunkIdx = i; - intersects.push(inters); - } - } - } - }, { - key: "computeBoundingBox", - value: function computeBoundingBox() { - var objects = this._objects; - var boundingBox = this.boundingBox; - - if (boundingBox === null) { - this.boundingBox = boundingBox = new THREE.Box3(); - } - - boundingBox.makeEmpty(); - - for (var i = 0, n = objects.length; i < n; ++i) { - boundingBox.expandByPoint(objects[i]._position); - } - } - }, { - key: "computeBoundingSphere", - value: function computeBoundingSphere() { - this.computeBoundingBox(); - var objects = this._objects; - var boundingBox = this.boundingBox; // Build bounding sphere - - var radiusSquared = 0.0; - var center = new THREE.Vector3(); - boundingBox.getCenter(center); - - for (var i = 0, n = objects.length; i < n; ++i) { - var pos = objects[i]._position; - var lengthSquared = center.distanceToSquared(pos); - - if (radiusSquared < lengthSquared) { - radiusSquared = lengthSquared; - } - } - - if (this.boundingSphere === null) { - this.boundingSphere = new THREE.Sphere(); - } - - this.boundingSphere.set(center, Math.sqrt(radiusSquared)); - } - }]); - - return _class; - }(base) - ); - }; - - var tmpColor = new THREE.Color(); - var OFFSET_SIZE = 4; - var COLOR_SIZE = 3; - var copySubArrays$1 = utils.copySubArrays; - - function setArrayXYZ(arr, idx, x, y, z) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; - } - - function setArrayXYZW(arr, idx, x, y, z, w) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; - arr[idx + 3] = w; - } - - var InstancedSpheresGeometry = /*#__PURE__*/function (_SphereCollisionGeo) { - inherits(InstancedSpheresGeometry, _SphereCollisionGeo); - - function InstancedSpheresGeometry(spheresCount, sphereComplexity, useZSprites) { - var _this; - - classCallCheck(this, InstancedSpheresGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(InstancedSpheresGeometry).call(this, spheresCount)); - _this._sphGeometry = useZSprites ? new THREE.PlaneBufferGeometry(2, 2, 1, 1) : new THREE.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI); - - _this._init(spheresCount, _this._sphGeometry); - - return _this; - } - - createClass(InstancedSpheresGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, itemPos, itemRad) { - setArrayXYZW(this._offsets, itemIdx * OFFSET_SIZE, itemPos.x, itemPos.y, itemPos.z, itemRad); - this.setSphere(itemIdx, itemPos, itemRad); - } - }, { - key: "setColor", - value: function setColor(itemIdx, colorVal) { - tmpColor.set(colorVal); - setArrayXYZ(this._colors, itemIdx * COLOR_SIZE, tmpColor.r, tmpColor.g, tmpColor.b); - } - }, { - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.getAttribute('offset').needsUpdate = true; - this.getAttribute('color').needsUpdate = true; - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "setOpacity", - value: function setOpacity(chunkIndices, value) { - var alphaArr = this._alpha; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - alphaArr[chunkIndices[i]] = value; - } - - this.getAttribute('alphaColor').needsUpdate = true; - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var instanceCount = chunkIndices.length; - var geom = new THREE.InstancedBufferGeometry(); - - this._init.call(geom, instanceCount, this._sphGeometry); - - copySubArrays$1(this._offsets, geom._offsets, chunkIndices, OFFSET_SIZE); - copySubArrays$1(this._colors, geom._colors, chunkIndices, COLOR_SIZE); - geom.boundingSphere = this.boundingSphere; - geom.boundingBox = this.boundingBox; - return [geom]; - } - }, { - key: "_init", - value: function _init(spheresCount, sphereGeo) { - this.copy(sphereGeo); - this._offsets = utils.allocateTyped(Float32Array, spheresCount * OFFSET_SIZE); - this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE); - var alpha = this._alpha = utils.allocateTyped(Float32Array, spheresCount); - - _.fill(alpha, 1.0); - - this.setAttribute('offset', new THREE.InstancedBufferAttribute(this._offsets, OFFSET_SIZE, false, 1)); - this.setAttribute('color', new THREE.InstancedBufferAttribute(this._colors, COLOR_SIZE, false, 1)); - this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(alpha, 1, false, 1)); - } - }]); - - return InstancedSpheresGeometry; - }(SphereCollisionGeo(THREE.InstancedBufferGeometry)); - - /** - * This class adds raycasting interface to indexed - * THREE.BufferGeometry. - * @constructor - */ - - var RaycastableBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) { - inherits(RaycastableBufferGeometry, _THREE$BufferGeometry); - - function RaycastableBufferGeometry() { - classCallCheck(this, RaycastableBufferGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(RaycastableBufferGeometry).apply(this, arguments)); - } - - createClass(RaycastableBufferGeometry, [{ - key: "uvIntersection", - // This method was copied from three.js - value: function uvIntersection(point, p1, p2, p3, uv1, uv2, uv3) { - var barycoord = RaycastableBufferGeometry._barycoord; - THREE.Triangle.barycoordFromPoint(point, p1, p2, p3, barycoord); - uv1.multiplyScalar(barycoord.x); - uv2.multiplyScalar(barycoord.y); - uv3.multiplyScalar(barycoord.z); - uv1.add(uv2).add(uv3); - return uv1.clone(); - } - }, { - key: "checkIntersection", - value: function checkIntersection(object, raycaster, ray, pA, pB, pC, point) { - var intersect = ray.intersectTriangle(pA, pB, pC, false, point); - - if (intersect === null) { - return null; - } - - return { - point: point.clone() - }; - } - }, { - key: "checkBufferGeometryIntersection", - value: function checkBufferGeometryIntersection(object, raycaster, ray, position, uv, a, b, c) { - var vA = RaycastableBufferGeometry._vA; - var vB = RaycastableBufferGeometry._vB; - var vC = RaycastableBufferGeometry._vC; - var intersectionPoint = RaycastableBufferGeometry._intersectionPoint; - vA.fromBufferAttribute(position, a); - vB.fromBufferAttribute(position, b); - vC.fromBufferAttribute(position, c); - var intersection = this.checkIntersection(object, raycaster, ray, vA, vB, vC, intersectionPoint); - - if (intersection) { - if (uv) { - var uvA = RaycastableBufferGeometry._uvA; - var uvB = RaycastableBufferGeometry._uvB; - var uvC = RaycastableBufferGeometry._uvC; - uvA.fromBufferAttribute(uv, a); - uvB.fromBufferAttribute(uv, b); - uvC.fromBufferAttribute(uv, c); - intersection.uv = this.uvIntersection(intersectionPoint, vA, vB, vC, uvA, uvB, uvC); - } - - var normal = new THREE.Vector3(); - THREE.Triangle.getNormal(vA, vB, vC, normal); - intersection.face = new THREE.Face3(a, b, c, normal); - intersection.faceIndex = a; - } - - return intersection; - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var ray = raycaster.ray; - - if (this.boundingSphere === null) { - this.computeBoundingSphere(); - } - - if (raycaster.ray.intersectsSphere(this.boundingSphere) === false) { - return; - } - - if (this.boundingBox !== null) { - if (ray.intersectsBox(this.boundingBox) === false) { - return; - } - } - - var a; - var b; - var c; - var index = this.index, - _this$attributes = this.attributes, - position = _this$attributes.position, - uv = _this$attributes.uv; - - if (index === null) { - return; - } // indexed buffer geometry - - - for (var i = 0, l = index.count; i < l; i += 3) { - a = index.getX(i); - b = index.getX(i + 1); - c = index.getX(i + 2); - var intersection = this.checkBufferGeometryIntersection(this, raycaster, ray, position, uv, a, b, c); - - if (intersection) { - intersection.faceIndex = Math.floor(i / 3); // triangle number in indices buffer semantics - - intersects.push(intersection); - } - } - } - }]); - - return RaycastableBufferGeometry; - }(THREE.BufferGeometry); - - defineProperty(RaycastableBufferGeometry, "_vA", new THREE.Vector3()); - - defineProperty(RaycastableBufferGeometry, "_vB", new THREE.Vector3()); - - defineProperty(RaycastableBufferGeometry, "_vC", new THREE.Vector3()); - - defineProperty(RaycastableBufferGeometry, "_uvA", new THREE.Vector2()); - - defineProperty(RaycastableBufferGeometry, "_uvB", new THREE.Vector2()); - - defineProperty(RaycastableBufferGeometry, "_uvC", new THREE.Vector2()); - - defineProperty(RaycastableBufferGeometry, "_barycoord", new THREE.Vector3()); - - defineProperty(RaycastableBufferGeometry, "_intersectionPoint", new THREE.Vector3()); - - var MAX_IDC_16BIT = 65535; - var VEC_SIZE = 3; - var tmpColor$1 = new THREE.Color(); - /** - * This class represents geometry which consists of separate chunks. - * Each chunk has same index and similar geometry with equal points and faces count. - * Each chunk has by default only one color. - * @constructor - */ - - var ChunkedObjectsGeometry = /*#__PURE__*/function (_RaycastableBufferGeo) { - inherits(ChunkedObjectsGeometry, _RaycastableBufferGeo); - - function ChunkedObjectsGeometry(chunkGeo, chunksCount) { - var _this; - - classCallCheck(this, ChunkedObjectsGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(ChunkedObjectsGeometry).call(this)); - - if (_this.constructor === ChunkedObjectsGeometry) { - throw new Error('Can not instantiate abstract class!'); - } - - _this._chunkGeo = chunkGeo; - - _this._init(chunkGeo, chunksCount); - - return _this; - } - - createClass(ChunkedObjectsGeometry, [{ - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.getAttribute('position').needsUpdate = true; - this.getAttribute('normal').needsUpdate = true; - this.getAttribute('color').needsUpdate = true; - } - }, { - key: "setColor", - value: function setColor(chunkIdx, colorVal) { - tmpColor$1.set(colorVal); - var colors = this._colors; - var chunkSize = this._chunkSize; - - for (var i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) { - var idx = i * VEC_SIZE; - colors[idx] = tmpColor$1.r; - colors[idx + 1] = tmpColor$1.g; - colors[idx + 2] = tmpColor$1.b; - } - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "setOpacity", - value: function setOpacity(chunkIndices, value) { - var alphaArr = this._alpha; - var chunkSize = this._chunkSize; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var left = chunkIndices[i] * chunkSize; - - _.fill(alphaArr, value, left, left + chunkSize); - } - - this.getAttribute('alphaColor').needsUpdate = true; - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var inters = []; - - get(getPrototypeOf(ChunkedObjectsGeometry.prototype), "raycast", this).call(this, raycaster, inters); - - var facesPerChunk = this._chunkGeo.index.count / 3; - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('faceIndex')) { - continue; - } - - inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk); - intersects.push(inters[i]); - } - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var instanceCount = chunkIndices.length; - var geom = new THREE.BufferGeometry(); - - this._init.call(geom, this._chunkGeo, instanceCount); - - var srcPos = this._positions; - var srcNorm = this._normals; - var srcColor = this._colors; - var dstPos = geom._positions; - var dstNorm = geom._normals; - var dstColor = geom._colors; - var chunkSize = this._chunkSize * VEC_SIZE; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var dstPtOffset = i * chunkSize; - var ptIdxBegin = chunkIndices[i] * chunkSize; - var ptIdxEnd = ptIdxBegin + chunkSize; - dstPos.set(srcPos.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); - dstNorm.set(srcNorm.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); - dstColor.set(srcColor.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); - } - - geom.boundingSphere = this.boundingSphere; - geom.boundingBox = this.boundingBox; - return [geom]; - } - }, { - key: "_init", - value: function _init(chunkGeo, chunksCount) { - var chunkSize = this._chunkSize = chunkGeo.attributes.position.count; - var chunkIndex = chunkGeo.index.array; - var chunkIndexSize = chunkIndex.length; - var pointsCount = this._chunkSize * chunksCount; - var use32bitIndex = pointsCount > MAX_IDC_16BIT; - var indexSize = chunkIndexSize * chunksCount; - var index = this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, indexSize); - this._positions = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); - this._normals = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); - this._colors = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); - var alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount); - - _.fill(alpha, 1.0); - - for (var i = 0; i < chunksCount; ++i) { - var offset = i * chunkIndexSize; - var posOffset = i * chunkSize; - index.set(chunkIndex, offset); - - for (var j = 0; j < chunkIndexSize; ++j) { - index[offset + j] += posOffset; - } - } - - this.setIndex(new THREE.BufferAttribute(this._index, 1)); - this.setAttribute('position', new THREE.BufferAttribute(this._positions, VEC_SIZE)); - this.setAttribute('normal', new THREE.BufferAttribute(this._normals, VEC_SIZE)); - this.setAttribute('color', new THREE.BufferAttribute(this._colors, VEC_SIZE)); - this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1)); - } - }]); - - return ChunkedObjectsGeometry; - }(RaycastableBufferGeometry); - - var VEC_SIZE$1 = 3; - - var SimpleSpheresGeometry = /*#__PURE__*/function (_SphereCollisionGeo) { - inherits(SimpleSpheresGeometry, _SphereCollisionGeo); - - function SimpleSpheresGeometry(spheresCount, sphereComplexity) { - var _this; - - classCallCheck(this, SimpleSpheresGeometry); - - var sphGeometry = new THREE.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI); - _this = possibleConstructorReturn(this, getPrototypeOf(SimpleSpheresGeometry).call(this, spheresCount, sphGeometry, spheresCount)); - var normals = _this._normals; - var geoNormals = sphGeometry.attributes.normal.array; - var chunkSize = _this._chunkSize; - _this._chunkPos = _this._chunkGeo.attributes.position.array; - _this._tmpPositions = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE$1); - - for (var i = 0; i < spheresCount; ++i) { - normals.set(geoNormals, chunkSize * VEC_SIZE$1 * i); - } - - return _this; - } - - createClass(SimpleSpheresGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, itemPos, itemRad) { - var tmpPos = this._tmpPositions; - var chunkSize = this._chunkSize; - var geoPos = this._chunkPos; - - for (var i = 0; i < chunkSize; ++i) { - var idx = i * 3; - tmpPos[idx] = itemPos.x + geoPos[idx] * itemRad; - tmpPos[idx + 1] = itemPos.y + geoPos[idx + 1] * itemRad; - tmpPos[idx + 2] = itemPos.z + geoPos[idx + 2] * itemRad; - } - - this._positions.set(tmpPos, chunkSize * itemIdx * VEC_SIZE$1); - - this.setSphere(itemIdx, itemPos, itemRad); - } - }]); - - return SimpleSpheresGeometry; - }(SphereCollisionGeo(ChunkedObjectsGeometry)); - - var VEC_SIZE$2 = 3; - var centerPos = new THREE.Vector3(); - var tmpVector = new THREE.Vector3(); - var normMtx = new THREE.Matrix3(); - - var Simple2CCylindersGeometry = /*#__PURE__*/function (_ChunkedObjectsGeomet) { - inherits(Simple2CCylindersGeometry, _ChunkedObjectsGeomet); - - function Simple2CCylindersGeometry(instanceCount, polyComplexity) { - var _this; - - classCallCheck(this, Simple2CCylindersGeometry); - - var cylGeometry = new THREE.CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true); - _this = possibleConstructorReturn(this, getPrototypeOf(Simple2CCylindersGeometry).call(this, cylGeometry, 2 * instanceCount)); - var chunkSize = _this._chunkSize; - _this._chunkPos = _this._chunkGeo.attributes.position.array; - _this._chunkNorms = _this._chunkGeo.attributes.normal.array; - _this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE$2); - return _this; - } - - createClass(Simple2CCylindersGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, botPos, topPos, itemRad) { - var chunkSize = this._chunkSize; - var firstOffset = chunkSize * 2 * itemIdx * VEC_SIZE$2; - var secondOffset = firstOffset + chunkSize * VEC_SIZE$2; - var tmpArray = this._tmpVector; - var geoPos = this._chunkPos; - var geoNorm = this._chunkNorms; - centerPos.lerpVectors(botPos, topPos, 0.5); - var mtx1 = gfxutils.calcCylinderMatrix(botPos, centerPos, itemRad); - normMtx.getNormalMatrix(mtx1); - var idx; - - for (var i = 0; i < chunkSize; ++i) { - idx = i * VEC_SIZE$2; - tmpVector.fromArray(geoPos, idx); - tmpVector.applyMatrix4(mtx1); - tmpVector.toArray(tmpArray, idx); - } - - this._positions.set(tmpArray, firstOffset); // now shift center to get another part of the cylinder - - - centerPos.sub(botPos); - - for (var _i = 0; _i < chunkSize; ++_i) { - idx = _i * VEC_SIZE$2; - tmpArray[idx] += centerPos.x; - tmpArray[idx + 1] += centerPos.y; - tmpArray[idx + 2] += centerPos.z; - } - - this._positions.set(tmpArray, secondOffset); - - for (var _i2 = 0; _i2 < chunkSize; ++_i2) { - idx = _i2 * VEC_SIZE$2; - tmpVector.fromArray(geoNorm, idx); - tmpVector.applyMatrix3(normMtx); - tmpVector.toArray(tmpArray, idx); - } - - this._normals.set(tmpArray, firstOffset); - - this._normals.set(tmpArray, secondOffset); - } - }, { - key: "setColor", - value: function setColor(itemIdx, colorVal1, colorVal2) { - var first = 2 * itemIdx; - - get(getPrototypeOf(Simple2CCylindersGeometry.prototype), "setColor", this).call(this, first, colorVal1); - - var second = first + 1; - - get(getPrototypeOf(Simple2CCylindersGeometry.prototype), "setColor", this).call(this, second, colorVal2); - } - }]); - - return Simple2CCylindersGeometry; - }(ChunkedObjectsGeometry); - - var MAX_POINTS_COUNT_16BIT = 65536; - var PTS_PER_TRIANGLE = 3; - - var CylinderBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) { - inherits(CylinderBufferGeometry, _THREE$BufferGeometry); - - function CylinderBufferGeometry(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded) { - var _this; - - classCallCheck(this, CylinderBufferGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(CylinderBufferGeometry).call(this)); - var thetaStart = 0; - var thetaLength = 2 * Math.PI; - _this.type = 'CylinderBufferGeometry'; - _this.parameters = { - radiusTop: radiusTop, - radiusBottom: radiusBottom, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded - }; - var hasTop = openEnded === false && radiusTop > 0; - var hasBottom = openEnded === false && radiusBottom > 0; - var vertexCount = (heightSegments + 1) * radialSegments + hasTop * (radialSegments + 1) + hasBottom * (radialSegments + 1); - var facesCount = (2 * heightSegments + hasTop + hasBottom) * radialSegments; - var heightHalf = height / 2; - /* eslint-disable no-magic-numbers */ - - var positions = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3); - var normals = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3); - var indices = new THREE.Uint16BufferAttribute(utils.allocateTyped(Uint16Array, facesCount * PTS_PER_TRIANGLE), 1); - /* eslint-enable no-magic-numbers */ - - var uvs = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 2), 2); - console.assert(vertexCount < MAX_POINTS_COUNT_16BIT, 'false: Cylinder Geometry has too many vertices (65536 max).'); - var currVtxIdx = 0; - var currFaceIdx = 0; - var tanTheta = -(radiusBottom - radiusTop) / height; // setup cylinder data - - for (var y = 0; y <= heightSegments; y++) { - // faces - if (y !== heightSegments) { - for (var i = 0; i < radialSegments; i++) { - var v1 = currVtxIdx + i; - var v2 = currVtxIdx + radialSegments + i; - var v3 = currVtxIdx + radialSegments + (i + 1) % radialSegments; - var v4 = currVtxIdx + (i + 1) % radialSegments; - indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v1, v4, v2); - currFaceIdx++; - indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v2, v4, v3); - currFaceIdx++; - } - } // vertices - - - var v = y / heightSegments; - var radius = v * (radiusBottom - radiusTop) + radiusTop; - - for (var x = 0; x < radialSegments; x++) { - var u = x / radialSegments; - var vx = radius * Math.sin(u * thetaLength + thetaStart); - var vy = v * height - heightHalf; - var vz = radius * Math.cos(u * thetaLength + thetaStart); - var normal = new THREE.Vector3(vx, Math.sqrt(vx * vx + vz * vz) * tanTheta, vz).normalize(); - positions.setXYZ(currVtxIdx, vx, vy, vz); - normals.setXYZ(currVtxIdx, normal.x, normal.y, normal.z); - uvs.setXY(currVtxIdx, u, v); - ++currVtxIdx; - } - } // top cap - - - if (hasTop) { - var startTIdx = currVtxIdx; - var lastIdx = currVtxIdx + radialSegments; - - for (var fTIdx = 0; fTIdx < radialSegments; ++fTIdx) { - var currSrcIdx = currVtxIdx - radialSegments; - positions.setXYZ(currVtxIdx, positions.getX(currSrcIdx), positions.getY(currSrcIdx), positions.getZ(currSrcIdx)); - normals.setXYZ(currVtxIdx, 0, 1, 0); - uvs.setXY(currVtxIdx, 1, 1); - var nextTVtx = startTIdx + (fTIdx + 1) % radialSegments; - indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, currVtxIdx, nextTVtx, lastIdx); - currFaceIdx++; - currVtxIdx++; - } - - positions.setXYZ(currVtxIdx, 0, heightHalf, 0); - normals.setXYZ(currVtxIdx, 0, 1, 0); - uvs.setXY(currVtxIdx, 1, 1); - ++currVtxIdx; - } // bottom cap - - - if (hasBottom) { - var startBIdx = currVtxIdx; - var lastBIdx = currVtxIdx + radialSegments; - - for (var fBIdx = 0; fBIdx < radialSegments; ++fBIdx) { - var currSrcBIdx = fBIdx; - positions.setXYZ(currVtxIdx, positions.getX(currSrcBIdx), positions.getY(currSrcBIdx), positions.getZ(currSrcBIdx)); - normals.setXYZ(currVtxIdx, 0, -1, 0); - uvs.setXY(currVtxIdx, 0, 0); - var nextBVtx = startBIdx + (fBIdx + 1) % radialSegments; - indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, nextBVtx, currVtxIdx, lastBIdx); - currFaceIdx++; - currVtxIdx++; - } - - positions.setXYZ(currVtxIdx, 0, -heightHalf, 0); - normals.setXYZ(currVtxIdx, 0, -1, 0); - uvs.setXY(currVtxIdx, 0, 0); - } - - _this.setIndex(indices); - - _this.setAttribute('position', positions); - - _this.setAttribute('normal', normals); - - _this.setAttribute('uv', uvs); - - return _this; - } - - createClass(CylinderBufferGeometry, [{ - key: "clone", - value: function clone() { - var parameters = this.parameters; - return new CylinderBufferGeometry(parameters.radiusTop, parameters.radiusBottom, parameters.height, parameters.radialSegments, parameters.heightSegments, parameters.openEnded); - } - }]); - - return CylinderBufferGeometry; - }(THREE.BufferGeometry); - - var tmpColor$2 = new THREE.Color(); - var invMatrix = new THREE.Matrix4(); - var OFFSET_SIZE$1 = 4; - var COLOR_SIZE$1 = 3; - var copySubArrays$2 = utils.copySubArrays; - - function setArrayXYZ$1(arr, idx, x, y, z) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; - } - - function setArrayXYZW$1(arr, idx, x, y, z, w) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; - arr[idx + 3] = w; - } - - function sortNumber(a, b) { - return a - b; - } - - function _prepareCylinderInfo(chunkIndices) { - chunkIndices.sort(sortNumber); - var chunksIdx = []; - var cylinderInfo = []; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var val = chunkIndices[i]; - var even = (val | 0) % 2 === 0; - var newPar = { - first: false, - second: false - }; - - if (even) { - newPar.first = true; - newPar.second = i + 1 < n && chunkIndices[i + 1] === chunkIndices[i] + 1; - - if (newPar.second) { - ++i; - } - } else { - newPar.second = true; - } - - chunksIdx.push(Math.floor(val / 2)); - cylinderInfo.push(newPar); - } - - return { - indices: chunksIdx, - cylinderInfo: cylinderInfo - }; - } - - function _assignOpacity(cylinderInfo, color1, color2) { - for (var i = 0, n = cylinderInfo.length; i < n; ++i) { - var info = cylinderInfo[i]; - - if (!info.first) { - color1[COLOR_SIZE$1 * i] = -0.5; - } - - if (!info.second) { - color2[COLOR_SIZE$1 * i] = -0.5; - } - } - } - - var Instanced2CCylindersGeometry = /*#__PURE__*/function (_THREE$InstancedBuffe) { - inherits(Instanced2CCylindersGeometry, _THREE$InstancedBuffe); - - function Instanced2CCylindersGeometry(instanceCount, polyComplexity, useZSprites, openEnded) { - var _this; - - classCallCheck(this, Instanced2CCylindersGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(Instanced2CCylindersGeometry).call(this)); - _this._useZSprites = useZSprites; - _this._cylGeometry = useZSprites ? new THREE.PlaneBufferGeometry(2, 2, 1, 1) : new CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, openEnded); - - _this._init(instanceCount, _this._cylGeometry, _this._useZSprites); - - _this._collisionGeo = new Simple2CCylindersGeometry(instanceCount, 3); - return _this; - } - - createClass(Instanced2CCylindersGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, botPos, topPos, itemRad) { - var matrix = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad); - var me = matrix.elements; - var mtxOffset = itemIdx * OFFSET_SIZE$1; - - this._collisionGeo.setItem(itemIdx, botPos, topPos, itemRad); - - setArrayXYZW$1(this._matVector1, mtxOffset, me[0], me[4], me[8], me[12]); - setArrayXYZW$1(this._matVector2, mtxOffset, me[1], me[5], me[9], me[13]); - setArrayXYZW$1(this._matVector3, mtxOffset, me[2], me[6], me[10], me[14]); - - if (this._useZSprites) { - invMatrix.getInverse(matrix); - me = invMatrix.elements; - setArrayXYZW$1(this._invmatVector1, mtxOffset, me[0], me[4], me[8], me[12]); - setArrayXYZW$1(this._invmatVector2, mtxOffset, me[1], me[5], me[9], me[13]); - setArrayXYZW$1(this._invmatVector3, mtxOffset, me[2], me[6], me[10], me[14]); - } - } - }, { - key: "setColor", - value: function setColor(itemIdx, colorVal1, colorVal2) { - var colorIdx = itemIdx * COLOR_SIZE$1; - tmpColor$2.set(colorVal1); - setArrayXYZ$1(this._color1, colorIdx, tmpColor$2.r, tmpColor$2.g, tmpColor$2.b); - tmpColor$2.set(colorVal2); - setArrayXYZ$1(this._color2, colorIdx, tmpColor$2.r, tmpColor$2.g, tmpColor$2.b); - } - }, { - key: "computeBoundingSphere", - value: function computeBoundingSphere() { - this._collisionGeo.computeBoundingSphere(); - - this.boundingSphere = this._collisionGeo.boundingSphere; - } - }, { - key: "computeBoundingBox", - value: function computeBoundingBox() { - this._collisionGeo.computeBoundingBox(); - - this.boundingBox = this._collisionGeo.boundingBox; - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - this._collisionGeo.raycast(raycaster, intersects); - } - }, { - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.getAttribute('matVector1').needsUpdate = true; - this.getAttribute('matVector2').needsUpdate = true; - this.getAttribute('matVector3').needsUpdate = true; - this.getAttribute('color').needsUpdate = true; - this.getAttribute('color2').needsUpdate = true; - this.getAttribute('alphaColor').needsUpdate = true; - - if (this._useZSprites) { - this.getAttribute('invmatVector1').needsUpdate = true; - this.getAttribute('invmatVector2').needsUpdate = true; - this.getAttribute('invmatVector3').needsUpdate = true; - } - - this._collisionGeo.finishUpdate(); - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "setOpacity", - value: function setOpacity(chunkIndices, value) { - var alphaArr = this._alpha; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - alphaArr[Math.floor(chunkIndices[i] / 2)] = value; - } - - this.getAttribute('alphaColor').needsUpdate = true; - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var info = _prepareCylinderInfo(chunkIndices); - - var cylinderIndices = info.indices; - var instanceCount = cylinderIndices.length; - var geom = new THREE.InstancedBufferGeometry(); - - this._init.call(geom, instanceCount, this._cylGeometry, this._useZSprites); - - copySubArrays$2(this._matVector1, geom._matVector1, cylinderIndices, OFFSET_SIZE$1); - copySubArrays$2(this._matVector2, geom._matVector2, cylinderIndices, OFFSET_SIZE$1); - copySubArrays$2(this._matVector3, geom._matVector3, cylinderIndices, OFFSET_SIZE$1); - - if (this._useZSprites) { - copySubArrays$2(this._invmatVector1, geom._invmatVector1, cylinderIndices, OFFSET_SIZE$1); - copySubArrays$2(this._invmatVector2, geom._invmatVector2, cylinderIndices, OFFSET_SIZE$1); - copySubArrays$2(this._invmatVector3, geom._invmatVector3, cylinderIndices, OFFSET_SIZE$1); - } - - copySubArrays$2(this._color1, geom._color1, cylinderIndices, COLOR_SIZE$1); - copySubArrays$2(this._color2, geom._color2, cylinderIndices, COLOR_SIZE$1); - - _assignOpacity(info.cylinderInfo, geom._color1, geom._color2); - - geom.boundingSphere = this.boundingSphere; - geom.boundingBox = this.boundingBox; - return [geom]; - } - }, { - key: "getGeoParams", - value: function getGeoParams() { - return this._cylGeometry.parameters; - } - }, { - key: "_init", - value: function _init(instanceCount, cylinderGeo, useZSprites) { - this.copy(cylinderGeo); - this._matVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._matVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._matVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._color1 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE$1); - this._color2 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE$1); - var alpha = this._alpha = utils.allocateTyped(Float32Array, instanceCount); - - _.fill(alpha, 1.0); - - this.setAttribute('matVector1', new THREE.InstancedBufferAttribute(this._matVector1, OFFSET_SIZE$1, false, 1)); - this.setAttribute('matVector2', new THREE.InstancedBufferAttribute(this._matVector2, OFFSET_SIZE$1, false, 1)); - this.setAttribute('matVector3', new THREE.InstancedBufferAttribute(this._matVector3, OFFSET_SIZE$1, false, 1)); - this.setAttribute('color', new THREE.InstancedBufferAttribute(this._color1, COLOR_SIZE$1, false, 1)); - this.setAttribute('color2', new THREE.InstancedBufferAttribute(this._color2, COLOR_SIZE$1, false, 1)); - this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(this._alpha, 1, false, 1)); - - if (useZSprites) { - this._invmatVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._invmatVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._invmatVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this.setAttribute('invmatVector1', new THREE.InstancedBufferAttribute(this._invmatVector1, OFFSET_SIZE$1, false, 1)); - this.setAttribute('invmatVector2', new THREE.InstancedBufferAttribute(this._invmatVector2, OFFSET_SIZE$1, false, 1)); - this.setAttribute('invmatVector3', new THREE.InstancedBufferAttribute(this._invmatVector3, OFFSET_SIZE$1, false, 1)); - } - } - }]); - - return Instanced2CCylindersGeometry; - }(THREE.InstancedBufferGeometry); - - var VEC_SIZE$3 = 3; - var TRI_SIZE = 3; - var tmpPrev = new THREE.Vector3(); - var tmpNext = new THREE.Vector3(); - var tmpRes = new THREE.Vector3(); - var simpleNormal = new THREE.Vector3(1.0, 0.0, 0.0); - var normalOnCut = new THREE.Vector3(); - var nearRingPt = new THREE.Vector3(); - - function _createExtrudedChunkGeometry(shape, ringsCount) { - var geo = new THREE.BufferGeometry(); - var ptsCount = shape.length; - var totalPts = ptsCount * ringsCount; - var type = totalPts <= 65536 ? Uint16Array : Uint32Array; - var facesPerChunk = (ringsCount - 1) * ptsCount * 2; - var indices = new THREE.BufferAttribute(utils.allocateTyped(type, facesPerChunk * TRI_SIZE), 1); - var currVtxIdx = 0; - var currFaceIdx = 0; - - for (var y = 0; y < ringsCount; y++) { - // faces - if (y !== ringsCount - 1) { - for (var i = 0; i < ptsCount; i++) { - var v1 = currVtxIdx + i; - var v2 = currVtxIdx + ptsCount + i; - var v3 = currVtxIdx + ptsCount + (i + 1) % ptsCount; - var v4 = currVtxIdx + (i + 1) % ptsCount; - indices.setXYZ(currFaceIdx * TRI_SIZE, v1, v4, v2); - currFaceIdx++; - indices.setXYZ(currFaceIdx * TRI_SIZE, v2, v4, v3); - currFaceIdx++; - } - } - - currVtxIdx += ptsCount; - } - - geo.setIndex(indices); - var pos = utils.allocateTyped(Float32Array, totalPts * VEC_SIZE$3); - geo.setAttribute('position', new THREE.BufferAttribute(pos, VEC_SIZE$3)); - geo._positions = shape; - return geo; - } - - var ExtrudedObjectsGeometry = /*#__PURE__*/function (_ChunkedObjectsGeomet) { - inherits(ExtrudedObjectsGeometry, _ChunkedObjectsGeomet); - - function ExtrudedObjectsGeometry(shape, ringsCount, chunksCount) { - var _this; - - classCallCheck(this, ExtrudedObjectsGeometry); - - var chunkGeo = _createExtrudedChunkGeometry(shape, ringsCount); - - _this = possibleConstructorReturn(this, getPrototypeOf(ExtrudedObjectsGeometry).call(this, chunkGeo, chunksCount)); - _this._ringsCount = ringsCount; - var tmpShape = _this._tmpShape = []; - - for (var i = 0; i < shape.length; ++i) { - tmpShape[i] = new THREE.Vector3(); - } - - return _this; - } - - createClass(ExtrudedObjectsGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, matrices) { - var hasSlope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var hasCut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var ptsCount = this._chunkGeo._positions.length; - var ringsCount = this._ringsCount; - var chunkStartIdx = ptsCount * this._ringsCount * itemIdx * VEC_SIZE$3; - - this._setPoints(matrices, ptsCount, ringsCount, chunkStartIdx); - - if (hasSlope) { - this._setSlopeNormals(ptsCount, ringsCount, chunkStartIdx); - } else { - this._setBaseNormals(ptsCount, ringsCount, chunkStartIdx); - } - - if (hasCut) { - this._addCut(ptsCount, ringsCount, chunkStartIdx); - } - } - }, { - key: "_setPoints", - value: function _setPoints(matrices, ptsCount, ringsCount, chunkStartIdx) { - var tmpShape = this._tmpShape; - var positions = this._positions; - var shape = this._chunkGeo._positions; - - for (var i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i) { - var mtx = matrices[i]; - - for (var j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE$3) { - tmpShape[j].copy(shape[j]).applyMatrix4(mtx).toArray(positions, vtxIdx); - } - } - } - }, { - key: "_setBaseNormals", - value: function _setBaseNormals(ptsCount, ringsCount, chunkStartIdx) { - var nPtsInRing = ptsCount * VEC_SIZE$3; - - for (var i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i, vtxIdx += nPtsInRing) { - this._countNormalsInRing(ptsCount, vtxIdx, false); - } - } - }, { - key: "_setSlopeNormals", - value: function _setSlopeNormals(ptsCount, ringsCount, chunkStartIdx) { - var normals = this._normals; - var nPtsInRing = ptsCount * VEC_SIZE$3; - var vtxIdx = chunkStartIdx; // First ring - // In all cases, besides cut, second ring is coincident to first. So values of first ring's normals doesn't - // matter (In the cut case special handler will be applied later and will set them to correct values) - - for (var j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE$3) { - simpleNormal.toArray(normals, vtxIdx); - } // second ring - // If it isn't first Item we take normals' values from the last ring of the previous item (these rings are coincident) - // else we count normals' values based on next ring information - - - if (vtxIdx - 2 * nPtsInRing > 0) { - for (var _j = 0; _j < ptsCount; ++_j, vtxIdx += VEC_SIZE$3) { - tmpRes.fromArray(normals, vtxIdx - 2 * nPtsInRing).toArray(normals, vtxIdx); - } - } else { - this._countNormalsInRing(ptsCount, vtxIdx, true, +nPtsInRing); - - vtxIdx += nPtsInRing; - } // other rings - // we count normals' values based on previous ring information - - - for (var i = 2; i < ringsCount; ++i, vtxIdx += nPtsInRing) { - this._countNormalsInRing(ptsCount, vtxIdx, true, -nPtsInRing); - } - } // Counting normals: - // - Slope - // Radius changes throught part => normals aren't parallel with the plane contains section points - // normal = vTangentInSectionPlane x vToSuchPointInPrevSection (all vectors are scaled for being 1 in length) - // - No slope - // Radius doesn't change throught part => normals are parallel with the plane contains section points - // normal = vToPrevPointInSection + vToNextPointInSection (all vectors are scaled for being 1 in length) - - }, { - key: "_countNormalsInRing", - value: function _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) { - var tmpShape = this._tmpShape; - var normals = this._normals; - tmpShape[0].fromArray(this._positions, vtxIdx); - tmpShape[ptsCount - 1].fromArray(this._positions, vtxIdx + (ptsCount - 1) * VEC_SIZE$3); - - for (var j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE$3) { - if (j < ptsCount - 1) { - tmpShape[j + 1].fromArray(this._positions, vtxIdx + VEC_SIZE$3); - } - - if (isSlope) { - nearRingPt.fromArray(this._positions, vtxIdx + shiftToExtraPt); - tmpPrev.subVectors(tmpShape[(j + ptsCount - 1) % ptsCount], tmpShape[(j + 1) % ptsCount]).normalize(); - tmpNext.subVectors(tmpShape[j], nearRingPt).normalize(); - tmpRes.crossVectors(tmpNext, tmpPrev).normalize().toArray(normals, vtxIdx); - } else { - tmpPrev.subVectors(tmpShape[j], tmpShape[(j + ptsCount - 1) % ptsCount]).normalize(); - tmpNext.subVectors(tmpShape[j], tmpShape[(j + 1) % ptsCount]).normalize(); - tmpRes.addVectors(tmpPrev, tmpNext).normalize().toArray(normals, vtxIdx); - } - } - } - }, { - key: "_addCut", - value: function _addCut(ptsCount, ringsCount, chunkStartIdx) { - // Nothing to do if item is flat or only line - if (ptsCount < 3 || ringsCount < 2) { - return; - } - - var positions = this._positions; - var normals = this._normals; - var tmpShape = this._tmpShape; - var nPtsInRing = ptsCount * VEC_SIZE$3; // Normal to the cut plane is equal to cross product of two vectors which are lying in it - - tmpShape[0].fromArray(positions, chunkStartIdx); - tmpShape[1].fromArray(positions, chunkStartIdx + VEC_SIZE$3); - tmpShape[2].fromArray(positions, chunkStartIdx + 2 * VEC_SIZE$3); - tmpPrev.subVectors(tmpShape[1], tmpShape[0]).normalize(); - tmpNext.subVectors(tmpShape[1], tmpShape[2]).normalize(); - normalOnCut.crossVectors(tmpPrev, tmpNext).normalize(); - var vtxIdx = chunkStartIdx; // First and second rings normals' values are equal to value of normal to the cutting plane - - for (var j = 0; j < ptsCount * 2; ++j, vtxIdx += VEC_SIZE$3) { - normalOnCut.toArray(normals, vtxIdx); - } - - if (ringsCount > 2) { - // Third ring points are coincident to first ring points, but have different normals. It makes sharp angle near cut - for (var _j2 = 0; _j2 < ptsCount; ++_j2, vtxIdx += VEC_SIZE$3) { - tmpRes.fromArray(positions, vtxIdx - nPtsInRing).toArray(positions, vtxIdx); - } - } - } - }]); - - return ExtrudedObjectsGeometry; - }(ChunkedObjectsGeometry); - - var MAX_IDC_16BIT$1 = 65535; - var VERTEX_PER_SEGMENT = 4; - var POS_SIZE = 4; - var DIR_SIZE = 3; - var COL_SIZE = 3; - var tmpColor$3 = new THREE.Color(); - var direction = new THREE.Vector3(); - - function setArrayXYZ$2(arr, idx, x, y, z) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; - } - - function setArrayXYZW$2(arr, idx, x, y, z, w) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; - arr[idx + 3] = w; - } - - function getSubset(arr, startSegmentIdx, segmentsCount, elemSize) { - var start = startSegmentIdx * VERTEX_PER_SEGMENT; - var end = start + segmentsCount * VERTEX_PER_SEGMENT; - return arr.subarray(start * elemSize, end * elemSize); - } - /** - * This class represents lines geometry which consists of screen-aligned narrow quad of variable width. - * - * @constructor - * - * @param {number} segmentsCount Number of segments per chunk. - * collision geometry. - */ - - - var ThickLinesGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) { - inherits(ThickLinesGeometry, _THREE$BufferGeometry); - - function ThickLinesGeometry(segmentsCount) { - var _this; - - classCallCheck(this, ThickLinesGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(ThickLinesGeometry).call(this)); - - _this._initVertices(segmentsCount); - - return _this; - } - - createClass(ThickLinesGeometry, [{ - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.getAttribute('position').needsUpdate = true; - this.getAttribute('color').needsUpdate = true; - this.getAttribute('alphaColor').needsUpdate = true; - this.getAttribute('direction').needsUpdate = true; - } - }, { - key: "setColor", - value: function setColor(segmentIdx, colorVal) { - tmpColor$3.set(colorVal); - var idx = segmentIdx * VERTEX_PER_SEGMENT * COL_SIZE; - setArrayXYZ$2(this._colors, idx, tmpColor$3.r, tmpColor$3.g, tmpColor$3.b); - idx += COL_SIZE; - setArrayXYZ$2(this._colors, idx, tmpColor$3.r, tmpColor$3.g, tmpColor$3.b); - idx += COL_SIZE; - setArrayXYZ$2(this._colors, idx, tmpColor$3.r, tmpColor$3.g, tmpColor$3.b); - idx += COL_SIZE; - setArrayXYZ$2(this._colors, idx, tmpColor$3.r, tmpColor$3.g, tmpColor$3.b); - } - }, { - key: "setSegment", - value: function setSegment(segmentIdx, pos1, pos2) { - direction.subVectors(pos1, pos2); - direction.normalize(); - var positions = this._positions; - var directions = this._directions; - var idx = segmentIdx * VERTEX_PER_SEGMENT * POS_SIZE; - var dirIdx = segmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE; - setArrayXYZW$2(positions, idx, pos1.x, pos1.y, pos1.z, 0.5); - setArrayXYZ$2(directions, dirIdx, direction.x, direction.y, direction.z); - idx += POS_SIZE; - dirIdx += DIR_SIZE; - setArrayXYZW$2(positions, idx, pos1.x, pos1.y, pos1.z, -0.5); - setArrayXYZ$2(directions, dirIdx, direction.x, direction.y, direction.z); - idx += POS_SIZE; - dirIdx += DIR_SIZE; - setArrayXYZW$2(positions, idx, pos2.x, pos2.y, pos2.z, 0.5); - setArrayXYZ$2(directions, dirIdx, direction.x, direction.y, direction.z); - idx += POS_SIZE; - dirIdx += DIR_SIZE; - setArrayXYZW$2(positions, idx, pos2.x, pos2.y, pos2.z, -0.5); - setArrayXYZ$2(directions, dirIdx, direction.x, direction.y, direction.z); - } - }, { - key: "setOpacity", - value: function setOpacity(startSegIdx, endSegIdx, value) { - var start = startSegIdx * VERTEX_PER_SEGMENT; - var end = endSegIdx * VERTEX_PER_SEGMENT; - - _.fill(this.alpha, value, end, start); - - this.getAttribute('alphaColor').needsUpdate = true; - } - }, { - key: "getSubsetSegments", - value: function getSubsetSegments(startSegmentIdx, segmentsCount) { - return [getSubset(this._positions, startSegmentIdx, segmentsCount, POS_SIZE), getSubset(this._directions, startSegmentIdx, segmentsCount, DIR_SIZE)]; - } - }, { - key: "getSubsetColors", - value: function getSubsetColors(startSegmentIdx, segmentsCount) { - return getSubset(this._colors, startSegmentIdx, segmentsCount, COL_SIZE); - } - }, { - key: "getSubsetOpacities", - value: function getSubsetOpacities(startSegmentIdx, segmentsCount) { - return getSubset(this._alpha, startSegmentIdx, segmentsCount, 1); - } - }, { - key: "getNumVertexPerSegment", - value: function getNumVertexPerSegment() { - return VERTEX_PER_SEGMENT; - } - }, { - key: "getPositionSize", - value: function getPositionSize() { - return POS_SIZE; - } - }, { - key: "setSegments", - value: function setSegments(startSegmentIdx, positions) { - var startPos = startSegmentIdx * VERTEX_PER_SEGMENT * POS_SIZE; - - if (positions instanceof Array && positions.length === 2) { - this._positions.set(positions[0], startPos); - - var startDir = startSegmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE; - - this._directions.set(positions[1], startDir); // dirs are geo part of vertex - - } else { - this._positions.set(positions, startPos); - } - } - }, { - key: "setColors", - value: function setColors(startSegmentIdx, colors) { - var start = startSegmentIdx * VERTEX_PER_SEGMENT * COL_SIZE; - - this._colors.set(colors, start); - } - }, { - key: "_initVertices", - value: function _initVertices(segmentsCount) { - this._buffersSize = segmentsCount * VERTEX_PER_SEGMENT; - var pointsCount = this._buffersSize; - var use32bitIndex = pointsCount > MAX_IDC_16BIT$1; - this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, segmentsCount * 6); - this._positions = utils.allocateTyped(Float32Array, pointsCount * POS_SIZE); - this._colors = utils.allocateTyped(Float32Array, pointsCount * COL_SIZE); - this._directions = utils.allocateTyped(Float32Array, pointsCount * DIR_SIZE); - var alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount); - - _.fill(alpha, 1.0); - - var index = this._index; - var indexOffset = 0; - var pointOffset = 0; - - for (var j = 0; j < segmentsCount; j++, indexOffset += 6, pointOffset += VERTEX_PER_SEGMENT) { - index[indexOffset] = pointOffset; - index[indexOffset + 1] = pointOffset + 1; - index[indexOffset + 2] = pointOffset + 3; - index[indexOffset + 3] = pointOffset; - index[indexOffset + 4] = pointOffset + 2; - index[indexOffset + 5] = pointOffset + 3; - } - - this.setIndex(new THREE.BufferAttribute(this._index, 1)); - this.setAttribute('position', new THREE.BufferAttribute(this._positions, POS_SIZE)); - this.setAttribute('color', new THREE.BufferAttribute(this._colors, COL_SIZE)); - this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1)); - this.setAttribute('direction', new THREE.BufferAttribute(this._directions, DIR_SIZE)); - } - }]); - - return ThickLinesGeometry; - }(THREE.BufferGeometry); - - /** - * This class represents geometry which consists lines. This can build bounding volumes - * @constructor - * - * @param {number} segmentsCount Number of segments per chunk. - */ - - var LinesGeometry = /*#__PURE__*/function (_BaseLinesGeometry) { - inherits(LinesGeometry, _BaseLinesGeometry); - - function LinesGeometry() { - classCallCheck(this, LinesGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(LinesGeometry).apply(this, arguments)); - } - - createClass(LinesGeometry, [{ - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "computeBoundingSphere", - value: function computeBoundingSphere() { - var boundingBox = this.boundingBox; // Build bounding sphere - - var radiusSquared = 0.0; - var center = new THREE.Vector3(); - - if (boundingBox) { - boundingBox.getCenter(center); - } - - var positions = this._positions; - var sphere = this.boundingSphere || new THREE.Sphere(); - var size = this._positions.length; - var pos = new THREE.Vector3(); - var posSize = this.getPositionSize(); - - for (var i = 0; i < size; i += posSize) { - pos.set(positions[i], positions[i + 1], positions[i + 2]); - var lengthSquared = center.distanceToSquared(pos); - - if (radiusSquared < lengthSquared) { - radiusSquared = lengthSquared; - } - } - - sphere.set(center, Math.sqrt(radiusSquared)); - this.boundingSphere = sphere; - } - }, { - key: "computeBoundingBox", - value: function computeBoundingBox() { - var positions = this._positions; - var box = new THREE.Box3(); - var size = this._positions.length; - var tmpVec = new THREE.Vector3(); - var posSize = this.getPositionSize(); - - for (var i = 0; i < size; i += posSize) { - tmpVec.set(positions[i], positions[i + 1], positions[i + 2]); - box.expandByPoint(tmpVec); - } - - this.boundingBox = box; - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }]); - - return LinesGeometry; - }(ThickLinesGeometry); - - var VEC_SIZE$4 = 3; - var tmpVector$1 = new THREE.Vector3(); - var normMtx$1 = new THREE.Matrix3(); - - var CylinderCollisionGeo = /*#__PURE__*/function (_ChunkedObjectsGeomet) { - inherits(CylinderCollisionGeo, _ChunkedObjectsGeomet); - - function CylinderCollisionGeo(instanceCount, polyComplexity) { - var _this; - - classCallCheck(this, CylinderCollisionGeo); - - var cylGeometry = new THREE.CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true); - _this = possibleConstructorReturn(this, getPrototypeOf(CylinderCollisionGeo).call(this, cylGeometry, instanceCount)); - var chunkSize = _this._chunkSize; - _this._chunkPos = _this._chunkGeo.attributes.position.array; - _this._chunkNorms = _this._chunkGeo.attributes.normal.array; - _this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE$4); - return _this; - } - - createClass(CylinderCollisionGeo, [{ - key: "setItem", - value: function setItem(itemIdx, botPos, topPos, itemRad) { - var chunkSize = this._chunkSize; - var itemOffset = chunkSize * itemIdx * VEC_SIZE$4; - var tmpArray = this._tmpVector; - var geoPos = this._chunkPos; - var geoNorm = this._chunkNorms; - var mtx1 = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad); - normMtx$1.getNormalMatrix(mtx1); - var idx; - - for (var i = 0; i < chunkSize; ++i) { - idx = i * VEC_SIZE$4; - tmpVector$1.fromArray(geoPos, idx); - tmpVector$1.applyMatrix4(mtx1); - tmpVector$1.toArray(tmpArray, idx); - } - - this._positions.set(tmpArray, itemOffset); - - for (var _i = 0; _i < chunkSize; ++_i) { - idx = _i * VEC_SIZE$4; - tmpVector$1.fromArray(geoNorm, idx); - tmpVector$1.applyMatrix3(normMtx$1); - tmpVector$1.toArray(tmpArray, idx); - } - - this._normals.set(tmpArray, itemOffset); - } - }]); - - return CylinderCollisionGeo; - }(ChunkedObjectsGeometry); - - var COLLISION_RAD = 0.1; - /** - * This class represents geometry which consists of separate chunks. - * Each chunk has same index and similar geometry with equal points and faces count. - * Each chunk has by default only one color. - * @constructor - * - * @param {number} chunksCount Total chunks count. - * @param {number} segmentsCount Number of segments per chunk. - * @param {boolean} enableCollision Enable or disable collision where each segment is - * a collidable cylinder. - * collision geometry. - */ - - var ChunkedLinesGeometry = /*#__PURE__*/function (_LinesGeometry) { - inherits(ChunkedLinesGeometry, _LinesGeometry); - - function ChunkedLinesGeometry(chunksCount, segmentsCount, enableCollision) { - var _this; - - classCallCheck(this, ChunkedLinesGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(ChunkedLinesGeometry).call(this, chunksCount * segmentsCount)); - - _this._init(segmentsCount); - - _this._collisionGeo = enableCollision ? new CylinderCollisionGeo(chunksCount * segmentsCount, 3) : null; - return _this; - } - - createClass(ChunkedLinesGeometry, [{ - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "computeBoundingSphere", - value: function computeBoundingSphere() { - var collisionGeo = this._collisionGeo; - - if (collisionGeo) { - collisionGeo.computeBoundingSphere(); - this.boundingSphere = collisionGeo.boundingSphere; - return; - } - - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "computeBoundingSphere", this).call(this); - } - }, { - key: "computeBoundingBox", - value: function computeBoundingBox() { - var collisionGeo = this._collisionGeo; - - if (collisionGeo) { - collisionGeo.computeBoundingBox(); - this.boundingBox = collisionGeo.boundingBox; - return; - } - - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "computeBoundingBox", this).call(this); - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var collisionGeo = this._collisionGeo; - - if (!collisionGeo) { - return; - } - - var segCount = this._chunkSize; - - this._collisionGeo.raycast(raycaster, intersects); - - for (var i = 0, n = intersects.length; i < n; ++i) { - var chunkIdx = intersects[i].chunkIdx; - - if (chunkIdx === undefined) { - continue; - } - - chunkIdx = chunkIdx / segCount | 0; - intersects[i].chunkIdx = chunkIdx; - } - } - }, { - key: "setColor", - value: function setColor(chunkIdx, colorVal) { - var chunkSize = this._chunkSize; - - for (var i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) { - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "setColor", this).call(this, i, colorVal); - } - } - }, { - key: "setSegment", - value: function setSegment(chunkIdx, segIdx, pos1, pos2) { - var chunkSize = this._chunkSize; - var idx = chunkIdx * chunkSize + segIdx; - - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "setSegment", this).call(this, idx, pos1, pos2); - - if (this._collisionGeo) { - this._collisionGeo.setItem(chunkIdx * chunkSize + segIdx, pos1, pos2, COLLISION_RAD); - } - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "setOpacity", - value: function setOpacity(chunkIndices, value) { - var chunkSize = this._chunkSize; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var left = chunkIndices[i] * chunkSize; - - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "setOpacity", this).call(this, left, left + chunkSize - 1, value); - } - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var instanceCount = chunkIndices.length; - var chunkSize = this._chunkSize; - var subset = new ChunkedLinesGeometry(instanceCount, chunkSize, false); - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var dstPtOffset = i * chunkSize; - var startSegIdx = chunkIndices[i] * chunkSize; - subset.setSegments(dstPtOffset, this.getSubsetSegments(startSegIdx, chunkSize)); - subset.setColors(dstPtOffset, this.getSubsetColors(startSegIdx, chunkSize)); - } - - subset.boundingSphere = this.boundingSphere; - subset.boundingBox = this.boundingBox; - return [subset]; - } - }, { - key: "_init", - value: function _init(chunkSize) { - this._chunkSize = chunkSize; - } - }]); - - return ChunkedLinesGeometry; - }(LinesGeometry); - - var COLLISION_RAD$1 = 0.3; - var tmpVector$2 = new THREE.Vector3(); - - var TwoColorLinesGeometry = /*#__PURE__*/function (_LinesGeometry) { - inherits(TwoColorLinesGeometry, _LinesGeometry); - - function TwoColorLinesGeometry(segmentsCount) { - var _this; - - classCallCheck(this, TwoColorLinesGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(TwoColorLinesGeometry).call(this, segmentsCount * 2)); - - _this._init(segmentsCount); - - _this._collisionGeo = new Simple2CCylindersGeometry(segmentsCount, 3); - return _this; - } - - createClass(TwoColorLinesGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, botPos, topPos) { - this._collisionGeo.setItem(itemIdx, botPos, topPos, COLLISION_RAD$1); - - var offset = 2 * itemIdx; // there are two points per segment - - tmpVector$2.lerpVectors(botPos, topPos, 0.5); - - get(getPrototypeOf(TwoColorLinesGeometry.prototype), "setSegment", this).call(this, offset, botPos, tmpVector$2); - - get(getPrototypeOf(TwoColorLinesGeometry.prototype), "setSegment", this).call(this, offset + 1, tmpVector$2, topPos); - } - }, { - key: "setColor", - value: function setColor(itemIdx, colorVal1, colorVal2) { - var offset = 2 * itemIdx; // there are two points per segment - - get(getPrototypeOf(TwoColorLinesGeometry.prototype), "setColor", this).call(this, offset, colorVal1); - - get(getPrototypeOf(TwoColorLinesGeometry.prototype), "setColor", this).call(this, offset + 1, colorVal2); - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - if (this._collisionGeo) { - this._collisionGeo.raycast(raycaster, intersects); - } - } - }, { - key: "getSubset", - value: function getSubset(segmentIndices) { - var instanceCount = segmentIndices.length; - var subset = new TwoColorLinesGeometry(instanceCount, false); - - for (var i = 0, n = instanceCount; i < n; ++i) { - var startSegIdx = segmentIndices[i]; - subset.setSegments(i, this.getSubsetSegments(startSegIdx, 1)); - subset.setColors(i, this.getSubsetColors(startSegIdx, 1)); - } - - subset.boundingSphere = this.boundingSphere; - subset.boundingBox = this.boundingBox; - return [subset]; - } - }, { - key: "_init", - value: function _init(segmentsCount) { - this._segCounts = segmentsCount * 2; - } - }]); - - return TwoColorLinesGeometry; - }(LinesGeometry); // (???)parent = LinesGeometry.prototype; - - var vectors = [new THREE.Vector3(1, 0, 0), new THREE.Vector3(-1, 0, 0), new THREE.Vector3(0, 1, 0), new THREE.Vector3(0, -1, 0), new THREE.Vector3(0, 0, 1), new THREE.Vector3(0, 0, -1)]; - var vecCount = vectors.length; - var tempPos1 = new THREE.Vector3(); - var tempPos2 = new THREE.Vector3(); - - var CrossGeometry = /*#__PURE__*/function (_SphereCollisionGeo) { - inherits(CrossGeometry, _SphereCollisionGeo); - - function CrossGeometry(chunksCount) { - classCallCheck(this, CrossGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(CrossGeometry).call(this, chunksCount, chunksCount, vecCount / 2 | 0, false)); - } - - createClass(CrossGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, itemPos, itemRad) { - this.setSphere(itemIdx, itemPos, itemRad); - - for (var i = 0; i < vecCount / 2; ++i) { - var first = i * 2; - tempPos1.x = itemPos.x + vectors[first].x * itemRad; - tempPos1.y = itemPos.y + vectors[first].y * itemRad; - tempPos1.z = itemPos.z + vectors[first].z * itemRad; - var second = first + 1; - tempPos2.x = itemPos.x + vectors[second].x * itemRad; - tempPos2.y = itemPos.y + vectors[second].y * itemRad; - tempPos2.z = itemPos.z + vectors[second].z * itemRad; - this.setSegment(itemIdx, i, tempPos1, tempPos2); - } - } - }]); - - return CrossGeometry; - }(SphereCollisionGeo(ChunkedLinesGeometry)); - - var POS_RAD_SIZE = 4; - var COLOR_SIZE$2 = 3; - var tmpColor$4 = new THREE.Color(); - /** - * This is a base class for isosurface algorithms. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - - var IsoSurfaceGeometry = /*#__PURE__*/function (_RaycastableBufferGeo) { - inherits(IsoSurfaceGeometry, _RaycastableBufferGeo); - - function IsoSurfaceGeometry(spheresCount, opts) { - var _this; - - classCallCheck(this, IsoSurfaceGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(IsoSurfaceGeometry).call(this)); - _this._opts = opts; - _this.zClip = _this._opts.zClip; - _this._posRad = utils.allocateTyped(Float32Array, spheresCount * POS_RAD_SIZE); - _this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE$2); - return _this; - } - - createClass(IsoSurfaceGeometry, [{ - key: "setItem", - value: function setItem(chunkIdx, pos, radius) { - var posRad = this._posRad; - var idx = POS_RAD_SIZE * chunkIdx; - posRad[idx++] = pos.x; - posRad[idx++] = pos.y; - posRad[idx++] = pos.z; - posRad[idx] = radius; - } - }, { - key: "setColor", - value: function setColor(chunkIdx, colorVal) { - tmpColor$4.set(colorVal); - var colors = this._colors; - var idx = COLOR_SIZE$2 * chunkIdx; - colors[idx++] = tmpColor$4.r; - colors[idx++] = tmpColor$4.g; - colors[idx] = tmpColor$4.b; - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this._build(); - } - }, { - key: "setOpacity", - value: function setOpacity() {// not implemented - } - }, { - key: "raycast", - value: function raycast() {} - }, { - key: "getSubset", - value: function getSubset() { - return []; - } - }]); - - return IsoSurfaceGeometry; - }(RaycastableBufferGeometry); - - /** - * Class for marching cube - * Stores 8 points and 8 float values are stored together in linear array - * Int values for has intersection or not - in integer32 linear array - * Int values for bits flags - in integer32 linear array - * - */ - - var IsoSurfaceMarchCube = /*#__PURE__*/function () { - function IsoSurfaceMarchCube() { - classCallCheck(this, IsoSurfaceMarchCube); - - this.pointsValuesLinear = null; - this.hasIntersection = null; - this.bitsInside = null; - } - - createClass(IsoSurfaceMarchCube, [{ - key: "create", - value: function create(numCellsPerSide) { - var vx7000000 = 0x7000000; - var n3 = numCellsPerSide * numCellsPerSide * numCellsPerSide; - - if (n3 > vx7000000) { - throw new Error('Too large cube dimension: lead to memory huge uasge'); - } - - this.pointsValuesLinear = utils.allocateTyped(Float32Array, (2 << 2 + 2) * n3); - this.hasIntersection = utils.allocateTyped(Int32Array, n3); - this.bitsInside = utils.allocateTyped(Int32Array, n3); - return 0; - } - }, { - key: "destroy", - value: function destroy() { - this.bitsInside = null; - this.hasIntersection = null; - this.pointsValuesLinear = null; - } - }]); - - return IsoSurfaceMarchCube; - }(); - /* eslint-disable no-magic-numbers */ - - - IsoSurfaceMarchCube.prototype.striIndicesMarchCube = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1, 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1, 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1, 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1, 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1, 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1, 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1, 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1, 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1, 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1, 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1, 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1, 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1, 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1, 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1, 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1, 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1, 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1, 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1, 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1, 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1, 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1, 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1, 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1, 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1, 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1, 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1, 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1, 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1, 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1, 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1, 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1, 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1, 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1, 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1, 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1, 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1, 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1, 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1, 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1, 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1, 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1, 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1, 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1, 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1, 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1, 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1, 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1, 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1, 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1, 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1, 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1, 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1, 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1, 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1, 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1, 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1, 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1, 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1, 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1, 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1, 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1, 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1, 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1, 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1, 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1, 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1, 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1, 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1, 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1, 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1, 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1, 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1, 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1, 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1, 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1, 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1, 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1, 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1, 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1, 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1, 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1, 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1, 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1, 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1, 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1, 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1, 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1, 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1, 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1, 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1, 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1, 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1, 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1, 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1, 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1, 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1, 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1, 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1, 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1, 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1, 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1, 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1, 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1, 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1, 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1, 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1, 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1, 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; - - var edgeTable = [0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0]; - - function _voxelGradientFast(v, point, grad) { - var g = v.getValue(point.x, point.y, point.z); - grad.set(g[0], g[1], g[2]); - } // Helper class GridCell - - - var GridCell = function GridCell() { - classCallCheck(this, GridCell); - - this._arrSize = 8; - this.p = new Array(this._arrSize); - this.g = new Array(this._arrSize); - this.val = new Array(this._arrSize); - - for (var i = 0; i < this._arrSize; ++i) { - this.p[i] = new THREE.Vector3(); - this.g[i] = new THREE.Vector3(); - } - - this.cubeIndex = 0; - }; // Helper class Triangle - - - var Triangle = function Triangle() { - classCallCheck(this, Triangle); - - this.a = { - p: new THREE.Vector3(), - n: new THREE.Vector3() - }; - this.b = { - p: new THREE.Vector3(), - n: new THREE.Vector3() - }; - this.c = { - p: new THREE.Vector3(), - n: new THREE.Vector3() - }; - }; - - function createArray(arrSize) { - var arr = new Array(arrSize); - - for (var i = 0; i < arrSize; ++i) { - arr[i] = new THREE.Vector3(); - } - - return arr; - } - - var IsoSurface = /*#__PURE__*/function () { - function IsoSurface() { - classCallCheck(this, IsoSurface); - - this._numTriangles = 0; - this._numVertices = 0; - this._position = []; - this._normals = []; - this._colors = null; - this._indices = []; - this._volumetricData = null; - this._xAxis = new THREE.Vector3(); - this._yAxis = new THREE.Vector3(); - this._zAxis = new THREE.Vector3(); - this._xDir = new THREE.Vector3(); - this._yDir = new THREE.Vector3(); - this._zDir = new THREE.Vector3(); - } - - createClass(IsoSurface, [{ - key: "_prepareAxesAndDirs", - value: function _prepareAxesAndDirs() { - var volData = this._volumetricData; - var cellSize = volData.getCellSize(); // calculate cell axes - - var xAxis = this._xAxis; - var yAxis = this._yAxis; - var zAxis = this._zAxis; - var xDir = this._xDir; - var yDir = this._yDir; - var zDir = this._zDir; - xAxis.set(cellSize.x, 0, 0); - yAxis.set(0, cellSize.y, 0); - zAxis.set(0, 0, cellSize.z); - xDir.set(1, 0, 0); - yDir.set(0, 1, 0); - zDir.set(0, 0, 1); // flip normals if coordinate system is in the wrong handedness - - var tmp = new THREE.Vector3(); - tmp.crossVectors(xDir, yDir); - - if (tmp.dot(zDir) < 0) { - xDir.negate(); - yDir.negate(); - zDir.negate(); - } // check that the grid is in the all-positive octant of the coordinate system - - - if (xDir.x < 0 || xDir.y < 0 || xDir.z < 0 || yDir.x < 0 || yDir.y < 0 || yDir.z < 0 || zDir.x < 0 || zDir.y < 0 || zDir.z < 0) { - return false; - } // check that the grid is axis-aligned - - - var notZero = function notZero(axe) { - return Math.abs(axe) > Number.EPSILON; - }; - - return !(notZero(xAxis.y) || notZero(xAxis.z) || notZero(yAxis.x) || notZero(yAxis.z) || notZero(zAxis.x) || notZero(zAxis.y)); - } - }, { - key: "_vertexInterp", - value: function _vertexInterp(isoLevel, grid, ind1, ind2, vertex, normal) { - var p1 = grid.p[ind1]; - var p2 = grid.p[ind2]; - var n1 = grid.g[ind1]; - var n2 = grid.g[ind2]; - var valP1 = grid.val[ind1]; - var valP2 = grid.val[ind2]; - var isoDiffP1 = isoLevel - valP1; - var diffValP2P1 = valP2 - valP1; - var mu = 0.0; - - if (Math.abs(diffValP2P1) > 0.0) { - mu = isoDiffP1 / diffValP2P1; - } - - mu = mu > 1.0 ? 1.0 : mu; - vertex.lerpVectors(p1, p2, mu); - normal.lerpVectors(n1, n2, mu); - } - }, { - key: "_polygonize", - value: function _polygonize(grid, isoLevel, triangles) { - var cubeIndex = grid.cubeIndex; - var i = 0; - var arrSize = IsoSurface._arrSize; - var firstIndices = IsoSurface._firstIndices; - var secondIndices = IsoSurface._secondIndices; - var vertexList = IsoSurface._vertexList; - var normalList = IsoSurface._normalList; - - for (; i < arrSize; ++i) { - if (edgeTable[cubeIndex] & 1 << i) { - this._vertexInterp(isoLevel, grid, firstIndices[i], secondIndices[i], vertexList[i], normalList[i]); - } - } - - var triCount = 0; - var triTblIdx = cubeIndex * 16; - var triTable = IsoSurface._triTable; - - for (i = 0; triTable[triTblIdx + i] !== -1; i += 3) { - triangles[triCount].a.p.copy(vertexList[triTable[triTblIdx + i]]); - triangles[triCount].a.n.copy(normalList[triTable[triTblIdx + i]]); - triangles[triCount].b.p.copy(vertexList[triTable[triTblIdx + i + 1]]); - triangles[triCount].b.n.copy(normalList[triTable[triTblIdx + i + 1]]); - triangles[triCount].c.p.copy(vertexList[triTable[triTblIdx + i + 2]]); - triangles[triCount].c.n.copy(normalList[triTable[triTblIdx + i + 2]]); - ++triCount; - } - - return triCount; - } - }, { - key: "_doGridPosNorms", - value: function _doGridPosNorms(isoValue, step, appendSimple) { - var vol = this._volumetricData; - - var volData = this._volumetricData.getData(); - - var dim = vol.getDimensions(); - var xSize = dim[0]; - var ySize = dim[1]; - var zSize = dim[2]; - var stepX = step * vol.getStrideX(); - var stepY = step * vol.getStrideY(); - var stepZ = step * vol.getStrideZ(); - var gc = new GridCell(); - var gcVal = gc.val; - var gcValSize = gc.val.length; - var additions = [new THREE.Vector3(0, 0, 0), // 0 - new THREE.Vector3(step, 0, 0), // 1 - new THREE.Vector3(step, step, 0), // 2 - new THREE.Vector3(0, step, 0), // 3 - new THREE.Vector3(0, 0, step), // 4 - new THREE.Vector3(step, 0, step), // 5 - new THREE.Vector3(step, step, step), // 6 - new THREE.Vector3(0, step, step) // 7 - ]; - var tmpTriCount = 5; - var triangles = new Array(tmpTriCount); - - for (var j = 0; j < tmpTriCount; ++j) { - triangles[j] = new Triangle(); - } - - var appendVertex; - var self = this; - var positions = this._position; - var normals = this._normals; - - if (appendSimple) { - // Special case for axis-aligned grid with positive unit vector normals - appendVertex = function () { - var axis = new THREE.Vector3(self._xAxis.x, self._yAxis.y, self._zAxis.z); - return function (triVertex) { - var vertex = triVertex.p.clone(); - vertex.multiply(axis); - positions.push(vertex.add(self._origin)); - normals.push(triVertex.n.clone()); - }; - }(); - } else { - appendVertex = function () { - var posMtx = new THREE.Matrix3(); - posMtx.set(self._xAxis.x, self._yAxis.x, self._zAxis.x, self._xAxis.y, self._yAxis.y, self._zAxis.y, self._xAxis.z, self._yAxis.z, self._zAxis.z); - var normMtx = new THREE.Matrix3(); - normMtx.set(self._xDir.x, self._yDir.x, self._zDir.x, self._xDir.y, self._yDir.y, self._zDir.y, self._xDir.z, self._yDir.z, self._zDir.z); - return function (triVertex) { - positions.push(triVertex.p.clone().applyMatrix3(posMtx).add(self._origin)); - normals.push(triVertex.n.clone().applyMatrix3(normMtx)); - }; - }(); - } - - var indices = this._indices; - var globTriCount = 0; - - for (var z = 0; z < zSize - step; z += step) { - for (var y = 0; y < ySize - step; y += step) { - var idx = vol.getDirectIdx(0, y, z); - - for (var x = 0; x < xSize - step; x += step, idx += stepX) { - /* eslint-disable no-multi-spaces */ - - /* eslint-disable computed-property-spacing */ - gcVal[0] = volData[idx]; - gcVal[1] = volData[idx + stepX]; - gcVal[3] = volData[idx + stepY]; - gcVal[2] = volData[idx + stepX + stepY]; - gcVal[4] = volData[idx + stepZ]; - gcVal[5] = volData[idx + stepX + stepZ]; - gcVal[7] = volData[idx + stepY + stepZ]; - gcVal[6] = volData[idx + stepX + stepY + stepZ]; - /* eslint-enable no-multi-spaces */ - - /* eslint-enable computed-property-spacing */ - // Determine the index into the edge table which - // tells us which vertices are inside of the surface - - var cubeIndex = 0; - var i = 0; - - for (; i < gcValSize; ++i) { - if (gcVal[i] < isoValue) { - cubeIndex |= 1 << i; - } - } - - if (edgeTable[cubeIndex] === 0) { - continue; - } - - gc.cubeIndex = cubeIndex; - - for (i = 0; i < gcValSize; ++i) { - gc.p[i].set(x + additions[i].x, y + additions[i].y, z + additions[i].z); - - _voxelGradientFast(this._gradient, gc.p[i], gc.g[i]); - } // calculate vertices and facets for this cube, - // calculate normals by interpolating between the negated - // normalized volume gradients for the 8 reference voxels - - - var triCount = this._polygonize(gc, isoValue, triangles); - - globTriCount += triCount; // append triangles using different techniques - - for (i = 0; i < triCount; ++i) { - indices.push(this._numTriangles * 3); - indices.push(this._numTriangles * 3 + 1); - indices.push(this._numTriangles * 3 + 2); - ++this._numTriangles; - appendVertex(triangles[i].a); - appendVertex(triangles[i].b); - appendVertex(triangles[i].c); - } - } - } - } - - return globTriCount; - } - }, { - key: "compute", - value: function compute(volData, origin, isoValue, step) { - this._volumetricData = volData; - this._origin = origin; - this._gradient = volData.computeGradient(); - - this._doGridPosNorms(isoValue, step, this._prepareAxesAndDirs()); - } - }, { - key: "_remapIndices", - value: function _remapIndices(vertexMap, idcCount) { - var indices = this._indices; - var newIndices = utils.allocateTyped(Uint32Array, idcCount); - - for (var i = 0; i < idcCount; ++i) { - indices[i] = vertexMap[indices[i]]; - newIndices[i] = indices[i]; - } - - this._indices = newIndices; - } - }, { - key: "_remapVertices", - value: function _remapVertices(vertices, normals, count) { - var newPositions = utils.allocateTyped(Float32Array, count * 3); - var newNormals = utils.allocateTyped(Float32Array, count * 3); - - for (var i = 0; i < count; ++i) { - var pos = vertices[i]; - newPositions[i * 3] = pos.x; - newPositions[i * 3 + 1] = pos.y; - newPositions[i * 3 + 2] = pos.z; - var norm = normals[i].normalize(); - newNormals[i * 3] = norm.x; - newNormals[i * 3 + 1] = norm.y; - newNormals[i * 3 + 2] = norm.z; - } - - this._position = newPositions; - this._normals = newNormals; - } - }, { - key: "vertexFusion", - value: function vertexFusion(offset, len) { - var faceVer = this._indices.length; - var vertices = this._position; - var normals = this._normals; - var oldVerCount = vertices.length | 0; - - if (faceVer === 0 || oldVerCount === 0) { - return; - } - - var vMap = utils.allocateTyped(Uint32Array, oldVerCount); - vMap[0] = 0; - var newVer = 1; - var i = 1; - - for (; i < oldVerCount; ++i) { - var start = newVer - offset < 0 ? 0 : newVer - offset; - var end = start + len > newVer ? newVer : start + len; - var matchedIndex = -1; - - for (var j = start; j < end; ++j) { - if (Math.abs(vertices[i] - vertices[j]) < Number.EPSILON) { - matchedIndex = j; - break; - } - } - - if (matchedIndex !== -1) { - vMap[i] = matchedIndex; - } else { - vertices[newVer].copy(vertices[i]); - normals[newVer].copy(normals[i]); - vMap[i] = newVer; - ++newVer; - } - } - - this._remapIndices(vMap, faceVer); - - this._remapVertices(vertices, normals, newVer); - } // Assign per-vertex colors from a volumetric texture map (same dimensions as the original volumetric data). - // Along with color dominating atom is determined for each vertex - // and vertices with atom out of "visible" subset get filtered out. - // XXX only handles orthogonal volumes currently - - }, { - key: "setColorVolTex", - value: function setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) { - var i; - var idx; - var numVerts = this._position.length / 3; - var vertices = this._position; - var origin = this._origin; - - var dim = this._volumetricData.getDimensions(); - - var xs = dim[0] - 1; - var ys = dim[1] - 1; - var zs = dim[2] - 1; - var colorData = colorMap.getData(); - var strideX = colorMap.getStrideX(); - var strideY = colorMap.getStrideY(); - var strideZ = colorMap.getStrideZ(); - var atomWeightData; - var atomStrideX; - var atomStrideY; - var atomStrideZ; - - if (visibilitySelector !== null) { - atomWeightData = atomWeightMap.getData(); - atomStrideX = atomWeightMap.getStrideX(); - atomStrideY = atomWeightMap.getStrideY(); - atomStrideZ = atomWeightMap.getStrideZ(); - } - - var xInv = 1.0 / this._xAxis.x; - var yInv = 1.0 / this._yAxis.y; - var zInv = 1.0 / this._zAxis.z; - var atomLookup = []; - var atomWeights = []; - var colors = utils.allocateTyped(Float32Array, numVerts * 3); - - function interp(mu, idx1, idx2, c) { - c[0] = (1 - mu) * colorData[idx1] + mu * colorData[idx2]; - c[1] = (1 - mu) * colorData[idx1 + 1] + mu * colorData[idx2 + 1]; - c[2] = (1 - mu) * colorData[idx1 + 2] + mu * colorData[idx2 + 2]; - } - - function collectWeight(ai, coefX, coefY, coefZ) { - var a = atomMap[ai]; // atomWeightMap is a scalar field, so index into atom map should be the same - - if (a != null) { - atomLookup[a.index] = a; - var w = coefX * coefY * coefZ * atomWeightData[ai]; - - if (typeof atomWeights[a.index] === 'undefined') { - atomWeights[a.index] = w; - } else { - atomWeights[a.index] += w; - } - } - } - - var vMap = utils.allocateTyped(Int32Array, numVerts); - var newVerCount = 0; - - for (i = 0; i < numVerts; i++) { - var ind = i * 3; - var vx = (vertices[ind] - origin.x) * xInv; - var vy = (vertices[ind + 1] - origin.y) * yInv; - var vz = (vertices[ind + 2] - origin.z) * zInv; - var x = Math.min(Math.max(vx, 0), xs) | 0; - var y = Math.min(Math.max(vy, 0), ys) | 0; - var z = Math.min(Math.max(vz, 0), zs) | 0; - var mux = vx - x; - var muy = vy - y; - var muz = vz - z; - - if (visibilitySelector != null) { - // collect atom weights - atomLookup = []; - atomWeights = []; - idx = atomWeightMap.getDirectIdx(x, y, z); - collectWeight(idx, 1 - mux, 1 - muy, 1 - muz); - collectWeight(idx + atomStrideX, mux, 1 - muy, 1 - muz); - collectWeight(idx + atomStrideY, 1 - mux, muy, 1 - muz); - collectWeight(idx + atomStrideX + atomStrideY, mux, muy, 1 - muz); - collectWeight(idx + atomStrideZ, 1 - mux, 1 - muy, muz); - collectWeight(idx + atomStrideX + atomStrideZ, mux, 1 - muy, muz); - collectWeight(idx + atomStrideY + atomStrideZ, 1 - mux, muy, muz); - collectWeight(idx + atomStrideX + atomStrideY + atomStrideZ, mux, muy, muz); // find dominant atom - - var maxWeight = 0.0; - var dominantIdx = -1; - - for (var atomIdx in atomWeights) { - if (atomWeights[atomIdx] > maxWeight) { - dominantIdx = atomIdx; - maxWeight = atomWeights[atomIdx]; - } - } - - if (dominantIdx < 0 || !visibilitySelector.includesAtom(atomLookup[dominantIdx])) { - // this vertex doesn't belong to visible subset and will be skipped - vMap[i] = -1; - continue; - } - } - - vMap[i] = newVerCount++; // color tri-linear interpolation - - var dx = x < xs ? strideX : 0; - var dy = y < ys ? strideY : 0; - var dz = z < zs ? strideZ : 0; - var c0 = [0, 0, 0]; - var c1 = [0, 0, 0]; - var c2 = [0, 0, 0]; - var c3 = [0, 0, 0]; - idx = colorMap.getDirectIdx(x, y, z); - interp(mux, idx, idx + dx, c0); - interp(mux, idx + dy, idx + dx + dy, c1); - interp(mux, idx + dz, idx + dx + dz, c2); - interp(mux, idx + dy + dz, idx + dx + dy + dz, c3); - var cz0 = [0, 0, 0]; - cz0[0] = (1 - muy) * c0[0] + muy * c1[0]; - cz0[1] = (1 - muy) * c0[1] + muy * c1[1]; - cz0[2] = (1 - muy) * c0[2] + muy * c1[2]; - var cz1 = [0, 0, 0]; - cz1[0] = (1 - muy) * c2[0] + muy * c3[0]; - cz1[1] = (1 - muy) * c2[1] + muy * c3[1]; - cz1[2] = (1 - muy) * c2[2] + muy * c3[2]; - colors[ind] = (1 - muz) * cz0[0] + muz * cz1[0]; - colors[ind + 1] = (1 - muz) * cz0[1] + muz * cz1[1]; - colors[ind + 2] = (1 - muz) * cz0[2] + muz * cz1[2]; - } - - this._colors = colors; - - if (visibilitySelector != null) { - // shift visible vertices towards beginning of array - for (i = 0; i < numVerts; ++i) { - var j = vMap[i]; - - if (j < 0) { - continue; - } // assert: j <= i - - - this._position[j * 3] = this._position[i * 3]; - this._position[j * 3 + 1] = this._position[i * 3 + 1]; - this._position[j * 3 + 2] = this._position[i * 3 + 2]; - this._normals[j * 3] = this._normals[i * 3]; - this._normals[j * 3 + 1] = this._normals[i * 3 + 1]; - this._normals[j * 3 + 2] = this._normals[i * 3 + 2]; - this._colors[j * 3] = this._colors[i * 3]; - this._colors[j * 3 + 1] = this._colors[i * 3 + 1]; - this._colors[j * 3 + 2] = this._colors[i * 3 + 2]; - } // rebuild index list - - - var numTriangles = this._indices.length / 3; - var newTriCount = 0; - - for (i = 0; i < numTriangles; ++i) { - var i0 = vMap[this._indices[3 * i]]; - var i1 = vMap[this._indices[3 * i + 1]]; - var i2 = vMap[this._indices[3 * i + 2]]; - - if (i0 >= 0 && i1 >= 0 && i2 >= 0) { - this._indices[3 * newTriCount] = i0; - this._indices[3 * newTriCount + 1] = i1; - this._indices[3 * newTriCount + 2] = i2; - ++newTriCount; - } - } // shrink arrays to data size - - - this._position = new Float32Array(this._position.buffer.slice(0, newVerCount * 3 * 4)); - this._normals = new Float32Array(this._normals.buffer.slice(0, newVerCount * 3 * 4)); - this._colors = new Float32Array(this._colors.buffer.slice(0, newVerCount * 3 * 4)); - this._indices = new Uint32Array(this._indices.buffer.slice(0, newTriCount * 3 * 4)); - } - } - }, { - key: "toMesh", - value: function toMesh() { - var geo = new THREE.BufferGeometry(); - geo.setIndex(new THREE.BufferAttribute(this._indices, 1)); - geo.setAttribute('position', new THREE.BufferAttribute(this._position, 3)); - geo.setAttribute('normal', new THREE.BufferAttribute(this._normals, 3)); - geo.setAttribute('color', new THREE.BufferAttribute(this._colors, 3)); - geo.computeBoundingSphere(); - return geo; - } - }]); - - return IsoSurface; - }(); - - defineProperty(IsoSurface, "_triTable", IsoSurfaceMarchCube.prototype.striIndicesMarchCube); - - defineProperty(IsoSurface, "_arrSize", 12); - - defineProperty(IsoSurface, "_firstIndices", [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3]); - - defineProperty(IsoSurface, "_secondIndices", [1, 2, 3, 0, 5, 6, 7, 4, 4, 5, 6, 7]); - - defineProperty(IsoSurface, "_vertexList", createArray(IsoSurface._arrSize)); - - defineProperty(IsoSurface, "_normalList", createArray(IsoSurface._arrSize)); - - /** - * This is a base class for volumetric maps based isosurface algorithms. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - - var VolumeSurfaceGeometry = /*#__PURE__*/function (_IsoSurfaceGeometry) { - inherits(VolumeSurfaceGeometry, _IsoSurfaceGeometry); - - function VolumeSurfaceGeometry() { - classCallCheck(this, VolumeSurfaceGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(VolumeSurfaceGeometry).apply(this, arguments)); - } - - createClass(VolumeSurfaceGeometry, [{ - key: "_build", - value: function _build() { - var params = this._opts; - this.numVoxels = [128, 128, 128]; - this.xAxis = new THREE.Vector3(1.0, 0.0, 0.0); - this.yAxis = new THREE.Vector3(0.0, 1.0, 0.0); - this.zAxis = new THREE.Vector3(0.0, 0.0, 1.0); - this.origin = new THREE.Vector3(0.0, 0.0, 0.0); - this._visibilitySelector = params.visibilitySelector; - - this._calcSurface(params); - } - }, { - key: "_findMinMax", - value: function _findMinMax(posRadArray) { - var itemSize = 4; - var itemsCount = posRadArray.length / itemSize; - var maxPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]]; - var minPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]]; - - for (var i = 1; i < itemsCount; ++i) { - var ind = i * itemSize; - - for (var itemIdx = 0; itemIdx < itemSize; ++itemIdx) { - var tmpVal = posRadArray[ind + itemIdx]; - maxPosRad[itemIdx] = Math.max(tmpVal, maxPosRad[itemIdx]); - minPosRad[itemIdx] = Math.min(tmpVal, minPosRad[itemIdx]); - } - } - - return { - maxPosRad: maxPosRad, - minPosRad: minPosRad - }; - } - }, { - key: "_findNumVoxels", - value: function _findNumVoxels(posRadArray, params) { - var numVoxels = this.numVoxels; - - var minMaxValues = this._findMinMax(posRadArray); - - var minCoordRad = minMaxValues.minPosRad; - var maxCoordRad = minMaxValues.maxPosRad; // minrad - - if (minCoordRad[3] > 4.0) { - params.gridSpacing *= minCoordRad[3]; - } - - var gridPadding = params.radScale * maxCoordRad[3] * 1.7; - var padRad = gridPadding; - padRad = 0.65 * Math.sqrt(4.0 / 3.0 * Math.PI * padRad * padRad * padRad); - gridPadding = Math.max(gridPadding, padRad); - var i = 0; - - for (; i < 3; ++i) { - minCoordRad[i] -= gridPadding; - maxCoordRad[i] += gridPadding; - } - - for (i = 0; i < 3; ++i) { - numVoxels[i] = Math.ceil((maxCoordRad[i] - minCoordRad[i]) / params.gridSpacing); - } - - this.xAxis.x = (numVoxels[0] - 1) * params.gridSpacing; - this.yAxis.y = (numVoxels[1] - 1) * params.gridSpacing; - this.zAxis.z = (numVoxels[2] - 1) * params.gridSpacing; - - var _minCoordRad = slicedToArray(minCoordRad, 3); - - this.origin.x = _minCoordRad[0]; - this.origin.y = _minCoordRad[1]; - this.origin.z = _minCoordRad[2]; - return { - bbox: minMaxValues, - dim: numVoxels - }; - } - }, { - key: "_makeSurface", - value: function _makeSurface(surface, params) { - var isoSurf = new IsoSurface(); - isoSurf.compute(surface.volMap, this.origin, params.isoValue, 1); - isoSurf.vertexFusion(9, 9); // normalization is included - - if (isoSurf._numTriangles > 0) { - isoSurf.setColorVolTex(surface.volTexMap, surface.atomMap, surface.atomWeightMap, this._visibilitySelector); - this.setIndex(new THREE.BufferAttribute(isoSurf._indices, 1)); - this.setAttribute('position', new THREE.BufferAttribute(isoSurf._position, 3)); - this.setAttribute('normal', new THREE.BufferAttribute(isoSurf._normals, 3)); - this.setAttribute('color', new THREE.BufferAttribute(isoSurf._colors, 3)); - } else { - // geometry should have at least empty position attributes to be processed in wireframe mode by three.js - this.setAttribute('position', new THREE.BufferAttribute(utils.allocateTyped(Float32Array, 0), 3)); - } - } - }, { - key: "_calcSurface", - value: function _calcSurface(params) { - var packedArrays = { - posRad: this._posRad, - colors: this._colors, - atoms: this._opts.atoms - }; - - if (packedArrays.posRad.length === 0) { - return; - } - - var boundaries = this._findNumVoxels(packedArrays.posRad, params); - - var box = new THREE.Box3(this.origin, new THREE.Vector3(this.xAxis.x, this.yAxis.y, this.zAxis.z).add(this.origin)); - - var surface = this._computeSurface(packedArrays, box, boundaries, params); - - this._makeSurface(surface, params); - } - }]); - - return VolumeSurfaceGeometry; - }(IsoSurfaceGeometry); - - var Volume$1 = chem.Volume; - /** - * This class implements 'quick' isosurface geometry generation algorithm. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - - var QuickSurfGeometry = /*#__PURE__*/function (_VolumeSurfaceGeometr) { - inherits(QuickSurfGeometry, _VolumeSurfaceGeometr); - - function QuickSurfGeometry() { - classCallCheck(this, QuickSurfGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(QuickSurfGeometry).apply(this, arguments)); - } - - createClass(QuickSurfGeometry, [{ - key: "_computeSurface", - value: function _computeSurface(packedArrays, box, boundaries, params) { - // beware of shifting this multiple times! - this._shiftByOrigin(packedArrays.posRad); - - var surface = { - volMap: new Volume$1(Float32Array, this.numVoxels, box), - volTexMap: new Volume$1(Float32Array, this.numVoxels, box, 3) - }; - - if (this._visibilitySelector != null) { - surface.atomMap = []; - surface.atomWeightMap = new Volume$1(Float32Array, this.numVoxels, box); - } - - this.gaussdensity(surface, packedArrays, null, params); - return surface; - } - }, { - key: "gaussdensity", - value: function gaussdensity(surface, packedArrays, atomicNum, params) { - var numAtoms = packedArrays.posRad.length / 4; - var posRad = packedArrays.posRad, - colors = packedArrays.colors; - var numVoxels = this.numVoxels; - var radScale = params.radScale, - gaussLim = params.gaussLim, - gridSpacing = params.gridSpacing; - var invIsoValue = 1.0 / params.isoValue; - var invGridSpacing = 1.0 / gridSpacing; - var maxVoxelX = numVoxels[0] - 1; - var maxVoxelY = numVoxels[1] - 1; - var maxVoxelZ = numVoxels[2] - 1; // TODO is densityMap and volTexMap initialized? - - var volMap = surface.volMap, - volTexMap = surface.volTexMap; - var volData = volMap.getData(); - var strideX = volMap.getStrideX(); - var volTexData = volTexMap.getData(); - var texStrideX = volTexMap.getStrideX(); - var atomWeightData; - - if (this._visibilitySelector != null) { - atomWeightData = surface.atomWeightMap.getData(); - } - - var atomMap = surface.atomMap; - - for (var i = 0; i < numAtoms; ++i) { - var ind = i * 4; - var scaledRad = posRad[ind + 3] * radScale; - var atomicNumFactor = atomicNum === null ? 1.0 : atomicNum[i]; - var radInv = 1 / (2 * scaledRad * scaledRad); - var radLim = gaussLim * scaledRad; - var radLim2 = radLim * radLim; - radLim *= invGridSpacing; - var tmp = posRad[ind] * invGridSpacing; - var xMin = Math.max(tmp - radLim | 0, 0); - var xMax = Math.min(tmp + radLim | 0, maxVoxelX); - tmp = posRad[ind + 1] * invGridSpacing; - var yMin = Math.max(tmp - radLim | 0, 0); - var yMax = Math.min(tmp + radLim | 0, maxVoxelY); - tmp = posRad[ind + 2] * invGridSpacing; - var zMin = Math.max(tmp - radLim | 0, 0); - var zMax = Math.min(tmp + radLim | 0, maxVoxelZ); - var dz = zMin * gridSpacing - posRad[ind + 2]; - - for (var z = zMin; z <= zMax; ++z, dz += gridSpacing) { - var dy = yMin * gridSpacing - posRad[ind + 1]; - - for (var y = yMin; y <= yMax; ++y, dy += gridSpacing) { - var dy2dz2 = dy * dy + dz * dz; - - if (dy2dz2 >= radLim2) { - continue; - } - - var addr = volMap.getDirectIdx(xMin, y, z); - var texAddr = volTexMap.getDirectIdx(xMin, y, z); - var dx = xMin * gridSpacing - posRad[ind]; - - for (var x = xMin; x <= xMax; ++x, dx += gridSpacing, addr += strideX, texAddr += texStrideX) { - var r2 = dx * dx + dy2dz2; - var expVal = -r2 * radInv; - var density = Math.exp(expVal) * atomicNumFactor; // store most relevant atom (with highest density) - - if (this._visibilitySelector != null && density > atomWeightData[addr]) { - // NOSONAR - atomWeightData[addr] = density; // we use same index into atom map and atomWeightMap - - atomMap[addr] = packedArrays.atoms[i]; - } - - volData[addr] += density; // TODO check for volTexMap routine? - - density *= invIsoValue; - var colInd = i * 3; - volTexData[texAddr] += density * colors[colInd]; - volTexData[texAddr + 1] += density * colors[colInd + 1]; - volTexData[texAddr + 2] += density * colors[colInd + 2]; - } - } - } - } - } - }, { - key: "_shiftByOrigin", - value: function _shiftByOrigin(posRadArray) { - var originX = this.origin.x; - var originY = this.origin.y; - var originZ = this.origin.z; - var itemSize = 4; - var itemsCount = posRadArray.length / itemSize; - - for (var i = 0; i < itemsCount; ++i) { - var ind = i * itemSize; - posRadArray[ind] -= originX; - posRadArray[ind + 1] -= originY; - posRadArray[ind + 2] -= originZ; - } - } - }]); - - return QuickSurfGeometry; - }(VolumeSurfaceGeometry); - - /** - * Modifed from SpatialHash - * - * Main differences are: - * - Optimized grid size to ensure we only ever need to look +/-1 cell - * - Aware of atomic radii and will only output atoms within rAtom + rExtra - * (see withinRadii method) - * - * (Uses rounding rather than bitshifting as consequence of arbitrary grid size) - * @class - * @param {Float32Array} posRad - x, y, z coordinates and radiuses - * @param {Float32Array} min - xyz min coordinates - * @param {Float32Array} max - xyz max coordinates - * @param {number} maxDistance - max distance - */ - - function AVHash(posRad, min, max, maxDistance) { - var itemSize = 4; - var nAtoms = posRad.length / itemSize; - var minX = min[0]; - var minY = min[1]; - var minZ = min[2]; - var maxX = max[0]; - var maxY = max[1]; - var maxZ = max[2]; - - function hashFunc(w, minW) { - return Math.floor((w - minW) / maxDistance); - } - - var iDim = hashFunc(maxX, minX) + 1; - var jDim = hashFunc(maxY, minY) + 1; - var kDim = hashFunc(maxZ, minZ) + 1; - var nCells = iDim * jDim * kDim; - var jkDim = jDim * kDim; - /* Get cellID for cartesian x,y,z */ - - var cellID = function cellID(x, y, z) { - return (hashFunc(x, minX) * jDim + hashFunc(y, minY)) * kDim + hashFunc(z, minZ); - }; - /* Initial building, could probably be optimized further */ - - - var preHash = []; - var i; - var cid; - - for (i = 0; i < nAtoms; i++) { - var iIdx = itemSize * i; - cid = cellID(posRad[iIdx], posRad[iIdx + 1], posRad[iIdx + 2]); - - if (preHash[cid] === undefined) { - preHash[cid] = [i]; - } else { - preHash[cid].push(i); - } - } - - var cellOffsets = utils.allocateTyped(Uint32Array, nCells); - var cellLengths = utils.allocateTyped(Uint16Array, nCells); - var data = utils.allocateTyped(Uint32Array, nAtoms); - var offset = 0; - var maxCellLength = 0; - var j; - - for (i = 0; i < nCells; i++) { - var start = cellOffsets[i] = offset; - var subArray = preHash[i]; - - if (subArray !== undefined) { - for (j = 0; j < subArray.length; j++) { - data[offset] = subArray[j]; - offset++; - } - } - - var cellLength = offset - start; - cellLengths[i] = cellLength; - - if (cellLength > maxCellLength) { - maxCellLength = cellLength; - } - } // Maximum number of neighbours we could ever produce (27 adjacent cells of equal population) - - - this.neighbourListLength = 27 * maxCellLength + 1; - /** - * Populate the supplied out array with atom indices that are within rAtom + rExtra - * of x,y,z - * - * -1 in out array indicates the end of the list - * - * @param {number} x - x coordinate - * @param {number} y - y coordinate - * @param {number} z - z coordinate - * @param {number} rExtra - additional radius - * @param {Float32Array} out - pre-allocated output array - * @return {undefined} - */ - - this.withinRadii = function (x, y, z, rExtra, out) { - var outIdx = 0; - var nearI = hashFunc(x, minX); - var nearJ = hashFunc(y, minY); - var nearK = hashFunc(z, minZ); - var loI = Math.max(0, nearI - 1); - var loJ = Math.max(0, nearJ - 1); - var loK = Math.max(0, nearK - 1); - var hiI = Math.min(iDim - 1, nearI + 1); - var hiJ = Math.min(jDim - 1, nearJ + 1); - var hiK = Math.min(kDim - 1, nearK + 1); - - for (i = loI; i <= hiI; ++i) { - var iOffset = i * jkDim; - - for (j = loJ; j <= hiJ; ++j) { - var jOffset = j * kDim; - - for (var k = loK; k <= hiK; ++k) { - cid = iOffset + jOffset + k; - var cellStart = cellOffsets[cid]; - var cellEnd = cellStart + cellLengths[cid]; - - for (var dataIndex = cellStart; dataIndex < cellEnd; dataIndex++) { - var atomIndex = data[dataIndex]; - var baseIndex = itemSize * atomIndex; - var dx = posRad[baseIndex] - x; - var dy = posRad[baseIndex + 1] - y; - var dz = posRad[baseIndex + 2] - z; - var rSum = posRad[baseIndex + 3] + rExtra; - - if (dx * dx + dy * dy + dz * dz <= rSum * rSum) { - out[outIdx++] = data[dataIndex]; - } - } - } - } - } // Add terminator - - - out[outIdx] = -1; - }; - } - - function ContactSurface(packedArrays, boundaries, params, _indexList) { - // Field generation method adapted from AstexViewer (Mike Hartshorn) - // by Fred Ludlow. - // Other parts based heavily on NGL (Alexander Rose) EDT Surface class - // - // Should work as a drop-in alternative to EDTSurface (though some of - // the EDT paramters are not relevant in this method). - var itemSize = 4; - var posRad = packedArrays.posRad, - colors = packedArrays.colors, - atoms = packedArrays.atoms; - var nAtoms = posRad.length / itemSize; - var bbox = boundaries.bbox; - var min = bbox.minPosRad; - var max = bbox.maxPosRad; - var r2; // Atom positions, expanded radii (squared) - - var maxRadius; // Parameters - - var probeRadius; - var scaleFactor; - var probePositions; // Cache last value for obscured test - - var lastClip = -1; // Grid params - - var dim; - var grid; - var volTex; - var weights; - var weightsMap = null; - var atomMap = null; - var visibilitySelector = null; // grid indices -> xyz coords - - var gridx; - var gridy; - var gridz; // Lookup tables: - - var sinTable; - var cosTable; // Spatial Hash - - var hash; // Neighbour array to be filled by hash - - var neighbours; // Vectors for Torus Projection - - var mid = new THREE.Vector3(0.0, 0.0, 0.0); - var n1 = new THREE.Vector3(0.0, 0.0, 0.0); - var n2 = new THREE.Vector3(0.0, 0.0, 0.0); - var ngTorus; - - function uniformArray(TypeName, n, a) { - var array = utils.allocateTyped(TypeName, n); - - for (var innI = 0; innI < n; ++innI) { - array[innI] = a; - } - - return array; - } - - function fillGridDim(a, start, step) { - for (var innI = 0; innI < a.length; innI++) { - a[innI] = start + step * innI; - } - } - - function initializeGrid() { - scaleFactor = params.scaleFactor; - dim = boundaries.dim; - ngTorus = Math.min(5, 2 + Math.floor(probeRadius * scaleFactor)); - var gridSize = dim[0] * dim[1] * dim[2]; - grid = uniformArray(Float32Array, gridSize, -1001.0); - volTex = utils.allocateTyped(Float32Array, gridSize * 3); - weights = utils.allocateTyped(Float32Array, gridSize); - - if (visibilitySelector) { - weightsMap = utils.allocateTyped(Float32Array, gridSize); - atomMap = []; - } - - gridx = utils.allocateTyped(Float32Array, dim[0]); - gridy = utils.allocateTyped(Float32Array, dim[1]); - gridz = utils.allocateTyped(Float32Array, dim[2]); - fillGridDim(gridx, min[0], 1 / scaleFactor); - fillGridDim(gridy, min[1], 1 / scaleFactor); - fillGridDim(gridz, min[2], 1 / scaleFactor); - } - - function initializeAngleTables() { - var theta = 0.0; - var step = 2 * Math.PI / probePositions; - cosTable = utils.allocateTyped(Float32Array, probePositions); - sinTable = utils.allocateTyped(Float32Array, probePositions); - - for (var innI = 0; innI < probePositions; innI++) { - cosTable[innI] = Math.cos(theta); - sinTable[innI] = Math.sin(theta); - theta += step; - } - } - - function initializeHash() { - hash = new AVHash(posRad, min, max, 2.01 * maxRadius); - neighbours = new Int32Array(hash.neighbourListLength); - } - - function init() { - probeRadius = params.probeRadius; - scaleFactor = params.scaleFactor; - probePositions = params.probePositions; - visibilitySelector = params.visibilitySelector; - r2 = utils.allocateTyped(Float32Array, nAtoms); - maxRadius = 0; - - for (var innI = 0; innI < nAtoms; ++innI) { - var rExt = posRad[innI * itemSize + 3] += probeRadius; - - if (rExt > maxRadius) { - maxRadius = rExt; - } - - r2[innI] = rExt * rExt; - } - - initializeGrid(); - initializeAngleTables(); - initializeHash(); - lastClip = -1; - } - - function singleAtomObscures(ai, innX, innY, innZ) { - var innCI = itemSize * ai; - var ra2 = r2[ai]; - var dx = posRad[innCI] - innX; - var dy = posRad[innCI + 1] - innY; - var dz = posRad[innCI + 2] - innZ; - var d2 = dx * dx + dy * dy + dz * dz; - return d2 < ra2; - } - - function obscured(innX, innY, innZ, a, b) { - // Is the point at x,y,z obscured by any of the atoms - // specifeid by indices in neighbours. Ignore indices - // a and b (these are the relevant atoms in projectPoints/Torii) - // Cache the last clipped atom (as very often the same one in - // subsequent calls) - var ai; - - if (lastClip !== -1) { - ai = lastClip; - - if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) { - return ai; - } - - lastClip = -1; - } - - var ni = 0; - ai = neighbours[ni]; - - while (ai >= 0) { - if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) { - lastClip = ai; - return ai; - } - - ai = neighbours[++ni]; - } - - lastClip = -1; - return -1; - } - - function projectPoints() { - // For each atom: - // Iterate over a subsection of the grid, for each point: - // If current value < 0.0, unvisited, set positive - // - // In any case: Project this point onto surface of the atomic sphere - // If this projected point is not obscured by any other atom - // Calcualte delta distance and set grid value to minimum of - // itself and delta - // Should we alias frequently accessed closure constiables?? - // Assume JS engine capable of optimizing this - // anyway... - var maxRad = 4.0; - var sigma = maxRad / 3; - var sigma2Inv = 1 / (2 * sigma * sigma); - - for (var innI = 0; innI < nAtoms; innI++) { - var innCI = itemSize * innI; - var ax = posRad[innCI]; - var ay = posRad[innCI + 1]; - var az = posRad[innCI + 2]; - var ar = posRad[innCI + 3]; - var ar2 = r2[innI]; - hash.withinRadii(ax, ay, az, ar, neighbours); // Number of grid points, round this up... - - var ng = Math.ceil(ar * scaleFactor); // Center of the atom, mapped to grid points (take floor) - - var iax = Math.floor(scaleFactor * (ax - min[0])); - var iay = Math.floor(scaleFactor * (ay - min[1])); - var iaz = Math.floor(scaleFactor * (az - min[2])); // Extents of grid to consider for this atom - - var minx = Math.max(0, iax - ng); - var miny = Math.max(0, iay - ng); - var minz = Math.max(0, iaz - ng); // Add two to these points: - // - iax are floor'd values so this ensures coverage - // - these are loop limits (exclusive) - - var maxx = Math.min(dim[0], iax + ng + 2); - var maxy = Math.min(dim[1], iay + ng + 2); - var maxz = Math.min(dim[2], iaz + ng + 2); - var colIdx = innI * 3; - var cr = colors[colIdx]; - var cg = colors[colIdx + 1]; - var cb = colors[colIdx + 2]; - - for (var iz = minz; iz < maxz; iz++) { - var dz = gridz[iz] - az; - var zOffset = dim[1] * dim[0] * iz; - - for (var iy = miny; iy < maxy; iy++) { - var dy = gridy[iy] - ay; - var dzy2 = dz * dz + dy * dy; - var zyOffset = zOffset + dim[0] * iy; - - for (var ix = minx; ix < maxx; ix++) { - var idx = ix + zyOffset; - var dx = gridx[ix] - ax; - var d2 = dzy2 + dx * dx; - - if (d2 < ar2) { - var w = Math.exp(-d2 * sigma2Inv); - var cIdx = idx * 3; - volTex[cIdx] += cr * w; - volTex[cIdx + 1] += cg * w; - volTex[cIdx + 2] += cb * w; - weights[idx] += w; - - if (visibilitySelector !== null && w > weightsMap[idx]) { - weightsMap[idx] = w; - atomMap[idx] = atoms[innI]; - } - - if (grid[idx] < 0.0) { - // Unvisited, make positive - grid[idx] = -grid[idx]; - } // Project on to the surface of the sphere - // sp is the projected point ( dx, dy, dz ) * ( ra / d ) - - - var d = Math.sqrt(d2); - var ap = ar / d; - var spx = dx * ap; - var spy = dy * ap; - var spz = dz * ap; - spx += ax; - spy += ay; - spz += az; - - if (obscured(spx, spy, spz, innI, -1) === -1) { - var dd = ar - d; - - if (dd < grid[idx]) { - grid[idx] = dd; - } - } - } - } - } - } - } - } - - function normalToLine(out, p) { - out.x = out.y = out.z = 1.0; - - if (p.x !== 0) { - out.x = (p.y + p.z) / -p.x; - } else if (p.y !== 0) { - out.y = (p.x + p.z) / -p.y; - } else if (p.z !== 0) { - out.z = (p.x + p.y) / -p.z; - } - - return out; - } - - function projectTorus(a, b) { - var aIdx = itemSize * a; - var bIdx = itemSize * b; - var xa = posRad[aIdx]; - var ya = posRad[aIdx + 1]; - var za = posRad[aIdx + 2]; - var r1 = posRad[aIdx + 3]; - var dx = mid.x = posRad[bIdx] - xa; - var dy = mid.y = posRad[bIdx + 1] - ya; - var dz = mid.z = posRad[bIdx + 2] - za; - var innR2 = posRad[bIdx + 3]; - var d2 = dx * dx + dy * dy + dz * dz; // This check now redundant as already done in AVHash.withinRadii - // if( d2 > (( r1 + r2 ) * ( r1 + r2 )) ){ return; } - - var d = Math.sqrt(d2); // Find angle between a->b vector and the circle - // of their intersection by cosine rule - - var cosA = (r1 * r1 + d * d - innR2 * innR2) / (2.0 * r1 * d); // distance along a->b at intersection - - var dmp = r1 * cosA; - mid.normalize(); // Create normal to line - - normalToLine(n1, mid); - n1.normalize(); // Cross together for second normal vector - - n2.crossVectors(mid, n1); - n2.normalize(); // r is radius of circle of intersection - - var rInt = Math.sqrt(r1 * r1 - dmp * dmp); - n1.multiplyScalar(rInt); - n2.multiplyScalar(rInt); - mid.multiplyScalar(dmp); - mid.x += xa; - mid.y += ya; - mid.z += za; - lastClip = -1; - var ng = ngTorus; - - for (var innI = 0; innI < probePositions; innI++) { - var cost = cosTable[innI]; - var sint = sinTable[innI]; - var px = mid.x + cost * n1.x + sint * n2.x; - var py = mid.y + cost * n1.y + sint * n2.y; - var pz = mid.z + cost * n1.z + sint * n2.z; - - if (obscured(px, py, pz, a, b) === -1) { - // As above, iterate over our grid... - // px, py, pz in grid coords - var iax = Math.floor(scaleFactor * (px - min[0])); - var iay = Math.floor(scaleFactor * (py - min[1])); - var iaz = Math.floor(scaleFactor * (pz - min[2])); - var minx = Math.max(0, iax - ng); - var miny = Math.max(0, iay - ng); - var minz = Math.max(0, iaz - ng); - var maxx = Math.min(dim[0], iax + ng + 2); - var maxy = Math.min(dim[1], iay + ng + 2); - var maxz = Math.min(dim[2], iaz + ng + 2); - - for (var iz = minz; iz < maxz; iz++) { - dz = pz - gridz[iz]; - var zOffset = dim[1] * dim[0] * iz; - - for (var iy = miny; iy < maxy; iy++) { - dy = py - gridy[iy]; - var dzy2 = dz * dz + dy * dy; - var zyOffset = zOffset + dim[0] * iy; - - for (var ix = minx; ix < maxx; ix++) { - dx = px - gridx[ix]; - d2 = dzy2 + dx * dx; - var idx = ix + zyOffset; - var current = grid[idx]; - - if (current > 0.0 && d2 < current * current) { - grid[idx] = Math.sqrt(d2); - } - } - } - } - } - } - } - - function projectTorii() { - for (var innI = 0; innI < nAtoms; innI++) { - var innIdx = itemSize * innI; - hash.withinRadii(posRad[innIdx], posRad[innIdx + 1], posRad[innIdx + 2], posRad[innIdx + 3], neighbours); - var ia = 0; - var ni = neighbours[ia]; - - while (ni >= 0) { - if (innI < ni) { - projectTorus(innI, ni); - } - - ni = neighbours[++ia]; - } - } - } - - function fixNegatives() { - for (var innI = 0, n = grid.length; innI < n; innI++) { - if (grid[innI] < 0) grid[innI] = 0; - var w = weights[innI]; - - if (w > 0) { - w = 1 / w; - var innInnI = innI * 3; - volTex[innInnI] *= w; - volTex[innInnI + 1] *= w; - volTex[innInnI + 2] *= w; - } - } - } - - function getVolume() { - // Basic steps are: - // 1) Initialize - // 2) Project points - // 3) Project torii - console.time('ContactSurface.getVolume'); - console.time('ContactSurface.init'); - init(); - console.timeEnd('ContactSurface.init'); - console.time('ContactSurface.projectPoints'); - projectPoints(); - console.timeEnd('ContactSurface.projectPoints'); - console.time('ContactSurface.projectTorii'); - projectTorii(); - console.timeEnd('ContactSurface.projectTorii'); - fixNegatives(); - console.timeEnd('ContactSurface.getVolume'); - } - - this.build = function () { - // type and cutoff left in for compatibility with EDTSurface.getSurface - // function signature - getVolume(); - this.volTexMap = volTex; - this.weightsMap = weightsMap; - this.atomMap = atomMap; - this.volMap = grid; - }; - } - - var Volume$2 = chem.Volume; - /** - * This class implements 'contact' isosurface geometry generation algorithm. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - - var ContactSurfaceGeometry = /*#__PURE__*/function (_VolumeSurfaceGeometr) { - inherits(ContactSurfaceGeometry, _VolumeSurfaceGeometr); - - function ContactSurfaceGeometry() { - classCallCheck(this, ContactSurfaceGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(ContactSurfaceGeometry).apply(this, arguments)); - } - - createClass(ContactSurfaceGeometry, [{ - key: "_computeSurface", - value: function _computeSurface(packedArrays, box, boundaries, params) { - var contactSurface = new ContactSurface(packedArrays, boundaries, params); - contactSurface.build(); - var surface = { - volMap: new Volume$2(Float32Array, this.numVoxels, box, 1, contactSurface.volMap), - volTexMap: new Volume$2(Float32Array, this.numVoxels, box, 3, contactSurface.volTexMap), - atomMap: contactSurface.atomMap, - atomWeightMap: new Volume$2(Float32Array, this.numVoxels, box, 1, contactSurface.weightsMap) - }; - return surface; - } - }]); - - return ContactSurfaceGeometry; - }(VolumeSurfaceGeometry); - - /** - * Class for colored atom. Need for atom structure clusterization - * - * @param {Vector3} vCenter Center of atom - * @param {number} radiusAt Radius of atom - */ - - var IsoSurfaceAtomColored = function IsoSurfaceAtomColored(vCenter, radiusAt) { - classCallCheck(this, IsoSurfaceAtomColored); - - this.coord = new THREE.Vector3(); - this.coord.copy(vCenter); - this.radius = radiusAt; - this.colorX = 0.99999; - this.colorY = 0.0; - this.colorZ = 0.0; - this.atomType = 0; - this.srcAtom = null; - }; - - /* jshint bitwise: false */ - - /** - * Build normals for isosurface, using atoms information - * - * @param {number} numAtoms - Number of atoms in molecule - * @param {Element} atoms - Array of atoms - * @param {Vector3} vBoxMin - Bounding box min - * @param {Vector3} vBoxMax - Bounding box max - * @param {number} probeRadius - Normals for output - * - */ - - var IsosurfaceBuildNormals = /*#__PURE__*/function () { - function IsosurfaceBuildNormals(numAtoms, atoms, vBoxMin, vBoxMax, probeRadius) { - classCallCheck(this, IsosurfaceBuildNormals); - - this._numAtoms = numAtoms; - this._atoms = atoms; - this._vBoxMin = new THREE.Vector3(); - this._vBoxMax = new THREE.Vector3(); - - this._vBoxMin.copy(vBoxMin); - - this._vBoxMax.copy(vBoxMax); - - this._probeRadius = probeRadius; - this._atomsList = null; - this._voxelList = null; - } - - createClass(IsosurfaceBuildNormals, [{ - key: "createVoxels", - value: function createVoxels() { - var numAtomsRefs; - var rad; - var ATOM_VOXEL_REF_SCALE = 4.5; - var numAtoms = this._numAtoms | 0; - var atoms = this._atoms; - var dx = this._vBoxMax.x - this._vBoxMin.x; - var dy = this._vBoxMax.y - this._vBoxMin.y; - var dz = this._vBoxMax.z - this._vBoxMin.z; - var w = dx < dy ? dx : dy; - w = dz < w ? dz : w; - var maxRad = 0.0; - var aveRad = 0.0; - var i; - - for (i = 0; i < numAtoms; i++) { - rad = (atoms[i].radius + this._probeRadius) * 2.0; - maxRad = rad > maxRad ? rad : maxRad; - aveRad += rad; - } - - var numCells = Math.floor(w / maxRad); - - if (numCells < 2) { - numCells = 2; - } - - aveRad /= numAtoms; - this._numCells = numCells; - this._aveRad = aveRad; - this._maxRad = maxRad; - var side = numCells; - var side2 = numCells * numCells; - var side3 = numCells * numCells * numCells; - var xScale = this._xScale = 1.0 / (this._vBoxMax.x - this._vBoxMin.x); - var yScale = this._yScale = 1.0 / (this._vBoxMax.y - this._vBoxMin.y); - var zScale = this._zScale = 1.0 / (this._vBoxMax.z - this._vBoxMin.z); // estimate number of individual atom refs in each voxel list - - var maxAtomsRefs = 0; - var xNumVoxMult = xScale * numCells; - var yNumVoxMult = yScale * numCells; - var zNumVoxMult = zScale * numCells; - - for (i = 0; i < numAtoms; i++) { - var radAffect = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE; - var diaAffect = radAffect * 2.0; - var numVoxX = Math.floor(xNumVoxMult * diaAffect + 0.8); - var numVoxY = Math.floor(yNumVoxMult * diaAffect + 0.8); - var numVoxZ = Math.floor(zNumVoxMult * diaAffect + 0.8); // avoid case numVox? == 0 - // also use loop i <= - - numVoxX++; - numVoxY++; - numVoxZ++; - maxAtomsRefs += numVoxX * numVoxY * numVoxZ; - } // for (i) - // maxAtomsRefs = numAtoms * MAX_ATOMS_IN_SINGLE_VOXEL; - - - this._voxelList = utils.allocateTyped(Int32Array, side3); - var atomsList = []; - atomsList.length = maxAtomsRefs; - - if (this._voxelList === null || atomsList === null) { - return 0 - 1; - } // init voxel list - - - for (i = 0; i < side3; i++) { - this._voxelList[i] = -1; - } - - numAtomsRefs = 0; // create voxel lists - - for (i = 0; i < numAtoms; i++) { - // use multiplier 4 to locate this atom in different voxels - rad = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE; - var xIndMin = Math.floor((atoms[i].coord.x - this._vBoxMin.x - rad) * numCells * xScale); - var yIndMin = Math.floor((atoms[i].coord.y - this._vBoxMin.y - rad) * numCells * yScale); - var zIndMin = Math.floor((atoms[i].coord.z - this._vBoxMin.z - rad) * numCells * zScale); - var xIndMax = Math.floor((atoms[i].coord.x - this._vBoxMin.x + rad) * numCells * xScale); - var yIndMax = Math.floor((atoms[i].coord.y - this._vBoxMin.y + rad) * numCells * yScale); - var zIndMax = Math.floor((atoms[i].coord.z - this._vBoxMin.z + rad) * numCells * zScale); - xIndMin = xIndMin >= 0 ? xIndMin : 0; - yIndMin = yIndMin >= 0 ? yIndMin : 0; - zIndMin = zIndMin >= 0 ? zIndMin : 0; - xIndMax = xIndMax < numCells ? xIndMax : numCells - 1; - yIndMax = yIndMax < numCells ? yIndMax : numCells - 1; - zIndMax = zIndMax < numCells ? zIndMax : numCells - 1; - - for (var z = zIndMin; z <= zIndMax; z++) { - for (var y = yIndMin; y <= yIndMax; y++) { - for (var x = xIndMin; x <= xIndMax; x++) { - // add atom with index "i" to this voxel list - var indVoxel = x + y * side + z * side2; // assert indVoxel >= 0 - // assert indVoxel < side3 - // add first - - if (this._voxelList[indVoxel] < 0) { - atomsList[numAtomsRefs * 2 + 0] = i; - atomsList[numAtomsRefs * 2 + 1] = 0 - 1; - this._voxelList[indVoxel] = numAtomsRefs; - numAtomsRefs++; // assert numAtomsRefs < maxAtomsRefs - 1 - - continue; - } // insert into head of list - - - var indexNext = this._voxelList[indVoxel]; - this._voxelList[indVoxel] = numAtomsRefs; - atomsList[numAtomsRefs * 2 + 0] = i; - atomsList[numAtomsRefs * 2 + 1] = indexNext; - numAtomsRefs++; - } // for (x) - - } // for (y) - - } // for (z) - - } // for (i) - // convert Array to Int32Array - - - this._atomsList = Int32Array.from(atomsList); - return 0; - } - }, { - key: "destroyVoxels", - value: function destroyVoxels() { - this._atomsList = null; - this._voxelList = null; - this._atoms = null; - this._vertices = null; - this._vBoxMin = null; - this._vBoxMax = null; - } - /** - * Enumerate all atoms affecting specified point - * - * @param {Vector3} point - point in 3D - * @param {func(atom)} process - function to call for each atom - */ - - }, { - key: "forEachRelatedAtom", - value: function forEachRelatedAtom(point, process) { - // find corresponding voxel - var xInd = Math.floor((point.x - this._vBoxMin.x) * this._numCells * this._xScale); - var yInd = Math.floor((point.y - this._vBoxMin.y) * this._numCells * this._yScale); - var zInd = Math.floor((point.z - this._vBoxMin.z) * this._numCells * this._zScale); - var indVoxel = xInd + yInd * this._numCells + zInd * this._numCells * this._numCells; // run through atoms affecting this voxel - - var atoms = this._atoms; - - for (var ref = this._voxelList[indVoxel]; ref >= 0; ref = this._atomsList[ref * 2 + 1]) { - var indexAtom = this._atomsList[ref * 2]; - process(atoms[indexAtom]); - } - } - /** - * Get atom closest to specified point - * - * @param {Vector3} point - point in 3D - * - * @returns {IsoSurfaceAtomColored} atom, or null if not found - */ - - }, { - key: "getClosestAtom", - value: function getClosestAtom(point) { - var closest = null; - var minDist2 = Number.MAX_VALUE; - this.forEachRelatedAtom(point, function (atom) { - var dist2 = point.distanceToSquared(atom.coord); - - if (dist2 < minDist2) { - minDist2 = dist2; - closest = atom; - } - }); - return closest; - } - /** - * Build normals for isosurface, using atoms information - * - * @param {number} numVertices - Number of vertices in final geometry (to render) - * @param {Vector3} vertices - Geometry vertices (3d coordinates array) - * @param {Vector3} normals - Normals for output - * - * @returns {number} 0, if success - */ - - }, { - key: "buildNormals", - value: function buildNormals(numVertices, vertices, normals) { - var self = this; - var numCloseAtoms = 0; - var vx = 0; - var vy = 0; - var vz = 0; - var dist2; - var vNormalX = 0; - var vNormalY = 0; - var vNormalZ = 0; - var koef = 0; - var w = 0; - var r25 = 2.5; - var r01 = 0.1; - var maxRadAffect = this._aveRad * r25; - var maxRadAffect2 = maxRadAffect * maxRadAffect; - var expScale = -this._aveRad * r01; // some stats - // numSlowAtoms = 0; - - var gatherNormals = function gatherNormals(atom) { - var dx = vx - atom.coord.x; - var dy = vy - atom.coord.y; - var dz = vz - atom.coord.z; - dist2 = dx * dx + dy * dy + dz * dz; - - if (dist2 > maxRadAffect2) { - return; - } // get weight for gaussian smoothing - - - var rad = atom.radius + self._probeRadius; - koef = dist2 - rad * rad; - - if (koef < 0.0) { - koef = -koef; - } - - w = Math.exp(expScale * koef); - vNormalX += dx * w; - vNormalY += dy * w; - vNormalZ += dz * w; - numCloseAtoms++; - }; - - for (var i = 0; i < numVertices; i++) { - vx = vertices[i].x; - vy = vertices[i].y; - vz = vertices[i].z; - numCloseAtoms = 0; - vNormalX = vNormalY = vNormalZ = 0.0; - this.forEachRelatedAtom(vertices[i], gatherNormals); - - dist2 = vNormalX * vNormalX + vNormalY * vNormalY + vNormalZ * vNormalZ; - - if (numCloseAtoms > 0) { - koef = 1.0 / Math.sqrt(dist2); - vNormalX *= koef; - vNormalY *= koef; - vNormalZ *= koef; - } - - normals[i].x = vNormalX; - normals[i].y = vNormalY; - normals[i].z = vNormalZ; - } // for (i) all vertices - - - return 0; - } - /** - * Build vertex colors for isosurface, using atoms information - * - * @param {number} numVertices - Number of vertices in final geometry (to render) - * @param {Vector3} vertices - Geometry vertices (3d coordinates array) - * @param {Vector3} colors - Colors for output - * @param {number} radiusColorSmoothness - Radius of smoothness sphere - * - * @returns {number} 0, if success - */ - - }, { - key: "buildColors", - value: function buildColors(numVertices, vertices, colors, radiusColorSmoothness) { - var self = this; - var vx = 0.0; - var vy = 0.0; - var vz = 0.0; - var koef = 0.0; - var w = 0.0; - var KOEF_ADD = 0.8; - var maxRadAffect = radiusColorSmoothness; - var maxRadAffect2 = maxRadAffect * maxRadAffect; - var colorsClose = []; - var weights = []; - var weightsSum = 0; - - var gatherColors = function gatherColors(atom) { - var dx = vx - atom.coord.x; - var dy = vy - atom.coord.y; - var dz = vz - atom.coord.z; - var dist2 = dx * dx + dy * dy + dz * dz; - - if (dist2 > maxRadAffect2) { - return; - } // get weight for gaussian smoothing - - - var rad = atom.radius + self._probeRadius; - koef = dist2 - rad * rad; - - if (koef < 0.0) { - koef = -koef; - } - - w = 1.0 / (KOEF_ADD + koef); - colorsClose.push([atom.colorX, atom.colorY, atom.colorZ]); - weights.push(w); // save weights for use - - weightsSum += w; // calc sum of weights fo further normalization - }; // process all vertices, one by one - - - for (var i = 0; i < numVertices; i++) { - vx = vertices[i].x; - vy = vertices[i].y; - vz = vertices[i].z; - colorsClose = []; - weights = []; - weightsSum = 0; - this.forEachRelatedAtom(vertices[i], gatherColors); // normalized weighted sum of colors - - for (var j = 0; j < colorsClose.length; ++j) { - var weightNormalized = weights[j] / weightsSum; - colors[i].x += colorsClose[j][0] * weightNormalized; - colors[i].y += colorsClose[j][1] * weightNormalized; - colors[i].z += colorsClose[j][2] * weightNormalized; - } - } // for (i) all vertices - - - return 0; - } - }]); - - return IsosurfaceBuildNormals; - }(); - - /** - * Class for geometry (triangle mesh) representation - * - * - * @param {number} maxNumVertices Maximum possible number of vertices in mesh - * @param {number} maxNumTriangles Maximum possible number of triangles in mesh - * @param {boolean} needVertexColors Obvious - */ - - var IsoSurfaceGeo = /*#__PURE__*/function () { - function IsoSurfaceGeo(maxNumVertices, maxNumTriangles, needVertexColors) { - classCallCheck(this, IsoSurfaceGeo); - - this._maxNumVertices = maxNumVertices; - this._maxNumTriangles = maxNumTriangles; - this._vertices = new Array(maxNumVertices); - this._normals = new Array(maxNumVertices); - this._colors = null; - - if (needVertexColors) { - this._colors = new Array(maxNumVertices); - } - - this._indices = new Array(maxNumTriangles * (1 + 2)); - this._numVertices = 0; - this._numTriangles = 0; - var i; - - for (i = 0; i < maxNumVertices; i++) { - this._vertices[i] = new THREE.Vector3(); - this._normals[i] = new THREE.Vector3(); - } - - for (i = 0; i < maxNumTriangles * (1 + 2); i++) { - this._indices[i] = -1; - } - - if (needVertexColors) { - for (i = 0; i < maxNumVertices; i++) { - this._colors[i] = new THREE.Vector3(); - } - } - } - - createClass(IsoSurfaceGeo, [{ - key: "destroy", - value: function destroy() { - this._vertices = null; - this._normals = null; - this._indices = null; - } - }]); - - return IsoSurfaceGeo; - }(); - - var COLOR_SIZE$3 = 3; - var HASH_SIZE = 32768; - var Element$1 = chem.Element; - /** - * This class implements 'quick' isosurface geometry generation algorithm. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - - var SSIsosurfaceGeometry = /*#__PURE__*/function (_IsoSurfaceGeometry) { - inherits(SSIsosurfaceGeometry, _IsoSurfaceGeometry); - - function SSIsosurfaceGeometry() { - classCallCheck(this, SSIsosurfaceGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(SSIsosurfaceGeometry).apply(this, arguments)); - } - - createClass(SSIsosurfaceGeometry, [{ - key: "_build", - value: function _build() { - // convert geoOut into arrays of positions, indices, normals - this._innerBuild(); - - var geoOut = this.getGeo(); - this.destroy(); - - this._fromGeo(geoOut); - } - }, { - key: "_fromGeo", - value: function _fromGeo(geoOut) { - var colors = null; - var positions = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); - var normals = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); - - if (geoOut._colors !== null) { - colors = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); - } - - var indices = utils.allocateTyped(Uint32Array, (1 + 2) * geoOut._numTriangles); - - for (var i = 0, j = 0; i < geoOut._numVertices; i++) { - positions[j + 0] = geoOut._vertices[i].x; - positions[j + 1] = geoOut._vertices[i].y; - positions[j + 2] = geoOut._vertices[i].z; - normals[j + 0] = geoOut._normals[i].x; - normals[j + 1] = geoOut._normals[i].y; - normals[j + 2] = geoOut._normals[i].z; - j += 3; - } - - if (colors !== null) { - for (var _i = 0, _j = 0; _i < geoOut._numVertices; _i++, _j += 3) { - colors[_j + 0] = geoOut._colors[_i].x; - colors[_j + 1] = geoOut._colors[_i].y; - colors[_j + 2] = geoOut._colors[_i].z; - } - } - - var numTri3 = geoOut._numTriangles * (1 + 2); - - for (var _i2 = 0; _i2 < numTri3; _i2++) { - indices[_i2] = geoOut._indices[_i2]; - } - - this.setIndex(new THREE.BufferAttribute(indices, 1)); - this.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - this.setAttribute('normal', new THREE.BufferAttribute(normals, 3)); - this.setAttribute('color', new THREE.BufferAttribute(colors, 3)); - this.computeBoundingBox(); - this.computeBoundingSphere(); - geoOut.destroy(); - } - }, { - key: "convertToAtomsColored", - value: function convertToAtomsColored(packedArrays, atomsColored) { - var atoms = packedArrays.atoms, - colors = packedArrays.colors; - - for (var i = 0, numAtoms = atoms.length; i < numAtoms; i++) { - var vCenter = atoms[i].position; - var radius = atoms[i].element.radius; - atomsColored[i] = new IsoSurfaceAtomColored(vCenter, radius); - var nm = atoms[i].element.number; - atomsColored[i].atomType = this.getType(nm); - var cIdx = COLOR_SIZE$3 * i; - atomsColored[i].colorX = colors[cIdx++]; - atomsColored[i].colorY = colors[cIdx++]; - atomsColored[i].colorZ = colors[cIdx]; - atomsColored[i].srcAtom = atoms[i]; - } - } - }, { - key: "getGeo", - value: function getGeo() { - return this.geoOut; - } - }, { - key: "destroy", - value: function destroy() { - this.atoms = null; - this.hashLines = null; - this.hashEntries = null; - } - /** - * Calculates bounding box for array with spheres (atoms) - * - * @param {Object} atoms Atoms array - * @param {Vector3} vBoxMin Bounding box min point - * @param {Vector3} vBoxMax Bounding box max point - */ - - }, { - key: "getBoundingBox", - value: function getBoundingBox(atoms, vBoxMin, vBoxMax) { - var bigNum = 10000000.0; - vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum; - vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum; - var probeRadius2 = this.probeRadius * this.atomRadiusScale; - var radMax = 0.0; - - for (var i = 0, num = atoms.length; i < num; i++) { - var vCenter = atoms[i].coord; - var rad = atoms[i].radius + probeRadius2; - radMax = rad > radMax ? rad : radMax; - - if (vCenter.x - rad < vBoxMin.x) { - vBoxMin.x = vCenter.x - rad; - } - - if (vCenter.y - rad < vBoxMin.y) { - vBoxMin.y = vCenter.y - rad; - } - - if (vCenter.z - rad < vBoxMin.z) { - vBoxMin.z = vCenter.z - rad; - } - - if (vCenter.x + rad > vBoxMax.x) { - vBoxMax.x = vCenter.x + rad; - } - - if (vCenter.y + rad > vBoxMax.y) { - vBoxMax.y = vCenter.y + rad; - } - - if (vCenter.z + rad > vBoxMax.z) { - vBoxMax.z = vCenter.z + rad; - } - } - - vBoxMin.x -= radMax; - vBoxMin.y -= radMax; - vBoxMin.z -= radMax; - vBoxMax.x += radMax; - vBoxMax.y += radMax; - vBoxMax.z += radMax; - } - /** - * Calculate (x,y,z) cordinate of the cell corner point - * - * @param {Vector3} vBoxMin Bounding box min point - * @param {Vector3} vBoxMax Bounding box max point - * @param {number} x Cell integer x coordinate - * @param {number} y Cell integer y coordinate - * @param {number} z Cell integer z coordinate - * @param {number} numPoints NUm points in cell on side - * @param {Vector3} vOut Output vector - */ - - }, { - key: "getCornerCoord", - value: function getCornerCoord(vBoxMin, vBoxMax, x, y, z, numPoints, vOut) { - var invNP = 1.0 / (numPoints - 1.0); - var tx = x * invNP; - var ty = y * invNP; - var tz = z * invNP; - vOut.x = vBoxMin.x * (1.0 - tx) + vBoxMax.x * tx; - vOut.y = vBoxMin.y * (1.0 - ty) + vBoxMax.y * ty; - vOut.z = vBoxMin.z * (1.0 - tz) + vBoxMax.z * tz; - } - /** - * Calculate point of intersection of sphere surface - * and cell edge, given by [indexA, indexB] line - * - * @param {number} indexA Cell vertex index in [0..11] - * @param {number} indexB Cell vertex index in [0..11] - * @param {array} sign Sign array for all 8 vertices - * @param {object} cube Cube - * @param {number} indexPointValue for value placement - * @param {Vector3} vOut Point of intersection - */ - - }, { - key: "buildEdgePoint", - value: function buildEdgePoint(indexA, indexB, sign, cube, indexPointValue, vOut) { - if (sign[indexA] ^ sign[indexB]) { - var cTwentyFour = 24; - var t = (0 - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]) / (cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexB] - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]); - var xa = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 0]; - var ya = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 1]; - var za = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 2]; - var xb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 0]; - var yb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 1]; - var zb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 2]; - vOut.x = xa * (1.0 - t) + xb * t; - vOut.y = ya * (1.0 - t) + yb * t; - vOut.z = za * (1.0 - t) + zb * t; - } - } - /** - * Check if triangle is visible (vertices are close to atoms included in visibility set) - * - * @param {Vector3} v0 Vertex #0 - * @param {Vector3} v1 Vertex #1 - * @param {Vector3} v2 Vertex #2 - * @returns {boolean} true if triangle is visible - */ - - }, { - key: "isTriangleVisible", - value: function isTriangleVisible(v0, v1, v2) { - var a0 = this.voxelWorld.getClosestAtom(v0); - var a1 = this.voxelWorld.getClosestAtom(v1); - var a2 = this.voxelWorld.getClosestAtom(v2); - - if (a0 === null || a1 === null || a2 === null || a0.srcAtom === null || a1.srcAtom === null || a2.srcAtom === null) { - return false; - } - - return this.visibilitySelector.includesAtom(a0.srcAtom) && this.visibilitySelector.includesAtom(a1.srcAtom) && this.visibilitySelector.includesAtom(a2.srcAtom); - } - /** - * Add triangle to result geometry - * - * @param {Vector3} v0 Vertex #0 - * @param {Vector3} v1 Vertex #1 - * @param {Vector3} v2 Vertex #2 - * @returns {boolean} false if no more triangles can be added - */ - - }, { - key: "addTriangle", - value: function addTriangle(v0, v1, v2) { - if (this.visibilitySelector && !this.isTriangleVisible(v0, v1, v2)) { - return true; - } - - var geo = this.geoOut; - - if (geo._numTriangles >= this.maxNumTriangles) { - return false; - } // Add vertex with optimize - - - var indInGeo0 = this.addVertexToGeo(geo, v0); - var indInGeo1 = this.addVertexToGeo(geo, v1); - var indInGeo2 = this.addVertexToGeo(geo, v2); - - if ((indInGeo0 | indInGeo1 | indInGeo2) < 0) { - return false; - } - - var itr = 3 * geo._numTriangles; - geo._indices[itr + 0] = indInGeo0; - geo._indices[itr + 1] = indInGeo1; - geo._indices[itr + 2] = indInGeo2; - geo._numTriangles++; - return true; - } - /** - * Build result geometry (triangle mesh) from marching cube cells - * - * @param {number} meshRes Marchnig cube vertex count on each side - * @param {Vector3} vBoxMin Bounding box point min - * @param {Vector3} vBoxMax Bounding box point max - * @param {number} corners float values array for each cube point - * @param {Vector3} vCellStep vector to next cube cell diagonal point - * @param {object} cube IsoSurfaceMarchCube object - * @returns {number} 0, if success (<0) is error - */ - - }, { - key: "buildGeoFromCorners", - value: function buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) { - var arrSize = 12; - var cNumVerts = 8; - var numCells = meshRes - 1; - var side = meshRes; - var side2 = meshRes * meshRes; - var vaEdges = new Array(arrSize); - - for (var i = 0; i < arrSize; i++) { - vaEdges[i] = new THREE.Vector3(); - } - - var sign = []; - - for (var _i3 = 0; _i3 < cNumVerts; _i3++) { - sign[_i3] = 1.0; - } - - var vCorner = new THREE.Vector3(); - var indCell = 0; - var indY = 0; - - for (var y = 0; y < numCells; y++, indY += side2) { - var indZ = 0; - - for (var z = 0; z < numCells; z++, indZ += side) { - for (var x = 0; x < numCells; x++) { - if (!cube.hasIntersection[indCell]) { - // next cell - indCell++; - continue; - } - - var bitsInside = cube.bitsInside[indCell]; - this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, meshRes, vCorner); - var indPointValues = indCell * (2 << 2 + 2); - - for (var _i4 = 0, j = 0; _i4 < cNumVerts; _i4++) { - cube.pointsValuesLinear[indPointValues + j++] = vCorner.x; - cube.pointsValuesLinear[indPointValues + j++] = vCorner.y; - cube.pointsValuesLinear[indPointValues + j++] = vCorner.z; - } - - cube.pointsValuesLinear[indPointValues + 3] += vCellStep.x; - cube.pointsValuesLinear[indPointValues + 2 * 3] += vCellStep.x; - cube.pointsValuesLinear[indPointValues + 5 * 3] += vCellStep.x; - cube.pointsValuesLinear[indPointValues + 6 * 3] += vCellStep.x; - cube.pointsValuesLinear[indPointValues + 2 * 3 + 2] += vCellStep.z; - cube.pointsValuesLinear[indPointValues + 3 * 3 + 2] += vCellStep.z; - cube.pointsValuesLinear[indPointValues + 6 * 3 + 2] += vCellStep.z; - cube.pointsValuesLinear[indPointValues + 7 * 3 + 2] += vCellStep.z; - cube.pointsValuesLinear[indPointValues + 4 * 3 + 1] += vCellStep.y; - cube.pointsValuesLinear[indPointValues + 5 * 3 + 1] += vCellStep.y; - cube.pointsValuesLinear[indPointValues + 6 * 3 + 1] += vCellStep.y; - cube.pointsValuesLinear[indPointValues + 7 * 3 + 1] += vCellStep.y; // now current cell has intersections (from -x to +x) on some cube edges - - var indValues = indPointValues + 24; - - for (var _i5 = 0; _i5 < cNumVerts; ++_i5) { - sign[_i5] = cube.pointsValuesLinear[indValues + _i5] < 0.0 ? 1 : 0; - } - - this.buildEdgePoint(0, 1, sign, cube, indPointValues, vaEdges[0]); - this.buildEdgePoint(1, 2, sign, cube, indPointValues, vaEdges[1]); - this.buildEdgePoint(2, 3, sign, cube, indPointValues, vaEdges[2]); - this.buildEdgePoint(3, 0, sign, cube, indPointValues, vaEdges[3]); - this.buildEdgePoint(4, 5, sign, cube, indPointValues, vaEdges[4]); - this.buildEdgePoint(5, 6, sign, cube, indPointValues, vaEdges[5]); - this.buildEdgePoint(6, 7, sign, cube, indPointValues, vaEdges[6]); - this.buildEdgePoint(7, 4, sign, cube, indPointValues, vaEdges[7]); - this.buildEdgePoint(0, 4, sign, cube, indPointValues, vaEdges[8]); - this.buildEdgePoint(1, 5, sign, cube, indPointValues, vaEdges[9]); - this.buildEdgePoint(2, 6, sign, cube, indPointValues, vaEdges[10]); - this.buildEdgePoint(3, 7, sign, cube, indPointValues, vaEdges[11]); - var offs = bitsInside * (2 << 1 + 2); - - for (var numTri = 0, indTri = 0; numTri < 2 + 2 + 2; numTri++, indTri += 3) { - // s_triIndicesMarchCube is external array, defined in mold_ind.js - var i0 = cube.striIndicesMarchCube[offs + indTri]; - - if (i0 < 0) { - break; - } - - var i1 = cube.striIndicesMarchCube[offs + indTri + 1]; - var i2 = cube.striIndicesMarchCube[offs + indTri + 2]; - - if (!this.addTriangle(vaEdges[i0], vaEdges[i1], vaEdges[i2])) { - return 0 - 2; - } - } // for numTri - // next cell (cube) - - - indCell++; - } // for (x) - - } // for (z) - - } // for (y) - - - return 0; - } - /** - * Returns number of cell with intersection with at least one sphere. - * Using this number, we can estimate required number of vertices - * and triangles to build result mesh. - * - * @param {number} side Number of points in cube voxels - * @param {number} numCells Number of cells in cube voxels (per direction) - * @param {array} corners Array of float values for cube corner points - * @param {object} cube IsoSurfaceMarchCube object - * @returns {number} numIntersectedCells - */ - - }, { - key: "getNumIntersectedCells", - value: function getNumIntersectedCells(side, numCells, corners, cube) { - var side2 = side * side; - var cNumVerts = 8; - var numIntersectedCells = 0; - var indCell = 0; - var indY = 0; - - for (var y = 0; y < numCells; y++, indY += side2) { - var indZ = 0; - - for (var z = 0; z < numCells; z++, indZ += side) { - for (var x = 0; x < numCells; x++) { - var cubeValuesIndex = indCell * (2 << 2 + 2) + 24; - var indCorner = x + indZ + indY; - cube.pointsValuesLinear[cubeValuesIndex] = corners[indCorner]; - cube.pointsValuesLinear[cubeValuesIndex + 1] = corners[indCorner + 1]; - cube.pointsValuesLinear[cubeValuesIndex + 2] = corners[indCorner + side + 1]; - cube.pointsValuesLinear[cubeValuesIndex + 3] = corners[indCorner + side]; - cube.pointsValuesLinear[cubeValuesIndex + 4] = corners[side2 + indCorner]; - cube.pointsValuesLinear[cubeValuesIndex + 5] = corners[side2 + indCorner + 1]; - cube.pointsValuesLinear[cubeValuesIndex + 6] = corners[side2 + indCorner + side + 1]; - cube.pointsValuesLinear[cubeValuesIndex + 7] = corners[side2 + indCorner + side]; // check read exception - // assert(side2 + indCorner + side + 1 < side3); - // get bit flags inside - - var bitsInside = 0; - - for (var i = 0; i < cNumVerts; ++i) { - if (cube.pointsValuesLinear[cubeValuesIndex + i] < 0.0) { - bitsInside |= 1 << i; - } - } - - if (bitsInside === 0 || bitsInside === (1 << cNumVerts) - 1) { - cube.hasIntersection[indCell] = false; - } else { - cube.hasIntersection[indCell] = true; - numIntersectedCells++; - } - - cube.bitsInside[indCell] = bitsInside; // next cell - - indCell++; - } // for (x) - - } // for (z) - - } // for (y) - - - return numIntersectedCells; - } - }, { - key: "getType", - value: function getType(letter) { - /* eslint-disable no-magic-numbers */ - var atomT = [0, 0, 1, 1, 2, 6, 3, 6, 4, 6, 5, 6, 6, 0, 7, 3, 8, 2, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 4, 16, 5, 17, 6, 18, 6, 19, 6, 20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6, 32, 6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, 45, 6, 46, 6, 47, 6, 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, 6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6, 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6, 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, 95, 6, 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, 6, 108, 6, 109, 6]; - /* eslint-enable no-magic-numbers */ - - if (letter < 1 || letter > atomT.length / 2 || Object.keys(Element$1.ByAtomicNumber).length * 2 !== atomT.length) { - throw new Error('atomT.length should be equal Element.ByAtomicNumber.length * 2'); - } - - return atomT[letter * 2]; - } - /** - * Calculate values for marching cube grid points - * positive values are outside sphere, negative - is inside - * - * @param {array} corners array of float values - * @param {number} side Number of point in cube in 1 dimennsion - * @param {Vector3} vBoxMin Bounding box min point - * @param {Vector3} vBoxMax Bounding box max point - * @param {array} atoms Array of input atoms - * @param {number} probeRad radius for atom probing - */ - - }, { - key: "calculateGridCorners", - value: function calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) { - var side2 = side * side; - var side3 = side2 * side; - var vCorner = new THREE.Vector3(); - var vDif = new THREE.Vector3(); - /* eslint-disable no-magic-numbers */ - - var aLot = +1.0e12; - /* eslint-enable no-magic-numbers */ - - for (var i = 0; i < side3; i++) { - corners[i] = aLot; // to large value - } - - var xScale = (side - 1) / (vBoxMax.x - vBoxMin.x); - var yScale = (side - 1) / (vBoxMax.y - vBoxMin.y); - var zScale = (side - 1) / (vBoxMax.z - vBoxMin.z); - - for (var s = 0, numAtoms = atoms.length; s < numAtoms; s++) { - var atom = atoms[s]; - var radius = atom.radius + probeRad; - var fx = (atom.coord.x - radius - vBoxMin.x) * xScale; - var fy = (atom.coord.y - radius - vBoxMin.y) * yScale; - var fz = (atom.coord.z - radius - vBoxMin.z) * zScale; - var indXMin = Math.floor(fx); - var indYMin = Math.floor(fy); - var indZMin = Math.floor(fz); - var indXMax = Math.floor((atom.coord.x + radius - vBoxMin.x) * xScale); - var indYMax = Math.floor((atom.coord.y + radius - vBoxMin.y) * yScale); - var indZMax = Math.floor((atom.coord.z + radius - vBoxMin.z) * zScale); - indXMax++; - indYMax++; - indZMax++; - indXMax = indXMax <= side - 1 ? indXMax : side - 1; - indYMax = indYMax <= side - 1 ? indYMax : side - 1; - indZMax = indZMax <= side - 1 ? indZMax : side - 1; - - for (var y = indYMin; y <= indYMax; y++) { - var indY = y * side2; - - for (var z = indZMin; z <= indZMax; z++) { - var indZ = z * side; - - for (var x = indXMin; x <= indXMax; x++) { - var ind = indY + indZ + x; - this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, side, vCorner); - vDif.x = vCorner.x - atom.coord.x; - vDif.y = vCorner.y - atom.coord.y; - vDif.z = vCorner.z - atom.coord.z; - var distToSphere = Math.sqrt(vDif.x * vDif.x + vDif.y * vDif.y + vDif.z * vDif.z); // val: < 0, if inside sphere - // val: > 0, if outside sphere - - var val = distToSphere - radius; - - if (val < corners[ind]) { - corners[ind] = val; - } - } // for (x) - - } // for (z) - - } // for (y) - - } // for (s) - - } - /** - * Create memory pool for vertex hash management - * - * @param {number} maxNumVertices Maximum possible number of vertices (that will be build) - * @param {number} maxNumTriangles Maximum possible number of triangles (that will be build) - * @returns {number} 0, if success. (<0) is non memory - */ - - }, { - key: "createVertexHash", - value: function createVertexHash(maxNumVertices, maxNumTriangles) { - this.hashLines = utils.allocateTyped(Int32Array, HASH_SIZE * 2); - - if (this.hashLines === null) { - return 0 - 1; - } - - for (var i = 0, j = 0; i < HASH_SIZE; i++) { - this.hashLines[j++] = 0; // num vertices in this hash line - - this.hashLines[j++] = 0 - 1; // index of the first entry - } - - this.maxNumVertices = maxNumVertices; - this.maxNumTriangles = maxNumTriangles; - this.numHashEtriesAllocated = maxNumVertices; - this.hashEntries = utils.allocateTyped(Int32Array, 2 * this.numHashEtriesAllocated); - - if (this.hashEntries === null) { - return 0 - 1; - } - - for (var _i6 = 0, _j2 = 0; _i6 < this.numHashEtriesAllocated; _i6++) { - this.hashEntries[_j2++] = 0 - 1; // index of vertex - - this.hashEntries[_j2++] = 0 - 1; // next hash entry index - } - - this.numHashEntryIndex = 0; - return 0; - } - /** - * Allocate and return new hash entry. Just check possible amount. - * - * @returns {number} index of hash entry, that can be used for geometry add vertex functionality - */ - - }, { - key: "getNewHashEntry", - value: function getNewHashEntry() { - if (this.numHashEntryIndex < this.numHashEtriesAllocated) { - var i = this.numHashEntryIndex; - this.numHashEntryIndex++; - return i; - } - - return 0 - 1; - } - /** - * Add vertex to geometry structure - * using vertex hash table to quickly check, is this vertex already exist in geometry - * - * @param {object} geoOut Geometry to build - * @param {Vector3} vAdd Vertex to add - * @returns {number} index of added (or existing) vertex in geometry. - */ - - }, { - key: "addVertexToGeo", - value: function addVertexToGeo(geoOut, vAdd) { - var entry; - var oneHynberes = 0.01; - var n815851 = 815851; - var n37633 = 37633; - var n2453543 = 2453543; - var r106 = 1.0e-6; - var hashResolution = this.marCubeResoultion << 2; - var v = new THREE.Vector3(); - var ix = Math.floor(hashResolution * (vAdd.x - this.vBoxMin.x) / (this.vBoxMax.x + oneHynberes - this.vBoxMin.x)); - var iy = Math.floor(hashResolution * (vAdd.y - this.vBoxMin.y) / (this.vBoxMax.y + oneHynberes - this.vBoxMin.y)); - var iz = Math.floor(hashResolution * (vAdd.z - this.vBoxMin.z) / (this.vBoxMax.z + oneHynberes - this.vBoxMin.z)); - var iHash = ix * n815851 + iz * n37633 + iy * n2453543; - iHash &= HASH_SIZE - 1; - var hLineIndex = iHash + iHash; // search vertex via hash - // search in hash list - - if (this.vBoxMin !== null && this.vBoxMax !== null) { - for (entry = this.hashLines[hLineIndex + 1]; entry >= 0; entry = this.hashEntries[entry * 2 + 1]) { - var ind = this.hashEntries[entry * 2 + 0]; // vertex index - - v.copy(geoOut._vertices[ind]); - v.x -= vAdd.x; - v.y -= vAdd.y; - v.z -= vAdd.z; - var dot2 = v.x * v.x + v.y * v.y + v.z * v.z; - - if (dot2 < r106) { - return ind; - } // if (found) - - } // for (entry) - - } // search - // add new vertex to geometry - - - if (geoOut._numVertices >= this.maxNumVertices) { - return 0 - 1; - } - - var iVertAdd = geoOut._numVertices; - - geoOut._vertices[iVertAdd].copy(vAdd); // add to hash - - - if (this.vBoxMin !== null && this.vBoxMax !== null) { - entry = this.getNewHashEntry(); - - if (entry < 0) { - return 0 - 1; - } - - var entryFirst = this.hashLines[hLineIndex + 1]; - this.hashLines[hLineIndex + 1] = entry; - this.hashEntries[entry * 2 + 0] = iVertAdd; - this.hashEntries[entry * 2 + 1] = entryFirst; - this.hashLines[hLineIndex + 0]++; // num vertices in line ++ - } - - geoOut._numVertices++; - return iVertAdd; - } - /** - * - * @param {number} side some placeholder description - * @param {number} probeSphereRadius some placeholder description - * @param {object} vBoxMin some placeholder description - * @param {object} vBoxMax some placeholder description - * @param {object} geoOut some placeholder description - * @param {object} corners some placeholder description - * @returns {number} always 0 - */ - - }, { - key: "modifyExcludedFromGeo", - value: function modifyExcludedFromGeo(side, probeSphereRadius, vBoxMin, vBoxMax, geoOut, corners) { - var ind; - var distToSphere; - var distToBorder; - var r11 = 1.1; - - function innerBlockWorkAround() { - if (distToBorder > 0.0) { - // point is inside probe sphere - if (corners[ind] < 0.0) { - corners[ind] = distToBorder; // was inside surface, now is oustide ( > 0) - } - - if (distToBorder > corners[ind]) { - corners[ind] = distToBorder; // find positive maximum - } - } else if (distToBorder > corners[ind]) { - // point is outside sphere - corners[ind] = distToBorder; // find negative maximum - } - } - - var side2 = side * side; - var xScale = (side - 1) / (vBoxMax.x - vBoxMin.x); - var yScale = (side - 1) / (vBoxMax.y - vBoxMin.y); - var zScale = (side - 1) / (vBoxMax.z - vBoxMin.z); - var probeSpRad2 = probeSphereRadius * 2 * (probeSphereRadius * 2); - var sideInv = 1.0 / (side - 1); - - for (var i = 0; i < geoOut._numVertices; i++) { - var vCenter = geoOut._vertices[i]; - var radEst = probeSphereRadius * r11; - var indXMin = Math.floor((vCenter.x - radEst - vBoxMin.x) * xScale); - var indYMin = Math.floor((vCenter.y - radEst - vBoxMin.y) * yScale); - var indZMin = Math.floor((vCenter.z - radEst - vBoxMin.z) * zScale); - var indXMax = Math.floor((vCenter.x + radEst - vBoxMin.x) * xScale); - var indYMax = Math.floor((vCenter.y + radEst - vBoxMin.y) * yScale); - var indZMax = Math.floor((vCenter.z + radEst - vBoxMin.z) * zScale); - indXMin = indXMin >= 0 ? indXMin : 0; - indYMin = indYMin >= 0 ? indYMin : 0; - indZMin = indZMin >= 0 ? indZMin : 0; - indXMax = indXMax <= side - 1 ? indXMax : side - 1; - indYMax = indYMax <= side - 1 ? indYMax : side - 1; - indZMax = indZMax <= side - 1 ? indZMax : side - 1; - - for (var iy = indYMin; iy <= indYMax; iy++) { - var indY = iy * side2; - - for (var iz = indZMin; iz <= indZMax; iz++) { - var indZ = iz * side; - - for (var ix = indXMin; ix <= indXMax; ix++) { - ind = indY + indZ + ix; // getCornerCoord(vBoxMin, vBoxMax, ix, iy, iz, side, &vCorner); - - var t = ix * sideInv; - var xCorner = vBoxMin.x * (1.0 - t) + vBoxMax.x * t; - t = iy * sideInv; - var yCorner = vBoxMin.y * (1.0 - t) + vBoxMax.y * t; - t = iz * sideInv; - var zCorner = vBoxMin.z * (1.0 - t) + vBoxMax.z * t; - var dx = xCorner - vCenter.x; - var dy = yCorner - vCenter.y; - var dz = zCorner - vCenter.z; - var dist2 = dx * dx + dy * dy + dz * dz; - - if (dist2 < probeSpRad2) { - distToSphere = Math.sqrt(dist2); - distToBorder = -(distToSphere - probeSphereRadius); - innerBlockWorkAround(); - } // if (dist from corner point to sphere center more 2 radiuses) - - } // for (ix) - - } // for (iz) - - } // for (iy) - - } // for (i) all geo vertices - - - return 0; - } - }, { - key: "_innerBuild", - value: function _innerBuild() { - var ok; - var expandFactor = 1.2; // performance test - // this.performanceTest(); - // Create temporary atoms (but colored) - - var packedArrays = { - posRad: this._posRad, - colors: this._colors, - atoms: this._opts.atoms - }; - this.complex = this._opts.parent; - this.atoms = packedArrays.atoms; - this.meshResolution = this._opts.gridSpacing; - this.atomRadiusScale = this._opts.radScale; - this.colorMode = this._opts.colorMode; - this.probeRadius = this._opts.probeRadius; - this.useVertexColors = true; - this.excludeProbe = this._opts.excludeProbe; - this.visibilitySelector = this._opts.visibilitySelector; - this.geoOut = null; - this.hashLines = null; - this.hashEntries = null; - this.numHashEtriesAllocated = 0; - this.numHashEntryIndex = 0; - this.maxNumVertices = 0; - this.maxNumTriangles = 0; - var atomsColored = new Array(this.atoms.length); - this.convertToAtomsColored(packedArrays, atomsColored); // find bbox for spheres scene - - var vBoxMin = this.vBoxMin = new THREE.Vector3(); - var vBoxMax = this.vBoxMax = new THREE.Vector3(); - this.getBoundingBox(atomsColored, vBoxMin, vBoxMax); - var marCubeResoultion = this.marCubeResoultion = this.meshResolution * (2 + 2); // build grid corners for Marching cube algorithm - - var side = marCubeResoultion; - var side2 = side * side; - var side3 = side2 * side; - var corners = utils.allocateTyped(Float32Array, side3); - var rProbeRadius = this.probeRadius * this.atomRadiusScale; - this.calculateGridCorners(corners, side, vBoxMin, vBoxMax, atomsColored, rProbeRadius); - var numCells = marCubeResoultion - 1; - var cube = new IsoSurfaceMarchCube(); - ok = cube.create(numCells); - - if (ok < 0) { - return ok; - } // copy corners to cells - - - var vCellStep = new THREE.Vector3(); - vCellStep.x = (vBoxMax.x - vBoxMin.x) / numCells; - vCellStep.y = (vBoxMax.y - vBoxMin.y) / numCells; - vCellStep.z = (vBoxMax.z - vBoxMin.z) / numCells; - var numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube); - var maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor); - var maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2); - this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors); - ok = this.createVertexHash(maxNumVertices, maxNumTriangles); - - if (ok < 0) { - return ok; - } // build voxel world (used to check triangle-to-atom tie and to calculate normals and colors) - - - var probeRadForNormalsColors = rProbeRadius; - - if (this.excludeProbe) { - probeRadForNormalsColors = 0.01; - } - - this.voxelWorld = new IsosurfaceBuildNormals(atomsColored.length, atomsColored, vBoxMin, vBoxMax, probeRadForNormalsColors); - this.voxelWorld.createVoxels(); - ok = this.buildGeoFromCorners(marCubeResoultion, vBoxMin, vBoxMax, corners, vCellStep, cube); - - if (this.excludeProbe) { - // using 3d mesh (geoOut) as a surface points - // move probe sphere and try to minimuze corners values - this.modifyExcludedFromGeo(side, rProbeRadius, vBoxMin, vBoxMax, this.geoOut, corners); // delete old builded geo - - this.geoOut._vertices = null; - this.geoOut._colors = null; - this.geoOut._indices = null; - this.geoOut._normals = null; - this.geoOut._numVertices = 0; - this.geoOut._numTriangles = 0; - this.geoOut = null; // estimage geo vertices budget again - - numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube); - maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor); - maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2); // creates empty new geometry - - this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors); - ok = this.createVertexHash(maxNumVertices, maxNumTriangles); - - if (ok < 0) { - return ok; - } // build vertices and triangles from corners values - - - ok = this.buildGeoFromCorners(side, vBoxMin, vBoxMax, corners, vCellStep, cube); - } // build vertex normals - - - this.voxelWorld.buildNormals(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._normals); // More value : more smooth color mixing - // value about 0.7: very rough colors borders - - var radiusColorSmoothness = 6.5; - - if (this.excludeProbe) { - radiusColorSmoothness -= 1.5; - } - - if (this.useVertexColors) { - this.voxelWorld.buildColors(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._colors, radiusColorSmoothness); - } - - this.voxelWorld.destroyVoxels(); - this.voxelWorld = null; // remove objects - - cube.destroy(); - return ok; - } - }]); - - return SSIsosurfaceGeometry; - }(IsoSurfaceGeometry); // All code below must be erased from every device and each developer's memory - - function createLabel(fieldTxt, className) { - var text = document.createElement('div'); - text.className = className; - - if (typeof fieldTxt === 'string') { - var spanText = document.createElement('span'); - spanText.style.fontSize = '150%'; - var strings = fieldTxt.split('\n'); - - for (var i = 0, n = strings.length; i < n; ++i) { - var spanNodeP = document.createElement('span'); - var spanNodeText = document.createTextNode(strings[i]); - spanNodeP.appendChild(spanNodeText); - spanText.appendChild(spanNodeP); - - if (i < n - 1) { - spanText.appendChild(document.createElement('br')); - } - } - - text.appendChild(spanText); - } else { - text.appendChild(fieldTxt); - } - - text.worldPos = new THREE.Vector3(); - return text; - } - - var LabelsGeometry = /*#__PURE__*/function (_EventDispatcher) { - inherits(LabelsGeometry, _EventDispatcher); - - function LabelsGeometry(instanceCount, opts) { - var _this; - - classCallCheck(this, LabelsGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(LabelsGeometry).call(this)); - _this._opts = opts; - _this.items = []; - _this.needsUpdate = false; - var xTranslation = -50; - var yTranslation = -50; - - switch (opts.horizontalAlign) { - case 'left': - xTranslation = 0; - break; - - case 'right': - xTranslation = -100; - break; - } - - switch (opts.verticalAlign) { - case 'top': - yTranslation = -100; - break; - - case 'bottom': - yTranslation = 0; - break; - } - - var deltaPos = new THREE.Vector3(opts.dx || 0, opts.dy || 0, opts.dz || 0); - _this.userData = { - translation: "translate(".concat(xTranslation, "%, ").concat(yTranslation, "%)"), - offset: deltaPos - }; - return _this; - } - - createClass(LabelsGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, itemPos, fieldTxt) { - var opts = this._opts; - var text = this.items[itemIdx] || createLabel(fieldTxt, 'label'); - text.worldPos.copy(itemPos); - text.style.textAlign = opts.horizontalAlign; - text.style.verticalAlign = opts.verticalAlign; - this.items[itemIdx] = text; - } - }, { - key: "setColor", - value: function setColor(itemIdx, fColor, bColor) { - var text = this.items[itemIdx]; - text.opts = { - color: fColor, - background: bColor - }; - } - }, { - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.needsUpdate = true; - this.dispatchEvent({ - type: 'update' - }); - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - } // unimplemented functions - - }, { - key: "raycast", - value: function raycast() {} - }, { - key: "setOpacity", - value: function setOpacity() {} - }, { - key: "getSubset", - value: function getSubset() { - return []; - } - }]); - - return LabelsGeometry; - }(EventDispatcher); - - var geometries = { - InstancedSpheresGeometry: InstancedSpheresGeometry, - SimpleSpheresGeometry: SimpleSpheresGeometry, - Simple2CCylindersGeometry: Simple2CCylindersGeometry, - Instanced2CCylindersGeometry: Instanced2CCylindersGeometry, - ExtrudedObjectsGeometry: ExtrudedObjectsGeometry, - ChunkedLinesGeometry: ChunkedLinesGeometry, - TwoColorLinesGeometry: TwoColorLinesGeometry, - CrossGeometry: CrossGeometry, - QuickSurfGeometry: QuickSurfGeometry, - ContactSurfaceGeometry: ContactSurfaceGeometry, - SSIsosurfaceGeometry: SSIsosurfaceGeometry, - LabelsGeometry: LabelsGeometry - }; - - function UberObject (SuperClass) { - var NewObjectType = /*#__PURE__*/function (_SuperClass) { - inherits(NewObjectType, _SuperClass); - - function NewObjectType() { - var _getPrototypeOf2; - - var _this; - - classCallCheck(this, NewObjectType); - - for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) { - rest[_key] = arguments[_key]; - } - - _this = possibleConstructorReturn(this, (_getPrototypeOf2 = getPrototypeOf(NewObjectType)).call.apply(_getPrototypeOf2, [this].concat(rest))); - _this.onBeforeRender = NewObjectType.prototype.onBeforeRender; - return _this; - } - - createClass(NewObjectType, [{ - key: "onBeforeRender", - value: function onBeforeRender(renderer, scene, camera, geometry, material, group) { - this._onBeforeRender(renderer, scene, camera, geometry, material, group); - - this._update(); - } - }, { - key: "_onBeforeRender", - value: function _onBeforeRender() {} - }, { - key: "_update", - value: function _update() { - var material = this.material; - - if (!material) { - return; - } - - if (material instanceof UberMaterial) { - material.updateUniforms(); - } - } - }]); - - return NewObjectType; - }(SuperClass); - - return NewObjectType; - } - - var Mesh = UberObject(THREE.Mesh); - - var ZSpriteMesh = /*#__PURE__*/function (_Mesh) { - inherits(ZSpriteMesh, _Mesh); - - function ZSpriteMesh() { - classCallCheck(this, ZSpriteMesh); - - return possibleConstructorReturn(this, getPrototypeOf(ZSpriteMesh).apply(this, arguments)); - } - - createClass(ZSpriteMesh, [{ - key: "_onBeforeRender", - value: function _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) { - Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera); - - var material = this.material; - - if (!material) { - return; - } - - if (material.uniforms.invModelViewMatrix) { - // NOTE: update of modelViewMatrix inside threejs is done after onBeforeRender call, - // so we have to do it manually in that place - this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld); // get inverse matrix - - material.uniforms.invModelViewMatrix.value.getInverse(this.modelViewMatrix); - material.uniformsNeedUpdate = true; - } - } - }]); - - return ZSpriteMesh; - }(Mesh); - - var Mesh$1 = UberObject(THREE.Mesh); - - var ZClippedMesh = /*#__PURE__*/function (_Mesh) { - inherits(ZClippedMesh, _Mesh); - - function ZClippedMesh(geometry, material) { - var _this; - - classCallCheck(this, ZClippedMesh); - - _this = possibleConstructorReturn(this, getPrototypeOf(ZClippedMesh).call(this, geometry, material)); - _this.castShadow = true; - _this.receiveShadow = true; - return _this; - } - - createClass(ZClippedMesh, [{ - key: "_onBeforeRender", - value: function _onBeforeRender(renderer, scene, camera) { - Mesh$1.prototype._onBeforeRender.call(this, renderer, scene, camera); - - var geo = this.geometry; - var material = this.material; - - if (!geo.zClip || !material.uberOptions) { - return; - } - - var zClipCoef = 0.5; - var modelView = ZClippedMesh._modelView; - var mvLength = ZClippedMesh._mvLength; - var center = ZClippedMesh._center; - modelView.multiplyMatrices(this.matrixWorld, camera.matrixWorldInverse); - var s = mvLength.setFromMatrixColumn(modelView, 0).length(); - center.copy(geo.boundingSphere.center); - this.localToWorld(center); - material.uberOptions.zClipValue = camera.position.z - center.z - s * (zClipCoef * geo.boundingSphere.radius); - } - }]); - - return ZClippedMesh; - }(Mesh$1); - - defineProperty(ZClippedMesh, "_mvLength", new THREE.Vector3()); - - defineProperty(ZClippedMesh, "_center", new THREE.Vector3()); - - defineProperty(ZClippedMesh, "_modelView", new THREE.Matrix4()); - - var TextMesh = /*#__PURE__*/function (_THREE$Group) { - inherits(TextMesh, _THREE$Group); - - function TextMesh(geometry, _material) { - var _this; - - classCallCheck(this, TextMesh); - - _this = possibleConstructorReturn(this, getPrototypeOf(TextMesh).call(this)); - _this.geometry = geometry; - - var self = assertThisInitialized(_this); - - self.initialized = false; - - _this.geometry.addEventListener('update', function () { - self.update(); - }); - - return _this; - } - - createClass(TextMesh, [{ - key: "init", - value: function init() { - var children = this.children; - - for (var i = children.length - 1; i >= 0; --i) { - this.remove(children[i]); - } - - var _this$geometry = this.geometry, - items = _this$geometry.items, - userData = _this$geometry.userData; - - for (var _i = 0, n = items.length; _i < n; ++_i) { - var srcItem = items[_i]; - - if (!srcItem) { - continue; - } - - var item = utils.shallowCloneNode(srcItem); - var label = new CSS2DObject(item); - label.userData = _.clone(userData); - var el = label.getElement(); - el.style.visibility = 'visible'; - label.source = srcItem; - this.add(label); - } - - this.initialized = true; - } - }, { - key: "update", - value: function update() { - var geo = this.geometry; - - if (!geo.needsUpdate) { - return; - } - - var children = this.children; - - if (!this.initialized) { - this.init(); - } - - for (var i = 0, n = children.length; i < n; ++i) { - var child = children[i]; - var item = child.source; - child.position.copy(item.worldPos); - child.userData.color = item.opts.color; - child.userData.background = item.opts.background; - } - } - }]); - - return TextMesh; - }(THREE.Group); - - var Mesh$2 = UberObject(THREE.Mesh); - - function SimpleMesh(geometry, material) { - Mesh$2.call(this, geometry, material); - this.castShadow = true; - this.receiveShadow = true; - } - - SimpleMesh.prototype = Object.create(Mesh$2.prototype); - SimpleMesh.prototype.constructor = SimpleMesh; - - var Mesh$3 = UberObject(THREE.Mesh); - - var _viewport = new THREE.Vector2(); - - var ThickLineMesh = /*#__PURE__*/function (_Mesh) { - inherits(ThickLineMesh, _Mesh); - - function ThickLineMesh() { - classCallCheck(this, ThickLineMesh); - - return possibleConstructorReturn(this, getPrototypeOf(ThickLineMesh).apply(this, arguments)); - } - - createClass(ThickLineMesh, [{ - key: "_onBeforeRender", - value: function _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) { - var material = this.material; - - if (!material.uberOptions) { - return; - } - - material.uberOptions.projMatrixInv.getInverse(camera.projectionMatrix, true); - renderer.getSize(_viewport); - material.uberOptions.viewport.set(_viewport.width, _viewport.height); - } - }]); - - return ThickLineMesh; - }(Mesh$3); - - var Mesh$4 = UberObject(THREE.Mesh); - - var InstancedMesh = /*#__PURE__*/function (_Mesh) { - inherits(InstancedMesh, _Mesh); - - function InstancedMesh() { - var _getPrototypeOf2; - - var _this; - - classCallCheck(this, InstancedMesh); - - for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) { - rest[_key] = arguments[_key]; - } - - _this = possibleConstructorReturn(this, (_getPrototypeOf2 = getPrototypeOf(InstancedMesh)).call.apply(_getPrototypeOf2, [this].concat(rest))); - _this.castShadow = true; - _this.receiveShadow = true; - return _this; - } - - return InstancedMesh; - }(Mesh$4); - - var meshes = { - ZClipped: ZClippedMesh, - ZSprite: ZSpriteMesh, - Text: TextMesh, - Line: UberObject(THREE.Line), - LineSegments: UberObject(THREE.LineSegments), - Mesh: SimpleMesh, - ThickLineMesh: ThickLineMesh, - Instanced: InstancedMesh - }; - - function setMatParams(params, uniforms) { - return function (material) { - material.setValues(params); - material.setUberOptions(uniforms); - }; - } - - function _createInstancedCylinders(useZSprites, openEnded) { - return { - Geometry: function Geometry(a, b) { - return new geometries.Instanced2CCylindersGeometry(a, b, useZSprites, openEnded); - }, - Object: useZSprites ? meshes.ZSprite : meshes.Instanced, - initMaterial: setMatParams({ - instancedMatrix: true, - attrColor: true, - attrColor2: true, - attrAlphaColor: true, - cylinderSprite: useZSprites - }) - }; - } - - function _createLineSegmentsGeoTriplet(geo, renderParams) { - var thickLines = geo.prototype instanceof ThickLinesGeometry; - var lineWidth = renderParams.lineWidth || 0; - return { - Geometry: geo, - Object: thickLines ? meshes.ThickLineMesh : meshes.LineSegments, - initMaterial: setMatParams({ - lights: false, - attrColor: true, - attrAlphaColor: true, - thickLine: thickLines - }, { - lineWidth: lineWidth - }) - }; - } - - function _createSimpleGeoTriplet(geoClass) { - return { - Geometry: geoClass, - Object: meshes.Mesh, - initMaterial: setMatParams({ - attrColor: true, - attrAlphaColor: true - }) - }; - } - - function _createIsoSurfaceGeoTriplet(geoClass, caps, settings, renderParams) { - var surfaceOpts = { - wireframe: !!renderParams.wireframe, - fakeOpacity: settings.now.isoSurfaceFakeOpacity, - zClip: renderParams.zClip - }; - return { - Geometry: geoClass, - Object: meshes.ZClipped, - initMaterial: setMatParams({ - attrColor: true, - attrAlphaColor: false, - wireframe: surfaceOpts.wireframe, - fakeOpacity: surfaceOpts.fakeOpacity, - zClip: surfaceOpts.zClip - }) - }; - } - - var MeshCreator = /*#__PURE__*/function () { - function MeshCreator() { - classCallCheck(this, MeshCreator); - } - - createClass(MeshCreator, null, [{ - key: "createSpheres", - value: function createSpheres(caps, settings) { - var useZSprites = settings.now.zSprites; - return { - Geometry: function Geometry(a, b) { - return new geometries.InstancedSpheresGeometry(a, b, useZSprites); - }, - Object: useZSprites ? meshes.ZSprite : meshes.Instanced, - initMaterial: setMatParams({ - instancedPos: true, - attrColor: true, - attrAlphaColor: true, - sphereSprite: useZSprites - }) - }; - } - }, { - key: "create2CClosedCylinders", - value: function create2CClosedCylinders(_caps, _settings) { - return _createInstancedCylinders(false, false); - } - }, { - key: "create2CCylinders", - value: function create2CCylinders(caps, settings) { - return _createInstancedCylinders(settings.now.zSprites, true); - } - }, { - key: "create2CLines", - value: function create2CLines(_caps, _settings, renderParams) { - return _createLineSegmentsGeoTriplet(geometries.TwoColorLinesGeometry, renderParams); - } - }, { - key: "createCrosses", - value: function createCrosses(_caps, _settings, renderParams) { - return _createLineSegmentsGeoTriplet(geometries.CrossGeometry, renderParams); - } - }, { - key: "createExtrudedChains", - value: function createExtrudedChains(_caps, _settings) { - return _createSimpleGeoTriplet(geometries.ExtrudedObjectsGeometry); - } - }, { - key: "createChunkedLines", - value: function createChunkedLines(_caps, _settings, renderParams) { - return _createLineSegmentsGeoTriplet(geometries.ChunkedLinesGeometry, renderParams); - } - }, { - key: "createQuickSurface", - value: function createQuickSurface(caps, settings, renderParams) { - return _createIsoSurfaceGeoTriplet(geometries.QuickSurfGeometry, caps, settings, renderParams); - } - }, { - key: "createContactSurface", - value: function createContactSurface(caps, settings, renderParams) { - return _createIsoSurfaceGeoTriplet(geometries.ContactSurfaceGeometry, caps, settings, renderParams); - } - }, { - key: "createSASSES", - value: function createSASSES(caps, settings, renderParams) { - return _createIsoSurfaceGeoTriplet(geometries.SSIsosurfaceGeometry, caps, settings, renderParams); - } - }, { - key: "createLabels", - value: function createLabels(_caps, _settings) { - return { - Geometry: geometries.LabelsGeometry, - Object: meshes.Text, - initMaterial: function initMaterial() {} - }; - } - }]); - - return MeshCreator; - }(); - - var TransformGroup = /*#__PURE__*/function (_THREE$Object3D) { - inherits(TransformGroup, _THREE$Object3D); - - function TransformGroup(geometry, geoParams, material, transforms) { - var _this; - - classCallCheck(this, TransformGroup); - - _this = possibleConstructorReturn(this, getPrototypeOf(TransformGroup).call(this)); - _this._geometry = geometry; - _this._geoParams = geoParams; - var mat = material.createInstance(); - geoParams.initMaterial(mat); - _this._material = mat; - _this._transforms = transforms.length > 0 ? transforms : [new THREE.Matrix4()]; - - var meshes = _this._createMeshes(geometry); - - for (var i = 0, n = meshes.length; i < n; ++i) { - _this.add(meshes[i]); - } - - return _this; - } - - createClass(TransformGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - var ray = TransformGroup._ray; - var inverseMatrix = TransformGroup._inverseMatrix; - var children = this.children; - ray.copy(raycaster.ray); - - for (var i = 0, n = children.length; i < n; ++i) { - var child = children[i]; - - if (!gfxutils.belongToSelectLayers(child)) { - continue; - } - - child.updateMatrixWorld(); - var mtx = child.matrixWorld; - inverseMatrix.getInverse(mtx); - raycaster.ray.copy(ray).applyMatrix4(inverseMatrix); - var childIntersects = []; - - this._geometry.raycast(raycaster, childIntersects); - - for (var j = 0, ciCount = childIntersects.length; j < ciCount; ++j) { - var inters = childIntersects[j]; - - if (inters.point) { - inters.point.applyMatrix4(mtx); - inters.distance = ray.origin.distanceTo(inters.point); - } - - inters.object = child; - intersects[intersects.length] = inters; - } - } - - raycaster.ray.copy(ray); - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var geos = this._geometry.getSubset(chunkIndices); - - var subset = []; - var subIdx = 0; - - for (var i = 0, n = geos.length; i < n; ++i) { - var _meshes = this._createMeshes(geos[i]); - - for (var j = 0, meshCnt = _meshes.length; j < meshCnt; ++j) { - subset[subIdx++] = _meshes[j]; - } - } - - return subset; - } - }, { - key: "_createMeshes", - value: function _createMeshes(geometry) { - var transforms = this._transforms; - var Mesh = this._geoParams.Object; - var material = this._material; - var meshes = []; - - for (var i = 0, n = transforms.length; i < n; ++i) { - var mesh = new Mesh(geometry, material); - mesh.applyMatrix(transforms[i]); - meshes[i] = mesh; - } - - return meshes; - } - }]); - - return TransformGroup; - }(THREE.Object3D); - - defineProperty(TransformGroup, "_inverseMatrix", new THREE.Matrix4()); - - defineProperty(TransformGroup, "_ray", new THREE.Ray()); - - function wrapper(Name, args) { - var params = [Name].concat(args); - return Name.bind.apply(Name, toConsumableArray(params)); - } - - var ChemGroup = /*#__PURE__*/function (_RCGroup) { - inherits(ChemGroup, _RCGroup); - - function ChemGroup(geoParams, selection, colorer, mode, transforms, polyComplexity, material) { - var _this; - - classCallCheck(this, ChemGroup); - - _this = possibleConstructorReturn(this, getPrototypeOf(ChemGroup).call(this)); - - if (_this.constructor === ChemGroup) { - throw new Error('Can not instantiate abstract class!'); - } - - _this._selection = selection; - _this._mode = mode; - _this._colorer = colorer; - _this._chunksIdc = selection.chunks; - _this._polyComplexity = polyComplexity; - _this._geo = new (wrapper(geoParams.Geometry, _this._makeGeoArgs()))(); - _this._mesh = new TransformGroup(_this._geo, geoParams, material, transforms); - - _this.add(_this._mesh); - - _this._build(); - - return _this; - } - - createClass(ChemGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - throw new Error('ChemGroup subclass must override _makeGeoArgs() method'); - } - /** - * Builds subset geometry by ATOMS index list - * - * @param {Number} mask - Representation mask - * @param {Boolean} innerOnly - if true returns inner bonds only - without halves - * @returns {Array} Subset geometry - */ - - }, { - key: "getSubset", - value: function getSubset(mask, innerOnly) { - innerOnly = innerOnly !== undefined ? innerOnly : false; - - var chunksList = this._calcChunksList(mask, innerOnly); - - if (chunksList.length === 0) { - return []; - } - - return this._mesh.getSubset(chunksList); - } - }, { - key: "_changeSubsetOpacity", - value: function _changeSubsetOpacity(mask, value, innerOnly) { - var chunksList = this._calcChunksList(mask, innerOnly); - - if (chunksList.length === 0) { - return; - } - - this._geo.setOpacity(chunksList, value); - } - }, { - key: "enableSubset", - value: function enableSubset(mask, innerOnly) { - innerOnly = innerOnly !== undefined ? innerOnly : true; - - this._changeSubsetOpacity(mask, 1.0, innerOnly); - } - }, { - key: "disableSubset", - value: function disableSubset(mask, innerOnly) { - innerOnly = innerOnly !== undefined ? innerOnly : true; - - this._changeSubsetOpacity(mask, 0.0, innerOnly); - } - }]); - - return ChemGroup; - }(RCGroup); - - var AtomsGroup = /*#__PURE__*/function (_ChemGroup) { - inherits(AtomsGroup, _ChemGroup); - - function AtomsGroup() { - classCallCheck(this, AtomsGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsGroup).apply(this, arguments)); - } - - createClass(AtomsGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - var atoms = this._selection.atoms; - var inters = []; - - this._mesh.raycast(raycaster, inters); - - var atomsIdc = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var atomIdx = atomsIdc[inters[i].chunkIdx]; - - if (atomIdx < atoms.length) { - inters[i].atom = atoms[atomIdx]; - intersects.push(inters[i]); - } - } - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask) { - var chunksList = []; - var atoms = this._selection.atoms; - var atomsIdc = this._chunksIdc; - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - - if ((atom.mask & mask) !== 0) { - chunksList.push(i); - } - } - - return chunksList; - } - }]); - - return AtomsGroup; - }(ChemGroup); - - var AtomsSphereGroup = /*#__PURE__*/function (_AtomsGroup) { - inherits(AtomsSphereGroup, _AtomsGroup); - - function AtomsSphereGroup() { - classCallCheck(this, AtomsSphereGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsSphereGroup).apply(this, arguments)); - } - - createClass(AtomsSphereGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - return [this._selection.chunks.length, this._polyComplexity]; - } - }, { - key: "_build", - value: function _build() { - var atomsIdc = this._selection.chunks; - var _this$_selection = this._selection, - atoms = _this$_selection.atoms, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - geo.setItem(i, atom.position, mode.calcAtomRadius(atom)); - geo.setColor(i, colorer.getAtomColor(atom, parent)); - } - - geo.finalize(); - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var atomsIdc = this._selection.chunks; - var atoms = this._selection.atoms; - var mode = this._mode; - var colorer = this._colorer; - var updateColor = frameData.needsColorUpdate(colorer); - var geo = this._geo; - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), mode.calcAtomRadius(atom)); - - if (updateColor) { - geo.setColor(i, frameData.getAtomColor(colorer, atom)); - } - } - - geo.finalize(); - } - }]); - - return AtomsSphereGroup; - }(AtomsGroup); - - var AtomsSurfaceGroup = /*#__PURE__*/function (_AtomsSphereGroup) { - inherits(AtomsSurfaceGroup, _AtomsSphereGroup); - - function AtomsSurfaceGroup() { - classCallCheck(this, AtomsSurfaceGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsSurfaceGroup).apply(this, arguments)); - } - - createClass(AtomsSurfaceGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var selectedAtoms = []; - var _this$_selection = this._selection, - atoms = _this$_selection.atoms, - chunks = _this$_selection.chunks; - var n = chunks.length; - - for (var i = 0; i < n; ++i) { - selectedAtoms[i] = atoms[chunks[i]]; - } - - var opts = this._mode.getSurfaceOpts(); - - opts.atoms = selectedAtoms; - return [n, opts]; - } - }]); - - return AtomsSurfaceGroup; - }(AtomsSphereGroup); - - var AtomsSASSESGroupStub = /*#__PURE__*/function (_AtomsSphereGroup) { - inherits(AtomsSASSESGroupStub, _AtomsSphereGroup); - - function AtomsSASSESGroupStub() { - classCallCheck(this, AtomsSASSESGroupStub); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsSASSESGroupStub).apply(this, arguments)); - } - - createClass(AtomsSASSESGroupStub, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var selectedAtoms = []; - var _this$_selection = this._selection, - atoms = _this$_selection.atoms, - chunks = _this$_selection.chunks; - var n = chunks.length; - - for (var i = 0; i < n; ++i) { - selectedAtoms[i] = atoms[chunks[i]]; - } - - var opts = this._mode.getSurfaceOpts(); - - opts.atoms = selectedAtoms; - opts.selection = this._selection; - opts.colorMode = this._colorer; - return [n, opts]; - } - }]); - - return AtomsSASSESGroupStub; - }(AtomsSphereGroup); - - function adjustColor(color) { - var r = color >> 16 & 255; - var g = color >> 8 & 255; - var b = color & 255; - - if (0.2126 * r + 0.7152 * g + 0.0722 * b > 127) { - r = r * 3 / 10; - g = g * 3 / 10; - b = b * 3 / 10; - } else { - r = 255 - (255 - r) * 3 / 10; - g = 255 - (255 - g) * 3 / 10; - b = 255 - (255 - b) * 3 / 10; - } - - return r << 16 | g << 8 | b; - } - - function inverseColor(color) { - var r = color >> 16 & 255; - var g = color >> 8 & 255; - var b = color & 255; - return 255 - r << 16 | 255 - g << 8 | 255 - b; - } - - function getAtomText(atom) { - if (atom.name.getNode() !== null) { - return atom.name.getNode(); - } - - return atom.getVisualName(); - } - - var colorMappings = { - none: function none(c) { - return c; - }, - adjust: adjustColor, - inverse: inverseColor - }; - - function propagateColor(color, rule) { - var result; - - if (colorMappings.hasOwnProperty(rule)) { - result = utils.hexColor(colorMappings[rule](color)); - } else { - var val = parseInt(rule, 16); - - if (!Number.isNaN(val) && rule.toLowerCase().startsWith('0x')) { - result = utils.hexColor(val); - } else { - result = '#000000'; - } - } - - return result; - } - - var templateMappings = { - serial: function serial(a) { - return a.serial; - }, - name: function name(a) { - return a.getVisualName(); - }, - elem: function elem(a) { - return a.element.name; - }, - residue: function residue(a) { - return a.residue.getType().getName(); - }, - sequence: function sequence(a) { - return a.residue.getSequence(); - }, - chain: function chain(a) { - return a.residue.getChain().getName(); - }, - hetatm: function hetatm(a) { - return a.isHet(); - }, - water: function water(a) { - return a.residue.getType().getName() === 'HOH' || a.residue.getType().getName() === 'WAT'; - } - }; - - var parseTemplate = function parseTemplate(atom, str) { - return str.replace(/\{\{(\s*\w+\s*)\}\}/g, function (m) { - var key = m.replace(/\s+/g, ''); - key = key.substring(2, key.length - 2).toLowerCase(); - - if (templateMappings.hasOwnProperty(key)) { - return templateMappings[key](atom); - } - - return 'null'; - }); - }; - - var AtomsTextGroup = /*#__PURE__*/function (_AtomsGroup) { - inherits(AtomsTextGroup, _AtomsGroup); - - function AtomsTextGroup() { - classCallCheck(this, AtomsTextGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsTextGroup).apply(this, arguments)); - } - - createClass(AtomsTextGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var opts = this._mode.getLabelOpts(); - - return [this._selection.chunks.length, opts]; - } - }, { - key: "_build", - value: function _build() { - var opts = this._mode.getLabelOpts(); - - var atomsIdc = this._selection.chunks; - var _this$_selection = this._selection, - atoms = _this$_selection.atoms, - parent = _this$_selection.parent; - var colorer = this._colorer; - var geo = this._geo; - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - var text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom); - - if (!text) { - continue; - } - - var color = colorer.getAtomColor(atom, parent); - var fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16); - var bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent'; - geo.setItem(i, atom.position, text); - geo.setColor(i, fgColor, bgColor); - } - - geo.finalize(); - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var opts = this._mode.getLabelOpts(); - - var atomsIdc = this._selection.chunks; - var atoms = this._selection.atoms; - var colorer = this._colorer; - var geo = this._geo; - var updateColor = frameData.needsColorUpdate(colorer); - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - var text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom); - - if (!text) { - continue; - } - - var color = frameData.getAtomColor(colorer, atom); - var fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16); - var bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent'; - geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), text); - - if (updateColor) { - geo.setColor(i, fgColor, bgColor); - } - } - - geo.finalize(); - } - }]); - - return AtomsTextGroup; - }(AtomsGroup); - - function _slerp(omega, v1, v2, t) { - var oSin = Math.sin(omega); - return v1.clone().multiplyScalar(Math.sin((1 - t) * omega) / oSin).addScaledVector(v2, Math.sin(t * omega) / oSin); - } - - var AromaticGroup = /*#__PURE__*/function (_AtomsGroup) { - inherits(AromaticGroup, _AtomsGroup); - - function AromaticGroup() { - classCallCheck(this, AromaticGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AromaticGroup).apply(this, arguments)); - } - - createClass(AromaticGroup, [{ - key: "_buildInner", - value: function _buildInner(radOffset, addChunk) { - var chunksToIdx = this._selection.chunks; - var prevVector = new THREE.Vector3(); - var currVector = new THREE.Vector3(); - var segmentsHeight = this._segmentsHeight; - var leprStep = 1.0 / segmentsHeight; - var colorer = this._colorer; - var _this$_selection = this._selection, - cycles = _this$_selection.cycles, - parent = _this$_selection.parent; - var chunkIdx = 0; - var currAtomIdx = chunksToIdx[chunkIdx]; - - for (var cIdx = 0, cCount = cycles.length; cIdx < cCount; ++cIdx) { - var cycle = cycles[cIdx]; - var cycAtoms = cycle.atoms; - var chunkPoints = []; - var tmpDir = []; - var center = cycle.center; - var cycleRad = cycle.radius - radOffset; - var n = cycAtoms.length; - var i = 0; - var prevPos = cycAtoms[n - 1].position; - var currPos = cycAtoms[i].position; - prevVector.subVectors(prevPos, center); - currVector.subVectors(currPos, center); - var upDir = currVector.clone().cross(prevVector).normalize(); - - for (; i < n; ++i) { - var omega = prevVector.angleTo(currVector); - tmpDir[i] = _slerp(omega, prevVector, currVector, 0.5).normalize(); - currPos = cycAtoms[(i + 1) % n].position; - prevVector.copy(currVector); - currVector.subVectors(currPos, center); - } - - for (i = 0; i < n; ++i) { - if (cycAtoms[i].index !== currAtomIdx) { - continue; - } - - var start = tmpDir[i]; - var end = tmpDir[(i + 1) % n]; - var color = colorer.getAtomColor(cycAtoms[i], parent); - var currAngle = start.angleTo(end); - - for (var j = 0; j <= segmentsHeight; ++j) { - chunkPoints[j] = _slerp(currAngle, start, end, j * leprStep).multiplyScalar(cycleRad).add(center); - } - - addChunk(chunkIdx++, color, chunkPoints, center, upDir); - currAtomIdx = chunksToIdx[chunkIdx]; - } - } - } - }]); - - return AromaticGroup; - }(AtomsGroup); - - function _createShape(rad, parts) { - var pts = []; - - for (var i = 0; i < parts; ++i) { - var a = -2 * i / parts * Math.PI; - pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0)); - } - - return pts; - } - - var calcChunkMatrix = gfxutils.calcChunkMatrix; - - var AromaticTorusGroup = /*#__PURE__*/function (_AromaticGroup) { - inherits(AromaticTorusGroup, _AromaticGroup); - - function AromaticTorusGroup() { - classCallCheck(this, AromaticTorusGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AromaticTorusGroup).apply(this, arguments)); - } - - createClass(AromaticTorusGroup, [{ - key: "_build", - value: function _build() { - var segmentsHeight = this._segmentsHeight; - - var torusRad = this._mode.getAromRadius(); - - var radiusV = new THREE.Vector2(torusRad, torusRad); - var radOffset = this._mode.calcStickRadius() + 2 * torusRad; - var lookAtVector = new THREE.Vector3(); - var mtc = []; - var geo = this._geo; - - this._buildInner(radOffset, function (chunkIdx, color, points, center, upDir) { - for (var j = 0; j <= segmentsHeight; ++j) { - var currPoint = points[j]; - var currDir = currPoint.clone().sub(center).cross(upDir); - lookAtVector.addVectors(currPoint, currDir); - mtc[j] = calcChunkMatrix(currPoint, lookAtVector, upDir, radiusV); - } - - geo.setItem(chunkIdx, mtc); - geo.setColor(chunkIdx, color); - }); - - geo.finalize(); - } - }, { - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - this._segmentsHeight = this._polyComplexity; - return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length]; - } - }]); - - return AromaticTorusGroup; - }(AromaticGroup); - - var AromaticLinesGroup = /*#__PURE__*/function (_AromaticGroup) { - inherits(AromaticLinesGroup, _AromaticGroup); - - function AromaticLinesGroup() { - classCallCheck(this, AromaticLinesGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AromaticLinesGroup).apply(this, arguments)); - } - - createClass(AromaticLinesGroup, [{ - key: "_build", - value: function _build() { - var _this = this; - - var geo = this._geo; - - var radOffset = this._mode.getAromaticOffset(); - - this._buildInner(radOffset, function (chunkIdx, color, points) { - var prevPt = points[0]; // do not replace with start - - for (var j = 1; j <= _this._segmentsHeight; ++j) { - var currPoint = points[j]; - geo.setSegment(chunkIdx, j - 1, prevPt, currPoint); - prevPt = currPoint; - } - - geo.setColor(chunkIdx, color); - }); - - geo.finalize(); - } - }, { - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - this._segmentsHeight = this._mode.getAromaticArcChunks(); - return [this._selection.chunks.length, this._segmentsHeight, true]; - } - }]); - - return AromaticLinesGroup; - }(AromaticGroup); - - var ResiduesGroup = /*#__PURE__*/function (_ChemGroup) { - inherits(ResiduesGroup, _ChemGroup); - - function ResiduesGroup() { - classCallCheck(this, ResiduesGroup); - - return possibleConstructorReturn(this, getPrototypeOf(ResiduesGroup).apply(this, arguments)); - } - - createClass(ResiduesGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - var residues = this._selection.residues; - var inters = []; - - this._mesh.raycast(raycaster, inters); - - var chunksIdc = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var resIdx = chunksIdc[inters[i].chunkIdx]; - - if (resIdx < residues.length) { - inters[i].residue = residues[resIdx]; - intersects.push(inters[i]); - } - } - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask) { - var chunksList = []; - var residues = this._selection.residues; - var resIdc = this._chunksIdc; - - for (var i = 0, n = resIdc.length; i < n; ++i) { - var res = residues[resIdc[i]]; - - if ((res._mask & mask) !== 0) { - chunksList.push(i); - } - } - - return chunksList; - } - }]); - - return ResiduesGroup; - }(ChemGroup); - - var NucleicItemGroup = /*#__PURE__*/function (_ResiduesGroup) { - inherits(NucleicItemGroup, _ResiduesGroup); - - function NucleicItemGroup() { - classCallCheck(this, NucleicItemGroup); - - return possibleConstructorReturn(this, getPrototypeOf(NucleicItemGroup).apply(this, arguments)); - } - - createClass(NucleicItemGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - var residues = this._selection.residues; - var inters = []; - - this._mesh.raycast(raycaster, inters); - - var chunksIdc = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var resIdx = chunksIdc[Math.floor(inters[i].chunkIdx / 2)]; - - if (resIdx < residues.length) { - inters[i].residue = residues[resIdx]; - intersects.push(inters[i]); - } - } - } - }, { - key: "_build", - value: function _build() { - var _this$_selection = this._selection, - residues = _this$_selection.residues, - parent = _this$_selection.parent; - var colorer = this._colorer; - var geo = this._geo; - - var stickRad = this._mode.calcStickRadius(); - - var chunkIdx = 0; - var resIdc = this._selection.chunks; - - for (var i = 0, n = resIdc.length; i < n; ++i) { - var res = residues[resIdc[i]]; - var color = colorer.getResidueColor(res, parent); - - this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color); - } - - geo.finalize(); - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask) { - var chunksList = []; - var chunkIdx = 0; - var residues = this._selection.residues; - var resIdc = this._chunksIdc; - - for (var i = 0, n = resIdc.length; i < n; ++i) { - var res = residues[resIdc[i]]; - - if ((res._mask & mask) !== 0) { - chunksList[chunkIdx++] = 2 * i; - chunksList[chunkIdx++] = 2 * i + 1; - } - } - - return chunksList; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var residues = frameData.getResidues(); - var parent = this._selection.parent; - var colorer = this._colorer; - var geo = this._geo; - - var stickRad = this._mode.calcStickRadius(); - - var chunkIdx = 0; - var resIdc = this._selection.chunks; - - for (var i = 0, n = resIdc.length; i < n; ++i) { - var res = residues[resIdc[i]]; - var color = colorer.getResidueColor(res, parent); - - this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color); - } - - geo.finishUpdate(); - } - }]); - - return NucleicItemGroup; - }(ResiduesGroup); - - var NucleicCylindersGroup = /*#__PURE__*/function (_NucleicItemGroup) { - inherits(NucleicCylindersGroup, _NucleicItemGroup); - - function NucleicCylindersGroup() { - classCallCheck(this, NucleicCylindersGroup); - - return possibleConstructorReturn(this, getPrototypeOf(NucleicCylindersGroup).apply(this, arguments)); - } - - createClass(NucleicCylindersGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - return [this._selection.chunks.length, this._polyComplexity]; - } - }, { - key: "_processItem", - value: function _processItem(chunkIdx, cyl1, cyl2, stickRad, color) { - var geo = this._geo; - geo.setItem(chunkIdx, cyl1, cyl2, stickRad); - geo.setColor(chunkIdx, color, color); - } - }]); - - return NucleicCylindersGroup; - }(NucleicItemGroup); - - var NucleicSpheresGroup = /*#__PURE__*/function (_NucleicItemGroup) { - inherits(NucleicSpheresGroup, _NucleicItemGroup); - - function NucleicSpheresGroup() { - classCallCheck(this, NucleicSpheresGroup); - - return possibleConstructorReturn(this, getPrototypeOf(NucleicSpheresGroup).apply(this, arguments)); - } - - createClass(NucleicSpheresGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - return [this._selection.chunks.length * 2, this._polyComplexity]; - } - }, { - key: "_processItem", - value: function _processItem(chunkIdx, cyl1, cyl2, stickRad, color) { - var geo = this._geo; - var idx = chunkIdx * 2; - geo.setItem(idx, cyl1, stickRad); - geo.setColor(idx, color); - idx++; - geo.setItem(idx, cyl2, stickRad); - geo.setColor(idx, color); - } - }]); - - return NucleicSpheresGroup; - }(NucleicItemGroup); - - var Smooth = createCommonjsModule(function (module, exports) { - /* - Smooth.js version 0.1.7 - - Turn arrays into smooth functions. - - Copyright 2012 Spencer Cohen - Licensed under MIT license (see "Smooth.js MIT license.txt") - */ - - /*Constants (these are accessible by Smooth.WHATEVER in user space) - */ - - (function() { - var AbstractInterpolator, CubicInterpolator, Enum, LinearInterpolator, NearestInterpolator, PI, SincFilterInterpolator, Smooth, clipClamp, clipMirror, clipPeriodic, defaultConfig, getColumn, getType, isValidNumber, k, makeLanczosWindow, makeScaledFunction, makeSincKernel, normalizeScaleTo, shallowCopy, sin, sinc, v, validateNumber, validateVector, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - - Enum = { - /*Interpolation methods - */ - METHOD_NEAREST: 'nearest', - METHOD_LINEAR: 'linear', - METHOD_CUBIC: 'cubic', - METHOD_LANCZOS: 'lanczos', - METHOD_SINC: 'sinc', - /*Input clipping modes - */ - CLIP_CLAMP: 'clamp', - CLIP_ZERO: 'zero', - CLIP_PERIODIC: 'periodic', - CLIP_MIRROR: 'mirror', - /* Constants for control over the cubic interpolation tension - */ - CUBIC_TENSION_DEFAULT: 0, - CUBIC_TENSION_CATMULL_ROM: 0 - }; - - defaultConfig = { - method: Enum.METHOD_CUBIC, - cubicTension: Enum.CUBIC_TENSION_DEFAULT, - clip: Enum.CLIP_CLAMP, - scaleTo: 0, - sincFilterSize: 2, - sincWindow: void 0 - }; - - /*Index clipping functions - */ - - clipClamp = function(i, n) { - return Math.max(0, Math.min(i, n - 1)); - }; - - clipPeriodic = function(i, n) { - i = i % n; - if (i < 0) i += n; - return i; - }; - - clipMirror = function(i, n) { - var period; - period = 2 * (n - 1); - i = clipPeriodic(i, period); - if (i > n - 1) i = period - i; - return i; - }; - - /* - Abstract scalar interpolation class which provides common functionality for all interpolators - - Subclasses must override interpolate(). - */ - - AbstractInterpolator = (function() { - - function AbstractInterpolator(array, config) { - this.array = array.slice(0); - this.length = this.array.length; - if (!(this.clipHelper = { - clamp: this.clipHelperClamp, - zero: this.clipHelperZero, - periodic: this.clipHelperPeriodic, - mirror: this.clipHelperMirror - }[config.clip])) { - throw "Invalid clip: " + config.clip; - } - } - - AbstractInterpolator.prototype.getClippedInput = function(i) { - if ((0 <= i && i < this.length)) { - return this.array[i]; - } else { - return this.clipHelper(i); - } - }; - - AbstractInterpolator.prototype.clipHelperClamp = function(i) { - return this.array[clipClamp(i, this.length)]; - }; - - AbstractInterpolator.prototype.clipHelperZero = function(i) { - return 0; - }; - - AbstractInterpolator.prototype.clipHelperPeriodic = function(i) { - return this.array[clipPeriodic(i, this.length)]; - }; - - AbstractInterpolator.prototype.clipHelperMirror = function(i) { - return this.array[clipMirror(i, this.length)]; - }; - - AbstractInterpolator.prototype.interpolate = function(t) { - throw 'Subclasses of AbstractInterpolator must override the interpolate() method.'; - }; - - return AbstractInterpolator; - - })(); - - NearestInterpolator = (function(_super) { - - __extends(NearestInterpolator, _super); - - function NearestInterpolator() { - NearestInterpolator.__super__.constructor.apply(this, arguments); - } - - NearestInterpolator.prototype.interpolate = function(t) { - return this.getClippedInput(Math.round(t)); - }; - - return NearestInterpolator; - - })(AbstractInterpolator); - - LinearInterpolator = (function(_super) { - - __extends(LinearInterpolator, _super); - - function LinearInterpolator() { - LinearInterpolator.__super__.constructor.apply(this, arguments); - } - - LinearInterpolator.prototype.interpolate = function(t) { - var k; - k = Math.floor(t); - t -= k; - return (1 - t) * this.getClippedInput(k) + t * this.getClippedInput(k + 1); - }; - - return LinearInterpolator; - - })(AbstractInterpolator); - - CubicInterpolator = (function(_super) { - - __extends(CubicInterpolator, _super); - - function CubicInterpolator(array, config) { - this.tangentFactor = 1 - Math.max(-1, Math.min(1, config.cubicTension)); - CubicInterpolator.__super__.constructor.apply(this, arguments); - } - - CubicInterpolator.prototype.getTangent = function(k) { - return this.tangentFactor * (this.getClippedInput(k + 1) - this.getClippedInput(k - 1)) / 2; - }; - - CubicInterpolator.prototype.interpolate = function(t) { - var k, m, p, t2, t3; - k = Math.floor(t); - m = [this.getTangent(k), this.getTangent(k + 1)]; - p = [this.getClippedInput(k), this.getClippedInput(k + 1)]; - t -= k; - t2 = t * t; - t3 = t * t2; - return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + (-2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1]; - }; - - return CubicInterpolator; - - })(AbstractInterpolator); - - sin = Math.sin, PI = Math.PI; - - sinc = function(x) { - if (x === 0) { - return 1; - } else { - return sin(PI * x) / (PI * x); - } - }; - - makeLanczosWindow = function(a) { - return function(x) { - return sinc(x / a); - }; - }; - - makeSincKernel = function(window) { - return function(x) { - return sinc(x) * window(x); - }; - }; - - SincFilterInterpolator = (function(_super) { - - __extends(SincFilterInterpolator, _super); - - function SincFilterInterpolator(array, config) { - SincFilterInterpolator.__super__.constructor.apply(this, arguments); - this.a = config.sincFilterSize; - if (!config.sincWindow) throw 'No sincWindow provided'; - this.kernel = makeSincKernel(config.sincWindow); - } - - SincFilterInterpolator.prototype.interpolate = function(t) { - var k, n, sum, _ref, _ref2; - k = Math.floor(t); - sum = 0; - for (n = _ref = k - this.a + 1, _ref2 = k + this.a; _ref <= _ref2 ? n <= _ref2 : n >= _ref2; _ref <= _ref2 ? n++ : n--) { - sum += this.kernel(t - n) * this.getClippedInput(n); - } - return sum; - }; - - return SincFilterInterpolator; - - })(AbstractInterpolator); - - getColumn = function(arr, i) { - var row, _i, _len, _results; - _results = []; - for (_i = 0, _len = arr.length; _i < _len; _i++) { - row = arr[_i]; - _results.push(row[i]); - } - return _results; - }; - - makeScaledFunction = function(f, baseScale, scaleRange) { - var scaleFactor, translation; - if (scaleRange.join === '0,1') { - return f; - } else { - scaleFactor = baseScale / (scaleRange[1] - scaleRange[0]); - translation = scaleRange[0]; - return function(t) { - return f(scaleFactor * (t - translation)); - }; - } - }; - - getType = function(x) { - return Object.prototype.toString.call(x).slice('[object '.length, -1); - }; - - validateNumber = function(n) { - if (isNaN(n)) throw 'NaN in Smooth() input'; - if (getType(n) !== 'Number') throw 'Non-number in Smooth() input'; - if (!isFinite(n)) throw 'Infinity in Smooth() input'; - }; - - validateVector = function(v, dimension) { - var n, _i, _len; - if (getType(v) !== 'Array') throw 'Non-vector in Smooth() input'; - if (v.length !== dimension) throw 'Inconsistent dimension in Smooth() input'; - for (_i = 0, _len = v.length; _i < _len; _i++) { - n = v[_i]; - validateNumber(n); - } - }; - - isValidNumber = function(n) { - return (getType(n) === 'Number') && isFinite(n) && !isNaN(n); - }; - - normalizeScaleTo = function(s) { - var invalidErr; - invalidErr = "scaleTo param must be number or array of two numbers"; - switch (getType(s)) { - case 'Number': - if (!isValidNumber(s)) throw invalidErr; - s = [0, s]; - break; - case 'Array': - if (s.length !== 2) throw invalidErr; - if (!(isValidNumber(s[0]) && isValidNumber(s[1]))) throw invalidErr; - break; - default: - throw invalidErr; - } - return s; - }; - - shallowCopy = function(obj) { - var copy, k, v; - copy = {}; - for (k in obj) { - if (!__hasProp.call(obj, k)) continue; - v = obj[k]; - copy[k] = v; - } - return copy; - }; - - Smooth = function(arr, config) { - var baseDomainEnd, dimension, i, interpolator, interpolatorClass, interpolators, k, n, properties, smoothFunc, v; - if (config == null) config = {}; - properties = {}; - config = shallowCopy(config); - properties.config = shallowCopy(config); - if (config.scaleTo == null) config.scaleTo = config.period; - if (config.sincFilterSize == null) { - config.sincFilterSize = config.lanczosFilterSize; - } - for (k in defaultConfig) { - if (!__hasProp.call(defaultConfig, k)) continue; - v = defaultConfig[k]; - if (config[k] == null) config[k] = v; - } - if (!(interpolatorClass = { - nearest: NearestInterpolator, - linear: LinearInterpolator, - cubic: CubicInterpolator, - lanczos: SincFilterInterpolator, - sinc: SincFilterInterpolator - }[config.method])) { - throw "Invalid method: " + config.method; - } - if (config.method === 'lanczos') { - config.sincWindow = makeLanczosWindow(config.sincFilterSize); - } - if (arr.length < 2) throw 'Array must have at least two elements'; - properties.count = arr.length; - smoothFunc = (function() { - var _i, _j, _len, _len2; - switch (getType(arr[0])) { - case 'Number': - properties.dimension = 'scalar'; - if (Smooth.deepValidation) { - for (_i = 0, _len = arr.length; _i < _len; _i++) { - n = arr[_i]; - validateNumber(n); - } - } - interpolator = new interpolatorClass(arr, config); - return function(t) { - return interpolator.interpolate(t); - }; - case 'Array': - properties.dimension = dimension = arr[0].length; - if (!dimension) throw 'Vectors must be non-empty'; - if (Smooth.deepValidation) { - for (_j = 0, _len2 = arr.length; _j < _len2; _j++) { - v = arr[_j]; - validateVector(v, dimension); - } - } - interpolators = (function() { - var _results; - _results = []; - for (i = 0; 0 <= dimension ? i < dimension : i > dimension; 0 <= dimension ? i++ : i--) { - _results.push(new interpolatorClass(getColumn(arr, i), config)); - } - return _results; - })(); - return function(t) { - var interpolator, _k, _len3, _results; - _results = []; - for (_k = 0, _len3 = interpolators.length; _k < _len3; _k++) { - interpolator = interpolators[_k]; - _results.push(interpolator.interpolate(t)); - } - return _results; - }; - default: - throw "Invalid element type: " + (getType(arr[0])); - } - })(); - if (config.clip === 'periodic') { - baseDomainEnd = arr.length; - } else { - baseDomainEnd = arr.length - 1; - } - config.scaleTo || (config.scaleTo = baseDomainEnd); - properties.domain = normalizeScaleTo(config.scaleTo); - smoothFunc = makeScaledFunction(smoothFunc, baseDomainEnd, properties.domain); - properties.domain.sort(); - /*copy properties - */ - for (k in properties) { - if (!__hasProp.call(properties, k)) continue; - v = properties[k]; - smoothFunc[k] = v; - } - return smoothFunc; - }; - - for (k in Enum) { - if (!__hasProp.call(Enum, k)) continue; - v = Enum[k]; - Smooth[k] = v; - } - - Smooth.deepValidation = true; - - ( exports !== null ? exports : window).Smooth = Smooth; - - }).call(commonjsGlobal); - }); - var Smooth_1 = Smooth.Smooth; - - var ResidueType$1 = chem.ResidueType; - var calcMatrix = gfxutils.calcChunkMatrix; - - function _buildStructureInterpolator(points, tension) { - var path = Smooth_1(points, { - method: Smooth_1.METHOD_CUBIC, - clip: Smooth_1.CLIP_CLAMP, - cubicTension: tension, - scaleTo: 1 - }); - return function (t, argTrans) { - var transformT = argTrans; - - if (transformT === null) { - // map our range to the [second .. last but one] - transformT = function transformT(tt) { - return (tt * (points.length - 1 - 2) + 1) / (points.length - 1); - }; - } - - var newt = transformT(t); - var ans = path(newt); - return new THREE.Vector3(ans[0], ans[1], ans[2]); - }; - } - - function _addPoints(centerPoints, topPoints, idx, residue) { - if (!residue._isValid) { - centerPoints[idx] = centerPoints[idx - 1]; - topPoints[idx] = topPoints[idx - 1]; - return; - } - - var cp = residue._controlPoint; - centerPoints[idx] = [cp.x, cp.y, cp.z]; - var tp = cp.clone().add(residue._wingVector); - topPoints[idx] = [tp.x, tp.y, tp.z]; - } - - function _addPointsForLoneResidue(centerPoints, topPoints, idx, residue) { - var nucleic = (residue._type.flags & ResidueType$1.Flags.NUCLEIC) !== 0; - var nameFrom = nucleic ? 'C5\'' : 'N'; - var nameTo = nucleic ? 'C3\'' : 'C'; - var posFrom; - var posTo; - residue.forEachAtom(function (atom) { - var name = atom.getVisualName(); - - if (!posFrom && name === nameFrom) { - posFrom = atom.position; - } else if (!posTo && name === nameTo) { - posTo = atom.position; - } - }); // provide a fallback for unknown residues - - if (!(posFrom && posTo)) { - posFrom = residue._firstAtom.position; - posTo = residue._lastAtom.position; - } - - if (posFrom && posTo) { - var shift = posTo.clone().sub(posFrom); - var wing = residue._wingVector; - var cp = residue._controlPoint; - var tp = cp.clone().add(wing); - var cpPrev = cp.clone().sub(shift); - var tpPrev = cpPrev.clone().add(wing); - centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z]; - topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z]; - ++idx; - centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z]; - topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z]; - ++idx; - centerPoints[idx] = [cp.x, cp.y, cp.z]; - topPoints[idx] = [tp.x, tp.y, tp.z]; - ++idx; - var cpNext = cp.clone().add(shift); - var tpNext = cpNext.clone().add(wing); - centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z]; - topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z]; - ++idx; - centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z]; - topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z]; - } - } - - function _calcPoints(residues, firstIdx, lastIdx, boundaries) { - var left = boundaries.start; - var right = boundaries.end; - - function _prevIdx(idx) { - return idx > left && residues[idx - 1]._isValid ? idx - 1 : idx; - } - - function _nextIdx(idx) { - return idx < right && residues[idx + 1]._isValid ? idx + 1 : idx; - } - - var topPoints = []; - var centerPoints = []; - var arrIdx = 0; - - function _extrapolate2(currIdx, otherIdx) { - var cp = residues[currIdx]._controlPoint.clone().lerp(residues[otherIdx]._controlPoint, -0.25); - - var tp = cp.clone().add(residues[currIdx]._wingVector); - centerPoints[arrIdx] = [cp.x, cp.y, cp.z]; - topPoints[arrIdx++] = [tp.x, tp.y, tp.z]; - centerPoints[arrIdx] = [cp.x, cp.y, cp.z]; - topPoints[arrIdx++] = [tp.x, tp.y, tp.z]; - } // a single disconnected residue - - - var prevIdx = _prevIdx(firstIdx); - - var nextIdx = _nextIdx(lastIdx); - - if (prevIdx === nextIdx) { - _addPointsForLoneResidue(centerPoints, topPoints, arrIdx, residues[firstIdx]); - - return { - centerPoints: centerPoints, - topPoints: topPoints - }; - } // Two points (prev-prev and next-next) are added to support edge conditions for cubic splines, they are ignored - // Another two (prev and next) were added to support the outside of the sub chain - // prev and prev-prev - - - if (firstIdx === prevIdx) { - // do the extrapolation - _extrapolate2(firstIdx, _nextIdx(firstIdx)); - } else { - _addPoints(centerPoints, topPoints, arrIdx++, residues[_prevIdx(prevIdx)]); - - _addPoints(centerPoints, topPoints, arrIdx++, residues[prevIdx]); - } // main loop - - - for (var idx = firstIdx; idx <= lastIdx; ++idx) { - _addPoints(centerPoints, topPoints, arrIdx++, residues[idx]); - } // next and next-next - - - if (nextIdx === _nextIdx(nextIdx)) { - // do the extrapolation - _extrapolate2(lastIdx, _prevIdx(lastIdx)); - } else { - _addPoints(centerPoints, topPoints, arrIdx++, residues[nextIdx]); - - _addPoints(centerPoints, topPoints, arrIdx, residues[_nextIdx(nextIdx)]); - } - - return { - centerPoints: centerPoints, - topPoints: topPoints - }; - } - - var CartoonHelper = /*#__PURE__*/function () { - function CartoonHelper(residues, startIdx, endIdx, segmentsCount, tension, boundaries) { - classCallCheck(this, CartoonHelper); - - var pointsArrays = _calcPoints(residues, startIdx, endIdx, boundaries); - - this._topInterp = _buildStructureInterpolator(pointsArrays.topPoints, tension); - this._centerInterp = _buildStructureInterpolator(pointsArrays.centerPoints, tension); - this._shift = 0.5 / (endIdx - startIdx + 2); - this._valueStep = (1.0 - 2 * this._shift) / (2 * (endIdx - startIdx + 1) * (segmentsCount - 1)); - this._segmentsCount = segmentsCount; - } - - createClass(CartoonHelper, [{ - key: "prepareMatrices", - value: function prepareMatrices(idx, firstRad, secondRad) { - var mtcCount = this._segmentsCount; - var outMtc = new Array(mtcCount); - var currRad = new THREE.Vector2(0, 0); - var topInterp = this._topInterp; - var cenInterp = this._centerInterp; - var currentValue = this._shift + this._valueStep * (mtcCount - 1) * idx; - - for (var mtxIdx = 0; mtxIdx < mtcCount; ++mtxIdx) { - var lerpVal = Math.min(1.0, mtxIdx / (mtcCount - 1)); - currRad.lerpVectors(firstRad, secondRad, lerpVal); - var currTop = topInterp(currentValue, null); - var currCenter = cenInterp(currentValue, null); - currentValue += this._valueStep; - var nextCenter = cenInterp(currentValue, null); - outMtc[mtxIdx] = calcMatrix(currCenter.clone(), nextCenter.clone(), currTop.clone().sub(currCenter), currRad); - } - - return outMtc; - } - }]); - - return CartoonHelper; - }(); - - function _createShape$1(rad, parts) { - var pts = []; - - for (var i = 0; i < parts; ++i) { - // starts from pi/2 because it's important that points are lied on the angles of arrows (visual issues if not) - var a = Math.PI / 2.0 - 2 * Math.PI * i / parts; - pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0)); - } - - return pts; - } - - function _loopThrough(subDiv, residues, segmentsHeight, tension, mode, callback) { - for (var subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { - var subs = subDiv[subDivI].arr; - var boundaries = subDiv[subDivI].boundaries; - - for (var i = 0, n = subs.length; i < n; ++i) { - var idc = [subs[i].start, subs[i].end]; - var matrixHelper = new CartoonHelper(residues, idc[0], idc[1], segmentsHeight, tension, boundaries); - var prevLast = null; - var startIdx = subs[i].start * 2; - var endIdx = subs[i].end * 2 + 1; - var prevSecondRad = mode.getResidueRadius(residues[0], 0); - - for (var idx = startIdx; idx <= endIdx; ++idx) { - var resIdx = idx / 2 | 0; - var currRes = residues[resIdx]; - var firstRad = mode.getResidueRadius(currRes, idx % 2); - var secondRad = mode.getResidueRadius(currRes, 1 + idx % 2); - var mtc = matrixHelper.prepareMatrices(idx - idc[0] * 2, firstRad, secondRad); - mtc.unshift(prevLast === null ? mtc[0] : prevLast); // Slope - radius is changed along this residue part - - var hasSlope = firstRad.x !== secondRad.x || firstRad.y !== secondRad.y; // Cut - end radius of previous part not equal to start radius of this part. First section of this part lies in the orthogonal plane - - var hasCut = firstRad.x !== prevSecondRad.x || firstRad.y !== prevSecondRad.y; - callback(currRes, mtc, hasSlope, hasCut); - prevLast = mtc[segmentsHeight]; - prevSecondRad = secondRad; - } - } - } - } - - var ResiduesSubseqGroup = /*#__PURE__*/function (_ResiduesGroup) { - inherits(ResiduesSubseqGroup, _ResiduesGroup); - - function ResiduesSubseqGroup() { - classCallCheck(this, ResiduesSubseqGroup); - - return possibleConstructorReturn(this, getPrototypeOf(ResiduesSubseqGroup).apply(this, arguments)); - } - - createClass(ResiduesSubseqGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var cmpMultiplier = this._mode.getHeightSegmentsRatio(); - - this._segmentsHeight = this._polyComplexity * cmpMultiplier | 0; - return [_createShape$1(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length * 2]; - } - }, { - key: "_build", - value: function _build() { - var _this$_selection = this._selection, - residues = _this$_selection.residues, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var tension = mode.getTension(); - var geo = this._geo; - var chunkIdx = 0; - var chunkIdc = []; - - _loopThrough(this._selection.subdivs, residues, this._segmentsHeight, tension, mode, function (currRes, mtc) { - var hasSlope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var hasCut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var color = colorer.getResidueColor(currRes, parent); - chunkIdc[chunkIdx] = currRes._index; - geo.setItem(chunkIdx, mtc, hasSlope, hasCut); - geo.setColor(chunkIdx++, color); - }); - - this._chunksIdc = chunkIdc; - geo.finalize(); - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var parent = this._selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var tension = mode.getTension(); - var geo = this._geo; - var frameRes = frameData.getResidues(); - var chunkIdx = 0; - var updateColor = frameData.needsColorUpdate(colorer); - - _loopThrough(this._selection.subdivs, frameRes, this._segmentsHeight, tension, mode, function (currRes, mtc) { - geo.setItem(chunkIdx, mtc); - - if (updateColor) { - geo.setColor(chunkIdx, colorer.getResidueColor(currRes, parent)); - } - - chunkIdx++; - }); - - geo.finalize(); - } - }]); - - return ResiduesSubseqGroup; - }(ResiduesGroup); - - var ResiduesTraceGroup = /*#__PURE__*/function (_ChemGroup) { - inherits(ResiduesTraceGroup, _ChemGroup); - - function ResiduesTraceGroup() { - classCallCheck(this, ResiduesTraceGroup); - - return possibleConstructorReturn(this, getPrototypeOf(ResiduesTraceGroup).apply(this, arguments)); - } - - createClass(ResiduesTraceGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var subDiv = this._selection.subdivs; - var chunksCount = 0; - - for (var subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { - var subs = subDiv[subDivI].arr; - - for (var i = 0, n = subs.length; i < n; ++i) { - chunksCount += subs[i].end - subs[i].start; - } - } - - return [chunksCount, this._polyComplexity]; - } - }, { - key: "_build", - value: function _build() { - var _this$_selection = this._selection, - residues = _this$_selection.residues, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var chunkIdx = 0; - var chunkIdc = []; - var subDiv = this._selection.subdivs; - var stickRad = mode.calcStickRadius(); - - for (var subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { - var subs = subDiv[subDivI].arr; - - for (var i = 0, n = subs.length; i < n; ++i) { - var startIdx = subs[i].start; - var endIdx = subs[i].end; - var prevRes = residues[startIdx]; - - for (var idx = startIdx + 1; idx <= endIdx; ++idx) { - var currRes = residues[idx]; - chunkIdc[chunkIdx] = { - first: prevRes._index, - second: currRes._index - }; - geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad); - geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent)); - chunkIdx++; - prevRes = currRes; - } - } - } - - this._chunksIdc = chunkIdc; - geo.finalize(); - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var residues = frameData.getResidues(); - var parent = this._selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var chunkIdx = 0; - var subDiv = this._selection.subdivs; - var stickRad = mode.calcStickRadius(); - var updateColor = frameData.needsColorUpdate(colorer); - - for (var subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { - var subs = subDiv[subDivI].arr; - - for (var i = 0, n = subs.length; i < n; ++i) { - var startIdx = subs[i].start; - var endIdx = subs[i].end; - var prevRes = residues[startIdx]; - - for (var idx = startIdx + 1; idx <= endIdx; ++idx) { - var currRes = residues[idx]; - geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad); - - if (updateColor) { - geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent)); - } - - chunkIdx++; - prevRes = currRes; - } - } - } - - geo.finalize(); - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var inters = []; - var residues = this._selection.residues; - - this._mesh.raycast(raycaster, inters); - - var chunksToIdx = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var chunkIdx = inters[i].chunkIdx; - var chunk = chunksToIdx[Math.floor(chunkIdx / 2)]; - var resIdx = chunkIdx % 2 === 0 ? chunk.first : chunk.second; - - if (resIdx < residues.length) { - inters[i].residue = residues[resIdx]; - intersects.push(inters[i]); - } - } - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask) { - var chunksList = []; - var chunksToIdx = this._chunksIdc; - var residues = this._selection.residues; - - for (var i = 0, n = chunksToIdx.length; i < n; ++i) { - var chunk = chunksToIdx[i]; - - if (residues[chunk.first]._mask & mask) { - chunksList.push(i * 2); - } - - if (residues[chunk.second]._mask & mask) { - chunksList.push(i * 2 + 1); - } - } - - return chunksList; - } - }]); - - return ResiduesTraceGroup; - }(ChemGroup); - - function getCylinderCount(bondOrder) { - return bondOrder < 2 ? 1 : bondOrder; - } - - var BondsGroup = /*#__PURE__*/function (_ChemGroup) { - inherits(BondsGroup, _ChemGroup); - - function BondsGroup() { - classCallCheck(this, BondsGroup); - - return possibleConstructorReturn(this, getPrototypeOf(BondsGroup).apply(this, arguments)); - } - - createClass(BondsGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var drawMultiple = this._mode.drawMultiorderBonds(); - - var showAromatic = this._mode.showAromaticLoops(); - - var bondsIdc = this._selection.chunks; - var bonds = this._selection.bonds; - var bondsCount = 0; - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - bondsCount += this.getBondOrder(bonds[bondsIdc[i]], drawMultiple, showAromatic); - } - - return [bondsCount, this._polyComplexity]; - } - }, { - key: "getBondOrder", - value: function getBondOrder(bond, drawMultiple, showAromatic) { - var bondOrder = 1; - - if (drawMultiple && (!showAromatic || bond._type !== Bond.BondType.AROMATIC)) { - bondOrder = getCylinderCount(bond._order); - } - - return bondOrder; - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var bonds = this._selection.bonds; - var inters = []; - - this._mesh.raycast(raycaster, inters); - - var bondsIdc = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var chunkIdx = inters[i].chunkIdx; - var bondIdx = bondsIdc[Math.floor(chunkIdx / 2)]; - - if (bondIdx < bonds.length) { - var bond = bonds[bondIdx]; - inters[i].atom = chunkIdx % 2 === 0 ? bond._left : bond._right; - intersects.push(inters[i]); - } - } - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask, innerOnly) { - var chunksList = []; - var bonds = this._selection.bonds; - var chunksToIdx = this._chunksIdc; - - for (var i = 0, n = chunksToIdx.length; i < n; ++i) { - var bond = bonds[chunksToIdx[i]]; - - if (bond._left.mask & mask && (!innerOnly || bond._right.mask & mask)) { - chunksList.push(2 * i); - } - - if (bond._right.mask & mask && (!innerOnly || bond._left.mask & mask)) { - chunksList.push(2 * i + 1); - } - } - - return chunksList; - } - }]); - - return BondsGroup; - }(ChemGroup); - - var BondsCylinderGroup = /*#__PURE__*/function (_BondsGroup) { - inherits(BondsCylinderGroup, _BondsGroup); - - function BondsCylinderGroup() { - classCallCheck(this, BondsCylinderGroup); - - return possibleConstructorReturn(this, getPrototypeOf(BondsCylinderGroup).apply(this, arguments)); - } - - createClass(BondsCylinderGroup, [{ - key: "_build", - value: function _build() { - var bondsIdc = this._selection.chunks; - var _this$_selection = this._selection, - bonds = _this$_selection.bonds, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var drawMultiple = mode.drawMultiorderBonds(); - var showAromatic = mode.showAromaticLoops(); - var stickRad = mode.calcStickRadius(); - var emptyOffset = mode.calcSpaceFraction(); - var normDir; - var leftPos = new THREE.Vector3(); - var rightPos = new THREE.Vector3(); - var currBondIdx = 0; - var chunksToIdx = []; - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - var bond = bonds[bondsIdc[i]]; - var atom1 = bond._left; - var atom2 = bond._right; - var a1Pos = atom1.position; - var a2Pos = atom2.position; - normDir = bond.calcNormalDir(); - var order = this.getBondOrder(bond, drawMultiple, showAromatic); - var minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2)); - var dist = 2 * minRad / order; - var currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad; - - for (var j = 0; j < order; ++j) { - var scale = dist * (order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2))); - chunksToIdx[currBondIdx] = bond._index; - leftPos.copy(a1Pos); - leftPos.addScaledVector(normDir, scale); - rightPos.copy(a2Pos); - rightPos.addScaledVector(normDir, scale); - geo.setItem(currBondIdx, leftPos, rightPos, currStickRad); - geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent)); - } - } - - geo.finalize(); - this._chunksIdc = chunksToIdx; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - var bondsIdc = this._selection.chunks; - var bonds = this._selection.bonds; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var drawMultiple = mode.drawMultiorderBonds(); - var showAromatic = mode.showAromaticLoops(); - var stickRad = mode.calcStickRadius(); - var emptyOffset = mode.calcSpaceFraction(); - var normDir; - var leftPos = new THREE.Vector3(); - var rightPos = new THREE.Vector3(); - var currBondIdx = 0; - var updateColor = frameData.needsColorUpdate(colorer); - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - var bond = bonds[bondsIdc[i]]; - var atom1 = bond._left; - var atom2 = bond._right; - var a1Pos = frameData.getAtomPos(atom1.index).clone(); - var a2Pos = frameData.getAtomPos(atom2.index); - normDir = bond.calcNormalDir(); - var order = this.getBondOrder(bond, drawMultiple, showAromatic); - var minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2)); - var dist = 2 * minRad / order; - var currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad; - - for (var j = 0; j < order; ++j) { - var scale = dist * (order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2))); - leftPos.copy(a1Pos); - leftPos.addScaledVector(normDir, scale); - rightPos.copy(a2Pos); - rightPos.addScaledVector(normDir, scale); - geo.setItem(currBondIdx, leftPos, rightPos, currStickRad); - - if (updateColor) { - geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2)); - } - - currBondIdx++; - } - } - - geo.finalize(); - } - }]); - - return BondsCylinderGroup; - }(BondsGroup); - - var STEP_SIZE = 0.15; - - var BondsLinesGroup = /*#__PURE__*/function (_BondsGroup) { - inherits(BondsLinesGroup, _BondsGroup); - - function BondsLinesGroup() { - classCallCheck(this, BondsLinesGroup); - - return possibleConstructorReturn(this, getPrototypeOf(BondsLinesGroup).apply(this, arguments)); - } - - createClass(BondsLinesGroup, [{ - key: "_build", - value: function _build() { - var bondsIdc = this._selection.chunks; - var _this$_selection = this._selection, - bonds = _this$_selection.bonds, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var drawMultiple = mode.drawMultiorderBonds(); - var showAromatic = mode.showAromaticLoops(); - var bondDir = new THREE.Vector3(); - var leftPos = new THREE.Vector3(); - var rightPos = new THREE.Vector3(); - var currBondIdx = 0; - var chunksToIdx = []; - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - var bond = bonds[bondsIdc[i]]; - var atom1 = bond._left; - var atom2 = bond._right; - var a1Pos = atom1.position; - var a2Pos = atom2.position; - var a1Hangs = atom1.bonds.length === 1; - var a2Hangs = atom2.bonds.length === 1; - bondDir.subVectors(a2Pos, a1Pos); - var len = bondDir.length(); - var normDir = bond.calcNormalDir(); - var order = this.getBondOrder(bond, drawMultiple, showAromatic); - - for (var j = 0; j < order; ++j) { - leftPos.copy(a1Pos); - rightPos.copy(a2Pos); - var scale = order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2)); - chunksToIdx[currBondIdx] = bond._index; - - if (order === 2 && !a1Hangs && !a2Hangs) { - scale -= 0.5; - scale *= -1; - } - - if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) { - leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / len); - rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / len); - } - - scale *= STEP_SIZE; - leftPos.addScaledVector(normDir, scale); - rightPos.addScaledVector(normDir, scale); - geo.setItem(currBondIdx, leftPos, rightPos); - geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent)); - } - } - - geo.finalize(); - this._chunksIdc = chunksToIdx; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var bondsIdc = this._selection.chunks; - var bonds = this._selection.bonds; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var drawMultiple = mode.drawMultiorderBonds(); - var showAromatic = mode.showAromaticLoops(); - var bondDir = new THREE.Vector3(); - var leftPos = new THREE.Vector3(); - var rightPos = new THREE.Vector3(); - var currBondIdx = 0; - var updateColor = frameData.needsColorUpdate(colorer); - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - var bond = bonds[bondsIdc[i]]; - var atom1 = bond._left; - var atom2 = bond._right; - var a1Pos = frameData.getAtomPos(atom1.index).clone(); - var a2Pos = frameData.getAtomPos(atom2.index); - var a1Hangs = atom1.bonds.length === 1; - var a2Hangs = atom2.bonds.length === 1; - bondDir.subVectors(a2Pos, a1Pos); - var len = bondDir.length(); - var normDir = bond.calcNormalDir(); - var order = this.getBondOrder(bond, drawMultiple, showAromatic); - - for (var j = 0; j < order; ++j) { - leftPos.copy(a1Pos); - rightPos.copy(a2Pos); - var scale = order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2)); - - if (order === 2 && !a1Hangs && !a2Hangs) { - scale -= 0.5; - scale *= -1; - } - - if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) { - leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / len); - rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / len); - } - - scale *= STEP_SIZE; - leftPos.addScaledVector(normDir, scale); - rightPos.addScaledVector(normDir, scale); - geo.setItem(currBondIdx, leftPos, rightPos); - - if (updateColor) { - geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2)); - } - - currBondIdx++; - } - } - - geo.finalize(); - } - }]); - - return BondsLinesGroup; - }(BondsGroup); - - var groups = { - AtomsSphereGroup: AtomsSphereGroup, - AtomsSurfaceGroup: AtomsSurfaceGroup, - AtomsSASSESGroupStub: AtomsSASSESGroupStub, - AtomsTextGroup: AtomsTextGroup, - AromaticTorusGroup: AromaticTorusGroup, - AromaticLinesGroup: AromaticLinesGroup, - NucleicCylindersGroup: NucleicCylindersGroup, - NucleicSpheresGroup: NucleicSpheresGroup, - ResiduesSubseqGroup: ResiduesSubseqGroup, - ResiduesTraceGroup: ResiduesTraceGroup, - BondsCylinderGroup: BondsCylinderGroup, - BondsLinesGroup: BondsLinesGroup - }; - - var AtomsProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(AtomsProcessor, _RCGroup); - - function AtomsProcessor(AtomsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, AtomsProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(AtomsProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - _this._mode = mode; - var atoms = complex.getAtoms(); - var transforms = complex.getTransforms(); - complex.forEachComponent(function (component) { - var atomsIdc = []; - var atomCount = 0; - component.forEachAtom(function (atom) { - if (!self._checkAtom(atom, mask)) { - return; - } - - atomsIdc[atomCount++] = atom.index; - }); - - if (atomCount === 0) { - return; - } - - var atomsGroup = new AtomsGroup(geoParams, { - atoms: atoms, - chunks: atomsIdc, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - atomsGroup._component = component; - self.add(atomsGroup); - }); - return _this; - } - - createClass(AtomsProcessor, [{ - key: "_checkAtom", - value: function _checkAtom(atom, mask) { - return atom.mask & mask; - } - }, { - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return AtomsProcessor; - }(RCGroup); - - var OrphanAtomsProcessor = /*#__PURE__*/function (_AtomsProcessor) { - inherits(OrphanAtomsProcessor, _AtomsProcessor); - - function OrphanAtomsProcessor() { - classCallCheck(this, OrphanAtomsProcessor); - - return possibleConstructorReturn(this, getPrototypeOf(OrphanAtomsProcessor).apply(this, arguments)); - } - - createClass(OrphanAtomsProcessor, [{ - key: "_checkAtom", - value: function _checkAtom(atom, mask) { - if (!(atom.mask & mask)) { - return false; - } - - var bonds = atom.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - if (bonds[i]._left.mask & mask && bonds[i]._right.mask & mask) { - return false; - } - } - - return true; - } - }]); - - return OrphanAtomsProcessor; - }(AtomsProcessor); - - var ResiduesProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(ResiduesProcessor, _RCGroup); - - function ResiduesProcessor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, ResiduesProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(ResiduesProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - var residues = complex.getResidues(); - var transforms = complex.getTransforms(); - complex.forEachComponent(function (component) { - var chunksCount = 0; - var resIdc = []; - component.forEachResidue(function (residue) { - if (self._checkResidue(residue, mask)) { - resIdc[chunksCount++] = residue._index; - } - }); - - if (chunksCount === 0) { - return; - } - - var residuesGroup = new ResidueGroup(geoParams, { - residues: residues, - chunks: resIdc, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - residuesGroup._component = component; - self.add(residuesGroup); - }); - return _this; - } - - createClass(ResiduesProcessor, [{ - key: "checkResidue", - value: function checkResidue(residue, mask) { - return residue._mask & mask; - } - }, { - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return ResiduesProcessor; - }(RCGroup); - - var NucleicProcessor = /*#__PURE__*/function (_ResidueProcessor) { - inherits(NucleicProcessor, _ResidueProcessor); - - function NucleicProcessor() { - classCallCheck(this, NucleicProcessor); - - return possibleConstructorReturn(this, getPrototypeOf(NucleicProcessor).apply(this, arguments)); - } - - createClass(NucleicProcessor, [{ - key: "_checkResidue", - value: function _checkResidue(residue, mask) { - return mask & residue._mask && residue._cylinders !== null; - } - }]); - - return NucleicProcessor; - }(ResiduesProcessor); - - var SubseqsProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(SubseqsProcessor, _RCGroup); - - function SubseqsProcessor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, SubseqsProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(SubseqsProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - var residues = complex.getResidues(); - var transforms = complex.getTransforms(); - complex.forEachComponent(function (component) { - var subDivs = component.getMaskedSubdivSequences(mask); - var chunksCount = 0; - var resIdc = []; - - for (var subDivI = 0, subDivN = subDivs.length; subDivI < subDivN; ++subDivI) { - var subs = subDivs[subDivI].arr; - - for (var i = 0, n = subs.length; i < n; ++i) { - for (var j = subs[i].start, jEnd = subs[i].end; j <= jEnd; ++j) { - resIdc[chunksCount++] = residues[j]._index; - } - } - } - - if (chunksCount === 0) { - return; - } - - var residuesGroup = new ResidueGroup(geoParams, { - residues: residues, - chunks: resIdc, - subdivs: subDivs, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - residuesGroup._component = component; - self.add(residuesGroup); - }); - return _this; - } - - createClass(SubseqsProcessor, [{ - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return SubseqsProcessor; - }(RCGroup); - - var BondsProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(BondsProcessor, _RCGroup); - - function BondsProcessor(BondsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, BondsProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(BondsProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - var bonds = complex.getBonds(); - var transforms = complex.getTransforms(); - complex.forEachComponent(function (component) { - var bondsIdc = []; - var bondsCount = 0; - component.forEachBond(function (bond) { - var atom1 = bond._left; - var atom2 = bond._right; - - if (!(atom1.mask & mask) || !(atom2.mask & mask)) { - return; - } - - bondsIdc[bondsCount++] = bond._index; - }); - - if (bondsCount === 0) { - return; - } - - var bondsGroup = new BondsGroup(geoParams, { - bonds: bonds, - chunks: bondsIdc, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - bondsGroup._component = component; - self.add(bondsGroup); - }); - return _this; - } - - createClass(BondsProcessor, [{ - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return BondsProcessor; - }(RCGroup); - - var AromaticProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(AromaticProcessor, _RCGroup); - - function AromaticProcessor(AromaticGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, AromaticProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(AromaticProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - var atoms = complex.getAtoms(); - var transforms = complex.getTransforms(); - - if (!mode.showAromaticLoops()) { - return possibleConstructorReturn(_this); - } - - complex.forEachComponent(function (component) { - var atomsIdc = []; - var chunksCount = 0; - var cycles = []; - var cycleIdx = 0; - component.forEachCycle(function (cycle) { - var cycAtoms = cycle.atoms; - var perCycle = 0; - - for (var i = 0, n = cycAtoms.length; i < n; ++i) { - if ((cycAtoms[i].mask & mask) !== 0) { - ++perCycle; - atomsIdc[chunksCount++] = cycAtoms[i].index; - } - } - - if (perCycle > 0) { - cycles[cycleIdx++] = cycle; - } - }); - var atomsGroup = new AromaticGroup(geoParams, { - cycles: cycles, - atoms: atoms, - chunks: atomsIdc, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - atomsGroup._component = component; - self.add(atomsGroup); - }); - return _this; - } - - createClass(AromaticProcessor, [{ - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return AromaticProcessor; - }(RCGroup); - - var processors = { - Atoms: AtomsProcessor, - OrphanAtoms: OrphanAtomsProcessor, - Residues: ResiduesProcessor, - Nucleic: NucleicProcessor, - Subseqs: SubseqsProcessor, - Bonds: BondsProcessor, - Aromatic: AromaticProcessor - }; - - function _bakeGroup(triplet, Processor, Group) { - return function (complex, colorer, mode, polyComplexity, mask, material) { - return new Processor(Group, triplet, complex, colorer, mode, polyComplexity, mask, material); - }; - } - - var GroupsFactory = /*#__PURE__*/function () { - function GroupsFactory() { - classCallCheck(this, GroupsFactory); - } - - createClass(GroupsFactory, null, [{ - key: "AtomsSpheres", - value: function AtomsSpheres(caps, settings) { - var gfxTriplet = MeshCreator.createSpheres(caps, settings); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSphereGroup); - } - }, { - key: "OrphanedAtomsCrosses", - value: function OrphanedAtomsCrosses(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createCrosses(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.OrphanAtoms, groups.AtomsSphereGroup); - } - }, { - key: "BondsCylinders", - value: function BondsCylinders(caps, settings) { - var gfxTriplet = MeshCreator.create2CCylinders(caps, settings); - return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsCylinderGroup); - } - }, { - key: "BondsLines", - value: function BondsLines(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.create2CLines(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsLinesGroup); - } - }, { - key: "CartoonChains", - value: function CartoonChains(caps, settings) { - var gfxTriplet = MeshCreator.createExtrudedChains(caps, settings); - return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesSubseqGroup); - } - }, { - key: "TraceChains", - value: function TraceChains(caps, settings) { - var gfxTriplet = MeshCreator.create2CClosedCylinders(caps, settings); - return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesTraceGroup); - } - }, { - key: "NucleicSpheres", - value: function NucleicSpheres(caps, settings) { - var gfxTriplet = MeshCreator.createSpheres(caps, settings); - return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicSpheresGroup); - } - }, { - key: "NucleicCylinders", - value: function NucleicCylinders(caps, settings) { - var gfxTriplet = MeshCreator.create2CCylinders(caps, settings); - return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicCylindersGroup); - } - }, { - key: "ALoopsTorus", - value: function ALoopsTorus(caps, settings) { - var gfxTriplet = MeshCreator.createExtrudedChains(caps, settings); - return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticTorusGroup); - } - }, { - key: "ALoopsLines", - value: function ALoopsLines(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createChunkedLines(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticLinesGroup); - } - }, { - key: "QuickSurfGeo", - value: function QuickSurfGeo(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createQuickSurface(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup); - } - }, { - key: "ContactSurfaceGeo", - value: function ContactSurfaceGeo(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createContactSurface(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup); - } - }, { - key: "SASSESSurfaceGeo", - value: function SASSESSurfaceGeo(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createSASSES(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSASSESGroupStub); - } - }, { - key: "TextLabelsGeo", - value: function TextLabelsGeo(caps, settings) { - var gfxTriplet = MeshCreator.createLabels(caps, settings); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsTextGroup); - } - }]); - - return GroupsFactory; - }(); - - /** - * Create new mode. - * - * @param {object=} opts - Options to override defaults with. - * - * These options are copied locally and not kept by reference, so the created instance will not reflect further - * changes to the `opts` object. However, changes in defaults **will** affect the mode after its creation. - * - * @exports Mode - * @this Mode - * @abstract - * @constructor - * @classdesc Basic class for all available modes used for building and displaying molecule geometry. - */ - - var Mode = /*#__PURE__*/function () { - function Mode(opts) { - classCallCheck(this, Mode); - - if (this.constructor === Mode) { - throw new Error('Can not instantiate abstract class!'); - } - /** - * Mode options inherited (prototyped) from defaults. - * @type {object} - */ - - - this.opts = _.merge(utils.deriveDeep(this.settings.now.modes[this.id], true), opts); - } - /** - * Get mode identification, probably with options. - * @returns {string|Array} Mode identifier string ({@link Mode#id}) or two-element array containing both mode - * identifier and options ({@link Mode#opts}). - * Options are returned if they were changed during or after the mode creation. - */ - - - createClass(Mode, [{ - key: "identify", - value: function identify() { - var diff = utils.objectsDiff(this.opts, this.settings.now.modes[this.id]); - - if (!_.isEmpty(diff)) { - return [this.id, diff]; - } - - return this.id; - } - }, { - key: "buildGeometry", - value: function buildGeometry(complex, colorer, mask, material) { - var polyComplexity = this.opts.polyComplexity ? this.opts.polyComplexity[this.settings.now.resolution] : 0; - var groupList = this.depGroups; - var groupCount = groupList.length; - var group = new gfxutils.RCGroup(); - var self = this; - - for (var i = 0; i < groupCount; ++i) { - var currGroup = groupList[i]; - var renderParams = {}; - - if (_.isArray(currGroup)) { - renderParams = currGroup[1].call(this); - var _currGroup = currGroup; - - var _currGroup2 = slicedToArray(_currGroup, 1); - - currGroup = _currGroup2[0]; - } - - var Group = GroupsFactory[currGroup](null, this.settings, renderParams); - var newGroup = new Group(complex, colorer, self, polyComplexity, mask, material); - - if (newGroup.children.length > 0) { - group.add(newGroup); - } - } - - return group; - } - }]); - - return Mode; - }(); - - makeContextDependent(Mode.prototype); - /** - * Mode identifier. - * @type {string} - */ - - Mode.prototype.id = '__'; - /** - * Mode geo groups. - * @type {Array} - */ - - Mode.prototype.depGroups = []; - - function getRenderParams() { - return { - lineWidth: this.opts.lineWidth - }; - } - - var LinesMode = /*#__PURE__*/function (_Mode) { - inherits(LinesMode, _Mode); - - function LinesMode(opts) { - var _this; - - classCallCheck(this, LinesMode); - - _this = possibleConstructorReturn(this, getPrototypeOf(LinesMode).call(this, opts)); - _this.depGroups = _this.depGroups.slice(0); // clone depGroups to prevent prototype edits - - var groups = _this.depGroups; - - for (var i = 0, n = groups.length; i < n; ++i) { - groups[i] = [groups[i], getRenderParams]; - } - - return _this; - } - - createClass(LinesMode, [{ - key: "drawMultiorderBonds", - value: function drawMultiorderBonds() { - return this.opts.multibond; - } - }, { - key: "calcAtomRadius", - value: function calcAtomRadius() { - return this.opts.atom; - } - }, { - key: "getAromaticOffset", - value: function getAromaticOffset() { - return this.opts.offsarom; - } - }, { - key: "getAromaticArcChunks", - value: function getAromaticArcChunks() { - return this.opts.chunkarom; - } - }, { - key: "showAromaticLoops", - value: function showAromaticLoops() { - return this.opts.showarom; - } - }]); - - return LinesMode; - }(Mode); - - defineProperty(LinesMode, "id", 'LN'); - - LinesMode.prototype.id = 'LN'; - LinesMode.prototype.name = 'Lines'; - LinesMode.prototype.shortName = 'Lines'; - LinesMode.prototype.depGroups = ['ALoopsLines', 'BondsLines', 'OrphanedAtomsCrosses']; - - var LicoriceMode = /*#__PURE__*/function (_Mode) { - inherits(LicoriceMode, _Mode); - - function LicoriceMode() { - classCallCheck(this, LicoriceMode); - - return possibleConstructorReturn(this, getPrototypeOf(LicoriceMode).apply(this, arguments)); - } - - createClass(LicoriceMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(_atom) { - return this.opts.bond; - } - }, { - key: "calcStickRadius", - value: function calcStickRadius() { - return this.opts.bond; - } - }, { - key: "calcSpaceFraction", - value: function calcSpaceFraction() { - return this.opts.space; - } - }, { - key: "getAromRadius", - value: function getAromRadius() { - return this.opts.aromrad; - } - }, { - key: "showAromaticLoops", - value: function showAromaticLoops() { - return this.opts.showarom; - } - }, { - key: "drawMultiorderBonds", - value: function drawMultiorderBonds() { - return this.opts.multibond; - } - }]); - - return LicoriceMode; - }(Mode); - - defineProperty(LicoriceMode, "id", 'LC'); - - LicoriceMode.prototype.id = 'LC'; - LicoriceMode.prototype.name = 'Licorice'; - LicoriceMode.prototype.shortName = 'Licorice'; - LicoriceMode.prototype.depGroups = ['AtomsSpheres', 'BondsCylinders', 'ALoopsTorus']; - - var BallsAndSticksMode = /*#__PURE__*/function (_Mode) { - inherits(BallsAndSticksMode, _Mode); - - function BallsAndSticksMode() { - classCallCheck(this, BallsAndSticksMode); - - return possibleConstructorReturn(this, getPrototypeOf(BallsAndSticksMode).apply(this, arguments)); - } - - createClass(BallsAndSticksMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(atom) { - return atom.element.radius * this.opts.atom; - } - }, { - key: "calcStickRadius", - value: function calcStickRadius() { - return this.opts.bond; - } - }, { - key: "getAromRadius", - value: function getAromRadius() { - return this.opts.aromrad; - } - }, { - key: "showAromaticLoops", - value: function showAromaticLoops() { - return this.opts.showarom; - } - }, { - key: "calcSpaceFraction", - value: function calcSpaceFraction() { - return this.opts.space; - } - }, { - key: "drawMultiorderBonds", - value: function drawMultiorderBonds() { - return this.opts.multibond; - } - }]); - - return BallsAndSticksMode; - }(Mode); - - defineProperty(BallsAndSticksMode, "id", 'BS'); - - BallsAndSticksMode.prototype.id = 'BS'; - BallsAndSticksMode.prototype.name = 'Balls and Sticks'; - BallsAndSticksMode.prototype.shortName = 'Balls'; - BallsAndSticksMode.prototype.depGroups = ['AtomsSpheres', 'BondsCylinders', 'ALoopsTorus']; - - var VanDerWaalsMode = /*#__PURE__*/function (_Mode) { - inherits(VanDerWaalsMode, _Mode); - - function VanDerWaalsMode() { - classCallCheck(this, VanDerWaalsMode); - - return possibleConstructorReturn(this, getPrototypeOf(VanDerWaalsMode).apply(this, arguments)); - } - - createClass(VanDerWaalsMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(atom) { - return atom.element.radius; - } - }]); - - return VanDerWaalsMode; - }(Mode); - - defineProperty(VanDerWaalsMode, "id", 'VW'); - - VanDerWaalsMode.prototype.id = 'VW'; - VanDerWaalsMode.prototype.name = 'Van der Waals'; - VanDerWaalsMode.prototype.shortName = 'VDW'; - VanDerWaalsMode.prototype.depGroups = ['AtomsSpheres']; - - var TraceMode = /*#__PURE__*/function (_Mode) { - inherits(TraceMode, _Mode); - - function TraceMode() { - classCallCheck(this, TraceMode); - - return possibleConstructorReturn(this, getPrototypeOf(TraceMode).apply(this, arguments)); - } - - createClass(TraceMode, [{ - key: "calcStickRadius", - value: function calcStickRadius() { - return this.opts.radius; - } - }]); - - return TraceMode; - }(Mode); - - defineProperty(TraceMode, "id", 'TR'); - - TraceMode.prototype.id = 'TR'; - TraceMode.prototype.name = 'Trace'; - TraceMode.prototype.shortName = 'Trace'; - TraceMode.prototype.depGroups = ['TraceChains']; - - var TubeMode = /*#__PURE__*/function (_Mode) { - inherits(TubeMode, _Mode); - - function TubeMode() { - classCallCheck(this, TubeMode); - - return possibleConstructorReturn(this, getPrototypeOf(TubeMode).apply(this, arguments)); - } - - createClass(TubeMode, [{ - key: "getResidueRadius", - value: function getResidueRadius(_residue) { - return this.TUBE_RADIUS; - } - }, { - key: "getHeightSegmentsRatio", - value: function getHeightSegmentsRatio() { - return this.opts.heightSegmentsRatio; - } - }, { - key: "getTension", - value: function getTension() { - return this.opts.tension; - } - }, { - key: "buildGeometry", - value: function buildGeometry(complex, colorer, mask, material) { - var rad = this.opts.radius; - this.TUBE_RADIUS = new THREE.Vector2(rad, rad); - return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material); - } - }]); - - return TubeMode; - }(Mode); - - defineProperty(TubeMode, "id", 'TU'); - - TubeMode.prototype.id = 'TU'; - TubeMode.prototype.name = 'Tube'; - TubeMode.prototype.shortName = 'Tube'; - TubeMode.prototype.depGroups = ['CartoonChains']; - - var CartoonMode = /*#__PURE__*/function (_Mode) { - inherits(CartoonMode, _Mode); - - function CartoonMode(opts) { - var _this; - - classCallCheck(this, CartoonMode); - - _this = possibleConstructorReturn(this, getPrototypeOf(CartoonMode).call(this, opts)); // cache for secondary structure options - - _this.secCache = {}; - return _this; - } - - createClass(CartoonMode, [{ - key: "getResidueStartRadius", - value: function getResidueStartRadius(residue) { - var second = residue.getSecondary(); - - if (!second || !second.generic) { - return this.TUBE_RADIUS; - } - - var secOpts = this.secCache[second.generic]; - - if (!secOpts) { - return this.TUBE_RADIUS; - } - - if (second.term === residue) { - return secOpts.start; - } - - return secOpts.center; - } - }, { - key: "getResidueEndRadius", - value: function getResidueEndRadius(residue) { - var second = residue.getSecondary(); - - if (second === null || !second.generic) { - return this.TUBE_RADIUS; - } - - var secOpts = this.secCache[second.generic]; - - if (!secOpts) { - return this.TUBE_RADIUS; - } - - if (second.term === residue) { - return this.ARROW_END; - } - - return secOpts.center; - } - }, { - key: "getResidueRadius", - value: function getResidueRadius(residue, val) { - var startRad = this.getResidueStartRadius(residue); - - if (val === 0) { - return startRad; - } - - var endRad = this.getResidueEndRadius(residue); - - if (val === 2) { - return endRad; - } - - return startRad.clone().lerp(endRad, val / 2.0); - } - }, { - key: "calcStickRadius", - value: function calcStickRadius(_res) { - return this.opts.radius; - } - }, { - key: "getHeightSegmentsRatio", - value: function getHeightSegmentsRatio() { - return this.opts.heightSegmentsRatio; - } - }, { - key: "getTension", - value: function getTension() { - return this.opts.tension; - } - }, { - key: "buildGeometry", - value: function buildGeometry(complex, colorer, mask, material) { - var tubeRad = this.opts.radius; - var secHeight = this.opts.depth; - this.TUBE_RADIUS = new THREE.Vector2(tubeRad, tubeRad); - this.ARROW_END = new THREE.Vector2(secHeight, tubeRad); - var secCache = {}; - var secData = this.opts.ss; - /* eslint-disable guard-for-in */ - - for (var prop in secData) { - secCache[prop] = { - center: new THREE.Vector2(secHeight, secData[prop].width), - start: new THREE.Vector2(secHeight, secData[prop].arrow) - }; - } - - this.secCache = secCache; - /* eslint-enable guard-for-in */ - - return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material); - } - }]); - - return CartoonMode; - }(Mode); - - defineProperty(CartoonMode, "id", 'CA'); - - CartoonMode.prototype.id = 'CA'; - CartoonMode.prototype.name = 'Cartoon'; - CartoonMode.prototype.shortName = 'Cartoon'; - CartoonMode.prototype.depGroups = ['CartoonChains', 'NucleicSpheres', 'NucleicCylinders']; - - var selectors$1 = chem.selectors; - - function getRenderParams$1() { - return { - wireframe: this.opts.wireframe, - zClip: this.opts.zClip - }; - } - - var SurfaceMode = /*#__PURE__*/function (_Mode) { - inherits(SurfaceMode, _Mode); - - function SurfaceMode(opts) { - var _this; - - classCallCheck(this, SurfaceMode); - - _this = possibleConstructorReturn(this, getPrototypeOf(SurfaceMode).call(this, opts)); - _this.depGroups = _this.depGroups.slice(0); // clone depGroups to prevent prototype edits - - var surfaces = _this.surfaceNames; - var groups = _this.depGroups; - - for (var i = 0, n = surfaces.length; i < n; ++i) { - groups[groups.length] = [surfaces[i], getRenderParams$1]; - } - - return _this; - } - - createClass(SurfaceMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(atom) { - return atom.element.radius; - } - }, { - key: "getVisibilitySelector", - value: function getVisibilitySelector() { - var visibilitySelector = null; - - if (this.opts.subset !== '') { - var res = selectors$1.parse(this.opts.subset); - - if (!res.error) { - visibilitySelector = res.selector; - } - } - - return visibilitySelector; - } - }]); - - return SurfaceMode; - }(Mode); - - SurfaceMode.prototype.isSurface = true; - SurfaceMode.prototype.surfaceNames = []; - - var QuickSurfaceMode = /*#__PURE__*/function (_SurfaceMode) { - inherits(QuickSurfaceMode, _SurfaceMode); - - function QuickSurfaceMode() { - classCallCheck(this, QuickSurfaceMode); - - return possibleConstructorReturn(this, getPrototypeOf(QuickSurfaceMode).apply(this, arguments)); - } - - createClass(QuickSurfaceMode, [{ - key: "getSurfaceOpts", - value: function getSurfaceOpts() { - return { - useBeads: false, - isoValue: this.opts.isoValue, - gaussLim: this.opts.gaussLim[this.settings.now.resolution], - radScale: this.opts.scale, - gridSpacing: this.opts.gridSpacing[this.settings.now.resolution], - zClip: this.opts.zClip, - visibilitySelector: this.getVisibilitySelector() - }; - } - }]); - - return QuickSurfaceMode; - }(SurfaceMode); - - defineProperty(QuickSurfaceMode, "id", 'QS'); - - QuickSurfaceMode.prototype.id = 'QS'; - QuickSurfaceMode.prototype.name = 'Quick Surface'; - QuickSurfaceMode.prototype.shortName = 'Quick Surf'; - QuickSurfaceMode.prototype.surfaceNames = ['QuickSurfGeo']; - - var IsoSurfaceMode = /*#__PURE__*/function (_SurfaceMode) { - inherits(IsoSurfaceMode, _SurfaceMode); - - function IsoSurfaceMode(excludeProbe, opts) { - var _this; - - classCallCheck(this, IsoSurfaceMode); - - _this = possibleConstructorReturn(this, getPrototypeOf(IsoSurfaceMode).call(this, opts)); - _this._excludeProbe = excludeProbe; - return _this; - } - - createClass(IsoSurfaceMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(atom) { - return atom.element.radius; - } - }, { - key: "getSurfaceOpts", - value: function getSurfaceOpts() { - return { - gridSpacing: this.opts.polyComplexity[this.settings.now.resolution], - radScale: this._radScale, - zClip: this.opts.zClip, - visibilitySelector: this.getVisibilitySelector(), - probeRadius: this.opts.probeRadius, - excludeProbe: this._excludeProbe - }; - } - }]); - - return IsoSurfaceMode; - }(SurfaceMode); - - IsoSurfaceMode.prototype.id = 'SU'; - IsoSurfaceMode.prototype.name = 'Surface'; - IsoSurfaceMode.prototype.shortName = 'Surface'; - IsoSurfaceMode.prototype.surfaceNames = ['SASSESSurfaceGeo']; - IsoSurfaceMode.prototype._radScale = 1; - IsoSurfaceMode.prototype._excludeProbe = false; - - var IsoSurfaceSASMode = /*#__PURE__*/function (_IsoSurfaceMode) { - inherits(IsoSurfaceSASMode, _IsoSurfaceMode); - - function IsoSurfaceSASMode(opts) { - classCallCheck(this, IsoSurfaceSASMode); - - return possibleConstructorReturn(this, getPrototypeOf(IsoSurfaceSASMode).call(this, false, opts)); - } - - return IsoSurfaceSASMode; - }(IsoSurfaceMode); - - defineProperty(IsoSurfaceSASMode, "id", 'SA'); - - IsoSurfaceSASMode.prototype.id = 'SA'; - IsoSurfaceSASMode.prototype.name = 'Solvent Accessible Surface'; - IsoSurfaceSASMode.prototype.shortName = 'SAS'; - - var IsoSurfaceSESMode = /*#__PURE__*/function (_IsoSurfaceMode) { - inherits(IsoSurfaceSESMode, _IsoSurfaceMode); - - function IsoSurfaceSESMode(opts) { - classCallCheck(this, IsoSurfaceSESMode); - - return possibleConstructorReturn(this, getPrototypeOf(IsoSurfaceSESMode).call(this, true, opts)); - } - - return IsoSurfaceSESMode; - }(IsoSurfaceMode); - - defineProperty(IsoSurfaceSESMode, "id", 'SE'); - - IsoSurfaceSESMode.prototype.id = 'SE'; - IsoSurfaceSESMode.prototype.name = 'Solvent Excluded Surface'; - IsoSurfaceSESMode.prototype.shortName = 'SES'; - - var ContactSurfaceMode = /*#__PURE__*/function (_SurfaceMode) { - inherits(ContactSurfaceMode, _SurfaceMode); - - function ContactSurfaceMode() { - classCallCheck(this, ContactSurfaceMode); - - return possibleConstructorReturn(this, getPrototypeOf(ContactSurfaceMode).apply(this, arguments)); - } - - createClass(ContactSurfaceMode, [{ - key: "getSurfaceOpts", - value: function getSurfaceOpts() { - return { - probeRadius: this.opts.probeRadius, - radScale: this.opts.polyComplexity[this.settings.now.resolution], - scaleFactor: this.opts.polyComplexity[this.settings.now.resolution], - gridSpacing: 1.0 / this.opts.polyComplexity[this.settings.now.resolution], - isoValue: this.opts.isoValue, - probePositions: this.opts.probePositions, - zClip: this.opts.zClip, - visibilitySelector: this.getVisibilitySelector() - }; - } - }]); - - return ContactSurfaceMode; - }(SurfaceMode); - - defineProperty(ContactSurfaceMode, "id", 'CS'); - - ContactSurfaceMode.prototype.id = 'CS'; - ContactSurfaceMode.prototype.name = 'Contact Surface'; - ContactSurfaceMode.prototype.shortName = 'Contact Surf'; - ContactSurfaceMode.prototype.isSurface = true; - ContactSurfaceMode.prototype.surfaceNames = ['ContactSurfaceGeo']; - - var TextMode = /*#__PURE__*/function (_Mode) { - inherits(TextMode, _Mode); - - function TextMode() { - classCallCheck(this, TextMode); - - return possibleConstructorReturn(this, getPrototypeOf(TextMode).apply(this, arguments)); - } - - createClass(TextMode, [{ - key: "getTemplateOptions", - value: function getTemplateOptions() { - return this.opts.template; - } - }, { - key: "getLabelOpts", - value: function getLabelOpts() { - return _.merge(this.opts, { - colors: true, - adjustColor: true, - transparent: true - }); - } - }]); - - return TextMode; - }(Mode); - - defineProperty(TextMode, "id", 'TX'); - - TextMode.prototype.id = 'TX'; - TextMode.prototype.name = 'Text mode'; - TextMode.prototype.shortName = 'Text'; - TextMode.prototype.depGroups = ['TextLabelsGeo']; - - var modes = new EntityList([LinesMode, LicoriceMode, BallsAndSticksMode, VanDerWaalsMode, TraceMode, TubeMode, CartoonMode, QuickSurfaceMode, IsoSurfaceSASMode, IsoSurfaceSESMode, ContactSurfaceMode, TextMode]); - - function clamp(x, a, b) { - return x <= b ? x < 0 ? 0 : x : b; - } - - function lerpColor(c1, c2, alpha) { - var beta = 1 - alpha; - var r1 = c1 >> 16 & 0xff; - var g1 = c1 >> 8 & 0xff; - var b1 = c1 & 0xff; - var r2 = c2 >> 16 & 0xff; - var g2 = c2 >> 8 & 0xff; - var b2 = c2 & 0xff; - var r = beta * r1 + alpha * r2; - var g = beta * g1 + alpha * g2; - var b = beta * b1 + alpha * b2; - return r << 16 | g << 8 | b; - } - - var Palette = /*#__PURE__*/function () { - function Palette(name, id) { - classCallCheck(this, Palette); - - this.name = name || 'Custom'; - this.id = id || 'CP'; - } - - createClass(Palette, [{ - key: "getElementColor", - value: function getElementColor(name) { - var asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var color = this.elementColors[name]; - return color === undefined && !asIs ? this.defaultElementColor : color; - } - }, { - key: "getResidueColor", - value: function getResidueColor(name) { - var asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var color = this.residueColors[name]; - return color === undefined && !asIs ? this.defaultResidueColor : color; - } - }, { - key: "getChainColor", - value: function getChainColor(name) { - var chain = name.charCodeAt(0); - chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F) % this.chainColors.length; - return this.chainColors[chain]; - } - }, { - key: "getSecondaryColor", - value: function getSecondaryColor(type) { - var asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var color = this.secondaryColors[type]; - return color === undefined && !asIs ? this.defaultSecondaryColor : color; - } - }, { - key: "getSequentialColor", - value: function getSequentialColor(index) { - var colors = this.colors; - var len = colors.length; - return index < 0 ? colors[index % len + len] : colors[index % len]; - } - }, { - key: "getGradientColor", - value: function getGradientColor(value, gradientName) { - var gradient = this.gradients[gradientName]; - - if (!gradient) { - return this.defaultNamedColor; - } - - var count = gradient.length; - var index = value * (count - 1); - var left = Math.floor(index); - var right = clamp(left + 1, 0, count - 1); - left = clamp(left, 0, count - 1); - return lerpColor(gradient[left], gradient[right], index - left); - } - }, { - key: "getNamedColor", - value: function getNamedColor(name) { - var asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var color = this.namedColors[name]; - return color === undefined && !asIs ? this.defaultNamedColor : color; - } - }]); - - return Palette; - }(); - - _.assign(Palette.prototype, { - colors: [0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0x808080], - minRangeColor: 0x000000, - midRangeColor: 0x7F7F7F, - maxRangeColor: 0xFFFFFF, - defaultElementColor: 0xFFFFFF, - elementColors: {}, - defaultResidueColor: 0xFFFFFF, - residueColors: {}, - chainColors: [0xFFFFFF], - defaultSecondaryColor: 0xFFFFFF, - secondaryColors: {}, - defaultGradientColor: 0x000000, - defaultNamedColor: 0xFFFFFF, - namedColorsArray: [ - /* eslint-disable no-multi-spaces */ - ['indianred', 0xcd5c5c], ['lightcoral', 0xf08080], ['salmon', 0xfa8072], ['darksalmon', 0xe9967a], ['lightsalmon', 0xffa07a], ['crimson', 0xdc143c], ['red', 0xff0000], ['firebrick', 0xb22222], ['darkred', 0x8b0000], ['pink', 0xffc0cb], ['lightpink', 0xffb6c1], ['hotpink', 0xff69b4], ['deeppink', 0xff1493], ['mediumvioletred', 0xc71585], ['palevioletred', 0xdb7093], ['coral', 0xff7f50], ['tomato', 0xff6347], ['orangered', 0xff4500], ['darkorange', 0xff8c00], ['orange', 0xffa500], ['gold', 0xffd700], ['yellow', 0xffff00], ['lightyellow', 0xffffe0], ['lemonchiffon', 0xfffacd], ['lightgoldenrodyellow', 0xfafad2], ['papayawhip', 0xffefd5], ['moccasin', 0xffe4b5], ['peachpuff', 0xffdab9], ['palegoldenrod', 0xeee8aa], ['khaki', 0xf0e68c], ['darkkhaki', 0xbdb76b], ['lavender', 0xe6e6fa], ['thistle', 0xd8bfd8], ['plum', 0xdda0dd], ['violet', 0xee82ee], ['orchid', 0xda70d6], ['fuchsia', 0xff00ff], ['magenta', 0xff00ff], ['mediumorchid', 0xba55d3], ['mediumpurple', 0x9370db], ['rebeccapurple', 0x663399], ['blueviolet', 0x8a2be2], ['darkviolet', 0x9400d3], ['darkorchid', 0x9932cc], ['darkmagenta', 0x8b008b], ['purple', 0x800080], ['indigo', 0x4b0082], ['slateblue', 0x6a5acd], ['mediumslateblue', 0x7b68ee], ['darkslateblue', 0x483d8b], ['greenyellow', 0xadff2f], ['chartreuse', 0x7fff00], ['lawngreen', 0x7cfc00], ['lime', 0x00ff00], ['limegreen', 0x32cd32], ['palegreen', 0x98fb98], ['lightgreen', 0x90ee90], ['mediumspringgreen', 0x00fa9a], ['springgreen', 0x00ff7f], ['mediumseagreen', 0x3cb371], ['seagreen', 0x2e8b57], ['forestgreen', 0x228b22], ['green', 0x008000], ['darkgreen', 0x006400], ['yellowgreen', 0x9acd32], ['olivedrab', 0x6b8e23], ['olive', 0x808000], ['darkolivegreen', 0x556b2f], ['mediumaquamarine', 0x66cdaa], ['darkseagreen', 0x8fbc8f], ['lightseagreen', 0x20b2aa], ['darkcyan', 0x008b8b], ['teal', 0x008080], ['aqua', 0x00ffff], ['cyan', 0x00ffff], ['lightcyan', 0xe0ffff], ['paleturquoise', 0xafeeee], ['aquamarine', 0x7fffd4], ['turquoise', 0x40e0d0], ['mediumturquoise', 0x48d1cc], ['darkturquoise', 0x00ced1], ['cadetblue', 0x5f9ea0], ['steelblue', 0x4682b4], ['lightsteelblue', 0xb0c4de], ['powderblue', 0xb0e0e6], ['lightblue', 0xadd8e6], ['skyblue', 0x87ceeb], ['lightskyblue', 0x87cefa], ['deepskyblue', 0x00bfff], ['dodgerblue', 0x1e90ff], ['cornflowerblue', 0x6495ed], ['royalblue', 0x4169e1], ['blue', 0x0000ff], ['mediumblue', 0x0000cd], ['darkblue', 0x00008b], ['navy', 0x000080], ['midnightblue', 0x191970], ['cornsilk', 0xfff8dc], ['blanchedalmond', 0xffebcd], ['bisque', 0xffe4c4], ['navajowhite', 0xffdead], ['wheat', 0xf5deb3], ['burlywood', 0xdeb887], ['tan', 0xd2b48c], ['rosybrown', 0xbc8f8f], ['sandybrown', 0xf4a460], ['goldenrod', 0xdaa520], ['darkgoldenrod', 0xb8860b], ['peru', 0xcd853f], ['chocolate', 0xd2691e], ['saddlebrown', 0x8b4513], ['sienna', 0xa0522d], ['brown', 0xa52a2a], ['maroon', 0x800000], ['white', 0xffffff], ['snow', 0xfffafa], ['honeydew', 0xf0fff0], ['mintcream', 0xf5fffa], ['azure', 0xf0ffff], ['aliceblue', 0xf0f8ff], ['ghostwhite', 0xf8f8ff], ['whitesmoke', 0xf5f5f5], ['seashell', 0xfff5ee], ['beige', 0xf5f5dc], ['oldlace', 0xfdf5e6], ['floralwhite', 0xfffaf0], ['ivory', 0xfffff0], ['antiquewhite', 0xfaebd7], ['linen', 0xfaf0e6], ['lavenderblush', 0xfff0f5], ['mistyrose', 0xffe4e1], ['gainsboro', 0xdcdcdc], ['lightgray', 0xd3d3d3], ['silver', 0xc0c0c0], ['darkgray', 0xa9a9a9], ['gray', 0x808080], ['dimgray', 0x696969], ['lightslategray', 0x778899], ['slategray', 0x708090], ['darkslategray', 0x2f4f4f], ['black', 0x000000] - /* eslint-enable no-multi-spaces */ - ], - namedColors: {}, - - /* eslint-enable no-magic-numbers */ - gradients: { - rainbow: [0x0000ff, // blue - 0x00ffff, // cyan - 0x00ff00, // green - 0xffff00, // yellow - 0xff0000 // red - ], - temp: [0x0000ff, // blue - 0x007fff, // light-blue - 0xffffff, // white - 0xff7f00, // orange - 0xff0000 // red - ], - hot: [0xffffff, // white - 0xff7f00, // orange - 0xff0000 // red - ], - cold: [0xffffff, // white - 0x007fff, // light-blue - 0x0000ff // blue - ], - 'blue-red': [0x0000ff, // blue - 0xffffff, // white - 0xff0000 // red - ], - reds: [0xffffff, // white - 0xff0000 // red - ], - blues: [0xffffff, // white - 0x0000ff // blue - ] - } - }); - - var _Palette$prototype = Palette.prototype, - namedColorsArray = _Palette$prototype.namedColorsArray, - namedColors = _Palette$prototype.namedColors; - - for (var i = 0, length = namedColorsArray.length; i < length; ++i) { - var _namedColorsArray$i = slicedToArray(namedColorsArray[i], 2), - name = _namedColorsArray$i[0], - value = _namedColorsArray$i[1]; - - namedColors[name] = value; - } - - var palette = new Palette('CPK', 'CP'); // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. - - palette.elementColors = { - /* eslint-disable no-magic-numbers */ - H: 0xFFFFFF, - C: 0x202020, - N: 0x2060FF, - O: 0xEE2010, - F: 0x00FF00, - P: 0x8020FF, - S: 0xFFFF00, - CL: 0x00BB00, - FE: 0xD0D0D0, - CO: 0xD0D0D0, - NI: 0xD0D0D0, - CU: 0xD0D0D0, - BR: 0x008800, - I: 0x005500 - /* eslint-enable no-magic-numbers */ - - }; - - var _palette$secondaryCol; - var palette$1 = new Palette('Jmol', 'JM'); - palette$1.colors = [ - /* eslint-disable no-magic-numbers */ - 0x0000FF, // blue - 0x0055FF, // - 0x00ABFF, // - 0x00FFFF, // cyan - 0x00FFAB, // - 0x00FF55, // - 0x00FF00, // green - 0x55FF00, // - 0xABFF00, // - 0xFFFF00, // yellow - 0xFFAB00, // - 0xFF5500, // - 0xFF0000, // red - 0xFF0055, // - 0xFF00AB, // - 0xFF00FF, // magenta - 0xAB00FF, // - 0x5500FF // - - /* eslint-enable no-magic-numbers */ - ]; // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. - - palette$1.elementColors = { - /* eslint-disable no-magic-numbers */ - H: 0xFFFFFF, - D: 0xFFFFC0, - T: 0xFFFFA0, - HE: 0xD9FFFF, - LI: 0xCC80FF, - BE: 0xC2FF00, - B: 0xFFB5B5, - C: 0x909090, - N: 0x3050F8, - O: 0xFF0D0D, - F: 0x90E050, - NE: 0xB3E3F5, - NA: 0xAB5CF2, - MG: 0x8AFF00, - AL: 0xBFA6A6, - SI: 0xF0C8A0, - P: 0xFF8000, - S: 0xFFFF30, - CL: 0x1FF01F, - AR: 0x80D1E3, - K: 0x8F40D4, - CA: 0x3DFF00, - SC: 0xE6E6E6, - TI: 0xBFC2C7, - V: 0xA6A6AB, - CR: 0x8A99C7, - MN: 0x9C7AC7, - FE: 0xE06633, - CO: 0xF090A0, - NI: 0x50D050, - CU: 0xC88033, - ZN: 0x7D80B0, - GA: 0xC28F8F, - GE: 0x668F8F, - AS: 0xBD80E3, - SE: 0xFFA100, - BR: 0xA62929, - KR: 0x5CB8D1, - RB: 0x702EB0, - SR: 0x00FF00, - Y: 0x94FFFF, - ZR: 0x94E0E0, - NB: 0x73C2C9, - MO: 0x54B5B5, - TC: 0x3B9E9E, - RU: 0x248F8F, - RH: 0x0A7D8C, - PD: 0x006985, - AG: 0xC0C0C0, - CD: 0xFFD98F, - IN: 0xA67573, - SN: 0x668080, - SB: 0x9E63B5, - TE: 0xD47A00, - I: 0x940094, - XE: 0x429EB0, - CS: 0x57178F, - BA: 0x00C900, - LA: 0x70D4FF, - CE: 0xFFFFC7, - PR: 0xD9FFC7, - ND: 0xC7FFC7, - PM: 0xA3FFC7, - SM: 0x8FFFC7, - EU: 0x61FFC7, - GD: 0x45FFC7, - TB: 0x30FFC7, - DY: 0x1FFFC7, - HO: 0x00FF9C, - ER: 0x00E675, - TM: 0x00D452, - YB: 0x00BF38, - LU: 0x00AB24, - HF: 0x4DC2FF, - TA: 0x4DA6FF, - W: 0x2194D6, - RE: 0x267DAB, - OS: 0x266696, - IR: 0x175487, - PT: 0xD0D0E0, - AU: 0xFFD123, - HG: 0xB8B8D0, - TL: 0xA6544D, - PB: 0x575961, - BI: 0x9E4FB5, - PO: 0xAB5C00, - AT: 0x754F45, - RN: 0x428296, - FR: 0x420066, - RA: 0x007D00, - AC: 0x70ABFA, - TH: 0x00BAFF, - PA: 0x00A1FF, - U: 0x008FFF, - NP: 0x0080FF, - PU: 0x006BFF, - AM: 0x545CF2, - CM: 0x785CE3, - BK: 0x8A4FE3, - CF: 0xA136D4, - ES: 0xB31FD4, - FM: 0xB31FBA, - MD: 0xB30DA6, - NO: 0xBD0D87, - LR: 0xC70066, - RF: 0xCC0059, - DB: 0xD1004F, - SG: 0xD90045, - BH: 0xE00038, - HS: 0xE6002E, - MT: 0xEB0026 - /* eslint-enable no-magic-numbers */ - - }; - palette$1.defaultResidueColor = 0xBEA06E; // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. - - palette$1.residueColors = { - /* eslint-disable no-magic-numbers */ - ALA: 0xC8C8C8, - ARG: 0x145AFF, - ASN: 0x00DCDC, - ASP: 0xE60A0A, - CYS: 0xE6E600, - GLN: 0x00DCDC, - GLU: 0xE60A0A, - GLY: 0xEBEBEB, - HIS: 0x8282D2, - ILE: 0x0F820F, - LEU: 0x0F820F, - LYS: 0x145AFF, - MET: 0xE6E600, - PHE: 0x3232AA, - PRO: 0xDC9682, - SER: 0xFA9600, - THR: 0xFA9600, - TRP: 0xB45AB4, - TYR: 0x3232AA, - VAL: 0x0F820F, - A: 0xA0A0FF, - C: 0xFF8C4B, - G: 0xFF7070, - I: 0x80FFFF, - T: 0xA0FFA0, - U: 0xFF8080, - DA: 0xA0A0FF, - DC: 0xFF8C4B, - DG: 0xFF7070, - DI: 0x80FFFF, - DT: 0xA0FFA0, - DU: 0xFF8080, - '+A': 0xA0A0FF, - '+C': 0xFF8C4B, - '+G': 0xFF7070, - '+I': 0x80FFFF, - '+T': 0xA0FFA0, - '+U': 0xFF8080 - /* eslint-enable no-magic-numbers */ - - }; - palette$1.chainColors = [// ' '->0 'A'->1, 'B'->2 - 0xFFffffff, // ' ' & '0' white - // - 0xFFC0D0FF, // skyblue - 0xFFB0FFB0, // pastel green - 0xFFFFC0C8, // pink - 0xFFFFFF80, // pastel yellow - 0xFFFFC0FF, // pastel magenta - 0xFFB0F0F0, // pastel cyan - 0xFFFFD070, // pastel gold - 0xFFF08080, // lightcoral - 0xFFF5DEB3, // wheat - 0xFF00BFFF, // deepskyblue - 0xFFCD5C5C, // indianred - 0xFF66CDAA, // mediumaquamarine - 0xFF9ACD32, // yellowgreen - 0xFFEE82EE, // violet - 0xFF00CED1, // darkturquoise - 0xFF00FF7F, // springgreen - 0xFF3CB371, // mediumseagreen - 0xFF00008B, // darkblue - 0xFFBDB76B, // darkkhaki - 0xFF006400, // darkgreen - 0xFF800000, // maroon - 0xFF808000, // olive - 0xFF800080, // purple - 0xFF008080, // teal - 0xFFB8860B, // darkgoldenrod - 0xFFB22222 // firebrick - ]; - var StructuralElementType$3 = StructuralElement.Type; - palette$1.secondaryColors = (_palette$secondaryCol = {}, defineProperty(_palette$secondaryCol, StructuralElementType$3.HELIX_ALPHA, 0xFF0080), defineProperty(_palette$secondaryCol, StructuralElementType$3.HELIX_PI, 0x600080), defineProperty(_palette$secondaryCol, StructuralElementType$3.HELIX_310, 0xA00080), defineProperty(_palette$secondaryCol, StructuralElementType$3.STRAND, 0xFFC800), defineProperty(_palette$secondaryCol, StructuralElementType$3.TURN, 0x6080FF), defineProperty(_palette$secondaryCol, "dna", 0xAE00FE), defineProperty(_palette$secondaryCol, "rna", 0xFD0162), _palette$secondaryCol); - - var _palette$secondaryCol$1; - var palette$2 = new Palette('VMD', 'VM'); - palette$2.colors = [ - /* eslint-disable no-magic-numbers */ - 0x0000FF, // blue - 0xFF0000, // red - 0x606060, // gray - 0xFF8000, // orange - 0xFFFF00, // yellow - 0x808033, // tan - 0x999999, // silver - 0x00FF00, // green - 0xFFFFFF, // white - 0xFF9999, // pink - 0x40C0C0, // cyan - 0xA600A6, // purple - 0x80E666, // lime - 0xE666B3, // mauve - 0x804D00, // ochre - 0x8080C0 // ice blue - - /* eslint-enable no-magic-numbers */ - ]; - palette$2.defaultElementColor = 0x804D00; // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. - - palette$2.elementColors = { - /* eslint-disable no-magic-numbers */ - H: 0xFFFFFF, - C: 0x40BFBF, - N: 0x0000FF, - O: 0xFF0000, - P: 0x808033, - S: 0xFFFF00 - /* eslint-enable no-magic-numbers */ - - }; - palette$2.defaultResidueColor = 0x40C0C0; // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. - - palette$2.residueColors = { - /* eslint-disable no-magic-numbers */ - ALA: 0x0000FF, - ARG: 0xFFFFFF, - ASN: 0x808033, - ASP: 0xFF0000, - CYS: 0xFFFF00, - GLN: 0xFF8000, - GLU: 0xFF9999, - GLY: 0xFFFFFF, - HIS: 0x40C0C0, - ILE: 0x00FF00, - LEU: 0xFF9999, - LYS: 0x40C0C0, - MET: 0xFFFF00, - PHE: 0xA600A6, - PRO: 0x804C00, - SER: 0xFFFF00, - THR: 0xE666B3, - TRP: 0x999999, - TYR: 0x00FF00, - VAL: 0x808033, - A: 0x0000FF, - C: 0xFF8000, - G: 0xFFFF00, - T: 0xA600A6, - U: 0x00FF00, - DA: 0x0000FF, - DC: 0xFF8000, - DG: 0xFFFF00, - DT: 0xA600A6, - DU: 0x00FF00, - '+A': 0x0000FF, - '+C': 0xFF8000, - '+G': 0xFFFF00, - '+T': 0xA600A6, - '+U': 0x00FF00, - WAT: 0x40C0C0, - H2O: 0x40C0C0, - HOH: 0x40C0C0 - /* eslint-enable no-magic-numbers */ - - }; - palette$2.chainColors = [0xFFFFFF].concat(palette$2.colors); - var StructuralElementType$4 = StructuralElement.Type; - palette$2.secondaryColors = (_palette$secondaryCol$1 = {}, defineProperty(_palette$secondaryCol$1, StructuralElementType$4.HELIX_ALPHA, 0xA600A6), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.HELIX_310, 0x0000FF), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.HELIX_PI, 0xFF0000), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.STRAND, 0xFFFF00), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.BRIDGE, 0x808033), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.TURN, 0x40C0C0), _palette$secondaryCol$1); - - var palettes = new EntityList([palette, palette$1, palette$2]); - - /** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. - * - * These options are copied locally and not kept by reference, so the created instance will not reflect further - * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation. - * - * @exports Colorer - * @this Colorer - * @abstract - * @constructor - * @classdesc Basic class for all available coloring algorithms used for building and displaying molecule geometry. - */ - - var Colorer = /*#__PURE__*/function () { - function Colorer(opts) { - classCallCheck(this, Colorer); - - if (this.constructor === Colorer) { - throw new Error('Can not instantiate abstract class!'); - } - /** - * Colorer options inherited (prototyped) from defaults. - * @type {object} - */ - - - this.opts = _.merge(utils.deriveDeep(settings.now.colorers[this.id], true), opts); - /** - * Palette in use. - * @type {Palette} - */ - - this.palette = palettes.first; - } - /** - * Get Colorer identification, probably with options. - * @returns {string|Array} Colorer identifier string ({@link Colorer#id}) or two-element array containing both colorer - * identifier and options ({@link Colorer#opts}). - * Options are returned if they were changed during or after colorer creation. - */ - - - createClass(Colorer, [{ - key: "identify", - value: function identify() { - var diff = utils.objectsDiff(this.opts, settings.now.colorers[this.id]); - - if (!_.isEmpty(diff)) { - return [this.id, diff]; - } - - return this.id; - } - }]); - - return Colorer; - }(); - /** - * Colorer identifier. - * @type {string} - */ - - - Colorer.prototype.id = '__'; - - /** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @see Element - * - * @exports ElementColorer - * @augments Colorer - * @constructor - * @classdesc Coloring algorithm based on chemical element. - */ - - var ElementColorer = /*#__PURE__*/function (_Colorer) { - inherits(ElementColorer, _Colorer); - - function ElementColorer() { - classCallCheck(this, ElementColorer); - - return possibleConstructorReturn(this, getPrototypeOf(ElementColorer).apply(this, arguments)); - } - - createClass(ElementColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - var type = atom.element.name; - - if (type === 'C' && this.opts.carbon >= 0) { - return this.opts.carbon; - } - - return this.palette.getElementColor(type); - } - }, { - key: "getResidueColor", - value: function getResidueColor(_residue, _complex) { - return this.palette.defaultResidueColor; - } - }]); - - return ElementColorer; - }(Colorer); - - defineProperty(ElementColorer, "id", 'EL'); - - ElementColorer.prototype.id = 'EL'; - ElementColorer.prototype.name = 'Element'; - ElementColorer.prototype.shortName = 'Element'; - - /** - * Coloring algorithm based on residue type. - * - * @see ResidueType - * - * @exports ResidueTypeColorer - * @constructor - */ - - var ResidueTypeColorer = /*#__PURE__*/function (_Colorer) { - inherits(ResidueTypeColorer, _Colorer); - - function ResidueTypeColorer() { - classCallCheck(this, ResidueTypeColorer); - - return possibleConstructorReturn(this, getPrototypeOf(ResidueTypeColorer).apply(this, arguments)); - } - - createClass(ResidueTypeColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - return this.palette.getResidueColor(residue._type._name); - } - }]); - - return ResidueTypeColorer; - }(Colorer); - - defineProperty(ResidueTypeColorer, "id", 'RT'); - - ResidueTypeColorer.prototype.id = 'RT'; - ResidueTypeColorer.prototype.name = 'Residue Type'; - ResidueTypeColorer.prototype.shortName = 'Residue'; - - var SequenceColorer = /*#__PURE__*/function (_Colorer) { - inherits(SequenceColorer, _Colorer); - - function SequenceColorer() { - classCallCheck(this, SequenceColorer); - - return possibleConstructorReturn(this, getPrototypeOf(SequenceColorer).apply(this, arguments)); - } - - createClass(SequenceColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var chain = residue._chain; - - if (chain.minSequence === Number.POSITIVE_INFINITY && chain.maxSequence === Number.NEGATIVE_INFINITY) { - return this.palette.defaultNamedColor; - } - - var min = chain.minSequence; - var max = chain.maxSequence > min ? chain.maxSequence : min + 1; - return this.palette.getGradientColor((residue._sequence - min) / (max - min), this.opts.gradient); - } - }]); - - return SequenceColorer; - }(Colorer); - - defineProperty(SequenceColorer, "id", 'SQ'); - - SequenceColorer.prototype.id = 'SQ'; - SequenceColorer.prototype.name = 'Sequence'; - SequenceColorer.prototype.shortName = 'Sequence'; - - var ChainColorer = /*#__PURE__*/function (_Colorer) { - inherits(ChainColorer, _Colorer); - - function ChainColorer() { - classCallCheck(this, ChainColorer); - - return possibleConstructorReturn(this, getPrototypeOf(ChainColorer).apply(this, arguments)); - } - - createClass(ChainColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - return this.palette.getChainColor(residue.getChain()._name); - } - }]); - - return ChainColorer; - }(Colorer); - - defineProperty(ChainColorer, "id", 'CH'); - - ChainColorer.prototype.id = 'CH'; - ChainColorer.prototype.name = 'Chain'; - ChainColorer.prototype.shortName = 'Chain'; - - var SecondaryStructureColorer = /*#__PURE__*/function (_Colorer) { - inherits(SecondaryStructureColorer, _Colorer); - - function SecondaryStructureColorer() { - classCallCheck(this, SecondaryStructureColorer); - - return possibleConstructorReturn(this, getPrototypeOf(SecondaryStructureColorer).apply(this, arguments)); - } - - createClass(SecondaryStructureColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - if (residue._type.flags & ResidueType.Flags.DNA) { - return this.palette.getSecondaryColor('dna'); - } - - if (residue._type.flags & ResidueType.Flags.RNA) { - return this.palette.getSecondaryColor('rna'); - } - - var secondary = residue.getSecondary(); - - if (secondary) { - var color = this.palette.getSecondaryColor(secondary.type, true); - - if (color === undefined) { - color = this.palette.getSecondaryColor(secondary.generic); - } - - return color; - } - - return this.palette.defaultSecondaryColor; - } - }]); - - return SecondaryStructureColorer; - }(Colorer); - - defineProperty(SecondaryStructureColorer, "id", 'SS'); - - SecondaryStructureColorer.prototype.id = 'SS'; - SecondaryStructureColorer.prototype.name = 'Secondary Structure'; - SecondaryStructureColorer.prototype.shortName = 'Structure'; - - var UniformColorer = /*#__PURE__*/function (_Colorer) { - inherits(UniformColorer, _Colorer); - - function UniformColorer() { - classCallCheck(this, UniformColorer); - - return possibleConstructorReturn(this, getPrototypeOf(UniformColorer).apply(this, arguments)); - } - - createClass(UniformColorer, [{ - key: "getAtomColor", - value: function getAtomColor(_atom, _complex) { - return this.opts.color; - } - }, { - key: "getResidueColor", - value: function getResidueColor(_residue, _complex) { - return this.opts.color; - } - }]); - - return UniformColorer; - }(Colorer); - - defineProperty(UniformColorer, "id", 'UN'); - - UniformColorer.prototype.id = 'UN'; - UniformColorer.prototype.name = 'Uniform'; - UniformColorer.prototype.shortName = 'Uniform'; - - /** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @exports ConditionalColorer - * @augments Colorer - * @constructor - * @classdesc Bicolor coloring algorithm based on a selector string used as a condition. - */ - - var ConditionalColorer = /*#__PURE__*/function (_Colorer) { - inherits(ConditionalColorer, _Colorer); - - function ConditionalColorer(opts) { - var _this; - - classCallCheck(this, ConditionalColorer); - - _this = possibleConstructorReturn(this, getPrototypeOf(ConditionalColorer).call(this, opts)); - var parsed = selectors.parse(_this.opts.subset); - _this._subsetCached = parsed.error ? selectors.none() : parsed.selector; - return _this; - } - - createClass(ConditionalColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - return this._subsetCached.includesAtom(atom) ? this.opts.color : this.opts.baseColor; - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var subset = this._subsetCached; - var includes = true; - var atoms = residue._atoms; - - for (var i = 0, n = atoms.length; i < n; ++i) { - includes = includes && subset.includesAtom(atoms[i]); - } - - return includes ? this.opts.color : this.opts.baseColor; - } - }]); - - return ConditionalColorer; - }(Colorer); - - defineProperty(ConditionalColorer, "id", 'CO'); - - ConditionalColorer.prototype.id = 'CO'; - ConditionalColorer.prototype.name = 'Conditional'; - ConditionalColorer.prototype.shortName = 'Conditional'; - - var ConformationColorer = /*#__PURE__*/function (_Colorer) { - inherits(ConformationColorer, _Colorer); - - function ConformationColorer() { - classCallCheck(this, ConformationColorer); - - return possibleConstructorReturn(this, getPrototypeOf(ConformationColorer).apply(this, arguments)); - } - - createClass(ConformationColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - return this.palette.getChainColor(String.fromCharCode(atom.location)); - } - }, { - key: "getResidueColor", - value: function getResidueColor(_residue, _complex) { - return this.palette.defaultResidueColor; - } - }]); - - return ConformationColorer; - }(Colorer); - - defineProperty(ConformationColorer, "id", 'CF'); - - ConformationColorer.prototype.id = 'CF'; - ConformationColorer.prototype.name = 'Conformation'; - ConformationColorer.prototype.shortName = 'Conformation'; - - /** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @see Temperature - * - * @exports TemperatureColorer - * @augments Colorer - * @constructor - * @classdesc Coloring algorithm based on temperature of chemical element. - */ - - var TemperatureColorer = /*#__PURE__*/function (_Colorer) { - inherits(TemperatureColorer, _Colorer); - - function TemperatureColorer() { - classCallCheck(this, TemperatureColorer); - - return possibleConstructorReturn(this, getPrototypeOf(TemperatureColorer).apply(this, arguments)); - } - - createClass(TemperatureColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - var opts = this.opts; - var factor = 1; - - if (atom.temperature && opts) { - if (opts.min === opts.max) { - factor = atom.temperature > opts.max ? 1 : 0; - } else { - factor = (atom.temperature - opts.min) / (opts.max - opts.min); - } - - return this.palette.getGradientColor(factor, opts.gradient); - } - - return this.palette.defaultGradientColor; - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var opts = this.opts; - - if (!opts) { - return this.palette.defaultGradientColor; - } - - if (residue.temperature) { - var factor = 0; - - if (opts.min === opts.max) { - factor = residue.temperature > opts.max ? 1 : 0; - } else { - factor = (residue.temperature - opts.min) / (opts.max - opts.min); - } - - return this.palette.getGradientColor(factor, opts.gradient); - } - - return this.palette.defaultGradientColor; - } - }]); - - return TemperatureColorer; - }(Colorer); - - defineProperty(TemperatureColorer, "id", 'TM'); - - TemperatureColorer.prototype.id = 'TM'; // [T]e[M]perature - - TemperatureColorer.prototype.name = 'Temperature'; - TemperatureColorer.prototype.shortName = 'Temperature'; - - /** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @see Occupancy - * - * @exports OccupancyColorer - * @augments Occupancy - * @constructor - * @classdesc Coloring algorithm based on occupancy of chemical element. - */ - - var OccupancyColorer = /*#__PURE__*/function (_Colorer) { - inherits(OccupancyColorer, _Colorer); - - function OccupancyColorer() { - classCallCheck(this, OccupancyColorer); - - return possibleConstructorReturn(this, getPrototypeOf(OccupancyColorer).apply(this, arguments)); - } - - createClass(OccupancyColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - var opts = this.opts; - - if (atom.occupancy && opts) { - var factor = 1 - atom.occupancy; - return this.palette.getGradientColor(factor, opts.gradient); - } - - return this.palette.defaultGradientColor; - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var opts = this.opts; - - if (!opts) { - return this.palette.defaultGradientColor; - } - - if (residue.occupancy > 0) { - var factor = 1 - residue.occupancy; - return this.palette.getGradientColor(factor, opts.gradient); - } - - return this.palette.defaultGradientColor; - } - }]); - - return OccupancyColorer; - }(Colorer); - - defineProperty(OccupancyColorer, "id", 'OC'); - - OccupancyColorer.prototype.id = 'OC'; // [OC]cupancy - - OccupancyColorer.prototype.name = 'Occupancy'; - OccupancyColorer.prototype.shortName = 'Occupancy'; - - var HydrophobicityColorer = /*#__PURE__*/function (_Colorer) { - inherits(HydrophobicityColorer, _Colorer); - - function HydrophobicityColorer() { - classCallCheck(this, HydrophobicityColorer); - - return possibleConstructorReturn(this, getPrototypeOf(HydrophobicityColorer).apply(this, arguments)); - } - - createClass(HydrophobicityColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var color = this.palette.defaultResidueColor; - - if (residue._type.hydrophobicity) { - // Kyte Doolitle hydro [-4.5,4.5]->[0.1] - var min = -4.5; - var max = 4.5; - color = this.palette.getGradientColor((residue._type.hydrophobicity - min) / (max - min), this.opts.gradient); - } - - return color; - } - }]); - - return HydrophobicityColorer; - }(Colorer); - - defineProperty(HydrophobicityColorer, "id", 'HY'); - - HydrophobicityColorer.prototype.id = 'HY'; - HydrophobicityColorer.prototype.name = 'Hydrophobicity'; - HydrophobicityColorer.prototype.shortName = 'Hydrophobicity'; - - var MoleculeColorer = /*#__PURE__*/function (_Colorer) { - inherits(MoleculeColorer, _Colorer); - - function MoleculeColorer() { - classCallCheck(this, MoleculeColorer); - - return possibleConstructorReturn(this, getPrototypeOf(MoleculeColorer).apply(this, arguments)); - } - - createClass(MoleculeColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var molecule = residue._molecule; - - var count = _complex.getMoleculeCount(); - - if (count > 1) { - return this.palette.getGradientColor((molecule.index - 1) / (count - 1), this.opts.gradient); - } - - return this.palette.getGradientColor(0, this.opts.gradient); - } - }]); - - return MoleculeColorer; - }(Colorer); - - defineProperty(MoleculeColorer, "id", 'MO'); - - MoleculeColorer.prototype.id = 'MO'; - MoleculeColorer.prototype.name = 'Molecule'; - MoleculeColorer.prototype.shortName = 'Molecule'; - - function scaleColor(c, factor) { - var r1 = c >> 16 & 0xff; - var g1 = c >> 8 & 0xff; - var b1 = c & 0xff; - var r = factor * r1; - var g = factor * g1; - var b = factor * b1; - return r << 16 | g << 8 | b; - } - /** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @exports CarbonColorer - * @augments Colorer - * @constructor - * @classdesc Bicolor coloring algorithm based on selection carbon atoms. - */ - - - var CarbonColorer = /*#__PURE__*/function (_Colorer) { - inherits(CarbonColorer, _Colorer); - - function CarbonColorer() { - classCallCheck(this, CarbonColorer); - - return possibleConstructorReturn(this, getPrototypeOf(CarbonColorer).apply(this, arguments)); - } - - createClass(CarbonColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - var colorCarbon = this.opts.color; - var colorNotCarbon = scaleColor(colorCarbon, this.opts.factor); - return atom.flags & Atom.Flags.CARBON ? colorCarbon : colorNotCarbon; - } - }, { - key: "getResidueColor", - value: function getResidueColor(_residue, _complex) { - return this.opts.color; - } - }]); - - return CarbonColorer; - }(Colorer); - - defineProperty(CarbonColorer, "id", 'CB'); - - CarbonColorer.prototype.id = 'CB'; - CarbonColorer.prototype.name = 'Carbon'; - CarbonColorer.prototype.shortName = 'Carbon'; - - var colorers = new EntityList([ElementColorer, ResidueTypeColorer, SequenceColorer, ChainColorer, SecondaryStructureColorer, UniformColorer, ConditionalColorer, ConformationColorer, TemperatureColorer, OccupancyColorer, HydrophobicityColorer, MoleculeColorer, CarbonColorer]); - - function neutralColor(intensity) { - return new THREE.Color(intensity, intensity, intensity); - } - - var materialList = [{ - id: 'DF', - name: 'Diffuse', - shortName: 'Diffuse', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 1, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: false - } - }, { - id: 'SF', - name: 'Soft Plastic', - shortName: 'Soft', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.1), - shininess: 30, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: false - } - }, { - id: 'PL', - name: 'Glossy Plastic', - shortName: 'Glossy', - uberOptions: { - diffuse: neutralColor(0.56), - specular: neutralColor(0.28), - shininess: 100, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: false - } - }, { - id: 'ME', - name: 'Metal', - shortName: 'Metal', - uberOptions: { - diffuse: neutralColor(0.56), - specular: neutralColor(0.55), - shininess: 30, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: false - } - }, { - id: 'TR', - name: 'Transparent', - shortName: 'Transparent', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 1, - opacity: 0.5 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: true, - toonShading: false - } - }, { - id: 'GL', - name: 'Glass', - shortName: 'Glass', - uberOptions: { - diffuse: neutralColor(0.50), - specular: neutralColor(0.65), - shininess: 100, - opacity: 0.5 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: true, - toonShading: false - } - }, { - id: 'BA', - name: 'Backdrop', - shortName: 'Backdrop', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 1, - opacity: 1.0 - }, - values: { - lights: false, - fog: false, - depthWrite: false, - transparent: false, - toonShading: false - } - }, { - id: 'TN', - name: 'Toon', - shortName: 'Toon', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 1, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: true - } - }, { - id: 'FL', - name: 'Flat', - shortName: 'Flat', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 0, - opacity: 1.0 - }, - values: { - lights: false, - fog: true, - depthWrite: true, - transparent: false - } - }]; - var materials = new EntityList(materialList); - - var selectors$2 = chem.selectors; - - var Representation = /*#__PURE__*/function () { - function Representation(index, mode, colorer, selector) { - classCallCheck(this, Representation); - - var startMaterialValues = { - clipPlane: settings.now.draft.clipPlane, - fogTransparent: settings.now.bg.transparent, - shadowmap: settings.now.shadow.on, - shadowmapType: settings.now.shadow.type - }; - this.index = index; - this.mode = mode; - this.colorer = colorer; - this.selector = selector; - this.selectorString = ''; - this.count = 0; - this.material = new UberMaterial(); - this.material.setValues(startMaterialValues); - this.material.setUberOptions({ - fogAlpha: settings.now.fogAlpha - }); - this.materialPreset = materials.first; - this.needsRebuild = true; - this.visible = true; // apply mode params & preset - - this.setMode(mode); - } - - createClass(Representation, [{ - key: "markAtoms", - value: function markAtoms(complex) { - this.count = complex.markAtoms(this.selector, 1 << this.index); - this.needsRebuild = true; - return this.count; - } - }, { - key: "unmarkAtoms", - value: function unmarkAtoms(complex) { - complex.clearAtomBits(1 << this.index); - this.count = 0; - } - }, { - key: "setMode", - value: function setMode(mode) { - this.mode = mode; - } - }, { - key: "setMaterialPreset", - value: function setMaterialPreset(preset) { - this.materialPreset = preset; - this.material.setUberOptions(preset.uberOptions); - this.material.setValues(preset.values); - } - }, { - key: "reset", - value: function reset() { - this.geo = null; - this.selectionGeo = null; - } - }, { - key: "buildGeometry", - value: function buildGeometry(complex) { - this.reset(); - this.needsRebuild = false; - - if (settings.now.ao) { - this.material.setValues({ - normalsToGBuffer: settings.now.ao - }); - } - - this.geo = this.mode.buildGeometry(complex, this.colorer, 1 << this.index, this.material); - - if (this.material.uberOptions.opacity < 0.99 && settings.now.transparency === 'prepass') { - gfxutils.processTransparentMaterial(this.geo, this.material); - } - - this.geo.visible = this.visible; - gfxutils.processObjRenderOrder(this.geo, this.materialPreset.id); - gfxutils.processColFromPosMaterial(this.geo, this.material); - - if (settings.now.shadow.on) { - gfxutils.createShadowmapMaterial(this.geo, this.material); - } - - return this.geo; - } - }, { - key: "buildSelectionGeometry", - value: function buildSelectionGeometry(mask) { - var sg = null; - - if (this.geo && 'getSubset' in this.geo) { - var meshes = this.geo.getSubset(mask); - - if (meshes && meshes.length > 0) { - sg = new THREE.Group(); - sg.matrixAutoUpdate = false; - sg.matrix = this.geo.matrix; - - for (var j = 0; j < meshes.length; j++) { - var m = meshes[j]; - sg.add(m); - } - } - } - - if (sg) { - sg.visible = this.visible; - } - - this.selectionGeo = sg; - return this.selectionGeo; - } - /** - * Create object that represents difference between current and another rep - * anotherRep could be undefined. In this case everything is reported. - */ - - }, { - key: "compare", - value: function compare(repSettings) { - var diff = {}; - var selStr = String(this.selector); - - if (!repSettings || selStr.valueOf() !== String(repSettings.selector).valueOf()) { - diff.selector = selStr; - } - - var modeDiff = this.mode.identify(); - - if (!repSettings || Array.isArray(modeDiff) || modeDiff !== repSettings.mode) { - diff.mode = modeDiff; - } - - var colorerDiff = this.colorer.identify(); - - if (!repSettings || Array.isArray(colorerDiff) || colorerDiff !== repSettings.colorer) { - diff.colorer = colorerDiff; - } - - if (!repSettings || this.materialPreset.id !== repSettings.material) { - diff.material = this.materialPreset.id; - } - - return diff; - } - /** - * Change representation. Write fields what was changed into new object, return it. - */ - - }, { - key: "change", - value: function change(repSettings, complex, mode, color) { - var diff = {}; // modify selector - - if (repSettings.selector) { - var newSelectorObject = selectors$2.parse(repSettings.selector).selector; - var newSelector = String(newSelectorObject); - - if (this.selectorString !== newSelector) { - diff.selector = newSelector; - this.selectorString = newSelector; - this.selector = newSelectorObject; - this.markAtoms(complex); - } - } // modify mode - - - if (repSettings.mode) { - var newMode = repSettings.mode; - - if (!_.isEqual(this.mode.identify(), newMode)) { - diff.mode = newMode; - this.setMode(mode); - } - } // modify colorer - - - if (repSettings.colorer) { - var newColorer = repSettings.colorer; - - if (!_.isEqual(this.colorer.identify(), newColorer)) { - diff.colorer = newColorer; - this.colorer = color; - } - } // modify material - - - if (repSettings.material) { - var newMaterial = repSettings.material; - - if (!_.isEqual(this.materialPreset.id, newMaterial)) { - diff.material = newMaterial; - this.setMaterialPreset(materials.get(repSettings.material)); - } - } - - return diff; - } - }, { - key: "show", - value: function show(visible) { - this.visible = visible; - - if (this.geo) { - this.geo.visible = visible; - } - - if (this.selectionGeo) { - this.selectionGeo.visible = visible; - } - } - }]); - - return Representation; - }(); - - function _traverseComponentGroups(root, component, callback) { - var children = root.children; - - if (!children) { - return; - } - - for (var i = 0, n = children.length; i < n; ++i) { - var child = children[i]; - - if (child._component === component) { - callback(child); - } - - if (child instanceof gfxutils.RCGroup) { - _traverseComponentGroups(child, component, callback); - } - } - } - - function ComplexEditor() {} - - var ComplexComponentEditor = /*#__PURE__*/function (_ComplexEditor) { - inherits(ComplexComponentEditor, _ComplexEditor); - - function ComplexComponentEditor(complexVisual) { - var _this; - - classCallCheck(this, ComplexComponentEditor); - - _this = possibleConstructorReturn(this, getPrototypeOf(ComplexComponentEditor).call(this)); - _this._complexVisual = complexVisual; - _this._inProgress = false; - return _this; - } - - createClass(ComplexComponentEditor, [{ - key: "begin", - value: function begin() { - var complex = this._complexVisual.getComplex(); // init component matrices - - - this._componentTransforms = []; - - for (var i = 0; i < complex._components.length; ++i) { - var component = complex._components[i]; - this._componentTransforms[component._index] = new THREE.Object3D(); - } - - this._inProgress = true; - return true; - } - }, { - key: "apply", - value: function apply() { - if (!this._inProgress) { - return; - } - - var complex = this._complexVisual.getComplex(); - - for (var i = 0; i < complex._components.length; ++i) { - this._bakeComponentTransform(complex._components[i]); - } - - complex.onAtomPositionChanged(); - - this._resetComponentTransform(); - - this._complexVisual.finalizeEdit(); - } - }, { - key: "discard", - value: function discard() { - if (!this._inProgress) { - return; - } - - this._resetComponentTransform(); - - this._complexVisual.finalizeEdit(); - } - }, { - key: "getAltObj", - value: function getAltObj() { - var res = { - objects: [], - pivot: new THREE.Vector3(0, 0, 0) - }; - var visual = this._complexVisual; - var component = visual.getSelectedComponent(); - - if (component === null) { - return res; - } - - var selection = this._complexVisual.getSelectionGeo(); - - var selectionMask = 1 << visual.getSelectionBit(); - var i; - var j; - var reprNode; - var geo; // find all geo nodes for this component - - _traverseComponentGroups(visual, component, function (child) { - res.objects.push(child); - }); // find all selection nodes for this component - - - for (i = 0; i < selection.children.length; ++i) { - reprNode = selection.children[i]; - - for (j = 0; j < reprNode.children.length; ++j) { - geo = reprNode.children[j]; - - if (geo.hasOwnProperty('_component') && geo._component === component) { - res.objects.push(geo); - } - } - } // add dummy object that stores component transformation - - - res.objects.push(this._componentTransforms[component._index]); - var bbmin = new THREE.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - var bbmax = new THREE.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - component.forEachResidue(function (residue) { - var atoms = residue._atoms; - - for (j = 0; j < atoms.length; ++j) { - if (atoms[j].mask & selectionMask) { - bbmin.min(atoms[j].position); - bbmax.max(atoms[j].position); - } - } - }); - res.pivot.lerpVectors(bbmin, bbmax, 0.5); - return res; - } - }, { - key: "_bakeComponentTransform", - value: function _bakeComponentTransform(component) { - var t = this._componentTransforms[component._index]; - - if (t && (!(t.position.x === 0 && t.position.y === 0 && t.position.z === 0) || !(t.quaternion.x === 0 && t.quaternion.y === 0 && t.quaternion.z === 0 && t.quaternion.w === 1))) { - t.updateMatrix(); - component.forEachResidue(function (residue) { - var atoms = residue._atoms; - - for (var j = 0; j < atoms.length; ++j) { - atoms[j].position.applyMatrix4(t.matrix); - } - }); - } - } - }, { - key: "_resetComponentTransform", - value: function _resetComponentTransform() { - var visual = this._complexVisual; - - var selection = this._complexVisual.getSelectionGeo(); - - var i; - var j; - var reprNode; - var geo; - - for (i = 0; i < this._componentTransforms.length; ++i) { - geo = this._componentTransforms[i]; - geo.position.set(0, 0, 0); - geo.quaternion.set(0, 0, 0, 1); - } // reset all geo nodes - - - for (i = 0; i < visual.children.length; ++i) { - reprNode = visual.children[i]; - - for (j = 0; j < reprNode.children.length; ++j) { - geo = reprNode.children[j]; - - if (geo.hasOwnProperty('_component')) { - geo.position.set(0, 0, 0); - geo.quaternion.set(0, 0, 0, 1); - } - } - } // reset all selection nodes - - - for (i = 0; i < selection.children.length; ++i) { - reprNode = selection.children[i]; - - for (j = 0; j < reprNode.children.length; ++j) { - geo = reprNode.children[j]; - - if (geo.hasOwnProperty('_component')) { - geo.position.set(0, 0, 0); - geo.quaternion.set(0, 0, 0, 1); - } - } - } - } - }]); - - return ComplexComponentEditor; - }(ComplexEditor); - - var ComplexFragmentEditor = /*#__PURE__*/function (_ComplexEditor2) { - inherits(ComplexFragmentEditor, _ComplexEditor2); - - function ComplexFragmentEditor(complexVisual) { - var _this2; - - classCallCheck(this, ComplexFragmentEditor); - - _this2 = possibleConstructorReturn(this, getPrototypeOf(ComplexFragmentEditor).call(this)); - _this2._complexVisual = complexVisual; - _this2._inProgress = false; - return _this2; - } - - createClass(ComplexFragmentEditor, [{ - key: "begin", - value: function begin() { - var visual = this._complexVisual; - - var selection = this._complexVisual.getSelectionGeo(); - - var atoms = this._getSelectionBorderAtoms(); - - if (atoms.length < 1 || atoms.length > 2) { - logger.error('Can only edit fragments with one or two bound atoms.'); - return false; - } - - this._fragmentBoundAtoms = atoms; - var selectionMask = 1 << visual.getSelectionBit(); // hide selected fragment in main model - - visual.disableSubset(selectionMask, true); // hide selection geo in main model - - for (var k = 0; k < selection.children.length; ++k) { - selection.children[k].visible = false; - } // create visible fragment representation to rotate - - - var pivotPos = atoms[0].position.clone(); - - if (atoms.length === 2) { - pivotPos.lerp(atoms[1].position, 0.5); - } - - this._fragmentGeo = new THREE.Group(); - visual.add(this._fragmentGeo); - - this._fragmentGeo.position.copy(pivotPos); - - this._fragmentSelectionGeo = new THREE.Group(); - selection.add(this._fragmentSelectionGeo); - - this._fragmentSelectionGeo.position.copy(pivotPos); - - var offset = pivotPos.clone(); - offset.negate(); - - for (var i = 0; i < visual.children.length; ++i) { - var g = visual.children[i]; - - if (!('getSubset' in g)) { - continue; - } - - var vg = new THREE.Group(); - - this._fragmentGeo.add(vg); - - var sg = new THREE.Group(); - - this._fragmentSelectionGeo.add(sg); - - var meshes = g.getSubset(selectionMask, true); - - for (var j = 0; j < meshes.length; j++) { - var m = meshes[j]; - vg.add(m); - m.position.copy(offset); - } - - var smeshes = g.getSubset(selectionMask, true); - - for (var h = 0; h < smeshes.length; h++) { - var sm = smeshes[h]; - sg.add(sm); - sm.position.copy(offset); - } - } - - gfxutils.applySelectionMaterial(this._fragmentSelectionGeo); - this._inProgress = true; - return true; - } - }, { - key: "apply", - value: function apply() { - if (!this._inProgress) { - return; - } - - var visual = this._complexVisual; - var selectionBit = visual.getSelectionBit(); - var p = this._fragmentGeo.position; - - var m = this._fragmentGeo.matrix.clone(); - - m.multiply(new THREE.Matrix4().makeTranslation(-p.x, -p.y, -p.z)); - - this._bakeAtomTransform(m, 1 << selectionBit); // show selected fragment in main model - - - visual.enableSubset(1 << selectionBit, true); - visual.getComplex().onAtomPositionChanged(); - visual.finalizeEdit(); - } - }, { - key: "discard", - value: function discard() { - if (!this._inProgress) { - return; - } - - var visual = this._complexVisual; - - var selection = this._complexVisual.getSelectionGeo(); - - this._fragmentGeo.parent.remove(this._fragmentGeo); // show selected fragment in main model - - - visual.enableSubset(1 << visual.getSelectionBit(), true); // show selection geo in main model (+ remove fragment selection geo) - - for (var i = 0; i < selection.children.length; ++i) { - var node = selection.children[i]; - - if (node.visible) { - selection.remove(node); - } else { - node.visible = true; - } - } - - visual.finalizeEdit(); - } - }, { - key: "isFreeRotationAllowed", - value: function isFreeRotationAllowed() { - return this._fragmentBoundAtoms.length < 2; - } - }, { - key: "getAltObj", - value: function getAltObj() { - var res = { - objects: [], - pivot: new THREE.Vector3(0, 0, 0) - }; - res.objects.push(this._fragmentGeo, this._fragmentSelectionGeo); - var boundAtoms = this._fragmentBoundAtoms; - - if (boundAtoms.length === 1) { - if (boundAtoms[0].bonds.length === 1) { - // single external bond allows rotation about bond axis - var bond = boundAtoms[0].bonds[0]; - res.axis = new THREE.Vector3().subVectors(bond._right.position, bond._left.position); - res.axis.normalize(); - res.axis.transformDirection(this._complexVisual.matrixWorld); - } - } else if (boundAtoms.length === 2) { - // two bound atoms allow rotation only about axis running through their centers - res.axis = new THREE.Vector3().subVectors(boundAtoms[1].position, boundAtoms[0].position); - res.axis.normalize(); - res.axis.transformDirection(this._complexVisual.matrixWorld); - } - - return res; - } - }, { - key: "_getSelectionBorderAtoms", - value: function _getSelectionBorderAtoms() { - var complex = this._complexVisual.getComplex(); - - var selectionMask = 1 << this._complexVisual.getSelectionBit(); - - var atomHash = {}; - complex.forEachBond(function (bond) { - if (bond._left.mask & selectionMask) { - if ((bond._right.mask & selectionMask) === 0) { - atomHash[bond._left.index] = 1; - } - } else if (bond._right.mask & selectionMask) { - atomHash[bond._right.index] = 1; - } - }); - var atoms = []; - var keys = Object.keys(atomHash); - - for (var i = 0, n = keys.length; i < n; ++i) { - var idx = keys[i]; - atoms.push(complex._atoms[idx]); - } - - return atoms; - } - }, { - key: "_bakeAtomTransform", - value: function _bakeAtomTransform(matrix, mask) { - this._complexVisual.getComplex().forEachAtom(function (atom) { - if (atom.mask & mask) { - atom.position.applyMatrix4(matrix); - } - }); - } - }]); - - return ComplexFragmentEditor; - }(ComplexEditor); - - var ComplexVisualEdit = { - ComponentEditor: ComplexComponentEditor, - FragmentEditor: ComplexFragmentEditor - }; - - var selectors$3 = chem.selectors; - - function lookupAndCreate(entityList, specs) { - if (!Array.isArray(specs)) { - specs = [specs]; - } - - var _specs = specs, - _specs2 = slicedToArray(_specs, 2), - id = _specs2[0], - opts = _specs2[1]; - - var Entity = entityList.get(id) || entityList.first; - return new Entity(opts); - } - - var ComplexVisual = /*#__PURE__*/function (_Visual) { - inherits(ComplexVisual, _Visual); - - function ComplexVisual(name, dataSource) { - var _this; - - classCallCheck(this, ComplexVisual); - - _this = possibleConstructorReturn(this, getPrototypeOf(ComplexVisual).call(this, name, dataSource)); - _this._complex = dataSource; - /** @type {Representation[]} */ - - _this._reprList = []; - /** @type {?Representation} */ - - _this._repr = null; - _this._reprListChanged = true; - _this._selectionBit = 0; - _this._reprUsedBits = 0; - _this._selectionCount = 0; - _this._selectionGeometry = new THREE.Group(); - return _this; - } - - createClass(ComplexVisual, [{ - key: "getBoundaries", - value: function getBoundaries() { - return this._complex.getBoundaries(); - } - }, { - key: "release", - value: function release() { - if (this._selectionGeometry.parent) { - this._selectionGeometry.remove(this._selectionGeometry); - } - - Visual.prototype.release.call(this); - } - }, { - key: "getComplex", - value: function getComplex() { - return this._complex; - } - }, { - key: "getSelectionCount", - value: function getSelectionCount() { - return this._selectionCount; - } - }, { - key: "getSelectionGeo", - value: function getSelectionGeo() { - return this._selectionGeometry; - } - }, { - key: "getSelectionBit", - value: function getSelectionBit() { - return this._selectionBit; - } - }, { - key: "getEditor", - value: function getEditor() { - return this._editor; - } - }, { - key: "resetReps", - value: function resetReps(reps) { - // Create all necessary representations - if (this._complex) { - this._complex.clearAtomBits(~0); - } - - this._reprListChanged = true; - this._reprUsedBits = 0; - this._reprList.length = reps.length; - - for (var i = 0, n = reps.length; i < n; ++i) { - var rep = reps[i]; - var selector = void 0; - var selectorString = void 0; - - if (typeof rep.selector === 'string') { - selectorString = rep.selector; - - var _selectors$parse = selectors$3.parse(selectorString); - - selector = _selectors$parse.selector; - } else if (typeof rep.selector === 'undefined') { - selectorString = settings.now.presets["default"][0].selector; - - var _selectors$parse2 = selectors$3.parse(selectorString); - - selector = _selectors$parse2.selector; - } else { - selector = rep.selector; - selectorString = selector.toString(); - } - - var mode = lookupAndCreate(modes, rep.mode); - var colorer = lookupAndCreate(colorers, rep.colorer); - var material = materials.get(rep.material) || materials.first; - this._reprList[i] = new Representation(i, mode, colorer, selector); - - this._reprList[i].setMaterialPreset(material); - - this._reprList[i].selectorString = selectorString; - - if (this._complex) { - this._complex.markAtoms(selector, 1 << i); - } - - this._reprUsedBits |= 1 << i; - } - - this._repr = reps.length > 0 ? this._reprList[0] : null; - this._selectionBit = reps.length; - this._reprUsedBits |= 1 << this._selectionBit; // selection uses one bit - - this._selectionCount = 0; - - if (this._complex) { - this._complex.update(); - } - } - /** - * Get number of representations created so far. - * @returns {number} Number of reps. - */ - - }, { - key: "repCount", - value: function repCount() { - return this._reprList.length; - } - /** - * Get or set the current representation index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. - * @returns {number} The current index. - */ - - }, { - key: "repCurrent", - value: function repCurrent(index) { - if (index >= 0 && index < this._reprList.length) { - this._repr = this._reprList[index]; - } else { - index = this._reprList.indexOf(this._repr); - } - - return index; - } - /** - * Get or set representation by index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. - * @param {object=} rep - Optional representation description. - * @param {string=} rep.selector - Selector string. - * @param {string=} rep.mode - Mode id. - * @param {string=} rep.colorer - Colorer id. - * @param {string=} rep.material - Material id. - * @returns {Object} {desc, index, status} field desc contains rep description, index - index of correspondent rep, - * status - one of three strings: 'created', 'changed', ''. 'created' means new rep was created during this function, - * 'changed' - rep was changed during this function. '' - something else. - */ - - }, { - key: "rep", - value: function rep(index, _rep) { - // if index is missing then it is the current - if (!_rep && (index === undefined || index instanceof Object)) { - _rep = index; - index = this.repCurrent(); - } // fail if out of bounds - - - if (index < 0 || index > this._reprList.length) { - logger.error("Rep ".concat(index, " does not exist!")); - return null; - } // a special case of adding just after the end - - - if (index === this._reprList.length) { - var res = this.repAdd(_rep); - logger.warn("Rep ".concat(index, " does not exist! New representation was created.")); - return { - desc: res.desc, - index: index, - status: 'created' - }; - } // gather description - - - var target = this._reprList[index]; - var desc = { - selector: target.selectorString, - mode: target.mode.identify(), - colorer: target.colorer.identify(), - material: target.materialPreset.id - }; // modification is requested - - if (_rep) { - // modify - var diff = target.change(_rep, this._complex, lookupAndCreate(modes, _rep.mode), lookupAndCreate(colorers, _rep.colorer)); // something was changed - - if (!_.isEmpty(diff)) { - target.needsRebuild = true; - - for (var key in diff) { - if (diff.hasOwnProperty(key)) { - desc[key] = diff[key]; - logger.debug("rep[".concat(index, "].").concat(key, " changed to ").concat(diff[key])); - } - } // safety trick: lower resolution for surface modes - - - if (diff.mode && target.mode.isSurface && (settings.now.resolution === 'ultra' || settings.now.resolution === 'high')) { - logger.report('Surface resolution was changed to "medium" to avoid hang-ups.'); - settings.set('resolution', 'medium'); - } - - return { - desc: desc, - index: index, - status: 'changed' - }; - } - } - - return { - desc: desc, - index: index, - status: '' - }; - } - /** - * Get representation (not just description) by index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. - * @returns {?object} Representation. - */ - - }, { - key: "repGet", - value: function repGet(index) { - // if index is missing then it is the current - if (index === undefined || index instanceof Object) { - index = this.repCurrent(); - } // fail if out of bounds - - - if (index < 0 || index >= this._reprList.length) { - return null; - } - - return this._reprList[index]; - } - }, { - key: "_getFreeReprIdx", - value: function _getFreeReprIdx() { - var bits = this._reprUsedBits; - - for (var i = 0; i <= ComplexVisual.NUM_REPRESENTATION_BITS; ++i, bits >>= 1) { - if ((bits & 1) === 0) { - return i; - } - } - - return -1; - } - /** - * Add new representation. - * @param {object=} rep - Representation description. - * @returns {Object} {desc, index} field desc contains added rep description, index - index of this rep. - */ - - }, { - key: "repAdd", - value: function repAdd(rep) { - if (this._reprList.length >= ComplexVisual.NUM_REPRESENTATION_BITS) { - return null; - } - - var newSelectionBit = this._getFreeReprIdx(); - - if (newSelectionBit < 0) { - return null; // no more slots for representations - } - - var originalSelection = this.buildSelectorFromMask(1 << this._selectionBit); // Fill in default values - - var def = settings.now.presets["default"][0]; - - var desc = _.merge({ - selector: def.selector, - mode: def.mode, - colorer: def.colorer, - material: def.material - }, rep); - - var selector = typeof desc.selector === 'string' ? selectors$3.parse(desc.selector).selector : desc.selector; - var target = new Representation(this._selectionBit, lookupAndCreate(modes, desc.mode), lookupAndCreate(colorers, desc.colorer), selector); - target.selectorString = selector.toString(); - target.setMaterialPreset(materials.get(desc.material)); - target.markAtoms(this._complex); - - this._reprList.push(target); // change selection bit - - - this._selectionBit = newSelectionBit; - this._reprUsedBits |= 1 << this._selectionBit; // restore selection using new selection bit - - this._complex.markAtoms(originalSelection, 1 << this._selectionBit); - - return { - desc: desc, - index: this._reprList.length - 1 - }; - } - /** - * Remove representation. - * @param {number=} index - Zero-based representation index. - */ - - }, { - key: "repRemove", - value: function repRemove(index) { - if (index === undefined) { - index = this.repCurrent(); - } // catch out of bounds case - - - var count = this._reprList.length; - - if (index < 0 || index >= count || count <= 1) { - // do not allow to remove the single rep - return; - } - - var target = this._reprList[index]; - target.unmarkAtoms(this._complex); - this._reprUsedBits &= ~(1 << target.index); - - this._reprList.splice(index, 1); // update current rep - - - if (target === this._repr) { - --count; - index = index < count ? index : count - 1; - this._repr = this._reprList[index]; - } - - this._reprListChanged = true; - } - /** - * Hide representation. - * @param {number} index - Zero-based representation index. - * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default). - */ - - }, { - key: "repHide", - value: function repHide(index, hide) { - if (hide === undefined) { - hide = true; - } // fail if out of bounds - - - if (index < 0 || index >= this._reprList.length) { - return; - } - - var target = this._reprList[index]; - target.show(!hide); - } - /** - * Select atoms with selector - * @param {Selector} selector - selector - * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection - */ - - }, { - key: "select", - value: function select(selector, append) { - if (append) { - this._selectionCount += this._complex.markAtomsAdditionally(selector, 1 << this._selectionBit); - } else { - this._selectionCount = this._complex.markAtoms(selector, 1 << this._selectionBit); - } - - this._complex.updateStructuresMask(); - - this.rebuildSelectionGeometry(); - } - }, { - key: "resetSelectionMask", - value: function resetSelectionMask() { - if (this._selectionCount !== 0) { - this._selectionCount = 0; - - if (this._complex) { - this._complex.clearAtomBits(1 << this._selectionBit); - } - } - } - }, { - key: "updateSelectionMask", - value: function updateSelectionMask(pickedObj) { - var self = this; - var atom = pickedObj.atom; - var residue = pickedObj.residue, - chain = pickedObj.chain, - molecule = pickedObj.molecule; - var setMask = 1 << this._selectionBit; - var clearMask = ~setMask; - - if (atom) { - residue = atom.residue; - chain = residue._chain; - molecule = residue._molecule; - - if (atom.mask & setMask) { - atom.mask &= clearMask; - residue._mask &= clearMask; - chain._mask &= clearMask; - - if (molecule) { - molecule.mask &= clearMask; - } - - this._selectionCount--; - } else { - atom.mask |= setMask; - this._selectionCount++; // select residue if all atoms in it are selected - - residue.collectMask(); // select chain and molecule if all residues in it are selected - - chain.collectMask(); - - if (molecule) { - molecule.collectMask(); - } - } - } else if (residue) { - chain = residue._chain; - molecule = residue._molecule; - - if (residue._mask & setMask) { - residue._mask &= clearMask; - chain._mask &= clearMask; - residue.forEachAtom(function (a) { - if (a.mask & setMask) { - a.mask &= clearMask; - self._selectionCount--; - } - }); - } else { - residue._mask |= setMask; - residue.forEachAtom(function (a) { - if (!(a.mask & setMask)) { - a.mask |= setMask; - self._selectionCount++; - } - }); // select chain and molecule if all residues in it are selected - - chain.collectMask(); - - if (molecule) { - molecule.collectMask(); - } - } - } else if (chain || molecule) { - var obj = chain || molecule; - - if (obj._mask & setMask) { - obj._mask &= clearMask; - obj.forEachResidue(function (r) { - if (r._mask & setMask) { - r._mask &= clearMask; - r.forEachAtom(function (a) { - if (a.mask & setMask) { - a.mask &= clearMask; - self._selectionCount--; - } - }); - r._mask &= clearMask; - } - }); - } else { - obj._mask |= setMask; - obj.forEachResidue(function (r) { - if (!(r._mask & setMask)) { - r._mask |= setMask; - r.forEachAtom(function (a) { - if (!(a.mask & setMask)) { - a.mask |= setMask; - self._selectionCount++; - } - }); - var otherObj = chain ? r.getMolecule() : r.getChain(); - - if (otherObj) { - otherObj.collectMask(); - } - } - }); - } - } else { - this.resetSelectionMask(); - } - } - }, { - key: "expandSelection", - value: function expandSelection() { - var self = this; - var selectionMask = 1 << this._selectionBit; - var tmpMask = 1 << 31; // mark atoms to add - - this._complex.forEachBond(function (bond) { - if (bond._left.mask & selectionMask) { - if ((bond._right.mask & selectionMask) === 0) { - bond._right.mask |= tmpMask; - } - } else if (bond._right.mask & selectionMask) { - bond._left.mask |= tmpMask; - } - }); // select marked atoms - - - var deselectionMask = ~tmpMask; - - this._complex.forEachAtom(function (atom) { - if (atom.mask & tmpMask) { - atom.mask = atom.mask & deselectionMask | selectionMask; - ++self._selectionCount; - } - }); - - this._complex.updateStructuresMask(); - } - }, { - key: "shrinkSelection", - value: function shrinkSelection() { - var self = this; - var selectionMask = 1 << this._selectionBit; - var tmpMask = 1 << 31; // mark atoms neighbouring to unselected ones - - this._complex.forEachBond(function (bond) { - if (bond._left.mask & selectionMask) { - if ((bond._right.mask & selectionMask) === 0) { - bond._left.mask |= tmpMask; - } - } else if (bond._right.mask & selectionMask) { - bond._right.mask |= tmpMask; - } - }); // mark hanging atoms - - - this._complex.forEachAtom(function (atom) { - if (atom.mask & selectionMask && atom.bonds.length === 1) { - atom.mask |= tmpMask; - } - }); // deselect marked atoms - - - var deselectionMask = ~(selectionMask | tmpMask); - - this._complex.forEachAtom(function (atom) { - if (atom.mask & tmpMask) { - atom.mask &= deselectionMask; - --self._selectionCount; - } - }); - - this._complex.updateStructuresMask(); - } - }, { - key: "getSelectedComponent", - value: function getSelectedComponent() { - var selectionMask = 1 << this._selectionBit; - var component = null; - var multiple = false; // find which component is selected (exclusively) - - this._complex.forEachAtom(function (atom) { - if (atom.mask & selectionMask) { - if (component === null) { - component = atom.residue._component; - } else if (component !== atom.residue._component) { - multiple = true; - } - } - }); - - return multiple ? null : component; - } - }, { - key: "getSelectionCenter", - value: function getSelectionCenter(center, includesAtom, selRule) { - center.set(0.0, 0.0, 0.0); - var count = 0; - - this._complex.forEachAtom(function (atom) { - if (includesAtom(atom, selRule)) { - center.add(atom.position); - count++; - } - }); - - if (count === 0) { - return false; - } - - center.divideScalar(count); - center.applyMatrix4(this.matrix); - return true; - } - }, { - key: "needsRebuild", - value: function needsRebuild() { - if (this._reprListChanged) { - return true; - } - - var reprList = this._reprList; - - for (var i = 0, n = reprList.length; i < n; ++i) { - var repr = reprList[i]; - - if (repr.needsRebuild) { - return true; - } - } - - return false; - } - /** - * Rebuild molecule geometry asynchronously. - */ - - }, { - key: "rebuild", - value: function rebuild() { - var self = this; // Destroy current geometry - - gfxutils.clearTree(this); - return new Promise(function (resolve) { - // Nothing to do? - var complex = self._complex; - - if (!complex) { - resolve(); - return; - } - - var errorOccured = false; - setTimeout(function () { - console.time('build'); - var reprList = self._reprList; - var palette = palettes.get(settings.now.palette) || palettes.first; - var hasGeometry = false; - - for (var i = 0, n = reprList.length; i < n; ++i) { - var repr = reprList[i]; - repr.colorer.palette = palette; - - if (repr.needsRebuild) { - repr.reset(); - - try { - repr.buildGeometry(complex); - } catch (e) { - if (e instanceof utils.OutOfMemoryError) { - repr.needsRebuild = false; - repr.reset(); - logger.error("Not enough memory to build geometry for representation ".concat(repr.index + 1)); - errorOccured = true; - } else { - throw e; - } - } - } - - hasGeometry = errorOccured || hasGeometry || gfxutils.groupHasGeometryToRender(repr.geo); - - if (repr.geo) { - self.add(repr.geo); - } - } - - self._reprListChanged = false; - console.timeEnd('build'); - resolve(); - }, 10); - }); - } - }, { - key: "setNeedsRebuild", - value: function setNeedsRebuild() { - // invalidate all representations - var reprList = this._reprList; - - for (var i = 0, n = reprList.length; i < n; ++i) { - reprList[i].needsRebuild = true; - } - } - }, { - key: "rebuildSelectionGeometry", - value: function rebuildSelectionGeometry() { - var mask = 1 << this._selectionBit; - gfxutils.clearTree(this._selectionGeometry); - - for (var i = 0, n = this._reprList.length; i < n; ++i) { - var repr = this._reprList[i]; - var sg = repr.buildSelectionGeometry(mask); - - if (!sg) { - continue; - } - - this._selectionGeometry.add(sg); - - for (var j = 0; j < sg.children.length; j++) { - var m = sg.children[j]; // copy component transform (that's not applied yet) - // TODO make this code obsolete, accessing editor is bad - - if (this._editor && this._editor._componentTransforms) { - var t = this._editor._componentTransforms[m._component._index]; - - if (t) { - m.position.copy(t.position); - m.quaternion.copy(t.quaternion); - } - } - } - - gfxutils.applySelectionMaterial(sg); - } - } - }, { - key: "_buildSelectorFromSortedLists", - value: function _buildSelectorFromSortedLists(atoms, residues, chains) { - var complex = this._complex; - - function optimizeList(list) { - var result = []; - var k = 0; - var first = NaN; - var last = NaN; - - for (var i = 0, n = list.length; i < n; ++i) { - var value = list[i]; - - if (value === last + 1) { - last = value; - } else { - if (!Number.isNaN(first)) { - result[k++] = new selectors$3.Range(first, last); - } - - first = last = value; - } - } - - if (!Number.isNaN(first)) { - result[k] = new selectors$3.Range(first, last); - } - - return result; - } - - var expression = null; - - if (chains.length === complex._chains.length) { - expression = selectors$3.all(); - } else { - var selector; - - if (chains.length > 0) { - selector = selectors$3.chain(chains); - expression = expression ? selectors$3.or(expression, selector) : selector; // NOSONAR - } - - if (Object.keys(residues).length > 0) { - for (var ch in residues) { - if (residues.hasOwnProperty(ch)) { - selector = selectors$3.and(selectors$3.chain(ch), selectors$3.residx(optimizeList(residues[ch]))); - expression = expression ? selectors$3.or(expression, selector) : selector; - } - } - } - - if (atoms.length > 0) { - selector = selectors$3.serial(optimizeList(atoms)); - expression = expression ? selectors$3.or(expression, selector) : selector; - } - - if (!expression) { - expression = selectors$3.none(); - } - } - - return expression; - } - }, { - key: "buildSelectorFromMask", - value: function buildSelectorFromMask(mask) { - var complex = this._complex; - var chains = []; - var residues = {}; - var atoms = []; - complex.forEachChain(function (chain) { - if (chain._mask & mask) { - chains.push(chain._name); - } - }); - complex.forEachResidue(function (residue) { - if (residue._mask & mask && !(residue._chain._mask & mask)) { - var c = residue._chain._name; - - if (!(c in residues)) { - residues[c] = [residue._index]; - } else { - residues[c].push(residue._index); - } - } - }); - complex.forEachAtom(function (atom) { - if (atom.mask & mask && !(atom.residue._mask & mask)) { - atoms.push(atom.serial); - } - }); - return this._buildSelectorFromSortedLists(atoms, residues, chains); - } - }, { - key: "forSelectedResidues", - value: function forSelectedResidues(process) { - var selectionMask = 1 << this._selectionBit; - - this._complex.forEachResidue(function (residue) { - if (residue._mask & selectionMask) { - process(residue); - } - }); - } - }, { - key: "beginComponentEdit", - value: function beginComponentEdit() { - if (this._editor) { - return null; - } - - var editor = new ComplexVisualEdit.ComponentEditor(this); - - if (!editor.begin()) { - return null; - } - - this._editor = editor; - return editor; - } - }, { - key: "beginFragmentEdit", - value: function beginFragmentEdit() { - if (this._editor) { - return null; - } - - var editor = new ComplexVisualEdit.FragmentEditor(this); - - if (!editor.begin()) { - return null; - } - - this._editor = editor; - return editor; - } // should only be called by editors - - }, { - key: "finalizeEdit", - value: function finalizeEdit() { - this._editor = null; - } - }, { - key: "setMaterialValues", - value: function setMaterialValues(values) { - var needTraverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; - - for (var i = 0, n = this._reprList.length; i < n; ++i) { - var rep = this._reprList[i]; - rep.material.setValues(values); - - if (needTraverse) { - rep.geo.traverse(function (object) { - if (object instanceof THREE.Mesh) { - object.material.setValues(values); - - if (process !== undefined) { - process(object); - } - - object.material.needsUpdate = true; - } - }); - } - } - } - }, { - key: "setUberOptions", - value: function setUberOptions(values) { - for (var i = 0, n = this._reprList.length; i < n; ++i) { - var rep = this._reprList[i]; - rep.material.setUberOptions(values); - } - } - /** - * Build selector that contains all atoms within given distance from group of atoms - * @param {Selector} selector - selector describing source group of atoms - * @param {number} radius - distance - * @returns {Selector} selector describing result group of atoms - */ - - }, { - key: "within", - value: function within(selector, radius) { - var vw = this._complex.getVoxelWorld(); - - if (vw === null) { - return false; - } // mark atoms of the group as selected - - - var selectionMask = 1 << this._selectionBit; - - this._complex.markAtoms(selector, selectionMask); // mark all atoms within distance as selected - - - if (vw) { - vw.forEachAtomWithinDistFromMasked(this._complex, selectionMask, Number(radius), function (atom) { - atom.mask |= selectionMask; - }); - } // update selection count - - - this._selectionCount = this._complex.countAtomsByMask(selectionMask); // update secondary structure mask - - this._complex.updateStructuresMask(); - - return this.buildSelectorFromMask(selectionMask); - } - }]); - - return ComplexVisual; - }(Visual); // 32 bits = 30 bits for reps + 1 for selection + 1 for selection expansion - - - ComplexVisual.NUM_REPRESENTATION_BITS = 30; - - var vertexVolumeFaces = "varying vec3 pos;\r\n\r\nvoid main() {\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n pos = position.xyz + 0.5;\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n}"; - - var fragmentVolumeFaces = "varying vec3 pos;\r\n\r\nvoid main() {\r\n gl_FragColor = vec4(pos, 0.5);\r\n}"; - - var vertexVolume = "varying vec4 screenSpacePos;\r\n\r\nvoid main() {\r\n screenSpacePos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n gl_Position = screenSpacePos;\r\n}"; - - var fragmentVolume = "uniform mat4 projectionMatrix;\r\n\r\n// 3D volume texture\r\nuniform vec3 volumeDim; // volume dimensions, pixels\r\nuniform sampler2D tileTex; // tiled texture containing all Z-slices of a 3D data\r\nuniform vec2 tileTexSize; // size of tiled texture, pixels\r\nuniform vec2 tileStride; // UV stride between slices in tile tex, pixels\r\n\r\nuniform vec3 boxAngles;//value of angles({x: alpha, y:beta, z:gamma}) types 1 - if angle is obtuse, 0 - if acute\r\nuniform vec3 delta; //Projection box delta's from non-orthogonal origin axes; {x: XY, y : XZ, z: YZ}\r\n\r\nuniform vec3 _isoLevel0;\r\nuniform float _flipV;\r\nuniform sampler2D _BFLeft;\r\nuniform sampler2D _BFRight;\r\nuniform sampler2D _FFLeft;\r\nuniform sampler2D _FFRight;\r\nuniform sampler2D _WFFLeft;\r\nuniform sampler2D _WFFRight;\r\n\r\nvarying vec4 screenSpacePos;\r\n\r\n#define NO_COLOR vec4(0., 0., 0., 0.)\r\n\r\nvec4 sample3DTexture(vec3 texCoord) {\r\n // a pair of Z slices is determined by nearest slice border\r\n float zSliceBorder = floor(texCoord.z * volumeDim.z + 0.5);\r\n float zSliceNumber1 = max(zSliceBorder - 1.0, 0.0);\r\n float zSliceNumber2 = min(zSliceBorder, volumeDim.z - 1.0);\r\n\r\n float rowTiles = floor(tileTexSize.x / tileStride.x);\r\n\r\n // calculate coords in tile texture for both slices\r\n vec2 tileOffset = vec2(mod(zSliceNumber1, rowTiles), floor(zSliceNumber1 / rowTiles));\r\n vec2 texCoordSlice1 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n tileOffset = vec2(mod(zSliceNumber2, rowTiles), floor(zSliceNumber2 / rowTiles));\r\n vec2 texCoordSlice2 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n\r\n // bilinear filtering\r\n vec4 colorSlice1 = texture2D(tileTex, texCoordSlice1);\r\n vec4 colorSlice2 = texture2D(tileTex, texCoordSlice2);\r\n float weightSlice2 = texCoord.z * volumeDim.z - (zSliceNumber1 + 0.5);\r\n return mix(colorSlice1, colorSlice2, weightSlice2);\r\n}\r\n\r\nvec4 sample3DTextureInclined(vec3 boxCoord) { // delta:{ x: XY, y : XZ, z: YZ }\r\n vec3 textCoord = boxCoord;\r\n vec2 currDelta = mix(boxCoord.zz, vec2(1., 1.) - boxCoord.zz, boxAngles.yx) * delta.yz;\r\n\r\n textCoord.y = (boxCoord.y - currDelta.y) / (1. - delta.z);\r\n if (textCoord.y < 0.0 || textCoord.y > 1.0)\r\n return NO_COLOR;\r\n\r\n currDelta.x += mix(textCoord.y, 1.0 - textCoord.y, boxAngles.z) * delta.x;\r\n\r\n textCoord.x = (boxCoord.x - currDelta.x) / (1. - delta.x - delta.y);\r\n if (textCoord.x < 0.0 || textCoord.x > 1.0)\r\n return NO_COLOR;\r\n\r\n return sample3DTexture(textCoord);\r\n}\r\n\r\nfloat CalcColor(vec3 iter, vec3 dir) {\r\n float d = 1. / 128.;\r\n vec3 dx = vec3(d, 0.0, 0.0);\r\n vec3 dy = vec3(0.0, d, 0.0);\r\n vec3 dz = vec3(0.0, 0.0, d);\r\n\r\n // #Opt: coordInc.x:(iter + dx).x > 1. ? 0.: sample3DTextureInclined(iter + dx).x,\r\n vec3 coordInc = mix(\r\n vec3(\r\n sample3DTextureInclined(iter + dx).x,\r\n sample3DTextureInclined(iter + dy).x,\r\n sample3DTextureInclined(iter + dz).x\r\n ),\r\n vec3(0. ,0. , 0.),\r\n vec3(floor((iter + dx).x), floor((iter + dy).y), floor((iter + dz).z))\r\n );\r\n\r\n // #Opt: coordDec.x:(iter - dx).x < 0. ? 0.: sample3DTextureInclined(iter - dx).x,\r\n vec3 coordDec = mix(\r\n vec3(0. ,0. , 0.),\r\n vec3(\r\n sample3DTextureInclined(iter - dx).x,\r\n sample3DTextureInclined(iter - dy).x,\r\n sample3DTextureInclined(iter - dz).x\r\n ),\r\n vec3(ceil((iter - dx).x), ceil((iter - dy).y), ceil((iter - dz).z))\r\n );\r\n\r\n vec3 N = normalize(coordInc - coordDec);\r\n float dif = max(0.0, dot(N, dir));\r\n return dif;\r\n}\r\n\r\nvec3 AccuracyIso(vec3 left, vec3 right, float volLeft, float threshold) {\r\n for (int i = 0; i < 5; i++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if ((volLeft - threshold) * (vol - threshold) < 0.)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec3 CorrectIso(vec3 left, vec3 right, float tr) {\r\n for (int j = 0; j < 5; j++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if (vol < tr)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec4 GetIso1(vec3 start, vec3 back, float molDist, vec3 dir, float tr, int count) {\r\n float vol, stepSize = (float(count) + 2.) / float(STEPS_COUNT);\r\n vec3 step = stepSize * dir, iterator = start, left, right;\r\n vec4 acc = NO_COLOR;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n vol = sample3DTextureInclined(iterator).r;\r\n if (length(iterator - back) <= stepSize || (vol > tr))\r\n break;\r\n }\r\n\r\n if (vol > tr)\r\n acc = vec4(CorrectIso(iterator, iterator - step, tr).xyz, 1.);\r\n\r\n return acc;\r\n}\r\n\r\nfloat easeOut(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return 1.0 - (1.0 - t) * (1.0 - t);\r\n}\r\n\r\nfloat easeIn(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return t * t;\r\n}\r\n\r\nvec3 GetColSimple(float vol) {\r\n float t = easeOut(_isoLevel0.x, _isoLevel0.y, vol);\r\n float s = easeIn(_isoLevel0.y, _isoLevel0.z, vol);\r\n return vec3(0.5, 0.6, 0.7) * (1.0 - t) + 2.0 * vec3(s, 0, 0);\r\n}\r\n\r\nvec4 VolRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 acc = NO_COLOR, iso;\r\n vec3 iterator = start, sumColor = vec3(0., 0., 0.);\r\n float stepSize, alpha, sumAlpha = 0.0, vol, curStepSize, molD;\r\n vec3 step, col, colOld, right;\r\n float tr0 = _isoLevel0.x;\r\n float dif, r, kd, finish;\r\n int count = 0, stopMol = 0;\r\n\r\n for (int k = 0; k < 3; k++) {\r\n stepSize = (float(k) + 2.) / float(STEPS_COUNT);\r\n kd = 140. * tr0 * stepSize;\r\n r = 1. - kd;\r\n step = stepSize * dir;\r\n iso = GetIso1(iterator, back, molDist, dir, tr0, k);\r\n if (iso.a < 0.1 || length(iso.xyz - start) > molDist)\r\n break;\r\n iterator = iso.xyz;\r\n dif = 1.;// CalcColor(iterator, dir);\r\n colOld = GetColSimple(tr0);\r\n curStepSize = stepSize;\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n molD = length(iterator - start);\r\n vol = sample3DTextureInclined(iterator).r;\r\n finish = distance(iterator, back) - stepSize;\r\n if (finish < 0.0 || vol < tr0 || (sumAlpha > 0.97) || molD > molDist)\r\n break;\r\n alpha = (1. - r);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4.* colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n colOld = col;\r\n } // for i\r\n\r\n if (finish < 0.0 || sumAlpha > 0.97)\r\n break;\r\n\r\n if (molD > molDist) {\r\n curStepSize = stepSize - (molD - molDist);\r\n right = iterator - (molD - molDist) * dir;\r\n vol = sample3DTextureInclined(right).r;\r\n } else {\r\n vec3 left = iterator - step;\r\n right = CorrectIso(left, iterator, tr0);\r\n curStepSize = distance(left, right);\r\n vol = tr0;\r\n }\r\n\r\n alpha = (1. - r) * curStepSize / stepSize;\r\n dif = 1.;// CalcColor(right, dir);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * curStepSize / stepSize * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4. * colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n\r\n if (molD > molDist)\r\n break;\r\n } // for k\r\n acc.rgb = 1. * sumColor / sumAlpha;\r\n acc.a = sumAlpha;\r\n return acc;\r\n}\r\n\r\nvec4 VolRender1(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n float stepSize = 1.0 / float(STEPS_COUNT);\r\n float len = length(back - start);\r\n vec3 step = stepSize * dir;\r\n vec3 iterator = start;\r\n float acc = 0.0;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n if (float(i) * stepSize > len)\r\n break;\r\n iterator = iterator + step;\r\n if (sample3DTextureInclined(iterator).r > _isoLevel0.x)\r\n acc += 10. * sample3DTextureInclined(iterator).r / float(STEPS_COUNT);\r\n }\r\n\r\n return vec4(1.,1.,1., acc);\r\n}\r\n\r\nvec4 IsoRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 tst = GetIso1(start, back, 2., dir, _isoLevel0.x, 0);\r\n vec4 col = NO_COLOR;\r\n\r\n if (length(tst.xyz - start) < molDist && tst.a > 0.1) {\r\n float dif = CalcColor(tst.xyz, dir);\r\n dif = 0.9 * dif * dif;\r\n col = vec4(dif, dif, dif, 1);\r\n }\r\n return col;\r\n}\r\n\r\nvec4 VolRender2(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n return sample3DTexture(start);\r\n}\r\n\r\nvoid main() {\r\n vec3 tc = screenSpacePos.xyz / screenSpacePos.w * 0.5 + 0.5;\r\n\r\n if (_flipV > 0.0) {\r\n tc.y = 1.0 - tc.y;\r\n }\r\n\r\n vec3 start;\r\n vec3 back;\r\n vec3 molBack;\r\n if (projectionMatrix[0][2] < 0.0) {\r\n start = texture2D(_FFLeft, tc.xy).xyz;\r\n back = texture2D(_BFLeft, tc.xy).xyz;\r\n molBack = texture2D(_WFFLeft, tc.xy).xyz;\r\n } else {\r\n start = texture2D(_FFRight, tc.xy).xyz;\r\n back = texture2D(_BFRight, tc.xy).xyz;\r\n molBack = texture2D(_WFFRight, tc.xy).xyz;\r\n }\r\n\r\n vec3 dir = normalize(back - start);\r\n\r\n float molDist = 2.0;\r\n if (length(molBack) > 0.001) {\r\n molDist = distance(start, molBack);\r\n }\r\n\r\n #ifdef ISO_MODE\r\n gl_FragColor = IsoRender(start, back, molDist, dir);\r\n #else\r\n gl_FragColor = VolRender(start, back, molDist, dir);\r\n #endif\r\n}\r\n"; - - var vertexFarPlane = "varying vec4 volPos;\r\nuniform float aspectRatio;\r\nuniform float farZ;\r\nuniform float tanHalfFOV;\r\nuniform mat4 matWorld2Volume;\r\n\r\nvoid main() {\r\n // rescale plane to fill in the whole far plane area seen from camera\r\n vec3 pos = position.xyz;\r\n pos.x = pos.x * tanHalfFOV * farZ * aspectRatio;\r\n pos.y = pos.y * tanHalfFOV * farZ;\r\n // common transformation\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\r\n // calc pos in volume CS\r\n volPos = matWorld2Volume * modelMatrix * vec4(pos, 1.0);\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n volPos = volPos + 0.5;\r\n volPos.w = 0.5;\r\n}\r\n"; - - var fragmentFarPlane = "varying vec4 volPos;\r\n\r\nvoid main() {\r\n gl_FragColor = volPos;\r\n}"; - - var volumeUniforms = THREE.UniformsUtils.merge([{ - volumeDim: { - type: 'v3', - value: new THREE.Vector3(512, 512, 512) - }, - tileTex: { - type: 't', - value: null - }, - tileTexSize: { - type: 'v2', - value: new THREE.Vector2(512, 512) - }, - tileStride: { - type: 'v2', - value: new THREE.Vector2(512, 512) - }, - boxAngles: { - type: 'v3', - value: new THREE.Vector3(1, 1, 1) - }, - delta: { - type: 'v3', - value: new THREE.Vector3(0, 0, 0) - }, - _isoLevel0: { - type: 'v2', - value: new THREE.Vector3(0.5, 0.75, 1.0) - }, - _flipV: { - type: 'f', - value: 0.0 - }, - _BFLeft: { - type: 't', - value: null - }, - _BFRight: { - type: 't', - value: null - }, - _FFLeft: { - type: 't', - value: null - }, - _FFRight: { - type: 't', - value: null - }, - _WFFLeft: { - type: 't', - value: null - }, - _WFFRight: { - type: 't', - value: null - } - }]); - - function overrideUniforms(params, defUniforms) { - var uniforms = THREE.UniformsUtils.clone(defUniforms); - - for (var p in params) { - if (uniforms.hasOwnProperty(p)) { - uniforms[p].value = params[p]; - } - } - - return uniforms; - } - - function facesPosMaterialParams(params, sideType) { - return { - uniforms: overrideUniforms(params, {}), - vertexShader: vertexVolumeFaces, - fragmentShader: fragmentVolumeFaces, - transparent: false, - depthTest: false, - depthWrite: false, - side: sideType - }; - } - - var BackFacePosMaterial = /*#__PURE__*/function (_THREE$ShaderMaterial) { - inherits(BackFacePosMaterial, _THREE$ShaderMaterial); - - function BackFacePosMaterial(params) { - classCallCheck(this, BackFacePosMaterial); - - var backFaceParams = facesPosMaterialParams(params, THREE.BackSide); - return possibleConstructorReturn(this, getPrototypeOf(BackFacePosMaterial).call(this, backFaceParams)); - } - - return BackFacePosMaterial; - }(THREE.ShaderMaterial); - - var ShaderParams = function ShaderParams(params, uniforms, vertexShader, fragmentShader) { - classCallCheck(this, ShaderParams); - - this.uniforms = overrideUniforms(params, uniforms); - this.vertexShader = vertexShader; - this.fragmentShader = fragmentShader; - this.transparent = false; - this.depthTest = false; - this.depthWrite = false; - this.side = THREE.FrontSide; - }; - - var BackFacePosMaterialFarPlane = /*#__PURE__*/function (_THREE$ShaderMaterial2) { - inherits(BackFacePosMaterialFarPlane, _THREE$ShaderMaterial2); - - function BackFacePosMaterialFarPlane(params) { - classCallCheck(this, BackFacePosMaterialFarPlane); - - var matUniforms = THREE.UniformsUtils.merge([{ - aspectRatio: { - type: 'f', - value: 0.0 - }, - farZ: { - type: 'f', - value: 0.0 - }, - tanHalfFOV: { - type: 'f', - value: 0.0 - }, - matWorld2Volume: { - type: '4fv', - value: new THREE.Matrix4() - } - }]); - var shaderParams = new ShaderParams(params, matUniforms, vertexFarPlane, fragmentFarPlane); - return possibleConstructorReturn(this, getPrototypeOf(BackFacePosMaterialFarPlane).call(this, shaderParams)); - } - - return BackFacePosMaterialFarPlane; - }(THREE.ShaderMaterial); - - var FrontFacePosMaterial = /*#__PURE__*/function (_THREE$ShaderMaterial3) { - inherits(FrontFacePosMaterial, _THREE$ShaderMaterial3); - - function FrontFacePosMaterial(params) { - classCallCheck(this, FrontFacePosMaterial); - - var frontFaceParams = facesPosMaterialParams(params, THREE.FrontSide); - return possibleConstructorReturn(this, getPrototypeOf(FrontFacePosMaterial).call(this, frontFaceParams)); - } - - return FrontFacePosMaterial; - }(THREE.ShaderMaterial); - - var VolumeMaterial = /*#__PURE__*/function (_THREE$ShaderMaterial4) { - inherits(VolumeMaterial, _THREE$ShaderMaterial4); - - function VolumeMaterial(params) { - var _this; - - classCallCheck(this, VolumeMaterial); - - var shaderParams = new ShaderParams(params, volumeUniforms, vertexVolume, fragmentVolume); - shaderParams.transparent = true; - shaderParams.depthTest = true; - _this = possibleConstructorReturn(this, getPrototypeOf(VolumeMaterial).call(this, shaderParams)); - - _this.updateDefines(); - - return _this; - } - - createClass(VolumeMaterial, [{ - key: "updateDefines", - value: function updateDefines() { - this.defines = { - ISO_MODE: settings.now.modes.VD.isoMode, - STEPS_COUNT: settings.now.modes.VD.polyComplexity[settings.now.resolution] * 100 - }; - this.needsUpdate = true; - } - }]); - - return VolumeMaterial; - }(THREE.ShaderMaterial); - - var VolumeMaterial$1 = { - BackFacePosMaterial: BackFacePosMaterial, - BackFacePosMaterialFarPlane: BackFacePosMaterialFarPlane, - FrontFacePosMaterial: FrontFacePosMaterial, - VolumeMaterial: VolumeMaterial - }; - - var VolumeMesh = /*#__PURE__*/function (_THREE$Mesh) { - inherits(VolumeMesh, _THREE$Mesh); - - // data for noise filter - function VolumeMesh() { - var _this; - - classCallCheck(this, VolumeMesh); - - var geo = new THREE.BufferGeometry(); - _this = possibleConstructorReturn(this, getPrototypeOf(VolumeMesh).call(this, geo)); - - defineProperty(assertThisInitialized(_this), "volumeInfo", {}); - - _this.clipPlane = new THREE.Plane(); - var size = new THREE.Vector3(0.5, 0.5, 0.5); - _this.size = size; - _this.cullFlag = [true, true, true, true, true, true, true, true, false, false, false, false, false, false]; - _this.faces = [{ - indices: [], - norm: new THREE.Vector3(0, 0, -1) - }, { - indices: [], - norm: new THREE.Vector3(0, 0, 1) - }, { - indices: [], - norm: new THREE.Vector3(0, -1, 0) - }, { - indices: [], - norm: new THREE.Vector3(0, 1, 0) - }, { - indices: [], - norm: new THREE.Vector3(-1, 0, 0) - }, { - indices: [], - norm: new THREE.Vector3(1, 0, 0) - }, { - indices: [], - norm: new THREE.Vector3(0, 0, 0) - }]; - _this.vertices = [new THREE.Vector3(-size.x, -size.y, -size.z), new THREE.Vector3(-size.x, size.y, -size.z), new THREE.Vector3(size.x, -size.y, -size.z), new THREE.Vector3(size.x, size.y, -size.z), new THREE.Vector3(-size.x, -size.y, size.z), new THREE.Vector3(-size.x, size.y, size.z), new THREE.Vector3(size.x, -size.y, size.z), new THREE.Vector3(size.x, size.y, size.z), new THREE.Vector3(0.0, 0.0, 0.0), // Placeholder for section - new THREE.Vector3(0.0, 0.0, 0.0), new THREE.Vector3(0.0, 0.0, 0.0), new THREE.Vector3(0.0, 0.0, 0.0), new THREE.Vector3(0.0, 0.0, 0.0), new THREE.Vector3(0.0, 0.0, 0.0)]; - geo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(_this.vertices.length * 3), 3)); - _this.name = 'VolumeMesh'; - return _this; - } - - createClass(VolumeMesh, [{ - key: "_updateVertices", - value: function _updateVertices() { - // Algorithm: - // 1. Get plane parameters - // 2. Compute culling flags for all vertices - // 3. If intersection occurs => compute from 3 to 6 intersection points - var corners = VolumeMesh._corners; - var edges = VolumeMesh._edges; - var edgeIntersections = VolumeMesh._edgeIntersections; - var i; - var norm = this.clipPlane.normal; - var D = this.clipPlane.constant; - var vert = this.vertices; - var size = this.size; - var cornerMark = [0, 0, 0, 0, 0, 0, 0, 0]; - var edgeMark = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; - var curEdge = new THREE.Vector3(); - var curEdgeInter = null; - - function CheckX() { - if (norm.x === 0) return 0; - var x = -(norm.dot(curEdge) + D) / norm.x; - - if (-size.x <= x && x <= size.x) { - curEdgeInter.set(x, curEdge.y, curEdge.z); - if (x === size.x) return 2; - if (x === -size.x) return -2; - return 1; - } - - return 0; - } - - function CheckY() { - if (norm.y === 0) return 0; - var y = -(norm.dot(curEdge) + D) / norm.y; - - if (-size.y <= y && y <= size.y) { - curEdgeInter.set(curEdge.x, y, curEdge.z); - if (y === size.y) return 2; - if (y === -size.y) return -2; - return 1; - } - - return 0; - } - - function CheckZ() { - if (norm.z === 0) return 0; - var z = -(norm.dot(curEdge) + D) / norm.z; - - if (-size.z <= z && z <= size.z) { - curEdgeInter.set(curEdge.x, curEdge.y, z); - if (z === size.z) return 2; - if (z === -size.z) return -2; - return 1; - } - - return 0; - } // for each edge - - - for (var curEdgeIdx = 0; curEdgeIdx < 12; ++curEdgeIdx) { - var curEdgeSource = edges[curEdgeIdx]; - curEdgeInter = edgeIntersections[curEdgeIdx]; - curEdge.set(curEdgeSource[2], curEdgeSource[3], curEdgeSource[4]); - curEdge.multiply(size); // calculate intersection point - - var flag = 0; - if (curEdgeSource[2] === 0) flag = CheckX(); - if (curEdgeSource[3] === 0) flag = CheckY(); - if (curEdgeSource[4] === 0) flag = CheckZ(); // mark corresponding corner (if plane cuts through one) - - if (flag === -2) { - cornerMark[curEdgeSource[0]] = 1; - } else if (flag === 2) { - cornerMark[curEdgeSource[1]] = 1; - } else if (flag === 0) { - // edge is not intersected by the plane (doesn't produce a vertex) - edgeMark[curEdgeIdx] = 0; - } - } - - var face = { - indices: [], - norm: norm.clone().negate() - }; - var nextVertex = 8; // for each marked corner - - for (i = 0; i < 8; ++i) { - if (cornerMark[i] === 1) { - // add corner as vertex to the face - vert[nextVertex].set(corners[i][0], corners[i][1], corners[i][2]).multiply(size); - face.indices.push(nextVertex++); // skip adjacent edges - - edgeMark[corners[i][3]] = 0; - edgeMark[corners[i][4]] = 0; - edgeMark[corners[i][5]] = 0; - } - } // for each edge that has internal intersection - - - for (i = 0; i < 12; ++i) { - if (edgeMark[i] === 1) { - // add intersection point as vertex to the face - vert[nextVertex].copy(edgeIntersections[i]); - face.indices.push(nextVertex++); - } - } - - this.faces[6] = face; - var diff = new THREE.Vector3(); - var coplanarPoint = new THREE.Vector3(); - this.clipPlane.coplanarPoint(coplanarPoint); - - for (i = 0; i < vert.length; ++i) { - this.cullFlag[i] = false; - - if (i < 8) { - // corners should be culled by clipping plane - diff.subVectors(vert[i], coplanarPoint); - this.cullFlag[i] = norm.dot(diff) >= 0.0; - } else if (i < 8 + face.indices.length) { - // cross section vertices don't get culled - this.cullFlag[i] = true; - } - } // write data to vertex buffer - - - var positions = this.geometry.getAttribute('position'); - var idx = 0; - - for (i = 0; i < vert.length; ++i) { - positions.array[idx++] = vert[i].x; - positions.array[idx++] = vert[i].y; - positions.array[idx++] = vert[i].z; - } - - positions.needsUpdate = true; - } - }, { - key: "_collectVertices", - value: function _collectVertices(face, filter) { - var i; - var vert = this.vertices; - face.indices = []; - - for (i = 0; i < vert.length; ++i) { - if (this.cullFlag[i] && filter(vert[i])) { - face.indices.push(i); - } - } - } - }, { - key: "_sortIndices", - value: function _sortIndices(face, right) { - var i; - var j; - var vert = this.vertices; - var angle = []; - var dir = new THREE.Vector3(); - - for (i = 1; i < face.indices.length; ++i) { - dir.subVectors(vert[face.indices[i]], vert[face.indices[0]]); - dir.normalize(); - dir.cross(right); - dir.negate(); - angle[i] = face.norm.dot(dir); - } // Exchange sort - - - for (i = 1; i < face.indices.length - 1; ++i) { - for (j = i + 1; j < face.indices.length; ++j) { - if (angle[j] < angle[i]) { - // swap - var t = angle[i]; - angle[i] = angle[j]; - angle[j] = t; - t = face.indices[i]; - face.indices[i] = face.indices[j]; - face.indices[j] = t; - } - } - } - } - }, { - key: "_updateIndices", - value: function _updateIndices() { - // Algorithm: - // 1. Get plane vertices (from 3 to 6 vertices) - // 2. Get "right" vector in plane - // 3. Sort vertices using Graham-like method - // 4. Create indices - var i; - var faceIdx; - var face; - var vert = this.vertices; - var size = this.size; - - this._collectVertices(this.faces[0], function (vertex) { - return vertex.z === -size.z; - }); - - this._collectVertices(this.faces[1], function (vertex) { - return vertex.z === size.z; - }); - - this._collectVertices(this.faces[2], function (vertex) { - return vertex.y === -size.y; - }); - - this._collectVertices(this.faces[3], function (vertex) { - return vertex.y === size.y; - }); - - this._collectVertices(this.faces[4], function (vertex) { - return vertex.x === -size.x; - }); - - this._collectVertices(this.faces[5], function (vertex) { - return vertex.x === size.x; - }); - - var vCenter = new THREE.Vector3(); - var vRight = new THREE.Vector3(); - var vDir = new THREE.Vector3(); - - for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { - face = this.faces[faceIdx]; - if (face.indices.length === 0) continue; - vCenter.set(0, 0, 0); - - for (i = 0; i < face.indices.length; ++i) { - vCenter.add(vert[face.indices[i]]); - } - - vCenter.multiplyScalar(1.0 / face.indices.length); - vRight.subVectors(vert[face.indices[0]], vCenter); - vRight.normalize(); - var rightProj = []; - - for (i = 0; i < face.indices.length; ++i) { - vDir.subVectors(vert[face.indices[i]], vCenter); - rightProj[i] = vDir.dot(vRight); - } - - for (i = 1; i < face.indices.length; ++i) { - if (rightProj[i] < rightProj[0]) { - // swap - var t = rightProj[0]; - rightProj[0] = rightProj[i]; - rightProj[i] = t; - - var _face$indices = slicedToArray(face.indices, 1); - - t = _face$indices[0]; - face.indices[0] = face.indices[i]; - face.indices[i] = t; - } - } - - this._sortIndices(face, vRight); - } - - var numIndices = 0; - - for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { - face = this.faces[faceIdx]; - - if (face.indices.length >= 3) { - numIndices += 3 * (face.indices.length - 2); - } - } - - var offset = 0; - var indices = new Uint16Array(numIndices); - - for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { - face = this.faces[faceIdx]; - - for (i = 0; i < face.indices.length - 2; ++i) { - indices[offset] = face.indices[0]; // eslint-disable-line prefer-destructuring - - indices[offset + 1] = face.indices[i + 1]; - indices[offset + 2] = face.indices[i + 2]; - offset += 3; - } - } - - this.geometry.setIndex(new THREE.BufferAttribute(indices, 1)); - } - }, { - key: "setDataSource", - value: function setDataSource(dataSource) { - var vm = new VolumeMaterial$1.VolumeMaterial(); - var dim = dataSource.getDimensions(); - var stride = dataSource.getTiledTextureStride(); - var texture = dataSource.buildTiledTexture(); - var bbox = dataSource.getBox(); - vm.uniforms.volumeDim.value.set(dim[0], dim[1], dim[2]); - vm.uniforms.tileTex.value = texture; - vm.uniforms.tileTexSize.value.set(texture.image.width, texture.image.height); - vm.uniforms.tileStride.value.set(stride[0], stride[1]); - Object.assign(this.volumeInfo, dataSource.getVolumeInfo()); - var volInfo = this.volumeInfo; - vm.uniforms.delta.value.copy(volInfo.delta); - vm.uniforms.boxAngles.value.set(volInfo.obtuseAngle[0], volInfo.obtuseAngle[1], volInfo.obtuseAngle[2]); - this.material = vm; - bbox.getSize(this.scale); - bbox.getCenter(this.position); - } - }, { - key: "_updateIsoLevel", - value: function _updateIsoLevel() { - var _settings$now$modes$V = settings.now.modes.VD, - kSigma = _settings$now$modes$V.kSigma, - kSigmaMed = _settings$now$modes$V.kSigmaMed, - kSigmaMax = _settings$now$modes$V.kSigmaMax; - var volInfo = this.volumeInfo; - var mean = volInfo.dmean - volInfo.dmin; - var span = volInfo.dmax - volInfo.dmin; - - var level = function level(k) { - return (mean + k * volInfo.sd) / span; - }; - - this.material.uniforms._isoLevel0.value.set(level(kSigma), level(kSigmaMed), level(kSigmaMax)); - } - }, { - key: "rebuild", - value: function rebuild(camera) { - var nearClipPlaneOffset = VolumeMesh._nearClipPlaneOffset; - var pos = VolumeMesh._pos; - var norm = VolumeMesh._norm; - var norm4D = VolumeMesh._norm4D; - var matrixWorldToLocal = VolumeMesh._matrixWorldToLocal; - var clipPlane = VolumeMesh._clipPlane; - - this._updateIsoLevel(); // get clip plane in local space - - - camera.getWorldDirection(norm); - camera.getWorldPosition(pos); - pos.addScaledVector(norm, camera.near + nearClipPlaneOffset); // transform pos to local CS - - matrixWorldToLocal.getInverse(this.matrixWorld); - pos.applyMatrix4(matrixWorldToLocal); // transform norm to local CS - - norm4D.set(norm.x, norm.y, norm.z, 0.0); // NOTE: use homogeneous norm for proper transformation - - norm4D.applyMatrix4(matrixWorldToLocal); - norm.copy(norm4D); - norm.normalize(); - clipPlane.setFromNormalAndCoplanarPoint(norm, pos); - - if (!this.clipPlane.equals(clipPlane)) { - this.clipPlane = clipPlane.clone(); - - this._updateVertices(); - - this._updateIndices(); - } - } - }]); - - return VolumeMesh; - }(THREE.Mesh); - - defineProperty(VolumeMesh, "_corners", [// x, y, z, edge1, edge2, edge3 - [-1, -1, -1, 0, 4, 8], [1, -1, -1, 0, 5, 9], [1, 1, -1, 1, 5, 10], [-1, 1, -1, 1, 4, 11], [-1, -1, 1, 2, 6, 8], [1, -1, 1, 2, 7, 9], [1, 1, 1, 3, 7, 10], [-1, 1, 1, 3, 6, 11]]); - - defineProperty(VolumeMesh, "_edges", [// corner1, corner2, center_x, center_y, center_z - [0, 1, 0, -1, -1], [2, 3, 0, 1, -1], [4, 5, 0, -1, 1], [6, 7, 0, 1, 1], [0, 3, -1, 0, -1], [1, 2, 1, 0, -1], [4, 7, -1, 0, 1], [5, 6, 1, 0, 1], [0, 4, -1, -1, 0], [1, 5, 1, -1, 0], [2, 6, -1, 1, 0], [3, 7, 1, 1, 0]]); - - defineProperty(VolumeMesh, "_edgeIntersections", function () { - var edgeIntersections = []; - - for (var j = 0; j < 12; ++j) { - edgeIntersections.push(new THREE.Vector3()); - } - - return edgeIntersections; - }()); - - defineProperty(VolumeMesh, "_nearClipPlaneOffset", 0.2); - - defineProperty(VolumeMesh, "_pos", new THREE.Vector3()); - - defineProperty(VolumeMesh, "_norm", new THREE.Vector3()); - - defineProperty(VolumeMesh, "_norm4D", new THREE.Vector4()); - - defineProperty(VolumeMesh, "_matrixWorldToLocal", new THREE.Matrix4()); - - defineProperty(VolumeMesh, "_clipPlane", new THREE.Plane()); - - var VolumeBounds = /*#__PURE__*/function () { - function VolumeBounds(bBox, volInfo) { - classCallCheck(this, VolumeBounds); - - var delta = volInfo.delta; // {x: XY, y : XZ, z: YZ} - - var obtuseAngle = volInfo.obtuseAngle; // 1 - obtuse, 0 - acute - - var bSize = new THREE.Vector3(); - bBox.getSize(bSize); - bSize.multiplyScalar(0.5); - - var offsetVert = this._getBaseVertices(delta, obtuseAngle); - - var geometry = new THREE.Geometry(); - - for (var i = 0; i < 4; i++) { - geometry.vertices.push(offsetVert[i].clone().multiply(bSize)); - geometry.vertices.push(offsetVert[(i + 1) % 4].clone().multiply(bSize)); - } - - var translation = new THREE.Vector3(2 * bSize.x * (1 - delta.x - delta.y), 0, 0); - - for (var _i = 0; _i < 8; _i++) { - geometry.vertices.push(geometry.vertices[_i].clone().add(translation)); - } - - for (var _i2 = 0; _i2 < 4; _i2++) { - geometry.vertices.push(geometry.vertices[_i2 * 2].clone()); - geometry.vertices.push(geometry.vertices[_i2 * 2 + 8].clone()); - } - - var center = new THREE.Vector3(); - bBox.getCenter(center); - geometry.vertices.forEach(function (vertex) { - return vertex.add(center); - }); // pivot shift - - this._lines = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ - color: 0xFFFFFF - })); - - this._lines.layers.set(gfxutils.LAYERS.VOLUME); - } // Set one edge (4 points) of frame, from which with parallel transfer the rest of the frame points can be obtained - - - createClass(VolumeBounds, [{ - key: "_getBaseVertices", - value: function _getBaseVertices(delta, obtuseAngle) { - var projTable = VolumeBounds._projectionTable; - - var proj = function proj(index, inv) { - // tricky function to take account of projections: their position(related to box) and sign - var currDelta = delta[projTable[index][0]]; - var angleValue = -0.5 * (inv - 1) + inv * obtuseAngle[projTable[index][1]]; // inv = 1: alpha; inv = -1: 1 - alpha - - return angleValue * currDelta; - }; - - var offsetVert = [new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', 1)), -1 + 2 * proj('YZ', 1), -1), new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', 1)), -1 + 2 * proj('YZ', -1), 1), new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', -1)), 1 - 2 * proj('YZ', 1), 1), new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', -1)), 1 - 2 * proj('YZ', -1), -1)]; - return offsetVert; - } - }, { - key: "getMesh", - value: function getMesh() { - return this._lines; - } - }]); - - return VolumeBounds; - }(); - - defineProperty(VolumeBounds, "_projectionTable", { - // corresponds between (origin axes and angles between them) and between saving vector coordinates - XY: ['x', 2], - XZ: ['y', 1], - YZ: ['z', 0] - }); - - // cube. In cut place of cube there is no correct data in BFTexture and volume rendering integral is calculated - // with errors. - // Far plane cuts the cube in case of large volume scale (zoom), because farplane doesn't change - - var VolumeFarPlane = /*#__PURE__*/function () { - // create plane with unit corners coords (for future rescale in vshader according to camera properties) - function VolumeFarPlane(volume, width, height) { - classCallCheck(this, VolumeFarPlane); - - var planeGeo = this._initPlaneGeo(width, height); - - var mat = new VolumeMaterial$1.BackFacePosMaterialFarPlane(); - this._plane = new meshes.Mesh(planeGeo, mat); - this._plane.frustumCulled = false; - this._plane.doubleSided = true; - var matWorldToVolume = new THREE.Matrix4(); - - this._plane._onBeforeRender = function (_renderer, _scene, camera, _geometry, _material, _group) { - var material = this.material; - - if (!volume || !material) { - return; - } // count point in world at farplane place - - - var planeCamPos = new THREE.Vector4(0, 0, -(camera.far - 0.1), 1); - planeCamPos.applyMatrix4(camera.matrixWorld); // recalc matrices to make plane be placed as farplane in the World relative to camera - - this.matrix.identity(); - this.matrix.makeTranslation(planeCamPos.x, planeCamPos.y, planeCamPos.z); - this.matrixWorld.copy(this.matrix); - this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld); - this.normalMatrix.getNormalMatrix(this.modelViewMatrix); // build worldToVolume matrix to transform plane into volumeCS (volumeCS coords are written to BackFaceTexture) - - var volumeMatrix = volume.matrixWorld; - matWorldToVolume.getInverse(volumeMatrix); // update material props - - material.uniforms.aspectRatio.value = camera.aspect; - material.uniforms.farZ.value = camera.far; - material.uniforms.tanHalfFOV.value = Math.tan(THREE.Math.DEG2RAD * 0.5 * camera.fov); - material.uniforms.matWorld2Volume.value = matWorldToVolume; - }; // set it to special layer to draw only into BFTexture - - - this._plane.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE); - } - - createClass(VolumeFarPlane, [{ - key: "_initPlaneGeo", - value: function _initPlaneGeo(width, height) { - var planeGeo = new THREE.Geometry(); - width = width || 1; - height = height || 1; - planeGeo.vertices.push(new THREE.Vector3(-0.5 * width, 0.5 * height, 0)); - planeGeo.vertices.push(new THREE.Vector3(0.5 * width, 0.5 * height, 0)); - planeGeo.vertices.push(new THREE.Vector3(-0.5 * width, -0.5 * height, 0)); - planeGeo.vertices.push(new THREE.Vector3(0.5 * width, -0.5 * height, 0)); - planeGeo.faces.push(new THREE.Face3(0, 2, 1)); - planeGeo.faces.push(new THREE.Face3(2, 3, 1)); - return planeGeo; - } - }, { - key: "getMesh", - value: function getMesh() { - return this._plane; - } - }]); - - return VolumeFarPlane; - }(); - - function VolumeVisual(name, dataSource) { - Visual.call(this, name, dataSource); - this._mesh = new VolumeMesh(); - - this._mesh.setDataSource(dataSource); - - this.add(this._mesh); - this._frame = new VolumeBounds(this.getBoundaries().boundingBox, this._mesh.volumeInfo); - this.add(this._frame.getMesh()); - this.showFrame(settings.now.modes.VD.frame); - this._farPlane = new VolumeFarPlane(this._mesh, 2, 2); - this.add(this._farPlane.getMesh()); - } - - utils.deriveClass(VolumeVisual, Visual); - - VolumeVisual.prototype.getBoundaries = function () { - var box = this._dataSource.getBox(); - - var sphere = new THREE.Sphere(); - box.getBoundingSphere(sphere); - return { - boundingBox: box, - boundingSphere: sphere - }; - }; - - VolumeVisual.prototype.getMesh = function () { - return this._mesh; - }; - - VolumeVisual.prototype.showFrame = function (needShow) { - this._frame.getMesh().material.visible = needShow; - }; - - /** - * A list of available loaders. - * @extends EntityList - */ - - var LoaderList = /*#__PURE__*/function (_EntityList) { - inherits(LoaderList, _EntityList); - - /** - * Create a list of loaders. - * The loaders are indexed by supported source types (`.types` property of a Loader - * subclass). - * The loaders can be retrieved later by matching against specs (see {@link LoaderList#find}). - * - * @param {!Array=} someLoaders A list of {@link Loader} subclasses to - * automatically register at creation time. - * @see LoaderList#register - */ - function LoaderList() { - var someLoaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - - classCallCheck(this, LoaderList); - - return possibleConstructorReturn(this, getPrototypeOf(LoaderList).call(this, someLoaders, ['types'])); - } - /** - * Find a suitable loader for a source type. - * - * @param {Object} specs Loader specifications. - * @param {string=} specs.type Supported source type. - * @param {*=} specs.source Source to load from. - */ - - - createClass(LoaderList, [{ - key: "find", - value: function find(specs) { - var list = []; - - if (specs.type) { - list = this._dict.types[specs.type.toLowerCase()] || []; - } else if (specs.source) { - return this._list.filter(function (SomeLoader) { - return SomeLoader.canProbablyLoad && SomeLoader.canProbablyLoad(specs.source); - }); - } - - return toConsumableArray(list); - } - }]); - - return LoaderList; - }(EntityList); - - var Loader = /*#__PURE__*/function (_EventDispatcher) { - inherits(Loader, _EventDispatcher); - - function Loader(source, options) { - var _this; - - classCallCheck(this, Loader); - - _this = possibleConstructorReturn(this, getPrototypeOf(Loader).call(this)); - _this._source = source; - _this._options = options || {}; - _this._abort = false; - _this._agent = null; - return _this; - } - - createClass(Loader, [{ - key: "load", - value: function load() { - return Promise.reject(new Error('Loading from this source is not implemented')); - } - }, { - key: "abort", - value: function abort() { - this._abort = true; - - if (this._agent) { - this._agent.abort(); - } - } - }], [{ - key: "extractName", - value: function extractName(_source) { - return undefined; - } - }]); - - return Loader; - }(EventDispatcher); - makeContextDependent(Loader.prototype); - - var FileLoader = /*#__PURE__*/function (_Loader) { - inherits(FileLoader, _Loader); - - function FileLoader(source, options) { - var _this; - - classCallCheck(this, FileLoader); - - _this = possibleConstructorReturn(this, getPrototypeOf(FileLoader).call(this, source, options)); - options = _this._options; - _this._binary = options.binary === true; - return _this; - } - - createClass(FileLoader, [{ - key: "load", - value: function load() { - var _this2 = this; - - return new Promise(function (resolve, reject) { - if (_this2._abort) { - throw new Error('Loading aborted'); - } - - var blob = _this2._source; - var reader = _this2._agent = new FileReader(); - reader.addEventListener('load', function () { - resolve(reader.result); - }); - reader.addEventListener('error', function () { - reject(reader.error); - }); - reader.addEventListener('abort', function () { - reject(new Error('Loading aborted')); - }); - reader.addEventListener('progress', function (event) { - _this2.dispatchEvent(event); - }); - - if (_this2._binary) { - reader.readAsArrayBuffer(blob); - } else { - reader.readAsText(blob); - } - }); - } - }], [{ - key: "canProbablyLoad", - value: function canProbablyLoad(source) { - return File && source instanceof File || Blob && source instanceof Blob; - } - }, { - key: "extractName", - value: function extractName(source) { - return source && source.name; - } - }]); - - return FileLoader; - }(Loader); - FileLoader.types = ['file', 'blob']; - - var urlStartRegexp = /^(https?|ftp):\/\//i; - - var XHRLoader = /*#__PURE__*/function (_Loader) { - inherits(XHRLoader, _Loader); - - function XHRLoader(source, options) { - var _this; - - classCallCheck(this, XHRLoader); - - _this = possibleConstructorReturn(this, getPrototypeOf(XHRLoader).call(this, source, options)); - options = _this._options; - _this._binary = options.binary === true; - return _this; - } - - createClass(XHRLoader, [{ - key: "load", - value: function load() { - var _this2 = this; - - return new Promise(function (resolve, reject) { - if (_this2._abort) { - throw new Error('Loading aborted'); - } - - var url = _this2._source; - var request = _this2._agent = new XMLHttpRequest(); - request.addEventListener('load', function () { - if (request.status === 200) { - resolve(request.response); - } else { - reject(new Error("HTTP ".concat(request.status, " while fetching ").concat(url))); - } - }); - request.addEventListener('error', function () { - reject(new Error('HTTP request failed')); - }); - request.addEventListener('abort', function () { - reject(new Error('Loading aborted')); - }); - request.addEventListener('progress', function (event) { - _this2.dispatchEvent(event); - }); - request.open('GET', url); - - if (_this2._binary) { - request.responseType = 'arraybuffer'; - } else { - request.responseType = 'text'; - } - - request.send(); - }); - } - }], [{ - key: "canProbablyLoad", - value: function canProbablyLoad(source) { - return _.isString(source) && urlStartRegexp.test(source); - } - }, { - key: "extractName", - value: function extractName(source) { - if (source) { - var last = (source.indexOf('?') + 1 || source.lastIndexOf('#') + 1 || source.length + 1) - 1; - return source.slice(source.lastIndexOf('/', last) + 1, last); - } - - return undefined; - } - }]); - - return XHRLoader; - }(Loader); - XHRLoader.types = ['url']; - - var ImmediateLoader = /*#__PURE__*/function (_Loader) { - inherits(ImmediateLoader, _Loader); - - function ImmediateLoader() { - classCallCheck(this, ImmediateLoader); - - return possibleConstructorReturn(this, getPrototypeOf(ImmediateLoader).apply(this, arguments)); - } - - createClass(ImmediateLoader, [{ - key: "load", - value: function load() { - var _this = this; - - return new Promise(function (resolve) { - if (_this._abort) { - throw new Error('Loading aborted'); - } - - resolve(_this._source); - }); - } - }], [{ - key: "canProbablyLoad", - value: function canProbablyLoad(_source) { - return false; - } - }]); - - return ImmediateLoader; - }(Loader); - ImmediateLoader.types = ['immediate']; - - var loaders = new LoaderList([// note: order might be important - FileLoader, XHRLoader, ImmediateLoader]); - - /** - * A list of available parsers. - * @extends EntityList - */ - - var ParserList = /*#__PURE__*/function (_EntityList) { - inherits(ParserList, _EntityList); - - /** - * Create a list of parsers. - * The parsers are indexed by supported data formats and file extensions (`.formats` and - * `.extensions` properties of a Parser subclass). - * The parsers can be retrieved later by matching against specs (see {@link ParsrerList#find}). - * - * @param {!Array=} someParsers A list of {@link Parser} subclasses to - * automatically register at creation time. - * @see ParserList#register - */ - function ParserList() { - var someParsers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - - classCallCheck(this, ParserList); - - return possibleConstructorReturn(this, getPrototypeOf(ParserList).call(this, someParsers, ['formats', 'extensions'])); - } - /** - * Find a suitable parser for data. - * - * @param {Object} specs Parser specifications. - * @param {string=} specs.format Supported data format. - * @param {string=} specs.ext Supported filename extension. - * @param {*=} specs.data Data to parse. - */ - - - createClass(ParserList, [{ - key: "find", - value: function find(specs) { - var list = []; - - if (specs.format) { - list = this._dict.formats[specs.format.toLowerCase()] || []; - } else if (specs.ext) { - list = this._dict.extensions[specs.ext.toLowerCase()] || []; - } // autodetect only if no format is forced - - - if (list.length === 0 && !specs.format && specs.data) { - return this._list.filter(function (SomeParser) { - return SomeParser.canProbablyParse && SomeParser.canProbablyParse(specs.data); - }); - } - - return toConsumableArray(list); - } - }]); - - return ParserList; - }(EntityList); - - var Parser = /*#__PURE__*/function () { - function Parser(data, options) { - classCallCheck(this, Parser); - - this._data = data; - this._options = options || {}; - this._abort = false; - } - - createClass(Parser, [{ - key: "parseSync", - value: function parseSync() { - throw new Error('Parsing this type of data is not implemented'); - } - }, { - key: "parse", - value: function parse() { - var _this = this; - - return new Promise(function (resolve, reject) { - setTimeout(function () { - try { - if (_this._abort) { - return reject(new Error('Parsing aborted')); - } - - return resolve(_this.parseSync()); - } catch (error) { - return reject(error); - } - }); - }); - } // only for volume Parsers - - }, { - key: "getModel", - value: function getModel() { - this.model._parseHeader(this._data); - - return this.model; - } - }, { - key: "abort", - value: function abort() { - this._abort = true; - } - }]); - - return Parser; - }(); - makeContextDependent(Parser.prototype); - - /** - * Parser helper for PDB tag "REMARK 290". - * - * @exports Remark290 - * @constructor - */ - - var Remark290 = /*#__PURE__*/function () { - function Remark290() { - classCallCheck(this, Remark290); - - /** @type {THREE.Matrix4[]} */ - this.matrices = []; - /** @type {?THREE.Matrix4} */ - - this._matrix = null; - /** @type {number} */ - - this._matrixIndex = -1; - } - /** - * Parse a single line of a stream. - * @param {PDBStream} stream - stream to parse - */ - - - createClass(Remark290, [{ - key: "parse", - value: function parse(stream) { - /** @type {?THREE.Matrix4} */ - var matrix = this._matrix; - - if (stream.readString(12, 18) === ' SMTRY') { - var matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2 - - var matrixData = stream.readString(20, 80).trim().split(/\s+/); - var matrixIndex = parseInt(matrixData[0], 10); - - if (this._matrix === null || matrixIndex !== this._matrixIndex) { - // TODO: assert(matrixIndex === this.matrices.length + 1); - this._matrixIndex = matrixIndex; - this._matrix = matrix = new THREE.Matrix4(); - this.matrices[this.matrices.length] = matrix; - } - - var _matrix = matrix, - elements = _matrix.elements; - elements[matrixRow] = parseFloat(matrixData[1]); - elements[matrixRow + 4] = parseFloat(matrixData[2]); - elements[matrixRow + 8] = parseFloat(matrixData[3]); - elements[matrixRow + 12] = parseFloat(matrixData[4]); - } - } - }]); - - return Remark290; - }(); - - Remark290.prototype.id = 290; - - var Assembly$1 = chem.Assembly; - /** - * Parser helper for PDB tag "REMARK 350". - * - * @exports Remark350 - * @constructor - */ - - var Remark350 = /*#__PURE__*/function () { - function Remark350(complex) { - classCallCheck(this, Remark350); - - /** @type {Complex} */ - this._complex = complex; - /** @type {Assembly[]} */ - - this.assemblies = []; - /** @type {?Assembly} */ - - this._assembly = null; - /** @type {?THREE.Matrix4} */ - - this._matrix = null; - /** @type {number} */ - - this._matrixIndex = -1; - } - /** - * Parse a single line of a stream. - * @param {PDBStream} stream - stream to parse - */ - - - createClass(Remark350, [{ - key: "parse", - value: function parse(stream) { - /** @type {?Assembly} */ - var assembly = this._assembly; - /** @type {?THREE.Matrix4} */ - - var matrix = this._matrix; - - if (assembly && stream.readString(12, 18) === ' BIOMT') { - var matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2 - - var matrixData = stream.readString(20, 80).trim().split(/\s+/); - var matrixIndex = parseInt(matrixData[0], 10); - - if (this._matrix === null || matrixIndex !== this._matrixIndex) { - // TODO: assert(matrixIndex === assembly.matrices.length + 1); - this._matrixIndex = matrixIndex; - this._matrix = matrix = new THREE.Matrix4(); - assembly.addMatrix(matrix); - } - - var _matrix = matrix, - elements = _matrix.elements; - elements[matrixRow] = parseFloat(matrixData[1]); - elements[matrixRow + 4] = parseFloat(matrixData[2]); - elements[matrixRow + 8] = parseFloat(matrixData[3]); - elements[matrixRow + 12] = parseFloat(matrixData[4]); - } else if (assembly && stream.readString(35, 41) === 'CHAINS:') { - var entries = stream.readString(42, 80).split(','); - - for (var i = 0, n = entries.length; i < n; ++i) { - var chain = entries[i].trim(); - - if (chain.length > 0) { - assembly.addChain(chain); - } - } - } else if (stream.readString(12, 23) === 'BIOMOLECULE:') { - // assert molIndex === this.assemblies.length + 1 - this._matrix = null; - this._matrixIndex = -1; - this._assembly = assembly = new Assembly$1(this._complex); - this.assemblies.push(assembly); - } - } - }]); - - return Remark350; - }(); - - Remark350.prototype.id = 350; - - /** Helper class for stream-like reading input files. */ - var PDBStream = /*#__PURE__*/function () { - /** - * Create a stream - * @param {String} data Input data - */ - function PDBStream(data) { - classCallCheck(this, PDBStream); - - /** @type String */ - this._data = data; // Input file - - /** @type Number */ - - this._start = 0; // Starting position of line - - /** @type Number */ - - this._nextCR = -1; // Position of next CR (0x0D) - - /** @type Number */ - - this._nextLF = -1; // Position of next LF (0x0A) - - /** @type Number */ - - this._next = -1; // End position of line - - /** @type Number */ - - this._end = data.length; // End of data - - this.next(); - } - /** - * Reading next line. - * @returns {String} Next line in data (ending with LF or CR) - */ - - - createClass(PDBStream, [{ - key: "readLine", - value: function readLine() { - return this._data.slice(this._start, this._next); - } - /** - * Reading character from position. - * @param {Number} pos - Position in current line. - * @returns {String} Character from position - */ - - }, { - key: "readChar", - value: function readChar(pos) { - pos = this._start + pos - 1; - return pos < this._next ? this._data[pos] : ' '; - } - /** - * Reading character code from position. - * @param {Number} pos - Position in current line. - * @returns {Number} Character code from position - */ - - }, { - key: "readCharCode", - value: function readCharCode(pos) { - pos = this._start + pos - 1; - return pos < this._next ? this._data.charCodeAt(pos) : 32; - } - /** - * Reading string from begin to end points. - * For a reason unknown, numbering assumed not to start from 0, but from 1. - * @param {Number} begin - Begin point in current line. - * @param {Number} end - End point in current line. - * @returns {String} String from begin to end - */ - - }, { - key: "readString", - value: function readString(begin, end) { - var from = this._start + begin - 1; - var to = this._start + end; - return this._data.slice(from, to < this._next ? to : this._next); - } - /** - * Reading integer from begin to end points. - * @param {Number} begin - Begin point in current line. - * @param {Number} end - End point in current line. - * @returns {Number} Integer from begin to end - */ - - }, { - key: "readInt", - value: function readInt(begin, end) { - return parseInt(this.readString(begin, end), 10); - } - /** - * Reading float from begin to end points. - * @param {Number} begin - Begin point in current line. - * @param {Number} end - End point in current line. - * @returns {Number} Float from begin to end - */ - - }, { - key: "readFloat", - value: function readFloat(begin, end) { - return parseFloat(this.readString(begin, end)); - } - /** - * Checking for end of data. - * @returns {boolean} True if data is ended, false otherwise - */ - - }, { - key: "end", - value: function end() { - return this._start >= this._end; - } - /** - * Procedure to re-arrange current pointers in data. - */ - - }, { - key: "next", - value: function next() { - var start = this._next + 1; - this._start = start < this._end ? start : this._end; // support CR, LF, CR+LF line endings - // do not support LF+CR, CR+CR+LF, and other strange combinations - - if (this._start > this._nextCR) { - this._nextCR = (this._data.indexOf('\r', this._start) + 1 || this._end + 1) - 1; - } - - if (this._start > this._nextLF) { - this._nextLF = (this._data.indexOf('\n', this._start) + 1 || this._end + 1) - 1; - } - - this._next = this._nextCR + 1 < this._nextLF ? this._nextCR : this._nextLF; - } - }]); - - return PDBStream; - }(); - - var Complex$1 = chem.Complex, - Element$2 = chem.Element, - Helix$1 = chem.Helix, - Sheet$1 = chem.Sheet, - Strand$1 = chem.Strand, - Bond$1 = chem.Bond, - Molecule$1 = chem.Molecule; - var TAG_LENGTH = 6; - - function nameToElement(name) { - // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM - // - // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1 - // - // Atom names start with element symbols right-justified in columns 13-14 - // as permitted by the length of the name. For example, the symbol FE for - // iron appears in columns 13-14, whereas the symbol C for carbon appears - // in column 14 (see Misaligned Atom Names). If an atom name has four - // characters, however, it must start in column 13 even if the element - // symbol is a single character (for example, see Hydrogen Atoms). - var veryLong = name.trim().length === 4; - return name.slice(0, veryLong ? 1 : 2).trim(); - } // the most frequently used beginnings; although HEADER is mandatory, it is often missing in handmade files - - - var pdbStartRegexp = /^(HEADER\s|COMPND\s|REMARK\s|ATOM {2}|HETATM|MODEL )/i; - var remarkParsers = { - // NOTE: please forget the idea to build the method name in runtime, it can be obfuscated. - 290: Remark290, - 350: Remark350 - }; - - var PDBParser = /*#__PURE__*/function (_Parser) { - inherits(PDBParser, _Parser); - - function PDBParser(data, options) { - var _this; - - classCallCheck(this, PDBParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(PDBParser).call(this, data, options)); - _this._complex = null; - _this._chain = null; - _this._residue = null; - _this._sheet = null; - _this._serialAtomMap = null; - _this._modelId = 1; - _this._compaundFound = false; - _this._biomoleculeFound = false; - _this._allowedChainsIDs = null; - _this._lastMolId = -1; - _this._remarks = {}; - _this._remark = null; - _this._molecules = []; - _this._molecule = null; - _this._compndCurrToken = ''; - _this._options.fileType = 'pdb'; - return _this; - } - - createClass(PDBParser, [{ - key: "_finalize", - value: function _finalize() { - this._fixBondsArray(); - - this._fixChains(); // keep crystallographic symmetry transformations - - - var remark290 = this._remarks[290]; - this._complex.symmetry = _.isUndefined(remark290) ? [] : remark290.matrices; // add loaded biological assemblies - - var remark350 = this._remarks[350]; - this._complex.units = this._complex.units.concat(_.isUndefined(remark350) ? [] : remark350.assemblies); // add loaded macromolecules - - this._finalizeMolecules(); // create secondary structure etc. - - - this._complex.finalize({ - needAutoBonding: true, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - } - }, { - key: "_finalizeMolecules", - value: function _finalizeMolecules() { - // get chains from complex - var chainDict = {}; - var i; - var chains = this._complex._chains; - - for (i = 0; i < chains.length; ++i) { - var chainObj = chains[i]; - var chainName = chainObj._name; - chainDict[chainName] = chainObj; - } // aggregate residues from chains - - - for (i = 0; i < this._molecules.length; i++) { - var m = this._molecules[i]; - var residues = []; - - for (var j = 0; j < m._chains.length; j++) { - var name = m._chains[j]; - var chain = chainDict[name]; - residues = residues.concat(chain._residues.slice()); - } - - var molecule = new Molecule$1(this._complex, m._name, i + 1); - molecule.residues = residues; - this._complex._molecules[i] = molecule; - } - } - }, { - key: "_fixChains", - value: function _fixChains() { - var idChainMap = {}; - var complex = this._complex; // prepare - - for (var i = 0; i < complex._chains.length; i++) { - var chain = complex._chains[i]; - idChainMap[chain._name.charCodeAt(0)] = chain; - } - } // FIXME: This function is redundant, CONECT records always follow ATOM and HETATM. Build the map online. - - }, { - key: "_fixBondsArray", - value: function _fixBondsArray() { - var serialAtomMap = this._serialAtomMap = {}; - var complex = this._complex; - var atoms = complex._atoms; - - for (var i = 0, ni = atoms.length; i < ni; ++i) { - var atom = atoms[i]; - serialAtomMap[atom.serial] = atom; - } - - var bonds = complex._bonds; - var logger = this.logger; - - for (var j = 0, nj = bonds.length; j < nj; ++j) { - var bond = bonds[j]; - - if (bond._right < bond._left) { - logger.debug('_fixBondsArray: Logic error.'); - } - - bond._left = serialAtomMap[bond._left] || null; - bond._right = serialAtomMap[bond._right] || null; - } - } - }, { - key: "_parseATOM", - value: function _parseATOM(stream) { - if (this._modelId !== 1) { - return; - } - /* eslint-disable no-magic-numbers */ - - - var het = stream.readCharCode(1) === 0x48; // field names according to wwPDB Format - // NOTE: Chimera allows (nonstandard) use of columns 6-11 for the integer atom serial number in ATOM records. - - var serial = het ? stream.readInt(7, 11) : stream.readInt(6, 11); - var name = stream.readString(13, 16); - var altLoc = stream.readChar(17); - var resName = stream.readString(18, 20).trim(); - var chainID = stream.readChar(22); - var resSeq = stream.readInt(23, 26); - var iCode = stream.readChar(27); - var x = stream.readFloat(31, 38); - var y = stream.readFloat(39, 46); - var z = stream.readFloat(47, 54); - var occupancy = stream.readFloat(55, 60); - var tempFactor = stream.readFloat(61, 66); - var element = stream.readString(77, 78).trim() || nameToElement(name); - var charge = stream.readInt(79, 80) || 0; - /* eslint-enable no-magic-numbers */ - // skip waters (there may be lots of them) - - if (this.settings.now.nowater) { - if (resName === 'HOH' || resName === 'WAT') { - return; - } - } // PDB uses positional system for atom names. It helps derive element type from the name - // but names may include extra spaces. From this point on we don't need those spaces anymore. - - - name = name.trim(); - var type = Element$2.getByName(element); - var role = Element$2.Role[name]; // FIXME: Maybe should use type as additional index (" CA " vs. "CA ") - // NOTE: Residues of a particular chain are not required to be listed next to each other. - // https://github.com/biasmv/pv/commit/7319b898b7473ba380c26699e3b028b2b1a7e1a1 - - var chain = this._chain; - - if (!chain || chain.getName() !== chainID) { - this._chain = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); - this._residue = null; - } - - var residue = this._residue; - - if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { - this._residue = residue = chain.addResidue(resName, resSeq, iCode); - } - - var xyz = new THREE.Vector3(x, y, z); - residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); - } - }, { - key: "_parseENDMDL", - value: function _parseENDMDL() { - this._modelId += 1; - } - }, { - key: "_parseCONECT", - value: function _parseCONECT(stream) { - /* eslint-disable no-magic-numbers */ - var serial0 = stream.readInt(7, 11); - var serial1 = stream.readInt(12, 16); - var serial2 = stream.readInt(17, 21); - var serial3 = stream.readInt(22, 26); - var serial4 = stream.readInt(27, 31); - /* eslint-enable no-magic-numbers */ - - var complex = this._complex; // Keep bonds ordered by atom serial - - if (serial1 && serial1 > serial0) { - complex.addBond(serial0, serial1, 0, Bond$1.BondType.UNKNOWN, true); - } - - if (serial2 && serial2 > serial0) { - complex.addBond(serial0, serial2, 0, Bond$1.BondType.UNKNOWN, true); - } - - if (serial3 && serial3 > serial0) { - complex.addBond(serial0, serial3, 0, Bond$1.BondType.UNKNOWN, true); - } - - if (serial4 && serial4 > serial0) { - complex.addBond(serial0, serial4, 0, Bond$1.BondType.UNKNOWN, true); - } - } - }, { - key: "_parseCOMPND", - value: function _parseCOMPND(stream) { - /* eslint-disable no-magic-numbers */ - var str = stream.readString(11, 80); - var tokenIdx = str.indexOf(':'); - this._compndCurrToken = tokenIdx > 0 ? str.substring(0, tokenIdx).trim() : this._compndCurrToken; - /* eslint-enable no-magic-numbers */ - // start reading new molecule - - if (this._compndCurrToken === 'MOL_ID') { - this._molecule = { - _index: '', - _chains: [] - }; - this._molecule._index = parseInt(str.substring(tokenIdx + 1, str.indexOf(';')), 10); - - this._molecules.push(this._molecule); // parse molecule name - - } else if (this._compndCurrToken === 'MOLECULE' && this._molecule != null) { - this._molecule._name = str.substring(tokenIdx + 1, str.indexOf(';')).trim(); // parse molecule chains - } else if (this._compndCurrToken === 'CHAIN' && this._molecule != null) { - var chainStr = str.substring(tokenIdx + 1, 80).trim(); - var lastChar = chainStr[chainStr.length - 1]; - - if (lastChar === ';' || lastChar === ',') { - chainStr = chainStr.slice(0, -1); - } - - chainStr = chainStr.replace(/\s+/g, ''); - var chains = chainStr.split(','); - this._molecule._chains = this._molecule._chains.concat(chains); - } - } - }, { - key: "_parseREMARK", - value: function _parseREMARK(stream) { - /* eslint-disable no-magic-numbers */ - var remarkNum = stream.readInt(8, 10); - /* eslint-enable no-magic-numbers */ - // create remark parser if needed - - var remark = this._remarks[remarkNum]; - - if (_.isUndefined(remark)) { - var RemarkParser = remarkParsers[remarkNum]; - - if (_.isFunction(RemarkParser)) { - this._remarks[remarkNum] = remark = new RemarkParser(this._complex); - } - } // delegate parsing - - - if (!_.isUndefined(remark)) { - remark.parse(stream); - } - } - }, { - key: "_parseHELIX", - value: function _parseHELIX(stream) { - var _this2 = this; - - /* eslint-disable no-magic-numbers */ - var fields = [20, 22, 32, 34]; - /* eslint-enable no-magic-numbers */ - - this._parseSTRUCTURE(stream, fields, function (obj) { - _this2._complex.addHelix(obj); - - _this2._complex.structures.push(obj); - }); - } - }, { - key: "_parseSHEET", - value: function _parseSHEET(stream) { - var _this3 = this; - - /* eslint-disable no-magic-numbers */ - var fields = [22, 23, 33, 34]; - /* eslint-enable no-magic-numbers */ - - this._parseSTRUCTURE(stream, fields, function (obj) { - _this3._complex.addSheet(obj); - }); - } - }, { - key: "_parseSTRUCTURE", - value: function _parseSTRUCTURE(stream, pars, adder) { - var startId = 0; - var startIndex = 1; - var endId = 2; - var endIndex = 3; // identify fields: debugging and stuff - - /* eslint-disable no-magic-numbers */ - - var codeOfS = 0x53; - var serialNumber = stream.readInt(8, 10); - var structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim() - - var comment = stream.readString(41, 70).trim(); - var helLength = stream.readInt(72, 76); - var helixClass = stream.readInt(39, 40); - var shWidth = stream.readInt(15, 16); - var shCur = stream.readInt(42, 45); - var shPrev = stream.readInt(57, 60); - /* eslint-enable no-magic-numbers */ - // file fields - - var startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0); - var endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0); - var startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3); - var iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4); - var startICode = 0; - - if (iCodeStr.length > 0) { - startICode = iCodeStr.charCodeAt(0); - } - - var endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3); - iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4); - var endICode = 0; - - if (iCodeStr.length > 0) { - endICode = iCodeStr.charCodeAt(0); - } - - var obj; - var cs = this._sheet; - - if (stream.readCharCode(1) === codeOfS) { - if (cs !== null && cs.getName() !== structureName) { - cs = null; - this._sheet = null; - } - - if (cs === null) { - this._sheet = obj = new Sheet$1(structureName, shWidth); - adder(obj); - } else { - obj = cs; - } - - var strand = new Strand$1(obj, this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode), this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode), helixClass, shCur, shPrev); - obj.addStrand(strand); - - this._complex.structures.push(strand); - } else { - obj = new Helix$1(helixClass, this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode), this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode), serialNumber, structureName, comment, helLength); - adder(obj); - } - } - }, { - key: "_parseHEADER", - value: function _parseHEADER(stream) { - var metadata = this._complex.metadata; - metadata.classification = stream.readString(11, 50).trim(); - metadata.date = stream.readString(51, 59).trim(); - var id = stream.readString(63, 66).trim(); - metadata.id = id; - - if (id) { - this._complex.name = id; - } - - metadata.format = 'pdb'; - } - }, { - key: "_parseTITLE", - value: function _parseTITLE(stream) { - var metadata = this._complex.metadata; - metadata.title = metadata.title || []; - var line = stream.readInt(9, 10) || 1; - metadata.title[line - 1] = stream.readString(11, 80).trim(); - } - }, { - key: "parseSync", - value: function parseSync() { - var stream = new PDBStream(this._data); - var result = this._complex = new Complex$1(); // parse PDB line by line - - while (!stream.end()) { - var tag = stream.readString(1, TAG_LENGTH); - var func = PDBParser.tagParsers[tag]; - - if (_.isFunction(func)) { - func.call(this, stream); - } - - stream.next(); - } // Resolve indices and serials to objects - - - this._finalize(); // cleanup - - - this._serialAtomMap = null; - this._sheet = null; - this._residue = null; - this._chain = null; - this._complex = null; - - if (result.getAtomCount() === 0) { - throw new Error('The data does not contain valid atoms'); - } - - return result; - } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && pdbStartRegexp.test(data); - } - }]); - - return PDBParser; - }(Parser); - - defineProperty(PDBParser, "tagParsers", { - HEADER: PDBParser.prototype._parseHEADER, - 'TITLE ': PDBParser.prototype._parseTITLE, - 'ATOM ': PDBParser.prototype._parseATOM, - HETATM: PDBParser.prototype._parseATOM, - ENDMDL: PDBParser.prototype._parseENDMDL, - CONECT: PDBParser.prototype._parseCONECT, - COMPND: PDBParser.prototype._parseCOMPND, - REMARK: PDBParser.prototype._parseREMARK, - // 'SOURCE': PDBParser.prototype._parseSOURCE, - 'HELIX ': PDBParser.prototype._parseHELIX, - 'SHEET ': PDBParser.prototype._parseSHEET, - // nonstandard extension to allow range 100,000 - 999,999 - 'ATOM 1': PDBParser.prototype._parseATOM, - 'ATOM 2': PDBParser.prototype._parseATOM, - 'ATOM 3': PDBParser.prototype._parseATOM, - 'ATOM 4': PDBParser.prototype._parseATOM, - 'ATOM 5': PDBParser.prototype._parseATOM, - 'ATOM 6': PDBParser.prototype._parseATOM, - 'ATOM 7': PDBParser.prototype._parseATOM, - 'ATOM 8': PDBParser.prototype._parseATOM, - 'ATOM 9': PDBParser.prototype._parseATOM - }); - - PDBParser.formats = ['pdb']; - PDBParser.extensions = ['.pdb', '.ent']; - - var Complex$2 = chem.Complex, - Element$3 = chem.Element, - SGroup$1 = chem.SGroup, - Bond$2 = chem.Bond; - var cOrderCharCodes = { - A: 0, - S: 1, - D: 2, - T: 3 - }; - var cmlStartRegexp = /\s*<\?xml\b[^?>]*\?>\s*<(?:cml|molecule)\b/i; - - var CMLParser = /*#__PURE__*/function (_Parser) { - inherits(CMLParser, _Parser); - - function CMLParser(data, options) { - var _this; - - classCallCheck(this, CMLParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(CMLParser).call(this, data, options)); - _this._complex = null; - _this._residue = null; - _this._serialAtomMap = null; - _this._modelId = 1; - _this._lastMolId = -1; - _this._readOnlyOneMolecule = false; - _this._options.fileType = 'cml'; - return _this; - } - - createClass(CMLParser, [{ - key: "_rebuidBondIndexes", - value: function _rebuidBondIndexes(atoms, bonds) { - var count = atoms.length; - - for (var i = 0; i < count; i++) { - var atomId = atoms[i].id; - var countBonds = bonds.length; - - for (var j = 0; j < countBonds; j++) { - var idxs = bonds[j].atomRefs2.split(' '); - - if (idxs[0] === atomId) { - bonds[j].start = i; - } - - if (idxs[1] === atomId) { - bonds[j].end = i; - } - } - } - } - }, { - key: "_createSGroup", - value: function _createSGroup(molecule, moleculeArr) { - var newGroup = new SGroup$1(molecule.id, molecule.fieldData, new THREE.Vector3(parseFloat(molecule.x), parseFloat(molecule.y), 0), molecule.atomRefs, molecule); - - if (molecule.placement === 'Relative') { - newGroup._center = new THREE.Vector3(0, 0, 0); - } - - if (molecule.fieldName === 'MDLBG_FRAGMENT_CHARGE') { - newGroup._charge = parseInt(molecule.fieldData, 10) || 0; - } - - if (molecule.fieldName === 'MDLBG_FRAGMENT_COEFFICIENT') { - newGroup._repeat = parseInt(molecule.fieldData, 10) || 1; - } - - moleculeArr.push(newGroup); - } - }, { - key: "_extractSGroup", - value: function _extractSGroup(molecule, moleculeArr) { - if (!Array.isArray(moleculeArr)) { - moleculeArr = []; - } - - if (molecule) { - if (Array.isArray(molecule)) { - var count = molecule.length; - - for (var i = 0; i < count; i++) { - if (molecule[i].molecule) { - moleculeArr = moleculeArr.concat(this._extractSGroup(molecule[i].molecule)); - } - - this._createSGroup(molecule[i], moleculeArr); - } - } else { - if (molecule.molecule) { - if (molecule.molecule) { - moleculeArr = moleculeArr.concat(this._extractSGroup(molecule.molecule)); - } - } - - this._createSGroup(molecule, moleculeArr); - } - } - - return moleculeArr; - } - }, { - key: "_extractSGroups", - value: function _extractSGroups(molecule, atoms) { - var moleculeArr = this._extractSGroup(molecule); - - var count = atoms.length; - var i; - var j; - - for (i = 0; i < count; i++) { - var atomId = atoms[i].id; - - for (j = 0; j < moleculeArr.length; j++) { - var firstAtomRef = moleculeArr[j]._atoms.split(' ')[0]; - - if (firstAtomRef === atomId) { - if (!atoms[i].sgroupRef) { - atoms[i].sgroupRef = []; - } - - atoms[i].sgroupRef.push(moleculeArr[j]); - } - } - } // build sGroups centers - - - var atomMap = {}; // sgrpmap cache - - var mapEntry = null; - var nLimon = 100000000; - var bLow = new THREE.Vector3(nLimon, nLimon, nLimon); - var bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon); - - function cycleFuncInner(e) { - mapEntry = atomMap[e]; - - if (mapEntry) { - moleculeArr[j]._atoms.push(mapEntry.a); - } - } - - function cycleFunc(e) { - mapEntry = atomMap[e]; - - if (mapEntry) { - bLow.set(Math.min(bLow.x, mapEntry.x), Math.min(bLow.y, mapEntry.y), Math.min(bLow.z, mapEntry.z)); - bHight.set(Math.max(bHight.x, mapEntry.x), Math.max(bHight.y, mapEntry.y), Math.max(bHight.z, mapEntry.z)); - cycleFuncInner(e); - } - } - - for (i = 0; i < atoms.length; i++) { - atomMap[atoms[i].id] = {}; - atomMap[atoms[i].id].x = atoms[i].x2; - - if (atoms[i].x3) { - atomMap[atoms[i].id].x = atoms[i].x3; - } - - atomMap[atoms[i].id].x = parseFloat(atomMap[atoms[i].id].x); - atomMap[atoms[i].id].y = atoms[i].y2; - - if (atoms[i].y3) { - atomMap[atoms[i].id].y = atoms[i].y3; - } - - atomMap[atoms[i].id].y = parseFloat(atomMap[atoms[i].id].y); - atomMap[atoms[i].id].z = '0.0'; - - if (atoms[i].z3) { - atomMap[atoms[i].id].z = atoms[i].z3; - } - - atomMap[atoms[i].id].z = parseFloat(atomMap[atoms[i].id].z); - atomMap[atoms[i].id].a = atoms[i]; - } - - var atomsRef; - - for (j = 0; j < moleculeArr.length; j++) { - if (moleculeArr[j]._center !== null) { - bLow.set(nLimon, nLimon, nLimon); - bHight.set(-nLimon, -nLimon, -nLimon); - atomsRef = moleculeArr[j]._atoms.split(' '); - moleculeArr[j]._atoms = []; - atomsRef.forEach(cycleFunc); - - moleculeArr[j]._center.addVectors(bLow, bHight); - - moleculeArr[j]._center.multiplyScalar(0.5); - } else { - atomsRef = moleculeArr[j]._atoms.split(' '); - moleculeArr[j]._atoms = []; - atomsRef.forEach(cycleFuncInner); - } - } - - atomMap = null; - } - }, { - key: "_traverseData", - value: function _traverseData(dom) { - function isArray(o) { - return Object.prototype.toString.apply(o) === '[object Array]'; - } - - function parseNode(xmlNode, result) { - if (xmlNode.nodeName === '#text' && xmlNode.nodeValue.trim() === '') { - return; - } - - var jsonNode = {}; - jsonNode.xmlNode = xmlNode; - var existing = result[xmlNode.nodeName]; - - if (existing) { - if (!isArray(existing)) { - result[xmlNode.nodeName] = [existing, jsonNode]; - } else { - result[xmlNode.nodeName].push(jsonNode); - } - } else { - result[xmlNode.nodeName] = jsonNode; - } - - var length; - var i; - - if (xmlNode.attributes) { - length = xmlNode.attributes.length; - - for (i = 0; i < length; i++) { - var attribute = xmlNode.attributes[i]; - jsonNode[attribute.nodeName] = attribute.nodeValue; - } - } - - length = xmlNode.childNodes.length; - - for (i = 0; i < length; i++) { - parseNode(xmlNode.childNodes[i], jsonNode); - } - } - - var result = {}; - - if (dom.childNodes.length) { - parseNode(dom.childNodes[0], result); - } - - return result; - } - }, { - key: "_findSuitableMolecule", - value: function _findSuitableMolecule(data, molSet) { - for (var key in data) { - if (key === 'xmlNode') { - continue; - } else if (key === 'molecule') { - if (data.molecule) { - if (data.molecule.atomArray && data.molecule.atomArray.atom) { - molSet.push(data); - } - - if (Array.isArray(data.molecule)) { - for (var i = 0; i < data.molecule.length; i++) { - if (data.molecule[i].atomArray && data.molecule[i].atomArray.atom) { - molSet.push({ - molecule: data.molecule[i] - }); - } - } - } - } - } else if (data[key] && data[key] !== null && _typeof_1(data[key]) === 'object') { - this._findSuitableMolecule(data[key], molSet); - } - } - } - }, { - key: "_selectComponents", - value: function _selectComponents(text) { - var parser = new DOMParser(); - var doc = parser.parseFromString(text, 'application/xml'); - - var traversedData = this._traverseData(doc); - - var rawData; - var self = this; - - function prepareComponentCompound(data) { - var atoms = []; - - if (data.molecule && data.molecule.atomArray && data.molecule.atomArray.atom) { - if (!Array.isArray(data.molecule.atomArray.atom)) { - atoms.push(data.molecule.atomArray.atom); - } else { - atoms = data.molecule.atomArray.atom; - } - } else if (!data.molecule) { - var ret = {}; - ret.atomLabels = null; - ret.labelsCount = 1; - return ret; - } - - if (data.molecule.molecule) { - self._extractSGroups(data.molecule.molecule, atoms); - } - - var atom; - var count = atoms.length; - - for (var i = 0; i < count; i++) { - atom = atoms[i]; - atom.edges = []; - } - - var localBond = []; - - if (data.molecule.bondArray && data.molecule.bondArray.bond) { - if (!Array.isArray(data.molecule.bondArray.bond)) { - localBond.push(data.molecule.bondArray.bond); - } else { - localBond = data.molecule.bondArray.bond; - } - } - - var bond; - count = localBond.length; - - self._rebuidBondIndexes(atoms, localBond); - - function addCurrBond(index) { - bond = localBond[index]; - atom = atoms[bond.start]; - - if (!atom) { - return false; - } - - atom.edges.push(bond.end); - atom = atoms[bond.end]; - - if (!atom) { - return false; - } - - atom.edges.push(bond.start); - return true; - } - - for (var _i = 0; _i < count; _i++) { - if (!addCurrBond(_i)) { - // ignore invalid bond - continue; - } - - var orderAttr = bond.xmlNode.getAttribute('order'); - var tc = parseInt(orderAttr, 10); // the default bond order is unknown - - localBond[_i].order = 0; - localBond[_i].type = Bond$2.BondType.UNKNOWN; - - if (tc > 1) { - localBond[_i].order = tc; - } else { - // another option - bond order is a string - var order = cOrderCharCodes[orderAttr]; - - if (order !== undefined) { - localBond[_i].order = order; - - if (orderAttr === 'A') { - localBond[_i].type = Bond$2.BondType.AROMATIC; - } - } - } - } - - count = atoms.length; - - for (var _i2 = 0; _i2 < count; _i2++) { - atom = atoms[_i2]; - atom.edges.sort(); - } - - var labels = self._breadWidthSearch(atoms, 0); // for now - - - var retStruct = {}; - retStruct.atoms = atoms; - retStruct.bonds = localBond; - retStruct.labels = labels.atomLabels; - retStruct.count = Math.min(1, labels.labelsCount); // for now - - retStruct.curr = -1; - retStruct.originalCML = doc; - return retStruct; - } - - if (traversedData.cml) { - rawData = traversedData.cml; - } else { - rawData = traversedData; - } - - var retData = []; - var filteredData = []; - - this._findSuitableMolecule(rawData, filteredData); - - if (this._readOnlyOneMolecule && filteredData.length > 1) { - filteredData.splice(1, filteredData.length - 1); - } - - filteredData.forEach(function (d) { - var rd = prepareComponentCompound(d); - - if (rd.atoms.length > 0) { - retData.push(rd); - } - }); - return retData; - } - }, { - key: "_packLabel", - value: function _packLabel(compId, molId) { - var shift = 16; - return (molId << shift) + compId; - } - }, { - key: "_unpackLabel", - value: function _unpackLabel(l) { - var shift = 16; - var mask = (1 << shift) - 1; - return { - molId: l >>> shift, - compId: l & mask - }; - } - }, { - key: "_breadWidthSearch", - value: function _breadWidthSearch(atoms, molID) { - var atomLabels = new Array(atoms.length); - var id; - - for (id = 0; id < atomLabels.length; id++) { - atomLabels[id] = this._packLabel(0, molID); - } - - var breadthQueue = []; - var componentID = 0; - var labeledAtoms = atoms.length; - - while (labeledAtoms > 0) { - componentID++; - var startID = -1; - - for (id = 0; id < atomLabels.length; id++) { - if (this._unpackLabel(atomLabels[id]).compId === 0) { - startID = id; - break; - } - } - - if (startID < 0) { - break; - } // Bread first search - - - breadthQueue.push(atoms[startID]); - atomLabels[startID] = this._packLabel(componentID, molID); - labeledAtoms--; - - while (breadthQueue.length > 0) { - var curr = breadthQueue.shift(); - - if (!curr) { - continue; - } - - for (var i = 0; i < curr.edges.length; i++) { - if (atomLabels[curr.edges[i]] !== componentID) { - breadthQueue.push(atoms[curr.edges[i]]); - atomLabels[curr.edges[i]] = componentID; - labeledAtoms--; - } - } - } - } - - var ret = {}; - ret.atomLabels = atomLabels; - ret.labelsCount = componentID; - return ret; - } - }, { - key: "_parseBond", - value: function _parseBond(eAtom, mainAtom, order, type) { - if (eAtom >= 0) { - var h = [Math.min(eAtom, mainAtom), Math.max(eAtom, mainAtom)]; - - this._complex.addBond(h[0], h[1], order, type, true); - } - } - }, { - key: "_fixBondsArray", - value: function _fixBondsArray() { - var serialAtomMap = this._serialAtomMap = {}; - var complex = this._complex; - var atoms = complex._atoms; - - for (var i = 0, ni = atoms.length; i < ni; ++i) { - var atom = atoms[i]; - serialAtomMap[atom.serial] = atom; - } - - var bonds = complex._bonds; - var logger = this.logger; - - for (var j = 0, nj = bonds.length; j < nj; ++j) { - var bond = bonds[j]; - - if (bond._right < bond._left) { - logger.debug('_fixBondsArray: Logic error.'); - } - - bond._left = serialAtomMap[bond._left] || null; - bond._right = serialAtomMap[bond._right] || null; - } - } - }, { - key: "_parseSet", - value: function _parseSet(varData) { - var complex = this._complex = new Complex$2(); - var data = varData; - var currentLabel = data.curr; - var atoms = data.atoms, - labels = data.labels; - var atom = null; - var i; - var j; - var count = atoms.length; - - function addFunc(a) { - a.xmlNodeRef = atom; - - if (atom.x2) { - atom.x3 = atom.x2; - delete atom.x2; - } - - if (atom.y2) { - atom.y3 = atom.y2; - delete atom.y2; - } - - if (!atom.z3) { - atom.z3 = '0.0'; - } - - atom.complexAtom = a; - } - - var chains = {}; // parse atoms in label order - - var reorder = []; - - for (i = 0; i < count; i++) { - reorder.push(i); - } - - reorder.sort(function (a, b) { - return labels[a] - labels[b]; - }); - - for (i = 0; i < count; i++) { - var atomCharge = 0; - var lLabel = labels[reorder[i]]; - - if (this._unpackLabel(lLabel).molId === this._unpackLabel(currentLabel).molId) { - atom = atoms[reorder[i]]; - var atomFullNameStruct = atom.elementType; - - if (atom.sgroupRef) { - var countRef = atom.sgroupRef.length; - - for (var k = 0; k < countRef; ++k) { - complex._sgroups.push(atom.sgroupRef[k]); - } - } - - if (atom.x3 || atom.x2) { - var currAtomComp = this._unpackLabel(lLabel).compId; // use ' ' by default instead of synthetic creation of chain names - - - var chainID = ' '; //= String.fromCharCode('A'.charCodeAt(0) + currAtomComp); - - var resSeq = currAtomComp; - var iCode = ' '; - var strLabel = currAtomComp.toString(); - - if (strLabel.length === 1) { - strLabel = "0".concat(strLabel); - } - - var resName = "N".concat(strLabel); - var chain = chains[chainID]; - - if (!chain || chain.getName() !== chainID) { - chains[chainID] = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); - this._residue = null; - } - - var residue = this._residue; - - if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { - this._residue = residue = chain.addResidue(resName, resSeq, iCode); - } // _x, _y, _z, mname, mindex, atomNameFull, atomName, chainID, serial, isHet, atlLocInd, atomNameToTypeF - - - var xyz = null; - - if (atom.x3) { - xyz = new THREE.Vector3(parseFloat(atom.x3), parseFloat(atom.y3), parseFloat(atom.z3)); - } else if (atom.x2) { - xyz = new THREE.Vector3(parseFloat(atom.x2), parseFloat(atom.y2), 0); - } - - var element = Element$3.ByName[atom.elementType.toUpperCase()]; - - if (!element) { - element = JSON.parse(JSON.stringify(Element$3.ByName[Object.keys(Element$3.ByName)[Object.keys(Element$3.ByName).length - 1]])); - element.number += 1; - element.name = atom.elementType.toUpperCase(); - element.fullName = 'Unknown'; - Element$3.ByName[atom.elementType.toUpperCase()] = element; - } - - var atomSerial = parseInt(atom.id.replace(/[^0-9]/, ''), 10); - var added = residue.addAtom(atomFullNameStruct, element, xyz, Element$3.Role.SG, true, atomSerial, ' ', 1.0, 0.0, atomCharge); - - if (atom.hydrogenCount) { - added.hydrogenCount = parseInt(atom.hydrogenCount, 10); - } - - if (atom.mrvValence) { - added.valence = parseInt(atom.mrvValence, 10); - } - - addFunc(added); - } - } - } - - chains = null; // NOSONAR - - for (i = 0; i < data.bonds.length; i++) { - var cb = data.bonds[i]; - - if (this._unpackLabel(labels[cb.start]).molId === this._unpackLabel(currentLabel).molId && this._unpackLabel(labels[cb.end]).molId === this._unpackLabel(currentLabel).molId) { - atom = atoms[cb.start]; - - if (!atom || !atoms[cb.end]) { - continue; // skip invalid - } - - this._parseBond(parseInt(atom.id.replace(/[^0-9]/, ''), 10), parseInt(atoms[cb.end].id.replace(/[^0-9]/, ''), 10), cb.order, cb.type); - } - } - - for (i = 0; i < this._complex.getSGroupCount(); i++) { - var sGrp = this._complex.getSGroups()[i]; - - for (j = 0; j < sGrp._atoms.length; j++) { - sGrp._atoms[j] = sGrp._atoms[j].complexAtom; - } - } - - for (i = 0; i < count; i++) { - if (this._unpackLabel(labels[i]).molId === this._unpackLabel(currentLabel).molId) { - atom = atoms[i]; - atom.complexAtom = null; - delete atom.complexAtom; - } - } - - this._complex.originalCML = data.originalCML; - - this._fixBondsArray(); - - complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - this._serialAtomMap = null; - this._complex = null; - return complex; - } - }, { - key: "parseSync", - value: function parseSync() { - var complexes = []; - var self = this; - - var moleculaSet = this._selectComponents(this._data); - - moleculaSet.forEach(function (molSet) { - molSet.curr = 2; - - if (molSet.count === 0) { - molSet.count = 1; - } - - for (var i = 0; i < molSet.count; i++) { - molSet.curr = i + 1; - complexes.push(self._parseSet(molSet, false)); - } - }); - var totalAtomsParsed = 0; - complexes.forEach(function (c) { - totalAtomsParsed += c.getAtomCount(); - }); - - if (totalAtomsParsed <= 0) { - throw new Error('The data does not contain valid atoms'); - } - - if (complexes.length > 1) { - var joinedComplex = new Complex$2(); - joinedComplex.joinComplexes(complexes); - joinedComplex.originalCML = complexes[0].originalCML; - return joinedComplex; - } - - if (complexes.length === 1) { - return complexes[0]; - } - - return new Complex$2(); - } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && cmlStartRegexp.test(data); - } - }]); - - return CMLParser; - }(Parser); - - CMLParser.formats = ['cml']; - CMLParser.extensions = ['.cml']; - - var mmtf = createCommonjsModule(function (module, exports) { - !function(r,t){t(exports);}(commonjsGlobal,function(r){function t(r,t,n){for(var e=(r.byteLength,0),i=n.length;i>e;e++){var o=n.charCodeAt(e);if(128>o)r.setUint8(t++,o>>>0&127|0);else if(2048>o)r.setUint8(t++,o>>>6&31|192),r.setUint8(t++,o>>>0&63|128);else if(65536>o)r.setUint8(t++,o>>>12&15|224),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128);else {if(!(1114112>o))throw new Error("bad codepoint "+o);r.setUint8(t++,o>>>18&7|240),r.setUint8(t++,o>>>12&63|128),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128);}}}function n(r){for(var t=0,n=0,e=r.length;e>n;n++){var i=r.charCodeAt(n);if(128>i)t+=1;else if(2048>i)t+=2;else if(65536>i)t+=3;else {if(!(1114112>i))throw new Error("bad codepoint "+i);t+=4;}}return t}function e(r,i,o){var a=typeof r;if("string"===a){var u=n(r);if(32>u)return i.setUint8(o,160|u),t(i,o+1,r),1+u;if(256>u)return i.setUint8(o,217),i.setUint8(o+1,u),t(i,o+2,r),2+u;if(65536>u)return i.setUint8(o,218),i.setUint16(o+1,u),t(i,o+3,r),3+u;if(4294967296>u)return i.setUint8(o,219),i.setUint32(o+1,u),t(i,o+5,r),5+u}if(r instanceof Uint8Array){var u=r.byteLength,s=new Uint8Array(i.buffer);if(256>u)return i.setUint8(o,196),i.setUint8(o+1,u),s.set(r,o+2),2+u;if(65536>u)return i.setUint8(o,197),i.setUint16(o+1,u),s.set(r,o+3),3+u;if(4294967296>u)return i.setUint8(o,198),i.setUint32(o+1,u),s.set(r,o+5),5+u}if("number"===a){if(!isFinite(r))throw new Error("Number not finite: "+r);if(Math.floor(r)!==r)return i.setUint8(o,203),i.setFloat64(o+1,r),9;if(r>=0){if(128>r)return i.setUint8(o,r),1;if(256>r)return i.setUint8(o,204),i.setUint8(o+1,r),2;if(65536>r)return i.setUint8(o,205),i.setUint16(o+1,r),3;if(4294967296>r)return i.setUint8(o,206),i.setUint32(o+1,r),5;throw new Error("Number too big 0x"+r.toString(16))}if(r>=-32)return i.setInt8(o,r),1;if(r>=-128)return i.setUint8(o,208),i.setInt8(o+1,r),2;if(r>=-32768)return i.setUint8(o,209),i.setInt16(o+1,r),3;if(r>=-2147483648)return i.setUint8(o,210),i.setInt32(o+1,r),5;throw new Error("Number too small -0x"+(-r).toString(16).substr(1))}if(null===r)return i.setUint8(o,192),1;if("boolean"===a)return i.setUint8(o,r?195:194),1;if("object"===a){var u,f=0,c=Array.isArray(r);if(c)u=r.length;else {var d=Object.keys(r);u=d.length;}var f;if(16>u?(i.setUint8(o,u|(c?144:128)),f=1):65536>u?(i.setUint8(o,c?220:222),i.setUint16(o+1,u),f=3):4294967296>u&&(i.setUint8(o,c?221:223),i.setUint32(o+1,u),f=5),c)for(var l=0;u>l;l++)f+=e(r[l],i,o+f);else for(var l=0;u>l;l++){var v=d[l];f+=e(v,i,o+f),f+=e(r[v],i,o+f);}return f}throw new Error("Unknown type "+a)}function i(r){var t=typeof r;if("string"===t){var e=n(r);if(32>e)return 1+e;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(r instanceof Uint8Array){var e=r.byteLength;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if("number"===t){if(Math.floor(r)!==r)return 9;if(r>=0){if(128>r)return 1;if(256>r)return 2;if(65536>r)return 3;if(4294967296>r)return 5;throw new Error("Number too big 0x"+r.toString(16))}if(r>=-32)return 1;if(r>=-128)return 2;if(r>=-32768)return 3;if(r>=-2147483648)return 5;throw new Error("Number too small -0x"+r.toString(16).substr(1))}if("boolean"===t||null===r)return 1;if("object"===t){var e,o=0;if(Array.isArray(r)){e=r.length;for(var a=0;e>a;a++)o+=i(r[a]);}else {var u=Object.keys(r);e=u.length;for(var a=0;e>a;a++){var s=u[a];o+=i(s)+i(r[s]);}}if(16>e)return 1+o;if(65536>e)return 3+o;if(4294967296>e)return 5+o;throw new Error("Array or object too long 0x"+e.toString(16))}throw new Error("Unknown type "+t)}function o(r){var t=new ArrayBuffer(i(r)),n=new DataView(t);return e(r,n,0),new Uint8Array(t)}function a(r,t,n){return t?new r(t.buffer,t.byteOffset,t.byteLength/(n||1)):void 0}function u(r){return a(DataView,r)}function s(r){return a(Uint8Array,r)}function f(r){return a(Int8Array,r)}function c(r){return a(Int32Array,r,4)}function d(r){return a(Float32Array,r,4)}function l(r,t){var n=r.length/2;t||(t=new Int16Array(n));for(var e=0,i=0;n>e;++e,i+=2)t[e]=r[i]<<8^r[i+1]<<0;return t}function v(r,t){var n=r.length;t||(t=new Uint8Array(2*n));for(var e=u(t),i=0;n>i;++i)e.setInt16(2*i,r[i]);return s(t)}function g(r,t){var n=r.length/4;t||(t=new Int32Array(n));for(var e=0,i=0;n>e;++e,i+=4)t[e]=r[i]<<24^r[i+1]<<16^r[i+2]<<8^r[i+3]<<0;return t}function L(r,t){var n=r.length;t||(t=new Uint8Array(4*n));for(var e=u(t),i=0;n>i;++i)e.setInt32(4*i,r[i]);return s(t)}function h(r,t){var n=r.length;t||(t=new Float32Array(n/4));for(var e=u(t),i=u(r),o=0,a=0,s=n/4;s>o;++o,a+=4)e.setFloat32(a,i.getFloat32(a),!0);return t}function y(r,t,n){var e=r.length,i=1/t;n||(n=new Float32Array(e));for(var o=0;e>o;++o)n[o]=r[o]*i;return n}function m(r,t,n){var e=r.length;n||(n=new Int32Array(e));for(var i=0;e>i;++i)n[i]=Math.round(r[i]*t);return n}function p(r,t){var n,e;if(!t){var i=0;for(n=0,e=r.length;e>n;n+=2)i+=r[n+1];t=new r.constructor(i);}var o=0;for(n=0,e=r.length;e>n;n+=2)for(var a=r[n],u=r[n+1],s=0;u>s;++s)t[o]=a,++o;return t}function U(r){if(0===r.length)return new Int32Array;var t,n,e=2;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]&&(e+=2);var i=new Int32Array(e),o=0,a=1;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]?(i[o]=r[t-1],i[o+1]=a,a=1,o+=2):++a;return i[o]=r[r.length-1],i[o+1]=a,i}function b(r,t){var n=r.length;t||(t=new r.constructor(n)),n&&(t[0]=r[0]);for(var e=1;n>e;++e)t[e]=r[e]+t[e-1];return t}function I(r,t){var n=r.length;t||(t=new r.constructor(n)),t[0]=r[0];for(var e=1;n>e;++e)t[e]=r[e]-r[e-1];return t}function w(r,t){var n,e,i=r instanceof Int8Array?127:32767,o=-i-1,a=r.length;if(!t){var u=0;for(n=0;a>n;++n)r[n]o&&++u;t=new Int32Array(u);}for(n=0,e=0;a>n;){for(var s=0;r[n]===i||r[n]===o;)s+=r[n],++n;s+=r[n],++n,t[e]=s,++e;}return t}function C(r,t){var n,e=t?127:32767,i=-e-1,o=r.length,a=0;for(n=0;o>n;++n){var u=r[n];0===u?++a:a+=u===e||u===i?2:u>0?Math.ceil(u/e):Math.ceil(u/i);}var s=t?new Int8Array(a):new Int16Array(a),f=0;for(n=0;o>n;++n){var u=r[n];if(u>=0)for(;u>=e;)s[f]=e,++f,u-=e;else for(;i>=u;)s[f]=i,++f,u-=i;s[f]=u,++f;}return s}function A(r,t){return b(p(r),t)}function x(r){return U(I(r))}function M(r,t,n){return y(p(r,c(n)),t,n)}function F(r,t){return U(m(r,t))}function S(r,t,n){return y(b(r,c(n)),t,n)}function E(r,t,n){return I(m(r,t),n)}function N(r,t,n){return y(w(r,c(n)),t,n)}function O(r,t,n){var e=w(r,c(n));return S(e,t,d(e))}function T(r,t,n){return C(E(r,t),n)}function k(r){var t=u(r),n=t.getInt32(0),e=t.getInt32(4),i=r.subarray(8,12),r=r.subarray(12);return [n,r,e,i]}function j(r,t,n,e){var i=new ArrayBuffer(12+e.byteLength),o=new Uint8Array(i),a=new DataView(i);return a.setInt32(0,r),a.setInt32(4,t),n&&o.set(n,8),o.set(e,12),o}function q(r){var t=r.length,n=s(r);return j(2,t,void 0,n)}function D(r){var t=r.length,n=L(r);return j(4,t,void 0,n)}function P(r,t){var n=r.length/t,e=L([t]),i=s(r);return j(5,n,e,i)}function z(r){var t=r.length,n=L(U(r));return j(6,t,void 0,n)}function B(r){var t=r.length,n=L(x(r));return j(8,t,void 0,n)}function V(r,t){var n=r.length,e=L([t]),i=L(F(r,t));return j(9,n,e,i)}function G(r,t){var n=r.length,e=L([t]),i=v(T(r,t));return j(10,n,e,i)}function R(r){var t={};return rr.forEach(function(n){void 0!==r[n]&&(t[n]=r[n]);}),r.bondAtomList&&(t.bondAtomList=D(r.bondAtomList)),r.bondOrderList&&(t.bondOrderList=q(r.bondOrderList)),t.xCoordList=G(r.xCoordList,1e3),t.yCoordList=G(r.yCoordList,1e3),t.zCoordList=G(r.zCoordList,1e3),r.bFactorList&&(t.bFactorList=G(r.bFactorList,100)),r.atomIdList&&(t.atomIdList=B(r.atomIdList)),r.altLocList&&(t.altLocList=z(r.altLocList)),r.occupancyList&&(t.occupancyList=V(r.occupancyList,100)),t.groupIdList=B(r.groupIdList),t.groupTypeList=D(r.groupTypeList),r.secStructList&&(t.secStructList=q(r.secStructList)),r.insCodeList&&(t.insCodeList=z(r.insCodeList)),r.sequenceIndexList&&(t.sequenceIndexList=B(r.sequenceIndexList)),t.chainIdList=P(r.chainIdList,4),r.chainNameList&&(t.chainNameList=P(r.chainNameList,4)),t}function H(r){function t(r){for(var t={},n=0;r>n;n++){var e=o();t[e]=o();}return t}function n(t){var n=r.subarray(a,a+t);return a+=t,n}function e(t){var n=r.subarray(a,a+t);a+=t;var e=65535;if(t>e){for(var i=[],o=0;on;n++)t[n]=o();return t}function o(){var o,s,f=r[a];if(0===(128&f))return a++,f;if(128===(240&f))return s=15&f,a++,t(s);if(144===(240&f))return s=15&f,a++,i(s);if(160===(224&f))return s=31&f,a++,e(s);if(224===(224&f))return o=u.getInt8(a),a++,o;switch(f){case 192:return a++,null;case 194:return a++,!1;case 195:return a++,!0;case 196:return s=u.getUint8(a+1),a+=2,n(s);case 197:return s=u.getUint16(a+1),a+=3,n(s);case 198:return s=u.getUint32(a+1),a+=5,n(s);case 202:return o=u.getFloat32(a+1),a+=5,o;case 203:return o=u.getFloat64(a+1),a+=9,o;case 204:return o=r[a+1],a+=2,o;case 205:return o=u.getUint16(a+1),a+=3,o;case 206:return o=u.getUint32(a+1),a+=5,o;case 208:return o=u.getInt8(a+1),a+=2,o;case 209:return o=u.getInt16(a+1),a+=3,o;case 210:return o=u.getInt32(a+1),a+=5,o;case 217:return s=u.getUint8(a+1),a+=2,e(s);case 218:return s=u.getUint16(a+1),a+=3,e(s);case 219:return s=u.getUint32(a+1),a+=5,e(s);case 220:return s=u.getUint16(a+1),a+=3,i(s);case 221:return s=u.getUint32(a+1),a+=5,i(s);case 222:return s=u.getUint16(a+1),a+=3,t(s);case 223:return s=u.getUint32(a+1),a+=5,t(s)}throw new Error("Unknown type 0x"+f.toString(16))}var a=0,u=new DataView(r.buffer);return o()}function W(r,t,n,e){switch(r){case 1:return h(t);case 2:return f(t);case 3:return l(t);case 4:return g(t);case 5:return s(t);case 6:return p(g(t),new Uint8Array(n));case 7:return p(g(t));case 8:return A(g(t));case 9:return M(g(t),g(e)[0]);case 10:return O(l(t),g(e)[0]);case 11:return y(l(t),g(e)[0]);case 12:return N(l(t),g(e)[0]);case 13:return N(f(t),g(e)[0]);case 14:return w(l(t));case 15:return w(f(t))}}function X(r,t){t=t||{};var n=t.ignoreFields,e={};return nr.forEach(function(t){var i=n?-1!==n.indexOf(t):!1,o=r[t];i||void 0===o||(o instanceof Uint8Array?e[t]=W.apply(null,k(o)):e[t]=o);}),e}function J(r){return String.fromCharCode.apply(null,r).replace(/\0/g,"")}function K(r,t,n){n=n||{};var e,i,o,a,u,s,f=n.firstModelOnly,c=t.onModel,d=t.onChain,l=t.onGroup,v=t.onAtom,g=t.onBond,L=0,h=0,y=0,m=0,p=0,U=-1,b=r.chainNameList,I=r.secStructList,w=r.insCodeList,C=r.sequenceIndexList,A=r.atomIdList,x=r.bFactorList,M=r.altLocList,F=r.occupancyList,S=r.bondAtomList,E=r.bondOrderList;for(e=0,i=r.chainsPerModel.length;i>e&&!(f&&L>0);++e){var N=r.chainsPerModel[L];for(c&&c({chainCount:N,modelIndex:L}),o=0;N>o;++o){var O=r.groupsPerChain[h];if(d){var T=J(r.chainIdList.subarray(4*h,4*h+4)),k=null;b&&(k=J(b.subarray(4*h,4*h+4))),d({groupCount:O,chainIndex:h,modelIndex:L,chainId:T,chainName:k});}for(a=0;O>a;++a){var j=r.groupList[r.groupTypeList[y]],q=j.atomNameList.length;if(l){var D=null;I&&(D=I[y]);var P=null;r.insCodeList&&(P=String.fromCharCode(w[y]));var z=null;C&&(z=C[y]),l({atomCount:q,groupIndex:y,chainIndex:h,modelIndex:L,groupId:r.groupIdList[y],groupType:r.groupTypeList[y],groupName:j.groupName,singleLetterCode:j.singleLetterCode,chemCompType:j.chemCompType,secStruct:D,insCode:P,sequenceIndex:z});}for(u=0;q>u;++u){if(v){var B=null;A&&(B=A[m]);var V=null;x&&(V=x[m]);var G=null;M&&(G=String.fromCharCode(M[m]));var R=null;F&&(R=F[m]),v({atomIndex:m,groupIndex:y,chainIndex:h,modelIndex:L,atomId:B,element:j.elementList[u],atomName:j.atomNameList[u],formalCharge:j.formalChargeList[u],xCoord:r.xCoordList[m],yCoord:r.yCoordList[m],zCoord:r.zCoordList[m],bFactor:V,altLoc:G,occupancy:R});}m+=1;}if(g){var H=j.bondAtomList;for(u=0,s=j.bondOrderList.length;s>u;++u)g({atomIndex1:m-q+H[2*u],atomIndex2:m-q+H[2*u+1],bondOrder:j.bondOrderList[u]});}y+=1;}h+=1;}if(p=U+1,U=m-1,g&&S)for(u=0,s=S.length;s>u;u+=2){var W=S[u],X=S[u+1];(W>=p&&U>=W||X>=p&&U>=X)&&g({atomIndex1:W,atomIndex2:X,bondOrder:E?E[u/2]:null});}L+=1;}}function Q(r){return o(R(r))}function Y(r,t){r instanceof ArrayBuffer&&(r=new Uint8Array(r));var n;return n=r instanceof Uint8Array?H(r):r,X(n,t)}function Z(r,t,n,e){function i(){try{var r=Y(o.response);n(r);}catch(t){e(t);}}var o=new XMLHttpRequest;o.addEventListener("load",i,!0),o.addEventListener("error",e,!0),o.responseType="arraybuffer",o.open("GET",t+r.toUpperCase()),o.send();}function $(r,t,n){Z(r,or,t,n);}function _(r,t,n){Z(r,ar,t,n);}var rr=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"],tr=["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"],nr=rr.concat(tr),er="v1.1.0dev",ir="//mmtf.rcsb.org/v1.0/",or=ir+"full/",ar=ir+"reduced/";r.encode=Q,r.decode=Y,r.traverse=K,r.fetch=$,r.fetchReduced=_,r.version=er,r.fetchUrl=or,r.fetchReducedUrl=ar,r.encodeMsgpack=o,r.encodeMmtf=R,r.decodeMsgpack=H,r.decodeMmtf=X;}); - }); - - var Complex$3 = chem.Complex, - Chain$1 = chem.Chain, - Atom$1 = chem.Atom, - Element$4 = chem.Element, - Helix$2 = chem.Helix, - Sheet$2 = chem.Sheet, - Strand$2 = chem.Strand, - Bond$3 = chem.Bond, - Assembly$2 = chem.Assembly, - Molecule$2 = chem.Molecule; - - var ArrayComparator = /*#__PURE__*/function () { - function ArrayComparator(original) { - classCallCheck(this, ArrayComparator); - - this._original = Array.from(original); - - this._original.sort(); - - this._sum = 0; - - for (var i = 0; i < this._original.length; ++i) { - this._sum += this._original[i]; - } - } - - createClass(ArrayComparator, [{ - key: "compare", - value: function compare(candidate) { - var len = candidate.length; - - if (len !== this._original.length) { - return false; - } - - var sum = 0; - var i; - - for (i = 0; i < len; ++i) { - sum += candidate[i]; - } - - if (sum !== this._sum) { - return false; - } - - var sorted = Array.from(candidate); - sorted.sort(); - - for (i = 0; i < len; ++i) { - if (sorted[i] !== this._original[i]) { - return false; - } - } - - return true; - } - }]); - - return ArrayComparator; - }(); - - ArrayComparator.prototype.constructor = ArrayComparator; - var StructuralElementType$5 = StructuralElement.Type; // see https://github.com/rcsb/mmtf-javascript/blob/master/src/mmtf-traverse.js - - var secStructToType = [StructuralElementType$5.HELIX_PI, // 0 - StructuralElementType$5.BEND, // 1 - StructuralElementType$5.HELIX_ALPHA, // 2 - StructuralElementType$5.STRAND, // 3 - StructuralElementType$5.HELIX_310, // 4 - StructuralElementType$5.BRIDGE, // 5 - StructuralElementType$5.TURN, // 6 - StructuralElementType$5.COIL // 7 - ]; - - function getFirstByte(buf) { - var bytes = new Uint8Array(buf, 0, 1); - return bytes[0]; - } - - var MMTFParser = /*#__PURE__*/function (_Parser) { - inherits(MMTFParser, _Parser); - - function MMTFParser(data, options) { - var _this; - - classCallCheck(this, MMTFParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(MMTFParser).call(this, data, options)); - _this._options.fileType = 'mmtf'; - return _this; - } - - createClass(MMTFParser, [{ - key: "_onModel", - value: function _onModel(_modelData) {} - }, { - key: "_onChain", - value: function _onChain(chainData) { - if (chainData.modelIndex !== 0) { - return; - } - - var chain = new Chain$1(this._complex, chainData.chainName); - this._complex._chains[chainData.chainIndex] = chain; - chain._index = chainData.chainIndex; - } - }, { - key: "_onGroup", - value: function _onGroup(groupData) { - if (groupData.modelIndex !== 0) { - return; - } - - if (this.settings.now.nowater) { - // skip water - if (groupData.groupName === 'HOH' || groupData.groupName === 'WAT') { - return; - } - } - - var chain = this._complex._chains[groupData.chainIndex]; - var icode = !groupData.insCode.charCodeAt(0) ? '' : groupData.insCode; - var residue = chain.addResidue(groupData.groupName, groupData.groupId, icode); - residue._index = groupData.groupIndex; - - this._updateSecStructure(this._complex, residue, groupData); - } - }, { - key: "_onAtom", - value: function _onAtom(atomData) { - if (atomData.modelIndex !== 0) { - return; - } - - var altLoc = !atomData.altLoc.charCodeAt(0) ? '' : atomData.altLoc; - var atom = new Atom$1(atomData.groupIndex, // we store residue index here to replace it later with actual reference - atomData.atomName, Element$4.getByName(atomData.element.toUpperCase()), new THREE.Vector3(atomData.xCoord, atomData.yCoord, atomData.zCoord), Element$4.Role[atomData.atomName], false, // hetero atoms will be marked later - atomData.atomId, altLoc, atomData.occupancy, atomData.bFactor, atomData.formalCharge); - this._complex._atoms[atomData.atomIndex] = atom; - atom.index = atomData.atomIndex; - this._serialAtomMap[atomData.atomId] = atom; - } - }, { - key: "_onBond", - value: function _onBond(bondData) { - var right = Math.max(bondData.atomIndex1, bondData.atomIndex2); - - if (right >= this._complex._atoms.length) { - return; - } - - var left = Math.min(bondData.atomIndex1, bondData.atomIndex2); - - this._complex.addBond(this._complex._atoms[left], this._complex._atoms[right], bondData.bondOrder, Bond$3.BondType.UNKNOWN, true); - } - }, { - key: "_updateSecStructure", - value: function _updateSecStructure(complex, residue, groupData) { - var helixClasses = [3, -1, 1, -1, 5]; - - if (!_.isUndefined(groupData) && groupData.secStruct === this._ssType) { - residue._secondary = this._ssStruct; - - if (this._ssStruct) { - this._ssStruct.term = residue; - } - - return; - } - - if (!_.isUndefined(groupData)) { - // start new secondary structure - var type = secStructToType[groupData.secStruct]; - this._ssType = groupData.secStruct; - this._ssStart = residue; - var struct = null; - - switch (this._ssType) { - case -1: // undefined - - case 7: - // coil - break; - - case 0: // pi helix - - case 2: // alpha helix - - case 4: - // 3-10 helix - struct = new Helix$2(helixClasses[this._ssType], residue, residue, 0, '', '', 0); - - complex._helices.push(struct); - - break; - - case 3: - { - // extended - var sheet = new Sheet$2('', 0); - - complex._sheets.push(sheet); - - struct = new Strand$2(sheet, residue, residue, 0, null, null); - break; - } - - default: - if (type !== undefined) { - struct = new StructuralElement(type, residue, residue); - } - - break; - } - - this._ssStruct = struct; - residue._secondary = struct; - - if (struct) { - complex.structures.push(struct); - } - } - } - }, { - key: "_updateMolecules", - value: function _updateMolecules(mmtfData) { - var entities = mmtfData.entityList; - - if (!entities) { - return; - } - - var chainsInModel0 = mmtfData.chainsPerModel[0]; - - for (var i = 0; i < entities.length; i++) { - var entity = entities[i]; - var chains = entity.chainIndexList; - var residues = []; - - for (var j = 0; j < chains.length; j++) { - var chainIndex = chains[j]; // skip chains in models other than the first one - - if (chainIndex >= chainsInModel0) { - continue; - } - - var chain = this._complex._chains[chainIndex]; - residues = residues.concat(chain._residues.slice()); - } - - var molecule = new Molecule$2(this._complex, entity.description, i + 1); - molecule.residues = residues; - this._complex._molecules[i] = molecule; - } - } // populate complex with chains, residues and atoms - - }, { - key: "_traverse", - value: function _traverse(mmtfData) { - var self = this; // get metadata - - var metadata = this._complex.metadata; - metadata.id = mmtfData.structureId; - metadata.title = []; - metadata.title[0] = mmtfData.title; - metadata.date = mmtfData.releaseDate; - metadata.format = 'mmtf'; // create event callback functions - - var eventCallbacks = { - onModel: function onModel(modelData) { - self._onModel(modelData); - }, - onChain: function onChain(chainData) { - self._onChain(chainData); - }, - onGroup: function onGroup(groupData) { - self._onGroup(groupData); - }, - onAtom: function onAtom(atomData) { - self._onAtom(atomData); - }, - onBond: function onBond(bondData) { - self._onBond(bondData); - } - }; // temporary variables used during traversal to track secondary structures - - this._ssType = -1; - this._ssStruct = null; - this._ssStart = null; // traverse the structure and listen to the events - - mmtf.traverse(mmtfData, eventCallbacks); - - this._updateSecStructure(this._complex); - - this._updateMolecules(mmtfData); - } // During traversal atoms and residues don't come sequentially - // so a residue for certain atom can be unavailable. Thus we - // store residue index in atom. - // This function being called after traversal replaces the index - // with actual reference, and also populates atom lists in residues. - - }, { - key: "_linkAtomsToResidues", - value: function _linkAtomsToResidues() { - for (var i = 0; i < this._complex._atoms.length; ++i) { - var atom = this._complex._atoms[i]; - var residue = this._complex._residues[atom.residue]; - atom.residue = residue; - - residue._atoms.push(atom); - } - } - }, { - key: "_findSynonymousChains", - value: function _findSynonymousChains() { - var named = {}; - - for (var i = 0; i < this._complex._chains.length; ++i) { - var chain = this._complex._chains[i]; - var name = chain.getName(); - - if (!named.hasOwnProperty(name)) { - named[name] = []; - } - - named[name].push(chain._index); - } - - return named; - } // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains. - - }, { - key: "_parseAssemblyInfo", - value: function _parseAssemblyInfo(mmtfData) { - var i; - var j; - var k; - var assemblies = []; - var logger = this.logger; - - for (i = 0; i < mmtfData.bioAssemblyList.length; ++i) { - var baInfo = mmtfData.bioAssemblyList[i]; - - if (baInfo.transformList.length === 0) { - continue; - } - - var chains = baInfo.transformList[0].chainIndexList; - var chainListCheck = new ArrayComparator(chains); // build list of chain names - - var chainNames = {}; - - for (j = 0; j < chains.length; ++j) { - chainNames[this._complex._chains[chains[j]].getName()] = 1; - } // all chains with the same name should belong to assembly if one of them belongs - - - var allChains = []; - var name = void 0; - - for (name in chainNames) { - if (chainNames.hasOwnProperty(name)) { - // just concat arrays -- there should be no duplicates - Array.prototype.push.apply(allChains, this._chainsByName[name]); - } - } - - if (!chainListCheck.compare(allChains)) { - // assembly is missing some of the chains - logger.debug('MMTF: Assembly is missing some of the synonymous chains. Skipping...'); - } - - var a = new Assembly$2(this._complex); // add chains to assembly - - for (name in chainNames) { - if (chainNames.hasOwnProperty(name)) { - a.addChain(name); - } - } // add unique matrices to assembly - - - a.addMatrix(new THREE.Matrix4().fromArray(baInfo.transformList[0].matrix).transpose()); - - for (j = 1; j < baInfo.transformList.length; ++j) { - var transform = baInfo.transformList[j]; - - if (!chainListCheck.compare(transform.chainIndexList)) { - // list of chains for this transform doesn't match that for other transforms - // this is illegal in our structure - logger.debug('MMTF: Chain lists differ for different transforms in one assembly. Skipping...'); - continue; - } - - var m = new THREE.Matrix4().fromArray(transform.matrix).transpose(); // check if matrix is already in the list - - for (k = 0; k < a.matrices.length; ++k) { - if (a.matrices[k].equals(m)) { - break; - } - } - - if (k === a.matrices.length) { - a.addMatrix(m); - } - } - - a.finalize(); - assemblies.push(a); - } - - return assemblies; - } // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains. - - }, { - key: "_markHeteroAtoms", - value: function _markHeteroAtoms(mmtfData) { - var chainsInModel0 = mmtfData.chainsPerModel[0]; - - for (var i = 0; i < mmtfData.entityList.length; ++i) { - var entity = mmtfData.entityList[i]; - - if (entity.type !== 'polymer') { - for (var j = 0; j < entity.chainIndexList.length; ++j) { - var chainIndex = entity.chainIndexList[j]; // skip chains in models other than the first one - - if (chainIndex >= chainsInModel0) { - continue; - } - - var chain = this._complex._chains[chainIndex]; - - for (var k = 0; k < chain._residues.length; ++k) { - var res = chain._residues[k]; - - for (var m = 0; m < res._atoms.length; ++m) { - res._atoms[m].het = true; - } - } - } - } - } - } // joins chains with the same name into single chain - - }, { - key: "_joinSynonymousChains", - value: function _joinSynonymousChains() { - var i; - var j; - var primaryChainsArray = []; - var primaryChainsHash = {}; // join chains - - for (i = 0; i < this._complex._chains.length; ++i) { - var chain = this._complex._chains[i]; - var name = chain.getName(); - - if (!primaryChainsHash.hasOwnProperty(name)) { - // new name -- this is a primary chain - primaryChainsHash[name] = chain; - chain._index = primaryChainsArray.length; // update index as this array will later replace original chain list - - primaryChainsArray.push(chain); - continue; - } // this chain should be joined with the primary chain of the same name - - - var primary = primaryChainsHash[name]; - - for (j = 0; j < chain._residues.length; ++j) { - var residue = chain._residues[j]; - - primary._residues.push(residue); - - residue._chain = primary; - } - } // replace chains list with one containing only primary chains - // dropping references to all chains but primary - - - this._complex._chains = primaryChainsArray; - } - }, { - key: "parseSync", - value: function parseSync() { - var mmtfData = mmtf.decode(this._data); - this._complex = new Complex$3(); - this._serialAtomMap = {}; // filled during traversal - - this._traverse(mmtfData); - - this._linkAtomsToResidues(); - - this._markHeteroAtoms(mmtfData); - - this._chainsByName = this._findSynonymousChains(); - Array.prototype.push.apply(this._complex.units, this._parseAssemblyInfo(mmtfData)); - - this._joinSynonymousChains(); - - this._complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - - return this._complex; - } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - // check if it's binary MessagePack format containing a map (dictionary) - // see https://github.com/msgpack/msgpack/blob/master/spec.md - return _.isArrayBuffer(data) && (getFirstByte(data) | 1) === 0xDF; - } - }]); - - return MMTFParser; - }(Parser); - - MMTFParser.formats = ['mmtf']; - MMTFParser.extensions = ['.mmtf']; - MMTFParser.binary = true; - - var ParsingError = /*#__PURE__*/function (_Error) { - inherits(ParsingError, _Error); - - function ParsingError(message, line, column) { - var _this; - - classCallCheck(this, ParsingError); - - _this = possibleConstructorReturn(this, getPrototypeOf(ParsingError).call(this, "data:".concat(line, ":").concat(column, ": ").concat(message))); - - if (Error.captureStackTrace) { - Error.captureStackTrace(assertThisInitialized(_this), ParsingError); - } - - _this.name = 'ParsingError'; - _this.parseLine = line; - _this.parseColumn = column; - return _this; - } - - return ParsingError; - }( /*#__PURE__*/wrapNativeSuper(Error)); - - function _isWhitespace(ch) { - return ch === 32 || ch === 10 || ch === 13 || ch === 9; - } - - function _inlineIndexOf(ch0, str, idx) { - var len = str.length; - var ch = -1; - - while (idx < len) { - ch = str.charCodeAt(idx); - - if (ch === ch0 || ch === 10) { - break; - } - - ++idx; - } - - return ch === ch0 ? idx : -1; - } - - function readCIF(source) { - var i = 0; - var j = 0; - var n = source.length; - var code = NaN; - var newline = true; - var line = 1; - var column = 1; - var begin; - var state = 0; // 0 - start, 1 - block, 2 - item, 3 - loop, 4 - values, 5 - value - - var result = {}; - var block = {}; - var keys = []; - var keysCount = 0; - var key = ''; - var values = []; - var valuesCount = 0; - var value; - - function _parseValue() { - var val; - - if ((code === 46 || code === 63) && (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))) { - // '.' or '?' ..... - // it's a missing value - ++column; - ++i; - return undefined; - } - - if (newline && code === 59) { - // ';' ...................................................................... - // parse multi-line string - j = i; - var lines = 0; - - do { - j = _inlineIndexOf(10, source, j + 1); // '\n' - - if (j === -1) { - throw new ParsingError('Unterminated text block found', line, column); - } - - ++lines; - } while (j + 1 < n && source.charCodeAt(j + 1) !== code || j + 1 >= n); - - val = source.substring(i + 1, j).replace(/\r/g, ''); - i = j + 2; - line += lines; - column = 1; - newline = false; - return val; - } - - if (code === 39 || code === 34) { - // ''' or '"' ........................................................... - // parse quoted string - j = i; - - do { - j = _inlineIndexOf(code, source, j + 1); - - if (j === -1) { - throw new ParsingError('Unterminated quoted string found', line, column); - } - } while (j + 1 < n && !_isWhitespace(source.charCodeAt(j + 1))); - - val = source.substring(i + 1, j); - column += j - i + 1; - i = j + 1; - return val; - } // ...................................................................................................... - // parse until the first whitespace - - - j = i; - - while (j < n && !_isWhitespace(source.charCodeAt(j))) { - ++j; - } - - val = source.substring(i, j); - column += j - i; - i = j; // try to convert to a number - - var num = Number(val); - - if (!Number.isNaN(num)) { - return num; - } // or leave as an unquoted string - - - return val; - } - - function _storeKey(tag) { - keys[keysCount++] = tag; - } - - function _storeValue(val) { - var keyIndex = valuesCount % keysCount; - values[keyIndex].push(val); - ++valuesCount; - return val; - } - - while (i <= n) { - code = source.charCodeAt(i); // 'NaN' in place of '' - - if (code === 13) ; else if (code === 10) { - // '\n' ................................................................................ - // take note of new lines - newline = true; - ++line; - column = 1; - } else { - // process inline characters - if (code === 32 || code === 9) ; else if (code === 35) { - // '#' ............................................................................... - // skip the comment until before the end of the line - i = _inlineIndexOf(10, source, i + 1); // '\n' - - if (i === -1) { - break; - } else { - continue; // don't forget to process the new line - } - } else if (state === 0) { - // start ============================================================================= - if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { - // 'data_' .......... - j = i + 5; - begin = j; - - while (j < n && !_isWhitespace(source.charCodeAt(j))) { - ++j; - } - - column += j - i; - i = j; - - if (begin < i) { - // add new data block - result[source.substring(begin, i)] = block = {}; - state = 1; // block - - continue; // don't forget to process the whitespace - } else { - throw new ParsingError('Data block name missing', line, column); - } - } else if (Number.isNaN(code)) { - // .................................................................... - break; - } else { - // .................................................................................................. - throw new ParsingError("Unexpected character in state ".concat(state), line, column); - } - } else if (state === 1) { - // block ============================================================================= - if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { - // 'data_' .......... - state = 0; // start - - continue; // parse again in a different state - } else if (code === 95) { - // '_' ............................................................................. - j = i + 1; - begin = j; - - while (j < n && !_isWhitespace(source.charCodeAt(j))) { - ++j; - } - - column += j - i; - i = j; - - if (begin < i) { - // start new item - key = source.substring(begin, i); - state = 2; // item - - continue; // don't forget to process the whitespace - } else { - throw new ParsingError('Tag name missing', line, column); - } - } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { - // 'loop_' ... - i += 5; - column += 5; - - if (i < n && !_isWhitespace(source.charCodeAt(i))) { - throw new ParsingError("Unexpected character in state ".concat(state), line, column); - } else { - // start new loop - keys = []; - keysCount = 0; - values = []; - valuesCount = 0; - state = 3; // loop - - continue; // don't forget to process the whitespace - } - } else if (Number.isNaN(code)) { - // .................................................................... - break; - } else { - // .................................................................................................. - throw new ParsingError("Unexpected character in state ".concat(state), line, column); - } - } else if (state === 2) { - // item ============================================================================== - if (Number.isNaN(code)) { - break; - } - - value = _parseValue(); - - _.set(block, key, value); - - state = 1; // block - - continue; - } else if (state === 3) { - // loop ============================================================================== - if (code === 95) { - // '_' .................................................................................... - j = i + 1; - begin = j; - - while (j < n && !_isWhitespace(source.charCodeAt(j))) { - ++j; - } - - column += j - i; - i = j; - - if (begin < i) { - // add new key - _storeKey(source.substring(begin, i)); - - continue; // don't forget to process the whitespace - } else { - throw new ParsingError('Tag name missing', line, column); - } - } else { - // .................................................................................................. - if (keysCount > 0) { - for (var keyIndex = 0; keyIndex < keysCount; ++keyIndex) { - value = []; - values[keyIndex] = value; - - _.set(block, keys[keyIndex], value); - } - - state = 4; - continue; // parse again in a different state - } - - throw new ParsingError('Data tags are missing inside a loop', line, column); - } - } else if (state === 4) { - // values ============================================================================ - if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { - // 'data_' .......... - state = 0; // start - } else if (code === 95) { - // '_' ............................................................................. - state = 1; // block - } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { - // 'loop_' ... - state = 1; // block - } else if (Number.isNaN(code)) { - // .................................................................... - state = 0; - } else { - // .................................................................................................. - _storeValue(_parseValue()); - } - - continue; // parse again in a different state - } else { - // ==================================================================================================== - throw new ParsingError("Unexpected internal state ".concat(state), line, column); - } - - newline = false; - ++column; - } - - ++i; - } - - if (state === 2) { - // item - throw new ParsingError("Unexpected end of file in state ".concat(state), line, column); - } - - return result; - } - - var Complex$4 = chem.Complex, - Element$5 = chem.Element, - Helix$3 = chem.Helix, - Sheet$3 = chem.Sheet, - Strand$3 = chem.Strand, - Assembly$3 = chem.Assembly, - Molecule$3 = chem.Molecule; - var cRequiredAtomFields = ['auth_seq_id', 'Cartn_x', 'Cartn_y', 'Cartn_z', 'label_atom_id']; - var cSecondaryCoding = { - helx: 'helix', - turn: 'turn', - strn: 'strand' - }; - - function getTypeFromId(string) { - var typeId = /[A-Za-z]+/.exec(string); - - if (!typeId) { - return null; - } - - return cSecondaryCoding[typeId[0].toLowerCase()]; - } - /** - * Make valid object an array - * @param arrayLikeObject - * @return {array, object} array or object - */ - - - function arrize(arrayLikeObject) { - if (arrayLikeObject === null || arrayLikeObject === undefined || _.isArray(arrayLikeObject)) { - return arrayLikeObject; - } - - return [arrayLikeObject]; - } - - function nameToElement$1(name) { - // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM - // - // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1 - // - // Atom names start with element symbols right-justified in columns 13-14 - // as permitted by the length of the name. For example, the symbol FE for - // iron appears in columns 13-14, whereas the symbol C for carbon appears - // in column 14 (see Misaligned Atom Names). If an atom name has four - // characters, however, it must start in column 13 even if the element - // symbol is a single character (for example, see Hydrogen Atoms). - var veryLong = name.trim().length === 4; - return name.slice(0, veryLong ? 1 : 2).trim(); - } - - var AtomDataError = /*#__PURE__*/function (_Error) { - inherits(AtomDataError, _Error); - - function AtomDataError(message) { - var _this; - - classCallCheck(this, AtomDataError); - - _this = possibleConstructorReturn(this, getPrototypeOf(AtomDataError).call(this)); - _this.name = 'AtomDataError'; - _this.message = message; - return _this; - } - - return AtomDataError; - }( /*#__PURE__*/wrapNativeSuper(Error)); - - function _getOperations(operList) { - if (!operList) { - return null; - } - - var idc = arrize(operList.id); - var matrix = operList.matrix, - vector = operList.vector; - - if (!idc || !matrix || !vector) { - return null; - } - - var ops = []; - - for (var i = 0, n = idc.length; i < n; ++i) { - var mtx = new THREE.Matrix4(); - var elements = mtx.elements; - - for (var row = 0; row < 3; ++row) { - var matrixData = matrix[row + 1]; - elements[row] = arrize(matrixData[1])[i]; - elements[row + 4] = arrize(matrixData[2])[i]; - elements[row + 8] = arrize(matrixData[3])[i]; - elements[row + 12] = arrize(vector[row + 1])[i]; - } - - ops[idc[i]] = mtx; - } - - return ops; - } - - function _extractOperations(assemblyGen, opsDict) { - assemblyGen = _.isString(assemblyGen) ? assemblyGen : "".concat(assemblyGen); - var l = assemblyGen.replace(/\)\s*\(/g, '!').replace(/[()']/g, ''); - var groupStr = l.split('!'); - var gps = []; - - for (var grIdx = 0, grCount = groupStr.length; grIdx < grCount; ++grIdx) { - var gr = groupStr[grIdx].split(','); - var gp = []; - var idx = 0; - - for (var i = 0, n = gr.length; i < n; ++i) { - var s = gr[i]; - - if (s.includes('-')) { - var es = s.split('-'); - var j = parseInt(es[0], 10); - var m = parseInt(es[1], 10); - - for (; j <= m; ++j) { - gp[idx++] = opsDict[j]; - } - } else { - gp[idx++] = opsDict[s]; - } - } - - gps.push(gp); - } // traverse all groups from the end of array and make all mults - - - var matrices = []; - var cnt = 0; - - function traverse(level, mtx) { - for (var ii = 0, nn = gps[level].length; ii < nn; ++ii) { - var newMtx = mtx ? mtx.clone() : new THREE.Matrix4(); - newMtx.multiplyMatrices(gps[level][ii], newMtx); - - if (level === 0) { - matrices[cnt++] = newMtx; - } else { - traverse(level - 1, newMtx); - } - } - } - - traverse(gps.length - 1); - return matrices; - } - - var CIFParser = /*#__PURE__*/function (_Parser) { - inherits(CIFParser, _Parser); - - function CIFParser(data, options) { - var _this2; - - classCallCheck(this, CIFParser); - - _this2 = possibleConstructorReturn(this, getPrototypeOf(CIFParser).call(this, data, options)); - _this2.asymDict = {}; - _this2.molecules = []; - _this2._options.fileType = 'cif'; - return _this2; - } - - createClass(CIFParser, [{ - key: "parseSync", - value: function parseSync() { - this.logger.info('Parsing CIF file..'); - var data = readCIF(this._data); - return this._toComplex(data); - } - /** - * Convert intermediate structure into our valid Complex object - * @param cifData intermediate CIF object - * @returns {Complex} complex - * @private - */ - - }, { - key: "_toComplex", - value: function _toComplex(cifData) { - var complex = new Complex$4(); - var complexData = cifData[Object.keys(cifData)[0]]; - - this._extractAtoms(complex, complexData); - - this._extractSecondary(complex, complexData); - - this._extractAssemblies(complex, complexData); - - this._extractMolecules(complex, complexData); - - this._extractMetadata(complex, complexData); - - complex.finalize({ - needAutoBonding: true, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing - }); - return complex; - } - /** - * Extract metadata - * @param complex structure to fill - * @param complexData complex data from CIF file - * @private - */ - - }, { - key: "_extractMetadata", - value: function _extractMetadata(complex, complexData) { - var metadata = complex.metadata; - metadata.id = complexData.entry.id; - metadata.classification = complexData.struct_keywords.pdbx_keywords; - var databaserev = complexData.database_PDB_rev; - metadata.date = databaserev && databaserev.date_original ? databaserev.date_original : ''; - metadata.format = 'cif'; - metadata.title = []; - metadata.title[0] = complexData.struct.title; - } - /** - * Extract molecules information from CIF structure (should be called strictly after _extractAtoms) - * @param complexData complex data from CIF file - * @private - */ - - }, { - key: "_extractMolecules", - value: function _extractMolecules(complex, complexData) { - var molData = complexData.entity; - var names = arrize(molData.pdbx_description); - var count = names.length; - var i; // molecules names from cif - - for (i = 0; i < count; i++) { - this.molecules[i].name = names[i]; - } // reorganize molecules for complex and check chains - - - var molecules = complex.getMolecules(); - - for (i = 0; i < count; i++) { - var molecule = this.molecules[i]; - molecules[i] = new Molecule$3(complex, molecule.name, i + 1); - molecules[i].residues = molecule.residues; - } - } - /** - * Extract atom information from CIF structure and fill complex - * @param {Complex} complex - * @param complexData complex data from CIF file - * @private - */ - - }, { - key: "_extractAtoms", - value: function _extractAtoms(complex, complexData) { - var atomData = complexData.atom_site; - - if (!atomData) { - throw new AtomDataError('CIF parsing error: atom_site is not specified!'); - } - - for (var f = 0, n = cRequiredAtomFields.length; f < n; ++f) { - if (!atomData[cRequiredAtomFields[f]]) { - throw new AtomDataError("CIF parsing error: requires field ".concat(cRequiredAtomFields[f], " not found!")); - } - } - - var asymDict = this.asymDict; // required fields - - var resIdc = arrize(atomData.auth_seq_id); - var x = arrize(atomData.Cartn_x); - var y = arrize(atomData.Cartn_y); - var z = arrize(atomData.Cartn_z); - var names = arrize(atomData.label_atom_id); - var count = names.length; // optional fields - - var group = arrize(atomData.group_PDB) || []; - var chainIdc = arrize(atomData.auth_asym_id) || []; - var chainLabelIdc = arrize(atomData.label_asym_id) || []; - var serials = arrize(atomData.id) || []; - var iCodes = arrize(atomData.pdbx_PDB_ins_code) || []; - var resNames = arrize(atomData.label_comp_id) || []; - var elements = arrize(atomData.type_symbol) || []; - var tempFactors = arrize(atomData.B_iso_or_equiv) || []; - var occupancies = arrize(atomData.occupancy) || []; - var charges = arrize(atomData.pdbx_formal_charge) || []; - var altLocs = arrize(atomData.label_alt_id) || []; - var models = arrize(atomData.pdbx_PDB_model_num) || []; - var molecules = arrize(atomData.label_entity_id) || []; - var chain = null; - var residue = null; - - for (var i = 0; i < count; ++i) { - var model = models[i] || 1; - - if (model !== 1) { - continue; - } - - var chainID = String(chainIdc[i] || ' '); - - if (!chain || chain.getName() !== chainID) { - chain = complex.getChain(chainID) || complex.addChain(chainID); - } - - asymDict[String(chainLabelIdc[i] || ' ')] = chainID; - var resSeq = resIdc[i]; - var iCode = String(iCodes[i] || ' '); - var resName = String(resNames[i] || ''); - - if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { - residue = chain.addResidue(resName, resSeq, iCode); // store molecule (entity) - - var moleculeIdx = molecules[i] - 1; - var entity = this.molecules[moleculeIdx]; - - if (!entity) { - this.molecules[moleculeIdx] = { - name: '', - residues: [] - }; - entity = this.molecules[moleculeIdx]; - } - - entity.residues.push(residue); - } - - var name = names[i]; - var element = elements[i] || nameToElement$1(name); - var type = Element$5.getByName(element); - var role = Element$5.Role[name.trim()]; - var xyz = new THREE.Vector3(x[i], y[i], z[i]); - var het = group[i] === 'HETATM' || false; - var serial = serials[i] || i; - var tempFactor = tempFactors[i] || 0.0; - var occupancy = occupancies[i] || 0.0; - var altLoc = String(altLocs[i] || ''); - var charge = charges[i] || 0; - residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); - } - } - /** - * Extracts secondary structure information from CIF intermediate data - * and adds it into complex - * @param {Complex} complex - complex to fill - * @param complexData - CIF complex data - * @private - */ - - }, { - key: "_extractSecondary", - value: function _extractSecondary(complex, complexData) { - if (complexData.struct_conf) { - this._extractConfs(complex, complexData.struct_conf); - } - - if (complexData.struct_sheet_range) { - this._extractSheets(complex, complexData.struct_sheet_range); - } - } - /** - * Extracts sheets information from CIF intermediate data - * and adds it into complex - * @param {Complex} complex - * @param sheetData - * @private - */ - - }, { - key: "_extractSheets", - value: function _extractSheets(complex, sheetData) { - var asymDict = this.asymDict; - - if (!sheetData.sheet_id || !sheetData.id || !sheetData.beg_label_seq_id || !sheetData.end_label_seq_id || !sheetData.beg_label_asym_id) { - return; - } // Strand(sheet, start, end, sense, cur, prev) - - - var sheets = complex._sheets; - - function getSheet(name) { - var n = sheets.length; - - for (var i = 0; i < n; ++i) { - if (sheets[i]._name === name) { - return sheets[i]; - } - } - - sheets[n] = new Sheet$3(name, 0); - return sheets[n]; - } - - var sheetNames = arrize(sheetData.sheet_id); - var strandNames = arrize(sheetData.id); - var starts = arrize(sheetData.beg_auth_seq_id); - var ends = arrize(sheetData.end_auth_seq_id); - var chains = arrize(sheetData.beg_label_asym_id); - var stICodes = arrize(sheetData.pdbx_beg_PDB_ins_code) || []; - var endICodes = arrize(sheetData.pdbx_end_PDB_ins_code) || []; - - for (var i = 0, n = strandNames.length; i < n; ++i) { - var chain = complex.getChain(asymDict[chains[i]]); - var sheet = getSheet(sheetNames[i]); - var startIdx = starts[i]; - var endIdx = ends[i]; - var startICode = stICodes[i] || ' '; - var endICode = endICodes[i] || ' '; - var start = chain.findResidue(startIdx, startICode); - var end = chain.findResidue(endIdx, endICode); // TODO think about last condition - - if (!start || !end) { - continue; - } - - var strand = new Strand$3(sheet, start[0], end[0], 0, null, null); - var residues = chain.getResidues(); - - for (var r = start[1]; r <= end[1]; ++r) { - residues[r]._secondary = strand; - } - - sheet.addStrand(strand); - complex.structures.push(strand); - } - } - /** - * Extracts helix/turn/strand(?) information from CIF intermediate data - * and adds it into complex - * @param {Complex} complex - * @param helicesData - * @private - */ - - }, { - key: "_extractConfs", - value: function _extractConfs(complex, helicesData) { - var asymDict = this.asymDict; - - if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id || !helicesData.beg_label_asym_id) { - return; - } - - var types = arrize(helicesData.conf_type_id); - var starts = arrize(helicesData.beg_auth_seq_id); - var stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || []; - var ends = arrize(helicesData.end_auth_seq_id); - var endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || []; - var comments = arrize(helicesData.details) || []; - var lengths = arrize(helicesData.pdbx_PDB_helix_length) || []; - var helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || []; - var names = arrize(helicesData.id) || []; - var chains = arrize(helicesData.beg_label_asym_id); - - for (var i = 0, n = types.length; i < n; ++i) { - var type = getTypeFromId(types[i]); - - if (!type) { - continue; - } - - var name = names[i] || types[i]; - var chain = complex.getChain(asymDict[chains[i]]); - var startIdx = starts[i]; - var endIdx = ends[i]; - var startICode = stICodes[i] || ' '; - var endICode = endICodes[i] || ' '; - var start = chain.findResidue(startIdx, startICode); - var end = chain.findResidue(endIdx, endICode); // TODO think about last condition - - if (!start || !end) { - continue; - } - - var comment = comments[i] || ''; - var length = lengths[i] || 0; - var helixClass = helixClasses[i] || ' '; - var struct = void 0; - - if (type === 'helix') { - var idx = complex._helices.length; - struct = new Helix$3(helixClass, start[0], end[0], idx, name, comment, length); - complex.addHelix(struct); - complex.structures.push(struct); - } else if (type === 'turn') { - struct = new StructuralElement(StructuralElement.Type.TURN, start[0], end[0]); - complex.structures.push(struct); - } else { - struct = null; - } - - if (!struct) { - continue; - } - - var residues = chain.getResidues(); - - for (var r = start[1]; r <= end[1]; ++r) { - residues[r]._secondary = struct; - } - } - } - /** - * Extract biological assemblies information from CIF structure and fill complex - * @param {Complex} complex - * @param complexData complex data from CIF file - * @private - */ - - }, { - key: "_extractAssemblies", - value: function _extractAssemblies(complex, complexData) { - var asymDict = this.asymDict; - var asmGen = complexData.pdbx_struct_assembly_gen; - - if (!asmGen) { - return; - } - - var asmIdx = arrize(asmGen.assembly_id); - var asmOper = arrize(asmGen.oper_expression); - var asmList = arrize(asmGen.asym_id_list); - - if (!asmIdx || !asmOper || !asmList) { - return; - } - - var operList = _getOperations(complexData.pdbx_struct_oper_list); - - if (!operList) { - return; - } - - for (var i = 0, n = asmIdx.length; i < n; ++i) { - var asm = new Assembly$3(complex); - - var assemblyOps = _extractOperations(asmOper[i], operList); - - var entries = asmList[i].split(','); - - for (var ii = 0, nn = entries.length; ii < nn; ++ii) { - var chain = entries[ii].trim(); - - if (chain.length > 0) { - asm.addChain(asymDict[chain]); - } - } - - asm.matrices = assemblyOps; - complex.units.push(asm); - } - } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && /^\s*data_/i.test(data); - } - }]); - - return CIFParser; - }(Parser); - - CIFParser.formats = ['cif', 'mmcif']; - CIFParser.extensions = ['.cif', '.mmcif']; - - var valueType = { - singular: 0, - vector: 1, - array: 2, - buffer: 3 - }; - - var VolumeModel = /*#__PURE__*/function () { - function VolumeModel() { - classCallCheck(this, VolumeModel); - - defineProperty(this, "_xyz2crs", []); - - defineProperty(this, "_origin", new THREE.Vector3(0, 0, 0)); - - this._header = {}; - this._boxSize = new THREE.Vector3(); - this._boxStart = new THREE.Vector3(); - this._header.delta = {}; - this._header.extent = []; - this._header.nstart = []; - this._header.grid = []; - this._header.crs2xyz = []; - this._header.cellDims = new THREE.Vector3(); - this._header.angles = []; - this._header.origin = new THREE.Vector3(0, 0, 0); - this._header.dmin = 0; - this._header.dmean = 0; - this._header.dmax = 0; - } - - createClass(VolumeModel, [{ - key: "_typedCheck", - value: function _typedCheck() { - if (_.isTypedArray(this._buff)) { - this._buff = this._buff.buffer; - } else if (!_.isArrayBuffer(this._buff)) { - throw new TypeError('Expected ArrayBuffer or TypedArray'); - } - } - }, { - key: "_fillHeader", - value: function _fillHeader(headerFormat, arrays) { - for (var key in headerFormat) { - if (headerFormat.hasOwnProperty(key)) { - switch (headerFormat[key][0]) { - case valueType.singular: - this._header[key] = arrays[headerFormat[key][1]][headerFormat[key][2]]; - break; - - case valueType.array: - this._parseArray(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]); - - break; - - case valueType.vector: - this._parseVector(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]); - - break; - - case valueType.buffer: - this._header[key] = new Uint8Array(arrays[headerFormat[key][1]], [headerFormat[key][2]] * 4, [headerFormat[key][3]] * 4); - break; - } - } - } - } - }, { - key: "_parseVector", - value: function _parseVector(vector, arr, pos) { - var _ref = [arr[pos], arr[pos + 1], arr[pos + 2]]; - vector.x = _ref[0]; - vector.y = _ref[1]; - vector.z = _ref[2]; - } - }, { - key: "_parseArray", - value: function _parseArray(vector, arr, pos) { - vector[0] = arr[pos]; - vector[1] = arr[pos + 1]; - vector[2] = arr[pos + 2]; - } - }, { - key: "_parseHeader", - value: function _parseHeader(_buffer) {} - }, { - key: "_setAxisIndices", - value: function _setAxisIndices() {} - }, { - key: "_setOrigins", - value: function _setOrigins() {} - }, { - key: "_getAxis", - value: function _getAxis() { - var header = this._header; - var xScale = header.cellDims.x / header.grid[0]; - var yScale = header.cellDims.y / header.grid[1]; - var zScale = header.cellDims.z / header.grid[2]; - - var _header$angles = slicedToArray(header.angles, 3), - alpha = _header$angles[0], - beta = _header$angles[1], - gamma = _header$angles[2]; - - var z1 = Math.cos(beta); - var z2 = (Math.cos(alpha) - Math.cos(beta) * Math.cos(gamma)) / Math.sin(gamma); - var z3 = Math.sqrt(1.0 - z1 * z1 - z2 * z2); - var xaxis = new THREE.Vector3(xScale, 0, 0); - var yaxis = new THREE.Vector3(Math.cos(gamma) * yScale, Math.sin(gamma) * yScale, 0); - var zaxis = new THREE.Vector3(z1 * zScale, z2 * zScale, z3 * zScale); - return [xaxis, yaxis, zaxis]; - } - }, { - key: "_getXYZdim", - value: function _getXYZdim() { - return [this._header.extent[this._xyz2crs[0]], this._header.extent[this._xyz2crs[1]], this._header.extent[this._xyz2crs[2]]]; - } - }, { - key: "_getVolumeInfo", - value: function _getVolumeInfo() { - var volInfo = _.pick(this._header, ['dmean', 'dmin', 'dmax', 'sd', 'delta']); - - volInfo.obtuseAngle = this._header.angles.map(function (angle) { - return Number(angle >= Math.PI / 2); - }); - return volInfo; - } - }, { - key: "_setBoxParams", - value: function _setBoxParams(xaxis, yaxis, zaxis) { - var _this = this; - - // if axes are not orthogonal, the origins might not match with box coordinates - need to make shift - var shiftX = 0; - var shiftY = 0; - - var _this$_header$angles = slicedToArray(this._header.angles, 3), - alpha = _this$_header$angles[0], - beta = _this$_header$angles[1], - gamma = _this$_header$angles[2]; - - if (gamma >= Math.PI / 2) { - shiftX += Math.abs(yaxis.x); - } - - if (beta >= Math.PI / 2) { - shiftX += Math.abs(zaxis.x); - } - - if (alpha >= Math.PI / 2) { - shiftY += Math.abs(zaxis.y); - } - - this._boxStart = new THREE.Vector3(this._origin.x - shiftX, this._origin.y - shiftY, this._origin.z); - this._boxSize = new THREE.Vector3(Math.abs(xaxis.x) + Math.abs(yaxis.x) + Math.abs(zaxis.x), Math.abs(yaxis.y) + Math.abs(zaxis.y), Math.abs(zaxis.z)); - - var delta = function delta(axe, proj) { - return Math.abs(axe[proj]) / _this._boxSize[proj]; - }; - - this._header.delta.x = delta(yaxis, 'x'); - this._header.delta.y = delta(zaxis, 'x'); - this._header.delta.z = delta(zaxis, 'y'); - } - }, { - key: "_getXYZbox", - value: function _getXYZbox() { - return new THREE.Box3(this._boxStart.clone(), this._boxStart.clone().add(this._boxSize)); - } - }, { - key: "_toXYZData", - value: function _toXYZData() {} - }, { - key: "parse", - value: function parse(data) { - this._parseHeader(data); - - this._setOrigins(); - - return new Volume(Float32Array, this._getXYZdim(), this._getXYZbox(), 1, this._toXYZData(), this._getVolumeInfo()); - } - }]); - - return VolumeModel; - }(); - - var CCP4Header = { - extent: [valueType.array, 'u32', 0], - type: [valueType.singular, 'u32', 3], - nstart: [valueType.array, 'i32', 4], - grid: [valueType.array, 'u32', 7], - cellDims: [valueType.vector, 'f32', 10], - angles: [valueType.array, 'f32', 13], - crs2xyz: [valueType.array, 'i32', 16], - dmin: [valueType.singular, 'f32', 19], - dmax: [valueType.singular, 'f32', 20], - dmean: [valueType.singular, 'f32', 21], - ispg: [valueType.singular, 'u32', 22], - nsymbt: [valueType.singular, 'u32', 23], - lksflg: [valueType.singular, 'u32', 24], - customData: [valueType.buffer, 'buffer', 25, 9], - origin: [valueType.vector, 'f32', 34], - map: [valueType.buffer, 'buffer', 52, 1], - machine: [valueType.singular, 'u32', 53], - sd: [valueType.singular, 'f32', 54], - nlabel: [valueType.singular, 'f32', 55], - label: [valueType.buffer, 'buffer', 56, 200] - }; - - var Ccp4Model = /*#__PURE__*/function (_VolumeModel) { - inherits(Ccp4Model, _VolumeModel); - - function Ccp4Model() { - classCallCheck(this, Ccp4Model); - - return possibleConstructorReturn(this, getPrototypeOf(Ccp4Model).apply(this, arguments)); - } - - createClass(Ccp4Model, [{ - key: "_parseHeader", - // read header (http://www.ccp4.ac.uk/html/maplib.html) - value: function _parseHeader(_buffer) { - this._buff = _buffer; - - this._typedCheck(); - - var arrays = {}; - arrays.u32 = new Uint32Array(this._buff, 0, 56); - arrays.i32 = new Int32Array(this._buff, 0, 56); - arrays.f32 = new Float32Array(this._buff, 0, 56); - arrays.buffer = this._buff; - var header = this._header; - - this._fillHeader(CCP4Header, arrays); // calculate non-orthogonal unit cell coordinates - - - header.angles.forEach(function (angle, i, a) { - a[i] *= Math.PI / 180.0; - }); - } - }, { - key: "_setAxisIndices", - value: function _setAxisIndices() { - var header = this._header; - - if (header.cellDims.x === 0.0 && header.cellDims.y === 0.0 && header.cellDims.z === 0.0) { - header.cellDims.set(1.0, 1.0, 1.0); - } // Apply header conversion - // Mapping between CCP4 column, row, section and VMD x, y, z. - - - var crs2xyz = this._header.crs2xyz; - - if (crs2xyz[0] === 0 && crs2xyz[1] === 0 && crs2xyz[2] === 0) { - crs2xyz[0] = 1; - crs2xyz[1] = 2; - crs2xyz[2] = 3; - } - - var xyz2crs = this._xyz2crs; - xyz2crs[crs2xyz[0] - 1] = 0; // column - - xyz2crs[crs2xyz[1] - 1] = 1; // row - - xyz2crs[crs2xyz[2] - 1] = 2; // section - } - }, { - key: "_setOrigins", - value: function _setOrigins() { - var _this$_getAxis = this._getAxis(), - _this$_getAxis2 = slicedToArray(_this$_getAxis, 3), - xaxis = _this$_getAxis2[0], - yaxis = _this$_getAxis2[1], - zaxis = _this$_getAxis2[2]; - - this._setAxisIndices(); - - var header = this._header; - var xyz2crs = this._xyz2crs; // Handle both MRC-2000 and older format maps - - if (header.origin.x === 0.0 && header.origin.y === 0.0 && header.origin.z === 0.0) { - this._origin.addScaledVector(xaxis, header.nstart[xyz2crs[0]]); - - this._origin.addScaledVector(yaxis, header.nstart[xyz2crs[1]]); - - this._origin.addScaledVector(zaxis, header.nstart[xyz2crs[2]]); - } else { - this._origin = header.origin; // Use ORIGIN records rather than old n[xyz]start records - // http://www2.mrc-lmb.cam.ac.uk/image2000.html - // XXX the ORIGIN field is only used by the EM community, and - // has undefined meaning for non-orthogonal maps and/or non-cubic voxels, etc. - } - - xaxis.multiplyScalar(header.extent[xyz2crs[0]] - 1); - yaxis.multiplyScalar(header.extent[xyz2crs[1]] - 1); - zaxis.multiplyScalar(header.extent[xyz2crs[2]] - 1); - - if (header.type === 2) { - this._data = new Float32Array(this._buff, 1024 + header.nsymbt, header.extent[0] * header.extent[1] * header.extent[2]); - } else { - throw new Error("CCP4: Unsupported format ".concat(header.type)); - } - - this._setBoxParams(xaxis, yaxis, zaxis); - } - }, { - key: "_toXYZData", - value: function _toXYZData() { - var header = this._header; - var data = this._data; - var xyz2crs = this._xyz2crs; - var xyzData = new Float32Array(data.length); - - var dim = this._getXYZdim(); - - var xSize = dim[0]; - var ySize = dim[1]; - var crsIdx = 0; - var coord = []; - var x; - var y; - var z; - - for (coord[2] = 0; coord[2] < header.extent[2]; coord[2]++) { - // Site - for (coord[1] = 0; coord[1] < header.extent[1]; coord[1]++) { - // Row - for (coord[0] = 0; coord[0] < header.extent[0]; coord[0]++, crsIdx++) { - // Column - x = coord[xyz2crs[0]]; - y = coord[xyz2crs[1]]; - z = coord[xyz2crs[2]]; - xyzData[x + xSize * (y + ySize * z)] = data[crsIdx]; - } - } - } - - return xyzData; - } - }]); - - return Ccp4Model; - }(VolumeModel); - - var CCP4Parser = /*#__PURE__*/function (_Parser) { - inherits(CCP4Parser, _Parser); - - function CCP4Parser(data, options) { - var _this; - - classCallCheck(this, CCP4Parser); - - _this = possibleConstructorReturn(this, getPrototypeOf(CCP4Parser).call(this, data, options)); - _this._options.fileType = 'ccp4'; - _this.model = new Ccp4Model(); - return _this; - } - - createClass(CCP4Parser, [{ - key: "parseSync", - value: function parseSync() { - return this.model.parse(this._data); - } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(_data) { - return false; // Autodetection is not implemented yet - } - }]); - - return CCP4Parser; - }(Parser); - - CCP4Parser.formats = ['ccp4']; - CCP4Parser.extensions = ['.ccp4', '.map', '.mrc']; - CCP4Parser.binary = true; - - var Complex$5 = chem.Complex, - Element$6 = chem.Element, - Molecule$4 = chem.Molecule; - - var XYZParser = /*#__PURE__*/function (_Parser) { - inherits(XYZParser, _Parser); - - function XYZParser(data, options) { - var _this; - - classCallCheck(this, XYZParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(XYZParser).call(this, data, options)); - _this._complex = null; - _this._atomsInf = null; - _this._options.fileType = 'xyz'; - _this._fileName = options.name; - return _this; - } - - createClass(XYZParser, [{ - key: "_parseToAtomsInf", - value: function _parseToAtomsInf(source) { - var endnAtoms = source.indexOf('\n'); - var nAtoms = parseInt(source.substring(0, endnAtoms), 10); - var endComment = source.indexOf('\n', endnAtoms + 1); - var comment = source.slice(endnAtoms + 1, endComment).trim(); - - if (comment.length === 0) { - comment = this._fileName; - } - - var startAtomsInf = endComment + source.substring(endComment).search(/\S/); - this._atomsInf = source.substring(startAtomsInf).split(/[\s,]*\n[\s,]*/); - - if (!Number.isNaN(nAtoms) && this._atomsInf.length - 1 !== nAtoms) { - this._complex.error = { - message: 'wrong number of atoms' - }; - return; - } - - this._complex.metadata.format = 'xyz'; - this._complex.name = comment; - } - }, { - key: "_parseAtomsInf", - value: function _parseAtomsInf() { - var het = true; - var altLoc = ' '; - var occupancy = 1; - var tempFactor = 1; - var charge = 0; - - var chain = this._complex.addChain('A'); - - var residue = chain.addResidue('UNK', 1, ' '); - - for (var i = 0; i < this._atomsInf.length - 1; i++) { - var words = this._atomsInf[i].split(/[\s,]+/); - - if (words.length !== 4) { - this._complex.error = { - message: 'missed parameters' - }; - break; - } - - var serial = i + 1; - var name = words[0]; - var xyz = new THREE.Vector3(parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3])); - var type = Element$6.getByName(name); - var role = undefined; - residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); - } - - var molecule = new Molecule$4(this._complex, this._complex.name, 1); - molecule.residues = residue; - this._complex._molecules[0] = molecule; - } - }, { - key: "parseSync", - value: function parseSync() { - var result = this._complex = new Complex$5(); - - this._parseToAtomsInf(this._data); - - this._parseAtomsInf(); - - this._complex.finalize({ - needAutoBonding: true, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - - this._complex = null; - this._atomsInf = null; - - if (result.error) { - throw new Error(result.error.message); - } - - return result; - } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && /^\s*\d+ *\n[^\n]*\n\s*\w{1,3}\s+-?\d/.test(data); - } - }]); - - return XYZParser; - }(Parser); - - defineProperty(XYZParser, "formats", ['xyz']); - - defineProperty(XYZParser, "extensions", ['.xyz']); - - var Complex$6 = chem.Complex, - Element$7 = chem.Element; - - var PubChemParser = /*#__PURE__*/function (_Parser) { - inherits(PubChemParser, _Parser); - - function PubChemParser(data, options) { - var _this; - - classCallCheck(this, PubChemParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(PubChemParser).call(this, data, options)); - _this._options.fileType = 'pubchem+json'; - return _this; - } - - createClass(PubChemParser, [{ - key: "parseSync", - value: function parseSync() { - this.logger.info('Parsing PubChem JSON file...'); - return this._toComplex(JSON.parse(this._data)); - } - }, { - key: "_toComplex", - value: function _toComplex(jsonData) { - var complex = new Complex$6(); - var complexData = jsonData.PC_Compounds && jsonData.PC_Compounds[0]; - - if (complexData) { - this._extractAtoms(complex, complexData); - - complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing - }); - } - - return complex; - } - }, { - key: "_extractAtoms", - value: function _extractAtoms(complex, complexData) { - var aids = complexData.atoms && complexData.atoms.aid; - var elements = aids && complexData.atoms.element; - - if (!elements || aids.length !== elements.length) { - throw new Error('Unable to parse atom elements'); - } - - elements = _.fromPairs(_.zip(aids, elements)); - var atoms = {}; - var coords = complexData.coords && complexData.coords[0]; - var model = coords && coords.conformers && coords.conformers[0]; - var xs = model && model.x; - var ys = model && model.y; - var zs = model && model.z || []; - aids = coords && coords.aid; - - if (!aids || !xs || !ys) { - throw new Error('Coordinates are not found in the file'); - } - - var chain = complex.addChain(' '); - var residue = chain.addResidue('UNK', 1, ' '); - - for (var i = 0, n = aids.length; i < n; ++i) { - var aid = aids[i]; - var element = Element$7.ByAtomicNumber[elements[aid]]; - var xyz = new THREE.Vector3(xs[i], ys[i], zs[i] || 0.0); - atoms[aid] = residue.addAtom(element.name, element, xyz, undefined, true, aid, ' ', 1.0, 0.0, 0); - } - - var aids1 = complexData.bonds && complexData.bonds.aid1; - var aids2 = complexData.bonds && complexData.bonds.aid2; - var orders = complexData.bonds && complexData.bonds.order || []; - - if (!aids1 || !aids2 || aids1.length !== aids2.length) { - return; - } - - for (var j = 0, m = aids1.length; j < m; ++j) { - complex.addBond(atoms[aids1[j]], atoms[aids2[j]], orders[j] || 1, 0, true); - } - } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && data[0] === '{'; - } - }]); - - return PubChemParser; - }(Parser); - - PubChemParser.formats = ['pubchem', 'pubchem+json', 'pc']; - PubChemParser.extensions = ['.json']; - - var SDFStream = /*#__PURE__*/function () { - function SDFStream(data) { - classCallCheck(this, SDFStream); - - this._strings = data.split(/\r?\n|\r/); - this._currentStart = 0; - this._currentStringIndx = 0; - } - - createClass(SDFStream, [{ - key: "setStart", - value: function setStart(start) { - if (start >= this._strings.length) { - this._currentStart = this._strings.length - 1; - this._currentStringIndx = this._strings.length - 1; - } else { - this._currentStart = start; - this._currentStringIndx = start; - } - } - }, { - key: "getNextString", - value: function getNextString() { - return this._strings[++this._currentStringIndx]; - } - }, { - key: "getCurrentString", - value: function getCurrentString() { - return this._strings[this._currentStringIndx]; - } - }, { - key: "getStringFromStart", - value: function getStringFromStart(numb) { - this._currentStringIndx = this._currentStart + numb; - return this._strings[this._currentStart + numb]; - } - }, { - key: "findNextDataItem", - value: function findNextDataItem() { - var curStr = this.getNextString(); - var res = false; - - while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') { - if (curStr.match(/>\s+<(.*)>/)) { - res = true; - break; - } - - curStr = this.getNextString(); - } - - return res; - } - }, { - key: "findNextCompoundStart", - value: function findNextCompoundStart() { - var curStr = this.getCurrentString(); - - while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') { - curStr = this.getNextString(); - } - - this.setStart(++this._currentStringIndx); - return this.probablyHaveDataToParse(); - } - }, { - key: "probablyHaveDataToParse", - value: function probablyHaveDataToParse() { - return this._currentStringIndx < this._strings.length - 2; - } - }]); - - return SDFStream; - }(); - - var Complex$7 = chem.Complex, - Element$8 = chem.Element, - Bond$4 = chem.Bond, - Molecule$5 = chem.Molecule; - var chargeMap = [0, 3, 2, 1, 0, -1, -2, -3]; - var orderMap = [0, 1, 2, 3, 1, 1, 1, 2]; - var typeMap = [Bond$4.BondType.UNKNOWN, // 0 - error - Bond$4.BondType.COVALENT, // 1 - single - Bond$4.BondType.COVALENT, // 2 - double - Bond$4.BondType.COVALENT, // 3 - triple - Bond$4.BondType.AROMATIC, // 4 - aromatic - Bond$4.BondType.UNKNOWN, // 5 - single or double - Bond$4.BondType.AROMATIC, // 6 - single or aromatic - Bond$4.BondType.AROMATIC // 7 - double or aromatic - // 8 - any - // 9 - coordination - // 10 - hydrogen - ]; - var sdfAndMolRegexp = /.*(M\s\sEND).*|.*(^$$$$).*|.*>\s+<(.+)>.*/; - var sdfRegExp = /.*($$$$).*|.*>\s+<(.+)>.*/; - var fileFormat = { - SDF: 'sdf', - MOL: 'mol' - }; - var possibleNameTags = ['PUBCHEM_IUPAC_TRADITIONAL_NAME', /PUBCHEM_(.+)_NAME/, /(.+)name/, /(.+)NAME/]; - var possibleIDTags = ['PUBCHEM_COMPOUND_CID', 'id', 'ID', /.*CID/, /.*ID/, /.*id/]; - var possibleTitleTags = ['msg', 'MSG', 'message', 'title', 'description', 'desc']; - var tagsNames = ['name', 'id', 'title']; - var tags = { - name: possibleNameTags, - id: possibleIDTags, - title: possibleTitleTags - }; - - function buildChainID(index) { - if (!index) { - return 'A'; - } - - var codes = []; - - while (index) { - codes.push(65 + index % 26); - index = Math.trunc(index / 26); - } - - if (codes.length > 1) { - codes.reverse(); - codes[0] -= 1; - } - - return String.fromCharCode.apply(String, codes); - } - - var SDFParser = /*#__PURE__*/function (_Parser) { - inherits(SDFParser, _Parser); - - function SDFParser(data, options) { - var _this; - - classCallCheck(this, SDFParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(SDFParser).call(this, data, options)); - _this._format = 'sdf'; - _this._complex = null; - _this._chain = null; - _this._residue = null; - _this._molecules = null; - _this._metadata = {}; - _this._metadata.molecules = []; - _this._currentMolProps = {}; - _this._compoundIndx = -1; - _this._assemblies = []; - _this._atomsParsed = 0; - _this._atomsIndexes = []; - return _this; - } - - createClass(SDFParser, [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && sdfAndMolRegexp.test(data); - } - }, { - key: "_parseHeader", - value: function _parseHeader(stream) { - var molecule = {}; - molecule.name = stream.getStringFromStart(0); - var date = parseInt(stream.getStringFromStart(1).substr(10, 6).trim(), 10); - molecule.date = date.toString() || ''; - molecule.title = stream.getStringFromStart(2); - - this._metadata.molecules.push(molecule); - } - }, { - key: "_parseAtoms", - value: function _parseAtoms(stream, atomsNum) { - var curStr; - var serial = this._atomsParsed; // each molecule = chain\residue - - var chainID = buildChainID(this._compoundIndx); - var resName = 'UNK'; - var resSeq = 1; - this._chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); - this._residue = this._chain.addResidue(resName, resSeq, ' '); - - for (var i = 0; i < atomsNum; i++) { - curStr = stream.getNextString(); - serial++; - var x = parseFloat(curStr.substr(0, 10)); - var y = parseFloat(curStr.substr(10, 10)); - var z = parseFloat(curStr.substr(20, 10)); - var charge = chargeMap[parseInt(curStr.substr(36, 3), 10)]; - var xyz = new THREE.Vector3(x, y, z); - var name = curStr.substr(31, 3).trim().toUpperCase(); - var type = Element$8.getByName(name); - - if (!this._atomsIndexes[name]) { - this._atomsIndexes[name] = 0; - } - - this._atomsIndexes[name] += 1; - name += this._atomsIndexes[name]; // every atom need to have unique name. - - this._residue.addAtom(name, type, xyz, undefined, true, serial, ' ', 1.0, 0.0, charge); - } - } - }, { - key: "_parseBonds", - value: function _parseBonds(stream, bondsNum) { - var curStr; - - for (var i = 0; i < bondsNum; i++) { - curStr = stream.getNextString(); - - var atom1 = parseInt(curStr.substr(0, 3), 10) + this._atomsParsed; - - var atom2 = parseInt(curStr.substr(3, 3), 10) + this._atomsParsed; - - var bondType = parseInt(curStr.substr(6, 3), 10); - - if (atom1 > atom2) { - var _ref = [atom2, atom1]; - atom1 = _ref[0]; - atom2 = _ref[1]; - } - - this._complex.addBond(atom1, atom2, orderMap[bondType] || 1, typeMap[bondType] || Bond$4.BondType.UNKNOWN, true); - } - } - }, { - key: "_parseMOL", - value: function _parseMOL(stream) { - this._compoundIndx++; - - this._parseHeader(stream); - - var countsLine = stream.getStringFromStart(3); - var atomsNum = parseInt(countsLine.substr(0, 3), 10); - var bondsNum = parseInt(countsLine.substr(3, 3), 10); - - this._parseAtoms(stream, atomsNum); - - this._parseBonds(stream, bondsNum); - - this._atomsParsed += atomsNum; - this._metadata.molecules[this._compoundIndx]._residues = []; - - this._metadata.molecules[this._compoundIndx]._residues.push(this._residue); - } - }, { - key: "_parseDataItem", - value: function _parseDataItem(stream) { - var tag = stream.getCurrentString(); - var data = []; - var curStr = stream.getNextString(); // read data - - while (curStr.trim() !== '') { - data.push(curStr); - curStr = stream.getNextString(); - } - - if (data.length === 1) { - var _data = data; - - var _data2 = slicedToArray(_data, 1); - - data = _data2[0]; - } - - this._currentMolProps[tag.replace(/[<>]/g, '').trim()] = data; - } - }, { - key: "_parseCompound", - value: function _parseCompound(stream) { - this._parseMOL(stream); // parse data items block - - - if (this._format === fileFormat.SDF) { - this._currentMolProps = {}; - - while (stream.findNextDataItem()) { - this._parseDataItem(stream); - } - - if (Object.keys(this._currentMolProps).length !== 0) { - var molecule = this._metadata.molecules[this._compoundIndx]; - molecule.props = this._currentMolProps; - - this._tryToUpdateMoleculeData(molecule); - } - } - } - }, { - key: "_fixBondsArray", - value: function _fixBondsArray() { - var serialAtomMap = this._serialAtomMap; - var complex = this._complex; - var bonds = complex._bonds; - - for (var j = 0; j < bonds.length; j++) { - var bond = bonds[j]; - - if (bond._right < bond._left) { - console.log('_fixBondsArray: Logic error.'); - } - - bond._left = serialAtomMap[bond._left] || null; - bond._right = serialAtomMap[bond._right] || null; - } - } - }, { - key: "_buildAssemblies", - value: function _buildAssemblies() { - var chains = this._complex._chains; - - if (chains.length === 1) { - return this._assemblies; - } - - for (var i = 0; i < chains.length; i++) { - var assembly = new Assembly(this._complex); - var matrix = new THREE.Matrix4(); - assembly.addMatrix(matrix); - assembly.addChain(chains[i]._name); - - this._assemblies.push(assembly); - } - - return this._assemblies; - } - }, { - key: "_buildMolecules", - value: function _buildMolecules() { - this._complex._molecules = []; - var molecules = this._metadata.molecules; - - for (var i = 0; i < molecules.length; i++) { - var molecule = new Molecule$5(this._complex, molecules[i].name, i + 1); - molecule.residues = molecules[i]._residues; - this._complex._molecules[i] = molecule; - } - - return this._complex._molecules; - } - }, { - key: "_searchTag", - value: function _searchTag(tag, props) { - for (var i = 0; i < props.length; i++) { - if (tag instanceof RegExp && tag.test(props[i].tag) || tag === props[i].tag) { - return props[i].data; - } - } - - return undefined; - } - }, { - key: "_tryToFind", - value: function _tryToFind(tagsList, props) { - for (var j = 0; j < tagsList.length; j++) { - var res = this._searchTag(tagsList[j], props); - - if (res) { - return res; - } - } - - return undefined; - } - }, { - key: "_tryToUpdateMoleculeData", - value: function _tryToUpdateMoleculeData(molecule) { - var res = false; - - for (var i = 0; i < tagsNames.length; i++) { - var tagPossibleNames = tags[tagsNames[i]]; - - var data = this._tryToFind(tagPossibleNames, molecule.props); - - if (data) { - molecule[tagsNames[i]] = data; - res = true; - } - } - - molecule.name = molecule.name || molecule.id; - - if (molecule.name.match(/^\d+$/)) { - molecule.name = "CID: ".concat(molecule.name); - } - - return res; - } - }, { - key: "_finalizeMetadata", - value: function _finalizeMetadata() { - var molecules = this._metadata.molecules; - var metadata = this._complex.metadata; - var complex = this._complex; - - if (molecules.length === 1) { - complex.name = molecules[0].name; - metadata.title = molecules[0].title; - metadata.date = molecules[0].date; - metadata.properties = molecules[0].props; - } else if (molecules.length > 1) { - metadata.molecules = []; - - for (var i = 0; i < molecules.length; i++) { - metadata.molecules.push({ - name: molecules[i].name, - date: molecules[i].date, - title: molecules[i].title, - properties: molecules[i].props - }); - } - } - } - }, { - key: "_finalize", - value: function _finalize() { - var serialAtomMap = this._serialAtomMap = {}; - var atoms = this._complex._atoms; - - for (var i = 0; i < atoms.length; i++) { - var atom = atoms[i]; - serialAtomMap[atom.serial] = atom; - } - - this._complex._finalizeBonds(); - - this._fixBondsArray(); - - this._finalizeMetadata(); - - this._buildAssemblies(); - - this._complex.units = this._complex.units.concat(this._assemblies); - - this._buildMolecules(); - - this._complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: false, - enableEditing: false, - serialAtomMap: this._serialAtomMap - }); - } - }, { - key: "defineFormat", - value: function defineFormat(data) { - var format; - - if (sdfRegExp.test(data)) { - format = fileFormat.SDF; - } else { - format = fileFormat.MOL; - } - - return format; - } - }, { - key: "parseSync", - value: function parseSync() { - var result = this._complex = new Complex$7(); - var stream = new SDFStream(this._data); - this._format = this.defineFormat(this._data); - result.metadata.format = this._format; - - do { - this._parseCompound(stream); - } while (stream.findNextCompoundStart()); - - this._finalize(); - - return result; - } - }]); - - return SDFParser; - }(Parser); - SDFParser.formats = ['mol', 'sdf']; - SDFParser.extensions = ['.mol', '.sdf']; - - var DSN6Header = { - nstart: [valueType.array, 'i16', 0], - extent: [valueType.array, 'i16', 3], - grid: [valueType.array, 'i16', 6], - cellDims: [valueType.vector, 'i16', 9], - angles: [valueType.array, 'i16', 12], - div: [valueType.singular, 'i16', 15], - adder: [valueType.singular, 'i16', 16], - scaleFactor: [valueType.singular, 'i16', 17] - }; - - var DSN6Model = /*#__PURE__*/function (_VolumeModel) { - inherits(DSN6Model, _VolumeModel); - - function DSN6Model() { - classCallCheck(this, DSN6Model); - - return possibleConstructorReturn(this, getPrototypeOf(DSN6Model).apply(this, arguments)); - } - - createClass(DSN6Model, [{ - key: "_parseHeader", - value: function _parseHeader(_buffer) { - this._buff = _buffer; - - this._typedCheck(); - - var arrays = {}; - arrays.i16 = new Int16Array(this._buff); // check and reverse if big endian - - if (arrays.i16[18] !== 100) { - for (var i = 0, n = arrays.i16.length; i < n; ++i) { - var val = arrays.i16[i]; - arrays.i16[i] = (val & 0xff) << 8 | val >> 8 & 0xff; - } - } - - if (arrays.i16[18] !== 100) { - throw new Error('DSN6: Incorrect format '); - } - - var header = this._header; - - this._fillHeader(DSN6Header, arrays); - - header.cellDims.multiplyScalar(1.0 / header.scaleFactor); - header.angles.forEach(function (angle, i, a) { - a[i] *= Math.PI / 180.0 / header.scaleFactor; - }); - header.div /= 100; - } - }, { - key: "_setAxisIndices", - value: function _setAxisIndices() { - this._xyz2crs[0] = 0; - this._xyz2crs[1] = 1; - this._xyz2crs[2] = 2; - } - }, { - key: "_setOrigins", - value: function _setOrigins() { - var header = this._header; - - var _this$_getAxis = this._getAxis(), - _this$_getAxis2 = slicedToArray(_this$_getAxis, 3), - xaxis = _this$_getAxis2[0], - yaxis = _this$_getAxis2[1], - zaxis = _this$_getAxis2[2]; - - this._setAxisIndices(); - - this._origin.addScaledVector(xaxis, header.nstart[0]); - - this._origin.addScaledVector(yaxis, header.nstart[1]); - - this._origin.addScaledVector(zaxis, header.nstart[2]); - - xaxis.multiplyScalar(header.extent[0]); - yaxis.multiplyScalar(header.extent[1]); - zaxis.multiplyScalar(header.extent[2]); - - this._setBoxParams(xaxis, yaxis, zaxis); - } - }, { - key: "_pointCalculate", - value: function _pointCalculate(xyzData, byteBuffer, z, y, x, pos, i) { - var header = this._header; - - if (x < header.extent[0] && y < header.extent[1] && z < header.extent[2]) { - var idx = x + header.extent[0] * (y + header.extent[1] * z); - xyzData[idx] = (byteBuffer[pos.counter] - header.adder) / header.div; - ++pos.counter; - } else { - pos.counter += 8 - i; - return false; - } - - return true; - } - }, { - key: "_blockCalculate", - value: function _blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos) { - for (var k = 0; k < 8; ++k) { - var z = 8 * zBlock + k; - - for (var j = 0; j < 8; ++j) { - var y = 8 * yBlock + j; - var inRange = true; - var i = 0; - - while (inRange && i < 8) { - var x = 8 * xBlock + i; - inRange = this._pointCalculate(xyzData, byteBuffer, z, y, x, pos, i); - i++; - } - } - } - } - }, { - key: "_toXYZData", - value: function _toXYZData() { - var header = this._header; - var byteBuffer = new Uint8Array(this._buff); - var xyzData = new Float32Array(header.extent[0] * header.extent[1] * header.extent[2]); - var blocks = new THREE.Vector3(header.extent[0] / 8, header.extent[1] / 8, header.extent[2] / 8); - var pos = {}; - pos.counter = 512; - - for (var zBlock = 0; zBlock < blocks.z; ++zBlock) { - for (var yBlock = 0; yBlock < blocks.y; ++yBlock) { - for (var xBlock = 0; xBlock < blocks.x; ++xBlock) { - this._blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos); - } - } - } - - this._calculateInfoParams(xyzData); - - return xyzData; - } - }, { - key: "_calculateInfoParams", - value: function _calculateInfoParams(xyzData) { - this._header.dmean /= xyzData.length; - var dispersion = 0; - var minDensity = xyzData[0]; - var maxDensity = xyzData[0]; - - for (var j = 0; j < xyzData.length; j++) { - dispersion += Math.pow(this._header.dmean - xyzData[j], 2); - - if (xyzData[j] < minDensity) { - minDensity = xyzData[j]; - } - - if (xyzData[j] > maxDensity) { - maxDensity = xyzData[j]; - } - } - - this._header.sd = Math.sqrt(dispersion / xyzData.length); - this._header.dmax = maxDensity; - this._header.dmin = minDensity; - } - }]); - - return DSN6Model; - }(VolumeModel); - - var DSN6Parser = /*#__PURE__*/function (_Parser) { - inherits(DSN6Parser, _Parser); - - function DSN6Parser(data, options) { - var _this; - - classCallCheck(this, DSN6Parser); - - _this = possibleConstructorReturn(this, getPrototypeOf(DSN6Parser).call(this, data, options)); - _this._options.fileType = 'dsn6'; - _this.model = new DSN6Model(); - return _this; - } - - createClass(DSN6Parser, [{ - key: "parseSync", - value: function parseSync() { - return this.model.parse(this._data); - } - }], [{ - key: "canParse", - value: function canParse(data, options) { - if (!data) { - return false; - } - - return data instanceof ArrayBuffer && Parser.checkDataTypeOptions(options, 'dsn6'); - } - }, { - key: "canProbablyParse", - value: function canProbablyParse(_data) { - return false; - } - }]); - - return DSN6Parser; - }(Parser); - - DSN6Parser.formats = ['dsn6']; - DSN6Parser.extensions = ['.dsn6', '.omap']; - DSN6Parser.binary = true; - - /** - * Little helper class for GRO Parser usage. - * @extends PDBStream - */ - - var GROReader = /*#__PURE__*/function (_PDBStream) { - inherits(GROReader, _PDBStream); - - function GROReader(data) { - var _this; - - classCallCheck(this, GROReader); - - _this = possibleConstructorReturn(this, getPrototypeOf(GROReader).call(this, data)); - /** @type Number */ - - _this._next = -1; // End position of line - - _this.next(); - - return _this; - } - /** - * Getting end of string. - * @returns {Number} Pointer to end of string - */ - - - createClass(GROReader, [{ - key: "getNext", - value: function getNext() { - return this._next; - } - }]); - - return GROReader; - }(PDBStream); - - var Complex$8 = chem.Complex, - Element$9 = chem.Element, - Molecule$6 = chem.Molecule; - /** - * Gromos87 file format parser. - * @extends Parser - */ - - var GROParser = /*#__PURE__*/function (_Parser) { - inherits(GROParser, _Parser); - - /** - * Create parser for .gro file format - * - * @param {String} data Input file - * @param {String} options Input options (optional field) - */ - function GROParser(data, options) { - var _this; - - classCallCheck(this, GROParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(GROParser).call(this, data, options)); - /** @type Date */ - - _this._time = null; // Time in ps, optional field for animations - - /** @type Number */ - - _this._numAtoms = null; // Number of atoms in complex - - /** @type Number */ - - _this._residueNumber = null; // Number of exact residue - - /** @type String */ - - _this._residueName = ''; // Scientific name of exact residue - - /** @type String */ - - _this._atomName = ''; // Scientific name of exact atom - - /** @type Number */ - - _this._atomNumber = null; // Sorted number of exact atom - - /** @type Array */ - - _this._atomPosition = []; // Array which contains x, y, z position of exact atom - - /** @type Array */ - - _this._atomVelocity = []; // Array which contains x, y, z velocity of exact atom (optional) - - /** @type Complex */ - - _this._complex = null; // Complex structure for unified molecule representation - - /** @type Vector3 */ - - _this._molecules = []; // Molecules array - - /** @type Molecule */ - - _this._molecule = null; // Single molecule - - /** @type String */ - - _this._options.filetype = 'gro'; // Extension of data file. - - return _this; - } - /** - * General check for possibility of parsing. - * @param {String} data - Input file - * @returns {boolean} true if this file is in ascii, false otherwise - */ - - - createClass(GROParser, [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(this._data) && /^\s*[^\n]*\n\s*\d+ *\n\s*\d+[^\n\d]{3}\s*\w+\s*\d+\s*-?\d/.test(data); - } - /** - * Parsing title of molecule complex. - * NOTE: that names are ESTIMATES, there is no strict rules in Gromos87 standard for first line in input file. - * @param {GROReader} line - Line containing title and time. - */ - - }, { - key: "_parseTitle", - value: function _parseTitle(line) { - var metadata = this._complex.metadata; - metadata.id = line.readLine().trim(); - metadata.name = metadata.id.slice(metadata.id.lastIndexOf('\\') + 1, metadata.id.lastIndexOf('.')); - metadata.format = 'gro'; - } - /** - * Parsing line containing number of atoms information. - * @param {GROReader} line - Line containing number of atoms. - */ - - }, { - key: "_parseNumberOfAtoms", - value: function _parseNumberOfAtoms(line) { - this._numAtoms = line.readInt(0, line.getNext()); - - if (Number.isNaN(this._numAtoms)) { - throw new Error('Line 2 is not representing atom number. Consider checking input file'); - } - } - /** - * Parsing line containing information about residues, atoms etc. Also information about box vectors. - * Format of atoms MUST (by Gromos87 standard) be this: (note that numbering starts not from 0, but from 1!) - * ResidueNumber[1 - 5] ResidueName[6 - 10] AtomName[11 - 15] AtomNumber[16 - 20] Position[21 - 45] Velocity[46 - 69] - * @param {GROReader} line - Line containing information about atom. - */ - - }, { - key: "_parseAtom", - value: function _parseAtom(line) { - this._residueNumber = line.readInt(1, 5); - this._residueName = line.readString(6, 10).trim(); - this._atomName = line.readString(11, 15).trim(); - this._atomNumber = line.readInt(16, 20); - var positionX = line.readFloat(21, 28) * 10; - var positionY = line.readFloat(29, 36) * 10; - var positionZ = line.readFloat(37, 45) * 10; - - if (Number.isNaN(positionX) || Number.isNaN(positionY) || Number.isNaN(positionZ)) { - this._complex.error = { - message: "Atom position is invalid in \"".concat(line.readLine(), "\"") - }; - return; - } - /* const velocityX = line.readFloat(46, 53); - const velocityY = line.readFloat(54, 61); - const velocityZ = line.readFloat(62, 69); */ - - /* Adding residue and atom to complex structure */ - - - var type = Element$9.getByName(this._atomName[0]); - /* MAGIC 0. REASONS: This name is something like "CA", where - C - is an element an A is something else. But what about Calcium? */ - - if (type.fullName === 'Unknown') { - this._complex.error = { - message: "".concat(this._atomName[0], " hasn't been recognised as an atom name.") - }; - return; - } - - var role = Element$9.Role[this._atomName]; - /* Firstly, create a dummy chain */ - - var chain = this._chain; - - if (!chain) { - this._chain = chain = this._complex.addChain('A'); - } - /* Secondly, add residue to that chain */ - - - var residue = this._residue; - - if (!residue || residue.getSequence() !== this._residueNumber) { - this._residue = residue = chain.addResidue(this._residueName, this._residueNumber, ' '); - } - /* Lastly, add atom to that residue */ - - - this._atomPosition = new THREE.Vector3(positionX, positionY, positionZ); - /* Adding default constants to correct atom addition process */ - - var het = true; - var altLoc = ' '; - var occupancy = 1; - var tempFactor = 1; - var charge = 0; - residue.addAtom(this._atomName, type, this._atomPosition, role, het, this._atomNumber, altLoc, occupancy, tempFactor, charge); - } - /** - * Some finalizing procedures. In '.gro' file format there is only 1 chain and 1 molecule. - */ - - }, { - key: "_finalize", - value: function _finalize() { - var molecule = new Molecule$6(this._complex, this._complex.metadata.name, 1); // aggregate residues from chain - - molecule.residues = this._chain._residues; - molecule._chains = this._chain; - this._complex._molecules[0] = molecule; - - this._molecules.push(molecule); - - this._complex.finalize({ - needAutoBonding: true, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - } - /** - * Main parsing procedure. - * @returns {Complex} Complex structure for visualizing. - */ - - }, { - key: "parseSync", - value: function parseSync() { - /* Create "Complex" variable */ - var result = this._complex = new Complex$8(); - /* Parse input file line-by-line */ - - var reader = new GROReader(this._data); - var counter = 0; - /* Simple counter regarding to format of .gro file */ - - /* First two lines - technical information, other lines - Atoms */ - - this._parseTitle(reader); - - reader.next(); - - this._parseNumberOfAtoms(reader); - - reader.next(); - - for (counter = 0; counter < this._numAtoms; ++counter) { - if (!reader.end()) { - this._parseAtom(reader); - - reader.next(); - } else break; - } - /* If number of atoms in second line is less then actual atoms in file */ - - - if (counter < this._numAtoms) { - this._complex.error = { - message: 'File ended unexpectedly.' - }; - } - /* Catch errors occurred in parsing process */ - - - if (result.error) { - throw new Error(result.error.message); - } - /* Finalizing data */ - - - this._finalize(); - /* Cleaning up */ - - - this._atomPosition = null; - this._complex = null; - this._molecules = null; - this._molecule = null; - /* Return resulting Complex variable */ - - return result; - } - }]); - - return GROParser; - }(Parser); - - GROParser.formats = ['gro']; - GROParser.extensions = ['.gro']; - - var Complex$9 = chem.Complex, - Element$a = chem.Element, - Bond$5 = chem.Bond, - Molecule$7 = chem.Molecule; - var orderMap$1 = { - un: 0, - 1: 1, - 2: 2, - 3: 3, - ar: 1, - am: 1, - nc: 0, - du: 1 - }; - var typeMap$1 = { - un: Bond$5.BondType.UNKNOWN, - // unknown (cannot be determined from the parameter tables) - 1: Bond$5.BondType.COVALENT, - // single - 2: Bond$5.BondType.COVALENT, - // double - 3: Bond$5.BondType.COVALENT, - // triple - ar: Bond$5.BondType.AROMATIC, - // aromatic - am: Bond$5.BondType.COVALENT, - // amide - nc: Bond$5.BondType.UNKNOWN, - // not connected - du: Bond$5.BondType.COVALENT // dummy - - }; - var resNumberRegex = /\d+$/; - var spacesRegex = /\s+/; - - function splitToFields(str) { - return str.trim().split(spacesRegex); - } - /* There is no jsdoc documentation because of eslint corrections: - * not all Parser methods are implemented - */ - - - var MOL2Parser = /*#__PURE__*/function (_Parser) { - inherits(MOL2Parser, _Parser); - - function MOL2Parser(data, options) { - var _this; - - classCallCheck(this, MOL2Parser); - - _this = possibleConstructorReturn(this, getPrototypeOf(MOL2Parser).call(this, data, options)); - _this._complex = null; - _this._chain = null; - _this._residue = null; - _this._compoundIndx = -1; - _this._molecules = []; - _this._molecule = null; - _this._currPosIdx = 0; - _this._currStartIdx = 0; - _this._serialAtomMap = {}; - _this._options.fileType = 'mol2'; - return _this; - } - - createClass(MOL2Parser, [{ - key: "_parseRawStrings", - value: function _parseRawStrings(data) { - return data.split(/\r?\n|\r/); - } - }, { - key: "_toStringFromStart", - value: function _toStringFromStart(numb, MOL2Data) { - var newPosIdx = this._currStartIdx + numb; - this._currPosIdx = newPosIdx < MOL2Data.length ? newPosIdx : this._currStartIdx; - } - }, { - key: "_toHeaderString", - value: function _toHeaderString(header, MOL2Data) { - this._toStringFromStart(0, MOL2Data); - - while (this._currPosIdx < MOL2Data.length) { - if (MOL2Data[this._currPosIdx].match("@".concat(header))) { - return; - } - - this._currPosIdx++; - } - - this._toStringFromStart(0, MOL2Data); - } - }, { - key: "_toStringFromHeader", - value: function _toStringFromHeader(header, numb, MOL2Data) { - this._toHeaderString(header, MOL2Data); - - var newPosIdx = this._currPosIdx + numb; - - if (MOL2Data[this._currPosIdx].match("@".concat(header)) && newPosIdx < MOL2Data.length) { - this._currPosIdx = newPosIdx; - } - } - }, { - key: "_setStart", - value: function _setStart(startPos, MOL2Data) { - if (startPos >= MOL2Data.length) { - this._currStartIdx = this._currPosIdx = MOL2Data.length - 1; - } else { - this._currStartIdx = this._currPosIdx = startPos; - } - } - }, { - key: "_probablyHaveDataToParse", - value: function _probablyHaveDataToParse(MOL2Data) { - return this._currPosIdx < MOL2Data.length - 2; - } - }, { - key: "_findNextCompoundStart", - value: function _findNextCompoundStart(MOL2Data) { - while (this._currPosIdx < MOL2Data.length && MOL2Data[this._currPosIdx].trim() !== '@MOLECULE>') { - this._currPosIdx++; - } - - this._setStart(++this._currPosIdx, MOL2Data); - - return this._probablyHaveDataToParse(MOL2Data); - } - }, { - key: "_parseMolecule", - value: function _parseMolecule(MOL2Data) { - this._toHeaderString('MOLECULE', MOL2Data); - - var metadata = this._complex.metadata; - metadata.name = MOL2Data[++this._currPosIdx]; - metadata.format = 'mol2'; - this._molecule = { - _index: '', - _chains: [] - }; - this._molecule._index = this._compoundIndx + 1; - - this._molecules.push(this._molecule); - } - /* Atom format description: - * atomId atomName x y z element [resSeq [resName [charge [statusBit]]]] - * statusBits is the internal SYBYL status bits associated with the atom. - * These should never be set by the user. - * Source: http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf - */ - - }, { - key: "_parseAtoms", - value: function _parseAtoms(atomsNum, MOL2Data) { - this._toHeaderString('ATOM', MOL2Data); - - for (var i = 0; i < atomsNum; i++) { - var parsedStr = splitToFields(MOL2Data[++this._currPosIdx]); - - if (parsedStr.length < 6) { - throw new Error('MOL2 parsing error: Not enough information to create atom!'); - } - - var atomId = parseInt(parsedStr[0], 10); - var atomName = parsedStr[1]; - var x = parseFloat(parsedStr[2]); - var y = parseFloat(parsedStr[3]); - var z = parseFloat(parsedStr[4]); - var element = parsedStr[5].split('.')[0].toUpperCase(); - var charge = 0; - - if (parsedStr.length >= 9) { - charge = parseFloat(parsedStr[8]) || 0.0; - } - - var chain = this._chain; - - if (!chain) { - // .mol2 may contain information about multiple molecules, but they can't be visualized - // at the same time now. There is no need to create different chain IDs then. - this._chain = chain = this._complex.getChain('A') || this._complex.addChain('A'); - this._residue = null; - } - - if (!this._setResidue(parsedStr)) { - continue; - } // These fields are not listed in mol2 format. Set them default. - // Atoms and het atoms doesn't differ in .mol2, - // but het atoms have special residues. It can be used in next updates - - - var het = false; - var altLoc = ' '; - var occupancy = 1.0; - var tempFactor = 0.0; - var type = Element$a.getByName(element); - var role = Element$a.Role[atomName]; - var xyz = new THREE.Vector3(x, y, z); - - this._residue.addAtom(atomName, type, xyz, role, het, atomId, altLoc, occupancy, tempFactor, charge); - } - } - }, { - key: "_setResidue", - value: function _setResidue(parsedStr) { - var resSeq = 1; - var resName = 'UNK'; // The same meaning has '<0>' in some mol2 files - - if (parsedStr.length >= 7) { - resSeq = parseInt(parsedStr[6], 10); - } - - if (parsedStr.length >= 8 && parsedStr[7] !== '<0>') { - resName = parsedStr[7].replace(resNumberRegex, ''); - } - - if (this.settings.now.nowater) { - if (resName === 'HOH' || resName === 'WAT') { - return false; - } - } - - var residue = this._residue; - var chain = this._chain; - - if (!residue || residue.getSequence() !== resSeq) { - this._residue = chain.addResidue(resName, resSeq, 'A'); - } - - return true; - } - /* Bond format description - * bondId originAtomId targetAtomId bondType [statusBits] - */ - - }, { - key: "_parseBonds", - value: function _parseBonds(bondsNum, MOL2Data) { - this._toHeaderString('BOND', MOL2Data); - - for (var i = 0; i < bondsNum; i++) { - var parsedStr = splitToFields(MOL2Data[++this._currPosIdx]); - - if (parsedStr.length < 3) { - throw new Error('MOL2 parsing error: Missing information about bonds!'); - } - - var originAtomId = parseInt(parsedStr[1], 10); - var targetAtomId = parseInt(parsedStr[2], 10); - var bondType = parsedStr[3]; - - if (originAtomId > targetAtomId) { - var _ref = [targetAtomId, originAtomId]; - originAtomId = _ref[0]; - targetAtomId = _ref[1]; - } - - this._complex.addBond(originAtomId, targetAtomId, orderMap$1[bondType] || 0, typeMap$1[bondType] || Bond$5.BondType.UNKNOWN, true); - } - } - }, { - key: "_fixSerialAtoms", - value: function _fixSerialAtoms() { - var atoms = this._complex._atoms; - - for (var i = 0; i < atoms.length; i++) { - var atom = atoms[i]; - this._serialAtomMap[atom.serial] = atom; - } - } - }, { - key: "_fixBondsArray", - value: function _fixBondsArray() { - var serialAtomMap = this._serialAtomMap; - var complex = this._complex; - - if (Object.keys(serialAtomMap).length === 0) { - throw new Error('MOL2 parsing error: Missing atom information!'); - } - - var bonds = complex._bonds; - - for (var j = 0; j < bonds.length; j++) { - var bond = bonds[j]; - bond._left = serialAtomMap[bond._left] || null; - bond._right = serialAtomMap[bond._right] || null; - } - } - }, { - key: "_finalizeMolecules", - value: function _finalizeMolecules() { - // Get chain from complex - var chain = this._complex._chains[0]; - this._complex._molecules = []; // Aggregate residues from chains - // (to be precise from the chain 'A') - - for (var i = 0; i < this._molecules.length; i++) { - var currMolecule = this._molecules[i]; - var molResidues = chain._residues; - var molecule = new Molecule$7(this._complex, currMolecule._name, i + 1); - molecule.residues = molResidues; - this._complex._molecules[i] = molecule; - } - } - }, { - key: "_finalize", - value: function _finalize() { - this._complex._finalizeBonds(); - - this._fixSerialAtoms(); - - this._fixBondsArray(); - - this._finalizeMolecules(); - - this._complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - } - }, { - key: "_parseCompound", - value: function _parseCompound(MOL2Data) { - this._compoundIndx++; - - this._parseMolecule(MOL2Data); // Ignoring comments and everything before @MOLECULE block - - - this._toStringFromHeader('MOLECULE', 2, MOL2Data); - - var parsedStr = MOL2Data[this._currPosIdx].trim().split(spacesRegex); - - var atomsNum = parsedStr[0]; - var bondsNum = parsedStr[1]; - - this._parseAtoms(atomsNum, MOL2Data); - - this._parseBonds(bondsNum, MOL2Data); - } - }, { - key: "parseSync", - value: function parseSync() { - var result = this._complex = new Complex$9(); - - var MOL2Data = this._parseRawStrings(this._data); - - do { - this._parseCompound(MOL2Data); - } while (this._findNextCompoundStart(MOL2Data)); - - this._finalize(); - - return result; - } - }]); - - return MOL2Parser; - }(Parser); - - MOL2Parser.formats = ['mol2']; - MOL2Parser.extensions = ['.mol2', '.ml2', '.sy2']; - - var parsers = new ParserList([// note: order might be important - PDBParser, CIFParser, MMTFParser, XYZParser, CMLParser, PubChemParser, SDFParser, CCP4Parser, DSN6Parser, GROParser, MOL2Parser]); - - /** - * A list of available exporters. - * @extends EntityList - */ - - var ExporterList = /*#__PURE__*/function (_EntityList) { - inherits(ExporterList, _EntityList); - - /** - * Create a list of exporters. - * The exporters are indexed by supported data formats (`.formats` and - * `.extensions` properties of a Exporter subclass). - * The Exporters can be retrieved later by matching against specs (see {@link ExporterList#find}). - * - * @param {!Array=} someExporters A list of {@link Exporter} subclasses to - * automatically register at creation time. - * @see ExporterList#register - */ - function ExporterList() { - var someExporters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - - classCallCheck(this, ExporterList); - - return possibleConstructorReturn(this, getPrototypeOf(ExporterList).call(this, someExporters, ['formats'])); + isHydrogen() { + return this.element.number === 1; + } + getVisualName() { + const { + name + } = this; + if (name.length > 0) { + return name; + } + return this.element.name.trim(); + } + forEachBond(process) { + const { + bonds + } = this; + for (let i = 0, n = bonds.length; i < n; ++i) { + process(bonds[i]); } - /** - * Find a suitable exporter for data. - * - * @param {Object} specs Exporter specifications. - * @param {string=} specs.format Supported data format. - * @param {*=} specs.data Data to export. - */ - - - createClass(ExporterList, [{ - key: "find", - value: function find(specs) { - var list = []; - - if (specs.format) { - list = this._dict.formats[specs.format.toLowerCase()] || []; - } - - return toConsumableArray(list); + } + getFullName() { + let name = ''; + if (this.residue !== null) { + if (this.residue._chain !== null) { + name += `${this.residue._chain.getName()}.`; } - }]); - - return ExporterList; - }(EntityList); - - var Exporter = /*#__PURE__*/function () { - function Exporter(source, options) { - classCallCheck(this, Exporter); - - this._source = source; - this._options = options || {}; - this._abort = false; + name += `${this.residue._sequence}.`; } + name += this.name; + return name; + } - createClass(Exporter, [{ - key: "exportSync", - value: function exportSync() { - throw new Error('Exporting to this source is not implemented'); - } - }, { - key: "export", - value: function _export() { - var _this = this; - - return new Promise(function (resolve, reject) { - setTimeout(function () { - try { - if (_this._abort) { - return reject(new Error('Export aborted')); - } - - return resolve(_this.exportSync()); - } catch (error) { - return reject(error); - } - }); - }); - } - }, { - key: "abort", - value: function abort() { - this._abort = true; - } - }]); + /** + * Enumeration of atom flag values. + * + * @enum {number} + * @readonly + */ + static Flags = { + CARBON: 0x0001, + // OXYGEN: 0x0002, + // NITROGEN: 0x0004, + HYDROGEN: 0x0008, + /** Non-polar hydrogen (it is also a HYDROGEN) */ + NONPOLARH: 0x1008 + }; +} +/* harmony default export */ const chem_Atom = (Atom); +;// CONCATENATED MODULE: ./src/chem/Element.js +class Element { + constructor(number, name, fullName, weight, radius, radiusBonding, hValency) { + this.number = number; + this.name = name; + this.fullName = fullName; + this.weight = weight; + this.radius = radius; + this.radiusBonding = radiusBonding; + this.hydrogenValency = hValency; + } + static Constants = { + /* eslint-disable no-magic-numbers */ + U1: 1, + Lead: 2, + U2: 3, + Wing: 4, + U18: 18 + /* eslint-enable no-magic-numbers */ + }; + static Role = (() => ({ + /* eslint-disable no-magic-numbers */ + N: Element.Constants.U1, + CA: Element.Constants.Lead, + C: Element.Constants.U2, + O: Element.Constants.Wing, + SG: Element.Constants.U18 + /* eslint-enable no-magic-numbers */ + }))(); - return Exporter; - }(); - makeContextDependent(Exporter.prototype); + // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. + static ByAtomicNumber = (() => [/* eslint-disable no-magic-numbers */ + null, new Element(1, 'H', 'Hydrogen', 1.008, 1.2, 0.23, [1]), new Element(2, 'HE', 'Helium', 4.003, 1.4, 0.93, [0]), new Element(3, 'LI', 'Lithium', 6.941, 1.82, 0.68, [1]), new Element(4, 'BE', 'Beryllium', 9.012, 1.7, 0.35, [2]), new Element(5, 'B', 'Boron', 10.81, 2.08, 0.83, [3]), new Element(6, 'C', 'Carbon', 12.011, 1.95, 0.68, [4]), new Element(7, 'N', 'Nitrogen', 14.007, 1.85, 0.68, [3, 5]), new Element(8, 'O', 'Oxygen', 15.999, 1.7, 0.68, [2, 4]), new Element(9, 'F', 'Fluorine', 18.998, 1.73, 0.64, [1]), new Element(10, 'NE', 'Neon', 20.18, 1.54, 1.12, [0]), new Element(11, 'NA', 'Sodium', 22.99, 2.27, 0.97, [1]), new Element(12, 'MG', 'Magnesium', 24.305, 1.73, 1.1, [2]), new Element(13, 'AL', 'Aluminum', 26.981, 2.05, 1.35, [3]), new Element(14, 'SI', 'Silicon', 28.086, 2.1, 1.2, [4]), new Element(15, 'P', 'Phosphorus', 30.974, 2.08, 0.75, [3, 5]), new Element(16, 'S', 'Sulfur', 32.07, 2, 1.02, [2, 4, 6]), new Element(17, 'CL', 'Chlorine', 35.453, 1.97, 0.99, [1, 3, 5, 7]), new Element(18, 'AR', 'Argon', 39.948, 1.88, 1.57, [0]), new Element(19, 'K', 'Potassium', 39.1, 2.75, 1.33, [1]), new Element(20, 'CA', 'Calcium', 40.08, 1.973, 0.99, [2]), new Element(21, 'SC', 'Scandium', 44.956, 1.7, 1.44, [0]), new Element(22, 'TI', 'Titanium', 47.88, 1.7, 1.47, [0]), new Element(23, 'V', 'Vanadium', 50.941, 1.7, 1.33, [0]), new Element(24, 'CR', 'Chromium', 52, 1.7, 1.35, [0]), new Element(25, 'MN', 'Manganese', 54.938, 1.7, 1.35, [0]), new Element(26, 'FE', 'Iron', 55.847, 1.7, 1.34, [0]), new Element(27, 'CO', 'Cobalt', 58.93, 1.7, 1.33, [0]), new Element(28, 'NI', 'Nickel', 58.69, 1.63, 1.5, [0]), new Element(29, 'CU', 'Copper', 63.55, 1.4, 1.52, [0]), new Element(30, 'ZN', 'Zinc', 65.39, 1.39, 1.45, [0]), new Element(31, 'GA', 'Gallium', 69.72, 1.87, 1.22, [3]), new Element(32, 'GE', 'Germanium', 72.61, 1.7, 1.17, [4]), new Element(33, 'AS', 'Arsenic', 74.92, 1.85, 1.21, [3, 5]), new Element(34, 'SE', 'Selenium', 78.96, 1.9, 1.22, [2, 4, 6]), new Element(35, 'BR', 'Bromine', 79.9, 2.1, 1.21, [1, 3, 5, 7]), new Element(36, 'KR', 'Krypton', 83.8, 2.02, 1.91, [0]), new Element(37, 'RB', 'Rubidium', 85.47, 1.7, 1.47, [1]), new Element(38, 'SR', 'Strontium', 87.62, 1.7, 1.12, [2]), new Element(39, 'Y', 'Yttrium', 88.91, 1.7, 1.78, [0]), new Element(40, 'ZR', 'Zirconium', 91.22, 1.7, 1.56, [0]), new Element(41, 'NB', 'Niobium', 92.91, 1.7, 1.48, [0]), new Element(42, 'MO', 'Molybdenum', 95.94, 1.7, 1.47, [0]), new Element(43, 'TC', 'Technetium', 98.91, 1.7, 1.35, [0]), new Element(44, 'RU', 'Ruthenium', 101.07, 1.7, 1.4, [0]), new Element(45, 'RH', 'Rhodium', 102.91, 1.7, 1.45, [0]), new Element(46, 'PD', 'Palladium', 106.42, 1.63, 1.5, [0]), new Element(47, 'AG', 'Silver', 107.87, 1.72, 1.59, [0]), new Element(48, 'CD', 'Cadmium', 112.41, 1.58, 1.69, [0]), new Element(49, 'IN', 'Indium', 114.82, 1.93, 1.63, [3]), new Element(50, 'SN', 'Tin', 118.71, 2.17, 1.46, [2, 4]), new Element(51, 'SB', 'Antimony', 121.75, 2.2, 1.46, [3, 5]), new Element(52, 'TE', 'Tellurium', 127.6, 2.06, 1.47, [2, 4, 6]), new Element(53, 'I', 'Iodine', 126.91, 2.15, 1.4, [1, 3, 5, 7]), new Element(54, 'XE', 'Xenon', 131.29, 2.16, 1.98, [0]), new Element(55, 'CS', 'Cesium', 132.91, 1.7, 1.67, [1]), new Element(56, 'BA', 'Barium', 137.33, 1.7, 1.34, [2]), new Element(57, 'LA', 'Lanthanum', 138.91, 1.7, 1.87, [0]), new Element(58, 'CE', 'Cerium', 140.12, 1.7, 1.83, [0]), new Element(59, 'PR', 'Praseodymium', 140.91, 1.7, 1.82, [0]), new Element(60, 'ND', 'Neodymium', 144.24, 1.7, 1.81, [0]), new Element(61, 'PM', 'Promethium', 144.9, 1.7, 1.8, [0]), new Element(62, 'SM', 'Samarium', 150.36, 1.7, 1.8, [0]), new Element(63, 'EU', 'Europium', 151.96, 1.7, 1.99, [0]), new Element(64, 'GD', 'Gadolinium', 157.25, 1.7, 1.79, [0]), new Element(65, 'TB', 'Terbium', 158.93, 1.7, 1.76, [0]), new Element(66, 'DY', 'Dysprosium', 162.5, 1.7, 1.75, [0]), new Element(67, 'HO', 'Holmium', 164.93, 1.7, 1.74, [0]), new Element(68, 'ER', 'Erbium', 167.26, 1.7, 1.73, [0]), new Element(69, 'TM', 'Thulium', 168.93, 1.7, 1.72, [0]), new Element(70, 'YB', 'Ytterbium', 173.04, 1.7, 1.94, [0]), new Element(71, 'LU', 'Lutetium', 174.97, 1.7, 1.72, [0]), new Element(72, 'HF', 'Hafnium', 178.49, 1.7, 1.57, [0]), new Element(73, 'TA', 'Tantalum', 180.95, 1.7, 1.43, [0]), new Element(74, 'W', 'Tungsten', 183.85, 1.7, 1.37, [0]), new Element(75, 'RE', 'Rhenium', 186.21, 1.7, 1.35, [0]), new Element(76, 'OS', 'Osmium', 190.2, 1.7, 1.37, [0]), new Element(77, 'IR', 'Iridium', 192.22, 1.7, 1.32, [0]), new Element(78, 'PT', 'Platinum', 195.08, 1.72, 1.5, [0]), new Element(79, 'AU', 'Gold', 196.97, 1.66, 1.5, [0]), new Element(80, 'HG', 'Mercury', 200.59, 1.55, 1.7, [0]), new Element(81, 'TL', 'Thallium', 204.38, 1.96, 1.55, [1, 3]), new Element(82, 'PB', 'Lead', 207.2, 2.02, 1.54, [2, 4]), new Element(83, 'BI', 'Bismuth', 208.98, 1.7, 1.54, [3, 5]), new Element(84, 'PO', 'Polonium', 210, 1.7, 1.68, [2, 4, 6]), new Element(85, 'AT', 'Astatine', 210, 1.7, 1.7, [1, 3, 5, 7]), new Element(86, 'RN', 'Radon', 222, 1.7, 2.4, [0]), new Element(87, 'FR', 'Francium', 223, 1.7, 2, [1]), new Element(88, 'RA', 'Radium', 226.03, 1.7, 1.9, [2]), new Element(89, 'AC', 'Actinium', 227.03, 1.7, 1.88, [0]), new Element(90, 'TH', 'Thorium', 232.04, 1.7, 1.79, [0]), new Element(91, 'PA', 'Protactinium', 231.04, 1.7, 1.61, [0]), new Element(92, 'U', 'Uranium', 238.03, 1.86, 1.58, [0]), new Element(93, 'NP', 'Neptunium', 237.05, 1.7, 1.55, [0]), new Element(94, 'PU', 'Plutonium', 239.1, 1.7, 1.53, [0]), new Element(95, 'AM', 'Americium', 243.1, 1.7, 1.51, [0]), new Element(96, 'CM', 'Curium', 247.1, 1.7, 1.5, [0]), new Element(97, 'BK', 'Berkelium', 247.1, 1.7, 1.5, [0]), new Element(98, 'CF', 'Californium', 252.1, 1.7, 1.5, [0]), new Element(99, 'ES', 'Einsteinium', 252.1, 1.7, 1.5, [0]), new Element(100, 'FM', 'Fermium', 257.1, 1.7, 1.5, [0]), new Element(101, 'MD', 'Mendelevium', 256.1, 1.7, 1.5, [0]), new Element(102, 'NO', 'Nobelium', 259.1, 1.7, 1.5, [0]), new Element(103, 'LR', 'Lawrencium', 260.1, 1.7, 1.5, [0]), new Element(104, 'RF', 'Rutherfordium', 261, 1.7, 1.6, [0]), new Element(105, 'DB', 'Dubnium', 262, 1.7, 1.6, [0]), new Element(106, 'SG', 'Seaborgium', 263, 1.7, 1.6, [0]), new Element(107, 'BH', 'Bohrium', 262, 1.7, 1.6, [0]), new Element(108, 'HS', 'Hassium', 265, 1.7, 1.6, [0]), new Element(109, 'MT', 'Meitnerium', 268, 1.7, 1.6, [0]) + /* eslint-enable no-magic-numbers */])(); - var PDBResult = /*#__PURE__*/function () { - function PDBResult() { - classCallCheck(this, PDBResult); + // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. + static ByName = (() => ({ + // Duplicate atomic numbers (isotopes) + /* eslint-disable no-magic-numbers */ + D: new Element(1, 'D', 'Deuterium', 2.014, 1.2, 0.23, [1]), + T: new Element(1, 'T', 'Tritium', 3.016, 1.2, 0.23, [1]) + /* eslint-enable no-magic-numbers */ - this._resultArray = []; - this._currentStr = -1; - this._tag = null; - this._fixedNumeration = false; - this._numeration = false; - this._tagStrNum = 0; + // All regular elements will be added later, automatically + }))(); +} +(function () { + const byAtomicNumber = Element.ByAtomicNumber; + const byName = Element.ByName; + for (let i = 0, n = byAtomicNumber.length; i < n; ++i) { + const element = byAtomicNumber[i]; + if (element) { + byName[element.name] = element; } + } +})(); - createClass(PDBResult, [{ - key: "getResult", - value: function getResult() { - this.writeString('\n', 81, 81); - return this._resultArray.join(''); +// find atom type by chemical element (or create if missing) +Element.getByName = function (element) { + let type = Element.ByName[element]; + if (!type) { + type = Element.ByName[element] = new Element(0, element, 'Unknown', 0, 1.0, 0.01, [0]); + } + return type; +}; +/* harmony default export */ const chem_Element = (Element); +;// CONCATENATED MODULE: ./src/chem/Bond.js +const cBondTypes = { + /** Was generated manually */ + UNKNOWN: 0, + /** Simple covalent bond */ + COVALENT: 1, + /** Aromatic bond */ + AROMATIC: 2 +}; +function getAtomPos(atom) { + return atom.position; +} + +/** + * Bond between atoms. + * + * @param {Atom} left - The first atom. + * @param {Atom} right - The second atom. + * @param {number} order - Order of current bond. + * @param {number} type - Bond type. + * @param {boolean} fixed - Indicator of a pre-specified connection (in contrast with guessed one). + * + * @exports Bond + * @constructor + */ +class Bond { + constructor(left, right, order, type, fixed) { + this._left = left; + this._right = right; + this._fixed = fixed; + this._index = -1; + if (left > right) { + throw new Error('In a bond atom indices must be in increasing order'); + } + this._order = order; + this._type = type; + } + getLeft() { + return this._left; + } + getRight() { + return this._right; + } + getOrder() { + return this._order; + } + calcLength() { + return this._left.position.distanceTo(this._right.position); + } + _forEachNeighbour(currAtom, process) { + const { + bonds + } = currAtom; + for (let i = 0, n = bonds.length; i < n; ++i) { + process(bonds[i]._left !== currAtom ? bonds[i]._left : bonds[i]._right); + } + } + forEachLevelOne(process) { + const left = this._left; + const right = this._right; + this._forEachNeighbour(left, atom => { + if (atom === right) { + return; } - }, { - key: "_currentStrLength", - value: function _currentStrLength() { - var curStr = this._resultArray[this._currentStr]; - return curStr ? curStr.length : 0; - } // numeration can be number or boolean - // if numeration is number then just put this number to 8-10 pos in string - // if numeration is boolean then increase number for all new strings - - }, { - key: "newTag", - value: function newTag(tag, numeration) { - if (!tag) { - this._tag = null; - } else { - this._tag = tag; - } - - if (!_.isUndefined(numeration)) { - if (_.isNumber(numeration)) { - this._tagStrNum = numeration; - this._numeration = true; - this._fixedNumeration = true; - } else if (_.isBoolean(numeration)) { - this._tagStrNum = 0; - this._numeration = numeration; - this._fixedNumeration = false; - } - } else { - this._numeration = false; - this._fixedNumeration = false; - this._tagStrNum = 0; - } + process(atom); + }); + this._forEachNeighbour(right, atom => { + if (atom === left) { + return; } - }, { - key: "newString", - value: function newString(tag) { - this.writeString('\n', 81, 81); - this._currentStr++; - - this._resultArray.push(''); - - if (tag) { - this.writeString(tag, 1, 6); - } else if (this._tag) { - this.writeString(this._tag, 1, 6); - } - - if (this._numeration) { - if (!this._fixedNumeration) { - this._tagStrNum++; - } - - if (this._tagStrNum !== 1) { - this.writeString(this._tagStrNum.toString(), 10, 8); - } - } + process(atom); + }); + } + forEachLevelTwo(process) { + // TODO refactor this piece of an art? + const left = this._left; + const right = this._right; + const self = this; + self._forEachNeighbour(left, atom => { + if (atom === right) { + return; } - }, { - key: "writeEntireString", - value: function writeEntireString(string, maxStrPos, concat) { - if (!maxStrPos) { - maxStrPos = 81; - } - - for (var j = 0; j < string.length; j++) { - if (this._currentStrLength() === maxStrPos && j !== string.length - 1) { - this.newString(); - - if (concat) { - // pretty hardcoddy - this.writeString(concat.tag, concat.begin, concat.end); - } - } - - if (string[j] === '\n') { - this.newString(); - } else { - this.writeString(string[j]); - } + self._forEachNeighbour(atom, l2Atom => { + if (l2Atom === left) { + return; } + process(l2Atom); + }); + }); + self._forEachNeighbour(right, atom => { + if (atom === left) { + return; } - }, { - key: "writeString", - value: function writeString(string, begin, end) { - var curStr = this._resultArray[this._currentStr]; - var str; - var curStrLength = curStr ? curStr.length : 0; - - if (_.isUndefined(string)) { + self._forEachNeighbour(atom, l2Atom => { + if (l2Atom === right) { return; } - - if (!_.isNumber(begin)) { - begin = curStrLength + 1; - } - - if (!_.isNumber(end)) { - end = curStrLength + string.length; - } - - if (!_.isString(string)) { - str = string.toString(); - } else { - str = string; - } - - var finish = begin < end ? end : begin; - var start = begin < end ? begin : end; - - if (str.length > Math.abs(begin - end) + 1) { - str = str.substr(0, Math.abs(begin - end + 1)); - } // spaces before start of new data - - - if (start > curStrLength + 1) { - this._resultArray[this._currentStr] += ' '.repeat(start - curStrLength - 1); - } else if (start <= curStrLength) { - var cStr = this._resultArray[this._currentStr]; - this._resultArray[this._currentStr] = cStr.slice(0, start - 1); - } // if reverse order - // reverse order of end and begin means that user wants to align text right - - - if (end < begin) { - var len = begin - end + 1; - str = ' '.repeat(len - str.length) + str; - } // some hardcode fix for space between string numeration and data - // (see pdb file format description) - - - if (start === 11 && this._numeration && this._tagStrNum !== 1) { - str = " ".concat(str); - } // append new data to string - - - this._resultArray[this._currentStr] += str; - curStr = this._resultArray[this._currentStr]; - - if (finish > curStr.length) { - this._resultArray[this._currentStr] += ' '.repeat(finish - curStr.length); - } + process(l2Atom); + }); + }); + } + _fixDir(refPoint, currDir, posGetter) { + // count atoms to the right and to the left of the current plane + let rightCount = 0; + let leftCount = 0; + const tmpVec = refPoint.clone(); + function checkDir(atom) { + tmpVec.copy(posGetter(atom)); + tmpVec.sub(refPoint); + const dotProd = currDir.dot(tmpVec); + if (dotProd > 0) { + ++rightCount; + } else { + ++leftCount; } - }, { - key: "writeBondsArray", - value: function writeBondsArray(bonds, atom) { - var bondsArrays = this._getSubArrays(bonds, 4); - - for (var k = 0; k < bondsArrays.length; k++) { - this.newString(); - this.writeString(atom.serial, 11, 7); - - for (var j = 0; j < bondsArrays[k].length; j++) { - var serial = bondsArrays[k][j]._left.serial === atom.serial ? bondsArrays[k][j]._right.serial : bondsArrays[k][j]._left.serial; - this.writeString(serial, 16 + 5 * j, 12 + 5 * j); - } - } + } + function checkCarbon(atom) { + if (atom.element.name === 'C') { + checkDir(atom); } - }, { - key: "_getSubArrays", - value: function _getSubArrays(arr, subArraySize) { - var subArrays = []; - - for (var i = 0; i < arr.length; i += subArraySize) { - subArrays.push(arr.slice(i, i + subArraySize)); - } - - return subArrays; - } // function for writing matrix in Remark290 and Remark350 tags - // (see pdb file description) - - }, { - key: "writeMatrix", - value: function writeMatrix(matrix, matrixIndx, tag) { - for (var j = 0; j < 3; j++) { - this.newString(); - this.writeString(tag, 14, 18); - this.writeString((j + 1).toString(), 19, 19); - this.writeString(matrixIndx.toString(), 23, 20); - - for (var k = 0; k < 3; k++) { - var _numb = parseFloat(matrix.elements[j * 4 + k]).toFixed(6); - - this.writeString(_numb.toString(), 33 + k * 10, 24 + k * 10); - } - - var numb = parseFloat(matrix.elements[j * 4 + 3]).toFixed(5); - this.writeString(numb.toString(), 68, 55); - } + } + // count all atoms to the left and right of our plane, start from level 1 and carbons + const stages = [[this.forEachLevelOne, checkCarbon], [this.forEachLevelOne, checkDir], [this.forEachLevelTwo, checkCarbon], [this.forEachLevelTwo, checkDir]]; + for (let stageId = 0; stageId < stages.length; ++stageId) { + stages[stageId][0].call(this, stages[stageId][1]); + if (leftCount > rightCount) { + return currDir.multiplyScalar(-1); } - }, { - key: "writeMatrices", - value: function writeMatrices(matrices, string) { - if (!matrices) { - return; - } - - var matrix = new THREE.Matrix4(); - - for (var j = 0; j < matrices.length; j++) { - matrix.copy(matrices[j]).transpose(); - this.writeMatrix(matrix, j + 1, string); - } + if (leftCount < rightCount) { + return currDir; } - }]); - - return PDBResult; - }(); - - var PDBExporter = /*#__PURE__*/function (_Exporter) { - inherits(PDBExporter, _Exporter); - - function PDBExporter(source, options) { - var _this; - - classCallCheck(this, PDBExporter); - - _this = possibleConstructorReturn(this, getPrototypeOf(PDBExporter).call(this, source, options)); - _this._tags = ['HEADER', 'TITLE', 'COMPND', 'REMARK', 'HELIX', 'SHEET', 'ATOM and HETATM', 'CONECT']; - _this._result = null; - _this._tagExtractors = { - HEADER: _this._extractHEADER, - TITLE: _this._extractTITLE, - 'ATOM and HETATM': _this._extractATOM, - CONECT: _this._extractCONECT, - COMPND: _this._extractCOMPND, - REMARK: _this._extractREMARK, - HELIX: _this._extractHELIX, - SHEET: _this._extractSHEET - }; - _this._stringForRemark350 = 'COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN\n' + 'BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE\n' + 'MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS\n' + 'GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND\n' + 'CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.'; - _this._stringForRemark290 = 'CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS\n' + 'THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM\n' + 'RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY\n' + 'RELATED MOLECULES.'; - return _this; } + return currDir; + } + calcNormalDir(posGetter) { + const left = this._left; + const right = this._right; + let first = left; + let second = right; + posGetter = posGetter === undefined ? getAtomPos : posGetter; + if (left.bonds.length > right.bonds.length) { + first = right; + second = left; + } + let third = first; + let maxNeibs = 0; + const { + bonds + } = second; + for (let i = 0, n = bonds.length; i < n; ++i) { + let another = bonds[i]._left; + if (bonds[i]._left === second) { + another = bonds[i]._right; + } + if (another.bonds.length > maxNeibs && another !== first) { + third = another; + maxNeibs = another.bonds.length; + } + } + const secondPos = posGetter(second); + const firstV = posGetter(first).clone().sub(secondPos); + const secondV = posGetter(third).clone().sub(secondPos); + secondV.crossVectors(firstV, secondV); + if (secondV.lengthSq() < 0.0001) { + secondV.set(0, 1, 0); + } + firstV.normalize(); + secondV.normalize(); + firstV.crossVectors(secondV, firstV); + if (firstV.lengthSq() < 0.0001) { + firstV.set(0, 1, 0); + } + firstV.normalize(); + return this._fixDir(secondPos, firstV, posGetter); + } + static BondType = (() => cBondTypes)(); +} +Bond.prototype.BondType = cBondTypes; +/* harmony default export */ const chem_Bond = (Bond); +;// CONCATENATED MODULE: ./src/chem/Residue.js + + + +const cNucleicControlNames = ['C3\'', 'C3*', 'P', 'H5T', 'H3T']; +const cNucleicWing1Names = ['OP1', 'O1P']; +const cNucleicWing2Names = ['OP2', 'O2P']; +const cCylinderSource = ['C3\'', 'C3*', 'C1', 'C1\'', 'C1*', 'P']; +const cCylinderTarget = [{ + types: ['A', 'DA', 'G', 'DG'], + atoms: ['N1'] +}, { + types: ['C', 'DC'], + atoms: ['N3'] +}, { + types: ['T', 'DT', 'U', 'DU'], + atoms: ['O4'] +}]; + +/** + * Residue instance. + * + * @param {Chain} chain - Chain this residue belongs to. + * @param {ResidueType} type - Generic residue instance type. + * @param {number} sequence - Sequence ID. + * @param {string} icode - One character insertion code (usually space or A-Z). + * + * @exports Residue + * @constructor + */ +class Residue { + constructor(chain, type, sequence, icode) { + this._chain = chain; + this._component = null; + this._type = type; + this._sequence = sequence; + this._icode = icode; + this._mask = 1 | 0; + this._index = -1; + this._atoms = []; + this._secondary = null; + this._firstAtom = null; + this._leadAtom = null; + this._wingAtom = null; + this._lastAtom = null; + this._controlPoint = null; + this._midPoint = null; + this._wingVector = null; + this._cylinders = null; + this._isValid = true; + this._het = false; + this._molecule = null; + this.temperature = null; + this.occupancy = null; + } - createClass(PDBExporter, [{ - key: "exportSync", - value: function exportSync() { - var result = new PDBResult(); - - if (!this._source) { - return this._result; - } - - for (var i = 0; i < this._tags.length; i++) { - var tag = this._tags[i]; - var func = this._tagExtractors[tag]; - - if (_.isFunction(func)) { - func.call(this, result); - } - } - - this._result = result.getResult(); - return this._result; - } - }, { - key: "_extractHEADER", - value: function _extractHEADER(result) { - if (!this._source.metadata) { - return; - } - - var metadata = this._source.metadata; - result.newTag('HEADER'); - result.newString(); - - if (metadata.classification) { - result.writeString(metadata.classification, 11, 50); - } + // Getters and setters + getChain() { + return this._chain; + } + getMolecule() { + return this._molecule; + } + getType() { + return this._type; + } + getSequence() { + return this._sequence; + } + getSecondary() { + return this._secondary; + } + getICode() { + return this._icode; + } - if (metadata.date) { - result.writeString(metadata.date, 51, 59); - } + // Other methods - if (metadata.id) { - result.writeString(metadata.id, 63, 66); - } + addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge) { + const atom = new chem_Atom(this, name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); + const complex = this._chain.getComplex(); + complex.addAtom(atom); + this._atoms.push(atom); + this._het = this._het || het; + return atom; + } + getAtomCount() { + return this._atoms.length; + } + forEachAtom(process) { + const atoms = this._atoms; + for (let i = 0, n = atoms.length; i < n; ++i) { + if (process(atoms[i])) { + break; } - }, { - key: "_extractTITLE", - value: function _extractTITLE(result) { - if (!this._source.metadata) { - return; - } - - var metadata = this._source.metadata; - - if (!metadata.title) { - return; - } - - result.newTag('TITLE', true); - - for (var i = 0; i < metadata.title.length; i++) { - result.newString(); - result.writeString(metadata.title[i], 11, 80); - } + } + } + _findAtomByName(name) { + let res = null; + this.forEachAtom(atom => { + if (atom.name === name) { + res = atom; + return true; } - }, { - key: "_extractCONECT", - value: function _extractCONECT(result) { - if (!this._source._atoms) { - return; - } - - var atoms = this._source._atoms; - result.newTag('CONECT'); - - for (var i = 0; i < atoms.length; i++) { - var fixedBonds = atoms[i].bonds.filter(function (bond) { - return bond._fixed; - }); - - if (fixedBonds.length !== 0) { - result.writeBondsArray(fixedBonds.reverse(), atoms[i]); - } - } + return false; + }); + return res; + } + _findFirstAtomInList(names) { + let res = null; + for (let i = 0; i < names.length; ++i) { + res = this._findAtomByName(names[i]); + if (res !== null) { + return res; } - }, { - key: "_extractSHEET", - value: function _extractSHEET(result) { - if (!this._source._sheets) { - return; - } - - result.newTag('SHEET'); - var sheets = this._source._sheets; - - for (var i = 0; i < sheets.length; i++) { - if (sheets[i]._strands) { - var strands = sheets[i]._strands; - - for (var j = 0; j < strands.length; j++) { - result.newString(); - result.writeString(j + 1, 10, 8); - result.writeString(sheets[i]._name, 14, 12); - result.writeString(strands.length, 16, 15); - result.writeString(strands[j].init._type._name, 18, 20); - result.writeString(strands[j].init._chain._name, 22, 22); - result.writeString(strands[j].init._sequence, 26, 23); - result.writeString(strands[j].init._icode, 27, 27); - result.writeString(strands[j].term._type._name, 29, 31); - result.writeString(strands[j].init._chain._name, 33, 33); - result.writeString(strands[j].term._sequence, 37, 34); - result.writeString(strands[j].term._icode, 38, 38); - result.writeString(strands[j].sense, 40, 39); - } - } + } + return res; + } + collectMask() { + let mask = 0xffffffff; + const atoms = this._atoms; + for (let i = 0, n = atoms.length; i < n; ++i) { + mask &= atoms[i].mask; + } + this._mask = mask; + } + getCylinderTargetList() { + const type = this._type._name; + for (let i = 0, n = cCylinderTarget.length; i < n; ++i) { + for (let j = 0, m = cCylinderTarget[i].types.length; j < m; ++j) { + if (type === cCylinderTarget[i].types[j]) { + return cCylinderTarget[i].atoms; } } - }, { - key: "_extractHELIX", - value: function _extractHELIX(result) { - if (!this._source._helices) { - return; - } - - result.newTag('HELIX'); - var helices = this._source._helices; - - for (var i = 0; i < helices.length; i++) { - var helix = helices[i]; - - var helixClass = _.invert(typeByPDBHelixClass); - - result.newString(); - result.writeString(helix.serial, 10, 8); - result.writeString(helix.name, 14, 12); - result.writeString(helix.init._type._name, 16, 18); - result.writeString(helix.init._chain._name, 20, 20); - result.writeString(helix.init._sequence, 25, 22); - result.writeString(helix.init._icode, 26, 26); - result.writeString(helix.term._type._name, 28, 30); - result.writeString(helix.term._chain._name, 32, 32); - result.writeString(helix.term._sequence, 37, 34); - result.writeString(helix.term._icode, 38, 38); - result.writeString(helixClass[helix.type], 40, 39); - result.writeString(helix.comment, 41, 70); - result.writeString(helix.length, 76, 72); + } + return null; + } + _detectLeadWing(dst, next, getAtomPosition) { + const leadAtom = this._findFirstAtomInList(cNucleicControlNames); + let wingStart = this._findFirstAtomInList(cNucleicWing1Names); + let wingEnd = this._findFirstAtomInList(cNucleicWing2Names); + if (wingStart === null && next !== null) { + wingStart = next._findFirstAtomInList(cNucleicWing1Names); + } + if (wingEnd === null && next !== null) { + wingEnd = next._findFirstAtomInList(cNucleicWing2Names); + } + if (leadAtom === null || wingStart === null || wingEnd === null) { + return; + } + dst._leadAtom = leadAtom; + dst._controlPoint = getAtomPosition(leadAtom); + dst._wingVector = getAtomPosition(wingEnd).clone().sub(getAtomPosition(wingStart)); + dst._isValid = true; + const cylSource = this._findFirstAtomInList(cCylinderSource); + const targetList = this.getCylinderTargetList(); + const cylTarget = targetList !== null ? this._findFirstAtomInList(targetList) : null; + if (cylSource === null || cylTarget === null) { + return; + } + dst._cylinders = [getAtomPosition(cylSource), getAtomPosition(cylTarget)]; + } + calcWing(prevLeadPos, currLeadPos, prevWingPos, prevWing) { + const vectorA = currLeadPos.clone().sub(prevLeadPos); + const vectorB = prevLeadPos.clone().sub(prevWingPos); + vectorB.crossVectors(vectorA, vectorB); + vectorB.crossVectors(vectorA, vectorB).normalize(); + if (prevWing !== null && prevWing.length() > 0.0001) { + const needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2; + if (needToNegate) { + vectorB.negate(); + } + } + return vectorB; + } + _innerFinalize(prevRes, prev, nextRes, dst, chainAsNucleic, getAtomPosition) { + const bFirstInChain = prev === null; + const lp = getAtomPosition(this._leadAtom); + const currLeadPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(lp.x, lp.y, lp.z); + if (chainAsNucleic) { + this._detectLeadWing(dst, nextRes, getAtomPosition); + return; + } + if (bFirstInChain) { + // for first one in chain + dst._midPoint = getAtomPosition(this._firstAtom).clone(); + } else { + const prevLeadPos = prev._controlPoint; // lead point of previous monomer + dst._midPoint = prevLeadPos.clone().lerp(currLeadPos, 0.5); + dst._wingVector = this.calcWing(prevLeadPos, currLeadPos, getAtomPosition(prevRes._wingAtom), prev._wingVector); + } + dst._controlPoint = currLeadPos; + } + _finalize2(prev, next, asNucleic) { + // Should be called AFTER first finalize + this._innerFinalize(prev, prev, next, this, asNucleic, atom => atom.position); + } + isConnected(anotherResidue) { + if (this._chain !== anotherResidue._chain) { + return false; + } + if (this === anotherResidue) { + return true; + } + let res = false; + this.forEachAtom(atom => { + const { + bonds + } = atom; + for (let i = 0, n = bonds.length; i < n; ++i) { + const bond = bonds[i]; + if (bond._left.residue === anotherResidue || bond._right.residue === anotherResidue) { + res = true; + return true; } } - }, { - key: "_extractATOM", - value: function _extractATOM(result) { - if (!this._source._atoms) { - return; - } + return false; + }); + return res; + } + _finalize() { + const self = this; + [this._firstAtom] = this._atoms; + this._lastAtom = this._atoms[this._atoms.length - 1]; + this._leadAtom = null; + this._wingAtom = null; + let tempCount = 0; + let temperature = 0; // average temperature + let occupCount = 0; + let occupancy = 0; // average occupancy + this.forEachAtom(a => { + if (self._leadAtom === null) { + if (a.role === chem_Element.Constants.Lead) { + self._leadAtom = a; + } + } + if (self._wingAtom === null) { + if (a.role === chem_Element.Constants.Wing) { + self._wingAtom = a; + } + } + if (a.temperature) { + temperature += a.temperature; + tempCount++; + } + if (a.occupancy) { + occupancy += a.occupancy; + occupCount++; + } + return self._leadAtom !== null && self._wingAtom !== null; + }); + if (tempCount > 0) { + this.temperature = temperature / tempCount; + } + if (occupCount > 0) { + this.occupancy = occupancy / occupCount; + } - var atoms = this._source._atoms; - - for (var i = 0; i < atoms.length; i++) { - var tag = atoms[i].het ? 'HETATM' : 'ATOM'; - result.newString(tag); - var startIndx = atoms[i].element.name.length > 1 || atoms[i].name.length > 3 ? 13 : 14; - result.writeString(atoms[i].serial, 11, 7); - result.writeString(atoms[i].name, startIndx, 16); - result.writeString(String.fromCharCode(atoms[i].location), 17, 17); - result.writeString(atoms[i].residue._type._name, 20, 18); - result.writeString(atoms[i].residue._chain._name, 22, 22); - result.writeString(atoms[i].residue._sequence, 26, 23); - result.writeString(atoms[i].residue._icode, 27, 27); - result.writeString(atoms[i].position.x.toFixed(3), 38, 31); - result.writeString(atoms[i].position.y.toFixed(3), 46, 39); - result.writeString(atoms[i].position.z.toFixed(3), 54, 47); - result.writeString(atoms[i].occupancy.toFixed(2), 60, 55); - result.writeString(atoms[i].temperature.toFixed(2), 66, 61); - result.writeString(atoms[i].element.name, 78, 77); - - if (atoms[i].charge) { - result.writeString(atoms[i].charge, 79, 80); - } - } - } - }, { - key: "_extractCOMPND", - value: function _extractCOMPND(result) { - if (!this._source._molecules) { - return; - } + // Still try to make monomer look valid + if (this._leadAtom === null || this._wingAtom === null) { + this._isValid = false; + } + if (this._leadAtom === null) { + this._leadAtom = this._firstAtom; + } + if (this._wingAtom === null) { + this._wingAtom = this._lastAtom; + } + } +} +/* harmony default export */ const chem_Residue = (Residue); +;// CONCATENATED MODULE: ./src/chem/ResidueType.js +/** + * Residue type. + * + * Predefined acid or created with HET, HETNAM, etc. + * + * @param {string} name - Short name, either standard (ALA, MET, etc.) or non-standard one. + * @param {string} fullName - Full residue name. + * @param {string} letterCode - 1-letter symbol. + * + * @exports ResidueType + * @constructor + */ +class ResidueType { + constructor(name, fullName, letterCode) { + this._name = name; + this._fullName = fullName; + this.letterCode = letterCode; + this.flags = 0x0000; + } + getName() { + return this._name; + } - var molecules = this._source._molecules; - result.newTag('COMPND', true); + // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. + static StandardTypes = (() => ({ + /* eslint-disable no-magic-numbers */ + ALA: new ResidueType('ALA', 'Alanine', 'A'), + ARG: new ResidueType('ARG', 'Arginine', 'R'), + ASN: new ResidueType('ASN', 'Asparagine', 'N'), + ASP: new ResidueType('ASP', 'Aspartic Acid', 'D'), + CYS: new ResidueType('CYS', 'Cysteine', 'C'), + GLN: new ResidueType('GLN', 'Glutamine', 'Q'), + GLU: new ResidueType('GLU', 'Glutamic Acid', 'E'), + GLY: new ResidueType('GLY', 'Glycine', 'G'), + HIS: new ResidueType('HIS', 'Histidine', 'H'), + ILE: new ResidueType('ILE', 'Isoleucine', 'I'), + LEU: new ResidueType('LEU', 'Leucine', 'L'), + LYS: new ResidueType('LYS', 'Lysine', 'K'), + MET: new ResidueType('MET', 'Methionine', 'M'), + PHE: new ResidueType('PHE', 'Phenylalanine', 'F'), + PRO: new ResidueType('PRO', 'Proline', 'P'), + PYL: new ResidueType('PYL', 'Pyrrolysine', 'O'), + SEC: new ResidueType('SEC', 'Selenocysteine', 'U'), + SER: new ResidueType('SER', 'Serine', 'S'), + THR: new ResidueType('THR', 'Threonine', 'T'), + TRP: new ResidueType('TRP', 'Tryptophan', 'W'), + TYR: new ResidueType('TYR', 'Tyrosine', 'Y'), + VAL: new ResidueType('VAL', 'Valine', 'V'), + A: new ResidueType('A', 'Adenine', 'A'), + C: new ResidueType('C', 'Cytosine', 'C'), + G: new ResidueType('G', 'Guanine', 'G'), + I: new ResidueType('I', 'Inosine', 'I'), + T: new ResidueType('T', 'Thymine', 'T'), + U: new ResidueType('U', 'Uracil', 'U'), + DA: new ResidueType('DA', 'Adenine', 'A'), + DC: new ResidueType('DC', 'Cytosine', 'C'), + DG: new ResidueType('DG', 'Guanine', 'G'), + DI: new ResidueType('DI', 'Inosine', 'I'), + DT: new ResidueType('DT', 'Thymine', 'T'), + DU: new ResidueType('DU', 'Uracil', 'U'), + '+A': new ResidueType('+A', 'Adenine', 'A'), + '+C': new ResidueType('+C', 'Cytosine', 'C'), + '+G': new ResidueType('+G', 'Guanine', 'G'), + '+I': new ResidueType('+I', 'Inosine', 'I'), + '+T': new ResidueType('+T', 'Thymine', 'T'), + '+U': new ResidueType('+U', 'Uracil', 'U'), + WAT: new ResidueType('WAT', 'Water', ''), + H2O: new ResidueType('H2O', 'Water', ''), + HOH: new ResidueType('HOH', 'Water', ''), + DOD: new ResidueType('DOD', 'Water', ''), + UNK: new ResidueType('UNK', 'Unknown', ''), + UNL: new ResidueType('UNL', 'Unknown Ligand', '') + /* eslint-enable no-magic-numbers */ + }))(); - for (var i = 0; i < molecules.length; i++) { - var chains = this._getMoleculeChains(molecules[i]); + /** + * Enumeration of residue flag values. + * + * @enum {number} + * @readonly + */ + static Flags = { + // Amino acids + /** Amino acid residue */ + PROTEIN: 0x0001, + /** Basic amino acid residue */ + BASIC: 0x0002, + /** Acidic amino acid residue */ + ACIDIC: 0x0004, + /** Polar uncharged side chain amino acid residue */ + POLAR: 0x0008, + /** Non-polar hydrophobic side chain amino acid residue */ + NONPOLAR: 0x0010, + /** Aromatic amino acid residue */ + AROMATIC: 0x0020, + // Nucleic acids - result.newString(); - result.writeString("MOL_ID: ".concat(molecules[i].index, ";"), 11, 80); - result.newString(); - result.writeString("MOLECULE: ".concat(molecules[i].name, ";"), 11, 80); - result.newString(); - result.writeString('CHAIN: ', 11, 18); - var chainsString = "".concat(chains.join(', '), ";"); - result.writeEntireString(chainsString, 81); - } - } - }, { - key: "_extractREMARK", - value: function _extractREMARK(result) { - this._Remark290(result); + /** Nucleic residue */ + NUCLEIC: 0x0100, + /** Purine nucleic residue */ + PURINE: 0x0200, + /** Pyrimidine nucleic residue */ + PYRIMIDINE: 0x0400, + /** DNA */ + DNA: 0x0800, + /** RNA */ + RNA: 0x1000, + /** Water */ + WATER: 0x10000 + }; +} - this._Remark350(result); +// Flag combinations +function _addFlag(flag, list) { + for (let i = 0, n = list.length; i < n; ++i) { + const res = ResidueType.StandardTypes[list[i]]; + if (res) { + res.flags |= flag; + } + } +} +const { + Flags +} = ResidueType; +_addFlag(Flags.WATER, ['WAT', 'H2O', 'HOH', 'DOD']); +_addFlag(Flags.PROTEIN, ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLY', 'GLU', 'GLN', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'PYL', 'SEC', 'SER', 'THR', 'TRP', 'TYR', 'VAL']); +_addFlag(Flags.BASIC, ['ARG', 'HIS', 'LYS']); +_addFlag(Flags.ACIDIC, ['ASP', 'GLU']); +_addFlag(Flags.POLAR, ['ASN', 'CYS', 'GLN', 'SER', 'THR', 'TYR']); +_addFlag(Flags.NONPOLAR, ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'VAL', 'GLY']); +_addFlag(Flags.AROMATIC, ['PHE', 'TRP', 'TYR']); +_addFlag(Flags.NUCLEIC, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I', 'C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']); +_addFlag(Flags.PURINE, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I']); +_addFlag(Flags.PYRIMIDINE, ['C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']); +_addFlag(Flags.DNA, ['DA', 'DG', 'DI', 'DC', 'DT', 'DU']); +_addFlag(Flags.RNA, ['A', 'G', 'I', 'C', 'T', 'U']); +// Table of kdHydrophobicity +const hydro = { + ILE: 4.5, + VAL: 4.2, + LEU: 3.8, + PHE: 2.8, + CYS: 2.5, + MET: 1.9, + ALA: 1.8, + GLY: -0.4, + THR: -0.7, + SER: -0.8, + TRP: -0.9, + TYR: -1.3, + PRO: -1.6, + HIS: -3.2, + GLU: -3.5, + GLN: -3.5, + ASP: -3.5, + ASN: -3.5, + LYS: -3.9, + ARG: -4.5 +}; +function _addParam(param, list) { + const keys = Object.keys(list); + for (let i = 0, n = keys.length; i < n; ++i) { + const key = keys[i]; + const value = list[key]; + ResidueType.StandardTypes[key][param] = value; + } +} +_addParam('hydrophobicity', hydro); +/* harmony default export */ const chem_ResidueType = (ResidueType); +;// CONCATENATED MODULE: ./src/chem/Chain.js + + + + +/** + * Residues in chain are either amino acid either nucleic acid (and water) + * There might be some modified/mutated residues, which type could not be determined by their name (nucleic or amino); In this + * case firstly program definites the chain type (by well-known residues) and then definites modified/mutated residues + */ +const ChainType = { + UNKNOWN: 0, + PROTEIN: 1, + NUCLEIC: 2 +}; + +/** + * Residue chain. + * + * @param {Complex} complex - Molecular complex this chain belongs to. + * @param {string} name - One character identifier (usually space, A-Z, 0-9, or a-z). + * + * @exports Chain + * @constructor + */ +class Chain { + constructor(complex, name) { + this._complex = complex; + this._name = name; + this._mask = 1 | 0; + this._index = -1; + this._residues = []; + this.minSequence = Number.POSITIVE_INFINITY; + this.maxSequence = Number.NEGATIVE_INFINITY; + } + getComplex() { + return this._complex; + } + getName() { + return this._name; + } + getResidues() { + return this._residues; + } + _determineType() { + const residues = this._residues; + const { + PROTEIN, + NUCLEIC + } = chem_ResidueType.Flags; + this.type = ChainType.UNKNOWN; + for (let i = 0, n = residues.length; i < n; ++i) { + const { + flags + } = residues[i]._type; + if ((flags & NUCLEIC) !== 0) { + this.type = ChainType.NUCLEIC; + break; + } else if ((flags & PROTEIN) !== 0) { + this.type = ChainType.PROTEIN; + break; } - }, { - key: "_Remark290", - value: function _Remark290(result) { - if (!this._source.symmetry) { - return; - } + } + } - if (this._source.symmetry.length !== 0) { - var matrices = this._source.symmetry; - result.newTag('REMARK', 290); - result.newString(); - result.newString(); - result.writeEntireString(this._stringForRemark290); - result.writeMatrices(matrices, 'SMTRY'); - result.newString(); - result.newString(); - result.writeString('REMARK: NULL', 11, 80); - } + /** + * Finds thre residue with specified sequence number and inserion code + * @param {Number} seqNum sequence number + * @param {string} iCode insertion code + * @returns {*} Residue or null if not found + */ + findResidue(seqNum, iCode) { + const residues = this._residues; + for (let i = 0, n = residues.length; i < n; ++i) { + const res = residues[i]; + if (res._sequence === seqNum && res._icode === iCode) { + return [res, i]; } - }, { - key: "_Remark350", - value: function _Remark350(result) { - if (!this._source.units) { - return; - } - - var units = this._source.units; - var biomolIndx = 0; - result.newTag('REMARK', 350); - result.newString(); - result.newString(); - result.writeEntireString(this._stringForRemark350); - var assemblies = units.filter(function (unit) { - return unit instanceof Assembly; - }); + } + return null; + } + _finalize() { + this._determineType(); + const residues = this._residues; + let prev = null; + for (let i = 0, n = residues.length; i < n; ++i) { + const next = i + 1 < n ? residues[i + 1] : null; + const curr = residues[i]; + // TODO: skip invalid residues + if (true /* curr._isValid */) { + // eslint-disable-line no-constant-condition + curr._finalize2(prev, next, this.type === ChainType.NUCLEIC); + prev = curr; + } + } + + // fix very first wing + if (residues.length > 1 && residues[1]._wingVector) { + const p = residues[1]._wingVector; + residues[0]._wingVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(p.x, p.y, p.z); + } else if (residues.length > 0) { + residues[0]._wingVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1, 0, 0); + } + } + updateToFrame(frameData) { + const residues = this._residues; + let prev = null; + let prevData = null; + const frameRes = frameData._residues; + const n = residues.length; + function getAtomPos(atom) { + return frameData.getAtomPos(atom.index); + } + for (let i = 0; i < n; ++i) { + const curr = residues[i]; + const currData = frameRes[curr._index]; + const nextRes = i + 1 < n ? residues[i + 1] : null; + curr._innerFinalize(prev, prevData, nextRes, currData, this.type === ChainType.NUCLEIC, getAtomPos); + prev = curr; + prevData = currData; + } + frameRes[residues[0]._index]._wingVector = n > 1 ? frameRes[residues[1]._index]._wingVector : new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1, 0, 0); + } - for (var i = 0; i < assemblies.length; i++) { - result.newString(); - result.newString(); - biomolIndx++; - result.writeString("BIOMOLECULE: ".concat(biomolIndx), 11, 80); - var chains = assemblies[i].chains.join(', '); - result.newString(); - result.writeString('APPLY THE FOLLOWING TO CHAINS: '); - result.writeEntireString(chains, 69, { - tag: 'AND CHAINS: ', - begin: 31, - end: 42 - }); - var matrices = assemblies[i].matrices; - result.writeMatrices(matrices, 'BIOMT'); - } + /** + * Create a new residue. + * + * @param {string} name - Residue name. + * @param {number} sequence - Residue sequence number. + * @param {string} iCode - Insertion code. + * @returns {Residue} - Newly created residue instance. + */ + addResidue(name, sequence, iCode) { + let type = this._complex.getResidueType(name); + if (type === null) { + type = this._complex.addResidueType(name); + } + const residue = new chem_Residue(this, type, sequence, iCode); + this._complex.addResidue(residue); + this._residues.push(residue); + if (type.flags & (chem_ResidueType.Flags.NUCLEIC | chem_ResidueType.Flags.PROTEIN)) { + if (this.maxSequence < sequence) { + this.maxSequence = sequence; } - }, { - key: "_getMoleculeChains", - value: function _getMoleculeChains(molecule) { - function getChainName(residue) { - return residue._chain._name; - } - - var chainNames = molecule.residues.map(getChainName); - return chainNames.filter(function (item, pos) { - return chainNames.indexOf(item) === pos; - }); + if (this.minSequence > sequence) { + this.minSequence = sequence; } - }]); - - return PDBExporter; - }(Exporter); - PDBExporter.formats = ['pdb']; - PDBExporter.SourceClass = Complex; - - var FBX_POS_SIZE = 3; - var FBX_NORM_SIZE = 3; - var FBX_COL_SIZE = 4; - - function copyFbxPoint3(src, srcIdx, dst, dstIdx) { - dst[dstIdx] = src[srcIdx]; - dst[dstIdx + 1] = src[srcIdx + 1]; - dst[dstIdx + 2] = src[srcIdx + 2]; + } + return residue; } - - function copyFbxPoint4(src, srcIdx, dst, dstIdx, value) { - dst[dstIdx] = src[srcIdx]; - dst[dstIdx + 1] = src[srcIdx + 1]; - dst[dstIdx + 2] = src[srcIdx + 2]; - dst[dstIdx + 3] = value; + getResidueCount() { + return this._residues.length; } - - var vector4 = new THREE.Vector4(); - - function copyTransformedPoint3(src, srcIdx, dst, dstIdx, opts) { - vector4.set(src[srcIdx], src[srcIdx + 1], src[srcIdx + 2], opts.w); - vector4.applyMatrix4(opts.matrix); - dst[dstIdx] = vector4.x; - dst[dstIdx + 1] = vector4.y; - dst[dstIdx + 2] = vector4.z; + forEachResidue(process) { + const residues = this._residues; + for (let i = 0, n = residues.length; i < n; ++i) { + process(residues[i]); + } } - - function setSubArray(src, dst, count, copyFunctor, functorOpts) { - if ((dst.array.length - dst.start) / dst.stride < count || (src.array.length - src.start) / src.stride < count) { - return; // we've got no space + collectMask() { + let mask = 0xffffffff; + const residues = this._residues; + for (let i = 0, n = residues.length; i < n; ++i) { + mask &= residues[i]._mask; } + this._mask = mask; + } +} +/* harmony default export */ const chem_Chain = (Chain); +;// CONCATENATED MODULE: ./src/chem/StructuralElement.js - if (src.stride === dst.stride) { - // stride is the same - dst.array.set(src.array, dst.start); - } else { - var idx = dst.start; - var arridx = src.start; - for (var i = 0; i < count; ++i, idx += dst.stride, arridx += src.stride) { - copyFunctor(src.array, arridx, dst.array, idx, functorOpts); - } - } +/** An element of protein secondary structure. */ +class StructuralElement { + /** + * Create a secondary structural element of the specified type. + * + * @param {StructuralElement.Type} type Secondary structure type. + * @param {Residue} init Initial residue. + * @param {Residue} term Terminal residue. + */ + constructor(type, init, term) { + /** + * Secondary structure type. + * @type {StructuralElement.Type} + */ + this.type = type; + /** + * Generic secondary structure type. + * @type {StructuralElement.Generic} + */ + this.generic = StructuralElement.genericByType[this.type] || 'loop'; + /** + * Initial residue. + * @type Residue + */ + this.init = init; + /** + * Terminal residue. + * @type Residue + */ + this.term = term; } - var FBXModel = /*#__PURE__*/function () { - function FBXModel() { - classCallCheck(this, FBXModel); - - this.positions = null; - this.normals = null; - this.colors = null; - this.indices = null; - this.lastPos = 0; - this.lastNorm = 0; - this.lastCol = 0; - this.lastIdx = 0; + /** + * An internal method for making a final pass over the complex to set all required references. + * + * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring. + * Just copying it as-is right now and hoping for the best. + * + * @param {object} serialAtomMap A dictionary of atoms + * @param {object} residueHash A dictionary of hashed residues to check. + * @param {Complex} complex The molecular complex this element belongs to. + */ + _finalize(serialAtomMap, residueHash, complex) { + if (this.init instanceof chem_Residue && this.term instanceof chem_Residue) { + return; } - createClass(FBXModel, [{ - key: "init", - value: function init(vertsCount, indsCount) { - this.positions = new Float32Array(vertsCount * FBX_POS_SIZE); - this.normals = new Float32Array(vertsCount * FBX_NORM_SIZE); - this.colors = new Float32Array(vertsCount * FBX_COL_SIZE); - this.indices = new Int32Array(indsCount); - } - }, { - key: "setPositions", - value: function setPositions(array, start, count, stride) { - var src = { - array: array, - start: start, - stride: stride - }; - var dst = { - array: this.positions, - start: this.lastPos, - stride: FBX_POS_SIZE - }; - setSubArray(src, dst, count, copyFbxPoint3); - this.lastPos += count * FBX_POS_SIZE; - } - }, { - key: "setTransformedPositions", - value: function setTransformedPositions(array, start, count, stride, matrix) { - var idx = this.lastPos; - var arrIdx = start; - var opts = { - matrix: matrix, - w: 1 - }; - - for (var i = 0; i < count; ++i, arrIdx += stride, idx += FBX_POS_SIZE) { - copyTransformedPoint3(array, arrIdx, this.positions, idx, opts); + // Link all intermediate residues to this structural element + const start = complex.splitUnifiedSerial(this.init); + const end = complex.splitUnifiedSerial(this.term); + for (let chainId = start.chain; chainId <= end.chain; chainId++) { + for (let serialId = start.serial; serialId <= end.serial; serialId++) { + for (let { + iCode + } = start; iCode <= end.iCode; iCode++) { + const hashCode = complex.getUnifiedSerial(chainId, serialId, iCode); + if (residueHash[hashCode]) { + residueHash[hashCode]._secondary = this; + } } - - this.lastPos += count * FBX_POS_SIZE; - } - }, { - key: "setNormals", - value: function setNormals(array, start, count, stride) { - var src = { - array: array, - start: start, - stride: stride - }; - var dst = { - array: this.normals, - start: this.lastNorm, - stride: FBX_NORM_SIZE - }; - setSubArray(src, dst, count, copyFbxPoint3); - this.lastNorm += count * FBX_NORM_SIZE; } - }, { - key: "setTransformedNormals", - value: function setTransformedNormals(array, start, count, stride, matrix) { - var idx = this.lastNorm; - var arrIdx = start; - var opts = { - matrix: matrix, - w: 0 - }; + } - for (var i = 0; i < count; ++i, arrIdx += stride, idx += FBX_NORM_SIZE) { - copyTransformedPoint3(array, arrIdx, this.normals, idx, opts); - } + // Replace unfined serials by objects + this.init = residueHash[this.init]; + this.term = residueHash[this.term]; + } +} + +/** + * Specific type of a secondary structural element. + * @enum {string} + * @see StructuralElement.Generic + */ +StructuralElement.Type = { + /** A strand of a [beta-sheet](https://en.wikipedia.org/wiki/Beta_sheet). */ + STRAND: 'E', + /** An isolated beta-bridge (too small for a beta-sheet). */ + BRIDGE: 'B', + /** A [3/10 helix](https://en.wikipedia.org/wiki/310_helix) (hydrogen bonding is 3 residues apart). */ + HELIX_310: 'G', + /** An [alpha-helix](https://en.wikipedia.org/wiki/Alpha_helix) (hydrogen bonding is 4 residues apart). */ + HELIX_ALPHA: 'H', + /** A [pi-helix](https://en.wikipedia.org/wiki/Pi_helix) (hydrogen bonding is 5 residues apart). */ + HELIX_PI: 'I', + /** A generic helix of unspecified bonding distance. */ + HELIX: 'X', + /** An isolated 3/10-like helical turn. */ + TURN_310: '3', + /** An isolated alpha-like helical turn. */ + TURN_ALPHA: '4', + /** An isolated pi-like helical turn. */ + TURN_PI: '5', + /** An isolated helical [turn](https://en.wikipedia.org/wiki/Turn_(biochemistry)) of unspecified bonding distance. */ + TURN: 'T', + /** A bend (a region of high curvature). */ + BEND: 'S', + /** Just a protein section with no particular conformation. */ + COIL: 'C' +}; + +/** + * Generic type of a secondary structural element. + * @enum {string} + * @see StructuralElement.Type + */ +StructuralElement.Generic = { + /** A strand of a sheet. */ + STRAND: 'strand', + /** A helix. */ + HELIX: 'helix', + /** Just a protein section with no particular conformation. */ + LOOP: 'loop' +}; +const StructuralElementType = StructuralElement.Type; +const StructuralElementGeneric = StructuralElement.Generic; + +/** + * A mapping from specific types to generic ones. + * @type {Object} + */ +StructuralElement.genericByType = { + [StructuralElementType.STRAND]: StructuralElementGeneric.STRAND, + [StructuralElementType.HELIX_310]: StructuralElementGeneric.HELIX, + [StructuralElementType.HELIX_ALPHA]: StructuralElementGeneric.HELIX, + [StructuralElementType.HELIX_PI]: StructuralElementGeneric.HELIX, + [StructuralElementType.HELIX]: StructuralElementGeneric.HELIX +}; +/* harmony default export */ const chem_StructuralElement = (StructuralElement); +;// CONCATENATED MODULE: ./src/chem/Helix.js + +const Helix_StructuralElementType = chem_StructuralElement.Type; +const typeByPDBHelixClass = { + 1: Helix_StructuralElementType.HELIX_ALPHA, + 3: Helix_StructuralElementType.HELIX_PI, + 5: Helix_StructuralElementType.HELIX_310 +}; + +/** + * Helical secondary structure of a protein. + * @extends StructuralElement + */ +class Helix extends chem_StructuralElement { + /** + * Create a helix. + * + * @param {number} helixClass A helix class according to the + * [PDB Format](http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX). + * @param {Residue} init Initial residue. + * @param {Residue} term Terminal residue. + * @param {number} serial Serial number of the helix (see PDB Format). + * @param {string} name Helix identifier (see PDB Format). + * @param {string} comment Comment about this helix (see PDB Format). + * @param {number} length Length of this helix, in residues (see PDB Format). + */ + constructor(helixClass, init, term, serial, name, comment, length) { + super(typeByPDBHelixClass[helixClass] || chem_StructuralElement.Type.HELIX, init, term); - this.lastNorm += count * FBX_NORM_SIZE; - } - }, { - key: "setColors", - value: function setColors(array, start, count, stride) { - var src = { - array: array, - start: start, - stride: stride - }; - var dst = { - array: this.colors, - start: this.lastCol, - stride: FBX_COL_SIZE - }; - setSubArray(src, dst, count, copyFbxPoint4, 1); - this.lastCol += count * FBX_COL_SIZE; - } - }, { - key: "setIndices", - value: function setIndices(array, start, count) { - this.indices.set(array, this.lastIdx); - this.lastIdx += count; - } - }, { - key: "setShiftedIndices", - value: function setShiftedIndices(array, count, shift) { - var shifted = array.map(function (x) { - return x + shift; - }); - this.setIndices(shifted, 0, count); - } - }, { - key: "getVerticesNumber", - value: function getVerticesNumber() { - return this.lastPos / FBX_POS_SIZE; - } - }, { - key: "addInstance", - value: function addInstance(matrix, geo) { - // add indices at first to take old number of vertices for shift - var currentCount = this.getVerticesNumber(); - this.setShiftedIndices(geo.indices, geo.indices.length, currentCount); // simply write vertices at empty space + /** + * Serial number of the helix (see PDB Format). + * @type {number} + */ + this.serial = serial; + /** + * Helix identifier (see PDB Format). + * @type {string} + */ + this.name = name; + /** + * Comment about this helix (see PDB Format). + * @type {string} + */ + this.comment = comment; + /** + * Length of this helix, in residues (see PDB Format). + * @type {number} + */ + this.length = length; + } +} +/* harmony default export */ const chem_Helix = (Helix); +;// CONCATENATED MODULE: ./src/chem/Strand.js - var size = geo.itemSize; - this.setTransformedPositions(geo.positions, 0, geo.vertsCount, size.position, matrix); - this.setTransformedNormals(geo.normals, 0, geo.vertsCount, size.normal, matrix); - this.setColors(geo.colors, 0, geo.vertsCount, size.color); - } - }]); - return FBXModel; - }(); +/** + * A single strand of a sheet in a protein secondary structure. + * @extends StructuralElement + */ +class Strand extends chem_StructuralElement { + /** + * Create a strand. + * + * @param {Sheet} sheet Parent sheet this strand belongs to. + * @param {Residue} init Initial residue. + * @param {Residue} term Terminal residue. + * @param {number} sense Sense of strand with respect to previous strand in the sheet. + * - 0 if the first strand, + * - 1 if parallel, and + * - -1 if anti-parallel. + * @param {Atom} atomCur Atom in current strand (see PDB Format). + * @param {Atom} atomPrev Atom in previous strand (see PDB Format). + */ + constructor(sheet, init, term, sense, atomCur, atomPrev) { + super(chem_StructuralElement.Type.STRAND, init, term); - /** Base class for fbx geometry contains simply organized attributes: positions+normals+colors, indices. */ - var FBXGeometry = /*#__PURE__*/function () { /** - * Create a base geo with necessary members. + * Parent sheet this strand belongs to. + * @type {Sheet} + */ + this.sheet = sheet; + /** + * Sense of strand with respect to previous strand in the sheet. + * - 0 if the first strand, + * - 1 if parallel, and + * - -1 if anti-parallel. + * @type {number} + */ + this.sense = sense; + /** + * Atom in current strand (see PDB Format). + * @type {Atom} */ - function FBXGeometry() { - classCallCheck(this, FBXGeometry); - - this.positions = null; - this.normals = null; - this.colors = null; - this.indices = null; - this.vertsCount = 0; - this.itemSize = null; - } + this.atomCur = atomCur; /** - * Initialize base geo storing items info from attributes. - * @param {Object} geo - THREE.Geometry. + * Atom in previous strand (see PDB Format). + * @type {Atom} */ - - - createClass(FBXGeometry, [{ - key: "init", - value: function init(geo, _info) { - var attributes = geo.attributes; // save item size - - this.itemSize = { - position: attributes.position.itemSize, - normal: attributes.normal.itemSize, - color: attributes.color.itemSize - }; - } - }]); - - return FBXGeometry; - }(); + this.atomPrev = atomPrev; + } /** - * Fbx geometry, that copies positions+normals, indexes and creates colors filled with defined value. - * @extends FBXGeometry + * An internal method for making a final pass over the complex to set all required references. + * + * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring. + * Just copying it as-is right now and hoping for the best. + * + * @param {object} serialAtomMap A dictionary of atoms + * @param {object} residueHash A dictionary of hashed residues to check. + * @param {Complex} complex The molecular complex this element belongs to. + * + * @override */ - - var FBX1CGeometry = /*#__PURE__*/function (_FBXGeometry) { - inherits(FBX1CGeometry, _FBXGeometry); - - function FBX1CGeometry() { - classCallCheck(this, FBX1CGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(FBX1CGeometry).apply(this, arguments)); + _finalize(serialAtomMap, residueHash, complex) { + super._finalize(serialAtomMap, residueHash, complex); + let as = this.atomCur; + if (as !== null && !Number.isNaN(as)) { + this.atomCur = serialAtomMap[as]; } + as = this.atomPrev; + if (as !== null && !Number.isNaN(as)) { + this.atomPrev = serialAtomMap[as]; + } + } +} +/* harmony default export */ const chem_Strand = (Strand); +;// CONCATENATED MODULE: ./src/chem/Sheet.js + + +/** + * Sheet secondary structure of a protein. + * + * @param {string} name - + * @param {number} width - + * + * @exports Sheet + * @constructor + */ +class Sheet { + constructor(name, width) { + this._name = name; + this._width = width; + this._strands = []; + } - createClass(FBX1CGeometry, [{ - key: "init", + // Getters and setters + getName() { + return this._name; + } + getWidth() { + return this._width; + } + addStrand(strand) { + this._strands.push(strand); + this._width = this._strands.length; + } + addEmptyStrand() { + this._strands.push(new chem_Strand(null, null, null, null, null, null)); + } + _finalize(serialAtomMap, residueHash, complex) { + const s = this._strands; + for (let i = 0, n = s.length; i < n; ++i) { + s[i]._finalize(serialAtomMap, residueHash, complex); + } + if (!this._width) { + this._width = s.length; + } + if (s.length !== this._width) { + throw new Error(`Sheet ${this._name} is inconsistent.`); + } + } +} +/* harmony default export */ const chem_Sheet = (Sheet); +;// CONCATENATED MODULE: ./src/chem/SGroup.js + + +/** + * Atom measurements. + * + * @param {string} id - SGroup id + * @param {string} name - Name of the group + * @param {THREE.Vector3} position - Registered coordinates + * @param {array} atoms - Atoms group consists of + * @param {object} saveNode - XML node from file for saving + * + * @exports SGroup + * @constructor + */ +class SGroup { + constructor(id, name, position, atoms, saveNode) { + this._id = id; + this._name = name; + this._position = position || new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._atoms = atoms || []; + this._charge = 0; // default group charge + this._repeat = 1; // how many times group repeated: always > 0 + this._center = null; + this.xmlNodeRef = saveNode || null; + } - /** - * Initialize geo storing positions, normals, indices and create colors. - * @param {Object} geo - THREE.Geometry. - */ - value: function init(geo, _info) { - get(getPrototypeOf(FBX1CGeometry.prototype), "init", this).call(this, geo, _info); + /** + * Get atom full name. + * @returns {string} Atom full name. + */ + getName() { + return this._name; + } + getPosition() { + return this._position; + } + getCentralPoint() { + return this._center; + } + _rebuildSGroupOnAtomChange() { + const nLimon = 100000000; + if (this._center === null) { + return; // nothing to do if we are not relative + } + const bLow = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(nLimon, nLimon, nLimon); + const bHight = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-nLimon, -nLimon, -nLimon); + for (let j = 0, n = this._atoms.length; j < n; j++) { + const aPos = this._atoms[j].position; + bLow.set(Math.min(bLow.x, aPos.x), Math.min(bLow.y, aPos.y), Math.min(bLow.z, aPos.z)); + bHight.set(Math.max(bHight.x, aPos.x), Math.max(bHight.y, aPos.y), Math.max(bHight.z, aPos.z)); + } + this._center.addVectors(bLow, bHight); + this._center.multiplyScalar(0.5); + } +} +/* harmony default export */ const chem_SGroup = (SGroup); +// EXTERNAL MODULE: ./src/utils/SelectionParser.js +var SelectionParser = __webpack_require__(99); +;// CONCATENATED MODULE: ./src/chem/selectors/selectArgs.js + + +//---------------------------------------------------------------------------- +class Range { + constructor(min, max) { + this.min = min; + this.max = typeof max === 'undefined' ? min : max; + } + includes(value) { + return this.min <= value && value <= this.max; + } + toString() { + const { + min, + max + } = this; + return min === max ? String(min) : [min, max].join(':'); + } + toJSON() { + return [this.min, this.max]; + } +} - var _geo$attributes = geo.attributes, - position = _geo$attributes.position, - normal = _geo$attributes.normal, - index = geo.index; // copy vertices attributes +// //////////////////////////////////////////////////////////////////////////// - this.vertsCount = position.count; - this.positions = position.array; - this.normals = normal.array; // create color array +class List { + constructor(arg) { + if (arg instanceof this.constructor) { + // delegate construction to a different class + // eslint-disable-next-line no-constructor-return + return arg; + } + if (arg instanceof Array) { + this._values = arg.slice(0); + } else if (arg) { + this._values = [arg]; + } else { + this._values = []; + } + } + append(value) { + const values = this._values; + values[values.length] = value; + return this; + } + remove(value) { + const values = this._values; + const index = values.indexOf(value); + if (index >= 0) { + values.splice(index, 1); + } + return this; + } + toString() { + return this._values.join(','); + } + toJSON() { + const values = this._values; + const result = []; + for (let i = 0, n = values.length; i < n; ++i) { + const value = values[i]; + result[i] = value.toJSON ? value.toJSON() : value; + } + return result; + } +} - this.colors = new Float32Array(this.vertsCount * this.itemSize.color); // indices +//---------------------------------------------------------------------------- - this.indices = index.array; +class RangeList extends List { + includes(value) { + const list = this._values; + for (let i = 0, n = list.length; i < n; ++i) { + if (list[i].includes(value)) { + return true; } - /** - * Set defined color for all items in color attribute - * @param {Object} color - THREE.Color. - */ + } + return false; + } +} - }, { - key: "setColors", - value: function setColors(color) { - var offset = 0; +//---------------------------------------------------------------------------- - for (var i = 0, l = this.colors.length, cl = this.itemSize.color; i < l; i += cl) { - this.colors[offset++] = color.r; - this.colors[offset++] = color.g; - this.colors[offset++] = color.b; +const valuesArray = []; +class ValueList extends List { + constructor(arg, upperOnly) { + const list = super(arg); + if (upperOnly) { + this.upperOnly = true; + const values = list._values; + for (let i = 0, n = values.length; i < n; ++i) { + const value = values[i]; + if (typeof value === 'string') { + values[i] = value.toUpperCase(); } } - }]); + } else { + this.upperOnly = false; + } + // return constructed object + // eslint-disable-next-line no-constructor-return + return list; + } + includes(value) { + // we do not convert to upper case here for perfomance reasons + // if list is upper case only, value must be converted before it is sent up to here + return this._values.indexOf(value) !== -1; + } + toString() { + // Quote values that are not correct identifiers + const values = this._values; + valuesArray.length = 0; + for (let i = 0, n = values.length; i < n; ++i) { + valuesArray[i] = utils.correctSelectorIdentifier(String(values[i])); + } + return valuesArray.join(','); + } + _validate(value) { + return this.upperOnly && typeof value === 'string' ? value.toUpperCase() : value; + } + append(value) { + super.append(this._validate(value)); + return this; + } + remove(value) { + super.remove(this._validate(value)); + return this; + } +} - return FBX1CGeometry; - }(FBXGeometry); +;// CONCATENATED MODULE: ./src/chem/selectors/selectorsBase.js - /** - * Fbx geometry, that copies positions+normals, indexes from cylinder geometry and creates colors filled with two - * defined values. - * @extends FBXGeometry - */ - var FBX2CCylinder = /*#__PURE__*/function (_FBXGeometry) { - inherits(FBX2CCylinder, _FBXGeometry); +/** Base class for atom selectors. */ +class Selector { + toString() { + return this.keyword; + } + toJSON() { + return [this.name]; + } +} +Selector.prototype.name = 'Error'; +Selector.prototype.keyword = 'error'; + +/** Base class for list-based atom selectors. */ +class ListSelector extends Selector { + constructor(list) { + super(); + this.list = list; + } + toString() { + return `${this.keyword} ${this.list}`; + } + toJSON() { + return [this.name, this.list.toJSON()]; + } +} +class RangeListSelector extends ListSelector { + constructor(arg) { + super(new RangeList(arg)); + } +} +class ValueListSelector extends ListSelector { + constructor(arg, caseSensitive) { + super(new ValueList(arg, !caseSensitive)); + } +} +class NoneSelector extends Selector { + includesAtom(_atom) { + return false; + } +} +NoneSelector.prototype.name = 'None'; +NoneSelector.prototype.keyword = 'none'; +class AllSelector extends Selector { + includesAtom(_atom) { + return true; + } +} +AllSelector.prototype.name = 'All'; +AllSelector.prototype.keyword = 'all'; - function FBX2CCylinder() { - var _this; +;// CONCATENATED MODULE: ./src/chem/selectors/selectOps.js - classCallCheck(this, FBX2CCylinder); - _this = possibleConstructorReturn(this, getPrototypeOf(FBX2CCylinder).call(this)); - _this._cutRawStart = 0; - _this._cutRawEnd = 0; - _this._facesPerSlice = 0; - return _this; - } - /** - * Initialize geo by creating new attributes, because we extend number of vertices to make cylinder two-colored. - * Indices remain the same. We process open- end close-ended cylinders and consider cylinders od 2 segments - * in height ONLY. - * NOTE: cylinder consists of 2 height segments and stores parts in the order: tube, topCap, bottomCap - * @param {Object} geo - THREE.Geometry. - * @param {Object} info - information needed for geo extend - */ +//---------------------------------------------------------------------------- +// Operators +//---------------------------------------------------------------------------- +const none = new NoneSelector(); +class PrefixOperator extends Selector { + constructor(rhs) { + super(); + this.rhs = rhs || none; + } + toString() { + const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs; + return `${this.keyword} ${rhs}`; + } + toJSON() { + return [this.name, this.rhs.toJSON()]; + } +} +PrefixOperator.prototype.priority = 1; +class InfixOperator extends Selector { + constructor(lhs, rhs) { + super(); + this.lhs = lhs || none; + this.rhs = rhs || none; + } + toString() { + const lhs = this.lhs.priority && this.lhs.priority > this.priority ? `(${this.lhs})` : this.lhs; + const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs; + return `${lhs} ${this.keyword} ${rhs}`; + } + toJSON() { + return [this.name, this.lhs.toJSON(), this.rhs.toJSON()]; + } +} +InfixOperator.prototype.priority = 1000; +;// CONCATENATED MODULE: ./src/chem/selectors.js - createClass(FBX2CCylinder, [{ - key: "init", - value: function init(geo, info) { - get(getPrototypeOf(FBX2CCylinder.prototype), "init", this).call(this, geo, info); - var position = geo.attributes.position, - index = geo.index; // extend vertices arrays - this.vertsCount = position.count + info.addPerCylinder; - this._facesPerSlice = info.addPerCylinder; - this.positions = new Float32Array(this.vertsCount * position.itemSize); - this.normals = new Float32Array(this.vertsCount * this.itemSize.normal); - this.colors = new Float32Array(this.vertsCount * this.itemSize.color); - this._extendVertices(geo, info); // number of indices stays the same - this.indices = new Uint32Array(index.count); +const keywords = {}; - this._extendIndices(geo, info); - } - /** Extend vertex attributes to have one more slice to make sharp middle startColor-endColor line. */ +//---------------------------------------------------------------------------- +// Named selectors +//---------------------------------------------------------------------------- - }, { - key: "_extendVertices", - value: function _extendVertices(geo, info) { - var position = geo.attributes.position; - var normal = geo.attributes.normal; - var geoParams = geo.getGeoParams(); - var cutRaw = 1; // we expect cylinders of 2 segments in height => so half segment = 1 +function defineSelector(name, SelectorClass) { + const keyword = name.toLowerCase(); + SelectorClass.prototype.keyword = keyword; + SelectorClass.prototype.name = name; + const factory = function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + return new SelectorClass(...args); + }; + factory.SelectorClass = SelectorClass; + keywords[keyword] = factory; + return SelectorClass; +} +defineSelector('Serial', class SerialSelector extends RangeListSelector { + includesAtom(atom) { + return this.list.includes(atom.serial); + } +}); +defineSelector('Name', class NameSelector extends ValueListSelector { + includesAtom(atom) { + return this.list.includes(atom.name); + } +}); +defineSelector('AltLoc', class AltLocSelector extends ValueListSelector { + includesAtom(atom) { + return this.list.includes(String.fromCharCode(atom.location)); + } +}); +defineSelector('Elem', class ElemSelector extends ValueListSelector { + includesAtom(atom) { + return this.list.includes(atom.element.name); + } +}); +defineSelector('Residue', class ResidueSelector extends ValueListSelector { + includesAtom(atom) { + return this.list.includes(atom.residue._type._name); + } +}); +defineSelector('Sequence', class SequenceSelector extends RangeListSelector { + includesAtom(atom) { + return this.list.includes(atom.residue._sequence); + } +}); +defineSelector('ICode', class ICodeSelector extends ValueListSelector { + constructor(arg) { + super(arg, true); + } + includesAtom(atom) { + return this.list.includes(atom.residue._icode); + } +}); +defineSelector('ResIdx', class ResIdxSelector extends RangeListSelector { + includesAtom(atom) { + return this.list.includes(atom.residue._index); + } +}); +defineSelector('Chain', class ChainSelector extends ValueListSelector { + constructor(arg) { + super(arg, true); + } + includesAtom(atom) { + return this.list.includes(atom.residue._chain._name); + } +}); +defineSelector('Hetatm', class HetatmSelector extends Selector { + includesAtom(atom) { + return atom.het; + } +}); +defineSelector('PolarH', class PolarHSelector extends Selector { + includesAtom(atom) { + return (atom.flags & chem_Atom.Flags.NONPOLARH) === chem_Atom.Flags.HYDROGEN; + } +}); +defineSelector('NonPolarH', class NonPolarHSelector extends Selector { + includesAtom(atom) { + return (atom.flags & chem_Atom.Flags.NONPOLARH) === chem_Atom.Flags.NONPOLARH; + } +}); +defineSelector('All', AllSelector); +defineSelector('None', NoneSelector); +const NULL_SELECTOR = keywords.none(); + +//---------------------------------------------------------------------------- +// Named operators +//---------------------------------------------------------------------------- + +function defineOperator(name, priority, OperatorClass) { + OperatorClass.prototype.priority = priority; + return defineSelector(name, OperatorClass); +} +defineOperator('Not', 1, class NotOperator extends PrefixOperator { + includesAtom(atom) { + return !this.rhs.includesAtom(atom); + } +}); +defineOperator('And', 2, class AndOperator extends InfixOperator { + includesAtom(atom) { + return this.lhs.includesAtom(atom) && this.rhs.includesAtom(atom); + } +}); +defineOperator('Or', 3, class OrOperator extends InfixOperator { + includesAtom(atom) { + return this.lhs.includesAtom(atom) || this.rhs.includesAtom(atom); + } +}); - this._cutRawStart = cutRaw * geoParams.radialSegments; - this._cutRawEnd = this._cutRawStart + info.addPerCylinder; - { - // write first half of cylinder - var temp = position.array.slice(0, this._cutRawEnd * position.itemSize); - this.positions.set(temp, 0); - temp = normal.array.slice(0, this._cutRawEnd * normal.itemSize); - this.normals.set(temp, 0); - } - { - // write second part of cylinder - var _temp = position.array.slice(this._cutRawStart * position.itemSize, position.array.length); +//---------------------------------------------------------------------------- +// Flag selectors +//---------------------------------------------------------------------------- - this.positions.set(_temp, this._cutRawEnd * position.itemSize); - _temp = normal.array.slice(this._cutRawStart * normal.itemSize, normal.array.length); - this.normals.set(_temp, this._cutRawEnd * normal.itemSize); +function byResidueTypeFlag(flag, name) { + return defineSelector(name, class extends Selector { + includesAtom(atom) { + return (atom.residue._type.flags & flag) !== 0; + } + }); +} +byResidueTypeFlag(chem_ResidueType.Flags.PROTEIN, 'Protein'); +byResidueTypeFlag(chem_ResidueType.Flags.BASIC, 'Basic'); +byResidueTypeFlag(chem_ResidueType.Flags.ACIDIC, 'Acidic'); +byResidueTypeFlag(chem_ResidueType.Flags.BASIC | chem_ResidueType.Flags.ACIDIC, 'Charged'); +byResidueTypeFlag(chem_ResidueType.Flags.POLAR, 'Polar'); +byResidueTypeFlag(chem_ResidueType.Flags.NONPOLAR, 'NonPolar'); +byResidueTypeFlag(chem_ResidueType.Flags.AROMATIC, 'Aromatic'); +byResidueTypeFlag(chem_ResidueType.Flags.NUCLEIC, 'Nucleic'); +byResidueTypeFlag(chem_ResidueType.Flags.PURINE, 'Purine'); +byResidueTypeFlag(chem_ResidueType.Flags.PYRIMIDINE, 'Pyrimidine'); +byResidueTypeFlag(chem_ResidueType.Flags.WATER, 'Water'); + +//---------------------------------------------------------------------------- +const selectors = Object.create(keywords); +selectors.Selector = Selector; +selectors.RangeListSelector = RangeListSelector; +selectors.ValueListSelector = ValueListSelector; +selectors.Range = Range; +selectors.RangeList = RangeList; +selectors.ValueList = ValueList; +selectors.PrefixOperator = PrefixOperator; +selectors.InfixOperator = InfixOperator; +selectors.Context = Object.create({}); +selectors.GetSelector = function (key) { + if (!selectors.Context.hasOwnProperty(key)) { + const exc = { + message: `selector ${key} is not registered` + }; + throw exc; + } + return selectors.Context[key] || NULL_SELECTOR; +}; +selectors.ClearContext = function () { + Object.keys(selectors.Context).forEach(k => { + delete selectors.Context[k]; + }); +}; +selectors.keyword = function (key) { + return keywords[key.toLowerCase()] || keywords.none; +}; +selectors.parse = function (str) { + const res = {}; + try { + res.selector = SelectionParser.parser.parse(str); + } catch (e) { + res.selector = NULL_SELECTOR; + res.error = e.message; + } + return res; +}; +SelectionParser.parser.yy = selectors; +SelectionParser.parser.yy.parseError = SelectionParser.parser.parseError; // workaround for incorrect JISON parser generator for AMD module + +/* harmony default export */ const chem_selectors = (selectors); +;// CONCATENATED MODULE: ./src/chem/BiologicalUnit.js + + + +/** + * Basic biological unit class. + * + * @exports BiologicalUnit + * @constructor + */ +class BiologicalUnit { + constructor(complex) { + this._complex = complex; + this._selector = chem_selectors.keyword('All')(); + this._boundaries = { + boundingBox: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(), + boundingSphere: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Sphere() + }; + } + computeBoundaries() { + const atoms = this._complex._atoms; + const n = atoms.length; + const selector = this._selector; + const { + boundingBox + } = this._boundaries; + boundingBox.makeEmpty(); + if (n === 1) { + boundingBox.expandByPoint(atoms[0].position); + const bbc = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + boundingBox.getCenter(bbc); + const s = 2 * atoms[0].element.radius; + boundingBox.setFromCenterAndSize(bbc, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(s, s, s)); + } else { + for (let i = 0; i < n; ++i) { + if (selector.includesAtom(atoms[i])) { + boundingBox.expandByPoint(atoms[i].position); } } - /** Shift values of second part (+caps) indices by newly added vertices count. Number of faces remains the same. */ - - }, { - key: "_extendIndices", - value: function _extendIndices(geo, info) { - var index = geo.index; - var indicesPerQuad = 6; // quad = 2 triangles => 6 indices - - var startToShift = info.addPerCylinder * indicesPerQuad; - var shift = info.addPerCylinder; - var shifted = index.array.slice(startToShift, index.count); - shifted = shifted.map(function (x) { - return x + shift; - }); // shift only the endings - - this.indices.set(index.array, 0); - this.indices.set(shifted, startToShift); - } - /** - * Set defined colors: (first part + bottom cap), (second part + top cap) - * @param {number} start - start color index - * @param {number} end - start color index - * @param {array} array - array of colors - * @param {array} color - color value components - */ - - }, { - key: "_setColorRange", - value: function _setColorRange(start, end, array, color) { - var colorSize = color.length; + } - for (var i = start; i < end; i += colorSize) { - array.set(color, i); + // Build bounding sphere + let radiusSquared = 0.0; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + boundingBox.getCenter(center); + if (n === 1) { + this._boundaries.boundingSphere.set(center, atoms[0].element.radius); + } else { + for (let i = 0; i < n; ++i) { + if (!selector.includesAtom(atoms[i])) { + continue; + } + const pos = atoms[i].position; + const lengthSquared = center.distanceToSquared(pos); + if (radiusSquared < lengthSquared) { + radiusSquared = lengthSquared; } } - /** - * Set defined colors: (first part + bottom cap), (second part + top cap) - * @param {Object} color1 - THREE.Color. - * @param {Object} color2 - THREE.Color. - */ + this._boundaries.boundingSphere.set(center, Math.sqrt(radiusSquared)); + } + } + getTransforms() { + return []; + } + getSelector() { + return this._selector; + } + getBoundaries() { + return this._boundaries; + } + finalize() {} +} +/* harmony default export */ const chem_BiologicalUnit = (BiologicalUnit); +;// CONCATENATED MODULE: ./src/chem/Assembly.js - }, { - key: "setColors", - value: function setColors(color1, color2) { - var colorSize = this.itemSize.color; - var part1End = this._cutRawEnd * colorSize; - var part2End = part1End * 2; - this._setColorRange(0, part1End, this.colors, color1.toArray()); - this._setColorRange(part1End, part2End, this.colors, color2.toArray()); - if (part2End < this.colors.length) { - // cylinder has caps, lets paint them - var capSize = (this._facesPerSlice + 1) * colorSize; - var cap1End = part2End + capSize; +/** + * Biological assembly. + * + * @exports Assembly + * @constructor + */ - this._setColorRange(part2End, cap1End, this.colors, color2.toArray()); +class Assembly extends chem_BiologicalUnit { + constructor(complex) { + super(complex); + this.chains = []; + this.matrices = []; + } + computeBoundaries() { + super.computeBoundaries(); + // fix up the boundaries + const { + matrices + } = this; + const oldCenter = this._boundaries.boundingSphere.center; + const oldRad = this._boundaries.boundingSphere.radius; + const boundingBox = this._boundaries.boundingBox = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(); + boundingBox.makeEmpty(); + for (let i = 0, n = matrices.length; i < n; ++i) { + boundingBox.expandByPoint(oldCenter.clone().applyMatrix4(matrices[i])); + } + const newRad = boundingBox.max.distanceTo(boundingBox.min) / 2 + oldRad; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + boundingBox.getCenter(center); + this._boundaries.boundingSphere = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Sphere().set(center, newRad); + boundingBox.max.addScalar(oldRad); + boundingBox.min.subScalar(oldRad); + } - var cap2End = cap1End + capSize; // should be equal to this.colors.length; + /** + * Mark a chain as belonging to this biological assembly. + * @param {string} chain - chain identifier, usually a single letter + */ + addChain(chain) { + this.chains[this.chains.length] = chain; + } - this._setColorRange(cap1End, cap2End, this.colors, color1.toArray()); - } + /** + * Add a transformation matrix. + * @param {THREE.Matrix4} matrix - transformation matrix + */ + addMatrix(matrix) { + this.matrices[this.matrices.length] = matrix; + } + getTransforms() { + return this.matrices; + } + finalize() { + if (this.chains.length > 0) { + this._selector = chem_selectors.keyword('Chain')(this.chains); + } else { + this._selector = chem_selectors.keyword('None')(); + } + } +} +/* harmony default export */ const chem_Assembly = (Assembly); +;// CONCATENATED MODULE: ./src/chem/Component.js +/** + * This class represents connected component as a part of a complex. + * WARNING! The whole component entity is build under the assumption that residues + * are placed in the chains and complex in ascending order of indices + * + * @param {Complex} complex - Molecular complex this chain belongs to. + * + * @exports Component + * @constructor + */ +class Component { + constructor(complex) { + this._complex = complex; + this._index = -1; + this._residueIndices = []; + this._cycles = []; + this._subDivs = []; + this._residueCount = 0; + } + getResidues() { + return this._complex._residues; + } + getResidueCount() { + return this._residueCount; + } + forEachResidue(process) { + const residues = this._complex._residues; + const resIdc = this._residueIndices; + for (let idIdc = 0, idCount = resIdc.length; idIdc < idCount; ++idIdc) { + for (let idx = resIdc[idIdc].start, last = resIdc[idIdc].end; idx <= last; ++idx) { + process(residues[idx]); } - }]); - - return FBX2CCylinder; - }(FBXGeometry); - - var FBXInfoExtractor = /*#__PURE__*/function () { - function FBXInfoExtractor() { - classCallCheck(this, FBXInfoExtractor); - - this._materials = []; - this._models = []; } - - createClass(FBXInfoExtractor, [{ - key: "process", - value: function process(data) { - this._extractModelsAndMaterials(data); - - var models = this._flattenModels(); - - return { - name: data.name, - models: models, - materials: this._materials + } + setSubDivs(subDivs) { + this._subDivs = subDivs; + let curr = 0; + const resIdc = []; + let resCnt = 0; + for (let i = 0, n = subDivs.length; i < n; ++i) { + if (i === n - 1 || subDivs[i].end + 1 !== subDivs[i + 1].start) { + const { + start + } = subDivs[curr]; + const { + end + } = subDivs[i]; + resIdc[resIdc.length] = { + start, + end }; + resCnt += end - start + 1; + curr = i + 1; } - /** - * Extract fbx object information from ComplexVisual - * @param {object} data - complexVisual to get geometry info from - */ - - }, { - key: "_extractModelsAndMaterials", - value: function _extractModelsAndMaterials(data) { - var _this = this; - - var layersOfInterest = new THREE.Layers(); - layersOfInterest.set(gfxutils.LAYERS.DEFAULT); - layersOfInterest.enable(gfxutils.LAYERS.TRANSPARENT); - data.traverse(function (object) { - if (object instanceof THREE.Mesh && object.layers.test(layersOfInterest) && _this.checkExportAbility(object)) { - if (object.geometry.type === 'InstancedBufferGeometry') { - _this._collectInstancedGeoInfo(object); - } else { - _this._collectGeoInfo(object); + } + this._residueIndices = resIdc; + this._residueCount = resCnt; + } + getComplex() { + return this._complex; + } + forEachBond(process) { + const bonds = this._complex._bonds; + for (let i = 0, n = bonds.length; i < n; ++i) { + const bond = bonds[i]; + if (bond._left.residue._component === this) { + process(bond); + } + } + } + update() { + this.forEachCycle(cycle => { + cycle.update(); + }); + } + forEachAtom(process) { + this.forEachResidue(residue => { + residue.forEachAtom(process); + }); + } + addCycle(cycle) { + this._cycles.push(cycle); + } + forEachCycle(process) { + const cycles = this._cycles; + for (let i = 0, n = cycles.length; i < n; ++i) { + process(cycles[i]); + } + } + markResidues() { + const self = this; + self.forEachResidue(residue => { + residue._component = self; + }); + } + _forEachSubChain(mask, process) { + const residues = this._complex._residues; + const subs = this._subDivs; + for (let i = 0, n = subs.length; i < n; ++i) { + for (let idx = subs[i].start, last = subs[i].end; idx <= last; ++idx) { + const currRes = residues[idx]; + if (mask & currRes._mask && currRes._isValid) { + let end = idx + 1; + for (; end <= last; ++end) { + const endRes = residues[end]; + if (!(mask & endRes._mask && endRes._isValid)) { + break; } } - }); - } - /** - * Reworking indices buffer, see https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/ - * basically, every triangle in Miew has been represented hat way (e.g.) : 0,1,7, but we must (for FBX) rework that - * into: 0,1,-8. - * @param {array} indices - belongs to [0, maxVertIndex] - */ - - }, { - key: "_reworkIndices", - value: function _reworkIndices(indices) { - var faceSize = 3; - - for (var i = faceSize - 1; i < indices.length; i += faceSize) { - indices[i] *= -1; - indices[i]--; + process(i, idx, end - 1); + idx = end; } } - /** - * Combine geometry from several models having the same material into one Model and finally prepare indices - * @returns {array} models, combined by material id - */ - - }, { - key: "_flattenModels", - value: function _flattenModels() { - var overallVertsCount = 0; - - function shift(x) { - return x + overallVertsCount; - } - - var combined = []; // flatten models geometry - - for (var i = 0, n = this._models.length; i < n; i++) { - var models = this._models[i]; - var indices = []; - var positions = []; - var normals = []; - var colors = []; // reorganize every attributes as array of arrays - - overallVertsCount = 0; - - for (var j = 0; j < models.length; j++) { - var m = models[j]; - indices.push(m.indices.map(shift)); - overallVertsCount += m.getVerticesNumber(); - positions.push(m.positions); - normals.push(m.normals); - colors.push(m.colors); - } // join all subarrays into one - - - indices = utils.mergeTypedArraysUnsafe(indices); - - this._reworkIndices(indices); - - positions = utils.mergeTypedArraysUnsafe(positions); - normals = utils.mergeTypedArraysUnsafe(normals); - colors = utils.mergeTypedArraysUnsafe(colors); - combined.push({ - indices: indices, - positions: positions, - normals: normals, - colors: colors, - verticesCount: overallVertsCount - }); - } - - return combined; + } + } + getMaskedSequences(mask) { + const subs = []; + let idx = 0; + this._forEachSubChain(mask, (_subIdx, start, end) => { + subs[idx++] = { + start, + end + }; + }); + return subs; + } + getMaskedSubdivSequences(mask) { + const subs = []; + let currIdx = -1; + let lastSubIdx = -1; + const subDivs = this._subDivs; + this._forEachSubChain(mask, (subIdx, start, end) => { + if (lastSubIdx !== subIdx) { + ++currIdx; + subs[currIdx] = { + arr: [], + boundaries: subDivs[subIdx] + }; + lastSubIdx = subIdx; } - /** - * Check ability to export the kind of mesh. - * @param {object} mesh - given mesh to check - * @returns {boolean} result of check - */ - - }, { - key: "checkExportAbility", - value: function checkExportAbility(mesh) { - // check mesh on not being empty - if (mesh.geometry.attributes.position.count === 0) { - return false; - } // check type of mesh - // if (mesh.geometry.isInstancedBufferGeometry && settings.now.zSprites) { + subs[currIdx].arr[subs[currIdx].arr.length] = { + start, + end + }; + }); + return subs; + } +} +/* harmony default export */ const chem_Component = (Component); +;// CONCATENATED MODULE: ./src/chem/AtomPairs.js + +const cMaxPairsForHashCode = 32; +const cHashTableSize = 1024 * 1024; +const cNumbersPerPair = 4; +const cMaxNeighbours = 14; +const cInvalidVal = -1; +// 89237 is a large simple number, can be used for pseudo random hash code create +const cBigPrime = 89237; +class AtomPairs { + constructor(maxPairsEstimate) { + this.numPairs = 0; + this.numMaxPairs = maxPairsEstimate; + this.intBuffer = utils.allocateTyped(Int32Array, maxPairsEstimate * cNumbersPerPair); + for (let i = 0; i < maxPairsEstimate * cNumbersPerPair; i++) { + this.intBuffer[i] = cInvalidVal; + } + this.hashBuffer = utils.allocateTyped(Int32Array, cHashTableSize * cMaxPairsForHashCode); + for (let i = 0; i < cHashTableSize * cMaxPairsForHashCode; i++) { + this.hashBuffer[i] = cInvalidVal; + } + } + /** + * Destroy all pairs memory + */ + destroy() { + this.intBuffer = null; + this.hashBuffer = null; + } - if (mesh instanceof ZSpriteMesh) { - logger.warn('Currently we cannot export \'sprites\' modes, like BS, WV, LC. Please turn of settings \'zSprites\' and try again'); - return false; - } + /** + * Add pair of atoms to collection + * @param {number} indexA - Index of the 1st vertex. + * @param {number} indexB - Index of the 2nd vertex. + */ + addPair(indexA, indexB) { + const ia = indexA < indexB ? indexA : indexB; + const ib = indexA > indexB ? indexA : indexB; + const codeToAdd = ia + (ib << cMaxNeighbours); + const hashCode = ia + ib * cBigPrime & cHashTableSize - 1; + let j = hashCode * cMaxPairsForHashCode; + let apI = 0; + for (; apI < cMaxPairsForHashCode; apI++) { + const code = this.hashBuffer[j + apI]; + if (code === cInvalidVal) { + break; + } + if (code === codeToAdd) { + return false; + } + } + // add this new hash code + if (apI >= cMaxPairsForHashCode) { + throw new Error('addPair: increase cMaxPairsForHashCode'); + } + this.hashBuffer[j + apI] = codeToAdd; - if (mesh instanceof ThickLineMesh) { - logger.warn('Currently we cannot export Lines mode'); - return false; - } + // actually add + if (this.numPairs >= this.numMaxPairs) { + throw new Error('addPair: increase num pairs'); + } + j = this.numPairs * cNumbersPerPair; + this.intBuffer[j] = ia; + this.intBuffer[j + 1] = ib; + this.intBuffer[j + 2] = codeToAdd; + this.numPairs++; + return true; + } +} +/* harmony default export */ const chem_AtomPairs = (AtomPairs); +;// CONCATENATED MODULE: ./src/chem/AutoBond.js + + +const cProfileBondBuilder = false; +const cEstBondsMultiplier = 4; +const cSpaceCode = 32; +const cBondTolerance = 0.45; +const cVMDTolerance = 0.6; +const cBondRadInJMOL = true; +const cEpsilon = 0.001; + +/** + * Get radius used for building bonds. + * + * @param {Atom} atom - Atom object. + * @returns {number} special value for bonding radius for this atom + */ +function _getBondingRadius(atom) { + const { + element + } = atom; + if (element) { + return element.radiusBonding; + } + throw new Error('_getBondingRadius: Logic error.'); +} +function _isAtomEligible(atom) { + // build for all non-hetatm and for hetatm without bonds + return !atom.isHet() || atom.bonds && atom.bonds.length === 0; +} + +/** + * Bond between atoms. + * + * @param {Complex} complex molecular complex + + * @exports AutoBond + * @constructor + */ +class AutoBond { + constructor(complex) { + this._complex = complex; + this._maxRad = 1.8; + const bBox = this._complex.getDefaultBoundaries().boundingBox; + this._vBoxMin = bBox.min.clone(); + this._vBoxMax = bBox.max.clone(); + this._pairCollection = null; + } - return true; + /** + * Add existing pairs of connectors (from pdb file after its reading) + * @returns {number} 0 + */ + _addExistingPairs() { + const atoms = this._complex.getAtoms(); + const numAtoms = atoms.length; + let aInd = 0; + const collection = this._pairCollection; + for (; aInd < numAtoms; aInd++) { + const { + bonds + } = atoms[aInd]; + const numBondsForAtom = bonds.length; + for (let bInd = 0; bInd < numBondsForAtom; bInd++) { + const bond = bonds[bInd]; + const indTo = bond._left.index; + if (indTo === aInd) { + collection.addPair(aInd, bond._right.index); + } + } // for (b) all bonds in atom + } // for (a) + return 0; + } + _findPairs() { + const vw = this._complex.getVoxelWorld(); + if (vw === null) { + return; + } + const atoms = this._complex._atoms; + const atomsNum = atoms.length; + const self = this; + let rA; + let isHydrogenA; + let posA; + let locationA; + let atomA; + const processAtom = function (atomB) { + if (isHydrogenA && atomB.isHydrogen()) { + return; + } + const locationB = atomB.location; + if (locationA !== cSpaceCode && locationB !== cSpaceCode && locationA !== locationB) { + return; + } + const dist2 = posA.distanceToSquared(atomB.position); + const rB = atomB.element.radiusBonding; + const maxAcceptable = cBondRadInJMOL ? rA + rB + cBondTolerance : cVMDTolerance * (rA + rB); + if (dist2 > maxAcceptable * maxAcceptable) { + return; + } + if (dist2 < cEpsilon) { + return; } - /** - * Save geometry info from common mesh, like Surface or Cartoon - */ - - }, { - key: "_collectGeoInfo", - value: function _collectGeoInfo(mesh) { - var _mesh$geometry = mesh.geometry, - _mesh$geometry$attrib = _mesh$geometry.attributes, - position = _mesh$geometry$attrib.position, - color = _mesh$geometry$attrib.color, - normal = _mesh$geometry$attrib.normal, - index = _mesh$geometry.index, - matrix = mesh.matrix; - var model = new FBXModel(); - var vertCount = position.count; - model.init(vertCount, index.count); - - if (matrix.isIdentity()) { - model.setPositions(position.array, 0, vertCount, position.itemSize); - model.setNormals(normal.array, 0, vertCount, normal.itemSize); - } else { - model.setTransformedPositions(position.array, 0, vertCount, position.itemSize, matrix); - model.setTransformedNormals(normal.array, 0, vertCount, normal.itemSize, matrix); - } - - model.setColors(color.array, 0, vertCount, color.itemSize); - model.setIndices(index.array, 0, index.count); - - var material = this._collectMaterialInfo(mesh); - - this._addToPool(model, material); + self._pairCollection.addPair(atomA.index, atomB.index); + }; + for (let i = 0; i < atomsNum; ++i) { + atomA = atoms[i]; + if (!_isAtomEligible(atomA)) { + continue; } - /** - * Collect instanced spheres geometry and materials. - * @param {object} mesh - mesh with instanced spheres info - */ - - }, { - key: "_collectSpheresInfo", - value: function _collectSpheresInfo(mesh) { - var _mesh$geometry2 = mesh.geometry, - _mesh$geometry2$attri = _mesh$geometry2.attributes, - position = _mesh$geometry2$attri.position, - color = _mesh$geometry2$attri.color, - index = _mesh$geometry2.index, - matrix = mesh.matrix; - var model = new FBXModel(); - var instCount = mesh.geometry.maxInstancedCount; - var vertCount = position.count; - var indsCount = index.count; - model.init(instCount * vertCount, instCount * indsCount); - var geo = new FBX1CGeometry(); - geo.init(mesh.geometry); - var instMatrix = new THREE.Matrix4(); - var objMatrix = new THREE.Matrix4(); - var sphereColor = new THREE.Color(); - - for (var instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) { - // update colors in geometry - var colorIdx = instanceIndex * color.itemSize; - sphereColor.fromArray(color.array, colorIdx); - geo.setColors(sphereColor); // add instance to the model - - this._getSphereInstanceMatrix(mesh.geometry, instanceIndex, instMatrix); - - objMatrix.multiplyMatrices(matrix, instMatrix); - model.addInstance(objMatrix, geo); - } - - var material = this._collectMaterialInfo(mesh); - - this._addToPool(model, material); - } - /** - * Getting all instanced cylinders from given mesh. - * Divide cylinder (add additional vertexes) for prettiness therefore algorithm is a bit complicated - * @param {object} mesh - given mesh with instanced cylinders - */ - - }, { - key: "_collectCylindersInfo", - value: function _collectCylindersInfo(mesh) { - var _mesh$geometry3 = mesh.geometry, - _mesh$geometry3$attri = _mesh$geometry3.attributes, - position = _mesh$geometry3$attri.position, - color = _mesh$geometry3$attri.color, - color2 = _mesh$geometry3$attri.color2, - index = _mesh$geometry3.index, - matrix = mesh.matrix; - var model = new FBXModel(); - var instCount = mesh.geometry.maxInstancedCount; - var oneCCylinder = new FBX1CGeometry(); - oneCCylinder.init(mesh.geometry); - - var splittingInfo = this._gatherCylindersColoringInfo(mesh.geometry); - - var twoCCylinder = null; - - if (splittingInfo.needToSplit > 0) { - twoCCylinder = new FBX2CCylinder(); - twoCCylinder.init(mesh.geometry, splittingInfo); - } - - var additionalVertsCount = splittingInfo.addPerCylinder * splittingInfo.needToSplit; - var vertCount = position.count; - var indsCount = index.count; - model.init(instCount * vertCount + additionalVertsCount, instCount * indsCount); - var instMatrix = new THREE.Matrix4(); - var objMatrix = new THREE.Matrix4(); - var colorStart = new THREE.Color(); - var colorEnd = new THREE.Color(); - var geo = {}; - - for (var instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) { - // update colors in geometry - var colorIdx = instanceIndex * color.itemSize; - - if (splittingInfo.is2Colored[instanceIndex]) { - // .color2 contains starting color, and .color contains starting color (see uber.frag ATTR_COLOR2) - colorStart.fromArray(color2.array, colorIdx); - colorEnd.fromArray(color.array, colorIdx); - - if (twoCCylinder) { - twoCCylinder.setColors(colorStart, colorEnd); - geo = twoCCylinder; - } - } else { - // has one color per cylinder - colorStart.fromArray(color.array, colorIdx); - oneCCylinder.setColors(colorStart); - geo = oneCCylinder; - } // add instance to the model + rA = atomA.element.radiusBonding; + isHydrogenA = atomA.isHydrogen(); + posA = atomA.position; + locationA = atomA.location; + vw.forEachAtomWithinRadius(posA, 2 * this._maxRad + cBondTolerance, processAtom); + } + } + _addPairs() { + const atoms = this._complex._atoms; + for (let i = 0, k = 0; i < this._pairCollection.numPairs; i++, k += 4) { + const iA = this._pairCollection.intBuffer[k]; + const iB = this._pairCollection.intBuffer[k + 1]; + this._addPair(atoms[iA], atoms[iB]); + } + } + _addPair(atomA, atomB) { + const bondsA = atomA.bonds; + const indexA = atomA.index; + const indexB = atomB.index; + for (let j = 0, numBonds = bondsA.length; j < numBonds; ++j) { + const bond = bondsA[j]; + if (bond._left.index === indexB || bond._right.index === indexB) { + return; + } + } + const left = indexA < indexB ? atomA : atomB; + const right = indexA < indexB ? atomB : atomA; + const newBond = this._complex.addBond(left, right, 0, chem_Bond.BondType.UNKNOWN, false); + bondsA.push(newBond); + atomB.bonds.push(newBond); + } + build() { + if (cProfileBondBuilder) { + console.time('Bonds Builder'); + } + this._buildInner(); + if (cProfileBondBuilder) { + console.timeEnd('Bonds Builder'); + } + } + _buildInner() { + const atoms = this._complex._atoms; + if (atoms.length < 2) { + return; + } + if (atoms[0].index < 0) { + throw new Error('AutoBond: Atoms in complex were not indexed.'); + } + this._calcBoundingBox(); + this._pairCollection = new chem_AtomPairs(atoms.length * cEstBondsMultiplier); + this._addExistingPairs(); + this._findPairs(); + this._addPairs(); + } + _calcBoundingBox() { + const atoms = this._complex._atoms; + const nAtoms = atoms.length; + let maxRad = _getBondingRadius(atoms[0]); + for (let i = 1; i < nAtoms; ++i) { + maxRad = Math.max(maxRad, _getBondingRadius(atoms[i])); + } + this._vBoxMax.addScalar(maxRad); + this._vBoxMin.addScalar(-maxRad); + this._maxRad = maxRad * 1.2; + } + destroy() { + if (this._pairCollection) { + this._pairCollection.destroy(); + } + } +} +/* harmony default export */ const chem_AutoBond = (AutoBond); +;// CONCATENATED MODULE: ./src/chem/AromaticLoopsMarker.js - this._getCylinderInstanceMatrix(mesh.geometry, instanceIndex, instMatrix); - objMatrix.multiplyMatrices(matrix, instMatrix); - model.addInstance(objMatrix, geo); - } +const cCrossThresh = 0.1; +const cAromaticType = chem_Bond.BondType.AROMATIC; +const cAromaticAtoms = [chem_Element.ByName.C.number, chem_Element.ByName.N.number +// Element.ByName.O.number, +// Element.ByName.S.number, +]; - var material = this._collectMaterialInfo(mesh); +/** Conditions for bonds: + * - Cross product with each subsequent bond to add is collinear and point to the same direction + * - Each pair of a adjacent bonds belong to not more than one cycle + * - If there is more than one candidates we try them in ascending order of angle values + */ - this._addToPool(model, material); +const _coDirVectors = function () { + const v1Tmp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const v2Tmp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const cp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + return function (v1, v2) { + v1Tmp.copy(v1).normalize(); + v2Tmp.copy(v2).normalize(); + cp.crossVectors(v1Tmp, v2Tmp); + if (cp.length() > cCrossThresh) { + return false; + } + // zero vector in out terms must be collinear to any + return v1Tmp.dot(v2Tmp) >= 0; + }; +}(); +function _insertAscending(arr, val) { + let idx = 0; + while (idx < arr.length && arr[idx] < val) { + ++idx; + } + arr.splice(idx, 0, val); +} +function _anotherAtom(bond, currAtom) { + return bond._left === currAtom ? bond._right : bond._left; +} +function _cosBetween(v1, v2) { + const theta = v1.dot(v2) / Math.sqrt(v1.lengthSq() * v2.lengthSq()); + return external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MathUtils.clamp(theta, -1, 1); +} +function _markAromatic(bond) { + bond._type = cAromaticType; +} +class Cycle { + constructor(atomsList) { + this.atoms = atomsList; + this.update(); + } + update() { + const { + atoms + } = this; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const nA = atoms.length; + for (let j = 0; j < nA; ++j) { + center.add(atoms[j].position); + } + center.multiplyScalar(1.0 / nA); + this.center = center; + this.radius = center.distanceTo(atoms[0].position.clone().lerp(atoms[1].position, 0.5)); + } + forEachBond(process) { + const { + atoms + } = this; + const nA = atoms.length; + let currAtom = atoms[0]; + let nextAtom; + function checkBond(bond) { + if (bond._left === nextAtom || bond._right === nextAtom) { + process(bond); + } + } + for (let i = 0; i < nA; ++i) { + nextAtom = atoms[(i + 1) % nA]; + currAtom.forEachBond(checkBond); + currAtom = nextAtom; + } + } +} +function _isAromatic(bond) { + return bond._type === cAromaticType; +} +function _isPossibleAromatic(bond) { + if (bond.type === cAromaticType) { + return true; + } + const rightIdx = cAromaticAtoms.indexOf(bond._right.element.number); + const leftIdx = cAromaticAtoms.indexOf(bond._left.element.number); + return rightIdx !== -1 && leftIdx !== -1; +} +function _checkCycleSimple(cycle) { + return cycle.length > 3; +} +function _checkCycleComplex(cycle) { + console.assert(cycle.length > 2); + return true; +} +class AromaticLoopsMarker { + constructor(complex) { + this._complex = complex; + const bondsData = new Array(complex._bonds.length); + const bondMarks = new Array(complex._bonds.length); + for (let i = 0, n = bondsData.length; i < n; ++i) { + bondsData[i] = []; + bondMarks[i] = false; + } + this._bondsData = bondsData; + this._bondMarks = bondMarks; + this._resetCycles(); + } + _resetCycles() { + this._cycles = []; + this._currIdx = -1; + } + _haveSameCycle(bondsData, bond1, bond2) { + const arr1 = bondsData[bond1._index]; + const arr2 = bondsData[bond2._index]; + const n1 = arr1.length; + const n2 = arr2.length; + let i1 = 0; + let i2 = 0; + while (i1 < n1 && i2 < n2) { + if (arr1[i1] === arr2[i2]) { + return true; } - /** - * Adding model to pool of models or extend existing ones - * @param {object} model - model to add - * @param {object} material - material to add - */ - - }, { - key: "_addToPool", - value: function _addToPool(model, material) { - var materialIdx = this._checkExistingMaterial(material); - - if (materialIdx < 0) { - // new model-material pair - this._models.push([model]); - - this._materials.push(material); - } else { - // add model to existing model-material pair - var models = this._models[materialIdx]; - models.push(model); - } + if (arr1[i1] > arr2[i2]) { + ++i2; + } else { + ++i1; } - /** - * Checking if given material already was registered in materials pool (no need to create new one) - * @param {object} material - given material - * @returns {number} number of model-material pair - */ - - }, { - key: "_checkExistingMaterial", - value: function _checkExistingMaterial(material) { - return _.findIndex(this._materials, function (m) { - return _.isEqual(m, material); - }); + } + return false; + } + _tryBond(prevBond, currRight, currDir) { + const bondsOrder = []; + const bondsData = this._bondsData; + const currLeft = _anotherAtom(prevBond, currRight); + const currVec = currRight.position.clone().sub(currLeft.position); + const startAtomRef = this._currStart; + const self = this; + const bondMarks = this._bondMarks; + let checkAromatic = this._checkBond; + bondMarks[prevBond._index] = true; + checkAromatic = checkAromatic === undefined ? _isAromatic : checkAromatic; + currRight.forEachBond(newBond => { + if (!checkAromatic(newBond) || newBond === prevBond || bondMarks[newBond._index] || self._haveSameCycle(bondsData, prevBond, newBond)) { + return; } - }, { - key: "_gatherCylindersColoringInfo", - value: function _gatherCylindersColoringInfo(geo) { - var instCount = geo.maxInstancedCount; - var color1 = geo.attributes.color.array; - var color2 = geo.attributes.color2.array; - var stride = geo.attributes.color.itemSize; - var is2Colored = new Array(instCount); // analyze color instance attributes - - var needToSplit = 0; - var colIdx = 0; - - for (var i = 0; i < instCount; i++, colIdx += stride) { - var differs = Math.abs(color1[colIdx] - color2[colIdx]) > 0.0000001 || // compare ending colors - Math.abs(color1[colIdx + 1] - color2[colIdx + 1]) > 0.0000001 || Math.abs(color1[colIdx + 2] - color2[colIdx + 2]) > 0.0000001; - is2Colored[i] = differs; - needToSplit += differs; // count number of 2-colored cylinders - } // calc number of vertices to add into 2-colored - - - var geoParams = geo.getGeoParams(); - var addPerCylinder = geoParams.radialSegments; - return { - is2Colored: is2Colored, - needToSplit: needToSplit, - addPerCylinder: addPerCylinder - }; + const anotherAtom = _anotherAtom(newBond, currRight); + const anotherVec = anotherAtom.position.clone().sub(currRight.position); + const val = anotherAtom === startAtomRef ? -2.0 : 1 - _cosBetween(currVec, anotherVec); + const newDir = anotherVec.cross(currVec); + if (!_coDirVectors(newDir, currDir)) { + return; } - /** - * Collect instanced models and materials. - * @param {object} mesh - given mesh with instanced something (spheres or cylinders) - */ - - }, { - key: "_collectInstancedGeoInfo", - value: function _collectInstancedGeoInfo(mesh) { - if (mesh.geometry instanceof InstancedSpheresGeometry) { - this._collectSpheresInfo(mesh); - } else if (mesh.geometry instanceof Instanced2CCylindersGeometry) { - this._collectCylindersInfo(mesh); - } + let idx = 0; + while (idx < bondsOrder.length && bondsOrder[idx].val < val) { + ++idx; } - /** - * Collect Material info from given mesh. - * @param {object} mesh - given mesh with material info - * @returns {object} material - */ - - }, { - key: "_collectMaterialInfo", - value: function _collectMaterialInfo(mesh) { - var uberOptions = mesh.material.uberOptions; - return { - diffuse: uberOptions.diffuse.toArray(), - opacity: uberOptions.opacity, - shininess: uberOptions.shininess, - specular: uberOptions.specular.toArray() - }; + bondsOrder.splice(idx, 0, { + bond: newBond, + val, + dir: newDir + }); + }); + for (let i = 0, n = bondsOrder.length; i < n; ++i) { + const { + bond + } = bondsOrder[i]; + const newRight = bond._left === currRight ? bond._right : bond._left; + if (newRight === startAtomRef) { + ++this._currIdx; + this._cycles.push([currRight]); + bondMarks[prevBond._index] = false; + return true; } - }, { - key: "_getCylinderInstanceMatrix", - value: function _getCylinderInstanceMatrix(geo, instIdx, matrix) { - var matVector1 = geo.attributes.matVector1.array; - var matVector2 = geo.attributes.matVector2.array; - var matVector3 = geo.attributes.matVector3.array; - var idxOffset = instIdx * 4; // used 4 because offset arrays are stored in quads - - matrix.set(matVector1[idxOffset], matVector1[idxOffset + 1], matVector1[idxOffset + 2], matVector1[idxOffset + 3], matVector2[idxOffset], matVector2[idxOffset + 1], matVector2[idxOffset + 2], matVector2[idxOffset + 3], matVector3[idxOffset], matVector3[idxOffset + 1], matVector3[idxOffset + 2], matVector3[idxOffset + 3], 0, 0, 0, 1); + if (this._tryBond(bond, newRight, bondsOrder[i].dir)) { + _insertAscending(bondsData[bond._index], this._currIdx); + this._cycles[this._currIdx].push(currRight); + bondMarks[prevBond._index] = false; + return true; } - }, { - key: "_getSphereInstanceMatrix", - value: function _getSphereInstanceMatrix(geo, instIdx, matrix) { - var offset = geo.attributes.offset; - var idx = instIdx * offset.itemSize; - var x = offset.array[idx]; - var y = offset.array[idx + 1]; - var z = offset.array[idx + 2]; - var scale = offset.array[idx + 3]; - matrix.set(scale, 0, 0, x, 0, scale, 0, y, 0, 0, scale, z, 0, 0, 0, 1); + } + bondMarks[prevBond._index] = false; + return false; + } + _startCycle(bond) { + // start from left to right + this._currStart = bond._left; + if (this._tryBond(bond, bond._right, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3())) { + _insertAscending(this._bondsData[bond._index], this._currIdx); + this._cycles[this._currIdx].push(bond._left); + } + } + _findLoops(checkBond, checkCycle) { + this._checkBond = checkBond; + const complex = this._complex; + const self = this; + complex.forEachComponent(component => { + self._resetCycles(); + component.forEachBond(bond => { + if (checkBond(bond)) { + self._startCycle(bond); + } + }); + const cycles = self._cycles; + for (let i = 0, n = cycles.length; i < n; ++i) { + const cycle = cycles[i]; + if (!checkCycle(cycle)) { + continue; + } + const newCycle = new Cycle(cycle); + newCycle.forEachBond(_markAromatic); + component.addCycle(newCycle); } - }]); - - return FBXInfoExtractor; - }(); - - // Forming default definitions block - var defaultDefinitions = "\nDefinitions: {\n Version: 100\n Count: 3\n ObjectType: \"Model\" {\n Count: 1\n }\n ObjectType: \"Geometry\" {\n Count: 1\n }\n ObjectType: \"Material\" {\n Count: 1\n }\n ObjectType: \"Pose\" {\n Count: 1\n }\n ObjectType: \"GlobalSettings\" {\n Count: 1\n }\n} "; // Default model properties - - var defaultProperties = "Properties60: {\n Property: \"QuaternionInterpolate\", \"bool\", \"\",0\n Property: \"Visibility\", \"Visibility\", \"A\",1\n Property: \"Lcl Translation\", \"Lcl Translation\", \"A\",0.000000000000000,0.000000000000000,-1789.238037109375000\n Property: \"Lcl Rotation\", \"Lcl Rotation\", \"A\",0.000009334667643,-0.000000000000000,0.000000000000000\n Property: \"Lcl Scaling\", \"Lcl Scaling\", \"A\",1.000000000000000,1.000000000000000,1.000000000000000\n Property: \"RotationOffset\", \"Vector3D\", \"\",0,0,0\n Property: \"RotationPivot\", \"Vector3D\", \"\",0,0,0\n Property: \"ScalingOffset\", \"Vector3D\", \"\",0,0,0\n Property: \"ScalingPivot\", \"Vector3D\", \"\",0,0,0\n Property: \"TranslationActive\", \"bool\", \"\",0\n Property: \"TranslationMin\", \"Vector3D\", \"\",0,0,0\n Property: \"TranslationMax\", \"Vector3D\", \"\",0,0,0\n Property: \"TranslationMinX\", \"bool\", \"\",0\n Property: \"TranslationMinY\", \"bool\", \"\",0\n Property: \"TranslationMinZ\", \"bool\", \"\",0\n Property: \"TranslationMaxX\", \"bool\", \"\",0\n Property: \"TranslationMaxY\", \"bool\", \"\",0\n Property: \"TranslationMaxZ\", \"bool\", \"\",0\n Property: \"RotationOrder\", \"enum\", \"\",0\n Property: \"RotationSpaceForLimitOnly\", \"bool\", \"\",0\n Property: \"AxisLen\", \"double\", \"\",10\n Property: \"PreRotation\", \"Vector3D\", \"\",0,0,0\n Property: \"PostRotation\", \"Vector3D\", \"\",0,0,0\n Property: \"RotationActive\", \"bool\", \"\",0\n Property: \"RotationMin\", \"Vector3D\", \"\",0,0,0\n Property: \"RotationMax\", \"Vector3D\", \"\",0,0,0\n Property: \"RotationMinX\", \"bool\", \"\",0\n Property: \"RotationMinY\", \"bool\", \"\",0\n Property: \"RotationMinZ\", \"bool\", \"\",0\n Property: \"RotationMaxX\", \"bool\", \"\",0\n Property: \"RotationMaxY\", \"bool\", \"\",0\n Property: \"RotationMaxZ\", \"bool\", \"\",0\n Property: \"RotationStiffnessX\", \"double\", \"\",0\n Property: \"RotationStiffnessY\", \"double\", \"\",0\n Property: \"RotationStiffnessZ\", \"double\", \"\",0\n Property: \"MinDampRangeX\", \"double\", \"\",0\n Property: \"MinDampRangeY\", \"double\", \"\",0\n Property: \"MinDampRangeZ\", \"double\", \"\",0\n Property: \"MaxDampRangeX\", \"double\", \"\",0\n Property: \"MaxDampRangeY\", \"double\", \"\",0\n Property: \"MaxDampRangeZ\", \"double\", \"\",0\n Property: \"MinDampStrengthX\", \"double\", \"\",0\n Property: \"MinDampStrengthY\", \"double\", \"\",0\n Property: \"MinDampStrengthZ\", \"double\", \"\",0\n Property: \"MaxDampStrengthX\", \"double\", \"\",0\n Property: \"MaxDampStrengthY\", \"double\", \"\",0\n Property: \"MaxDampStrengthZ\", \"double\", \"\",0\n Property: \"PreferedAngleX\", \"double\", \"\",0\n Property: \"PreferedAngleY\", \"double\", \"\",0\n Property: \"PreferedAngleZ\", \"double\", \"\",0\n Property: \"InheritType\", \"enum\", \"\",0\n Property: \"ScalingActive\", \"bool\", \"\",0\n Property: \"ScalingMin\", \"Vector3D\", \"\",1,1,1\n Property: \"ScalingMax\", \"Vector3D\", \"\",1,1,1\n Property: \"ScalingMinX\", \"bool\", \"\",0\n Property: \"ScalingMinY\", \"bool\", \"\",0\n Property: \"ScalingMinZ\", \"bool\", \"\",0\n Property: \"ScalingMaxX\", \"bool\", \"\",0\n Property: \"ScalingMaxY\", \"bool\", \"\",0\n Property: \"ScalingMaxZ\", \"bool\", \"\",0\n Property: \"GeometricTranslation\", \"Vector3D\", \"\",0,0,0\n Property: \"GeometricRotation\", \"Vector3D\", \"\",0,0,0\n Property: \"GeometricScaling\", \"Vector3D\", \"\",1,1,1\n Property: \"LookAtProperty\", \"object\", \"\"\n Property: \"UpVectorProperty\", \"object\", \"\"\n Property: \"Show\", \"bool\", \"\",1\n Property: \"NegativePercentShapeSupport\", \"bool\", \"\",1\n Property: \"DefaultAttributeIndex\", \"int\", \"\",0\n Property: \"Color\", \"Color\", \"A+\",0,0,0\n Property: \"Size\", \"double\", \"\",100\n Property: \"Look\", \"enum\", \"\",1\n }"; // Default materials layer - - var defaultMaterialLayer = "\n LayerElementMaterial: 0 {\n Version: 101\n Name: \"\"\n MappingInformationType: \"AllSame\"\n ReferenceInformationType: \"Direct\"\n Materials: 0\n }"; // Default layers block + }); + } + markCycles() { + this._findLoops(_isAromatic, _checkCycleSimple); + } + detectCycles() { + this._findLoops(_isPossibleAromatic, _checkCycleComplex); + } +} +/* harmony default export */ const chem_AromaticLoopsMarker = (AromaticLoopsMarker); +;// CONCATENATED MODULE: ./src/chem/VoxelWorld.js + + + +/** + * Calculate min & max radius of a sphere slice between zMin & zMax + * + * @param {Vector3} center - center of the sphere + * @param {number} radius - sphere radius + * @param {number} zMin - lower bound of the slice + * @param {number} zMax - upper bound of the slice + */ +function _getSphereSliceRadiusRange(center, radius, zMin, zMax) { + const dzMin = zMin - center.z; + const dzMax = zMax - center.z; + const rzMin = Math.sqrt(Math.max(radius * radius - dzMin * dzMin, 0.0)); + const rzMax = Math.sqrt(Math.max(radius * radius - dzMax * dzMax, 0.0)); + const rMin = Math.min(rzMin, rzMax); + let rMax; + if (zMin <= center.z && zMax >= center.z) { + // sphere's main diameter is inside slice + rMax = radius; + } else { + rMax = Math.max(rzMin, rzMax); + } + return [rMin, rMax]; +} + +/** + * Calculate min & max radius of a circle slice between yMin & yMax. + * + * To maintain analogy with _getSphereSliceRadiusRange we call radius what in fact is + * half-width (along X axis) of the slice, i.e. 1D-sphere radius. + * + * @param {Vector3} center - center of the circle (z can be ignored) + * @param {number} radius - circle radius + * @param {number} yMin - lower bound of the slice + * @param {number} yMax - upper bound of the slice + * @returns {Array} - array of two numbers (min & max radius, or half-width) + */ +function _getCircleSliceRadiusRange(center, radius, yMin, yMax) { + const dyMin = yMin - center.y; + const dyMax = yMax - center.y; + const ryMin = Math.sqrt(Math.max(radius * radius - dyMin * dyMin, 0.0)); + const ryMax = Math.sqrt(Math.max(radius * radius - dyMax * dyMax, 0.0)); + const rMin = Math.min(ryMin, ryMax); + let rMax; + if (yMin <= center.y && yMax >= center.y) { + // slice's main diameter is inside slice + rMax = radius; + } else { + rMax = Math.max(ryMin, ryMax); + } + return [rMin, rMax]; +} + +/** + * VoxelWorld constructor + * + * @param {Box3} box - bounding box of the volume to be partitioned + * @param {Vector3} vCellSizeHint - target voxel size (actual voxel size may differ from this) + */ +class VoxelWorld { + constructor(box, vCellSizeHint) { + this._box = box.clone(); + const size = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + box.getSize(size); + this._count = size.clone().divide(vCellSizeHint).floor().max(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1, 1, 1)); + this._last = this._count.clone().subScalar(1); + this._cellSize = size.clone().divide(this._count); + this._cellInnerR = 0.5 * Math.min(Math.min(this._cellSize.x, this._cellSize.y), this._cellSize.z); + this._cellOuterR = 0.5 * Math.sqrt(this._cellSize.dot(this._cellSize)); + + // array of voxels, each element contains index of first atom in voxel + const numVoxels = this._count.x * this._count.y * this._count.z; + this._voxels = utils.allocateTyped(Int32Array, numVoxels); + for (let i = 0; i < numVoxels; ++i) { + this._voxels[i] = -1; + } + + // array of atoms that stores multiple single-linked lists + // two elements for each atom: Atom ref, index of next atom (in this array + this._atoms = []; + } - var defaultLayerBlock = "\n Layer: 0 {\n Version: 100\n LayerElement: {\n Type: \"LayerElementNormal\"\n TypedIndex: 0\n }\n LayerElement: {\n Type: \"LayerElementColor\"\n TypedIndex: 0\n }\n LayerElement: {\n Type: \"LayerElementMaterial\"\n TypedIndex: 0\n }\n }"; /** - * globalSettings info in output file. + * Add all atoms from a complex to voxel world + * + * @param {Complex} complex - complex */ + addAtoms(complex) { + const self = this; + let idx = this._atoms.length; + + // resize array of atoms + this._atoms.length += 2 * complex.getAtomCount(); + complex.forEachAtom(atom => { + // find which voxel contains this atom + const voxelIdx = self._findVoxel(atom.position); + + // push current atom to the head of voxel's atom list + self._atoms[idx] = atom; + self._atoms[idx + 1] = self._voxels[voxelIdx]; + self._voxels[voxelIdx] = idx; + idx += 2; + }); + } - var globalSettings = "GlobalSettings: {\n Version: 1000\n Properties60: {\n Property: \"UpAxis\", \"int\", \"\",1\n Property: \"UpAxisSign\", \"int\", \"\",1\n Property: \"FrontAxis\", \"int\", \"\",2\n Property: \"FrontAxisSign\", \"int\", \"\",1\n Property: \"CoordAxis\", \"int\", \"\",0\n Property: \"CoordAxisSign\", \"int\", \"\",1\n Property: \"UnitScaleFactor\", \"double\", \"\",1\n }\n }"; - - var FBXResult = /*#__PURE__*/function () { - function FBXResult() { - classCallCheck(this, FBXResult); + /** + * Get voxel that contains specified 3D point (we use clamp at the edges) + * + * @param {Vector3} point - a point in 3D + * @returns {number} - index of voxel + */ + static _zero = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0))(); + static _voxel = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3())(); + _findVoxel(point) { + const zero = VoxelWorld._zero; + const voxel = VoxelWorld._voxel; + voxel.copy(point).sub(this._box.min).divide(this._cellSize).floor().clamp(zero, this._last); + return voxel.x + this._count.x * (voxel.y + this._count.y * voxel.z); + } - this._resultArray = []; - this._info = null; + /** + * Call a function for each atom in voxel + * + * @param {number} voxel - index of voxel + * @param {function(Atom)} process - function to call + */ + _forEachAtomInVoxel(voxel, process) { + for (let i = this._voxels[voxel]; i >= 0; i = this._atoms[i + 1]) { + process(this._atoms[i]); } + } - createClass(FBXResult, [{ - key: "getResult", - value: function getResult(info) { - this._info = info; - - this._resultArray.push(this._writeHeader()); - - this._resultArray.push(this._writeDefinitions()); - - this._resultArray.push(this._writeObjects(info.models, info.materials)); - - this._resultArray.push(this._writeRelations()); - - this._resultArray.push(this._writeConnections()); // connections between models and materials) - + /** + * Call a function for each voxel that is touched by given sphere. Callback also takes flag + * isInside specifying whether voxel lies inside the sphere entirely. + * + * @param {Vector3} center - center of the sphere + * @param {number} radius - sphere radius + * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside + */ - this._info = null; - return this._resultArray.join(''); + static _xRange = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2())(); + static _yRange = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2())(); + static _zRange = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2())(); + _forEachVoxelWithinRadius(center, radius, process) { + const xRange = VoxelWorld._xRange; + const yRange = VoxelWorld._yRange; + const zRange = VoxelWorld._zRange; + + // switch to a faster method unless cell size is much smaller than sphere radius + if (radius / this._cellInnerR < 10) { + this._forEachVoxelWithinRadiusSimple(center, radius, process); + return; + } + let rRangeXY; + let rRangeX; + let xVal; + let yVal; + let zVal; + let isInsideX; + let isInsideY; + let isInsideZ; + zRange.set(center.z - radius, center.z + radius); + zRange.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor().clampScalar(0, this._count.z - 1); + for (let z = zRange.x; z <= zRange.y; ++z) { + zVal = [this._box.min.z + z * this._cellSize.z, this._box.min.z + (z + 1) * this._cellSize.z]; + isInsideZ = center.z - radius <= zVal[0] && zVal[1] <= center.z + radius; + rRangeXY = _getSphereSliceRadiusRange(center, radius, zVal[0], zVal[1]); + yRange.set(center.y - rRangeXY[1], center.y + rRangeXY[1]); + yRange.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor().clampScalar(0, this._count.y - 1); + for (let y = yRange.x; y <= yRange.y; ++y) { + yVal = [this._box.min.y + y * this._cellSize.y, this._box.min.y + (y + 1) * this._cellSize.y]; + isInsideY = center.y - rRangeXY[0] <= yVal[0] && yVal[1] <= center.y + rRangeXY[0]; + rRangeX = _getCircleSliceRadiusRange(center, rRangeXY[1], yVal[0], yVal[1]); + xRange.set(center.x - rRangeX[1], center.x + rRangeX[1]); + xRange.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor().clampScalar(0, this._count.x - 1); + for (let { + x + } = xRange; x <= xRange.y; ++x) { + xVal = [this._box.min.x + x * this._cellSize.x, this._box.min.x + (x + 1) * this._cellSize.x]; + isInsideX = center.x - rRangeX[0] <= xVal[0] && xVal[1] <= center.x + rRangeX[0]; + process(x + this._count.x * (y + this._count.y * z), isInsideX && isInsideY && isInsideZ); + } } - /** - * Add FBXHeader info to output file. - * Some fields are really confusing, but it seems that all listed fields are very informative - */ - - }, { - key: "_writeHeader", - value: function _writeHeader() { - var FBXHeaderVersion = 1003; // 1003 is some number which appears to present in many 6.1 ASCII files - - var FBXVersion = 6100; // Mandatory and only supported version + } + } - var date = new Date(); - var timeStampVersion = 1000; - var creator = "Miew FBX Exporter v".concat(this._info.version); // Supposed to be an engine + /** + * Call a function for each voxel that is touched by given sphere. Callback also takes flag + * isInside specifying whether voxel lies inside the sphere entirely. + * This is a version of method that doesn't try to "calculate" what voxels fall inside radius + * but instead just checks all voxels inside sphere's bounding box. This should be faster + * unless cell size is much smaller than sphere radius. + * + * @param {Vector3} center - center of the sphere + * @param {number} radius - sphere radius + * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside + */ - return "; FBX 6.1.0 project file\n; Created by ".concat(creator, " Copyright (c) 2015-2020 EPAM Systems, Inc.\n; For support please contact miew@epam.com\n; ----------------------------------------------------\n\nFBXHeaderExtension: {\n FBXHeaderVersion: ").concat(FBXHeaderVersion, "\n FBXVersion: ").concat(FBXVersion, "\n CreationTimeStamp: {\n Version: ").concat(timeStampVersion, "\n Year: ").concat(date.getFullYear(), "\n Month: ").concat(date.getMonth() + 1, " \n Day: ").concat(date.getDate(), "\n Hour: ").concat(date.getHours(), "\n Minute: ").concat(date.getMinutes(), "\n Second: ").concat(date.getSeconds(), "\n Millisecond: ").concat(date.getMilliseconds(), "\n }\n Creator: \"").concat(creator, "\"\n OtherFlags: {\n FlagPLE: 0\n }\n}\nCreationTime: \"").concat(date, "\"\nCreator: \"").concat(creator, "\" \n"); + static _vCenter = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3())(); + _forEachVoxelWithinRadiusSimple(center, radius, process) { + const xRange = VoxelWorld._xRange; + const yRange = VoxelWorld._yRange; + const zRange = VoxelWorld._zRange; + const vCenter = VoxelWorld._vCenter; + const distTouch2 = (radius + this._cellOuterR) * (radius + this._cellOuterR); + let distInside2 = -1.0; + if (radius > this._cellOuterR) { + distInside2 = (radius - this._cellOuterR) * (radius - this._cellOuterR); + } + + // calculate bounding box for the sphere + xRange.set(center.x - radius, center.x + radius); + xRange.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor(); + xRange.x = Math.min(Math.max(xRange.x, 0), this._count.x - 1); + xRange.y = Math.min(Math.max(xRange.y, 0), this._count.x - 1); + yRange.set(center.y - radius, center.y + radius); + yRange.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor(); + yRange.x = Math.min(Math.max(yRange.x, 0), this._count.y - 1); + yRange.y = Math.min(Math.max(yRange.y, 0), this._count.y - 1); + zRange.set(center.z - radius, center.z + radius); + zRange.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor(); + zRange.x = Math.min(Math.max(zRange.x, 0), this._count.z - 1); + zRange.y = Math.min(Math.max(zRange.y, 0), this._count.z - 1); + for (let z = zRange.x; z <= zRange.y; ++z) { + const zVal = [this._box.min.z + z * this._cellSize.z, this._box.min.z + (z + 1) * this._cellSize.z]; + vCenter.z = 0.5 * (zVal[0] + zVal[1]); + for (let y = yRange.x; y <= yRange.y; ++y) { + const yVal = [this._box.min.y + y * this._cellSize.y, this._box.min.y + (y + 1) * this._cellSize.y]; + vCenter.y = 0.5 * (yVal[0] + yVal[1]); + for (let { + x + } = xRange; x <= xRange.y; ++x) { + const xVal = [this._box.min.x + x * this._cellSize.x, this._box.min.x + (x + 1) * this._cellSize.x]; + vCenter.x = 0.5 * (xVal[0] + xVal[1]); + const d2 = center.distanceToSquared(vCenter); + if (d2 <= distTouch2) { + process(x + this._count.x * (y + this._count.y * z), d2 <= distInside2); + } + } } - /** - * Add Definitions info to output file. - * Not exactly sure if this section is template section (as it is in 7.4+) or it should every time be like this - */ + } + } - }, { - key: "_writeDefinitions", - value: function _writeDefinitions() { - return "\n; Object definitions\n;------------------------------------------------------------------\n\n".concat(defaultDefinitions, "\n"); + /** + * Call a function for each atom within given sphere + * + * @param {Vector3} center - center of the sphere + * @param {number} radius - sphere radius + * @param {function(Atom)} process - function to call + */ + forEachAtomWithinRadius(center, radius, process) { + const self = this; + const r2 = radius * radius; + self._forEachVoxelWithinRadius(center, radius, (voxel, isInside) => { + if (isInside) { + self._forEachAtomInVoxel(voxel, process); + } else { + self._forEachAtomInVoxel(voxel, atom => { + if (center.distanceToSquared(atom.position) <= r2) { + process(atom); + } + }); } - /** - * Adding gathered information about Models to resulting string. - * Reminder - there may be more then 1 model in scene, but we must place materials after ALL models. - * @returns {string} string containing all models (vertices, indices, colors, normals etc) - */ - - }, { - key: "_models", - value: function _models() { - var modelVersion = 232; - var allModels = ''; - var models = this._info.models; + }); + } - for (var i = 0; i < models.length; ++i) { - var model = models[i]; - var vertCount = model.verticesCount; - allModels += "\n Model: \"Model::".concat(this._info.name, "_").concat(i, "\", \"Mesh\" {\n Version: ").concat(modelVersion, " \n ").concat(defaultProperties, "\n ").concat(this._verticesIndices(model.positions, model.indices), "\n ").concat(this._normalLayer(model.normals), " \n ").concat(this._colorLayer(model.colors, vertCount), " \n ").concat(defaultMaterialLayer, " \n ").concat(defaultLayerBlock, "\n }"); + /** + * Call a function for each atom of given complex within given distance from group of atoms defined by mask + * + * @param {Complex} complex - complex + * @param {number} mask - bit mask + * @param {number} dist - distance + * @param {function(Atom)} process - function to call + */ + forEachAtomWithinDistFromMasked(complex, mask, dist, process) { + this._forEachAtomWithinDistFromGroup(atomProc => { + complex.forEachAtom(atom => { + if ((atom.mask & mask) !== 0) { + atomProc(atom); } + }); + }, dist, process); + } - return allModels; - } - /** - * Add Material info to result - */ - - }, { - key: "_materials", - value: function _materials() { - var materialVersion = 102; - var allMaterials = ''; - var materials = this._info.materials; - - for (var i = 0; i < materials.length; ++i) { - var material = materials[i]; - allMaterials += "\n Material: \"Material::".concat(this._info.name, "_").concat(i, "_default\", \"\" {\n Version: ").concat(materialVersion, "\n ShadingModel: \"lambert\"\n MultiLayer: 0\n ").concat(this._materialProperties(material), "\n }"); + /** + * Call a function for each atom of given complex within given distance from group of atoms defined by selector + * + * @param {Complex} complex - complex + * @param {number} selector - selector + * @param {number} dist - distance + * @param {function(Atom)} process - function to call + */ + forEachAtomWithinDistFromSelected(complex, selector, dist, process) { + this._forEachAtomWithinDistFromGroup(atomProc => { + complex.forEachAtom(atom => { + if (selector.includesAtom(atom)) { + atomProc(atom); } + }); + }, dist, process); + } - return allMaterials; + /** + * Call a function for each atom of given complex within given distance from group of atoms + * + * @param {function} forEachAtom - enumerator of atoms in the group + * @param {number} dist - distance + * @param {function(Atom)} process - function to call + */ + _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) { + const self = this; + const r2 = dist * dist; + const voxels = []; + const atoms = []; + let idx = 0; + + // build "within radius" atom list for each voxel + forEachAtom(atom => { + self._forEachVoxelWithinRadius(atom.position, dist, (voxel, isInside) => { + if (isInside) { + // this voxel is inside circle -- no check will be required + voxels[voxel] = -1; + } else if (typeof voxels[voxel] === 'undefined') { + // this voxel isn't covered yet -- start building list of atoms + atoms.push(atom); + atoms.push(-1); + voxels[voxel] = idx; + idx += 2; + } else if (voxels[voxel] !== -1) { + // this voxel has a list of atoms required for distance check -- add atom to the list + atoms.push(atom); + atoms.push(voxels[voxel]); + voxels[voxel] = idx; + idx += 2; + } + }); + }); + let voxel; + const processIfWithin = function (atom) { + if (typeof voxels[voxel] === 'undefined') { + return; } - /** - * Add Objects info to output file. - */ - - }, { - key: "_writeObjects", - value: function _writeObjects() { - return "\n; Object properties\n;------------------------------------------------------------------\n\nObjects: {\n ".concat(this._models(), "\n ").concat(this._materials(), "\n ").concat(globalSettings, "\n}\n"); + idx = voxels[voxel]; + if (idx === -1) { + // this voxel is fully covered + process(atom); + return; } - /** - * Add Relations info to output file. - */ - - }, { - key: "_writeRelations", - value: function _writeRelations() { - var modelsList = ''; - for (var i = 0; i < this._info.models.length; ++i) { - modelsList += "\n Model: \"Model::".concat(this._info.name, "_").concat(i, "\", \"Mesh\" {\n }"); - } - - var materialList = ''; - - for (var _i = 0; _i < this._info.materials.length; ++_i) { - materialList += "\n Material: \"Material::".concat(this._info.name, "_").concat(_i, "_default\", \"\" {\n }"); + // check distance to each atom within radius from this voxel + for (; idx >= 0; idx = atoms[idx + 1]) { + if (atom.position.distanceToSquared(atoms[idx].position) < r2) { + process(atom); + break; } - - return "\n; Object relations\n;------------------------------------------------------------------\n\nRelations: {\n ".concat(modelsList, "\n Model: \"Model::Producer Perspective\", \"Camera\" {\n }\n Model: \"Model::Producer Top\", \"Camera\" {\n }\n Model: \"Model::Producer Bottom\", \"Camera\" {\n }\n Model: \"Model::Producer Front\", \"Camera\" {\n }\n Model: \"Model::Producer Back\", \"Camera\" {\n }\n Model: \"Model::Producer Right\", \"Camera\" {\n }\n Model: \"Model::Producer Left\", \"Camera\" {\n }\n Model: \"Model::Camera Switcher\", \"CameraSwitcher\" {\n }\n ").concat(materialList, "\n}"); } - /** - * Add Connections info to output file. - */ + }; - }, { - key: "_writeConnections", - value: function _writeConnections() { - var modelsList = ''; - var name = this._info.name; + // for each marked voxel + for (voxel in voxels) { + if (voxels.hasOwnProperty(voxel)) { + self._forEachAtomInVoxel(voxel, processIfWithin); + } + } + } +} +/* harmony default export */ const chem_VoxelWorld = (VoxelWorld); +;// CONCATENATED MODULE: ./src/chem/HBondInfo.js + + +const MINIMAL_DISTANCE = 0.5; +const MIN_HBOND_ENERGY = -9.9; +const MAX_HBOND_ENERGY = -0.5; +const COUPLING_CONSTANT = -27.888; // = -332 * 0.42 * 0.2 +const MAX_COUPLING_DISTANCE = 5.0; // how far is the closest atom of a potential partner residue from CA atom +const MAX_RESIDUES_THRESHOLD = 1000; +class HBondInfo { + constructor(complex) { + this._complex = complex; + this._hbonds = []; // array of bond info for each residue + if (this._complex._residues.length > MAX_RESIDUES_THRESHOLD) { + this._buildVW(); // optimized version using voxel grid + } else { + this._build(); // test all pairs of residues + } + } + isBond(from, to) { + if (this._hbonds[from]) { + const [acc0, acc1] = this._hbonds[from].acceptor; + if (acc0 && acc0.residue === to && acc0.energy < MAX_HBOND_ENERGY) { + return true; + } + if (acc1 && acc1.residue === to && acc1.energy < MAX_HBOND_ENERGY) { + return true; + } + } + return false; + } + _build() { + const self = this; + for (let i = 0; i < this._complex._residues.length - 1; ++i) { + const ri = this._complex._residues[i]; + if ((ri.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + continue; + } - for (var i = 0; i < this._info.models.length; ++i) { - modelsList += "\n Connect: \"OO\", \"Model::".concat(name, "_").concat(i, "\", \"Model::Scene\""); + // get predecessor in chain + let preri = null; + if (i > 0 && this._complex._residues[i - 1].getType().flags & chem_ResidueType.Flags.PROTEIN && ri._sequence === this._complex._residues[i - 1]._sequence + 1) { + preri = this._complex._residues[i - 1]; + } + for (let j = i + 1; j < this._complex._residues.length; ++j) { + const rj = this._complex._residues[j]; + if ((rj.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + continue; } - var materialList = ''; - - for (var _i2 = 0; _i2 < this._info.materials.length; ++_i2) { - materialList += "\n Connect: \"OO\", \"Material::".concat(name, "_").concat(_i2, "_default\", \"Model::").concat(name, "_").concat(_i2, "\""); + // get predecessor in chain + let prerj = null; + if (this._complex._residues[j - 1].getType().flags & chem_ResidueType.Flags.PROTEIN && rj._sequence === this._complex._residues[j - 1]._sequence + 1) { + prerj = this._complex._residues[j - 1]; } - - return "\n; Object connections\n;------------------------------------------------------------------\n\nConnections: {\n ".concat(modelsList, "\n ").concat(materialList, "\n}"); - } - /** - * Write float array to string with limited precision - * @param {Float32Array} array - array to be fixed - * @returns {String} String with fixed floats - */ - - }, { - key: "_floatArrayToString", - value: function _floatArrayToString(array) { - var str = []; - - for (var i = 0; i < array.length; ++i) { - str[i] = array[i].toFixed(6); + self._calcHBondEnergy(preri, ri, rj); + if (j !== i + 1) { + self._calcHBondEnergy(prerj, rj, ri); } - - return str.join(','); } - /** - * Adding color layer to resulting file - * @param {Float32Array} colorArray attribute - * @param {number} vertCount - number of vertices in the model - * @returns {string} color layer info - */ - - }, { - key: "_colorLayer", - value: function _colorLayer(colorArray, vertCount) { - var layerElementColorNumber = 0; - var layerElementColorVersion = 101; - var layerElementColorName = ''; - - var colorsStr = this._floatArrayToString(colorArray); // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed - // As said [..Array(...)] - fastest and easiest way to produce [0, 1, .....] array - - - var colorIndices = toConsumableArray(Array(vertCount).keys()); - - return "\n LayerElementColor: ".concat(layerElementColorNumber, " {\n Version: ").concat(layerElementColorVersion, "\n Name: \"").concat(layerElementColorName, "\"\n MappingInformationType: \"ByVertice\"\n ReferenceInformationType: \"Direct\"\n Colors: ").concat(colorsStr, "\n ColorIndex: ").concat(colorIndices, "\n }"); + } + } + _buildVW() { + const self = this; + const residues = this._complex._residues; + let ri; + let preri; + const vw = this._complex.getVoxelWorld(); + if (vw === null) { + return; + } + const pairs = new chem_AtomPairs(this._complex._residues.length * this._complex._residues.length / 2); + function processAtom(atom) { + const rj = atom.residue; + if (rj._index === ri._index) { + return; } - /** - * Adding normal layer to resulting file - * @param {Float32Array} normalArray attribute - * @returns {string} normal layer info - */ - - }, { - key: "_normalLayer", - value: function _normalLayer(normalArray) { - var layerElementNormalNumber = 0; - var layerElementNormalVersion = 101; - var layerElementNormalName = ''; - - var normalsStr = this._floatArrayToString(normalArray); // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed - - - return "\n LayerElementNormal: ".concat(layerElementNormalNumber, " {\n Version: ").concat(layerElementNormalVersion, "\n Name: \"").concat(layerElementNormalName, "\"\n MappingInformationType: \"ByVertice\"\n ReferenceInformationType: \"Direct\" \n Normals: ").concat(normalsStr, "\n }"); + if ((rj.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + return; + } + if (!pairs.addPair(ri._index, rj._index)) { + // we've seen this pair + return; } - /** - * Adding vertices and indices to resulting string - * @return {string} resulting string in FBX notation - */ - - }, { - key: "_verticesIndices", - value: function _verticesIndices(positions, indices) { - var multiLayer = 0; - var multiTake = 1; - var shading = 'Y'; - var culling = 'CullingOff'; - var geometryVersion = 124; - var vertStr = this._floatArrayToString(positions); - /* About _correctArrayNotation: Float32Arrays will contains only Float32 numbers, which implies that it will be floating points with 17 numbers after point. - * We cannot (and it's logically incorrect) save all this information, so we convert this Float32Array into Array-like object with numbers with only 6 numbers after point - * Reminder - this is big memory loss (as we must save at one moment two arrays with similar information) */ + // get predecessor in chain + let prerj = rj._index > 0 ? residues[rj._index - 1] : null; + if (prerj && ((prerj.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0 || rj._sequence !== prerj._sequence + 1)) { + prerj = null; + } + self._calcHBondEnergy(preri, ri, rj); + if (rj._index !== ri._index + 1) { + self._calcHBondEnergy(prerj, rj, ri); + } + } + for (let i = 0; i < residues.length - 1; ++i) { + ri = residues[i]; + if ((ri.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + continue; + } + // get predecessor in chain + preri = i > 0 ? residues[i - 1] : null; + if (preri && ((preri.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0 || ri._sequence !== preri._sequence + 1)) { + preri = null; + } + vw.forEachAtomWithinRadius(this._residueGetCAlpha(ri), MAX_COUPLING_DISTANCE, processAtom); + } + } + _residueGetCAlpha(res) { + for (let i = 0; i < res._atoms.length; ++i) { + const { + name + } = res._atoms[i]; + if (name === 'CA' || name === 'C1') { + return res._atoms[i].position; + } + } + return null; + } + _residueGetCO(res) { + let c = null; + let o = null; + res.forEachAtom(a => { + if (a.name === 'C') { + c = a.position; + } else if (a.name === 'O') { + o = a.position; + } + }); + return [c, o]; + } - return "MultiLayer: ".concat(multiLayer, "\n MultiTake: ").concat(multiTake, "\n Shading: ").concat(shading, "\n Culling: \"").concat(culling, "\"\n Vertices: ").concat(vertStr, "\n PolygonVertexIndex: ").concat(indices, "\n GeometryVersion: ").concat(geometryVersion); + // TODO Support hydrogen defined in complex + _residueGetNH(prev, res) { + const [c, o] = this._residueGetCO(prev); + let n; + res.forEachAtom(a => { + if (a.name === 'N') { + n = a.position; } - /** - * Forming material properties block. - * @param {Object} material - given material of model - * @returns {String} material properties string - */ - - }, { - key: "_materialProperties", - value: function _materialProperties(material) { - return "Properties60: {\n Property: \"ShadingModel\", \"KString\", \"\", \"Lambert\"\n Property: \"MultiLayer\", \"bool\", \"\",0\n Property: \"EmissiveColor\", \"ColorRGB\", \"\",0,0,0\n Property: \"EmissiveFactor\", \"double\", \"\",0.0000\n Property: \"AmbientColor\", \"ColorRGB\", \"\",1,1,1\n Property: \"AmbientFactor\", \"double\", \"\",0.0000\n Property: \"DiffuseColor\", \"ColorRGB\", \"\",".concat(material.diffuse, "\n Property: \"DiffuseFactor\", \"double\", \"\",1.0000\n Property: \"Bump\", \"Vector3D\", \"\",0,0,0\n Property: \"TransparentColor\", \"ColorRGB\", \"\",1,1,1\n Property: \"TransparencyFactor\", \"double\", \"\",0.0000\n Property: \"SpecularColor\", \"ColorRGB\", \"\",").concat(material.specular, "\n Property: \"SpecularFactor\", \"double\", \"\",1.0000\n Property: \"ShininessExponent\", \"double\", \"\",").concat(material.shininess, "\n Property: \"ReflectionColor\", \"ColorRGB\", \"\",0,0,0\n Property: \"ReflectionFactor\", \"double\", \"\",1\n Property: \"Ambient\", \"ColorRGB\", \"\",1,1,1\n Property: \"Diffuse\", \"ColorRGB\", \"\",").concat(material.diffuse, "\n Property: \"Specular\", \"ColorRGB\", \"\",").concat(material.specular, "\n Property: \"Shininess\", \"double\", \"\",").concat(material.shininess, "\n Property: \"Opacity\", \"double\", \"\",").concat(material.opacity, "\n Property: \"Reflectivity\", \"double\", \"\",0\n }"); + }); + if (c && o && n) { + // calculate hydrogen position + const h = c.clone(); + h.sub(o); + h.multiplyScalar(1.0 / h.length()); + h.add(n); + return [n, h]; + } + return [null, null]; + } + _calcHBondEnergy(predonor, donor, acceptor) { + let result = 0; + if (predonor === null) { + return result; + } + if (donor.getType().getName() !== 'PRO') { + const [n, h] = this._residueGetNH(predonor, donor); + const [c, o] = this._residueGetCO(acceptor); + if (n === null || h === null || c === null || o === null) { + return result; + } + const distanceHO = h.distanceTo(o); + const distanceHC = h.distanceTo(c); + const distanceNC = n.distanceTo(c); + const distanceNO = n.distanceTo(o); + if (distanceHO < MINIMAL_DISTANCE || distanceHC < MINIMAL_DISTANCE || distanceNC < MINIMAL_DISTANCE || distanceNO < MINIMAL_DISTANCE) { + result = MIN_HBOND_ENERGY; + } else { + result = COUPLING_CONSTANT / distanceHO - COUPLING_CONSTANT / distanceHC + COUPLING_CONSTANT / distanceNC - COUPLING_CONSTANT / distanceNO; } - }]); - - return FBXResult; - }(); - - var FBXExporter = /*#__PURE__*/function (_Exporter) { - inherits(FBXExporter, _Exporter); - - function FBXExporter(source, options) { - var _this; - - classCallCheck(this, FBXExporter); - - _this = possibleConstructorReturn(this, getPrototypeOf(FBXExporter).call(this, source, options)); // Data - _this._data = source; - _this._version = options.miewVersion || '0.0-UNSPECIFIED'; - _this._extractor = new FBXInfoExtractor(); - return _this; + // DSSP compatibility mode: + result = Math.round(result * 1000) / 1000; + if (result < MIN_HBOND_ENERGY) { + result = MIN_HBOND_ENERGY; + } } - /** - * Entry point to exporter. - */ - - - createClass(FBXExporter, [{ - key: "exportSync", - value: function exportSync() { - // Creating mandatory blocks - var result = new FBXResult(); - - if (!this._source) { - return this._result; - } - - var info = this._extractor.process(this._data); - info.version = this._version; - this._result = result.getResult(info); - return this._result; + // update donor + if (typeof this._hbonds[donor._index] === 'undefined') { + this._hbonds[donor._index] = { + donor: [], + acceptor: [] + }; + } + const donorInfo = this._hbonds[donor._index]; + if (donorInfo.acceptor.length < 2) { + donorInfo.acceptor.push({ + residue: acceptor._index, + energy: result + }); + } + if (donorInfo.acceptor.length > 1) { + if (result < donorInfo.acceptor[0].energy) { + donorInfo.acceptor[1].residue = donorInfo.acceptor[0].residue; + donorInfo.acceptor[1].energy = donorInfo.acceptor[0].energy; + donorInfo.acceptor[0].residue = acceptor._index; + donorInfo.acceptor[0].energy = result; + } else if (result < donorInfo.acceptor[1].energy) { + donorInfo.acceptor[1].residue = acceptor._index; + donorInfo.acceptor[1].energy = result; } - }]); - - return FBXExporter; - }(Exporter); - FBXExporter.formats = ['fbx']; - FBXExporter.SourceClass = ComplexVisual; - - var exporters = new ExporterList([PDBExporter, FBXExporter]); - - var io = { - loaders: loaders, - parsers: parsers, - exporters: exporters - }; - - var tempColor = new THREE.Color(); - - var CSS2DRenderer = /*#__PURE__*/function () { - function CSS2DRenderer() { - classCallCheck(this, CSS2DRenderer); - - this._width = 0; - this._height = 0; - this._widthHalf = 0; - this._heightHalf = 0; - this._vector = new THREE.Vector3(); - this._viewMatrix = new THREE.Matrix4(); - this._projectionMatrix = new THREE.Matrix4(); - this._domElement = document.createElement('div'); - this._domElement.style.overflow = 'hidden'; - this._domElement.style.position = 'absolute'; - this._domElement.style.top = '0'; - this._domElement.style.zIndex = '0'; // start a new Stacking Context to enclose all z-ordered children - - this._domElement.style.pointerEvents = 'none'; } - createClass(CSS2DRenderer, [{ - key: "getElement", - value: function getElement() { - return this._domElement; + // update acceptor + if (typeof this._hbonds[acceptor._index] === 'undefined') { + this._hbonds[acceptor._index] = { + donor: [], + acceptor: [] + }; + } + const accInfo = this._hbonds[acceptor._index]; + if (accInfo.donor.length < 2) { + accInfo.donor.push({ + residue: donor._index, + energy: result + }); + } + if (accInfo.donor.length > 1) { + if (result < accInfo.donor[0].energy) { + accInfo.donor[1].residue = accInfo.donor[0].residue; + accInfo.donor[1].energy = accInfo.donor[0].energy; + accInfo.donor[0].residue = donor._index; + accInfo.donor[0].energy = result; + } else if (result < accInfo.donor[1].energy) { + accInfo.donor[1].residue = donor._index; + accInfo.donor[1].energy = result; } - }, { - key: "reset", - value: function reset() { - var myNode = this.getElement(); - - while (myNode.firstChild) { - myNode.removeChild(myNode.firstChild); + } + return result; + } +} +;// CONCATENATED MODULE: ./src/chem/SecondaryStructureMap.js + + +const BridgeType = Object.freeze({ + NO_BRIDGE: 0, + PARALLEL: 1, + ANTI_PARALLEL: 2 +}); +const HelixFlag = Object.freeze({ + START: 1, + MIDDLE: 2, + END: 3, + START_AND_END: 4 +}); +const StructureType = Object.freeze({ + STRAND: 'E', + BRIDGE: 'B', + HELIX_310: 'G', + HELIX_ALPHA: 'H', + HELIX_PI: 'I', + TURN: 'T', + BEND: 'S', + LOOP: ' ' +}); +class SecondaryStructureMap { + constructor(complex) { + this._complex = complex; + this._build(); + } + _build() { + const self = this; + this._hbonds = new HBondInfo(this._complex); + this._ss = []; // DSSP map by residue + + // auxilliary data + this._sheet = []; + this._betaPartners = []; + this._bend = []; + for (let i = 0; i < this._complex.getResidues().length; ++i) { + this._betaPartners[i] = []; + } + this._helixFlags = []; + this._helixFlags[3] = []; + this._helixFlags[4] = []; + this._helixFlags[5] = []; + + // calculate peptide chain lengths + this._chainLengths = []; + for (let i = 0; i < this._complex._chains.length; ++i) { + const chain = this._complex._chains[i].getResidues(); + let len = 0; + for (; len < chain.length; ++len) { + if ((chain[len].getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + break; } } - }, { - key: "setSize", - value: function setSize(width, height) { - this._width = width; - this._height = height; - this._widthHalf = this._width / 2; - this._heightHalf = this._height / 2; - this._domElement.style.width = "".concat(width, "px"); - this._domElement.style.height = "".concat(height, "px"); + this._chainLengths[i] = len; + } + this._buildBetaSheets(); + for (let i = 0; i < this._complex._chains.length; ++i) { + self._buildAlphaHelices(this._complex._chains[i].getResidues(), this._chainLengths[i], false); + } + } + _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) { + // Helix and Turn + for (let stride = 3; stride <= 5; ++stride) { + if (inResidues.length < stride) { + break; } - }, { - key: "_renderObject", - value: function _renderObject(object, camera, scene) { - function lerpColorAsHex(a, b, t) { - tempColor.setHex(a); - tempColor.lerp(b, t); - return "#".concat(tempColor.getHexString()); - } - - function colorAsHex(a) { - tempColor.setHex(a); - return "#".concat(tempColor.getHexString()); - } - - if (object instanceof CSS2DObject) { - this._vector.setFromMatrixPosition(object.matrixWorld); - - if (object.userData !== undefined && object.userData.offset !== undefined) { - var localOffset = new THREE.Vector3(object.userData.offset.x, object.userData.offset.y, 0); - - this._vector.add(localOffset.multiplyScalar(object.matrixWorld.getMaxScaleOnAxis())); - } - - this._vector.applyMatrix4(this._viewMatrix); - - var visibility = this._vector.z > -camera.near ? 'hidden' : 'visible'; - var zIndex = 10000 * (camera.far - -this._vector.z) / (camera.far - camera.near); - var element = object.getElement(); - - if (typeof scene.fog === 'undefined') { - element.style.color = colorAsHex(object.userData.color); - - if (object.userData.background !== 'transparent') { - element.style.background = colorAsHex(object.userData.background); - } - } else { - var fogFactor = THREE.Math.smoothstep(-this._vector.z, scene.fog.near, scene.fog.far); - element.style.color = lerpColorAsHex(object.userData.color, scene.fog.color, fogFactor); - - if (object.userData.background !== 'transparent') { - element.style.background = lerpColorAsHex(object.userData.background, scene.fog.color, fogFactor); + for (let i = 0; i + stride < chainLength; ++i) { + if (this._hbonds.isBond(inResidues[i + stride]._index, inResidues[i]._index) + /* && NoChainBreak(res[i], res[i + stride]) */) { + this._helixFlags[stride][inResidues[i + stride]._index] = HelixFlag.END; + for (let j = i + 1; j < i + stride; ++j) { + if (typeof this._helixFlags[stride][inResidues[j]._index] === 'undefined') { + this._helixFlags[stride][inResidues[j]._index] = HelixFlag.MIDDLE; } } - - this._vector.applyMatrix4(this._projectionMatrix); - - var style = "".concat(object.userData !== {} ? object.userData.translation : 'translate(-50%, -50%) ', "translate(").concat(this._vector.x * this._widthHalf + this._widthHalf, "px,").concat(-this._vector.y * this._heightHalf + this._heightHalf, "px)"); - element.style.visibility = visibility; - element.style.WebkitTransform = style; - element.style.MozTransform = style; - element.style.oTransform = style; - element.style.transform = style; - element.style.zIndex = Number(zIndex).toFixed(0); - - if (element.parentNode !== this._domElement) { - this._domElement.appendChild(element); + if (this._helixFlags[stride][inResidues[i]._index] === HelixFlag.END) { + this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START_AND_END; + } else { + this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START; } } - - for (var i = 0, l = object.children.length; i < l; i++) { - this._renderObject(object.children[i], camera, scene); - } } - }, { - key: "render", - value: function render(scene, camera) { - scene.updateMatrixWorld(); - - if (camera.parent === null) { - camera.updateMatrixWorld(); + } + for (let i = 2; i < chainLength - 2; ++i) { + const kappa = this._kappa(inResidues[i - 2], inResidues[i], inResidues[i + 2]); + this._bend[inResidues[i]._index] = kappa !== 360 && kappa > 70; + } + for (let i = 1; i + 4 < chainLength; ++i) { + if (this._isHelixStart(inResidues[i]._index, 4) && this._isHelixStart(inResidues[i - 1]._index, 4)) { + for (let j = i; j <= i + 3; ++j) { + this._ss[inResidues[j]._index] = StructureType.HELIX_ALPHA; } - - camera.matrixWorldInverse.getInverse(camera.matrixWorld); - - this._viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld)); - - this._projectionMatrix.copy(camera.projectionMatrix); - - this._renderObject(scene, camera, scene); } - }]); - - return CSS2DRenderer; - }(); - - var VK_LEFT = 37; - var VK_UP = 38; - var VK_RIGHT = 39; - var VK_DOWN = 40; - var STATE = { - NONE: -1, - ROTATE: 0, - TRANSLATE: 1, - SCALE: 2, - TRANSLATE_PIVOT: 3 - }; // pausing for this amount of time before releasing mouse button prevents inertial rotation (seconds) - - var FULL_STOP_THRESHOLD = 0.1; - var quaternion = new THREE.Quaternion(); - var matrix4 = new THREE.Matrix4(); // pivot -- local offset of the rotation pivot point - - function ObjectHandler(objects, camera, pivot, options) { - this.objects = objects; - - var _objects = slicedToArray(objects, 1); - - this.object = _objects[0]; - this.camera = camera; - this.pivot = pivot; - this.axis = new THREE.Vector3(0, 0, 1); - this.options = options; - this.lastRotation = { - axis: new THREE.Vector3(), - angle: 0.0 - }; - } - - ObjectHandler.prototype._rotate = function () { - var p = new THREE.Vector3(); - var q = new THREE.Quaternion(); - var s = new THREE.Vector3(); - var m = new THREE.Matrix4(); - return function (quat) { - var zeroPivot = this.pivot.x === 0.0 && this.pivot.y === 0.0 && this.pivot.z === 0.0; - m.copy(this.object.matrix); - - if (zeroPivot) { - m.multiply(matrix4.makeRotationFromQuaternion(quat)); - } else { - m.multiply(matrix4.makeTranslation(this.pivot.x, this.pivot.y, this.pivot.z)); - m.multiply(matrix4.makeRotationFromQuaternion(quat)); - m.multiply(matrix4.makeTranslation(-this.pivot.x, -this.pivot.y, -this.pivot.z)); + } + for (let i = 1; i + 3 < chainLength; ++i) { + if (this._isHelixStart(inResidues[i]._index, 3) && this._isHelixStart(inResidues[i - 1]._index, 3)) { + let empty = true; + for (let j = i; empty && j <= i + 2; ++j) { + empty = typeof this._ss[inResidues[j]._index] === 'undefined' || this._ss[inResidues[j]._index] === StructureType.HELIX_310; + } + if (empty) { + for (let j = i; j <= i + 2; ++j) { + this._ss[inResidues[j]._index] = StructureType.HELIX_310; + } + } } - - m.decompose(p, q, s); // update objects - - if (!zeroPivot) { - for (var i = 0; i < this.objects.length; ++i) { - this.objects[i].position.copy(p); + } + for (let i = 1; i + 5 < chainLength; ++i) { + if (this._isHelixStart(inResidues[i]._index, 5) && this._isHelixStart(inResidues[i - 1]._index, 5)) { + let empty = true; + for (let j = i; empty && j <= i + 4; ++j) { + empty = typeof this._ss[inResidues[j]._index] === 'undefined' || this._ss[inResidues[j]._index] === StructureType.HELIX_PI || inPreferPiHelices && this._ss[inResidues[j]._index] === StructureType.HELIX_ALPHA; + } + if (empty) { + for (let j = i; j <= i + 4; ++j) { + this._ss[inResidues[j]._index] = StructureType.HELIX_PI; + } } } - - for (var j = 0; j < this.objects.length; ++j) { - this.objects[j].quaternion.copy(q); - this.objects[j].updateMatrix(); + } + for (let i = 1; i + 1 < chainLength; ++i) { + if (typeof this._ss[inResidues[i]._index] === 'undefined') { + let isTurn = false; + for (let stride = 3; stride <= 5 && !isTurn; ++stride) { + for (let k = 1; k < stride && !isTurn; ++k) { + isTurn = i >= k && this._isHelixStart(inResidues[i - k]._index, stride); + } + } + if (isTurn) { + this._ss[inResidues[i]._index] = StructureType.TURN; + } else if (this._bend[inResidues[i]._index]) { + this._ss[inResidues[i]._index] = StructureType.BEND; + } } - }; - }(); - - ObjectHandler.prototype.setObjects = function (objects) { - this.objects = objects; - - var _objects2 = slicedToArray(objects, 1); - - this.object = _objects2[0]; - }; - - ObjectHandler.prototype.rotate = function () { - var rot = { - axis: new THREE.Vector3(), - angle: 0.0 - }; - return function (quat, mousePrevPos, mouseCurPos, aboutAxis) { - this.mouse2rotation(rot, mousePrevPos, mouseCurPos, aboutAxis); - quat.setFromAxisAngle(rot.axis, rot.angle); - - if (rot.angle) { - this._rotate(quat); + } + } + _residueGetCAlpha(res) { + for (let i = 0; i < res._atoms.length; ++i) { + const { + name + } = res._atoms[i]; + if (name === 'CA' || name === 'C1') { + return res._atoms[i].position; } - - this.lastRotation = rot; - }; - }(); - - ObjectHandler.prototype.translate = function () { - var dir = new THREE.Vector3(); - var pivot = new THREE.Vector3(); - return function (delta) { - // reverse-project viewport movement to view coords (compensate for screen aspect ratio) - dir.set(delta.x / this.camera.projectionMatrix.elements[0], delta.y / this.camera.projectionMatrix.elements[5], 0); - var dist = dir.length(); - dir.normalize(); // transform movement direction to object local coords - - dir.transformDirection(matrix4.getInverse(this.object.matrixWorld)); // visible translate distance shouldn't depend on camera-to-object distance - - pivot.copy(this.pivot); - this.object.localToWorld(pivot); - dist *= Math.abs(pivot.z - this.camera.position.z); // visible translate distance shouldn't depend on object scale - - dist /= this.object.matrixWorld.getMaxScaleOnAxis(); // all objects are translated similar to principal object - // (we assume they all have identical pivot and scale) - - for (var i = 0; i < this.objects.length; ++i) { - this.objects[i].translateOnAxis(dir, dist); + } + return null; + } + _cosinusAngle(p1, p2, p3, p4) { + const v12 = p1.clone().sub(p2); + const v34 = p3.clone().sub(p4); + let result = 0; + const x = v12.dot(v12) * v34.dot(v34); + if (x > 0) { + result = v12.dot(v34) / Math.sqrt(x); + } + return result; + } + _kappa(prevPrev, res, nextNext) { + const curCA = this._residueGetCAlpha(res); + const ppCA = this._residueGetCAlpha(prevPrev); + const nnCA = this._residueGetCAlpha(nextNext); + if (curCA === null || ppCA === null || nnCA === null) { + return 180; + } + const ckap = this._cosinusAngle(curCA, ppCA, nnCA, curCA); + const skap = Math.sqrt(1 - ckap * ckap); + return Math.atan2(skap, ckap) * 180 / Math.PI; + } + _isHelixStart(res, stride) { + return this._helixFlags[stride][res] === HelixFlag.START || this._helixFlags[stride][res] === HelixFlag.START_AND_END; + } + _buildBetaSheets() { + // find bridges + // check each chain against each other chain, and against itself + const bridges = []; + for (let a = 0; a < this._complex._chains.length; ++a) { + const lenA = this._chainLengths[a]; + if (lenA <= 4) { + continue; } - }; - }(); - - ObjectHandler.prototype.update = function () { - var axis = new THREE.Vector3(); - return function (timeSinceLastUpdate, timeSinceMove) { - if (settings.now.autoRotation !== 0.0) { - // auto-rotation with constant speed - // if rotation axis is fixed or hasn't been defined yet - if (settings.now.autoRotationAxisFixed || this.lastRotation.axis.length() === 0.0) { - // use Y-axis (transformed to local object coords) - axis.set(0, 1, 0).transformDirection(matrix4.getInverse(this.object.matrixWorld)); - } else { - // use axis defined by last user rotation - axis.copy(this.lastRotation.axis); + const chainA = this._complex._chains[a].getResidues(); + for (let b = a; b < this._complex._chains.length; ++b) { + const lenB = this._chainLengths[b]; + if (lenB <= 4) { + continue; } + const chainB = this._complex._chains[b].getResidues(); + for (let i = 1; i + 1 < lenA; ++i) { + const ri = chainA[i]; + let j = 1; + if (b === a) { + j = i + 3; // check for self-bridges forward down the chain + } + for (; j + 1 < lenB; ++j) { + const rj = chainB[j]; + const type = this._testBridge(chainA, i, chainB, j); + if (type === BridgeType.NO_BRIDGE) { + continue; + } - this._rotate(quaternion.setFromAxisAngle(axis, settings.now.autoRotation * timeSinceLastUpdate)); + // there is a bridge, try to attach it to previously found sequence + let found = false; + for (const bridge of bridges) { + if (type !== bridge.type || ri._index !== bridge.i[bridge.i.length - 1] + 1) { + continue; + } + if (type === BridgeType.PARALLEL && bridge.j[bridge.j.length - 1] + 1 === rj._index) { + bridge.i.push(ri._index); + bridge.j.push(rj._index); + found = true; + break; + } + if (type === BridgeType.ANTI_PARALLEL && bridge.j[0] - 1 === rj._index) { + bridge.i.push(ri._index); + bridge.j.unshift(rj._index); + found = true; + break; + } + } - return true; + // this bridge cannot be attached anywhere, start a new sequence + if (!found) { + bridges.push({ + type, + i: [ri._index], + chainI: ri.getChain()._index, + j: [rj._index], + chainJ: rj.getChain()._index + }); + } + } + } } + } - if (this.options.intertia && this.lastRotation.angle) { - // inertial object rotation - var angle = this.lastRotation.angle * Math.pow(1.0 - this.options.dynamicDampingFactor, 40.0 * timeSinceMove); - - if (Math.abs(angle) <= this.options.intertiaThreshold) { - this.lastRotation.angle = 0.0; + // extend ladders + bridges.sort((a, b) => { + if (a.chainI < b.chainI || a.chainI === b.chainI && a.i[0] < b.i[0]) { + return -1; + } + return 1; + }); + for (let i = 0; i < bridges.length; ++i) { + for (let j = i + 1; j < bridges.length; ++j) { + const ibi = bridges[i].i[0]; + const iei = bridges[i].i[bridges[i].i.length - 1]; + const jbi = bridges[i].j[0]; + const jei = bridges[i].j[bridges[i].j.length - 1]; + const ibj = bridges[j].i[0]; + const iej = bridges[j].i[bridges[j].i.length - 1]; + const jbj = bridges[j].j[0]; + const jej = bridges[j].j[bridges[j].j.length - 1]; + if (bridges[i].type !== bridges[j].type || this._hasChainBreak(Math.min(ibi, ibj), Math.max(iei, iej)) || this._hasChainBreak(Math.min(jbi, jbj), Math.max(jei, jej)) || ibj - iei >= 6 || iei >= ibj && ibi <= iej) { + continue; + } + let bulge = false; + if (bridges[i].type === BridgeType.PARALLEL) { + bulge = jbj - jei < 6 && ibj - iei < 3 || jbj - jei < 3; } else { - this._rotate(quaternion.setFromAxisAngle(this.lastRotation.axis, angle)); - - return true; + bulge = jbi - jej < 6 && ibj - iei < 3 || jbi - jej < 3; + } + if (bulge) { + bridges[i].i = bridges[i].i.concat(bridges[j].i); + if (bridges[i].type === BridgeType.PARALLEL) { + bridges[i].j = bridges[i].j.concat(bridges[j].j); + } else { + bridges[i].j = bridges[j].j.concat(bridges[i].j); + } + bridges.splice(j--, 1); } } + } - return false; - }; - }(); - - ObjectHandler.prototype.stop = function () { - this.lastRotation.angle = 0.0; - }; // calculate (axis, angle) pair from mouse/touch movement - - - ObjectHandler.prototype.mouse2rotation = function () { - var center = new THREE.Vector3(); - var eye = new THREE.Vector3(); - var eyeDirection = new THREE.Vector3(); - var cameraUpDirection = new THREE.Vector3(); - var cameraSidewaysDirection = new THREE.Vector3(); - var moveDirection = new THREE.Vector3(); - var mouseDelta = new THREE.Vector2(); - return function (rot, mousePrev, mouseCur, aboutAxis) { - if (aboutAxis) { - rot.axis.copy(this.axis); - rot.angle = this.options.axisRotateFactor * (mouseCur.y - mousePrev.y); - /* cool method that allows rotation around Z axis to be "tied" to mouse cursor - res.axis.copy(this.axis); - var pivot = this.pivot.clone(); - this.object.localToWorld(pivot); - pivot.project(this.camera); - var v1 = new THREE.Vector3(mousePrev.x, mousePrev.y, this.camera.position.z); - v1.sub(pivot); - var v2 = new THREE.Vector3(mouseCur.x, mouseCur.y, this.camera.position.z); - v2.sub(pivot); - v1.sub(res.axis.clone().multiplyScalar(v1.dot(res.axis))); - v2.sub(res.axis.clone().multiplyScalar(v2.dot(res.axis))); - var abs = v1.length() * v2.length(); - if (abs > 0) { - res.angle = res.axis.dot(v1.cross(v2)) / abs; + // Sheet + const ladderset = new Set(); + for (let i = 0; i < bridges.length; ++i) { + ladderset.add(bridges[i]); + } + let sheet = 1; + let ladder = 0; + while (ladderset.size > 0) { + let bridge = ladderset.values().next().value; + ladderset.delete(bridge); + const sheetset = new Set(); + sheetset.add(bridge); + let toMove; + do { + toMove = new Set(); + for (const a of sheetset.values()) { + for (const b of ladderset.values()) { + if (this._areBridgesLinked(a, b)) { + toMove.add(b); + } } - */ - } else { - mouseDelta.subVectors(mouseCur, mousePrev); - var angle = mouseDelta.length(); - - if (angle === 0.0) { - return; } - - center.copy(this.pivot); - this.object.localToWorld(center); - eye.subVectors(this.camera.position, center); - eyeDirection.copy(eye).normalize(); - cameraUpDirection.copy(this.camera.up).normalize(); - cameraSidewaysDirection.crossVectors(cameraUpDirection, eyeDirection).normalize(); - cameraUpDirection.setLength(mouseDelta.y); - cameraSidewaysDirection.setLength(mouseDelta.x); - moveDirection.copy(cameraUpDirection.add(cameraSidewaysDirection)); - rot.axis.crossVectors(moveDirection, eye); - rot.angle = -angle * this.options.rotateFactor; + for (bridge of toMove.values()) { + sheetset.add(bridge); + ladderset.delete(bridge); + } + } while (toMove.size > 0); + for (bridge of sheetset.values()) { + bridge.ladder = ladder; + bridge.sheet = sheet; + bridge.link = sheetset; + ++ladder; } + ++sheet; + } + for (let i = 0; i < bridges.length; ++i) { + const bridge = bridges[i]; - rot.axis.transformDirection(matrix4.getInverse(this.object.matrixWorld)); // make sure angle is always positive (thus 'axis' defines both axis and direction of rotation) - - if (rot.angle < 0.0) { - rot.axis.negate(); - rot.angle = -rot.angle; - } - }; - }(); + // find out if any of the i and j set members already have + // a bridge assigned, if so, we're assigning bridge 2 - function ObjectControls(object, objectPivot, camera, domElement, getAltObj) { - EventDispatcher.call(this); - var self = this; - this.object = object; - this.objectPivot = objectPivot; - this.camera = camera; - this.domElement = typeof domElement !== 'undefined' ? domElement : document; - this.getAltObj = getAltObj; // API - - this.enabled = true; - this.hotkeysEnabled = true; - this.screen = { - left: 0, - top: 0, - width: 0, - height: 0 - }; - this.options = { - rotateFactor: Math.PI, - // full screen slide (along short side) would roughly mean 180 deg. rotation - axisRotateFactor: 4 * Math.PI, - // full screen slide (along short side) would roughly mean 720 deg. rotation - intertia: true, - dynamicDampingFactor: 0.1, - intertiaThreshold: 1e-3 - }; // internals - - this._state = STATE.NONE; - this._mousePrevPos = new THREE.Vector2(); - this._mouseCurPos = new THREE.Vector2(); - this._mainObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options); - this._altObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options); - this._affectedObj = this._mainObj; - this._isAltObjFreeRotationAllowed = true; - this._isTranslationAllowed = true; - this._isKeysTranslatingObj = false; - this._pressedKeys = []; - this._clock = new Timer(); - - this._clock.start(); - - this._lastUpdateTime = this._clock.getElapsedTime(); // events - - this._listeners = [{ - obj: self.domElement, - type: 'mousedown', - handler: function handler(e) { - self.mousedown(e); - } - }, { - obj: self.domElement, - type: 'mouseup', - handler: function handler(e) { - self.mouseup(e); - } - }, { - obj: self.domElement, - type: 'mousemove', - handler: function handler(e) { - self.mousemove(e); - } - }, { - obj: self.domElement, - type: 'mousewheel', - handler: function handler(e) { - self.mousewheel(e); - } - }, { - obj: self.domElement, - type: 'DOMMouseScroll', - handler: function handler(e) { - self.mousewheel(e); - } - }, { - obj: self.domElement, - type: 'mouseout', - handler: function handler(e) { - self.mouseup(e); - } - }, { - obj: self.domElement, - type: 'touchstart', - handler: function handler(e) { - self.touchstartend(e); - } - }, { - obj: self.domElement, - type: 'touchend', - handler: function handler(e) { - self.touchstartend(e); - } - }, { - obj: self.domElement, - type: 'touchmove', - handler: function handler(e) { - self.touchmove(e); + let betai = 0; + let betaj = 0; + for (let l = 0; l < bridge.i.length; ++l) { + if (this._betaPartners[bridge.i[l]][0]) { + betai = 1; + break; + } } - }, { - obj: self.getKeyBindObject(), - type: 'keydown', - handler: function handler(e) { - self.keydownup(e); + for (let l = 0; l < bridge.j.length; ++l) { + if (this._betaPartners[bridge.j[l]][0]) { + betaj = 1; + break; + } } - }, { - obj: self.getKeyBindObject(), - type: 'keyup', - handler: function handler(e) { - self.keydownup(e); + let ss = StructureType.BRIDGE; + if (bridge.i.length > 1) { + ss = StructureType.STRAND; } - }, { - obj: window, - type: 'resize', - handler: function handler() { - self.handleResize(); + if (bridge.type === BridgeType.PARALLEL) { + let j = 0; + for (let k = 0; k < bridge.i.length; ++k) { + this._betaPartners[bridge.i[k]][betai] = { + residue: bridge.j[j++], + ladder: bridge.ladder, + parallel: true + }; + } + j = 0; + for (let k = 0; k < bridge.j.length; ++k) { + this._betaPartners[bridge.j[k]][betaj] = { + residue: bridge.i[j++], + ladder: bridge.ladder, + parallel: true + }; + } + } else { + let j = bridge.j.length - 1; + for (let k = 0; k < bridge.i.length; ++k) { + this._betaPartners[bridge.i[k]][betai] = { + residue: bridge.j[j--], + ladder: bridge.ladder, + parallel: false + }; + } + j = bridge.i.length - 1; + for (let k = 0; k < bridge.j.length; ++k) { + this._betaPartners[bridge.j[k]][betaj] = { + residue: bridge.i[j--], + ladder: bridge.ladder, + parallel: false + }; + } } - }, { - obj: window, - type: 'blur', - handler: function handler() { - self.resetKeys(); + for (let k = bridge.i[0]; k <= bridge.i[bridge.i.length - 1]; ++k) { + if (this._ss[k] !== StructureType.STRAND) { + this._ss[k] = ss; + this._sheet[k] = bridge.sheet; + } } - }, { - obj: self.domElement, - type: 'contextmenu', - handler: function handler(e) { - self.contextmenu(e); + for (let k = bridge.j[0]; k <= bridge.j[bridge.j.length - 1]; ++k) { + if (this._ss[k] !== StructureType.STRAND) { + this._ss[k] = ss; + this._sheet[k] = bridge.sheet; + } } - }]; - - for (var i = 0; i < this._listeners.length; i++) { - var l = this._listeners[i]; - l.obj.addEventListener(l.type, l.handler); } - - this.handleResize(); - this.resetKeys(); // force an update at start - - this.update(); - } // methods - - - ObjectControls.prototype = Object.create(EventDispatcher.prototype); - ObjectControls.prototype.constructor = ObjectControls; - - ObjectControls.prototype.resetKeys = function () { - this._pressedKeys[VK_LEFT] = false; - this._pressedKeys[VK_UP] = false; - this._pressedKeys[VK_RIGHT] = false; - this._pressedKeys[VK_DOWN] = false; - }; - - ObjectControls.prototype.contextmenu = function (e) { - e.stopPropagation(); - e.preventDefault(); - }; - - ObjectControls.prototype.handleResize = function () { - if (this.domElement === document) { - this.screen.left = 0; - this.screen.top = 0; - this.screen.width = window.innerWidth; - this.screen.height = window.innerHeight; - } else { - var box = this.domElement.getBoundingClientRect(); // adjustments come from similar code in the jquery offset() function - - var d = this.domElement.ownerDocument.documentElement; - this.screen.left = box.left + window.pageXOffset - d.clientLeft; - this.screen.top = box.top + window.pageYOffset - d.clientTop; - this.screen.width = box.width; - this.screen.height = box.height; + } + _testBridge(chainA, from, chainB, to) { + let result = BridgeType.NO_BRIDGE; + const a = chainA[from - 1]._index; + const b = chainA[from]._index; + const c = chainA[from + 1]._index; + const d = chainB[to - 1]._index; + const e = chainB[to]._index; + const f = chainB[to + 1]._index; + const isBond = this._hbonds.isBond.bind(this._hbonds); + if (isBond(c, e) && isBond(e, a) || isBond(f, b) && isBond(b, d)) { + result = BridgeType.PARALLEL; + } else if (isBond(c, d) && isBond(f, a) || isBond(e, b) && isBond(b, e)) { + result = BridgeType.ANTI_PARALLEL; } - }; - - ObjectControls.prototype.enable = function (enable) { - this.enabled = enable; - }; - - ObjectControls.prototype.enableHotkeys = function (enable) { - this.hotkeysEnabled = enable; - }; - - ObjectControls.prototype.allowTranslation = function (allow) { - this._isTranslationAllowed = allow; - }; - - ObjectControls.prototype.allowAltObjFreeRotation = function (allow) { - this._isAltObjFreeRotationAllowed = allow; - }; - - ObjectControls.prototype.keysTranslateObj = function (on) { - this._isKeysTranslatingObj = on; - }; - - ObjectControls.prototype.isEditingAltObj = function () { - return (this._state === STATE.ROTATE || this._state === STATE.TRANSLATE) && this._affectedObj === this._altObj; - }; // convert page coords of mouse/touch to uniform coords with smaller side being [-0.5, 0.5] - // (uniform coords keep direct proportion with screen distance travelled by mouse regardless of screen aspect ratio) - - - ObjectControls.prototype.convertMouseToOnCircle = function (coords, pageX, pageY) { - var screenSize = Math.min(this.screen.width, this.screen.height); + return result; + } - if (screenSize === 0) { - coords.set(0, 0); - return; + // return true if any of the residues in bridge a is identical to any of the residues in bridge b + _areBridgesLinked(a, b) { + const ai = new Set(a.i); + const aj = new Set(a.j); + for (const i of b.i) { + if (ai.has(i) || aj.has(i)) { + return true; + } } - - coords.set((pageX - this.screen.width * 0.5 - this.screen.left) / screenSize, (0.5 * this.screen.height + this.screen.top - pageY) / screenSize); - }; // convert page coords of mouse/touch to viewport coords with both sides being [-1, 1] - // (those are non-uniform coords affected by screen aspect ratio) - - - ObjectControls.prototype.convertMouseToViewport = function (coords, pageX, pageY) { - if (this.screen.width === 0 || this.screen.height === 0) { - coords.set(0, 0); - return; + for (const i of b.j) { + if (ai.has(i) || aj.has(i)) { + return true; + } } + return false; + } + _hasChainBreak(from, to) { + for (let i = from + 1; i <= to; ++i) { + if (this._complex._residues[i]._sequence !== this._complex._residues[i - 1]._sequence + 1) { + return true; + } + } + return false; + } +} +SecondaryStructureMap.StructureType = StructureType; +;// CONCATENATED MODULE: ./src/chem/Complex.js - coords.set(2.0 * (pageX - this.screen.width * 0.5 - this.screen.left) / this.screen.width, 2.0 * (0.5 * this.screen.height + this.screen.top - pageY) / this.screen.height); - }; - - ObjectControls.prototype.stop = function () { - this._mainObj.stop(); - - this._altObj.stop(); - }; // rotate object based on latest mouse/touch movement - - - ObjectControls.prototype.rotateByMouse = function () { - var quat = new THREE.Quaternion(); - return function (aboutZAxis) { - this._affectedObj.rotate(quat, this._mousePrevPos, this._mouseCurPos, aboutZAxis); - this.dispatchEvent({ - type: 'change', - action: 'rotate', - quaternion: quat - }); - }; - }(); // rotate object by specified quaternion - ObjectControls.prototype.rotate = function (quat) { - this.object.quaternion.multiply(quat); - this.dispatchEvent({ - type: 'change', - action: 'rotate', - quaternion: quat - }); - }; // get object's orientation - ObjectControls.prototype.getOrientation = function () { - return this.object.quaternion; - }; // set object's orientation - ObjectControls.prototype.setOrientation = function (quat) { - this.object.quaternion.copy(quat); - }; // translate object based on latest mouse/touch movement - ObjectControls.prototype.translate = function () { - var delta = new THREE.Vector2(); - return function () { - delta.subVectors(this._mouseCurPos, this._mousePrevPos); - this._affectedObj.translate(delta); - this.dispatchEvent({ - type: 'change', - action: 'translate' - }); - }; - }(); // get object scale - ObjectControls.prototype.getScale = function () { - return this.object.scale.x; - }; // set uniform object scale - ObjectControls.prototype.setScale = function (scale) { - this.object.scale.set(scale, scale, scale); - }; // scale object by factor (factor should be greater than zero) +const VOXEL_SIZE = 5.0; +const { + StructureType: Complex_StructureType +} = SecondaryStructureMap; +const Complex_StructuralElementType = chem_StructuralElement.Type; - ObjectControls.prototype.scale = function (factor) { - if (factor <= 0) { - return; - } +// see http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX +const helixClassMap = { + [Complex_StructureType.HELIX_ALPHA]: 1, + [Complex_StructureType.HELIX_PI]: 3, + [Complex_StructureType.HELIX_310]: 5 +}; +const loopMap = { + [Complex_StructureType.BRIDGE]: Complex_StructuralElementType.BRIDGE, + [Complex_StructureType.TURN]: Complex_StructuralElementType.TURN, + [Complex_StructureType.BEND]: Complex_StructuralElementType.BEND, + [Complex_StructureType.LOOP]: Complex_StructuralElementType.COIL +}; - this.setScale(this.object.scale.x * factor); - this.dispatchEvent({ - type: 'change', - action: 'zoom', - factor: factor +/** + * The entire complex of the molecules under study. + * + * @exports Complex + * @constructor + */ +class Complex { + constructor() { + this._chains = []; + this._components = []; + this._helices = []; + this._sheets = []; + this.structures = []; + this._residueTypes = Object.create(chem_ResidueType.StandardTypes); + this._atoms = []; + this._residues = []; + this._bonds = []; + this._sgroups = []; + this._molecules = []; + this._maskNeedsUpdate = false; + this.metadata = {}; + this.symmetry = []; + this.units = [new chem_BiologicalUnit(this)]; + this._currentUnit = 0; // default biological unit is the asymmetric unit + } + addAtom(atom) { + const index = this._atoms.length; + this._atoms.push(atom); + return index; + } + addSheet(sheet) { + const index = this._sheets.length; + this._sheets.push(sheet); + return index; + } + addHelix(helix) { + const index = this._helices.length; + this._helices.push(helix); + return index; + } + getAtoms() { + return this._atoms; + } + getBonds() { + return this._bonds; + } + getAtomCount() { + return this._atoms.length; + } + addResidue(residue) { + const index = this._residues.length; + this._residues.push(residue); + return index; + } + updateToFrame(frameData) { + this.forEachChain(chain => { + chain.updateToFrame(frameData); }); - }; - - ObjectControls.prototype.update = function () { - var shift = new THREE.Vector2(); - return function () { - var curTime = this._clock.getElapsedTime(); - - var timeSinceLastUpdate = curTime - this._lastUpdateTime; // update object handler - - if (this._state === STATE.NONE) { - var timeSinceMove = curTime - this._lastMouseMoveTime; - - if (this._mainObj.update(timeSinceLastUpdate, timeSinceMove) || this._altObj.update(timeSinceLastUpdate, timeSinceMove)) { - this.dispatchEvent({ - type: 'change', - action: 'auto' - }); - } - } // apply arrow keys - - - if (this._isKeysTranslatingObj) { - var speedX = Number(this._pressedKeys[VK_RIGHT]) - Number(this._pressedKeys[VK_LEFT]); - var speedY = Number(this._pressedKeys[VK_UP]) - Number(this._pressedKeys[VK_DOWN]); - - if (speedX !== 0.0 || speedY !== 0.0) { - var delta = timeSinceLastUpdate; // update object translation - - var altObj = this.getAltObj(); - - if (altObj.objects.length > 0) { - this._altObj.setObjects(altObj.objects); - - this._altObj.pivot = altObj.pivot; - - if ('axis' in altObj) { - this._altObj.axis = altObj.axis.clone(); - } else { - this._altObj.axis.set(0, 0, 1); - } - - shift.set(delta * speedX, delta * speedY); - - this._altObj.translate(shift); + } + addResidueType(resName) { + const rt = this._residueTypes[resName] = new chem_ResidueType(resName, 'Unknown', ''); + return rt; + } + getResidueCount() { + return this._residues.length; + } + getResidues() { + return this._residues; + } + getSGroupCount() { + return this._sgroups.length; + } + getSGroups() { + return this._sgroups; + } - this.dispatchEvent({ - type: 'change', - action: 'translate' + /* + Extract atom by its fullname: #chainName#.#residueId#.#atomName# + */ + getAtomByFullname(fullName) { + const parts = fullName.split('.'); + if (parts.length !== 3) { + return null; + } + const chainName = parts[0]; + const resId = parseInt(parts[1], 10); + if (Number.isNaN(resId)) { + return null; + } + const atomName = parts[2].toUpperCase(); + let currAtom = null; + this.forEachChain(chain => { + if (currAtom) { + return; + } + if (chain._name.localeCompare(chainName) === 0) { + chain.forEachResidue(residue => { + if (currAtom) { + return; + } + if (residue._sequence === resId) { + residue.forEachAtom(atom => { + if (currAtom) { + return; + } + if (atomName.localeCompare(atom.name) === 0) { + currAtom = atom; + } }); } - } + }); } + }); + return currAtom; + } - this._lastUpdateTime = curTime; + /** + * Create a new chain. + * + * @param {string} name - Chain name. + * @returns {Chain} - Newly created chain. + */ + addChain(name) { + const result = new chem_Chain(this, name); + this._chains.push(result); + return result; + } + getChain(name) { + for (let i = 0, n = this._chains.length; i < n; ++i) { + const chain = this._chains[i]; + if (chain.getName() === name) { + return chain; + } + } + return null; + } + getChainCount() { + return this._chains.length; + } + getMolecules() { + return this._molecules; + } + getMoleculeCount() { + return this._molecules.length; + } + forEachAtom(process) { + const atoms = this._atoms; + for (let i = 0, n = atoms.length; i < n; ++i) { + process(atoms[i]); + } + } + forEachBond(process) { + const bonds = this._bonds; + for (let i = 0, n = bonds.length; i < n; ++i) { + process(bonds[i]); + } + } + forEachResidue(process) { + const residues = this._residues; + for (let i = 0, n = residues.length; i < n; ++i) { + process(residues[i]); + } + } + forEachChain(process) { + const chains = this._chains; + for (let i = 0, n = chains.length; i < n; ++i) { + process(chains[i]); + } + } + forEachMolecule(process) { + const molecules = this._molecules; + const n = molecules.length; + for (let i = 0; i < n; ++i) { + process(molecules[i]); + } + } + forEachSGroup(process) { + const groups = this._sgroups; + for (let i = 0, n = groups.length; i < n; ++i) { + process(groups[i]); + } + } + forEachComponent(process) { + const components = this._components; + for (let i = 0, n = components.length; i < n; ++i) { + process(components[i]); + } + } + forEachVisibleComponent(process) { + const components = this._components; + for (let i = 0, n = components.length; i < n; ++i) { + process(components[i]); + } + } + addBond(left, right, order, type, fixed) { + const bond = new chem_Bond(left, right, order, type, fixed); + this._bonds.push(bond); + return bond; + } + getBondCount() { + return this._bonds.length; + } + getResidueType(name) { + return this._residueTypes[name] || null; + } + getUnifiedSerial(chain, serial, iCode) { + /* eslint-disable no-magic-numbers */ + const maxSerial = 65536; + const chainShift = maxSerial * 256; + /* eslint-enable no-magic-numbers */ + return serial + iCode * maxSerial + chain * chainShift; + } + splitUnifiedSerial(uniSerial) { + /* eslint-disable no-magic-numbers */ + const maxSerial = 65536; + const chainShift = maxSerial * 256; + /* eslint-enable no-magic-numbers */ + const chainId = Math.floor(uniSerial / chainShift); + const remnant = uniSerial - chainId * chainShift; + const insCode = Math.floor(remnant / maxSerial); + const ser = remnant - insCode * maxSerial; + return { + chain: chainId, + serial: ser, + iCode: insCode }; - }(); + } + _fillCmpEdit() { + const self = this; + const components = this._components; + function addComp() { + const comp = new chem_Component(self); + comp._index = components.length; + components[comp._index] = comp; + return comp; + } + this.forEachChain(chain => { + const residues = chain._residues; + const resCount = residues.length; + if (resCount < 1) { + return; + } + let comp = addComp(); + let currStart = residues[0]._index; + for (let i = 0; i < resCount; ++i) { + const currRes = residues[i]; + currRes._component = comp; + const nextRes = i === resCount - 1 ? null : residues[i + 1]; + if (!nextRes || !currRes.isConnected(nextRes) || currRes._index !== nextRes._index - 1) { + // the last condition is broken and incorrect + // the refactoring of the Component is required in order to fix this issue + comp.setSubDivs([{ + start: currStart, + end: currRes._index + }]); + if (nextRes) { + currStart = nextRes._index; + comp = addComp(); + } + } + } + }); + } - ObjectControls.prototype.reset = function () { - this._state = STATE.NONE; - this.object.quaternion.copy(quaternion.set(0, 0, 0, 1)); - }; // listeners + // This function was added in the moment of despair + // It was the dark times for miew + _fillCmpNoedit() { + const comp = new chem_Component(this); + comp._index = 0; + const residues = this._residues; + const resCount = residues.length; + if (resCount === 0) { + return; + } + const currSubDivs = []; + let currStart = 0; + for (let i = 0; i < resCount; ++i) { + const currRes = residues[i]; + currRes._component = comp; + const nextRes = i === resCount - 1 ? null : residues[i + 1]; + if (!nextRes || !currRes.isConnected(nextRes)) { + // wrap up this interval + currSubDivs[currSubDivs.length] = { + start: currStart, + end: i + }; + if (nextRes) { + currStart = i + 1; + } + } + } + comp.setSubDivs(currSubDivs); + this._components[comp._index] = comp; + } + /** + * Fill components information. + * @param {boolean} enableEditing - Restructure Complex to enable per-component editing. + */ + _fillComponents(enableEditing) { + if (enableEditing) { + this._fillCmpEdit(); + } else { + this._fillCmpNoedit(); + } + } + getCurrentUnit() { + return this._currentUnit; + } + getDefaultBoundaries() { + return this.units[0].getBoundaries(); + } + getBoundaries() { + return this.units[this._currentUnit].getBoundaries(); + } + getTransforms() { + return this.units[this._currentUnit].getTransforms(); + } + getSelector() { + return this.units[this._currentUnit].getSelector(); + } + resetCurrentUnit() { + this._currentUnit = 0; + this.setCurrentUnit(1); + } + setCurrentUnit(newUnit) { + if (newUnit !== null && newUnit !== undefined && newUnit !== this._currentUnit && newUnit >= 0 && newUnit < this.units.length) { + this._currentUnit = newUnit; + return true; + } + return false; + } + _computeBounds() { + const { + units + } = this; + for (let i = 0, n = units.length; i < n; ++i) { + units[i].computeBoundaries(); + } + } + onAtomPositionChanged() { + this.forEachChain(a => { + a._finalize(); + }); + this.forEachComponent(c => { + c.update(); + }); + // Update bounding sphere and box + this._computeBounds(); + this._finalizeBonds(); + this.forEachSGroup(s => { + s._rebuildSGroupOnAtomChange(); + }); + } + update() { + if (this._maskNeedsUpdate) { + this.updateStructuresMask(); + this._maskNeedsUpdate = false; + } + } + _finalizeBonds() { + const bonds = this.getBonds(); + const n = bonds.length; + for (let i = 0; i < n; ++i) { + bonds[i]._index = i; + } + } - ObjectControls.prototype.mousedown = function (event) { - if (this.enabled === false || this._state !== STATE.NONE) { - return; + /** + * Finalizes complex's inner data(i.e. after parsing). + * @param {objects} opts - Build bonds automatically. + * @param {boolean} opts.needAutoBonding - Build bonds automatically. + * @param {boolean} opts.detectAromaticLoops - Find/mark aromatic loops. + * @param {boolean} opts.enableEditing - Restructure Complex to enable per-component editing. + * @param {Array} [opts.serialAtomMap] - Array of atoms ordered by their serials. + */ + finalize(opts) { + opts = opts || {}; + // Put bonds into atoms + const bonds = this._bonds; + let i; + let n; + // remove invalid bonds + for (i = bonds.length - 1; i >= 0; i--) { + const bond = bonds[i]; + if (bond._left === null || bond._right === null) { + bonds.splice(i, 1); + } else { + bond._left.bonds.push(bond); + bond._right.bonds.push(bond); + } } + const residues = this._residues; + for (i = 0, n = residues.length; i < n; ++i) { + residues[i]._finalize(); + } + this.forEachChain(a => { + a._finalize(); + }); - event.preventDefault(); - event.stopPropagation(); + // WARNING! this MUST be done BEFORE computeBounds is called + const { + units + } = this; + for (i = 0, n = units.length; i < n; ++i) { + units[i].finalize(); + } + // try setting first biomolecule by defaults + this.setCurrentUnit(1); + const residueHash = {}; + for (i = 0, n = residues.length; i < n; ++i) { + const res = residues[i]; + // This code is extremely dangerous for non-PDB formats + residueHash[this.getUnifiedSerial(res.getChain().getName().charCodeAt(0), res.getSequence(), res.getICode().charCodeAt(0))] = res; + } + const { + structures + } = this; + for (i = 0, n = structures.length; i < n; ++i) { + structures[i]._finalize(opts.serialAtomMap, residueHash, this); + } + const helices = this._helices; + for (i = 0, n = helices.length; i < n; ++i) { + helices[i]._finalize(opts.serialAtomMap, residueHash, this); + } + const sheets = this._sheets; + for (i = 0, n = sheets.length; i < n; ++i) { + sheets[i]._finalize(opts.serialAtomMap, residueHash, this); + } + + // Update bounding sphere and box + this._computeBounds(); + const atoms = this._atoms; + for (i = 0, n = atoms.length; i < n; ++i) { + const currAtom = atoms[i]; + currAtom.index = i; + } + if (opts.needAutoBonding) { + const autoConnector = new chem_AutoBond(this); + autoConnector.build(); + autoConnector.destroy(); + } + const chains = this._chains; + for (i = 0, n = chains.length; i < n; ++i) { + chains[i]._index = i; + } + for (i = 0, n = residues.length; i < n; ++i) { + residues[i]._index = i; + } + + // mark non-polar hydrogens + for (i = 0, n = atoms.length; i < n; ++i) { + const atom = atoms[i]; + if (atom.flags & chem_Atom.Flags.HYDROGEN && atom.bonds.length === 1) { + const bond = atom.bonds[0]; + const other = bond._left !== atom && bond._left || bond._right; + if (other.flags & chem_Atom.Flags.CARBON) { + atom.flags |= chem_Atom.Flags.NONPOLARH; + } + } + } + this._finalizeBonds(); + this._fillComponents(opts.enableEditing); + const marker = new chem_AromaticLoopsMarker(this); + marker.markCycles(); + if (opts.detectAromaticLoops) { + // TODO remove this condition clause, it is for debug purposes only! + marker.detectCycles(); // TODO add conditional detection + } + this._finalizeMolecules(); + } + _finalizeMolecules() { + // add reference to molecule into residue + for (let i = 0; i < this._molecules.length; i++) { + const molecule = this._molecules[i]; + const count = molecule.residues.length; + for (let j = 0; j < count; j++) { + const residue = molecule.residues[j]; + residue._molecule = molecule; + } + } + } + updateStructuresMask() { + const updater = structure => structure.collectMask(); + this.forEachResidue(updater); + this.forEachChain(updater); + this.forEachMolecule(updater); + } + countAtomsByMask(mask) { + let count = 0; + this.forEachAtom(atom => { + if ((atom.mask & mask) !== 0) { + count++; + } + }); + return count; + } + getNumAtomsBySelector(selector) { + let count = 0; + this.forEachAtom(atom => { + if (selector.includesAtom(atom)) { + count++; + } + }); + return count; + } + resetAtomMask(mask) { + this.forEachAtom(atom => { + atom.mask = mask; + }); + } + markAtoms(selector, mask) { + const setMask = mask; + const clearMask = ~setMask; + let count = 0; + const totalSelector = chem_selectors.keyword('And')(selector, this.getSelector()); + this.forEachAtom(atom => { + if (totalSelector.includesAtom(atom)) { + atom.mask |= setMask; + count++; + } else { + atom.mask &= clearMask; + } + }); + this._maskNeedsUpdate = true; + return count; + } + markAtomsAdditionally(selector, mask) { + const setMask = mask; + let count = 0; + this.forEachAtom(atom => { + if (selector.includesAtom(atom) && (atom.mask & mask) !== mask) { + atom.mask |= setMask; + count++; + } + }); + return count; + } + clearAtomBits(mask) { + const clearMask = ~mask; + this.forEachAtom(atom => { + atom.mask &= clearMask; + }); + const reseter = a => { + a._mask &= clearMask; + }; + this.forEachAtom(reseter); + this.forEachResidue(reseter); + this.forEachChain(reseter); + this.forEachMolecule(reseter); + } + getAtomNames() { + if (this.hasOwnProperty('_atomNames')) { + return this._atomNames; + } + const dict = {}; + this.forEachAtom(atom => { + dict[atom.name] = 1; + }); + this._atomNames = Object.keys(dict); + return this._atomNames; + } + getElements() { + if (this.hasOwnProperty('_elements')) { + return this._elements; + } + const dict = {}; + this.forEachAtom(atom => { + dict[atom.element.name] = 1; + }); + this._elements = Object.keys(dict); + return this._elements; + } + getResidueNames() { + if (this.hasOwnProperty('_residueNames')) { + return this._residueNames; + } + const dict = {}; + this.forEachResidue(res => { + dict[res._type._name] = 1; + }); + this._residueNames = Object.keys(dict); + return this._residueNames; + } + getChainNames() { + if (this.hasOwnProperty('_chainNames')) { + return this._chainNames; + } + const dict = {}; + this.forEachChain(chain => { + dict[chain._name] = 1; + }); + this._chainNames = Object.keys(dict); + return this._chainNames; + } + getAltLocNames() { + if (this.hasOwnProperty('_altlocNames')) { + return this._altlocNames; + } + const dict = {}; + this.forEachAtom(atom => { + dict[String.fromCharCode(atom.location)] = 1; + }); + this._altlocNames = Object.keys(dict); + return this._altlocNames; + } + getVoxelWorld() { + if (!this.hasOwnProperty('_voxelWorld')) { + try { + this._voxelWorld = new chem_VoxelWorld(this.getDefaultBoundaries().boundingBox, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(VOXEL_SIZE, VOXEL_SIZE, VOXEL_SIZE)); + this._voxelWorld.addAtoms(this); + } catch (e) { + logger.warn('Unable to create voxel world'); + this._voxelWorld = null; + } + } + return this._voxelWorld; + } - if (this._state === STATE.NONE) { - if (event.button === 0) { - this._affectedObj.stop(); // can edit only one object at a time + /** + * Simple function to make unified routine procedure without code duplication. + * @param {Array} srcArray - Source chemical structure array (will be part of resulting chemical structure array). + * @param {Array} dstArray - Resulting chemical structure array. + * @param {number} param - Parameter for processor. + * @param {function} functor - Processor for every element in array. + */ + addElement(srcArray, dstArray, param, functor) { + const { + length + } = srcArray; + for (let i = 0; i < length; ++i) { + const elem = srcArray[i]; + functor(elem, param); + dstArray.push(elem); + } + } + // this function joins multiple complexes into one (this) + // atom, bond, ... objects are reused -- so input complexes are no longer valid + joinComplexes(complexes) { + // clear target complex + this._chains = []; + this._components = []; + this._helices = []; + this._sheets = []; + this.structures = []; + this._atoms = []; + this._residues = []; + this._bonds = []; + this._sgroups = []; + const self = this; + let atomBias = 0; + let bondBias = 0; + let residueBias = 0; + let chainBias = 0; + let componentBias = 0; + function processAtom(atom, bias) { + atom.serial += bias; + atom.index += bias; + } + function processBond(bond, bias) { + bond._index += bias; + } + function processResidue(residue, bias) { + residue._index += bias; + } + function processChain(chain, bias) { + chain._complex = self; + chain._index += bias; + } + function processComponent(component, bias) { + component._complex = self; + component._index += bias; + } - var workWithAltObj = false; + /** + * Simple function to do nothing. + */ + function doNothing() {} + for (let i = 0; i < complexes.length; ++i) { + const c = complexes[i]; + this.addElement(c._atoms, this._atoms, atomBias, processAtom); + this.addElement(c._bonds, this._bonds, bondBias, processBond); + this.addElement(c._residues, this._residues, residueBias, processResidue); + this.addElement(c._chains, this._chains, chainBias, processChain); + this.addElement(c._sheets, this._sheets, 0, doNothing); + this.addElement(c._helices, this._helices, 0, doNothing); + this.addElement(c._sgroups, this._sgroups, 0, doNothing); + this.addElement(c._components, this._components, componentBias, processComponent); + this.addElement(c.structures, this.structures, 0, doNothing); + // merge residue types + for (const rt in c._residueTypes) { + if (c._residueTypes.hasOwnProperty(rt)) { + this._residueTypes[rt] = c._residueTypes[rt]; + } + } + atomBias += c._atoms.length; + bondBias += c._bonds.length; + residueBias += c._residues.length; + chainBias += c._chains.length; + componentBias += c._components.length; + } + this._computeBounds(); + } - if (event.altKey) { - var altObj = this.getAltObj(); - workWithAltObj = altObj.objects.length > 0; + /** + * Replace secondary structure with calculated one. + * + * DSSP algorithm implementation is used. + * + * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and + * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211. + */ + dssp() { + const ssMap = new SecondaryStructureMap(this); + const structures = this.structures = []; + const helices = this._helices = []; + const sheets = this._sheets = []; + const getSheet = index => { + let item = sheets[index]; + if (!item) { + item = sheets[index] = new chem_Sheet(String(index), 0); + } + return item; + }; + let lastCode; + let lastSheetIndex; + let lastHelixIndex = 0; + let curStructure = null; + for (let i = 0, n = this._residues.length; i < n; ++i) { + const curCode = ssMap._ss[i]; + const curResidue = this._residues[i]; + const curSheetIndex = ssMap._sheet[i]; + + // expand the last structure + if (curCode === lastCode && curSheetIndex === lastSheetIndex) { + curResidue._secondary = curStructure; + if (curStructure) { + curStructure.term = curResidue; + } + if (curStructure instanceof chem_Helix) { + curStructure.length++; + } + continue; + } - if (workWithAltObj) { - this._altObj.setObjects(altObj.objects); + // create a new structure + const helixClass = helixClassMap[curCode]; + const loopType = loopMap[curCode]; + if (curCode === Complex_StructureType.STRAND) { + const curSheet = getSheet(curSheetIndex); + curStructure = new chem_Strand(curSheet, curResidue, curResidue, 0, null, null); + curSheet.addStrand(curStructure); + } else if (helixClass !== undefined) { + lastHelixIndex++; + curStructure = new chem_Helix(helixClass, curResidue, curResidue, lastHelixIndex, String(lastHelixIndex), '', 1); + helices.push(curStructure); + } else if (loopType !== undefined) { + curStructure = new chem_StructuralElement(loopType, curResidue, curResidue); + } else { + curStructure = null; + } + if (curStructure) { + structures.push(curStructure); + } + curResidue._secondary = curStructure; + lastCode = curCode; + lastSheetIndex = curSheetIndex; + } + this._sheets = sheets.filter(_sheet => true); // squeeze sheets array + } +} +Complex.prototype.id = 'Complex'; +Complex.prototype.name = ''; +/* harmony default export */ const chem_Complex = (Complex); +;// CONCATENATED MODULE: ./src/chem/Volume.js + + +function pow2ceil(v) { + let p = 2; + v = v - 1 >> 1; + while (v) { + p <<= 1; + v >>= 1; + } + return p; +} + +/** + * Volume constructor + * + * @param {Object} type - Float32Array, Int8Array, etc... + * @param {Object|Array} dimensions - number of data points on each axis (x, y, z) + * @param {Box3} box - bounding box defining data place in metric space, + * it's corners correspond to extreme data points + * @param {Number} vecSize - dimension of the field data point (1 = scalar, 3 = 3D vector) + * @param {Object} data - typed array of the same type as specified by the 1st parameter, + * layout: point by point along X, + * row by row along Y, + * plane by plane along Z + * @param {Number} volumeInfo - volume info values to define threshold to filter the noise + */ + +class Volume { + constructor(type, dimensions, box, vecSize, data, volumeInfo) { + this._box = box.clone(); + this._dimVec = Math.max(Math.floor(vecSize || 1), 1); + this._volumeInfo = volumeInfo; + if (dimensions instanceof Array) { + [this._dimX, this._dimY, this._dimZ] = dimensions; + } else { + this._dimX = dimensions.x; + this._dimY = dimensions.y; + this._dimZ = dimensions.z; + } + this._dimX = Math.max(Math.floor(this._dimX), 1); + this._dimY = Math.max(Math.floor(this._dimY), 1); + this._dimZ = Math.max(Math.floor(this._dimZ), 1); + this._rowElements = this._dimVec * this._dimX; + this._planeElements = this._rowElements * this._dimY; + this._totalElements = this._planeElements * this._dimZ; + this._data = data || utils.allocateTyped(type, this._totalElements); + + // override getter/setter for vector fields + switch (this._dimVec) { + case 1: + break; + case 2: + this.getValue = function (x, y, z) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + return [this._data[idx], this._data[idx + 1]]; + }; + this.setValue = function (x, y, z, a, b) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + this._data[idx] = a; + this._data[idx + 1] = b; + }; + this.addValue = function (x, y, z, a, b) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + this._data[idx] += a; + this._data[idx + 1] += b; + }; + break; + case 3: + this.getValue = function (x, y, z) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + return [this._data[idx], this._data[idx + 1], this._data[idx + 2]]; + }; + this.setValue = function (x, y, z, a, b, c) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + this._data[idx] = a; + this._data[idx + 1] = b; + this._data[idx + 2] = c; + }; + this.addValue = function (x, y, z, a, b, c) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + this._data[idx] += a; + this._data[idx + 1] += b; + this._data[idx + 2] += c; + }; + break; + default: + throw new Error('Volume: invalid vector dimension'); + } + } - this._altObj.pivot = altObj.pivot; + // default getter assumes it's a scalar field + getValue(x, y, z) { + return this._data[x + y * this._rowElements + z * this._planeElements]; + } - if ('axis' in altObj) { - this._altObj.axis = altObj.axis.clone(); - } else { - this._altObj.axis.set(0, 0, 1); - } - } - } + // default setter assumes it's a scalar field + setValue(x, y, z, val) { + this._data[x + y * this._rowElements + z * this._planeElements] = val; + } - this._affectedObj = workWithAltObj ? this._altObj : this._mainObj; - this._state = workWithAltObj && event.ctrlKey && this._isTranslationAllowed ? STATE.TRANSLATE : STATE.ROTATE; - } else if (event.button === 2) { - this._state = STATE.TRANSLATE_PIVOT; - } + // default adder assumes it's a scalar field + addValue(x, y, z, val) { + this._data[x + y * this._rowElements + z * this._planeElements] += val; + } + getDimensions() { + return [this._dimX, this._dimY, this._dimZ]; + } + getBox() { + return this._box; + } + getVolumeInfo() { + return this._volumeInfo; + } + getCellSize() { + const boxSize = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._box.getSize(boxSize); + const res = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + res.x = this._dimX > 1 ? boxSize.x / (this._dimX - 1) : 0; + res.y = this._dimY > 1 ? boxSize.y / (this._dimY - 1) : 0; + res.z = this._dimZ > 1 ? boxSize.z / (this._dimZ - 1) : 0; + return res; + } + computeGradient() { + if (this._dimVec !== 1) { + // gradient can only be computed for scalar fields + return null; } - if (this._state === STATE.ROTATE) { - this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY); + // create a 3D vector field of gradients + const gradient = new Volume(Float32Array, [this._dimX, this._dimY, this._dimZ], this._box, 3); - this._mousePrevPos.copy(this._mouseCurPos); - } + // calculate cell side lengths + const vl = this.getCellSize(); - if (this._state === STATE.TRANSLATE || this._state === STATE.TRANSLATE_PIVOT) { - this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); + // gradient axis scaling values and averaging factors, to correctly + // calculate the gradient for volumes with irregular cell spacing + const vs = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.5 / vl.x, -0.5 / vl.y, -0.5 / vl.z); - this._mousePrevPos.copy(this._mouseCurPos); + // TODO Check for intended bug in VMD (min is zero) + function clamp(val, min, max) { + return Math.min(max, Math.max(min, val)); } - }; - - ObjectControls.prototype.mousemove = function (event) { - if (this.enabled === false || this._state === STATE.NONE) { - return; + const xSize = this._dimX; + const ySize = this._dimY; + const zSize = this._dimZ; + const volMap = this._data; + function _voxelValue(x, y, z) { + return volMap[z * xSize * ySize + y * xSize + x]; } + for (let zi = 0; zi < zSize; ++zi) { + const zm = clamp(zi - 1, 0, zSize - 1); + const zp = clamp(zi + 1, 0, zSize - 1); + for (let yi = 0; yi < ySize; ++yi) { + const ym = clamp(yi - 1, 0, ySize - 1); + const yp = clamp(yi + 1, 0, ySize - 1); + for (let xi = 0; xi < xSize; ++xi) { + const xm = clamp(xi - 1, 0, xSize - 1); + const xp = clamp(xi + 1, 0, xSize - 1); - event.preventDefault(); - event.stopPropagation(); - - switch (this._state) { - case STATE.ROTATE: - this._mousePrevPos.copy(this._mouseCurPos); + // Calculate the volume gradient at each grid cell. + // Gradients are now stored unnormalized, since we need them in pure + // form in order to draw field lines etc. Shading code will now have + // to do renormalization for itself on-the-fly. - this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY); - this.rotateByMouse(event.altKey && !this._isAltObjFreeRotationAllowed || event.shiftKey); - this._lastMouseMoveTime = this._clock.getElapsedTime(); - break; - - case STATE.TRANSLATE: - this._mousePrevPos.copy(this._mouseCurPos); - - this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); - this.translate(); - break; + // XXX this gradient is only correct for orthogonal grids, since + // we're using the array index offsets rather to calculate the gradient + // rather than voxel coordinate offsets. This will have to be + // re-worked for non-orthogonal datasets. - case STATE.TRANSLATE_PIVOT: - this._mousePrevPos.copy(this._mouseCurPos); - - this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); - this.translatePivotByMouse(); - break; + gradient.setValue(xi, yi, zi, (_voxelValue(xp, yi, zi) - _voxelValue(xm, yi, zi)) * vs.x, (_voxelValue(xi, yp, zi) - _voxelValue(xi, ym, zi)) * vs.y, (_voxelValue(xi, yi, zp) - _voxelValue(xi, yi, zm)) * vs.z); + } + } } - }; - - ObjectControls.prototype.mousewheel = function (event) { - if (this.enabled === false || !settings.now.zooming || this._state !== STATE.NONE || event.shiftKey) { + return gradient; + } + normalize() { + const data = this._data; + + // get min/max + let min = data[0]; + let max = data[0]; + for (let i = 1; i < data.length; ++i) { + min = Math.min(min, data[i]); + max = Math.max(max, data[i]); + } + const d = 1.0 / (max - min); + if (d === 0) { return; } - event.preventDefault(); - var delta = 0; - - if (event.wheelDelta) { - // WebKit / Opera / Explorer 9 - delta = event.wheelDelta / 40; - } else if (event.detail) { - // Firefox - delta = -event.detail / 3; + // normalize + for (let i = 0; i < data.length; ++i) { + data[i] = d * (data[i] - min); } + } + getTiledTextureStride() { + return [this._dimX + 2, this._dimY + 2]; + } + buildTiledTexture() { + let tilesX = Math.ceil(Math.sqrt(this._dimZ * this._dimY / this._dimX)); + let width = tilesX * (this._dimX + 2) - 1; + width = pow2ceil(width); + tilesX = Math.floor(width / (this._dimX + 2)); + const tilesY = Math.ceil(this._dimZ / tilesX); + let height = tilesY * (this._dimY + 2) - 1; + height = pow2ceil(height); + const data = new Uint8Array(width * height); + let src; + let dst; + for (let tileRow = 0; tileRow < tilesY; ++tileRow) { + // process each pixel row of this tile row + for (let row = 0; row < this._dimY; ++row) { + src = tileRow * tilesX * this._planeElements + row * this._rowElements; + dst = width * (tileRow * (this._dimY + 2) + row); + // copy a series of rows through several XY planes + for (let t = 0; t < tilesX; ++t) { + // copy one row of one XY plane + for (let x = 0; x < this._dimX; ++x) { + data[dst++] = 255.0 * this._data[src++]; + } + + // repeat last pixel of previous tile + data[dst++] = 255.0 * this._data[src - 1]; + if (t < tilesX - 1) { + // skip to the same row of next XY plane + src += this._planeElements - this._rowElements; + // repeat first pixel of next tile + data[dst++] = 255.0 * this._data[src]; + } + } + } + } + + // fill pixels between tile rows with copy of edge pixels + for (let tileRow = 0; tileRow < tilesY; ++tileRow) { + // copy last pixel row of this tile row to the following pixel row of the texture + src = width * (tileRow * (this._dimY + 2) + this._dimY - 1); + dst = src + width; + for (let x = 0; x < width; ++x) { + data[dst++] = data[src++]; + } + if (tileRow < tilesY - 1) { + // copy first pixel row of next tile row to the preceding pixel row of the texture + src = width * (tileRow + 1) * (this._dimY + 2); + dst = src - width; + for (let x = 0; x < width; ++x) { + data[dst++] = data[src++]; + } + } + } + const texture = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.DataTexture(data, width, height, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LuminanceFormat, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UnsignedByteType, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UVMapping, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.ClampToEdgeWrapping, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.ClampToEdgeWrapping, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter); + texture.needsUpdate = true; + return texture; + } - var factor = 1.0 + delta * 0.05; - factor = Math.max(factor, 0.01); - this.scale(factor); - }; + /* ******************************************************************************** + * + * Methods that provide direct access to internal array (for better performance) + * + ******************************************************************************** */ - ObjectControls.prototype.mouseup = function (event) { - if (this.enabled === false || this._state === STATE.NONE) { - return; + getData() { + return this._data; + } + getDirectIdx(x, y, z) { + return x * this._dimVec + y * this._rowElements + z * this._planeElements; + } + getStrideX() { + return this._dimVec; + } + getStrideY() { + return this._rowElements; + } + getStrideZ() { + return this._planeElements; + } +} +Volume.prototype.id = 'Volume'; +/* harmony default export */ const chem_Volume = (Volume); +;// CONCATENATED MODULE: ./src/chem/Molecule.js +/** + * Residue Molecule. + * + * @param {Complex} complex - Molecular complex this Molecule belongs to. + * @param {String} name - Molecule's name. + * @param {Integer} index - Molecule's index in file. + * + * @exports Molecule + * @constructor + */ +class Molecule { + constructor(complex, name, index) { + this.complex = complex; + this.name = name || ''; + this.residues = []; + this.mask = 1 | 0; + this.index = index || -1; // start with 1 + } + forEachResidue(process) { + const { + residues + } = this; + for (let i = 0, n = residues.length; i < n; ++i) { + process(residues[i]); } + } + collectMask() { + let mask = 0xffffffff; + const { + residues + } = this; + for (let i = 0, n = residues.length; i < n; ++i) { + mask &= residues[i]._mask; + } + this.mask = mask; + } +} +/* harmony default export */ const chem_Molecule = (Molecule); +;// CONCATENATED MODULE: ./src/chem.js - event.preventDefault(); - event.stopPropagation(); - this._state = STATE.NONE; - if (this._clock.getElapsedTime() - this._lastMouseMoveTime > FULL_STOP_THRESHOLD) { - this._affectedObj.stop(); - } - }; - ObjectControls.prototype.touchstartend = function (event) { - if (this.enabled === false) { - return; - } - event.preventDefault(); - event.stopPropagation(); - switch (event.touches.length) { - case 1: - this._state = STATE.ROTATE; - this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY); - this._mousePrevPos.copy(this._mouseCurPos); - break; - case 2: - { - // prevent inertial rotation - this._mainObj.stop(); - this._altObj.stop(); - this._state = STATE.SCALE; - var dx = event.touches[0].pageX - event.touches[1].pageX; - var dy = event.touches[0].pageY - event.touches[1].pageY; - this._touchDistanceCur = this._touchDistanceStart = Math.sqrt(dx * dx + dy * dy); - this._scaleStart = this.object.scale.x; - break; - } - default: - this._state = STATE.NONE; - } - }; - ObjectControls.prototype.touchmove = function (event) { - if (this.enabled === false || this._state === STATE.NONE) { - return; - } - event.preventDefault(); - event.stopPropagation(); - switch (this._state) { - case STATE.ROTATE: - this._mousePrevPos.copy(this._mouseCurPos); - this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY); - this.rotateByMouse(false); - this._lastMouseMoveTime = this._clock.getElapsedTime(); - break; - case STATE.SCALE: - if (settings.now.zooming) { - // update scale - var dx = event.touches[0].pageX - event.touches[1].pageX; - var dy = event.touches[0].pageY - event.touches[1].pageY; - this._touchDistanceCur = Math.sqrt(dx * dx + dy * dy); - var newScale = this._scaleStart * this._touchDistanceCur / this._touchDistanceStart; - var factor = newScale / this.object.scale.x; - this.scale(factor); - } +/* harmony default export */ const chem = ({ + Atom: chem_Atom, + Element: chem_Element, + Bond: chem_Bond, + Residue: chem_Residue, + ResidueType: chem_ResidueType, + Chain: chem_Chain, + Helix: chem_Helix, + Strand: chem_Strand, + Sheet: chem_Sheet, + SGroup: chem_SGroup, + Assembly: chem_Assembly, + Complex: chem_Complex, + Volume: chem_Volume, + VoxelWorld: chem_VoxelWorld, + selectors: chem_selectors, + Molecule: chem_Molecule +}); +;// CONCATENATED MODULE: ./src/gfx/CSS2DObject.js +/** + * @author mrdoob / http://mrdoob.com/ + */ - break; + +class CSS2DObject extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Object3D { + constructor(element) { + super(); + const self = this; + this._element = element; + this._element.style.position = 'absolute'; + this.addEventListener('removed', () => { + if (self._element.parentNode !== null) { + self._element.parentNode.removeChild(self._element); + } + }); + } + getElement() { + return this._element; + } + + /** + * Sets label transparency. + * + * @param {number} transp - in [0; 1] 1 means fully transparent + */ + setTransparency(transp) { + const el = this.getElement(); + if (el === null) { + return; } - }; + if (transp === 1.0) { + el.style.display = 'none'; + return; + } + el.style.display = 'inline'; + const op = 1.0 - transp; + const top = op.toString(); + const op100 = op * 100; + el.style.opacity = top; + el.style.filter = `alpha(opacity=${op100})`; // IE fallback + } + clone() { + const obj = new CSS2DObject(this._element); + obj.copy(this); + return obj; + } +} +/* harmony default export */ const gfx_CSS2DObject = (CSS2DObject); +;// CONCATENATED MODULE: ./src/gfx/RCGroup.js - ObjectControls.prototype.keydownup = function (event) { - if (this.enabled === false || this.hotkeysEnabled === false) { +class RCGroup extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group { + raycast(raycaster, intersects) { + if (!this.visible) { return; } + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + children[i].raycast(raycaster, intersects); + } + } + enableSubset(mask, innerOnly) { + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].enableSubset) { + children[i].enableSubset(mask, innerOnly); + } + } + } + disableSubset(mask, innerOnly) { + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].disableSubset) { + children[i].disableSubset(mask, innerOnly); + } + } + } + isEmpty() { + return this.children.length === 0; + } + updateToFrame(frameData) { + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].updateToFrame) { + children[i].updateToFrame(frameData); + } + } + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + Array.prototype.push.apply(totalSubset, children[i].getSubset(mask, innerOnly)); + } + } + return totalSubset; + } +} +/* harmony default export */ const gfx_RCGroup = (RCGroup); +;// CONCATENATED MODULE: ./src/gfx/shaders/ScreenQuad.vert +const ScreenQuad_namespaceObject = "uniform mat4 projectionMatrix;\r\nuniform mat4 modelViewMatrix;\r\n\r\nattribute vec2 uv;\r\nattribute vec3 position;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vUv = uv;\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/ScreenQuadFromTex.frag +const ScreenQuadFromTex_namespaceObject = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform float opacity;\r\n\r\nvoid main() {\r\n vec4 color = texture2D(srcTex, vUv);\r\n gl_FragColor = vec4(color.xyz, color.a * opacity);\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/ScreenQuadFromTexWithDistortion.frag +const ScreenQuadFromTexWithDistortion_namespaceObject = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform float coef;\r\n\r\nvoid main() {\r\n vec2 uv = vUv * 2.0 - 1.0;\r\n float r2 = dot(uv, uv);\r\n vec2 tc = uv * (1.0 + coef * r2);\r\n if (!all(lessThan(abs(tc), vec2(1.0))))\r\n discard;\r\n tc = 0.5 * (tc + 1.0);\r\n gl_FragColor = texture2D(srcTex, tc);\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/gfxutils.js +/* eslint-disable no-magic-numbers */ + + + + + + + +const LAYERS = { + DEFAULT: 0, + VOLUME: 1, + TRANSPARENT: 2, + PREPASS_TRANSPARENT: 3, + VOLUME_BFPLANE: 4, + COLOR_FROM_POSITION: 5, + SHADOWMAP: 6 +}; +const SELECTION_LAYERS = [ +// These layers, that are used in the selection by ray casting +LAYERS.DEFAULT, LAYERS.TRANSPARENT]; +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Object3D.prototype.resetTransform = function () { + this.position.set(0, 0, 0); + this.quaternion.set(0, 0, 0, 1); + this.scale.set(1, 1, 1); +}; + +// update world matrix of this object and all its ancestors +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Object3D.prototype.updateMatrixWorldRecursive = function () { + if (this.parent != null) { + this.parent.updateMatrixWorldRecursive(); + } + this.updateMatrixWorld(); +}; +// add object to parent, saving objects' world transform +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Object3D.prototype.addSavingWorldTransform = function () { + const _worldMatrixInverse = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + return function (object) { + if (object instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Object3D) { + _worldMatrixInverse.copy(this.matrixWorld).invert(); + _worldMatrixInverse.multiply(object.matrixWorld); + object.matrix.copy(_worldMatrixInverse); + object.matrix.decompose(object.position, object.quaternion, object.scale); + this.add(object); + } + }; +}(); + +// render a tiny transparent quad in the center of the screen +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderer.prototype.renderDummyQuad = function () { + const _material = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MeshBasicMaterial({ + transparent: true, + opacity: 0.0, + depthWrite: false + }); + const _scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Scene(); + const _quad = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PlaneGeometry(0.01, 0.01), _material); + _scene.add(_quad); + const _camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000); + _camera.position.z = 100; + return function () { + this.render(_scene, _camera); + }; +}(); +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderer.prototype.renderScreenQuad = function () { + const _scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Scene(); + const _quad = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PlaneGeometry(1.0, 1.0)); + _scene.add(_quad); + const _camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000); + _camera.position.z = 100; + return function (material) { + _quad.material = material; + this.render(_scene, _camera); + }; +}(); +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4.prototype.isIdentity = function () { + const identity = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + return function () { + return identity.equals(this); + }; +}(); +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4.prototype.applyToPointsArray = function (array, stride, w) { + if (!array || !stride || stride < 3) { + return array; + } + w = w || 0; // use point as normal by default + const e = this.elements; + for (let i = 0; i < array.length; i += stride) { + const x = array[i]; + const y = array[i + 1]; + const z = array[i + 2]; + const persp = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]); + array[i] = (e[0] * x + e[4] * y + e[8] * z + e[12] * w) * persp; + array[i + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13] * w) * persp; + array[i + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14] * w) * persp; + } + return array; +}; +class ScreenQuadMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RawShaderMaterial { + constructor(params) { + if (params.uniforms === undefined) { + params.uniforms = {}; + } + params.uniforms.srcTex = { + type: 't', + value: null + }; + params.vertexShader = ScreenQuad_namespaceObject; + params.transparent = false; + params.depthTest = false; + params.depthWrite = false; + super(params); + } +} +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderer.prototype.renderScreenQuadFromTex = function () { + const _material = new ScreenQuadMaterial({ + uniforms: { + opacity: { + type: 'f', + value: 1.0 + } + }, + fragmentShader: ScreenQuadFromTex_namespaceObject, + transparent: true + }); + return function (srcTex, opacity) { + _material.uniforms.srcTex.value = srcTex; + _material.transparent = opacity < 1.0; + _material.uniforms.opacity.value = opacity; + this.renderScreenQuad(_material); + }; +}(); +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion = function () { + const _material = new ScreenQuadMaterial({ + uniforms: { + coef: { + type: 'f', + value: 1.0 + } + }, + fragmentShader: ScreenQuadFromTexWithDistortion_namespaceObject + }); + return function (srcTex, coef) { + _material.uniforms.srcTex.value = srcTex; + _material.uniforms.coef.value = coef; + this.renderScreenQuad(_material); + }; +}(); + +/** + * @param {number} angle - Field of view in degrees. + */ +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PerspectiveCamera.prototype.setMinimalFov = function (angle) { + if (this.aspect >= 1.0) { + this.fov = angle; + } else { + this.fov = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MathUtils.radToDeg(2 * Math.atan(Math.tan(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MathUtils.degToRad(angle) * 0.5) / this.aspect)); + } +}; + +/** + * @param {THREE.PerspectiveCamera} camera - Base camera for this stereo camera. + * @param {number} angle - Field of view in degrees. + */ +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.StereoCamera.prototype.updateHalfSized = function (camera, angle) { + const originalAspect = camera.aspect; + const originalFov = camera.fov; + camera.aspect = originalAspect / 2.0; + camera.setMinimalFov(angle); + camera.updateProjectionMatrix(); + this.update(camera); + camera.aspect = originalAspect; + camera.fov = originalFov; + camera.updateProjectionMatrix(); +}; + +/** + * @param {number} radius - Radius of bounding sphere in angstroms to fit on screen. + * @param {number} angle - Field of view in degrees. + */ +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PerspectiveCamera.prototype.setDistanceToFit = function (radius, angle) { + this.position.z = radius / Math.sin(0.5 * external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MathUtils.degToRad(angle)); +}; + +/** + * @param {RCGroup} gfxObj - All objects on scene. + * @param {THREE.PerspectiveCamera} camera - Camera used for rendering. + * @param {number} clipPlane - Distance to clip plane. + * @param {number} fogFarPlane - Distance to fog far plane. + */ +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Raycaster.prototype.intersectVisibleObject = function (gfxObj, camera, clipPlane, fogFarPlane) { + const intersects = this.intersectObject(gfxObj, false); + if (intersects.length === 0) { + return null; + } - switch (event.keyCode) { - case VK_LEFT: - case VK_UP: - case VK_RIGHT: - case VK_DOWN: - this._pressedKeys[event.keyCode] = event.type === 'keydown'; - event.preventDefault(); - event.stopPropagation(); - break; + // find point closest to camera that doesn't get clipped by camera near plane or clipPlane (if it exists) + const nearPlane = Math.min(camera.near, clipPlane); + let i; + let p = intersects[0]; + const v = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + for (i = 0; i < intersects.length; ++i) { + p = intersects[i]; + v.copy(p.point); + v.applyMatrix4(camera.matrixWorldInverse); + if (v.z <= -nearPlane) { + break; } - }; + } + if (i === intersects.length) { + return null; + } - ObjectControls.prototype.getKeyBindObject = function () { - return window.top; - }; + // check that selected intersection point is not clipped by camera far plane or occluded by fog (if it exists) + const farPlane = Math.min(camera.far, fogFarPlane); + v.copy(p.point); + v.applyMatrix4(camera.matrixWorldInverse); + if (v.z <= -farPlane) { + return null; + } + return p; +}; +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4.prototype.extractScale = function () { + const _v = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + return function (scale) { + if (scale === undefined) { + logger.debug('extractScale(): new is too expensive operation to do it on-the-fly'); + scale = _v.clone(); + } + const te = this.elements; + scale.x = _v.set(te[0], te[1], te[2]).length(); + scale.y = _v.set(te[4], te[5], te[6]).length(); + scale.z = _v.set(te[8], te[9], te[10]).length(); + + // if determine is negative, we need to invert one scale + const det = this.determinant(); + if (det < 0) { + scale.x = -scale.x; + } + return scale; + }; +}(); +function _calcCylinderMatrix(posBegin, posEnd, radius) { + const posCenter = posBegin.clone().lerp(posEnd, 0.5); + const matScale = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + matScale.makeScale(radius, posBegin.distanceTo(posEnd), radius); + const matRotHalf = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + matRotHalf.makeRotationX(Math.PI / 2); + const matRotLook = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + const vUp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 1, 0); + matRotLook.lookAt(posCenter, posEnd, vUp); + matRotLook.multiply(matRotHalf); + matRotLook.multiply(matScale); + matRotLook.setPosition(posCenter); + return matRotLook; +} +function _calcChunkMatrix(eye, target, up, rad) { + const matScale = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + matScale.makeScale(rad.x, rad.y, 0); + const matRotLook = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + matRotLook.lookAt(eye, target, up); + matRotLook.multiply(matScale); + matRotLook.setPosition(eye); + return matRotLook; +} +function _groupHasGeometryToRender(group) { + let hasGeoms = false; + group.traverse(node => { + if (node.hasOwnProperty('geometry') || node instanceof gfx_CSS2DObject) { + hasGeoms = true; + } + }); + return hasGeoms; +} +function _buildDistorionMesh(widthSegments, heightSegements, coef) { + // solve equation r_u = r_d * (1 + k * r_d^2) + // for r_d using iterations + // takes: r_u^2 + // returns: r_d / r_u factor that can be used to distort point coords + function calcInverseBarrel(r2) { + const epsilon = 1e-5; + let prevR2 = 0.0; + let curR2 = r2; + let dr = 1.0; + while (Math.abs(curR2 - prevR2) > epsilon) { + dr = 1.0 + coef * curR2; + prevR2 = curR2; + curR2 = r2 / (dr * dr); + } + return 1.0 / dr; + } + const geo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PlaneGeometry(2.0, 2.0, widthSegments, heightSegements); + const pos = geo.getAttribute('position'); + for (let i = 0; i < pos.count; ++i) { + const x = pos.array[3 * i]; + const y = pos.array[3 * i + 1]; + const c = calcInverseBarrel(x * x + y * y); + pos.setXY(i, c * x, c * y); + } + return geo; +} +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute.prototype.copyAtList = function (attribute, indexList) { + console.assert(this.itemSize === attribute.itemSize, 'DEBUG: BufferAttribute.copyAtList buffers have different item size.'); + const { + itemSize + } = this; + for (let i = 0, n = indexList.length; i < n; ++i) { + for (let j = 0; j < itemSize; ++j) { + this.array[i * itemSize + j] = attribute.array[indexList[i] * itemSize + j]; + } + } + return this; +}; +function fillArray(array, value, startIndex, endIndex) { + startIndex = typeof startIndex !== 'undefined' ? startIndex : 0; + endIndex = typeof endIndex !== 'undefined' ? endIndex : array.length; + for (let i = startIndex; i < endIndex; ++i) { + array[i] = value; + } +} + +/** @param {THREE.Object3D} object - Parent object. */ +function removeChildren(object) { + const { + children + } = object; + for (let i = 0, n = children.length; i < n; ++i) { + const child = children[i]; + child.parent = null; + child.dispatchEvent({ + type: 'removed' + }); + } + object.children = []; +} +function clearTree(object) { + object.traverse(obj => { + if (obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh || obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineSegments || obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Line) { + obj.geometry.dispose(); + } + }); + removeChildren(object); +} +function destroyObject(object) { + clearTree(object); + if (object.parent) { + object.parent.remove(object); + } else { + object.dispatchEvent({ + type: 'removed' + }); + } +} +function belongToSelectLayers(object) { + for (let i = 0; i < SELECTION_LAYERS.length; i++) { + if ((object.layers.mask >> SELECTION_LAYERS[i] & 1) === 1) { + return true; + } + } + return false; +} +function processObjRenderOrder(root, idMaterial) { + // set renderOrder to 0 for Backdrop and to 1 in other cases to render Backdrop earlier all other materials + const renderOrder = +(idMaterial !== 'BA'); + root.traverse(object => { + if (object.isGroup) { + object.renderOrder = renderOrder; + } + }); +} +function applySelectionMaterial(geo) { + geo.traverse(node => { + if ('material' in node) { + node.material = node.material.clone(true); + // using z-offset to magically fix selection rendering artifact (on z-sprites) + node.material.setValues({ + depthFunc: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LessEqualDepth, + overrideColor: true, + fog: false, + lights: false, + shadowmap: false + }); + node.material.setUberOptions({ + fixedColor: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(0xFFFF00), + zOffset: -1e-6 + }); + } + }); +} +function getMiddlePoint(point1, point2, optionalTarget) { + const result = optionalTarget || new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + result.set(0, 0, 0); + result.addScaledVector(point1, 0.5); + result.addScaledVector(point2, 0.5); + return result; +} + +// Monkey-patch for "InstancedBufferGeometry.instanceCount becomes undefined after copy()" +// https://github.com/mrdoob/three.js/issues/22151 +const _oldInstancedBufferGeometryCopy = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferGeometry.prototype.copy; +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferGeometry.prototype.copy = function (source) { + _oldInstancedBufferGeometryCopy.call(this, source); + if (this.instanceCount === undefined) { + this.instanceCount = Infinity; + } +}; +/* harmony default export */ const gfxutils = ({ + calcCylinderMatrix: _calcCylinderMatrix, + calcChunkMatrix: _calcChunkMatrix, + groupHasGeometryToRender: _groupHasGeometryToRender, + buildDistorionMesh: _buildDistorionMesh, + RCGroup: gfx_RCGroup, + fillArray, + clearTree, + destroyObject, + belongToSelectLayers, + processObjRenderOrder, + applySelectionMaterial, + getMiddlePoint, + LAYERS +}); +;// CONCATENATED MODULE: ./src/Visual.js + + +const _defaultBoundaries = { + boundingBox: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-1, -1, -1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1, 1, 1)), + boundingSphere: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Sphere(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0), 1) +}; +class Visual extends gfxutils.RCGroup { + constructor(name, dataSource) { + super(name, dataSource); + this.name = name; + this._dataSource = dataSource; + } + release() { + if (this.parent) { + this.parent.remove(this); + } + } + getDataSource() { + return this._dataSource; + } + getBoundaries() { + return _defaultBoundaries; + } +} +/* harmony default export */ const src_Visual = (Visual); +;// CONCATENATED MODULE: ./src/utils/EntityList.js +function _ensureArray(x) { + if (x === null || x === undefined || Array.isArray(x)) { + return x; + } + return [x]; +} + +/** An indexed list of objects or classes. */ +class EntityList { + /** + * Create a list of objects. + * The objects can be indexed by one or more properties for the later retrieval. + * + * @param {!Array=} entities A list of objects to automatically register at creation time. + * @param {!Array=} indices A list of property names to use for case-insensitive indexing. + * By default, a single `.id` property is used. + * @see EntityList#register + */ + constructor() { + let entities = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + let indices = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['id']; + this._list = []; + this._dict = {}; + this._indices = [...indices]; + this._indices.forEach(index => { + this._dict[index] = {}; + }); + entities.forEach(entity => this.register(entity)); + } - ObjectControls.prototype.dispose = function () { - for (var i = 0; i < this._listeners.length; i++) { - var l = this._listeners[i]; - l.obj.removeEventListener(l.type, l.handler); + /** + * Add a value to the end of a list. + * The list will contain only one copy of the value. + * + * @param {!Array} list An array. + * @param {*} value A value to add. + * @see EntityList.unregisterFromList + * @see EntityList.registerInDict + */ + static registerInList(list, value) { + if (!list.includes(value)) { + list.push(value); } - }; + } - ObjectControls.prototype.translatePivotByMouse = function () { - var delta = new THREE.Vector2(); - return function () { - delta.subVectors(this._mouseCurPos, this._mousePrevPos); - this.translatePivotInWorld(settings.now.translationSpeed * delta.x, settings.now.translationSpeed * delta.y, 0); - }; - }(); // Translate in WorldCS, translation is scaled with root scale matrix + /** + * Remove a value from a list if it is there. + * + * @param {!Array} list An array. + * @param {*} value A value to remove. + * @see EntityList.registerInList + */ + static unregisterFromList(list, value) { + const pos = list.indexOf(value); + if (pos !== -1) { + list.splice(pos, 1); + } + } + /** + * Add a value to a dictionary. + * The value may be stored under multiple different keys (aliases). + * There might be multiples values stored under the same key. + * + * @param {!Object} dict A dictionary. + * @param {!Array} keys An array of keys. + * @param {*} value A value to add. + * @see EntityList.unregisterFromDict + * @see EntityList.registerInList + */ + static registerInDict(dict, keys, value) { + keys.forEach(key => { + key = key.toLowerCase(); + const list = dict[key] = dict[key] || []; + if (!list.includes(value)) { + list.push(value); + } + }); + } - ObjectControls.prototype.translatePivotInWorld = function (x, y, z) { - var pos = this.objectPivot.position; - pos.applyMatrix4(this.object.matrixWorld); - pos.setX(pos.x + x); - pos.setY(pos.y + y); - pos.setZ(pos.z + z); - pos.applyMatrix4(matrix4.getInverse(this.object.matrixWorld)); - this.dispatchEvent({ - type: 'change', - action: 'translatePivot' + /** + * Remove a value from a dictionary. + * The value may be stored under multiple different keys (aliases). + * There might be multiples values stored under the same key. + * + * @param {!Object} dict A dictionary. + * @param {!Array} keys An array of keys. + * @param {*} value A value to add. + * @see EntityList.registerInDict + */ + static unregisterFromDict(dict, keys, value) { + keys.forEach(key => { + key = key.toLowerCase(); + const list = dict[key]; + if (list) { + const pos = list.indexOf(value); + if (pos !== -1) { + list.splice(pos, 1); + } + if (list.length === 0) { + delete dict[key]; + } + } }); - }; // Translate in ModelCS, x, y, z are Ang + } + /** + * Add an entity to this list. + * + * @param {!Object} entity An object or a class to register. The object must include all + * properties specified as indices on construction. + * @see EntityList#unregister + */ + register(entity) { + EntityList.registerInList(this._list, entity); + this._indices.forEach(index => { + EntityList.registerInDict(this._dict[index], _ensureArray(entity[index]), entity); + }); + } - ObjectControls.prototype.translatePivot = function (x, y, z) { - var pos = this.objectPivot.position; - pos.setX(pos.x + x); - pos.setY(pos.y + y); - pos.setZ(pos.z + z); - this.dispatchEvent({ - type: 'change', - action: 'translatePivot' + /** + * Remove an entity from this list. + * + * @param {!Object} entity An object or a class to unregister. The object may be + * missing from the list but it must include all properties specified as indices + * on construction. + * @see EntityList#register + */ + unregister(entity) { + EntityList.unregisterFromList(this._list, entity); + this._indices.forEach(index => { + EntityList.unregisterFromDict(this._dict[index], _ensureArray(entity[index]), entity); }); - }; // Set pivot + } + /** + * An ordered list of all registered entities. + * It is a read-only copy, use {@link EntityList#register} and {@link EntityList#unregister} + * to modify it. + * + * @type {!Array} + */ + get all() { + return [...this._list]; + } - ObjectControls.prototype.setPivot = function (newPivot) { - this.objectPivot.position.copy(newPivot); - this.dispatchEvent({ - type: 'change', - action: 'translatePivot' - }); - }; + /** + * The first registered entity. + * Use it if you do not care which entity you are referring to. + * + * @type {Object=} + */ + get first() { + return this._list[0]; + } - function Picker(gfxObj, camera, domElement) { - EventDispatcher.call(this); - var self = this; - this.gfxObj = gfxObj; - this.camera = camera; - this.domElement = typeof domElement !== 'undefined' ? domElement : document; - this.screen = { - left: 0, - top: 0, - width: 0, - height: 0 - }; - this._lastMousePos = new THREE.Vector2(0, 0); - this._mouseTotalDist = 0.0; - this._lastClickBeginTime = -1000.0; - this._lastClickPos = new THREE.Vector2(0, 0); - this._clickBeginTime = 0.0; - this._clock = new Timer(); + /** + * Retrieve a list of keys for the index. + * + * @param {string=} index One of the indices specified during the list construction. If omitted, + * the first of the indices is used. + * @returns {!Array} An unordered list of keys in the index, i.e. particular property + * values for all registered entities. + */ + keys(index) { + return Object.keys(this._dict[index || this._indices[0]]); + } - this._clock.start(); + /** + * Retrieve an entity by its key. + * + * @param {string} key A case-insensitive property value to look-up. + * @param {string=} index One of the indices specified during the list construction. If omitted, + * the first of the indices is used. + * @returns {Object=} An object registered in the index under the key. If there are multiple + * objects under the same key, the first one is returned. + */ + get(key, index) { + const dict = this._dict[index || this._indices[0]]; + if (dict) { + const values = dict[key && key.toLowerCase()]; + return values && values.length > 0 ? values[0] : undefined; + } + return undefined; + } +} +/* harmony default export */ const utils_EntityList = (EntityList); +;// CONCATENATED MODULE: ./src/utils/makeContextDependent.js - this._listeners = [{ - obj: self.domElement, - type: 'mousedown', - handler: function handler(e) { - self.mousedown(e); - } - }, { - obj: self.domElement, - type: 'mouseup', - handler: function handler(e) { - self.mouseup(e); - } - }, { - obj: self.domElement, - type: 'mousemove', - handler: function handler(e) { - self.mousemove(e); - } - }, { - obj: self.domElement, - type: 'touchstart', - handler: function handler(e) { - self.touchstart(e); + +function makeContextDependent(prototype) { + Object.defineProperties(prototype, { + logger: { + get() { + return this.context && this.context.logger ? this.context.logger : logger; } - }, { - obj: self.domElement, - type: 'touchend', - handler: function handler(e) { - self.touchend(e); + }, + settings: { + get() { + return this.context && this.context.settings ? this.context.settings : settings; } - }, { - obj: window, - type: 'resize', - handler: function handler() { - self.handleResize(); + } + }); +} +/* harmony default export */ const utils_makeContextDependent = (makeContextDependent); +;// CONCATENATED MODULE: ./src/gfx/geometries/SphereCollisionGeo.js + +class CollisionSphere { + constructor(position, radius) { + this._position = position; + this._radius = radius; + } + static _sphere = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Sphere())(); + raycast(raycaster) { + const sphere = CollisionSphere._sphere; + sphere.set(this._position, this._radius); + const p = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + if (raycaster.ray.intersectSphere(sphere, p)) { + return { + distance: raycaster.ray.origin.distanceTo(p), + point: p + }; + } + return null; + } +} +const SphereCollisionGeo = base => class extends base { + constructor(count) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + super(...args); + this._objects = new Array(count); + this.boundingSphere = null; + this.boundingBox = null; + } + setSphere(idx, position, radius) { + this._objects[idx] = new CollisionSphere(position, radius); + } + raycast(raycaster, intersects) { + // TODO raycast with bounding sphere? How to deal with updates? + for (let i = 0, n = this._objects.length; i < n; ++i) { + const inters = this._objects[i].raycast(raycaster); + if (inters) { + inters.chunkIdx = i; + intersects.push(inters); } - }]; - - for (var i = 0; i < this._listeners.length; i++) { - var l = this._listeners[i]; - l.obj.addEventListener(l.type, l.handler); } - - this.handleResize(); } - - Picker.prototype = Object.create(EventDispatcher.prototype); - Picker.prototype.constructor = Picker; - - Picker.prototype.reset = function () { - this.picked = {}; - this.dispatchEvent({ - type: 'newpick', - obj: {} - }); - }; - - Picker.prototype.handleResize = function () { - if (this.domElement === document) { - this.screen.left = 0; - this.screen.top = 0; - this.screen.width = window.innerWidth; - this.screen.height = window.innerHeight; - } else { - var box = this.domElement.getBoundingClientRect(); // adjustments come from similar code in the jquery offset() function - - var d = this.domElement.ownerDocument.documentElement; - this.screen.left = box.left + window.pageXOffset - d.clientLeft; - this.screen.top = box.top + window.pageYOffset - d.clientTop; - this.screen.width = box.width; - this.screen.height = box.height; + computeBoundingBox() { + const objects = this._objects; + let { + boundingBox + } = this; + if (boundingBox === null) { + this.boundingBox = boundingBox = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(); + } + boundingBox.makeEmpty(); + for (let i = 0, n = objects.length; i < n; ++i) { + boundingBox.expandByPoint(objects[i]._position); } - }; - - Picker.prototype.pickObject = function (screenPos) { - if (!this.gfxObj) { - this.picked = {}; - this.dispatchEvent({ - type: 'newpick', - obj: {} - }); - return; + } + computeBoundingSphere() { + this.computeBoundingBox(); + const objects = this._objects; + const { + boundingBox + } = this; + // Build bounding sphere + let radiusSquared = 0.0; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + boundingBox.getCenter(center); + for (let i = 0, n = objects.length; i < n; ++i) { + const pos = objects[i]._position; + const lengthSquared = center.distanceToSquared(pos); + if (radiusSquared < lengthSquared) { + radiusSquared = lengthSquared; + } + } + if (this.boundingSphere === null) { + this.boundingSphere = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Sphere(); + } + this.boundingSphere.set(center, Math.sqrt(radiusSquared)); + } +}; +/* harmony default export */ const geometries_SphereCollisionGeo = (SphereCollisionGeo); +;// CONCATENATED MODULE: ./src/gfx/geometries/InstancedSpheresGeometry.js + + + + +const tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(); +const OFFSET_SIZE = 4; +const COLOR_SIZE = 3; +const { + copySubArrays: InstancedSpheresGeometry_copySubArrays +} = utils; +function setArrayXYZ(arr, idx, x, y, z) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; +} +function setArrayXYZW(arr, idx, x, y, z, w) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; + arr[idx + 3] = w; +} +class InstancedSpheresGeometry extends geometries_SphereCollisionGeo(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferGeometry) { + constructor(spheresCount, sphereComplexity, useZSprites) { + super(spheresCount); + this._sphGeometry = useZSprites ? new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PlaneGeometry(2, 2, 1, 1) : new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI); + this._init(spheresCount, this._sphGeometry); + } + setItem(itemIdx, itemPos, itemRad) { + setArrayXYZW(this._offsets, itemIdx * OFFSET_SIZE, itemPos.x, itemPos.y, itemPos.z, itemRad); + this.setSphere(itemIdx, itemPos, itemRad); + } + setColor(itemIdx, colorVal) { + tmpColor.set(colorVal); + setArrayXYZ(this._colors, itemIdx * COLOR_SIZE, tmpColor.r, tmpColor.g, tmpColor.b); + } + startUpdate() { + return true; + } + finishUpdate() { + this.getAttribute('offset').needsUpdate = true; + this.getAttribute('color').needsUpdate = true; + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + setOpacity(chunkIndices, value) { + const alphaArr = this._alpha; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + alphaArr[chunkIndices[i]] = value; } + this.getAttribute('alphaColor').needsUpdate = true; + } + getSubset(chunkIndices) { + const instanceCount = chunkIndices.length; + const geom = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferGeometry(); + this._init.call(geom, instanceCount, this._sphGeometry); + InstancedSpheresGeometry_copySubArrays(this._offsets, geom._offsets, chunkIndices, OFFSET_SIZE); + InstancedSpheresGeometry_copySubArrays(this._colors, geom._colors, chunkIndices, COLOR_SIZE); + geom.boundingSphere = this.boundingSphere; + geom.boundingBox = this.boundingBox; + return [geom]; + } + _init(spheresCount, sphereGeo) { + this.copy(sphereGeo); + this._offsets = utils.allocateTyped(Float32Array, spheresCount * OFFSET_SIZE); + this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE); + const alpha = this._alpha = utils.allocateTyped(Float32Array, spheresCount); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().fill(alpha, 1.0); + this.setAttribute('offset', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._offsets, OFFSET_SIZE, false, 1)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._colors, COLOR_SIZE, false, 1)); + this.setAttribute('alphaColor', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(alpha, 1, false, 1)); + } +} +/* harmony default export */ const geometries_InstancedSpheresGeometry = (InstancedSpheresGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/ChunkedObjectsGeometry.js - var gfxObj = this.gfxObj; - var rayCaster = new THREE.Raycaster(); - rayCaster.ray.origin.setFromMatrixPosition(this.camera.matrixWorld); - rayCaster.ray.direction.set(screenPos.x, screenPos.y, 0.5).unproject(this.camera).sub(rayCaster.ray.origin).normalize(); - var clipPlane = settings.now.draft.clipPlane && this.clipPlaneValue ? this.clipPlaneValue : Infinity; - var fogFarPlane = settings.now.fog && this.fogFarValue ? this.fogFarValue : Infinity; - var point = rayCaster.intersectVisibleObject(gfxObj, this.camera, clipPlane, fogFarPlane); - if (!point) { - this.picked = {}; - this.dispatchEvent({ - type: 'newpick', - obj: {} - }); - return; - } - var picked = {}; +const MAX_IDC_16BIT = 65535; +const VEC_SIZE = 3; +const ChunkedObjectsGeometry_tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(); - if (point.residue || point.atom) { - var residue = point.residue || point.atom.residue; +/** + * This class represents geometry which consists of separate chunks. + * Each chunk has same index and similar geometry with equal points and faces count. + * Each chunk has by default only one color. + * @constructor + */ - if (settings.now.pick === 'chain') { - picked = { - chain: residue.getChain() - }; - } else if (settings.now.pick === 'molecule') { - picked = { - molecule: residue.getMolecule() - }; - } else if (point.residue || settings.now.pick === 'residue') { - picked = { - residue: residue - }; - } else if (point.atom) { - picked = { - atom: point.atom - }; +class ChunkedObjectsGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry { + constructor(chunkGeo, chunksCount) { + super(); + if (this.constructor === ChunkedObjectsGeometry) { + throw new Error('Can not instantiate abstract class!'); + } + this._chunkGeo = chunkGeo; + this._init(chunkGeo, chunksCount); + } + startUpdate() { + return true; + } + finishUpdate() { + this.getAttribute('position').needsUpdate = true; + this.getAttribute('normal').needsUpdate = true; + this.getAttribute('color').needsUpdate = true; + } + setColor(chunkIdx, colorVal) { + ChunkedObjectsGeometry_tmpColor.set(colorVal); + const colors = this._colors; + const chunkSize = this._chunkSize; + for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) { + const idx = i * VEC_SIZE; + colors[idx] = ChunkedObjectsGeometry_tmpColor.r; + colors[idx + 1] = ChunkedObjectsGeometry_tmpColor.g; + colors[idx + 2] = ChunkedObjectsGeometry_tmpColor.b; + } + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + setOpacity(chunkIndices, value) { + const alphaArr = this._alpha; + const chunkSize = this._chunkSize; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const left = chunkIndices[i] * chunkSize; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().fill(alphaArr, value, left, left + chunkSize); + } + this.getAttribute('alphaColor').needsUpdate = true; + } + raycast(raycaster, intersects) { + const inters = []; + // use THREE.Mesh raycasting interface for the Geometry. The Mesh is + // created with existed geometry and default material, so it doesn't slowdown. + const mesh = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh(); + mesh.geometry = this; + mesh.raycast(raycaster, inters); + const facesPerChunk = this._chunkGeo.index.count / 3; + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('faceIndex')) { + continue; } + inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk); + intersects.push(inters[i]); } + } + getSubset(chunkIndices) { + const instanceCount = chunkIndices.length; + const geom = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry(); + this._init.call(geom, this._chunkGeo, instanceCount); + const srcPos = this._positions; + const srcNorm = this._normals; + const srcColor = this._colors; + const dstPos = geom._positions; + const dstNorm = geom._normals; + const dstColor = geom._colors; + const chunkSize = this._chunkSize * VEC_SIZE; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const dstPtOffset = i * chunkSize; + const ptIdxBegin = chunkIndices[i] * chunkSize; + const ptIdxEnd = ptIdxBegin + chunkSize; + dstPos.set(srcPos.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); + dstNorm.set(srcNorm.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); + dstColor.set(srcColor.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); + } + geom.boundingSphere = this.boundingSphere; + geom.boundingBox = this.boundingBox; + return [geom]; + } + _init(chunkGeo, chunksCount) { + const chunkSize = this._chunkSize = chunkGeo.attributes.position.count; + const chunkIndex = chunkGeo.index.array; + const chunkIndexSize = chunkIndex.length; + const pointsCount = this._chunkSize * chunksCount; + const use32bitIndex = pointsCount > MAX_IDC_16BIT; + const indexSize = chunkIndexSize * chunksCount; + const index = this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, indexSize); + this._positions = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); + this._normals = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); + this._colors = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); + const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().fill(alpha, 1.0); + for (let i = 0; i < chunksCount; ++i) { + const offset = i * chunkIndexSize; + const posOffset = i * chunkSize; + index.set(chunkIndex, offset); + for (let j = 0; j < chunkIndexSize; ++j) { + index[offset + j] += posOffset; + } + } + this.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._index, 1)); + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._positions, VEC_SIZE)); + this.setAttribute('normal', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._normals, VEC_SIZE)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._colors, VEC_SIZE)); + this.setAttribute('alphaColor', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(alpha, 1)); + } +} +/* harmony default export */ const geometries_ChunkedObjectsGeometry = (ChunkedObjectsGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/SimpleSpheresGeometry.js - this.picked = picked; - this.dispatchEvent({ - type: 'newpick', - obj: picked - }); - }; - Picker.prototype.getMouseInViewport = function (pageX, pageY) { - return new THREE.Vector2((pageX - this.screen.left) / this.screen.width * 2 - 1, -(pageY - this.screen.top) / this.screen.height * 2 + 1); - }; - Picker.prototype.mousedown = function (event) { - event.preventDefault(); - event.stopPropagation(); - if (event.button === 0) { - this._lastMousePos = this.getMouseInViewport(event.pageX, event.pageY); - this._mouseTotalDist = 0.0; - this._clickBeginTime = this._clock.getElapsedTime(); +const SimpleSpheresGeometry_VEC_SIZE = 3; +class SimpleSpheresGeometry extends geometries_SphereCollisionGeo(geometries_ChunkedObjectsGeometry) { + constructor(spheresCount, sphereComplexity) { + const sphGeometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI); + super(spheresCount, sphGeometry, spheresCount); + const normals = this._normals; + const geoNormals = sphGeometry.attributes.normal.array; + const chunkSize = this._chunkSize; + this._chunkPos = this._chunkGeo.attributes.position.array; + this._tmpPositions = utils.allocateTyped(Float32Array, chunkSize * SimpleSpheresGeometry_VEC_SIZE); + for (let i = 0; i < spheresCount; ++i) { + normals.set(geoNormals, chunkSize * SimpleSpheresGeometry_VEC_SIZE * i); } - }; + } + setItem(itemIdx, itemPos, itemRad) { + const tmpPos = this._tmpPositions; + const chunkSize = this._chunkSize; + const geoPos = this._chunkPos; + for (let i = 0; i < chunkSize; ++i) { + const idx = i * 3; + tmpPos[idx] = itemPos.x + geoPos[idx] * itemRad; + tmpPos[idx + 1] = itemPos.y + geoPos[idx + 1] * itemRad; + tmpPos[idx + 2] = itemPos.z + geoPos[idx + 2] * itemRad; + } + this._positions.set(tmpPos, chunkSize * itemIdx * SimpleSpheresGeometry_VEC_SIZE); + this.setSphere(itemIdx, itemPos, itemRad); + } +} +/* harmony default export */ const geometries_SimpleSpheresGeometry = (SimpleSpheresGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/Simple2CCylindersGeometry.js - Picker.prototype.mousemove = function (event) { - event.preventDefault(); - event.stopPropagation(); - var pos = this.getMouseInViewport(event.pageX, event.pageY); - this._mouseTotalDist += pos.sub(this._lastMousePos).length(); - }; - Picker.prototype.mouseup = function (event) { - var self = this; - event.preventDefault(); - event.stopPropagation(); - if (event.button === 0) { - if (this._mouseTotalDist < 0.01) { - var curTime = this._clock.getElapsedTime(); - var curPos = this.getMouseInViewport(event.pageX, event.pageY); - var timeSinceLastClickBegin = curTime - this._lastClickBeginTime; +const Simple2CCylindersGeometry_VEC_SIZE = 3; +const centerPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +const tmpVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +const normMtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix3(); +class Simple2CCylindersGeometry extends geometries_ChunkedObjectsGeometry { + constructor(instanceCount, polyComplexity) { + const cylGeometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true); + super(cylGeometry, 2 * instanceCount); + const chunkSize = this._chunkSize; + this._chunkPos = this._chunkGeo.attributes.position.array; + this._chunkNorms = this._chunkGeo.attributes.normal.array; + this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * Simple2CCylindersGeometry_VEC_SIZE); + } + setItem(itemIdx, botPos, topPos, itemRad) { + const chunkSize = this._chunkSize; + const firstOffset = chunkSize * 2 * itemIdx * Simple2CCylindersGeometry_VEC_SIZE; + const secondOffset = firstOffset + chunkSize * Simple2CCylindersGeometry_VEC_SIZE; + const tmpArray = this._tmpVector; + const geoPos = this._chunkPos; + const geoNorm = this._chunkNorms; + centerPos.lerpVectors(botPos, topPos, 0.5); + const mtx1 = gfxutils.calcCylinderMatrix(botPos, centerPos, itemRad); + normMtx.getNormalMatrix(mtx1); + let idx; + for (let i = 0; i < chunkSize; ++i) { + idx = i * Simple2CCylindersGeometry_VEC_SIZE; + tmpVector.fromArray(geoPos, idx); + tmpVector.applyMatrix4(mtx1); + tmpVector.toArray(tmpArray, idx); + } + this._positions.set(tmpArray, firstOffset); + + // now shift center to get another part of the cylinder + centerPos.sub(botPos); + for (let i = 0; i < chunkSize; ++i) { + idx = i * Simple2CCylindersGeometry_VEC_SIZE; + tmpArray[idx] += centerPos.x; + tmpArray[idx + 1] += centerPos.y; + tmpArray[idx + 2] += centerPos.z; + } + this._positions.set(tmpArray, secondOffset); + for (let i = 0; i < chunkSize; ++i) { + idx = i * Simple2CCylindersGeometry_VEC_SIZE; + tmpVector.fromArray(geoNorm, idx); + tmpVector.applyMatrix3(normMtx); + tmpVector.toArray(tmpArray, idx); + } + this._normals.set(tmpArray, firstOffset); + this._normals.set(tmpArray, secondOffset); + } + setColor(itemIdx, colorVal1, colorVal2) { + const first = 2 * itemIdx; + super.setColor(first, colorVal1); + const second = first + 1; + super.setColor(second, colorVal2); + } +} +/* harmony default export */ const geometries_Simple2CCylindersGeometry = (Simple2CCylindersGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/CylinderBufferGeometry.js + + +const MAX_POINTS_COUNT_16BIT = 65536; +const PTS_PER_TRIANGLE = 3; +class CylinderBufferGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry { + constructor(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded) { + super(); + const thetaStart = 0; + const thetaLength = 2 * Math.PI; + this.type = 'CylinderBufferGeometry'; + this.parameters = { + radiusTop, + radiusBottom, + height, + radialSegments, + heightSegments, + openEnded + }; + const hasTop = openEnded === false && radiusTop > 0; + const hasBottom = openEnded === false && radiusBottom > 0; + const vertexCount = (heightSegments + 1) * radialSegments + hasTop * (radialSegments + 1) + hasBottom * (radialSegments + 1); + const facesCount = (2 * heightSegments + hasTop + hasBottom) * radialSegments; + const heightHalf = height / 2; - if (timeSinceLastClickBegin < 0.7) { - var clickDist = new THREE.Vector2().subVectors(curPos, this._lastClickPos); + /* eslint-disable no-magic-numbers */ + const positions = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3); + const normals = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3); + const indices = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Uint16BufferAttribute(utils.allocateTyped(Uint16Array, facesCount * PTS_PER_TRIANGLE), 1); + /* eslint-enable no-magic-numbers */ - if (clickDist.length() < 0.01) { - // it's a double click - this.dispatchEvent({ - type: 'dblclick', - obj: this.picked - }); - this._lastClickPos = curPos; - this._lastClickBeginTime = -1000; // this click cannot serve as first click in double-click + const uvs = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 2), 2); + console.assert(vertexCount < MAX_POINTS_COUNT_16BIT, 'DEBUG: Cylinder Geometry has too many vertices (65536 max).'); + let currVtxIdx = 0; + let currFaceIdx = 0; + const tanTheta = -(radiusBottom - radiusTop) / height; - return; - } + // setup cylinder data + for (let y = 0; y <= heightSegments; y++) { + // faces + if (y !== heightSegments) { + for (let i = 0; i < radialSegments; i++) { + const v1 = currVtxIdx + i; + const v2 = currVtxIdx + radialSegments + i; + const v3 = currVtxIdx + radialSegments + (i + 1) % radialSegments; + const v4 = currVtxIdx + (i + 1) % radialSegments; + indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v1, v4, v2); + currFaceIdx++; + indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v2, v4, v3); + currFaceIdx++; } + } - setTimeout(function () { - self.pickObject(curPos); - }, 0); - this._lastClickPos = curPos; - this._lastClickBeginTime = this._clickBeginTime; + // vertices + const v = y / heightSegments; + const radius = v * (radiusBottom - radiusTop) + radiusTop; + for (let x = 0; x < radialSegments; x++) { + const u = x / radialSegments; + const vx = radius * Math.sin(u * thetaLength + thetaStart); + const vy = v * height - heightHalf; + const vz = radius * Math.cos(u * thetaLength + thetaStart); + const normal = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(vx, Math.sqrt(vx * vx + vz * vz) * tanTheta, vz).normalize(); + positions.setXYZ(currVtxIdx, vx, vy, vz); + normals.setXYZ(currVtxIdx, normal.x, normal.y, normal.z); + uvs.setXY(currVtxIdx, u, v); + ++currVtxIdx; } } - }; - Picker.prototype.touchstart = function (event) { - event.preventDefault(); - event.stopPropagation(); - - if (event.touches.length === 1) { - this._lastTouchdownPos = this.getMouseInViewport(event.touches[0].pageX, event.touches[0].pageY); + // top cap + if (hasTop) { + const startTIdx = currVtxIdx; + const lastIdx = currVtxIdx + radialSegments; + for (let fTIdx = 0; fTIdx < radialSegments; ++fTIdx) { + const currSrcIdx = currVtxIdx - radialSegments; + positions.setXYZ(currVtxIdx, positions.getX(currSrcIdx), positions.getY(currSrcIdx), positions.getZ(currSrcIdx)); + normals.setXYZ(currVtxIdx, 0, 1, 0); + uvs.setXY(currVtxIdx, 1, 1); + const nextTVtx = startTIdx + (fTIdx + 1) % radialSegments; + indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, currVtxIdx, nextTVtx, lastIdx); + currFaceIdx++; + currVtxIdx++; + } + positions.setXYZ(currVtxIdx, 0, heightHalf, 0); + normals.setXYZ(currVtxIdx, 0, 1, 0); + uvs.setXY(currVtxIdx, 1, 1); + ++currVtxIdx; + } + + // bottom cap + if (hasBottom) { + const startBIdx = currVtxIdx; + const lastBIdx = currVtxIdx + radialSegments; + for (let fBIdx = 0; fBIdx < radialSegments; ++fBIdx) { + const currSrcBIdx = fBIdx; + positions.setXYZ(currVtxIdx, positions.getX(currSrcBIdx), positions.getY(currSrcBIdx), positions.getZ(currSrcBIdx)); + normals.setXYZ(currVtxIdx, 0, -1, 0); + uvs.setXY(currVtxIdx, 0, 0); + const nextBVtx = startBIdx + (fBIdx + 1) % radialSegments; + indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, nextBVtx, currVtxIdx, lastBIdx); + currFaceIdx++; + currVtxIdx++; + } + positions.setXYZ(currVtxIdx, 0, -heightHalf, 0); + normals.setXYZ(currVtxIdx, 0, -1, 0); + uvs.setXY(currVtxIdx, 0, 0); + } + this.setIndex(indices); + this.setAttribute('position', positions); + this.setAttribute('normal', normals); + this.setAttribute('uv', uvs); + } + clone() { + const { + parameters + } = this; + return new CylinderBufferGeometry(parameters.radiusTop, parameters.radiusBottom, parameters.height, parameters.radialSegments, parameters.heightSegments, parameters.openEnded); + } +} +/* harmony default export */ const geometries_CylinderBufferGeometry = (CylinderBufferGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/Instanced2CCylindersGeometry.js + + + + + + +const Instanced2CCylindersGeometry_tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(); +const invMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); +const Instanced2CCylindersGeometry_OFFSET_SIZE = 4; +const Instanced2CCylindersGeometry_COLOR_SIZE = 3; +const { + copySubArrays: Instanced2CCylindersGeometry_copySubArrays +} = utils; +function Instanced2CCylindersGeometry_setArrayXYZ(arr, idx, x, y, z) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; +} +function Instanced2CCylindersGeometry_setArrayXYZW(arr, idx, x, y, z, w) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; + arr[idx + 3] = w; +} +function sortNumber(a, b) { + return a - b; +} +function _prepareCylinderInfo(chunkIndices) { + chunkIndices.sort(sortNumber); + const chunksIdx = []; + const cylinderInfo = []; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const val = chunkIndices[i]; + const even = (val | 0) % 2 === 0; + const newPar = { + first: false, + second: false + }; + if (even) { + newPar.first = true; + newPar.second = i + 1 < n && chunkIndices[i + 1] === chunkIndices[i] + 1; + if (newPar.second) { + ++i; + } + } else { + newPar.second = true; } + chunksIdx.push(Math.floor(val / 2)); + cylinderInfo.push(newPar); + } + return { + indices: chunksIdx, + cylinderInfo }; - - Picker.prototype.touchend = function (event) { - var self = this; - event.preventDefault(); - event.stopPropagation(); - - if (event.touches.length === 0 && event.changedTouches.length === 1) { - var pos = this.getMouseInViewport(event.changedTouches[0].pageX, event.changedTouches[0].pageY); - var dist = pos.sub(this._lastTouchdownPos).length(); - - if (dist < 0.01) { - setTimeout(function () { - self.pickObject(self._lastTouchdownPos); - }, 0); +} +function _assignOpacity(cylinderInfo, color1, color2) { + for (let i = 0, n = cylinderInfo.length; i < n; ++i) { + const info = cylinderInfo[i]; + if (!info.first) { + color1[Instanced2CCylindersGeometry_COLOR_SIZE * i] = -0.5; + } + if (!info.second) { + color2[Instanced2CCylindersGeometry_COLOR_SIZE * i] = -0.5; + } + } +} +class Instanced2CCylindersGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferGeometry { + constructor(instanceCount, polyComplexity, useZSprites, openEnded) { + super(); + this._useZSprites = useZSprites; + this._cylGeometry = useZSprites ? new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PlaneGeometry(2, 2, 1, 1) : new geometries_CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, openEnded); + this._init(instanceCount, this._cylGeometry, this._useZSprites); + this._collisionGeo = new geometries_Simple2CCylindersGeometry(instanceCount, 3); + } + setItem(itemIdx, botPos, topPos, itemRad) { + const matrix = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad); + let me = matrix.elements; + const mtxOffset = itemIdx * Instanced2CCylindersGeometry_OFFSET_SIZE; + this._collisionGeo.setItem(itemIdx, botPos, topPos, itemRad); + Instanced2CCylindersGeometry_setArrayXYZW(this._matVector1, mtxOffset, me[0], me[4], me[8], me[12]); + Instanced2CCylindersGeometry_setArrayXYZW(this._matVector2, mtxOffset, me[1], me[5], me[9], me[13]); + Instanced2CCylindersGeometry_setArrayXYZW(this._matVector3, mtxOffset, me[2], me[6], me[10], me[14]); + if (this._useZSprites) { + invMatrix.copy(matrix).invert(); + me = invMatrix.elements; + Instanced2CCylindersGeometry_setArrayXYZW(this._invmatVector1, mtxOffset, me[0], me[4], me[8], me[12]); + Instanced2CCylindersGeometry_setArrayXYZW(this._invmatVector2, mtxOffset, me[1], me[5], me[9], me[13]); + Instanced2CCylindersGeometry_setArrayXYZW(this._invmatVector3, mtxOffset, me[2], me[6], me[10], me[14]); + } + } + setColor(itemIdx, colorVal1, colorVal2) { + const colorIdx = itemIdx * Instanced2CCylindersGeometry_COLOR_SIZE; + Instanced2CCylindersGeometry_tmpColor.set(colorVal1); + Instanced2CCylindersGeometry_setArrayXYZ(this._color1, colorIdx, Instanced2CCylindersGeometry_tmpColor.r, Instanced2CCylindersGeometry_tmpColor.g, Instanced2CCylindersGeometry_tmpColor.b); + Instanced2CCylindersGeometry_tmpColor.set(colorVal2); + Instanced2CCylindersGeometry_setArrayXYZ(this._color2, colorIdx, Instanced2CCylindersGeometry_tmpColor.r, Instanced2CCylindersGeometry_tmpColor.g, Instanced2CCylindersGeometry_tmpColor.b); + } + computeBoundingSphere() { + this._collisionGeo.computeBoundingSphere(); + this.boundingSphere = this._collisionGeo.boundingSphere; + } + computeBoundingBox() { + this._collisionGeo.computeBoundingBox(); + this.boundingBox = this._collisionGeo.boundingBox; + } + raycast(raycaster, intersects) { + this._collisionGeo.raycast(raycaster, intersects); + } + startUpdate() { + return true; + } + finishUpdate() { + this.getAttribute('matVector1').needsUpdate = true; + this.getAttribute('matVector2').needsUpdate = true; + this.getAttribute('matVector3').needsUpdate = true; + this.getAttribute('color').needsUpdate = true; + this.getAttribute('color2').needsUpdate = true; + this.getAttribute('alphaColor').needsUpdate = true; + if (this._useZSprites) { + this.getAttribute('invmatVector1').needsUpdate = true; + this.getAttribute('invmatVector2').needsUpdate = true; + this.getAttribute('invmatVector3').needsUpdate = true; + } + this._collisionGeo.finishUpdate(); + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + setOpacity(chunkIndices, value) { + const alphaArr = this._alpha; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + alphaArr[Math.floor(chunkIndices[i] / 2)] = value; + } + this.getAttribute('alphaColor').needsUpdate = true; + } + getSubset(chunkIndices) { + const info = _prepareCylinderInfo(chunkIndices); + const cylinderIndices = info.indices; + const instanceCount = cylinderIndices.length; + const geom = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferGeometry(); + this._init.call(geom, instanceCount, this._cylGeometry, this._useZSprites); + Instanced2CCylindersGeometry_copySubArrays(this._matVector1, geom._matVector1, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._matVector2, geom._matVector2, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._matVector3, geom._matVector3, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + if (this._useZSprites) { + Instanced2CCylindersGeometry_copySubArrays(this._invmatVector1, geom._invmatVector1, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._invmatVector2, geom._invmatVector2, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._invmatVector3, geom._invmatVector3, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + } + Instanced2CCylindersGeometry_copySubArrays(this._color1, geom._color1, cylinderIndices, Instanced2CCylindersGeometry_COLOR_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._color2, geom._color2, cylinderIndices, Instanced2CCylindersGeometry_COLOR_SIZE); + _assignOpacity(info.cylinderInfo, geom._color1, geom._color2); + geom.boundingSphere = this.boundingSphere; + geom.boundingBox = this.boundingBox; + return [geom]; + } + getGeoParams() { + return this._cylGeometry.parameters; + } + _init(instanceCount, cylinderGeo, useZSprites) { + this.copy(cylinderGeo); + this._matVector1 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._matVector2 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._matVector3 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._color1 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_COLOR_SIZE); + this._color2 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_COLOR_SIZE); + const alpha = this._alpha = utils.allocateTyped(Float32Array, instanceCount); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().fill(alpha, 1.0); + this.setAttribute('matVector1', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._matVector1, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('matVector2', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._matVector2, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('matVector3', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._matVector3, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._color1, Instanced2CCylindersGeometry_COLOR_SIZE, false, 1)); + this.setAttribute('color2', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._color2, Instanced2CCylindersGeometry_COLOR_SIZE, false, 1)); + this.setAttribute('alphaColor', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._alpha, 1, false, 1)); + if (useZSprites) { + this._invmatVector1 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._invmatVector2 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._invmatVector3 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this.setAttribute('invmatVector1', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._invmatVector1, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('invmatVector2', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._invmatVector2, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('invmatVector3', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute(this._invmatVector3, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + } + } +} +/* harmony default export */ const geometries_Instanced2CCylindersGeometry = (Instanced2CCylindersGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/ExtrudedObjectsGeometry.js + + + +const ExtrudedObjectsGeometry_VEC_SIZE = 3; +const TRI_SIZE = 3; +const tmpPrev = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +const tmpNext = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +const tmpRes = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +const simpleNormal = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1.0, 0.0, 0.0); +const normalOnCut = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +const nearRingPt = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +function _createExtrudedChunkGeometry(shape, ringsCount) { + const geo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry(); + const ptsCount = shape.length; + const totalPts = ptsCount * ringsCount; + const type = totalPts <= 65536 ? Uint16Array : Uint32Array; + const facesPerChunk = (ringsCount - 1) * ptsCount * 2; + const indices = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(utils.allocateTyped(type, facesPerChunk * TRI_SIZE), 1); + let currVtxIdx = 0; + let currFaceIdx = 0; + for (let y = 0; y < ringsCount; y++) { + // faces + if (y !== ringsCount - 1) { + for (let i = 0; i < ptsCount; i++) { + const v1 = currVtxIdx + i; + const v2 = currVtxIdx + ptsCount + i; + const v3 = currVtxIdx + ptsCount + (i + 1) % ptsCount; + const v4 = currVtxIdx + (i + 1) % ptsCount; + indices.setXYZ(currFaceIdx * TRI_SIZE, v1, v4, v2); + currFaceIdx++; + indices.setXYZ(currFaceIdx * TRI_SIZE, v2, v4, v3); + currFaceIdx++; + } + } + currVtxIdx += ptsCount; + } + geo.setIndex(indices); + const pos = utils.allocateTyped(Float32Array, totalPts * ExtrudedObjectsGeometry_VEC_SIZE); + geo.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(pos, ExtrudedObjectsGeometry_VEC_SIZE)); + geo._positions = shape; + return geo; +} +class ExtrudedObjectsGeometry extends geometries_ChunkedObjectsGeometry { + constructor(shape, ringsCount, chunksCount) { + const chunkGeo = _createExtrudedChunkGeometry(shape, ringsCount); + super(chunkGeo, chunksCount); + this._ringsCount = ringsCount; + const tmpShape = this._tmpShape = []; + for (let i = 0; i < shape.length; ++i) { + tmpShape[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + } + } + setItem(itemIdx, matrices) { + let hasSlope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + let hasCut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + const ptsCount = this._chunkGeo._positions.length; + const ringsCount = this._ringsCount; + const chunkStartIdx = ptsCount * this._ringsCount * itemIdx * ExtrudedObjectsGeometry_VEC_SIZE; + this._setPoints(matrices, ptsCount, ringsCount, chunkStartIdx); + if (hasSlope) { + this._setSlopeNormals(ptsCount, ringsCount, chunkStartIdx); + } else { + this._setBaseNormals(ptsCount, ringsCount, chunkStartIdx); + } + if (hasCut) { + this._addCut(ptsCount, ringsCount, chunkStartIdx); + } + } + _setPoints(matrices, ptsCount, ringsCount, chunkStartIdx) { + const tmpShape = this._tmpShape; + const positions = this._positions; + const shape = this._chunkGeo._positions; + for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i) { + const mtx = matrices[i]; + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + tmpShape[j].copy(shape[j]).applyMatrix4(mtx).toArray(positions, vtxIdx); } } - }; - - Picker.prototype.dispose = function () { - for (var i = 0; i < this._listeners.length; i++) { - var l = this._listeners[i]; - l.obj.removeEventListener(l.type, l.handler); + } + _setBaseNormals(ptsCount, ringsCount, chunkStartIdx) { + const nPtsInRing = ptsCount * ExtrudedObjectsGeometry_VEC_SIZE; + for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i, vtxIdx += nPtsInRing) { + this._countNormalsInRing(ptsCount, vtxIdx, false); } - }; - - var Axes = /*#__PURE__*/function () { - function Axes(target, targetCamera) { - classCallCheck(this, Axes); + } + _setSlopeNormals(ptsCount, ringsCount, chunkStartIdx) { + const normals = this._normals; + const nPtsInRing = ptsCount * ExtrudedObjectsGeometry_VEC_SIZE; + let vtxIdx = chunkStartIdx; + // First ring + // In all cases, besides cut, second ring is coincident to first. So values of first ring's normals doesn't + // matter (In the cut case special handler will be applied later and will set them to correct values) + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + simpleNormal.toArray(normals, vtxIdx); + } + // second ring + // If it isn't first Item we take normals' values from the last ring of the previous item (these rings are coincident) + // else we count normals' values based on next ring information + if (vtxIdx - 2 * nPtsInRing > 0) { + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + tmpRes.fromArray(normals, vtxIdx - 2 * nPtsInRing).toArray(normals, vtxIdx); + } + } else { + this._countNormalsInRing(ptsCount, vtxIdx, true, +nPtsInRing); + vtxIdx += nPtsInRing; + } + // other rings + // we count normals' values based on previous ring information + for (let i = 2; i < ringsCount; ++i, vtxIdx += nPtsInRing) { + this._countNormalsInRing(ptsCount, vtxIdx, true, -nPtsInRing); + } + } - this._target = target; - this._targetCamera = targetCamera; - this._camera = new THREE.PerspectiveCamera(targetCamera.fov, targetCamera.aspect, 1, 100); - this._object = new THREE.AxesHelper(1); - this._scene = new THREE.Scene(); + // Counting normals: + // - Slope + // Radius changes throught part => normals aren't parallel with the plane contains section points + // normal = vTangentInSectionPlane x vToSuchPointInPrevSection (all vectors are scaled for being 1 in length) + // - No slope + // Radius doesn't change throught part => normals are parallel with the plane contains section points + // normal = vToPrevPointInSection + vToNextPointInSection (all vectors are scaled for being 1 in length) + _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) { + const tmpShape = this._tmpShape; + const normals = this._normals; + tmpShape[0].fromArray(this._positions, vtxIdx); + tmpShape[ptsCount - 1].fromArray(this._positions, vtxIdx + (ptsCount - 1) * ExtrudedObjectsGeometry_VEC_SIZE); + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + if (j < ptsCount - 1) { + tmpShape[j + 1].fromArray(this._positions, vtxIdx + ExtrudedObjectsGeometry_VEC_SIZE); + } + if (isSlope) { + nearRingPt.fromArray(this._positions, vtxIdx + shiftToExtraPt); + tmpPrev.subVectors(tmpShape[(j + ptsCount - 1) % ptsCount], tmpShape[(j + 1) % ptsCount]).normalize(); + tmpNext.subVectors(tmpShape[j], nearRingPt).normalize(); + tmpRes.crossVectors(tmpNext, tmpPrev).normalize().toArray(normals, vtxIdx); + } else { + tmpPrev.subVectors(tmpShape[j], tmpShape[(j + ptsCount - 1) % ptsCount]).normalize(); + tmpNext.subVectors(tmpShape[j], tmpShape[(j + 1) % ptsCount]).normalize(); + tmpRes.addVectors(tmpPrev, tmpNext).normalize().toArray(normals, vtxIdx); + } + } + } + _addCut(ptsCount, ringsCount, chunkStartIdx) { + // Nothing to do if item is flat or only line + if (ptsCount < 3 || ringsCount < 2) { + return; + } + const positions = this._positions; + const normals = this._normals; + const tmpShape = this._tmpShape; + const nPtsInRing = ptsCount * ExtrudedObjectsGeometry_VEC_SIZE; + + // Normal to the cut plane is equal to cross product of two vectors which are lying in it + tmpShape[0].fromArray(positions, chunkStartIdx); + tmpShape[1].fromArray(positions, chunkStartIdx + ExtrudedObjectsGeometry_VEC_SIZE); + tmpShape[2].fromArray(positions, chunkStartIdx + 2 * ExtrudedObjectsGeometry_VEC_SIZE); + tmpPrev.subVectors(tmpShape[1], tmpShape[0]).normalize(); + tmpNext.subVectors(tmpShape[1], tmpShape[2]).normalize(); + normalOnCut.crossVectors(tmpPrev, tmpNext).normalize(); + let vtxIdx = chunkStartIdx; + // First and second rings normals' values are equal to value of normal to the cutting plane + for (let j = 0; j < ptsCount * 2; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + normalOnCut.toArray(normals, vtxIdx); + } + if (ringsCount > 2) { + // Third ring points are coincident to first ring points, but have different normals. It makes sharp angle near cut + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + tmpRes.fromArray(positions, vtxIdx - nPtsInRing).toArray(positions, vtxIdx); + } + } + } +} +/* harmony default export */ const geometries_ExtrudedObjectsGeometry = (ExtrudedObjectsGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/ThickLinesGeometry.js + + + +const ThickLinesGeometry_MAX_IDC_16BIT = 65535; +const VERTEX_PER_SEGMENT = 4; +const POS_SIZE = 4; +const DIR_SIZE = 3; +const COL_SIZE = 3; +const ThickLinesGeometry_tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(); +const direction = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +function ThickLinesGeometry_setArrayXYZ(arr, idx, x, y, z) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; +} +function ThickLinesGeometry_setArrayXYZW(arr, idx, x, y, z, w) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; + arr[idx + 3] = w; +} +function getSubset(arr, startSegmentIdx, segmentsCount, elemSize) { + const start = startSegmentIdx * VERTEX_PER_SEGMENT; + const end = start + segmentsCount * VERTEX_PER_SEGMENT; + return arr.subarray(start * elemSize, end * elemSize); +} + +/** + * This class represents lines geometry which consists of screen-aligned narrow quad of variable width. + * + * @constructor + * + * @param {number} segmentsCount Number of segments per chunk. + * collision geometry. + */ + +class ThickLinesGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry { + constructor(segmentsCount) { + super(); + this._initVertices(segmentsCount); + } + startUpdate() { + return true; + } + finishUpdate() { + this.getAttribute('position').needsUpdate = true; + this.getAttribute('color').needsUpdate = true; + this.getAttribute('alphaColor').needsUpdate = true; + this.getAttribute('direction').needsUpdate = true; + } + setColor(segmentIdx, colorVal) { + ThickLinesGeometry_tmpColor.set(colorVal); + let idx = segmentIdx * VERTEX_PER_SEGMENT * COL_SIZE; + ThickLinesGeometry_setArrayXYZ(this._colors, idx, ThickLinesGeometry_tmpColor.r, ThickLinesGeometry_tmpColor.g, ThickLinesGeometry_tmpColor.b); + idx += COL_SIZE; + ThickLinesGeometry_setArrayXYZ(this._colors, idx, ThickLinesGeometry_tmpColor.r, ThickLinesGeometry_tmpColor.g, ThickLinesGeometry_tmpColor.b); + idx += COL_SIZE; + ThickLinesGeometry_setArrayXYZ(this._colors, idx, ThickLinesGeometry_tmpColor.r, ThickLinesGeometry_tmpColor.g, ThickLinesGeometry_tmpColor.b); + idx += COL_SIZE; + ThickLinesGeometry_setArrayXYZ(this._colors, idx, ThickLinesGeometry_tmpColor.r, ThickLinesGeometry_tmpColor.g, ThickLinesGeometry_tmpColor.b); + } + setSegment(segmentIdx, pos1, pos2) { + direction.subVectors(pos1, pos2); + direction.normalize(); + const positions = this._positions; + const directions = this._directions; + let idx = segmentIdx * VERTEX_PER_SEGMENT * POS_SIZE; + let dirIdx = segmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE; + ThickLinesGeometry_setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, 0.5); + ThickLinesGeometry_setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z); + idx += POS_SIZE; + dirIdx += DIR_SIZE; + ThickLinesGeometry_setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, -0.5); + ThickLinesGeometry_setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z); + idx += POS_SIZE; + dirIdx += DIR_SIZE; + ThickLinesGeometry_setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, 0.5); + ThickLinesGeometry_setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z); + idx += POS_SIZE; + dirIdx += DIR_SIZE; + ThickLinesGeometry_setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, -0.5); + ThickLinesGeometry_setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z); + } + setOpacity(startSegIdx, endSegIdx, value) { + const start = startSegIdx * VERTEX_PER_SEGMENT; + const end = endSegIdx * VERTEX_PER_SEGMENT; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().fill(this.alpha, value, end, start); + this.getAttribute('alphaColor').needsUpdate = true; + } + getSubsetSegments(startSegmentIdx, segmentsCount) { + return [getSubset(this._positions, startSegmentIdx, segmentsCount, POS_SIZE), getSubset(this._directions, startSegmentIdx, segmentsCount, DIR_SIZE)]; + } + getSubsetColors(startSegmentIdx, segmentsCount) { + return getSubset(this._colors, startSegmentIdx, segmentsCount, COL_SIZE); + } + getSubsetOpacities(startSegmentIdx, segmentsCount) { + return getSubset(this._alpha, startSegmentIdx, segmentsCount, 1); + } + getNumVertexPerSegment() { + return VERTEX_PER_SEGMENT; + } + getPositionSize() { + return POS_SIZE; + } + setSegments(startSegmentIdx, positions) { + const startPos = startSegmentIdx * VERTEX_PER_SEGMENT * POS_SIZE; + if (positions instanceof Array && positions.length === 2) { + this._positions.set(positions[0], startPos); + const startDir = startSegmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE; + this._directions.set(positions[1], startDir); // dirs are geo part of vertex + } else { + this._positions.set(positions, startPos); + } + } + setColors(startSegmentIdx, colors) { + const start = startSegmentIdx * VERTEX_PER_SEGMENT * COL_SIZE; + this._colors.set(colors, start); + } + _initVertices(segmentsCount) { + this._buffersSize = segmentsCount * VERTEX_PER_SEGMENT; + const pointsCount = this._buffersSize; + const use32bitIndex = pointsCount > ThickLinesGeometry_MAX_IDC_16BIT; + this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, segmentsCount * 6); + this._positions = utils.allocateTyped(Float32Array, pointsCount * POS_SIZE); + this._colors = utils.allocateTyped(Float32Array, pointsCount * COL_SIZE); + this._directions = utils.allocateTyped(Float32Array, pointsCount * DIR_SIZE); + const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().fill(alpha, 1.0); + const index = this._index; + let indexOffset = 0; + let pointOffset = 0; + for (let j = 0; j < segmentsCount; j++, indexOffset += 6, pointOffset += VERTEX_PER_SEGMENT) { + index[indexOffset] = pointOffset; + index[indexOffset + 1] = pointOffset + 1; + index[indexOffset + 2] = pointOffset + 3; + index[indexOffset + 3] = pointOffset; + index[indexOffset + 4] = pointOffset + 2; + index[indexOffset + 5] = pointOffset + 3; + } + this.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._index, 1)); + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._positions, POS_SIZE)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._colors, COL_SIZE)); + this.setAttribute('alphaColor', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(alpha, 1)); + this.setAttribute('direction', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._directions, DIR_SIZE)); + } +} +/* harmony default export */ const geometries_ThickLinesGeometry = (ThickLinesGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/LinesGeometry.js - this._scene.add(this._object); - this._full = new THREE.Vector2(); - this._update(); +/** + * This class represents geometry which consists lines. This can build bounding volumes + * @constructor + * + * @param {number} segmentsCount Number of segments per chunk. + */ +class LinesGeometry extends geometries_ThickLinesGeometry { + startUpdate() { + return true; + } + computeBoundingSphere() { + const { + boundingBox + } = this; + // Build bounding sphere + let radiusSquared = 0.0; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + if (boundingBox) { + boundingBox.getCenter(center); + } + const positions = this._positions; + const sphere = this.boundingSphere || new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Sphere(); + const size = this._positions.length; + const pos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const posSize = this.getPositionSize(); + for (let i = 0; i < size; i += posSize) { + pos.set(positions[i], positions[i + 1], positions[i + 2]); + const lengthSquared = center.distanceToSquared(pos); + if (radiusSquared < lengthSquared) { + radiusSquared = lengthSquared; + } } + sphere.set(center, Math.sqrt(radiusSquared)); + this.boundingSphere = sphere; + } + computeBoundingBox() { + const positions = this._positions; + const box = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(); + const size = this._positions.length; + const tmpVec = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const posSize = this.getPositionSize(); + for (let i = 0; i < size; i += posSize) { + tmpVec.set(positions[i], positions[i + 1], positions[i + 2]); + box.expandByPoint(tmpVec); + } + this.boundingBox = box; + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } +} +/* harmony default export */ const geometries_LinesGeometry = (LinesGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/CylinderCollisionGeo.js - createClass(Axes, [{ - key: "_update", - value: function _update() { - var fov = this._targetCamera.fov; - var camera = this._camera; - camera.aspect = this._targetCamera.aspect; - camera.setMinimalFov(fov); - camera.setDistanceToFit(1.0, fov); - camera.updateProjectionMatrix(); - this._object.quaternion.copy(this._target.quaternion); - } - }, { - key: "render", - value: function render(renderer) { - this._update(); - - renderer.getSize(this._full); - var width = this._full.width * 0.25; - var height = this._full.height * 0.25; - var autoClear = renderer.autoClear; - renderer.autoClear = false; - renderer.setViewport(0.0, 0.0, width, height); - renderer.clear(false, true, false); - renderer.render(this._scene, this._camera); - renderer.setViewport(0, 0, this._full.width, this._full.height); - renderer.autoClear = autoClear; - } - }]); - return Axes; - }(); - var cDataOffset = 12; - var cFirstMask = 0x0FFFFF00; - var cFirstShift = 8; - var cSecMask1 = 0x000000FF; - var cSecShift1 = 12; - var cSecMask2 = 0xFFF00000; - var cSecShift2 = 20; - var cThirdMask = 0x000FFFFF; - var cStrMask = 0xF0000000; - var cStrShift = 28; - var c219 = 1 << 19; - var c220 = 1 << 20; - var cHelixIdx = 1; - var cSheetIdx = 2; - var secTypes = ['helix', 'strand']; - var cSecNames = ['fs', 'ps', 'ns', 'us']; - - function _createSecondary(strArray, complex) { - var residues = complex._residues; - var nRes = residues.length; - var resid = new Uint8Array(nRes); - var atoms = complex._atoms; - - for (var i = 0, n = strArray.length; i < n; ++i) { - var atom = atoms[i]; - resid[atom.residue._index] = strArray[i]; - } - - var secondary = []; - var rIdx = 0; - - while (rIdx < nRes) { - if (resid[rIdx] !== 0) { - var start = rIdx; - var val = resid[rIdx]; - - while (rIdx < nRes - 1 && resid[rIdx + 1] === val && residues[rIdx].isConnected(residues[rIdx + 1])) { - ++rIdx; - } - - secondary.push({ - start: start, - end: rIdx, - type: secTypes[val - 1] - }); +const CylinderCollisionGeo_VEC_SIZE = 3; +const CylinderCollisionGeo_tmpVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +const CylinderCollisionGeo_normMtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix3(); +class CylinderCollisionGeo extends geometries_ChunkedObjectsGeometry { + constructor(instanceCount, polyComplexity) { + const cylGeometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true); + super(cylGeometry, instanceCount); + const chunkSize = this._chunkSize; + this._chunkPos = this._chunkGeo.attributes.position.array; + this._chunkNorms = this._chunkGeo.attributes.normal.array; + this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * CylinderCollisionGeo_VEC_SIZE); + } + setItem(itemIdx, botPos, topPos, itemRad) { + const chunkSize = this._chunkSize; + const itemOffset = chunkSize * itemIdx * CylinderCollisionGeo_VEC_SIZE; + const tmpArray = this._tmpVector; + const geoPos = this._chunkPos; + const geoNorm = this._chunkNorms; + const mtx1 = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad); + CylinderCollisionGeo_normMtx.getNormalMatrix(mtx1); + let idx; + for (let i = 0; i < chunkSize; ++i) { + idx = i * CylinderCollisionGeo_VEC_SIZE; + CylinderCollisionGeo_tmpVector.fromArray(geoPos, idx); + CylinderCollisionGeo_tmpVector.applyMatrix4(mtx1); + CylinderCollisionGeo_tmpVector.toArray(tmpArray, idx); + } + this._positions.set(tmpArray, itemOffset); + for (let i = 0; i < chunkSize; ++i) { + idx = i * CylinderCollisionGeo_VEC_SIZE; + CylinderCollisionGeo_tmpVector.fromArray(geoNorm, idx); + CylinderCollisionGeo_tmpVector.applyMatrix3(CylinderCollisionGeo_normMtx); + CylinderCollisionGeo_tmpVector.toArray(tmpArray, idx); + } + this._normals.set(tmpArray, itemOffset); + } +} +/* harmony default export */ const geometries_CylinderCollisionGeo = (CylinderCollisionGeo); +;// CONCATENATED MODULE: ./src/gfx/geometries/ChunkedLinesGeometry.js + + +const COLLISION_RAD = 0.1; + +/** + * This class represents geometry which consists of separate chunks. + * Each chunk has same index and similar geometry with equal points and faces count. + * Each chunk has by default only one color. + * @constructor + * + * @param {number} chunksCount Total chunks count. + * @param {number} segmentsCount Number of segments per chunk. + * @param {boolean} enableCollision Enable or disable collision where each segment is + * a collidable cylinder. + * collision geometry. + */ +class ChunkedLinesGeometry extends geometries_LinesGeometry { + constructor(chunksCount, segmentsCount, enableCollision) { + super(chunksCount * segmentsCount); + this._init(segmentsCount); + this._collisionGeo = enableCollision ? new geometries_CylinderCollisionGeo(chunksCount * segmentsCount, 3) : null; + } + startUpdate() { + return true; + } + computeBoundingSphere() { + const collisionGeo = this._collisionGeo; + if (collisionGeo) { + collisionGeo.computeBoundingSphere(); + this.boundingSphere = collisionGeo.boundingSphere; + return; + } + super.computeBoundingSphere(); + } + computeBoundingBox() { + const collisionGeo = this._collisionGeo; + if (collisionGeo) { + collisionGeo.computeBoundingBox(); + this.boundingBox = collisionGeo.boundingBox; + return; + } + super.computeBoundingBox(); + } + raycast(raycaster, intersects) { + const collisionGeo = this._collisionGeo; + if (!collisionGeo) { + return; + } + const segCount = this._chunkSize; + this._collisionGeo.raycast(raycaster, intersects); + for (let i = 0, n = intersects.length; i < n; ++i) { + let { + chunkIdx + } = intersects[i]; + if (chunkIdx === undefined) { + continue; } - - ++rIdx; + chunkIdx = chunkIdx / segCount | 0; + intersects[i].chunkIdx = chunkIdx; } - - return secondary; } - - function fromUInt20ToInt20(uint20) { - return uint20 >= c219 ? uint20 - c220 : uint20; + setColor(chunkIdx, colorVal) { + const chunkSize = this._chunkSize; + for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) { + super.setColor(i, colorVal); + } + } + setSegment(chunkIdx, segIdx, pos1, pos2) { + const chunkSize = this._chunkSize; + const idx = chunkIdx * chunkSize + segIdx; + super.setSegment(idx, pos1, pos2); + if (this._collisionGeo) { + this._collisionGeo.setItem(chunkIdx * chunkSize + segIdx, pos1, pos2, COLLISION_RAD); + } + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + setOpacity(chunkIndices, value) { + const chunkSize = this._chunkSize; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const left = chunkIndices[i] * chunkSize; + super.setOpacity(left, left + chunkSize - 1, value); + } + } + getSubset(chunkIndices) { + const instanceCount = chunkIndices.length; + const chunkSize = this._chunkSize; + const subset = new ChunkedLinesGeometry(instanceCount, chunkSize, false); + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const dstPtOffset = i * chunkSize; + const startSegIdx = chunkIndices[i] * chunkSize; + subset.setSegments(dstPtOffset, this.getSubsetSegments(startSegIdx, chunkSize)); + subset.setColors(dstPtOffset, this.getSubsetColors(startSegIdx, chunkSize)); + } + subset.boundingSphere = this.boundingSphere; + subset.boundingBox = this.boundingBox; + return [subset]; } + _init(chunkSize) { + this._chunkSize = chunkSize; + } +} +/* harmony default export */ const geometries_ChunkedLinesGeometry = (ChunkedLinesGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/TwoColorLinesGeometry.js - var FrameInfo = /*#__PURE__*/function () { - function FrameInfo(complex, payload, callbacks) { - classCallCheck(this, FrameInfo); - this._complex = complex; - this._secondary = null; - this.isLoading = false; - this._framesRange = { - start: 0, - end: -1 - }; - this.frameIsReady = false; - this._buffer = null; - this._frameRequest = null; - this._callbacks = callbacks; - - if (typeof payload === 'function') { - this._framesRequestLength = 1; - this._downloadDataFn = payload; - } else { - this.parseBinaryData(payload, true); - } - this.reset(); - this.setFrame(0); +const TwoColorLinesGeometry_COLLISION_RAD = 0.3; +const TwoColorLinesGeometry_tmpVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +class TwoColorLinesGeometry extends geometries_LinesGeometry { + constructor(segmentsCount) { + super(segmentsCount * 2); + this._init(segmentsCount); + this._collisionGeo = new geometries_Simple2CCylindersGeometry(segmentsCount, 3); + } + setItem(itemIdx, botPos, topPos) { + this._collisionGeo.setItem(itemIdx, botPos, topPos, TwoColorLinesGeometry_COLLISION_RAD); + const offset = 2 * itemIdx; // there are two points per segment + TwoColorLinesGeometry_tmpVector.lerpVectors(botPos, topPos, 0.5); + super.setSegment(offset, botPos, TwoColorLinesGeometry_tmpVector); + super.setSegment(offset + 1, TwoColorLinesGeometry_tmpVector, topPos); + } + setColor(itemIdx, colorVal1, colorVal2) { + const offset = 2 * itemIdx; // there are two points per segment + super.setColor(offset, colorVal1); + super.setColor(offset + 1, colorVal2); + } + raycast(raycaster, intersects) { + if (this._collisionGeo) { + this._collisionGeo.raycast(raycaster, intersects); } + } + getSubset(segmentIndices) { + const instanceCount = segmentIndices.length; + const subset = new TwoColorLinesGeometry(instanceCount, false); + for (let i = 0, n = instanceCount; i < n; ++i) { + const startSegIdx = segmentIndices[i]; + subset.setSegments(i, this.getSubsetSegments(startSegIdx, 1)); + subset.setColors(i, this.getSubsetColors(startSegIdx, 1)); + } + subset.boundingSphere = this.boundingSphere; + subset.boundingBox = this.boundingBox; + return [subset]; + } + _init(segmentsCount) { + this._segCounts = segmentsCount * 2; + } +} +// (???)parent = LinesGeometry.prototype; - createClass(FrameInfo, [{ - key: "_prepareBuffer", - value: function _prepareBuffer(framesStart, framesEnd) { - if (framesStart === undefined || framesStart === null) { - framesStart = 0; - } - - if (framesEnd === undefined || framesEnd === null) { - framesEnd = framesStart + this._framesRequestLength; - } +/* harmony default export */ const geometries_TwoColorLinesGeometry = (TwoColorLinesGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/CrossGeometry.js - if (this._framesCount !== undefined) { - framesEnd = Math.min(this._framesCount - 1, framesEnd); - } - if (this._downloadDataFn) { - var self = this; - var onDone = function onDone(data) { - self.isLoading = false; +const vectors = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1, 0, 0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-1, 0, 0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 1, 0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, -1, 0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, -1)]; +const vecCount = vectors.length; +const tempPos1 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +const tempPos2 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); +class CrossGeometry extends geometries_SphereCollisionGeo(geometries_ChunkedLinesGeometry) { + constructor(chunksCount) { + super(chunksCount, chunksCount, vecCount / 2 | 0, false); + } + setItem(itemIdx, itemPos, itemRad) { + this.setSphere(itemIdx, itemPos, itemRad); + for (let i = 0; i < vecCount / 2; ++i) { + const first = i * 2; + tempPos1.x = itemPos.x + vectors[first].x * itemRad; + tempPos1.y = itemPos.y + vectors[first].y * itemRad; + tempPos1.z = itemPos.z + vectors[first].z * itemRad; + const second = first + 1; + tempPos2.x = itemPos.x + vectors[second].x * itemRad; + tempPos2.y = itemPos.y + vectors[second].y * itemRad; + tempPos2.z = itemPos.z + vectors[second].z * itemRad; + this.setSegment(itemIdx, i, tempPos1, tempPos2); + } + } +} +/* harmony default export */ const geometries_CrossGeometry = (CrossGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurfaceGeometry.js + + +const POS_RAD_SIZE = 4; +const IsoSurfaceGeometry_COLOR_SIZE = 3; +const IsoSurfaceGeometry_tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(); + +/** + * This is a base class for isosurface algorithms. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor + */ +class IsoSurfaceGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry { + constructor(spheresCount, opts) { + super(); + this._opts = opts; + this.zClip = this._opts.zClip; + this._posRad = utils.allocateTyped(Float32Array, spheresCount * POS_RAD_SIZE); + this._colors = utils.allocateTyped(Float32Array, spheresCount * IsoSurfaceGeometry_COLOR_SIZE); + } + setItem(chunkIdx, pos, radius) { + const posRad = this._posRad; + let idx = POS_RAD_SIZE * chunkIdx; + posRad[idx++] = pos.x; + posRad[idx++] = pos.y; + posRad[idx++] = pos.z; + posRad[idx] = radius; + } + setColor(chunkIdx, colorVal) { + IsoSurfaceGeometry_tmpColor.set(colorVal); + const colors = this._colors; + let idx = IsoSurfaceGeometry_COLOR_SIZE * chunkIdx; + colors[idx++] = IsoSurfaceGeometry_tmpColor.r; + colors[idx++] = IsoSurfaceGeometry_tmpColor.g; + colors[idx] = IsoSurfaceGeometry_tmpColor.b; + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + finishUpdate() { + this._build(); + } + setOpacity() { + // not implemented + } + raycast() {} + getSubset() { + return []; + } +} +/* harmony default export */ const geometries_IsoSurfaceGeometry = (IsoSurfaceGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurfaceMarchCube.js + + +/** + * Class for marching cube + * Stores 8 points and 8 float values are stored together in linear array + * Int values for has intersection or not - in integer32 linear array + * Int values for bits flags - in integer32 linear array + * + */ +class IsoSurfaceMarchCube { + constructor() { + this.pointsValuesLinear = null; + this.hasIntersection = null; + this.bitsInside = null; + } + create(numCellsPerSide) { + const vx7000000 = 0x7000000; + const n3 = numCellsPerSide * numCellsPerSide * numCellsPerSide; + if (n3 > vx7000000) { + throw new Error('Too large cube dimension: lead to memory huge uasge'); + } + this.pointsValuesLinear = utils.allocateTyped(Float32Array, (2 << 2 + 2) * n3); + this.hasIntersection = utils.allocateTyped(Int32Array, n3); + this.bitsInside = utils.allocateTyped(Int32Array, n3); + return 0; + } + destroy() { + this.bitsInside = null; + this.hasIntersection = null; + this.pointsValuesLinear = null; + } +} - if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') { - self._callbacks.onLoadStatusChanged(); - } +/* eslint-disable no-magic-numbers */ +IsoSurfaceMarchCube.prototype.striIndicesMarchCube = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1, 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1, 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1, 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1, 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1, 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1, 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1, 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1, 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1, 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1, 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1, 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1, 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1, 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1, 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1, 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1, 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1, 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1, 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1, 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1, 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1, 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1, 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1, 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1, 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1, 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1, 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1, 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1, 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1, 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1, 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1, 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1, 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1, 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1, 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1, 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1, 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1, 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1, 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1, 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1, 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1, 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1, 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1, 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1, 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1, 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1, 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1, 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1, 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1, 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1, 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1, 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1, 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1, 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1, 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1, 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1, 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1, 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1, 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1, 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1, 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1, 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1, 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1, 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1, 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1, 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1, 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1, 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1, 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1, 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1, 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1, 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1, 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1, 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1, 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1, 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1, 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1, 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1, 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1, 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1, 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1, 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1, 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1, 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1, 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1, 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1, 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1, 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1, 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1, 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1, 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1, 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1, 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1, 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1, 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1, 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1, 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1, 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1, 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1, 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1, 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1, 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1, 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1, 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1, 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1, 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1, 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1, 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1, 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; +/* eslint-enable no-magic-numbers */ - self._buffer = { - data: data, - state: 'ready', - start: framesStart, - end: framesEnd - }; +/* harmony default export */ const geometries_IsoSurfaceMarchCube = (IsoSurfaceMarchCube); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurface.js - if (self._frameRequest !== null) { - var idx = self._frameRequest; - self._frameRequest = null; - self.setFrame(idx); - } - }; - var onFail = function onFail() { - self.isLoading = false; - if (self._callbacks && typeof self._callbacks.onError === 'function') { - self._callbacks.onError('Streaming failed'); - } - }; +const edgeTable = [0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0]; +function _voxelGradientFast(v, point, grad) { + const g = v.getValue(point.x, point.y, point.z); + grad.set(g[0], g[1], g[2]); +} - if (!this._buffer) { - this._buffer = {}; - } +// Helper class GridCell +class GridCell { + constructor() { + this._arrSize = 8; + this.p = new Array(this._arrSize); + this.g = new Array(this._arrSize); + this.val = new Array(this._arrSize); + for (let i = 0; i < this._arrSize; ++i) { + this.p[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this.g[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + } + this.cubeIndex = 0; + } +} - this._buffer.state = 'downloading'; - this.isLoading = true; +// Helper class Triangle +class Triangle { + constructor() { + this.a = { + p: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(), + n: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3() + }; + this.b = { + p: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(), + n: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3() + }; + this.c = { + p: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(), + n: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3() + }; + } +} +function createArray(arrSize) { + const arr = new Array(arrSize); + for (let i = 0; i < arrSize; ++i) { + arr[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + } + return arr; +} +class IsoSurface { + constructor() { + this._numTriangles = 0; + this._numVertices = 0; + this._position = []; + this._normals = []; + this._colors = null; + this._indices = []; + this._volumetricData = null; + this._xAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._yAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._zAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._xDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._yDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._zDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + } + _prepareAxesAndDirs() { + const volData = this._volumetricData; + const cellSize = volData.getCellSize(); + + // calculate cell axes + const xAxis = this._xAxis; + const yAxis = this._yAxis; + const zAxis = this._zAxis; + const xDir = this._xDir; + const yDir = this._yDir; + const zDir = this._zDir; + xAxis.set(cellSize.x, 0, 0); + yAxis.set(0, cellSize.y, 0); + zAxis.set(0, 0, cellSize.z); + xDir.set(1, 0, 0); + yDir.set(0, 1, 0); + zDir.set(0, 0, 1); + + // flip normals if coordinate system is in the wrong handedness + const tmp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + tmp.crossVectors(xDir, yDir); + if (tmp.dot(zDir) < 0) { + xDir.negate(); + yDir.negate(); + zDir.negate(); + } + + // check that the grid is in the all-positive octant of the coordinate system + if (xDir.x < 0 || xDir.y < 0 || xDir.z < 0 || yDir.x < 0 || yDir.y < 0 || yDir.z < 0 || zDir.x < 0 || zDir.y < 0 || zDir.z < 0) { + return false; + } - if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') { - self._callbacks.onLoadStatusChanged(); + // check that the grid is axis-aligned + const notZero = axe => Math.abs(axe) > Number.EPSILON; + return !(notZero(xAxis.y) || notZero(xAxis.z) || notZero(yAxis.x) || notZero(yAxis.z) || notZero(zAxis.x) || notZero(zAxis.y)); + } + _vertexInterp(isoLevel, grid, ind1, ind2, vertex, normal) { + const p1 = grid.p[ind1]; + const p2 = grid.p[ind2]; + const n1 = grid.g[ind1]; + const n2 = grid.g[ind2]; + const valP1 = grid.val[ind1]; + const valP2 = grid.val[ind2]; + const isoDiffP1 = isoLevel - valP1; + const diffValP2P1 = valP2 - valP1; + let mu = 0.0; + if (Math.abs(diffValP2P1) > 0.0) { + mu = isoDiffP1 / diffValP2P1; + } + mu = mu > 1.0 ? 1.0 : mu; + vertex.lerpVectors(p1, p2, mu); + normal.lerpVectors(n1, n2, mu); + } + static _triTable = (() => geometries_IsoSurfaceMarchCube.prototype.striIndicesMarchCube)(); + static _arrSize = 12; + static _firstIndices = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3]; + static _secondIndices = [1, 2, 3, 0, 5, 6, 7, 4, 4, 5, 6, 7]; + static _vertexList = (() => createArray(IsoSurface._arrSize))(); + static _normalList = (() => createArray(IsoSurface._arrSize))(); + _polygonize(grid, isoLevel, triangles) { + const { + cubeIndex + } = grid; + let i = 0; + const arrSize = IsoSurface._arrSize; + const firstIndices = IsoSurface._firstIndices; + const secondIndices = IsoSurface._secondIndices; + const vertexList = IsoSurface._vertexList; + const normalList = IsoSurface._normalList; + for (; i < arrSize; ++i) { + if (edgeTable[cubeIndex] & 1 << i) { + this._vertexInterp(isoLevel, grid, firstIndices[i], secondIndices[i], vertexList[i], normalList[i]); + } + } + let triCount = 0; + const triTblIdx = cubeIndex * 16; + const triTable = IsoSurface._triTable; + for (i = 0; triTable[triTblIdx + i] !== -1; i += 3) { + triangles[triCount].a.p.copy(vertexList[triTable[triTblIdx + i]]); + triangles[triCount].a.n.copy(normalList[triTable[triTblIdx + i]]); + triangles[triCount].b.p.copy(vertexList[triTable[triTblIdx + i + 1]]); + triangles[triCount].b.n.copy(normalList[triTable[triTblIdx + i + 1]]); + triangles[triCount].c.p.copy(vertexList[triTable[triTblIdx + i + 2]]); + triangles[triCount].c.n.copy(normalList[triTable[triTblIdx + i + 2]]); + ++triCount; + } + return triCount; + } + _doGridPosNorms(isoValue, step, appendSimple) { + const vol = this._volumetricData; + const volData = this._volumetricData.getData(); + const dim = vol.getDimensions(); + const xSize = dim[0]; + const ySize = dim[1]; + const zSize = dim[2]; + const stepX = step * vol.getStrideX(); + const stepY = step * vol.getStrideY(); + const stepZ = step * vol.getStrideZ(); + const gc = new GridCell(); + const gcVal = gc.val; + const gcValSize = gc.val.length; + const additions = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0), + // 0 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(step, 0, 0), + // 1 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(step, step, 0), + // 2 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, step, 0), + // 3 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, step), + // 4 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(step, 0, step), + // 5 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(step, step, step), + // 6 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, step, step) // 7 + ]; + const tmpTriCount = 5; + const triangles = new Array(tmpTriCount); + for (let j = 0; j < tmpTriCount; ++j) { + triangles[j] = new Triangle(); + } + let appendVertex; + const self = this; + const positions = this._position; + const normals = this._normals; + if (appendSimple) { + // Special case for axis-aligned grid with positive unit vector normals + appendVertex = function () { + const axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(self._xAxis.x, self._yAxis.y, self._zAxis.z); + return function (triVertex) { + const vertex = triVertex.p.clone(); + vertex.multiply(axis); + positions.push(vertex.add(self._origin)); + normals.push(triVertex.n.clone()); + }; + }(); + } else { + appendVertex = function () { + const posMtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix3(); + posMtx.set(self._xAxis.x, self._yAxis.x, self._zAxis.x, self._xAxis.y, self._yAxis.y, self._zAxis.y, self._xAxis.z, self._yAxis.z, self._zAxis.z); + const normMtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix3(); + normMtx.set(self._xDir.x, self._yDir.x, self._zDir.x, self._xDir.y, self._yDir.y, self._zDir.y, self._xDir.z, self._yDir.z, self._zDir.z); + return function (triVertex) { + positions.push(triVertex.p.clone().applyMatrix3(posMtx).add(self._origin)); + normals.push(triVertex.n.clone().applyMatrix3(normMtx)); + }; + }(); + } + const indices = this._indices; + let globTriCount = 0; + for (let z = 0; z < zSize - step; z += step) { + for (let y = 0; y < ySize - step; y += step) { + let idx = vol.getDirectIdx(0, y, z); + for (let x = 0; x < xSize - step; x += step, idx += stepX) { + /* eslint-disable no-multi-spaces */ + /* eslint-disable computed-property-spacing */ + gcVal[0] = volData[idx]; + gcVal[1] = volData[idx + stepX]; + gcVal[3] = volData[idx + stepY]; + gcVal[2] = volData[idx + stepX + stepY]; + gcVal[4] = volData[idx + stepZ]; + gcVal[5] = volData[idx + stepX + stepZ]; + gcVal[7] = volData[idx + stepY + stepZ]; + gcVal[6] = volData[idx + stepX + stepY + stepZ]; + /* eslint-enable no-multi-spaces */ + /* eslint-enable computed-property-spacing */ + + // Determine the index into the edge table which + // tells us which vertices are inside of the surface + let cubeIndex = 0; + let i = 0; + for (; i < gcValSize; ++i) { + if (gcVal[i] < isoValue) { + cubeIndex |= 1 << i; + } + } + if (edgeTable[cubeIndex] === 0) { + continue; } - - this._downloadDataFn({ - start: framesStart, - end: framesEnd + 1 - }, onDone, onFail); - } - } - }, { - key: "_parseBuffer", - value: function _parseBuffer() { - if (this._buffer && this._buffer.state === 'ready') { - this._framesRange = { - start: this._buffer.start, - end: this._buffer.end - }; - this.parseBinaryData(this._buffer.data, false); - - var _bufferRequestStart = (this._buffer.end + 1) % this._framesCount; - - if (_bufferRequestStart >= this._framesCount) { - _bufferRequestStart = 0; + gc.cubeIndex = cubeIndex; + for (i = 0; i < gcValSize; ++i) { + gc.p[i].set(x + additions[i].x, y + additions[i].y, z + additions[i].z); + _voxelGradientFast(this._gradient, gc.p[i], gc.g[i]); } - this._buffer = { - state: 'none' - }; - - this._prepareBuffer(_bufferRequestStart, _bufferRequestStart + this._framesRequestLength); + // calculate vertices and facets for this cube, + // calculate normals by interpolating between the negated + // normalized volume gradients for the 8 reference voxels + const triCount = this._polygonize(gc, isoValue, triangles); + globTriCount += triCount; - if (this._frameRequest !== null) { - var idx = this._frameRequest; - this._frameRequest = null; - this.setFrame(idx); + // append triangles using different techniques + for (i = 0; i < triCount; ++i) { + indices.push(this._numTriangles * 3); + indices.push(this._numTriangles * 3 + 1); + indices.push(this._numTriangles * 3 + 2); + ++this._numTriangles; + appendVertex(triangles[i].a); + appendVertex(triangles[i].b); + appendVertex(triangles[i].c); } } } - }, { - key: "parseBinaryData", - value: function parseBinaryData(arrayBuffer) { - var dataView = new DataView(arrayBuffer); - var offset = 0; - var atomsCount = dataView.getUint32(offset, true); - offset += 4; - var framesCount = dataView.getUint32(offset, true); - this._framesCount = framesCount; - this._framesRange.end = this._framesRange.end > 0 ? Math.min(this._framesRange.end, framesCount - 1) : framesCount - 1; - offset += 4; - this._atomsCount = atomsCount; - var maxSize = 1024 * 1024; // 1 MB - - this._framesRequestLength = Math.ceil(maxSize / (atomsCount * 8)); - var chunkedFramesCount = this._framesRange.end - this._framesRange.start + 1; - - if (atomsCount !== this._complex._atoms.length || arrayBuffer.byteLength !== cDataOffset + chunkedFramesCount * atomsCount * 8) { - throw new Error(); - } - - var complex = this._complex; - var timeStep = dataView.getUint32(offset, true); - var iName = 0; - - while (timeStep > 1000 && iName < cSecNames.length - 1) { - timeStep /= 1000; - ++iName; - } - - this._timeStep = "".concat(timeStep.toString(), " ").concat(cSecNames[iName]); - offset += 4; - var secondary = []; - var posData = new Float32Array(chunkedFramesCount * atomsCount * 3); - var coordIdx = 0; - var secondaryArr = new Int8Array(atomsCount); - - for (var j = 0; j < chunkedFramesCount; ++j) { - for (var i = 0; i < atomsCount; ++i) { - var hiWord = dataView.getUint32(offset, true); - offset += 4; - var loWord = dataView.getUint32(offset, true); - offset += 4; - var str = (loWord & cStrMask) >>> cStrShift; - var x = fromUInt20ToInt20((loWord & cFirstMask) >>> cFirstShift >> 0); - var y = fromUInt20ToInt20(((loWord & cSecMask1) << cSecShift1 | (hiWord & cSecMask2) >>> cSecShift2) >> 0); - var z = fromUInt20ToInt20((hiWord & cThirdMask) >> 0); - secondaryArr[i] = 0; - - if (str > 0 && str < 4) { - secondaryArr[i] = cHelixIdx; - } else if (str === 4) { - secondaryArr[i] = cSheetIdx; - } - - posData[coordIdx++] = x / 100; - posData[coordIdx++] = y / 100; - posData[coordIdx++] = z / 100; - } - - secondary.push(_createSecondary(secondaryArr, complex)); + } + return globTriCount; + } + compute(volData, origin, isoValue, step) { + this._volumetricData = volData; + this._origin = origin; + this._gradient = volData.computeGradient(); + this._doGridPosNorms(isoValue, step, this._prepareAxesAndDirs()); + } + _remapIndices(vertexMap, idcCount) { + const indices = this._indices; + const newIndices = utils.allocateTyped(Uint32Array, idcCount); + for (let i = 0; i < idcCount; ++i) { + indices[i] = vertexMap[indices[i]]; + newIndices[i] = indices[i]; + } + this._indices = newIndices; + } + _remapVertices(vertices, normals, count) { + const newPositions = utils.allocateTyped(Float32Array, count * 3); + const newNormals = utils.allocateTyped(Float32Array, count * 3); + for (let i = 0; i < count; ++i) { + const pos = vertices[i]; + newPositions[i * 3] = pos.x; + newPositions[i * 3 + 1] = pos.y; + newPositions[i * 3 + 2] = pos.z; + const norm = normals[i].normalize(); + newNormals[i * 3] = norm.x; + newNormals[i * 3 + 1] = norm.y; + newNormals[i * 3 + 2] = norm.z; + } + this._position = newPositions; + this._normals = newNormals; + } + vertexFusion(offset, len) { + const faceVer = this._indices.length; + const vertices = this._position; + const normals = this._normals; + const oldVerCount = vertices.length | 0; + if (faceVer === 0 || oldVerCount === 0) { + return; + } + const vMap = utils.allocateTyped(Uint32Array, oldVerCount); + vMap[0] = 0; + let newVer = 1; + let i = 1; + for (; i < oldVerCount; ++i) { + const start = newVer - offset < 0 ? 0 : newVer - offset; + const end = start + len > newVer ? newVer : start + len; + let matchedIndex = -1; + for (let j = start; j < end; ++j) { + if (Math.abs(vertices[i] - vertices[j]) < Number.EPSILON) { + matchedIndex = j; + break; } - - this._secondaryData = secondary; - this._data = posData; - } - }, { - key: "nextFrame", - value: function nextFrame() { - this.setFrame((this._currFrame + 1) % this._framesCount); - } - }, { - key: "needsColorUpdate", - value: function needsColorUpdate(colorer) { - return colorer instanceof SecondaryStructureColorer; - } - }, { - key: "getAtomColor", - value: function getAtomColor(colorer, atom) { - return colorer.getResidueColor(this._residues[atom.residue._index], this._complex); } - }, { - key: "getResidueColor", - value: function getResidueColor(colorer, residue) { - return colorer.getResidueColor(this._residues[residue._index], this._complex); + if (matchedIndex !== -1) { + vMap[i] = matchedIndex; + } else { + vertices[newVer].copy(vertices[i]); + normals[newVer].copy(normals[i]); + vMap[i] = newVer; + ++newVer; } - }, { - key: "_updateSecondary", - value: function _updateSecondary() { - var i; - var myResidues = this._residues; - var n = myResidues.length; - - for (i = 0; i < n; ++i) { - myResidues[i]._secondary = null; - } - - var sec = this._secondaryData[this._currFrame - this._framesRange.start]; - - for (i = 0, n = sec.length; i < n; ++i) { - var oldSec = sec[i]; - var start = oldSec.start, - end = oldSec.end; - var nSec = { - _start: myResidues[start], - _end: myResidues[end], - type: oldSec.type, - generic: oldSec.generic - }; + } + this._remapIndices(vMap, faceVer); + this._remapVertices(vertices, normals, newVer); + } - for (var j = start; j <= end; ++j) { - myResidues[j]._secondary = nSec; - } + // Assign per-vertex colors from a volumetric texture map (same dimensions as the original volumetric data). + // Along with color dominating atom is determined for each vertex + // and vertices with atom out of "visible" subset get filtered out. + // XXX only handles orthogonal volumes currently + setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) { + let i; + let idx; + const numVerts = this._position.length / 3; + const vertices = this._position; + const origin = this._origin; + const dim = this._volumetricData.getDimensions(); + const xs = dim[0] - 1; + const ys = dim[1] - 1; + const zs = dim[2] - 1; + const colorData = colorMap.getData(); + const strideX = colorMap.getStrideX(); + const strideY = colorMap.getStrideY(); + const strideZ = colorMap.getStrideZ(); + let atomWeightData; + let atomStrideX; + let atomStrideY; + let atomStrideZ; + if (visibilitySelector !== null) { + atomWeightData = atomWeightMap.getData(); + atomStrideX = atomWeightMap.getStrideX(); + atomStrideY = atomWeightMap.getStrideY(); + atomStrideZ = atomWeightMap.getStrideZ(); + } + const xInv = 1.0 / this._xAxis.x; + const yInv = 1.0 / this._yAxis.y; + const zInv = 1.0 / this._zAxis.z; + let atomLookup = []; + let atomWeights = []; + const colors = utils.allocateTyped(Float32Array, numVerts * 3); + function interp(mu, idx1, idx2, c) { + c[0] = (1 - mu) * colorData[idx1] + mu * colorData[idx2]; + c[1] = (1 - mu) * colorData[idx1 + 1] + mu * colorData[idx2 + 1]; + c[2] = (1 - mu) * colorData[idx1 + 2] + mu * colorData[idx2 + 2]; + } + function collectWeight(ai, coefX, coefY, coefZ) { + const a = atomMap[ai]; // atomWeightMap is a scalar field, so index into atom map should be the same + if (a != null) { + atomLookup[a.index] = a; + const w = coefX * coefY * coefZ * atomWeightData[ai]; + if (typeof atomWeights[a.index] === 'undefined') { + atomWeights[a.index] = w; + } else { + atomWeights[a.index] += w; + } + } + } + const vMap = utils.allocateTyped(Int32Array, numVerts); + let newVerCount = 0; + for (i = 0; i < numVerts; i++) { + const ind = i * 3; + const vx = (vertices[ind] - origin.x) * xInv; + const vy = (vertices[ind + 1] - origin.y) * yInv; + const vz = (vertices[ind + 2] - origin.z) * zInv; + const x = Math.min(Math.max(vx, 0), xs) | 0; + const y = Math.min(Math.max(vy, 0), ys) | 0; + const z = Math.min(Math.max(vz, 0), zs) | 0; + const mux = vx - x; + const muy = vy - y; + const muz = vz - z; + if (visibilitySelector != null) { + // collect atom weights + atomLookup = []; + atomWeights = []; + idx = atomWeightMap.getDirectIdx(x, y, z); + collectWeight(idx, 1 - mux, 1 - muy, 1 - muz); + collectWeight(idx + atomStrideX, mux, 1 - muy, 1 - muz); + collectWeight(idx + atomStrideY, 1 - mux, muy, 1 - muz); + collectWeight(idx + atomStrideX + atomStrideY, mux, muy, 1 - muz); + collectWeight(idx + atomStrideZ, 1 - mux, 1 - muy, muz); + collectWeight(idx + atomStrideX + atomStrideZ, mux, 1 - muy, muz); + collectWeight(idx + atomStrideY + atomStrideZ, 1 - mux, muy, muz); + collectWeight(idx + atomStrideX + atomStrideY + atomStrideZ, mux, muy, muz); + + // find dominant atom + let maxWeight = 0.0; + let dominantIdx = -1; + for (const atomIdx in atomWeights) { + if (atomWeights[atomIdx] > maxWeight) { + dominantIdx = atomIdx; + maxWeight = atomWeights[atomIdx]; + } + } + if (dominantIdx < 0 || !visibilitySelector.includesAtom(atomLookup[dominantIdx])) { + // this vertex doesn't belong to visible subset and will be skipped + vMap[i] = -1; + continue; } } - }, { - key: "reset", - value: function reset() { - var compRes = this._complex._residues; - var n = compRes.length; - this._residues = new Array(n); - var myResidues = this._residues; - - var getSec = function getSec() { - return this._secondary; - }; - - for (var i = 0; i < n; ++i) { - myResidues[i] = { - _type: compRes[i]._type, - _isValid: compRes[i]._isValid, - _controlPoint: null, - _wingVector: null, - _secondary: null, - getSecondary: getSec - }; + vMap[i] = newVerCount++; + + // color tri-linear interpolation + const dx = x < xs ? strideX : 0; + const dy = y < ys ? strideY : 0; + const dz = z < zs ? strideZ : 0; + const c0 = [0, 0, 0]; + const c1 = [0, 0, 0]; + const c2 = [0, 0, 0]; + const c3 = [0, 0, 0]; + idx = colorMap.getDirectIdx(x, y, z); + interp(mux, idx, idx + dx, c0); + interp(mux, idx + dy, idx + dx + dy, c1); + interp(mux, idx + dz, idx + dx + dz, c2); + interp(mux, idx + dy + dz, idx + dx + dy + dz, c3); + const cz0 = [0, 0, 0]; + cz0[0] = (1 - muy) * c0[0] + muy * c1[0]; + cz0[1] = (1 - muy) * c0[1] + muy * c1[1]; + cz0[2] = (1 - muy) * c0[2] + muy * c1[2]; + const cz1 = [0, 0, 0]; + cz1[0] = (1 - muy) * c2[0] + muy * c3[0]; + cz1[1] = (1 - muy) * c2[1] + muy * c3[1]; + cz1[2] = (1 - muy) * c2[2] + muy * c3[2]; + colors[ind] = (1 - muz) * cz0[0] + muz * cz1[0]; + colors[ind + 1] = (1 - muz) * cz0[1] + muz * cz1[1]; + colors[ind + 2] = (1 - muz) * cz0[2] + muz * cz1[2]; + } + this._colors = colors; + if (visibilitySelector != null) { + // shift visible vertices towards beginning of array + for (i = 0; i < numVerts; ++i) { + const j = vMap[i]; + if (j < 0) { + continue; } + + // assert: j <= i + this._position[j * 3] = this._position[i * 3]; + this._position[j * 3 + 1] = this._position[i * 3 + 1]; + this._position[j * 3 + 2] = this._position[i * 3 + 2]; + this._normals[j * 3] = this._normals[i * 3]; + this._normals[j * 3 + 1] = this._normals[i * 3 + 1]; + this._normals[j * 3 + 2] = this._normals[i * 3 + 2]; + this._colors[j * 3] = this._colors[i * 3]; + this._colors[j * 3 + 1] = this._colors[i * 3 + 1]; + this._colors[j * 3 + 2] = this._colors[i * 3 + 2]; } - }, { - key: "setFrame", - value: function setFrame(frameIdx) { - this.frameIsReady = false; - if (frameIdx >= this._framesRange.start && frameIdx <= this._framesRange.end) { - this._currFrame = frameIdx; - this._cachedResidues = false; + // rebuild index list + const numTriangles = this._indices.length / 3; + let newTriCount = 0; + for (i = 0; i < numTriangles; ++i) { + const i0 = vMap[this._indices[3 * i]]; + const i1 = vMap[this._indices[3 * i + 1]]; + const i2 = vMap[this._indices[3 * i + 2]]; + if (i0 >= 0 && i1 >= 0 && i2 >= 0) { + this._indices[3 * newTriCount] = i0; + this._indices[3 * newTriCount + 1] = i1; + this._indices[3 * newTriCount + 2] = i2; + ++newTriCount; + } + } - this._updateSecondary(); + // shrink arrays to data size + this._position = new Float32Array(this._position.buffer.slice(0, newVerCount * 3 * 4)); + this._normals = new Float32Array(this._normals.buffer.slice(0, newVerCount * 3 * 4)); + this._colors = new Float32Array(this._colors.buffer.slice(0, newVerCount * 3 * 4)); + this._indices = new Uint32Array(this._indices.buffer.slice(0, newTriCount * 3 * 4)); + } + } + toMesh() { + const geo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry(); + geo.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._indices, 1)); + geo.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._position, 3)); + geo.setAttribute('normal', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._normals, 3)); + geo.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(this._colors, 3)); + geo.computeBoundingSphere(); + return geo; + } +} +/* harmony default export */ const geometries_IsoSurface = (IsoSurface); +;// CONCATENATED MODULE: ./src/gfx/geometries/VolumeSurfaceGeometry.js - this.frameIsReady = true; - } else { - this._frameRequest = frameIdx; - if (!this._buffer) { - this._prepareBuffer(frameIdx); - } else { - var self = this; - switch (this._buffer.state) { - case 'none': - this._prepareBuffer(frameIdx); - break; - case 'ready': - self._parseBuffer(); +/** + * This is a base class for volumetric maps based isosurface algorithms. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor + */ - break; - } - } - } - } - }, { - key: "disableEvents", - value: function disableEvents() { - this._callbacks = null; +class VolumeSurfaceGeometry extends geometries_IsoSurfaceGeometry { + _build() { + const params = this._opts; + this.numVoxels = [128, 128, 128]; + this.xAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1.0, 0.0, 0.0); + this.yAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 1.0, 0.0); + this.zAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 1.0); + this.origin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0); + this._visibilitySelector = params.visibilitySelector; + this._calcSurface(params); + } + _findMinMax(posRadArray) { + const itemSize = 4; + const itemsCount = posRadArray.length / itemSize; + const maxPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]]; + const minPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]]; + for (let i = 1; i < itemsCount; ++i) { + const ind = i * itemSize; + for (let itemIdx = 0; itemIdx < itemSize; ++itemIdx) { + const tmpVal = posRadArray[ind + itemIdx]; + maxPosRad[itemIdx] = Math.max(tmpVal, maxPosRad[itemIdx]); + minPosRad[itemIdx] = Math.min(tmpVal, minPosRad[itemIdx]); } - /** - * Returns link to atom pos vector, clone it if needed - */ + } + return { + maxPosRad, + minPosRad + }; + } + _findNumVoxels(posRadArray, params) { + const { + numVoxels + } = this; + const minMaxValues = this._findMinMax(posRadArray); + const minCoordRad = minMaxValues.minPosRad; + const maxCoordRad = minMaxValues.maxPosRad; + + // minrad + if (minCoordRad[3] > 4.0) { + params.gridSpacing *= minCoordRad[3]; + } + let gridPadding = params.radScale * maxCoordRad[3] * 1.7; + let padRad = gridPadding; + padRad = 0.65 * Math.sqrt(4.0 / 3.0 * Math.PI * padRad * padRad * padRad); + gridPadding = Math.max(gridPadding, padRad); + let i = 0; + for (; i < 3; ++i) { + minCoordRad[i] -= gridPadding; + maxCoordRad[i] += gridPadding; + } + for (i = 0; i < 3; ++i) { + numVoxels[i] = Math.ceil((maxCoordRad[i] - minCoordRad[i]) / params.gridSpacing); + } + this.xAxis.x = (numVoxels[0] - 1) * params.gridSpacing; + this.yAxis.y = (numVoxels[1] - 1) * params.gridSpacing; + this.zAxis.z = (numVoxels[2] - 1) * params.gridSpacing; + [this.origin.x, this.origin.y, this.origin.z] = minCoordRad; + return { + bbox: minMaxValues, + dim: numVoxels + }; + } + _makeSurface(surface, params) { + const isoSurf = new geometries_IsoSurface(); + isoSurf.compute(surface.volMap, this.origin, params.isoValue, 1); + isoSurf.vertexFusion(9, 9); // normalization is included + + if (isoSurf._numTriangles > 0) { + isoSurf.setColorVolTex(surface.volTexMap, surface.atomMap, surface.atomWeightMap, this._visibilitySelector); + this.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(isoSurf._indices, 1)); + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(isoSurf._position, 3)); + this.setAttribute('normal', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(isoSurf._normals, 3)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(isoSurf._colors, 3)); + } else { + // geometry should have at least empty position attributes to be processed in wireframe mode by three.js + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(utils.allocateTyped(Float32Array, 0), 3)); + } + } + _calcSurface(params) { + const packedArrays = { + posRad: this._posRad, + colors: this._colors, + atoms: this._opts.atoms + }; + if (packedArrays.posRad.length === 0) { + return; + } + const boundaries = this._findNumVoxels(packedArrays.posRad, params); + const box = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(this.origin, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(this.xAxis.x, this.yAxis.y, this.zAxis.z).add(this.origin)); + const surface = this._computeSurface(packedArrays, box, boundaries, params); + this._makeSurface(surface, params); + } +} +/* harmony default export */ const geometries_VolumeSurfaceGeometry = (VolumeSurfaceGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/QuickSurfGeometry.js + + +const { + Volume: QuickSurfGeometry_Volume +} = chem; + +/** + * This class implements 'quick' isosurface geometry generation algorithm. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor + */ + +class QuickSurfGeometry extends geometries_VolumeSurfaceGeometry { + _computeSurface(packedArrays, box, boundaries, params) { + // beware of shifting this multiple times! + this._shiftByOrigin(packedArrays.posRad); + const surface = { + volMap: new QuickSurfGeometry_Volume(Float32Array, this.numVoxels, box), + volTexMap: new QuickSurfGeometry_Volume(Float32Array, this.numVoxels, box, 3) + }; + if (this._visibilitySelector != null) { + surface.atomMap = []; + surface.atomWeightMap = new QuickSurfGeometry_Volume(Float32Array, this.numVoxels, box); + } + this.gaussdensity(surface, packedArrays, null, params); + return surface; + } + gaussdensity(surface, packedArrays, atomicNum, params) { + const numAtoms = packedArrays.posRad.length / 4; + const { + posRad, + colors + } = packedArrays; + const { + numVoxels + } = this; + const { + radScale, + gaussLim, + gridSpacing + } = params; + const invIsoValue = 1.0 / params.isoValue; + const invGridSpacing = 1.0 / gridSpacing; + const maxVoxelX = numVoxels[0] - 1; + const maxVoxelY = numVoxels[1] - 1; + const maxVoxelZ = numVoxels[2] - 1; + // TODO is densityMap and volTexMap initialized? + + const { + volMap, + volTexMap + } = surface; + const volData = volMap.getData(); + const strideX = volMap.getStrideX(); + const volTexData = volTexMap.getData(); + const texStrideX = volTexMap.getStrideX(); + let atomWeightData; + if (this._visibilitySelector != null) { + atomWeightData = surface.atomWeightMap.getData(); + } + const { + atomMap + } = surface; + for (let i = 0; i < numAtoms; ++i) { + const ind = i * 4; + const scaledRad = posRad[ind + 3] * radScale; + const atomicNumFactor = atomicNum === null ? 1.0 : atomicNum[i]; + const radInv = 1 / (2 * scaledRad * scaledRad); + let radLim = gaussLim * scaledRad; + const radLim2 = radLim * radLim; + radLim *= invGridSpacing; + let tmp = posRad[ind] * invGridSpacing; + const xMin = Math.max(tmp - radLim | 0, 0); + const xMax = Math.min(tmp + radLim | 0, maxVoxelX); + tmp = posRad[ind + 1] * invGridSpacing; + const yMin = Math.max(tmp - radLim | 0, 0); + const yMax = Math.min(tmp + radLim | 0, maxVoxelY); + tmp = posRad[ind + 2] * invGridSpacing; + const zMin = Math.max(tmp - radLim | 0, 0); + const zMax = Math.min(tmp + radLim | 0, maxVoxelZ); + let dz = zMin * gridSpacing - posRad[ind + 2]; + for (let z = zMin; z <= zMax; ++z, dz += gridSpacing) { + let dy = yMin * gridSpacing - posRad[ind + 1]; + for (let y = yMin; y <= yMax; ++y, dy += gridSpacing) { + const dy2dz2 = dy * dy + dz * dz; + if (dy2dz2 >= radLim2) { + continue; + } + let addr = volMap.getDirectIdx(xMin, y, z); + let texAddr = volTexMap.getDirectIdx(xMin, y, z); + let dx = xMin * gridSpacing - posRad[ind]; + for (let x = xMin; x <= xMax; ++x, dx += gridSpacing, addr += strideX, texAddr += texStrideX) { + const r2 = dx * dx + dy2dz2; + const expVal = -r2 * radInv; + let density = Math.exp(expVal) * atomicNumFactor; + + // store most relevant atom (with highest density) + if (this._visibilitySelector != null && density > atomWeightData[addr]) { + // NOSONAR + atomWeightData[addr] = density; + // we use same index into atom map and atomWeightMap + atomMap[addr] = packedArrays.atoms[i]; + } + volData[addr] += density; - }, { - key: "getAtomPos", - value: function getAtomPos(atomIdx) { - var vec = FrameInfo._vec; - var self = this; - var data = self._data; - var idx = (self._atomsCount * (self._currFrame - self._framesRange.start) + atomIdx) * 3; - vec.set(data[idx], data[idx + 1], data[idx + 2]); - return vec; - } - }, { - key: "getResidues", - value: function getResidues() { - if (this._cachedResidues) { - return this._residues; + // TODO check for volTexMap routine? + density *= invIsoValue; + const colInd = i * 3; + volTexData[texAddr] += density * colors[colInd]; + volTexData[texAddr + 1] += density * colors[colInd + 1]; + volTexData[texAddr + 2] += density * colors[colInd + 2]; + } } - - this._complex.updateToFrame(this); - - return this._residues; } - }]); - - return FrameInfo; - }(); + } + } + _shiftByOrigin(posRadArray) { + const originX = this.origin.x; + const originY = this.origin.y; + const originZ = this.origin.z; + const itemSize = 4; + const itemsCount = posRadArray.length / itemSize; + for (let i = 0; i < itemsCount; ++i) { + const ind = i * itemSize; + posRadArray[ind] -= originX; + posRadArray[ind + 1] -= originY; + posRadArray[ind + 2] -= originZ; + } + } +} +/* harmony default export */ const geometries_QuickSurfGeometry = (QuickSurfGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/ContactSurface.js + + + +/** + * Modifed from SpatialHash + * + * Main differences are: + * - Optimized grid size to ensure we only ever need to look +/-1 cell + * - Aware of atomic radii and will only output atoms within rAtom + rExtra + * (see withinRadii method) + * + * (Uses rounding rather than bitshifting as consequence of arbitrary grid size) + * @class + * @param {Float32Array} posRad - x, y, z coordinates and radiuses + * @param {Float32Array} min - xyz min coordinates + * @param {Float32Array} max - xyz max coordinates + * @param {number} maxDistance - max distance + */ +function AVHash(posRad, min, max, maxDistance) { + const itemSize = 4; + const nAtoms = posRad.length / itemSize; + const minX = min[0]; + const minY = min[1]; + const minZ = min[2]; + const maxX = max[0]; + const maxY = max[1]; + const maxZ = max[2]; + function hashFunc(w, minW) { + return Math.floor((w - minW) / maxDistance); + } + const iDim = hashFunc(maxX, minX) + 1; + const jDim = hashFunc(maxY, minY) + 1; + const kDim = hashFunc(maxZ, minZ) + 1; + const nCells = iDim * jDim * kDim; + const jkDim = jDim * kDim; + + /* Get cellID for cartesian x,y,z */ + const cellID = function (x, y, z) { + return (hashFunc(x, minX) * jDim + hashFunc(y, minY)) * kDim + hashFunc(z, minZ); + }; + + /* Initial building, could probably be optimized further */ + const preHash = []; + let i; + let cid; + for (i = 0; i < nAtoms; i++) { + const iIdx = itemSize * i; + cid = cellID(posRad[iIdx], posRad[iIdx + 1], posRad[iIdx + 2]); + if (preHash[cid] === undefined) { + preHash[cid] = [i]; + } else { + preHash[cid].push(i); + } + } + const cellOffsets = utils.allocateTyped(Uint32Array, nCells); + const cellLengths = utils.allocateTyped(Uint16Array, nCells); + const data = utils.allocateTyped(Uint32Array, nAtoms); + let offset = 0; + let maxCellLength = 0; + let j; + for (i = 0; i < nCells; i++) { + const start = cellOffsets[i] = offset; + const subArray = preHash[i]; + if (subArray !== undefined) { + for (j = 0; j < subArray.length; j++) { + data[offset] = subArray[j]; + offset++; + } + } + const cellLength = offset - start; + cellLengths[i] = cellLength; + if (cellLength > maxCellLength) { + maxCellLength = cellLength; + } + } - defineProperty(FrameInfo, "_vec", new THREE.Vector3()); + // Maximum number of neighbours we could ever produce (27 adjacent cells of equal population) + this.neighbourListLength = 27 * maxCellLength + 1; /** - * Create new scene object. + * Populate the supplied out array with atom indices that are within rAtom + rExtra + * of x,y,z * - * @param {array=} params - Object required params. - * @param {object=} opts - Options to override defaults with. + * -1 in out array indicates the end of the list * - * These options are copied locally and not kept by reference, so the created instance will not reflect further - * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation. - * - * @exports SceneObject - * @this SceneObject - * @abstract - * @constructor - * @classdesc Basic class for all scene objects that are not reps. + * @param {number} x - x coordinate + * @param {number} y - y coordinate + * @param {number} z - z coordinate + * @param {number} rExtra - additional radius + * @param {Float32Array} out - pre-allocated output array + * @return {undefined} */ - - var SceneObject = /*#__PURE__*/function () { - function SceneObject(params, opts) { - classCallCheck(this, SceneObject); - - if (this.constructor === SceneObject) { - throw new Error('Can not instantiate abstract class!'); - } - /** - * Object's options inherited (prototyped) from defaults. - * @type {object} - */ - - - this.params = params; - this.opts = _.merge(utils.deriveDeep(settings.now.objects[this.type], true), opts); - this.needsRebuild = false; - this._mesh = null; - this.id = null; - } - /** - * Get object identification, probably with options. - * @returns {Object} field type contains type information, params - object's formal parameters, - * opts - changed options - * Options are returned if they were changed during or after object creation. - */ - - - createClass(SceneObject, [{ - key: "identify", - value: function identify() { - var result = { - type: this.type, - params: this.params - }; - var diff = utils.objectsDiff(this.opts, settings.now.modes[this.id]); - - if (!_.isEmpty(diff)) { - result.opts = diff; + this.withinRadii = function (x, y, z, rExtra, out) { + let outIdx = 0; + const nearI = hashFunc(x, minX); + const nearJ = hashFunc(y, minY); + const nearK = hashFunc(z, minZ); + const loI = Math.max(0, nearI - 1); + const loJ = Math.max(0, nearJ - 1); + const loK = Math.max(0, nearK - 1); + const hiI = Math.min(iDim - 1, nearI + 1); + const hiJ = Math.min(jDim - 1, nearJ + 1); + const hiK = Math.min(kDim - 1, nearK + 1); + for (i = loI; i <= hiI; ++i) { + const iOffset = i * jkDim; + for (j = loJ; j <= hiJ; ++j) { + const jOffset = j * kDim; + for (let k = loK; k <= hiK; ++k) { + cid = iOffset + jOffset + k; + const cellStart = cellOffsets[cid]; + const cellEnd = cellStart + cellLengths[cid]; + for (let dataIndex = cellStart; dataIndex < cellEnd; dataIndex++) { + const atomIndex = data[dataIndex]; + const baseIndex = itemSize * atomIndex; + const dx = posRad[baseIndex] - x; + const dy = posRad[baseIndex + 1] - y; + const dz = posRad[baseIndex + 2] - z; + const rSum = posRad[baseIndex + 3] + rExtra; + if (dx * dx + dy * dy + dz * dz <= rSum * rSum) { + out[outIdx++] = data[dataIndex]; + } + } } - - return result; } - }, { - key: "toString", - value: function toString() { - var paramsStr = "o=".concat(this.type, ",").concat(this.params.join(',')); - var optsStr = utils.compareOptionsWithDefaults(this.opts, settings.defaults.objects[this.type]); - return paramsStr + optsStr; + } + // Add terminator + out[outIdx] = -1; + }; +} +function ContactSurface(packedArrays, boundaries, params, _indexList) { + // Field generation method adapted from AstexViewer (Mike Hartshorn) + // by Fred Ludlow. + // Other parts based heavily on NGL (Alexander Rose) EDT Surface class + // + // Should work as a drop-in alternative to EDTSurface (though some of + // the EDT paramters are not relevant in this method). + + const itemSize = 4; + const { + posRad, + colors, + atoms + } = packedArrays; + const nAtoms = posRad.length / itemSize; + const { + bbox + } = boundaries; + const min = bbox.minPosRad; + const max = bbox.maxPosRad; + let r2; // Atom positions, expanded radii (squared) + let maxRadius; + + // Parameters + let probeRadius; + let scaleFactor; + let probePositions; + + // Cache last value for obscured test + let lastClip = -1; + + // Grid params + let dim; + let grid; + let volTex; + let weights; + let weightsMap = null; + let atomMap = null; + let visibilitySelector = null; + + // grid indices -> xyz coords + let gridx; + let gridy; + let gridz; + + // Lookup tables: + let sinTable; + let cosTable; + + // Spatial Hash + let hash; + + // Neighbour array to be filled by hash + let neighbours; + + // Vectors for Torus Projection + const mid = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0); + const n1 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0); + const n2 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0); + let ngTorus; + function uniformArray(TypeName, n, a) { + const array = utils.allocateTyped(TypeName, n); + for (let innI = 0; innI < n; ++innI) { + array[innI] = a; + } + return array; + } + function fillGridDim(a, start, step) { + for (let innI = 0; innI < a.length; innI++) { + a[innI] = start + step * innI; + } + } + function initializeGrid() { + ({ + scaleFactor + } = params); + ({ + dim + } = boundaries); + ngTorus = Math.min(5, 2 + Math.floor(probeRadius * scaleFactor)); + const gridSize = dim[0] * dim[1] * dim[2]; + grid = uniformArray(Float32Array, gridSize, -1001.0); + volTex = utils.allocateTyped(Float32Array, gridSize * 3); + weights = utils.allocateTyped(Float32Array, gridSize); + if (visibilitySelector) { + weightsMap = utils.allocateTyped(Float32Array, gridSize); + atomMap = []; + } + gridx = utils.allocateTyped(Float32Array, dim[0]); + gridy = utils.allocateTyped(Float32Array, dim[1]); + gridz = utils.allocateTyped(Float32Array, dim[2]); + fillGridDim(gridx, min[0], 1 / scaleFactor); + fillGridDim(gridy, min[1], 1 / scaleFactor); + fillGridDim(gridz, min[2], 1 / scaleFactor); + } + function initializeAngleTables() { + let theta = 0.0; + const step = 2 * Math.PI / probePositions; + cosTable = utils.allocateTyped(Float32Array, probePositions); + sinTable = utils.allocateTyped(Float32Array, probePositions); + for (let innI = 0; innI < probePositions; innI++) { + cosTable[innI] = Math.cos(theta); + sinTable[innI] = Math.sin(theta); + theta += step; + } + } + function initializeHash() { + hash = new AVHash(posRad, min, max, 2.01 * maxRadius); + neighbours = new Int32Array(hash.neighbourListLength); + } + function init() { + ({ + probeRadius, + scaleFactor, + probePositions, + visibilitySelector + } = params); + r2 = utils.allocateTyped(Float32Array, nAtoms); + maxRadius = 0; + for (let innI = 0; innI < nAtoms; ++innI) { + const rExt = posRad[innI * itemSize + 3] += probeRadius; + if (rExt > maxRadius) { + maxRadius = rExt; + } + r2[innI] = rExt * rExt; + } + initializeGrid(); + initializeAngleTables(); + initializeHash(); + lastClip = -1; + } + function singleAtomObscures(ai, innX, innY, innZ) { + const innCI = itemSize * ai; + const ra2 = r2[ai]; + const dx = posRad[innCI] - innX; + const dy = posRad[innCI + 1] - innY; + const dz = posRad[innCI + 2] - innZ; + const d2 = dx * dx + dy * dy + dz * dz; + return d2 < ra2; + } + function obscured(innX, innY, innZ, a, b) { + // Is the point at x,y,z obscured by any of the atoms + // specifeid by indices in neighbours. Ignore indices + // a and b (these are the relevant atoms in projectPoints/Torii) + + // Cache the last clipped atom (as very often the same one in + // subsequent calls) + let ai; + if (lastClip !== -1) { + ai = lastClip; + if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) { + return ai; } - }, { - key: "getGeometry", - value: function getGeometry() { - return this._mesh; + lastClip = -1; + } + let ni = 0; + ai = neighbours[ni]; + while (ai >= 0) { + if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) { + lastClip = ai; + return ai; } - }, { - key: "destroy", - value: function destroy() { - if (this._mesh) { - gfxutils.destroyObject(this._mesh); + ai = neighbours[++ni]; + } + lastClip = -1; + return -1; + } + function projectPoints() { + // For each atom: + // Iterate over a subsection of the grid, for each point: + // If current value < 0.0, unvisited, set positive + // + // In any case: Project this point onto surface of the atomic sphere + // If this projected point is not obscured by any other atom + // Calcualte delta distance and set grid value to minimum of + // itself and delta + + // Should we alias frequently accessed closure constiables?? + // Assume JS engine capable of optimizing this + // anyway... + const maxRad = 4.0; + const sigma = maxRad / 3; + const sigma2Inv = 1 / (2 * sigma * sigma); + for (let innI = 0; innI < nAtoms; innI++) { + const innCI = itemSize * innI; + const ax = posRad[innCI]; + const ay = posRad[innCI + 1]; + const az = posRad[innCI + 2]; + const ar = posRad[innCI + 3]; + const ar2 = r2[innI]; + hash.withinRadii(ax, ay, az, ar, neighbours); + + // Number of grid points, round this up... + const ng = Math.ceil(ar * scaleFactor); + + // Center of the atom, mapped to grid points (take floor) + const iax = Math.floor(scaleFactor * (ax - min[0])); + const iay = Math.floor(scaleFactor * (ay - min[1])); + const iaz = Math.floor(scaleFactor * (az - min[2])); + + // Extents of grid to consider for this atom + const minx = Math.max(0, iax - ng); + const miny = Math.max(0, iay - ng); + const minz = Math.max(0, iaz - ng); + + // Add two to these points: + // - iax are floor'd values so this ensures coverage + // - these are loop limits (exclusive) + const maxx = Math.min(dim[0], iax + ng + 2); + const maxy = Math.min(dim[1], iay + ng + 2); + const maxz = Math.min(dim[2], iaz + ng + 2); + const colIdx = innI * 3; + const cr = colors[colIdx]; + const cg = colors[colIdx + 1]; + const cb = colors[colIdx + 2]; + for (let iz = minz; iz < maxz; iz++) { + const dz = gridz[iz] - az; + const zOffset = dim[1] * dim[0] * iz; + for (let iy = miny; iy < maxy; iy++) { + const dy = gridy[iy] - ay; + const dzy2 = dz * dz + dy * dy; + const zyOffset = zOffset + dim[0] * iy; + for (let ix = minx; ix < maxx; ix++) { + const idx = ix + zyOffset; + const dx = gridx[ix] - ax; + const d2 = dzy2 + dx * dx; + if (d2 < ar2) { + const w = Math.exp(-d2 * sigma2Inv); + const cIdx = idx * 3; + volTex[cIdx] += cr * w; + volTex[cIdx + 1] += cg * w; + volTex[cIdx + 2] += cb * w; + weights[idx] += w; + if (visibilitySelector !== null && w > weightsMap[idx]) { + weightsMap[idx] = w; + atomMap[idx] = atoms[innI]; + } + if (grid[idx] < 0.0) { + // Unvisited, make positive + grid[idx] = -grid[idx]; + } + // Project on to the surface of the sphere + // sp is the projected point ( dx, dy, dz ) * ( ra / d ) + const d = Math.sqrt(d2); + const ap = ar / d; + let spx = dx * ap; + let spy = dy * ap; + let spz = dz * ap; + spx += ax; + spy += ay; + spz += az; + if (obscured(spx, spy, spz, innI, -1) === -1) { + const dd = ar - d; + if (dd < grid[idx]) { + grid[idx] = dd; + } + } + } + } } } - }]); - - return SceneObject; - }(); - /** - * Scene object identifier. - * @type {string} - */ - - - SceneObject.prototype.type = '__'; - - var LinesObj = /*#__PURE__*/function (_SceneObject) { - inherits(LinesObj, _SceneObject); - - function LinesObj(params, opts) { - var _this; - - classCallCheck(this, LinesObj); - - _this = possibleConstructorReturn(this, getPrototypeOf(LinesObj).call(this, params, opts)); - - if (params.length < 2) { - throw new Error('Wrong number of argumets on line object creation!'); - } - - var _params = slicedToArray(params, 2); - - _this._id1 = _params[0]; - _this._id2 = _params[1]; - return _this; } - - createClass(LinesObj, [{ - key: "_getAtomFromName", - value: function _getAtomFromName(complex, atomId) { - var err = ' - Wrong atom format it must be \'#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME\' (e.g. \'A.38.CO1\')'; - var atom1 = complex.getAtomByFullname(atomId); - - if (!atom1) { - throw new Error(atomId + err); + } + function normalToLine(out, p) { + out.x = out.y = out.z = 1.0; + if (p.x !== 0) { + out.x = (p.y + p.z) / -p.x; + } else if (p.y !== 0) { + out.y = (p.x + p.z) / -p.y; + } else if (p.z !== 0) { + out.z = (p.x + p.y) / -p.z; + } + return out; + } + function projectTorus(a, b) { + const aIdx = itemSize * a; + const bIdx = itemSize * b; + const xa = posRad[aIdx]; + const ya = posRad[aIdx + 1]; + const za = posRad[aIdx + 2]; + const r1 = posRad[aIdx + 3]; + let dx = mid.x = posRad[bIdx] - xa; + let dy = mid.y = posRad[bIdx + 1] - ya; + let dz = mid.z = posRad[bIdx + 2] - za; + const innR2 = posRad[bIdx + 3]; + let d2 = dx * dx + dy * dy + dz * dz; + + // This check now redundant as already done in AVHash.withinRadii + // if( d2 > (( r1 + r2 ) * ( r1 + r2 )) ){ return; } + + const d = Math.sqrt(d2); + + // Find angle between a->b vector and the circle + // of their intersection by cosine rule + const cosA = (r1 * r1 + d * d - innR2 * innR2) / (2.0 * r1 * d); + + // distance along a->b at intersection + const dmp = r1 * cosA; + mid.normalize(); + + // Create normal to line + normalToLine(n1, mid); + n1.normalize(); + + // Cross together for second normal vector + n2.crossVectors(mid, n1); + n2.normalize(); + + // r is radius of circle of intersection + const rInt = Math.sqrt(r1 * r1 - dmp * dmp); + n1.multiplyScalar(rInt); + n2.multiplyScalar(rInt); + mid.multiplyScalar(dmp); + mid.x += xa; + mid.y += ya; + mid.z += za; + lastClip = -1; + const ng = ngTorus; + for (let innI = 0; innI < probePositions; innI++) { + const cost = cosTable[innI]; + const sint = sinTable[innI]; + const px = mid.x + cost * n1.x + sint * n2.x; + const py = mid.y + cost * n1.y + sint * n2.y; + const pz = mid.z + cost * n1.z + sint * n2.z; + if (obscured(px, py, pz, a, b) === -1) { + // As above, iterate over our grid... + // px, py, pz in grid coords + const iax = Math.floor(scaleFactor * (px - min[0])); + const iay = Math.floor(scaleFactor * (py - min[1])); + const iaz = Math.floor(scaleFactor * (pz - min[2])); + const minx = Math.max(0, iax - ng); + const miny = Math.max(0, iay - ng); + const minz = Math.max(0, iaz - ng); + const maxx = Math.min(dim[0], iax + ng + 2); + const maxy = Math.min(dim[1], iay + ng + 2); + const maxz = Math.min(dim[2], iaz + ng + 2); + for (let iz = minz; iz < maxz; iz++) { + dz = pz - gridz[iz]; + const zOffset = dim[1] * dim[0] * iz; + for (let iy = miny; iy < maxy; iy++) { + dy = py - gridy[iy]; + const dzy2 = dz * dz + dy * dy; + const zyOffset = zOffset + dim[0] * iy; + for (let ix = minx; ix < maxx; ix++) { + dx = px - gridx[ix]; + d2 = dzy2 + dx * dx; + const idx = ix + zyOffset; + const current = grid[idx]; + if (current > 0.0 && d2 < current * current) { + grid[idx] = Math.sqrt(d2); + } + } + } } - - return atom1; } - }, { - key: "build", - value: function build(complex) { - var geom = new THREE.Geometry(); - this._atom1 = this._getAtomFromName(complex, this._id1); - this._atom2 = this._getAtomFromName(complex, this._id2); - geom.vertices[0] = this._atom1.position.clone(); - geom.vertices[1] = this._atom2.position.clone(); - geom.dynamic = true; - geom.computeBoundingBox(); - this._line = new meshes.Line(geom, new UberMaterial({ - lights: false, - overrideColor: true, - dashedLine: true, - fogTransparent: settings.now.bg.transparent - })); - - this._line.computeLineDistances(); - - this._line.material.setUberOptions({ - fixedColor: new THREE.Color(this.opts.color), - dashedLineSize: this.opts.dashSize, - dashedLinePeriod: this.opts.dashSize + this.opts.gapSize - }); - - this._line.material.updateUniforms(); - - this._line.raycast = function (_raycaster, _intersects) {}; - - this._mesh = this._line; - var transforms = complex.getTransforms(); - - if (transforms.length > 0) { - this._mesh = new THREE.Group(); - - this._mesh.add(this._line); - - gfxutils.applyTransformsToMeshes(this._mesh, transforms); + } + } + function projectTorii() { + for (let innI = 0; innI < nAtoms; innI++) { + const innIdx = itemSize * innI; + hash.withinRadii(posRad[innIdx], posRad[innIdx + 1], posRad[innIdx + 2], posRad[innIdx + 3], neighbours); + let ia = 0; + let ni = neighbours[ia]; + while (ni >= 0) { + if (innI < ni) { + projectTorus(innI, ni); } + ni = neighbours[++ia]; } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - if (!this._atom1 || !this._atom2 || !this._line) { - return; - } - - var geo = this._line.geometry; - geo.vertices[0].copy(frameData.getAtomPos(this._atom1.index)); - geo.vertices[1].copy(frameData.getAtomPos(this._atom2.index)); - - this._line.computeLineDistances(); - - geo.computeBoundingSphere(); - geo.verticesNeedUpdate = true; + } + } + function fixNegatives() { + for (let innI = 0, n = grid.length; innI < n; innI++) { + if (grid[innI] < 0) grid[innI] = 0; + let w = weights[innI]; + if (w > 0) { + w = 1 / w; + const innInnI = innI * 3; + volTex[innInnI] *= w; + volTex[innInnI + 1] *= w; + volTex[innInnI + 2] *= w; } - }]); - - return LinesObj; - }(SceneObject); - - LinesObj.prototype.constructor = LinesObj; - LinesObj.prototype.type = 'line'; - - var fragmentShader$1 = "precision highp float;\r\n\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexSize;\r\nuniform vec2 thickness;\r\nvarying vec2 vUv;\r\n\r\n#ifdef DEPTH_OUTLINE\r\n uniform sampler2D srcDepthTex; //depthTexture\r\n uniform vec3 color;\r\n uniform float threshold;\r\n#endif\r\n\r\nvoid main() {\r\n\r\n vec2 pixelSize = thickness / srcTexSize;\r\n\r\n #ifdef DEPTH_OUTLINE\r\n float c00 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,-pixelSize.y)).x;\r\n float c01 = texture2D(srcDepthTex, vUv + vec2(0,-pixelSize.y)).x;\r\n float c02 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,-pixelSize.y)).x;\r\n float c10 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,0)).x;\r\n float c12 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,0)).x;\r\n float c20 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,pixelSize.y)).x;\r\n float c21 = texture2D(srcDepthTex, vUv + vec2(0,pixelSize.y)).x;\r\n float c22 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,pixelSize.y)).x;\r\n\r\n float horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n float vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n float grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n\r\n gl_FragColor = ( grad > threshold ) ? vec4(color.rgb, 1.0) : gl_FragColor = texture2D(srcTex, vUv);\r\n\r\n #else\r\n vec4 c00 = texture2D(srcTex, vUv + vec2(-pixelSize.x,-pixelSize.y));\r\n vec4 c01 = texture2D(srcTex, vUv + vec2(0,-pixelSize.y));\r\n vec4 c02 = texture2D(srcTex, vUv + vec2(pixelSize.x,-pixelSize.y));\r\n vec4 c10 = texture2D(srcTex, vUv + vec2(-pixelSize.x,0));\r\n vec4 c12 = texture2D(srcTex, vUv + vec2(pixelSize.x,0));\r\n vec4 c20 = texture2D(srcTex, vUv + vec2(-pixelSize.x,pixelSize.y));\r\n vec4 c21 = texture2D(srcTex, vUv + vec2(0,pixelSize.y));\r\n vec4 c22 = texture2D(srcTex, vUv + vec2(pixelSize.x,pixelSize.y));\r\n\r\n vec4 horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n vec4 vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n vec4 grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n gl_FragColor = grad;\r\n #endif\r\n}\r\n"; - - var OutlineMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(OutlineMaterial, _THREE$RawShaderMater); - - function OutlineMaterial(params) { - var _this; - - classCallCheck(this, OutlineMaterial); - - // add depth outline - _this = possibleConstructorReturn(this, getPrototypeOf(OutlineMaterial).call(this, params)); - var settings = { - uniforms: { - srcTex: { - type: 't', - value: null - }, - srcDepthTex: { - type: 't', - value: null - }, - srcTexSize: { - type: 'v2', - value: new THREE.Vector2(512, 512) - }, - color: { - type: 'v3', - value: null - }, - threshold: { - type: 'f', - value: null - }, - opacity: { - type: 'f', - value: 1.0 - }, - thickness: { - type: 'v2', - value: new THREE.Vector2(1, 1) - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$1, - transparent: true, - depthTest: false, - depthWrite: false - }; + } + } + function getVolume() { + // Basic steps are: + // 1) Initialize + // 2) Project points + // 3) Project torii + console.time('ContactSurface.getVolume'); + console.time('ContactSurface.init'); + init(); + console.timeEnd('ContactSurface.init'); + console.time('ContactSurface.projectPoints'); + projectPoints(); + console.timeEnd('ContactSurface.projectPoints'); + console.time('ContactSurface.projectTorii'); + projectTorii(); + console.timeEnd('ContactSurface.projectTorii'); + fixNegatives(); + console.timeEnd('ContactSurface.getVolume'); + } + this.build = function () { + // type and cutoff left in for compatibility with EDTSurface.getSurface + // function signature + getVolume(); + this.volTexMap = volTex; + this.weightsMap = weightsMap; + this.atomMap = atomMap; + this.volMap = grid; + }; +} +/* harmony default export */ const geometries_ContactSurface = (ContactSurface); +;// CONCATENATED MODULE: ./src/gfx/geometries/ContactSurfaceGeometry.js + + + +const { + Volume: ContactSurfaceGeometry_Volume +} = chem; + +/** + * This class implements 'contact' isosurface geometry generation algorithm. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor + */ + +class ContactSurfaceGeometry extends geometries_VolumeSurfaceGeometry { + _computeSurface(packedArrays, box, boundaries, params) { + const contactSurface = new geometries_ContactSurface(packedArrays, boundaries, params); + contactSurface.build(); + const surface = { + volMap: new ContactSurfaceGeometry_Volume(Float32Array, this.numVoxels, box, 1, contactSurface.volMap), + volTexMap: new ContactSurfaceGeometry_Volume(Float32Array, this.numVoxels, box, 3, contactSurface.volTexMap), + atomMap: contactSurface.atomMap, + atomWeightMap: new ContactSurfaceGeometry_Volume(Float32Array, this.numVoxels, box, 1, contactSurface.weightsMap) + }; + return surface; + } +} +/* harmony default export */ const geometries_ContactSurfaceGeometry = (ContactSurfaceGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurfaceAtomColored.js + + +/** + * Class for colored atom. Need for atom structure clusterization + * + * @param {Vector3} vCenter Center of atom + * @param {number} radiusAt Radius of atom + */ +class IsoSurfaceAtomColored { + constructor(vCenter, radiusAt) { + this.coord = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this.coord.copy(vCenter); + this.radius = radiusAt; + this.colorX = 0.99999; + this.colorY = 0.0; + this.colorZ = 0.0; + this.atomType = 0; + this.srcAtom = null; + } +} +/* harmony default export */ const geometries_IsoSurfaceAtomColored = (IsoSurfaceAtomColored); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsosurfaceBuildNormals.js + + + +// suppress some JSHint warnings +/* jshint bitwise: false */ + +/** + * Build normals for isosurface, using atoms information + * + * @param {number} numAtoms - Number of atoms in molecule + * @param {Element} atoms - Array of atoms + * @param {Vector3} vBoxMin - Bounding box min + * @param {Vector3} vBoxMax - Bounding box max + * @param {number} probeRadius - Normals for output + * + */ +class IsosurfaceBuildNormals { + constructor(numAtoms, atoms, vBoxMin, vBoxMax, probeRadius) { + this._numAtoms = numAtoms; + this._atoms = atoms; + this._vBoxMin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._vBoxMax = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._vBoxMin.copy(vBoxMin); + this._vBoxMax.copy(vBoxMax); + this._probeRadius = probeRadius; + this._atomsList = null; + this._voxelList = null; + } + createVoxels() { + let numAtomsRefs; + let rad; + const ATOM_VOXEL_REF_SCALE = 4.5; + const numAtoms = this._numAtoms | 0; + const atoms = this._atoms; + const dx = this._vBoxMax.x - this._vBoxMin.x; + const dy = this._vBoxMax.y - this._vBoxMin.y; + const dz = this._vBoxMax.z - this._vBoxMin.z; + let w = dx < dy ? dx : dy; + w = dz < w ? dz : w; + let maxRad = 0.0; + let aveRad = 0.0; + let i; + for (i = 0; i < numAtoms; i++) { + rad = (atoms[i].radius + this._probeRadius) * 2.0; + maxRad = rad > maxRad ? rad : maxRad; + aveRad += rad; + } + let numCells = Math.floor(w / maxRad); + if (numCells < 2) { + numCells = 2; + } + aveRad /= numAtoms; + this._numCells = numCells; + this._aveRad = aveRad; + this._maxRad = maxRad; + const side = numCells; + const side2 = numCells * numCells; + const side3 = numCells * numCells * numCells; + const xScale = this._xScale = 1.0 / (this._vBoxMax.x - this._vBoxMin.x); + const yScale = this._yScale = 1.0 / (this._vBoxMax.y - this._vBoxMin.y); + const zScale = this._zScale = 1.0 / (this._vBoxMax.z - this._vBoxMin.z); + + // estimate number of individual atom refs in each voxel list + let maxAtomsRefs = 0; + const xNumVoxMult = xScale * numCells; + const yNumVoxMult = yScale * numCells; + const zNumVoxMult = zScale * numCells; + for (i = 0; i < numAtoms; i++) { + const radAffect = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE; + const diaAffect = radAffect * 2.0; + let numVoxX = Math.floor(xNumVoxMult * diaAffect + 0.8); + let numVoxY = Math.floor(yNumVoxMult * diaAffect + 0.8); + let numVoxZ = Math.floor(zNumVoxMult * diaAffect + 0.8); + // avoid case numVox? == 0 + // also use loop i <= + numVoxX++; + numVoxY++; + numVoxZ++; + maxAtomsRefs += numVoxX * numVoxY * numVoxZ; + } // for (i) + // maxAtomsRefs = numAtoms * MAX_ATOMS_IN_SINGLE_VOXEL; + + this._voxelList = utils.allocateTyped(Int32Array, side3); + const atomsList = []; + atomsList.length = maxAtomsRefs; + if (this._voxelList === null || atomsList === null) { + return 0 - 1; + } + // init voxel list + for (i = 0; i < side3; i++) { + this._voxelList[i] = -1; + } + numAtomsRefs = 0; + + // create voxel lists + for (i = 0; i < numAtoms; i++) { + // use multiplier 4 to locate this atom in different voxels + rad = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE; + let xIndMin = Math.floor((atoms[i].coord.x - this._vBoxMin.x - rad) * numCells * xScale); + let yIndMin = Math.floor((atoms[i].coord.y - this._vBoxMin.y - rad) * numCells * yScale); + let zIndMin = Math.floor((atoms[i].coord.z - this._vBoxMin.z - rad) * numCells * zScale); + let xIndMax = Math.floor((atoms[i].coord.x - this._vBoxMin.x + rad) * numCells * xScale); + let yIndMax = Math.floor((atoms[i].coord.y - this._vBoxMin.y + rad) * numCells * yScale); + let zIndMax = Math.floor((atoms[i].coord.z - this._vBoxMin.z + rad) * numCells * zScale); + xIndMin = xIndMin >= 0 ? xIndMin : 0; + yIndMin = yIndMin >= 0 ? yIndMin : 0; + zIndMin = zIndMin >= 0 ? zIndMin : 0; + xIndMax = xIndMax < numCells ? xIndMax : numCells - 1; + yIndMax = yIndMax < numCells ? yIndMax : numCells - 1; + zIndMax = zIndMax < numCells ? zIndMax : numCells - 1; + for (let z = zIndMin; z <= zIndMax; z++) { + for (let y = yIndMin; y <= yIndMax; y++) { + for (let x = xIndMin; x <= xIndMax; x++) { + // add atom with index "i" to this voxel list + const indVoxel = x + y * side + z * side2; + // assert indVoxel >= 0 + // assert indVoxel < side3 + + // add first + if (this._voxelList[indVoxel] < 0) { + atomsList[numAtomsRefs * 2 + 0] = i; + atomsList[numAtomsRefs * 2 + 1] = 0 - 1; + this._voxelList[indVoxel] = numAtomsRefs; + numAtomsRefs++; + // assert numAtomsRefs < maxAtomsRefs - 1 + continue; + } + // insert into head of list + const indexNext = this._voxelList[indVoxel]; + this._voxelList[indVoxel] = numAtomsRefs; + atomsList[numAtomsRefs * 2 + 0] = i; + atomsList[numAtomsRefs * 2 + 1] = indexNext; + numAtomsRefs++; + } // for (x) + } // for (y) + } // for (z) + } // for (i) - _this.setValues(settings); + // convert Array to Int32Array + this._atomsList = Int32Array.from(atomsList); + return 0; + } + destroyVoxels() { + this._atomsList = null; + this._voxelList = null; + this._atoms = null; + this._vertices = null; + this._vBoxMin = null; + this._vBoxMax = null; + } - return _this; + /** + * Enumerate all atoms affecting specified point + * + * @param {Vector3} point - point in 3D + * @param {func(atom)} process - function to call for each atom + */ + forEachRelatedAtom(point, process) { + // find corresponding voxel + const xInd = Math.floor((point.x - this._vBoxMin.x) * this._numCells * this._xScale); + const yInd = Math.floor((point.y - this._vBoxMin.y) * this._numCells * this._yScale); + const zInd = Math.floor((point.z - this._vBoxMin.z) * this._numCells * this._zScale); + const indVoxel = xInd + yInd * this._numCells + zInd * this._numCells * this._numCells; + + // run through atoms affecting this voxel + const atoms = this._atoms; + for (let ref = this._voxelList[indVoxel]; ref >= 0; ref = this._atomsList[ref * 2 + 1]) { + const indexAtom = this._atomsList[ref * 2]; + process(atoms[indexAtom]); } + } - createClass(OutlineMaterial, [{ - key: "copy", - value: function copy(source) { - get(getPrototypeOf(OutlineMaterial.prototype), "copy", this).call(this, source); - - this.depth = source.depth; + /** + * Get atom closest to specified point + * + * @param {Vector3} point - point in 3D + * + * @returns {IsoSurfaceAtomColored} atom, or null if not found + */ + getClosestAtom(point) { + let closest = null; + let minDist2 = Number.MAX_VALUE; + this.forEachRelatedAtom(point, atom => { + const dist2 = point.distanceToSquared(atom.coord); + if (dist2 < minDist2) { + minDist2 = dist2; + closest = atom; } - }, { - key: "setValues", - value: function setValues(values) { - if (typeof values === 'undefined') { - return; - } // set direct values - + }); + return closest; + } - get(getPrototypeOf(OutlineMaterial.prototype), "setValues", this).call(this, values); + /** + * Build normals for isosurface, using atoms information + * + * @param {number} numVertices - Number of vertices in final geometry (to render) + * @param {Vector3} vertices - Geometry vertices (3d coordinates array) + * @param {Vector3} normals - Normals for output + * + * @returns {number} 0, if success + */ + buildNormals(numVertices, vertices, normals) { + const self = this; + let numCloseAtoms = 0; + let vx = 0; + let vy = 0; + let vz = 0; + let dist2; + let vNormalX = 0; + let vNormalY = 0; + let vNormalZ = 0; + let koef = 0; + let w = 0; + const r25 = 2.5; + const r01 = 0.1; + const maxRadAffect = this._aveRad * r25; + const maxRadAffect2 = maxRadAffect * maxRadAffect; + const expScale = -this._aveRad * r01; + + // some stats + // numSlowAtoms = 0; + + const gatherNormals = function (atom) { + const dx = vx - atom.coord.x; + const dy = vy - atom.coord.y; + const dz = vz - atom.coord.z; + dist2 = dx * dx + dy * dy + dz * dz; + if (dist2 > maxRadAffect2) { + return; + } - var defines = {}; + // get weight for gaussian smoothing + const rad = atom.radius + self._probeRadius; + koef = dist2 - rad * rad; + if (koef < 0.0) { + koef = -koef; + } + w = Math.exp(expScale * koef); + vNormalX += dx * w; + vNormalY += dy * w; + vNormalZ += dz * w; + numCloseAtoms++; + }; + let maxClosedAtoms = 0; + // process all vertices, one by one + for (let i = 0; i < numVertices; i++) { + vx = vertices[i].x; + vy = vertices[i].y; + vz = vertices[i].z; + numCloseAtoms = 0; + vNormalX = vNormalY = vNormalZ = 0.0; + this.forEachRelatedAtom(vertices[i], gatherNormals); + maxClosedAtoms = numCloseAtoms > maxClosedAtoms ? numCloseAtoms : maxClosedAtoms; + + // normalize vNormal + dist2 = vNormalX * vNormalX + vNormalY * vNormalY + vNormalZ * vNormalZ; + if (numCloseAtoms > 0) { + koef = 1.0 / Math.sqrt(dist2); + vNormalX *= koef; + vNormalY *= koef; + vNormalZ *= koef; + } + normals[i].x = vNormalX; + normals[i].y = vNormalY; + normals[i].z = vNormalZ; + } // for (i) all vertices + + return 0; + } - if (this.depth) { - defines.DEPTH_OUTLINE = 1; - } // set dependent values + /** + * Build vertex colors for isosurface, using atoms information + * + * @param {number} numVertices - Number of vertices in final geometry (to render) + * @param {Vector3} vertices - Geometry vertices (3d coordinates array) + * @param {Vector3} colors - Colors for output + * @param {number} radiusColorSmoothness - Radius of smoothness sphere + * + * @returns {number} 0, if success + */ + buildColors(numVertices, vertices, colors, radiusColorSmoothness) { + const self = this; + let vx = 0.0; + let vy = 0.0; + let vz = 0.0; + let koef = 0.0; + let w = 0.0; + const KOEF_ADD = 0.8; + const maxRadAffect = radiusColorSmoothness; + const maxRadAffect2 = maxRadAffect * maxRadAffect; + let colorsClose = []; + let weights = []; + let weightsSum = 0; + const gatherColors = function (atom) { + const dx = vx - atom.coord.x; + const dy = vy - atom.coord.y; + const dz = vz - atom.coord.z; + const dist2 = dx * dx + dy * dy + dz * dz; + if (dist2 > maxRadAffect2) { + return; + } + // get weight for gaussian smoothing + const rad = atom.radius + self._probeRadius; + koef = dist2 - rad * rad; + if (koef < 0.0) { + koef = -koef; + } + w = 1.0 / (KOEF_ADD + koef); + colorsClose.push([atom.colorX, atom.colorY, atom.colorZ]); + weights.push(w); // save weights for use + weightsSum += w; // calc sum of weights fo further normalization + }; - this.defines = defines; + // process all vertices, one by one + for (let i = 0; i < numVertices; i++) { + vx = vertices[i].x; + vy = vertices[i].y; + vz = vertices[i].z; + colorsClose = []; + weights = []; + weightsSum = 0; + this.forEachRelatedAtom(vertices[i], gatherColors); + + // normalized weighted sum of colors + for (let j = 0; j < colorsClose.length; ++j) { + const weightNormalized = weights[j] / weightsSum; + colors[i].x += colorsClose[j][0] * weightNormalized; + colors[i].y += colorsClose[j][1] * weightNormalized; + colors[i].z += colorsClose[j][2] * weightNormalized; + } + } // for (i) all vertices + return 0; + } +} +/* harmony default export */ const geometries_IsosurfaceBuildNormals = (IsosurfaceBuildNormals); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurfaceGeo.js + + +/** + * Class for geometry (triangle mesh) representation + * + * + * @param {number} maxNumVertices Maximum possible number of vertices in mesh + * @param {number} maxNumTriangles Maximum possible number of triangles in mesh + * @param {boolean} needVertexColors Obvious + */ +class IsoSurfaceGeo { + constructor(maxNumVertices, maxNumTriangles, needVertexColors) { + this._maxNumVertices = maxNumVertices; + this._maxNumTriangles = maxNumTriangles; + this._vertices = new Array(maxNumVertices); + this._normals = new Array(maxNumVertices); + this._colors = null; + if (needVertexColors) { + this._colors = new Array(maxNumVertices); + } + this._indices = new Array(maxNumTriangles * (1 + 2)); + this._numVertices = 0; + this._numTriangles = 0; + let i; + for (i = 0; i < maxNumVertices; i++) { + this._vertices[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._normals[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + } + for (i = 0; i < maxNumTriangles * (1 + 2); i++) { + this._indices[i] = -1; + } + if (needVertexColors) { + for (i = 0; i < maxNumVertices; i++) { + this._colors[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); } - }]); + } + } + destroy() { + this._vertices = null; + this._normals = null; + this._indices = null; + } +} +/* harmony default export */ const geometries_IsoSurfaceGeo = (IsoSurfaceGeo); +;// CONCATENATED MODULE: ./src/gfx/geometries/SSIsosurfaceGeometry.js - return OutlineMaterial; - }(THREE.RawShaderMaterial); - OutlineMaterial.prototype.depth = false; - var fragmentShader$2 = "precision highp float;\r\n\r\n// edge end finding algorithm parameters\r\n#define FXAA_QUALITY_PS 8\r\n#define FXAA_QUALITY_P0 1.0\r\n#define FXAA_QUALITY_P1 1.5\r\n#define FXAA_QUALITY_P2 2.0\r\n#define FXAA_QUALITY_P3 2.0\r\n#define FXAA_QUALITY_P4 2.0\r\n#define FXAA_QUALITY_P5 2.0\r\n#define FXAA_QUALITY_P6 4.0\r\n#define FXAA_QUALITY_P7 12.0\r\n// constants\r\nfloat fxaaQualityEdgeThreshold = 0.125;\r\nfloat fxaaQualityEdgeThresholdMin = 0.0625;\r\nfloat fxaaQualitySubpix = 0.7; //0.65;\r\n// global params\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexelSize;\r\nuniform vec3 bgColor;\r\n// from vs\r\nvarying vec2 vUv;\r\n//=====================================================================//\r\n// calc luminance from rgb\r\n//'float FxaaLuma(vec3 rgb) {return rgb.y * (0.587/0.299) + rgb.x; } // Lotte's idea about game luminance\r\nfloat FxaaLuma(vec3 rgb) {return dot(rgb, vec3(0.299, 0.587, 0.114)); } // real luminance calculation\r\n // for non-real scene rendering\r\n// texture sampling by pixel position(coords) and offset(in pixels)\r\n vec3 FxaaTex(sampler2D tex, vec2 pos, vec2 off, vec2 res ) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos + off * res );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos + off * res ).xyz;\r\n #endif\r\n}\r\nvec3 FxaaTexTop(sampler2D tex, vec2 pos) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos).xyz;\r\n #endif\r\n}\r\nvec4 FxaaTexTopAlpha(sampler2D tex, vec2 pos) {\r\n return texture2D( tex, pos);\r\n}\r\n\r\n//=====================================================================//\r\nvoid main() {\r\n // renaming\r\n vec2 posM = vUv;\r\n // get luminance for neighbours\r\n float lumaS = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, 1.0 ), srcTexelSize));\r\n float lumaE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 0.0 ), srcTexelSize));\r\n float lumaN = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, -1.0 ), srcTexelSize));\r\n float lumaW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 0.0 ), srcTexelSize));\r\n float lumaM = FxaaLuma(FxaaTexTop(srcTex, posM));\r\n // find max and min luminance\r\n float rangeMax = max(max(lumaN, lumaW), max(lumaE, max(lumaS, lumaM)));\r\n float rangeMin = min(min(lumaN, lumaW), min(lumaE, min(lumaS, lumaM)));\r\n // calc maximum non-edge range\r\n float rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\r\n float range = rangeMax - rangeMin;\r\n float rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\r\n // exit when luma contrast is small (is not edge)\r\n if(range < rangeMaxClamped){\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n return;\r\n }\r\n float subpixRcpRange = 1.0/range;\r\n // note: the sampling coordinates can be calculated in vertex shader but the approach doesn't affect performance\r\n // visibly, thus we decided to leave calculation here for better readability.\r\n // calc other neighbours luminance\r\n float lumaNE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, -1.0 ), srcTexelSize));\r\n float lumaSW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 1.0 ), srcTexelSize));\r\n float lumaSE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 1.0 ), srcTexelSize));\r\n float lumaNW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, -1.0 ), srcTexelSize));\r\n/*--------------span calculation and subpix amount calulation-----------------*/\r\n float lumaNS = lumaN + lumaS;\r\n float lumaWE = lumaW + lumaE;\r\n float subpixNSWE = lumaNS + lumaWE;\r\n float edgeHorz1 = (-2.0 * lumaM) + lumaNS;\r\n float edgeVert1 = (-2.0 * lumaM) + lumaWE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNESE = lumaNE + lumaSE;\r\n float lumaNWNE = lumaNW + lumaNE;\r\n float edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\r\n float edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNWSW = lumaNW + lumaSW;\r\n float lumaSWSE = lumaSW + lumaSE;\r\n float edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\r\n float edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\r\n float edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\r\n float edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\r\n float edgeHorz = abs(edgeHorz3) + edgeHorz4;\r\n float edgeVert = abs(edgeVert3) + edgeVert4;\r\n/*--------------------subpix amount calulation------------------------------*/\r\n float subpixNWSWNESE = lumaNWSW + lumaNESE;\r\n float lengthSign = srcTexelSize.x;\r\n bool horzSpan = edgeHorz >= edgeVert;\r\n // debug code edge span visualization\r\n/*' if (horzSpan)\r\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);\r\n else\r\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\r\n return;*/\r\n float subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\r\n/*--------------------------------------------------------------------------*/\r\n if(!horzSpan) lumaN = lumaW;\r\n if(!horzSpan) lumaS = lumaE;\r\n if(horzSpan) lengthSign = srcTexelSize.y;\r\n float subpixB = (subpixA * (1.0/12.0)) - lumaM;\r\n/*--------------------------------------------------------------------------*/\r\n float gradientN = lumaN - lumaM;\r\n float gradientS = lumaS - lumaM;\r\n float lumaNN = lumaN + lumaM;\r\n float lumaSS = lumaS + lumaM;\r\n bool pairN = abs(gradientN) >= abs(gradientS);\r\n float gradient = max(abs(gradientN), abs(gradientS));\r\n if(pairN) lengthSign = -lengthSign;\r\n float subpixC = clamp(abs(subpixB) * subpixRcpRange, 0.0, 1.0);\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posB;\r\n posB = posM;\r\n vec2 offNP;\r\n offNP.x = (!horzSpan) ? 0.0 : srcTexelSize.x;\r\n offNP.y = ( horzSpan) ? 0.0 : srcTexelSize.y;\r\n if(!horzSpan) posB.x += lengthSign * 0.5;\r\n if( horzSpan) posB.y += lengthSign * 0.5;\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posN;\r\n posN = posB - offNP * FXAA_QUALITY_P0;\r\n vec2 posP;\r\n posP = posB + offNP * FXAA_QUALITY_P0;\r\n float subpixD = ((-2.0)*subpixC) + 3.0;\r\n float lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN));\r\n float subpixE = subpixC * subpixC;\r\n float lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP));\r\n/*--------------------------------------------------------------------------*/\r\n if(!pairN) lumaNN = lumaSS;\r\n float gradientScaled = gradient * 1.0/4.0;\r\n float lumaMM = lumaM - lumaNN * 0.5;\r\n float subpixF = subpixD * subpixE;\r\n bool lumaMLTZero = lumaMM < 0.0;\r\n/*---------------------looped edge-end search-------------------------------*/\r\n lumaEndN -= lumaNN * 0.5;\r\n lumaEndP -= lumaNN * 0.5;\r\n bool doneN = abs(lumaEndN) >= gradientScaled;\r\n bool doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P1;\r\n bool doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P1;\r\n/*--------------------------------------------------------------------------*/\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P2;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P2;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 3)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P3;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P3;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 4)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P4;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P4;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 5)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P5;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P5;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 6)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P6;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P6;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 7)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P7;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P7;\r\n/*--------------------------------------------------------------------------*/\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n/*----------------calculate subpix offset due to edge ends-------------------*/\r\n float dstN = posM.x - posN.x;\r\n float dstP = posP.x - posM.x;\r\n if(!horzSpan) dstN = posM.y - posN.y;\r\n if(!horzSpan) dstP = posP.y - posM.y;\r\n/*--------------------------------------------------------------------------*/\r\n bool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\r\n float spanLength = (dstP + dstN);\r\n bool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\r\n float spanLengthRcp = 1.0 / spanLength;\r\n/*--------------------------------------------------------------------------*/\r\n bool directionN = dstN < dstP;\r\n float dst = min(dstN, dstP);\r\n bool goodSpan = directionN ? goodSpanN : goodSpanP;\r\n float subpixG = subpixF * subpixF;\r\n float pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\r\n float subpixH = subpixG * fxaaQualitySubpix;\r\n/*-----------------calc texture offest using subpix-------------------------*/\r\n float pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\r\n float pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\r\n\r\n float offset = pixelOffsetSubpix * lengthSign;\r\n #ifdef BG_TRANSPARENT\r\n // get original texel\r\n vec4 rgbaA = FxaaTexTopAlpha(srcTex, posM);\r\n // calc step to blended texel\r\n vec2 step = sign((!horzSpan) ? vec2 (offset, 0.0) : vec2 (0.0, offset));\r\n // get neighboring texel\r\n vec4 rgbaB = FxaaTexTopAlpha(srcTex, posM + step * srcTexelSize);\r\n // calc blend factor from offset\r\n float f = (!horzSpan) ? offset / srcTexelSize.x : offset / srcTexelSize.y;\r\n f = abs(f);\r\n // calc alpha (special formula to emulate blending with bg)\r\n gl_FragColor.a = 1.0 - mix(1.0 - rgbaA.a, 1.0 - rgbaB.a, f);\r\n // calc color (special formula to emulate blending with bg)\r\n gl_FragColor.rgb = mix(rgbaA.rgb * rgbaA.a, rgbaB.rgb * rgbaB.a, f) / gl_FragColor.a;\r\n #else\r\n if(!horzSpan) {\r\n posM.x += offset;\r\n } else {\r\n posM.y += offset;\r\n }\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n #endif\r\n return;\r\n}\r\n"; - var FXAAMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(FXAAMaterial, _THREE$RawShaderMater); - function FXAAMaterial(params) { - var _this; - classCallCheck(this, FXAAMaterial); - _this = possibleConstructorReturn(this, getPrototypeOf(FXAAMaterial).call(this, params)); // set default values - _this.setValues.call(assertThisInitialized(_this), { - uniforms: { - srcTex: { - type: 't', - value: null - }, - srcTexelSize: { - type: 'v2', - value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) - }, - bgColor: { - type: 'c', - value: new THREE.Color(0xffffff) - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$2, - transparent: false, - depthTest: false, - depthWrite: false - }); +const SSIsosurfaceGeometry_COLOR_SIZE = 3; +const HASH_SIZE = 32768; +const { + Element: SSIsosurfaceGeometry_Element +} = chem; - _this.setValues(params); +/** + * This class implements 'quick' isosurface geometry generation algorithm. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor + */ - return _this; +class SSIsosurfaceGeometry extends geometries_IsoSurfaceGeometry { + _build() { + // convert geoOut into arrays of positions, indices, normals + this._innerBuild(); + const geoOut = this.getGeo(); + this.destroy(); + this._fromGeo(geoOut); + } + _fromGeo(geoOut) { + let colors = null; + const positions = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); + const normals = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); + if (geoOut._colors !== null) { + colors = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); + } + const indices = utils.allocateTyped(Uint32Array, (1 + 2) * geoOut._numTriangles); + for (let i = 0, j = 0; i < geoOut._numVertices; i++) { + positions[j + 0] = geoOut._vertices[i].x; + positions[j + 1] = geoOut._vertices[i].y; + positions[j + 2] = geoOut._vertices[i].z; + normals[j + 0] = geoOut._normals[i].x; + normals[j + 1] = geoOut._normals[i].y; + normals[j + 2] = geoOut._normals[i].z; + j += 3; + } + if (colors !== null) { + for (let i = 0, j = 0; i < geoOut._numVertices; i++, j += 3) { + colors[j + 0] = geoOut._colors[i].x; + colors[j + 1] = geoOut._colors[i].y; + colors[j + 2] = geoOut._colors[i].z; + } + } + const numTri3 = geoOut._numTriangles * (1 + 2); + for (let i = 0; i < numTri3; i++) { + indices[i] = geoOut._indices[i]; + } + this.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(indices, 1)); + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(positions, 3)); + this.setAttribute('normal', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(normals, 3)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(colors, 3)); + this.computeBoundingBox(); + this.computeBoundingSphere(); + geoOut.destroy(); + } + convertToAtomsColored(packedArrays, atomsColored) { + const { + atoms, + colors + } = packedArrays; + for (let i = 0, numAtoms = atoms.length; i < numAtoms; i++) { + const vCenter = atoms[i].position; + const { + radius + } = atoms[i].element; + atomsColored[i] = new geometries_IsoSurfaceAtomColored(vCenter, radius); + const nm = atoms[i].element.number; + atomsColored[i].atomType = this.getType(nm); + let cIdx = SSIsosurfaceGeometry_COLOR_SIZE * i; + atomsColored[i].colorX = colors[cIdx++]; + atomsColored[i].colorY = colors[cIdx++]; + atomsColored[i].colorZ = colors[cIdx]; + atomsColored[i].srcAtom = atoms[i]; } + } + getGeo() { + return this.geoOut; + } + destroy() { + this.atoms = null; + this.hashLines = null; + this.hashEntries = null; + } - createClass(FXAAMaterial, [{ - key: "copy", - value: function copy(source) { - get(getPrototypeOf(FXAAMaterial.prototype), "copy", this).call(this, source); - - this.depth = source.depth; - } - }, { - key: "setValues", - value: function setValues(values) { - if (typeof values === 'undefined') { - return; - } // set direct values + /** + * Calculates bounding box for array with spheres (atoms) + * + * @param {Object} atoms Atoms array + * @param {Vector3} vBoxMin Bounding box min point + * @param {Vector3} vBoxMax Bounding box max point + */ + getBoundingBox(atoms, vBoxMin, vBoxMax) { + const bigNum = 10000000.0; + vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum; + vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum; + const probeRadius2 = this.probeRadius * this.atomRadiusScale; + let radMax = 0.0; + for (let i = 0, num = atoms.length; i < num; i++) { + const vCenter = atoms[i].coord; + const rad = atoms[i].radius + probeRadius2; + radMax = rad > radMax ? rad : radMax; + if (vCenter.x - rad < vBoxMin.x) { + vBoxMin.x = vCenter.x - rad; + } + if (vCenter.y - rad < vBoxMin.y) { + vBoxMin.y = vCenter.y - rad; + } + if (vCenter.z - rad < vBoxMin.z) { + vBoxMin.z = vCenter.z - rad; + } + if (vCenter.x + rad > vBoxMax.x) { + vBoxMax.x = vCenter.x + rad; + } + if (vCenter.y + rad > vBoxMax.y) { + vBoxMax.y = vCenter.y + rad; + } + if (vCenter.z + rad > vBoxMax.z) { + vBoxMax.z = vCenter.z + rad; + } + } + vBoxMin.x -= radMax; + vBoxMin.y -= radMax; + vBoxMin.z -= radMax; + vBoxMax.x += radMax; + vBoxMax.y += radMax; + vBoxMax.z += radMax; + } + /** + * Calculate (x,y,z) cordinate of the cell corner point + * + * @param {Vector3} vBoxMin Bounding box min point + * @param {Vector3} vBoxMax Bounding box max point + * @param {number} x Cell integer x coordinate + * @param {number} y Cell integer y coordinate + * @param {number} z Cell integer z coordinate + * @param {number} numPoints NUm points in cell on side + * @param {Vector3} vOut Output vector + */ + getCornerCoord(vBoxMin, vBoxMax, x, y, z, numPoints, vOut) { + const invNP = 1.0 / (numPoints - 1.0); + const tx = x * invNP; + const ty = y * invNP; + const tz = z * invNP; + vOut.x = vBoxMin.x * (1.0 - tx) + vBoxMax.x * tx; + vOut.y = vBoxMin.y * (1.0 - ty) + vBoxMax.y * ty; + vOut.z = vBoxMin.z * (1.0 - tz) + vBoxMax.z * tz; + } - get(getPrototypeOf(FXAAMaterial.prototype), "setValues", this).call(this, values); + /** + * Calculate point of intersection of sphere surface + * and cell edge, given by [indexA, indexB] line + * + * @param {number} indexA Cell vertex index in [0..11] + * @param {number} indexB Cell vertex index in [0..11] + * @param {array} sign Sign array for all 8 vertices + * @param {object} cube Cube + * @param {number} indexPointValue for value placement + * @param {Vector3} vOut Point of intersection + */ + buildEdgePoint(indexA, indexB, sign, cube, indexPointValue, vOut) { + if (sign[indexA] ^ sign[indexB]) { + const cTwentyFour = 24; + const t = (0 - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]) / (cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexB] - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]); + const xa = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 0]; + const ya = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 1]; + const za = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 2]; + const xb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 0]; + const yb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 1]; + const zb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 2]; + vOut.x = xa * (1.0 - t) + xb * t; + vOut.y = ya * (1.0 - t) + yb * t; + vOut.z = za * (1.0 - t) + zb * t; + } + } - var defines = {}; + /** + * Check if triangle is visible (vertices are close to atoms included in visibility set) + * + * @param {Vector3} v0 Vertex #0 + * @param {Vector3} v1 Vertex #1 + * @param {Vector3} v2 Vertex #2 + * @returns {boolean} true if triangle is visible + */ + isTriangleVisible(v0, v1, v2) { + const a0 = this.voxelWorld.getClosestAtom(v0); + const a1 = this.voxelWorld.getClosestAtom(v1); + const a2 = this.voxelWorld.getClosestAtom(v2); + if (a0 === null || a1 === null || a2 === null || a0.srcAtom === null || a1.srcAtom === null || a2.srcAtom === null) { + return false; + } + return this.visibilitySelector.includesAtom(a0.srcAtom) && this.visibilitySelector.includesAtom(a1.srcAtom) && this.visibilitySelector.includesAtom(a2.srcAtom); + } - if (this.bgTransparent) { - defines.BG_TRANSPARENT = 1; - } // set dependent values + /** + * Add triangle to result geometry + * + * @param {Vector3} v0 Vertex #0 + * @param {Vector3} v1 Vertex #1 + * @param {Vector3} v2 Vertex #2 + * @returns {boolean} false if no more triangles can be added + */ + addTriangle(v0, v1, v2) { + if (this.visibilitySelector && !this.isTriangleVisible(v0, v1, v2)) { + return true; + } + const geo = this.geoOut; + if (geo._numTriangles >= this.maxNumTriangles) { + return false; + } + // Add vertex with optimize + const indInGeo0 = this.addVertexToGeo(geo, v0); + const indInGeo1 = this.addVertexToGeo(geo, v1); + const indInGeo2 = this.addVertexToGeo(geo, v2); + if ((indInGeo0 | indInGeo1 | indInGeo2) < 0) { + return false; + } + const itr = 3 * geo._numTriangles; + geo._indices[itr + 0] = indInGeo0; + geo._indices[itr + 1] = indInGeo1; + geo._indices[itr + 2] = indInGeo2; + geo._numTriangles++; + return true; + } - this.defines = defines; - } - }]); + /** + * Build result geometry (triangle mesh) from marching cube cells + * + * @param {number} meshRes Marchnig cube vertex count on each side + * @param {Vector3} vBoxMin Bounding box point min + * @param {Vector3} vBoxMax Bounding box point max + * @param {number} corners float values array for each cube point + * @param {Vector3} vCellStep vector to next cube cell diagonal point + * @param {object} cube IsoSurfaceMarchCube object + * @returns {number} 0, if success (<0) is error + */ + buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) { + const arrSize = 12; + const cNumVerts = 8; + const numCells = meshRes - 1; + const side = meshRes; + const side2 = meshRes * meshRes; + const vaEdges = new Array(arrSize); + for (let i = 0; i < arrSize; i++) { + vaEdges[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + } + const sign = []; + for (let i = 0; i < cNumVerts; i++) { + sign[i] = 1.0; + } + const vCorner = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + let indCell = 0; + let indY = 0; + for (let y = 0; y < numCells; y++, indY += side2) { + let indZ = 0; + for (let z = 0; z < numCells; z++, indZ += side) { + for (let x = 0; x < numCells; x++) { + if (!cube.hasIntersection[indCell]) { + // next cell + indCell++; + continue; + } + const bitsInside = cube.bitsInside[indCell]; + this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, meshRes, vCorner); + const indPointValues = indCell * (2 << 2 + 2); + for (let i = 0, j = 0; i < cNumVerts; i++) { + cube.pointsValuesLinear[indPointValues + j++] = vCorner.x; + cube.pointsValuesLinear[indPointValues + j++] = vCorner.y; + cube.pointsValuesLinear[indPointValues + j++] = vCorner.z; + } + cube.pointsValuesLinear[indPointValues + 3] += vCellStep.x; + cube.pointsValuesLinear[indPointValues + 2 * 3] += vCellStep.x; + cube.pointsValuesLinear[indPointValues + 5 * 3] += vCellStep.x; + cube.pointsValuesLinear[indPointValues + 6 * 3] += vCellStep.x; + cube.pointsValuesLinear[indPointValues + 2 * 3 + 2] += vCellStep.z; + cube.pointsValuesLinear[indPointValues + 3 * 3 + 2] += vCellStep.z; + cube.pointsValuesLinear[indPointValues + 6 * 3 + 2] += vCellStep.z; + cube.pointsValuesLinear[indPointValues + 7 * 3 + 2] += vCellStep.z; + cube.pointsValuesLinear[indPointValues + 4 * 3 + 1] += vCellStep.y; + cube.pointsValuesLinear[indPointValues + 5 * 3 + 1] += vCellStep.y; + cube.pointsValuesLinear[indPointValues + 6 * 3 + 1] += vCellStep.y; + cube.pointsValuesLinear[indPointValues + 7 * 3 + 1] += vCellStep.y; + + // now current cell has intersections (from -x to +x) on some cube edges + const indValues = indPointValues + 24; + for (let i = 0; i < cNumVerts; ++i) { + sign[i] = cube.pointsValuesLinear[indValues + i] < 0.0 ? 1 : 0; + } + this.buildEdgePoint(0, 1, sign, cube, indPointValues, vaEdges[0]); + this.buildEdgePoint(1, 2, sign, cube, indPointValues, vaEdges[1]); + this.buildEdgePoint(2, 3, sign, cube, indPointValues, vaEdges[2]); + this.buildEdgePoint(3, 0, sign, cube, indPointValues, vaEdges[3]); + this.buildEdgePoint(4, 5, sign, cube, indPointValues, vaEdges[4]); + this.buildEdgePoint(5, 6, sign, cube, indPointValues, vaEdges[5]); + this.buildEdgePoint(6, 7, sign, cube, indPointValues, vaEdges[6]); + this.buildEdgePoint(7, 4, sign, cube, indPointValues, vaEdges[7]); + this.buildEdgePoint(0, 4, sign, cube, indPointValues, vaEdges[8]); + this.buildEdgePoint(1, 5, sign, cube, indPointValues, vaEdges[9]); + this.buildEdgePoint(2, 6, sign, cube, indPointValues, vaEdges[10]); + this.buildEdgePoint(3, 7, sign, cube, indPointValues, vaEdges[11]); + const offs = bitsInside * (2 << 1 + 2); + for (let numTri = 0, indTri = 0; numTri < 2 + 2 + 2; numTri++, indTri += 3) { + // s_triIndicesMarchCube is external array, defined in mold_ind.js + const i0 = cube.striIndicesMarchCube[offs + indTri]; + if (i0 < 0) { + break; + } + const i1 = cube.striIndicesMarchCube[offs + indTri + 1]; + const i2 = cube.striIndicesMarchCube[offs + indTri + 2]; + if (!this.addTriangle(vaEdges[i0], vaEdges[i1], vaEdges[i2])) { + return 0 - 2; + } + } // for numTri + + // next cell (cube) + indCell++; + } // for (x) + } // for (z) + } // for (y) + return 0; + } - return FXAAMaterial; - }(THREE.RawShaderMaterial); - - FXAAMaterial.prototype.bgTransparent = false; - - var fragmentShader$3 = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 32\r\nuniform vec3 samplesKernel[MAX_SAMPLES_COUNT];\r\nuniform sampler2D noiseTexture;\r\nuniform vec2 noiseTexelSize;\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D depthTexture;\r\nuniform sampler2D normalTexture;\r\nuniform vec2 srcTexelSize;\r\nuniform vec2 camNearFar;\r\nuniform mat4 projMatrix;\r\n\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\nuniform float kernelRadius;\r\nuniform float depthThreshold;\r\nuniform float factor;\r\n\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n // remap coordinates to prevent noise exture rescale\r\n vec2 vUvNoise = vUv / srcTexelSize * noiseTexelSize;\r\n vec4 normalData = texture2D(normalTexture, vUv);\r\n // return for background fragments (their normals are zero vectors)\r\n if (length(normalData.rgb) < EPSILON) {\r\n // 0.0 in alpha component means that it is background fragment\r\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\r\n return;\r\n }\r\n //[0, 1] -> [-1, 1]\r\n vec3 normal = (normalData.rgb * 2.0 - 1.0);\r\n // normalData.a store 1.0 if normal was build for frontfaced surface\r\n // and 0.0 in other case\r\n if (normalData.a < EPSILON) {\r\n normal *= -1.0;\r\n }\r\n // get random vector for sampling sphere rotation\r\n vec3 randN = texture2D(noiseTexture, vUvNoise).rgb * 2.0 - 1.0;\r\n randN = normalize(randN);\r\n // build TBN (randomly rotated around normal)\r\n vec3 tangent = normalize(randN - normal * dot(randN, normal));\r\n vec3 bitangent = cross(tangent, normal);\r\n mat3 TBN = mat3(tangent, bitangent, normal);\r\n // calc AO value\r\n float AO = 0.0;\r\n for (int i = 0 ; i < MAX_SAMPLES_COUNT ; i++) {\r\n // rotate sampling kernel around normal\r\n vec3 reflectedSample = TBN * samplesKernel[i];\r\n // get sample\r\n vec3 samplePos = viewPos + reflectedSample * kernelRadius;\r\n\r\n // project sample to screen to get sample's screen pos\r\n vec4 SampleScrPos = vec4(samplePos, 1.0);\r\n // eye -> clip\r\n SampleScrPos = projMatrix * SampleScrPos;\r\n // normalize\r\n SampleScrPos.xy /= SampleScrPos.w;\r\n //[-1, 1] -> [0, 1]\r\n SampleScrPos.xy = (SampleScrPos.xy + vec2(1.0)) * 0.5;\r\n\r\n // get view z for sample projected to the objct surface\r\n float sampleDepth = CalcViewZ(SampleScrPos.xy);\r\n // calc occlusion made by object surface at the sample\r\n AO += step(samplePos.z, sampleDepth);\r\n }\r\n // calc result AO-map color\r\n AO = 1.0 - max(0.0, AO / float(MAX_SAMPLES_COUNT) * factor);\r\n // write value to AO-map\r\n gl_FragColor = vec4(AO, AO, AO, 1.0);\r\n}\r\n"; - - var _samplesKernel$1 = [// hemisphere samples adopted to sphere - new THREE.Vector3(0.295184, 0.077723, 0.068429), new THREE.Vector3(-0.271976, -0.365221, 0.838363), new THREE.Vector3(0.547713, 0.467576, 0.488515), new THREE.Vector3(0.662808, -0.031733, 0.584758), new THREE.Vector3(-0.025717, 0.218955, 0.657094), new THREE.Vector3(-0.310153, -0.365223, 0.370701), new THREE.Vector3(-0.101407, -0.006313, 0.747665), new THREE.Vector3(-0.769138, 0.360399, 0.086847), new THREE.Vector3(-0.271988, -0.275140, 0.905353), new THREE.Vector3(0.096740, -0.566901, 0.700151), new THREE.Vector3(0.562872, -0.735136, 0.094647), new THREE.Vector3(0.379877, 0.359278, 0.190061), new THREE.Vector3(0.519064, -0.023055, 0.405068), new THREE.Vector3(-0.301036, 0.114696, 0.088885), new THREE.Vector3(-0.282922, 0.598305, 0.487214), new THREE.Vector3(-0.181859, 0.251670, 0.679702), new THREE.Vector3(-0.191463, -0.635818, 0.512919), new THREE.Vector3(-0.293655, 0.427423, 0.078921), new THREE.Vector3(-0.267983, 0.680534, 0.132880), new THREE.Vector3(0.139611, 0.319637, 0.477439), new THREE.Vector3(-0.352086, 0.311040, 0.653913), new THREE.Vector3(0.321032, 0.805279, 0.487345), new THREE.Vector3(0.073516, 0.820734, 0.414183), new THREE.Vector3(-0.155324, 0.589983, 0.411460), new THREE.Vector3(0.335976, 0.170782, 0.527627), new THREE.Vector3(0.463460, -0.355658, 0.167689), new THREE.Vector3(0.222654, 0.596550, 0.769406), new THREE.Vector3(0.922138, -0.042070, 0.147555), new THREE.Vector3(-0.727050, -0.329192, 0.369826), new THREE.Vector3(-0.090731, 0.533820, 0.463767), new THREE.Vector3(-0.323457, -0.876559, 0.238524), new THREE.Vector3(-0.663277, -0.372384, 0.342856)]; - - var AOMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(AOMaterial, _THREE$RawShaderMater); - - function AOMaterial() { - var _this; - - classCallCheck(this, AOMaterial); - - _this = possibleConstructorReturn(this, getPrototypeOf(AOMaterial).call(this)); // set default values - - _this.setValues.call(assertThisInitialized(_this), { - uniforms: { - noiseTexture: { - type: 't', - value: noise.noiseTexture - }, - noiseTexelSize: { - type: 'v2', - value: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight) - }, - diffuseTexture: { - type: 't', - value: null - }, - normalTexture: { - type: 't', - value: null - }, - depthTexture: { - type: 't', - value: null - }, - srcTexelSize: { - type: 'v2', - value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) - }, - camNearFar: { - type: 'v2', - value: new THREE.Vector2(1.0, 10.0) - }, - projMatrix: { - type: 'mat4', - value: new THREE.Matrix4() - }, - aspectRatio: { - type: 'f', - value: 0.0 - }, - tanHalfFOV: { - type: 'f', - value: 0.0 - }, - samplesKernel: { - type: 'v3v', - value: _samplesKernel$1 - }, - kernelRadius: { - type: 'f', - value: 1.0 - }, - depthThreshold: { - type: 'f', - value: 1.0 - }, - factor: { - type: 'f', - value: 1.0 + /** + * Returns number of cell with intersection with at least one sphere. + * Using this number, we can estimate required number of vertices + * and triangles to build result mesh. + * + * @param {number} side Number of points in cube voxels + * @param {number} numCells Number of cells in cube voxels (per direction) + * @param {array} corners Array of float values for cube corner points + * @param {object} cube IsoSurfaceMarchCube object + * @returns {number} numIntersectedCells + */ + getNumIntersectedCells(side, numCells, corners, cube) { + const side2 = side * side; + const cNumVerts = 8; + let numIntersectedCells = 0; + let indCell = 0; + let indY = 0; + for (let y = 0; y < numCells; y++, indY += side2) { + let indZ = 0; + for (let z = 0; z < numCells; z++, indZ += side) { + for (let x = 0; x < numCells; x++) { + const cubeValuesIndex = indCell * (2 << 2 + 2) + 24; + const indCorner = x + indZ + indY; + cube.pointsValuesLinear[cubeValuesIndex] = corners[indCorner]; + cube.pointsValuesLinear[cubeValuesIndex + 1] = corners[indCorner + 1]; + cube.pointsValuesLinear[cubeValuesIndex + 2] = corners[indCorner + side + 1]; + cube.pointsValuesLinear[cubeValuesIndex + 3] = corners[indCorner + side]; + cube.pointsValuesLinear[cubeValuesIndex + 4] = corners[side2 + indCorner]; + cube.pointsValuesLinear[cubeValuesIndex + 5] = corners[side2 + indCorner + 1]; + cube.pointsValuesLinear[cubeValuesIndex + 6] = corners[side2 + indCorner + side + 1]; + cube.pointsValuesLinear[cubeValuesIndex + 7] = corners[side2 + indCorner + side]; + + // check read exception + // assert(side2 + indCorner + side + 1 < side3); + + // get bit flags inside + let bitsInside = 0; + for (let i = 0; i < cNumVerts; ++i) { + if (cube.pointsValuesLinear[cubeValuesIndex + i] < 0.0) { + bitsInside |= 1 << i; + } } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$3, - transparent: false, - depthTest: false, - depthWrite: false - }); + if (bitsInside === 0 || bitsInside === (1 << cNumVerts) - 1) { + cube.hasIntersection[indCell] = false; + } else { + cube.hasIntersection[indCell] = true; + numIntersectedCells++; + } + cube.bitsInside[indCell] = bitsInside; + // next cell + indCell++; + } // for (x) + } // for (z) + } // for (y) + return numIntersectedCells; + } + getType(letter) { + /* eslint-disable no-magic-numbers */ + const atomT = [0, 0, 1, 1, 2, 6, 3, 6, 4, 6, 5, 6, 6, 0, 7, 3, 8, 2, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 4, 16, 5, 17, 6, 18, 6, 19, 6, 20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6, 32, 6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, 45, 6, 46, 6, 47, 6, 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, 6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6, 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6, 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, 95, 6, 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, 6, 108, 6, 109, 6]; + /* eslint-enable no-magic-numbers */ - return _this; + if (letter < 1 || letter > atomT.length / 2 || Object.keys(SSIsosurfaceGeometry_Element.ByAtomicNumber).length * 2 !== atomT.length) { + throw new Error('atomT.length should be equal Element.ByAtomicNumber.length * 2'); } + return atomT[letter * 2]; + } - return AOMaterial; - }(THREE.RawShaderMaterial); - - var fragmentShader$4 = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = res;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x + samplesOffsets[i] * srcTexelSize.x, y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb = res.rgb / weightSum;\r\n gl_FragColor = res;\r\n}\r\n"; + /** + * Calculate values for marching cube grid points + * positive values are outside sphere, negative - is inside + * + * @param {array} corners array of float values + * @param {number} side Number of point in cube in 1 dimennsion + * @param {Vector3} vBoxMin Bounding box min point + * @param {Vector3} vBoxMax Bounding box max point + * @param {array} atoms Array of input atoms + * @param {number} probeRad radius for atom probing + */ + calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) { + const side2 = side * side; + const side3 = side2 * side; + const vCorner = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const vDif = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + /* eslint-disable no-magic-numbers */ + const aLot = +1.0e12; + /* eslint-enable no-magic-numbers */ - var _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0]; + for (let i = 0; i < side3; i++) { + corners[i] = aLot; // to large value + } + const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x); + const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y); + const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z); + for (let s = 0, numAtoms = atoms.length; s < numAtoms; s++) { + const atom = atoms[s]; + const radius = atom.radius + probeRad; + const fx = (atom.coord.x - radius - vBoxMin.x) * xScale; + const fy = (atom.coord.y - radius - vBoxMin.y) * yScale; + const fz = (atom.coord.z - radius - vBoxMin.z) * zScale; + const indXMin = Math.floor(fx); + const indYMin = Math.floor(fy); + const indZMin = Math.floor(fz); + let indXMax = Math.floor((atom.coord.x + radius - vBoxMin.x) * xScale); + let indYMax = Math.floor((atom.coord.y + radius - vBoxMin.y) * yScale); + let indZMax = Math.floor((atom.coord.z + radius - vBoxMin.z) * zScale); + indXMax++; + indYMax++; + indZMax++; + indXMax = indXMax <= side - 1 ? indXMax : side - 1; + indYMax = indYMax <= side - 1 ? indYMax : side - 1; + indZMax = indZMax <= side - 1 ? indZMax : side - 1; + for (let y = indYMin; y <= indYMax; y++) { + const indY = y * side2; + for (let z = indZMin; z <= indZMax; z++) { + const indZ = z * side; + for (let x = indXMin; x <= indXMax; x++) { + const ind = indY + indZ + x; + this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, side, vCorner); + vDif.x = vCorner.x - atom.coord.x; + vDif.y = vCorner.y - atom.coord.y; + vDif.z = vCorner.z - atom.coord.z; + const distToSphere = Math.sqrt(vDif.x * vDif.x + vDif.y * vDif.y + vDif.z * vDif.z); + // val: < 0, if inside sphere + // val: > 0, if outside sphere + const val = distToSphere - radius; + if (val < corners[ind]) { + corners[ind] = val; + } + } // for (x) + } // for (z) + } // for (y) + } // for (s) + } - var AOHorBlurMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(AOHorBlurMaterial, _THREE$RawShaderMater); + /** + * Create memory pool for vertex hash management + * + * @param {number} maxNumVertices Maximum possible number of vertices (that will be build) + * @param {number} maxNumTriangles Maximum possible number of triangles (that will be build) + * @returns {number} 0, if success. (<0) is non memory + */ + createVertexHash(maxNumVertices, maxNumTriangles) { + this.hashLines = utils.allocateTyped(Int32Array, HASH_SIZE * 2); + if (this.hashLines === null) { + return 0 - 1; + } + for (let i = 0, j = 0; i < HASH_SIZE; i++) { + this.hashLines[j++] = 0; // num vertices in this hash line + this.hashLines[j++] = 0 - 1; // index of the first entry + } + this.maxNumVertices = maxNumVertices; + this.maxNumTriangles = maxNumTriangles; + this.numHashEtriesAllocated = maxNumVertices; + this.hashEntries = utils.allocateTyped(Int32Array, 2 * this.numHashEtriesAllocated); + if (this.hashEntries === null) { + return 0 - 1; + } + for (let i = 0, j = 0; i < this.numHashEtriesAllocated; i++) { + this.hashEntries[j++] = 0 - 1; // index of vertex + this.hashEntries[j++] = 0 - 1; // next hash entry index + } + this.numHashEntryIndex = 0; + return 0; + } - function AOHorBlurMaterial() { - var _this; + /** + * Allocate and return new hash entry. Just check possible amount. + * + * @returns {number} index of hash entry, that can be used for geometry add vertex functionality + */ + getNewHashEntry() { + if (this.numHashEntryIndex < this.numHashEtriesAllocated) { + const i = this.numHashEntryIndex; + this.numHashEntryIndex++; + return i; + } + return 0 - 1; + } - classCallCheck(this, AOHorBlurMaterial); + /** + * Add vertex to geometry structure + * using vertex hash table to quickly check, is this vertex already exist in geometry + * + * @param {object} geoOut Geometry to build + * @param {Vector3} vAdd Vertex to add + * @returns {number} index of added (or existing) vertex in geometry. + */ + addVertexToGeo(geoOut, vAdd) { + let entry; + const oneHynberes = 0.01; + const n815851 = 815851; + const n37633 = 37633; + const n2453543 = 2453543; + const r106 = 1.0e-6; + const hashResolution = this.marCubeResoultion << 2; + const v = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const ix = Math.floor(hashResolution * (vAdd.x - this.vBoxMin.x) / (this.vBoxMax.x + oneHynberes - this.vBoxMin.x)); + const iy = Math.floor(hashResolution * (vAdd.y - this.vBoxMin.y) / (this.vBoxMax.y + oneHynberes - this.vBoxMin.y)); + const iz = Math.floor(hashResolution * (vAdd.z - this.vBoxMin.z) / (this.vBoxMax.z + oneHynberes - this.vBoxMin.z)); + let iHash = ix * n815851 + iz * n37633 + iy * n2453543; + iHash &= HASH_SIZE - 1; + const hLineIndex = iHash + iHash; + + // search vertex via hash + // search in hash list + if (this.vBoxMin !== null && this.vBoxMax !== null) { + for (entry = this.hashLines[hLineIndex + 1]; entry >= 0; entry = this.hashEntries[entry * 2 + 1]) { + const ind = this.hashEntries[entry * 2 + 0]; // vertex index + v.copy(geoOut._vertices[ind]); + v.x -= vAdd.x; + v.y -= vAdd.y; + v.z -= vAdd.z; + const dot2 = v.x * v.x + v.y * v.y + v.z * v.z; + if (dot2 < r106) { + return ind; + } // if (found) + } // for (entry) + } // search + + // add new vertex to geometry + if (geoOut._numVertices >= this.maxNumVertices) { + return 0 - 1; + } + const iVertAdd = geoOut._numVertices; + geoOut._vertices[iVertAdd].copy(vAdd); + + // add to hash + if (this.vBoxMin !== null && this.vBoxMax !== null) { + entry = this.getNewHashEntry(); + if (entry < 0) { + return 0 - 1; + } + const entryFirst = this.hashLines[hLineIndex + 1]; + this.hashLines[hLineIndex + 1] = entry; + this.hashEntries[entry * 2 + 0] = iVertAdd; + this.hashEntries[entry * 2 + 1] = entryFirst; + this.hashLines[hLineIndex + 0]++; // num vertices in line ++ + } + geoOut._numVertices++; + return iVertAdd; + } - _this = possibleConstructorReturn(this, getPrototypeOf(AOHorBlurMaterial).call(this)); // set default values + /** + * + * @param {number} side some placeholder description + * @param {number} probeSphereRadius some placeholder description + * @param {object} vBoxMin some placeholder description + * @param {object} vBoxMax some placeholder description + * @param {object} geoOut some placeholder description + * @param {object} corners some placeholder description + * @returns {number} always 0 + */ + modifyExcludedFromGeo(side, probeSphereRadius, vBoxMin, vBoxMax, geoOut, corners) { + let ind; + let distToSphere; + let distToBorder; + const r11 = 1.1; + function innerBlockWorkAround() { + if (distToBorder > 0.0) { + // point is inside probe sphere + if (corners[ind] < 0.0) { + corners[ind] = distToBorder; // was inside surface, now is oustide ( > 0) + } + if (distToBorder > corners[ind]) { + corners[ind] = distToBorder; // find positive maximum + } + } else if (distToBorder > corners[ind]) { + // point is outside sphere + corners[ind] = distToBorder; // find negative maximum + } + } + const side2 = side * side; + const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x); + const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y); + const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z); + const probeSpRad2 = probeSphereRadius * 2 * (probeSphereRadius * 2); + const sideInv = 1.0 / (side - 1); + for (let i = 0; i < geoOut._numVertices; i++) { + const vCenter = geoOut._vertices[i]; + const radEst = probeSphereRadius * r11; + let indXMin = Math.floor((vCenter.x - radEst - vBoxMin.x) * xScale); + let indYMin = Math.floor((vCenter.y - radEst - vBoxMin.y) * yScale); + let indZMin = Math.floor((vCenter.z - radEst - vBoxMin.z) * zScale); + let indXMax = Math.floor((vCenter.x + radEst - vBoxMin.x) * xScale); + let indYMax = Math.floor((vCenter.y + radEst - vBoxMin.y) * yScale); + let indZMax = Math.floor((vCenter.z + radEst - vBoxMin.z) * zScale); + indXMin = indXMin >= 0 ? indXMin : 0; + indYMin = indYMin >= 0 ? indYMin : 0; + indZMin = indZMin >= 0 ? indZMin : 0; + indXMax = indXMax <= side - 1 ? indXMax : side - 1; + indYMax = indYMax <= side - 1 ? indYMax : side - 1; + indZMax = indZMax <= side - 1 ? indZMax : side - 1; + for (let iy = indYMin; iy <= indYMax; iy++) { + const indY = iy * side2; + for (let iz = indZMin; iz <= indZMax; iz++) { + const indZ = iz * side; + for (let ix = indXMin; ix <= indXMax; ix++) { + ind = indY + indZ + ix; + // getCornerCoord(vBoxMin, vBoxMax, ix, iy, iz, side, &vCorner); + let t = ix * sideInv; + const xCorner = vBoxMin.x * (1.0 - t) + vBoxMax.x * t; + t = iy * sideInv; + const yCorner = vBoxMin.y * (1.0 - t) + vBoxMax.y * t; + t = iz * sideInv; + const zCorner = vBoxMin.z * (1.0 - t) + vBoxMax.z * t; + const dx = xCorner - vCenter.x; + const dy = yCorner - vCenter.y; + const dz = zCorner - vCenter.z; + const dist2 = dx * dx + dy * dy + dz * dz; + if (dist2 < probeSpRad2) { + distToSphere = Math.sqrt(dist2); + distToBorder = -(distToSphere - probeSphereRadius); + innerBlockWorkAround(); + } // if (dist from corner point to sphere center more 2 radiuses) + } // for (ix) + } // for (iz) + } // for (iy) + } // for (i) all geo vertices + return 0; + } + _innerBuild() { + let ok; + const expandFactor = 1.2; + + // performance test + // this.performanceTest(); + + // Create temporary atoms (but colored) + const packedArrays = { + posRad: this._posRad, + colors: this._colors, + atoms: this._opts.atoms + }; + this.complex = this._opts.parent; + this.atoms = packedArrays.atoms; + this.meshResolution = this._opts.gridSpacing; + this.atomRadiusScale = this._opts.radScale; + this.colorMode = this._opts.colorMode; + this.probeRadius = this._opts.probeRadius; + this.useVertexColors = true; + this.excludeProbe = this._opts.excludeProbe; + this.visibilitySelector = this._opts.visibilitySelector; + this.geoOut = null; + this.hashLines = null; + this.hashEntries = null; + this.numHashEtriesAllocated = 0; + this.numHashEntryIndex = 0; + this.maxNumVertices = 0; + this.maxNumTriangles = 0; + const atomsColored = new Array(this.atoms.length); + this.convertToAtomsColored(packedArrays, atomsColored); + + // find bbox for spheres scene + const vBoxMin = this.vBoxMin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const vBoxMax = this.vBoxMax = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this.getBoundingBox(atomsColored, vBoxMin, vBoxMax); + const marCubeResoultion = this.marCubeResoultion = this.meshResolution * (2 + 2); + + // build grid corners for Marching cube algorithm + const side = marCubeResoultion; + const side2 = side * side; + const side3 = side2 * side; + const corners = utils.allocateTyped(Float32Array, side3); + const rProbeRadius = this.probeRadius * this.atomRadiusScale; + this.calculateGridCorners(corners, side, vBoxMin, vBoxMax, atomsColored, rProbeRadius); + const numCells = marCubeResoultion - 1; + const cube = new geometries_IsoSurfaceMarchCube(); + ok = cube.create(numCells); + if (ok < 0) { + return ok; + } + // copy corners to cells + const vCellStep = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + vCellStep.x = (vBoxMax.x - vBoxMin.x) / numCells; + vCellStep.y = (vBoxMax.y - vBoxMin.y) / numCells; + vCellStep.z = (vBoxMax.z - vBoxMin.z) / numCells; + let numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube); + let maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor); + let maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2); + this.geoOut = new geometries_IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors); + ok = this.createVertexHash(maxNumVertices, maxNumTriangles); + if (ok < 0) { + return ok; + } + + // build voxel world (used to check triangle-to-atom tie and to calculate normals and colors) + let probeRadForNormalsColors = rProbeRadius; + if (this.excludeProbe) { + probeRadForNormalsColors = 0.01; + } + this.voxelWorld = new geometries_IsosurfaceBuildNormals(atomsColored.length, atomsColored, vBoxMin, vBoxMax, probeRadForNormalsColors); + this.voxelWorld.createVoxels(); + ok = this.buildGeoFromCorners(marCubeResoultion, vBoxMin, vBoxMax, corners, vCellStep, cube); + if (this.excludeProbe) { + // using 3d mesh (geoOut) as a surface points + // move probe sphere and try to minimuze corners values + this.modifyExcludedFromGeo(side, rProbeRadius, vBoxMin, vBoxMax, this.geoOut, corners); + + // delete old builded geo + this.geoOut._vertices = null; + this.geoOut._colors = null; + this.geoOut._indices = null; + this.geoOut._normals = null; + this.geoOut._numVertices = 0; + this.geoOut._numTriangles = 0; + this.geoOut = null; + + // estimage geo vertices budget again + numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube); + maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor); + maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2); + + // creates empty new geometry + this.geoOut = new geometries_IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors); + ok = this.createVertexHash(maxNumVertices, maxNumTriangles); + if (ok < 0) { + return ok; + } + // build vertices and triangles from corners values + ok = this.buildGeoFromCorners(side, vBoxMin, vBoxMax, corners, vCellStep, cube); + } - _this.setValues.call(assertThisInitialized(_this), { - uniforms: { - depthTexture: { - type: 't', - value: null - }, - srcTexelSize: { - type: 'v2', - value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) - }, - aoMap: { - type: 't', - value: null - }, - samplesOffsets: { - type: 'fv1', - value: _kernelOffsets - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$4, - transparent: false, - depthTest: false, - depthWrite: false - }); + // build vertex normals + this.voxelWorld.buildNormals(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._normals); + // More value : more smooth color mixing + // value about 0.7: very rough colors borders + let radiusColorSmoothness = 6.5; + if (this.excludeProbe) { + radiusColorSmoothness -= 1.5; + } + if (this.useVertexColors) { + this.voxelWorld.buildColors(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._colors, radiusColorSmoothness); + } + this.voxelWorld.destroyVoxels(); + this.voxelWorld = null; - return _this; - } - - return AOHorBlurMaterial; - }(THREE.RawShaderMaterial); - - var fragmentShader$5 = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nuniform mat4 projMatrix;\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\n#ifdef USE_FOG\r\n uniform vec2 fogNearFar;\r\n uniform vec4 fogColor;\r\n#endif\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 color = texture2D(diffuseTexture, vec2(x, y));\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x, y + samplesOffsets[i] * srcTexelSize.y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb /= weightSum;\r\n\r\n #if defined(USE_FOG) && !defined(FOG_TRANSPARENT)\r\n // Add fog to the result value\r\n // Proper way to get an image with fog and ao requires formula:\r\n // gl_FragColor = fragColor*AO*(1-fogFactor) + fogColor*fogFactor\r\n // But we have already fogged molecule to add AO too. Let's split the straight formula into our real steps!\r\n // We have: AO, fogFactor, fogColor,\r\n // color = fragColor*(1-fogFactor) + fogColor*fogFactor (it comes from diffuseTexture,\r\n // where molecule has been already drawn with fog)\r\n // Transform:\r\n // fragColor*AO*(1-fogFactor) + fogColor*fogFactor =\r\n // = [fragColor*(1-fogFactor) = color - fogColor*fogFactor] =\r\n // = (color - fogColor*fogFactor)*AO + fogColor*fogFactor =\r\n // = color*AO + fogColor*fogFactor*(1 - AO)\r\n // Result: gl_FragColor = color*AO + fogColor*fogFactor*(1 - AO)\r\n float fogFactor = smoothstep(fogNearFar.x, fogNearFar.y, - viewPos.z) * fogColor.a;\r\n gl_FragColor.rgb = color.rgb * res.rgb + fogColor.rgb * fogFactor *(vec3(1.0, 1.0, 1.0) - res.rgb);\r\n #else\r\n gl_FragColor.rgb = color.rgb * res.rgb;\r\n #endif\r\n gl_FragColor.a = color.a;\r\n}\r\n"; - - var _kernelOffsets$1 = [-2.0, -1.0, 0.0, 1.0, 2.0]; - - var AOVertBlurWithBlendMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(AOVertBlurWithBlendMaterial, _THREE$RawShaderMater); - - function AOVertBlurWithBlendMaterial(params) { - var _this; - - classCallCheck(this, AOVertBlurWithBlendMaterial); - - _this = possibleConstructorReturn(this, getPrototypeOf(AOVertBlurWithBlendMaterial).call(this, params)); // set default values - - _this.setValues.call(assertThisInitialized(_this), { - uniforms: { - diffuseTexture: { - type: 't', - value: null - }, - depthTexture: { - type: 't', - value: null - }, - srcTexelSize: { - type: 'v2', - value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) - }, - aoMap: { - type: 't', - value: null - }, - samplesOffsets: { - type: 'fv1', - value: _kernelOffsets$1 - }, - projMatrix: { - type: 'mat4', - value: new THREE.Matrix4() - }, - aspectRatio: { - type: 'f', - value: 0.0 - }, - tanHalfFOV: { - type: 'f', - value: 0.0 - }, - fogNearFar: { - type: 'v2', - value: new THREE.Vector2(100.0, 100.0) - }, - fogColor: { - type: 'v4', - value: new THREE.Vector4(0.0, 0.5, 0.0, 1.0) - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$5, - transparent: false, - depthTest: false, - depthWrite: false - }); + // remove objects + cube.destroy(); + return ok; + } +} - _this.setValues(params); +// All code below must be erased from every device and each developer's memory - return _this; - } +/* harmony default export */ const geometries_SSIsosurfaceGeometry = (SSIsosurfaceGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/LabelsGeometry.js - createClass(AOVertBlurWithBlendMaterial, [{ - key: "setValues", - value: function setValues(values) { - if (typeof values === 'undefined') { - return; - } // set direct values +function createLabel(fieldTxt, className) { + const text = document.createElement('div'); + text.className = className; + if (typeof fieldTxt === 'string') { + const spanText = document.createElement('span'); + spanText.style.fontSize = '150%'; + const strings = fieldTxt.split('\n'); + for (let i = 0, n = strings.length; i < n; ++i) { + const spanNodeP = document.createElement('span'); + const spanNodeText = document.createTextNode(strings[i]); + spanNodeP.appendChild(spanNodeText); + spanText.appendChild(spanNodeP); + if (i < n - 1) { + spanText.appendChild(document.createElement('br')); + } + } + text.appendChild(spanText); + } else { + text.appendChild(fieldTxt); + } + text.worldPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + return text; +} +class LabelsGeometry extends utils_EventDispatcher { + constructor(instanceCount, opts) { + super(); + this._opts = opts; + this.items = []; + this.needsUpdate = false; + let xTranslation = -50; + let yTranslation = -50; + switch (opts.horizontalAlign) { + case 'left': + xTranslation = 0; + break; + case 'right': + xTranslation = -100; + break; + default: + break; + } + switch (opts.verticalAlign) { + case 'top': + yTranslation = -100; + break; + case 'bottom': + yTranslation = 0; + break; + default: + break; + } + const deltaPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(opts.dx || 0, opts.dy || 0, opts.dz || 0); + this.userData = { + translation: `translate(${xTranslation}%, ${yTranslation}%)`, + offset: deltaPos + }; + } + setItem(itemIdx, itemPos, fieldTxt) { + const opts = this._opts; + const text = this.items[itemIdx] || createLabel(fieldTxt, 'label'); + text.worldPos.copy(itemPos); + text.style.textAlign = opts.horizontalAlign; + text.style.verticalAlign = opts.verticalAlign; + this.items[itemIdx] = text; + } + setColor(itemIdx, fColor, bColor) { + const text = this.items[itemIdx]; + text.opts = { + color: fColor, + background: bColor + }; + } + startUpdate() { + return true; + } + finishUpdate() { + this.needsUpdate = true; + this.dispatchEvent({ + type: 'update' + }); + } + finalize() { + this.finishUpdate(); + } - get(getPrototypeOf(AOVertBlurWithBlendMaterial.prototype), "setValues", this).call(this, values); + // unimplemented functions + raycast() {} + setOpacity() {} + getSubset() { + return []; + } +} +/* harmony default export */ const geometries_LabelsGeometry = (LabelsGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/geometries.js - var defines = {}; - if (this.useFog) { - defines.USE_FOG = 1; - } - if (this.fogTransparent) { - defines.FOG_TRANSPARENT = 1; - } // set dependent values - this.defines = defines; - } - }]); - return AOVertBlurWithBlendMaterial; - }(THREE.RawShaderMaterial); - AOVertBlurWithBlendMaterial.prototype.useFog = true; - AOVertBlurWithBlendMaterial.prototype.fogTransparent = false; - var fragmentShader$6 = "precision highp float;\r\n\r\nuniform sampler2D srcL;\r\nuniform sampler2D srcR;\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vec4 l = texture2D(srcL, vUv);\r\n vec4 r = texture2D(srcR, vUv);\r\n gl_FragColor = vec4(l.r, r.g, r.b, 1.0);\r\n}\r\n"; - var AnaglyphMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(AnaglyphMaterial, _THREE$RawShaderMater); - function AnaglyphMaterial() { - var _this; - classCallCheck(this, AnaglyphMaterial); - _this = possibleConstructorReturn(this, getPrototypeOf(AnaglyphMaterial).call(this)); - var settings = { - uniforms: { - srcL: { - type: 't', - value: null - }, - srcR: { - type: 't', - value: null - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$6, - transparent: false, - depthTest: false, - depthWrite: false - }; +/* harmony default export */ const geometries = ({ + InstancedSpheresGeometry: geometries_InstancedSpheresGeometry, + SimpleSpheresGeometry: geometries_SimpleSpheresGeometry, + Simple2CCylindersGeometry: geometries_Simple2CCylindersGeometry, + Instanced2CCylindersGeometry: geometries_Instanced2CCylindersGeometry, + ExtrudedObjectsGeometry: geometries_ExtrudedObjectsGeometry, + ChunkedLinesGeometry: geometries_ChunkedLinesGeometry, + TwoColorLinesGeometry: geometries_TwoColorLinesGeometry, + CrossGeometry: geometries_CrossGeometry, + QuickSurfGeometry: geometries_QuickSurfGeometry, + ContactSurfaceGeometry: geometries_ContactSurfaceGeometry, + SSIsosurfaceGeometry: geometries_SSIsosurfaceGeometry, + LabelsGeometry: geometries_LabelsGeometry +}); +;// CONCATENATED MODULE: ./src/gfx/shaders/Uber.vert +const Uber_namespaceObject = "float INSTANCED_SPRITE_OVERSCALE = 1.3;\r\n\r\nattribute vec3 normal;\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n varying vec3 viewNormal;\r\n#endif\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n varying vec3 vNormal;\r\n#endif\r\n\r\n#ifdef THICK_LINE\r\n attribute vec4 position; // W contains vert pos or neg offset\r\n#else\r\n attribute vec3 position;\r\n#endif\r\n\r\nvarying vec3 vWorldPosition;\r\nvarying vec3 vViewPosition;\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n attribute float alphaColor;\r\n varying float alphaCol;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n attribute vec3 color;\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n attribute vec3 color2;\r\n varying vec3 vColor2;\r\n attribute vec2 uv;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_POS\r\n attribute vec4 offset;\r\n #ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n varying vec4 spritePosEye;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n attribute vec4 matVector1;\r\n attribute vec4 matVector2;\r\n attribute vec4 matVector3;\r\n attribute vec4 invmatVector1;\r\n attribute vec4 invmatVector2;\r\n attribute vec4 invmatVector3;\r\n\r\n #ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n varying vec4 spritePosEye;\r\n #endif\r\n#endif\r\n\r\nuniform mat4 modelViewMatrix; // optional\r\nuniform mat4 projectionMatrix; // optional\r\nuniform mat3 normalMatrix; // optional\r\nuniform mat4 modelMatrix; // optional\r\n\r\n#ifdef DASHED_LINE\r\n attribute float lineDistance;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n#ifdef THICK_LINE\r\n attribute vec3 direction;\r\n uniform mat4 projMatrixInv;\r\n uniform vec2 viewport;\r\n uniform float lineWidth;\r\n\r\n vec4 transform(vec4 coord){\r\n return projectionMatrix * modelViewMatrix * coord;\r\n }\r\n\r\n vec2 project(vec4 device){\r\n vec3 device_normal = device.xyz/device.w;\r\n vec2 clip_pos = (device_normal*0.5+0.5).xy;\r\n return clip_pos * viewport;\r\n }\r\n\r\n vec4 unproject(vec2 screen, float z, float w){\r\n vec2 clip_pos = screen/viewport;\r\n vec2 device_normal = clip_pos*2.0-1.0;\r\n return vec4(device_normal*w, z, w);\r\n }\r\n#endif\r\n\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n alphaCol = alphaColor;\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n vec3 objectNormal = vec3(\r\n dot(normal, matVector1.xyz),\r\n dot(normal, matVector2.xyz),\r\n dot(normal, matVector3.xyz));\r\n#else\r\n vec3 objectNormal = vec3( normal );\r\n#endif\r\n\r\nvec3 transformedNormal = normalMatrix * objectNormal;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n vNormal = normalize(transformedNormal);\r\n#endif\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n viewNormal = normalize(mat3(modelViewMatrix)*objectNormal);\r\n#endif\r\n\r\n vec4 localPos = vec4(position.xyz, 1.0);\r\n vec4 worldPos = modelMatrix * localPos;\r\n vec4 mvPosition = modelViewMatrix * localPos;\r\n\r\n// make thick line offset\r\n#ifdef THICK_LINE\r\n // get screen pos\r\n vec4 dPos = transform(vec4(position.xyz, 1.0));\r\n vec2 sPos = project(dPos);\r\n // move pos forward\r\n vec3 position2 = position.xyz + direction.xyz * 0.5;\r\n // get screen offset pos\r\n vec4 dPos2 = transform(vec4(position2.xyz, 1.0));\r\n vec2 sPos2 = project(dPos2);\r\n // screen line direction\r\n vec2 sDir = normalize(sPos2 - sPos);\r\n // vertex offset (orthogonal to line direction)\r\n vec2 offset1 = vec2(-sDir.y, sDir.x);\r\n // move screen vertex\r\n vec2 newPos = sPos + offset1 * position.w * lineWidth;\r\n // get moved pos in view space\r\n vec4 dNewPos = unproject(newPos, dPos.z, dPos.w);\r\n mvPosition.xyz = (projMatrixInv * dNewPos).xyz;\r\n#endif // THICK_LINE\r\n\r\n#ifdef INSTANCED_POS\r\n #ifdef SPHERE_SPRITE\r\n instOffset = offset;\r\n\r\n vec4 posEye = modelViewMatrix * vec4( offset.xyz, 1.0 );\r\n float scale = length(modelViewMatrix[0]);\r\n mvPosition = posEye + vec4( position.xyz * offset.w * scale * INSTANCED_SPRITE_OVERSCALE, 0.0 );\r\n posEye.w = offset.w * scale;\r\n\r\n spritePosEye = posEye;\r\n #else\r\n localPos = vec4( offset.xyz + position.xyz * offset.w, 1.0 );\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n #ifdef CYLINDER_SPRITE\r\n matVec1 = matVector1;\r\n matVec2 = matVector2;\r\n matVec3 = matVector3;\r\n invmatVec1 = invmatVector1;\r\n invmatVec2 = invmatVector2;\r\n invmatVec3 = invmatVector3;\r\n\r\n // calculate eye coords of cylinder endpoints\r\n vec4 v = vec4(0, -0.5, 0, 1);\r\n vec4 p1 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n v.y = 0.5;\r\n vec4 p2 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n\r\n // sprite is placed at the center of cylinder\r\n vec4 posEye;\r\n posEye.xyz = mix(p1.xyz, p2.xyz, 0.5);\r\n posEye.w = 1.0;\r\n spritePosEye = posEye;\r\n\r\n // cylinder radius in eye space\r\n float rad = length(modelViewMatrix[0]) * length(vec3(matVector1.x, matVector2.x, matVector3.x));\r\n vec2 spriteSize;\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // In ortho projection we skip z coordinate\r\n // basic sprite size at screen plane (covers only cylinder axis)\r\n vec2 spriteSizeScreen = abs(p2.xy - p1.xy);\r\n\r\n spriteSize = vec2(1.0, 1.0) * INSTANCED_SPRITE_OVERSCALE * (spriteSizeScreen + 2.0 * rad);\r\n #else\r\n // basic sprite size at screen plane (covers only cylinder axis)\r\n vec2 spriteSizeScreen = abs(p2.xy / p2.z - p1.xy / p1.z);\r\n\r\n // full sprite size in eye coords\r\n float minZ = min(abs(p1.z), abs(p2.z));\r\n spriteSize = vec2(1.0, 1.0) * INSTANCED_SPRITE_OVERSCALE * abs(posEye.z) * (spriteSizeScreen + 2.0 * rad / minZ);\r\n #endif\r\n\r\n mvPosition = posEye + vec4( position.xy * 0.5 * spriteSize, 0, 0 );\r\n #else\r\n localPos = vec4(dot(localPos, matVector1), dot(localPos, matVector2), dot(localPos, matVector3), 1.0);\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n gl_Position = projectionMatrix * mvPosition;\r\n\r\n vWorldPosition = worldPos.xyz;\r\n vViewPosition = - mvPosition.xyz;\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t vec4 worldPosition;\r\n\t // see THREE.WebGLProgram.unrollLoops\r\n\t #pragma unroll_loop_start\r\n\t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * vec4(vWorldPosition, 1.0);\r\n vDirectionalShadowNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(objectNormal, 0.0))).xyz;\r\n\t }\r\n\t #pragma unroll_loop_end\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n vColor = color.xyz;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n vColor2 = color2;\r\n #ifndef CYLINDER_SPRITE\r\n vUv = uv;\r\n #endif\r\n#endif\r\n\r\n#ifdef DASHED_LINE\r\n vLineDistance = lineDistance;\r\n#endif\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/Uber.frag +const gfx_shaders_Uber_namespaceObject = "#if defined (NORMALS_TO_G_BUFFER)\r\n #define fragColor gl_FragData[0]\r\n#else\r\n #define fragColor gl_FragColor\r\n#endif\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n varying float alphaCol;\r\n#endif\r\n\r\n#ifdef COLOR_FROM_POS\r\n uniform mat4 world2colorMatrix;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\r\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ]; //only for sprites\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n vec4 vDirLightWorldCoord[ NUM_DIR_LIGHTS ];\r\n vec3 vDirLightWorldNormal[ NUM_DIR_LIGHTS ];\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n // We use 4 instead uniform variable or define because this value is used in for(... i < value; ...) with\r\n // unroll_loop and unroll_loop has pattern:\r\n // /#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g\r\n uniform vec2 samplesKernel[4]; // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n uniform sampler2D noiseTex;\r\n uniform vec2 noiseTexelSize;\r\n uniform vec2 srcTexelSize;\r\n uniform mat4 projectionMatrix;\r\n #endif\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n varying vec3 vColor2;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\nuniform vec3 diffuse;\r\nuniform vec3 emissive;\r\nuniform vec3 specular;\r\nuniform float shininess;\r\nuniform vec3 fixedColor;\r\nuniform float opacity;\r\nuniform float zClipValue;\r\nuniform float clipPlaneValue;\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n varying vec3 viewNormal;\r\n#endif\r\n\r\n#define RECIPROCAL_PI 0.31830988618\r\n#define saturate(a) clamp( a, 0.0, 1.0 )\r\n\r\n#ifdef USE_FOG\r\n uniform vec3 fogColor;\r\n uniform float fogAlpha;\r\n uniform float fogNear;\r\n uniform float fogFar;\r\n#endif\r\n\r\nvarying vec3 vWorldPosition; // world position of the pixel (invalid when INSTANCED_SPRITE is defined)\r\nvarying vec3 vViewPosition;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n varying vec3 vNormal;\r\n#endif\r\n\r\n/////////////////////////////////////////// ZSprites ////////////////////////////////////////////////\r\n#if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r\n uniform float nearPlaneValue;\r\n#endif\r\n\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 spritePosEye;\r\n#endif\r\n\r\n#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n uniform float zOffset;\r\n\r\n #if !defined(USE_LIGHTS) || !defined(SHADOWMAP) || !defined(SHADOWMAP_PCF_RAND) || !(NUM_DIR_LIGHTS > 0)\r\n uniform mat4 projectionMatrix;\r\n #endif\r\n\r\n float calcDepthForSprites(vec4 pixelPosEye, float zOffset, mat4 projMatrix) {\r\n vec4 pixelPosScreen = projMatrix * pixelPosEye;\r\n return 0.5 * (pixelPosScreen.z / pixelPosScreen.w + 1.0) + zOffset;\r\n }\r\n#endif\r\n\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n\r\n bool intersect_ray_sphere(in vec3 origin, in vec3 ray, out vec3 point, out float frontFaced) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray, ray);\r\n float b = dot(ray, origin);\r\n float c = dot(origin, origin) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return false;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n // choose nearest point inside frustum\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // orthografic camera is used for dirLight sources. So in it for all spheres the point with smaller 't' is visible\r\n // t1 is always smaller than t2 (from calculations)\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n #else\r\n // for perspective camera first intersection can be in front of near plane. If not intersection is p1 else - p2\r\n // t* = 0.0 corresponds to point of intersection near plane by the ray from camera to curPixel\r\n if (t1 >= 0.0) {\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n }\r\n if (t2 >= 0.0) {\r\n point = p2;\r\n frontFaced = -1.0;\r\n return true;\r\n }\r\n #endif\r\n\r\n return false;\r\n }\r\n\r\n bool get_sphere_point(in vec3 pixelPosEye, out vec3 point, out float frontFaced) {\r\n vec3 origin, ray;\r\n\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // transform vector from sprite center to curPixel into sphere local coords\r\n origin = pixelPosEye.xyz - spritePosEye.xyz;\r\n origin = (invModelViewMatrix * vec4(origin, 0.0)).xyz / instOffset.w;\r\n\r\n // transform camera orientation vector into sphere local coords\r\n ray = (invModelViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\r\n #else\r\n // find point of intersection near plane by the ray from camera to curPixel\r\n vec4 v = vec4(-(nearPlaneValue / pixelPosEye.z) * pixelPosEye, 1.0);\r\n\r\n // transform intersection point into sphere local coords\r\n v = invModelViewMatrix * v;\r\n origin = (v.xyz - instOffset.xyz) / instOffset.w;\r\n\r\n // transform vector from camera pos to curPixel into sphere local coords\r\n ray = (invModelViewMatrix * vec4(pixelPosEye, 0.0)).xyz;\r\n #endif\r\n ray = normalize(ray);\r\n\r\n return intersect_ray_sphere(origin, ray, point, frontFaced);\r\n }\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n varying vec4 spritePosEye;\r\n\r\n bool intersect_ray_cylinder(in vec3 origin, in vec3 ray, out vec3 point, out float frontFaced) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray.xz, ray.xz);\r\n float b = dot(ray.xz, origin.xz);\r\n float c = dot(origin.xz, origin.xz) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return false;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n float halfHeight = 0.5;\r\n\r\n // choose nearest point\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // orthografic camera is used for dirLight sources. So in it for all cylinders the point with smaller 't' is visible\r\n // if it is not outside of cylinnder (t1 is always smaller than t2).\r\n if (p1.y >= -halfHeight && p1.y <= halfHeight) {\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n }\r\n if (p2.y >= -halfHeight && p2.y <= halfHeight) {\r\n point = p2;\r\n frontFaced = -1.0;\r\n return true;\r\n }\r\n #else\r\n // for perspective camera first intersection can be in front of near plane. If not intersection is p1 else - p2\r\n // t* = 0.0 corresponds to point of intersection near plane by the ray from camera to curPixel\r\n if (t1 >= 0.0 && p1.y >= -halfHeight && p1.y <= halfHeight) {\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n }\r\n if (t2 >= 0.0 && p2.y >= -halfHeight && p2.y <= halfHeight) {\r\n point = p2;\r\n frontFaced = -1.0;\r\n return true;\r\n }\r\n #endif\r\n\r\n return false;\r\n }\r\n\r\n bool get_cylinder_point(in vec3 pixelPosEye, out vec3 point, out float frontFaced) {\r\n vec3 origin, ray;\r\n vec4 v;\r\n\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // transform vector from sprite center to curPixel into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye.xyz - spritePosEye.xyz, 0.0);\r\n origin = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n\r\n // transform camera orientation vector into cylinder local coords\r\n v = invModelViewMatrix * vec4(0.0, 0.0, -1.0, 0.0);\r\n ray = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n #else\r\n // find point of intersection near plane by the ray from camera to curPixel\r\n v = vec4(-(nearPlaneValue / pixelPosEye.z) * pixelPosEye, 1.0);\r\n\r\n // transform intersection point into cylinder local coords\r\n v = invModelViewMatrix * v;\r\n origin = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n\r\n // transform vector from camera pos to curPixel into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye, 0.0);\r\n ray = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n #endif\r\n ray = normalize(ray);\r\n\r\n return intersect_ray_cylinder(origin, ray, point, frontFaced);\r\n }\r\n#endif\r\n\r\n///////////////////////////////////// Pack and unpack ///////////////////////////////////////////////\r\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\r\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\r\n\r\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\r\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\r\n\r\n\r\nconst float ShiftRight8 = 1. / 256.;\r\n\r\nvec4 packDepthToRGBA( const in float v ) {\r\n vec4 r = vec4( fract( v * PackFactors ), v );\r\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\r\n return r * PackUpscale;\r\n}\r\n\r\nfloat unpackRGBAToDepth( const in vec4 v ) {\r\n return dot( v, UnpackFactors );\r\n}\r\n\r\n////////////////////////////////////////// All Lighting /////////////////////////////////////////////////\r\n#ifdef TOON_SHADING\r\n #define LOW_TOON_BORDER 0.0\r\n #define MEDIUM_TOON_BORDER 0.7\r\n #define HIGH_TOON_BORDER 1.0\r\n\r\n #define MEDIUM_TOON_RANGE 0.5\r\n #define HIGH_TOON_RANGE 0.95\r\n#endif\r\n#if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n struct ReflectedLight {\r\n vec3 directDiffuse;\r\n vec3 directSpecular;\r\n vec3 indirectDiffuse;\r\n };\r\n\r\n struct BlinnPhongMaterial {\r\n vec3 diffuseColor;\r\n vec3 specularColor;\r\n float specularShininess;\r\n };\r\n\r\n struct GeometricContext {\r\n vec3 normal;\r\n vec3 viewDir;\r\n };\r\n\r\n struct DirectionalLight {\r\n vec3 direction;\r\n vec3 color;\r\n };\r\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\r\n\r\n struct DirectionalLightShadow {\r\n vec2 shadowMapSize;\r\n float shadowBias;\r\n float shadowRadius;\r\n };\r\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHTS ];\r\n\r\n uniform vec3 ambientLightColor;\r\n\r\n /////////////////////////////////////////// Shadowmap ////////////////////////////////////////////////\r\n\r\n #if defined(SHADOWMAP)\r\n \tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\r\n \t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\r\n \t}\r\n\r\n float getShadow( sampler2D shadowMap, DirectionalLightShadow dirLight, vec4 shadowCoord, vec3 vViewPosition, vec3 vNormal ) {\r\n \t float shadow = 0.0;\r\n\r\n // When shadows for sprites will appear use here for them normals as it done for G-buffer\r\n shadowCoord.xyz += dirLight.shadowBias * vNormal;\r\n shadowCoord.xyz /= shadowCoord.w;\r\n\r\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\r\n bool inFrustum = all( inFrustumVec );\r\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\r\n bool frustumTest = all( frustumTestVec );\r\n\r\n if ( frustumTest ) {\r\n #ifdef SHADOWMAP_BASIC\r\n \t shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\r\n \t#endif\r\n\r\n \t#ifdef SHADOWMAP_PCF_SHARP\r\n \t vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n float dx0 = - texelSize.x * dirLight.shadowRadius;\r\n float dy0 = - texelSize.y * dirLight.shadowRadius;\r\n float dx1 = + texelSize.x * dirLight.shadowRadius;\r\n float dy1 = + texelSize.y * dirLight.shadowRadius;\r\n\r\n shadow = (\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\r\n ) * ( 1.0 / 9.0 );\r\n #endif\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n vec4 vUv = ((projectionMatrix * vec4(vViewPosition, 1.0)) + 1.0) / 2.0;\r\n vec2 vUvNoise = vUv.xy / srcTexelSize * noiseTexelSize;\r\n\r\n vec2 noiseVec = normalize(texture2D(noiseTex, vUvNoise).rg);\r\n mat2 mNoise = mat2(noiseVec.x, noiseVec.y, -noiseVec.y, noiseVec.x);\r\n\r\n vec2 offset;\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < 4; i ++ ) { // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n offset = mNoise * ( normalize( samplesKernel[ i ]) * texelSize * dirLight.shadowRadius );\r\n shadow += texture2DCompare( shadowMap, shadowCoord.xy + offset, shadowCoord.z );\r\n }\r\n #pragma unroll_loop_end\r\n shadow /= float( 4 ); // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n #endif\r\n }\r\n return shadow;//(shadow != 1.0) ? 0.5 : 1.0;//vec4(shadow, shadow, shadow, 1.0);\r\n }\r\n #endif\r\n\r\n /////////////////////////////////////////// Lighting /////////////////////////////////////////////////\r\n\r\n vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\r\n return RECIPROCAL_PI * diffuseColor;\r\n } // validated\r\n\r\n vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\r\n // Original approximation by Christophe Schlick '94\r\n //;float fresnel = pow( 1.0 - dotLH, 5.0 );\r\n // Optimized variant (presented by Epic at SIGGRAPH '13)\r\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\r\n return ( 1.0 - specularColor ) * fresnel + specularColor;\r\n } // validated\r\n\r\n float G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\r\n // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\r\n return 0.25;\r\n }\r\n\r\n float D_BlinnPhong( const in float shininess, const in float dotNH ) {\r\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\r\n }\r\n\r\n vec3 BRDF_Specular_BlinnPhong( const in DirectionalLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\r\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\r\n float dotNH = saturate(dot( geometry.normal, halfDir ));\r\n float dotLH = saturate(dot( incidentLight.direction, halfDir ));\r\n\r\n vec3 F = F_Schlick( specularColor, dotLH );\r\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\r\n float D = D_BlinnPhong( shininess, dotNH );\r\n\r\n return F * ( G * D );\r\n } // validated\r\n\r\n void RE_Direct_BlinnPhong( const in DirectionalLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight, float penumbra ) {\r\n\r\n float dotNL = saturate( dot( geometry.normal, directLight.direction ));\r\n #ifdef TOON_SHADING\r\n if(dotNL < MEDIUM_TOON_RANGE){\r\n dotNL = LOW_TOON_BORDER;\r\n }\r\n else if(dotNL < HIGH_TOON_RANGE){\r\n dotNL = MEDIUM_TOON_BORDER;\r\n }\r\n else{\r\n dotNL = HIGH_TOON_BORDER;\r\n }\r\n #endif\r\n\r\n vec3 irradiance = dotNL * directLight.color;\r\n reflectedLight.directDiffuse += penumbra * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n reflectedLight.directSpecular += penumbra * irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess );\r\n }\r\n\r\n void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\r\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n }\r\n\r\n vec3 calcLighting(const in GeometricContext geometry, const in BlinnPhongMaterial material, vec3 vViewPosition) {\r\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\r\n vec3 irradiance = ambientLightColor;\r\n\r\n float shadowMask = 1.0;\r\n // see THREE.WebGLProgram.unrollLoops\r\n \t#pragma unroll_loop_start\r\n \t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n \t #ifdef SHADOWMAP\r\n \t shadowMask = getShadow( directionalShadowMap[ i ], directionalLightShadows[ i ], vDirLightWorldCoord[ i ], vViewPosition, vDirLightWorldNormal[ i ] );\r\n #endif\r\n\r\n \t\t if ( shadowMask > 0.0 ) RE_Direct_BlinnPhong( directionalLights[ i ], geometry, material, reflectedLight, shadowMask );\r\n \t\t}\r\n \t\t#pragma unroll_loop_end\r\n\r\n RE_IndirectDiffuse_BlinnPhong(irradiance, material, reflectedLight);\r\n\r\n return saturate(reflectedLight.indirectDiffuse + reflectedLight.directDiffuse + reflectedLight.directSpecular);\r\n }\r\n#endif\r\n\r\n/////////////////////////////////////////// Dashed Line ///////////////////////////////////////////////\r\n#ifdef DASHED_LINE\r\n uniform float dashedLineSize;\r\n uniform float dashedLinePeriod;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef CLIP_PLANE\r\n if (vViewPosition.z < clipPlaneValue) discard;\r\n#endif\r\n\r\n#ifdef ZCLIP\r\n if (vViewPosition.z < zClipValue) discard;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n #if NUM_DIR_LIGHTS > 0\r\n // see THREE.WebGLProgram.unrollLoops\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirLightWorldCoord[ i ] = vDirectionalShadowCoord[ i ];\r\n vDirLightWorldNormal[ i ] = vDirectionalShadowNormal[ i ];\r\n }\r\n #pragma unroll_loop_end\r\n #endif\r\n#endif\r\n\r\n vec4 pixelPosWorld = vec4(vWorldPosition, 1.0);\r\n vec4 pixelPosEye;\r\n\r\n#ifdef SPHERE_SPRITE\r\n\r\n vec3 viewNormalSprites;\r\n float frontFaced = 1.0;\r\n vec3 normal;\r\n\r\n/* quick-and-dirty method\r\n normal.xy = ' + INSTANCED_SPRITE_OVERSCALE + ' * (2.0 * vUv - 1.0);\r\n float r2 = dot(normal.xy, normal.xy);\r\n if (r2 > 1.0) discard;\r\n float normalZ = sqrt(1.0 - r2);\r\n normal.z = normalZ;\r\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\r\n pixelPosEye = vec4(spritePosEye.xyz, 1.0);\r\n pixelPosEye.z += spritePosEye.w * normalZ;\r\n*/\r\n\r\n // ray-trace sphere surface\r\n {\r\n vec3 p;\r\n if (!get_sphere_point(-vViewPosition, p, frontFaced)) discard;\r\n vec4 v = vec4(instOffset.xyz + p * instOffset.w, 1.0);\r\n pixelPosWorld = modelMatrix * v;\r\n pixelPosEye = modelViewMatrix * v;\r\n normal = normalize(normalMatrix * p);\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*p);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n #if NUM_DIR_LIGHTS > 0\r\n // see THREE.WebGLProgram.unrollLoops\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirLightWorldCoord[ i ] = directionalShadowMatrix[ i ] * pixelPosWorld;\r\n vDirLightWorldNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(p, 0.0))).xyz;\r\n }\r\n #pragma unroll_loop_end\r\n #endif\r\n #endif\r\n }\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n vec3 normal;\r\n vec3 viewNormalSprites;\r\n float frontFaced = 1.0;\r\n float cylinderY = 0.0;\r\n\r\n // ray-trace cylinder surface\r\n {\r\n vec3 p;\r\n if (!get_cylinder_point(-vViewPosition, p, frontFaced)) discard;\r\n\r\n cylinderY = 0.5 * (p.y + 1.0);\r\n\r\n vec4 v = vec4(p, 1.0);\r\n v = vec4(dot(v, matVec1), dot(v, matVec2), dot(v, matVec3), 1.0);\r\n pixelPosWorld = modelMatrix * v;\r\n pixelPosEye = modelViewMatrix * v;\r\n\r\n vec3 localNormal = normalize(vec3(p.x, 0.0, p.z));\r\n normal = vec3(\r\n dot(localNormal, matVec1.xyz),\r\n dot(localNormal, matVec2.xyz),\r\n dot(localNormal, matVec3.xyz));\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*normal);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n #if NUM_DIR_LIGHTS > 0\r\n // see THREE.WebGLProgram.unrollLoops\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirLightWorldCoord[ i ] = directionalShadowMatrix[ i ] * pixelPosWorld;\r\n vDirLightWorldNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(normal, 0.0))).xyz;\r\n }\r\n #pragma unroll_loop_end\r\n #endif\r\n #endif\r\n\r\n normal = normalize(normalMatrix * normal);\r\n }\r\n#endif\r\n\r\n #ifdef ATTR_COLOR\r\n vec3 vertexColor = vColor;\r\n #else\r\n vec3 vertexColor = vec3(1.0, 1.0, 1.0);\r\n #endif\r\n\r\n #ifdef ATTR_COLOR2\r\n #ifdef CYLINDER_SPRITE\r\n float colorCoef = cylinderY; // cylinder parameter is calculated from ray-tracing\r\n #else\r\n float colorCoef = vUv.y; // cylinder parameter is interpolated as tex coord\r\n #endif\r\n // choose either color or color2\r\n vertexColor = mix(vColor2, vColor, step(0.5, colorCoef));\r\n #endif\r\n\r\n // negative red component is a special condition\r\n if (vertexColor.x < 0.0) discard;\r\n\r\n #ifdef DASHED_LINE\r\n if ( mod( vLineDistance, dashedLinePeriod ) > dashedLineSize ) discard;\r\n #endif\r\n\r\n // transparency prepass writes only z, so we don't need to calc the color\r\n #ifdef PREPASS_TRANSP\r\n fragColor = vec4(1.0, 1.0, 1.0, 1.0);\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n return;\r\n #endif\r\n\r\n float totalOpacity = opacity;\r\n\r\n #ifdef ATTR_ALPHA_COLOR\r\n totalOpacity *= alphaCol;\r\n #endif\r\n\r\n // discard fully transparent pixels\r\n if (totalOpacity == 0.0) discard;\r\n\r\n #ifdef FAKE_OPACITY\r\n // discard pixels in checker pattern\r\n vec2 dm_coord = floor(gl_FragCoord.xy);\r\n dm_coord = fract(dm_coord * 0.5);\r\n if (totalOpacity < 1.0 && (dm_coord.x < 0.5 ^^ dm_coord.y < 0.5)) discard;\r\n vec4 diffuseColor = vec4(diffuse, 1.0);\r\n #else\r\n vec4 diffuseColor = vec4(diffuse, totalOpacity);\r\n #endif\r\n\r\n float flipNormal;\r\n #if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n flipNormal = 1.0;\r\n #ifdef DOUBLE_SIDED\r\n flipNormal = float( gl_FrontFacing );\r\n #endif\r\n vec3 normal = normalize( vNormal ) * flipNormal;\r\n #endif\r\n\r\n diffuseColor.rgb *= vertexColor;\r\n\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n\r\n #ifdef NORMALS_TO_G_BUFFER\r\n #if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r\n vec3 viewNormaInColor = viewNormalSprites;\r\n #else\r\n vec3 viewNormaInColor = viewNormal;\r\n float frontFaced = float( gl_FrontFacing );\r\n #endif\r\n // [-1, 1] -> [0, 1]\r\n viewNormaInColor = 0.5 * viewNormaInColor + 0.5;\r\n gl_FragData[1] = vec4(viewNormaInColor, frontFaced);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n vec3 viewDir;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n viewDir = -pixelPosEye.xyz;\r\n #else\r\n viewDir = vViewPosition;\r\n #endif\r\n GeometricContext geometry = GeometricContext(normal, normalize( viewDir ));\r\n BlinnPhongMaterial material = BlinnPhongMaterial(diffuseColor.rgb, specular, shininess);\r\n vec3 outgoingLight = calcLighting(geometry, material, viewDir);\r\n #else\r\n vec3 outgoingLight = diffuseColor.rgb;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_DEPTH\r\n float depth = 0.0;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n depth = gl_FragDepthEXT;\r\n #else\r\n depth = gl_FragCoord.z;\r\n #endif\r\n fragColor = packDepthToRGBA(depth);\r\n return;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_POS\r\n fragColor = world2colorMatrix * pixelPosWorld;\r\n #else\r\n #ifdef OVERRIDE_COLOR\r\n fragColor = vec4(fixedColor, diffuseColor.a);\r\n #else\r\n fragColor = vec4(outgoingLight, diffuseColor.a);//vec4(vNormal, 1.0);\r\n #endif\r\n\r\n #ifdef USE_FOG\r\n float viewDistance;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n viewDistance = abs(pixelPosEye.z);\r\n #else\r\n viewDistance = vViewPosition.z;\r\n #endif\r\n float fogFactor = smoothstep( fogNear, fogFar, viewDistance) * fogAlpha;\r\n #ifdef FOG_TRANSPARENT\r\n fragColor.a = fragColor.a * (1.0 - fogFactor);\r\n #else\r\n fragColor.rgb = mix( fragColor.rgb, fogColor, fogFactor );\r\n #endif\r\n #endif\r\n\r\n #endif\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/capabilities.js +/* harmony default export */ const capabilities = ({ + precision: 'mediump', + /** + * + * @param {THREE.WebGLRenderer} renderer + */ + init(renderer) { + this.precision = renderer.capabilities.getMaxPrecision('highp'); + } +}); +;// CONCATENATED MODULE: ./src/gfx/noiseTexture.js + +const noiseWidth = 4; +const noiseHeight = 4; +const _noiseData = new Uint8Array([24, 52, 0, 255, 254, 145, 0, 255, 122, 0, 0, 255, 7, 170, 0, 255, 34, 214, 0, 255, 173, 8, 0, 255, 86, 249, 0, 255, 160, 4, 0, 255, 226, 46, 0, 255, 224, 211, 0, 255, 3, 157, 0, 255, 174, 247, 0, 255, 12, 182, 0, 255, 220, 216, 0, 255, 1, 109, 0, 255, 253, 154, 0, 255]); +const _noiseWrapS = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RepeatWrapping; +const _noiseWrapT = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RepeatWrapping; +const _noiseMinFilter = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.NearestFilter; +const _noiseMagFilter = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.NearestFilter; +const _noiseMapping = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UVMapping; +const noiseTexture = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.DataTexture(_noiseData, noiseWidth, noiseHeight, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UnsignedByteType, _noiseMapping, _noiseWrapS, _noiseWrapT, _noiseMagFilter, _noiseMinFilter, 1); +noiseTexture.needsUpdate = true; +/* harmony default export */ const gfx_noiseTexture = ({ + noiseWidth, + noiseHeight, + noiseTexture +}); +;// CONCATENATED MODULE: ./src/gfx/shaders/UberMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ + + + + + + +// Length of _samplesKernel is used in Uber.frag +// If you want to change length of _samplesKernel, please, remember change it in Uber.frag too. +// You can easy find places for replace using word:_samplesKernel +const _samplesKernel = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(-0.541978, 0.840393), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(0.125533, -0.992089), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(0.374329, 0.927296), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(-0.105475, 0.994422)]; +const defaultUniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UniformsUtils.merge([external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UniformsLib.fog, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UniformsLib.lights, { + // are updated automatically by three.js (see THREE.ShaderLib.common) + diffuse: { + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(0xeeeeee) + }, + opacity: { + value: 1.0 + }, + specular: { + type: 'c', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(0x111111) + }, + shininess: { + type: 'f', + value: 30 + }, + fixedColor: { + type: 'c', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(0xffffff) + }, + zOffset: { + type: 'f', + value: 0.0 + }, + zClipValue: { + type: 'f', + value: 0.0 + }, + clipPlaneValue: { + type: 'f', + value: 0.0 + }, + nearPlaneValue: { + type: 'f', + value: -0.5 + }, + invModelViewMatrix: { + type: '4fv', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4() + }, + world2colorMatrix: { + type: '4fv', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4() + }, + dashedLineSize: { + type: 'f', + value: 0.1 + }, + dashedLinePeriod: { + type: 'f', + value: 0.2 + }, + projMatrixInv: { + type: '4fv', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4() + }, + viewport: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2() + }, + lineWidth: { + type: 'f', + value: 2.0 + }, + // default value must be the same as settings + fogAlpha: { + type: 'f', + value: 1.0 + }, + samplesKernel: { + type: 'v2v', + value: null + }, + noiseTex: { + type: 't', + value: null + }, + noiseTexelSize: { + type: 'v2', + value: null + }, + srcTexelSize: { + type: 'v2', + value: null + } +}]); +const uberOptionNames = ['shininess', 'opacity', 'zOffset', 'diffuse', 'specular', 'fixedColor', 'zClipCoef', 'zClipValue', 'clipPlaneValue', 'world2colorMatrix', 'dashedLineSize', 'dashedLinePeriod', 'projMatrixInv', 'viewport', 'lineWidth', 'fogAlpha', 'samplesKernel', 'noiseTex', 'noiseTexelSize', 'srcTexelSize']; + +// properties that convert to uniforms +const uberOptions = { + diffuse: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(0xffffff), + // used in phong lighting + specular: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(0x111111), + // used in phong lighting + shininess: 30, + // used in phong lighting + opacity: 1, + // set mesh opacity + fixedColor: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(0xffffff), + // color to override (see OVERRIDE_COLOR) + zOffset: 0.0, + // used fo zsprites (see SPHERE_SPRITE CYLINDER_SPRITE) + zClipCoef: 2.0, + // use for Surfs clipping (mesh param, isn't used in shader) FIXME move to representation param + zClipValue: 0.0, + // value to clip Surfs in shader (see ZCLIP) + clipPlaneValue: 0.0, + // value to clip scene globally (see CLIPPLANE) + world2colorMatrix: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(), + dashedLineSize: 0.1, + dashedLinePeriod: 0.3, + projMatrixInv: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(), + viewport: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(800, 600), + lineWidth: 2.0, + fogAlpha: 1.0, + samplesKernel: _samplesKernel, + noiseTex: gfx_noiseTexture.noiseTexture, + noiseTexelSize: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(1.0 / gfx_noiseTexture.noiseWidth, 1.0 / gfx_noiseTexture.noiseHeight), + srcTexelSize: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(1.0 / 800.0, 1.0 / 600.0), + copy(source) { + this.diffuse.copy(source.diffuse); + this.specular.copy(source.specular); + this.shininess = source.shininess; + this.opacity = source.opacity; + this.fixedColor.copy(source.fixedColor); + this.zOffset = source.zOffset; + this.zClipCoef = source.zClipCoef; + this.zClipValue = source.zClipValue; + this.clipPlaneValue = source.clipPlaneValue; + this.world2colorMatrix.copy(source.world2colorMatrix); + this.dashedLineSize = source.dashedLineSize; + this.dashedLinePeriod = source.dashedLinePeriod; + this.projMatrixInv = source.projMatrixInv; + this.viewport = source.viewport; + this.lineWidth = source.lineWidth; // used for thick lines only + this.toonShading = source.toonShading; + this.fogAlpha = source.fogAlpha; + this.samplesKernel = source.samplesKernel; + this.noiseTex = source.noiseTex; + this.noiseTexelSize = source.noiseTexelSize; + this.srcTexelSize = source.srcTexelSize; + } +}; +class UberMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RawShaderMaterial { + constructor(params) { + super(params); + + // add fog + this.fog = true; + // used for instanced geometry + this.instancedPos = false; + this.instancedMatrix = false; + // atoms and links color + this.attrColor = false; + // second link color for cylinders + this.attrColor2 = false; + // + this.attrAlphaColor = false; + // overrides color for all vertices (used in selection) + this.overrideColor = false; + // zsrpites + this.sphereSprite = false; + this.cylinderSprite = false; + // clip Surfs individually + this.zClip = false; + // clip scene with global clip plane + this.clipPlane = false; + // enable fake (chess-like) opacity + this.fakeOpacity = false; + // render only depth, don't take care about the pixel color (used for transparency depth prepass) + this.prepassTransparancy = false; + // used to render pixel positions + this.colorFromPos = false; + // used to render shadowmap + this.shadowmap = false; + // used to describe shadowmap type + this.shadowmapType = 'random'; + // used to render pixel view deph + this.colorFromDepth = false; + // mark that rendering is for orthographic camera + this.orthoCam = false; + // used to render dashed line + this.dashedLine = false; + // mark as transparent + this.transparent = true; + // mark as thick lines + this.thickLine = false; + // makes fog begin transparency (required for transparent background) + this.fogTransparent = false; + // used to render surface normals to G buffer for ssao effect + this.normalsToGBuffer = false; + // used for toon material + this.toonShading = false; + + // uber options of "root" materials are inherited from single uber-options object that resides in prototype + this.uberOptions = Object.create(UberMaterial.prototype.uberOptions); + + // set default values + super.setValues({ + uniforms: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UniformsUtils.clone(defaultUniforms), + vertexShader: this.precisionString() + Uber_namespaceObject, + fragmentShader: this.precisionString() + gfx_shaders_Uber_namespaceObject, + lights: true, + fog: true, + side: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.DoubleSide + }); + this.setValues(params); + } + precisionString() { + const { + precision + } = capabilities; + const str = `precision ${precision} float;\n` + `precision ${precision} int;\n\n`; + return str; + } + copy(source) { + super.copy(source); + this.fragmentShader = source.fragmentShader; + this.vertexShader = source.vertexShader; + this.uniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UniformsUtils.clone(source.uniforms); + this.defines = { + ...source.defines + }; + this.extensions = source.extensions; + this.fog = source.fog; + this.instancedPos = source.instancedPos; + this.instancedMatrix = source.instancedMatrix; + this.attrColor = source.attrColor; + this.attrColor2 = source.attrColor2; + this.attrAlphaColor = source.attrAlphaColor; + this.overrideColor = source.overrideColor; + this.sphereSprite = source.sphereSprite; + this.cylinderSprite = source.cylinderSprite; + this.zClip = source.zClip; + this.clipPlane = source.clipPlane; + this.fakeOpacity = source.fakeOpacity; + this.colorFromPos = source.colorFromPos; + this.shadowmap = source.shadowmap; + this.shadowmapType = source.shadowmapType; + this.colorFromDepth = source.colorFromDepth; + this.orthoCam = source.orthoCam; + this.prepassTransparancy = source.prepassTransparancy; + this.dashedLine = source.dashedLine; + this.thickLine = source.thickLine; + this.fogTransparent = source.fogTransparent; + this.normalsToGBuffer = source.normalsToGBuffer; + this.toonShading = source.toonShading; + this.uberOptions.copy(source.uberOptions); + return this; + } - _this.setValues(settings); + // create copy of this material + // its options are prototyped after this material's options + createInstance() { + const inst = new UberMaterial(); + inst.copy(this); + inst.uberOptions = Object.create(this.uberOptions); + return inst; + } + setValues(values) { + if (typeof values === 'undefined') { + return; + } - return _this; + // set direct values + super.setValues(values); + const defines = {}; + const extensions = {}; + if (this.fog) { + defines.USE_FOG = 1; + } + if (this.instancedPos) { + defines.INSTANCED_POS = 1; + } + if (this.instancedMatrix) { + defines.INSTANCED_MATRIX = 1; + } + if (this.attrColor) { + defines.ATTR_COLOR = 1; + } + if (this.attrColor2) { + defines.ATTR_COLOR2 = 1; + } + if (this.attrAlphaColor) { + defines.ATTR_ALPHA_COLOR = 1; + } + if (this.overrideColor) { + defines.OVERRIDE_COLOR = 1; + } + if (this.sphereSprite) { + defines.SPHERE_SPRITE = 1; + extensions.fragDepth = true; + } + if (this.cylinderSprite) { + defines.CYLINDER_SPRITE = 1; + extensions.fragDepth = true; + } + if (this.zClip) { + defines.ZCLIP = 1; + } + if (this.clipPlane) { + defines.CLIP_PLANE = 1; + } + if (this.fakeOpacity) { + defines.FAKE_OPACITY = 1; + } + if (this.lights) { + defines.USE_LIGHTS = 1; } - - return AnaglyphMaterial; - }(THREE.RawShaderMaterial); - - var View = /*#__PURE__*/function () { - function View() { - classCallCheck(this, View); - - this.position = new THREE.Vector3(0, 0, 0); - this.scale = 1; - this.orientation = new THREE.Quaternion(0, 0, 0, 1); + if (this.colorFromPos) { + defines.COLOR_FROM_POS = 1; } - - createClass(View, [{ - key: "set", - value: function set(position, scale, orientation) { - this.position = position; - this.scale = scale; - this.orientation = orientation; + if (this.shadowmap) { + defines.SHADOWMAP = 1; + if (this.shadowmapType === 'pcf') { + defines.SHADOWMAP_PCF_SHARP = 1; + } else if (this.shadowmapType === 'random') { + defines.SHADOWMAP_PCF_RAND = 1; + } else { + defines.SHADOWMAP_BASIC = 1; } - }]); - - return View; - }(); - - var _transitionTime = 1.5; // in seconds - - var ViewInterpolator = /*#__PURE__*/function () { - function ViewInterpolator() { - classCallCheck(this, ViewInterpolator); } - - createClass(ViewInterpolator, [{ - key: "setup", - value: function setup(startView, endView) { - this._startTime = undefined; - this._endTime = undefined; - this._isPaused = false; - this._srcView = startView; - this._dstView = endView; - this._isMoving = false; - } - }, { - key: "isMoving", - value: function isMoving() { - return this._isMoving; - } - }, { - key: "wasStarted", - value: function wasStarted() { - return typeof this._startTime !== 'undefined' && typeof this._endTime !== 'undefined'; - } - }, { - key: "start", - value: function start() { - this._startTime = Date.now(); - var transTime = settings.now.interpolateViews ? _transitionTime * 1000 : 0; - this._endTime = this._startTime + transTime; - this._isMoving = true; - } - }, { - key: "getCurrentView", - value: function getCurrentView() { - if (typeof this._srcView === 'undefined' || typeof this._dstView === 'undefined' || !this._isMoving || !this.wasStarted()) { - return { - success: false - }; - } - - var view = this.createView(); - var time = Date.now(); - - if (time > this._endTime) { - view = this._dstView; - this.reset(); - return { - success: true, - view: view - }; - } - - var factor = (time - this._startTime) / (this._endTime - this._startTime); - view.position.copy(this._srcView.position); - view.position.lerp(this._dstView.position, factor); - view.scale = (1 - factor) * this._srcView.scale + factor * this._dstView.scale; - view.orientation.copy(this._srcView.orientation); - view.orientation.slerp(this._dstView.orientation, factor); - return { - success: true, - view: view - }; + if (this.colorFromDepth) { + defines.COLOR_FROM_DEPTH = 1; + } + if (this.orthoCam) { + defines.ORTHOGRAPHIC_CAMERA = 1; + } + if (this.prepassTransparancy) { + defines.PREPASS_TRANSP = 1; + } + if (this.dashedLine) { + defines.DASHED_LINE = 1; + } + if (this.thickLine) { + defines.THICK_LINE = 1; + } + if (this.fogTransparent) { + defines.FOG_TRANSPARENT = 1; + } + if (this.normalsToGBuffer) { + extensions.drawBuffers = true; + defines.NORMALS_TO_G_BUFFER = 1; + } + if (this.toonShading) { + defines.TOON_SHADING = 1; + } + // set dependent values + this.defines = defines; + this.extensions = extensions; + } + setUberOptions(values) { + if (typeof values === 'undefined') { + return; + } + for (const key in values) { + if (!values.hasOwnProperty(key)) { + continue; } - }, { - key: "reset", - value: function reset() { - this._startTime = this._endTime = 0; - this._isMoving = false; + if (this.uberOptions[key] instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color) { + this.uberOptions[key] = values[key].clone(); + } else { + this.uberOptions[key] = values[key]; } - }, { - key: "pause", - value: function pause() { - if (!this._isPaused) { - this.setup(this.getCurrentView().view, this._dstView); - this._isPaused = true; + } + } + clone(shallow) { + if (!shallow) { + return super.clone(); + } + return this.createInstance(); + } + updateUniforms() { + const self = this; + uberOptionNames.forEach(p => { + if (self.uniforms.hasOwnProperty(p)) { + if (self.uberOptions[p] instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color || self.uberOptions[p] instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4) { + self.uniforms[p].value = self.uberOptions[p].clone(); + } else { + self.uniforms[p].value = self.uberOptions[p]; } } - }, { - key: "resume", - value: function resume() { - this._isPaused = false; + }); + } +} +UberMaterial.prototype.uberOptions = uberOptions; +/* harmony default export */ const shaders_UberMaterial = (UberMaterial); +;// CONCATENATED MODULE: ./src/gfx/meshes/UberObject.js + +/* harmony default export */ function UberObject(SuperClass) { + class NewObjectType extends SuperClass { + constructor() { + super(...arguments); + this.onBeforeRender = NewObjectType.prototype.onBeforeRender; + } + onBeforeRender(renderer, scene, camera, geometry, material, group) { + this._onBeforeRender(renderer, scene, camera, geometry, material, group); + this._update(); + } + _onBeforeRender() {} + _update() { + const { + material + } = this; + if (!material) { + return; } - }, { - key: "createView", - value: function createView() { - return new View(); + if (material instanceof shaders_UberMaterial) { + material.updateUniforms(); } - }]); - - return ViewInterpolator; - }(); - - var MAX_COOKIE_LEN = 4000; - var COUNT_SUFFIX = 'Cnt'; - - function _chunkString(string, chunkLen) { - var l = string.length; - var chunks = []; - - for (var c = 0, lc = 0; lc < l; c++, lc += chunkLen) { - chunks[c] = string.slice(lc, lc + chunkLen); } - - return chunks; } - /** - * Create new context dependent Cookie holder object. - * @param context - * @param {Object} opts - options - * @param {string} opts.path - cookie path - * @constructor - */ + return NewObjectType; +} +;// CONCATENATED MODULE: ./src/gfx/meshes/ZSpriteMesh.js - function Cookies(context, opts) { - this.context = context; - this._opts = _.merge({ - path: '/' - }, opts); +const Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh); +class ZSpriteMesh extends Mesh { + constructor() { + super(...arguments); + this.castShadow = true; + this.receiveShadow = true; } - - makeContextDependent(Cookies.prototype); - /** - * Remove cookie by the name. - * @param key - */ - - Cookies.prototype.removeCookie = function (key) { - var cntKey = this._toCount(key); - - var cntVal = this._getSimpleCookie(cntKey); - - if (!cntVal) { - this._removeSimpleCookie(key); - + _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) { + Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera); + const { + material + } = this; + if (!material) { return; } - - this._removeSimpleCookie(cntKey); - - cntVal = parseInt(cntVal, 10); - - for (var i = 0; i < cntVal; ++i) { - this._removeSimpleCookie(key + i); + if (material.uniforms.invModelViewMatrix) { + // NOTE: update of modelViewMatrix inside threejs is done after onBeforeRender call, + // so we have to do it manually in that place + this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld); + // get inverse matrix + material.uniforms.invModelViewMatrix.value.copy(this.modelViewMatrix).invert(); + material.uniforms.nearPlaneValue.value = camera.near; + material.uniformsNeedUpdate = true; } - }; - /** - * Set new cookie value. Automatically splits - * values that are too large into multiple cookies. - * @param key - * @param value - */ - - - Cookies.prototype.setCookie = function (key, value) { - this.removeCookie(key); - value = encodeURIComponent(value); - - var values = _chunkString(value, MAX_COOKIE_LEN - key.length - 1); - - var cntVal = values.length; + } +} +/* harmony default export */ const meshes_ZSpriteMesh = (ZSpriteMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/ZClippedMesh.js - if (cntVal === 1) { - this._setSimpleCookie(key, value); +const ZClippedMesh_Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh); +class ZClippedMesh extends ZClippedMesh_Mesh { + constructor(geometry, material) { + super(geometry, material); + this.castShadow = true; + this.receiveShadow = true; + } + static _mvLength = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3())(); + static _center = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3())(); + static _modelView = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4())(); + _onBeforeRender(renderer, scene, camera) { + ZClippedMesh_Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera); + const geo = this.geometry; + const { + material + } = this; + if (!geo.zClip || !material.uberOptions) { return; } - - var cntKey = this._toCount(key); - - this._setSimpleCookie(cntKey, cntVal.toString()); - - for (var i = 0; i < cntVal; ++i) { - this._setSimpleCookie(key + i, values[i]); - } - }; - /** - * Obtain the value of a compound cookie. - * @param key - */ + const zClipCoef = 0.5; + const modelView = ZClippedMesh._modelView; + const mvLength = ZClippedMesh._mvLength; + const center = ZClippedMesh._center; + modelView.multiplyMatrices(this.matrixWorld, camera.matrixWorldInverse); + const s = mvLength.setFromMatrixColumn(modelView, 0).length(); + center.copy(geo.boundingSphere.center); + this.localToWorld(center); + material.uberOptions.zClipValue = camera.position.z - center.z - s * (zClipCoef * geo.boundingSphere.radius); + } +} +/* harmony default export */ const meshes_ZClippedMesh = (ZClippedMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/TextMesh.js - Cookies.prototype.getCookie = function (key) { - var cntKey = this._toCount(key); - var cntVal = this._getSimpleCookie(cntKey); - if (!cntVal) { - return this._getSimpleCookie(key); +class TextMesh extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group { + constructor(geometry, _material) { + super(); + this.geometry = geometry; + const self = this; + self.initialized = false; + this.geometry.addEventListener('update', () => { + self.update(); + }); + } + init() { + const { + children + } = this; + for (let i = children.length - 1; i >= 0; --i) { + this.remove(children[i]); + } + const { + items, + userData + } = this.geometry; + for (let i = 0, n = items.length; i < n; ++i) { + const srcItem = items[i]; + if (!srcItem) { + continue; + } + const item = utils.shallowCloneNode(srcItem); + const label = new gfx_CSS2DObject(item); + label.userData = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().clone(userData); + const el = label.getElement(); + el.style.visibility = 'visible'; + label.source = srcItem; + this.add(label); } - - cntVal = parseInt(cntVal, 10); - var value = []; - - for (var i = 0; i < cntVal; ++i) { - value[i] = this._getSimpleCookie(key + i); + this.initialized = true; + } + update() { + const geo = this.geometry; + if (!geo.needsUpdate) { + return; } - - return value.join(''); - }; - - Cookies.prototype._toCount = function (key) { - return key + COUNT_SUFFIX; - }; - - Cookies.prototype._removeSimpleCookie = function (key) { - document.cookie = "".concat(key, "=; expires=Thu, 01 Jan 1970 00:00:01 GMT;"); - }; - - Cookies.prototype._getExpirationDate = function () { - var today = new Date(); - var EXP_PERIOD_YEARS = 10; - today.setFullYear(today.getFullYear() + EXP_PERIOD_YEARS); - return today; - }; - - Cookies.prototype._setSimpleCookie = function (key, value) { - document.cookie = "".concat(key, "=").concat(value, ";expires=").concat(this._getExpirationDate().toUTCString(), ";path=").concat(this._opts.path); - }; - - Cookies.prototype._getSimpleCookie = function (key) { - var matches = document.cookie.match(new RegExp("(?:^|; )".concat(key, "=([^;]*)"))); - return matches ? decodeURIComponent(matches[1]) : ''; - }; - - Cookies.prototype._exists = function (key) { - return document.cookie.match(new RegExp("(?:^|; )".concat(key, "=([^;]*)"))); - }; - - /* - * Toggling WebVR is done through button.click because of limitations on calling requestPresent in webVR: - * VRDisplay::requestPresent should be called from user gesture: - * https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestPresent - */ - function createWebVRButton (webVRPoC) { - function showEnterVR(button) { - button.style.display = ''; - button.style.cursor = 'pointer'; - button.style.left = 'calc(50% - 50px)'; - button.style.width = '100px'; - button.textContent = 'ENTER VR'; - var currentSession = null; - - function onSessionEnded() - /* event */ - { - currentSession.removeEventListener('end', onSessionEnded); - button.textContent = 'ENTER VR'; - currentSession = null; - } - - function onSessionStarted(session) { - session.addEventListener('end', onSessionEnded); - - webVRPoC._gfx.renderer.xr.setReferenceSpaceType('local'); - - webVRPoC._gfx.renderer.xr.setSession(session); - - button.textContent = 'EXIT VR'; - currentSession = session; - } - - button.onmouseenter = function () { - button.style.opacity = '1.0'; - }; - - button.onmouseleave = function () { - button.style.opacity = '0.5'; - }; - - button.onclick = function () { - if (currentSession === null) { - // WebXR's requestReferenceSpace only works if the corresponding feature - // was requested at session creation time. For simplicity, just ask for - // the interesting ones as optional features, but be aware that the - // requestReferenceSpace call will fail if it turns out to be unavailable. - // ('local' is always available for immersive sessions and doesn't need to - // be requested separately.) - var sessionInit = { - optionalFeatures: ['local-floor', 'bounded-floor'] - }; - navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted); - webVRPoC.moveSceneBehindHeadset(); - } else { - currentSession.end(); - } - }; + const { + children + } = this; + if (!this.initialized) { + this.init(); } - - function showWebXRNotFound(button) { - button.style.display = ''; - button.style.cursor = 'auto'; - button.style.left = 'calc(50% - 75px)'; - button.style.width = '150px'; - button.textContent = 'VR NOT FOUND'; - button.onmouseenter = null; - button.onmouseleave = null; - button.onclick = null; - } - - function stylizeElement(element) { - element.style.position = 'absolute'; - element.style.bottom = '20px'; - element.style.padding = '12px 6px'; - element.style.border = '1px solid #fff'; - element.style.borderRadius = '4px'; - element.style.background = 'transparent'; - element.style.color = '#fff'; - element.style.font = 'normal 13px sans-serif'; - element.style.textAlign = 'center'; - element.style.opacity = '0.5'; - element.style.outline = 'none'; - element.style.zIndex = '999'; - } - - if ('xr' in navigator) { - var button = document.createElement('button'); - button.style.display = 'none'; - stylizeElement(button); - navigator.xr.isSessionSupported('immersive-vr').then(function (supported) { - return supported ? showEnterVR(button) : showWebXRNotFound(button); - }); - return button; + for (let i = 0, n = children.length; i < n; ++i) { + const child = children[i]; + const item = child.source; + child.position.copy(item.worldPos); + child.userData.color = item.opts.color; + child.userData.background = item.opts.background; } - - var message = document.createElement('a'); - message.href = 'https://webvr.info'; - message.innerHTML = 'WEBXR NOT SUPPORTED'; - message.style.left = 'calc(50% - 90px)'; - message.style.width = '180px'; - message.style.textDecoration = 'none'; - stylizeElement(message); - return message; } +} +/* harmony default export */ const meshes_TextMesh = (TextMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/SimpleMesh.js - var WebVRPoC = /*#__PURE__*/function () { - function WebVRPoC(onToggle) { - classCallCheck(this, WebVRPoC); - - this._mainCamera = new THREE.PerspectiveCamera(); - this._button = null; - this._onToggle = onToggle; - this._molContainer = new gfxutils.RCGroup(); - this._user = new gfxutils.RCGroup(); - this._scalingPivot = new THREE.Object3D(); - this._user.add(this._scalingPivot); - - this._controller1 = null; - this._controller2 = null; - this._pressedGripsCounter = 0; - this._distance = 0; - this._gfx = null; +const SimpleMesh_Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh); +class SimpleMesh extends SimpleMesh_Mesh { + constructor(geometry, material) { + super(geometry, material); + this.castShadow = true; + this.receiveShadow = true; + } +} +/* harmony default export */ const meshes_SimpleMesh = (SimpleMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/ThickLineMesh.js + + +const ThickLineMesh_Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh); +const _viewport = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(); +class ThickLineMesh extends ThickLineMesh_Mesh { + _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) { + const { + material + } = this; + if (!material.uberOptions) { + return; } + material.uberOptions.projMatrixInv.copy(camera.projectionMatrix).invert(); + renderer.getSize(_viewport); + material.uberOptions.viewport.set(_viewport.width, _viewport.height); + } +} +/* harmony default export */ const meshes_ThickLineMesh = (ThickLineMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/InstancedMesh.js - createClass(WebVRPoC, [{ - key: "startScalingByControllers", - value: function startScalingByControllers() { - // reset scale - this._distance = this._controller1.position.distanceTo(this._controller2.position); - gfxutils.getMiddlePoint(this._controller1.position, this._controller2.position, this._scalingPivot.position); - - this._scalingPivot.scale.set(1, 1, 1); - - this._scalingPivot.updateMatrix(); - - this._scalingPivot.updateMatrixWorld(); // link molecule to pivot - - - this._scalingPivot.addSavingWorldTransform(this._molContainer); - } - }, { - key: "stopScalingByControllers", - value: function stopScalingByControllers() { - this._gfx.scene.addSavingWorldTransform(this._molContainer); - } - }, { - key: "handleGripsDown", - value: function handleGripsDown(event) { - this._pressedGripsCounter++; - - if (this._pressedGripsCounter === 2) { - this.startScalingByControllers(); - } else if (this._pressedGripsCounter === 1) { - event.target.addSavingWorldTransform(this._molContainer); - } - } - }, { - key: "handleGripsUp", - value: function handleGripsUp(event) { - this._pressedGripsCounter--; - - if (this._pressedGripsCounter === 1) { - this.stopScalingByControllers(); // reattach molecule to other controller - - var anotherController = event.target === this._controller1 ? this._controller2 : this._controller1; - anotherController.addSavingWorldTransform(this._molContainer); - } else if (this._pressedGripsCounter === 0) { - this._gfx.scene.addSavingWorldTransform(this._molContainer); - } - } - }, { - key: "enable", - value: function enable(gfx) { - if (!gfx) { - logger.warn('WebVR couldn\'t be enabled, because gfx is not defined'); - return; - } - - this._gfx = gfx; - var renderer = gfx.renderer, - camera = gfx.camera; - - if (!renderer) { - throw new Error('No renderer is available to toggle WebVR'); - } - - if (!camera) { - throw new Error('No camera is available to toggle WebVR'); - } // enable xr in renderer - - - renderer.xr.enabled = true; // add button for turning vr mode - - if (!this._button) { - this._button = createWebVRButton(this); - document.body.appendChild(this._button); - } else { - this._button.style.display = 'block'; - } // store fog setting - - - this._mainFog = settings.now.fog; - settings.set('fog', false); - - this._plugVRNodesIntoScene(gfx, renderer); - - this._setControllersListeners(); // make some Miew job - - - if (this._onToggle) { - this._onToggle(true); - } - } - }, { - key: "_plugVRNodesIntoScene", - value: function _plugVRNodesIntoScene(gfx, renderer) { - // store common scene camera - this._mainCamera.copy(gfx.camera); // add hierarchical structure for webVR into scene - - - gfx.scene.add(this._user); // turn on webvr transformation - - gfx.scene.add(this._molContainer); - - this._molContainer.add(gfx.root); - - this._controller1 = renderer.xr.getController(0); - this._controller2 = renderer.xr.getController(1); - - var mesh = this._createControllerMesh(); - - this._controller1.add(mesh); - - this._controller2.add(mesh.clone()); - - this._user.add(this._controller1); - - this._user.add(this._controller2); - } - }, { - key: "_setControllersListeners", - value: function _setControllersListeners() { - var _this = this; - - this._controller1.addEventListener('selectstart', function (event) { - _this.handleGripsDown(event); - }); - - this._controller1.addEventListener('selectend', function (event) { - _this.handleGripsUp(event); - }); - - this._controller2.addEventListener('selectstart', function (event) { - _this.handleGripsDown(event); - }); - - this._controller2.addEventListener('selectend', function (event) { - _this.handleGripsUp(event); - }); - - this._controller1.addEventListener('squeezestart', function (event) { - _this.handleGripsDown(event); - }); - - this._controller1.addEventListener('squeezeend', function (event) { - _this.handleGripsUp(event); - }); - - this._controller2.addEventListener('squeezestart', function (event) { - _this.handleGripsDown(event); - }); - - this._controller2.addEventListener('squeezeend', function (event) { - _this.handleGripsUp(event); - }); - } - }, { - key: "disable", - value: function disable() { - if (!this._gfx) { - return; - } - var _this$_gfx = this._gfx, - renderer = _this$_gfx.renderer, - camera = _this$_gfx.camera; +const InstancedMesh_Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh); +class InstancedMesh extends InstancedMesh_Mesh { + constructor() { + super(...arguments); + this.castShadow = true; + this.receiveShadow = true; + } +} +/* harmony default export */ const meshes_InstancedMesh = (InstancedMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/meshes.js - if (!renderer) { - throw new Error('No renderer is available to toggle WebVR'); - } // nullify webxr callback for animation frame - renderer.setAnimationLoop(null); - var session = renderer.xr.getSession(); - if (session) { - session.end(); - } - renderer.xr.enabled = false; // remove button of VR entering - if (this._button) { - this._button.style.display = 'none'; - } // restore fog param - settings.set('fog', this._mainFog); +/* harmony default export */ const meshes = ({ + ZClipped: meshes_ZClippedMesh, + ZSprite: meshes_ZSpriteMesh, + Text: meshes_TextMesh, + Line: UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Line), + LineSegments: UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineSegments), + Mesh: meshes_SimpleMesh, + ThickLineMesh: meshes_ThickLineMesh, + Instanced: meshes_InstancedMesh +}); +;// CONCATENATED MODULE: ./src/gfx/meshes/MeshCreator.js - this._unplugVRNodesFromScene(camera); // make some Miew job - if (this._onToggle) { - this._onToggle(false); +function setMatParams(params, uniforms) { + return function (material) { + material.setValues(params); + material.setUberOptions(uniforms); + }; +} +function _createInstancedCylinders(useZSprites, openEnded) { + function Geometry(a, b) { + return new geometries.Instanced2CCylindersGeometry(a, b, useZSprites, openEnded); + } + return { + Geometry, + Object: useZSprites ? meshes.ZSprite : meshes.Instanced, + initMaterial: setMatParams({ + instancedMatrix: true, + attrColor: true, + attrColor2: true, + attrAlphaColor: true, + cylinderSprite: useZSprites + }) + }; +} +function _createLineSegmentsGeoTriplet(geo, renderParams) { + const thickLines = geo.prototype instanceof geometries_ThickLinesGeometry; + const lineWidth = renderParams.lineWidth || 0; + return { + Geometry: geo, + Object: thickLines ? meshes.ThickLineMesh : meshes.LineSegments, + initMaterial: setMatParams({ + lights: false, + attrColor: true, + attrAlphaColor: true, + thickLine: thickLines + }, { + lineWidth + }) + }; +} +function _createSimpleGeoTriplet(geoClass) { + return { + Geometry: geoClass, + Object: meshes.Mesh, + initMaterial: setMatParams({ + attrColor: true, + attrAlphaColor: true + }) + }; +} +function _createIsoSurfaceGeoTriplet(geoClass, caps, settings, renderParams) { + const surfaceOpts = { + wireframe: !!renderParams.wireframe, + fakeOpacity: settings.now.isoSurfaceFakeOpacity, + zClip: renderParams.zClip + }; + return { + Geometry: geoClass, + Object: meshes.ZClipped, + initMaterial: setMatParams({ + attrColor: true, + attrAlphaColor: false, + wireframe: surfaceOpts.wireframe, + fakeOpacity: surfaceOpts.fakeOpacity, + zClip: surfaceOpts.zClip + }) + }; +} +class MeshCreator { + static createSpheres(caps, settings) { + const useZSprites = settings.now.zSprites; + function Geometry(a, b) { + return new geometries.InstancedSpheresGeometry(a, b, useZSprites); + } + return { + Geometry, + Object: useZSprites ? meshes.ZSprite : meshes.Instanced, + initMaterial: setMatParams({ + instancedPos: true, + attrColor: true, + attrAlphaColor: true, + sphereSprite: useZSprites + }) + }; + } + static create2CClosedCylinders(_caps, _settings) { + return _createInstancedCylinders(false, false); + } + static create2CCylinders(caps, settings) { + return _createInstancedCylinders(settings.now.zSprites, true); + } + static create2CLines(_caps, _settings, renderParams) { + return _createLineSegmentsGeoTriplet(geometries.TwoColorLinesGeometry, renderParams); + } + static createCrosses(_caps, _settings, renderParams) { + return _createLineSegmentsGeoTriplet(geometries.CrossGeometry, renderParams); + } + static createExtrudedChains(_caps, _settings) { + return _createSimpleGeoTriplet(geometries.ExtrudedObjectsGeometry); + } + static createChunkedLines(_caps, _settings, renderParams) { + return _createLineSegmentsGeoTriplet(geometries.ChunkedLinesGeometry, renderParams); + } + static createQuickSurface(caps, settings, renderParams) { + return _createIsoSurfaceGeoTriplet(geometries.QuickSurfGeometry, caps, settings, renderParams); + } + static createContactSurface(caps, settings, renderParams) { + return _createIsoSurfaceGeoTriplet(geometries.ContactSurfaceGeometry, caps, settings, renderParams); + } + static createSASSES(caps, settings, renderParams) { + return _createIsoSurfaceGeoTriplet(geometries.SSIsosurfaceGeometry, caps, settings, renderParams); + } + static createLabels(_caps, _settings) { + return { + Geometry: geometries.LabelsGeometry, + Object: meshes.Text, + initMaterial() {} + }; + } +} +/* harmony default export */ const meshes_MeshCreator = (MeshCreator); +;// CONCATENATED MODULE: ./src/gfx/meshes/TransformGroup.js + + +class TransformGroup extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Object3D { + static _inverseMatrix = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4())(); + static _ray = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Ray())(); + constructor(geometry, geoParams, material, transforms) { + super(); + this._geometry = geometry; + this._geoParams = geoParams; + const mat = material.createInstance(); + geoParams.initMaterial(mat); + this._material = mat; + this._transforms = transforms.length > 0 ? transforms : [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4()]; + const meshes = this._createMeshes(geometry); + for (let i = 0, n = meshes.length; i < n; ++i) { + this.add(meshes[i]); + } + } + raycast(raycaster, intersects) { + const ray = TransformGroup._ray; + const inverseMatrix = TransformGroup._inverseMatrix; + const { + children + } = this; + ray.copy(raycaster.ray); + for (let i = 0, n = children.length; i < n; ++i) { + const child = children[i]; + if (!gfxutils.belongToSelectLayers(child)) { + continue; + } + child.updateMatrixWorld(); + const mtx = child.matrixWorld; + inverseMatrix.copy(mtx).invert(); + raycaster.ray.copy(ray).applyMatrix4(inverseMatrix); + const childIntersects = []; + this._geometry.raycast(raycaster, childIntersects); + for (let j = 0, ciCount = childIntersects.length; j < ciCount; ++j) { + const inters = childIntersects[j]; + if (inters.point) { + inters.point.applyMatrix4(mtx); + inters.distance = ray.origin.distanceTo(inters.point); } + inters.object = child; + intersects[intersects.length] = inters; } - }, { - key: "_unplugVRNodesFromScene", - value: function _unplugVRNodesFromScene(camera) { - // restore common camera - if (this._mainCamera && camera) { - camera.copy(this._mainCamera); - } // turn off webvr transformation - + } + raycaster.ray.copy(ray); + } + getSubset(chunkIndices) { + const geos = this._geometry.getSubset(chunkIndices); + const subset = []; + let subIdx = 0; + for (let i = 0, n = geos.length; i < n; ++i) { + const meshes = this._createMeshes(geos[i]); + for (let j = 0, meshCnt = meshes.length; j < meshCnt; ++j) { + subset[subIdx++] = meshes[j]; + } + } + return subset; + } + _createMeshes(geometry) { + const transforms = this._transforms; + const Mesh = this._geoParams.Object; + const material = this._material; + const meshes = []; + for (let i = 0, n = transforms.length; i < n; ++i) { + const mesh = new Mesh(geometry, material); + mesh.applyMatrix4(transforms[i]); + meshes[i] = mesh; + } + return meshes; + } +} +/* harmony default export */ const meshes_TransformGroup = (TransformGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/ChemGroup.js + + +function wrapper(Name, args) { + const params = [Name].concat(args); + return Name.bind(...params); +} +class ChemGroup extends gfx_RCGroup { + constructor(geoParams, selection, colorer, mode, transforms, polyComplexity, material) { + super(); + if (this.constructor === ChemGroup) { + throw new Error('Can not instantiate abstract class!'); + } + this._selection = selection; + this._mode = mode; + this._colorer = colorer; + this._chunksIdc = selection.chunks; + this._polyComplexity = polyComplexity; + this._geo = new (wrapper(geoParams.Geometry, this._makeGeoArgs()))(); + this._mesh = new meshes_TransformGroup(this._geo, geoParams, material, transforms); + this.add(this._mesh); + this._build(); + } + _makeGeoArgs() { + throw new Error('ChemGroup subclass must override _makeGeoArgs() method'); + } - var root = this._molContainer.children[0]; + /** + * Builds subset geometry by ATOMS index list + * + * @param {Number} mask - Representation mask + * @param {Boolean} innerOnly - if true returns inner bonds only - without halves + * @returns {Array} Subset geometry + */ + getSubset(mask, innerOnly) { + innerOnly = innerOnly !== undefined ? innerOnly : false; + const chunksList = this._calcChunksList(mask, innerOnly); + if (chunksList.length === 0) { + return []; + } + return this._mesh.getSubset(chunksList); + } + _changeSubsetOpacity(mask, value, innerOnly) { + const chunksList = this._calcChunksList(mask, innerOnly); + if (chunksList.length === 0) { + return; + } + this._geo.setOpacity(chunksList, value); + } + enableSubset(mask, innerOnly) { + innerOnly = innerOnly !== undefined ? innerOnly : true; + this._changeSubsetOpacity(mask, 1.0, innerOnly); + } + disableSubset(mask, innerOnly) { + innerOnly = innerOnly !== undefined ? innerOnly : true; + this._changeSubsetOpacity(mask, 0.0, innerOnly); + } +} +/* harmony default export */ const groups_ChemGroup = (ChemGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsGroup.js + +class AtomsGroup extends groups_ChemGroup { + raycast(raycaster, intersects) { + const { + atoms + } = this._selection; + const inters = []; + this._mesh.raycast(raycaster, inters); + const atomsIdc = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; + } + const atomIdx = atomsIdc[inters[i].chunkIdx]; + if (atomIdx < atoms.length) { + inters[i].atom = atoms[atomIdx]; + intersects.push(inters[i]); + } + } + } + _calcChunksList(mask) { + const chunksList = []; + const { + atoms + } = this._selection; + const atomsIdc = this._chunksIdc; + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + if ((atom.mask & mask) !== 0) { + chunksList.push(i); + } + } + return chunksList; + } +} +/* harmony default export */ const groups_AtomsGroup = (AtomsGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsSphereGroup.js - if (root) { - this._gfx.scene.add(root); +class AtomsSphereGroup extends groups_AtomsGroup { + _makeGeoArgs() { + return [this._selection.chunks.length, this._polyComplexity]; + } + _build() { + const atomsIdc = this._selection.chunks; + const { + atoms, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + geo.setItem(i, atom.position, mode.calcAtomRadius(atom)); + geo.setColor(i, colorer.getAtomColor(atom, parent)); + } + geo.finalize(); + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const atomsIdc = this._selection.chunks; + const { + atoms + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const updateColor = frameData.needsColorUpdate(colorer); + const geo = this._geo; + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), mode.calcAtomRadius(atom)); + if (updateColor) { + geo.setColor(i, frameData.getAtomColor(colorer, atom)); + } + } + geo.finalize(); + } +} +/* harmony default export */ const groups_AtomsSphereGroup = (AtomsSphereGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsSurfaceGroup.js + +class AtomsSurfaceGroup extends groups_AtomsSphereGroup { + _makeGeoArgs() { + const selectedAtoms = []; + const { + atoms, + chunks + } = this._selection; + const n = chunks.length; + for (let i = 0; i < n; ++i) { + selectedAtoms[i] = atoms[chunks[i]]; + } + const opts = this._mode.getSurfaceOpts(); + opts.atoms = selectedAtoms; + return [n, opts]; + } +} +/* harmony default export */ const groups_AtomsSurfaceGroup = (AtomsSurfaceGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsSASSESGroupStub.js +/* This is a stub class keep it until SAS/SES is refactored */ + + +class AtomsSASSESGroupStub extends groups_AtomsSphereGroup { + _makeGeoArgs() { + const selectedAtoms = []; + const { + atoms, + chunks + } = this._selection; + const n = chunks.length; + for (let i = 0; i < n; ++i) { + selectedAtoms[i] = atoms[chunks[i]]; + } + const opts = this._mode.getSurfaceOpts(); + opts.atoms = selectedAtoms; + opts.selection = this._selection; + opts.colorMode = this._colorer; + return [n, opts]; + } +} +/* harmony default export */ const groups_AtomsSASSESGroupStub = (AtomsSASSESGroupStub); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsTextGroup.js + + +function adjustColor(color) { + let r = color >> 16 & 255; + let g = color >> 8 & 255; + let b = color & 255; + if (0.2126 * r + 0.7152 * g + 0.0722 * b > 127) { + r = r * 3 / 10; + g = g * 3 / 10; + b = b * 3 / 10; + } else { + r = 255 - (255 - r) * 3 / 10; + g = 255 - (255 - g) * 3 / 10; + b = 255 - (255 - b) * 3 / 10; + } + return r << 16 | g << 8 | b; +} +function inverseColor(color) { + const r = color >> 16 & 255; + const g = color >> 8 & 255; + const b = color & 255; + return 255 - r << 16 | 255 - g << 8 | 255 - b; +} +function getAtomText(atom) { + if (atom.name.getNode() !== null) { + return atom.name.getNode(); + } + return atom.getVisualName(); +} +const colorMappings = { + none(c) { + return c; + }, + adjust: adjustColor, + inverse: inverseColor +}; +function propagateColor(color, rule) { + let result; + if (colorMappings.hasOwnProperty(rule)) { + result = utils.hexColor(colorMappings[rule](color)); + } else { + const val = parseInt(rule, 16); + if (!Number.isNaN(val) && rule.toLowerCase().startsWith('0x')) { + result = utils.hexColor(val); + } else { + result = '#000000'; + } + } + return result; +} +const templateMappings = { + serial(a) { + return a.serial; + }, + name(a) { + return a.getVisualName(); + }, + elem(a) { + return a.element.name; + }, + residue(a) { + return a.residue.getType().getName(); + }, + sequence(a) { + return a.residue.getSequence(); + }, + chain(a) { + return a.residue.getChain().getName(); + }, + hetatm(a) { + return a.isHet(); + }, + water(a) { + return a.residue.getType().getName() === 'HOH' || a.residue.getType().getName() === 'WAT'; + } +}; +const parseTemplate = function (atom, str) { + return str.replace(/\{\{(\s*\w+\s*)\}\}/g, m => { + let key = m.replace(/\s+/g, ''); + key = key.substring(2, key.length - 2).toLowerCase(); + if (templateMappings.hasOwnProperty(key)) { + return templateMappings[key](atom); + } + return 'null'; + }); +}; +class AtomsTextGroup extends groups_AtomsGroup { + _makeGeoArgs() { + const opts = this._mode.getLabelOpts(); + return [this._selection.chunks.length, opts]; + } + _build() { + const opts = this._mode.getLabelOpts(); + const atomsIdc = this._selection.chunks; + const { + atoms, + parent + } = this._selection; + const colorer = this._colorer; + const geo = this._geo; + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom); + if (!text) { + continue; + } + const color = colorer.getAtomColor(atom, parent); + const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16); + const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent'; + geo.setItem(i, atom.position, text); + geo.setColor(i, fgColor, bgColor); + } + geo.finalize(); + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const opts = this._mode.getLabelOpts(); + const atomsIdc = this._selection.chunks; + const { + atoms + } = this._selection; + const colorer = this._colorer; + const geo = this._geo; + const updateColor = frameData.needsColorUpdate(colorer); + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom); + if (!text) { + continue; + } + const color = frameData.getAtomColor(colorer, atom); + const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16); + const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent'; + geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), text); + if (updateColor) { + geo.setColor(i, fgColor, bgColor); + } + } + geo.finalize(); + } +} +/* harmony default export */ const groups_AtomsTextGroup = (AtomsTextGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AromaticGroup.js + + +function _slerp(omega, v1, v2, t) { + const oSin = Math.sin(omega); + return v1.clone().multiplyScalar(Math.sin((1 - t) * omega) / oSin).addScaledVector(v2, Math.sin(t * omega) / oSin); +} +class AromaticGroup extends groups_AtomsGroup { + _buildInner(radOffset, addChunk) { + const chunksToIdx = this._selection.chunks; + const prevVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const currVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const segmentsHeight = this._segmentsHeight; + const leprStep = 1.0 / segmentsHeight; + const colorer = this._colorer; + const { + cycles, + parent + } = this._selection; + let chunkIdx = 0; + let currAtomIdx = chunksToIdx[chunkIdx]; + for (let cIdx = 0, cCount = cycles.length; cIdx < cCount; ++cIdx) { + const cycle = cycles[cIdx]; + const cycAtoms = cycle.atoms; + const chunkPoints = []; + const tmpDir = []; + const { + center + } = cycle; + const cycleRad = cycle.radius - radOffset; + const n = cycAtoms.length; + let i = 0; + const prevPos = cycAtoms[n - 1].position; + let currPos = cycAtoms[i].position; + prevVector.subVectors(prevPos, center); + currVector.subVectors(currPos, center); + const upDir = currVector.clone().cross(prevVector).normalize(); + for (; i < n; ++i) { + const omega = prevVector.angleTo(currVector); + tmpDir[i] = _slerp(omega, prevVector, currVector, 0.5).normalize(); + currPos = cycAtoms[(i + 1) % n].position; + prevVector.copy(currVector); + currVector.subVectors(currPos, center); + } + for (i = 0; i < n; ++i) { + if (cycAtoms[i].index !== currAtomIdx) { + continue; } + const start = tmpDir[i]; + const end = tmpDir[(i + 1) % n]; + const color = colorer.getAtomColor(cycAtoms[i], parent); + const currAngle = start.angleTo(end); + for (let j = 0; j <= segmentsHeight; ++j) { + chunkPoints[j] = _slerp(currAngle, start, end, j * leprStep).multiplyScalar(cycleRad).add(center); + } + addChunk(chunkIdx++, color, chunkPoints, center, upDir); + currAtomIdx = chunksToIdx[chunkIdx]; + } + } + } +} +/* harmony default export */ const groups_AromaticGroup = (AromaticGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AromaticTorusGroup.js - this._molContainer.parent.remove(this._molContainer); - - if (this._user) { - this._gfx.scene.remove(this._user); - } // free scene nodes - this._molContainer = null; - this._user = null; - this._scalingPivot = null; - this._user = null; - this._controller1 = null; - this._controller2 = null; +function _createShape(rad, parts) { + const pts = []; + for (let i = 0; i < parts; ++i) { + const a = -2 * i / parts * Math.PI; + pts.push(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0)); + } + return pts; +} +const { + calcChunkMatrix +} = gfxutils; +class AromaticTorusGroup extends groups_AromaticGroup { + _build() { + const segmentsHeight = this._segmentsHeight; + const torusRad = this._mode.getAromRadius(); + const radiusV = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(torusRad, torusRad); + const radOffset = this._mode.calcStickRadius() + 2 * torusRad; + const lookAtVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const mtc = []; + const geo = this._geo; + this._buildInner(radOffset, (chunkIdx, color, points, center, upDir) => { + for (let j = 0; j <= segmentsHeight; ++j) { + const currPoint = points[j]; + const currDir = currPoint.clone().sub(center).cross(upDir); + lookAtVector.addVectors(currPoint, currDir); + mtc[j] = calcChunkMatrix(currPoint, lookAtVector, upDir, radiusV); + } + geo.setItem(chunkIdx, mtc); + geo.setColor(chunkIdx, color); + }); + geo.finalize(); + } + _makeGeoArgs() { + this._segmentsHeight = this._polyComplexity; + return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length]; + } +} +/* harmony default export */ const groups_AromaticTorusGroup = (AromaticTorusGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AromaticLinesGroup.js + +class AromaticLinesGroup extends groups_AromaticGroup { + _build() { + const geo = this._geo; + const radOffset = this._mode.getAromaticOffset(); + this._buildInner(radOffset, (chunkIdx, color, points) => { + let prevPt = points[0]; // do not replace with start + for (let j = 1; j <= this._segmentsHeight; ++j) { + const currPoint = points[j]; + geo.setSegment(chunkIdx, j - 1, prevPt, currPoint); + prevPt = currPoint; + } + geo.setColor(chunkIdx, color); + }); + geo.finalize(); + } + _makeGeoArgs() { + this._segmentsHeight = this._mode.getAromaticArcChunks(); + return [this._selection.chunks.length, this._segmentsHeight, true]; + } +} +/* harmony default export */ const groups_AromaticLinesGroup = (AromaticLinesGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/ResiduesGroup.js + +class ResiduesGroup extends groups_ChemGroup { + raycast(raycaster, intersects) { + const { + residues + } = this._selection; + const inters = []; + this._mesh.raycast(raycaster, inters); + const chunksIdc = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; } - }, { - key: "_createControllerMesh", - value: function _createControllerMesh() { - // visualize controllers with cylinders - var geometry = new THREE.CylinderGeometry(0.04, 0.04, 0.3); - var material = new UberMaterial({ - lights: false, - overrideColor: true - }); - material.setUberOptions({ - fixedColor: new THREE.Color(0x4444ff) - }); - material.updateUniforms(); - var cylinder = new THREE.Mesh(geometry, material); - cylinder.rotateX(-Math.PI / 2); - return cylinder; + const resIdx = chunksIdc[inters[i].chunkIdx]; + if (resIdx < residues.length) { + inters[i].residue = residues[resIdx]; + intersects.push(inters[i]); } - }, { - key: "updateMoleculeScale", - value: function updateMoleculeScale() { - if (!this._controller1 || !this._controller2) { - return; - } + } + } + _calcChunksList(mask) { + const chunksList = []; + const { + residues + } = this._selection; + const resIdc = this._chunksIdc; + for (let i = 0, n = resIdc.length; i < n; ++i) { + const res = residues[resIdc[i]]; + if ((res._mask & mask) !== 0) { + chunksList.push(i); + } + } + return chunksList; + } +} +/* harmony default export */ const groups_ResiduesGroup = (ResiduesGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/NucleicItemGroup.js + +class NucleicItemGroup extends groups_ResiduesGroup { + raycast(raycaster, intersects) { + const { + residues + } = this._selection; + const inters = []; + this._mesh.raycast(raycaster, inters); + const chunksIdc = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; + } + const resIdx = chunksIdc[Math.floor(inters[i].chunkIdx / 2)]; + if (resIdx < residues.length) { + inters[i].residue = residues[resIdx]; + intersects.push(inters[i]); + } + } + } + _build() { + const { + residues, + parent + } = this._selection; + const colorer = this._colorer; + const geo = this._geo; + const stickRad = this._mode.calcStickRadius(); + let chunkIdx = 0; + const resIdc = this._selection.chunks; + for (let i = 0, n = resIdc.length; i < n; ++i) { + const res = residues[resIdc[i]]; + const color = colorer.getResidueColor(res, parent); + this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color); + } + geo.finalize(); + } + _calcChunksList(mask) { + const chunksList = []; + let chunkIdx = 0; + const { + residues + } = this._selection; + const resIdc = this._chunksIdc; + for (let i = 0, n = resIdc.length; i < n; ++i) { + const res = residues[resIdc[i]]; + if ((res._mask & mask) !== 0) { + chunksList[chunkIdx++] = 2 * i; + chunksList[chunkIdx++] = 2 * i + 1; + } + } + return chunksList; + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const residues = frameData.getResidues(); + const { + parent + } = this._selection; + const colorer = this._colorer; + const geo = this._geo; + const stickRad = this._mode.calcStickRadius(); + let chunkIdx = 0; + const resIdc = this._selection.chunks; + for (let i = 0, n = resIdc.length; i < n; ++i) { + const res = residues[resIdc[i]]; + const color = colorer.getResidueColor(res, parent); + this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color); + } + geo.finishUpdate(); + } +} +/* harmony default export */ const groups_NucleicItemGroup = (NucleicItemGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/NucleicCylindersGroup.js - var self = this; // update molecule scaling by controllers +class NucleicCylindersGroup extends groups_NucleicItemGroup { + _makeGeoArgs() { + return [this._selection.chunks.length, this._polyComplexity]; + } + _processItem(chunkIdx, cyl1, cyl2, stickRad, color) { + const geo = this._geo; + geo.setItem(chunkIdx, cyl1, cyl2, stickRad); + geo.setColor(chunkIdx, color, color); + } +} +/* harmony default export */ const groups_NucleicCylindersGroup = (NucleicCylindersGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/NucleicSpheresGroup.js - if (self._pressedGripsCounter === 2) { - // recalc scaling pivot - gfxutils.getMiddlePoint(self._controller1.position, self._controller2.position, self._scalingPivot.position); // recalc scaler +class NucleicSpheresGroup extends groups_NucleicItemGroup { + _makeGeoArgs() { + return [this._selection.chunks.length * 2, this._polyComplexity]; + } + _processItem(chunkIdx, cyl1, cyl2, stickRad, color) { + const geo = this._geo; + let idx = chunkIdx * 2; + geo.setItem(idx, cyl1, stickRad); + geo.setColor(idx, color); + idx++; + geo.setItem(idx, cyl2, stickRad); + geo.setColor(idx, color); + } +} +/* harmony default export */ const groups_NucleicSpheresGroup = (NucleicSpheresGroup); +// EXTERNAL MODULE: ./vendor/js/Smooth.js +var Smooth = __webpack_require__(690); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/CartoonHelper.js - var dist = self._controller1.position.distanceTo(self._controller2.position); - var scaler = dist / self._distance; - self._scalingPivot.scale.multiplyScalar(scaler); // save cur distance for next frame +const { + ResidueType: CartoonHelper_ResidueType +} = chem; +const calcMatrix = gfxutils.calcChunkMatrix; +function _buildStructureInterpolator(points, tension) { + const path = (0,Smooth.Smooth)(points, { + method: Smooth.Smooth.METHOD_CUBIC, + clip: Smooth.Smooth.CLIP_CLAMP, + cubicTension: tension, + scaleTo: 1 + }); + return function (t, argTrans) { + let transformT = argTrans; + if (transformT === null) { + // map our range to the [second .. last but one] + transformT = function (tt) { + return (tt * (points.length - 1 - 2) + 1) / (points.length - 1); + }; + } + const newt = transformT(t); + const ans = path(newt); + return new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(ans[0], ans[1], ans[2]); + }; +} +function _addPoints(centerPoints, topPoints, idx, residue) { + if (!residue._isValid) { + centerPoints[idx] = centerPoints[idx - 1]; + topPoints[idx] = topPoints[idx - 1]; + return; + } + const cp = residue._controlPoint; + centerPoints[idx] = [cp.x, cp.y, cp.z]; + const tp = cp.clone().add(residue._wingVector); + topPoints[idx] = [tp.x, tp.y, tp.z]; +} +function _addPointsForLoneResidue(centerPoints, topPoints, idx, residue) { + const nucleic = (residue._type.flags & CartoonHelper_ResidueType.Flags.NUCLEIC) !== 0; + const nameFrom = nucleic ? 'C5\'' : 'N'; + const nameTo = nucleic ? 'C3\'' : 'C'; + let posFrom; + let posTo; + residue.forEachAtom(atom => { + const name = atom.getVisualName(); + if (!posFrom && name === nameFrom) { + posFrom = atom.position; + } else if (!posTo && name === nameTo) { + posTo = atom.position; + } + }); - self._distance = dist; - } - } - /** - * Reposition molecule right before the camera. - * @note The proper way is to initiate headset in the place of common Miew's camera. - * But threejs limitations on setting new XRReferenceSpace enforce the molecule repositioning - * Hope, something will change. - */ + // provide a fallback for unknown residues + if (!(posFrom && posTo)) { + posFrom = residue._firstAtom.position; + posTo = residue._lastAtom.position; + } + if (posFrom && posTo) { + const shift = posTo.clone().sub(posFrom); + const wing = residue._wingVector; + const cp = residue._controlPoint; + const tp = cp.clone().add(wing); + const cpPrev = cp.clone().sub(shift); + const tpPrev = cpPrev.clone().add(wing); + centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z]; + topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z]; + ++idx; + centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z]; + topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z]; + ++idx; + centerPoints[idx] = [cp.x, cp.y, cp.z]; + topPoints[idx] = [tp.x, tp.y, tp.z]; + ++idx; + const cpNext = cp.clone().add(shift); + const tpNext = cpNext.clone().add(wing); + centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z]; + topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z]; + ++idx; + centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z]; + topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z]; + } +} +function _calcPoints(residues, firstIdx, lastIdx, boundaries) { + const left = boundaries.start; + const right = boundaries.end; + function _prevIdx(idx) { + return idx > left && residues[idx - 1]._isValid ? idx - 1 : idx; + } + function _nextIdx(idx) { + return idx < right && residues[idx + 1]._isValid ? idx + 1 : idx; + } + const topPoints = []; + const centerPoints = []; + let arrIdx = 0; + function _extrapolate2(currIdx, otherIdx) { + const cp = residues[currIdx]._controlPoint.clone().lerp(residues[otherIdx]._controlPoint, -0.25); + const tp = cp.clone().add(residues[currIdx]._wingVector); + centerPoints[arrIdx] = [cp.x, cp.y, cp.z]; + topPoints[arrIdx++] = [tp.x, tp.y, tp.z]; + centerPoints[arrIdx] = [cp.x, cp.y, cp.z]; + topPoints[arrIdx++] = [tp.x, tp.y, tp.z]; + } - }, { - key: "moveSceneBehindHeadset", - value: function moveSceneBehindHeadset() { - var gfx = this._gfx; - var camera = gfx.camera; // set container position in camera space + // a single disconnected residue + const prevIdx = _prevIdx(firstIdx); + const nextIdx = _nextIdx(lastIdx); + if (prevIdx === nextIdx) { + _addPointsForLoneResidue(centerPoints, topPoints, arrIdx, residues[firstIdx]); + return { + centerPoints, + topPoints + }; + } - var container = this._molContainer; - container.matrix.identity(); - container.position.set(0, 0, -4.0); - container.updateMatrix(); // update container world matrix + // Two points (prev-prev and next-next) are added to support edge conditions for cubic splines, they are ignored + // Another two (prev and next) were added to support the outside of the sub chain - container.matrixWorld.multiplyMatrices(camera.matrixWorld, container.matrix); // readd to scene + // prev and prev-prev + if (firstIdx === prevIdx) { + // do the extrapolation + _extrapolate2(firstIdx, _nextIdx(firstIdx)); + } else { + _addPoints(centerPoints, topPoints, arrIdx++, residues[_prevIdx(prevIdx)]); + _addPoints(centerPoints, topPoints, arrIdx++, residues[prevIdx]); + } - gfx.scene.addSavingWorldTransform(container); + // main loop + for (let idx = firstIdx; idx <= lastIdx; ++idx) { + _addPoints(centerPoints, topPoints, arrIdx++, residues[idx]); + } - if (this._onToggle) { - this._onToggle(true); - } - } - }, { - key: "getCanvas", - value: function getCanvas() { - var gfx = this._gfx; - return gfx && gfx.renderer ? gfx.renderer.domElement : null; - } - }]); + // next and next-next + if (nextIdx === _nextIdx(nextIdx)) { + // do the extrapolation + _extrapolate2(lastIdx, _prevIdx(lastIdx)); + } else { + _addPoints(centerPoints, topPoints, arrIdx++, residues[nextIdx]); + _addPoints(centerPoints, topPoints, arrIdx, residues[_nextIdx(nextIdx)]); + } + return { + centerPoints, + topPoints + }; +} +class CartoonHelper { + constructor(residues, startIdx, endIdx, segmentsCount, tension, boundaries) { + const pointsArrays = _calcPoints(residues, startIdx, endIdx, boundaries); + this._topInterp = _buildStructureInterpolator(pointsArrays.topPoints, tension); + this._centerInterp = _buildStructureInterpolator(pointsArrays.centerPoints, tension); + this._shift = 0.5 / (endIdx - startIdx + 2); + this._valueStep = (1.0 - 2 * this._shift) / (2 * (endIdx - startIdx + 1) * (segmentsCount - 1)); + this._segmentsCount = segmentsCount; + } + prepareMatrices(idx, firstRad, secondRad) { + const mtcCount = this._segmentsCount; + const outMtc = new Array(mtcCount); + const currRad = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(0, 0); + const topInterp = this._topInterp; + const cenInterp = this._centerInterp; + let currentValue = this._shift + this._valueStep * (mtcCount - 1) * idx; + for (let mtxIdx = 0; mtxIdx < mtcCount; ++mtxIdx) { + const lerpVal = Math.min(1.0, mtxIdx / (mtcCount - 1)); + currRad.lerpVectors(firstRad, secondRad, lerpVal); + const currTop = topInterp(currentValue, null); + const currCenter = cenInterp(currentValue, null); + currentValue += this._valueStep; + const nextCenter = cenInterp(currentValue, null); + outMtc[mtxIdx] = calcMatrix(currCenter.clone(), nextCenter.clone(), currTop.clone().sub(currCenter), currRad); + } + return outMtc; + } +} +/* harmony default export */ const groups_CartoonHelper = (CartoonHelper); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/ResiduesSubseqGroup.js - return WebVRPoC; - }(); - var fragmentScreenQuadFromDistTex = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform vec3 aberration;\r\n\r\nvoid main() {\r\n vec2 uv = vUv * 2.0 - 1.0;\r\n \r\n gl_FragColor.r = texture2D(srcTex, 0.5 * (uv * aberration[0] + 1.0)).r;\r\n gl_FragColor.g = texture2D(srcTex, 0.5 * (uv * aberration[1] + 1.0)).g;\r\n gl_FragColor.b = texture2D(srcTex, 0.5 * (uv * aberration[2] + 1.0)).b;\r\n gl_FragColor.a = 1.0;\r\n}"; - - var selectors$4 = chem.selectors, - Atom$2 = chem.Atom, - Residue$1 = chem.Residue, - Chain$2 = chem.Chain, - Molecule$8 = chem.Molecule; - var EDIT_MODE = { - COMPLEX: 0, - COMPONENT: 1, - FRAGMENT: 2 - }; - var LOADER_NOT_FOUND = 'Could not find suitable loader for this source'; - var PARSER_NOT_FOUND = 'Could not find suitable parser for this source'; - var createElement$2 = utils.createElement; - function updateFogRange(fog, center, radius) { - fog.near = center - radius * settings.now.fogNearFactor; - fog.far = center + radius * settings.now.fogFarFactor; +function ResiduesSubseqGroup_createShape(rad, parts) { + const pts = []; + for (let i = 0; i < parts; ++i) { + // starts from pi/2 because it's important that points are lied on the angles of arrows (visual issues if not) + const a = Math.PI / 2.0 - 2 * Math.PI * i / parts; + pts.push(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0)); } - - function removeExtension(fileName) { - var dot = fileName.lastIndexOf('.'); - - if (dot >= 0) { - fileName = fileName.substr(0, dot); + return pts; +} +function _loopThrough(subDiv, residues, segmentsHeight, tension, mode, callback) { + for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { + const subs = subDiv[subDivI].arr; + const { + boundaries + } = subDiv[subDivI]; + for (let i = 0, n = subs.length; i < n; ++i) { + const idc = [subs[i].start, subs[i].end]; + const matrixHelper = new groups_CartoonHelper(residues, idc[0], idc[1], segmentsHeight, tension, boundaries); + let prevLast = null; + const startIdx = subs[i].start * 2; + const endIdx = subs[i].end * 2 + 1; + let prevSecondRad = mode.getResidueRadius(residues[0], 0); + for (let idx = startIdx; idx <= endIdx; ++idx) { + const resIdx = idx / 2 | 0; + const currRes = residues[resIdx]; + const firstRad = mode.getResidueRadius(currRes, idx % 2); + const secondRad = mode.getResidueRadius(currRes, 1 + idx % 2); + const mtc = matrixHelper.prepareMatrices(idx - idc[0] * 2, firstRad, secondRad); + mtc.unshift(prevLast === null ? mtc[0] : prevLast); + + // Slope - radius is changed along this residue part + const hasSlope = firstRad.x !== secondRad.x || firstRad.y !== secondRad.y; + // Cut - end radius of previous part not equal to start radius of this part. First section of this part lies in the orthogonal plane + const hasCut = firstRad.x !== prevSecondRad.x || firstRad.y !== prevSecondRad.y; + callback(currRes, mtc, hasSlope, hasCut); + prevLast = mtc[segmentsHeight]; + prevSecondRad = secondRad; + } } - - return fileName; } - - function hasValidResidues(complex) { - var hasValidRes = false; - complex.forEachComponent(function (component) { - component.forEachResidue(function (residue) { - if (residue._isValid) { - hasValidRes = true; - } - }); +} +class ResiduesSubseqGroup extends groups_ResiduesGroup { + _makeGeoArgs() { + const cmpMultiplier = this._mode.getHeightSegmentsRatio(); + this._segmentsHeight = this._polyComplexity * cmpMultiplier | 0; + return [ResiduesSubseqGroup_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length * 2]; + } + _build() { + const { + residues, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const tension = mode.getTension(); + const geo = this._geo; + let chunkIdx = 0; + const chunkIdc = []; + _loopThrough(this._selection.subdivs, residues, this._segmentsHeight, tension, mode, function (currRes, mtc) { + let hasSlope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + let hasCut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + const color = colorer.getResidueColor(currRes, parent); + chunkIdc[chunkIdx] = currRes._index; + geo.setItem(chunkIdx, mtc, hasSlope, hasCut); + geo.setColor(chunkIdx++, color); }); - return hasValidRes; + this._chunksIdc = chunkIdc; + geo.finalize(); } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const { + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const tension = mode.getTension(); + const geo = this._geo; + const frameRes = frameData.getResidues(); + let chunkIdx = 0; + const updateColor = frameData.needsColorUpdate(colorer); + _loopThrough(this._selection.subdivs, frameRes, this._segmentsHeight, tension, mode, (currRes, mtc) => { + geo.setItem(chunkIdx, mtc); + if (updateColor) { + geo.setColor(chunkIdx, colorer.getResidueColor(currRes, parent)); + } + chunkIdx++; + }); + geo.finalize(); + } +} +/* harmony default export */ const groups_ResiduesSubseqGroup = (ResiduesSubseqGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/ResiduesTraceGroup.js - function reportProgress(log, action, percent) { - var TOTAL_PERCENT = 100; - - if (percent !== undefined) { - log.debug("".concat(action, "... ").concat(Math.floor(percent * TOTAL_PERCENT), "%")); - } else { - log.debug("".concat(action, "...")); +class ResiduesTraceGroup extends groups_ChemGroup { + _makeGeoArgs() { + const subDiv = this._selection.subdivs; + let chunksCount = 0; + for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { + const subs = subDiv[subDivI].arr; + for (let i = 0, n = subs.length; i < n; ++i) { + chunksCount += subs[i].end - subs[i].start; + } } + return [chunksCount, this._polyComplexity]; } - - function chooseFogColor() { - return settings.now.fogColorEnable ? settings.now.fogColor : settings.now.bg.color; - } // //////////////////////////////////////////////////////////////////////////// - - /** - * Main 3D Molecular Viewer class. - * - * @param {object} opts - Viewer options. - * @param {HTMLElement=} opts.container - DOM element that serves as a viewer container. - * @param {object=} opts.settings - An object with properties to override default settings. - * @param {string=} opts.settingsCookie='settings' - The name of the cookie to save current settings to. - * @param {string=} opts.cookiePath='/' - The path option for cookies. Defaults to root. - * - * @exports Miew - * @constructor - */ + _build() { + const { + residues, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + let chunkIdx = 0; + const chunkIdc = []; + const subDiv = this._selection.subdivs; + const stickRad = mode.calcStickRadius(); + for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { + const subs = subDiv[subDivI].arr; + for (let i = 0, n = subs.length; i < n; ++i) { + const startIdx = subs[i].start; + const endIdx = subs[i].end; + let prevRes = residues[startIdx]; + for (let idx = startIdx + 1; idx <= endIdx; ++idx) { + const currRes = residues[idx]; + chunkIdc[chunkIdx] = { + first: prevRes._index, + second: currRes._index + }; + geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad); + geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent)); + chunkIdx++; + prevRes = currRes; + } + } + } + this._chunksIdc = chunkIdc; + geo.finalize(); + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + + const residues = frameData.getResidues(); + const { + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + let chunkIdx = 0; + const subDiv = this._selection.subdivs; + const stickRad = mode.calcStickRadius(); + const updateColor = frameData.needsColorUpdate(colorer); + for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { + const subs = subDiv[subDivI].arr; + for (let i = 0, n = subs.length; i < n; ++i) { + const startIdx = subs[i].start; + const endIdx = subs[i].end; + let prevRes = residues[startIdx]; + for (let idx = startIdx + 1; idx <= endIdx; ++idx) { + const currRes = residues[idx]; + geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad); + if (updateColor) { + geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent)); + } + chunkIdx++; + prevRes = currRes; + } + } + } + geo.finalize(); + } + raycast(raycaster, intersects) { + const inters = []; + const { + residues + } = this._selection; + this._mesh.raycast(raycaster, inters); + const chunksToIdx = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; + } + const { + chunkIdx + } = inters[i]; + const chunk = chunksToIdx[Math.floor(chunkIdx / 2)]; + const resIdx = chunkIdx % 2 === 0 ? chunk.first : chunk.second; + if (resIdx < residues.length) { + inters[i].residue = residues[resIdx]; + intersects.push(inters[i]); + } + } + } + _calcChunksList(mask) { + const chunksList = []; + const chunksToIdx = this._chunksIdc; + const { + residues + } = this._selection; + for (let i = 0, n = chunksToIdx.length; i < n; ++i) { + const chunk = chunksToIdx[i]; + if (residues[chunk.first]._mask & mask) { + chunksList.push(i * 2); + } + if (residues[chunk.second]._mask & mask) { + chunksList.push(i * 2 + 1); + } + } + return chunksList; + } +} +/* harmony default export */ const groups_ResiduesTraceGroup = (ResiduesTraceGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/BondsGroup.js + + +function getCylinderCount(bondOrder) { + return bondOrder < 2 ? 1 : bondOrder; +} +class BondsGroup extends groups_ChemGroup { + _makeGeoArgs() { + const drawMultiple = this._mode.drawMultiorderBonds(); + const showAromatic = this._mode.showAromaticLoops(); + const bondsIdc = this._selection.chunks; + const { + bonds + } = this._selection; + let bondsCount = 0; + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + bondsCount += this.getBondOrder(bonds[bondsIdc[i]], drawMultiple, showAromatic); + } + return [bondsCount, this._polyComplexity]; + } + getBondOrder(bond, drawMultiple, showAromatic) { + let bondOrder = 1; + if (drawMultiple && (!showAromatic || bond._type !== chem_Bond.BondType.AROMATIC)) { + bondOrder = getCylinderCount(bond._order); + } + return bondOrder; + } + raycast(raycaster, intersects) { + const { + bonds + } = this._selection; + const inters = []; + this._mesh.raycast(raycaster, inters); + const bondsIdc = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; + } + const { + chunkIdx + } = inters[i]; + const bondIdx = bondsIdc[Math.floor(chunkIdx / 2)]; + if (bondIdx < bonds.length) { + const bond = bonds[bondIdx]; + inters[i].atom = chunkIdx % 2 === 0 ? bond._left : bond._right; + intersects.push(inters[i]); + } + } + } + _calcChunksList(mask, innerOnly) { + const chunksList = []; + const { + bonds + } = this._selection; + const chunksToIdx = this._chunksIdc; + for (let i = 0, n = chunksToIdx.length; i < n; ++i) { + const bond = bonds[chunksToIdx[i]]; + if (bond._left.mask & mask && (!innerOnly || bond._right.mask & mask)) { + chunksList.push(2 * i); + } + if (bond._right.mask & mask && (!innerOnly || bond._left.mask & mask)) { + chunksList.push(2 * i + 1); + } + } + return chunksList; + } +} +/* harmony default export */ const groups_BondsGroup = (BondsGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/BondsCylinderGroup.js + + +class BondsCylinderGroup extends groups_BondsGroup { + _build() { + const bondsIdc = this._selection.chunks; + const { + bonds, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + const drawMultiple = mode.drawMultiorderBonds(); + const showAromatic = mode.showAromaticLoops(); + const stickRad = mode.calcStickRadius(); + const emptyOffset = mode.calcSpaceFraction(); + let normDir; + const leftPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const rightPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + let currBondIdx = 0; + const chunksToIdx = []; + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + const bond = bonds[bondsIdc[i]]; + const atom1 = bond._left; + const atom2 = bond._right; + const a1Pos = atom1.position; + const a2Pos = atom2.position; + normDir = bond.calcNormalDir(); + const order = this.getBondOrder(bond, drawMultiple, showAromatic); + const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2)); + const dist = 2 * minRad / order; + const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad; + for (let j = 0; j < order; ++j) { + const scale = dist * (order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2))); + chunksToIdx[currBondIdx] = bond._index; + leftPos.copy(a1Pos); + leftPos.addScaledVector(normDir, scale); + rightPos.copy(a2Pos); + rightPos.addScaledVector(normDir, scale); + geo.setItem(currBondIdx, leftPos, rightPos, currStickRad); + geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent)); + } + } + geo.finalize(); + this._chunksIdc = chunksToIdx; + } + updateToFrame(frameData) { + const bondsIdc = this._selection.chunks; + const { + bonds + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + const drawMultiple = mode.drawMultiorderBonds(); + const showAromatic = mode.showAromaticLoops(); + const stickRad = mode.calcStickRadius(); + const emptyOffset = mode.calcSpaceFraction(); + let normDir; + const leftPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const rightPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + let currBondIdx = 0; + const updateColor = frameData.needsColorUpdate(colorer); + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + const bond = bonds[bondsIdc[i]]; + const atom1 = bond._left; + const atom2 = bond._right; + const a1Pos = frameData.getAtomPos(atom1.index).clone(); + const a2Pos = frameData.getAtomPos(atom2.index); + normDir = bond.calcNormalDir(); + const order = this.getBondOrder(bond, drawMultiple, showAromatic); + const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2)); + const dist = 2 * minRad / order; + const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad; + for (let j = 0; j < order; ++j) { + const scale = dist * (order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2))); + leftPos.copy(a1Pos); + leftPos.addScaledVector(normDir, scale); + rightPos.copy(a2Pos); + rightPos.addScaledVector(normDir, scale); + geo.setItem(currBondIdx, leftPos, rightPos, currStickRad); + if (updateColor) { + geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2)); + } + currBondIdx++; + } + } + geo.finalize(); + } +} +/* harmony default export */ const groups_BondsCylinderGroup = (BondsCylinderGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/BondsLinesGroup.js + + +const STEP_SIZE = 0.15; +class BondsLinesGroup extends groups_BondsGroup { + _build() { + const bondsIdc = this._selection.chunks; + const { + bonds, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + const drawMultiple = mode.drawMultiorderBonds(); + const showAromatic = mode.showAromaticLoops(); + const bondDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const leftPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const rightPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + let currBondIdx = 0; + const chunksToIdx = []; + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + const bond = bonds[bondsIdc[i]]; + const atom1 = bond._left; + const atom2 = bond._right; + const a1Pos = atom1.position; + const a2Pos = atom2.position; + const a1Hangs = atom1.bonds.length === 1; + const a2Hangs = atom2.bonds.length === 1; + bondDir.subVectors(a2Pos, a1Pos); + const len = bondDir.length(); + const normDir = bond.calcNormalDir(); + const order = this.getBondOrder(bond, drawMultiple, showAromatic); + for (let j = 0; j < order; ++j) { + leftPos.copy(a1Pos); + rightPos.copy(a2Pos); + let scale = order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2)); + chunksToIdx[currBondIdx] = bond._index; + if (order === 2 && !a1Hangs && !a2Hangs) { + scale -= 0.5; + scale *= -1; + } + if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) { + leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / len); + rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / len); + } + scale *= STEP_SIZE; + leftPos.addScaledVector(normDir, scale); + rightPos.addScaledVector(normDir, scale); + geo.setItem(currBondIdx, leftPos, rightPos); + geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent)); + } + } + geo.finalize(); + this._chunksIdc = chunksToIdx; + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const bondsIdc = this._selection.chunks; + const { + bonds + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + const drawMultiple = mode.drawMultiorderBonds(); + const showAromatic = mode.showAromaticLoops(); + const bondDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const leftPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const rightPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + let currBondIdx = 0; + const updateColor = frameData.needsColorUpdate(colorer); + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + const bond = bonds[bondsIdc[i]]; + const atom1 = bond._left; + const atom2 = bond._right; + const a1Pos = frameData.getAtomPos(atom1.index).clone(); + const a2Pos = frameData.getAtomPos(atom2.index); + const a1Hangs = atom1.bonds.length === 1; + const a2Hangs = atom2.bonds.length === 1; + bondDir.subVectors(a2Pos, a1Pos); + const len = bondDir.length(); + const normDir = bond.calcNormalDir(); + const order = this.getBondOrder(bond, drawMultiple, showAromatic); + for (let j = 0; j < order; ++j) { + leftPos.copy(a1Pos); + rightPos.copy(a2Pos); + let scale = order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2)); + if (order === 2 && !a1Hangs && !a2Hangs) { + scale -= 0.5; + scale *= -1; + } + if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) { + leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / len); + rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / len); + } + scale *= STEP_SIZE; + leftPos.addScaledVector(normDir, scale); + rightPos.addScaledVector(normDir, scale); + geo.setItem(currBondIdx, leftPos, rightPos); + if (updateColor) { + geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2)); + } + currBondIdx++; + } + } + geo.finalize(); + } +} +/* harmony default export */ const groups_BondsLinesGroup = (BondsLinesGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/groups.js - function Miew(opts) { - EventDispatcher.call(this); - this._opts = _.merge({ - settingsCookie: 'settings', - cookiePath: '/' - }, opts); - /** @type {?object} */ - this._gfx = null; - /** @type {ViewInterpolator} */ - this._interpolator = new ViewInterpolator(); - /** @type {HTMLElement} */ - this._container = opts && opts.container || document.getElementById('miew-container') || _.head(document.getElementsByClassName('miew-container')) || document.body; - /** @type {HTMLElement} */ - this._containerRoot = this._container; - /** @type {boolean} */ - this._running = false; - /** @type {boolean} */ - this._halting = false; - /** @type {boolean} */ - this._building = false; - /** @type {boolean} */ - this._needRender = true; - /** @type {boolean} */ - this._hotKeysEnabled = true; - /** @type {Settings} */ - this.settings = settings; - var log = logger; - log.console = false; - log.level = 'info'; - /** - * @type {Logger} - * @example - * miew.logger.addEventListener('message', function _onLogMessage(evt) { - * console.log(evt.message); - * }); - */ +/* harmony default export */ const groups = ({ + AtomsSphereGroup: groups_AtomsSphereGroup, + AtomsSurfaceGroup: groups_AtomsSurfaceGroup, + AtomsSASSESGroupStub: groups_AtomsSASSESGroupStub, + AtomsTextGroup: groups_AtomsTextGroup, + AromaticTorusGroup: groups_AromaticTorusGroup, + AromaticLinesGroup: groups_AromaticLinesGroup, + NucleicCylindersGroup: groups_NucleicCylindersGroup, + NucleicSpheresGroup: groups_NucleicSpheresGroup, + ResiduesSubseqGroup: groups_ResiduesSubseqGroup, + ResiduesTraceGroup: groups_ResiduesTraceGroup, + BondsCylinderGroup: groups_BondsCylinderGroup, + BondsLinesGroup: groups_BondsLinesGroup +}); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/AtomsProcessor.js - this.logger = log; - this._cookies = new Cookies(this); - this.restoreSettings(); +class AtomsProcessor extends gfx_RCGroup { + constructor(AtomsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + this._mode = mode; + const atoms = complex.getAtoms(); + const transforms = complex.getTransforms(); + complex.forEachComponent(component => { + const atomsIdc = []; + let atomCount = 0; + component.forEachAtom(atom => { + if (!self._checkAtom(atom, mask)) { + return; + } + atomsIdc[atomCount++] = atom.index; + }); + if (atomCount === 0) { + return; + } + const atomsGroup = new AtomsGroup(geoParams, { + atoms, + chunks: atomsIdc, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + atomsGroup._component = component; + self.add(atomsGroup); + }); + } + _checkAtom(atom, mask) { + return atom.mask & mask; + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } + } + return totalSubset; + } +} +/* harmony default export */ const processors_AtomsProcessor = (AtomsProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/OrphanAtomsProcessor.js - if (opts && opts.settings) { - this.settings.set(opts.settings); +class OrphanAtomsProcessor extends processors_AtomsProcessor { + _checkAtom(atom, mask) { + if (!(atom.mask & mask)) { + return false; + } + const { + bonds + } = atom; + for (let i = 0, n = bonds.length; i < n; ++i) { + if (bonds[i]._left.mask & mask && bonds[i]._right.mask & mask) { + return false; + } } - /** @type {?Spinner} */ + return true; + } +} +/* harmony default export */ const processors_OrphanAtomsProcessor = (OrphanAtomsProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/ResiduesProcessor.js + +class ResiduesProcessor extends gfx_RCGroup { + constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + const residues = complex.getResidues(); + const transforms = complex.getTransforms(); + complex.forEachComponent(component => { + let chunksCount = 0; + const resIdc = []; + component.forEachResidue(residue => { + if (self._checkResidue(residue, mask)) { + resIdc[chunksCount++] = residue._index; + } + }); + if (chunksCount === 0) { + return; + } + const residuesGroup = new ResidueGroup(geoParams, { + residues, + chunks: resIdc, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + residuesGroup._component = component; + self.add(residuesGroup); + }); + } + checkResidue(residue, mask) { + return residue._mask & mask; + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } + } + return totalSubset; + } +} +/* harmony default export */ const processors_ResiduesProcessor = (ResiduesProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/NucleicProcessor.js +class NucleicProcessor extends processors_ResiduesProcessor { + _checkResidue(residue, mask) { + return mask & residue._mask && residue._cylinders !== null; + } +} +/* harmony default export */ const processors_NucleicProcessor = (NucleicProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/SubseqsProcessor.js + +class SubseqsProcessor extends gfx_RCGroup { + constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + const residues = complex.getResidues(); + const transforms = complex.getTransforms(); + complex.forEachComponent(component => { + const subDivs = component.getMaskedSubdivSequences(mask); + let chunksCount = 0; + const resIdc = []; + for (let subDivI = 0, subDivN = subDivs.length; subDivI < subDivN; ++subDivI) { + const subs = subDivs[subDivI].arr; + for (let i = 0, n = subs.length; i < n; ++i) { + for (let j = subs[i].start, jEnd = subs[i].end; j <= jEnd; ++j) { + resIdc[chunksCount++] = residues[j]._index; + } + } + } + if (chunksCount === 0) { + return; + } + const residuesGroup = new ResidueGroup(geoParams, { + residues, + chunks: resIdc, + subdivs: subDivs, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + residuesGroup._component = component; + self.add(residuesGroup); + }); + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } + } + return totalSubset; + } +} +/* harmony default export */ const processors_SubseqsProcessor = (SubseqsProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/BondsProcessor.js + +class BondsProcessor extends gfx_RCGroup { + constructor(BondsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + const bonds = complex.getBonds(); + const transforms = complex.getTransforms(); + complex.forEachComponent(component => { + const bondsIdc = []; + let bondsCount = 0; + component.forEachBond(bond => { + const atom1 = bond._left; + const atom2 = bond._right; + if (!(atom1.mask & mask) || !(atom2.mask & mask)) { + return; + } + bondsIdc[bondsCount++] = bond._index; + }); + if (bondsCount === 0) { + return; + } + const bondsGroup = new BondsGroup(geoParams, { + bonds, + chunks: bondsIdc, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + bondsGroup._component = component; + self.add(bondsGroup); + }); + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } + } + return totalSubset; + } +} +/* harmony default export */ const processors_BondsProcessor = (BondsProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/AromaticProcessor.js + +class AromaticProcessor extends gfx_RCGroup { + constructor(AromaticGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + const atoms = complex.getAtoms(); + const transforms = complex.getTransforms(); + if (!mode.showAromaticLoops()) { + return; + } + complex.forEachComponent(component => { + const atomsIdc = []; + let chunksCount = 0; + const cycles = []; + let cycleIdx = 0; + component.forEachCycle(cycle => { + const cycAtoms = cycle.atoms; + let perCycle = 0; + for (let i = 0, n = cycAtoms.length; i < n; ++i) { + if ((cycAtoms[i].mask & mask) !== 0) { + ++perCycle; + atomsIdc[chunksCount++] = cycAtoms[i].index; + } + } + if (perCycle > 0) { + cycles[cycleIdx++] = cycle; + } + }); + const atomsGroup = new AromaticGroup(geoParams, { + cycles, + atoms, + chunks: atomsIdc, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + atomsGroup._component = component; + self.add(atomsGroup); + }); + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } + } + return totalSubset; + } +} +/* harmony default export */ const processors_AromaticProcessor = (AromaticProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/processors.js - this._spinner = null; - /** @type {JobHandle[]} */ - this._loading = []; - /** @type {?number} - * @deprecated until Animation system refactoring - */ - this._animInterval = null; - /** @type {object} */ - this._visuals = {}; - /** @type {?string} */ - this._curVisualName = null; - /** @type {array} */ - this._objects = []; - /** @type {object} */ - this._sourceWindow = null; - this.reset(); +/* harmony default export */ const processors = ({ + Atoms: processors_AtomsProcessor, + OrphanAtoms: processors_OrphanAtomsProcessor, + Residues: processors_ResiduesProcessor, + Nucleic: processors_NucleicProcessor, + Subseqs: processors_SubseqsProcessor, + Bonds: processors_BondsProcessor, + Aromatic: processors_AromaticProcessor +}); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/GroupsFactory.js - if (this._repr) { - log.debug("Selected ".concat(this._repr.mode.name, " mode with ").concat(this._repr.colorer.name, " colorer.")); - } - var self = this; - Miew.registeredPlugins.forEach(function (plugin) { - plugin.call(self); - }); - this._initOnSettingsChanged(); +function _bakeGroup(triplet, Processor, Group) { + return function (complex, colorer, mode, polyComplexity, mask, material) { + return new Processor(Group, triplet, complex, colorer, mode, polyComplexity, mask, material); + }; +} +class GroupsFactory { + static AtomsSpheres(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createSpheres(caps, settings); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSphereGroup); + } + static OrphanedAtomsCrosses(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createCrosses(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.OrphanAtoms, groups.AtomsSphereGroup); + } + static BondsCylinders(caps, settings) { + const gfxTriplet = meshes_MeshCreator.create2CCylinders(caps, settings); + return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsCylinderGroup); + } + static BondsLines(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.create2CLines(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsLinesGroup); + } + static CartoonChains(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createExtrudedChains(caps, settings); + return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesSubseqGroup); + } + static TraceChains(caps, settings) { + const gfxTriplet = meshes_MeshCreator.create2CClosedCylinders(caps, settings); + return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesTraceGroup); + } + static NucleicSpheres(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createSpheres(caps, settings); + return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicSpheresGroup); + } + static NucleicCylinders(caps, settings) { + const gfxTriplet = meshes_MeshCreator.create2CCylinders(caps, settings); + return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicCylindersGroup); + } + static ALoopsTorus(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createExtrudedChains(caps, settings); + return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticTorusGroup); } + static ALoopsLines(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createChunkedLines(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticLinesGroup); + } + static QuickSurfGeo(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createQuickSurface(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup); + } + static ContactSurfaceGeo(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createContactSurface(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup); + } + static SASSESSurfaceGeo(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createSASSES(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSASSESGroupStub); + } + static TextLabelsGeo(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createLabels(caps, settings); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsTextGroup); + } +} +/* harmony default export */ const groups_GroupsFactory = (GroupsFactory); +;// CONCATENATED MODULE: ./src/gfx/modes/Mode.js - Miew.prototype = Object.create(EventDispatcher.prototype); - Miew.prototype.constructor = Miew; - Miew.prototype.getMaxRepresentationCount = function () { - return ComplexVisual.NUM_REPRESENTATION_BITS; - }; - /** - * Replace viewer container contents with a DOM element. - * @param {HTMLElement} container - parent container. - * @param {HTMLElement} element - DOM element to show. - * @private - */ - function _setContainerContents(container, element) { - var parent = container; - while (parent.firstChild) { - parent.removeChild(parent.firstChild); - } - parent.appendChild(element); +/** + * Create new mode. + * + * @param {object=} opts - Options to override defaults with. + * + * These options are copied locally and not kept by reference, so the created instance will not reflect further + * changes to the `opts` object. However, changes in defaults **will** affect the mode after its creation. + * + * @exports Mode + * @this Mode + * @abstract + * @constructor + * @classdesc Basic class for all available modes used for building and displaying molecule geometry. + */ +class Mode { + constructor(opts) { + if (this.constructor === Mode) { + throw new Error('Can not instantiate abstract class!'); + } + /** + * Mode options inherited (prototyped) from defaults. + * @type {object} + */ + this.opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge(utils.deriveDeep(this.settings.now.modes[this.id], true), opts); } + /** - * Update Shadow Camera target position and frustum. - * @private + * Get mode identification, probably with options. + * @returns {string|Array} Mode identifier string ({@link Mode#id}) or two-element array containing both mode + * identifier and options ({@link Mode#opts}). + * Options are returned if they were changed during or after the mode creation. */ + identify() { + const diff = utils.objectsDiff(this.opts, this.settings.now.modes[this.id]); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(diff)) { + return [this.id, diff]; + } + return this.id; + } + buildGeometry(complex, colorer, mask, material) { + const polyComplexity = this.opts.polyComplexity ? this.opts.polyComplexity[this.settings.now.resolution] : 0; + const groupList = this.depGroups; + const groupCount = groupList.length; + const group = new gfxutils.RCGroup(); + const self = this; + for (let i = 0; i < groupCount; ++i) { + let currGroup = groupList[i]; + let renderParams = {}; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isArray(currGroup)) { + renderParams = currGroup[1].call(this); + [currGroup] = currGroup; + } + const Group = groups_GroupsFactory[currGroup](null, this.settings, renderParams); + const newGroup = new Group(complex, colorer, self, polyComplexity, mask, material); + if (newGroup.children.length > 0) { + group.add(newGroup); + } + } + return group; + } +} +utils_makeContextDependent(Mode.prototype); + +/** +* Mode identifier. +* @type {string} +*/ +Mode.prototype.id = '__'; + +/** + * Mode geo groups. + * @type {Array} + */ +Mode.prototype.depGroups = []; +/* harmony default export */ const modes_Mode = (Mode); +;// CONCATENATED MODULE: ./src/gfx/modes/LinesMode.js + +function getRenderParams() { + return { + lineWidth: this.opts.lineWidth + }; +} +class LinesMode extends modes_Mode { + static id = 'LN'; + constructor(opts) { + super(opts); + this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits + const groups = this.depGroups; + for (let i = 0, n = groups.length; i < n; ++i) { + groups[i] = [groups[i], getRenderParams]; + } + } + drawMultiorderBonds() { + return this.opts.multibond; + } + calcAtomRadius() { + return this.opts.atom; + } + getAromaticOffset() { + return this.opts.offsarom; + } + getAromaticArcChunks() { + return this.opts.chunkarom; + } + showAromaticLoops() { + return this.opts.showarom; + } +} +LinesMode.prototype.id = 'LN'; +LinesMode.prototype.name = 'Lines'; +LinesMode.prototype.shortName = 'Lines'; +LinesMode.prototype.depGroups = ['ALoopsLines', 'BondsLines', 'OrphanedAtomsCrosses']; +/* harmony default export */ const modes_LinesMode = (LinesMode); +;// CONCATENATED MODULE: ./src/gfx/modes/LicoriceMode.js +/* eslint-disable no-magic-numbers */ + +class LicoriceMode extends modes_Mode { + static id = 'LC'; + calcAtomRadius(_atom) { + return this.opts.bond; + } + calcStickRadius() { + return this.opts.bond; + } + calcSpaceFraction() { + return this.opts.space; + } + getAromRadius() { + return this.opts.aromrad; + } + showAromaticLoops() { + return this.opts.showarom; + } + drawMultiorderBonds() { + return this.opts.multibond; + } +} +LicoriceMode.prototype.id = 'LC'; +LicoriceMode.prototype.name = 'Licorice'; +LicoriceMode.prototype.shortName = 'Licorice'; +LicoriceMode.prototype.depGroups = ['AtomsSpheres', 'BondsCylinders', 'ALoopsTorus']; +/* harmony default export */ const modes_LicoriceMode = (LicoriceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/BallsAndSticksMode.js +/* eslint-disable no-magic-numbers */ + +class BallsAndSticksMode extends modes_Mode { + static id = 'BS'; + calcAtomRadius(atom) { + return atom.element.radius * this.opts.atom; + } + calcStickRadius() { + return this.opts.bond; + } + getAromRadius() { + return this.opts.aromrad; + } + showAromaticLoops() { + return this.opts.showarom; + } + calcSpaceFraction() { + return this.opts.space; + } + drawMultiorderBonds() { + return this.opts.multibond; + } +} +BallsAndSticksMode.prototype.id = 'BS'; +BallsAndSticksMode.prototype.name = 'Balls and Sticks'; +BallsAndSticksMode.prototype.shortName = 'Balls'; +BallsAndSticksMode.prototype.depGroups = ['AtomsSpheres', 'BondsCylinders', 'ALoopsTorus']; +/* harmony default export */ const modes_BallsAndSticksMode = (BallsAndSticksMode); +;// CONCATENATED MODULE: ./src/gfx/modes/VanDerWaalsMode.js + +class VanDerWaalsMode extends modes_Mode { + static id = 'VW'; + calcAtomRadius(atom) { + return atom.element.radius; + } +} +VanDerWaalsMode.prototype.id = 'VW'; +VanDerWaalsMode.prototype.name = 'Van der Waals'; +VanDerWaalsMode.prototype.shortName = 'VDW'; +VanDerWaalsMode.prototype.depGroups = ['AtomsSpheres']; +/* harmony default export */ const modes_VanDerWaalsMode = (VanDerWaalsMode); +;// CONCATENATED MODULE: ./src/gfx/modes/TraceMode.js + +class TraceMode extends modes_Mode { + static id = 'TR'; + calcStickRadius() { + return this.opts.radius; + } +} +TraceMode.prototype.id = 'TR'; +TraceMode.prototype.name = 'Trace'; +TraceMode.prototype.shortName = 'Trace'; +TraceMode.prototype.depGroups = ['TraceChains']; +/* harmony default export */ const modes_TraceMode = (TraceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/TubeMode.js + + +class TubeMode extends modes_Mode { + static id = 'TU'; + getResidueRadius(_residue) { + return this.TUBE_RADIUS; + } + getHeightSegmentsRatio() { + return this.opts.heightSegmentsRatio; + } + getTension() { + return this.opts.tension; + } + buildGeometry(complex, colorer, mask, material) { + const rad = this.opts.radius; + this.TUBE_RADIUS = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(rad, rad); + return modes_Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material); + } +} +TubeMode.prototype.id = 'TU'; +TubeMode.prototype.name = 'Tube'; +TubeMode.prototype.shortName = 'Tube'; +TubeMode.prototype.depGroups = ['CartoonChains']; +/* harmony default export */ const modes_TubeMode = (TubeMode); +;// CONCATENATED MODULE: ./src/gfx/modes/CartoonMode.js + + +class CartoonMode extends modes_Mode { + static id = 'CA'; + constructor(opts) { + super(opts); + // cache for secondary structure options + this.secCache = {}; + } + getResidueStartRadius(residue) { + const second = residue.getSecondary(); + if (!second || !second.generic) { + return this.TUBE_RADIUS; + } + const secOpts = this.secCache[second.generic]; + if (!secOpts) { + return this.TUBE_RADIUS; + } + if (second.term === residue) { + return secOpts.start; + } + return secOpts.center; + } + getResidueEndRadius(residue) { + const second = residue.getSecondary(); + if (second === null || !second.generic) { + return this.TUBE_RADIUS; + } + const secOpts = this.secCache[second.generic]; + if (!secOpts) { + return this.TUBE_RADIUS; + } + if (second.term === residue) { + return this.ARROW_END; + } + return secOpts.center; + } + getResidueRadius(residue, val) { + const startRad = this.getResidueStartRadius(residue); + if (val === 0) { + return startRad; + } + const endRad = this.getResidueEndRadius(residue); + if (val === 2) { + return endRad; + } + return startRad.clone().lerp(endRad, val / 2.0); + } + calcStickRadius(_res) { + return this.opts.radius; + } + getHeightSegmentsRatio() { + return this.opts.heightSegmentsRatio; + } + getTension() { + return this.opts.tension; + } + buildGeometry(complex, colorer, mask, material) { + const tubeRad = this.opts.radius; + const secHeight = this.opts.depth; + this.TUBE_RADIUS = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(tubeRad, tubeRad); + this.ARROW_END = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(secHeight, tubeRad); + const secCache = {}; + const secData = this.opts.ss; + /* eslint-disable guard-for-in */ + for (const prop in secData) { + secCache[prop] = { + center: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(secHeight, secData[prop].width), + start: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(secHeight, secData[prop].arrow) + }; + } + this.secCache = secCache; + /* eslint-enable guard-for-in */ - - Miew.prototype._updateShadowCamera = function () { - var shadowMatrix = new THREE.Matrix4(); - var direction = new THREE.Vector3(); - var OBB = { - center: new THREE.Vector3(), - halfSize: new THREE.Vector3() - }; - return function () { - this._gfx.scene.updateMatrixWorld(); - - for (var i = 0; i < this._gfx.scene.children.length; i++) { - if (this._gfx.scene.children[i].type === 'DirectionalLight') { - var light = this._gfx.scene.children[i]; - shadowMatrix.copy(light.shadow.camera.matrixWorldInverse); - this.getOBB(shadowMatrix, OBB); - direction.subVectors(light.target.position, light.position); - light.position.subVectors(OBB.center, direction); - light.target.position.copy(OBB.center); - light.shadow.bias = 0.09; - light.shadow.camera.bottom = -OBB.halfSize.y; - light.shadow.camera.top = OBB.halfSize.y; - light.shadow.camera.right = OBB.halfSize.x; - light.shadow.camera.left = -OBB.halfSize.x; - light.shadow.camera.near = direction.length() - OBB.halfSize.z; - light.shadow.camera.far = direction.length() + OBB.halfSize.z; - light.shadow.camera.updateProjectionMatrix(); - } + return modes_Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material); + } +} +CartoonMode.prototype.id = 'CA'; +CartoonMode.prototype.name = 'Cartoon'; +CartoonMode.prototype.shortName = 'Cartoon'; +CartoonMode.prototype.depGroups = ['CartoonChains', 'NucleicSpheres', 'NucleicCylinders']; +/* harmony default export */ const modes_CartoonMode = (CartoonMode); +;// CONCATENATED MODULE: ./src/gfx/modes/SurfaceMode.js + + +const { + selectors: SurfaceMode_selectors +} = chem; +function SurfaceMode_getRenderParams() { + return { + wireframe: this.opts.wireframe, + zClip: this.opts.zClip + }; +} +class SurfaceMode extends modes_Mode { + constructor(opts) { + super(opts); + this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits + const surfaces = this.surfaceNames; + const groups = this.depGroups; + for (let i = 0, n = surfaces.length; i < n; ++i) { + groups[groups.length] = [surfaces[i], SurfaceMode_getRenderParams]; + } + } + calcAtomRadius(atom) { + return atom.element.radius; + } + getVisibilitySelector() { + let visibilitySelector = null; + if (this.opts.subset !== '') { + const res = SurfaceMode_selectors.parse(this.opts.subset); + if (!res.error) { + visibilitySelector = res.selector; } + } + return visibilitySelector; + } +} +SurfaceMode.prototype.isSurface = true; +SurfaceMode.prototype.surfaceNames = []; +/* harmony default export */ const modes_SurfaceMode = (SurfaceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/QuickSurfaceMode.js + +class QuickSurfaceMode extends modes_SurfaceMode { + static id = 'QS'; + getSurfaceOpts() { + return { + useBeads: false, + isoValue: this.opts.isoValue, + gaussLim: this.opts.gaussLim[this.settings.now.resolution], + radScale: this.opts.scale, + gridSpacing: this.opts.gridSpacing[this.settings.now.resolution], + zClip: this.opts.zClip, + visibilitySelector: this.getVisibilitySelector() }; - }(); - /** - * Initialize the viewer. - * @returns {boolean} true on success. - * @throws Forwards exception raised during initialization. - * @see Miew#term - */ - - - Miew.prototype.init = function () { - var container = this._container; - var elem = utils.createElement('div', { - "class": 'miew-canvas' + } +} +QuickSurfaceMode.prototype.id = 'QS'; +QuickSurfaceMode.prototype.name = 'Quick Surface'; +QuickSurfaceMode.prototype.shortName = 'Quick Surf'; +QuickSurfaceMode.prototype.surfaceNames = ['QuickSurfGeo']; +/* harmony default export */ const modes_QuickSurfaceMode = (QuickSurfaceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/IsoSurfaceMode.js + +class IsoSurfaceMode extends modes_SurfaceMode { + constructor(excludeProbe, opts) { + super(opts); + this._excludeProbe = excludeProbe; + } + calcAtomRadius(atom) { + return atom.element.radius; + } + getSurfaceOpts() { + return { + gridSpacing: this.opts.polyComplexity[this.settings.now.resolution], + radScale: this._radScale, + zClip: this.opts.zClip, + visibilitySelector: this.getVisibilitySelector(), + probeRadius: this.opts.probeRadius, + excludeProbe: this._excludeProbe + }; + } +} +IsoSurfaceMode.prototype.id = 'SU'; +IsoSurfaceMode.prototype.name = 'Surface'; +IsoSurfaceMode.prototype.shortName = 'Surface'; +IsoSurfaceMode.prototype.surfaceNames = ['SASSESSurfaceGeo']; +IsoSurfaceMode.prototype._radScale = 1; +IsoSurfaceMode.prototype._excludeProbe = false; +/* harmony default export */ const modes_IsoSurfaceMode = (IsoSurfaceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/IsoSurfaceSASMode.js + +class IsoSurfaceSASMode extends modes_IsoSurfaceMode { + static id = 'SA'; + constructor(opts) { + super(false, opts); + } +} +IsoSurfaceSASMode.prototype.id = 'SA'; +IsoSurfaceSASMode.prototype.name = 'Solvent Accessible Surface'; +IsoSurfaceSASMode.prototype.shortName = 'SAS'; +/* harmony default export */ const modes_IsoSurfaceSASMode = (IsoSurfaceSASMode); +;// CONCATENATED MODULE: ./src/gfx/modes/IsoSurfaceSESMode.js + +class IsoSurfaceSESMode extends modes_IsoSurfaceMode { + static id = 'SE'; + constructor(opts) { + super(true, opts); + } +} +IsoSurfaceSESMode.prototype.id = 'SE'; +IsoSurfaceSESMode.prototype.name = 'Solvent Excluded Surface'; +IsoSurfaceSESMode.prototype.shortName = 'SES'; +/* harmony default export */ const modes_IsoSurfaceSESMode = (IsoSurfaceSESMode); +;// CONCATENATED MODULE: ./src/gfx/modes/ContactSurfaceMode.js + +class ContactSurfaceMode extends modes_SurfaceMode { + static id = 'CS'; + getSurfaceOpts() { + return { + probeRadius: this.opts.probeRadius, + radScale: this.opts.polyComplexity[this.settings.now.resolution], + scaleFactor: this.opts.polyComplexity[this.settings.now.resolution], + gridSpacing: 1.0 / this.opts.polyComplexity[this.settings.now.resolution], + isoValue: this.opts.isoValue, + probePositions: this.opts.probePositions, + zClip: this.opts.zClip, + visibilitySelector: this.getVisibilitySelector() + }; + } +} +ContactSurfaceMode.prototype.id = 'CS'; +ContactSurfaceMode.prototype.name = 'Contact Surface'; +ContactSurfaceMode.prototype.shortName = 'Contact Surf'; +ContactSurfaceMode.prototype.isSurface = true; +ContactSurfaceMode.prototype.surfaceNames = ['ContactSurfaceGeo']; +/* harmony default export */ const modes_ContactSurfaceMode = (ContactSurfaceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/TextMode.js + + +class TextMode extends modes_Mode { + static id = 'TX'; + getTemplateOptions() { + return this.opts.template; + } + getLabelOpts() { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge(this.opts, { + colors: true, + adjustColor: true, + transparent: true }); + } +} +TextMode.prototype.id = 'TX'; +TextMode.prototype.name = 'Text mode'; +TextMode.prototype.shortName = 'Text'; +TextMode.prototype.depGroups = ['TextLabelsGeo']; +/* harmony default export */ const modes_TextMode = (TextMode); +;// CONCATENATED MODULE: ./src/gfx/modes.js - _setContainerContents(container, elem); - - this._container = elem; - var frag = document.createDocumentFragment(); - frag.appendChild(this._msgMode = createElement$2('div', { - "class": 'mode-message overlay' - }, createElement$2('p', {}, 'COMPONENT EDIT MODE'))); - frag.appendChild(this._msgAtomInfo = createElement$2('div', { - "class": 'atom-info overlay' - }, createElement$2('p', {}, ''))); - container.appendChild(frag); - - if (this._gfx !== null) { - // block double init - return true; - } - - var self = this; - - this._showMessage('Viewer is being initialized...'); - - try { - this._initGfx(); - this._initListeners(); - this._spinner = new Spinner({ - lines: 13, - length: 28, - width: 14, - radius: 42, - color: '#fff', - zIndex: 700 - }); - window.top.addEventListener('keydown', function (event) { - self._onKeyDown(event); - }); - window.top.addEventListener('keyup', function (event) { - self._onKeyUp(event); - }); - this._objectControls = new ObjectControls(this._gfx.root, this._gfx.pivot, this._gfx.camera, this._gfx.renderer.domElement, function () { - return self._getAltObj(); - }); - this._objectControls.addEventListener('change', function (e) { - if (settings.now.shadow.on) { - self._updateShadowCamera(); - } // route rotate, zoom, translate and translatePivot events to the external API - switch (e.action) { - case 'rotate': - self.dispatchEvent({ - type: 'rotate', - quaternion: e.quaternion - }); - break; - case 'zoom': - self.dispatchEvent({ - type: 'zoom', - factor: e.factor - }); - break; - default: - self.dispatchEvent({ - type: e.action - }); - } - self.dispatchEvent({ - type: 'transform' - }); - self._needRender = true; - }); - var gfx = this._gfx; - this._picker = new Picker(gfx.root, gfx.camera, gfx.renderer.domElement); - this._picker.addEventListener('newpick', function (event) { - self._onPick(event); - }); - this._picker.addEventListener('dblclick', function (event) { - self.center(event); - }); - } catch (error) { - if (error.name === 'TypeError' && error.message === 'Cannot read property \'getExtension\' of null') { - this._showMessage('Could not create WebGL context.'); - } else if (error.message.search(/webgl/i) > 1) { - this._showMessage(error.message); - } else { - this._showMessage('Viewer initialization failed.'); - throw error; - } +const modes = new utils_EntityList([modes_LinesMode, modes_LicoriceMode, modes_BallsAndSticksMode, modes_VanDerWaalsMode, modes_TraceMode, modes_TubeMode, modes_CartoonMode, modes_QuickSurfaceMode, modes_IsoSurfaceSASMode, modes_IsoSurfaceSESMode, modes_ContactSurfaceMode, modes_TextMode]); +/* harmony default export */ const gfx_modes = (modes); +;// CONCATENATED MODULE: ./src/gfx/palettes/Palette.js - return false; - } // automatically load default file +function clamp(x, a, b) { + return x <= b ? x < 0 ? 0 : x : b; +} +function lerpColor(c1, c2, alpha) { + const beta = 1 - alpha; + const r1 = c1 >> 16 & 0xff; + const g1 = c1 >> 8 & 0xff; + const b1 = c1 & 0xff; + const r2 = c2 >> 16 & 0xff; + const g2 = c2 >> 8 & 0xff; + const b2 = c2 & 0xff; + const r = beta * r1 + alpha * r2; + const g = beta * g1 + alpha * g2; + const b = beta * b1 + alpha * b2; + return r << 16 | g << 8 | b; +} +class Palette { + constructor(name, id) { + this.name = name || 'Custom'; + this.id = id || 'CP'; + } + getElementColor(name) { + let asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + const color = this.elementColors[name]; + return color === undefined && !asIs ? this.defaultElementColor : color; + } + getResidueColor(name) { + let asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + const color = this.residueColors[name]; + return color === undefined && !asIs ? this.defaultResidueColor : color; + } + getChainColor(name) { + let chain = name.charCodeAt(0); + chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F) % this.chainColors.length; + return this.chainColors[chain]; + } + getSecondaryColor(type) { + let asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + const color = this.secondaryColors[type]; + return color === undefined && !asIs ? this.defaultSecondaryColor : color; + } + getSequentialColor(index) { + const { + colors + } = this; + const len = colors.length; + return index < 0 ? colors[index % len + len] : colors[index % len]; + } + getGradientColor(value, gradientName) { + const gradient = this.gradients[gradientName]; + if (!gradient) { + return this.defaultNamedColor; + } + const count = gradient.length; + const index = value * (count - 1); + let left = Math.floor(index); + const right = clamp(left + 1, 0, count - 1); + left = clamp(left, 0, count - 1); + return lerpColor(gradient[left], gradient[right], index - left); + } + getNamedColor(name) { + let asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + const color = this.namedColors[name]; + return color === undefined && !asIs ? this.defaultNamedColor : color; + } +} +external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().assign(Palette.prototype, { + colors: [0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0x808080], + minRangeColor: 0x000000, + midRangeColor: 0x7F7F7F, + maxRangeColor: 0xFFFFFF, + defaultElementColor: 0xFFFFFF, + elementColors: {}, + defaultResidueColor: 0xFFFFFF, + residueColors: {}, + chainColors: [0xFFFFFF], + defaultSecondaryColor: 0xFFFFFF, + secondaryColors: {}, + defaultGradientColor: 0x000000, + defaultNamedColor: 0xFFFFFF, + namedColorsArray: [/* eslint-disable no-multi-spaces */ + ['indianred', 0xcd5c5c], ['lightcoral', 0xf08080], ['salmon', 0xfa8072], ['darksalmon', 0xe9967a], ['lightsalmon', 0xffa07a], ['crimson', 0xdc143c], ['red', 0xff0000], ['firebrick', 0xb22222], ['darkred', 0x8b0000], ['pink', 0xffc0cb], ['lightpink', 0xffb6c1], ['hotpink', 0xff69b4], ['deeppink', 0xff1493], ['mediumvioletred', 0xc71585], ['palevioletred', 0xdb7093], ['coral', 0xff7f50], ['tomato', 0xff6347], ['orangered', 0xff4500], ['darkorange', 0xff8c00], ['orange', 0xffa500], ['gold', 0xffd700], ['yellow', 0xffff00], ['lightyellow', 0xffffe0], ['lemonchiffon', 0xfffacd], ['lightgoldenrodyellow', 0xfafad2], ['papayawhip', 0xffefd5], ['moccasin', 0xffe4b5], ['peachpuff', 0xffdab9], ['palegoldenrod', 0xeee8aa], ['khaki', 0xf0e68c], ['darkkhaki', 0xbdb76b], ['lavender', 0xe6e6fa], ['thistle', 0xd8bfd8], ['plum', 0xdda0dd], ['violet', 0xee82ee], ['orchid', 0xda70d6], ['fuchsia', 0xff00ff], ['magenta', 0xff00ff], ['mediumorchid', 0xba55d3], ['mediumpurple', 0x9370db], ['rebeccapurple', 0x663399], ['blueviolet', 0x8a2be2], ['darkviolet', 0x9400d3], ['darkorchid', 0x9932cc], ['darkmagenta', 0x8b008b], ['purple', 0x800080], ['indigo', 0x4b0082], ['slateblue', 0x6a5acd], ['mediumslateblue', 0x7b68ee], ['darkslateblue', 0x483d8b], ['greenyellow', 0xadff2f], ['chartreuse', 0x7fff00], ['lawngreen', 0x7cfc00], ['lime', 0x00ff00], ['limegreen', 0x32cd32], ['palegreen', 0x98fb98], ['lightgreen', 0x90ee90], ['mediumspringgreen', 0x00fa9a], ['springgreen', 0x00ff7f], ['mediumseagreen', 0x3cb371], ['seagreen', 0x2e8b57], ['forestgreen', 0x228b22], ['green', 0x008000], ['darkgreen', 0x006400], ['yellowgreen', 0x9acd32], ['olivedrab', 0x6b8e23], ['olive', 0x808000], ['darkolivegreen', 0x556b2f], ['mediumaquamarine', 0x66cdaa], ['darkseagreen', 0x8fbc8f], ['lightseagreen', 0x20b2aa], ['darkcyan', 0x008b8b], ['teal', 0x008080], ['aqua', 0x00ffff], ['cyan', 0x00ffff], ['lightcyan', 0xe0ffff], ['paleturquoise', 0xafeeee], ['aquamarine', 0x7fffd4], ['turquoise', 0x40e0d0], ['mediumturquoise', 0x48d1cc], ['darkturquoise', 0x00ced1], ['cadetblue', 0x5f9ea0], ['steelblue', 0x4682b4], ['lightsteelblue', 0xb0c4de], ['powderblue', 0xb0e0e6], ['lightblue', 0xadd8e6], ['skyblue', 0x87ceeb], ['lightskyblue', 0x87cefa], ['deepskyblue', 0x00bfff], ['dodgerblue', 0x1e90ff], ['cornflowerblue', 0x6495ed], ['royalblue', 0x4169e1], ['blue', 0x0000ff], ['mediumblue', 0x0000cd], ['darkblue', 0x00008b], ['navy', 0x000080], ['midnightblue', 0x191970], ['cornsilk', 0xfff8dc], ['blanchedalmond', 0xffebcd], ['bisque', 0xffe4c4], ['navajowhite', 0xffdead], ['wheat', 0xf5deb3], ['burlywood', 0xdeb887], ['tan', 0xd2b48c], ['rosybrown', 0xbc8f8f], ['sandybrown', 0xf4a460], ['goldenrod', 0xdaa520], ['darkgoldenrod', 0xb8860b], ['peru', 0xcd853f], ['chocolate', 0xd2691e], ['saddlebrown', 0x8b4513], ['sienna', 0xa0522d], ['brown', 0xa52a2a], ['maroon', 0x800000], ['white', 0xffffff], ['snow', 0xfffafa], ['honeydew', 0xf0fff0], ['mintcream', 0xf5fffa], ['azure', 0xf0ffff], ['aliceblue', 0xf0f8ff], ['ghostwhite', 0xf8f8ff], ['whitesmoke', 0xf5f5f5], ['seashell', 0xfff5ee], ['beige', 0xf5f5dc], ['oldlace', 0xfdf5e6], ['floralwhite', 0xfffaf0], ['ivory', 0xfffff0], ['antiquewhite', 0xfaebd7], ['linen', 0xfaf0e6], ['lavenderblush', 0xfff0f5], ['mistyrose', 0xffe4e1], ['gainsboro', 0xdcdcdc], ['lightgray', 0xd3d3d3], ['silver', 0xc0c0c0], ['darkgray', 0xa9a9a9], ['gray', 0x808080], ['dimgray', 0x696969], ['lightslategray', 0x778899], ['slategray', 0x708090], ['darkslategray', 0x2f4f4f], ['black', 0x000000] + /* eslint-enable no-multi-spaces */], + namedColors: {}, + /* eslint-enable no-magic-numbers */ + gradients: { + rainbow: [0x0000ff, + // blue + 0x00ffff, + // cyan + 0x00ff00, + // green + 0xffff00, + // yellow + 0xff0000 // red + ], + temp: [0x0000ff, + // blue + 0x007fff, + // light-blue + 0xffffff, + // white + 0xff7f00, + // orange + 0xff0000 // red + ], + hot: [0xffffff, + // white + 0xff7f00, + // orange + 0xff0000 // red + ], + cold: [0xffffff, + // white + 0x007fff, + // light-blue + 0x0000ff // blue + ], + 'blue-red': [0x0000ff, + // blue + 0xffffff, + // white + 0xff0000 // red + ], + reds: [0xffffff, + // white + 0xff0000 // red + ], + blues: [0xffffff, + // white + 0x0000ff // blue + ] + } +}); +const { + namedColorsArray, + namedColors +} = Palette.prototype; +for (let i = 0, { + length + } = namedColorsArray; i < length; ++i) { + const [name, value] = namedColorsArray[i]; + namedColors[name] = value; +} +/* harmony default export */ const palettes_Palette = (Palette); +;// CONCATENATED MODULE: ./src/gfx/palettes/cpkPalette.js + +const palette = new palettes_Palette('CPK', 'CP'); + +// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. +palette.elementColors = { + /* eslint-disable no-magic-numbers */ + H: 0xFFFFFF, + C: 0x202020, + N: 0x2060FF, + O: 0xEE2010, + F: 0x00FF00, + P: 0x8020FF, + S: 0xFFFF00, + CL: 0x00BB00, + FE: 0xD0D0D0, + CO: 0xD0D0D0, + NI: 0xD0D0D0, + CU: 0xD0D0D0, + BR: 0x008800, + I: 0x005500 + /* eslint-enable no-magic-numbers */ +}; +/* harmony default export */ const cpkPalette = (palette); +;// CONCATENATED MODULE: ./src/gfx/palettes/jmolPalette.js + + +const jmolPalette_palette = new palettes_Palette('Jmol', 'JM'); +jmolPalette_palette.colors = [/* eslint-disable no-magic-numbers */ +0x0000FF, +// blue +0x0055FF, +// +0x00ABFF, +// +0x00FFFF, +// cyan +0x00FFAB, +// +0x00FF55, +// +0x00FF00, +// green +0x55FF00, +// +0xABFF00, +// +0xFFFF00, +// yellow +0xFFAB00, +// +0xFF5500, +// +0xFF0000, +// red +0xFF0055, +// +0xFF00AB, +// +0xFF00FF, +// magenta +0xAB00FF, +// +0x5500FF // +/* eslint-enable no-magic-numbers */]; + +// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. +jmolPalette_palette.elementColors = { + /* eslint-disable no-magic-numbers */ + H: 0xFFFFFF, + D: 0xFFFFC0, + T: 0xFFFFA0, + HE: 0xD9FFFF, + LI: 0xCC80FF, + BE: 0xC2FF00, + B: 0xFFB5B5, + C: 0x909090, + N: 0x3050F8, + O: 0xFF0D0D, + F: 0x90E050, + NE: 0xB3E3F5, + NA: 0xAB5CF2, + MG: 0x8AFF00, + AL: 0xBFA6A6, + SI: 0xF0C8A0, + P: 0xFF8000, + S: 0xFFFF30, + CL: 0x1FF01F, + AR: 0x80D1E3, + K: 0x8F40D4, + CA: 0x3DFF00, + SC: 0xE6E6E6, + TI: 0xBFC2C7, + V: 0xA6A6AB, + CR: 0x8A99C7, + MN: 0x9C7AC7, + FE: 0xE06633, + CO: 0xF090A0, + NI: 0x50D050, + CU: 0xC88033, + ZN: 0x7D80B0, + GA: 0xC28F8F, + GE: 0x668F8F, + AS: 0xBD80E3, + SE: 0xFFA100, + BR: 0xA62929, + KR: 0x5CB8D1, + RB: 0x702EB0, + SR: 0x00FF00, + Y: 0x94FFFF, + ZR: 0x94E0E0, + NB: 0x73C2C9, + MO: 0x54B5B5, + TC: 0x3B9E9E, + RU: 0x248F8F, + RH: 0x0A7D8C, + PD: 0x006985, + AG: 0xC0C0C0, + CD: 0xFFD98F, + IN: 0xA67573, + SN: 0x668080, + SB: 0x9E63B5, + TE: 0xD47A00, + I: 0x940094, + XE: 0x429EB0, + CS: 0x57178F, + BA: 0x00C900, + LA: 0x70D4FF, + CE: 0xFFFFC7, + PR: 0xD9FFC7, + ND: 0xC7FFC7, + PM: 0xA3FFC7, + SM: 0x8FFFC7, + EU: 0x61FFC7, + GD: 0x45FFC7, + TB: 0x30FFC7, + DY: 0x1FFFC7, + HO: 0x00FF9C, + ER: 0x00E675, + TM: 0x00D452, + YB: 0x00BF38, + LU: 0x00AB24, + HF: 0x4DC2FF, + TA: 0x4DA6FF, + W: 0x2194D6, + RE: 0x267DAB, + OS: 0x266696, + IR: 0x175487, + PT: 0xD0D0E0, + AU: 0xFFD123, + HG: 0xB8B8D0, + TL: 0xA6544D, + PB: 0x575961, + BI: 0x9E4FB5, + PO: 0xAB5C00, + AT: 0x754F45, + RN: 0x428296, + FR: 0x420066, + RA: 0x007D00, + AC: 0x70ABFA, + TH: 0x00BAFF, + PA: 0x00A1FF, + U: 0x008FFF, + NP: 0x0080FF, + PU: 0x006BFF, + AM: 0x545CF2, + CM: 0x785CE3, + BK: 0x8A4FE3, + CF: 0xA136D4, + ES: 0xB31FD4, + FM: 0xB31FBA, + MD: 0xB30DA6, + NO: 0xBD0D87, + LR: 0xC70066, + RF: 0xCC0059, + DB: 0xD1004F, + SG: 0xD90045, + BH: 0xE00038, + HS: 0xE6002E, + MT: 0xEB0026 + /* eslint-enable no-magic-numbers */ +}; +jmolPalette_palette.defaultResidueColor = 0xBEA06E; - var file = this._opts && this._opts.load; +// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. +jmolPalette_palette.residueColors = { + /* eslint-disable no-magic-numbers */ + ALA: 0xC8C8C8, + ARG: 0x145AFF, + ASN: 0x00DCDC, + ASP: 0xE60A0A, + CYS: 0xE6E600, + GLN: 0x00DCDC, + GLU: 0xE60A0A, + GLY: 0xEBEBEB, + HIS: 0x8282D2, + ILE: 0x0F820F, + LEU: 0x0F820F, + LYS: 0x145AFF, + MET: 0xE6E600, + PHE: 0x3232AA, + PRO: 0xDC9682, + SER: 0xFA9600, + THR: 0xFA9600, + TRP: 0xB45AB4, + TYR: 0x3232AA, + VAL: 0x0F820F, + A: 0xA0A0FF, + C: 0xFF8C4B, + G: 0xFF7070, + I: 0x80FFFF, + T: 0xA0FFA0, + U: 0xFF8080, + DA: 0xA0A0FF, + DC: 0xFF8C4B, + DG: 0xFF7070, + DI: 0x80FFFF, + DT: 0xA0FFA0, + DU: 0xFF8080, + '+A': 0xA0A0FF, + '+C': 0xFF8C4B, + '+G': 0xFF7070, + '+I': 0x80FFFF, + '+T': 0xA0FFA0, + '+U': 0xFF8080 + /* eslint-enable no-magic-numbers */ +}; +jmolPalette_palette.chainColors = [ +// ' '->0 'A'->1, 'B'->2 +0xFFffffff, +// ' ' & '0' white +// +0xFFC0D0FF, +// skyblue +0xFFB0FFB0, +// pastel green +0xFFFFC0C8, +// pink +0xFFFFFF80, +// pastel yellow +0xFFFFC0FF, +// pastel magenta +0xFFB0F0F0, +// pastel cyan +0xFFFFD070, +// pastel gold +0xFFF08080, +// lightcoral + +0xFFF5DEB3, +// wheat +0xFF00BFFF, +// deepskyblue +0xFFCD5C5C, +// indianred +0xFF66CDAA, +// mediumaquamarine +0xFF9ACD32, +// yellowgreen +0xFFEE82EE, +// violet +0xFF00CED1, +// darkturquoise +0xFF00FF7F, +// springgreen +0xFF3CB371, +// mediumseagreen + +0xFF00008B, +// darkblue +0xFFBDB76B, +// darkkhaki +0xFF006400, +// darkgreen +0xFF800000, +// maroon +0xFF808000, +// olive +0xFF800080, +// purple +0xFF008080, +// teal +0xFFB8860B, +// darkgoldenrod +0xFFB22222 // firebrick +]; +const jmolPalette_StructuralElementType = chem_StructuralElement.Type; +jmolPalette_palette.secondaryColors = { + [jmolPalette_StructuralElementType.HELIX_ALPHA]: 0xFF0080, + [jmolPalette_StructuralElementType.HELIX_PI]: 0x600080, + [jmolPalette_StructuralElementType.HELIX_310]: 0xA00080, + [jmolPalette_StructuralElementType.STRAND]: 0xFFC800, + [jmolPalette_StructuralElementType.TURN]: 0x6080FF, + dna: 0xAE00FE, + rna: 0xFD0162 +}; +/* harmony default export */ const jmolPalette = (jmolPalette_palette); +;// CONCATENATED MODULE: ./src/gfx/palettes/vmdPalette.js + + +const vmdPalette_palette = new palettes_Palette('VMD', 'VM'); +vmdPalette_palette.colors = [/* eslint-disable no-magic-numbers */ +0x0000FF, +// blue +0xFF0000, +// red +0x606060, +// gray +0xFF8000, +// orange +0xFFFF00, +// yellow +0x808033, +// tan +0x999999, +// silver +0x00FF00, +// green +0xFFFFFF, +// white +0xFF9999, +// pink +0x40C0C0, +// cyan +0xA600A6, +// purple +0x80E666, +// lime +0xE666B3, +// mauve +0x804D00, +// ochre +0x8080C0 // ice blue +/* eslint-enable no-magic-numbers */]; +vmdPalette_palette.defaultElementColor = 0x804D00; + +// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. +vmdPalette_palette.elementColors = { + /* eslint-disable no-magic-numbers */ + H: 0xFFFFFF, + C: 0x40BFBF, + N: 0x0000FF, + O: 0xFF0000, + P: 0x808033, + S: 0xFFFF00 + /* eslint-enable no-magic-numbers */ +}; +vmdPalette_palette.defaultResidueColor = 0x40C0C0; - if (file) { - var type = this._opts && this._opts.type; - this.load(file, { - fileType: type, - keepRepsInfo: true - }); +// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. +vmdPalette_palette.residueColors = { + /* eslint-disable no-magic-numbers */ + ALA: 0x0000FF, + ARG: 0xFFFFFF, + ASN: 0x808033, + ASP: 0xFF0000, + CYS: 0xFFFF00, + GLN: 0xFF8000, + GLU: 0xFF9999, + GLY: 0xFFFFFF, + HIS: 0x40C0C0, + ILE: 0x00FF00, + LEU: 0xFF9999, + LYS: 0x40C0C0, + MET: 0xFFFF00, + PHE: 0xA600A6, + PRO: 0x804C00, + SER: 0xFFFF00, + THR: 0xE666B3, + TRP: 0x999999, + TYR: 0x00FF00, + VAL: 0x808033, + A: 0x0000FF, + C: 0xFF8000, + G: 0xFFFF00, + T: 0xA600A6, + U: 0x00FF00, + DA: 0x0000FF, + DC: 0xFF8000, + DG: 0xFFFF00, + DT: 0xA600A6, + DU: 0x00FF00, + '+A': 0x0000FF, + '+C': 0xFF8000, + '+G': 0xFFFF00, + '+T': 0xA600A6, + '+U': 0x00FF00, + WAT: 0x40C0C0, + H2O: 0x40C0C0, + HOH: 0x40C0C0 + /* eslint-enable no-magic-numbers */ +}; +vmdPalette_palette.chainColors = [0xFFFFFF].concat(vmdPalette_palette.colors); +const vmdPalette_StructuralElementType = chem_StructuralElement.Type; +vmdPalette_palette.secondaryColors = { + [vmdPalette_StructuralElementType.HELIX_ALPHA]: 0xA600A6, + [vmdPalette_StructuralElementType.HELIX_310]: 0x0000FF, + [vmdPalette_StructuralElementType.HELIX_PI]: 0xFF0000, + [vmdPalette_StructuralElementType.STRAND]: 0xFFFF00, + [vmdPalette_StructuralElementType.BRIDGE]: 0x808033, + [vmdPalette_StructuralElementType.TURN]: 0x40C0C0 +}; +/* harmony default export */ const vmdPalette = (vmdPalette_palette); +;// CONCATENATED MODULE: ./src/gfx/palettes.js + + + + +const palettes = new utils_EntityList([cpkPalette, jmolPalette, vmdPalette]); +/* harmony default export */ const gfx_palettes = (palettes); +;// CONCATENATED MODULE: ./src/gfx/colorers/Colorer.js + + + + + +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. + * + * These options are copied locally and not kept by reference, so the created instance will not reflect further + * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation. + * + * @exports Colorer + * @this Colorer + * @abstract + * @constructor + * @classdesc Basic class for all available coloring algorithms used for building and displaying molecule geometry. + */ +class Colorer { + constructor(opts) { + if (this.constructor === Colorer) { + throw new Error('Can not instantiate abstract class!'); } + /** + * Colorer options inherited (prototyped) from defaults. + * @type {object} + */ + this.opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge(utils.deriveDeep(settings.now.colorers[this.id], true), opts); + /** + * Palette in use. + * @type {Palette} + */ + this.palette = gfx_palettes.first; + } - return true; - }; - /** - * Terminate the viewer completely. - * @see Miew#init - */ - - - Miew.prototype.term = function () { - this._showMessage('Viewer has been terminated.'); - - this._loading.forEach(function (job) { - job.cancel(); - }); - - this._loading.length = 0; - this.halt(); - this._gfx = null; - }; - /** - * Display message inside the viewer container, hiding WebGL canvas. - * @param {string} msg - Message to show. - * @private - */ - - - Miew.prototype._showMessage = function (msg) { - var element = document.createElement('div'); - element.setAttribute('class', 'miew-message'); - element.appendChild(document.createElement('p')).appendChild(document.createTextNode(msg)); - - _setContainerContents(this._container, element); - }; /** - * Display WebGL canvas inside the viewer container, hiding any message shown. - * @private + * Get Colorer identification, probably with options. + * @returns {string|Array} Colorer identifier string ({@link Colorer#id}) or two-element array containing both colorer + * identifier and options ({@link Colorer#opts}). + * Options are returned if they were changed during or after colorer creation. */ - - - Miew.prototype._showCanvas = function () { - _setContainerContents(this._container, this._gfx.renderer.domElement); - }; - - Miew.prototype._requestAnimationFrame = function (callback) { - var xr = this._gfx.renderer.xr; - - if (xr && xr.enabled) { - this._gfx.renderer.setAnimationLoop(callback); - - return; + identify() { + const diff = utils.objectsDiff(this.opts, settings.now.colorers[this.id]); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(diff)) { + return [this.id, diff]; } - - requestAnimationFrame(callback); - }; - - function arezSpritesSupported(context) { - return context.getExtension('EXT_frag_depth'); + return this.id; } - - function isAOSupported(context) { - return context.getExtension('WEBGL_depth_texture') && context.getExtension('WEBGL_draw_buffers'); +} + +/** + * Colorer identifier. + * @type {string} + */ + +Colorer.prototype.id = '__'; +/* harmony default export */ const colorers_Colorer = (Colorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ElementColorer.js + + +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @see Element + * + * @exports ElementColorer + * @augments Colorer + * @constructor + * @classdesc Coloring algorithm based on chemical element. + */ +class ElementColorer extends colorers_Colorer { + static id = 'EL'; + getAtomColor(atom, _complex) { + const type = atom.element.name; + if (type === 'C' && this.opts.carbon >= 0) { + return this.opts.carbon; + } + return this.palette.getElementColor(type); } - /** - * Initialize WebGL and set 3D scene up. - * @private - */ - - - Miew.prototype._initGfx = function () { - var gfx = { - width: this._container.clientWidth, - height: this._container.clientHeight - }; - var webGLOptions = { - preserveDrawingBuffer: true, - alpha: true, - premultipliedAlpha: false - }; - - if (settings.now.antialias) { - webGLOptions.antialias = true; + getResidueColor(_residue, _complex) { + return this.palette.defaultResidueColor; + } +} +ElementColorer.prototype.id = 'EL'; +ElementColorer.prototype.name = 'Element'; +ElementColorer.prototype.shortName = 'Element'; +/* harmony default export */ const colorers_ElementColorer = (ElementColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ResidueTypeColorer.js + + +/** + * Coloring algorithm based on residue type. + * + * @see ResidueType + * + * @exports ResidueTypeColorer + * @constructor + */ +class ResidueTypeColorer extends colorers_Colorer { + static id = 'RT'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + return this.palette.getResidueColor(residue._type._name); + } +} +ResidueTypeColorer.prototype.id = 'RT'; +ResidueTypeColorer.prototype.name = 'Residue Type'; +ResidueTypeColorer.prototype.shortName = 'Residue'; +/* harmony default export */ const colorers_ResidueTypeColorer = (ResidueTypeColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/SequenceColorer.js + +class SequenceColorer extends colorers_Colorer { + static id = 'SQ'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + const chain = residue._chain; + if (chain.minSequence === Number.POSITIVE_INFINITY && chain.maxSequence === Number.NEGATIVE_INFINITY) { + return this.palette.defaultNamedColor; + } + const min = chain.minSequence; + const max = chain.maxSequence > min ? chain.maxSequence : min + 1; + return this.palette.getGradientColor((residue._sequence - min) / (max - min), this.opts.gradient); + } +} +SequenceColorer.prototype.id = 'SQ'; +SequenceColorer.prototype.name = 'Sequence'; +SequenceColorer.prototype.shortName = 'Sequence'; +/* harmony default export */ const colorers_SequenceColorer = (SequenceColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ChainColorer.js + +class ChainColorer extends colorers_Colorer { + static id = 'CH'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + return this.palette.getChainColor(residue.getChain()._name); + } +} +ChainColorer.prototype.id = 'CH'; +ChainColorer.prototype.name = 'Chain'; +ChainColorer.prototype.shortName = 'Chain'; +/* harmony default export */ const colorers_ChainColorer = (ChainColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/SecondaryStructureColorer.js + + +class SecondaryStructureColorer extends colorers_Colorer { + static id = 'SS'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + if (residue._type.flags & chem_ResidueType.Flags.DNA) { + return this.palette.getSecondaryColor('dna'); } - - gfx.renderer2d = new CSS2DRenderer(); - gfx.renderer = new THREE.WebGLRenderer(webGLOptions); - gfx.renderer.shadowMap.enabled = settings.now.shadow.on; - gfx.renderer.shadowMap.autoUpdate = false; - gfx.renderer.shadowMap.type = THREE.PCFShadowMap; - capabilities.init(gfx.renderer); // z-sprites and ambient occlusion possibility - - if (!arezSpritesSupported(gfx.renderer.getContext())) { - settings.set('zSprites', false); + if (residue._type.flags & chem_ResidueType.Flags.RNA) { + return this.palette.getSecondaryColor('rna'); } - - if (!isAOSupported(gfx.renderer.getContext())) { - settings.set('ao', false); + const secondary = residue.getSecondary(); + if (secondary) { + let color = this.palette.getSecondaryColor(secondary.type, true); + if (color === undefined) { + color = this.palette.getSecondaryColor(secondary.generic); + } + return color; } - - gfx.renderer.autoClear = false; - gfx.renderer.setPixelRatio(window.devicePixelRatio); - gfx.renderer.setSize(gfx.width, gfx.height); - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - gfx.renderer.clearColor(); - gfx.renderer2d.setSize(gfx.width, gfx.height); - gfx.camera = new THREE.PerspectiveCamera(settings.now.camFov, gfx.width / gfx.height, settings.now.camNear, settings.now.camFar); - gfx.camera.setMinimalFov(settings.now.camFov); - gfx.camera.position.z = settings.now.camDistance; - gfx.camera.updateProjectionMatrix(); - gfx.camera.layers.set(gfxutils.LAYERS.DEFAULT); - gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME); - gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME_BFPLANE); - gfx.stereoCam = new THREE.StereoCamera(); - gfx.scene = new THREE.Scene(); - var color = chooseFogColor(); - gfx.scene.fog = new THREE.Fog(color, settings.now.camNear, settings.now.camFar); - gfx.root = new gfxutils.RCGroup(); - gfx.scene.add(gfx.root); - gfx.pivot = new gfxutils.RCGroup(); - gfx.root.add(gfx.pivot); - gfx.selectionScene = new THREE.Scene(); - gfx.selectionRoot = new THREE.Group(); - gfx.selectionRoot.matrixAutoUpdate = false; - gfx.selectionScene.add(gfx.selectionRoot); - gfx.selectionPivot = new THREE.Group(); - gfx.selectionPivot.matrixAutoUpdate = false; - gfx.selectionRoot.add(gfx.selectionPivot); - var light12 = new THREE.DirectionalLight(0xffffff, 0.45); - light12.position.set(0, 0.414, 1); - light12.layers.enable(gfxutils.LAYERS.TRANSPARENT); - light12.castShadow = true; - light12.shadow = new THREE.DirectionalLightShadow(); - light12.shadow.bias = 0.09; - light12.shadow.radius = settings.now.shadow.radius; - light12.shadow.camera.layers.set(gfxutils.LAYERS.SHADOWMAP); - var pixelRatio = gfx.renderer.getPixelRatio(); - var shadowMapSize = Math.max(gfx.width, gfx.height) * pixelRatio; - light12.shadow.mapSize.width = shadowMapSize; - light12.shadow.mapSize.height = shadowMapSize; - light12.target.position.set(0.0, 0.0, 0.0); - gfx.scene.add(light12); - gfx.scene.add(light12.target); - var light3 = new THREE.AmbientLight(0x666666); - light3.layers.enable(gfxutils.LAYERS.TRANSPARENT); - gfx.scene.add(light3); // add axes - - gfx.axes = new Axes(gfx.root, gfx.camera); - var deviceWidth = gfx.width * pixelRatio; - var deviceHeight = gfx.height * pixelRatio; - gfx.offscreenBuf = new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.NearestFilter, - format: THREE.RGBAFormat, - depthBuffer: true - }); - - if (gfx.renderer.getContext().getExtension('WEBGL_depth_texture')) { - gfx.offscreenBuf.depthTexture = new THREE.DepthTexture(); - gfx.offscreenBuf.depthTexture.type = THREE.UnsignedShortType; + return this.palette.defaultSecondaryColor; + } +} +SecondaryStructureColorer.prototype.id = 'SS'; +SecondaryStructureColorer.prototype.name = 'Secondary Structure'; +SecondaryStructureColorer.prototype.shortName = 'Structure'; +/* harmony default export */ const colorers_SecondaryStructureColorer = (SecondaryStructureColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/UniformColorer.js + +class UniformColorer extends colorers_Colorer { + static id = 'UN'; + getAtomColor(_atom, _complex) { + return this.opts.color; + } + getResidueColor(_residue, _complex) { + return this.opts.color; + } +} +UniformColorer.prototype.id = 'UN'; +UniformColorer.prototype.name = 'Uniform'; +UniformColorer.prototype.shortName = 'Uniform'; +/* harmony default export */ const colorers_UniformColorer = (UniformColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ConditionalColorer.js + + + +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @exports ConditionalColorer + * @augments Colorer + * @constructor + * @classdesc Bicolor coloring algorithm based on a selector string used as a condition. + */ +class ConditionalColorer extends colorers_Colorer { + static id = 'CO'; + constructor(opts) { + super(opts); + const parsed = chem_selectors.parse(this.opts.subset); + this._subsetCached = parsed.error ? chem_selectors.none() : parsed.selector; + } + getAtomColor(atom, _complex) { + return this._subsetCached.includesAtom(atom) ? this.opts.color : this.opts.baseColor; + } + getResidueColor(residue, _complex) { + const subset = this._subsetCached; + const atoms = residue._atoms; + for (let i = 0, n = atoms.length; i < n; ++i) { + if (!subset.includesAtom(atoms[i])) { + return this.opts.baseColor; + } } - - gfx.offscreenBuf2 = new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.LinearFilter, - format: THREE.RGBAFormat, - depthBuffer: false - }); - gfx.offscreenBuf3 = new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.LinearFilter, - format: THREE.RGBAFormat, - depthBuffer: false - }); - gfx.offscreenBuf4 = new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.LinearFilter, - format: THREE.RGBAFormat, - depthBuffer: false - }); - gfx.volBFTex = gfx.offscreenBuf3; - gfx.volFFTex = gfx.offscreenBuf4; - gfx.volWFFTex = gfx.offscreenBuf; // use float textures for volume rendering if possible - - if (gfx.renderer.getContext().getExtension('OES_texture_float')) { - gfx.offscreenBuf5 = new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.LinearFilter, - format: THREE.RGBAFormat, - type: THREE.FloatType, - depthBuffer: false - }); - gfx.offscreenBuf6 = new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.LinearFilter, - format: THREE.RGBAFormat, - type: THREE.FloatType, - depthBuffer: false - }); - gfx.offscreenBuf7 = new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.LinearFilter, - format: THREE.RGBAFormat, - type: THREE.FloatType, - depthBuffer: true - }); - gfx.volBFTex = gfx.offscreenBuf5; - gfx.volFFTex = gfx.offscreenBuf6; - gfx.volWFFTex = gfx.offscreenBuf7; - } else { - this.logger.warn('Device doesn\'t support OES_texture_float extension'); + return this.opts.color; + } +} +ConditionalColorer.prototype.id = 'CO'; +ConditionalColorer.prototype.name = 'Conditional'; +ConditionalColorer.prototype.shortName = 'Conditional'; +/* harmony default export */ const colorers_ConditionalColorer = (ConditionalColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ConformationColorer.js + +class ConformationColorer extends colorers_Colorer { + static id = 'CF'; + getAtomColor(atom, _complex) { + return this.palette.getChainColor(String.fromCharCode(atom.location)); + } + getResidueColor(_residue, _complex) { + return this.palette.defaultResidueColor; + } +} +ConformationColorer.prototype.id = 'CF'; +ConformationColorer.prototype.name = 'Conformation'; +ConformationColorer.prototype.shortName = 'Conformation'; +/* harmony default export */ const colorers_ConformationColorer = (ConformationColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/TemperatureColorer.js + + +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @see Temperature + * + * @exports TemperatureColorer + * @augments Colorer + * @constructor + * @classdesc Coloring algorithm based on temperature of chemical element. + */ +class TemperatureColorer extends colorers_Colorer { + static id = 'TM'; + getAtomColor(atom, _complex) { + const { + opts + } = this; + let factor = 1; + if (atom.temperature && opts) { + if (opts.min === opts.max) { + factor = atom.temperature > opts.max ? 1 : 0; + } else { + factor = (atom.temperature - opts.min) / (opts.max - opts.min); + } + return this.palette.getGradientColor(factor, opts.gradient); + } + return this.palette.defaultGradientColor; + } + getResidueColor(residue, _complex) { + const { + opts + } = this; + if (!opts) { + return this.palette.defaultGradientColor; + } + if (residue.temperature) { + let factor = 0; + if (opts.min === opts.max) { + factor = residue.temperature > opts.max ? 1 : 0; + } else { + factor = (residue.temperature - opts.min) / (opts.max - opts.min); + } + return this.palette.getGradientColor(factor, opts.gradient); + } + return this.palette.defaultGradientColor; + } +} +TemperatureColorer.prototype.id = 'TM'; // [T]e[M]perature +TemperatureColorer.prototype.name = 'Temperature'; +TemperatureColorer.prototype.shortName = 'Temperature'; +/* harmony default export */ const colorers_TemperatureColorer = (TemperatureColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/OccupancyColorer.js + + +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @see Occupancy + * + * @exports OccupancyColorer + * @augments Occupancy + * @constructor + * @classdesc Coloring algorithm based on occupancy of chemical element. + */ +class OccupancyColorer extends colorers_Colorer { + static id = 'OC'; + _getColorByOccupancy(occupancy, opts) { + if (occupancy !== undefined) { + const factor = 1 - occupancy; + return this.palette.getGradientColor(factor, opts.gradient); + } + return this.palette.defaultGradientColor; + } + getAtomColor(atom, _complex) { + const { + opts + } = this; + return this._getColorByOccupancy(atom.occupancy, opts); + } + getResidueColor(residue, _complex) { + const { + opts + } = this; + return this._getColorByOccupancy(residue.occupancy, opts); + } +} +OccupancyColorer.prototype.id = 'OC'; // [OC]cupancy +OccupancyColorer.prototype.name = 'Occupancy'; +OccupancyColorer.prototype.shortName = 'Occupancy'; +/* harmony default export */ const colorers_OccupancyColorer = (OccupancyColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/HydrophobicityColorer.js + +class HydrophobicityColorer extends colorers_Colorer { + static id = 'HY'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + let color = this.palette.defaultResidueColor; + if (residue._type.hydrophobicity !== undefined) { + // Kyte Doolitle hydro [-4.5,4.5]->[0.1] + const min = -4.5; + const max = 4.5; + color = this.palette.getGradientColor((residue._type.hydrophobicity - min) / (max - min), this.opts.gradient); + } + return color; + } +} +HydrophobicityColorer.prototype.id = 'HY'; +HydrophobicityColorer.prototype.name = 'Hydrophobicity'; +HydrophobicityColorer.prototype.shortName = 'Hydrophobicity'; +/* harmony default export */ const colorers_HydrophobicityColorer = (HydrophobicityColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/MoleculeColorer.js + +class MoleculeColorer extends colorers_Colorer { + static id = 'MO'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + const molecule = residue._molecule; + const count = _complex.getMoleculeCount(); + if (count > 1) { + return this.palette.getGradientColor((molecule.index - 1) / (count - 1), this.opts.gradient); } + return this.palette.getGradientColor(0, this.opts.gradient); + } +} +MoleculeColorer.prototype.id = 'MO'; +MoleculeColorer.prototype.name = 'Molecule'; +MoleculeColorer.prototype.shortName = 'Molecule'; +/* harmony default export */ const colorers_MoleculeColorer = (MoleculeColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/CarbonColorer.js + + +function scaleColor(c, factor) { + const r1 = c >> 16 & 0xff; + const g1 = c >> 8 & 0xff; + const b1 = c & 0xff; + const r = factor * r1; + const g = factor * g1; + const b = factor * b1; + return r << 16 | g << 8 | b; +} + +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @exports CarbonColorer + * @augments Colorer + * @constructor + * @classdesc Bicolor coloring algorithm based on selection carbon atoms. + */ +class CarbonColorer extends colorers_Colorer { + static id = 'CB'; + getAtomColor(atom, _complex) { + const colorCarbon = this.opts.color; + const colorNotCarbon = scaleColor(colorCarbon, this.opts.factor); + return atom.flags & chem_Atom.Flags.CARBON ? colorCarbon : colorNotCarbon; + } + getResidueColor(_residue, _complex) { + return this.opts.color; + } +} +CarbonColorer.prototype.id = 'CB'; +CarbonColorer.prototype.name = 'Carbon'; +CarbonColorer.prototype.shortName = 'Carbon'; +/* harmony default export */ const colorers_CarbonColorer = (CarbonColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers.js - gfx.stereoBufL = new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.LinearFilter, - format: THREE.RGBAFormat, - depthBuffer: false - }); - gfx.stereoBufR = new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.LinearFilter, - format: THREE.RGBAFormat, - depthBuffer: false - }); - this._gfx = gfx; - this._showCanvas(); - this._embedWebXR(settings.now.stereo === 'WEBVR'); - this._container.appendChild(gfx.renderer2d.getElement()); // add FPS counter - var stats = new Stats(); - stats.domElement.style.position = 'absolute'; - stats.domElement.style.right = '0'; - stats.domElement.style.bottom = '0'; - this._container.appendChild(stats.domElement); - this._fps = stats; - this._fps.show(settings.now.fps); - }; - /** - * Setup event listeners. - * @private - */ - Miew.prototype._initListeners = function () { - var self = this; - window.addEventListener('resize', function () { - self._onResize(); - }); - }; - /** - * Try to add numbers to the base name to make it unique among visuals - * @private - */ - Miew.prototype._makeUniqueVisualName = function (baseName) { - if (!baseName) { - return Math.random().toString(); - } - var name = baseName; - var suffix = 1; +const colorers = new utils_EntityList([colorers_ElementColorer, colorers_ResidueTypeColorer, colorers_SequenceColorer, colorers_ChainColorer, colorers_SecondaryStructureColorer, colorers_UniformColorer, colorers_ConditionalColorer, colorers_ConformationColorer, colorers_TemperatureColorer, colorers_OccupancyColorer, colorers_HydrophobicityColorer, colorers_MoleculeColorer, colorers_CarbonColorer]); +/* harmony default export */ const gfx_colorers = (colorers); +;// CONCATENATED MODULE: ./src/gfx/materials.js - while (this._visuals.hasOwnProperty(name)) { - name = "".concat(baseName, " (").concat(suffix.toString(), ")"); - suffix++; - } - return name; +function neutralColor(intensity) { + return new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(intensity, intensity, intensity); +} +const materialList = [{ + id: 'DF', + name: 'Diffuse', + shortName: 'Diffuse', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 1, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: false + } +}, { + id: 'SF', + name: 'Soft Plastic', + shortName: 'Soft', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.1), + shininess: 30, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: false + } +}, { + id: 'PL', + name: 'Glossy Plastic', + shortName: 'Glossy', + uberOptions: { + diffuse: neutralColor(0.56), + specular: neutralColor(0.28), + shininess: 100, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: false + } +}, { + id: 'ME', + name: 'Metal', + shortName: 'Metal', + uberOptions: { + diffuse: neutralColor(0.56), + specular: neutralColor(0.55), + shininess: 30, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: false + } +}, { + id: 'TR', + name: 'Transparent', + shortName: 'Transparent', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 1, + opacity: 0.5 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: true, + toonShading: false + } +}, { + id: 'GL', + name: 'Glass', + shortName: 'Glass', + uberOptions: { + diffuse: neutralColor(0.50), + specular: neutralColor(0.65), + shininess: 100, + opacity: 0.5 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: true, + toonShading: false + } +}, { + id: 'BA', + name: 'Backdrop', + shortName: 'Backdrop', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 1, + opacity: 1.0 + }, + values: { + lights: false, + fog: false, + depthWrite: false, + transparent: false, + toonShading: false + } +}, { + id: 'TN', + name: 'Toon', + shortName: 'Toon', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 1, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: true + } +}, { + id: 'FL', + name: 'Flat', + shortName: 'Flat', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 0, + opacity: 1.0 + }, + values: { + lights: false, + fog: true, + depthWrite: true, + transparent: false + } +}]; +const materials = new utils_EntityList(materialList); +/* harmony default export */ const gfx_materials = (materials); +;// CONCATENATED MODULE: ./src/gfx/meshutils.js +/** + * Utils functions which is worked with meshes + * + * functions for doing something with all/specified meshes + * functions for traversihg tree and create auxiliary meshes for transparency/shadowmaps... + * functions for calculating data connected with meshes + */ + + + +function _gatherObjects(root, meshTypes) { + const meshes = []; + root.traverse(object => { + for (let i = 0; i < meshTypes.length; i++) { + if (object instanceof meshTypes[i]) { + meshes[meshes.length] = object; + break; + } + } + }); + return meshes; +} + +// new mesh with the same geometry and specified material values and layer +function createDerivativeMesh(mesh, values, layer) { + const material = mesh.material.createInstance(); + material.setValues(values); + const newMesh = new mesh.constructor(mesh.geometry, material); + newMesh.material.needsUpdate = true; + newMesh.applyMatrix4(mesh.matrix); + newMesh.layers.set(layer); + return newMesh; +} +function traverseMeshes(root, meshTypes, func) { + const meshes = _gatherObjects(root, meshTypes); + for (let i = 0, n = meshes.length; i < n; ++i) { + const mesh = meshes[i]; + if (!mesh.parent) { + continue; + } + func(mesh); + } +} +function applyTransformsToMeshes(root, mtc) { + const mtcCount = mtc.length; + if (mtcCount < 1) { + return; + } + const meshTypes = [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineSegments, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Line]; + traverseMeshes(root, meshTypes, mesh => { + mesh.applyMatrix4(mtc[0]); + for (let j = 1; j < mtcCount; ++j) { + const newMesh = new mesh.constructor(mesh.geometry, mesh.material); + mesh.parent.add(newMesh); + newMesh.applyMatrix4(mtc[j]); + } + }); +} +const processTransparentMaterial = function () { + const matValues = { + prepassTransparancy: true, + fakeOpacity: false, + transparent: false, + colorFromDepth: false, + lights: false, + shadowmap: false, + fog: false + }; + return function (root, material) { + if (!(material instanceof shaders_UberMaterial)) { + return; + } + traverseMeshes(root, [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineSegments], mesh => { + mesh.material.setValues({ + prepassTransparancy: false, + fakeOpacity: false + }); + mesh.material.needsUpdate = true; + mesh.layers.set(gfxutils.LAYERS.TRANSPARENT); + const prepassTranspMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.PREPASS_TRANSPARENT); + mesh.parent.add(prepassTranspMesh); + }); }; - /** - * Add visual to the viewer - * @private - */ +}(); +const processColFromPosMaterial = function () { + const matValues = { + colorFromPos: true, + transparent: false, + colorFromDepth: false, + lights: false, + shadowmap: false, + fog: false, + overrideColor: false, + fogTransparent: false, + attrColor: false, + attrColor2: false, + attrAlphaColor: false, + fakeOpacity: false + }; + return function (root, material) { + if (!(material instanceof shaders_UberMaterial)) { + return; + } + traverseMeshes(root, [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineSegments], mesh => { + const colFromPosMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.COLOR_FROM_POSITION); + mesh.parent.add(colFromPosMesh); + }); + }; +}(); +const createShadowmapMaterial = function () { + const matValues = { + colorFromDepth: true, + orthoCam: true, + lights: false, + shadowmap: false, + fog: false + }; + return function (root, material) { + if (!(material instanceof shaders_UberMaterial)) { + return; + } + traverseMeshes(root, [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineSegments], mesh => { + if (!mesh.receiveShadow && mesh.material.shadowmap) { + // remove shadow from non-receivers + mesh.material.setValues({ + shadowmap: false + }); + } + if (!mesh.material.lights) { + // skip creating shadowmap meshes for materials without lighting + return; + } + if (!mesh.castShadow) { + // skip creating shadowmap meshes for non-casters + return; + } + if (!gfxutils.belongToSelectLayers(mesh)) { + // skip creating shadowmap meshes for selection layer + return; + } + const shadowmapMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.SHADOWMAP); + shadowmapMesh.isShadowmapMesh = true; + mesh.parent.add(shadowmapMesh); + }); + }; +}(); +function removeShadowmapMaterial(root, material) { + if (!(material instanceof shaders_UberMaterial)) { + return; + } + traverseMeshes(root, [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineSegments], mesh => { + if (mesh.isShadowmapMesh) { + mesh.parent.remove(mesh); + } + }); +} +function forEachMeshInGroup(group, process) { + function processObj(object) { + if (object instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh) { + process(object); + } + for (let i = 0, l = object.children.length; i < l; i++) { + processObj(object.children[i]); + } + } + processObj(group); +} +function _countMeshTriangles(mesh) { + const geom = mesh.geometry; + if (geom instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferGeometry) { + const attribs = geom.attributes; + for (const property in attribs) { + if (attribs.hasOwnProperty(property) && attribs[property] instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.InstancedBufferAttribute) { + const currAttr = attribs[property]; + const indexSize = geom.index ? geom.index.array.length / 3 : 0; + return indexSize * currAttr.array.length / currAttr.itemSize; + } + } + return 0; + } + if (geom instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry) { + return geom.index ? geom.index.array.length / 3 : 0; + } + return geom.faces ? geom.faces.length : 0; +} +function countTriangles(group) { + let totalCount = 0; + forEachMeshInGroup(group, mesh => { + totalCount += _countMeshTriangles(mesh); + }); + return totalCount; +} +/* harmony default export */ const meshutils = ({ + applyTransformsToMeshes, + processTransparentMaterial, + processColFromPosMaterial, + createShadowmapMaterial, + removeShadowmapMaterial, + forEachMeshInGroup, + countTriangles +}); +;// CONCATENATED MODULE: ./src/gfx/Representation.js + - Miew.prototype._addVisual = function (visual) { - if (!visual) { - return null; - } // change visual name in order to make it unique - var name = this._makeUniqueVisualName(visual.name); - visual.name = name; - this._visuals[name] = visual; - this._gfx.pivot.add(visual); - if (visual.getSelectionGeo) { - this._gfx.selectionPivot.add(visual.getSelectionGeo()); +const { + selectors: Representation_selectors +} = chem; +class Representation { + constructor(index, mode, colorer, selector) { + const startMaterialValues = { + clipPlane: settings.now.draft.clipPlane, + fogTransparent: settings.now.bg.transparent, + shadowmap: settings.now.shadow.on, + shadowmapType: settings.now.shadow.type + }; + this.index = index; + this.mode = mode; + this.colorer = colorer; + this.selector = selector; + this.selectorString = ''; + this.count = 0; + this.material = new shaders_UberMaterial(); + this.material.setValues(startMaterialValues); + this.material.setUberOptions({ + fogAlpha: settings.now.fogAlpha + }); + this.materialPreset = gfx_materials.first; + this.needsRebuild = true; + this.visible = true; + + // apply mode params & preset + this.setMode(mode); + } + markAtoms(complex) { + this.count = complex.markAtoms(this.selector, 1 << this.index); + this.needsRebuild = true; + return this.count; + } + unmarkAtoms(complex) { + complex.clearAtomBits(1 << this.index); + this.count = 0; + } + setMode(mode) { + this.mode = mode; + } + setMaterialPreset(preset) { + this.materialPreset = preset; + this.material.setUberOptions(preset.uberOptions); + this.material.setValues(preset.values); + } + reset() { + this.geo = null; + this.selectionGeo = null; + } + buildGeometry(complex) { + this.reset(); + this.needsRebuild = false; + if (settings.now.ao) { + this.material.setValues({ + normalsToGBuffer: settings.now.ao + }); + } + this.geo = this.mode.buildGeometry(complex, this.colorer, 1 << this.index, this.material); + if (this.material.uberOptions.opacity < 0.99 && settings.now.transparency === 'prepass') { + meshutils.processTransparentMaterial(this.geo, this.material); + } + this.geo.visible = this.visible; + gfxutils.processObjRenderOrder(this.geo, this.materialPreset.id); + meshutils.processColFromPosMaterial(this.geo, this.material); + if (settings.now.shadow.on) { + meshutils.createShadowmapMaterial(this.geo, this.material); + } + return this.geo; + } + buildSelectionGeometry(mask) { + let sg = null; + if (this.geo && 'getSubset' in this.geo) { + const meshes = this.geo.getSubset(mask); + if (meshes && meshes.length > 0) { + sg = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group(); + sg.matrixAutoUpdate = false; + sg.matrix = this.geo.matrix; + for (let j = 0; j < meshes.length; j++) { + const m = meshes[j]; + sg.add(m); + } + } } + if (sg) { + sg.visible = this.visible; + } + this.selectionGeo = sg; + return this.selectionGeo; + } - return name; - }; /** - * Remove visual from the viewer - * @private + * Create object that represents difference between current and another rep + * anotherRep could be undefined. In this case everything is reported. */ - - - Miew.prototype._removeVisual = function (visual) { - var name = ''; - var obj = null; - - if (visual instanceof Visual) { - name = visual.name; - obj = visual; - } else if (typeof visual === 'string') { - name = visual; - obj = this._visuals[name]; + compare(repSettings) { + const diff = {}; + const selStr = String(this.selector); + if (!repSettings || selStr.valueOf() !== String(repSettings.selector).valueOf()) { + diff.selector = selStr; } - - if (!obj || !this._visuals.hasOwnProperty(name) || this._visuals[name] !== obj) { - return; + const modeDiff = this.mode.identify(); + if (!repSettings || Array.isArray(modeDiff) || modeDiff !== repSettings.mode) { + diff.mode = modeDiff; } - - if (name === this._curVisualName) { - this._curVisualName = undefined; + const colorerDiff = this.colorer.identify(); + if (!repSettings || Array.isArray(colorerDiff) || colorerDiff !== repSettings.colorer) { + diff.colorer = colorerDiff; } + if (!repSettings || this.materialPreset.id !== repSettings.material) { + diff.material = this.materialPreset.id; + } + return diff; + } - delete this._visuals[name]; - obj.release(); // removes nodes from scene - - this._needRender = true; - }; /** - * Call specified function for each Visual - * @private + * Change representation. Write fields what was changed into new object, return it. */ + change(repSettings, complex, mode, color) { + const diff = {}; - - Miew.prototype._forEachVisual = function (callback) { - for (var name in this._visuals) { - if (this._visuals.hasOwnProperty(name)) { - callback(this._visuals[name]); + // modify selector + if (repSettings.selector) { + const newSelectorObject = Representation_selectors.parse(repSettings.selector).selector; + const newSelector = String(newSelectorObject); + if (this.selectorString !== newSelector) { + diff.selector = newSelector; + this.selectorString = newSelector; + this.selector = newSelectorObject; + this.markAtoms(complex); } } - }; - /** - * Release (destroy) all visuals in the scene - * @private - */ + // modify mode + if (repSettings.mode) { + const newMode = repSettings.mode; + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEqual(this.mode.identify(), newMode)) { + diff.mode = newMode; + this.setMode(mode); + } + } - Miew.prototype._releaseAllVisuals = function () { - if (!this._gfx || !this._gfx.pivot) { - return; + // modify colorer + if (repSettings.colorer) { + const newColorer = repSettings.colorer; + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEqual(this.colorer.identify(), newColorer)) { + diff.colorer = newColorer; + this.colorer = color; + } } - for (var name in this._visuals) { - if (this._visuals.hasOwnProperty(name)) { - this._visuals[name].release(); + // modify material + if (repSettings.material) { + const newMaterial = repSettings.material; + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEqual(this.materialPreset.id, newMaterial)) { + diff.material = newMaterial; + this.setMaterialPreset(gfx_materials.get(repSettings.material)); } } + return diff; + } + show(visible) { + this.visible = visible; + if (this.geo) { + this.geo.visible = visible; + } + if (this.selectionGeo) { + this.selectionGeo.visible = visible; + } + } +} +/* harmony default export */ const gfx_Representation = (Representation); +;// CONCATENATED MODULE: ./src/ComplexVisualEdit.js - this._visuals = {}; - }; - /** - * Call specified function for each ComplexVisual - * @private - */ - Miew.prototype._forEachComplexVisual = function (callback) { - if (!this._gfx || !this._gfx.pivot) { - return; - } - for (var name in this._visuals) { - if (this._visuals.hasOwnProperty(name) && this._visuals[name] instanceof ComplexVisual) { - callback(this._visuals[name]); - } +function _traverseComponentGroups(root, component, callback) { + const { + children + } = root; + if (!children) { + return; + } + for (let i = 0, n = children.length; i < n; ++i) { + const child = children[i]; + if (child._component === component) { + callback(child); } - }; - /** - * Returns ComplexVisual with specified name, or current (if not found), or any, or null - * @private - */ + if (child instanceof gfxutils.RCGroup) { + _traverseComponentGroups(child, component, callback); + } + } +} +function ComplexEditor() {} +class ComplexComponentEditor extends ComplexEditor { + constructor(complexVisual) { + super(); + this._complexVisual = complexVisual; + this._inProgress = false; + } + begin() { + const complex = this._complexVisual.getComplex(); + // init component matrices + this._componentTransforms = []; + for (let i = 0; i < complex._components.length; ++i) { + const component = complex._components[i]; + this._componentTransforms[component._index] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Object3D(); + } + this._inProgress = true; + return true; + } + apply() { + if (!this._inProgress) { + return; + } + const complex = this._complexVisual.getComplex(); + for (let i = 0; i < complex._components.length; ++i) { + this._bakeComponentTransform(complex._components[i]); + } + complex.onAtomPositionChanged(); + this._resetComponentTransform(); + this._complexVisual.finalizeEdit(); + } + discard() { + if (!this._inProgress) { + return; + } + this._resetComponentTransform(); + this._complexVisual.finalizeEdit(); + } + getAltObj() { + const res = { + objects: [], + pivot: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0) + }; + const visual = this._complexVisual; + const component = visual.getSelectedComponent(); + if (component === null) { + return res; + } + const selection = this._complexVisual.getSelectionGeo(); + const selectionMask = 1 << visual.getSelectionBit(); + let i; + let j; + let reprNode; + let geo; - Miew.prototype._getComplexVisual = function (name) { - name = name || this._curVisualName; - var any = null; - var named = null; + // find all geo nodes for this component + _traverseComponentGroups(visual, component, child => { + res.objects.push(child); + }); - this._forEachComplexVisual(function (visual) { - any = visual; + // find all selection nodes for this component + for (i = 0; i < selection.children.length; ++i) { + reprNode = selection.children[i]; + for (j = 0; j < reprNode.children.length; ++j) { + geo = reprNode.children[j]; + if (geo.hasOwnProperty('_component') && geo._component === component) { + res.objects.push(geo); + } + } + } - if (visual.name === name) { - named = visual; + // add dummy object that stores component transformation + res.objects.push(this._componentTransforms[component._index]); + const bbmin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + const bbmax = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + component.forEachResidue(residue => { + const atoms = residue._atoms; + for (j = 0; j < atoms.length; ++j) { + if (atoms[j].mask & selectionMask) { + bbmin.min(atoms[j].position); + bbmax.max(atoms[j].position); + } } }); + res.pivot.lerpVectors(bbmin, bbmax, 0.5); + return res; + } + _bakeComponentTransform(component) { + const t = this._componentTransforms[component._index]; + if (t && (!(t.position.x === 0 && t.position.y === 0 && t.position.z === 0) || !(t.quaternion.x === 0 && t.quaternion.y === 0 && t.quaternion.z === 0 && t.quaternion.w === 1))) { + t.updateMatrix(); + component.forEachResidue(residue => { + const atoms = residue._atoms; + for (let j = 0; j < atoms.length; ++j) { + atoms[j].position.applyMatrix4(t.matrix); + } + }); + } + } + _resetComponentTransform() { + const visual = this._complexVisual; + const selection = this._complexVisual.getSelectionGeo(); + let i; + let j; + let reprNode; + let geo; + for (i = 0; i < this._componentTransforms.length; ++i) { + geo = this._componentTransforms[i]; + geo.position.set(0, 0, 0); + geo.quaternion.set(0, 0, 0, 1); + } + + // reset all geo nodes + for (i = 0; i < visual.children.length; ++i) { + reprNode = visual.children[i]; + for (j = 0; j < reprNode.children.length; ++j) { + geo = reprNode.children[j]; + if (geo.hasOwnProperty('_component')) { + geo.position.set(0, 0, 0); + geo.quaternion.set(0, 0, 0, 1); + } + } + } - return named || any; - }; - /** - * Returns first found VolumeVisual (no more than one should be present actually) - * @private - */ - + // reset all selection nodes + for (i = 0; i < selection.children.length; ++i) { + reprNode = selection.children[i]; + for (j = 0; j < reprNode.children.length; ++j) { + geo = reprNode.children[j]; + if (geo.hasOwnProperty('_component')) { + geo.position.set(0, 0, 0); + geo.quaternion.set(0, 0, 0, 1); + } + } + } + } +} +class ComplexFragmentEditor extends ComplexEditor { + constructor(complexVisual) { + super(); + this._complexVisual = complexVisual; + this._inProgress = false; + } + begin() { + const visual = this._complexVisual; + const selection = this._complexVisual.getSelectionGeo(); + const atoms = this._getSelectionBorderAtoms(); + if (atoms.length < 1 || atoms.length > 2) { + logger.error('Can only edit fragments with one or two bound atoms.'); + return false; + } + this._fragmentBoundAtoms = atoms; + const selectionMask = 1 << visual.getSelectionBit(); + + // hide selected fragment in main model + visual.disableSubset(selectionMask, true); + + // hide selection geo in main model + for (let k = 0; k < selection.children.length; ++k) { + selection.children[k].visible = false; + } + + // create visible fragment representation to rotate + const pivotPos = atoms[0].position.clone(); + if (atoms.length === 2) { + pivotPos.lerp(atoms[1].position, 0.5); + } + this._fragmentGeo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group(); + visual.add(this._fragmentGeo); + this._fragmentGeo.position.copy(pivotPos); + this._fragmentSelectionGeo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group(); + selection.add(this._fragmentSelectionGeo); + this._fragmentSelectionGeo.position.copy(pivotPos); + const offset = pivotPos.clone(); + offset.negate(); + for (let i = 0; i < visual.children.length; ++i) { + const g = visual.children[i]; + if (!('getSubset' in g)) { + continue; + } + const vg = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group(); + this._fragmentGeo.add(vg); + const sg = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group(); + this._fragmentSelectionGeo.add(sg); + const meshes = g.getSubset(selectionMask, true); + for (let j = 0; j < meshes.length; j++) { + const m = meshes[j]; + vg.add(m); + m.position.copy(offset); + } + const smeshes = g.getSubset(selectionMask, true); + for (let h = 0; h < smeshes.length; h++) { + const sm = smeshes[h]; + sg.add(sm); + sm.position.copy(offset); + } + } + gfxutils.applySelectionMaterial(this._fragmentSelectionGeo); + this._inProgress = true; + return true; + } + apply() { + if (!this._inProgress) { + return; + } + const visual = this._complexVisual; + const selectionBit = visual.getSelectionBit(); + const p = this._fragmentGeo.position; + const m = this._fragmentGeo.matrix.clone(); + m.multiply(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4().makeTranslation(-p.x, -p.y, -p.z)); + this._bakeAtomTransform(m, 1 << selectionBit); + + // show selected fragment in main model + visual.enableSubset(1 << selectionBit, true); + visual.getComplex().onAtomPositionChanged(); + visual.finalizeEdit(); + } + discard() { + if (!this._inProgress) { + return; + } + const visual = this._complexVisual; + const selection = this._complexVisual.getSelectionGeo(); + this._fragmentGeo.parent.remove(this._fragmentGeo); - Miew.prototype._getVolumeVisual = function () { - var any = null; + // show selected fragment in main model + visual.enableSubset(1 << visual.getSelectionBit(), true); - this._forEachVisual(function (visual) { - if (visual instanceof VolumeVisual) { - any = visual; + // show selection geo in main model (+ remove fragment selection geo) + for (let i = 0; i < selection.children.length; ++i) { + const node = selection.children[i]; + if (node.visible) { + selection.remove(node); + } else { + node.visible = true; + } + } + visual.finalizeEdit(); + } + isFreeRotationAllowed() { + return this._fragmentBoundAtoms.length < 2; + } + getAltObj() { + const res = { + objects: [], + pivot: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0) + }; + res.objects.push(this._fragmentGeo, this._fragmentSelectionGeo); + const boundAtoms = this._fragmentBoundAtoms; + if (boundAtoms.length === 1) { + if (boundAtoms[0].bonds.length === 1) { + // single external bond allows rotation about bond axis + const bond = boundAtoms[0].bonds[0]; + res.axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3().subVectors(bond._right.position, bond._left.position); + res.axis.normalize(); + res.axis.transformDirection(this._complexVisual.matrixWorld); + } + } else if (boundAtoms.length === 2) { + // two bound atoms allow rotation only about axis running through their centers + res.axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3().subVectors(boundAtoms[1].position, boundAtoms[0].position); + res.axis.normalize(); + res.axis.transformDirection(this._complexVisual.matrixWorld); + } + return res; + } + _getSelectionBorderAtoms() { + const complex = this._complexVisual.getComplex(); + const selectionMask = 1 << this._complexVisual.getSelectionBit(); + const atomHash = {}; + complex.forEachBond(bond => { + if (bond._left.mask & selectionMask) { + if ((bond._right.mask & selectionMask) === 0) { + atomHash[bond._left.index] = 1; + } + } else if (bond._right.mask & selectionMask) { + atomHash[bond._right.index] = 1; } }); - - return any; - }; - /** - * Returns ComplexVisual corresponding to specified complex - * @private - */ - - - Miew.prototype._getVisualForComplex = function (complex) { - if (!complex) { - return null; + const atoms = []; + const keys = Object.keys(atomHash); + for (let i = 0, n = keys.length; i < n; ++i) { + const idx = keys[i]; + atoms.push(complex._atoms[idx]); } - - var found = null; - - this._forEachComplexVisual(function (visual) { - if (visual.getComplex() === complex) { - found = visual; + return atoms; + } + _bakeAtomTransform(matrix, mask) { + this._complexVisual.getComplex().forEachAtom(atom => { + if (atom.mask & mask) { + atom.position.applyMatrix4(matrix); } }); + } +} +/* harmony default export */ const ComplexVisualEdit = ({ + ComponentEditor: ComplexComponentEditor, + FragmentEditor: ComplexFragmentEditor +}); +;// CONCATENATED MODULE: ./src/ComplexVisual.js - return found; - }; - /* - * Get a list of names of visuals currently shown by the viewer - */ - - - Miew.prototype.getVisuals = function () { - return Object.keys(this._visuals); - }; - /* - * Get complex visuals count - */ - Miew.prototype.getComplexVisualsCount = function () { - var count = 0; - this._forEachComplexVisual(function () { - return count++; - }); - return count; - }; - /* - * Get current visual - */ - Miew.prototype.getCurrentVisual = function () { - return this._curVisualName; - }; - /* - * Set current visual. - * All further operations will be performed on this visual (complex) if not stated otherwise. - */ - Miew.prototype.setCurrentVisual = function (name) { - if (!this._visuals[name]) { - return; - } - this._curVisualName = name; - }; - /** - * Run the viewer, start processing update/render frames periodically. - * Has no effect if already running. - * @see Miew#halt - */ - Miew.prototype.run = function () { - var _this = this; - if (!this._running) { - this._running = true; - if (this._halting) { - this._halting = false; - return; - } - this._objectControls.enable(true); +const { + selectors: ComplexVisual_selectors +} = chem; +function lookupAndCreate(entityList, specs) { + if (!Array.isArray(specs)) { + specs = [specs]; + } + const [id, opts] = specs; + const Entity = entityList.get(id) || entityList.first; + return new Entity(opts); +} +class ComplexVisual extends src_Visual { + constructor(name, dataSource) { + super(name, dataSource); + this._complex = dataSource; + + /** @type {Representation[]} */ + this._reprList = []; + /** @type {?Representation} */ + this._repr = null; + this._reprListChanged = true; + this._selectionBit = 0; + this._reprUsedBits = 0; + this._selectionCount = 0; + this._selectionGeometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group(); + } + getBoundaries() { + return this._complex.getBoundaries(); + } + release() { + if (this._selectionGeometry.parent) { + this._selectionGeometry.remove(this._selectionGeometry); + } + src_Visual.prototype.release.call(this); + } + getComplex() { + return this._complex; + } + getSelectionCount() { + return this._selectionCount; + } + getSelectionGeo() { + return this._selectionGeometry; + } + getSelectionBit() { + return this._selectionBit; + } + getEditor() { + return this._editor; + } + resetReps(reps) { + // Create all necessary representations + if (this._complex) { + this._complex.clearAtomBits(~0); + } + this._reprListChanged = true; + this._reprUsedBits = 0; + this._reprList.length = reps.length; + for (let i = 0, n = reps.length; i < n; ++i) { + const rep = reps[i]; + let selector; + let selectorString; + if (typeof rep.selector === 'string') { + selectorString = rep.selector; + ({ + selector + } = ComplexVisual_selectors.parse(selectorString)); + } else if (typeof rep.selector === 'undefined') { + selectorString = settings.now.presets.default[0].selector; + ({ + selector + } = ComplexVisual_selectors.parse(selectorString)); + } else { + ({ + selector + } = rep); + selectorString = selector.toString(); + } + const mode = lookupAndCreate(gfx_modes, rep.mode); + const colorer = lookupAndCreate(gfx_colorers, rep.colorer); + const material = gfx_materials.get(rep.material) || gfx_materials.first; + this._reprList[i] = new gfx_Representation(i, mode, colorer, selector); + this._reprList[i].setMaterialPreset(material); + this._reprList[i].selectorString = selectorString; + if (this._complex) { + this._complex.markAtoms(selector, 1 << i); + } + this._reprUsedBits |= 1 << i; + } + this._repr = reps.length > 0 ? this._reprList[0] : null; + this._selectionBit = reps.length; + this._reprUsedBits |= 1 << this._selectionBit; // selection uses one bit + this._selectionCount = 0; + if (this._complex) { + this._complex.update(); + } + } - this._interpolator.resume(); + /** + * Get number of representations created so far. + * @returns {number} Number of reps. + */ + repCount() { + return this._reprList.length; + } - this._requestAnimationFrame(function () { - return _this._onTick(); - }); + /** + * Get or set the current representation index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. + * @returns {number} The current index. + */ + repCurrent(index) { + if (index >= 0 && index < this._reprList.length) { + this._repr = this._reprList[index]; + } else { + index = this._reprList.indexOf(this._repr); } - }; + return index; + } + /** - * Request the viewer to stop. - * Will be processed during the next frame. - * @see Miew#run + * Get or set representation by index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. + * @param {object=} rep - Optional representation description. + * @param {string=} rep.selector - Selector string. + * @param {string=} rep.mode - Mode id. + * @param {string=} rep.colorer - Colorer id. + * @param {string=} rep.material - Material id. + * @returns {Object} {desc, index, status} field desc contains rep description, index - index of correspondent rep, + * status - one of three strings: 'created', 'changed', ''. 'created' means new rep was created during this function, + * 'changed' - rep was changed during this function. '' - something else. */ + rep(index, rep) { + // if index is missing then it is the current + if (!rep && (index === undefined || index instanceof Object)) { + rep = index; + index = this.repCurrent(); + } + // fail if out of bounds + if (index < 0 || index > this._reprList.length) { + logger.error(`Rep ${index} does not exist!`); + return null; + } - Miew.prototype.halt = function () { - if (this._running) { - this._discardComponentEdit(); + // a special case of adding just after the end + if (index === this._reprList.length) { + const res = this.repAdd(rep); + logger.warn(`Rep ${index} does not exist! New representation was created.`); + return { + desc: res.desc, + index, + status: 'created' + }; + } - this._discardFragmentEdit(); + // gather description + const target = this._reprList[index]; + const desc = { + selector: target.selectorString, + mode: target.mode.identify(), + colorer: target.colorer.identify(), + material: target.materialPreset.id + }; - this._objectControls.enable(false); + // modification is requested + if (rep) { + // modify + const diff = target.change(rep, this._complex, lookupAndCreate(gfx_modes, rep.mode), lookupAndCreate(gfx_colorers, rep.colorer)); - this._interpolator.pause(); + // something was changed + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(diff)) { + target.needsRebuild = true; + for (const key in diff) { + if (diff.hasOwnProperty(key)) { + desc[key] = diff[key]; + logger.debug(`rep[${index}].${key} changed to ${diff[key]}`); + } + } - this._halting = true; + // safety trick: lower resolution for surface modes + if (diff.mode && target.mode.isSurface && (settings.now.resolution === 'ultra' || settings.now.resolution === 'high')) { + logger.report('Surface resolution was changed to "medium" to avoid hang-ups.'); + settings.set('resolution', 'medium'); + } + return { + desc, + index, + status: 'changed' + }; + } } - }; + return { + desc, + index, + status: '' + }; + } + /** - * Request the viewer to start / stop responsing - * on hot keys. - * @param enabled - start (true) or stop (false) response on hot keys. + * Get representation (not just description) by index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. + * @returns {?object} Representation. */ + repGet(index) { + // if index is missing then it is the current + if (index === undefined || index instanceof Object) { + index = this.repCurrent(); + } + // fail if out of bounds + if (index < 0 || index >= this._reprList.length) { + return null; + } + return this._reprList[index]; + } + _getFreeReprIdx() { + let bits = this._reprUsedBits; + for (let i = 0; i <= ComplexVisual.NUM_REPRESENTATION_BITS; ++i, bits >>= 1) { + if ((bits & 1) === 0) { + return i; + } + } + return -1; + } - Miew.prototype.enableHotKeys = function (enabled) { - this._hotKeysEnabled = enabled; - - this._objectControls.enableHotkeys(enabled); - }; /** - * Callback which processes window resize. - * @private + * Add new representation. + * @param {object=} rep - Representation description. + * @returns {Object} {desc, index} field desc contains added rep description, index - index of this rep. */ + repAdd(rep) { + if (this._reprList.length >= ComplexVisual.NUM_REPRESENTATION_BITS) { + return null; + } + const newSelectionBit = this._getFreeReprIdx(); + if (newSelectionBit < 0) { + return null; // no more slots for representations + } + const originalSelection = this.buildSelectorFromMask(1 << this._selectionBit); + + // Fill in default values + const def = settings.now.presets.default[0]; + const desc = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge({ + selector: def.selector, + mode: def.mode, + colorer: def.colorer, + material: def.material + }, rep); + const selector = typeof desc.selector === 'string' ? ComplexVisual_selectors.parse(desc.selector).selector : desc.selector; + const target = new gfx_Representation(this._selectionBit, lookupAndCreate(gfx_modes, desc.mode), lookupAndCreate(gfx_colorers, desc.colorer), selector); + target.selectorString = selector.toString(); + target.setMaterialPreset(gfx_materials.get(desc.material)); + target.markAtoms(this._complex); + this._reprList.push(target); + + // change selection bit + this._selectionBit = newSelectionBit; + this._reprUsedBits |= 1 << this._selectionBit; + + // restore selection using new selection bit + this._complex.markAtoms(originalSelection, 1 << this._selectionBit); + return { + desc, + index: this._reprList.length - 1 + }; + } + /** + * Remove representation. + * @param {number=} index - Zero-based representation index. + */ + repRemove(index) { + if (index === undefined) { + index = this.repCurrent(); + } - Miew.prototype._onResize = function () { - this._needRender = true; - var gfx = this._gfx; - gfx.width = this._container.clientWidth; - gfx.height = this._container.clientHeight; - gfx.camera.aspect = gfx.width / gfx.height; - gfx.camera.setMinimalFov(settings.now.camFov); - gfx.camera.updateProjectionMatrix(); - gfx.renderer.setSize(gfx.width, gfx.height); - gfx.renderer2d.setSize(gfx.width, gfx.height); - this.dispatchEvent({ - type: 'resize' - }); - }; - - Miew.prototype._resizeOffscreenBuffers = function (width, height, stereo) { - var gfx = this._gfx; - stereo = stereo || 'NONE'; - var isAnaglyph = stereo === 'NONE' || stereo === 'ANAGLYPH'; - var multi = isAnaglyph ? 1 : 0.5; - gfx.offscreenBuf.setSize(multi * width, height); - gfx.offscreenBuf2.setSize(multi * width, height); - gfx.offscreenBuf3.setSize(multi * width, height); - gfx.offscreenBuf4.setSize(multi * width, height); - - if (gfx.offscreenBuf5) { - gfx.offscreenBuf5.setSize(multi * width, height); + // catch out of bounds case + let count = this._reprList.length; + if (index < 0 || index >= count || count <= 1) { + // do not allow to remove the single rep + return; } + const target = this._reprList[index]; + target.unmarkAtoms(this._complex); + this._reprUsedBits &= ~(1 << target.index); + this._reprList.splice(index, 1); - if (gfx.offscreenBuf6) { - gfx.offscreenBuf6.setSize(multi * width, height); + // update current rep + if (target === this._repr) { + --count; + index = index < count ? index : count - 1; + this._repr = this._reprList[index]; } + this._reprListChanged = true; + } - if (gfx.offscreenBuf7) { - gfx.offscreenBuf7.setSize(multi * width, height); + /** + * Hide representation. + * @param {number} index - Zero-based representation index. + * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default). + */ + repHide(index, hide) { + if (hide === undefined) { + hide = true; } - if (isAnaglyph) { - gfx.stereoBufL.setSize(width, height); - gfx.stereoBufR.setSize(width, height); + // fail if out of bounds + if (index < 0 || index >= this._reprList.length) { + return; } - }; + const target = this._reprList[index]; + target.show(!hide); + } + /** - * Callback which processes update/render frames. - * @private + * Select atoms with selector + * @param {Selector} selector - selector + * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection */ + select(selector, append) { + if (append) { + this._selectionCount += this._complex.markAtomsAdditionally(selector, 1 << this._selectionBit); + } else { + this._selectionCount = this._complex.markAtoms(selector, 1 << this._selectionBit); + } + this._complex.updateStructuresMask(); + this.rebuildSelectionGeometry(); + } + resetSelectionMask() { + if (this._selectionCount !== 0) { + this._selectionCount = 0; + if (this._complex) { + this._complex.clearAtomBits(1 << this._selectionBit); + } + } + } + updateSelectionMask(pickedObj) { + const self = this; + const { + atom + } = pickedObj; + let { + residue, + chain, + molecule + } = pickedObj; + const setMask = 1 << this._selectionBit; + const clearMask = ~setMask; + if (atom) { + residue = atom.residue; + chain = residue._chain; + molecule = residue._molecule; + if (atom.mask & setMask) { + atom.mask &= clearMask; + residue._mask &= clearMask; + chain._mask &= clearMask; + if (molecule) { + molecule.mask &= clearMask; + } + this._selectionCount--; + } else { + atom.mask |= setMask; + this._selectionCount++; + // select residue if all atoms in it are selected + residue.collectMask(); + // select chain and molecule if all residues in it are selected + chain.collectMask(); + if (molecule) { + molecule.collectMask(); + } + } + } else if (residue) { + chain = residue._chain; + molecule = residue._molecule; + if (residue._mask & setMask) { + residue._mask &= clearMask; + chain._mask &= clearMask; + residue.forEachAtom(a => { + if (a.mask & setMask) { + a.mask &= clearMask; + self._selectionCount--; + } + }); + } else { + residue._mask |= setMask; + residue.forEachAtom(a => { + if (!(a.mask & setMask)) { + a.mask |= setMask; + self._selectionCount++; + } + }); - Miew.prototype._onTick = function () { - var _this2 = this; - - if (this._halting) { - this._running = false; - this._halting = false; - return; + // select chain and molecule if all residues in it are selected + chain.collectMask(); + if (molecule) { + molecule.collectMask(); + } + } + } else if (chain || molecule) { + const obj = chain || molecule; + if (obj._mask & setMask) { + obj._mask &= clearMask; + obj.forEachResidue(r => { + if (r._mask & setMask) { + r._mask &= clearMask; + r.forEachAtom(a => { + if (a.mask & setMask) { + a.mask &= clearMask; + self._selectionCount--; + } + }); + r._mask &= clearMask; + } + }); + } else { + obj._mask |= setMask; + obj.forEachResidue(r => { + if (!(r._mask & setMask)) { + r._mask |= setMask; + r.forEachAtom(a => { + if (!(a.mask & setMask)) { + a.mask |= setMask; + self._selectionCount++; + } + }); + const otherObj = chain ? r.getMolecule() : r.getChain(); + if (otherObj) { + otherObj.collectMask(); + } + } + }); + } + } else { + this.resetSelectionMask(); } + } + expandSelection() { + const self = this; + const selectionMask = 1 << this._selectionBit; + const tmpMask = 1 << 31; - this._fps.update(); + // mark atoms to add + this._complex.forEachBond(bond => { + if (bond._left.mask & selectionMask) { + if ((bond._right.mask & selectionMask) === 0) { + bond._right.mask |= tmpMask; + } + } else if (bond._right.mask & selectionMask) { + bond._left.mask |= tmpMask; + } + }); - this._requestAnimationFrame(function () { - return _this2._onTick(); + // select marked atoms + const deselectionMask = ~tmpMask; + this._complex.forEachAtom(atom => { + if (atom.mask & tmpMask) { + atom.mask = atom.mask & deselectionMask | selectionMask; + ++self._selectionCount; + } }); + this._complex.updateStructuresMask(); + } + shrinkSelection() { + const self = this; + const selectionMask = 1 << this._selectionBit; + const tmpMask = 1 << 31; - this._onUpdate(); + // mark atoms neighbouring to unselected ones + this._complex.forEachBond(bond => { + if (bond._left.mask & selectionMask) { + if ((bond._right.mask & selectionMask) === 0) { + bond._left.mask |= tmpMask; + } + } else if (bond._right.mask & selectionMask) { + bond._right.mask |= tmpMask; + } + }); - if (this._needRender) { - this._onRender(); + // mark hanging atoms + this._complex.forEachAtom(atom => { + if (atom.mask & selectionMask && atom.bonds.length === 1) { + atom.mask |= tmpMask; + } + }); - this._needRender = !settings.now.suspendRender || settings.now.stereo === 'WEBVR'; + // deselect marked atoms + const deselectionMask = ~(selectionMask | tmpMask); + this._complex.forEachAtom(atom => { + if (atom.mask & tmpMask) { + atom.mask &= deselectionMask; + --self._selectionCount; + } + }); + this._complex.updateStructuresMask(); + } + getSelectedComponent() { + const selectionMask = 1 << this._selectionBit; + let component = null; + let multiple = false; + + // find which component is selected (exclusively) + this._complex.forEachAtom(atom => { + if (atom.mask & selectionMask) { + if (component === null) { + component = atom.residue._component; + } else if (component !== atom.residue._component) { + multiple = true; + } + } + }); + return multiple ? null : component; + } + getSelectionCenter(center, includesAtom, selRule) { + center.set(0.0, 0.0, 0.0); + let count = 0; + this._complex.forEachAtom(atom => { + if (includesAtom(atom, selRule)) { + center.add(atom.position); + count++; + } + }); + if (count === 0) { + return false; } - }; + center.divideScalar(count); + center.applyMatrix4(this.matrix); + return true; + } + needsRebuild() { + if (this._reprListChanged) { + return true; + } + const reprList = this._reprList; + for (let i = 0, n = reprList.length; i < n; ++i) { + const repr = reprList[i]; + if (repr.needsRebuild) { + return true; + } + } + return false; + } + + /** + * Rebuild molecule geometry asynchronously. + */ + rebuild() { + const self = this; + + // Destroy current geometry + gfxutils.clearTree(this); + return new Promise(resolve => { + // Nothing to do? + const complex = self._complex; + if (!complex) { + resolve(); + return; + } + let errorOccured = false; + setTimeout(() => { + console.time('build'); + const reprList = self._reprList; + const palette = gfx_palettes.get(settings.now.palette) || gfx_palettes.first; + let hasGeometry = false; + for (let i = 0, n = reprList.length; i < n; ++i) { + const repr = reprList[i]; + repr.colorer.palette = palette; + if (repr.needsRebuild) { + repr.reset(); + try { + repr.buildGeometry(complex); + } catch (e) { + if (e instanceof utils.OutOfMemoryError) { + repr.needsRebuild = false; + repr.reset(); + logger.error(`Not enough memory to build geometry for representation ${repr.index + 1}`); + errorOccured = true; + } else { + throw e; + } + } + if (false) {} + } + hasGeometry = errorOccured || hasGeometry || gfxutils.groupHasGeometryToRender(repr.geo); + if (repr.geo) { + self.add(repr.geo); + } + } + self._reprListChanged = false; + console.timeEnd('build'); + resolve(); + }, 10); + }); + } + setNeedsRebuild() { + // invalidate all representations + const reprList = this._reprList; + for (let i = 0, n = reprList.length; i < n; ++i) { + reprList[i].needsRebuild = true; + } + } + rebuildSelectionGeometry() { + const mask = 1 << this._selectionBit; + gfxutils.clearTree(this._selectionGeometry); + for (let i = 0, n = this._reprList.length; i < n; ++i) { + const repr = this._reprList[i]; + const sg = repr.buildSelectionGeometry(mask); + if (!sg) { + continue; + } + this._selectionGeometry.add(sg); + for (let j = 0; j < sg.children.length; j++) { + const m = sg.children[j]; - Miew.prototype._getBSphereRadius = function () { - // calculate radius that would include all visuals - var radius = 0; + // copy component transform (that's not applied yet) + // TODO make this code obsolete, accessing editor is bad + if (this._editor && this._editor._componentTransforms) { + const t = this._editor._componentTransforms[m._component._index]; + if (t) { + m.position.copy(t.position); + m.quaternion.copy(t.quaternion); + } + } + } + gfxutils.applySelectionMaterial(sg); + } + } + _buildSelectorFromSortedLists(atoms, residues, chains) { + const complex = this._complex; + function optimizeList(list) { + const result = []; + let k = 0; + let first = NaN; + let last = NaN; + for (let i = 0, n = list.length; i < n; ++i) { + const value = list[i]; + if (value === last + 1) { + last = value; + } else { + if (!Number.isNaN(first)) { + result[k++] = new ComplexVisual_selectors.Range(first, last); + } + first = last = value; + } + } + if (!Number.isNaN(first)) { + result[k] = new ComplexVisual_selectors.Range(first, last); + } + return result; + } + let expression = null; + if (chains.length === complex._chains.length) { + expression = ComplexVisual_selectors.all(); + } else { + let selector; + if (chains.length > 0) { + selector = ComplexVisual_selectors.chain(chains); + expression = expression ? ComplexVisual_selectors.or(expression, selector) : selector; // NOSONAR + } + if (Object.keys(residues).length > 0) { + for (const ch in residues) { + if (residues.hasOwnProperty(ch)) { + selector = ComplexVisual_selectors.and(ComplexVisual_selectors.chain(ch), ComplexVisual_selectors.residx(optimizeList(residues[ch]))); + expression = expression ? ComplexVisual_selectors.or(expression, selector) : selector; + } + } + } + if (atoms.length > 0) { + selector = ComplexVisual_selectors.serial(optimizeList(atoms)); + expression = expression ? ComplexVisual_selectors.or(expression, selector) : selector; + } + if (!expression) { + expression = ComplexVisual_selectors.none(); + } + } + return expression; + } + buildSelectorFromMask(mask) { + const complex = this._complex; + const chains = []; + const residues = {}; + const atoms = []; + complex.forEachChain(chain => { + if (chain._mask & mask) { + chains.push(chain._name); + } + }); + complex.forEachResidue(residue => { + if (residue._mask & mask && !(residue._chain._mask & mask)) { + const c = residue._chain._name; + if (!(c in residues)) { + residues[c] = [residue._index]; + } else { + residues[c].push(residue._index); + } + } + }); + complex.forEachAtom(atom => { + if (atom.mask & mask && !(atom.residue._mask & mask)) { + atoms.push(atom.serial); + } + }); + return this._buildSelectorFromSortedLists(atoms, residues, chains); + } + forSelectedResidues(process) { + const selectionMask = 1 << this._selectionBit; + this._complex.forEachResidue(residue => { + if (residue._mask & selectionMask) { + process(residue); + } + }); + } + beginComponentEdit() { + if (this._editor) { + return null; + } + const editor = new ComplexVisualEdit.ComponentEditor(this); + if (!editor.begin()) { + return null; + } + this._editor = editor; + return editor; + } + beginFragmentEdit() { + if (this._editor) { + return null; + } + const editor = new ComplexVisualEdit.FragmentEditor(this); + if (!editor.begin()) { + return null; + } + this._editor = editor; + return editor; + } - this._forEachVisual(function (visual) { - radius = Math.max(radius, visual.getBoundaries().boundingSphere.radius); - }); + // should only be called by editors + finalizeEdit() { + this._editor = null; + } + setMaterialValues(values) { + let needTraverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + let process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + for (let i = 0, n = this._reprList.length; i < n; ++i) { + const rep = this._reprList[i]; + rep.material.setValues(values); + if (needTraverse) { + rep.geo.traverse(object => { + if (object instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh) { + object.material.setValues(values); + if (process !== undefined) { + process(object); + } + object.material.needsUpdate = true; + } + }); + } + } + } + setUberOptions(values) { + for (let i = 0, n = this._reprList.length; i < n; ++i) { + const rep = this._reprList[i]; + rep.material.setUberOptions(values); + } + } - return radius * this._objectControls.getScale(); - }; /** - * Calculate bounding box that would include all visuals and being axis aligned in world defined by - * transformation matrix: matrix - * @param {Matrix4} matrix - transformation matrix. - * @param {object} OBB - calculating bounding box. - * @param {Vector3} OBB.center - OBB center. - * @param {Vector3} OBB.halfSize - half magnitude of OBB sizes. + * Build selector that contains all atoms within given distance from group of atoms + * @param {Selector} selector - selector describing source group of atoms + * @param {number} radius - distance + * @returns {Selector} selector describing result group of atoms */ + within(selector, radius) { + const vw = this._complex.getVoxelWorld(); + if (vw === null) { + return false; + } + // mark atoms of the group as selected + const selectionMask = 1 << this._selectionBit; + this._complex.markAtoms(selector, selectionMask); - Miew.prototype.getOBB = function () { - var _bSphereForOneVisual = new THREE.Sphere(); - - var _bBoxForOneVisual = new THREE.Box3(); - - var _bBox = new THREE.Box3(); - - var _invMatrix = new THREE.Matrix4(); - - var _points = [new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3()]; - return function (matrix, OBB) { - _bBox.makeEmpty(); - - this._forEachVisual(function (visual) { - _bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere); - - _bSphereForOneVisual.applyMatrix4(visual.matrixWorld).applyMatrix4(matrix); - - _bSphereForOneVisual.getBoundingBox(_bBoxForOneVisual); - - _bBox.union(_bBoxForOneVisual); + // mark all atoms within distance as selected + if (vw) { + vw.forEachAtomWithinDistFromMasked(this._complex, selectionMask, Number(radius), atom => { + atom.mask |= selectionMask; }); + } - _bBox.getCenter(OBB.center); - - _invMatrix.getInverse(matrix); - - OBB.center.applyMatrix4(_invMatrix); - var min = _bBox.min; - var max = _bBox.max; + // update selection count + this._selectionCount = this._complex.countAtomsByMask(selectionMask); - _points[0].set(min.x, min.y, min.z); // 000 + // update secondary structure mask + this._complex.updateStructuresMask(); + return this.buildSelectorFromMask(selectionMask); + } +} +// 32 bits = 30 bits for reps + 1 for selection + 1 for selection expansion +ComplexVisual.NUM_REPRESENTATION_BITS = 30; +/* harmony default export */ const src_ComplexVisual = (ComplexVisual); +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeFaces.vert +const VolumeFaces_namespaceObject = "varying vec3 pos;\r\n\r\nvoid main() {\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n pos = position.xyz + 0.5;\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n}"; +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeFaces.frag +const gfx_shaders_VolumeFaces_namespaceObject = "varying vec3 pos;\r\n\r\nvoid main() {\r\n gl_FragColor = vec4(pos, 0.5);\r\n}"; +;// CONCATENATED MODULE: ./src/gfx/shaders/Volume.vert +const shaders_Volume_namespaceObject = "varying vec4 screenSpacePos;\r\n\r\nvoid main() {\r\n screenSpacePos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n gl_Position = screenSpacePos;\r\n}"; +;// CONCATENATED MODULE: ./src/gfx/shaders/Volume.frag +const src_gfx_shaders_Volume_namespaceObject = "uniform mat4 projectionMatrix;\r\n\r\n// 3D volume texture\r\nuniform vec3 volumeDim; // volume dimensions, pixels\r\nuniform sampler2D tileTex; // tiled texture containing all Z-slices of a 3D data\r\nuniform vec2 tileTexSize; // size of tiled texture, pixels\r\nuniform vec2 tileStride; // UV stride between slices in tile tex, pixels\r\n\r\nuniform vec3 boxAngles;//value of angles({x: alpha, y:beta, z:gamma}) types 1 - if angle is obtuse, 0 - if acute\r\nuniform vec3 delta; //Projection box delta's from non-orthogonal origin axes; {x: XY, y : XZ, z: YZ}\r\n\r\nuniform vec3 _isoLevel0;\r\nuniform float _flipV;\r\nuniform sampler2D _BFLeft;\r\nuniform sampler2D _BFRight;\r\nuniform sampler2D _FFLeft;\r\nuniform sampler2D _FFRight;\r\nuniform sampler2D _WFFLeft;\r\nuniform sampler2D _WFFRight;\r\n\r\nvarying vec4 screenSpacePos;\r\n\r\n#define NO_COLOR vec4(0., 0., 0., 0.)\r\n\r\nvec4 sample3DTexture(vec3 texCoord) {\r\n // a pair of Z slices is determined by nearest slice border\r\n float zSliceBorder = floor(texCoord.z * volumeDim.z + 0.5);\r\n float zSliceNumber1 = max(zSliceBorder - 1.0, 0.0);\r\n float zSliceNumber2 = min(zSliceBorder, volumeDim.z - 1.0);\r\n\r\n float rowTiles = floor(tileTexSize.x / tileStride.x);\r\n\r\n // calculate coords in tile texture for both slices\r\n vec2 tileOffset = vec2(mod(zSliceNumber1, rowTiles), floor(zSliceNumber1 / rowTiles));\r\n vec2 texCoordSlice1 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n tileOffset = vec2(mod(zSliceNumber2, rowTiles), floor(zSliceNumber2 / rowTiles));\r\n vec2 texCoordSlice2 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n\r\n // bilinear filtering\r\n vec4 colorSlice1 = texture2D(tileTex, texCoordSlice1);\r\n vec4 colorSlice2 = texture2D(tileTex, texCoordSlice2);\r\n float weightSlice2 = texCoord.z * volumeDim.z - (zSliceNumber1 + 0.5);\r\n return mix(colorSlice1, colorSlice2, weightSlice2);\r\n}\r\n\r\nvec4 sample3DTextureInclined(vec3 boxCoord) { // delta:{ x: XY, y : XZ, z: YZ }\r\n vec3 textCoord = boxCoord;\r\n vec2 currDelta = mix(boxCoord.zz, vec2(1., 1.) - boxCoord.zz, boxAngles.yx) * delta.yz;\r\n\r\n textCoord.y = (boxCoord.y - currDelta.y) / (1. - delta.z);\r\n if (textCoord.y < 0.0 || textCoord.y > 1.0)\r\n return NO_COLOR;\r\n\r\n currDelta.x += mix(textCoord.y, 1.0 - textCoord.y, boxAngles.z) * delta.x;\r\n\r\n textCoord.x = (boxCoord.x - currDelta.x) / (1. - delta.x - delta.y);\r\n if (textCoord.x < 0.0 || textCoord.x > 1.0)\r\n return NO_COLOR;\r\n\r\n return sample3DTexture(textCoord);\r\n}\r\n\r\nfloat CalcColor(vec3 iter, vec3 dir) {\r\n float d = 1. / 128.;\r\n vec3 dx = vec3(d, 0.0, 0.0);\r\n vec3 dy = vec3(0.0, d, 0.0);\r\n vec3 dz = vec3(0.0, 0.0, d);\r\n\r\n // #Opt: coordInc.x:(iter + dx).x > 1. ? 0.: sample3DTextureInclined(iter + dx).x,\r\n vec3 coordInc = mix(\r\n vec3(\r\n sample3DTextureInclined(iter + dx).x,\r\n sample3DTextureInclined(iter + dy).x,\r\n sample3DTextureInclined(iter + dz).x\r\n ),\r\n vec3(0. ,0. , 0.),\r\n vec3(floor((iter + dx).x), floor((iter + dy).y), floor((iter + dz).z))\r\n );\r\n\r\n // #Opt: coordDec.x:(iter - dx).x < 0. ? 0.: sample3DTextureInclined(iter - dx).x,\r\n vec3 coordDec = mix(\r\n vec3(0. ,0. , 0.),\r\n vec3(\r\n sample3DTextureInclined(iter - dx).x,\r\n sample3DTextureInclined(iter - dy).x,\r\n sample3DTextureInclined(iter - dz).x\r\n ),\r\n vec3(ceil((iter - dx).x), ceil((iter - dy).y), ceil((iter - dz).z))\r\n );\r\n\r\n vec3 N = normalize(coordInc - coordDec);\r\n float dif = max(0.0, dot(N, dir));\r\n return dif;\r\n}\r\n\r\nvec3 AccuracyIso(vec3 left, vec3 right, float volLeft, float threshold) {\r\n for (int i = 0; i < 5; i++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if ((volLeft - threshold) * (vol - threshold) < 0.)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec3 CorrectIso(vec3 left, vec3 right, float tr) {\r\n for (int j = 0; j < 5; j++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if (vol < tr)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec4 GetIso1(vec3 start, vec3 back, float molDist, vec3 dir, float tr, int count) {\r\n float vol, stepSize = (float(count) + 2.) / float(STEPS_COUNT);\r\n vec3 step = stepSize * dir, iterator = start, left, right;\r\n vec4 acc = NO_COLOR;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n vol = sample3DTextureInclined(iterator).r;\r\n if (length(iterator - back) <= stepSize || (vol > tr))\r\n break;\r\n }\r\n\r\n if (vol > tr)\r\n acc = vec4(CorrectIso(iterator, iterator - step, tr).xyz, 1.);\r\n\r\n return acc;\r\n}\r\n\r\nfloat easeOut(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return 1.0 - (1.0 - t) * (1.0 - t);\r\n}\r\n\r\nfloat easeIn(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return t * t;\r\n}\r\n\r\nvec3 GetColSimple(float vol) {\r\n float t = easeOut(_isoLevel0.x, _isoLevel0.y, vol);\r\n float s = easeIn(_isoLevel0.y, _isoLevel0.z, vol);\r\n return vec3(0.5, 0.6, 0.7) * (1.0 - t) + 2.0 * vec3(s, 0, 0);\r\n}\r\n\r\nvec4 VolRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 acc = NO_COLOR, iso;\r\n vec3 iterator = start, sumColor = vec3(0., 0., 0.);\r\n float stepSize, alpha, sumAlpha = 0.0, vol, curStepSize, molD;\r\n vec3 step, col, colOld, right;\r\n float tr0 = _isoLevel0.x;\r\n float dif, r, kd, finish;\r\n int count = 0, stopMol = 0;\r\n\r\n for (int k = 0; k < 3; k++) {\r\n stepSize = (float(k) + 2.) / float(STEPS_COUNT);\r\n kd = 140. * tr0 * stepSize;\r\n r = 1. - kd;\r\n step = stepSize * dir;\r\n iso = GetIso1(iterator, back, molDist, dir, tr0, k);\r\n if (iso.a < 0.1 || length(iso.xyz - start) > molDist)\r\n break;\r\n iterator = iso.xyz;\r\n dif = 1.;// CalcColor(iterator, dir);\r\n colOld = GetColSimple(tr0);\r\n curStepSize = stepSize;\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n molD = length(iterator - start);\r\n vol = sample3DTextureInclined(iterator).r;\r\n finish = distance(iterator, back) - stepSize;\r\n if (finish < 0.0 || vol < tr0 || (sumAlpha > 0.97) || molD > molDist)\r\n break;\r\n alpha = (1. - r);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4.* colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n colOld = col;\r\n } // for i\r\n\r\n if (finish < 0.0 || sumAlpha > 0.97)\r\n break;\r\n\r\n if (molD > molDist) {\r\n curStepSize = stepSize - (molD - molDist);\r\n right = iterator - (molD - molDist) * dir;\r\n vol = sample3DTextureInclined(right).r;\r\n } else {\r\n vec3 left = iterator - step;\r\n right = CorrectIso(left, iterator, tr0);\r\n curStepSize = distance(left, right);\r\n vol = tr0;\r\n }\r\n\r\n alpha = (1. - r) * curStepSize / stepSize;\r\n dif = 1.;// CalcColor(right, dir);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * curStepSize / stepSize * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4. * colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n\r\n if (molD > molDist)\r\n break;\r\n } // for k\r\n acc.rgb = 1. * sumColor / sumAlpha;\r\n acc.a = sumAlpha;\r\n return acc;\r\n}\r\n\r\nvec4 VolRender1(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n float stepSize = 1.0 / float(STEPS_COUNT);\r\n float len = length(back - start);\r\n vec3 step = stepSize * dir;\r\n vec3 iterator = start;\r\n float acc = 0.0;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n if (float(i) * stepSize > len)\r\n break;\r\n iterator = iterator + step;\r\n if (sample3DTextureInclined(iterator).r > _isoLevel0.x)\r\n acc += 10. * sample3DTextureInclined(iterator).r / float(STEPS_COUNT);\r\n }\r\n\r\n return vec4(1.,1.,1., acc);\r\n}\r\n\r\nvec4 IsoRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 tst = GetIso1(start, back, 2., dir, _isoLevel0.x, 0);\r\n vec4 col = NO_COLOR;\r\n\r\n if (length(tst.xyz - start) < molDist && tst.a > 0.1) {\r\n float dif = CalcColor(tst.xyz, dir);\r\n dif = 0.9 * dif * dif;\r\n col = vec4(dif, dif, dif, 1);\r\n }\r\n return col;\r\n}\r\n\r\nvec4 VolRender2(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n return sample3DTexture(start);\r\n}\r\n\r\nvoid main() {\r\n vec3 tc = screenSpacePos.xyz / screenSpacePos.w * 0.5 + 0.5;\r\n\r\n if (_flipV > 0.0) {\r\n tc.y = 1.0 - tc.y;\r\n }\r\n\r\n vec3 start;\r\n vec3 back;\r\n vec3 molBack;\r\n if (projectionMatrix[0][2] < 0.0) {\r\n start = texture2D(_FFLeft, tc.xy).xyz;\r\n back = texture2D(_BFLeft, tc.xy).xyz;\r\n molBack = texture2D(_WFFLeft, tc.xy).xyz;\r\n } else {\r\n start = texture2D(_FFRight, tc.xy).xyz;\r\n back = texture2D(_BFRight, tc.xy).xyz;\r\n molBack = texture2D(_WFFRight, tc.xy).xyz;\r\n }\r\n\r\n vec3 dir = normalize(back - start);\r\n\r\n float molDist = 2.0;\r\n if (length(molBack) > 0.001) {\r\n molDist = distance(start, molBack);\r\n }\r\n\r\n #ifdef ISO_MODE\r\n gl_FragColor = IsoRender(start, back, molDist, dir);\r\n #else\r\n gl_FragColor = VolRender(start, back, molDist, dir);\r\n #endif\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeFarPlane.vert +const VolumeFarPlane_namespaceObject = "varying vec4 volPos;\r\nuniform float aspectRatio;\r\nuniform float farZ;\r\nuniform float tanHalfFOV;\r\nuniform mat4 matWorld2Volume;\r\n\r\nvoid main() {\r\n // rescale plane to fill in the whole far plane area seen from camera\r\n vec3 pos = position.xyz;\r\n pos.x = pos.x * tanHalfFOV * farZ * aspectRatio;\r\n pos.y = pos.y * tanHalfFOV * farZ;\r\n // common transformation\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\r\n // calc pos in volume CS\r\n volPos = matWorld2Volume * modelMatrix * vec4(pos, 1.0);\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n volPos = volPos + 0.5;\r\n volPos.w = 0.5;\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeFarPlane.frag +const gfx_shaders_VolumeFarPlane_namespaceObject = "varying vec4 volPos;\r\n\r\nvoid main() {\r\n gl_FragColor = volPos;\r\n}"; +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ - _points[1].set(max.x, min.y, min.z); // 100 - _points[2].set(min.x, max.y, min.z); // 010 - _points[3].set(min.x, min.y, max.z); // 001 - for (var i = 0, l = _points.length; i < l; i++) { - _points[i].applyMatrix4(_invMatrix); +const volumeUniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UniformsUtils.merge([{ + volumeDim: { + type: 'v3', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(512, 512, 512) + }, + tileTex: { + type: 't', + value: null + }, + tileTexSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(512, 512) + }, + tileStride: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(512, 512) + }, + boxAngles: { + type: 'v3', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1, 1, 1) + }, + delta: { + type: 'v3', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0) + }, + _isoLevel0: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.5, 0.75, 1.0) + }, + _flipV: { + type: 'f', + value: 0.0 + }, + _BFLeft: { + type: 't', + value: null + }, + _BFRight: { + type: 't', + value: null + }, + _FFLeft: { + type: 't', + value: null + }, + _FFRight: { + type: 't', + value: null + }, + _WFFLeft: { + type: 't', + value: null + }, + _WFFRight: { + type: 't', + value: null + } +}]); +function overrideUniforms(params, defUniforms) { + const uniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UniformsUtils.clone(defUniforms); + for (const p in params) { + if (uniforms.hasOwnProperty(p)) { + uniforms[p].value = params[p]; + } + } + return uniforms; +} +function facesPosMaterialParams(params, sideType) { + return { + uniforms: overrideUniforms(params, {}), + vertexShader: VolumeFaces_namespaceObject, + fragmentShader: gfx_shaders_VolumeFaces_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false, + side: sideType + }; +} +class BackFacePosMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.ShaderMaterial { + constructor(params) { + const backFaceParams = facesPosMaterialParams(params, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BackSide); + super(backFaceParams); + } +} +class ShaderParams { + constructor(params, uniforms, vertexShader, fragmentShader) { + this.uniforms = overrideUniforms(params, uniforms); + this.vertexShader = vertexShader; + this.fragmentShader = fragmentShader; + this.transparent = false; + this.depthTest = false; + this.depthWrite = false; + this.side = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.FrontSide; + } +} +class BackFacePosMaterialFarPlane extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.ShaderMaterial { + constructor(params) { + const matUniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UniformsUtils.merge([{ + aspectRatio: { + type: 'f', + value: 0.0 + }, + farZ: { + type: 'f', + value: 0.0 + }, + tanHalfFOV: { + type: 'f', + value: 0.0 + }, + matWorld2Volume: { + type: '4fv', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4() } - - OBB.halfSize.set(Math.abs(_points[0].x - _points[1].x), Math.abs(_points[0].y - _points[2].y), Math.abs(_points[0].z - _points[3].z)).multiplyScalar(0.5); + }]); + const shaderParams = new ShaderParams(params, matUniforms, VolumeFarPlane_namespaceObject, gfx_shaders_VolumeFarPlane_namespaceObject); + super(shaderParams); + } +} +class FrontFacePosMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.ShaderMaterial { + constructor(params) { + const frontFaceParams = facesPosMaterialParams(params, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.FrontSide); + super(frontFaceParams); + } +} +class VolumeMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.ShaderMaterial { + constructor(params) { + const shaderParams = new ShaderParams(params, volumeUniforms, shaders_Volume_namespaceObject, src_gfx_shaders_Volume_namespaceObject); + shaderParams.transparent = true; + shaderParams.depthTest = true; + super(shaderParams); + this.updateDefines(); + } + updateDefines() { + this.defines = { + ISO_MODE: settings.now.modes.VD.isoMode, + STEPS_COUNT: settings.now.modes.VD.polyComplexity[settings.now.resolution] * 100 }; - }(); - - Miew.prototype._updateFog = function () { - var gfx = this._gfx; + this.needsUpdate = true; + } +} +/* harmony default export */ const shaders_VolumeMaterial = ({ + BackFacePosMaterial, + BackFacePosMaterialFarPlane, + FrontFacePosMaterial, + VolumeMaterial +}); +;// CONCATENATED MODULE: ./src/gfx/VolumeMesh.js - if (settings.now.fog) { - if (typeof gfx.scene.fog === 'undefined' || gfx.scene.fog === null) { - var color = chooseFogColor(); - gfx.scene.fog = new THREE.Fog(color); - this._setUberMaterialValues({ - fog: settings.now.fog - }); - } - updateFogRange(gfx.scene.fog, gfx.camera.position.z, this._getBSphereRadius()); - } else if (gfx.scene.fog) { - gfx.scene.fog = undefined; +class VolumeMesh extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh { + volumeInfo = {}; // data for noise filter - this._setUberMaterialValues({ - fog: settings.now.fog - }); + constructor() { + const geo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry(); + super(geo); + this.clipPlane = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Plane(); + const size = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.5, 0.5, 0.5); + this.size = size; + this.cullFlag = [true, true, true, true, true, true, true, true, false, false, false, false, false, false]; + this.faces = [{ + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, -1) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 1) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, -1, 0) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 1, 0) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-1, 0, 0) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1, 0, 0) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0) + }]; + this.vertices = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-size.x, -size.y, -size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-size.x, size.y, -size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(size.x, -size.y, -size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(size.x, size.y, -size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-size.x, -size.y, size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-size.x, size.y, size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(size.x, -size.y, size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(size.x, size.y, size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0), + // Placeholder for section + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0)]; + geo.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(new Float32Array(this.vertices.length * 3), 3)); + this.name = 'VolumeMesh'; + } + static _corners = (() => [ + // x, y, z, edge1, edge2, edge3 + [-1, -1, -1, 0, 4, 8], [1, -1, -1, 0, 5, 9], [1, 1, -1, 1, 5, 10], [-1, 1, -1, 1, 4, 11], [-1, -1, 1, 2, 6, 8], [1, -1, 1, 2, 7, 9], [1, 1, 1, 3, 7, 10], [-1, 1, 1, 3, 6, 11]])(); + static _edges = (() => [ + // corner1, corner2, center_x, center_y, center_z + [0, 1, 0, -1, -1], [2, 3, 0, 1, -1], [4, 5, 0, -1, 1], [6, 7, 0, 1, 1], [0, 3, -1, 0, -1], [1, 2, 1, 0, -1], [4, 7, -1, 0, 1], [5, 6, 1, 0, 1], [0, 4, -1, -1, 0], [1, 5, 1, -1, 0], [2, 6, -1, 1, 0], [3, 7, 1, 1, 0]])(); + static _edgeIntersections = function () { + const edgeIntersections = []; + for (let j = 0; j < 12; ++j) { + edgeIntersections.push(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3()); } - }; - - Miew.prototype._onUpdate = function () { - if (this.isScriptingCommandAvailable !== undefined && this.isScriptingCommandAvailable() && !this._building) { - this.callNextCmd(); + return edgeIntersections; + }(); + _updateVertices() { + // Algorithm: + // 1. Get plane parameters + // 2. Compute culling flags for all vertices + // 3. If intersection occurs => compute from 3 to 6 intersection points + const corners = VolumeMesh._corners; + const edges = VolumeMesh._edges; + const edgeIntersections = VolumeMesh._edgeIntersections; + let i; + const norm = this.clipPlane.normal; + const D = this.clipPlane.constant; + const vert = this.vertices; + const { + size + } = this; + const cornerMark = [0, 0, 0, 0, 0, 0, 0, 0]; + const edgeMark = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; + const curEdge = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + let curEdgeInter = null; + function CheckX() { + if (norm.x === 0) return 0; + const x = -(norm.dot(curEdge) + D) / norm.x; + if (-size.x <= x && x <= size.x) { + curEdgeInter.set(x, curEdge.y, curEdge.z); + if (x === size.x) return 2; + if (x === -size.x) return -2; + return 1; + } + return 0; } - - this._objectControls.update(); - - this._forEachComplexVisual(function (visual) { - visual.getComplex().update(); - }); - - if (settings.now.autobuild && !this._loading.length && !this._building && this._needRebuild()) { - this.rebuild(); + function CheckY() { + if (norm.y === 0) return 0; + const y = -(norm.dot(curEdge) + D) / norm.y; + if (-size.y <= y && y <= size.y) { + curEdgeInter.set(curEdge.x, y, curEdge.z); + if (y === size.y) return 2; + if (y === -size.y) return -2; + return 1; + } + return 0; } - - if (!this._loading.length && !this._building && !this._needRebuild()) { - this._updateView(); + function CheckZ() { + if (norm.z === 0) return 0; + const z = -(norm.dot(curEdge) + D) / norm.z; + if (-size.z <= z && z <= size.z) { + curEdgeInter.set(curEdge.x, curEdge.y, z); + if (z === size.z) return 2; + if (z === -size.z) return -2; + return 1; + } + return 0; } - this._updateFog(); - - if (this._gfx.renderer.xr.enabled) { - this.webVR.updateMoleculeScale(); + // for each edge + for (let curEdgeIdx = 0; curEdgeIdx < 12; ++curEdgeIdx) { + const curEdgeSource = edges[curEdgeIdx]; + curEdgeInter = edgeIntersections[curEdgeIdx]; + curEdge.set(curEdgeSource[2], curEdgeSource[3], curEdgeSource[4]); + curEdge.multiply(size); + + // calculate intersection point + let flag = 0; + if (curEdgeSource[2] === 0) flag = CheckX(); + if (curEdgeSource[3] === 0) flag = CheckY(); + if (curEdgeSource[4] === 0) flag = CheckZ(); + + // mark corresponding corner (if plane cuts through one) + if (flag === -2) { + cornerMark[curEdgeSource[0]] = 1; + } else if (flag === 2) { + cornerMark[curEdgeSource[1]] = 1; + } else if (flag === 0) { + // edge is not intersected by the plane (doesn't produce a vertex) + edgeMark[curEdgeIdx] = 0; + } + } + const face = { + indices: [], + norm: norm.clone().negate() + }; + let nextVertex = 8; + + // for each marked corner + for (i = 0; i < 8; ++i) { + if (cornerMark[i] === 1) { + // add corner as vertex to the face + vert[nextVertex].set(corners[i][0], corners[i][1], corners[i][2]).multiply(size); + face.indices.push(nextVertex++); + // skip adjacent edges + edgeMark[corners[i][3]] = 0; + edgeMark[corners[i][4]] = 0; + edgeMark[corners[i][5]] = 0; + } + } + + // for each edge that has internal intersection + for (i = 0; i < 12; ++i) { + if (edgeMark[i] === 1) { + // add intersection point as vertex to the face + vert[nextVertex].copy(edgeIntersections[i]); + face.indices.push(nextVertex++); + } + } + this.faces[6] = face; + const diff = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const coplanarPoint = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this.clipPlane.coplanarPoint(coplanarPoint); + for (i = 0; i < vert.length; ++i) { + this.cullFlag[i] = false; + if (i < 8) { + // corners should be culled by clipping plane + diff.subVectors(vert[i], coplanarPoint); + this.cullFlag[i] = norm.dot(diff) >= 0.0; + } else if (i < 8 + face.indices.length) { + // cross section vertices don't get culled + this.cullFlag[i] = true; + } + } + + // write data to vertex buffer + const positions = this.geometry.getAttribute('position'); + let idx = 0; + for (i = 0; i < vert.length; ++i) { + positions.array[idx++] = vert[i].x; + positions.array[idx++] = vert[i].y; + positions.array[idx++] = vert[i].z; + } + positions.needsUpdate = true; + } + _collectVertices(face, filter) { + let i; + const vert = this.vertices; + face.indices = []; + for (i = 0; i < vert.length; ++i) { + if (this.cullFlag[i] && filter(vert[i])) { + face.indices.push(i); + } + } + } + _sortIndices(face, right) { + let i; + let j; + const vert = this.vertices; + const angle = []; + const dir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + for (i = 1; i < face.indices.length; ++i) { + dir.subVectors(vert[face.indices[i]], vert[face.indices[0]]); + dir.normalize(); + dir.cross(right); + dir.negate(); + angle[i] = face.norm.dot(dir); + } + + // Exchange sort + for (i = 1; i < face.indices.length - 1; ++i) { + for (j = i + 1; j < face.indices.length; ++j) { + if (angle[j] < angle[i]) { + // swap + let t = angle[i]; + angle[i] = angle[j]; + angle[j] = t; + t = face.indices[i]; + face.indices[i] = face.indices[j]; + face.indices[j] = t; + } + } + } + } + _updateIndices() { + // Algorithm: + // 1. Get plane vertices (from 3 to 6 vertices) + // 2. Get "right" vector in plane + // 3. Sort vertices using Graham-like method + // 4. Create indices + + let i; + let faceIdx; + let face; + const vert = this.vertices; + const { + size + } = this; + this._collectVertices(this.faces[0], vertex => vertex.z === -size.z); + this._collectVertices(this.faces[1], vertex => vertex.z === size.z); + this._collectVertices(this.faces[2], vertex => vertex.y === -size.y); + this._collectVertices(this.faces[3], vertex => vertex.y === size.y); + this._collectVertices(this.faces[4], vertex => vertex.x === -size.x); + this._collectVertices(this.faces[5], vertex => vertex.x === size.x); + const vCenter = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const vRight = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const vDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { + face = this.faces[faceIdx]; + if (face.indices.length === 0) continue; + vCenter.set(0, 0, 0); + for (i = 0; i < face.indices.length; ++i) { + vCenter.add(vert[face.indices[i]]); + } + vCenter.multiplyScalar(1.0 / face.indices.length); + vRight.subVectors(vert[face.indices[0]], vCenter); + vRight.normalize(); + const rightProj = []; + for (i = 0; i < face.indices.length; ++i) { + vDir.subVectors(vert[face.indices[i]], vCenter); + rightProj[i] = vDir.dot(vRight); + } + for (i = 1; i < face.indices.length; ++i) { + if (rightProj[i] < rightProj[0]) { + // swap + let t = rightProj[0]; + rightProj[0] = rightProj[i]; + rightProj[i] = t; + [t] = face.indices; + face.indices[0] = face.indices[i]; + face.indices[i] = t; + } + } + this._sortIndices(face, vRight); + } + let numIndices = 0; + for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { + face = this.faces[faceIdx]; + if (face.indices.length >= 3) { + numIndices += 3 * (face.indices.length - 2); + } + } + let offset = 0; + const indices = new Uint16Array(numIndices); + for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { + face = this.faces[faceIdx]; + for (i = 0; i < face.indices.length - 2; ++i) { + indices[offset] = face.indices[0]; // eslint-disable-line prefer-destructuring + indices[offset + 1] = face.indices[i + 1]; + indices[offset + 2] = face.indices[i + 2]; + offset += 3; + } + } + this.geometry.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(indices, 1)); + } + setDataSource(dataSource) { + const vm = new shaders_VolumeMaterial.VolumeMaterial(); + const dim = dataSource.getDimensions(); + const stride = dataSource.getTiledTextureStride(); + const texture = dataSource.buildTiledTexture(); + const bbox = dataSource.getBox(); + vm.uniforms.volumeDim.value.set(dim[0], dim[1], dim[2]); + vm.uniforms.tileTex.value = texture; + vm.uniforms.tileTexSize.value.set(texture.image.width, texture.image.height); + vm.uniforms.tileStride.value.set(stride[0], stride[1]); + Object.assign(this.volumeInfo, dataSource.getVolumeInfo()); + const volInfo = this.volumeInfo; + vm.uniforms.delta.value.copy(volInfo.delta); + vm.uniforms.boxAngles.value.set(volInfo.obtuseAngle[0], volInfo.obtuseAngle[1], volInfo.obtuseAngle[2]); + this.material = vm; + bbox.getSize(this.scale); + bbox.getCenter(this.position); + } + _updateIsoLevel() { + const { + kSigma, + kSigmaMed, + kSigmaMax + } = settings.now.modes.VD; + const volInfo = this.volumeInfo; + const mean = volInfo.dmean - volInfo.dmin; + const span = volInfo.dmax - volInfo.dmin; + const level = k => (mean + k * volInfo.sd) / span; + this.material.uniforms._isoLevel0.value.set(level(kSigma), level(kSigmaMed), level(kSigmaMax)); + } + static _nearClipPlaneOffset = 0.2; + static _pos = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3())(); + static _norm = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3())(); + static _norm4D = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector4())(); + static _matrixWorldToLocal = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4())(); + static _clipPlane = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Plane())(); + rebuild(camera) { + const nearClipPlaneOffset = VolumeMesh._nearClipPlaneOffset; + const pos = VolumeMesh._pos; + const norm = VolumeMesh._norm; + const norm4D = VolumeMesh._norm4D; + const matrixWorldToLocal = VolumeMesh._matrixWorldToLocal; + const clipPlane = VolumeMesh._clipPlane; + this._updateIsoLevel(); + + // get clip plane in local space + camera.getWorldDirection(norm); + camera.getWorldPosition(pos); + pos.addScaledVector(norm, camera.near + nearClipPlaneOffset); + + // transform pos to local CS + matrixWorldToLocal.copy(this.matrixWorld).invert(); + pos.applyMatrix4(matrixWorldToLocal); + + // transform norm to local CS + norm4D.set(norm.x, norm.y, norm.z, 0.0); // NOTE: use homogeneous norm for proper transformation + norm4D.applyMatrix4(matrixWorldToLocal); + norm.copy(norm4D); + norm.normalize(); + clipPlane.setFromNormalAndCoplanarPoint(norm, pos); + if (!this.clipPlane.equals(clipPlane)) { + this.clipPlane = clipPlane.clone(); + this._updateVertices(); + this._updateIndices(); } + } +} +/* harmony default export */ const gfx_VolumeMesh = (VolumeMesh); +;// CONCATENATED MODULE: ./src/gfx/VolumeBounds.js + + +function _flattenArray(input) { + const n = input.length; + const output = new Float32Array(n * 3); + for (let i = 0; i < n; ++i) { + const j = 3 * i; + const v = input[i]; + output[j] = v.x; + output[j + 1] = v.y; + output[j + 2] = v.z; + } + return output; +} +class VolumeBounds { + static _projectionTable = { + // corresponds between (origin axes and angles between them) and between saving vector coordinates + XY: ['x', 2], + XZ: ['y', 1], + YZ: ['z', 0] }; + constructor(bBox, volInfo) { + const { + delta + } = volInfo; // {x: XY, y : XZ, z: YZ} + const { + obtuseAngle + } = volInfo; // 1 - obtuse, 0 - acute + + const bSize = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + bBox.getSize(bSize); + bSize.multiplyScalar(0.5); + const offsetVert = this._getBaseVertices(delta, obtuseAngle); + const geometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry(); + const vertices = []; + for (let i = 0; i < 4; i++) { + vertices.push(offsetVert[i].clone().multiply(bSize)); + vertices.push(offsetVert[(i + 1) % 4].clone().multiply(bSize)); + } + const translation = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(2 * bSize.x * (1 - delta.x - delta.y), 0, 0); + for (let i = 0; i < 8; i++) { + vertices.push(vertices[i].clone().add(translation)); + } + for (let i = 0; i < 4; i++) { + vertices.push(vertices[i * 2].clone()); + vertices.push(vertices[i * 2 + 8].clone()); + } + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + bBox.getCenter(center); + vertices.forEach(vertex => vertex.add(center)); // pivot shift + + const flatVertices = _flattenArray(vertices); + geometry.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(flatVertices, 3)); + this._lines = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineSegments(geometry, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineBasicMaterial({ + color: 0xFFFFFF + })); + this._lines.layers.set(gfxutils.LAYERS.VOLUME); + } - Miew.prototype._onRender = function () { - var gfx = this._gfx; // update all matrices - - gfx.scene.updateMatrixWorld(); - gfx.camera.updateMatrixWorld(); + // Set one edge (4 points) of frame, from which with parallel transfer the rest of the frame points can be obtained + _getBaseVertices(delta, obtuseAngle) { + const projTable = VolumeBounds._projectionTable; + const proj = (index, inv) => { + // tricky function to take account of projections: their position(related to box) and sign + const currDelta = delta[projTable[index][0]]; + const angleValue = -0.5 * (inv - 1) + inv * obtuseAngle[projTable[index][1]]; // inv = 1: alpha; inv = -1: 1 - alpha + return angleValue * currDelta; + }; + const offsetVert = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', 1)), -1 + 2 * proj('YZ', 1), -1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', 1)), -1 + 2 * proj('YZ', -1), 1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', -1)), 1 - 2 * proj('YZ', 1), 1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', -1)), 1 - 2 * proj('YZ', -1), -1)]; + return offsetVert; + } + getMesh() { + return this._lines; + } +} +/* harmony default export */ const gfx_VolumeBounds = (VolumeBounds); +;// CONCATENATED MODULE: ./src/gfx/VolumeFarPlane.js + + + + + +// Thes geometric far plane is required for correct filling in the BFTexture in case, when far plane cuts the volume +// cube. In cut place of cube there is no correct data in BFTexture and volume rendering integral is calculated +// with errors. +// Far plane cuts the cube in case of large volume scale (zoom), because farplane doesn't change +class VolumeFarPlane { + // create plane with unit corners coords (for future rescale in vshader according to camera properties) + constructor(volume, width, height) { + const planeGeo = this._initPlaneGeo(width, height); + const mat = new shaders_VolumeMaterial.BackFacePosMaterialFarPlane(); + this._plane = new meshes.Mesh(planeGeo, mat); + this._plane.frustumCulled = false; + this._plane.doubleSided = true; + const matWorldToVolume = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + this._plane._onBeforeRender = function (_renderer, _scene, camera, _geometry, _material, _group) { + const { + material + } = this; + if (!volume || !material) { + return; + } - this._clipPlaneUpdateValue(this._getBSphereRadius()); + // count point in world at farplane place + const planeCamPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector4(0, 0, -(camera.far - 0.1), 1); + planeCamPos.applyMatrix4(camera.matrixWorld); - this._fogFarUpdateValue(); + // recalc matrices to make plane be placed as farplane in the World relative to camera + this.matrix.identity(); + this.matrix.makeTranslation(planeCamPos.x, planeCamPos.y, planeCamPos.z); + this.matrixWorld.copy(this.matrix); + this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld); + this.normalMatrix.getNormalMatrix(this.modelViewMatrix); - gfx.renderer.setRenderTarget(null); - gfx.renderer.clear(); + // build worldToVolume matrix to transform plane into volumeCS (volumeCS coords are written to BackFaceTexture) + const volumeMatrix = volume.matrixWorld; + matWorldToVolume.copy(volumeMatrix).invert(); - this._renderFrame(settings.now.stereo); - }; + // update material props + material.uniforms.aspectRatio.value = camera.aspect; + material.uniforms.farZ.value = camera.far; + material.uniforms.tanHalfFOV.value = Math.tan(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MathUtils.DEG2RAD * 0.5 * camera.fov); + material.uniforms.matWorld2Volume.value = matWorldToVolume; + }; - Miew.prototype._renderFrame = function () { - var _anaglyphMat = new AnaglyphMaterial(); + // set it to special layer to draw only into BFTexture + this._plane.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE); + } + _initPlaneGeo(width, height) { + const planeGeo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry(); + width = width || 1; + height = height || 1; + const vertices = new Float32Array([-0.5 * width, 0.5 * height, 0, 0.5 * width, 0.5 * height, 0, -0.5 * width, -0.5 * height, 0, 0.5 * width, -0.5 * height, 0]); + planeGeo.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(vertices, 3)); + planeGeo.setIndex([0, 2, 1, 2, 3, 1]); + return planeGeo; + } + getMesh() { + return this._plane; + } +} +/* harmony default export */ const gfx_VolumeFarPlane = (VolumeFarPlane); +;// CONCATENATED MODULE: ./src/VolumeVisual.js - var _size = new THREE.Vector2(); - return function (stereo) { - var gfx = this._gfx; - var renderer = gfx.renderer; - renderer.getSize(_size); - if (stereo !== 'NONE') { - gfx.camera.focus = gfx.camera.position.z; // set focus to the center of the object - gfx.stereoCam.aspect = 1.0; // in anaglyph mode we render full-size image for each eye - // while in other stereo modes only half-size (two images on the screen) - if (stereo === 'ANAGLYPH') { - gfx.stereoCam.update(gfx.camera); - } else { - gfx.stereoCam.updateHalfSized(gfx.camera, settings.now.camFov); - } - } // resize offscreen buffers to match the target +class VolumeVisual extends src_Visual { + constructor(name, dataSource) { + super(name, dataSource); + this._mesh = new gfx_VolumeMesh(); + this._mesh.setDataSource(dataSource); + this.add(this._mesh); + this._frame = new gfx_VolumeBounds(this.getBoundaries().boundingBox, this._mesh.volumeInfo); + this.add(this._frame.getMesh()); + this.showFrame(settings.now.modes.VD.frame); + this._farPlane = new gfx_VolumeFarPlane(this._mesh, 2, 2); + this.add(this._farPlane.getMesh()); + } + getBoundaries() { + const box = this._dataSource.getBox(); + const sphere = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Sphere(); + box.getBoundingSphere(sphere); + return { + boundingBox: box, + boundingSphere: sphere + }; + } + getMesh() { + return this._mesh; + } + showFrame(needShow) { + this._frame.getMesh().material.visible = needShow; + } +} +/* harmony default export */ const src_VolumeVisual = (VolumeVisual); +;// CONCATENATED MODULE: ./src/io/loaders/LoaderList.js - var pixelRatio = gfx.renderer.getPixelRatio(); - this._resizeOffscreenBuffers(_size.width * pixelRatio, _size.height * pixelRatio, stereo); +/** + * A list of available loaders. + * @extends EntityList + */ +class LoaderList extends utils_EntityList { + /** + * Create a list of loaders. + * The loaders are indexed by supported source types (`.types` property of a Loader + * subclass). + * The loaders can be retrieved later by matching against specs (see {@link LoaderList#find}). + * + * @param {!Array=} someLoaders A list of {@link Loader} subclasses to + * automatically register at creation time. + * @see LoaderList#register + */ + constructor() { + let someLoaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + super(someLoaders, ['types']); + } - this._renderShadowMap(); + /** + * Find a suitable loader for a source type. + * + * @param {Object} specs Loader specifications. + * @param {string=} specs.type Supported source type. + * @param {*=} specs.source Source to load from. + */ + find(specs) { + let list = []; + if (specs.type) { + list = this._dict.types[specs.type.toLowerCase()] || []; + } else if (specs.source) { + return this._list.filter(SomeLoader => SomeLoader.canProbablyLoad && SomeLoader.canProbablyLoad(specs.source)); + } + return [...list]; + } +} +/* harmony default export */ const loaders_LoaderList = (LoaderList); +;// CONCATENATED MODULE: ./src/io/loaders/Loader.js + + +class Loader extends utils_EventDispatcher { + constructor(source, options) { + super(); + this._source = source; + this._options = options || {}; + this._abort = false; + this._agent = null; + } + load() { + return Promise.reject(new Error('Loading from this source is not implemented')); + } + abort() { + this._abort = true; + if (this._agent) { + this._agent.abort(); + } + } + static extractName(_source) { + return undefined; + } +} +utils_makeContextDependent(Loader.prototype); +;// CONCATENATED MODULE: ./src/io/loaders/FileLoader.js + +class FileLoader extends Loader { + constructor(source, options) { + super(source, options); + options = this._options; + this._binary = options.binary === true; + } + load() { + return new Promise((resolve, reject) => { + if (this._abort) { + throw new Error('Loading aborted'); + } + const blob = this._source; + const reader = this._agent = new FileReader(); + reader.addEventListener('load', () => { + resolve(reader.result); + }); + reader.addEventListener('error', () => { + reject(reader.error); + }); + reader.addEventListener('abort', () => { + reject(new Error('Loading aborted')); + }); + reader.addEventListener('progress', event => { + this.dispatchEvent(event); + }); + if (this._binary) { + reader.readAsArrayBuffer(blob); + } else { + reader.readAsText(blob); + } + }); + } + static canProbablyLoad(source) { + return File && source instanceof File || Blob && source instanceof Blob; + } + static extractName(source) { + return source && source.name; + } +} +FileLoader.types = ['file', 'blob']; +;// CONCATENATED MODULE: ./src/io/loaders/XHRLoader.js - switch (stereo) { - case 'WEBVR': - case 'NONE': - this._renderScene(gfx.camera, false); - break; - case 'SIMPLE': - case 'DISTORTED': - renderer.setScissorTest(true); - renderer.setScissor(0, 0, _size.width / 2, _size.height); - renderer.setViewport(0, 0, _size.width / 2, _size.height); +// we don't need to detect all kinds of URLs, just the evident ones +const urlStartRegexp = /^(https?|ftp):\/\//i; +class XHRLoader extends Loader { + constructor(source, options) { + super(source, options); + options = this._options; + this._binary = options.binary === true; + } + load() { + return new Promise((resolve, reject) => { + if (this._abort) { + throw new Error('Loading aborted'); + } + const url = this._source; + const request = this._agent = new XMLHttpRequest(); + request.addEventListener('load', () => { + if (request.status === 200) { + resolve(request.response); + } else { + reject(new Error(`HTTP ${request.status} while fetching ${url}`)); + } + }); + request.addEventListener('error', () => { + reject(new Error('HTTP request failed')); + }); + request.addEventListener('abort', () => { + reject(new Error('Loading aborted')); + }); + request.addEventListener('progress', event => { + this.dispatchEvent(event); + }); + request.open('GET', url); + if (this._binary) { + request.responseType = 'arraybuffer'; + } else { + request.responseType = 'text'; + } + request.send(); + }); + } + static canProbablyLoad(source) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(source) && urlStartRegexp.test(source); + } + static extractName(source) { + if (source) { + const last = (source.indexOf('?') + 1 || source.lastIndexOf('#') + 1 || source.length + 1) - 1; + return source.slice(source.lastIndexOf('/', last) + 1, last); + } + return undefined; + } +} +XHRLoader.types = ['url']; +;// CONCATENATED MODULE: ./src/io/loaders/ImmediateLoader.js - this._renderScene(this._gfx.stereoCam.cameraL, stereo === 'DISTORTED'); +class ImmediateLoader extends Loader { + load() { + return new Promise(resolve => { + if (this._abort) { + throw new Error('Loading aborted'); + } + resolve(this._source); + }); + } + static canProbablyLoad(_source) { + return false; + } +} +ImmediateLoader.types = ['immediate']; +;// CONCATENATED MODULE: ./src/io/loaders.js - renderer.setScissor(_size.width / 2, 0, _size.width / 2, _size.height); - renderer.setViewport(_size.width / 2, 0, _size.width / 2, _size.height); - this._renderScene(this._gfx.stereoCam.cameraR, stereo === 'DISTORTED'); - renderer.setScissorTest(false); - break; - case 'ANAGLYPH': - this._renderScene(this._gfx.stereoCam.cameraL, false, gfx.stereoBufL); +/* harmony default export */ const loaders = (new loaders_LoaderList([ +// note: order might be important +FileLoader, XHRLoader, ImmediateLoader])); +;// CONCATENATED MODULE: ./src/io/parsers/ParserList.js - this._renderScene(this._gfx.stereoCam.cameraR, false, gfx.stereoBufR); - renderer.setRenderTarget(null); - _anaglyphMat.uniforms.srcL.value = gfx.stereoBufL.texture; - _anaglyphMat.uniforms.srcR.value = gfx.stereoBufR.texture; - gfx.renderer.renderScreenQuad(_anaglyphMat); - break; - } +/** + * A list of available parsers. + * @extends EntityList + */ +class ParserList extends utils_EntityList { + /** + * Create a list of parsers. + * The parsers are indexed by supported data formats and file extensions (`.formats` and + * `.extensions` properties of a Parser subclass). + * The parsers can be retrieved later by matching against specs (see {@link ParsrerList#find}). + * + * @param {!Array=} someParsers A list of {@link Parser} subclasses to + * automatically register at creation time. + * @see ParserList#register + */ + constructor() { + let someParsers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + super(someParsers, ['formats', 'extensions']); + } - gfx.renderer2d.render(gfx.scene, gfx.camera); + /** + * Find a suitable parser for data. + * + * @param {Object} specs Parser specifications. + * @param {string=} specs.format Supported data format. + * @param {string=} specs.ext Supported filename extension. + * @param {*=} specs.data Data to parse. + */ + find(specs) { + let list = []; + if (specs.format) { + list = this._dict.formats[specs.format.toLowerCase()] || []; + } else if (specs.ext) { + list = this._dict.extensions[specs.ext.toLowerCase()] || []; + } + // autodetect only if no format is forced + if (list.length === 0 && !specs.format && specs.data) { + return this._list.filter(SomeParser => SomeParser.canProbablyParse && SomeParser.canProbablyParse(specs.data)); + } + return [...list]; + } +} +/* harmony default export */ const parsers_ParserList = (ParserList); +;// CONCATENATED MODULE: ./src/io/parsers/Parser.js + +class Parser { + constructor(data, options) { + this._data = data; + this._options = options || {}; + this._abort = false; + } + parseSync() { + throw new Error('Parsing this type of data is not implemented'); + } + parse() { + return new Promise((resolve, reject) => { + setTimeout(() => { + try { + if (this._abort) { + return reject(new Error('Parsing aborted')); + } + return resolve(this.parseSync()); + } catch (error) { + return reject(error); + } + }); + }); + } - if (settings.now.axes && gfx.axes && !gfx.renderer.xr.enabled) { - gfx.axes.render(renderer); - } - }; - }(); + // only for volume Parsers + getModel() { + this.model._parseHeader(this._data); + return this.model; + } + abort() { + this._abort = true; + } +} +utils_makeContextDependent(Parser.prototype); +;// CONCATENATED MODULE: ./src/io/parsers/pdb/Remark290.js + + +/** + * Parser helper for PDB tag "REMARK 290". + * + * @exports Remark290 + * @constructor + */ +class Remark290 { + constructor() { + /** @type {THREE.Matrix4[]} */ + this.matrices = []; + + /** @type {?THREE.Matrix4} */ + this._matrix = null; + /** @type {number} */ + this._matrixIndex = -1; + } - Miew.prototype._onBgColorChanged = function () { - var gfx = this._gfx; - var color = chooseFogColor(); + /** + * Parse a single line of a stream. + * @param {PDBStream} stream - stream to parse + */ - if (gfx) { - if (gfx.scene.fog) { - gfx.scene.fog.color.set(color); + parse(stream) { + /** @type {?THREE.Matrix4} */ + let matrix = this._matrix; + if (stream.readString(12, 18) === ' SMTRY') { + const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2 + const matrixData = stream.readString(20, 80).trim().split(/\s+/); + const matrixIndex = parseInt(matrixData[0], 10); + if (this._matrix === null || matrixIndex !== this._matrixIndex) { + // TODO: assert(matrixIndex === this.matrices.length + 1); + this._matrixIndex = matrixIndex; + this._matrix = matrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + this.matrices[this.matrices.length] = matrix; } - - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + const { + elements + } = matrix; + elements[matrixRow] = parseFloat(matrixData[1]); + elements[matrixRow + 4] = parseFloat(matrixData[2]); + elements[matrixRow + 8] = parseFloat(matrixData[3]); + elements[matrixRow + 12] = parseFloat(matrixData[4]); } + } +} +Remark290.prototype.id = 290; +/* harmony default export */ const pdb_Remark290 = (Remark290); +;// CONCATENATED MODULE: ./src/io/parsers/pdb/Remark350.js + + +const { + Assembly: Remark350_Assembly +} = chem; + +/** + * Parser helper for PDB tag "REMARK 350". + * + * @exports Remark350 + * @constructor + */ +class Remark350 { + constructor(complex) { + /** @type {Complex} */ + this._complex = complex; + /** @type {Assembly[]} */ + this.assemblies = []; + + /** @type {?Assembly} */ + this._assembly = null; + /** @type {?THREE.Matrix4} */ + this._matrix = null; + /** @type {number} */ + this._matrixIndex = -1; + } - this._needRender = true; - }; - - Miew.prototype._onFogColorChanged = function () { - var gfx = this._gfx; - var color = chooseFogColor(); + /** + * Parse a single line of a stream. + * @param {PDBStream} stream - stream to parse + */ - if (gfx && gfx.scene.fog) { - gfx.scene.fog.color.set(color); + parse(stream) { + /** @type {?Assembly} */ + let assembly = this._assembly; + /** @type {?THREE.Matrix4} */ + let matrix = this._matrix; + if (assembly && stream.readString(12, 18) === ' BIOMT') { + const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2 + const matrixData = stream.readString(20, 80).trim().split(/\s+/); + const matrixIndex = parseInt(matrixData[0], 10); + if (this._matrix === null || matrixIndex !== this._matrixIndex) { + // TODO: assert(matrixIndex === assembly.matrices.length + 1); + this._matrixIndex = matrixIndex; + this._matrix = matrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + assembly.addMatrix(matrix); + } + const { + elements + } = matrix; + elements[matrixRow] = parseFloat(matrixData[1]); + elements[matrixRow + 4] = parseFloat(matrixData[2]); + elements[matrixRow + 8] = parseFloat(matrixData[3]); + elements[matrixRow + 12] = parseFloat(matrixData[4]); + } else if (assembly && stream.readString(35, 41) === 'CHAINS:') { + const entries = stream.readString(42, 80).split(','); + for (let i = 0, n = entries.length; i < n; ++i) { + const chain = entries[i].trim(); + if (chain.length > 0) { + assembly.addChain(chain); + } + } + } else if (stream.readString(12, 23) === 'BIOMOLECULE:') { + // assert molIndex === this.assemblies.length + 1 + this._matrix = null; + this._matrixIndex = -1; + this._assembly = assembly = new Remark350_Assembly(this._complex); + this.assemblies.push(assembly); } + } +} +Remark350.prototype.id = 350; +/* harmony default export */ const pdb_Remark350 = (Remark350); +;// CONCATENATED MODULE: ./src/io/parsers/PDBStream.js +/** Helper class for stream-like reading input files. */ +class PDBStream { + /** + * Create a stream + * @param {String} data Input data + */ + constructor(data) { + /** @type String */ + this._data = data; // Input file + /** @type Number */ + this._start = 0; // Starting position of line + /** @type Number */ + this._nextCR = -1; // Position of next CR (0x0D) + /** @type Number */ + this._nextLF = -1; // Position of next LF (0x0A) + /** @type Number */ + this._next = -1; // End position of line + /** @type Number */ + this._end = data.length; // End of data + + this.next(); + } - this._needRender = true; - }; + /** + * Reading next line. + * @returns {String} Next line in data (ending with LF or CR) + */ + readLine() { + return this._data.slice(this._start, this._next); + } - Miew.prototype._setUberMaterialValues = function (values) { - this._gfx.root.traverse(function (obj) { - if ((obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line) && obj.material instanceof UberMaterial) { - obj.material.setValues(values); - obj.material.needsUpdate = true; - } - }); - }; + /** + * Reading character from position. + * @param {Number} pos - Position in current line. + * @returns {String} Character from position + */ + readChar(pos) { + pos = this._start + pos - 1; + return pos < this._next ? this._data[pos] : ' '; + } + + /** + * Reading character code from position. + * @param {Number} pos - Position in current line. + * @returns {Number} Character code from position + */ + readCharCode(pos) { + pos = this._start + pos - 1; + return pos < this._next ? this._data.charCodeAt(pos) : 32; + } + + /** + * Reading string from begin to end points. + * For a reason unknown, numbering assumed not to start from 0, but from 1. + * @param {Number} begin - Begin point in current line. + * @param {Number} end - End point in current line. + * @returns {String} String from begin to end + */ + readString(begin, end) { + const from = this._start + begin - 1; + const to = this._start + end; + return this._data.slice(from, to < this._next ? to : this._next); + } - Miew.prototype._enableMRT = function (on, renderBuffer, textureBuffer) { - var gfx = this._gfx; - var gl = gfx.renderer.getContext(); - var ext = gl.getExtension('WEBGL_draw_buffers'); - var properties = gfx.renderer.properties; + /** + * Reading integer from begin to end points. + * @param {Number} begin - Begin point in current line. + * @param {Number} end - End point in current line. + * @returns {Number} Integer from begin to end + */ + readInt(begin, end) { + return parseInt(this.readString(begin, end), 10); + } - if (!on) { - ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, null]); - return; - } // take extra texture from Texture Buffer + /** + * Reading float from begin to end points. + * @param {Number} begin - Begin point in current line. + * @param {Number} end - End point in current line. + * @returns {Number} Float from begin to end + */ + readFloat(begin, end) { + return parseFloat(this.readString(begin, end)); + } + /** + * Checking for end of data. + * @returns {boolean} True if data is ended, false otherwise + */ + end() { + return this._start >= this._end; + } + + /** + * Procedure to re-arrange current pointers in data. + */ + next() { + const start = this._next + 1; + this._start = start < this._end ? start : this._end; - gfx.renderer.setRenderTarget(textureBuffer); + // support CR, LF, CR+LF line endings + // do not support LF+CR, CR+CR+LF, and other strange combinations - var tx8 = properties.get(textureBuffer.texture).__webglTexture; + if (this._start > this._nextCR) { + this._nextCR = (this._data.indexOf('\r', this._start) + 1 || this._end + 1) - 1; + } + if (this._start > this._nextLF) { + this._nextLF = (this._data.indexOf('\n', this._start) + 1 || this._end + 1) - 1; + } + this._next = this._nextCR + 1 < this._nextLF ? this._nextCR : this._nextLF; + } +} +/* harmony default export */ const parsers_PDBStream = (PDBStream); +;// CONCATENATED MODULE: ./src/io/parsers/PDBParser.js - gl.bindTexture(gl.TEXTURE_2D, tx8); // take texture and framebuffer from renderbuffer - gfx.renderer.setRenderTarget(renderBuffer); - var fb = properties.get(renderBuffer).__webglFramebuffer; - var tx = properties.get(renderBuffer.texture).__webglTexture; // set framebuffer - gl.bindFramebuffer(gl.FRAMEBUFFER, fb); - fb.width = renderBuffer.width; - fb.height = renderBuffer.height; - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tx, 0); - gl.framebufferTexture2D(gl.FRAMEBUFFER, ext.COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, tx8, 0); // mapping textures - ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, ext.COLOR_ATTACHMENT1_WEBGL]); - }; +const { + Complex: PDBParser_Complex, + Element: PDBParser_Element, + Helix: PDBParser_Helix, + Sheet: PDBParser_Sheet, + Strand: PDBParser_Strand, + Bond: PDBParser_Bond, + Molecule: PDBParser_Molecule +} = chem; +const TAG_LENGTH = 6; +function nameToElement(name) { + // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM + // + // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1 + // + // Atom names start with element symbols right-justified in columns 13-14 + // as permitted by the length of the name. For example, the symbol FE for + // iron appears in columns 13-14, whereas the symbol C for carbon appears + // in column 14 (see Misaligned Atom Names). If an atom name has four + // characters, however, it must start in column 13 even if the element + // symbol is a single character (for example, see Hydrogen Atoms). + + const veryLong = name.trim().length === 4; + return name.slice(0, veryLong ? 1 : 2).trim(); +} + +// the most frequently used beginnings; although HEADER is mandatory, it is often missing in handmade files +const pdbStartRegexp = /^(HEADER\s|COMPND\s|REMARK\s|ATOM {2}|HETATM|MODEL )/i; +const remarkParsers = { + // NOTE: please forget the idea to build the method name in runtime, it can be obfuscated. + 290: pdb_Remark290, + 350: pdb_Remark350 +}; +class PDBParser extends Parser { + constructor(data, options) { + super(data, options); + this._complex = null; + this._chain = null; + this._residue = null; + this._sheet = null; + this._serialAtomMap = null; + this._modelId = 1; + this._compaundFound = false; + this._biomoleculeFound = false; + this._allowedChainsIDs = null; + this._lastMolId = -1; + this._remarks = {}; + this._remark = null; + this._molecules = []; + this._molecule = null; + this._compndCurrToken = ''; + this._options.fileType = 'pdb'; + } + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(data) && pdbStartRegexp.test(data); + } + _finalize() { + this._fixBondsArray(); + this._fixChains(); + + // keep crystallographic symmetry transformations + const remark290 = this._remarks[290]; + this._complex.symmetry = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(remark290) ? [] : remark290.matrices; + + // add loaded biological assemblies + const remark350 = this._remarks[350]; + this._complex.units = this._complex.units.concat(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(remark350) ? [] : remark350.assemblies); + + // add loaded macromolecules + this._finalizeMolecules(); + + // create secondary structure etc. + this._complex.finalize({ + needAutoBonding: true, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap + }); + } + _finalizeMolecules() { + // get chains from complex + const chainDict = {}; + let i; + const chains = this._complex._chains; + for (i = 0; i < chains.length; ++i) { + const chainObj = chains[i]; + const chainName = chainObj._name; + chainDict[chainName] = chainObj; + } + + // aggregate residues from chains + for (i = 0; i < this._molecules.length; i++) { + const m = this._molecules[i]; + let residues = []; + for (let j = 0; j < m._chains.length; j++) { + const name = m._chains[j]; + const chain = chainDict[name]; + residues = residues.concat(chain._residues.slice()); + } + const molecule = new PDBParser_Molecule(this._complex, m._name, i + 1); + molecule.residues = residues; + this._complex._molecules[i] = molecule; + } + } + _fixChains() { + const idChainMap = {}; + const complex = this._complex; - Miew.prototype._renderScene = function () { - return function (camera, distortion, target) { - distortion = distortion || false; - target = target || null; - var gfx = this._gfx; // render to offscreen buffer + // prepare + for (let i = 0; i < complex._chains.length; i++) { + const chain = complex._chains[i]; + idChainMap[chain._name.charCodeAt(0)] = chain; + } + } - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - gfx.renderer.setRenderTarget(target); - gfx.renderer.clear(); + // FIXME: This function is redundant, CONECT records always follow ATOM and HETATM. Build the map online. + _fixBondsArray() { + const serialAtomMap = this._serialAtomMap = {}; + const complex = this._complex; + const atoms = complex._atoms; + for (let i = 0, ni = atoms.length; i < ni; ++i) { + const atom = atoms[i]; + serialAtomMap[atom.serial] = atom; + } + const bonds = complex._bonds; + const { + logger + } = this; + for (let j = 0, nj = bonds.length; j < nj; ++j) { + const bond = bonds[j]; + if (bond._right < bond._left) { + logger.debug('_fixBondsArray: Logic error.'); + } + bond._left = serialAtomMap[bond._left] || null; + bond._right = serialAtomMap[bond._right] || null; + } + } + _parseATOM(stream) { + if (this._modelId !== 1) { + return; + } - if (gfx.renderer.xr.enabled) { - gfx.renderer.render(gfx.scene, camera); + /* eslint-disable no-magic-numbers */ + const het = stream.readCharCode(1) === 0x48; + + // field names according to wwPDB Format + // NOTE: Chimera allows (nonstandard) use of columns 6-11 for the integer atom serial number in ATOM records. + const serial = het ? stream.readInt(7, 11) : stream.readInt(6, 11); + let name = stream.readString(13, 16); + const altLoc = stream.readChar(17); + const resName = stream.readString(18, 20).trim(); + const chainID = stream.readChar(22); + const resSeq = stream.readInt(23, 26); + const iCode = stream.readChar(27); + const x = stream.readFloat(31, 38); + const y = stream.readFloat(39, 46); + const z = stream.readFloat(47, 54); + const occupancy = stream.readFloat(55, 60); + const tempFactor = stream.readFloat(61, 66); + const element = stream.readString(77, 78).trim() || nameToElement(name); + const charge = stream.readInt(79, 80) || 0; + /* eslint-enable no-magic-numbers */ + // skip waters (there may be lots of them) + if (this.settings.now.nowater) { + if (resName === 'HOH' || resName === 'WAT') { return; - } // clean buffer for normals texture + } + } + // PDB uses positional system for atom names. It helps derive element type from the name + // but names may include extra spaces. From this point on we don't need those spaces anymore. + name = name.trim(); + const type = PDBParser_Element.getByName(element); + const role = PDBParser_Element.Role[name]; // FIXME: Maybe should use type as additional index (" CA " vs. "CA ") - gfx.renderer.setClearColor(0x000000, 0.0); - gfx.renderer.setRenderTarget(gfx.offscreenBuf4); - gfx.renderer.clearColor(); - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - gfx.renderer.setRenderTarget(gfx.offscreenBuf); - gfx.renderer.clear(); - var bHaveComplexes = this._getComplexVisual() !== null; + // NOTE: Residues of a particular chain are not required to be listed next to each other. + // https://github.com/biasmv/pv/commit/7319b898b7473ba380c26699e3b028b2b1a7e1a1 + let chain = this._chain; + if (!chain || chain.getName() !== chainID) { + this._chain = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); + this._residue = null; + } + let residue = this._residue; + if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { + this._residue = residue = chain.addResidue(resName, resSeq, iCode); + } + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(x, y, z); + residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); + } + _parseENDMDL() { + this._modelId += 1; + } + _parseCONECT(stream) { + /* eslint-disable no-magic-numbers */ + const serial0 = stream.readInt(7, 11); + const serial1 = stream.readInt(12, 16); + const serial2 = stream.readInt(17, 21); + const serial3 = stream.readInt(22, 26); + const serial4 = stream.readInt(27, 31); + /* eslint-enable no-magic-numbers */ - var volumeVisual = this._getVolumeVisual(); + const complex = this._complex; - var ssao = bHaveComplexes && settings.now.ao; + // Keep bonds ordered by atom serial + if (serial1 && serial1 > serial0) { + complex.addBond(serial0, serial1, 0, PDBParser_Bond.BondType.UNKNOWN, true); + } + if (serial2 && serial2 > serial0) { + complex.addBond(serial0, serial2, 0, PDBParser_Bond.BondType.UNKNOWN, true); + } + if (serial3 && serial3 > serial0) { + complex.addBond(serial0, serial3, 0, PDBParser_Bond.BondType.UNKNOWN, true); + } + if (serial4 && serial4 > serial0) { + complex.addBond(serial0, serial4, 0, PDBParser_Bond.BondType.UNKNOWN, true); + } + } + _parseCOMPND(stream) { + /* eslint-disable no-magic-numbers */ + const str = stream.readString(11, 80); + const tokenIdx = str.indexOf(':'); + this._compndCurrToken = tokenIdx > 0 ? str.substring(0, tokenIdx).trim() : this._compndCurrToken; + /* eslint-enable no-magic-numbers */ - if (ssao) { - this._enableMRT(true, gfx.offscreenBuf, gfx.offscreenBuf4); - } + // start reading new molecule + if (this._compndCurrToken === 'MOL_ID') { + this._molecule = { + _index: '', + _chains: [] + }; + this._molecule._index = parseInt(str.substring(tokenIdx + 1, str.indexOf(';')), 10); + this._molecules.push(this._molecule); + // parse molecule name + } else if (this._compndCurrToken === 'MOLECULE' && this._molecule != null) { + this._molecule._name = str.substring(tokenIdx + 1, str.indexOf(';')).trim(); + // parse molecule chains + } else if (this._compndCurrToken === 'CHAIN' && this._molecule != null) { + let chainStr = str.substring(tokenIdx + 1, 80).trim(); + const lastChar = chainStr[chainStr.length - 1]; + if (lastChar === ';' || lastChar === ',') { + chainStr = chainStr.slice(0, -1); + } + chainStr = chainStr.replace(/\s+/g, ''); + const chains = chainStr.split(','); + this._molecule._chains = this._molecule._chains.concat(chains); + } + } + _parseREMARK(stream) { + /* eslint-disable no-magic-numbers */ + const remarkNum = stream.readInt(8, 10); + /* eslint-enable no-magic-numbers */ - if (settings.now.transparency === 'prepass') { - this._renderWithPrepassTransparency(camera, gfx.offscreenBuf); - } else if (settings.now.transparency === 'standard') { - gfx.renderer.setRenderTarget(gfx.offscreenBuf); - gfx.renderer.render(gfx.scene, camera); + // create remark parser if needed + let remark = this._remarks[remarkNum]; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(remark)) { + const RemarkParser = remarkParsers[remarkNum]; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isFunction(RemarkParser)) { + this._remarks[remarkNum] = remark = new RemarkParser(this._complex); } + } - if (ssao) { - this._enableMRT(false, null, null); - } // when fxaa we should get resulting image in temp off-screen buff2 for further postprocessing with fxaa filter - // otherwise we render to canvas - - - var outline = bHaveComplexes && settings.now.outline.on; - var fxaa = bHaveComplexes && settings.now.fxaa; - var volume = volumeVisual !== null && volumeVisual.getMesh().material != null; - var dstBuffer = ssao || outline || volume || fxaa || distortion ? gfx.offscreenBuf2 : target; - var srcBuffer = gfx.offscreenBuf; - - if (ssao) { - this._performAO(srcBuffer, gfx.offscreenBuf4, gfx.offscreenBuf.depthTexture, dstBuffer, gfx.offscreenBuf3, gfx.offscreenBuf2); + // delegate parsing + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(remark)) { + remark.parse(stream); + } + } + _parseHELIX(stream) { + /* eslint-disable no-magic-numbers */ + const fields = [20, 22, 32, 34]; + /* eslint-enable no-magic-numbers */ + this._parseSTRUCTURE(stream, fields, obj => { + this._complex.addHelix(obj); + this._complex.structures.push(obj); + }); + } + _parseSHEET(stream) { + /* eslint-disable no-magic-numbers */ + const fields = [22, 23, 33, 34]; + /* eslint-enable no-magic-numbers */ + this._parseSTRUCTURE(stream, fields, obj => { + this._complex.addSheet(obj); + }); + } + _parseSTRUCTURE(stream, pars, adder) { + const startId = 0; + const startIndex = 1; + const endId = 2; + const endIndex = 3; - if (!fxaa && !distortion && !volume && !outline) { - srcBuffer = dstBuffer; - dstBuffer = target; - gfx.renderer.setRenderTarget(dstBuffer); - gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0); - } + // identify fields: debugging and stuff + /* eslint-disable no-magic-numbers */ + const codeOfS = 0x53; + const serialNumber = stream.readInt(8, 10); + const structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim() + const comment = stream.readString(41, 70).trim(); + const helLength = stream.readInt(72, 76); + const helixClass = stream.readInt(39, 40); + const shWidth = stream.readInt(15, 16); + const shCur = stream.readInt(42, 45); + const shPrev = stream.readInt(57, 60); + /* eslint-enable no-magic-numbers */ + // file fields + const startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0); + const endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0); + const startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3); + let iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4); + let startICode = 0; + if (iCodeStr.length > 0) { + startICode = iCodeStr.charCodeAt(0); + } + const endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3); + iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4); + let endICode = 0; + if (iCodeStr.length > 0) { + endICode = iCodeStr.charCodeAt(0); + } + let obj; + let cs = this._sheet; + if (stream.readCharCode(1) === codeOfS) { + if (cs !== null && cs.getName() !== structureName) { + cs = null; + this._sheet = null; + } + if (cs === null) { + this._sheet = obj = new PDBParser_Sheet(structureName, shWidth); + adder(obj); } else { - // just copy color buffer to dst buffer - gfx.renderer.setRenderTarget(dstBuffer); - gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0); - } // outline + obj = cs; + } + const strand = new PDBParser_Strand(obj, this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode), this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode), helixClass, shCur, shPrev); + obj.addStrand(strand); + this._complex.structures.push(strand); + } else { + obj = new PDBParser_Helix(helixClass, this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode), this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode), serialNumber, structureName, comment, helLength); + adder(obj); + } + } + _parseHEADER(stream) { + const { + metadata + } = this._complex; + metadata.classification = stream.readString(11, 50).trim(); + metadata.date = stream.readString(51, 59).trim(); + const id = stream.readString(63, 66).trim(); + metadata.id = id; + if (id) { + this._complex.name = id; + } + metadata.format = 'pdb'; + } + _parseTITLE(stream) { + const { + metadata + } = this._complex; + metadata.title = metadata.title || []; + const line = stream.readInt(9, 10) || 1; + metadata.title[line - 1] = stream.readString(11, 80).trim(); + } + static tagParsers = (() => ({ + HEADER: PDBParser.prototype._parseHEADER, + 'TITLE ': PDBParser.prototype._parseTITLE, + 'ATOM ': PDBParser.prototype._parseATOM, + HETATM: PDBParser.prototype._parseATOM, + ENDMDL: PDBParser.prototype._parseENDMDL, + CONECT: PDBParser.prototype._parseCONECT, + COMPND: PDBParser.prototype._parseCOMPND, + REMARK: PDBParser.prototype._parseREMARK, + // 'SOURCE': PDBParser.prototype._parseSOURCE, + 'HELIX ': PDBParser.prototype._parseHELIX, + 'SHEET ': PDBParser.prototype._parseSHEET, + // nonstandard extension to allow range 100,000 - 999,999 + 'ATOM 1': PDBParser.prototype._parseATOM, + 'ATOM 2': PDBParser.prototype._parseATOM, + 'ATOM 3': PDBParser.prototype._parseATOM, + 'ATOM 4': PDBParser.prototype._parseATOM, + 'ATOM 5': PDBParser.prototype._parseATOM, + 'ATOM 6': PDBParser.prototype._parseATOM, + 'ATOM 7': PDBParser.prototype._parseATOM, + 'ATOM 8': PDBParser.prototype._parseATOM, + 'ATOM 9': PDBParser.prototype._parseATOM + }))(); + parseSync() { + const stream = new parsers_PDBStream(this._data); + const result = this._complex = new PDBParser_Complex(); + // parse PDB line by line + while (!stream.end()) { + const tag = stream.readString(1, TAG_LENGTH); + const func = PDBParser.tagParsers[tag]; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isFunction(func)) { + func.call(this, stream); + } + stream.next(); + } - if (outline) { - srcBuffer = dstBuffer; - dstBuffer = volume || fxaa || distortion ? gfx.offscreenBuf3 : target; + // Resolve indices and serials to objects + this._finalize(); - if (srcBuffer != null) { - this._renderOutline(camera, gfx.offscreenBuf, srcBuffer, dstBuffer); + // cleanup + this._serialAtomMap = null; + this._sheet = null; + this._residue = null; + this._chain = null; + this._complex = null; + if (result.getAtomCount() === 0) { + throw new Error('The data does not contain valid atoms'); + } + return result; + } +} +PDBParser.formats = ['pdb']; +PDBParser.extensions = ['.pdb', '.ent']; +/* harmony default export */ const parsers_PDBParser = (PDBParser); +;// CONCATENATED MODULE: ./src/io/parsers/CMLParser.js + + + + +const { + Complex: CMLParser_Complex, + Element: CMLParser_Element, + SGroup: CMLParser_SGroup, + Bond: CMLParser_Bond +} = chem; +const cOrderCharCodes = { + A: 0, + S: 1, + D: 2, + T: 3 +}; +const cmlStartRegexp = /\s*<\?xml\b[^?>]*\?>\s*<(?:cml|molecule)\b/i; +class CMLParser extends Parser { + constructor(data, options) { + super(data, options); + this._complex = null; + this._residue = null; + this._serialAtomMap = null; + this._modelId = 1; + this._lastMolId = -1; + this._readOnlyOneMolecule = false; + this._options.fileType = 'cml'; + } + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(data) && cmlStartRegexp.test(data); + } + _rebuidBondIndexes(atoms, bonds) { + const count = atoms.length; + for (let i = 0; i < count; i++) { + const atomId = atoms[i].id; + const countBonds = bonds.length; + for (let j = 0; j < countBonds; j++) { + const idxs = bonds[j].atomRefs2.split(' '); + if (idxs[0] === atomId) { + bonds[j].start = i; } - } // render selected part with outline material - - - this._renderSelection(camera, gfx.offscreenBuf, dstBuffer); - - if (volume) { - // copy current picture to the buffer that retains depth-data of the original molecule render - // so that volume renderer could use depth-test - gfx.renderer.setRenderTarget(gfx.offscreenBuf); - gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0); - dstBuffer = gfx.offscreenBuf; - - this._renderVolume(volumeVisual, camera, dstBuffer, gfx.volBFTex, gfx.volFFTex, gfx.volWFFTex); // if this is the last stage -- copy image to target - - - if (!fxaa && !distortion) { - gfx.renderer.setRenderTarget(target); - gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0); + if (idxs[1] === atomId) { + bonds[j].end = i; } } - - srcBuffer = dstBuffer; - - if (fxaa) { - dstBuffer = distortion ? gfx.offscreenBuf4 : target; - - this._performFXAA(srcBuffer, dstBuffer); - - srcBuffer = dstBuffer; + } + } + _createSGroup(molecule, moleculeArr) { + const newGroup = new CMLParser_SGroup(molecule.id, molecule.fieldData, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(parseFloat(molecule.x), parseFloat(molecule.y), 0), molecule.atomRefs, molecule); + if (molecule.placement === 'Relative') { + newGroup._center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0); + } + if (molecule.fieldName === 'MDLBG_FRAGMENT_CHARGE') { + newGroup._charge = parseInt(molecule.fieldData, 10) || 0; + } + if (molecule.fieldName === 'MDLBG_FRAGMENT_COEFFICIENT') { + newGroup._repeat = parseInt(molecule.fieldData, 10) || 1; + } + moleculeArr.push(newGroup); + } + _extractSGroup(molecule, moleculeArr) { + if (!Array.isArray(moleculeArr)) { + moleculeArr = []; + } + if (molecule) { + if (Array.isArray(molecule)) { + const count = molecule.length; + for (let i = 0; i < count; i++) { + if (molecule[i].molecule) { + moleculeArr = moleculeArr.concat(this._extractSGroup(molecule[i].molecule)); + } + this._createSGroup(molecule[i], moleculeArr); + } + } else { + if (molecule.molecule) { + if (molecule.molecule) { + moleculeArr = moleculeArr.concat(this._extractSGroup(molecule.molecule)); + } + } + this._createSGroup(molecule, moleculeArr); } - - if (distortion) { - dstBuffer = target; - - this._performDistortion(srcBuffer, dstBuffer, true); + } + return moleculeArr; + } + _extractSGroups(molecule, atoms) { + const moleculeArr = this._extractSGroup(molecule); + const count = atoms.length; + let i; + let j; + for (i = 0; i < count; i++) { + const atomId = atoms[i].id; + for (j = 0; j < moleculeArr.length; j++) { + const firstAtomRef = moleculeArr[j]._atoms.split(' ')[0]; + if (firstAtomRef === atomId) { + if (!atoms[i].sgroupRef) { + atoms[i].sgroupRef = []; + } + atoms[i].sgroupRef.push(moleculeArr[j]); + } + } + } + // build sGroups centers + let atomMap = {}; // sgrpmap cache + let mapEntry = null; + const nLimon = 100000000; + const bLow = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(nLimon, nLimon, nLimon); + const bHight = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-nLimon, -nLimon, -nLimon); + function cycleFuncInner(e) { + mapEntry = atomMap[e]; + if (mapEntry) { + moleculeArr[j]._atoms.push(mapEntry.a); + } + } + function cycleFunc(e) { + mapEntry = atomMap[e]; + if (mapEntry) { + bLow.set(Math.min(bLow.x, mapEntry.x), Math.min(bLow.y, mapEntry.y), Math.min(bLow.z, mapEntry.z)); + bHight.set(Math.max(bHight.x, mapEntry.x), Math.max(bHight.y, mapEntry.y), Math.max(bHight.z, mapEntry.z)); + cycleFuncInner(e); + } + } + for (i = 0; i < atoms.length; i++) { + atomMap[atoms[i].id] = {}; + atomMap[atoms[i].id].x = atoms[i].x2; + if (atoms[i].x3) { + atomMap[atoms[i].id].x = atoms[i].x3; + } + atomMap[atoms[i].id].x = parseFloat(atomMap[atoms[i].id].x); + atomMap[atoms[i].id].y = atoms[i].y2; + if (atoms[i].y3) { + atomMap[atoms[i].id].y = atoms[i].y3; + } + atomMap[atoms[i].id].y = parseFloat(atomMap[atoms[i].id].y); + atomMap[atoms[i].id].z = '0.0'; + if (atoms[i].z3) { + atomMap[atoms[i].id].z = atoms[i].z3; + } + atomMap[atoms[i].id].z = parseFloat(atomMap[atoms[i].id].z); + atomMap[atoms[i].id].a = atoms[i]; + } + let atomsRef; + for (j = 0; j < moleculeArr.length; j++) { + if (moleculeArr[j]._center !== null) { + bLow.set(nLimon, nLimon, nLimon); + bHight.set(-nLimon, -nLimon, -nLimon); + atomsRef = moleculeArr[j]._atoms.split(' '); + moleculeArr[j]._atoms = []; + atomsRef.forEach(cycleFunc); + moleculeArr[j]._center.addVectors(bLow, bHight); + moleculeArr[j]._center.multiplyScalar(0.5); + } else { + atomsRef = moleculeArr[j]._atoms.split(' '); + moleculeArr[j]._atoms = []; + atomsRef.forEach(cycleFuncInner); } - }; - }(); - - Miew.prototype._performDistortion = function () { - var _scene = new THREE.Scene(); - - var _camera = new THREE.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, -500, 1000); - - var _material = new THREE.RawShaderMaterial({ - uniforms: { - srcTex: { - type: 't', - value: null - }, - aberration: { - type: 'fv3', - value: new THREE.Vector3(1.0) + } + atomMap = null; + } + _traverseData(dom) { + function isArray(o) { + return Object.prototype.toString.apply(o) === '[object Array]'; + } + function parseNode(xmlNode, result) { + if (xmlNode.nodeName === '#text' && xmlNode.nodeValue.trim() === '') { + return; + } + const jsonNode = {}; + jsonNode.xmlNode = xmlNode; + const existing = result[xmlNode.nodeName]; + if (existing) { + if (!isArray(existing)) { + result[xmlNode.nodeName] = [existing, jsonNode]; + } else { + result[xmlNode.nodeName].push(jsonNode); } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentScreenQuadFromDistTex, - transparent: false, - depthTest: false, - depthWrite: false - }); - - var _geo = gfxutils.buildDistorionMesh(10, 10, settings.now.debug.stereoBarrel); - - _scene.add(new meshes.Mesh(_geo, _material)); - - return function (srcBuffer, targetBuffer, mesh) { - this._gfx.renderer.setRenderTarget(targetBuffer); - - this._gfx.renderer.clear(); - - if (mesh) { - _material.uniforms.srcTex.value = srcBuffer.texture; - - _material.uniforms.aberration.value.set(0.995, 1.0, 1.01); - - this._gfx.renderer.render(_scene, _camera); } else { - this._gfx.renderer.renderScreenQuadFromTexWithDistortion(srcBuffer, settings.now.debug.stereoBarrel); + result[xmlNode.nodeName] = jsonNode; } - }; - }(); + let length; + let i; + if (xmlNode.attributes) { + ({ + length + } = xmlNode.attributes); + for (i = 0; i < length; i++) { + const attribute = xmlNode.attributes[i]; + jsonNode[attribute.nodeName] = attribute.nodeValue; + } + } + ({ + length + } = xmlNode.childNodes); + for (i = 0; i < length; i++) { + parseNode(xmlNode.childNodes[i], jsonNode); + } + } + const result = {}; + if (dom.childNodes.length) { + parseNode(dom.childNodes[0], result); + } + return result; + } + _findSuitableMolecule(data, molSet) { + for (const key in data) { + if (key === 'xmlNode') { + continue; + } else if (key === 'molecule') { + if (data.molecule) { + if (data.molecule.atomArray && data.molecule.atomArray.atom) { + molSet.push(data); + } + if (Array.isArray(data.molecule)) { + for (let i = 0; i < data.molecule.length; i++) { + if (data.molecule[i].atomArray && data.molecule[i].atomArray.atom) { + molSet.push({ + molecule: data.molecule[i] + }); + } + } + } + } + } else if (data[key] && data[key] !== null && typeof data[key] === 'object') { + this._findSuitableMolecule(data[key], molSet); + } + } + } + _selectComponents(text) { + const parser = new DOMParser(); + const doc = parser.parseFromString(text, 'application/xml'); + const traversedData = this._traverseData(doc); + let rawData; + const self = this; + function prepareComponentCompound(data) { + let atoms = []; + if (data.molecule && data.molecule.atomArray && data.molecule.atomArray.atom) { + if (!Array.isArray(data.molecule.atomArray.atom)) { + atoms.push(data.molecule.atomArray.atom); + } else { + atoms = data.molecule.atomArray.atom; + } + } else if (!data.molecule) { + const ret = {}; + ret.atomLabels = null; + ret.labelsCount = 1; + return ret; + } + if (data.molecule.molecule) { + self._extractSGroups(data.molecule.molecule, atoms); + } + let atom; + let count = atoms.length; + for (let i = 0; i < count; i++) { + atom = atoms[i]; + atom.edges = []; + } + let localBond = []; + if (data.molecule.bondArray && data.molecule.bondArray.bond) { + if (!Array.isArray(data.molecule.bondArray.bond)) { + localBond.push(data.molecule.bondArray.bond); + } else { + localBond = data.molecule.bondArray.bond; + } + } + let bond; + count = localBond.length; + self._rebuidBondIndexes(atoms, localBond); + function addCurrBond(index) { + bond = localBond[index]; + atom = atoms[bond.start]; + if (!atom) { + return false; + } + atom.edges.push(bond.end); + atom = atoms[bond.end]; + if (!atom) { + return false; + } + atom.edges.push(bond.start); + return true; + } + for (let i = 0; i < count; i++) { + if (!addCurrBond(i)) { + // ignore invalid bond + continue; + } + const orderAttr = bond.xmlNode.getAttribute('order'); + const tc = parseInt(orderAttr, 10); + // the default bond order is unknown + localBond[i].order = 0; + localBond[i].type = CMLParser_Bond.BondType.UNKNOWN; + if (tc > 1) { + localBond[i].order = tc; + } else { + // another option - bond order is a string + const order = cOrderCharCodes[orderAttr]; + if (order !== undefined) { + localBond[i].order = order; + if (orderAttr === 'A') { + localBond[i].type = CMLParser_Bond.BondType.AROMATIC; + } + } + } + } + count = atoms.length; + for (let i = 0; i < count; i++) { + atom = atoms[i]; + atom.edges.sort(); + } + const labels = self._breadWidthSearch(atoms, 0); // for now - Miew.prototype._renderOutline = function () { - var _outlineMaterial = new OutlineMaterial({ - depth: true + const retStruct = {}; + retStruct.atoms = atoms; + retStruct.bonds = localBond; + retStruct.labels = labels.atomLabels; + retStruct.count = Math.min(1, labels.labelsCount); // for now + retStruct.curr = -1; + retStruct.originalCML = doc; + return retStruct; + } + if (traversedData.cml) { + rawData = traversedData.cml; + } else { + rawData = traversedData; + } + const retData = []; + const filteredData = []; + this._findSuitableMolecule(rawData, filteredData); + if (this._readOnlyOneMolecule && filteredData.length > 1) { + filteredData.splice(1, filteredData.length - 1); + } + filteredData.forEach(d => { + const rd = prepareComponentCompound(d); + if (rd.atoms.length > 0) { + retData.push(rd); + } }); - - return function (camera, srcDepthBuffer, srcColorBuffer, targetBuffer) { - var self = this; - var gfx = self._gfx; // apply Sobel filter -- draw outline - - _outlineMaterial.uniforms.srcTex.value = srcColorBuffer.texture; - _outlineMaterial.uniforms.srcDepthTex.value = srcDepthBuffer.depthTexture; - - _outlineMaterial.uniforms.srcTexSize.value.set(srcDepthBuffer.width, srcDepthBuffer.height); - - _outlineMaterial.uniforms.color.value = new THREE.Color(settings.now.outline.color); - _outlineMaterial.uniforms.threshold.value = settings.now.outline.threshold; - _outlineMaterial.uniforms.thickness.value = new THREE.Vector2(settings.now.outline.thickness, settings.now.outline.thickness); - gfx.renderer.setRenderTarget(targetBuffer); - gfx.renderer.renderScreenQuad(_outlineMaterial); - }; - }(); - - Miew.prototype._renderShadowMap = function () { - var pars = { - minFilter: THREE.NearestFilter, - magFilter: THREE.NearestFilter, - format: THREE.RGBAFormat + return retData; + } + _packLabel(compId, molId) { + const shift = 16; + return (molId << shift) + compId; + } + _unpackLabel(l) { + const shift = 16; + const mask = (1 << shift) - 1; + return { + molId: l >>> shift, + compId: l & mask }; - return function () { - if (!settings.now.shadow.on) { - return; + } + _breadWidthSearch(atoms, molID) { + const atomLabels = new Array(atoms.length); + let id; + for (id = 0; id < atomLabels.length; id++) { + atomLabels[id] = this._packLabel(0, molID); + } + const breadthQueue = []; + let componentID = 0; + let labeledAtoms = atoms.length; + while (labeledAtoms > 0) { + componentID++; + let startID = -1; + for (id = 0; id < atomLabels.length; id++) { + if (this._unpackLabel(atomLabels[id]).compId === 0) { + startID = id; + break; + } + } + if (startID < 0) { + break; } - var gfx = this._gfx; - var currentRenderTarget = gfx.renderer.getRenderTarget(); - var activeCubeFace = gfx.renderer.getActiveCubeFace(); - var activeMipmapLevel = gfx.renderer.getActiveMipmapLevel(); - var _state = gfx.renderer.state; // Set GL state for depth map. - - _state.setBlending(THREE.NoBlending); - - _state.buffers.color.setClear(1, 1, 1, 1); - - _state.buffers.depth.setTest(true); - - _state.setScissorTest(false); - - for (var i = 0; i < gfx.scene.children.length; i++) { - if (gfx.scene.children[i].type === 'DirectionalLight') { - var light = gfx.scene.children[i]; - - if (light.shadow.map == null) { - light.shadow.map = new THREE.WebGLRenderTarget(light.shadow.mapSize.width, light.shadow.mapSize.height, pars); - light.shadow.camera.updateProjectionMatrix(); + // Bread first search + breadthQueue.push(atoms[startID]); + atomLabels[startID] = this._packLabel(componentID, molID); + labeledAtoms--; + while (breadthQueue.length > 0) { + const curr = breadthQueue.shift(); + if (!curr) { + continue; + } + for (let i = 0; i < curr.edges.length; i++) { + if (atomLabels[curr.edges[i]] !== componentID) { + breadthQueue.push(atoms[curr.edges[i]]); + atomLabels[curr.edges[i]] = componentID; + labeledAtoms--; + } + } + } + } + const ret = {}; + ret.atomLabels = atomLabels; + ret.labelsCount = componentID; + return ret; + } + _parseBond(eAtom, mainAtom, order, type) { + if (eAtom >= 0) { + const h = [Math.min(eAtom, mainAtom), Math.max(eAtom, mainAtom)]; + this._complex.addBond(h[0], h[1], order, type, true); + } + } + _fixBondsArray() { + const serialAtomMap = this._serialAtomMap = {}; + const complex = this._complex; + const atoms = complex._atoms; + for (let i = 0, ni = atoms.length; i < ni; ++i) { + const atom = atoms[i]; + serialAtomMap[atom.serial] = atom; + } + const bonds = complex._bonds; + const { + logger + } = this; + for (let j = 0, nj = bonds.length; j < nj; ++j) { + const bond = bonds[j]; + if (bond._right < bond._left) { + logger.debug('_fixBondsArray: Logic error.'); + } + bond._left = serialAtomMap[bond._left] || null; + bond._right = serialAtomMap[bond._right] || null; + } + } + _parseSet(varData) { + const complex = this._complex = new CMLParser_Complex(); + const data = varData; + const currentLabel = data.curr; + const { + atoms, + labels + } = data; + let atom = null; + let i; + let j; + const count = atoms.length; + function addFunc(a) { + a.xmlNodeRef = atom; + if (atom.x2) { + atom.x3 = atom.x2; + delete atom.x2; + } + if (atom.y2) { + atom.y3 = atom.y2; + delete atom.y2; + } + if (!atom.z3) { + atom.z3 = '0.0'; + } + atom.complexAtom = a; + } + let chains = {}; + // parse atoms in label order + const reorder = []; + for (i = 0; i < count; i++) { + reorder.push(i); + } + reorder.sort((a, b) => labels[a] - labels[b]); + for (i = 0; i < count; i++) { + const atomCharge = 0; + const lLabel = labels[reorder[i]]; + if (this._unpackLabel(lLabel).molId === this._unpackLabel(currentLabel).molId) { + atom = atoms[reorder[i]]; + const atomFullNameStruct = atom.elementType; + if (atom.sgroupRef) { + const countRef = atom.sgroupRef.length; + for (let k = 0; k < countRef; ++k) { + complex._sgroups.push(atom.sgroupRef[k]); + } + } + if (atom.x3 || atom.x2) { + const currAtomComp = this._unpackLabel(lLabel).compId; + // use ' ' by default instead of synthetic creation of chain names + const chainID = ' '; //= String.fromCharCode('A'.charCodeAt(0) + currAtomComp); + const resSeq = currAtomComp; + const iCode = ' '; + let strLabel = currAtomComp.toString(); + if (strLabel.length === 1) { + strLabel = `0${strLabel}`; + } + const resName = `N${strLabel}`; + let chain = chains[chainID]; + if (!chain || chain.getName() !== chainID) { + chains[chainID] = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); + this._residue = null; + } + let residue = this._residue; + if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { + this._residue = residue = chain.addResidue(resName, resSeq, iCode); } - light.shadow.updateMatrices(light); - gfx.renderer.setRenderTarget(light.shadow.map); - gfx.renderer.clear(); - gfx.renderer.render(gfx.scene, light.shadow.camera); + // _x, _y, _z, mname, mindex, atomNameFull, atomName, chainID, serial, isHet, atlLocInd, atomNameToTypeF + let xyz = null; + if (atom.x3) { + xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(parseFloat(atom.x3), parseFloat(atom.y3), parseFloat(atom.z3)); + } else if (atom.x2) { + xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(parseFloat(atom.x2), parseFloat(atom.y2), 0); + } + let element = CMLParser_Element.ByName[atom.elementType.toUpperCase()]; + if (!element) { + element = JSON.parse(JSON.stringify(CMLParser_Element.ByName[Object.keys(CMLParser_Element.ByName)[Object.keys(CMLParser_Element.ByName).length - 1]])); + element.number += 1; + element.name = atom.elementType.toUpperCase(); + element.fullName = 'Unknown'; + CMLParser_Element.ByName[atom.elementType.toUpperCase()] = element; + } + const atomSerial = parseInt(atom.id.replace(/[^0-9]/, ''), 10); + const added = residue.addAtom(atomFullNameStruct, element, xyz, CMLParser_Element.Role.SG, true, atomSerial, ' ', 1.0, 0.0, atomCharge); + if (atom.hydrogenCount) { + added.hydrogenCount = parseInt(atom.hydrogenCount, 10); + } + if (atom.mrvValence) { + added.valence = parseInt(atom.mrvValence, 10); + } + addFunc(added); } } - - gfx.renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel); - }; - }(); - /** - * Check if there is selection which must be rendered or not. - * @private - * @returns {boolean} true on existing selection to render - */ - - - Miew.prototype._hasSelectionToRender = function () { - var selPivot = this._gfx.selectionPivot; - - for (var i = 0; i < selPivot.children.length; i++) { - var selPivotChild = selPivot.children[i]; - - if (selPivotChild.children.length > 0) { - return true; + } + chains = null; // NOSONAR + for (i = 0; i < data.bonds.length; i++) { + const cb = data.bonds[i]; + if (this._unpackLabel(labels[cb.start]).molId === this._unpackLabel(currentLabel).molId && this._unpackLabel(labels[cb.end]).molId === this._unpackLabel(currentLabel).molId) { + atom = atoms[cb.start]; + if (!atom || !atoms[cb.end]) { + continue; // skip invalid + } + this._parseBond(parseInt(atom.id.replace(/[^0-9]/, ''), 10), parseInt(atoms[cb.end].id.replace(/[^0-9]/, ''), 10), cb.order, cb.type); } } - - return false; - }; - - Miew.prototype._renderSelection = function () { - var _outlineMaterial = new OutlineMaterial(); - - return function (camera, srcBuffer, targetBuffer) { - var self = this; - var gfx = self._gfx; // clear offscreen buffer (leave z-buffer intact) - - gfx.renderer.setClearColor('black', 0); // render selection to offscreen buffer - - gfx.renderer.setRenderTarget(srcBuffer); - gfx.renderer.clear(true, false, false); - - if (self._hasSelectionToRender()) { - gfx.selectionRoot.matrix = gfx.root.matrix; - gfx.selectionPivot.matrix = gfx.pivot.matrix; - gfx.renderer.render(gfx.selectionScene, camera); - } else { - // just render something to force "target clear" operation to finish - gfx.renderer.renderDummyQuad(); - } // overlay to screen - - - gfx.renderer.setRenderTarget(targetBuffer); - gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 0.6); // apply Sobel filter -- draw outline - - _outlineMaterial.uniforms.srcTex.value = srcBuffer.texture; - - _outlineMaterial.uniforms.srcTexSize.value.set(srcBuffer.width, srcBuffer.height); - - gfx.renderer.renderScreenQuad(_outlineMaterial); - }; - }(); - - Miew.prototype._checkVolumeRenderingSupport = function (renderTarget) { - if (!renderTarget) { + for (i = 0; i < this._complex.getSGroupCount(); i++) { + const sGrp = this._complex.getSGroups()[i]; + for (j = 0; j < sGrp._atoms.length; j++) { + sGrp._atoms[j] = sGrp._atoms[j].complexAtom; + } + } + for (i = 0; i < count; i++) { + if (this._unpackLabel(labels[i]).molId === this._unpackLabel(currentLabel).molId) { + atom = atoms[i]; + atom.complexAtom = null; + delete atom.complexAtom; + } + } + this._complex.originalCML = data.originalCML; + this._fixBondsArray(); + complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap + }); + this._serialAtomMap = null; + this._complex = null; + return complex; + } + parseSync() { + const complexes = []; + const self = this; + const moleculaSet = this._selectComponents(this._data); + moleculaSet.forEach(molSet => { + molSet.curr = 2; + if (molSet.count === 0) { + molSet.count = 1; + } + for (let i = 0; i < molSet.count; i++) { + molSet.curr = i + 1; + complexes.push(self._parseSet(molSet, false)); + } + }); + let totalAtomsParsed = 0; + complexes.forEach(c => { + totalAtomsParsed += c.getAtomCount(); + }); + if (totalAtomsParsed <= 0) { + throw new Error('The data does not contain valid atoms'); + } + if (complexes.length > 1) { + const joinedComplex = new CMLParser_Complex(); + joinedComplex.joinComplexes(complexes); + joinedComplex.originalCML = complexes[0].originalCML; + return joinedComplex; + } + if (complexes.length === 1) { + return complexes[0]; + } + return new CMLParser_Complex(); + } +} +CMLParser.formats = ['cml']; +CMLParser.extensions = ['.cml']; +/* harmony default export */ const parsers_CMLParser = (CMLParser); +// EXTERNAL MODULE: ./vendor/js/mmtf.js +var mmtf = __webpack_require__(660); +var mmtf_default = /*#__PURE__*/__webpack_require__.n(mmtf); +;// CONCATENATED MODULE: ./src/io/parsers/MMTFParser.js + + + + + + +const { + Complex: MMTFParser_Complex, + Chain: MMTFParser_Chain, + Atom: MMTFParser_Atom, + Element: MMTFParser_Element, + Helix: MMTFParser_Helix, + Sheet: MMTFParser_Sheet, + Strand: MMTFParser_Strand, + Bond: MMTFParser_Bond, + Assembly: MMTFParser_Assembly, + Molecule: MMTFParser_Molecule +} = chem; +class ArrayComparator { + constructor(original) { + this._original = Array.from(original); + this._original.sort(); + this._sum = 0; + for (let i = 0; i < this._original.length; ++i) { + this._sum += this._original[i]; + } + } + compare(candidate) { + const len = candidate.length; + if (len !== this._original.length) { return false; } - - var gfx = this._gfx; - var oldRT = gfx.renderer.getRenderTarget(); - gfx.renderer.setRenderTarget(renderTarget); - var context = gfx.renderer.getContext(); - var result = context.checkFramebufferStatus(context.FRAMEBUFFER); - gfx.renderer.setRenderTarget(oldRT); - - if (result !== context.FRAMEBUFFER_COMPLETE) { - // floatFrameBufferWarning = ; - this.logger.warn('Device doesn\'t support electron density rendering'); + let sum = 0; + let i; + for (i = 0; i < len; ++i) { + sum += candidate[i]; + } + if (sum !== this._sum) { return false; } - - return true; - }; - - Miew.prototype._renderVolume = function () { - var volumeBFMat = new VolumeMaterial$1.BackFacePosMaterial(); - var volumeFFMat = new VolumeMaterial$1.FrontFacePosMaterial(); - var cubeOffsetMat = new THREE.Matrix4().makeTranslation(0.5, 0.5, 0.5); - var world2colorMat = new THREE.Matrix4(); - var volumeRenderingSupported; - return function (volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) { - var gfx = this._gfx; - - if (typeof volumeRenderingSupported === 'undefined') { - volumeRenderingSupported = this._checkVolumeRenderingSupport(tmpBuf1); + const sorted = Array.from(candidate); + sorted.sort(); + for (i = 0; i < len; ++i) { + if (sorted[i] !== this._original[i]) { + return false; } - - if (!volumeRenderingSupported) { + } + return true; + } +} +ArrayComparator.prototype.constructor = ArrayComparator; +const MMTFParser_StructuralElementType = chem_StructuralElement.Type; + +// see https://github.com/rcsb/mmtf-javascript/blob/master/src/mmtf-traverse.js +const secStructToType = [MMTFParser_StructuralElementType.HELIX_PI, +// 0 +MMTFParser_StructuralElementType.BEND, +// 1 +MMTFParser_StructuralElementType.HELIX_ALPHA, +// 2 +MMTFParser_StructuralElementType.STRAND, +// 3 +MMTFParser_StructuralElementType.HELIX_310, +// 4 +MMTFParser_StructuralElementType.BRIDGE, +// 5 +MMTFParser_StructuralElementType.TURN, +// 6 +MMTFParser_StructuralElementType.COIL // 7 +]; +function getFirstByte(buf) { + const bytes = new Uint8Array(buf, 0, 1); + return bytes[0]; +} +class MMTFParser extends Parser { + constructor(data, options) { + super(data, options); + this._options.fileType = 'mmtf'; + } + static canProbablyParse(data) { + // check if it's binary MessagePack format containing a map (dictionary) + // see https://github.com/msgpack/msgpack/blob/master/spec.md + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isArrayBuffer(data) && (getFirstByte(data) | 1) === 0xDF; + } + _onModel(_modelData) {} + _onChain(chainData) { + if (chainData.modelIndex !== 0) { + return; + } + const chain = new MMTFParser_Chain(this._complex, chainData.chainName); + this._complex._chains[chainData.chainIndex] = chain; + chain._index = chainData.chainIndex; + } + _onGroup(groupData) { + if (groupData.modelIndex !== 0) { + return; + } + if (this.settings.now.nowater) { + // skip water + if (groupData.groupName === 'HOH' || groupData.groupName === 'WAT') { return; } - - var mesh = volumeVisual.getMesh(); - mesh.rebuild(gfx.camera); // use main camera to prepare special textures to be used by volumetric rendering - // these textures have the size of the window and are stored in offscreen buffers - - gfx.renderer.setClearColor('black', 0); - gfx.renderer.setRenderTarget(tmpBuf1); - gfx.renderer.clear(); - gfx.renderer.setRenderTarget(tmpBuf2); - gfx.renderer.clear(); - gfx.renderer.setRenderTarget(tmpBuf3); - gfx.renderer.clear(); - gfx.renderer.setRenderTarget(tmpBuf1); // draw plane with its own material, because it differs slightly from volumeBFMat - - camera.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE); - gfx.renderer.render(gfx.scene, camera); - camera.layers.set(gfxutils.LAYERS.VOLUME); - gfx.scene.overrideMaterial = volumeBFMat; - gfx.renderer.render(gfx.scene, camera); - gfx.renderer.setRenderTarget(tmpBuf2); - camera.layers.set(gfxutils.LAYERS.VOLUME); - gfx.scene.overrideMaterial = volumeFFMat; - gfx.renderer.render(gfx.scene, camera); - gfx.scene.overrideMaterial = null; - camera.layers.set(gfxutils.LAYERS.DEFAULT); // prepare texture that contains molecule positions - - world2colorMat.getInverse(mesh.matrixWorld); - UberMaterial.prototype.uberOptions.world2colorMatrix.multiplyMatrices(cubeOffsetMat, world2colorMat); - camera.layers.set(gfxutils.LAYERS.COLOR_FROM_POSITION); - gfx.renderer.setRenderTarget(tmpBuf3); - gfx.renderer.render(gfx.scene, camera); // render volume - - var vm = mesh.material; - vm.uniforms._BFRight.value = tmpBuf1.texture; - vm.uniforms._FFRight.value = tmpBuf2.texture; - vm.uniforms._WFFRight.value = tmpBuf3.texture; - camera.layers.set(gfxutils.LAYERS.VOLUME); - gfx.renderer.setRenderTarget(dstBuf); - gfx.renderer.render(gfx.scene, camera); - camera.layers.set(gfxutils.LAYERS.DEFAULT); - }; - }(); - /* Render scene with 'ZPrepass transparency Effect' - * Idea: transparent objects are rendered in two passes. The first one writes result only into depth buffer. - * The second pass reads depth buffer and writes only to color buffer. The method results in - * correct image of front part of the semi-transparent objects, but we can see only front transparent objects - * and opaque objects inside, there is no transparent objects inside. - * Notes: 1. Opaque objects should be rendered strictly before semi-transparent ones. - * 2. Realization doesn't use camera layers because scene traversing is used for material changes and - * we can use it to select needed meshes and don't complicate meshes builders with layers - */ - - - Miew.prototype._renderWithPrepassTransparency = function () { - return function (camera, targetBuffer) { - var gfx = this._gfx; - gfx.renderer.setRenderTarget(targetBuffer); // opaque objects - - camera.layers.set(gfxutils.LAYERS.DEFAULT); - gfx.renderer.render(gfx.scene, camera); // transparent objects z prepass - - camera.layers.set(gfxutils.LAYERS.PREPASS_TRANSPARENT); - gfx.renderer.getContext().colorMask(false, false, false, false); // don't update color buffer - - gfx.renderer.render(gfx.scene, camera); - gfx.renderer.getContext().colorMask(true, true, true, true); // update color buffer - // transparent objects color pass - - camera.layers.set(gfxutils.LAYERS.TRANSPARENT); - gfx.renderer.render(gfx.scene, camera); // restore default layer - - camera.layers.set(gfxutils.LAYERS.DEFAULT); - }; - }(); - - Miew.prototype._performFXAA = function () { - var _fxaaMaterial = new FXAAMaterial(); - - return function (srcBuffer, targetBuffer) { - if (typeof srcBuffer === 'undefined' || typeof targetBuffer === 'undefined') { - return; + } + const chain = this._complex._chains[groupData.chainIndex]; + const icode = !groupData.insCode.charCodeAt(0) ? '' : groupData.insCode; + const residue = chain.addResidue(groupData.groupName, groupData.groupId, icode); + residue._index = groupData.groupIndex; + this._updateSecStructure(this._complex, residue, groupData); + } + _onAtom(atomData) { + if (atomData.modelIndex !== 0) { + return; + } + const altLoc = !atomData.altLoc.charCodeAt(0) ? '' : atomData.altLoc; + const atom = new MMTFParser_Atom(atomData.groupIndex, + // we store residue index here to replace it later with actual reference + atomData.atomName, MMTFParser_Element.getByName(atomData.element.toUpperCase()), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(atomData.xCoord, atomData.yCoord, atomData.zCoord), MMTFParser_Element.Role[atomData.atomName], false, + // hetero atoms will be marked later + atomData.atomId, altLoc, atomData.occupancy, atomData.bFactor, atomData.formalCharge); + this._complex._atoms[atomData.atomIndex] = atom; + atom.index = atomData.atomIndex; + this._serialAtomMap[atomData.atomId] = atom; + } + _onBond(bondData) { + const right = Math.max(bondData.atomIndex1, bondData.atomIndex2); + if (right >= this._complex._atoms.length) { + return; + } + const left = Math.min(bondData.atomIndex1, bondData.atomIndex2); + this._complex.addBond(this._complex._atoms[left], this._complex._atoms[right], bondData.bondOrder, MMTFParser_Bond.BondType.UNKNOWN, true); + } + _updateSecStructure(complex, residue, groupData) { + const helixClasses = [3, -1, 1, -1, 5]; + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(groupData) && groupData.secStruct === this._ssType) { + residue._secondary = this._ssStruct; + if (this._ssStruct) { + this._ssStruct.term = residue; } - - var gfx = this._gfx; // clear canvas - - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - gfx.renderer.setRenderTarget(targetBuffer); - gfx.renderer.clear(); // do fxaa processing of offscreen buff2 - - _fxaaMaterial.uniforms.srcTex.value = srcBuffer.texture; - - _fxaaMaterial.uniforms.srcTexelSize.value.set(1.0 / srcBuffer.width, 1.0 / srcBuffer.height); - - _fxaaMaterial.uniforms.bgColor.value.set(settings.now.bg.color); - - if (_fxaaMaterial.bgTransparent !== settings.now.bg.transparent) { - _fxaaMaterial.setValues({ - bgTransparent: settings.now.bg.transparent - }); - - _fxaaMaterial.needsUpdate = true; + return; + } + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(groupData)) { + // start new secondary structure + const type = secStructToType[groupData.secStruct]; + this._ssType = groupData.secStruct; + this._ssStart = residue; + let struct = null; + switch (this._ssType) { + case -1: // undefined + case 7: + // coil + break; + case 0: // pi helix + case 2: // alpha helix + case 4: + // 3-10 helix + struct = new MMTFParser_Helix(helixClasses[this._ssType], residue, residue, 0, '', '', 0); + complex._helices.push(struct); + break; + case 3: + { + // extended + const sheet = new MMTFParser_Sheet('', 0); + complex._sheets.push(sheet); + struct = new MMTFParser_Strand(sheet, residue, residue, 0, null, null); + break; + } + default: + if (type !== undefined) { + struct = new chem_StructuralElement(type, residue, residue); + } + break; + } + this._ssStruct = struct; + residue._secondary = struct; + if (struct) { + complex.structures.push(struct); + } + } + } + _updateMolecules(mmtfData) { + const entities = mmtfData.entityList; + if (!entities) { + return; + } + const chainsInModel0 = mmtfData.chainsPerModel[0]; + for (let i = 0; i < entities.length; i++) { + const entity = entities[i]; + const chains = entity.chainIndexList; + let residues = []; + for (let j = 0; j < chains.length; j++) { + const chainIndex = chains[j]; + // skip chains in models other than the first one + if (chainIndex >= chainsInModel0) { + continue; + } + const chain = this._complex._chains[chainIndex]; + residues = residues.concat(chain._residues.slice()); } + const molecule = new MMTFParser_Molecule(this._complex, entity.description, i + 1); + molecule.residues = residues; + this._complex._molecules[i] = molecule; + } + } - gfx.renderer.renderScreenQuad(_fxaaMaterial); + // populate complex with chains, residues and atoms + _traverse(mmtfData) { + const self = this; + + // get metadata + const { + metadata + } = this._complex; + metadata.id = mmtfData.structureId; + metadata.title = []; + metadata.title[0] = mmtfData.title; + metadata.date = mmtfData.releaseDate; + metadata.format = 'mmtf'; + + // create event callback functions + const eventCallbacks = { + onModel(modelData) { + self._onModel(modelData); + }, + onChain(chainData) { + self._onChain(chainData); + }, + onGroup(groupData) { + self._onGroup(groupData); + }, + onAtom(atomData) { + self._onAtom(atomData); + }, + onBond(bondData) { + self._onBond(bondData); + } }; - }(); - - Miew.prototype._performAO = function () { - var _aoMaterial = new AOMaterial(); - var _horBlurMaterial = new AOHorBlurMaterial(); + // temporary variables used during traversal to track secondary structures + this._ssType = -1; + this._ssStruct = null; + this._ssStart = null; - var _vertBlurMaterial = new AOVertBlurWithBlendMaterial(); - - var _scale = new THREE.Vector3(); + // traverse the structure and listen to the events + mmtf_default().traverse(mmtfData, eventCallbacks); + this._updateSecStructure(this._complex); + this._updateMolecules(mmtfData); + } - return function (srcColorBuffer, normalBuffer, srcDepthTexture, targetBuffer, tempBuffer, tempBuffer1) { - if (!srcColorBuffer || !normalBuffer || !srcDepthTexture || !targetBuffer || !tempBuffer || !tempBuffer1) { - return; + // During traversal atoms and residues don't come sequentially + // so a residue for certain atom can be unavailable. Thus we + // store residue index in atom. + // This function being called after traversal replaces the index + // with actual reference, and also populates atom lists in residues. + _linkAtomsToResidues() { + for (let i = 0; i < this._complex._atoms.length; ++i) { + const atom = this._complex._atoms[i]; + const residue = this._complex._residues[atom.residue]; + atom.residue = residue; + residue._atoms.push(atom); + } + } + _findSynonymousChains() { + const named = {}; + for (let i = 0; i < this._complex._chains.length; ++i) { + const chain = this._complex._chains[i]; + const name = chain.getName(); + if (!named.hasOwnProperty(name)) { + named[name] = []; } + named[name].push(chain._index); + } + return named; + } - var gfx = this._gfx; - var tanHalfFOV = Math.tan(THREE.Math.DEG2RAD * 0.5 * gfx.camera.fov); - _aoMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture; - _aoMaterial.uniforms.depthTexture.value = srcDepthTexture; - _aoMaterial.uniforms.normalTexture.value = normalBuffer.texture; - - _aoMaterial.uniforms.srcTexelSize.value.set(1.0 / srcColorBuffer.width, 1.0 / srcColorBuffer.height); - - _aoMaterial.uniforms.camNearFar.value.set(gfx.camera.near, gfx.camera.far); - - _aoMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix; - _aoMaterial.uniforms.aspectRatio.value = gfx.camera.aspect; - _aoMaterial.uniforms.tanHalfFOV.value = tanHalfFOV; - gfx.root.matrix.extractScale(_scale); - _aoMaterial.uniforms.kernelRadius.value = settings.now.debug.ssaoKernelRadius * _scale.x; - _aoMaterial.uniforms.depthThreshold.value = 2.0 * this._getBSphereRadius(); // diameter - - _aoMaterial.uniforms.factor.value = settings.now.debug.ssaoFactor; // N: should be tempBuffer1 for proper use of buffers (see buffers using outside the function) - - gfx.renderer.setRenderTarget(tempBuffer1); - gfx.renderer.renderScreenQuad(_aoMaterial); - _horBlurMaterial.uniforms.aoMap.value = tempBuffer1.texture; - - _horBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer1.width, 1.0 / tempBuffer1.height); - - _horBlurMaterial.uniforms.depthTexture.value = srcDepthTexture; - gfx.renderer.setRenderTarget(tempBuffer); - gfx.renderer.renderScreenQuad(_horBlurMaterial); - _vertBlurMaterial.uniforms.aoMap.value = tempBuffer.texture; - _vertBlurMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture; - - _vertBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer.width, 1.0 / tempBuffer.height); - - _vertBlurMaterial.uniforms.depthTexture.value = srcDepthTexture; - _vertBlurMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix; - _vertBlurMaterial.uniforms.aspectRatio.value = gfx.camera.aspect; - _vertBlurMaterial.uniforms.tanHalfFOV.value = tanHalfFOV; - var fog = gfx.scene.fog; - - if (fog) { - _vertBlurMaterial.uniforms.fogNearFar.value.set(fog.near, fog.far); - - _vertBlurMaterial.uniforms.fogColor.value.set(fog.color.r, fog.color.g, fog.color.b, settings.now.fogAlpha); + // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains. + _parseAssemblyInfo(mmtfData) { + let i; + let j; + let k; + const assemblies = []; + const { + logger + } = this; + for (i = 0; i < mmtfData.bioAssemblyList.length; ++i) { + const baInfo = mmtfData.bioAssemblyList[i]; + if (baInfo.transformList.length === 0) { + continue; } + const chains = baInfo.transformList[0].chainIndexList; + const chainListCheck = new ArrayComparator(chains); - if (_vertBlurMaterial.useFog !== settings.now.fog || _vertBlurMaterial.fogTransparent !== settings.now.bg.transparent) { - _vertBlurMaterial.setValues({ - useFog: settings.now.fog, - fogTransparent: settings.now.bg.transparent - }); + // build list of chain names + const chainNames = {}; + for (j = 0; j < chains.length; ++j) { + chainNames[this._complex._chains[chains[j]].getName()] = 1; + } - _vertBlurMaterial.needsUpdate = true; + // all chains with the same name should belong to assembly if one of them belongs + const allChains = []; + let name; + for (name in chainNames) { + if (chainNames.hasOwnProperty(name)) { + // just concat arrays -- there should be no duplicates + Array.prototype.push.apply(allChains, this._chainsByName[name]); + } } + if (!chainListCheck.compare(allChains)) { + // assembly is missing some of the chains + logger.debug('MMTF: Assembly is missing some of the synonymous chains. Skipping...'); + } + const a = new MMTFParser_Assembly(this._complex); - gfx.renderer.setRenderTarget(targetBuffer); - gfx.renderer.renderScreenQuad(_vertBlurMaterial); - }; - }(); - /** - * Reset the viewer, unload molecules. - * @param {boolean=} keepReps - Keep representations while resetting viewer state. - */ + // add chains to assembly + for (name in chainNames) { + if (chainNames.hasOwnProperty(name)) { + a.addChain(name); + } + } + // add unique matrices to assembly + a.addMatrix(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4().fromArray(baInfo.transformList[0].matrix).transpose()); + for (j = 1; j < baInfo.transformList.length; ++j) { + const transform = baInfo.transformList[j]; + if (!chainListCheck.compare(transform.chainIndexList)) { + // list of chains for this transform doesn't match that for other transforms + // this is illegal in our structure + logger.debug('MMTF: Chain lists differ for different transforms in one assembly. Skipping...'); + continue; + } + const m = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4().fromArray(transform.matrix).transpose(); - Miew.prototype.reset = function () - /* keepReps */ - { - if (this._picker) { - this._picker.reset(); + // check if matrix is already in the list + for (k = 0; k < a.matrices.length; ++k) { + if (a.matrices[k].equals(m)) { + break; + } + } + if (k === a.matrices.length) { + a.addMatrix(m); + } + } + a.finalize(); + assemblies.push(a); } + return assemblies; + } - this._lastPick = null; - - this._releaseAllVisuals(); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this._resetObjects(); - - if (this._gfx) { - gfxutils.clearTree(this._gfx.pivot); - - this._gfx.renderer2d.reset(); + // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains. + _markHeteroAtoms(mmtfData) { + const chainsInModel0 = mmtfData.chainsPerModel[0]; + for (let i = 0; i < mmtfData.entityList.length; ++i) { + const entity = mmtfData.entityList[i]; + if (entity.type !== 'polymer') { + for (let j = 0; j < entity.chainIndexList.length; ++j) { + const chainIndex = entity.chainIndexList[j]; + // skip chains in models other than the first one + if (chainIndex >= chainsInModel0) { + continue; + } + const chain = this._complex._chains[chainIndex]; + for (let k = 0; k < chain._residues.length; ++k) { + const res = chain._residues[k]; + for (let m = 0; m < res._atoms.length; ++m) { + res._atoms[m].het = true; + } + } + } + } } + } - this.setNeedRender(); - }; - - Miew.prototype._resetScene = function () { - this._objectControls.reset(); - - this._objectControls.allowTranslation(true); - - this._objectControls.allowAltObjFreeRotation(true); - - this.resetReps(); - this.resetPivot(); - this.rebuildAll(); - }; + // joins chains with the same name into single chain + _joinSynonymousChains() { + let i; + let j; + const primaryChainsArray = []; + const primaryChainsHash = {}; + + // join chains + for (i = 0; i < this._complex._chains.length; ++i) { + const chain = this._complex._chains[i]; + const name = chain.getName(); + if (!primaryChainsHash.hasOwnProperty(name)) { + // new name -- this is a primary chain + primaryChainsHash[name] = chain; + chain._index = primaryChainsArray.length; // update index as this array will later replace original chain list + primaryChainsArray.push(chain); + continue; + } - Miew.prototype.resetView = function () { - // reset controls - if (this._picker) { - this._picker.reset(); + // this chain should be joined with the primary chain of the same name + const primary = primaryChainsHash[name]; + for (j = 0; j < chain._residues.length; ++j) { + const residue = chain._residues[j]; + primary._residues.push(residue); + residue._chain = primary; + } } - this._setEditMode(EDIT_MODE.COMPLEX); - - this._resetScene(); // reset selection - - - this._forEachComplexVisual(function (visual) { - visual.updateSelectionMask({}); - visual.rebuildSelectionGeometry(); + // replace chains list with one containing only primary chains + // dropping references to all chains but primary + this._complex._chains = primaryChainsArray; + } + parseSync() { + const mmtfData = mmtf_default().decode(this._data); + this._complex = new MMTFParser_Complex(); + this._serialAtomMap = {}; // filled during traversal + + this._traverse(mmtfData); + this._linkAtomsToResidues(); + this._markHeteroAtoms(mmtfData); + this._chainsByName = this._findSynonymousChains(); + Array.prototype.push.apply(this._complex.units, this._parseAssemblyInfo(mmtfData)); + this._joinSynonymousChains(); + this._complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap }); - }; - - Miew.prototype._export = function (format) { - var TheExporter = _.head(io.exporters.find({ - format: format - })); - - if (!TheExporter) { - this.logger.error('Could not find suitable exporter for this source'); - return Promise.reject(new Error('Could not find suitable exporter for this source')); - } + return this._complex; + } +} +MMTFParser.formats = ['mmtf']; +MMTFParser.extensions = ['.mmtf']; +MMTFParser.binary = true; +/* harmony default export */ const parsers_MMTFParser = (MMTFParser); +;// CONCATENATED MODULE: ./src/io/parsers/ParsingError.js +class ParsingError extends Error { + constructor(message, line, column) { + super(`data:${line}:${column}: ${message}`); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, ParsingError); + } + this.name = 'ParsingError'; + this.parseLine = line; + this.parseColumn = column; + } +} +/* harmony default export */ const parsers_ParsingError = (ParsingError); +;// CONCATENATED MODULE: ./src/io/parsers/readCIF.js - this.dispatchEvent({ - type: 'exporting' - }); - if (this._visuals[this._curVisualName] instanceof ComplexVisual) { - var dataSource = null; - if (TheExporter.SourceClass === ComplexVisual) { - dataSource = this._visuals[this._curVisualName]; - } else if (TheExporter.SourceClass === Complex) { - dataSource = this._visuals[this._curVisualName]._complex; - } +// Implemented and being tested against: https://www.iucr.org/resources/cif/spec/version1.1/cifsyntax - var exporter = new TheExporter(dataSource, { - miewVersion: Miew.VERSION - }); - return exporter["export"]().then(function (data) { - return data; - }); +function _isWhitespace(ch) { + return ch === 32 || ch === 10 || ch === 13 || ch === 9; +} +function _inlineIndexOf(ch0, str, idx) { + const len = str.length; + let ch = -1; + while (idx < len) { + ch = str.charCodeAt(idx); + if (ch === ch0 || ch === 10) { + break; } - - if (this._visuals[this._curVisualName] instanceof VolumeVisual) { - return Promise.reject(new Error('Sorry, exporter for volume data not implemented yet')); + ++idx; + } + return ch === ch0 ? idx : -1; +} +function readCIF(source) { + let i = 0; + let j = 0; + const n = source.length; + let code = NaN; + let newline = true; + let line = 1; + let column = 1; + let begin; + let state = 0; // 0 - start, 1 - block, 2 - item, 3 - loop, 4 - values, 5 - value + const result = {}; + let block = {}; + let keys = []; + let keysCount = 0; + let key = ''; + let values = []; + let valuesCount = 0; + let value; + function _parseValue() { + let val; + if ((code === 46 || code === 63) && (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))) { + // '.' or '?' ..... + // it's a missing value + ++column; + ++i; + return undefined; } - - return Promise.reject(new Error('Unexpected format of data')); - }; - - var rePdbId = /^(?:(pdb|cif|mmtf|ccp4|dsn6):\s*)?(\d[a-z\d]{3})$/i; - var rePubchem = /^(?:pc|pubchem):\s*([a-z]+)$/i; - var reUrlScheme = /^([a-z][a-z\d\-+.]*):/i; - - function resolveSourceShortcut(source, opts) { - if (!_.isString(source)) { - return source; - } // e.g. "mmtf:1CRN" - - - var matchesPdbId = rePdbId.exec(source); - - if (matchesPdbId) { - var _matchesPdbId = slicedToArray(matchesPdbId, 3), - _matchesPdbId$ = _matchesPdbId[1], - format = _matchesPdbId$ === void 0 ? 'pdb' : _matchesPdbId$, - id = _matchesPdbId[2]; - - format = format.toLowerCase(); - id = id.toUpperCase(); - - switch (format) { - case 'pdb': - source = "https://files.rcsb.org/download/".concat(id, ".pdb"); - break; - - case 'cif': - source = "https://files.rcsb.org/download/".concat(id, ".cif"); + if (newline && code === 59) { + // ';' ...................................................................... + // parse multi-line string + j = i; + let lines = 0; + do { + j = _inlineIndexOf(10, source, j + 1); // '\n' + if (j === -1) { + throw new parsers_ParsingError('Unterminated text block found', line, column); + } + ++lines; + } while (j + 1 < n && source.charCodeAt(j + 1) !== code || j + 1 >= n); + val = source.substring(i + 1, j).replace(/\r/g, ''); + i = j + 2; + line += lines; + column = 1; + newline = false; + return val; + } + if (code === 39 || code === 34) { + // ''' or '"' ........................................................... + // parse quoted string + j = i; + do { + j = _inlineIndexOf(code, source, j + 1); + if (j === -1) { + throw new parsers_ParsingError('Unterminated quoted string found', line, column); + } + } while (j + 1 < n && !_isWhitespace(source.charCodeAt(j + 1))); + val = source.substring(i + 1, j); + column += j - i + 1; + i = j + 1; + return val; + } // ...................................................................................................... + // parse until the first whitespace + j = i; + while (j < n && !_isWhitespace(source.charCodeAt(j))) { + ++j; + } + val = source.substring(i, j); + column += j - i; + i = j; + // try to convert to a number + const num = Number(val); + if (!Number.isNaN(num)) { + return num; + } + // or leave as an unquoted string + return val; + } + function _storeKey(tag) { + keys[keysCount++] = tag; + } + function _storeValue(val) { + const keyIndex = valuesCount % keysCount; + values[keyIndex].push(val); + ++valuesCount; + return val; + } + while (i <= n) { + code = source.charCodeAt(i); // 'NaN' in place of '' + if (code === 13) {// '\r' ....................................................................................... + // just ignore + } else if (code === 10) { + // '\n' ................................................................................ + // take note of new lines + newline = true; + ++line; + column = 1; + } else { + // process inline characters + if (code === 32 || code === 9) {// ' ' or '\t' ................................................................ + // just ignore + } else if (code === 35) { + // '#' ............................................................................... + // skip the comment until before the end of the line + i = _inlineIndexOf(10, source, i + 1); // '\n' + if (i === -1) { break; - - case 'mmtf': - source = "https://mmtf.rcsb.org/v1.0/full/".concat(id); + } else { + continue; // don't forget to process the new line + } + } else if (state === 0) { + // start ============================================================================= + if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { + // 'data_' .......... + j = i + 5; + begin = j; + while (j < n && !_isWhitespace(source.charCodeAt(j))) { + ++j; + } + column += j - i; + i = j; + if (begin < i) { + // add new data block + result[source.substring(begin, i)] = block = {}; + state = 1; // block + continue; // don't forget to process the whitespace + } else { + throw new parsers_ParsingError('Data block name missing', line, column); + } + } else if (Number.isNaN(code)) { + // .................................................................... break; - - case 'ccp4': - source = "https://www.ebi.ac.uk/pdbe/coordinates/files/".concat(id.toLowerCase(), ".ccp4"); + } else { + // .................................................................................................. + throw new parsers_ParsingError(`Unexpected character in state ${state}`, line, column); + } + } else if (state === 1) { + // block ============================================================================= + if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { + // 'data_' .......... + state = 0; // start + continue; // parse again in a different state + } else if (code === 95) { + // '_' ............................................................................. + j = i + 1; + begin = j; + while (j < n && !_isWhitespace(source.charCodeAt(j))) { + ++j; + } + column += j - i; + i = j; + if (begin < i) { + // start new item + key = source.substring(begin, i); + state = 2; // item + continue; // don't forget to process the whitespace + } else { + throw new parsers_ParsingError('Tag name missing', line, column); + } + } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { + // 'loop_' ... + i += 5; + column += 5; + if (i < n && !_isWhitespace(source.charCodeAt(i))) { + throw new parsers_ParsingError(`Unexpected character in state ${state}`, line, column); + } else { + // start new loop + keys = []; + keysCount = 0; + values = []; + valuesCount = 0; + state = 3; // loop + continue; // don't forget to process the whitespace + } + } else if (Number.isNaN(code)) { + // .................................................................... break; - - case 'dsn6': - source = "https://edmaps.rcsb.org/maps/".concat(id.toLowerCase(), "_2fofc.dsn6"); + } else { + // .................................................................................................. + throw new parsers_ParsingError(`Unexpected character in state ${state}`, line, column); + } + } else if (state === 2) { + // item ============================================================================== + if (Number.isNaN(code)) { break; - - default: - throw new Error('Unexpected data format shortcut'); + } + value = _parseValue(); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().set(block, key, value); + state = 1; // block + continue; + } else if (state === 3) { + // loop ============================================================================== + if (code === 95) { + // '_' .................................................................................... + j = i + 1; + begin = j; + while (j < n && !_isWhitespace(source.charCodeAt(j))) { + ++j; + } + column += j - i; + i = j; + if (begin < i) { + // add new key + _storeKey(source.substring(begin, i)); + continue; // don't forget to process the whitespace + } else { + throw new parsers_ParsingError('Tag name missing', line, column); + } + } else { + // .................................................................................................. + if (keysCount > 0) { + for (let keyIndex = 0; keyIndex < keysCount; ++keyIndex) { + value = []; + values[keyIndex] = value; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().set(block, keys[keyIndex], value); + } + state = 4; + continue; // parse again in a different state + } + throw new parsers_ParsingError('Data tags are missing inside a loop', line, column); + } + } else if (state === 4) { + // values ============================================================================ + if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { + // 'data_' .......... + state = 0; // start + } else if (code === 95) { + // '_' ............................................................................. + state = 1; // block + } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { + // 'loop_' ... + state = 1; // block + } else if (Number.isNaN(code)) { + // .................................................................... + state = 0; + } else { + // .................................................................................................. + _storeValue(_parseValue()); + } + continue; // parse again in a different state + } else { + // ==================================================================================================== + throw new parsers_ParsingError(`Unexpected internal state ${state}`, line, column); } + newline = false; + ++column; + } + ++i; + } + if (state === 2) { + // item + throw new parsers_ParsingError(`Unexpected end of file in state ${state}`, line, column); + } + return result; +} +;// CONCATENATED MODULE: ./src/io/parsers/CIFParser.js - opts.fileType = format; - opts.fileName = "".concat(id, ".").concat(format); - opts.sourceType = 'url'; - return source; - } // e.g. "pc:aspirin" - var matchesPubchem = rePubchem.exec(source); - if (matchesPubchem) { - var compound = matchesPubchem[1].toLowerCase(); - source = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/".concat(compound, "/JSON?record_type=3d"); - opts.fileType = 'pubchem'; - opts.fileName = "".concat(compound, ".json"); - opts.sourceType = 'url'; - return source; - } // otherwise is should be an URL - if (opts.sourceType === 'url' || opts.sourceType === undefined) { - opts.sourceType = 'url'; // e.g. "./data/1CRN.pdb" +const { + Complex: CIFParser_Complex, + Element: CIFParser_Element, + Helix: CIFParser_Helix, + Sheet: CIFParser_Sheet, + Strand: CIFParser_Strand, + Assembly: CIFParser_Assembly, + Molecule: CIFParser_Molecule +} = chem; +const cRequiredAtomFields = ['auth_seq_id', 'Cartn_x', 'Cartn_y', 'Cartn_z', 'label_atom_id']; +const cSecondaryCoding = { + helx: 'helix', + turn: 'turn', + strn: 'strand' +}; +function getTypeFromId(string) { + const typeId = /[A-Za-z]+/.exec(string); + if (!typeId) { + return null; + } + return cSecondaryCoding[typeId[0].toLowerCase()]; +} + +/** + * Make valid object an array + * @param arrayLikeObject + * @return {array, object} array or object + */ +function arrize(arrayLikeObject) { + if (arrayLikeObject === null || arrayLikeObject === undefined || external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isArray(arrayLikeObject)) { + return arrayLikeObject; + } + return [arrayLikeObject]; +} +function CIFParser_nameToElement(name) { + // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM + // + // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1 + // + // Atom names start with element symbols right-justified in columns 13-14 + // as permitted by the length of the name. For example, the symbol FE for + // iron appears in columns 13-14, whereas the symbol C for carbon appears + // in column 14 (see Misaligned Atom Names). If an atom name has four + // characters, however, it must start in column 13 even if the element + // symbol is a single character (for example, see Hydrogen Atoms). + + const veryLong = name.trim().length === 4; + return name.slice(0, veryLong ? 1 : 2).trim(); +} +class AtomDataError extends Error { + constructor(message) { + super(); + this.name = 'AtomDataError'; + this.message = message; + } +} +function _getOperations(operList) { + if (!operList) { + return null; + } + const idc = arrize(operList.id); + const { + matrix, + vector + } = operList; + if (!idc || !matrix || !vector) { + return null; + } + const ops = []; + for (let i = 0, n = idc.length; i < n; ++i) { + const mtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + const { + elements + } = mtx; + for (let row = 0; row < 3; ++row) { + const matrixData = matrix[row + 1]; + elements[row] = arrize(matrixData[1])[i]; + elements[row + 4] = arrize(matrixData[2])[i]; + elements[row + 8] = arrize(matrixData[3])[i]; + elements[row + 12] = arrize(vector[row + 1])[i]; + } + ops[idc[i]] = mtx; + } + return ops; +} +function _extractOperations(assemblyGen, opsDict) { + assemblyGen = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(assemblyGen) ? assemblyGen : `${assemblyGen}`; + const l = assemblyGen.replace(/\)\s*\(/g, '!').replace(/[()']/g, ''); + const groupStr = l.split('!'); + const gps = []; + for (let grIdx = 0, grCount = groupStr.length; grIdx < grCount; ++grIdx) { + const gr = groupStr[grIdx].split(','); + const gp = []; + let idx = 0; + for (let i = 0, n = gr.length; i < n; ++i) { + const s = gr[i]; + if (s.includes('-')) { + const es = s.split('-'); + let j = parseInt(es[0], 10); + const m = parseInt(es[1], 10); + for (; j <= m; ++j) { + gp[idx++] = opsDict[j]; + } + } else { + gp[idx++] = opsDict[s]; + } + } + gps.push(gp); + } - if (!reUrlScheme.test(source)) { - source = utils.resolveURL(source); + // traverse all groups from the end of array and make all mults + const matrices = []; + let cnt = 0; + function traverse(level, mtx) { + for (let ii = 0, nn = gps[level].length; ii < nn; ++ii) { + const newMtx = mtx ? mtx.clone() : new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + newMtx.multiplyMatrices(gps[level][ii], newMtx); + if (level === 0) { + matrices[cnt++] = newMtx; + } else { + traverse(level - 1, newMtx); } } + } + traverse(gps.length - 1); + return matrices; +} +class CIFParser extends Parser { + constructor(data, options) { + super(data, options); + this.asymDict = {}; + this.molecules = []; + this._options.fileType = 'cif'; + } + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(data) && /^\s*data_/i.test(data); + } + parseSync() { + this.logger.info('Parsing CIF file..'); + const data = readCIF(this._data); + return this._toComplex(data); + } - return source; + /** + * Convert intermediate structure into our valid Complex object + * @param cifData intermediate CIF object + * @returns {Complex} complex + * @private + */ + _toComplex(cifData) { + const complex = new CIFParser_Complex(); + const complexData = cifData[Object.keys(cifData)[0]]; + this._extractAtoms(complex, complexData); + this._extractSecondary(complex, complexData); + this._extractAssemblies(complex, complexData); + this._extractMolecules(complex, complexData); + this._extractMetadata(complex, complexData); + complex.finalize({ + needAutoBonding: true, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing + }); + return complex; } - function updateBinaryMode(opts) { - var binary = opts.binary; // detect by format + /** + * Extract metadata + * @param complex structure to fill + * @param complexData complex data from CIF file + * @private + */ - if (opts.fileType !== undefined) { - var TheParser = _.head(io.parsers.find({ - format: opts.fileType - })); + _extractMetadata(complex, complexData) { + const { + metadata + } = complex; + metadata.id = complexData.entry.id; + metadata.classification = complexData.struct_keywords.pdbx_keywords; + const databaserev = complexData.database_PDB_rev; + metadata.date = databaserev && databaserev.date_original ? databaserev.date_original : ''; + metadata.format = 'cif'; + metadata.title = []; + metadata.title[0] = complexData.struct.title; + } - if (TheParser) { - binary = TheParser.binary || false; + /** + * Extract molecules information from CIF structure (should be called strictly after _extractAtoms) + * @param complexData complex data from CIF file + * @private + */ + _extractMolecules(complex, complexData) { + const molData = complexData.entity; + const names = arrize(molData.pdbx_description); + const count = names.length; + let i; + + // molecules names from cif + for (i = 0; i < count; i++) { + if (this.molecules[i]) { + // molecule was created during atoms processing + this.molecules[i].name = names[i]; } else { - throw new Error('Could not find suitable parser for this format'); + // molecule wasn't created, because there is no atom which is contained + this.molecules[i] = { + name: names[i], + residues: [] + }; } - } // detect by file extension - + } - if (binary === undefined && opts.fileExt !== undefined) { - var _TheParser = _.head(io.parsers.find({ - ext: opts.fileExt - })); + // reorganize molecules for complex and check chains + const molecules = complex.getMolecules(); + for (i = 0; i < count; i++) { + const molecule = this.molecules[i]; + molecules[i] = new CIFParser_Molecule(complex, molecule.name, i + 1); + molecules[i].residues = molecule.residues; + } + } - if (_TheParser) { - binary = _TheParser.binary || false; + /** + * Extract atom information from CIF structure and fill complex + * @param {Complex} complex + * @param complexData complex data from CIF file + * @private + */ + _extractAtoms(complex, complexData) { + const atomData = complexData.atom_site; + if (!atomData) { + throw new AtomDataError('CIF parsing error: atom_site is not specified!'); + } + for (let f = 0, n = cRequiredAtomFields.length; f < n; ++f) { + if (!atomData[cRequiredAtomFields[f]]) { + throw new AtomDataError(`CIF parsing error: requires field ${cRequiredAtomFields[f]} not found!`); + } + } + const { + asymDict + } = this; + // required fields + const resIdc = arrize(atomData.auth_seq_id); + const x = arrize(atomData.Cartn_x); + const y = arrize(atomData.Cartn_y); + const z = arrize(atomData.Cartn_z); + const names = arrize(atomData.label_atom_id); + const count = names.length; + // optional fields + const group = arrize(atomData.group_PDB) || []; + const chainIdc = arrize(atomData.auth_asym_id) || []; + const chainLabelIdc = arrize(atomData.label_asym_id) || []; + const serials = arrize(atomData.id) || []; + const iCodes = arrize(atomData.pdbx_PDB_ins_code) || []; + const resNames = arrize(atomData.label_comp_id) || []; + const elements = arrize(atomData.type_symbol) || []; + const tempFactors = arrize(atomData.B_iso_or_equiv) || []; + const occupancies = arrize(atomData.occupancy) || []; + const charges = arrize(atomData.pdbx_formal_charge) || []; + const altLocs = arrize(atomData.label_alt_id) || []; + const models = arrize(atomData.pdbx_PDB_model_num) || []; + const molecules = arrize(atomData.label_entity_id) || []; + let chain = null; + let residue = null; + for (let i = 0; i < count; ++i) { + const model = models[i] || 1; + if (model !== 1) { + continue; } - } // temporary workaround for animation - - - if (opts.fileExt !== undefined && opts.fileExt.toLowerCase() === '.man') { - opts.binary = true; - opts.animation = true; // who cares? - } // update if detected + const chainID = String(chainIdc[i] || ' '); + if (!chain || chain.getName() !== chainID) { + chain = complex.getChain(chainID) || complex.addChain(chainID); + } + asymDict[String(chainLabelIdc[i] || ' ')] = chainID; + const resSeq = resIdc[i]; + const iCode = String(iCodes[i] || ' '); + const resName = String(resNames[i] || ''); + if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { + residue = chain.addResidue(resName, resSeq, iCode); + + // store residue in appropriate molecule + const moleculeIdx = molecules[i] - 1; + let entity = this.molecules[moleculeIdx]; + if (!entity) { + // create new molecule if it hasn't been created + this.molecules[moleculeIdx] = { + name: '', + residues: [] + }; + entity = this.molecules[moleculeIdx]; + } + entity.residues.push(residue); + } + const name = names[i]; + const element = elements[i] || CIFParser_nameToElement(name); + const type = CIFParser_Element.getByName(element); + const role = CIFParser_Element.Role[name.trim()]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(x[i], y[i], z[i]); + const het = group[i] === 'HETATM' || false; + const serial = serials[i] || i; + const tempFactor = tempFactors[i] || 0.0; + const occupancy = occupancies[i] || 0.0; + const altLoc = String(altLocs[i] || ''); + const charge = charges[i] || 0; + residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); + } + } + /** + * Extracts secondary structure information from CIF intermediate data + * and adds it into complex + * @param {Complex} complex - complex to fill + * @param complexData - CIF complex data + * @private + */ + _extractSecondary(complex, complexData) { + if (complexData.struct_conf) { + this._extractConfs(complex, complexData.struct_conf); + } + if (complexData.struct_sheet_range) { + this._extractSheets(complex, complexData.struct_sheet_range); + } + } - if (binary !== undefined) { - if (opts.binary !== undefined && opts.binary !== binary) { - opts.context.logger.warn('Overriding incorrect binary mode'); + /** + * Extracts sheets information from CIF intermediate data + * and adds it into complex + * @param {Complex} complex + * @param sheetData + * @private + */ + _extractSheets(complex, sheetData) { + const { + asymDict + } = this; + if (!sheetData.sheet_id || !sheetData.id || !sheetData.beg_label_seq_id || !sheetData.end_label_seq_id || !sheetData.beg_label_asym_id) { + return; + } + // Strand(sheet, start, end, sense, cur, prev) + const sheets = complex._sheets; + function getSheet(name) { + const n = sheets.length; + for (let i = 0; i < n; ++i) { + if (sheets[i]._name === name) { + return sheets[i]; + } + } + sheets[n] = new CIFParser_Sheet(name, 0); + return sheets[n]; + } + const sheetNames = arrize(sheetData.sheet_id); + const strandNames = arrize(sheetData.id); + const starts = arrize(sheetData.beg_auth_seq_id); + const ends = arrize(sheetData.end_auth_seq_id); + const chains = arrize(sheetData.beg_label_asym_id); + const stICodes = arrize(sheetData.pdbx_beg_PDB_ins_code) || []; + const endICodes = arrize(sheetData.pdbx_end_PDB_ins_code) || []; + for (let i = 0, n = strandNames.length; i < n; ++i) { + const chain = complex.getChain(asymDict[chains[i]]); + const sheet = getSheet(sheetNames[i]); + const startIdx = starts[i]; + const endIdx = ends[i]; + const startICode = stICodes[i] || ' '; + const endICode = endICodes[i] || ' '; + const start = chain.findResidue(startIdx, startICode); + const end = chain.findResidue(endIdx, endICode); + + // TODO think about last condition + if (!start || !end) { + continue; } + const strand = new CIFParser_Strand(sheet, start[0], end[0], 0, null, null); + const residues = chain.getResidues(); + for (let r = start[1]; r <= end[1]; ++r) { + residues[r]._secondary = strand; + } + sheet.addStrand(strand); + complex.structures.push(strand); } - - opts.binary = binary || false; } - function _fetchData(source, opts, job) { - return new Promise(function (resolve) { - if (job.shouldCancel()) { - throw new Error('Operation cancelled'); + /** + * Extracts helix/turn/strand(?) information from CIF intermediate data + * and adds it into complex + * @param {Complex} complex + * @param helicesData + * @private + */ + _extractConfs(complex, helicesData) { + const { + asymDict + } = this; + if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id || !helicesData.beg_label_asym_id) { + return; + } + const types = arrize(helicesData.conf_type_id); + const starts = arrize(helicesData.beg_auth_seq_id); + const stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || []; + const ends = arrize(helicesData.end_auth_seq_id); + const endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || []; + const comments = arrize(helicesData.details) || []; + const lengths = arrize(helicesData.pdbx_PDB_helix_length) || []; + const helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || []; + const names = arrize(helicesData.id) || []; + const chains = arrize(helicesData.beg_label_asym_id); + for (let i = 0, n = types.length; i < n; ++i) { + const type = getTypeFromId(types[i]); + if (!type) { + continue; } + const name = names[i] || types[i]; + const chain = complex.getChain(asymDict[chains[i]]); + const startIdx = starts[i]; + const endIdx = ends[i]; + const startICode = stICodes[i] || ' '; + const endICode = endICodes[i] || ' '; + const start = chain.findResidue(startIdx, startICode); + const end = chain.findResidue(endIdx, endICode); + + // TODO think about last condition + if (!start || !end) { + continue; + } + const comment = comments[i] || ''; + const length = lengths[i] || 0; + const helixClass = helixClasses[i] || ' '; + let struct; + if (type === 'helix') { + const idx = complex._helices.length; + struct = new CIFParser_Helix(helixClass, start[0], end[0], idx, name, comment, length); + complex.addHelix(struct); + complex.structures.push(struct); + } else if (type === 'turn') { + struct = new chem_StructuralElement(chem_StructuralElement.Type.TURN, start[0], end[0]); + complex.structures.push(struct); + } else { + struct = null; + } + if (!struct) { + continue; + } + const residues = chain.getResidues(); + for (let r = start[1]; r <= end[1]; ++r) { + residues[r]._secondary = struct; + } + } + } - job.notify({ - type: 'fetching' - }); // allow for source shortcuts - - source = resolveSourceShortcut(source, opts); // detect a proper loader - - var TheLoader = _.head(io.loaders.find({ - type: opts.sourceType, - source: source - })); - - if (!TheLoader) { - throw new Error(LOADER_NOT_FOUND); - } // split file name - - - var fileName = opts.fileName || TheLoader.extractName(source); - - if (fileName) { - var _utils$splitFileName = utils.splitFileName(fileName), - _utils$splitFileName2 = slicedToArray(_utils$splitFileName, 2), - name = _utils$splitFileName2[0], - fileExt = _utils$splitFileName2[1]; - - _.defaults(opts, { - name: name, - fileExt: fileExt, - fileName: fileName - }); - } // should it be text or binary? - - - updateBinaryMode(opts); // FIXME: All new settings retrieved from server are applied after the loading is complete. However, we need some - // flags to alter the loading process itself. Here we apply them in advance. Dirty hack. Kill the server, remove - // all hacks and everybody's happy. - - var newOptions = _.get(opts, 'preset.expression'); - - if (!_.isUndefined(newOptions)) { - newOptions = JSON.parse(newOptions); - - if (newOptions && newOptions.settings) { - var keys = ['singleUnit']; - - for (var keyIndex = 0, keyCount = keys.length; keyIndex < keyCount; ++keyIndex) { - var key = keys[keyIndex]; - - var value = _.get(newOptions.settings, key); - - if (!_.isUndefined(value)) { - settings.set(key, value); - } - } - } - } // create a loader - - - var loader = new TheLoader(source, opts); - loader.context = opts.context; - job.addEventListener('cancel', function () { - return loader.abort(); - }); - loader.addEventListener('progress', function (event) { - if (event.lengthComputable && event.total > 0) { - reportProgress(loader.logger, 'Fetching', event.loaded / event.total); - } else { - reportProgress(loader.logger, 'Fetching'); + /** + * Extract biological assemblies information from CIF structure and fill complex + * @param {Complex} complex + * @param complexData complex data from CIF file + * @private + */ + _extractAssemblies(complex, complexData) { + const { + asymDict + } = this; + const asmGen = complexData.pdbx_struct_assembly_gen; + if (!asmGen) { + return; + } + const asmIdx = arrize(asmGen.assembly_id); + const asmOper = arrize(asmGen.oper_expression); + const asmList = arrize(asmGen.asym_id_list); + if (!asmIdx || !asmOper || !asmList) { + return; + } + const operList = _getOperations(complexData.pdbx_struct_oper_list); + if (!operList) { + return; + } + for (let i = 0, n = asmIdx.length; i < n; ++i) { + const asm = new CIFParser_Assembly(complex); + const assemblyOps = _extractOperations(asmOper[i], operList); + const entries = asmList[i].split(','); + for (let ii = 0, nn = entries.length; ii < nn; ++ii) { + const chain = entries[ii].trim(); + if (chain.length > 0) { + asm.addChain(asymDict[chain]); } - }); - console.time('fetch'); - var promise = loader.load().then(function (data) { - console.timeEnd('fetch'); - opts.context.logger.info('Fetching finished'); - job.notify({ - type: 'fetchingDone', - data: data - }); - return data; - })["catch"](function (error) { - console.timeEnd('fetch'); - opts.context.logger.debug(error.message); - - if (error.stack) { - opts.context.logger.debug(error.stack); + } + asm.matrices = assemblyOps; + complex.units.push(asm); + } + } +} +CIFParser.formats = ['cif', 'mmcif']; +CIFParser.extensions = ['.cif', '.mmcif']; +/* harmony default export */ const parsers_CIFParser = (CIFParser); +;// CONCATENATED MODULE: ./src/io/parsers/VolumeModel.js + + + +const valueType = { + singular: 0, + vector: 1, + array: 2, + buffer: 3 +}; +class VolumeModel { + _xyz2crs = []; + _origin = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0))(); + constructor() { + this._header = {}; + this._boxSize = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._boxStart = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._header.delta = {}; + this._header.extent = []; + this._header.nstart = []; + this._header.grid = []; + this._header.crs2xyz = []; + this._header.cellDims = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._header.angles = []; + this._header.origin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0); + this._header.dmin = 0; + this._header.dmean = 0; + this._header.dmax = 0; + } + _typedCheck() { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isTypedArray(this._buff)) { + this._buff = this._buff.buffer; + } else if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isArrayBuffer(this._buff)) { + throw new TypeError('Expected ArrayBuffer or TypedArray'); + } + } + _fillHeader(headerFormat, arrays) { + for (const key in headerFormat) { + if (headerFormat.hasOwnProperty(key)) { + switch (headerFormat[key][0]) { + case valueType.singular: + this._header[key] = arrays[headerFormat[key][1]][headerFormat[key][2]]; + break; + case valueType.array: + this._parseArray(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]); + break; + case valueType.vector: + this._parseVector(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]); + break; + case valueType.buffer: + this._header[key] = new Uint8Array(arrays[headerFormat[key][1]], [headerFormat[key][2]] * 4, [headerFormat[key][3]] * 4); + break; + default: + break; } - - opts.context.logger.error('Fetching failed'); - job.notify({ - type: 'fetchingDone', - error: error - }); - throw error; - }); - resolve(promise); + } + } + } + _parseVector(vector, arr, pos) { + [vector.x, vector.y, vector.z] = [arr[pos], arr[pos + 1], arr[pos + 2]]; + } + _parseArray(vector, arr, pos) { + vector[0] = arr[pos]; + vector[1] = arr[pos + 1]; + vector[2] = arr[pos + 2]; + } + _parseHeader(_buffer) {} + _setAxisIndices() {} + _setOrigins() {} + _getAxis() { + const header = this._header; + const xScale = header.cellDims.x / header.grid[0]; + const yScale = header.cellDims.y / header.grid[1]; + const zScale = header.cellDims.z / header.grid[2]; + const [alpha, beta, gamma] = header.angles; + const z1 = Math.cos(beta); + const z2 = (Math.cos(alpha) - Math.cos(beta) * Math.cos(gamma)) / Math.sin(gamma); + const z3 = Math.sqrt(1.0 - z1 * z1 - z2 * z2); + const xaxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(xScale, 0, 0); + const yaxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(Math.cos(gamma) * yScale, Math.sin(gamma) * yScale, 0); + const zaxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(z1 * zScale, z2 * zScale, z3 * zScale); + return [xaxis, yaxis, zaxis]; + } + _getXYZdim() { + return [this._header.extent[this._xyz2crs[0]], this._header.extent[this._xyz2crs[1]], this._header.extent[this._xyz2crs[2]]]; + } + _getVolumeInfo() { + const volInfo = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().pick(this._header, ['dmean', 'dmin', 'dmax', 'sd', 'delta']); + volInfo.obtuseAngle = this._header.angles.map(angle => Number(angle >= Math.PI / 2)); + return volInfo; + } + _setBoxParams(xaxis, yaxis, zaxis) { + // if axes are not orthogonal, the origins might not match with box coordinates - need to make shift + let shiftX = 0; + let shiftY = 0; + const [alpha, beta, gamma] = this._header.angles; + if (gamma >= Math.PI / 2) { + shiftX += Math.abs(yaxis.x); + } + if (beta >= Math.PI / 2) { + shiftX += Math.abs(zaxis.x); + } + if (alpha >= Math.PI / 2) { + shiftY += Math.abs(zaxis.y); + } + this._boxStart = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(this._origin.x - shiftX, this._origin.y - shiftY, this._origin.z); + this._boxSize = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(Math.abs(xaxis.x) + Math.abs(yaxis.x) + Math.abs(zaxis.x), Math.abs(yaxis.y) + Math.abs(zaxis.y), Math.abs(zaxis.z)); + const delta = (axe, proj) => Math.abs(axe[proj]) / this._boxSize[proj]; + this._header.delta.x = delta(yaxis, 'x'); + this._header.delta.y = delta(zaxis, 'x'); + this._header.delta.z = delta(zaxis, 'y'); + } + _getXYZbox() { + return new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(this._boxStart.clone(), this._boxStart.clone().add(this._boxSize)); + } + _toXYZData() {} + parse(data) { + this._parseHeader(data); + this._setOrigins(); + return new chem_Volume(Float32Array, this._getXYZdim(), this._getXYZbox(), 1, this._toXYZData(), this._getVolumeInfo()); + } +} +/* harmony default export */ const parsers_VolumeModel = (VolumeModel); +;// CONCATENATED MODULE: ./src/io/parsers/CCP4Parser.js + + +const CCP4Header = { + extent: [valueType.array, 'u32', 0], + type: [valueType.singular, 'u32', 3], + nstart: [valueType.array, 'i32', 4], + grid: [valueType.array, 'u32', 7], + cellDims: [valueType.vector, 'f32', 10], + angles: [valueType.array, 'f32', 13], + crs2xyz: [valueType.array, 'i32', 16], + dmin: [valueType.singular, 'f32', 19], + dmax: [valueType.singular, 'f32', 20], + dmean: [valueType.singular, 'f32', 21], + ispg: [valueType.singular, 'u32', 22], + nsymbt: [valueType.singular, 'u32', 23], + lksflg: [valueType.singular, 'u32', 24], + customData: [valueType.buffer, 'buffer', 25, 9], + origin: [valueType.vector, 'f32', 34], + map: [valueType.buffer, 'buffer', 52, 1], + machine: [valueType.singular, 'u32', 53], + sd: [valueType.singular, 'f32', 54], + nlabel: [valueType.singular, 'f32', 55], + label: [valueType.buffer, 'buffer', 56, 200] +}; +class Ccp4Model extends parsers_VolumeModel { + // read header (http://www.ccp4.ac.uk/html/maplib.html) + _parseHeader(_buffer) { + this._buff = _buffer; + this._typedCheck(); + const arrays = {}; + arrays.u32 = new Uint32Array(this._buff, 0, 56); + arrays.i32 = new Int32Array(this._buff, 0, 56); + arrays.f32 = new Float32Array(this._buff, 0, 56); + arrays.buffer = this._buff; + const header = this._header; + this._fillHeader(CCP4Header, arrays); + + // calculate non-orthogonal unit cell coordinates + header.angles.forEach((angle, i, a) => { + a[i] *= Math.PI / 180.0; }); } - - function _parseData(data, opts, job) { - if (job.shouldCancel()) { - return Promise.reject(new Error('Operation cancelled')); + _setAxisIndices() { + const header = this._header; + if (header.cellDims.x === 0.0 && header.cellDims.y === 0.0 && header.cellDims.z === 0.0) { + header.cellDims.set(1.0, 1.0, 1.0); + } + // Apply header conversion + // Mapping between CCP4 column, row, section and VMD x, y, z. + const { + crs2xyz + } = this._header; + if (crs2xyz[0] === 0 && crs2xyz[1] === 0 && crs2xyz[2] === 0) { + crs2xyz[0] = 1; + crs2xyz[1] = 2; + crs2xyz[2] = 3; + } + const xyz2crs = this._xyz2crs; + xyz2crs[crs2xyz[0] - 1] = 0; // column + xyz2crs[crs2xyz[1] - 1] = 1; // row + xyz2crs[crs2xyz[2] - 1] = 2; // section + } + _setOrigins() { + const [xaxis, yaxis, zaxis] = this._getAxis(); + this._setAxisIndices(); + const header = this._header; + const xyz2crs = this._xyz2crs; + // Handle both MRC-2000 and older format maps + if (header.origin.x === 0.0 && header.origin.y === 0.0 && header.origin.z === 0.0) { + this._origin.addScaledVector(xaxis, header.nstart[xyz2crs[0]]); + this._origin.addScaledVector(yaxis, header.nstart[xyz2crs[1]]); + this._origin.addScaledVector(zaxis, header.nstart[xyz2crs[2]]); + } else { + this._origin = header.origin; + // Use ORIGIN records rather than old n[xyz]start records + // http://www2.mrc-lmb.cam.ac.uk/image2000.html + // XXX the ORIGIN field is only used by the EM community, and + // has undefined meaning for non-orthogonal maps and/or non-cubic voxels, etc. + } + xaxis.multiplyScalar(header.extent[xyz2crs[0]] - 1); + yaxis.multiplyScalar(header.extent[xyz2crs[1]] - 1); + zaxis.multiplyScalar(header.extent[xyz2crs[2]] - 1); + if (header.type === 2) { + this._data = new Float32Array(this._buff, 1024 + header.nsymbt, header.extent[0] * header.extent[1] * header.extent[2]); + } else { + throw new Error(`CCP4: Unsupported format ${header.type}`); } - - job.notify({ - type: 'parsing' + this._setBoxParams(xaxis, yaxis, zaxis); + } + _toXYZData() { + const header = this._header; + const data = this._data; + const xyz2crs = this._xyz2crs; + const xyzData = new Float32Array(data.length); + const dim = this._getXYZdim(); + const xSize = dim[0]; + const ySize = dim[1]; + let crsIdx = 0; + const coord = []; + let x; + let y; + let z; + for (coord[2] = 0; coord[2] < header.extent[2]; coord[2]++) { + // Site + for (coord[1] = 0; coord[1] < header.extent[1]; coord[1]++) { + // Row + for (coord[0] = 0; coord[0] < header.extent[0]; coord[0]++, crsIdx++) { + // Column + x = coord[xyz2crs[0]]; + y = coord[xyz2crs[1]]; + z = coord[xyz2crs[2]]; + xyzData[x + xSize * (y + ySize * z)] = data[crsIdx]; + } + } + } + return xyzData; + } +} +class CCP4Parser extends Parser { + constructor(data, options) { + super(data, options); + this._options.fileType = 'ccp4'; + this.model = new Ccp4Model(); + } + static canProbablyParse(_data) { + return false; // Autodetection is not implemented yet + } + parseSync() { + return this.model.parse(this._data); + } +} +CCP4Parser.formats = ['ccp4']; +CCP4Parser.extensions = ['.ccp4', '.map', '.mrc']; +CCP4Parser.binary = true; +/* harmony default export */ const parsers_CCP4Parser = (CCP4Parser); +;// CONCATENATED MODULE: ./src/io/parsers/XYZParser.js + + + + +const { + Complex: XYZParser_Complex, + Element: XYZParser_Element, + Molecule: XYZParser_Molecule +} = chem; +class XYZParser extends Parser { + constructor(data, options) { + super(data, options); + this._complex = null; + this._atomsInf = null; + this._options.fileType = 'xyz'; + this._fileName = options.name; + } + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(data) && /^\s*\d+ *\n[^\n]*\n\s*\w{1,3}\s+-?\d/.test(data); + } + _parseToAtomsInf(source) { + const endnAtoms = source.indexOf('\n'); + const nAtoms = parseInt(source.substring(0, endnAtoms), 10); + const endComment = source.indexOf('\n', endnAtoms + 1); + let comment = source.slice(endnAtoms + 1, endComment).trim(); + if (comment.length === 0) { + comment = this._fileName; + } + const startAtomsInf = endComment + source.substring(endComment).search(/\S/); + this._atomsInf = source.substring(startAtomsInf).split(/[\s,]*\n[\s,]*/); + if (!Number.isNaN(nAtoms) && this._atomsInf.length - 1 !== nAtoms) { + this._complex.error = { + message: 'wrong number of atoms' + }; + return; + } + this._complex.metadata.format = 'xyz'; + this._complex.name = comment; + } + _parseAtomsInf() { + const het = true; + const altLoc = ' '; + const occupancy = 1; + const tempFactor = 1; + const charge = 0; + const chain = this._complex.addChain('A'); + const residue = chain.addResidue('UNK', 1, ' '); + for (let i = 0; i < this._atomsInf.length - 1; i++) { + const words = this._atomsInf[i].split(/[\s,]+/); + if (words.length !== 4) { + this._complex.error = { + message: 'missed parameters' + }; + break; + } + const serial = i + 1; + const name = words[0]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3])); + const type = XYZParser_Element.getByName(name); + const role = undefined; + residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); + } + const molecule = new XYZParser_Molecule(this._complex, this._complex.name, 1); + molecule.residues = residue; + this._complex._molecules[0] = molecule; + } + parseSync() { + const result = this._complex = new XYZParser_Complex(); + this._parseToAtomsInf(this._data); + this._parseAtomsInf(); + this._complex.finalize({ + needAutoBonding: true, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap }); - - var TheParser = _.head(io.parsers.find({ - format: opts.fileType, - ext: opts.fileExt, - data: data - })); - - if (!TheParser) { - return Promise.reject(new Error('Could not find suitable parser')); + this._complex = null; + this._atomsInf = null; + if (result.error) { + throw new Error(result.error.message); } + return result; + } + static formats = ['xyz']; + static extensions = ['.xyz']; +} +/* harmony default export */ const parsers_XYZParser = (XYZParser); +;// CONCATENATED MODULE: ./src/io/parsers/PubChemParser.js - var parser = new TheParser(data, opts); - parser.context = opts.context; - job.addEventListener('cancel', function () { - return parser.abort(); - }); - console.time('parse'); - return parser.parse().then(function (dataSet) { - console.timeEnd('parse'); - job.notify({ - type: 'parsingDone', - data: dataSet - }); - return dataSet; - })["catch"](function (error) { - console.timeEnd('parse'); - opts.error = error; - opts.context.logger.debug(error.message); - if (error.stack) { - opts.context.logger.debug(error.stack); - } - opts.context.logger.error('Parsing failed'); - job.notify({ - type: 'parsingDone', - error: error + +const { + Complex: PubChemParser_Complex, + Element: PubChemParser_Element +} = chem; +class PubChemParser extends Parser { + constructor(data, options) { + super(data, options); + this._options.fileType = 'pubchem+json'; + } + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(data) && data[0] === '{'; + } + parseSync() { + this.logger.info('Parsing PubChem JSON file...'); + return this._toComplex(JSON.parse(this._data)); + } + _toComplex(jsonData) { + const complex = new PubChemParser_Complex(); + const complexData = jsonData.PC_Compounds && jsonData.PC_Compounds[0]; + if (complexData) { + this._extractAtoms(complex, complexData); + complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing }); - throw error; - }); + } + return complex; } - /** - * Load molecule asynchronously. - * @param {string|File} source - Molecule source to load (e.g. PDB ID, URL or File object). - * @param {object=} opts - Options. - * @param {string=} opts.sourceType - Data source type (e.g. 'url', 'file'). - * @param {string=} opts.fileType - Data contents type (e.g. 'pdb', 'cml'). - * @param {string=} opts.mdFile - .nc file path. - * @param {boolean=} opts.keepRepsInfo - prevent reset of object and reps information. - * @returns {Promise} name of the visual that was added to the viewer - */ - - - Miew.prototype.load = function (source, opts) { - var _this3 = this; + _extractAtoms(complex, complexData) { + let aids = complexData.atoms && complexData.atoms.aid; + let elements = aids && complexData.atoms.element; + if (!elements || aids.length !== elements.length) { + throw new Error('Unable to parse atom elements'); + } + elements = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().fromPairs(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().zip(aids, elements)); + const atoms = {}; + const coords = complexData.coords && complexData.coords[0]; + const model = coords && coords.conformers && coords.conformers[0]; + const xs = model && model.x; + const ys = model && model.y; + const zs = model && model.z || []; + aids = coords && coords.aid; + if (!aids || !xs || !ys) { + throw new Error('Coordinates are not found in the file'); + } + const chain = complex.addChain(' '); + const residue = chain.addResidue('UNK', 1, ' '); + for (let i = 0, n = aids.length; i < n; ++i) { + const aid = aids[i]; + const element = PubChemParser_Element.ByAtomicNumber[elements[aid]]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(xs[i], ys[i], zs[i] || 0.0); + atoms[aid] = residue.addAtom(element.name, element, xyz, undefined, true, aid, ' ', 1.0, 0.0, 0); + } + const aids1 = complexData.bonds && complexData.bonds.aid1; + const aids2 = complexData.bonds && complexData.bonds.aid2; + const orders = complexData.bonds && complexData.bonds.order || []; + if (!aids1 || !aids2 || aids1.length !== aids2.length) { + return; + } + for (let j = 0, m = aids1.length; j < m; ++j) { + complex.addBond(atoms[aids1[j]], atoms[aids2[j]], orders[j] || 1, 0, true); + } + } +} +PubChemParser.formats = ['pubchem', 'pubchem+json', 'pc']; +PubChemParser.extensions = ['.json']; +/* harmony default export */ const parsers_PubChemParser = (PubChemParser); +;// CONCATENATED MODULE: ./src/io/parsers/SDFStream.js + +class SDFStream { + constructor(data) { + this._strings = data.split(/\r?\n|\r/); + this._currentStart = 0; + this._currentStringIndx = 0; + } + setStart(start) { + if (start >= this._strings.length) { + this._currentStart = this._strings.length - 1; + this._currentStringIndx = this._strings.length - 1; + } else { + this._currentStart = start; + this._currentStringIndx = start; + } + } + getNextString() { + return this._strings[++this._currentStringIndx]; + } + getCurrentString() { + return this._strings[this._currentStringIndx]; + } + getStringFromStart(numb) { + this._currentStringIndx = this._currentStart + numb; + return this._strings[this._currentStart + numb]; + } + findNextDataItem() { + let curStr = this.getNextString(); + let res = false; + while (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(curStr) && curStr.trim() !== '$$$$') { + if (curStr.match(/>\s+<(.*)>/)) { + res = true; + break; + } + curStr = this.getNextString(); + } + return res; + } + findNextCompoundStart() { + let curStr = this.getCurrentString(); + while (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(curStr) && curStr.trim() !== '$$$$') { + curStr = this.getNextString(); + } + this.setStart(++this._currentStringIndx); + return this.probablyHaveDataToParse(); + } + probablyHaveDataToParse() { + return this._currentStringIndx < this._strings.length - 2; + } +} +;// CONCATENATED MODULE: ./src/io/parsers/SDFParser.js + + + + + + +const { + Complex: SDFParser_Complex, + Element: SDFParser_Element, + Bond: SDFParser_Bond, + Molecule: SDFParser_Molecule +} = chem; +const chargeMap = [0, 3, 2, 1, 0, -1, -2, -3]; +const orderMap = [0, 1, 2, 3, 1, 1, 1, 2]; +const typeMap = [SDFParser_Bond.BondType.UNKNOWN, +// 0 - error +SDFParser_Bond.BondType.COVALENT, +// 1 - single +SDFParser_Bond.BondType.COVALENT, +// 2 - double +SDFParser_Bond.BondType.COVALENT, +// 3 - triple +SDFParser_Bond.BondType.AROMATIC, +// 4 - aromatic +SDFParser_Bond.BondType.UNKNOWN, +// 5 - single or double +SDFParser_Bond.BondType.AROMATIC, +// 6 - single or aromatic +SDFParser_Bond.BondType.AROMATIC // 7 - double or aromatic +// 8 - any +// 9 - coordination +// 10 - hydrogen +]; +const sdfAndMolRegexp = /.*(M\s\sEND).*|.*(^$$$$).*|.*>\s+<(.+)>.*/; +const sdfRegExp = /.*($$$$).*|.*>\s+<(.+)>.*/; +const fileFormat = { + SDF: 'sdf', + MOL: 'mol' +}; +const possibleNameTags = ['PUBCHEM_IUPAC_TRADITIONAL_NAME', /PUBCHEM_(.+)_NAME/, /(.+)name/, /(.+)NAME/]; +const possibleIDTags = ['PUBCHEM_COMPOUND_CID', 'id', 'ID', /.*CID/, /.*ID/, /.*id/]; +const possibleTitleTags = ['msg', 'MSG', 'message', 'title', 'description', 'desc']; +const tagsNames = ['name', 'id', 'title']; +const tags = { + name: possibleNameTags, + id: possibleIDTags, + title: possibleTitleTags +}; +function buildChainID(index) { + if (!index) { + return 'A'; + } + const codes = []; + while (index) { + codes.push(65 + index % 26); + index = Math.trunc(index / 26); + } + if (codes.length > 1) { + codes.reverse(); + codes[0] -= 1; + } + return String.fromCharCode(...codes); +} +class SDFParser extends Parser { + constructor(data, options) { + super(data, options); + this._format = 'sdf'; + this._complex = null; + this._chain = null; + this._residue = null; + this._molecules = null; + this._metadata = {}; + this._metadata.molecules = []; + this._currentMolProps = {}; + this._compoundIndx = -1; + this._assemblies = []; + this._atomsParsed = 0; + this._atomsIndexes = []; + } + canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(data) && sdfAndMolRegexp.test(data); + } + _parseHeader(stream) { + const molecule = {}; + molecule.name = stream.getStringFromStart(0); + const date = parseInt(stream.getStringFromStart(1).substr(10, 6).trim(), 10); + molecule.date = date.toString() || ''; + molecule.title = stream.getStringFromStart(2); + this._metadata.molecules.push(molecule); + } + _parseAtoms(stream, atomsNum) { + let curStr; + let serial = this._atomsParsed; + + // each molecule = chain\residue + const chainID = buildChainID(this._compoundIndx); + const resName = 'UNK'; + const resSeq = 1; + this._chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); + this._residue = this._chain.addResidue(resName, resSeq, ' '); + for (let i = 0; i < atomsNum; i++) { + curStr = stream.getNextString(); + serial++; + const x = parseFloat(curStr.substr(0, 10)); + const y = parseFloat(curStr.substr(10, 10)); + const z = parseFloat(curStr.substr(20, 10)); + const charge = chargeMap[parseInt(curStr.substr(36, 3), 10)]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(x, y, z); + let name = curStr.substr(31, 3).trim().toUpperCase(); + const type = SDFParser_Element.getByName(name); + if (!this._atomsIndexes[name]) { + this._atomsIndexes[name] = 0; + } + this._atomsIndexes[name] += 1; + name += this._atomsIndexes[name]; // every atom need to have unique name. + + this._residue.addAtom(name, type, xyz, undefined, true, serial, ' ', 1.0, 0.0, charge); + } + } + _parseBonds(stream, bondsNum) { + let curStr; + for (let i = 0; i < bondsNum; i++) { + curStr = stream.getNextString(); + let atom1 = parseInt(curStr.substr(0, 3), 10) + this._atomsParsed; + let atom2 = parseInt(curStr.substr(3, 3), 10) + this._atomsParsed; + const bondType = parseInt(curStr.substr(6, 3), 10); + if (atom1 > atom2) { + [atom1, atom2] = [atom2, atom1]; + } + this._complex.addBond(atom1, atom2, orderMap[bondType] || 1, typeMap[bondType] || SDFParser_Bond.BondType.UNKNOWN, true); + } + } + _parseMOL(stream) { + this._compoundIndx++; + this._parseHeader(stream); + const countsLine = stream.getStringFromStart(3); + const atomsNum = parseInt(countsLine.substr(0, 3), 10); + const bondsNum = parseInt(countsLine.substr(3, 3), 10); + this._parseAtoms(stream, atomsNum); + this._parseBonds(stream, bondsNum); + this._atomsParsed += atomsNum; + this._metadata.molecules[this._compoundIndx]._residues = []; + this._metadata.molecules[this._compoundIndx]._residues.push(this._residue); + } + _parseDataItem(stream) { + const tag = stream.getCurrentString(); + let data = []; + let curStr = stream.getNextString(); - opts = _.merge({}, opts, { - context: this - }); // for a single-file scenario + // read data + while (curStr.trim() !== '') { + data.push(curStr); + curStr = stream.getNextString(); + } + if (data.length === 1) { + [data] = data; + } + this._currentMolProps[tag.replace(/[<>]/g, '').trim()] = data; + } + _parseCompound(stream) { + this._parseMOL(stream); - if (!this.settings.now.use.multiFile) { - // abort all loaders in progress - if (this._loading.length) { - this._loading.forEach(function (job) { - job.cancel(); + // parse data items block + if (this._format === fileFormat.SDF) { + this._currentMolProps = {}; + while (stream.findNextDataItem()) { + this._parseDataItem(stream); + } + if (Object.keys(this._currentMolProps).length !== 0) { + const molecule = this._metadata.molecules[this._compoundIndx]; + molecule.props = this._currentMolProps; + this._tryToUpdateMoleculeData(molecule); + } + } + } + _fixBondsArray() { + const serialAtomMap = this._serialAtomMap; + const complex = this._complex; + const bonds = complex._bonds; + for (let j = 0; j < bonds.length; j++) { + const bond = bonds[j]; + if (bond._right < bond._left) { + console.log('_fixBondsArray: Logic error.'); + } + bond._left = serialAtomMap[bond._left] || null; + bond._right = serialAtomMap[bond._right] || null; + } + } + _buildAssemblies() { + const chains = this._complex._chains; + if (chains.length === 1) { + return this._assemblies; + } + for (let i = 0; i < chains.length; i++) { + const assembly = new chem_Assembly(this._complex); + const matrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + assembly.addMatrix(matrix); + assembly.addChain(chains[i]._name); + this._assemblies.push(assembly); + } + return this._assemblies; + } + _buildMolecules() { + this._complex._molecules = []; + const { + molecules + } = this._metadata; + for (let i = 0; i < molecules.length; i++) { + const molecule = new SDFParser_Molecule(this._complex, molecules[i].name, i + 1); + molecule.residues = molecules[i]._residues; + this._complex._molecules[i] = molecule; + } + return this._complex._molecules; + } + _searchTag(tag, props) { + for (let i = 0; i < props.length; i++) { + if (tag instanceof RegExp && tag.test(props[i].tag) || tag === props[i].tag) { + return props[i].data; + } + } + return undefined; + } + _tryToFind(tagsList, props) { + for (let j = 0; j < tagsList.length; j++) { + const res = this._searchTag(tagsList[j], props); + if (res) { + return res; + } + } + return undefined; + } + _tryToUpdateMoleculeData(molecule) { + let res = false; + for (let i = 0; i < tagsNames.length; i++) { + const tagPossibleNames = tags[tagsNames[i]]; + const data = this._tryToFind(tagPossibleNames, molecule.props); + if (data) { + molecule[tagsNames[i]] = data; + res = true; + } + } + molecule.name = molecule.name || molecule.id; + if (molecule.name.match(/^\d+$/)) { + molecule.name = `CID: ${molecule.name}`; + } + return res; + } + _finalizeMetadata() { + const { + molecules + } = this._metadata; + const { + metadata + } = this._complex; + const complex = this._complex; + if (molecules.length === 1) { + complex.name = molecules[0].name; + metadata.title = molecules[0].title; + metadata.date = molecules[0].date; + metadata.properties = molecules[0].props; + } else if (molecules.length > 1) { + metadata.molecules = []; + for (let i = 0; i < molecules.length; i++) { + metadata.molecules.push({ + name: molecules[i].name, + date: molecules[i].date, + title: molecules[i].title, + properties: molecules[i].props }); - - this._loading.length = 0; - } // reset - - - if (!opts.animation) { - // FIXME: sometimes it is set AFTERWARDS! - this.reset(true); } } - - this._interpolator.reset(); - - this.dispatchEvent({ - type: 'loading', - options: opts, - source: source + } + _finalize() { + const serialAtomMap = this._serialAtomMap = {}; + const atoms = this._complex._atoms; + for (let i = 0; i < atoms.length; i++) { + const atom = atoms[i]; + serialAtomMap[atom.serial] = atom; + } + this._complex._finalizeBonds(); + this._fixBondsArray(); + this._finalizeMetadata(); + this._buildAssemblies(); + this._complex.units = this._complex.units.concat(this._assemblies); + this._buildMolecules(); + this._complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: false, + enableEditing: false, + serialAtomMap: this._serialAtomMap }); - var job = new JobHandle(); - - this._loading.push(job); - - job.addEventListener('notification', function (e) { - _this3.dispatchEvent(e.slaveEvent); + } + defineFormat(data) { + let format; + if (sdfRegExp.test(data)) { + format = fileFormat.SDF; + } else { + format = fileFormat.MOL; + } + return format; + } + parseSync() { + const result = this._complex = new SDFParser_Complex(); + const stream = new SDFStream(this._data); + this._format = this.defineFormat(this._data); + result.metadata.format = this._format; + do { + this._parseCompound(stream); + } while (stream.findNextCompoundStart()); + this._finalize(); + return result; + } +} +SDFParser.formats = ['mol', 'sdf']; +SDFParser.extensions = ['.mol', '.sdf']; +;// CONCATENATED MODULE: ./src/io/parsers/DSN6Parser.js + + + + +// http://www.uoxray.uoregon.edu/tnt/manual/node104.html +const DSN6Header = { + nstart: [valueType.array, 'i16', 0], + extent: [valueType.array, 'i16', 3], + grid: [valueType.array, 'i16', 6], + cellDims: [valueType.vector, 'i16', 9], + angles: [valueType.array, 'i16', 12], + div: [valueType.singular, 'i16', 15], + adder: [valueType.singular, 'i16', 16], + scaleFactor: [valueType.singular, 'i16', 17] +}; +class DSN6Model extends parsers_VolumeModel { + _parseHeader(_buffer) { + this._buff = _buffer; + this._typedCheck(); + const arrays = {}; + arrays.i16 = new Int16Array(this._buff); + + // check and reverse if big endian + if (arrays.i16[18] !== 100) { + for (let i = 0, n = arrays.i16.length; i < n; ++i) { + const val = arrays.i16[i]; + arrays.i16[i] = (val & 0xff) << 8 | val >> 8 & 0xff; + } + } + if (arrays.i16[18] !== 100) { + throw new Error('DSN6: Incorrect format '); + } + const header = this._header; + this._fillHeader(DSN6Header, arrays); + header.cellDims.multiplyScalar(1.0 / header.scaleFactor); + header.angles.forEach((angle, i, a) => { + a[i] *= Math.PI / 180.0 / header.scaleFactor; }); - - this._spinner.spin(this._container); - - var onLoadEnd = function onLoadEnd(anything) { - var jobIndex = _this3._loading.indexOf(job); - - if (jobIndex !== -1) { - _this3._loading.splice(jobIndex, 1); + header.div /= 100; + } + _setAxisIndices() { + this._xyz2crs[0] = 0; + this._xyz2crs[1] = 1; + this._xyz2crs[2] = 2; + } + _setOrigins() { + const header = this._header; + const [xaxis, yaxis, zaxis] = this._getAxis(); + this._setAxisIndices(); + this._origin.addScaledVector(xaxis, header.nstart[0]); + this._origin.addScaledVector(yaxis, header.nstart[1]); + this._origin.addScaledVector(zaxis, header.nstart[2]); + xaxis.multiplyScalar(header.extent[0]); + yaxis.multiplyScalar(header.extent[1]); + zaxis.multiplyScalar(header.extent[2]); + this._setBoxParams(xaxis, yaxis, zaxis); + } + _pointCalculate(xyzData, byteBuffer, z, y, x, pos, i) { + const header = this._header; + if (x < header.extent[0] && y < header.extent[1] && z < header.extent[2]) { + const idx = x + header.extent[0] * (y + header.extent[1] * z); + xyzData[idx] = (byteBuffer[pos.counter] - header.adder) / header.div; + ++pos.counter; + } else { + pos.counter += 8 - i; + return false; + } + return true; + } + _blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos) { + for (let k = 0; k < 8; ++k) { + const z = 8 * zBlock + k; + for (let j = 0; j < 8; ++j) { + const y = 8 * yBlock + j; + let inRange = true; + let i = 0; + while (inRange && i < 8) { + const x = 8 * xBlock + i; + inRange = this._pointCalculate(xyzData, byteBuffer, z, y, x, pos, i); + i++; + } } + } + } + _toXYZData() { + const header = this._header; + const byteBuffer = new Uint8Array(this._buff); + const xyzData = new Float32Array(header.extent[0] * header.extent[1] * header.extent[2]); + const blocks = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(header.extent[0] / 8, header.extent[1] / 8, header.extent[2] / 8); + const pos = {}; + pos.counter = 512; + for (let zBlock = 0; zBlock < blocks.z; ++zBlock) { + for (let yBlock = 0; yBlock < blocks.y; ++yBlock) { + for (let xBlock = 0; xBlock < blocks.x; ++xBlock) { + this._blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos); + } + } + } + this._calculateInfoParams(xyzData); + return xyzData; + } + _calculateInfoParams(xyzData) { + this._header.dmean /= xyzData.length; + let dispersion = 0; + let minDensity = xyzData[0]; + let maxDensity = xyzData[0]; + for (let j = 0; j < xyzData.length; j++) { + dispersion += (this._header.dmean - xyzData[j]) ** 2; + if (xyzData[j] < minDensity) { + minDensity = xyzData[j]; + } + if (xyzData[j] > maxDensity) { + maxDensity = xyzData[j]; + } + } + this._header.sd = Math.sqrt(dispersion / xyzData.length); + this._header.dmax = maxDensity; + this._header.dmin = minDensity; + } +} +class DSN6Parser extends Parser { + constructor(data, options) { + super(data, options); + this._options.fileType = 'dsn6'; + this.model = new DSN6Model(); + } + static canParse(data, options) { + if (!data) { + return false; + } + return data instanceof ArrayBuffer && Parser.checkDataTypeOptions(options, 'dsn6'); + } + static canProbablyParse(_data) { + return false; + } + parseSync() { + return this.model.parse(this._data); + } +} +DSN6Parser.formats = ['dsn6']; +DSN6Parser.extensions = ['.dsn6', '.omap']; +DSN6Parser.binary = true; +/* harmony default export */ const parsers_DSN6Parser = (DSN6Parser); +;// CONCATENATED MODULE: ./src/io/parsers/GROReader.js + + +/** + * Little helper class for GRO Parser usage. + * @extends PDBStream + */ +class GROReader extends parsers_PDBStream { + constructor(data) { + super(data); + /** @type Number */ + this._next = -1; // End position of line + this.next(); + } - _this3._spinner.stop(); + /** + * Getting end of string. + * @returns {Number} Pointer to end of string + */ + getNext() { + return this._next; + } +} +/* harmony default export */ const parsers_GROReader = (GROReader); +;// CONCATENATED MODULE: ./src/io/parsers/GROParser.js - _this3._refreshTitle(); - job.notify({ - type: 'loadingDone', - anything: anything - }); - return anything; - }; - return _fetchData(source, opts, job).then(function (data) { - return _parseData(data, opts, job); - }).then(function (object) { - var name = _this3._onLoad(object, opts); - return onLoadEnd(name); - })["catch"](function (err) { - _this3.logger.error('Could not load data'); - _this3.logger.debug(err); +const { + Complex: GROParser_Complex, + Element: GROParser_Element, + Molecule: GROParser_Molecule +} = chem; - throw onLoadEnd(err); - }); - }; +/** + * Gromos87 file format parser. + * @extends Parser + */ +class GROParser extends Parser { /** - * Unload molecule (delete corresponding visual). - * @param {string=} name - name of the visual + * Create parser for .gro file format + * + * @param {String} data Input file + * @param {String} options Input options (optional field) */ + constructor(data, options) { + super(data, options); + /** @type Date */ + this._time = null; // Time in ps, optional field for animations + /** @type Number */ + this._numAtoms = null; // Number of atoms in complex + /** @type Number */ + this._residueNumber = null; // Number of exact residue + /** @type String */ + this._residueName = ''; // Scientific name of exact residue + /** @type String */ + this._atomName = ''; // Scientific name of exact atom + /** @type Number */ + this._atomNumber = null; // Sorted number of exact atom + /** @type Array */ + this._atomPosition = []; // Array which contains x, y, z position of exact atom + /** @type Array */ + this._atomVelocity = []; // Array which contains x, y, z velocity of exact atom (optional) + /** @type Complex */ + this._complex = null; // Complex structure for unified molecule representation + /** @type Vector3 */ + this._molecules = []; // Molecules array + /** @type Molecule */ + this._molecule = null; // Single molecule + /** @type String */ + this._options.filetype = 'gro'; // Extension of data file. + } - - Miew.prototype.unload = function (name) { - this._removeVisual(name || this.getCurrentVisual()); - - this.resetPivot(); - - if (settings.now.shadow.on) { - this._updateShadowCamera(); - } - }; /** - * Start new animation. Now is broken. - * @param fileData - new data to animate - * @private - * @deprecated until animation system refactoring. + * General check for possibility of parsing. + * @param {String} data - Input file + * @returns {boolean} true if this file is in ascii, false otherwise */ + canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(this._data) && /^\s*[^\n]*\n\s*\d+ *\n\s*\d+[^\n\d]{3}\s*\w+\s*\d+\s*-?\d/.test(data); + } + /** + * Parsing title of molecule complex. + * NOTE: that names are ESTIMATES, there is no strict rules in Gromos87 standard for first line in input file. + * @param {GROReader} line - Line containing title and time. + */ + _parseTitle(line) { + const { + metadata + } = this._complex; + metadata.id = line.readLine().trim(); + metadata.name = metadata.id.slice(metadata.id.lastIndexOf('\\') + 1, metadata.id.lastIndexOf('.')); + metadata.format = 'gro'; + } - Miew.prototype._startAnimation = function (fileData) { - this._stopAnimation(); - - var self = this; - - var visual = this._getComplexVisual(); + /** + * Parsing line containing number of atoms information. + * @param {GROReader} line - Line containing number of atoms. + */ + _parseNumberOfAtoms(line) { + this._numAtoms = line.readInt(0, line.getNext()); + if (Number.isNaN(this._numAtoms)) { + throw new Error('Line 2 is not representing atom number. Consider checking input file'); + } + } - if (visual === null) { - this.logger.error('Unable to start animation - no molecule is loaded.'); + /** + * Parsing line containing information about residues, atoms etc. Also information about box vectors. + * Format of atoms MUST (by Gromos87 standard) be this: (note that numbering starts not from 0, but from 1!) + * ResidueNumber[1 - 5] ResidueName[6 - 10] AtomName[11 - 15] AtomNumber[16 - 20] Position[21 - 45] Velocity[46 - 69] + * @param {GROReader} line - Line containing information about atom. + */ + _parseAtom(line) { + this._residueNumber = line.readInt(1, 5); + this._residueName = line.readString(6, 10).trim(); + this._atomName = line.readString(11, 15).trim(); + this._atomNumber = line.readInt(16, 20); + const positionX = line.readFloat(21, 28) * 10; + const positionY = line.readFloat(29, 36) * 10; + const positionZ = line.readFloat(37, 45) * 10; + if (Number.isNaN(positionX) || Number.isNaN(positionY) || Number.isNaN(positionZ)) { + this._complex.error = { + message: `Atom position is invalid in "${line.readLine()}"` + }; return; } - - try { - this._frameInfo = new FrameInfo(visual.getComplex(), fileData, { - onLoadStatusChanged: function onLoadStatusChanged() { - self.dispatchEvent({ - type: 'mdPlayerStateChanged', - state: { - isPlaying: self._isAnimating, - isLoading: self._frameInfo ? self._frameInfo.isLoading : true - } - }); - }, - onError: function onError(message) { - self._stopAnimation(); - - self.logger.error(message); - } - }); - } catch (e) { - this.logger.error('Animation file does not fit to current complex!'); + /* const velocityX = line.readFloat(46, 53); + const velocityY = line.readFloat(54, 61); + const velocityZ = line.readFloat(62, 69); */ + /* Adding residue and atom to complex structure */ + const type = GROParser_Element.getByName(this._atomName[0]); /* MAGIC 0. REASONS: This name is something like "CA", where + C - is an element an A is something else. But what about Calcium? */ + if (type.fullName === 'Unknown') { + this._complex.error = { + message: `${this._atomName[0]} hasn't been recognised as an atom name.` + }; return; } + const role = GROParser_Element.Role[this._atomName]; + /* Firstly, create a dummy chain */ + let chain = this._chain; + if (!chain) { + this._chain = chain = this._complex.addChain('A'); + } + /* Secondly, add residue to that chain */ + let residue = this._residue; + if (!residue || residue.getSequence() !== this._residueNumber) { + this._residue = residue = chain.addResidue(this._residueName, this._residueNumber, ' '); + } + /* Lastly, add atom to that residue */ + this._atomPosition = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(positionX, positionY, positionZ); + /* Adding default constants to correct atom addition process */ + const het = true; + const altLoc = ' '; + const occupancy = 1; + const tempFactor = 1; + const charge = 0; + residue.addAtom(this._atomName, type, this._atomPosition, role, het, this._atomNumber, altLoc, occupancy, tempFactor, charge); + } - this._continueAnimation(); - }; /** - * Pause current animation. Now is broken. - * @private - * @deprecated until animation system refactoring. + * Some finalizing procedures. In '.gro' file format there is only 1 chain and 1 molecule. */ + _finalize() { + const molecule = new GROParser_Molecule(this._complex, this._complex.metadata.name, 1); + // aggregate residues from chain + molecule.residues = this._chain._residues; + molecule._chains = this._chain; + this._complex._molecules[0] = molecule; + this._molecules.push(molecule); + this._complex.finalize({ + needAutoBonding: true, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap + }); + } - - Miew.prototype._pauseAnimation = function () { - if (this._animInterval === null) { - return; + /** + * Main parsing procedure. + * @returns {Complex} Complex structure for visualizing. + */ + parseSync() { + /* Create "Complex" variable */ + const result = this._complex = new GROParser_Complex(); + /* Parse input file line-by-line */ + const reader = new parsers_GROReader(this._data); + let counter = 0; /* Simple counter regarding to format of .gro file */ + /* First two lines - technical information, other lines - Atoms */ + this._parseTitle(reader); + reader.next(); + this._parseNumberOfAtoms(reader); + reader.next(); + for (counter = 0; counter < this._numAtoms; ++counter) { + if (!reader.end()) { + this._parseAtom(reader); + reader.next(); + } else break; + } + /* If number of atoms in second line is less then actual atoms in file */ + if (counter < this._numAtoms) { + this._complex.error = { + message: 'File ended unexpectedly.' + }; + } + /* Catch errors occurred in parsing process */ + if (result.error) { + throw new Error(result.error.message); } - this._isAnimating = false; - clearInterval(this._animInterval); - this._animInterval = null; + /* Finalizing data */ + this._finalize(); - if (this._frameInfo) { - this.dispatchEvent({ - type: 'mdPlayerStateChanged', - state: { - isPlaying: this._isAnimating, - isLoading: this._frameInfo.isLoading - } - }); + /* Cleaning up */ + this._atomPosition = null; + this._complex = null; + this._molecules = null; + this._molecule = null; + + /* Return resulting Complex variable */ + return result; + } +} +GROParser.formats = ['gro']; +GROParser.extensions = ['.gro']; +/* harmony default export */ const parsers_GROParser = (GROParser); +;// CONCATENATED MODULE: ./src/io/parsers/MOL2Parser.js + + + +const { + Complex: MOL2Parser_Complex, + Element: MOL2Parser_Element, + Bond: MOL2Parser_Bond, + Molecule: MOL2Parser_Molecule +} = chem; +const MOL2Parser_orderMap = { + un: 0, + 1: 1, + 2: 2, + 3: 3, + ar: 1, + am: 1, + nc: 0, + du: 1 +}; +const MOL2Parser_typeMap = { + un: MOL2Parser_Bond.BondType.UNKNOWN, + // unknown (cannot be determined from the parameter tables) + 1: MOL2Parser_Bond.BondType.COVALENT, + // single + 2: MOL2Parser_Bond.BondType.COVALENT, + // double + 3: MOL2Parser_Bond.BondType.COVALENT, + // triple + ar: MOL2Parser_Bond.BondType.AROMATIC, + // aromatic + am: MOL2Parser_Bond.BondType.COVALENT, + // amide + nc: MOL2Parser_Bond.BondType.UNKNOWN, + // not connected + du: MOL2Parser_Bond.BondType.COVALENT // dummy +}; +const resNumberRegex = /\d+$/; +const spacesRegex = /\s+/; +function splitToFields(str) { + return str.trim().split(spacesRegex); +} +/* There is no jsdoc documentation because of eslint corrections: + * not all Parser methods are implemented + */ + +class MOL2Parser extends Parser { + constructor(data, options) { + super(data, options); + this._complex = null; + this._chain = null; + this._residue = null; + this._compoundIndx = -1; + this._molecules = []; + this._molecule = null; + this._currPosIdx = 0; + this._currStartIdx = 0; + this._serialAtomMap = {}; + this._options.fileType = 'mol2'; + } + _parseRawStrings(data) { + return data.split(/\r?\n|\r/); + } + _toStringFromStart(numb, MOL2Data) { + const newPosIdx = this._currStartIdx + numb; + this._currPosIdx = newPosIdx < MOL2Data.length ? newPosIdx : this._currStartIdx; + } + _toHeaderString(header, MOL2Data) { + this._toStringFromStart(0, MOL2Data); + while (this._currPosIdx < MOL2Data.length) { + if (MOL2Data[this._currPosIdx].match(`@${header}`)) { + return; + } + this._currPosIdx++; } - }; - /** - * Continue current animation after pausing. Now is broken. - * @private - * @deprecated until animation system refactoring. - */ + this._toStringFromStart(0, MOL2Data); + } + _toStringFromHeader(header, numb, MOL2Data) { + this._toHeaderString(header, MOL2Data); + const newPosIdx = this._currPosIdx + numb; + if (MOL2Data[this._currPosIdx].match(`@${header}`) && newPosIdx < MOL2Data.length) { + this._currPosIdx = newPosIdx; + } + } + _setStart(startPos, MOL2Data) { + if (startPos >= MOL2Data.length) { + this._currStartIdx = this._currPosIdx = MOL2Data.length - 1; + } else { + this._currStartIdx = this._currPosIdx = startPos; + } + } + _probablyHaveDataToParse(MOL2Data) { + return this._currPosIdx < MOL2Data.length - 2; + } + _findNextCompoundStart(MOL2Data) { + while (this._currPosIdx < MOL2Data.length && MOL2Data[this._currPosIdx].trim() !== '@MOLECULE>') { + this._currPosIdx++; + } + this._setStart(++this._currPosIdx, MOL2Data); + return this._probablyHaveDataToParse(MOL2Data); + } + _parseMolecule(MOL2Data) { + this._toHeaderString('MOLECULE', MOL2Data); + const { + metadata + } = this._complex; + metadata.name = MOL2Data[++this._currPosIdx]; + metadata.format = 'mol2'; + this._molecule = { + _index: '', + _chains: [] + }; + this._molecule._index = this._compoundIndx + 1; + this._molecules.push(this._molecule); + } + /* Atom format description: + * atomId atomName x y z element [resSeq [resName [charge [statusBit]]]] + * statusBits is the internal SYBYL status bits associated with the atom. + * These should never be set by the user. + * Source: http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf + */ + _parseAtoms(atomsNum, MOL2Data) { + this._toHeaderString('ATOM', MOL2Data); + for (let i = 0; i < atomsNum; i++) { + const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]); + if (parsedStr.length < 6) { + throw new Error('MOL2 parsing error: Not enough information to create atom!'); + } + const atomId = parseInt(parsedStr[0], 10); + const atomName = parsedStr[1]; + const x = parseFloat(parsedStr[2]); + const y = parseFloat(parsedStr[3]); + const z = parseFloat(parsedStr[4]); + const element = parsedStr[5].split('.')[0].toUpperCase(); + let charge = 0; + if (parsedStr.length >= 9) { + charge = parseFloat(parsedStr[8]) || 0.0; + } + let chain = this._chain; + if (!chain) { + // .mol2 may contain information about multiple molecules, but they can't be visualized + // at the same time now. There is no need to create different chain IDs then. + this._chain = chain = this._complex.getChain('A') || this._complex.addChain('A'); + this._residue = null; + } + if (!this._setResidue(parsedStr)) { + continue; + } - Miew.prototype._continueAnimation = function () { - this._isAnimating = true; - var minFrameTime = 1000 / settings.now.maxfps; - minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime; - var self = this; - var pivot = self._gfx.pivot; + // These fields are not listed in mol2 format. Set them default. + // Atoms and het atoms doesn't differ in .mol2, + // but het atoms have special residues. It can be used in next updates + const het = false; + const altLoc = ' '; + const occupancy = 1.0; + const tempFactor = 0.0; + const type = MOL2Parser_Element.getByName(element); + const role = MOL2Parser_Element.Role[atomName]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(x, y, z); + this._residue.addAtom(atomName, type, xyz, role, het, atomId, altLoc, occupancy, tempFactor, charge); + } + } + _setResidue(parsedStr) { + let resSeq = 1; + let resName = 'UNK'; // The same meaning has '<0>' in some mol2 files - var visual = this._getComplexVisual(); + if (parsedStr.length >= 7) { + resSeq = parseInt(parsedStr[6], 10); + } + if (parsedStr.length >= 8 && parsedStr[7] !== '<0>') { + resName = parsedStr[7].replace(resNumberRegex, ''); + } + if (this.settings.now.nowater) { + if (resName === 'HOH' || resName === 'WAT') { + return false; + } + } + const residue = this._residue; + const chain = this._chain; + if (!residue || residue.getSequence() !== resSeq) { + this._residue = chain.addResidue(resName, resSeq, 'A'); + } + return true; + } - if (visual) { - visual.resetSelectionMask(); - visual.rebuildSelectionGeometry(); - this._msgAtomInfo.style.opacity = 0.0; + /* Bond format description + * bondId originAtomId targetAtomId bondType [statusBits] + */ + _parseBonds(bondsNum, MOL2Data) { + this._toHeaderString('BOND', MOL2Data); + for (let i = 0; i < bondsNum; i++) { + const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]); + if (parsedStr.length < 3) { + throw new Error('MOL2 parsing error: Missing information about bonds!'); + } + let originAtomId = parseInt(parsedStr[1], 10); + let targetAtomId = parseInt(parsedStr[2], 10); + const bondType = parsedStr[3]; + if (originAtomId > targetAtomId) { + [originAtomId, targetAtomId] = [targetAtomId, originAtomId]; + } + this._complex.addBond(originAtomId, targetAtomId, MOL2Parser_orderMap[bondType] || 0, MOL2Parser_typeMap[bondType] || MOL2Parser_Bond.BondType.UNKNOWN, true); + } + } + _fixSerialAtoms() { + const atoms = this._complex._atoms; + for (let i = 0; i < atoms.length; i++) { + const atom = atoms[i]; + this._serialAtomMap[atom.serial] = atom; } + } + _fixBondsArray() { + const serialAtomMap = this._serialAtomMap; + const complex = this._complex; + if (Object.keys(serialAtomMap).length === 0) { + throw new Error('MOL2 parsing error: Missing atom information!'); + } + const bonds = complex._bonds; + for (let j = 0; j < bonds.length; j++) { + const bond = bonds[j]; + bond._left = serialAtomMap[bond._left] || null; + bond._right = serialAtomMap[bond._right] || null; + } + } + _finalizeMolecules() { + // Get chain from complex + const chain = this._complex._chains[0]; + this._complex._molecules = []; + + // Aggregate residues from chains + // (to be precise from the chain 'A') + for (let i = 0; i < this._molecules.length; i++) { + const currMolecule = this._molecules[i]; + const molResidues = chain._residues; + const molecule = new MOL2Parser_Molecule(this._complex, currMolecule._name, i + 1); + molecule.residues = molResidues; + this._complex._molecules[i] = molecule; + } + } + _finalize() { + this._complex._finalizeBonds(); + this._fixSerialAtoms(); + this._fixBondsArray(); + this._finalizeMolecules(); + this._complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap + }); + } + _parseCompound(MOL2Data) { + this._compoundIndx++; + this._parseMolecule(MOL2Data); + + // Ignoring comments and everything before @MOLECULE block + this._toStringFromHeader('MOLECULE', 2, MOL2Data); + const parsedStr = MOL2Data[this._currPosIdx].trim().split(spacesRegex); + const atomsNum = parsedStr[0]; + const bondsNum = parsedStr[1]; + this._parseAtoms(atomsNum, MOL2Data); + this._parseBonds(bondsNum, MOL2Data); + } + parseSync() { + const result = this._complex = new MOL2Parser_Complex(); + const MOL2Data = this._parseRawStrings(this._data); + do { + this._parseCompound(MOL2Data); + } while (this._findNextCompoundStart(MOL2Data)); + this._finalize(); + return result; + } +} +MOL2Parser.formats = ['mol2']; +MOL2Parser.extensions = ['.mol2', '.ml2', '.sy2']; +/* harmony default export */ const parsers_MOL2Parser = (MOL2Parser); +;// CONCATENATED MODULE: ./src/io/parsers.js - this._animInterval = setInterval(function () { - self.dispatchEvent({ - type: 'mdPlayerStateChanged', - state: { - isPlaying: self._isAnimating, - isLoading: self._frameInfo.isLoading - } - }); - if (self._frameInfo.frameIsReady) { - pivot.updateToFrame(self._frameInfo); - self._updateObjsToFrame(self._frameInfo); - self._refreshTitle(" Frame ".concat(self._frameInfo._currFrame, " of ").concat(self._frameInfo._framesCount, " time interval - ").concat(self._frameInfo._timeStep)); - try { - self._frameInfo.nextFrame(); - } catch (e) { - self.logger.error('Error during animation'); - self._stopAnimation(); - return; - } - self._needRender = true; - } - }, minFrameTime); - }; - /** - * Stop current animation. Now is broken. - * @private - * @deprecated until animation system refactoring. - */ - Miew.prototype._stopAnimation = function () { - if (this._animInterval === null) { - return; - } - clearInterval(this._animInterval); - this._frameInfo.disableEvents(); +/* harmony default export */ const parsers = (new parsers_ParserList([ +// note: order might be important +parsers_PDBParser, parsers_CIFParser, parsers_MMTFParser, parsers_XYZParser, parsers_CMLParser, parsers_PubChemParser, SDFParser, parsers_CCP4Parser, parsers_DSN6Parser, parsers_GROParser, parsers_MOL2Parser])); +;// CONCATENATED MODULE: ./src/io/exporters/ExporterList.js - this._frameInfo = null; - this._animInterval = null; - this.dispatchEvent({ - type: 'mdPlayerStateChanged', - state: null - }); - }; + +/** + * A list of available exporters. + * @extends EntityList + */ +class ExporterList extends utils_EntityList { /** - * Invoked upon successful loading of some data source - * @param {DataSource} dataSource - Data source for visualization (molecular complex or other) - * @param {object} opts - Options. - * @private + * Create a list of exporters. + * The exporters are indexed by supported data formats (`.formats` and + * `.extensions` properties of a Exporter subclass). + * The Exporters can be retrieved later by matching against specs (see {@link ExporterList#find}). + * + * @param {!Array=} someExporters A list of {@link Exporter} subclasses to + * automatically register at creation time. + * @see ExporterList#register */ + constructor() { + let someExporters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + super(someExporters, ['formats']); + } - - Miew.prototype._onLoad = function (dataSource, opts) { - var gfx = this._gfx; - var visualName = null; - - if (opts.animation) { - this._refreshTitle(); - - this._startAnimation(dataSource); - - return null; + /** + * Find a suitable exporter for data. + * + * @param {Object} specs Exporter specifications. + * @param {string=} specs.format Supported data format. + * @param {*=} specs.data Data to export. + */ + find(specs) { + let list = []; + if (specs.format) { + list = this._dict.formats[specs.format.toLowerCase()] || []; } + return [...list]; + } +} +/* harmony default export */ const exporters_ExporterList = (ExporterList); +;// CONCATENATED MODULE: ./src/io/exporters/Exporter.js + +class Exporter { + constructor(source, options) { + this._source = source; + this._options = options || {}; + this._abort = false; + } + exportSync() { + throw new Error('Exporting to this source is not implemented'); + } + export() { + return new Promise((resolve, reject) => { + setTimeout(() => { + try { + if (this._abort) { + return reject(new Error('Export aborted')); + } + return resolve(this.exportSync()); + } catch (error) { + return reject(error); + } + }); + }); + } + abort() { + this._abort = true; + } +} +utils_makeContextDependent(Exporter.prototype); +;// CONCATENATED MODULE: ./src/io/exporters/PDBResult.js + + +class PDBResult { + constructor() { + this._resultArray = []; + this._currentStr = -1; + this._tag = null; + this._fixedNumeration = false; + this._numeration = false; + this._tagStrNum = 0; + } + getResult() { + this.writeString('\n', 81, 81); + return this._resultArray.join(''); + } + _currentStrLength() { + const curStr = this._resultArray[this._currentStr]; + return curStr ? curStr.length : 0; + } - this._stopAnimation(); - - if (!opts || !opts.keepRepsInfo) { - this._opts.reps = null; - this._opts._objects = null; + // numeration can be number or boolean + // if numeration is number then just put this number to 8-10 pos in string + // if numeration is boolean then increase number for all new strings + newTag(tag, numeration) { + if (!tag) { + this._tag = null; + } else { + this._tag = tag; + } + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(numeration)) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isNumber(numeration)) { + this._tagStrNum = numeration; + this._numeration = true; + this._fixedNumeration = true; + } else if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isBoolean(numeration)) { + this._tagStrNum = 0; + this._numeration = numeration; + this._fixedNumeration = false; + } + } else { + this._numeration = false; + this._fixedNumeration = false; + this._tagStrNum = 0; } - - if (dataSource.id === 'Complex') { - var complex = dataSource; // update title - - if (opts.fileName) { - complex.name = complex.name || removeExtension(opts.fileName).toUpperCase(); - } else if (opts.amberFileName) { - complex.name = complex.name || removeExtension(opts.amberFileName).toUpperCase(); - } else { - complex.name = "Dynamic ".concat(opts.fileType, " molecule"); + } + newString(tag) { + this.writeString('\n', 81, 81); + this._currentStr++; + this._resultArray.push(''); + if (tag) { + this.writeString(tag, 1, 6); + } else if (this._tag) { + this.writeString(this._tag, 1, 6); + } + if (this._numeration) { + if (!this._fixedNumeration) { + this._tagStrNum++; } - - visualName = this._addVisual(new ComplexVisual(complex.name, complex)); - this._curVisualName = visualName; - var desc = this.info(); - this.logger.info("Parsed ".concat(opts.fileName, " (").concat(desc.atoms, " atoms, ").concat(desc.bonds, " bonds, ").concat(desc.residues, " residues, ").concat(desc.chains, " chains).")); - - if (_.isNumber(this._opts.unit)) { - complex.setCurrentUnit(this._opts.unit); + if (this._tagStrNum !== 1) { + this.writeString(this._tagStrNum.toString(), 10, 8); } - - if (opts.preset) ; else if (settings.now.autoPreset) { - switch (opts.fileType) { - case 'cml': - this.resetReps('small'); - break; - - case 'pdb': - case 'mmtf': - case 'cif': - if (hasValidResidues(complex)) { - this.resetReps('macro'); - } else { - this.resetReps('small'); - } - - break; - - default: - this.resetReps('default'); - break; + } + } + writeEntireString(string, maxStrPos, concat) { + if (!maxStrPos) { + maxStrPos = 81; + } + for (let j = 0; j < string.length; j++) { + if (this._currentStrLength() === maxStrPos && j !== string.length - 1) { + this.newString(); + if (concat) { + // pretty hardcoddy + this.writeString(concat.tag, concat.begin, concat.end); } + } + if (string[j] === '\n') { + this.newString(); } else { - this.resetReps('default'); + this.writeString(string[j]); } - } else if (dataSource.id === 'Volume') { - this.resetEd(); - visualName = this._onLoadEd(dataSource); } - - gfx.camera.updateProjectionMatrix(); - - this._updateFog(); // reset global transform - - - gfx.root.resetTransform(); - this.resetPivot(); // set scale to fit everything on the screen - - this._objectControls.setScale(settings.now.radiusToFit / this._getBSphereRadius()); - - this._resetObjects(); - - if (settings.now.autoResolution) { - this._tweakResolution(); + } + writeString(string, begin, end) { + let curStr = this._resultArray[this._currentStr]; + let str; + const curStrLength = curStr ? curStr.length : 0; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(string)) { + return; } - - if (settings.now.shadow.on) { - this._updateShadowCamera(); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isNumber(begin)) { + begin = curStrLength + 1; } - - if (this._opts.view) { - this.view(this._opts.view); - delete this._opts.view; + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isNumber(end)) { + end = curStrLength + string.length; + } + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(string)) { + str = string.toString(); + } else { + str = string; + } + const finish = begin < end ? end : begin; + const start = begin < end ? begin : end; + if (str.length > Math.abs(begin - end) + 1) { + str = str.substr(0, Math.abs(begin - end + 1)); } - this._refreshTitle(); - - return visualName; - }; - - Miew.prototype.resetEd = function () { - if (this._edLoader) { - this._edLoader.abort(); - - this._edLoader = null; - } // free all resources - - - this._removeVisual(this._getVolumeVisual()); - - this._needRender = true; - }; - - Miew.prototype.loadEd = function (source) { - var _this4 = this; - - this.resetEd(); - - var TheLoader = _.head(io.loaders.find({ - source: source - })); + // spaces before start of new data + if (start > curStrLength + 1) { + this._resultArray[this._currentStr] += ' '.repeat(start - curStrLength - 1); + } else if (start <= curStrLength) { + const cStr = this._resultArray[this._currentStr]; + this._resultArray[this._currentStr] = cStr.slice(0, start - 1); + } - if (!TheLoader) { - this.logger.error(LOADER_NOT_FOUND); - return Promise.reject(new Error(LOADER_NOT_FOUND)); + // if reverse order + // reverse order of end and begin means that user wants to align text right + if (end < begin) { + const len = begin - end + 1; + str = ' '.repeat(len - str.length) + str; } - var loader = this._edLoader = new TheLoader(source, { - binary: true - }); - loader.context = this; - return loader.load().then(function (data) { - var TheParser = _.head(io.parsers.find({ - format: 'ccp4' - })); + // some hardcode fix for space between string numeration and data + // (see pdb file format description) + if (start === 11 && this._numeration && this._tagStrNum !== 1) { + str = ` ${str}`; + } - if (!TheParser) { - throw new Error(PARSER_NOT_FOUND); + // append new data to string + this._resultArray[this._currentStr] += str; + curStr = this._resultArray[this._currentStr]; + if (finish > curStr.length) { + this._resultArray[this._currentStr] += ' '.repeat(finish - curStr.length); + } + } + writeBondsArray(bonds, atom) { + const bondsArrays = this._getSubArrays(bonds, 4); + for (let k = 0; k < bondsArrays.length; k++) { + this.newString(); + this.writeString(atom.serial, 11, 7); + for (let j = 0; j < bondsArrays[k].length; j++) { + const serial = bondsArrays[k][j]._left.serial === atom.serial ? bondsArrays[k][j]._right.serial : bondsArrays[k][j]._left.serial; + this.writeString(serial, 16 + 5 * j, 12 + 5 * j); } + } + } + _getSubArrays(arr, subArraySize) { + const subArrays = []; + for (let i = 0; i < arr.length; i += subArraySize) { + subArrays.push(arr.slice(i, i + subArraySize)); + } + return subArrays; + } - var parser = new TheParser(data); - parser.context = _this4; - return parser.parse().then(function (dataSource) { - _this4._onLoadEd(dataSource); - }); - })["catch"](function (error) { - _this4.logger.error('Could not load ED data'); - - _this4.logger.debug(error); - }); - }; - - Miew.prototype._onLoadEd = function (dataSource) { - dataSource.normalize(); - var volumeVisual = new VolumeVisual('volume', dataSource); - volumeVisual.getMesh().layers.set(gfxutils.LAYERS.VOLUME); // volume mesh is not visible to common render - - var visualName = this._addVisual(volumeVisual); - - this._needRender = true; - return visualName; - }; - - Miew.prototype._needRebuild = function () { - var needsRebuild = false; + // function for writing matrix in Remark290 and Remark350 tags + // (see pdb file description) + writeMatrix(matrix, matrixIndx, tag) { + for (let j = 0; j < 3; j++) { + this.newString(); + this.writeString(tag, 14, 18); + this.writeString((j + 1).toString(), 19, 19); + this.writeString(matrixIndx.toString(), 23, 20); + for (let k = 0; k < 3; k++) { + const numb = parseFloat(matrix.elements[j * 4 + k]).toFixed(6); + this.writeString(numb.toString(), 33 + k * 10, 24 + k * 10); + } + const numb = parseFloat(matrix.elements[j * 4 + 3]).toFixed(5); + this.writeString(numb.toString(), 68, 55); + } + } + writeMatrices(matrices, string) { + if (!matrices) { + return; + } + const matrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + for (let j = 0; j < matrices.length; j++) { + matrix.copy(matrices[j]).transpose(); + this.writeMatrix(matrix, j + 1, string); + } + } +} +;// CONCATENATED MODULE: ./src/io/exporters/PDBExporter.js - this._forEachComplexVisual(function (visual) { - needsRebuild = needsRebuild || visual.needsRebuild(); - }); - return needsRebuild; - }; - Miew.prototype._rebuildObjects = function () { - var self = this; - var gfx = this._gfx; - var i; - var n; // remove old object geometry - var toRemove = []; - for (i = 0; i < gfx.pivot.children.length; ++i) { - var child = gfx.pivot.children[i]; - if (!(child instanceof Visual)) { - toRemove.push(child); +class PDBExporter extends Exporter { + constructor(source, options) { + super(source, options); + this._tags = ['HEADER', 'TITLE', 'COMPND', 'REMARK', 'HELIX', 'SHEET', 'ATOM and HETATM', 'CONECT']; + this._result = null; + this._tagExtractors = { + HEADER: this._extractHEADER, + TITLE: this._extractTITLE, + 'ATOM and HETATM': this._extractATOM, + CONECT: this._extractCONECT, + COMPND: this._extractCOMPND, + REMARK: this._extractREMARK, + HELIX: this._extractHELIX, + SHEET: this._extractSHEET + }; + this._stringForRemark350 = 'COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN\n' + 'BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE\n' + 'MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS\n' + 'GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND\n' + 'CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.'; + this._stringForRemark290 = 'CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS\n' + 'THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM\n' + 'RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY\n' + 'RELATED MOLECULES.'; + } + exportSync() { + const result = new PDBResult(); + if (!this._source) { + return this._result; + } + for (let i = 0; i < this._tags.length; i++) { + const tag = this._tags[i]; + const func = this._tagExtractors[tag]; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isFunction(func)) { + func.call(this, result); } } - - for (i = 0; i < toRemove.length; ++i) { - toRemove[i].parent.remove(toRemove[i]); + this._result = result.getResult(); + return this._result; + } + _extractHEADER(result) { + if (!this._source.metadata) { + return; } - - setTimeout(function () { - var objList = self._objects; - - for (i = 0, n = objList.length; i < n; ++i) { - var obj = objList[i]; - - if (obj.needsRebuild) { - obj.build(); - } - - if (obj.getGeometry()) { - gfx.pivot.add(obj.getGeometry()); + const { + metadata + } = this._source; + result.newTag('HEADER'); + result.newString(); + if (metadata.classification) { + result.writeString(metadata.classification, 11, 50); + } + if (metadata.date) { + result.writeString(metadata.date, 51, 59); + } + if (metadata.id) { + result.writeString(metadata.id, 63, 66); + } + } + _extractTITLE(result) { + if (!this._source.metadata) { + return; + } + const { + metadata + } = this._source; + if (!metadata.title) { + return; + } + result.newTag('TITLE', true); + for (let i = 0; i < metadata.title.length; i++) { + result.newString(); + result.writeString(metadata.title[i], 11, 80); + } + } + _extractCONECT(result) { + if (!this._source._atoms) { + return; + } + const atoms = this._source._atoms; + result.newTag('CONECT'); + for (let i = 0; i < atoms.length; i++) { + const fixedBonds = atoms[i].bonds.filter(bond => bond._fixed); + if (fixedBonds.length !== 0) { + result.writeBondsArray(fixedBonds.reverse(), atoms[i]); + } + } + } + _extractSHEET(result) { + if (!this._source._sheets) { + return; + } + result.newTag('SHEET'); + const sheets = this._source._sheets; + for (let i = 0; i < sheets.length; i++) { + if (sheets[i]._strands) { + const strands = sheets[i]._strands; + for (let j = 0; j < strands.length; j++) { + result.newString(); + result.writeString(j + 1, 10, 8); + result.writeString(sheets[i]._name, 14, 12); + result.writeString(strands.length, 16, 15); + result.writeString(strands[j].init._type._name, 18, 20); + result.writeString(strands[j].init._chain._name, 22, 22); + result.writeString(strands[j].init._sequence, 26, 23); + result.writeString(strands[j].init._icode, 27, 27); + result.writeString(strands[j].term._type._name, 29, 31); + result.writeString(strands[j].init._chain._name, 33, 33); + result.writeString(strands[j].term._sequence, 37, 34); + result.writeString(strands[j].term._icode, 38, 38); + result.writeString(strands[j].sense, 40, 39); } } - }, 10); - }; - - Miew.prototype.changeUnit = function (unitIdx, name) { - var visual = this._getComplexVisual(name); - - if (!visual) { - throw new Error('There is no complex to change!'); } - - function currentUnitInfo() { - var unit = visual ? visual.getComplex().getCurrentUnit() : 0; - var type = unit > 0 ? "Bio molecule ".concat(unit) : 'Asymmetric unit'; - return "Current unit: ".concat(unit, " (").concat(type, ")"); + } + _extractHELIX(result) { + if (!this._source._helices) { + return; } - - if (unitIdx === undefined) { - return currentUnitInfo(); + result.newTag('HELIX'); + const helices = this._source._helices; + for (let i = 0; i < helices.length; i++) { + const helix = helices[i]; + const helixClass = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().invert(typeByPDBHelixClass); + result.newString(); + result.writeString(helix.serial, 10, 8); + result.writeString(helix.name, 14, 12); + result.writeString(helix.init._type._name, 16, 18); + result.writeString(helix.init._chain._name, 20, 20); + result.writeString(helix.init._sequence, 25, 22); + result.writeString(helix.init._icode, 26, 26); + result.writeString(helix.term._type._name, 28, 30); + result.writeString(helix.term._chain._name, 32, 32); + result.writeString(helix.term._sequence, 37, 34); + result.writeString(helix.term._icode, 38, 38); + result.writeString(helixClass[helix.type], 40, 39); + result.writeString(helix.comment, 41, 70); + result.writeString(helix.length, 76, 72); } - - if (_.isString(unitIdx)) { - unitIdx = Math.max(parseInt(unitIdx, 10), 0); + } + _extractATOM(result) { + if (!this._source._atoms) { + return; } - - if (visual.getComplex().setCurrentUnit(unitIdx)) { - this._resetScene(); - - this._updateInfoPanel(); + const atoms = this._source._atoms; + for (let i = 0; i < atoms.length; i++) { + const tag = atoms[i].het ? 'HETATM' : 'ATOM'; + result.newString(tag); + const startIndx = atoms[i].element.name.length > 1 || atoms[i].name.length > 3 ? 13 : 14; + result.writeString(atoms[i].serial, 11, 7); + result.writeString(atoms[i].name, startIndx, 16); + result.writeString(String.fromCharCode(atoms[i].location), 17, 17); + result.writeString(atoms[i].residue._type._name, 20, 18); + result.writeString(atoms[i].residue._chain._name, 22, 22); + result.writeString(atoms[i].residue._sequence, 26, 23); + result.writeString(atoms[i].residue._icode, 27, 27); + result.writeString(atoms[i].position.x.toFixed(3), 38, 31); + result.writeString(atoms[i].position.y.toFixed(3), 46, 39); + result.writeString(atoms[i].position.z.toFixed(3), 54, 47); + result.writeString(atoms[i].occupancy.toFixed(2), 60, 55); + result.writeString(atoms[i].temperature.toFixed(2), 66, 61); + result.writeString(atoms[i].element.name, 78, 77); + if (atoms[i].charge) { + result.writeString(atoms[i].charge, 79, 80); + } + } + } + _extractCOMPND(result) { + if (!this._source._molecules) { + return; + } + const molecules = this._source._molecules; + result.newTag('COMPND', true); + for (let i = 0; i < molecules.length; i++) { + const chains = this._getMoleculeChains(molecules[i]); + result.newString(); + result.writeString(`MOL_ID: ${molecules[i].index};`, 11, 80); + result.newString(); + result.writeString(`MOLECULE: ${molecules[i].name};`, 11, 80); + result.newString(); + result.writeString('CHAIN: ', 11, 18); + const chainsString = `${chains.join(', ')};`; + result.writeEntireString(chainsString, 81); + } + } + _extractREMARK(result) { + this._Remark290(result); + this._Remark350(result); + } + _Remark290(result) { + if (!this._source.symmetry) { + return; + } + if (this._source.symmetry.length !== 0) { + const matrices = this._source.symmetry; + result.newTag('REMARK', 290); + result.newString(); + result.newString(); + result.writeEntireString(this._stringForRemark290); + result.writeMatrices(matrices, 'SMTRY'); + result.newString(); + result.newString(); + result.writeString('REMARK: NULL', 11, 80); + } + } + _Remark350(result) { + if (!this._source.units) { + return; + } + const { + units + } = this._source; + let biomolIndx = 0; + result.newTag('REMARK', 350); + result.newString(); + result.newString(); + result.writeEntireString(this._stringForRemark350); + const assemblies = units.filter(unit => unit instanceof chem_Assembly); + for (let i = 0; i < assemblies.length; i++) { + result.newString(); + result.newString(); + biomolIndx++; + result.writeString(`BIOMOLECULE: ${biomolIndx}`, 11, 80); + const chains = assemblies[i].chains.join(', '); + result.newString(); + result.writeString('APPLY THE FOLLOWING TO CHAINS: '); + result.writeEntireString(chains, 69, { + tag: 'AND CHAINS: ', + begin: 31, + end: 42 + }); + const { + matrices + } = assemblies[i]; + result.writeMatrices(matrices, 'BIOMT'); + } + } + _getMoleculeChains(molecule) { + function getChainName(residue) { + return residue._chain._name; + } + const chainNames = molecule.residues.map(getChainName); + return chainNames.filter((item, pos) => chainNames.indexOf(item) === pos); + } +} +PDBExporter.formats = ['pdb']; +PDBExporter.SourceClass = chem_Complex; +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBXModel.js + +const FBX_POS_SIZE = 3; +const FBX_NORM_SIZE = 3; +const FBX_COL_SIZE = 4; +function copyFbxPoint3(src, srcIdx, dst, dstIdx) { + dst[dstIdx] = src[srcIdx]; + dst[dstIdx + 1] = src[srcIdx + 1]; + dst[dstIdx + 2] = src[srcIdx + 2]; +} +function copyFbxPoint4(src, srcIdx, dst, dstIdx, value) { + dst[dstIdx] = src[srcIdx]; + dst[dstIdx + 1] = src[srcIdx + 1]; + dst[dstIdx + 2] = src[srcIdx + 2]; + dst[dstIdx + 3] = value; +} +const vector4 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector4(); +function copyTransformedPoint3(src, srcIdx, dst, dstIdx, opts) { + vector4.set(src[srcIdx], src[srcIdx + 1], src[srcIdx + 2], opts.w); + vector4.applyMatrix4(opts.matrix); + dst[dstIdx] = vector4.x; + dst[dstIdx + 1] = vector4.y; + dst[dstIdx + 2] = vector4.z; +} +function setSubArray(src, dst, count, copyFunctor, functorOpts) { + if ((dst.array.length - dst.start) / dst.stride < count || (src.array.length - src.start) / src.stride < count) { + return; // we've got no space + } + if (src.stride === dst.stride) { + // stride is the same + dst.array.set(src.array, dst.start); + } else { + let idx = dst.start; + let arridx = src.start; + for (let i = 0; i < count; ++i, idx += dst.stride, arridx += src.stride) { + copyFunctor(src.array, arridx, dst.array, idx, functorOpts); + } + } +} +class FBXModel { + constructor() { + this.positions = null; + this.normals = null; + this.colors = null; + this.indices = null; + this.lastPos = 0; + this.lastNorm = 0; + this.lastCol = 0; + this.lastIdx = 0; + } + init(vertsCount, indsCount) { + this.positions = new Float32Array(vertsCount * FBX_POS_SIZE); + this.normals = new Float32Array(vertsCount * FBX_NORM_SIZE); + this.colors = new Float32Array(vertsCount * FBX_COL_SIZE); + this.indices = new Int32Array(indsCount); + } + setPositions(array, start, count, stride) { + const src = { + array, + start, + stride + }; + const dst = { + array: this.positions, + start: this.lastPos, + stride: FBX_POS_SIZE + }; + setSubArray(src, dst, count, copyFbxPoint3); + this.lastPos += count * FBX_POS_SIZE; + } + setTransformedPositions(array, start, count, stride, matrix) { + let idx = this.lastPos; + let arrIdx = start; + const opts = { + matrix, + w: 1 + }; + for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_POS_SIZE) { + copyTransformedPoint3(array, arrIdx, this.positions, idx, opts); + } + this.lastPos += count * FBX_POS_SIZE; + } + setNormals(array, start, count, stride) { + const src = { + array, + start, + stride + }; + const dst = { + array: this.normals, + start: this.lastNorm, + stride: FBX_NORM_SIZE + }; + setSubArray(src, dst, count, copyFbxPoint3); + this.lastNorm += count * FBX_NORM_SIZE; + } + setTransformedNormals(array, start, count, stride, matrix) { + let idx = this.lastNorm; + let arrIdx = start; + const opts = { + matrix, + w: 0 + }; + for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_NORM_SIZE) { + copyTransformedPoint3(array, arrIdx, this.normals, idx, opts); } + this.lastNorm += count * FBX_NORM_SIZE; + } + setColors(array, start, count, stride) { + const src = { + array, + start, + stride + }; + const dst = { + array: this.colors, + start: this.lastCol, + stride: FBX_COL_SIZE + }; + setSubArray(src, dst, count, copyFbxPoint4, 1); + this.lastCol += count * FBX_COL_SIZE; + } + setIndices(array, start, count) { + this.indices.set(array, this.lastIdx); + this.lastIdx += count; + } + setShiftedIndices(array, count, shift) { + const shifted = array.map(x => x + shift); + this.setIndices(shifted, 0, count); + } + getVerticesNumber() { + return this.lastPos / FBX_POS_SIZE; + } + addInstance(matrix, geo) { + // add indices at first to take old number of vertices for shift + const currentCount = this.getVerticesNumber(); + this.setShiftedIndices(geo.indices, geo.indices.length, currentCount); + // simply write vertices at empty space + const size = geo.itemSize; + this.setTransformedPositions(geo.positions, 0, geo.vertsCount, size.position, matrix); + this.setTransformedNormals(geo.normals, 0, geo.vertsCount, size.normal, matrix); + this.setColors(geo.colors, 0, geo.vertsCount, size.color); + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBXGeometry.js +/** Base class for fbx geometry contains simply organized attributes: positions+normals+colors, indices. */ +class FBXGeometry { + /** + * Create a base geo with necessary members. + */ + constructor() { + this.positions = null; + this.normals = null; + this.colors = null; + this.indices = null; + this.vertsCount = 0; + this.itemSize = null; + } - return currentUnitInfo(); - }; /** - * Start to rebuild geometry asynchronously. + * Initialize base geo storing items info from attributes. + * @param {Object} geo - THREE.BufferGeometry. */ + init(geo, _info) { + const { + attributes + } = geo; + // save item size + this.itemSize = { + position: attributes.position.itemSize, + normal: attributes.normal.itemSize, + color: attributes.color.itemSize + }; + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBX1CGeometry.js - Miew.prototype.rebuild = function () { - var _this5 = this; +/** + * Fbx geometry, that copies positions+normals, indexes and creates colors filled with defined value. + * @extends FBXGeometry + */ +class FBX1CGeometry extends FBXGeometry { + /** + * Initialize geo storing positions, normals, indices and create colors. + * @param {Object} geo - THREE.BufferGeometry. + */ + init(geo, _info) { + super.init(geo, _info); + const { + attributes: { + position, + normal + }, + index + } = geo; + // copy vertices attributes + this.vertsCount = position.count; + this.positions = position.array; + this.normals = normal.array; + // create color array + this.colors = new Float32Array(this.vertsCount * this.itemSize.color); + // indices + this.indices = index.array; + } - if (this._building) { - this.logger.warn('Miew.rebuild(): already building!'); - return; + /** + * Set defined color for all items in color attribute + * @param {Object} color - THREE.Color. + */ + setColors(color) { + let offset = 0; + for (let i = 0, l = this.colors.length, cl = this.itemSize.color; i < l; i += cl) { + this.colors[offset++] = color.r; + this.colors[offset++] = color.g; + this.colors[offset++] = color.b; } + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBX2CCylinder.js + + +/** + * Fbx geometry, that copies positions+normals, indexes from cylinder geometry and creates colors filled with two + * defined values. + * @extends FBXGeometry + */ +class FBX2CCylinder extends FBXGeometry { + constructor() { + super(); + this._cutRawStart = 0; + this._cutRawEnd = 0; + this._facesPerSlice = 0; + } - this._building = true; - this.dispatchEvent({ - type: 'rebuilding' - }); - - this._rebuildObjects(); - - this._gfx.renderer2d.reset(); - - var rebuildActions = []; - - this._forEachComplexVisual(function (visual) { - if (visual.needsRebuild()) { - rebuildActions.push(visual.rebuild().then(function () { - return new Promise(function (resolve) { - visual.rebuildSelectionGeometry(); - resolve(); - }); - })); - } - }); // Start asynchronous rebuild - - - var self = this; - - this._spinner.spin(this._container); + /** + * Initialize geo by creating new attributes, because we extend number of vertices to make cylinder two-colored. + * Indices remain the same. We process open- end close-ended cylinders and consider cylinders od 2 segments + * in height ONLY. + * NOTE: cylinder consists of 2 height segments and stores parts in the order: tube, topCap, bottomCap + * @param {Object} geo - THREE.BufferGeometry. + * @param {Object} info - information needed for geo extend + */ + init(geo, info) { + super.init(geo, info); + const { + attributes: { + position + }, + index + } = geo; + // extend vertices arrays + this.vertsCount = position.count + info.addPerCylinder; + this._facesPerSlice = info.addPerCylinder; + this.positions = new Float32Array(this.vertsCount * position.itemSize); + this.normals = new Float32Array(this.vertsCount * this.itemSize.normal); + this.colors = new Float32Array(this.vertsCount * this.itemSize.color); + this._extendVertices(geo, info); + // number of indices stays the same + this.indices = new Uint32Array(index.count); + this._extendIndices(geo, info); + } - Promise.all(rebuildActions).then(function () { - self._spinner.stop(); + /** Extend vertex attributes to have one more slice to make sharp middle startColor-endColor line. */ + _extendVertices(geo, info) { + const { + position + } = geo.attributes; + const { + normal + } = geo.attributes; + const geoParams = geo.getGeoParams(); + const cutRaw = 1; // we expect cylinders of 2 segments in height => so half segment = 1 + this._cutRawStart = cutRaw * geoParams.radialSegments; + this._cutRawEnd = this._cutRawStart + info.addPerCylinder; + { + // write first half of cylinder + let temp = position.array.slice(0, this._cutRawEnd * position.itemSize); + this.positions.set(temp, 0); + temp = normal.array.slice(0, this._cutRawEnd * normal.itemSize); + this.normals.set(temp, 0); + } + { + // write second part of cylinder + let temp = position.array.slice(this._cutRawStart * position.itemSize, position.array.length); + this.positions.set(temp, this._cutRawEnd * position.itemSize); + temp = normal.array.slice(this._cutRawStart * normal.itemSize, normal.array.length); + this.normals.set(temp, this._cutRawEnd * normal.itemSize); + } + } - self._needRender = true; + /** Shift values of second part (+caps) indices by newly added vertices count. Number of faces remains the same. */ + _extendIndices(geo, info) { + const { + index + } = geo; + const indicesPerQuad = 6; // quad = 2 triangles => 6 indices + const startToShift = info.addPerCylinder * indicesPerQuad; + const shift = info.addPerCylinder; + let shifted = index.array.slice(startToShift, index.count); + shifted = shifted.map(x => x + shift); // shift only the endings + this.indices.set(index.array, 0); + this.indices.set(shifted, startToShift); + } - self._refreshTitle(); + /** + * Set defined colors: (first part + bottom cap), (second part + top cap) + * @param {number} start - start color index + * @param {number} end - start color index + * @param {array} array - array of colors + * @param {array} color - color value components + */ + _setColorRange(start, end, array, color) { + const colorSize = color.length; + for (let i = start; i < end; i += colorSize) { + array.set(color, i); + } + } - _this5.dispatchEvent({ - type: 'buildingDone' - }); + /** + * Set defined colors: (first part + bottom cap), (second part + top cap) + * @param {Object} color1 - THREE.Color. + * @param {Object} color2 - THREE.Color. + */ + setColors(color1, color2) { + const colorSize = this.itemSize.color; + const part1End = this._cutRawEnd * colorSize; + const part2End = part1End * 2; + this._setColorRange(0, part1End, this.colors, color1.toArray()); + this._setColorRange(part1End, part2End, this.colors, color2.toArray()); + if (part2End < this.colors.length) { + // cylinder has caps, lets paint them + const capSize = (this._facesPerSlice + 1) * colorSize; + const cap1End = part2End + capSize; + this._setColorRange(part2End, cap1End, this.colors, color2.toArray()); + const cap2End = cap1End + capSize; // should be equal to this.colors.length; + this._setColorRange(cap1End, cap2End, this.colors, color1.toArray()); + } + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBXInfoExtractor.js - self._building = false; - }); - }; - /** Mark all representations for rebuilding */ - Miew.prototype.rebuildAll = function () { - this._forEachComplexVisual(function (visual) { - visual.setNeedsRebuild(); - }); - }; - Miew.prototype._refreshTitle = function (appendix) { - var title; - appendix = appendix === undefined ? '' : appendix; - var visual = this._getComplexVisual(); - if (visual) { - title = visual.getComplex().name; - var rep = visual.repGet(visual.repCurrent()); - title += rep ? " \u2013 ".concat(rep.mode.name, " Mode") : ''; - } else { - title = Object.keys(this._visuals).length > 0 ? 'Unknown' : 'No Data'; - } - title += appendix; - this.dispatchEvent({ - type: 'titleChanged', - data: title - }); - }; - Miew.prototype.setNeedRender = function () { - this._needRender = true; - }; - Miew.prototype._extractRepresentation = function () { - var _this6 = this; - var changed = []; - this._forEachComplexVisual(function (visual) { - if (visual.getSelectionCount() === 0) { - return; - } - var selector = visual.buildSelectorFromMask(1 << visual.getSelectionBit()); - var defPreset = settings.now.presets["default"]; - var res = visual.repAdd({ - selector: selector, - mode: defPreset[0].mode.id, - colorer: defPreset[0].colorer.id, - material: defPreset[0].material.id - }); +class FBXInfoExtractor { + constructor() { + this._materials = []; + this._models = []; + } + process(data) { + this._extractModelsAndMaterials(data); + const models = this._flattenModels(); + return { + name: data.name, + models, + materials: this._materials + }; + } - if (!res) { - if (visual.repCount() === ComplexVisual.NUM_REPRESENTATION_BITS) { - _this6.logger.warn("Number of representations is limited to ".concat(ComplexVisual.NUM_REPRESENTATION_BITS)); + /** + * Extract fbx object information from ComplexVisual + * @param {object} data - complexVisual to get geometry info from + */ + _extractModelsAndMaterials(data) { + const layersOfInterest = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Layers(); + layersOfInterest.set(gfxutils.LAYERS.DEFAULT); + layersOfInterest.enable(gfxutils.LAYERS.TRANSPARENT); + data.traverse(object => { + if (object instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh && object.layers.test(layersOfInterest) && this.checkExportAbility(object)) { + if (object.geometry.type === 'InstancedBufferGeometry') { + this._collectInstancedGeoInfo(object); + } else { + this._collectGeoInfo(object); } - - return; } - - _this6.dispatchEvent({ - type: 'repAdded', - index: res.index, - name: visual.name - }); - - visual.repCurrent(res.index); - changed.push(visual.name); }); + } - if (changed.length > 0) { - this.logger.report("New representation from selection for complexes: ".concat(changed.join(', '))); + /** + * Reworking indices buffer, see https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/ + * basically, every triangle in Miew has been represented hat way (e.g.) : 0,1,7, but we must (for FBX) rework that + * into: 0,1,-8. + * @param {array} indices - belongs to [0, maxVertIndex] + */ + _reworkIndices(indices) { + const faceSize = 3; + for (let i = faceSize - 1; i < indices.length; i += faceSize) { + indices[i] *= -1; + indices[i]--; } - }; + } + /** - * Change current representation list. - * @param {array} reps - Representation list. + * Combine geometry from several models having the same material into one Model and finally prepare indices + * @returns {array} models, combined by material id */ + _flattenModels() { + let overallVertsCount = 0; + function shift(x) { + return x + overallVertsCount; + } + const combined = []; + // flatten models geometry + for (let i = 0, n = this._models.length; i < n; i++) { + const models = this._models[i]; + let indices = []; + let positions = []; + let normals = []; + let colors = []; + // reorganize every attributes as array of arrays + overallVertsCount = 0; + for (let j = 0; j < models.length; j++) { + const m = models[j]; + indices.push(m.indices.map(shift)); + overallVertsCount += m.getVerticesNumber(); + positions.push(m.positions); + normals.push(m.normals); + colors.push(m.colors); + } + // join all subarrays into one + indices = utils.mergeTypedArraysUnsafe(indices); + this._reworkIndices(indices); + positions = utils.mergeTypedArraysUnsafe(positions); + normals = utils.mergeTypedArraysUnsafe(normals); + colors = utils.mergeTypedArraysUnsafe(colors); + combined.push({ + indices, + positions, + normals, + colors, + verticesCount: overallVertsCount + }); + } + return combined; + } + /** + * Check ability to export the kind of mesh. + * @param {object} mesh - given mesh to check + * @returns {boolean} result of check + */ + checkExportAbility(mesh) { + // check mesh on not being empty + if (mesh.geometry.attributes.position.count === 0) { + return false; + } + // check type of mesh + // if (mesh.geometry.isInstancedBufferGeometry && settings.now.zSprites) { + if (mesh instanceof meshes_ZSpriteMesh) { + logger.warn('Currently we cannot export \'sprites\' modes, like BS, WV, LC. Please turn of settings \'zSprites\' and try again'); + return false; + } + if (mesh instanceof meshes_ThickLineMesh) { + logger.warn('Currently we cannot export Lines mode'); + return false; + } + return true; + } - Miew.prototype._setReps = function (reps) { - reps = reps || this._opts && this._opts.reps || []; + /** + * Save geometry info from common mesh, like Surface or Cartoon + */ + _collectGeoInfo(mesh) { + const { + geometry: { + attributes: { + position, + color, + normal + }, + index + }, + matrix + } = mesh; + const model = new FBXModel(); + const vertCount = position.count; + model.init(vertCount, index.count); + if (matrix.isIdentity()) { + model.setPositions(position.array, 0, vertCount, position.itemSize); + model.setNormals(normal.array, 0, vertCount, normal.itemSize); + } else { + model.setTransformedPositions(position.array, 0, vertCount, position.itemSize, matrix); + model.setTransformedNormals(normal.array, 0, vertCount, normal.itemSize, matrix); + } + model.setColors(color.array, 0, vertCount, color.itemSize); + model.setIndices(index.array, 0, index.count); + const material = this._collectMaterialInfo(mesh); + this._addToPool(model, material); + } - this._forEachComplexVisual(function (visual) { - return visual.resetReps(reps); - }); - }; /** - * Apply existing preset to current scene. - * @param preset + * Collect instanced spheres geometry and materials. + * @param {object} mesh - mesh with instanced spheres info */ + _collectSpheresInfo(mesh) { + const { + geometry: { + attributes: { + position, + color + }, + index + }, + matrix + } = mesh; + const model = new FBXModel(); + const instCount = mesh.geometry.instanceCount; + const vertCount = position.count; + const indsCount = index.count; + model.init(instCount * vertCount, instCount * indsCount); + const geo = new FBX1CGeometry(); + geo.init(mesh.geometry); + const instMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + const objMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + const sphereColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(); + for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) { + // update colors in geometry + const colorIdx = instanceIndex * color.itemSize; + sphereColor.fromArray(color.array, colorIdx); + geo.setColors(sphereColor); + // add instance to the model + this._getSphereInstanceMatrix(mesh.geometry, instanceIndex, instMatrix); + objMatrix.multiplyMatrices(matrix, instMatrix); + model.addInstance(objMatrix, geo); + } + const material = this._collectMaterialInfo(mesh); + this._addToPool(model, material); + } + /** + * Getting all instanced cylinders from given mesh. + * Divide cylinder (add additional vertexes) for prettiness therefore algorithm is a bit complicated + * @param {object} mesh - given mesh with instanced cylinders + */ + _collectCylindersInfo(mesh) { + const { + geometry: { + attributes: { + position, + color, + color2 + }, + index + }, + matrix + } = mesh; + const model = new FBXModel(); + const instCount = mesh.geometry.instanceCount; + const oneCCylinder = new FBX1CGeometry(); + oneCCylinder.init(mesh.geometry); + const splittingInfo = this._gatherCylindersColoringInfo(mesh.geometry); + let twoCCylinder = null; + if (splittingInfo.needToSplit > 0) { + twoCCylinder = new FBX2CCylinder(); + twoCCylinder.init(mesh.geometry, splittingInfo); + } + const additionalVertsCount = splittingInfo.addPerCylinder * splittingInfo.needToSplit; + const vertCount = position.count; + const indsCount = index.count; + model.init(instCount * vertCount + additionalVertsCount, instCount * indsCount); + const instMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + const objMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + const colorStart = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(); + const colorEnd = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(); + let geo = {}; + for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) { + // update colors in geometry + const colorIdx = instanceIndex * color.itemSize; + if (splittingInfo.is2Colored[instanceIndex]) { + // .color2 contains starting color, and .color contains starting color (see uber.frag ATTR_COLOR2) + colorStart.fromArray(color2.array, colorIdx); + colorEnd.fromArray(color.array, colorIdx); + if (twoCCylinder) { + twoCCylinder.setColors(colorStart, colorEnd); + geo = twoCCylinder; + } + } else { + // has one color per cylinder + colorStart.fromArray(color.array, colorIdx); + oneCCylinder.setColors(colorStart); + geo = oneCCylinder; + } + // add instance to the model + this._getCylinderInstanceMatrix(mesh.geometry, instanceIndex, instMatrix); + objMatrix.multiplyMatrices(matrix, instMatrix); + model.addInstance(objMatrix, geo); + } + const material = this._collectMaterialInfo(mesh); + this._addToPool(model, material); + } - Miew.prototype.applyPreset = function (preset) { - var presets = settings.now.presets; - var presList = [preset || settings.defaults.preset, settings.defaults.preset, Object.keys(presets)[0]]; - var reps = null; + /** + * Adding model to pool of models or extend existing ones + * @param {object} model - model to add + * @param {object} material - material to add + */ + _addToPool(model, material) { + const materialIdx = this._checkExistingMaterial(material); + if (materialIdx < 0) { + // new model-material pair + this._models.push([model]); + this._materials.push(material); + } else { + // add model to existing model-material pair + const models = this._models[materialIdx]; + models.push(model); + } + } - for (var i = 0; !reps && i < presList.length; ++i) { - settings.set('preset', presList[i]); - reps = presets[settings.now.preset]; + /** + * Checking if given material already was registered in materials pool (no need to create new one) + * @param {object} material - given material + * @returns {number} number of model-material pair + */ + _checkExistingMaterial(material) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().findIndex(this._materials, m => external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEqual(m, material)); + } + _gatherCylindersColoringInfo(geo) { + const instCount = geo.instanceCount; + const color1 = geo.attributes.color.array; + const color2 = geo.attributes.color2.array; + const stride = geo.attributes.color.itemSize; + const is2Colored = new Array(instCount); + // analyze color instance attributes + let needToSplit = 0; + let colIdx = 0; + for (let i = 0; i < instCount; i++, colIdx += stride) { + const differs = Math.abs(color1[colIdx] - color2[colIdx]) > 0.0000001 // compare ending colors + || Math.abs(color1[colIdx + 1] - color2[colIdx + 1]) > 0.0000001 || Math.abs(color1[colIdx + 2] - color2[colIdx + 2]) > 0.0000001; + is2Colored[i] = differs; + needToSplit += differs; // count number of 2-colored cylinders + } + // calc number of vertices to add into 2-colored + const geoParams = geo.getGeoParams(); + const addPerCylinder = geoParams.radialSegments; + return { + is2Colored, + needToSplit, + addPerCylinder + }; + } - if (!reps) { - this.logger.warn("Unknown preset \"".concat(settings.now.preset, "\"")); - } + /** + * Collect instanced models and materials. + * @param {object} mesh - given mesh with instanced something (spheres or cylinders) + */ + _collectInstancedGeoInfo(mesh) { + if (mesh.geometry instanceof geometries_InstancedSpheresGeometry) { + this._collectSpheresInfo(mesh); + } else if (mesh.geometry instanceof geometries_Instanced2CCylindersGeometry) { + this._collectCylindersInfo(mesh); } + } + + /** + * Collect Material info from given mesh. + * @param {object} mesh - given mesh with material info + * @returns {object} material + */ + _collectMaterialInfo(mesh) { + const { + uberOptions + } = mesh.material; + return { + diffuse: uberOptions.diffuse.toArray(), + opacity: uberOptions.opacity, + shininess: uberOptions.shininess, + specular: uberOptions.specular.toArray() + }; + } + _getCylinderInstanceMatrix(geo, instIdx, matrix) { + const matVector1 = geo.attributes.matVector1.array; + const matVector2 = geo.attributes.matVector2.array; + const matVector3 = geo.attributes.matVector3.array; + const idxOffset = instIdx * 4; // used 4 because offset arrays are stored in quads + matrix.set(matVector1[idxOffset], matVector1[idxOffset + 1], matVector1[idxOffset + 2], matVector1[idxOffset + 3], matVector2[idxOffset], matVector2[idxOffset + 1], matVector2[idxOffset + 2], matVector2[idxOffset + 3], matVector3[idxOffset], matVector3[idxOffset + 1], matVector3[idxOffset + 2], matVector3[idxOffset + 3], 0, 0, 0, 1); + } + _getSphereInstanceMatrix(geo, instIdx, matrix) { + const { + offset + } = geo.attributes; + const idx = instIdx * offset.itemSize; + const x = offset.array[idx]; + const y = offset.array[idx + 1]; + const z = offset.array[idx + 2]; + const scale = offset.array[idx + 3]; + matrix.set(scale, 0, 0, x, 0, scale, 0, y, 0, 0, scale, z, 0, 0, 0, 1); + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBXResult.js +// Forming default definitions block +const defaultDefinitions = ` +Definitions: { + Version: 100 + Count: 3 + ObjectType: "Model" { + Count: 1 + } + ObjectType: "Geometry" { + Count: 1 + } + ObjectType: "Material" { + Count: 1 + } + ObjectType: "Pose" { + Count: 1 + } + ObjectType: "GlobalSettings" { + Count: 1 + } +} `; + +// Default model properties +const defaultProperties = `Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A",1 + Property: "Lcl Translation", "Lcl Translation", "A",0.000000000000000,0.000000000000000,-1789.238037109375000 + Property: "Lcl Rotation", "Lcl Rotation", "A",0.000009334667643,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A+",0,0,0 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + }`; + +// Default materials layer +const defaultMaterialLayer = ` + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "AllSame" + ReferenceInformationType: "Direct" + Materials: 0 + }`; + +// Default layers block +const defaultLayerBlock = ` + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementColor" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + }`; + +/** + * globalSettings info in output file. + */ +const globalSettings = `GlobalSettings: { + Version: 1000 + Properties60: { + Property: "UpAxis", "int", "",1 + Property: "UpAxisSign", "int", "",1 + Property: "FrontAxis", "int", "",2 + Property: "FrontAxisSign", "int", "",1 + Property: "CoordAxis", "int", "",0 + Property: "CoordAxisSign", "int", "",1 + Property: "UnitScaleFactor", "double", "",1 + } + }`; +class FBXResult { + constructor() { + this._resultArray = []; + this._info = null; + } + getResult(info) { + this._info = info; + this._resultArray.push(this._writeHeader()); + this._resultArray.push(this._writeDefinitions()); + this._resultArray.push(this._writeObjects(info.models, info.materials)); + this._resultArray.push(this._writeRelations()); + this._resultArray.push(this._writeConnections()); // connections between models and materials) + this._info = null; + return this._resultArray.join(''); + } - this._setReps(reps); - }; /** - * Reset current representation list to initial values. - * @param {string} [preset] - The source preset in case of uninitialized representation list. + * Add FBXHeader info to output file. + * Some fields are really confusing, but it seems that all listed fields are very informative */ + _writeHeader() { + const FBXHeaderVersion = 1003; // 1003 is some number which appears to present in many 6.1 ASCII files + const FBXVersion = 6100; // Mandatory and only supported version + const date = new Date(); + const timeStampVersion = 1000; + const creator = `Miew FBX Exporter v${this._info.version}`; // Supposed to be an engine + + return `; FBX 6.1.0 project file +; Created by ${creator} Copyright (c) 2015-2024 EPAM Systems, Inc. +; For support please contact miew@epam.com +; ---------------------------------------------------- + +FBXHeaderExtension: { + FBXHeaderVersion: ${FBXHeaderVersion} + FBXVersion: ${FBXVersion} + CreationTimeStamp: { + Version: ${timeStampVersion} + Year: ${date.getFullYear()} + Month: ${date.getMonth() + 1} + Day: ${date.getDate()} + Hour: ${date.getHours()} + Minute: ${date.getMinutes()} + Second: ${date.getSeconds()} + Millisecond: ${date.getMilliseconds()} + } + Creator: "${creator}" + OtherFlags: { + FlagPLE: 0 + } +} +CreationTime: "${date}" +Creator: "${creator}" +`; + } - - Miew.prototype.resetReps = function (preset) { - var reps = this._opts && this._opts.reps; - - if (reps) { - this._setReps(reps); - } else { - this.applyPreset(preset); - } - }; /** - * Get number of representations created so far. - * @returns {number} Number of reps. + * Add Definitions info to output file. + * Not exactly sure if this section is template section (as it is in 7.4+) or it should every time be like this */ + _writeDefinitions() { + return ` +; Object definitions +;------------------------------------------------------------------ +${defaultDefinitions} +`; + } - Miew.prototype.repCount = function (name) { - var visual = this._getComplexVisual(name); - - return visual ? visual.repCount() : 0; - }; /** - * Get or set the current representation index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. - * @param {string=} [name] - Complex name. Defaults to the current one. - * @returns {number} The current index. + * Adding gathered information about Models to resulting string. + * Reminder - there may be more then 1 model in scene, but we must place materials after ALL models. + * @returns {string} string containing all models (vertices, indices, colors, normals etc) */ + _models() { + const modelVersion = 232; + let allModels = ''; + const { + models + } = this._info; + for (let i = 0; i < models.length; ++i) { + const model = models[i]; + const vertCount = model.verticesCount; + allModels += ` + Model: "Model::${this._info.name}_${i}", "Mesh" { + Version: ${modelVersion} + ${defaultProperties} + ${this._verticesIndices(model.positions, model.indices)} + ${this._normalLayer(model.normals)} + ${this._colorLayer(model.colors, vertCount)} + ${defaultMaterialLayer} + ${defaultLayerBlock} + }`; + } + return allModels; + } - - Miew.prototype.repCurrent = function (index, name) { - var visual = this._getComplexVisual(name); - - var newIdx = visual ? visual.repCurrent(index) : -1; - - if (index && newIdx !== index) { - this.logger.warn("Representation ".concat(index, " was not found. Current rep remains unchanged.")); - } - - return newIdx; - }; /** - * Get or set representation by index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one. - * @param {object=} rep - Optional representation description. - * @param {string=} rep.selector - Selector string. - * @param {string=} rep.mode - Mode id. - * @param {string=} rep.colorer - Colorer id. - * @param {string=} rep.material - Material id. - * @returns {?object} Representation description. + * Add Material info to result */ + _materials() { + const materialVersion = 102; + let allMaterials = ''; + const { + materials + } = this._info; + for (let i = 0; i < materials.length; ++i) { + const material = materials[i]; + allMaterials += ` + Material: "Material::${this._info.name}_${i}_default", "" { + Version: ${materialVersion} + ShadingModel: "lambert" + MultiLayer: 0 + ${this._materialProperties(material)} + }`; + } + return allMaterials; + } - - Miew.prototype.rep = function (index, rep) { - var visual = this._getComplexVisual(''); - - if (!visual) { - return null; - } - - var res = visual.rep(index, rep); - - if (res.status === 'created') { - this.dispatchEvent({ - type: 'repAdded', - index: res.index, - name: visual.name - }); - } else if (res.status === 'changed') { - this.dispatchEvent({ - type: 'repChanged', - index: res.index, - name: visual.name - }); - } - - return res.desc; - }; /** - * Get representation (not just description) by index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one. - * @returns {?object} Representation. + * Add Objects info to output file. */ + _writeObjects() { + return ` +; Object properties +;------------------------------------------------------------------ + +Objects: { + ${this._models()} + ${this._materials()} + ${globalSettings} +} +`; + } - - Miew.prototype.repGet = function (index, name) { - var visual = this._getComplexVisual(name); - - return visual ? visual.repGet(index) : null; - }; /** - * Add new representation. - * @param {object=} rep - Representation description. - * @returns {number} Index of the new representation. + * Add Relations info to output file. */ + _writeRelations() { + let modelsList = ''; + for (let i = 0; i < this._info.models.length; ++i) { + modelsList += ` + Model: "Model::${this._info.name}_${i}", "Mesh" { + }`; + } + let materialList = ''; + for (let i = 0; i < this._info.materials.length; ++i) { + materialList += ` + Material: "Material::${this._info.name}_${i}_default", "" { + }`; + } + return ` +; Object relations +;------------------------------------------------------------------ + +Relations: { + ${modelsList} + Model: "Model::Producer Perspective", "Camera" { + } + Model: "Model::Producer Top", "Camera" { + } + Model: "Model::Producer Bottom", "Camera" { + } + Model: "Model::Producer Front", "Camera" { + } + Model: "Model::Producer Back", "Camera" { + } + Model: "Model::Producer Right", "Camera" { + } + Model: "Model::Producer Left", "Camera" { + } + Model: "Model::Camera Switcher", "CameraSwitcher" { + } + ${materialList} +}`; + } + /** + * Add Connections info to output file. + */ + _writeConnections() { + let modelsList = ''; + const { + name + } = this._info; + for (let i = 0; i < this._info.models.length; ++i) { + modelsList += ` + Connect: "OO", "Model::${name}_${i}", "Model::Scene"`; + } + let materialList = ''; + for (let i = 0; i < this._info.materials.length; ++i) { + materialList += ` + Connect: "OO", "Material::${name}_${i}_default", "Model::${name}_${i}"`; + } + return ` +; Object connections +;------------------------------------------------------------------ + +Connections: { + ${modelsList} + ${materialList} +}`; + } - Miew.prototype.repAdd = function (rep, name) { - var visual = this._getComplexVisual(name); - - if (!visual) { - return -1; - } - - var res = visual.repAdd(rep); - - if (res) { - this.dispatchEvent({ - type: 'repAdded', - index: res.index, - name: name - }); - return res.index; + /** + * Write float array to string with limited precision + * @param {Float32Array} array - array to be fixed + * @returns {String} String with fixed floats + */ + _floatArrayToString(array) { + const str = []; + for (let i = 0; i < array.length; ++i) { + str[i] = array[i].toFixed(6); } + return str.join(','); + } - return -1; - }; /** - * Remove representation. - * @param {number=} index - Zero-based representation index. + * Adding color layer to resulting file + * @param {Float32Array} colorArray attribute + * @param {number} vertCount - number of vertices in the model + * @returns {string} color layer info */ + _colorLayer(colorArray, vertCount) { + const layerElementColorNumber = 0; + const layerElementColorVersion = 101; + const layerElementColorName = ''; + const colorsStr = this._floatArrayToString(colorArray); + // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed + // As said [..Array(...)] - fastest and easiest way to produce [0, 1, .....] array + const colorIndices = [...Array(vertCount).keys()]; + return ` + LayerElementColor: ${layerElementColorNumber} { + Version: ${layerElementColorVersion} + Name: "${layerElementColorName}" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Colors: ${colorsStr} + ColorIndex: ${colorIndices} + }`; + } - - Miew.prototype.repRemove = function (index, name) { - var visual = this._getComplexVisual(name); - - if (!visual) { - return; - } - - visual.repRemove(index); - this.dispatchEvent({ - type: 'repRemoved', - index: index, - name: name - }); - }; /** - * Hide representation. - * @param {number} index - Zero-based representation index. - * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default). + * Adding normal layer to resulting file + * @param {Float32Array} normalArray attribute + * @returns {string} normal layer info */ + _normalLayer(normalArray) { + const layerElementNormalNumber = 0; + const layerElementNormalVersion = 101; + const layerElementNormalName = ''; + const normalsStr = this._floatArrayToString(normalArray); + // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed + return ` + LayerElementNormal: ${layerElementNormalNumber} { + Version: ${layerElementNormalVersion} + Name: "${layerElementNormalName}" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: ${normalsStr} + }`; + } + /** + * Adding vertices and indices to resulting string + * @return {string} resulting string in FBX notation + */ + _verticesIndices(positions, indices) { + const multiLayer = 0; + const multiTake = 1; + const shading = 'Y'; + const culling = 'CullingOff'; + const geometryVersion = 124; + const vertStr = this._floatArrayToString(positions); + /* About _correctArrayNotation: Float32Arrays will contains only Float32 numbers, which implies that it will be floating points with 17 numbers after point. + * We cannot (and it's logically incorrect) save all this information, so we convert this Float32Array into Array-like object with numbers with only 6 numbers after point + * Reminder - this is big memory loss (as we must save at one moment two arrays with similar information) */ + return `MultiLayer: ${multiLayer} + MultiTake: ${multiTake} + Shading: ${shading} + Culling: "${culling}" + Vertices: ${vertStr} + PolygonVertexIndex: ${indices} + GeometryVersion: ${geometryVersion}`; + } - Miew.prototype.repHide = function (index, hide, name) { - this._needRender = true; + /** + * Forming material properties block. + * @param {Object} material - given material of model + * @returns {String} material properties string + */ + _materialProperties(material) { + return `Properties60: { + Property: "ShadingModel", "KString", "", "Lambert" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0,0,0 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",1,1,1 + Property: "AmbientFactor", "double", "",0.0000 + Property: "DiffuseColor", "ColorRGB", "",${material.diffuse} + Property: "DiffuseFactor", "double", "",1.0000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",${material.specular} + Property: "SpecularFactor", "double", "",1.0000 + Property: "ShininessExponent", "double", "",${material.shininess} + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Ambient", "ColorRGB", "",1,1,1 + Property: "Diffuse", "ColorRGB", "",${material.diffuse} + Property: "Specular", "ColorRGB", "",${material.specular} + Property: "Shininess", "double", "",${material.shininess} + Property: "Opacity", "double", "",${material.opacity} + Property: "Reflectivity", "double", "",0 + }`; + } +} +;// CONCATENATED MODULE: ./src/io/exporters/FBXExporter.js - var visual = this._getComplexVisual(name); - return visual ? visual.repHide(index, hide) : null; - }; - Miew.prototype._setEditMode = function (mode) { - this._editMode = mode; - var elem = this._msgMode; - if (elem) { - elem.style.opacity = mode === EDIT_MODE.COMPLEX ? 0.0 : 1.0; +class FBXExporter extends Exporter { + constructor(source, options) { + super(source, options); + // Data + this._data = source; + this._version = options.miewVersion || '0.0-UNSPECIFIED'; + this._extractor = new FBXInfoExtractor(); + } - if (mode !== EDIT_MODE.COMPLEX) { - var t = elem.getElementsByTagName('p')[0]; - t.innerHTML = mode === EDIT_MODE.COMPONENT ? 'COMPONENT EDIT MODE' : 'FRAGMENT EDIT MODE'; + /** + * Entry point to exporter. + */ + exportSync() { + // Creating mandatory blocks + const result = new FBXResult(); + if (!this._source) { + return this._result; + } + const info = this._extractor.process(this._data); + info.version = this._version; + this._result = result.getResult(info); + return this._result; + } +} +FBXExporter.formats = ['fbx']; +FBXExporter.SourceClass = src_ComplexVisual; +;// CONCATENATED MODULE: ./src/io/exporters.js + + + +/* harmony default export */ const exporters = (new exporters_ExporterList([PDBExporter, FBXExporter])); +;// CONCATENATED MODULE: ./src/io/io.js + + + +/* harmony default export */ const io = ({ + loaders: loaders, + parsers: parsers, + exporters: exporters +}); +;// CONCATENATED MODULE: ./src/gfx/CSS2DRenderer.js +/** + * @author mrdoob / http://mrdoob.com/ + */ + + + +const tempColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(); +class CSS2DRenderer { + constructor() { + this._width = 0; + this._height = 0; + this._widthHalf = 0; + this._heightHalf = 0; + this._vector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + this._viewMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + this._projectionMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + this._domElement = document.createElement('div'); + this._domElement.style.overflow = 'hidden'; + this._domElement.style.position = 'absolute'; + this._domElement.style.top = '0'; + this._domElement.style.zIndex = '0'; // start a new Stacking Context to enclose all z-ordered children + this._domElement.style.pointerEvents = 'none'; + } + getElement() { + return this._domElement; + } + reset() { + const myNode = this.getElement(); + while (myNode.firstChild) { + myNode.removeChild(myNode.firstChild); + } + } + setSize(width, height) { + this._width = width; + this._height = height; + this._widthHalf = this._width / 2; + this._heightHalf = this._height / 2; + this._domElement.style.width = `${width}px`; + this._domElement.style.height = `${height}px`; + } + _renderObject(object, camera, scene) { + function lerpColorAsHex(a, b, t) { + tempColor.setHex(a); + tempColor.lerp(b, t); + return `#${tempColor.getHexString()}`; + } + function colorAsHex(a) { + tempColor.setHex(a); + return `#${tempColor.getHexString()}`; + } + if (object instanceof gfx_CSS2DObject) { + this._vector.setFromMatrixPosition(object.matrixWorld); + if (object.userData !== undefined && object.userData.offset !== undefined) { + const localOffset = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(object.userData.offset.x, object.userData.offset.y, 0); + this._vector.add(localOffset.multiplyScalar(object.matrixWorld.getMaxScaleOnAxis())); + } + this._vector.applyMatrix4(this._viewMatrix); + const visibility = this._vector.z > -camera.near ? 'hidden' : 'visible'; + const zIndex = 10000 * (camera.far - -this._vector.z) / (camera.far - camera.near); + const element = object.getElement(); + if (typeof scene.fog === 'undefined') { + element.style.color = colorAsHex(object.userData.color); + if (object.userData.background !== 'transparent') { + element.style.background = colorAsHex(object.userData.background); + } + } else { + const fogFactor = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MathUtils.smoothstep(-this._vector.z, scene.fog.near, scene.fog.far); + element.style.color = lerpColorAsHex(object.userData.color, scene.fog.color, fogFactor); + if (object.userData.background !== 'transparent') { + element.style.background = lerpColorAsHex(object.userData.background, scene.fog.color, fogFactor); + } + } + this._vector.applyMatrix4(this._projectionMatrix); + const style = `${object.userData !== {} ? object.userData.translation : 'translate(-50%, -50%) '}translate(${this._vector.x * this._widthHalf + this._widthHalf}px,${-this._vector.y * this._heightHalf + this._heightHalf}px)`; + element.style.visibility = visibility; + element.style.WebkitTransform = style; + element.style.MozTransform = style; + element.style.oTransform = style; + element.style.transform = style; + element.style.zIndex = Number(zIndex).toFixed(0); + if (element.parentNode !== this._domElement) { + this._domElement.appendChild(element); } } - - this.dispatchEvent({ - type: 'editModeChanged', - data: mode === EDIT_MODE.COMPLEX - }); - }; - - Miew.prototype._enterComponentEditMode = function () { - if (this._editMode !== EDIT_MODE.COMPLEX) { - return; + for (let i = 0, l = object.children.length; i < l; i++) { + this._renderObject(object.children[i], camera, scene); } - - var editors = []; - - this._forEachComplexVisual(function (visual) { - var editor = visual.beginComponentEdit(); - - if (editor) { - editors.push(editor); + } + render(scene, camera) { + scene.updateMatrixWorld(); + if (camera.parent === null) { + camera.updateMatrixWorld(); + } + camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); + this._viewMatrix.copy(camera.matrixWorldInverse); + this._projectionMatrix.copy(camera.projectionMatrix); + this._renderObject(scene, camera, scene); + } +} +/* harmony default export */ const gfx_CSS2DRenderer = (CSS2DRenderer); +;// CONCATENATED MODULE: ./src/utils/getTopWindow.js +function getTopWindow() { + // intercept the exception if we have cross-origin iframe + try { + if (window.top.location.href !== undefined) { + return window.top; + } + } catch (e) { + // provide fallback + } + return window; +} +;// CONCATENATED MODULE: ./src/ui/ObjectControls.js + + + + + +const VK_LEFT = 37; +const VK_UP = 38; +const VK_RIGHT = 39; +const VK_DOWN = 40; +const STATE = { + NONE: -1, + ROTATE: 0, + TRANSLATE: 1, + SCALE: 2, + TRANSLATE_PIVOT: 3 +}; + +// pausing for this amount of time before releasing mouse button prevents inertial rotation (seconds) +const FULL_STOP_THRESHOLD = 0.1; +const quaternion = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Quaternion(); +const matrix4 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + +// pivot -- local offset of the rotation pivot point +function ObjectHandler(objects, camera, pivot, options) { + this.objects = objects; + [this.object] = objects; + this.camera = camera; + this.pivot = pivot; + this.axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 1); + this.options = options; + this.lastRotation = { + axis: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(), + angle: 0.0 + }; +} +ObjectHandler.prototype._rotate = function () { + const p = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const q = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Quaternion(); + const s = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const m = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + return function (quat) { + const zeroPivot = this.pivot.x === 0.0 && this.pivot.y === 0.0 && this.pivot.z === 0.0; + m.copy(this.object.matrix); + if (zeroPivot) { + m.multiply(matrix4.makeRotationFromQuaternion(quat)); + } else { + m.multiply(matrix4.makeTranslation(this.pivot.x, this.pivot.y, this.pivot.z)); + m.multiply(matrix4.makeRotationFromQuaternion(quat)); + m.multiply(matrix4.makeTranslation(-this.pivot.x, -this.pivot.y, -this.pivot.z)); + } + m.decompose(p, q, s); + + // update objects + if (!zeroPivot) { + for (let i = 0; i < this.objects.length; ++i) { + this.objects[i].position.copy(p); + } + } + for (let j = 0; j < this.objects.length; ++j) { + this.objects[j].quaternion.copy(q); + this.objects[j].updateMatrix(); + } + }; +}(); +ObjectHandler.prototype.setObjects = function (objects) { + this.objects = objects; + [this.object] = objects; +}; +ObjectHandler.prototype.rotate = function () { + const rot = { + axis: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(), + angle: 0.0 + }; + return function (quat, mousePrevPos, mouseCurPos, aboutAxis) { + this.mouse2rotation(rot, mousePrevPos, mouseCurPos, aboutAxis); + quat.setFromAxisAngle(rot.axis, rot.angle); + if (rot.angle) { + this._rotate(quat); + } + this.lastRotation = rot; + }; +}(); +ObjectHandler.prototype.translate = function () { + const dir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const pivot = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + return function (delta) { + // reverse-project viewport movement to view coords (compensate for screen aspect ratio) + dir.set(delta.x / this.camera.projectionMatrix.elements[0], delta.y / this.camera.projectionMatrix.elements[5], 0); + let dist = dir.length(); + dir.normalize(); + + // transform movement direction to object local coords + dir.transformDirection(matrix4.copy(this.object.matrixWorld).invert()); + + // visible translate distance shouldn't depend on camera-to-object distance + pivot.copy(this.pivot); + this.object.localToWorld(pivot); + dist *= Math.abs(pivot.z - this.camera.position.z); + + // visible translate distance shouldn't depend on object scale + dist /= this.object.matrixWorld.getMaxScaleOnAxis(); + + // all objects are translated similar to principal object + // (we assume they all have identical pivot and scale) + for (let i = 0; i < this.objects.length; ++i) { + this.objects[i].translateOnAxis(dir, dist); + } + }; +}(); +ObjectHandler.prototype.update = function () { + const axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + return function (timeSinceLastUpdate, timeSinceMove) { + if (settings.now.autoRotation !== 0.0) { + // auto-rotation with constant speed + + // if rotation axis is fixed or hasn't been defined yet + if (settings.now.autoRotationAxisFixed || this.lastRotation.axis.length() === 0.0) { + // use Y-axis (transformed to local object coords) + axis.set(0, 1, 0).transformDirection(matrix4.copy(this.object.matrixWorld).invert()); + } else { + // use axis defined by last user rotation + axis.copy(this.lastRotation.axis); } - }); - - if (editors === []) { - return; + this._rotate(quaternion.setFromAxisAngle(axis, settings.now.autoRotation * timeSinceLastUpdate)); + return true; } - - this._editors = editors; - this.logger.info('COMPONENT EDIT MODE -- ON'); - - this._setEditMode(EDIT_MODE.COMPONENT); - - this._objectControls.keysTranslateObj(true); + if (this.options.intertia && this.lastRotation.angle) { + // inertial object rotation + const angle = this.lastRotation.angle * (1.0 - this.options.dynamicDampingFactor) ** (40.0 * timeSinceMove); + if (Math.abs(angle) <= this.options.intertiaThreshold) { + this.lastRotation.angle = 0.0; + } else { + this._rotate(quaternion.setFromAxisAngle(this.lastRotation.axis, angle)); + return true; + } + } + return false; }; - - Miew.prototype._applyComponentEdit = function () { - if (this._editMode !== EDIT_MODE.COMPONENT) { - return; +}(); +ObjectHandler.prototype.stop = function () { + this.lastRotation.angle = 0.0; +}; + +// calculate (axis, angle) pair from mouse/touch movement +ObjectHandler.prototype.mouse2rotation = function () { + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const eye = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const eyeDirection = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const cameraUpDirection = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const cameraSidewaysDirection = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const moveDirection = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const mouseDelta = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(); + return function (rot, mousePrev, mouseCur, aboutAxis) { + if (aboutAxis) { + rot.axis.copy(this.axis); + rot.angle = this.options.axisRotateFactor * (mouseCur.y - mousePrev.y); + + /* cool method that allows rotation around Z axis to be "tied" to mouse cursor + res.axis.copy(this.axis); + var pivot = this.pivot.clone(); + this.object.localToWorld(pivot); + pivot.project(this.camera); + var v1 = new THREE.Vector3(mousePrev.x, mousePrev.y, this.camera.position.z); + v1.sub(pivot); + var v2 = new THREE.Vector3(mouseCur.x, mouseCur.y, this.camera.position.z); + v2.sub(pivot); + v1.sub(res.axis.clone().multiplyScalar(v1.dot(res.axis))); + v2.sub(res.axis.clone().multiplyScalar(v2.dot(res.axis))); + var abs = v1.length() * v2.length(); + if (abs > 0) { + res.angle = res.axis.dot(v1.cross(v2)) / abs; + } + */ + } else { + mouseDelta.subVectors(mouseCur, mousePrev); + const angle = mouseDelta.length(); + if (angle === 0.0) { + return; + } + center.copy(this.pivot); + this.object.localToWorld(center); + eye.subVectors(this.camera.position, center); + eyeDirection.copy(eye).normalize(); + cameraUpDirection.copy(this.camera.up).normalize(); + cameraSidewaysDirection.crossVectors(cameraUpDirection, eyeDirection).normalize(); + cameraUpDirection.setLength(mouseDelta.y); + cameraSidewaysDirection.setLength(mouseDelta.x); + moveDirection.copy(cameraUpDirection.add(cameraSidewaysDirection)); + rot.axis.crossVectors(moveDirection, eye); + rot.angle = -angle * this.options.rotateFactor; + } + rot.axis.transformDirection(matrix4.copy(this.object.matrixWorld).invert()); + + // make sure angle is always positive (thus 'axis' defines both axis and direction of rotation) + if (rot.angle < 0.0) { + rot.axis.negate(); + rot.angle = -rot.angle; + } + }; +}(); +function ObjectControls(object, objectPivot, camera, domElement, getAltObj) { + utils_EventDispatcher.call(this); + const self = this; + this.object = object; + this.objectPivot = objectPivot; + this.camera = camera; + this.domElement = typeof domElement !== 'undefined' ? domElement : document; + this.getAltObj = getAltObj; + + // API + + this.enabled = true; + this.hotkeysEnabled = true; + this.screen = { + left: 0, + top: 0, + width: 0, + height: 0 + }; + this.options = { + rotateFactor: Math.PI, + // full screen slide (along short side) would roughly mean 180 deg. rotation + axisRotateFactor: 4 * Math.PI, + // full screen slide (along short side) would roughly mean 720 deg. rotation + intertia: true, + dynamicDampingFactor: 0.1, + intertiaThreshold: 1e-3 + }; + + // internals + + this._state = STATE.NONE; + this._mousePrevPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(); + this._mouseCurPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(); + this._mainObj = new ObjectHandler([this.object], this.camera, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0), this.options); + this._altObj = new ObjectHandler([this.object], this.camera, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0), this.options); + this._affectedObj = this._mainObj; + this._isAltObjFreeRotationAllowed = true; + this._isTranslationAllowed = true; + this._isKeysTranslatingObj = false; + this._pressedKeys = []; + this._clock = new Timer(); + this._clock.start(); + this._lastUpdateTime = this._clock.getElapsedTime(); + + // events + this._listeners = [{ + obj: self.domElement, + type: 'mousedown', + handler(e) { + self.mousedown(e); } - - this._objectControls.stop(); - - this._objectControls.keysTranslateObj(false); - - for (var i = 0; i < this._editors.length; ++i) { - this._editors[i].apply(); + }, { + obj: self.domElement, + type: 'mouseup', + handler(e) { + self.mouseup(e); } - - this._editors = []; - this.logger.info('COMPONENT EDIT MODE -- OFF (applied)'); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this.rebuildAll(); + }, { + obj: self.domElement, + type: 'mousemove', + handler(e) { + self.mousemove(e); + } + }, { + obj: self.domElement, + type: 'mousewheel', + handler(e) { + self.mousewheel(e); + } + }, { + obj: self.domElement, + type: 'DOMMouseScroll', + handler(e) { + self.mousewheel(e); + } + }, { + obj: self.domElement, + type: 'mouseout', + handler(e) { + self.mouseup(e); + } + }, { + obj: self.domElement, + type: 'touchstart', + handler(e) { + self.touchstartend(e); + } + }, { + obj: self.domElement, + type: 'touchend', + handler(e) { + self.touchstartend(e); + } + }, { + obj: self.domElement, + type: 'touchmove', + handler(e) { + self.touchmove(e); + } + }, { + obj: self.getKeyBindObject(), + type: 'keydown', + handler(e) { + self.keydownup(e); + } + }, { + obj: self.getKeyBindObject(), + type: 'keyup', + handler(e) { + self.keydownup(e); + } + }, { + obj: window, + type: 'resize', + handler() { + self.handleResize(); + } + }, { + obj: window, + type: 'blur', + handler() { + self.resetKeys(); + } + }, { + obj: self.domElement, + type: 'contextmenu', + handler(e) { + self.contextmenu(e); + } + }]; + for (let i = 0; i < this._listeners.length; i++) { + const l = this._listeners[i]; + l.obj.addEventListener(l.type, l.handler); + } + this.handleResize(); + this.resetKeys(); + + // force an update at start + this.update(); +} + +// methods + +ObjectControls.prototype = Object.create(utils_EventDispatcher.prototype); +ObjectControls.prototype.constructor = ObjectControls; +ObjectControls.prototype.resetKeys = function () { + this._pressedKeys[VK_LEFT] = false; + this._pressedKeys[VK_UP] = false; + this._pressedKeys[VK_RIGHT] = false; + this._pressedKeys[VK_DOWN] = false; +}; +ObjectControls.prototype.contextmenu = function (e) { + e.stopPropagation(); + e.preventDefault(); +}; +ObjectControls.prototype.handleResize = function () { + if (this.domElement === document) { + this.screen.left = 0; + this.screen.top = 0; + this.screen.width = window.innerWidth; + this.screen.height = window.innerHeight; + } else { + const box = this.domElement.getBoundingClientRect(); + // adjustments come from similar code in the jquery offset() function + const d = this.domElement.ownerDocument.documentElement; + this.screen.left = box.left + window.pageXOffset - d.clientLeft; + this.screen.top = box.top + window.pageYOffset - d.clientTop; + this.screen.width = box.width; + this.screen.height = box.height; + } +}; +ObjectControls.prototype.enable = function (enable) { + this.enabled = enable; +}; +ObjectControls.prototype.enableHotkeys = function (enable) { + this.hotkeysEnabled = enable; +}; +ObjectControls.prototype.allowTranslation = function (allow) { + this._isTranslationAllowed = allow; +}; +ObjectControls.prototype.allowAltObjFreeRotation = function (allow) { + this._isAltObjFreeRotationAllowed = allow; +}; +ObjectControls.prototype.keysTranslateObj = function (on) { + this._isKeysTranslatingObj = on; +}; +ObjectControls.prototype.isEditingAltObj = function () { + return (this._state === STATE.ROTATE || this._state === STATE.TRANSLATE) && this._affectedObj === this._altObj; +}; + +// convert page coords of mouse/touch to uniform coords with smaller side being [-0.5, 0.5] +// (uniform coords keep direct proportion with screen distance travelled by mouse regardless of screen aspect ratio) +ObjectControls.prototype.convertMouseToOnCircle = function (coords, pageX, pageY) { + const screenSize = Math.min(this.screen.width, this.screen.height); + if (screenSize === 0) { + coords.set(0, 0); + return; + } + coords.set((pageX - this.screen.width * 0.5 - this.screen.left) / screenSize, (0.5 * this.screen.height + this.screen.top - pageY) / screenSize); +}; + +// convert page coords of mouse/touch to viewport coords with both sides being [-1, 1] +// (those are non-uniform coords affected by screen aspect ratio) +ObjectControls.prototype.convertMouseToViewport = function (coords, pageX, pageY) { + if (this.screen.width === 0 || this.screen.height === 0) { + coords.set(0, 0); + return; + } + coords.set(2.0 * (pageX - this.screen.width * 0.5 - this.screen.left) / this.screen.width, 2.0 * (0.5 * this.screen.height + this.screen.top - pageY) / this.screen.height); +}; +ObjectControls.prototype.stop = function () { + this._mainObj.stop(); + this._altObj.stop(); +}; + +// rotate object based on latest mouse/touch movement +ObjectControls.prototype.rotateByMouse = function () { + const quat = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Quaternion(); + return function (aboutZAxis) { + this._affectedObj.rotate(quat, this._mousePrevPos, this._mouseCurPos, aboutZAxis); + this.dispatchEvent({ + type: 'change', + action: 'rotate', + quaternion: quat + }); }; +}(); - Miew.prototype._discardComponentEdit = function () { - if (this._editMode !== EDIT_MODE.COMPONENT) { - return; - } +// rotate object by specified quaternion +ObjectControls.prototype.rotate = function (quat) { + this.object.quaternion.multiply(quat); + this.dispatchEvent({ + type: 'change', + action: 'rotate', + quaternion: quat + }); +}; + +// get object's orientation +ObjectControls.prototype.getOrientation = function () { + return this.object.quaternion; +}; + +// set object's orientation +ObjectControls.prototype.setOrientation = function (quat) { + this.object.quaternion.copy(quat); +}; + +// translate object based on latest mouse/touch movement +ObjectControls.prototype.translate = function () { + const delta = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(); + return function () { + delta.subVectors(this._mouseCurPos, this._mousePrevPos); + this._affectedObj.translate(delta); + this.dispatchEvent({ + type: 'change', + action: 'translate' + }); + }; +}(); - this._objectControls.stop(); +// get object scale +ObjectControls.prototype.getScale = function () { + return this.object.scale.x; +}; - this._objectControls.keysTranslateObj(false); +// set uniform object scale +ObjectControls.prototype.setScale = function (scale) { + this.object.scale.set(scale, scale, scale); +}; - for (var i = 0; i < this._editors.length; ++i) { - this._editors[i].discard(); +// scale object by factor (factor should be greater than zero) +ObjectControls.prototype.scale = function (factor) { + if (factor <= 0) { + return; + } + this.setScale(this.object.scale.x * factor); + this.dispatchEvent({ + type: 'change', + action: 'zoom', + factor + }); +}; +ObjectControls.prototype.update = function () { + const shift = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(); + return function () { + const curTime = this._clock.getElapsedTime(); + const timeSinceLastUpdate = curTime - this._lastUpdateTime; + + // update object handler + if (this._state === STATE.NONE) { + const timeSinceMove = curTime - this._lastMouseMoveTime; + if (this._mainObj.update(timeSinceLastUpdate, timeSinceMove) || this._altObj.update(timeSinceLastUpdate, timeSinceMove)) { + this.dispatchEvent({ + type: 'change', + action: 'auto' + }); + } } - this._editors = []; - this.logger.info('COMPONENT EDIT MODE -- OFF (discarded)'); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this._needRender = true; - this.rebuildAll(); - }; + // apply arrow keys + if (this._isKeysTranslatingObj) { + const speedX = Number(this._pressedKeys[VK_RIGHT]) - Number(this._pressedKeys[VK_LEFT]); + const speedY = Number(this._pressedKeys[VK_UP]) - Number(this._pressedKeys[VK_DOWN]); + if (speedX !== 0.0 || speedY !== 0.0) { + const delta = timeSinceLastUpdate; - Miew.prototype._enterFragmentEditMode = function () { - if (this._editMode !== EDIT_MODE.COMPLEX) { - return; + // update object translation + const altObj = this.getAltObj(); + if (altObj.objects.length > 0) { + this._altObj.setObjects(altObj.objects); + this._altObj.pivot = altObj.pivot; + if ('axis' in altObj) { + this._altObj.axis = altObj.axis.clone(); + } else { + this._altObj.axis.set(0, 0, 1); + } + shift.set(delta * speedX, delta * speedY); + this._altObj.translate(shift); + this.dispatchEvent({ + type: 'change', + action: 'translate' + }); + } + } } + this._lastUpdateTime = curTime; + }; +}(); +ObjectControls.prototype.reset = function () { + this._state = STATE.NONE; + this.object.quaternion.copy(quaternion.set(0, 0, 0, 1)); +}; - var selectedVisuals = []; +// listeners - this._forEachComplexVisual(function (visual) { - if (visual instanceof ComplexVisual && visual.getSelectionCount() > 0) { - selectedVisuals.push(visual); +ObjectControls.prototype.mousedown = function (event) { + if (this.enabled === false || this._state !== STATE.NONE) { + return; + } + event.preventDefault(); + event.stopPropagation(); + if (this._state === STATE.NONE) { + if (event.button === 0) { + this._affectedObj.stop(); // can edit only one object at a time + + let workWithAltObj = false; + if (event.altKey) { + const altObj = this.getAltObj(); + workWithAltObj = altObj.objects.length > 0; + if (workWithAltObj) { + this._altObj.setObjects(altObj.objects); + this._altObj.pivot = altObj.pivot; + if ('axis' in altObj) { + this._altObj.axis = altObj.axis.clone(); + } else { + this._altObj.axis.set(0, 0, 1); + } + } } - }); - - if (selectedVisuals.length !== 1) { - // either we have no selection or - // we have selected atoms in two or more visuals -- not supported - return; + this._affectedObj = workWithAltObj ? this._altObj : this._mainObj; + this._state = workWithAltObj && event.ctrlKey && this._isTranslationAllowed ? STATE.TRANSLATE : STATE.ROTATE; + } else if (event.button === 2) { + this._state = STATE.TRANSLATE_PIVOT; + } + } + if (this._state === STATE.ROTATE) { + this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY); + this._mousePrevPos.copy(this._mouseCurPos); + } + if (this._state === STATE.TRANSLATE || this._state === STATE.TRANSLATE_PIVOT) { + this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); + this._mousePrevPos.copy(this._mouseCurPos); + } +}; +ObjectControls.prototype.mousemove = function (event) { + if (this.enabled === false || this._state === STATE.NONE) { + return; + } + event.preventDefault(); + event.stopPropagation(); + switch (this._state) { + case STATE.ROTATE: + this._mousePrevPos.copy(this._mouseCurPos); + this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY); + this.rotateByMouse(event.altKey && !this._isAltObjFreeRotationAllowed || event.shiftKey); + this._lastMouseMoveTime = this._clock.getElapsedTime(); + break; + case STATE.TRANSLATE: + this._mousePrevPos.copy(this._mouseCurPos); + this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); + this.translate(); + break; + case STATE.TRANSLATE_PIVOT: + this._mousePrevPos.copy(this._mouseCurPos); + this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); + this.translatePivotByMouse(); + break; + default: + break; + } +}; +ObjectControls.prototype.mousewheel = function (event) { + if (this.enabled === false || !settings.now.zooming || this._state !== STATE.NONE || event.shiftKey) { + return; + } + event.preventDefault(); + let delta = 0; + if (event.wheelDelta) { + // WebKit / Opera / Explorer 9 + delta = event.wheelDelta / 40; + } else if (event.detail) { + // Firefox + delta = -event.detail / 3; + } + let factor = 1.0 + delta * 0.05; + factor = Math.max(factor, 0.01); + this.scale(factor); +}; +ObjectControls.prototype.mouseup = function (event) { + if (this.enabled === false || this._state === STATE.NONE) { + return; + } + event.preventDefault(); + event.stopPropagation(); + this._state = STATE.NONE; + if (this._clock.getElapsedTime() - this._lastMouseMoveTime > FULL_STOP_THRESHOLD) { + this._affectedObj.stop(); + } +}; +ObjectControls.prototype.touchstartend = function (event) { + if (this.enabled === false) { + return; + } + event.preventDefault(); + event.stopPropagation(); + switch (event.touches.length) { + case 1: + this._state = STATE.ROTATE; + this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY); + this._mousePrevPos.copy(this._mouseCurPos); + break; + case 2: + { + // prevent inertial rotation + this._mainObj.stop(); + this._altObj.stop(); + this._state = STATE.SCALE; + const dx = event.touches[0].pageX - event.touches[1].pageX; + const dy = event.touches[0].pageY - event.touches[1].pageY; + this._touchDistanceCur = this._touchDistanceStart = Math.sqrt(dx * dx + dy * dy); + this._scaleStart = this.object.scale.x; + break; + } + default: + this._state = STATE.NONE; + } +}; +ObjectControls.prototype.touchmove = function (event) { + if (this.enabled === false || this._state === STATE.NONE) { + return; + } + event.preventDefault(); + event.stopPropagation(); + switch (this._state) { + case STATE.ROTATE: + this._mousePrevPos.copy(this._mouseCurPos); + this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY); + this.rotateByMouse(false); + this._lastMouseMoveTime = this._clock.getElapsedTime(); + break; + case STATE.SCALE: + if (settings.now.zooming) { + // update scale + const dx = event.touches[0].pageX - event.touches[1].pageX; + const dy = event.touches[0].pageY - event.touches[1].pageY; + this._touchDistanceCur = Math.sqrt(dx * dx + dy * dy); + const newScale = this._scaleStart * this._touchDistanceCur / this._touchDistanceStart; + const factor = newScale / this.object.scale.x; + this.scale(factor); + } + break; + default: + } +}; +ObjectControls.prototype.keydownup = function (event) { + if (this.enabled === false || this.hotkeysEnabled === false) { + return; + } + switch (event.keyCode) { + case VK_LEFT: + case VK_UP: + case VK_RIGHT: + case VK_DOWN: + this._pressedKeys[event.keyCode] = event.type === 'keydown'; + event.preventDefault(); + event.stopPropagation(); + break; + default: + } +}; +ObjectControls.prototype.getKeyBindObject = function () { + return getTopWindow(); +}; +ObjectControls.prototype.dispose = function () { + for (let i = 0; i < this._listeners.length; i++) { + const l = this._listeners[i]; + l.obj.removeEventListener(l.type, l.handler); + } +}; +ObjectControls.prototype.translatePivotByMouse = function () { + const delta = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(); + return function () { + delta.subVectors(this._mouseCurPos, this._mousePrevPos); + this.translatePivotInWorld(settings.now.translationSpeed * delta.x, settings.now.translationSpeed * delta.y, 0); + }; +}(); + +// Translate in WorldCS, translation is scaled with root scale matrix +ObjectControls.prototype.translatePivotInWorld = function (x, y, z) { + const pos = this.objectPivot.position; + pos.applyMatrix4(this.object.matrixWorld); + pos.setX(pos.x + x); + pos.setY(pos.y + y); + pos.setZ(pos.z + z); + pos.applyMatrix4(matrix4.copy(this.object.matrixWorld).invert()); + this.dispatchEvent({ + type: 'change', + action: 'translatePivot' + }); +}; + +// Translate in ModelCS, x, y, z are Ang +ObjectControls.prototype.translatePivot = function (x, y, z) { + const pos = this.objectPivot.position; + pos.setX(pos.x + x); + pos.setY(pos.y + y); + pos.setZ(pos.z + z); + this.dispatchEvent({ + type: 'change', + action: 'translatePivot' + }); +}; + +// Set pivot +ObjectControls.prototype.setPivot = function (newPivot) { + this.objectPivot.position.copy(newPivot); + this.dispatchEvent({ + type: 'change', + action: 'translatePivot' + }); +}; +/* harmony default export */ const ui_ObjectControls = (ObjectControls); +;// CONCATENATED MODULE: ./src/ui/Picker.js + + + + +function Picker(gfxObj, camera, domElement) { + utils_EventDispatcher.call(this); + const self = this; + this.gfxObj = gfxObj; + this.camera = camera; + this.domElement = typeof domElement !== 'undefined' ? domElement : document; + this.screen = { + left: 0, + top: 0, + width: 0, + height: 0 + }; + this._lastMousePos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(0, 0); + this._mouseTotalDist = 0.0; + this._lastClickBeginTime = -1000.0; + this._lastClickPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(0, 0); + this._clickBeginTime = 0.0; + this._clock = new Timer(); + this._clock.start(); + this._listeners = [{ + obj: self.domElement, + type: 'mousedown', + handler(e) { + self.mousedown(e); + } + }, { + obj: self.domElement, + type: 'mouseup', + handler(e) { + self.mouseup(e); } - - var editor = selectedVisuals[0].beginFragmentEdit(); - - if (!editor) { - return; + }, { + obj: self.domElement, + type: 'mousemove', + handler(e) { + self.mousemove(e); } - - this._editors = [editor]; - this.logger.info('FRAGMENT EDIT MODE -- ON (single bond)'); - - this._setEditMode(EDIT_MODE.FRAGMENT); - - this._objectControls.allowTranslation(false); - - this._objectControls.allowAltObjFreeRotation(editor.isFreeRotationAllowed()); - - this._needRender = true; - }; - - Miew.prototype._applyFragmentEdit = function () { - if (this._editMode !== EDIT_MODE.FRAGMENT) { - return; + }, { + obj: self.domElement, + type: 'touchstart', + handler(e) { + self.touchstart(e); } - - this._objectControls.stop(); - - for (var i = 0; i < this._editors.length; ++i) { - this._editors[i].apply(); + }, { + obj: self.domElement, + type: 'touchend', + handler(e) { + self.touchend(e); } - - this._editors = []; - this.logger.info('FRAGMENT EDIT MODE -- OFF (applied)'); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this._objectControls.allowTranslation(true); - - this._objectControls.allowAltObjFreeRotation(true); - - this.rebuildAll(); - }; - - Miew.prototype._discardFragmentEdit = function () { - if (this._editMode !== EDIT_MODE.FRAGMENT) { - return; + }, { + obj: window, + type: 'resize', + handler() { + self.handleResize(); } - - this._objectControls.stop(); - - for (var i = 0; i < this._editors.length; ++i) { - this._editors[i].discard(); + }]; + for (let i = 0; i < this._listeners.length; i++) { + const l = this._listeners[i]; + l.obj.addEventListener(l.type, l.handler); + } + this.handleResize(); +} +Picker.prototype = Object.create(utils_EventDispatcher.prototype); +Picker.prototype.constructor = Picker; +Picker.prototype.reset = function () { + this.picked = {}; + this.dispatchEvent({ + type: 'newpick', + obj: {} + }); +}; +Picker.prototype.handleResize = function () { + if (this.domElement === document) { + this.screen.left = 0; + this.screen.top = 0; + this.screen.width = window.innerWidth; + this.screen.height = window.innerHeight; + } else { + const box = this.domElement.getBoundingClientRect(); + // adjustments come from similar code in the jquery offset() function + const d = this.domElement.ownerDocument.documentElement; + this.screen.left = box.left + window.pageXOffset - d.clientLeft; + this.screen.top = box.top + window.pageYOffset - d.clientTop; + this.screen.width = box.width; + this.screen.height = box.height; + } +}; +Picker.prototype.pickObject = function (screenPos) { + if (!this.gfxObj) { + this.picked = {}; + this.dispatchEvent({ + type: 'newpick', + obj: {} + }); + return; + } + const { + gfxObj + } = this; + const rayCaster = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Raycaster(); + rayCaster.ray.origin.setFromMatrixPosition(this.camera.matrixWorld); + rayCaster.ray.direction.set(screenPos.x, screenPos.y, 0.5).unproject(this.camera).sub(rayCaster.ray.origin).normalize(); + const clipPlane = settings.now.draft.clipPlane && this.clipPlaneValue ? this.clipPlaneValue : Infinity; + const fogFarPlane = settings.now.fog && this.fogFarValue ? this.fogFarValue : Infinity; + const point = rayCaster.intersectVisibleObject(gfxObj, this.camera, clipPlane, fogFarPlane); + if (!point) { + this.picked = {}; + this.dispatchEvent({ + type: 'newpick', + obj: {} + }); + return; + } + let picked = {}; + if (point.residue || point.atom) { + const residue = point.residue || point.atom.residue; + if (settings.now.pick === 'chain') { + picked = { + chain: residue.getChain() + }; + } else if (settings.now.pick === 'molecule') { + picked = { + molecule: residue.getMolecule() + }; + } else if (point.residue || settings.now.pick === 'residue') { + picked = { + residue + }; + } else if (point.atom) { + picked = { + atom: point.atom + }; } - - this._editors = []; - this.logger.info('FRAGMENT EDIT MODE -- OFF (discarded)'); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this._objectControls.allowTranslation(true); - - this._objectControls.allowAltObjFreeRotation(true); - - this._needRender = true; - }; - - Miew.prototype._onPick = function (event) { - if (!settings.now.picking) { - // picking is disabled - return; + } + this.picked = picked; + this.dispatchEvent({ + type: 'newpick', + obj: picked + }); +}; +Picker.prototype.getMouseInViewport = function (pageX, pageY) { + return new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2((pageX - this.screen.left) / this.screen.width * 2 - 1, -(pageY - this.screen.top) / this.screen.height * 2 + 1); +}; +Picker.prototype.mousedown = function (event) { + event.preventDefault(); + event.stopPropagation(); + if (event.button === 0) { + this._lastMousePos = this.getMouseInViewport(event.pageX, event.pageY); + this._mouseTotalDist = 0.0; + this._clickBeginTime = this._clock.getElapsedTime(); + } +}; +Picker.prototype.mousemove = function (event) { + event.preventDefault(); + event.stopPropagation(); + const pos = this.getMouseInViewport(event.pageX, event.pageY); + this._mouseTotalDist += pos.sub(this._lastMousePos).length(); +}; +Picker.prototype.mouseup = function (event) { + const self = this; + event.preventDefault(); + event.stopPropagation(); + if (event.button === 0) { + if (this._mouseTotalDist < 0.01) { + const curTime = this._clock.getElapsedTime(); + const curPos = this.getMouseInViewport(event.pageX, event.pageY); + const timeSinceLastClickBegin = curTime - this._lastClickBeginTime; + if (timeSinceLastClickBegin < 0.7) { + const clickDist = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2().subVectors(curPos, this._lastClickPos); + if (clickDist.length() < 0.01) { + // it's a double click + this.dispatchEvent({ + type: 'dblclick', + obj: this.picked + }); + this._lastClickPos = curPos; + this._lastClickBeginTime = -1000; // this click cannot serve as first click in double-click + return; + } + } + setTimeout(() => { + self.pickObject(curPos); + }, 0); + this._lastClickPos = curPos; + this._lastClickBeginTime = this._clickBeginTime; } - - if (this._animInterval !== null) { - // animation playback is on - return; + } +}; +Picker.prototype.touchstart = function (event) { + event.preventDefault(); + event.stopPropagation(); + if (event.touches.length === 1) { + this._lastTouchdownPos = this.getMouseInViewport(event.touches[0].pageX, event.touches[0].pageY); + } +}; +Picker.prototype.touchend = function (event) { + const self = this; + event.preventDefault(); + event.stopPropagation(); + if (event.touches.length === 0 && event.changedTouches.length === 1) { + const pos = this.getMouseInViewport(event.changedTouches[0].pageX, event.changedTouches[0].pageY); + const dist = pos.sub(this._lastTouchdownPos).length(); + if (dist < 0.01) { + setTimeout(() => { + self.pickObject(self._lastTouchdownPos); + }, 0); } - - if (this._editMode === EDIT_MODE.FRAGMENT) { - // prevent picking in fragment edit mode - return; + } +}; +Picker.prototype.dispose = function () { + for (let i = 0; i < this._listeners.length; i++) { + const l = this._listeners[i]; + l.obj.removeEventListener(l.type, l.handler); + } +}; +/* harmony default export */ const ui_Picker = (Picker); +;// CONCATENATED MODULE: ./src/gfx/Axes.js + +class Axes { + constructor(target, targetCamera) { + this._target = target; + this._targetCamera = targetCamera; + this._camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PerspectiveCamera(targetCamera.fov, targetCamera.aspect, 1, 100); + this._object = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.AxesHelper(1); + this._scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Scene(); + this._scene.add(this._object); + this._full = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(); + this._update(); + } + _update() { + const { + fov + } = this._targetCamera; + const camera = this._camera; + camera.aspect = this._targetCamera.aspect; + camera.setMinimalFov(fov); + camera.setDistanceToFit(1.0, fov); + camera.updateProjectionMatrix(); + this._object.quaternion.copy(this._target.quaternion); + } + render(renderer) { + this._update(); + renderer.getSize(this._full); + const width = this._full.width * 0.25; + const height = this._full.height * 0.25; + const { + autoClear + } = renderer; + renderer.autoClear = false; + renderer.setViewport(0.0, 0.0, width, height); + renderer.clear(false, true, false); + renderer.render(this._scene, this._camera); + renderer.setViewport(0, 0, this._full.width, this._full.height); + renderer.autoClear = autoClear; + } +} +/* harmony default export */ const gfx_Axes = (Axes); +;// CONCATENATED MODULE: ./src/gfx/FrameInfo.js + + +const cDataOffset = 12; +const cFirstMask = 0x0FFFFF00; +const cFirstShift = 8; +const cSecMask1 = 0x000000FF; +const cSecShift1 = 12; +const cSecMask2 = 0xFFF00000; +const cSecShift2 = 20; +const cThirdMask = 0x000FFFFF; +const cStrMask = 0xF0000000; +const cStrShift = 28; +const c219 = 1 << 19; +const c220 = 1 << 20; +const cHelixIdx = 1; +const cSheetIdx = 2; +const secTypes = ['helix', 'strand']; +const cSecNames = ['fs', 'ps', 'ns', 'us']; +function _createSecondary(strArray, complex) { + const residues = complex._residues; + const nRes = residues.length; + const resid = new Uint8Array(nRes); + const atoms = complex._atoms; + for (let i = 0, n = strArray.length; i < n; ++i) { + const atom = atoms[i]; + resid[atom.residue._index] = strArray[i]; + } + const secondary = []; + let rIdx = 0; + while (rIdx < nRes) { + if (resid[rIdx] !== 0) { + const start = rIdx; + const val = resid[rIdx]; + while (rIdx < nRes - 1 && resid[rIdx + 1] === val && residues[rIdx].isConnected(residues[rIdx + 1])) { + ++rIdx; + } + secondary.push({ + start, + end: rIdx, + type: secTypes[val - 1] + }); } - - if (this._objectControls.isEditingAltObj()) { - // prevent picking during component rotation - return; - } // update last pick & find complex - - - var complex = null; - - if (event.obj.atom) { - complex = event.obj.atom.residue.getChain().getComplex(); - this._lastPick = event.obj.atom; - } else if (event.obj.residue) { - complex = event.obj.residue.getChain().getComplex(); - this._lastPick = event.obj.residue; - } else if (event.obj.chain) { - complex = event.obj.chain.getComplex(); - this._lastPick = event.obj.chain; - } else if (event.obj.molecule) { - complex = event.obj.molecule.complex; - this._lastPick = event.obj.molecule; + ++rIdx; + } + return secondary; +} +function fromUInt20ToInt20(uint20) { + return uint20 >= c219 ? uint20 - c220 : uint20; +} +class FrameInfo { + constructor(complex, payload, callbacks) { + this._complex = complex; + this._secondary = null; + this.isLoading = false; + this._framesRange = { + start: 0, + end: -1 + }; + this.frameIsReady = false; + this._buffer = null; + this._frameRequest = null; + this._callbacks = callbacks; + if (typeof payload === 'function') { + this._framesRequestLength = 1; + this._downloadDataFn = payload; } else { - this._lastPick = null; + this.parseBinaryData(payload, true); } - - function _updateSelection(visual) { - visual.updateSelectionMask(event.obj); - visual.rebuildSelectionGeometry(); - } // update visual - - - if (complex) { - var visual = this._getVisualForComplex(complex); - - if (visual) { - _updateSelection(visual); - - this._needRender = true; + this.reset(); + this.setFrame(0); + } + _prepareBuffer(framesStart, framesEnd) { + if (framesStart === undefined || framesStart === null) { + framesStart = 0; + } + if (framesEnd === undefined || framesEnd === null) { + framesEnd = framesStart + this._framesRequestLength; + } + if (this._framesCount !== undefined) { + framesEnd = Math.min(this._framesCount - 1, framesEnd); + } + if (this._downloadDataFn) { + const self = this; + const onDone = function (data) { + self.isLoading = false; + if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') { + self._callbacks.onLoadStatusChanged(); + } + self._buffer = { + data, + state: 'ready', + start: framesStart, + end: framesEnd + }; + if (self._frameRequest !== null) { + const idx = self._frameRequest; + self._frameRequest = null; + self.setFrame(idx); + } + }; + const onFail = function () { + self.isLoading = false; + if (self._callbacks && typeof self._callbacks.onError === 'function') { + self._callbacks.onError('Streaming failed'); + } + }; + if (!this._buffer) { + this._buffer = {}; } - } else { - this._forEachComplexVisual(_updateSelection); - - this._needRender = true; + this._buffer.state = 'downloading'; + this.isLoading = true; + if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') { + self._callbacks.onLoadStatusChanged(); + } + this._downloadDataFn({ + start: framesStart, + end: framesEnd + 1 + }, onDone, onFail); } - - this._updateInfoPanel(); - - this.dispatchEvent(event); - }; - - Miew.prototype._onKeyDown = function (event) { - if (!this._running || !this._hotKeysEnabled) { - return; + } + _parseBuffer() { + if (this._buffer && this._buffer.state === 'ready') { + this._framesRange = { + start: this._buffer.start, + end: this._buffer.end + }; + this.parseBinaryData(this._buffer.data, false); + let _bufferRequestStart = (this._buffer.end + 1) % this._framesCount; + if (_bufferRequestStart >= this._framesCount) { + _bufferRequestStart = 0; + } + this._buffer = { + state: 'none' + }; + this._prepareBuffer(_bufferRequestStart, _bufferRequestStart + this._framesRequestLength); + if (this._frameRequest !== null) { + const idx = this._frameRequest; + this._frameRequest = null; + this.setFrame(idx); + } } - - switch (event.keyCode) { - case 'C'.charCodeAt(0): - if (settings.now.editing) { - this._enterComponentEditMode(); - } - - break; - - case 'F'.charCodeAt(0): - if (settings.now.editing) { - this._enterFragmentEditMode(); - } - - break; - - case 'A'.charCodeAt(0): - switch (this._editMode) { - case EDIT_MODE.COMPONENT: - this._applyComponentEdit(); - - break; - - case EDIT_MODE.FRAGMENT: - this._applyFragmentEdit(); - + } + parseBinaryData(arrayBuffer) { + const dataView = new DataView(arrayBuffer); + let offset = 0; + const atomsCount = dataView.getUint32(offset, true); + offset += 4; + const framesCount = dataView.getUint32(offset, true); + this._framesCount = framesCount; + this._framesRange.end = this._framesRange.end > 0 ? Math.min(this._framesRange.end, framesCount - 1) : framesCount - 1; + offset += 4; + this._atomsCount = atomsCount; + const maxSize = 1024 * 1024; // 1 MB + this._framesRequestLength = Math.ceil(maxSize / (atomsCount * 8)); + const chunkedFramesCount = this._framesRange.end - this._framesRange.start + 1; + if (atomsCount !== this._complex._atoms.length || arrayBuffer.byteLength !== cDataOffset + chunkedFramesCount * atomsCount * 8) { + throw new Error(); + } + const complex = this._complex; + let timeStep = dataView.getUint32(offset, true); + let iName = 0; + while (timeStep > 1000 && iName < cSecNames.length - 1) { + timeStep /= 1000; + ++iName; + } + this._timeStep = `${timeStep.toString()} ${cSecNames[iName]}`; + offset += 4; + const secondary = []; + const posData = new Float32Array(chunkedFramesCount * atomsCount * 3); + let coordIdx = 0; + const secondaryArr = new Int8Array(atomsCount); + for (let j = 0; j < chunkedFramesCount; ++j) { + for (let i = 0; i < atomsCount; ++i) { + const hiWord = dataView.getUint32(offset, true); + offset += 4; + const loWord = dataView.getUint32(offset, true); + offset += 4; + const str = (loWord & cStrMask) >>> cStrShift; + const x = fromUInt20ToInt20((loWord & cFirstMask) >>> cFirstShift >> 0); + const y = fromUInt20ToInt20(((loWord & cSecMask1) << cSecShift1 | (hiWord & cSecMask2) >>> cSecShift2) >> 0); + const z = fromUInt20ToInt20((hiWord & cThirdMask) >> 0); + secondaryArr[i] = 0; + if (str > 0 && str < 4) { + secondaryArr[i] = cHelixIdx; + } else if (str === 4) { + secondaryArr[i] = cSheetIdx; + } + posData[coordIdx++] = x / 100; + posData[coordIdx++] = y / 100; + posData[coordIdx++] = z / 100; + } + secondary.push(_createSecondary(secondaryArr, complex)); + } + this._secondaryData = secondary; + this._data = posData; + } + nextFrame() { + this.setFrame((this._currFrame + 1) % this._framesCount); + } + needsColorUpdate(colorer) { + return colorer instanceof colorers_SecondaryStructureColorer; + } + getAtomColor(colorer, atom) { + return colorer.getResidueColor(this._residues[atom.residue._index], this._complex); + } + getResidueColor(colorer, residue) { + return colorer.getResidueColor(this._residues[residue._index], this._complex); + } + _updateSecondary() { + let i; + const myResidues = this._residues; + let n = myResidues.length; + for (i = 0; i < n; ++i) { + myResidues[i]._secondary = null; + } + const sec = this._secondaryData[this._currFrame - this._framesRange.start]; + for (i = 0, n = sec.length; i < n; ++i) { + const oldSec = sec[i]; + const { + start, + end + } = oldSec; + const nSec = { + _start: myResidues[start], + _end: myResidues[end], + type: oldSec.type, + generic: oldSec.generic + }; + for (let j = start; j <= end; ++j) { + myResidues[j]._secondary = nSec; + } + } + } + reset() { + const compRes = this._complex._residues; + const n = compRes.length; + this._residues = new Array(n); + const myResidues = this._residues; + const getSec = function () { + return this._secondary; + }; + for (let i = 0; i < n; ++i) { + myResidues[i] = { + _type: compRes[i]._type, + _isValid: compRes[i]._isValid, + _controlPoint: null, + _wingVector: null, + _secondary: null, + getSecondary: getSec + }; + } + } + setFrame(frameIdx) { + this.frameIsReady = false; + if (frameIdx >= this._framesRange.start && frameIdx <= this._framesRange.end) { + this._currFrame = frameIdx; + this._cachedResidues = false; + this._updateSecondary(); + this.frameIsReady = true; + } else { + this._frameRequest = frameIdx; + if (!this._buffer) { + this._prepareBuffer(frameIdx); + } else { + const self = this; + switch (this._buffer.state) { + case 'none': + this._prepareBuffer(frameIdx); break; - } - - break; - - case 'D'.charCodeAt(0): - switch (this._editMode) { - case EDIT_MODE.COMPONENT: - this._discardComponentEdit(); - + case 'ready': + self._parseBuffer(); break; - - case EDIT_MODE.FRAGMENT: - this._discardFragmentEdit(); - + default: break; } + } + } + } + disableEvents() { + this._callbacks = null; + } - break; - - case 'S'.charCodeAt(0): - event.preventDefault(); - event.stopPropagation(); - settings.set('ao', !settings.now.ao); - this._needRender = true; - break; + /** + * Returns link to atom pos vector, clone it if needed + */ - case 107: - event.preventDefault(); - event.stopPropagation(); + static _vec = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3())(); + getAtomPos(atomIdx) { + const vec = FrameInfo._vec; + const self = this; + const data = self._data; + const idx = (self._atomsCount * (self._currFrame - self._framesRange.start) + atomIdx) * 3; + vec.set(data[idx], data[idx + 1], data[idx + 2]); + return vec; + } + getResidues() { + if (this._cachedResidues) { + return this._residues; + } + this._complex.updateToFrame(this); + return this._residues; + } +} +/* harmony default export */ const gfx_FrameInfo = (FrameInfo); +;// CONCATENATED MODULE: ./src/gfx/objects/SceneObject.js + + + + + +/** + * Create new scene object. + * + * @param {array=} params - Object required params. + * @param {object=} opts - Options to override defaults with. + * + * These options are copied locally and not kept by reference, so the created instance will not reflect further + * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation. + * + * @exports SceneObject + * @this SceneObject + * @abstract + * @constructor + * @classdesc Basic class for all scene objects that are not reps. + */ +class SceneObject { + constructor(params, opts) { + if (this.constructor === SceneObject) { + throw new Error('Can not instantiate abstract class!'); + } + /** + * Object's options inherited (prototyped) from defaults. + * @type {object} + */ + this.params = params; + this.opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge(utils.deriveDeep(settings.now.objects[this.type], true), opts); + this.needsRebuild = false; + this._mesh = null; + this.id = null; + } - this._forEachComplexVisual(function (visual) { - visual.expandSelection(); - visual.rebuildSelectionGeometry(); - }); + /** + * Get object identification, probably with options. + * @returns {Object} field type contains type information, params - object's formal parameters, + * opts - changed options + * Options are returned if they were changed during or after object creation. + */ + identify() { + const result = { + type: this.type, + params: this.params + }; + const diff = utils.objectsDiff(this.opts, settings.now.modes[this.id]); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(diff)) { + result.opts = diff; + } + return result; + } + toString() { + const paramsStr = `o=${this.type},${this.params.join(',')}`; + const optsStr = utils.compareOptionsWithDefaults(this.opts, settings.defaults.objects[this.type]); + return paramsStr + optsStr; + } + getGeometry() { + return this._mesh; + } + destroy() { + if (this._mesh) { + gfxutils.destroyObject(this._mesh); + } + } +} - this._updateInfoPanel(); +/** + * Scene object identifier. + * @type {string} + */ +SceneObject.prototype.type = '__'; +/* harmony default export */ const objects_SceneObject = (SceneObject); +;// CONCATENATED MODULE: ./src/gfx/objects/LinesObj.js - this._needRender = true; - break; - case 109: - event.preventDefault(); - event.stopPropagation(); - this._forEachComplexVisual(function (visual) { - visual.shrinkSelection(); - visual.rebuildSelectionGeometry(); - }); - this._updateInfoPanel(); - this._needRender = true; - break; - } - }; - Miew.prototype._onKeyUp = function (event) { - if (!this._running || !this._hotKeysEnabled) { - return; +class LinesObj extends objects_SceneObject { + constructor(params, opts) { + super(params, opts); + if (params.length < 2) { + throw new Error('Wrong number of argumets on line object creation!'); } - - if (event.keyCode === 'X'.charCodeAt(0)) { - this._extractRepresentation(); + [this._id1, this._id2] = params; + } + _getAtomFromName(complex, atomId) { + const err = ' - Wrong atom format it must be \'#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME\' (e.g. \'A.38.CO1\')'; + const atom1 = complex.getAtomByFullname(atomId); + if (!atom1) { + throw new Error(atomId + err); } - }; - - Miew.prototype._updateInfoPanel = function () { - var info = this._msgAtomInfo.getElementsByTagName('p')[0]; - - var atom; - var residue; - var count = 0; - - this._forEachComplexVisual(function (visual) { - count += visual.getSelectionCount(); + return atom1; + } + build(complex) { + const geom = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferGeometry(); + this._atom1 = this._getAtomFromName(complex, this._id1); + this._atom2 = this._getAtomFromName(complex, this._id2); + const p1 = this._atom1.position; + const p2 = this._atom2.position; + const vertices = new Float32Array([p1.x, p1.y, p1.z, p2.x, p2.y, p2.z]); + geom.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.BufferAttribute(vertices, 3)); + geom.computeBoundingBox(); + this._line = new meshes.Line(geom, new shaders_UberMaterial({ + lights: false, + overrideColor: true, + dashedLine: true, + fogTransparent: settings.now.bg.transparent + })); + this._line.computeLineDistances(); + this._line.material.setUberOptions({ + fixedColor: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(this.opts.color), + dashedLineSize: this.opts.dashSize, + dashedLinePeriod: this.opts.dashSize + this.opts.gapSize }); - - while (info.firstChild) { - info.removeChild(info.firstChild); + this._line.material.updateUniforms(); + this._line.raycast = function (_raycaster, _intersects) {}; + this._mesh = this._line; + const transforms = complex.getTransforms(); + if (transforms.length > 0) { + this._mesh = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group(); + this._mesh.add(this._line); + meshutils.applyTransformsToMeshes(this._mesh, transforms); } - - if (count === 0) { - this._msgAtomInfo.style.opacity = 0.0; + } + updateToFrame(frameData) { + if (!this._atom1 || !this._atom2 || !this._line) { + return; + } + const geo = this._line.geometry; + geo.vertices[0].copy(frameData.getAtomPos(this._atom1.index)); + geo.vertices[1].copy(frameData.getAtomPos(this._atom2.index)); + this._line.computeLineDistances(); + geo.computeBoundingSphere(); + geo.verticesNeedUpdate = true; + } +} +LinesObj.prototype.constructor = LinesObj; +LinesObj.prototype.type = 'line'; +/* harmony default export */ const objects_LinesObj = (LinesObj); +;// CONCATENATED MODULE: ./src/gfx/shaders/Outline.frag +const Outline_namespaceObject = "precision highp float;\r\n\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexSize;\r\nuniform vec2 thickness;\r\nvarying vec2 vUv;\r\n\r\n#ifdef DEPTH_OUTLINE\r\n uniform sampler2D srcDepthTex; //depthTexture\r\n uniform vec3 color;\r\n uniform float threshold;\r\n#endif\r\n\r\nvoid main() {\r\n\r\n vec2 pixelSize = thickness / srcTexSize;\r\n\r\n #ifdef DEPTH_OUTLINE\r\n float c00 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,-pixelSize.y)).x;\r\n float c01 = texture2D(srcDepthTex, vUv + vec2(0,-pixelSize.y)).x;\r\n float c02 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,-pixelSize.y)).x;\r\n float c10 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,0)).x;\r\n float c12 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,0)).x;\r\n float c20 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,pixelSize.y)).x;\r\n float c21 = texture2D(srcDepthTex, vUv + vec2(0,pixelSize.y)).x;\r\n float c22 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,pixelSize.y)).x;\r\n\r\n float horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n float vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n float grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n\r\n gl_FragColor = ( grad > threshold ) ? vec4(color.rgb, 1.0) : gl_FragColor = texture2D(srcTex, vUv);\r\n\r\n #else\r\n vec4 c00 = texture2D(srcTex, vUv + vec2(-pixelSize.x,-pixelSize.y));\r\n vec4 c01 = texture2D(srcTex, vUv + vec2(0,-pixelSize.y));\r\n vec4 c02 = texture2D(srcTex, vUv + vec2(pixelSize.x,-pixelSize.y));\r\n vec4 c10 = texture2D(srcTex, vUv + vec2(-pixelSize.x,0));\r\n vec4 c12 = texture2D(srcTex, vUv + vec2(pixelSize.x,0));\r\n vec4 c20 = texture2D(srcTex, vUv + vec2(-pixelSize.x,pixelSize.y));\r\n vec4 c21 = texture2D(srcTex, vUv + vec2(0,pixelSize.y));\r\n vec4 c22 = texture2D(srcTex, vUv + vec2(pixelSize.x,pixelSize.y));\r\n\r\n vec4 horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n vec4 vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n vec4 grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n gl_FragColor = grad;\r\n #endif\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/OutlineMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ + + + +class OutlineMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RawShaderMaterial { + constructor(params) { + // add depth outline + super(params); + const settings = { + uniforms: { + srcTex: { + type: 't', + value: null + }, + srcDepthTex: { + type: 't', + value: null + }, + srcTexSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(512, 512) + }, + color: { + type: 'v3', + value: null + }, + threshold: { + type: 'f', + value: null + }, + opacity: { + type: 'f', + value: 1.0 + }, + thickness: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(1, 1) + } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: Outline_namespaceObject, + transparent: true, + depthTest: false, + depthWrite: false + }; + this.setValues(settings); + } + copy(source) { + super.copy(source); + this.depth = source.depth; + } + setValues(values) { + if (typeof values === 'undefined') { return; } - var firstLine = "".concat(String(count), " atom").concat(count !== 1 ? 's' : '', " selected"); - - if (this._lastPick !== null) { - firstLine += ', the last pick:'; + // set direct values + super.setValues(values); + const defines = {}; + if (this.depth) { + defines.DEPTH_OUTLINE = 1; } - var secondLine = ''; - var aName = ''; - var coordLine = ''; + // set dependent values + this.defines = defines; + } +} +OutlineMaterial.prototype.depth = false; +/* harmony default export */ const shaders_OutlineMaterial = (OutlineMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/FXAA.frag +const FXAA_namespaceObject = "precision highp float;\r\n\r\n// edge end finding algorithm parameters\r\n#define FXAA_QUALITY_PS 8\r\n#define FXAA_QUALITY_P0 1.0\r\n#define FXAA_QUALITY_P1 1.5\r\n#define FXAA_QUALITY_P2 2.0\r\n#define FXAA_QUALITY_P3 2.0\r\n#define FXAA_QUALITY_P4 2.0\r\n#define FXAA_QUALITY_P5 2.0\r\n#define FXAA_QUALITY_P6 4.0\r\n#define FXAA_QUALITY_P7 12.0\r\n// constants\r\nfloat fxaaQualityEdgeThreshold = 0.125;\r\nfloat fxaaQualityEdgeThresholdMin = 0.0625;\r\nfloat fxaaQualitySubpix = 0.7; //0.65;\r\n// global params\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexelSize;\r\nuniform vec3 bgColor;\r\n// from vs\r\nvarying vec2 vUv;\r\n//=====================================================================//\r\n// calc luminance from rgb\r\n//'float FxaaLuma(vec3 rgb) {return rgb.y * (0.587/0.299) + rgb.x; } // Lotte's idea about game luminance\r\nfloat FxaaLuma(vec3 rgb) {return dot(rgb, vec3(0.299, 0.587, 0.114)); } // real luminance calculation\r\n // for non-real scene rendering\r\n// texture sampling by pixel position(coords) and offset(in pixels)\r\n vec3 FxaaTex(sampler2D tex, vec2 pos, vec2 off, vec2 res ) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos + off * res );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos + off * res ).xyz;\r\n #endif\r\n}\r\nvec3 FxaaTexTop(sampler2D tex, vec2 pos) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos).xyz;\r\n #endif\r\n}\r\nvec4 FxaaTexTopAlpha(sampler2D tex, vec2 pos) {\r\n return texture2D( tex, pos);\r\n}\r\n\r\n//=====================================================================//\r\nvoid main() {\r\n // renaming\r\n vec2 posM = vUv;\r\n // get luminance for neighbours\r\n float lumaS = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, 1.0 ), srcTexelSize));\r\n float lumaE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 0.0 ), srcTexelSize));\r\n float lumaN = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, -1.0 ), srcTexelSize));\r\n float lumaW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 0.0 ), srcTexelSize));\r\n float lumaM = FxaaLuma(FxaaTexTop(srcTex, posM));\r\n // find max and min luminance\r\n float rangeMax = max(max(lumaN, lumaW), max(lumaE, max(lumaS, lumaM)));\r\n float rangeMin = min(min(lumaN, lumaW), min(lumaE, min(lumaS, lumaM)));\r\n // calc maximum non-edge range\r\n float rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\r\n float range = rangeMax - rangeMin;\r\n float rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\r\n // exit when luma contrast is small (is not edge)\r\n if(range < rangeMaxClamped){\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n return;\r\n }\r\n float subpixRcpRange = 1.0/range;\r\n // note: the sampling coordinates can be calculated in vertex shader but the approach doesn't affect performance\r\n // visibly, thus we decided to leave calculation here for better readability.\r\n // calc other neighbours luminance\r\n float lumaNE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, -1.0 ), srcTexelSize));\r\n float lumaSW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 1.0 ), srcTexelSize));\r\n float lumaSE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 1.0 ), srcTexelSize));\r\n float lumaNW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, -1.0 ), srcTexelSize));\r\n/*--------------span calculation and subpix amount calulation-----------------*/\r\n float lumaNS = lumaN + lumaS;\r\n float lumaWE = lumaW + lumaE;\r\n float subpixNSWE = lumaNS + lumaWE;\r\n float edgeHorz1 = (-2.0 * lumaM) + lumaNS;\r\n float edgeVert1 = (-2.0 * lumaM) + lumaWE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNESE = lumaNE + lumaSE;\r\n float lumaNWNE = lumaNW + lumaNE;\r\n float edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\r\n float edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNWSW = lumaNW + lumaSW;\r\n float lumaSWSE = lumaSW + lumaSE;\r\n float edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\r\n float edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\r\n float edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\r\n float edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\r\n float edgeHorz = abs(edgeHorz3) + edgeHorz4;\r\n float edgeVert = abs(edgeVert3) + edgeVert4;\r\n/*--------------------subpix amount calulation------------------------------*/\r\n float subpixNWSWNESE = lumaNWSW + lumaNESE;\r\n float lengthSign = srcTexelSize.x;\r\n bool horzSpan = edgeHorz >= edgeVert;\r\n // debug code edge span visualization\r\n/*' if (horzSpan)\r\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);\r\n else\r\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\r\n return;*/\r\n float subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\r\n/*--------------------------------------------------------------------------*/\r\n if(!horzSpan) lumaN = lumaW;\r\n if(!horzSpan) lumaS = lumaE;\r\n if(horzSpan) lengthSign = srcTexelSize.y;\r\n float subpixB = (subpixA * (1.0/12.0)) - lumaM;\r\n/*--------------------------------------------------------------------------*/\r\n float gradientN = lumaN - lumaM;\r\n float gradientS = lumaS - lumaM;\r\n float lumaNN = lumaN + lumaM;\r\n float lumaSS = lumaS + lumaM;\r\n bool pairN = abs(gradientN) >= abs(gradientS);\r\n float gradient = max(abs(gradientN), abs(gradientS));\r\n if(pairN) lengthSign = -lengthSign;\r\n float subpixC = clamp(abs(subpixB) * subpixRcpRange, 0.0, 1.0);\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posB;\r\n posB = posM;\r\n vec2 offNP;\r\n offNP.x = (!horzSpan) ? 0.0 : srcTexelSize.x;\r\n offNP.y = ( horzSpan) ? 0.0 : srcTexelSize.y;\r\n if(!horzSpan) posB.x += lengthSign * 0.5;\r\n if( horzSpan) posB.y += lengthSign * 0.5;\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posN;\r\n posN = posB - offNP * FXAA_QUALITY_P0;\r\n vec2 posP;\r\n posP = posB + offNP * FXAA_QUALITY_P0;\r\n float subpixD = ((-2.0)*subpixC) + 3.0;\r\n float lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN));\r\n float subpixE = subpixC * subpixC;\r\n float lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP));\r\n/*--------------------------------------------------------------------------*/\r\n if(!pairN) lumaNN = lumaSS;\r\n float gradientScaled = gradient * 1.0/4.0;\r\n float lumaMM = lumaM - lumaNN * 0.5;\r\n float subpixF = subpixD * subpixE;\r\n bool lumaMLTZero = lumaMM < 0.0;\r\n/*---------------------looped edge-end search-------------------------------*/\r\n lumaEndN -= lumaNN * 0.5;\r\n lumaEndP -= lumaNN * 0.5;\r\n bool doneN = abs(lumaEndN) >= gradientScaled;\r\n bool doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P1;\r\n bool doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P1;\r\n/*--------------------------------------------------------------------------*/\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P2;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P2;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 3)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P3;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P3;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 4)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P4;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P4;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 5)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P5;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P5;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 6)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P6;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P6;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 7)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P7;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P7;\r\n/*--------------------------------------------------------------------------*/\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n/*----------------calculate subpix offset due to edge ends-------------------*/\r\n float dstN = posM.x - posN.x;\r\n float dstP = posP.x - posM.x;\r\n if(!horzSpan) dstN = posM.y - posN.y;\r\n if(!horzSpan) dstP = posP.y - posM.y;\r\n/*--------------------------------------------------------------------------*/\r\n bool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\r\n float spanLength = (dstP + dstN);\r\n bool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\r\n float spanLengthRcp = 1.0 / spanLength;\r\n/*--------------------------------------------------------------------------*/\r\n bool directionN = dstN < dstP;\r\n float dst = min(dstN, dstP);\r\n bool goodSpan = directionN ? goodSpanN : goodSpanP;\r\n float subpixG = subpixF * subpixF;\r\n float pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\r\n float subpixH = subpixG * fxaaQualitySubpix;\r\n/*-----------------calc texture offest using subpix-------------------------*/\r\n float pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\r\n float pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\r\n\r\n float offset = pixelOffsetSubpix * lengthSign;\r\n #ifdef BG_TRANSPARENT\r\n // get original texel\r\n vec4 rgbaA = FxaaTexTopAlpha(srcTex, posM);\r\n // calc step to blended texel\r\n vec2 step = sign((!horzSpan) ? vec2 (offset, 0.0) : vec2 (0.0, offset));\r\n // get neighboring texel\r\n vec4 rgbaB = FxaaTexTopAlpha(srcTex, posM + step * srcTexelSize);\r\n // calc blend factor from offset\r\n float f = (!horzSpan) ? offset / srcTexelSize.x : offset / srcTexelSize.y;\r\n f = abs(f);\r\n // calc alpha (special formula to emulate blending with bg)\r\n gl_FragColor.a = 1.0 - mix(1.0 - rgbaA.a, 1.0 - rgbaB.a, f);\r\n // calc color (special formula to emulate blending with bg)\r\n gl_FragColor.rgb = mix(rgbaA.rgb * rgbaA.a, rgbaB.rgb * rgbaB.a, f) / gl_FragColor.a;\r\n #else\r\n if(!horzSpan) {\r\n posM.x += offset;\r\n } else {\r\n posM.y += offset;\r\n }\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n #endif\r\n return;\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/FXAAMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ - if (this._lastPick instanceof Atom$2) { - atom = this._lastPick; - residue = atom.residue; - aName = atom.name; - var location = atom.location !== 32 ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space - secondLine = "".concat(atom.element.fullName, " #").concat(atom.serial).concat(location, ": ").concat(residue._chain._name, ".").concat(residue._type._name).concat(residue._sequence).concat(residue._icode.trim(), "."); - secondLine += aName; - coordLine = "Coord: (".concat(atom.position.x.toFixed(2).toString(), ", ").concat(atom.position.y.toFixed(2).toString(), ", ").concat(atom.position.z.toFixed(2).toString(), ")"); - } else if (this._lastPick instanceof Residue$1) { - residue = this._lastPick; - secondLine = "".concat(residue._type._fullName, ": ").concat(residue._chain._name, ".").concat(residue._type._name).concat(residue._sequence).concat(residue._icode.trim()); - } else if (this._lastPick instanceof Chain$2) { - secondLine = "chain ".concat(this._lastPick._name); - } else if (this._lastPick instanceof Molecule$8) { - secondLine = "molecule ".concat(this._lastPick._name); - } - info.appendChild(document.createTextNode(firstLine)); +class FXAAMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RawShaderMaterial { + constructor(params) { + super(params); - if (secondLine !== '') { - info.appendChild(document.createElement('br')); - info.appendChild(document.createTextNode(secondLine)); + // set default values + this.setValues.call(this, { + uniforms: { + srcTex: { + type: 't', + value: null + }, + srcTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(1.0 / 512.0, 1.0 / 512.0) + }, + bgColor: { + type: 'c', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(0xffffff) + } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: FXAA_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false + }); + this.setValues(params); + } + copy(source) { + super.copy(source); + this.depth = source.depth; + } + setValues(values) { + if (typeof values === 'undefined') { + return; } - if (coordLine !== '') { - info.appendChild(document.createElement('br')); - info.appendChild(document.createTextNode(coordLine)); + // set direct values + super.setValues(values); + const defines = {}; + if (this.bgTransparent) { + defines.BG_TRANSPARENT = 1; } + // set dependent values + this.defines = defines; + } +} +FXAAMaterial.prototype.bgTransparent = false; +/* harmony default export */ const shaders_FXAAMaterial = (FXAAMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/AO.frag +const AO_namespaceObject = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 32\r\nuniform vec3 samplesKernel[MAX_SAMPLES_COUNT];\r\nuniform sampler2D noiseTexture;\r\nuniform vec2 noiseTexelSize;\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D depthTexture;\r\nuniform sampler2D normalTexture;\r\nuniform vec2 srcTexelSize;\r\nuniform vec2 camNearFar;\r\nuniform mat4 projMatrix;\r\n\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\nuniform float kernelRadius;\r\nuniform float depthThreshold;\r\nuniform float factor;\r\n\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n // remap coordinates to prevent noise exture rescale\r\n vec2 vUvNoise = vUv / srcTexelSize * noiseTexelSize;\r\n vec4 normalData = texture2D(normalTexture, vUv);\r\n // return for background fragments (their normals are zero vectors)\r\n if (length(normalData.rgb) < EPSILON) {\r\n // 0.0 in alpha component means that it is background fragment\r\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\r\n return;\r\n }\r\n //[0, 1] -> [-1, 1]\r\n vec3 normal = (normalData.rgb * 2.0 - 1.0);\r\n // normalData.a store 1.0 if normal was build for frontfaced surface\r\n // and 0.0 in other case\r\n if (normalData.a < EPSILON) {\r\n normal *= -1.0;\r\n }\r\n // get random vector for sampling sphere rotation\r\n vec3 randN = texture2D(noiseTexture, vUvNoise).rgb * 2.0 - 1.0;\r\n randN = normalize(randN);\r\n // build TBN (randomly rotated around normal)\r\n vec3 tangent = normalize(randN - normal * dot(randN, normal));\r\n vec3 bitangent = cross(tangent, normal);\r\n mat3 TBN = mat3(tangent, bitangent, normal);\r\n // calc AO value\r\n float AO = 0.0;\r\n for (int i = 0 ; i < MAX_SAMPLES_COUNT ; i++) {\r\n // rotate sampling kernel around normal\r\n vec3 reflectedSample = TBN * samplesKernel[i];\r\n // get sample\r\n vec3 samplePos = viewPos + reflectedSample * kernelRadius;\r\n\r\n // project sample to screen to get sample's screen pos\r\n vec4 SampleScrPos = vec4(samplePos, 1.0);\r\n // eye -> clip\r\n SampleScrPos = projMatrix * SampleScrPos;\r\n // normalize\r\n SampleScrPos.xy /= SampleScrPos.w;\r\n //[-1, 1] -> [0, 1]\r\n SampleScrPos.xy = (SampleScrPos.xy + vec2(1.0)) * 0.5;\r\n\r\n // get view z for sample projected to the objct surface\r\n float sampleDepth = CalcViewZ(SampleScrPos.xy);\r\n // calc occlusion made by object surface at the sample\r\n AO += step(samplePos.z, sampleDepth);\r\n }\r\n // calc result AO-map color\r\n AO = 1.0 - max(0.0, AO / float(MAX_SAMPLES_COUNT) * factor);\r\n // write value to AO-map\r\n gl_FragColor = vec4(AO, AO, AO, 1.0);\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/AOMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ - this._msgAtomInfo.style.opacity = 1.0; - }; - Miew.prototype._getAltObj = function () { - if (this._editors) { - var altObj = null; - for (var i = 0; i < this._editors.length; ++i) { - var nextAltObj = this._editors[i].getAltObj(); - if (nextAltObj.objects.length > 0) { - if (altObj) { - // we have selected atoms in two or more visuals -- not supported - altObj = null; - break; - } +const AOMaterial_samplesKernel = [ +// hemisphere samples adopted to sphere +new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.295184, 0.077723, 0.068429), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.271976, -0.365221, 0.838363), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.547713, 0.467576, 0.488515), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.662808, -0.031733, 0.584758), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.025717, 0.218955, 0.657094), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.310153, -0.365223, 0.370701), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.101407, -0.006313, 0.747665), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.769138, 0.360399, 0.086847), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.271988, -0.275140, 0.905353), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.096740, -0.566901, 0.700151), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.562872, -0.735136, 0.094647), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.379877, 0.359278, 0.190061), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.519064, -0.023055, 0.405068), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.301036, 0.114696, 0.088885), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.282922, 0.598305, 0.487214), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.181859, 0.251670, 0.679702), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.191463, -0.635818, 0.512919), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.293655, 0.427423, 0.078921), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.267983, 0.680534, 0.132880), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.139611, 0.319637, 0.477439), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.352086, 0.311040, 0.653913), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.321032, 0.805279, 0.487345), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.073516, 0.820734, 0.414183), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.155324, 0.589983, 0.411460), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.335976, 0.170782, 0.527627), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.463460, -0.355658, 0.167689), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.222654, 0.596550, 0.769406), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.922138, -0.042070, 0.147555), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.727050, -0.329192, 0.369826), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.090731, 0.533820, 0.463767), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.323457, -0.876559, 0.238524), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(-0.663277, -0.372384, 0.342856)]; +class AOMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RawShaderMaterial { + constructor() { + super(); - altObj = nextAltObj; + // set default values + this.setValues.call(this, { + uniforms: { + noiseTexture: { + type: 't', + value: gfx_noiseTexture.noiseTexture + }, + noiseTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(1.0 / gfx_noiseTexture.noiseWidth, 1.0 / gfx_noiseTexture.noiseHeight) + }, + diffuseTexture: { + type: 't', + value: null + }, + normalTexture: { + type: 't', + value: null + }, + depthTexture: { + type: 't', + value: null + }, + srcTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(1.0 / 512.0, 1.0 / 512.0) + }, + camNearFar: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(1.0, 10.0) + }, + projMatrix: { + type: 'mat4', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4() + }, + aspectRatio: { + type: 'f', + value: 0.0 + }, + tanHalfFOV: { + type: 'f', + value: 0.0 + }, + samplesKernel: { + type: 'v3v', + value: AOMaterial_samplesKernel + }, + kernelRadius: { + type: 'f', + value: 1.0 + }, + depthThreshold: { + type: 'f', + value: 1.0 + }, + factor: { + type: 'f', + value: 1.0 } - } - - if (altObj) { - return altObj; - } - } - - return { - objects: [], - pivot: new THREE.Vector3(0, 0, 0) - }; - }; - - Miew.prototype.resetPivot = function () { - var boundingBox = new THREE.Box3(); - var center = new THREE.Vector3(); - return function () { - boundingBox.makeEmpty(); - - this._forEachVisual(function (visual) { - boundingBox.union(visual.getBoundaries().boundingBox); - }); - - boundingBox.getCenter(center); - - this._objectControls.setPivot(center.negate()); - - this.dispatchEvent({ - type: 'transform' - }); - }; - }(); + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: AO_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false + }); + } +} +/* harmony default export */ const shaders_AOMaterial = (AOMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/AOHorBlur.frag +const AOHorBlur_namespaceObject = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = res;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x + samplesOffsets[i] * srcTexelSize.x, y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb = res.rgb / weightSum;\r\n gl_FragColor = res;\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/AOHorBlurMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ - Miew.prototype.setPivotResidue = function () { - var center = new THREE.Vector3(); - return function (residue) { - var visual = this._getVisualForComplex(residue.getChain().getComplex()); - if (!visual) { - return; - } - if (residue._controlPoint) { - center.copy(residue._controlPoint); - } else { - var x = 0; - var y = 0; - var z = 0; - var amount = residue._atoms.length; +const _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0]; +class AOHorBlurMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RawShaderMaterial { + constructor() { + super(); - for (var i = 0; i < amount; ++i) { - var p = residue._atoms[i].position; - x += p.x / amount; - y += p.y / amount; - z += p.z / amount; + // set default values + this.setValues.call(this, { + uniforms: { + depthTexture: { + type: 't', + value: null + }, + srcTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(1.0 / 512.0, 1.0 / 512.0) + }, + aoMap: { + type: 't', + value: null + }, + samplesOffsets: { + type: 'fv1', + value: _kernelOffsets } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: AOHorBlur_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false + }); + } +} +/* harmony default export */ const shaders_AOHorBlurMaterial = (AOHorBlurMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/AOVertBlurWithBlend.frag +const AOVertBlurWithBlend_namespaceObject = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nuniform mat4 projMatrix;\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\n#ifdef USE_FOG\r\n uniform vec2 fogNearFar;\r\n uniform vec4 fogColor;\r\n#endif\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 color = texture2D(diffuseTexture, vec2(x, y));\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x, y + samplesOffsets[i] * srcTexelSize.y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb /= weightSum;\r\n\r\n #if defined(USE_FOG) && !defined(FOG_TRANSPARENT)\r\n // Add fog to the result value\r\n // Proper way to get an image with fog and ao requires formula:\r\n // gl_FragColor = fragColor*AO*(1-fogFactor) + fogColor*fogFactor\r\n // But we have already fogged molecule to add AO too. Let's split the straight formula into our real steps!\r\n // We have: AO, fogFactor, fogColor,\r\n // color = fragColor*(1-fogFactor) + fogColor*fogFactor (it comes from diffuseTexture,\r\n // where molecule has been already drawn with fog)\r\n // Transform:\r\n // fragColor*AO*(1-fogFactor) + fogColor*fogFactor =\r\n // = [fragColor*(1-fogFactor) = color - fogColor*fogFactor] =\r\n // = (color - fogColor*fogFactor)*AO + fogColor*fogFactor =\r\n // = color*AO + fogColor*fogFactor*(1 - AO)\r\n // Result: gl_FragColor = color*AO + fogColor*fogFactor*(1 - AO)\r\n float fogFactor = smoothstep(fogNearFar.x, fogNearFar.y, - viewPos.z) * fogColor.a;\r\n gl_FragColor.rgb = color.rgb * res.rgb + fogColor.rgb * fogFactor *(vec3(1.0, 1.0, 1.0) - res.rgb);\r\n #else\r\n gl_FragColor.rgb = color.rgb * res.rgb;\r\n #endif\r\n gl_FragColor.a = color.a;\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/AOVertBlurWithBlendMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ - center.set(x, y, z); - } - - center.applyMatrix4(visual.matrix).negate(); - - this._objectControls.setPivot(center); - - this.dispatchEvent({ - type: 'transform' - }); - }; - }(); - - Miew.prototype.setPivotAtom = function () { - var center = new THREE.Vector3(); - return function (atom) { - var visual = this._getVisualForComplex(atom.residue.getChain().getComplex()); - - if (!visual) { - return; - } - - center.copy(atom.position); - center.applyMatrix4(visual.matrix).negate(); - - this._objectControls.setPivot(center); - - this.dispatchEvent({ - type: 'transform' - }); - }; - }(); - Miew.prototype.getSelectionCenter = function () { - var _centerInVisual = new THREE.Vector3(0.0, 0.0, 0.0); - return function (center, includesAtom, selector) { - center.set(0.0, 0.0, 0.0); - var count = 0; +const AOVertBlurWithBlendMaterial_kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0]; +class AOVertBlurWithBlendMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RawShaderMaterial { + constructor(params) { + super(params); - this._forEachComplexVisual(function (visual) { - if (visual.getSelectionCenter(_centerInVisual, includesAtom, selector || visual.getSelectionBit())) { - center.add(_centerInVisual); - count++; + // set default values + this.setValues.call(this, { + uniforms: { + diffuseTexture: { + type: 't', + value: null + }, + depthTexture: { + type: 't', + value: null + }, + srcTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(1.0 / 512.0, 1.0 / 512.0) + }, + aoMap: { + type: 't', + value: null + }, + samplesOffsets: { + type: 'fv1', + value: AOVertBlurWithBlendMaterial_kernelOffsets + }, + projMatrix: { + type: 'mat4', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4() + }, + aspectRatio: { + type: 'f', + value: 0.0 + }, + tanHalfFOV: { + type: 'f', + value: 0.0 + }, + fogNearFar: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(100.0, 100.0) + }, + fogColor: { + type: 'v4', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector4(0.0, 0.5, 0.0, 1.0) } - }); - - if (count === 0) { - return false; - } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: AOVertBlurWithBlend_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false + }); + this.setValues(params); + } + setValues(values) { + if (typeof values === 'undefined') { + return; + } - center.divideScalar(count); - center.negate(); - return true; + // set direct values + super.setValues(values); + const defines = {}; + if (this.useFog) { + defines.USE_FOG = 1; + } + if (this.fogTransparent) { + defines.FOG_TRANSPARENT = 1; + } + // set dependent values + this.defines = defines; + } +} +AOVertBlurWithBlendMaterial.prototype.useFog = true; +AOVertBlurWithBlendMaterial.prototype.fogTransparent = false; +/* harmony default export */ const shaders_AOVertBlurWithBlendMaterial = (AOVertBlurWithBlendMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/Anaglyph.frag +const Anaglyph_namespaceObject = "precision highp float;\r\n\r\nuniform sampler2D srcL;\r\nuniform sampler2D srcR;\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vec4 l = texture2D(srcL, vUv);\r\n vec4 r = texture2D(srcR, vUv);\r\n gl_FragColor = vec4(l.r, r.g, r.b, 1.0);\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/AnaglyphMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ + + + +class AnaglyphMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RawShaderMaterial { + constructor() { + super(); + const settings = { + uniforms: { + srcL: { + type: 't', + value: null + }, + srcR: { + type: 't', + value: null + } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: Anaglyph_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false }; - }(); + this.setValues(settings); + } +} +/* harmony default export */ const shaders_AnaglyphMaterial = (AnaglyphMaterial); +;// CONCATENATED MODULE: ./src/gfx/ViewInterpolator.js - Miew.prototype.setPivotSubset = function () { - var _center = new THREE.Vector3(0.0, 0.0, 0.0); - function _includesInCurSelection(atom, selectionBit) { - return atom.mask & 1 << selectionBit; +class View { + constructor() { + this.position = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0); + this.scale = 1; + this.orientation = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Quaternion(0, 0, 0, 1); + } + set(position, scale, orientation) { + this.position = position; + this.scale = scale; + this.orientation = orientation; + } +} +const _transitionTime = 1.5; // in seconds + +class ViewInterpolator { + setup(startView, endView) { + this._startTime = undefined; + this._endTime = undefined; + this._isPaused = false; + this._srcView = startView; + this._dstView = endView; + this._isMoving = false; + } + isMoving() { + return this._isMoving; + } + wasStarted() { + return typeof this._startTime !== 'undefined' && typeof this._endTime !== 'undefined'; + } + start() { + this._startTime = Date.now(); + const transTime = settings.now.interpolateViews ? _transitionTime * 1000 : 0; + this._endTime = this._startTime + transTime; + this._isMoving = true; + } + getCurrentView() { + if (typeof this._srcView === 'undefined' || typeof this._dstView === 'undefined' || !this._isMoving || !this.wasStarted()) { + return { + success: false + }; } - - function _includesInSelector(atom, selector) { - return selector.selector.includesAtom(atom); + let view = this.createView(); + const time = Date.now(); + if (time > this._endTime) { + view = this._dstView; + this.reset(); + return { + success: true, + view + }; } + const factor = (time - this._startTime) / (this._endTime - this._startTime); + view.position.copy(this._srcView.position); + view.position.lerp(this._dstView.position, factor); + view.scale = (1 - factor) * this._srcView.scale + factor * this._dstView.scale; + view.orientation.copy(this._srcView.orientation); + view.orientation.slerp(this._dstView.orientation, factor); + return { + success: true, + view + }; + } + reset() { + this._startTime = this._endTime = 0; + this._isMoving = false; + } + pause() { + if (!this._isPaused) { + this.setup(this.getCurrentView().view, this._dstView); + this._isPaused = true; + } + } + resume() { + this._isPaused = false; + } + createView() { + return new View(); + } +} +;// CONCATENATED MODULE: ./src/utils/Cookies.js - return function (selector) { - var includesAtom = selector ? _includesInSelector : _includesInCurSelection; - - if (this.getSelectionCenter(_center, includesAtom, selector)) { - this._objectControls.setPivot(_center); - this.dispatchEvent({ - type: 'transform' - }); +const MAX_COOKIE_LEN = 4000; +const COUNT_SUFFIX = 'Cnt'; +function _chunkString(string, chunkLen) { + const l = string.length; + const chunks = []; + for (let c = 0, lc = 0; lc < l; c++, lc += chunkLen) { + chunks[c] = string.slice(lc, lc + chunkLen); + } + return chunks; +} + +/** + * Create new context dependent Cookie holder object. + * @param context + * @param {Object} opts - options + * @param {string} opts.path - cookie path + * @constructor + */ +function Cookies(context, opts) { + this.context = context; + this._opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge({ + path: '/' + }, opts); +} +utils_makeContextDependent(Cookies.prototype); + +/** + * Remove cookie by the name. + * @param key + */ +Cookies.prototype.removeCookie = function (key) { + const cntKey = this._toCount(key); + let cntVal = this._getSimpleCookie(cntKey); + if (!cntVal) { + this._removeSimpleCookie(key); + return; + } + this._removeSimpleCookie(cntKey); + cntVal = parseInt(cntVal, 10); + for (let i = 0; i < cntVal; ++i) { + this._removeSimpleCookie(key + i); + } +}; + +/** + * Set new cookie value. Automatically splits + * values that are too large into multiple cookies. + * @param key + * @param value + */ +Cookies.prototype.setCookie = function (key, value) { + this.removeCookie(key); + value = encodeURIComponent(value); + const values = _chunkString(value, MAX_COOKIE_LEN - key.length - 1); + const cntVal = values.length; + if (cntVal === 1) { + this._setSimpleCookie(key, value); + return; + } + const cntKey = this._toCount(key); + this._setSimpleCookie(cntKey, cntVal.toString()); + for (let i = 0; i < cntVal; ++i) { + this._setSimpleCookie(key + i, values[i]); + } +}; + +/** + * Obtain the value of a compound cookie. + * @param key + */ +Cookies.prototype.getCookie = function (key) { + const cntKey = this._toCount(key); + let cntVal = this._getSimpleCookie(cntKey); + if (!cntVal) { + return this._getSimpleCookie(key); + } + cntVal = parseInt(cntVal, 10); + const value = []; + for (let i = 0; i < cntVal; ++i) { + value[i] = this._getSimpleCookie(key + i); + } + return value.join(''); +}; +Cookies.prototype._toCount = function (key) { + return key + COUNT_SUFFIX; +}; +Cookies.prototype._removeSimpleCookie = function (key) { + document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`; +}; +Cookies.prototype._getExpirationDate = function () { + const today = new Date(); + const EXP_PERIOD_YEARS = 10; + today.setFullYear(today.getFullYear() + EXP_PERIOD_YEARS); + return today; +}; +Cookies.prototype._setSimpleCookie = function (key, value) { + document.cookie = `${key}=${value};expires=${this._getExpirationDate().toUTCString()};path=${this._opts.path}`; +}; +Cookies.prototype._getSimpleCookie = function (key) { + const matches = document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`)); + return matches ? decodeURIComponent(matches[1]) : ''; +}; +Cookies.prototype._exists = function (key) { + return document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`)); +}; +/* harmony default export */ const utils_Cookies = (Cookies); +;// CONCATENATED MODULE: ./src/gfx/vr/createWebVRButton.js +/* + * Toggling WebVR is done through button.click because of limitations on calling requestPresent in webVR: + * VRDisplay::requestPresent should be called from user gesture: + * https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestPresent + */ +/* harmony default export */ function createWebVRButton(webVRPoC) { + function showEnterVR(button) { + button.style.display = ''; + button.style.cursor = 'pointer'; + button.style.left = 'calc(50% - 50px)'; + button.style.width = '100px'; + button.textContent = 'ENTER VR'; + let currentSession = null; + function onSessionEnded( /* event */ + ) { + currentSession.removeEventListener('end', onSessionEnded); + button.textContent = 'ENTER VR'; + currentSession = null; + } + function onSessionStarted(session) { + session.addEventListener('end', onSessionEnded); + webVRPoC._gfx.renderer.xr.setReferenceSpaceType('local'); + webVRPoC._gfx.renderer.xr.setSession(session); + button.textContent = 'EXIT VR'; + currentSession = session; + } + button.onmouseenter = function () { + button.style.opacity = '1.0'; + }; + button.onmouseleave = function () { + button.style.opacity = '0.5'; + }; + button.onclick = function () { + if (currentSession === null) { + // WebXR's requestReferenceSpace only works if the corresponding feature + // was requested at session creation time. For simplicity, just ask for + // the interesting ones as optional features, but be aware that the + // requestReferenceSpace call will fail if it turns out to be unavailable. + // ('local' is always available for immersive sessions and doesn't need to + // be requested separately.) + + const sessionInit = { + optionalFeatures: ['local-floor', 'bounded-floor'] + }; + navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted); + webVRPoC.moveSceneBehindHeadset(); } else { - this.logger.warn('selection is empty. Center operation not performed'); + currentSession.end(); } }; - }(); - /** - * Makes a screenshot. - * @param {number} [width] - Width of an image. Defaults to the canvas width. - * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height, - * if width is omitted too. - * @returns {string} Data URL representing the image contents. - */ - - - Miew.prototype.screenshot = function (width, height) { - var gfx = this._gfx; - var deviceWidth = gfx.renderer.domElement.width; - var deviceHeight = gfx.renderer.domElement.height; + } + function showWebXRNotFound(button) { + button.style.display = ''; + button.style.cursor = 'auto'; + button.style.left = 'calc(50% - 75px)'; + button.style.width = '150px'; + button.textContent = 'VR NOT FOUND'; + button.onmouseenter = null; + button.onmouseleave = null; + button.onclick = null; + } + function stylizeElement(element) { + element.style.position = 'absolute'; + element.style.bottom = '20px'; + element.style.padding = '12px 6px'; + element.style.border = '1px solid #fff'; + element.style.borderRadius = '4px'; + element.style.background = 'transparent'; + element.style.color = '#fff'; + element.style.font = 'normal 13px sans-serif'; + element.style.textAlign = 'center'; + element.style.opacity = '0.5'; + element.style.outline = 'none'; + element.style.zIndex = '999'; + } + if ('xr' in navigator) { + const button = document.createElement('button'); + button.style.display = 'none'; + stylizeElement(button); + navigator.xr.isSessionSupported('immersive-vr').then(supported => supported ? showEnterVR(button) : showWebXRNotFound(button)); + return button; + } + const message = document.createElement('a'); + message.href = 'https://webvr.info'; + message.innerHTML = 'WEBXR NOT SUPPORTED'; + message.style.left = 'calc(50% - 90px)'; + message.style.width = '180px'; + message.style.textDecoration = 'none'; + stylizeElement(message); + return message; +} +;// CONCATENATED MODULE: ./src/gfx/vr/WebVRPoC.js + + + + + + +class WebVRPoC { + constructor(onToggle) { + this._mainCamera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PerspectiveCamera(); + this._button = null; + this._onToggle = onToggle; + this._molContainer = new gfxutils.RCGroup(); + this._user = new gfxutils.RCGroup(); + this._scalingPivot = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Object3D(); + this._user.add(this._scalingPivot); + this._controller1 = null; + this._controller2 = null; + this._pressedGripsCounter = 0; + this._distance = 0; + this._gfx = null; + } + startScalingByControllers() { + // reset scale + this._distance = this._controller1.position.distanceTo(this._controller2.position); + gfxutils.getMiddlePoint(this._controller1.position, this._controller2.position, this._scalingPivot.position); + this._scalingPivot.scale.set(1, 1, 1); + this._scalingPivot.updateMatrix(); + this._scalingPivot.updateMatrixWorld(); + // link molecule to pivot + this._scalingPivot.addSavingWorldTransform(this._molContainer); + } + stopScalingByControllers() { + this._gfx.scene.addSavingWorldTransform(this._molContainer); + } + handleGripsDown(event) { + this._pressedGripsCounter++; + if (this._pressedGripsCounter === 2) { + this.startScalingByControllers(); + } else if (this._pressedGripsCounter === 1) { + event.target.addSavingWorldTransform(this._molContainer); + } + } + handleGripsUp(event) { + this._pressedGripsCounter--; + if (this._pressedGripsCounter === 1) { + this.stopScalingByControllers(); + // reattach molecule to other controller + const anotherController = event.target === this._controller1 ? this._controller2 : this._controller1; + anotherController.addSavingWorldTransform(this._molContainer); + } else if (this._pressedGripsCounter === 0) { + this._gfx.scene.addSavingWorldTransform(this._molContainer); + } + } + enable(gfx) { + if (!gfx) { + logger.warn('WebVR couldn\'t be enabled, because gfx is not defined'); + return; + } + this._gfx = gfx; + const { + renderer, + camera + } = gfx; + if (!renderer) { + throw new Error('No renderer is available to toggle WebVR'); + } + if (!camera) { + throw new Error('No camera is available to toggle WebVR'); + } + + // enable xr in renderer + renderer.xr.enabled = true; + // add button for turning vr mode + if (!this._button) { + this._button = createWebVRButton(this); + document.body.appendChild(this._button); + } else { + this._button.style.display = 'block'; + } + // store fog setting + this._mainFog = settings.now.fog; + settings.set('fog', false); + this._plugVRNodesIntoScene(gfx, renderer); + this._setControllersListeners(); - function fov2Tan(fov) { - return Math.tan(THREE.Math.degToRad(0.5 * fov)); + // make some Miew job + if (this._onToggle) { + this._onToggle(true); + } + } + _plugVRNodesIntoScene(gfx, renderer) { + // store common scene camera + this._mainCamera.copy(gfx.camera); + // add hierarchical structure for webVR into scene + gfx.scene.add(this._user); + // turn on webvr transformation + gfx.scene.add(this._molContainer); + this._molContainer.add(gfx.root); + this._controller1 = renderer.xr.getController(0); + this._controller2 = renderer.xr.getController(1); + const mesh = this._createControllerMesh(); + this._controller1.add(mesh); + this._controller2.add(mesh.clone()); + this._user.add(this._controller1); + this._user.add(this._controller2); + } + _setControllersListeners() { + this._controller1.addEventListener('selectstart', event => { + this.handleGripsDown(event); + }); + this._controller1.addEventListener('selectend', event => { + this.handleGripsUp(event); + }); + this._controller2.addEventListener('selectstart', event => { + this.handleGripsDown(event); + }); + this._controller2.addEventListener('selectend', event => { + this.handleGripsUp(event); + }); + this._controller1.addEventListener('squeezestart', event => { + this.handleGripsDown(event); + }); + this._controller1.addEventListener('squeezeend', event => { + this.handleGripsUp(event); + }); + this._controller2.addEventListener('squeezestart', event => { + this.handleGripsDown(event); + }); + this._controller2.addEventListener('squeezeend', event => { + this.handleGripsUp(event); + }); + } + disable() { + if (!this._gfx) { + return; + } + const { + renderer, + camera + } = this._gfx; + if (!renderer) { + throw new Error('No renderer is available to toggle WebVR'); } - function tan2Fov(tan) { - return THREE.Math.radToDeg(Math.atan(tan)) * 2.0; + // nullify webxr callback for animation frame + renderer.setAnimationLoop(null); + const session = renderer.xr.getSession(); + if (session) { + session.end(); } - - function getDataURL() { - var dataURL; - var currBrowser = utils.getBrowser(); - - if (currBrowser === utils.browserType.SAFARI) { - var canvas = document.createElement('canvas'); - var canvasContext = canvas.getContext('2d'); - canvas.width = width === undefined ? deviceWidth : width; - canvas.height = height === undefined ? deviceHeight : height; - canvasContext.drawImage(gfx.renderer.domElement, 0, 0, canvas.width, canvas.height); - dataURL = canvas.toDataURL('image/png'); - } else { - // Copy current canvas to screenshot - dataURL = gfx.renderer.domElement.toDataURL('image/png'); - } - - return dataURL; + renderer.xr.enabled = false; + // remove button of VR entering + if (this._button) { + this._button.style.display = 'none'; } + // restore fog param + settings.set('fog', this._mainFog); + this._unplugVRNodesFromScene(camera); - height = height || width; - var screenshotURI; - - if (width === undefined && height === undefined || width === deviceWidth && height === deviceHeight) { - // renderer.domElement.toDataURL('image/png') returns flipped image in Safari - // It hasn't been resolved yet, but getScreenshotSafari() - // fixes it using an extra canvas. - screenshotURI = getDataURL(); - } else { - var originalAspect = gfx.camera.aspect; - var originalFov = gfx.camera.fov; - var originalTanFov2 = fov2Tan(gfx.camera.fov); // screenshot should contain the principal area of interest (a centered square touching screen sides) - - var areaOfInterestSize = Math.min(gfx.width, gfx.height); - var areaOfInterestTanFov2 = originalTanFov2 * areaOfInterestSize / gfx.height; // set appropriate camera aspect & FOV - - var shotAspect = width / height; - gfx.renderer.setPixelRatio(1); - gfx.camera.aspect = shotAspect; - gfx.camera.fov = tan2Fov(areaOfInterestTanFov2 / Math.min(shotAspect, 1.0)); - gfx.camera.updateProjectionMatrix(); // resize canvas to the required size of screenshot - - gfx.renderer.setDrawingBufferSize(width, height, 1); // make screenshot - - this._renderFrame(settings.now.stereo); - - screenshotURI = getDataURL(); // restore original camera & canvas proportions - - gfx.renderer.setPixelRatio(window.devicePixelRatio); - gfx.camera.aspect = originalAspect; - gfx.camera.fov = originalFov; - gfx.camera.updateProjectionMatrix(); - gfx.renderer.setDrawingBufferSize(gfx.width, gfx.height, window.devicePixelRatio); - this._needRender = true; + // make some Miew job + if (this._onToggle) { + this._onToggle(false); + } + } + _unplugVRNodesFromScene(camera) { + // restore common camera + if (this._mainCamera && camera) { + camera.copy(this._mainCamera); + } + // turn off webvr transformation + const root = this._molContainer.children[0]; + if (root) { + this._gfx.scene.add(root); + } + this._molContainer.parent.remove(this._molContainer); + if (this._user) { + this._gfx.scene.remove(this._user); + } + // free scene nodes + this._molContainer = null; + this._user = null; + this._scalingPivot = null; + this._user = null; + this._controller1 = null; + this._controller2 = null; + } + _createControllerMesh() { + // visualize controllers with cylinders + const geometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.CylinderGeometry(0.04, 0.04, 0.3); + const material = new shaders_UberMaterial({ + lights: false, + overrideColor: true + }); + material.setUberOptions({ + fixedColor: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(0x4444ff) + }); + material.updateUniforms(); + const cylinder = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh(geometry, material); + cylinder.rotateX(-Math.PI / 2); + return cylinder; + } + updateMoleculeScale() { + if (!this._controller1 || !this._controller2) { + return; } + const self = this; + // update molecule scaling by controllers + if (self._pressedGripsCounter === 2) { + // recalc scaling pivot + gfxutils.getMiddlePoint(self._controller1.position, self._controller2.position, self._scalingPivot.position); + // recalc scaler + const dist = self._controller1.position.distanceTo(self._controller2.position); + const scaler = dist / self._distance; + self._scalingPivot.scale.multiplyScalar(scaler); + // save cur distance for next frame + self._distance = dist; + } + } - return screenshotURI; - }; /** - * Makes screenshot and initiates a download. - * @param {string} [filename] - Name of a file. Default to a 'screenshot-XXXXX.png', where XXXXX is a current - * date/time in seconds. - * @param {number} [width] - Width of an image. Defaults to the canvas width. - * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height, - * if width is omitted too. + * Reposition molecule right before the camera. + * @note The proper way is to initiate headset in the place of common Miew's camera. + * But threejs limitations on setting new XRReferenceSpace enforce the molecule repositioning + * Hope, something will change. */ + moveSceneBehindHeadset() { + const gfx = this._gfx; + const { + camera + } = gfx; + + // set container position in camera space + const container = this._molContainer; + container.matrix.identity(); + container.position.set(0, 0, -4.0); + container.updateMatrix(); + + // update container world matrix + container.matrixWorld.multiplyMatrices(camera.matrixWorld, container.matrix); + // readd to scene + gfx.scene.addSavingWorldTransform(container); + if (this._onToggle) { + this._onToggle(true); + } + } + getCanvas() { + const gfx = this._gfx; + return gfx && gfx.renderer ? gfx.renderer.domElement : null; + } +} +;// CONCATENATED MODULE: ./src/gfx/shaders/ScreenQuadFromDistortionTex.frag +const ScreenQuadFromDistortionTex_namespaceObject = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform vec3 aberration;\r\n\r\nvoid main() {\r\n vec2 uv = vUv * 2.0 - 1.0;\r\n \r\n gl_FragColor.r = texture2D(srcTex, 0.5 * (uv * aberration[0] + 1.0)).r;\r\n gl_FragColor.g = texture2D(srcTex, 0.5 * (uv * aberration[1] + 1.0)).g;\r\n gl_FragColor.b = texture2D(srcTex, 0.5 * (uv * aberration[2] + 1.0)).b;\r\n gl_FragColor.a = 1.0;\r\n}"; +;// CONCATENATED MODULE: ./src/Miew.js +/* global PACKAGE_VERSION:false */ - Miew.prototype.screenshotSave = function (filename, width, height) { - var uri = this.screenshot(width, height); - utils.shotDownload(uri, filename); - }; - - Miew.prototype.save = function (opts) { - var _this7 = this; - this._export(opts.fileType).then(function (dataString) { - var filename = _this7._visuals[_this7._curVisualName]._complex.name; - utils.download(dataString, filename, opts.fileType); - _this7._refreshTitle(); - _this7.dispatchEvent({ - type: 'exportingDone' - }); - })["catch"](function (error) { - _this7.logger.error('Could not export data'); - _this7.logger.debug(error); - _this7._refreshTitle(); - _this7.dispatchEvent({ - type: 'exportingDone', - error: error - }); - }); - }; - Miew.prototype._tweakResolution = function () { - var maxPerf = [['poor', 100], ['low', 500], ['medium', 1000], ['high', 5000], ['ultra', Number.MAX_VALUE]]; - var atomCount = 0; - this._forEachComplexVisual(function (visual) { - atomCount += visual.getComplex().getAtomCount(); - }); - if (atomCount > 0) { - var performance = this._gfxScore * 10e5 / atomCount; // set resolution based on estimated performance - for (var i = 0; i < maxPerf.length; ++i) { - if (performance < maxPerf[i][1]) { - this._autoChangeResolution(maxPerf[i][0]); - break; - } - } - } - }; - Miew.prototype._autoChangeResolution = function (resolution) { - if (resolution !== settings.now.resolution) { - this.logger.report("Your rendering resolution was changed to \"".concat(resolution, "\" for best performance.")); - } - settings.now.resolution = resolution; - }; - /** - * Save current settings to cookies. - */ - Miew.prototype.saveSettings = function () { - this._cookies.setCookie(this._opts.settingsCookie, JSON.stringify(this.settings.getDiffs(true))); - }; - /** - * Load settings from cookies. - */ - Miew.prototype.restoreSettings = function () { - try { - var cookie = this._cookies.getCookie(this._opts.settingsCookie); - var diffs = cookie ? JSON.parse(cookie) : {}; - this.settings.applyDiffs(diffs, true); - } catch (e) { - this.logger.error("Cookies parse error: ".concat(e.message)); - } - }; - /** - * Reset current settings to the defaults. - */ - Miew.prototype.resetSettings = function () { - this.settings.reset(); - }; - /* - * DANGEROUS and TEMPORARY. The method should change or disappear in future versions. - * @param {string|object} opts - See {@link Miew} constructor. - * @see {@link Miew#set}, {@link Miew#repAdd}, {@link Miew#rep}. - */ - Miew.prototype.setOptions = function (opts) { - if (typeof opts === 'string') { - opts = Miew.options.fromAttr(opts); - } - if (opts.reps) { - this._opts.reps = null; - } - _.merge(this._opts, opts); - if (opts.settings) { - this.set(opts.settings); - } - this._opts._objects = opts._objects; - this._resetObjects(); - if (opts.load) { - this.load(opts.load, { - fileType: opts.type - }); - } - if (opts.preset) { - settings.now.preset = opts.preset; - } - if (opts.reps) { - this.resetReps(opts.preset); - } - if (this._opts.view) { - this.view(this._opts.view); - delete this._opts.view; - } - var visual = this._getComplexVisual(); - if (visual) { - visual.getComplex().resetCurrentUnit(); - if (_.isNumber(opts.unit)) { - visual.getComplex().setCurrentUnit(opts.unit); - } - this.resetView(); - this.rebuildAll(); - } - }; - Miew.prototype.info = function (name) { - var visual = this._getComplexVisual(name); - if (!visual) { - return {}; - } - var complex = visual.getComplex(); - var metadata = complex.metadata; - return { - id: metadata.id || complex.name || 'UNKNOWN', - title: metadata.title && metadata.title.join(' ') || 'UNKNOWN DATA', - atoms: complex.getAtomCount(), - bonds: complex.getBondCount(), - residues: complex.getResidueCount(), - chains: complex.getChainCount() - }; - }; - /* - * OBJECTS SEGMENT - */ - Miew.prototype.addObject = function (objData, bThrow) { - var Ctor = null; - if (objData.type === LinesObj.prototype.type) { - Ctor = LinesObj; - } - if (Ctor === null) { - throw new Error("Unknown scene object type - ".concat(objData.type)); - } - try { - var newObj = new Ctor(objData.params, objData.opts); +const { + selectors: Miew_selectors, + Atom: Miew_Atom, + Residue: Miew_Residue, + Chain: Miew_Chain, + Molecule: Miew_Molecule +} = chem; +const EDIT_MODE = { + COMPLEX: 0, + COMPONENT: 1, + FRAGMENT: 2 +}; +const LOADER_NOT_FOUND = 'Could not find suitable loader for this source'; +const PARSER_NOT_FOUND = 'Could not find suitable parser for this source'; - this._addSceneObject(newObj); - } catch (error) { - if (!bThrow) { - this.logger.debug("Error during scene object creation: ".concat(error.message)); - } else { - throw error; +// Color management changed a lot in threejs 152+ version. +// To keep miew colors we disable the new color management system +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.ColorManagement.enabled = false; +const { + createElement: Miew_createElement +} = utils; +function updateFogRange(fog, center, radius) { + fog.near = center - radius * settings.now.fogNearFactor; + fog.far = center + radius * settings.now.fogFarFactor; +} +function removeExtension(fileName) { + const dot = fileName.lastIndexOf('.'); + if (dot >= 0) { + fileName = fileName.substr(0, dot); + } + return fileName; +} +function hasValidResidues(complex) { + let hasValidRes = false; + complex.forEachComponent(component => { + component.forEachResidue(residue => { + if (residue._isValid) { + hasValidRes = true; } - } - - this._needRender = true; - }; - - Miew.prototype._addSceneObject = function (sceneObject) { - var visual = this._getComplexVisual(); - - if (sceneObject.build && visual) { - sceneObject.build(visual.getComplex()); + }); + }); + return hasValidRes; +} +function reportProgress(log, action, percent) { + const TOTAL_PERCENT = 100; + if (percent !== undefined) { + log.debug(`${action}... ${Math.floor(percent * TOTAL_PERCENT)}%`); + } else { + log.debug(`${action}...`); + } +} +function chooseFogColor() { + return settings.now.fogColorEnable ? settings.now.fogColor : settings.now.bg.color; +} + +// //////////////////////////////////////////////////////////////////////////// + +/** + * Main 3D Molecular Viewer class. + * + * @param {object} opts - Viewer options. + * @param {HTMLElement=} opts.container - DOM element that serves as a viewer container. + * @param {object=} opts.settings - An object with properties to override default settings. + * @param {string=} opts.settingsCookie='settings' - The name of the cookie to save current settings to. + * @param {string=} opts.cookiePath='/' - The path option for cookies. Defaults to root. + * + * @exports Miew + * @constructor + */ +function Miew(opts) { + utils_EventDispatcher.call(this); + this._opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge({ + settingsCookie: 'settings', + cookiePath: '/' + }, opts); + /** @type {?object} */ + this._gfx = null; + /** @type {ViewInterpolator} */ + this._interpolator = new ViewInterpolator(); + /** @type {HTMLElement} */ + this._container = opts && opts.container || document.getElementById('miew-container') || external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().head(document.getElementsByClassName('miew-container')) || document.body; + /** @type {HTMLElement} */ + this._containerRoot = this._container; + + /** @type {boolean} */ + this._running = false; + /** @type {boolean} */ + this._halting = false; + /** @type {boolean} */ + this._building = false; + /** @type {boolean} */ + this._needRender = true; + /** @type {boolean} */ + this._hotKeysEnabled = true; + + /** @type {Settings} */ + this.settings = settings; + const log = logger; + log.console = false; + log.level = false ? 0 : 'info'; + /** + * @type {Logger} + * @example + * miew.logger.addEventListener('message', function _onLogMessage(evt) { + * console.log(evt.message); + * }); + */ + this.logger = log; + this._cookies = new utils_Cookies(this); + this.restoreSettings(); + if (opts && opts.settings) { + this.settings.set(opts.settings); + } - this._gfx.pivot.add(sceneObject.getGeometry()); - } + /** @type {?Spinner} */ + this._spinner = null; + /** @type {JobHandle[]} */ + this._loading = []; + /** @type {?number} + * @deprecated until Animation system refactoring + */ + this._animInterval = null; - var objects = this._objects; - objects[objects.length] = sceneObject; - }; + /** @type {object} */ + this._visuals = {}; + /** @type {?string} */ + this._curVisualName = null; - Miew.prototype._updateObjsToFrame = function (frameData) { - var objs = this._objects; + /** @type {array} */ + this._objects = []; - for (var i = 0, n = objs.length; i < n; ++i) { - if (objs[i].updateToFrame) { - objs[i].updateToFrame(frameData); + /** @type {object} */ + this._sourceWindow = null; + this.reset(); + if (this._repr) { + log.debug(`Selected ${this._repr.mode.name} mode with ${this._repr.colorer.name} colorer.`); + } + const self = this; + Miew.registeredPlugins.forEach(plugin => { + plugin.call(self); + }); + this._initOnSettingsChanged(); +} +Miew.prototype = Object.create(utils_EventDispatcher.prototype); +Miew.prototype.constructor = Miew; +Miew.prototype.getMaxRepresentationCount = function () { + return src_ComplexVisual.NUM_REPRESENTATION_BITS; +}; + +/** + * Replace viewer container contents with a DOM element. + * @param {HTMLElement} container - parent container. + * @param {HTMLElement} element - DOM element to show. + * @private + */ +function _setContainerContents(container, element) { + const parent = container; + while (parent.firstChild) { + parent.removeChild(parent.firstChild); + } + parent.appendChild(element); +} + +/** + * Update Shadow Camera target position and frustum. + * @private + */ +Miew.prototype._updateShadowCamera = function () { + const shadowMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + const direction = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const OBB = { + center: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(), + halfSize: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3() + }; + return function () { + this._gfx.scene.updateMatrixWorld(); + for (let i = 0; i < this._gfx.scene.children.length; i++) { + if (this._gfx.scene.children[i].type === 'DirectionalLight') { + const light = this._gfx.scene.children[i]; + shadowMatrix.copy(light.shadow.camera.matrixWorldInverse); + this.getOBB(shadowMatrix, OBB); + direction.subVectors(light.target.position, light.position); + light.position.subVectors(OBB.center, direction); + light.target.position.copy(OBB.center); + light.shadow.bias = 0.09; + light.shadow.camera.bottom = -OBB.halfSize.y; + light.shadow.camera.top = OBB.halfSize.y; + light.shadow.camera.right = OBB.halfSize.x; + light.shadow.camera.left = -OBB.halfSize.x; + light.shadow.camera.near = direction.length() - OBB.halfSize.z; + light.shadow.camera.far = direction.length() + OBB.halfSize.z; + light.shadow.camera.updateProjectionMatrix(); + } + } + }; +}(); + +/** + * Initialize the viewer. + * @returns {boolean} true on success. + * @throws Forwards exception raised during initialization. + * @see Miew#term + */ +Miew.prototype.init = function () { + const container = this._container; + const elem = utils.createElement('div', { + class: 'miew-canvas' + }); + _setContainerContents(container, elem); + this._container = elem; + const frag = document.createDocumentFragment(); + frag.appendChild(this._msgMode = Miew_createElement('div', { + class: 'mode-message overlay' + }, Miew_createElement('p', {}, 'COMPONENT EDIT MODE'))); + frag.appendChild(this._msgAtomInfo = Miew_createElement('div', { + class: 'atom-info overlay' + }, Miew_createElement('p', {}, ''))); + container.appendChild(frag); + if (this._gfx !== null) { + // block double init + return true; + } + const self = this; + this._showMessage('Viewer is being initialized...'); + try { + this._initGfx(); + this._initListeners(); + this._spinner = new Spinner({ + lines: 13, + length: 28, + width: 14, + radius: 42, + color: '#fff', + zIndex: 700 + }); + const target = getTopWindow(); + target.addEventListener('keydown', event => { + self._onKeyDown(event); + }); + target.addEventListener('keyup', event => { + self._onKeyUp(event); + }); + this._objectControls = new ui_ObjectControls(this._gfx.root, this._gfx.pivot, this._gfx.camera, this._gfx.renderer.domElement, () => self._getAltObj()); + this._objectControls.addEventListener('change', e => { + if (settings.now.shadow.on) { + self._updateShadowCamera(); } - } - }; - - Miew.prototype._resetObjects = function () { - var objs = this._opts._objects; - this._objects = []; - - if (objs) { - for (var i = 0, n = objs.length; i < n; ++i) { - this.addObject(objs[i], false); + // route rotate, zoom, translate and translatePivot events to the external API + switch (e.action) { + case 'rotate': + self.dispatchEvent({ + type: 'rotate', + quaternion: e.quaternion + }); + break; + case 'zoom': + self.dispatchEvent({ + type: 'zoom', + factor: e.factor + }); + break; + default: + self.dispatchEvent({ + type: e.action + }); } + self.dispatchEvent({ + type: 'transform' + }); + self._needRender = true; + }); + const gfx = this._gfx; + this._picker = new ui_Picker(gfx.root, gfx.camera, gfx.renderer.domElement); + this._picker.addEventListener('newpick', event => { + self._onPick(event); + }); + this._picker.addEventListener('dblclick', event => { + self.center(event); + }); + } catch (error) { + if (error.name === 'TypeError' && error.message === 'Cannot read property \'getExtension\' of null') { + this._showMessage('Could not create WebGL context.'); + } else if (error.message.search(/webgl/i) > 1) { + this._showMessage(error.message); + } else { + this._showMessage('Viewer initialization failed.'); + throw error; } - }; + return false; + } - Miew.prototype.removeObject = function (index) { - var obj = this._objects[index]; + // automatically load default file + const file = this._opts && this._opts.load; + if (file) { + const type = this._opts && this._opts.type; + this.load(file, { + fileType: type, + keepRepsInfo: true + }); + } + return true; +}; + +/** + * Terminate the viewer completely. + * @see Miew#init + */ +Miew.prototype.term = function () { + this._showMessage('Viewer has been terminated.'); + this._loading.forEach(job => { + job.cancel(); + }); + this._loading.length = 0; + this.halt(); + this._gfx = null; +}; + +/** + * Display message inside the viewer container, hiding WebGL canvas. + * @param {string} msg - Message to show. + * @private + */ +Miew.prototype._showMessage = function (msg) { + const element = document.createElement('div'); + element.setAttribute('class', 'miew-message'); + element.appendChild(document.createElement('p')).appendChild(document.createTextNode(msg)); + _setContainerContents(this._container, element); +}; + +/** + * Display WebGL canvas inside the viewer container, hiding any message shown. + * @private + */ +Miew.prototype._showCanvas = function () { + _setContainerContents(this._container, this._gfx.renderer.domElement); +}; +Miew.prototype._requestAnimationFrame = function (callback) { + const { + xr + } = this._gfx.renderer; + if (xr && xr.enabled) { + this._gfx.renderer.setAnimationLoop(callback); + return; + } + requestAnimationFrame(callback); +}; +function arezSpritesSupported(context) { + return context.getExtension('EXT_frag_depth'); +} +function isAOSupported(context) { + return context.getExtension('WEBGL_depth_texture') && context.getExtension('WEBGL_draw_buffers'); +} + +/** + * Initialize WebGL and set 3D scene up. + * @private + */ +Miew.prototype._initGfx = function () { + const gfx = { + width: this._container.clientWidth, + height: this._container.clientHeight + }; + const webGLOptions = { + preserveDrawingBuffer: true, + alpha: true, + premultipliedAlpha: false + }; + if (settings.now.antialias) { + webGLOptions.antialias = true; + } + gfx.renderer2d = new gfx_CSS2DRenderer(); + gfx.renderer = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGL1Renderer(webGLOptions); + gfx.renderer.shadowMap.enabled = settings.now.shadow.on; + gfx.renderer.shadowMap.autoUpdate = false; + gfx.renderer.shadowMap.type = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PCFShadowMap; + capabilities.init(gfx.renderer); + + // z-sprites and ambient occlusion possibility + if (!arezSpritesSupported(gfx.renderer.getContext())) { + settings.set('zSprites', false); + } + if (!isAOSupported(gfx.renderer.getContext())) { + settings.set('ao', false); + } + gfx.renderer.autoClear = false; + gfx.renderer.setPixelRatio(window.devicePixelRatio); + gfx.renderer.setSize(gfx.width, gfx.height); + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + gfx.renderer.clearColor(); + gfx.renderer2d.setSize(gfx.width, gfx.height); + gfx.camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.PerspectiveCamera(settings.now.camFov, gfx.width / gfx.height, settings.now.camNear, settings.now.camFar); + gfx.camera.setMinimalFov(settings.now.camFov); + gfx.camera.position.z = settings.now.camDistance; + gfx.camera.updateProjectionMatrix(); + gfx.camera.layers.set(gfxutils.LAYERS.DEFAULT); + gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME); + gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME_BFPLANE); + gfx.stereoCam = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.StereoCamera(); + gfx.scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Scene(); + const color = chooseFogColor(); + gfx.scene.fog = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Fog(color, settings.now.camNear, settings.now.camFar); + gfx.root = new gfxutils.RCGroup(); + gfx.scene.add(gfx.root); + gfx.pivot = new gfxutils.RCGroup(); + gfx.root.add(gfx.pivot); + gfx.selectionScene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Scene(); + gfx.selectionRoot = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group(); + gfx.selectionRoot.matrixAutoUpdate = false; + gfx.selectionScene.add(gfx.selectionRoot); + gfx.selectionPivot = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Group(); + gfx.selectionPivot.matrixAutoUpdate = false; + gfx.selectionRoot.add(gfx.selectionPivot); + const light12 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.DirectionalLight(0xffffff, 0.45); + light12.position.set(0, 0.414, 1); + light12.layers.enable(gfxutils.LAYERS.TRANSPARENT); + light12.castShadow = true; + light12.shadow.bias = 0.09; + light12.shadow.radius = settings.now.shadow.radius; + light12.shadow.camera.layers.set(gfxutils.LAYERS.SHADOWMAP); + const pixelRatio = gfx.renderer.getPixelRatio(); + const shadowMapSize = Math.max(gfx.width, gfx.height) * pixelRatio; + light12.shadow.mapSize.width = shadowMapSize; + light12.shadow.mapSize.height = shadowMapSize; + light12.target.position.set(0.0, 0.0, 0.0); + gfx.scene.add(light12); + gfx.scene.add(light12.target); + const light3 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.AmbientLight(0x666666); + light3.layers.enable(gfxutils.LAYERS.TRANSPARENT); + gfx.scene.add(light3); + + // add axes + gfx.axes = new gfx_Axes(gfx.root, gfx.camera); + const deviceWidth = gfx.width * pixelRatio; + const deviceHeight = gfx.height * pixelRatio; + gfx.offscreenBuf = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.NearestFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, + depthBuffer: true + }); + if (gfx.renderer.getContext().getExtension('WEBGL_depth_texture')) { + gfx.offscreenBuf.depthTexture = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.DepthTexture(); + gfx.offscreenBuf.depthTexture.type = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.UnsignedShortType; + } + gfx.offscreenBuf2 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, + depthBuffer: false + }); + gfx.offscreenBuf3 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, + depthBuffer: false + }); + gfx.offscreenBuf4 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, + depthBuffer: false + }); + gfx.volBFTex = gfx.offscreenBuf3; + gfx.volFFTex = gfx.offscreenBuf4; + gfx.volWFFTex = gfx.offscreenBuf; + + // use float textures for volume rendering if possible + if (gfx.renderer.getContext().getExtension('OES_texture_float')) { + gfx.offscreenBuf5 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, + type: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.FloatType, + depthBuffer: false + }); + gfx.offscreenBuf6 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, + type: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.FloatType, + depthBuffer: false + }); + gfx.offscreenBuf7 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, + type: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.FloatType, + depthBuffer: true + }); + gfx.volBFTex = gfx.offscreenBuf5; + gfx.volFFTex = gfx.offscreenBuf6; + gfx.volWFFTex = gfx.offscreenBuf7; + } else { + this.logger.warn('Device doesn\'t support OES_texture_float extension'); + } + gfx.stereoBufL = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, + depthBuffer: false + }); + gfx.stereoBufR = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat, + depthBuffer: false + }); + this._gfx = gfx; + this._showCanvas(); + this._embedWebXR(settings.now.stereo === 'WEBVR'); + this._container.appendChild(gfx.renderer2d.getElement()); + + // add FPS counter + const stats = new gfx_Stats(); + stats.domElement.style.position = 'absolute'; + stats.domElement.style.right = '0'; + stats.domElement.style.bottom = '0'; + this._container.appendChild(stats.domElement); + this._fps = stats; + this._fps.show(settings.now.fps); +}; + +/** + * Setup event listeners. + * @private + */ +Miew.prototype._initListeners = function () { + const self = this; + window.addEventListener('resize', () => { + self._onResize(); + }); +}; + +/** + * Try to add numbers to the base name to make it unique among visuals + * @private + */ +Miew.prototype._makeUniqueVisualName = function (baseName) { + if (!baseName) { + return Math.random().toString(); + } + let name = baseName; + let suffix = 1; + while (this._visuals.hasOwnProperty(name)) { + name = `${baseName} (${suffix.toString()})`; + suffix++; + } + return name; +}; + +/** + * Add visual to the viewer + * @private + */ +Miew.prototype._addVisual = function (visual) { + if (!visual) { + return null; + } - if (!obj) { - throw new Error("Scene object with index ".concat(index, " does not exist")); - } + // change visual name in order to make it unique + const name = this._makeUniqueVisualName(visual.name); + visual.name = name; + this._visuals[name] = visual; + this._gfx.pivot.add(visual); + if (visual.getSelectionGeo) { + this._gfx.selectionPivot.add(visual.getSelectionGeo()); + } + return name; +}; + +/** + * Remove visual from the viewer + * @private + */ +Miew.prototype._removeVisual = function (visual) { + let name = ''; + let obj = null; + if (visual instanceof src_Visual) { + ({ + name + } = visual); + obj = visual; + } else if (typeof visual === 'string') { + name = visual; + obj = this._visuals[name]; + } + if (!obj || !this._visuals.hasOwnProperty(name) || this._visuals[name] !== obj) { + return; + } + if (name === this._curVisualName) { + this._curVisualName = undefined; + } + delete this._visuals[name]; + obj.release(); // removes nodes from scene - obj.destroy(); + this._needRender = true; +}; - this._objects.splice(index, 1); +/** + * Call specified function for each Visual + * @private + */ +Miew.prototype._forEachVisual = function (callback) { + for (const name in this._visuals) { + if (this._visuals.hasOwnProperty(name)) { + callback(this._visuals[name]); + } + } +}; + +/** + * Release (destroy) all visuals in the scene + * @private + */ +Miew.prototype._releaseAllVisuals = function () { + if (!this._gfx || !this._gfx.pivot) { + return; + } + for (const name in this._visuals) { + if (this._visuals.hasOwnProperty(name)) { + this._visuals[name].release(); + } + } + this._visuals = {}; +}; + +/** + * Call specified function for each ComplexVisual + * @private + */ +Miew.prototype._forEachComplexVisual = function (callback) { + if (!this._gfx || !this._gfx.pivot) { + return; + } + for (const name in this._visuals) { + if (this._visuals.hasOwnProperty(name) && this._visuals[name] instanceof src_ComplexVisual) { + callback(this._visuals[name]); + } + } +}; + +/** + * Returns ComplexVisual with specified name, or current (if not found), or any, or null + * @private + */ +Miew.prototype._getComplexVisual = function (name) { + name = name || this._curVisualName; + let any = null; + let named = null; + this._forEachComplexVisual(visual => { + any = visual; + if (visual.name === name) { + named = visual; + } + }); + return named || any; +}; + +/** + * Returns first found VolumeVisual (no more than one should be present actually) + * @private + */ +Miew.prototype._getVolumeVisual = function () { + let any = null; + this._forEachVisual(visual => { + if (visual instanceof src_VolumeVisual) { + any = visual; + } + }); + return any; +}; + +/** + * Returns ComplexVisual corresponding to specified complex + * @private + */ +Miew.prototype._getVisualForComplex = function (complex) { + if (!complex) { + return null; + } + let found = null; + this._forEachComplexVisual(visual => { + if (visual.getComplex() === complex) { + found = visual; + } + }); + return found; +}; - this._needRender = true; - }; - /** - * Get a string with a URL to reproduce the current scene. - * - * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full - * preset information regardless of the differences with settings - * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included - * @param {boolean} [opts.view=false] - when this flag is true, a view information is included - * @returns {string} URL +/* + * Get a list of names of visuals currently shown by the viewer */ +Miew.prototype.getVisuals = function () { + return Object.keys(this._visuals); +}; - - Miew.prototype.getURL = function (opts) { - return options.toURL(this.getState(_.defaults(opts, { - compact: true, - settings: false, - view: false - }))); - }; - /** - * Get a string with a script to reproduce the current scene. - * - * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full - * preset information regardless of the differences with settings - * @param {boolean} [opts.settings=true] - when this flag is true, changes in settings are included - * @param {boolean} [opts.view=true] - when this flag is true, a view information is included - * @returns {string} script +/* + * Get complex visuals count + */ +Miew.prototype.getComplexVisualsCount = function () { + let count = 0; + this._forEachComplexVisual(() => count++); + return count; +}; + +/* + * Get current visual */ +Miew.prototype.getCurrentVisual = function () { + return this._curVisualName; +}; +/* + * Set current visual. + * All further operations will be performed on this visual (complex) if not stated otherwise. + */ +Miew.prototype.setCurrentVisual = function (name) { + if (!this._visuals[name]) { + return; + } + this._curVisualName = name; +}; + +/** + * Run the viewer, start processing update/render frames periodically. + * Has no effect if already running. + * @see Miew#halt + */ +Miew.prototype.run = function () { + if (!this._running) { + this._running = true; + if (this._halting) { + this._halting = false; + return; + } + this._objectControls.enable(true); + this._interpolator.resume(); + this._requestAnimationFrame(() => this._onTick()); + } +}; + +/** + * Request the viewer to stop. + * Will be processed during the next frame. + * @see Miew#run + */ +Miew.prototype.halt = function () { + if (this._running) { + this._discardComponentEdit(); + this._discardFragmentEdit(); + this._objectControls.enable(false); + this._interpolator.pause(); + this._halting = true; + } +}; + +/** + * Request the viewer to start / stop responsing + * on hot keys. + * @param enabled - start (true) or stop (false) response on hot keys. + */ +Miew.prototype.enableHotKeys = function (enabled) { + this._hotKeysEnabled = enabled; + this._objectControls.enableHotkeys(enabled); +}; + +/** + * Callback which processes window resize. + * @private + */ +Miew.prototype._onResize = function () { + const gfx = this._gfx; + if (!gfx) { + return; + } + this._needRender = true; + gfx.width = this._container.clientWidth; + gfx.height = this._container.clientHeight; + gfx.camera.aspect = gfx.width / gfx.height; + gfx.camera.setMinimalFov(settings.now.camFov); + gfx.camera.updateProjectionMatrix(); + gfx.renderer.setSize(gfx.width, gfx.height); + gfx.renderer2d.setSize(gfx.width, gfx.height); + this.dispatchEvent({ + type: 'resize' + }); +}; +Miew.prototype._resizeOffscreenBuffers = function (width, height, stereo) { + const gfx = this._gfx; + stereo = stereo || 'NONE'; + const isAnaglyph = stereo === 'NONE' || stereo === 'ANAGLYPH'; + const multi = isAnaglyph ? 1 : 0.5; + gfx.offscreenBuf.setSize(multi * width, height); + gfx.offscreenBuf2.setSize(multi * width, height); + gfx.offscreenBuf3.setSize(multi * width, height); + gfx.offscreenBuf4.setSize(multi * width, height); + if (gfx.offscreenBuf5) { + gfx.offscreenBuf5.setSize(multi * width, height); + } + if (gfx.offscreenBuf6) { + gfx.offscreenBuf6.setSize(multi * width, height); + } + if (gfx.offscreenBuf7) { + gfx.offscreenBuf7.setSize(multi * width, height); + } + if (isAnaglyph) { + gfx.stereoBufL.setSize(width, height); + gfx.stereoBufR.setSize(width, height); + } +}; + +/** + * Callback which processes update/render frames. + * @private + */ +Miew.prototype._onTick = function () { + if (this._halting) { + this._running = false; + this._halting = false; + return; + } + this._fps.update(); + this._requestAnimationFrame(() => this._onTick()); + this._onUpdate(); + if (this._needRender) { + this._onRender(); + this._needRender = !settings.now.suspendRender || settings.now.stereo === 'WEBVR'; + } +}; +Miew.prototype._getBSphereRadius = function () { + // calculate radius that would include all visuals + let radius = 0; + this._forEachVisual(visual => { + radius = Math.max(radius, visual.getBoundaries().boundingSphere.radius); + }); + return radius * this._objectControls.getScale(); +}; + +/** + * Calculate bounding box that would include all visuals and being axis aligned in world defined by + * transformation matrix: matrix + * @param {Matrix4} matrix - transformation matrix. + * @param {object} OBB - calculating bounding box. + * @param {Vector3} OBB.center - OBB center. + * @param {Vector3} OBB.halfSize - half magnitude of OBB sizes. + */ +Miew.prototype.getOBB = function () { + const _bSphereForOneVisual = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Sphere(); + const _bBoxForOneVisual = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(); + const _bBox = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(); + const _invMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + const _points = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3()]; + return function (matrix, OBB) { + _bBox.makeEmpty(); + this._forEachVisual(visual => { + _bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere); + _bSphereForOneVisual.applyMatrix4(visual.matrixWorld).applyMatrix4(matrix); + _bSphereForOneVisual.getBoundingBox(_bBoxForOneVisual); + _bBox.union(_bBoxForOneVisual); + }); + _bBox.getCenter(OBB.center); + _invMatrix.copy(matrix).invert(); + OBB.center.applyMatrix4(_invMatrix); + const { + min + } = _bBox; + const { + max + } = _bBox; + _points[0].set(min.x, min.y, min.z); // 000 + _points[1].set(max.x, min.y, min.z); // 100 + _points[2].set(min.x, max.y, min.z); // 010 + _points[3].set(min.x, min.y, max.z); // 001 + for (let i = 0, l = _points.length; i < l; i++) { + _points[i].applyMatrix4(_invMatrix); + } + OBB.halfSize.set(Math.abs(_points[0].x - _points[1].x), Math.abs(_points[0].y - _points[2].y), Math.abs(_points[0].z - _points[3].z)).multiplyScalar(0.5); + }; +}(); +Miew.prototype._updateFog = function () { + const gfx = this._gfx; + if (settings.now.fog) { + if (typeof gfx.scene.fog === 'undefined' || gfx.scene.fog === null) { + const color = chooseFogColor(); + gfx.scene.fog = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Fog(color); + this._setUberMaterialValues({ + fog: settings.now.fog + }); + } + updateFogRange(gfx.scene.fog, gfx.camera.position.z, this._getBSphereRadius()); + } else if (gfx.scene.fog) { + gfx.scene.fog = undefined; + this._setUberMaterialValues({ + fog: settings.now.fog + }); + } +}; +Miew.prototype._onUpdate = function () { + if (this.isScriptingCommandAvailable !== undefined && this.isScriptingCommandAvailable() && !this._building) { + this.callNextCmd(); + } + this._objectControls.update(); + this._forEachComplexVisual(visual => { + visual.getComplex().update(); + }); + if (settings.now.autobuild && !this._loading.length && !this._building && this._needRebuild()) { + this.rebuild(); + } + if (!this._loading.length && !this._building && !this._needRebuild()) { + this._updateView(); + } + this._updateFog(); + if (this._gfx.renderer.xr.enabled) { + this.webVR.updateMoleculeScale(); + } +}; +Miew.prototype._onRender = function () { + const gfx = this._gfx; + + // update all matrices + gfx.scene.updateMatrixWorld(); + gfx.camera.updateMatrixWorld(); + this._clipPlaneUpdateValue(this._getBSphereRadius()); + this._fogFarUpdateValue(); + gfx.renderer.setRenderTarget(null); + gfx.renderer.clear(); + this._renderFrame(settings.now.stereo); +}; +Miew.prototype._renderFrame = function () { + const _anaglyphMat = new shaders_AnaglyphMaterial(); + const _size = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(); + return function (stereo) { + const gfx = this._gfx; + const { + renderer + } = gfx; + renderer.getSize(_size); + if (stereo !== 'NONE') { + gfx.camera.focus = gfx.camera.position.z; // set focus to the center of the object + gfx.stereoCam.aspect = 1.0; + + // in anaglyph mode we render full-size image for each eye + // while in other stereo modes only half-size (two images on the screen) + if (stereo === 'ANAGLYPH') { + gfx.stereoCam.update(gfx.camera); + } else { + gfx.stereoCam.updateHalfSized(gfx.camera, settings.now.camFov); + } + } - Miew.prototype.getScript = function (opts) { - return options.toScript(this.getState(_.defaults(opts, { - compact: true, - settings: true, - view: true - }))); + // resize offscreen buffers to match the target + const pixelRatio = gfx.renderer.getPixelRatio(); + this._resizeOffscreenBuffers(_size.width * pixelRatio, _size.height * pixelRatio, stereo); + this._renderShadowMap(); + switch (stereo) { + case 'WEBVR': + case 'NONE': + this._renderScene(gfx.camera, false); + break; + case 'SIMPLE': + case 'DISTORTED': + renderer.setScissorTest(true); + renderer.setScissor(0, 0, _size.width / 2, _size.height); + renderer.setViewport(0, 0, _size.width / 2, _size.height); + this._renderScene(this._gfx.stereoCam.cameraL, stereo === 'DISTORTED'); + renderer.setScissor(_size.width / 2, 0, _size.width / 2, _size.height); + renderer.setViewport(_size.width / 2, 0, _size.width / 2, _size.height); + this._renderScene(this._gfx.stereoCam.cameraR, stereo === 'DISTORTED'); + renderer.setScissorTest(false); + break; + case 'ANAGLYPH': + this._renderScene(this._gfx.stereoCam.cameraL, false, gfx.stereoBufL); + this._renderScene(this._gfx.stereoCam.cameraR, false, gfx.stereoBufR); + renderer.setRenderTarget(null); + _anaglyphMat.uniforms.srcL.value = gfx.stereoBufL.texture; + _anaglyphMat.uniforms.srcR.value = gfx.stereoBufR.texture; + gfx.renderer.renderScreenQuad(_anaglyphMat); + break; + default: + } + gfx.renderer2d.render(gfx.scene, gfx.camera); + if (settings.now.axes && gfx.axes && !gfx.renderer.xr.enabled) { + gfx.axes.render(renderer); + } }; - /* - * Generates object that represents the current state of representations list - * @param {boolean} compareWithDefaults - when this flag is true, reps list is compared (if possible) - * to preset's defaults and only diffs are generated - */ - - - Miew.prototype._compareReps = function (complexVisual, compareWithDefaults) { - var ans = {}; - var repCount = 0; - - if (complexVisual) { - repCount = complexVisual.repCount(); +}(); +Miew.prototype._onBgColorChanged = function () { + const gfx = this._gfx; + const color = chooseFogColor(); + if (gfx) { + if (gfx.scene.fog) { + gfx.scene.fog.color.set(color); } - - var currPreset = settings.defaults.presets[settings.now.preset]; - var compare = compareWithDefaults; - - if (currPreset === undefined || currPreset.length > repCount) { - compare = false; - ans.preset = 'empty'; - } else if (settings.now.preset !== settings.defaults.preset) { - ans.preset = settings.now.preset; + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + } + this._needRender = true; +}; +Miew.prototype._onFogColorChanged = function () { + const gfx = this._gfx; + const color = chooseFogColor(); + if (gfx && gfx.scene.fog) { + gfx.scene.fog.color.set(color); + } + this._needRender = true; +}; +Miew.prototype._setUberMaterialValues = function (values) { + this._gfx.root.traverse(obj => { + if ((obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Mesh || obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.LineSegments || obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Line) && obj.material instanceof shaders_UberMaterial) { + obj.material.setValues(values); + obj.material.needsUpdate = true; } + }); +}; +Miew.prototype._enableMRT = function (on, renderBuffer, textureBuffer) { + const gfx = this._gfx; + const gl = gfx.renderer.getContext(); + const ext = gl.getExtension('WEBGL_draw_buffers'); + const { + properties + } = gfx.renderer; + if (!on) { + ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, null]); + return; + } - var repsDiff = []; - var emptyReps = true; - - for (var i = 0, n = repCount; i < n; ++i) { - repsDiff[i] = complexVisual.repGet(i).compare(compare ? currPreset[i] : null); - - if (!_.isEmpty(repsDiff[i])) { - emptyReps = false; - } + // take extra texture from Texture Buffer + gfx.renderer.setRenderTarget(textureBuffer); + const tx8 = properties.get(textureBuffer.texture).__webglTexture; + gl.bindTexture(gl.TEXTURE_2D, tx8); + + // take texture and framebuffer from renderbuffer + gfx.renderer.setRenderTarget(renderBuffer); + const fb = properties.get(renderBuffer).__webglFramebuffer; + const tx = properties.get(renderBuffer.texture).__webglTexture; + + // set framebuffer + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + fb.width = renderBuffer.width; + fb.height = renderBuffer.height; + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tx, 0); + gl.framebufferTexture2D(gl.FRAMEBUFFER, ext.COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, tx8, 0); + + // mapping textures + ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, ext.COLOR_ATTACHMENT1_WEBGL]); +}; +Miew.prototype._renderScene = function () { + return function (camera, distortion, target) { + distortion = distortion || false; + target = target || null; + const gfx = this._gfx; + + // render to offscreen buffer + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + gfx.renderer.setRenderTarget(target); + gfx.renderer.clear(); + if (gfx.renderer.xr.enabled) { + gfx.renderer.render(gfx.scene, camera); + return; } - if (!emptyReps) { - ans.reps = repsDiff; + // clean buffer for normals texture + gfx.renderer.setClearColor(0x000000, 0.0); + gfx.renderer.setRenderTarget(gfx.offscreenBuf4); + gfx.renderer.clearColor(); + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + gfx.renderer.setRenderTarget(gfx.offscreenBuf); + gfx.renderer.clear(); + const bHaveComplexes = this._getComplexVisual() !== null; + const volumeVisual = this._getVolumeVisual(); + const ssao = bHaveComplexes && settings.now.ao; + if (ssao) { + this._enableMRT(true, gfx.offscreenBuf, gfx.offscreenBuf4); + } + if (settings.now.transparency === 'prepass') { + this._renderWithPrepassTransparency(camera, gfx.offscreenBuf); + } else if (settings.now.transparency === 'standard') { + gfx.renderer.setRenderTarget(gfx.offscreenBuf); + gfx.renderer.render(gfx.scene, camera); } - - return ans; - }; - /* - * Obtain object that represents current state of miew (might be used as options in constructor). - * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full - * preset information regardless of the differences with settings - * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included - * @param {boolean} [opts.view=false] - when this flag is true, a view information is included - * @returns {Object} State object. - */ - - - Miew.prototype.getState = function (opts) { - var state = {}; - opts = _.defaults(opts, { - compact: true, - settings: false, - view: false - }); // load - - var visual = this._getComplexVisual(); - - if (visual !== null) { - var complex = visual.getComplex(); - var metadata = complex.metadata; - - if (metadata.id) { - var format = metadata.format ? "".concat(metadata.format, ":") : ''; - state.load = format + metadata.id; - } - - var unit = complex.getCurrentUnit(); - - if (unit !== 1) { - state.unit = unit; - } - } // representations - - - var repsInfo = this._compareReps(visual, opts.compact); - - if (repsInfo.preset) { - state.preset = repsInfo.preset; + if (ssao) { + this._enableMRT(false, null, null); } - if (repsInfo.reps) { - state.reps = repsInfo.reps; - } // objects - - - var objects = this._objects; - var objectsState = []; - - for (var i = 0, n = objects.length; i < n; ++i) { - objectsState[i] = objects[i].identify(); + // when fxaa we should get resulting image in temp off-screen buff2 for further postprocessing with fxaa filter + // otherwise we render to canvas + const outline = bHaveComplexes && settings.now.outline.on; + const fxaa = bHaveComplexes && settings.now.fxaa; + const volume = volumeVisual !== null && volumeVisual.getMesh().material != null; + let dstBuffer = ssao || outline || volume || fxaa || distortion ? gfx.offscreenBuf2 : target; + let srcBuffer = gfx.offscreenBuf; + if (ssao) { + this._performAO(srcBuffer, gfx.offscreenBuf4, gfx.offscreenBuf.depthTexture, dstBuffer, gfx.offscreenBuf3, gfx.offscreenBuf2); + if (!fxaa && !distortion && !volume && !outline) { + srcBuffer = dstBuffer; + dstBuffer = target; + gfx.renderer.setRenderTarget(dstBuffer); + gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0); + } + } else { + // just copy color buffer to dst buffer + gfx.renderer.setRenderTarget(dstBuffer); + gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0); } - if (objects.length > 0) { - state._objects = objectsState; - } // view - - - if (opts.view) { - state.view = this.view(); - } // settings - - - if (opts.settings) { - var diff = this.settings.getDiffs(false); - - if (!_.isEmpty(diff)) { - state.settings = diff; + // outline + if (outline) { + srcBuffer = dstBuffer; + dstBuffer = volume || fxaa || distortion ? gfx.offscreenBuf3 : target; + if (srcBuffer != null) { + this._renderOutline(camera, gfx.offscreenBuf, srcBuffer, dstBuffer); } } - return state; - }; - /** - * Get parameter value. - * @param {string} param - Parameter name or path (e.g. 'modes.BS.atom'). - * @param {*=} value - Default value. - * @returns {*} Parameter value. - */ - - - Miew.prototype.get = function (param, value) { - return settings.get(param, value); - }; - - Miew.prototype._clipPlaneUpdateValue = function (radius) { - var clipPlaneValue = Math.max(this._gfx.camera.position.z - radius * settings.now.draft.clipPlaneFactor, settings.now.camNear); - var opts = { - clipPlaneValue: clipPlaneValue - }; - - this._forEachComplexVisual(function (visual) { - visual.setUberOptions(opts); - }); - - for (var i = 0, n = this._objects.length; i < n; ++i) { - var obj = this._objects[i]; + // render selected part with outline material + this._renderSelection(camera, gfx.offscreenBuf, dstBuffer); + if (volume) { + // copy current picture to the buffer that retains depth-data of the original molecule render + // so that volume renderer could use depth-test + gfx.renderer.setRenderTarget(gfx.offscreenBuf); + gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0); + dstBuffer = gfx.offscreenBuf; + this._renderVolume(volumeVisual, camera, dstBuffer, gfx.volBFTex, gfx.volFFTex, gfx.volWFFTex); - if (obj._line) { - obj._line.material.setUberOptions(opts); + // if this is the last stage -- copy image to target + if (!fxaa && !distortion) { + gfx.renderer.setRenderTarget(target); + gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0); } } - - if (this._picker !== null) { - this._picker.clipPlaneValue = clipPlaneValue; + srcBuffer = dstBuffer; + if (fxaa) { + dstBuffer = distortion ? gfx.offscreenBuf4 : target; + this._performFXAA(srcBuffer, dstBuffer); + srcBuffer = dstBuffer; } - }; - - Miew.prototype._fogFarUpdateValue = function () { - if (this._picker !== null) { - if (this._gfx.scene.fog) { - this._picker.fogFarValue = this._gfx.scene.fog.far; - } else { - this._picker.fogFarValue = undefined; - } + if (distortion) { + dstBuffer = target; + this._performDistortion(srcBuffer, dstBuffer, true); } }; - - Miew.prototype._updateShadowmapMeshes = function (process) { - this._forEachComplexVisual(function (visual) { - var reprList = visual._reprList; - - for (var i = 0, n = reprList.length; i < n; ++i) { - var repr = reprList[i]; - process(repr.geo, repr.material); +}(); +Miew.prototype._performDistortion = function () { + const _scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Scene(); + const _camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, -500, 1000); + const _material = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RawShaderMaterial({ + uniforms: { + srcTex: { + type: 't', + value: null + }, + aberration: { + type: 'fv3', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(1.0) } - }); + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: ScreenQuadFromDistortionTex_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false + }); + const _geo = gfxutils.buildDistorionMesh(10, 10, settings.now.debug.stereoBarrel); + _scene.add(new meshes.Mesh(_geo, _material)); + return function (srcBuffer, targetBuffer, mesh) { + this._gfx.renderer.setRenderTarget(targetBuffer); + this._gfx.renderer.clear(); + if (mesh) { + _material.uniforms.srcTex.value = srcBuffer.texture; + _material.uniforms.aberration.value.set(0.995, 1.0, 1.01); + this._gfx.renderer.render(_scene, _camera); + } else { + this._gfx.renderer.renderScreenQuadFromTexWithDistortion(srcBuffer, settings.now.debug.stereoBarrel); + } }; - - Miew.prototype._updateMaterials = function (values) { - var needTraverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; - - this._forEachComplexVisual(function (visual) { - return visual.setMaterialValues(values, needTraverse, process); - }); - - for (var i = 0, n = this._objects.length; i < n; ++i) { - var obj = this._objects[i]; - - if (obj._line) { - obj._line.material.setValues(values); - - obj._line.material.needsUpdate = true; +}(); +Miew.prototype._renderOutline = function () { + const _outlineMaterial = new shaders_OutlineMaterial({ + depth: true + }); + return function (camera, srcDepthBuffer, srcColorBuffer, targetBuffer) { + const self = this; + const gfx = self._gfx; + + // apply Sobel filter -- draw outline + _outlineMaterial.uniforms.srcTex.value = srcColorBuffer.texture; + _outlineMaterial.uniforms.srcDepthTex.value = srcDepthBuffer.depthTexture; + _outlineMaterial.uniforms.srcTexSize.value.set(srcDepthBuffer.width, srcDepthBuffer.height); + _outlineMaterial.uniforms.color.value = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Color(settings.now.outline.color); + _outlineMaterial.uniforms.threshold.value = settings.now.outline.threshold; + _outlineMaterial.uniforms.thickness.value = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector2(settings.now.outline.thickness, settings.now.outline.thickness); + gfx.renderer.setRenderTarget(targetBuffer); + gfx.renderer.renderScreenQuad(_outlineMaterial); + }; +}(); +Miew.prototype._renderShadowMap = function () { + const pars = { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.NearestFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.NearestFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.RGBAFormat + }; + return function () { + if (!settings.now.shadow.on) { + return; + } + const gfx = this._gfx; + const currentRenderTarget = gfx.renderer.getRenderTarget(); + const activeCubeFace = gfx.renderer.getActiveCubeFace(); + const activeMipmapLevel = gfx.renderer.getActiveMipmapLevel(); + const _state = gfx.renderer.state; + + // Set GL state for depth map. + _state.setBlending(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.NoBlending); + _state.buffers.color.setClear(1, 1, 1, 1); + _state.buffers.depth.setTest(true); + _state.setScissorTest(false); + for (let i = 0; i < gfx.scene.children.length; i++) { + if (gfx.scene.children[i].type === 'DirectionalLight') { + const light = gfx.scene.children[i]; + if (light.shadow.map == null) { + light.shadow.map = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.WebGLRenderTarget(light.shadow.mapSize.width, light.shadow.mapSize.height, pars); + light.shadow.camera.updateProjectionMatrix(); + } + light.shadow.updateMatrices(light); + gfx.renderer.setRenderTarget(light.shadow.map); + gfx.renderer.clear(); + gfx.renderer.render(gfx.scene, light.shadow.camera); } } + gfx.renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel); }; +}(); - Miew.prototype._fogAlphaChanged = function () { - this._forEachComplexVisual(function (visual) { - visual.setUberOptions({ - fogAlpha: settings.now.fogAlpha - }); - }); - }; - - Miew.prototype._embedWebXR = function () { - var _this8 = this; +/** + * Check if there is selection which must be rendered or not. + * @private + * @returns {boolean} true on existing selection to render + */ +Miew.prototype._hasSelectionToRender = function () { + const selPivot = this._gfx.selectionPivot; + for (let i = 0; i < selPivot.children.length; i++) { + const selPivotChild = selPivot.children[i]; + if (selPivotChild.children.length > 0) { + return true; + } + } + return false; +}; +Miew.prototype._renderSelection = function () { + const _outlineMaterial = new shaders_OutlineMaterial(); + return function (camera, srcBuffer, targetBuffer) { + const self = this; + const gfx = self._gfx; + + // clear offscreen buffer (leave z-buffer intact) + gfx.renderer.setClearColor('black', 0); + + // render selection to offscreen buffer + gfx.renderer.setRenderTarget(srcBuffer); + gfx.renderer.clear(true, false, false); + if (self._hasSelectionToRender()) { + gfx.selectionRoot.matrix = gfx.root.matrix; + gfx.selectionPivot.matrix = gfx.pivot.matrix; + gfx.renderer.render(gfx.selectionScene, camera); + } else { + // just render something to force "target clear" operation to finish + gfx.renderer.renderDummyQuad(); + } - // switch off - if (settings.now.stereo !== 'WEBVR') { - if (this.webVR) { - this.webVR.disable(); - } + // overlay to screen + gfx.renderer.setRenderTarget(targetBuffer); + gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 0.6); - this.webVR = null; + // apply Sobel filter -- draw outline + _outlineMaterial.uniforms.srcTex.value = srcBuffer.texture; + _outlineMaterial.uniforms.srcTexSize.value.set(srcBuffer.width, srcBuffer.height); + gfx.renderer.renderScreenQuad(_outlineMaterial); + }; +}(); +Miew.prototype._checkVolumeRenderingSupport = function (renderTarget) { + if (!renderTarget) { + return false; + } + const gfx = this._gfx; + const oldRT = gfx.renderer.getRenderTarget(); + gfx.renderer.setRenderTarget(renderTarget); + const context = gfx.renderer.getContext(); + const result = context.checkFramebufferStatus(context.FRAMEBUFFER); + gfx.renderer.setRenderTarget(oldRT); + if (result !== context.FRAMEBUFFER_COMPLETE) { + // floatFrameBufferWarning = ; + this.logger.warn('Device doesn\'t support electron density rendering'); + return false; + } + return true; +}; +Miew.prototype._renderVolume = function () { + const volumeBFMat = new shaders_VolumeMaterial.BackFacePosMaterial(); + const volumeFFMat = new shaders_VolumeMaterial.FrontFacePosMaterial(); + const cubeOffsetMat = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4().makeTranslation(0.5, 0.5, 0.5); + const world2colorMat = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + let volumeRenderingSupported; + return function (volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) { + const gfx = this._gfx; + if (typeof volumeRenderingSupported === 'undefined') { + volumeRenderingSupported = this._checkVolumeRenderingSupport(tmpBuf1); + } + if (!volumeRenderingSupported) { return; - } // switch on - + } + const mesh = volumeVisual.getMesh(); + mesh.rebuild(gfx.camera); - if (!this.webVR) { - this.webVR = new WebVRPoC(function () { - _this8._requestAnimationFrame(function () { - return _this8._onTick(); - }); + // use main camera to prepare special textures to be used by volumetric rendering + // these textures have the size of the window and are stored in offscreen buffers + gfx.renderer.setClearColor('black', 0); + gfx.renderer.setRenderTarget(tmpBuf1); + gfx.renderer.clear(); + gfx.renderer.setRenderTarget(tmpBuf2); + gfx.renderer.clear(); + gfx.renderer.setRenderTarget(tmpBuf3); + gfx.renderer.clear(); + gfx.renderer.setRenderTarget(tmpBuf1); + // draw plane with its own material, because it differs slightly from volumeBFMat + camera.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE); + gfx.renderer.render(gfx.scene, camera); + camera.layers.set(gfxutils.LAYERS.VOLUME); + gfx.scene.overrideMaterial = volumeBFMat; + gfx.renderer.render(gfx.scene, camera); + gfx.renderer.setRenderTarget(tmpBuf2); + camera.layers.set(gfxutils.LAYERS.VOLUME); + gfx.scene.overrideMaterial = volumeFFMat; + gfx.renderer.render(gfx.scene, camera); + gfx.scene.overrideMaterial = null; + camera.layers.set(gfxutils.LAYERS.DEFAULT); + + // prepare texture that contains molecule positions + world2colorMat.copy(mesh.matrixWorld).invert(); + shaders_UberMaterial.prototype.uberOptions.world2colorMatrix.multiplyMatrices(cubeOffsetMat, world2colorMat); + camera.layers.set(gfxutils.LAYERS.COLOR_FROM_POSITION); + gfx.renderer.setRenderTarget(tmpBuf3); + gfx.renderer.render(gfx.scene, camera); + + // render volume + const vm = mesh.material; + vm.uniforms._BFRight.value = tmpBuf1.texture; + vm.uniforms._FFRight.value = tmpBuf2.texture; + vm.uniforms._WFFRight.value = tmpBuf3.texture; + camera.layers.set(gfxutils.LAYERS.VOLUME); + gfx.renderer.setRenderTarget(dstBuf); + gfx.renderer.render(gfx.scene, camera); + camera.layers.set(gfxutils.LAYERS.DEFAULT); + }; +}(); + +/* Render scene with 'ZPrepass transparency Effect' + * Idea: transparent objects are rendered in two passes. The first one writes result only into depth buffer. + * The second pass reads depth buffer and writes only to color buffer. The method results in + * correct image of front part of the semi-transparent objects, but we can see only front transparent objects + * and opaque objects inside, there is no transparent objects inside. + * Notes: 1. Opaque objects should be rendered strictly before semi-transparent ones. + * 2. Realization doesn't use camera layers because scene traversing is used for material changes and + * we can use it to select needed meshes and don't complicate meshes builders with layers + */ +Miew.prototype._renderWithPrepassTransparency = function () { + return function (camera, targetBuffer) { + const gfx = this._gfx; + gfx.renderer.setRenderTarget(targetBuffer); + + // opaque objects + camera.layers.set(gfxutils.LAYERS.DEFAULT); + gfx.renderer.render(gfx.scene, camera); + + // transparent objects z prepass + camera.layers.set(gfxutils.LAYERS.PREPASS_TRANSPARENT); + gfx.renderer.getContext().colorMask(false, false, false, false); // don't update color buffer + gfx.renderer.render(gfx.scene, camera); + gfx.renderer.getContext().colorMask(true, true, true, true); // update color buffer + + // transparent objects color pass + camera.layers.set(gfxutils.LAYERS.TRANSPARENT); + gfx.renderer.render(gfx.scene, camera); + + // restore default layer + camera.layers.set(gfxutils.LAYERS.DEFAULT); + }; +}(); +Miew.prototype._performFXAA = function () { + const _fxaaMaterial = new shaders_FXAAMaterial(); + return function (srcBuffer, targetBuffer) { + if (typeof srcBuffer === 'undefined' || typeof targetBuffer === 'undefined') { + return; + } + const gfx = this._gfx; - _this8._needRender = true; + // clear canvas + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + gfx.renderer.setRenderTarget(targetBuffer); + gfx.renderer.clear(); - _this8._onResize(); + // do fxaa processing of offscreen buff2 + _fxaaMaterial.uniforms.srcTex.value = srcBuffer.texture; + _fxaaMaterial.uniforms.srcTexelSize.value.set(1.0 / srcBuffer.width, 1.0 / srcBuffer.height); + _fxaaMaterial.uniforms.bgColor.value.set(settings.now.bg.color); + if (_fxaaMaterial.bgTransparent !== settings.now.bg.transparent) { + _fxaaMaterial.setValues({ + bgTransparent: settings.now.bg.transparent }); + _fxaaMaterial.needsUpdate = true; + } + gfx.renderer.renderScreenQuad(_fxaaMaterial); + }; +}(); +Miew.prototype._performAO = function () { + const _aoMaterial = new shaders_AOMaterial(); + const _horBlurMaterial = new shaders_AOHorBlurMaterial(); + const _vertBlurMaterial = new shaders_AOVertBlurWithBlendMaterial(); + const _scale = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + return function (srcColorBuffer, normalBuffer, srcDepthTexture, targetBuffer, tempBuffer, tempBuffer1) { + if (!srcColorBuffer || !normalBuffer || !srcDepthTexture || !targetBuffer || !tempBuffer || !tempBuffer1) { + return; } - - this.webVR.enable(this._gfx); - }; - - Miew.prototype._initOnSettingsChanged = function () { - var _this9 = this; - - var on = function on(props, func) { - props = _.isArray(props) ? props : [props]; - props.forEach(function (prop) { - _this9.settings.addEventListener("change:".concat(prop), func); + const gfx = this._gfx; + const tanHalfFOV = Math.tan(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MathUtils.DEG2RAD * 0.5 * gfx.camera.fov); + _aoMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture; + _aoMaterial.uniforms.depthTexture.value = srcDepthTexture; + _aoMaterial.uniforms.normalTexture.value = normalBuffer.texture; + _aoMaterial.uniforms.srcTexelSize.value.set(1.0 / srcColorBuffer.width, 1.0 / srcColorBuffer.height); + _aoMaterial.uniforms.camNearFar.value.set(gfx.camera.near, gfx.camera.far); + _aoMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix; + _aoMaterial.uniforms.aspectRatio.value = gfx.camera.aspect; + _aoMaterial.uniforms.tanHalfFOV.value = tanHalfFOV; + gfx.root.matrix.extractScale(_scale); + _aoMaterial.uniforms.kernelRadius.value = settings.now.debug.ssaoKernelRadius * _scale.x; + _aoMaterial.uniforms.depthThreshold.value = 2.0 * this._getBSphereRadius(); // diameter + _aoMaterial.uniforms.factor.value = settings.now.debug.ssaoFactor; + // N: should be tempBuffer1 for proper use of buffers (see buffers using outside the function) + gfx.renderer.setRenderTarget(tempBuffer1); + gfx.renderer.renderScreenQuad(_aoMaterial); + _horBlurMaterial.uniforms.aoMap.value = tempBuffer1.texture; + _horBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer1.width, 1.0 / tempBuffer1.height); + _horBlurMaterial.uniforms.depthTexture.value = srcDepthTexture; + gfx.renderer.setRenderTarget(tempBuffer); + gfx.renderer.renderScreenQuad(_horBlurMaterial); + _vertBlurMaterial.uniforms.aoMap.value = tempBuffer.texture; + _vertBlurMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture; + _vertBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer.width, 1.0 / tempBuffer.height); + _vertBlurMaterial.uniforms.depthTexture.value = srcDepthTexture; + _vertBlurMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix; + _vertBlurMaterial.uniforms.aspectRatio.value = gfx.camera.aspect; + _vertBlurMaterial.uniforms.tanHalfFOV.value = tanHalfFOV; + const { + fog + } = gfx.scene; + if (fog) { + _vertBlurMaterial.uniforms.fogNearFar.value.set(fog.near, fog.far); + _vertBlurMaterial.uniforms.fogColor.value.set(fog.color.r, fog.color.g, fog.color.b, settings.now.fogAlpha); + } + if (_vertBlurMaterial.useFog !== settings.now.fog || _vertBlurMaterial.fogTransparent !== settings.now.bg.transparent) { + _vertBlurMaterial.setValues({ + useFog: settings.now.fog, + fogTransparent: settings.now.bg.transparent }); - }; - - on('modes.VD.frame', function () { - var volume = _this9._getVolumeVisual(); + _vertBlurMaterial.needsUpdate = true; + } + gfx.renderer.setRenderTarget(targetBuffer); + gfx.renderer.renderScreenQuad(_vertBlurMaterial); + }; +}(); - if (volume === null) return; - volume.showFrame(settings.now.modes.VD.frame); - _this9._needRender = true; - }); - on('modes.VD.isoMode', function () { - var volume = _this9._getVolumeVisual(); +/** + * Reset the viewer, unload molecules. + * @param {boolean=} keepReps - Keep representations while resetting viewer state. + */ +Miew.prototype.reset = function /* keepReps */ +() { + if (this._picker) { + this._picker.reset(); + } + this._lastPick = null; + this._releaseAllVisuals(); + this._setEditMode(EDIT_MODE.COMPLEX); + this._resetObjects(); + if (this._gfx) { + gfxutils.clearTree(this._gfx.pivot); + this._gfx.renderer2d.reset(); + } + this.setNeedRender(); +}; +Miew.prototype._resetScene = function () { + this._objectControls.reset(); + this._objectControls.allowTranslation(true); + this._objectControls.allowAltObjFreeRotation(true); + this.resetReps(); + this.resetPivot(); + this.rebuildAll(); +}; +Miew.prototype.resetView = function () { + // reset controls + if (this._picker) { + this._picker.reset(); + } + this._setEditMode(EDIT_MODE.COMPLEX); + this._resetScene(); - if (volume === null) return; - volume.getMesh().material.updateDefines(); - _this9._needRender = true; - }); - on('bg.color', function () { - _this9._onBgColorChanged(); + // reset selection + this._forEachComplexVisual(visual => { + visual.updateSelectionMask({}); + visual.rebuildSelectionGeometry(); + }); +}; +Miew.prototype._export = function (format) { + const TheExporter = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().head(io.exporters.find({ + format + })); + if (!TheExporter) { + this.logger.error('Could not find suitable exporter for this source'); + return Promise.reject(new Error('Could not find suitable exporter for this source')); + } + this.dispatchEvent({ + type: 'exporting' + }); + if (this._visuals[this._curVisualName] instanceof src_ComplexVisual) { + let dataSource = null; + if (TheExporter.SourceClass === src_ComplexVisual) { + dataSource = this._visuals[this._curVisualName]; + } else if (TheExporter.SourceClass === chem_Complex) { + dataSource = this._visuals[this._curVisualName]._complex; + } + const exporter = new TheExporter(dataSource, { + miewVersion: Miew.VERSION }); - on('ao', function () { - if (settings.now.ao && !isAOSupported(_this9._gfx.renderer.getContext())) { - _this9.logger.warn('Your device or browser does not support ao'); - - settings.set('ao', false); - } else { - var values = { - normalsToGBuffer: settings.now.ao - }; + return exporter.export().then(data => data); + } + if (this._visuals[this._curVisualName] instanceof src_VolumeVisual) { + return Promise.reject(new Error('Sorry, exporter for volume data not implemented yet')); + } + return Promise.reject(new Error('Unexpected format of data')); +}; +const rePdbId = /^(?:(pdb|cif|ccp4|dsn6):\s*)?(\d[a-z\d]{3})$/i; +const rePubchem = /^(?:pc|pubchem):\s*([a-z]+)$/i; +const reUrlScheme = /^([a-z][a-z\d\-+.]*):/i; +function resolveSourceShortcut(source, opts) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(source)) { + return source; + } - _this9._setUberMaterialValues(values); - } - }); - on('zSprites', function () { - if (settings.now.zSprites && !arezSpritesSupported(_this9._gfx.renderer.getContext())) { - _this9.logger.warn('Your device or browser does not support zSprites'); + // e.g. "cif:1CRN" + const matchesPdbId = rePdbId.exec(source); + if (matchesPdbId) { + let [, format = 'pdb', id] = matchesPdbId; + format = format.toLowerCase(); + id = id.toUpperCase(); + switch (format) { + case 'pdb': + source = `https://files.rcsb.org/download/${id}.pdb`; + break; + case 'cif': + source = `https://files.rcsb.org/download/${id}.cif`; + break; + case 'ccp4': + source = `https://www.ebi.ac.uk/pdbe/coordinates/files/${id.toLowerCase()}.ccp4`; + break; + case 'dsn6': + source = `https://edmaps.rcsb.org/maps/${id.toLowerCase()}_2fofc.dsn6`; + break; + default: + throw new Error('Unexpected data format shortcut'); + } + opts.fileType = format; + opts.fileName = `${id}.${format}`; + opts.sourceType = 'url'; + return source; + } - settings.set('zSprites', false); - } - }); - on('fogColor', function () { - _this9._onFogColorChanged(); - }); - on('fogColorEnable', function () { - _this9._onFogColorChanged(); - }); - on('bg.transparent', function (evt) { - var gfx = _this9._gfx; + // e.g. "pc:aspirin" + const matchesPubchem = rePubchem.exec(source); + if (matchesPubchem) { + const compound = matchesPubchem[1].toLowerCase(); + source = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${compound}/JSON?record_type=3d`; + opts.fileType = 'pubchem'; + opts.fileName = `${compound}.json`; + opts.sourceType = 'url'; + return source; + } - if (gfx) { - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - } // update materials + // otherwise is should be an URL + if (opts.sourceType === 'url' || opts.sourceType === undefined) { + opts.sourceType = 'url'; + // e.g. "./data/1CRN.pdb" + if (!reUrlScheme.test(source)) { + source = utils.resolveURL(source); + } + } + return source; +} +function updateBinaryMode(opts) { + let { + binary + } = opts; + + // detect by format + if (opts.fileType !== undefined) { + const TheParser = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().head(io.parsers.find({ + format: opts.fileType + })); + if (TheParser) { + binary = TheParser.binary || false; + } else { + throw new Error('Could not find suitable parser for this format'); + } + } - _this9._updateMaterials({ - fogTransparent: evt.value - }); + // detect by file extension + if (binary === undefined && opts.fileExt !== undefined) { + const TheParser = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().head(io.parsers.find({ + ext: opts.fileExt + })); + if (TheParser) { + binary = TheParser.binary || false; + } + } - _this9.rebuildAll(); - }); - on('draft.clipPlane', function (evt) { - // update materials - _this9._updateMaterials({ - clipPlane: evt.value - }); + // temporary workaround for animation + if (opts.fileExt !== undefined && opts.fileExt.toLowerCase() === '.man') { + opts.binary = true; + opts.animation = true; // who cares? + } - _this9.rebuildAll(); + // update if detected + if (binary !== undefined) { + if (opts.binary !== undefined && opts.binary !== binary) { + opts.context.logger.warn('Overriding incorrect binary mode'); + } + } + opts.binary = binary || false; +} +function _fetchData(source, opts, job) { + return new Promise(resolve => { + if (job.shouldCancel()) { + throw new Error('Operation cancelled'); + } + job.notify({ + type: 'fetching' }); - on('shadow.on', function (evt) { - // update materials - var values = { - shadowmap: evt.value, - shadowmapType: settings.now.shadow.type - }; - var gfx = _this9._gfx; - - if (gfx) { - gfx.renderer.shadowMap.enabled = Boolean(values.shadowmap); - } - _this9._updateMaterials(values, true); + // allow for source shortcuts + source = resolveSourceShortcut(source, opts); - if (values.shadowmap) { - _this9._updateShadowCamera(); + // detect a proper loader + const TheLoader = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().head(io.loaders.find({ + type: opts.sourceType, + source + })); + if (!TheLoader) { + throw new Error(LOADER_NOT_FOUND); + } - _this9._updateShadowmapMeshes(gfxutils.createShadowmapMaterial); - } else { - _this9._updateShadowmapMeshes(gfxutils.removeShadowmapMaterial); - } + // split file name + const fileName = opts.fileName || TheLoader.extractName(source); + if (fileName) { + const [name, fileExt] = utils.splitFileName(fileName); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().defaults(opts, { + name, + fileExt, + fileName + }); + } - _this9._needRender = true; - }); - on('shadow.type', function (evt) { - // update materials if shadowmap is enable - if (settings.now.shadow.on) { - _this9._updateMaterials({ - shadowmapType: evt.value - }, true); + // should it be text or binary? + updateBinaryMode(opts); - _this9._needRender = true; - } - }); - on('shadow.radius', function (evt) { - for (var i = 0; i < _this9._gfx.scene.children.length; i++) { - if (_this9._gfx.scene.children[i].shadow !== undefined) { - var light = _this9._gfx.scene.children[i]; - light.shadow.radius = evt.value; - _this9._needRender = true; + // FIXME: All new settings retrieved from server are applied after the loading is complete. However, we need some + // flags to alter the loading process itself. Here we apply them in advance. Dirty hack. Kill the server, remove + // all hacks and everybody's happy. + let newOptions = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(opts, 'preset.expression'); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(newOptions)) { + newOptions = JSON.parse(newOptions); + if (newOptions && newOptions.settings) { + const keys = ['singleUnit']; + for (let keyIndex = 0, keyCount = keys.length; keyIndex < keyCount; ++keyIndex) { + const key = keys[keyIndex]; + const value = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(newOptions.settings, key); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(value)) { + settings.set(key, value); + } } } - }); - on('fps', function () { - _this9._fps.show(settings.now.fps); - }); - on(['fog', 'fogNearFactor', 'fogFarFactor'], function () { - _this9._updateFog(); - - _this9._needRender = true; - }); - on('fogAlpha', function () { - var fogAlpha = settings.now.fogAlpha; + } - if (fogAlpha < 0 || fogAlpha > 1) { - _this9.logger.warn('fogAlpha must belong range [0,1]'); + // create a loader + const loader = new TheLoader(source, opts); + loader.context = opts.context; + job.addEventListener('cancel', () => loader.abort()); + loader.addEventListener('progress', event => { + if (event.lengthComputable && event.total > 0) { + reportProgress(loader.logger, 'Fetching', event.loaded / event.total); + } else { + reportProgress(loader.logger, 'Fetching'); } - - _this9._fogAlphaChanged(); - - _this9._needRender = true; }); - on('autoResolution', function (evt) { - if (evt.value && !_this9._gfxScore) { - _this9.logger.warn('Benchmarks are missed, autoresolution will not work! ' + 'Autoresolution should be set during miew startup.'); + console.time('fetch'); + const promise = loader.load().then(data => { + console.timeEnd('fetch'); + opts.context.logger.info('Fetching finished'); + job.notify({ + type: 'fetchingDone', + data + }); + return data; + }).catch(error => { + console.timeEnd('fetch'); + opts.context.logger.debug(error.message); + if (error.stack) { + opts.context.logger.debug(error.stack); } + opts.context.logger.error('Fetching failed'); + job.notify({ + type: 'fetchingDone', + error + }); + throw error; }); - on('stereo', function () { - _this9._embedWebXR(settings.now.stereo === 'WEBVR'); - - _this9._needRender = true; - }); - on(['transparency', 'palette'], function () { - _this9.rebuildAll(); - }); - on('resolution', function () { - // update complex visuals - _this9.rebuildAll(); // update volume visual - - - var volume = _this9._getVolumeVisual(); - - if (volume) { - volume.getMesh().material.updateDefines(); - _this9._needRender = true; - } + resolve(promise); + }); +} +function _parseData(data, opts, job) { + if (job.shouldCancel()) { + return Promise.reject(new Error('Operation cancelled')); + } + job.notify({ + type: 'parsing' + }); + const TheParser = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().head(io.parsers.find({ + format: opts.fileType, + ext: opts.fileExt, + data + })); + if (!TheParser) { + return Promise.reject(new Error('Could not find suitable parser')); + } + const parser = new TheParser(data, opts); + parser.context = opts.context; + job.addEventListener('cancel', () => parser.abort()); + console.time('parse'); + return parser.parse().then(dataSet => { + console.timeEnd('parse'); + job.notify({ + type: 'parsingDone', + data: dataSet }); - on(['axes', 'fxaa', 'ao', 'outline.on', 'outline.color', 'outline.threshold', 'outline.thickness'], function () { - _this9._needRender = true; + return dataSet; + }).catch(error => { + console.timeEnd('parse'); + opts.error = error; + opts.context.logger.debug(error.message); + if (error.stack) { + opts.context.logger.debug(error.stack); + } + opts.context.logger.error('Parsing failed'); + job.notify({ + type: 'parsingDone', + error }); - }; - /** - * Set parameter value. - * @param {string|object} params - Parameter name or path (e.g. 'modes.BS.atom') or even settings object. - * @param {*=} value - Value. - */ - - - Miew.prototype.set = function (params, value) { - settings.set(params, value); - }; - /** - * Select atoms with selection string. - * @param {string} expression - string expression of selection - * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection - */ - - - Miew.prototype.select = function (expression, append) { - var visual = this._getComplexVisual(); + throw error; + }); +} + +/** + * Load molecule asynchronously. + * @param {string|File} source - Molecule source to load (e.g. PDB ID, URL or File object). + * @param {object=} opts - Options. + * @param {string=} opts.sourceType - Data source type (e.g. 'url', 'file'). + * @param {string=} opts.fileType - Data contents type (e.g. 'pdb', 'cml'). + * @param {string=} opts.mdFile - .nc file path. + * @param {boolean=} opts.keepRepsInfo - prevent reset of object and reps information. + * @returns {Promise} name of the visual that was added to the viewer + */ +Miew.prototype.load = function (source, opts) { + opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge({}, opts, { + context: this + }); - if (!visual) { - return; + // for a single-file scenario + if (!this.settings.now.use.multiFile) { + // abort all loaders in progress + if (this._loading.length) { + this._loading.forEach(job => { + job.cancel(); + }); + this._loading.length = 0; } - var sel = expression; - - if (_.isString(expression)) { - sel = selectors$4.parse(expression).selector; + // reset + if (!opts.animation) { + // FIXME: sometimes it is set AFTERWARDS! + this.reset(true); } - - visual.select(sel, append); - this._lastPick = null; - - this._updateInfoPanel(); - - this._needRender = true; - }; - - var VIEW_VERSION = '1'; - /** - * Get or set view info packed into string. - * - * **Note:** view is stored for *left-handed* cs, euler angles are stored in radians and *ZXY-order*, - * - * @param {string=} expression - Optional string encoded the view - */ - - Miew.prototype.view = function (expression) { - var self = this; - var pivot = this._gfx.pivot; - var transform = []; - var eulerOrder = 'ZXY'; - - function encode() { - var pos = pivot.position; - var scale = self._objectControls.getScale() / settings.now.radiusToFit; - var euler = new THREE.Euler(); - euler.setFromQuaternion(self._objectControls.getOrientation(), eulerOrder); - transform = [pos.x, pos.y, pos.z, scale, euler.x, euler.y, euler.z]; - return VIEW_VERSION + utils.arrayToBase64(transform, Float32Array); + } + this._interpolator.reset(); + this.dispatchEvent({ + type: 'loading', + options: opts, + source + }); + const job = new JobHandle(); + this._loading.push(job); + job.addEventListener('notification', e => { + this.dispatchEvent(e.slaveEvent); + }); + this._spinner.spin(this._container); + const onLoadEnd = anything => { + const jobIndex = this._loading.indexOf(job); + if (jobIndex !== -1) { + this._loading.splice(jobIndex, 1); } - - function decode() { - // backwards compatible: old non-versioned view is the 0th version - if (expression.length === 40) { - expression = "0".concat(expression); + this._spinner.stop(); + this._refreshTitle(); + job.notify({ + type: 'loadingDone', + anything + }); + return anything; + }; + return _fetchData(source, opts, job).then(data => _parseData(data, opts, job)).then(object => { + const name = this._onLoad(object, opts); + return onLoadEnd(name); + }).catch(err => { + this.logger.error('Could not load data'); + this.logger.debug(err); + throw onLoadEnd(err); + }); +}; + +/** + * Unload molecule (delete corresponding visual). + * @param {string=} name - name of the visual + */ +Miew.prototype.unload = function (name) { + this._removeVisual(name || this.getCurrentVisual()); + this.resetPivot(); + if (settings.now.shadow.on) { + this._updateShadowCamera(); + } +}; + +/** + * Start new animation. Now is broken. + * @param fileData - new data to animate + * @private + * @deprecated until animation system refactoring. + */ +Miew.prototype._startAnimation = function (fileData) { + this._stopAnimation(); + const self = this; + const visual = this._getComplexVisual(); + if (visual === null) { + this.logger.error('Unable to start animation - no molecule is loaded.'); + return; + } + try { + this._frameInfo = new gfx_FrameInfo(visual.getComplex(), fileData, { + onLoadStatusChanged() { + self.dispatchEvent({ + type: 'mdPlayerStateChanged', + state: { + isPlaying: self._isAnimating, + isLoading: self._frameInfo ? self._frameInfo.isLoading : true + } + }); + }, + onError(message) { + self._stopAnimation(); + self.logger.error(message); + } + }); + } catch (e) { + this.logger.error('Animation file does not fit to current complex!'); + return; + } + this._continueAnimation(); +}; + +/** + * Pause current animation. Now is broken. + * @private + * @deprecated until animation system refactoring. + */ +Miew.prototype._pauseAnimation = function () { + if (this._animInterval === null) { + return; + } + this._isAnimating = false; + clearInterval(this._animInterval); + this._animInterval = null; + if (this._frameInfo) { + this.dispatchEvent({ + type: 'mdPlayerStateChanged', + state: { + isPlaying: this._isAnimating, + isLoading: this._frameInfo.isLoading } - - var version = expression[0]; - transform = utils.arrayFromBase64(expression.substr(1), Float32Array); // apply adapter for old versions - - if (version !== VIEW_VERSION) { - if (version === '0') { - // cancel radiusToFit included in old views - transform[3] /= 8.0; - } else { - // do nothing - self.logger.warn("Encoded view version mismatch, stored as ".concat(version, " vs ").concat(VIEW_VERSION, " expected")); - return; - } + }); + } +}; + +/** + * Continue current animation after pausing. Now is broken. + * @private + * @deprecated until animation system refactoring. + */ +Miew.prototype._continueAnimation = function () { + this._isAnimating = true; + let minFrameTime = 1000 / settings.now.maxfps; + minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime; + const self = this; + const { + pivot + } = self._gfx; + const visual = this._getComplexVisual(); + if (visual) { + visual.resetSelectionMask(); + visual.rebuildSelectionGeometry(); + this._msgAtomInfo.style.opacity = 0.0; + } + this._animInterval = setInterval(() => { + self.dispatchEvent({ + type: 'mdPlayerStateChanged', + state: { + isPlaying: self._isAnimating, + isLoading: self._frameInfo.isLoading } - - var interpolator = self._interpolator; - var srcView = interpolator.createView(); - srcView.position.copy(pivot.position); - srcView.scale = self._objectControls.getScale(); - srcView.orientation.copy(self._objectControls.getOrientation()); - var dstView = interpolator.createView(); - dstView.position.set(transform[0], transform[1], transform[2]); // hack to make preset views work after we moved centering offset to visual nodes - // FIXME should only store main pivot offset in preset - - if (self._getComplexVisual()) { - dstView.position.sub(self._getComplexVisual().position); + }); + if (self._frameInfo.frameIsReady) { + pivot.updateToFrame(self._frameInfo); + self._updateObjsToFrame(self._frameInfo); + self._refreshTitle(` Frame ${self._frameInfo._currFrame} of ${self._frameInfo._framesCount} time interval - ${self._frameInfo._timeStep}`); + try { + self._frameInfo.nextFrame(); + } catch (e) { + self.logger.error('Error during animation'); + self._stopAnimation(); + return; } - - dstView.scale = transform[3]; // eslint-disable-line prefer-destructuring - - dstView.orientation.setFromEuler(new THREE.Euler(transform[4], transform[5], transform[6], eulerOrder)); - interpolator.setup(srcView, dstView); + self._needRender = true; } - - if (typeof expression === 'undefined') { - return encode(); + }, minFrameTime); +}; + +/** + * Stop current animation. Now is broken. + * @private + * @deprecated until animation system refactoring. + */ +Miew.prototype._stopAnimation = function () { + if (this._animInterval === null) { + return; + } + clearInterval(this._animInterval); + this._frameInfo.disableEvents(); + this._frameInfo = null; + this._animInterval = null; + this.dispatchEvent({ + type: 'mdPlayerStateChanged', + state: null + }); +}; + +/** + * Invoked upon successful loading of some data source + * @param {DataSource} dataSource - Data source for visualization (molecular complex or other) + * @param {object} opts - Options. + * @private + */ +Miew.prototype._onLoad = function (dataSource, opts) { + const gfx = this._gfx; + let visualName = null; + if (opts.animation) { + this._refreshTitle(); + this._startAnimation(dataSource); + return null; + } + this._stopAnimation(); + if (!opts || !opts.keepRepsInfo) { + this._opts.reps = null; + this._opts._objects = null; + } + if (dataSource.id === 'Complex') { + const complex = dataSource; + + // update title + if (opts.fileName) { + complex.name = complex.name || removeExtension(opts.fileName).toUpperCase(); + } else if (opts.amberFileName) { + complex.name = complex.name || removeExtension(opts.amberFileName).toUpperCase(); + } else { + complex.name = `Dynamic ${opts.fileType} molecule`; } - - decode(); - return expression; - }; - /* - * Update current view due to viewinterpolator state - */ - - - Miew.prototype._updateView = function () { - var self = this; - var pivot = this._gfx.pivot; - var interpolator = this._interpolator; - - if (!interpolator.wasStarted()) { - interpolator.start(); + visualName = this._addVisual(new src_ComplexVisual(complex.name, complex)); + this._curVisualName = visualName; + const desc = this.info(); + this.logger.info(`Parsed ${opts.fileName} (${desc.atoms} atoms, ${desc.bonds} bonds, ${desc.residues} residues, ${desc.chains} chains).`); + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isNumber(this._opts.unit)) { + complex.setCurrentUnit(this._opts.unit); } - - if (!interpolator.isMoving()) { - return; + if (opts.preset) { + // ...removed server access... + } else if (settings.now.autoPreset) { + switch (opts.fileType) { + case 'cml': + this.resetReps('small'); + break; + case 'pdb': + case 'mmtf': + case 'cif': + if (hasValidResidues(complex)) { + this.resetReps('macro'); + } else { + this.resetReps('small'); + } + break; + default: + this.resetReps('default'); + break; + } + } else { + this.resetReps('default'); } + } else if (dataSource.id === 'Volume') { + this.resetEd(); + visualName = this._onLoadEd(dataSource); + } + gfx.camera.updateProjectionMatrix(); + this._updateFog(); + + // reset global transform + gfx.root.resetTransform(); + this.resetPivot(); + + // set scale to fit everything on the screen + this._objectControls.setScale(settings.now.radiusToFit / this._getBSphereRadius()); + this._resetObjects(); + if (settings.now.autoResolution) { + this._tweakResolution(); + } + if (settings.now.shadow.on) { + this._updateShadowCamera(); + } + if (this._opts.view) { + this.view(this._opts.view); + delete this._opts.view; + } + this._refreshTitle(); + return visualName; +}; +Miew.prototype.resetEd = function () { + if (this._edLoader) { + this._edLoader.abort(); + this._edLoader = null; + } - var res = interpolator.getCurrentView(); - - if (res.success) { - var curr = res.view; - pivot.position.copy(curr.position); - - self._objectControls.setScale(curr.scale * settings.now.radiusToFit); - - self._objectControls.setOrientation(curr.orientation); - - this.dispatchEvent({ - type: 'transform' - }); - self._needRender = true; + // free all resources + this._removeVisual(this._getVolumeVisual()); + this._needRender = true; +}; +Miew.prototype.loadEd = function (source) { + this.resetEd(); + const TheLoader = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().head(io.loaders.find({ + source + })); + if (!TheLoader) { + this.logger.error(LOADER_NOT_FOUND); + return Promise.reject(new Error(LOADER_NOT_FOUND)); + } + const loader = this._edLoader = new TheLoader(source, { + binary: true + }); + loader.context = this; + return loader.load().then(data => { + const TheParser = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().head(io.parsers.find({ + format: 'ccp4' + })); + if (!TheParser) { + throw new Error(PARSER_NOT_FOUND); } - }; - /** - * Translate object by vector - * @param {number} x - translation value (Ang) along model's X axis - * @param {number} y - translation value (Ang) along model's Y axis - * @param {number} z - translation value (Ang) along model's Z axis - */ - - - Miew.prototype.translate = function (x, y, z) { - this._objectControls.translatePivot(x, y, z); + const parser = new TheParser(data); + parser.context = this; + return parser.parse().then(dataSource => { + this._onLoadEd(dataSource); + }); + }).catch(error => { + this.logger.error('Could not load ED data'); + this.logger.debug(error); + }); +}; +Miew.prototype._onLoadEd = function (dataSource) { + dataSource.normalize(); + const volumeVisual = new src_VolumeVisual('volume', dataSource); + volumeVisual.getMesh().layers.set(gfxutils.LAYERS.VOLUME); // volume mesh is not visible to common render + const visualName = this._addVisual(volumeVisual); + this._needRender = true; + return visualName; +}; +Miew.prototype._needRebuild = function () { + let needsRebuild = false; + this._forEachComplexVisual(visual => { + needsRebuild = needsRebuild || visual.needsRebuild(); + }); + return needsRebuild; +}; +Miew.prototype._rebuildObjects = function () { + const self = this; + const gfx = this._gfx; + let i; + let n; + + // remove old object geometry + const toRemove = []; + for (i = 0; i < gfx.pivot.children.length; ++i) { + const child = gfx.pivot.children[i]; + if (!(child instanceof src_Visual)) { + toRemove.push(child); + } + } + for (i = 0; i < toRemove.length; ++i) { + toRemove[i].parent.remove(toRemove[i]); + } + setTimeout(() => { + const objList = self._objects; + for (i = 0, n = objList.length; i < n; ++i) { + const obj = objList[i]; + if (obj.needsRebuild) { + obj.build(); + } + if (obj.getGeometry()) { + gfx.pivot.add(obj.getGeometry()); + } + } + }, 10); +}; +Miew.prototype.changeUnit = function (unitIdx, name) { + const visual = this._getComplexVisual(name); + if (!visual) { + throw new Error('There is no complex to change!'); + } + function currentUnitInfo() { + const unit = visual ? visual.getComplex().getCurrentUnit() : 0; + const type = unit > 0 ? `Bio molecule ${unit}` : 'Asymmetric unit'; + return `Current unit: ${unit} (${type})`; + } + if (unitIdx === undefined) { + return currentUnitInfo(); + } + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(unitIdx)) { + unitIdx = Math.max(parseInt(unitIdx, 10), 0); + } + if (visual.getComplex().setCurrentUnit(unitIdx)) { + this._resetScene(); + this._updateInfoPanel(); + } + return currentUnitInfo(); +}; + +/** + * Start to rebuild geometry asynchronously. + */ +Miew.prototype.rebuild = function () { + if (this._building) { + this.logger.warn('Miew.rebuild(): already building!'); + return; + } + this._building = true; + this.dispatchEvent({ + type: 'rebuilding' + }); + this._rebuildObjects(); + this._gfx.renderer2d.reset(); + const rebuildActions = []; + this._forEachComplexVisual(visual => { + if (visual.needsRebuild()) { + rebuildActions.push(visual.rebuild().then(() => new Promise(resolve => { + visual.rebuildSelectionGeometry(); + resolve(); + }))); + } + }); + // Start asynchronous rebuild + const self = this; + this._spinner.spin(this._container); + Promise.all(rebuildActions).then(() => { + self._spinner.stop(); + self._needRender = true; + self._refreshTitle(); this.dispatchEvent({ - type: 'transform' + type: 'buildingDone' }); - this._needRender = true; - }; - /** - * Rotate object by Euler angles - * @param {number} x - rotation angle around X axis in radians - * @param {number} y - rotation angle around Y axis in radians - * @param {number} z - rotation angle around Z axis in radians - */ - - - Miew.prototype.rotate = function (x, y, z) { - this._objectControls.rotate(new THREE.Quaternion().setFromEuler(new THREE.Euler(x, y, z, 'XYZ'))); + self._building = false; + }); +}; +/** Mark all representations for rebuilding */ +Miew.prototype.rebuildAll = function () { + this._forEachComplexVisual(visual => { + visual.setNeedsRebuild(); + }); +}; +Miew.prototype._refreshTitle = function (appendix) { + let title; + appendix = appendix === undefined ? '' : appendix; + const visual = this._getComplexVisual(); + if (visual) { + title = visual.getComplex().name; + const rep = visual.repGet(visual.repCurrent()); + title += rep ? ` – ${rep.mode.name} Mode` : ''; + } else { + title = Object.keys(this._visuals).length > 0 ? 'Unknown' : 'No Data'; + } + title += appendix; + this.dispatchEvent({ + type: 'titleChanged', + data: title + }); +}; +Miew.prototype.setNeedRender = function () { + this._needRender = true; +}; +Miew.prototype._extractRepresentation = function () { + const changed = []; + this._forEachComplexVisual(visual => { + if (visual.getSelectionCount() === 0) { + return; + } + const selector = visual.buildSelectorFromMask(1 << visual.getSelectionBit()); + const defPreset = settings.now.presets.default; + const res = visual.repAdd({ + selector, + mode: defPreset[0].mode.id, + colorer: defPreset[0].colorer.id, + material: defPreset[0].material.id + }); + if (!res) { + if (visual.repCount() === src_ComplexVisual.NUM_REPRESENTATION_BITS) { + this.logger.warn(`Number of representations is limited to ${src_ComplexVisual.NUM_REPRESENTATION_BITS}`); + } + return; + } this.dispatchEvent({ - type: 'transform' + type: 'repAdded', + index: res.index, + name: visual.name }); - this._needRender = true; - }; - /** - * Scale object by factor - * @param {number} factor - scale multiplier, should greater than zero - */ - - - Miew.prototype.scale = function (factor) { - if (factor <= 0) { - throw new RangeError('Scale should be greater than zero'); + visual.repCurrent(res.index); + changed.push(visual.name); + }); + if (changed.length > 0) { + this.logger.report(`New representation from selection for complexes: ${changed.join(', ')}`); + } +}; + +/** + * Change current representation list. + * @param {array} reps - Representation list. + */ +Miew.prototype._setReps = function (reps) { + reps = reps || this._opts && this._opts.reps || []; + this._forEachComplexVisual(visual => visual.resetReps(reps)); +}; + +/** + * Apply existing preset to current scene. + * @param preset + */ +Miew.prototype.applyPreset = function (preset) { + const { + presets + } = settings.now; + const presList = [preset || settings.defaults.preset, settings.defaults.preset, Object.keys(presets)[0]]; + let reps = null; + for (let i = 0; !reps && i < presList.length; ++i) { + settings.set('preset', presList[i]); + reps = presets[settings.now.preset]; + if (!reps) { + this.logger.warn(`Unknown preset "${settings.now.preset}"`); } - - this._objectControls.scale(factor); - + } + this._setReps(reps); +}; + +/** + * Reset current representation list to initial values. + * @param {string} [preset] - The source preset in case of uninitialized representation list. + */ +Miew.prototype.resetReps = function (preset) { + const reps = this._opts && this._opts.reps; + if (reps) { + this._setReps(reps); + } else { + this.applyPreset(preset); + } +}; + +/** + * Get number of representations created so far. + * @returns {number} Number of reps. + */ +Miew.prototype.repCount = function (name) { + const visual = this._getComplexVisual(name); + return visual ? visual.repCount() : 0; +}; + +/** + * Get or set the current representation index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. + * @param {string=} [name] - Complex name. Defaults to the current one. + * @returns {number} The current index. + */ +Miew.prototype.repCurrent = function (index, name) { + const visual = this._getComplexVisual(name); + const newIdx = visual ? visual.repCurrent(index) : -1; + if (index && newIdx !== index) { + this.logger.warn(`Representation ${index} was not found. Current rep remains unchanged.`); + } + return newIdx; +}; + +/** + * Get or set representation by index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one. + * @param {object=} rep - Optional representation description. + * @param {string=} rep.selector - Selector string. + * @param {string=} rep.mode - Mode id. + * @param {string=} rep.colorer - Colorer id. + * @param {string=} rep.material - Material id. + * @returns {?object} Representation description. + */ +Miew.prototype.rep = function (index, rep) { + const visual = this._getComplexVisual(''); + if (!visual) { + return null; + } + const res = visual.rep(index, rep); + if (res.status === 'created') { this.dispatchEvent({ - type: 'transform' + type: 'repAdded', + index: res.index, + name: visual.name }); - this._needRender = true; - }; - /** - * Center view on selection - * @param {empty | subset | string} selector - defines part of molecule which must be centered ( - * empty - center on current selection; - * subset - center on picked atom/residue/molecule; - * string - center on atoms correspond to selection string) - */ + } else if (res.status === 'changed') { + this.dispatchEvent({ + type: 'repChanged', + index: res.index, + name: visual.name + }); + } + return res.desc; +}; + +/** + * Get representation (not just description) by index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one. + * @returns {?object} Representation. + */ +Miew.prototype.repGet = function (index, name) { + const visual = this._getComplexVisual(name); + return visual ? visual.repGet(index) : null; +}; + +/** + * Add new representation. + * @param {object=} rep - Representation description. + * @returns {number} Index of the new representation. + */ +Miew.prototype.repAdd = function (rep, name) { + const visual = this._getComplexVisual(name); + if (!visual) { + return -1; + } + const res = visual.repAdd(rep); + if (res) { + this.dispatchEvent({ + type: 'repAdded', + index: res.index, + name + }); + return res.index; + } + return -1; +}; + +/** + * Remove representation. + * @param {number=} index - Zero-based representation index. + */ +Miew.prototype.repRemove = function (index, name) { + const visual = this._getComplexVisual(name); + if (!visual) { + return; + } + visual.repRemove(index); + this.dispatchEvent({ + type: 'repRemoved', + index, + name + }); +}; + +/** + * Hide representation. + * @param {number} index - Zero-based representation index. + * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default). + */ +Miew.prototype.repHide = function (index, hide, name) { + this._needRender = true; + const visual = this._getComplexVisual(name); + return visual ? visual.repHide(index, hide) : null; +}; +Miew.prototype._setEditMode = function (mode) { + this._editMode = mode; + const elem = this._msgMode; + if (elem) { + elem.style.opacity = mode === EDIT_MODE.COMPLEX ? 0.0 : 1.0; + if (mode !== EDIT_MODE.COMPLEX) { + const t = elem.getElementsByTagName('p')[0]; + t.innerHTML = mode === EDIT_MODE.COMPONENT ? 'COMPONENT EDIT MODE' : 'FRAGMENT EDIT MODE'; + } + } + this.dispatchEvent({ + type: 'editModeChanged', + data: mode === EDIT_MODE.COMPLEX + }); +}; +Miew.prototype._enterComponentEditMode = function () { + if (this._editMode !== EDIT_MODE.COMPLEX) { + return; + } + const editors = []; + this._forEachComplexVisual(visual => { + const editor = visual.beginComponentEdit(); + if (editor) { + editors.push(editor); + } + }); + if (editors === []) { + return; + } + this._editors = editors; + this.logger.info('COMPONENT EDIT MODE -- ON'); + this._setEditMode(EDIT_MODE.COMPONENT); + this._objectControls.keysTranslateObj(true); +}; +Miew.prototype._applyComponentEdit = function () { + if (this._editMode !== EDIT_MODE.COMPONENT) { + return; + } + this._objectControls.stop(); + this._objectControls.keysTranslateObj(false); + for (let i = 0; i < this._editors.length; ++i) { + this._editors[i].apply(); + } + this._editors = []; + this.logger.info('COMPONENT EDIT MODE -- OFF (applied)'); + this._setEditMode(EDIT_MODE.COMPLEX); + this.rebuildAll(); +}; +Miew.prototype._discardComponentEdit = function () { + if (this._editMode !== EDIT_MODE.COMPONENT) { + return; + } + this._objectControls.stop(); + this._objectControls.keysTranslateObj(false); + for (let i = 0; i < this._editors.length; ++i) { + this._editors[i].discard(); + } + this._editors = []; + this.logger.info('COMPONENT EDIT MODE -- OFF (discarded)'); + this._setEditMode(EDIT_MODE.COMPLEX); + this._needRender = true; + this.rebuildAll(); +}; +Miew.prototype._enterFragmentEditMode = function () { + if (this._editMode !== EDIT_MODE.COMPLEX) { + return; + } + const selectedVisuals = []; + this._forEachComplexVisual(visual => { + if (visual instanceof src_ComplexVisual && visual.getSelectionCount() > 0) { + selectedVisuals.push(visual); + } + }); + if (selectedVisuals.length !== 1) { + // either we have no selection or + // we have selected atoms in two or more visuals -- not supported + return; + } + const editor = selectedVisuals[0].beginFragmentEdit(); + if (!editor) { + return; + } + this._editors = [editor]; + this.logger.info('FRAGMENT EDIT MODE -- ON (single bond)'); + this._setEditMode(EDIT_MODE.FRAGMENT); + this._objectControls.allowTranslation(false); + this._objectControls.allowAltObjFreeRotation(editor.isFreeRotationAllowed()); + this._needRender = true; +}; +Miew.prototype._applyFragmentEdit = function () { + if (this._editMode !== EDIT_MODE.FRAGMENT) { + return; + } + this._objectControls.stop(); + for (let i = 0; i < this._editors.length; ++i) { + this._editors[i].apply(); + } + this._editors = []; + this.logger.info('FRAGMENT EDIT MODE -- OFF (applied)'); + this._setEditMode(EDIT_MODE.COMPLEX); + this._objectControls.allowTranslation(true); + this._objectControls.allowAltObjFreeRotation(true); + this.rebuildAll(); +}; +Miew.prototype._discardFragmentEdit = function () { + if (this._editMode !== EDIT_MODE.FRAGMENT) { + return; + } + this._objectControls.stop(); + for (let i = 0; i < this._editors.length; ++i) { + this._editors[i].discard(); + } + this._editors = []; + this.logger.info('FRAGMENT EDIT MODE -- OFF (discarded)'); + this._setEditMode(EDIT_MODE.COMPLEX); + this._objectControls.allowTranslation(true); + this._objectControls.allowAltObjFreeRotation(true); + this._needRender = true; +}; +Miew.prototype._onPick = function (event) { + if (!settings.now.picking) { + // picking is disabled + return; + } + if (this._animInterval !== null) { + // animation playback is on + return; + } + if (this._editMode === EDIT_MODE.FRAGMENT) { + // prevent picking in fragment edit mode + return; + } + if (this._objectControls.isEditingAltObj()) { + // prevent picking during component rotation + return; + } + // update last pick & find complex + let complex = null; + if (event.obj.atom) { + complex = event.obj.atom.residue.getChain().getComplex(); + this._lastPick = event.obj.atom; + } else if (event.obj.residue) { + complex = event.obj.residue.getChain().getComplex(); + this._lastPick = event.obj.residue; + } else if (event.obj.chain) { + complex = event.obj.chain.getComplex(); + this._lastPick = event.obj.chain; + } else if (event.obj.molecule) { + complex = event.obj.molecule.complex; + this._lastPick = event.obj.molecule; + } else { + this._lastPick = null; + } + function _updateSelection(visual) { + visual.updateSelectionMask(event.obj); + visual.rebuildSelectionGeometry(); + } - Miew.prototype.center = function (selector) { - // no arguments - center on current selection; - if (selector === undefined) { - this.setPivotSubset(); + // update visual + if (complex) { + const visual = this._getVisualForComplex(complex); + if (visual) { + _updateSelection(visual); this._needRender = true; - return; - } // subset with atom or residue - center on picked atom/residue; + } + } else { + this._forEachComplexVisual(_updateSelection); + this._needRender = true; + } + this._updateInfoPanel(); + this.dispatchEvent(event); +}; +Miew.prototype._onKeyDown = function (event) { + if (!this._running || !this._hotKeysEnabled) { + return; + } + // editing keys + if (settings.now.editing) { + switch (event.code) { + case 'KeyC': + this._enterComponentEditMode(); + break; + case 'KeyF': + this._enterFragmentEditMode(); + break; + case 'KeyA': + switch (this._editMode) { + case EDIT_MODE.COMPONENT: + this._applyComponentEdit(); + break; + case EDIT_MODE.FRAGMENT: + this._applyFragmentEdit(); + break; + default: + break; + } + break; + case 'KeyD': + switch (this._editMode) { + case EDIT_MODE.COMPONENT: + this._discardComponentEdit(); + break; + case EDIT_MODE.FRAGMENT: + this._discardFragmentEdit(); + break; + default: + break; + } + break; + default: + } + } - if (selector.obj !== undefined && ('atom' in selector.obj || 'residue' in selector.obj)) { - // from event with selection - if ('atom' in selector.obj) { - this.setPivotAtom(selector.obj.atom); - } else { - this.setPivotResidue(selector.obj.residue); + // other keys + switch (event.code) { + case 'NumpadAdd': + if (event.altKey) { + event.preventDefault(); + event.stopPropagation(); + this._forEachComplexVisual(visual => { + visual.expandSelection(); + visual.rebuildSelectionGeometry(); + }); + this._updateInfoPanel(); + this._needRender = true; } - - this._needRender = true; - return; - } // string - center on atoms correspond to selection string - - - if (selector.obj === undefined && selector !== '') { - var sel = selectors$4.parse(selector); - - if (sel.error === undefined) { - this.setPivotSubset(sel); + break; + case 'NumpadSubtract': + if (event.altKey) { + event.preventDefault(); + event.stopPropagation(); + this._forEachComplexVisual(visual => { + visual.shrinkSelection(); + visual.rebuildSelectionGeometry(); + }); + this._updateInfoPanel(); this._needRender = true; - return; } - } // empty subset or incorrect/empty string - center on all molecule; - - - this.resetPivot(); - this._needRender = true; - }; - /** - * Build selector that contains all atoms within given distance from group of atoms - * @param {Selector} selector - selector describing source group of atoms - * @param {number} radius - distance - * @returns {Selector} selector describing result group of atoms - */ - - - Miew.prototype.within = function (selector, radius) { - var visual = this._getComplexVisual(); - - if (!visual) { - return selectors$4.None(); - } - - if (selector instanceof String) { - selector = selectors$4.parse(selector); + break; + default: + } +}; +Miew.prototype._onKeyUp = function (event) { + if (!this._running || !this._hotKeysEnabled) { + return; + } + if (event.code === 'KeyX') { + this._extractRepresentation(); + } +}; +Miew.prototype._updateInfoPanel = function () { + const info = this._msgAtomInfo.getElementsByTagName('p')[0]; + let atom; + let residue; + let count = 0; + this._forEachComplexVisual(visual => { + count += visual.getSelectionCount(); + }); + while (info.firstChild) { + info.removeChild(info.firstChild); + } + if (count === 0) { + this._msgAtomInfo.style.opacity = 0.0; + return; + } + let firstLine = `${String(count)} atom${count !== 1 ? 's' : ''} selected`; + if (this._lastPick !== null) { + firstLine += ', the last pick:'; + } + let secondLine = ''; + let aName = ''; + let coordLine = ''; + if (this._lastPick instanceof Miew_Atom) { + atom = this._lastPick; + residue = atom.residue; + aName = atom.name; + const location = atom.location !== 32 ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space + secondLine = `${atom.element.fullName} #${atom.serial}${location}: \ + ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}.`; + secondLine += aName; + coordLine = `Coord: (${atom.position.x.toFixed(2).toString()},\ + ${atom.position.y.toFixed(2).toString()},\ + ${atom.position.z.toFixed(2).toString()})`; + } else if (this._lastPick instanceof Miew_Residue) { + residue = this._lastPick; + secondLine = `${residue._type._fullName}: \ + ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}`; + } else if (this._lastPick instanceof Miew_Chain) { + secondLine = `chain ${this._lastPick._name}`; + } else if (this._lastPick instanceof Miew_Molecule) { + secondLine = `molecule ${this._lastPick._name}`; + } + info.appendChild(document.createTextNode(firstLine)); + if (secondLine !== '') { + info.appendChild(document.createElement('br')); + info.appendChild(document.createTextNode(secondLine)); + } + if (coordLine !== '') { + info.appendChild(document.createElement('br')); + info.appendChild(document.createTextNode(coordLine)); + } + this._msgAtomInfo.style.opacity = 1.0; +}; +Miew.prototype._getAltObj = function () { + if (this._editors) { + let altObj = null; + for (let i = 0; i < this._editors.length; ++i) { + const nextAltObj = this._editors[i].getAltObj(); + if (nextAltObj.objects.length > 0) { + if (altObj) { + // we have selected atoms in two or more visuals -- not supported + altObj = null; + break; + } + altObj = nextAltObj; + } } - - var res = visual.within(selector, radius); - - if (res) { - visual.rebuildSelectionGeometry(); - this._needRender = true; + if (altObj) { + return altObj; } - - return res; + } + return { + objects: [], + pivot: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0, 0, 0) + }; +}; +Miew.prototype.resetPivot = function () { + const boundingBox = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Box3(); + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + return function () { + boundingBox.makeEmpty(); + this._forEachVisual(visual => { + boundingBox.union(visual.getBoundaries().boundingBox); + }); + boundingBox.getCenter(center); + this._objectControls.setPivot(center.negate()); + this.dispatchEvent({ + type: 'transform' + }); }; - /** - * Get atom position in 2D canvas coords - * @param {string} fullAtomName - full atom name, like A.38.CG - * @returns {Object} {x, y} or false if atom not found - */ - - - Miew.prototype.projected = function (fullAtomName, complexName) { - var visual = this._getComplexVisual(complexName); - +}(); +Miew.prototype.setPivotResidue = function () { + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + return function (residue) { + const visual = this._getVisualForComplex(residue.getChain().getComplex()); if (!visual) { - return false; - } - - var atom = visual.getComplex().getAtomByFullname(fullAtomName); - - if (atom === null) { - return false; + return; } - - var pos = atom.position.clone(); // we consider atom position to be affected only by common complex transform - // ignoring any transformations that may add during editing - - this._gfx.pivot.updateMatrixWorldRecursive(); - - this._gfx.camera.updateMatrixWorldRecursive(); - - this._gfx.pivot.localToWorld(pos); - - pos.project(this._gfx.camera); - return { - x: (pos.x + 1.0) * 0.5 * this._gfx.width, - y: (1.0 - pos.y) * 0.5 * this._gfx.height - }; + if (residue._controlPoint) { + center.copy(residue._controlPoint); + } else { + let x = 0; + let y = 0; + let z = 0; + const amount = residue._atoms.length; + for (let i = 0; i < amount; ++i) { + const p = residue._atoms[i].position; + x += p.x / amount; + y += p.y / amount; + z += p.z / amount; + } + center.set(x, y, z); + } + center.applyMatrix4(visual.matrix).negate(); + this._objectControls.setPivot(center); + this.dispatchEvent({ + type: 'transform' + }); }; - /** - * Replace secondary structure with calculated one. - * - * DSSP algorithm implementation is used. - * - * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and - * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211. - * - * @param {string=} complexName - complex name - */ - - - Miew.prototype.dssp = function (complexName) { - var visual = this._getComplexVisual(complexName); - +}(); +Miew.prototype.setPivotAtom = function () { + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + return function (atom) { + const visual = this._getVisualForComplex(atom.residue.getChain().getComplex()); if (!visual) { return; } - - visual.getComplex().dssp(); // rebuild dependent representations (cartoon or ss-colored) - - visual._reprList.forEach(function (rep) { - if (rep.mode.id === 'CA' || rep.colorer.id === 'SS') { - rep.needsRebuild = true; + center.copy(atom.position); + center.applyMatrix4(visual.matrix).negate(); + this._objectControls.setPivot(center); + this.dispatchEvent({ + type: 'transform' + }); + }; +}(); +Miew.prototype.getSelectionCenter = function () { + const _centerInVisual = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0); + return function (center, includesAtom, selector) { + center.set(0.0, 0.0, 0.0); + let count = 0; + this._forEachComplexVisual(visual => { + if (visual.getSelectionCenter(_centerInVisual, includesAtom, selector || visual.getSelectionBit())) { + center.add(_centerInVisual); + count++; } }); + if (count === 0) { + return false; + } + center.divideScalar(count); + center.negate(); + return true; }; - - Miew.prototype.exportCML = function () { - var self = this; - - function extractRotation(m) { - var xAxis = new THREE.Vector3(); - var yAxis = new THREE.Vector3(); - var zAxis = new THREE.Vector3(); - m.extractBasis(xAxis, yAxis, zAxis); - xAxis.normalize(); - yAxis.normalize(); - zAxis.normalize(); - var retMat = new THREE.Matrix4(); - retMat.identity(); - retMat.makeBasis(xAxis, yAxis, zAxis); - return retMat; - } - - function updateCMLData(complex) { - var root = self._gfx.root; - var mat = extractRotation(root.matrixWorld); - var v4 = new THREE.Vector4(0, 0, 0, 0); - var vCenter = new THREE.Vector4(0, 0, 0, 0); - var xml = null; - var ap = null; // update atoms in cml - - complex.forEachAtom(function (atom) { - if (atom.xmlNodeRef && atom.xmlNodeRef.xmlNode) { - xml = atom.xmlNodeRef.xmlNode; - ap = atom.position; - v4.set(ap.x, ap.y, ap.z, 1.0); - v4.applyMatrix4(mat); - xml.setAttribute('x3', v4.x.toString()); - xml.setAttribute('y3', v4.y.toString()); - xml.setAttribute('z3', v4.z.toString()); - xml.removeAttribute('x2'); - xml.removeAttribute('y2'); - } - }); // update stereo groups in cml - - complex.forEachSGroup(function (sGroup) { - if (sGroup.xmlNodeRef && sGroup.xmlNodeRef.xmlNode) { - xml = sGroup.xmlNodeRef.xmlNode; - ap = sGroup.getPosition(); - v4.set(ap.x, ap.y, ap.z, 1.0); - var cp = sGroup.getCentralPoint(); - - if (cp === null) { - v4.applyMatrix4(mat); - } else { - vCenter.set(cp.x, cp.y, cp.z, 0.0); - v4.add(vCenter); - v4.applyMatrix4(mat); // pos in global space - - vCenter.set(cp.x, cp.y, cp.z, 1.0); - vCenter.applyMatrix4(mat); - v4.sub(vCenter); - } - - xml.setAttribute('x', v4.x.toString()); - xml.setAttribute('y', v4.y.toString()); - xml.setAttribute('z', v4.z.toString()); - } +}(); +Miew.prototype.setPivotSubset = function () { + const _center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(0.0, 0.0, 0.0); + function _includesInCurSelection(atom, selectionBit) { + return atom.mask & 1 << selectionBit; + } + function _includesInSelector(atom, selector) { + return selector.selector.includesAtom(atom); + } + return function (selector) { + const includesAtom = selector ? _includesInSelector : _includesInCurSelection; + if (this.getSelectionCenter(_center, includesAtom, selector)) { + this._objectControls.setPivot(_center); + this.dispatchEvent({ + type: 'transform' }); + } else { + this.logger.warn('selection is empty. Center operation not performed'); + } + }; +}(); + +/** + * Makes a screenshot. + * @param {number} [width] - Width of an image. Defaults to the canvas width. + * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height, + * if width is omitted too. + * @returns {string} Data URL representing the image contents. + */ +Miew.prototype.screenshot = function (width, height) { + const gfx = this._gfx; + const deviceWidth = gfx.renderer.domElement.width; + const deviceHeight = gfx.renderer.domElement.height; + function fov2Tan(fov) { + return Math.tan(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MathUtils.degToRad(0.5 * fov)); + } + function tan2Fov(tan) { + return external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.MathUtils.radToDeg(Math.atan(tan)) * 2.0; + } + function getDataURL() { + let dataURL; + const currBrowser = utils.getBrowser(); + if (currBrowser === utils.browserType.SAFARI) { + const canvas = document.createElement('canvas'); + const canvasContext = canvas.getContext('2d'); + canvas.width = width === undefined ? deviceWidth : width; + canvas.height = height === undefined ? deviceHeight : height; + canvasContext.drawImage(gfx.renderer.domElement, 0, 0, canvas.width, canvas.height); + dataURL = canvas.toDataURL('image/png'); + } else { + // Copy current canvas to screenshot + dataURL = gfx.renderer.domElement.toDataURL('image/png'); } + return dataURL; + } + height = height || width; + let screenshotURI; + if (width === undefined && height === undefined || width === deviceWidth && height === deviceHeight) { + // renderer.domElement.toDataURL('image/png') returns flipped image in Safari + // It hasn't been resolved yet, but getScreenshotSafari() + // fixes it using an extra canvas. + screenshotURI = getDataURL(); + } else { + const originalAspect = gfx.camera.aspect; + const originalFov = gfx.camera.fov; + const originalTanFov2 = fov2Tan(gfx.camera.fov); + + // screenshot should contain the principal area of interest (a centered square touching screen sides) + const areaOfInterestSize = Math.min(gfx.width, gfx.height); + const areaOfInterestTanFov2 = originalTanFov2 * areaOfInterestSize / gfx.height; + + // set appropriate camera aspect & FOV + const shotAspect = width / height; + gfx.renderer.setPixelRatio(1); + gfx.camera.aspect = shotAspect; + gfx.camera.fov = tan2Fov(areaOfInterestTanFov2 / Math.min(shotAspect, 1.0)); + gfx.camera.updateProjectionMatrix(); - var visual = self._getComplexVisual(); - - var complex = visual ? visual.getComplex() : null; - - if (complex && complex.originalCML) { - updateCMLData(complex); // serialize xml structure to string - - var oSerializer = new XMLSerializer(); - return oSerializer.serializeToString(complex.originalCML); - } - - return null; - }; - /** - * Reproduce the RCSB PDB Molecule of the Month style by David S. Goodsell - * - * @see http://pdb101.rcsb.org/motm/motm-about - */ + // resize canvas to the required size of screenshot + gfx.renderer.setDrawingBufferSize(width, height, 1); + // make screenshot + this._renderFrame(settings.now.stereo); + screenshotURI = getDataURL(); - Miew.prototype.motm = function () { - settings.set({ - fogColorEnable: true, - fogColor: 0x000000, - outline: { - on: true, - threshold: 0.01 - }, - bg: { - color: 0xffffff - } + // restore original camera & canvas proportions + gfx.renderer.setPixelRatio(window.devicePixelRatio); + gfx.camera.aspect = originalAspect; + gfx.camera.fov = originalFov; + gfx.camera.updateProjectionMatrix(); + gfx.renderer.setDrawingBufferSize(gfx.width, gfx.height, window.devicePixelRatio); + this._needRender = true; + } + return screenshotURI; +}; + +/** + * Makes screenshot and initiates a download. + * @param {string} [filename] - Name of a file. Default to a 'screenshot-XXXXX.png', where XXXXX is a current + * date/time in seconds. + * @param {number} [width] - Width of an image. Defaults to the canvas width. + * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height, + * if width is omitted too. + */ +Miew.prototype.screenshotSave = function (filename, width, height) { + const uri = this.screenshot(width, height); + utils.shotDownload(uri, filename); +}; +Miew.prototype.save = function (opts) { + this._export(opts.fileType).then(dataString => { + const filename = this._visuals[this._curVisualName]._complex.name; + utils.download(dataString, filename, opts.fileType); + this._refreshTitle(); + this.dispatchEvent({ + type: 'exportingDone' }); - - this._forEachComplexVisual(function (visual) { - var rep = []; - var complex = visual.getComplex(); - var palette = palettes.get(settings.now.palette); - - for (var i = 0; i < complex.getChainCount(); i++) { - var curChainName = complex._chains[i]._name; - var curChainColor = palette.getChainColor(curChainName); - rep[i] = { - selector: "chain ".concat(curChainName), - mode: 'VW', - colorer: ['CB', { - color: curChainColor, - factor: 0.9 - }], - material: 'FL' - }; + }).catch(error => { + this.logger.error('Could not export data'); + this.logger.debug(error); + this._refreshTitle(); + this.dispatchEvent({ + type: 'exportingDone', + error + }); + }); +}; +Miew.prototype._tweakResolution = function () { + const maxPerf = [['poor', 100], ['low', 500], ['medium', 1000], ['high', 5000], ['ultra', Number.MAX_VALUE]]; + let atomCount = 0; + this._forEachComplexVisual(visual => { + atomCount += visual.getComplex().getAtomCount(); + }); + if (atomCount > 0) { + const performance = this._gfxScore * 10e5 / atomCount; + // set resolution based on estimated performance + for (let i = 0; i < maxPerf.length; ++i) { + if (performance < maxPerf[i][1]) { + this._autoChangeResolution(maxPerf[i][0]); + break; } - - visual.resetReps(rep); + } + } +}; +Miew.prototype._autoChangeResolution = function (resolution) { + if (resolution !== settings.now.resolution) { + this.logger.report(`Your rendering resolution was changed to "${resolution}" for best performance.`); + } + settings.now.resolution = resolution; +}; + +/** + * Save current settings to cookies. + */ +Miew.prototype.saveSettings = function () { + this._cookies.setCookie(this._opts.settingsCookie, JSON.stringify(this.settings.getDiffs(true))); +}; + +/** + * Load settings from cookies. + */ +Miew.prototype.restoreSettings = function () { + try { + const cookie = this._cookies.getCookie(this._opts.settingsCookie); + const diffs = cookie ? JSON.parse(cookie) : {}; + this.settings.applyDiffs(diffs, true); + } catch (e) { + this.logger.error(`Cookies parse error: ${e.message}`); + } +}; + +/** + * Reset current settings to the defaults. + */ +Miew.prototype.resetSettings = function () { + this.settings.reset(); +}; + +/* + * DANGEROUS and TEMPORARY. The method should change or disappear in future versions. + * @param {string|object} opts - See {@link Miew} constructor. + * @see {@link Miew#set}, {@link Miew#repAdd}, {@link Miew#rep}. + */ +Miew.prototype.setOptions = function (opts) { + if (typeof opts === 'string') { + opts = Miew.options.fromAttr(opts); + } + if (opts.reps) { + this._opts.reps = null; + } + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().merge(this._opts, opts); + if (opts.settings) { + this.set(opts.settings); + } + this._opts._objects = opts._objects; + this._resetObjects(); + if (opts.load) { + this.load(opts.load, { + fileType: opts.type }); - }; - - Miew.prototype.VERSION = "0.9.0" ; // Uncomment this to get debug trace: - // Miew.prototype.debugTracer = new utils.DebugTracer(Miew.prototype); - - _.assign(Miew, - /** @lends Miew */ - { - VERSION: Miew.prototype.VERSION, - registeredPlugins: [], - // export namespaces // TODO: WIP: refactoring external interface - chem: chem, - io: io, - modes: modes, - colorers: colorers, - materials: materials, - palettes: palettes, - options: options, - settings: settings, - utils: utils, - gfx: { - Representation: Representation - }, - - /** - * Third-party libraries packaged together with Miew. - * - * @property {object} lodash - [Lodash](https://lodash.com/), a modern JavaScript utility library delivering - * modularity, performance & extras. - * @property {object} three - [three.js](https://threejs.org/), JavaScript 3D library. - * - * @example - * var _ = Miew.thirdParty.lodash; - * var opts = _.merge({ ... }, Miew.options.fromURL(window.location.search)); - * var miew = new Miew(opts); - */ - thirdParty: { - lodash: _, - three: THREE + } + if (opts.preset) { + settings.now.preset = opts.preset; + } + if (opts.reps) { + this.resetReps(opts.preset); + } + if (this._opts.view) { + this.view(this._opts.view); + delete this._opts.view; + } + const visual = this._getComplexVisual(); + if (visual) { + visual.getComplex().resetCurrentUnit(); + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isNumber(opts.unit)) { + visual.getComplex().setCurrentUnit(opts.unit); } - }); + this.resetView(); + this.rebuildAll(); + } +}; +Miew.prototype.info = function (name) { + const visual = this._getComplexVisual(name); + if (!visual) { + return {}; + } + const complex = visual.getComplex(); + const { + metadata + } = complex; + return { + id: metadata.id || complex.name || 'UNKNOWN', + title: metadata.title && metadata.title.join(' ') || 'UNKNOWN DATA', + atoms: complex.getAtomCount(), + bonds: complex.getBondCount(), + residues: complex.getResidueCount(), + chains: complex.getChainCount() + }; +}; + +/* + * OBJECTS SEGMENT + */ - /* eslint-disable */ - // DO NOT EDIT! Automatically generated from .jison - /* parser generated by jison 0.4.18 */ - /* - Returns a Parser object of the following structure: - - Parser: { - yy: {} - } - - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), - - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), - - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, - - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } - - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) +Miew.prototype.addObject = function (objData, bThrow) { + let Ctor = null; + if (objData.type === objects_LinesObj.prototype.type) { + Ctor = objects_LinesObj; + } + if (Ctor === null) { + throw new Error(`Unknown scene object type - ${objData.type}`); + } + try { + const newObj = new Ctor(objData.params, objData.opts); + this._addSceneObject(newObj); + } catch (error) { + if (!bThrow) { + this.logger.debug(`Error during scene object creation: ${error.message}`); + } else { + throw error; } - */ - var parser$1 = (function(){ - var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,60],$V1=[1,62],$V2=[1,63],$V3=[1,65],$V4=[1,66],$V5=[1,67],$V6=[1,68],$V7=[1,69],$V8=[1,80],$V9=[1,72],$Va=[1,73],$Vb=[1,74],$Vc=[1,75],$Vd=[1,99],$Ve=[1,76],$Vf=[1,100],$Vg=[1,79],$Vh=[1,51],$Vi=[1,81],$Vj=[1,82],$Vk=[1,84],$Vl=[1,83],$Vm=[1,85],$Vn=[1,96],$Vo=[1,97],$Vp=[1,98],$Vq=[1,86],$Vr=[1,87],$Vs=[1,64],$Vt=[1,70],$Vu=[1,71],$Vv=[1,77],$Vw=[1,78],$Vx=[1,53],$Vy=[1,54],$Vz=[1,55],$VA=[1,61],$VB=[1,88],$VC=[1,89],$VD=[1,90],$VE=[1,91],$VF=[1,92],$VG=[1,93],$VH=[1,94],$VI=[1,95],$VJ=[1,101],$VK=[1,102],$VL=[1,103],$VM=[1,104],$VN=[1,105],$VO=[1,56],$VP=[1,57],$VQ=[1,58],$VR=[1,59],$VS=[1,115],$VT=[1,111],$VU=[1,114],$VV=[1,112],$VW=[1,113],$VX=[1,118],$VY=[1,117],$VZ=[1,134],$V_=[1,149],$V$=[1,150],$V01=[1,157],$V11=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V21=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,71,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V31=[5,6,7,9,13,15,17,18,19,20,23,25,26,27,30,33,34,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95],$V41=[5,70,72],$V51=[5,74],$V61=[71,101]; - var parser = {trace: function trace () { }, - yy: {}, - symbols_: {"error":2,"Program":3,"Command":4,"EOF":5,"RESET":6,"BUILD":7,"ALL":8,"HELP":9,"Path":10,"MOTM":11,"OneArgCommand":12,"GET":13,"STRING":14,"SET":15,"Value":16,"SET_SAVE":17,"SET_RESTORE":18,"SET_RESET":19,"PRESET":20,"AddRepresentation":21,"EditRepresentation":22,"REMOVE":23,"RepresentationReference":24,"HIDE":25,"SHOW":26,"LIST":27,"EXPAND_KEY":28,"SELECTOR_KEY":29,"SELECT":30,"AS":31,"WordAll":32,"SELECTOR":33,"WITHIN":34,"NUMBER":35,"OF":36,"MATERIAL":37,"IDENTIFIER":38,"ModeCMD":39,"ColorCMD":40,"VIEW":41,"BASE_64":42,"UNIT":43,"DSSP":44,"SCALE":45,"ROTATE":46,"AxesList":47,"TRANSLATE":48,"CENTER":49,"GetURLBranch":50,"Screenshot":51,"LINE":52,"ArgList":53,"LISTOBJ":54,"REMOVEOBJ":55,"URL":56,"VIEW_KEY":57,"SCREENSHOT":58,"LOAD":59,"Url":60,"FILE_KEY":61,"ADD":62,"Description":63,"REP":64,"MODE":65,"COLOR":66,"Descriptor":67,"RepresentationOwnProperty":68,"RepresentationOwnPropertyOpts":69,"DESC_KEY":70,"=":71,"DESC_KEY_OPTS":72,"AxesArg":73,"DESC_KEY_AXES":74,"Arg":75,"PathWoDescKey":76,"HEX":77,"BOOL":78,"Word":79,"CommandSetWoDESC_KEY":80,"DescKeys":81,"CLEAR":82,"FILE_LIST":83,"FILE_REGISTER":84,"FILE_DELETE":85,"PRESET_ADD":86,"PRESET_DELETE":87,"PRESET_UPDATE":88,"PRESET_RENAME":89,"PRESET_OPEN":90,"CREATE_SCENARIO":91,"RESET_SCENARIO":92,"DELETE_SCENARIO":93,"ADD_SCENARIO_ITEM":94,"LIST_SCENARIO":95,"PDB_KEY":96,"DELAY_KEY":97,"PRST_KEY":98,"DESCRIPTION_KEY":99,"CommandSet":100,".":101,"PresetPath":102,"/":103,"HexOrNumber":104,"$accept":0,"$end":1}, - terminals_: {2:"error",5:"EOF",6:"RESET",7:"BUILD",8:"ALL",9:"HELP",11:"MOTM",13:"GET",14:"STRING",15:"SET",17:"SET_SAVE",18:"SET_RESTORE",19:"SET_RESET",20:"PRESET",23:"REMOVE",25:"HIDE",26:"SHOW",27:"LIST",28:"EXPAND_KEY",29:"SELECTOR_KEY",30:"SELECT",31:"AS",33:"SELECTOR",34:"WITHIN",35:"NUMBER",36:"OF",37:"MATERIAL",38:"IDENTIFIER",41:"VIEW",42:"BASE_64",43:"UNIT",44:"DSSP",45:"SCALE",46:"ROTATE",48:"TRANSLATE",49:"CENTER",52:"LINE",54:"LISTOBJ",55:"REMOVEOBJ",56:"URL",57:"VIEW_KEY",58:"SCREENSHOT",59:"LOAD",61:"FILE_KEY",62:"ADD",64:"REP",65:"MODE",66:"COLOR",70:"DESC_KEY",71:"=",72:"DESC_KEY_OPTS",74:"DESC_KEY_AXES",77:"HEX",78:"BOOL",82:"CLEAR",83:"FILE_LIST",84:"FILE_REGISTER",85:"FILE_DELETE",86:"PRESET_ADD",87:"PRESET_DELETE",88:"PRESET_UPDATE",89:"PRESET_RENAME",90:"PRESET_OPEN",91:"CREATE_SCENARIO",92:"RESET_SCENARIO",93:"DELETE_SCENARIO",94:"ADD_SCENARIO_ITEM",95:"LIST_SCENARIO",96:"PDB_KEY",97:"DELAY_KEY",98:"PRST_KEY",99:"DESCRIPTION_KEY",101:".",103:"/"}, - productions_: [0,[3,2],[3,1],[4,1],[4,1],[4,2],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,3],[4,3],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[4,2],[4,1],[4,2],[4,2],[4,2],[4,4],[4,2],[4,6],[4,2],[4,1],[4,1],[4,1],[4,2],[4,2],[4,1],[4,2],[4,1],[4,2],[4,2],[4,2],[4,1],[4,2],[4,1],[4,1],[4,3],[4,3],[4,4],[4,4],[4,1],[4,2],[50,1],[50,2],[50,2],[50,3],[50,3],[51,1],[51,2],[51,3],[12,2],[12,2],[12,2],[21,1],[21,2],[21,2],[21,3],[22,2],[22,3],[39,2],[39,3],[40,2],[40,3],[24,1],[24,1],[63,1],[63,2],[63,3],[63,4],[67,1],[67,1],[67,2],[68,3],[69,3],[47,1],[47,2],[73,2],[53,1],[53,2],[75,3],[16,1],[16,1],[16,1],[16,1],[16,1],[79,1],[79,1],[32,1],[32,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[100,1],[100,1],[76,1],[76,3],[76,3],[10,1],[10,1],[10,3],[10,3],[10,3],[60,1],[102,1],[102,3],[104,1],[104,1]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { - /* this == yyval */ - - var $0 = $$.length - 1; - switch (yystate) { - case 1: - return $$[$0-1]; - case 3: - this.$ = yy.miew.reset(false); yy.ClearContext(); yy.miew.resetReps("empty"); - break; - case 4: - this.$ = yy.miew.rebuild(); - break; - case 5: - this.$ = yy.miew.rebuildAll(); yy.miew.rebuild(); - break; - case 6: - this.$ = yy.echo(yy.utils.help().toString()); - break; - case 7: - this.$ = yy.echo(yy.utils.help($$[$0]).toString()); - break; - case 8: - this.$ = yy.miew.motm(); - break; - case 10: case 11: - this.$ = yy.utils.propagateProp($$[$0]); yy.echo(yy.miew.get($$[$0]).toString()); - break; - case 12: case 13: - this.$ = yy.miew.set($$[$0-1], yy.utils.propagateProp($$[$0-1], $$[$0]));break; - case 14: - this.$ = yy.miew.saveSettings();break; - case 15: - this.$ = yy.miew.restoreSettings();break; - case 16: - this.$ = yy.miew.resetSettings();break; - case 17: - this.$ = yy.miew.resetReps(); - break; - case 18: - this.$ = yy.miew.applyPreset($$[$0]); - break; - case 21: - this.$ = yy.miew.repRemove($$[$0]); yy.representations.remove($$[$0]); - break; - case 22: - this.$ = yy.miew.repHide($$[$0]); - break; - case 23: - this.$ = yy.miew.repHide($$[$0], false); - break; - case 24: - this.$ = yy.echo(yy.utils.listRep(yy.miew, yy.representations, $$[$0], '-e')); - break; - case 25: - this.$ = yy.echo(yy.utils.list(yy.miew, yy.representations)); - break; - case 26: - this.$ = yy.echo(yy.utils.list(yy.miew, yy.representations, $$[$0])); - break; - case 27: - this.$ = yy.echo(yy.utils.listSelector(yy.miew, yy.Context)); - break; - case 28: - this.$ = yy.miew.select(yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0], true)); - break; - case 29: - this.$ = yy.Context[$$[$0].toLowerCase()] = yy.utils.checkArg($$[$0-3].toLowerCase(), $$[$0-2], true); yy.miew.select(yy.Context[$$[$0].toLowerCase()]); - break; - case 30: - this.$ = yy.miew.rep(yy.miew.repCurrent(), {selector : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0])}); - break; - case 31: - this.$ = yy.Context[$$[$0].toLowerCase()] = yy.miew.within(yy.utils.checkArg("select", $$[$0-2], true), Number($$[$0-4])); - break; - case 32: - this.$ = yy.miew.rep(yy.miew.repCurrent(), {material : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())}); - break; - case 35: - this.$ = yy.echo(yy.miew.view()); - break; - case 36: case 37: - this.$ = yy.miew.view($$[$0]); - break; - case 38: - this.$ = yy.echo(yy.miew.changeUnit()); - break; - case 39: - this.$ = yy.echo(yy.miew.changeUnit($$[$0])); - break; - case 40: - this.$ = yy.miew.dssp(); - break; - case 41: - this.$ = yy.miew.scale($$[$0]); - break; - case 42: - for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.rotate($$[$0][i]['x'] * Math.PI / 180.0, $$[$0][i]['y'] * Math.PI / 180.0, $$[$0][i]['z'] * Math.PI / 180.0);} - break; - case 43: - for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.translate($$[$0][i]['x'] || 0, $$[$0][i]['y'] || 0, $$[$0][i]['z'] || 0);} - break; - case 44: - this.$ = yy.miew.center(); - break; - case 45: - this.$ = yy.miew.center($$[$0]); - break; - case 48: case 49: - this.$ = yy.miew.addObject({type: 'line', params: [$$[$0-1], $$[$0]]}, true); - break; - case 50: case 51: - this.$ = yy.miew.addObject({type: 'line', params: [$$[$0-2], $$[$0-1]], opts:$$[$0].toJSO(yy.utils, 'objects', 'line')}, true); - break; - case 52: - this.$ = yy.echo(yy.utils.listObjs(yy.miew)); - break; - case 53: - this.$ = yy.miew.removeObject($$[$0]); - break; - case 54: - this.$ = yy.echo(yy.miew.getURL({view: false, settings: false})); - break; - case 55: - this.$ = yy.echo(yy.miew.getURL({view: false, settings: true})); - break; - case 56: - this.$ = yy.echo(yy.miew.getURL({view: true, settings: false})); - break; - case 57: case 58: - this.$ = yy.echo(yy.miew.getURL({view: true, settings: true})); - break; - case 59: - this.$ = yy.miew.screenshotSave(); - break; - case 60: - this.$ = yy.miew.screenshotSave('', Number($$[$0])); - break; - case 61: - this.$ = yy.miew.screenshotSave('', Number($$[$0-1]), Number($$[$0])); - break; - case 62: case 63: case 64: - this.$ = yy.utils.load(yy.miew, $$[$0]); yy.representations.clear(); - break; - case 65: - this.$ = yy.echo(yy.representations.add(yy.miew.repAdd())); - break; - case 66: - this.$ = yy.echo(yy.representations.add($$[$0], yy.miew.repAdd())); - break; - case 67: - this.$ = yy.echo(yy.representations.add(yy.miew.repAdd($$[$0]))); - break; - case 68: - this.$ = yy.echo(yy.representations.add($$[$0-1], yy.miew.repAdd($$[$0]))); - break; - case 69: - this.$ = yy.miew.rep($$[$0]); yy.miew.repCurrent($$[$0]); - break; - case 70: - this.$ = yy.miew.rep($$[$0-1], $$[$0]); yy.miew.repCurrent($$[$0-1]); - break; - case 71: - this.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())}); - break; - case 72: - this.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))}); - break; - case 73: - this.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())}); - break; - case 74: - this.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))}); - break; - case 75: - this.$ = Number(yy.representations.get($$[$0])); - break; - case 76: case 92: - this.$ = Number($$[$0]); - break; - case 77: - this.$ = $$[$0]; - break; - case 78: - this.$ = yy._.assign($$[$0-1], $$[$0]); - break; - case 79: - this.$ = yy._.assign($$[$0-2], $$[$0-1], $$[$0]); - break; - case 80: - this.$ = yy._.assign($$[$0-3], $$[$0-2], $$[$0-1], $$[$0]); - break; - case 81: case 82: - this.$ = yy.CreateObjectPair($$[$0].key, $$[$0].val); - break; - case 83: - this.$ = yy.CreateObjectPair($$[$0-1].key, new Array($$[$0-1].val, $$[$0].toJSO(yy.utils, $$[$0-1].key, $$[$0-1].val))); - break; - case 84: case 85: - this.$ = Object.create({'key': yy.keyRemap($$[$0-2]), 'val': yy.utils.checkArg($$[$0-2], $$[$0])}); - break; - case 86: - this.$ = [$$[$0]]; - break; - case 87: - this.$ = $$[$0-1].concat($$[$0]); - break; - case 88: - this.$ = yy.CreateObjectPair($$[$0-1].toLowerCase(), Number($$[$0])); - break; - case 89: - this.$ = new yy.ArgList($$[$0]); - break; - case 90: - this.$ = $$[$0-1].append($$[$0]); - break; - case 91: - this.$ = new yy.Arg($$[$0-2], $$[$0]); - break; - case 93: - this.$ = parseInt($$[$0]); - break; - case 94: - this.$ = JSON.parse($$[$0]); - break; - case 95: case 96: - this.$ = String($$[$0]); - break; - case 157: case 158: case 161: case 162: case 163: - this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; //cause of could be color word in path; - break; - case 166: - this.$ = $$[$0-2] = $$[$0-2] + $$[$0-1] + $$[$0]; - break; } - }, - table: [{3:1,4:2,5:[1,3],6:[1,4],7:[1,5],9:[1,6],11:[1,7],12:8,13:[1,9],15:[1,10],17:[1,11],18:[1,12],19:[1,13],20:[1,14],21:15,22:16,23:[1,17],25:[1,18],26:[1,19],27:[1,20],30:[1,21],33:[1,22],34:[1,23],37:[1,24],39:25,40:26,41:[1,27],43:[1,28],44:[1,29],45:[1,30],46:[1,31],48:[1,32],49:[1,33],50:34,51:35,52:[1,36],54:[1,37],55:[1,38],56:[1,44],58:[1,45],59:[1,39],62:[1,40],64:[1,41],65:[1,42],66:[1,43]},{1:[3]},{5:[1,46]},{1:[2,2]},{5:[2,3]},{5:[2,4],8:[1,47]},{5:[2,6],6:$V0,7:$V1,9:$V2,10:48,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,8]},{5:[2,9]},{6:$V0,7:$V1,9:$V2,10:106,13:$V3,14:[1,107],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{6:$V0,7:$V1,9:$V2,10:108,13:$V3,14:[1,109],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,14]},{5:[2,15]},{5:[2,16]},{5:[2,17],14:$VS,16:110,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,19]},{5:[2,20]},{24:116,35:$VX,38:$VY},{24:119,35:$VX,38:$VY},{24:120,35:$VX,38:$VY},{5:[2,25],24:121,28:[1,122],29:[1,123],35:$VX,38:$VY},{14:[1,124]},{14:[1,125]},{35:[1,126]},{38:[1,127]},{5:[2,33]},{5:[2,34]},{5:[2,35],14:[1,128],42:[1,129]},{5:[2,38],35:[1,130]},{5:[2,40]},{35:[1,131]},{47:132,73:133,74:$VZ},{47:135,73:133,74:$VZ},{5:[2,44],14:[1,136]},{5:[2,46]},{5:[2,47]},{6:$V0,7:$V1,9:$V2,10:138,13:$V3,14:[1,137],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,52]},{35:[1,139]},{14:[1,143],38:[1,141],60:140,61:[1,142]},{5:[2,65],38:[1,144],63:145,67:146,68:147,69:148,70:$V_,72:$V$},{24:151,35:$VX,38:$VY},{38:[1,152]},{38:[1,153]},{5:[2,54],29:[1,154],57:[1,155]},{5:[2,59],35:[1,156]},{1:[2,1]},{5:[2,5]},{5:[2,7],101:$V01},o($V11,[2,159]),o($V11,[2,160]),o($V21,[2,97]),o($V21,[2,98]),o($V11,[2,147]),o($V11,[2,148]),o($V11,[2,149]),o($V11,[2,150]),o($V11,[2,151]),o($V11,[2,152]),o($V11,[2,153]),o($V21,[2,101]),o($V21,[2,102]),o($V21,[2,103]),o($V21,[2,104]),o($V21,[2,105]),o($V21,[2,106]),o($V21,[2,107]),o($V21,[2,108]),o($V21,[2,109]),o($V21,[2,110]),o($V21,[2,111]),o($V21,[2,112]),o($V21,[2,113]),o($V21,[2,114]),o($V21,[2,115]),o($V21,[2,116]),o($V21,[2,117]),o($V21,[2,118]),o($V21,[2,119]),o($V21,[2,120]),o($V21,[2,121]),o($V21,[2,122]),o($V21,[2,123]),o($V21,[2,124]),o($V21,[2,125]),o($V21,[2,126]),o($V21,[2,127]),o($V21,[2,128]),o($V21,[2,129]),o($V21,[2,130]),o($V21,[2,131]),o($V21,[2,132]),o($V21,[2,133]),o($V21,[2,134]),o($V21,[2,135]),o($V21,[2,136]),o($V21,[2,137]),o($V21,[2,138]),o($V21,[2,139]),o($V21,[2,140]),o($V21,[2,141]),o($V21,[2,142]),o($V21,[2,143]),o($V21,[2,144]),o($V21,[2,145]),o($V21,[2,146]),{5:[2,10],101:$V01},{5:[2,11]},{14:$VS,16:158,35:$VT,38:$VU,77:$VV,78:$VW,101:$V01},{14:$VS,16:159,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,18]},o($V31,[2,92]),o($V31,[2,93]),o($V31,[2,94]),o($V31,[2,95]),o($V31,[2,96]),{5:[2,21]},o($V41,[2,75]),o($V41,[2,76]),{5:[2,22]},{5:[2,23]},{5:[2,24]},{5:[2,26]},{5:[2,27]},{5:[2,28],31:[1,160]},{5:[2,30]},{36:[1,161]},{5:[2,32]},{5:[2,36]},{5:[2,37]},{5:[2,39]},{5:[2,41]},{5:[2,42],73:162,74:$VZ},o($V51,[2,86]),{35:[1,163]},{5:[2,43],73:162,74:$VZ},{5:[2,45]},{14:[1,164]},{6:$V0,7:$V1,9:$V2,10:165,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR,101:$V01},{5:[2,53]},{5:[2,62]},{5:[2,63]},{5:[2,64]},{5:[2,164]},{5:[2,66],63:166,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,67]},{5:[2,77],67:167,68:147,69:148,70:$V_,72:$V$},o($V41,[2,81]),o($V41,[2,82],{80:52,53:168,75:169,76:170,79:171,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),{71:[1,172]},{71:[1,173]},{5:[2,69],63:174,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,71],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:175,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,73],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:176,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,55],57:[1,177]},{5:[2,56],29:[1,178]},{5:[2,60],35:[1,179]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,181],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:180,80:52,81:182,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,12]},{5:[2,13]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:183,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{14:[1,186]},o($V51,[2,87]),o($V51,[2,88]),{5:[2,48],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:187,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,49],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:188,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,101:$V01},{5:[2,68]},{5:[2,78],67:189,68:147,69:148,70:$V_,72:$V$},o($V41,[2,83],{80:52,76:170,79:171,75:190,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),o($V31,[2,89]),{71:[1,191],101:[1,192]},o($V61,[2,156]),{14:$VS,16:193,35:$VT,38:$VU,77:$VV,78:$VW},{14:$VS,16:194,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,70]},{5:[2,72],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,74],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,57]},{5:[2,58]},{5:[2,61]},o($V11,[2,161]),o($V11,[2,162]),o($V11,[2,163]),{5:[2,29]},{5:[2,99]},{5:[2,100]},{31:[1,195]},{5:[2,50],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,51],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,79],67:196,68:147,69:148,70:$V_,72:$V$},o($V31,[2,90]),{14:$VS,16:197,35:$VT,38:$VU,77:$VV,78:$VW},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,199],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,79:198,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},o($V41,[2,84]),o($V31,[2,85]),{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:200,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,80]},o($V31,[2,91]),o($V61,[2,157]),o($V61,[2,158]),{5:[2,31]}], - defaultActions: {3:[2,2],4:[2,3],7:[2,8],8:[2,9],11:[2,14],12:[2,15],13:[2,16],15:[2,19],16:[2,20],25:[2,33],26:[2,34],29:[2,40],34:[2,46],35:[2,47],37:[2,52],46:[2,1],47:[2,5],107:[2,11],110:[2,18],116:[2,21],119:[2,22],120:[2,23],121:[2,24],122:[2,26],123:[2,27],125:[2,30],127:[2,32],128:[2,36],129:[2,37],130:[2,39],131:[2,41],136:[2,45],139:[2,53],140:[2,62],141:[2,63],142:[2,64],143:[2,164],145:[2,67],158:[2,12],159:[2,13],166:[2,68],174:[2,70],177:[2,57],178:[2,58],179:[2,61],183:[2,29],184:[2,99],185:[2,100],196:[2,80],200:[2,31]}, - parseError: function parseError (str, hash) { - if (hash.recoverable) { - this.trace(str); - } else { - var error = new Error(str); - error.hash = hash; - throw error; - } - }, - parse: function parse(input) { - var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; - var args = lstack.slice.call(arguments, 1); - var lexer = Object.create(this.lexer); - var sharedState = { yy: {} }; - for (var k in this.yy) { - if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState.yy[k] = this.yy[k]; - } - } - lexer.setInput(input, sharedState.yy); - sharedState.yy.lexer = lexer; - sharedState.yy.parser = this; - if (typeof lexer.yylloc == 'undefined') { - lexer.yylloc = {}; - } - var yyloc = lexer.yylloc; - lstack.push(yyloc); - var ranges = lexer.options && lexer.options.ranges; - if (typeof sharedState.yy.parseError === 'function') { - this.parseError = sharedState.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).parseError; - } - function lex() { - var token; - token = tstack.pop() || lexer.lex() || EOF; - if (typeof token !== 'number') { - if (token instanceof Array) { - tstack = token; - token = tstack.pop(); - } - token = self.symbols_[token] || token; - } - return token; - } - var symbol, state, action, r, yyval = {}, p, len, newState, expected; - while (true) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); - } - action = table[state] && table[state][symbol]; - } - if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr = ''; - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push('\'' + this.terminals_[p] + '\''); - } - } - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); - } - this.parseError(errStr, { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected - }); - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(lexer.yytext); - lstack.push(lexer.yylloc); - stack.push(action[1]); - symbol = null; - { - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - if (ranges) { - yyval._$.range = [ - lstack[lstack.length - (len || 1)].range[0], - lstack[lstack.length - 1].range[1] - ]; - } - r = this.performAction.apply(yyval, [ - yytext, - yyleng, - yylineno, - sharedState.yy, - action[1], - vstack, - lstack - ].concat(args)); - if (typeof r !== 'undefined') { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; - } - } - return true; - }}; - - - /* generated by jison-lex 0.3.4 */ - var lexer = (function(){ - var lexer = ({ - - EOF:1, - - parseError:function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, - - // resets the lexer, sets new input - setInput:function (input, yy) { - this.yy = yy || this.yy || {}; - this._input = input; - this._more = this._backtrack = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - if (this.options.ranges) { - this.yylloc.range = [0,0]; - } - this.offset = 0; - return this; - }, - - // consumes and returns one char from the input - input:function () { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) { - this.yylloc.range[1]++; - } - - this._input = this._input.slice(1); - return ch; - }, - - // unshifts one char (or a string) into the input - unput:function (ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - var r = this.yylloc.range; - - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - this.yyleng = this.yytext.length; - return this; - }, - - // When called from action, caches matched text and appends it on next action - more:function () { - this._more = true; - return this; - }, - - // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. - reject:function () { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - - } - return this; - }, - - // retain first n characters of the match - less:function (n) { - this.unput(this.match.slice(n)); - }, - - // displays already matched input, i.e. for error messages - pastInput:function () { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); - }, - - // displays upcoming input, i.e. for error messages - upcomingInput:function () { - var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20-next.length); - } - return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); - }, - - // displays the character position where the lexing error occurred, i.e. for error messages - showPosition:function () { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; - }, - - // test the lexed token: return FALSE when not a match, otherwise return token - test_match:function(match, indexed_rule) { - var token, - lines, - backup; - - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } - - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; - } - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : - this.yylloc.last_column + match[0].length - }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); - if (this.done && this._input) { - this.done = false; - } - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - return false; // rule action called reject() implying the next rule should be tested instead. - } - return false; - }, - - // return next match in input - next:function () { - if (this.done) { - return this.EOF; - } - if (!this._input) { - this.done = true; - } - - var token, - match, - tempMatch, - index; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); - if (token !== false) { - return token; - } else if (this._backtrack) { - match = false; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - if (match) { - token = this.test_match(match, rules[index]); - if (token !== false) { - return token; - } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - if (this._input === "") { - return this.EOF; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - } - }, - - // return next match that has a token - lex:function lex () { - var r = this.next(); - if (r) { - return r; - } else { - return this.lex(); - } - }, + this._needRender = true; +}; +Miew.prototype._addSceneObject = function (sceneObject) { + const visual = this._getComplexVisual(); + if (sceneObject.build && visual) { + sceneObject.build(visual.getComplex()); + this._gfx.pivot.add(sceneObject.getGeometry()); + } + const objects = this._objects; + objects[objects.length] = sceneObject; +}; +Miew.prototype._updateObjsToFrame = function (frameData) { + const objs = this._objects; + for (let i = 0, n = objs.length; i < n; ++i) { + if (objs[i].updateToFrame) { + objs[i].updateToFrame(frameData); + } + } +}; +Miew.prototype._resetObjects = function () { + const objs = this._opts._objects; + this._objects = []; + if (objs) { + for (let i = 0, n = objs.length; i < n; ++i) { + this.addObject(objs[i], false); + } + } +}; +Miew.prototype.removeObject = function (index) { + const obj = this._objects[index]; + if (!obj) { + throw new Error(`Scene object with index ${index} does not exist`); + } + obj.destroy(); + this._objects.splice(index, 1); + this._needRender = true; +}; + +/** + * Get a string with a URL to reproduce the current scene. + * + * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full + * preset information regardless of the differences with settings + * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included + * @param {boolean} [opts.view=false] - when this flag is true, a view information is included + * @returns {string} URL + */ +Miew.prototype.getURL = function (opts) { + return options.toURL(this.getState(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().defaults(opts, { + compact: true, + settings: false, + view: false + }))); +}; + +/** + * Get a string with a script to reproduce the current scene. + * + * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full + * preset information regardless of the differences with settings + * @param {boolean} [opts.settings=true] - when this flag is true, changes in settings are included + * @param {boolean} [opts.view=true] - when this flag is true, a view information is included + * @returns {string} script + */ +Miew.prototype.getScript = function (opts) { + return options.toScript(this.getState(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().defaults(opts, { + compact: true, + settings: true, + view: true + }))); +}; + +/* + * Generates object that represents the current state of representations list + * @param {boolean} compareWithDefaults - when this flag is true, reps list is compared (if possible) + * to preset's defaults and only diffs are generated + */ +Miew.prototype._compareReps = function (complexVisual, compareWithDefaults) { + const ans = {}; + let repCount = 0; + if (complexVisual) { + repCount = complexVisual.repCount(); + } + const currPreset = settings.defaults.presets[settings.now.preset]; + let compare = compareWithDefaults; + if (currPreset === undefined || currPreset.length > repCount) { + compare = false; + ans.preset = 'empty'; + } else if (settings.now.preset !== settings.defaults.preset) { + ans.preset = settings.now.preset; + } + const repsDiff = []; + let emptyReps = true; + for (let i = 0, n = repCount; i < n; ++i) { + repsDiff[i] = complexVisual.repGet(i).compare(compare ? currPreset[i] : null); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(repsDiff[i])) { + emptyReps = false; + } + } + if (!emptyReps) { + ans.reps = repsDiff; + } + return ans; +}; - // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) - begin:function begin (condition) { - this.conditionStack.push(condition); - }, +/* + * Obtain object that represents current state of miew (might be used as options in constructor). + * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full + * preset information regardless of the differences with settings + * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included + * @param {boolean} [opts.view=false] - when this flag is true, a view information is included + * @returns {Object} State object. + */ +Miew.prototype.getState = function (opts) { + const state = {}; + opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().defaults(opts, { + compact: true, + settings: false, + view: false + }); - // pop the previously active lexer condition state off the condition stack - popState:function popState () { - var n = this.conditionStack.length - 1; - if (n > 0) { - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } - }, + // load + const visual = this._getComplexVisual(); + if (visual !== null) { + const complex = visual.getComplex(); + const { + metadata + } = complex; + if (metadata.id) { + const format = metadata.format ? `${metadata.format}:` : ''; + state.load = format + metadata.id; + } + const unit = complex.getCurrentUnit(); + if (unit !== 1) { + state.unit = unit; + } + } - // produce the lexer rule set which is active for the currently active lexer condition state - _currentRules:function _currentRules () { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions["INITIAL"].rules; - } - }, + // representations + const repsInfo = this._compareReps(visual, opts.compact); + if (repsInfo.preset) { + state.preset = repsInfo.preset; + } + if (repsInfo.reps) { + state.reps = repsInfo.reps; + } - // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available - topState:function topState (n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { - return this.conditionStack[n]; - } else { - return "INITIAL"; - } - }, + // objects + const objects = this._objects; + const objectsState = []; + for (let i = 0, n = objects.length; i < n; ++i) { + objectsState[i] = objects[i].identify(); + } + if (objects.length > 0) { + state._objects = objectsState; + } - // alias for begin(condition) - pushState:function pushState (condition) { - this.begin(condition); - }, + // view + if (opts.view) { + state.view = this.view(); + } - // return the number of states currently on the stack - stateStackSize:function stateStackSize() { - return this.conditionStack.length; - }, - options: {"case-insensitive":true}, - performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { - switch($avoiding_name_collisions) { - case 0:/* ignore whitespace */ - break; - case 1:return ''; - case 2:return ''; - case 3:return 42; - case 4:return 35; - case 5:return 77; - case 6:return 78; - case 7:return 78; - case 8:return 8; - case 9:return 6; - case 10:return 82; - case 11:return 7; - case 12:return 9; - case 13:return 59; - case 14:return 13 - case 15:return 15 - case 16:return 17 - case 17:return 18 - case 18:return 19 - case 19:return 20 - case 20:return 11 - case 21:return 62 - case 22:return 64 - case 23:return 23 - case 24:return 25 - case 25:return 26 - case 26:return 27 - case 27:return 30 - case 28:return 34 - case 29:return 33 - case 30:return 65 - case 31:return 66 - case 32:return 37 - case 33:return 41 - case 34:return 43 - case 35:return 52 - case 36:return 54 - case 37:return 55 - case 38:return 46 - case 39:return 48 - case 40:return 45 - case 41:return 49 - case 42:return 56 - case 43:return 58; - case 44:return 44 - case 45:return 83 - case 46:return 84 - case 47:return 85 - case 48:return 86 - case 49:return 87 - case 50:return 88 - case 51:return 89 - case 52:return 90 - case 53:return 91 - case 54:return 92 - case 55:return 93 - case 56:return 94 - case 57:return 95 - case 58:return 70 - case 59:return 70 - case 60:return 72 - case 61:return 72 - case 62:return 74 - case 63:return 74 - case 64:return 74 - case 65:return 31 - case 66:return 36 - case 67:return 96 - case 68:return 97 - case 69:return 98 - case 70:return 99 - case 71:yy_.yytext = yy.utils.unquoteString(yy_.yytext); return 14; - case 72:return 38; - case 73:return 5; - case 74:return 101; - case 75:return 103; - case 76:return '\\'; - case 77:return 28 - case 78:return 61 - case 79:return 29 - case 80:return 57 - case 81:return 71 + // settings + if (opts.settings) { + const diff = this.settings.getDiffs(false); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isEmpty(diff)) { + state.settings = diff; + } } - }, - rules: [/^(?:\s+)/i,/^(?:[#].*)/i,/^(?:\/\/.*)/i,/^(?:([_A-Z0-9\/\+]+==))/i,/^(?:-?[0-9]+(\.[0-9]+)?\b)/i,/^(?:0[xX][0-9A-F]+\b)/i,/^(?:false\b)/i,/^(?:true\b)/i,/^(?:all\b)/i,/^(?:reset\b)/i,/^(?:clear\b)/i,/^(?:build\b)/i,/^(?:help\b)/i,/^(?:load\b)/i,/^(?:get\b)/i,/^(?:set\b)/i,/^(?:set_save\b)/i,/^(?:set_restore\b)/i,/^(?:set_reset\b)/i,/^(?:preset\b)/i,/^(?:motm\b)/i,/^(?:add\b)/i,/^(?:rep\b)/i,/^(?:remove\b)/i,/^(?:hide\b)/i,/^(?:show\b)/i,/^(?:list\b)/i,/^(?:select\b)/i,/^(?:within\b)/i,/^(?:selector\b)/i,/^(?:mode\b)/i,/^(?:color\b)/i,/^(?:material\b)/i,/^(?:view\b)/i,/^(?:unit\b)/i,/^(?:line\b)/i,/^(?:listobj\b)/i,/^(?:removeobj\b)/i,/^(?:rotate\b)/i,/^(?:translate\b)/i,/^(?:scale\b)/i,/^(?:center\b)/i,/^(?:url\b)/i,/^(?:screenshot\b)/i,/^(?:dssp\b)/i,/^(?:file_list\b)/i,/^(?:file_register\b)/i,/^(?:file_delete\b)/i,/^(?:preset_add\b)/i,/^(?:preset_delete\b)/i,/^(?:preset_update\b)/i,/^(?:preset_rename\b)/i,/^(?:preset_open\b)/i,/^(?:create_scenario\b)/i,/^(?:reset_scenario\b)/i,/^(?:delete_scenario\b)/i,/^(?:add_scenario_item\b)/i,/^(?:list_scenario\b)/i,/^(?:s\b)/i,/^(?:mt\b)/i,/^(?:m\b)/i,/^(?:c\b)/i,/^(?:x\b)/i,/^(?:y\b)/i,/^(?:z\b)/i,/^(?:as\b)/i,/^(?:of\b)/i,/^(?:pdb\b)/i,/^(?:delay\b)/i,/^(?:prst\b)/i,/^(?:desc\b)/i,/^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:\.)/i,/^(?:\/)/i,/^(?:\\)/i,/^(?:-e\b)/i,/^(?:-f\b)/i,/^(?:-s\b)/i,/^(?:-v\b)/i,/^(?:=)/i], - conditions: {"INITIAL":{"rules":[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,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],"inclusive":true}} + return state; +}; + +/** + * Get parameter value. + * @param {string} param - Parameter name or path (e.g. 'modes.BS.atom'). + * @param {*=} value - Default value. + * @returns {*} Parameter value. + */ +Miew.prototype.get = function (param, value) { + return settings.get(param, value); +}; +Miew.prototype._clipPlaneUpdateValue = function (radius) { + const clipPlaneValue = Math.max(this._gfx.camera.position.z - radius * settings.now.draft.clipPlaneFactor, settings.now.camNear); + const opts = { + clipPlaneValue + }; + this._forEachComplexVisual(visual => { + visual.setUberOptions(opts); }); - return lexer; - })(); - parser.lexer = lexer; - function Parser () { - this.yy = {}; + for (let i = 0, n = this._objects.length; i < n; ++i) { + const obj = this._objects[i]; + if (obj._line) { + obj._line.material.setUberOptions(opts); + } } - Parser.prototype = parser;parser.Parser = Parser; - return new Parser; - })(); - - var MiewCLIParser = {parser: parser$1}; - var MiewCLIParser_1 = MiewCLIParser.parser; - - var modeIdDesc = { - $help: ['Rendering mode shortcut', ' BS - balls and sticks mode', ' LN - lines mode', ' LC - licorice mode', ' VW - van der waals mode', ' TR - trace mode', ' TU - tube mode', ' CA - cartoon mode', ' SA - isosurface mode', ' QS - quick surface mode', ' SE - solvent excluded mode', ' TX - text mode'], - BS: { - $help: [' Balls and sticks', ' aromrad = #aromatic radius', ' atom = #atom radius', ' bond = #bond radius', ' multibond = #use multibond', ' showarom = #show aromatic', ' space = #space value\n'] - }, - CA: { - $help: [' Cartoon', ' arrow = #arrow size', ' depth = #depth of surface', ' heightSegmentsRatio = ', ' radius = #tube radius', ' tension = #', ' width = #secondary width\n'] - }, - LN: { - $help: [' Lines', ' atom = #atom radius', ' chunkarom = ', ' multibond = #use multibond', ' showarom = #show aromatic', ' offsarom = \n'] - }, - LC: { - $help: [' Licorice', ' aromrad = #aromatic radius', ' bond = #bond radius', ' multibond = #use multibond', ' showarom = #show aromatic', ' space = #space value\n'] - }, - VW: { - $help: [' Van der Waals', ' nothing\n'] - }, - TR: { - $help: [' Trace', ' radius = #tube radius\n'] - }, - TU: { - $help: [' Tube', ' heightSegmentsRatio = ', ' radius = #tube radius', ' tension = \n'] - }, - SA: { - $help: [' Surface', ' zClip = #clip z plane\n'] - }, - QS: { - $help: [' Quick surface', ' isoValue = ', ' scale = ', ' wireframe = ', ' zClip = #clip z plane\n'] - }, - SE: { - $help: [' Solvent excluded surface', ' zClip = #clip z plane\n'] - }, - TX: { - $help: [' Text mode', ' template = string that can include "{{ id }}"', ' it will be replaced by value, id can be one of next:', ' serial, name, type, sequence, residue, chain, hetatm, water\n', ' horizontalAlign = {"left", "right", "center"}', ' verticalAlign = {"top", "bottom", "middle"}', ' dx = #offset along x', ' dy = #offset along y', ' dz = #offset along z', ' fg = #text color modificator', ' could be keyword, named color or hex', ' fg = #back color modificator', ' could be keyword, named color or hex', ' showBg = #if set show background', ' plate under text'] + if (this._picker !== null) { + this._picker.clipPlaneValue = clipPlaneValue; + } +}; +Miew.prototype._fogFarUpdateValue = function () { + if (this._picker !== null) { + if (this._gfx.scene.fog) { + this._picker.fogFarValue = this._gfx.scene.fog.far; + } else { + this._picker.fogFarValue = undefined; } - }; - var colorDesc = { - $help: ['Coloring mode shortcut', ' EL - color by element', ' CH - color by chain', ' SQ - color by sequence', ' RT - color by residue type', ' SS - color by secondary structure', ' UN - uniform'], - UN: { - $help: ['Parameters of coloring modes customization', ' Uniform', ' color = #RGB->HEX->dec\n'], - color: { - $help: Object.keys(palettes.get(settings.now.palette).namedColors).sort().join('\n') - } + } +}; +Miew.prototype._updateShadowmapMeshes = function (process) { + this._forEachComplexVisual(visual => { + const reprList = visual._reprList; + for (let i = 0, n = reprList.length; i < n; ++i) { + const repr = reprList[i]; + process(repr.geo, repr.material); } + }); +}; +Miew.prototype._updateMaterials = function (values) { + let needTraverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + let process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + this._forEachComplexVisual(visual => visual.setMaterialValues(values, needTraverse, process)); + for (let i = 0, n = this._objects.length; i < n; ++i) { + const obj = this._objects[i]; + if (obj._line) { + obj._line.material.setValues(values); + obj._line.material.needsUpdate = true; + } + } +}; +Miew.prototype._fogAlphaChanged = function () { + this._forEachComplexVisual(visual => { + visual.setUberOptions({ + fogAlpha: settings.now.fogAlpha + }); + }); +}; +Miew.prototype._embedWebXR = function () { + // switch off + if (settings.now.stereo !== 'WEBVR') { + if (this.webVR) { + this.webVR.disable(); + } + this.webVR = null; + return; + } + // switch on + if (!this.webVR) { + this.webVR = new WebVRPoC(() => { + this._requestAnimationFrame(() => this._onTick()); + this._needRender = true; + this._onResize(); + }); + } + this.webVR.enable(this._gfx); +}; +Miew.prototype._initOnSettingsChanged = function () { + const on = (props, func) => { + props = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isArray(props) ? props : [props]; + props.forEach(prop => { + this.settings.addEventListener(`change:${prop}`, func); + }); }; - var materialDesc = { - $help: ['Material shortcut', ' DF - diffuse', ' TR - transparent', ' SF - soft plastic', ' PL - glossy plastic', ' ME - metal', ' GL - glass'] - }; - var addRepDesc = { - $help: ['Short (packed) representation description as a set of variables', ' s=', ' selector property', ' m=[!:[,...]]', ' render mode property', ' c=[!:[,...]]', ' color mode property', ' mt=', ' material property'], - s: { - $help: 'Selection expression string as it is in menu->representations->selection' - }, - m: modeIdDesc, - c: colorDesc, - mt: materialDesc - }; - var setGetParameterDesc = { - $help: ['Parameters of rendering modes customization: modes', 'Parameters of colorer customization: colorers', 'Autobuild: autobuild = (|)'], - modes: modeIdDesc, - colorers: colorDesc - }; - var help = { - $help: ['help (| )', 'You can get detailed information about command options', ' using "help cmd.opt.opt.[...]"\n', ' you can use one line comments', ' everything started from (#|//) will be skipped', ' Example: >build //some comment\n', 'List of available commands:'], - reset: { - $help: ['Reload current object, delete all representations', ' Nothing will work until load new object'] - }, - load: { - $help: ['load (||-f [<*.NC FILE URL STRING>])', ' Load new pdb object from selected source'], - PDBID: { - $help: 'pdb id in remote molecule database' - }, - URL: { - $help: 'url to source file' - }, - f: { - $help: ['open file system dialog to fetch local file', 'optionally you can determine trajectory file', 'via URL for *.top model'] + on('modes.VD.frame', () => { + const volume = this._getVolumeVisual(); + if (volume === null) return; + volume.showFrame(settings.now.modes.VD.frame); + this._needRender = true; + }); + on('modes.VD.isoMode', () => { + const volume = this._getVolumeVisual(); + if (volume === null) return; + volume.getMesh().material.updateDefines(); + this._needRender = true; + }); + on('bg.color', () => { + this._onBgColorChanged(); + }); + on('ao', () => { + if (settings.now.ao && !isAOSupported(this._gfx.renderer.getContext())) { + this.logger.warn('Your device or browser does not support ao'); + settings.set('ao', false); + } else { + const values = { + normalsToGBuffer: settings.now.ao + }; + this._setUberMaterialValues(values); + } + }); + on('zSprites', () => { + if (settings.now.zSprites && !arezSpritesSupported(this._gfx.renderer.getContext())) { + this.logger.warn('Your device or browser does not support zSprites'); + settings.set('zSprites', false); + } + this.rebuildAll(); + }); + on('fogColor', () => { + this._onFogColorChanged(); + }); + on('fogColorEnable', () => { + this._onFogColorChanged(); + }); + on('bg.transparent', evt => { + const gfx = this._gfx; + if (gfx) { + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + } + // update materials + this._updateMaterials({ + fogTransparent: evt.value + }); + this.rebuildAll(); + }); + on('draft.clipPlane', evt => { + // update materials + this._updateMaterials({ + clipPlane: evt.value + }); + this.rebuildAll(); + }); + on('shadow.on', evt => { + // update materials + const values = { + shadowmap: evt.value, + shadowmapType: settings.now.shadow.type + }; + const gfx = this._gfx; + if (gfx) { + gfx.renderer.shadowMap.enabled = Boolean(values.shadowmap); + } + this._updateMaterials(values, true); + if (values.shadowmap) { + this._updateShadowCamera(); + this._updateShadowmapMeshes(meshutils.createShadowmapMaterial); + } else { + this._updateShadowmapMeshes(meshutils.removeShadowmapMaterial); + } + this._needRender = true; + }); + on('shadow.type', evt => { + // update materials if shadowmap is enable + if (settings.now.shadow.on) { + this._updateMaterials({ + shadowmapType: evt.value + }, true); + this._needRender = true; + } + }); + on('shadow.radius', evt => { + for (let i = 0; i < this._gfx.scene.children.length; i++) { + if (this._gfx.scene.children[i].shadow !== undefined) { + const light = this._gfx.scene.children[i]; + light.shadow.radius = evt.value; + this._needRender = true; } - }, - clear: { - $help: 'No args. Clear terminal' - }, - add: { - $help: ['add [] []', ' Add new item to representation set with', ' default or params'], - REP_NAME: { - $help: 'Identifier string [_,a-z,A-Z,0-9] can not start from digit' - }, - DESCRIPTION: addRepDesc - }, - rep: { - $help: ['rep [|] []', ' set current representation by name or index', ' edit current representation by '], - REP_NAME: { - $help: ['Identifier string [_,a-z,A-Z,0-9] can not start from digit', 'Must be declared before'] - }, - REP_INDEX: { - $help: 'Index of available representation' - }, - DESCRIPTION: addRepDesc - }, - remove: { - $help: ['remove (|)', 'Remove representation by name or index'], - REP_NAME: { - $help: ['Identifier string [_,a-z,A-Z,0-9] can not start from digit', 'Must be declared before'] - }, - REP_INDEX: { - $help: 'Index of available representation' + } + }); + on('fps', () => { + this._fps.show(settings.now.fps); + }); + on(['fog', 'fogNearFactor', 'fogFarFactor'], () => { + this._updateFog(); + this._needRender = true; + }); + on('fogAlpha', () => { + const { + fogAlpha + } = settings.now; + if (fogAlpha < 0 || fogAlpha > 1) { + this.logger.warn('fogAlpha must belong range [0,1]'); + } + this._fogAlphaChanged(); + this._needRender = true; + }); + on('autoResolution', evt => { + if (evt.value && !this._gfxScore) { + this.logger.warn('Benchmarks are missed, autoresolution will not work! ' + 'Autoresolution should be set during miew startup.'); + } + }); + on('stereo', () => { + this._embedWebXR(settings.now.stereo === 'WEBVR'); + this._needRender = true; + }); + on(['transparency', 'palette'], () => { + this.rebuildAll(); + }); + on('resolution', () => { + // update complex visuals + this.rebuildAll(); + + // update volume visual + const volume = this._getVolumeVisual(); + if (volume) { + volume.getMesh().material.updateDefines(); + this._needRender = true; + } + }); + on(['axes', 'fxaa', 'ao', 'outline.on', 'outline.color', 'outline.threshold', 'outline.thickness'], () => { + this._needRender = true; + }); +}; + +/** + * Set parameter value. + * @param {string|object} params - Parameter name or path (e.g. 'modes.BS.atom') or even settings object. + * @param {*=} value - Value. + */ +Miew.prototype.set = function (params, value) { + settings.set(params, value); +}; + +/** + * Select atoms with selection string. + * @param {string} expression - string expression of selection + * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection + */ +Miew.prototype.select = function (expression, append) { + const visual = this._getComplexVisual(); + if (!visual) { + return; + } + let sel = expression; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isString(expression)) { + sel = Miew_selectors.parse(expression).selector; + } + visual.select(sel, append); + this._lastPick = null; + this._updateInfoPanel(); + this._needRender = true; +}; +const VIEW_VERSION = '1'; + +/** + * Get or set view info packed into string. + * + * **Note:** view is stored for *left-handed* cs, euler angles are stored in radians and *ZXY-order*, + * + * @param {string=} expression - Optional string encoded the view + */ +Miew.prototype.view = function (expression) { + const self = this; + const { + pivot + } = this._gfx; + let transform = []; + const eulerOrder = 'ZXY'; + function encode() { + const pos = pivot.position; + const scale = self._objectControls.getScale() / settings.now.radiusToFit; + const euler = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Euler(); + euler.setFromQuaternion(self._objectControls.getOrientation(), eulerOrder); + transform = [pos.x, pos.y, pos.z, scale, euler.x, euler.y, euler.z]; + return VIEW_VERSION + utils.arrayToBase64(transform, Float32Array); + } + function decode() { + // backwards compatible: old non-versioned view is the 0th version + if (expression.length === 40) { + expression = `0${expression}`; + } + const version = expression[0]; + transform = utils.arrayFromBase64(expression.substr(1), Float32Array); + + // apply adapter for old versions + if (version !== VIEW_VERSION) { + if (version === '0') { + // cancel radiusToFit included in old views + transform[3] /= 8.0; + } else { + // do nothing + self.logger.warn(`Encoded view version mismatch, stored as ${version} vs ${VIEW_VERSION} expected`); + return; } - }, - selector: { - $help: ['selector ', ' set selector from EXPRESSION to current representation'], - EXPRESSION: { - $help: 'Selection expression string as it is in menu->representations->selection' + } + const interpolator = self._interpolator; + const srcView = interpolator.createView(); + srcView.position.copy(pivot.position); + srcView.scale = self._objectControls.getScale(); + srcView.orientation.copy(self._objectControls.getOrientation()); + const dstView = interpolator.createView(); + dstView.position.set(transform[0], transform[1], transform[2]); + + // hack to make preset views work after we moved centering offset to visual nodes + // FIXME should only store main pivot offset in preset + if (self._getComplexVisual()) { + dstView.position.sub(self._getComplexVisual().position); + } + dstView.scale = transform[3]; // eslint-disable-line prefer-destructuring + dstView.orientation.setFromEuler(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Euler(transform[4], transform[5], transform[6], eulerOrder)); + interpolator.setup(srcView, dstView); + } + if (typeof expression === 'undefined') { + return encode(); + } + decode(); + return expression; +}; + +/* + * Update current view due to viewinterpolator state + */ +Miew.prototype._updateView = function () { + const self = this; + const { + pivot + } = this._gfx; + const interpolator = this._interpolator; + if (!interpolator.wasStarted()) { + interpolator.start(); + } + if (!interpolator.isMoving()) { + return; + } + const res = interpolator.getCurrentView(); + if (res.success) { + const curr = res.view; + pivot.position.copy(curr.position); + self._objectControls.setScale(curr.scale * settings.now.radiusToFit); + self._objectControls.setOrientation(curr.orientation); + this.dispatchEvent({ + type: 'transform' + }); + self._needRender = true; + } +}; + +/** + * Translate object by vector + * @param {number} x - translation value (Ang) along model's X axis + * @param {number} y - translation value (Ang) along model's Y axis + * @param {number} z - translation value (Ang) along model's Z axis + */ +Miew.prototype.translate = function (x, y, z) { + this._objectControls.translatePivot(x, y, z); + this.dispatchEvent({ + type: 'transform' + }); + this._needRender = true; +}; + +/** + * Rotate object by Euler angles + * @param {number} x - rotation angle around X axis in radians + * @param {number} y - rotation angle around Y axis in radians + * @param {number} z - rotation angle around Z axis in radians + */ +Miew.prototype.rotate = function (x, y, z) { + this._objectControls.rotate(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Quaternion().setFromEuler(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Euler(x, y, z, 'XYZ'))); + this.dispatchEvent({ + type: 'transform' + }); + this._needRender = true; +}; + +/** + * Scale object by factor + * @param {number} factor - scale multiplier, should greater than zero + */ +Miew.prototype.scale = function (factor) { + if (factor <= 0) { + throw new RangeError('Scale should be greater than zero'); + } + this._objectControls.scale(factor); + this.dispatchEvent({ + type: 'transform' + }); + this._needRender = true; +}; + +/** + * Center view on selection + * @param {empty | subset | string} selector - defines part of molecule which must be centered ( + * empty - center on current selection; + * subset - center on picked atom/residue/molecule; + * string - center on atoms correspond to selection string) + */ +Miew.prototype.center = function (selector) { + // no arguments - center on current selection; + if (selector === undefined) { + this.setPivotSubset(); + this._needRender = true; + return; + } + // subset with atom or residue - center on picked atom/residue; + if (selector.obj !== undefined && ('atom' in selector.obj || 'residue' in selector.obj)) { + // from event with selection + if ('atom' in selector.obj) { + this.setPivotAtom(selector.obj.atom); + } else { + this.setPivotResidue(selector.obj.residue); + } + this._needRender = true; + return; + } + // string - center on atoms correspond to selection string + if (selector.obj === undefined && selector !== '') { + const sel = Miew_selectors.parse(selector); + if (sel.error === undefined) { + this.setPivotSubset(sel); + this._needRender = true; + return; + } + } + // empty subset or incorrect/empty string - center on all molecule; + this.resetPivot(); + this._needRender = true; +}; + +/** + * Build selector that contains all atoms within given distance from group of atoms + * @param {Selector} selector - selector describing source group of atoms + * @param {number} radius - distance + * @returns {Selector} selector describing result group of atoms + */ +Miew.prototype.within = function (selector, radius) { + const visual = this._getComplexVisual(); + if (!visual) { + return Miew_selectors.None(); + } + if (selector instanceof String) { + selector = Miew_selectors.parse(selector); + } + const res = visual.within(selector, radius); + if (res) { + visual.rebuildSelectionGeometry(); + this._needRender = true; + } + return res; +}; + +/** + * Get atom position in 2D canvas coords + * @param {string} fullAtomName - full atom name, like A.38.CG + * @returns {Object} {x, y} or false if atom not found + */ +Miew.prototype.projected = function (fullAtomName, complexName) { + const visual = this._getComplexVisual(complexName); + if (!visual) { + return false; + } + const atom = visual.getComplex().getAtomByFullname(fullAtomName); + if (atom === null) { + return false; + } + const pos = atom.position.clone(); + // we consider atom position to be affected only by common complex transform + // ignoring any transformations that may add during editing + this._gfx.pivot.updateMatrixWorldRecursive(); + this._gfx.camera.updateMatrixWorldRecursive(); + this._gfx.pivot.localToWorld(pos); + pos.project(this._gfx.camera); + return { + x: (pos.x + 1.0) * 0.5 * this._gfx.width, + y: (1.0 - pos.y) * 0.5 * this._gfx.height + }; +}; + +/** + * Replace secondary structure with calculated one. + * + * DSSP algorithm implementation is used. + * + * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and + * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211. + * + * @param {string=} complexName - complex name + */ +Miew.prototype.dssp = function (complexName) { + const visual = this._getComplexVisual(complexName); + if (!visual) { + return; + } + visual.getComplex().dssp(); + + // rebuild dependent representations (cartoon or ss-colored) + visual._reprList.forEach(rep => { + if (rep.mode.id === 'CA' || rep.colorer.id === 'SS') { + rep.needsRebuild = true; + } + }); +}; +Miew.prototype.exportCML = function () { + const self = this; + function extractRotation(m) { + const xAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const yAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + const zAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector3(); + m.extractBasis(xAxis, yAxis, zAxis); + xAxis.normalize(); + yAxis.normalize(); + zAxis.normalize(); + const retMat = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Matrix4(); + retMat.identity(); + retMat.makeBasis(xAxis, yAxis, zAxis); + return retMat; + } + function updateCMLData(complex) { + const { + root + } = self._gfx; + const mat = extractRotation(root.matrixWorld); + const v4 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector4(0, 0, 0, 0); + const vCenter = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_.Vector4(0, 0, 0, 0); + let xml = null; + let ap = null; + + // update atoms in cml + complex.forEachAtom(atom => { + if (atom.xmlNodeRef && atom.xmlNodeRef.xmlNode) { + xml = atom.xmlNodeRef.xmlNode; + ap = atom.position; + v4.set(ap.x, ap.y, ap.z, 1.0); + v4.applyMatrix4(mat); + xml.setAttribute('x3', v4.x.toString()); + xml.setAttribute('y3', v4.y.toString()); + xml.setAttribute('z3', v4.z.toString()); + xml.removeAttribute('x2'); + xml.removeAttribute('y2'); } - }, - mode: { - $help: ['mode [=...]', ' set rendering mode and apply parameters to current representation'], - MODE_ID: modeIdDesc - }, - color: { - $help: ['color [=...]', ' set colorer and apply parameters to current representation'], - COLORER_ID: colorDesc - }, - material: { - $help: ['material ', ' set material to current representation'], - MATERIAL_ID: materialDesc - }, - build: { - $help: 'build help str', - add: { - $help: 'build.add', - "new": { - $help: ['add.new', 'add.new new line 1', 'add.new new line 2', 'add.new new line 3'] + }); + // update stereo groups in cml + complex.forEachSGroup(sGroup => { + if (sGroup.xmlNodeRef && sGroup.xmlNodeRef.xmlNode) { + xml = sGroup.xmlNodeRef.xmlNode; + ap = sGroup.getPosition(); + v4.set(ap.x, ap.y, ap.z, 1.0); + const cp = sGroup.getCentralPoint(); + if (cp === null) { + v4.applyMatrix4(mat); + } else { + vCenter.set(cp.x, cp.y, cp.z, 0.0); + v4.add(vCenter); + v4.applyMatrix4(mat); // pos in global space + vCenter.set(cp.x, cp.y, cp.z, 1.0); + vCenter.applyMatrix4(mat); + v4.sub(vCenter); } - }, - del: { - $help: 'build.del' - } - }, - list: { - $help: ['list [-e|-s||]', 'Print representations if no args print list of representations', ' -e expand list and show all representations', ' -s show all user-registered selectors', ' | show only current representation'] - }, - hide: { - $help: ['hide (|)', 'Hide representation referenced in args'] - }, - show: { - $help: ['show (|)', 'Show representation referenced in args'] - }, - get: { - $help: ['get ', 'Print value', ' - path to option use get.PARAMETER to get more info'], - PARAMETER: setGetParameterDesc - }, - set: { - $help: ['set ', 'Set with ', ' - path to option use set.PARAMETER to get more info'], - PARAMETER: setGetParameterDesc - }, - set_save: { - $help: ['set_save', 'Save current settings to cookie'] - }, - set_restore: { - $help: ['set_restore', 'Load and apply settings from cookie'] - }, - set_reset: { - $help: ['set_reset', 'Reset current settings to the defaults'] - }, - preset: { - $help: ['preset []', 'Reset current representation or set preset to '], - PRESET: { - $help: ['default', 'wire', 'small', 'macro'] - } - }, - unit: { - $help: ['unit []', 'Change current biological structure view. Zero value means asymmetric unit,', 'positive values set an assembly with corresponding number.', 'Being called with no parameters command prints current unit information.'] - }, - view: { - $help: ['view []', 'Get current encoded view or set if ENCODED_VIEW placed as argument'], - ENCODED_VIEW: { - $help: ['encoded view matrix string (binary code)'] + xml.setAttribute('x', v4.x.toString()); + xml.setAttribute('y', v4.y.toString()); + xml.setAttribute('z', v4.z.toString()); } + }); + } + const visual = self._getComplexVisual(); + const complex = visual ? visual.getComplex() : null; + if (complex && complex.originalCML) { + updateCMLData(complex); + + // serialize xml structure to string + const oSerializer = new XMLSerializer(); + return oSerializer.serializeToString(complex.originalCML); + } + return null; +}; + +/** + * Reproduce the RCSB PDB Molecule of the Month style by David S. Goodsell + * + * @see http://pdb101.rcsb.org/motm/motm-about + */ +Miew.prototype.motm = function () { + settings.set({ + fogColorEnable: true, + fogColor: 0x000000, + outline: { + on: true, + threshold: 0.01 }, - rotate: { - $help: ['rotate (x|y|z) [] [(x|y|z) []]...', 'Rotate scene'] - }, - scale: { - $help: ['scale ', 'Scale scene'] + bg: { + color: 0xffffff + } + }); + this._forEachComplexVisual(visual => { + const rep = []; + const complex = visual.getComplex(); + const palette = gfx_palettes.get(settings.now.palette); + for (let i = 0; i < complex.getChainCount(); i++) { + const curChainName = complex._chains[i]._name; + const curChainColor = palette.getChainColor(curChainName); + rep[i] = { + selector: `chain ${curChainName}`, + mode: 'VW', + colorer: ['CB', { + color: curChainColor, + factor: 0.9 + }], + material: 'FL' + }; + } + visual.resetReps(rep); + }); +}; +Miew.prototype.VERSION = true && "0.11.0-0" || 0; + +// Uncomment this to get debug trace: +// Miew.prototype.debugTracer = new utils.DebugTracer(Miew.prototype); + +external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().assign(Miew, /** @lends Miew */{ + VERSION: Miew.prototype.VERSION, + registeredPlugins: [], + // export namespaces // TODO: WIP: refactoring external interface + chem: chem, + io: io, + modes: gfx_modes, + colorers: gfx_colorers, + materials: gfx_materials, + palettes: gfx_palettes, + options: options, + settings: settings, + utils: utils, + gfx: { + Representation: gfx_Representation + }, + /** + * Third-party libraries packaged together with Miew. + * + * @property {object} lodash - [Lodash](https://lodash.com/), a modern JavaScript utility library delivering + * modularity, performance & extras. + * @property {object} three - [three.js](https://threejs.org/), JavaScript 3D library. + * + * @example + * var _ = Miew.thirdParty.lodash; + * var opts = _.merge({ ... }, Miew.options.fromURL(window.location.search)); + * var miew = new Miew(opts); + */ + thirdParty: { + lodash: (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default()), + three: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_ + } +}); +/* harmony default export */ const src_Miew = (Miew); +// EXTERNAL MODULE: ./src/utils/MiewCLIParser.js +var MiewCLIParser = __webpack_require__(89); +;// CONCATENATED MODULE: ./src/utils/MiewCLIHelp.js + + +const modeIdDesc = { + $help: ['Rendering mode shortcut', ' BS - balls and sticks mode', ' LN - lines mode', ' LC - licorice mode', ' VW - van der waals mode', ' TR - trace mode', ' TU - tube mode', ' CA - cartoon mode', ' SA - isosurface mode', ' QS - quick surface mode', ' SE - solvent excluded mode', ' TX - text mode'], + BS: { + $help: [' Balls and sticks', ' aromrad = #aromatic radius', ' atom = #atom radius', ' bond = #bond radius', ' multibond = #use multibond', ' showarom = #show aromatic', ' space = #space value\n'] + }, + CA: { + $help: [' Cartoon', ' arrow = #arrow size', ' depth = #depth of surface', ' heightSegmentsRatio = ', ' radius = #tube radius', ' tension = #', ' width = #secondary width\n'] + }, + LN: { + $help: [' Lines', ' atom = #atom radius', ' chunkarom = ', ' multibond = #use multibond', ' showarom = #show aromatic', ' offsarom = \n'] + }, + LC: { + $help: [' Licorice', ' aromrad = #aromatic radius', ' bond = #bond radius', ' multibond = #use multibond', ' showarom = #show aromatic', ' space = #space value\n'] + }, + VW: { + $help: [' Van der Waals', ' nothing\n'] + }, + TR: { + $help: [' Trace', ' radius = #tube radius\n'] + }, + TU: { + $help: [' Tube', ' heightSegmentsRatio = ', ' radius = #tube radius', ' tension = \n'] + }, + SA: { + $help: [' Surface', ' zClip = #clip z plane\n'] + }, + QS: { + $help: [' Quick surface', ' isoValue = ', ' scale = ', ' wireframe = ', ' zClip = #clip z plane\n'] + }, + SE: { + $help: [' Solvent excluded surface', ' zClip = #clip z plane\n'] + }, + TX: { + $help: [' Text mode', ' template = string that can include "{{ id }}"', ' it will be replaced by value, id can be one of next:', ' serial, name, type, sequence, residue, chain, hetatm, water\n', ' horizontalAlign = {"left", "right", "center"}', ' verticalAlign = {"top", "bottom", "middle"}', ' dx = #offset along x', ' dy = #offset along y', ' dz = #offset along z', ' fg = #text color modificator', ' could be keyword, named color or hex', ' fg = #back color modificator', ' could be keyword, named color or hex', ' showBg = #if set show background', ' plate under text'] + } +}; +const colorDesc = { + $help: ['Coloring mode shortcut', ' EL - color by element', ' CH - color by chain', ' SQ - color by sequence', ' RT - color by residue type', ' SS - color by secondary structure', ' UN - uniform'], + UN: { + $help: ['Parameters of coloring modes customization', ' Uniform', ' color = #RGB->HEX->dec\n'], + color: { + $help: Object.keys(gfx_palettes.get(settings.now.palette).namedColors).sort().join('\n') + } + } +}; +const materialDesc = { + $help: ['Material shortcut', ' DF - diffuse', ' TR - transparent', ' SF - soft plastic', ' PL - glossy plastic', ' ME - metal', ' GL - glass'] +}; +const addRepDesc = { + $help: ['Short (packed) representation description as a set of variables', ' s=', ' selector property', ' m=[!:[,...]]', ' render mode property', ' c=[!:[,...]]', ' color mode property', ' mt=', ' material property'], + s: { + $help: 'Selection expression string as it is in menu->representations->selection' + }, + m: modeIdDesc, + c: colorDesc, + mt: materialDesc +}; +const setGetParameterDesc = { + $help: ['Parameters of rendering modes customization: modes', 'Parameters of colorer customization: colorers', 'Autobuild: autobuild = (|)'], + modes: modeIdDesc, + colorers: colorDesc +}; +const help = { + $help: ['help (| )', 'You can get detailed information about command options', ' using "help cmd.opt.opt.[...]"\n', ' you can use one line comments', ' everything started from (#|//) will be skipped', ' Example: >build //some comment\n', 'List of available commands:'], + reset: { + $help: ['Reload current object, delete all representations', ' Nothing will work until load new object'] + }, + load: { + $help: ['load (||-f [<*.NC FILE URL STRING>])', ' Load new pdb object from selected source'], + PDBID: { + $help: 'pdb id in remote molecule database' }, - select: { - $help: ['select [as ]', 'Select atoms using selector defined in SELECTOR_STRING', ' and if SELECTOR_NAME is defined register it in viewer', ' you can use it later as a complex selector'] + URL: { + $help: 'url to source file' }, - within: { - $help: ['within of as ', 'Build within named selector', ' DISTANCE ', ' SELECTOR_STRING ', ' SELECTOR_NAME '] + f: { + $help: ['open file system dialog to fetch local file', 'optionally you can determine trajectory file', 'via URL for *.top model'] + } + }, + clear: { + $help: 'No args. Clear terminal' + }, + add: { + $help: ['add [] []', ' Add new item to representation set with', ' default or params'], + REP_NAME: { + $help: 'Identifier string [_,a-z,A-Z,0-9] can not start from digit' }, - url: { - $help: ['url [-s] [-v]', 'Report URL encoded scene', ' if -s set that include settings in the URL', ' if -v set that include view in the URL'] + DESCRIPTION: addRepDesc + }, + rep: { + $help: ['rep [|] []', ' set current representation by name or index', ' edit current representation by '], + REP_NAME: { + $help: ['Identifier string [_,a-z,A-Z,0-9] can not start from digit', 'Must be declared before'] }, - screenshot: { - $help: ['screenshot [ []]', 'Make a screenshot of the scene', ' WIDTH in pixels', ' HEIGHT in pixels, equal to WIDTH by default'] + REP_INDEX: { + $help: 'Index of available representation' }, - line: { - $help: ['line [=]', 'Draw dashed line between two specified atoms'] + DESCRIPTION: addRepDesc + }, + remove: { + $help: ['remove (|)', 'Remove representation by name or index'], + REP_NAME: { + $help: ['Identifier string [_,a-z,A-Z,0-9] can not start from digit', 'Must be declared before'] }, - removeobj: { - $help: ['removeobj ', 'Remove scene object by its index. Indices could be obtained by command'] + REP_INDEX: { + $help: 'Index of available representation' + } + }, + selector: { + $help: ['selector ', ' set selector from EXPRESSION to current representation'], + EXPRESSION: { + $help: 'Selection expression string as it is in menu->representations->selection' + } + }, + mode: { + $help: ['mode [=...]', ' set rendering mode and apply parameters to current representation'], + MODE_ID: modeIdDesc + }, + color: { + $help: ['color [=...]', ' set colorer and apply parameters to current representation'], + COLORER_ID: colorDesc + }, + material: { + $help: ['material ', ' set material to current representation'], + MATERIAL_ID: materialDesc + }, + build: { + $help: 'build help str', + add: { + $help: 'build.add', + new: { + $help: ['add.new', 'add.new new line 1', 'add.new new line 2', 'add.new new line 3'] + } }, - listobj: { - $help: ['listobj', 'Display the list of all existing scene objects'] + del: { + $help: 'build.del' } - }; - - var selectors$5 = Miew.chem.selectors, - modes$1 = Miew.modes, - colorers$1 = Miew.colorers, - materials$1 = Miew.materials, - palettes$1 = Miew.palettes, - options$1 = Miew.options, - settings$1 = Miew.settings; - - function None() {} - - var NULL = function () { - var obj = new None(); - return function () { - return obj; - }; - }(); - - var RepresentationMap = /*#__PURE__*/function () { - function RepresentationMap() { - classCallCheck(this, RepresentationMap); - - this.representationMap = {}; - this.representationID = {}; + }, + list: { + $help: ['list [-e|-s||]', 'Print representations if no args print list of representations', ' -e expand list and show all representations', ' -s show all user-registered selectors', ' | show only current representation'] + }, + hide: { + $help: ['hide (|)', 'Hide representation referenced in args'] + }, + show: { + $help: ['show (|)', 'Show representation referenced in args'] + }, + get: { + $help: ['get ', 'Print value', ' - path to option use get.PARAMETER to get more info'], + PARAMETER: setGetParameterDesc + }, + set: { + $help: ['set ', 'Set with ', ' - path to option use set.PARAMETER to get more info'], + PARAMETER: setGetParameterDesc + }, + set_save: { + $help: ['set_save', 'Save current settings to cookie'] + }, + set_restore: { + $help: ['set_restore', 'Load and apply settings from cookie'] + }, + set_reset: { + $help: ['set_reset', 'Reset current settings to the defaults'] + }, + preset: { + $help: ['preset []', 'Reset current representation or set preset to '], + PRESET: { + $help: ['default', 'wire', 'small', 'macro'] + } + }, + unit: { + $help: ['unit []', 'Change current biological structure view. Zero value means asymmetric unit,', 'positive values set an assembly with corresponding number.', 'Being called with no parameters command prints current unit information.'] + }, + view: { + $help: ['view []', 'Get current encoded view or set if ENCODED_VIEW placed as argument'], + ENCODED_VIEW: { + $help: ['encoded view matrix string (binary code)'] } + }, + rotate: { + $help: ['rotate (x|y|z) [] [(x|y|z) []]...', 'Rotate scene'] + }, + scale: { + $help: ['scale ', 'Scale scene'] + }, + select: { + $help: ['select [as ]', 'Select atoms using selector defined in SELECTOR_STRING', ' and if SELECTOR_NAME is defined register it in viewer', ' you can use it later as a complex selector'] + }, + within: { + $help: ['within of as ', 'Build within named selector', ' DISTANCE ', ' SELECTOR_STRING ', ' SELECTOR_NAME '] + }, + url: { + $help: ['url [-s] [-v]', 'Report URL encoded scene', ' if -s set that include settings in the URL', ' if -v set that include view in the URL'] + }, + screenshot: { + $help: ['screenshot [ []]', 'Make a screenshot of the scene', ' WIDTH in pixels', ' HEIGHT in pixels, equal to WIDTH by default'] + }, + line: { + $help: ['line [=]', 'Draw dashed line between two specified atoms'] + }, + removeobj: { + $help: ['removeobj ', 'Remove scene object by its index. Indices could be obtained by command'] + }, + listobj: { + $help: ['listobj', 'Display the list of all existing scene objects'] + } +}; +/* harmony default export */ const MiewCLIHelp = (help); +;// CONCATENATED MODULE: ./src/Miew-cli.js - createClass(RepresentationMap, [{ - key: "get", - value: function get(strId) { - return this.representationMap[strId] || this.representationID[strId] || ''; - } - }, { - key: "add", - value: function add(strId, index) { - if (strId === -1) { - return 'Can not create representation: there is no data'; - } - if (index !== undefined) { - if (!this.representationMap.hasOwnProperty(strId)) { - this.representationMap[strId.toString()] = index; - this.representationID[index] = strId.toString(); - } else { - return 'This name has already existed, registered without name'; - } - } - return "Representation ".concat(strId, " successfully added"); - } - }, { - key: "remove", - value: function remove(index) { - if (index && this.representationID.hasOwnProperty(index)) { - delete this.representationMap[this.representationID[index]]; - delete this.representationID[index]; - } - var sortedKeys = Object.keys(this.representationID).sort(); - for (var i in sortedKeys) { - if (sortedKeys.hasOwnProperty(i)) { - var id = sortedKeys[i]; - if (id > index) { - this.representationID[id - 1] = this.representationID[id]; - this.representationMap[this.representationID[id]] -= 1; - delete this.representationID[id]; - } - } - } - } - }, { - key: "clear", - value: function clear() { - this.representationMap = {}; - this.representationID = {}; +const { + chem: { + selectors: Miew_cli_selectors + }, + modes: Miew_cli_modes, + colorers: Miew_cli_colorers, + materials: Miew_cli_materials, + palettes: Miew_cli_palettes, + options: Miew_cli_options, + settings: Miew_cli_settings +} = src_Miew; +function None() {} +const NULL = function () { + const obj = new None(); + return function () { + return obj; + }; +}(); +class RepresentationMap { + constructor() { + this.representationMap = {}; + this.representationID = {}; + } + get(strId) { + return this.representationMap[strId] || this.representationID[strId] || ''; + } + add(strId, index) { + if (strId === -1) { + return 'Can not create representation: there is no data'; + } + if (index !== undefined) { + if (!this.representationMap.hasOwnProperty(strId)) { + this.representationMap[strId.toString()] = index; + this.representationID[index] = strId.toString(); + } else { + return 'This name has already existed, registered without name'; } - }]); - - return RepresentationMap; - }(); - - var representationsStorage = new RepresentationMap(); - - function keyRemap(key) { - var keys = { - s: 'selector', - m: 'mode', - c: 'colorer', - mt: 'material', - mode: 'modes', - color: 'colorers', - colorer: 'colorers', - select: 'selector', - material: 'materials', - selector: 'selector' - }; - var ans = keys[key]; - return ans === undefined ? key : ans; + } + return `Representation ${strId} successfully added`; } - - var CLIUtils = /*#__PURE__*/function () { - function CLIUtils() { - classCallCheck(this, CLIUtils); + remove(index) { + if (index && this.representationID.hasOwnProperty(index)) { + delete this.representationMap[this.representationID[index]]; + delete this.representationID[index]; } - - createClass(CLIUtils, [{ - key: "list", - value: function list(miew, repMap, key) { - var ret = ''; - - if (miew && repMap !== undefined) { - if (key === undefined || key === '-e') { - var count = miew.repCount(); - - for (var i = 0; i < count; i++) { - ret += this.listRep(miew, repMap, i, key); - } - } - } - - return ret; - } - }, { - key: "listRep", - value: function listRep(miew, repMap, repIndex, key) { - var ret = ''; - var rep = miew.repGet(repIndex); - - if (!rep) { - logger.warn("Rep ".concat(repIndex, " does not exist!")); - return ret; - } - - var index = repIndex; - var repName = repMap.get(index); - var mode = rep.mode, - colorer = rep.colorer; - var selectionStr = rep.selectorString; - var material = rep.materialPreset; - ret += "#".concat(index, " : ").concat(mode.name).concat(repName === '' ? '' : ", ".concat(repName), "\n"); - - if (key !== undefined) { - ret += " selection : \"".concat(selectionStr, "\"\n"); - ret += " mode : (".concat(mode.id, "), ").concat(mode.name, "\n"); - ret += " colorer : (".concat(colorer.id, "), ").concat(colorer.name, "\n"); - ret += " material : (".concat(material.id, "), ").concat(material.name, "\n"); + const sortedKeys = Object.keys(this.representationID).sort(); + for (const i in sortedKeys) { + if (sortedKeys.hasOwnProperty(i)) { + const id = sortedKeys[i]; + if (id > index) { + this.representationID[id - 1] = this.representationID[id]; + this.representationMap[this.representationID[id]] -= 1; + delete this.representationID[id]; } - - return ret; } - }, { - key: "listSelector", - value: function listSelector(miew, context) { - var ret = ''; - - for (var k in context) { - if (context.hasOwnProperty(k)) { - ret += "".concat(k, " : \"").concat(context[k], "\"\n"); - } - } - - return ret; + } + } + clear() { + this.representationMap = {}; + this.representationID = {}; + } +} +const representationsStorage = new RepresentationMap(); +function keyRemap(key) { + const keys = { + s: 'selector', + m: 'mode', + c: 'colorer', + mt: 'material', + mode: 'modes', + color: 'colorers', + colorer: 'colorers', + select: 'selector', + material: 'materials', + selector: 'selector' + }; + const ans = keys[key]; + return ans === undefined ? key : ans; +} +class CLIUtils { + list(miew, repMap, key) { + let ret = ''; + if (miew && repMap !== undefined) { + if (key === undefined || key === '-e') { + const count = miew.repCount(); + for (let i = 0; i < count; i++) { + ret += this.listRep(miew, repMap, i, key); + } + } + } + return ret; + } + listRep(miew, repMap, repIndex, key) { + let ret = ''; + const rep = miew.repGet(repIndex); + if (!rep) { + logger.warn(`Rep ${repIndex} does not exist!`); + return ret; + } + const index = repIndex; + const repName = repMap.get(index); + const { + mode, + colorer + } = rep; + const selectionStr = rep.selectorString; + const material = rep.materialPreset; + ret += `#${index} : ${mode.name}${repName === '' ? '' : `, ${repName}`}\n`; + if (key !== undefined) { + ret += ` selection : "${selectionStr}"\n`; + ret += ` mode : (${mode.id}), ${mode.name}\n`; + ret += ` colorer : (${colorer.id}), ${colorer.name}\n`; + ret += ` material : (${material.id}), ${material.name}\n`; + } + return ret; + } + listSelector(miew, context) { + let ret = ''; + for (const k in context) { + if (context.hasOwnProperty(k)) { + ret += `${k} : "${context[k]}"\n`; } - }, { - key: "listObjs", - value: function listObjs(miew) { - var objs = miew._objects; - - if (!objs || !Array.isArray(objs) || objs.length === 0) { - return 'There are no objects on the scene'; - } - - var strList = []; - - for (var i = 0, n = objs.length; i < n; ++i) { - strList[i] = "".concat(i, ": ").concat(objs[i].toString()); + } + return ret; + } + listObjs(miew) { + const objs = miew._objects; + if (!objs || !Array.isArray(objs) || objs.length === 0) { + return 'There are no objects on the scene'; + } + const strList = []; + for (let i = 0, n = objs.length; i < n; ++i) { + strList[i] = `${i}: ${objs[i].toString()}`; + } + return strList.join('\n'); + } + joinHelpStr(helpData) { + if (helpData instanceof Array) { + return helpData.join('\n'); + } + return helpData; + } + help(path) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(path)) { + return `${this.joinHelpStr(MiewCLIHelp.$help)}\n${external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().slice(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().sortBy(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().keys(MiewCLIHelp)), 1).join(', ')}\n`; + } + const helpItem = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(MiewCLIHelp, path); + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().isUndefined(helpItem) ? this.help() : `${this.joinHelpStr(helpItem.$help)}\n`; + } + load(miew, arg) { + if (miew === undefined || arg === undefined || arg === '-f') { + return; + } + miew.awaitWhileCMDisInProcess(); + const finish = () => miew.finishAwaitingCMDInProcess(); + miew.load(arg).then(finish, finish); + } + checkArg(key, arg, modificate) { + if (key !== undefined && arg !== undefined) { + if (keyRemap(key) === 'selector') { + const res = Miew_cli_selectors.parse(arg); + if (res.error !== undefined) { + const selExc = { + message: res.error + }; + throw selExc; } - - return strList.join('\n'); - } - }, { - key: "joinHelpStr", - value: function joinHelpStr(helpData) { - if (helpData instanceof Array) { - return helpData.join('\n'); + if (modificate !== undefined && modificate) { + return res.selector; } - - return helpData; + return arg; } - }, { - key: "help", - value: function help$1(path) { - if (_.isUndefined(path)) { - return "".concat(this.joinHelpStr(help.$help), "\n").concat(_.slice(_.sortBy(_.keys(help)), 1).join(', '), "\n"); - } - - var helpItem = _.get(help, path); - - return _.isUndefined(helpItem) ? this.help() : "".concat(this.joinHelpStr(helpItem.$help), "\n"); + const modificators = { + colorers: Miew_cli_colorers, + modes: Miew_cli_modes, + materials: Miew_cli_materials + }; + let modificator = key; + let temp; + while (modificator !== temp) { + temp = modificator; + modificator = keyRemap(temp); + } + if (modificators[modificator].get(arg) === undefined) { + const exc = { + message: `${arg} is not existed in ${modificator}` + }; + throw exc; } - }, { - key: "load", - value: function load(miew, arg) { - if (miew === undefined || arg === undefined || arg === '-f') { - return; - } - - miew.awaitWhileCMDisInProcess(); - - var finish = function finish() { - return miew.finishAwaitingCMDInProcess(); + return arg; + } + return NULL; + } + propagateProp(path, arg) { + if (path !== undefined) { + let argExc = {}; + const adapter = Miew_cli_options.adapters[typeof external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(Miew_cli_settings.defaults, path)]; + if (adapter === undefined) { + const pathExc = { + message: `${path} is not existed` }; - - miew.load(arg).then(finish, finish); + throw pathExc; } - }, { - key: "checkArg", - value: function checkArg(key, arg, modificate) { - if (key !== undefined && arg !== undefined) { - if (keyRemap(key) === 'selector') { - var res = selectors$5.parse(arg); - - if (res.error !== undefined) { - var selExc = { - message: res.error - }; - throw selExc; - } - - if (modificate !== undefined && modificate) { - return res.selector; - } - - return arg; - } - - var modificators = { - colorers: colorers$1, - modes: modes$1, - materials: materials$1 - }; - var modificator = key; - var temp; - - while (modificator !== temp) { - temp = modificator; - modificator = keyRemap(temp); - } - - if (modificators[modificator].get(arg) === undefined) { - var exc = { - message: "".concat(arg, " is not existed in ").concat(modificator) - }; - throw exc; - } - - return arg; - } - - return NULL; + if ((path.endsWith('.color') || path.endsWith('.baseColor') || path.endsWith('.EL.carbon')) && typeof arg !== 'number') { + arg = Miew_cli_palettes.get(Miew_cli_settings.now.palette).getNamedColor(arg); } - }, { - key: "propagateProp", - value: function propagateProp(path, arg) { - if (path !== undefined) { - var argExc = {}; - - var adapter = options$1.adapters[_typeof_1(_.get(settings$1.defaults, path))]; - - if (adapter === undefined) { - var pathExc = { - message: "".concat(path, " is not existed") - }; - throw pathExc; - } - - if ((path.endsWith('.color') || path.endsWith('.baseColor') || path.endsWith('.EL.carbon')) && typeof arg !== 'number') { - arg = palettes$1.get(settings$1.now.palette).getNamedColor(arg); - } - - if (path.endsWith('.fg') || path.endsWith('.bg')) { - if (typeof arg !== 'number') { - var val = palettes$1.get(settings$1.now.palette).getNamedColor(arg, true); - - if (val !== undefined) { - arg = "0x".concat(val.toString(16)); - } - } else { - arg = "0x".concat(arg.toString(16)); - } - } - - if (path.endsWith('.template')) { - arg = arg.replace(/\\n/g, '\n'); // NOSONAR - } - - if (arg !== undefined && adapter(arg) !== arg && adapter(arg) !== arg > 0) { - argExc = { - message: "".concat(path, " must be a \"").concat(_typeof_1(_.get(settings$1.defaults, path)), "\"") - }; - throw argExc; + if (path.endsWith('.fg') || path.endsWith('.bg')) { + if (typeof arg !== 'number') { + const val = Miew_cli_palettes.get(Miew_cli_settings.now.palette).getNamedColor(arg, true); + if (val !== undefined) { + arg = `0x${val.toString(16)}`; } + } else { + arg = `0x${arg.toString(16)}`; } - - return arg; } - }, { - key: "unquoteString", - value: function unquoteString(value) { - return utils.unquoteString(value); + if (path.endsWith('.template')) { + arg = arg.replace(/\\n/g, '\n'); // NOSONAR + } + if (arg !== undefined && adapter(arg) !== arg && adapter(arg) !== arg > 0) { + argExc = { + message: `${path} must be a "${typeof external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().get(Miew_cli_settings.defaults, path)}"` + }; + throw argExc; } - }]); - - return CLIUtils; - }(); // repIndexOrRepMap could be RepresentationMap or index - - - var utilFunctions = new CLIUtils(); - - function CreateObjectPair(a, b) { - var obj = {}; - obj[a] = b; - return obj; - } - - function ArgList(arg) { - if (arg instanceof this.constructor) { - return arg; - } - - if (arg instanceof Array) { - this._values = arg.slice(0); - } else if (arg) { - this._values = [arg]; - } else { - this._values = []; } + return arg; } - - ArgList.prototype.append = function (value) { - var values = this._values; - values[values.length] = value; - return this; - }; - - ArgList.prototype.remove = function (value) { - var values = this._values; - var index = values.indexOf(value); - - if (index >= 0) { - values.splice(index, 1); - } - - return this; - }; - - ArgList.prototype.toJSO = function (cliUtils, cmd, arg) { - var res = {}; - var list = this._values; - - for (var i = 0, n = list.length; i < n; ++i) { - _.set(res, list[i].id, cliUtils.propagateProp("".concat(keyRemap(cmd), ".").concat(arg, ".").concat(list[i].id), list[i].val)); - } - - return res; - }; - - function Arg(_id, _val) { - this.id = _id; - this.val = _val; - } - - var cliutils = Object.create({}); - cliutils.Arg = Arg; - cliutils.ArgList = ArgList; - cliutils.miew = null; - cliutils.echo = null; - cliutils.representations = representationsStorage; - cliutils.utils = utilFunctions; - cliutils._ = _; - cliutils.CreateObjectPair = CreateObjectPair; - cliutils.keyRemap = keyRemap; - cliutils.Context = selectors$5.Context; - cliutils.ClearContext = selectors$5.ClearContext; - cliutils.NULL = NULL; - - cliutils.notimplemented = function () { - return this.NULL; - }; - - Miew.prototype.script = function (script, _printCallback, _errorCallback) { - MiewCLIParser_1.yy.miew = this; - MiewCLIParser_1.yy.echo = _printCallback; - MiewCLIParser_1.yy.error = _errorCallback; - - if (this.cmdQueue === undefined) { - this.cmdQueue = []; - } - - if (this.commandInAction === undefined) { - this.commandInAction = false; - } - - this.cmdQueue = this.cmdQueue.concat(script.split('\n')); - }; - - Miew.prototype.awaitWhileCMDisInProcess = function () { - this.commandInAction = true; - }; - - Miew.prototype.finishAwaitingCMDInProcess = function () { + unquoteString(value) { + return utils.unquoteString(value); + } +} +// repIndexOrRepMap could be RepresentationMap or index + +const utilFunctions = new CLIUtils(); +function CreateObjectPair(a, b) { + const obj = {}; + obj[a] = b; + return obj; +} +function ArgList(arg) { + if (arg instanceof this.constructor) { + return arg; + } + if (arg instanceof Array) { + this._values = arg.slice(0); + } else if (arg) { + this._values = [arg]; + } else { + this._values = []; + } +} +ArgList.prototype.append = function (value) { + const values = this._values; + values[values.length] = value; + return this; +}; +ArgList.prototype.remove = function (value) { + const values = this._values; + const index = values.indexOf(value); + if (index >= 0) { + values.splice(index, 1); + } + return this; +}; +ArgList.prototype.toJSO = function (cliUtils, cmd, arg) { + const res = {}; + const list = this._values; + for (let i = 0, n = list.length; i < n; ++i) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default().set(res, list[i].id, cliUtils.propagateProp(`${keyRemap(cmd)}.${arg}.${list[i].id}`, list[i].val)); + } + return res; +}; +function Arg(_id, _val) { + this.id = _id; + this.val = _val; +} +const cliutils = Object.create({}); +cliutils.Arg = Arg; +cliutils.ArgList = ArgList; +cliutils.miew = null; +cliutils.echo = null; +cliutils.representations = representationsStorage; +cliutils.utils = utilFunctions; +cliutils._ = (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_default()); +cliutils.CreateObjectPair = CreateObjectPair; +cliutils.keyRemap = keyRemap; +cliutils.Context = Miew_cli_selectors.Context; +cliutils.ClearContext = Miew_cli_selectors.ClearContext; +cliutils.NULL = NULL; +cliutils.notimplemented = function () { + return this.NULL; +}; +src_Miew.prototype.script = function (script, _printCallback, _errorCallback) { + MiewCLIParser.parser.yy.miew = this; + MiewCLIParser.parser.yy.echo = _printCallback; + MiewCLIParser.parser.yy.error = _errorCallback; + if (this.cmdQueue === undefined) { + this.cmdQueue = []; + } + if (this.commandInAction === undefined) { this.commandInAction = false; - }; - - Miew.prototype.isScriptingCommandAvailable = function () { - return this.commandInAction !== undefined && !this.commandInAction && this.cmdQueue !== undefined && this.cmdQueue.length > 0; - }; - - Miew.prototype.callNextCmd = function () { - if (this.isScriptingCommandAvailable()) { - var cmd = this.cmdQueue.shift(); - var res = {}; - res.success = false; - - try { - MiewCLIParser_1.parse(cmd); - res.success = true; - } catch (e) { - res.error = e.message; - MiewCLIParser_1.yy.error(res.error); - this.finishAwaitingCMDInProcess(); - } - - return res; + } + this.cmdQueue = this.cmdQueue.concat(script.split('\n')); +}; +src_Miew.prototype.awaitWhileCMDisInProcess = function () { + this.commandInAction = true; +}; +src_Miew.prototype.finishAwaitingCMDInProcess = function () { + this.commandInAction = false; +}; +src_Miew.prototype.isScriptingCommandAvailable = function () { + return this.commandInAction !== undefined && !this.commandInAction && this.cmdQueue !== undefined && this.cmdQueue.length > 0; +}; +src_Miew.prototype.callNextCmd = function () { + if (this.isScriptingCommandAvailable()) { + const cmd = this.cmdQueue.shift(); + const res = {}; + res.success = false; + try { + MiewCLIParser.parser.parse(cmd); + res.success = true; + } catch (e) { + res.error = e.message; + MiewCLIParser.parser.yy.error(res.error); + this.finishAwaitingCMDInProcess(); } - - return ''; - }; - - MiewCLIParser_1.yy = cliutils; // workaround for incorrect JISON parser generator for AMD module - - MiewCLIParser_1.yy.parseError = MiewCLIParser_1.parseError; - - return Miew; - -}))); -//# sourceMappingURL=Miew.js.map + return res; + } + return ''; +}; +MiewCLIParser.parser.yy = cliutils; +// workaround for incorrect JISON parser generator for AMD module +MiewCLIParser.parser.yy.parseError = MiewCLIParser.parser.parseError; +;// CONCATENATED MODULE: ./src/index.js + + +/* harmony default export */ const src = (src_Miew); +})(); + +__webpack_exports__ = __webpack_exports__["default"]; +/******/ return __webpack_exports__; +/******/ })() +; +}); +//# sourceMappingURL=Miew.js.map \ No newline at end of file diff --git a/packages/miew/dist/Miew.js.map b/packages/miew/dist/Miew.js.map index 34a1ff05b..7f47ee31a 100644 --- a/packages/miew/dist/Miew.js.map +++ b/packages/miew/dist/Miew.js.map @@ -1 +1 @@ -{"version":3,"file":"Miew.js","sources":["../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../node_modules/spin.js/spin.js","../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../src/Timer.js","../../src/gfx/Stats.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../src/utils/EventDispatcher.js","../../src/utils/logger.js","../../src/utils.js","../../src/utils/JobHandle.js","../../src/settings.js","../../src/options.js","../../node_modules/@babel/runtime/helpers/defineProperty.js","../../src/chem/Atom.js","../../src/chem/Element.js","../../src/chem/Bond.js","../../src/chem/Residue.js","../../src/chem/ResidueType.js","../../src/chem/Chain.js","../../src/chem/StructuralElement.js","../../src/chem/Helix.js","../../node_modules/@babel/runtime/helpers/superPropBase.js","../../node_modules/@babel/runtime/helpers/get.js","../../src/chem/Strand.js","../../src/chem/Sheet.js","../../src/chem/SGroup.js","../../src/utils/SelectionParser.js","../../src/chem/selectors/selectArgs.js","../../src/chem/selectors/selectorsBase.js","../../src/chem/selectors/selectOps.js","../../src/chem/selectors.js","../../src/chem/BiologicalUnit.js","../../src/chem/Assembly.js","../../src/chem/Component.js","../../src/chem/AtomPairs.js","../../src/chem/AutoBond.js","../../src/chem/AromaticLoopsMarker.js","../../src/chem/VoxelWorld.js","../../src/chem/HBondInfo.js","../../src/chem/SecondaryStructureMap.js","../../src/chem/Complex.js","../../src/chem/Volume.js","../../src/chem/Molecule.js","../../src/chem.js","../../src/gfx/CSS2DObject.js","../../src/gfx/RCGroup.js","../../src/gfx/capabilities.js","../../src/gfx/noiseTexture.js","../../src/gfx/shaders/UberMaterial.js","../../src/gfx/gfxutils.js","../../src/Visual.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../src/utils/EntityList.js","../../src/utils/makeContextDependent.js","../../src/gfx/geometries/SphereCollisionGeo.js","../../src/gfx/geometries/InstancedSpheresGeometry.js","../../src/gfx/geometries/RaycastableBufferGeometry.js","../../src/gfx/geometries/ChunkedObjectsGeometry.js","../../src/gfx/geometries/SimpleSpheresGeometry.js","../../src/gfx/geometries/Simple2CCylindersGeometry.js","../../src/gfx/geometries/CylinderBufferGeometry.js","../../src/gfx/geometries/Instanced2CCylindersGeometry.js","../../src/gfx/geometries/ExtrudedObjectsGeometry.js","../../src/gfx/geometries/ThickLinesGeometry.js","../../src/gfx/geometries/LinesGeometry.js","../../src/gfx/geometries/CylinderCollisionGeo.js","../../src/gfx/geometries/ChunkedLinesGeometry.js","../../src/gfx/geometries/TwoColorLinesGeometry.js","../../src/gfx/geometries/CrossGeometry.js","../../src/gfx/geometries/IsoSurfaceGeometry.js","../../src/gfx/geometries/IsoSurfaceMarchCube.js","../../src/gfx/geometries/IsoSurface.js","../../src/gfx/geometries/VolumeSurfaceGeometry.js","../../src/gfx/geometries/QuickSurfGeometry.js","../../src/gfx/geometries/ContactSurface.js","../../src/gfx/geometries/ContactSurfaceGeometry.js","../../src/gfx/geometries/IsoSurfaceAtomColored.js","../../src/gfx/geometries/IsosurfaceBuildNormals.js","../../src/gfx/geometries/IsoSurfaceGeo.js","../../src/gfx/geometries/SSIsosurfaceGeometry.js","../../src/gfx/geometries/LabelsGeometry.js","../../src/gfx/geometries/geometries.js","../../src/gfx/meshes/UberObject.js","../../src/gfx/meshes/ZSpriteMesh.js","../../src/gfx/meshes/ZClippedMesh.js","../../src/gfx/meshes/TextMesh.js","../../src/gfx/meshes/SimpleMesh.js","../../src/gfx/meshes/ThickLineMesh.js","../../src/gfx/meshes/InstancedMesh.js","../../src/gfx/meshes/meshes.js","../../src/gfx/meshes/MeshCreator.js","../../src/gfx/meshes/TransformGroup.js","../../src/gfx/modes/groups/ChemGroup.js","../../src/gfx/modes/groups/AtomsGroup.js","../../src/gfx/modes/groups/AtomsSphereGroup.js","../../src/gfx/modes/groups/AtomsSurfaceGroup.js","../../src/gfx/modes/groups/AtomsSASSESGroupStub.js","../../src/gfx/modes/groups/AtomsTextGroup.js","../../src/gfx/modes/groups/AromaticGroup.js","../../src/gfx/modes/groups/AromaticTorusGroup.js","../../src/gfx/modes/groups/AromaticLinesGroup.js","../../src/gfx/modes/groups/ResiduesGroup.js","../../src/gfx/modes/groups/NucleicItemGroup.js","../../src/gfx/modes/groups/NucleicCylindersGroup.js","../../src/gfx/modes/groups/NucleicSpheresGroup.js","../../vendor/js/Smooth.js","../../src/gfx/modes/groups/CartoonHelper.js","../../src/gfx/modes/groups/ResiduesSubseqGroup.js","../../src/gfx/modes/groups/ResiduesTraceGroup.js","../../src/gfx/modes/groups/BondsGroup.js","../../src/gfx/modes/groups/BondsCylinderGroup.js","../../src/gfx/modes/groups/BondsLinesGroup.js","../../src/gfx/modes/groups/groups.js","../../src/gfx/modes/processors/AtomsProcessor.js","../../src/gfx/modes/processors/OrphanAtomsProcessor.js","../../src/gfx/modes/processors/ResiduesProcessor.js","../../src/gfx/modes/processors/NucleicProcessor.js","../../src/gfx/modes/processors/SubseqsProcessor.js","../../src/gfx/modes/processors/BondsProcessor.js","../../src/gfx/modes/processors/AromaticProcessor.js","../../src/gfx/modes/processors/processors.js","../../src/gfx/modes/groups/GroupsFactory.js","../../src/gfx/modes/Mode.js","../../src/gfx/modes/LinesMode.js","../../src/gfx/modes/LicoriceMode.js","../../src/gfx/modes/BallsAndSticksMode.js","../../src/gfx/modes/VanDerWaalsMode.js","../../src/gfx/modes/TraceMode.js","../../src/gfx/modes/TubeMode.js","../../src/gfx/modes/CartoonMode.js","../../src/gfx/modes/SurfaceMode.js","../../src/gfx/modes/QuickSurfaceMode.js","../../src/gfx/modes/IsoSurfaceMode.js","../../src/gfx/modes/IsoSurfaceSASMode.js","../../src/gfx/modes/IsoSurfaceSESMode.js","../../src/gfx/modes/ContactSurfaceMode.js","../../src/gfx/modes/TextMode.js","../../src/gfx/modes.js","../../src/gfx/palettes/Palette.js","../../src/gfx/palettes/cpkPalette.js","../../src/gfx/palettes/jmolPalette.js","../../src/gfx/palettes/vmdPalette.js","../../src/gfx/palettes.js","../../src/gfx/colorers/Colorer.js","../../src/gfx/colorers/ElementColorer.js","../../src/gfx/colorers/ResidueTypeColorer.js","../../src/gfx/colorers/SequenceColorer.js","../../src/gfx/colorers/ChainColorer.js","../../src/gfx/colorers/SecondaryStructureColorer.js","../../src/gfx/colorers/UniformColorer.js","../../src/gfx/colorers/ConditionalColorer.js","../../src/gfx/colorers/ConformationColorer.js","../../src/gfx/colorers/TemperatureColorer.js","../../src/gfx/colorers/OccupancyColorer.js","../../src/gfx/colorers/HydrophobicityColorer.js","../../src/gfx/colorers/MoleculeColorer.js","../../src/gfx/colorers/CarbonColorer.js","../../src/gfx/colorers.js","../../src/gfx/materials.js","../../src/gfx/Representation.js","../../src/ComplexVisualEdit.js","../../src/ComplexVisual.js","../../src/gfx/shaders/VolumeMaterial.js","../../src/gfx/VolumeMesh.js","../../src/gfx/VolumeBounds.js","../../src/gfx/VolumeFarPlane.js","../../src/VolumeVisual.js","../../src/io/loaders/LoaderList.js","../../src/io/loaders/Loader.js","../../src/io/loaders/FileLoader.js","../../src/io/loaders/XHRLoader.js","../../src/io/loaders/ImmediateLoader.js","../../src/io/loaders.js","../../src/io/parsers/ParserList.js","../../src/io/parsers/Parser.js","../../src/io/parsers/pdb/Remark290.js","../../src/io/parsers/pdb/Remark350.js","../../src/io/parsers/PDBStream.js","../../src/io/parsers/PDBParser.js","../../src/io/parsers/CMLParser.js","../../vendor/js/mmtf.js","../../src/io/parsers/MMTFParser.js","../../src/io/parsers/ParsingError.js","../../src/io/parsers/readCIF.js","../../src/io/parsers/CIFParser.js","../../src/io/parsers/VolumeModel.js","../../src/io/parsers/CCP4Parser.js","../../src/io/parsers/XYZParser.js","../../src/io/parsers/PubChemParser.js","../../src/io/parsers/SDFStream.js","../../src/io/parsers/SDFParser.js","../../src/io/parsers/DSN6Parser.js","../../src/io/parsers/GROReader.js","../../src/io/parsers/GROParser.js","../../src/io/parsers/MOL2Parser.js","../../src/io/parsers.js","../../src/io/exporters/ExporterList.js","../../src/io/exporters/Exporter.js","../../src/io/exporters/PDBResult.js","../../src/io/exporters/PDBExporter.js","../../src/io/exporters/fbx/FBXModel.js","../../src/io/exporters/fbx/FBXGeometry.js","../../src/io/exporters/fbx/FBX1CGeometry.js","../../src/io/exporters/fbx/FBX2CCylinder.js","../../src/io/exporters/fbx/FBXInfoExtractor.js","../../src/io/exporters/fbx/FBXResult.js","../../src/io/exporters/FBXExporter.js","../../src/io/exporters.js","../../src/io/io.js","../../src/gfx/CSS2DRenderer.js","../../src/ui/ObjectControls.js","../../src/ui/Picker.js","../../src/gfx/Axes.js","../../src/gfx/FrameInfo.js","../../src/gfx/objects/SceneObject.js","../../src/gfx/objects/LinesObj.js","../../src/gfx/shaders/OutlineMaterial.js","../../src/gfx/shaders/FXAAMaterial.js","../../src/gfx/shaders/AOMaterial.js","../../src/gfx/shaders/AOHorBlurMaterial.js","../../src/gfx/shaders/AOVertBlurWithBlendMaterial.js","../../src/gfx/shaders/AnaglyphMaterial.js","../../src/gfx/ViewInterpolator.js","../../src/utils/Cookies.js","../../src/gfx/vr/createWebVRButton.js","../../src/gfx/vr/WebVRPoC.js","../../src/Miew.js","../../src/utils/MiewCLIParser.js","../../src/utils/MiewCLIHelp.js","../../src/Miew-cli.js"],"sourcesContent":["function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) {\n return;\n }\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","var __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar defaults = {\r\n lines: 12,\r\n length: 7,\r\n width: 5,\r\n radius: 10,\r\n scale: 1.0,\r\n corners: 1,\r\n color: '#000',\r\n fadeColor: 'transparent',\r\n animation: 'spinner-line-fade-default',\r\n rotate: 0,\r\n direction: 1,\r\n speed: 1,\r\n zIndex: 2e9,\r\n className: 'spinner',\r\n top: '50%',\r\n left: '50%',\r\n shadow: '0 0 1px transparent',\r\n position: 'absolute',\r\n};\r\nvar Spinner = /** @class */ (function () {\r\n function Spinner(opts) {\r\n if (opts === void 0) { opts = {}; }\r\n this.opts = __assign(__assign({}, defaults), opts);\r\n }\r\n /**\r\n * Adds the spinner to the given target element. If this instance is already\r\n * spinning, it is automatically removed from its previous target by calling\r\n * stop() internally.\r\n */\r\n Spinner.prototype.spin = function (target) {\r\n this.stop();\r\n this.el = document.createElement('div');\r\n this.el.className = this.opts.className;\r\n this.el.setAttribute('role', 'progressbar');\r\n css(this.el, {\r\n position: this.opts.position,\r\n width: 0,\r\n zIndex: this.opts.zIndex,\r\n left: this.opts.left,\r\n top: this.opts.top,\r\n transform: \"scale(\" + this.opts.scale + \")\",\r\n });\r\n if (target) {\r\n target.insertBefore(this.el, target.firstChild || null);\r\n }\r\n drawLines(this.el, this.opts);\r\n return this;\r\n };\r\n /**\r\n * Stops and removes the Spinner.\r\n * Stopped spinners may be reused by calling spin() again.\r\n */\r\n Spinner.prototype.stop = function () {\r\n if (this.el) {\r\n if (typeof requestAnimationFrame !== 'undefined') {\r\n cancelAnimationFrame(this.animateId);\r\n }\r\n else {\r\n clearTimeout(this.animateId);\r\n }\r\n if (this.el.parentNode) {\r\n this.el.parentNode.removeChild(this.el);\r\n }\r\n this.el = undefined;\r\n }\r\n return this;\r\n };\r\n return Spinner;\r\n}());\r\nexport { Spinner };\r\n/**\r\n * Sets multiple style properties at once.\r\n */\r\nfunction css(el, props) {\r\n for (var prop in props) {\r\n el.style[prop] = props[prop];\r\n }\r\n return el;\r\n}\r\n/**\r\n * Returns the line color from the given string or array.\r\n */\r\nfunction getColor(color, idx) {\r\n return typeof color == 'string' ? color : color[idx % color.length];\r\n}\r\n/**\r\n * Internal method that draws the individual lines.\r\n */\r\nfunction drawLines(el, opts) {\r\n var borderRadius = (Math.round(opts.corners * opts.width * 500) / 1000) + 'px';\r\n var shadow = 'none';\r\n if (opts.shadow === true) {\r\n shadow = '0 2px 4px #000'; // default shadow\r\n }\r\n else if (typeof opts.shadow === 'string') {\r\n shadow = opts.shadow;\r\n }\r\n var shadows = parseBoxShadow(shadow);\r\n for (var i = 0; i < opts.lines; i++) {\r\n var degrees = ~~(360 / opts.lines * i + opts.rotate);\r\n var backgroundLine = css(document.createElement('div'), {\r\n position: 'absolute',\r\n top: -opts.width / 2 + \"px\",\r\n width: (opts.length + opts.width) + 'px',\r\n height: opts.width + 'px',\r\n background: getColor(opts.fadeColor, i),\r\n borderRadius: borderRadius,\r\n transformOrigin: 'left',\r\n transform: \"rotate(\" + degrees + \"deg) translateX(\" + opts.radius + \"px)\",\r\n });\r\n var delay = i * opts.direction / opts.lines / opts.speed;\r\n delay -= 1 / opts.speed; // so initial animation state will include trail\r\n var line = css(document.createElement('div'), {\r\n width: '100%',\r\n height: '100%',\r\n background: getColor(opts.color, i),\r\n borderRadius: borderRadius,\r\n boxShadow: normalizeShadow(shadows, degrees),\r\n animation: 1 / opts.speed + \"s linear \" + delay + \"s infinite \" + opts.animation,\r\n });\r\n backgroundLine.appendChild(line);\r\n el.appendChild(backgroundLine);\r\n }\r\n}\r\nfunction parseBoxShadow(boxShadow) {\r\n var regex = /^\\s*([a-zA-Z]+\\s+)?(-?\\d+(\\.\\d+)?)([a-zA-Z]*)\\s+(-?\\d+(\\.\\d+)?)([a-zA-Z]*)(.*)$/;\r\n var shadows = [];\r\n for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) {\r\n var shadow = _a[_i];\r\n var matches = shadow.match(regex);\r\n if (matches === null) {\r\n continue; // invalid syntax\r\n }\r\n var x = +matches[2];\r\n var y = +matches[5];\r\n var xUnits = matches[4];\r\n var yUnits = matches[7];\r\n if (x === 0 && !xUnits) {\r\n xUnits = yUnits;\r\n }\r\n if (y === 0 && !yUnits) {\r\n yUnits = xUnits;\r\n }\r\n if (xUnits !== yUnits) {\r\n continue; // units must match to use as coordinates\r\n }\r\n shadows.push({\r\n prefix: matches[1] || '',\r\n x: x,\r\n y: y,\r\n xUnits: xUnits,\r\n yUnits: yUnits,\r\n end: matches[8],\r\n });\r\n }\r\n return shadows;\r\n}\r\n/**\r\n * Modify box-shadow x/y offsets to counteract rotation\r\n */\r\nfunction normalizeShadow(shadows, degrees) {\r\n var normalized = [];\r\n for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) {\r\n var shadow = shadows_1[_i];\r\n var xy = convertOffset(shadow.x, shadow.y, degrees);\r\n normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end);\r\n }\r\n return normalized.join(', ');\r\n}\r\nfunction convertOffset(x, y, degrees) {\r\n var radians = degrees * Math.PI / 180;\r\n var sin = Math.sin(radians);\r\n var cos = Math.cos(radians);\r\n return [\r\n Math.round((x * cos + y * sin) * 1000) / 1000,\r\n Math.round((-x * sin + y * cos) * 1000) / 1000,\r\n ];\r\n}\r\n","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","//----------------------------------------------------------------------------\r\n// Timer\r\n\r\nclass Timer {\r\n constructor() {\r\n this.startTime = 0;\r\n this.oldTime = 0;\r\n this.elapsedTime = 0;\r\n this.running = false;\r\n }\r\n\r\n start() {\r\n this.startTime = Timer.now();\r\n this.oldTime = this.startTime;\r\n this.running = true;\r\n }\r\n\r\n stop() {\r\n this.getElapsedTime();\r\n this.running = false;\r\n }\r\n\r\n getElapsedTime() {\r\n this.update();\r\n return this.elapsedTime;\r\n }\r\n\r\n update() {\r\n let delta = 0;\r\n if (this.running) {\r\n const newTime = Timer.now();\r\n delta = 0.001 * (newTime - this.oldTime);\r\n this.oldTime = newTime;\r\n this.elapsedTime += delta;\r\n }\r\n\r\n return delta;\r\n }\r\n}\r\n\r\nTimer.now = (function () {\r\n const p = typeof window !== 'undefined' && window.performance;\r\n return (p && p.now) ? p.now.bind(p) : Date.now;\r\n}());\r\n\r\nexport default Timer;\r\n","import Timer from '../Timer';\r\n\r\nconst { now } = Timer;\r\n\r\nfunction createElement(tag, id, css) {\r\n const element = document.createElement(tag);\r\n element.id = id;\r\n element.style.cssText = css;\r\n return element;\r\n}\r\n\r\nclass Stats {\r\n constructor() {\r\n this.domElement = createElement('div', 'stats', 'padding:8px');\r\n this._text = createElement('p', 'fps', 'margin:0;color:silver;font-size:large');\r\n this.domElement.appendChild(this._text);\r\n\r\n this._startTime = now();\r\n this._prevTime = this._startTime;\r\n\r\n this._deltas = new Array(20);\r\n this._index = 0;\r\n this._total = 0.0;\r\n this._count = 0;\r\n }\r\n\r\n end() {\r\n const time = now();\r\n const delta = time - this._startTime;\r\n\r\n if (this._count < this._deltas.length) {\r\n this._count++;\r\n } else {\r\n this._total -= this._deltas[this._index];\r\n }\r\n this._total += delta;\r\n this._deltas[this._index] = delta;\r\n this._index = (this._index + 1) % this._deltas.length;\r\n\r\n this.ms = this._total / this._count;\r\n this.fps = 1000 / this.ms;\r\n\r\n if (time > this._prevTime + 1000) {\r\n this._text.textContent = this.fps.toPrecision(2);\r\n this._prevTime = time;\r\n }\r\n\r\n return time;\r\n }\r\n\r\n update() {\r\n this._startTime = this.end();\r\n }\r\n\r\n show(on) {\r\n if (on === undefined) {\r\n on = true;\r\n }\r\n this.domElement.style.display = on ? 'block' : 'none';\r\n }\r\n}\r\n\r\nexport default Stats;\r\n","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}\n\nmodule.exports = _isNativeFunction;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nvar setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeFunction = require(\"./isNativeFunction\");\n\nvar construct = require(\"./construct\");\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nmodule.exports = _wrapNativeSuper;","/**\r\n * This class introduces the simplest event system.\r\n */\r\n\r\nimport _ from 'lodash';\r\n\r\nfunction isUndefOrEqual(param, value) {\r\n return !param || param === value;\r\n}\r\n\r\n/**\r\n * Creates empty dispatcher.\r\n *\r\n * @exports EventDispatcher\r\n * @constructor\r\n */\r\nfunction EventDispatcher() {\r\n this._handlers = {};\r\n}\r\n\r\n/**\r\n * Binds callback on specific event type. Optional `context` parameter\r\n * could be used as 'this' for the `callback`.\r\n * @param {string} type Event name.\r\n * @param {function} callback Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.addEventListener = function (type, callback, context) {\r\n let handlers = this._handlers[type];\r\n\r\n if (!handlers) {\r\n this._handlers[type] = [];\r\n handlers = this._handlers[type];\r\n }\r\n\r\n const params = [callback, context];\r\n function _checkPar(par) {\r\n return par[0] === params[0] && par[1] === params[1];\r\n }\r\n\r\n if (_.find(handlers, _checkPar) === undefined) {\r\n handlers.push(params);\r\n }\r\n};\r\n\r\n/**\r\n * Removes a previously-bound callback function from an object.\r\n * If no `context` is specified, all versions of the `callback` with different\r\n * contexts will be removed.\r\n * If no `callback` is specified, all callbacks of the `type` will be removed.\r\n * If no `type` is specified, callbacks for all events will be removed.\r\n * @param {?string} [type] Event type.\r\n * @param {function} [callback] Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.removeEventListener = function (type, callback, context) {\r\n const self = this;\r\n _.forEach(self._handlers, (handler, ev) => {\r\n _.remove(handler, (values) => isUndefOrEqual(type, ev)\r\n && isUndefOrEqual(callback, values[0])\r\n && isUndefOrEqual(context, values[1] || self));\r\n });\r\n\r\n this._handlers = _.omitBy(self._handlers, (handler) => handler.length === 0);\r\n};\r\n\r\n/**\r\n * Makes all the callbacks for the specific `event` to trigger.\r\n * @param {Object} event Event.\r\n * @param {string} event.type Type of the event.\r\n */\r\nEventDispatcher.prototype.dispatchEvent = function (event) {\r\n const self = this;\r\n\r\n _.forEach(this._handlers[event.type], (callback) => {\r\n const context = callback[1] || self;\r\n callback[0].apply(context, [event]);\r\n });\r\n};\r\n\r\nexport default EventDispatcher;\r\n","/**\r\n * This module contains class for logging.\r\n * Returns an instance of a logger that have already been created.\r\n * Allows users to log messages for five different levels,\r\n * enable console output and catch signal on each message.\r\n */\r\nimport _ from 'lodash';\r\nimport EventDispatcher from './EventDispatcher';\r\n\r\nconst priorities = {\r\n debug: 0,\r\n info: 1,\r\n report: 2,\r\n warn: 3,\r\n error: 4,\r\n};\r\n\r\n/**\r\n * Create new Logger.\r\n *\r\n * @exports Logger\r\n * @extends EventDispatcher\r\n * @constructor\r\n */\r\nfunction Logger() {\r\n EventDispatcher.call(this);\r\n /** Boolean flag that toggles output to browser console.\r\n * @type {boolean}\r\n */\r\n this.console = false;\r\n this._priority = priorities.warn;\r\n}\r\n\r\nLogger.prototype = Object.create(EventDispatcher.prototype);\r\nLogger.prototype.constructor = Logger;\r\n\r\n/**\r\n * Create new clean instance of the logger.\r\n * @returns {Logger}\r\n */\r\nLogger.prototype.instantiate = function () {\r\n return new Logger();\r\n};\r\n\r\nfunction verify(number) {\r\n if (!_.isNumber(number)) {\r\n throw new Error('Wrong log level specified!');\r\n }\r\n return number;\r\n}\r\n\r\n/**\r\n * @property {string} current threshold for signals and console output.\r\n * @name Logger#level\r\n */\r\nObject.defineProperty(Logger.prototype, 'level', {\r\n get() {\r\n return _.findKey(priorities, (value) => value === this._priority);\r\n },\r\n set(level) {\r\n this._priority = verify(priorities[level]);\r\n },\r\n});\r\n\r\n/**\r\n * Returns the list of all possible level values.\r\n * @returns {Array}\r\n */\r\nLogger.prototype.levels = function () {\r\n return Object.keys(priorities);\r\n};\r\n\r\n/**\r\n * Add new message with specified level.\r\n * @param {string} level - level of the message, must be one of the\r\n * {'debug' | 'info' | 'report' | 'warn' | 'error'}\r\n * @param {string} message\r\n */\r\nLogger.prototype.message = function (level, message) {\r\n const priority = verify(priorities[level]);\r\n this._message(priority, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('debug', ...);\r\n * @param message\r\n */\r\nLogger.prototype.debug = function (message) {\r\n this._message(priorities.debug, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('info', ...);\r\n * @param message\r\n */\r\nLogger.prototype.info = function (message) {\r\n this._message(priorities.info, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('report', ...);\r\n * @param message\r\n */\r\nLogger.prototype.report = function (message) {\r\n this._message(priorities.report, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('warn', ...);\r\n * @param message\r\n */\r\nLogger.prototype.warn = function (message) {\r\n this._message(priorities.warn, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('error', ...);\r\n * @param message\r\n */\r\nLogger.prototype.error = function (message) {\r\n this._message(priorities.error, message);\r\n};\r\n\r\n/**\r\n * Add new message with specified priority.\r\n * @param {number} priority - priority of the message\r\n * @param {string} message\r\n * @private\r\n */\r\nLogger.prototype._message = function (priority, message) {\r\n if (priority < this._priority) {\r\n return;\r\n }\r\n const level = _.findKey(priorities, (value) => value === priority);\r\n message = String(message);\r\n if (this.console) {\r\n const output = `miew:${level}: ${message}`;\r\n if (level === 'error') {\r\n console.error(output); // NOSONAR\r\n } else if (level === 'warn') {\r\n console.warn(output); // NOSONAR\r\n } else {\r\n console.log(output); // NOSONAR\r\n }\r\n }\r\n this.dispatchEvent({ type: 'message', level, message });\r\n};\r\n\r\nexport default new Logger();\r\n","import _ from 'lodash';\r\nimport logger from './utils/logger';\r\n\r\n\r\nconst browserType = {\r\n DEFAULT: 0,\r\n SAFARI: 1,\r\n};\r\n//----------------------------------------------------------------------------\r\n// Query string\r\n\r\n/**\r\n * Escape only dangerous chars in a query string component, use a plus instead of a space.\r\n *\r\n * [RFC 3986](https://tools.ietf.org/html/rfc3986) allows the following chars in the query (see 3.4):\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! $ & ' ( ) * + , ; = : @ / ?\r\n *\r\n * For query string elements we need to escape ampersand, equal sign, and plus,\r\n * but encodeURIComponent() function encodes anything except for the following:\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! ' ( ) *\r\n *\r\n * @param {string} text - key or value to encode\r\n * @param {string} excludeExp - regexp for symbols to exclude from encoding\r\n * @returns {string} encoded string\r\n */\r\nfunction encodeQueryComponent(text, excludeExp) {\r\n const encode = (code) => String.fromCharCode(parseInt(code.substr(1), 16));\r\n return encodeURIComponent(text).replace(excludeExp, encode).replace(/%20/g, '+');\r\n}\r\n\r\n/**\r\n * Unescape dangerous chars in a query string component.\r\n *\r\n * @param {string} text - encoded key or value\r\n * @returns {string} decoded string\r\n * @see {@link encodeQueryComponent}\r\n */\r\nfunction decodeQueryComponent(text) {\r\n return decodeURIComponent(text.replace(/\\+/g, ' '));\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Array} array of (key, value) pairs.\r\n */\r\nfunction getUrlParameters(url) {\r\n url = url || window.location.search;\r\n\r\n const query = url.substring(url.indexOf('?') + 1);\r\n const search = /([^&=]+)=?([^&]*)/g;\r\n const result = [];\r\n let match;\r\n\r\n while ((match = search.exec(query)) !== null) { // eslint-disable-line no-cond-assign\r\n result.push([decodeQueryComponent(match[1]), decodeQueryComponent(match[2])]);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters as a hash.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Object}\r\n */\r\nfunction getUrlParametersAsDict(url) {\r\n const result = {};\r\n const a = getUrlParameters(url);\r\n for (let i = 0; i < a.length; ++i) {\r\n const [key, value] = a[i];\r\n result[key] = value;\r\n }\r\n return result;\r\n}\r\n\r\nfunction resolveURL(str) {\r\n if (typeof URL !== 'undefined') {\r\n try {\r\n if (typeof window !== 'undefined') {\r\n return new URL(str, window.location).href;\r\n }\r\n return new URL(str).href;\r\n } catch (error) {\r\n // IE 11 has a URL object with no constructor available so just try a different approach instead\r\n }\r\n }\r\n if (typeof document !== 'undefined') {\r\n const anchor = document.createElement('a');\r\n anchor.href = str;\r\n return anchor.href;\r\n }\r\n return str;\r\n}\r\n\r\n/**\r\n * Generates regular expression object that includes all symbols\r\n * listed in the argument\r\n * @param symbolStr {string} - String containing characters list.\r\n * @returns {RegExp} - Regular expression.\r\n */\r\nfunction generateRegExp(symbolStr) {\r\n const symbolList = [];\r\n\r\n for (let i = 0, n = symbolStr.length; i < n; ++i) {\r\n symbolList[symbolList.length] = symbolStr[i].charCodeAt(0).toString(16);\r\n }\r\n\r\n const listStr = symbolList.join('|');\r\n\r\n return new RegExp(`%(?:${listStr})`, 'gi');\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Create HTML element\r\n\r\nfunction createElement(tag, attrs, content) {\r\n const element = document.createElement(tag);\r\n let i;\r\n let n;\r\n if (attrs) {\r\n const keys = Object.keys(attrs);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n element.setAttribute(key, attrs[key]);\r\n }\r\n }\r\n if (content) {\r\n if (!(content instanceof Array)) {\r\n content = [content];\r\n }\r\n for (i = 0, n = content.length; i < n; ++i) {\r\n const child = content[i];\r\n if (typeof child === 'string') {\r\n element.appendChild(document.createTextNode(child));\r\n } else if (child instanceof HTMLElement) {\r\n element.appendChild(child);\r\n }\r\n }\r\n }\r\n return element;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Easy inheritance\r\n\r\n/**\r\n * Derive the class from the base.\r\n * @param cls {function} - Class (constructor) to derive.\r\n * @param base {function} - Class (constructor) to derive from.\r\n * @param members {object=} - Optional instance members to add.\r\n * @param statics {object=} - Optional static class members to add.\r\n * @returns {function} Original class.\r\n */\r\nfunction deriveClass(cls, base, members, statics) {\r\n cls.prototype = _.assign(Object.create(base.prototype), { constructor: cls }, members);\r\n if (statics) {\r\n _.assign(cls, statics);\r\n }\r\n return cls;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Deep prototyping\r\n\r\nfunction deriveDeep(obj, needZeroOwnProperties) {\r\n let res = obj;\r\n let i;\r\n let n;\r\n if (obj instanceof Array) {\r\n res = new Array(obj.length);\r\n for (i = 0, n = obj.length; i < n; ++i) {\r\n res[i] = deriveDeep(obj[i]);\r\n }\r\n } else if (obj instanceof Object) {\r\n res = Object.create(obj);\r\n const keys = Object.keys(obj);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = obj[key];\r\n const copy = deriveDeep(value);\r\n if (copy !== value) {\r\n res[key] = copy;\r\n }\r\n }\r\n if (needZeroOwnProperties && Object.keys(res).length > 0) {\r\n res = Object.create(res);\r\n }\r\n }\r\n return res;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Colors\r\n\r\nfunction hexColor(color) {\r\n const hex = (`0000000${color.toString(16)}`).substr(-6);\r\n return `#${hex}`;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Debug tracing\r\n\r\nfunction DebugTracer(namespace) {\r\n let enabled = false;\r\n\r\n this.enable = function (on) {\r\n enabled = on;\r\n };\r\n\r\n let indent = 0;\r\n const methods = Object.keys(namespace);\r\n\r\n function wrap(method_, name_) {\r\n return function (...args) {\r\n const spaces = DebugTracer.spaces.substr(0, indent * 2);\r\n if (enabled) {\r\n logger.debug(`${spaces + name_} {`);\r\n }\r\n indent++;\r\n const result = method_.apply(this, args); // eslint-disable-line no-invalid-this\r\n indent--;\r\n if (enabled) {\r\n logger.debug(`${spaces}} // ${name_}`);\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n for (let i = 0, n = methods.length; i < n; ++i) {\r\n const name = methods[i];\r\n const method = namespace[name];\r\n if (method instanceof Function && name !== 'constructor') {\r\n namespace[name] = wrap(method, name);\r\n }\r\n }\r\n}\r\n\r\nDebugTracer.spaces = ' ';\r\n\r\nclass OutOfMemoryError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'OutOfMemoryError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction allocateTyped(TypedArrayName, size) {\r\n let result = null;\r\n try {\r\n result = new TypedArrayName(size);\r\n } catch (e) {\r\n if (e instanceof RangeError) {\r\n throw new OutOfMemoryError(e.message);\r\n } else {\r\n throw e;\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Float array conversion\r\n\r\nfunction bytesToBase64(/** ArrayBuffer */ buffer) {\r\n const bytes = new Uint8Array(buffer);\r\n let binary = '';\r\n for (let i = 0; i < bytes.byteLength; i++) {\r\n binary += String.fromCharCode(bytes[i]);\r\n }\r\n return window.btoa(binary);\r\n}\r\n\r\nfunction bytesFromBase64(/** string */ str) {\r\n const binary = window.atob(str);\r\n const bytes = new Uint8Array(binary.length);\r\n for (let i = 0; i < bytes.length; ++i) {\r\n bytes[i] = binary[i].charCodeAt(0);\r\n }\r\n return bytes.buffer;\r\n}\r\n\r\nfunction arrayToBase64(/** number[] */ array, /** function */ TypedArrayClass) {\r\n return bytesToBase64(new TypedArrayClass(array).buffer);\r\n}\r\n\r\nfunction arrayFromBase64(/** string */ str, /** function */ TypedArrayClass) {\r\n return Array.prototype.slice.call(new TypedArrayClass(bytesFromBase64(str)));\r\n}\r\n\r\n// NOTE: this is 1-level comparison\r\nfunction compareOptionsWithDefaults(opts, defOpts) {\r\n const optsStr = [];\r\n if (defOpts && opts) {\r\n const keys = Object.keys(opts);\r\n for (let p = 0; p < keys.length; ++p) {\r\n const key = keys[p];\r\n const value = opts[key];\r\n // TODO add processing for tree structure\r\n if (!(value instanceof Object) && typeof defOpts[key] !== 'undefined' && defOpts[key] !== value) {\r\n optsStr.push(`${key}:${value}`);\r\n }\r\n }\r\n if (optsStr.length > 0) {\r\n return `!${optsStr.join()}`;\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nfunction isAlmostPlainObject(o) {\r\n if (_.isPlainObject(o)) {\r\n return true;\r\n }\r\n const proto = o && Object.getPrototypeOf(o);\r\n return !!proto && !proto.hasOwnProperty('constructor') && isAlmostPlainObject(proto);\r\n}\r\n\r\n/**\r\n * Build an object that contains properties (and subproperties) of `src` different from those\r\n * in `dst`. Objects are parsed recursively, other values (including arrays) are compared for\r\n * equality using `_.isEqual()`.\r\n * @param {!object} src - a new object to compare, may contain changed or new properties\r\n * @param {!object} dst - an old reference object\r\n */\r\nfunction objectsDiff(src, dst) {\r\n const diff = {};\r\n _.forIn(src, (srcValue, key) => {\r\n const dstValue = dst[key];\r\n if (isAlmostPlainObject(srcValue) && isAlmostPlainObject(dstValue)) {\r\n const deepDiff = objectsDiff(srcValue, dstValue);\r\n if (!_.isEmpty(deepDiff)) {\r\n diff[key] = deepDiff;\r\n }\r\n } else if (!_.isEqual(srcValue, dstValue)) {\r\n diff[key] = srcValue;\r\n }\r\n });\r\n return diff;\r\n}\r\n\r\nfunction forInRecursive(object, callback) {\r\n function iterateThrough(obj, prefix) {\r\n _.forIn(obj, (value, key) => {\r\n const newPref = prefix + (prefix.length > 0 ? '.' : '');\r\n if (value instanceof Object) {\r\n iterateThrough(value, newPref + key);\r\n } else if (value !== undefined) {\r\n callback(value, newPref + key);\r\n }\r\n });\r\n }\r\n iterateThrough(object, '');\r\n}\r\n\r\nfunction enquoteString(value) {\r\n if (_.isString(value)) {\r\n return `\"${value.replace(/\"/g, '\\\\\"')}\"`;\r\n }\r\n return value;\r\n}\r\n\r\nfunction unquoteString(value) {\r\n if (!_.isString(value)) {\r\n return value;\r\n }\r\n if (value[0] === '\"' && value[value.length - 1] === '\"') {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\\"/g, '\"');\r\n }\r\n if (value[0] === \"'\" && value[value.length - 1] === \"'\") {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\'/g, \"'\");\r\n }\r\n throw new SyntaxError('Incorrect string format, can\\'t unqute it');\r\n}\r\n\r\nfunction getFileExtension(fileName) {\r\n return fileName.slice((Math.max(0, fileName.lastIndexOf('.')) || Infinity));\r\n}\r\n\r\nfunction splitFileName(fileName) {\r\n const ext = getFileExtension(fileName);\r\n const name = fileName.slice(0, fileName.length - ext.length);\r\n return [name, ext];\r\n}\r\n\r\nfunction dataUrlToBlob(url) {\r\n const parts = url.split(/[:;,]/);\r\n const partsCount = parts.length;\r\n if (partsCount >= 3 && parts[partsCount - 2] === 'base64') {\r\n return new Blob([bytesFromBase64(parts[partsCount - 1])]);\r\n }\r\n return null;\r\n}\r\n\r\nfunction getBrowser() {\r\n if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1\r\n && navigator.userAgent\r\n && navigator.userAgent.indexOf('CriOS') === -1\r\n && navigator.userAgent.indexOf('FxiOS') === -1) {\r\n return browserType.SAFARI;\r\n }\r\n return browserType.DEFAULT;\r\n}\r\n\r\nfunction shotOpen(url) {\r\n if (typeof window !== 'undefined') {\r\n window.open().document.write(``);\r\n }\r\n}\r\n\r\nfunction shotDownload(dataUrl, filename) {\r\n if (!dataUrl || dataUrl.substr(0, 5) !== 'data:') {\r\n return;\r\n }\r\n if (!filename) {\r\n filename = ['screenshot-', +new Date(), '.png'].join('');\r\n }\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(dataUrlToBlob(dataUrl), filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(dataUrlToBlob(dataUrl));\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction download(data, filename, type) {\r\n const blobData = new Blob([data]);\r\n\r\n if (!filename) {\r\n filename = ['data', +new Date()].join('');\r\n }\r\n\r\n if (!type) {\r\n filename += blobData.type || '.bin';\r\n } else {\r\n filename += `.${type}`;\r\n }\r\n\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(blobData, filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(blobData);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction copySubArrays(src, dst, indices, itemSize) {\r\n for (let i = 0, n = indices.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n dst[i * itemSize + j] = src[indices[i] * itemSize + j];\r\n }\r\n }\r\n}\r\n\r\nfunction shallowCloneNode(node) {\r\n const newNode = node.cloneNode(true);\r\n newNode.worldPos = node.worldPos;\r\n // .style property is readonly, so \"newNode.style = node.style;\" won't work (and we don't need it, right?)\r\n return newNode;\r\n}\r\n\r\nconst unquotedStringRE = /^[a-zA-Z0-9_]*$/;\r\nconst enquoteHelper = ['\"', '', '\"'];\r\n\r\n// verify and correct if needed selctor identifier\r\nfunction correctSelectorIdentifier(value) {\r\n if (unquotedStringRE.test(value)) {\r\n return value;\r\n }\r\n // quote incorrect identifier\r\n enquoteHelper[1] = value;\r\n return enquoteHelper.join('');\r\n}\r\n\r\n/**\r\n * Concatenates two TypedArray. Doesn't check null refs o type equality\r\n * Attention! It must be use very rarely because requires memory reallocation every time. Use MergeTypedArraysUnsafe to\r\n * unite array of subarrays.\r\n * @param{TypedArray} first - destination array\r\n * @param{TypedArray} second - source array\r\n * @returns{TypedArray} resulting concatenated array\r\n */\r\nfunction concatTypedArraysUnsafe(first, second) {\r\n const result = new first.constructor(first.length + second.length);\r\n result.set(first);\r\n result.set(second, first.length);\r\n return result;\r\n}\r\n\r\n/**\r\n * Merges array of TypedArray into TypedArray. Doesn't check null refs o type equality\r\n * @param{array} array - source array of subarrays\r\n * @returns{TypedArray} resulting merged array\r\n */\r\nfunction mergeTypedArraysUnsafe(array) {\r\n if (array.length <= 0) {\r\n return null;\r\n }\r\n // count the size\r\n const size = array.reduce((acc, cur) => acc + cur.length, 0);\r\n // create combined array\r\n const result = new array[0].constructor(size);\r\n for (let i = 0, start = 0; i < array.length; i++) {\r\n const count = array[i].length;\r\n result.set(array[i], start);\r\n start += count;\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Exports\r\n\r\nexport default {\r\n browserType,\r\n encodeQueryComponent,\r\n decodeQueryComponent,\r\n getUrlParameters,\r\n getUrlParametersAsDict,\r\n resolveURL,\r\n generateRegExp,\r\n createElement,\r\n deriveClass,\r\n deriveDeep,\r\n hexColor,\r\n DebugTracer,\r\n OutOfMemoryError,\r\n allocateTyped,\r\n bytesFromBase64,\r\n bytesToBase64,\r\n arrayFromBase64,\r\n arrayToBase64,\r\n compareOptionsWithDefaults,\r\n objectsDiff,\r\n forInRecursive,\r\n enquoteString,\r\n unquoteString,\r\n getBrowser,\r\n shotOpen,\r\n shotDownload,\r\n copySubArrays,\r\n shallowCloneNode,\r\n correctSelectorIdentifier,\r\n getFileExtension,\r\n splitFileName,\r\n download,\r\n concatTypedArraysUnsafe,\r\n mergeTypedArraysUnsafe,\r\n};\r\n","import EventDispatcher from './EventDispatcher';\r\n\r\nexport default class JobHandle extends EventDispatcher {\r\n constructor() {\r\n super();\r\n this._shouldCancel = false;\r\n }\r\n\r\n cancel() {\r\n this._shouldCancel = true;\r\n this.dispatchEvent({ type: 'cancel' });\r\n }\r\n\r\n shouldCancel() {\r\n return this._shouldCancel;\r\n }\r\n\r\n // slaves use this to notify master about their events\r\n // master routes these notifications to a single event slot\r\n notify(event) {\r\n this.dispatchEvent({ type: 'notification', slaveEvent: event });\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport utils from './utils';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\n\r\nconst VERSION = 0;\r\n\r\n//----------------------------------------------------------------------------\r\n// DEFAULT SETTINGS\r\n//----------------------------------------------------------------------------\r\n\r\n/**\r\n * Polygonal complexity settings.\r\n *\r\n * @typedef PolyComplexity\r\n * @property {number} poor\r\n * @property {number} low\r\n * @property {number} medium\r\n * @property {number} high\r\n * @property {number} ultra\r\n */\r\n\r\n/**\r\n * @alias SettingsObject\r\n * @namespace\r\n */\r\nconst defaults = {\r\n /**\r\n * Default options for all available modes.\r\n * Use {@link Mode.id} as a dictionary key to access mode options.\r\n *\r\n * Usually you don't need to override these settings. You may specify mode options as a parameter during\r\n * {@link Mode} construction.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {LinesModeOptions} LN - Lines mode options.\r\n * @property {LicoriceModeOptions} LC - Licorice mode options.\r\n * @property {BallsAndSticksModeOptions} BS - Balls and Sticks mode options.\r\n * @property {VanDerWaalsModeOptions} VW - Van der Waals mode options.\r\n * @property {TraceModeOptions} TR - Trace mode options.\r\n * @property {TubeModeOptions} TU - Tube mode options.\r\n * @property {CartoonModeOptions} CA - Cartoon mode options.\r\n * @property {QuickSurfaceModeOptions} QS - Contact Surface mode options.\r\n * @property {IsoSurfaceSASModeOptions} SA - Solvent Accessible Surface mode options.\r\n * @property {IsoSurfaceSESModeOptions} SE - Solvent Excluded Surface mode options.\r\n * @property {ContactSurfaceModeOptions} CS - Contact Surface mode options.\r\n * @property {TextModeOptions} TX - Text mode options.\r\n * @property {VolumeDensityModeOptions} VD - Volume Density mode options.\r\n */\r\n modes: {\r\n //----------------------------------------------------------------------------\r\n // BALLS AND STICKS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Balls and Sticks mode options.\r\n *\r\n * @typedef BallsAndSticksModeOptions\r\n *\r\n * @property {number} atom - Sphere radius as a fraction of Van der Waals atom radius.\r\n * @property {number} bond - Cylinder radius in angstroms.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n BS: {\r\n atom: 0.23,\r\n bond: 0.15,\r\n space: 0.5,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VAN DER WAALS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Van der Waals mode options.\r\n *\r\n * @typedef VanDerWaalsModeOptions\r\n *\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VW: {\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 8,\r\n high: 16,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LINES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Lines mode options.\r\n *\r\n * @typedef LinesModeOptions\r\n *\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {number} offsarom - Offset between bonds and aromatic cycle.\r\n * @property {number} chunkarom - Number of pieces in a-loop arc, corresponding to atom.\r\n * @property {number} atom - Collision radius for atoms picking.\r\n * @property {number} lineWidth - Line width in pixels (not used in thin lines).\r\n */\r\n LN: {\r\n multibond: true,\r\n showarom: true,\r\n offsarom: 0.2,\r\n chunkarom: 10,\r\n atom: 0.23,\r\n lineWidth: 2,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LICORICE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Licorice mode options.\r\n *\r\n * @typedef LicoriceModeOptions\r\n *\r\n * @property {number} bond - Bond cylinder radius.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Poly complexity values for render modes.\r\n */\r\n LC: {\r\n bond: 0.20,\r\n space: 0.0,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SAS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Accessible Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSASModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SA: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Excluded Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSESModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SE: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // QUICK SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Quick Surface mode options.\r\n *\r\n * @typedef QuickSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} scale - Radius scale for the surface being built.\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} gaussLim - Gauss lim for coloring the bigger the value, the smoother our colors are.\r\n * @property {PolyComplexity} gridSpacing - Poly complexity values for render modes. In this case the value\r\n * corresponds to the grid density.\r\n */\r\n QS: {\r\n isoValue: 0.5,\r\n gaussLim: {\r\n poor: 1.5,\r\n low: 2.0,\r\n medium: 2.5,\r\n high: 3.0,\r\n ultra: 4.0,\r\n },\r\n scale: 1.0,\r\n wireframe: false,\r\n gridSpacing: {\r\n poor: 2,\r\n low: 1.5,\r\n medium: 1,\r\n high: 0.5,\r\n ultra: 0.25,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CONTACT SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Contact Surface mode options.\r\n *\r\n * @typedef ContactSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} probeRadius - Probe radius.\r\n * @property {number} probePositions\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Radius scale for the surface being built.\r\n * Poly complexity values for render modes. In this case the value corresponds to the grid density.\r\n */\r\n CS: {\r\n probeRadius: 1.4,\r\n isoValue: 1.5,\r\n wireframe: false,\r\n probePositions: 30,\r\n polyComplexity: {\r\n poor: 0.5,\r\n low: 1.0,\r\n medium: 1.5,\r\n high: 1.75,\r\n ultra: 2.0,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TRACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Trace mode options.\r\n *\r\n * @typedef TraceModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n TR: {\r\n radius: 0.30,\r\n polyComplexity: {\r\n poor: 12,\r\n low: 16,\r\n medium: 32,\r\n high: 64,\r\n ultra: 64,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TUBE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Tube mode options.\r\n *\r\n * @typedef TubeModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {number} tension - Tension for interpolation.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n TU: {\r\n radius: 0.30,\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CARTOON\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Cartoon mode options.\r\n *\r\n * @typedef CartoonModeOptions\r\n *\r\n * @property {number} radius - Standard tube radius.\r\n * @property {number} depth - Height of the secondary structure ribbon.\r\n * @property {number} tension - Tension for interpolation.\r\n * @proprety {object} ss - Secondary structure parameters.\r\n * @proprety {object} ss.helix - Options for helices render.\r\n * @proprety {number} ss.helix.width - Width of the secondary structure ribbon.\r\n * @proprety {number} ss.helix.arrow - Secondary structure's arrow width.\r\n * @proprety {object} ss.strand - Options for strands render.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * polyComplexity must be even for producing symmetric arrows.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n CA: {\r\n radius: 0.30,\r\n depth: 0.25,\r\n ss: {\r\n helix: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n strand: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n },\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TEXT\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Text mode options.\r\n *\r\n * @typedef TextModeOptions\r\n *\r\n * @property {string} template - Format string for building output text.\r\n * @property {string} horizontalAlign - Text alignment ('left', 'right', 'center').\r\n * @property {string} verticalAlign - Vertical text box alignment ('top', 'bottom', 'middle').\r\n * @property {number} dx - Text offset x in angstroms.\r\n * @property {number} dy - Text offset y in angstroms.\r\n * @property {number} dz - Text offset z in angstroms.\r\n * @property {string} fg - Color rule for foreground.\r\n * @property {string} bg - Color rule for background.\r\n * @property {boolean} showBg - Flag, that toggles background rendering.\r\n *\r\n */\r\n TX: {\r\n template: '{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}',\r\n horizontalAlign: 'center',\r\n verticalAlign: 'middle',\r\n dx: 0,\r\n dy: 0,\r\n dz: 1,\r\n fg: 'none',\r\n bg: '0x202020',\r\n showBg: true,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VOLUME DENSITY\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Volume density mode options.\r\n *\r\n * @typedef VolumeDensityModeOptions\r\n *\r\n * @property {number} kSigma - Noise threshold coefficient.\r\n * @property {boolean} frame - flag, that turns on box frame painting.\r\n * @property {boolean} isoMode - flag, that turns on IsoSurface mode instead of Volume Rendering.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VD: {\r\n kSigma: 1.0,\r\n kSigmaMed: 2.0,\r\n kSigmaMax: 4.0,\r\n frame: true,\r\n isoMode: false,\r\n polyComplexity: {\r\n poor: 2,\r\n low: 3,\r\n medium: 4,\r\n high: 8,\r\n ultra: 10,\r\n },\r\n },\r\n },\r\n\r\n /**\r\n * Default options for all available colorers.\r\n * Use {@link Colorer.id} as a dictionary key to access colorer options.\r\n *\r\n * Usually you don't need to override these settings. You may specify colorer options as a parameter during\r\n * {@link Colorer} construction.\r\n *\r\n * Not all colorers have options.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {ElementColorerOptions} EL - Element colorer options.\r\n * @property {SequenceColorerOptions} SQ - Sequence colorer options.\r\n * @property {MoleculeColorerOptions} MO - Molecule colorer options.\r\n * @property {UniformColorerOptions} UN - Uniform colorer options.\r\n * @property {ConditionalColorerOptions} CO - Conditional colorer options.\r\n * @property {TemperatureColorerOptions} TM - Temperature colorer options.\r\n * @property {OccupancyColorerOptions} OC - Occupancy colorer options.\r\n * @property {HydrophobicityColorerOptions} HY - Hydrophobicity colorer options.\r\n */\r\n colorers: {\r\n /**\r\n * Element colorer options.\r\n *\r\n * @typedef ElementColorerOptions\r\n *\r\n * @property {number} carbon - Carbon color or -1 to use default.\r\n */\r\n EL: {\r\n carbon: -1,\r\n },\r\n\r\n /**\r\n * Uniform colorer options.\r\n *\r\n * @typedef UniformColorerOptions\r\n *\r\n * @property {number} color - Single color to paint with.\r\n */\r\n UN: {\r\n color: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Conditional colorer options.\r\n *\r\n * @typedef ConditionalColorerOptions\r\n *\r\n * @property {string} subset - Selector string.\r\n * @property {number} color - Color of selected atoms.\r\n * @property {number} baseColor - Color of other atoms.\r\n */\r\n CO: {\r\n subset: 'charged',\r\n color: 0xFF0000,\r\n baseColor: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Carbon colorer options.\r\n *\r\n * @typedef CarbonColorerOptions\r\n *\r\n * @property {number} color - Single color to paint carbons\r\n * @property {number} factor - Color factor for not carbon atoms.\r\n */\r\n CB: {\r\n color: 0x909090,\r\n factor: 0.6,\r\n },\r\n\r\n /**\r\n * Sequence colorer options.\r\n *\r\n * @typedef SequenceColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n SQ: {\r\n gradient: 'rainbow',\r\n },\r\n\r\n /**\r\n * Temperature colorer options.\r\n *\r\n * @typedef TemperatureColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n * @property {number} min - Minimal temperature.\r\n * @property {number} max - Maximal temperature.\r\n */\r\n TM: {\r\n gradient: 'temp',\r\n min: 5,\r\n max: 40,\r\n },\r\n\r\n /**\r\n * Occupancy colorer options.\r\n *\r\n * @typedef OccupancyColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n OC: {\r\n gradient: 'reds',\r\n },\r\n\r\n /**\r\n * Hydrophobicity colorer options.\r\n *\r\n * @typedef HydrophobicityColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n HY: {\r\n gradient: 'blue-red',\r\n },\r\n\r\n /**\r\n * Molecule colorer options.\r\n *\r\n * @typedef MoleculeColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n MO: {\r\n gradient: 'rainbow',\r\n },\r\n },\r\n\r\n /*\r\n * Use antialiasing in WebGL.\r\n * @type {boolean}\r\n */\r\n antialias: true,\r\n\r\n /*\r\n * Camera field of view in degrees.\r\n * @type {number}\r\n */\r\n camFov: 45.0,\r\n\r\n /*\r\n * Camera near plane distance.\r\n * @type {number}\r\n */\r\n camNear: 0.5,\r\n\r\n /*\r\n * Camera far plane distance.\r\n * @type {number}\r\n */\r\n camFar: 100.0,\r\n\r\n camDistance: 2.5,\r\n\r\n radiusToFit: 1.0,\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogNearFactor: 0.5, // [0, 1]\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogFarFactor: 1, // [0, 1]\r\n fogAlpha: 1.0,\r\n fogColor: 0x000000,\r\n fogColorEnable: false,\r\n\r\n /**\r\n * Palette used for molecule coloring.\r\n * @type {string}\r\n */\r\n palette: 'JM',\r\n\r\n /*\r\n * Geometry resolution.\r\n * @type {string}\r\n */\r\n resolution: 'medium',\r\n\r\n autoResolution: false/* true */,\r\n\r\n autoPreset: true,\r\n\r\n preset: 'default', // TODO: remove 'preset' from settings, implement autodetection\r\n\r\n presets: {\r\n // Default\r\n default: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n empty: [],\r\n\r\n // Wireframe\r\n wire: [{\r\n mode: 'LN',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Small molecules\r\n small: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Proteins, nucleic acids etc.\r\n macro: [{\r\n mode: 'CA',\r\n colorer: 'SS',\r\n selector: 'not hetatm',\r\n material: 'SF',\r\n }, {\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'hetatm and not water',\r\n material: 'SF',\r\n }],\r\n },\r\n\r\n objects: {\r\n line: {\r\n color: 0xFFFFFFFF,\r\n dashSize: 0.3,\r\n gapSize: 0.05,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n\r\n bg: {\r\n color: 0x202020,\r\n transparent: false,\r\n },\r\n\r\n draft: {\r\n clipPlane: false,\r\n clipPlaneFactor: 0.5,\r\n clipPlaneSpeed: 0.00003,\r\n },\r\n\r\n /*\r\n * Separate group for plugins.\r\n * Each plugin handles its field by itself.\r\n */\r\n plugins: {\r\n\r\n },\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n axes: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fog: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fps: true,\r\n\r\n /**\r\n * Switch using of z-sprites for sphere and cylinder geometry\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zSprites: true,\r\n\r\n isoSurfaceFakeOpacity: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n suspendRender: true,\r\n\r\n nowater: false,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autobuild: true,\r\n\r\n /**\r\n * Anti-aliasing.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fxaa: true,\r\n /**\r\n * Outline depths\r\n * @type {boolean}\r\n * @instance\r\n */\r\n outline: {\r\n on: false,\r\n color: 0x000000,\r\n threshold: 0.1,\r\n thickness: 1,\r\n },\r\n\r\n /**\r\n * Ambient Occlusion special effect.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n ao: false,\r\n\r\n /**\r\n * Shadows options.\r\n *\r\n * @property {boolean} shadowMap - enable/disable.\r\n * @property {string} basic/percentage-closer filtering/non-uniform randomizing pcf.\r\n * @property {number} radius for percentage-closer filtering.\r\n */\r\n shadow: {\r\n on: false,\r\n type: 'random'/* basic, pcf, random */,\r\n radius: 1.0,\r\n },\r\n\r\n /**\r\n * Auto-rotation with constant speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n autoRotation: 0.0,\r\n\r\n /**\r\n * Set maximum fps for animation.\r\n * @type {number}\r\n * @instance\r\n */\r\n maxfps: 30,\r\n\r\n /**\r\n * Set fbx output precision.\r\n * @type {number}\r\n * @instance\r\n */\r\n fbxprec: 4,\r\n\r\n /**\r\n * Auto-rotation axis.\r\n *\r\n * - true: complex auto-rotation is about vertical axis\r\n * - false: rotation axis is defined by last user rotation\r\n *\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autoRotationAxisFixed: true,\r\n\r\n /**\r\n * Enable zooming with mouse wheel or pinch gesture.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zooming: true,\r\n\r\n /**\r\n * Enable picking atoms & residues with left mouse button or touch.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n picking: true,\r\n\r\n /**\r\n * Set picking mode ('atom', 'residue', 'chain', 'molecule').\r\n * @type {string}\r\n * @instance\r\n */\r\n pick: 'atom',\r\n\r\n /**\r\n * Make \"component\" and \"fragment\" editing modes available.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n editing: false,\r\n\r\n /**\r\n * Detect aromatic loops.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n aromatic: false,\r\n\r\n /**\r\n * Load only one biological unit from all those described in PDB file.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n singleUnit: true,\r\n\r\n /**\r\n * Set stereo mode ('NONE', 'SIMPLE', 'DISTORTED', 'ANAGLYPH', 'WEBVR').\r\n * @type {string}\r\n * @instance\r\n */\r\n stereo: 'NONE',\r\n\r\n /**\r\n * Enable smooth transition between views\r\n * @type {boolean}\r\n * @instance\r\n */\r\n interpolateViews: true,\r\n\r\n /**\r\n * Set transparency mode ('standard', 'prepass').\r\n * @type {string}\r\n * @instance\r\n */\r\n transparency: 'prepass',\r\n\r\n /**\r\n * Mouse translation speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n translationSpeed: 2,\r\n\r\n debug: {\r\n example: 3.5,\r\n text: 'hello!',\r\n good: true,\r\n ssaoKernelRadius: 0.7,\r\n ssaoFactor: 0.7,\r\n stereoBarrel: 0.25,\r\n },\r\n use: {\r\n multiFile: false,\r\n },\r\n};\r\n\r\n//----------------------------------------------------------------------------\r\n// SETTINGS CLASS\r\n//----------------------------------------------------------------------------\r\n\r\nfunction Settings() {\r\n EventDispatcher.call(this);\r\n\r\n this.old = null;\r\n this.now = {};\r\n this._changed = {};\r\n\r\n this.reset();\r\n}\r\n\r\nutils.deriveClass(Settings, EventDispatcher, {\r\n defaults,\r\n\r\n set(path, value) {\r\n if (_.isString(path)) {\r\n const oldValue = _.get(this.now, path);\r\n if (oldValue !== value) {\r\n _.set(this.now, path, value);\r\n this._notifyChange(path, value);\r\n }\r\n } else {\r\n const diff = utils.objectsDiff(path, this.now);\r\n if (!_.isEmpty(diff)) {\r\n _.merge(this.now, diff);\r\n this._notifyChanges(diff);\r\n }\r\n }\r\n },\r\n\r\n get(path, defaultValue) {\r\n return _.get(this.now, path, defaultValue);\r\n },\r\n\r\n reset() {\r\n const diff = utils.objectsDiff(defaults, this.now);\r\n this.now = _.cloneDeep(defaults);\r\n this.old = null;\r\n this._notifyChanges(diff);\r\n this._changed = {};\r\n },\r\n\r\n checkpoint() {\r\n this.old = _.cloneDeep(this.now);\r\n this._changed = {};\r\n },\r\n\r\n _notifyChange(path, value) {\r\n this._changed[path] = true;\r\n this.dispatchEvent({ type: `change:${path}`, value });\r\n },\r\n\r\n _notifyChanges(diff) {\r\n utils.forInRecursive(diff, (deepValue, deepPath) => {\r\n this._notifyChange(deepPath, deepValue);\r\n });\r\n },\r\n\r\n changed() {\r\n if (!this.old) {\r\n return [];\r\n }\r\n const { old, now } = this;\r\n const keys = _.filter(Object.keys(this._changed), (key) => _.get(old, key) !== _.get(now, key));\r\n return keys;\r\n },\r\n\r\n applyDiffs(diffs) {\r\n if (diffs.hasOwnProperty('VERSION') && diffs.VERSION !== VERSION) {\r\n throw new Error('Settings version does not match!');\r\n }\r\n // VERSION shouldn't be presented inside settings structure\r\n delete diffs.VERSION;\r\n this.reset();\r\n this.set(diffs);\r\n },\r\n\r\n getDiffs(versioned) {\r\n const diffs = utils.objectsDiff(this.now, defaults);\r\n if (versioned) {\r\n diffs.VERSION = VERSION;\r\n }\r\n return diffs;\r\n },\r\n\r\n setPluginOpts(plugin, opts) {\r\n defaults.plugins[plugin] = _.cloneDeep(opts);\r\n this.now.plugins[plugin] = _.cloneDeep(opts);\r\n },\r\n});\r\n\r\n\r\nexport default new Settings();\r\n","import _ from 'lodash';\r\nimport settings from './settings';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\n\r\nlet repIndex = 0;\r\n\r\nfunction asBoolean(value) {\r\n return !(!value || value === '0' || (_.isString(value) && value.toLowerCase() === 'false'));\r\n}\r\n\r\nconst adapters = {\r\n string: String,\r\n number: Number,\r\n boolean: asBoolean,\r\n};\r\n\r\n// Level 1 assignment symbol\r\nconst cL1Ass = '=';\r\n\r\nconst cOptsSep = '!';\r\n// Level 2 (options) assignment symbol\r\nconst cL2Ass = ':';\r\n// Level 2 (options) separator symbol\r\nconst cLSep = ',';\r\n\r\nconst cCommonIgnoreSymbols = '$;@/?';\r\n/**\r\n * We may (and should) leave as is for better readability:\r\n *\r\n * $ , ; : @ / ?\r\n */\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n */\r\nfunction getLevel1ExcludedExpr() {\r\n const cLevel1Ignores = ':,';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel1Ignores);\r\n}\r\n\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n * (options, etc, ..)\r\n */\r\nfunction getLevel2ExcludedExpr() {\r\n const cLevel2Ignores = ' ';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel2Ignores);\r\n}\r\n\r\nconst cL1ExclExpr = getLevel1ExcludedExpr();\r\nfunction encodeQueryComponentL1(value) {\r\n return utils.encodeQueryComponent(value, cL1ExclExpr);\r\n}\r\n\r\nconst cL2ExclExpr = getLevel2ExcludedExpr();\r\nfunction encodeQueryComponentL2(value) {\r\n return utils.encodeQueryComponent(value, cL2ExclExpr);\r\n}\r\n\r\nfunction ensureRepList(opts) {\r\n let { reps } = opts;\r\n if (!reps) {\r\n const { presets } = settings.now;\r\n let preset = opts.preset || settings.now.preset;\r\n reps = presets[preset];\r\n if (!reps) {\r\n logger.warn(`Unknown preset \"${preset}\"`);\r\n [preset] = Object.keys(presets);\r\n reps = presets[preset]; // fall back to any preset\r\n }\r\n opts.preset = preset;\r\n opts.reps = utils.deriveDeep(reps, true);\r\n }\r\n}\r\n\r\nfunction ensureRepAssign(opts, prop, value) {\r\n ensureRepList(opts);\r\n const rep = opts.reps[repIndex];\r\n // prop specified twice therefore start new rep by cloning the current\r\n if (rep.hasOwnProperty(prop)) {\r\n repIndex = opts.reps.length;\r\n opts.reps[repIndex] = utils.deriveDeep(rep, true);\r\n }\r\n if (value !== undefined) {\r\n opts.reps[repIndex][prop] = value;\r\n }\r\n}\r\n\r\nfunction addObject(opts, params, options) {\r\n if (opts._objects === undefined) {\r\n opts._objects = [];\r\n }\r\n\r\n const [type, newOpts] = options;\r\n const newObj = {\r\n type,\r\n params,\r\n };\r\n\r\n if (newOpts !== undefined) {\r\n newObj.opts = newOpts;\r\n }\r\n\r\n opts._objects[opts._objects.length] = newObj;\r\n}\r\n\r\nfunction parseParams(str, params) {\r\n const sep = str.indexOf(',');\r\n if (sep >= 0) {\r\n params.push(str.substr(sep + 1).split(','));\r\n return str.substr(0, sep);\r\n }\r\n // keep this untouched if no params were extracted\r\n return str;\r\n}\r\n\r\nfunction extractArgs(input, defaultsDict, params) {\r\n if (input) {\r\n const bang = input.indexOf(cOptsSep);\r\n const inputVal = parseParams(input.substr(0, bang >= 0 ? bang : undefined), params);\r\n if (bang >= 0) {\r\n const args = input.substr(bang + 1).split(cLSep);\r\n input = inputVal;\r\n if (defaultsDict) {\r\n const defaults = defaultsDict[input];\r\n const opts = utils.deriveDeep(defaults, true);\r\n args.forEach((arg) => {\r\n const pair = arg.split(cL2Ass, 2);\r\n const key = decodeURIComponent(pair[0]);\r\n const value = decodeURIComponent(pair[1]);\r\n const adapter = adapters[typeof _.get(defaults, key)];\r\n if (adapter) {\r\n _.set(opts, key, adapter(value));\r\n } else {\r\n logger.warn(`Unknown argument \"${key}\" for option \"${input}\"`);\r\n }\r\n });\r\n if (Object.keys(opts).length > 0) {\r\n input = [input, opts];\r\n }\r\n }\r\n } else {\r\n input = inputVal;\r\n }\r\n }\r\n return input;\r\n}\r\n\r\nconst actions = {\r\n\r\n l: 'load',\r\n load: String,\r\n t: 'type',\r\n type: String,\r\n v: 'view',\r\n view: String,\r\n u: 'unit',\r\n unit: Number,\r\n menu: asBoolean,\r\n\r\n // Commands\r\n\r\n o: 'object',\r\n object(value, opts) {\r\n const params = [];\r\n let options = extractArgs(value, settings.defaults.objects, params);\r\n if (!Array.isArray(options)) {\r\n options = [options];\r\n }\r\n addObject(opts, params[0], options);\r\n },\r\n\r\n p: 'preset',\r\n preset(value, opts) {\r\n opts.preset = value;\r\n opts.reps = null;\r\n ensureRepList(opts);\r\n },\r\n\r\n r: 'rep',\r\n rep(value, opts) {\r\n ensureRepList(opts);\r\n repIndex = Number(value);\r\n // clamp the index to one greater than the last\r\n repIndex = repIndex <= opts.reps.length ? (repIndex < 0 ? 0 : repIndex) : opts.reps.length;\r\n // create a new rep if it is adjacent to the existing ones\r\n if (repIndex === opts.reps.length) {\r\n // if there is no rep to derive from, derive from the first rep of the default\r\n opts.reps[repIndex] = repIndex > 0 ? utils.deriveDeep(opts.reps[repIndex - 1], true)\r\n : utils.deriveDeep(settings.defaults.presets.default[0], true);\r\n }\r\n },\r\n\r\n s: 'select',\r\n select(value, opts) {\r\n ensureRepAssign(opts, 'selector', value);\r\n },\r\n\r\n m: 'mode',\r\n mode(value, opts) {\r\n ensureRepAssign(opts, 'mode', extractArgs(value, settings.defaults.modes));\r\n },\r\n\r\n c: 'color',\r\n color(value, opts) {\r\n ensureRepAssign(opts, 'colorer', extractArgs(value, settings.defaults.colorers));\r\n },\r\n\r\n mt: 'material',\r\n material(value, opts) {\r\n ensureRepAssign(opts, 'material', extractArgs(value, settings.defaults.materials));\r\n },\r\n\r\n dup(value, opts) {\r\n ensureRepList(opts);\r\n const { reps } = opts;\r\n const rep = reps[repIndex];\r\n repIndex = reps.length;\r\n reps[repIndex] = utils.deriveDeep(rep, true);\r\n },\r\n\r\n // Settings shortcuts\r\n\r\n ar: 'autoResolution',\r\n};\r\n\r\nfunction _fromArray(entries) {\r\n repIndex = 0;\r\n\r\n const opts = {};\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const /** string[] */ entry = entries[i];\r\n let /** string? */ key = entry[0];\r\n const /** string? */ value = entry[1];\r\n let /** function|string? */ action = actions[key];\r\n\r\n // unwind shortcuts and aliases\r\n while (_.isString(action)) {\r\n key = action;\r\n action = actions[key];\r\n }\r\n\r\n // either set a property or use specialized parser\r\n if (!action) {\r\n const adapter = adapters[typeof _.get(settings.defaults, key)];\r\n if (adapter) {\r\n _.set(opts, `settings.${key}`, adapter(value));\r\n } else {\r\n logger.warn(`Unknown option \"${key}\"`);\r\n }\r\n } else if (_.isFunction(action)) {\r\n const result = action(value, opts);\r\n if (result !== undefined) {\r\n opts[key] = result;\r\n }\r\n }\r\n }\r\n\r\n return opts;\r\n}\r\n\r\nfunction fromAttr(attr) {\r\n return _fromArray(utils.getUrlParameters(`?${attr || ''}`));\r\n}\r\n\r\nfunction fromURL(url) {\r\n return _fromArray(utils.getUrlParameters(url));\r\n}\r\n\r\nfunction _processOptsForURL(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = encodeQueryComponentL2(key) + cL2Ass + encodeQueryComponentL2(value);\r\n });\r\n return str.join(cLSep);\r\n}\r\n\r\nfunction _processArgsForURL(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]}${cOptsSep}${_processOptsForURL(args[1])}`;\r\n}\r\n\r\nfunction _processObjForURL(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += `,${objOpts.params.join(',')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += cOptsSep + _processOptsForURL(objOpts.opts);\r\n }\r\n return res;\r\n}\r\n\r\nfunction toURL(opts) {\r\n const stringList = [];\r\n let idx = 0;\r\n\r\n function checkAndAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n stringList[idx++] = encodeQueryComponentL1(prefix)\r\n + cL1Ass + encodeQueryComponentL1(value);\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n if (_.isEmpty(repList[i])) {\r\n continue;\r\n }\r\n checkAndAdd('r', i);\r\n checkAndAdd('s', repList[i].selector);\r\n checkAndAdd('m', _processArgsForURL(repList[i].mode));\r\n checkAndAdd('c', _processArgsForURL(repList[i].colorer));\r\n checkAndAdd('mt', _processArgsForURL(repList[i].material));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('o', _processObjForURL(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('l', opts.load);\r\n checkAndAdd('u', opts.unit);\r\n checkAndAdd('p', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n checkAndAdd('v', opts.view);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(key, value);\r\n });\r\n\r\n let url = '';\r\n if (typeof window !== 'undefined') {\r\n const { location } = window;\r\n url = `${location.protocol}//${location.host}${location.pathname}`;\r\n }\r\n if (stringList.length > 0) {\r\n url += `?${stringList.join('&')}`;\r\n }\r\n\r\n return url;\r\n}\r\n\r\nfunction _processOptsForScript(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = `${key}=${utils.enquoteString(value)}`;\r\n });\r\n return str.join(' ');\r\n}\r\n\r\nfunction _processArgsForScript(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]} ${_processOptsForScript(args[1])}`;\r\n}\r\n\r\nfunction _processObjForScript(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += ` ${objOpts.params.map(utils.enquoteString).join(' ')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += ` ${_processOptsForScript(objOpts.opts)}`;\r\n }\r\n return res;\r\n}\r\n\r\nfunction _processRepsForScript(rep, index) {\r\n const repString = [];\r\n let strIdx = 0;\r\n function localAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n repString[strIdx++] = prefix + value;\r\n }\r\n }\r\n if (_.isEmpty(rep)) {\r\n return null;\r\n }\r\n localAdd('', index);\r\n localAdd('s=', utils.enquoteString(rep.selector));\r\n localAdd('m=', _processArgsForScript(rep.mode));\r\n localAdd('c=', _processArgsForScript(rep.colorer));\r\n localAdd('mt=', _processArgsForScript(rep.material));\r\n return repString.join(' ');\r\n}\r\n\r\nfunction toScript(opts) {\r\n const commandsList = [];\r\n let idx = 0;\r\n function checkAndAdd(command, value, saveQuotes) {\r\n if (value !== null && value !== undefined) {\r\n const quote = (typeof value === 'string' && saveQuotes) ? '\"' : '';\r\n commandsList[idx++] = `${command} ${quote}${value}${quote}`.trim();\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n checkAndAdd('rep', _processRepsForScript(repList[i], i));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('', _processObjForScript(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('set', 'autobuild false');\r\n checkAndAdd('load', opts.load, true);\r\n checkAndAdd('unit', opts.unit);\r\n checkAndAdd('preset', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(`set ${key}`, value, true);\r\n });\r\n checkAndAdd('view', opts.view);\r\n checkAndAdd('set', 'autobuild true');\r\n return commandsList.join('\\n');\r\n}\r\n\r\nexport default {\r\n fromURL,\r\n fromAttr,\r\n adapters,\r\n toURL,\r\n toScript,\r\n};\r\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","/**\r\n * Atom measurements.\r\n *\r\n * @param {Residue} residue - (required) Residue containing the atom\r\n * @param {string} name - (required) Name, unique in the residue\r\n * @param {Element} type - (required) Chemical element reference\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n *\r\n * @param {number} role - Role of atom inside monomer: Lead and wing are particularity interesting\r\n * @param {boolean} het - Non-standard residue indicator\r\n *\r\n * @param {number} serial - Serial number, unique in the model\r\n * @param {string} location - Alternative location indicator (usually space or A-Z)\r\n * @param {number} occupancy - Occupancy percentage, from 0 to 1\r\n * @param {number} temperature - Temperature\r\n * @param {number} charge - Charge\r\n *\r\n * @exports Atom\r\n * @constructor\r\n */\r\n\r\nclass Atom {\r\n constructor(residue, name, type, position, role, het, serial, location, occupancy, temperature, charge) {\r\n this.index = -1;\r\n this.residue = residue;\r\n this.name = name;\r\n this.element = type;\r\n this.position = position;\r\n this.role = role;\r\n this.mask = 1 | 0;\r\n\r\n this.het = het;\r\n\r\n this.serial = serial;\r\n this.location = (location || ' ').charCodeAt(0);\r\n this.occupancy = occupancy || 1;\r\n this.temperature = temperature;\r\n this.charge = charge;\r\n this.hydrogenCount = -1; // explicitly invalid\r\n this.radicalCount = 0;\r\n this.valence = -1; // explicitly invalid\r\n\r\n this.bonds = [];\r\n\r\n this.flags = 0x0000;\r\n if (type.name === 'H') {\r\n this.flags |= Atom.Flags.HYDROGEN;\r\n } else if (type.name === 'C') {\r\n this.flags |= Atom.Flags.CARBON;\r\n }\r\n }\r\n\r\n isHet() {\r\n return this.het;\r\n }\r\n\r\n isHydrogen() {\r\n return this.element.number === 1;\r\n }\r\n\r\n getVisualName() {\r\n const { name } = this;\r\n if (name.length > 0) {\r\n return name;\r\n }\r\n return this.element.name.trim();\r\n }\r\n\r\n forEachBond(process) {\r\n const { bonds } = this;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n getFullName() {\r\n let name = '';\r\n if (this.residue !== null) {\r\n if (this.residue._chain !== null) {\r\n name += `${this.residue._chain.getName()}.`;\r\n }\r\n name += `${this.residue._sequence}.`;\r\n }\r\n name += this.name;\r\n return name;\r\n }\r\n\r\n /**\r\n * Enumeration of atom flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n CARBON: 0x0001,\r\n // OXYGEN: 0x0002,\r\n // NITROGEN: 0x0004,\r\n HYDROGEN: 0x0008,\r\n /** Non-polar hydrogen (it is also a HYDROGEN) */\r\n NONPOLARH: 0x1008,\r\n };\r\n}\r\n\r\nexport default Atom;\r\n","class Element {\r\n constructor(number, name, fullName, weight, radius, radiusBonding, hValency) {\r\n this.number = number;\r\n this.name = name;\r\n this.fullName = fullName;\r\n this.weight = weight;\r\n this.radius = radius;\r\n this.radiusBonding = radiusBonding;\r\n this.hydrogenValency = hValency;\r\n }\r\n\r\n static Constants = {\r\n /* eslint-disable no-magic-numbers */\r\n U1: 1,\r\n Lead: 2,\r\n U2: 3,\r\n Wing: 4,\r\n U18: 18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n static Role = {\r\n /* eslint-disable no-magic-numbers */\r\n N: Element.Constants.U1,\r\n CA: Element.Constants.Lead,\r\n C: Element.Constants.U2,\r\n O: Element.Constants.Wing,\r\n SG: Element.Constants.U18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByAtomicNumber = [\r\n /* eslint-disable no-magic-numbers */\r\n null,\r\n new Element(1, 'H', 'Hydrogen', 1.008, 1.2, 0.23, [1]),\r\n new Element(2, 'HE', 'Helium', 4.003, 1.4, 0.93, [0]),\r\n new Element(3, 'LI', 'Lithium', 6.941, 1.82, 0.68, [1]),\r\n new Element(4, 'BE', 'Beryllium', 9.012, 1.7, 0.35, [2]),\r\n new Element(5, 'B', 'Boron', 10.81, 2.08, 0.83, [3]),\r\n new Element(6, 'C', 'Carbon', 12.011, 1.95, 0.68, [4]),\r\n new Element(7, 'N', 'Nitrogen', 14.007, 1.85, 0.68, [3, 5]),\r\n new Element(8, 'O', 'Oxygen', 15.999, 1.7, 0.68, [2, 4]),\r\n new Element(9, 'F', 'Fluorine', 18.998, 1.73, 0.64, [1]),\r\n new Element(10, 'NE', 'Neon', 20.18, 1.54, 1.12, [0]),\r\n new Element(11, 'NA', 'Sodium', 22.99, 2.27, 0.97, [1]),\r\n new Element(12, 'MG', 'Magnesium', 24.305, 1.73, 1.1, [2]),\r\n new Element(13, 'AL', 'Aluminum', 26.981, 2.05, 1.35, [3]),\r\n new Element(14, 'SI', 'Silicon', 28.086, 2.1, 1.2, [4]),\r\n new Element(15, 'P', 'Phosphorus', 30.974, 2.08, 0.75, [3, 5]),\r\n new Element(16, 'S', 'Sulfur', 32.07, 2, 1.02, [2, 4, 6]),\r\n new Element(17, 'CL', 'Chlorine', 35.453, 1.97, 0.99, [1, 3, 5, 7]),\r\n new Element(18, 'AR', 'Argon', 39.948, 1.88, 1.57, [0]),\r\n new Element(19, 'K', 'Potassium', 39.1, 2.75, 1.33, [1]),\r\n new Element(20, 'CA', 'Calcium', 40.08, 1.973, 0.99, [2]),\r\n new Element(21, 'SC', 'Scandium', 44.956, 1.7, 1.44, [0]),\r\n new Element(22, 'TI', 'Titanium', 47.88, 1.7, 1.47, [0]),\r\n new Element(23, 'V', 'Vanadium', 50.941, 1.7, 1.33, [0]),\r\n new Element(24, 'CR', 'Chromium', 52, 1.7, 1.35, [0]),\r\n new Element(25, 'MN', 'Manganese', 54.938, 1.7, 1.35, [0]),\r\n new Element(26, 'FE', 'Iron', 55.847, 1.7, 1.34, [0]),\r\n new Element(27, 'CO', 'Cobalt', 58.93, 1.7, 1.33, [0]),\r\n new Element(28, 'NI', 'Nickel', 58.69, 1.63, 1.5, [0]),\r\n new Element(29, 'CU', 'Copper', 63.55, 1.4, 1.52, [0]),\r\n new Element(30, 'ZN', 'Zinc', 65.39, 1.39, 1.45, [0]),\r\n new Element(31, 'GA', 'Gallium', 69.72, 1.87, 1.22, [3]),\r\n new Element(32, 'GE', 'Germanium', 72.61, 1.7, 1.17, [4]),\r\n new Element(33, 'AS', 'Arsenic', 74.92, 1.85, 1.21, [3, 5]),\r\n new Element(34, 'SE', 'Selenium', 78.96, 1.9, 1.22, [2, 4, 6]),\r\n new Element(35, 'BR', 'Bromine', 79.9, 2.1, 1.21, [1, 3, 5, 7]),\r\n new Element(36, 'KR', 'Krypton', 83.8, 2.02, 1.91, [0]),\r\n new Element(37, 'RB', 'Rubidium', 85.47, 1.7, 1.47, [1]),\r\n new Element(38, 'SR', 'Strontium', 87.62, 1.7, 1.12, [2]),\r\n new Element(39, 'Y', 'Yttrium', 88.91, 1.7, 1.78, [0]),\r\n new Element(40, 'ZR', 'Zirconium', 91.22, 1.7, 1.56, [0]),\r\n new Element(41, 'NB', 'Niobium', 92.91, 1.7, 1.48, [0]),\r\n new Element(42, 'MO', 'Molybdenum', 95.94, 1.7, 1.47, [0]),\r\n new Element(43, 'TC', 'Technetium', 98.91, 1.7, 1.35, [0]),\r\n new Element(44, 'RU', 'Ruthenium', 101.07, 1.7, 1.4, [0]),\r\n new Element(45, 'RH', 'Rhodium', 102.91, 1.7, 1.45, [0]),\r\n new Element(46, 'PD', 'Palladium', 106.42, 1.63, 1.5, [0]),\r\n new Element(47, 'AG', 'Silver', 107.87, 1.72, 1.59, [0]),\r\n new Element(48, 'CD', 'Cadmium', 112.41, 1.58, 1.69, [0]),\r\n new Element(49, 'IN', 'Indium', 114.82, 1.93, 1.63, [3]),\r\n new Element(50, 'SN', 'Tin', 118.71, 2.17, 1.46, [2, 4]),\r\n new Element(51, 'SB', 'Antimony', 121.75, 2.2, 1.46, [3, 5]),\r\n new Element(52, 'TE', 'Tellurium', 127.6, 2.06, 1.47, [2, 4, 6]),\r\n new Element(53, 'I', 'Iodine', 126.91, 2.15, 1.4, [1, 3, 5, 7]),\r\n new Element(54, 'XE', 'Xenon', 131.29, 2.16, 1.98, [0]),\r\n new Element(55, 'CS', 'Cesium', 132.91, 1.7, 1.67, [1]),\r\n new Element(56, 'BA', 'Barium', 137.33, 1.7, 1.34, [2]),\r\n new Element(57, 'LA', 'Lanthanum', 138.91, 1.7, 1.87, [0]),\r\n new Element(58, 'CE', 'Cerium', 140.12, 1.7, 1.83, [0]),\r\n new Element(59, 'PR', 'Praseodymium', 140.91, 1.7, 1.82, [0]),\r\n new Element(60, 'ND', 'Neodymium', 144.24, 1.7, 1.81, [0]),\r\n new Element(61, 'PM', 'Promethium', 144.9, 1.7, 1.8, [0]),\r\n new Element(62, 'SM', 'Samarium', 150.36, 1.7, 1.8, [0]),\r\n new Element(63, 'EU', 'Europium', 151.96, 1.7, 1.99, [0]),\r\n new Element(64, 'GD', 'Gadolinium', 157.25, 1.7, 1.79, [0]),\r\n new Element(65, 'TB', 'Terbium', 158.93, 1.7, 1.76, [0]),\r\n new Element(66, 'DY', 'Dysprosium', 162.5, 1.7, 1.75, [0]),\r\n new Element(67, 'HO', 'Holmium', 164.93, 1.7, 1.74, [0]),\r\n new Element(68, 'ER', 'Erbium', 167.26, 1.7, 1.73, [0]),\r\n new Element(69, 'TM', 'Thulium', 168.93, 1.7, 1.72, [0]),\r\n new Element(70, 'YB', 'Ytterbium', 173.04, 1.7, 1.94, [0]),\r\n new Element(71, 'LU', 'Lutetium', 174.97, 1.7, 1.72, [0]),\r\n new Element(72, 'HF', 'Hafnium', 178.49, 1.7, 1.57, [0]),\r\n new Element(73, 'TA', 'Tantalum', 180.95, 1.7, 1.43, [0]),\r\n new Element(74, 'W', 'Tungsten', 183.85, 1.7, 1.37, [0]),\r\n new Element(75, 'RE', 'Rhenium', 186.21, 1.7, 1.35, [0]),\r\n new Element(76, 'OS', 'Osmium', 190.2, 1.7, 1.37, [0]),\r\n new Element(77, 'IR', 'Iridium', 192.22, 1.7, 1.32, [0]),\r\n new Element(78, 'PT', 'Platinum', 195.08, 1.72, 1.5, [0]),\r\n new Element(79, 'AU', 'Gold', 196.97, 1.66, 1.5, [0]),\r\n new Element(80, 'HG', 'Mercury', 200.59, 1.55, 1.7, [0]),\r\n new Element(81, 'TL', 'Thallium', 204.38, 1.96, 1.55, [1, 3]),\r\n new Element(82, 'PB', 'Lead', 207.2, 2.02, 1.54, [2, 4]),\r\n new Element(83, 'BI', 'Bismuth', 208.98, 1.7, 1.54, [3, 5]),\r\n new Element(84, 'PO', 'Polonium', 210, 1.7, 1.68, [2, 4, 6]),\r\n new Element(85, 'AT', 'Astatine', 210, 1.7, 1.7, [1, 3, 5, 7]),\r\n new Element(86, 'RN', 'Radon', 222, 1.7, 2.4, [0]),\r\n new Element(87, 'FR', 'Francium', 223, 1.7, 2, [1]),\r\n new Element(88, 'RA', 'Radium', 226.03, 1.7, 1.9, [2]),\r\n new Element(89, 'AC', 'Actinium', 227.03, 1.7, 1.88, [0]),\r\n new Element(90, 'TH', 'Thorium', 232.04, 1.7, 1.79, [0]),\r\n new Element(91, 'PA', 'Protactinium', 231.04, 1.7, 1.61, [0]),\r\n new Element(92, 'U', 'Uranium', 238.03, 1.86, 1.58, [0]),\r\n new Element(93, 'NP', 'Neptunium', 237.05, 1.7, 1.55, [0]),\r\n new Element(94, 'PU', 'Plutonium', 239.1, 1.7, 1.53, [0]),\r\n new Element(95, 'AM', 'Americium', 243.1, 1.7, 1.51, [0]),\r\n new Element(96, 'CM', 'Curium', 247.1, 1.7, 1.5, [0]),\r\n new Element(97, 'BK', 'Berkelium', 247.1, 1.7, 1.5, [0]),\r\n new Element(98, 'CF', 'Californium', 252.1, 1.7, 1.5, [0]),\r\n new Element(99, 'ES', 'Einsteinium', 252.1, 1.7, 1.5, [0]),\r\n new Element(100, 'FM', 'Fermium', 257.1, 1.7, 1.5, [0]),\r\n new Element(101, 'MD', 'Mendelevium', 256.1, 1.7, 1.5, [0]),\r\n new Element(102, 'NO', 'Nobelium', 259.1, 1.7, 1.5, [0]),\r\n new Element(103, 'LR', 'Lawrencium', 260.1, 1.7, 1.5, [0]),\r\n new Element(104, 'RF', 'Rutherfordium', 261, 1.7, 1.6, [0]),\r\n new Element(105, 'DB', 'Dubnium', 262, 1.7, 1.6, [0]),\r\n new Element(106, 'SG', 'Seaborgium', 263, 1.7, 1.6, [0]),\r\n new Element(107, 'BH', 'Bohrium', 262, 1.7, 1.6, [0]),\r\n new Element(108, 'HS', 'Hassium', 265, 1.7, 1.6, [0]),\r\n new Element(109, 'MT', 'Meitnerium', 268, 1.7, 1.6, [0]),\r\n /* eslint-enable no-magic-numbers */\r\n ];\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByName = {\r\n // Duplicate atomic numbers (isotopes)\r\n /* eslint-disable no-magic-numbers */\r\n D: new Element(1, 'D', 'Deuterium', 2.014, 1.2, 0.23, [1]),\r\n T: new Element(1, 'T', 'Tritium', 3.016, 1.2, 0.23, [1]),\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // All regular elements will be added later, automatically\r\n };\r\n}\r\n\r\n(function () {\r\n const byAtomicNumber = Element.ByAtomicNumber;\r\n const byName = Element.ByName;\r\n for (let i = 0, n = byAtomicNumber.length; i < n; ++i) {\r\n const element = byAtomicNumber[i];\r\n if (element) {\r\n byName[element.name] = element;\r\n }\r\n }\r\n}());\r\n\r\n// find atom type by chemical element (or create if missing)\r\nElement.getByName = function (element) {\r\n let type = Element.ByName[element];\r\n if (!type) {\r\n type = Element.ByName[element] = new Element(0, element, 'Unknown', 0, 1.0, 0.01, [0]);\r\n }\r\n return type;\r\n};\r\n\r\nexport default Element;\r\n","const cBondTypes = {\r\n /** Was generated manually */\r\n UNKNOWN: 0,\r\n /** Simple covalent bond */\r\n COVALENT: 1,\r\n /** Aromatic bond */\r\n AROMATIC: 2,\r\n};\r\n\r\nfunction getAtomPos(atom) {\r\n return atom.position;\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Atom} left - The first atom.\r\n * @param {Atom} right - The second atom.\r\n * @param {number} order - Order of current bond.\r\n * @param {number} type - Bond type.\r\n * @param {boolean} fixed - Indicator of a pre-specified connection (in contrast with guessed one).\r\n *\r\n * @exports Bond\r\n * @constructor\r\n */\r\nclass Bond {\r\n constructor(left, right, order, type, fixed) {\r\n this._left = left;\r\n this._right = right;\r\n this._fixed = fixed;\r\n this._index = -1;\r\n if (left > right) {\r\n throw new Error('In a bond atom indices must be in increasing order');\r\n }\r\n this._order = order;\r\n this._type = type;\r\n }\r\n\r\n getLeft() {\r\n return this._left;\r\n }\r\n\r\n getRight() {\r\n return this._right;\r\n }\r\n\r\n getOrder() {\r\n return this._order;\r\n }\r\n\r\n calcLength() {\r\n return this._left.position.distanceTo(this._right.position);\r\n }\r\n\r\n _forEachNeighbour(currAtom, process) {\r\n const { bonds } = currAtom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]._left !== currAtom ? bonds[i]._left : bonds[i]._right);\r\n }\r\n }\r\n\r\n forEachLevelOne(process) {\r\n const left = this._left;\r\n const right = this._right;\r\n this._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n this._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n }\r\n\r\n forEachLevelTwo(process) {\r\n // TODO refactor this piece of an art?\r\n const left = this._left;\r\n const right = this._right;\r\n const self = this;\r\n self._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === left) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n self._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === right) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n }\r\n\r\n _fixDir(refPoint, currDir, posGetter) {\r\n // count atoms to the right and to the left of the current plane\r\n let rightCount = 0;\r\n let leftCount = 0;\r\n const tmpVec = refPoint.clone();\r\n function checkDir(atom) {\r\n tmpVec.copy(posGetter(atom));\r\n tmpVec.sub(refPoint);\r\n const dotProd = currDir.dot(tmpVec);\r\n if (dotProd > 0) {\r\n ++rightCount;\r\n } else {\r\n ++leftCount;\r\n }\r\n }\r\n function checkCarbon(atom) {\r\n if (atom.element.name === 'C') {\r\n checkDir(atom);\r\n }\r\n }\r\n // count all atoms to the left and right of our plane, start from level 1 and carbons\r\n const stages = [\r\n [this.forEachLevelOne, checkCarbon],\r\n [this.forEachLevelOne, checkDir],\r\n [this.forEachLevelTwo, checkCarbon],\r\n [this.forEachLevelTwo, checkDir],\r\n ];\r\n\r\n for (let stageId = 0; stageId < stages.length; ++stageId) {\r\n stages[stageId][0].call(this, stages[stageId][1]);\r\n if (leftCount > rightCount) {\r\n return currDir.multiplyScalar(-1);\r\n }\r\n if (leftCount < rightCount) {\r\n return currDir;\r\n }\r\n }\r\n return currDir;\r\n }\r\n\r\n calcNormalDir(posGetter) {\r\n const left = this._left;\r\n const right = this._right;\r\n let first = left;\r\n let second = right;\r\n posGetter = posGetter === undefined ? getAtomPos : posGetter;\r\n if (left.bonds.length > right.bonds.length) {\r\n first = right;\r\n second = left;\r\n }\r\n let third = first;\r\n let maxNeibs = 0;\r\n const { bonds } = second;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n let another = bonds[i]._left;\r\n if (bonds[i]._left === second) {\r\n another = bonds[i]._right;\r\n }\r\n if (another.bonds.length > maxNeibs && another !== first) {\r\n third = another;\r\n maxNeibs = another.bonds.length;\r\n }\r\n }\r\n const secondPos = posGetter(second);\r\n const firstV = posGetter(first).clone().sub(secondPos);\r\n const secondV = posGetter(third).clone().sub(secondPos);\r\n secondV.crossVectors(firstV, secondV);\r\n if (secondV.lengthSq() < 0.0001) {\r\n secondV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n secondV.normalize();\r\n firstV.crossVectors(secondV, firstV);\r\n if (firstV.lengthSq() < 0.0001) {\r\n firstV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n return this._fixDir(secondPos, firstV, posGetter);\r\n }\r\n\r\n static BondType = cBondTypes;\r\n}\r\n\r\nBond.prototype.BondType = cBondTypes;\r\n\r\nexport default Bond;\r\n","import * as THREE from 'three';\r\nimport Atom from './Atom';\r\nimport Element from './Element';\r\n\r\nconst cNucleicControlNames = ['C3\\'', 'C3*', 'P', 'H5T', 'H3T'];\r\nconst cNucleicWing1Names = ['OP1', 'O1P'];\r\nconst cNucleicWing2Names = ['OP2', 'O2P'];\r\n\r\nconst cCylinderSource = ['C3\\'', 'C3*', 'C1', 'C1\\'', 'C1*', 'P'];\r\nconst cCylinderTarget = [{\r\n types: ['A', 'DA', 'G', 'DG'],\r\n atoms: ['N1'],\r\n}, {\r\n types: ['C', 'DC'],\r\n atoms: ['N3'],\r\n}, {\r\n types: ['T', 'DT', 'U', 'DU'],\r\n atoms: ['O4'],\r\n}];\r\n\r\n/**\r\n * Residue instance.\r\n *\r\n * @param {Chain} chain - Chain this residue belongs to.\r\n * @param {ResidueType} type - Generic residue instance type.\r\n * @param {number} sequence - Sequence ID.\r\n * @param {string} icode - One character insertion code (usually space or A-Z).\r\n *\r\n * @exports Residue\r\n * @constructor\r\n */\r\nclass Residue {\r\n constructor(chain, type, sequence, icode) {\r\n this._chain = chain;\r\n this._component = null;\r\n this._type = type;\r\n this._sequence = sequence;\r\n this._icode = icode;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n\r\n this._atoms = [];\r\n this._secondary = null;\r\n this._firstAtom = null;\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n this._lastAtom = null;\r\n this._controlPoint = null;\r\n this._midPoint = null;\r\n this._wingVector = null;\r\n this._cylinders = null;\r\n this._isValid = true;\r\n this._het = false;\r\n this._molecule = null;\r\n this.temperature = null;\r\n this.occupancy = null;\r\n }\r\n\r\n // Getters and setters\r\n getChain() {\r\n return this._chain;\r\n }\r\n\r\n getMolecule() {\r\n return this._molecule;\r\n }\r\n\r\n getType() {\r\n return this._type;\r\n }\r\n\r\n getSequence() {\r\n return this._sequence;\r\n }\r\n\r\n getSecondary() {\r\n return this._secondary;\r\n }\r\n\r\n getICode() {\r\n return this._icode;\r\n }\r\n\r\n // Other methods\r\n\r\n addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge) {\r\n const atom = new Atom(this, name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n const complex = this._chain.getComplex();\r\n complex.addAtom(atom);\r\n this._atoms.push(atom);\r\n this._het = this._het || het;\r\n return atom;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n if (process(atoms[i])) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n _findAtomByName(name) {\r\n let res = null;\r\n this.forEachAtom((atom) => {\r\n if (atom.name === name) {\r\n res = atom;\r\n return true;\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _findFirstAtomInList(names) {\r\n let res = null;\r\n for (let i = 0; i < names.length; ++i) {\r\n res = this._findAtomByName(names[i]);\r\n if (res !== null) {\r\n return res;\r\n }\r\n }\r\n return res;\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n mask &= atoms[i].mask;\r\n }\r\n this._mask = mask;\r\n }\r\n\r\n getCylinderTargetList() {\r\n const type = this._type._name;\r\n for (let i = 0, n = cCylinderTarget.length; i < n; ++i) {\r\n for (let j = 0, m = cCylinderTarget[i].types.length; j < m; ++j) {\r\n if (type === cCylinderTarget[i].types[j]) {\r\n return cCylinderTarget[i].atoms;\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n _detectLeadWing(dst, next, getAtomPosition) {\r\n const leadAtom = this._findFirstAtomInList(cNucleicControlNames);\r\n let wingStart = this._findFirstAtomInList(cNucleicWing1Names);\r\n let wingEnd = this._findFirstAtomInList(cNucleicWing2Names);\r\n\r\n if (wingStart === null && next !== null) {\r\n wingStart = next._findFirstAtomInList(cNucleicWing1Names);\r\n }\r\n\r\n if (wingEnd === null && next !== null) {\r\n wingEnd = next._findFirstAtomInList(cNucleicWing2Names);\r\n }\r\n\r\n if (leadAtom === null || wingStart === null || wingEnd === null) {\r\n return;\r\n }\r\n\r\n dst._leadAtom = leadAtom;\r\n dst._controlPoint = getAtomPosition(leadAtom);\r\n dst._wingVector = getAtomPosition(wingEnd).clone().sub(getAtomPosition(wingStart));\r\n dst._isValid = true;\r\n\r\n const cylSource = this._findFirstAtomInList(cCylinderSource);\r\n const targetList = this.getCylinderTargetList();\r\n const cylTarget = targetList !== null ? this._findFirstAtomInList(targetList) : null;\r\n if (cylSource === null || cylTarget === null) {\r\n return;\r\n }\r\n dst._cylinders = [getAtomPosition(cylSource), getAtomPosition(cylTarget)];\r\n }\r\n\r\n calcWing(prevLeadPos, currLeadPos, prevWingPos, prevWing) {\r\n const vectorA = currLeadPos.clone().sub(prevLeadPos);\r\n const vectorB = prevLeadPos.clone().sub(prevWingPos);\r\n vectorB.crossVectors(vectorA, vectorB);\r\n vectorB.crossVectors(vectorA, vectorB).normalize();\r\n if (prevWing !== null && prevWing.length() > 0.0001) {\r\n const needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2;\r\n if (needToNegate) {\r\n vectorB.negate();\r\n }\r\n }\r\n return vectorB;\r\n }\r\n\r\n _innerFinalize(prevRes, prev, nextRes, dst, chainAsNucleic, getAtomPosition) {\r\n const bFirstInChain = prev === null;\r\n\r\n const lp = getAtomPosition(this._leadAtom);\r\n const currLeadPos = new THREE.Vector3(lp.x, lp.y, lp.z);\r\n if (chainAsNucleic) {\r\n this._detectLeadWing(dst, nextRes, getAtomPosition);\r\n return;\r\n }\r\n\r\n if (bFirstInChain) { // for first one in chain\r\n dst._midPoint = getAtomPosition(this._firstAtom).clone();\r\n } else {\r\n const prevLeadPos = prev._controlPoint; // lead point of previous monomer\r\n dst._midPoint = prevLeadPos.clone().lerp(currLeadPos, 0.5);\r\n dst._wingVector = this.calcWing(prevLeadPos, currLeadPos, getAtomPosition(prevRes._wingAtom), prev._wingVector);\r\n }\r\n dst._controlPoint = currLeadPos;\r\n }\r\n\r\n _finalize2(prev, next, asNucleic) {\r\n // Should be called AFTER first finalize\r\n this._innerFinalize(prev, prev, next, this, asNucleic, (atom) => atom.position);\r\n }\r\n\r\n isConnected(anotherResidue) {\r\n if (this._chain !== anotherResidue._chain) {\r\n return false;\r\n }\r\n if (this === anotherResidue) {\r\n return true;\r\n }\r\n let res = false;\r\n this.forEachAtom((atom) => {\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue === anotherResidue || bond._right.residue === anotherResidue) {\r\n res = true;\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _finalize() {\r\n const self = this;\r\n [this._firstAtom] = this._atoms;\r\n this._lastAtom = this._atoms[this._atoms.length - 1];\r\n\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n\r\n let tempCount = 0;\r\n let temperature = 0; // average temperature\r\n let occupCount = 0;\r\n let occupancy = 0; // average occupancy\r\n this.forEachAtom((a) => {\r\n if (self._leadAtom === null) {\r\n if (a.role === Element.Constants.Lead) {\r\n self._leadAtom = a;\r\n }\r\n }\r\n if (self._wingAtom === null) {\r\n if (a.role === Element.Constants.Wing) {\r\n self._wingAtom = a;\r\n }\r\n }\r\n if (a.temperature) {\r\n temperature += a.temperature;\r\n tempCount++;\r\n }\r\n if (a.occupancy) {\r\n occupancy += a.occupancy;\r\n occupCount++;\r\n }\r\n return (self._leadAtom !== null && self._wingAtom !== null);\r\n });\r\n\r\n if (tempCount > 0) {\r\n this.temperature = temperature / tempCount;\r\n }\r\n if (occupCount > 0) {\r\n this.occupancy = occupancy / occupCount;\r\n }\r\n\r\n // Still try to make monomer look valid\r\n if (this._leadAtom === null || this._wingAtom === null) {\r\n this._isValid = false;\r\n }\r\n if (this._leadAtom === null) {\r\n this._leadAtom = this._firstAtom;\r\n }\r\n if (this._wingAtom === null) {\r\n this._wingAtom = this._lastAtom;\r\n }\r\n }\r\n}\r\n\r\nexport default Residue;\r\n","/**\r\n * Residue type.\r\n *\r\n * Predefined acid or created with HET, HETNAM, etc.\r\n *\r\n * @param {string} name - Short name, either standard (ALA, MET, etc.) or non-standard one.\r\n * @param {string} fullName - Full residue name.\r\n * @param {string} letterCode - 1-letter symbol.\r\n *\r\n * @exports ResidueType\r\n * @constructor\r\n */\r\nclass ResidueType {\r\n constructor(name, fullName, letterCode) {\r\n this._name = name;\r\n this._fullName = fullName;\r\n this.letterCode = letterCode;\r\n this.flags = 0x0000;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\n static StandardTypes = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: new ResidueType('ALA', 'Alanine', 'A'),\r\n ARG: new ResidueType('ARG', 'Arginine', 'R'),\r\n ASN: new ResidueType('ASN', 'Asparagine', 'N'),\r\n ASP: new ResidueType('ASP', 'Aspartic Acid', 'D'),\r\n CYS: new ResidueType('CYS', 'Cysteine', 'C'),\r\n GLN: new ResidueType('GLN', 'Glutamine', 'Q'),\r\n GLU: new ResidueType('GLU', 'Glutamic Acid', 'E'),\r\n GLY: new ResidueType('GLY', 'Glycine', 'G'),\r\n HIS: new ResidueType('HIS', 'Histidine', 'H'),\r\n ILE: new ResidueType('ILE', 'Isoleucine', 'I'),\r\n LEU: new ResidueType('LEU', 'Leucine', 'L'),\r\n LYS: new ResidueType('LYS', 'Lysine', 'K'),\r\n MET: new ResidueType('MET', 'Methionine', 'M'),\r\n PHE: new ResidueType('PHE', 'Phenylalanine', 'F'),\r\n PRO: new ResidueType('PRO', 'Proline', 'P'),\r\n PYL: new ResidueType('PYL', 'Pyrrolysine', 'O'),\r\n SEC: new ResidueType('SEC', 'Selenocysteine', 'U'),\r\n SER: new ResidueType('SER', 'Serine', 'S'),\r\n THR: new ResidueType('THR', 'Threonine', 'T'),\r\n TRP: new ResidueType('TRP', 'Tryptophan', 'W'),\r\n TYR: new ResidueType('TYR', 'Tyrosine', 'Y'),\r\n VAL: new ResidueType('VAL', 'Valine', 'V'),\r\n A: new ResidueType('A', 'Adenine', 'A'),\r\n C: new ResidueType('C', 'Cytosine', 'C'),\r\n G: new ResidueType('G', 'Guanine', 'G'),\r\n I: new ResidueType('I', 'Inosine', 'I'),\r\n T: new ResidueType('T', 'Thymine', 'T'),\r\n U: new ResidueType('U', 'Uracil', 'U'),\r\n DA: new ResidueType('DA', 'Adenine', 'A'),\r\n DC: new ResidueType('DC', 'Cytosine', 'C'),\r\n DG: new ResidueType('DG', 'Guanine', 'G'),\r\n DI: new ResidueType('DI', 'Inosine', 'I'),\r\n DT: new ResidueType('DT', 'Thymine', 'T'),\r\n DU: new ResidueType('DU', 'Uracil', 'U'),\r\n '+A': new ResidueType('+A', 'Adenine', 'A'),\r\n '+C': new ResidueType('+C', 'Cytosine', 'C'),\r\n '+G': new ResidueType('+G', 'Guanine', 'G'),\r\n '+I': new ResidueType('+I', 'Inosine', 'I'),\r\n '+T': new ResidueType('+T', 'Thymine', 'T'),\r\n '+U': new ResidueType('+U', 'Uracil', 'U'),\r\n WAT: new ResidueType('WAT', 'Water', ''),\r\n H2O: new ResidueType('H2O', 'Water', ''),\r\n HOH: new ResidueType('HOH', 'Water', ''),\r\n DOD: new ResidueType('DOD', 'Water', ''),\r\n UNK: new ResidueType('UNK', 'Unknown', ''),\r\n UNL: new ResidueType('UNL', 'Unknown Ligand', ''),\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n /**\r\n * Enumeration of residue flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n // Amino acids\r\n /** Amino acid residue */\r\n PROTEIN: 0x0001,\r\n /** Basic amino acid residue */\r\n BASIC: 0x0002,\r\n /** Acidic amino acid residue */\r\n ACIDIC: 0x0004,\r\n /** Polar uncharged side chain amino acid residue */\r\n POLAR: 0x0008,\r\n /** Non-polar hydrophobic side chain amino acid residue */\r\n NONPOLAR: 0x0010,\r\n /** Aromatic amino acid residue */\r\n AROMATIC: 0x0020,\r\n\r\n // Nucleic acids\r\n\r\n /** Nucleic residue */\r\n NUCLEIC: 0x0100,\r\n /** Purine nucleic residue */\r\n PURINE: 0x0200,\r\n /** Pyrimidine nucleic residue */\r\n PYRIMIDINE: 0x0400,\r\n /** DNA */\r\n DNA: 0x0800,\r\n /** RNA */\r\n RNA: 0x1000,\r\n\r\n /** Water */\r\n WATER: 0x10000,\r\n };\r\n}\r\n\r\n// Flag combinations\r\nfunction _addFlag(flag, list) {\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const res = ResidueType.StandardTypes[list[i]];\r\n if (res) {\r\n res.flags |= flag;\r\n }\r\n }\r\n}\r\n\r\nconst { Flags } = ResidueType;\r\n_addFlag(Flags.WATER, ['WAT', 'H2O', 'HOH', 'DOD']);\r\n\r\n_addFlag(Flags.PROTEIN, [\r\n 'ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLY', 'GLU', 'GLN', 'HIS', 'ILE',\r\n 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'PYL', 'SEC', 'SER', 'THR', 'TRP',\r\n 'TYR', 'VAL',\r\n]);\r\n_addFlag(Flags.BASIC, ['ARG', 'HIS', 'LYS']);\r\n_addFlag(Flags.ACIDIC, ['ASP', 'GLU']);\r\n_addFlag(Flags.POLAR, ['ASN', 'CYS', 'GLN', 'SER', 'THR', 'TYR']);\r\n_addFlag(Flags.NONPOLAR, ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'VAL', 'GLY']);\r\n_addFlag(Flags.AROMATIC, ['PHE', 'TRP', 'TYR']);\r\n\r\n_addFlag(Flags.NUCLEIC, [\r\n 'A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I',\r\n 'C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U',\r\n]);\r\n_addFlag(Flags.PURINE, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I']);\r\n_addFlag(Flags.PYRIMIDINE, ['C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']);\r\n_addFlag(Flags.DNA, ['DA', 'DG', 'DI', 'DC', 'DT', 'DU']);\r\n_addFlag(Flags.RNA, ['A', 'G', 'I', 'C', 'T', 'U']);\r\n// Table of kdHydrophobicity\r\nconst hydro = {\r\n ILE: 4.5,\r\n VAL: 4.2,\r\n LEU: 3.8,\r\n PHE: 2.8,\r\n CYS: 2.5,\r\n MET: 1.9,\r\n ALA: 1.8,\r\n GLY: -0.4,\r\n THR: -0.7,\r\n SER: -0.8,\r\n TRP: -0.9,\r\n TYR: -1.3,\r\n PRO: -1.6,\r\n HIS: -3.2,\r\n GLU: -3.5,\r\n GLN: -3.5,\r\n ASP: -3.5,\r\n ASN: -3.5,\r\n LYS: -3.9,\r\n ARG: -4.5,\r\n};\r\n\r\nfunction _addParam(param, list) {\r\n const keys = Object.keys(list);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = list[key];\r\n ResidueType.StandardTypes[key][param] = value;\r\n }\r\n}\r\n\r\n_addParam('hydrophobicity', hydro);\r\n\r\nexport default ResidueType;\r\n","import * as THREE from 'three';\r\nimport Residue from './Residue';\r\nimport ResidueType from './ResidueType';\r\n\r\n/**\r\n * Residues in chain are either amino acid either nucleic acid (and water)\r\n * There might be some modified/mutated residues, which type could not be determined by their name (nucleic or amino); In this\r\n * case firstly program definites the chain type (by well-known residues) and then definites modified/mutated residues\r\n */\r\nconst ChainType = {\r\n UNKNOWN: 0,\r\n PROTEIN: 1,\r\n NUCLEIC: 2,\r\n};\r\n\r\n/**\r\n * Residue chain.\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n * @param {string} name - One character identifier (usually space, A-Z, 0-9, or a-z).\r\n *\r\n * @exports Chain\r\n * @constructor\r\n */\r\nclass Chain {\r\n constructor(complex, name) {\r\n this._complex = complex;\r\n this._name = name;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n this._residues = [];\r\n\r\n this.minSequence = Number.POSITIVE_INFINITY;\r\n this.maxSequence = Number.NEGATIVE_INFINITY;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n _determineType() {\r\n const residues = this._residues;\r\n\r\n const { PROTEIN, NUCLEIC } = ResidueType.Flags;\r\n\r\n this.type = ChainType.UNKNOWN;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const { flags } = residues[i]._type;\r\n\r\n if ((flags & NUCLEIC) !== 0) {\r\n this.type = ChainType.NUCLEIC;\r\n break;\r\n } else if ((flags & PROTEIN) !== 0) {\r\n this.type = ChainType.PROTEIN;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Finds thre residue with specified sequence number and inserion code\r\n * @param {Number} seqNum sequence number\r\n * @param {string} iCode insertion code\r\n * @returns {*} Residue or null if not found\r\n */\r\n findResidue(seqNum, iCode) {\r\n const residues = this._residues;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n if (res._sequence === seqNum && res._icode === iCode) {\r\n return [res, i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _finalize() {\r\n this._determineType();\r\n\r\n const residues = this._residues;\r\n\r\n let prev = null;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const next = (i + 1 < n) ? residues[i + 1] : null;\r\n const curr = residues[i];\r\n // TODO: skip invalid residues\r\n if (1 /* curr._isValid */) { // eslint-disable-line no-constant-condition\r\n curr._finalize2(prev, next, this.type === ChainType.NUCLEIC);\r\n prev = curr;\r\n }\r\n }\r\n\r\n // fix very first wing\r\n if (residues.length > 1 && residues[1]._wingVector) {\r\n const p = residues[1]._wingVector;\r\n residues[0]._wingVector = new THREE.Vector3(p.x, p.y, p.z);\r\n } else if (residues.length > 0) {\r\n residues[0]._wingVector = new THREE.Vector3(1, 0, 0);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const residues = this._residues;\r\n let prev = null;\r\n let prevData = null;\r\n const frameRes = frameData._residues;\r\n const n = residues.length;\r\n function getAtomPos(atom) {\r\n return frameData.getAtomPos(atom.index);\r\n }\r\n\r\n for (let i = 0; i < n; ++i) {\r\n const curr = residues[i];\r\n const currData = frameRes[curr._index];\r\n const nextRes = (i + 1 < n) ? residues[i + 1] : null;\r\n curr._innerFinalize(prev, prevData, nextRes, currData, this.type === ChainType.NUCLEIC, getAtomPos);\r\n prev = curr;\r\n prevData = currData;\r\n }\r\n\r\n frameRes[residues[0]._index]._wingVector = n > 1\r\n ? frameRes[residues[1]._index]._wingVector\r\n : new THREE.Vector3(1, 0, 0);\r\n }\r\n\r\n /**\r\n * Create a new residue.\r\n *\r\n * @param {string} name - Residue name.\r\n * @param {number} sequence - Residue sequence number.\r\n * @param {string} iCode - Insertion code.\r\n * @returns {Residue} - Newly created residue instance.\r\n */\r\n addResidue(name, sequence, iCode) {\r\n let type = this._complex.getResidueType(name);\r\n if (type === null) {\r\n type = this._complex.addResidueType(name);\r\n }\r\n const residue = new Residue(this, type, sequence, iCode);\r\n this._complex.addResidue(residue);\r\n this._residues.push(residue);\r\n\r\n if (type.flags & (ResidueType.Flags.NUCLEIC | ResidueType.Flags.PROTEIN)) {\r\n if (this.maxSequence < sequence) {\r\n this.maxSequence = sequence;\r\n }\r\n if (this.minSequence > sequence) {\r\n this.minSequence = sequence;\r\n }\r\n }\r\n\r\n return residue;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this._mask = mask;\r\n }\r\n}\r\n\r\nexport default Chain;\r\n","import Residue from './Residue';\r\n\r\n/** An element of protein secondary structure. */\r\nclass StructuralElement {\r\n /**\r\n * Create a secondary structural element of the specified type.\r\n *\r\n * @param {StructuralElement.Type} type Secondary structure type.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n */\r\n constructor(type, init, term) {\r\n /**\r\n * Secondary structure type.\r\n * @type {StructuralElement.Type}\r\n */\r\n this.type = type;\r\n /**\r\n * Generic secondary structure type.\r\n * @type {StructuralElement.Generic}\r\n */\r\n this.generic = StructuralElement.genericByType[this.type] || 'loop';\r\n /**\r\n * Initial residue.\r\n * @type Residue\r\n */\r\n this.init = init;\r\n /**\r\n * Terminal residue.\r\n * @type Residue\r\n */\r\n this.term = term;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n if (this.init instanceof Residue && this.term instanceof Residue) {\r\n return;\r\n }\r\n\r\n // Link all intermediate residues to this structural element\r\n const start = complex.splitUnifiedSerial(this.init);\r\n const end = complex.splitUnifiedSerial(this.term);\r\n for (let chainId = start.chain; chainId <= end.chain; chainId++) {\r\n for (let serialId = start.serial; serialId <= end.serial; serialId++) {\r\n for (let { iCode } = start; iCode <= end.iCode; iCode++) {\r\n const hashCode = complex.getUnifiedSerial(chainId, serialId, iCode);\r\n if (residueHash[hashCode]) {\r\n residueHash[hashCode]._secondary = this;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Replace unfined serials by objects\r\n this.init = residueHash[this.init];\r\n this.term = residueHash[this.term];\r\n }\r\n}\r\n\r\n/**\r\n * Specific type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Generic\r\n */\r\nStructuralElement.Type = {\r\n /** A strand of a [beta-sheet](https://en.wikipedia.org/wiki/Beta_sheet). */\r\n STRAND: 'E',\r\n /** An isolated beta-bridge (too small for a beta-sheet). */\r\n BRIDGE: 'B',\r\n\r\n /** A [3/10 helix](https://en.wikipedia.org/wiki/310_helix) (hydrogen bonding is 3 residues apart). */\r\n HELIX_310: 'G',\r\n /** An [alpha-helix](https://en.wikipedia.org/wiki/Alpha_helix) (hydrogen bonding is 4 residues apart). */\r\n HELIX_ALPHA: 'H',\r\n /** A [pi-helix](https://en.wikipedia.org/wiki/Pi_helix) (hydrogen bonding is 5 residues apart). */\r\n HELIX_PI: 'I',\r\n /** A generic helix of unspecified bonding distance. */\r\n HELIX: 'X',\r\n\r\n /** An isolated 3/10-like helical turn. */\r\n TURN_310: '3',\r\n /** An isolated alpha-like helical turn. */\r\n TURN_ALPHA: '4',\r\n /** An isolated pi-like helical turn. */\r\n TURN_PI: '5',\r\n /** An isolated helical [turn](https://en.wikipedia.org/wiki/Turn_(biochemistry)) of unspecified bonding distance. */\r\n TURN: 'T',\r\n\r\n /** A bend (a region of high curvature). */\r\n BEND: 'S',\r\n /** Just a protein section with no particular conformation. */\r\n COIL: 'C',\r\n};\r\n\r\n/**\r\n * Generic type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Type\r\n */\r\nStructuralElement.Generic = {\r\n /** A strand of a sheet. */\r\n STRAND: 'strand',\r\n /** A helix. */\r\n HELIX: 'helix',\r\n /** Just a protein section with no particular conformation. */\r\n LOOP: 'loop',\r\n};\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\nconst StructuralElementGeneric = StructuralElement.Generic;\r\n\r\n/**\r\n * A mapping from specific types to generic ones.\r\n * @type {Object}\r\n */\r\nStructuralElement.genericByType = {\r\n [StructuralElementType.STRAND]: StructuralElementGeneric.STRAND,\r\n [StructuralElementType.HELIX_310]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_ALPHA]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_PI]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX]: StructuralElementGeneric.HELIX,\r\n};\r\n\r\nexport default StructuralElement;\r\n","import StructuralElement from './StructuralElement';\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\nexport const typeByPDBHelixClass = {\r\n 1: StructuralElementType.HELIX_ALPHA,\r\n 3: StructuralElementType.HELIX_PI,\r\n 5: StructuralElementType.HELIX_310,\r\n};\r\n\r\n/**\r\n * Helical secondary structure of a protein.\r\n * @extends StructuralElement\r\n */\r\nclass Helix extends StructuralElement {\r\n /**\r\n * Create a helix.\r\n *\r\n * @param {number} helixClass A helix class according to the\r\n * [PDB Format](http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX).\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} serial Serial number of the helix (see PDB Format).\r\n * @param {string} name Helix identifier (see PDB Format).\r\n * @param {string} comment Comment about this helix (see PDB Format).\r\n * @param {number} length Length of this helix, in residues (see PDB Format).\r\n */\r\n constructor(helixClass, init, term, serial, name, comment, length) {\r\n super(typeByPDBHelixClass[helixClass] || StructuralElement.Type.HELIX, init, term);\r\n\r\n /**\r\n * Serial number of the helix (see PDB Format).\r\n * @type {number}\r\n */\r\n this.serial = serial;\r\n /**\r\n * Helix identifier (see PDB Format).\r\n * @type {string}\r\n */\r\n this.name = name;\r\n /**\r\n * Comment about this helix (see PDB Format).\r\n * @type {string}\r\n */\r\n this.comment = comment;\r\n /**\r\n * Length of this helix, in residues (see PDB Format).\r\n * @type {number}\r\n */\r\n this.length = length;\r\n }\r\n}\r\n\r\nexport default Helix;\r\n","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","import StructuralElement from './StructuralElement';\r\n\r\n/**\r\n * A single strand of a sheet in a protein secondary structure.\r\n * @extends StructuralElement\r\n */\r\nclass Strand extends StructuralElement {\r\n /**\r\n * Create a strand.\r\n *\r\n * @param {Sheet} sheet Parent sheet this strand belongs to.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} sense Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @param {Atom} atomCur Atom in current strand (see PDB Format).\r\n * @param {Atom} atomPrev Atom in previous strand (see PDB Format).\r\n */\r\n constructor(sheet, init, term, sense, atomCur, atomPrev) {\r\n super(StructuralElement.Type.STRAND, init, term);\r\n\r\n /**\r\n * Parent sheet this strand belongs to.\r\n * @type {Sheet}\r\n */\r\n this.sheet = sheet;\r\n /**\r\n * Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @type {number}\r\n */\r\n this.sense = sense;\r\n /**\r\n * Atom in current strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomCur = atomCur;\r\n /**\r\n * Atom in previous strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomPrev = atomPrev;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n *\r\n * @override\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n super._finalize(serialAtomMap, residueHash, complex);\r\n\r\n let as = this.atomCur;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomCur = serialAtomMap[as];\r\n }\r\n as = this.atomPrev;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomPrev = serialAtomMap[as];\r\n }\r\n }\r\n}\r\n\r\nexport default Strand;\r\n","import Strand from './Strand';\r\n\r\n/**\r\n * Sheet secondary structure of a protein.\r\n *\r\n * @param {string} name -\r\n * @param {number} width -\r\n *\r\n * @exports Sheet\r\n * @constructor\r\n */\r\nclass Sheet {\r\n constructor(name, width) {\r\n this._name = name;\r\n this._width = width;\r\n\r\n this._strands = [];\r\n }\r\n\r\n // Getters and setters\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getWidth() {\r\n return this._width;\r\n }\r\n\r\n addStrand(strand) {\r\n this._strands.push(strand);\r\n this._width = this._strands.length;\r\n }\r\n\r\n addEmptyStrand() {\r\n this._strands.push(new Strand(null, null, null, null, null, null));\r\n }\r\n\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n const s = this._strands;\r\n for (let i = 0, n = s.length; i < n; ++i) {\r\n s[i]._finalize(serialAtomMap, residueHash, complex);\r\n }\r\n if (!this._width) {\r\n this._width = s.length;\r\n }\r\n if (s.length !== this._width) {\r\n throw new Error(`Sheet ${this._name} is inconsistent.`);\r\n }\r\n }\r\n}\r\n\r\nexport default Sheet;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Atom measurements.\r\n *\r\n * @param {string} id - SGroup id\r\n * @param {string} name - Name of the group\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n * @param {array} atoms - Atoms group consists of\r\n * @param {object} saveNode - XML node from file for saving\r\n *\r\n * @exports SGroup\r\n * @constructor\r\n */\r\nclass SGroup {\r\n constructor(id, name, position, atoms, saveNode) {\r\n this._id = id;\r\n this._name = name;\r\n this._position = position || new THREE.Vector3();\r\n this._atoms = atoms || [];\r\n this._charge = 0; // default group charge\r\n this._repeat = 1; // how many times group repeated: always > 0\r\n this._center = null;\r\n this.xmlNodeRef = saveNode || null;\r\n }\r\n\r\n /**\r\n * Get atom full name.\r\n * @returns {string} Atom full name.\r\n */\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getPosition() {\r\n return this._position;\r\n }\r\n\r\n getCentralPoint() {\r\n return this._center;\r\n }\r\n\r\n _rebuildSGroupOnAtomChange() {\r\n const nLimon = 100000000;\r\n if (this._center === null) {\r\n return; // nothing to do if we are not relative\r\n }\r\n\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n for (let j = 0, n = this._atoms.length; j < n; j++) {\r\n const aPos = this._atoms[j].position;\r\n bLow.set(Math.min(bLow.x, aPos.x), Math.min(bLow.y, aPos.y), Math.min(bLow.z, aPos.z));\r\n bHight.set(Math.max(bHight.x, aPos.x), Math.max(bHight.y, aPos.y), Math.max(bHight.z, aPos.z));\r\n }\r\n this._center.addVectors(bLow, bHight);\r\n this._center.multiplyScalar(0.5);\r\n }\r\n}\r\n\r\nexport default SGroup;\r\n","/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,8],$V5=[1,9],$V6=[1,11],$V7=[1,12],$V8=[5,7,8,11],$V9=[1,17],$Va=[1,22],$Vb=[1,20],$Vc=[1,21],$Vd=[5,7,8,11,19];\r\nvar parser = {trace: function trace() { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Expression\":4,\"EOF\":5,\"Selector\":6,\"OR\":7,\"AND\":8,\"NOT\":9,\"(\":10,\")\":11,\"SELECTOR\":12,\"NAMED_SELECTOR\":13,\"SELECTOR_RANGED\":14,\"RangeList\":15,\"SELECTOR_NAMED\":16,\"NameList\":17,\"Range\":18,\",\":19,\"NUMBER\":20,\":\":21,\"Name\":22,\"IDENTIFIER\":23,\"STRING\":24,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",7:\"OR\",8:\"AND\",9:\"NOT\",10:\"(\",11:\")\",12:\"SELECTOR\",13:\"NAMED_SELECTOR\",14:\"SELECTOR_RANGED\",16:\"SELECTOR_NAMED\",19:\",\",20:\"NUMBER\",21:\":\",23:\"IDENTIFIER\",24:\"STRING\"},\r\nproductions_: [0,[3,2],[4,1],[4,3],[4,3],[4,2],[4,3],[6,1],[6,1],[6,2],[6,2],[15,1],[15,3],[18,1],[18,3],[17,1],[17,3],[22,1],[22,1],[22,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.keyword('or')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.keyword('and')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.keyword('not')($$[$0]);\r\nbreak;\r\ncase 6:\r\nthis.$ = $$[$0-1];\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.keyword($$[$0])();\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.GetSelector($$[$0].toLowerCase().slice(1, $$[$0].length));\r\nbreak;\r\ncase 9: case 10:\r\nthis.$ = yy.keyword($$[$0-1])($$[$0]);\r\nbreak;\r\ncase 11:\r\nthis.$ = new yy.RangeList($$[$0]);\r\nbreak;\r\ncase 12: case 16:\r\nthis.$ = $$[$0-2].append($$[$0]);\r\nbreak;\r\ncase 13:\r\nthis.$ = new yy.Range(Number($$[$0]));\r\nbreak;\r\ncase 14:\r\nthis.$ = new yy.Range(Number($$[$0-2]), Number($$[$0]));\r\nbreak;\r\ncase 15:\r\nthis.$ = new yy.ValueList($$[$0]);\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{1:[3]},{5:[1,10],7:$V6,8:$V7},o($V8,[2,2]),{4:13,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:14,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,7]),o($V8,[2,8]),{15:15,18:16,20:$V9},{17:18,20:$Va,22:19,23:$Vb,24:$Vc},{1:[2,1]},{4:23,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:24,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,5]),{7:$V6,8:$V7,11:[1,25]},o($V8,[2,9],{19:[1,26]}),o($Vd,[2,11]),o($Vd,[2,13],{21:[1,27]}),o($V8,[2,10],{19:[1,28]}),o($Vd,[2,15]),o($Vd,[2,17]),o($Vd,[2,18]),o($Vd,[2,19]),o([5,7,11],[2,3],{8:$V7}),o($V8,[2,4]),o($V8,[2,6]),{18:29,20:$V9},{20:[1,30]},{20:$Va,22:31,23:$Vb,24:$Vc},o($Vd,[2,12]),o($Vd,[2,14]),o($Vd,[2,16])],\r\ndefaultActions: {10:[2,1]},\r\nparseError: function parseError(str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function (match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex() {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin(condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState() {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules() {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState(n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState(condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* skip whitespace */\r\nbreak;\r\ncase 1:return 20;\r\nbreak;\r\ncase 2:return 7;\r\nbreak;\r\ncase 3:return 8;\r\nbreak;\r\ncase 4:return 9;\r\nbreak;\r\ncase 5:return 12;\r\nbreak;\r\ncase 6:return 16;\r\nbreak;\r\ncase 7:return 14;\r\nbreak;\r\ncase 8:return 10;\r\nbreak;\r\ncase 9:return 11;\r\nbreak;\r\ncase 10:return 19;\r\nbreak;\r\ncase 11:return 21;\r\nbreak;\r\ncase 12:return '<=';\r\nbreak;\r\ncase 13:return '>=';\r\nbreak;\r\ncase 14:return '<';\r\nbreak;\r\ncase 15:return '>';\r\nbreak;\r\ncase 16:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 24;\r\nbreak;\r\ncase 17:return 13;\r\nbreak;\r\ncase 18:return 23;\r\nbreak;\r\ncase 19:return 5;\r\nbreak;\r\ncase 20:return 'INVALID';\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:(-?(?:[1-9][0-9]+|[0-9]))\\b)/i,/^(?:OR\\b)/i,/^(?:AND\\b)/i,/^(?:NOT\\b)/i,/^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\\b)/i,/^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\\b)/i,/^(?:((SERIAL|SEQUENCE|RESIDX))\\b)/i,/^(?:\\()/i,/^(?:\\))/i,/^(?:,)/i,/^(?::)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:(@[_A-Z0-9]+))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:.)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","import utils from '../../utils';\r\n\r\n//----------------------------------------------------------------------------\r\nclass Range {\r\n constructor(min, max) {\r\n this.min = min;\r\n this.max = typeof max === 'undefined' ? min : max;\r\n }\r\n\r\n includes(value) {\r\n return this.min <= value && value <= this.max;\r\n }\r\n\r\n toString() {\r\n const { min, max } = this;\r\n return min === max ? String(min) : [min, max].join(':');\r\n }\r\n\r\n toJSON() {\r\n return [this.min, this.max];\r\n }\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\nclass List {\r\n constructor(arg) {\r\n if (arg instanceof this.constructor) {\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n }\r\n\r\n append(value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n }\r\n\r\n toString() {\r\n return this._values.join(',');\r\n }\r\n\r\n toJSON() {\r\n const values = this._values;\r\n const result = [];\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n result[i] = value.toJSON ? value.toJSON() : value;\r\n }\r\n return result;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nclass RangeList extends List {\r\n includes(value) {\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n if (list[i].includes(value)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nconst valuesArray = [];\r\n\r\nclass ValueList extends List {\r\n constructor(arg, upperOnly) {\r\n const list = super(arg);\r\n if (upperOnly) {\r\n this.upperOnly = true;\r\n const values = list._values;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n if (typeof value === 'string') {\r\n values[i] = value.toUpperCase();\r\n }\r\n }\r\n } else {\r\n this.upperOnly = false;\r\n }\r\n return list;\r\n }\r\n\r\n includes(value) {\r\n // we do not convert to upper case here for perfomance reasons\r\n // if list is upper case only, value must be converted before it is sent up to here\r\n return this._values.indexOf(value) !== -1;\r\n }\r\n\r\n toString() {\r\n // Quote values that are not correct identifiers\r\n const values = this._values;\r\n valuesArray.length = 0;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n valuesArray[i] = utils.correctSelectorIdentifier(String(values[i]));\r\n }\r\n return valuesArray.join(',');\r\n }\r\n\r\n _validate(value) {\r\n return (this.upperOnly && typeof value === 'string') ? value.toUpperCase() : value;\r\n }\r\n\r\n append(value) {\r\n super.append(this._validate(value));\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n super.remove(this._validate(value));\r\n return this;\r\n }\r\n}\r\n\r\nexport {\r\n Range,\r\n List,\r\n RangeList,\r\n ValueList,\r\n};\r\n","import { RangeList, ValueList } from './selectArgs';\r\n\r\n/** Base class for atom selectors. */\r\nclass Selector {\r\n toString() {\r\n return this.keyword;\r\n }\r\n\r\n toJSON() {\r\n return [this.name];\r\n }\r\n}\r\n\r\nSelector.prototype.name = 'Error';\r\nSelector.prototype.keyword = 'error';\r\n\r\n/** Base class for list-based atom selectors. */\r\nclass ListSelector extends Selector {\r\n constructor(list) {\r\n super();\r\n this.list = list;\r\n }\r\n\r\n toString() {\r\n return `${this.keyword} ${this.list}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.list.toJSON()];\r\n }\r\n}\r\n\r\nclass RangeListSelector extends ListSelector {\r\n constructor(arg) {\r\n super(new RangeList(arg));\r\n }\r\n}\r\n\r\nclass ValueListSelector extends ListSelector {\r\n constructor(arg, caseSensitive) {\r\n super(new ValueList(arg, !caseSensitive));\r\n }\r\n}\r\n\r\nclass NoneSelector extends Selector {\r\n includesAtom(_atom) {\r\n return false;\r\n }\r\n}\r\n\r\nNoneSelector.prototype.name = 'None';\r\nNoneSelector.prototype.keyword = 'none';\r\n\r\nclass AllSelector extends Selector {\r\n includesAtom(_atom) {\r\n return true;\r\n }\r\n}\r\n\r\nAllSelector.prototype.name = 'All';\r\nAllSelector.prototype.keyword = 'all';\r\n\r\nexport {\r\n Selector,\r\n ListSelector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n};\r\n","import { Selector, NoneSelector } from './selectorsBase';\r\n\r\n//----------------------------------------------------------------------------\r\n// Operators\r\n//----------------------------------------------------------------------------\r\nconst none = new NoneSelector();\r\n\r\nclass PrefixOperator extends Selector {\r\n constructor(rhs) {\r\n super();\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nPrefixOperator.prototype.priority = 1;\r\n\r\nclass InfixOperator extends Selector {\r\n constructor(lhs, rhs) {\r\n super();\r\n this.lhs = lhs || none;\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const lhs = this.lhs.priority && this.lhs.priority > this.priority ? `(${this.lhs})` : this.lhs;\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${lhs} ${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.lhs.toJSON(), this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nInfixOperator.prototype.priority = 1000;\r\n\r\nexport { PrefixOperator, InfixOperator };\r\n","import Atom from './Atom';\r\nimport ResidueType from './ResidueType';\r\nimport { parser } from '../utils/SelectionParser';\r\nimport { Range, RangeList, ValueList } from './selectors/selectArgs';\r\nimport { PrefixOperator, InfixOperator } from './selectors/selectOps';\r\nimport {\r\n Selector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n} from './selectors/selectorsBase';\r\n\r\nconst keywords = {};\r\n\r\n//----------------------------------------------------------------------------\r\n// Named selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineSelector(name, SelectorClass) {\r\n const keyword = name.toLowerCase();\r\n SelectorClass.prototype.keyword = keyword;\r\n SelectorClass.prototype.name = name;\r\n\r\n const factory = ((...args) => new SelectorClass(...args));\r\n factory.SelectorClass = SelectorClass;\r\n keywords[keyword] = factory;\r\n\r\n return SelectorClass;\r\n}\r\n\r\ndefineSelector('Serial', class SerialSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.serial);\r\n }\r\n});\r\n\r\ndefineSelector('Name', class NameSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.name);\r\n }\r\n});\r\n\r\ndefineSelector('AltLoc', class AltLocSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(String.fromCharCode(atom.location));\r\n }\r\n});\r\n\r\ndefineSelector('Elem', class ElemSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.element.name);\r\n }\r\n});\r\n\r\ndefineSelector('Residue', class ResidueSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._type._name);\r\n }\r\n});\r\n\r\ndefineSelector('Sequence', class SequenceSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._sequence);\r\n }\r\n});\r\n\r\ndefineSelector('ICode', class ICodeSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._icode);\r\n }\r\n});\r\n\r\ndefineSelector('ResIdx', class ResIdxSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._index);\r\n }\r\n});\r\n\r\ndefineSelector('Chain', class ChainSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._chain._name);\r\n }\r\n});\r\n\r\ndefineSelector('Hetatm', class HetatmSelector extends Selector {\r\n includesAtom(atom) {\r\n return atom.het;\r\n }\r\n});\r\n\r\ndefineSelector('PolarH', class PolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.HYDROGEN;\r\n }\r\n});\r\n\r\ndefineSelector('NonPolarH', class NonPolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.NONPOLARH;\r\n }\r\n});\r\n\r\ndefineSelector('All', AllSelector);\r\n\r\ndefineSelector('None', NoneSelector);\r\n\r\nconst NULL_SELECTOR = keywords.none();\r\n\r\n//----------------------------------------------------------------------------\r\n// Named operators\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineOperator(name, priority, OperatorClass) {\r\n OperatorClass.prototype.priority = priority;\r\n return defineSelector(name, OperatorClass);\r\n}\r\ndefineOperator('Not', 1, class NotOperator extends PrefixOperator {\r\n includesAtom(atom) {\r\n return !this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('And', 2, class AndOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) && this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('Or', 3, class OrOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) || this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\n//----------------------------------------------------------------------------\r\n// Flag selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction byResidueTypeFlag(flag, name) {\r\n return defineSelector(name, class extends Selector {\r\n includesAtom(atom) {\r\n return (atom.residue._type.flags & flag) !== 0;\r\n }\r\n });\r\n}\r\n\r\nbyResidueTypeFlag(ResidueType.Flags.PROTEIN, 'Protein');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC, 'Basic');\r\nbyResidueTypeFlag(ResidueType.Flags.ACIDIC, 'Acidic');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC | ResidueType.Flags.ACIDIC, 'Charged');\r\nbyResidueTypeFlag(ResidueType.Flags.POLAR, 'Polar');\r\nbyResidueTypeFlag(ResidueType.Flags.NONPOLAR, 'NonPolar');\r\nbyResidueTypeFlag(ResidueType.Flags.AROMATIC, 'Aromatic');\r\nbyResidueTypeFlag(ResidueType.Flags.NUCLEIC, 'Nucleic');\r\nbyResidueTypeFlag(ResidueType.Flags.PURINE, 'Purine');\r\nbyResidueTypeFlag(ResidueType.Flags.PYRIMIDINE, 'Pyrimidine');\r\nbyResidueTypeFlag(ResidueType.Flags.WATER, 'Water');\r\n\r\n//----------------------------------------------------------------------------\r\nconst selectors = Object.create(keywords);\r\n\r\nselectors.Selector = Selector;\r\nselectors.RangeListSelector = RangeListSelector;\r\nselectors.ValueListSelector = ValueListSelector;\r\nselectors.Range = Range;\r\nselectors.RangeList = RangeList;\r\nselectors.ValueList = ValueList;\r\nselectors.PrefixOperator = PrefixOperator;\r\nselectors.InfixOperator = InfixOperator;\r\nselectors.Context = Object.create({});\r\n\r\nselectors.GetSelector = function (key) {\r\n if (!selectors.Context.hasOwnProperty(key)) {\r\n const exc = { message: `selector ${key} is not registered` };\r\n throw exc;\r\n }\r\n return selectors.Context[key] || NULL_SELECTOR;\r\n};\r\n\r\nselectors.ClearContext = function () {\r\n Object.keys(selectors.Context).forEach((k) => { delete selectors.Context[k]; });\r\n};\r\n\r\nselectors.keyword = function (key) {\r\n return keywords[key.toLowerCase()] || keywords.none;\r\n};\r\n\r\nselectors.parse = function (str) {\r\n const res = {};\r\n try {\r\n res.selector = parser.parse(str);\r\n } catch (e) {\r\n res.selector = NULL_SELECTOR;\r\n res.error = e.message;\r\n }\r\n return res;\r\n};\r\n\r\nparser.yy = selectors;\r\nparser.yy.parseError = parser.parseError; // workaround for incorrect JISON parser generator for AMD module\r\n\r\nexport default selectors;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\n\r\n/**\r\n * Basic biological unit class.\r\n *\r\n * @exports BiologicalUnit\r\n * @constructor\r\n */\r\nclass BiologicalUnit {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._selector = selectors.keyword('All')();\r\n this._boundaries = {\r\n boundingBox: new THREE.Box3(),\r\n boundingSphere: new THREE.Sphere(),\r\n };\r\n }\r\n\r\n computeBoundaries() {\r\n const atoms = this._complex._atoms;\r\n const n = atoms.length;\r\n const selector = this._selector;\r\n\r\n const { boundingBox } = this._boundaries;\r\n boundingBox.makeEmpty();\r\n if (n === 1) {\r\n boundingBox.expandByPoint(atoms[0].position);\r\n const bbc = new THREE.Vector3();\r\n boundingBox.getCenter(bbc);\r\n const s = 2 * atoms[0].element.radius;\r\n boundingBox.setFromCenterAndSize(bbc, new THREE.Vector3(s, s, s));\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (selector.includesAtom(atoms[i])) {\r\n boundingBox.expandByPoint(atoms[i].position);\r\n }\r\n }\r\n }\r\n\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n if (n === 1) {\r\n this._boundaries.boundingSphere.set(center, atoms[0].element.radius);\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (!selector.includesAtom(atoms[i])) {\r\n continue;\r\n }\r\n const pos = atoms[i].position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n this._boundaries.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n }\r\n\r\n getTransforms() {\r\n return [];\r\n }\r\n\r\n getSelector() {\r\n return this._selector;\r\n }\r\n\r\n getBoundaries() {\r\n return this._boundaries;\r\n }\r\n\r\n finalize() {\r\n }\r\n}\r\n\r\nexport default BiologicalUnit;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\nimport BiologicalUnit from './BiologicalUnit';\r\n\r\n/**\r\n * Biological assembly.\r\n *\r\n * @exports Assembly\r\n * @constructor\r\n */\r\n\r\nclass Assembly extends BiologicalUnit {\r\n constructor(complex) {\r\n super(complex);\r\n this.chains = [];\r\n this.matrices = [];\r\n }\r\n\r\n computeBoundaries() {\r\n super.computeBoundaries();\r\n // fix up the boundaries\r\n const { matrices } = this;\r\n const oldCenter = this._boundaries.boundingSphere.center;\r\n const oldRad = this._boundaries.boundingSphere.radius;\r\n const boundingBox = this._boundaries.boundingBox = new THREE.Box3();\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = matrices.length; i < n; ++i) {\r\n boundingBox.expandByPoint(oldCenter.clone().applyMatrix4(matrices[i]));\r\n }\r\n\r\n const newRad = boundingBox.max.distanceTo(boundingBox.min) / 2 + oldRad;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n this._boundaries.boundingSphere = new THREE.Sphere().set(center, newRad);\r\n boundingBox.max.addScalar(oldRad);\r\n boundingBox.min.subScalar(oldRad);\r\n }\r\n\r\n /**\r\n * Mark a chain as belonging to this biological assembly.\r\n * @param {string} chain - chain identifier, usually a single letter\r\n */\r\n addChain(chain) {\r\n this.chains[this.chains.length] = chain;\r\n }\r\n\r\n /**\r\n * Add a transformation matrix.\r\n * @param {THREE.Matrix4} matrix - transformation matrix\r\n */\r\n addMatrix(matrix) {\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n getTransforms() {\r\n return this.matrices;\r\n }\r\n\r\n finalize() {\r\n if (this.chains.length > 0) {\r\n this._selector = selectors.keyword('Chain')(this.chains);\r\n } else {\r\n this._selector = selectors.keyword('None')();\r\n }\r\n }\r\n}\r\n\r\nexport default Assembly;\r\n","/**\r\n * This class represents connected component as a part of a complex.\r\n * WARNING! The whole component entity is build under the assumption that residues\r\n * are placed in the chains and complex in ascending order of indices\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n *\r\n * @exports Component\r\n * @constructor\r\n */\r\nclass Component {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._index = -1;\r\n this._residueIndices = [];\r\n this._cycles = [];\r\n this._subDivs = [];\r\n this._residueCount = 0;\r\n }\r\n\r\n getResidues() {\r\n return this._complex._residues;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residueCount;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._complex._residues;\r\n const resIdc = this._residueIndices;\r\n for (let idIdc = 0, idCount = resIdc.length; idIdc < idCount; ++idIdc) {\r\n for (let idx = resIdc[idIdc].start, last = resIdc[idIdc].end; idx <= last; ++idx) {\r\n process(residues[idx]);\r\n }\r\n }\r\n }\r\n\r\n setSubDivs(subDivs) {\r\n this._subDivs = subDivs;\r\n let curr = 0;\r\n const resIdc = [];\r\n let resCnt = 0;\r\n for (let i = 0, n = subDivs.length; i < n; ++i) {\r\n if (i === n - 1 || subDivs[i].end + 1 !== subDivs[i + 1].start) {\r\n const { start } = subDivs[curr];\r\n const { end } = subDivs[i];\r\n resIdc[resIdc.length] = {\r\n start,\r\n end,\r\n };\r\n resCnt += end - start + 1;\r\n curr = i + 1;\r\n }\r\n }\r\n\r\n this._residueIndices = resIdc;\r\n this._residueCount = resCnt;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._complex._bonds;\r\n\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue._component === this) {\r\n process(bond);\r\n }\r\n }\r\n }\r\n\r\n update() {\r\n this.forEachCycle((cycle) => {\r\n cycle.update();\r\n });\r\n }\r\n\r\n forEachAtom(process) {\r\n this.forEachResidue((residue) => {\r\n residue.forEachAtom(process);\r\n });\r\n }\r\n\r\n addCycle(cycle) {\r\n this._cycles.push(cycle);\r\n }\r\n\r\n forEachCycle(process) {\r\n const cycles = this._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n process(cycles[i]);\r\n }\r\n }\r\n\r\n markResidues() {\r\n const self = this;\r\n self.forEachResidue((residue) => {\r\n residue._component = self;\r\n });\r\n }\r\n\r\n _forEachSubChain(mask, process) {\r\n const residues = this._complex._residues;\r\n const subs = this._subDivs;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let idx = subs[i].start, last = subs[i].end; idx <= last; ++idx) {\r\n const currRes = residues[idx];\r\n if (mask & currRes._mask && currRes._isValid) {\r\n let end = idx + 1;\r\n for (; end <= last; ++end) {\r\n const endRes = residues[end];\r\n if (!(mask & endRes._mask && endRes._isValid)) {\r\n break;\r\n }\r\n }\r\n process(i, idx, end - 1);\r\n idx = end;\r\n }\r\n }\r\n }\r\n }\r\n\r\n getMaskedSequences(mask) {\r\n const subs = [];\r\n let idx = 0;\r\n this._forEachSubChain(mask, (_subIdx, start, end) => {\r\n subs[idx++] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n\r\n getMaskedSubdivSequences(mask) {\r\n const subs = [];\r\n let currIdx = -1;\r\n let lastSubIdx = -1;\r\n const subDivs = this._subDivs;\r\n\r\n this._forEachSubChain(mask, (subIdx, start, end) => {\r\n if (lastSubIdx !== subIdx) {\r\n ++currIdx;\r\n subs[currIdx] = {\r\n arr: [],\r\n boundaries: subDivs[subIdx],\r\n };\r\n lastSubIdx = subIdx;\r\n }\r\n subs[currIdx].arr[subs[currIdx].arr.length] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n}\r\n\r\nexport default Component;\r\n","import utils from '../utils';\r\n\r\nconst cMaxPairsForHashCode = 32;\r\nconst cHashTableSize = 1024 * 1024;\r\nconst cNumbersPerPair = 4;\r\nconst cMaxNeighbours = 14;\r\nconst cInvalidVal = -1;\r\n// 89237 is a large simple number, can be used for pseudo random hash code create\r\nconst cBigPrime = 89237;\r\n\r\nclass AtomPairs {\r\n constructor(maxPairsEstimate) {\r\n this.numPairs = 0;\r\n this.numMaxPairs = maxPairsEstimate;\r\n this.intBuffer = utils.allocateTyped(Int32Array, maxPairsEstimate * cNumbersPerPair);\r\n for (let i = 0; i < maxPairsEstimate * cNumbersPerPair; i++) {\r\n this.intBuffer[i] = cInvalidVal;\r\n }\r\n this.hashBuffer = utils.allocateTyped(Int32Array, cHashTableSize * cMaxPairsForHashCode);\r\n for (let i = 0; i < cHashTableSize * cMaxPairsForHashCode; i++) {\r\n this.hashBuffer[i] = cInvalidVal;\r\n }\r\n }\r\n\r\n /**\r\n * Destroy all pairs memory\r\n */\r\n destroy() {\r\n this.intBuffer = null;\r\n this.hashBuffer = null;\r\n }\r\n\r\n /**\r\n * Add pair of atoms to collection\r\n * @param {number} indexA - Index of the 1st vertex.\r\n * @param {number} indexB - Index of the 2nd vertex.\r\n */\r\n addPair(indexA, indexB) {\r\n const ia = (indexA < indexB) ? indexA : indexB;\r\n const ib = (indexA > indexB) ? indexA : indexB;\r\n const codeToAdd = ia + (ib << cMaxNeighbours);\r\n\r\n const hashCode = (ia + (ib * cBigPrime)) & (cHashTableSize - 1);\r\n let j = hashCode * cMaxPairsForHashCode;\r\n let apI = 0;\r\n for (; apI < cMaxPairsForHashCode; apI++) {\r\n const code = this.hashBuffer[j + apI];\r\n if (code === cInvalidVal) {\r\n break;\r\n }\r\n if (code === codeToAdd) {\r\n return false;\r\n }\r\n }\r\n // add this new hash code\r\n if (apI >= cMaxPairsForHashCode) {\r\n throw new Error('addPair: increase cMaxPairsForHashCode');\r\n }\r\n this.hashBuffer[j + apI] = codeToAdd;\r\n\r\n // actually add\r\n if (this.numPairs >= this.numMaxPairs) {\r\n throw new Error('addPair: increase num pairs');\r\n }\r\n j = this.numPairs * cNumbersPerPair;\r\n this.intBuffer[j] = ia;\r\n this.intBuffer[j + 1] = ib;\r\n this.intBuffer[j + 2] = codeToAdd;\r\n this.numPairs++;\r\n return true;\r\n }\r\n}\r\n\r\nexport default AtomPairs;\r\n","import AtomPairs from './AtomPairs';\r\nimport Bond from './Bond';\r\n\r\nconst cProfileBondBuilder = false;\r\nconst cEstBondsMultiplier = 4;\r\nconst cSpaceCode = 32;\r\nconst cBondTolerance = 0.45;\r\nconst cVMDTolerance = 0.6;\r\nconst cBondRadInJMOL = true;\r\nconst cEpsilon = 0.001;\r\n\r\n/**\r\n * Get radius used for building bonds.\r\n *\r\n * @param {Atom} atom - Atom object.\r\n * @returns {number} special value for bonding radius for this atom\r\n */\r\nfunction _getBondingRadius(atom) {\r\n const { element } = atom;\r\n if (element) {\r\n return element.radiusBonding;\r\n }\r\n throw new Error('_getBondingRadius: Logic error.');\r\n}\r\n\r\nfunction _isAtomEligible(atom) {\r\n // build for all non-hetatm and for hetatm without bonds\r\n return !atom.isHet() || (atom.bonds && atom.bonds.length === 0);\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Complex} complex molecular complex\r\n\r\n * @exports AutoBond\r\n * @constructor\r\n */\r\nclass AutoBond {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._maxRad = 1.8;\r\n const bBox = this._complex.getDefaultBoundaries().boundingBox;\r\n this._vBoxMin = bBox.min.clone();\r\n this._vBoxMax = bBox.max.clone();\r\n\r\n this._pairCollection = null;\r\n }\r\n\r\n /**\r\n * Add existing pairs of connectors (from pdb file after its reading)\r\n * @returns {number} 0\r\n */\r\n _addExistingPairs() {\r\n const atoms = this._complex.getAtoms();\r\n const numAtoms = atoms.length;\r\n let aInd = 0;\r\n const collection = this._pairCollection;\r\n\r\n for (; aInd < numAtoms; aInd++) {\r\n const { bonds } = atoms[aInd];\r\n const numBondsForAtom = bonds.length;\r\n for (let bInd = 0; bInd < numBondsForAtom; bInd++) {\r\n const bond = bonds[bInd];\r\n const indTo = bond._left.index;\r\n if (indTo === aInd) {\r\n collection.addPair(aInd, bond._right.index);\r\n }\r\n } // for (b) all bonds in atom\r\n } // for (a)\r\n return 0;\r\n }\r\n\r\n _findPairs() {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const atoms = this._complex._atoms;\r\n const atomsNum = atoms.length;\r\n const self = this;\r\n\r\n let rA;\r\n let isHydrogenA;\r\n let posA;\r\n let locationA;\r\n let atomA;\r\n\r\n const processAtom = function (atomB) {\r\n if (isHydrogenA && atomB.isHydrogen()) {\r\n return;\r\n }\r\n\r\n const locationB = atomB.location;\r\n if ((locationA !== cSpaceCode)\r\n && (locationB !== cSpaceCode)\r\n && (locationA !== locationB)) {\r\n return;\r\n }\r\n\r\n const dist2 = posA.distanceToSquared(atomB.position);\r\n const rB = atomB.element.radiusBonding;\r\n const maxAcceptable = cBondRadInJMOL ? rA + rB + cBondTolerance : cVMDTolerance * (rA + rB);\r\n\r\n if (dist2 > (maxAcceptable * maxAcceptable)) {\r\n return;\r\n }\r\n\r\n if (dist2 < cEpsilon) {\r\n return;\r\n }\r\n\r\n self._pairCollection.addPair(atomA.index, atomB.index);\r\n };\r\n\r\n for (let i = 0; i < atomsNum; ++i) {\r\n atomA = atoms[i];\r\n if (!_isAtomEligible(atomA)) {\r\n continue;\r\n }\r\n\r\n rA = atomA.element.radiusBonding;\r\n isHydrogenA = atomA.isHydrogen();\r\n posA = atomA.position;\r\n locationA = atomA.location;\r\n\r\n vw.forEachAtomWithinRadius(posA, 2 * this._maxRad + cBondTolerance, processAtom);\r\n }\r\n }\r\n\r\n _addPairs() {\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0, k = 0; i < this._pairCollection.numPairs; i++, k += 4) {\r\n const iA = this._pairCollection.intBuffer[k];\r\n const iB = this._pairCollection.intBuffer[k + 1];\r\n this._addPair(atoms[iA], atoms[iB]);\r\n }\r\n }\r\n\r\n _addPair(atomA, atomB) {\r\n const bondsA = atomA.bonds;\r\n const indexA = atomA.index;\r\n const indexB = atomB.index;\r\n for (let j = 0, numBonds = bondsA.length; j < numBonds; ++j) {\r\n const bond = bondsA[j];\r\n if (bond._left.index === indexB || bond._right.index === indexB) {\r\n return;\r\n }\r\n }\r\n const left = indexA < indexB ? atomA : atomB;\r\n const right = indexA < indexB ? atomB : atomA;\r\n const newBond = this._complex.addBond(left, right, 0, Bond.BondType.UNKNOWN, false);\r\n bondsA.push(newBond);\r\n atomB.bonds.push(newBond);\r\n }\r\n\r\n build() {\r\n if (cProfileBondBuilder) {\r\n console.time('Bonds Builder');\r\n }\r\n this._buildInner();\r\n\r\n if (cProfileBondBuilder) {\r\n console.timeEnd('Bonds Builder');\r\n }\r\n }\r\n\r\n _buildInner() {\r\n const atoms = this._complex._atoms;\r\n if (atoms.length < 2) {\r\n return;\r\n }\r\n if (atoms[0].index < 0) {\r\n throw new Error('AutoBond: Atoms in complex were not indexed.');\r\n }\r\n\r\n this._calcBoundingBox();\r\n this._pairCollection = new AtomPairs(atoms.length * cEstBondsMultiplier);\r\n this._addExistingPairs();\r\n this._findPairs();\r\n this._addPairs();\r\n }\r\n\r\n _calcBoundingBox() {\r\n const atoms = this._complex._atoms;\r\n const nAtoms = atoms.length;\r\n let maxRad = _getBondingRadius(atoms[0]);\r\n for (let i = 1; i < nAtoms; ++i) {\r\n maxRad = Math.max(maxRad, _getBondingRadius(atoms[i]));\r\n }\r\n this._vBoxMax.addScalar(maxRad);\r\n this._vBoxMin.addScalar(-maxRad);\r\n this._maxRad = maxRad * 1.2;\r\n }\r\n\r\n destroy() {\r\n if (this._pairCollection) {\r\n this._pairCollection.destroy();\r\n }\r\n }\r\n}\r\n\r\nexport default AutoBond;\r\n","import * as THREE from 'three';\r\nimport Bond from './Bond';\r\nimport Element from './Element';\r\n\r\nconst cCrossThresh = 0.1;\r\nconst cAromaticType = Bond.BondType.AROMATIC;\r\nconst cAromaticAtoms = [\r\n Element.ByName.C.number,\r\n Element.ByName.N.number,\r\n // Element.ByName.O.number,\r\n // Element.ByName.S.number,\r\n];\r\n\r\n\r\n/** Conditions for bonds:\r\n * - Cross product with each subsequent bond to add is collinear and point to the same direction\r\n * - Each pair of a adjacent bonds belong to not more than one cycle\r\n * - If there is more than one candidates we try them in ascending order of angle values\r\n */\r\n\r\nconst _coDirVectors = (function () {\r\n const v1Tmp = new THREE.Vector3();\r\n const v2Tmp = new THREE.Vector3();\r\n const cp = new THREE.Vector3();\r\n return function (v1, v2) {\r\n v1Tmp.copy(v1).normalize();\r\n v2Tmp.copy(v2).normalize();\r\n cp.crossVectors(v1Tmp, v2Tmp);\r\n if (cp.length() > cCrossThresh) {\r\n return false;\r\n }\r\n // zero vector in out terms must be collinear to any\r\n return v1Tmp.dot(v2Tmp) >= 0;\r\n };\r\n}());\r\n\r\nfunction _insertAscending(arr, val) {\r\n let idx = 0;\r\n while (idx < arr.length && arr[idx] < val) {\r\n ++idx;\r\n }\r\n arr.splice(idx, 0, val);\r\n}\r\n\r\nfunction _anotherAtom(bond, currAtom) {\r\n return bond._left === currAtom ? bond._right : bond._left;\r\n}\r\n\r\nfunction _cosBetween(v1, v2) {\r\n const theta = v1.dot(v2) / (Math.sqrt(v1.lengthSq() * v2.lengthSq()));\r\n return THREE.Math.clamp(theta, -1, 1);\r\n}\r\n\r\nfunction _markAromatic(bond) {\r\n bond._type = cAromaticType;\r\n}\r\n\r\nclass Cycle {\r\n constructor(atomsList) {\r\n this.atoms = atomsList;\r\n this.update();\r\n }\r\n\r\n update() {\r\n const { atoms } = this;\r\n const center = new THREE.Vector3();\r\n const nA = atoms.length;\r\n for (let j = 0; j < nA; ++j) {\r\n center.add(atoms[j].position);\r\n }\r\n center.multiplyScalar(1.0 / nA);\r\n this.center = center;\r\n this.radius = center.distanceTo(atoms[0].position.clone().lerp(atoms[1].position, 0.5));\r\n }\r\n\r\n forEachBond(process) {\r\n const { atoms } = this;\r\n const nA = atoms.length;\r\n let currAtom = atoms[0];\r\n let nextAtom;\r\n\r\n function checkBond(bond) {\r\n if (bond._left === nextAtom || bond._right === nextAtom) {\r\n process(bond);\r\n }\r\n }\r\n\r\n for (let i = 0; i < nA; ++i) {\r\n nextAtom = atoms[(i + 1) % nA];\r\n currAtom.forEachBond(checkBond);\r\n currAtom = nextAtom;\r\n }\r\n }\r\n}\r\n\r\nfunction _isAromatic(bond) {\r\n return bond._type === cAromaticType;\r\n}\r\n\r\nfunction _isPossibleAromatic(bond) {\r\n if (bond.type === cAromaticType) {\r\n return true;\r\n }\r\n const rightIdx = cAromaticAtoms.indexOf(bond._right.element.number);\r\n const leftIdx = cAromaticAtoms.indexOf(bond._left.element.number);\r\n return rightIdx !== -1 && leftIdx !== -1;\r\n}\r\n\r\nfunction _checkCycleSimple(cycle) {\r\n return cycle.length > 3;\r\n}\r\n\r\nfunction _checkCycleComplex(cycle) {\r\n console.assert(cycle.length > 2);\r\n return true;\r\n}\r\n\r\nclass AromaticLoopsMarker {\r\n constructor(complex) {\r\n this._complex = complex;\r\n const bondsData = new Array(complex._bonds.length);\r\n const bondMarks = new Array(complex._bonds.length);\r\n for (let i = 0, n = bondsData.length; i < n; ++i) {\r\n bondsData[i] = [];\r\n bondMarks[i] = false;\r\n }\r\n this._bondsData = bondsData;\r\n this._bondMarks = bondMarks;\r\n this._resetCycles();\r\n }\r\n\r\n _resetCycles() {\r\n this._cycles = [];\r\n this._currIdx = -1;\r\n }\r\n\r\n _haveSameCycle(bondsData, bond1, bond2) {\r\n const arr1 = bondsData[bond1._index];\r\n const arr2 = bondsData[bond2._index];\r\n const n1 = arr1.length;\r\n const n2 = arr2.length;\r\n let i1 = 0;\r\n let i2 = 0;\r\n while (i1 < n1 && i2 < n2) {\r\n if (arr1[i1] === arr2[i2]) {\r\n return true;\r\n }\r\n if (arr1[i1] > arr2[i2]) {\r\n ++i2;\r\n } else {\r\n ++i1;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _tryBond(prevBond, currRight, currDir) {\r\n const bondsOrder = [];\r\n const bondsData = this._bondsData;\r\n const currLeft = _anotherAtom(prevBond, currRight);\r\n const currVec = currRight.position.clone().sub(currLeft.position);\r\n const startAtomRef = this._currStart;\r\n const self = this;\r\n const bondMarks = this._bondMarks;\r\n let checkAromatic = this._checkBond;\r\n bondMarks[prevBond._index] = true;\r\n checkAromatic = checkAromatic === undefined ? _isAromatic : checkAromatic;\r\n currRight.forEachBond((newBond) => {\r\n if (!checkAromatic(newBond)\r\n || newBond === prevBond\r\n || bondMarks[newBond._index]\r\n || self._haveSameCycle(bondsData, prevBond, newBond)) {\r\n return;\r\n }\r\n const anotherAtom = _anotherAtom(newBond, currRight);\r\n const anotherVec = anotherAtom.position.clone().sub(currRight.position);\r\n const val = anotherAtom === startAtomRef ? -2.0 : 1 - _cosBetween(currVec, anotherVec);\r\n const newDir = anotherVec.cross(currVec);\r\n if (!_coDirVectors(newDir, currDir)) {\r\n return;\r\n }\r\n let idx = 0;\r\n while (idx < bondsOrder.length && bondsOrder[idx].val < val) {\r\n ++idx;\r\n }\r\n bondsOrder.splice(idx, 0, { bond: newBond, val, dir: newDir });\r\n });\r\n\r\n for (let i = 0, n = bondsOrder.length; i < n; ++i) {\r\n const { bond } = bondsOrder[i];\r\n const newRight = bond._left === currRight ? bond._right : bond._left;\r\n if (newRight === startAtomRef) {\r\n ++this._currIdx;\r\n this._cycles.push([currRight]);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n if (this._tryBond(bond, newRight, bondsOrder[i].dir)) {\r\n _insertAscending(bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(currRight);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n }\r\n bondMarks[prevBond._index] = false;\r\n return false;\r\n }\r\n\r\n _startCycle(bond) {\r\n // start from left to right\r\n this._currStart = bond._left;\r\n if (this._tryBond(bond, bond._right, new THREE.Vector3())) {\r\n _insertAscending(this._bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(bond._left);\r\n }\r\n }\r\n\r\n _findLoops(checkBond, checkCycle) {\r\n this._checkBond = checkBond;\r\n const complex = this._complex;\r\n const self = this;\r\n\r\n complex.forEachComponent((component) => {\r\n self._resetCycles();\r\n component.forEachBond((bond) => {\r\n if (checkBond(bond)) {\r\n self._startCycle(bond);\r\n }\r\n });\r\n const cycles = self._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n const cycle = cycles[i];\r\n if (!checkCycle(cycle)) {\r\n continue;\r\n }\r\n const newCycle = new Cycle(cycle);\r\n newCycle.forEachBond(_markAromatic);\r\n component.addCycle(newCycle);\r\n }\r\n });\r\n }\r\n\r\n markCycles() {\r\n this._findLoops(_isAromatic, _checkCycleSimple);\r\n }\r\n\r\n detectCycles() {\r\n this._findLoops(_isPossibleAromatic, _checkCycleComplex);\r\n }\r\n}\r\n\r\nexport default AromaticLoopsMarker;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\n/**\r\n * Calculate min & max radius of a sphere slice between zMin & zMax\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {number} zMin - lower bound of the slice\r\n * @param {number} zMax - upper bound of the slice\r\n */\r\nfunction _getSphereSliceRadiusRange(center, radius, zMin, zMax) {\r\n const dzMin = zMin - center.z;\r\n const dzMax = zMax - center.z;\r\n const rzMin = Math.sqrt(Math.max(radius * radius - dzMin * dzMin, 0.0));\r\n const rzMax = Math.sqrt(Math.max(radius * radius - dzMax * dzMax, 0.0));\r\n\r\n const rMin = Math.min(rzMin, rzMax);\r\n let rMax;\r\n\r\n if (zMin <= center.z && zMax >= center.z) {\r\n // sphere's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(rzMin, rzMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * Calculate min & max radius of a circle slice between yMin & yMax.\r\n *\r\n * To maintain analogy with _getSphereSliceRadiusRange we call radius what in fact is\r\n * half-width (along X axis) of the slice, i.e. 1D-sphere radius.\r\n *\r\n * @param {Vector3} center - center of the circle (z can be ignored)\r\n * @param {number} radius - circle radius\r\n * @param {number} yMin - lower bound of the slice\r\n * @param {number} yMax - upper bound of the slice\r\n * @returns {Array} - array of two numbers (min & max radius, or half-width)\r\n */\r\nfunction _getCircleSliceRadiusRange(center, radius, yMin, yMax) {\r\n const dyMin = yMin - center.y;\r\n const dyMax = yMax - center.y;\r\n const ryMin = Math.sqrt(Math.max(radius * radius - dyMin * dyMin, 0.0));\r\n const ryMax = Math.sqrt(Math.max(radius * radius - dyMax * dyMax, 0.0));\r\n\r\n const rMin = Math.min(ryMin, ryMax);\r\n let rMax;\r\n\r\n if (yMin <= center.y && yMax >= center.y) {\r\n // slice's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(ryMin, ryMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * VoxelWorld constructor\r\n *\r\n * @param {Box3} box - bounding box of the volume to be partitioned\r\n * @param {Vector3} vCellSizeHint - target voxel size (actual voxel size may differ from this)\r\n */\r\nclass VoxelWorld {\r\n constructor(box, vCellSizeHint) {\r\n this._box = box.clone();\r\n const size = new THREE.Vector3();\r\n box.getSize(size);\r\n this._count = size.clone().divide(vCellSizeHint).floor().max(new THREE.Vector3(1, 1, 1));\r\n this._last = this._count.clone().subScalar(1);\r\n this._cellSize = size.clone().divide(this._count);\r\n this._cellInnerR = 0.5 * Math.min(Math.min(this._cellSize.x, this._cellSize.y), this._cellSize.z);\r\n this._cellOuterR = 0.5 * Math.sqrt(this._cellSize.dot(this._cellSize));\r\n\r\n // array of voxels, each element contains index of first atom in voxel\r\n const numVoxels = this._count.x * this._count.y * this._count.z;\r\n this._voxels = utils.allocateTyped(Int32Array, numVoxels);\r\n for (let i = 0; i < numVoxels; ++i) {\r\n this._voxels[i] = -1;\r\n }\r\n\r\n // array of atoms that stores multiple single-linked lists\r\n // two elements for each atom: Atom ref, index of next atom (in this array\r\n this._atoms = [];\r\n }\r\n\r\n /**\r\n * Add all atoms from a complex to voxel world\r\n *\r\n * @param {Complex} complex - complex\r\n */\r\n addAtoms(complex) {\r\n const self = this;\r\n\r\n let idx = this._atoms.length;\r\n\r\n // resize array of atoms\r\n this._atoms.length += 2 * complex.getAtomCount();\r\n\r\n complex.forEachAtom((atom) => {\r\n // find which voxel contains this atom\r\n const voxelIdx = self._findVoxel(atom.position);\r\n\r\n // push current atom to the head of voxel's atom list\r\n self._atoms[idx] = atom;\r\n self._atoms[idx + 1] = self._voxels[voxelIdx];\r\n self._voxels[voxelIdx] = idx;\r\n\r\n idx += 2;\r\n });\r\n }\r\n\r\n /**\r\n * Get voxel that contains specified 3D point (we use clamp at the edges)\r\n *\r\n * @param {Vector3} point - a point in 3D\r\n * @returns {number} - index of voxel\r\n */\r\n static _zero = new THREE.Vector3(0, 0, 0);\r\n\r\n static _voxel = new THREE.Vector3();\r\n\r\n _findVoxel(point) {\r\n const zero = VoxelWorld._zero;\r\n const voxel = VoxelWorld._voxel;\r\n voxel.copy(point)\r\n .sub(this._box.min)\r\n .divide(this._cellSize)\r\n .floor()\r\n .clamp(zero, this._last);\r\n return voxel.x + this._count.x * (voxel.y + this._count.y * voxel.z);\r\n }\r\n\r\n /**\r\n * Call a function for each atom in voxel\r\n *\r\n * @param {number} voxel - index of voxel\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomInVoxel(voxel, process) {\r\n for (let i = this._voxels[voxel]; i >= 0; i = this._atoms[i + 1]) {\r\n process(this._atoms[i]);\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _xRange = new THREE.Vector2();\r\n\r\n static _yRange = new THREE.Vector2();\r\n\r\n static _zRange = new THREE.Vector2();\r\n\r\n _forEachVoxelWithinRadius(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n\r\n // switch to a faster method unless cell size is much smaller than sphere radius\r\n if (radius / this._cellInnerR < 10) {\r\n this._forEachVoxelWithinRadiusSimple(center, radius, process);\r\n return;\r\n }\r\n\r\n let rRangeXY;\r\n let rRangeX;\r\n let xVal;\r\n let yVal;\r\n let zVal;\r\n let isInsideX;\r\n let isInsideY;\r\n let isInsideZ;\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor()\r\n .clampScalar(0, this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n\r\n isInsideZ = (center.z - radius <= zVal[0]) && (zVal[1] <= center.z + radius);\r\n\r\n rRangeXY = _getSphereSliceRadiusRange(center, radius, zVal[0], zVal[1]);\r\n\r\n yRange.set(center.y - rRangeXY[1], center.y + rRangeXY[1]);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor()\r\n .clampScalar(0, this._count.y - 1);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n\r\n isInsideY = (center.y - rRangeXY[0] <= yVal[0]) && (yVal[1] <= center.y + rRangeXY[0]);\r\n\r\n rRangeX = _getCircleSliceRadiusRange(center, rRangeXY[1], yVal[0], yVal[1]);\r\n\r\n xRange.set(center.x - rRangeX[1], center.x + rRangeX[1]);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor()\r\n .clampScalar(0, this._count.x - 1);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n isInsideX = (center.x - rRangeX[0] <= xVal[0]) && (xVal[1] <= center.x + rRangeX[0]);\r\n\r\n process(x + this._count.x * (y + this._count.y * z), isInsideX && isInsideY && isInsideZ);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n * This is a version of method that doesn't try to \"calculate\" what voxels fall inside radius\r\n * but instead just checks all voxels inside sphere's bounding box. This should be faster\r\n * unless cell size is much smaller than sphere radius.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _vCenter = new THREE.Vector3();\r\n\r\n _forEachVoxelWithinRadiusSimple(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n const vCenter = VoxelWorld._vCenter;\r\n\r\n const distTouch2 = (radius + this._cellOuterR) * (radius + this._cellOuterR);\r\n let distInside2 = -1.0;\r\n if (radius > this._cellOuterR) {\r\n distInside2 = (radius - this._cellOuterR) * (radius - this._cellOuterR);\r\n }\r\n\r\n // calculate bounding box for the sphere\r\n xRange.set(center.x - radius, center.x + radius);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor();\r\n xRange.x = Math.min(Math.max(xRange.x, 0), this._count.x - 1);\r\n xRange.y = Math.min(Math.max(xRange.y, 0), this._count.x - 1);\r\n\r\n yRange.set(center.y - radius, center.y + radius);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor();\r\n yRange.x = Math.min(Math.max(yRange.x, 0), this._count.y - 1);\r\n yRange.y = Math.min(Math.max(yRange.y, 0), this._count.y - 1);\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor();\r\n zRange.x = Math.min(Math.max(zRange.x, 0), this._count.z - 1);\r\n zRange.y = Math.min(Math.max(zRange.y, 0), this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n const zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n vCenter.z = 0.5 * (zVal[0] + zVal[1]);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n const yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n vCenter.y = 0.5 * (yVal[0] + yVal[1]);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n const xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n vCenter.x = 0.5 * (xVal[0] + xVal[1]);\r\n\r\n const d2 = center.distanceToSquared(vCenter);\r\n if (d2 <= distTouch2) {\r\n process(x + this._count.x * (y + this._count.y * z), d2 <= distInside2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each atom within given sphere\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinRadius(center, radius, process) {\r\n const self = this;\r\n const r2 = radius * radius;\r\n\r\n self._forEachVoxelWithinRadius(center, radius, (voxel, isInside) => {\r\n if (isInside) {\r\n self._forEachAtomInVoxel(voxel, process);\r\n } else {\r\n self._forEachAtomInVoxel(voxel, (atom) => {\r\n if (center.distanceToSquared(atom.position) <= r2) {\r\n process(atom);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by mask\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} mask - bit mask\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromMasked(complex, mask, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by selector\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} selector - selector\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromSelected(complex, selector, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms\r\n *\r\n * @param {function} forEachAtom - enumerator of atoms in the group\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) {\r\n const self = this;\r\n const r2 = dist * dist;\r\n\r\n const voxels = [];\r\n const atoms = [];\r\n let idx = 0;\r\n\r\n // build \"within radius\" atom list for each voxel\r\n forEachAtom((atom) => {\r\n self._forEachVoxelWithinRadius(atom.position, dist, (voxel, isInside) => {\r\n if (isInside) {\r\n // this voxel is inside circle -- no check will be required\r\n voxels[voxel] = -1;\r\n } else if (typeof voxels[voxel] === 'undefined') {\r\n // this voxel isn't covered yet -- start building list of atoms\r\n atoms.push(atom);\r\n atoms.push(-1);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n } else if (voxels[voxel] !== -1) {\r\n // this voxel has a list of atoms required for distance check -- add atom to the list\r\n atoms.push(atom);\r\n atoms.push(voxels[voxel]);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n }\r\n });\r\n });\r\n\r\n let voxel;\r\n\r\n const processIfWithin = function (atom) {\r\n if (typeof voxels[voxel] === 'undefined') {\r\n return;\r\n }\r\n\r\n idx = voxels[voxel];\r\n if (idx === -1) {\r\n // this voxel is fully covered\r\n process(atom);\r\n return;\r\n }\r\n\r\n // check distance to each atom within radius from this voxel\r\n for (; idx >= 0; idx = atoms[idx + 1]) {\r\n if (atom.position.distanceToSquared(atoms[idx].position) < r2) {\r\n process(atom);\r\n break;\r\n }\r\n }\r\n };\r\n\r\n // for each marked voxel\r\n for (voxel in voxels) {\r\n if (voxels.hasOwnProperty(voxel)) {\r\n self._forEachAtomInVoxel(voxel, processIfWithin);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default VoxelWorld;\r\n","import ResidueType from './ResidueType';\r\nimport PairCollection from './AtomPairs';\r\n\r\nconst MINIMAL_DISTANCE = 0.5;\r\nconst MIN_HBOND_ENERGY = -9.9;\r\nconst MAX_HBOND_ENERGY = -0.5;\r\nconst COUPLING_CONSTANT = -27.888; // = -332 * 0.42 * 0.2\r\nconst MAX_COUPLING_DISTANCE = 5.0; // how far is the closest atom of a potential partner residue from CA atom\r\nconst MAX_RESIDUES_THRESHOLD = 1000;\r\n\r\nexport default class HBondInfo {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._hbonds = []; // array of bond info for each residue\r\n if (this._complex._residues.length > MAX_RESIDUES_THRESHOLD) {\r\n this._buildVW(); // optimized version using voxel grid\r\n } else {\r\n this._build(); // test all pairs of residues\r\n }\r\n }\r\n\r\n isBond(from, to) {\r\n if (this._hbonds[from]) {\r\n const [acc0, acc1] = this._hbonds[from].acceptor;\r\n if (acc0 && acc0.residue === to && acc0.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n if (acc1 && acc1.residue === to && acc1.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n\r\n for (let i = 0; i < this._complex._residues.length - 1; ++i) {\r\n const ri = this._complex._residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let preri = null;\r\n if (i > 0 && (this._complex._residues[i - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && ri._sequence === this._complex._residues[i - 1]._sequence + 1) {\r\n preri = this._complex._residues[i - 1];\r\n }\r\n\r\n for (let j = i + 1; j < this._complex._residues.length; ++j) {\r\n const rj = this._complex._residues[j];\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = null;\r\n if ((this._complex._residues[j - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && rj._sequence === this._complex._residues[j - 1]._sequence + 1) {\r\n prerj = this._complex._residues[j - 1];\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (j !== i + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _buildVW() {\r\n const self = this;\r\n const residues = this._complex._residues;\r\n let ri;\r\n let preri;\r\n\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const pairs = new PairCollection(this._complex._residues.length * this._complex._residues.length / 2);\r\n\r\n function processAtom(atom) {\r\n const rj = atom.residue;\r\n\r\n if (rj._index === ri._index) {\r\n return;\r\n }\r\n\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n return;\r\n }\r\n\r\n if (!pairs.addPair(ri._index, rj._index)) {\r\n // we've seen this pair\r\n return;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = rj._index > 0 ? residues[rj._index - 1] : null;\r\n if (prerj\r\n && ((prerj.getType().flags & ResidueType.Flags.PROTEIN) === 0 || rj._sequence !== prerj._sequence + 1)) {\r\n prerj = null;\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (rj._index !== ri._index + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n\r\n for (let i = 0; i < residues.length - 1; ++i) {\r\n ri = residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n preri = i > 0 ? residues[i - 1] : null;\r\n if (preri\r\n && ((preri.getType().flags & ResidueType.Flags.PROTEIN) === 0 || ri._sequence !== preri._sequence + 1)) {\r\n preri = null;\r\n }\r\n\r\n vw.forEachAtomWithinRadius(this._residueGetCAlpha(ri), MAX_COUPLING_DISTANCE, processAtom);\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _residueGetCO(res) {\r\n let c = null;\r\n let o = null;\r\n\r\n res.forEachAtom((a) => {\r\n if (a.name === 'C') {\r\n c = a.position;\r\n } else if (a.name === 'O') {\r\n o = a.position;\r\n }\r\n });\r\n\r\n return [c, o];\r\n }\r\n\r\n // TODO Support hydrogen defined in complex\r\n _residueGetNH(prev, res) {\r\n const [c, o] = this._residueGetCO(prev);\r\n\r\n let n;\r\n res.forEachAtom((a) => {\r\n if (a.name === 'N') {\r\n n = a.position;\r\n }\r\n });\r\n\r\n if (c && o && n) {\r\n // calculate hydrogen position\r\n const h = c.clone();\r\n h.sub(o);\r\n h.multiplyScalar(1.0 / h.length());\r\n h.add(n);\r\n\r\n return [n, h];\r\n }\r\n\r\n return [null, null];\r\n }\r\n\r\n _calcHBondEnergy(predonor, donor, acceptor) {\r\n let result = 0;\r\n\r\n if (predonor === null) {\r\n return result;\r\n }\r\n\r\n if (donor.getType().getName() !== 'PRO') {\r\n const [n, h] = this._residueGetNH(predonor, donor);\r\n const [c, o] = this._residueGetCO(acceptor);\r\n\r\n if (n === null || h === null || c === null || o === null) {\r\n return result;\r\n }\r\n\r\n const distanceHO = h.distanceTo(o);\r\n const distanceHC = h.distanceTo(c);\r\n const distanceNC = n.distanceTo(c);\r\n const distanceNO = n.distanceTo(o);\r\n\r\n if (distanceHO < MINIMAL_DISTANCE || distanceHC < MINIMAL_DISTANCE\r\n || distanceNC < MINIMAL_DISTANCE || distanceNO < MINIMAL_DISTANCE) {\r\n result = MIN_HBOND_ENERGY;\r\n } else {\r\n result = COUPLING_CONSTANT / distanceHO - COUPLING_CONSTANT / distanceHC\r\n + COUPLING_CONSTANT / distanceNC - COUPLING_CONSTANT / distanceNO;\r\n }\r\n\r\n // DSSP compatibility mode:\r\n result = Math.round(result * 1000) / 1000;\r\n\r\n if (result < MIN_HBOND_ENERGY) {\r\n result = MIN_HBOND_ENERGY;\r\n }\r\n }\r\n\r\n // update donor\r\n if (typeof this._hbonds[donor._index] === 'undefined') {\r\n this._hbonds[donor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const donorInfo = this._hbonds[donor._index];\r\n\r\n if (donorInfo.acceptor.length < 2) {\r\n donorInfo.acceptor.push({\r\n residue: acceptor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (donorInfo.acceptor.length > 1) {\r\n if (result < donorInfo.acceptor[0].energy) {\r\n donorInfo.acceptor[1].residue = donorInfo.acceptor[0].residue;\r\n donorInfo.acceptor[1].energy = donorInfo.acceptor[0].energy;\r\n donorInfo.acceptor[0].residue = acceptor._index;\r\n donorInfo.acceptor[0].energy = result;\r\n } else if (result < donorInfo.acceptor[1].energy) {\r\n donorInfo.acceptor[1].residue = acceptor._index;\r\n donorInfo.acceptor[1].energy = result;\r\n }\r\n }\r\n\r\n // update acceptor\r\n if (typeof this._hbonds[acceptor._index] === 'undefined') {\r\n this._hbonds[acceptor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const accInfo = this._hbonds[acceptor._index];\r\n\r\n if (accInfo.donor.length < 2) {\r\n accInfo.donor.push({\r\n residue: donor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (accInfo.donor.length > 1) {\r\n if (result < accInfo.donor[0].energy) {\r\n accInfo.donor[1].residue = accInfo.donor[0].residue;\r\n accInfo.donor[1].energy = accInfo.donor[0].energy;\r\n accInfo.donor[0].residue = donor._index;\r\n accInfo.donor[0].energy = result;\r\n } else if (result < accInfo.donor[1].energy) {\r\n accInfo.donor[1].residue = donor._index;\r\n accInfo.donor[1].energy = result;\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n","import HBondInfo from './HBondInfo';\r\nimport ResidueType from './ResidueType';\r\n\r\nconst BridgeType = Object.freeze({\r\n NO_BRIDGE: 0,\r\n PARALLEL: 1,\r\n ANTI_PARALLEL: 2,\r\n});\r\n\r\nconst HelixFlag = Object.freeze({\r\n START: 1,\r\n MIDDLE: 2,\r\n END: 3,\r\n START_AND_END: 4,\r\n});\r\n\r\nconst StructureType = Object.freeze({\r\n STRAND: 'E',\r\n BRIDGE: 'B',\r\n HELIX_310: 'G',\r\n HELIX_ALPHA: 'H',\r\n HELIX_PI: 'I',\r\n TURN: 'T',\r\n BEND: 'S',\r\n LOOP: ' ',\r\n});\r\n\r\nexport default class SecondaryStructureMap {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._build();\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n this._hbonds = new HBondInfo(this._complex);\r\n this._ss = []; // DSSP map by residue\r\n\r\n // auxilliary data\r\n this._sheet = [];\r\n this._betaPartners = [];\r\n this._bend = [];\r\n for (let i = 0; i < this._complex.getResidues().length; ++i) {\r\n this._betaPartners[i] = [];\r\n }\r\n this._helixFlags = [];\r\n this._helixFlags[3] = [];\r\n this._helixFlags[4] = [];\r\n this._helixFlags[5] = [];\r\n\r\n // calculate peptide chain lengths\r\n this._chainLengths = [];\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i].getResidues();\r\n let len = 0;\r\n for (; len < chain.length; ++len) {\r\n if ((chain[len].getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n break;\r\n }\r\n }\r\n this._chainLengths[i] = len;\r\n }\r\n\r\n this._buildBetaSheets();\r\n\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n self._buildAlphaHelices(this._complex._chains[i].getResidues(), this._chainLengths[i], false);\r\n }\r\n }\r\n\r\n _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) {\r\n // Helix and Turn\r\n for (let stride = 3; stride <= 5; ++stride) {\r\n if (inResidues.length < stride) {\r\n break;\r\n }\r\n\r\n for (let i = 0; i + stride < chainLength; ++i) {\r\n if (this._hbonds.isBond(inResidues[i + stride]._index, inResidues[i]._index)\r\n /* && NoChainBreak(res[i], res[i + stride]) */) {\r\n this._helixFlags[stride][inResidues[i + stride]._index] = HelixFlag.END;\r\n for (let j = i + 1; j < i + stride; ++j) {\r\n if (typeof this._helixFlags[stride][inResidues[j]._index] === 'undefined') {\r\n this._helixFlags[stride][inResidues[j]._index] = HelixFlag.MIDDLE;\r\n }\r\n }\r\n\r\n if (this._helixFlags[stride][inResidues[i]._index] === HelixFlag.END) {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START_AND_END;\r\n } else {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 2; i < chainLength - 2; ++i) {\r\n const kappa = this._kappa(inResidues[i - 2], inResidues[i], inResidues[i + 2]);\r\n this._bend[inResidues[i]._index] = (kappa !== 360 && kappa > 70);\r\n }\r\n\r\n for (let i = 1; i + 4 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 4) && this._isHelixStart(inResidues[i - 1]._index, 4)) {\r\n for (let j = i; j <= i + 3; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_ALPHA;\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 3 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 3) && this._isHelixStart(inResidues[i - 1]._index, 3)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 2; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_310;\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 2; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_310;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 5 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 5) && this._isHelixStart(inResidues[i - 1]._index, 5)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 4; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_PI\r\n || (inPreferPiHelices && this._ss[inResidues[j]._index] === StructureType.HELIX_ALPHA);\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 4; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_PI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 1 < chainLength; ++i) {\r\n if (typeof this._ss[inResidues[i]._index] === 'undefined') {\r\n let isTurn = false;\r\n for (let stride = 3; stride <= 5 && !isTurn; ++stride) {\r\n for (let k = 1; k < stride && !isTurn; ++k) {\r\n isTurn = (i >= k) && this._isHelixStart(inResidues[i - k]._index, stride);\r\n }\r\n }\r\n\r\n if (isTurn) {\r\n this._ss[inResidues[i]._index] = StructureType.TURN;\r\n } else if (this._bend[inResidues[i]._index]) {\r\n this._ss[inResidues[i]._index] = StructureType.BEND;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _cosinusAngle(p1, p2, p3, p4) {\r\n const v12 = p1.clone().sub(p2);\r\n const v34 = p3.clone().sub(p4);\r\n\r\n let result = 0;\r\n\r\n const x = v12.dot(v12) * v34.dot(v34);\r\n if (x > 0) {\r\n result = v12.dot(v34) / Math.sqrt(x);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _kappa(prevPrev, res, nextNext) {\r\n const curCA = this._residueGetCAlpha(res);\r\n const ppCA = this._residueGetCAlpha(prevPrev);\r\n const nnCA = this._residueGetCAlpha(nextNext);\r\n if (curCA === null || ppCA === null || nnCA === null) {\r\n return 180;\r\n }\r\n\r\n const ckap = this._cosinusAngle(curCA, ppCA, nnCA, curCA);\r\n const skap = Math.sqrt(1 - ckap * ckap);\r\n return Math.atan2(skap, ckap) * 180 / Math.PI;\r\n }\r\n\r\n _isHelixStart(res, stride) {\r\n return (this._helixFlags[stride][res] === HelixFlag.START\r\n || this._helixFlags[stride][res] === HelixFlag.START_AND_END);\r\n }\r\n\r\n _buildBetaSheets() {\r\n // find bridges\r\n // check each chain against each other chain, and against itself\r\n const bridges = [];\r\n for (let a = 0; a < this._complex._chains.length; ++a) {\r\n const lenA = this._chainLengths[a];\r\n if (lenA <= 4) {\r\n continue;\r\n }\r\n\r\n const chainA = this._complex._chains[a].getResidues();\r\n\r\n for (let b = a; b < this._complex._chains.length; ++b) {\r\n const lenB = this._chainLengths[b];\r\n if (lenB <= 4) {\r\n continue;\r\n }\r\n\r\n const chainB = this._complex._chains[b].getResidues();\r\n\r\n for (let i = 1; i + 1 < lenA; ++i) {\r\n const ri = chainA[i];\r\n\r\n let j = 1;\r\n if (b === a) {\r\n j = i + 3; // check for self-bridges forward down the chain\r\n }\r\n\r\n for (; j + 1 < lenB; ++j) {\r\n const rj = chainB[j];\r\n\r\n const type = this._testBridge(chainA, i, chainB, j);\r\n if (type === BridgeType.NO_BRIDGE) {\r\n continue;\r\n }\r\n\r\n // there is a bridge, try to attach it to previously found sequence\r\n let found = false;\r\n for (const bridge of bridges) {\r\n if (type !== bridge.type || ri._index !== bridge.i[bridge.i.length - 1] + 1) {\r\n continue;\r\n }\r\n\r\n if (type === BridgeType.PARALLEL && bridge.j[bridge.j.length - 1] + 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.push(rj._index);\r\n found = true;\r\n break;\r\n }\r\n\r\n if (type === BridgeType.ANTI_PARALLEL && bridge.j[0] - 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.unshift(rj._index);\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n // this bridge cannot be attached anywhere, start a new sequence\r\n if (!found) {\r\n bridges.push({\r\n type,\r\n i: [ri._index],\r\n chainI: ri.getChain()._index,\r\n j: [rj._index],\r\n chainJ: rj.getChain()._index,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // extend ladders\r\n bridges.sort((a, b) => {\r\n if (a.chainI < b.chainI || (a.chainI === b.chainI && a.i[0] < b.i[0])) {\r\n return -1;\r\n }\r\n return 1;\r\n });\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n for (let j = i + 1; j < bridges.length; ++j) {\r\n const ibi = bridges[i].i[0];\r\n const iei = bridges[i].i[bridges[i].i.length - 1];\r\n const jbi = bridges[i].j[0];\r\n const jei = bridges[i].j[bridges[i].j.length - 1];\r\n const ibj = bridges[j].i[0];\r\n const iej = bridges[j].i[bridges[j].i.length - 1];\r\n const jbj = bridges[j].j[0];\r\n const jej = bridges[j].j[bridges[j].j.length - 1];\r\n\r\n if (bridges[i].type !== bridges[j].type\r\n || this._hasChainBreak(Math.min(ibi, ibj), Math.max(iei, iej))\r\n || this._hasChainBreak(Math.min(jbi, jbj), Math.max(jei, jej))\r\n || ibj - iei >= 6 || (iei >= ibj && ibi <= iej)) {\r\n continue;\r\n }\r\n\r\n let bulge = false;\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bulge = ((jbj - jei < 6 && ibj - iei < 3) || (jbj - jei < 3));\r\n } else {\r\n bulge = ((jbi - jej < 6 && ibj - iei < 3) || (jbi - jej < 3));\r\n }\r\n\r\n if (bulge) {\r\n bridges[i].i = bridges[i].i.concat(bridges[j].i);\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bridges[i].j = bridges[i].j.concat(bridges[j].j);\r\n } else {\r\n bridges[i].j = bridges[j].j.concat(bridges[i].j);\r\n }\r\n bridges.splice(j--, 1);\r\n }\r\n }\r\n }\r\n\r\n // Sheet\r\n const ladderset = new Set();\r\n for (let i = 0; i < bridges.length; ++i) {\r\n ladderset.add(bridges[i]);\r\n }\r\n\r\n let sheet = 1;\r\n let ladder = 0;\r\n while (ladderset.size > 0) {\r\n let bridge = ladderset.values().next().value;\r\n ladderset.delete(bridge);\r\n\r\n const sheetset = new Set();\r\n sheetset.add(bridge);\r\n\r\n let toMove;\r\n do {\r\n toMove = new Set();\r\n for (const a of sheetset.values()) {\r\n for (const b of ladderset.values()) {\r\n if (this._areBridgesLinked(a, b)) {\r\n toMove.add(b);\r\n }\r\n }\r\n }\r\n for (bridge of toMove.values()) {\r\n sheetset.add(bridge);\r\n ladderset.delete(bridge);\r\n }\r\n } while (toMove.size > 0);\r\n\r\n for (bridge of sheetset.values()) {\r\n bridge.ladder = ladder;\r\n bridge.sheet = sheet;\r\n bridge.link = sheetset;\r\n ++ladder;\r\n }\r\n\r\n ++sheet;\r\n }\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n const bridge = bridges[i];\r\n\r\n // find out if any of the i and j set members already have\r\n // a bridge assigned, if so, we're assigning bridge 2\r\n\r\n let betai = 0;\r\n let betaj = 0;\r\n\r\n for (let l = 0; l < bridge.i.length; ++l) {\r\n if (this._betaPartners[bridge.i[l]][0]) {\r\n betai = 1;\r\n break;\r\n }\r\n }\r\n\r\n for (let l = 0; l < bridge.j.length; ++l) {\r\n if (this._betaPartners[bridge.j[l]][0]) {\r\n betaj = 1;\r\n break;\r\n }\r\n }\r\n\r\n let ss = StructureType.BRIDGE;\r\n if (bridge.i.length > 1) {\r\n ss = StructureType.STRAND;\r\n }\r\n\r\n if (bridge.type === BridgeType.PARALLEL) {\r\n let j = 0;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n\r\n j = 0;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n } else {\r\n let j = bridge.j.length - 1;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n\r\n j = bridge.i.length - 1;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n }\r\n\r\n for (let k = bridge.i[0]; k <= bridge.i[bridge.i.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n\r\n for (let k = bridge.j[0]; k <= bridge.j[bridge.j.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _testBridge(chainA, from, chainB, to) {\r\n let result = BridgeType.NO_BRIDGE;\r\n\r\n const a = chainA[from - 1]._index;\r\n const b = chainA[from]._index;\r\n const c = chainA[from + 1]._index;\r\n const d = chainB[to - 1]._index;\r\n const e = chainB[to]._index;\r\n const f = chainB[to + 1]._index;\r\n\r\n const isBond = this._hbonds.isBond.bind(this._hbonds);\r\n if ((isBond(c, e) && isBond(e, a)) || (isBond(f, b) && isBond(b, d))) {\r\n result = BridgeType.PARALLEL;\r\n } else if ((isBond(c, d) && isBond(f, a)) || (isBond(e, b) && isBond(b, e))) {\r\n result = BridgeType.ANTI_PARALLEL;\r\n }\r\n return result;\r\n }\r\n\r\n // return true if any of the residues in bridge a is identical to any of the residues in bridge b\r\n _areBridgesLinked(a, b) {\r\n const ai = new Set(a.i);\r\n const aj = new Set(a.j);\r\n\r\n for (const i of b.i) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n for (const i of b.j) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n _hasChainBreak(from, to) {\r\n for (let i = from + 1; i <= to; ++i) {\r\n if (this._complex._residues[i]._sequence !== this._complex._residues[i - 1]._sequence + 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\nSecondaryStructureMap.StructureType = StructureType;\r\n","import * as THREE from 'three';\r\nimport logger from '../utils/logger';\r\nimport Atom from './Atom';\r\nimport Chain from './Chain';\r\nimport Helix from './Helix';\r\nimport Strand from './Strand';\r\nimport Sheet from './Sheet';\r\nimport Component from './Component';\r\nimport ResidueType from './ResidueType';\r\nimport Bond from './Bond';\r\nimport AutoBond from './AutoBond';\r\nimport AromaticLoopsMarker from './AromaticLoopsMarker';\r\nimport BiologicalUnit from './BiologicalUnit';\r\nimport selectors from './selectors';\r\nimport VoxelWorld from './VoxelWorld';\r\nimport SecondaryStructureMap from './SecondaryStructureMap';\r\nimport StructuralElement from './StructuralElement';\r\n\r\nconst VOXEL_SIZE = 5.0;\r\n\r\nconst { StructureType } = SecondaryStructureMap;\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX\r\nconst helixClassMap = {\r\n [StructureType.HELIX_ALPHA]: 1,\r\n [StructureType.HELIX_PI]: 3,\r\n [StructureType.HELIX_310]: 5,\r\n};\r\n\r\nconst loopMap = {\r\n [StructureType.BRIDGE]: StructuralElementType.BRIDGE,\r\n [StructureType.TURN]: StructuralElementType.TURN,\r\n [StructureType.BEND]: StructuralElementType.BEND,\r\n [StructureType.LOOP]: StructuralElementType.COIL,\r\n};\r\n\r\n/**\r\n * The entire complex of the molecules under study.\r\n *\r\n * @exports Complex\r\n * @constructor\r\n */\r\nclass Complex {\r\n constructor() {\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n\r\n this._residueTypes = Object.create(ResidueType.StandardTypes);\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n this._molecules = [];\r\n this._maskNeedsUpdate = false;\r\n\r\n this.metadata = {};\r\n\r\n this.symmetry = [];\r\n this.units = [new BiologicalUnit(this)];\r\n this._currentUnit = 0; // default biological unit is the asymmetric unit\r\n }\r\n\r\n addAtom(atom) {\r\n const index = this._atoms.length;\r\n this._atoms.push(atom);\r\n return index;\r\n }\r\n\r\n addSheet(sheet) {\r\n const index = this._sheets.length;\r\n this._sheets.push(sheet);\r\n return index;\r\n }\r\n\r\n addHelix(helix) {\r\n const index = this._helices.length;\r\n this._helices.push(helix);\r\n return index;\r\n }\r\n\r\n getAtoms() {\r\n return this._atoms;\r\n }\r\n\r\n getBonds() {\r\n return this._bonds;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n addResidue(residue) {\r\n const index = this._residues.length;\r\n this._residues.push(residue);\r\n return index;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n this.forEachChain((chain) => {\r\n chain.updateToFrame(frameData);\r\n });\r\n }\r\n\r\n addResidueType(resName) {\r\n const rt = this._residueTypes[resName] = new ResidueType(resName, 'Unknown', '');\r\n return rt;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n getSGroupCount() {\r\n return this._sgroups.length;\r\n }\r\n\r\n getSGroups() {\r\n return this._sgroups;\r\n }\r\n\r\n /*\r\n Extract atom by its fullname: #chainName#.#residueId#.#atomName#\r\n */\r\n getAtomByFullname(fullName) {\r\n const parts = fullName.split('.');\r\n if (parts.length !== 3) {\r\n return null;\r\n }\r\n\r\n const chainName = parts[0];\r\n const resId = parseInt(parts[1], 10);\r\n if (Number.isNaN(resId)) {\r\n return null;\r\n }\r\n const atomName = parts[2].toUpperCase();\r\n\r\n let currAtom = null;\r\n this.forEachChain((chain) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (chain._name.localeCompare(chainName) === 0) {\r\n chain.forEachResidue((residue) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (residue._sequence === resId) {\r\n residue.forEachAtom((atom) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (atomName.localeCompare(atom.name) === 0) {\r\n currAtom = atom;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n });\r\n\r\n return currAtom;\r\n }\r\n\r\n /**\r\n * Create a new chain.\r\n *\r\n * @param {string} name - Chain name.\r\n * @returns {Chain} - Newly created chain.\r\n */\r\n addChain(name) {\r\n const result = new Chain(this, name);\r\n this._chains.push(result);\r\n return result;\r\n }\r\n\r\n getChain(name) {\r\n for (let i = 0, n = this._chains.length; i < n; ++i) {\r\n const chain = this._chains[i];\r\n if (chain.getName() === name) {\r\n return chain;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n getChainCount() {\r\n return this._chains.length;\r\n }\r\n\r\n getMolecules() {\r\n return this._molecules;\r\n }\r\n\r\n getMoleculeCount() {\r\n return this._molecules.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n process(atoms[i]);\r\n }\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._bonds;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n forEachChain(process) {\r\n const chains = this._chains;\r\n for (let i = 0, n = chains.length; i < n; ++i) {\r\n process(chains[i]);\r\n }\r\n }\r\n\r\n forEachMolecule(process) {\r\n const molecules = this._molecules;\r\n const n = molecules.length;\r\n for (let i = 0; i < n; ++i) {\r\n process(molecules[i]);\r\n }\r\n }\r\n\r\n forEachSGroup(process) {\r\n const groups = this._sgroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n process(groups[i]);\r\n }\r\n }\r\n\r\n forEachComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n forEachVisibleComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n addBond(left, right, order, type, fixed) {\r\n const bond = new Bond(left, right, order, type, fixed);\r\n this._bonds.push(bond);\r\n return bond;\r\n }\r\n\r\n getBondCount() {\r\n return this._bonds.length;\r\n }\r\n\r\n getResidueType(name) {\r\n return this._residueTypes[name] || null;\r\n }\r\n\r\n getUnifiedSerial(chain, serial, iCode) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n return serial + iCode * maxSerial + chain * chainShift;\r\n }\r\n\r\n splitUnifiedSerial(uniSerial) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n const chainId = Math.floor(uniSerial / chainShift);\r\n const remnant = uniSerial - chainId * chainShift;\r\n const insCode = Math.floor(remnant / maxSerial);\r\n const ser = remnant - insCode * maxSerial;\r\n return { chain: chainId, serial: ser, iCode: insCode };\r\n }\r\n\r\n _fillCmpEdit() {\r\n const self = this;\r\n const components = this._components;\r\n\r\n function addComp() {\r\n const comp = new Component(self);\r\n comp._index = components.length;\r\n components[comp._index] = comp;\r\n return comp;\r\n }\r\n\r\n this.forEachChain((chain) => {\r\n const residues = chain._residues;\r\n const resCount = residues.length;\r\n if (resCount < 1) {\r\n return;\r\n }\r\n let comp = addComp();\r\n let currStart = residues[0]._index;\r\n\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)\r\n || currRes._index !== nextRes._index - 1) {\r\n // the last condition is broken and incorrect\r\n // the refactoring of the Component is required in order to fix this issue\r\n comp.setSubDivs([{\r\n start: currStart,\r\n end: currRes._index,\r\n }]);\r\n if (nextRes) {\r\n currStart = nextRes._index;\r\n comp = addComp();\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n // This function was added in the moment of despair\r\n // It was the dark times for miew\r\n _fillCmpNoedit() {\r\n const comp = new Component(this);\r\n comp._index = 0;\r\n\r\n const residues = this._residues;\r\n const resCount = residues.length;\r\n if (resCount === 0) {\r\n return;\r\n }\r\n\r\n const currSubDivs = [];\r\n let currStart = 0;\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)) {\r\n // wrap up this interval\r\n currSubDivs[currSubDivs.length] = {\r\n start: currStart,\r\n end: i,\r\n };\r\n if (nextRes) {\r\n currStart = i + 1;\r\n }\r\n }\r\n }\r\n\r\n comp.setSubDivs(currSubDivs);\r\n this._components[comp._index] = comp;\r\n }\r\n\r\n /**\r\n * Fill components information.\r\n * @param {boolean} enableEditing - Restructure Complex to enable per-component editing.\r\n */\r\n _fillComponents(enableEditing) {\r\n if (enableEditing) {\r\n this._fillCmpEdit();\r\n } else {\r\n this._fillCmpNoedit();\r\n }\r\n }\r\n\r\n getCurrentUnit() {\r\n return this._currentUnit;\r\n }\r\n\r\n getDefaultBoundaries() {\r\n return this.units[0].getBoundaries();\r\n }\r\n\r\n getBoundaries() {\r\n return this.units[this._currentUnit].getBoundaries();\r\n }\r\n\r\n getTransforms() {\r\n return this.units[this._currentUnit].getTransforms();\r\n }\r\n\r\n getSelector() {\r\n return this.units[this._currentUnit].getSelector();\r\n }\r\n\r\n resetCurrentUnit() {\r\n this._currentUnit = 0;\r\n this.setCurrentUnit(1);\r\n }\r\n\r\n setCurrentUnit(newUnit) {\r\n if (newUnit !== null && newUnit !== undefined\r\n && newUnit !== this._currentUnit\r\n && newUnit >= 0\r\n && newUnit < this.units.length) {\r\n this._currentUnit = newUnit;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n _computeBounds() {\r\n const { units } = this;\r\n for (let i = 0, n = units.length; i < n; ++i) {\r\n units[i].computeBoundaries();\r\n }\r\n }\r\n\r\n onAtomPositionChanged() {\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n this.forEachComponent((c) => {\r\n c.update();\r\n });\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n this._finalizeBonds();\r\n this.forEachSGroup((s) => {\r\n s._rebuildSGroupOnAtomChange();\r\n });\r\n }\r\n\r\n update() {\r\n if (this._maskNeedsUpdate) {\r\n this.updateStructuresMask();\r\n this._maskNeedsUpdate = false;\r\n }\r\n }\r\n\r\n _finalizeBonds() {\r\n const bonds = this.getBonds();\r\n const n = bonds.length;\r\n for (let i = 0; i < n; ++i) {\r\n bonds[i]._index = i;\r\n }\r\n }\r\n\r\n /**\r\n * Finalizes complex's inner data(i.e. after parsing).\r\n * @param {objects} opts - Build bonds automatically.\r\n * @param {boolean} opts.needAutoBonding - Build bonds automatically.\r\n * @param {boolean} opts.detectAromaticLoops - Find/mark aromatic loops.\r\n * @param {boolean} opts.enableEditing - Restructure Complex to enable per-component editing.\r\n * @param {Array} [opts.serialAtomMap] - Array of atoms ordered by their serials.\r\n */\r\n finalize(opts) {\r\n opts = opts || {};\r\n // Put bonds into atoms\r\n const bonds = this._bonds;\r\n let i;\r\n let n;\r\n // remove invalid bonds\r\n for (i = bonds.length - 1; i >= 0; i--) {\r\n const bond = bonds[i];\r\n if (bond._left === null || bond._right === null) {\r\n bonds.splice(i, 1);\r\n } else {\r\n bond._left.bonds.push(bond);\r\n bond._right.bonds.push(bond);\r\n }\r\n }\r\n\r\n const residues = this._residues;\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._finalize();\r\n }\r\n\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n\r\n // WARNING! this MUST be done BEFORE computeBounds is called\r\n const { units } = this;\r\n for (i = 0, n = units.length; i < n; ++i) {\r\n units[i].finalize();\r\n }\r\n // try setting first biomolecule by defaults\r\n this.setCurrentUnit(1);\r\n\r\n const residueHash = {};\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n // This code is extremely dangerous for non-PDB formats\r\n residueHash[this.getUnifiedSerial(\r\n res.getChain().getName().charCodeAt(0),\r\n res.getSequence(), res.getICode().charCodeAt(0),\r\n )] = res;\r\n }\r\n\r\n const { structures } = this;\r\n for (i = 0, n = structures.length; i < n; ++i) {\r\n structures[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const helices = this._helices;\r\n for (i = 0, n = helices.length; i < n; ++i) {\r\n helices[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const sheets = this._sheets;\r\n for (i = 0, n = sheets.length; i < n; ++i) {\r\n sheets[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n\r\n const atoms = this._atoms;\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const currAtom = atoms[i];\r\n currAtom.index = i;\r\n }\r\n\r\n if (opts.needAutoBonding) {\r\n const autoConnector = new AutoBond(this);\r\n autoConnector.build();\r\n autoConnector.destroy();\r\n }\r\n\r\n const chains = this._chains;\r\n for (i = 0, n = chains.length; i < n; ++i) {\r\n chains[i]._index = i;\r\n }\r\n\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._index = i;\r\n }\r\n\r\n // mark non-polar hydrogens\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n if (atom.flags & Atom.Flags.HYDROGEN && atom.bonds.length === 1) {\r\n const bond = atom.bonds[0];\r\n const other = (bond._left !== atom && bond._left) || bond._right;\r\n if (other.flags & Atom.Flags.CARBON) {\r\n atom.flags |= Atom.Flags.NONPOLARH;\r\n }\r\n }\r\n }\r\n\r\n this._finalizeBonds();\r\n this._fillComponents(opts.enableEditing);\r\n\r\n const marker = new AromaticLoopsMarker(this);\r\n marker.markCycles();\r\n if (opts.detectAromaticLoops) { // TODO remove this condition clause, it is for debug purposes only!\r\n marker.detectCycles(); // TODO add conditional detection\r\n }\r\n\r\n this._finalizeMolecules();\r\n }\r\n\r\n _finalizeMolecules() {\r\n // add reference to molecule into residue\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const molecule = this._molecules[i];\r\n const count = molecule.residues.length;\r\n for (let j = 0; j < count; j++) {\r\n const residue = molecule.residues[j];\r\n residue._molecule = molecule;\r\n }\r\n }\r\n }\r\n\r\n updateStructuresMask() {\r\n const updater = (structure) => structure.collectMask();\r\n this.forEachResidue(updater);\r\n this.forEachChain(updater);\r\n this.forEachMolecule(updater);\r\n }\r\n\r\n countAtomsByMask(mask) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n getNumAtomsBySelector(selector) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n resetAtomMask(mask) {\r\n this.forEachAtom((atom) => {\r\n atom.mask = mask;\r\n });\r\n }\r\n\r\n markAtoms(selector, mask) {\r\n const setMask = mask;\r\n const clearMask = ~setMask;\r\n let count = 0;\r\n const totalSelector = selectors.keyword('And')(selector, this.getSelector());\r\n\r\n this.forEachAtom((atom) => {\r\n if (totalSelector.includesAtom(atom)) {\r\n atom.mask |= setMask;\r\n count++;\r\n } else {\r\n atom.mask &= clearMask;\r\n }\r\n });\r\n this._maskNeedsUpdate = true;\r\n\r\n return count;\r\n }\r\n\r\n markAtomsAdditionally(selector, mask) {\r\n const setMask = mask;\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom) && (atom.mask & mask) !== mask) {\r\n atom.mask |= setMask;\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n clearAtomBits(mask) {\r\n const clearMask = ~mask;\r\n this.forEachAtom((atom) => {\r\n atom.mask &= clearMask;\r\n });\r\n const reseter = (a) => {\r\n a._mask &= clearMask;\r\n };\r\n this.forEachAtom(reseter);\r\n this.forEachResidue(reseter);\r\n this.forEachChain(reseter);\r\n this.forEachMolecule(reseter);\r\n }\r\n\r\n getAtomNames() {\r\n if (this.hasOwnProperty('_atomNames')) {\r\n return this._atomNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.name] = 1;\r\n });\r\n this._atomNames = Object.keys(dict);\r\n\r\n return this._atomNames;\r\n }\r\n\r\n getElements() {\r\n if (this.hasOwnProperty('_elements')) {\r\n return this._elements;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.element.name] = 1;\r\n });\r\n this._elements = Object.keys(dict);\r\n\r\n return this._elements;\r\n }\r\n\r\n getResidueNames() {\r\n if (this.hasOwnProperty('_residueNames')) {\r\n return this._residueNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachResidue((res) => {\r\n dict[res._type._name] = 1;\r\n });\r\n this._residueNames = Object.keys(dict);\r\n\r\n return this._residueNames;\r\n }\r\n\r\n getChainNames() {\r\n if (this.hasOwnProperty('_chainNames')) {\r\n return this._chainNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachChain((chain) => {\r\n dict[chain._name] = 1;\r\n });\r\n this._chainNames = Object.keys(dict);\r\n\r\n return this._chainNames;\r\n }\r\n\r\n getAltLocNames() {\r\n if (this.hasOwnProperty('_altlocNames')) {\r\n return this._altlocNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[String.fromCharCode(atom.location)] = 1;\r\n });\r\n this._altlocNames = Object.keys(dict);\r\n\r\n return this._altlocNames;\r\n }\r\n\r\n getVoxelWorld() {\r\n if (!this.hasOwnProperty('_voxelWorld')) {\r\n try {\r\n this._voxelWorld = new VoxelWorld(\r\n this.getDefaultBoundaries().boundingBox,\r\n new THREE.Vector3(VOXEL_SIZE, VOXEL_SIZE, VOXEL_SIZE),\r\n );\r\n this._voxelWorld.addAtoms(this);\r\n } catch (e) {\r\n logger.warn('Unable to create voxel world');\r\n this._voxelWorld = null;\r\n }\r\n }\r\n\r\n return this._voxelWorld;\r\n }\r\n\r\n /**\r\n * Simple function to make unified routine procedure without code duplication.\r\n * @param {Array} srcArray - Source chemical structure array (will be part of resulting chemical structure array).\r\n * @param {Array} dstArray - Resulting chemical structure array.\r\n * @param {number} param - Parameter for processor.\r\n * @param {function} functor - Processor for every element in array.\r\n */\r\n addElement(srcArray, dstArray, param, functor) {\r\n const { length } = srcArray;\r\n for (let i = 0; i < length; ++i) {\r\n const elem = srcArray[i];\r\n functor(elem, param);\r\n dstArray.push(elem);\r\n }\r\n }\r\n\r\n // this function joins multiple complexes into one (this)\r\n // atom, bond, ... objects are reused -- so input complexes are no longer valid\r\n joinComplexes(complexes) {\r\n // clear target complex\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n\r\n const self = this;\r\n let atomBias = 0;\r\n let bondBias = 0;\r\n let residueBias = 0;\r\n let chainBias = 0;\r\n let componentBias = 0;\r\n\r\n function processAtom(atom, bias) {\r\n atom.serial += bias;\r\n atom.index += bias;\r\n }\r\n\r\n function processBond(bond, bias) {\r\n bond._index += bias;\r\n }\r\n\r\n function processResidue(residue, bias) {\r\n residue._index += bias;\r\n }\r\n\r\n function processChain(chain, bias) {\r\n chain._complex = self;\r\n chain._index += bias;\r\n }\r\n\r\n function processComponent(component, bias) {\r\n component._complex = self;\r\n component._index += bias;\r\n }\r\n\r\n /**\r\n * Simple function to do nothing.\r\n */\r\n function doNothing() {\r\n }\r\n\r\n for (let i = 0; i < complexes.length; ++i) {\r\n const c = complexes[i];\r\n this.addElement(c._atoms, this._atoms, atomBias, processAtom);\r\n this.addElement(c._bonds, this._bonds, bondBias, processBond);\r\n this.addElement(c._residues, this._residues, residueBias, processResidue);\r\n this.addElement(c._chains, this._chains, chainBias, processChain);\r\n this.addElement(c._sheets, this._sheets, 0, doNothing);\r\n this.addElement(c._helices, this._helices, 0, doNothing);\r\n this.addElement(c._sgroups, this._sgroups, 0, doNothing);\r\n this.addElement(c._components, this._components, componentBias, processComponent);\r\n this.addElement(c.structures, this.structures, 0, doNothing);\r\n // merge residue types\r\n for (const rt in c._residueTypes) {\r\n if (c._residueTypes.hasOwnProperty(rt)) {\r\n this._residueTypes[rt] = c._residueTypes[rt];\r\n }\r\n }\r\n\r\n atomBias += c._atoms.length;\r\n bondBias += c._bonds.length;\r\n residueBias += c._residues.length;\r\n chainBias += c._chains.length;\r\n componentBias += c._components.length;\r\n }\r\n\r\n this._computeBounds();\r\n }\r\n\r\n /**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n */\r\n dssp() {\r\n const ssMap = new SecondaryStructureMap(this);\r\n\r\n const structures = this.structures = [];\r\n const helices = this._helices = [];\r\n const sheets = this._sheets = [];\r\n\r\n const getSheet = (index) => {\r\n let item = sheets[index];\r\n if (!item) {\r\n item = sheets[index] = new Sheet(String(index), 0);\r\n }\r\n return item;\r\n };\r\n\r\n let lastCode;\r\n let lastSheetIndex;\r\n let lastHelixIndex = 0;\r\n let curStructure = null;\r\n for (let i = 0, n = this._residues.length; i < n; ++i) {\r\n const curCode = ssMap._ss[i];\r\n const curResidue = this._residues[i];\r\n const curSheetIndex = ssMap._sheet[i];\r\n\r\n // expand the last structure\r\n if (curCode === lastCode && curSheetIndex === lastSheetIndex) {\r\n curResidue._secondary = curStructure;\r\n if (curStructure) {\r\n curStructure.term = curResidue;\r\n }\r\n if (curStructure instanceof Helix) {\r\n curStructure.length++;\r\n }\r\n continue;\r\n }\r\n\r\n // create a new structure\r\n const helixClass = helixClassMap[curCode];\r\n const loopType = loopMap[curCode];\r\n if (curCode === StructureType.STRAND) {\r\n const curSheet = getSheet(curSheetIndex);\r\n curStructure = new Strand(curSheet, curResidue, curResidue, 0, null, null);\r\n curSheet.addStrand(curStructure);\r\n } else if (helixClass !== undefined) {\r\n lastHelixIndex++;\r\n curStructure = new Helix(helixClass, curResidue, curResidue, lastHelixIndex, String(lastHelixIndex), '', 1);\r\n helices.push(curStructure);\r\n } else if (loopType !== undefined) {\r\n curStructure = new StructuralElement(loopType, curResidue, curResidue);\r\n } else {\r\n curStructure = null;\r\n }\r\n\r\n if (curStructure) {\r\n structures.push(curStructure);\r\n }\r\n\r\n curResidue._secondary = curStructure;\r\n\r\n lastCode = curCode;\r\n lastSheetIndex = curSheetIndex;\r\n }\r\n\r\n this._sheets = sheets.filter((_sheet) => true); // squeeze sheets array\r\n }\r\n}\r\n\r\nComplex.prototype.id = 'Complex';\r\nComplex.prototype.name = '';\r\n\r\nexport default Complex;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\nfunction pow2ceil(v) {\r\n let p = 2;\r\n v = (v - 1) >> 1;\r\n while (v) {\r\n p <<= 1;\r\n v >>= 1;\r\n }\r\n return p;\r\n}\r\n\r\n/**\r\n * Volume constructor\r\n *\r\n * @param {Object} type - Float32Array, Int8Array, etc...\r\n * @param {Object|Array} dimensions - number of data points on each axis (x, y, z)\r\n * @param {Box3} box - bounding box defining data place in metric space,\r\n * it's corners correspond to extreme data points\r\n * @param {Number} vecSize - dimension of the field data point (1 = scalar, 3 = 3D vector)\r\n * @param {Object} data - typed array of the same type as specified by the 1st parameter,\r\n * layout: point by point along X,\r\n * row by row along Y,\r\n * plane by plane along Z\r\n * @param {Number} volumeInfo - volume info values to define threshold to filter the noise\r\n */\r\n\r\nclass Volume {\r\n constructor(type, dimensions, box, vecSize, data, volumeInfo) {\r\n this._box = box.clone();\r\n this._dimVec = Math.max(Math.floor(vecSize || 1), 1);\r\n this._volumeInfo = volumeInfo;\r\n\r\n if (dimensions instanceof Array) {\r\n [this._dimX, this._dimY, this._dimZ] = dimensions;\r\n } else {\r\n this._dimX = dimensions.x;\r\n this._dimY = dimensions.y;\r\n this._dimZ = dimensions.z;\r\n }\r\n this._dimX = Math.max(Math.floor(this._dimX), 1);\r\n this._dimY = Math.max(Math.floor(this._dimY), 1);\r\n this._dimZ = Math.max(Math.floor(this._dimZ), 1);\r\n\r\n this._rowElements = this._dimVec * this._dimX;\r\n this._planeElements = this._rowElements * this._dimY;\r\n this._totalElements = this._planeElements * this._dimZ;\r\n\r\n this._data = data || utils.allocateTyped(type, this._totalElements);\r\n\r\n // override getter/setter for vector fields\r\n switch (this._dimVec) {\r\n case 1:\r\n break;\r\n\r\n case 2:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n };\r\n break;\r\n\r\n case 3:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1], this._data[idx + 2]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n this._data[idx + 2] = c;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n this._data[idx + 2] += c;\r\n };\r\n break;\r\n\r\n default:\r\n throw new Error('Volume: invalid vector dimension');\r\n }\r\n }\r\n\r\n // default getter assumes it's a scalar field\r\n getValue(x, y, z) {\r\n return this._data[x + y * this._rowElements + z * this._planeElements];\r\n }\r\n\r\n // default setter assumes it's a scalar field\r\n setValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] = val;\r\n }\r\n\r\n // default adder assumes it's a scalar field\r\n addValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] += val;\r\n }\r\n\r\n getDimensions() {\r\n return [this._dimX, this._dimY, this._dimZ];\r\n }\r\n\r\n getBox() {\r\n return this._box;\r\n }\r\n\r\n getVolumeInfo() {\r\n return this._volumeInfo;\r\n }\r\n\r\n getCellSize() {\r\n const boxSize = new THREE.Vector3();\r\n this._box.getSize(boxSize);\r\n const res = new THREE.Vector3();\r\n res.x = this._dimX > 1 ? boxSize.x / (this._dimX - 1) : 0;\r\n res.y = this._dimY > 1 ? boxSize.y / (this._dimY - 1) : 0;\r\n res.z = this._dimZ > 1 ? boxSize.z / (this._dimZ - 1) : 0;\r\n return res;\r\n }\r\n\r\n computeGradient() {\r\n if (this._dimVec !== 1) {\r\n // gradient can only be computed for scalar fields\r\n return null;\r\n }\r\n\r\n // create a 3D vector field of gradients\r\n const gradient = new Volume(Float32Array, [this._dimX, this._dimY, this._dimZ], this._box, 3);\r\n\r\n // calculate cell side lengths\r\n const vl = this.getCellSize();\r\n\r\n // gradient axis scaling values and averaging factors, to correctly\r\n // calculate the gradient for volumes with irregular cell spacing\r\n const vs = new THREE.Vector3(-0.5 / vl.x, -0.5 / vl.y, -0.5 / vl.z);\r\n\r\n // TODO Check for intended bug in VMD (min is zero)\r\n function clamp(val, min, max) {\r\n return Math.min(max, Math.max(min, val));\r\n }\r\n\r\n const xSize = this._dimX;\r\n const ySize = this._dimY;\r\n const zSize = this._dimZ;\r\n const volMap = this._data;\r\n\r\n function _voxelValue(x, y, z) {\r\n return volMap[z * xSize * ySize + y * xSize + x];\r\n }\r\n\r\n for (let zi = 0; zi < zSize; ++zi) {\r\n const zm = clamp(zi - 1, 0, zSize - 1);\r\n const zp = clamp(zi + 1, 0, zSize - 1);\r\n\r\n for (let yi = 0; yi < ySize; ++yi) {\r\n const ym = clamp(yi - 1, 0, ySize - 1);\r\n const yp = clamp(yi + 1, 0, ySize - 1);\r\n\r\n for (let xi = 0; xi < xSize; ++xi) {\r\n const xm = clamp(xi - 1, 0, xSize - 1);\r\n const xp = clamp(xi + 1, 0, xSize - 1);\r\n\r\n // Calculate the volume gradient at each grid cell.\r\n // Gradients are now stored unnormalized, since we need them in pure\r\n // form in order to draw field lines etc. Shading code will now have\r\n // to do renormalization for itself on-the-fly.\r\n\r\n // XXX this gradient is only correct for orthogonal grids, since\r\n // we're using the array index offsets rather to calculate the gradient\r\n // rather than voxel coordinate offsets. This will have to be\r\n // re-worked for non-orthogonal datasets.\r\n\r\n gradient.setValue(\r\n xi, yi, zi,\r\n (_voxelValue(xp, yi, zi) - _voxelValue(xm, yi, zi)) * vs.x,\r\n (_voxelValue(xi, yp, zi) - _voxelValue(xi, ym, zi)) * vs.y,\r\n (_voxelValue(xi, yi, zp) - _voxelValue(xi, yi, zm)) * vs.z,\r\n );\r\n }\r\n }\r\n }\r\n\r\n return gradient;\r\n }\r\n\r\n normalize() {\r\n const data = this._data;\r\n\r\n // get min/max\r\n let min = data[0];\r\n let max = data[0];\r\n for (let i = 1; i < data.length; ++i) {\r\n min = Math.min(min, data[i]);\r\n max = Math.max(max, data[i]);\r\n }\r\n\r\n const d = 1.0 / (max - min);\r\n if (d === 0) {\r\n return;\r\n }\r\n\r\n // normalize\r\n for (let i = 0; i < data.length; ++i) {\r\n data[i] = d * (data[i] - min);\r\n }\r\n }\r\n\r\n getTiledTextureStride() {\r\n return [this._dimX + 2, this._dimY + 2];\r\n }\r\n\r\n buildTiledTexture() {\r\n let tilesX = Math.ceil(Math.sqrt(this._dimZ * this._dimY / this._dimX));\r\n\r\n let width = tilesX * (this._dimX + 2) - 1;\r\n width = pow2ceil(width);\r\n tilesX = Math.floor(width / (this._dimX + 2));\r\n\r\n const tilesY = Math.ceil(this._dimZ / tilesX);\r\n let height = tilesY * (this._dimY + 2) - 1;\r\n height = pow2ceil(height);\r\n\r\n const data = new Uint8Array(width * height);\r\n\r\n let src;\r\n let dst;\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // process each pixel row of this tile row\r\n for (let row = 0; row < this._dimY; ++row) {\r\n src = tileRow * tilesX * this._planeElements + row * this._rowElements;\r\n dst = width * (tileRow * (this._dimY + 2) + row);\r\n // copy a series of rows through several XY planes\r\n for (let t = 0; t < tilesX; ++t) {\r\n // copy one row of one XY plane\r\n for (let x = 0; x < this._dimX; ++x) {\r\n data[dst++] = 255.0 * this._data[src++];\r\n }\r\n\r\n // repeat last pixel of previous tile\r\n data[dst++] = 255.0 * this._data[src - 1];\r\n\r\n if (t < tilesX - 1) {\r\n // skip to the same row of next XY plane\r\n src += this._planeElements - this._rowElements;\r\n // repeat first pixel of next tile\r\n data[dst++] = 255.0 * this._data[src];\r\n }\r\n }\r\n }\r\n }\r\n\r\n // fill pixels between tile rows with copy of edge pixels\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // copy last pixel row of this tile row to the following pixel row of the texture\r\n src = width * (tileRow * (this._dimY + 2) + this._dimY - 1);\r\n dst = src + width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n if (tileRow < tilesY - 1) {\r\n // copy first pixel row of next tile row to the preceding pixel row of the texture\r\n src = width * (tileRow + 1) * (this._dimY + 2);\r\n dst = src - width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n }\r\n }\r\n\r\n const texture = new THREE.DataTexture(\r\n data, width, height, THREE.LuminanceFormat, THREE.UnsignedByteType,\r\n THREE.UVMapping, THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping, THREE.LinearFilter, THREE.LinearFilter,\r\n );\r\n texture.needsUpdate = true;\r\n return texture;\r\n }\r\n\r\n /* ********************************************************************************\r\n *\r\n * Methods that provide direct access to internal array (for better performance)\r\n *\r\n ******************************************************************************** */\r\n\r\n getData() {\r\n return this._data;\r\n }\r\n\r\n getDirectIdx(x, y, z) {\r\n return x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n }\r\n\r\n getStrideX() {\r\n return this._dimVec;\r\n }\r\n\r\n getStrideY() {\r\n return this._rowElements;\r\n }\r\n\r\n getStrideZ() {\r\n return this._planeElements;\r\n }\r\n}\r\n\r\nVolume.prototype.id = 'Volume';\r\n\r\nexport default Volume;\r\n","/**\r\n * Residue Molecule.\r\n *\r\n * @param {Complex} complex - Molecular complex this Molecule belongs to.\r\n * @param {String} name - Molecule's name.\r\n * @param {Integer} index - Molecule's index in file.\r\n *\r\n * @exports Molecule\r\n * @constructor\r\n */\r\nclass Molecule {\r\n constructor(complex, name, index) {\r\n this.complex = complex;\r\n this.name = name || '';\r\n this.residues = [];\r\n this.mask = 1 | 0;\r\n this.index = index || -1; // start with 1\r\n }\r\n\r\n forEachResidue(process) {\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this.mask = mask;\r\n }\r\n}\r\n\r\nexport default Molecule;\r\n","import Atom from './chem/Atom';\r\nimport Element from './chem/Element';\r\nimport Bond from './chem/Bond';\r\nimport Residue from './chem/Residue';\r\nimport ResidueType from './chem/ResidueType';\r\nimport Chain from './chem/Chain';\r\nimport Helix from './chem/Helix';\r\nimport Strand from './chem/Strand';\r\nimport Sheet from './chem/Sheet';\r\nimport SGroup from './chem/SGroup';\r\nimport Assembly from './chem/Assembly';\r\nimport Complex from './chem/Complex';\r\nimport Volume from './chem/Volume';\r\nimport VoxelWorld from './chem/VoxelWorld';\r\nimport selectors from './chem/selectors';\r\nimport Molecule from './chem/Molecule';\r\n\r\nexport default {\r\n Atom,\r\n Element,\r\n Bond,\r\n Residue,\r\n ResidueType,\r\n Chain,\r\n Helix,\r\n Strand,\r\n Sheet,\r\n SGroup,\r\n Assembly,\r\n Complex,\r\n Volume,\r\n VoxelWorld,\r\n selectors,\r\n Molecule,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\n\r\nclass CSS2DObject extends THREE.Object3D {\r\n constructor(element) {\r\n super();\r\n const self = this;\r\n this._element = element;\r\n this._element.style.position = 'absolute';\r\n this.addEventListener('removed', () => {\r\n if (self._element.parentNode !== null) {\r\n self._element.parentNode.removeChild(self._element);\r\n }\r\n });\r\n }\r\n\r\n getElement() {\r\n return this._element;\r\n }\r\n\r\n /**\r\n * Sets label transparency.\r\n *\r\n * @param {number} transp - in [0; 1] 1 means fully transparent\r\n */\r\n setTransparency(transp) {\r\n const el = this.getElement();\r\n if (el === null) {\r\n return;\r\n }\r\n if (transp === 1.0) {\r\n el.style.display = 'none';\r\n return;\r\n }\r\n el.style.display = 'inline';\r\n const op = 1.0 - transp;\r\n const top = op.toString();\r\n const op100 = op * 100;\r\n el.style.opacity = top;\r\n el.style.filter = `alpha(opacity=${op100})`; // IE fallback\r\n }\r\n\r\n clone() {\r\n const obj = new CSS2DObject(this._element);\r\n obj.copy(this);\r\n return obj;\r\n }\r\n}\r\n\r\n\r\nexport default CSS2DObject;\r\n","import * as THREE from 'three';\r\n\r\nclass RCGroup extends THREE.Group {\r\n raycast(raycaster, intersects) {\r\n if (!this.visible) {\r\n return;\r\n }\r\n\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n children[i].raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].enableSubset) {\r\n children[i].enableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].disableSubset) {\r\n children[i].disableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n isEmpty() {\r\n return this.children.length === 0;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].updateToFrame) {\r\n children[i].updateToFrame(frameData);\r\n }\r\n }\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n Array.prototype.push.apply(totalSubset, children[i].getSubset(mask, innerOnly));\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default RCGroup;\r\n","export default {\r\n\r\n precision: 'mediump',\r\n\r\n /**\r\n *\r\n * @param {THREE.WebGLRenderer} renderer\r\n */\r\n init(renderer) {\r\n this.precision = renderer.capabilities.getMaxPrecision('highp');\r\n },\r\n};\r\n","import * as THREE from 'three';\r\n\r\nconst noiseWidth = 4;\r\nconst noiseHeight = 4;\r\nconst _noiseData = new Uint8Array([\r\n 24, 52, 0, 254, 145, 0, 122, 0, 0, 7, 170, 0,\r\n 34, 214, 0, 173, 8, 0, 86, 249, 0, 160, 4, 0,\r\n 226, 46, 0, 224, 211, 0, 3, 157, 0, 174, 247, 0,\r\n 12, 182, 0, 220, 216, 0, 1, 109, 0, 253, 154, 0,\r\n]);\r\nconst _noiseWrapS = THREE.RepeatWrapping;\r\nconst _noiseWrapT = THREE.RepeatWrapping;\r\nconst _noiseMinFilter = THREE.NearestFilter;\r\nconst _noiseMagFilter = THREE.NearestFilter;\r\nconst _noiseMapping = THREE.UVMapping;\r\nconst noiseTexture = new THREE.DataTexture(\r\n _noiseData, noiseWidth, noiseHeight, THREE.RGBFormat,\r\n THREE.UnsignedByteType, _noiseMapping, _noiseWrapS, _noiseWrapT, _noiseMagFilter, _noiseMinFilter, 1,\r\n);\r\nnoiseTexture.needsUpdate = true;\r\n\r\nexport default {\r\n noiseWidth,\r\n noiseHeight,\r\n noiseTexture,\r\n};\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './Uber.vert';\r\nimport fragmentShader from './Uber.frag';\r\nimport capabilities from '../capabilities';\r\nimport noise from '../noiseTexture';\r\n\r\n// Length of _samplesKernel is used in Uber.frag\r\n// If you want to change length of _samplesKernel, please, remember change it in Uber.frag too.\r\n// You can easy find places for replace using word:_samplesKernel\r\nconst _samplesKernel = [\r\n new THREE.Vector2(-0.541978, 0.840393),\r\n new THREE.Vector2(0.125533, -0.992089),\r\n new THREE.Vector2(0.374329, 0.927296),\r\n new THREE.Vector2(-0.105475, 0.994422),\r\n];\r\n\r\nconst defaultUniforms = THREE.UniformsUtils.merge([\r\n\r\n THREE.UniformsLib.fog,\r\n THREE.UniformsLib.lights,\r\n\r\n {\r\n // are updated automatically by three.js (see THREE.ShaderLib.common)\r\n diffuse: { value: new THREE.Color(0xeeeeee) },\r\n opacity: { value: 1.0 },\r\n\r\n specular: { type: 'c', value: new THREE.Color(0x111111) },\r\n shininess: { type: 'f', value: 30 },\r\n fixedColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n zOffset: { type: 'f', value: 0.0 },\r\n zClipValue: { type: 'f', value: 0.0 },\r\n clipPlaneValue: { type: 'f', value: 0.0 },\r\n invModelViewMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n world2colorMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n dashedLineSize: { type: 'f', value: 0.1 },\r\n dashedLinePeriod: { type: 'f', value: 0.2 },\r\n projMatrixInv: { type: '4fv', value: new THREE.Matrix4() },\r\n viewport: { type: 'v2', value: new THREE.Vector2() },\r\n lineWidth: { type: 'f', value: 2.0 },\r\n // default value must be the same as settings\r\n fogAlpha: { type: 'f', value: 1.0 },\r\n samplesKernel: { type: 'v2v', value: null },\r\n noiseTex: { type: 't', value: null },\r\n noiseTexelSize: { type: 'v2', value: null },\r\n srcTexelSize: { type: 'v2', value: null },\r\n },\r\n\r\n]);\r\n\r\nconst uberOptionNames = [\r\n 'shininess',\r\n 'opacity',\r\n 'zOffset',\r\n 'diffuse',\r\n 'specular',\r\n 'fixedColor',\r\n 'zClipCoef',\r\n 'zClipValue',\r\n 'clipPlaneValue',\r\n 'world2colorMatrix',\r\n 'dashedLineSize',\r\n 'dashedLinePeriod',\r\n 'projMatrixInv',\r\n 'viewport',\r\n 'lineWidth',\r\n 'fogAlpha',\r\n 'samplesKernel',\r\n 'noiseTex',\r\n 'noiseTexelSize',\r\n 'srcTexelSize',\r\n];\r\n\r\nfunction UberMaterial(params) {\r\n THREE.RawShaderMaterial.call(this);\r\n\r\n // add fog\r\n this.fog = true;\r\n // used for instanced geometry\r\n this.instancedPos = false;\r\n this.instancedMatrix = false;\r\n // atoms and links color\r\n this.attrColor = false;\r\n // second link color for cylinders\r\n this.attrColor2 = false;\r\n //\r\n this.attrAlphaColor = false;\r\n // overrides color for all vertices (used in selection)\r\n this.overrideColor = false;\r\n // zsrpites\r\n this.sphereSprite = false;\r\n this.cylinderSprite = false;\r\n // clip Surfs individually\r\n this.zClip = false;\r\n // clip scene with global clip plane\r\n this.clipPlane = false;\r\n // enable fake (chess-like) opacity\r\n this.fakeOpacity = false;\r\n // render only depth, don't take care about the pixel color (used for transparency depth prepass)\r\n this.prepassTransparancy = false;\r\n // used to render pixel positions\r\n this.colorFromPos = false;\r\n // used to render shadowmap\r\n this.shadowmap = false;\r\n // used to describe shadowmap type\r\n this.shadowmapType = 'random';\r\n // used to render pixel view deph\r\n this.colorFromDepth = false;\r\n // used to render dashed line\r\n this.dashedLine = false;\r\n // mark as transparent\r\n this.transparent = true;\r\n // mark as thick lines\r\n this.thickLine = false;\r\n // makes fog begin transparency (required for transparent background)\r\n this.fogTransparent = false;\r\n // used to render surface normals to G buffer for ssao effect\r\n this.normalsToGBuffer = false;\r\n // used for toon material\r\n this.toonShading = false;\r\n\r\n // uber options of \"root\" materials are inherited from single uber-options object that resides in prototype\r\n this.uberOptions = Object.create(UberMaterial.prototype.uberOptions);\r\n\r\n // set default values\r\n THREE.RawShaderMaterial.prototype.setValues.call(this, {\r\n uniforms: THREE.UniformsUtils.clone(defaultUniforms),\r\n vertexShader: this.precisionString() + vertexShader,\r\n fragmentShader: this.precisionString() + fragmentShader,\r\n lights: true,\r\n fog: true,\r\n side: THREE.DoubleSide,\r\n });\r\n\r\n this.setValues(params);\r\n}\r\n\r\nUberMaterial.prototype = Object.create(THREE.RawShaderMaterial.prototype);\r\nUberMaterial.prototype.constructor = UberMaterial;\r\n\r\nUberMaterial.prototype.precisionString = function () {\r\n const { precision } = capabilities;\r\n const str = `precision ${precision} float;\\n`\r\n + `precision ${precision} int;\\n\\n`;\r\n return str;\r\n};\r\n\r\n// properties that convert to uniforms\r\nUberMaterial.prototype.uberOptions = {\r\n diffuse: new THREE.Color(0xffffff), // used in phong lighting\r\n specular: new THREE.Color(0x111111), // used in phong lighting\r\n shininess: 30, // used in phong lighting\r\n opacity: 1, // set mesh opacity\r\n fixedColor: new THREE.Color(0xffffff), // color to override (see OVERRIDE_COLOR)\r\n zOffset: 0.0, // used fo zsprites (see SPHERE_SPRITE CYLINDER_SPRITE)\r\n zClipCoef: 2.0, // use for Surfs clipping (mesh param, isn't used in shader) FIXME move to representation param\r\n zClipValue: 0.0, // value to clip Surfs in shader (see ZCLIP)\r\n clipPlaneValue: 0.0, // value to clip scene globally (see CLIPPLANE)\r\n world2colorMatrix: new THREE.Matrix4(),\r\n dashedLineSize: 0.1,\r\n dashedLinePeriod: 0.3,\r\n projMatrixInv: new THREE.Matrix4(),\r\n viewport: new THREE.Vector2(800, 600),\r\n lineWidth: 2.0,\r\n fogAlpha: 1.0,\r\n samplesKernel: _samplesKernel,\r\n noiseTex: noise.noiseTexture,\r\n noiseTexelSize: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight),\r\n srcTexelSize: new THREE.Vector2(1.0 / 800.0, 1.0 / 600.0),\r\n\r\n copy(source) {\r\n this.diffuse.copy(source.diffuse);\r\n this.specular.copy(source.specular);\r\n this.shininess = source.shininess;\r\n this.opacity = source.opacity;\r\n this.fixedColor.copy(source.fixedColor);\r\n this.zOffset = source.zOffset;\r\n this.zClipCoef = source.zClipCoef;\r\n this.zClipValue = source.zClipValue;\r\n this.clipPlaneValue = source.clipPlaneValue;\r\n this.world2colorMatrix.copy(source.world2colorMatrix);\r\n this.dashedLineSize = source.dashedLineSize;\r\n this.dashedLinePeriod = source.dashedLinePeriod;\r\n this.projMatrixInv = source.projMatrixInv;\r\n this.viewport = source.viewport;\r\n this.lineWidth = source.lineWidth; // used for thick lines only\r\n this.toonShading = source.toonShading;\r\n this.fogAlpha = source.fogAlpha;\r\n this.samplesKernel = source.samplesKernel;\r\n this.noiseTex = source.noiseTex;\r\n this.noiseTexelSize = source.noiseTexelSize;\r\n this.srcTexelSize = source.srcTexelSize;\r\n },\r\n};\r\n\r\nUberMaterial.prototype.copy = function (source) {\r\n THREE.RawShaderMaterial.prototype.copy.call(this, source);\r\n\r\n this.fragmentShader = source.fragmentShader;\r\n this.vertexShader = source.vertexShader;\r\n\r\n this.uniforms = THREE.UniformsUtils.clone(source.uniforms);\r\n this.defines = { ...source.defines };\r\n this.extensions = source.extensions;\r\n\r\n this.fog = source.fog;\r\n this.instancedPos = source.instancedPos;\r\n this.instancedMatrix = source.instancedMatrix;\r\n this.attrColor = source.attrColor;\r\n this.attrColor2 = source.attrColor2;\r\n this.attrAlphaColor = source.attrAlphaColor;\r\n this.overrideColor = source.overrideColor;\r\n this.sphereSprite = source.sphereSprite;\r\n this.cylinderSprite = source.cylinderSprite;\r\n this.zClip = source.zClip;\r\n this.clipPlane = source.clipPlane;\r\n this.fakeOpacity = source.fakeOpacity;\r\n this.colorFromPos = source.colorFromPos;\r\n this.shadowmap = source.shadowmap;\r\n this.shadowmapType = source.shadowmapType;\r\n this.colorFromDepth = source.colorFromDepth;\r\n this.prepassTransparancy = source.prepassTransparancy;\r\n this.dashedLine = source.dashedLine;\r\n this.thickLine = source.thickLine;\r\n this.fogTransparent = source.fogTransparent;\r\n this.normalsToGBuffer = source.normalsToGBuffer;\r\n this.toonShading = source.toonShading;\r\n\r\n this.uberOptions.copy(source.uberOptions);\r\n\r\n return this;\r\n};\r\n\r\n// create copy of this material\r\n// its options are prototyped after this material's options\r\nUberMaterial.prototype.createInstance = function () {\r\n const inst = new UberMaterial();\r\n inst.copy(this);\r\n inst.uberOptions = Object.create(this.uberOptions);\r\n return inst;\r\n};\r\n\r\nUberMaterial.prototype.setValues = function (values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n THREE.RawShaderMaterial.prototype.setValues.call(this, values);\r\n\r\n const defines = {};\r\n const extensions = {};\r\n\r\n if (this.fog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.instancedPos) {\r\n defines.INSTANCED_POS = 1;\r\n }\r\n if (this.instancedMatrix) {\r\n defines.INSTANCED_MATRIX = 1;\r\n }\r\n if (this.attrColor) {\r\n defines.ATTR_COLOR = 1;\r\n }\r\n if (this.attrColor2) {\r\n defines.ATTR_COLOR2 = 1;\r\n }\r\n if (this.attrAlphaColor) {\r\n defines.ATTR_ALPHA_COLOR = 1;\r\n }\r\n if (this.overrideColor) {\r\n defines.OVERRIDE_COLOR = 1;\r\n }\r\n if (this.sphereSprite) {\r\n defines.SPHERE_SPRITE = 1;\r\n extensions.fragDepth = 1;\r\n }\r\n if (this.cylinderSprite) {\r\n defines.CYLINDER_SPRITE = 1;\r\n extensions.fragDepth = 1;\r\n }\r\n if (this.zClip) {\r\n defines.ZCLIP = 1;\r\n }\r\n if (this.clipPlane) {\r\n defines.CLIP_PLANE = 1;\r\n }\r\n if (this.fakeOpacity) {\r\n defines.FAKE_OPACITY = 1;\r\n }\r\n if (this.lights) {\r\n defines.USE_LIGHTS = 1;\r\n }\r\n if (this.colorFromPos) {\r\n defines.COLOR_FROM_POS = 1;\r\n }\r\n if (this.shadowmap) {\r\n defines.SHADOWMAP = 1;\r\n if (this.shadowmapType === 'pcf') {\r\n defines.SHADOWMAP_PCF_SHARP = 1;\r\n } else if (this.shadowmapType === 'random') {\r\n defines.SHADOWMAP_PCF_RAND = 1;\r\n } else {\r\n defines.SHADOWMAP_BASIC = 1;\r\n }\r\n }\r\n if (this.colorFromDepth) {\r\n defines.COLOR_FROM_DEPTH = 1;\r\n }\r\n if (this.prepassTransparancy) {\r\n defines.PREPASS_TRANSP = 1;\r\n }\r\n if (this.dashedLine) {\r\n defines.DASHED_LINE = 1;\r\n }\r\n if (this.thickLine) {\r\n defines.THICK_LINE = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n if (this.normalsToGBuffer) {\r\n extensions.drawBuffers = 1;\r\n defines.NORMALS_TO_G_BUFFER = 1;\r\n }\r\n if (this.toonShading) {\r\n defines.TOON_SHADING = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n this.extensions = extensions;\r\n};\r\n\r\nUberMaterial.prototype.setUberOptions = function (values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n for (const key in values) {\r\n if (!values.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n\r\n if (this.uberOptions[key] instanceof THREE.Color) {\r\n this.uberOptions[key] = values[key].clone();\r\n } else {\r\n this.uberOptions[key] = values[key];\r\n }\r\n }\r\n};\r\n\r\nUberMaterial.prototype.clone = function (shallow) {\r\n if (!shallow) {\r\n return THREE.Material.prototype.clone.call(this);\r\n }\r\n return this.createInstance();\r\n};\r\n\r\nUberMaterial.prototype.updateUniforms = function () {\r\n const self = this;\r\n\r\n uberOptionNames.forEach((p) => {\r\n if (self.uniforms.hasOwnProperty(p)) {\r\n if (self.uberOptions[p] instanceof THREE.Color\r\n || self.uberOptions[p] instanceof THREE.Matrix4) {\r\n self.uniforms[p].value = self.uberOptions[p].clone();\r\n } else {\r\n self.uniforms[p].value = self.uberOptions[p];\r\n }\r\n }\r\n });\r\n};\r\n\r\nexport default UberMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\nimport * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport logger from '../utils/logger';\r\nimport CSS2DObject from './CSS2DObject';\r\nimport RCGroup from './RCGroup';\r\nimport vertexScreenQuadShader from './shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromTex from './shaders/ScreenQuadFromTex.frag';\r\nimport fragmentScreenQuadFromTexWithDistortion from './shaders/ScreenQuadFromTexWithDistortion.frag';\r\nimport UberMaterial from './shaders/UberMaterial';\r\n\r\nconst LAYERS = {\r\n DEFAULT: 0, VOLUME: 1, TRANSPARENT: 2, PREPASS_TRANSPARENT: 3, VOLUME_BFPLANE: 4, COLOR_FROM_POSITION: 5, SHADOWMAP: 6,\r\n};\r\n\r\nconst SELECTION_LAYERS = [ // These layers, that are used in the selection by ray casting\r\n LAYERS.DEFAULT, LAYERS.TRANSPARENT,\r\n];\r\n\r\nTHREE.Object3D.prototype.resetTransform = function () {\r\n this.position.set(0, 0, 0);\r\n this.quaternion.set(0, 0, 0, 1);\r\n this.scale.set(1, 1, 1);\r\n};\r\n\r\n// update world matrix of this object and all its ancestors\r\nTHREE.Object3D.prototype.updateMatrixWorldRecursive = function () {\r\n if (this.parent != null) {\r\n this.parent.updateMatrixWorldRecursive();\r\n }\r\n this.updateMatrixWorld();\r\n};\r\n// add object to parent, saving objects' world transform\r\nTHREE.Object3D.prototype.addSavingWorldTransform = (function () {\r\n const _worldMatrixInverse = new THREE.Matrix4();\r\n\r\n return function (object) {\r\n if (object instanceof THREE.Object3D) {\r\n _worldMatrixInverse.getInverse(this.matrixWorld);\r\n _worldMatrixInverse.multiply(object.matrixWorld);\r\n object.matrix.copy(_worldMatrixInverse);\r\n object.matrix.decompose(object.position, object.quaternion, object.scale);\r\n this.add(object);\r\n }\r\n };\r\n}());\r\n\r\n// render a tiny transparent quad in the center of the screen\r\nTHREE.WebGLRenderer.prototype.renderDummyQuad = (function () {\r\n const _material = new THREE.MeshBasicMaterial({ transparent: true, opacity: 0.0, depthWrite: false });\r\n\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneBufferGeometry(0.01, 0.01), _material);\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n return function () {\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuad = (function () {\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneBufferGeometry(1.0, 1.0));\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n\r\n return function (material) {\r\n _quad.material = material;\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.isIdentity = (function () {\r\n const identity = new THREE.Matrix4();\r\n return function () {\r\n return identity.equals(this);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.applyToPointsArray = function (array, stride, w) {\r\n if (!array || !stride || stride < 3) {\r\n return array;\r\n }\r\n w = w || 0; // use point as normal by default\r\n const e = this.elements;\r\n for (let i = 0; i < array.length; i += stride) {\r\n const x = array[i];\r\n const y = array[i + 1];\r\n const z = array[i + 2];\r\n\r\n const persp = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\r\n\r\n array[i] = (e[0] * x + e[4] * y + e[8] * z + e[12] * w) * persp;\r\n array[i + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13] * w) * persp;\r\n array[i + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14] * w) * persp;\r\n }\r\n return array;\r\n};\r\n\r\nclass ScreenQuadMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n if (params.uniforms === undefined) {\r\n params.uniforms = {};\r\n }\r\n params.uniforms.srcTex = { type: 't', value: null };\r\n params.vertexShader = vertexScreenQuadShader;\r\n params.transparent = false;\r\n params.depthTest = false;\r\n params.depthWrite = false;\r\n super(params);\r\n }\r\n}\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTex = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { opacity: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTex,\r\n transparent: true,\r\n });\r\n\r\n\r\n return function (srcTex, opacity) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.transparent = (opacity < 1.0);\r\n _material.uniforms.opacity.value = opacity;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { coef: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTexWithDistortion,\r\n });\r\n\r\n\r\n return function (srcTex, coef) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.uniforms.coef.value = coef;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\n/**\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setMinimalFov = function (angle) {\r\n if (this.aspect >= 1.0) {\r\n this.fov = angle;\r\n } else {\r\n this.fov = THREE.Math.radToDeg(2 * Math.atan(Math.tan(THREE.Math.degToRad(angle) * 0.5) / this.aspect));\r\n }\r\n};\r\n\r\n/**\r\n * @param {THREE.PerspectiveCamera} camera - Base camera for this stereo camera.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.StereoCamera.prototype.updateHalfSized = function (camera, angle) {\r\n const originalAspect = camera.aspect;\r\n const originalFov = camera.fov;\r\n\r\n camera.aspect = originalAspect / 2.0;\r\n camera.setMinimalFov(angle);\r\n camera.updateProjectionMatrix();\r\n\r\n this.update(camera);\r\n\r\n camera.aspect = originalAspect;\r\n camera.fov = originalFov;\r\n camera.updateProjectionMatrix();\r\n};\r\n\r\n/**\r\n * @param {number} radius - Radius of bounding sphere in angstroms to fit on screen.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setDistanceToFit = function (radius, angle) {\r\n this.position.z = radius / Math.sin(0.5 * THREE.Math.degToRad(angle));\r\n};\r\n\r\n/**\r\n * @param {RCGroup} gfxObj - All objects on scene.\r\n * @param {THREE.PerspectiveCamera} camera - Camera used for rendering.\r\n * @param {number} clipPlane - Distance to clip plane.\r\n * @param {number} fogFarPlane - Distance to fog far plane.\r\n */\r\nTHREE.Raycaster.prototype.intersectVisibleObject = function (gfxObj, camera, clipPlane, fogFarPlane) {\r\n const intersects = this.intersectObject(gfxObj, false);\r\n if (intersects.length === 0) {\r\n return null;\r\n }\r\n\r\n // find point closest to camera that doesn't get clipped by camera near plane or clipPlane (if it exists)\r\n const nearPlane = Math.min(camera.near, clipPlane);\r\n let i;\r\n let p = intersects[0];\r\n const v = new THREE.Vector3();\r\n for (i = 0; i < intersects.length; ++i) {\r\n p = intersects[i];\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -nearPlane) {\r\n break;\r\n }\r\n }\r\n if (i === intersects.length) {\r\n return null;\r\n }\r\n\r\n // check that selected intersection point is not clipped by camera far plane or occluded by fog (if it exists)\r\n const farPlane = Math.min(camera.far, fogFarPlane);\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -farPlane) {\r\n return null;\r\n }\r\n return p;\r\n};\r\n\r\nTHREE.Matrix4.prototype.extractScale = (function () {\r\n const _v = new THREE.Vector3();\r\n\r\n return function (scale) {\r\n if (scale === undefined) {\r\n logger.debug('extractScale(): new is too expensive operation to do it on-the-fly');\r\n scale = _v.clone();\r\n }\r\n\r\n const te = this.elements;\r\n scale.x = _v.set(te[0], te[1], te[2]).length();\r\n scale.y = _v.set(te[4], te[5], te[6]).length();\r\n scale.z = _v.set(te[8], te[9], te[10]).length();\r\n\r\n // if determine is negative, we need to invert one scale\r\n const det = this.determinant();\r\n if (det < 0) {\r\n scale.x = -scale.x;\r\n }\r\n return scale;\r\n };\r\n}());\r\n\r\nfunction _calcCylinderMatrix(posBegin, posEnd, radius) {\r\n const posCenter = posBegin.clone().lerp(posEnd, 0.5);\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(radius, posBegin.distanceTo(posEnd), radius);\r\n\r\n const matRotHalf = new THREE.Matrix4();\r\n matRotHalf.makeRotationX(Math.PI / 2);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n const vUp = new THREE.Vector3(0, 1, 0);\r\n matRotLook.lookAt(posCenter, posEnd, vUp);\r\n\r\n matRotLook.multiply(matRotHalf);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(posCenter);\r\n return matRotLook;\r\n}\r\n\r\nfunction _calcChunkMatrix(eye, target, up, rad) {\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(rad.x, rad.y, 0);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n matRotLook.lookAt(eye, target, up);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(eye);\r\n\r\n return matRotLook;\r\n}\r\n\r\nfunction _forEachMeshInGroup(group, process) {\r\n function processObj(object) {\r\n if (object instanceof THREE.Mesh) {\r\n process(object);\r\n }\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n processObj(object.children[i]);\r\n }\r\n }\r\n processObj(group);\r\n}\r\n\r\nfunction _countMeshTriangles(mesh) {\r\n const geom = mesh.geometry;\r\n if (geom instanceof THREE.InstancedBufferGeometry) {\r\n const attribs = geom.attributes;\r\n for (const property in attribs) {\r\n if (attribs.hasOwnProperty(property) && attribs[property] instanceof THREE.InstancedBufferAttribute) {\r\n const currAttr = attribs[property];\r\n const indexSize = geom.index ? geom.index.array.length / 3 : 0;\r\n return indexSize * currAttr.array.length / currAttr.itemSize;\r\n }\r\n }\r\n return 0;\r\n }\r\n if (geom instanceof THREE.BufferGeometry) {\r\n return geom.index ? geom.index.array.length / 3 : 0;\r\n }\r\n return geom.faces ? geom.faces.length : 0;\r\n}\r\n\r\nfunction _countTriangles(group) {\r\n let totalCount = 0;\r\n _forEachMeshInGroup(group, (mesh) => {\r\n totalCount += _countMeshTriangles(mesh);\r\n });\r\n return totalCount;\r\n}\r\n\r\nfunction _groupHasGeometryToRender(group) {\r\n let hasGeoms = false;\r\n group.traverse((node) => {\r\n if (node.hasOwnProperty('geometry') || node instanceof CSS2DObject) {\r\n hasGeoms = true;\r\n }\r\n });\r\n return hasGeoms;\r\n}\r\n\r\nfunction _buildDistorionMesh(widthSegments, heightSegements, coef) {\r\n // solve equation r_u = r_d * (1 + k * r_d^2)\r\n // for r_d using iterations\r\n // takes: r_u^2\r\n // returns: r_d / r_u factor that can be used to distort point coords\r\n function calcInverseBarrel(r2) {\r\n const epsilon = 1e-5;\r\n let prevR2 = 0.0;\r\n let curR2 = r2;\r\n let dr = 1.0;\r\n while (Math.abs(curR2 - prevR2) > epsilon) {\r\n dr = 1.0 + coef * curR2;\r\n prevR2 = curR2;\r\n curR2 = r2 / (dr * dr);\r\n }\r\n\r\n return 1.0 / dr;\r\n }\r\n\r\n const geo = new THREE.PlaneBufferGeometry(2.0, 2.0, widthSegments, heightSegements);\r\n\r\n const pos = geo.getAttribute('position');\r\n for (let i = 0; i < pos.count; ++i) {\r\n const x = pos.array[3 * i];\r\n const y = pos.array[3 * i + 1];\r\n const c = calcInverseBarrel(x * x + y * y);\r\n pos.setXY(i, c * x, c * y);\r\n }\r\n\r\n return geo;\r\n}\r\n\r\nTHREE.BufferAttribute.prototype.copyAtList = function (attribute, indexList) {\r\n console.assert(\r\n this.itemSize === attribute.itemSize,\r\n 'DEBUG: BufferAttribute.copyAtList buffers have different item size.',\r\n );\r\n const { itemSize } = this;\r\n for (let i = 0, n = indexList.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n this.array[i * itemSize + j] = attribute.array[indexList[i] * itemSize + j];\r\n }\r\n }\r\n return this;\r\n};\r\n\r\nfunction fillArray(array, value, startIndex, endIndex) {\r\n startIndex = (typeof startIndex !== 'undefined') ? startIndex : 0;\r\n endIndex = (typeof endIndex !== 'undefined') ? endIndex : array.length;\r\n for (let i = startIndex; i < endIndex; ++i) {\r\n array[i] = value;\r\n }\r\n}\r\n\r\n/** @param {THREE.Object3D} object - Parent object. */\r\nfunction removeChildren(object) {\r\n const { children } = object;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n child.parent = null;\r\n child.dispatchEvent({ type: 'removed' });\r\n }\r\n object.children = [];\r\n}\r\n\r\nfunction clearTree(object) {\r\n object.traverse((obj) => {\r\n if (obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line) {\r\n obj.geometry.dispose();\r\n }\r\n });\r\n removeChildren(object);\r\n}\r\n\r\nfunction destroyObject(object) {\r\n clearTree(object);\r\n if (object.parent) {\r\n object.parent.remove(object);\r\n } else {\r\n object.dispatchEvent({ type: 'removed' });\r\n }\r\n}\r\n\r\nfunction belongToSelectLayers(object) {\r\n for (let i = 0; i < SELECTION_LAYERS.length; i++) {\r\n if (((object.layers.mask >> SELECTION_LAYERS[i]) & 1) === 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction _getMeshesArr(root, meshTypes) {\r\n const meshes = [];\r\n root.traverse((object) => {\r\n for (let i = 0; i < meshTypes.length; i++) {\r\n if (object instanceof meshTypes[i]) {\r\n meshes[meshes.length] = object;\r\n break;\r\n }\r\n }\r\n });\r\n return meshes;\r\n}\r\n\r\nfunction applyTransformsToMeshes(root, mtc) {\r\n const mtcCount = mtc.length;\r\n if (mtcCount < 1) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments, THREE.Line]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n const { parent } = mesh;\r\n if (!parent) {\r\n continue;\r\n }\r\n mesh.applyMatrix(mtc[0]);\r\n for (let j = 1; j < mtcCount; ++j) {\r\n const newMesh = new mesh.constructor(mesh.geometry, mesh.material);\r\n parent.add(newMesh);\r\n newMesh.applyMatrix(mtc[j]);\r\n }\r\n }\r\n}\r\n\r\nfunction processTransparentMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n const { parent } = mesh;\r\n if (!parent) {\r\n continue;\r\n }\r\n mesh.material.setValues({ prepassTransparancy: false, fakeOpacity: false });\r\n mesh.material.needsUpdate = true;\r\n mesh.layers.set(LAYERS.TRANSPARENT);\r\n\r\n // copy of geometry with prepass material\r\n const prepassMat = mesh.material.createInstance();\r\n prepassMat.setValues({ prepassTransparancy: true, fakeOpacity: false });\r\n const prepassMesh = new mesh.constructor(mesh.geometry, prepassMat);\r\n _.forEach(['transparent', 'colorFromDepth', 'lights', 'shadowmap', 'fog'],\r\n (value) => {\r\n prepassMesh.material[value] = false;\r\n });\r\n prepassMesh.material.needsUpdate = true;\r\n prepassMesh.applyMatrix(mesh.matrix);\r\n prepassMesh.layers.set(LAYERS.PREPASS_TRANSPARENT);\r\n parent.add(prepassMesh);\r\n }\r\n}\r\n\r\nfunction processColFromPosMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n const { parent } = mesh;\r\n if (!parent) {\r\n continue;\r\n }\r\n\r\n // copy of geometry with colFromPosMat material\r\n const colFromPosMat = mesh.material.createInstance();\r\n colFromPosMat.setValues({ colorFromPos: true });\r\n const colFromPosMesh = new mesh.constructor(mesh.geometry, colFromPosMat);\r\n _.forEach(['transparent', 'colorFromDepth', 'lights', 'shadowmap', 'fog', 'overrideColor', 'fogTransparent',\r\n 'attrColor', 'attrColor2', 'attrAlphaColor', 'fakeOpacity'],\r\n (value) => {\r\n colFromPosMesh.material[value] = false;\r\n });\r\n\r\n colFromPosMesh.material.needsUpdate = true;\r\n colFromPosMesh.applyMatrix(mesh.matrix);\r\n colFromPosMesh.layers.set(LAYERS.COLOR_FROM_POSITION);\r\n parent.add(colFromPosMesh);\r\n }\r\n}\r\n\r\nfunction createShadowmapMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n if (!mesh.receiveShadow && mesh.material.shadowmap) { // remove shadow from non-receivers\r\n mesh.material.setValues({ shadowmap: false });\r\n }\r\n if (!mesh.castShadow) { // skip creating shadowmap meshes for non-casters\r\n continue;\r\n }\r\n\r\n // create special mesh for shadowmap\r\n const { parent } = mesh;\r\n if (!parent) {\r\n continue;\r\n }\r\n\r\n // copy of geometry with shadowmap material\r\n const shadowmapMat = mesh.material.createInstance();\r\n shadowmapMat.setValues({ colorFromDepth: true });\r\n const shadowmapMesh = new mesh.constructor(mesh.geometry, shadowmapMat);\r\n _.forEach(['lights', 'shadowmap', 'fog'],\r\n (value) => {\r\n shadowmapMesh.material[value] = false;\r\n });\r\n shadowmapMesh.isShadowmapMesh = true;\r\n shadowmapMesh.material.needsUpdate = true;\r\n shadowmapMesh.applyMatrix(mesh.matrix);\r\n shadowmapMesh.layers.set(LAYERS.SHADOWMAP);\r\n parent.add(shadowmapMesh);\r\n }\r\n}\r\n\r\nfunction removeShadowmapMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n if (mesh.isShadowmapMesh && mesh.parent) {\r\n mesh.parent.remove(mesh);\r\n }\r\n }\r\n}\r\n\r\nfunction processObjRenderOrder(root, idMaterial) {\r\n // set renderOrder to 0 for Backdrop and to 1 in other cases to render Backdrop earlier all other materials\r\n const renderOrder = +(idMaterial !== 'BA');\r\n root.traverse((object) => {\r\n if (object.isGroup) {\r\n object.renderOrder = renderOrder;\r\n }\r\n });\r\n}\r\n\r\n/** Traverse tree and make visible only needed meshes */\r\nfunction makeVisibleMeshes(object, checker) {\r\n if (object && object.traverse) {\r\n object.traverse((obj) => {\r\n if (obj instanceof THREE.Mesh) {\r\n obj.visible = checker(obj);\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction applySelectionMaterial(geo) {\r\n geo.traverse((node) => {\r\n if ('material' in node) {\r\n node.material = node.material.clone(true);\r\n // using z-offset to magically fix selection rendering artifact (on z-sprites)\r\n node.material.setValues({ depthFunc: THREE.LessEqualDepth, overrideColor: true, fog: false });\r\n node.material.setUberOptions({ fixedColor: new THREE.Color(0xFFFF00), zOffset: -1e-6 });\r\n }\r\n });\r\n}\r\n\r\nfunction getMiddlePoint(point1, point2, optionalTarget) {\r\n const result = optionalTarget || new THREE.Vector3();\r\n\r\n result.set(0, 0, 0);\r\n result.addScaledVector(point1, 0.5);\r\n result.addScaledVector(point2, 0.5);\r\n\r\n return result;\r\n}\r\n\r\n\r\nexport default {\r\n calcCylinderMatrix: _calcCylinderMatrix,\r\n calcChunkMatrix: _calcChunkMatrix,\r\n forEachMeshInGroup: _forEachMeshInGroup,\r\n countTriangles: _countTriangles,\r\n groupHasGeometryToRender: _groupHasGeometryToRender,\r\n buildDistorionMesh: _buildDistorionMesh,\r\n RCGroup,\r\n fillArray,\r\n clearTree,\r\n destroyObject,\r\n belongToSelectLayers,\r\n applyTransformsToMeshes,\r\n processTransparentMaterial,\r\n processColFromPosMaterial,\r\n createShadowmapMaterial,\r\n removeShadowmapMaterial,\r\n processObjRenderOrder,\r\n makeVisibleMeshes,\r\n applySelectionMaterial,\r\n getMiddlePoint,\r\n LAYERS,\r\n};\r\n","import * as THREE from 'three';\r\nimport utils from './utils';\r\nimport gfxutils from './gfx/gfxutils';\r\n\r\nconst _defaultBoundaries = {\r\n boundingBox: new THREE.Box3(new THREE.Vector3(-1, -1, -1), new THREE.Vector3(1, 1, 1)),\r\n boundingSphere: new THREE.Sphere(new THREE.Vector3(0, 0, 0), 1),\r\n};\r\n\r\nfunction Visual(name, dataSource) {\r\n gfxutils.RCGroup.call(this);\r\n\r\n this.name = name;\r\n\r\n this._dataSource = dataSource;\r\n}\r\n\r\nutils.deriveClass(Visual, gfxutils.RCGroup);\r\n\r\nVisual.prototype.release = function () {\r\n if (this.parent) {\r\n this.parent.remove(this);\r\n }\r\n};\r\n\r\nVisual.prototype.getDataSource = function () {\r\n return this._dataSource;\r\n};\r\n\r\nVisual.prototype.getBoundaries = function () {\r\n return _defaultBoundaries;\r\n};\r\n\r\nexport default Visual;\r\n","function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nmodule.exports = _nonIterableSpread;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _ensureArray(x) {\r\n if (x === null || x === undefined || Array.isArray(x)) {\r\n return x;\r\n }\r\n return [x];\r\n}\r\n\r\n/** An indexed list of objects or classes. */\r\nclass EntityList {\r\n /**\r\n * Create a list of objects.\r\n * The objects can be indexed by one or more properties for the later retrieval.\r\n *\r\n * @param {!Array=} entities A list of objects to automatically register at creation time.\r\n * @param {!Array=} indices A list of property names to use for case-insensitive indexing.\r\n * By default, a single `.id` property is used.\r\n * @see EntityList#register\r\n */\r\n constructor(entities = [], indices = ['id']) {\r\n this._list = [];\r\n this._dict = {};\r\n this._indices = [...indices];\r\n this._indices.forEach((index) => {\r\n this._dict[index] = {};\r\n });\r\n\r\n entities.forEach((entity) => this.register(entity));\r\n }\r\n\r\n /**\r\n * Add a value to the end of a list.\r\n * The list will contain only one copy of the value.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromList\r\n * @see EntityList.registerInDict\r\n */\r\n static registerInList(list, value) {\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a value from a list if it is there.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to remove.\r\n * @see EntityList.registerInList\r\n */\r\n static unregisterFromList(list, value) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Add a value to a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromDict\r\n * @see EntityList.registerInList\r\n */\r\n static registerInDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key] = dict[key] || [];\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Remove a value from a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.registerInDict\r\n */\r\n static unregisterFromDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key];\r\n if (list) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n if (list.length === 0) {\r\n delete dict[key];\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Add an entity to this list.\r\n *\r\n * @param {!Object} entity An object or a class to register. The object must include all\r\n * properties specified as indices on construction.\r\n * @see EntityList#unregister\r\n */\r\n register(entity) {\r\n EntityList.registerInList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.registerInDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * Remove an entity from this list.\r\n *\r\n * @param {!Object} entity An object or a class to unregister. The object may be\r\n * missing from the list but it must include all properties specified as indices\r\n * on construction.\r\n * @see EntityList#register\r\n */\r\n unregister(entity) {\r\n EntityList.unregisterFromList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.unregisterFromDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * An ordered list of all registered entities.\r\n * It is a read-only copy, use {@link EntityList#register} and {@link EntityList#unregister}\r\n * to modify it.\r\n *\r\n * @type {!Array}\r\n */\r\n get all() {\r\n return [...this._list];\r\n }\r\n\r\n /**\r\n * The first registered entity.\r\n * Use it if you do not care which entity you are referring to.\r\n *\r\n * @type {Object=}\r\n */\r\n get first() {\r\n return this._list[0];\r\n }\r\n\r\n /**\r\n * Retrieve a list of keys for the index.\r\n *\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {!Array} An unordered list of keys in the index, i.e. particular property\r\n * values for all registered entities.\r\n */\r\n keys(index) {\r\n return Object.keys(this._dict[index || this._indices[0]]);\r\n }\r\n\r\n /**\r\n * Retrieve an entity by its key.\r\n *\r\n * @param {string} key A case-insensitive property value to look-up.\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {Object=} An object registered in the index under the key. If there are multiple\r\n * objects under the same key, the first one is returned.\r\n */\r\n get(key, index) {\r\n const dict = this._dict[index || this._indices[0]];\r\n if (dict) {\r\n const values = dict[key && key.toLowerCase()];\r\n return values && values.length > 0 ? values[0] : undefined;\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nexport default EntityList;\r\n","import settings from '../settings';\r\nimport logger from './logger';\r\n\r\nfunction makeContextDependent(prototype) {\r\n Object.defineProperties(prototype, {\r\n logger: {\r\n get() {\r\n return this.context && this.context.logger ? this.context.logger : logger;\r\n },\r\n },\r\n settings: {\r\n get() {\r\n return this.context && this.context.settings ? this.context.settings : settings;\r\n },\r\n },\r\n });\r\n}\r\n\r\nexport default makeContextDependent;\r\n","import * as THREE from 'three';\r\n\r\nclass CollisionSphere {\r\n constructor(position, radius) {\r\n this._position = position;\r\n this._radius = radius;\r\n }\r\n\r\n static _sphere = new THREE.Sphere();\r\n\r\n raycast(raycaster) {\r\n const sphere = CollisionSphere._sphere;\r\n sphere.set(this._position, this._radius);\r\n\r\n const p = new THREE.Vector3();\r\n if (raycaster.ray.intersectSphere(sphere, p)) {\r\n return {\r\n distance: raycaster.ray.origin.distanceTo(p),\r\n point: p,\r\n };\r\n }\r\n return null;\r\n }\r\n}\r\n\r\nconst SphereCollisionGeo = (base) => class extends base {\r\n constructor(count, ...args) {\r\n super(...args);\r\n this._objects = new Array(count);\r\n this.boundingSphere = null;\r\n this.boundingBox = null;\r\n }\r\n\r\n setSphere(idx, position, radius) {\r\n this._objects[idx] = new CollisionSphere(position, radius);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n // TODO raycast with bounding sphere? How to deal with updates?\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const inters = this._objects[i].raycast(raycaster);\r\n if (inters) {\r\n inters.chunkIdx = i;\r\n intersects.push(inters);\r\n }\r\n }\r\n }\r\n\r\n computeBoundingBox() {\r\n const objects = this._objects;\r\n let { boundingBox } = this;\r\n if (boundingBox === null) {\r\n this.boundingBox = boundingBox = new THREE.Box3();\r\n }\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n boundingBox.expandByPoint(objects[i]._position);\r\n }\r\n }\r\n\r\n computeBoundingSphere() {\r\n this.computeBoundingBox();\r\n const objects = this._objects;\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n const pos = objects[i]._position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n if (this.boundingSphere === null) {\r\n this.boundingSphere = new THREE.Sphere();\r\n }\r\n this.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n};\r\nexport default SphereCollisionGeo;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst tmpColor = new THREE.Color();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\nclass InstancedSpheresGeometry extends SphereCollisionGeo(THREE.InstancedBufferGeometry) {\r\n constructor(spheresCount, sphereComplexity, useZSprites) {\r\n super(spheresCount);\r\n this._sphGeometry = useZSprites ? new THREE.PlaneBufferGeometry(2, 2, 1, 1)\r\n : new THREE.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI);\r\n this._init(spheresCount, this._sphGeometry);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n setArrayXYZW(this._offsets, itemIdx * OFFSET_SIZE, itemPos.x, itemPos.y, itemPos.z, itemRad);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n\r\n setColor(itemIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n setArrayXYZ(this._colors, itemIdx * COLOR_SIZE, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('offset').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[chunkIndices[i]] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._sphGeometry);\r\n\r\n copySubArrays(this._offsets, geom._offsets, chunkIndices, OFFSET_SIZE);\r\n copySubArrays(this._colors, geom._colors, chunkIndices, COLOR_SIZE);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(spheresCount, sphereGeo) {\r\n this.copy(sphereGeo);\r\n\r\n this._offsets = utils.allocateTyped(Float32Array, spheresCount * OFFSET_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, spheresCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('offset', new THREE.InstancedBufferAttribute(this._offsets, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._colors, COLOR_SIZE, false, 1));\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(alpha, 1, false, 1));\r\n }\r\n}\r\nexport default InstancedSpheresGeometry;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * This class adds raycasting interface to indexed\r\n * THREE.BufferGeometry.\r\n * @constructor\r\n */\r\n\r\nclass RaycastableBufferGeometry extends THREE.BufferGeometry {\r\n // This method was copied from three.js\r\n\r\n static _vA = new THREE.Vector3();\r\n\r\n static _vB = new THREE.Vector3();\r\n\r\n static _vC = new THREE.Vector3();\r\n\r\n\r\n static _uvA = new THREE.Vector2();\r\n\r\n static _uvB = new THREE.Vector2();\r\n\r\n static _uvC = new THREE.Vector2();\r\n\r\n\r\n static _barycoord = new THREE.Vector3();\r\n\r\n\r\n static _intersectionPoint = new THREE.Vector3();\r\n\r\n uvIntersection(point, p1, p2, p3, uv1, uv2, uv3) {\r\n const barycoord = RaycastableBufferGeometry._barycoord;\r\n THREE.Triangle.barycoordFromPoint(point, p1, p2, p3, barycoord);\r\n\r\n uv1.multiplyScalar(barycoord.x);\r\n uv2.multiplyScalar(barycoord.y);\r\n uv3.multiplyScalar(barycoord.z);\r\n\r\n uv1.add(uv2).add(uv3);\r\n return uv1.clone();\r\n }\r\n\r\n checkIntersection(object, raycaster, ray, pA, pB, pC, point) {\r\n const intersect = ray.intersectTriangle(pA, pB, pC, false, point);\r\n\r\n if (intersect === null) {\r\n return null;\r\n }\r\n\r\n return {\r\n point: point.clone(),\r\n };\r\n }\r\n\r\n checkBufferGeometryIntersection(object, raycaster, ray, position, uv, a, b, c) {\r\n const vA = RaycastableBufferGeometry._vA;\r\n const vB = RaycastableBufferGeometry._vB;\r\n const vC = RaycastableBufferGeometry._vC;\r\n const intersectionPoint = RaycastableBufferGeometry._intersectionPoint;\r\n\r\n vA.fromBufferAttribute(position, a);\r\n vB.fromBufferAttribute(position, b);\r\n vC.fromBufferAttribute(position, c);\r\n\r\n const intersection = this.checkIntersection(\r\n object, raycaster, ray, vA, vB, vC, intersectionPoint,\r\n );\r\n if (intersection) {\r\n if (uv) {\r\n const uvA = RaycastableBufferGeometry._uvA;\r\n const uvB = RaycastableBufferGeometry._uvB;\r\n const uvC = RaycastableBufferGeometry._uvC;\r\n\r\n uvA.fromBufferAttribute(uv, a);\r\n uvB.fromBufferAttribute(uv, b);\r\n uvC.fromBufferAttribute(uv, c);\r\n intersection.uv = this.uvIntersection(\r\n intersectionPoint, vA, vB, vC, uvA, uvB, uvC,\r\n );\r\n }\r\n const normal = new THREE.Vector3();\r\n THREE.Triangle.getNormal(vA, vB, vC, normal);\r\n intersection.face = new THREE.Face3(a, b, c, normal);\r\n intersection.faceIndex = a;\r\n }\r\n\r\n return intersection;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const { ray } = raycaster;\r\n if (this.boundingSphere === null) {\r\n this.computeBoundingSphere();\r\n }\r\n\r\n if (raycaster.ray.intersectsSphere(this.boundingSphere) === false) {\r\n return;\r\n }\r\n\r\n if (this.boundingBox !== null) {\r\n if (ray.intersectsBox(this.boundingBox) === false) {\r\n return;\r\n }\r\n }\r\n\r\n let a;\r\n let b;\r\n let c;\r\n const {\r\n index,\r\n attributes: { position, uv },\r\n } = this;\r\n\r\n if (index === null) {\r\n return;\r\n }\r\n // indexed buffer geometry\r\n for (let i = 0, l = index.count; i < l; i += 3) {\r\n a = index.getX(i);\r\n b = index.getX(i + 1);\r\n c = index.getX(i + 2);\r\n\r\n const intersection = this.checkBufferGeometryIntersection(this, raycaster, ray, position, uv, a, b, c);\r\n\r\n if (intersection) {\r\n intersection.faceIndex = Math.floor(i / 3); // triangle number in indices buffer semantics\r\n intersects.push(intersection);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default RaycastableBufferGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport RaycastableBufferGeometry from './RaycastableBufferGeometry';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VEC_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n */\r\n\r\nclass ChunkedObjectsGeometry extends RaycastableBufferGeometry {\r\n constructor(chunkGeo, chunksCount) {\r\n super();\r\n\r\n if (this.constructor === ChunkedObjectsGeometry) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n\r\n this._chunkGeo = chunkGeo;\r\n\r\n this._init(chunkGeo, chunksCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('normal').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n const idx = i * VEC_SIZE;\r\n colors[idx] = tmpColor.r;\r\n colors[idx + 1] = tmpColor.g;\r\n colors[idx + 2] = tmpColor.b;\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n _.fill(alphaArr, value, left, left + chunkSize);\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n super.raycast(raycaster, inters);\r\n const facesPerChunk = this._chunkGeo.index.count / 3;\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('faceIndex')) {\r\n continue;\r\n }\r\n inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk);\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.BufferGeometry();\r\n this._init.call(geom, this._chunkGeo, instanceCount);\r\n\r\n const srcPos = this._positions;\r\n const srcNorm = this._normals;\r\n const srcColor = this._colors;\r\n\r\n const dstPos = geom._positions;\r\n const dstNorm = geom._normals;\r\n const dstColor = geom._colors;\r\n\r\n const chunkSize = this._chunkSize * VEC_SIZE;\r\n\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const ptIdxBegin = chunkIndices[i] * chunkSize;\r\n const ptIdxEnd = ptIdxBegin + chunkSize;\r\n dstPos.set(srcPos.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstNorm.set(srcNorm.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstColor.set(srcColor.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n }\r\n\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(chunkGeo, chunksCount) {\r\n const chunkSize = this._chunkSize = chunkGeo.attributes.position.count;\r\n const chunkIndex = chunkGeo.index.array;\r\n const chunkIndexSize = chunkIndex.length;\r\n const pointsCount = this._chunkSize * chunksCount;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n const indexSize = chunkIndexSize * chunksCount;\r\n const index = this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, indexSize);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._normals = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n for (let i = 0; i < chunksCount; ++i) {\r\n const offset = i * chunkIndexSize;\r\n const posOffset = i * chunkSize;\r\n index.set(chunkIndex, offset);\r\n for (let j = 0; j < chunkIndexSize; ++j) {\r\n index[offset + j] += posOffset;\r\n }\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, VEC_SIZE));\r\n this.setAttribute('normal', new THREE.BufferAttribute(this._normals, VEC_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, VEC_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n }\r\n}\r\nexport default ChunkedObjectsGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst VEC_SIZE = 3;\r\n\r\nclass SimpleSpheresGeometry extends SphereCollisionGeo(ChunkedObjectsGeometry) {\r\n constructor(spheresCount, sphereComplexity) {\r\n const sphGeometry = new THREE.SphereBufferGeometry(\r\n 1, sphereComplexity * 2, sphereComplexity,\r\n 0, Math.PI * 2, 0, Math.PI,\r\n );\r\n super(spheresCount, sphGeometry, spheresCount);\r\n\r\n const normals = this._normals;\r\n const geoNormals = sphGeometry.attributes.normal.array;\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._tmpPositions = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n for (let i = 0; i < spheresCount; ++i) {\r\n normals.set(geoNormals, chunkSize * VEC_SIZE * i);\r\n }\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n const tmpPos = this._tmpPositions;\r\n const chunkSize = this._chunkSize;\r\n const geoPos = this._chunkPos;\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n const idx = i * 3;\r\n tmpPos[idx] = itemPos.x + geoPos[idx] * itemRad;\r\n tmpPos[idx + 1] = itemPos.y + geoPos[idx + 1] * itemRad;\r\n tmpPos[idx + 2] = itemPos.z + geoPos[idx + 2] * itemRad;\r\n }\r\n\r\n this._positions.set(tmpPos, chunkSize * itemIdx * VEC_SIZE);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n}\r\nexport default SimpleSpheresGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst centerPos = new THREE.Vector3();\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\n\r\nclass Simple2CCylindersGeometry extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, 2 * instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const firstOffset = chunkSize * 2 * itemIdx * VEC_SIZE;\r\n const secondOffset = firstOffset + chunkSize * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n centerPos.lerpVectors(botPos, topPos, 0.5);\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, centerPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, firstOffset);\r\n\r\n // now shift center to get another part of the cylinder\r\n centerPos.sub(botPos);\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpArray[idx] += centerPos.x;\r\n tmpArray[idx + 1] += centerPos.y;\r\n tmpArray[idx + 2] += centerPos.z;\r\n }\r\n this._positions.set(tmpArray, secondOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, firstOffset);\r\n this._normals.set(tmpArray, secondOffset);\r\n }\r\n\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const first = 2 * itemIdx;\r\n super.setColor(first, colorVal1);\r\n\r\n const second = first + 1;\r\n super.setColor(second, colorVal2);\r\n }\r\n}\r\n\r\nexport default Simple2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_POINTS_COUNT_16BIT = 65536;\r\nconst PTS_PER_TRIANGLE = 3;\r\n\r\nclass CylinderBufferGeometry extends THREE.BufferGeometry {\r\n constructor(\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n ) {\r\n super();\r\n\r\n const thetaStart = 0;\r\n const thetaLength = 2 * Math.PI;\r\n\r\n\r\n this.type = 'CylinderBufferGeometry';\r\n\r\n this.parameters = {\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n };\r\n\r\n const hasTop = openEnded === false && radiusTop > 0;\r\n const hasBottom = openEnded === false && radiusBottom > 0;\r\n const vertexCount = (heightSegments + 1) * radialSegments\r\n + hasTop * (radialSegments + 1)\r\n + hasBottom * (radialSegments + 1);\r\n const facesCount = (2 * heightSegments + hasTop + hasBottom) * radialSegments;\r\n\r\n const heightHalf = height / 2;\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const positions = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const normals = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const indices = new THREE.Uint16BufferAttribute(utils.allocateTyped(Uint16Array, facesCount * PTS_PER_TRIANGLE), 1);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const uvs = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 2), 2);\r\n console.assert(vertexCount < MAX_POINTS_COUNT_16BIT, 'DEBUG: Cylinder Geometry has too many vertices (65536 max).');\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n const tanTheta = -(radiusBottom - radiusTop) / height;\r\n\r\n // setup cylinder data\r\n for (let y = 0; y <= heightSegments; y++) {\r\n // faces\r\n if (y !== heightSegments) {\r\n for (let i = 0; i < radialSegments; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + radialSegments + i;\r\n const v3 = currVtxIdx + radialSegments + ((i + 1) % radialSegments);\r\n const v4 = currVtxIdx + ((i + 1) % radialSegments);\r\n\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n // vertices\r\n const v = y / heightSegments;\r\n const radius = v * (radiusBottom - radiusTop) + radiusTop;\r\n\r\n for (let x = 0; x < radialSegments; x++) {\r\n const u = x / radialSegments;\r\n\r\n const vx = radius * Math.sin(u * thetaLength + thetaStart);\r\n const vy = v * height - heightHalf;\r\n const vz = radius * Math.cos(u * thetaLength + thetaStart);\r\n\r\n const normal = new THREE.Vector3(\r\n vx,\r\n Math.sqrt(vx * vx + vz * vz) * tanTheta,\r\n vz,\r\n ).normalize();\r\n\r\n positions.setXYZ(currVtxIdx, vx, vy, vz);\r\n normals.setXYZ(currVtxIdx, normal.x, normal.y, normal.z);\r\n uvs.setXY(currVtxIdx, u, v);\r\n ++currVtxIdx;\r\n }\r\n }\r\n\r\n // top cap\r\n if (hasTop) {\r\n const startTIdx = currVtxIdx;\r\n const lastIdx = currVtxIdx + radialSegments;\r\n for (let fTIdx = 0; fTIdx < radialSegments; ++fTIdx) {\r\n const currSrcIdx = currVtxIdx - radialSegments;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcIdx),\r\n positions.getY(currSrcIdx),\r\n positions.getZ(currSrcIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n\r\n\r\n const nextTVtx = startTIdx + ((fTIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, currVtxIdx, nextTVtx, lastIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n ++currVtxIdx;\r\n }\r\n\r\n // bottom cap\r\n if (hasBottom) {\r\n const startBIdx = currVtxIdx;\r\n const lastBIdx = currVtxIdx + radialSegments;\r\n for (let fBIdx = 0; fBIdx < radialSegments; ++fBIdx) {\r\n const currSrcBIdx = fBIdx;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcBIdx), positions.getY(currSrcBIdx), positions.getZ(currSrcBIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n\r\n\r\n const nextBVtx = startBIdx + ((fBIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, nextBVtx, currVtxIdx, lastBIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, -heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n }\r\n\r\n this.setIndex(indices);\r\n this.setAttribute('position', positions);\r\n this.setAttribute('normal', normals);\r\n this.setAttribute('uv', uvs);\r\n }\r\n\r\n clone() {\r\n const { parameters } = this;\r\n\r\n return new CylinderBufferGeometry(\r\n parameters.radiusTop,\r\n parameters.radiusBottom,\r\n parameters.height,\r\n parameters.radialSegments,\r\n parameters.heightSegments,\r\n parameters.openEnded,\r\n );\r\n }\r\n}\r\n\r\nexport default CylinderBufferGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport CylinderBufferGeometry from './CylinderBufferGeometry';\r\n\r\nconst tmpColor = new THREE.Color();\r\nconst invMatrix = new THREE.Matrix4();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction sortNumber(a, b) {\r\n return a - b;\r\n}\r\n\r\nfunction _prepareCylinderInfo(chunkIndices) {\r\n chunkIndices.sort(sortNumber);\r\n const chunksIdx = [];\r\n const cylinderInfo = [];\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const val = chunkIndices[i];\r\n const even = (val | 0) % 2 === 0;\r\n const newPar = {\r\n first: false,\r\n second: false,\r\n };\r\n if (even) {\r\n newPar.first = true;\r\n newPar.second = i + 1 < n && chunkIndices[i + 1] === chunkIndices[i] + 1;\r\n if (newPar.second) {\r\n ++i;\r\n }\r\n } else {\r\n newPar.second = true;\r\n }\r\n chunksIdx.push(Math.floor(val / 2));\r\n cylinderInfo.push(newPar);\r\n }\r\n return { indices: chunksIdx, cylinderInfo };\r\n}\r\n\r\nfunction _assignOpacity(cylinderInfo, color1, color2) {\r\n for (let i = 0, n = cylinderInfo.length; i < n; ++i) {\r\n const info = cylinderInfo[i];\r\n if (!info.first) {\r\n color1[COLOR_SIZE * i] = -0.5;\r\n }\r\n if (!info.second) {\r\n color2[COLOR_SIZE * i] = -0.5;\r\n }\r\n }\r\n}\r\nclass Instanced2CCylindersGeometry extends THREE.InstancedBufferGeometry {\r\n constructor(instanceCount, polyComplexity, useZSprites, openEnded) {\r\n super();\r\n this._useZSprites = useZSprites;\r\n this._cylGeometry = useZSprites ? new THREE.PlaneBufferGeometry(2, 2, 1, 1)\r\n : new CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, openEnded);\r\n this._init(instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n this._collisionGeo = new Simple2CCylindersGeometry(instanceCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const matrix = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n let me = matrix.elements;\r\n const mtxOffset = itemIdx * OFFSET_SIZE;\r\n\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, itemRad);\r\n setArrayXYZW(this._matVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._matVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._matVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n\r\n if (this._useZSprites) {\r\n invMatrix.getInverse(matrix);\r\n me = invMatrix.elements;\r\n setArrayXYZW(this._invmatVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._invmatVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._invmatVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n }\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const colorIdx = itemIdx * COLOR_SIZE;\r\n tmpColor.set(colorVal1);\r\n setArrayXYZ(this._color1, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n tmpColor.set(colorVal2);\r\n setArrayXYZ(this._color2, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n computeBoundingSphere() {\r\n this._collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = this._collisionGeo.boundingSphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n this._collisionGeo.computeBoundingBox();\r\n this.boundingBox = this._collisionGeo.boundingBox;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('matVector1').needsUpdate = true;\r\n this.getAttribute('matVector2').needsUpdate = true;\r\n this.getAttribute('matVector3').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('color2').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n if (this._useZSprites) {\r\n this.getAttribute('invmatVector1').needsUpdate = true;\r\n this.getAttribute('invmatVector2').needsUpdate = true;\r\n this.getAttribute('invmatVector3').needsUpdate = true;\r\n }\r\n\r\n this._collisionGeo.finishUpdate();\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[Math.floor(chunkIndices[i] / 2)] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const info = _prepareCylinderInfo(chunkIndices);\r\n const cylinderIndices = info.indices;\r\n const instanceCount = cylinderIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n copySubArrays(this._matVector1, geom._matVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector2, geom._matVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector3, geom._matVector3, cylinderIndices, OFFSET_SIZE);\r\n\r\n if (this._useZSprites) {\r\n copySubArrays(this._invmatVector1, geom._invmatVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector2, geom._invmatVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector3, geom._invmatVector3, cylinderIndices, OFFSET_SIZE);\r\n }\r\n\r\n copySubArrays(this._color1, geom._color1, cylinderIndices, COLOR_SIZE);\r\n copySubArrays(this._color2, geom._color2, cylinderIndices, COLOR_SIZE);\r\n _assignOpacity(info.cylinderInfo, geom._color1, geom._color2);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n getGeoParams() {\r\n return this._cylGeometry.parameters;\r\n }\r\n\r\n _init(instanceCount, cylinderGeo, useZSprites) {\r\n this.copy(cylinderGeo);\r\n this._matVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._color1 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n this._color2 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, instanceCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('matVector1', new THREE.InstancedBufferAttribute(this._matVector1, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector2', new THREE.InstancedBufferAttribute(this._matVector2, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector3', new THREE.InstancedBufferAttribute(this._matVector3, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._color1, COLOR_SIZE, false, 1));\r\n this.setAttribute('color2', new THREE.InstancedBufferAttribute(this._color2, COLOR_SIZE, false, 1));\r\n\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(this._alpha, 1, false, 1));\r\n\r\n if (useZSprites) {\r\n this._invmatVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n\r\n this.setAttribute(\r\n 'invmatVector1',\r\n new THREE.InstancedBufferAttribute(this._invmatVector1, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector2',\r\n new THREE.InstancedBufferAttribute(this._invmatVector2, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector3',\r\n new THREE.InstancedBufferAttribute(this._invmatVector3, OFFSET_SIZE, false, 1),\r\n );\r\n }\r\n }\r\n}\r\n\r\nexport default Instanced2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst TRI_SIZE = 3;\r\nconst tmpPrev = new THREE.Vector3();\r\nconst tmpNext = new THREE.Vector3();\r\nconst tmpRes = new THREE.Vector3();\r\nconst simpleNormal = new THREE.Vector3(1.0, 0.0, 0.0);\r\nconst normalOnCut = new THREE.Vector3();\r\nconst nearRingPt = new THREE.Vector3();\r\n\r\nfunction _createExtrudedChunkGeometry(shape, ringsCount) {\r\n const geo = new THREE.BufferGeometry();\r\n const ptsCount = shape.length;\r\n const totalPts = ptsCount * ringsCount;\r\n const type = totalPts <= 65536 ? Uint16Array : Uint32Array;\r\n const facesPerChunk = (ringsCount - 1) * ptsCount * 2;\r\n const indices = new THREE.BufferAttribute(utils.allocateTyped(type, facesPerChunk * TRI_SIZE), 1);\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n for (let y = 0; y < ringsCount; y++) {\r\n // faces\r\n if (y !== ringsCount - 1) {\r\n for (let i = 0; i < ptsCount; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + ptsCount + i;\r\n const v3 = currVtxIdx + ptsCount + ((i + 1) % ptsCount);\r\n const v4 = currVtxIdx + ((i + 1) % ptsCount);\r\n\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n currVtxIdx += ptsCount;\r\n }\r\n\r\n geo.setIndex(indices);\r\n const pos = utils.allocateTyped(Float32Array, totalPts * VEC_SIZE);\r\n geo.setAttribute('position', new THREE.BufferAttribute(pos, VEC_SIZE));\r\n\r\n geo._positions = shape;\r\n\r\n return geo;\r\n}\r\n\r\nclass ExtrudedObjectsGeometry extends ChunkedObjectsGeometry {\r\n constructor(shape, ringsCount, chunksCount) {\r\n const chunkGeo = _createExtrudedChunkGeometry(shape, ringsCount);\r\n super(chunkGeo, chunksCount);\r\n this._ringsCount = ringsCount;\r\n\r\n const tmpShape = this._tmpShape = [];\r\n for (let i = 0; i < shape.length; ++i) {\r\n tmpShape[i] = new THREE.Vector3();\r\n }\r\n }\r\n\r\n setItem(itemIdx, matrices, hasSlope = false, hasCut = false) {\r\n const ptsCount = this._chunkGeo._positions.length;\r\n const ringsCount = this._ringsCount;\r\n const chunkStartIdx = ptsCount * this._ringsCount * itemIdx * VEC_SIZE;\r\n\r\n this._setPoints(matrices, ptsCount, ringsCount, chunkStartIdx);\r\n\r\n if (hasSlope) {\r\n this._setSlopeNormals(ptsCount, ringsCount, chunkStartIdx);\r\n } else {\r\n this._setBaseNormals(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n\r\n if (hasCut) {\r\n this._addCut(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n }\r\n\r\n _setPoints(matrices, ptsCount, ringsCount, chunkStartIdx) {\r\n const tmpShape = this._tmpShape;\r\n const positions = this._positions;\r\n const shape = this._chunkGeo._positions;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i) {\r\n const mtx = matrices[i];\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpShape[j].copy(shape[j]).applyMatrix4(mtx).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _setBaseNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, false);\r\n }\r\n }\r\n\r\n _setSlopeNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const normals = this._normals;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First ring\r\n // In all cases, besides cut, second ring is coincident to first. So values of first ring's normals doesn't\r\n // matter (In the cut case special handler will be applied later and will set them to correct values)\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n simpleNormal.toArray(normals, vtxIdx);\r\n }\r\n // second ring\r\n // If it isn't first Item we take normals' values from the last ring of the previous item (these rings are coincident)\r\n // else we count normals' values based on next ring information\r\n if (vtxIdx - 2 * nPtsInRing > 0) {\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(normals, vtxIdx - 2 * nPtsInRing).toArray(normals, vtxIdx);\r\n }\r\n } else {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, +nPtsInRing);\r\n vtxIdx += nPtsInRing;\r\n }\r\n // other rings\r\n // we count normals' values based on previous ring information\r\n for (let i = 2; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, -nPtsInRing);\r\n }\r\n }\r\n\r\n // Counting normals:\r\n // - Slope\r\n // Radius changes throught part => normals aren't parallel with the plane contains section points\r\n // normal = vTangentInSectionPlane x vToSuchPointInPrevSection (all vectors are scaled for being 1 in length)\r\n // - No slope\r\n // Radius doesn't change throught part => normals are parallel with the plane contains section points\r\n // normal = vToPrevPointInSection + vToNextPointInSection (all vectors are scaled for being 1 in length)\r\n _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) {\r\n const tmpShape = this._tmpShape;\r\n const normals = this._normals;\r\n\r\n tmpShape[0].fromArray(this._positions, vtxIdx);\r\n tmpShape[ptsCount - 1].fromArray(this._positions, vtxIdx + (ptsCount - 1) * VEC_SIZE);\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n if (j < ptsCount - 1) {\r\n tmpShape[j + 1].fromArray(this._positions, vtxIdx + VEC_SIZE);\r\n }\r\n\r\n if (isSlope) {\r\n nearRingPt.fromArray(this._positions, vtxIdx + shiftToExtraPt);\r\n\r\n tmpPrev.subVectors(tmpShape[(j + ptsCount - 1) % ptsCount], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], nearRingPt).normalize();\r\n tmpRes.crossVectors(tmpNext, tmpPrev).normalize().toArray(normals, vtxIdx);\r\n } else {\r\n tmpPrev.subVectors(tmpShape[j], tmpShape[(j + ptsCount - 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpRes.addVectors(tmpPrev, tmpNext).normalize().toArray(normals, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _addCut(ptsCount, ringsCount, chunkStartIdx) {\r\n // Nothing to do if item is flat or only line\r\n if (ptsCount < 3 || ringsCount < 2) {\r\n return;\r\n }\r\n const positions = this._positions;\r\n const normals = this._normals;\r\n const tmpShape = this._tmpShape;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n // Normal to the cut plane is equal to cross product of two vectors which are lying in it\r\n tmpShape[0].fromArray(positions, chunkStartIdx);\r\n tmpShape[1].fromArray(positions, chunkStartIdx + VEC_SIZE);\r\n tmpShape[2].fromArray(positions, chunkStartIdx + 2 * VEC_SIZE);\r\n\r\n tmpPrev.subVectors(tmpShape[1], tmpShape[0]).normalize();\r\n tmpNext.subVectors(tmpShape[1], tmpShape[2]).normalize();\r\n normalOnCut.crossVectors(tmpPrev, tmpNext).normalize();\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First and second rings normals' values are equal to value of normal to the cutting plane\r\n for (let j = 0; j < ptsCount * 2; ++j, vtxIdx += VEC_SIZE) {\r\n normalOnCut.toArray(normals, vtxIdx);\r\n }\r\n if (ringsCount > 2) {\r\n // Third ring points are coincident to first ring points, but have different normals. It makes sharp angle near cut\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(positions, vtxIdx - nPtsInRing).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default ExtrudedObjectsGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VERTEX_PER_SEGMENT = 4;\r\nconst POS_SIZE = 4;\r\nconst DIR_SIZE = 3;\r\nconst COL_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\nconst direction = new THREE.Vector3();\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction getSubset(arr, startSegmentIdx, segmentsCount, elemSize) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT;\r\n const end = start + segmentsCount * VERTEX_PER_SEGMENT;\r\n return arr.subarray(start * elemSize, end * elemSize);\r\n}\r\n\r\n/**\r\n * This class represents lines geometry which consists of screen-aligned narrow quad of variable width.\r\n *\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * collision geometry.\r\n */\r\n\r\nclass ThickLinesGeometry extends THREE.BufferGeometry {\r\n constructor(segmentsCount) {\r\n super();\r\n this._initVertices(segmentsCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n this.getAttribute('direction').needsUpdate = true;\r\n }\r\n\r\n setColor(segmentIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n setSegment(segmentIdx, pos1, pos2) {\r\n direction.subVectors(pos1, pos2);\r\n direction.normalize();\r\n const positions = this._positions;\r\n const directions = this._directions;\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n let dirIdx = segmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n }\r\n\r\n setOpacity(startSegIdx, endSegIdx, value) {\r\n const start = startSegIdx * VERTEX_PER_SEGMENT;\r\n const end = endSegIdx * VERTEX_PER_SEGMENT;\r\n _.fill(this.alpha, value, end, start);\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubsetSegments(startSegmentIdx, segmentsCount) {\r\n return [\r\n getSubset(this._positions, startSegmentIdx, segmentsCount, POS_SIZE),\r\n getSubset(this._directions, startSegmentIdx, segmentsCount, DIR_SIZE),\r\n ];\r\n }\r\n\r\n getSubsetColors(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._colors, startSegmentIdx, segmentsCount, COL_SIZE);\r\n }\r\n\r\n getSubsetOpacities(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._alpha, startSegmentIdx, segmentsCount, 1);\r\n }\r\n\r\n getNumVertexPerSegment() {\r\n return VERTEX_PER_SEGMENT;\r\n }\r\n\r\n getPositionSize() {\r\n return POS_SIZE;\r\n }\r\n\r\n setSegments(startSegmentIdx, positions) {\r\n const startPos = startSegmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n if (positions instanceof Array && positions.length === 2) {\r\n this._positions.set(positions[0], startPos);\r\n const startDir = startSegmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n this._directions.set(positions[1], startDir); // dirs are geo part of vertex\r\n } else {\r\n this._positions.set(positions, startPos);\r\n }\r\n }\r\n\r\n setColors(startSegmentIdx, colors) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n this._colors.set(colors, start);\r\n }\r\n\r\n _initVertices(segmentsCount) {\r\n this._buffersSize = segmentsCount * VERTEX_PER_SEGMENT;\r\n const pointsCount = this._buffersSize;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, segmentsCount * 6);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * POS_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * COL_SIZE);\r\n this._directions = utils.allocateTyped(Float32Array, pointsCount * DIR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n const index = this._index;\r\n let indexOffset = 0;\r\n let pointOffset = 0;\r\n for (let j = 0; j < segmentsCount; j++, indexOffset += 6, pointOffset += VERTEX_PER_SEGMENT) {\r\n index[indexOffset] = pointOffset;\r\n index[indexOffset + 1] = pointOffset + 1;\r\n index[indexOffset + 2] = pointOffset + 3;\r\n index[indexOffset + 3] = pointOffset;\r\n index[indexOffset + 4] = pointOffset + 2;\r\n index[indexOffset + 5] = pointOffset + 3;\r\n }\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, POS_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, COL_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n this.setAttribute('direction', new THREE.BufferAttribute(this._directions, DIR_SIZE));\r\n }\r\n}\r\n\r\n\r\nexport default ThickLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport BaseLinesGeometry from './ThickLinesGeometry';\r\n\r\n/**\r\n * This class represents geometry which consists lines. This can build bounding volumes\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n */\r\nclass LinesGeometry extends BaseLinesGeometry {\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n if (boundingBox) {\r\n boundingBox.getCenter(center);\r\n }\r\n const positions = this._positions;\r\n const sphere = this.boundingSphere || new THREE.Sphere();\r\n const size = this._positions.length;\r\n const pos = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n pos.set(positions[i], positions[i + 1], positions[i + 2]);\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n sphere.set(center, Math.sqrt(radiusSquared));\r\n this.boundingSphere = sphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n const positions = this._positions;\r\n const box = new THREE.Box3();\r\n const size = this._positions.length;\r\n const tmpVec = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n tmpVec.set(positions[i], positions[i + 1], positions[i + 2]);\r\n box.expandByPoint(tmpVec);\r\n }\r\n this.boundingBox = box;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n}\r\n\r\nexport default LinesGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\nclass CylinderCollisionGeo extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const itemOffset = chunkSize * itemIdx * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, itemOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, itemOffset);\r\n }\r\n}\r\nexport default CylinderCollisionGeo;\r\n","import LinesGeometry from './LinesGeometry';\r\nimport CylinderCollisionGeo from './CylinderCollisionGeo';\r\n\r\nconst COLLISION_RAD = 0.1;\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n *\r\n * @param {number} chunksCount Total chunks count.\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * @param {boolean} enableCollision Enable or disable collision where each segment is\r\n * a collidable cylinder.\r\n * collision geometry.\r\n */\r\nclass ChunkedLinesGeometry extends LinesGeometry {\r\n constructor(chunksCount, segmentsCount, enableCollision) {\r\n super(chunksCount * segmentsCount);\r\n this._init(segmentsCount);\r\n this._collisionGeo = enableCollision ? new CylinderCollisionGeo(chunksCount * segmentsCount, 3) : null;\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = collisionGeo.boundingSphere;\r\n return;\r\n }\r\n super.computeBoundingSphere();\r\n }\r\n\r\n computeBoundingBox() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingBox();\r\n this.boundingBox = collisionGeo.boundingBox;\r\n return;\r\n }\r\n super.computeBoundingBox();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const collisionGeo = this._collisionGeo;\r\n if (!collisionGeo) {\r\n return;\r\n }\r\n const segCount = this._chunkSize;\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n for (let i = 0, n = intersects.length; i < n; ++i) {\r\n let { chunkIdx } = intersects[i];\r\n if (chunkIdx === undefined) {\r\n continue;\r\n }\r\n chunkIdx = (chunkIdx / segCount) | 0;\r\n intersects[i].chunkIdx = chunkIdx;\r\n }\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n super.setColor(i, colorVal);\r\n }\r\n }\r\n\r\n setSegment(chunkIdx, segIdx, pos1, pos2) {\r\n const chunkSize = this._chunkSize;\r\n const idx = chunkIdx * chunkSize + segIdx;\r\n super.setSegment(idx, pos1, pos2);\r\n if (this._collisionGeo) {\r\n this._collisionGeo.setItem(chunkIdx * chunkSize + segIdx, pos1, pos2, COLLISION_RAD);\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n super.setOpacity(left, left + chunkSize - 1, value);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const chunkSize = this._chunkSize;\r\n const subset = new ChunkedLinesGeometry(instanceCount, chunkSize, false);\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const startSegIdx = chunkIndices[i] * chunkSize;\r\n subset.setSegments(dstPtOffset, this.getSubsetSegments(startSegIdx, chunkSize));\r\n subset.setColors(dstPtOffset, this.getSubsetColors(startSegIdx, chunkSize));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(chunkSize) {\r\n this._chunkSize = chunkSize;\r\n }\r\n}\r\n\r\nexport default ChunkedLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport LinesGeometry from './LinesGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\n\r\nconst COLLISION_RAD = 0.3;\r\nconst tmpVector = new THREE.Vector3();\r\n\r\n\r\nclass TwoColorLinesGeometry extends LinesGeometry {\r\n constructor(segmentsCount) {\r\n super(segmentsCount * 2);\r\n this._init(segmentsCount);\r\n this._collisionGeo = new Simple2CCylindersGeometry(segmentsCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos) {\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, COLLISION_RAD);\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n tmpVector.lerpVectors(botPos, topPos, 0.5);\r\n super.setSegment(offset, botPos, tmpVector);\r\n super.setSegment(offset + 1, tmpVector, topPos);\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n super.setColor(offset, colorVal1);\r\n super.setColor(offset + 1, colorVal2);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n if (this._collisionGeo) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n getSubset(segmentIndices) {\r\n const instanceCount = segmentIndices.length;\r\n const subset = new TwoColorLinesGeometry(instanceCount, false);\r\n for (let i = 0, n = instanceCount; i < n; ++i) {\r\n const startSegIdx = segmentIndices[i];\r\n subset.setSegments(i, this.getSubsetSegments(startSegIdx, 1));\r\n subset.setColors(i, this.getSubsetColors(startSegIdx, 1));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(segmentsCount) {\r\n this._segCounts = segmentsCount * 2;\r\n }\r\n}\r\n// (???)parent = LinesGeometry.prototype;\r\n\r\nexport default TwoColorLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst vectors = [\r\n new THREE.Vector3(1, 0, 0),\r\n new THREE.Vector3(-1, 0, 0),\r\n new THREE.Vector3(0, 1, 0),\r\n new THREE.Vector3(0, -1, 0),\r\n new THREE.Vector3(0, 0, 1),\r\n new THREE.Vector3(0, 0, -1),\r\n];\r\nconst vecCount = vectors.length;\r\nconst tempPos1 = new THREE.Vector3();\r\nconst tempPos2 = new THREE.Vector3();\r\n\r\nclass CrossGeometry extends SphereCollisionGeo(ChunkedLinesGeometry) {\r\n constructor(chunksCount) {\r\n super(chunksCount, chunksCount, (vecCount / 2) | 0, false);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n\r\n for (let i = 0; i < vecCount / 2; ++i) {\r\n const first = i * 2;\r\n tempPos1.x = itemPos.x + vectors[first].x * itemRad;\r\n tempPos1.y = itemPos.y + vectors[first].y * itemRad;\r\n tempPos1.z = itemPos.z + vectors[first].z * itemRad;\r\n const second = first + 1;\r\n tempPos2.x = itemPos.x + vectors[second].x * itemRad;\r\n tempPos2.y = itemPos.y + vectors[second].y * itemRad;\r\n tempPos2.z = itemPos.z + vectors[second].z * itemRad;\r\n this.setSegment(itemIdx, i, tempPos1, tempPos2);\r\n }\r\n }\r\n}\r\nexport default CrossGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport RaycastableBufferGeometry from './RaycastableBufferGeometry';\r\n\r\nconst POS_RAD_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This is a base class for isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\nclass IsoSurfaceGeometry extends RaycastableBufferGeometry {\r\n constructor(spheresCount, opts) {\r\n super();\r\n\r\n this._opts = opts;\r\n this.zClip = this._opts.zClip;\r\n this._posRad = utils.allocateTyped(Float32Array, spheresCount * POS_RAD_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n }\r\n\r\n setItem(chunkIdx, pos, radius) {\r\n const posRad = this._posRad;\r\n let idx = POS_RAD_SIZE * chunkIdx;\r\n posRad[idx++] = pos.x;\r\n posRad[idx++] = pos.y;\r\n posRad[idx++] = pos.z;\r\n posRad[idx] = radius;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n let idx = COLOR_SIZE * chunkIdx;\r\n colors[idx++] = tmpColor.r;\r\n colors[idx++] = tmpColor.g;\r\n colors[idx] = tmpColor.b;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n finishUpdate() {\r\n this._build();\r\n }\r\n\r\n setOpacity() {\r\n // not implemented\r\n }\r\n\r\n raycast() {\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\nexport default IsoSurfaceGeometry;\r\n","import utils from '../../utils';\r\n\r\n/**\r\n * Class for marching cube\r\n * Stores 8 points and 8 float values are stored together in linear array\r\n * Int values for has intersection or not - in integer32 linear array\r\n * Int values for bits flags - in integer32 linear array\r\n *\r\n */\r\nclass IsoSurfaceMarchCube {\r\n constructor() {\r\n this.pointsValuesLinear = null;\r\n this.hasIntersection = null;\r\n this.bitsInside = null;\r\n }\r\n\r\n create(numCellsPerSide) {\r\n const vx7000000 = 0x7000000;\r\n const n3 = numCellsPerSide * numCellsPerSide * numCellsPerSide;\r\n if (n3 > vx7000000) {\r\n throw new Error('Too large cube dimension: lead to memory huge uasge');\r\n }\r\n this.pointsValuesLinear = utils.allocateTyped(Float32Array, (2 << (2 + 2)) * n3);\r\n this.hasIntersection = utils.allocateTyped(Int32Array, n3);\r\n this.bitsInside = utils.allocateTyped(Int32Array, n3);\r\n return 0;\r\n }\r\n\r\n destroy() {\r\n this.bitsInside = null;\r\n this.hasIntersection = null;\r\n this.pointsValuesLinear = null;\r\n }\r\n}\r\n\r\n/* eslint-disable no-magic-numbers */\r\nIsoSurfaceMarchCube.prototype.striIndicesMarchCube = [\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1,\r\n 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1,\r\n 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1,\r\n 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1,\r\n 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1,\r\n 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1,\r\n 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1,\r\n 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1,\r\n 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1,\r\n 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1,\r\n 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1,\r\n 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1,\r\n 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1,\r\n 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1,\r\n 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1,\r\n 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1,\r\n 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1,\r\n 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1,\r\n 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1,\r\n 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1,\r\n 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1,\r\n 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1,\r\n 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1,\r\n 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1,\r\n 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1,\r\n 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1,\r\n 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1,\r\n 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1,\r\n 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1,\r\n 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1,\r\n 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1,\r\n 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1,\r\n 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1,\r\n 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1,\r\n 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1,\r\n 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1,\r\n 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1,\r\n 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1,\r\n 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1,\r\n 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1,\r\n 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1,\r\n 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1,\r\n 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1,\r\n 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1,\r\n 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1,\r\n 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1,\r\n 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1,\r\n 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1,\r\n 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1,\r\n 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1,\r\n 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1,\r\n 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1,\r\n 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1,\r\n 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1,\r\n 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1,\r\n 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1,\r\n 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1,\r\n 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1,\r\n 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1,\r\n 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1,\r\n 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1,\r\n 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1,\r\n 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1,\r\n 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1,\r\n 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1,\r\n 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1,\r\n 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1,\r\n 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1,\r\n 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1,\r\n 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1,\r\n 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1,\r\n 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1,\r\n 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1,\r\n 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1,\r\n 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1,\r\n 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1,\r\n 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1,\r\n 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1,\r\n 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1,\r\n 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1,\r\n 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1,\r\n 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1,\r\n 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1,\r\n 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1,\r\n 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1,\r\n 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1,\r\n 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1,\r\n 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1,\r\n 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1,\r\n 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1,\r\n 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1,\r\n 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1,\r\n 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n];\r\n/* eslint-enable no-magic-numbers */\r\n\r\nexport default IsoSurfaceMarchCube;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport utils from '../../utils';\r\n\r\nconst edgeTable = [\r\n 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,\r\n 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,\r\n 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,\r\n 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,\r\n 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,\r\n 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,\r\n 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a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a3, 0x2a9, 0x3a0,\r\n 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,\r\n 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,\r\n 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,\r\n 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,\r\n 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,\r\n 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0];\r\n\r\nfunction _voxelGradientFast(v, point, grad) {\r\n const g = v.getValue(point.x, point.y, point.z);\r\n grad.set(g[0], g[1], g[2]);\r\n}\r\n\r\n// Helper class GridCell\r\nclass GridCell {\r\n constructor() {\r\n this._arrSize = 8;\r\n this.p = new Array(this._arrSize);\r\n this.g = new Array(this._arrSize);\r\n this.val = new Array(this._arrSize);\r\n for (let i = 0; i < this._arrSize; ++i) {\r\n this.p[i] = new THREE.Vector3();\r\n this.g[i] = new THREE.Vector3();\r\n }\r\n this.cubeIndex = 0;\r\n }\r\n}\r\n\r\n// Helper class Triangle\r\nclass Triangle {\r\n constructor() {\r\n this.a = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.b = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.c = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n }\r\n}\r\n\r\nfunction createArray(arrSize) {\r\n const arr = new Array(arrSize);\r\n for (let i = 0; i < arrSize; ++i) {\r\n arr[i] = new THREE.Vector3();\r\n }\r\n\r\n return arr;\r\n}\r\n\r\nclass IsoSurface {\r\n constructor() {\r\n this._numTriangles = 0;\r\n this._numVertices = 0;\r\n this._position = [];\r\n this._normals = [];\r\n this._colors = null;\r\n this._indices = [];\r\n this._volumetricData = null;\r\n this._xAxis = new THREE.Vector3();\r\n this._yAxis = new THREE.Vector3();\r\n this._zAxis = new THREE.Vector3();\r\n this._xDir = new THREE.Vector3();\r\n this._yDir = new THREE.Vector3();\r\n this._zDir = new THREE.Vector3();\r\n }\r\n\r\n _prepareAxesAndDirs() {\r\n const volData = this._volumetricData;\r\n\r\n const cellSize = volData.getCellSize();\r\n\r\n // calculate cell axes\r\n const xAxis = this._xAxis;\r\n const yAxis = this._yAxis;\r\n const zAxis = this._zAxis;\r\n const xDir = this._xDir;\r\n const yDir = this._yDir;\r\n const zDir = this._zDir;\r\n\r\n xAxis.set(cellSize.x, 0, 0);\r\n yAxis.set(0, cellSize.y, 0);\r\n zAxis.set(0, 0, cellSize.z);\r\n\r\n xDir.set(1, 0, 0);\r\n yDir.set(0, 1, 0);\r\n zDir.set(0, 0, 1);\r\n\r\n // flip normals if coordinate system is in the wrong handedness\r\n const tmp = new THREE.Vector3();\r\n tmp.crossVectors(xDir, yDir);\r\n if (tmp.dot(zDir) < 0) {\r\n xDir.negate();\r\n yDir.negate();\r\n zDir.negate();\r\n }\r\n\r\n // check that the grid is in the all-positive octant of the coordinate system\r\n if (xDir.x < 0 || xDir.y < 0 || xDir.z < 0\r\n || yDir.x < 0 || yDir.y < 0 || yDir.z < 0\r\n || zDir.x < 0 || zDir.y < 0 || zDir.z < 0) {\r\n return false;\r\n }\r\n\r\n // check that the grid is axis-aligned\r\n const notZero = (axe) => Math.abs(axe) > Number.EPSILON;\r\n return !(notZero(xAxis.y) || notZero(xAxis.z)\r\n || notZero(yAxis.x) || notZero(yAxis.z)\r\n || notZero(zAxis.x) || notZero(zAxis.y));\r\n }\r\n\r\n _vertexInterp(isoLevel, grid, ind1, ind2, vertex, normal) {\r\n const p1 = grid.p[ind1];\r\n const p2 = grid.p[ind2];\r\n const n1 = grid.g[ind1];\r\n const n2 = grid.g[ind2];\r\n const valP1 = grid.val[ind1];\r\n const valP2 = grid.val[ind2];\r\n const isoDiffP1 = isoLevel - valP1;\r\n const diffValP2P1 = valP2 - valP1;\r\n\r\n let mu = 0.0;\r\n\r\n if (Math.abs(diffValP2P1) > 0.0) {\r\n mu = isoDiffP1 / diffValP2P1;\r\n }\r\n mu = mu > 1.0 ? 1.0 : mu;\r\n vertex.lerpVectors(p1, p2, mu);\r\n normal.lerpVectors(n1, n2, mu);\r\n }\r\n\r\n static _triTable = IsoSurfaceMarchCube.prototype.striIndicesMarchCube;\r\n\r\n static _arrSize = 12;\r\n\r\n static _firstIndices = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3];\r\n\r\n static _secondIndices = [1, 2, 3, 0, 5, 6, 7, 4, 4, 5, 6, 7];\r\n\r\n static _vertexList = createArray(IsoSurface._arrSize);\r\n\r\n static _normalList = createArray(IsoSurface._arrSize);\r\n\r\n _polygonize(grid, isoLevel, triangles) {\r\n const { cubeIndex } = grid;\r\n let i = 0;\r\n const arrSize = IsoSurface._arrSize;\r\n const firstIndices = IsoSurface._firstIndices;\r\n const secondIndices = IsoSurface._secondIndices;\r\n const vertexList = IsoSurface._vertexList;\r\n const normalList = IsoSurface._normalList;\r\n\r\n for (; i < arrSize; ++i) {\r\n if (edgeTable[cubeIndex] & (1 << i)) {\r\n this._vertexInterp(\r\n isoLevel, grid,\r\n firstIndices[i],\r\n secondIndices[i],\r\n vertexList[i],\r\n normalList[i],\r\n );\r\n }\r\n }\r\n\r\n let triCount = 0;\r\n const triTblIdx = cubeIndex * 16;\r\n const triTable = IsoSurface._triTable;\r\n\r\n for (i = 0; triTable[triTblIdx + i] !== -1; i += 3) {\r\n triangles[triCount].a.p.copy(vertexList[triTable[triTblIdx + i]]);\r\n triangles[triCount].a.n.copy(normalList[triTable[triTblIdx + i]]);\r\n\r\n triangles[triCount].b.p.copy(vertexList[triTable[triTblIdx + i + 1]]);\r\n triangles[triCount].b.n.copy(normalList[triTable[triTblIdx + i + 1]]);\r\n\r\n triangles[triCount].c.p.copy(vertexList[triTable[triTblIdx + i + 2]]);\r\n triangles[triCount].c.n.copy(normalList[triTable[triTblIdx + i + 2]]);\r\n ++triCount;\r\n }\r\n\r\n return triCount;\r\n }\r\n\r\n _doGridPosNorms(isoValue, step, appendSimple) {\r\n const vol = this._volumetricData;\r\n const volData = this._volumetricData.getData();\r\n const dim = vol.getDimensions();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n const zSize = dim[2];\r\n const stepX = step * vol.getStrideX();\r\n const stepY = step * vol.getStrideY();\r\n const stepZ = step * vol.getStrideZ();\r\n\r\n const gc = new GridCell();\r\n const gcVal = gc.val;\r\n const gcValSize = gc.val.length;\r\n const additions = [\r\n new THREE.Vector3(0, 0, 0), // 0\r\n new THREE.Vector3(step, 0, 0), // 1\r\n new THREE.Vector3(step, step, 0), // 2\r\n new THREE.Vector3(0, step, 0), // 3\r\n new THREE.Vector3(0, 0, step), // 4\r\n new THREE.Vector3(step, 0, step), // 5\r\n new THREE.Vector3(step, step, step), // 6\r\n new THREE.Vector3(0, step, step), // 7\r\n ];\r\n\r\n const tmpTriCount = 5;\r\n const triangles = new Array(tmpTriCount);\r\n for (let j = 0; j < tmpTriCount; ++j) {\r\n triangles[j] = new Triangle();\r\n }\r\n\r\n\r\n let appendVertex;\r\n const self = this;\r\n const positions = this._position;\r\n const normals = this._normals;\r\n if (appendSimple) {\r\n // Special case for axis-aligned grid with positive unit vector normals\r\n appendVertex = (function () {\r\n const axis = new THREE.Vector3(self._xAxis.x, self._yAxis.y, self._zAxis.z);\r\n return function (triVertex) {\r\n const vertex = triVertex.p.clone();\r\n vertex.multiply(axis);\r\n positions.push(vertex.add(self._origin));\r\n normals.push(triVertex.n.clone());\r\n };\r\n }());\r\n } else {\r\n appendVertex = (function () {\r\n const posMtx = new THREE.Matrix3();\r\n posMtx.set(\r\n self._xAxis.x, self._yAxis.x, self._zAxis.x,\r\n self._xAxis.y, self._yAxis.y, self._zAxis.y,\r\n self._xAxis.z, self._yAxis.z, self._zAxis.z,\r\n );\r\n const normMtx = new THREE.Matrix3();\r\n normMtx.set(\r\n self._xDir.x, self._yDir.x, self._zDir.x,\r\n self._xDir.y, self._yDir.y, self._zDir.y,\r\n self._xDir.z, self._yDir.z, self._zDir.z,\r\n );\r\n\r\n return function (triVertex) {\r\n positions.push(triVertex.p.clone().applyMatrix3(posMtx).add(self._origin));\r\n normals.push(triVertex.n.clone().applyMatrix3(normMtx));\r\n };\r\n }());\r\n }\r\n const indices = this._indices;\r\n\r\n let globTriCount = 0;\r\n\r\n for (let z = 0; z < (zSize - step); z += step) {\r\n for (let y = 0; y < (ySize - step); y += step) {\r\n let idx = vol.getDirectIdx(0, y, z);\r\n for (let x = 0; x < (xSize - step); x += step, idx += stepX) {\r\n /* eslint-disable no-multi-spaces */\r\n /* eslint-disable computed-property-spacing */\r\n gcVal[0] = volData[idx];\r\n gcVal[1] = volData[idx + stepX];\r\n gcVal[3] = volData[idx + stepY];\r\n gcVal[2] = volData[idx + stepX + stepY];\r\n gcVal[4] = volData[idx + stepZ];\r\n gcVal[5] = volData[idx + stepX + stepZ];\r\n gcVal[7] = volData[idx + stepY + stepZ];\r\n gcVal[6] = volData[idx + stepX + stepY + stepZ];\r\n /* eslint-enable no-multi-spaces */\r\n /* eslint-enable computed-property-spacing */\r\n\r\n // Determine the index into the edge table which\r\n // tells us which vertices are inside of the surface\r\n let cubeIndex = 0;\r\n let i = 0;\r\n for (; i < gcValSize; ++i) {\r\n if (gcVal[i] < isoValue) {\r\n cubeIndex |= (1 << i);\r\n }\r\n }\r\n\r\n if (edgeTable[cubeIndex] === 0) {\r\n continue;\r\n }\r\n\r\n gc.cubeIndex = cubeIndex;\r\n for (i = 0; i < gcValSize; ++i) {\r\n gc.p[i].set(x + additions[i].x, y + additions[i].y, z + additions[i].z);\r\n _voxelGradientFast(this._gradient, gc.p[i], gc.g[i]);\r\n }\r\n\r\n // calculate vertices and facets for this cube,\r\n // calculate normals by interpolating between the negated\r\n // normalized volume gradients for the 8 reference voxels\r\n const triCount = this._polygonize(gc, isoValue, triangles);\r\n globTriCount += triCount;\r\n\r\n // append triangles using different techniques\r\n for (i = 0; i < triCount; ++i) {\r\n indices.push(this._numTriangles * 3);\r\n indices.push(this._numTriangles * 3 + 1);\r\n indices.push(this._numTriangles * 3 + 2);\r\n ++this._numTriangles;\r\n\r\n appendVertex(triangles[i].a);\r\n appendVertex(triangles[i].b);\r\n appendVertex(triangles[i].c);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return globTriCount;\r\n }\r\n\r\n compute(volData, origin, isoValue, step) {\r\n this._volumetricData = volData;\r\n this._origin = origin;\r\n\r\n this._gradient = volData.computeGradient();\r\n\r\n this._doGridPosNorms(isoValue, step, this._prepareAxesAndDirs());\r\n }\r\n\r\n _remapIndices(vertexMap, idcCount) {\r\n const indices = this._indices;\r\n const newIndices = utils.allocateTyped(Uint32Array, idcCount);\r\n for (let i = 0; i < idcCount; ++i) {\r\n indices[i] = vertexMap[indices[i]];\r\n newIndices[i] = indices[i];\r\n }\r\n this._indices = newIndices;\r\n }\r\n\r\n _remapVertices(vertices, normals, count) {\r\n const newPositions = utils.allocateTyped(Float32Array, count * 3);\r\n const newNormals = utils.allocateTyped(Float32Array, count * 3);\r\n for (let i = 0; i < count; ++i) {\r\n const pos = vertices[i];\r\n newPositions[i * 3] = pos.x;\r\n newPositions[i * 3 + 1] = pos.y;\r\n newPositions[i * 3 + 2] = pos.z;\r\n const norm = normals[i].normalize();\r\n newNormals[i * 3] = norm.x;\r\n newNormals[i * 3 + 1] = norm.y;\r\n newNormals[i * 3 + 2] = norm.z;\r\n }\r\n this._position = newPositions;\r\n this._normals = newNormals;\r\n }\r\n\r\n vertexFusion(offset, len) {\r\n const faceVer = this._indices.length;\r\n const vertices = this._position;\r\n const normals = this._normals;\r\n const oldVerCount = vertices.length | 0;\r\n if (faceVer === 0 || oldVerCount === 0) {\r\n return;\r\n }\r\n const vMap = utils.allocateTyped(Uint32Array, oldVerCount);\r\n vMap[0] = 0;\r\n let newVer = 1;\r\n\r\n let i = 1;\r\n for (; i < oldVerCount; ++i) {\r\n const start = newVer - offset < 0 ? 0 : newVer - offset;\r\n const end = start + len > newVer ? newVer : start + len;\r\n let matchedIndex = -1;\r\n\r\n for (let j = start; j < end; ++j) {\r\n if (Math.abs(vertices[i] - vertices[j]) < Number.EPSILON) {\r\n matchedIndex = j;\r\n break;\r\n }\r\n }\r\n\r\n if (matchedIndex !== -1) {\r\n vMap[i] = matchedIndex;\r\n } else {\r\n vertices[newVer].copy(vertices[i]);\r\n normals[newVer].copy(normals[i]);\r\n vMap[i] = newVer;\r\n ++newVer;\r\n }\r\n }\r\n\r\n this._remapIndices(vMap, faceVer);\r\n this._remapVertices(vertices, normals, newVer);\r\n }\r\n\r\n // Assign per-vertex colors from a volumetric texture map (same dimensions as the original volumetric data).\r\n // Along with color dominating atom is determined for each vertex\r\n // and vertices with atom out of \"visible\" subset get filtered out.\r\n // XXX only handles orthogonal volumes currently\r\n setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) {\r\n let i;\r\n let idx;\r\n const numVerts = this._position.length / 3;\r\n const vertices = this._position;\r\n const origin = this._origin;\r\n const dim = this._volumetricData.getDimensions();\r\n const xs = dim[0] - 1;\r\n const ys = dim[1] - 1;\r\n const zs = dim[2] - 1;\r\n\r\n const colorData = colorMap.getData();\r\n const strideX = colorMap.getStrideX();\r\n const strideY = colorMap.getStrideY();\r\n const strideZ = colorMap.getStrideZ();\r\n\r\n let atomWeightData;\r\n let atomStrideX;\r\n let atomStrideY;\r\n let atomStrideZ;\r\n\r\n if (visibilitySelector !== null) {\r\n atomWeightData = atomWeightMap.getData();\r\n atomStrideX = atomWeightMap.getStrideX();\r\n atomStrideY = atomWeightMap.getStrideY();\r\n atomStrideZ = atomWeightMap.getStrideZ();\r\n }\r\n\r\n const xInv = 1.0 / this._xAxis.x;\r\n const yInv = 1.0 / this._yAxis.y;\r\n const zInv = 1.0 / this._zAxis.z;\r\n\r\n let atomLookup = [];\r\n let atomWeights = [];\r\n const colors = utils.allocateTyped(Float32Array, numVerts * 3);\r\n\r\n function interp(mu, idx1, idx2, c) {\r\n c[0] = (1 - mu) * colorData[idx1] + mu * colorData[idx2];\r\n c[1] = (1 - mu) * colorData[idx1 + 1] + mu * colorData[idx2 + 1];\r\n c[2] = (1 - mu) * colorData[idx1 + 2] + mu * colorData[idx2 + 2];\r\n }\r\n\r\n function collectWeight(ai, coefX, coefY, coefZ) {\r\n const a = atomMap[ai]; // atomWeightMap is a scalar field, so index into atom map should be the same\r\n if (a != null) {\r\n atomLookup[a.index] = a;\r\n const w = coefX * coefY * coefZ * atomWeightData[ai];\r\n if (typeof atomWeights[a.index] === 'undefined') {\r\n atomWeights[a.index] = w;\r\n } else {\r\n atomWeights[a.index] += w;\r\n }\r\n }\r\n }\r\n\r\n const vMap = utils.allocateTyped(Int32Array, numVerts);\r\n let newVerCount = 0;\r\n\r\n for (i = 0; i < numVerts; i++) {\r\n const ind = i * 3;\r\n const vx = (vertices[ind] - origin.x) * xInv;\r\n const vy = (vertices[ind + 1] - origin.y) * yInv;\r\n const vz = (vertices[ind + 2] - origin.z) * zInv;\r\n const x = Math.min(Math.max(vx, 0), xs) | 0;\r\n const y = Math.min(Math.max(vy, 0), ys) | 0;\r\n const z = Math.min(Math.max(vz, 0), zs) | 0;\r\n\r\n const mux = (vx - x);\r\n const muy = (vy - y);\r\n const muz = (vz - z);\r\n\r\n if (visibilitySelector != null) {\r\n // collect atom weights\r\n atomLookup = [];\r\n atomWeights = [];\r\n idx = atomWeightMap.getDirectIdx(x, y, z);\r\n collectWeight(idx, 1 - mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideX, mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideY, 1 - mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideX + atomStrideY, mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideZ, 1 - mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideZ, mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideY + atomStrideZ, 1 - mux, muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideY + atomStrideZ, mux, muy, muz);\r\n\r\n // find dominant atom\r\n let maxWeight = 0.0;\r\n let dominantIdx = -1;\r\n for (const atomIdx in atomWeights) {\r\n if (atomWeights[atomIdx] > maxWeight) {\r\n dominantIdx = atomIdx;\r\n maxWeight = atomWeights[atomIdx];\r\n }\r\n }\r\n\r\n if (dominantIdx < 0 || !visibilitySelector.includesAtom(atomLookup[dominantIdx])) {\r\n // this vertex doesn't belong to visible subset and will be skipped\r\n vMap[i] = -1;\r\n continue;\r\n }\r\n }\r\n\r\n vMap[i] = newVerCount++;\r\n\r\n // color tri-linear interpolation\r\n const dx = (x < xs) ? strideX : 0;\r\n const dy = (y < ys) ? strideY : 0;\r\n const dz = (z < zs) ? strideZ : 0;\r\n\r\n const c0 = [0, 0, 0];\r\n const c1 = [0, 0, 0];\r\n const c2 = [0, 0, 0];\r\n const c3 = [0, 0, 0];\r\n\r\n idx = colorMap.getDirectIdx(x, y, z);\r\n interp(mux, idx, idx + dx, c0);\r\n interp(mux, idx + dy, idx + dx + dy, c1);\r\n interp(mux, idx + dz, idx + dx + dz, c2);\r\n interp(mux, idx + dy + dz, idx + dx + dy + dz, c3);\r\n\r\n const cz0 = [0, 0, 0];\r\n cz0[0] = (1 - muy) * c0[0] + muy * c1[0];\r\n cz0[1] = (1 - muy) * c0[1] + muy * c1[1];\r\n cz0[2] = (1 - muy) * c0[2] + muy * c1[2];\r\n\r\n const cz1 = [0, 0, 0];\r\n cz1[0] = (1 - muy) * c2[0] + muy * c3[0];\r\n cz1[1] = (1 - muy) * c2[1] + muy * c3[1];\r\n cz1[2] = (1 - muy) * c2[2] + muy * c3[2];\r\n\r\n colors[ind] = (1 - muz) * cz0[0] + muz * cz1[0];\r\n colors[ind + 1] = (1 - muz) * cz0[1] + muz * cz1[1];\r\n colors[ind + 2] = (1 - muz) * cz0[2] + muz * cz1[2];\r\n }\r\n this._colors = colors;\r\n\r\n if (visibilitySelector != null) {\r\n // shift visible vertices towards beginning of array\r\n for (i = 0; i < numVerts; ++i) {\r\n const j = vMap[i];\r\n if (j < 0) {\r\n continue;\r\n }\r\n\r\n // assert: j <= i\r\n this._position[j * 3] = this._position[i * 3];\r\n this._position[j * 3 + 1] = this._position[i * 3 + 1];\r\n this._position[j * 3 + 2] = this._position[i * 3 + 2];\r\n this._normals[j * 3] = this._normals[i * 3];\r\n this._normals[j * 3 + 1] = this._normals[i * 3 + 1];\r\n this._normals[j * 3 + 2] = this._normals[i * 3 + 2];\r\n this._colors[j * 3] = this._colors[i * 3];\r\n this._colors[j * 3 + 1] = this._colors[i * 3 + 1];\r\n this._colors[j * 3 + 2] = this._colors[i * 3 + 2];\r\n }\r\n\r\n // rebuild index list\r\n const numTriangles = this._indices.length / 3;\r\n let newTriCount = 0;\r\n for (i = 0; i < numTriangles; ++i) {\r\n const i0 = vMap[this._indices[3 * i]];\r\n const i1 = vMap[this._indices[3 * i + 1]];\r\n const i2 = vMap[this._indices[3 * i + 2]];\r\n if (i0 >= 0 && i1 >= 0 && i2 >= 0) {\r\n this._indices[3 * newTriCount] = i0;\r\n this._indices[3 * newTriCount + 1] = i1;\r\n this._indices[3 * newTriCount + 2] = i2;\r\n ++newTriCount;\r\n }\r\n }\r\n\r\n // shrink arrays to data size\r\n this._position = new Float32Array(this._position.buffer.slice(0, newVerCount * 3 * 4));\r\n this._normals = new Float32Array(this._normals.buffer.slice(0, newVerCount * 3 * 4));\r\n this._colors = new Float32Array(this._colors.buffer.slice(0, newVerCount * 3 * 4));\r\n this._indices = new Uint32Array(this._indices.buffer.slice(0, newTriCount * 3 * 4));\r\n }\r\n }\r\n\r\n toMesh() {\r\n const geo = new THREE.BufferGeometry();\r\n geo.setIndex(new THREE.BufferAttribute(this._indices, 1));\r\n geo.setAttribute('position', new THREE.BufferAttribute(this._position, 3));\r\n geo.setAttribute('normal', new THREE.BufferAttribute(this._normals, 3));\r\n geo.setAttribute('color', new THREE.BufferAttribute(this._colors, 3));\r\n geo.computeBoundingSphere();\r\n return geo;\r\n }\r\n}\r\nexport default IsoSurface;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurface from './IsoSurface';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * This is a base class for volumetric maps based isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass VolumeSurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n const params = this._opts;\r\n this.numVoxels = [128, 128, 128];\r\n this.xAxis = new THREE.Vector3(1.0, 0.0, 0.0);\r\n this.yAxis = new THREE.Vector3(0.0, 1.0, 0.0);\r\n this.zAxis = new THREE.Vector3(0.0, 0.0, 1.0);\r\n\r\n this.origin = new THREE.Vector3(0.0, 0.0, 0.0);\r\n this._visibilitySelector = params.visibilitySelector;\r\n\r\n this._calcSurface(params);\r\n }\r\n\r\n _findMinMax(posRadArray) {\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n const maxPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n const minPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n for (let i = 1; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n for (let itemIdx = 0; itemIdx < itemSize; ++itemIdx) {\r\n const tmpVal = posRadArray[ind + itemIdx];\r\n maxPosRad[itemIdx] = Math.max(tmpVal, maxPosRad[itemIdx]);\r\n minPosRad[itemIdx] = Math.min(tmpVal, minPosRad[itemIdx]);\r\n }\r\n }\r\n return { maxPosRad, minPosRad };\r\n }\r\n\r\n _findNumVoxels(posRadArray, params) {\r\n const { numVoxels } = this;\r\n const minMaxValues = this._findMinMax(posRadArray);\r\n const minCoordRad = minMaxValues.minPosRad;\r\n const maxCoordRad = minMaxValues.maxPosRad;\r\n\r\n // minrad\r\n if (minCoordRad[3] > 4.0) {\r\n params.gridSpacing *= minCoordRad[3];\r\n }\r\n\r\n let gridPadding = params.radScale * maxCoordRad[3] * 1.7;\r\n let padRad = gridPadding;\r\n padRad = 0.65 * Math.sqrt(4.0 / 3.0 * Math.PI * padRad * padRad * padRad);\r\n gridPadding = Math.max(gridPadding, padRad);\r\n\r\n let i = 0;\r\n for (; i < 3; ++i) {\r\n minCoordRad[i] -= gridPadding;\r\n maxCoordRad[i] += gridPadding;\r\n }\r\n\r\n for (i = 0; i < 3; ++i) {\r\n numVoxels[i] = Math.ceil((maxCoordRad[i] - minCoordRad[i]) / params.gridSpacing);\r\n }\r\n this.xAxis.x = (numVoxels[0] - 1) * params.gridSpacing;\r\n this.yAxis.y = (numVoxels[1] - 1) * params.gridSpacing;\r\n this.zAxis.z = (numVoxels[2] - 1) * params.gridSpacing;\r\n\r\n [this.origin.x, this.origin.y, this.origin.z] = minCoordRad;\r\n\r\n return { bbox: minMaxValues, dim: numVoxels };\r\n }\r\n\r\n _makeSurface(surface, params) {\r\n const isoSurf = new IsoSurface();\r\n isoSurf.compute(surface.volMap, this.origin, params.isoValue, 1);\r\n isoSurf.vertexFusion(9, 9);// normalization is included\r\n\r\n if (isoSurf._numTriangles > 0) {\r\n isoSurf.setColorVolTex(surface.volTexMap, surface.atomMap, surface.atomWeightMap, this._visibilitySelector);\r\n this.setIndex(new THREE.BufferAttribute(isoSurf._indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(isoSurf._position, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(isoSurf._normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(isoSurf._colors, 3));\r\n } else { // geometry should have at least empty position attributes to be processed in wireframe mode by three.js\r\n this.setAttribute('position', new THREE.BufferAttribute(utils.allocateTyped(Float32Array, 0), 3));\r\n }\r\n }\r\n\r\n _calcSurface(params) {\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n\r\n if (packedArrays.posRad.length === 0) {\r\n return;\r\n }\r\n const boundaries = this._findNumVoxels(packedArrays.posRad, params);\r\n\r\n const box = new THREE.Box3(\r\n this.origin,\r\n new THREE.Vector3(this.xAxis.x, this.yAxis.y, this.zAxis.z).add(this.origin),\r\n );\r\n const surface = this._computeSurface(packedArrays, box, boundaries, params);\r\n\r\n this._makeSurface(surface, params);\r\n }\r\n}\r\n\r\nexport default VolumeSurfaceGeometry;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass QuickSurfGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n // beware of shifting this multiple times!\r\n this._shiftByOrigin(packedArrays.posRad);\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3),\r\n };\r\n\r\n if (this._visibilitySelector != null) {\r\n surface.atomMap = [];\r\n surface.atomWeightMap = new Volume(Float32Array, this.numVoxels, box);\r\n }\r\n\r\n this.gaussdensity(surface, packedArrays, null, params);\r\n return surface;\r\n }\r\n\r\n gaussdensity(surface, packedArrays, atomicNum, params) {\r\n const numAtoms = packedArrays.posRad.length / 4;\r\n const { posRad, colors } = packedArrays;\r\n const { numVoxels } = this;\r\n const { radScale, gaussLim, gridSpacing } = params;\r\n const invIsoValue = 1.0 / params.isoValue;\r\n const invGridSpacing = 1.0 / gridSpacing;\r\n const maxVoxelX = numVoxels[0] - 1;\r\n const maxVoxelY = numVoxels[1] - 1;\r\n const maxVoxelZ = numVoxels[2] - 1;\r\n // TODO is densityMap and volTexMap initialized?\r\n\r\n const { volMap, volTexMap } = surface;\r\n const volData = volMap.getData();\r\n const strideX = volMap.getStrideX();\r\n\r\n const volTexData = volTexMap.getData();\r\n const texStrideX = volTexMap.getStrideX();\r\n\r\n let atomWeightData;\r\n if (this._visibilitySelector != null) {\r\n atomWeightData = surface.atomWeightMap.getData();\r\n }\r\n\r\n const { atomMap } = surface;\r\n\r\n for (let i = 0; i < numAtoms; ++i) {\r\n const ind = i * 4;\r\n const scaledRad = posRad[ind + 3] * radScale;\r\n const atomicNumFactor = atomicNum === null ? 1.0 : atomicNum[i];\r\n const radInv = 1 / (2 * scaledRad * scaledRad);\r\n let radLim = gaussLim * scaledRad;\r\n const radLim2 = radLim * radLim;\r\n radLim *= invGridSpacing;\r\n\r\n let tmp = posRad[ind] * invGridSpacing;\r\n const xMin = Math.max((tmp - radLim) | 0, 0);\r\n const xMax = Math.min((tmp + radLim) | 0, maxVoxelX);\r\n tmp = posRad[ind + 1] * invGridSpacing;\r\n const yMin = Math.max((tmp - radLim) | 0, 0);\r\n const yMax = Math.min((tmp + radLim) | 0, maxVoxelY);\r\n tmp = posRad[ind + 2] * invGridSpacing;\r\n const zMin = Math.max((tmp - radLim) | 0, 0);\r\n const zMax = Math.min((tmp + radLim) | 0, maxVoxelZ);\r\n\r\n let dz = zMin * gridSpacing - posRad[ind + 2];\r\n for (let z = zMin; z <= zMax; ++z, dz += gridSpacing) {\r\n let dy = yMin * gridSpacing - posRad[ind + 1];\r\n for (let y = yMin; y <= yMax; ++y, dy += gridSpacing) {\r\n const dy2dz2 = dy * dy + dz * dz;\r\n\r\n if (dy2dz2 >= radLim2) {\r\n continue;\r\n }\r\n\r\n let addr = volMap.getDirectIdx(xMin, y, z);\r\n let texAddr = volTexMap.getDirectIdx(xMin, y, z);\r\n let dx = xMin * gridSpacing - posRad[ind];\r\n for (let x = xMin; x <= xMax; ++x, dx += gridSpacing, addr += strideX, texAddr += texStrideX) {\r\n const r2 = dx * dx + dy2dz2;\r\n const expVal = -r2 * radInv;\r\n\r\n let density = Math.exp(expVal) * atomicNumFactor;\r\n\r\n // store most relevant atom (with highest density)\r\n if (this._visibilitySelector != null\r\n && density > atomWeightData[addr]) { // NOSONAR\r\n atomWeightData[addr] = density;\r\n // we use same index into atom map and atomWeightMap\r\n atomMap[addr] = packedArrays.atoms[i];\r\n }\r\n\r\n volData[addr] += density;\r\n\r\n // TODO check for volTexMap routine?\r\n density *= invIsoValue;\r\n const colInd = i * 3;\r\n volTexData[texAddr] += density * colors[colInd];\r\n volTexData[texAddr + 1] += density * colors[colInd + 1];\r\n volTexData[texAddr + 2] += density * colors[colInd + 2];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n _shiftByOrigin(posRadArray) {\r\n const originX = this.origin.x;\r\n const originY = this.origin.y;\r\n const originZ = this.origin.z;\r\n\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n for (let i = 0; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n posRadArray[ind] -= originX;\r\n posRadArray[ind + 1] -= originY;\r\n posRadArray[ind + 2] -= originZ;\r\n }\r\n }\r\n}\r\n\r\nexport default QuickSurfGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * Modifed from SpatialHash\r\n *\r\n * Main differences are:\r\n * - Optimized grid size to ensure we only ever need to look +/-1 cell\r\n * - Aware of atomic radii and will only output atoms within rAtom + rExtra\r\n * (see withinRadii method)\r\n *\r\n * (Uses rounding rather than bitshifting as consequence of arbitrary grid size)\r\n * @class\r\n * @param {Float32Array} posRad - x, y, z coordinates and radiuses\r\n * @param {Float32Array} min - xyz min coordinates\r\n * @param {Float32Array} max - xyz max coordinates\r\n * @param {number} maxDistance - max distance\r\n */\r\nfunction AVHash(posRad, min, max, maxDistance) {\r\n const itemSize = 4;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const minX = min[0];\r\n const minY = min[1];\r\n const minZ = min[2];\r\n\r\n const maxX = max[0];\r\n const maxY = max[1];\r\n const maxZ = max[2];\r\n\r\n function hashFunc(w, minW) {\r\n return Math.floor((w - minW) / maxDistance);\r\n }\r\n\r\n const iDim = hashFunc(maxX, minX) + 1;\r\n const jDim = hashFunc(maxY, minY) + 1;\r\n const kDim = hashFunc(maxZ, minZ) + 1;\r\n\r\n const nCells = iDim * jDim * kDim;\r\n\r\n const jkDim = jDim * kDim;\r\n\r\n\r\n /* Get cellID for cartesian x,y,z */\r\n const cellID = function (x, y, z) {\r\n return (((hashFunc(x, minX) * jDim) + hashFunc(y, minY)) * kDim) + hashFunc(z, minZ);\r\n };\r\n\r\n\r\n /* Initial building, could probably be optimized further */\r\n const preHash = [];\r\n let i;\r\n let cid;\r\n for (i = 0; i < nAtoms; i++) {\r\n const iIdx = itemSize * i;\r\n cid = cellID(posRad[iIdx], posRad[iIdx + 1], posRad[iIdx + 2]);\r\n\r\n if (preHash[cid] === undefined) {\r\n preHash[cid] = [i];\r\n } else {\r\n preHash[cid].push(i);\r\n }\r\n }\r\n\r\n const cellOffsets = utils.allocateTyped(Uint32Array, nCells);\r\n const cellLengths = utils.allocateTyped(Uint16Array, nCells);\r\n const data = utils.allocateTyped(Uint32Array, nAtoms);\r\n\r\n let offset = 0;\r\n let maxCellLength = 0;\r\n let j;\r\n for (i = 0; i < nCells; i++) {\r\n const start = cellOffsets[i] = offset;\r\n\r\n const subArray = preHash[i];\r\n\r\n if (subArray !== undefined) {\r\n for (j = 0; j < subArray.length; j++) {\r\n data[offset] = subArray[j];\r\n offset++;\r\n }\r\n }\r\n\r\n const cellLength = offset - start;\r\n cellLengths[i] = cellLength;\r\n\r\n if (cellLength > maxCellLength) {\r\n maxCellLength = cellLength;\r\n }\r\n }\r\n\r\n // Maximum number of neighbours we could ever produce (27 adjacent cells of equal population)\r\n this.neighbourListLength = (27 * maxCellLength) + 1;\r\n\r\n /**\r\n * Populate the supplied out array with atom indices that are within rAtom + rExtra\r\n * of x,y,z\r\n *\r\n * -1 in out array indicates the end of the list\r\n *\r\n * @param {number} x - x coordinate\r\n * @param {number} y - y coordinate\r\n * @param {number} z - z coordinate\r\n * @param {number} rExtra - additional radius\r\n * @param {Float32Array} out - pre-allocated output array\r\n * @return {undefined}\r\n */\r\n this.withinRadii = function (x, y, z, rExtra, out) {\r\n let outIdx = 0;\r\n\r\n const nearI = hashFunc(x, minX);\r\n const nearJ = hashFunc(y, minY);\r\n const nearK = hashFunc(z, minZ);\r\n\r\n const loI = Math.max(0, nearI - 1);\r\n const loJ = Math.max(0, nearJ - 1);\r\n const loK = Math.max(0, nearK - 1);\r\n\r\n const hiI = Math.min(iDim - 1, nearI + 1);\r\n const hiJ = Math.min(jDim - 1, nearJ + 1);\r\n const hiK = Math.min(kDim - 1, nearK + 1);\r\n\r\n for (i = loI; i <= hiI; ++i) {\r\n const iOffset = i * jkDim;\r\n\r\n for (j = loJ; j <= hiJ; ++j) {\r\n const jOffset = j * kDim;\r\n\r\n for (let k = loK; k <= hiK; ++k) {\r\n cid = iOffset + jOffset + k;\r\n\r\n const cellStart = cellOffsets[cid];\r\n const cellEnd = cellStart + cellLengths[cid];\r\n\r\n for (let dataIndex = cellStart; dataIndex < cellEnd; dataIndex++) {\r\n const atomIndex = data[dataIndex];\r\n const baseIndex = itemSize * atomIndex;\r\n const dx = posRad[baseIndex] - x;\r\n const dy = posRad[baseIndex + 1] - y;\r\n const dz = posRad[baseIndex + 2] - z;\r\n const rSum = posRad[baseIndex + 3] + rExtra;\r\n\r\n if ((dx * dx + dy * dy + dz * dz) <= (rSum * rSum)) {\r\n out[outIdx++] = data[dataIndex];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Add terminator\r\n out[outIdx] = -1;\r\n };\r\n}\r\nfunction ContactSurface(packedArrays, boundaries, params, _indexList) {\r\n // Field generation method adapted from AstexViewer (Mike Hartshorn)\r\n // by Fred Ludlow.\r\n // Other parts based heavily on NGL (Alexander Rose) EDT Surface class\r\n //\r\n // Should work as a drop-in alternative to EDTSurface (though some of\r\n // the EDT paramters are not relevant in this method).\r\n\r\n const itemSize = 4;\r\n const { posRad, colors, atoms } = packedArrays;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const { bbox } = boundaries;\r\n\r\n const min = bbox.minPosRad;\r\n const max = bbox.maxPosRad;\r\n\r\n let r2; // Atom positions, expanded radii (squared)\r\n let maxRadius;\r\n\r\n // Parameters\r\n let probeRadius;\r\n let scaleFactor;\r\n let probePositions;\r\n\r\n // Cache last value for obscured test\r\n let lastClip = -1;\r\n\r\n // Grid params\r\n let dim;\r\n let grid;\r\n let volTex;\r\n let weights;\r\n let weightsMap = null;\r\n let atomMap = null;\r\n let visibilitySelector = null;\r\n\r\n\r\n // grid indices -> xyz coords\r\n let gridx;\r\n let gridy;\r\n let gridz;\r\n\r\n // Lookup tables:\r\n let sinTable;\r\n let cosTable;\r\n\r\n // Spatial Hash\r\n let hash;\r\n\r\n // Neighbour array to be filled by hash\r\n let neighbours;\r\n\r\n // Vectors for Torus Projection\r\n const mid = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n1 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n2 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n let ngTorus;\r\n\r\n function uniformArray(TypeName, n, a) {\r\n const array = utils.allocateTyped(TypeName, n);\r\n for (let innI = 0; innI < n; ++innI) {\r\n array[innI] = a;\r\n }\r\n\r\n return array;\r\n }\r\n\r\n function fillGridDim(a, start, step) {\r\n for (let innI = 0; innI < a.length; innI++) {\r\n a[innI] = start + (step * innI);\r\n }\r\n }\r\n\r\n function initializeGrid() {\r\n ({ scaleFactor } = params);\r\n ({ dim } = boundaries);\r\n\r\n ngTorus = Math.min(5, 2 + Math.floor(probeRadius * scaleFactor));\r\n\r\n const gridSize = dim[0] * dim[1] * dim[2];\r\n grid = uniformArray(Float32Array, gridSize, -1001.0);\r\n volTex = utils.allocateTyped(Float32Array, gridSize * 3);\r\n weights = utils.allocateTyped(Float32Array, gridSize);\r\n if (visibilitySelector) {\r\n weightsMap = utils.allocateTyped(Float32Array, gridSize);\r\n atomMap = [];\r\n }\r\n\r\n\r\n gridx = utils.allocateTyped(Float32Array, dim[0]);\r\n gridy = utils.allocateTyped(Float32Array, dim[1]);\r\n gridz = utils.allocateTyped(Float32Array, dim[2]);\r\n\r\n fillGridDim(gridx, min[0], 1 / scaleFactor);\r\n fillGridDim(gridy, min[1], 1 / scaleFactor);\r\n fillGridDim(gridz, min[2], 1 / scaleFactor);\r\n }\r\n\r\n function initializeAngleTables() {\r\n let theta = 0.0;\r\n const step = 2 * Math.PI / probePositions;\r\n\r\n cosTable = utils.allocateTyped(Float32Array, probePositions);\r\n sinTable = utils.allocateTyped(Float32Array, probePositions);\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n cosTable[innI] = Math.cos(theta);\r\n sinTable[innI] = Math.sin(theta);\r\n theta += step;\r\n }\r\n }\r\n\r\n function initializeHash() {\r\n hash = new AVHash(posRad, min, max, 2.01 * maxRadius);\r\n neighbours = new Int32Array(hash.neighbourListLength);\r\n }\r\n\r\n function init() {\r\n ({\r\n probeRadius,\r\n scaleFactor,\r\n probePositions,\r\n visibilitySelector,\r\n } = params);\r\n r2 = utils.allocateTyped(Float32Array, nAtoms);\r\n maxRadius = 0;\r\n for (let innI = 0; innI < nAtoms; ++innI) {\r\n const rExt = posRad[innI * itemSize + 3] += probeRadius;\r\n if (rExt > maxRadius) {\r\n maxRadius = rExt;\r\n }\r\n r2[innI] = rExt * rExt;\r\n }\r\n\r\n initializeGrid();\r\n initializeAngleTables();\r\n initializeHash();\r\n\r\n lastClip = -1;\r\n }\r\n\r\n function singleAtomObscures(ai, innX, innY, innZ) {\r\n const innCI = itemSize * ai;\r\n const ra2 = r2[ai];\r\n const dx = posRad[innCI] - innX;\r\n const dy = posRad[innCI + 1] - innY;\r\n const dz = posRad[innCI + 2] - innZ;\r\n const d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n return d2 < ra2;\r\n }\r\n\r\n function obscured(innX, innY, innZ, a, b) {\r\n // Is the point at x,y,z obscured by any of the atoms\r\n // specifeid by indices in neighbours. Ignore indices\r\n // a and b (these are the relevant atoms in projectPoints/Torii)\r\n\r\n // Cache the last clipped atom (as very often the same one in\r\n // subsequent calls)\r\n let ai;\r\n\r\n if (lastClip !== -1) {\r\n ai = lastClip;\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n return ai;\r\n }\r\n lastClip = -1;\r\n }\r\n\r\n let ni = 0;\r\n ai = neighbours[ni];\r\n while (ai >= 0) {\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n lastClip = ai;\r\n return ai;\r\n }\r\n ai = neighbours[++ni];\r\n }\r\n\r\n lastClip = -1;\r\n\r\n return -1;\r\n }\r\n\r\n function projectPoints() {\r\n // For each atom:\r\n // Iterate over a subsection of the grid, for each point:\r\n // If current value < 0.0, unvisited, set positive\r\n //\r\n // In any case: Project this point onto surface of the atomic sphere\r\n // If this projected point is not obscured by any other atom\r\n // Calcualte delta distance and set grid value to minimum of\r\n // itself and delta\r\n\r\n // Should we alias frequently accessed closure constiables??\r\n // Assume JS engine capable of optimizing this\r\n // anyway...\r\n const maxRad = 4.0;\r\n const sigma = (maxRad) / 3;\r\n const sigma2Inv = 1 / (2 * sigma * sigma);\r\n\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innCI = itemSize * innI;\r\n const ax = posRad[innCI];\r\n const ay = posRad[innCI + 1];\r\n const az = posRad[innCI + 2];\r\n const ar = posRad[innCI + 3];\r\n const ar2 = r2[innI];\r\n\r\n hash.withinRadii(ax, ay, az, ar, neighbours);\r\n\r\n // Number of grid points, round this up...\r\n const ng = Math.ceil(ar * scaleFactor);\r\n\r\n // Center of the atom, mapped to grid points (take floor)\r\n const iax = Math.floor(scaleFactor * (ax - min[0]));\r\n const iay = Math.floor(scaleFactor * (ay - min[1]));\r\n const iaz = Math.floor(scaleFactor * (az - min[2]));\r\n\r\n // Extents of grid to consider for this atom\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n // Add two to these points:\r\n // - iax are floor'd values so this ensures coverage\r\n // - these are loop limits (exclusive)\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n const colIdx = innI * 3;\r\n const cr = colors[colIdx];\r\n const cg = colors[colIdx + 1];\r\n const cb = colors[colIdx + 2];\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n const dz = gridz[iz] - az;\r\n const zOffset = dim[1] * dim[0] * iz;\r\n\r\n for (let iy = miny; iy < maxy; iy++) {\r\n const dy = gridy[iy] - ay;\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n\r\n for (let ix = minx; ix < maxx; ix++) {\r\n const idx = ix + zyOffset;\r\n const dx = gridx[ix] - ax;\r\n const d2 = dzy2 + dx * dx;\r\n\r\n\r\n if (d2 < ar2) {\r\n const w = Math.exp(-d2 * sigma2Inv);\r\n const cIdx = idx * 3;\r\n volTex[cIdx] += cr * w;\r\n volTex[cIdx + 1] += cg * w;\r\n volTex[cIdx + 2] += cb * w;\r\n weights[idx] += w;\r\n if (visibilitySelector !== null && w > weightsMap[idx]) {\r\n weightsMap[idx] = w;\r\n atomMap[idx] = atoms[innI];\r\n }\r\n\r\n if (grid[idx] < 0.0) {\r\n // Unvisited, make positive\r\n grid[idx] = -grid[idx];\r\n }\r\n // Project on to the surface of the sphere\r\n // sp is the projected point ( dx, dy, dz ) * ( ra / d )\r\n const d = Math.sqrt(d2);\r\n const ap = ar / d;\r\n let spx = dx * ap;\r\n let spy = dy * ap;\r\n let spz = dz * ap;\r\n\r\n spx += ax;\r\n spy += ay;\r\n spz += az;\r\n\r\n if (obscured(spx, spy, spz, innI, -1) === -1) {\r\n const dd = ar - d;\r\n if (dd < grid[idx]) {\r\n grid[idx] = dd;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function normalToLine(out, p) {\r\n out.x = out.y = out.z = 1.0;\r\n if (p.x !== 0) {\r\n out.x = (p.y + p.z) / -p.x;\r\n } else if (p.y !== 0) {\r\n out.y = (p.x + p.z) / -p.y;\r\n } else if (p.z !== 0) {\r\n out.z = (p.x + p.y) / -p.z;\r\n }\r\n return out;\r\n }\r\n\r\n function projectTorus(a, b) {\r\n const aIdx = itemSize * a;\r\n const bIdx = itemSize * b;\r\n const xa = posRad[aIdx];\r\n const ya = posRad[aIdx + 1];\r\n const za = posRad[aIdx + 2];\r\n const r1 = posRad[aIdx + 3];\r\n let dx = mid.x = posRad[bIdx] - xa;\r\n let dy = mid.y = posRad[bIdx + 1] - ya;\r\n let dz = mid.z = posRad[bIdx + 2] - za;\r\n const innR2 = posRad[bIdx + 3];\r\n let d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n // This check now redundant as already done in AVHash.withinRadii\r\n // if( d2 > (( r1 + r2 ) * ( r1 + r2 )) ){ return; }\r\n\r\n const d = Math.sqrt(d2);\r\n\r\n // Find angle between a->b vector and the circle\r\n // of their intersection by cosine rule\r\n const cosA = (r1 * r1 + d * d - innR2 * innR2) / (2.0 * r1 * d);\r\n\r\n // distance along a->b at intersection\r\n const dmp = r1 * cosA;\r\n\r\n mid.normalize();\r\n\r\n // Create normal to line\r\n normalToLine(n1, mid);\r\n n1.normalize();\r\n\r\n // Cross together for second normal vector\r\n n2.crossVectors(mid, n1);\r\n n2.normalize();\r\n\r\n // r is radius of circle of intersection\r\n const rInt = Math.sqrt(r1 * r1 - dmp * dmp);\r\n\r\n n1.multiplyScalar(rInt);\r\n n2.multiplyScalar(rInt);\r\n mid.multiplyScalar(dmp);\r\n\r\n mid.x += xa;\r\n mid.y += ya;\r\n mid.z += za;\r\n\r\n lastClip = -1;\r\n\r\n const ng = ngTorus;\r\n\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n const cost = cosTable[innI];\r\n const sint = sinTable[innI];\r\n\r\n const px = mid.x + cost * n1.x + sint * n2.x;\r\n const py = mid.y + cost * n1.y + sint * n2.y;\r\n const pz = mid.z + cost * n1.z + sint * n2.z;\r\n\r\n if (obscured(px, py, pz, a, b) === -1) {\r\n // As above, iterate over our grid...\r\n // px, py, pz in grid coords\r\n const iax = Math.floor(scaleFactor * (px - min[0]));\r\n const iay = Math.floor(scaleFactor * (py - min[1]));\r\n const iaz = Math.floor(scaleFactor * (pz - min[2]));\r\n\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n dz = pz - gridz[iz];\r\n const zOffset = dim[1] * dim[0] * iz;\r\n for (let iy = miny; iy < maxy; iy++) {\r\n dy = py - gridy[iy];\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n for (let ix = minx; ix < maxx; ix++) {\r\n dx = px - gridx[ix];\r\n d2 = dzy2 + dx * dx;\r\n const idx = ix + zyOffset;\r\n const current = grid[idx];\r\n\r\n if (current > 0.0 && d2 < (current * current)) {\r\n grid[idx] = Math.sqrt(d2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function projectTorii() {\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innIdx = itemSize * innI;\r\n hash.withinRadii(\r\n posRad[innIdx], posRad[innIdx + 1], posRad[innIdx + 2],\r\n posRad[innIdx + 3], neighbours,\r\n );\r\n let ia = 0;\r\n let ni = neighbours[ia];\r\n while (ni >= 0) {\r\n if (innI < ni) {\r\n projectTorus(innI, ni);\r\n }\r\n ni = neighbours[++ia];\r\n }\r\n }\r\n }\r\n\r\n function fixNegatives() {\r\n for (let innI = 0, n = grid.length; innI < n; innI++) {\r\n if (grid[innI] < 0) grid[innI] = 0;\r\n let w = weights[innI];\r\n if (w > 0) {\r\n w = 1 / w;\r\n const innInnI = innI * 3;\r\n volTex[innInnI] *= w;\r\n volTex[innInnI + 1] *= w;\r\n volTex[innInnI + 2] *= w;\r\n }\r\n }\r\n }\r\n\r\n function getVolume() {\r\n // Basic steps are:\r\n // 1) Initialize\r\n // 2) Project points\r\n // 3) Project torii\r\n console.time('ContactSurface.getVolume');\r\n\r\n console.time('ContactSurface.init');\r\n init();\r\n console.timeEnd('ContactSurface.init');\r\n\r\n console.time('ContactSurface.projectPoints');\r\n projectPoints();\r\n console.timeEnd('ContactSurface.projectPoints');\r\n\r\n console.time('ContactSurface.projectTorii');\r\n projectTorii();\r\n console.timeEnd('ContactSurface.projectTorii');\r\n fixNegatives();\r\n console.timeEnd('ContactSurface.getVolume');\r\n }\r\n\r\n this.build = function () {\r\n // type and cutoff left in for compatibility with EDTSurface.getSurface\r\n // function signature\r\n getVolume();\r\n this.volTexMap = volTex;\r\n this.weightsMap = weightsMap;\r\n this.atomMap = atomMap;\r\n this.volMap = grid;\r\n };\r\n}\r\nexport default ContactSurface;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport ContactSurface from './ContactSurface';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'contact' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass ContactSurfaceGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n const contactSurface = new ContactSurface(packedArrays, boundaries, params);\r\n contactSurface.build();\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.volMap),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3, contactSurface.volTexMap),\r\n atomMap: contactSurface.atomMap,\r\n atomWeightMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.weightsMap),\r\n };\r\n return surface;\r\n }\r\n}\r\n\r\nexport default ContactSurfaceGeometry;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for colored atom. Need for atom structure clusterization\r\n *\r\n * @param {Vector3} vCenter Center of atom\r\n * @param {number} radiusAt Radius of atom\r\n */\r\nclass IsoSurfaceAtomColored {\r\n constructor(vCenter, radiusAt) {\r\n this.coord = new THREE.Vector3();\r\n this.coord.copy(vCenter);\r\n this.radius = radiusAt;\r\n this.colorX = 0.99999;\r\n this.colorY = 0.0;\r\n this.colorZ = 0.0;\r\n this.atomType = 0;\r\n this.srcAtom = null;\r\n }\r\n}\r\nexport default IsoSurfaceAtomColored;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n// suppress some JSHint warnings\r\n/* jshint bitwise: false */\r\n\r\n/**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numAtoms - Number of atoms in molecule\r\n * @param {Element} atoms - Array of atoms\r\n * @param {Vector3} vBoxMin - Bounding box min\r\n * @param {Vector3} vBoxMax - Bounding box max\r\n * @param {number} probeRadius - Normals for output\r\n *\r\n */\r\nclass IsosurfaceBuildNormals {\r\n constructor(numAtoms, atoms, vBoxMin, vBoxMax, probeRadius) {\r\n this._numAtoms = numAtoms;\r\n this._atoms = atoms;\r\n this._vBoxMin = new THREE.Vector3();\r\n this._vBoxMax = new THREE.Vector3();\r\n this._vBoxMin.copy(vBoxMin);\r\n this._vBoxMax.copy(vBoxMax);\r\n this._probeRadius = probeRadius;\r\n\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n }\r\n\r\n createVoxels() {\r\n let numAtomsRefs;\r\n let rad;\r\n const ATOM_VOXEL_REF_SCALE = 4.5;\r\n\r\n const numAtoms = this._numAtoms | 0;\r\n const atoms = this._atoms;\r\n const dx = this._vBoxMax.x - this._vBoxMin.x;\r\n const dy = this._vBoxMax.y - this._vBoxMin.y;\r\n const dz = this._vBoxMax.z - this._vBoxMin.z;\r\n let w = (dx < dy) ? dx : dy;\r\n w = (dz < w) ? dz : w;\r\n let maxRad = 0.0;\r\n let aveRad = 0.0;\r\n\r\n let i;\r\n for (i = 0; i < numAtoms; i++) {\r\n rad = (atoms[i].radius + this._probeRadius) * 2.0;\r\n maxRad = (rad > maxRad) ? rad : maxRad;\r\n aveRad += rad;\r\n }\r\n let numCells = Math.floor(w / maxRad);\r\n if (numCells < 2) {\r\n numCells = 2;\r\n }\r\n aveRad /= numAtoms;\r\n\r\n this._numCells = numCells;\r\n this._aveRad = aveRad;\r\n this._maxRad = maxRad;\r\n\r\n const side = numCells;\r\n const side2 = numCells * numCells;\r\n const side3 = numCells * numCells * numCells;\r\n\r\n const xScale = this._xScale = 1.0 / (this._vBoxMax.x - this._vBoxMin.x);\r\n const yScale = this._yScale = 1.0 / (this._vBoxMax.y - this._vBoxMin.y);\r\n const zScale = this._zScale = 1.0 / (this._vBoxMax.z - this._vBoxMin.z);\r\n\r\n // estimate number of individual atom refs in each voxel list\r\n let maxAtomsRefs = 0;\r\n\r\n const xNumVoxMult = xScale * numCells;\r\n const yNumVoxMult = yScale * numCells;\r\n const zNumVoxMult = zScale * numCells;\r\n\r\n for (i = 0; i < numAtoms; i++) {\r\n const radAffect = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n const diaAffect = radAffect * 2.0;\r\n let numVoxX = Math.floor(xNumVoxMult * diaAffect + 0.8);\r\n let numVoxY = Math.floor(yNumVoxMult * diaAffect + 0.8);\r\n let numVoxZ = Math.floor(zNumVoxMult * diaAffect + 0.8);\r\n // avoid case numVox? == 0\r\n // also use loop i <=\r\n numVoxX++;\r\n numVoxY++;\r\n numVoxZ++;\r\n maxAtomsRefs += numVoxX * numVoxY * numVoxZ;\r\n } // for (i)\r\n // maxAtomsRefs = numAtoms * MAX_ATOMS_IN_SINGLE_VOXEL;\r\n\r\n\r\n this._voxelList = utils.allocateTyped(Int32Array, side3);\r\n const atomsList = [];\r\n atomsList.length = maxAtomsRefs;\r\n if ((this._voxelList === null) || (atomsList === null)) {\r\n return 0 - 1;\r\n }\r\n // init voxel list\r\n for (i = 0; i < side3; i++) {\r\n this._voxelList[i] = -1;\r\n }\r\n numAtomsRefs = 0;\r\n\r\n // create voxel lists\r\n for (i = 0; i < numAtoms; i++) {\r\n // use multiplier 4 to locate this atom in different voxels\r\n rad = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n let xIndMin = Math.floor((atoms[i].coord.x - this._vBoxMin.x - rad) * numCells * xScale);\r\n let yIndMin = Math.floor((atoms[i].coord.y - this._vBoxMin.y - rad) * numCells * yScale);\r\n let zIndMin = Math.floor((atoms[i].coord.z - this._vBoxMin.z - rad) * numCells * zScale);\r\n let xIndMax = Math.floor((atoms[i].coord.x - this._vBoxMin.x + rad) * numCells * xScale);\r\n let yIndMax = Math.floor((atoms[i].coord.y - this._vBoxMin.y + rad) * numCells * yScale);\r\n let zIndMax = Math.floor((atoms[i].coord.z - this._vBoxMin.z + rad) * numCells * zScale);\r\n\r\n xIndMin = (xIndMin >= 0) ? xIndMin : 0;\r\n yIndMin = (yIndMin >= 0) ? yIndMin : 0;\r\n zIndMin = (zIndMin >= 0) ? zIndMin : 0;\r\n\r\n xIndMax = (xIndMax < numCells) ? xIndMax : (numCells - 1);\r\n yIndMax = (yIndMax < numCells) ? yIndMax : (numCells - 1);\r\n zIndMax = (zIndMax < numCells) ? zIndMax : (numCells - 1);\r\n\r\n for (let z = zIndMin; z <= zIndMax; z++) {\r\n for (let y = yIndMin; y <= yIndMax; y++) {\r\n for (let x = xIndMin; x <= xIndMax; x++) {\r\n // add atom with index \"i\" to this voxel list\r\n const indVoxel = x + y * side + z * side2;\r\n // assert indVoxel >= 0\r\n // assert indVoxel < side3\r\n\r\n // add first\r\n if (this._voxelList[indVoxel] < 0) {\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = 0 - 1;\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n numAtomsRefs++;\r\n // assert numAtomsRefs < maxAtomsRefs - 1\r\n continue;\r\n }\r\n // insert into head of list\r\n const indexNext = this._voxelList[indVoxel];\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = indexNext;\r\n numAtomsRefs++;\r\n } // for (x)\r\n } // for (y)\r\n } // for (z)\r\n } // for (i)\r\n\r\n // convert Array to Int32Array\r\n this._atomsList = Int32Array.from(atomsList);\r\n\r\n return 0;\r\n }\r\n\r\n destroyVoxels() {\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n\r\n this._atoms = null;\r\n this._vertices = null;\r\n this._vBoxMin = null;\r\n this._vBoxMax = null;\r\n }\r\n\r\n /**\r\n * Enumerate all atoms affecting specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n * @param {func(atom)} process - function to call for each atom\r\n */\r\n forEachRelatedAtom(point, process) {\r\n // find corresponding voxel\r\n const xInd = Math.floor((point.x - this._vBoxMin.x) * this._numCells * this._xScale);\r\n const yInd = Math.floor((point.y - this._vBoxMin.y) * this._numCells * this._yScale);\r\n const zInd = Math.floor((point.z - this._vBoxMin.z) * this._numCells * this._zScale);\r\n const indVoxel = xInd + yInd * this._numCells + zInd * this._numCells * this._numCells;\r\n\r\n // run through atoms affecting this voxel\r\n const atoms = this._atoms;\r\n for (let ref = this._voxelList[indVoxel]; ref >= 0; ref = this._atomsList[ref * 2 + 1]) {\r\n const indexAtom = this._atomsList[ref * 2];\r\n process(atoms[indexAtom]);\r\n }\r\n }\r\n\r\n /**\r\n * Get atom closest to specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n *\r\n * @returns {IsoSurfaceAtomColored} atom, or null if not found\r\n */\r\n getClosestAtom(point) {\r\n let closest = null;\r\n let minDist2 = Number.MAX_VALUE;\r\n\r\n this.forEachRelatedAtom(point, (atom) => {\r\n const dist2 = point.distanceToSquared(atom.coord);\r\n if (dist2 < minDist2) {\r\n minDist2 = dist2;\r\n closest = atom;\r\n }\r\n });\r\n\r\n return closest;\r\n }\r\n\r\n /**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} normals - Normals for output\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildNormals(numVertices, vertices, normals) {\r\n const self = this;\r\n let numCloseAtoms = 0;\r\n let vx = 0;\r\n let vy = 0;\r\n let vz = 0;\r\n let dist2;\r\n let vNormalX = 0;\r\n let vNormalY = 0;\r\n let vNormalZ = 0;\r\n let koef = 0;\r\n let w = 0;\r\n const r25 = 2.5;\r\n const r01 = 0.1;\r\n\r\n const maxRadAffect = this._aveRad * r25;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n const expScale = -this._aveRad * r01;\r\n\r\n // some stats\r\n // numSlowAtoms = 0;\r\n\r\n const gatherNormals = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = Math.exp(expScale * koef);\r\n\r\n vNormalX += dx * w;\r\n vNormalY += dy * w;\r\n vNormalZ += dz * w;\r\n numCloseAtoms++;\r\n };\r\n\r\n let maxClosedAtoms = 0;\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n numCloseAtoms = 0;\r\n vNormalX = vNormalY = vNormalZ = 0.0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherNormals);\r\n\r\n maxClosedAtoms = (numCloseAtoms > maxClosedAtoms) ? numCloseAtoms : maxClosedAtoms;\r\n\r\n // normalize vNormal\r\n dist2 = vNormalX * vNormalX + vNormalY * vNormalY + vNormalZ * vNormalZ;\r\n if (numCloseAtoms > 0) {\r\n koef = 1.0 / Math.sqrt(dist2);\r\n vNormalX *= koef;\r\n vNormalY *= koef;\r\n vNormalZ *= koef;\r\n }\r\n normals[i].x = vNormalX;\r\n normals[i].y = vNormalY;\r\n normals[i].z = vNormalZ;\r\n } // for (i) all vertices\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Build vertex colors for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} colors - Colors for output\r\n * @param {number} radiusColorSmoothness - Radius of smoothness sphere\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildColors(numVertices, vertices, colors, radiusColorSmoothness) {\r\n const self = this;\r\n let vx = 0.0;\r\n let vy = 0.0;\r\n let vz = 0.0;\r\n let koef = 0.0;\r\n let w = 0.0;\r\n const KOEF_ADD = 0.8;\r\n\r\n const maxRadAffect = radiusColorSmoothness;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n\r\n let colorsClose = [];\r\n let weights = [];\r\n let weightsSum = 0;\r\n\r\n const gatherColors = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = 1.0 / (KOEF_ADD + koef);\r\n\r\n colorsClose.push([atom.colorX, atom.colorY, atom.colorZ]);\r\n weights.push(w); // save weights for use\r\n weightsSum += w; // calc sum of weights fo further normalization\r\n };\r\n\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n colorsClose = [];\r\n weights = [];\r\n weightsSum = 0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherColors);\r\n\r\n // normalized weighted sum of colors\r\n for (let j = 0; j < colorsClose.length; ++j) {\r\n const weightNormalized = weights[j] / weightsSum;\r\n colors[i].x += colorsClose[j][0] * weightNormalized;\r\n colors[i].y += colorsClose[j][1] * weightNormalized;\r\n colors[i].z += colorsClose[j][2] * weightNormalized;\r\n }\r\n } // for (i) all vertices\r\n return 0;\r\n }\r\n}\r\nexport default IsosurfaceBuildNormals;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for geometry (triangle mesh) representation\r\n *\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices in mesh\r\n * @param {number} maxNumTriangles Maximum possible number of triangles in mesh\r\n * @param {boolean} needVertexColors Obvious\r\n */\r\nclass IsoSurfaceGeo {\r\n constructor(maxNumVertices, maxNumTriangles, needVertexColors) {\r\n this._maxNumVertices = maxNumVertices;\r\n this._maxNumTriangles = maxNumTriangles;\r\n this._vertices = new Array(maxNumVertices);\r\n this._normals = new Array(maxNumVertices);\r\n this._colors = null;\r\n if (needVertexColors) {\r\n this._colors = new Array(maxNumVertices);\r\n }\r\n this._indices = new Array(maxNumTriangles * (1 + 2));\r\n this._numVertices = 0;\r\n this._numTriangles = 0;\r\n\r\n let i;\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._vertices[i] = new THREE.Vector3();\r\n this._normals[i] = new THREE.Vector3();\r\n }\r\n for (i = 0; i < maxNumTriangles * (1 + 2); i++) {\r\n this._indices[i] = -1;\r\n }\r\n if (needVertexColors) {\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._colors[i] = new THREE.Vector3();\r\n }\r\n }\r\n }\r\n\r\n destroy() {\r\n this._vertices = null;\r\n this._normals = null;\r\n this._indices = null;\r\n }\r\n}\r\nexport default IsoSurfaceGeo;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurfaceAtomColored from './IsoSurfaceAtomColored';\r\nimport IsosurfaceBuildNormals from './IsosurfaceBuildNormals';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport IsoSurfaceGeo from './IsoSurfaceGeo';\r\nimport chem from '../../chem';\r\nimport utils from '../../utils';\r\n\r\nconst COLOR_SIZE = 3;\r\nconst HASH_SIZE = 32768;\r\nconst { Element } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass SSIsosurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n // convert geoOut into arrays of positions, indices, normals\r\n this._innerBuild();\r\n const geoOut = this.getGeo();\r\n this.destroy();\r\n this._fromGeo(geoOut);\r\n }\r\n\r\n _fromGeo(geoOut) {\r\n let colors = null;\r\n const positions = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n const normals = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n if (geoOut._colors !== null) {\r\n colors = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n }\r\n const indices = utils.allocateTyped(Uint32Array, (1 + 2) * geoOut._numTriangles);\r\n\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++) {\r\n positions[j + 0] = (geoOut._vertices[i].x);\r\n positions[j + 1] = (geoOut._vertices[i].y);\r\n positions[j + 2] = (geoOut._vertices[i].z);\r\n normals[j + 0] = geoOut._normals[i].x;\r\n normals[j + 1] = geoOut._normals[i].y;\r\n normals[j + 2] = geoOut._normals[i].z;\r\n j += 3;\r\n }\r\n if (colors !== null) {\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++, j += 3) {\r\n colors[j + 0] = geoOut._colors[i].x;\r\n colors[j + 1] = geoOut._colors[i].y;\r\n colors[j + 2] = geoOut._colors[i].z;\r\n }\r\n }\r\n\r\n const numTri3 = geoOut._numTriangles * (1 + 2);\r\n for (let i = 0; i < numTri3; i++) {\r\n indices[i] = geoOut._indices[i];\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(positions, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(colors, 3));\r\n this.computeBoundingBox();\r\n this.computeBoundingSphere();\r\n\r\n geoOut.destroy();\r\n }\r\n\r\n convertToAtomsColored(packedArrays, atomsColored) {\r\n const { atoms, colors } = packedArrays;\r\n for (let i = 0, numAtoms = atoms.length; i < numAtoms; i++) {\r\n const vCenter = atoms[i].position;\r\n const { radius } = atoms[i].element;\r\n atomsColored[i] = new IsoSurfaceAtomColored(vCenter, radius);\r\n const nm = atoms[i].element.number;\r\n atomsColored[i].atomType = this.getType(nm);\r\n let cIdx = COLOR_SIZE * i;\r\n atomsColored[i].colorX = colors[cIdx++];\r\n atomsColored[i].colorY = colors[cIdx++];\r\n atomsColored[i].colorZ = colors[cIdx];\r\n atomsColored[i].srcAtom = atoms[i];\r\n }\r\n }\r\n\r\n getGeo() {\r\n return this.geoOut;\r\n }\r\n\r\n destroy() {\r\n this.atoms = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n }\r\n\r\n /**\r\n * Calculates bounding box for array with spheres (atoms)\r\n *\r\n * @param {Object} atoms Atoms array\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n */\r\n getBoundingBox(atoms, vBoxMin, vBoxMax) {\r\n const bigNum = 10000000.0;\r\n\r\n vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum;\r\n vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum;\r\n\r\n const probeRadius2 = this.probeRadius * this.atomRadiusScale;\r\n let radMax = 0.0;\r\n for (let i = 0, num = atoms.length; i < num; i++) {\r\n const vCenter = atoms[i].coord;\r\n const rad = atoms[i].radius + probeRadius2;\r\n radMax = (rad > radMax) ? rad : radMax;\r\n if (vCenter.x - rad < vBoxMin.x) {\r\n vBoxMin.x = vCenter.x - rad;\r\n }\r\n if (vCenter.y - rad < vBoxMin.y) {\r\n vBoxMin.y = vCenter.y - rad;\r\n }\r\n if (vCenter.z - rad < vBoxMin.z) {\r\n vBoxMin.z = vCenter.z - rad;\r\n }\r\n if (vCenter.x + rad > vBoxMax.x) {\r\n vBoxMax.x = vCenter.x + rad;\r\n }\r\n if (vCenter.y + rad > vBoxMax.y) {\r\n vBoxMax.y = vCenter.y + rad;\r\n }\r\n if (vCenter.z + rad > vBoxMax.z) {\r\n vBoxMax.z = vCenter.z + rad;\r\n }\r\n }\r\n vBoxMin.x -= radMax;\r\n vBoxMin.y -= radMax;\r\n vBoxMin.z -= radMax;\r\n vBoxMax.x += radMax;\r\n vBoxMax.y += radMax;\r\n vBoxMax.z += radMax;\r\n }\r\n\r\n /**\r\n * Calculate (x,y,z) cordinate of the cell corner point\r\n *\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {number} x Cell integer x coordinate\r\n * @param {number} y Cell integer y coordinate\r\n * @param {number} z Cell integer z coordinate\r\n * @param {number} numPoints NUm points in cell on side\r\n * @param {Vector3} vOut Output vector\r\n */\r\n getCornerCoord(vBoxMin, vBoxMax, x, y, z, numPoints, vOut) {\r\n const invNP = 1.0 / (numPoints - 1.0);\r\n const tx = x * invNP;\r\n const ty = y * invNP;\r\n const tz = z * invNP;\r\n\r\n vOut.x = vBoxMin.x * (1.0 - tx) + vBoxMax.x * tx;\r\n vOut.y = vBoxMin.y * (1.0 - ty) + vBoxMax.y * ty;\r\n vOut.z = vBoxMin.z * (1.0 - tz) + vBoxMax.z * tz;\r\n }\r\n\r\n /**\r\n * Calculate point of intersection of sphere surface\r\n * and cell edge, given by [indexA, indexB] line\r\n *\r\n * @param {number} indexA Cell vertex index in [0..11]\r\n * @param {number} indexB Cell vertex index in [0..11]\r\n * @param {array} sign Sign array for all 8 vertices\r\n * @param {object} cube Cube\r\n * @param {number} indexPointValue for value placement\r\n * @param {Vector3} vOut Point of intersection\r\n */\r\n buildEdgePoint(indexA, indexB, sign, cube, indexPointValue, vOut) {\r\n if (sign[indexA] ^ sign[indexB]) {\r\n const cTwentyFour = 24;\r\n const t = (0 - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA])\r\n / (cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexB]\r\n - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]);\r\n const xa = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 0];\r\n const ya = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 1];\r\n const za = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 2];\r\n const xb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 0];\r\n const yb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 1];\r\n const zb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 2];\r\n\r\n vOut.x = xa * (1.0 - t) + xb * t;\r\n vOut.y = ya * (1.0 - t) + yb * t;\r\n vOut.z = za * (1.0 - t) + zb * t;\r\n }\r\n }\r\n\r\n /**\r\n * Check if triangle is visible (vertices are close to atoms included in visibility set)\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} true if triangle is visible\r\n */\r\n isTriangleVisible(v0, v1, v2) {\r\n const a0 = this.voxelWorld.getClosestAtom(v0);\r\n const a1 = this.voxelWorld.getClosestAtom(v1);\r\n const a2 = this.voxelWorld.getClosestAtom(v2);\r\n if (a0 === null || a1 === null || a2 === null\r\n || a0.srcAtom === null || a1.srcAtom === null || a2.srcAtom === null) {\r\n return false;\r\n }\r\n\r\n return this.visibilitySelector.includesAtom(a0.srcAtom)\r\n && this.visibilitySelector.includesAtom(a1.srcAtom)\r\n && this.visibilitySelector.includesAtom(a2.srcAtom);\r\n }\r\n\r\n /**\r\n * Add triangle to result geometry\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} false if no more triangles can be added\r\n */\r\n addTriangle(v0, v1, v2) {\r\n if (this.visibilitySelector && !this.isTriangleVisible(v0, v1, v2)) {\r\n return true;\r\n }\r\n\r\n const geo = this.geoOut;\r\n\r\n if (geo._numTriangles >= this.maxNumTriangles) {\r\n return false;\r\n }\r\n\r\n // Add vertex with optimize\r\n const indInGeo0 = this.addVertexToGeo(geo, v0);\r\n const indInGeo1 = this.addVertexToGeo(geo, v1);\r\n const indInGeo2 = this.addVertexToGeo(geo, v2);\r\n if ((indInGeo0 | indInGeo1 | indInGeo2) < 0) {\r\n return false;\r\n }\r\n\r\n const itr = 3 * geo._numTriangles;\r\n geo._indices[itr + 0] = indInGeo0;\r\n geo._indices[itr + 1] = indInGeo1;\r\n geo._indices[itr + 2] = indInGeo2;\r\n geo._numTriangles++;\r\n return true;\r\n }\r\n\r\n /**\r\n * Build result geometry (triangle mesh) from marching cube cells\r\n *\r\n * @param {number} meshRes Marchnig cube vertex count on each side\r\n * @param {Vector3} vBoxMin Bounding box point min\r\n * @param {Vector3} vBoxMax Bounding box point max\r\n * @param {number} corners float values array for each cube point\r\n * @param {Vector3} vCellStep vector to next cube cell diagonal point\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} 0, if success (<0) is error\r\n */\r\n buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) {\r\n const arrSize = 12;\r\n const cNumVerts = 8;\r\n const numCells = meshRes - 1;\r\n const side = meshRes;\r\n const side2 = meshRes * meshRes;\r\n\r\n const vaEdges = new Array(arrSize);\r\n for (let i = 0; i < arrSize; i++) {\r\n vaEdges[i] = new THREE.Vector3();\r\n }\r\n const sign = [];\r\n for (let i = 0; i < cNumVerts; i++) {\r\n sign[i] = 1.0;\r\n }\r\n const vCorner = new THREE.Vector3();\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n if (!cube.hasIntersection[indCell]) {\r\n // next cell\r\n indCell++;\r\n continue;\r\n }\r\n const bitsInside = cube.bitsInside[indCell];\r\n\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, meshRes, vCorner);\r\n\r\n const indPointValues = indCell * (2 << (2 + 2));\r\n for (let i = 0, j = 0; i < cNumVerts; i++) {\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.x;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.y;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.z;\r\n }\r\n\r\n cube.pointsValuesLinear[indPointValues + 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 2 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3] += vCellStep.x;\r\n\r\n cube.pointsValuesLinear[indPointValues + 2 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 3 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 2] += vCellStep.z;\r\n\r\n cube.pointsValuesLinear[indPointValues + 4 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 1] += vCellStep.y;\r\n\r\n\r\n // now current cell has intersections (from -x to +x) on some cube edges\r\n const indValues = indPointValues + 24;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n sign[i] = (cube.pointsValuesLinear[indValues + i] < 0.0) ? 1 : 0;\r\n }\r\n\r\n this.buildEdgePoint(0, 1, sign, cube, indPointValues, vaEdges[0]);\r\n this.buildEdgePoint(1, 2, sign, cube, indPointValues, vaEdges[1]);\r\n this.buildEdgePoint(2, 3, sign, cube, indPointValues, vaEdges[2]);\r\n this.buildEdgePoint(3, 0, sign, cube, indPointValues, vaEdges[3]);\r\n\r\n this.buildEdgePoint(4, 5, sign, cube, indPointValues, vaEdges[4]);\r\n this.buildEdgePoint(5, 6, sign, cube, indPointValues, vaEdges[5]);\r\n this.buildEdgePoint(6, 7, sign, cube, indPointValues, vaEdges[6]);\r\n this.buildEdgePoint(7, 4, sign, cube, indPointValues, vaEdges[7]);\r\n\r\n this.buildEdgePoint(0, 4, sign, cube, indPointValues, vaEdges[8]);\r\n this.buildEdgePoint(1, 5, sign, cube, indPointValues, vaEdges[9]);\r\n this.buildEdgePoint(2, 6, sign, cube, indPointValues, vaEdges[10]);\r\n this.buildEdgePoint(3, 7, sign, cube, indPointValues, vaEdges[11]);\r\n\r\n const offs = bitsInside * (2 << (1 + 2));\r\n for (let numTri = 0, indTri = 0; numTri < (2 + 2 + 2); numTri++, indTri += 3) {\r\n // s_triIndicesMarchCube is external array, defined in mold_ind.js\r\n const i0 = cube.striIndicesMarchCube[offs + indTri];\r\n if (i0 < 0) {\r\n break;\r\n }\r\n const i1 = cube.striIndicesMarchCube[offs + indTri + 1];\r\n const i2 = cube.striIndicesMarchCube[offs + indTri + 2];\r\n\r\n if (!this.addTriangle(vaEdges[i0], vaEdges[i1], vaEdges[i2])) {\r\n return 0 - 2;\r\n }\r\n } // for numTri\r\n\r\n // next cell (cube)\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return 0;\r\n }\r\n\r\n /**\r\n * Returns number of cell with intersection with at least one sphere.\r\n * Using this number, we can estimate required number of vertices\r\n * and triangles to build result mesh.\r\n *\r\n * @param {number} side Number of points in cube voxels\r\n * @param {number} numCells Number of cells in cube voxels (per direction)\r\n * @param {array} corners Array of float values for cube corner points\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} numIntersectedCells\r\n */\r\n getNumIntersectedCells(side, numCells, corners, cube) {\r\n const side2 = side * side;\r\n const cNumVerts = 8;\r\n let numIntersectedCells = 0;\r\n\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n const cubeValuesIndex = indCell * (2 << (2 + 2)) + 24;\r\n const indCorner = x + indZ + indY;\r\n\r\n cube.pointsValuesLinear[cubeValuesIndex] = corners[indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 1] = corners[indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 2] = corners[indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 3] = corners[indCorner + side];\r\n cube.pointsValuesLinear[cubeValuesIndex + 4] = corners[side2 + indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 5] = corners[side2 + indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 6] = corners[side2 + indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 7] = corners[side2 + indCorner + side];\r\n\r\n // check read exception\r\n // assert(side2 + indCorner + side + 1 < side3);\r\n\r\n // get bit flags inside\r\n let bitsInside = 0;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n if (cube.pointsValuesLinear[cubeValuesIndex + i] < 0.0) {\r\n bitsInside |= (1 << i);\r\n }\r\n }\r\n\r\n if ((bitsInside === 0) || (bitsInside === ((1 << cNumVerts) - 1))) {\r\n cube.hasIntersection[indCell] = false;\r\n } else {\r\n cube.hasIntersection[indCell] = true;\r\n numIntersectedCells++;\r\n }\r\n cube.bitsInside[indCell] = bitsInside;\r\n // next cell\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return numIntersectedCells;\r\n }\r\n\r\n getType(letter) {\r\n /* eslint-disable no-magic-numbers */\r\n const atomT = [0, 0, 1, 1, 2, 6, 3, 6, 4, 6, 5, 6, 6, 0, 7, 3, 8, 2, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 4,\r\n 16, 5, 17, 6, 18, 6, 19, 6, 20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6,\r\n 32, 6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, 45, 6, 46, 6, 47, 6,\r\n 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, 6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6,\r\n 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6,\r\n 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, 95, 6,\r\n 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, 6, 108, 6, 109, 6];\r\n /* eslint-enable no-magic-numbers */\r\n\r\n if (letter < 1 || letter > atomT.length / 2\r\n || (Object.keys(Element.ByAtomicNumber).length * 2) !== atomT.length) {\r\n throw new Error('atomT.length should be equal Element.ByAtomicNumber.length * 2');\r\n }\r\n return atomT[letter * 2];\r\n }\r\n\r\n\r\n /**\r\n * Calculate values for marching cube grid points\r\n * positive values are outside sphere, negative - is inside\r\n *\r\n * @param {array} corners array of float values\r\n * @param {number} side Number of point in cube in 1 dimennsion\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {array} atoms Array of input atoms\r\n * @param {number} probeRad radius for atom probing\r\n */\r\n calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) {\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const vCorner = new THREE.Vector3();\r\n const vDif = new THREE.Vector3();\r\n /* eslint-disable no-magic-numbers */\r\n const aLot = +1.0e12;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n for (let i = 0; i < side3; i++) {\r\n corners[i] = aLot; // to large value\r\n }\r\n\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n for (let s = 0, numAtoms = atoms.length; s < numAtoms; s++) {\r\n const atom = atoms[s];\r\n const radius = atom.radius + probeRad;\r\n\r\n const fx = ((atom.coord.x - radius) - vBoxMin.x) * xScale;\r\n const fy = ((atom.coord.y - radius) - vBoxMin.y) * yScale;\r\n const fz = ((atom.coord.z - radius) - vBoxMin.z) * zScale;\r\n\r\n const indXMin = Math.floor(fx);\r\n const indYMin = Math.floor(fy);\r\n const indZMin = Math.floor(fz);\r\n\r\n let indXMax = Math.floor(((atom.coord.x + radius) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((atom.coord.y + radius) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((atom.coord.z + radius) - vBoxMin.z) * zScale);\r\n\r\n indXMax++;\r\n indYMax++;\r\n indZMax++;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let y = indYMin; y <= indYMax; y++) {\r\n const indY = y * side2;\r\n for (let z = indZMin; z <= indZMax; z++) {\r\n const indZ = z * side;\r\n for (let x = indXMin; x <= indXMax; x++) {\r\n const ind = indY + indZ + x;\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, side, vCorner);\r\n vDif.x = vCorner.x - atom.coord.x;\r\n vDif.y = vCorner.y - atom.coord.y;\r\n vDif.z = vCorner.z - atom.coord.z;\r\n const distToSphere = Math.sqrt(vDif.x * vDif.x + vDif.y * vDif.y + vDif.z * vDif.z);\r\n // val: < 0, if inside sphere\r\n // val: > 0, if outside sphere\r\n const val = distToSphere - radius;\r\n if (val < corners[ind]) {\r\n corners[ind] = val;\r\n }\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n } // for (s)\r\n }\r\n\r\n /**\r\n * Create memory pool for vertex hash management\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices (that will be build)\r\n * @param {number} maxNumTriangles Maximum possible number of triangles (that will be build)\r\n * @returns {number} 0, if success. (<0) is non memory\r\n */\r\n createVertexHash(maxNumVertices, maxNumTriangles) {\r\n this.hashLines = utils.allocateTyped(Int32Array, HASH_SIZE * 2);\r\n if (this.hashLines === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < HASH_SIZE; i++) {\r\n this.hashLines[j++] = 0; // num vertices in this hash line\r\n this.hashLines[j++] = 0 - 1; // index of the first entry\r\n }\r\n\r\n this.maxNumVertices = maxNumVertices;\r\n this.maxNumTriangles = maxNumTriangles;\r\n\r\n this.numHashEtriesAllocated = maxNumVertices;\r\n this.hashEntries = utils.allocateTyped(Int32Array, 2 * this.numHashEtriesAllocated);\r\n if (this.hashEntries === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < this.numHashEtriesAllocated; i++) {\r\n this.hashEntries[j++] = 0 - 1; // index of vertex\r\n this.hashEntries[j++] = 0 - 1; // next hash entry index\r\n }\r\n this.numHashEntryIndex = 0;\r\n return 0;\r\n }\r\n\r\n /**\r\n * Allocate and return new hash entry. Just check possible amount.\r\n *\r\n * @returns {number} index of hash entry, that can be used for geometry add vertex functionality\r\n */\r\n getNewHashEntry() {\r\n if (this.numHashEntryIndex < this.numHashEtriesAllocated) {\r\n const i = this.numHashEntryIndex;\r\n this.numHashEntryIndex++;\r\n return i;\r\n }\r\n return 0 - 1;\r\n }\r\n\r\n /**\r\n * Add vertex to geometry structure\r\n * using vertex hash table to quickly check, is this vertex already exist in geometry\r\n *\r\n * @param {object} geoOut Geometry to build\r\n * @param {Vector3} vAdd Vertex to add\r\n * @returns {number} index of added (or existing) vertex in geometry.\r\n */\r\n addVertexToGeo(geoOut, vAdd) {\r\n let entry;\r\n const oneHynberes = 0.01;\r\n const n815851 = 815851;\r\n const n37633 = 37633;\r\n const n2453543 = 2453543;\r\n const r106 = 1.0e-6;\r\n\r\n const hashResolution = this.marCubeResoultion << 2;\r\n const v = new THREE.Vector3();\r\n const ix = Math.floor(hashResolution * (vAdd.x - this.vBoxMin.x) / (this.vBoxMax.x + oneHynberes - this.vBoxMin.x));\r\n const iy = Math.floor(hashResolution * (vAdd.y - this.vBoxMin.y) / (this.vBoxMax.y + oneHynberes - this.vBoxMin.y));\r\n const iz = Math.floor(hashResolution * (vAdd.z - this.vBoxMin.z) / (this.vBoxMax.z + oneHynberes - this.vBoxMin.z));\r\n let iHash = ix * n815851 + iz * n37633 + iy * n2453543;\r\n iHash &= (HASH_SIZE - 1);\r\n const hLineIndex = iHash + iHash;\r\n\r\n // search vertex via hash\r\n // search in hash list\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n for (entry = this.hashLines[hLineIndex + 1]; entry >= 0; entry = this.hashEntries[entry * 2 + 1]) {\r\n const ind = this.hashEntries[entry * 2 + 0]; // vertex index\r\n v.copy(geoOut._vertices[ind]);\r\n v.x -= vAdd.x;\r\n v.y -= vAdd.y;\r\n v.z -= vAdd.z;\r\n const dot2 = v.x * v.x + v.y * v.y + v.z * v.z;\r\n if (dot2 < r106) {\r\n return ind;\r\n } // if (found)\r\n } // for (entry)\r\n } // search\r\n\r\n // add new vertex to geometry\r\n if (geoOut._numVertices >= this.maxNumVertices) {\r\n return 0 - 1;\r\n }\r\n\r\n const iVertAdd = geoOut._numVertices;\r\n geoOut._vertices[iVertAdd].copy(vAdd);\r\n\r\n // add to hash\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n entry = this.getNewHashEntry();\r\n if (entry < 0) {\r\n return 0 - 1;\r\n }\r\n const entryFirst = this.hashLines[hLineIndex + 1];\r\n this.hashLines[hLineIndex + 1] = entry;\r\n this.hashEntries[entry * 2 + 0] = iVertAdd;\r\n this.hashEntries[entry * 2 + 1] = entryFirst;\r\n\r\n this.hashLines[hLineIndex + 0]++; // num vertices in line ++\r\n }\r\n geoOut._numVertices++;\r\n return iVertAdd;\r\n }\r\n\r\n /**\r\n *\r\n * @param {number} side some placeholder description\r\n * @param {number} probeSphereRadius some placeholder description\r\n * @param {object} vBoxMin some placeholder description\r\n * @param {object} vBoxMax some placeholder description\r\n * @param {object} geoOut some placeholder description\r\n * @param {object} corners some placeholder description\r\n * @returns {number} always 0\r\n */\r\n modifyExcludedFromGeo(\r\n side, probeSphereRadius,\r\n vBoxMin, vBoxMax,\r\n geoOut, corners,\r\n ) {\r\n let ind;\r\n let distToSphere;\r\n let distToBorder;\r\n const r11 = 1.1;\r\n\r\n function innerBlockWorkAround() {\r\n if (distToBorder > 0.0) {\r\n // point is inside probe sphere\r\n if (corners[ind] < 0.0) {\r\n corners[ind] = distToBorder; // was inside surface, now is oustide ( > 0)\r\n }\r\n if (distToBorder > corners[ind]) {\r\n corners[ind] = distToBorder; // find positive maximum\r\n }\r\n } else if (distToBorder > corners[ind]) { // point is outside sphere\r\n corners[ind] = distToBorder; // find negative maximum\r\n }\r\n }\r\n\r\n const side2 = side * side;\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n const probeSpRad2 = (probeSphereRadius * 2) * (probeSphereRadius * 2);\r\n const sideInv = 1.0 / (side - 1);\r\n\r\n for (let i = 0; i < geoOut._numVertices; i++) {\r\n const vCenter = geoOut._vertices[i];\r\n\r\n const radEst = probeSphereRadius * r11;\r\n\r\n let indXMin = Math.floor(((vCenter.x - radEst) - vBoxMin.x) * xScale);\r\n let indYMin = Math.floor(((vCenter.y - radEst) - vBoxMin.y) * yScale);\r\n let indZMin = Math.floor(((vCenter.z - radEst) - vBoxMin.z) * zScale);\r\n\r\n let indXMax = Math.floor(((vCenter.x + radEst) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((vCenter.y + radEst) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((vCenter.z + radEst) - vBoxMin.z) * zScale);\r\n\r\n indXMin = (indXMin >= 0) ? indXMin : 0;\r\n indYMin = (indYMin >= 0) ? indYMin : 0;\r\n indZMin = (indZMin >= 0) ? indZMin : 0;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let iy = indYMin; iy <= indYMax; iy++) {\r\n const indY = iy * side2;\r\n for (let iz = indZMin; iz <= indZMax; iz++) {\r\n const indZ = iz * side;\r\n for (let ix = indXMin; ix <= indXMax; ix++) {\r\n ind = indY + indZ + ix;\r\n // getCornerCoord(vBoxMin, vBoxMax, ix, iy, iz, side, &vCorner);\r\n let t = ix * sideInv;\r\n const xCorner = vBoxMin.x * (1.0 - t) + vBoxMax.x * t;\r\n t = iy * sideInv;\r\n const yCorner = vBoxMin.y * (1.0 - t) + vBoxMax.y * t;\r\n t = iz * sideInv;\r\n const zCorner = vBoxMin.z * (1.0 - t) + vBoxMax.z * t;\r\n\r\n const dx = xCorner - vCenter.x;\r\n const dy = yCorner - vCenter.y;\r\n const dz = zCorner - vCenter.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 < probeSpRad2) {\r\n distToSphere = Math.sqrt(dist2);\r\n distToBorder = -(distToSphere - probeSphereRadius);\r\n innerBlockWorkAround();\r\n } // if (dist from corner point to sphere center more 2 radiuses)\r\n } // for (ix)\r\n } // for (iz)\r\n } // for (iy)\r\n } // for (i) all geo vertices\r\n return 0;\r\n }\r\n\r\n _innerBuild() {\r\n let ok;\r\n const expandFactor = 1.2;\r\n\r\n // performance test\r\n // this.performanceTest();\r\n\r\n // Create temporary atoms (but colored)\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n this.complex = this._opts.parent;\r\n this.atoms = packedArrays.atoms;\r\n this.meshResolution = this._opts.gridSpacing;\r\n this.atomRadiusScale = this._opts.radScale;\r\n this.colorMode = this._opts.colorMode;\r\n this.probeRadius = this._opts.probeRadius;\r\n this.useVertexColors = true;\r\n this.excludeProbe = this._opts.excludeProbe;\r\n this.visibilitySelector = this._opts.visibilitySelector;\r\n\r\n this.geoOut = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n this.numHashEtriesAllocated = 0;\r\n this.numHashEntryIndex = 0;\r\n this.maxNumVertices = 0;\r\n this.maxNumTriangles = 0;\r\n\r\n const atomsColored = new Array(this.atoms.length);\r\n this.convertToAtomsColored(packedArrays, atomsColored);\r\n\r\n // find bbox for spheres scene\r\n const vBoxMin = this.vBoxMin = new THREE.Vector3();\r\n const vBoxMax = this.vBoxMax = new THREE.Vector3();\r\n this.getBoundingBox(atomsColored, vBoxMin, vBoxMax);\r\n\r\n const marCubeResoultion = this.marCubeResoultion = this.meshResolution * (2 + 2);\r\n\r\n // build grid corners for Marching cube algorithm\r\n const side = marCubeResoultion;\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const corners = utils.allocateTyped(Float32Array, side3);\r\n const rProbeRadius = this.probeRadius * this.atomRadiusScale;\r\n\r\n this.calculateGridCorners(corners, side, vBoxMin, vBoxMax, atomsColored, rProbeRadius);\r\n\r\n const numCells = marCubeResoultion - 1;\r\n const cube = new IsoSurfaceMarchCube();\r\n ok = cube.create(numCells);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // copy corners to cells\r\n const vCellStep = new THREE.Vector3();\r\n vCellStep.x = (vBoxMax.x - vBoxMin.x) / numCells;\r\n vCellStep.y = (vBoxMax.y - vBoxMin.y) / numCells;\r\n vCellStep.z = (vBoxMax.z - vBoxMin.z) / numCells;\r\n\r\n let numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n let maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n let maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n\r\n // build voxel world (used to check triangle-to-atom tie and to calculate normals and colors)\r\n let probeRadForNormalsColors = rProbeRadius;\r\n if (this.excludeProbe) {\r\n probeRadForNormalsColors = 0.01;\r\n }\r\n this.voxelWorld = new IsosurfaceBuildNormals(\r\n atomsColored.length, atomsColored,\r\n vBoxMin, vBoxMax, probeRadForNormalsColors,\r\n );\r\n this.voxelWorld.createVoxels();\r\n\r\n ok = this.buildGeoFromCorners(marCubeResoultion, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n if (this.excludeProbe) {\r\n // using 3d mesh (geoOut) as a surface points\r\n // move probe sphere and try to minimuze corners values\r\n this.modifyExcludedFromGeo(side, rProbeRadius, vBoxMin, vBoxMax, this.geoOut, corners);\r\n\r\n // delete old builded geo\r\n this.geoOut._vertices = null;\r\n this.geoOut._colors = null;\r\n this.geoOut._indices = null;\r\n this.geoOut._normals = null;\r\n this.geoOut._numVertices = 0;\r\n this.geoOut._numTriangles = 0;\r\n this.geoOut = null;\r\n\r\n // estimage geo vertices budget again\r\n numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n // creates empty new geometry\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // build vertices and triangles from corners values\r\n ok = this.buildGeoFromCorners(side, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n }\r\n\r\n // build vertex normals\r\n this.voxelWorld.buildNormals(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._normals);\r\n // More value : more smooth color mixing\r\n // value about 0.7: very rough colors borders\r\n let radiusColorSmoothness = 6.5;\r\n if (this.excludeProbe) {\r\n radiusColorSmoothness -= 1.5;\r\n }\r\n if (this.useVertexColors) {\r\n this.voxelWorld.buildColors(\r\n this.geoOut._vertices.length, this.geoOut._vertices,\r\n this.geoOut._colors, radiusColorSmoothness,\r\n );\r\n }\r\n this.voxelWorld.destroyVoxels();\r\n this.voxelWorld = null;\r\n\r\n // remove objects\r\n cube.destroy();\r\n\r\n return ok;\r\n }\r\n}\r\n\r\n// All code below must be erased from every device and each developer's memory\r\n\r\nexport default SSIsosurfaceGeometry;\r\n","import * as THREE from 'three';\r\nimport EventDispatcher from '../../utils/EventDispatcher';\r\n\r\nfunction createLabel(fieldTxt, className) {\r\n const text = document.createElement('div');\r\n text.className = className;\r\n\r\n if (typeof fieldTxt === 'string') {\r\n const spanText = document.createElement('span');\r\n spanText.style.fontSize = '150%';\r\n const strings = fieldTxt.split('\\n');\r\n\r\n for (let i = 0, n = strings.length; i < n; ++i) {\r\n const spanNodeP = document.createElement('span');\r\n const spanNodeText = document.createTextNode(strings[i]);\r\n spanNodeP.appendChild(spanNodeText);\r\n spanText.appendChild(spanNodeP);\r\n if (i < n - 1) {\r\n spanText.appendChild(document.createElement('br'));\r\n }\r\n }\r\n\r\n text.appendChild(spanText);\r\n } else {\r\n text.appendChild(fieldTxt);\r\n }\r\n text.worldPos = new THREE.Vector3();\r\n return text;\r\n}\r\nclass LabelsGeometry extends EventDispatcher {\r\n constructor(instanceCount, opts) {\r\n super();\r\n this._opts = opts;\r\n this.items = [];\r\n this.needsUpdate = false;\r\n\r\n let xTranslation = -50;\r\n let yTranslation = -50;\r\n switch (opts.horizontalAlign) {\r\n case 'left':\r\n xTranslation = 0;\r\n break;\r\n case 'right':\r\n xTranslation = -100;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n switch (opts.verticalAlign) {\r\n case 'top':\r\n yTranslation = -100;\r\n break;\r\n case 'bottom':\r\n yTranslation = 0;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n const deltaPos = new THREE.Vector3(opts.dx || 0, opts.dy || 0, opts.dz || 0);\r\n this.userData = {\r\n translation: `translate(${xTranslation}%, ${yTranslation}%)`,\r\n offset: deltaPos,\r\n };\r\n }\r\n\r\n setItem(itemIdx, itemPos, fieldTxt) {\r\n const opts = this._opts;\r\n const text = this.items[itemIdx] || createLabel(fieldTxt, 'label');\r\n\r\n text.worldPos.copy(itemPos);\r\n text.style.textAlign = opts.horizontalAlign;\r\n text.style.verticalAlign = opts.verticalAlign;\r\n this.items[itemIdx] = text;\r\n }\r\n\r\n setColor(itemIdx, fColor, bColor) {\r\n const text = this.items[itemIdx];\r\n text.opts = {\r\n color: fColor,\r\n background: bColor,\r\n };\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.needsUpdate = true;\r\n this.dispatchEvent({ type: 'update' });\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n }\r\n\r\n // unimplemented functions\r\n raycast() {\r\n }\r\n\r\n setOpacity() {\r\n\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\n\r\nexport default LabelsGeometry;\r\n","import InstancedSpheresGeometry from './InstancedSpheresGeometry';\r\nimport SimpleSpheresGeometry from './SimpleSpheresGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport Instanced2CCylindersGeometry from './Instanced2CCylindersGeometry';\r\nimport ExtrudedObjectsGeometry from './ExtrudedObjectsGeometry';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport TwoColorLinesGeometry from './TwoColorLinesGeometry';\r\nimport CrossGeometry from './CrossGeometry';\r\nimport QuickSurfGeometry from './QuickSurfGeometry';\r\nimport ContactSurfaceGeometry from './ContactSurfaceGeometry';\r\nimport SSIsosurfaceGeometry from './SSIsosurfaceGeometry';\r\nimport LabelsGeometry from './LabelsGeometry';\r\n\r\nexport default {\r\n InstancedSpheresGeometry,\r\n SimpleSpheresGeometry,\r\n Simple2CCylindersGeometry,\r\n Instanced2CCylindersGeometry,\r\n ExtrudedObjectsGeometry,\r\n ChunkedLinesGeometry,\r\n TwoColorLinesGeometry,\r\n CrossGeometry,\r\n QuickSurfGeometry,\r\n ContactSurfaceGeometry,\r\n SSIsosurfaceGeometry,\r\n LabelsGeometry,\r\n};\r\n","import UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default function (SuperClass) {\r\n class NewObjectType extends SuperClass {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.onBeforeRender = NewObjectType.prototype.onBeforeRender;\r\n }\r\n\r\n onBeforeRender(renderer, scene, camera, geometry, material, group) {\r\n this._onBeforeRender(renderer, scene, camera, geometry, material, group);\r\n this._update();\r\n }\r\n\r\n _onBeforeRender() {\r\n }\r\n\r\n _update() {\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material instanceof UberMaterial) {\r\n material.updateUniforms();\r\n }\r\n }\r\n }\r\n\r\n return NewObjectType;\r\n}\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZSpriteMesh extends Mesh {\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material.uniforms.invModelViewMatrix) {\r\n // NOTE: update of modelViewMatrix inside threejs is done after onBeforeRender call,\r\n // so we have to do it manually in that place\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n // get inverse matrix\r\n material.uniforms.invModelViewMatrix.value.getInverse(this.modelViewMatrix);\r\n material.uniformsNeedUpdate = true;\r\n }\r\n }\r\n}\r\n\r\nexport default ZSpriteMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZClippedMesh extends Mesh {\r\n constructor(geometry, material) {\r\n super(geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n\r\n static _mvLength = new THREE.Vector3();\r\n\r\n static _center = new THREE.Vector3();\r\n\r\n static _modelView = new THREE.Matrix4();\r\n\r\n _onBeforeRender(renderer, scene, camera) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n\r\n const geo = this.geometry;\r\n const { material } = this;\r\n if (!geo.zClip || !material.uberOptions) {\r\n return;\r\n }\r\n\r\n const zClipCoef = 0.5;\r\n\r\n const modelView = ZClippedMesh._modelView;\r\n const mvLength = ZClippedMesh._mvLength;\r\n const center = ZClippedMesh._center;\r\n\r\n modelView.multiplyMatrices(this.matrixWorld, camera.matrixWorldInverse);\r\n const s = mvLength.setFromMatrixColumn(modelView, 0).length();\r\n center.copy(geo.boundingSphere.center);\r\n\r\n this.localToWorld(center);\r\n material.uberOptions.zClipValue = camera.position.z - center.z\r\n - s * (zClipCoef * geo.boundingSphere.radius);\r\n }\r\n}\r\n\r\nexport default ZClippedMesh;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from '../CSS2DObject';\r\nimport utils from '../../utils';\r\n\r\nclass TextMesh extends THREE.Group {\r\n constructor(geometry, _material) {\r\n super();\r\n this.geometry = geometry;\r\n\r\n const self = this;\r\n self.initialized = false;\r\n this.geometry.addEventListener('update', () => {\r\n self.update();\r\n });\r\n }\r\n\r\n init() {\r\n const { children } = this;\r\n for (let i = children.length - 1; i >= 0; --i) {\r\n this.remove(children[i]);\r\n }\r\n\r\n const { items, userData } = this.geometry;\r\n for (let i = 0, n = items.length; i < n; ++i) {\r\n const srcItem = items[i];\r\n if (!srcItem) {\r\n continue;\r\n }\r\n const item = utils.shallowCloneNode(srcItem);\r\n const label = new CSS2DObject(item);\r\n label.userData = _.clone(userData);\r\n const el = label.getElement();\r\n el.style.visibility = 'visible';\r\n label.source = srcItem;\r\n this.add(label);\r\n }\r\n this.initialized = true;\r\n }\r\n\r\n update() {\r\n const geo = this.geometry;\r\n if (!geo.needsUpdate) {\r\n return;\r\n }\r\n const { children } = this;\r\n if (!this.initialized) {\r\n this.init();\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n const item = child.source;\r\n child.position.copy(item.worldPos);\r\n child.userData.color = item.opts.color;\r\n child.userData.background = item.opts.background;\r\n }\r\n }\r\n}\r\n\r\nexport default TextMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nfunction SimpleMesh(geometry, material) {\r\n Mesh.call(this, geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n}\r\n\r\nSimpleMesh.prototype = Object.create(Mesh.prototype);\r\nSimpleMesh.prototype.constructor = SimpleMesh;\r\n\r\nexport default SimpleMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\nconst _viewport = new THREE.Vector2();\r\n\r\nclass ThickLineMesh extends Mesh {\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!material.uberOptions) {\r\n return;\r\n }\r\n\r\n material.uberOptions.projMatrixInv.getInverse(camera.projectionMatrix, true);\r\n renderer.getSize(_viewport);\r\n material.uberOptions.viewport.set(_viewport.width, _viewport.height);\r\n }\r\n}\r\n\r\nexport default ThickLineMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass InstancedMesh extends Mesh {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n}\r\n\r\nexport default InstancedMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\nimport ZSpriteMesh from './ZSpriteMesh';\r\nimport ZClippedMesh from './ZClippedMesh';\r\nimport TextMesh from './TextMesh';\r\nimport SimpleMesh from './SimpleMesh';\r\nimport ThickLineMesh from './ThickLineMesh';\r\nimport InstancedMesh from './InstancedMesh';\r\n\r\nexport default {\r\n ZClipped: ZClippedMesh,\r\n ZSprite: ZSpriteMesh,\r\n Text: TextMesh,\r\n Line: UberObject(THREE.Line),\r\n LineSegments: UberObject(THREE.LineSegments),\r\n Mesh: SimpleMesh,\r\n ThickLineMesh,\r\n Instanced: InstancedMesh,\r\n};\r\n","import geometries from '../geometries/geometries';\r\nimport meshes from './meshes';\r\nimport ThickLinesGeometry from '../geometries/ThickLinesGeometry';\r\n\r\nfunction setMatParams(params, uniforms) {\r\n return function (material) {\r\n material.setValues(params);\r\n material.setUberOptions(uniforms);\r\n };\r\n}\r\n\r\nfunction _createInstancedCylinders(useZSprites, openEnded) {\r\n return {\r\n Geometry(a, b) {\r\n return new geometries.Instanced2CCylindersGeometry(a, b, useZSprites, openEnded);\r\n },\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedMatrix: true,\r\n attrColor: true,\r\n attrColor2: true,\r\n attrAlphaColor: true,\r\n cylinderSprite: useZSprites,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createLineSegmentsGeoTriplet(geo, renderParams) {\r\n const thickLines = geo.prototype instanceof ThickLinesGeometry;\r\n const lineWidth = renderParams.lineWidth || 0;\r\n return {\r\n Geometry: geo,\r\n Object: thickLines ? meshes.ThickLineMesh : meshes.LineSegments,\r\n initMaterial: setMatParams({\r\n lights: false,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n thickLine: thickLines,\r\n }, {\r\n lineWidth,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createSimpleGeoTriplet(geoClass) {\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.Mesh,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createIsoSurfaceGeoTriplet(geoClass, caps, settings, renderParams) {\r\n const surfaceOpts = {\r\n wireframe: !!renderParams.wireframe,\r\n fakeOpacity: settings.now.isoSurfaceFakeOpacity,\r\n zClip: renderParams.zClip,\r\n };\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.ZClipped,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: false,\r\n wireframe: surfaceOpts.wireframe,\r\n fakeOpacity: surfaceOpts.fakeOpacity,\r\n zClip: surfaceOpts.zClip,\r\n }),\r\n };\r\n}\r\n\r\nclass MeshCreator {\r\n static createSpheres(caps, settings) {\r\n const useZSprites = settings.now.zSprites;\r\n return {\r\n Geometry(a, b) {\r\n return new geometries.InstancedSpheresGeometry(a, b, useZSprites);\r\n },\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedPos: true,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n sphereSprite: useZSprites,\r\n }),\r\n };\r\n }\r\n\r\n static create2CClosedCylinders(_caps, _settings) {\r\n return _createInstancedCylinders(false, false);\r\n }\r\n\r\n static create2CCylinders(caps, settings) {\r\n return _createInstancedCylinders(settings.now.zSprites, true);\r\n }\r\n\r\n static create2CLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.TwoColorLinesGeometry, renderParams);\r\n }\r\n\r\n static createCrosses(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.CrossGeometry, renderParams);\r\n }\r\n\r\n static createExtrudedChains(_caps, _settings) {\r\n return _createSimpleGeoTriplet(geometries.ExtrudedObjectsGeometry);\r\n }\r\n\r\n static createChunkedLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.ChunkedLinesGeometry, renderParams);\r\n }\r\n\r\n static createQuickSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.QuickSurfGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createContactSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.ContactSurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createSASSES(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.SSIsosurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createLabels(_caps, _settings) {\r\n return {\r\n Geometry: geometries.LabelsGeometry,\r\n Object: meshes.Text,\r\n initMaterial() {\r\n },\r\n };\r\n }\r\n}\r\n\r\nexport default MeshCreator;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../gfxutils';\r\n\r\nclass TransformGroup extends THREE.Object3D {\r\n static _inverseMatrix = new THREE.Matrix4();\r\n\r\n static _ray = new THREE.Ray();\r\n\r\n constructor(geometry, geoParams, material, transforms) {\r\n super();\r\n this._geometry = geometry;\r\n this._geoParams = geoParams;\r\n const mat = material.createInstance();\r\n geoParams.initMaterial(mat);\r\n this._material = mat;\r\n this._transforms = transforms.length > 0 ? transforms : [new THREE.Matrix4()];\r\n const meshes = this._createMeshes(geometry);\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n this.add(meshes[i]);\r\n }\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const ray = TransformGroup._ray;\r\n const inverseMatrix = TransformGroup._inverseMatrix;\r\n const { children } = this;\r\n ray.copy(raycaster.ray);\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n\r\n if (!gfxutils.belongToSelectLayers(child)) {\r\n continue;\r\n }\r\n\r\n child.updateMatrixWorld();\r\n const mtx = child.matrixWorld;\r\n inverseMatrix.getInverse(mtx);\r\n raycaster.ray.copy(ray).applyMatrix4(inverseMatrix);\r\n const childIntersects = [];\r\n this._geometry.raycast(raycaster, childIntersects);\r\n\r\n for (let j = 0, ciCount = childIntersects.length; j < ciCount; ++j) {\r\n const inters = childIntersects[j];\r\n if (inters.point) {\r\n inters.point.applyMatrix4(mtx);\r\n inters.distance = ray.origin.distanceTo(inters.point);\r\n }\r\n inters.object = child;\r\n intersects[intersects.length] = inters;\r\n }\r\n }\r\n raycaster.ray.copy(ray);\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const geos = this._geometry.getSubset(chunkIndices);\r\n const subset = [];\r\n let subIdx = 0;\r\n\r\n for (let i = 0, n = geos.length; i < n; ++i) {\r\n const meshes = this._createMeshes(geos[i]);\r\n for (let j = 0, meshCnt = meshes.length; j < meshCnt; ++j) {\r\n subset[subIdx++] = meshes[j];\r\n }\r\n }\r\n\r\n return subset;\r\n }\r\n\r\n _createMeshes(geometry) {\r\n const transforms = this._transforms;\r\n const Mesh = this._geoParams.Object;\r\n const material = this._material;\r\n const meshes = [];\r\n for (let i = 0, n = transforms.length; i < n; ++i) {\r\n const mesh = new Mesh(geometry, material);\r\n mesh.applyMatrix(transforms[i]);\r\n\r\n meshes[i] = mesh;\r\n }\r\n\r\n return meshes;\r\n }\r\n}\r\n\r\nexport default TransformGroup;\r\n","import RCGroup from '../../RCGroup';\r\nimport TransformGroup from '../../meshes/TransformGroup';\r\n\r\nfunction wrapper(Name, args) {\r\n const params = [Name].concat(args);\r\n return Name.bind(...params);\r\n}\r\n\r\nclass ChemGroup extends RCGroup {\r\n constructor(geoParams, selection, colorer, mode, transforms, polyComplexity, material) {\r\n super();\r\n if (this.constructor === ChemGroup) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n this._selection = selection;\r\n this._mode = mode;\r\n this._colorer = colorer;\r\n this._chunksIdc = selection.chunks;\r\n this._polyComplexity = polyComplexity;\r\n this._geo = new (wrapper(geoParams.Geometry, this._makeGeoArgs()))();\r\n this._mesh = new TransformGroup(this._geo, geoParams, material, transforms);\r\n this.add(this._mesh);\r\n this._build();\r\n }\r\n\r\n _makeGeoArgs() {\r\n throw new Error('ChemGroup subclass must override _makeGeoArgs() method');\r\n }\r\n\r\n /**\r\n * Builds subset geometry by ATOMS index list\r\n *\r\n * @param {Number} mask - Representation mask\r\n * @param {Boolean} innerOnly - if true returns inner bonds only - without halves\r\n * @returns {Array} Subset geometry\r\n */\r\n getSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : false;\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return [];\r\n }\r\n return this._mesh.getSubset(chunksList);\r\n }\r\n\r\n _changeSubsetOpacity(mask, value, innerOnly) {\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return;\r\n }\r\n this._geo.setOpacity(chunksList, value);\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 1.0, innerOnly);\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 0.0, innerOnly);\r\n }\r\n}\r\n\r\nexport default ChemGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass AtomsGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { atoms } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const atomsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const atomIdx = atomsIdc[inters[i].chunkIdx];\r\n if (atomIdx < atoms.length) {\r\n inters[i].atom = atoms[atomIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { atoms } = this._selection;\r\n const atomsIdc = this._chunksIdc;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n if ((atom.mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default AtomsGroup;\r\n","import AtomsGroup from './AtomsGroup';\r\n\r\nclass AtomsSphereGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, atom.position, mode.calcAtomRadius(atom));\r\n geo.setColor(i, colorer.getAtomColor(atom, parent));\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), mode.calcAtomRadius(atom));\r\n if (updateColor) {\r\n geo.setColor(i, frameData.getAtomColor(colorer, atom));\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsSphereGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSurfaceGroup extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n return [n, opts];\r\n }\r\n}\r\nexport default AtomsSurfaceGroup;\r\n","/* This is a stub class keep it until SAS/SES is refactored */\r\n\r\nimport AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSASSESGroupStub extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n opts.selection = this._selection;\r\n opts.colorMode = this._colorer;\r\n return [n, opts];\r\n }\r\n}\r\n\r\nexport default AtomsSASSESGroupStub;\r\n","import AtomsGroup from './AtomsGroup';\r\nimport utils from '../../../utils';\r\n\r\nfunction adjustColor(color) {\r\n let r = (color >> 16) & 255;\r\n let g = (color >> 8) & 255;\r\n let b = color & 255;\r\n\r\n if (0.2126 * r + 0.7152 * g + 0.0722 * b > 127) {\r\n r = r * 3 / 10;\r\n g = g * 3 / 10;\r\n b = b * 3 / 10;\r\n } else {\r\n r = 255 - ((255 - r) * 3 / 10);\r\n g = 255 - ((255 - g) * 3 / 10);\r\n b = 255 - ((255 - b) * 3 / 10);\r\n }\r\n\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\nfunction inverseColor(color) {\r\n const r = (color >> 16) & 255;\r\n const g = (color >> 8) & 255;\r\n const b = color & 255;\r\n\r\n return ((255 - r) << 16) | ((255 - g) << 8) | (255 - b);\r\n}\r\n\r\nfunction getAtomText(atom) {\r\n if (atom.name.getNode() !== null) {\r\n return atom.name.getNode();\r\n }\r\n\r\n return atom.getVisualName();\r\n}\r\n\r\nconst colorMappings = {\r\n none(c) {\r\n return c;\r\n },\r\n adjust: adjustColor,\r\n inverse: inverseColor,\r\n};\r\n\r\nfunction propagateColor(color, rule) {\r\n let result;\r\n if (colorMappings.hasOwnProperty(rule)) {\r\n result = utils.hexColor(colorMappings[rule](color));\r\n } else {\r\n const val = parseInt(rule, 16);\r\n if (!Number.isNaN(val) && rule.toLowerCase().startsWith('0x')) {\r\n result = utils.hexColor(val);\r\n } else {\r\n result = '#000000';\r\n }\r\n }\r\n return result;\r\n}\r\n\r\nconst templateMappings = {\r\n serial(a) {\r\n return a.serial;\r\n },\r\n name(a) {\r\n return a.getVisualName();\r\n },\r\n elem(a) {\r\n return a.element.name;\r\n },\r\n residue(a) {\r\n return a.residue.getType().getName();\r\n },\r\n sequence(a) {\r\n return a.residue.getSequence();\r\n },\r\n chain(a) {\r\n return a.residue.getChain().getName();\r\n },\r\n hetatm(a) {\r\n return a.isHet();\r\n },\r\n water(a) {\r\n return a.residue.getType().getName() === 'HOH' || a.residue.getType().getName() === 'WAT';\r\n },\r\n};\r\n\r\nconst parseTemplate = function (atom, str) {\r\n return str.replace(/\\{\\{(\\s*\\w+\\s*)\\}\\}/g, (m) => {\r\n let key = m.replace(/\\s+/g, '');\r\n key = key.substring(2, key.length - 2).toLowerCase();\r\n\r\n if (templateMappings.hasOwnProperty(key)) {\r\n return templateMappings[key](atom);\r\n }\r\n return 'null';\r\n });\r\n};\r\n\r\nclass AtomsTextGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n const opts = this._mode.getLabelOpts();\r\n return [this._selection.chunks.length, opts];\r\n }\r\n\r\n _build() {\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = colorer.getAtomColor(atom, parent);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, atom.position, text);\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = frameData.getAtomColor(colorer, atom);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), text);\r\n if (updateColor) {\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsTextGroup;\r\n","import * as THREE from 'three';\r\nimport AtomsGroup from './AtomsGroup';\r\n\r\nfunction _slerp(omega, v1, v2, t) {\r\n const oSin = Math.sin(omega);\r\n return v1.clone().multiplyScalar(Math.sin((1 - t) * omega) / oSin).addScaledVector(v2, Math.sin(t * omega) / oSin);\r\n}\r\n\r\nclass AromaticGroup extends AtomsGroup {\r\n _buildInner(radOffset, addChunk) {\r\n const chunksToIdx = this._selection.chunks;\r\n\r\n const prevVector = new THREE.Vector3();\r\n const currVector = new THREE.Vector3();\r\n const segmentsHeight = this._segmentsHeight;\r\n const leprStep = 1.0 / segmentsHeight;\r\n const colorer = this._colorer;\r\n\r\n const { cycles, parent } = this._selection;\r\n let chunkIdx = 0;\r\n let currAtomIdx = chunksToIdx[chunkIdx];\r\n\r\n for (let cIdx = 0, cCount = cycles.length; cIdx < cCount; ++cIdx) {\r\n const cycle = cycles[cIdx];\r\n const cycAtoms = cycle.atoms;\r\n const chunkPoints = [];\r\n const tmpDir = [];\r\n const { center } = cycle;\r\n const cycleRad = cycle.radius - radOffset;\r\n const n = cycAtoms.length;\r\n let i = 0;\r\n const prevPos = cycAtoms[n - 1].position;\r\n let currPos = cycAtoms[i].position;\r\n prevVector.subVectors(prevPos, center);\r\n currVector.subVectors(currPos, center);\r\n const upDir = currVector.clone().cross(prevVector).normalize();\r\n\r\n\r\n for (; i < n; ++i) {\r\n const omega = prevVector.angleTo(currVector);\r\n tmpDir[i] = _slerp(omega, prevVector, currVector, 0.5).normalize();\r\n currPos = cycAtoms[(i + 1) % n].position;\r\n prevVector.copy(currVector);\r\n currVector.subVectors(currPos, center);\r\n }\r\n\r\n for (i = 0; i < n; ++i) {\r\n if (cycAtoms[i].index !== currAtomIdx) {\r\n continue;\r\n }\r\n const start = tmpDir[i];\r\n const end = tmpDir[(i + 1) % n];\r\n const color = colorer.getAtomColor(cycAtoms[i], parent);\r\n const currAngle = start.angleTo(end);\r\n\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n chunkPoints[j] = _slerp(currAngle, start, end, j * leprStep).multiplyScalar(cycleRad).add(center);\r\n }\r\n\r\n addChunk(chunkIdx++, color, chunkPoints, center, upDir);\r\n currAtomIdx = chunksToIdx[chunkIdx];\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default AromaticGroup;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../../gfxutils';\r\nimport AromaticGroup from './AromaticGroup';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n for (let i = 0; i < parts; ++i) {\r\n const a = -2 * i / parts * Math.PI;\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\nconst { calcChunkMatrix } = gfxutils;\r\n\r\nclass AromaticTorusGroup extends AromaticGroup {\r\n _build() {\r\n const segmentsHeight = this._segmentsHeight;\r\n const torusRad = this._mode.getAromRadius();\r\n const radiusV = new THREE.Vector2(torusRad, torusRad);\r\n const radOffset = this._mode.calcStickRadius() + 2 * torusRad;\r\n const lookAtVector = new THREE.Vector3();\r\n const mtc = [];\r\n const geo = this._geo;\r\n this._buildInner(radOffset, (chunkIdx, color, points, center, upDir) => {\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n const currDir = currPoint.clone().sub(center).cross(upDir);\r\n lookAtVector.addVectors(currPoint, currDir);\r\n mtc[j] = calcChunkMatrix(currPoint, lookAtVector, upDir, radiusV);\r\n }\r\n geo.setItem(chunkIdx, mtc);\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._polyComplexity;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length];\r\n }\r\n}\r\n\r\nexport default AromaticTorusGroup;\r\n","import AromaticGroup from './AromaticGroup';\r\n\r\nclass AromaticLinesGroup extends AromaticGroup {\r\n _build() {\r\n const geo = this._geo;\r\n const radOffset = this._mode.getAromaticOffset();\r\n this._buildInner(radOffset, (chunkIdx, color, points) => {\r\n let prevPt = points[0];// do not replace with start\r\n for (let j = 1; j <= this._segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n geo.setSegment(chunkIdx, j - 1, prevPt, currPoint);\r\n prevPt = currPoint;\r\n }\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._mode.getAromaticArcChunks();\r\n return [this._selection.chunks.length, this._segmentsHeight, true];\r\n }\r\n}\r\n\r\nexport default AromaticLinesGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[inters[i].chunkIdx];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesGroup;\r\n","import ResiduesGroup from './ResiduesGroup';\r\n\r\nclass NucleicItemGroup extends ResiduesGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[Math.floor(inters[i].chunkIdx / 2)];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n let chunkIdx = 0;\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList[chunkIdx++] = 2 * i;\r\n chunksList[chunkIdx++] = 2 * i + 1;\r\n }\r\n }\r\n return chunksList;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finishUpdate();\r\n }\r\n}\r\n\r\nexport default NucleicItemGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicCylindersGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n geo.setItem(chunkIdx, cyl1, cyl2, stickRad);\r\n geo.setColor(chunkIdx, color, color);\r\n }\r\n}\r\n\r\nexport default NucleicCylindersGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicSpheresGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length * 2, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n let idx = chunkIdx * 2;\r\n geo.setItem(idx, cyl1, stickRad);\r\n geo.setColor(idx, color);\r\n idx++;\r\n geo.setItem(idx, cyl2, stickRad);\r\n geo.setColor(idx, color);\r\n }\r\n}\r\n\r\nexport default NucleicSpheresGroup;\r\n","\r\n/*\r\nSmooth.js version 0.1.7\r\n\r\nTurn arrays into smooth functions.\r\n\r\nCopyright 2012 Spencer Cohen\r\nLicensed under MIT license (see \"Smooth.js MIT license.txt\")\r\n*/\r\n\r\n/*Constants (these are accessible by Smooth.WHATEVER in user space)\r\n*/\r\n\r\n(function() {\r\n var AbstractInterpolator, CubicInterpolator, Enum, LinearInterpolator, NearestInterpolator, PI, SincFilterInterpolator, Smooth, clipClamp, clipMirror, clipPeriodic, defaultConfig, getColumn, getType, isValidNumber, k, makeLanczosWindow, makeScaledFunction, makeSincKernel, normalizeScaleTo, shallowCopy, sin, sinc, v, validateNumber, validateVector,\r\n __hasProp = Object.prototype.hasOwnProperty,\r\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };\r\n\r\n Enum = {\r\n /*Interpolation methods\r\n */\r\n METHOD_NEAREST: 'nearest',\r\n METHOD_LINEAR: 'linear',\r\n METHOD_CUBIC: 'cubic',\r\n METHOD_LANCZOS: 'lanczos',\r\n METHOD_SINC: 'sinc',\r\n /*Input clipping modes\r\n */\r\n CLIP_CLAMP: 'clamp',\r\n CLIP_ZERO: 'zero',\r\n CLIP_PERIODIC: 'periodic',\r\n CLIP_MIRROR: 'mirror',\r\n /* Constants for control over the cubic interpolation tension\r\n */\r\n CUBIC_TENSION_DEFAULT: 0,\r\n CUBIC_TENSION_CATMULL_ROM: 0\r\n };\r\n\r\n defaultConfig = {\r\n method: Enum.METHOD_CUBIC,\r\n cubicTension: Enum.CUBIC_TENSION_DEFAULT,\r\n clip: Enum.CLIP_CLAMP,\r\n scaleTo: 0,\r\n sincFilterSize: 2,\r\n sincWindow: void 0\r\n };\r\n\r\n /*Index clipping functions\r\n */\r\n\r\n clipClamp = function(i, n) {\r\n return Math.max(0, Math.min(i, n - 1));\r\n };\r\n\r\n clipPeriodic = function(i, n) {\r\n i = i % n;\r\n if (i < 0) i += n;\r\n return i;\r\n };\r\n\r\n clipMirror = function(i, n) {\r\n var period;\r\n period = 2 * (n - 1);\r\n i = clipPeriodic(i, period);\r\n if (i > n - 1) i = period - i;\r\n return i;\r\n };\r\n\r\n /*\r\n Abstract scalar interpolation class which provides common functionality for all interpolators\r\n \r\n Subclasses must override interpolate().\r\n */\r\n\r\n AbstractInterpolator = (function() {\r\n\r\n function AbstractInterpolator(array, config) {\r\n this.array = array.slice(0);\r\n this.length = this.array.length;\r\n if (!(this.clipHelper = {\r\n clamp: this.clipHelperClamp,\r\n zero: this.clipHelperZero,\r\n periodic: this.clipHelperPeriodic,\r\n mirror: this.clipHelperMirror\r\n }[config.clip])) {\r\n throw \"Invalid clip: \" + config.clip;\r\n }\r\n }\r\n\r\n AbstractInterpolator.prototype.getClippedInput = function(i) {\r\n if ((0 <= i && i < this.length)) {\r\n return this.array[i];\r\n } else {\r\n return this.clipHelper(i);\r\n }\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperClamp = function(i) {\r\n return this.array[clipClamp(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperZero = function(i) {\r\n return 0;\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperPeriodic = function(i) {\r\n return this.array[clipPeriodic(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperMirror = function(i) {\r\n return this.array[clipMirror(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.interpolate = function(t) {\r\n throw 'Subclasses of AbstractInterpolator must override the interpolate() method.';\r\n };\r\n\r\n return AbstractInterpolator;\r\n\r\n })();\r\n\r\n NearestInterpolator = (function(_super) {\r\n\r\n __extends(NearestInterpolator, _super);\r\n\r\n function NearestInterpolator() {\r\n NearestInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n NearestInterpolator.prototype.interpolate = function(t) {\r\n return this.getClippedInput(Math.round(t));\r\n };\r\n\r\n return NearestInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n LinearInterpolator = (function(_super) {\r\n\r\n __extends(LinearInterpolator, _super);\r\n\r\n function LinearInterpolator() {\r\n LinearInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n LinearInterpolator.prototype.interpolate = function(t) {\r\n var k;\r\n k = Math.floor(t);\r\n t -= k;\r\n return (1 - t) * this.getClippedInput(k) + t * this.getClippedInput(k + 1);\r\n };\r\n\r\n return LinearInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n CubicInterpolator = (function(_super) {\r\n\r\n __extends(CubicInterpolator, _super);\r\n\r\n function CubicInterpolator(array, config) {\r\n this.tangentFactor = 1 - Math.max(-1, Math.min(1, config.cubicTension));\r\n CubicInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n CubicInterpolator.prototype.getTangent = function(k) {\r\n return this.tangentFactor * (this.getClippedInput(k + 1) - this.getClippedInput(k - 1)) / 2;\r\n };\r\n\r\n CubicInterpolator.prototype.interpolate = function(t) {\r\n var k, m, p, t2, t3;\r\n k = Math.floor(t);\r\n m = [this.getTangent(k), this.getTangent(k + 1)];\r\n p = [this.getClippedInput(k), this.getClippedInput(k + 1)];\r\n t -= k;\r\n t2 = t * t;\r\n t3 = t * t2;\r\n return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + (-2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1];\r\n };\r\n\r\n return CubicInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n sin = Math.sin, PI = Math.PI;\r\n\r\n sinc = function(x) {\r\n if (x === 0) {\r\n return 1;\r\n } else {\r\n return sin(PI * x) / (PI * x);\r\n }\r\n };\r\n\r\n makeLanczosWindow = function(a) {\r\n return function(x) {\r\n return sinc(x / a);\r\n };\r\n };\r\n\r\n makeSincKernel = function(window) {\r\n return function(x) {\r\n return sinc(x) * window(x);\r\n };\r\n };\r\n\r\n SincFilterInterpolator = (function(_super) {\r\n\r\n __extends(SincFilterInterpolator, _super);\r\n\r\n function SincFilterInterpolator(array, config) {\r\n SincFilterInterpolator.__super__.constructor.apply(this, arguments);\r\n this.a = config.sincFilterSize;\r\n if (!config.sincWindow) throw 'No sincWindow provided';\r\n this.kernel = makeSincKernel(config.sincWindow);\r\n }\r\n\r\n SincFilterInterpolator.prototype.interpolate = function(t) {\r\n var k, n, sum, _ref, _ref2;\r\n k = Math.floor(t);\r\n sum = 0;\r\n for (n = _ref = k - this.a + 1, _ref2 = k + this.a; _ref <= _ref2 ? n <= _ref2 : n >= _ref2; _ref <= _ref2 ? n++ : n--) {\r\n sum += this.kernel(t - n) * this.getClippedInput(n);\r\n }\r\n return sum;\r\n };\r\n\r\n return SincFilterInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n getColumn = function(arr, i) {\r\n var row, _i, _len, _results;\r\n _results = [];\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n row = arr[_i];\r\n _results.push(row[i]);\r\n }\r\n return _results;\r\n };\r\n\r\n makeScaledFunction = function(f, baseScale, scaleRange) {\r\n var scaleFactor, translation;\r\n if (scaleRange.join === '0,1') {\r\n return f;\r\n } else {\r\n scaleFactor = baseScale / (scaleRange[1] - scaleRange[0]);\r\n translation = scaleRange[0];\r\n return function(t) {\r\n return f(scaleFactor * (t - translation));\r\n };\r\n }\r\n };\r\n\r\n getType = function(x) {\r\n return Object.prototype.toString.call(x).slice('[object '.length, -1);\r\n };\r\n\r\n validateNumber = function(n) {\r\n if (isNaN(n)) throw 'NaN in Smooth() input';\r\n if (getType(n) !== 'Number') throw 'Non-number in Smooth() input';\r\n if (!isFinite(n)) throw 'Infinity in Smooth() input';\r\n };\r\n\r\n validateVector = function(v, dimension) {\r\n var n, _i, _len;\r\n if (getType(v) !== 'Array') throw 'Non-vector in Smooth() input';\r\n if (v.length !== dimension) throw 'Inconsistent dimension in Smooth() input';\r\n for (_i = 0, _len = v.length; _i < _len; _i++) {\r\n n = v[_i];\r\n validateNumber(n);\r\n }\r\n };\r\n\r\n isValidNumber = function(n) {\r\n return (getType(n) === 'Number') && isFinite(n) && !isNaN(n);\r\n };\r\n\r\n normalizeScaleTo = function(s) {\r\n var invalidErr;\r\n invalidErr = \"scaleTo param must be number or array of two numbers\";\r\n switch (getType(s)) {\r\n case 'Number':\r\n if (!isValidNumber(s)) throw invalidErr;\r\n s = [0, s];\r\n break;\r\n case 'Array':\r\n if (s.length !== 2) throw invalidErr;\r\n if (!(isValidNumber(s[0]) && isValidNumber(s[1]))) throw invalidErr;\r\n break;\r\n default:\r\n throw invalidErr;\r\n }\r\n return s;\r\n };\r\n\r\n shallowCopy = function(obj) {\r\n var copy, k, v;\r\n copy = {};\r\n for (k in obj) {\r\n if (!__hasProp.call(obj, k)) continue;\r\n v = obj[k];\r\n copy[k] = v;\r\n }\r\n return copy;\r\n };\r\n\r\n Smooth = function(arr, config) {\r\n var baseDomainEnd, dimension, i, interpolator, interpolatorClass, interpolators, k, n, properties, smoothFunc, v;\r\n if (config == null) config = {};\r\n properties = {};\r\n config = shallowCopy(config);\r\n properties.config = shallowCopy(config);\r\n if (config.scaleTo == null) config.scaleTo = config.period;\r\n if (config.sincFilterSize == null) {\r\n config.sincFilterSize = config.lanczosFilterSize;\r\n }\r\n for (k in defaultConfig) {\r\n if (!__hasProp.call(defaultConfig, k)) continue;\r\n v = defaultConfig[k];\r\n if (config[k] == null) config[k] = v;\r\n }\r\n if (!(interpolatorClass = {\r\n nearest: NearestInterpolator,\r\n linear: LinearInterpolator,\r\n cubic: CubicInterpolator,\r\n lanczos: SincFilterInterpolator,\r\n sinc: SincFilterInterpolator\r\n }[config.method])) {\r\n throw \"Invalid method: \" + config.method;\r\n }\r\n if (config.method === 'lanczos') {\r\n config.sincWindow = makeLanczosWindow(config.sincFilterSize);\r\n }\r\n if (arr.length < 2) throw 'Array must have at least two elements';\r\n properties.count = arr.length;\r\n smoothFunc = (function() {\r\n var _i, _j, _len, _len2;\r\n switch (getType(arr[0])) {\r\n case 'Number':\r\n properties.dimension = 'scalar';\r\n if (Smooth.deepValidation) {\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n n = arr[_i];\r\n validateNumber(n);\r\n }\r\n }\r\n interpolator = new interpolatorClass(arr, config);\r\n return function(t) {\r\n return interpolator.interpolate(t);\r\n };\r\n case 'Array':\r\n properties.dimension = dimension = arr[0].length;\r\n if (!dimension) throw 'Vectors must be non-empty';\r\n if (Smooth.deepValidation) {\r\n for (_j = 0, _len2 = arr.length; _j < _len2; _j++) {\r\n v = arr[_j];\r\n validateVector(v, dimension);\r\n }\r\n }\r\n interpolators = (function() {\r\n var _results;\r\n _results = [];\r\n for (i = 0; 0 <= dimension ? i < dimension : i > dimension; 0 <= dimension ? i++ : i--) {\r\n _results.push(new interpolatorClass(getColumn(arr, i), config));\r\n }\r\n return _results;\r\n })();\r\n return function(t) {\r\n var interpolator, _k, _len3, _results;\r\n _results = [];\r\n for (_k = 0, _len3 = interpolators.length; _k < _len3; _k++) {\r\n interpolator = interpolators[_k];\r\n _results.push(interpolator.interpolate(t));\r\n }\r\n return _results;\r\n };\r\n default:\r\n throw \"Invalid element type: \" + (getType(arr[0]));\r\n }\r\n })();\r\n if (config.clip === 'periodic') {\r\n baseDomainEnd = arr.length;\r\n } else {\r\n baseDomainEnd = arr.length - 1;\r\n }\r\n config.scaleTo || (config.scaleTo = baseDomainEnd);\r\n properties.domain = normalizeScaleTo(config.scaleTo);\r\n smoothFunc = makeScaledFunction(smoothFunc, baseDomainEnd, properties.domain);\r\n properties.domain.sort();\r\n /*copy properties\r\n */\r\n for (k in properties) {\r\n if (!__hasProp.call(properties, k)) continue;\r\n v = properties[k];\r\n smoothFunc[k] = v;\r\n }\r\n return smoothFunc;\r\n };\r\n\r\n for (k in Enum) {\r\n if (!__hasProp.call(Enum, k)) continue;\r\n v = Enum[k];\r\n Smooth[k] = v;\r\n }\r\n\r\n Smooth.deepValidation = true;\r\n\r\n (typeof exports !== \"undefined\" && exports !== null ? exports : window).Smooth = Smooth;\r\n\r\n}).call(this);\r\n","import * as THREE from 'three';\r\nimport { Smooth } from '../../../../vendor/js/Smooth';\r\nimport gfxutils from '../../gfxutils';\r\nimport chem from '../../../chem';\r\n\r\nconst { ResidueType } = chem;\r\n\r\nconst calcMatrix = gfxutils.calcChunkMatrix;\r\n\r\nfunction _buildStructureInterpolator(points, tension) {\r\n const path = Smooth(points, {\r\n method: Smooth.METHOD_CUBIC,\r\n clip: Smooth.CLIP_CLAMP,\r\n cubicTension: tension,\r\n scaleTo: 1,\r\n });\r\n\r\n return function (t, argTrans) {\r\n let transformT = argTrans;\r\n if (transformT === null) {\r\n // map our range to the [second .. last but one]\r\n transformT = function (tt) {\r\n return (tt * ((points.length - 1) - 2) + 1) / (points.length - 1);\r\n };\r\n }\r\n const newt = transformT(t);\r\n const ans = path(newt);\r\n return new THREE.Vector3(ans[0], ans[1], ans[2]);\r\n };\r\n}\r\n\r\nfunction _addPoints(centerPoints, topPoints, idx, residue) {\r\n if (!residue._isValid) {\r\n centerPoints[idx] = centerPoints[idx - 1];\r\n topPoints[idx] = topPoints[idx - 1];\r\n return;\r\n }\r\n const cp = residue._controlPoint;\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n const tp = cp.clone().add(residue._wingVector);\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n}\r\n\r\nfunction _addPointsForLoneResidue(centerPoints, topPoints, idx, residue) {\r\n const nucleic = (residue._type.flags & ResidueType.Flags.NUCLEIC) !== 0;\r\n const nameFrom = nucleic ? 'C5\\'' : 'N';\r\n const nameTo = nucleic ? 'C3\\'' : 'C';\r\n\r\n let posFrom;\r\n let posTo;\r\n residue.forEachAtom((atom) => {\r\n const name = atom.getVisualName();\r\n if (!posFrom && name === nameFrom) {\r\n posFrom = atom.position;\r\n } else if (!posTo && name === nameTo) {\r\n posTo = atom.position;\r\n }\r\n });\r\n\r\n // provide a fallback for unknown residues\r\n if (!(posFrom && posTo)) {\r\n posFrom = residue._firstAtom.position;\r\n posTo = residue._lastAtom.position;\r\n }\r\n\r\n if (posFrom && posTo) {\r\n const shift = posTo.clone().sub(posFrom);\r\n\r\n const wing = residue._wingVector;\r\n const cp = residue._controlPoint;\r\n const tp = cp.clone().add(wing);\r\n\r\n const cpPrev = cp.clone().sub(shift);\r\n const tpPrev = cpPrev.clone().add(wing);\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n ++idx;\r\n\r\n const cpNext = cp.clone().add(shift);\r\n const tpNext = cpNext.clone().add(wing);\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n ++idx;\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n }\r\n}\r\n\r\nfunction _calcPoints(residues, firstIdx, lastIdx, boundaries) {\r\n const left = boundaries.start;\r\n const right = boundaries.end;\r\n function _prevIdx(idx) {\r\n return idx > left && residues[idx - 1]._isValid ? idx - 1 : idx;\r\n }\r\n function _nextIdx(idx) {\r\n return idx < right && residues[idx + 1]._isValid ? idx + 1 : idx;\r\n }\r\n\r\n const topPoints = [];\r\n const centerPoints = [];\r\n let arrIdx = 0;\r\n function _extrapolate2(currIdx, otherIdx) {\r\n const cp = residues[currIdx]._controlPoint.clone().lerp(residues[otherIdx]._controlPoint, -0.25);\r\n const tp = cp.clone().add(residues[currIdx]._wingVector);\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n }\r\n\r\n // a single disconnected residue\r\n const prevIdx = _prevIdx(firstIdx);\r\n const nextIdx = _nextIdx(lastIdx);\r\n if (prevIdx === nextIdx) {\r\n _addPointsForLoneResidue(centerPoints, topPoints, arrIdx, residues[firstIdx]);\r\n return { centerPoints, topPoints };\r\n }\r\n\r\n // Two points (prev-prev and next-next) are added to support edge conditions for cubic splines, they are ignored\r\n // Another two (prev and next) were added to support the outside of the sub chain\r\n\r\n // prev and prev-prev\r\n if (firstIdx === prevIdx) {\r\n // do the extrapolation\r\n _extrapolate2(firstIdx, _nextIdx(firstIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[_prevIdx(prevIdx)]);\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[prevIdx]);\r\n }\r\n\r\n // main loop\r\n for (let idx = firstIdx; idx <= lastIdx; ++idx) {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[idx]);\r\n }\r\n\r\n // next and next-next\r\n if (nextIdx === _nextIdx(nextIdx)) {\r\n // do the extrapolation\r\n _extrapolate2(lastIdx, _prevIdx(lastIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[nextIdx]);\r\n _addPoints(centerPoints, topPoints, arrIdx, residues[_nextIdx(nextIdx)]);\r\n }\r\n return { centerPoints, topPoints };\r\n}\r\n\r\nclass CartoonHelper {\r\n constructor(residues, startIdx, endIdx, segmentsCount, tension, boundaries) {\r\n const pointsArrays = _calcPoints(residues, startIdx, endIdx, boundaries);\r\n this._topInterp = _buildStructureInterpolator(pointsArrays.topPoints, tension);\r\n this._centerInterp = _buildStructureInterpolator(pointsArrays.centerPoints, tension);\r\n\r\n this._shift = 0.5 / (endIdx - startIdx + 2);\r\n this._valueStep = (1.0 - 2 * this._shift) / (2 * (endIdx - startIdx + 1) * (segmentsCount - 1));\r\n this._segmentsCount = segmentsCount;\r\n }\r\n\r\n prepareMatrices(idx, firstRad, secondRad) {\r\n const mtcCount = this._segmentsCount;\r\n const outMtc = new Array(mtcCount);\r\n const currRad = new THREE.Vector2(0, 0);\r\n\r\n const topInterp = this._topInterp;\r\n const cenInterp = this._centerInterp;\r\n\r\n let currentValue = this._shift + this._valueStep * (mtcCount - 1) * idx;\r\n\r\n for (let mtxIdx = 0; mtxIdx < mtcCount; ++mtxIdx) {\r\n const lerpVal = Math.min(1.0, mtxIdx / (mtcCount - 1));\r\n currRad.lerpVectors(firstRad, secondRad, lerpVal);\r\n\r\n const currTop = topInterp(currentValue, null);\r\n const currCenter = cenInterp(currentValue, null);\r\n currentValue += this._valueStep;\r\n const nextCenter = cenInterp(currentValue, null);\r\n\r\n outMtc[mtxIdx] = calcMatrix(currCenter.clone(), nextCenter.clone(), currTop.clone().sub(currCenter), currRad);\r\n }\r\n\r\n return outMtc;\r\n }\r\n}\r\n\r\nexport default CartoonHelper;\r\n","import * as THREE from 'three';\r\nimport ResiduesGroup from './ResiduesGroup';\r\nimport CartoonHelper from './CartoonHelper';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n\r\n for (let i = 0; i < parts; ++i) {\r\n // starts from pi/2 because it's important that points are lied on the angles of arrows (visual issues if not)\r\n const a = Math.PI / 2.0 - 2 * Math.PI * i / parts;\r\n\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\n\r\nfunction _loopThrough(subDiv, residues, segmentsHeight, tension, mode, callback) {\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n const { boundaries } = subDiv[subDivI];\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const idc = [subs[i].start, subs[i].end];\r\n const matrixHelper = new CartoonHelper(residues, idc[0], idc[1], segmentsHeight, tension, boundaries);\r\n let prevLast = null;\r\n const startIdx = subs[i].start * 2;\r\n const endIdx = subs[i].end * 2 + 1;\r\n let prevSecondRad = mode.getResidueRadius(residues[0], 0);\r\n for (let idx = startIdx; idx <= endIdx; ++idx) {\r\n const resIdx = (idx / 2 | 0);\r\n const currRes = residues[resIdx];\r\n const firstRad = mode.getResidueRadius(currRes, idx % 2);\r\n const secondRad = mode.getResidueRadius(currRes, 1 + (idx % 2));\r\n\r\n const mtc = matrixHelper.prepareMatrices(idx - idc[0] * 2, firstRad, secondRad);\r\n mtc.unshift(prevLast === null ? mtc[0] : prevLast);\r\n\r\n // Slope - radius is changed along this residue part\r\n const hasSlope = (firstRad.x !== secondRad.x) || (firstRad.y !== secondRad.y);\r\n // Cut - end radius of previous part not equal to start radius of this part. First section of this part lies in the orthogonal plane\r\n const hasCut = (firstRad.x !== prevSecondRad.x) || (firstRad.y !== prevSecondRad.y);\r\n\r\n callback(currRes, mtc, hasSlope, hasCut);\r\n\r\n prevLast = mtc[segmentsHeight];\r\n prevSecondRad = secondRad;\r\n }\r\n }\r\n }\r\n}\r\n\r\nclass ResiduesSubseqGroup extends ResiduesGroup {\r\n _makeGeoArgs() {\r\n const cmpMultiplier = this._mode.getHeightSegmentsRatio();\r\n this._segmentsHeight = this._polyComplexity * cmpMultiplier | 0;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length * 2];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n _loopThrough(this._selection.subdivs, residues, this._segmentsHeight, tension, mode, (currRes, mtc, hasSlope = false, hasCut = false) => {\r\n const color = colorer.getResidueColor(currRes, parent);\r\n chunkIdc[chunkIdx] = currRes._index;\r\n geo.setItem(chunkIdx, mtc, hasSlope, hasCut);\r\n geo.setColor(chunkIdx++, color);\r\n });\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n const frameRes = frameData.getResidues();\r\n let chunkIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n _loopThrough(this._selection.subdivs, frameRes, this._segmentsHeight, tension, mode, (currRes, mtc) => {\r\n geo.setItem(chunkIdx, mtc);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n });\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default ResiduesSubseqGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesTraceGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const subDiv = this._selection.subdivs;\r\n let chunksCount = 0;\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n chunksCount += subs[i].end - subs[i].start;\r\n }\r\n }\r\n return [chunksCount, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n chunkIdc[chunkIdx] = { first: prevRes._index, second: currRes._index };\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n geo.finalize();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n const { residues } = this._selection;\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksToIdx = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const chunk = chunksToIdx[Math.floor(chunkIdx / 2)];\r\n const resIdx = chunkIdx % 2 === 0 ? chunk.first : chunk.second;\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const chunksToIdx = this._chunksIdc;\r\n const { residues } = this._selection;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const chunk = chunksToIdx[i];\r\n if (residues[chunk.first]._mask & mask) {\r\n chunksList.push(i * 2);\r\n }\r\n if (residues[chunk.second]._mask & mask) {\r\n chunksList.push(i * 2 + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesTraceGroup;\r\n","import ChemGroup from './ChemGroup';\r\nimport Bond from '../../../chem/Bond';\r\n\r\nfunction getCylinderCount(bondOrder) {\r\n return bondOrder < 2 ? 1 : bondOrder;\r\n}\r\n\r\nclass BondsGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const drawMultiple = this._mode.drawMultiorderBonds();\r\n const showAromatic = this._mode.showAromaticLoops();\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n let bondsCount = 0;\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n bondsCount += this.getBondOrder(bonds[bondsIdc[i]], drawMultiple, showAromatic);\r\n }\r\n return [bondsCount, this._polyComplexity];\r\n }\r\n\r\n getBondOrder(bond, drawMultiple, showAromatic) {\r\n let bondOrder = 1;\r\n if (drawMultiple && (!showAromatic || bond._type !== Bond.BondType.AROMATIC)) {\r\n bondOrder = getCylinderCount(bond._order);\r\n }\r\n return bondOrder;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const { bonds } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const bondsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const bondIdx = bondsIdc[Math.floor(chunkIdx / 2)];\r\n if (bondIdx < bonds.length) {\r\n const bond = bonds[bondIdx];\r\n inters[i].atom = chunkIdx % 2 === 0 ? bond._left : bond._right;\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask, innerOnly) {\r\n const chunksList = [];\r\n const { bonds } = this._selection;\r\n const chunksToIdx = this._chunksIdc;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const bond = bonds[chunksToIdx[i]];\r\n if ((bond._left.mask & mask) && (!innerOnly || (bond._right.mask & mask))) {\r\n chunksList.push(2 * i);\r\n }\r\n if ((bond._right.mask & mask) && (!innerOnly || (bond._left.mask & mask))) {\r\n chunksList.push(2 * i + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default BondsGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nclass BondsCylinderGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsCylinderGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nconst STEP_SIZE = 0.15;\r\n\r\nclass BondsLinesGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsLinesGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\nimport AtomsSurfaceGroup from './AtomsSurfaceGroup';\r\nimport AtomsSASSESGroupStub from './AtomsSASSESGroupStub';\r\nimport AtomsTextGroup from './AtomsTextGroup';\r\nimport AromaticTorusGroup from './AromaticTorusGroup';\r\nimport AromaticLinesGroup from './AromaticLinesGroup';\r\nimport NucleicCylindersGroup from './NucleicCylindersGroup';\r\nimport NucleicSpheresGroup from './NucleicSpheresGroup';\r\nimport ResiduesSubseqGroup from './ResiduesSubseqGroup';\r\nimport ResiduesTraceGroup from './ResiduesTraceGroup';\r\nimport BondsCylinderGroup from './BondsCylinderGroup';\r\nimport BondsLinesGroup from './BondsLinesGroup';\r\n\r\nexport default {\r\n AtomsSphereGroup,\r\n AtomsSurfaceGroup,\r\n AtomsSASSESGroupStub,\r\n AtomsTextGroup,\r\n AromaticTorusGroup,\r\n AromaticLinesGroup,\r\n NucleicCylindersGroup,\r\n NucleicSpheresGroup,\r\n ResiduesSubseqGroup,\r\n ResiduesTraceGroup,\r\n BondsCylinderGroup,\r\n BondsLinesGroup,\r\n};\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AtomsProcessor extends RCGroup {\r\n constructor(AtomsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n this._mode = mode;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let atomCount = 0;\r\n component.forEachAtom((atom) => {\r\n if (!self._checkAtom(atom, mask)) {\r\n return;\r\n }\r\n atomsIdc[atomCount++] = atom.index;\r\n });\r\n if (atomCount === 0) {\r\n return;\r\n }\r\n const atomsGroup = new AtomsGroup(geoParams, {\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n _checkAtom(atom, mask) {\r\n return atom.mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AtomsProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\n\r\nclass OrphanAtomsProcessor extends AtomsProcessor {\r\n _checkAtom(atom, mask) {\r\n if (!(atom.mask & mask)) {\r\n return false;\r\n }\r\n\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n if ((bonds[i]._left.mask & mask) && (bonds[i]._right.mask & mask)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n\r\nexport default OrphanAtomsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass ResiduesProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n component.forEachResidue((residue) => {\r\n if (self._checkResidue(residue, mask)) {\r\n resIdc[chunksCount++] = residue._index;\r\n }\r\n });\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n checkResidue(residue, mask) {\r\n return residue._mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default ResiduesProcessor;\r\n","import ResidueProcessor from './ResiduesProcessor';\r\n\r\nclass NucleicProcessor extends ResidueProcessor {\r\n _checkResidue(residue, mask) {\r\n return mask & residue._mask && residue._cylinders !== null;\r\n }\r\n}\r\nexport default NucleicProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass SubseqsProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const subDivs = component.getMaskedSubdivSequences(mask);\r\n\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n for (let subDivI = 0, subDivN = subDivs.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDivs[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let j = subs[i].start, jEnd = subs[i].end; j <= jEnd; ++j) {\r\n resIdc[chunksCount++] = residues[j]._index;\r\n }\r\n }\r\n }\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n subdivs: subDivs,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default SubseqsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass BondsProcessor extends RCGroup {\r\n constructor(BondsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const bonds = complex.getBonds();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const bondsIdc = [];\r\n let bondsCount = 0;\r\n component.forEachBond((bond) => {\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n if (!(atom1.mask & mask) || !(atom2.mask & mask)) {\r\n return;\r\n }\r\n bondsIdc[bondsCount++] = bond._index;\r\n });\r\n if (bondsCount === 0) {\r\n return;\r\n }\r\n const bondsGroup = new BondsGroup(geoParams, {\r\n bonds,\r\n chunks: bondsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n bondsGroup._component = component;\r\n self.add(bondsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default BondsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AromaticProcessor extends RCGroup {\r\n constructor(AromaticGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n if (!mode.showAromaticLoops()) {\r\n return;\r\n }\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let chunksCount = 0;\r\n const cycles = [];\r\n let cycleIdx = 0;\r\n component.forEachCycle((cycle) => {\r\n const cycAtoms = cycle.atoms;\r\n let perCycle = 0;\r\n for (let i = 0, n = cycAtoms.length; i < n; ++i) {\r\n if ((cycAtoms[i].mask & mask) !== 0) {\r\n ++perCycle;\r\n atomsIdc[chunksCount++] = cycAtoms[i].index;\r\n }\r\n }\r\n if (perCycle > 0) {\r\n cycles[cycleIdx++] = cycle;\r\n }\r\n });\r\n\r\n const atomsGroup = new AromaticGroup(geoParams, {\r\n cycles,\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AromaticProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\nimport OrphanAtomsProcessor from './OrphanAtomsProcessor';\r\nimport ResiduesProcessor from './ResiduesProcessor';\r\nimport NucleicProcessor from './NucleicProcessor';\r\nimport SubseqsProcessor from './SubseqsProcessor';\r\nimport BondsProcessor from './BondsProcessor';\r\nimport AromaticProcessor from './AromaticProcessor';\r\n\r\nexport default {\r\n Atoms: AtomsProcessor,\r\n OrphanAtoms: OrphanAtomsProcessor,\r\n Residues: ResiduesProcessor,\r\n Nucleic: NucleicProcessor,\r\n Subseqs: SubseqsProcessor,\r\n Bonds: BondsProcessor,\r\n Aromatic: AromaticProcessor,\r\n};\r\n","import MeshCreator from '../../meshes/MeshCreator';\r\nimport groups from './groups';\r\nimport processors from '../processors/processors';\r\n\r\nfunction _bakeGroup(triplet, Processor, Group) {\r\n return function (complex, colorer, mode, polyComplexity, mask, material) {\r\n return new Processor(Group, triplet, complex, colorer, mode, polyComplexity, mask, material);\r\n };\r\n}\r\n\r\nclass GroupsFactory {\r\n static AtomsSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static OrphanedAtomsCrosses(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createCrosses(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.OrphanAtoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static BondsCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsCylinderGroup);\r\n }\r\n\r\n static BondsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.create2CLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsLinesGroup);\r\n }\r\n\r\n static CartoonChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesSubseqGroup);\r\n }\r\n\r\n static TraceChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CClosedCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesTraceGroup);\r\n }\r\n\r\n static NucleicSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicSpheresGroup);\r\n }\r\n\r\n static NucleicCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicCylindersGroup);\r\n }\r\n\r\n static ALoopsTorus(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticTorusGroup);\r\n }\r\n\r\n static ALoopsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createChunkedLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticLinesGroup);\r\n }\r\n\r\n static QuickSurfGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createQuickSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static ContactSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createContactSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static SASSESSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createSASSES(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSASSESGroupStub);\r\n }\r\n\r\n static TextLabelsGeo(caps, settings) {\r\n const gfxTriplet = MeshCreator.createLabels(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsTextGroup);\r\n }\r\n}\r\n\r\nexport default GroupsFactory;\r\n","import _ from 'lodash';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport factory from './groups/GroupsFactory';\r\n\r\n/**\r\n * Create new mode.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the mode after its creation.\r\n *\r\n * @exports Mode\r\n * @this Mode\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available modes used for building and displaying molecule geometry.\r\n */\r\nclass Mode {\r\n constructor(opts) {\r\n if (this.constructor === Mode) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Mode options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(this.settings.now.modes[this.id], true), opts);\r\n }\r\n\r\n\r\n /**\r\n * Get mode identification, probably with options.\r\n * @returns {string|Array} Mode identifier string ({@link Mode#id}) or two-element array containing both mode\r\n * identifier and options ({@link Mode#opts}).\r\n * Options are returned if they were changed during or after the mode creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, this.settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const polyComplexity = this.opts.polyComplexity ? this.opts.polyComplexity[this.settings.now.resolution] : 0;\r\n const groupList = this.depGroups;\r\n const groupCount = groupList.length;\r\n const group = new gfxutils.RCGroup();\r\n const self = this;\r\n for (let i = 0; i < groupCount; ++i) {\r\n let currGroup = groupList[i];\r\n let renderParams = {};\r\n if (_.isArray(currGroup)) {\r\n renderParams = currGroup[1].call(this);\r\n [currGroup] = currGroup;\r\n }\r\n const Group = factory[currGroup](null, this.settings, renderParams);\r\n const newGroup = new Group(complex, colorer, self, polyComplexity, mask, material);\r\n if (newGroup.children.length > 0) {\r\n group.add(newGroup);\r\n }\r\n }\r\n return group;\r\n }\r\n}\r\n\r\nmakeContextDependent(Mode.prototype);\r\n\r\n/**\r\n* Mode identifier.\r\n* @type {string}\r\n*/\r\nMode.prototype.id = '__';\r\n\r\n/**\r\n * Mode geo groups.\r\n * @type {Array}\r\n */\r\nMode.prototype.depGroups = [];\r\n\r\nexport default Mode;\r\n","import Mode from './Mode';\r\n\r\nfunction getRenderParams() {\r\n return {\r\n lineWidth: this.opts.lineWidth,\r\n };\r\n}\r\n\r\nclass LinesMode extends Mode {\r\n static id = 'LN';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const groups = this.depGroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n groups[i] = [groups[i], getRenderParams];\r\n }\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n\r\n calcAtomRadius() {\r\n return this.opts.atom;\r\n }\r\n\r\n getAromaticOffset() {\r\n return this.opts.offsarom;\r\n }\r\n\r\n getAromaticArcChunks() {\r\n return this.opts.chunkarom;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n}\r\n\r\nLinesMode.prototype.id = 'LN';\r\nLinesMode.prototype.name = 'Lines';\r\nLinesMode.prototype.shortName = 'Lines';\r\nLinesMode.prototype.depGroups = [\r\n 'ALoopsLines',\r\n 'BondsLines',\r\n 'OrphanedAtomsCrosses',\r\n];\r\n\r\nexport default LinesMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass LicoriceMode extends Mode {\r\n static id = 'LC';\r\n\r\n calcAtomRadius(_atom) {\r\n return this.opts.bond;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nLicoriceMode.prototype.id = 'LC';\r\nLicoriceMode.prototype.name = 'Licorice';\r\nLicoriceMode.prototype.shortName = 'Licorice';\r\nLicoriceMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default LicoriceMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass BallsAndSticksMode extends Mode {\r\n static id = 'BS';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius * this.opts.atom;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nBallsAndSticksMode.prototype.id = 'BS';\r\nBallsAndSticksMode.prototype.name = 'Balls and Sticks';\r\nBallsAndSticksMode.prototype.shortName = 'Balls';\r\nBallsAndSticksMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default BallsAndSticksMode;\r\n","import Mode from './Mode';\r\n\r\nclass VanDerWaalsMode extends Mode {\r\n static id = 'VW';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n}\r\n\r\nVanDerWaalsMode.prototype.id = 'VW';\r\nVanDerWaalsMode.prototype.name = 'Van der Waals';\r\nVanDerWaalsMode.prototype.shortName = 'VDW';\r\nVanDerWaalsMode.prototype.depGroups = ['AtomsSpheres'];\r\n\r\nexport default VanDerWaalsMode;\r\n","import Mode from './Mode';\r\n\r\nclass TraceMode extends Mode {\r\n static id = 'TR';\r\n\r\n calcStickRadius() {\r\n return this.opts.radius;\r\n }\r\n}\r\n\r\nTraceMode.prototype.id = 'TR';\r\nTraceMode.prototype.name = 'Trace';\r\nTraceMode.prototype.shortName = 'Trace';\r\nTraceMode.prototype.depGroups = ['TraceChains'];\r\n\r\nexport default TraceMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass TubeMode extends Mode {\r\n static id = 'TU';\r\n\r\n getResidueRadius(_residue) {\r\n return this.TUBE_RADIUS;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const rad = this.opts.radius;\r\n this.TUBE_RADIUS = new THREE.Vector2(rad, rad);\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nTubeMode.prototype.id = 'TU';\r\nTubeMode.prototype.name = 'Tube';\r\nTubeMode.prototype.shortName = 'Tube';\r\nTubeMode.prototype.depGroups = ['CartoonChains'];\r\n\r\nexport default TubeMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass CartoonMode extends Mode {\r\n static id = 'CA';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n // cache for secondary structure options\r\n this.secCache = {};\r\n }\r\n\r\n getResidueStartRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (!second || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return secOpts.start;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueEndRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (second === null || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return this.ARROW_END;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueRadius(residue, val) {\r\n const startRad = this.getResidueStartRadius(residue);\r\n if (val === 0) {\r\n return startRad;\r\n }\r\n\r\n const endRad = this.getResidueEndRadius(residue);\r\n if (val === 2) {\r\n return endRad;\r\n }\r\n\r\n return startRad.clone().lerp(endRad, val / 2.0);\r\n }\r\n\r\n calcStickRadius(_res) {\r\n return this.opts.radius;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const tubeRad = this.opts.radius;\r\n const secHeight = this.opts.depth;\r\n\r\n this.TUBE_RADIUS = new THREE.Vector2(tubeRad, tubeRad);\r\n this.ARROW_END = new THREE.Vector2(secHeight, tubeRad);\r\n const secCache = {};\r\n const secData = this.opts.ss;\r\n /* eslint-disable guard-for-in */\r\n for (const prop in secData) {\r\n secCache[prop] = {\r\n center: new THREE.Vector2(secHeight, secData[prop].width),\r\n start: new THREE.Vector2(secHeight, secData[prop].arrow),\r\n };\r\n }\r\n this.secCache = secCache;\r\n /* eslint-enable guard-for-in */\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nCartoonMode.prototype.id = 'CA';\r\nCartoonMode.prototype.name = 'Cartoon';\r\nCartoonMode.prototype.shortName = 'Cartoon';\r\nCartoonMode.prototype.depGroups = [\r\n 'CartoonChains',\r\n 'NucleicSpheres',\r\n 'NucleicCylinders',\r\n];\r\n\r\nexport default CartoonMode;\r\n","import chem from '../../chem';\r\nimport Mode from './Mode';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction getRenderParams() {\r\n return {\r\n wireframe: this.opts.wireframe,\r\n zClip: this.opts.zClip,\r\n };\r\n}\r\n\r\nclass SurfaceMode extends Mode {\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const surfaces = this.surfaceNames;\r\n const groups = this.depGroups;\r\n for (let i = 0, n = surfaces.length; i < n; ++i) {\r\n groups[groups.length] = [surfaces[i], getRenderParams];\r\n }\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getVisibilitySelector() {\r\n let visibilitySelector = null;\r\n if (this.opts.subset !== '') {\r\n const res = selectors.parse(this.opts.subset);\r\n if (!res.error) {\r\n visibilitySelector = res.selector;\r\n }\r\n }\r\n return visibilitySelector;\r\n }\r\n}\r\n\r\nSurfaceMode.prototype.isSurface = true;\r\nSurfaceMode.prototype.surfaceNames = [];\r\n\r\nexport default SurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass QuickSurfaceMode extends SurfaceMode {\r\n static id = 'QS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n useBeads: false,\r\n isoValue: this.opts.isoValue,\r\n gaussLim: this.opts.gaussLim[this.settings.now.resolution],\r\n radScale: this.opts.scale,\r\n gridSpacing: this.opts.gridSpacing[this.settings.now.resolution],\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nQuickSurfaceMode.prototype.id = 'QS';\r\nQuickSurfaceMode.prototype.name = 'Quick Surface';\r\nQuickSurfaceMode.prototype.shortName = 'Quick Surf';\r\nQuickSurfaceMode.prototype.surfaceNames = ['QuickSurfGeo'];\r\n\r\nexport default QuickSurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass IsoSurfaceMode extends SurfaceMode {\r\n constructor(excludeProbe, opts) {\r\n super(opts);\r\n this._excludeProbe = excludeProbe;\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getSurfaceOpts() {\r\n return {\r\n gridSpacing: this.opts.polyComplexity[this.settings.now.resolution],\r\n radScale: this._radScale,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n probeRadius: this.opts.probeRadius,\r\n excludeProbe: this._excludeProbe,\r\n };\r\n }\r\n}\r\n\r\nIsoSurfaceMode.prototype.id = 'SU';\r\nIsoSurfaceMode.prototype.name = 'Surface';\r\nIsoSurfaceMode.prototype.shortName = 'Surface';\r\nIsoSurfaceMode.prototype.surfaceNames = ['SASSESSurfaceGeo'];\r\n\r\nIsoSurfaceMode.prototype._radScale = 1;\r\nIsoSurfaceMode.prototype._excludeProbe = false;\r\n\r\nexport default IsoSurfaceMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSASMode extends IsoSurfaceMode {\r\n static id = 'SA';\r\n\r\n constructor(opts) {\r\n super(false, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSASMode.prototype.id = 'SA';\r\nIsoSurfaceSASMode.prototype.name = 'Solvent Accessible Surface';\r\nIsoSurfaceSASMode.prototype.shortName = 'SAS';\r\n\r\nexport default IsoSurfaceSASMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSESMode extends IsoSurfaceMode {\r\n static id = 'SE';\r\n\r\n constructor(opts) {\r\n super(true, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSESMode.prototype.id = 'SE';\r\nIsoSurfaceSESMode.prototype.name = 'Solvent Excluded Surface';\r\nIsoSurfaceSESMode.prototype.shortName = 'SES';\r\n\r\nexport default IsoSurfaceSESMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass ContactSurfaceMode extends SurfaceMode {\r\n static id = 'CS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n probeRadius: this.opts.probeRadius,\r\n radScale: this.opts.polyComplexity[this.settings.now.resolution],\r\n scaleFactor: this.opts.polyComplexity[this.settings.now.resolution],\r\n gridSpacing: 1.0 / this.opts.polyComplexity[this.settings.now.resolution],\r\n isoValue: this.opts.isoValue,\r\n probePositions: this.opts.probePositions,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nContactSurfaceMode.prototype.id = 'CS';\r\nContactSurfaceMode.prototype.name = 'Contact Surface';\r\nContactSurfaceMode.prototype.shortName = 'Contact Surf';\r\nContactSurfaceMode.prototype.isSurface = true;\r\nContactSurfaceMode.prototype.surfaceNames = ['ContactSurfaceGeo'];\r\n\r\nexport default ContactSurfaceMode;\r\n","import _ from 'lodash';\r\nimport Mode from './Mode';\r\n\r\nclass TextMode extends Mode {\r\n static id = 'TX';\r\n\r\n getTemplateOptions() {\r\n return this.opts.template;\r\n }\r\n\r\n getLabelOpts() {\r\n return _.merge(this.opts, {\r\n colors: true,\r\n adjustColor: true,\r\n transparent: true,\r\n });\r\n }\r\n}\r\n\r\nTextMode.prototype.id = 'TX';\r\nTextMode.prototype.name = 'Text mode';\r\nTextMode.prototype.shortName = 'Text';\r\nTextMode.prototype.depGroups = ['TextLabelsGeo'];\r\n\r\nexport default TextMode;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport LinesMode from './modes/LinesMode';\r\nimport LicoriceMode from './modes/LicoriceMode';\r\nimport BallsAndSticksMode from './modes/BallsAndSticksMode';\r\nimport VanDerWaalsMode from './modes/VanDerWaalsMode';\r\nimport TraceMode from './modes/TraceMode';\r\nimport TubeMode from './modes/TubeMode';\r\nimport CartoonMode from './modes/CartoonMode';\r\nimport QuickSurfaceMode from './modes/QuickSurfaceMode';\r\nimport IsoSurfaceSASMode from './modes/IsoSurfaceSASMode';\r\nimport IsoSurfaceSESMode from './modes/IsoSurfaceSESMode';\r\nimport ContactSurfaceMode from './modes/ContactSurfaceMode';\r\nimport TextMode from './modes/TextMode';\r\n\r\nconst modes = new EntityList([\r\n LinesMode,\r\n LicoriceMode,\r\n BallsAndSticksMode,\r\n VanDerWaalsMode,\r\n TraceMode,\r\n TubeMode,\r\n CartoonMode,\r\n QuickSurfaceMode,\r\n IsoSurfaceSASMode,\r\n IsoSurfaceSESMode,\r\n ContactSurfaceMode,\r\n TextMode,\r\n]);\r\n\r\nexport default modes;\r\n","import _ from 'lodash';\r\n\r\nfunction clamp(x, a, b) {\r\n return x <= b ? x < 0 ? 0 : x : b;\r\n}\r\n\r\nfunction lerpColor(c1, c2, alpha) {\r\n const beta = 1 - alpha;\r\n const r1 = (c1 >> 16) & 0xff;\r\n const g1 = (c1 >> 8) & 0xff;\r\n const b1 = c1 & 0xff;\r\n const r2 = (c2 >> 16) & 0xff;\r\n const g2 = (c2 >> 8) & 0xff;\r\n const b2 = c2 & 0xff;\r\n const r = beta * r1 + alpha * r2;\r\n const g = beta * g1 + alpha * g2;\r\n const b = beta * b1 + alpha * b2;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\n\r\nclass Palette {\r\n constructor(name, id) {\r\n this.name = name || 'Custom';\r\n this.id = id || 'CP';\r\n }\r\n\r\n getElementColor(name, asIs = false) {\r\n const color = this.elementColors[name];\r\n return color === undefined && !asIs ? this.defaultElementColor : color;\r\n }\r\n\r\n getResidueColor(name, asIs = false) {\r\n const color = this.residueColors[name];\r\n return color === undefined && !asIs ? this.defaultResidueColor : color;\r\n }\r\n\r\n getChainColor(name) {\r\n let chain = name.charCodeAt(0);\r\n chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F)\r\n % this.chainColors.length;\r\n return this.chainColors[chain];\r\n }\r\n\r\n getSecondaryColor(type, asIs = false) {\r\n const color = this.secondaryColors[type];\r\n return color === undefined && !asIs ? this.defaultSecondaryColor : color;\r\n }\r\n\r\n getSequentialColor(index) {\r\n const { colors } = this;\r\n const len = colors.length;\r\n return index < 0 ? colors[(index % len) + len] : colors[index % len];\r\n }\r\n\r\n getGradientColor(value, gradientName) {\r\n const gradient = this.gradients[gradientName];\r\n if (!gradient) {\r\n return this.defaultNamedColor;\r\n }\r\n const count = gradient.length;\r\n const index = value * (count - 1);\r\n let left = Math.floor(index);\r\n const right = clamp(left + 1, 0, count - 1);\r\n left = clamp(left, 0, count - 1);\r\n return lerpColor(gradient[left], gradient[right], index - left);\r\n }\r\n\r\n getNamedColor(name, asIs = false) {\r\n const color = this.namedColors[name];\r\n return color === undefined && !asIs ? this.defaultNamedColor : color;\r\n }\r\n}\r\n\r\n_.assign(Palette.prototype, {\r\n colors: [0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0x808080],\r\n\r\n minRangeColor: 0x000000,\r\n midRangeColor: 0x7F7F7F,\r\n maxRangeColor: 0xFFFFFF,\r\n\r\n defaultElementColor: 0xFFFFFF,\r\n elementColors: {},\r\n\r\n defaultResidueColor: 0xFFFFFF,\r\n residueColors: {},\r\n\r\n chainColors: [0xFFFFFF],\r\n\r\n defaultSecondaryColor: 0xFFFFFF,\r\n secondaryColors: {},\r\n\r\n defaultGradientColor: 0x000000,\r\n\r\n defaultNamedColor: 0xFFFFFF,\r\n namedColorsArray: [\r\n /* eslint-disable no-multi-spaces */\r\n ['indianred', 0xcd5c5c],\r\n ['lightcoral', 0xf08080],\r\n ['salmon', 0xfa8072],\r\n ['darksalmon', 0xe9967a],\r\n ['lightsalmon', 0xffa07a],\r\n ['crimson', 0xdc143c],\r\n ['red', 0xff0000],\r\n ['firebrick', 0xb22222],\r\n ['darkred', 0x8b0000],\r\n ['pink', 0xffc0cb],\r\n ['lightpink', 0xffb6c1],\r\n ['hotpink', 0xff69b4],\r\n ['deeppink', 0xff1493],\r\n ['mediumvioletred', 0xc71585],\r\n ['palevioletred', 0xdb7093],\r\n ['coral', 0xff7f50],\r\n ['tomato', 0xff6347],\r\n ['orangered', 0xff4500],\r\n ['darkorange', 0xff8c00],\r\n ['orange', 0xffa500],\r\n ['gold', 0xffd700],\r\n ['yellow', 0xffff00],\r\n ['lightyellow', 0xffffe0],\r\n ['lemonchiffon', 0xfffacd],\r\n ['lightgoldenrodyellow', 0xfafad2],\r\n ['papayawhip', 0xffefd5],\r\n ['moccasin', 0xffe4b5],\r\n ['peachpuff', 0xffdab9],\r\n ['palegoldenrod', 0xeee8aa],\r\n ['khaki', 0xf0e68c],\r\n ['darkkhaki', 0xbdb76b],\r\n ['lavender', 0xe6e6fa],\r\n ['thistle', 0xd8bfd8],\r\n ['plum', 0xdda0dd],\r\n ['violet', 0xee82ee],\r\n ['orchid', 0xda70d6],\r\n ['fuchsia', 0xff00ff],\r\n ['magenta', 0xff00ff],\r\n ['mediumorchid', 0xba55d3],\r\n ['mediumpurple', 0x9370db],\r\n ['rebeccapurple', 0x663399],\r\n ['blueviolet', 0x8a2be2],\r\n ['darkviolet', 0x9400d3],\r\n ['darkorchid', 0x9932cc],\r\n ['darkmagenta', 0x8b008b],\r\n ['purple', 0x800080],\r\n ['indigo', 0x4b0082],\r\n ['slateblue', 0x6a5acd],\r\n ['mediumslateblue', 0x7b68ee],\r\n ['darkslateblue', 0x483d8b],\r\n ['greenyellow', 0xadff2f],\r\n ['chartreuse', 0x7fff00],\r\n ['lawngreen', 0x7cfc00],\r\n ['lime', 0x00ff00],\r\n ['limegreen', 0x32cd32],\r\n ['palegreen', 0x98fb98],\r\n ['lightgreen', 0x90ee90],\r\n ['mediumspringgreen', 0x00fa9a],\r\n ['springgreen', 0x00ff7f],\r\n ['mediumseagreen', 0x3cb371],\r\n ['seagreen', 0x2e8b57],\r\n ['forestgreen', 0x228b22],\r\n ['green', 0x008000],\r\n ['darkgreen', 0x006400],\r\n ['yellowgreen', 0x9acd32],\r\n ['olivedrab', 0x6b8e23],\r\n ['olive', 0x808000],\r\n ['darkolivegreen', 0x556b2f],\r\n ['mediumaquamarine', 0x66cdaa],\r\n ['darkseagreen', 0x8fbc8f],\r\n ['lightseagreen', 0x20b2aa],\r\n ['darkcyan', 0x008b8b],\r\n ['teal', 0x008080],\r\n ['aqua', 0x00ffff],\r\n ['cyan', 0x00ffff],\r\n ['lightcyan', 0xe0ffff],\r\n ['paleturquoise', 0xafeeee],\r\n ['aquamarine', 0x7fffd4],\r\n ['turquoise', 0x40e0d0],\r\n ['mediumturquoise', 0x48d1cc],\r\n ['darkturquoise', 0x00ced1],\r\n ['cadetblue', 0x5f9ea0],\r\n ['steelblue', 0x4682b4],\r\n ['lightsteelblue', 0xb0c4de],\r\n ['powderblue', 0xb0e0e6],\r\n ['lightblue', 0xadd8e6],\r\n ['skyblue', 0x87ceeb],\r\n ['lightskyblue', 0x87cefa],\r\n ['deepskyblue', 0x00bfff],\r\n ['dodgerblue', 0x1e90ff],\r\n ['cornflowerblue', 0x6495ed],\r\n ['royalblue', 0x4169e1],\r\n ['blue', 0x0000ff],\r\n ['mediumblue', 0x0000cd],\r\n ['darkblue', 0x00008b],\r\n ['navy', 0x000080],\r\n ['midnightblue', 0x191970],\r\n ['cornsilk', 0xfff8dc],\r\n ['blanchedalmond', 0xffebcd],\r\n ['bisque', 0xffe4c4],\r\n ['navajowhite', 0xffdead],\r\n ['wheat', 0xf5deb3],\r\n ['burlywood', 0xdeb887],\r\n ['tan', 0xd2b48c],\r\n ['rosybrown', 0xbc8f8f],\r\n ['sandybrown', 0xf4a460],\r\n ['goldenrod', 0xdaa520],\r\n ['darkgoldenrod', 0xb8860b],\r\n ['peru', 0xcd853f],\r\n ['chocolate', 0xd2691e],\r\n ['saddlebrown', 0x8b4513],\r\n ['sienna', 0xa0522d],\r\n ['brown', 0xa52a2a],\r\n ['maroon', 0x800000],\r\n ['white', 0xffffff],\r\n ['snow', 0xfffafa],\r\n ['honeydew', 0xf0fff0],\r\n ['mintcream', 0xf5fffa],\r\n ['azure', 0xf0ffff],\r\n ['aliceblue', 0xf0f8ff],\r\n ['ghostwhite', 0xf8f8ff],\r\n ['whitesmoke', 0xf5f5f5],\r\n ['seashell', 0xfff5ee],\r\n ['beige', 0xf5f5dc],\r\n ['oldlace', 0xfdf5e6],\r\n ['floralwhite', 0xfffaf0],\r\n ['ivory', 0xfffff0],\r\n ['antiquewhite', 0xfaebd7],\r\n ['linen', 0xfaf0e6],\r\n ['lavenderblush', 0xfff0f5],\r\n ['mistyrose', 0xffe4e1],\r\n ['gainsboro', 0xdcdcdc],\r\n ['lightgray', 0xd3d3d3],\r\n ['silver', 0xc0c0c0],\r\n ['darkgray', 0xa9a9a9],\r\n ['gray', 0x808080],\r\n ['dimgray', 0x696969],\r\n ['lightslategray', 0x778899],\r\n ['slategray', 0x708090],\r\n ['darkslategray', 0x2f4f4f],\r\n ['black', 0x000000],\r\n /* eslint-enable no-multi-spaces */\r\n ],\r\n\r\n namedColors: {},\r\n /* eslint-enable no-magic-numbers */\r\n\r\n gradients: {\r\n rainbow: [\r\n 0x0000ff, // blue\r\n 0x00ffff, // cyan\r\n 0x00ff00, // green\r\n 0xffff00, // yellow\r\n 0xff0000, // red\r\n ],\r\n temp: [\r\n 0x0000ff, // blue\r\n 0x007fff, // light-blue\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n hot: [\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n cold: [\r\n 0xffffff, // white\r\n 0x007fff, // light-blue\r\n 0x0000ff, // blue\r\n ],\r\n 'blue-red': [\r\n 0x0000ff, // blue\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n reds: [\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n blues: [\r\n 0xffffff, // white\r\n 0x0000ff, // blue\r\n ],\r\n },\r\n});\r\n\r\n\r\nconst { namedColorsArray, namedColors } = Palette.prototype;\r\n\r\nfor (let i = 0, { length } = namedColorsArray; i < length; ++i) {\r\n const [name, value] = namedColorsArray[i];\r\n namedColors[name] = value;\r\n}\r\n\r\nexport default Palette;\r\n","import Palette from './Palette';\r\n\r\nconst palette = new Palette('CPK', 'CP');\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x202020,\r\n N: 0x2060FF,\r\n O: 0xEE2010,\r\n F: 0x00FF00,\r\n P: 0x8020FF,\r\n S: 0xFFFF00,\r\n CL: 0x00BB00,\r\n FE: 0xD0D0D0,\r\n CO: 0xD0D0D0,\r\n NI: 0xD0D0D0,\r\n CU: 0xD0D0D0,\r\n BR: 0x008800,\r\n I: 0x005500,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('Jmol', 'JM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0x0055FF, //\r\n 0x00ABFF, //\r\n 0x00FFFF, // cyan\r\n 0x00FFAB, //\r\n 0x00FF55, //\r\n 0x00FF00, // green\r\n 0x55FF00, //\r\n 0xABFF00, //\r\n 0xFFFF00, // yellow\r\n 0xFFAB00, //\r\n 0xFF5500, //\r\n 0xFF0000, // red\r\n 0xFF0055, //\r\n 0xFF00AB, //\r\n 0xFF00FF, // magenta\r\n 0xAB00FF, //\r\n 0x5500FF, //\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n D: 0xFFFFC0,\r\n T: 0xFFFFA0,\r\n HE: 0xD9FFFF,\r\n LI: 0xCC80FF,\r\n BE: 0xC2FF00,\r\n B: 0xFFB5B5,\r\n C: 0x909090,\r\n N: 0x3050F8,\r\n O: 0xFF0D0D,\r\n F: 0x90E050,\r\n NE: 0xB3E3F5,\r\n NA: 0xAB5CF2,\r\n MG: 0x8AFF00,\r\n AL: 0xBFA6A6,\r\n SI: 0xF0C8A0,\r\n P: 0xFF8000,\r\n S: 0xFFFF30,\r\n CL: 0x1FF01F,\r\n AR: 0x80D1E3,\r\n K: 0x8F40D4,\r\n CA: 0x3DFF00,\r\n SC: 0xE6E6E6,\r\n TI: 0xBFC2C7,\r\n V: 0xA6A6AB,\r\n CR: 0x8A99C7,\r\n MN: 0x9C7AC7,\r\n FE: 0xE06633,\r\n CO: 0xF090A0,\r\n NI: 0x50D050,\r\n CU: 0xC88033,\r\n ZN: 0x7D80B0,\r\n GA: 0xC28F8F,\r\n GE: 0x668F8F,\r\n AS: 0xBD80E3,\r\n SE: 0xFFA100,\r\n BR: 0xA62929,\r\n KR: 0x5CB8D1,\r\n RB: 0x702EB0,\r\n SR: 0x00FF00,\r\n Y: 0x94FFFF,\r\n ZR: 0x94E0E0,\r\n NB: 0x73C2C9,\r\n MO: 0x54B5B5,\r\n TC: 0x3B9E9E,\r\n RU: 0x248F8F,\r\n RH: 0x0A7D8C,\r\n PD: 0x006985,\r\n AG: 0xC0C0C0,\r\n CD: 0xFFD98F,\r\n IN: 0xA67573,\r\n SN: 0x668080,\r\n SB: 0x9E63B5,\r\n TE: 0xD47A00,\r\n I: 0x940094,\r\n XE: 0x429EB0,\r\n CS: 0x57178F,\r\n BA: 0x00C900,\r\n LA: 0x70D4FF,\r\n CE: 0xFFFFC7,\r\n PR: 0xD9FFC7,\r\n ND: 0xC7FFC7,\r\n PM: 0xA3FFC7,\r\n SM: 0x8FFFC7,\r\n EU: 0x61FFC7,\r\n GD: 0x45FFC7,\r\n TB: 0x30FFC7,\r\n DY: 0x1FFFC7,\r\n HO: 0x00FF9C,\r\n ER: 0x00E675,\r\n TM: 0x00D452,\r\n YB: 0x00BF38,\r\n LU: 0x00AB24,\r\n HF: 0x4DC2FF,\r\n TA: 0x4DA6FF,\r\n W: 0x2194D6,\r\n RE: 0x267DAB,\r\n OS: 0x266696,\r\n IR: 0x175487,\r\n PT: 0xD0D0E0,\r\n AU: 0xFFD123,\r\n HG: 0xB8B8D0,\r\n TL: 0xA6544D,\r\n PB: 0x575961,\r\n BI: 0x9E4FB5,\r\n PO: 0xAB5C00,\r\n AT: 0x754F45,\r\n RN: 0x428296,\r\n FR: 0x420066,\r\n RA: 0x007D00,\r\n AC: 0x70ABFA,\r\n TH: 0x00BAFF,\r\n PA: 0x00A1FF,\r\n U: 0x008FFF,\r\n NP: 0x0080FF,\r\n PU: 0x006BFF,\r\n AM: 0x545CF2,\r\n CM: 0x785CE3,\r\n BK: 0x8A4FE3,\r\n CF: 0xA136D4,\r\n ES: 0xB31FD4,\r\n FM: 0xB31FBA,\r\n MD: 0xB30DA6,\r\n NO: 0xBD0D87,\r\n LR: 0xC70066,\r\n RF: 0xCC0059,\r\n DB: 0xD1004F,\r\n SG: 0xD90045,\r\n BH: 0xE00038,\r\n HS: 0xE6002E,\r\n MT: 0xEB0026,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0xBEA06E;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0xC8C8C8,\r\n ARG: 0x145AFF,\r\n ASN: 0x00DCDC,\r\n ASP: 0xE60A0A,\r\n CYS: 0xE6E600,\r\n GLN: 0x00DCDC,\r\n GLU: 0xE60A0A,\r\n GLY: 0xEBEBEB,\r\n HIS: 0x8282D2,\r\n ILE: 0x0F820F,\r\n LEU: 0x0F820F,\r\n LYS: 0x145AFF,\r\n MET: 0xE6E600,\r\n PHE: 0x3232AA,\r\n PRO: 0xDC9682,\r\n SER: 0xFA9600,\r\n THR: 0xFA9600,\r\n TRP: 0xB45AB4,\r\n TYR: 0x3232AA,\r\n VAL: 0x0F820F,\r\n A: 0xA0A0FF,\r\n C: 0xFF8C4B,\r\n G: 0xFF7070,\r\n I: 0x80FFFF,\r\n T: 0xA0FFA0,\r\n U: 0xFF8080,\r\n DA: 0xA0A0FF,\r\n DC: 0xFF8C4B,\r\n DG: 0xFF7070,\r\n DI: 0x80FFFF,\r\n DT: 0xA0FFA0,\r\n DU: 0xFF8080,\r\n '+A': 0xA0A0FF,\r\n '+C': 0xFF8C4B,\r\n '+G': 0xFF7070,\r\n '+I': 0x80FFFF,\r\n '+T': 0xA0FFA0,\r\n '+U': 0xFF8080,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [\r\n // ' '->0 'A'->1, 'B'->2\r\n 0xFFffffff, // ' ' & '0' white\r\n //\r\n 0xFFC0D0FF, // skyblue\r\n 0xFFB0FFB0, // pastel green\r\n 0xFFFFC0C8, // pink\r\n 0xFFFFFF80, // pastel yellow\r\n 0xFFFFC0FF, // pastel magenta\r\n 0xFFB0F0F0, // pastel cyan\r\n 0xFFFFD070, // pastel gold\r\n 0xFFF08080, // lightcoral\r\n\r\n 0xFFF5DEB3, // wheat\r\n 0xFF00BFFF, // deepskyblue\r\n 0xFFCD5C5C, // indianred\r\n 0xFF66CDAA, // mediumaquamarine\r\n 0xFF9ACD32, // yellowgreen\r\n 0xFFEE82EE, // violet\r\n 0xFF00CED1, // darkturquoise\r\n 0xFF00FF7F, // springgreen\r\n 0xFF3CB371, // mediumseagreen\r\n\r\n 0xFF00008B, // darkblue\r\n 0xFFBDB76B, // darkkhaki\r\n 0xFF006400, // darkgreen\r\n 0xFF800000, // maroon\r\n 0xFF808000, // olive\r\n 0xFF800080, // purple\r\n 0xFF008080, // teal\r\n 0xFFB8860B, // darkgoldenrod\r\n 0xFFB22222, // firebrick\r\n];\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xFF0080,\r\n [StructuralElementType.HELIX_PI]: 0x600080,\r\n [StructuralElementType.HELIX_310]: 0xA00080,\r\n [StructuralElementType.STRAND]: 0xFFC800,\r\n [StructuralElementType.TURN]: 0x6080FF,\r\n dna: 0xAE00FE,\r\n rna: 0xFD0162,\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('VMD', 'VM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0xFF0000, // red\r\n 0x606060, // gray\r\n 0xFF8000, // orange\r\n 0xFFFF00, // yellow\r\n 0x808033, // tan\r\n 0x999999, // silver\r\n 0x00FF00, // green\r\n 0xFFFFFF, // white\r\n 0xFF9999, // pink\r\n 0x40C0C0, // cyan\r\n 0xA600A6, // purple\r\n 0x80E666, // lime\r\n 0xE666B3, // mauve\r\n 0x804D00, // ochre\r\n 0x8080C0, // ice blue\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\npalette.defaultElementColor = 0x804D00;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x40BFBF,\r\n N: 0x0000FF,\r\n O: 0xFF0000,\r\n P: 0x808033,\r\n S: 0xFFFF00,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0x40C0C0;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0x0000FF,\r\n ARG: 0xFFFFFF,\r\n ASN: 0x808033,\r\n ASP: 0xFF0000,\r\n CYS: 0xFFFF00,\r\n GLN: 0xFF8000,\r\n GLU: 0xFF9999,\r\n GLY: 0xFFFFFF,\r\n HIS: 0x40C0C0,\r\n ILE: 0x00FF00,\r\n LEU: 0xFF9999,\r\n LYS: 0x40C0C0,\r\n MET: 0xFFFF00,\r\n PHE: 0xA600A6,\r\n PRO: 0x804C00,\r\n SER: 0xFFFF00,\r\n THR: 0xE666B3,\r\n TRP: 0x999999,\r\n TYR: 0x00FF00,\r\n VAL: 0x808033,\r\n A: 0x0000FF,\r\n C: 0xFF8000,\r\n G: 0xFFFF00,\r\n T: 0xA600A6,\r\n U: 0x00FF00,\r\n DA: 0x0000FF,\r\n DC: 0xFF8000,\r\n DG: 0xFFFF00,\r\n DT: 0xA600A6,\r\n DU: 0x00FF00,\r\n '+A': 0x0000FF,\r\n '+C': 0xFF8000,\r\n '+G': 0xFFFF00,\r\n '+T': 0xA600A6,\r\n '+U': 0x00FF00,\r\n WAT: 0x40C0C0,\r\n H2O: 0x40C0C0,\r\n HOH: 0x40C0C0,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [0xFFFFFF].concat(palette.colors);\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xA600A6,\r\n [StructuralElementType.HELIX_310]: 0x0000FF,\r\n [StructuralElementType.HELIX_PI]: 0xFF0000,\r\n [StructuralElementType.STRAND]: 0xFFFF00,\r\n [StructuralElementType.BRIDGE]: 0x808033,\r\n [StructuralElementType.TURN]: 0x40C0C0,\r\n};\r\n\r\nexport default palette;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport cpkPalette from './palettes/cpkPalette';\r\nimport jmolPalette from './palettes/jmolPalette';\r\nimport vmdPalette from './palettes/vmdPalette';\r\n\r\nconst palettes = new EntityList([\r\n cpkPalette,\r\n jmolPalette,\r\n vmdPalette,\r\n]);\r\n\r\nexport default palettes;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport palettes from '../palettes';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports Colorer\r\n * @this Colorer\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available coloring algorithms used for building and displaying molecule geometry.\r\n */\r\nclass Colorer {\r\n constructor(opts) {\r\n if (this.constructor === Colorer) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Colorer options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(settings.now.colorers[this.id], true), opts);\r\n /**\r\n * Palette in use.\r\n * @type {Palette}\r\n */\r\n this.palette = palettes.first;\r\n }\r\n\r\n /**\r\n * Get Colorer identification, probably with options.\r\n * @returns {string|Array} Colorer identifier string ({@link Colorer#id}) or two-element array containing both colorer\r\n * identifier and options ({@link Colorer#opts}).\r\n * Options are returned if they were changed during or after colorer creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, settings.now.colorers[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n}\r\n\r\n/**\r\n * Colorer identifier.\r\n * @type {string}\r\n */\r\n\r\nColorer.prototype.id = '__';\r\n\r\nexport default Colorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Element\r\n *\r\n * @exports ElementColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on chemical element.\r\n */\r\nclass ElementColorer extends Colorer {\r\n static id = 'EL';\r\n\r\n getAtomColor(atom, _complex) {\r\n const type = atom.element.name;\r\n if (type === 'C' && this.opts.carbon >= 0) {\r\n return this.opts.carbon;\r\n }\r\n return this.palette.getElementColor(type);\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nElementColorer.prototype.id = 'EL';\r\nElementColorer.prototype.name = 'Element';\r\nElementColorer.prototype.shortName = 'Element';\r\n\r\nexport default ElementColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Coloring algorithm based on residue type.\r\n *\r\n * @see ResidueType\r\n *\r\n * @exports ResidueTypeColorer\r\n * @constructor\r\n */\r\nclass ResidueTypeColorer extends Colorer {\r\n static id = 'RT';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getResidueColor(residue._type._name);\r\n }\r\n}\r\n\r\nResidueTypeColorer.prototype.id = 'RT';\r\nResidueTypeColorer.prototype.name = 'Residue Type';\r\nResidueTypeColorer.prototype.shortName = 'Residue';\r\n\r\nexport default ResidueTypeColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass SequenceColorer extends Colorer {\r\n static id = 'SQ';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const chain = residue._chain;\r\n if (chain.minSequence === Number.POSITIVE_INFINITY && chain.maxSequence === Number.NEGATIVE_INFINITY) {\r\n return this.palette.defaultNamedColor;\r\n }\r\n const min = chain.minSequence;\r\n const max = chain.maxSequence > min ? chain.maxSequence : min + 1;\r\n return this.palette.getGradientColor((residue._sequence - min) / (max - min), this.opts.gradient);\r\n }\r\n}\r\n\r\nSequenceColorer.prototype.id = 'SQ';\r\nSequenceColorer.prototype.name = 'Sequence';\r\nSequenceColorer.prototype.shortName = 'Sequence';\r\n\r\nexport default SequenceColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ChainColorer extends Colorer {\r\n static id = 'CH';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getChainColor(residue.getChain()._name);\r\n }\r\n}\r\n\r\nChainColorer.prototype.id = 'CH';\r\nChainColorer.prototype.name = 'Chain';\r\nChainColorer.prototype.shortName = 'Chain';\r\n\r\nexport default ChainColorer;\r\n","import Colorer from './Colorer';\r\nimport ResidueType from '../../chem/ResidueType';\r\n\r\nclass SecondaryStructureColorer extends Colorer {\r\n static id = 'SS';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n if (residue._type.flags & ResidueType.Flags.DNA) {\r\n return this.palette.getSecondaryColor('dna');\r\n }\r\n if (residue._type.flags & ResidueType.Flags.RNA) {\r\n return this.palette.getSecondaryColor('rna');\r\n }\r\n const secondary = residue.getSecondary();\r\n if (secondary) {\r\n let color = this.palette.getSecondaryColor(secondary.type, true);\r\n if (color === undefined) {\r\n color = this.palette.getSecondaryColor(secondary.generic);\r\n }\r\n return color;\r\n }\r\n return this.palette.defaultSecondaryColor;\r\n }\r\n}\r\n\r\nSecondaryStructureColorer.prototype.id = 'SS';\r\nSecondaryStructureColorer.prototype.name = 'Secondary Structure';\r\nSecondaryStructureColorer.prototype.shortName = 'Structure';\r\n\r\nexport default SecondaryStructureColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass UniformColorer extends Colorer {\r\n static id = 'UN';\r\n\r\n getAtomColor(_atom, _complex) {\r\n return this.opts.color;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nUniformColorer.prototype.id = 'UN';\r\nUniformColorer.prototype.name = 'Uniform';\r\nUniformColorer.prototype.shortName = 'Uniform';\r\n\r\nexport default UniformColorer;\r\n","import Colorer from './Colorer';\r\nimport selectors from '../../chem/selectors';\r\n\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports ConditionalColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on a selector string used as a condition.\r\n */\r\nclass ConditionalColorer extends Colorer {\r\n static id = 'CO';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n const parsed = selectors.parse(this.opts.subset);\r\n this._subsetCached = parsed.error ? selectors.none() : parsed.selector;\r\n }\r\n\r\n getAtomColor(atom, _complex) {\r\n return this._subsetCached.includesAtom(atom) ? this.opts.color : this.opts.baseColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const subset = this._subsetCached;\r\n let includes = true;\r\n const atoms = residue._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n includes = includes && subset.includesAtom(atoms[i]);\r\n }\r\n return includes ? this.opts.color : this.opts.baseColor;\r\n }\r\n}\r\n\r\nConditionalColorer.prototype.id = 'CO';\r\nConditionalColorer.prototype.name = 'Conditional';\r\nConditionalColorer.prototype.shortName = 'Conditional';\r\n\r\nexport default ConditionalColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ConformationColorer extends Colorer {\r\n static id = 'CF';\r\n\r\n getAtomColor(atom, _complex) {\r\n return this.palette.getChainColor(String.fromCharCode(atom.location));\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nConformationColorer.prototype.id = 'CF';\r\nConformationColorer.prototype.name = 'Conformation';\r\nConformationColorer.prototype.shortName = 'Conformation';\r\n\r\nexport default ConformationColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Temperature\r\n *\r\n * @exports TemperatureColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on temperature of chemical element.\r\n */\r\nclass TemperatureColorer extends Colorer {\r\n static id = 'TM';\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n let factor = 1;\r\n if (atom.temperature && opts) {\r\n if (opts.min === opts.max) {\r\n factor = atom.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (atom.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n if (!opts) {\r\n return this.palette.defaultGradientColor;\r\n }\r\n if (residue.temperature) {\r\n let factor = 0;\r\n if (opts.min === opts.max) {\r\n factor = residue.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (residue.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n}\r\n\r\nTemperatureColorer.prototype.id = 'TM'; // [T]e[M]perature\r\nTemperatureColorer.prototype.name = 'Temperature';\r\nTemperatureColorer.prototype.shortName = 'Temperature';\r\n\r\nexport default TemperatureColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Occupancy\r\n *\r\n * @exports OccupancyColorer\r\n * @augments Occupancy\r\n * @constructor\r\n * @classdesc Coloring algorithm based on occupancy of chemical element.\r\n */\r\nclass OccupancyColorer extends Colorer {\r\n static id = 'OC';\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n if (atom.occupancy && opts) {\r\n const factor = 1 - atom.occupancy;\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n if (!opts) {\r\n return this.palette.defaultGradientColor;\r\n }\r\n if (residue.occupancy > 0) {\r\n const factor = 1 - residue.occupancy;\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n}\r\n\r\nOccupancyColorer.prototype.id = 'OC'; // [OC]cupancy\r\nOccupancyColorer.prototype.name = 'Occupancy';\r\nOccupancyColorer.prototype.shortName = 'Occupancy';\r\n\r\nexport default OccupancyColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass HydrophobicityColorer extends Colorer {\r\n static id = 'HY';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n let color = this.palette.defaultResidueColor;\r\n if (residue._type.hydrophobicity) {\r\n // Kyte Doolitle hydro [-4.5,4.5]->[0.1]\r\n const min = -4.5;\r\n const max = 4.5;\r\n color = this.palette.getGradientColor((residue._type.hydrophobicity - min) / (max - min), this.opts.gradient);\r\n }\r\n return color;\r\n }\r\n}\r\n\r\nHydrophobicityColorer.prototype.id = 'HY';\r\nHydrophobicityColorer.prototype.name = 'Hydrophobicity';\r\nHydrophobicityColorer.prototype.shortName = 'Hydrophobicity';\r\n\r\nexport default HydrophobicityColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass MoleculeColorer extends Colorer {\r\n static id = 'MO';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const molecule = residue._molecule;\r\n const count = _complex.getMoleculeCount();\r\n if (count > 1) {\r\n return this.palette.getGradientColor((molecule.index - 1) / (count - 1), this.opts.gradient);\r\n }\r\n return this.palette.getGradientColor(0, this.opts.gradient);\r\n }\r\n}\r\n\r\nMoleculeColorer.prototype.id = 'MO';\r\nMoleculeColorer.prototype.name = 'Molecule';\r\nMoleculeColorer.prototype.shortName = 'Molecule';\r\n\r\nexport default MoleculeColorer;\r\n","import Colorer from './Colorer';\r\nimport Atom from '../../chem/Atom';\r\n\r\nfunction scaleColor(c, factor) {\r\n const r1 = (c >> 16) & 0xff;\r\n const g1 = (c >> 8) & 0xff;\r\n const b1 = c & 0xff;\r\n const r = factor * r1;\r\n const g = factor * g1;\r\n const b = factor * b1;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports CarbonColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on selection carbon atoms.\r\n */\r\nclass CarbonColorer extends Colorer {\r\n static id = 'CB';\r\n\r\n getAtomColor(atom, _complex) {\r\n const colorCarbon = this.opts.color;\r\n const colorNotCarbon = scaleColor(colorCarbon, this.opts.factor);\r\n return (atom.flags & Atom.Flags.CARBON) ? colorCarbon : colorNotCarbon;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nCarbonColorer.prototype.id = 'CB';\r\nCarbonColorer.prototype.name = 'Carbon';\r\nCarbonColorer.prototype.shortName = 'Carbon';\r\n\r\nexport default CarbonColorer;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport ElementColorer from './colorers/ElementColorer';\r\nimport ResidueTypeColorer from './colorers/ResidueTypeColorer';\r\nimport SequenceColorer from './colorers/SequenceColorer';\r\nimport ChainColorer from './colorers/ChainColorer';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\nimport UniformColorer from './colorers/UniformColorer';\r\nimport ConditionalColorer from './colorers/ConditionalColorer';\r\nimport ConformationColorer from './colorers/ConformationColorer';\r\nimport TemperatureColorer from './colorers/TemperatureColorer';\r\nimport OccupancyColorer from './colorers/OccupancyColorer';\r\nimport HydrophobicityColorer from './colorers/HydrophobicityColorer';\r\nimport MoleculeColorer from './colorers/MoleculeColorer';\r\nimport CarbonColorer from './colorers/CarbonColorer';\r\n\r\nconst colorers = new EntityList([\r\n ElementColorer,\r\n ResidueTypeColorer,\r\n SequenceColorer,\r\n ChainColorer,\r\n SecondaryStructureColorer,\r\n UniformColorer,\r\n ConditionalColorer,\r\n ConformationColorer,\r\n TemperatureColorer,\r\n OccupancyColorer,\r\n HydrophobicityColorer,\r\n MoleculeColorer,\r\n CarbonColorer,\r\n]);\r\n\r\nexport default colorers;\r\n","import * as THREE from 'three';\r\nimport EntityList from '../utils/EntityList';\r\n\r\nfunction neutralColor(intensity) {\r\n return new THREE.Color(intensity, intensity, intensity);\r\n}\r\n\r\nconst materialList = [\r\n {\r\n id: 'DF',\r\n name: 'Diffuse',\r\n shortName: 'Diffuse',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'SF',\r\n name: 'Soft Plastic',\r\n shortName: 'Soft',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.1),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'PL',\r\n name: 'Glossy Plastic',\r\n shortName: 'Glossy',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.28),\r\n shininess: 100,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'ME',\r\n name: 'Metal',\r\n shortName: 'Metal',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.55),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TR',\r\n name: 'Transparent',\r\n shortName: 'Transparent',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'GL',\r\n name: 'Glass',\r\n shortName: 'Glass',\r\n uberOptions: {\r\n diffuse: neutralColor(0.50),\r\n specular: neutralColor(0.65),\r\n shininess: 100,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'BA',\r\n name: 'Backdrop',\r\n shortName: 'Backdrop',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: false,\r\n depthWrite: false,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TN',\r\n name: 'Toon',\r\n shortName: 'Toon',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: true,\r\n },\r\n }, {\r\n id: 'FL',\r\n name: 'Flat',\r\n shortName: 'Flat',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 0,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n },\r\n },\r\n];\r\n\r\nconst materials = new EntityList(materialList);\r\n\r\nexport default materials;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport UberMaterial from './shaders/UberMaterial';\r\nimport gfxutils from './gfxutils';\r\nimport settings from '../settings';\r\nimport materials from './materials';\r\nimport chem from '../chem';\r\n\r\nconst { selectors } = chem;\r\n\r\nclass Representation {\r\n constructor(index, mode, colorer, selector) {\r\n const startMaterialValues = {\r\n clipPlane: settings.now.draft.clipPlane,\r\n fogTransparent: settings.now.bg.transparent,\r\n shadowmap: settings.now.shadow.on,\r\n shadowmapType: settings.now.shadow.type,\r\n };\r\n this.index = index;\r\n this.mode = mode;\r\n this.colorer = colorer;\r\n this.selector = selector;\r\n this.selectorString = '';\r\n this.count = 0;\r\n this.material = new UberMaterial();\r\n this.material.setValues(startMaterialValues);\r\n this.material.setUberOptions({ fogAlpha: settings.now.fogAlpha });\r\n this.materialPreset = materials.first;\r\n this.needsRebuild = true;\r\n this.visible = true;\r\n\r\n // apply mode params & preset\r\n this.setMode(mode);\r\n }\r\n\r\n\r\n markAtoms(complex) {\r\n this.count = complex.markAtoms(this.selector, 1 << this.index);\r\n this.needsRebuild = true;\r\n return this.count;\r\n }\r\n\r\n unmarkAtoms(complex) {\r\n complex.clearAtomBits(1 << this.index);\r\n this.count = 0;\r\n }\r\n\r\n setMode(mode) {\r\n this.mode = mode;\r\n }\r\n\r\n setMaterialPreset(preset) {\r\n this.materialPreset = preset;\r\n this.material.setUberOptions(preset.uberOptions);\r\n this.material.setValues(preset.values);\r\n }\r\n\r\n reset() {\r\n this.geo = null;\r\n this.selectionGeo = null;\r\n }\r\n\r\n buildGeometry(complex) {\r\n this.reset();\r\n this.needsRebuild = false;\r\n\r\n if (settings.now.ao) {\r\n this.material.setValues({ normalsToGBuffer: settings.now.ao });\r\n }\r\n\r\n this.geo = this.mode.buildGeometry(complex, this.colorer, 1 << this.index, this.material);\r\n\r\n if (this.material.uberOptions.opacity < 0.99 && settings.now.transparency === 'prepass') {\r\n gfxutils.processTransparentMaterial(this.geo, this.material);\r\n }\r\n this.geo.visible = this.visible;\r\n\r\n gfxutils.processObjRenderOrder(this.geo, this.materialPreset.id);\r\n gfxutils.processColFromPosMaterial(this.geo, this.material);\r\n\r\n if (settings.now.shadow.on) {\r\n gfxutils.createShadowmapMaterial(this.geo, this.material);\r\n }\r\n\r\n return this.geo;\r\n }\r\n\r\n buildSelectionGeometry(mask) {\r\n let sg = null;\r\n\r\n if (this.geo && ('getSubset' in this.geo)) {\r\n const meshes = this.geo.getSubset(mask);\r\n if (meshes && meshes.length > 0) {\r\n sg = new THREE.Group();\r\n sg.matrixAutoUpdate = false;\r\n sg.matrix = this.geo.matrix;\r\n\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n sg.add(m);\r\n }\r\n }\r\n }\r\n\r\n if (sg) {\r\n sg.visible = this.visible;\r\n }\r\n\r\n this.selectionGeo = sg;\r\n return this.selectionGeo;\r\n }\r\n\r\n /**\r\n * Create object that represents difference between current and another rep\r\n * anotherRep could be undefined. In this case everything is reported.\r\n */\r\n compare(repSettings) {\r\n const diff = {};\r\n\r\n const selStr = String(this.selector);\r\n if (!repSettings || selStr.valueOf() !== String(repSettings.selector).valueOf()) {\r\n diff.selector = selStr;\r\n }\r\n\r\n const modeDiff = this.mode.identify();\r\n if (!repSettings || Array.isArray(modeDiff) || modeDiff !== repSettings.mode) {\r\n diff.mode = modeDiff;\r\n }\r\n\r\n const colorerDiff = this.colorer.identify();\r\n if (!repSettings || Array.isArray(colorerDiff) || colorerDiff !== repSettings.colorer) {\r\n diff.colorer = colorerDiff;\r\n }\r\n\r\n if (!repSettings || this.materialPreset.id !== repSettings.material) {\r\n diff.material = this.materialPreset.id;\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n /**\r\n * Change representation. Write fields what was changed into new object, return it.\r\n */\r\n change(repSettings, complex, mode, color) {\r\n const diff = {};\r\n\r\n // modify selector\r\n if (repSettings.selector) {\r\n const newSelectorObject = selectors.parse(repSettings.selector).selector;\r\n const newSelector = String(newSelectorObject);\r\n if (this.selectorString !== newSelector) {\r\n diff.selector = newSelector;\r\n this.selectorString = newSelector;\r\n this.selector = newSelectorObject;\r\n this.markAtoms(complex);\r\n }\r\n }\r\n\r\n // modify mode\r\n if (repSettings.mode) {\r\n const newMode = repSettings.mode;\r\n if (!_.isEqual(this.mode.identify(), newMode)) {\r\n diff.mode = newMode;\r\n this.setMode(mode);\r\n }\r\n }\r\n\r\n // modify colorer\r\n if (repSettings.colorer) {\r\n const newColorer = repSettings.colorer;\r\n if (!_.isEqual(this.colorer.identify(), newColorer)) {\r\n diff.colorer = newColorer;\r\n this.colorer = color;\r\n }\r\n }\r\n\r\n // modify material\r\n if (repSettings.material) {\r\n const newMaterial = repSettings.material;\r\n if (!_.isEqual(this.materialPreset.id, newMaterial)) {\r\n diff.material = newMaterial;\r\n this.setMaterialPreset(materials.get(repSettings.material));\r\n }\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n show(visible) {\r\n this.visible = visible;\r\n if (this.geo) {\r\n this.geo.visible = visible;\r\n }\r\n if (this.selectionGeo) {\r\n this.selectionGeo.visible = visible;\r\n }\r\n }\r\n}\r\n\r\nexport default Representation;\r\n","import * as THREE from 'three';\r\nimport logger from './utils/logger';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport './gfx/modes';\r\n\r\nfunction _traverseComponentGroups(root, component, callback) {\r\n const { children } = root;\r\n if (!children) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n if (child._component === component) {\r\n callback(child);\r\n }\r\n if (child instanceof gfxutils.RCGroup) {\r\n _traverseComponentGroups(child, component, callback);\r\n }\r\n }\r\n}\r\n\r\nfunction ComplexEditor() {\r\n}\r\n\r\nclass ComplexComponentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n // init component matrices\r\n this._componentTransforms = [];\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n const component = complex._components[i];\r\n this._componentTransforms[component._index] = new THREE.Object3D();\r\n }\r\n\r\n this._inProgress = true;\r\n\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const complex = this._complexVisual.getComplex();\r\n\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n this._bakeComponentTransform(complex._components[i]);\r\n }\r\n\r\n complex.onAtomPositionChanged();\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n const visual = this._complexVisual;\r\n const component = visual.getSelectedComponent();\r\n\r\n if (component === null) {\r\n return res;\r\n }\r\n\r\n const selection = this._complexVisual.getSelectionGeo();\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n // find all geo nodes for this component\r\n _traverseComponentGroups(visual, component, (child) => {\r\n res.objects.push(child);\r\n });\r\n\r\n // find all selection nodes for this component\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component') && geo._component === component) {\r\n res.objects.push(geo);\r\n }\r\n }\r\n }\r\n\r\n // add dummy object that stores component transformation\r\n res.objects.push(this._componentTransforms[component._index]);\r\n\r\n const bbmin = new THREE.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n const bbmax = new THREE.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (j = 0; j < atoms.length; ++j) {\r\n if (atoms[j].mask & selectionMask) {\r\n bbmin.min(atoms[j].position);\r\n bbmax.max(atoms[j].position);\r\n }\r\n }\r\n });\r\n\r\n res.pivot.lerpVectors(bbmin, bbmax, 0.5);\r\n return res;\r\n }\r\n\r\n _bakeComponentTransform(component) {\r\n const t = this._componentTransforms[component._index];\r\n if (t && (!(t.position.x === 0 && t.position.y === 0 && t.position.z === 0)\r\n || !(t.quaternion.x === 0 && t.quaternion.y === 0 && t.quaternion.z === 0 && t.quaternion.w === 1))) {\r\n t.updateMatrix();\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (let j = 0; j < atoms.length; ++j) {\r\n atoms[j].position.applyMatrix4(t.matrix);\r\n }\r\n });\r\n }\r\n }\r\n\r\n _resetComponentTransform() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n for (i = 0; i < this._componentTransforms.length; ++i) {\r\n geo = this._componentTransforms[i];\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n\r\n // reset all geo nodes\r\n for (i = 0; i < visual.children.length; ++i) {\r\n reprNode = visual.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n // reset all selection nodes\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\nclass ComplexFragmentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n const atoms = this._getSelectionBorderAtoms();\r\n if (atoms.length < 1 || atoms.length > 2) {\r\n logger.error('Can only edit fragments with one or two bound atoms.');\r\n return false;\r\n }\r\n\r\n this._fragmentBoundAtoms = atoms;\r\n\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n\r\n // hide selected fragment in main model\r\n visual.disableSubset(selectionMask, true);\r\n\r\n // hide selection geo in main model\r\n for (let k = 0; k < selection.children.length; ++k) {\r\n selection.children[k].visible = false;\r\n }\r\n\r\n // create visible fragment representation to rotate\r\n const pivotPos = atoms[0].position.clone();\r\n\r\n if (atoms.length === 2) {\r\n pivotPos.lerp(atoms[1].position, 0.5);\r\n }\r\n\r\n this._fragmentGeo = new THREE.Group();\r\n visual.add(this._fragmentGeo);\r\n this._fragmentGeo.position.copy(pivotPos);\r\n\r\n this._fragmentSelectionGeo = new THREE.Group();\r\n selection.add(this._fragmentSelectionGeo);\r\n this._fragmentSelectionGeo.position.copy(pivotPos);\r\n\r\n const offset = pivotPos.clone();\r\n offset.negate();\r\n\r\n for (let i = 0; i < visual.children.length; ++i) {\r\n const g = visual.children[i];\r\n if (!('getSubset' in g)) {\r\n continue;\r\n }\r\n\r\n const vg = new THREE.Group();\r\n this._fragmentGeo.add(vg);\r\n\r\n const sg = new THREE.Group();\r\n this._fragmentSelectionGeo.add(sg);\r\n\r\n const meshes = g.getSubset(selectionMask, true);\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n vg.add(m);\r\n m.position.copy(offset);\r\n }\r\n\r\n const smeshes = g.getSubset(selectionMask, true);\r\n for (let h = 0; h < smeshes.length; h++) {\r\n const sm = smeshes[h];\r\n sg.add(sm);\r\n sm.position.copy(offset);\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(this._fragmentSelectionGeo);\r\n\r\n this._inProgress = true;\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selectionBit = visual.getSelectionBit();\r\n\r\n const p = this._fragmentGeo.position;\r\n const m = this._fragmentGeo.matrix.clone();\r\n m.multiply(new THREE.Matrix4().makeTranslation(-p.x, -p.y, -p.z));\r\n\r\n this._bakeAtomTransform(m, 1 << selectionBit);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << selectionBit, true);\r\n\r\n visual.getComplex().onAtomPositionChanged();\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n this._fragmentGeo.parent.remove(this._fragmentGeo);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << visual.getSelectionBit(), true);\r\n\r\n // show selection geo in main model (+ remove fragment selection geo)\r\n for (let i = 0; i < selection.children.length; ++i) {\r\n const node = selection.children[i];\r\n if (node.visible) {\r\n selection.remove(node);\r\n } else {\r\n node.visible = true;\r\n }\r\n }\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n isFreeRotationAllowed() {\r\n return (this._fragmentBoundAtoms.length < 2);\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n res.objects.push(this._fragmentGeo, this._fragmentSelectionGeo);\r\n\r\n const boundAtoms = this._fragmentBoundAtoms;\r\n if (boundAtoms.length === 1) {\r\n if (boundAtoms[0].bonds.length === 1) {\r\n // single external bond allows rotation about bond axis\r\n const bond = boundAtoms[0].bonds[0];\r\n res.axis = new THREE.Vector3().subVectors(bond._right.position, bond._left.position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n } else if (boundAtoms.length === 2) {\r\n // two bound atoms allow rotation only about axis running through their centers\r\n res.axis = new THREE.Vector3().subVectors(boundAtoms[1].position, boundAtoms[0].position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _getSelectionBorderAtoms() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n const selectionMask = 1 << this._complexVisual.getSelectionBit();\r\n const atomHash = {};\r\n\r\n complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n atomHash[bond._left.index] = 1;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n atomHash[bond._right.index] = 1;\r\n }\r\n });\r\n\r\n const atoms = [];\r\n const keys = Object.keys(atomHash);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const idx = keys[i];\r\n atoms.push(complex._atoms[idx]);\r\n }\r\n\r\n return atoms;\r\n }\r\n\r\n _bakeAtomTransform(matrix, mask) {\r\n this._complexVisual.getComplex().forEachAtom((atom) => {\r\n if (atom.mask & mask) {\r\n atom.position.applyMatrix4(matrix);\r\n }\r\n });\r\n }\r\n}\r\n\r\n\r\nexport default {\r\n ComponentEditor: ComplexComponentEditor,\r\n FragmentEditor: ComplexFragmentEditor,\r\n};\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\nimport chem from './chem';\r\nimport settings from './settings';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport Visual from './Visual';\r\nimport ComplexVisualEdit from './ComplexVisualEdit';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction lookupAndCreate(entityList, specs) {\r\n if (!Array.isArray(specs)) {\r\n specs = [specs];\r\n }\r\n const [id, opts] = specs;\r\n const Entity = entityList.get(id) || entityList.first;\r\n return new Entity(opts);\r\n}\r\n\r\nclass ComplexVisual extends Visual {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this._complex = dataSource;\r\n\r\n /** @type {Representation[]} */\r\n this._reprList = [];\r\n /** @type {?Representation} */\r\n this._repr = null;\r\n this._reprListChanged = true;\r\n\r\n this._selectionBit = 0;\r\n this._reprUsedBits = 0;\r\n this._selectionCount = 0;\r\n\r\n this._selectionGeometry = new THREE.Group();\r\n }\r\n\r\n getBoundaries() {\r\n return this._complex.getBoundaries();\r\n }\r\n\r\n release() {\r\n if (this._selectionGeometry.parent) {\r\n this._selectionGeometry.remove(this._selectionGeometry);\r\n }\r\n Visual.prototype.release.call(this);\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getSelectionCount() {\r\n return this._selectionCount;\r\n }\r\n\r\n getSelectionGeo() {\r\n return this._selectionGeometry;\r\n }\r\n\r\n getSelectionBit() {\r\n return this._selectionBit;\r\n }\r\n\r\n getEditor() {\r\n return this._editor;\r\n }\r\n\r\n resetReps(reps) {\r\n // Create all necessary representations\r\n if (this._complex) {\r\n this._complex.clearAtomBits(~0);\r\n }\r\n this._reprListChanged = true;\r\n this._reprUsedBits = 0;\r\n this._reprList.length = reps.length;\r\n for (let i = 0, n = reps.length; i < n; ++i) {\r\n const rep = reps[i];\r\n\r\n let selector;\r\n let selectorString;\r\n if (typeof rep.selector === 'string') {\r\n selectorString = rep.selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else if (typeof rep.selector === 'undefined') {\r\n selectorString = settings.now.presets.default[0].selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else {\r\n ({ selector } = rep);\r\n selectorString = selector.toString();\r\n }\r\n const mode = lookupAndCreate(modes, rep.mode);\r\n const colorer = lookupAndCreate(colorers, rep.colorer);\r\n const material = materials.get(rep.material) || materials.first;\r\n\r\n this._reprList[i] = new Representation(i, mode, colorer, selector);\r\n this._reprList[i].setMaterialPreset(material);\r\n this._reprList[i].selectorString = selectorString;\r\n\r\n if (this._complex) {\r\n this._complex.markAtoms(selector, 1 << i);\r\n }\r\n\r\n this._reprUsedBits |= 1 << i;\r\n }\r\n this._repr = reps.length > 0 ? this._reprList[0] : null;\r\n\r\n this._selectionBit = reps.length;\r\n this._reprUsedBits |= 1 << this._selectionBit; // selection uses one bit\r\n this._selectionCount = 0;\r\n\r\n if (this._complex) {\r\n this._complex.update();\r\n }\r\n }\r\n\r\n /**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\n repCount() {\r\n return this._reprList.length;\r\n }\r\n\r\n /**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\n repCurrent(index) {\r\n if (index >= 0 && index < this._reprList.length) {\r\n this._repr = this._reprList[index];\r\n } else {\r\n index = this._reprList.indexOf(this._repr);\r\n }\r\n return index;\r\n }\r\n\r\n /**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {Object} {desc, index, status} field desc contains rep description, index - index of correspondent rep,\r\n * status - one of three strings: 'created', 'changed', ''. 'created' means new rep was created during this function,\r\n * 'changed' - rep was changed during this function. '' - something else.\r\n */\r\n rep(index, rep) {\r\n // if index is missing then it is the current\r\n if (!rep && (index === undefined || index instanceof Object)) {\r\n rep = index;\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index > this._reprList.length) {\r\n logger.error(`Rep ${index} does not exist!`);\r\n return null;\r\n }\r\n\r\n // a special case of adding just after the end\r\n if (index === this._reprList.length) {\r\n const res = this.repAdd(rep);\r\n logger.warn(`Rep ${index} does not exist! New representation was created.`);\r\n return { desc: res.desc, index, status: 'created' };\r\n }\r\n\r\n // gather description\r\n const target = this._reprList[index];\r\n const desc = {\r\n selector: target.selectorString,\r\n mode: target.mode.identify(),\r\n colorer: target.colorer.identify(),\r\n material: target.materialPreset.id,\r\n };\r\n\r\n // modification is requested\r\n if (rep) {\r\n // modify\r\n const diff = target.change(rep, this._complex,\r\n lookupAndCreate(modes, rep.mode),\r\n lookupAndCreate(colorers, rep.colorer));\r\n\r\n // something was changed\r\n if (!_.isEmpty(diff)) {\r\n target.needsRebuild = true;\r\n for (const key in diff) {\r\n if (diff.hasOwnProperty(key)) {\r\n desc[key] = diff[key];\r\n logger.debug(`rep[${index}].${key} changed to ${diff[key]}`);\r\n }\r\n }\r\n\r\n // safety trick: lower resolution for surface modes\r\n if (diff.mode && target.mode.isSurface\r\n && (settings.now.resolution === 'ultra' || settings.now.resolution === 'high')) {\r\n logger.report('Surface resolution was changed to \"medium\" to avoid hang-ups.');\r\n settings.set('resolution', 'medium');\r\n }\r\n return { desc, index, status: 'changed' };\r\n }\r\n }\r\n return { desc, index, status: '' };\r\n }\r\n\r\n\r\n /**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\n repGet(index) {\r\n // if index is missing then it is the current\r\n if (index === undefined || index instanceof Object) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return null;\r\n }\r\n\r\n return this._reprList[index];\r\n }\r\n\r\n _getFreeReprIdx() {\r\n let bits = this._reprUsedBits;\r\n for (let i = 0; i <= ComplexVisual.NUM_REPRESENTATION_BITS; ++i, bits >>= 1) {\r\n if ((bits & 1) === 0) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {Object} {desc, index} field desc contains added rep description, index - index of this rep.\r\n */\r\n repAdd(rep) {\r\n if (this._reprList.length >= ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n return null;\r\n }\r\n\r\n const newSelectionBit = this._getFreeReprIdx();\r\n if (newSelectionBit < 0) {\r\n return null; // no more slots for representations\r\n }\r\n\r\n const originalSelection = this.buildSelectorFromMask(1 << this._selectionBit);\r\n\r\n // Fill in default values\r\n const def = settings.now.presets.default[0];\r\n const desc = _.merge({\r\n selector: def.selector,\r\n mode: def.mode,\r\n colorer: def.colorer,\r\n material: def.material,\r\n }, rep);\r\n\r\n const selector = (typeof desc.selector === 'string') ? selectors.parse(desc.selector).selector : desc.selector;\r\n const target = new Representation(\r\n this._selectionBit,\r\n lookupAndCreate(modes, desc.mode),\r\n lookupAndCreate(colorers, desc.colorer),\r\n selector,\r\n );\r\n target.selectorString = selector.toString();\r\n target.setMaterialPreset(materials.get(desc.material));\r\n target.markAtoms(this._complex);\r\n this._reprList.push(target);\r\n\r\n // change selection bit\r\n this._selectionBit = newSelectionBit;\r\n this._reprUsedBits |= 1 << this._selectionBit;\r\n\r\n // restore selection using new selection bit\r\n this._complex.markAtoms(originalSelection, 1 << this._selectionBit);\r\n\r\n return { desc, index: this._reprList.length - 1 };\r\n }\r\n\r\n /**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\n repRemove(index) {\r\n if (index === undefined) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // catch out of bounds case\r\n let count = this._reprList.length;\r\n if (index < 0 || index >= count || count <= 1) { // do not allow to remove the single rep\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.unmarkAtoms(this._complex);\r\n this._reprUsedBits &= ~(1 << target.index);\r\n\r\n this._reprList.splice(index, 1);\r\n\r\n // update current rep\r\n if (target === this._repr) {\r\n --count;\r\n index = index < count ? index : count - 1;\r\n this._repr = this._reprList[index];\r\n }\r\n this._reprListChanged = true;\r\n }\r\n\r\n /**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\n repHide(index, hide) {\r\n if (hide === undefined) {\r\n hide = true;\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.show(!hide);\r\n }\r\n\r\n /**\r\n * Select atoms with selector\r\n * @param {Selector} selector - selector\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\n select(selector, append) {\r\n if (append) {\r\n this._selectionCount += this._complex.markAtomsAdditionally(selector, 1 << this._selectionBit);\r\n } else {\r\n this._selectionCount = this._complex.markAtoms(selector, 1 << this._selectionBit);\r\n }\r\n this._complex.updateStructuresMask();\r\n this.rebuildSelectionGeometry();\r\n }\r\n\r\n resetSelectionMask() {\r\n if (this._selectionCount !== 0) {\r\n this._selectionCount = 0;\r\n if (this._complex) {\r\n this._complex.clearAtomBits(1 << this._selectionBit);\r\n }\r\n }\r\n }\r\n\r\n updateSelectionMask(pickedObj) {\r\n const self = this;\r\n const { atom } = pickedObj;\r\n let { residue, chain, molecule } = pickedObj;\r\n const setMask = 1 << this._selectionBit;\r\n const clearMask = ~setMask;\r\n\r\n if (atom) {\r\n residue = atom.residue;\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (atom.mask & setMask) {\r\n atom.mask &= clearMask;\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n if (molecule) {\r\n molecule.mask &= clearMask;\r\n }\r\n this._selectionCount--;\r\n } else {\r\n atom.mask |= setMask;\r\n this._selectionCount++;\r\n\r\n // select residue if all atoms in it are selected\r\n residue.collectMask();\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (residue) {\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (residue._mask & setMask) {\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n residue.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n } else {\r\n residue._mask |= setMask;\r\n residue.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (chain || molecule) {\r\n const obj = chain || molecule;\r\n if (obj._mask & setMask) {\r\n obj._mask &= clearMask;\r\n obj.forEachResidue((r) => {\r\n if (r._mask & setMask) {\r\n r._mask &= clearMask;\r\n r.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n r._mask &= clearMask;\r\n }\r\n });\r\n } else {\r\n obj._mask |= setMask;\r\n obj.forEachResidue((r) => {\r\n if (!(r._mask & setMask)) {\r\n r._mask |= setMask;\r\n r.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n const otherObj = chain ? r.getMolecule() : r.getChain();\r\n if (otherObj) {\r\n otherObj.collectMask();\r\n }\r\n }\r\n });\r\n }\r\n } else {\r\n this.resetSelectionMask();\r\n }\r\n }\r\n\r\n expandSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms to add\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // select marked atoms\r\n const deselectionMask = ~tmpMask;\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask = (atom.mask & deselectionMask) | selectionMask;\r\n ++self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n shrinkSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms neighbouring to unselected ones\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // mark hanging atoms\r\n this._complex.forEachAtom((atom) => {\r\n if ((atom.mask & selectionMask) && (atom.bonds.length === 1)) {\r\n atom.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // deselect marked atoms\r\n const deselectionMask = ~(selectionMask | tmpMask);\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask &= deselectionMask;\r\n --self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n getSelectedComponent() {\r\n const selectionMask = 1 << this._selectionBit;\r\n\r\n let component = null;\r\n let multiple = false;\r\n\r\n // find which component is selected (exclusively)\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & selectionMask) {\r\n if (component === null) {\r\n component = atom.residue._component;\r\n } else if (component !== atom.residue._component) {\r\n multiple = true;\r\n }\r\n }\r\n });\r\n\r\n return multiple ? null : component;\r\n }\r\n\r\n getSelectionCenter(center, includesAtom, selRule) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._complex.forEachAtom((atom) => {\r\n if (includesAtom(atom, selRule)) {\r\n center.add(atom.position);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.applyMatrix4(this.matrix);\r\n return true;\r\n }\r\n\r\n needsRebuild() {\r\n if (this._reprListChanged) {\r\n return true;\r\n }\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n if (repr.needsRebuild) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Rebuild molecule geometry asynchronously.\r\n */\r\n rebuild() {\r\n const self = this;\r\n\r\n // Destroy current geometry\r\n gfxutils.clearTree(this);\r\n\r\n return new Promise(((resolve) => {\r\n // Nothing to do?\r\n const complex = self._complex;\r\n if (!complex) {\r\n resolve();\r\n return;\r\n }\r\n\r\n let errorOccured = false;\r\n setTimeout(() => {\r\n console.time('build');\r\n const reprList = self._reprList;\r\n const palette = palettes.get(settings.now.palette) || palettes.first;\r\n let hasGeometry = false;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n repr.colorer.palette = palette;\r\n\r\n if (repr.needsRebuild) {\r\n repr.reset();\r\n\r\n try {\r\n repr.buildGeometry(complex);\r\n } catch (e) {\r\n if (e instanceof utils.OutOfMemoryError) {\r\n repr.needsRebuild = false;\r\n repr.reset();\r\n logger.error(`Not enough memory to build geometry for representation ${repr.index + 1}`);\r\n errorOccured = true;\r\n } else {\r\n throw e;\r\n }\r\n }\r\n\r\n if (DEBUG && !errorOccured) {\r\n logger.debug(`Triangles count: ${gfxutils.countTriangles(repr.geo)}`);\r\n }\r\n }\r\n\r\n hasGeometry = errorOccured || hasGeometry || gfxutils.groupHasGeometryToRender(repr.geo);\r\n\r\n if (repr.geo) {\r\n self.add(repr.geo);\r\n }\r\n }\r\n\r\n self._reprListChanged = false;\r\n\r\n console.timeEnd('build');\r\n resolve();\r\n }, 10);\r\n }));\r\n }\r\n\r\n setNeedsRebuild() {\r\n // invalidate all representations\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n reprList[i].needsRebuild = true;\r\n }\r\n }\r\n\r\n rebuildSelectionGeometry() {\r\n const mask = 1 << this._selectionBit;\r\n\r\n gfxutils.clearTree(this._selectionGeometry);\r\n\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const repr = this._reprList[i];\r\n const sg = repr.buildSelectionGeometry(mask);\r\n if (!sg) {\r\n continue;\r\n }\r\n\r\n this._selectionGeometry.add(sg);\r\n for (let j = 0; j < sg.children.length; j++) {\r\n const m = sg.children[j];\r\n\r\n // copy component transform (that's not applied yet)\r\n // TODO make this code obsolete, accessing editor is bad\r\n if (this._editor && this._editor._componentTransforms) {\r\n const t = this._editor._componentTransforms[m._component._index];\r\n if (t) {\r\n m.position.copy(t.position);\r\n m.quaternion.copy(t.quaternion);\r\n }\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(sg);\r\n }\r\n }\r\n\r\n _buildSelectorFromSortedLists(atoms, residues, chains) {\r\n const complex = this._complex;\r\n\r\n function optimizeList(list) {\r\n const result = [];\r\n let k = 0;\r\n let first = NaN;\r\n let last = NaN;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const value = list[i];\r\n if (value === last + 1) {\r\n last = value;\r\n } else {\r\n if (!Number.isNaN(first)) {\r\n result[k++] = new selectors.Range(first, last);\r\n }\r\n first = last = value;\r\n }\r\n }\r\n if (!Number.isNaN(first)) {\r\n result[k] = new selectors.Range(first, last);\r\n }\r\n return result;\r\n }\r\n\r\n let expression = null;\r\n if (chains.length === complex._chains.length) {\r\n expression = selectors.all();\r\n } else {\r\n let selector;\r\n if (chains.length > 0) {\r\n selector = selectors.chain(chains);\r\n expression = expression ? selectors.or(expression, selector) : selector;// NOSONAR\r\n }\r\n if (Object.keys(residues).length > 0) {\r\n for (const ch in residues) {\r\n if (residues.hasOwnProperty(ch)) {\r\n selector = selectors.and(\r\n selectors.chain(ch),\r\n selectors.residx(optimizeList(residues[ch])),\r\n );\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n }\r\n }\r\n if (atoms.length > 0) {\r\n selector = selectors.serial(optimizeList(atoms));\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n\r\n if (!expression) {\r\n expression = selectors.none();\r\n }\r\n }\r\n\r\n return expression;\r\n }\r\n\r\n buildSelectorFromMask(mask) {\r\n const complex = this._complex;\r\n const chains = [];\r\n const residues = {};\r\n const atoms = [];\r\n\r\n complex.forEachChain((chain) => {\r\n if (chain._mask & mask) {\r\n chains.push(chain._name);\r\n }\r\n });\r\n\r\n complex.forEachResidue((residue) => {\r\n if (residue._mask & mask && !(residue._chain._mask & mask)) {\r\n const c = residue._chain._name;\r\n if (!(c in residues)) {\r\n residues[c] = [residue._index];\r\n } else {\r\n residues[c].push(residue._index);\r\n }\r\n }\r\n });\r\n\r\n complex.forEachAtom((atom) => {\r\n if (atom.mask & mask && !(atom.residue._mask & mask)) {\r\n atoms.push(atom.serial);\r\n }\r\n });\r\n\r\n return this._buildSelectorFromSortedLists(atoms, residues, chains);\r\n }\r\n\r\n forSelectedResidues(process) {\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.forEachResidue((residue) => {\r\n if (residue._mask & selectionMask) {\r\n process(residue);\r\n }\r\n });\r\n }\r\n\r\n beginComponentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.ComponentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n beginFragmentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.FragmentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n // should only be called by editors\r\n finalizeEdit() {\r\n this._editor = null;\r\n }\r\n\r\n setMaterialValues(values, needTraverse = false, process = undefined) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setValues(values);\r\n if (needTraverse) {\r\n rep.geo.traverse((object) => {\r\n if (object instanceof THREE.Mesh) {\r\n object.material.setValues(values);\r\n\r\n if (process !== undefined) {\r\n process(object);\r\n }\r\n\r\n object.material.needsUpdate = true;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n setUberOptions(values) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setUberOptions(values);\r\n }\r\n }\r\n\r\n /**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\n within(selector, radius) {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return false;\r\n }\r\n\r\n // mark atoms of the group as selected\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.markAtoms(selector, selectionMask);\r\n\r\n // mark all atoms within distance as selected\r\n if (vw) {\r\n vw.forEachAtomWithinDistFromMasked(this._complex, selectionMask, Number(radius), (atom) => {\r\n atom.mask |= selectionMask;\r\n });\r\n }\r\n\r\n // update selection count\r\n this._selectionCount = this._complex.countAtomsByMask(selectionMask);\r\n\r\n // update secondary structure mask\r\n this._complex.updateStructuresMask();\r\n\r\n return this.buildSelectorFromMask(selectionMask);\r\n }\r\n}\r\n// 32 bits = 30 bits for reps + 1 for selection + 1 for selection expansion\r\nComplexVisual.NUM_REPRESENTATION_BITS = 30;\r\n\r\nexport default ComplexVisual;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexVolumeFaces from './VolumeFaces.vert';\r\nimport fragmentVolumeFaces from './VolumeFaces.frag';\r\nimport vertexVolume from './Volume.vert';\r\nimport fragmentVolume from './Volume.frag';\r\nimport vertexFarPlane from './VolumeFarPlane.vert';\r\nimport fragmentFarPlane from './VolumeFarPlane.frag';\r\nimport settings from '../../settings';\r\n\r\nconst volumeUniforms = THREE.UniformsUtils.merge([\r\n {\r\n volumeDim: { type: 'v3', value: new THREE.Vector3(512, 512, 512) },\r\n tileTex: { type: 't', value: null },\r\n tileTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n tileStride: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n\r\n boxAngles: { type: 'v3', value: new THREE.Vector3(1, 1, 1) },\r\n delta: { type: 'v3', value: new THREE.Vector3(0, 0, 0) },\r\n\r\n _isoLevel0: { type: 'v2', value: new THREE.Vector3(0.5, 0.75, 1.0) },\r\n _flipV: { type: 'f', value: 0.0 },\r\n _BFLeft: { type: 't', value: null },\r\n _BFRight: { type: 't', value: null },\r\n _FFLeft: { type: 't', value: null },\r\n _FFRight: { type: 't', value: null },\r\n _WFFLeft: { type: 't', value: null },\r\n _WFFRight: { type: 't', value: null },\r\n },\r\n]);\r\n\r\nfunction overrideUniforms(params, defUniforms) {\r\n const uniforms = THREE.UniformsUtils.clone(defUniforms);\r\n for (const p in params) {\r\n if (uniforms.hasOwnProperty(p)) {\r\n uniforms[p].value = params[p];\r\n }\r\n }\r\n return uniforms;\r\n}\r\n\r\nfunction facesPosMaterialParams(params, sideType) {\r\n return {\r\n uniforms: overrideUniforms(params, {}),\r\n vertexShader: vertexVolumeFaces,\r\n fragmentShader: fragmentVolumeFaces,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n side: sideType,\r\n };\r\n}\r\n\r\nclass BackFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const backFaceParams = facesPosMaterialParams(params, THREE.BackSide);\r\n super(backFaceParams);\r\n }\r\n}\r\n\r\nclass ShaderParams {\r\n constructor(params, uniforms, vertexShader, fragmentShader) {\r\n this.uniforms = overrideUniforms(params, uniforms);\r\n this.vertexShader = vertexShader;\r\n this.fragmentShader = fragmentShader;\r\n this.transparent = false;\r\n this.depthTest = false;\r\n this.depthWrite = false;\r\n this.side = THREE.FrontSide;\r\n }\r\n}\r\n\r\nclass BackFacePosMaterialFarPlane extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const matUniforms = THREE.UniformsUtils.merge([\r\n {\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n farZ: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n matWorld2Volume: { type: '4fv', value: new THREE.Matrix4() },\r\n },\r\n ]);\r\n\r\n const shaderParams = new ShaderParams(params, matUniforms, vertexFarPlane, fragmentFarPlane);\r\n super(shaderParams);\r\n }\r\n}\r\n\r\nclass FrontFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const frontFaceParams = facesPosMaterialParams(params, THREE.FrontSide);\r\n super(frontFaceParams);\r\n }\r\n}\r\n\r\nclass VolumeMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const shaderParams = new ShaderParams(params, volumeUniforms, vertexVolume, fragmentVolume);\r\n shaderParams.transparent = true;\r\n shaderParams.depthTest = true;\r\n\r\n super(shaderParams);\r\n this.updateDefines();\r\n }\r\n\r\n updateDefines() {\r\n this.defines = {\r\n ISO_MODE: settings.now.modes.VD.isoMode,\r\n STEPS_COUNT: settings.now.modes.VD.polyComplexity[settings.now.resolution] * 100,\r\n };\r\n this.needsUpdate = true;\r\n }\r\n}\r\n\r\nexport default {\r\n BackFacePosMaterial,\r\n BackFacePosMaterialFarPlane,\r\n FrontFacePosMaterial,\r\n VolumeMaterial,\r\n};\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport settings from '../settings';\r\n\r\nclass VolumeMesh extends THREE.Mesh {\r\n volumeInfo = {}; // data for noise filter\r\n\r\n constructor() {\r\n const geo = new THREE.BufferGeometry();\r\n super(geo);\r\n this.clipPlane = new THREE.Plane();\r\n const size = new THREE.Vector3(0.5, 0.5, 0.5);\r\n this.size = size;\r\n\r\n this.cullFlag = [\r\n true, true, true, true,\r\n true, true, true, true,\r\n false, false, false, false, false, false,\r\n ];\r\n\r\n this.faces = [\r\n { indices: [], norm: new THREE.Vector3(0, 0, -1) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 1) },\r\n { indices: [], norm: new THREE.Vector3(0, -1, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 1, 0) },\r\n { indices: [], norm: new THREE.Vector3(-1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 0) },\r\n ];\r\n\r\n this.vertices = [\r\n new THREE.Vector3(-size.x, -size.y, -size.z),\r\n new THREE.Vector3(-size.x, size.y, -size.z),\r\n new THREE.Vector3(size.x, -size.y, -size.z),\r\n new THREE.Vector3(size.x, size.y, -size.z),\r\n new THREE.Vector3(-size.x, -size.y, size.z),\r\n new THREE.Vector3(-size.x, size.y, size.z),\r\n new THREE.Vector3(size.x, -size.y, size.z),\r\n new THREE.Vector3(size.x, size.y, size.z),\r\n new THREE.Vector3(0.0, 0.0, 0.0), // Placeholder for section\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n ];\r\n\r\n geo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(this.vertices.length * 3), 3));\r\n\r\n this.name = 'VolumeMesh';\r\n }\r\n\r\n static _corners = [\r\n // x, y, z, edge1, edge2, edge3\r\n [-1, -1, -1, 0, 4, 8],\r\n [1, -1, -1, 0, 5, 9],\r\n [1, 1, -1, 1, 5, 10],\r\n [-1, 1, -1, 1, 4, 11],\r\n [-1, -1, 1, 2, 6, 8],\r\n [1, -1, 1, 2, 7, 9],\r\n [1, 1, 1, 3, 7, 10],\r\n [-1, 1, 1, 3, 6, 11],\r\n ];\r\n\r\n static _edges = [\r\n // corner1, corner2, center_x, center_y, center_z\r\n [0, 1, 0, -1, -1],\r\n [2, 3, 0, 1, -1],\r\n [4, 5, 0, -1, 1],\r\n [6, 7, 0, 1, 1],\r\n [0, 3, -1, 0, -1],\r\n [1, 2, 1, 0, -1],\r\n [4, 7, -1, 0, 1],\r\n [5, 6, 1, 0, 1],\r\n [0, 4, -1, -1, 0],\r\n [1, 5, 1, -1, 0],\r\n [2, 6, -1, 1, 0],\r\n [3, 7, 1, 1, 0],\r\n ];\r\n\r\n static _edgeIntersections = (function () {\r\n const edgeIntersections = [];\r\n for (let j = 0; j < 12; ++j) {\r\n edgeIntersections.push(new THREE.Vector3());\r\n }\r\n return edgeIntersections;\r\n }());\r\n\r\n _updateVertices() {\r\n // Algorithm:\r\n // 1. Get plane parameters\r\n // 2. Compute culling flags for all vertices\r\n // 3. If intersection occurs => compute from 3 to 6 intersection points\r\n const corners = VolumeMesh._corners;\r\n const edges = VolumeMesh._edges;\r\n const edgeIntersections = VolumeMesh._edgeIntersections;\r\n\r\n let i;\r\n\r\n const norm = this.clipPlane.normal;\r\n const D = this.clipPlane.constant;\r\n\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n const cornerMark = [0, 0, 0, 0, 0, 0, 0, 0];\r\n const edgeMark = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];\r\n\r\n const curEdge = new THREE.Vector3();\r\n let curEdgeInter = null;\r\n\r\n function CheckX() {\r\n if (norm.x === 0) return 0;\r\n const x = -(norm.dot(curEdge) + D) / norm.x;\r\n if (-size.x <= x && x <= size.x) {\r\n curEdgeInter.set(x, curEdge.y, curEdge.z);\r\n if (x === size.x) return 2;\r\n if (x === -size.x) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckY() {\r\n if (norm.y === 0) return 0;\r\n const y = -(norm.dot(curEdge) + D) / norm.y;\r\n if (-size.y <= y && y <= size.y) {\r\n curEdgeInter.set(curEdge.x, y, curEdge.z);\r\n if (y === size.y) return 2;\r\n if (y === -size.y) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckZ() {\r\n if (norm.z === 0) return 0;\r\n const z = -(norm.dot(curEdge) + D) / norm.z;\r\n if (-size.z <= z && z <= size.z) {\r\n curEdgeInter.set(curEdge.x, curEdge.y, z);\r\n if (z === size.z) return 2;\r\n if (z === -size.z) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n // for each edge\r\n for (let curEdgeIdx = 0; curEdgeIdx < 12; ++curEdgeIdx) {\r\n const curEdgeSource = edges[curEdgeIdx];\r\n curEdgeInter = edgeIntersections[curEdgeIdx];\r\n\r\n curEdge.set(curEdgeSource[2], curEdgeSource[3], curEdgeSource[4]);\r\n curEdge.multiply(size);\r\n\r\n // calculate intersection point\r\n let flag = 0;\r\n if (curEdgeSource[2] === 0) flag = CheckX();\r\n if (curEdgeSource[3] === 0) flag = CheckY();\r\n if (curEdgeSource[4] === 0) flag = CheckZ();\r\n\r\n // mark corresponding corner (if plane cuts through one)\r\n if (flag === -2) {\r\n cornerMark[curEdgeSource[0]] = 1;\r\n } else if (flag === 2) {\r\n cornerMark[curEdgeSource[1]] = 1;\r\n } else if (flag === 0) {\r\n // edge is not intersected by the plane (doesn't produce a vertex)\r\n edgeMark[curEdgeIdx] = 0;\r\n }\r\n }\r\n\r\n const face = {\r\n indices: [],\r\n norm: norm.clone().negate(),\r\n };\r\n\r\n let nextVertex = 8;\r\n\r\n // for each marked corner\r\n for (i = 0; i < 8; ++i) {\r\n if (cornerMark[i] === 1) {\r\n // add corner as vertex to the face\r\n vert[nextVertex].set(corners[i][0], corners[i][1], corners[i][2]).multiply(size);\r\n face.indices.push(nextVertex++);\r\n // skip adjacent edges\r\n edgeMark[corners[i][3]] = 0;\r\n edgeMark[corners[i][4]] = 0;\r\n edgeMark[corners[i][5]] = 0;\r\n }\r\n }\r\n\r\n // for each edge that has internal intersection\r\n for (i = 0; i < 12; ++i) {\r\n if (edgeMark[i] === 1) {\r\n // add intersection point as vertex to the face\r\n vert[nextVertex].copy(edgeIntersections[i]);\r\n face.indices.push(nextVertex++);\r\n }\r\n }\r\n\r\n this.faces[6] = face;\r\n\r\n const diff = new THREE.Vector3();\r\n const coplanarPoint = new THREE.Vector3();\r\n this.clipPlane.coplanarPoint(coplanarPoint);\r\n for (i = 0; i < vert.length; ++i) {\r\n this.cullFlag[i] = false;\r\n if (i < 8) {\r\n // corners should be culled by clipping plane\r\n diff.subVectors(vert[i], coplanarPoint);\r\n this.cullFlag[i] = (norm.dot(diff) >= 0.0);\r\n } else if (i < 8 + face.indices.length) {\r\n // cross section vertices don't get culled\r\n this.cullFlag[i] = true;\r\n }\r\n }\r\n\r\n // write data to vertex buffer\r\n const positions = this.geometry.getAttribute('position');\r\n let idx = 0;\r\n for (i = 0; i < vert.length; ++i) {\r\n positions.array[idx++] = vert[i].x;\r\n positions.array[idx++] = vert[i].y;\r\n positions.array[idx++] = vert[i].z;\r\n }\r\n positions.needsUpdate = true;\r\n }\r\n\r\n _collectVertices(face, filter) {\r\n let i;\r\n const vert = this.vertices;\r\n face.indices = [];\r\n for (i = 0; i < vert.length; ++i) {\r\n if (this.cullFlag[i] && filter(vert[i])) {\r\n face.indices.push(i);\r\n }\r\n }\r\n }\r\n\r\n _sortIndices(face, right) {\r\n let i;\r\n let j;\r\n const vert = this.vertices;\r\n const angle = [];\r\n\r\n const dir = new THREE.Vector3();\r\n for (i = 1; i < face.indices.length; ++i) {\r\n dir.subVectors(vert[face.indices[i]], vert[face.indices[0]]);\r\n dir.normalize();\r\n dir.cross(right);\r\n dir.negate();\r\n angle[i] = face.norm.dot(dir);\r\n }\r\n\r\n // Exchange sort\r\n for (i = 1; i < face.indices.length - 1; ++i) {\r\n for (j = i + 1; j < face.indices.length; ++j) {\r\n if (angle[j] < angle[i]) {\r\n // swap\r\n let t = angle[i];\r\n angle[i] = angle[j];\r\n angle[j] = t;\r\n\r\n t = face.indices[i];\r\n face.indices[i] = face.indices[j];\r\n face.indices[j] = t;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _updateIndices() {\r\n // Algorithm:\r\n // 1. Get plane vertices (from 3 to 6 vertices)\r\n // 2. Get \"right\" vector in plane\r\n // 3. Sort vertices using Graham-like method\r\n // 4. Create indices\r\n\r\n let i;\r\n let faceIdx;\r\n let face;\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n this._collectVertices(this.faces[0], (vertex) => vertex.z === -size.z);\r\n this._collectVertices(this.faces[1], (vertex) => vertex.z === size.z);\r\n this._collectVertices(this.faces[2], (vertex) => vertex.y === -size.y);\r\n this._collectVertices(this.faces[3], (vertex) => vertex.y === size.y);\r\n this._collectVertices(this.faces[4], (vertex) => vertex.x === -size.x);\r\n this._collectVertices(this.faces[5], (vertex) => vertex.x === size.x);\r\n\r\n const vCenter = new THREE.Vector3();\r\n const vRight = new THREE.Vector3();\r\n const vDir = new THREE.Vector3();\r\n\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n\r\n if (face.indices.length === 0) continue;\r\n\r\n vCenter.set(0, 0, 0);\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vCenter.add(vert[face.indices[i]]);\r\n }\r\n vCenter.multiplyScalar(1.0 / face.indices.length);\r\n vRight.subVectors(vert[face.indices[0]], vCenter);\r\n vRight.normalize();\r\n\r\n const rightProj = [];\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vDir.subVectors(vert[face.indices[i]], vCenter);\r\n rightProj[i] = vDir.dot(vRight);\r\n }\r\n for (i = 1; i < face.indices.length; ++i) {\r\n if (rightProj[i] < rightProj[0]) {\r\n // swap\r\n let t = rightProj[0];\r\n rightProj[0] = rightProj[i];\r\n rightProj[i] = t;\r\n\r\n [t] = face.indices;\r\n face.indices[0] = face.indices[i];\r\n face.indices[i] = t;\r\n }\r\n }\r\n\r\n this._sortIndices(face, vRight);\r\n }\r\n\r\n let numIndices = 0;\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n if (face.indices.length >= 3) {\r\n numIndices += 3 * (face.indices.length - 2);\r\n }\r\n }\r\n let offset = 0;\r\n const indices = new Uint16Array(numIndices);\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n for (i = 0; i < face.indices.length - 2; ++i) {\r\n indices[offset] = face.indices[0]; // eslint-disable-line prefer-destructuring\r\n indices[offset + 1] = face.indices[i + 1];\r\n indices[offset + 2] = face.indices[i + 2];\r\n offset += 3;\r\n }\r\n }\r\n\r\n this.geometry.setIndex(new THREE.BufferAttribute(indices, 1));\r\n }\r\n\r\n setDataSource(dataSource) {\r\n const vm = new VolumeMaterial.VolumeMaterial();\r\n const dim = dataSource.getDimensions();\r\n const stride = dataSource.getTiledTextureStride();\r\n const texture = dataSource.buildTiledTexture();\r\n const bbox = dataSource.getBox();\r\n vm.uniforms.volumeDim.value.set(dim[0], dim[1], dim[2]);\r\n vm.uniforms.tileTex.value = texture;\r\n vm.uniforms.tileTexSize.value.set(texture.image.width, texture.image.height);\r\n vm.uniforms.tileStride.value.set(stride[0], stride[1]);\r\n Object.assign(this.volumeInfo, dataSource.getVolumeInfo());\r\n\r\n const volInfo = this.volumeInfo;\r\n vm.uniforms.delta.value.copy(volInfo.delta);\r\n vm.uniforms.boxAngles.value.set(volInfo.obtuseAngle[0], volInfo.obtuseAngle[1], volInfo.obtuseAngle[2]);\r\n\r\n this.material = vm;\r\n\r\n bbox.getSize(this.scale);\r\n bbox.getCenter(this.position);\r\n }\r\n\r\n _updateIsoLevel() {\r\n const { kSigma, kSigmaMed, kSigmaMax } = settings.now.modes.VD;\r\n const volInfo = this.volumeInfo;\r\n const mean = volInfo.dmean - volInfo.dmin;\r\n const span = volInfo.dmax - volInfo.dmin;\r\n const level = (k) => (mean + k * volInfo.sd) / span;\r\n this.material.uniforms._isoLevel0.value.set(level(kSigma), level(kSigmaMed), level(kSigmaMax));\r\n }\r\n\r\n static _nearClipPlaneOffset = 0.2;\r\n\r\n static _pos = new THREE.Vector3();\r\n\r\n static _norm = new THREE.Vector3();\r\n\r\n static _norm4D = new THREE.Vector4();\r\n\r\n static _matrixWorldToLocal = new THREE.Matrix4();\r\n\r\n static _clipPlane = new THREE.Plane();\r\n\r\n rebuild(camera) {\r\n const nearClipPlaneOffset = VolumeMesh._nearClipPlaneOffset;\r\n const pos = VolumeMesh._pos;\r\n const norm = VolumeMesh._norm;\r\n const norm4D = VolumeMesh._norm4D;\r\n const matrixWorldToLocal = VolumeMesh._matrixWorldToLocal;\r\n const clipPlane = VolumeMesh._clipPlane;\r\n\r\n\r\n this._updateIsoLevel();\r\n\r\n // get clip plane in local space\r\n camera.getWorldDirection(norm);\r\n camera.getWorldPosition(pos);\r\n pos.addScaledVector(norm, camera.near + nearClipPlaneOffset);\r\n\r\n // transform pos to local CS\r\n matrixWorldToLocal.getInverse(this.matrixWorld);\r\n pos.applyMatrix4(matrixWorldToLocal);\r\n\r\n // transform norm to local CS\r\n norm4D.set(norm.x, norm.y, norm.z, 0.0); // NOTE: use homogeneous norm for proper transformation\r\n norm4D.applyMatrix4(matrixWorldToLocal);\r\n norm.copy(norm4D);\r\n norm.normalize();\r\n\r\n clipPlane.setFromNormalAndCoplanarPoint(norm, pos);\r\n\r\n if (!this.clipPlane.equals(clipPlane)) {\r\n this.clipPlane = clipPlane.clone();\r\n this._updateVertices();\r\n this._updateIndices();\r\n }\r\n }\r\n}\r\n\r\n\r\nexport default VolumeMesh;\r\n","import * as THREE from 'three';\r\nimport gfxutils from './gfxutils';\r\n\r\nclass VolumeBounds {\r\n static _projectionTable = { // corresponds between (origin axes and angles between them) and between saving vector coordinates\r\n XY: ['x', 2],\r\n XZ: ['y', 1],\r\n YZ: ['z', 0],\r\n };\r\n\r\n constructor(bBox, volInfo) {\r\n const { delta } = volInfo; // {x: XY, y : XZ, z: YZ}\r\n const { obtuseAngle } = volInfo; // 1 - obtuse, 0 - acute\r\n\r\n const bSize = new THREE.Vector3();\r\n bBox.getSize(bSize);\r\n bSize.multiplyScalar(0.5);\r\n\r\n const offsetVert = this._getBaseVertices(delta, obtuseAngle);\r\n\r\n const geometry = new THREE.Geometry();\r\n\r\n for (let i = 0; i < 4; i++) {\r\n geometry.vertices.push(offsetVert[i].clone().multiply(bSize));\r\n geometry.vertices.push(offsetVert[(i + 1) % 4].clone().multiply(bSize));\r\n }\r\n const translation = new THREE.Vector3(2 * bSize.x * (1 - delta.x - delta.y), 0, 0);\r\n for (let i = 0; i < 8; i++) {\r\n geometry.vertices.push(geometry.vertices[i].clone().add(translation));\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n geometry.vertices.push(geometry.vertices[i * 2].clone());\r\n geometry.vertices.push(geometry.vertices[i * 2 + 8].clone());\r\n }\r\n const center = new THREE.Vector3();\r\n bBox.getCenter(center);\r\n geometry.vertices.forEach((vertex) => vertex.add(center)); // pivot shift\r\n\r\n this._lines = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ color: 0xFFFFFF }));\r\n this._lines.layers.set(gfxutils.LAYERS.VOLUME);\r\n }\r\n\r\n // Set one edge (4 points) of frame, from which with parallel transfer the rest of the frame points can be obtained\r\n _getBaseVertices(delta, obtuseAngle) {\r\n const projTable = VolumeBounds._projectionTable;\r\n\r\n const proj = ((index, inv) => { // tricky function to take account of projections: their position(related to box) and sign\r\n const currDelta = delta[projTable[index][0]];\r\n const angleValue = -0.5 * (inv - 1) + inv * obtuseAngle[projTable[index][1]];// inv = 1: alpha; inv = -1: 1 - alpha\r\n return angleValue * currDelta;\r\n });\r\n\r\n const offsetVert = [\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', 1)), -1 + 2 * proj('YZ', 1), -1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', 1)), -1 + 2 * proj('YZ', -1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', -1)), 1 - 2 * proj('YZ', 1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', -1)), 1 - 2 * proj('YZ', -1), -1),\r\n ];\r\n\r\n return offsetVert;\r\n }\r\n\r\n getMesh() {\r\n return this._lines;\r\n }\r\n}\r\n\r\nexport default VolumeBounds;\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport meshes from './meshes/meshes';\r\nimport gfxutils from './gfxutils';\r\n\r\n// Thes geometric far plane is required for correct filling in the BFTexture in case, when far plane cuts the volume\r\n// cube. In cut place of cube there is no correct data in BFTexture and volume rendering integral is calculated\r\n// with errors.\r\n// Far plane cuts the cube in case of large volume scale (zoom), because farplane doesn't change\r\nclass VolumeFarPlane {\r\n // create plane with unit corners coords (for future rescale in vshader according to camera properties)\r\n constructor(volume, width, height) {\r\n const planeGeo = this._initPlaneGeo(width, height);\r\n\r\n const mat = new VolumeMaterial.BackFacePosMaterialFarPlane();\r\n this._plane = new meshes.Mesh(planeGeo, mat);\r\n this._plane.frustumCulled = false;\r\n this._plane.doubleSided = true;\r\n const matWorldToVolume = new THREE.Matrix4();\r\n\r\n this._plane._onBeforeRender = function (_renderer, _scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!volume || !material) {\r\n return;\r\n }\r\n\r\n // count point in world at farplane place\r\n const planeCamPos = new THREE.Vector4(0, 0, -(camera.far - 0.1), 1);\r\n planeCamPos.applyMatrix4(camera.matrixWorld);\r\n\r\n // recalc matrices to make plane be placed as farplane in the World relative to camera\r\n this.matrix.identity();\r\n this.matrix.makeTranslation(planeCamPos.x, planeCamPos.y, planeCamPos.z);\r\n this.matrixWorld.copy(this.matrix);\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n this.normalMatrix.getNormalMatrix(this.modelViewMatrix);\r\n\r\n // build worldToVolume matrix to transform plane into volumeCS (volumeCS coords are written to BackFaceTexture)\r\n const volumeMatrix = volume.matrixWorld;\r\n matWorldToVolume.getInverse(volumeMatrix);\r\n\r\n // update material props\r\n material.uniforms.aspectRatio.value = camera.aspect;\r\n material.uniforms.farZ.value = camera.far;\r\n material.uniforms.tanHalfFOV.value = Math.tan(THREE.Math.DEG2RAD * 0.5 * camera.fov);\r\n material.uniforms.matWorld2Volume.value = matWorldToVolume;\r\n };\r\n\r\n // set it to special layer to draw only into BFTexture\r\n this._plane.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n }\r\n\r\n _initPlaneGeo(width, height) {\r\n const planeGeo = new THREE.Geometry();\r\n\r\n width = width || 1;\r\n height = height || 1;\r\n\r\n planeGeo.vertices.push(new THREE.Vector3(-0.5 * width, 0.5 * height, 0));\r\n planeGeo.vertices.push(new THREE.Vector3(0.5 * width, 0.5 * height, 0));\r\n planeGeo.vertices.push(new THREE.Vector3(-0.5 * width, -0.5 * height, 0));\r\n planeGeo.vertices.push(new THREE.Vector3(0.5 * width, -0.5 * height, 0));\r\n\r\n planeGeo.faces.push(new THREE.Face3(0, 2, 1));\r\n planeGeo.faces.push(new THREE.Face3(2, 3, 1));\r\n\r\n return planeGeo;\r\n }\r\n\r\n getMesh() {\r\n return this._plane;\r\n }\r\n}\r\n\r\nexport default VolumeFarPlane;\r\n","import * as THREE from 'three';\r\nimport utils from './utils';\r\nimport VolumeMesh from './gfx/VolumeMesh';\r\nimport VolumeBounds from './gfx/VolumeBounds';\r\nimport VolumeFarPlane from './gfx/VolumeFarPlane';\r\nimport Visual from './Visual';\r\nimport settings from './settings';\r\n\r\nfunction VolumeVisual(name, dataSource) {\r\n Visual.call(this, name, dataSource);\r\n\r\n this._mesh = new VolumeMesh();\r\n this._mesh.setDataSource(dataSource);\r\n this.add(this._mesh);\r\n\r\n this._frame = new VolumeBounds(this.getBoundaries().boundingBox, this._mesh.volumeInfo);\r\n this.add(this._frame.getMesh());\r\n this.showFrame(settings.now.modes.VD.frame);\r\n\r\n this._farPlane = new VolumeFarPlane(this._mesh, 2, 2);\r\n this.add(this._farPlane.getMesh());\r\n}\r\n\r\nutils.deriveClass(VolumeVisual, Visual);\r\n\r\nVolumeVisual.prototype.getBoundaries = function () {\r\n const box = this._dataSource.getBox();\r\n const sphere = new THREE.Sphere();\r\n box.getBoundingSphere(sphere);\r\n\r\n return {\r\n boundingBox: box,\r\n boundingSphere: sphere,\r\n };\r\n};\r\n\r\nVolumeVisual.prototype.getMesh = function () {\r\n return this._mesh;\r\n};\r\n\r\nVolumeVisual.prototype.showFrame = function (needShow) {\r\n this._frame.getMesh().material.visible = needShow;\r\n};\r\n\r\nexport default VolumeVisual;\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available loaders.\r\n * @extends EntityList\r\n */\r\nclass LoaderList extends EntityList {\r\n /**\r\n * Create a list of loaders.\r\n * The loaders are indexed by supported source types (`.types` property of a Loader\r\n * subclass).\r\n * The loaders can be retrieved later by matching against specs (see {@link LoaderList#find}).\r\n *\r\n * @param {!Array=} someLoaders A list of {@link Loader} subclasses to\r\n * automatically register at creation time.\r\n * @see LoaderList#register\r\n */\r\n constructor(someLoaders = []) {\r\n super(someLoaders, ['types']);\r\n }\r\n\r\n /**\r\n * Find a suitable loader for a source type.\r\n *\r\n * @param {Object} specs Loader specifications.\r\n * @param {string=} specs.type Supported source type.\r\n * @param {*=} specs.source Source to load from.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.type) {\r\n list = this._dict.types[specs.type.toLowerCase()] || [];\r\n } else if (specs.source) {\r\n return this._list.filter((SomeLoader) => SomeLoader.canProbablyLoad && SomeLoader.canProbablyLoad(specs.source));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default LoaderList;\r\n","import EventDispatcher from '../../utils/EventDispatcher';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Loader extends EventDispatcher {\r\n constructor(source, options) {\r\n super();\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n this._agent = null;\r\n }\r\n\r\n load() {\r\n return Promise.reject(new Error('Loading from this source is not implemented'));\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n if (this._agent) {\r\n this._agent.abort();\r\n }\r\n }\r\n\r\n static extractName(_source) {\r\n return undefined;\r\n }\r\n}\r\n\r\nmakeContextDependent(Loader.prototype);\r\n","import Loader from './Loader';\r\n\r\nexport default class FileLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = options.binary === true;\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const blob = this._source;\r\n const reader = this._agent = new FileReader();\r\n\r\n reader.addEventListener('load', () => {\r\n resolve(reader.result);\r\n });\r\n reader.addEventListener('error', () => {\r\n reject(reader.error);\r\n });\r\n reader.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n reader.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n if (this._binary) {\r\n reader.readAsArrayBuffer(blob);\r\n } else {\r\n reader.readAsText(blob);\r\n }\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return (File && source instanceof File) || (Blob && source instanceof Blob);\r\n }\r\n\r\n static extractName(source) {\r\n return source && source.name;\r\n }\r\n}\r\n\r\nFileLoader.types = ['file', 'blob'];\r\n","import _ from 'lodash';\r\nimport Loader from './Loader';\r\n\r\n// we don't need to detect all kinds of URLs, just the evident ones\r\nconst urlStartRegexp = /^(https?|ftp):\\/\\//i;\r\n\r\nexport default class XHRLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = (options.binary === true);\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const url = this._source;\r\n const request = this._agent = new XMLHttpRequest();\r\n\r\n request.addEventListener('load', () => {\r\n if (request.status === 200) {\r\n resolve(request.response);\r\n } else {\r\n reject(new Error(`HTTP ${request.status} while fetching ${url}`));\r\n }\r\n });\r\n request.addEventListener('error', () => {\r\n reject(new Error('HTTP request failed'));\r\n });\r\n request.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n request.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n request.open('GET', url);\r\n if (this._binary) {\r\n request.responseType = 'arraybuffer';\r\n } else {\r\n request.responseType = 'text';\r\n }\r\n request.send();\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return _.isString(source) && urlStartRegexp.test(source);\r\n }\r\n\r\n static extractName(source) {\r\n if (source) {\r\n const last = (source.indexOf('?') + 1 || source.lastIndexOf('#') + 1 || source.length + 1) - 1;\r\n return source.slice(source.lastIndexOf('/', last) + 1, last);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nXHRLoader.types = ['url'];\r\n","import Loader from './Loader';\r\n\r\nexport default class ImmediateLoader extends Loader {\r\n load() {\r\n return new Promise((resolve) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n resolve(this._source);\r\n });\r\n }\r\n\r\n static canProbablyLoad(_source) {\r\n return false;\r\n }\r\n}\r\n\r\nImmediateLoader.types = ['immediate'];\r\n","import LoaderList from './loaders/LoaderList';\r\n\r\nimport FileLoader from './loaders/FileLoader';\r\nimport XHRLoader from './loaders/XHRLoader';\r\nimport ImmediateLoader from './loaders/ImmediateLoader';\r\n\r\nexport default new LoaderList([\r\n // note: order might be important\r\n FileLoader,\r\n XHRLoader,\r\n ImmediateLoader,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available parsers.\r\n * @extends EntityList\r\n */\r\nclass ParserList extends EntityList {\r\n /**\r\n * Create a list of parsers.\r\n * The parsers are indexed by supported data formats and file extensions (`.formats` and\r\n * `.extensions` properties of a Parser subclass).\r\n * The parsers can be retrieved later by matching against specs (see {@link ParsrerList#find}).\r\n *\r\n * @param {!Array=} someParsers A list of {@link Parser} subclasses to\r\n * automatically register at creation time.\r\n * @see ParserList#register\r\n */\r\n constructor(someParsers = []) {\r\n super(someParsers, ['formats', 'extensions']);\r\n }\r\n\r\n /**\r\n * Find a suitable parser for data.\r\n *\r\n * @param {Object} specs Parser specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {string=} specs.ext Supported filename extension.\r\n * @param {*=} specs.data Data to parse.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n } else if (specs.ext) {\r\n list = this._dict.extensions[specs.ext.toLowerCase()] || [];\r\n }\r\n // autodetect only if no format is forced\r\n if (list.length === 0 && !specs.format && specs.data) {\r\n return this._list.filter((SomeParser) => SomeParser.canProbablyParse && SomeParser.canProbablyParse(specs.data));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ParserList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Parser {\r\n constructor(data, options) {\r\n this._data = data;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n parseSync() {\r\n throw new Error('Parsing this type of data is not implemented');\r\n }\r\n\r\n parse() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Parsing aborted'));\r\n }\r\n return resolve(this.parseSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n // only for volume Parsers\r\n getModel() {\r\n this.model._parseHeader(this._data);\r\n return this.model;\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Parser.prototype);\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 290\".\r\n *\r\n * @exports Remark290\r\n * @constructor\r\n */\r\nclass Remark290 {\r\n constructor() {\r\n /** @type {THREE.Matrix4[]} */\r\n this.matrices = [];\r\n\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (stream.readString(12, 18) === ' SMTRY') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === this.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n }\r\n }\r\n}\r\n\r\nRemark290.prototype.id = 290;\r\n\r\nexport default Remark290;\r\n","import * as THREE from 'three';\r\nimport chem from '../../../chem';\r\n\r\nconst { Assembly } = chem;\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 350\".\r\n *\r\n * @exports Remark350\r\n * @constructor\r\n */\r\nclass Remark350 {\r\n constructor(complex) {\r\n /** @type {Complex} */\r\n this._complex = complex;\r\n /** @type {Assembly[]} */\r\n this.assemblies = [];\r\n\r\n /** @type {?Assembly} */\r\n this._assembly = null;\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?Assembly} */\r\n let assembly = this._assembly;\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (assembly && stream.readString(12, 18) === ' BIOMT') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === assembly.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n } else if (assembly && stream.readString(35, 41) === 'CHAINS:') {\r\n const entries = stream.readString(42, 80).split(',');\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const chain = entries[i].trim();\r\n if (chain.length > 0) {\r\n assembly.addChain(chain);\r\n }\r\n }\r\n } else if (stream.readString(12, 23) === 'BIOMOLECULE:') {\r\n // assert molIndex === this.assemblies.length + 1\r\n this._matrix = null;\r\n this._matrixIndex = -1;\r\n this._assembly = assembly = new Assembly(this._complex);\r\n this.assemblies.push(assembly);\r\n }\r\n }\r\n}\r\n\r\nRemark350.prototype.id = 350;\r\n\r\nexport default Remark350;\r\n","/** Helper class for stream-like reading input files. */\r\nclass PDBStream {\r\n /**\r\n * Create a stream\r\n * @param {String} data Input data\r\n */\r\n constructor(data) {\r\n /** @type String */\r\n this._data = data; // Input file\r\n /** @type Number */\r\n this._start = 0; // Starting position of line\r\n /** @type Number */\r\n this._nextCR = -1; // Position of next CR (0x0D)\r\n /** @type Number */\r\n this._nextLF = -1; // Position of next LF (0x0A)\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n /** @type Number */\r\n this._end = data.length; // End of data\r\n\r\n this.next();\r\n }\r\n\r\n /**\r\n * Reading next line.\r\n * @returns {String} Next line in data (ending with LF or CR)\r\n */\r\n readLine() {\r\n return this._data.slice(this._start, this._next);\r\n }\r\n\r\n /**\r\n * Reading character from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {String} Character from position\r\n */\r\n readChar(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data[pos] : ' ';\r\n }\r\n\r\n /**\r\n * Reading character code from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {Number} Character code from position\r\n */\r\n readCharCode(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data.charCodeAt(pos) : 32;\r\n }\r\n\r\n /**\r\n * Reading string from begin to end points.\r\n * For a reason unknown, numbering assumed not to start from 0, but from 1.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {String} String from begin to end\r\n */\r\n readString(begin, end) {\r\n const from = this._start + begin - 1;\r\n const to = this._start + end;\r\n return this._data.slice(from, to < this._next ? to : this._next);\r\n }\r\n\r\n /**\r\n * Reading integer from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Integer from begin to end\r\n */\r\n readInt(begin, end) {\r\n return parseInt(this.readString(begin, end), 10);\r\n }\r\n\r\n /**\r\n * Reading float from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Float from begin to end\r\n */\r\n readFloat(begin, end) {\r\n return parseFloat(this.readString(begin, end));\r\n }\r\n\r\n /**\r\n * Checking for end of data.\r\n * @returns {boolean} True if data is ended, false otherwise\r\n */\r\n end() {\r\n return this._start >= this._end;\r\n }\r\n\r\n /**\r\n * Procedure to re-arrange current pointers in data.\r\n */\r\n next() {\r\n const start = this._next + 1;\r\n this._start = start < this._end ? start : this._end;\r\n\r\n // support CR, LF, CR+LF line endings\r\n // do not support LF+CR, CR+CR+LF, and other strange combinations\r\n\r\n if (this._start > this._nextCR) {\r\n this._nextCR = (this._data.indexOf('\\r', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n if (this._start > this._nextLF) {\r\n this._nextLF = (this._data.indexOf('\\n', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n this._next = this._nextCR + 1 < this._nextLF ? this._nextCR : this._nextLF;\r\n }\r\n}\r\n\r\nexport default PDBStream;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport Remark290 from './pdb/Remark290';\r\nimport Remark350 from './pdb/Remark350';\r\nimport PDBStream from './PDBStream';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst TAG_LENGTH = 6;\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\n// the most frequently used beginnings; although HEADER is mandatory, it is often missing in handmade files\r\nconst pdbStartRegexp = /^(HEADER\\s|COMPND\\s|REMARK\\s|ATOM {2}|HETATM|MODEL )/i;\r\n\r\nconst remarkParsers = {\r\n // NOTE: please forget the idea to build the method name in runtime, it can be obfuscated.\r\n 290: Remark290,\r\n 350: Remark350,\r\n};\r\n\r\nclass PDBParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._sheet = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._compaundFound = false;\r\n this._biomoleculeFound = false;\r\n this._allowedChainsIDs = null;\r\n this._lastMolId = -1;\r\n\r\n this._remarks = {};\r\n this._remark = null;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n this._compndCurrToken = '';\r\n\r\n this._options.fileType = 'pdb';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && pdbStartRegexp.test(data);\r\n }\r\n\r\n _finalize() {\r\n this._fixBondsArray();\r\n this._fixChains();\r\n\r\n // keep crystallographic symmetry transformations\r\n const remark290 = this._remarks[290];\r\n this._complex.symmetry = _.isUndefined(remark290) ? [] : remark290.matrices;\r\n\r\n // add loaded biological assemblies\r\n const remark350 = this._remarks[350];\r\n this._complex.units = this._complex.units.concat(_.isUndefined(remark350) ? [] : remark350.assemblies);\r\n\r\n // add loaded macromolecules\r\n this._finalizeMolecules();\r\n\r\n // create secondary structure etc.\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _finalizeMolecules() {\r\n // get chains from complex\r\n const chainDict = {};\r\n let i;\r\n const chains = this._complex._chains;\r\n for (i = 0; i < chains.length; ++i) {\r\n const chainObj = chains[i];\r\n const chainName = chainObj._name;\r\n chainDict[chainName] = chainObj;\r\n }\r\n\r\n // aggregate residues from chains\r\n for (i = 0; i < this._molecules.length; i++) {\r\n const m = this._molecules[i];\r\n let residues = [];\r\n for (let j = 0; j < m._chains.length; j++) {\r\n const name = m._chains[j];\r\n const chain = chainDict[name];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, m._name, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _fixChains() {\r\n const idChainMap = {};\r\n const complex = this._complex;\r\n\r\n // prepare\r\n for (let i = 0; i < complex._chains.length; i++) {\r\n const chain = complex._chains[i];\r\n idChainMap[chain._name.charCodeAt(0)] = chain;\r\n }\r\n }\r\n\r\n // FIXME: This function is redundant, CONECT records always follow ATOM and HETATM. Build the map online.\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseATOM(stream) {\r\n if (this._modelId !== 1) {\r\n return;\r\n }\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const het = stream.readCharCode(1) === 0x48;\r\n\r\n // field names according to wwPDB Format\r\n // NOTE: Chimera allows (nonstandard) use of columns 6-11 for the integer atom serial number in ATOM records.\r\n const serial = het ? stream.readInt(7, 11) : stream.readInt(6, 11);\r\n let name = stream.readString(13, 16);\r\n const altLoc = stream.readChar(17);\r\n const resName = stream.readString(18, 20).trim();\r\n const chainID = stream.readChar(22);\r\n const resSeq = stream.readInt(23, 26);\r\n const iCode = stream.readChar(27);\r\n const x = stream.readFloat(31, 38);\r\n const y = stream.readFloat(39, 46);\r\n const z = stream.readFloat(47, 54);\r\n const occupancy = stream.readFloat(55, 60);\r\n const tempFactor = stream.readFloat(61, 66);\r\n const element = stream.readString(77, 78).trim() || nameToElement(name);\r\n const charge = stream.readInt(79, 80) || 0;\r\n /* eslint-enable no-magic-numbers */\r\n // skip waters (there may be lots of them)\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n // PDB uses positional system for atom names. It helps derive element type from the name\r\n // but names may include extra spaces. From this point on we don't need those spaces anymore.\r\n name = name.trim();\r\n\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name]; // FIXME: Maybe should use type as additional index (\" CA \" vs. \"CA \")\r\n\r\n // NOTE: Residues of a particular chain are not required to be listed next to each other.\r\n // https://github.com/biasmv/pv/commit/7319b898b7473ba380c26699e3b028b2b1a7e1a1\r\n let chain = this._chain;\r\n if (!chain || chain.getName() !== chainID) {\r\n this._chain = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n _parseENDMDL() {\r\n this._modelId += 1;\r\n }\r\n\r\n _parseCONECT(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const serial0 = stream.readInt(7, 11);\r\n const serial1 = stream.readInt(12, 16);\r\n const serial2 = stream.readInt(17, 21);\r\n const serial3 = stream.readInt(22, 26);\r\n const serial4 = stream.readInt(27, 31);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const complex = this._complex;\r\n\r\n // Keep bonds ordered by atom serial\r\n if (serial1 && serial1 > serial0) {\r\n complex.addBond(serial0, serial1, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial2 && serial2 > serial0) {\r\n complex.addBond(serial0, serial2, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial3 && serial3 > serial0) {\r\n complex.addBond(serial0, serial3, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial4 && serial4 > serial0) {\r\n complex.addBond(serial0, serial4, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n }\r\n\r\n _parseCOMPND(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const str = stream.readString(11, 80);\r\n const tokenIdx = str.indexOf(':');\r\n this._compndCurrToken = tokenIdx > 0 ? str.substring(0, tokenIdx).trim() : this._compndCurrToken;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // start reading new molecule\r\n if (this._compndCurrToken === 'MOL_ID') {\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = parseInt(str.substring(tokenIdx + 1, str.indexOf(';')), 10);\r\n this._molecules.push(this._molecule);\r\n // parse molecule name\r\n } else if (this._compndCurrToken === 'MOLECULE' && this._molecule != null) {\r\n this._molecule._name = str.substring(tokenIdx + 1, str.indexOf(';')).trim();\r\n // parse molecule chains\r\n } else if (this._compndCurrToken === 'CHAIN' && this._molecule != null) {\r\n let chainStr = str.substring(tokenIdx + 1, 80).trim();\r\n const lastChar = chainStr[chainStr.length - 1];\r\n if (lastChar === ';' || lastChar === ',') {\r\n chainStr = chainStr.slice(0, -1);\r\n }\r\n chainStr = chainStr.replace(/\\s+/g, '');\r\n const chains = chainStr.split(',');\r\n this._molecule._chains = this._molecule._chains.concat(chains);\r\n }\r\n }\r\n\r\n _parseREMARK(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const remarkNum = stream.readInt(8, 10);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // create remark parser if needed\r\n let remark = this._remarks[remarkNum];\r\n if (_.isUndefined(remark)) {\r\n const RemarkParser = remarkParsers[remarkNum];\r\n if (_.isFunction(RemarkParser)) {\r\n this._remarks[remarkNum] = remark = new RemarkParser(this._complex);\r\n }\r\n }\r\n\r\n // delegate parsing\r\n if (!_.isUndefined(remark)) {\r\n remark.parse(stream);\r\n }\r\n }\r\n\r\n _parseHELIX(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [20, 22, 32, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addHelix(obj);\r\n this._complex.structures.push(obj);\r\n });\r\n }\r\n\r\n _parseSHEET(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [22, 23, 33, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addSheet(obj);\r\n });\r\n }\r\n\r\n _parseSTRUCTURE(stream, pars, adder) {\r\n const startId = 0;\r\n const startIndex = 1;\r\n const endId = 2;\r\n const endIndex = 3;\r\n\r\n // identify fields: debugging and stuff\r\n /* eslint-disable no-magic-numbers */\r\n const codeOfS = 0x53;\r\n const serialNumber = stream.readInt(8, 10);\r\n const structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim()\r\n const comment = stream.readString(41, 70).trim();\r\n const helLength = stream.readInt(72, 76);\r\n const helixClass = stream.readInt(39, 40);\r\n const shWidth = stream.readInt(15, 16);\r\n const shCur = stream.readInt(42, 45);\r\n const shPrev = stream.readInt(57, 60);\r\n /* eslint-enable no-magic-numbers */\r\n // file fields\r\n const startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0);\r\n const endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0);\r\n const startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3);\r\n let iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4);\r\n let startICode = 0;\r\n\r\n if (iCodeStr.length > 0) {\r\n startICode = iCodeStr.charCodeAt(0);\r\n }\r\n const endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3);\r\n iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4);\r\n let endICode = 0;\r\n if (iCodeStr.length > 0) {\r\n endICode = iCodeStr.charCodeAt(0);\r\n }\r\n\r\n let obj;\r\n let cs = this._sheet;\r\n if (stream.readCharCode(1) === codeOfS) {\r\n if (cs !== null && cs.getName() !== structureName) {\r\n cs = null;\r\n this._sheet = null;\r\n }\r\n if (cs === null) {\r\n this._sheet = obj = new Sheet(structureName, shWidth);\r\n adder(obj);\r\n } else {\r\n obj = cs;\r\n }\r\n const strand = new Strand(\r\n obj,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n helixClass, shCur, shPrev,\r\n );\r\n obj.addStrand(strand);\r\n this._complex.structures.push(strand);\r\n } else {\r\n obj = new Helix(\r\n helixClass,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n serialNumber, structureName, comment, helLength,\r\n );\r\n adder(obj);\r\n }\r\n }\r\n\r\n _parseHEADER(stream) {\r\n const { metadata } = this._complex;\r\n metadata.classification = stream.readString(11, 50).trim();\r\n metadata.date = stream.readString(51, 59).trim();\r\n\r\n const id = stream.readString(63, 66).trim();\r\n metadata.id = id;\r\n if (id) {\r\n this._complex.name = id;\r\n }\r\n metadata.format = 'pdb';\r\n }\r\n\r\n _parseTITLE(stream) {\r\n const { metadata } = this._complex;\r\n metadata.title = metadata.title || [];\r\n\r\n const line = stream.readInt(9, 10) || 1;\r\n metadata.title[line - 1] = stream.readString(11, 80).trim();\r\n }\r\n\r\n static tagParsers = {\r\n HEADER: PDBParser.prototype._parseHEADER,\r\n 'TITLE ': PDBParser.prototype._parseTITLE,\r\n 'ATOM ': PDBParser.prototype._parseATOM,\r\n HETATM: PDBParser.prototype._parseATOM,\r\n ENDMDL: PDBParser.prototype._parseENDMDL,\r\n CONECT: PDBParser.prototype._parseCONECT,\r\n COMPND: PDBParser.prototype._parseCOMPND,\r\n REMARK: PDBParser.prototype._parseREMARK,\r\n // 'SOURCE': PDBParser.prototype._parseSOURCE,\r\n 'HELIX ': PDBParser.prototype._parseHELIX,\r\n 'SHEET ': PDBParser.prototype._parseSHEET,\r\n\r\n // nonstandard extension to allow range 100,000 - 999,999\r\n 'ATOM 1': PDBParser.prototype._parseATOM,\r\n 'ATOM 2': PDBParser.prototype._parseATOM,\r\n 'ATOM 3': PDBParser.prototype._parseATOM,\r\n 'ATOM 4': PDBParser.prototype._parseATOM,\r\n 'ATOM 5': PDBParser.prototype._parseATOM,\r\n 'ATOM 6': PDBParser.prototype._parseATOM,\r\n 'ATOM 7': PDBParser.prototype._parseATOM,\r\n 'ATOM 8': PDBParser.prototype._parseATOM,\r\n 'ATOM 9': PDBParser.prototype._parseATOM,\r\n };\r\n\r\n parseSync() {\r\n const stream = new PDBStream(this._data);\r\n const result = this._complex = new Complex();\r\n\r\n // parse PDB line by line\r\n while (!stream.end()) {\r\n const tag = stream.readString(1, TAG_LENGTH);\r\n const func = PDBParser.tagParsers[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, stream);\r\n }\r\n stream.next();\r\n }\r\n\r\n // Resolve indices and serials to objects\r\n this._finalize();\r\n\r\n // cleanup\r\n this._serialAtomMap = null;\r\n this._sheet = null;\r\n this._residue = null;\r\n this._chain = null;\r\n this._complex = null;\r\n\r\n if (result.getAtomCount() === 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\nPDBParser.formats = ['pdb'];\r\nPDBParser.extensions = ['.pdb', '.ent'];\r\n\r\nexport default PDBParser;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n SGroup,\r\n Bond,\r\n} = chem;\r\n\r\nconst cOrderCharCodes = {\r\n A: 0,\r\n S: 1,\r\n D: 2,\r\n T: 3,\r\n};\r\n\r\nconst cmlStartRegexp = /\\s*<\\?xml\\b[^?>]*\\?>\\s*<(?:cml|molecule)\\b/i;\r\n\r\nclass CMLParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._complex = null;\r\n this._residue = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._lastMolId = -1;\r\n this._readOnlyOneMolecule = false;\r\n this._options.fileType = 'cml';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && cmlStartRegexp.test(data);\r\n }\r\n\r\n _rebuidBondIndexes(atoms, bonds) {\r\n const count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n\r\n const countBonds = bonds.length;\r\n for (let j = 0; j < countBonds; j++) {\r\n const idxs = bonds[j].atomRefs2.split(' ');\r\n if (idxs[0] === atomId) {\r\n bonds[j].start = i;\r\n }\r\n\r\n if (idxs[1] === atomId) {\r\n bonds[j].end = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _createSGroup(molecule, moleculeArr) {\r\n const newGroup = new SGroup(\r\n molecule.id, molecule.fieldData,\r\n new THREE.Vector3(parseFloat(molecule.x), parseFloat(molecule.y), 0), molecule.atomRefs, molecule,\r\n );\r\n if (molecule.placement === 'Relative') {\r\n newGroup._center = new THREE.Vector3(0, 0, 0);\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_CHARGE') {\r\n newGroup._charge = parseInt(molecule.fieldData, 10) || 0;\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_COEFFICIENT') {\r\n newGroup._repeat = parseInt(molecule.fieldData, 10) || 1;\r\n }\r\n moleculeArr.push(newGroup);\r\n }\r\n\r\n _extractSGroup(molecule, moleculeArr) {\r\n if (!Array.isArray(moleculeArr)) {\r\n moleculeArr = [];\r\n }\r\n\r\n if (molecule) {\r\n if (Array.isArray(molecule)) {\r\n const count = molecule.length;\r\n for (let i = 0; i < count; i++) {\r\n if (molecule[i].molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule[i].molecule));\r\n }\r\n this._createSGroup(molecule[i], moleculeArr);\r\n }\r\n } else {\r\n if (molecule.molecule) {\r\n if (molecule.molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule.molecule));\r\n }\r\n }\r\n this._createSGroup(molecule, moleculeArr);\r\n }\r\n }\r\n\r\n return moleculeArr;\r\n }\r\n\r\n\r\n _extractSGroups(molecule, atoms) {\r\n const moleculeArr = this._extractSGroup(molecule);\r\n\r\n\r\n const count = atoms.length;\r\n let i;\r\n let j;\r\n\r\n for (i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n const firstAtomRef = moleculeArr[j]._atoms.split(' ')[0];\r\n if (firstAtomRef === atomId) {\r\n if (!atoms[i].sgroupRef) {\r\n atoms[i].sgroupRef = [];\r\n }\r\n atoms[i].sgroupRef.push(moleculeArr[j]);\r\n }\r\n }\r\n }\r\n // build sGroups centers\r\n let atomMap = {}; // sgrpmap cache\r\n let mapEntry = null;\r\n const nLimon = 100000000;\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n\r\n function cycleFuncInner(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n moleculeArr[j]._atoms.push(mapEntry.a);\r\n }\r\n }\r\n\r\n function cycleFunc(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n bLow.set(Math.min(bLow.x, mapEntry.x), Math.min(bLow.y, mapEntry.y), Math.min(bLow.z, mapEntry.z));\r\n bHight.set(Math.max(bHight.x, mapEntry.x), Math.max(bHight.y, mapEntry.y), Math.max(bHight.z, mapEntry.z));\r\n cycleFuncInner(e);\r\n }\r\n }\r\n\r\n for (i = 0; i < atoms.length; i++) {\r\n atomMap[atoms[i].id] = {};\r\n atomMap[atoms[i].id].x = atoms[i].x2;\r\n if (atoms[i].x3) {\r\n atomMap[atoms[i].id].x = atoms[i].x3;\r\n }\r\n atomMap[atoms[i].id].x = parseFloat(atomMap[atoms[i].id].x);\r\n atomMap[atoms[i].id].y = atoms[i].y2;\r\n if (atoms[i].y3) {\r\n atomMap[atoms[i].id].y = atoms[i].y3;\r\n }\r\n atomMap[atoms[i].id].y = parseFloat(atomMap[atoms[i].id].y);\r\n atomMap[atoms[i].id].z = '0.0';\r\n if (atoms[i].z3) {\r\n atomMap[atoms[i].id].z = atoms[i].z3;\r\n }\r\n atomMap[atoms[i].id].z = parseFloat(atomMap[atoms[i].id].z);\r\n atomMap[atoms[i].id].a = atoms[i];\r\n }\r\n\r\n let atomsRef;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n if (moleculeArr[j]._center !== null) {\r\n bLow.set(nLimon, nLimon, nLimon);\r\n bHight.set(-nLimon, -nLimon, -nLimon);\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFunc);\r\n\r\n moleculeArr[j]._center.addVectors(bLow, bHight);\r\n moleculeArr[j]._center.multiplyScalar(0.5);\r\n } else {\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFuncInner);\r\n }\r\n }\r\n atomMap = null;\r\n }\r\n\r\n\r\n _traverseData(dom) {\r\n function isArray(o) {\r\n return Object.prototype.toString.apply(o) === '[object Array]';\r\n }\r\n\r\n function parseNode(xmlNode, result) {\r\n if (xmlNode.nodeName === '#text' && xmlNode.nodeValue.trim() === '') {\r\n return;\r\n }\r\n\r\n const jsonNode = {};\r\n jsonNode.xmlNode = xmlNode;\r\n const existing = result[xmlNode.nodeName];\r\n if (existing) {\r\n if (!isArray(existing)) {\r\n result[xmlNode.nodeName] = [existing, jsonNode];\r\n } else {\r\n result[xmlNode.nodeName].push(jsonNode);\r\n }\r\n } else {\r\n result[xmlNode.nodeName] = jsonNode;\r\n }\r\n\r\n let length;\r\n let i;\r\n if (xmlNode.attributes) {\r\n ({ length } = xmlNode.attributes);\r\n for (i = 0; i < length; i++) {\r\n const attribute = xmlNode.attributes[i];\r\n jsonNode[attribute.nodeName] = attribute.nodeValue;\r\n }\r\n }\r\n\r\n ({ length } = xmlNode.childNodes);\r\n for (i = 0; i < length; i++) {\r\n parseNode(xmlNode.childNodes[i], jsonNode);\r\n }\r\n }\r\n\r\n const result = {};\r\n if (dom.childNodes.length) {\r\n parseNode(dom.childNodes[0], result);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _findSuitableMolecule(data, molSet) {\r\n for (const key in data) {\r\n if (key === 'xmlNode') {\r\n continue;\r\n } else if (key === 'molecule') {\r\n if (data.molecule) {\r\n if (data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n molSet.push(data);\r\n }\r\n if (Array.isArray(data.molecule)) {\r\n for (let i = 0; i < data.molecule.length; i++) {\r\n if (data.molecule[i].atomArray && data.molecule[i].atomArray.atom) {\r\n molSet.push({ molecule: data.molecule[i] });\r\n }\r\n }\r\n }\r\n }\r\n } else if (data[key] && data[key] !== null && typeof (data[key]) === 'object') {\r\n this._findSuitableMolecule(data[key], molSet);\r\n }\r\n }\r\n }\r\n\r\n _selectComponents(text) {\r\n const parser = new DOMParser();\r\n const doc = parser.parseFromString(text, 'application/xml');\r\n const traversedData = this._traverseData(doc);\r\n let rawData;\r\n const self = this;\r\n\r\n function prepareComponentCompound(data) {\r\n let atoms = [];\r\n if (data.molecule && data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n if (!Array.isArray(data.molecule.atomArray.atom)) {\r\n atoms.push(data.molecule.atomArray.atom);\r\n } else {\r\n atoms = data.molecule.atomArray.atom;\r\n }\r\n } else if (!data.molecule) {\r\n const ret = {};\r\n ret.atomLabels = null;\r\n ret.labelsCount = 1;\r\n return ret;\r\n }\r\n\r\n if (data.molecule.molecule) {\r\n self._extractSGroups(data.molecule.molecule, atoms);\r\n }\r\n\r\n let atom;\r\n let count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges = [];\r\n }\r\n\r\n let localBond = [];\r\n if (data.molecule.bondArray && data.molecule.bondArray.bond) {\r\n if (!Array.isArray(data.molecule.bondArray.bond)) {\r\n localBond.push(data.molecule.bondArray.bond);\r\n } else {\r\n localBond = data.molecule.bondArray.bond;\r\n }\r\n }\r\n let bond;\r\n count = localBond.length;\r\n self._rebuidBondIndexes(atoms, localBond);\r\n\r\n function addCurrBond(index) {\r\n bond = localBond[index];\r\n atom = atoms[bond.start];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.end);\r\n atom = atoms[bond.end];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.start);\r\n return true;\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n if (!addCurrBond(i)) {\r\n // ignore invalid bond\r\n continue;\r\n }\r\n const orderAttr = bond.xmlNode.getAttribute('order');\r\n const tc = parseInt(orderAttr, 10);\r\n // the default bond order is unknown\r\n localBond[i].order = 0;\r\n localBond[i].type = Bond.BondType.UNKNOWN;\r\n if (tc > 1) {\r\n localBond[i].order = tc;\r\n } else {\r\n // another option - bond order is a string\r\n const order = cOrderCharCodes[orderAttr];\r\n if (order !== undefined) {\r\n localBond[i].order = order;\r\n if (orderAttr === 'A') {\r\n localBond[i].type = Bond.BondType.AROMATIC;\r\n }\r\n }\r\n }\r\n }\r\n\r\n count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges.sort();\r\n }\r\n\r\n const labels = self._breadWidthSearch(atoms, 0); // for now\r\n\r\n const retStruct = {};\r\n retStruct.atoms = atoms;\r\n retStruct.bonds = localBond;\r\n retStruct.labels = labels.atomLabels;\r\n retStruct.count = Math.min(1, labels.labelsCount); // for now\r\n retStruct.curr = -1;\r\n retStruct.originalCML = doc;\r\n\r\n return retStruct;\r\n }\r\n\r\n if (traversedData.cml) {\r\n rawData = traversedData.cml;\r\n } else {\r\n rawData = traversedData;\r\n }\r\n const retData = [];\r\n const filteredData = [];\r\n this._findSuitableMolecule(rawData, filteredData);\r\n if (this._readOnlyOneMolecule && filteredData.length > 1) {\r\n filteredData.splice(1, filteredData.length - 1);\r\n }\r\n filteredData.forEach((d) => {\r\n const rd = prepareComponentCompound(d);\r\n if (rd.atoms.length > 0) {\r\n retData.push(rd);\r\n }\r\n });\r\n return retData;\r\n }\r\n\r\n _packLabel(compId, molId) {\r\n const shift = 16;\r\n return (molId << shift) + compId;\r\n }\r\n\r\n _unpackLabel(l) {\r\n const shift = 16;\r\n const mask = (1 << shift) - 1;\r\n return { molId: l >>> shift, compId: l & mask };\r\n }\r\n\r\n _breadWidthSearch(atoms, molID) {\r\n const atomLabels = new Array(atoms.length);\r\n\r\n let id;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n atomLabels[id] = this._packLabel(0, molID);\r\n }\r\n\r\n const breadthQueue = [];\r\n let componentID = 0;\r\n let labeledAtoms = atoms.length;\r\n\r\n while (labeledAtoms > 0) {\r\n componentID++;\r\n\r\n let startID = -1;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n if (this._unpackLabel(atomLabels[id]).compId === 0) {\r\n startID = id;\r\n break;\r\n }\r\n }\r\n\r\n if (startID < 0) {\r\n break;\r\n }\r\n\r\n // Bread first search\r\n breadthQueue.push(atoms[startID]);\r\n atomLabels[startID] = this._packLabel(componentID, molID);\r\n labeledAtoms--;\r\n\r\n while (breadthQueue.length > 0) {\r\n const curr = breadthQueue.shift();\r\n if (!curr) {\r\n continue;\r\n }\r\n\r\n for (let i = 0; i < curr.edges.length; i++) {\r\n if (atomLabels[curr.edges[i]] !== componentID) {\r\n breadthQueue.push(atoms[curr.edges[i]]);\r\n atomLabels[curr.edges[i]] = componentID;\r\n labeledAtoms--;\r\n }\r\n }\r\n }\r\n }\r\n const ret = {};\r\n ret.atomLabels = atomLabels;\r\n ret.labelsCount = componentID;\r\n return ret;\r\n }\r\n\r\n _parseBond(eAtom, mainAtom, order, type) {\r\n if (eAtom >= 0) {\r\n const h = [Math.min(eAtom, mainAtom), Math.max(eAtom, mainAtom)];\r\n this._complex.addBond(h[0], h[1], order, type, true);\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseSet(varData) {\r\n const complex = this._complex = new Complex();\r\n const data = varData;\r\n const currentLabel = data.curr;\r\n const { atoms, labels } = data;\r\n let atom = null;\r\n let i;\r\n let j;\r\n const count = atoms.length;\r\n\r\n function addFunc(a) {\r\n a.xmlNodeRef = atom;\r\n if (atom.x2) {\r\n atom.x3 = atom.x2;\r\n delete atom.x2;\r\n }\r\n if (atom.y2) {\r\n atom.y3 = atom.y2;\r\n delete atom.y2;\r\n }\r\n if (!(atom.z3)) {\r\n atom.z3 = '0.0';\r\n }\r\n atom.complexAtom = a;\r\n }\r\n\r\n let chains = {};\r\n // parse atoms in label order\r\n const reorder = [];\r\n for (i = 0; i < count; i++) {\r\n reorder.push(i);\r\n }\r\n reorder.sort((a, b) => labels[a] - labels[b]);\r\n for (i = 0; i < count; i++) {\r\n const atomCharge = 0;\r\n const lLabel = labels[reorder[i]];\r\n if (this._unpackLabel(lLabel).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[reorder[i]];\r\n const atomFullNameStruct = atom.elementType;\r\n\r\n if (atom.sgroupRef) {\r\n const countRef = atom.sgroupRef.length;\r\n for (let k = 0; k < countRef; ++k) {\r\n complex._sgroups.push(atom.sgroupRef[k]);\r\n }\r\n }\r\n\r\n if (atom.x3 || atom.x2) {\r\n const currAtomComp = this._unpackLabel(lLabel).compId;\r\n // use ' ' by default instead of synthetic creation of chain names\r\n const chainID = ' '; //= String.fromCharCode('A'.charCodeAt(0) + currAtomComp);\r\n const resSeq = currAtomComp;\r\n const iCode = ' ';\r\n let strLabel = currAtomComp.toString();\r\n if (strLabel.length === 1) {\r\n strLabel = `0${strLabel}`;\r\n }\r\n const resName = `N${strLabel}`;\r\n let chain = chains[chainID];\r\n if (!chain || chain.getName() !== chainID) {\r\n chains[chainID] = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n // _x, _y, _z, mname, mindex, atomNameFull, atomName, chainID, serial, isHet, atlLocInd, atomNameToTypeF\r\n let xyz = null;\r\n if (atom.x3) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x3), parseFloat(atom.y3), parseFloat(atom.z3));\r\n } else if (atom.x2) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x2), parseFloat(atom.y2), 0);\r\n }\r\n let element = Element.ByName[atom.elementType.toUpperCase()];\r\n if (!element) {\r\n element = (JSON.parse(JSON.stringify(Element.ByName[\r\n Object.keys(Element.ByName)[Object.keys(Element.ByName).length - 1]])));\r\n element.number += 1;\r\n element.name = atom.elementType.toUpperCase();\r\n element.fullName = 'Unknown';\r\n Element.ByName[atom.elementType.toUpperCase()] = element;\r\n }\r\n const atomSerial = parseInt(atom.id.replace(/[^0-9]/, ''), 10);\r\n const added = residue.addAtom(\r\n atomFullNameStruct, element, xyz, Element.Role.SG,\r\n true, atomSerial, ' ', 1.0, 0.0, atomCharge,\r\n );\r\n if (atom.hydrogenCount) {\r\n added.hydrogenCount = parseInt(atom.hydrogenCount, 10);\r\n }\r\n if (atom.mrvValence) {\r\n added.valence = parseInt(atom.mrvValence, 10);\r\n }\r\n addFunc(added);\r\n }\r\n }\r\n }\r\n chains = null;// NOSONAR\r\n for (i = 0; i < data.bonds.length; i++) {\r\n const cb = data.bonds[i];\r\n if (this._unpackLabel(labels[cb.start]).molId === this._unpackLabel(currentLabel).molId\r\n && this._unpackLabel(labels[cb.end]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[cb.start];\r\n if (!atom || !(atoms[cb.end])) {\r\n continue; // skip invalid\r\n }\r\n this._parseBond(\r\n parseInt(atom.id.replace(/[^0-9]/, ''), 10),\r\n parseInt(atoms[cb.end].id.replace(/[^0-9]/, ''), 10), cb.order, cb.type,\r\n );\r\n }\r\n }\r\n\r\n for (i = 0; i < this._complex.getSGroupCount(); i++) {\r\n const sGrp = this._complex.getSGroups()[i];\r\n for (j = 0; j < sGrp._atoms.length; j++) {\r\n sGrp._atoms[j] = sGrp._atoms[j].complexAtom;\r\n }\r\n }\r\n for (i = 0; i < count; i++) {\r\n if (this._unpackLabel(labels[i]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[i];\r\n atom.complexAtom = null;\r\n delete atom.complexAtom;\r\n }\r\n }\r\n this._complex.originalCML = data.originalCML;\r\n this._fixBondsArray();\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n this._serialAtomMap = null;\r\n this._complex = null;\r\n return complex;\r\n }\r\n\r\n parseSync() {\r\n const complexes = [];\r\n const self = this;\r\n const moleculaSet = this._selectComponents(this._data);\r\n moleculaSet.forEach((molSet) => {\r\n molSet.curr = 2;\r\n if (molSet.count === 0) {\r\n molSet.count = 1;\r\n }\r\n for (let i = 0; i < molSet.count; i++) {\r\n molSet.curr = (i + 1);\r\n complexes.push(self._parseSet(molSet, false));\r\n }\r\n });\r\n\r\n let totalAtomsParsed = 0;\r\n complexes.forEach((c) => {\r\n totalAtomsParsed += c.getAtomCount();\r\n });\r\n if (totalAtomsParsed <= 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n if (complexes.length > 1) {\r\n const joinedComplex = new Complex();\r\n joinedComplex.joinComplexes(complexes);\r\n joinedComplex.originalCML = complexes[0].originalCML;\r\n return joinedComplex;\r\n }\r\n if (complexes.length === 1) {\r\n return complexes[0];\r\n }\r\n return new Complex();\r\n }\r\n}\r\n\r\n\r\nCMLParser.formats = ['cml'];\r\nCMLParser.extensions = ['.cml'];\r\n\r\nexport default CMLParser;\r\n","!function(r,t){if(\"function\"==typeof define&&define.amd)define([\"exports\"],t);else if(\"object\"==typeof exports&&\"undefined\"!=typeof module)t(exports);else t(r.MMTF=r.MMTF||{})}(this,function(r){\"use strict\";function t(r,t,n){for(var e=(r.byteLength,0),i=n.length;i>e;e++){var o=n.charCodeAt(e);if(128>o)r.setUint8(t++,o>>>0&127|0);else if(2048>o)r.setUint8(t++,o>>>6&31|192),r.setUint8(t++,o>>>0&63|128);else if(65536>o)r.setUint8(t++,o>>>12&15|224),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128);else{if(!(1114112>o))throw new Error(\"bad codepoint \"+o);r.setUint8(t++,o>>>18&7|240),r.setUint8(t++,o>>>12&63|128),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128)}}}function n(r){for(var t=0,n=0,e=r.length;e>n;n++){var i=r.charCodeAt(n);if(128>i)t+=1;else if(2048>i)t+=2;else if(65536>i)t+=3;else{if(!(1114112>i))throw new Error(\"bad codepoint \"+i);t+=4}}return t}function e(r,i,o){var a=typeof r;if(\"string\"===a){var u=n(r);if(32>u)return i.setUint8(o,160|u),t(i,o+1,r),1+u;if(256>u)return i.setUint8(o,217),i.setUint8(o+1,u),t(i,o+2,r),2+u;if(65536>u)return i.setUint8(o,218),i.setUint16(o+1,u),t(i,o+3,r),3+u;if(4294967296>u)return i.setUint8(o,219),i.setUint32(o+1,u),t(i,o+5,r),5+u}if(r instanceof Uint8Array){var u=r.byteLength,s=new Uint8Array(i.buffer);if(256>u)return i.setUint8(o,196),i.setUint8(o+1,u),s.set(r,o+2),2+u;if(65536>u)return i.setUint8(o,197),i.setUint16(o+1,u),s.set(r,o+3),3+u;if(4294967296>u)return i.setUint8(o,198),i.setUint32(o+1,u),s.set(r,o+5),5+u}if(\"number\"===a){if(!isFinite(r))throw new Error(\"Number not finite: \"+r);if(Math.floor(r)!==r)return i.setUint8(o,203),i.setFloat64(o+1,r),9;if(r>=0){if(128>r)return i.setUint8(o,r),1;if(256>r)return i.setUint8(o,204),i.setUint8(o+1,r),2;if(65536>r)return i.setUint8(o,205),i.setUint16(o+1,r),3;if(4294967296>r)return i.setUint8(o,206),i.setUint32(o+1,r),5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return i.setInt8(o,r),1;if(r>=-128)return i.setUint8(o,208),i.setInt8(o+1,r),2;if(r>=-32768)return i.setUint8(o,209),i.setInt16(o+1,r),3;if(r>=-2147483648)return i.setUint8(o,210),i.setInt32(o+1,r),5;throw new Error(\"Number too small -0x\"+(-r).toString(16).substr(1))}if(null===r)return i.setUint8(o,192),1;if(\"boolean\"===a)return i.setUint8(o,r?195:194),1;if(\"object\"===a){var u,f=0,c=Array.isArray(r);if(c)u=r.length;else{var d=Object.keys(r);u=d.length}var f;if(16>u?(i.setUint8(o,u|(c?144:128)),f=1):65536>u?(i.setUint8(o,c?220:222),i.setUint16(o+1,u),f=3):4294967296>u&&(i.setUint8(o,c?221:223),i.setUint32(o+1,u),f=5),c)for(var l=0;u>l;l++)f+=e(r[l],i,o+f);else for(var l=0;u>l;l++){var v=d[l];f+=e(v,i,o+f),f+=e(r[v],i,o+f)}return f}throw new Error(\"Unknown type \"+a)}function i(r){var t=typeof r;if(\"string\"===t){var e=n(r);if(32>e)return 1+e;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(r instanceof Uint8Array){var e=r.byteLength;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(\"number\"===t){if(Math.floor(r)!==r)return 9;if(r>=0){if(128>r)return 1;if(256>r)return 2;if(65536>r)return 3;if(4294967296>r)return 5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return 1;if(r>=-128)return 2;if(r>=-32768)return 3;if(r>=-2147483648)return 5;throw new Error(\"Number too small -0x\"+r.toString(16).substr(1))}if(\"boolean\"===t||null===r)return 1;if(\"object\"===t){var e,o=0;if(Array.isArray(r)){e=r.length;for(var a=0;e>a;a++)o+=i(r[a])}else{var u=Object.keys(r);e=u.length;for(var a=0;e>a;a++){var s=u[a];o+=i(s)+i(r[s])}}if(16>e)return 1+o;if(65536>e)return 3+o;if(4294967296>e)return 5+o;throw new Error(\"Array or object too long 0x\"+e.toString(16))}throw new Error(\"Unknown type \"+t)}function o(r){var t=new ArrayBuffer(i(r)),n=new DataView(t);return e(r,n,0),new Uint8Array(t)}function a(r,t,n){return t?new r(t.buffer,t.byteOffset,t.byteLength/(n||1)):void 0}function u(r){return a(DataView,r)}function s(r){return a(Uint8Array,r)}function f(r){return a(Int8Array,r)}function c(r){return a(Int32Array,r,4)}function d(r){return a(Float32Array,r,4)}function l(r,t){var n=r.length/2;t||(t=new Int16Array(n));for(var e=0,i=0;n>e;++e,i+=2)t[e]=r[i]<<8^r[i+1]<<0;return t}function v(r,t){var n=r.length;t||(t=new Uint8Array(2*n));for(var e=u(t),i=0;n>i;++i)e.setInt16(2*i,r[i]);return s(t)}function g(r,t){var n=r.length/4;t||(t=new Int32Array(n));for(var e=0,i=0;n>e;++e,i+=4)t[e]=r[i]<<24^r[i+1]<<16^r[i+2]<<8^r[i+3]<<0;return t}function L(r,t){var n=r.length;t||(t=new Uint8Array(4*n));for(var e=u(t),i=0;n>i;++i)e.setInt32(4*i,r[i]);return s(t)}function h(r,t){var n=r.length;t||(t=new Float32Array(n/4));for(var e=u(t),i=u(r),o=0,a=0,s=n/4;s>o;++o,a+=4)e.setFloat32(a,i.getFloat32(a),!0);return t}function y(r,t,n){var e=r.length,i=1/t;n||(n=new Float32Array(e));for(var o=0;e>o;++o)n[o]=r[o]*i;return n}function m(r,t,n){var e=r.length;n||(n=new Int32Array(e));for(var i=0;e>i;++i)n[i]=Math.round(r[i]*t);return n}function p(r,t){var n,e;if(!t){var i=0;for(n=0,e=r.length;e>n;n+=2)i+=r[n+1];t=new r.constructor(i)}var o=0;for(n=0,e=r.length;e>n;n+=2)for(var a=r[n],u=r[n+1],s=0;u>s;++s)t[o]=a,++o;return t}function U(r){if(0===r.length)return new Int32Array;var t,n,e=2;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]&&(e+=2);var i=new Int32Array(e),o=0,a=1;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]?(i[o]=r[t-1],i[o+1]=a,a=1,o+=2):++a;return i[o]=r[r.length-1],i[o+1]=a,i}function b(r,t){var n=r.length;t||(t=new r.constructor(n)),n&&(t[0]=r[0]);for(var e=1;n>e;++e)t[e]=r[e]+t[e-1];return t}function I(r,t){var n=r.length;t||(t=new r.constructor(n)),t[0]=r[0];for(var e=1;n>e;++e)t[e]=r[e]-r[e-1];return t}function w(r,t){var n,e,i=r instanceof Int8Array?127:32767,o=-i-1,a=r.length;if(!t){var u=0;for(n=0;a>n;++n)r[n]o&&++u;t=new Int32Array(u)}for(n=0,e=0;a>n;){for(var s=0;r[n]===i||r[n]===o;)s+=r[n],++n;s+=r[n],++n,t[e]=s,++e}return t}function C(r,t){var n,e=t?127:32767,i=-e-1,o=r.length,a=0;for(n=0;o>n;++n){var u=r[n];0===u?++a:a+=u===e||u===i?2:u>0?Math.ceil(u/e):Math.ceil(u/i)}var s=t?new Int8Array(a):new Int16Array(a),f=0;for(n=0;o>n;++n){var u=r[n];if(u>=0)for(;u>=e;)s[f]=e,++f,u-=e;else for(;i>=u;)s[f]=i,++f,u-=i;s[f]=u,++f}return s}function A(r,t){return b(p(r),t)}function x(r){return U(I(r))}function M(r,t,n){return y(p(r,c(n)),t,n)}function F(r,t){return U(m(r,t))}function S(r,t,n){return y(b(r,c(n)),t,n)}function E(r,t,n){return I(m(r,t),n)}function N(r,t,n){return y(w(r,c(n)),t,n)}function O(r,t,n){var e=w(r,c(n));return S(e,t,d(e))}function T(r,t,n){return C(E(r,t),n)}function k(r){var t=u(r),n=t.getInt32(0),e=t.getInt32(4),i=r.subarray(8,12),r=r.subarray(12);return[n,r,e,i]}function j(r,t,n,e){var i=new ArrayBuffer(12+e.byteLength),o=new Uint8Array(i),a=new DataView(i);return a.setInt32(0,r),a.setInt32(4,t),n&&o.set(n,8),o.set(e,12),o}function q(r){var t=r.length,n=s(r);return j(2,t,void 0,n)}function D(r){var t=r.length,n=L(r);return j(4,t,void 0,n)}function P(r,t){var n=r.length/t,e=L([t]),i=s(r);return j(5,n,e,i)}function z(r){var t=r.length,n=L(U(r));return j(6,t,void 0,n)}function B(r){var t=r.length,n=L(x(r));return j(8,t,void 0,n)}function V(r,t){var n=r.length,e=L([t]),i=L(F(r,t));return j(9,n,e,i)}function G(r,t){var n=r.length,e=L([t]),i=v(T(r,t));return j(10,n,e,i)}function R(r){var t={};return rr.forEach(function(n){void 0!==r[n]&&(t[n]=r[n])}),r.bondAtomList&&(t.bondAtomList=D(r.bondAtomList)),r.bondOrderList&&(t.bondOrderList=q(r.bondOrderList)),t.xCoordList=G(r.xCoordList,1e3),t.yCoordList=G(r.yCoordList,1e3),t.zCoordList=G(r.zCoordList,1e3),r.bFactorList&&(t.bFactorList=G(r.bFactorList,100)),r.atomIdList&&(t.atomIdList=B(r.atomIdList)),r.altLocList&&(t.altLocList=z(r.altLocList)),r.occupancyList&&(t.occupancyList=V(r.occupancyList,100)),t.groupIdList=B(r.groupIdList),t.groupTypeList=D(r.groupTypeList),r.secStructList&&(t.secStructList=q(r.secStructList,1)),r.insCodeList&&(t.insCodeList=z(r.insCodeList)),r.sequenceIndexList&&(t.sequenceIndexList=B(r.sequenceIndexList)),t.chainIdList=P(r.chainIdList,4),r.chainNameList&&(t.chainNameList=P(r.chainNameList,4)),t}function H(r){function t(r){for(var t={},n=0;r>n;n++){var e=o();t[e]=o()}return t}function n(t){var n=r.subarray(a,a+t);return a+=t,n}function e(t){var n=r.subarray(a,a+t);a+=t;var e=65535;if(t>e){for(var i=[],o=0;on;n++)t[n]=o();return t}function o(){var o,s,f=r[a];if(0===(128&f))return a++,f;if(128===(240&f))return s=15&f,a++,t(s);if(144===(240&f))return s=15&f,a++,i(s);if(160===(224&f))return s=31&f,a++,e(s);if(224===(224&f))return o=u.getInt8(a),a++,o;switch(f){case 192:return a++,null;case 194:return a++,!1;case 195:return a++,!0;case 196:return s=u.getUint8(a+1),a+=2,n(s);case 197:return s=u.getUint16(a+1),a+=3,n(s);case 198:return s=u.getUint32(a+1),a+=5,n(s);case 202:return o=u.getFloat32(a+1),a+=5,o;case 203:return o=u.getFloat64(a+1),a+=9,o;case 204:return o=r[a+1],a+=2,o;case 205:return o=u.getUint16(a+1),a+=3,o;case 206:return o=u.getUint32(a+1),a+=5,o;case 208:return o=u.getInt8(a+1),a+=2,o;case 209:return o=u.getInt16(a+1),a+=3,o;case 210:return o=u.getInt32(a+1),a+=5,o;case 217:return s=u.getUint8(a+1),a+=2,e(s);case 218:return s=u.getUint16(a+1),a+=3,e(s);case 219:return s=u.getUint32(a+1),a+=5,e(s);case 220:return s=u.getUint16(a+1),a+=3,i(s);case 221:return s=u.getUint32(a+1),a+=5,i(s);case 222:return s=u.getUint16(a+1),a+=3,t(s);case 223:return s=u.getUint32(a+1),a+=5,t(s)}throw new Error(\"Unknown type 0x\"+f.toString(16))}var a=0,u=new DataView(r.buffer);return o()}function W(r,t,n,e){switch(r){case 1:return h(t);case 2:return f(t);case 3:return l(t);case 4:return g(t);case 5:return s(t);case 6:return p(g(t),new Uint8Array(n));case 7:return p(g(t));case 8:return A(g(t));case 9:return M(g(t),g(e)[0]);case 10:return O(l(t),g(e)[0]);case 11:return y(l(t),g(e)[0]);case 12:return N(l(t),g(e)[0]);case 13:return N(f(t),g(e)[0]);case 14:return w(l(t));case 15:return w(f(t))}}function X(r,t){t=t||{};var n=t.ignoreFields,e={};return nr.forEach(function(t){var i=n?-1!==n.indexOf(t):!1,o=r[t];i||void 0===o||(o instanceof Uint8Array?e[t]=W.apply(null,k(o)):e[t]=o)}),e}function J(r){return String.fromCharCode.apply(null,r).replace(/\\0/g,\"\")}function K(r,t,n){n=n||{};var e,i,o,a,u,s,f=n.firstModelOnly,c=t.onModel,d=t.onChain,l=t.onGroup,v=t.onAtom,g=t.onBond,L=0,h=0,y=0,m=0,p=0,U=-1,b=r.chainNameList,I=r.secStructList,w=r.insCodeList,C=r.sequenceIndexList,A=r.atomIdList,x=r.bFactorList,M=r.altLocList,F=r.occupancyList,S=r.bondAtomList,E=r.bondOrderList;for(e=0,i=r.chainsPerModel.length;i>e&&!(f&&L>0);++e){var N=r.chainsPerModel[L];for(c&&c({chainCount:N,modelIndex:L}),o=0;N>o;++o){var O=r.groupsPerChain[h];if(d){var T=J(r.chainIdList.subarray(4*h,4*h+4)),k=null;b&&(k=J(b.subarray(4*h,4*h+4))),d({groupCount:O,chainIndex:h,modelIndex:L,chainId:T,chainName:k})}for(a=0;O>a;++a){var j=r.groupList[r.groupTypeList[y]],q=j.atomNameList.length;if(l){var D=null;I&&(D=I[y]);var P=null;r.insCodeList&&(P=String.fromCharCode(w[y]));var z=null;C&&(z=C[y]),l({atomCount:q,groupIndex:y,chainIndex:h,modelIndex:L,groupId:r.groupIdList[y],groupType:r.groupTypeList[y],groupName:j.groupName,singleLetterCode:j.singleLetterCode,chemCompType:j.chemCompType,secStruct:D,insCode:P,sequenceIndex:z})}for(u=0;q>u;++u){if(v){var B=null;A&&(B=A[m]);var V=null;x&&(V=x[m]);var G=null;M&&(G=String.fromCharCode(M[m]));var R=null;F&&(R=F[m]),v({atomIndex:m,groupIndex:y,chainIndex:h,modelIndex:L,atomId:B,element:j.elementList[u],atomName:j.atomNameList[u],formalCharge:j.formalChargeList[u],xCoord:r.xCoordList[m],yCoord:r.yCoordList[m],zCoord:r.zCoordList[m],bFactor:V,altLoc:G,occupancy:R})}m+=1}if(g){var H=j.bondAtomList;for(u=0,s=j.bondOrderList.length;s>u;++u)g({atomIndex1:m-q+H[2*u],atomIndex2:m-q+H[2*u+1],bondOrder:j.bondOrderList[u]})}y+=1}h+=1}if(p=U+1,U=m-1,g&&S)for(u=0,s=S.length;s>u;u+=2){var W=S[u],X=S[u+1];(W>=p&&U>=W||X>=p&&U>=X)&&g({atomIndex1:W,atomIndex2:X,bondOrder:E?E[u/2]:null})}L+=1}}function Q(r){return o(R(r))}function Y(r,t){r instanceof ArrayBuffer&&(r=new Uint8Array(r));var n;return n=r instanceof Uint8Array?H(r):r,X(n,t)}function Z(r,t,n,e){function i(){try{var r=Y(o.response);n(r)}catch(t){e(t)}}var o=new XMLHttpRequest;o.addEventListener(\"load\",i,!0),o.addEventListener(\"error\",e,!0),o.responseType=\"arraybuffer\",o.open(\"GET\",t+r.toUpperCase()),o.send()}function $(r,t,n){Z(r,or,t,n)}function _(r,t,n){Z(r,ar,t,n)}var rr=[\"mmtfVersion\",\"mmtfProducer\",\"unitCell\",\"spaceGroup\",\"structureId\",\"title\",\"depositionDate\",\"releaseDate\",\"experimentalMethods\",\"resolution\",\"rFree\",\"rWork\",\"bioAssemblyList\",\"ncsOperatorList\",\"entityList\",\"groupList\",\"numBonds\",\"numAtoms\",\"numGroups\",\"numChains\",\"numModels\",\"groupsPerChain\",\"chainsPerModel\"],tr=[\"xCoordList\",\"yCoordList\",\"zCoordList\",\"groupIdList\",\"groupTypeList\",\"chainIdList\",\"bFactorList\",\"atomIdList\",\"altLocList\",\"occupancyList\",\"secStructList\",\"insCodeList\",\"sequenceIndexList\",\"chainNameList\",\"bondAtomList\",\"bondOrderList\"],nr=rr.concat(tr),er=\"v1.1.0dev\",ir=\"//mmtf.rcsb.org/v1.0/\",or=ir+\"full/\",ar=ir+\"reduced/\";r.encode=Q,r.decode=Y,r.traverse=K,r.fetch=$,r.fetchReduced=_,r.version=er,r.fetchUrl=or,r.fetchReducedUrl=ar,r.encodeMsgpack=o,r.encodeMmtf=R,r.decodeMsgpack=H,r.decodeMmtf=X});","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport MMTF from '../../../vendor/js/mmtf';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst {\r\n Complex,\r\n Chain,\r\n Atom,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nclass ArrayComparator {\r\n constructor(original) {\r\n this._original = Array.from(original);\r\n this._original.sort();\r\n\r\n this._sum = 0;\r\n for (let i = 0; i < this._original.length; ++i) {\r\n this._sum += this._original[i];\r\n }\r\n }\r\n\r\n compare(candidate) {\r\n const len = candidate.length;\r\n if (len !== this._original.length) {\r\n return false;\r\n }\r\n\r\n let sum = 0;\r\n let i;\r\n for (i = 0; i < len; ++i) {\r\n sum += candidate[i];\r\n }\r\n\r\n if (sum !== this._sum) {\r\n return false;\r\n }\r\n\r\n const sorted = Array.from(candidate);\r\n sorted.sort();\r\n\r\n for (i = 0; i < len; ++i) {\r\n if (sorted[i] !== this._original[i]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\nArrayComparator.prototype.constructor = ArrayComparator;\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see https://github.com/rcsb/mmtf-javascript/blob/master/src/mmtf-traverse.js\r\nconst secStructToType = [\r\n StructuralElementType.HELIX_PI, // 0\r\n StructuralElementType.BEND, // 1\r\n StructuralElementType.HELIX_ALPHA, // 2\r\n StructuralElementType.STRAND, // 3\r\n StructuralElementType.HELIX_310, // 4\r\n StructuralElementType.BRIDGE, // 5\r\n StructuralElementType.TURN, // 6\r\n StructuralElementType.COIL, // 7\r\n];\r\n\r\nfunction getFirstByte(buf) {\r\n const bytes = new Uint8Array(buf, 0, 1);\r\n return bytes[0];\r\n}\r\n\r\nclass MMTFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'mmtf';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n // check if it's binary MessagePack format containing a map (dictionary)\r\n // see https://github.com/msgpack/msgpack/blob/master/spec.md\r\n return _.isArrayBuffer(data) && ((getFirstByte(data) | 1) === 0xDF);\r\n }\r\n\r\n _onModel(_modelData) {\r\n }\r\n\r\n _onChain(chainData) {\r\n if (chainData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const chain = new Chain(this._complex, chainData.chainName);\r\n this._complex._chains[chainData.chainIndex] = chain;\r\n chain._index = chainData.chainIndex;\r\n }\r\n\r\n _onGroup(groupData) {\r\n if (groupData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n if (this.settings.now.nowater) {\r\n // skip water\r\n if (groupData.groupName === 'HOH' || groupData.groupName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n const chain = this._complex._chains[groupData.chainIndex];\r\n const icode = !groupData.insCode.charCodeAt(0) ? '' : groupData.insCode;\r\n const residue = chain.addResidue(groupData.groupName, groupData.groupId, icode);\r\n residue._index = groupData.groupIndex;\r\n\r\n this._updateSecStructure(this._complex, residue, groupData);\r\n }\r\n\r\n _onAtom(atomData) {\r\n if (atomData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const altLoc = !atomData.altLoc.charCodeAt(0) ? '' : atomData.altLoc;\r\n const atom = new Atom(\r\n atomData.groupIndex, // we store residue index here to replace it later with actual reference\r\n atomData.atomName,\r\n Element.getByName(atomData.element.toUpperCase()),\r\n new THREE.Vector3(atomData.xCoord, atomData.yCoord, atomData.zCoord),\r\n Element.Role[atomData.atomName],\r\n false, // hetero atoms will be marked later\r\n atomData.atomId,\r\n altLoc,\r\n atomData.occupancy,\r\n atomData.bFactor,\r\n atomData.formalCharge,\r\n );\r\n\r\n this._complex._atoms[atomData.atomIndex] = atom;\r\n atom.index = atomData.atomIndex;\r\n\r\n this._serialAtomMap[atomData.atomId] = atom;\r\n }\r\n\r\n _onBond(bondData) {\r\n const right = Math.max(bondData.atomIndex1, bondData.atomIndex2);\r\n if (right >= this._complex._atoms.length) {\r\n return;\r\n }\r\n const left = Math.min(bondData.atomIndex1, bondData.atomIndex2);\r\n this._complex.addBond(\r\n this._complex._atoms[left], this._complex._atoms[right],\r\n bondData.bondOrder, Bond.BondType.UNKNOWN, true,\r\n );\r\n }\r\n\r\n _updateSecStructure(complex, residue, groupData) {\r\n const helixClasses = [3, -1, 1, -1, 5];\r\n\r\n if (!_.isUndefined(groupData) && groupData.secStruct === this._ssType) {\r\n residue._secondary = this._ssStruct;\r\n if (this._ssStruct) {\r\n this._ssStruct.term = residue;\r\n }\r\n return;\r\n }\r\n\r\n if (!_.isUndefined(groupData)) {\r\n // start new secondary structure\r\n const type = secStructToType[groupData.secStruct];\r\n this._ssType = groupData.secStruct;\r\n this._ssStart = residue;\r\n\r\n let struct = null;\r\n switch (this._ssType) {\r\n case -1: // undefined\r\n case 7: // coil\r\n break;\r\n case 0: // pi helix\r\n case 2: // alpha helix\r\n case 4: // 3-10 helix\r\n struct = new Helix(helixClasses[this._ssType], residue, residue, 0, '', '', 0);\r\n complex._helices.push(struct);\r\n break;\r\n case 3: { // extended\r\n const sheet = new Sheet('', 0);\r\n complex._sheets.push(sheet);\r\n struct = new Strand(sheet, residue, residue, 0, null, null);\r\n break;\r\n }\r\n default:\r\n if (type !== undefined) {\r\n struct = new StructuralElement(type, residue, residue);\r\n }\r\n break;\r\n }\r\n\r\n this._ssStruct = struct;\r\n residue._secondary = struct;\r\n if (struct) {\r\n complex.structures.push(struct);\r\n }\r\n }\r\n }\r\n\r\n _updateMolecules(mmtfData) {\r\n const entities = mmtfData.entityList;\r\n if (!entities) {\r\n return;\r\n }\r\n\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < entities.length; i++) {\r\n const entity = entities[i];\r\n const chains = entity.chainIndexList;\r\n let residues = [];\r\n for (let j = 0; j < chains.length; j++) {\r\n const chainIndex = chains[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, entity.description, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n // populate complex with chains, residues and atoms\r\n _traverse(mmtfData) {\r\n const self = this;\r\n\r\n // get metadata\r\n const { metadata } = this._complex;\r\n metadata.id = mmtfData.structureId;\r\n metadata.title = [];\r\n metadata.title[0] = mmtfData.title;\r\n metadata.date = mmtfData.releaseDate;\r\n metadata.format = 'mmtf';\r\n\r\n // create event callback functions\r\n const eventCallbacks = {\r\n onModel(modelData) {\r\n self._onModel(modelData);\r\n },\r\n onChain(chainData) {\r\n self._onChain(chainData);\r\n },\r\n onGroup(groupData) {\r\n self._onGroup(groupData);\r\n },\r\n onAtom(atomData) {\r\n self._onAtom(atomData);\r\n },\r\n onBond(bondData) {\r\n self._onBond(bondData);\r\n },\r\n };\r\n\r\n // temporary variables used during traversal to track secondary structures\r\n this._ssType = -1;\r\n this._ssStruct = null;\r\n this._ssStart = null;\r\n\r\n // traverse the structure and listen to the events\r\n MMTF.traverse(mmtfData, eventCallbacks);\r\n\r\n this._updateSecStructure(this._complex);\r\n this._updateMolecules(mmtfData);\r\n }\r\n\r\n // During traversal atoms and residues don't come sequentially\r\n // so a residue for certain atom can be unavailable. Thus we\r\n // store residue index in atom.\r\n // This function being called after traversal replaces the index\r\n // with actual reference, and also populates atom lists in residues.\r\n _linkAtomsToResidues() {\r\n for (let i = 0; i < this._complex._atoms.length; ++i) {\r\n const atom = this._complex._atoms[i];\r\n const residue = this._complex._residues[atom.residue];\r\n atom.residue = residue;\r\n residue._atoms.push(atom);\r\n }\r\n }\r\n\r\n _findSynonymousChains() {\r\n const named = {};\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!named.hasOwnProperty(name)) {\r\n named[name] = [];\r\n }\r\n\r\n named[name].push(chain._index);\r\n }\r\n\r\n return named;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _parseAssemblyInfo(mmtfData) {\r\n let i;\r\n let j;\r\n let k;\r\n const assemblies = [];\r\n const { logger } = this;\r\n\r\n for (i = 0; i < mmtfData.bioAssemblyList.length; ++i) {\r\n const baInfo = mmtfData.bioAssemblyList[i];\r\n if (baInfo.transformList.length === 0) {\r\n continue;\r\n }\r\n\r\n const chains = baInfo.transformList[0].chainIndexList;\r\n const chainListCheck = new ArrayComparator(chains);\r\n\r\n // build list of chain names\r\n const chainNames = {};\r\n for (j = 0; j < chains.length; ++j) {\r\n chainNames[this._complex._chains[chains[j]].getName()] = 1;\r\n }\r\n\r\n // all chains with the same name should belong to assembly if one of them belongs\r\n const allChains = [];\r\n let name;\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n // just concat arrays -- there should be no duplicates\r\n Array.prototype.push.apply(allChains, this._chainsByName[name]);\r\n }\r\n }\r\n if (!chainListCheck.compare(allChains)) {\r\n // assembly is missing some of the chains\r\n logger.debug('MMTF: Assembly is missing some of the synonymous chains. Skipping...');\r\n }\r\n\r\n const a = new Assembly(this._complex);\r\n\r\n // add chains to assembly\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n a.addChain(name);\r\n }\r\n }\r\n\r\n // add unique matrices to assembly\r\n a.addMatrix(new THREE.Matrix4().fromArray(baInfo.transformList[0].matrix).transpose());\r\n for (j = 1; j < baInfo.transformList.length; ++j) {\r\n const transform = baInfo.transformList[j];\r\n\r\n if (!chainListCheck.compare(transform.chainIndexList)) {\r\n // list of chains for this transform doesn't match that for other transforms\r\n // this is illegal in our structure\r\n logger.debug('MMTF: Chain lists differ for different transforms in one assembly. Skipping...');\r\n continue;\r\n }\r\n\r\n const m = new THREE.Matrix4().fromArray(transform.matrix).transpose();\r\n\r\n // check if matrix is already in the list\r\n for (k = 0; k < a.matrices.length; ++k) {\r\n if (a.matrices[k].equals(m)) {\r\n break;\r\n }\r\n }\r\n\r\n if (k === a.matrices.length) {\r\n a.addMatrix(m);\r\n }\r\n }\r\n\r\n a.finalize();\r\n assemblies.push(a);\r\n }\r\n\r\n return assemblies;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _markHeteroAtoms(mmtfData) {\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < mmtfData.entityList.length; ++i) {\r\n const entity = mmtfData.entityList[i];\r\n if (entity.type !== 'polymer') {\r\n for (let j = 0; j < entity.chainIndexList.length; ++j) {\r\n const chainIndex = entity.chainIndexList[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n for (let k = 0; k < chain._residues.length; ++k) {\r\n const res = chain._residues[k];\r\n for (let m = 0; m < res._atoms.length; ++m) {\r\n res._atoms[m].het = true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // joins chains with the same name into single chain\r\n _joinSynonymousChains() {\r\n let i;\r\n let j;\r\n\r\n const primaryChainsArray = [];\r\n const primaryChainsHash = {};\r\n\r\n // join chains\r\n for (i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!primaryChainsHash.hasOwnProperty(name)) {\r\n // new name -- this is a primary chain\r\n primaryChainsHash[name] = chain;\r\n chain._index = primaryChainsArray.length; // update index as this array will later replace original chain list\r\n primaryChainsArray.push(chain);\r\n continue;\r\n }\r\n\r\n // this chain should be joined with the primary chain of the same name\r\n const primary = primaryChainsHash[name];\r\n for (j = 0; j < chain._residues.length; ++j) {\r\n const residue = chain._residues[j];\r\n primary._residues.push(residue);\r\n residue._chain = primary;\r\n }\r\n }\r\n\r\n // replace chains list with one containing only primary chains\r\n // dropping references to all chains but primary\r\n this._complex._chains = primaryChainsArray;\r\n }\r\n\r\n parseSync() {\r\n const mmtfData = MMTF.decode(this._data);\r\n\r\n this._complex = new Complex();\r\n this._serialAtomMap = {}; // filled during traversal\r\n\r\n this._traverse(mmtfData);\r\n this._linkAtomsToResidues();\r\n this._markHeteroAtoms(mmtfData);\r\n this._chainsByName = this._findSynonymousChains();\r\n Array.prototype.push.apply(this._complex.units, this._parseAssemblyInfo(mmtfData));\r\n this._joinSynonymousChains();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n return this._complex;\r\n }\r\n}\r\n\r\nMMTFParser.formats = ['mmtf'];\r\nMMTFParser.extensions = ['.mmtf'];\r\nMMTFParser.binary = true;\r\n\r\nexport default MMTFParser;\r\n","class ParsingError extends Error {\r\n constructor(message, line, column) {\r\n super(`data:${line}:${column}: ${message}`);\r\n\r\n if (Error.captureStackTrace) {\r\n Error.captureStackTrace(this, ParsingError);\r\n }\r\n\r\n this.name = 'ParsingError';\r\n this.parseLine = line;\r\n this.parseColumn = column;\r\n }\r\n}\r\n\r\nexport default ParsingError;\r\n","import _ from 'lodash';\r\nimport ParsingError from './ParsingError';\r\n\r\n// Implemented and being tested against: https://www.iucr.org/resources/cif/spec/version1.1/cifsyntax\r\n\r\nfunction _isWhitespace(ch) {\r\n return ch === 32 || ch === 10 || ch === 13 || ch === 9;\r\n}\r\n\r\nfunction _inlineIndexOf(ch0, str, idx) {\r\n const len = str.length;\r\n let ch = -1;\r\n while (idx < len) {\r\n ch = str.charCodeAt(idx);\r\n if (ch === ch0 || ch === 10) {\r\n break;\r\n }\r\n ++idx;\r\n }\r\n return ch === ch0 ? idx : -1;\r\n}\r\n\r\nexport default function readCIF(source) {\r\n let i = 0;\r\n let j = 0;\r\n const n = source.length;\r\n let code = NaN;\r\n let newline = true;\r\n let line = 1;\r\n let column = 1;\r\n let begin;\r\n let state = 0; // 0 - start, 1 - block, 2 - item, 3 - loop, 4 - values, 5 - value\r\n const result = {};\r\n let block = {};\r\n let keys = [];\r\n let keysCount = 0;\r\n let key = '';\r\n let values = [];\r\n let valuesCount = 0;\r\n let value;\r\n\r\n function _parseValue() {\r\n let val;\r\n if ((code === 46 || code === 63) && (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))) { // '.' or '?' .....\r\n // it's a missing value\r\n ++column;\r\n ++i;\r\n return undefined;\r\n }\r\n if (newline && code === 59) { // ';' ......................................................................\r\n // parse multi-line string\r\n j = i;\r\n let lines = 0;\r\n do {\r\n j = _inlineIndexOf(10, source, j + 1); // '\\n'\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated text block found', line, column);\r\n }\r\n ++lines;\r\n } while ((j + 1 < n && source.charCodeAt(j + 1) !== code) || j + 1 >= n);\r\n val = source.substring(i + 1, j).replace(/\\r/g, '');\r\n i = j + 2;\r\n line += lines;\r\n column = 1;\r\n newline = false;\r\n return val;\r\n }\r\n if (code === 39 || code === 34) { // ''' or '\"' ...........................................................\r\n // parse quoted string\r\n j = i;\r\n do {\r\n j = _inlineIndexOf(code, source, j + 1);\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated quoted string found', line, column);\r\n }\r\n } while (j + 1 < n && !_isWhitespace(source.charCodeAt(j + 1)));\r\n val = source.substring(i + 1, j);\r\n column += j - i + 1;\r\n i = j + 1;\r\n return val;\r\n } // ......................................................................................................\r\n // parse until the first whitespace\r\n j = i;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n val = source.substring(i, j);\r\n column += j - i;\r\n i = j;\r\n // try to convert to a number\r\n const num = Number(val);\r\n if (!Number.isNaN(num)) {\r\n return num;\r\n }\r\n // or leave as an unquoted string\r\n return val;\r\n }\r\n\r\n function _storeKey(tag) {\r\n keys[keysCount++] = tag;\r\n }\r\n\r\n function _storeValue(val) {\r\n const keyIndex = valuesCount % keysCount;\r\n values[keyIndex].push(val);\r\n ++valuesCount;\r\n return val;\r\n }\r\n\r\n while (i <= n) {\r\n code = source.charCodeAt(i); // 'NaN' in place of ''\r\n if (code === 13) { // '\\r' .......................................................................................\r\n // just ignore\r\n } else if (code === 10) { // '\\n' ................................................................................\r\n // take note of new lines\r\n newline = true;\r\n ++line;\r\n column = 1;\r\n } else {\r\n // process inline characters\r\n if (code === 32 || code === 9) { // ' ' or '\\t' ................................................................\r\n // just ignore\r\n } else if (code === 35) { // '#' ...............................................................................\r\n // skip the comment until before the end of the line\r\n i = _inlineIndexOf(10, source, i + 1); // '\\n'\r\n if (i === -1) {\r\n break;\r\n } else {\r\n continue; // don't forget to process the new line\r\n }\r\n } else if (state === 0) { // start =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n j = i + 5;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new data block\r\n result[source.substring(begin, i)] = block = {};\r\n state = 1; // block\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Data block name missing', line, column);\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 1) { // block =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n continue; // parse again in a different state\r\n } else if (code === 95) { // '_' .............................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // start new item\r\n key = source.substring(begin, i);\r\n state = 2; // item\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n i += 5;\r\n column += 5;\r\n if (i < n && !_isWhitespace(source.charCodeAt(i))) {\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n } else {\r\n // start new loop\r\n keys = [];\r\n keysCount = 0;\r\n values = [];\r\n valuesCount = 0;\r\n state = 3; // loop\r\n continue; // don't forget to process the whitespace\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 2) { // item ==============================================================================\r\n if (Number.isNaN(code)) {\r\n break;\r\n }\r\n value = _parseValue();\r\n _.set(block, key, value);\r\n state = 1; // block\r\n continue;\r\n } else if (state === 3) { // loop ==============================================================================\r\n if (code === 95) { // '_' ....................................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new key\r\n _storeKey(source.substring(begin, i));\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else { // ..................................................................................................\r\n if (keysCount > 0) {\r\n for (let keyIndex = 0; keyIndex < keysCount; ++keyIndex) {\r\n value = [];\r\n values[keyIndex] = value;\r\n _.set(block, keys[keyIndex], value);\r\n }\r\n state = 4;\r\n continue; // parse again in a different state\r\n }\r\n throw new ParsingError('Data tags are missing inside a loop', line, column);\r\n }\r\n } else if (state === 4) { // values ============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n } else if (code === 95) { // '_' .............................................................................\r\n state = 1; // block\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n state = 1; // block\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n state = 0;\r\n } else { // ..................................................................................................\r\n _storeValue(_parseValue());\r\n }\r\n continue; // parse again in a different state\r\n } else { // ====================================================================================================\r\n throw new ParsingError(`Unexpected internal state ${state}`, line, column);\r\n }\r\n\r\n newline = false;\r\n ++column;\r\n }\r\n ++i;\r\n }\r\n\r\n if (state === 2) { // item\r\n throw new ParsingError(`Unexpected end of file in state ${state}`, line, column);\r\n }\r\n\r\n return result;\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\nimport readCIF from './readCIF';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nconst cRequiredAtomFields = [\r\n 'auth_seq_id',\r\n 'Cartn_x',\r\n 'Cartn_y',\r\n 'Cartn_z',\r\n 'label_atom_id',\r\n];\r\n\r\nconst cSecondaryCoding = {\r\n helx: 'helix',\r\n turn: 'turn',\r\n strn: 'strand',\r\n};\r\n\r\nfunction getTypeFromId(string) {\r\n const typeId = /[A-Za-z]+/.exec(string);\r\n if (!typeId) {\r\n return null;\r\n }\r\n\r\n return cSecondaryCoding[typeId[0].toLowerCase()];\r\n}\r\n\r\n/**\r\n * Make valid object an array\r\n * @param arrayLikeObject\r\n * @return {array, object} array or object\r\n */\r\nfunction arrize(arrayLikeObject) {\r\n if (arrayLikeObject === null || arrayLikeObject === undefined || _.isArray(arrayLikeObject)) {\r\n return arrayLikeObject;\r\n }\r\n return [arrayLikeObject];\r\n}\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\nclass AtomDataError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'AtomDataError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction _getOperations(operList) {\r\n if (!operList) {\r\n return null;\r\n }\r\n const idc = arrize(operList.id);\r\n const { matrix, vector } = operList;\r\n if (!idc || !matrix || !vector) {\r\n return null;\r\n }\r\n\r\n const ops = [];\r\n for (let i = 0, n = idc.length; i < n; ++i) {\r\n const mtx = new THREE.Matrix4();\r\n const { elements } = mtx;\r\n\r\n for (let row = 0; row < 3; ++row) {\r\n const matrixData = matrix[row + 1];\r\n elements[row] = arrize(matrixData[1])[i];\r\n elements[row + 4] = arrize(matrixData[2])[i];\r\n elements[row + 8] = arrize(matrixData[3])[i];\r\n elements[row + 12] = arrize(vector[row + 1])[i];\r\n }\r\n ops[idc[i]] = mtx;\r\n }\r\n return ops;\r\n}\r\n\r\nfunction _extractOperations(assemblyGen, opsDict) {\r\n assemblyGen = _.isString(assemblyGen) ? assemblyGen : `${assemblyGen}`;\r\n const l = assemblyGen.replace(/\\)\\s*\\(/g, '!').replace(/[()']/g, '');\r\n const groupStr = l.split('!');\r\n const gps = [];\r\n\r\n for (let grIdx = 0, grCount = groupStr.length; grIdx < grCount; ++grIdx) {\r\n const gr = groupStr[grIdx].split(',');\r\n const gp = [];\r\n let idx = 0;\r\n for (let i = 0, n = gr.length; i < n; ++i) {\r\n const s = gr[i];\r\n if (s.includes('-')) {\r\n const es = s.split('-');\r\n let j = parseInt(es[0], 10);\r\n const m = parseInt(es[1], 10);\r\n for (; j <= m; ++j) {\r\n gp[idx++] = opsDict[j];\r\n }\r\n } else {\r\n gp[idx++] = opsDict[s];\r\n }\r\n }\r\n gps.push(gp);\r\n }\r\n\r\n // traverse all groups from the end of array and make all mults\r\n const matrices = [];\r\n let cnt = 0;\r\n function traverse(level, mtx) {\r\n for (let ii = 0, nn = gps[level].length; ii < nn; ++ii) {\r\n const newMtx = mtx ? mtx.clone() : new THREE.Matrix4();\r\n newMtx.multiplyMatrices(gps[level][ii], newMtx);\r\n if (level === 0) {\r\n matrices[cnt++] = newMtx;\r\n } else {\r\n traverse(level - 1, newMtx);\r\n }\r\n }\r\n }\r\n traverse(gps.length - 1);\r\n return matrices;\r\n}\r\n\r\nclass CIFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this.asymDict = {};\r\n this.molecules = [];\r\n this._options.fileType = 'cif';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*data_/i.test(data);\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing CIF file..');\r\n const data = readCIF(this._data);\r\n return this._toComplex(data);\r\n }\r\n\r\n /**\r\n * Convert intermediate structure into our valid Complex object\r\n * @param cifData intermediate CIF object\r\n * @returns {Complex} complex\r\n * @private\r\n */\r\n _toComplex(cifData) {\r\n const complex = new Complex();\r\n const complexData = cifData[Object.keys(cifData)[0]];\r\n this._extractAtoms(complex, complexData);\r\n this._extractSecondary(complex, complexData);\r\n this._extractAssemblies(complex, complexData);\r\n this._extractMolecules(complex, complexData);\r\n this._extractMetadata(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n\r\n return complex;\r\n }\r\n\r\n\r\n /**\r\n * Extract metadata\r\n * @param complex structure to fill\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n\r\n _extractMetadata(complex, complexData) {\r\n const { metadata } = complex;\r\n metadata.id = complexData.entry.id;\r\n metadata.classification = complexData.struct_keywords.pdbx_keywords;\r\n const databaserev = complexData.database_PDB_rev;\r\n metadata.date = (databaserev && databaserev.date_original) ? databaserev.date_original : '';\r\n metadata.format = 'cif';\r\n metadata.title = [];\r\n metadata.title[0] = complexData.struct.title;\r\n }\r\n\r\n /**\r\n * Extract molecules information from CIF structure (should be called strictly after _extractAtoms)\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractMolecules(complex, complexData) {\r\n const molData = complexData.entity;\r\n const names = arrize(molData.pdbx_description);\r\n const count = names.length;\r\n let i;\r\n\r\n // molecules names from cif\r\n for (i = 0; i < count; i++) {\r\n this.molecules[i].name = names[i];\r\n }\r\n\r\n // reorganize molecules for complex and check chains\r\n const molecules = complex.getMolecules();\r\n for (i = 0; i < count; i++) {\r\n const molecule = this.molecules[i];\r\n molecules[i] = new Molecule(complex, molecule.name, i + 1);\r\n molecules[i].residues = molecule.residues;\r\n }\r\n }\r\n\r\n /**\r\n * Extract atom information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAtoms(complex, complexData) {\r\n const atomData = complexData.atom_site;\r\n if (!atomData) {\r\n throw new AtomDataError('CIF parsing error: atom_site is not specified!');\r\n }\r\n\r\n for (let f = 0, n = cRequiredAtomFields.length; f < n; ++f) {\r\n if (!atomData[cRequiredAtomFields[f]]) {\r\n throw new AtomDataError(`CIF parsing error: requires field ${cRequiredAtomFields[f]} not found!`);\r\n }\r\n }\r\n\r\n const { asymDict } = this;\r\n // required fields\r\n const resIdc = arrize(atomData.auth_seq_id);\r\n const x = arrize(atomData.Cartn_x);\r\n const y = arrize(atomData.Cartn_y);\r\n const z = arrize(atomData.Cartn_z);\r\n const names = arrize(atomData.label_atom_id);\r\n const count = names.length;\r\n // optional fields\r\n const group = arrize(atomData.group_PDB) || [];\r\n const chainIdc = arrize(atomData.auth_asym_id) || [];\r\n const chainLabelIdc = arrize(atomData.label_asym_id) || [];\r\n const serials = arrize(atomData.id) || [];\r\n const iCodes = arrize(atomData.pdbx_PDB_ins_code) || [];\r\n const resNames = arrize(atomData.label_comp_id) || [];\r\n const elements = arrize(atomData.type_symbol) || [];\r\n const tempFactors = arrize(atomData.B_iso_or_equiv) || [];\r\n const occupancies = arrize(atomData.occupancy) || [];\r\n const charges = arrize(atomData.pdbx_formal_charge) || [];\r\n const altLocs = arrize(atomData.label_alt_id) || [];\r\n const models = arrize(atomData.pdbx_PDB_model_num) || [];\r\n const molecules = arrize(atomData.label_entity_id) || [];\r\n\r\n let chain = null;\r\n let residue = null;\r\n for (let i = 0; i < count; ++i) {\r\n const model = models[i] || 1;\r\n if (model !== 1) {\r\n continue;\r\n }\r\n const chainID = String(chainIdc[i] || ' ');\r\n\r\n if (!chain || chain.getName() !== chainID) {\r\n chain = complex.getChain(chainID) || complex.addChain(chainID);\r\n }\r\n asymDict[String(chainLabelIdc[i] || ' ')] = chainID;\r\n const resSeq = resIdc[i];\r\n const iCode = String(iCodes[i] || ' ');\r\n const resName = String(resNames[i] || '');\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n residue = chain.addResidue(resName, resSeq, iCode);\r\n\r\n // store molecule (entity)\r\n const moleculeIdx = molecules[i] - 1;\r\n let entity = this.molecules[moleculeIdx];\r\n if (!entity) {\r\n this.molecules[moleculeIdx] = { name: '', residues: [] };\r\n entity = this.molecules[moleculeIdx];\r\n }\r\n entity.residues.push(residue);\r\n }\r\n\r\n const name = names[i];\r\n const element = elements[i] || nameToElement(name);\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name.trim()];\r\n const xyz = new THREE.Vector3(x[i], y[i], z[i]);\r\n const het = group[i] === 'HETATM' || false;\r\n const serial = serials[i] || i;\r\n const tempFactor = tempFactors[i] || 0.0;\r\n const occupancy = occupancies[i] || 0.0;\r\n const altLoc = String(altLocs[i] || '');\r\n const charge = charges[i] || 0;\r\n\r\n residue.addAtom(\r\n name, type, xyz,\r\n role, het, serial, altLoc, occupancy, tempFactor, charge,\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Extracts secondary structure information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex - complex to fill\r\n * @param complexData - CIF complex data\r\n * @private\r\n */\r\n _extractSecondary(complex, complexData) {\r\n if (complexData.struct_conf) {\r\n this._extractConfs(complex, complexData.struct_conf);\r\n }\r\n if (complexData.struct_sheet_range) {\r\n this._extractSheets(complex, complexData.struct_sheet_range);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts sheets information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param sheetData\r\n * @private\r\n */\r\n _extractSheets(complex, sheetData) {\r\n const { asymDict } = this;\r\n if (!sheetData.sheet_id || !sheetData.id || !sheetData.beg_label_seq_id || !sheetData.end_label_seq_id\r\n || !sheetData.beg_label_asym_id) {\r\n return;\r\n }\r\n // Strand(sheet, start, end, sense, cur, prev)\r\n const sheets = complex._sheets;\r\n\r\n function getSheet(name) {\r\n const n = sheets.length;\r\n for (let i = 0; i < n; ++i) {\r\n if (sheets[i]._name === name) {\r\n return sheets[i];\r\n }\r\n }\r\n sheets[n] = new Sheet(name, 0);\r\n return sheets[n];\r\n }\r\n\r\n const sheetNames = arrize(sheetData.sheet_id);\r\n const strandNames = arrize(sheetData.id);\r\n const starts = arrize(sheetData.beg_auth_seq_id);\r\n const ends = arrize(sheetData.end_auth_seq_id);\r\n const chains = arrize(sheetData.beg_label_asym_id);\r\n const stICodes = arrize(sheetData.pdbx_beg_PDB_ins_code) || [];\r\n const endICodes = arrize(sheetData.pdbx_end_PDB_ins_code) || [];\r\n\r\n for (let i = 0, n = strandNames.length; i < n; ++i) {\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n const sheet = getSheet(sheetNames[i]);\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n\r\n const strand = new Strand(sheet, start[0], end[0], 0, null, null);\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = strand;\r\n }\r\n sheet.addStrand(strand);\r\n complex.structures.push(strand);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts helix/turn/strand(?) information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param helicesData\r\n * @private\r\n */\r\n _extractConfs(complex, helicesData) {\r\n const { asymDict } = this;\r\n if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id\r\n || !helicesData.beg_label_asym_id) {\r\n return;\r\n }\r\n\r\n const types = arrize(helicesData.conf_type_id);\r\n const starts = arrize(helicesData.beg_auth_seq_id);\r\n const stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || [];\r\n const ends = arrize(helicesData.end_auth_seq_id);\r\n const endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || [];\r\n const comments = arrize(helicesData.details) || [];\r\n const lengths = arrize(helicesData.pdbx_PDB_helix_length) || [];\r\n const helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || [];\r\n const names = arrize(helicesData.id) || [];\r\n const chains = arrize(helicesData.beg_label_asym_id);\r\n\r\n for (let i = 0, n = types.length; i < n; ++i) {\r\n const type = getTypeFromId(types[i]);\r\n if (!type) {\r\n continue;\r\n }\r\n const name = names[i] || types[i];\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n const comment = comments[i] || '';\r\n const length = lengths[i] || 0;\r\n const helixClass = helixClasses[i] || ' ';\r\n let struct;\r\n if (type === 'helix') {\r\n const idx = complex._helices.length;\r\n struct = new Helix(helixClass, start[0], end[0], idx, name, comment, length);\r\n complex.addHelix(struct);\r\n complex.structures.push(struct);\r\n } else if (type === 'turn') {\r\n struct = new StructuralElement(StructuralElement.Type.TURN, start[0], end[0]);\r\n complex.structures.push(struct);\r\n } else {\r\n struct = null;\r\n }\r\n if (!struct) {\r\n continue;\r\n }\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = struct;\r\n }\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Extract biological assemblies information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAssemblies(complex, complexData) {\r\n const { asymDict } = this;\r\n const asmGen = complexData.pdbx_struct_assembly_gen;\r\n if (!asmGen) {\r\n return;\r\n }\r\n\r\n const asmIdx = arrize(asmGen.assembly_id);\r\n const asmOper = arrize(asmGen.oper_expression);\r\n const asmList = arrize(asmGen.asym_id_list);\r\n if (!asmIdx || !asmOper || !asmList) {\r\n return;\r\n }\r\n\r\n const operList = _getOperations(complexData.pdbx_struct_oper_list);\r\n if (!operList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = asmIdx.length; i < n; ++i) {\r\n const asm = new Assembly(complex);\r\n const assemblyOps = _extractOperations(asmOper[i], operList);\r\n const entries = asmList[i].split(',');\r\n for (let ii = 0, nn = entries.length; ii < nn; ++ii) {\r\n const chain = entries[ii].trim();\r\n if (chain.length > 0) {\r\n asm.addChain(asymDict[chain]);\r\n }\r\n }\r\n asm.matrices = assemblyOps;\r\n complex.units.push(asm);\r\n }\r\n }\r\n}\r\n\r\nCIFParser.formats = ['cif', 'mmcif'];\r\nCIFParser.extensions = ['.cif', '.mmcif'];\r\n\r\nexport default CIFParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Volume from '../../chem/Volume';\r\n\r\nexport const valueType = {\r\n singular: 0,\r\n vector: 1,\r\n array: 2,\r\n buffer: 3,\r\n};\r\n\r\nclass VolumeModel {\r\n _xyz2crs = [];\r\n\r\n _origin = new THREE.Vector3(0, 0, 0);\r\n\r\n constructor() {\r\n this._header = {};\r\n this._boxSize = new THREE.Vector3();\r\n this._boxStart = new THREE.Vector3();\r\n this._header.delta = {};\r\n this._header.extent = [];\r\n this._header.nstart = [];\r\n this._header.grid = [];\r\n this._header.crs2xyz = [];\r\n this._header.cellDims = new THREE.Vector3();\r\n this._header.angles = [];\r\n this._header.origin = new THREE.Vector3(0, 0, 0);\r\n this._header.dmin = 0;\r\n this._header.dmean = 0;\r\n this._header.dmax = 0;\r\n }\r\n\r\n _typedCheck() {\r\n if (_.isTypedArray(this._buff)) {\r\n this._buff = this._buff.buffer;\r\n } else if (!_.isArrayBuffer(this._buff)) {\r\n throw new TypeError('Expected ArrayBuffer or TypedArray');\r\n }\r\n }\r\n\r\n _fillHeader(headerFormat, arrays) {\r\n for (const key in headerFormat) {\r\n if (headerFormat.hasOwnProperty(key)) {\r\n switch (headerFormat[key][0]) {\r\n case valueType.singular:\r\n this._header[key] = arrays[headerFormat[key][1]][headerFormat[key][2]];\r\n break;\r\n\r\n case valueType.array:\r\n this._parseArray(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.vector:\r\n this._parseVector(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.buffer:\r\n this._header[key] = new Uint8Array(\r\n arrays[headerFormat[key][1]],\r\n [headerFormat[key][2]] * 4,\r\n [headerFormat[key][3]] * 4,\r\n );\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _parseVector(vector, arr, pos) {\r\n [vector.x, vector.y, vector.z] = [arr[pos], arr[pos + 1], arr[pos + 2]];\r\n }\r\n\r\n _parseArray(vector, arr, pos) {\r\n vector[0] = arr[pos];\r\n vector[1] = arr[pos + 1];\r\n vector[2] = arr[pos + 2];\r\n }\r\n\r\n _parseHeader(_buffer) {}\r\n\r\n _setAxisIndices() {}\r\n\r\n _setOrigins() {}\r\n\r\n _getAxis() {\r\n const header = this._header;\r\n\r\n const xScale = header.cellDims.x / header.grid[0];\r\n const yScale = header.cellDims.y / header.grid[1];\r\n const zScale = header.cellDims.z / header.grid[2];\r\n\r\n const [alpha, beta, gamma] = header.angles;\r\n\r\n const z1 = Math.cos(beta);\r\n const z2 = (Math.cos(alpha) - Math.cos(beta)\r\n * Math.cos(gamma)) / Math.sin(gamma);\r\n const z3 = Math.sqrt(1.0 - z1 * z1 - z2 * z2);\r\n\r\n const xaxis = new THREE.Vector3(xScale, 0, 0);\r\n const yaxis = new THREE.Vector3(Math.cos(gamma) * yScale, Math.sin(gamma) * yScale, 0);\r\n const zaxis = new THREE.Vector3(z1 * zScale, z2 * zScale, z3 * zScale);\r\n\r\n return [xaxis, yaxis, zaxis];\r\n }\r\n\r\n _getXYZdim() {\r\n return [this._header.extent[this._xyz2crs[0]],\r\n this._header.extent[this._xyz2crs[1]],\r\n this._header.extent[this._xyz2crs[2]]];\r\n }\r\n\r\n _getVolumeInfo() {\r\n const volInfo = _.pick(this._header, ['dmean', 'dmin', 'dmax', 'sd', 'delta']);\r\n volInfo.obtuseAngle = this._header.angles.map((angle) => Number(angle >= (Math.PI / 2)));\r\n return volInfo;\r\n }\r\n\r\n _setBoxParams(xaxis, yaxis, zaxis) {\r\n // if axes are not orthogonal, the origins might not match with box coordinates - need to make shift\r\n let shiftX = 0;\r\n let shiftY = 0;\r\n const [alpha, beta, gamma] = this._header.angles;\r\n\r\n if (gamma >= Math.PI / 2) {\r\n shiftX += Math.abs(yaxis.x);\r\n }\r\n if (beta >= Math.PI / 2) {\r\n shiftX += Math.abs(zaxis.x);\r\n }\r\n if (alpha >= Math.PI / 2) {\r\n shiftY += Math.abs(zaxis.y);\r\n }\r\n\r\n this._boxStart = new THREE.Vector3(this._origin.x - shiftX, this._origin.y - shiftY, this._origin.z);\r\n this._boxSize = new THREE.Vector3(\r\n Math.abs(xaxis.x) + Math.abs(yaxis.x) + Math.abs(zaxis.x),\r\n Math.abs(yaxis.y) + Math.abs(zaxis.y),\r\n Math.abs(zaxis.z),\r\n );\r\n\r\n const delta = (axe, proj) => (Math.abs(axe[proj]) / this._boxSize[proj]);\r\n this._header.delta.x = delta(yaxis, 'x');\r\n this._header.delta.y = delta(zaxis, 'x');\r\n this._header.delta.z = delta(zaxis, 'y');\r\n }\r\n\r\n _getXYZbox() {\r\n return new THREE.Box3(this._boxStart.clone(), this._boxStart.clone().add(this._boxSize));\r\n }\r\n\r\n _toXYZData() {}\r\n\r\n parse(data) {\r\n this._parseHeader(data);\r\n this._setOrigins();\r\n return new Volume(Float32Array, this._getXYZdim(), this._getXYZbox(), 1, this._toXYZData(), this._getVolumeInfo());\r\n }\r\n}\r\n\r\nexport default VolumeModel;\r\n","import Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\nconst CCP4Header = {\r\n extent: [valueType.array, 'u32', 0],\r\n type: [valueType.singular, 'u32', 3],\r\n nstart: [valueType.array, 'i32', 4],\r\n grid: [valueType.array, 'u32', 7],\r\n cellDims: [valueType.vector, 'f32', 10],\r\n angles: [valueType.array, 'f32', 13],\r\n crs2xyz: [valueType.array, 'i32', 16],\r\n dmin: [valueType.singular, 'f32', 19],\r\n dmax: [valueType.singular, 'f32', 20],\r\n dmean: [valueType.singular, 'f32', 21],\r\n ispg: [valueType.singular, 'u32', 22],\r\n nsymbt: [valueType.singular, 'u32', 23],\r\n lksflg: [valueType.singular, 'u32', 24],\r\n customData: [valueType.buffer, 'buffer', 25, 9],\r\n origin: [valueType.vector, 'f32', 34],\r\n map: [valueType.buffer, 'buffer', 52, 1],\r\n machine: [valueType.singular, 'u32', 53],\r\n sd: [valueType.singular, 'f32', 54],\r\n nlabel: [valueType.singular, 'f32', 55],\r\n label: [valueType.buffer, 'buffer', 56, 200],\r\n};\r\n\r\nclass Ccp4Model extends VolumeModel {\r\n // read header (http://www.ccp4.ac.uk/html/maplib.html)\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n const arrays = {};\r\n arrays.u32 = new Uint32Array(this._buff, 0, 56);\r\n arrays.i32 = new Int32Array(this._buff, 0, 56);\r\n arrays.f32 = new Float32Array(this._buff, 0, 56);\r\n arrays.buffer = this._buff;\r\n const header = this._header;\r\n\r\n this._fillHeader(CCP4Header, arrays);\r\n\r\n // calculate non-orthogonal unit cell coordinates\r\n header.angles.forEach((angle, i, a) => { a[i] *= Math.PI / 180.0; });\r\n }\r\n\r\n _setAxisIndices() {\r\n const header = this._header;\r\n\r\n if (header.cellDims.x === 0.0 && header.cellDims.y === 0.0 && header.cellDims.z === 0.0) {\r\n header.cellDims.set(1.0, 1.0, 1.0);\r\n }\r\n // Apply header conversion\r\n // Mapping between CCP4 column, row, section and VMD x, y, z.\r\n const { crs2xyz } = this._header;\r\n if (crs2xyz[0] === 0 && crs2xyz[1] === 0 && crs2xyz[2] === 0) {\r\n crs2xyz[0] = 1;\r\n crs2xyz[1] = 2;\r\n crs2xyz[2] = 3;\r\n }\r\n\r\n const xyz2crs = this._xyz2crs;\r\n xyz2crs[crs2xyz[0] - 1] = 0; // column\r\n xyz2crs[crs2xyz[1] - 1] = 1; // row\r\n xyz2crs[crs2xyz[2] - 1] = 2; // section\r\n }\r\n\r\n\r\n _setOrigins() {\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n const header = this._header;\r\n const xyz2crs = this._xyz2crs;\r\n // Handle both MRC-2000 and older format maps\r\n if (header.origin.x === 0.0 && header.origin.y === 0.0 && header.origin.z === 0.0) {\r\n this._origin.addScaledVector(xaxis, header.nstart[xyz2crs[0]]);\r\n this._origin.addScaledVector(yaxis, header.nstart[xyz2crs[1]]);\r\n this._origin.addScaledVector(zaxis, header.nstart[xyz2crs[2]]);\r\n } else {\r\n this._origin = header.origin;\r\n // Use ORIGIN records rather than old n[xyz]start records\r\n // http://www2.mrc-lmb.cam.ac.uk/image2000.html\r\n // XXX the ORIGIN field is only used by the EM community, and\r\n // has undefined meaning for non-orthogonal maps and/or non-cubic voxels, etc.\r\n }\r\n xaxis.multiplyScalar(header.extent[xyz2crs[0]] - 1);\r\n yaxis.multiplyScalar(header.extent[xyz2crs[1]] - 1);\r\n zaxis.multiplyScalar(header.extent[xyz2crs[2]] - 1);\r\n\r\n if (header.type === 2) {\r\n this._data = new Float32Array(\r\n this._buff,\r\n 1024 + header.nsymbt,\r\n header.extent[0] * header.extent[1] * header.extent[2],\r\n );\r\n } else {\r\n throw new Error(`CCP4: Unsupported format ${header.type}`);\r\n }\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const data = this._data;\r\n const xyz2crs = this._xyz2crs;\r\n const xyzData = new Float32Array(data.length);\r\n\r\n const dim = this._getXYZdim();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n\r\n let crsIdx = 0;\r\n const coord = [];\r\n let x;\r\n let y;\r\n let z;\r\n for (coord[2] = 0; coord[2] < header.extent[2]; coord[2]++) { // Site\r\n for (coord[1] = 0; coord[1] < header.extent[1]; coord[1]++) { // Row\r\n for (coord[0] = 0; coord[0] < header.extent[0]; coord[0]++, crsIdx++) { // Column\r\n x = coord[xyz2crs[0]];\r\n y = coord[xyz2crs[1]];\r\n z = coord[xyz2crs[2]];\r\n xyzData[x + xSize * (y + ySize * z)] = data[crsIdx];\r\n }\r\n }\r\n }\r\n\r\n return xyzData;\r\n }\r\n}\r\n\r\nclass CCP4Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'ccp4';\r\n this.model = new Ccp4Model();\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false; // Autodetection is not implemented yet\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nCCP4Parser.formats = ['ccp4'];\r\nCCP4Parser.extensions = ['.ccp4', '.map', '.mrc'];\r\nCCP4Parser.binary = true;\r\n\r\nexport default CCP4Parser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element, Molecule } = chem;\r\n\r\nclass XYZParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n this._options.fileType = 'xyz';\r\n this._fileName = options.name;\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*\\d+ *\\n[^\\n]*\\n\\s*\\w{1,3}\\s+-?\\d/.test(data);\r\n }\r\n\r\n _parseToAtomsInf(source) {\r\n const endnAtoms = source.indexOf('\\n');\r\n const nAtoms = parseInt(source.substring(0, endnAtoms), 10);\r\n const endComment = source.indexOf('\\n', endnAtoms + 1);\r\n let comment = source.slice(endnAtoms + 1, endComment).trim();\r\n if (comment.length === 0) {\r\n comment = this._fileName;\r\n }\r\n\r\n const startAtomsInf = endComment + source.substring(endComment).search(/\\S/);\r\n this._atomsInf = source.substring(startAtomsInf).split(/[\\s,]*\\n[\\s,]*/);\r\n if (!Number.isNaN(nAtoms) && (this._atomsInf.length - 1 !== nAtoms)) {\r\n this._complex.error = {\r\n message: 'wrong number of atoms',\r\n };\r\n return;\r\n }\r\n\r\n this._complex.metadata.format = 'xyz';\r\n this._complex.name = comment;\r\n }\r\n\r\n _parseAtomsInf() {\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n\r\n const chain = this._complex.addChain('A');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0; i < this._atomsInf.length - 1; i++) {\r\n const words = this._atomsInf[i].split(/[\\s,]+/);\r\n\r\n if (words.length !== 4) {\r\n this._complex.error = {\r\n message: 'missed parameters',\r\n };\r\n break;\r\n }\r\n\r\n const serial = i + 1;\r\n const name = words[0];\r\n const xyz = new THREE.Vector3(parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3]));\r\n const type = Element.getByName(name);\r\n const role = undefined;\r\n\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n const molecule = new Molecule(this._complex, this._complex.name, 1);\r\n molecule.residues = residue;\r\n this._complex._molecules[0] = molecule;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n\r\n this._parseToAtomsInf(this._data);\r\n this._parseAtomsInf();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n return result;\r\n }\r\n\r\n static formats = ['xyz'];\r\n\r\n static extensions = ['.xyz'];\r\n}\r\n\r\nexport default XYZParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element } = chem;\r\n\r\nclass PubChemParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'pubchem+json';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && data[0] === '{';\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing PubChem JSON file...');\r\n return this._toComplex(JSON.parse(this._data));\r\n }\r\n\r\n _toComplex(jsonData) {\r\n const complex = new Complex();\r\n const complexData = jsonData.PC_Compounds && jsonData.PC_Compounds[0];\r\n if (complexData) {\r\n this._extractAtoms(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n }\r\n return complex;\r\n }\r\n\r\n _extractAtoms(complex, complexData) {\r\n let aids = complexData.atoms && complexData.atoms.aid;\r\n let elements = aids && complexData.atoms.element;\r\n if (!elements || aids.length !== elements.length) {\r\n throw new Error('Unable to parse atom elements');\r\n }\r\n elements = _.fromPairs(_.zip(aids, elements));\r\n const atoms = {};\r\n\r\n const coords = complexData.coords && complexData.coords[0];\r\n const model = coords && coords.conformers && coords.conformers[0];\r\n const xs = model && model.x;\r\n const ys = model && model.y;\r\n const zs = (model && model.z) || [];\r\n aids = coords && coords.aid;\r\n if (!aids || !xs || !ys) {\r\n throw new Error('Coordinates are not found in the file');\r\n }\r\n\r\n const chain = complex.addChain(' ');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0, n = aids.length; i < n; ++i) {\r\n const aid = aids[i];\r\n const element = Element.ByAtomicNumber[elements[aid]];\r\n const xyz = new THREE.Vector3(xs[i], ys[i], zs[i] || 0.0);\r\n atoms[aid] = residue.addAtom(element.name, element, xyz, undefined, true, aid, ' ', 1.0, 0.0, 0);\r\n }\r\n\r\n const aids1 = complexData.bonds && complexData.bonds.aid1;\r\n const aids2 = complexData.bonds && complexData.bonds.aid2;\r\n const orders = (complexData.bonds && complexData.bonds.order) || [];\r\n if (!aids1 || !aids2 || aids1.length !== aids2.length) {\r\n return;\r\n }\r\n\r\n for (let j = 0, m = aids1.length; j < m; ++j) {\r\n complex.addBond(atoms[aids1[j]], atoms[aids2[j]], orders[j] || 1, 0, true);\r\n }\r\n }\r\n}\r\n\r\n\r\nPubChemParser.formats = ['pubchem', 'pubchem+json', 'pc'];\r\nPubChemParser.extensions = ['.json'];\r\n\r\nexport default PubChemParser;\r\n","import _ from 'lodash';\r\n\r\nexport default class SDFStream {\r\n constructor(data) {\r\n this._strings = data.split(/\\r?\\n|\\r/);\r\n this._currentStart = 0;\r\n this._currentStringIndx = 0;\r\n }\r\n\r\n setStart(start) {\r\n if (start >= this._strings.length) {\r\n this._currentStart = this._strings.length - 1;\r\n this._currentStringIndx = this._strings.length - 1;\r\n } else {\r\n this._currentStart = start;\r\n this._currentStringIndx = start;\r\n }\r\n }\r\n\r\n getNextString() {\r\n return this._strings[++this._currentStringIndx];\r\n }\r\n\r\n getCurrentString() {\r\n return this._strings[this._currentStringIndx];\r\n }\r\n\r\n getStringFromStart(numb) {\r\n this._currentStringIndx = this._currentStart + numb;\r\n return this._strings[this._currentStart + numb];\r\n }\r\n\r\n findNextDataItem() {\r\n let curStr = this.getNextString();\r\n let res = false;\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n if (curStr.match(/>\\s+<(.*)>/)) {\r\n res = true;\r\n break;\r\n }\r\n curStr = this.getNextString();\r\n }\r\n\r\n return res;\r\n }\r\n\r\n findNextCompoundStart() {\r\n let curStr = this.getCurrentString();\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n curStr = this.getNextString();\r\n }\r\n this.setStart(++this._currentStringIndx);\r\n return this.probablyHaveDataToParse();\r\n }\r\n\r\n probablyHaveDataToParse() {\r\n return this._currentStringIndx < this._strings.length - 2;\r\n }\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport SDFStream from './SDFStream';\r\nimport Assembly from '../../chem/Assembly';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst chargeMap = [0, 3, 2, 1, 0, -1, -2, -3];\r\nconst orderMap = [0, 1, 2, 3, 1, 1, 1, 2];\r\nconst typeMap = [\r\n Bond.BondType.UNKNOWN, // 0 - error\r\n Bond.BondType.COVALENT, // 1 - single\r\n Bond.BondType.COVALENT, // 2 - double\r\n Bond.BondType.COVALENT, // 3 - triple\r\n Bond.BondType.AROMATIC, // 4 - aromatic\r\n Bond.BondType.UNKNOWN, // 5 - single or double\r\n Bond.BondType.AROMATIC, // 6 - single or aromatic\r\n Bond.BondType.AROMATIC, // 7 - double or aromatic\r\n // 8 - any\r\n // 9 - coordination\r\n // 10 - hydrogen\r\n];\r\n\r\nconst sdfAndMolRegexp = /.*(M\\s\\sEND).*|.*(^$$$$).*|.*>\\s+<(.+)>.*/;\r\nconst sdfRegExp = /.*($$$$).*|.*>\\s+<(.+)>.*/;\r\n\r\nconst fileFormat = { SDF: 'sdf', MOL: 'mol' };\r\n\r\nconst possibleNameTags = ['PUBCHEM_IUPAC_TRADITIONAL_NAME', /PUBCHEM_(.+)_NAME/, /(.+)name/, /(.+)NAME/];\r\nconst possibleIDTags = ['PUBCHEM_COMPOUND_CID', 'id', 'ID', /.*CID/, /.*ID/, /.*id/];\r\nconst possibleTitleTags = ['msg', 'MSG', 'message', 'title', 'description', 'desc'];\r\nconst tagsNames = ['name', 'id', 'title'];\r\nconst tags = { name: possibleNameTags, id: possibleIDTags, title: possibleTitleTags };\r\n\r\nfunction buildChainID(index) {\r\n if (!index) {\r\n return 'A';\r\n }\r\n\r\n const codes = [];\r\n while (index) {\r\n codes.push(65 + (index % 26));\r\n index = Math.trunc(index / 26);\r\n }\r\n if (codes.length > 1) {\r\n codes.reverse();\r\n codes[0] -= 1;\r\n }\r\n\r\n return String.fromCharCode(...codes);\r\n}\r\n\r\nexport default class SDFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._format = 'sdf';\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._molecules = null;\r\n this._metadata = {};\r\n this._metadata.molecules = [];\r\n this._currentMolProps = {};\r\n this._compoundIndx = -1;\r\n this._assemblies = [];\r\n this._atomsParsed = 0;\r\n this._atomsIndexes = [];\r\n }\r\n\r\n canProbablyParse(data) {\r\n return _.isString(data) && sdfAndMolRegexp.test(data);\r\n }\r\n\r\n _parseHeader(stream) {\r\n const molecule = {};\r\n molecule.name = stream.getStringFromStart(0);\r\n const date = parseInt(stream.getStringFromStart(1).substr(10, 6).trim(), 10);\r\n molecule.date = date.toString() || '';\r\n molecule.title = stream.getStringFromStart(2);\r\n this._metadata.molecules.push(molecule);\r\n }\r\n\r\n _parseAtoms(stream, atomsNum) {\r\n let curStr;\r\n let serial = this._atomsParsed;\r\n\r\n // each molecule = chain\\residue\r\n const chainID = buildChainID(this._compoundIndx);\r\n const resName = 'UNK';\r\n const resSeq = 1;\r\n\r\n this._chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = this._chain.addResidue(resName, resSeq, ' ');\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n curStr = stream.getNextString();\r\n serial++;\r\n const x = parseFloat(curStr.substr(0, 10));\r\n const y = parseFloat(curStr.substr(10, 10));\r\n const z = parseFloat(curStr.substr(20, 10));\r\n const charge = chargeMap[parseInt(curStr.substr(36, 3), 10)];\r\n const xyz = new THREE.Vector3(x, y, z);\r\n let name = curStr.substr(31, 3).trim().toUpperCase();\r\n const type = Element.getByName(name);\r\n if (!this._atomsIndexes[name]) {\r\n this._atomsIndexes[name] = 0;\r\n }\r\n this._atomsIndexes[name] += 1;\r\n name += this._atomsIndexes[name]; // every atom need to have unique name.\r\n\r\n this._residue.addAtom(name, type, xyz, undefined, true, serial, ' ', 1.0, 0.0, charge);\r\n }\r\n }\r\n\r\n _parseBonds(stream, bondsNum) {\r\n let curStr;\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n curStr = stream.getNextString();\r\n let atom1 = parseInt(curStr.substr(0, 3), 10) + this._atomsParsed;\r\n let atom2 = parseInt(curStr.substr(3, 3), 10) + this._atomsParsed;\r\n const bondType = parseInt(curStr.substr(6, 3), 10);\r\n\r\n if (atom1 > atom2) {\r\n [atom1, atom2] = [atom2, atom1];\r\n }\r\n this._complex.addBond(atom1, atom2,\r\n orderMap[bondType] || 1,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true);\r\n }\r\n }\r\n\r\n _parseMOL(stream) {\r\n this._compoundIndx++;\r\n\r\n this._parseHeader(stream);\r\n const countsLine = stream.getStringFromStart(3);\r\n const atomsNum = parseInt(countsLine.substr(0, 3), 10);\r\n const bondsNum = parseInt(countsLine.substr(3, 3), 10);\r\n this._parseAtoms(stream, atomsNum);\r\n this._parseBonds(stream, bondsNum);\r\n\r\n this._atomsParsed += atomsNum;\r\n\r\n this._metadata.molecules[this._compoundIndx]._residues = [];\r\n this._metadata.molecules[this._compoundIndx]._residues.push(this._residue);\r\n }\r\n\r\n _parseDataItem(stream) {\r\n const tag = stream.getCurrentString();\r\n\r\n let data = [];\r\n let curStr = stream.getNextString();\r\n\r\n // read data\r\n while (curStr.trim() !== '') {\r\n data.push(curStr);\r\n curStr = stream.getNextString();\r\n }\r\n if (data.length === 1) {\r\n [data] = data;\r\n }\r\n this._currentMolProps[tag.replace(/[<>]/g, '').trim()] = data;\r\n }\r\n\r\n _parseCompound(stream) {\r\n this._parseMOL(stream);\r\n\r\n // parse data items block\r\n if (this._format === fileFormat.SDF) {\r\n this._currentMolProps = {};\r\n while (stream.findNextDataItem()) {\r\n this._parseDataItem(stream);\r\n }\r\n if (Object.keys(this._currentMolProps).length !== 0) {\r\n const molecule = this._metadata.molecules[this._compoundIndx];\r\n molecule.props = this._currentMolProps;\r\n this._tryToUpdateMoleculeData(molecule);\r\n }\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n console.log('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _buildAssemblies() {\r\n const chains = this._complex._chains;\r\n\r\n if (chains.length === 1) {\r\n return this._assemblies;\r\n }\r\n\r\n for (let i = 0; i < chains.length; i++) {\r\n const assembly = new Assembly(this._complex);\r\n const matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n assembly.addChain(chains[i]._name);\r\n this._assemblies.push(assembly);\r\n }\r\n\r\n return this._assemblies;\r\n }\r\n\r\n _buildMolecules() {\r\n this._complex._molecules = [];\r\n const { molecules } = this._metadata;\r\n for (let i = 0; i < molecules.length; i++) {\r\n const molecule = new Molecule(this._complex, molecules[i].name, i + 1);\r\n molecule.residues = molecules[i]._residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n\r\n return this._complex._molecules;\r\n }\r\n\r\n _searchTag(tag, props) {\r\n for (let i = 0; i < props.length; i++) {\r\n if ((tag instanceof RegExp && tag.test(props[i].tag)) || tag === props[i].tag) {\r\n return props[i].data;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToFind(tagsList, props) {\r\n for (let j = 0; j < tagsList.length; j++) {\r\n const res = this._searchTag(tagsList[j], props);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToUpdateMoleculeData(molecule) {\r\n let res = false;\r\n for (let i = 0; i < tagsNames.length; i++) {\r\n const tagPossibleNames = tags[tagsNames[i]];\r\n const data = this._tryToFind(tagPossibleNames, molecule.props);\r\n if (data) {\r\n molecule[tagsNames[i]] = data;\r\n res = true;\r\n }\r\n }\r\n\r\n molecule.name = molecule.name || molecule.id;\r\n if (molecule.name.match(/^\\d+$/)) {\r\n molecule.name = `CID: ${molecule.name}`;\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _finalizeMetadata() {\r\n const { molecules } = this._metadata;\r\n const { metadata } = this._complex;\r\n const complex = this._complex;\r\n\r\n if (molecules.length === 1) {\r\n complex.name = molecules[0].name;\r\n metadata.title = molecules[0].title;\r\n metadata.date = molecules[0].date;\r\n metadata.properties = molecules[0].props;\r\n } else if (molecules.length > 1) {\r\n metadata.molecules = [];\r\n for (let i = 0; i < molecules.length; i++) {\r\n metadata.molecules.push({\r\n name: molecules[i].name, date: molecules[i].date, title: molecules[i].title, properties: molecules[i].props,\r\n });\r\n }\r\n }\r\n }\r\n\r\n _finalize() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n this._complex._finalizeBonds();\r\n this._fixBondsArray();\r\n this._finalizeMetadata();\r\n this._buildAssemblies();\r\n this._complex.units = this._complex.units.concat(this._assemblies);\r\n this._buildMolecules();\r\n this._complex.finalize({\r\n needAutoBonding: false, detectAromaticLoops: false, enableEditing: false, serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n defineFormat(data) {\r\n let format;\r\n if (sdfRegExp.test(data)) {\r\n format = fileFormat.SDF;\r\n } else {\r\n format = fileFormat.MOL;\r\n }\r\n\r\n return format;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const stream = new SDFStream(this._data);\r\n\r\n this._format = this.defineFormat(this._data);\r\n result.metadata.format = this._format;\r\n\r\n do {\r\n this._parseCompound(stream);\r\n } while (stream.findNextCompoundStart());\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nSDFParser.formats = ['mol', 'sdf'];\r\nSDFParser.extensions = ['.mol', '.sdf'];\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\n// http://www.uoxray.uoregon.edu/tnt/manual/node104.html\r\nconst DSN6Header = {\r\n nstart: [valueType.array, 'i16', 0],\r\n extent: [valueType.array, 'i16', 3],\r\n grid: [valueType.array, 'i16', 6],\r\n cellDims: [valueType.vector, 'i16', 9],\r\n angles: [valueType.array, 'i16', 12],\r\n div: [valueType.singular, 'i16', 15],\r\n adder: [valueType.singular, 'i16', 16],\r\n scaleFactor: [valueType.singular, 'i16', 17],\r\n};\r\n\r\nclass DSN6Model extends VolumeModel {\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n\r\n const arrays = {};\r\n arrays.i16 = new Int16Array(this._buff);\r\n\r\n // check and reverse if big endian\r\n if (arrays.i16[18] !== 100) {\r\n for (let i = 0, n = arrays.i16.length; i < n; ++i) {\r\n const val = arrays.i16[i];\r\n arrays.i16[i] = ((val & 0xff) << 8) | ((val >> 8) & 0xff);\r\n }\r\n }\r\n if (arrays.i16[18] !== 100) {\r\n throw new Error('DSN6: Incorrect format ');\r\n }\r\n\r\n const header = this._header;\r\n\r\n this._fillHeader(DSN6Header, arrays);\r\n header.cellDims.multiplyScalar(1.0 / header.scaleFactor);\r\n header.angles.forEach((angle, i, a) => { a[i] *= (Math.PI / 180.0) / header.scaleFactor; });\r\n header.div /= 100;\r\n }\r\n\r\n _setAxisIndices() {\r\n this._xyz2crs[0] = 0;\r\n this._xyz2crs[1] = 1;\r\n this._xyz2crs[2] = 2;\r\n }\r\n\r\n _setOrigins() {\r\n const header = this._header;\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n this._origin.addScaledVector(xaxis, header.nstart[0]);\r\n this._origin.addScaledVector(yaxis, header.nstart[1]);\r\n this._origin.addScaledVector(zaxis, header.nstart[2]);\r\n\r\n xaxis.multiplyScalar(header.extent[0]);\r\n yaxis.multiplyScalar(header.extent[1]);\r\n zaxis.multiplyScalar(header.extent[2]);\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _pointCalculate(xyzData, byteBuffer, z, y, x, pos, i) {\r\n const header = this._header;\r\n\r\n if (x < header.extent[0] && y < header.extent[1] && z < header.extent[2]) {\r\n const idx = x + header.extent[0] * (y + header.extent[1] * z);\r\n xyzData[idx] = (byteBuffer[pos.counter] - header.adder) / header.div;\r\n ++pos.counter;\r\n } else {\r\n pos.counter += 8 - i;\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n _blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos) {\r\n for (let k = 0; k < 8; ++k) {\r\n const z = 8 * zBlock + k;\r\n for (let j = 0; j < 8; ++j) {\r\n const y = 8 * yBlock + j;\r\n let inRange = true;\r\n let i = 0;\r\n while (inRange && i < 8) {\r\n const x = 8 * xBlock + i;\r\n inRange = this._pointCalculate(xyzData, byteBuffer, z, y, x, pos, i);\r\n i++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const byteBuffer = new Uint8Array(this._buff);\r\n const xyzData = new Float32Array(header.extent[0] * header.extent[1] * header.extent[2]);\r\n\r\n const blocks = new THREE.Vector3(header.extent[0] / 8, header.extent[1] / 8, header.extent[2] / 8);\r\n\r\n const pos = {};\r\n pos.counter = 512;\r\n\r\n for (let zBlock = 0; zBlock < blocks.z; ++zBlock) {\r\n for (let yBlock = 0; yBlock < blocks.y; ++yBlock) {\r\n for (let xBlock = 0; xBlock < blocks.x; ++xBlock) {\r\n this._blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos);\r\n }\r\n }\r\n }\r\n this._calculateInfoParams(xyzData);\r\n return xyzData;\r\n }\r\n\r\n _calculateInfoParams(xyzData) {\r\n this._header.dmean /= xyzData.length;\r\n let dispersion = 0;\r\n let minDensity = xyzData[0];\r\n let maxDensity = xyzData[0];\r\n for (let j = 0; j < xyzData.length; j++) {\r\n dispersion += (this._header.dmean - xyzData[j]) ** 2;\r\n\r\n if (xyzData[j] < minDensity) {\r\n minDensity = xyzData[j];\r\n }\r\n if (xyzData[j] > maxDensity) {\r\n maxDensity = xyzData[j];\r\n }\r\n }\r\n this._header.sd = Math.sqrt(dispersion / xyzData.length);\r\n this._header.dmax = maxDensity;\r\n this._header.dmin = minDensity;\r\n }\r\n}\r\n\r\nclass DSN6Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'dsn6';\r\n this.model = new DSN6Model();\r\n }\r\n\r\n static canParse(data, options) {\r\n if (!data) {\r\n return false;\r\n }\r\n return data instanceof ArrayBuffer && Parser.checkDataTypeOptions(options, 'dsn6');\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false;\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nDSN6Parser.formats = ['dsn6'];\r\nDSN6Parser.extensions = ['.dsn6', '.omap'];\r\nDSN6Parser.binary = true;\r\n\r\nexport default DSN6Parser;\r\n","import PDBStream from './PDBStream';\r\n\r\n/**\r\n * Little helper class for GRO Parser usage.\r\n * @extends PDBStream\r\n */\r\nclass GROReader extends PDBStream {\r\n constructor(data) {\r\n super(data);\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n this.next();\r\n }\r\n\r\n /**\r\n * Getting end of string.\r\n * @returns {Number} Pointer to end of string\r\n */\r\n getNext() {\r\n return this._next;\r\n }\r\n}\r\n\r\nexport default GROReader;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport GROReader from './GROReader';\r\n\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Molecule,\r\n} = chem;\r\n\r\n/**\r\n * Gromos87 file format parser.\r\n * @extends Parser\r\n */\r\nclass GROParser extends Parser {\r\n /**\r\n * Create parser for .gro file format\r\n *\r\n * @param {String} data Input file\r\n * @param {String} options Input options (optional field)\r\n */\r\n constructor(data, options) {\r\n super(data, options);\r\n /** @type Date */\r\n this._time = null; // Time in ps, optional field for animations\r\n /** @type Number */\r\n this._numAtoms = null; // Number of atoms in complex\r\n /** @type Number */\r\n this._residueNumber = null; // Number of exact residue\r\n /** @type String */\r\n this._residueName = ''; // Scientific name of exact residue\r\n /** @type String */\r\n this._atomName = ''; // Scientific name of exact atom\r\n /** @type Number */\r\n this._atomNumber = null; // Sorted number of exact atom\r\n /** @type Array */\r\n this._atomPosition = []; // Array which contains x, y, z position of exact atom\r\n /** @type Array */\r\n this._atomVelocity = []; // Array which contains x, y, z velocity of exact atom (optional)\r\n /** @type Complex */\r\n this._complex = null; // Complex structure for unified molecule representation\r\n /** @type Vector3 */\r\n this._molecules = []; // Molecules array\r\n /** @type Molecule */\r\n this._molecule = null; // Single molecule\r\n /** @type String */\r\n this._options.filetype = 'gro'; // Extension of data file.\r\n }\r\n\r\n /**\r\n * General check for possibility of parsing.\r\n * @param {String} data - Input file\r\n * @returns {boolean} true if this file is in ascii, false otherwise\r\n */\r\n canProbablyParse(data) {\r\n return _.isString(this._data) && /^\\s*[^\\n]*\\n\\s*\\d+ *\\n\\s*\\d+[^\\n\\d]{3}\\s*\\w+\\s*\\d+\\s*-?\\d/.test(data);\r\n }\r\n\r\n /**\r\n * Parsing title of molecule complex.\r\n * NOTE: that names are ESTIMATES, there is no strict rules in Gromos87 standard for first line in input file.\r\n * @param {GROReader} line - Line containing title and time.\r\n */\r\n _parseTitle(line) {\r\n const { metadata } = this._complex;\r\n metadata.id = line.readLine().trim();\r\n metadata.name = metadata.id.slice(metadata.id.lastIndexOf('\\\\') + 1, metadata.id.lastIndexOf('.'));\r\n metadata.format = 'gro';\r\n }\r\n\r\n /**\r\n * Parsing line containing number of atoms information.\r\n * @param {GROReader} line - Line containing number of atoms.\r\n */\r\n _parseNumberOfAtoms(line) {\r\n this._numAtoms = line.readInt(0, line.getNext());\r\n if (Number.isNaN(this._numAtoms)) {\r\n throw new Error('Line 2 is not representing atom number. Consider checking input file');\r\n }\r\n }\r\n\r\n /**\r\n * Parsing line containing information about residues, atoms etc. Also information about box vectors.\r\n * Format of atoms MUST (by Gromos87 standard) be this: (note that numbering starts not from 0, but from 1!)\r\n * ResidueNumber[1 - 5] ResidueName[6 - 10] AtomName[11 - 15] AtomNumber[16 - 20] Position[21 - 45] Velocity[46 - 69]\r\n * @param {GROReader} line - Line containing information about atom.\r\n */\r\n _parseAtom(line) {\r\n this._residueNumber = line.readInt(1, 5);\r\n this._residueName = line.readString(6, 10).trim();\r\n this._atomName = line.readString(11, 15).trim();\r\n this._atomNumber = line.readInt(16, 20);\r\n const positionX = line.readFloat(21, 28) * 10;\r\n const positionY = line.readFloat(29, 36) * 10;\r\n const positionZ = line.readFloat(37, 45) * 10;\r\n if (Number.isNaN(positionX) || Number.isNaN(positionY) || Number.isNaN(positionZ)) {\r\n this._complex.error = {\r\n message: `Atom position is invalid in \"${line.readLine()}\"`,\r\n };\r\n return;\r\n }\r\n /* const velocityX = line.readFloat(46, 53);\r\n const velocityY = line.readFloat(54, 61);\r\n const velocityZ = line.readFloat(62, 69); */\r\n /* Adding residue and atom to complex structure */\r\n const type = Element.getByName(this._atomName[0]); /* MAGIC 0. REASONS: This name is something like \"CA\", where\r\n C - is an element an A is something else. But what about Calcium? */\r\n if (type.fullName === 'Unknown') {\r\n this._complex.error = {\r\n message: `${this._atomName[0]} hasn't been recognised as an atom name.`,\r\n };\r\n return;\r\n }\r\n const role = Element.Role[this._atomName];\r\n /* Firstly, create a dummy chain */\r\n let chain = this._chain;\r\n if (!chain) {\r\n this._chain = chain = this._complex.addChain('A');\r\n }\r\n /* Secondly, add residue to that chain */\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== this._residueNumber) {\r\n this._residue = residue = chain.addResidue(this._residueName, this._residueNumber, ' ');\r\n }\r\n /* Lastly, add atom to that residue */\r\n this._atomPosition = new THREE.Vector3(positionX, positionY, positionZ);\r\n /* Adding default constants to correct atom addition process */\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n residue.addAtom(this._atomName, type, this._atomPosition, role, het, this._atomNumber, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n /**\r\n * Some finalizing procedures. In '.gro' file format there is only 1 chain and 1 molecule.\r\n */\r\n _finalize() {\r\n const molecule = new Molecule(this._complex, this._complex.metadata.name, 1);\r\n // aggregate residues from chain\r\n molecule.residues = this._chain._residues;\r\n molecule._chains = this._chain;\r\n this._complex._molecules[0] = molecule;\r\n this._molecules.push(molecule);\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n /**\r\n * Main parsing procedure.\r\n * @returns {Complex} Complex structure for visualizing.\r\n */\r\n parseSync() {\r\n /* Create \"Complex\" variable */\r\n const result = this._complex = new Complex();\r\n /* Parse input file line-by-line */\r\n const reader = new GROReader(this._data);\r\n let counter = 0; /* Simple counter regarding to format of .gro file */\r\n /* First two lines - technical information, other lines - Atoms */\r\n this._parseTitle(reader);\r\n reader.next();\r\n this._parseNumberOfAtoms(reader);\r\n reader.next();\r\n for (counter = 0; counter < this._numAtoms; ++counter) {\r\n if (!reader.end()) {\r\n this._parseAtom(reader);\r\n reader.next();\r\n } else break;\r\n }\r\n /* If number of atoms in second line is less then actual atoms in file */\r\n if (counter < this._numAtoms) {\r\n this._complex.error = {\r\n message: 'File ended unexpectedly.',\r\n };\r\n }\r\n /* Catch errors occurred in parsing process */\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n\r\n /* Finalizing data */\r\n this._finalize();\r\n\r\n /* Cleaning up */\r\n this._atomPosition = null;\r\n this._complex = null;\r\n this._molecules = null;\r\n this._molecule = null;\r\n\r\n /* Return resulting Complex variable */\r\n return result;\r\n }\r\n}\r\n\r\nGROParser.formats = ['gro'];\r\nGROParser.extensions = ['.gro'];\r\n\r\nexport default GROParser;\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst orderMap = {\r\n un: 0,\r\n 1: 1,\r\n 2: 2,\r\n 3: 3,\r\n ar: 1,\r\n am: 1,\r\n nc: 0,\r\n du: 1,\r\n};\r\nconst typeMap = {\r\n un: Bond.BondType.UNKNOWN, // unknown (cannot be determined from the parameter tables)\r\n 1: Bond.BondType.COVALENT, // single\r\n 2: Bond.BondType.COVALENT, // double\r\n 3: Bond.BondType.COVALENT, // triple\r\n ar: Bond.BondType.AROMATIC, // aromatic\r\n am: Bond.BondType.COVALENT, // amide\r\n nc: Bond.BondType.UNKNOWN, // not connected\r\n du: Bond.BondType.COVALENT, // dummy\r\n};\r\n\r\nconst resNumberRegex = /\\d+$/;\r\nconst spacesRegex = /\\s+/;\r\n\r\nfunction splitToFields(str) {\r\n return str.trim().split(spacesRegex);\r\n}\r\n/* There is no jsdoc documentation because of eslint corrections:\r\n * not all Parser methods are implemented\r\n */\r\n\r\nclass MOL2Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._compoundIndx = -1;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n\r\n this._currPosIdx = 0;\r\n this._currStartIdx = 0;\r\n\r\n this._serialAtomMap = {};\r\n\r\n this._options.fileType = 'mol2';\r\n }\r\n\r\n _parseRawStrings(data) {\r\n return data.split(/\\r?\\n|\\r/);\r\n }\r\n\r\n _toStringFromStart(numb, MOL2Data) {\r\n const newPosIdx = this._currStartIdx + numb;\r\n this._currPosIdx = (newPosIdx < MOL2Data.length) ? newPosIdx : this._currStartIdx;\r\n }\r\n\r\n _toHeaderString(header, MOL2Data) {\r\n this._toStringFromStart(0, MOL2Data);\r\n while (this._currPosIdx < MOL2Data.length) {\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`)) {\r\n return;\r\n }\r\n this._currPosIdx++;\r\n }\r\n this._toStringFromStart(0, MOL2Data);\r\n }\r\n\r\n _toStringFromHeader(header, numb, MOL2Data) {\r\n this._toHeaderString(header, MOL2Data);\r\n const newPosIdx = this._currPosIdx + numb;\r\n\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`) && newPosIdx < MOL2Data.length) {\r\n this._currPosIdx = newPosIdx;\r\n }\r\n }\r\n\r\n _setStart(startPos, MOL2Data) {\r\n if (startPos >= MOL2Data.length) {\r\n this._currStartIdx = this._currPosIdx = MOL2Data.length - 1;\r\n } else {\r\n this._currStartIdx = this._currPosIdx = startPos;\r\n }\r\n }\r\n\r\n _probablyHaveDataToParse(MOL2Data) {\r\n return this._currPosIdx < MOL2Data.length - 2;\r\n }\r\n\r\n _findNextCompoundStart(MOL2Data) {\r\n while (this._currPosIdx < MOL2Data.length && MOL2Data[this._currPosIdx].trim() !== '@MOLECULE>') {\r\n this._currPosIdx++;\r\n }\r\n this._setStart(++this._currPosIdx, MOL2Data);\r\n return this._probablyHaveDataToParse(MOL2Data);\r\n }\r\n\r\n _parseMolecule(MOL2Data) {\r\n this._toHeaderString('MOLECULE', MOL2Data);\r\n\r\n const { metadata } = this._complex;\r\n metadata.name = MOL2Data[++this._currPosIdx];\r\n metadata.format = 'mol2';\r\n\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = this._compoundIndx + 1;\r\n this._molecules.push(this._molecule);\r\n }\r\n\r\n /* Atom format description:\r\n * atomId atomName x y z element [resSeq [resName [charge [statusBit]]]]\r\n * statusBits is the internal SYBYL status bits associated with the atom.\r\n * These should never be set by the user.\r\n * Source: http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf\r\n */\r\n _parseAtoms(atomsNum, MOL2Data) {\r\n this._toHeaderString('ATOM', MOL2Data);\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 6) {\r\n throw new Error('MOL2 parsing error: Not enough information to create atom!');\r\n }\r\n const atomId = parseInt(parsedStr[0], 10);\r\n const atomName = parsedStr[1];\r\n\r\n const x = parseFloat(parsedStr[2]);\r\n const y = parseFloat(parsedStr[3]);\r\n const z = parseFloat(parsedStr[4]);\r\n\r\n const element = parsedStr[5].split('.')[0].toUpperCase();\r\n\r\n let charge = 0;\r\n if (parsedStr.length >= 9) {\r\n charge = parseFloat(parsedStr[8]) || 0.0;\r\n }\r\n\r\n let chain = this._chain;\r\n if (!chain) {\r\n // .mol2 may contain information about multiple molecules, but they can't be visualized\r\n // at the same time now. There is no need to create different chain IDs then.\r\n this._chain = chain = this._complex.getChain('A') || this._complex.addChain('A');\r\n this._residue = null;\r\n }\r\n if (!this._setResidue(parsedStr)) {\r\n continue;\r\n }\r\n\r\n // These fields are not listed in mol2 format. Set them default.\r\n // Atoms and het atoms doesn't differ in .mol2,\r\n // but het atoms have special residues. It can be used in next updates\r\n const het = false;\r\n const altLoc = ' ';\r\n const occupancy = 1.0;\r\n const tempFactor = 0.0;\r\n const type = Element.getByName(element);\r\n const role = Element.Role[atomName];\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n this._residue.addAtom(atomName, type, xyz, role, het, atomId, altLoc, occupancy, tempFactor, charge);\r\n }\r\n }\r\n\r\n _setResidue(parsedStr) {\r\n let resSeq = 1;\r\n let resName = 'UNK'; // The same meaning has '<0>' in some mol2 files\r\n\r\n if (parsedStr.length >= 7) {\r\n resSeq = parseInt(parsedStr[6], 10);\r\n }\r\n if (parsedStr.length >= 8 && parsedStr[7] !== '<0>') {\r\n resName = parsedStr[7].replace(resNumberRegex, '');\r\n }\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return false;\r\n }\r\n }\r\n const residue = this._residue;\r\n const chain = this._chain;\r\n if (!residue || residue.getSequence() !== resSeq) {\r\n this._residue = chain.addResidue(resName, resSeq, 'A');\r\n }\r\n return true;\r\n }\r\n\r\n /* Bond format description\r\n * bondId originAtomId targetAtomId bondType [statusBits]\r\n */\r\n _parseBonds(bondsNum, MOL2Data) {\r\n this._toHeaderString('BOND', MOL2Data);\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 3) {\r\n throw new Error('MOL2 parsing error: Missing information about bonds!');\r\n }\r\n\r\n let originAtomId = parseInt(parsedStr[1], 10);\r\n let targetAtomId = parseInt(parsedStr[2], 10);\r\n const bondType = parsedStr[3];\r\n\r\n if (originAtomId > targetAtomId) {\r\n [originAtomId, targetAtomId] = [targetAtomId, originAtomId];\r\n }\r\n this._complex.addBond(originAtomId, targetAtomId,\r\n orderMap[bondType] || 0,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true);\r\n }\r\n }\r\n\r\n _fixSerialAtoms() {\r\n const atoms = this._complex._atoms;\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n this._serialAtomMap[atom.serial] = atom;\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n if (Object.keys(serialAtomMap).length === 0) {\r\n throw new Error('MOL2 parsing error: Missing atom information!');\r\n }\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _finalizeMolecules() {\r\n // Get chain from complex\r\n const chain = this._complex._chains[0];\r\n this._complex._molecules = [];\r\n\r\n // Aggregate residues from chains\r\n // (to be precise from the chain 'A')\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const currMolecule = this._molecules[i];\r\n const molResidues = chain._residues;\r\n const molecule = new Molecule(this._complex, currMolecule._name, i + 1);\r\n molecule.residues = molResidues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _finalize() {\r\n this._complex._finalizeBonds();\r\n this._fixSerialAtoms();\r\n this._fixBondsArray();\r\n this._finalizeMolecules();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _parseCompound(MOL2Data) {\r\n this._compoundIndx++;\r\n this._parseMolecule(MOL2Data);\r\n\r\n // Ignoring comments and everything before @MOLECULE block\r\n this._toStringFromHeader('MOLECULE', 2, MOL2Data);\r\n\r\n const parsedStr = MOL2Data[this._currPosIdx].trim().split(spacesRegex);\r\n const atomsNum = parsedStr[0];\r\n const bondsNum = parsedStr[1];\r\n\r\n this._parseAtoms(atomsNum, MOL2Data);\r\n this._parseBonds(bondsNum, MOL2Data);\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const MOL2Data = this._parseRawStrings(this._data);\r\n do {\r\n this._parseCompound(MOL2Data);\r\n } while (this._findNextCompoundStart(MOL2Data));\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nMOL2Parser.formats = ['mol2'];\r\nMOL2Parser.extensions = ['.mol2', '.ml2', '.sy2'];\r\n\r\nexport default MOL2Parser;\r\n","import ParserList from './parsers/ParserList';\r\n\r\nimport PDBParser from './parsers/PDBParser';\r\nimport CMLParser from './parsers/CMLParser';\r\nimport MMTFParser from './parsers/MMTFParser';\r\nimport CIFParser from './parsers/CIFParser';\r\nimport CCP4Parser from './parsers/CCP4Parser';\r\nimport XYZParser from './parsers/XYZParser';\r\nimport PubChemParser from './parsers/PubChemParser';\r\nimport SDFParser from './parsers/SDFParser';\r\nimport DSN6Parser from './parsers/DSN6Parser';\r\nimport GROParser from './parsers/GROParser';\r\nimport MOL2Parser from './parsers/MOL2Parser';\r\n\r\nexport default new ParserList([\r\n // note: order might be important\r\n PDBParser,\r\n CIFParser,\r\n MMTFParser,\r\n XYZParser,\r\n CMLParser,\r\n PubChemParser,\r\n SDFParser,\r\n CCP4Parser,\r\n DSN6Parser,\r\n GROParser,\r\n MOL2Parser,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available exporters.\r\n * @extends EntityList\r\n */\r\nclass ExporterList extends EntityList {\r\n /**\r\n * Create a list of exporters.\r\n * The exporters are indexed by supported data formats (`.formats` and\r\n * `.extensions` properties of a Exporter subclass).\r\n * The Exporters can be retrieved later by matching against specs (see {@link ExporterList#find}).\r\n *\r\n * @param {!Array=} someExporters A list of {@link Exporter} subclasses to\r\n * automatically register at creation time.\r\n * @see ExporterList#register\r\n */\r\n constructor(someExporters = []) {\r\n super(someExporters, ['formats']);\r\n }\r\n\r\n /**\r\n * Find a suitable exporter for data.\r\n *\r\n * @param {Object} specs Exporter specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {*=} specs.data Data to export.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ExporterList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Exporter {\r\n constructor(source, options) {\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n exportSync() {\r\n throw new Error('Exporting to this source is not implemented');\r\n }\r\n\r\n export() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Export aborted'));\r\n }\r\n return resolve(this.exportSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Exporter.prototype);\r\n","import _ from 'lodash';\r\nimport { Matrix4 } from 'three';\r\n\r\nexport default class PDBResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._currentStr = -1;\r\n this._tag = null;\r\n this._fixedNumeration = false;\r\n this._numeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n\r\n getResult() {\r\n this.writeString('\\n', 81, 81);\r\n return this._resultArray.join('');\r\n }\r\n\r\n _currentStrLength() {\r\n const curStr = this._resultArray[this._currentStr];\r\n return curStr ? curStr.length : 0;\r\n }\r\n\r\n // numeration can be number or boolean\r\n // if numeration is number then just put this number to 8-10 pos in string\r\n // if numeration is boolean then increase number for all new strings\r\n newTag(tag, numeration) {\r\n if (!tag) {\r\n this._tag = null;\r\n } else {\r\n this._tag = tag;\r\n }\r\n if (!_.isUndefined(numeration)) {\r\n if (_.isNumber(numeration)) {\r\n this._tagStrNum = numeration;\r\n this._numeration = true;\r\n this._fixedNumeration = true;\r\n } else if (_.isBoolean(numeration)) {\r\n this._tagStrNum = 0;\r\n this._numeration = numeration;\r\n this._fixedNumeration = false;\r\n }\r\n } else {\r\n this._numeration = false;\r\n this._fixedNumeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n }\r\n\r\n newString(tag) {\r\n this.writeString('\\n', 81, 81);\r\n this._currentStr++;\r\n this._resultArray.push('');\r\n\r\n if (tag) {\r\n this.writeString(tag, 1, 6);\r\n } else if (this._tag) {\r\n this.writeString(this._tag, 1, 6);\r\n }\r\n\r\n if (this._numeration) {\r\n if (!this._fixedNumeration) {\r\n this._tagStrNum++;\r\n }\r\n if (this._tagStrNum !== 1) {\r\n this.writeString(this._tagStrNum.toString(), 10, 8);\r\n }\r\n }\r\n }\r\n\r\n writeEntireString(string, maxStrPos, concat) {\r\n if (!maxStrPos) {\r\n maxStrPos = 81;\r\n }\r\n for (let j = 0; j < string.length; j++) {\r\n if (this._currentStrLength() === maxStrPos && j !== string.length - 1) {\r\n this.newString();\r\n if (concat) { // pretty hardcoddy\r\n this.writeString(concat.tag, concat.begin, concat.end);\r\n }\r\n }\r\n if (string[j] === '\\n') {\r\n this.newString();\r\n } else {\r\n this.writeString(string[j]);\r\n }\r\n }\r\n }\r\n\r\n writeString(string, begin, end) {\r\n let curStr = this._resultArray[this._currentStr];\r\n let str;\r\n\r\n const curStrLength = curStr ? curStr.length : 0;\r\n\r\n if (_.isUndefined(string)) {\r\n return;\r\n }\r\n\r\n if (!_.isNumber(begin)) {\r\n begin = curStrLength + 1;\r\n }\r\n\r\n if (!_.isNumber(end)) {\r\n end = curStrLength + string.length;\r\n }\r\n\r\n if (!_.isString(string)) {\r\n str = string.toString();\r\n } else {\r\n str = string;\r\n }\r\n\r\n const finish = begin < end ? end : begin;\r\n const start = begin < end ? begin : end;\r\n\r\n if (str.length > Math.abs(begin - end) + 1) {\r\n str = str.substr(0, Math.abs(begin - end + 1));\r\n }\r\n\r\n // spaces before start of new data\r\n if (start > curStrLength + 1) {\r\n this._resultArray[this._currentStr] += ' '.repeat(start - curStrLength - 1);\r\n } else if (start <= curStrLength) {\r\n const cStr = this._resultArray[this._currentStr];\r\n this._resultArray[this._currentStr] = cStr.slice(0, start - 1);\r\n }\r\n\r\n // if reverse order\r\n // reverse order of end and begin means that user wants to align text right\r\n if (end < begin) {\r\n const len = begin - end + 1;\r\n str = ' '.repeat(len - str.length) + str;\r\n }\r\n\r\n // some hardcode fix for space between string numeration and data\r\n // (see pdb file format description)\r\n if (start === 11 && this._numeration && this._tagStrNum !== 1) {\r\n str = ` ${str}`;\r\n }\r\n\r\n // append new data to string\r\n this._resultArray[this._currentStr] += str;\r\n curStr = this._resultArray[this._currentStr];\r\n\r\n if (finish > curStr.length) {\r\n this._resultArray[this._currentStr] += ' '.repeat(finish - curStr.length);\r\n }\r\n }\r\n\r\n writeBondsArray(bonds, atom) {\r\n const bondsArrays = this._getSubArrays(bonds, 4);\r\n\r\n for (let k = 0; k < bondsArrays.length; k++) {\r\n this.newString();\r\n this.writeString(atom.serial, 11, 7);\r\n\r\n for (let j = 0; j < bondsArrays[k].length; j++) {\r\n const serial = (bondsArrays[k][j]._left.serial === atom.serial)\r\n ? bondsArrays[k][j]._right.serial : bondsArrays[k][j]._left.serial;\r\n\r\n this.writeString(serial, 16 + 5 * j, 12 + 5 * j);\r\n }\r\n }\r\n }\r\n\r\n _getSubArrays(arr, subArraySize) {\r\n const subArrays = [];\r\n for (let i = 0; i < arr.length; i += subArraySize) {\r\n subArrays.push(arr.slice(i, i + subArraySize));\r\n }\r\n return subArrays;\r\n }\r\n\r\n // function for writing matrix in Remark290 and Remark350 tags\r\n // (see pdb file description)\r\n writeMatrix(matrix, matrixIndx, tag) {\r\n for (let j = 0; j < 3; j++) {\r\n this.newString();\r\n this.writeString(tag, 14, 18);\r\n this.writeString((j + 1).toString(), 19, 19);\r\n this.writeString(matrixIndx.toString(), 23, 20);\r\n for (let k = 0; k < 3; k++) {\r\n const numb = parseFloat(matrix.elements[j * 4 + k]).toFixed(6);\r\n this.writeString(numb.toString(), 33 + k * 10, 24 + k * 10);\r\n }\r\n\r\n const numb = parseFloat(matrix.elements[j * 4 + 3]).toFixed(5);\r\n this.writeString(numb.toString(), 68, 55);\r\n }\r\n }\r\n\r\n writeMatrices(matrices, string) {\r\n if (!matrices) {\r\n return;\r\n }\r\n const matrix = new Matrix4();\r\n for (let j = 0; j < matrices.length; j++) {\r\n matrix.copy(matrices[j]).transpose();\r\n this.writeMatrix(matrix, j + 1, string);\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport Complex from '../../chem/Complex';\r\nimport Exporter from './Exporter';\r\nimport PDBResult from './PDBResult';\r\nimport Assembly from '../../chem/Assembly';\r\nimport { typeByPDBHelixClass } from '../../chem/Helix';\r\n\r\nexport default class PDBExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n this._tags = ['HEADER', 'TITLE', 'COMPND', 'REMARK', 'HELIX', 'SHEET', 'ATOM and HETATM', 'CONECT'];\r\n this._result = null;\r\n this._tagExtractors = {\r\n HEADER: this._extractHEADER,\r\n TITLE: this._extractTITLE,\r\n 'ATOM and HETATM': this._extractATOM,\r\n CONECT: this._extractCONECT,\r\n COMPND: this._extractCOMPND,\r\n REMARK: this._extractREMARK,\r\n HELIX: this._extractHELIX,\r\n SHEET: this._extractSHEET,\r\n };\r\n this._stringForRemark350 = 'COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN\\n'\r\n + 'BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE\\n'\r\n + 'MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS\\n'\r\n + 'GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND\\n'\r\n + 'CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.';\r\n\r\n this._stringForRemark290 = 'CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS\\n'\r\n + 'THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM\\n'\r\n + 'RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY\\n'\r\n + 'RELATED MOLECULES.';\r\n }\r\n\r\n exportSync() {\r\n const result = new PDBResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n for (let i = 0; i < this._tags.length; i++) {\r\n const tag = this._tags[i];\r\n const func = this._tagExtractors[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, result);\r\n }\r\n }\r\n\r\n this._result = result.getResult();\r\n\r\n return this._result;\r\n }\r\n\r\n _extractHEADER(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n result.newTag('HEADER');\r\n result.newString();\r\n if (metadata.classification) {\r\n result.writeString(metadata.classification, 11, 50);\r\n }\r\n if (metadata.date) {\r\n result.writeString(metadata.date, 51, 59);\r\n }\r\n if (metadata.id) {\r\n result.writeString(metadata.id, 63, 66);\r\n }\r\n }\r\n\r\n _extractTITLE(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n if (!metadata.title) {\r\n return;\r\n }\r\n result.newTag('TITLE', true);\r\n for (let i = 0; i < metadata.title.length; i++) {\r\n result.newString();\r\n result.writeString(metadata.title[i], 11, 80);\r\n }\r\n }\r\n\r\n _extractCONECT(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n\r\n const atoms = this._source._atoms;\r\n result.newTag('CONECT');\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const fixedBonds = atoms[i].bonds.filter((bond) => bond._fixed);\r\n if (fixedBonds.length !== 0) {\r\n result.writeBondsArray(fixedBonds.reverse(), atoms[i]);\r\n }\r\n }\r\n }\r\n\r\n _extractSHEET(result) {\r\n if (!this._source._sheets) {\r\n return;\r\n }\r\n\r\n result.newTag('SHEET');\r\n\r\n const sheets = this._source._sheets;\r\n for (let i = 0; i < sheets.length; i++) {\r\n if (sheets[i]._strands) {\r\n const strands = sheets[i]._strands;\r\n for (let j = 0; j < strands.length; j++) {\r\n result.newString();\r\n result.writeString(j + 1, 10, 8);\r\n result.writeString(sheets[i]._name, 14, 12);\r\n result.writeString(strands.length, 16, 15);\r\n result.writeString(strands[j].init._type._name, 18, 20);\r\n result.writeString(strands[j].init._chain._name, 22, 22);\r\n result.writeString(strands[j].init._sequence, 26, 23);\r\n result.writeString(strands[j].init._icode, 27, 27);\r\n result.writeString(strands[j].term._type._name, 29, 31);\r\n result.writeString(strands[j].init._chain._name, 33, 33);\r\n result.writeString(strands[j].term._sequence, 37, 34);\r\n result.writeString(strands[j].term._icode, 38, 38);\r\n result.writeString(strands[j].sense, 40, 39);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _extractHELIX(result) {\r\n if (!this._source._helices) {\r\n return;\r\n }\r\n\r\n result.newTag('HELIX');\r\n const helices = this._source._helices;\r\n for (let i = 0; i < helices.length; i++) {\r\n const helix = helices[i];\r\n const helixClass = _.invert(typeByPDBHelixClass);\r\n result.newString();\r\n result.writeString(helix.serial, 10, 8);\r\n result.writeString(helix.name, 14, 12);\r\n result.writeString(helix.init._type._name, 16, 18);\r\n result.writeString(helix.init._chain._name, 20, 20);\r\n result.writeString(helix.init._sequence, 25, 22);\r\n result.writeString(helix.init._icode, 26, 26);\r\n result.writeString(helix.term._type._name, 28, 30);\r\n result.writeString(helix.term._chain._name, 32, 32);\r\n result.writeString(helix.term._sequence, 37, 34);\r\n result.writeString(helix.term._icode, 38, 38);\r\n result.writeString(helixClass[helix.type], 40, 39);\r\n result.writeString(helix.comment, 41, 70);\r\n result.writeString(helix.length, 76, 72);\r\n }\r\n }\r\n\r\n _extractATOM(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n const atoms = this._source._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const tag = atoms[i].het ? 'HETATM' : 'ATOM';\r\n result.newString(tag);\r\n const startIndx = (atoms[i].element.name.length > 1 || atoms[i].name.length > 3) ? 13 : 14;\r\n result.writeString(atoms[i].serial, 11, 7);\r\n result.writeString(atoms[i].name, startIndx, 16);\r\n result.writeString(String.fromCharCode(atoms[i].location), 17, 17);\r\n result.writeString(atoms[i].residue._type._name, 20, 18);\r\n result.writeString(atoms[i].residue._chain._name, 22, 22);\r\n result.writeString(atoms[i].residue._sequence, 26, 23);\r\n result.writeString(atoms[i].residue._icode, 27, 27);\r\n result.writeString(atoms[i].position.x.toFixed(3), 38, 31);\r\n result.writeString(atoms[i].position.y.toFixed(3), 46, 39);\r\n result.writeString(atoms[i].position.z.toFixed(3), 54, 47);\r\n result.writeString(atoms[i].occupancy.toFixed(2), 60, 55);\r\n result.writeString(atoms[i].temperature.toFixed(2), 66, 61);\r\n result.writeString(atoms[i].element.name, 78, 77);\r\n if (atoms[i].charge) {\r\n result.writeString(atoms[i].charge, 79, 80);\r\n }\r\n }\r\n }\r\n\r\n _extractCOMPND(result) {\r\n if (!this._source._molecules) {\r\n return;\r\n }\r\n const molecules = this._source._molecules;\r\n result.newTag('COMPND', true);\r\n\r\n for (let i = 0; i < molecules.length; i++) {\r\n const chains = this._getMoleculeChains(molecules[i]);\r\n result.newString();\r\n result.writeString(`MOL_ID: ${molecules[i].index};`, 11, 80);\r\n result.newString();\r\n result.writeString(`MOLECULE: ${molecules[i].name};`, 11, 80);\r\n result.newString();\r\n result.writeString('CHAIN: ', 11, 18);\r\n const chainsString = `${chains.join(', ')};`;\r\n result.writeEntireString(chainsString, 81);\r\n }\r\n }\r\n\r\n _extractREMARK(result) {\r\n this._Remark290(result);\r\n this._Remark350(result);\r\n }\r\n\r\n _Remark290(result) {\r\n if (!this._source.symmetry) {\r\n return;\r\n }\r\n\r\n if (this._source.symmetry.length !== 0) {\r\n const matrices = this._source.symmetry;\r\n result.newTag('REMARK', 290);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark290);\r\n result.writeMatrices(matrices, 'SMTRY');\r\n result.newString();\r\n result.newString();\r\n result.writeString('REMARK: NULL', 11, 80);\r\n }\r\n }\r\n\r\n _Remark350(result) {\r\n if (!this._source.units) {\r\n return;\r\n }\r\n const { units } = this._source;\r\n let biomolIndx = 0;\r\n\r\n result.newTag('REMARK', 350);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark350);\r\n\r\n const assemblies = units.filter((unit) => unit instanceof Assembly);\r\n\r\n for (let i = 0; i < assemblies.length; i++) {\r\n result.newString();\r\n result.newString();\r\n biomolIndx++;\r\n result.writeString(`BIOMOLECULE: ${biomolIndx}`, 11, 80);\r\n const chains = assemblies[i].chains.join(', ');\r\n result.newString();\r\n result.writeString('APPLY THE FOLLOWING TO CHAINS: ');\r\n result.writeEntireString(chains, 69, { tag: 'AND CHAINS: ', begin: 31, end: 42 });\r\n\r\n const { matrices } = assemblies[i];\r\n result.writeMatrices(matrices, 'BIOMT');\r\n }\r\n }\r\n\r\n _getMoleculeChains(molecule) {\r\n function getChainName(residue) {\r\n return residue._chain._name;\r\n }\r\n const chainNames = molecule.residues.map(getChainName);\r\n return chainNames.filter((item, pos) => chainNames.indexOf(item) === pos);\r\n }\r\n}\r\n\r\nPDBExporter.formats = ['pdb'];\r\nPDBExporter.SourceClass = Complex;\r\n","import * as THREE from 'three';\r\n\r\nconst FBX_POS_SIZE = 3;\r\nconst FBX_NORM_SIZE = 3;\r\nconst FBX_COL_SIZE = 4;\r\n\r\nfunction copyFbxPoint3(src, srcIdx, dst, dstIdx) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n}\r\n\r\nfunction copyFbxPoint4(src, srcIdx, dst, dstIdx, value) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n dst[dstIdx + 3] = value;\r\n}\r\n\r\nconst vector4 = new THREE.Vector4();\r\nfunction copyTransformedPoint3(src, srcIdx, dst, dstIdx, opts) {\r\n vector4.set(src[srcIdx], src[srcIdx + 1], src[srcIdx + 2], opts.w);\r\n vector4.applyMatrix4(opts.matrix);\r\n dst[dstIdx] = vector4.x;\r\n dst[dstIdx + 1] = vector4.y;\r\n dst[dstIdx + 2] = vector4.z;\r\n}\r\n\r\nfunction setSubArray(src, dst, count, copyFunctor, functorOpts) {\r\n if ((dst.array.length - dst.start) / dst.stride < count\r\n || (src.array.length - src.start) / src.stride < count) {\r\n return; // we've got no space\r\n }\r\n if (src.stride === dst.stride) { // stride is the same\r\n dst.array.set(src.array, dst.start);\r\n } else {\r\n let idx = dst.start;\r\n let arridx = src.start;\r\n for (let i = 0; i < count; ++i, idx += dst.stride, arridx += src.stride) {\r\n copyFunctor(src.array, arridx, dst.array, idx, functorOpts);\r\n }\r\n }\r\n}\r\n\r\nexport default class FBXModel {\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.lastPos = 0;\r\n this.lastNorm = 0;\r\n this.lastCol = 0;\r\n this.lastIdx = 0;\r\n }\r\n\r\n init(vertsCount, indsCount) {\r\n this.positions = new Float32Array(vertsCount * FBX_POS_SIZE);\r\n this.normals = new Float32Array(vertsCount * FBX_NORM_SIZE);\r\n this.colors = new Float32Array(vertsCount * FBX_COL_SIZE);\r\n this.indices = new Int32Array(indsCount);\r\n }\r\n\r\n setPositions(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.positions,\r\n start: this.lastPos,\r\n stride: FBX_POS_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setTransformedPositions(array, start, count, stride, matrix) {\r\n let idx = this.lastPos;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 1 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_POS_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.positions, idx, opts);\r\n }\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setNormals(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.normals,\r\n start: this.lastNorm,\r\n stride: FBX_NORM_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setTransformedNormals(array, start, count, stride, matrix) {\r\n let idx = this.lastNorm;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 0 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_NORM_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.normals, idx, opts);\r\n }\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setColors(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.colors,\r\n start: this.lastCol,\r\n stride: FBX_COL_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint4, 1);\r\n this.lastCol += count * FBX_COL_SIZE;\r\n }\r\n\r\n setIndices(array, start, count) {\r\n this.indices.set(array, this.lastIdx);\r\n this.lastIdx += count;\r\n }\r\n\r\n setShiftedIndices(array, count, shift) {\r\n const shifted = array.map((x) => x + shift);\r\n this.setIndices(shifted, 0, count);\r\n }\r\n\r\n getVerticesNumber() {\r\n return this.lastPos / FBX_POS_SIZE;\r\n }\r\n\r\n addInstance(matrix, geo) {\r\n // add indices at first to take old number of vertices for shift\r\n const currentCount = this.getVerticesNumber();\r\n this.setShiftedIndices(geo.indices, geo.indices.length, currentCount);\r\n // simply write vertices at empty space\r\n const size = geo.itemSize;\r\n this.setTransformedPositions(geo.positions, 0, geo.vertsCount, size.position, matrix);\r\n this.setTransformedNormals(geo.normals, 0, geo.vertsCount, size.normal, matrix);\r\n this.setColors(geo.colors, 0, geo.vertsCount, size.color);\r\n }\r\n}\r\n","/** Base class for fbx geometry contains simply organized attributes: positions+normals+colors, indices. */\r\nexport default class FBXGeometry {\r\n /**\r\n * Create a base geo with necessary members.\r\n */\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.vertsCount = 0;\r\n this.itemSize = null;\r\n }\r\n\r\n /**\r\n * Initialize base geo storing items info from attributes.\r\n * @param {Object} geo - THREE.Geometry.\r\n */\r\n init(geo, _info) {\r\n const { attributes } = geo;\r\n // save item size\r\n this.itemSize = {\r\n position: attributes.position.itemSize,\r\n normal: attributes.normal.itemSize,\r\n color: attributes.color.itemSize,\r\n };\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes and creates colors filled with defined value.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX1CGeometry extends FBXGeometry {\r\n /**\r\n * Initialize geo storing positions, normals, indices and create colors.\r\n * @param {Object} geo - THREE.Geometry.\r\n */\r\n init(geo, _info) {\r\n super.init(geo, _info);\r\n const {\r\n attributes: {\r\n position,\r\n normal,\r\n },\r\n index,\r\n } = geo;\r\n // copy vertices attributes\r\n this.vertsCount = position.count;\r\n this.positions = position.array;\r\n this.normals = normal.array;\r\n // create color array\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n // indices\r\n this.indices = index.array;\r\n }\r\n\r\n /**\r\n * Set defined color for all items in color attribute\r\n * @param {Object} color - THREE.Color.\r\n */\r\n setColors(color) {\r\n let offset = 0;\r\n for (let i = 0, l = this.colors.length, cl = this.itemSize.color; i < l; i += cl) {\r\n this.colors[offset++] = color.r;\r\n this.colors[offset++] = color.g;\r\n this.colors[offset++] = color.b;\r\n }\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes from cylinder geometry and creates colors filled with two\r\n * defined values.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX2CCylinder extends FBXGeometry {\r\n constructor() {\r\n super();\r\n this._cutRawStart = 0;\r\n this._cutRawEnd = 0;\r\n this._facesPerSlice = 0;\r\n }\r\n\r\n /**\r\n * Initialize geo by creating new attributes, because we extend number of vertices to make cylinder two-colored.\r\n * Indices remain the same. We process open- end close-ended cylinders and consider cylinders od 2 segments\r\n * in height ONLY.\r\n * NOTE: cylinder consists of 2 height segments and stores parts in the order: tube, topCap, bottomCap\r\n * @param {Object} geo - THREE.Geometry.\r\n * @param {Object} info - information needed for geo extend\r\n */\r\n init(geo, info) {\r\n super.init(geo, info);\r\n const {\r\n attributes: {\r\n position,\r\n },\r\n index,\r\n } = geo;\r\n // extend vertices arrays\r\n this.vertsCount = position.count + info.addPerCylinder;\r\n this._facesPerSlice = info.addPerCylinder;\r\n this.positions = new Float32Array(this.vertsCount * position.itemSize);\r\n this.normals = new Float32Array(this.vertsCount * this.itemSize.normal);\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n this._extendVertices(geo, info);\r\n // number of indices stays the same\r\n this.indices = new Uint32Array(index.count);\r\n this._extendIndices(geo, info);\r\n }\r\n\r\n /** Extend vertex attributes to have one more slice to make sharp middle startColor-endColor line. */\r\n _extendVertices(geo, info) {\r\n const { position } = geo.attributes;\r\n const { normal } = geo.attributes;\r\n const geoParams = geo.getGeoParams();\r\n const cutRaw = 1; // we expect cylinders of 2 segments in height => so half segment = 1\r\n this._cutRawStart = cutRaw * geoParams.radialSegments;\r\n this._cutRawEnd = this._cutRawStart + info.addPerCylinder;\r\n { // write first half of cylinder\r\n let temp = position.array.slice(0, this._cutRawEnd * position.itemSize);\r\n this.positions.set(temp, 0);\r\n temp = normal.array.slice(0, this._cutRawEnd * normal.itemSize);\r\n this.normals.set(temp, 0);\r\n }\r\n { // write second part of cylinder\r\n let temp = position.array.slice(this._cutRawStart * position.itemSize, position.array.length);\r\n this.positions.set(temp, this._cutRawEnd * position.itemSize);\r\n temp = normal.array.slice(this._cutRawStart * normal.itemSize, normal.array.length);\r\n this.normals.set(temp, this._cutRawEnd * normal.itemSize);\r\n }\r\n }\r\n\r\n /** Shift values of second part (+caps) indices by newly added vertices count. Number of faces remains the same. */\r\n _extendIndices(geo, info) {\r\n const { index } = geo;\r\n const indicesPerQuad = 6; // quad = 2 triangles => 6 indices\r\n const startToShift = info.addPerCylinder * indicesPerQuad;\r\n const shift = info.addPerCylinder;\r\n let shifted = index.array.slice(startToShift, index.count);\r\n shifted = shifted.map((x) => x + shift); // shift only the endings\r\n this.indices.set(index.array, 0);\r\n this.indices.set(shifted, startToShift);\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {number} start - start color index\r\n * @param {number} end - start color index\r\n * @param {array} array - array of colors\r\n * @param {array} color - color value components\r\n */\r\n _setColorRange(start, end, array, color) {\r\n const colorSize = color.length;\r\n for (let i = start; i < end; i += colorSize) {\r\n array.set(color, i);\r\n }\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {Object} color1 - THREE.Color.\r\n * @param {Object} color2 - THREE.Color.\r\n */\r\n setColors(color1, color2) {\r\n const colorSize = this.itemSize.color;\r\n const part1End = this._cutRawEnd * colorSize;\r\n const part2End = part1End * 2;\r\n this._setColorRange(0, part1End, this.colors, color1.toArray());\r\n this._setColorRange(part1End, part2End, this.colors, color2.toArray());\r\n if (part2End < this.colors.length) { // cylinder has caps, lets paint them\r\n const capSize = (this._facesPerSlice + 1) * colorSize;\r\n const cap1End = part2End + capSize;\r\n this._setColorRange(part2End, cap1End, this.colors, color2.toArray());\r\n const cap2End = cap1End + capSize; // should be equal to this.colors.length;\r\n this._setColorRange(cap1End, cap2End, this.colors, color1.toArray());\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\n\r\nimport utils from '../../../utils';\r\nimport gfxutils from '../../../gfx/gfxutils';\r\nimport logger from '../../../utils/logger';\r\n\r\nimport FBXModel from './FBXModel';\r\nimport ThickLineMesh from '../../../gfx/meshes/ThickLineMesh';\r\nimport ZSpriteMesh from '../../../gfx/meshes/ZSpriteMesh';\r\nimport InstancedSpheresGeometry from '../../../gfx/geometries/InstancedSpheresGeometry';\r\nimport Instanced2CCylindersGeometry from '../../../gfx/geometries/Instanced2CCylindersGeometry';\r\nimport FBX1CGeometry from './FBX1CGeometry';\r\nimport FBX2CCylinder from './FBX2CCylinder';\r\n\r\nexport default class FBXInfoExtractor {\r\n constructor() {\r\n this._materials = [];\r\n this._models = [];\r\n }\r\n\r\n process(data) {\r\n this._extractModelsAndMaterials(data);\r\n\r\n\r\n const models = this._flattenModels();\r\n\r\n return {\r\n name: data.name,\r\n models,\r\n materials: this._materials,\r\n };\r\n }\r\n\r\n /**\r\n * Extract fbx object information from ComplexVisual\r\n * @param {object} data - complexVisual to get geometry info from\r\n */\r\n _extractModelsAndMaterials(data) {\r\n const layersOfInterest = new THREE.Layers();\r\n layersOfInterest.set(gfxutils.LAYERS.DEFAULT);\r\n layersOfInterest.enable(gfxutils.LAYERS.TRANSPARENT);\r\n data.traverse((object) => {\r\n if (object instanceof THREE.Mesh && object.layers.test(layersOfInterest) && this.checkExportAbility(object)) {\r\n if (object.geometry.type === 'InstancedBufferGeometry') {\r\n this._collectInstancedGeoInfo(object);\r\n } else {\r\n this._collectGeoInfo(object);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Reworking indices buffer, see https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/\r\n * basically, every triangle in Miew has been represented hat way (e.g.) : 0,1,7, but we must (for FBX) rework that\r\n * into: 0,1,-8.\r\n * @param {array} indices - belongs to [0, maxVertIndex]\r\n */\r\n _reworkIndices(indices) {\r\n const faceSize = 3;\r\n for (let i = faceSize - 1; i < indices.length; i += faceSize) {\r\n indices[i] *= -1;\r\n indices[i]--;\r\n }\r\n }\r\n\r\n /**\r\n * Combine geometry from several models having the same material into one Model and finally prepare indices\r\n * @returns {array} models, combined by material id\r\n */\r\n _flattenModels() {\r\n let overallVertsCount = 0;\r\n function shift(x) {\r\n return x + overallVertsCount;\r\n }\r\n const combined = [];\r\n // flatten models geometry\r\n for (let i = 0, n = this._models.length; i < n; i++) {\r\n const models = this._models[i];\r\n let indices = [];\r\n let positions = [];\r\n let normals = [];\r\n let colors = [];\r\n // reorganize every attributes as array of arrays\r\n overallVertsCount = 0;\r\n for (let j = 0; j < models.length; j++) {\r\n const m = models[j];\r\n indices.push(m.indices.map(shift));\r\n overallVertsCount += m.getVerticesNumber();\r\n positions.push(m.positions);\r\n normals.push(m.normals);\r\n colors.push(m.colors);\r\n }\r\n // join all subarrays into one\r\n indices = utils.mergeTypedArraysUnsafe(indices);\r\n this._reworkIndices(indices);\r\n positions = utils.mergeTypedArraysUnsafe(positions);\r\n normals = utils.mergeTypedArraysUnsafe(normals);\r\n colors = utils.mergeTypedArraysUnsafe(colors);\r\n combined.push({\r\n indices,\r\n positions,\r\n normals,\r\n colors,\r\n verticesCount: overallVertsCount,\r\n });\r\n }\r\n return combined;\r\n }\r\n\r\n /**\r\n * Check ability to export the kind of mesh.\r\n * @param {object} mesh - given mesh to check\r\n * @returns {boolean} result of check\r\n */\r\n checkExportAbility(mesh) {\r\n // check mesh on not being empty\r\n if (mesh.geometry.attributes.position.count === 0) {\r\n return false;\r\n }\r\n // check type of mesh\r\n // if (mesh.geometry.isInstancedBufferGeometry && settings.now.zSprites) {\r\n if (mesh instanceof ZSpriteMesh) {\r\n logger.warn('Currently we cannot export \\'sprites\\' modes, like BS, WV, LC. Please turn of settings \\'zSprites\\' and try again');\r\n return false;\r\n }\r\n if (mesh instanceof ThickLineMesh) {\r\n logger.warn('Currently we cannot export Lines mode');\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Save geometry info from common mesh, like Surface or Cartoon\r\n */\r\n _collectGeoInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n normal,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const vertCount = position.count;\r\n model.init(vertCount, index.count);\r\n if (matrix.isIdentity()) {\r\n model.setPositions(position.array, 0, vertCount, position.itemSize);\r\n model.setNormals(normal.array, 0, vertCount, normal.itemSize);\r\n } else {\r\n model.setTransformedPositions(position.array, 0, vertCount, position.itemSize, matrix);\r\n model.setTransformedNormals(normal.array, 0, vertCount, normal.itemSize, matrix);\r\n }\r\n model.setColors(color.array, 0, vertCount, color.itemSize);\r\n model.setIndices(index.array, 0, index.count);\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Collect instanced spheres geometry and materials.\r\n * @param {object} mesh - mesh with instanced spheres info\r\n */\r\n _collectSpheresInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.maxInstancedCount;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount, instCount * indsCount);\r\n const geo = new FBX1CGeometry();\r\n geo.init(mesh.geometry);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const sphereColor = new THREE.Color();\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n sphereColor.fromArray(color.array, colorIdx);\r\n geo.setColors(sphereColor);\r\n // add instance to the model\r\n this._getSphereInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Getting all instanced cylinders from given mesh.\r\n * Divide cylinder (add additional vertexes) for prettiness therefore algorithm is a bit complicated\r\n * @param {object} mesh - given mesh with instanced cylinders\r\n */\r\n _collectCylindersInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n color2,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.maxInstancedCount;\r\n const oneCCylinder = new FBX1CGeometry();\r\n oneCCylinder.init(mesh.geometry);\r\n const splittingInfo = this._gatherCylindersColoringInfo(mesh.geometry);\r\n let twoCCylinder = null;\r\n if (splittingInfo.needToSplit > 0) {\r\n twoCCylinder = new FBX2CCylinder();\r\n twoCCylinder.init(mesh.geometry, splittingInfo);\r\n }\r\n const additionalVertsCount = splittingInfo.addPerCylinder * splittingInfo.needToSplit;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount + additionalVertsCount, instCount * indsCount);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const colorStart = new THREE.Color();\r\n const colorEnd = new THREE.Color();\r\n let geo = {};\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n if (splittingInfo.is2Colored[instanceIndex]) {\r\n // .color2 contains starting color, and .color contains starting color (see uber.frag ATTR_COLOR2)\r\n colorStart.fromArray(color2.array, colorIdx);\r\n colorEnd.fromArray(color.array, colorIdx);\r\n if (twoCCylinder) {\r\n twoCCylinder.setColors(colorStart, colorEnd);\r\n geo = twoCCylinder;\r\n }\r\n } else {\r\n // has one color per cylinder\r\n colorStart.fromArray(color.array, colorIdx);\r\n oneCCylinder.setColors(colorStart);\r\n geo = oneCCylinder;\r\n }\r\n // add instance to the model\r\n this._getCylinderInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Adding model to pool of models or extend existing ones\r\n * @param {object} model - model to add\r\n * @param {object} material - material to add\r\n */\r\n _addToPool(model, material) {\r\n const materialIdx = this._checkExistingMaterial(material);\r\n if (materialIdx < 0) { // new model-material pair\r\n this._models.push([model]);\r\n this._materials.push(material);\r\n } else { // add model to existing model-material pair\r\n const models = this._models[materialIdx];\r\n models.push(model);\r\n }\r\n }\r\n\r\n /**\r\n * Checking if given material already was registered in materials pool (no need to create new one)\r\n * @param {object} material - given material\r\n * @returns {number} number of model-material pair\r\n */\r\n _checkExistingMaterial(material) {\r\n return _.findIndex(this._materials, (m) => _.isEqual(m, material));\r\n }\r\n\r\n _gatherCylindersColoringInfo(geo) {\r\n const instCount = geo.maxInstancedCount;\r\n const color1 = geo.attributes.color.array;\r\n const color2 = geo.attributes.color2.array;\r\n const stride = geo.attributes.color.itemSize;\r\n const is2Colored = new Array(instCount);\r\n // analyze color instance attributes\r\n let needToSplit = 0;\r\n let colIdx = 0;\r\n for (let i = 0; i < instCount; i++, colIdx += stride) {\r\n const differs = (Math.abs(color1[colIdx] - color2[colIdx]) > 0.0000001) // compare ending colors\r\n || (Math.abs(color1[colIdx + 1] - color2[colIdx + 1]) > 0.0000001)\r\n || (Math.abs(color1[colIdx + 2] - color2[colIdx + 2]) > 0.0000001);\r\n is2Colored[i] = differs;\r\n needToSplit += differs; // count number of 2-colored cylinders\r\n }\r\n // calc number of vertices to add into 2-colored\r\n const geoParams = geo.getGeoParams();\r\n const addPerCylinder = geoParams.radialSegments;\r\n return { is2Colored, needToSplit, addPerCylinder };\r\n }\r\n\r\n /**\r\n * Collect instanced models and materials.\r\n * @param {object} mesh - given mesh with instanced something (spheres or cylinders)\r\n */\r\n _collectInstancedGeoInfo(mesh) {\r\n if (mesh.geometry instanceof InstancedSpheresGeometry) {\r\n this._collectSpheresInfo(mesh);\r\n } else if (mesh.geometry instanceof Instanced2CCylindersGeometry) {\r\n this._collectCylindersInfo(mesh);\r\n }\r\n }\r\n\r\n /**\r\n * Collect Material info from given mesh.\r\n * @param {object} mesh - given mesh with material info\r\n * @returns {object} material\r\n */\r\n _collectMaterialInfo(mesh) {\r\n const { uberOptions } = mesh.material;\r\n return ({\r\n diffuse: uberOptions.diffuse.toArray(),\r\n opacity: uberOptions.opacity,\r\n shininess: uberOptions.shininess,\r\n specular: uberOptions.specular.toArray(),\r\n });\r\n }\r\n\r\n _getCylinderInstanceMatrix(geo, instIdx, matrix) {\r\n const matVector1 = geo.attributes.matVector1.array;\r\n const matVector2 = geo.attributes.matVector2.array;\r\n const matVector3 = geo.attributes.matVector3.array;\r\n const idxOffset = instIdx * 4; // used 4 because offset arrays are stored in quads\r\n matrix.set(matVector1[idxOffset], matVector1[idxOffset + 1], matVector1[idxOffset + 2], matVector1[idxOffset + 3],\r\n matVector2[idxOffset], matVector2[idxOffset + 1], matVector2[idxOffset + 2], matVector2[idxOffset + 3],\r\n matVector3[idxOffset], matVector3[idxOffset + 1], matVector3[idxOffset + 2], matVector3[idxOffset + 3],\r\n 0, 0, 0, 1);\r\n }\r\n\r\n _getSphereInstanceMatrix(geo, instIdx, matrix) {\r\n const { offset } = geo.attributes;\r\n const idx = instIdx * offset.itemSize;\r\n const x = offset.array[idx];\r\n const y = offset.array[idx + 1];\r\n const z = offset.array[idx + 2];\r\n const scale = offset.array[idx + 3];\r\n matrix.set(\r\n scale, 0, 0, x,\r\n 0, scale, 0, y,\r\n 0, 0, scale, z,\r\n 0, 0, 0, 1,\r\n );\r\n }\r\n}\r\n","// Forming default definitions block\r\nconst defaultDefinitions = `\r\nDefinitions: {\r\n Version: 100\r\n Count: 3\r\n ObjectType: \"Model\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Geometry\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Material\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Pose\" {\r\n Count: 1\r\n }\r\n ObjectType: \"GlobalSettings\" {\r\n Count: 1\r\n }\r\n} `;\r\n\r\n// Default model properties\r\nconst defaultProperties = `Properties60: {\r\n Property: \"QuaternionInterpolate\", \"bool\", \"\",0\r\n Property: \"Visibility\", \"Visibility\", \"A\",1\r\n Property: \"Lcl Translation\", \"Lcl Translation\", \"A\",0.000000000000000,0.000000000000000,-1789.238037109375000\r\n Property: \"Lcl Rotation\", \"Lcl Rotation\", \"A\",0.000009334667643,-0.000000000000000,0.000000000000000\r\n Property: \"Lcl Scaling\", \"Lcl Scaling\", \"A\",1.000000000000000,1.000000000000000,1.000000000000000\r\n Property: \"RotationOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationActive\", \"bool\", \"\",0\r\n Property: \"TranslationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMinX\", \"bool\", \"\",0\r\n Property: \"TranslationMinY\", \"bool\", \"\",0\r\n Property: \"TranslationMinZ\", \"bool\", \"\",0\r\n Property: \"TranslationMaxX\", \"bool\", \"\",0\r\n Property: \"TranslationMaxY\", \"bool\", \"\",0\r\n Property: \"TranslationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationOrder\", \"enum\", \"\",0\r\n Property: \"RotationSpaceForLimitOnly\", \"bool\", \"\",0\r\n Property: \"AxisLen\", \"double\", \"\",10\r\n Property: \"PreRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"PostRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationActive\", \"bool\", \"\",0\r\n Property: \"RotationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMinX\", \"bool\", \"\",0\r\n Property: \"RotationMinY\", \"bool\", \"\",0\r\n Property: \"RotationMinZ\", \"bool\", \"\",0\r\n Property: \"RotationMaxX\", \"bool\", \"\",0\r\n Property: \"RotationMaxY\", \"bool\", \"\",0\r\n Property: \"RotationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationStiffnessX\", \"double\", \"\",0\r\n Property: \"RotationStiffnessY\", \"double\", \"\",0\r\n Property: \"RotationStiffnessZ\", \"double\", \"\",0\r\n Property: \"MinDampRangeX\", \"double\", \"\",0\r\n Property: \"MinDampRangeY\", \"double\", \"\",0\r\n Property: \"MinDampRangeZ\", \"double\", \"\",0\r\n Property: \"MaxDampRangeX\", \"double\", \"\",0\r\n Property: \"MaxDampRangeY\", \"double\", \"\",0\r\n Property: \"MaxDampRangeZ\", \"double\", \"\",0\r\n Property: \"MinDampStrengthX\", \"double\", \"\",0\r\n Property: \"MinDampStrengthY\", \"double\", \"\",0\r\n Property: \"MinDampStrengthZ\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthX\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthY\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthZ\", \"double\", \"\",0\r\n Property: \"PreferedAngleX\", \"double\", \"\",0\r\n Property: \"PreferedAngleY\", \"double\", \"\",0\r\n Property: \"PreferedAngleZ\", \"double\", \"\",0\r\n Property: \"InheritType\", \"enum\", \"\",0\r\n Property: \"ScalingActive\", \"bool\", \"\",0\r\n Property: \"ScalingMin\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMax\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMinX\", \"bool\", \"\",0\r\n Property: \"ScalingMinY\", \"bool\", \"\",0\r\n Property: \"ScalingMinZ\", \"bool\", \"\",0\r\n Property: \"ScalingMaxX\", \"bool\", \"\",0\r\n Property: \"ScalingMaxY\", \"bool\", \"\",0\r\n Property: \"ScalingMaxZ\", \"bool\", \"\",0\r\n Property: \"GeometricTranslation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricScaling\", \"Vector3D\", \"\",1,1,1\r\n Property: \"LookAtProperty\", \"object\", \"\"\r\n Property: \"UpVectorProperty\", \"object\", \"\"\r\n Property: \"Show\", \"bool\", \"\",1\r\n Property: \"NegativePercentShapeSupport\", \"bool\", \"\",1\r\n Property: \"DefaultAttributeIndex\", \"int\", \"\",0\r\n Property: \"Color\", \"Color\", \"A+\",0,0,0\r\n Property: \"Size\", \"double\", \"\",100\r\n Property: \"Look\", \"enum\", \"\",1\r\n }`;\r\n\r\n// Default materials layer\r\nconst defaultMaterialLayer = `\r\n LayerElementMaterial: 0 {\r\n Version: 101\r\n Name: \"\"\r\n MappingInformationType: \"AllSame\"\r\n ReferenceInformationType: \"Direct\"\r\n Materials: 0\r\n }`;\r\n\r\n// Default layers block\r\nconst defaultLayerBlock = `\r\n Layer: 0 {\r\n Version: 100\r\n LayerElement: {\r\n Type: \"LayerElementNormal\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementColor\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementMaterial\"\r\n TypedIndex: 0\r\n }\r\n }`;\r\n\r\n/**\r\n * globalSettings info in output file.\r\n */\r\nconst globalSettings = `GlobalSettings: {\r\n Version: 1000\r\n Properties60: {\r\n Property: \"UpAxis\", \"int\", \"\",1\r\n Property: \"UpAxisSign\", \"int\", \"\",1\r\n Property: \"FrontAxis\", \"int\", \"\",2\r\n Property: \"FrontAxisSign\", \"int\", \"\",1\r\n Property: \"CoordAxis\", \"int\", \"\",0\r\n Property: \"CoordAxisSign\", \"int\", \"\",1\r\n Property: \"UnitScaleFactor\", \"double\", \"\",1\r\n }\r\n }`;\r\n\r\nexport default class FBXResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._info = null;\r\n }\r\n\r\n getResult(info) {\r\n this._info = info;\r\n this._resultArray.push(this._writeHeader());\r\n this._resultArray.push(this._writeDefinitions());\r\n this._resultArray.push(this._writeObjects(info.models, info.materials));\r\n this._resultArray.push(this._writeRelations());\r\n this._resultArray.push(this._writeConnections()); // connections between models and materials)\r\n this._info = null;\r\n return this._resultArray.join('');\r\n }\r\n\r\n /**\r\n * Add FBXHeader info to output file.\r\n * Some fields are really confusing, but it seems that all listed fields are very informative\r\n */\r\n _writeHeader() {\r\n const FBXHeaderVersion = 1003; // 1003 is some number which appears to present in many 6.1 ASCII files\r\n const FBXVersion = 6100; // Mandatory and only supported version\r\n const date = new Date();\r\n const timeStampVersion = 1000;\r\n const creator = `Miew FBX Exporter v${this._info.version}`; // Supposed to be an engine\r\n\r\n return `; FBX 6.1.0 project file\r\n; Created by ${creator} Copyright (c) 2015-2020 EPAM Systems, Inc.\r\n; For support please contact miew@epam.com\r\n; ----------------------------------------------------\r\n\r\nFBXHeaderExtension: {\r\n FBXHeaderVersion: ${FBXHeaderVersion}\r\n FBXVersion: ${FBXVersion}\r\n CreationTimeStamp: {\r\n Version: ${timeStampVersion}\r\n Year: ${date.getFullYear()}\r\n Month: ${date.getMonth() + 1} \r\n Day: ${date.getDate()}\r\n Hour: ${date.getHours()}\r\n Minute: ${date.getMinutes()}\r\n Second: ${date.getSeconds()}\r\n Millisecond: ${date.getMilliseconds()}\r\n }\r\n Creator: \"${creator}\"\r\n OtherFlags: {\r\n FlagPLE: 0\r\n }\r\n}\r\nCreationTime: \"${date}\"\r\nCreator: \"${creator}\" \r\n`;\r\n }\r\n\r\n /**\r\n * Add Definitions info to output file.\r\n * Not exactly sure if this section is template section (as it is in 7.4+) or it should every time be like this\r\n */\r\n _writeDefinitions() {\r\n return `\r\n; Object definitions\r\n;------------------------------------------------------------------\r\n\r\n${defaultDefinitions}\r\n`;\r\n }\r\n\r\n /**\r\n * Adding gathered information about Models to resulting string.\r\n * Reminder - there may be more then 1 model in scene, but we must place materials after ALL models.\r\n * @returns {string} string containing all models (vertices, indices, colors, normals etc)\r\n */\r\n _models() {\r\n const modelVersion = 232;\r\n let allModels = '';\r\n const { models } = this._info;\r\n for (let i = 0; i < models.length; ++i) {\r\n const model = models[i];\r\n const vertCount = model.verticesCount;\r\n allModels += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n Version: ${modelVersion} \r\n ${defaultProperties}\r\n ${this._verticesIndices(model.positions, model.indices)}\r\n ${this._normalLayer(model.normals)} \r\n ${this._colorLayer(model.colors, vertCount)} \r\n ${defaultMaterialLayer} \r\n ${defaultLayerBlock}\r\n }`;\r\n }\r\n return allModels;\r\n }\r\n\r\n /**\r\n * Add Material info to result\r\n */\r\n _materials() {\r\n const materialVersion = 102;\r\n let allMaterials = '';\r\n const { materials } = this._info;\r\n for (let i = 0; i < materials.length; ++i) {\r\n const material = materials[i];\r\n allMaterials += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n Version: ${materialVersion}\r\n ShadingModel: \"lambert\"\r\n MultiLayer: 0\r\n ${this._materialProperties(material)}\r\n }`;\r\n }\r\n return allMaterials;\r\n }\r\n\r\n /**\r\n * Add Objects info to output file.\r\n */\r\n _writeObjects() {\r\n return `\r\n; Object properties\r\n;------------------------------------------------------------------\r\n\r\nObjects: {\r\n ${this._models()}\r\n ${this._materials()}\r\n ${globalSettings}\r\n}\r\n`;\r\n }\r\n\r\n /**\r\n * Add Relations info to output file.\r\n */\r\n _writeRelations() {\r\n let modelsList = '';\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n }`;\r\n }\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n }`;\r\n }\r\n\r\n return `\r\n; Object relations\r\n;------------------------------------------------------------------\r\n\r\nRelations: {\r\n ${modelsList}\r\n Model: \"Model::Producer Perspective\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Top\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Bottom\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Front\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Back\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Right\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Left\", \"Camera\" {\r\n }\r\n Model: \"Model::Camera Switcher\", \"CameraSwitcher\" {\r\n }\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Add Connections info to output file.\r\n */\r\n _writeConnections() {\r\n let modelsList = '';\r\n const { name } = this._info;\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Connect: \"OO\", \"Model::${name}_${i}\", \"Model::Scene\"`;\r\n }\r\n\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Connect: \"OO\", \"Material::${name}_${i}_default\", \"Model::${name}_${i}\"`;\r\n }\r\n\r\n return `\r\n; Object connections\r\n;------------------------------------------------------------------\r\n\r\nConnections: {\r\n ${modelsList}\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Write float array to string with limited precision\r\n * @param {Float32Array} array - array to be fixed\r\n * @returns {String} String with fixed floats\r\n */\r\n _floatArrayToString(array) {\r\n const str = [];\r\n for (let i = 0; i < array.length; ++i) {\r\n str[i] = array[i].toFixed(6);\r\n }\r\n return str.join(',');\r\n }\r\n\r\n /**\r\n * Adding color layer to resulting file\r\n * @param {Float32Array} colorArray attribute\r\n * @param {number} vertCount - number of vertices in the model\r\n * @returns {string} color layer info\r\n */\r\n _colorLayer(colorArray, vertCount) {\r\n const layerElementColorNumber = 0;\r\n const layerElementColorVersion = 101;\r\n const layerElementColorName = '';\r\n const colorsStr = this._floatArrayToString(colorArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n // As said [..Array(...)] - fastest and easiest way to produce [0, 1, .....] array\r\n const colorIndices = [...Array(vertCount).keys()];\r\n return `\r\n LayerElementColor: ${layerElementColorNumber} {\r\n Version: ${layerElementColorVersion}\r\n Name: \"${layerElementColorName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\"\r\n Colors: ${colorsStr}\r\n ColorIndex: ${colorIndices}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding normal layer to resulting file\r\n * @param {Float32Array} normalArray attribute\r\n * @returns {string} normal layer info\r\n */\r\n _normalLayer(normalArray) {\r\n const layerElementNormalNumber = 0;\r\n const layerElementNormalVersion = 101;\r\n const layerElementNormalName = '';\r\n const normalsStr = this._floatArrayToString(normalArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n return `\r\n LayerElementNormal: ${layerElementNormalNumber} {\r\n Version: ${layerElementNormalVersion}\r\n Name: \"${layerElementNormalName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\" \r\n Normals: ${normalsStr}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding vertices and indices to resulting string\r\n * @return {string} resulting string in FBX notation\r\n */\r\n _verticesIndices(positions, indices) {\r\n const multiLayer = 0;\r\n const multiTake = 1;\r\n const shading = 'Y';\r\n const culling = 'CullingOff';\r\n const geometryVersion = 124;\r\n const vertStr = this._floatArrayToString(positions);\r\n /* About _correctArrayNotation: Float32Arrays will contains only Float32 numbers, which implies that it will be floating points with 17 numbers after point.\r\n * We cannot (and it's logically incorrect) save all this information, so we convert this Float32Array into Array-like object with numbers with only 6 numbers after point\r\n * Reminder - this is big memory loss (as we must save at one moment two arrays with similar information) */\r\n return `MultiLayer: ${multiLayer}\r\n MultiTake: ${multiTake}\r\n Shading: ${shading}\r\n Culling: \"${culling}\"\r\n Vertices: ${vertStr}\r\n PolygonVertexIndex: ${indices}\r\n GeometryVersion: ${geometryVersion}`;\r\n }\r\n\r\n /**\r\n * Forming material properties block.\r\n * @param {Object} material - given material of model\r\n * @returns {String} material properties string\r\n */\r\n _materialProperties(material) {\r\n return `Properties60: {\r\n Property: \"ShadingModel\", \"KString\", \"\", \"Lambert\"\r\n Property: \"MultiLayer\", \"bool\", \"\",0\r\n Property: \"EmissiveColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"EmissiveFactor\", \"double\", \"\",0.0000\r\n Property: \"AmbientColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"AmbientFactor\", \"double\", \"\",0.0000\r\n Property: \"DiffuseColor\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"DiffuseFactor\", \"double\", \"\",1.0000\r\n Property: \"Bump\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TransparentColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"TransparencyFactor\", \"double\", \"\",0.0000\r\n Property: \"SpecularColor\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"SpecularFactor\", \"double\", \"\",1.0000\r\n Property: \"ShininessExponent\", \"double\", \"\",${material.shininess}\r\n Property: \"ReflectionColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"ReflectionFactor\", \"double\", \"\",1\r\n Property: \"Ambient\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"Diffuse\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"Specular\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"Shininess\", \"double\", \"\",${material.shininess}\r\n Property: \"Opacity\", \"double\", \"\",${material.opacity}\r\n Property: \"Reflectivity\", \"double\", \"\",0\r\n }`;\r\n }\r\n}\r\n","import Exporter from './Exporter';\r\nimport FBXInfoExtractor from './fbx/FBXInfoExtractor';\r\nimport FBXResult from './fbx/FBXResult';\r\nimport ComplexVisual from '../../ComplexVisual';\r\n\r\nexport default class FBXExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n // Data\r\n this._data = source;\r\n this._version = options.miewVersion || '0.0-UNSPECIFIED';\r\n this._extractor = new FBXInfoExtractor();\r\n }\r\n\r\n /**\r\n * Entry point to exporter.\r\n */\r\n exportSync() {\r\n // Creating mandatory blocks\r\n const result = new FBXResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n const info = this._extractor.process(this._data);\r\n info.version = this._version;\r\n this._result = result.getResult(info);\r\n return this._result;\r\n }\r\n}\r\n\r\nFBXExporter.formats = ['fbx'];\r\nFBXExporter.SourceClass = ComplexVisual;\r\n","import ExporterList from './exporters/ExporterList';\r\n\r\nimport PDBExporter from './exporters/PDBExporter';\r\nimport FBXExporter from './exporters/FBXExporter';\r\n\r\nexport default new ExporterList([\r\n PDBExporter,\r\n FBXExporter,\r\n]);\r\n","import loaders from './loaders';\r\nimport parsers from './parsers';\r\nimport exporters from './exporters';\r\n\r\nexport default {\r\n loaders,\r\n parsers,\r\n exporters,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from './CSS2DObject';\r\n\r\nconst tempColor = new THREE.Color();\r\n\r\nclass CSS2DRenderer {\r\n constructor() {\r\n this._width = 0;\r\n this._height = 0;\r\n this._widthHalf = 0;\r\n this._heightHalf = 0;\r\n\r\n this._vector = new THREE.Vector3();\r\n this._viewMatrix = new THREE.Matrix4();\r\n this._projectionMatrix = new THREE.Matrix4();\r\n\r\n this._domElement = document.createElement('div');\r\n this._domElement.style.overflow = 'hidden';\r\n this._domElement.style.position = 'absolute';\r\n this._domElement.style.top = '0';\r\n this._domElement.style.zIndex = '0'; // start a new Stacking Context to enclose all z-ordered children\r\n this._domElement.style.pointerEvents = 'none';\r\n }\r\n\r\n getElement() {\r\n return this._domElement;\r\n }\r\n\r\n reset() {\r\n const myNode = this.getElement();\r\n while (myNode.firstChild) {\r\n myNode.removeChild(myNode.firstChild);\r\n }\r\n }\r\n\r\n setSize(width, height) {\r\n this._width = width;\r\n this._height = height;\r\n\r\n this._widthHalf = this._width / 2;\r\n this._heightHalf = this._height / 2;\r\n\r\n this._domElement.style.width = `${width}px`;\r\n this._domElement.style.height = `${height}px`;\r\n }\r\n\r\n _renderObject(object, camera, scene) {\r\n function lerpColorAsHex(a, b, t) {\r\n tempColor.setHex(a);\r\n tempColor.lerp(b, t);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n function colorAsHex(a) {\r\n tempColor.setHex(a);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n if (object instanceof CSS2DObject) {\r\n this._vector.setFromMatrixPosition(object.matrixWorld);\r\n\r\n if (object.userData !== undefined && object.userData.offset !== undefined) {\r\n const localOffset = new THREE.Vector3(object.userData.offset.x, object.userData.offset.y, 0);\r\n this._vector.add(localOffset.multiplyScalar(object.matrixWorld.getMaxScaleOnAxis()));\r\n }\r\n\r\n this._vector.applyMatrix4(this._viewMatrix);\r\n\r\n const visibility = this._vector.z > -camera.near ? 'hidden' : 'visible';\r\n const zIndex = 10000 * (camera.far - (-this._vector.z)) / (camera.far - camera.near);\r\n\r\n const element = object.getElement();\r\n if (typeof scene.fog === 'undefined') {\r\n element.style.color = colorAsHex(object.userData.color);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = colorAsHex(object.userData.background);\r\n }\r\n } else {\r\n const fogFactor = THREE.Math.smoothstep(-this._vector.z, scene.fog.near, scene.fog.far);\r\n element.style.color = lerpColorAsHex(object.userData.color, scene.fog.color, fogFactor);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = lerpColorAsHex(object.userData.background, scene.fog.color, fogFactor);\r\n }\r\n }\r\n\r\n this._vector.applyMatrix4(this._projectionMatrix);\r\n\r\n const style = `${object.userData !== {} ? object.userData.translation : 'translate(-50%, -50%) '\r\n }translate(${this._vector.x * this._widthHalf + this._widthHalf}px,${\r\n -this._vector.y * this._heightHalf + this._heightHalf}px)`;\r\n element.style.visibility = visibility;\r\n element.style.WebkitTransform = style;\r\n element.style.MozTransform = style;\r\n element.style.oTransform = style;\r\n element.style.transform = style;\r\n element.style.zIndex = Number(zIndex).toFixed(0);\r\n\r\n if (element.parentNode !== this._domElement) {\r\n this._domElement.appendChild(element);\r\n }\r\n }\r\n\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n this._renderObject(object.children[i], camera, scene);\r\n }\r\n }\r\n\r\n render(scene, camera) {\r\n scene.updateMatrixWorld();\r\n\r\n if (camera.parent === null) {\r\n camera.updateMatrixWorld();\r\n }\r\n\r\n camera.matrixWorldInverse.getInverse(camera.matrixWorld);\r\n\r\n this._viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));\r\n this._projectionMatrix.copy(camera.projectionMatrix);\r\n\r\n this._renderObject(scene, camera, scene);\r\n }\r\n}\r\nexport default CSS2DRenderer;\r\n","import * as THREE from 'three';\r\nimport Timer from '../Timer';\r\nimport settings from '../settings';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\n\r\nconst VK_LEFT = 37;\r\nconst VK_UP = 38;\r\nconst VK_RIGHT = 39;\r\nconst VK_DOWN = 40;\r\n\r\nconst STATE = {\r\n NONE: -1, ROTATE: 0, TRANSLATE: 1, SCALE: 2, TRANSLATE_PIVOT: 3,\r\n};\r\n\r\n// pausing for this amount of time before releasing mouse button prevents inertial rotation (seconds)\r\nconst FULL_STOP_THRESHOLD = 0.1;\r\n\r\nconst quaternion = new THREE.Quaternion();\r\nconst matrix4 = new THREE.Matrix4();\r\n\r\n// pivot -- local offset of the rotation pivot point\r\nfunction ObjectHandler(objects, camera, pivot, options) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n this.camera = camera;\r\n this.pivot = pivot;\r\n this.axis = new THREE.Vector3(0, 0, 1);\r\n this.options = options;\r\n\r\n this.lastRotation = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n}\r\n\r\nObjectHandler.prototype._rotate = (function () {\r\n const p = new THREE.Vector3();\r\n const q = new THREE.Quaternion();\r\n const s = new THREE.Vector3();\r\n\r\n const m = new THREE.Matrix4();\r\n\r\n return function (quat) {\r\n const zeroPivot = (this.pivot.x === 0.0 && this.pivot.y === 0.0 && this.pivot.z === 0.0);\r\n\r\n m.copy(this.object.matrix);\r\n\r\n if (zeroPivot) {\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n } else {\r\n m.multiply(matrix4.makeTranslation(this.pivot.x, this.pivot.y, this.pivot.z));\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n m.multiply(matrix4.makeTranslation(-this.pivot.x, -this.pivot.y, -this.pivot.z));\r\n }\r\n\r\n m.decompose(p, q, s);\r\n\r\n // update objects\r\n if (!zeroPivot) {\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].position.copy(p);\r\n }\r\n }\r\n\r\n for (let j = 0; j < this.objects.length; ++j) {\r\n this.objects[j].quaternion.copy(q);\r\n this.objects[j].updateMatrix();\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.setObjects = function (objects) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n};\r\n\r\nObjectHandler.prototype.rotate = (function () {\r\n const rot = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n\r\n return function (quat, mousePrevPos, mouseCurPos, aboutAxis) {\r\n this.mouse2rotation(rot, mousePrevPos, mouseCurPos, aboutAxis);\r\n quat.setFromAxisAngle(rot.axis, rot.angle);\r\n\r\n if (rot.angle) {\r\n this._rotate(quat);\r\n }\r\n\r\n this.lastRotation = rot;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.translate = (function () {\r\n const dir = new THREE.Vector3();\r\n const pivot = new THREE.Vector3();\r\n\r\n return function (delta) {\r\n // reverse-project viewport movement to view coords (compensate for screen aspect ratio)\r\n dir.set(\r\n delta.x / this.camera.projectionMatrix.elements[0],\r\n delta.y / this.camera.projectionMatrix.elements[5], 0,\r\n );\r\n let dist = dir.length();\r\n dir.normalize();\r\n\r\n // transform movement direction to object local coords\r\n dir.transformDirection(matrix4.getInverse(this.object.matrixWorld));\r\n\r\n // visible translate distance shouldn't depend on camera-to-object distance\r\n pivot.copy(this.pivot);\r\n this.object.localToWorld(pivot);\r\n dist *= Math.abs(pivot.z - this.camera.position.z);\r\n\r\n // visible translate distance shouldn't depend on object scale\r\n dist /= this.object.matrixWorld.getMaxScaleOnAxis();\r\n\r\n // all objects are translated similar to principal object\r\n // (we assume they all have identical pivot and scale)\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].translateOnAxis(dir, dist);\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.update = (function () {\r\n const axis = new THREE.Vector3();\r\n\r\n return function (timeSinceLastUpdate, timeSinceMove) {\r\n if (settings.now.autoRotation !== 0.0) {\r\n // auto-rotation with constant speed\r\n\r\n // if rotation axis is fixed or hasn't been defined yet\r\n if (settings.now.autoRotationAxisFixed || this.lastRotation.axis.length() === 0.0) {\r\n // use Y-axis (transformed to local object coords)\r\n axis.set(0, 1, 0).transformDirection(matrix4.getInverse(this.object.matrixWorld));\r\n } else {\r\n // use axis defined by last user rotation\r\n axis.copy(this.lastRotation.axis);\r\n }\r\n\r\n this._rotate(quaternion.setFromAxisAngle(axis, settings.now.autoRotation * timeSinceLastUpdate));\r\n return true;\r\n }\r\n\r\n if (this.options.intertia && this.lastRotation.angle) {\r\n // inertial object rotation\r\n const angle = this.lastRotation.angle * ((1.0 - this.options.dynamicDampingFactor) ** (40.0 * timeSinceMove));\r\n\r\n if (Math.abs(angle) <= this.options.intertiaThreshold) {\r\n this.lastRotation.angle = 0.0;\r\n } else {\r\n this._rotate(quaternion.setFromAxisAngle(this.lastRotation.axis, angle));\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.stop = function () {\r\n this.lastRotation.angle = 0.0;\r\n};\r\n\r\n// calculate (axis, angle) pair from mouse/touch movement\r\nObjectHandler.prototype.mouse2rotation = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n const eye = new THREE.Vector3();\r\n const eyeDirection = new THREE.Vector3();\r\n\r\n const cameraUpDirection = new THREE.Vector3();\r\n const cameraSidewaysDirection = new THREE.Vector3();\r\n\r\n const moveDirection = new THREE.Vector3();\r\n\r\n const mouseDelta = new THREE.Vector2();\r\n\r\n return function (rot, mousePrev, mouseCur, aboutAxis) {\r\n if (aboutAxis) {\r\n rot.axis.copy(this.axis);\r\n rot.angle = this.options.axisRotateFactor * (mouseCur.y - mousePrev.y);\r\n\r\n /* cool method that allows rotation around Z axis to be \"tied\" to mouse cursor\r\n\r\n res.axis.copy(this.axis);\r\n\r\n var pivot = this.pivot.clone();\r\n this.object.localToWorld(pivot);\r\n pivot.project(this.camera);\r\n\r\n var v1 = new THREE.Vector3(mousePrev.x, mousePrev.y, this.camera.position.z);\r\n v1.sub(pivot);\r\n var v2 = new THREE.Vector3(mouseCur.x, mouseCur.y, this.camera.position.z);\r\n v2.sub(pivot);\r\n\r\n v1.sub(res.axis.clone().multiplyScalar(v1.dot(res.axis)));\r\n v2.sub(res.axis.clone().multiplyScalar(v2.dot(res.axis)));\r\n\r\n var abs = v1.length() * v2.length();\r\n if (abs > 0) {\r\n res.angle = res.axis.dot(v1.cross(v2)) / abs;\r\n }\r\n */\r\n } else {\r\n mouseDelta.subVectors(mouseCur, mousePrev);\r\n const angle = mouseDelta.length();\r\n if (angle === 0.0) {\r\n return;\r\n }\r\n\r\n center.copy(this.pivot);\r\n this.object.localToWorld(center);\r\n eye.subVectors(this.camera.position, center);\r\n eyeDirection.copy(eye).normalize();\r\n\r\n cameraUpDirection.copy(this.camera.up).normalize();\r\n cameraSidewaysDirection.crossVectors(cameraUpDirection, eyeDirection).normalize();\r\n\r\n cameraUpDirection.setLength(mouseDelta.y);\r\n cameraSidewaysDirection.setLength(mouseDelta.x);\r\n\r\n moveDirection.copy(cameraUpDirection.add(cameraSidewaysDirection));\r\n\r\n rot.axis.crossVectors(moveDirection, eye);\r\n\r\n rot.angle = -angle * this.options.rotateFactor;\r\n }\r\n\r\n rot.axis.transformDirection(matrix4.getInverse(this.object.matrixWorld));\r\n\r\n // make sure angle is always positive (thus 'axis' defines both axis and direction of rotation)\r\n if (rot.angle < 0.0) {\r\n rot.axis.negate();\r\n rot.angle = -rot.angle;\r\n }\r\n };\r\n}());\r\n\r\nfunction ObjectControls(object, objectPivot, camera, domElement, getAltObj) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.object = object;\r\n this.objectPivot = objectPivot;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.getAltObj = getAltObj;\r\n\r\n // API\r\n\r\n this.enabled = true;\r\n this.hotkeysEnabled = true;\r\n\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n\r\n this.options = {\r\n rotateFactor: Math.PI, // full screen slide (along short side) would roughly mean 180 deg. rotation\r\n axisRotateFactor: 4 * Math.PI, // full screen slide (along short side) would roughly mean 720 deg. rotation\r\n intertia: true,\r\n dynamicDampingFactor: 0.1,\r\n intertiaThreshold: 1e-3,\r\n };\r\n\r\n // internals\r\n\r\n this._state = STATE.NONE;\r\n\r\n this._mousePrevPos = new THREE.Vector2();\r\n this._mouseCurPos = new THREE.Vector2();\r\n\r\n this._mainObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._altObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._affectedObj = this._mainObj;\r\n this._isAltObjFreeRotationAllowed = true;\r\n this._isTranslationAllowed = true;\r\n this._isKeysTranslatingObj = false;\r\n\r\n this._pressedKeys = [];\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n this._lastUpdateTime = this._clock.getElapsedTime();\r\n\r\n // events\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousewheel',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'DOMMouseScroll',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseout',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchmove',\r\n handler(e) {\r\n self.touchmove(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keydown',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keyup',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'blur',\r\n handler() {\r\n self.resetKeys();\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'contextmenu',\r\n handler(e) {\r\n self.contextmenu(e);\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n\r\n this.resetKeys();\r\n\r\n // force an update at start\r\n this.update();\r\n}\r\n\r\n// methods\r\n\r\nObjectControls.prototype = Object.create(EventDispatcher.prototype);\r\nObjectControls.prototype.constructor = ObjectControls;\r\n\r\nObjectControls.prototype.resetKeys = function () {\r\n this._pressedKeys[VK_LEFT] = false;\r\n this._pressedKeys[VK_UP] = false;\r\n this._pressedKeys[VK_RIGHT] = false;\r\n this._pressedKeys[VK_DOWN] = false;\r\n};\r\n\r\nObjectControls.prototype.contextmenu = function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n};\r\n\r\nObjectControls.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nObjectControls.prototype.enable = function (enable) {\r\n this.enabled = enable;\r\n};\r\n\r\nObjectControls.prototype.enableHotkeys = function (enable) {\r\n this.hotkeysEnabled = enable;\r\n};\r\n\r\nObjectControls.prototype.allowTranslation = function (allow) {\r\n this._isTranslationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.allowAltObjFreeRotation = function (allow) {\r\n this._isAltObjFreeRotationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.keysTranslateObj = function (on) {\r\n this._isKeysTranslatingObj = on;\r\n};\r\n\r\nObjectControls.prototype.isEditingAltObj = function () {\r\n return ((this._state === STATE.ROTATE) || (this._state === STATE.TRANSLATE))\r\n && (this._affectedObj === this._altObj);\r\n};\r\n\r\n// convert page coords of mouse/touch to uniform coords with smaller side being [-0.5, 0.5]\r\n// (uniform coords keep direct proportion with screen distance travelled by mouse regardless of screen aspect ratio)\r\nObjectControls.prototype.convertMouseToOnCircle = function (coords, pageX, pageY) {\r\n const screenSize = Math.min(this.screen.width, this.screen.height);\r\n\r\n if (screenSize === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n ((pageX - this.screen.width * 0.5 - this.screen.left) / screenSize),\r\n ((0.5 * this.screen.height + this.screen.top - pageY) / screenSize),\r\n );\r\n};\r\n\r\n// convert page coords of mouse/touch to viewport coords with both sides being [-1, 1]\r\n// (those are non-uniform coords affected by screen aspect ratio)\r\nObjectControls.prototype.convertMouseToViewport = function (coords, pageX, pageY) {\r\n if (this.screen.width === 0 || this.screen.height === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n (2.0 * (pageX - this.screen.width * 0.5 - this.screen.left) / this.screen.width),\r\n (2.0 * (0.5 * this.screen.height + this.screen.top - pageY) / this.screen.height),\r\n );\r\n};\r\n\r\nObjectControls.prototype.stop = function () {\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n};\r\n\r\n// rotate object based on latest mouse/touch movement\r\nObjectControls.prototype.rotateByMouse = (function () {\r\n const quat = new THREE.Quaternion();\r\n\r\n return function (aboutZAxis) {\r\n this._affectedObj.rotate(quat, this._mousePrevPos, this._mouseCurPos, aboutZAxis);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n };\r\n}());\r\n\r\n// rotate object by specified quaternion\r\nObjectControls.prototype.rotate = function (quat) {\r\n this.object.quaternion.multiply(quat);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n};\r\n\r\n// get object's orientation\r\nObjectControls.prototype.getOrientation = function () {\r\n return this.object.quaternion;\r\n};\r\n\r\n// set object's orientation\r\nObjectControls.prototype.setOrientation = function (quat) {\r\n this.object.quaternion.copy(quat);\r\n};\r\n\r\n// translate object based on latest mouse/touch movement\r\nObjectControls.prototype.translate = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this._affectedObj.translate(delta);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n };\r\n}());\r\n\r\n// get object scale\r\nObjectControls.prototype.getScale = function () {\r\n return this.object.scale.x;\r\n};\r\n\r\n// set uniform object scale\r\nObjectControls.prototype.setScale = function (scale) {\r\n this.object.scale.set(scale, scale, scale);\r\n};\r\n\r\n// scale object by factor (factor should be greater than zero)\r\nObjectControls.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n return;\r\n }\r\n this.setScale(this.object.scale.x * factor);\r\n this.dispatchEvent({ type: 'change', action: 'zoom', factor });\r\n};\r\n\r\nObjectControls.prototype.update = (function () {\r\n const shift = new THREE.Vector2();\r\n\r\n return function () {\r\n const curTime = this._clock.getElapsedTime();\r\n const timeSinceLastUpdate = curTime - this._lastUpdateTime;\r\n\r\n // update object handler\r\n if (this._state === STATE.NONE) {\r\n const timeSinceMove = curTime - this._lastMouseMoveTime;\r\n if (this._mainObj.update(timeSinceLastUpdate, timeSinceMove)\r\n || this._altObj.update(timeSinceLastUpdate, timeSinceMove)) {\r\n this.dispatchEvent({ type: 'change', action: 'auto' });\r\n }\r\n }\r\n\r\n // apply arrow keys\r\n if (this._isKeysTranslatingObj) {\r\n const speedX = Number(this._pressedKeys[VK_RIGHT]) - Number(this._pressedKeys[VK_LEFT]);\r\n const speedY = Number(this._pressedKeys[VK_UP]) - Number(this._pressedKeys[VK_DOWN]);\r\n if (speedX !== 0.0 || speedY !== 0.0) {\r\n const delta = timeSinceLastUpdate;\r\n\r\n // update object translation\r\n const altObj = this.getAltObj();\r\n if (altObj.objects.length > 0) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n\r\n shift.set(delta * speedX, delta * speedY);\r\n this._altObj.translate(shift);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n }\r\n }\r\n }\r\n\r\n this._lastUpdateTime = curTime;\r\n };\r\n}());\r\n\r\nObjectControls.prototype.reset = function () {\r\n this._state = STATE.NONE;\r\n\r\n this.object.quaternion.copy(quaternion.set(0, 0, 0, 1));\r\n};\r\n\r\n// listeners\r\n\r\nObjectControls.prototype.mousedown = function (event) {\r\n if (this.enabled === false || this._state !== STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (this._state === STATE.NONE) {\r\n if (event.button === 0) {\r\n this._affectedObj.stop(); // can edit only one object at a time\r\n\r\n let workWithAltObj = false;\r\n\r\n if (event.altKey) {\r\n const altObj = this.getAltObj();\r\n workWithAltObj = (altObj.objects.length > 0);\r\n if (workWithAltObj) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n this._affectedObj = workWithAltObj ? this._altObj : this._mainObj;\r\n\r\n this._state = (workWithAltObj && event.ctrlKey && this._isTranslationAllowed) ? STATE.TRANSLATE : STATE.ROTATE;\r\n } else if (event.button === 2) {\r\n this._state = STATE.TRANSLATE_PIVOT;\r\n }\r\n }\r\n\r\n if (this._state === STATE.ROTATE) {\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n\r\n if (this._state === STATE.TRANSLATE || this._state === STATE.TRANSLATE_PIVOT) {\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousemove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this.rotateByMouse((event.altKey && !this._isAltObjFreeRotationAllowed) || event.shiftKey);\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.TRANSLATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translate();\r\n break;\r\n\r\n case STATE.TRANSLATE_PIVOT:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translatePivotByMouse();\r\n break;\r\n\r\n default: break;\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousewheel = function (event) {\r\n if (this.enabled === false || !settings.now.zooming || this._state !== STATE.NONE || event.shiftKey) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n let delta = 0;\r\n\r\n if (event.wheelDelta) {\r\n // WebKit / Opera / Explorer 9\r\n delta = event.wheelDelta / 40;\r\n } else if (event.detail) {\r\n // Firefox\r\n delta = -event.detail / 3;\r\n }\r\n\r\n let factor = 1.0 + delta * 0.05;\r\n factor = Math.max(factor, 0.01);\r\n this.scale(factor);\r\n};\r\n\r\nObjectControls.prototype.mouseup = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n this._state = STATE.NONE;\r\n\r\n if (this._clock.getElapsedTime() - this._lastMouseMoveTime > FULL_STOP_THRESHOLD) {\r\n this._affectedObj.stop();\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchstartend = function (event) {\r\n if (this.enabled === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (event.touches.length) {\r\n case 1:\r\n this._state = STATE.ROTATE;\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n break;\r\n\r\n case 2: {\r\n // prevent inertial rotation\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n\r\n this._state = STATE.SCALE;\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = this._touchDistanceStart = Math.sqrt(dx * dx + dy * dy);\r\n this._scaleStart = this.object.scale.x;\r\n break;\r\n }\r\n\r\n default:\r\n this._state = STATE.NONE;\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchmove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this.rotateByMouse(false);\r\n\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.SCALE:\r\n if (settings.now.zooming) {\r\n // update scale\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = Math.sqrt(dx * dx + dy * dy);\r\n const newScale = this._scaleStart * this._touchDistanceCur / this._touchDistanceStart;\r\n const factor = newScale / this.object.scale.x;\r\n this.scale(factor);\r\n }\r\n break;\r\n\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.keydownup = function (event) {\r\n if (this.enabled === false || this.hotkeysEnabled === false) {\r\n return;\r\n }\r\n\r\n switch (event.keyCode) {\r\n case VK_LEFT:\r\n case VK_UP:\r\n case VK_RIGHT:\r\n case VK_DOWN:\r\n this._pressedKeys[event.keyCode] = (event.type === 'keydown');\r\n event.preventDefault();\r\n event.stopPropagation();\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.getKeyBindObject = function () {\r\n return window.top;\r\n};\r\n\r\n\r\nObjectControls.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nObjectControls.prototype.translatePivotByMouse = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this.translatePivotInWorld(settings.now.translationSpeed * delta.x, settings.now.translationSpeed * delta.y, 0);\r\n };\r\n}());\r\n\r\n// Translate in WorldCS, translation is scaled with root scale matrix\r\nObjectControls.prototype.translatePivotInWorld = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.applyMatrix4(this.object.matrixWorld);\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n pos.applyMatrix4(matrix4.getInverse(this.object.matrixWorld));\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Translate in ModelCS, x, y, z are Ang\r\nObjectControls.prototype.translatePivot = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Set pivot\r\nObjectControls.prototype.setPivot = function (newPivot) {\r\n this.objectPivot.position.copy(newPivot);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\nexport default ObjectControls;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\nimport Timer from '../Timer';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\n\r\nfunction Picker(gfxObj, camera, domElement) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.gfxObj = gfxObj;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n this._lastMousePos = new THREE.Vector2(0, 0);\r\n this._mouseTotalDist = 0.0;\r\n this._lastClickBeginTime = -1000.0;\r\n this._lastClickPos = new THREE.Vector2(0, 0);\r\n this._clickBeginTime = 0.0;\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstart(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchend(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n}\r\n\r\nPicker.prototype = Object.create(EventDispatcher.prototype);\r\nPicker.prototype.constructor = Picker;\r\n\r\nPicker.prototype.reset = function () {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n};\r\n\r\nPicker.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nPicker.prototype.pickObject = function (screenPos) {\r\n if (!this.gfxObj) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n const { gfxObj } = this;\r\n const rayCaster = new THREE.Raycaster();\r\n rayCaster.ray.origin.setFromMatrixPosition(this.camera.matrixWorld);\r\n rayCaster.ray.direction.set(screenPos.x, screenPos.y, 0.5).unproject(this.camera).sub(rayCaster.ray.origin).normalize();\r\n\r\n const clipPlane = (settings.now.draft.clipPlane && this.clipPlaneValue) ? this.clipPlaneValue : Infinity;\r\n const fogFarPlane = (settings.now.fog && this.fogFarValue) ? this.fogFarValue : Infinity;\r\n const point = rayCaster.intersectVisibleObject(gfxObj, this.camera, clipPlane, fogFarPlane);\r\n if (!point) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n let picked = {};\r\n if (point.residue || point.atom) {\r\n const residue = point.residue || point.atom.residue;\r\n if (settings.now.pick === 'chain') {\r\n picked = { chain: residue.getChain() };\r\n } else if (settings.now.pick === 'molecule') {\r\n picked = { molecule: residue.getMolecule() };\r\n } else if (point.residue || settings.now.pick === 'residue') {\r\n picked = { residue };\r\n } else if (point.atom) {\r\n picked = { atom: point.atom };\r\n }\r\n }\r\n this.picked = picked;\r\n this.dispatchEvent({ type: 'newpick', obj: picked });\r\n};\r\n\r\nPicker.prototype.getMouseInViewport = function (pageX, pageY) {\r\n return new THREE.Vector2(\r\n (pageX - this.screen.left) / this.screen.width * 2 - 1,\r\n -(pageY - this.screen.top) / this.screen.height * 2 + 1,\r\n );\r\n};\r\n\r\nPicker.prototype.mousedown = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n this._lastMousePos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist = 0.0;\r\n this._clickBeginTime = this._clock.getElapsedTime();\r\n }\r\n};\r\n\r\nPicker.prototype.mousemove = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n const pos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist += pos.sub(this._lastMousePos).length();\r\n};\r\n\r\nPicker.prototype.mouseup = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n if (this._mouseTotalDist < 0.01) {\r\n const curTime = this._clock.getElapsedTime();\r\n const curPos = this.getMouseInViewport(event.pageX, event.pageY);\r\n\r\n const timeSinceLastClickBegin = curTime - this._lastClickBeginTime;\r\n if (timeSinceLastClickBegin < 0.7) {\r\n const clickDist = new THREE.Vector2().subVectors(curPos, this._lastClickPos);\r\n if (clickDist.length() < 0.01) {\r\n // it's a double click\r\n this.dispatchEvent({ type: 'dblclick', obj: this.picked });\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = -1000; // this click cannot serve as first click in double-click\r\n return;\r\n }\r\n }\r\n\r\n setTimeout(() => {\r\n self.pickObject(curPos);\r\n }, 0);\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = this._clickBeginTime;\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.touchstart = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 1) {\r\n this._lastTouchdownPos = this.getMouseInViewport(event.touches[0].pageX, event.touches[0].pageY);\r\n }\r\n};\r\n\r\nPicker.prototype.touchend = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 0\r\n && event.changedTouches.length === 1) {\r\n const pos = this.getMouseInViewport(event.changedTouches[0].pageX, event.changedTouches[0].pageY);\r\n const dist = pos.sub(this._lastTouchdownPos).length();\r\n if (dist < 0.01) {\r\n setTimeout(() => {\r\n self.pickObject(self._lastTouchdownPos);\r\n }, 0);\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nexport default Picker;\r\n","import * as THREE from 'three';\r\n\r\nclass Axes {\r\n constructor(target, targetCamera) {\r\n this._target = target;\r\n this._targetCamera = targetCamera;\r\n this._camera = new THREE.PerspectiveCamera(targetCamera.fov, targetCamera.aspect, 1, 100);\r\n this._object = new THREE.AxesHelper(1);\r\n this._scene = new THREE.Scene();\r\n this._scene.add(this._object);\r\n this._full = new THREE.Vector2();\r\n\r\n this._update();\r\n }\r\n\r\n _update() {\r\n const { fov } = this._targetCamera;\r\n const camera = this._camera;\r\n camera.aspect = this._targetCamera.aspect;\r\n camera.setMinimalFov(fov);\r\n camera.setDistanceToFit(1.0, fov);\r\n camera.updateProjectionMatrix();\r\n\r\n this._object.quaternion.copy(this._target.quaternion);\r\n }\r\n\r\n render(renderer) {\r\n this._update();\r\n\r\n renderer.getSize(this._full);\r\n const width = this._full.width * 0.25;\r\n const height = this._full.height * 0.25;\r\n\r\n const { autoClear } = renderer;\r\n renderer.autoClear = false;\r\n renderer.setViewport(0.0, 0.0, width, height);\r\n renderer.clear(false, true, false);\r\n renderer.render(this._scene, this._camera);\r\n renderer.setViewport(0, 0, this._full.width, this._full.height);\r\n renderer.autoClear = autoClear;\r\n }\r\n}\r\nexport default Axes;\r\n","import * as THREE from 'three';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\n\r\nconst cDataOffset = 12;\r\nconst cFirstMask = 0x0FFFFF00;\r\nconst cFirstShift = 8;\r\nconst cSecMask1 = 0x000000FF;\r\nconst cSecShift1 = 12;\r\nconst cSecMask2 = 0xFFF00000;\r\nconst cSecShift2 = 20;\r\nconst cThirdMask = 0x000FFFFF;\r\nconst cStrMask = 0xF0000000;\r\nconst cStrShift = 28;\r\nconst c219 = 1 << 19;\r\nconst c220 = 1 << 20;\r\n\r\nconst cHelixIdx = 1;\r\nconst cSheetIdx = 2;\r\nconst secTypes = ['helix', 'strand'];\r\nconst cSecNames = ['fs', 'ps', 'ns', 'us'];\r\n\r\nfunction _createSecondary(strArray, complex) {\r\n const residues = complex._residues;\r\n const nRes = residues.length;\r\n const resid = new Uint8Array(nRes);\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, n = strArray.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n resid[atom.residue._index] = strArray[i];\r\n }\r\n\r\n const secondary = [];\r\n let rIdx = 0;\r\n while (rIdx < nRes) {\r\n if (resid[rIdx] !== 0) {\r\n const start = rIdx;\r\n const val = resid[rIdx];\r\n while (rIdx < nRes - 1 && resid[rIdx + 1] === val\r\n && residues[rIdx].isConnected(residues[rIdx + 1])) {\r\n ++rIdx;\r\n }\r\n secondary.push({ start, end: rIdx, type: secTypes[val - 1] });\r\n }\r\n ++rIdx;\r\n }\r\n return secondary;\r\n}\r\n\r\nfunction fromUInt20ToInt20(uint20) {\r\n return uint20 >= c219 ? uint20 - c220 : uint20;\r\n}\r\n\r\nclass FrameInfo {\r\n constructor(complex, payload, callbacks) {\r\n this._complex = complex;\r\n this._secondary = null;\r\n this.isLoading = false;\r\n this._framesRange = {\r\n start: 0,\r\n end: -1,\r\n };\r\n this.frameIsReady = false;\r\n this._buffer = null;\r\n this._frameRequest = null;\r\n this._callbacks = callbacks;\r\n if (typeof payload === 'function') {\r\n this._framesRequestLength = 1;\r\n this._downloadDataFn = payload;\r\n } else {\r\n this.parseBinaryData(payload, true);\r\n }\r\n this.reset();\r\n this.setFrame(0);\r\n }\r\n\r\n _prepareBuffer(framesStart, framesEnd) {\r\n if (framesStart === undefined || framesStart === null) {\r\n framesStart = 0;\r\n }\r\n if (framesEnd === undefined || framesEnd === null) {\r\n framesEnd = framesStart + this._framesRequestLength;\r\n }\r\n if (this._framesCount !== undefined) {\r\n framesEnd = Math.min(this._framesCount - 1, framesEnd);\r\n }\r\n if (this._downloadDataFn) {\r\n const self = this;\r\n const onDone = function (data) {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n self._buffer = {\r\n data,\r\n state: 'ready',\r\n start: framesStart,\r\n end: framesEnd,\r\n };\r\n if (self._frameRequest !== null) {\r\n const idx = self._frameRequest;\r\n self._frameRequest = null;\r\n self.setFrame(idx);\r\n }\r\n };\r\n const onFail = function () {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onError === 'function') {\r\n self._callbacks.onError('Streaming failed');\r\n }\r\n };\r\n if (!this._buffer) {\r\n this._buffer = {};\r\n }\r\n this._buffer.state = 'downloading';\r\n this.isLoading = true;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n this._downloadDataFn({ start: framesStart, end: framesEnd + 1 }, onDone, onFail);\r\n }\r\n }\r\n\r\n _parseBuffer() {\r\n if (this._buffer && this._buffer.state === 'ready') {\r\n this._framesRange = {\r\n start: this._buffer.start,\r\n end: this._buffer.end,\r\n };\r\n this.parseBinaryData(this._buffer.data, false);\r\n let _bufferRequestStart = (this._buffer.end + 1) % this._framesCount;\r\n if (_bufferRequestStart >= this._framesCount) {\r\n _bufferRequestStart = 0;\r\n }\r\n this._buffer = {\r\n state: 'none',\r\n };\r\n this._prepareBuffer(_bufferRequestStart, _bufferRequestStart + this._framesRequestLength);\r\n if (this._frameRequest !== null) {\r\n const idx = this._frameRequest;\r\n this._frameRequest = null;\r\n this.setFrame(idx);\r\n }\r\n }\r\n }\r\n\r\n parseBinaryData(arrayBuffer) {\r\n const dataView = new DataView(arrayBuffer);\r\n let offset = 0;\r\n const atomsCount = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const framesCount = dataView.getUint32(offset, true);\r\n this._framesCount = framesCount;\r\n this._framesRange.end = this._framesRange.end > 0\r\n ? Math.min(this._framesRange.end, framesCount - 1) : framesCount - 1;\r\n offset += 4;\r\n this._atomsCount = atomsCount;\r\n const maxSize = 1024 * 1024; // 1 MB\r\n this._framesRequestLength = Math.ceil(maxSize / (atomsCount * 8));\r\n const chunkedFramesCount = this._framesRange.end - this._framesRange.start + 1;\r\n if (atomsCount !== this._complex._atoms.length\r\n || arrayBuffer.byteLength !== cDataOffset + chunkedFramesCount * atomsCount * 8) {\r\n throw new Error();\r\n }\r\n const complex = this._complex;\r\n let timeStep = dataView.getUint32(offset, true);\r\n let iName = 0;\r\n while (timeStep > 1000 && iName < cSecNames.length - 1) {\r\n timeStep /= 1000;\r\n ++iName;\r\n }\r\n\r\n this._timeStep = `${timeStep.toString()} ${cSecNames[iName]}`;\r\n offset += 4;\r\n const secondary = [];\r\n const posData = new Float32Array(chunkedFramesCount * atomsCount * 3);\r\n let coordIdx = 0;\r\n const secondaryArr = new Int8Array(atomsCount);\r\n for (let j = 0; j < chunkedFramesCount; ++j) {\r\n for (let i = 0; i < atomsCount; ++i) {\r\n const hiWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const loWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const str = (loWord & cStrMask) >>> cStrShift;\r\n const x = fromUInt20ToInt20(((loWord & cFirstMask) >>> cFirstShift) >> 0);\r\n const y = fromUInt20ToInt20((((loWord & cSecMask1) << cSecShift1)\r\n | ((hiWord & cSecMask2) >>> cSecShift2)) >> 0);\r\n const z = fromUInt20ToInt20((hiWord & cThirdMask) >> 0);\r\n secondaryArr[i] = 0;\r\n if (str > 0 && str < 4) {\r\n secondaryArr[i] = cHelixIdx;\r\n } else if (str === 4) {\r\n secondaryArr[i] = cSheetIdx;\r\n }\r\n posData[coordIdx++] = x / 100;\r\n posData[coordIdx++] = y / 100;\r\n posData[coordIdx++] = z / 100;\r\n }\r\n secondary.push(_createSecondary(secondaryArr, complex));\r\n }\r\n this._secondaryData = secondary;\r\n this._data = posData;\r\n }\r\n\r\n nextFrame() {\r\n this.setFrame((this._currFrame + 1) % this._framesCount);\r\n }\r\n\r\n needsColorUpdate(colorer) {\r\n return colorer instanceof SecondaryStructureColorer;\r\n }\r\n\r\n getAtomColor(colorer, atom) {\r\n return colorer.getResidueColor(this._residues[atom.residue._index], this._complex);\r\n }\r\n\r\n getResidueColor(colorer, residue) {\r\n return colorer.getResidueColor(this._residues[residue._index], this._complex);\r\n }\r\n\r\n _updateSecondary() {\r\n let i;\r\n const myResidues = this._residues;\r\n let n = myResidues.length;\r\n for (i = 0; i < n; ++i) {\r\n myResidues[i]._secondary = null;\r\n }\r\n const sec = this._secondaryData[this._currFrame - this._framesRange.start];\r\n for (i = 0, n = sec.length; i < n; ++i) {\r\n const oldSec = sec[i];\r\n const { start, end } = oldSec;\r\n const nSec = {\r\n _start: myResidues[start],\r\n _end: myResidues[end],\r\n type: oldSec.type,\r\n generic: oldSec.generic,\r\n };\r\n for (let j = start; j <= end; ++j) {\r\n myResidues[j]._secondary = nSec;\r\n }\r\n }\r\n }\r\n\r\n reset() {\r\n const compRes = this._complex._residues;\r\n const n = compRes.length;\r\n this._residues = new Array(n);\r\n const myResidues = this._residues;\r\n const getSec = function () {\r\n return this._secondary;\r\n };\r\n for (let i = 0; i < n; ++i) {\r\n myResidues[i] = {\r\n _type: compRes[i]._type,\r\n _isValid: compRes[i]._isValid,\r\n _controlPoint: null,\r\n _wingVector: null,\r\n _secondary: null,\r\n getSecondary: getSec,\r\n };\r\n }\r\n }\r\n\r\n setFrame(frameIdx) {\r\n this.frameIsReady = false;\r\n if (frameIdx >= this._framesRange.start && frameIdx <= this._framesRange.end) {\r\n this._currFrame = frameIdx;\r\n this._cachedResidues = false;\r\n this._updateSecondary();\r\n this.frameIsReady = true;\r\n } else {\r\n this._frameRequest = frameIdx;\r\n if (!this._buffer) {\r\n this._prepareBuffer(frameIdx);\r\n } else {\r\n const self = this;\r\n switch (this._buffer.state) {\r\n case 'none':\r\n this._prepareBuffer(frameIdx);\r\n break;\r\n case 'ready':\r\n self._parseBuffer();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n disableEvents() {\r\n this._callbacks = null;\r\n }\r\n\r\n /**\r\n * Returns link to atom pos vector, clone it if needed\r\n */\r\n\r\n static _vec = new THREE.Vector3();\r\n\r\n getAtomPos(atomIdx) {\r\n const vec = FrameInfo._vec;\r\n const self = this;\r\n const data = self._data;\r\n const idx = (self._atomsCount * (self._currFrame - self._framesRange.start) + atomIdx) * 3;\r\n vec.set(data[idx], data[idx + 1], data[idx + 2]);\r\n return vec;\r\n }\r\n\r\n\r\n getResidues() {\r\n if (this._cachedResidues) {\r\n return this._residues;\r\n }\r\n this._complex.updateToFrame(this);\r\n return this._residues;\r\n }\r\n}\r\nexport default FrameInfo;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\n\r\n/**\r\n * Create new scene object.\r\n *\r\n * @param {array=} params - Object required params.\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports SceneObject\r\n * @this SceneObject\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all scene objects that are not reps.\r\n */\r\nclass SceneObject {\r\n constructor(params, opts) {\r\n if (this.constructor === SceneObject) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Object's options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.params = params;\r\n this.opts = _.merge(utils.deriveDeep(settings.now.objects[this.type], true), opts);\r\n this.needsRebuild = false;\r\n this._mesh = null;\r\n this.id = null;\r\n }\r\n\r\n /**\r\n * Get object identification, probably with options.\r\n * @returns {Object} field type contains type information, params - object's formal parameters,\r\n * opts - changed options\r\n * Options are returned if they were changed during or after object creation.\r\n */\r\n identify() {\r\n const result = {\r\n type: this.type,\r\n params: this.params,\r\n };\r\n const diff = utils.objectsDiff(this.opts, settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n result.opts = diff;\r\n }\r\n return result;\r\n }\r\n\r\n toString() {\r\n const paramsStr = `o=${this.type},${this.params.join(',')}`;\r\n const optsStr = utils.compareOptionsWithDefaults(this.opts, settings.defaults.objects[this.type]);\r\n return paramsStr + optsStr;\r\n }\r\n\r\n getGeometry() {\r\n return this._mesh;\r\n }\r\n\r\n destroy() {\r\n if (this._mesh) {\r\n gfxutils.destroyObject(this._mesh);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Scene object identifier.\r\n * @type {string}\r\n */\r\nSceneObject.prototype.type = '__';\r\n\r\nexport default SceneObject;\r\n","import * as THREE from 'three';\r\nimport SceneObject from './SceneObject';\r\nimport gfxutils from '../gfxutils';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\nimport meshes from '../meshes/meshes';\r\nimport settings from '../../settings';\r\n\r\nclass LinesObj extends SceneObject {\r\n constructor(params, opts) {\r\n super(params, opts);\r\n if (params.length < 2) {\r\n throw new Error('Wrong number of argumets on line object creation!');\r\n }\r\n [this._id1, this._id2] = params;\r\n }\r\n\r\n _getAtomFromName(complex, atomId) {\r\n const err = ' - Wrong atom format it must be \\'#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME\\' (e.g. \\'A.38.CO1\\')';\r\n const atom1 = complex.getAtomByFullname(atomId);\r\n if (!atom1) {\r\n throw new Error(atomId + err);\r\n }\r\n return atom1;\r\n }\r\n\r\n build(complex) {\r\n const geom = new THREE.Geometry();\r\n this._atom1 = this._getAtomFromName(complex, this._id1);\r\n this._atom2 = this._getAtomFromName(complex, this._id2);\r\n\r\n geom.vertices[0] = this._atom1.position.clone();\r\n geom.vertices[1] = this._atom2.position.clone();\r\n geom.dynamic = true;\r\n geom.computeBoundingBox();\r\n\r\n this._line = new meshes.Line(geom, new UberMaterial({\r\n lights: false,\r\n overrideColor: true,\r\n dashedLine: true,\r\n fogTransparent: settings.now.bg.transparent,\r\n }));\r\n this._line.computeLineDistances();\r\n this._line.material.setUberOptions({\r\n fixedColor: new THREE.Color(this.opts.color),\r\n dashedLineSize: this.opts.dashSize,\r\n dashedLinePeriod: this.opts.dashSize + this.opts.gapSize,\r\n });\r\n this._line.material.updateUniforms();\r\n\r\n this._line.raycast = function (_raycaster, _intersects) {};\r\n this._mesh = this._line;\r\n const transforms = complex.getTransforms();\r\n if (transforms.length > 0) {\r\n this._mesh = new THREE.Group();\r\n this._mesh.add(this._line);\r\n gfxutils.applyTransformsToMeshes(this._mesh, transforms);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n if (!this._atom1 || !this._atom2 || !this._line) {\r\n return;\r\n }\r\n\r\n const geo = this._line.geometry;\r\n geo.vertices[0].copy(frameData.getAtomPos(this._atom1.index));\r\n geo.vertices[1].copy(frameData.getAtomPos(this._atom2.index));\r\n this._line.computeLineDistances();\r\n geo.computeBoundingSphere();\r\n\r\n geo.verticesNeedUpdate = true;\r\n }\r\n}\r\n\r\nLinesObj.prototype.constructor = LinesObj;\r\nLinesObj.prototype.type = 'line';\r\n\r\nexport default LinesObj;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Outline.frag';\r\n\r\nclass OutlineMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n // add depth outline\r\n super(params);\r\n\r\n const settings = {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcDepthTex: { type: 't', value: null },\r\n srcTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n color: { type: 'v3', value: null },\r\n threshold: { type: 'f', value: null },\r\n opacity: { type: 'f', value: 1.0 },\r\n thickness: { type: 'v2', value: new THREE.Vector2(1, 1) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: true,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n\r\n this.setValues(settings);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n const defines = {};\r\n\r\n if (this.depth) {\r\n defines.DEPTH_OUTLINE = 1;\r\n }\r\n\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nOutlineMaterial.prototype.depth = false;\r\n\r\nexport default OutlineMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './FXAA.frag';\r\n\r\nclass FXAAMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n bgColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.bgTransparent) {\r\n defines.BG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nFXAAMaterial.prototype.bgTransparent = false;\r\n\r\nexport default FXAAMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AO.frag';\r\nimport noise from '../noiseTexture';\r\n\r\nconst _samplesKernel = [\r\n // hemisphere samples adopted to sphere\r\n new THREE.Vector3(0.295184, 0.077723, 0.068429),\r\n new THREE.Vector3(-0.271976, -0.365221, 0.838363),\r\n new THREE.Vector3(0.547713, 0.467576, 0.488515),\r\n new THREE.Vector3(0.662808, -0.031733, 0.584758),\r\n new THREE.Vector3(-0.025717, 0.218955, 0.657094),\r\n new THREE.Vector3(-0.310153, -0.365223, 0.370701),\r\n new THREE.Vector3(-0.101407, -0.006313, 0.747665),\r\n new THREE.Vector3(-0.769138, 0.360399, 0.086847),\r\n new THREE.Vector3(-0.271988, -0.275140, 0.905353),\r\n new THREE.Vector3(0.096740, -0.566901, 0.700151),\r\n new THREE.Vector3(0.562872, -0.735136, 0.094647),\r\n new THREE.Vector3(0.379877, 0.359278, 0.190061),\r\n new THREE.Vector3(0.519064, -0.023055, 0.405068),\r\n new THREE.Vector3(-0.301036, 0.114696, 0.088885),\r\n new THREE.Vector3(-0.282922, 0.598305, 0.487214),\r\n new THREE.Vector3(-0.181859, 0.251670, 0.679702),\r\n new THREE.Vector3(-0.191463, -0.635818, 0.512919),\r\n new THREE.Vector3(-0.293655, 0.427423, 0.078921),\r\n new THREE.Vector3(-0.267983, 0.680534, 0.132880),\r\n new THREE.Vector3(0.139611, 0.319637, 0.477439),\r\n new THREE.Vector3(-0.352086, 0.311040, 0.653913),\r\n new THREE.Vector3(0.321032, 0.805279, 0.487345),\r\n new THREE.Vector3(0.073516, 0.820734, 0.414183),\r\n new THREE.Vector3(-0.155324, 0.589983, 0.411460),\r\n new THREE.Vector3(0.335976, 0.170782, 0.527627),\r\n new THREE.Vector3(0.463460, -0.355658, 0.167689),\r\n new THREE.Vector3(0.222654, 0.596550, 0.769406),\r\n new THREE.Vector3(0.922138, -0.042070, 0.147555),\r\n new THREE.Vector3(-0.727050, -0.329192, 0.369826),\r\n new THREE.Vector3(-0.090731, 0.533820, 0.463767),\r\n new THREE.Vector3(-0.323457, -0.876559, 0.238524),\r\n new THREE.Vector3(-0.663277, -0.372384, 0.342856),\r\n];\r\n\r\nclass AOMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n noiseTexture: { type: 't', value: noise.noiseTexture },\r\n noiseTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight) },\r\n diffuseTexture: { type: 't', value: null },\r\n normalTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n camNearFar: { type: 'v2', value: new THREE.Vector2(1.0, 10.0) },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n samplesKernel: { type: 'v3v', value: _samplesKernel },\r\n kernelRadius: { type: 'f', value: 1.0 },\r\n depthThreshold: { type: 'f', value: 1.0 },\r\n factor: { type: 'f', value: 1.0 },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOHorBlur.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOHorBlurMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOHorBlurMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOVertBlurWithBlend.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOVertBlurWithBlendMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n diffuseTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n fogNearFar: { type: 'v2', value: new THREE.Vector2(100.0, 100.0) },\r\n fogColor: { type: 'v4', value: new THREE.Vector4(0.0, 0.5, 0.0, 1.0) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.useFog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nAOVertBlurWithBlendMaterial.prototype.useFog = true;\r\nAOVertBlurWithBlendMaterial.prototype.fogTransparent = false;\r\n\r\nexport default AOVertBlurWithBlendMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Anaglyph.frag';\r\n\r\nclass AnaglyphMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n const settings = {\r\n uniforms: {\r\n srcL: { type: 't', value: null },\r\n srcR: { type: 't', value: null },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n this.setValues(settings);\r\n }\r\n}\r\n\r\nexport default AnaglyphMaterial;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\n\r\nclass View {\r\n constructor() {\r\n this.position = new THREE.Vector3(0, 0, 0);\r\n this.scale = 1;\r\n this.orientation = new THREE.Quaternion(0, 0, 0, 1);\r\n }\r\n\r\n set(position, scale, orientation) {\r\n this.position = position;\r\n this.scale = scale;\r\n this.orientation = orientation;\r\n }\r\n}\r\n\r\nconst _transitionTime = 1.5; // in seconds\r\n\r\nexport default class ViewInterpolator {\r\n setup(startView, endView) {\r\n this._startTime = undefined;\r\n this._endTime = undefined;\r\n this._isPaused = false;\r\n\r\n this._srcView = startView;\r\n this._dstView = endView;\r\n this._isMoving = false;\r\n }\r\n\r\n isMoving() {\r\n return this._isMoving;\r\n }\r\n\r\n wasStarted() {\r\n return typeof this._startTime !== 'undefined' && typeof this._endTime !== 'undefined';\r\n }\r\n\r\n start() {\r\n this._startTime = Date.now();\r\n const transTime = settings.now.interpolateViews ? _transitionTime * 1000 : 0;\r\n this._endTime = this._startTime + transTime;\r\n this._isMoving = true;\r\n }\r\n\r\n getCurrentView() {\r\n if (typeof this._srcView === 'undefined' || typeof this._dstView === 'undefined'\r\n || !this._isMoving || !this.wasStarted()) {\r\n return { success: false };\r\n }\r\n\r\n let view = this.createView();\r\n const time = Date.now();\r\n if (time > this._endTime) {\r\n view = this._dstView;\r\n this.reset();\r\n return { success: true, view };\r\n }\r\n\r\n const factor = (time - this._startTime) / (this._endTime - this._startTime);\r\n view.position.copy(this._srcView.position);\r\n view.position.lerp(this._dstView.position, factor);\r\n view.scale = (1 - factor) * this._srcView.scale + factor * this._dstView.scale;\r\n view.orientation.copy(this._srcView.orientation);\r\n view.orientation.slerp(this._dstView.orientation, factor);\r\n return { success: true, view };\r\n }\r\n\r\n reset() {\r\n this._startTime = this._endTime = 0;\r\n this._isMoving = false;\r\n }\r\n\r\n pause() {\r\n if (!this._isPaused) {\r\n this.setup(this.getCurrentView().view, this._dstView);\r\n this._isPaused = true;\r\n }\r\n }\r\n\r\n resume() {\r\n this._isPaused = false;\r\n }\r\n\r\n createView() {\r\n return new View();\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport makeContextDependent from './makeContextDependent';\r\n\r\nconst MAX_COOKIE_LEN = 4000;\r\nconst COUNT_SUFFIX = 'Cnt';\r\n\r\nfunction _chunkString(string, chunkLen) {\r\n const l = string.length;\r\n const chunks = [];\r\n for (let c = 0, lc = 0; lc < l; c++, lc += chunkLen) {\r\n chunks[c] = string.slice(lc, lc + chunkLen);\r\n }\r\n return chunks;\r\n}\r\n\r\n/**\r\n * Create new context dependent Cookie holder object.\r\n * @param context\r\n * @param {Object} opts - options\r\n * @param {string} opts.path - cookie path\r\n * @constructor\r\n */\r\nfunction Cookies(context, opts) {\r\n this.context = context;\r\n this._opts = _.merge({\r\n path: '/',\r\n }, opts);\r\n}\r\n\r\nmakeContextDependent(Cookies.prototype);\r\n\r\n/**\r\n * Remove cookie by the name.\r\n * @param key\r\n */\r\nCookies.prototype.removeCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n this._removeSimpleCookie(key);\r\n return;\r\n }\r\n this._removeSimpleCookie(cntKey);\r\n cntVal = parseInt(cntVal, 10);\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._removeSimpleCookie(key + i);\r\n }\r\n};\r\n\r\n/**\r\n * Set new cookie value. Automatically splits\r\n * values that are too large into multiple cookies.\r\n * @param key\r\n * @param value\r\n */\r\nCookies.prototype.setCookie = function (key, value) {\r\n this.removeCookie(key);\r\n value = encodeURIComponent(value);\r\n const values = _chunkString(value, MAX_COOKIE_LEN - key.length - 1);\r\n const cntVal = values.length;\r\n if (cntVal === 1) {\r\n this._setSimpleCookie(key, value);\r\n return;\r\n }\r\n const cntKey = this._toCount(key);\r\n this._setSimpleCookie(cntKey, cntVal.toString());\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._setSimpleCookie(key + i, values[i]);\r\n }\r\n};\r\n\r\n/**\r\n * Obtain the value of a compound cookie.\r\n * @param key\r\n */\r\nCookies.prototype.getCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n return this._getSimpleCookie(key);\r\n }\r\n cntVal = parseInt(cntVal, 10);\r\n const value = [];\r\n for (let i = 0; i < cntVal; ++i) {\r\n value[i] = this._getSimpleCookie(key + i);\r\n }\r\n return value.join('');\r\n};\r\n\r\nCookies.prototype._toCount = function (key) {\r\n return key + COUNT_SUFFIX;\r\n};\r\n\r\nCookies.prototype._removeSimpleCookie = function (key) {\r\n document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\r\n};\r\n\r\nCookies.prototype._getExpirationDate = function () {\r\n const today = new Date();\r\n const EXP_PERIOD_YEARS = 10;\r\n today.setFullYear(today.getFullYear() + EXP_PERIOD_YEARS);\r\n return today;\r\n};\r\n\r\nCookies.prototype._setSimpleCookie = function (key, value) {\r\n document.cookie = `${key}=${value\r\n };expires=${this._getExpirationDate().toUTCString()\r\n };path=${this._opts.path}`;\r\n};\r\n\r\nCookies.prototype._getSimpleCookie = function (key) {\r\n const matches = document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n return matches ? decodeURIComponent(matches[1]) : '';\r\n};\r\n\r\nCookies.prototype._exists = function (key) {\r\n return document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n};\r\n\r\nexport default Cookies;\r\n","/*\r\n * Toggling WebVR is done through button.click because of limitations on calling requestPresent in webVR:\r\n * VRDisplay::requestPresent should be called from user gesture:\r\n * https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestPresent\r\n */\r\nexport default function (webVRPoC) {\r\n function showEnterVR(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'pointer';\r\n button.style.left = 'calc(50% - 50px)';\r\n button.style.width = '100px';\r\n\r\n button.textContent = 'ENTER VR';\r\n\r\n let currentSession = null;\r\n\r\n function onSessionEnded(/* event */) {\r\n currentSession.removeEventListener('end', onSessionEnded);\r\n button.textContent = 'ENTER VR';\r\n currentSession = null;\r\n }\r\n\r\n function onSessionStarted(session) {\r\n session.addEventListener('end', onSessionEnded);\r\n webVRPoC._gfx.renderer.xr.setReferenceSpaceType('local');\r\n webVRPoC._gfx.renderer.xr.setSession(session);\r\n button.textContent = 'EXIT VR';\r\n currentSession = session;\r\n }\r\n\r\n button.onmouseenter = function () { button.style.opacity = '1.0'; };\r\n button.onmouseleave = function () { button.style.opacity = '0.5'; };\r\n\r\n button.onclick = function () {\r\n if (currentSession === null) {\r\n // WebXR's requestReferenceSpace only works if the corresponding feature\r\n // was requested at session creation time. For simplicity, just ask for\r\n // the interesting ones as optional features, but be aware that the\r\n // requestReferenceSpace call will fail if it turns out to be unavailable.\r\n // ('local' is always available for immersive sessions and doesn't need to\r\n // be requested separately.)\r\n\r\n const sessionInit = { optionalFeatures: ['local-floor', 'bounded-floor'] };\r\n navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted);\r\n webVRPoC.moveSceneBehindHeadset();\r\n } else {\r\n currentSession.end();\r\n }\r\n };\r\n }\r\n\r\n function showWebXRNotFound(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'auto';\r\n button.style.left = 'calc(50% - 75px)';\r\n button.style.width = '150px';\r\n button.textContent = 'VR NOT FOUND';\r\n button.onmouseenter = null;\r\n button.onmouseleave = null;\r\n button.onclick = null;\r\n }\r\n\r\n function stylizeElement(element) {\r\n element.style.position = 'absolute';\r\n element.style.bottom = '20px';\r\n element.style.padding = '12px 6px';\r\n element.style.border = '1px solid #fff';\r\n element.style.borderRadius = '4px';\r\n element.style.background = 'transparent';\r\n element.style.color = '#fff';\r\n element.style.font = 'normal 13px sans-serif';\r\n element.style.textAlign = 'center';\r\n element.style.opacity = '0.5';\r\n element.style.outline = 'none';\r\n element.style.zIndex = '999';\r\n }\r\n\r\n if ('xr' in navigator) {\r\n const button = document.createElement('button');\r\n button.style.display = 'none';\r\n stylizeElement(button);\r\n navigator.xr.isSessionSupported('immersive-vr').then((supported) => (\r\n supported ? showEnterVR(button) : showWebXRNotFound(button)\r\n ));\r\n return button;\r\n }\r\n const message = document.createElement('a');\r\n message.href = 'https://webvr.info';\r\n message.innerHTML = 'WEBXR NOT SUPPORTED';\r\n message.style.left = 'calc(50% - 90px)';\r\n message.style.width = '180px';\r\n message.style.textDecoration = 'none';\r\n stylizeElement(message);\r\n return message;\r\n}\r\n","import * as THREE from 'three';\r\nimport createWebVRButton from './createWebVRButton';\r\nimport gfxutils from '../gfxutils';\r\nimport logger from '../../utils/logger';\r\nimport settings from '../../settings';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default class WebVRPoC {\r\n constructor(onToggle) {\r\n this._mainCamera = new THREE.PerspectiveCamera();\r\n this._button = null;\r\n this._onToggle = onToggle;\r\n\r\n this._molContainer = new gfxutils.RCGroup();\r\n this._user = new gfxutils.RCGroup();\r\n this._scalingPivot = new THREE.Object3D();\r\n this._user.add(this._scalingPivot);\r\n\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n this._pressedGripsCounter = 0;\r\n this._distance = 0;\r\n\r\n this._gfx = null;\r\n }\r\n\r\n startScalingByControllers() {\r\n // reset scale\r\n this._distance = this._controller1.position.distanceTo(this._controller2.position);\r\n gfxutils.getMiddlePoint(this._controller1.position, this._controller2.position, this._scalingPivot.position);\r\n this._scalingPivot.scale.set(1, 1, 1);\r\n this._scalingPivot.updateMatrix();\r\n this._scalingPivot.updateMatrixWorld();\r\n // link molecule to pivot\r\n this._scalingPivot.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n stopScalingByControllers() {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n handleGripsDown(event) {\r\n this._pressedGripsCounter++;\r\n if (this._pressedGripsCounter === 2) {\r\n this.startScalingByControllers();\r\n } else if (this._pressedGripsCounter === 1) {\r\n event.target.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n handleGripsUp(event) {\r\n this._pressedGripsCounter--;\r\n if (this._pressedGripsCounter === 1) {\r\n this.stopScalingByControllers();\r\n // reattach molecule to other controller\r\n const anotherController = event.target === this._controller1 ? this._controller2 : this._controller1;\r\n anotherController.addSavingWorldTransform(this._molContainer);\r\n } else if (this._pressedGripsCounter === 0) {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n enable(gfx) {\r\n if (!gfx) {\r\n logger.warn('WebVR couldn\\'t be enabled, because gfx is not defined');\r\n return;\r\n }\r\n this._gfx = gfx;\r\n const { renderer, camera } = gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n if (!camera) {\r\n throw new Error('No camera is available to toggle WebVR');\r\n }\r\n\r\n // enable xr in renderer\r\n renderer.xr.enabled = true;\r\n // add button for turning vr mode\r\n if (!this._button) {\r\n this._button = createWebVRButton(this);\r\n document.body.appendChild(this._button);\r\n } else {\r\n this._button.style.display = 'block';\r\n }\r\n // store fog setting\r\n this._mainFog = settings.now.fog;\r\n settings.set('fog', false);\r\n\r\n this._plugVRNodesIntoScene(gfx, renderer);\r\n this._setControllersListeners();\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n _plugVRNodesIntoScene(gfx, renderer) {\r\n // store common scene camera\r\n this._mainCamera.copy(gfx.camera);\r\n // add hierarchical structure for webVR into scene\r\n gfx.scene.add(this._user);\r\n // turn on webvr transformation\r\n gfx.scene.add(this._molContainer);\r\n this._molContainer.add(gfx.root);\r\n\r\n this._controller1 = renderer.xr.getController(0);\r\n this._controller2 = renderer.xr.getController(1);\r\n const mesh = this._createControllerMesh();\r\n this._controller1.add(mesh);\r\n this._controller2.add(mesh.clone());\r\n this._user.add(this._controller1);\r\n this._user.add(this._controller2);\r\n }\r\n\r\n _setControllersListeners() {\r\n this._controller1.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n\r\n this._controller1.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n }\r\n\r\n disable() {\r\n if (!this._gfx) {\r\n return;\r\n }\r\n const { renderer, camera } = this._gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n\r\n // nullify webxr callback for animation frame\r\n renderer.setAnimationLoop(null);\r\n const session = renderer.xr.getSession();\r\n if (session) {\r\n session.end();\r\n }\r\n renderer.xr.enabled = false;\r\n // remove button of VR entering\r\n if (this._button) {\r\n this._button.style.display = 'none';\r\n }\r\n // restore fog param\r\n settings.set('fog', this._mainFog);\r\n\r\n this._unplugVRNodesFromScene(camera);\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(false);\r\n }\r\n }\r\n\r\n _unplugVRNodesFromScene(camera) {\r\n // restore common camera\r\n if (this._mainCamera && camera) {\r\n camera.copy(this._mainCamera);\r\n }\r\n // turn off webvr transformation\r\n const root = this._molContainer.children[0];\r\n if (root) {\r\n this._gfx.scene.add(root);\r\n }\r\n this._molContainer.parent.remove(this._molContainer);\r\n if (this._user) {\r\n this._gfx.scene.remove(this._user);\r\n }\r\n // free scene nodes\r\n this._molContainer = null;\r\n this._user = null;\r\n this._scalingPivot = null;\r\n this._user = null;\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n }\r\n\r\n _createControllerMesh() {\r\n // visualize controllers with cylinders\r\n const geometry = new THREE.CylinderGeometry(0.04, 0.04, 0.3);\r\n const material = new UberMaterial({ lights: false, overrideColor: true });\r\n material.setUberOptions({ fixedColor: new THREE.Color(0x4444ff) });\r\n material.updateUniforms();\r\n const cylinder = new THREE.Mesh(geometry, material);\r\n cylinder.rotateX(-Math.PI / 2);\r\n return cylinder;\r\n }\r\n\r\n updateMoleculeScale() {\r\n if (!this._controller1 || !this._controller2) {\r\n return;\r\n }\r\n\r\n const self = this;\r\n // update molecule scaling by controllers\r\n if (self._pressedGripsCounter === 2) {\r\n // recalc scaling pivot\r\n gfxutils.getMiddlePoint(self._controller1.position, self._controller2.position, self._scalingPivot.position);\r\n // recalc scaler\r\n const dist = self._controller1.position.distanceTo(self._controller2.position);\r\n const scaler = dist / self._distance;\r\n self._scalingPivot.scale.multiplyScalar(scaler);\r\n // save cur distance for next frame\r\n self._distance = dist;\r\n }\r\n }\r\n\r\n /**\r\n * Reposition molecule right before the camera.\r\n * @note The proper way is to initiate headset in the place of common Miew's camera.\r\n * But threejs limitations on setting new XRReferenceSpace enforce the molecule repositioning\r\n * Hope, something will change.\r\n */\r\n moveSceneBehindHeadset() {\r\n const gfx = this._gfx;\r\n const { camera } = gfx;\r\n\r\n // set container position in camera space\r\n const container = this._molContainer;\r\n container.matrix.identity();\r\n container.position.set(0, 0, -4.0);\r\n container.updateMatrix();\r\n\r\n // update container world matrix\r\n container.matrixWorld.multiplyMatrices(camera.matrixWorld, container.matrix);\r\n // readd to scene\r\n gfx.scene.addSavingWorldTransform(container);\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n getCanvas() {\r\n const gfx = this._gfx;\r\n return (gfx && gfx.renderer) ? gfx.renderer.domElement : null;\r\n }\r\n}\r\n","/* global PACKAGE_VERSION:false */\r\nimport _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport { Spinner } from 'spin.js';\r\nimport Stats from './gfx/Stats';\r\nimport utils from './utils';\r\nimport JobHandle from './utils/JobHandle';\r\nimport options from './options';\r\nimport settings from './settings';\r\nimport chem from './chem';\r\nimport Visual from './Visual';\r\nimport ComplexVisual from './ComplexVisual';\r\nimport Complex from './chem/Complex';\r\nimport VolumeVisual from './VolumeVisual';\r\nimport io from './io/io';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport CSS2DRenderer from './gfx/CSS2DRenderer';\r\nimport ObjectControls from './ui/ObjectControls';\r\nimport Picker from './ui/Picker';\r\nimport Axes from './gfx/Axes';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport FrameInfo from './gfx/FrameInfo';\r\nimport meshes from './gfx/meshes/meshes';\r\nimport LinesObject from './gfx/objects/LinesObj';\r\nimport UberMaterial from './gfx/shaders/UberMaterial';\r\nimport OutlineMaterial from './gfx/shaders/OutlineMaterial';\r\nimport FXAAMaterial from './gfx/shaders/FXAAMaterial';\r\nimport AOMaterial from './gfx/shaders/AOMaterial';\r\nimport AOHorBlurMaterial from './gfx/shaders/AOHorBlurMaterial';\r\nimport AOVertBlurWithBlendMaterial from './gfx/shaders/AOVertBlurWithBlendMaterial';\r\nimport AnaglyphMaterial from './gfx/shaders/AnaglyphMaterial';\r\nimport VolumeMaterial from './gfx/shaders/VolumeMaterial';\r\nimport ViewInterpolator from './gfx/ViewInterpolator';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\nimport logger from './utils/logger';\r\nimport Cookies from './utils/Cookies';\r\nimport capabilities from './gfx/capabilities';\r\nimport WebVRPoC from './gfx/vr/WebVRPoC';\r\nimport vertexScreenQuadShader from './gfx/shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromDistTex from './gfx/shaders/ScreenQuadFromDistortionTex.frag';\r\n\r\nconst {\r\n selectors,\r\n Atom,\r\n Residue,\r\n Chain,\r\n Molecule,\r\n} = chem;\r\n\r\nconst EDIT_MODE = { COMPLEX: 0, COMPONENT: 1, FRAGMENT: 2 };\r\n\r\nconst LOADER_NOT_FOUND = 'Could not find suitable loader for this source';\r\nconst PARSER_NOT_FOUND = 'Could not find suitable parser for this source';\r\n\r\nconst { createElement } = utils;\r\n\r\nfunction updateFogRange(fog, center, radius) {\r\n fog.near = center - radius * settings.now.fogNearFactor;\r\n fog.far = center + radius * settings.now.fogFarFactor;\r\n}\r\n\r\nfunction removeExtension(fileName) {\r\n const dot = fileName.lastIndexOf('.');\r\n if (dot >= 0) {\r\n fileName = fileName.substr(0, dot);\r\n }\r\n return fileName;\r\n}\r\n\r\nfunction hasValidResidues(complex) {\r\n let hasValidRes = false;\r\n complex.forEachComponent((component) => {\r\n component.forEachResidue((residue) => {\r\n if (residue._isValid) {\r\n hasValidRes = true;\r\n }\r\n });\r\n });\r\n return hasValidRes;\r\n}\r\n\r\nfunction reportProgress(log, action, percent) {\r\n const TOTAL_PERCENT = 100;\r\n if (percent !== undefined) {\r\n log.debug(`${action}... ${Math.floor(percent * TOTAL_PERCENT)}%`);\r\n } else {\r\n log.debug(`${action}...`);\r\n }\r\n}\r\n\r\nfunction chooseFogColor() {\r\n return settings.now.fogColorEnable ? settings.now.fogColor : settings.now.bg.color;\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\n/**\r\n * Main 3D Molecular Viewer class.\r\n *\r\n * @param {object} opts - Viewer options.\r\n * @param {HTMLElement=} opts.container - DOM element that serves as a viewer container.\r\n * @param {object=} opts.settings - An object with properties to override default settings.\r\n * @param {string=} opts.settingsCookie='settings' - The name of the cookie to save current settings to.\r\n * @param {string=} opts.cookiePath='/' - The path option for cookies. Defaults to root.\r\n *\r\n * @exports Miew\r\n * @constructor\r\n */\r\nfunction Miew(opts) {\r\n EventDispatcher.call(this);\r\n this._opts = _.merge({\r\n settingsCookie: 'settings',\r\n cookiePath: '/',\r\n }, opts);\r\n /** @type {?object} */\r\n this._gfx = null;\r\n /** @type {ViewInterpolator} */\r\n this._interpolator = new ViewInterpolator();\r\n /** @type {HTMLElement} */\r\n this._container = (opts && opts.container)\r\n || document.getElementById('miew-container')\r\n || _.head(document.getElementsByClassName('miew-container'))\r\n || document.body;\r\n /** @type {HTMLElement} */\r\n this._containerRoot = this._container;\r\n\r\n /** @type {boolean} */\r\n this._running = false;\r\n /** @type {boolean} */\r\n this._halting = false;\r\n /** @type {boolean} */\r\n this._building = false;\r\n /** @type {boolean} */\r\n this._needRender = true;\r\n /** @type {boolean} */\r\n this._hotKeysEnabled = true;\r\n\r\n /** @type {Settings} */\r\n this.settings = settings;\r\n const log = logger;\r\n log.console = DEBUG;\r\n log.level = DEBUG ? 'debug' : 'info';\r\n /**\r\n * @type {Logger}\r\n * @example\r\n * miew.logger.addEventListener('message', function _onLogMessage(evt) {\r\n * console.log(evt.message);\r\n * });\r\n */\r\n this.logger = log;\r\n\r\n this._cookies = new Cookies(this);\r\n this.restoreSettings();\r\n if (opts && opts.settings) {\r\n this.settings.set(opts.settings);\r\n }\r\n\r\n /** @type {?Spinner} */\r\n this._spinner = null;\r\n /** @type {JobHandle[]} */\r\n this._loading = [];\r\n /** @type {?number}\r\n * @deprecated until Animation system refactoring\r\n */\r\n this._animInterval = null;\r\n\r\n /** @type {object} */\r\n this._visuals = {};\r\n /** @type {?string} */\r\n this._curVisualName = null;\r\n\r\n /** @type {array} */\r\n this._objects = [];\r\n\r\n /** @type {object} */\r\n this._sourceWindow = null;\r\n\r\n this.reset();\r\n\r\n if (this._repr) {\r\n log.debug(`Selected ${this._repr.mode.name} mode with ${this._repr.colorer.name} colorer.`);\r\n }\r\n\r\n const self = this;\r\n Miew.registeredPlugins.forEach((plugin) => {\r\n plugin.call(self);\r\n });\r\n\r\n this._initOnSettingsChanged();\r\n}\r\n\r\nMiew.prototype = Object.create(EventDispatcher.prototype);\r\nMiew.prototype.constructor = Miew;\r\n\r\nMiew.prototype.getMaxRepresentationCount = function () {\r\n return ComplexVisual.NUM_REPRESENTATION_BITS;\r\n};\r\n\r\n/**\r\n * Replace viewer container contents with a DOM element.\r\n * @param {HTMLElement} container - parent container.\r\n * @param {HTMLElement} element - DOM element to show.\r\n * @private\r\n */\r\nfunction _setContainerContents(container, element) {\r\n const parent = container;\r\n while (parent.firstChild) {\r\n parent.removeChild(parent.firstChild);\r\n }\r\n parent.appendChild(element);\r\n}\r\n\r\n/**\r\n * Update Shadow Camera target position and frustum.\r\n * @private\r\n */\r\nMiew.prototype._updateShadowCamera = (function () {\r\n const shadowMatrix = new THREE.Matrix4();\r\n const direction = new THREE.Vector3();\r\n const OBB = { center: new THREE.Vector3(), halfSize: new THREE.Vector3() };\r\n\r\n return function () {\r\n this._gfx.scene.updateMatrixWorld();\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = this._gfx.scene.children[i];\r\n shadowMatrix.copy(light.shadow.camera.matrixWorldInverse);\r\n this.getOBB(shadowMatrix, OBB);\r\n\r\n direction.subVectors(light.target.position, light.position);\r\n light.position.subVectors(OBB.center, direction);\r\n light.target.position.copy(OBB.center);\r\n\r\n light.shadow.bias = 0.09;\r\n light.shadow.camera.bottom = -OBB.halfSize.y;\r\n light.shadow.camera.top = OBB.halfSize.y;\r\n light.shadow.camera.right = OBB.halfSize.x;\r\n light.shadow.camera.left = -OBB.halfSize.x;\r\n light.shadow.camera.near = direction.length() - OBB.halfSize.z;\r\n light.shadow.camera.far = direction.length() + OBB.halfSize.z;\r\n\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Initialize the viewer.\r\n * @returns {boolean} true on success.\r\n * @throws Forwards exception raised during initialization.\r\n * @see Miew#term\r\n */\r\nMiew.prototype.init = function () {\r\n const container = this._container;\r\n const elem = utils.createElement('div', { class: 'miew-canvas' });\r\n _setContainerContents(container, elem);\r\n this._container = elem;\r\n\r\n const frag = document.createDocumentFragment();\r\n frag.appendChild(this._msgMode = createElement(\r\n 'div', { class: 'mode-message overlay' },\r\n createElement('p', {}, 'COMPONENT EDIT MODE'),\r\n ));\r\n frag.appendChild(this._msgAtomInfo = createElement(\r\n 'div', { class: 'atom-info overlay' },\r\n createElement('p', {}, ''),\r\n ));\r\n container.appendChild(frag);\r\n\r\n if (this._gfx !== null) { // block double init\r\n return true;\r\n }\r\n\r\n const self = this;\r\n this._showMessage('Viewer is being initialized...');\r\n try {\r\n this._initGfx();\r\n\r\n this._initListeners();\r\n this._spinner = new Spinner({\r\n lines: 13,\r\n length: 28,\r\n width: 14,\r\n radius: 42,\r\n color: '#fff',\r\n zIndex: 700,\r\n });\r\n\r\n window.top.addEventListener('keydown', (event) => {\r\n self._onKeyDown(event);\r\n });\r\n\r\n window.top.addEventListener('keyup', (event) => {\r\n self._onKeyUp(event);\r\n });\r\n\r\n this._objectControls = new ObjectControls(\r\n this._gfx.root, this._gfx.pivot,\r\n this._gfx.camera, this._gfx.renderer.domElement, (() => self._getAltObj()),\r\n );\r\n this._objectControls.addEventListener('change', (e) => {\r\n if (settings.now.shadow.on) {\r\n self._updateShadowCamera();\r\n }\r\n // route rotate, zoom, translate and translatePivot events to the external API\r\n switch (e.action) {\r\n case 'rotate':\r\n self.dispatchEvent({ type: 'rotate', quaternion: e.quaternion });\r\n break;\r\n case 'zoom':\r\n self.dispatchEvent({ type: 'zoom', factor: e.factor });\r\n break;\r\n default:\r\n self.dispatchEvent({ type: e.action });\r\n }\r\n self.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n });\r\n\r\n const gfx = this._gfx;\r\n this._picker = new Picker(gfx.root, gfx.camera, gfx.renderer.domElement);\r\n this._picker.addEventListener('newpick', (event) => {\r\n self._onPick(event);\r\n });\r\n this._picker.addEventListener('dblclick', (event) => {\r\n self.center(event);\r\n });\r\n } catch (error) {\r\n if (error.name === 'TypeError' && error.message === 'Cannot read property \\'getExtension\\' of null') {\r\n this._showMessage('Could not create WebGL context.');\r\n } else if (error.message.search(/webgl/i) > 1) {\r\n this._showMessage(error.message);\r\n } else {\r\n this._showMessage('Viewer initialization failed.');\r\n throw error;\r\n }\r\n return false;\r\n }\r\n\r\n // automatically load default file\r\n const file = this._opts && this._opts.load;\r\n if (file) {\r\n const type = this._opts && this._opts.type;\r\n this.load(file, { fileType: type, keepRepsInfo: true });\r\n }\r\n\r\n return true;\r\n};\r\n\r\n/**\r\n * Terminate the viewer completely.\r\n * @see Miew#init\r\n */\r\nMiew.prototype.term = function () {\r\n this._showMessage('Viewer has been terminated.');\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n this.halt();\r\n this._gfx = null;\r\n};\r\n\r\n/**\r\n * Display message inside the viewer container, hiding WebGL canvas.\r\n * @param {string} msg - Message to show.\r\n * @private\r\n */\r\nMiew.prototype._showMessage = function (msg) {\r\n const element = document.createElement('div');\r\n element.setAttribute('class', 'miew-message');\r\n element.appendChild(document.createElement('p')).appendChild(document.createTextNode(msg));\r\n _setContainerContents(this._container, element);\r\n};\r\n\r\n/**\r\n * Display WebGL canvas inside the viewer container, hiding any message shown.\r\n * @private\r\n */\r\nMiew.prototype._showCanvas = function () {\r\n _setContainerContents(this._container, this._gfx.renderer.domElement);\r\n};\r\n\r\nMiew.prototype._requestAnimationFrame = function (callback) {\r\n const { xr } = this._gfx.renderer;\r\n if (xr && xr.enabled) {\r\n this._gfx.renderer.setAnimationLoop(callback);\r\n return;\r\n }\r\n requestAnimationFrame(callback);\r\n};\r\n\r\nfunction arezSpritesSupported(context) {\r\n return context.getExtension('EXT_frag_depth');\r\n}\r\n\r\nfunction isAOSupported(context) {\r\n return (context.getExtension('WEBGL_depth_texture')\r\n && context.getExtension('WEBGL_draw_buffers'));\r\n}\r\n\r\n/**\r\n * Initialize WebGL and set 3D scene up.\r\n * @private\r\n */\r\nMiew.prototype._initGfx = function () {\r\n const gfx = {\r\n width: this._container.clientWidth,\r\n height: this._container.clientHeight,\r\n };\r\n\r\n const webGLOptions = { preserveDrawingBuffer: true, alpha: true, premultipliedAlpha: false };\r\n if (settings.now.antialias) {\r\n webGLOptions.antialias = true;\r\n }\r\n\r\n gfx.renderer2d = new CSS2DRenderer();\r\n\r\n gfx.renderer = new THREE.WebGLRenderer(webGLOptions);\r\n gfx.renderer.shadowMap.enabled = settings.now.shadow.on;\r\n gfx.renderer.shadowMap.autoUpdate = false;\r\n gfx.renderer.shadowMap.type = THREE.PCFShadowMap;\r\n capabilities.init(gfx.renderer);\r\n\r\n // z-sprites and ambient occlusion possibility\r\n if (!arezSpritesSupported(gfx.renderer.getContext())) {\r\n settings.set('zSprites', false);\r\n }\r\n if (!isAOSupported(gfx.renderer.getContext())) {\r\n settings.set('ao', false);\r\n }\r\n\r\n gfx.renderer.autoClear = false;\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n gfx.camera = new THREE.PerspectiveCamera(\r\n settings.now.camFov, gfx.width / gfx.height,\r\n settings.now.camNear, settings.now.camFar,\r\n );\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.position.z = settings.now.camDistance;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n\r\n gfx.stereoCam = new THREE.StereoCamera();\r\n\r\n gfx.scene = new THREE.Scene();\r\n\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color, settings.now.camNear, settings.now.camFar);\r\n\r\n gfx.root = new gfxutils.RCGroup();\r\n gfx.scene.add(gfx.root);\r\n\r\n gfx.pivot = new gfxutils.RCGroup();\r\n gfx.root.add(gfx.pivot);\r\n\r\n gfx.selectionScene = new THREE.Scene();\r\n gfx.selectionRoot = new THREE.Group();\r\n gfx.selectionRoot.matrixAutoUpdate = false;\r\n gfx.selectionScene.add(gfx.selectionRoot);\r\n\r\n gfx.selectionPivot = new THREE.Group();\r\n gfx.selectionPivot.matrixAutoUpdate = false;\r\n gfx.selectionRoot.add(gfx.selectionPivot);\r\n\r\n const light12 = new THREE.DirectionalLight(0xffffff, 0.45);\r\n light12.position.set(0, 0.414, 1);\r\n light12.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n light12.castShadow = true;\r\n light12.shadow = new THREE.DirectionalLightShadow();\r\n light12.shadow.bias = 0.09;\r\n light12.shadow.radius = settings.now.shadow.radius;\r\n light12.shadow.camera.layers.set(gfxutils.LAYERS.SHADOWMAP);\r\n\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n const shadowMapSize = Math.max(gfx.width, gfx.height) * pixelRatio;\r\n light12.shadow.mapSize.width = shadowMapSize;\r\n light12.shadow.mapSize.height = shadowMapSize;\r\n light12.target.position.set(0.0, 0.0, 0.0);\r\n gfx.scene.add(light12);\r\n gfx.scene.add(light12.target);\r\n\r\n const light3 = new THREE.AmbientLight(0x666666);\r\n light3.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.scene.add(light3);\r\n\r\n // add axes\r\n gfx.axes = new Axes(gfx.root, gfx.camera);\r\n const deviceWidth = gfx.width * pixelRatio;\r\n const deviceHeight = gfx.height * pixelRatio;\r\n\r\n gfx.offscreenBuf = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat, depthBuffer: true,\r\n },\r\n );\r\n\r\n if (gfx.renderer.getContext().getExtension('WEBGL_depth_texture')) {\r\n gfx.offscreenBuf.depthTexture = new THREE.DepthTexture();\r\n gfx.offscreenBuf.depthTexture.type = THREE.UnsignedShortType;\r\n }\r\n\r\n gfx.offscreenBuf2 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf3 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf4 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf3;\r\n gfx.volFFTex = gfx.offscreenBuf4;\r\n gfx.volWFFTex = gfx.offscreenBuf;\r\n\r\n // use float textures for volume rendering if possible\r\n if (gfx.renderer.getContext().getExtension('OES_texture_float')) {\r\n gfx.offscreenBuf5 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf6 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf7 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: true,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf5;\r\n gfx.volFFTex = gfx.offscreenBuf6;\r\n gfx.volWFFTex = gfx.offscreenBuf7;\r\n } else {\r\n this.logger.warn('Device doesn\\'t support OES_texture_float extension');\r\n }\r\n\r\n gfx.stereoBufL = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.stereoBufR = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n this._gfx = gfx;\r\n this._showCanvas();\r\n\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n\r\n this._container.appendChild(gfx.renderer2d.getElement());\r\n\r\n // add FPS counter\r\n const stats = new Stats();\r\n stats.domElement.style.position = 'absolute';\r\n stats.domElement.style.right = '0';\r\n stats.domElement.style.bottom = '0';\r\n this._container.appendChild(stats.domElement);\r\n this._fps = stats;\r\n this._fps.show(settings.now.fps);\r\n};\r\n\r\n/**\r\n * Setup event listeners.\r\n * @private\r\n */\r\nMiew.prototype._initListeners = function () {\r\n const self = this;\r\n window.addEventListener('resize', () => {\r\n self._onResize();\r\n });\r\n};\r\n\r\n/**\r\n * Try to add numbers to the base name to make it unique among visuals\r\n * @private\r\n */\r\nMiew.prototype._makeUniqueVisualName = function (baseName) {\r\n if (!baseName) {\r\n return Math.random().toString();\r\n }\r\n\r\n let name = baseName;\r\n let suffix = 1;\r\n while (this._visuals.hasOwnProperty(name)) {\r\n name = `${baseName} (${suffix.toString()})`;\r\n suffix++;\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Add visual to the viewer\r\n * @private\r\n */\r\nMiew.prototype._addVisual = function (visual) {\r\n if (!visual) {\r\n return null;\r\n }\r\n\r\n // change visual name in order to make it unique\r\n const name = this._makeUniqueVisualName(visual.name);\r\n visual.name = name;\r\n\r\n this._visuals[name] = visual;\r\n this._gfx.pivot.add(visual);\r\n if (visual.getSelectionGeo) {\r\n this._gfx.selectionPivot.add(visual.getSelectionGeo());\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Remove visual from the viewer\r\n * @private\r\n */\r\nMiew.prototype._removeVisual = function (visual) {\r\n let name = '';\r\n let obj = null;\r\n if (visual instanceof Visual) {\r\n ({ name } = visual);\r\n obj = visual;\r\n } else if (typeof visual === 'string') {\r\n name = visual;\r\n obj = this._visuals[name];\r\n }\r\n\r\n if (!obj || !this._visuals.hasOwnProperty(name) || this._visuals[name] !== obj) {\r\n return;\r\n }\r\n\r\n if (name === this._curVisualName) {\r\n this._curVisualName = undefined;\r\n }\r\n\r\n delete this._visuals[name];\r\n obj.release(); // removes nodes from scene\r\n\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Call specified function for each Visual\r\n * @private\r\n */\r\nMiew.prototype._forEachVisual = function (callback) {\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Release (destroy) all visuals in the scene\r\n * @private\r\n */\r\nMiew.prototype._releaseAllVisuals = function () {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n this._visuals[name].release();\r\n }\r\n }\r\n\r\n this._visuals = {};\r\n};\r\n\r\n/**\r\n * Call specified function for each ComplexVisual\r\n * @private\r\n */\r\nMiew.prototype._forEachComplexVisual = function (callback) {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)\r\n && this._visuals[name] instanceof ComplexVisual) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual with specified name, or current (if not found), or any, or null\r\n * @private\r\n */\r\nMiew.prototype._getComplexVisual = function (name) {\r\n name = name || this._curVisualName;\r\n let any = null;\r\n let named = null;\r\n this._forEachComplexVisual((visual) => {\r\n any = visual;\r\n if (visual.name === name) {\r\n named = visual;\r\n }\r\n });\r\n return named || any;\r\n};\r\n\r\n/**\r\n * Returns first found VolumeVisual (no more than one should be present actually)\r\n * @private\r\n */\r\nMiew.prototype._getVolumeVisual = function () {\r\n let any = null;\r\n this._forEachVisual((visual) => {\r\n if (visual instanceof VolumeVisual) {\r\n any = visual;\r\n }\r\n });\r\n return any;\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual corresponding to specified complex\r\n * @private\r\n */\r\nMiew.prototype._getVisualForComplex = function (complex) {\r\n if (!complex) {\r\n return null;\r\n }\r\n\r\n let found = null;\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getComplex() === complex) {\r\n found = visual;\r\n }\r\n });\r\n return found;\r\n};\r\n\r\n/*\r\n * Get a list of names of visuals currently shown by the viewer\r\n */\r\nMiew.prototype.getVisuals = function () {\r\n return Object.keys(this._visuals);\r\n};\r\n\r\n/*\r\n * Get complex visuals count\r\n */\r\nMiew.prototype.getComplexVisualsCount = function () {\r\n let count = 0;\r\n this._forEachComplexVisual(() => count++);\r\n return count;\r\n};\r\n\r\n/*\r\n * Get current visual\r\n */\r\nMiew.prototype.getCurrentVisual = function () {\r\n return this._curVisualName;\r\n};\r\n\r\n/*\r\n * Set current visual.\r\n * All further operations will be performed on this visual (complex) if not stated otherwise.\r\n */\r\nMiew.prototype.setCurrentVisual = function (name) {\r\n if (!this._visuals[name]) {\r\n return;\r\n }\r\n\r\n this._curVisualName = name;\r\n};\r\n\r\n/**\r\n * Run the viewer, start processing update/render frames periodically.\r\n * Has no effect if already running.\r\n * @see Miew#halt\r\n */\r\nMiew.prototype.run = function () {\r\n if (!this._running) {\r\n this._running = true;\r\n if (this._halting) {\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._objectControls.enable(true);\r\n this._interpolator.resume();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to stop.\r\n * Will be processed during the next frame.\r\n * @see Miew#run\r\n */\r\nMiew.prototype.halt = function () {\r\n if (this._running) {\r\n this._discardComponentEdit();\r\n this._discardFragmentEdit();\r\n this._objectControls.enable(false);\r\n this._interpolator.pause();\r\n this._halting = true;\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to start / stop responsing\r\n * on hot keys.\r\n * @param enabled - start (true) or stop (false) response on hot keys.\r\n */\r\nMiew.prototype.enableHotKeys = function (enabled) {\r\n this._hotKeysEnabled = enabled;\r\n this._objectControls.enableHotkeys(enabled);\r\n};\r\n\r\n/**\r\n * Callback which processes window resize.\r\n * @private\r\n */\r\nMiew.prototype._onResize = function () {\r\n this._needRender = true;\r\n\r\n const gfx = this._gfx;\r\n gfx.width = this._container.clientWidth;\r\n gfx.height = this._container.clientHeight;\r\n\r\n gfx.camera.aspect = gfx.width / gfx.height;\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n this.dispatchEvent({ type: 'resize' });\r\n};\r\n\r\nMiew.prototype._resizeOffscreenBuffers = function (width, height, stereo) {\r\n const gfx = this._gfx;\r\n stereo = stereo || 'NONE';\r\n const isAnaglyph = (stereo === 'NONE' || stereo === 'ANAGLYPH');\r\n const multi = isAnaglyph ? 1 : 0.5;\r\n gfx.offscreenBuf.setSize(multi * width, height);\r\n gfx.offscreenBuf2.setSize(multi * width, height);\r\n gfx.offscreenBuf3.setSize(multi * width, height);\r\n gfx.offscreenBuf4.setSize(multi * width, height);\r\n if (gfx.offscreenBuf5) {\r\n gfx.offscreenBuf5.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf6) {\r\n gfx.offscreenBuf6.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf7) {\r\n gfx.offscreenBuf7.setSize(multi * width, height);\r\n }\r\n if (isAnaglyph) {\r\n gfx.stereoBufL.setSize(width, height);\r\n gfx.stereoBufR.setSize(width, height);\r\n }\r\n};\r\n\r\n/**\r\n * Callback which processes update/render frames.\r\n * @private\r\n */\r\nMiew.prototype._onTick = function () {\r\n if (this._halting) {\r\n this._running = false;\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._fps.update();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n\r\n this._onUpdate();\r\n if (this._needRender) {\r\n this._onRender();\r\n this._needRender = !settings.now.suspendRender || settings.now.stereo === 'WEBVR';\r\n }\r\n};\r\n\r\nMiew.prototype._getBSphereRadius = function () {\r\n // calculate radius that would include all visuals\r\n let radius = 0;\r\n this._forEachVisual((visual) => {\r\n radius = Math.max(radius, visual.getBoundaries().boundingSphere.radius);\r\n });\r\n return radius * this._objectControls.getScale();\r\n};\r\n\r\n/**\r\n * Calculate bounding box that would include all visuals and being axis aligned in world defined by\r\n * transformation matrix: matrix\r\n * @param {Matrix4} matrix - transformation matrix.\r\n * @param {object} OBB - calculating bounding box.\r\n * @param {Vector3} OBB.center - OBB center.\r\n * @param {Vector3} OBB.halfSize - half magnitude of OBB sizes.\r\n */\r\nMiew.prototype.getOBB = (function () {\r\n const _bSphereForOneVisual = new THREE.Sphere();\r\n const _bBoxForOneVisual = new THREE.Box3();\r\n const _bBox = new THREE.Box3();\r\n\r\n const _invMatrix = new THREE.Matrix4();\r\n\r\n const _points = [\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n ];\r\n\r\n return function (matrix, OBB) {\r\n _bBox.makeEmpty();\r\n\r\n this._forEachVisual((visual) => {\r\n _bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere);\r\n _bSphereForOneVisual.applyMatrix4(visual.matrixWorld).applyMatrix4(matrix);\r\n _bSphereForOneVisual.getBoundingBox(_bBoxForOneVisual);\r\n _bBox.union(_bBoxForOneVisual);\r\n });\r\n _bBox.getCenter(OBB.center);\r\n\r\n _invMatrix.getInverse(matrix);\r\n OBB.center.applyMatrix4(_invMatrix);\r\n\r\n const { min } = _bBox;\r\n const { max } = _bBox;\r\n _points[0].set(min.x, min.y, min.z); // 000\r\n _points[1].set(max.x, min.y, min.z); // 100\r\n _points[2].set(min.x, max.y, min.z); // 010\r\n _points[3].set(min.x, min.y, max.z); // 001\r\n for (let i = 0, l = _points.length; i < l; i++) {\r\n _points[i].applyMatrix4(_invMatrix);\r\n }\r\n\r\n OBB.halfSize.set(\r\n Math.abs(_points[0].x - _points[1].x),\r\n Math.abs(_points[0].y - _points[2].y),\r\n Math.abs(_points[0].z - _points[3].z),\r\n ).multiplyScalar(0.5);\r\n };\r\n}());\r\n\r\nMiew.prototype._updateFog = function () {\r\n const gfx = this._gfx;\r\n\r\n if (settings.now.fog) {\r\n if (typeof gfx.scene.fog === 'undefined' || gfx.scene.fog === null) {\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color);\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n updateFogRange(gfx.scene.fog, gfx.camera.position.z, this._getBSphereRadius());\r\n } else if (gfx.scene.fog) {\r\n gfx.scene.fog = undefined;\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n};\r\n\r\nMiew.prototype._onUpdate = function () {\r\n if (this.isScriptingCommandAvailable !== undefined && this.isScriptingCommandAvailable() && !this._building) {\r\n this.callNextCmd();\r\n }\r\n\r\n this._objectControls.update();\r\n\r\n this._forEachComplexVisual((visual) => {\r\n visual.getComplex().update();\r\n });\r\n\r\n if (settings.now.autobuild && !this._loading.length && !this._building && this._needRebuild()) {\r\n this.rebuild();\r\n }\r\n\r\n if (!this._loading.length && !this._building && !this._needRebuild()) {\r\n this._updateView();\r\n }\r\n\r\n this._updateFog();\r\n\r\n if (this._gfx.renderer.xr.enabled) {\r\n this.webVR.updateMoleculeScale();\r\n }\r\n};\r\n\r\nMiew.prototype._onRender = function () {\r\n const gfx = this._gfx;\r\n\r\n // update all matrices\r\n gfx.scene.updateMatrixWorld();\r\n gfx.camera.updateMatrixWorld();\r\n\r\n this._clipPlaneUpdateValue(this._getBSphereRadius());\r\n this._fogFarUpdateValue();\r\n\r\n gfx.renderer.setRenderTarget(null);\r\n gfx.renderer.clear();\r\n\r\n this._renderFrame(settings.now.stereo);\r\n};\r\n\r\nMiew.prototype._renderFrame = (function () {\r\n const _anaglyphMat = new AnaglyphMaterial();\r\n const _size = new THREE.Vector2();\r\n\r\n return function (stereo) {\r\n const gfx = this._gfx;\r\n const { renderer } = gfx;\r\n\r\n renderer.getSize(_size);\r\n\r\n if (stereo !== 'NONE') {\r\n gfx.camera.focus = gfx.camera.position.z; // set focus to the center of the object\r\n gfx.stereoCam.aspect = 1.0;\r\n\r\n // in anaglyph mode we render full-size image for each eye\r\n // while in other stereo modes only half-size (two images on the screen)\r\n if (stereo === 'ANAGLYPH') {\r\n gfx.stereoCam.update(gfx.camera);\r\n } else {\r\n gfx.stereoCam.updateHalfSized(gfx.camera, settings.now.camFov);\r\n }\r\n }\r\n\r\n // resize offscreen buffers to match the target\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n this._resizeOffscreenBuffers(_size.width * pixelRatio, _size.height * pixelRatio, stereo);\r\n\r\n this._renderShadowMap();\r\n\r\n switch (stereo) {\r\n case 'WEBVR':\r\n case 'NONE':\r\n this._renderScene(gfx.camera, false);\r\n break;\r\n case 'SIMPLE':\r\n case 'DISTORTED':\r\n renderer.setScissorTest(true);\r\n\r\n renderer.setScissor(0, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(0, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraL, stereo === 'DISTORTED');\r\n\r\n renderer.setScissor(_size.width / 2, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(_size.width / 2, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraR, stereo === 'DISTORTED');\r\n\r\n renderer.setScissorTest(false);\r\n break;\r\n case 'ANAGLYPH':\r\n this._renderScene(this._gfx.stereoCam.cameraL, false, gfx.stereoBufL);\r\n this._renderScene(this._gfx.stereoCam.cameraR, false, gfx.stereoBufR);\r\n renderer.setRenderTarget(null);\r\n _anaglyphMat.uniforms.srcL.value = gfx.stereoBufL.texture;\r\n _anaglyphMat.uniforms.srcR.value = gfx.stereoBufR.texture;\r\n gfx.renderer.renderScreenQuad(_anaglyphMat);\r\n break;\r\n default:\r\n }\r\n\r\n gfx.renderer2d.render(gfx.scene, gfx.camera);\r\n\r\n if (settings.now.axes && gfx.axes && !gfx.renderer.xr.enabled) {\r\n gfx.axes.render(renderer);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._onBgColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx) {\r\n if (gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onFogColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx && gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._setUberMaterialValues = function (values) {\r\n this._gfx.root.traverse((obj) => {\r\n if ((obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line)\r\n && obj.material instanceof UberMaterial) {\r\n obj.material.setValues(values);\r\n obj.material.needsUpdate = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._enableMRT = function (on, renderBuffer, textureBuffer) {\r\n const gfx = this._gfx;\r\n const gl = gfx.renderer.getContext();\r\n const ext = gl.getExtension('WEBGL_draw_buffers');\r\n const { properties } = gfx.renderer;\r\n\r\n if (!on) {\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, null]);\r\n return;\r\n }\r\n\r\n // take extra texture from Texture Buffer\r\n gfx.renderer.setRenderTarget(textureBuffer);\r\n const tx8 = properties.get(textureBuffer.texture).__webglTexture;\r\n gl.bindTexture(gl.TEXTURE_2D, tx8);\r\n\r\n // take texture and framebuffer from renderbuffer\r\n gfx.renderer.setRenderTarget(renderBuffer);\r\n const fb = properties.get(renderBuffer).__webglFramebuffer;\r\n const tx = properties.get(renderBuffer.texture).__webglTexture;\r\n\r\n // set framebuffer\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n fb.width = renderBuffer.width;\r\n fb.height = renderBuffer.height;\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tx, 0);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, ext.COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, tx8, 0);\r\n\r\n // mapping textures\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, ext.COLOR_ATTACHMENT1_WEBGL]);\r\n};\r\n\r\nMiew.prototype._renderScene = (function () {\r\n return function (camera, distortion, target) {\r\n distortion = distortion || false;\r\n target = target || null;\r\n\r\n const gfx = this._gfx;\r\n\r\n // render to offscreen buffer\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.clear();\r\n if (gfx.renderer.xr.enabled) {\r\n gfx.renderer.render(gfx.scene, camera);\r\n return;\r\n }\r\n\r\n // clean buffer for normals texture\r\n gfx.renderer.setClearColor(0x000000, 0.0);\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf4);\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.clear();\r\n\r\n const bHaveComplexes = (this._getComplexVisual() !== null);\r\n const volumeVisual = this._getVolumeVisual();\r\n const ssao = bHaveComplexes && settings.now.ao;\r\n\r\n if (ssao) {\r\n this._enableMRT(true, gfx.offscreenBuf, gfx.offscreenBuf4);\r\n }\r\n\r\n if (settings.now.transparency === 'prepass') {\r\n this._renderWithPrepassTransparency(camera, gfx.offscreenBuf);\r\n } else if (settings.now.transparency === 'standard') {\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n }\r\n\r\n if (ssao) {\r\n this._enableMRT(false, null, null);\r\n }\r\n\r\n // when fxaa we should get resulting image in temp off-screen buff2 for further postprocessing with fxaa filter\r\n // otherwise we render to canvas\r\n const outline = bHaveComplexes && settings.now.outline.on;\r\n const fxaa = bHaveComplexes && settings.now.fxaa;\r\n const volume = (volumeVisual !== null) && (volumeVisual.getMesh().material != null);\r\n let dstBuffer = (ssao || outline || volume || fxaa || distortion) ? gfx.offscreenBuf2 : target;\r\n let srcBuffer = gfx.offscreenBuf;\r\n\r\n if (ssao) {\r\n this._performAO(\r\n srcBuffer,\r\n gfx.offscreenBuf4,\r\n gfx.offscreenBuf.depthTexture,\r\n dstBuffer,\r\n gfx.offscreenBuf3,\r\n gfx.offscreenBuf2,\r\n );\r\n if (!fxaa && !distortion && !volume && !outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = target;\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n } else {\r\n // just copy color buffer to dst buffer\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n\r\n // outline\r\n if (outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = (volume || fxaa || distortion) ? gfx.offscreenBuf3 : target;\r\n if (srcBuffer != null) {\r\n this._renderOutline(camera, gfx.offscreenBuf, srcBuffer, dstBuffer);\r\n }\r\n }\r\n\r\n // render selected part with outline material\r\n this._renderSelection(camera, gfx.offscreenBuf, dstBuffer);\r\n\r\n if (volume) {\r\n // copy current picture to the buffer that retains depth-data of the original molecule render\r\n // so that volume renderer could use depth-test\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n dstBuffer = gfx.offscreenBuf;\r\n this._renderVolume(volumeVisual, camera, dstBuffer, gfx.volBFTex, gfx.volFFTex, gfx.volWFFTex);\r\n\r\n // if this is the last stage -- copy image to target\r\n if (!fxaa && !distortion) {\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n }\r\n }\r\n\r\n srcBuffer = dstBuffer;\r\n\r\n if (fxaa) {\r\n dstBuffer = distortion ? gfx.offscreenBuf4 : target;\r\n this._performFXAA(srcBuffer, dstBuffer);\r\n srcBuffer = dstBuffer;\r\n }\r\n\r\n if (distortion) {\r\n dstBuffer = target;\r\n this._performDistortion(srcBuffer, dstBuffer, true);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._performDistortion = (function () {\r\n const _scene = new THREE.Scene();\r\n const _camera = new THREE.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, -500, 1000);\r\n\r\n const _material = new THREE.RawShaderMaterial({\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n aberration: { type: 'fv3', value: new THREE.Vector3(1.0) },\r\n },\r\n vertexShader: vertexScreenQuadShader,\r\n fragmentShader: fragmentScreenQuadFromDistTex,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n const _geo = gfxutils.buildDistorionMesh(10, 10, settings.now.debug.stereoBarrel);\r\n _scene.add(new meshes.Mesh(_geo, _material));\r\n\r\n return function (srcBuffer, targetBuffer, mesh) {\r\n this._gfx.renderer.setRenderTarget(targetBuffer);\r\n this._gfx.renderer.clear();\r\n\r\n if (mesh) {\r\n _material.uniforms.srcTex.value = srcBuffer.texture;\r\n _material.uniforms.aberration.value.set(0.995, 1.0, 1.01);\r\n this._gfx.renderer.render(_scene, _camera);\r\n } else {\r\n this._gfx.renderer.renderScreenQuadFromTexWithDistortion(srcBuffer, settings.now.debug.stereoBarrel);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._renderOutline = (function () {\r\n const _outlineMaterial = new OutlineMaterial({ depth: true });\r\n\r\n return function (camera, srcDepthBuffer, srcColorBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcColorBuffer.texture;\r\n _outlineMaterial.uniforms.srcDepthTex.value = srcDepthBuffer.depthTexture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcDepthBuffer.width, srcDepthBuffer.height);\r\n _outlineMaterial.uniforms.color.value = new THREE.Color(settings.now.outline.color);\r\n _outlineMaterial.uniforms.threshold.value = settings.now.outline.threshold;\r\n _outlineMaterial.uniforms.thickness.value = new THREE.Vector2(\r\n settings.now.outline.thickness,\r\n settings.now.outline.thickness,\r\n );\r\n\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._renderShadowMap = (function () {\r\n const pars = { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };\r\n\r\n return function () {\r\n if (!settings.now.shadow.on) {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n const currentRenderTarget = gfx.renderer.getRenderTarget();\r\n const activeCubeFace = gfx.renderer.getActiveCubeFace();\r\n const activeMipmapLevel = gfx.renderer.getActiveMipmapLevel();\r\n\r\n const _state = gfx.renderer.state;\r\n\r\n // Set GL state for depth map.\r\n _state.setBlending(THREE.NoBlending);\r\n _state.buffers.color.setClear(1, 1, 1, 1);\r\n _state.buffers.depth.setTest(true);\r\n _state.setScissorTest(false);\r\n\r\n for (let i = 0; i < gfx.scene.children.length; i++) {\r\n if (gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = gfx.scene.children[i];\r\n\r\n if (light.shadow.map == null) {\r\n light.shadow.map = new THREE.WebGLRenderTarget(light.shadow.mapSize.width, light.shadow.mapSize.height, pars);\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n light.shadow.updateMatrices(light);\r\n\r\n gfx.renderer.setRenderTarget(light.shadow.map);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.render(gfx.scene, light.shadow.camera);\r\n }\r\n }\r\n gfx.renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);\r\n };\r\n}());\r\n\r\n/**\r\n * Check if there is selection which must be rendered or not.\r\n * @private\r\n * @returns {boolean} true on existing selection to render\r\n */\r\nMiew.prototype._hasSelectionToRender = function () {\r\n const selPivot = this._gfx.selectionPivot;\r\n\r\n for (let i = 0; i < selPivot.children.length; i++) {\r\n const selPivotChild = selPivot.children[i];\r\n if (selPivotChild.children.length > 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n\r\nMiew.prototype._renderSelection = (function () {\r\n const _outlineMaterial = new OutlineMaterial();\r\n\r\n return function (camera, srcBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // clear offscreen buffer (leave z-buffer intact)\r\n gfx.renderer.setClearColor('black', 0);\r\n\r\n // render selection to offscreen buffer\r\n gfx.renderer.setRenderTarget(srcBuffer);\r\n gfx.renderer.clear(true, false, false);\r\n if (self._hasSelectionToRender()) {\r\n gfx.selectionRoot.matrix = gfx.root.matrix;\r\n gfx.selectionPivot.matrix = gfx.pivot.matrix;\r\n gfx.renderer.render(gfx.selectionScene, camera);\r\n } else {\r\n // just render something to force \"target clear\" operation to finish\r\n gfx.renderer.renderDummyQuad();\r\n }\r\n\r\n // overlay to screen\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 0.6);\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcBuffer.width, srcBuffer.height);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._checkVolumeRenderingSupport = function (renderTarget) {\r\n if (!renderTarget) {\r\n return false;\r\n }\r\n const gfx = this._gfx;\r\n const oldRT = gfx.renderer.getRenderTarget();\r\n\r\n gfx.renderer.setRenderTarget(renderTarget);\r\n const context = gfx.renderer.getContext();\r\n const result = context.checkFramebufferStatus(context.FRAMEBUFFER);\r\n gfx.renderer.setRenderTarget(oldRT);\r\n if (result !== context.FRAMEBUFFER_COMPLETE) {\r\n // floatFrameBufferWarning = ;\r\n this.logger.warn('Device doesn\\'t support electron density rendering');\r\n return false;\r\n }\r\n return true;\r\n};\r\n\r\nMiew.prototype._renderVolume = (function () {\r\n const volumeBFMat = new VolumeMaterial.BackFacePosMaterial();\r\n const volumeFFMat = new VolumeMaterial.FrontFacePosMaterial();\r\n const cubeOffsetMat = new THREE.Matrix4().makeTranslation(0.5, 0.5, 0.5);\r\n const world2colorMat = new THREE.Matrix4();\r\n\r\n let volumeRenderingSupported;\r\n\r\n return function (volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) {\r\n const gfx = this._gfx;\r\n\r\n if (typeof volumeRenderingSupported === 'undefined') {\r\n volumeRenderingSupported = this._checkVolumeRenderingSupport(tmpBuf1);\r\n }\r\n\r\n if (!volumeRenderingSupported) {\r\n return;\r\n }\r\n\r\n const mesh = volumeVisual.getMesh();\r\n\r\n mesh.rebuild(gfx.camera);\r\n\r\n // use main camera to prepare special textures to be used by volumetric rendering\r\n // these textures have the size of the window and are stored in offscreen buffers\r\n gfx.renderer.setClearColor('black', 0);\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n // draw plane with its own material, because it differs slightly from volumeBFMat\r\n camera.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeBFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeFFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.scene.overrideMaterial = null;\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n\r\n // prepare texture that contains molecule positions\r\n world2colorMat.getInverse(mesh.matrixWorld);\r\n UberMaterial.prototype.uberOptions.world2colorMatrix.multiplyMatrices(cubeOffsetMat, world2colorMat);\r\n camera.layers.set(gfxutils.LAYERS.COLOR_FROM_POSITION);\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // render volume\r\n const vm = mesh.material;\r\n vm.uniforms._BFRight.value = tmpBuf1.texture;\r\n vm.uniforms._FFRight.value = tmpBuf2.texture;\r\n vm.uniforms._WFFRight.value = tmpBuf3.texture;\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.renderer.setRenderTarget(dstBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\n/* Render scene with 'ZPrepass transparency Effect'\r\n * Idea: transparent objects are rendered in two passes. The first one writes result only into depth buffer.\r\n * The second pass reads depth buffer and writes only to color buffer. The method results in\r\n * correct image of front part of the semi-transparent objects, but we can see only front transparent objects\r\n * and opaque objects inside, there is no transparent objects inside.\r\n * Notes: 1. Opaque objects should be rendered strictly before semi-transparent ones.\r\n * 2. Realization doesn't use camera layers because scene traversing is used for material changes and\r\n * we can use it to select needed meshes and don't complicate meshes builders with layers\r\n */\r\nMiew.prototype._renderWithPrepassTransparency = (function () {\r\n return function (camera, targetBuffer) {\r\n const gfx = this._gfx;\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n\r\n // opaque objects\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // transparent objects z prepass\r\n camera.layers.set(gfxutils.LAYERS.PREPASS_TRANSPARENT);\r\n gfx.renderer.getContext().colorMask(false, false, false, false); // don't update color buffer\r\n gfx.renderer.render(gfx.scene, camera);\r\n gfx.renderer.getContext().colorMask(true, true, true, true); // update color buffer\r\n\r\n // transparent objects color pass\r\n camera.layers.set(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // restore default layer\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\nMiew.prototype._performFXAA = (function () {\r\n const _fxaaMaterial = new FXAAMaterial();\r\n\r\n return function (srcBuffer, targetBuffer) {\r\n if (typeof srcBuffer === 'undefined' || typeof targetBuffer === 'undefined') {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n\r\n // clear canvas\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.clear();\r\n\r\n // do fxaa processing of offscreen buff2\r\n _fxaaMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _fxaaMaterial.uniforms.srcTexelSize.value.set(1.0 / srcBuffer.width, 1.0 / srcBuffer.height);\r\n _fxaaMaterial.uniforms.bgColor.value.set(settings.now.bg.color);\r\n\r\n if (_fxaaMaterial.bgTransparent !== settings.now.bg.transparent) {\r\n _fxaaMaterial.setValues({ bgTransparent: settings.now.bg.transparent });\r\n _fxaaMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.renderScreenQuad(_fxaaMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._performAO = (function () {\r\n const _aoMaterial = new AOMaterial();\r\n const _horBlurMaterial = new AOHorBlurMaterial();\r\n const _vertBlurMaterial = new AOVertBlurWithBlendMaterial();\r\n\r\n const _scale = new THREE.Vector3();\r\n return function (srcColorBuffer, normalBuffer, srcDepthTexture, targetBuffer, tempBuffer, tempBuffer1) {\r\n if (!srcColorBuffer || !normalBuffer || !srcDepthTexture || !targetBuffer || !tempBuffer || !tempBuffer1) {\r\n return;\r\n }\r\n const gfx = this._gfx;\r\n const tanHalfFOV = Math.tan(THREE.Math.DEG2RAD * 0.5 * gfx.camera.fov);\r\n\r\n _aoMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _aoMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _aoMaterial.uniforms.normalTexture.value = normalBuffer.texture;\r\n _aoMaterial.uniforms.srcTexelSize.value.set(1.0 / srcColorBuffer.width, 1.0 / srcColorBuffer.height);\r\n _aoMaterial.uniforms.camNearFar.value.set(gfx.camera.near, gfx.camera.far);\r\n _aoMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _aoMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _aoMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n gfx.root.matrix.extractScale(_scale);\r\n _aoMaterial.uniforms.kernelRadius.value = settings.now.debug.ssaoKernelRadius * _scale.x;\r\n _aoMaterial.uniforms.depthThreshold.value = 2.0 * this._getBSphereRadius(); // diameter\r\n _aoMaterial.uniforms.factor.value = settings.now.debug.ssaoFactor;\r\n // N: should be tempBuffer1 for proper use of buffers (see buffers using outside the function)\r\n gfx.renderer.setRenderTarget(tempBuffer1);\r\n gfx.renderer.renderScreenQuad(_aoMaterial);\r\n\r\n _horBlurMaterial.uniforms.aoMap.value = tempBuffer1.texture;\r\n _horBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer1.width, 1.0 / tempBuffer1.height);\r\n _horBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n gfx.renderer.setRenderTarget(tempBuffer);\r\n gfx.renderer.renderScreenQuad(_horBlurMaterial);\r\n\r\n _vertBlurMaterial.uniforms.aoMap.value = tempBuffer.texture;\r\n _vertBlurMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _vertBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer.width, 1.0 / tempBuffer.height);\r\n _vertBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _vertBlurMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _vertBlurMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _vertBlurMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n const { fog } = gfx.scene;\r\n if (fog) {\r\n _vertBlurMaterial.uniforms.fogNearFar.value.set(fog.near, fog.far);\r\n _vertBlurMaterial.uniforms.fogColor.value.set(fog.color.r, fog.color.g, fog.color.b, settings.now.fogAlpha);\r\n }\r\n if ((_vertBlurMaterial.useFog !== settings.now.fog)\r\n || (_vertBlurMaterial.fogTransparent !== settings.now.bg.transparent)) {\r\n _vertBlurMaterial.setValues({ useFog: settings.now.fog, fogTransparent: settings.now.bg.transparent });\r\n _vertBlurMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_vertBlurMaterial);\r\n };\r\n}());\r\n\r\n/**\r\n * Reset the viewer, unload molecules.\r\n * @param {boolean=} keepReps - Keep representations while resetting viewer state.\r\n */\r\nMiew.prototype.reset = function (/* keepReps */) {\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._lastPick = null;\r\n\r\n this._releaseAllVisuals();\r\n\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._resetObjects();\r\n\r\n if (this._gfx) {\r\n gfxutils.clearTree(this._gfx.pivot);\r\n this._gfx.renderer2d.reset();\r\n }\r\n\r\n this.setNeedRender();\r\n};\r\n\r\nMiew.prototype._resetScene = function () {\r\n this._objectControls.reset();\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n this.resetReps();\r\n this.resetPivot();\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype.resetView = function () {\r\n // reset controls\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._resetScene();\r\n\r\n // reset selection\r\n this._forEachComplexVisual((visual) => {\r\n visual.updateSelectionMask({});\r\n visual.rebuildSelectionGeometry();\r\n });\r\n};\r\n\r\nMiew.prototype._export = function (format) {\r\n const TheExporter = _.head(io.exporters.find({ format }));\r\n if (!TheExporter) {\r\n this.logger.error('Could not find suitable exporter for this source');\r\n return Promise.reject(new Error('Could not find suitable exporter for this source'));\r\n }\r\n this.dispatchEvent({ type: 'exporting' });\r\n\r\n if (this._visuals[this._curVisualName] instanceof ComplexVisual) {\r\n let dataSource = null;\r\n if (TheExporter.SourceClass === ComplexVisual) {\r\n dataSource = this._visuals[this._curVisualName];\r\n } else if (TheExporter.SourceClass === Complex) {\r\n dataSource = this._visuals[this._curVisualName]._complex;\r\n }\r\n const exporter = new TheExporter(dataSource, { miewVersion: Miew.VERSION });\r\n return exporter.export().then((data) => data);\r\n }\r\n if (this._visuals[this._curVisualName] instanceof VolumeVisual) {\r\n return Promise.reject(new Error('Sorry, exporter for volume data not implemented yet'));\r\n }\r\n return Promise.reject(new Error('Unexpected format of data'));\r\n};\r\n\r\nconst rePdbId = /^(?:(pdb|cif|mmtf|ccp4|dsn6):\\s*)?(\\d[a-z\\d]{3})$/i;\r\nconst rePubchem = /^(?:pc|pubchem):\\s*([a-z]+)$/i;\r\nconst reUrlScheme = /^([a-z][a-z\\d\\-+.]*):/i;\r\n\r\nfunction resolveSourceShortcut(source, opts) {\r\n if (!_.isString(source)) {\r\n return source;\r\n }\r\n\r\n // e.g. \"mmtf:1CRN\"\r\n const matchesPdbId = rePdbId.exec(source);\r\n if (matchesPdbId) {\r\n let [, format = 'pdb', id] = matchesPdbId;\r\n\r\n format = format.toLowerCase();\r\n id = id.toUpperCase();\r\n\r\n switch (format) {\r\n case 'pdb':\r\n source = `https://files.rcsb.org/download/${id}.pdb`;\r\n break;\r\n case 'cif':\r\n source = `https://files.rcsb.org/download/${id}.cif`;\r\n break;\r\n case 'mmtf':\r\n source = `https://mmtf.rcsb.org/v1.0/full/${id}`;\r\n break;\r\n case 'ccp4':\r\n source = `https://www.ebi.ac.uk/pdbe/coordinates/files/${id.toLowerCase()}.ccp4`;\r\n break;\r\n case 'dsn6':\r\n source = `https://edmaps.rcsb.org/maps/${id.toLowerCase()}_2fofc.dsn6`;\r\n break;\r\n default:\r\n throw new Error('Unexpected data format shortcut');\r\n }\r\n\r\n opts.fileType = format;\r\n opts.fileName = `${id}.${format}`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // e.g. \"pc:aspirin\"\r\n const matchesPubchem = rePubchem.exec(source);\r\n if (matchesPubchem) {\r\n const compound = matchesPubchem[1].toLowerCase();\r\n source = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${compound}/JSON?record_type=3d`;\r\n opts.fileType = 'pubchem';\r\n opts.fileName = `${compound}.json`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // otherwise is should be an URL\r\n if (opts.sourceType === 'url' || opts.sourceType === undefined) {\r\n opts.sourceType = 'url';\r\n\r\n // e.g. \"./data/1CRN.pdb\"\r\n if (!reUrlScheme.test(source)) {\r\n source = utils.resolveURL(source);\r\n }\r\n }\r\n\r\n return source;\r\n}\r\n\r\nfunction updateBinaryMode(opts) {\r\n let { binary } = opts;\r\n\r\n // detect by format\r\n if (opts.fileType !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n } else {\r\n throw new Error('Could not find suitable parser for this format');\r\n }\r\n }\r\n\r\n // detect by file extension\r\n if (binary === undefined && opts.fileExt !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ ext: opts.fileExt }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n }\r\n }\r\n\r\n // temporary workaround for animation\r\n if (opts.fileExt !== undefined && opts.fileExt.toLowerCase() === '.man') {\r\n opts.binary = true;\r\n opts.animation = true; // who cares?\r\n }\r\n\r\n // update if detected\r\n if (binary !== undefined) {\r\n if (opts.binary !== undefined && opts.binary !== binary) {\r\n opts.context.logger.warn('Overriding incorrect binary mode');\r\n }\r\n }\r\n\r\n opts.binary = binary || false;\r\n}\r\n\r\nfunction _fetchData(source, opts, job) {\r\n return new Promise(((resolve) => {\r\n if (job.shouldCancel()) {\r\n throw new Error('Operation cancelled');\r\n }\r\n job.notify({ type: 'fetching' });\r\n\r\n // allow for source shortcuts\r\n source = resolveSourceShortcut(source, opts);\r\n\r\n // detect a proper loader\r\n const TheLoader = _.head(io.loaders.find({ type: opts.sourceType, source }));\r\n if (!TheLoader) {\r\n throw new Error(LOADER_NOT_FOUND);\r\n }\r\n\r\n // split file name\r\n const fileName = opts.fileName || TheLoader.extractName(source);\r\n if (fileName) {\r\n const [name, fileExt] = utils.splitFileName(fileName);\r\n _.defaults(opts, { name, fileExt, fileName });\r\n }\r\n\r\n // should it be text or binary?\r\n updateBinaryMode(opts);\r\n\r\n // FIXME: All new settings retrieved from server are applied after the loading is complete. However, we need some\r\n // flags to alter the loading process itself. Here we apply them in advance. Dirty hack. Kill the server, remove\r\n // all hacks and everybody's happy.\r\n let newOptions = _.get(opts, 'preset.expression');\r\n if (!_.isUndefined(newOptions)) {\r\n newOptions = JSON.parse(newOptions);\r\n if (newOptions && newOptions.settings) {\r\n const keys = ['singleUnit'];\r\n for (let keyIndex = 0, keyCount = keys.length; keyIndex < keyCount; ++keyIndex) {\r\n const key = keys[keyIndex];\r\n const value = _.get(newOptions.settings, key);\r\n if (!_.isUndefined(value)) {\r\n settings.set(key, value);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // create a loader\r\n const loader = new TheLoader(source, opts);\r\n loader.context = opts.context;\r\n job.addEventListener('cancel', () => loader.abort());\r\n\r\n loader.addEventListener('progress', (event) => {\r\n if (event.lengthComputable && event.total > 0) {\r\n reportProgress(loader.logger, 'Fetching', event.loaded / event.total);\r\n } else {\r\n reportProgress(loader.logger, 'Fetching');\r\n }\r\n });\r\n\r\n console.time('fetch');\r\n const promise = loader.load()\r\n .then((data) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.info('Fetching finished');\r\n job.notify({ type: 'fetchingDone', data });\r\n return data;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Fetching failed');\r\n job.notify({ type: 'fetchingDone', error });\r\n throw error;\r\n });\r\n resolve(promise);\r\n }));\r\n}\r\n\r\nfunction _parseData(data, opts, job) {\r\n if (job.shouldCancel()) {\r\n return Promise.reject(new Error('Operation cancelled'));\r\n }\r\n\r\n job.notify({ type: 'parsing' });\r\n\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType, ext: opts.fileExt, data }));\r\n if (!TheParser) {\r\n return Promise.reject(new Error('Could not find suitable parser'));\r\n }\r\n\r\n const parser = new TheParser(data, opts);\r\n parser.context = opts.context;\r\n job.addEventListener('cancel', () => parser.abort());\r\n\r\n console.time('parse');\r\n return parser.parse()\r\n .then((dataSet) => {\r\n console.timeEnd('parse');\r\n job.notify({ type: 'parsingDone', data: dataSet });\r\n return dataSet;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('parse');\r\n opts.error = error;\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Parsing failed');\r\n job.notify({ type: 'parsingDone', error });\r\n throw error;\r\n });\r\n}\r\n\r\n/**\r\n * Load molecule asynchronously.\r\n * @param {string|File} source - Molecule source to load (e.g. PDB ID, URL or File object).\r\n * @param {object=} opts - Options.\r\n * @param {string=} opts.sourceType - Data source type (e.g. 'url', 'file').\r\n * @param {string=} opts.fileType - Data contents type (e.g. 'pdb', 'cml').\r\n * @param {string=} opts.mdFile - .nc file path.\r\n * @param {boolean=} opts.keepRepsInfo - prevent reset of object and reps information.\r\n * @returns {Promise} name of the visual that was added to the viewer\r\n */\r\nMiew.prototype.load = function (source, opts) {\r\n opts = _.merge({}, opts, {\r\n context: this,\r\n });\r\n\r\n // for a single-file scenario\r\n if (!this.settings.now.use.multiFile) {\r\n // abort all loaders in progress\r\n if (this._loading.length) {\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n }\r\n\r\n // reset\r\n if (!opts.animation) { // FIXME: sometimes it is set AFTERWARDS!\r\n this.reset(true);\r\n }\r\n }\r\n\r\n this._interpolator.reset();\r\n\r\n this.dispatchEvent({ type: 'loading', options: opts, source });\r\n\r\n const job = new JobHandle();\r\n this._loading.push(job);\r\n job.addEventListener('notification', (e) => {\r\n this.dispatchEvent(e.slaveEvent);\r\n });\r\n\r\n this._spinner.spin(this._container);\r\n\r\n const onLoadEnd = (anything) => {\r\n const jobIndex = this._loading.indexOf(job);\r\n if (jobIndex !== -1) {\r\n this._loading.splice(jobIndex, 1);\r\n }\r\n this._spinner.stop();\r\n this._refreshTitle();\r\n job.notify({ type: 'loadingDone', anything });\r\n return anything;\r\n };\r\n\r\n return _fetchData(source, opts, job)\r\n .then((data) => _parseData(data, opts, job))\r\n .then((object) => {\r\n const name = this._onLoad(object, opts);\r\n return onLoadEnd(name);\r\n })\r\n .catch((err) => {\r\n this.logger.error('Could not load data');\r\n this.logger.debug(err);\r\n throw onLoadEnd(err);\r\n });\r\n};\r\n\r\n/**\r\n * Unload molecule (delete corresponding visual).\r\n * @param {string=} name - name of the visual\r\n */\r\nMiew.prototype.unload = function (name) {\r\n this._removeVisual(name || this.getCurrentVisual());\r\n this.resetPivot();\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n};\r\n\r\n/**\r\n * Start new animation. Now is broken.\r\n * @param fileData - new data to animate\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._startAnimation = function (fileData) {\r\n this._stopAnimation();\r\n const self = this;\r\n const visual = this._getComplexVisual();\r\n if (visual === null) {\r\n this.logger.error('Unable to start animation - no molecule is loaded.');\r\n return;\r\n }\r\n try {\r\n this._frameInfo = new FrameInfo(\r\n visual.getComplex(), fileData,\r\n {\r\n onLoadStatusChanged() {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo ? self._frameInfo.isLoading : true,\r\n },\r\n });\r\n },\r\n onError(message) {\r\n self._stopAnimation();\r\n self.logger.error(message);\r\n },\r\n },\r\n );\r\n } catch (e) {\r\n this.logger.error('Animation file does not fit to current complex!');\r\n return;\r\n }\r\n this._continueAnimation();\r\n};\r\n\r\n/**\r\n * Pause current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._pauseAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n this._isAnimating = false;\r\n clearInterval(this._animInterval);\r\n this._animInterval = null;\r\n if (this._frameInfo) {\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: this._isAnimating,\r\n isLoading: this._frameInfo.isLoading,\r\n },\r\n });\r\n }\r\n};\r\n\r\n/**\r\n * Continue current animation after pausing. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._continueAnimation = function () {\r\n this._isAnimating = true;\r\n let minFrameTime = 1000 / settings.now.maxfps;\r\n minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime;\r\n const self = this;\r\n const { pivot } = self._gfx;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.resetSelectionMask();\r\n visual.rebuildSelectionGeometry();\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n }\r\n this._animInterval = setInterval(() => {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo.isLoading,\r\n },\r\n });\r\n if (self._frameInfo.frameIsReady) {\r\n pivot.updateToFrame(self._frameInfo);\r\n self._updateObjsToFrame(self._frameInfo);\r\n self._refreshTitle(` Frame ${self._frameInfo._currFrame} of ${self._frameInfo._framesCount\r\n } time interval - ${self._frameInfo._timeStep}`);\r\n try {\r\n self._frameInfo.nextFrame();\r\n } catch (e) {\r\n self.logger.error('Error during animation');\r\n self._stopAnimation();\r\n return;\r\n }\r\n self._needRender = true;\r\n }\r\n }, minFrameTime);\r\n};\r\n\r\n/**\r\n * Stop current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._stopAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n clearInterval(this._animInterval);\r\n this._frameInfo.disableEvents();\r\n this._frameInfo = null;\r\n this._animInterval = null;\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: null,\r\n });\r\n};\r\n\r\n/**\r\n * Invoked upon successful loading of some data source\r\n * @param {DataSource} dataSource - Data source for visualization (molecular complex or other)\r\n * @param {object} opts - Options.\r\n * @private\r\n */\r\nMiew.prototype._onLoad = function (dataSource, opts) {\r\n const gfx = this._gfx;\r\n let visualName = null;\r\n\r\n if (opts.animation) {\r\n this._refreshTitle();\r\n this._startAnimation(dataSource);\r\n return null;\r\n }\r\n this._stopAnimation();\r\n if (!opts || !opts.keepRepsInfo) {\r\n this._opts.reps = null;\r\n this._opts._objects = null;\r\n }\r\n\r\n\r\n if (dataSource.id === 'Complex') {\r\n const complex = dataSource;\r\n\r\n // update title\r\n if (opts.fileName) {\r\n complex.name = complex.name || removeExtension(opts.fileName).toUpperCase();\r\n } else if (opts.amberFileName) {\r\n complex.name = complex.name || removeExtension(opts.amberFileName).toUpperCase();\r\n } else {\r\n complex.name = `Dynamic ${opts.fileType} molecule`;\r\n }\r\n\r\n visualName = this._addVisual(new ComplexVisual(complex.name, complex));\r\n this._curVisualName = visualName;\r\n\r\n const desc = this.info();\r\n this.logger.info(`Parsed ${opts.fileName} (${\r\n desc.atoms} atoms, ${\r\n desc.bonds} bonds, ${\r\n desc.residues} residues, ${\r\n desc.chains} chains).`);\r\n\r\n if (_.isNumber(this._opts.unit)) {\r\n complex.setCurrentUnit(this._opts.unit);\r\n }\r\n\r\n if (opts.preset) {\r\n // ...removed server access...\r\n } else if (settings.now.autoPreset) {\r\n switch (opts.fileType) {\r\n case 'cml':\r\n this.resetReps('small');\r\n break;\r\n case 'pdb':\r\n case 'mmtf':\r\n case 'cif':\r\n if (hasValidResidues(complex)) {\r\n this.resetReps('macro');\r\n } else {\r\n this.resetReps('small');\r\n }\r\n break;\r\n default:\r\n this.resetReps('default');\r\n break;\r\n }\r\n } else {\r\n this.resetReps('default');\r\n }\r\n } else if (dataSource.id === 'Volume') {\r\n this.resetEd();\r\n visualName = this._onLoadEd(dataSource);\r\n }\r\n\r\n gfx.camera.updateProjectionMatrix();\r\n this._updateFog();\r\n\r\n // reset global transform\r\n gfx.root.resetTransform();\r\n this.resetPivot();\r\n\r\n // set scale to fit everything on the screen\r\n this._objectControls.setScale(settings.now.radiusToFit / this._getBSphereRadius());\r\n\r\n this._resetObjects();\r\n\r\n if (settings.now.autoResolution) {\r\n this._tweakResolution();\r\n }\r\n\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n this._refreshTitle();\r\n\r\n return visualName;\r\n};\r\n\r\nMiew.prototype.resetEd = function () {\r\n if (this._edLoader) {\r\n this._edLoader.abort();\r\n this._edLoader = null;\r\n }\r\n\r\n // free all resources\r\n this._removeVisual(this._getVolumeVisual());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype.loadEd = function (source) {\r\n this.resetEd();\r\n\r\n const TheLoader = _.head(io.loaders.find({ source }));\r\n if (!TheLoader) {\r\n this.logger.error(LOADER_NOT_FOUND);\r\n return Promise.reject(new Error(LOADER_NOT_FOUND));\r\n }\r\n\r\n const loader = this._edLoader = new TheLoader(source, { binary: true });\r\n loader.context = this;\r\n return loader.load().then((data) => {\r\n const TheParser = _.head(io.parsers.find({ format: 'ccp4' }));\r\n if (!TheParser) {\r\n throw new Error(PARSER_NOT_FOUND);\r\n }\r\n const parser = new TheParser(data);\r\n parser.context = this;\r\n return parser.parse().then((dataSource) => {\r\n this._onLoadEd(dataSource);\r\n });\r\n }).catch((error) => {\r\n this.logger.error('Could not load ED data');\r\n this.logger.debug(error);\r\n });\r\n};\r\n\r\nMiew.prototype._onLoadEd = function (dataSource) {\r\n dataSource.normalize();\r\n\r\n const volumeVisual = new VolumeVisual('volume', dataSource);\r\n volumeVisual.getMesh().layers.set(gfxutils.LAYERS.VOLUME); // volume mesh is not visible to common render\r\n const visualName = this._addVisual(volumeVisual);\r\n\r\n this._needRender = true;\r\n return visualName;\r\n};\r\n\r\nMiew.prototype._needRebuild = function () {\r\n let needsRebuild = false;\r\n this._forEachComplexVisual((visual) => {\r\n needsRebuild = needsRebuild || visual.needsRebuild();\r\n });\r\n return needsRebuild;\r\n};\r\n\r\nMiew.prototype._rebuildObjects = function () {\r\n const self = this;\r\n const gfx = this._gfx;\r\n let i;\r\n let n;\r\n\r\n // remove old object geometry\r\n const toRemove = [];\r\n for (i = 0; i < gfx.pivot.children.length; ++i) {\r\n const child = gfx.pivot.children[i];\r\n if (!(child instanceof Visual)) {\r\n toRemove.push(child);\r\n }\r\n }\r\n for (i = 0; i < toRemove.length; ++i) {\r\n toRemove[i].parent.remove(toRemove[i]);\r\n }\r\n\r\n setTimeout(() => {\r\n const objList = self._objects;\r\n for (i = 0, n = objList.length; i < n; ++i) {\r\n const obj = objList[i];\r\n if (obj.needsRebuild) {\r\n obj.build();\r\n }\r\n if (obj.getGeometry()) {\r\n gfx.pivot.add(obj.getGeometry());\r\n }\r\n }\r\n }, 10);\r\n};\r\n\r\nMiew.prototype.changeUnit = function (unitIdx, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n throw new Error('There is no complex to change!');\r\n }\r\n\r\n function currentUnitInfo() {\r\n const unit = visual ? visual.getComplex().getCurrentUnit() : 0;\r\n const type = unit > 0 ? (`Bio molecule ${unit}`) : 'Asymmetric unit';\r\n return `Current unit: ${unit} (${type})`;\r\n }\r\n\r\n if (unitIdx === undefined) {\r\n return currentUnitInfo();\r\n }\r\n if (_.isString(unitIdx)) {\r\n unitIdx = Math.max(parseInt(unitIdx, 10), 0);\r\n }\r\n if (visual.getComplex().setCurrentUnit(unitIdx)) {\r\n this._resetScene();\r\n this._updateInfoPanel();\r\n }\r\n return currentUnitInfo();\r\n};\r\n\r\n/**\r\n * Start to rebuild geometry asynchronously.\r\n */\r\nMiew.prototype.rebuild = function () {\r\n if (this._building) {\r\n this.logger.warn('Miew.rebuild(): already building!');\r\n return;\r\n }\r\n this._building = true;\r\n\r\n this.dispatchEvent({ type: 'rebuilding' });\r\n\r\n this._rebuildObjects();\r\n\r\n this._gfx.renderer2d.reset();\r\n\r\n const rebuildActions = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.needsRebuild()) {\r\n rebuildActions.push(visual.rebuild().then(() => new Promise(((resolve) => {\r\n visual.rebuildSelectionGeometry();\r\n resolve();\r\n }))));\r\n }\r\n });\r\n\r\n // Start asynchronous rebuild\r\n const self = this;\r\n this._spinner.spin(this._container);\r\n Promise.all(rebuildActions).then(() => {\r\n self._spinner.stop();\r\n\r\n\r\n self._needRender = true;\r\n\r\n self._refreshTitle();\r\n this.dispatchEvent({ type: 'buildingDone' });\r\n self._building = false;\r\n });\r\n};\r\n\r\n/** Mark all representations for rebuilding */\r\nMiew.prototype.rebuildAll = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setNeedsRebuild();\r\n });\r\n};\r\n\r\nMiew.prototype._refreshTitle = function (appendix) {\r\n let title;\r\n appendix = appendix === undefined ? '' : appendix;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n title = visual.getComplex().name;\r\n const rep = visual.repGet(visual.repCurrent());\r\n title += (rep ? ` – ${rep.mode.name} Mode` : '');\r\n } else {\r\n title = Object.keys(this._visuals).length > 0 ? 'Unknown' : 'No Data';\r\n }\r\n title += appendix;\r\n\r\n this.dispatchEvent({ type: 'titleChanged', data: title });\r\n};\r\n\r\nMiew.prototype.setNeedRender = function () {\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._extractRepresentation = function () {\r\n const changed = [];\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCount() === 0) {\r\n return;\r\n }\r\n\r\n const selector = visual.buildSelectorFromMask(1 << visual.getSelectionBit());\r\n const defPreset = settings.now.presets.default;\r\n const res = visual.repAdd({\r\n selector,\r\n mode: defPreset[0].mode.id,\r\n colorer: defPreset[0].colorer.id,\r\n material: defPreset[0].material.id,\r\n });\r\n if (!res) {\r\n if (visual.repCount() === ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n this.logger.warn(`Number of representations is limited to ${ComplexVisual.NUM_REPRESENTATION_BITS}`);\r\n }\r\n return;\r\n }\r\n\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n visual.repCurrent(res.index);\r\n\r\n changed.push(visual.name);\r\n });\r\n\r\n if (changed.length > 0) {\r\n this.logger.report(`New representation from selection for complexes: ${changed.join(', ')}`);\r\n }\r\n};\r\n\r\n/**\r\n * Change current representation list.\r\n * @param {array} reps - Representation list.\r\n */\r\nMiew.prototype._setReps = function (reps) {\r\n reps = reps || (this._opts && this._opts.reps) || [];\r\n this._forEachComplexVisual((visual) => visual.resetReps(reps));\r\n};\r\n\r\n/**\r\n * Apply existing preset to current scene.\r\n * @param preset\r\n */\r\nMiew.prototype.applyPreset = function (preset) {\r\n const { presets } = settings.now;\r\n const presList = [\r\n preset || settings.defaults.preset,\r\n settings.defaults.preset,\r\n Object.keys(presets)[0],\r\n ];\r\n let reps = null;\r\n for (let i = 0; !reps && i < presList.length; ++i) {\r\n settings.set('preset', presList[i]);\r\n reps = presets[settings.now.preset];\r\n if (!reps) {\r\n this.logger.warn(`Unknown preset \"${settings.now.preset}\"`);\r\n }\r\n }\r\n this._setReps(reps);\r\n};\r\n\r\n/**\r\n * Reset current representation list to initial values.\r\n * @param {string} [preset] - The source preset in case of uninitialized representation list.\r\n */\r\nMiew.prototype.resetReps = function (preset) {\r\n const reps = this._opts && this._opts.reps;\r\n if (reps) {\r\n this._setReps(reps);\r\n } else {\r\n this.applyPreset(preset);\r\n }\r\n};\r\n\r\n/**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\nMiew.prototype.repCount = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repCount() : 0;\r\n};\r\n\r\n/**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {string=} [name] - Complex name. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\nMiew.prototype.repCurrent = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n const newIdx = visual ? visual.repCurrent(index) : -1;\r\n if (index && newIdx !== index) {\r\n this.logger.warn(`Representation ${index} was not found. Current rep remains unchanged.`);\r\n }\r\n return newIdx;\r\n};\r\n\r\n/**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {?object} Representation description.\r\n */\r\nMiew.prototype.rep = function (index, rep) {\r\n const visual = this._getComplexVisual('');\r\n if (!visual) {\r\n return null;\r\n }\r\n const res = visual.rep(index, rep);\r\n if (res.status === 'created') {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n } else if (res.status === 'changed') {\r\n this.dispatchEvent({ type: 'repChanged', index: res.index, name: visual.name });\r\n }\r\n return res.desc;\r\n};\r\n\r\n/**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\nMiew.prototype.repGet = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repGet(index) : null;\r\n};\r\n\r\n/**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {number} Index of the new representation.\r\n */\r\nMiew.prototype.repAdd = function (rep, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return -1;\r\n }\r\n\r\n const res = visual.repAdd(rep);\r\n if (res) {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name });\r\n return res.index;\r\n }\r\n return -1;\r\n};\r\n\r\n/**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\nMiew.prototype.repRemove = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n visual.repRemove(index);\r\n this.dispatchEvent({ type: 'repRemoved', index, name });\r\n};\r\n\r\n/**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\nMiew.prototype.repHide = function (index, hide, name) {\r\n this._needRender = true;\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repHide(index, hide) : null;\r\n};\r\n\r\nMiew.prototype._setEditMode = function (mode) {\r\n this._editMode = mode;\r\n\r\n const elem = this._msgMode;\r\n if (elem) {\r\n elem.style.opacity = (mode === EDIT_MODE.COMPLEX) ? 0.0 : 1.0;\r\n\r\n if (mode !== EDIT_MODE.COMPLEX) {\r\n const t = elem.getElementsByTagName('p')[0];\r\n t.innerHTML = (mode === EDIT_MODE.COMPONENT) ? 'COMPONENT EDIT MODE' : 'FRAGMENT EDIT MODE';\r\n }\r\n }\r\n\r\n this.dispatchEvent({ type: 'editModeChanged', data: mode === EDIT_MODE.COMPLEX });\r\n};\r\n\r\nMiew.prototype._enterComponentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const editors = [];\r\n this._forEachComplexVisual((visual) => {\r\n const editor = visual.beginComponentEdit();\r\n if (editor) {\r\n editors.push(editor);\r\n }\r\n });\r\n\r\n if (editors === []) {\r\n return;\r\n }\r\n\r\n this._editors = editors;\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- ON');\r\n this._setEditMode(EDIT_MODE.COMPONENT);\r\n this._objectControls.keysTranslateObj(true);\r\n};\r\n\r\nMiew.prototype._applyComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._needRender = true;\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._enterFragmentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const selectedVisuals = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual instanceof ComplexVisual\r\n && visual.getSelectionCount() > 0) {\r\n selectedVisuals.push(visual);\r\n }\r\n });\r\n\r\n if (selectedVisuals.length !== 1) {\r\n // either we have no selection or\r\n // we have selected atoms in two or more visuals -- not supported\r\n return;\r\n }\r\n\r\n const editor = selectedVisuals[0].beginFragmentEdit();\r\n if (!editor) {\r\n return;\r\n }\r\n this._editors = [editor];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- ON (single bond)');\r\n this._setEditMode(EDIT_MODE.FRAGMENT);\r\n this._objectControls.allowTranslation(false);\r\n this._objectControls.allowAltObjFreeRotation(editor.isFreeRotationAllowed());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._applyFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onPick = function (event) {\r\n if (!settings.now.picking) {\r\n // picking is disabled\r\n return;\r\n }\r\n\r\n if (this._animInterval !== null) {\r\n // animation playback is on\r\n return;\r\n }\r\n\r\n if (this._editMode === EDIT_MODE.FRAGMENT) {\r\n // prevent picking in fragment edit mode\r\n return;\r\n }\r\n\r\n if (this._objectControls.isEditingAltObj()) {\r\n // prevent picking during component rotation\r\n return;\r\n }\r\n\r\n // update last pick & find complex\r\n let complex = null;\r\n if (event.obj.atom) {\r\n complex = event.obj.atom.residue.getChain().getComplex();\r\n this._lastPick = event.obj.atom;\r\n } else if (event.obj.residue) {\r\n complex = event.obj.residue.getChain().getComplex();\r\n this._lastPick = event.obj.residue;\r\n } else if (event.obj.chain) {\r\n complex = event.obj.chain.getComplex();\r\n this._lastPick = event.obj.chain;\r\n } else if (event.obj.molecule) {\r\n complex = event.obj.molecule.complex;\r\n this._lastPick = event.obj.molecule;\r\n } else {\r\n this._lastPick = null;\r\n }\r\n\r\n function _updateSelection(visual) {\r\n visual.updateSelectionMask(event.obj);\r\n visual.rebuildSelectionGeometry();\r\n }\r\n\r\n // update visual\r\n if (complex) {\r\n const visual = this._getVisualForComplex(complex);\r\n if (visual) {\r\n _updateSelection(visual);\r\n this._needRender = true;\r\n }\r\n } else {\r\n this._forEachComplexVisual(_updateSelection);\r\n this._needRender = true;\r\n }\r\n\r\n this._updateInfoPanel();\r\n this.dispatchEvent(event);\r\n};\r\n\r\nMiew.prototype._onKeyDown = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n switch (event.keyCode) {\r\n case 'C'.charCodeAt(0):\r\n if (settings.now.editing) {\r\n this._enterComponentEditMode();\r\n }\r\n break;\r\n case 'F'.charCodeAt(0):\r\n if (settings.now.editing) {\r\n this._enterFragmentEditMode();\r\n }\r\n break;\r\n case 'A'.charCodeAt(0):\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._applyComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._applyFragmentEdit();\r\n break;\r\n default: break;\r\n }\r\n break;\r\n case 'D'.charCodeAt(0):\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._discardComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._discardFragmentEdit();\r\n break;\r\n default: break;\r\n }\r\n break;\r\n case 'S'.charCodeAt(0):\r\n event.preventDefault();\r\n event.stopPropagation();\r\n settings.set('ao', !settings.now.ao);\r\n this._needRender = true;\r\n break;\r\n case 107:\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.expandSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n break;\r\n case 109:\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.shrinkSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nMiew.prototype._onKeyUp = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n if (event.keyCode === 'X'.charCodeAt(0)) {\r\n this._extractRepresentation();\r\n }\r\n};\r\n\r\nMiew.prototype._updateInfoPanel = function () {\r\n const info = this._msgAtomInfo.getElementsByTagName('p')[0];\r\n let atom;\r\n let residue;\r\n\r\n let count = 0;\r\n this._forEachComplexVisual((visual) => {\r\n count += visual.getSelectionCount();\r\n });\r\n\r\n while (info.firstChild) {\r\n info.removeChild(info.firstChild);\r\n }\r\n\r\n if (count === 0) {\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n return;\r\n }\r\n\r\n let firstLine = `${String(count)} atom${count !== 1 ? 's' : ''} selected`;\r\n if (this._lastPick !== null) {\r\n firstLine += ', the last pick:';\r\n }\r\n let secondLine = '';\r\n let aName = '';\r\n let coordLine = '';\r\n\r\n if (this._lastPick instanceof Atom) {\r\n atom = this._lastPick;\r\n residue = atom.residue;\r\n\r\n aName = atom.name;\r\n const location = (atom.location !== 32) ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space\r\n secondLine = `${atom.element.fullName} #${atom.serial}${location}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}.`;\r\n secondLine += aName;\r\n\r\n coordLine = `Coord: (${atom.position.x.toFixed(2).toString()},\\\r\n ${atom.position.y.toFixed(2).toString()},\\\r\n ${atom.position.z.toFixed(2).toString()})`;\r\n } else if (this._lastPick instanceof Residue) {\r\n residue = this._lastPick;\r\n\r\n secondLine = `${residue._type._fullName}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}`;\r\n } else if (this._lastPick instanceof Chain) {\r\n secondLine = `chain ${this._lastPick._name}`;\r\n } else if (this._lastPick instanceof Molecule) {\r\n secondLine = `molecule ${this._lastPick._name}`;\r\n }\r\n\r\n info.appendChild(document.createTextNode(firstLine));\r\n\r\n if (secondLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(secondLine));\r\n }\r\n\r\n if (coordLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(coordLine));\r\n }\r\n\r\n this._msgAtomInfo.style.opacity = 1.0;\r\n};\r\n\r\nMiew.prototype._getAltObj = function () {\r\n if (this._editors) {\r\n let altObj = null;\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n const nextAltObj = this._editors[i].getAltObj();\r\n if (nextAltObj.objects.length > 0) {\r\n if (altObj) {\r\n // we have selected atoms in two or more visuals -- not supported\r\n altObj = null;\r\n break;\r\n }\r\n altObj = nextAltObj;\r\n }\r\n }\r\n if (altObj) {\r\n return altObj;\r\n }\r\n }\r\n\r\n return {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n};\r\n\r\nMiew.prototype.resetPivot = (function () {\r\n const boundingBox = new THREE.Box3();\r\n const center = new THREE.Vector3();\r\n\r\n return function () {\r\n boundingBox.makeEmpty();\r\n this._forEachVisual((visual) => {\r\n boundingBox.union(visual.getBoundaries().boundingBox);\r\n });\r\n\r\n boundingBox.getCenter(center);\r\n this._objectControls.setPivot(center.negate());\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotResidue = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (residue) {\r\n const visual = this._getVisualForComplex(residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n if (residue._controlPoint) {\r\n center.copy(residue._controlPoint);\r\n } else {\r\n let x = 0;\r\n let y = 0;\r\n let z = 0;\r\n const amount = residue._atoms.length;\r\n for (let i = 0; i < amount; ++i) {\r\n const p = residue._atoms[i].position;\r\n x += p.x / amount;\r\n y += p.y / amount;\r\n z += p.z / amount;\r\n }\r\n center.set(x, y, z);\r\n }\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotAtom = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (atom) {\r\n const visual = this._getVisualForComplex(atom.residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n center.copy(atom.position);\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.getSelectionCenter = (function () {\r\n const _centerInVisual = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n return function (center, includesAtom, selector) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCenter(_centerInVisual, includesAtom, selector || visual.getSelectionBit())) {\r\n center.add(_centerInVisual);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.negate();\r\n return true;\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotSubset = (function () {\r\n const _center = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n function _includesInCurSelection(atom, selectionBit) {\r\n return atom.mask & (1 << selectionBit);\r\n }\r\n\r\n function _includesInSelector(atom, selector) {\r\n return selector.selector.includesAtom(atom);\r\n }\r\n\r\n return function (selector) {\r\n const includesAtom = (selector) ? _includesInSelector : _includesInCurSelection;\r\n\r\n if (this.getSelectionCenter(_center, includesAtom, selector)) {\r\n this._objectControls.setPivot(_center);\r\n this.dispatchEvent({ type: 'transform' });\r\n } else {\r\n this.logger.warn('selection is empty. Center operation not performed');\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Makes a screenshot.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n * @returns {string} Data URL representing the image contents.\r\n */\r\nMiew.prototype.screenshot = function (width, height) {\r\n const gfx = this._gfx;\r\n const deviceWidth = gfx.renderer.domElement.width;\r\n const deviceHeight = gfx.renderer.domElement.height;\r\n\r\n function fov2Tan(fov) {\r\n return Math.tan(THREE.Math.degToRad(0.5 * fov));\r\n }\r\n\r\n function tan2Fov(tan) {\r\n return THREE.Math.radToDeg(Math.atan(tan)) * 2.0;\r\n }\r\n\r\n function getDataURL() {\r\n let dataURL;\r\n const currBrowser = utils.getBrowser();\r\n\r\n if (currBrowser === utils.browserType.SAFARI) {\r\n const canvas = document.createElement('canvas');\r\n const canvasContext = canvas.getContext('2d');\r\n\r\n canvas.width = width === undefined ? deviceWidth : width;\r\n canvas.height = height === undefined ? deviceHeight : height;\r\n\r\n canvasContext.drawImage(gfx.renderer.domElement, 0, 0, canvas.width, canvas.height);\r\n dataURL = canvas.toDataURL('image/png');\r\n } else {\r\n // Copy current canvas to screenshot\r\n dataURL = gfx.renderer.domElement.toDataURL('image/png');\r\n }\r\n return dataURL;\r\n }\r\n height = height || width;\r\n\r\n let screenshotURI;\r\n if ((width === undefined && height === undefined)\r\n || (width === deviceWidth && height === deviceHeight)) {\r\n // renderer.domElement.toDataURL('image/png') returns flipped image in Safari\r\n // It hasn't been resolved yet, but getScreenshotSafari()\r\n // fixes it using an extra canvas.\r\n screenshotURI = getDataURL();\r\n } else {\r\n const originalAspect = gfx.camera.aspect;\r\n const originalFov = gfx.camera.fov;\r\n const originalTanFov2 = fov2Tan(gfx.camera.fov);\r\n\r\n // screenshot should contain the principal area of interest (a centered square touching screen sides)\r\n const areaOfInterestSize = Math.min(gfx.width, gfx.height);\r\n const areaOfInterestTanFov2 = originalTanFov2 * areaOfInterestSize / gfx.height;\r\n\r\n // set appropriate camera aspect & FOV\r\n const shotAspect = width / height;\r\n gfx.renderer.setPixelRatio(1);\r\n gfx.camera.aspect = shotAspect;\r\n gfx.camera.fov = tan2Fov(areaOfInterestTanFov2 / Math.min(shotAspect, 1.0));\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n // resize canvas to the required size of screenshot\r\n gfx.renderer.setDrawingBufferSize(width, height, 1);\r\n\r\n // make screenshot\r\n this._renderFrame(settings.now.stereo);\r\n screenshotURI = getDataURL();\r\n\r\n // restore original camera & canvas proportions\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.camera.aspect = originalAspect;\r\n gfx.camera.fov = originalFov;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.renderer.setDrawingBufferSize(gfx.width, gfx.height, window.devicePixelRatio);\r\n this._needRender = true;\r\n }\r\n\r\n return screenshotURI;\r\n};\r\n\r\n/**\r\n * Makes screenshot and initiates a download.\r\n * @param {string} [filename] - Name of a file. Default to a 'screenshot-XXXXX.png', where XXXXX is a current\r\n * date/time in seconds.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n */\r\nMiew.prototype.screenshotSave = function (filename, width, height) {\r\n const uri = this.screenshot(width, height);\r\n utils.shotDownload(uri, filename);\r\n};\r\n\r\nMiew.prototype.save = function (opts) {\r\n this._export(opts.fileType).then((dataString) => {\r\n const filename = this._visuals[this._curVisualName]._complex.name;\r\n utils.download(dataString, filename, opts.fileType);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone' });\r\n }).catch((error) => {\r\n this.logger.error('Could not export data');\r\n this.logger.debug(error);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone', error });\r\n });\r\n};\r\n\r\nMiew.prototype._tweakResolution = function () {\r\n const maxPerf = [\r\n ['poor', 100],\r\n ['low', 500],\r\n ['medium', 1000],\r\n ['high', 5000],\r\n ['ultra', Number.MAX_VALUE],\r\n ];\r\n\r\n let atomCount = 0;\r\n this._forEachComplexVisual((visual) => {\r\n atomCount += visual.getComplex().getAtomCount();\r\n });\r\n\r\n if (atomCount > 0) {\r\n const performance = this._gfxScore * 10e5 / atomCount;\r\n // set resolution based on estimated performance\r\n for (let i = 0; i < maxPerf.length; ++i) {\r\n if (performance < maxPerf[i][1]) {\r\n this._autoChangeResolution(maxPerf[i][0]);\r\n break;\r\n }\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._autoChangeResolution = function (resolution) {\r\n if (resolution !== settings.now.resolution) {\r\n this.logger.report(`Your rendering resolution was changed to \"${resolution}\" for best performance.`);\r\n }\r\n settings.now.resolution = resolution;\r\n};\r\n\r\n/**\r\n * Save current settings to cookies.\r\n */\r\nMiew.prototype.saveSettings = function () {\r\n this._cookies.setCookie(this._opts.settingsCookie, JSON.stringify(this.settings.getDiffs(true)));\r\n};\r\n\r\n/**\r\n * Load settings from cookies.\r\n */\r\nMiew.prototype.restoreSettings = function () {\r\n try {\r\n const cookie = this._cookies.getCookie(this._opts.settingsCookie);\r\n const diffs = cookie ? JSON.parse(cookie) : {};\r\n this.settings.applyDiffs(diffs, true);\r\n } catch (e) {\r\n this.logger.error(`Cookies parse error: ${e.message}`);\r\n }\r\n};\r\n\r\n/**\r\n * Reset current settings to the defaults.\r\n */\r\nMiew.prototype.resetSettings = function () {\r\n this.settings.reset();\r\n};\r\n\r\n/*\r\n * DANGEROUS and TEMPORARY. The method should change or disappear in future versions.\r\n * @param {string|object} opts - See {@link Miew} constructor.\r\n * @see {@link Miew#set}, {@link Miew#repAdd}, {@link Miew#rep}.\r\n */\r\nMiew.prototype.setOptions = function (opts) {\r\n if (typeof opts === 'string') {\r\n opts = Miew.options.fromAttr(opts);\r\n }\r\n if (opts.reps) {\r\n this._opts.reps = null;\r\n }\r\n _.merge(this._opts, opts);\r\n if (opts.settings) {\r\n this.set(opts.settings);\r\n }\r\n\r\n this._opts._objects = opts._objects;\r\n this._resetObjects();\r\n\r\n if (opts.load) {\r\n this.load(opts.load, { fileType: opts.type });\r\n }\r\n\r\n if (opts.preset) {\r\n settings.now.preset = opts.preset;\r\n }\r\n\r\n if (opts.reps) {\r\n this.resetReps(opts.preset);\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.getComplex().resetCurrentUnit();\r\n if (_.isNumber(opts.unit)) {\r\n visual.getComplex().setCurrentUnit(opts.unit);\r\n }\r\n this.resetView();\r\n this.rebuildAll();\r\n }\r\n};\r\n\r\nMiew.prototype.info = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return {};\r\n }\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n return {\r\n id: metadata.id || complex.name || 'UNKNOWN',\r\n title: (metadata.title && metadata.title.join(' ')) || 'UNKNOWN DATA',\r\n atoms: complex.getAtomCount(),\r\n bonds: complex.getBondCount(),\r\n residues: complex.getResidueCount(),\r\n chains: complex.getChainCount(),\r\n };\r\n};\r\n\r\n/*\r\n * OBJECTS SEGMENT\r\n */\r\n\r\nMiew.prototype.addObject = function (objData, bThrow) {\r\n let Ctor = null;\r\n\r\n if (objData.type === LinesObject.prototype.type) {\r\n Ctor = LinesObject;\r\n }\r\n\r\n if (Ctor === null) {\r\n throw new Error(`Unknown scene object type - ${objData.type}`);\r\n }\r\n\r\n try {\r\n const newObj = new Ctor(objData.params, objData.opts);\r\n this._addSceneObject(newObj);\r\n } catch (error) {\r\n if (!bThrow) {\r\n this.logger.debug(`Error during scene object creation: ${error.message}`);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._addSceneObject = function (sceneObject) {\r\n const visual = this._getComplexVisual();\r\n if (sceneObject.build && visual) {\r\n sceneObject.build(visual.getComplex());\r\n this._gfx.pivot.add(sceneObject.getGeometry());\r\n }\r\n const objects = this._objects;\r\n objects[objects.length] = sceneObject;\r\n};\r\n\r\nMiew.prototype._updateObjsToFrame = function (frameData) {\r\n const objs = this._objects;\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n if (objs[i].updateToFrame) {\r\n objs[i].updateToFrame(frameData);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._resetObjects = function () {\r\n const objs = this._opts._objects;\r\n\r\n this._objects = [];\r\n if (objs) {\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n this.addObject(objs[i], false);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype.removeObject = function (index) {\r\n const obj = this._objects[index];\r\n if (!obj) {\r\n throw new Error(`Scene object with index ${index} does not exist`);\r\n }\r\n obj.destroy();\r\n this._objects.splice(index, 1);\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Get a string with a URL to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {string} URL\r\n */\r\nMiew.prototype.getURL = function (opts) {\r\n return options.toURL(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n })));\r\n};\r\n\r\n/**\r\n * Get a string with a script to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=true] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=true] - when this flag is true, a view information is included\r\n * @returns {string} script\r\n */\r\nMiew.prototype.getScript = function (opts) {\r\n return options.toScript(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: true,\r\n view: true,\r\n })));\r\n};\r\n\r\n/*\r\n * Generates object that represents the current state of representations list\r\n * @param {boolean} compareWithDefaults - when this flag is true, reps list is compared (if possible)\r\n * to preset's defaults and only diffs are generated\r\n */\r\nMiew.prototype._compareReps = function (complexVisual, compareWithDefaults) {\r\n const ans = {};\r\n let repCount = 0;\r\n\r\n if (complexVisual) {\r\n repCount = complexVisual.repCount();\r\n }\r\n\r\n const currPreset = settings.defaults.presets[settings.now.preset];\r\n let compare = compareWithDefaults;\r\n if (currPreset === undefined || currPreset.length > repCount) {\r\n compare = false;\r\n ans.preset = 'empty';\r\n } else if (settings.now.preset !== settings.defaults.preset) {\r\n ans.preset = settings.now.preset;\r\n }\r\n\r\n const repsDiff = [];\r\n let emptyReps = true;\r\n for (let i = 0, n = repCount; i < n; ++i) {\r\n repsDiff[i] = complexVisual.repGet(i).compare(compare ? currPreset[i] : null);\r\n if (!_.isEmpty(repsDiff[i])) {\r\n emptyReps = false;\r\n }\r\n }\r\n if (!emptyReps) {\r\n ans.reps = repsDiff;\r\n }\r\n return ans;\r\n};\r\n\r\n/*\r\n * Obtain object that represents current state of miew (might be used as options in constructor).\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {Object} State object.\r\n */\r\nMiew.prototype.getState = function (opts) {\r\n const state = {};\r\n\r\n opts = _.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n });\r\n\r\n // load\r\n const visual = this._getComplexVisual();\r\n if (visual !== null) {\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n if (metadata.id) {\r\n const format = metadata.format ? `${metadata.format}:` : '';\r\n state.load = format + metadata.id;\r\n }\r\n const unit = complex.getCurrentUnit();\r\n if (unit !== 1) {\r\n state.unit = unit;\r\n }\r\n }\r\n\r\n // representations\r\n const repsInfo = this._compareReps(visual, opts.compact);\r\n if (repsInfo.preset) {\r\n state.preset = repsInfo.preset;\r\n }\r\n\r\n if (repsInfo.reps) {\r\n state.reps = repsInfo.reps;\r\n }\r\n\r\n // objects\r\n const objects = this._objects;\r\n const objectsState = [];\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n objectsState[i] = objects[i].identify();\r\n }\r\n if (objects.length > 0) {\r\n state._objects = objectsState;\r\n }\r\n\r\n // view\r\n if (opts.view) {\r\n state.view = this.view();\r\n }\r\n\r\n // settings\r\n if (opts.settings) {\r\n const diff = this.settings.getDiffs(false);\r\n if (!_.isEmpty(diff)) {\r\n state.settings = diff;\r\n }\r\n }\r\n\r\n return state;\r\n};\r\n\r\n/**\r\n * Get parameter value.\r\n * @param {string} param - Parameter name or path (e.g. 'modes.BS.atom').\r\n * @param {*=} value - Default value.\r\n * @returns {*} Parameter value.\r\n */\r\nMiew.prototype.get = function (param, value) {\r\n return settings.get(param, value);\r\n};\r\n\r\nMiew.prototype._clipPlaneUpdateValue = function (radius) {\r\n const clipPlaneValue = Math.max(\r\n this._gfx.camera.position.z - radius * settings.now.draft.clipPlaneFactor,\r\n settings.now.camNear,\r\n );\r\n\r\n const opts = { clipPlaneValue };\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions(opts);\r\n });\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setUberOptions(opts);\r\n }\r\n }\r\n if (this._picker !== null) {\r\n this._picker.clipPlaneValue = clipPlaneValue;\r\n }\r\n};\r\n\r\nMiew.prototype._fogFarUpdateValue = function () {\r\n if (this._picker !== null) {\r\n if (this._gfx.scene.fog) {\r\n this._picker.fogFarValue = this._gfx.scene.fog.far;\r\n } else {\r\n this._picker.fogFarValue = undefined;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._updateShadowmapMeshes = function (process) {\r\n this._forEachComplexVisual((visual) => {\r\n const reprList = visual._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n process(repr.geo, repr.material);\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._updateMaterials = function (values, needTraverse = false, process = undefined) {\r\n this._forEachComplexVisual((visual) => visual.setMaterialValues(values, needTraverse, process));\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setValues(values);\r\n obj._line.material.needsUpdate = true;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._fogAlphaChanged = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions({\r\n fogAlpha: settings.now.fogAlpha,\r\n });\r\n });\r\n};\r\n\r\nMiew.prototype._embedWebXR = function () {\r\n // switch off\r\n if (settings.now.stereo !== 'WEBVR') {\r\n if (this.webVR) {\r\n this.webVR.disable();\r\n }\r\n this.webVR = null;\r\n return;\r\n }\r\n // switch on\r\n if (!this.webVR) {\r\n this.webVR = new WebVRPoC(() => {\r\n this._requestAnimationFrame(() => this._onTick());\r\n this._needRender = true;\r\n this._onResize();\r\n });\r\n }\r\n this.webVR.enable(this._gfx);\r\n};\r\n\r\nMiew.prototype._initOnSettingsChanged = function () {\r\n const on = (props, func) => {\r\n props = _.isArray(props) ? props : [props];\r\n props.forEach((prop) => {\r\n this.settings.addEventListener(`change:${prop}`, func);\r\n });\r\n };\r\n\r\n on('modes.VD.frame', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.showFrame(settings.now.modes.VD.frame);\r\n this._needRender = true;\r\n });\r\n\r\n on('modes.VD.isoMode', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n });\r\n\r\n on('bg.color', () => {\r\n this._onBgColorChanged();\r\n });\r\n\r\n on('ao', () => {\r\n if (settings.now.ao && !isAOSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support ao');\r\n settings.set('ao', false);\r\n } else {\r\n const values = { normalsToGBuffer: settings.now.ao };\r\n this._setUberMaterialValues(values);\r\n }\r\n });\r\n\r\n on('zSprites', () => {\r\n if (settings.now.zSprites && !arezSpritesSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support zSprites');\r\n settings.set('zSprites', false);\r\n }\r\n });\r\n\r\n on('fogColor', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('fogColorEnable', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('bg.transparent', (evt) => {\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n // update materials\r\n this._updateMaterials({ fogTransparent: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('draft.clipPlane', (evt) => {\r\n // update materials\r\n this._updateMaterials({ clipPlane: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('shadow.on', (evt) => {\r\n // update materials\r\n const values = { shadowmap: evt.value, shadowmapType: settings.now.shadow.type };\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.shadowMap.enabled = Boolean(values.shadowmap);\r\n }\r\n this._updateMaterials(values, true);\r\n if (values.shadowmap) {\r\n this._updateShadowCamera();\r\n this._updateShadowmapMeshes(gfxutils.createShadowmapMaterial);\r\n } else {\r\n this._updateShadowmapMeshes(gfxutils.removeShadowmapMaterial);\r\n }\r\n this._needRender = true;\r\n });\r\n\r\n on('shadow.type', (evt) => {\r\n // update materials if shadowmap is enable\r\n if (settings.now.shadow.on) {\r\n this._updateMaterials({ shadowmapType: evt.value }, true);\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on('shadow.radius', (evt) => {\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].shadow !== undefined) {\r\n const light = this._gfx.scene.children[i];\r\n light.shadow.radius = evt.value;\r\n this._needRender = true;\r\n }\r\n }\r\n });\r\n\r\n on('fps', () => {\r\n this._fps.show(settings.now.fps);\r\n });\r\n\r\n on(['fog', 'fogNearFactor', 'fogFarFactor'], () => {\r\n this._updateFog();\r\n this._needRender = true;\r\n });\r\n\r\n on('fogAlpha', () => {\r\n const { fogAlpha } = settings.now;\r\n if (fogAlpha < 0 || fogAlpha > 1) {\r\n this.logger.warn('fogAlpha must belong range [0,1]');\r\n }\r\n this._fogAlphaChanged();\r\n this._needRender = true;\r\n });\r\n\r\n on('autoResolution', (evt) => {\r\n if (evt.value && !this._gfxScore) {\r\n this.logger.warn('Benchmarks are missed, autoresolution will not work! '\r\n + 'Autoresolution should be set during miew startup.');\r\n }\r\n });\r\n\r\n on('stereo', () => {\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n this._needRender = true;\r\n });\r\n\r\n on(['transparency', 'palette'], () => {\r\n this.rebuildAll();\r\n });\r\n\r\n on('resolution', () => {\r\n // update complex visuals\r\n this.rebuildAll();\r\n\r\n // update volume visual\r\n const volume = this._getVolumeVisual();\r\n if (volume) {\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on(['axes', 'fxaa', 'ao',\r\n 'outline.on', 'outline.color', 'outline.threshold', 'outline.thickness'], () => {\r\n this._needRender = true;\r\n });\r\n};\r\n\r\n/**\r\n * Set parameter value.\r\n * @param {string|object} params - Parameter name or path (e.g. 'modes.BS.atom') or even settings object.\r\n * @param {*=} value - Value.\r\n */\r\nMiew.prototype.set = function (params, value) {\r\n settings.set(params, value);\r\n};\r\n\r\n/**\r\n * Select atoms with selection string.\r\n * @param {string} expression - string expression of selection\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\nMiew.prototype.select = function (expression, append) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n let sel = expression;\r\n if (_.isString(expression)) {\r\n sel = selectors.parse(expression).selector;\r\n }\r\n\r\n visual.select(sel, append);\r\n this._lastPick = null;\r\n\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n};\r\n\r\nconst VIEW_VERSION = '1';\r\n\r\n/**\r\n * Get or set view info packed into string.\r\n *\r\n * **Note:** view is stored for *left-handed* cs, euler angles are stored in radians and *ZXY-order*,\r\n *\r\n * @param {string=} expression - Optional string encoded the view\r\n */\r\nMiew.prototype.view = function (expression) {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n let transform = [];\r\n const eulerOrder = 'ZXY';\r\n\r\n function encode() {\r\n const pos = pivot.position;\r\n const scale = self._objectControls.getScale() / settings.now.radiusToFit;\r\n const euler = new THREE.Euler();\r\n euler.setFromQuaternion(self._objectControls.getOrientation(), eulerOrder);\r\n transform = [\r\n pos.x, pos.y, pos.z,\r\n scale,\r\n euler.x, euler.y, euler.z,\r\n ];\r\n return VIEW_VERSION + utils.arrayToBase64(transform, Float32Array);\r\n }\r\n\r\n function decode() {\r\n // backwards compatible: old non-versioned view is the 0th version\r\n if (expression.length === 40) {\r\n expression = `0${expression}`;\r\n }\r\n\r\n const version = expression[0];\r\n transform = utils.arrayFromBase64(expression.substr(1), Float32Array);\r\n\r\n // apply adapter for old versions\r\n if (version !== VIEW_VERSION) {\r\n if (version === '0') {\r\n // cancel radiusToFit included in old views\r\n transform[3] /= 8.0;\r\n } else {\r\n // do nothing\r\n self.logger.warn(`Encoded view version mismatch, stored as ${version} vs ${VIEW_VERSION} expected`);\r\n return;\r\n }\r\n }\r\n\r\n const interpolator = self._interpolator;\r\n const srcView = interpolator.createView();\r\n srcView.position.copy(pivot.position);\r\n srcView.scale = self._objectControls.getScale();\r\n srcView.orientation.copy(self._objectControls.getOrientation());\r\n\r\n const dstView = interpolator.createView();\r\n dstView.position.set(transform[0], transform[1], transform[2]);\r\n\r\n // hack to make preset views work after we moved centering offset to visual nodes\r\n // FIXME should only store main pivot offset in preset\r\n if (self._getComplexVisual()) {\r\n dstView.position.sub(self._getComplexVisual().position);\r\n }\r\n\r\n dstView.scale = transform[3]; // eslint-disable-line prefer-destructuring\r\n dstView.orientation.setFromEuler(new THREE.Euler(transform[4], transform[5], transform[6], eulerOrder));\r\n\r\n interpolator.setup(srcView, dstView);\r\n }\r\n\r\n if (typeof expression === 'undefined') {\r\n return encode();\r\n }\r\n decode();\r\n\r\n return expression;\r\n};\r\n\r\n/*\r\n * Update current view due to viewinterpolator state\r\n */\r\nMiew.prototype._updateView = function () {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n\r\n const interpolator = this._interpolator;\r\n if (!interpolator.wasStarted()) {\r\n interpolator.start();\r\n }\r\n\r\n if (!interpolator.isMoving()) {\r\n return;\r\n }\r\n\r\n const res = interpolator.getCurrentView();\r\n if (res.success) {\r\n const curr = res.view;\r\n pivot.position.copy(curr.position);\r\n self._objectControls.setScale(curr.scale * settings.now.radiusToFit);\r\n self._objectControls.setOrientation(curr.orientation);\r\n this.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n }\r\n};\r\n\r\n/**\r\n * Translate object by vector\r\n * @param {number} x - translation value (Ang) along model's X axis\r\n * @param {number} y - translation value (Ang) along model's Y axis\r\n * @param {number} z - translation value (Ang) along model's Z axis\r\n */\r\nMiew.prototype.translate = function (x, y, z) {\r\n this._objectControls.translatePivot(x, y, z);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Rotate object by Euler angles\r\n * @param {number} x - rotation angle around X axis in radians\r\n * @param {number} y - rotation angle around Y axis in radians\r\n * @param {number} z - rotation angle around Z axis in radians\r\n */\r\nMiew.prototype.rotate = function (x, y, z) {\r\n this._objectControls.rotate(new THREE.Quaternion().setFromEuler(new THREE.Euler(x, y, z, 'XYZ')));\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Scale object by factor\r\n * @param {number} factor - scale multiplier, should greater than zero\r\n */\r\nMiew.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n throw new RangeError('Scale should be greater than zero');\r\n }\r\n this._objectControls.scale(factor);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Center view on selection\r\n * @param {empty | subset | string} selector - defines part of molecule which must be centered (\r\n * empty - center on current selection;\r\n * subset - center on picked atom/residue/molecule;\r\n * string - center on atoms correspond to selection string)\r\n */\r\nMiew.prototype.center = function (selector) {\r\n // no arguments - center on current selection;\r\n if (selector === undefined) {\r\n this.setPivotSubset();\r\n this._needRender = true;\r\n return;\r\n }\r\n // subset with atom or residue - center on picked atom/residue;\r\n if (selector.obj !== undefined && ('atom' in selector.obj || 'residue' in selector.obj)) { // from event with selection\r\n if ('atom' in selector.obj) {\r\n this.setPivotAtom(selector.obj.atom);\r\n } else {\r\n this.setPivotResidue(selector.obj.residue);\r\n }\r\n this._needRender = true;\r\n return;\r\n }\r\n // string - center on atoms correspond to selection string\r\n if (selector.obj === undefined && selector !== '') {\r\n const sel = selectors.parse(selector);\r\n if (sel.error === undefined) {\r\n this.setPivotSubset(sel);\r\n this._needRender = true;\r\n return;\r\n }\r\n }\r\n // empty subset or incorrect/empty string - center on all molecule;\r\n this.resetPivot();\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\nMiew.prototype.within = function (selector, radius) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return selectors.None();\r\n }\r\n\r\n if (selector instanceof String) {\r\n selector = selectors.parse(selector);\r\n }\r\n\r\n const res = visual.within(selector, radius);\r\n if (res) {\r\n visual.rebuildSelectionGeometry();\r\n this._needRender = true;\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Get atom position in 2D canvas coords\r\n * @param {string} fullAtomName - full atom name, like A.38.CG\r\n * @returns {Object} {x, y} or false if atom not found\r\n */\r\nMiew.prototype.projected = function (fullAtomName, complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return false;\r\n }\r\n\r\n const atom = visual.getComplex().getAtomByFullname(fullAtomName);\r\n if (atom === null) {\r\n return false;\r\n }\r\n\r\n const pos = atom.position.clone();\r\n // we consider atom position to be affected only by common complex transform\r\n // ignoring any transformations that may add during editing\r\n this._gfx.pivot.updateMatrixWorldRecursive();\r\n this._gfx.camera.updateMatrixWorldRecursive();\r\n this._gfx.pivot.localToWorld(pos);\r\n pos.project(this._gfx.camera);\r\n\r\n return {\r\n x: (pos.x + 1.0) * 0.5 * this._gfx.width,\r\n y: (1.0 - pos.y) * 0.5 * this._gfx.height,\r\n };\r\n};\r\n\r\n/**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n *\r\n * @param {string=} complexName - complex name\r\n */\r\nMiew.prototype.dssp = function (complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return;\r\n }\r\n visual.getComplex().dssp();\r\n\r\n // rebuild dependent representations (cartoon or ss-colored)\r\n visual._reprList.forEach((rep) => {\r\n if (rep.mode.id === 'CA' || rep.colorer.id === 'SS') {\r\n rep.needsRebuild = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype.exportCML = function () {\r\n const self = this;\r\n\r\n function extractRotation(m) {\r\n const xAxis = new THREE.Vector3();\r\n const yAxis = new THREE.Vector3();\r\n const zAxis = new THREE.Vector3();\r\n m.extractBasis(xAxis, yAxis, zAxis);\r\n xAxis.normalize();\r\n yAxis.normalize();\r\n zAxis.normalize();\r\n const retMat = new THREE.Matrix4();\r\n retMat.identity();\r\n retMat.makeBasis(xAxis, yAxis, zAxis);\r\n return retMat;\r\n }\r\n\r\n function updateCMLData(complex) {\r\n const { root } = self._gfx;\r\n const mat = extractRotation(root.matrixWorld);\r\n const v4 = new THREE.Vector4(0, 0, 0, 0);\r\n const vCenter = new THREE.Vector4(0, 0, 0, 0);\r\n let xml = null;\r\n let ap = null;\r\n\r\n // update atoms in cml\r\n complex.forEachAtom((atom) => {\r\n if (atom.xmlNodeRef && atom.xmlNodeRef.xmlNode) {\r\n xml = atom.xmlNodeRef.xmlNode;\r\n ap = atom.position;\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n v4.applyMatrix4(mat);\r\n xml.setAttribute('x3', v4.x.toString());\r\n xml.setAttribute('y3', v4.y.toString());\r\n xml.setAttribute('z3', v4.z.toString());\r\n xml.removeAttribute('x2');\r\n xml.removeAttribute('y2');\r\n }\r\n });\r\n // update stereo groups in cml\r\n complex.forEachSGroup((sGroup) => {\r\n if (sGroup.xmlNodeRef && sGroup.xmlNodeRef.xmlNode) {\r\n xml = sGroup.xmlNodeRef.xmlNode;\r\n ap = sGroup.getPosition();\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n const cp = sGroup.getCentralPoint();\r\n if (cp === null) {\r\n v4.applyMatrix4(mat);\r\n } else {\r\n vCenter.set(cp.x, cp.y, cp.z, 0.0);\r\n v4.add(vCenter);\r\n v4.applyMatrix4(mat); // pos in global space\r\n vCenter.set(cp.x, cp.y, cp.z, 1.0);\r\n vCenter.applyMatrix4(mat);\r\n v4.sub(vCenter);\r\n }\r\n xml.setAttribute('x', v4.x.toString());\r\n xml.setAttribute('y', v4.y.toString());\r\n xml.setAttribute('z', v4.z.toString());\r\n }\r\n });\r\n }\r\n\r\n const visual = self._getComplexVisual();\r\n const complex = visual ? visual.getComplex() : null;\r\n if (complex && complex.originalCML) {\r\n updateCMLData(complex);\r\n\r\n // serialize xml structure to string\r\n const oSerializer = new XMLSerializer();\r\n return oSerializer.serializeToString(complex.originalCML);\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Reproduce the RCSB PDB Molecule of the Month style by David S. Goodsell\r\n *\r\n * @see http://pdb101.rcsb.org/motm/motm-about\r\n */\r\nMiew.prototype.motm = function () {\r\n settings.set({\r\n fogColorEnable: true,\r\n fogColor: 0x000000,\r\n outline: { on: true, threshold: 0.01 },\r\n bg: { color: 0xffffff },\r\n });\r\n\r\n this._forEachComplexVisual((visual) => {\r\n const rep = [];\r\n const complex = visual.getComplex();\r\n const palette = palettes.get(settings.now.palette);\r\n for (let i = 0; i < complex.getChainCount(); i++) {\r\n const curChainName = complex._chains[i]._name;\r\n const curChainColor = palette.getChainColor(curChainName);\r\n rep[i] = {\r\n selector: `chain ${curChainName}`,\r\n mode: 'VW',\r\n colorer: ['CB', { color: curChainColor, factor: 0.9 }],\r\n material: 'FL',\r\n };\r\n }\r\n visual.resetReps(rep);\r\n });\r\n};\r\n\r\nMiew.prototype.VERSION = (typeof PACKAGE_VERSION !== 'undefined' && PACKAGE_VERSION) || '0.0.0-dev';\r\n\r\n// Uncomment this to get debug trace:\r\n// Miew.prototype.debugTracer = new utils.DebugTracer(Miew.prototype);\r\n\r\n_.assign(Miew, /** @lends Miew */ {\r\n VERSION: Miew.prototype.VERSION,\r\n\r\n registeredPlugins: [],\r\n\r\n // export namespaces // TODO: WIP: refactoring external interface\r\n chem,\r\n io,\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n utils,\r\n gfx: {\r\n Representation,\r\n },\r\n\r\n /**\r\n * Third-party libraries packaged together with Miew.\r\n *\r\n * @property {object} lodash - [Lodash](https://lodash.com/), a modern JavaScript utility library delivering\r\n * modularity, performance & extras.\r\n * @property {object} three - [three.js](https://threejs.org/), JavaScript 3D library.\r\n *\r\n * @example\r\n * var _ = Miew.thirdParty.lodash;\r\n * var opts = _.merge({ ... }, Miew.options.fromURL(window.location.search));\r\n * var miew = new Miew(opts);\r\n */\r\n thirdParty: {\r\n lodash: _,\r\n three: THREE,\r\n },\r\n});\r\n\r\nexport default Miew;\r\n","/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,60],$V1=[1,62],$V2=[1,63],$V3=[1,65],$V4=[1,66],$V5=[1,67],$V6=[1,68],$V7=[1,69],$V8=[1,80],$V9=[1,72],$Va=[1,73],$Vb=[1,74],$Vc=[1,75],$Vd=[1,99],$Ve=[1,76],$Vf=[1,100],$Vg=[1,79],$Vh=[1,51],$Vi=[1,81],$Vj=[1,82],$Vk=[1,84],$Vl=[1,83],$Vm=[1,85],$Vn=[1,96],$Vo=[1,97],$Vp=[1,98],$Vq=[1,86],$Vr=[1,87],$Vs=[1,64],$Vt=[1,70],$Vu=[1,71],$Vv=[1,77],$Vw=[1,78],$Vx=[1,53],$Vy=[1,54],$Vz=[1,55],$VA=[1,61],$VB=[1,88],$VC=[1,89],$VD=[1,90],$VE=[1,91],$VF=[1,92],$VG=[1,93],$VH=[1,94],$VI=[1,95],$VJ=[1,101],$VK=[1,102],$VL=[1,103],$VM=[1,104],$VN=[1,105],$VO=[1,56],$VP=[1,57],$VQ=[1,58],$VR=[1,59],$VS=[1,115],$VT=[1,111],$VU=[1,114],$VV=[1,112],$VW=[1,113],$VX=[1,118],$VY=[1,117],$VZ=[1,134],$V_=[1,149],$V$=[1,150],$V01=[1,157],$V11=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V21=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,71,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V31=[5,6,7,9,13,15,17,18,19,20,23,25,26,27,30,33,34,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95],$V41=[5,70,72],$V51=[5,74],$V61=[71,101];\r\nvar parser = {trace: function trace () { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Command\":4,\"EOF\":5,\"RESET\":6,\"BUILD\":7,\"ALL\":8,\"HELP\":9,\"Path\":10,\"MOTM\":11,\"OneArgCommand\":12,\"GET\":13,\"STRING\":14,\"SET\":15,\"Value\":16,\"SET_SAVE\":17,\"SET_RESTORE\":18,\"SET_RESET\":19,\"PRESET\":20,\"AddRepresentation\":21,\"EditRepresentation\":22,\"REMOVE\":23,\"RepresentationReference\":24,\"HIDE\":25,\"SHOW\":26,\"LIST\":27,\"EXPAND_KEY\":28,\"SELECTOR_KEY\":29,\"SELECT\":30,\"AS\":31,\"WordAll\":32,\"SELECTOR\":33,\"WITHIN\":34,\"NUMBER\":35,\"OF\":36,\"MATERIAL\":37,\"IDENTIFIER\":38,\"ModeCMD\":39,\"ColorCMD\":40,\"VIEW\":41,\"BASE_64\":42,\"UNIT\":43,\"DSSP\":44,\"SCALE\":45,\"ROTATE\":46,\"AxesList\":47,\"TRANSLATE\":48,\"CENTER\":49,\"GetURLBranch\":50,\"Screenshot\":51,\"LINE\":52,\"ArgList\":53,\"LISTOBJ\":54,\"REMOVEOBJ\":55,\"URL\":56,\"VIEW_KEY\":57,\"SCREENSHOT\":58,\"LOAD\":59,\"Url\":60,\"FILE_KEY\":61,\"ADD\":62,\"Description\":63,\"REP\":64,\"MODE\":65,\"COLOR\":66,\"Descriptor\":67,\"RepresentationOwnProperty\":68,\"RepresentationOwnPropertyOpts\":69,\"DESC_KEY\":70,\"=\":71,\"DESC_KEY_OPTS\":72,\"AxesArg\":73,\"DESC_KEY_AXES\":74,\"Arg\":75,\"PathWoDescKey\":76,\"HEX\":77,\"BOOL\":78,\"Word\":79,\"CommandSetWoDESC_KEY\":80,\"DescKeys\":81,\"CLEAR\":82,\"FILE_LIST\":83,\"FILE_REGISTER\":84,\"FILE_DELETE\":85,\"PRESET_ADD\":86,\"PRESET_DELETE\":87,\"PRESET_UPDATE\":88,\"PRESET_RENAME\":89,\"PRESET_OPEN\":90,\"CREATE_SCENARIO\":91,\"RESET_SCENARIO\":92,\"DELETE_SCENARIO\":93,\"ADD_SCENARIO_ITEM\":94,\"LIST_SCENARIO\":95,\"PDB_KEY\":96,\"DELAY_KEY\":97,\"PRST_KEY\":98,\"DESCRIPTION_KEY\":99,\"CommandSet\":100,\".\":101,\"PresetPath\":102,\"/\":103,\"HexOrNumber\":104,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",6:\"RESET\",7:\"BUILD\",8:\"ALL\",9:\"HELP\",11:\"MOTM\",13:\"GET\",14:\"STRING\",15:\"SET\",17:\"SET_SAVE\",18:\"SET_RESTORE\",19:\"SET_RESET\",20:\"PRESET\",23:\"REMOVE\",25:\"HIDE\",26:\"SHOW\",27:\"LIST\",28:\"EXPAND_KEY\",29:\"SELECTOR_KEY\",30:\"SELECT\",31:\"AS\",33:\"SELECTOR\",34:\"WITHIN\",35:\"NUMBER\",36:\"OF\",37:\"MATERIAL\",38:\"IDENTIFIER\",41:\"VIEW\",42:\"BASE_64\",43:\"UNIT\",44:\"DSSP\",45:\"SCALE\",46:\"ROTATE\",48:\"TRANSLATE\",49:\"CENTER\",52:\"LINE\",54:\"LISTOBJ\",55:\"REMOVEOBJ\",56:\"URL\",57:\"VIEW_KEY\",58:\"SCREENSHOT\",59:\"LOAD\",61:\"FILE_KEY\",62:\"ADD\",64:\"REP\",65:\"MODE\",66:\"COLOR\",70:\"DESC_KEY\",71:\"=\",72:\"DESC_KEY_OPTS\",74:\"DESC_KEY_AXES\",77:\"HEX\",78:\"BOOL\",82:\"CLEAR\",83:\"FILE_LIST\",84:\"FILE_REGISTER\",85:\"FILE_DELETE\",86:\"PRESET_ADD\",87:\"PRESET_DELETE\",88:\"PRESET_UPDATE\",89:\"PRESET_RENAME\",90:\"PRESET_OPEN\",91:\"CREATE_SCENARIO\",92:\"RESET_SCENARIO\",93:\"DELETE_SCENARIO\",94:\"ADD_SCENARIO_ITEM\",95:\"LIST_SCENARIO\",96:\"PDB_KEY\",97:\"DELAY_KEY\",98:\"PRST_KEY\",99:\"DESCRIPTION_KEY\",101:\".\",103:\"/\"},\r\nproductions_: [0,[3,2],[3,1],[4,1],[4,1],[4,2],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,3],[4,3],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[4,2],[4,1],[4,2],[4,2],[4,2],[4,4],[4,2],[4,6],[4,2],[4,1],[4,1],[4,1],[4,2],[4,2],[4,1],[4,2],[4,1],[4,2],[4,2],[4,2],[4,1],[4,2],[4,1],[4,1],[4,3],[4,3],[4,4],[4,4],[4,1],[4,2],[50,1],[50,2],[50,2],[50,3],[50,3],[51,1],[51,2],[51,3],[12,2],[12,2],[12,2],[21,1],[21,2],[21,2],[21,3],[22,2],[22,3],[39,2],[39,3],[40,2],[40,3],[24,1],[24,1],[63,1],[63,2],[63,3],[63,4],[67,1],[67,1],[67,2],[68,3],[69,3],[47,1],[47,2],[73,2],[53,1],[53,2],[75,3],[16,1],[16,1],[16,1],[16,1],[16,1],[79,1],[79,1],[32,1],[32,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[100,1],[100,1],[76,1],[76,3],[76,3],[10,1],[10,1],[10,3],[10,3],[10,3],[60,1],[102,1],[102,3],[104,1],[104,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.miew.reset(false); yy.ClearContext(); yy.miew.resetReps(\"empty\");\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.miew.rebuild();\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.miew.rebuildAll(); yy.miew.rebuild();\r\nbreak;\r\ncase 6:\r\nthis.$ = yy.echo(yy.utils.help().toString());\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.echo(yy.utils.help($$[$0]).toString());\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.miew.motm();\r\nbreak;\r\ncase 10: case 11:\r\nthis.$ = yy.utils.propagateProp($$[$0]); yy.echo(yy.miew.get($$[$0]).toString());\r\nbreak;\r\ncase 12: case 13:\r\nthis.$ = yy.miew.set($$[$0-1], yy.utils.propagateProp($$[$0-1], $$[$0]));;\r\nbreak;\r\ncase 14:\r\nthis.$ = yy.miew.saveSettings();;\r\nbreak;\r\ncase 15:\r\nthis.$ = yy.miew.restoreSettings();;\r\nbreak;\r\ncase 16:\r\nthis.$ = yy.miew.resetSettings();;\r\nbreak;\r\ncase 17:\r\nthis.$ = yy.miew.resetReps();\r\nbreak;\r\ncase 18:\r\nthis.$ = yy.miew.applyPreset($$[$0]);\r\nbreak;\r\ncase 21:\r\nthis.$ = yy.miew.repRemove($$[$0]); yy.representations.remove($$[$0]);\r\nbreak;\r\ncase 22:\r\nthis.$ = yy.miew.repHide($$[$0]);\r\nbreak;\r\ncase 23:\r\nthis.$ = yy.miew.repHide($$[$0], false);\r\nbreak;\r\ncase 24:\r\nthis.$ = yy.echo(yy.utils.listRep(yy.miew, yy.representations, $$[$0], '-e'));\r\nbreak;\r\ncase 25:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations));\r\nbreak;\r\ncase 26:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations, $$[$0]));\r\nbreak;\r\ncase 27:\r\nthis.$ = yy.echo(yy.utils.listSelector(yy.miew, yy.Context));\r\nbreak;\r\ncase 28:\r\nthis.$ = yy.miew.select(yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0], true));\r\nbreak;\r\ncase 29:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.utils.checkArg($$[$0-3].toLowerCase(), $$[$0-2], true); yy.miew.select(yy.Context[$$[$0].toLowerCase()]);\r\nbreak;\r\ncase 30:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {selector : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0])});\r\nbreak;\r\ncase 31:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.miew.within(yy.utils.checkArg(\"select\", $$[$0-2], true), Number($$[$0-4]));\r\nbreak;\r\ncase 32:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {material : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 35:\r\nthis.$ = yy.echo(yy.miew.view());\r\nbreak;\r\ncase 36: case 37:\r\nthis.$ = yy.miew.view($$[$0]);\r\nbreak;\r\ncase 38:\r\nthis.$ = yy.echo(yy.miew.changeUnit());\r\nbreak;\r\ncase 39:\r\nthis.$ = yy.echo(yy.miew.changeUnit($$[$0]));\r\nbreak;\r\ncase 40:\r\nthis.$ = yy.miew.dssp();\r\nbreak;\r\ncase 41:\r\nthis.$ = yy.miew.scale($$[$0]);\r\nbreak;\r\ncase 42:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.rotate($$[$0][i]['x'] * Math.PI / 180.0, $$[$0][i]['y'] * Math.PI / 180.0, $$[$0][i]['z'] * Math.PI / 180.0)} \r\nbreak;\r\ncase 43:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.translate($$[$0][i]['x'] || 0, $$[$0][i]['y'] || 0, $$[$0][i]['z'] || 0)} \r\nbreak;\r\ncase 44:\r\nthis.$ = yy.miew.center();\r\nbreak;\r\ncase 45:\r\nthis.$ = yy.miew.center($$[$0]);\r\nbreak;\r\ncase 48: case 49:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-1], $$[$0]]}, true);\r\nbreak;\r\ncase 50: case 51:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-2], $$[$0-1]], opts:$$[$0].toJSO(yy.utils, 'objects', 'line')}, true);\r\nbreak;\r\ncase 52:\r\nthis.$ = yy.echo(yy.utils.listObjs(yy.miew));\r\nbreak;\r\ncase 53:\r\nthis.$ = yy.miew.removeObject($$[$0]);\r\nbreak;\r\ncase 54:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: false}));\r\nbreak;\r\ncase 55:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: true}));\r\nbreak;\r\ncase 56:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: false}));\r\nbreak;\r\ncase 57: case 58:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: true}));\r\nbreak;\r\ncase 59:\r\nthis.$ = yy.miew.screenshotSave();\r\nbreak;\r\ncase 60:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0]));\r\nbreak;\r\ncase 61:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0-1]), Number($$[$0]));\r\nbreak;\r\ncase 62: case 63: case 64:\r\nthis.$ = yy.utils.load(yy.miew, $$[$0]); yy.representations.clear();\r\nbreak;\r\ncase 65:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd()));\r\nbreak;\r\ncase 66:\r\nthis.$ = yy.echo(yy.representations.add($$[$0], yy.miew.repAdd()));\r\nbreak;\r\ncase 67:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 68:\r\nthis.$ = yy.echo(yy.representations.add($$[$0-1], yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 69:\r\nthis.$ = yy.miew.rep($$[$0]); yy.miew.repCurrent($$[$0]);\r\nbreak;\r\ncase 70:\r\nthis.$ = yy.miew.rep($$[$0-1], $$[$0]); yy.miew.repCurrent($$[$0-1]);\r\nbreak;\r\ncase 71:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 72:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 73:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 74:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 75:\r\nthis.$ = Number(yy.representations.get($$[$0]));\r\nbreak;\r\ncase 76: case 92:\r\nthis.$ = Number($$[$0]);\r\nbreak;\r\ncase 77:\r\nthis.$ = $$[$0];\r\nbreak;\r\ncase 78:\r\nthis.$ = yy._.assign($$[$0-1], $$[$0]);\r\nbreak;\r\ncase 79:\r\nthis.$ = yy._.assign($$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 80:\r\nthis.$ = yy._.assign($$[$0-3], $$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 81: case 82:\r\nthis.$ = yy.CreateObjectPair($$[$0].key, $$[$0].val);\r\nbreak;\r\ncase 83:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].key, new Array($$[$0-1].val, $$[$0].toJSO(yy.utils, $$[$0-1].key, $$[$0-1].val)));\r\nbreak;\r\ncase 84: case 85:\r\nthis.$ = Object.create({'key': yy.keyRemap($$[$0-2]), 'val': yy.utils.checkArg($$[$0-2], $$[$0])});\r\nbreak;\r\ncase 86:\r\nthis.$ = [$$[$0]];\r\nbreak;\r\ncase 87:\r\nthis.$ = $$[$0-1].concat($$[$0]);\r\nbreak;\r\ncase 88:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].toLowerCase(), Number($$[$0]));\r\nbreak;\r\ncase 89:\r\nthis.$ = new yy.ArgList($$[$0]);\r\nbreak;\r\ncase 90:\r\nthis.$ = $$[$0-1].append($$[$0]);\r\nbreak;\r\ncase 91:\r\nthis.$ = new yy.Arg($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 93:\r\nthis.$ = parseInt($$[$0]);\r\nbreak;\r\ncase 94:\r\nthis.$ = JSON.parse($$[$0]);\r\nbreak;\r\ncase 95: case 96:\r\nthis.$ = String($$[$0]);\r\nbreak;\r\ncase 157: case 158: case 161: case 162: case 163:\r\nthis.$ = $$[$0-2] + $$[$0-1] + $$[$0] //cause of could be color word in path;\r\nbreak;\r\ncase 166:\r\nthis.$ = $$[$0-2] = $$[$0-2] + $$[$0-1] + $$[$0];\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,5:[1,3],6:[1,4],7:[1,5],9:[1,6],11:[1,7],12:8,13:[1,9],15:[1,10],17:[1,11],18:[1,12],19:[1,13],20:[1,14],21:15,22:16,23:[1,17],25:[1,18],26:[1,19],27:[1,20],30:[1,21],33:[1,22],34:[1,23],37:[1,24],39:25,40:26,41:[1,27],43:[1,28],44:[1,29],45:[1,30],46:[1,31],48:[1,32],49:[1,33],50:34,51:35,52:[1,36],54:[1,37],55:[1,38],56:[1,44],58:[1,45],59:[1,39],62:[1,40],64:[1,41],65:[1,42],66:[1,43]},{1:[3]},{5:[1,46]},{1:[2,2]},{5:[2,3]},{5:[2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,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,14]},{5:[2,15]},{5:[2,16]},{5:[2,17],14:$VS,16:110,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,19]},{5:[2,20]},{24:116,35:$VX,38:$VY},{24:119,35:$VX,38:$VY},{24:120,35:$VX,38:$VY},{5:[2,25],24:121,28:[1,122],29:[1,123],35:$VX,38:$VY},{14:[1,124]},{14:[1,125]},{35:[1,126]},{38:[1,127]},{5:[2,33]},{5:[2,34]},{5:[2,35],14:[1,128],42:[1,129]},{5:[2,38],35:[1,130]},{5:[2,40]},{35:[1,131]},{47:132,73:133,74:$VZ},{47:135,73:133,74:$VZ},{5:[2,44],14:[1,136]},{5:[2,46]},{5:[2,47]},{6:$V0,7:$V1,9:$V2,10:138,13:$V3,14:[1,137],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,52]},{35:[1,139]},{14:[1,143],38:[1,141],60:140,61:[1,142]},{5:[2,65],38:[1,144],63:145,67:146,68:147,69:148,70:$V_,72:$V$},{24:151,35:$VX,38:$VY},{38:[1,152]},{38:[1,153]},{5:[2,54],29:[1,154],57:[1,155]},{5:[2,59],35:[1,156]},{1:[2,1]},{5:[2,5]},{5:[2,7],101:$V01},o($V11,[2,159]),o($V11,[2,160]),o($V21,[2,97]),o($V21,[2,98]),o($V11,[2,147]),o($V11,[2,148]),o($V11,[2,149]),o($V11,[2,150]),o($V11,[2,151]),o($V11,[2,152]),o($V11,[2,153]),o($V21,[2,101]),o($V21,[2,102]),o($V21,[2,103]),o($V21,[2,104]),o($V21,[2,105]),o($V21,[2,106]),o($V21,[2,107]),o($V21,[2,108]),o($V21,[2,109]),o($V21,[2,110]),o($V21,[2,111]),o($V21,[2,112]),o($V21,[2,113]),o($V21,[2,114]),o($V21,[2,115]),o($V21,[2,116]),o($V21,[2,117]),o($V21,[2,118]),o($V21,[2,119]),o($V21,[2,120]),o($V21,[2,121]),o($V21,[2,122]),o($V21,[2,123]),o($V21,[2,124]),o($V21,[2,125]),o($V21,[2,126]),o($V21,[2,127]),o($V21,[2,128]),o($V21,[2,129]),o($V21,[2,130]),o($V21,[2,131]),o($V21,[2,132]),o($V21,[2,133]),o($V21,[2,134]),o($V21,[2,135]),o($V21,[2,136]),o($V21,[2,137]),o($V21,[2,138]),o($V21,[2,139]),o($V21,[2,140]),o($V21,[2,141]),o($V21,[2,142]),o($V21,[2,143]),o($V21,[2,144]),o($V21,[2,145]),o($V21,[2,146]),{5:[2,10],101:$V01},{5:[2,11]},{14:$VS,16:158,35:$VT,38:$VU,77:$VV,78:$VW,101:$V01},{14:$VS,16:159,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,18]},o($V31,[2,92]),o($V31,[2,93]),o($V31,[2,94]),o($V31,[2,95]),o($V31,[2,96]),{5:[2,21]},o($V41,[2,75]),o($V41,[2,76]),{5:[2,22]},{5:[2,23]},{5:[2,24]},{5:[2,26]},{5:[2,27]},{5:[2,28],31:[1,160]},{5:[2,30]},{36:[1,161]},{5:[2,32]},{5:[2,36]},{5:[2,37]},{5:[2,39]},{5:[2,41]},{5:[2,42],73:162,74:$VZ},o($V51,[2,86]),{35:[1,163]},{5:[2,43],73:162,74:$VZ},{5:[2,45]},{14:[1,164]},{6:$V0,7:$V1,9:$V2,10:165,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR,101:$V01},{5:[2,53]},{5:[2,62]},{5:[2,63]},{5:[2,64]},{5:[2,164]},{5:[2,66],63:166,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,67]},{5:[2,77],67:167,68:147,69:148,70:$V_,72:$V$},o($V41,[2,81]),o($V41,[2,82],{80:52,53:168,75:169,76:170,79:171,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),{71:[1,172]},{71:[1,173]},{5:[2,69],63:174,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,71],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:175,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,73],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:176,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,55],57:[1,177]},{5:[2,56],29:[1,178]},{5:[2,60],35:[1,179]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,181],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:180,80:52,81:182,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,12]},{5:[2,13]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:183,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{14:[1,186]},o($V51,[2,87]),o($V51,[2,88]),{5:[2,48],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:187,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,49],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:188,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,101:$V01},{5:[2,68]},{5:[2,78],67:189,68:147,69:148,70:$V_,72:$V$},o($V41,[2,83],{80:52,76:170,79:171,75:190,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),o($V31,[2,89]),{71:[1,191],101:[1,192]},o($V61,[2,156]),{14:$VS,16:193,35:$VT,38:$VU,77:$VV,78:$VW},{14:$VS,16:194,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,70]},{5:[2,72],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,74],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,57]},{5:[2,58]},{5:[2,61]},o($V11,[2,161]),o($V11,[2,162]),o($V11,[2,163]),{5:[2,29]},{5:[2,99]},{5:[2,100]},{31:[1,195]},{5:[2,50],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,51],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,79],67:196,68:147,69:148,70:$V_,72:$V$},o($V31,[2,90]),{14:$VS,16:197,35:$VT,38:$VU,77:$VV,78:$VW},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,199],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,79:198,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},o($V41,[2,84]),o($V31,[2,85]),{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:200,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,80]},o($V31,[2,91]),o($V61,[2,157]),o($V61,[2,158]),{5:[2,31]}],\r\ndefaultActions: {3:[2,2],4:[2,3],7:[2,8],8:[2,9],11:[2,14],12:[2,15],13:[2,16],15:[2,19],16:[2,20],25:[2,33],26:[2,34],29:[2,40],34:[2,46],35:[2,47],37:[2,52],46:[2,1],47:[2,5],107:[2,11],110:[2,18],116:[2,21],119:[2,22],120:[2,23],121:[2,24],122:[2,26],123:[2,27],125:[2,30],127:[2,32],128:[2,36],129:[2,37],130:[2,39],131:[2,41],136:[2,45],139:[2,53],140:[2,62],141:[2,63],142:[2,64],143:[2,164],145:[2,67],158:[2,12],159:[2,13],166:[2,68],174:[2,70],177:[2,57],178:[2,58],179:[2,61],183:[2,29],184:[2,99],185:[2,100],196:[2,80],200:[2,31]},\r\nparseError: function parseError (str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function(match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex () {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin (condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState () {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules () {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState (n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState (condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* ignore whitespace */\r\nbreak;\r\ncase 1:return '';\r\nbreak;\r\ncase 2:return '';\r\nbreak;\r\ncase 3:return 42;\r\nbreak;\r\ncase 4:return 35;\r\nbreak;\r\ncase 5:return 77;\r\nbreak;\r\ncase 6:return 78;\r\nbreak;\r\ncase 7:return 78;\r\nbreak;\r\ncase 8:return 8;\r\nbreak;\r\ncase 9:return 6;\r\nbreak;\r\ncase 10:return 82;\r\nbreak;\r\ncase 11:return 7;\r\nbreak;\r\ncase 12:return 9;\r\nbreak;\r\ncase 13:return 59;\r\nbreak;\r\ncase 14:return 13\r\nbreak;\r\ncase 15:return 15\r\nbreak;\r\ncase 16:return 17\r\nbreak;\r\ncase 17:return 18\r\nbreak;\r\ncase 18:return 19\r\nbreak;\r\ncase 19:return 20\r\nbreak;\r\ncase 20:return 11\r\nbreak;\r\ncase 21:return 62\r\nbreak;\r\ncase 22:return 64\r\nbreak;\r\ncase 23:return 23\r\nbreak;\r\ncase 24:return 25\r\nbreak;\r\ncase 25:return 26\r\nbreak;\r\ncase 26:return 27\r\nbreak;\r\ncase 27:return 30\r\nbreak;\r\ncase 28:return 34\r\nbreak;\r\ncase 29:return 33\r\nbreak;\r\ncase 30:return 65\r\nbreak;\r\ncase 31:return 66\r\nbreak;\r\ncase 32:return 37\r\nbreak;\r\ncase 33:return 41\r\nbreak;\r\ncase 34:return 43\r\nbreak;\r\ncase 35:return 52\r\nbreak;\r\ncase 36:return 54\r\nbreak;\r\ncase 37:return 55\r\nbreak;\r\ncase 38:return 46\r\nbreak;\r\ncase 39:return 48\r\nbreak;\r\ncase 40:return 45\r\nbreak;\r\ncase 41:return 49\r\nbreak;\r\ncase 42:return 56\r\nbreak;\r\ncase 43:return 58;\r\nbreak;\r\ncase 44:return 44\r\nbreak;\r\ncase 45:return 83\r\nbreak;\r\ncase 46:return 84\r\nbreak;\r\ncase 47:return 85\r\nbreak;\r\ncase 48:return 86\r\nbreak;\r\ncase 49:return 87\r\nbreak;\r\ncase 50:return 88\r\nbreak;\r\ncase 51:return 89\r\nbreak;\r\ncase 52:return 90\r\nbreak;\r\ncase 53:return 91\r\nbreak;\r\ncase 54:return 92\r\nbreak;\r\ncase 55:return 93\r\nbreak;\r\ncase 56:return 94\r\nbreak;\r\ncase 57:return 95\r\nbreak;\r\ncase 58:return 70\r\nbreak;\r\ncase 59:return 70\r\nbreak;\r\ncase 60:return 72\r\nbreak;\r\ncase 61:return 72\r\nbreak;\r\ncase 62:return 74\r\nbreak;\r\ncase 63:return 74\r\nbreak;\r\ncase 64:return 74\r\nbreak;\r\ncase 65:return 31\r\nbreak;\r\ncase 66:return 36\r\nbreak;\r\ncase 67:return 96\r\nbreak;\r\ncase 68:return 97\r\nbreak;\r\ncase 69:return 98\r\nbreak;\r\ncase 70:return 99\r\nbreak;\r\ncase 71:yy_.yytext = yy.utils.unquoteString(yy_.yytext); return 14;\r\nbreak;\r\ncase 72:return 38;\r\nbreak;\r\ncase 73:return 5;\r\nbreak;\r\ncase 74:return 101;\r\nbreak;\r\ncase 75:return 103;\r\nbreak;\r\ncase 76:return '\\\\';\r\nbreak;\r\ncase 77:return 28\r\nbreak;\r\ncase 78:return 61\r\nbreak;\r\ncase 79:return 29\r\nbreak;\r\ncase 80:return 57\r\nbreak;\r\ncase 81:return 71\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:[#].*)/i,/^(?:\\/\\/.*)/i,/^(?:([_A-Z0-9\\/\\+]+==))/i,/^(?:-?[0-9]+(\\.[0-9]+)?\\b)/i,/^(?:0[xX][0-9A-F]+\\b)/i,/^(?:false\\b)/i,/^(?:true\\b)/i,/^(?:all\\b)/i,/^(?:reset\\b)/i,/^(?:clear\\b)/i,/^(?:build\\b)/i,/^(?:help\\b)/i,/^(?:load\\b)/i,/^(?:get\\b)/i,/^(?:set\\b)/i,/^(?:set_save\\b)/i,/^(?:set_restore\\b)/i,/^(?:set_reset\\b)/i,/^(?:preset\\b)/i,/^(?:motm\\b)/i,/^(?:add\\b)/i,/^(?:rep\\b)/i,/^(?:remove\\b)/i,/^(?:hide\\b)/i,/^(?:show\\b)/i,/^(?:list\\b)/i,/^(?:select\\b)/i,/^(?:within\\b)/i,/^(?:selector\\b)/i,/^(?:mode\\b)/i,/^(?:color\\b)/i,/^(?:material\\b)/i,/^(?:view\\b)/i,/^(?:unit\\b)/i,/^(?:line\\b)/i,/^(?:listobj\\b)/i,/^(?:removeobj\\b)/i,/^(?:rotate\\b)/i,/^(?:translate\\b)/i,/^(?:scale\\b)/i,/^(?:center\\b)/i,/^(?:url\\b)/i,/^(?:screenshot\\b)/i,/^(?:dssp\\b)/i,/^(?:file_list\\b)/i,/^(?:file_register\\b)/i,/^(?:file_delete\\b)/i,/^(?:preset_add\\b)/i,/^(?:preset_delete\\b)/i,/^(?:preset_update\\b)/i,/^(?:preset_rename\\b)/i,/^(?:preset_open\\b)/i,/^(?:create_scenario\\b)/i,/^(?:reset_scenario\\b)/i,/^(?:delete_scenario\\b)/i,/^(?:add_scenario_item\\b)/i,/^(?:list_scenario\\b)/i,/^(?:s\\b)/i,/^(?:mt\\b)/i,/^(?:m\\b)/i,/^(?:c\\b)/i,/^(?:x\\b)/i,/^(?:y\\b)/i,/^(?:z\\b)/i,/^(?:as\\b)/i,/^(?:of\\b)/i,/^(?:pdb\\b)/i,/^(?:delay\\b)/i,/^(?:prst\\b)/i,/^(?:desc\\b)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:\\.)/i,/^(?:\\/)/i,/^(?:\\\\)/i,/^(?:-e\\b)/i,/^(?:-f\\b)/i,/^(?:-s\\b)/i,/^(?:-v\\b)/i,/^(?:=)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[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,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","import palettes from '../gfx/palettes';\r\nimport settings from '../settings';\r\n\r\nconst modeIdDesc = {\r\n $help: [\r\n 'Rendering mode shortcut',\r\n ' BS - balls and sticks mode',\r\n ' LN - lines mode',\r\n ' LC - licorice mode',\r\n ' VW - van der waals mode',\r\n ' TR - trace mode',\r\n ' TU - tube mode',\r\n ' CA - cartoon mode',\r\n ' SA - isosurface mode',\r\n ' QS - quick surface mode',\r\n ' SE - solvent excluded mode',\r\n ' TX - text mode',\r\n ],\r\n BS: {\r\n $help: [\r\n ' Balls and sticks',\r\n ' aromrad = #aromatic radius',\r\n ' atom = #atom radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n CA: {\r\n $help: [\r\n ' Cartoon',\r\n ' arrow = #arrow size',\r\n ' depth = #depth of surface',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = #',\r\n ' width = #secondary width\\n',\r\n ],\r\n },\r\n LN: {\r\n $help: [\r\n ' Lines',\r\n ' atom = #atom radius',\r\n ' chunkarom = ',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' offsarom = \\n',\r\n ],\r\n },\r\n LC: {\r\n $help: [\r\n ' Licorice',\r\n ' aromrad = #aromatic radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n VW: {\r\n $help: [\r\n ' Van der Waals',\r\n ' nothing\\n',\r\n ],\r\n },\r\n TR: {\r\n $help: [\r\n ' Trace',\r\n ' radius = #tube radius\\n',\r\n ],\r\n },\r\n TU: {\r\n $help: [\r\n ' Tube',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = \\n',\r\n ],\r\n },\r\n SA: {\r\n $help: [\r\n ' Surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n QS: {\r\n $help: [\r\n ' Quick surface',\r\n ' isoValue = ',\r\n ' scale = ',\r\n ' wireframe = ',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n SE: {\r\n $help: [\r\n ' Solvent excluded surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n TX: {\r\n $help: [\r\n ' Text mode',\r\n ' template = string that can include \"{{ id }}\"',\r\n ' it will be replaced by value, id can be one of next:',\r\n ' serial, name, type, sequence, residue, chain, hetatm, water\\n',\r\n ' horizontalAlign = {\"left\", \"right\", \"center\"}',\r\n ' verticalAlign = {\"top\", \"bottom\", \"middle\"}',\r\n ' dx = #offset along x',\r\n ' dy = #offset along y',\r\n ' dz = #offset along z',\r\n ' fg = #text color modificator',\r\n ' could be keyword, named color or hex',\r\n ' fg = #back color modificator',\r\n ' could be keyword, named color or hex',\r\n ' showBg = #if set show background',\r\n ' plate under text',\r\n ],\r\n },\r\n};\r\n\r\nconst colorDesc = {\r\n $help: [\r\n 'Coloring mode shortcut',\r\n ' EL - color by element',\r\n ' CH - color by chain',\r\n ' SQ - color by sequence',\r\n ' RT - color by residue type',\r\n ' SS - color by secondary structure',\r\n ' UN - uniform',\r\n ],\r\n UN: {\r\n $help: [\r\n 'Parameters of coloring modes customization',\r\n ' Uniform',\r\n ' color = #RGB->HEX->dec\\n',\r\n ],\r\n color: {\r\n $help: Object.keys(palettes.get(settings.now.palette).namedColors).sort().join('\\n'),\r\n },\r\n },\r\n};\r\n\r\nconst materialDesc = {\r\n $help: [\r\n 'Material shortcut',\r\n ' DF - diffuse',\r\n ' TR - transparent',\r\n ' SF - soft plastic',\r\n ' PL - glossy plastic',\r\n ' ME - metal',\r\n ' GL - glass',\r\n ],\r\n};\r\n\r\nconst addRepDesc = {\r\n $help: [\r\n 'Short (packed) representation description as a set of variables',\r\n ' s=',\r\n ' selector property',\r\n ' m=[!:[,...]]',\r\n ' render mode property',\r\n ' c=[!:[,...]]',\r\n ' color mode property',\r\n ' mt=',\r\n ' material property',\r\n ],\r\n s: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n m: modeIdDesc,\r\n c: colorDesc,\r\n mt: materialDesc,\r\n};\r\n\r\nconst setGetParameterDesc = {\r\n $help: [\r\n 'Parameters of rendering modes customization: modes',\r\n 'Parameters of colorer customization: colorers',\r\n 'Autobuild: autobuild = (|)',\r\n ],\r\n modes: modeIdDesc,\r\n colorers: colorDesc,\r\n};\r\n\r\nconst help = {\r\n $help: [\r\n 'help (| )',\r\n 'You can get detailed information about command options',\r\n ' using \"help cmd.opt.opt.[...]\"\\n',\r\n ' you can use one line comments',\r\n ' everything started from (#|//) will be skipped',\r\n ' Example: >build //some comment\\n',\r\n 'List of available commands:',\r\n ],\r\n reset: {\r\n $help: [\r\n 'Reload current object, delete all representations',\r\n ' Nothing will work until load new object',\r\n ],\r\n },\r\n load: {\r\n $help: [\r\n 'load (||-f [<*.NC FILE URL STRING>])',\r\n ' Load new pdb object from selected source',\r\n ],\r\n PDBID: {\r\n $help: 'pdb id in remote molecule database',\r\n },\r\n URL: {\r\n $help: 'url to source file',\r\n },\r\n f: {\r\n $help: [\r\n 'open file system dialog to fetch local file',\r\n 'optionally you can determine trajectory file',\r\n 'via URL for *.top model',\r\n ],\r\n },\r\n },\r\n clear: {\r\n $help: 'No args. Clear terminal',\r\n },\r\n add: {\r\n $help: [\r\n 'add [] []',\r\n ' Add new item to representation set with',\r\n ' default or params',\r\n ],\r\n REP_NAME: {\r\n $help: 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n rep: {\r\n $help: [\r\n 'rep [|] []',\r\n ' set current representation by name or index',\r\n ' edit current representation by ',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n remove: {\r\n $help: [\r\n 'remove (|)',\r\n 'Remove representation by name or index',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n },\r\n selector: {\r\n $help: [\r\n 'selector ',\r\n ' set selector from EXPRESSION to current representation',\r\n ],\r\n EXPRESSION: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n },\r\n mode: {\r\n $help: [\r\n 'mode [=...]',\r\n ' set rendering mode and apply parameters to current representation',\r\n ],\r\n MODE_ID: modeIdDesc,\r\n },\r\n color: {\r\n $help: [\r\n 'color [=...]',\r\n ' set colorer and apply parameters to current representation',\r\n ],\r\n COLORER_ID: colorDesc,\r\n },\r\n material: {\r\n $help: [\r\n 'material ',\r\n ' set material to current representation',\r\n ],\r\n MATERIAL_ID: materialDesc,\r\n },\r\n build: {\r\n $help: 'build help str',\r\n add: {\r\n $help: 'build.add',\r\n new: {\r\n $help: [\r\n 'add.new',\r\n 'add.new new line 1',\r\n 'add.new new line 2',\r\n 'add.new new line 3',\r\n ],\r\n },\r\n },\r\n del: {\r\n $help: 'build.del',\r\n },\r\n },\r\n list: {\r\n $help: [\r\n 'list [-e|-s||]',\r\n 'Print representations if no args print list of representations',\r\n ' -e expand list and show all representations',\r\n ' -s show all user-registered selectors',\r\n ' | show only current representation',\r\n ],\r\n },\r\n hide: {\r\n $help: [\r\n 'hide (|)',\r\n 'Hide representation referenced in args',\r\n ],\r\n },\r\n show: {\r\n $help: [\r\n 'show (|)',\r\n 'Show representation referenced in args',\r\n ],\r\n },\r\n get: {\r\n $help: [\r\n 'get ',\r\n 'Print value',\r\n ' - path to option use get.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set: {\r\n $help: [\r\n 'set ',\r\n 'Set with ',\r\n ' - path to option use set.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set_save: {\r\n $help: [\r\n 'set_save',\r\n 'Save current settings to cookie',\r\n ],\r\n },\r\n set_restore: {\r\n $help: [\r\n 'set_restore',\r\n 'Load and apply settings from cookie',\r\n ],\r\n },\r\n set_reset: {\r\n $help: [\r\n 'set_reset',\r\n 'Reset current settings to the defaults',\r\n ],\r\n },\r\n preset: {\r\n $help: [\r\n 'preset []',\r\n 'Reset current representation or set preset to ',\r\n ],\r\n PRESET: {\r\n $help: [\r\n 'default',\r\n 'wire',\r\n 'small',\r\n 'macro',\r\n ],\r\n },\r\n },\r\n unit: {\r\n $help: [\r\n 'unit []',\r\n 'Change current biological structure view. Zero value means asymmetric unit,',\r\n 'positive values set an assembly with corresponding number.',\r\n 'Being called with no parameters command prints current unit information.',\r\n ],\r\n },\r\n view: {\r\n $help: [\r\n 'view []',\r\n 'Get current encoded view or set if ENCODED_VIEW placed as argument',\r\n ],\r\n ENCODED_VIEW: {\r\n $help: [\r\n 'encoded view matrix string (binary code)',\r\n ],\r\n },\r\n },\r\n rotate: {\r\n $help: [\r\n 'rotate (x|y|z) [] [(x|y|z) []]...',\r\n 'Rotate scene',\r\n ],\r\n },\r\n scale: {\r\n $help: [\r\n 'scale ',\r\n 'Scale scene',\r\n ],\r\n },\r\n select: {\r\n $help: [\r\n 'select [as ]',\r\n 'Select atoms using selector defined in SELECTOR_STRING',\r\n ' and if SELECTOR_NAME is defined register it in viewer',\r\n ' you can use it later as a complex selector',\r\n ],\r\n },\r\n within: {\r\n $help: [\r\n 'within of as ',\r\n 'Build within named selector',\r\n ' DISTANCE ',\r\n ' SELECTOR_STRING ',\r\n ' SELECTOR_NAME ',\r\n ],\r\n },\r\n url: {\r\n $help: [\r\n 'url [-s] [-v]',\r\n 'Report URL encoded scene',\r\n ' if -s set that include settings in the URL',\r\n ' if -v set that include view in the URL',\r\n ],\r\n },\r\n screenshot: {\r\n $help: [\r\n 'screenshot [ []]',\r\n 'Make a screenshot of the scene',\r\n ' WIDTH in pixels',\r\n ' HEIGHT in pixels, equal to WIDTH by default',\r\n ],\r\n },\r\n line: {\r\n $help: [\r\n 'line [=]',\r\n 'Draw dashed line between two specified atoms',\r\n ],\r\n },\r\n removeobj: {\r\n $help: [\r\n 'removeobj ',\r\n 'Remove scene object by its index. Indices could be obtained by command',\r\n ],\r\n },\r\n listobj: {\r\n $help: [\r\n 'listobj',\r\n 'Display the list of all existing scene objects',\r\n ],\r\n },\r\n};\r\n\r\nexport default help;\r\n","import _ from 'lodash';\r\nimport Miew from './Miew';\r\nimport { parser as parsercli } from './utils/MiewCLIParser';\r\nimport clihelp from './utils/MiewCLIHelp';\r\nimport logger from './utils/logger';\r\nimport utils from './utils';\r\n\r\nconst {\r\n chem: { selectors },\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n} = Miew;\r\n\r\nfunction None() {\r\n}\r\n\r\nconst NULL = (function () {\r\n const obj = new None();\r\n return function () {\r\n return obj;\r\n };\r\n}());\r\n\r\nclass RepresentationMap {\r\n constructor() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n\r\n get(strId) {\r\n return this.representationMap[strId] || this.representationID[strId] || '';\r\n }\r\n\r\n add(strId, index) {\r\n if (strId === -1) {\r\n return 'Can not create representation: there is no data';\r\n }\r\n\r\n if (index !== undefined) {\r\n if (!this.representationMap.hasOwnProperty(strId)) {\r\n this.representationMap[strId.toString()] = index;\r\n this.representationID[index] = strId.toString();\r\n } else {\r\n return 'This name has already existed, registered without name';\r\n }\r\n }\r\n return `Representation ${strId} successfully added`;\r\n }\r\n\r\n remove(index) {\r\n if (index && this.representationID.hasOwnProperty(index)) {\r\n delete this.representationMap[this.representationID[index]];\r\n delete this.representationID[index];\r\n }\r\n\r\n const sortedKeys = Object.keys(this.representationID).sort();\r\n for (const i in sortedKeys) {\r\n if (sortedKeys.hasOwnProperty(i)) {\r\n const id = sortedKeys[i];\r\n if (id > index) {\r\n this.representationID[id - 1] = this.representationID[id];\r\n this.representationMap[this.representationID[id]] -= 1;\r\n delete this.representationID[id];\r\n }\r\n }\r\n }\r\n }\r\n\r\n clear() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n}\r\n\r\n\r\nconst representationsStorage = new RepresentationMap();\r\n\r\nfunction keyRemap(key) {\r\n const keys = {\r\n s: 'selector',\r\n m: 'mode',\r\n c: 'colorer',\r\n mt: 'material',\r\n mode: 'modes',\r\n color: 'colorers',\r\n colorer: 'colorers',\r\n select: 'selector',\r\n material: 'materials',\r\n selector: 'selector',\r\n };\r\n const ans = keys[key];\r\n return ans === undefined ? key : ans;\r\n}\r\n\r\nclass CLIUtils {\r\n list(miew, repMap, key) {\r\n let ret = '';\r\n if (miew && repMap !== undefined) {\r\n if (key === undefined || key === '-e') {\r\n const count = miew.repCount();\r\n\r\n for (let i = 0; i < count; i++) {\r\n ret += this.listRep(miew, repMap, i, key);\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n\r\n listRep(miew, repMap, repIndex, key) {\r\n let ret = '';\r\n const rep = miew.repGet(repIndex);\r\n if (!rep) {\r\n logger.warn(`Rep ${repIndex} does not exist!`);\r\n return ret;\r\n }\r\n const index = repIndex;\r\n const repName = repMap.get(index);\r\n\r\n const { mode, colorer } = rep;\r\n const selectionStr = rep.selectorString;\r\n const material = rep.materialPreset;\r\n\r\n ret += `#${index} : ${mode.name}${repName === '' ? '' : `, ${repName}`}\\n`;\r\n\r\n if (key !== undefined) {\r\n ret += ` selection : \"${selectionStr}\"\\n`;\r\n ret += ` mode : (${mode.id}), ${mode.name}\\n`;\r\n ret += ` colorer : (${colorer.id}), ${colorer.name}\\n`;\r\n ret += ` material : (${material.id}), ${material.name}\\n`;\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listSelector(miew, context) {\r\n let ret = '';\r\n\r\n for (const k in context) {\r\n if (context.hasOwnProperty(k)) {\r\n ret += `${k} : \"${context[k]}\"\\n`;\r\n }\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listObjs(miew) {\r\n const objs = miew._objects;\r\n\r\n if (!objs || !Array.isArray(objs) || objs.length === 0) {\r\n return 'There are no objects on the scene';\r\n }\r\n\r\n const strList = [];\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n strList[i] = `${i}: ${objs[i].toString()}`;\r\n }\r\n\r\n return strList.join('\\n');\r\n }\r\n\r\n joinHelpStr(helpData) {\r\n if (helpData instanceof Array) {\r\n return helpData.join('\\n');\r\n }\r\n return helpData;\r\n }\r\n\r\n help(path) {\r\n if (_.isUndefined(path)) {\r\n return `${this.joinHelpStr(clihelp.$help)}\\n${_.slice(_.sortBy(_.keys(clihelp)), 1).join(', ')}\\n`;\r\n }\r\n\r\n const helpItem = _.get(clihelp, path);\r\n return _.isUndefined(helpItem) ? this.help() : `${this.joinHelpStr(helpItem.$help)}\\n`;\r\n }\r\n\r\n load(miew, arg) {\r\n if (miew === undefined || arg === undefined || arg === '-f') {\r\n return;\r\n }\r\n miew.awaitWhileCMDisInProcess();\r\n const finish = () => miew.finishAwaitingCMDInProcess();\r\n miew.load(arg).then(finish, finish);\r\n }\r\n\r\n checkArg(key, arg, modificate) {\r\n if (key !== undefined && arg !== undefined) {\r\n if (keyRemap(key) === 'selector') {\r\n const res = selectors.parse(arg);\r\n\r\n if (res.error !== undefined) {\r\n const selExc = { message: res.error };\r\n throw selExc;\r\n }\r\n\r\n if (modificate !== undefined && modificate) {\r\n return res.selector;\r\n }\r\n return arg;\r\n }\r\n\r\n const modificators = {\r\n colorers,\r\n modes,\r\n materials,\r\n };\r\n\r\n let modificator = key;\r\n let temp;\r\n while (modificator !== temp) {\r\n temp = modificator;\r\n modificator = keyRemap(temp);\r\n }\r\n\r\n if (modificators[modificator].get(arg) === undefined) {\r\n const exc = { message: `${arg} is not existed in ${modificator}` };\r\n throw exc;\r\n }\r\n return arg;\r\n }\r\n return NULL;\r\n }\r\n\r\n propagateProp(path, arg) {\r\n if (path !== undefined) {\r\n let argExc = {};\r\n const adapter = options.adapters[typeof _.get(settings.defaults, path)];\r\n if (adapter === undefined) {\r\n const pathExc = { message: `${path} is not existed` };\r\n throw pathExc;\r\n }\r\n\r\n if ((path.endsWith('.color') || path.endsWith('.baseColor')\r\n || path.endsWith('.EL.carbon')) && typeof arg !== 'number') {\r\n arg = palettes.get(settings.now.palette).getNamedColor(arg);\r\n }\r\n\r\n if (path.endsWith('.fg') || path.endsWith('.bg')) {\r\n if (typeof arg !== 'number') {\r\n const val = palettes.get(settings.now.palette).getNamedColor(arg, true);\r\n if (val !== undefined) {\r\n arg = `0x${val.toString(16)}`;\r\n }\r\n } else {\r\n arg = `0x${arg.toString(16)}`;\r\n }\r\n }\r\n\r\n if (path.endsWith('.template')) {\r\n arg = arg.replace(/\\\\n/g, '\\n');// NOSONAR\r\n }\r\n\r\n if (arg !== undefined && adapter(arg) !== arg && adapter(arg) !== (arg > 0)) {\r\n argExc = { message: `${path} must be a \"${typeof _.get(settings.defaults, path)}\"` };\r\n throw argExc;\r\n }\r\n }\r\n return arg;\r\n }\r\n\r\n unquoteString(value) {\r\n return utils.unquoteString(value);\r\n }\r\n}\r\n// repIndexOrRepMap could be RepresentationMap or index\r\n\r\n\r\nconst utilFunctions = new CLIUtils();\r\n\r\nfunction CreateObjectPair(a, b) {\r\n const obj = {};\r\n obj[a] = b;\r\n return obj;\r\n}\r\n\r\nfunction ArgList(arg) {\r\n if (arg instanceof this.constructor) {\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n}\r\n\r\nArgList.prototype.append = function (value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n};\r\n\r\nArgList.prototype.remove = function (value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n};\r\n\r\nArgList.prototype.toJSO = function (cliUtils, cmd, arg) {\r\n const res = {};\r\n\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n _.set(res, list[i].id, cliUtils.propagateProp(`${keyRemap(cmd)}.${arg}.${list[i].id}`, list[i].val));\r\n }\r\n\r\n return res;\r\n};\r\n\r\nfunction Arg(_id, _val) {\r\n this.id = _id;\r\n this.val = _val;\r\n}\r\n\r\nconst cliutils = Object.create({});\r\n\r\ncliutils.Arg = Arg;\r\ncliutils.ArgList = ArgList;\r\n\r\ncliutils.miew = null;\r\ncliutils.echo = null;\r\ncliutils.representations = representationsStorage;\r\ncliutils.utils = utilFunctions;\r\n\r\ncliutils._ = _;\r\ncliutils.CreateObjectPair = CreateObjectPair;\r\ncliutils.keyRemap = keyRemap;\r\ncliutils.Context = selectors.Context;\r\ncliutils.ClearContext = selectors.ClearContext;\r\n\r\ncliutils.NULL = NULL;\r\n\r\ncliutils.notimplemented = function () {\r\n return this.NULL;\r\n};\r\n\r\nMiew.prototype.script = function (script, _printCallback, _errorCallback) {\r\n parsercli.yy.miew = this;\r\n parsercli.yy.echo = _printCallback;\r\n parsercli.yy.error = _errorCallback;\r\n if (this.cmdQueue === undefined) {\r\n this.cmdQueue = [];\r\n }\r\n\r\n if (this.commandInAction === undefined) {\r\n this.commandInAction = false;\r\n }\r\n\r\n this.cmdQueue = this.cmdQueue.concat(script.split('\\n'));\r\n};\r\n\r\nMiew.prototype.awaitWhileCMDisInProcess = function () {\r\n this.commandInAction = true;\r\n};\r\n\r\nMiew.prototype.finishAwaitingCMDInProcess = function () {\r\n this.commandInAction = false;\r\n};\r\n\r\nMiew.prototype.isScriptingCommandAvailable = function () {\r\n return this.commandInAction !== undefined\r\n && !this.commandInAction\r\n && this.cmdQueue !== undefined\r\n && this.cmdQueue.length > 0;\r\n};\r\n\r\nMiew.prototype.callNextCmd = function () {\r\n if (this.isScriptingCommandAvailable()) {\r\n const cmd = this.cmdQueue.shift();\r\n\r\n const res = {};\r\n res.success = false;\r\n try {\r\n parsercli.parse(cmd);\r\n res.success = true;\r\n } catch (e) {\r\n res.error = e.message;\r\n parsercli.yy.error(res.error);\r\n this.finishAwaitingCMDInProcess();\r\n }\r\n return res;\r\n }\r\n return '';\r\n};\r\n\r\nparsercli.yy = cliutils;\r\n// workaround for incorrect JISON parser generator for AMD module\r\nparsercli.yy.parseError = parsercli.parseError;\r\n"],"names":["this","Timer","startTime","oldTime","elapsedTime","running","now","getElapsedTime","update","delta","newTime","p","window","performance","bind","Date","createElement","tag","id","css","element","document","style","cssText","Stats","domElement","_text","appendChild","_startTime","_prevTime","_deltas","Array","_index","_total","_count","time","length","ms","fps","textContent","toPrecision","end","on","undefined","display","_typeof","isUndefOrEqual","param","value","EventDispatcher","_handlers","prototype","addEventListener","type","callback","context","handlers","params","_checkPar","par","_","find","push","removeEventListener","self","forEach","handler","ev","remove","values","omitBy","dispatchEvent","event","apply","priorities","debug","info","report","warn","error","Logger","call","console","_priority","Object","create","constructor","instantiate","verify","number","isNumber","Error","defineProperty","get","findKey","set","level","levels","keys","message","priority","_message","String","output","log","browserType","DEFAULT","SAFARI","encodeQueryComponent","text","excludeExp","encode","code","fromCharCode","parseInt","substr","encodeURIComponent","replace","decodeQueryComponent","decodeURIComponent","getUrlParameters","url","location","search","query","substring","indexOf","result","match","exec","getUrlParametersAsDict","a","i","key","resolveURL","str","URL","href","anchor","generateRegExp","symbolStr","symbolList","n","charCodeAt","toString","listStr","join","RegExp","attrs","content","setAttribute","child","createTextNode","HTMLElement","deriveClass","cls","base","members","statics","assign","deriveDeep","obj","needZeroOwnProperties","res","copy","hexColor","color","hex","DebugTracer","namespace","enabled","enable","indent","methods","wrap","method_","name_","spaces","logger","args","name","method","Function","OutOfMemoryError","allocateTyped","TypedArrayName","size","e","RangeError","bytesToBase64","buffer","bytes","Uint8Array","binary","byteLength","btoa","bytesFromBase64","atob","arrayToBase64","array","TypedArrayClass","arrayFromBase64","slice","compareOptionsWithDefaults","opts","defOpts","optsStr","isAlmostPlainObject","o","isPlainObject","proto","getPrototypeOf","hasOwnProperty","objectsDiff","src","dst","diff","forIn","srcValue","dstValue","deepDiff","isEmpty","isEqual","forInRecursive","object","iterateThrough","prefix","newPref","enquoteString","isString","unquoteString","SyntaxError","getFileExtension","fileName","Math","max","lastIndexOf","Infinity","splitFileName","ext","dataUrlToBlob","parts","split","partsCount","Blob","getBrowser","navigator","vendor","userAgent","shotOpen","open","write","shotDownload","dataUrl","filename","msSaveBlob","link","download","innerHTML","createObjectURL","body","click","removeChild","data","blobData","copySubArrays","indices","itemSize","j","shallowCloneNode","node","newNode","cloneNode","worldPos","unquotedStringRE","enquoteHelper","correctSelectorIdentifier","test","concatTypedArraysUnsafe","first","second","mergeTypedArraysUnsafe","reduce","acc","cur","start","count","JobHandle","_shouldCancel","slaveEvent","VERSION","defaults","modes","BS","atom","bond","space","multibond","aromrad","showarom","polyComplexity","poor","low","medium","high","ultra","VW","LN","offsarom","chunkarom","lineWidth","LC","SA","zClip","probeRadius","subset","wireframe","SE","QS","isoValue","gaussLim","scale","gridSpacing","CS","probePositions","TR","radius","TU","heightSegmentsRatio","tension","CA","depth","ss","helix","width","arrow","strand","TX","template","horizontalAlign","verticalAlign","dx","dy","dz","fg","bg","showBg","VD","kSigma","kSigmaMed","kSigmaMax","frame","isoMode","colorers","EL","carbon","UN","CO","baseColor","CB","factor","SQ","gradient","TM","min","OC","HY","MO","antialias","camFov","camNear","camFar","camDistance","radiusToFit","fogNearFactor","fogFarFactor","fogAlpha","fogColor","fogColorEnable","palette","resolution","autoResolution","autoPreset","preset","presets","mode","colorer","selector","material","empty","wire","small","macro","objects","line","dashSize","gapSize","transparent","draft","clipPlane","clipPlaneFactor","clipPlaneSpeed","plugins","axes","fog","zSprites","isoSurfaceFakeOpacity","suspendRender","nowater","autobuild","fxaa","outline","threshold","thickness","ao","shadow","autoRotation","maxfps","fbxprec","autoRotationAxisFixed","zooming","picking","pick","editing","aromatic","singleUnit","stereo","interpolateViews","transparency","translationSpeed","example","good","ssaoKernelRadius","ssaoFactor","stereoBarrel","use","multiFile","Settings","old","_changed","reset","utils","path","oldValue","_notifyChange","merge","_notifyChanges","defaultValue","cloneDeep","checkpoint","deepValue","deepPath","changed","filter","applyDiffs","diffs","getDiffs","versioned","setPluginOpts","plugin","repIndex","asBoolean","toLowerCase","adapters","string","Number","cL1Ass","cOptsSep","cL2Ass","cLSep","cCommonIgnoreSymbols","getLevel1ExcludedExpr","cLevel1Ignores","getLevel2ExcludedExpr","cLevel2Ignores","cL1ExclExpr","encodeQueryComponentL1","cL2ExclExpr","encodeQueryComponentL2","ensureRepList","reps","settings","ensureRepAssign","prop","rep","addObject","options","_objects","newOpts","newObj","parseParams","sep","extractArgs","input","defaultsDict","bang","inputVal","arg","pair","adapter","actions","l","load","t","v","view","u","unit","menu","isArray","r","s","select","m","c","mt","materials","dup","ar","_fromArray","entries","entry","action","isFunction","fromAttr","attr","fromURL","_processOptsForURL","_processArgsForURL","_processObjForURL","objOpts","toURL","stringList","idx","checkAndAdd","addReps","repList","addObjects","objList","protocol","host","pathname","_processOptsForScript","_processArgsForScript","_processObjForScript","map","_processRepsForScript","index","repString","strIdx","localAdd","toScript","commandsList","command","saveQuotes","quote","trim","Atom","residue","position","role","het","serial","occupancy","temperature","charge","mask","hydrogenCount","radicalCount","valence","bonds","flags","Flags","HYDROGEN","CARBON","process","_chain","getName","_sequence","NONPOLARH","Element","fullName","weight","radiusBonding","hValency","hydrogenValency","U1","Lead","U2","Wing","U18","N","Constants","C","O","SG","D","T","byAtomicNumber","ByAtomicNumber","byName","ByName","getByName","cBondTypes","UNKNOWN","COVALENT","AROMATIC","getAtomPos","Bond","left","right","order","fixed","_left","_right","_fixed","_order","_type","distanceTo","currAtom","_forEachNeighbour","l2Atom","refPoint","currDir","posGetter","rightCount","leftCount","tmpVec","clone","checkDir","sub","dotProd","dot","checkCarbon","stages","forEachLevelOne","forEachLevelTwo","stageId","multiplyScalar","third","maxNeibs","another","secondPos","firstV","secondV","crossVectors","lengthSq","normalize","_fixDir","BondType","cNucleicControlNames","cNucleicWing1Names","cNucleicWing2Names","cCylinderSource","cCylinderTarget","types","atoms","Residue","chain","sequence","icode","_component","_icode","_mask","_atoms","_secondary","_firstAtom","_leadAtom","_wingAtom","_lastAtom","_controlPoint","_midPoint","_wingVector","_cylinders","_isValid","_het","_molecule","xyz","altLoc","tempFactor","complex","getComplex","addAtom","forEachAtom","names","_findAtomByName","_name","next","getAtomPosition","leadAtom","_findFirstAtomInList","wingStart","wingEnd","cylSource","targetList","getCylinderTargetList","cylTarget","prevLeadPos","currLeadPos","prevWingPos","prevWing","vectorA","vectorB","needToNegate","abs","angleTo","PI","negate","prevRes","prev","nextRes","chainAsNucleic","bFirstInChain","lp","THREE","x","y","z","_detectLeadWing","lerp","calcWing","asNucleic","_innerFinalize","anotherResidue","tempCount","occupCount","ResidueType","letterCode","_fullName","ALA","ARG","ASN","ASP","CYS","GLN","GLU","GLY","HIS","ILE","LEU","LYS","MET","PHE","PRO","PYL","SEC","SER","THR","TRP","TYR","VAL","A","G","I","U","DA","DC","DG","DI","DT","DU","WAT","H2O","HOH","DOD","UNK","UNL","PROTEIN","BASIC","ACIDIC","POLAR","NONPOLAR","NUCLEIC","PURINE","PYRIMIDINE","DNA","RNA","WATER","_addFlag","flag","list","StandardTypes","hydro","_addParam","ChainType","Chain","_complex","_residues","minSequence","POSITIVE_INFINITY","maxSequence","NEGATIVE_INFINITY","residues","seqNum","iCode","_determineType","curr","_finalize2","frameData","prevData","frameRes","currData","getResidueType","addResidueType","addResidue","StructuralElement","init","term","generic","genericByType","serialAtomMap","residueHash","splitUnifiedSerial","chainId","serialId","hashCode","getUnifiedSerial","Type","STRAND","BRIDGE","HELIX_310","HELIX_ALPHA","HELIX_PI","HELIX","TURN_310","TURN_ALPHA","TURN_PI","TURN","BEND","COIL","Generic","LOOP","StructuralElementType","StructuralElementGeneric","typeByPDBHelixClass","Helix","helixClass","comment","Strand","sheet","sense","atomCur","atomPrev","as","isNaN","Sheet","_width","_strands","_finalize","SGroup","saveNode","_id","_position","_charge","_repeat","_center","xmlNodeRef","nLimon","bLow","bHight","aPos","addVectors","parser","k","$V0","$V1","$V2","$V3","$V4","$V5","$V6","$V7","$V8","$V9","$Va","$Vb","$Vc","$Vd","trace","yy","symbols_","terminals_","productions_","performAction","anonymous","yytext","yyleng","yylineno","yystate","$$","_$","$0","$","keyword","GetSelector","RangeList","append","Range","ValueList","table","defaultActions","parseError","hash","recoverable","parse","stack","tstack","vstack","lstack","TERROR","EOF","arguments","lexer","sharedState","setInput","yylloc","yyloc","ranges","lex","token","pop","symbol","state","yyval","len","newState","expected","errStr","showPosition","loc","first_line","last_line","first_column","last_column","range","concat","_input","_more","_backtrack","done","matched","conditionStack","offset","ch","lines","unput","oldLines","more","reject","backtrack_lexer","less","pastInput","past","upcomingInput","pre","test_match","indexed_rule","backup","matches","tempMatch","rules","_currentRules","flex","begin","condition","popState","conditions","topState","pushState","stateStackSize","yy_","$avoiding_name_collisions","YY_START","Parser","List","_values","splice","toJSON","includes","valuesArray","upperOnly","toUpperCase","_validate","Selector","ListSelector","RangeListSelector","ValueListSelector","caseSensitive","NoneSelector","_atom","AllSelector","none","PrefixOperator","rhs","InfixOperator","lhs","keywords","defineSelector","SelectorClass","factory","NULL_SELECTOR","defineOperator","OperatorClass","includesAtom","byResidueTypeFlag","selectors","Context","exc","ClearContext","BiologicalUnit","_selector","_boundaries","boundingBox","boundingSphere","makeEmpty","expandByPoint","bbc","getCenter","setFromCenterAndSize","radiusSquared","center","pos","lengthSquared","distanceToSquared","sqrt","Assembly","chains","matrices","oldCenter","oldRad","applyMatrix4","newRad","addScalar","subScalar","matrix","Component","_residueIndices","_cycles","_subDivs","_residueCount","resIdc","idIdc","idCount","last","subDivs","resCnt","_bonds","forEachCycle","cycle","forEachResidue","cycles","subs","currRes","endRes","_forEachSubChain","_subIdx","currIdx","lastSubIdx","subIdx","arr","boundaries","cMaxPairsForHashCode","cHashTableSize","cNumbersPerPair","cMaxNeighbours","cInvalidVal","cBigPrime","AtomPairs","maxPairsEstimate","numPairs","numMaxPairs","intBuffer","Int32Array","hashBuffer","indexA","indexB","ia","ib","codeToAdd","apI","cEstBondsMultiplier","cSpaceCode","cBondTolerance","cEpsilon","_getBondingRadius","_isAtomEligible","isHet","AutoBond","_maxRad","bBox","getDefaultBoundaries","_vBoxMin","_vBoxMax","_pairCollection","getAtoms","numAtoms","aInd","collection","numBondsForAtom","bInd","indTo","addPair","vw","getVoxelWorld","atomsNum","rA","isHydrogenA","posA","locationA","atomA","processAtom","atomB","isHydrogen","locationB","dist2","rB","maxAcceptable","forEachAtomWithinRadius","iA","iB","_addPair","bondsA","numBonds","newBond","addBond","_buildInner","_calcBoundingBox","_addExistingPairs","_findPairs","_addPairs","nAtoms","maxRad","destroy","cCrossThresh","cAromaticType","cAromaticAtoms","_coDirVectors","v1Tmp","v2Tmp","cp","v1","v2","_insertAscending","val","_anotherAtom","_cosBetween","theta","clamp","_markAromatic","Cycle","atomsList","nA","add","nextAtom","checkBond","forEachBond","_isAromatic","_isPossibleAromatic","rightIdx","leftIdx","_checkCycleSimple","_checkCycleComplex","assert","AromaticLoopsMarker","bondsData","bondMarks","_bondsData","_bondMarks","_resetCycles","_currIdx","bond1","bond2","arr1","arr2","n1","n2","i1","i2","prevBond","currRight","bondsOrder","currLeft","currVec","startAtomRef","_currStart","checkAromatic","_checkBond","_haveSameCycle","anotherAtom","anotherVec","newDir","cross","dir","newRight","_tryBond","checkCycle","forEachComponent","component","_startCycle","newCycle","addCycle","_findLoops","_getSphereSliceRadiusRange","zMin","zMax","dzMin","dzMax","rzMin","rzMax","rMin","rMax","_getCircleSliceRadiusRange","yMin","yMax","dyMin","dyMax","ryMin","ryMax","VoxelWorld","box","vCellSizeHint","_box","getSize","divide","floor","_last","_cellSize","_cellInnerR","_cellOuterR","numVoxels","_voxels","getAtomCount","voxelIdx","_findVoxel","point","zero","_zero","voxel","_voxel","xRange","_xRange","yRange","_yRange","zRange","_zRange","_forEachVoxelWithinRadiusSimple","rRangeXY","rRangeX","xVal","yVal","zVal","isInsideX","isInsideY","isInsideZ","divideScalar","clampScalar","vCenter","_vCenter","distTouch2","distInside2","d2","r2","_forEachVoxelWithinRadius","isInside","_forEachAtomInVoxel","dist","_forEachAtomWithinDistFromGroup","atomProc","voxels","processIfWithin","MINIMAL_DISTANCE","MIN_HBOND_ENERGY","MAX_HBOND_ENERGY","COUPLING_CONSTANT","MAX_COUPLING_DISTANCE","MAX_RESIDUES_THRESHOLD","HBondInfo","_hbonds","_buildVW","_build","from","to","acceptor","acc0","acc1","energy","ri","getType","preri","rj","prerj","_calcHBondEnergy","pairs","PairCollection","_residueGetCAlpha","_residueGetCO","h","predonor","donor","_residueGetNH","distanceHO","distanceHC","distanceNC","distanceNO","round","donorInfo","accInfo","BridgeType","freeze","NO_BRIDGE","PARALLEL","ANTI_PARALLEL","HelixFlag","START","MIDDLE","END","START_AND_END","StructureType","SecondaryStructureMap","_ss","_sheet","_betaPartners","_bend","getResidues","_helixFlags","_chainLengths","_chains","_buildBetaSheets","_buildAlphaHelices","inResidues","chainLength","inPreferPiHelices","stride","isBond","kappa","_kappa","_isHelixStart","isTurn","p1","p2","p3","p4","v12","v34","prevPrev","nextNext","curCA","ppCA","nnCA","ckap","_cosinusAngle","skap","atan2","bridges","lenA","chainA","b","lenB","chainB","_testBridge","found","bridge","unshift","chainI","getChain","chainJ","sort","ibi","iei","jbi","jei","ibj","iej","jbj","jej","_hasChainBreak","bulge","ladderset","Set","ladder","sheetset","toMove","_areBridgesLinked","betai","betaj","parallel","d","f","ai","aj","has","VOXEL_SIZE","helixClassMap","loopMap","Complex","_components","_helices","_sheets","structures","_residueTypes","_sgroups","_molecules","_maskNeedsUpdate","metadata","symmetry","units","_currentUnit","forEachChain","updateToFrame","resName","rt","chainName","resId","atomName","localeCompare","molecules","groups","components","maxSerial","chainShift","uniSerial","remnant","insCode","ser","addComp","comp","resCount","currStart","isConnected","setSubDivs","currSubDivs","enableEditing","_fillCmpEdit","_fillCmpNoedit","getBoundaries","getTransforms","getSelector","setCurrentUnit","newUnit","computeBoundaries","_computeBounds","_finalizeBonds","forEachSGroup","_rebuildSGroupOnAtomChange","updateStructuresMask","getBonds","finalize","getSequence","getICode","helices","sheets","needAutoBonding","autoConnector","build","other","_fillComponents","marker","markCycles","detectAromaticLoops","detectCycles","_finalizeMolecules","molecule","updater","structure","collectMask","forEachMolecule","setMask","clearMask","totalSelector","reseter","_atomNames","dict","_elements","_residueNames","_chainNames","_altlocNames","_voxelWorld","addAtoms","srcArray","dstArray","functor","elem","complexes","atomBias","bondBias","residueBias","chainBias","componentBias","bias","processBond","processResidue","processChain","processComponent","doNothing","addElement","ssMap","getSheet","item","lastCode","lastSheetIndex","lastHelixIndex","curStructure","curCode","curResidue","curSheetIndex","loopType","curSheet","addStrand","pow2ceil","Volume","dimensions","vecSize","volumeInfo","_dimVec","_volumeInfo","_dimX","_dimY","_dimZ","_rowElements","_planeElements","_totalElements","_data","getValue","setValue","addValue","boxSize","Float32Array","vl","getCellSize","vs","xSize","ySize","zSize","volMap","_voxelValue","zi","zm","zp","yi","ym","yp","xi","xm","xp","tilesX","ceil","tilesY","height","tileRow","row","texture","needsUpdate","Molecule","CSS2DObject","_element","parentNode","transp","el","getElement","op","top","op100","opacity","RCGroup","raycaster","intersects","visible","children","raycast","innerOnly","enableSubset","disableSubset","totalSubset","getSubset","precision","renderer","capabilities","getMaxPrecision","noiseWidth","noiseHeight","_noiseData","_noiseWrapS","_noiseWrapT","_noiseMinFilter","_noiseMagFilter","_noiseMapping","noiseTexture","_samplesKernel","defaultUniforms","lights","diffuse","specular","shininess","fixedColor","zOffset","zClipValue","clipPlaneValue","invModelViewMatrix","world2colorMatrix","dashedLineSize","dashedLinePeriod","projMatrixInv","viewport","samplesKernel","noiseTex","noiseTexelSize","srcTexelSize","uberOptionNames","UberMaterial","instancedPos","instancedMatrix","attrColor","attrColor2","attrAlphaColor","overrideColor","sphereSprite","cylinderSprite","fakeOpacity","prepassTransparancy","colorFromPos","shadowmap","shadowmapType","colorFromDepth","dashedLine","thickLine","fogTransparent","normalsToGBuffer","toonShading","uberOptions","setValues","uniforms","vertexShader","precisionString","fragmentShader","side","zClipCoef","noise","source","defines","extensions","createInstance","inst","USE_FOG","INSTANCED_POS","INSTANCED_MATRIX","ATTR_COLOR","ATTR_COLOR2","ATTR_ALPHA_COLOR","OVERRIDE_COLOR","SPHERE_SPRITE","fragDepth","CYLINDER_SPRITE","ZCLIP","CLIP_PLANE","FAKE_OPACITY","USE_LIGHTS","COLOR_FROM_POS","SHADOWMAP","SHADOWMAP_PCF_SHARP","SHADOWMAP_PCF_RAND","SHADOWMAP_BASIC","COLOR_FROM_DEPTH","PREPASS_TRANSP","DASHED_LINE","THICK_LINE","FOG_TRANSPARENT","drawBuffers","NORMALS_TO_G_BUFFER","TOON_SHADING","setUberOptions","shallow","updateUniforms","LAYERS","VOLUME","TRANSPARENT","PREPASS_TRANSPARENT","VOLUME_BFPLANE","COLOR_FROM_POSITION","SELECTION_LAYERS","resetTransform","quaternion","updateMatrixWorldRecursive","parent","updateMatrixWorld","addSavingWorldTransform","_worldMatrixInverse","getInverse","matrixWorld","multiply","decompose","renderDummyQuad","_material","depthWrite","_scene","_quad","_camera","render","renderScreenQuad","isIdentity","identity","equals","applyToPointsArray","w","elements","persp","ScreenQuadMaterial","srcTex","vertexScreenQuadShader","depthTest","renderScreenQuadFromTex","fragmentScreenQuadFromTex","renderScreenQuadFromTexWithDistortion","coef","fragmentScreenQuadFromTexWithDistortion","setMinimalFov","angle","aspect","fov","radToDeg","atan","tan","degToRad","updateHalfSized","camera","originalAspect","originalFov","updateProjectionMatrix","setDistanceToFit","sin","intersectVisibleObject","gfxObj","fogFarPlane","intersectObject","nearPlane","near","matrixWorldInverse","farPlane","far","extractScale","_v","te","det","determinant","_calcCylinderMatrix","posBegin","posEnd","posCenter","matScale","makeScale","matRotHalf","makeRotationX","matRotLook","vUp","lookAt","setPosition","_calcChunkMatrix","eye","target","up","rad","_forEachMeshInGroup","group","processObj","_countMeshTriangles","mesh","geom","geometry","attribs","attributes","property","currAttr","indexSize","faces","_countTriangles","totalCount","_groupHasGeometryToRender","hasGeoms","traverse","_buildDistorionMesh","widthSegments","heightSegements","calcInverseBarrel","epsilon","prevR2","curR2","dr","geo","getAttribute","setXY","copyAtList","attribute","indexList","fillArray","startIndex","endIndex","removeChildren","clearTree","dispose","destroyObject","belongToSelectLayers","layers","_getMeshesArr","root","meshTypes","meshes","applyTransformsToMeshes","mtc","mtcCount","applyMatrix","newMesh","processTransparentMaterial","prepassMat","prepassMesh","processColFromPosMaterial","colFromPosMat","colFromPosMesh","createShadowmapMaterial","receiveShadow","castShadow","shadowmapMat","shadowmapMesh","isShadowmapMesh","removeShadowmapMaterial","processObjRenderOrder","idMaterial","renderOrder","isGroup","makeVisibleMeshes","checker","applySelectionMaterial","depthFunc","getMiddlePoint","point1","point2","optionalTarget","addScaledVector","calcCylinderMatrix","calcChunkMatrix","forEachMeshInGroup","countTriangles","groupHasGeometryToRender","buildDistorionMesh","_defaultBoundaries","Visual","dataSource","gfxutils","_dataSource","release","getDataSource","_ensureArray","EntityList","entities","_list","_dict","_indices","entity","register","registerInList","registerInDict","unregisterFromList","unregisterFromDict","makeContextDependent","defineProperties","CollisionSphere","_radius","sphere","_sphere","ray","intersectSphere","distance","origin","SphereCollisionGeo","inters","chunkIdx","computeBoundingBox","tmpColor","OFFSET_SIZE","COLOR_SIZE","setArrayXYZ","setArrayXYZW","InstancedSpheresGeometry","spheresCount","sphereComplexity","useZSprites","_sphGeometry","_init","itemIdx","itemPos","itemRad","_offsets","setSphere","colorVal","_colors","g","finishUpdate","computeBoundingSphere","chunkIndices","alphaArr","_alpha","instanceCount","sphereGeo","alpha","fill","RaycastableBufferGeometry","uv1","uv2","uv3","barycoord","_barycoord","barycoordFromPoint","pA","pB","pC","intersect","intersectTriangle","uv","vA","_vA","vB","_vB","vC","_vC","intersectionPoint","_intersectionPoint","fromBufferAttribute","intersection","checkIntersection","uvA","_uvA","uvB","_uvB","uvC","_uvC","uvIntersection","normal","getNormal","face","faceIndex","intersectsSphere","intersectsBox","getX","checkBufferGeometryIntersection","MAX_IDC_16BIT","VEC_SIZE","ChunkedObjectsGeometry","chunkGeo","chunksCount","_chunkGeo","colors","chunkSize","_chunkSize","facesPerChunk","srcPos","_positions","srcNorm","_normals","srcColor","dstPos","dstNorm","dstColor","dstPtOffset","ptIdxBegin","ptIdxEnd","subarray","chunkIndex","chunkIndexSize","pointsCount","use32bitIndex","Uint32Array","Uint16Array","posOffset","setIndex","SimpleSpheresGeometry","sphGeometry","normals","geoNormals","_chunkPos","_tmpPositions","tmpPos","geoPos","centerPos","tmpVector","normMtx","Simple2CCylindersGeometry","cylGeometry","_chunkNorms","_tmpVector","botPos","topPos","firstOffset","secondOffset","tmpArray","geoNorm","lerpVectors","mtx1","getNormalMatrix","fromArray","toArray","applyMatrix3","colorVal1","colorVal2","MAX_POINTS_COUNT_16BIT","PTS_PER_TRIANGLE","CylinderBufferGeometry","radiusTop","radiusBottom","radialSegments","heightSegments","openEnded","thetaStart","thetaLength","parameters","hasTop","hasBottom","vertexCount","facesCount","heightHalf","positions","uvs","currVtxIdx","currFaceIdx","tanTheta","v3","v4","setXYZ","vx","vy","vz","cos","startTIdx","lastIdx","fTIdx","currSrcIdx","getY","getZ","nextTVtx","startBIdx","lastBIdx","fBIdx","currSrcBIdx","nextBVtx","invMatrix","sortNumber","_prepareCylinderInfo","chunksIdx","cylinderInfo","even","newPar","_assignOpacity","color1","color2","Instanced2CCylindersGeometry","_useZSprites","_cylGeometry","_collisionGeo","me","mtxOffset","setItem","_matVector1","_matVector2","_matVector3","_invmatVector1","_invmatVector2","_invmatVector3","colorIdx","_color1","_color2","cylinderIndices","cylinderGeo","TRI_SIZE","tmpPrev","tmpNext","tmpRes","simpleNormal","normalOnCut","nearRingPt","_createExtrudedChunkGeometry","shape","ringsCount","ptsCount","totalPts","ExtrudedObjectsGeometry","_ringsCount","tmpShape","_tmpShape","hasSlope","hasCut","chunkStartIdx","_setPoints","_setSlopeNormals","_setBaseNormals","_addCut","vtxIdx","mtx","nPtsInRing","_countNormalsInRing","isSlope","shiftToExtraPt","subVectors","VERTEX_PER_SEGMENT","POS_SIZE","DIR_SIZE","COL_SIZE","direction","startSegmentIdx","segmentsCount","elemSize","ThickLinesGeometry","_initVertices","segmentIdx","pos1","pos2","directions","_directions","dirIdx","startSegIdx","endSegIdx","startPos","startDir","_buffersSize","indexOffset","pointOffset","LinesGeometry","posSize","getPositionSize","BaseLinesGeometry","CylinderCollisionGeo","itemOffset","COLLISION_RAD","ChunkedLinesGeometry","enableCollision","collisionGeo","segCount","segIdx","setSegments","getSubsetSegments","setColors","getSubsetColors","TwoColorLinesGeometry","segmentIndices","_segCounts","vectors","vecCount","tempPos1","tempPos2","CrossGeometry","setSegment","POS_RAD_SIZE","IsoSurfaceGeometry","_opts","_posRad","posRad","IsoSurfaceMarchCube","pointsValuesLinear","hasIntersection","bitsInside","numCellsPerSide","vx7000000","n3","striIndicesMarchCube","edgeTable","_voxelGradientFast","grad","GridCell","_arrSize","cubeIndex","Triangle","createArray","arrSize","IsoSurface","_numTriangles","_numVertices","_volumetricData","_xAxis","_yAxis","_zAxis","_xDir","_yDir","_zDir","volData","cellSize","xAxis","yAxis","zAxis","xDir","yDir","zDir","tmp","notZero","axe","EPSILON","isoLevel","grid","ind1","ind2","vertex","valP1","valP2","isoDiffP1","diffValP2P1","mu","triangles","firstIndices","_firstIndices","secondIndices","_secondIndices","vertexList","_vertexList","normalList","_normalList","_vertexInterp","triCount","triTblIdx","triTable","_triTable","step","appendSimple","vol","getData","dim","getDimensions","stepX","getStrideX","stepY","getStrideY","stepZ","getStrideZ","gc","gcVal","gcValSize","additions","tmpTriCount","appendVertex","axis","triVertex","_origin","posMtx","globTriCount","getDirectIdx","_gradient","_polygonize","computeGradient","_doGridPosNorms","_prepareAxesAndDirs","vertexMap","idcCount","newIndices","vertices","newPositions","newNormals","norm","faceVer","oldVerCount","vMap","newVer","matchedIndex","_remapIndices","_remapVertices","colorMap","atomMap","atomWeightMap","visibilitySelector","numVerts","xs","ys","zs","colorData","strideX","strideY","strideZ","atomWeightData","atomStrideX","atomStrideY","atomStrideZ","xInv","yInv","zInv","atomLookup","atomWeights","interp","idx1","idx2","collectWeight","coefX","coefY","coefZ","newVerCount","ind","mux","muy","muz","maxWeight","dominantIdx","atomIdx","c0","c1","c2","c3","cz0","cz1","numTriangles","newTriCount","i0","VolumeSurfaceGeometry","_visibilitySelector","_calcSurface","posRadArray","itemsCount","maxPosRad","minPosRad","tmpVal","minMaxValues","_findMinMax","minCoordRad","maxCoordRad","gridPadding","radScale","padRad","bbox","surface","isoSurf","compute","vertexFusion","setColorVolTex","volTexMap","packedArrays","_findNumVoxels","_computeSurface","_makeSurface","chem","QuickSurfGeometry","_shiftByOrigin","gaussdensity","atomicNum","invIsoValue","invGridSpacing","maxVoxelX","maxVoxelY","maxVoxelZ","volTexData","texStrideX","scaledRad","atomicNumFactor","radInv","radLim","radLim2","xMin","xMax","dy2dz2","addr","texAddr","expVal","density","exp","colInd","originX","originY","originZ","AVHash","maxDistance","minX","minY","minZ","maxX","maxY","maxZ","hashFunc","minW","iDim","jDim","kDim","nCells","jkDim","cellID","preHash","cid","iIdx","cellOffsets","cellLengths","maxCellLength","subArray","cellLength","neighbourListLength","withinRadii","rExtra","out","outIdx","nearI","nearJ","nearK","loI","loJ","loK","hiI","hiJ","hiK","iOffset","jOffset","cellStart","cellEnd","dataIndex","atomIndex","baseIndex","rSum","ContactSurface","_indexList","maxRadius","scaleFactor","lastClip","volTex","weights","weightsMap","gridx","gridy","gridz","sinTable","cosTable","neighbours","mid","ngTorus","uniformArray","TypeName","innI","fillGridDim","initializeGrid","gridSize","initializeAngleTables","initializeHash","rExt","singleAtomObscures","innX","innY","innZ","innCI","ra2","obscured","ni","projectPoints","sigma","sigma2Inv","ax","ay","az","ar2","ng","iax","iay","iaz","minx","miny","minz","maxx","maxy","maxz","colIdx","cr","cg","cb","iz","iy","dzy2","zyOffset","ix","cIdx","ap","spx","spy","spz","dd","normalToLine","projectTorus","aIdx","bIdx","xa","ya","za","r1","innR2","cosA","dmp","rInt","cost","sint","px","py","pz","current","projectTorii","innIdx","fixNegatives","innInnI","getVolume","timeEnd","ContactSurfaceGeometry","contactSurface","IsoSurfaceAtomColored","radiusAt","coord","colorX","colorY","colorZ","atomType","srcAtom","IsosurfaceBuildNormals","vBoxMin","vBoxMax","_numAtoms","_probeRadius","_atomsList","_voxelList","numAtomsRefs","ATOM_VOXEL_REF_SCALE","aveRad","numCells","_numCells","_aveRad","side2","side3","xScale","_xScale","yScale","_yScale","zScale","_zScale","maxAtomsRefs","xNumVoxMult","yNumVoxMult","zNumVoxMult","radAffect","diaAffect","numVoxX","numVoxY","numVoxZ","xIndMin","yIndMin","zIndMin","xIndMax","yIndMax","zIndMax","indVoxel","indexNext","_vertices","xInd","yInd","zInd","ref","indexAtom","closest","minDist2","MAX_VALUE","forEachRelatedAtom","numVertices","numCloseAtoms","vNormalX","vNormalY","vNormalZ","koef","r25","r01","maxRadAffect","maxRadAffect2","expScale","gatherNormals","radiusColorSmoothness","KOEF_ADD","colorsClose","weightsSum","gatherColors","weightNormalized","IsoSurfaceGeo","maxNumVertices","maxNumTriangles","needVertexColors","_maxNumVertices","_maxNumTriangles","HASH_SIZE","SSIsosurfaceGeometry","_innerBuild","geoOut","getGeo","_fromGeo","numTri3","atomsColored","nm","hashLines","hashEntries","bigNum","probeRadius2","atomRadiusScale","radMax","num","numPoints","vOut","invNP","tx","ty","tz","sign","cube","indexPointValue","cTwentyFour","xb","yb","zb","v0","a0","voxelWorld","getClosestAtom","a1","a2","isTriangleVisible","indInGeo0","addVertexToGeo","indInGeo1","indInGeo2","itr","meshRes","corners","vCellStep","cNumVerts","vaEdges","vCorner","indCell","indY","indZ","getCornerCoord","indPointValues","indValues","buildEdgePoint","offs","numTri","indTri","addTriangle","numIntersectedCells","cubeValuesIndex","indCorner","letter","atomT","probeRad","vDif","aLot","fx","fy","fz","indXMin","indYMin","indZMin","indXMax","indYMax","indZMax","distToSphere","numHashEtriesAllocated","numHashEntryIndex","vAdd","oneHynberes","n815851","n37633","n2453543","r106","hashResolution","marCubeResoultion","iHash","hLineIndex","dot2","iVertAdd","getNewHashEntry","entryFirst","probeSphereRadius","distToBorder","r11","innerBlockWorkAround","probeSpRad2","sideInv","radEst","xCorner","yCorner","zCorner","ok","expandFactor","meshResolution","colorMode","useVertexColors","excludeProbe","convertToAtomsColored","getBoundingBox","rProbeRadius","calculateGridCorners","numIntersectedCellsEstim","getNumIntersectedCells","createVertexHash","probeRadForNormalsColors","createVoxels","buildGeoFromCorners","modifyExcludedFromGeo","buildNormals","buildColors","destroyVoxels","createLabel","fieldTxt","className","spanText","fontSize","strings","spanNodeP","spanNodeText","LabelsGeometry","items","xTranslation","yTranslation","deltaPos","userData","translation","textAlign","fColor","bColor","background","SuperClass","NewObjectType","rest","onBeforeRender","scene","_onBeforeRender","_update","Mesh","UberObject","ZSpriteMesh","_geometry","_group","modelViewMatrix","multiplyMatrices","uniformsNeedUpdate","ZClippedMesh","modelView","_modelView","mvLength","_mvLength","setFromMatrixColumn","localToWorld","TextMesh","initialized","srcItem","label","visibility","SimpleMesh","_viewport","ThickLineMesh","projectionMatrix","InstancedMesh","ZClipped","ZSprite","Text","Line","LineSegments","Instanced","setMatParams","_createInstancedCylinders","Geometry","geometries","initMaterial","_createLineSegmentsGeoTriplet","renderParams","thickLines","_createSimpleGeoTriplet","geoClass","_createIsoSurfaceGeoTriplet","caps","surfaceOpts","MeshCreator","_caps","_settings","TransformGroup","geoParams","transforms","_geoParams","mat","_transforms","_createMeshes","_ray","inverseMatrix","_inverseMatrix","childIntersects","ciCount","geos","meshCnt","wrapper","Name","ChemGroup","selection","_selection","_mode","_colorer","_chunksIdc","chunks","_polyComplexity","_geo","_makeGeoArgs","_mesh","chunksList","_calcChunksList","setOpacity","_changeSubsetOpacity","AtomsGroup","atomsIdc","AtomsSphereGroup","calcAtomRadius","setColor","getAtomColor","updateColor","needsColorUpdate","AtomsSurfaceGroup","selectedAtoms","getSurfaceOpts","AtomsSASSESGroupStub","adjustColor","inverseColor","getAtomText","getNode","getVisualName","colorMappings","adjust","inverse","propagateColor","rule","startsWith","templateMappings","hetatm","water","parseTemplate","AtomsTextGroup","getLabelOpts","fgColor","bgColor","_slerp","omega","oSin","AromaticGroup","radOffset","addChunk","chunksToIdx","prevVector","currVector","segmentsHeight","_segmentsHeight","leprStep","currAtomIdx","cCount","cycAtoms","chunkPoints","tmpDir","cycleRad","prevPos","currPos","upDir","currAngle","_createShape","pts","AromaticTorusGroup","torusRad","getAromRadius","radiusV","calcStickRadius","lookAtVector","points","currPoint","AromaticLinesGroup","getAromaticOffset","prevPt","getAromaticArcChunks","ResiduesGroup","chunksIdc","resIdx","NucleicItemGroup","stickRad","getResidueColor","_processItem","NucleicCylindersGroup","cyl1","cyl2","NucleicSpheresGroup","calcMatrix","_buildStructureInterpolator","Smooth","METHOD_CUBIC","clip","CLIP_CLAMP","cubicTension","scaleTo","argTrans","transformT","tt","newt","ans","_addPoints","centerPoints","topPoints","tp","_addPointsForLoneResidue","nucleic","nameFrom","nameTo","posFrom","posTo","shift","wing","cpPrev","tpPrev","cpNext","tpNext","_calcPoints","firstIdx","_prevIdx","_nextIdx","arrIdx","_extrapolate2","otherIdx","prevIdx","nextIdx","CartoonHelper","startIdx","endIdx","pointsArrays","_topInterp","_centerInterp","_shift","_valueStep","_segmentsCount","firstRad","secondRad","outMtc","currRad","topInterp","cenInterp","currentValue","mtxIdx","lerpVal","currTop","currCenter","nextCenter","_loopThrough","subDiv","subDivI","subDivN","idc","matrixHelper","prevLast","prevSecondRad","getResidueRadius","prepareMatrices","ResiduesSubseqGroup","cmpMultiplier","getHeightSegmentsRatio","getTension","chunkIdc","subdivs","ResiduesTraceGroup","chunk","getCylinderCount","bondOrder","BondsGroup","drawMultiple","drawMultiorderBonds","showAromatic","showAromaticLoops","bondsIdc","bondsCount","getBondOrder","bondIdx","BondsCylinderGroup","emptyOffset","calcSpaceFraction","normDir","leftPos","rightPos","currBondIdx","atom1","atom2","a1Pos","a2Pos","calcNormalDir","minRad","currStickRad","STEP_SIZE","BondsLinesGroup","bondDir","a1Hangs","a2Hangs","AtomsProcessor","atomCount","_checkAtom","atomsGroup","meshIdx","chSubset","subsetEl","OrphanAtomsProcessor","ResiduesProcessor","ResidueGroup","_checkResidue","residuesGroup","NucleicProcessor","ResidueProcessor","SubseqsProcessor","getMaskedSubdivSequences","jEnd","BondsProcessor","bondsGroup","AromaticProcessor","cycleIdx","perCycle","Atoms","OrphanAtoms","Residues","Nucleic","Subseqs","Bonds","Aromatic","_bakeGroup","triplet","Processor","Group","GroupsFactory","gfxTriplet","createSpheres","processors","createCrosses","create2CCylinders","create2CLines","createExtrudedChains","create2CClosedCylinders","createChunkedLines","createQuickSurface","createContactSurface","createSASSES","createLabels","Mode","groupList","depGroups","groupCount","currGroup","newGroup","getRenderParams","LinesMode","shortName","LicoriceMode","BallsAndSticksMode","VanDerWaalsMode","TraceMode","TubeMode","_residue","TUBE_RADIUS","buildGeometry","CartoonMode","secCache","getSecondary","secOpts","ARROW_END","startRad","getResidueStartRadius","endRad","getResidueEndRadius","_res","tubeRad","secHeight","secData","SurfaceMode","surfaces","surfaceNames","isSurface","QuickSurfaceMode","useBeads","getVisibilitySelector","IsoSurfaceMode","_excludeProbe","_radScale","IsoSurfaceSASMode","IsoSurfaceSESMode","ContactSurfaceMode","TextMode","lerpColor","beta","g1","b1","g2","b2","Palette","asIs","elementColors","defaultElementColor","residueColors","defaultResidueColor","chainColors","secondaryColors","defaultSecondaryColor","gradientName","gradients","defaultNamedColor","namedColors","minRangeColor","midRangeColor","maxRangeColor","defaultGradientColor","namedColorsArray","rainbow","temp","hot","cold","reds","blues","H","F","P","S","CL","FE","NI","CU","BR","HE","LI","BE","B","NE","NA","MG","AL","SI","AR","K","SC","TI","V","CR","MN","ZN","GA","GE","AS","KR","RB","SR","Y","ZR","NB","TC","RU","RH","PD","AG","CD","IN","SN","SB","TE","XE","BA","LA","CE","PR","ND","PM","SM","EU","GD","TB","DY","HO","ER","YB","LU","HF","TA","W","RE","OS","IR","PT","AU","HG","TL","PB","BI","PO","AT","RN","FR","RA","AC","TH","PA","NP","PU","AM","CM","BK","CF","ES","FM","MD","NO","LR","RF","DB","BH","HS","MT","palettes","cpkPalette","jmolPalette","vmdPalette","Colorer","ElementColorer","getElementColor","ResidueTypeColorer","SequenceColorer","getGradientColor","ChainColorer","getChainColor","SecondaryStructureColorer","getSecondaryColor","secondary","UniformColorer","ConditionalColorer","parsed","_subsetCached","ConformationColorer","TemperatureColorer","OccupancyColorer","HydrophobicityColorer","hydrophobicity","MoleculeColorer","getMoleculeCount","scaleColor","CarbonColorer","colorCarbon","colorNotCarbon","neutralColor","intensity","materialList","Representation","startMaterialValues","selectorString","materialPreset","needsRebuild","setMode","markAtoms","clearAtomBits","selectionGeo","sg","matrixAutoUpdate","repSettings","selStr","valueOf","modeDiff","identify","colorerDiff","newSelectorObject","newSelector","newMode","newColorer","newMaterial","setMaterialPreset","_traverseComponentGroups","ComplexEditor","ComplexComponentEditor","complexVisual","_complexVisual","_inProgress","_componentTransforms","_bakeComponentTransform","onAtomPositionChanged","_resetComponentTransform","finalizeEdit","pivot","visual","getSelectedComponent","getSelectionGeo","selectionMask","getSelectionBit","reprNode","bbmin","bbmax","updateMatrix","ComplexFragmentEditor","_getSelectionBorderAtoms","_fragmentBoundAtoms","pivotPos","_fragmentGeo","_fragmentSelectionGeo","vg","smeshes","sm","selectionBit","makeTranslation","_bakeAtomTransform","boundAtoms","transformDirection","atomHash","ComponentEditor","FragmentEditor","lookupAndCreate","entityList","specs","Entity","ComplexVisual","_reprList","_repr","_reprListChanged","_selectionBit","_reprUsedBits","_selectionCount","_selectionGeometry","_editor","repCurrent","repAdd","desc","status","change","bits","NUM_REPRESENTATION_BITS","newSelectionBit","_getFreeReprIdx","originalSelection","buildSelectorFromMask","def","unmarkAtoms","hide","show","markAtomsAdditionally","rebuildSelectionGeometry","pickedObj","otherObj","getMolecule","resetSelectionMask","tmpMask","deselectionMask","multiple","selRule","reprList","repr","Promise","resolve","errorOccured","setTimeout","hasGeometry","buildSelectionGeometry","optimizeList","NaN","expression","all","or","and","residx","_buildSelectorFromSortedLists","editor","ComplexVisualEdit","needTraverse","forEachAtomWithinDistFromMasked","countAtomsByMask","volumeUniforms","volumeDim","tileTex","tileTexSize","tileStride","boxAngles","_isoLevel0","_flipV","_BFLeft","_BFRight","_FFLeft","_FFRight","_WFFLeft","_WFFRight","overrideUniforms","defUniforms","facesPosMaterialParams","sideType","vertexVolumeFaces","fragmentVolumeFaces","BackFacePosMaterial","backFaceParams","ShaderParams","BackFacePosMaterialFarPlane","matUniforms","aspectRatio","farZ","tanHalfFOV","matWorld2Volume","shaderParams","vertexFarPlane","fragmentFarPlane","FrontFacePosMaterial","frontFaceParams","VolumeMaterial","vertexVolume","fragmentVolume","updateDefines","ISO_MODE","STEPS_COUNT","VolumeMesh","cullFlag","_corners","edges","_edges","edgeIntersections","_edgeIntersections","constant","vert","cornerMark","edgeMark","curEdge","curEdgeInter","CheckX","CheckY","CheckZ","curEdgeIdx","curEdgeSource","nextVertex","coplanarPoint","faceIdx","_collectVertices","vRight","vDir","rightProj","_sortIndices","numIndices","vm","getTiledTextureStride","buildTiledTexture","getBox","image","getVolumeInfo","volInfo","obtuseAngle","mean","dmean","dmin","span","dmax","sd","nearClipPlaneOffset","_nearClipPlaneOffset","_pos","_norm","norm4D","_norm4D","matrixWorldToLocal","_matrixWorldToLocal","_clipPlane","_updateIsoLevel","getWorldDirection","getWorldPosition","setFromNormalAndCoplanarPoint","_updateVertices","_updateIndices","VolumeBounds","bSize","offsetVert","_getBaseVertices","_lines","projTable","_projectionTable","proj","inv","currDelta","angleValue","XY","XZ","YZ","VolumeFarPlane","volume","planeGeo","_initPlaneGeo","_plane","frustumCulled","doubleSided","matWorldToVolume","_renderer","planeCamPos","normalMatrix","volumeMatrix","DEG2RAD","VolumeVisual","setDataSource","_frame","getMesh","showFrame","_farPlane","getBoundingSphere","needShow","LoaderList","someLoaders","SomeLoader","canProbablyLoad","Loader","_source","_options","_abort","_agent","abort","FileLoader","_binary","blob","reader","FileReader","readAsArrayBuffer","readAsText","File","urlStartRegexp","XHRLoader","request","XMLHttpRequest","response","responseType","send","ImmediateLoader","ParserList","someParsers","format","formats","SomeParser","canProbablyParse","parseSync","model","_parseHeader","Remark290","_matrix","_matrixIndex","stream","readString","matrixRow","readCharCode","matrixData","matrixIndex","parseFloat","Remark350","assemblies","_assembly","assembly","addMatrix","addChain","PDBStream","_start","_nextCR","_nextLF","_next","_end","TAG_LENGTH","nameToElement","veryLong","pdbStartRegexp","remarkParsers","PDBParser","_serialAtomMap","_modelId","_compaundFound","_biomoleculeFound","_allowedChainsIDs","_lastMolId","_remarks","_remark","_compndCurrToken","fileType","_fixBondsArray","_fixChains","remark290","isUndefined","remark350","chainDict","chainObj","idChainMap","nj","readInt","readChar","chainID","resSeq","readFloat","Role","serial0","serial1","serial2","serial3","serial4","tokenIdx","chainStr","lastChar","remarkNum","remark","RemarkParser","fields","_parseSTRUCTURE","addHelix","addSheet","pars","adder","startId","endId","codeOfS","serialNumber","structureName","helLength","shWidth","shCur","shPrev","startChainID","endChainID","startSequenceNumber","iCodeStr","startICode","endSequenceNumber","endICode","cs","classification","date","title","func","tagParsers","HEADER","_parseHEADER","_parseTITLE","_parseATOM","HETATM","ENDMDL","_parseENDMDL","CONECT","_parseCONECT","COMPND","_parseCOMPND","REMARK","_parseREMARK","_parseHELIX","_parseSHEET","cOrderCharCodes","cmlStartRegexp","CMLParser","_readOnlyOneMolecule","atomId","countBonds","idxs","atomRefs2","moleculeArr","fieldData","atomRefs","placement","fieldName","_extractSGroup","_createSGroup","firstAtomRef","sgroupRef","mapEntry","cycleFuncInner","cycleFunc","x2","x3","y2","y3","z3","atomsRef","dom","parseNode","xmlNode","nodeName","nodeValue","jsonNode","existing","childNodes","molSet","atomArray","_findSuitableMolecule","DOMParser","doc","parseFromString","traversedData","_traverseData","rawData","prepareComponentCompound","ret","atomLabels","labelsCount","_extractSGroups","localBond","bondArray","_rebuidBondIndexes","addCurrBond","orderAttr","tc","labels","_breadWidthSearch","retStruct","originalCML","cml","retData","filteredData","rd","compId","molId","molID","_packLabel","breadthQueue","componentID","labeledAtoms","startID","_unpackLabel","eAtom","mainAtom","varData","currentLabel","addFunc","complexAtom","reorder","atomCharge","lLabel","atomFullNameStruct","elementType","countRef","currAtomComp","strLabel","JSON","stringify","atomSerial","added","mrvValence","_parseBond","getSGroupCount","sGrp","getSGroups","moleculaSet","_selectComponents","_parseSet","totalAtomsParsed","joinedComplex","joinComplexes","ArrayComparator","original","_original","_sum","candidate","sum","sorted","secStructToType","getFirstByte","buf","MMTFParser","_modelData","chainData","modelIndex","chainIndex","groupData","groupName","groupId","groupIndex","_updateSecStructure","atomData","xCoord","yCoord","zCoord","bFactor","formalCharge","bondData","atomIndex1","atomIndex2","helixClasses","secStruct","_ssType","_ssStruct","_ssStart","struct","mmtfData","chainsInModel0","chainsPerModel","chainIndexList","description","structureId","releaseDate","eventCallbacks","onModel","modelData","_onModel","onChain","_onChain","onGroup","_onGroup","onAtom","_onAtom","onBond","_onBond","MMTF","_updateMolecules","named","bioAssemblyList","baInfo","transformList","chainListCheck","chainNames","allChains","_chainsByName","compare","transpose","transform","primaryChainsArray","primaryChainsHash","primary","decode","_traverse","_linkAtomsToResidues","_markHeteroAtoms","_findSynonymousChains","_parseAssemblyInfo","_joinSynonymousChains","isArrayBuffer","ParsingError","column","captureStackTrace","parseLine","parseColumn","_isWhitespace","_inlineIndexOf","ch0","readCIF","newline","block","keysCount","valuesCount","_parseValue","_storeKey","_storeValue","keyIndex","cRequiredAtomFields","cSecondaryCoding","helx","turn","strn","getTypeFromId","typeId","arrize","arrayLikeObject","AtomDataError","_getOperations","operList","vector","ops","_extractOperations","assemblyGen","opsDict","groupStr","gps","grIdx","grCount","gr","gp","es","cnt","ii","nn","newMtx","CIFParser","asymDict","_toComplex","cifData","complexData","_extractAtoms","_extractSecondary","_extractAssemblies","_extractMolecules","_extractMetadata","struct_keywords","pdbx_keywords","databaserev","database_PDB_rev","date_original","molData","pdbx_description","getMolecules","atom_site","auth_seq_id","Cartn_x","Cartn_y","Cartn_z","label_atom_id","group_PDB","chainIdc","auth_asym_id","chainLabelIdc","label_asym_id","serials","iCodes","pdbx_PDB_ins_code","resNames","label_comp_id","type_symbol","tempFactors","B_iso_or_equiv","occupancies","charges","pdbx_formal_charge","altLocs","label_alt_id","models","pdbx_PDB_model_num","label_entity_id","moleculeIdx","struct_conf","_extractConfs","struct_sheet_range","_extractSheets","sheetData","sheet_id","beg_label_seq_id","end_label_seq_id","beg_label_asym_id","sheetNames","strandNames","starts","beg_auth_seq_id","ends","end_auth_seq_id","stICodes","pdbx_beg_PDB_ins_code","endICodes","pdbx_end_PDB_ins_code","findResidue","helicesData","conf_type_id","comments","details","lengths","pdbx_PDB_helix_length","pdbx_PDB_helix_class","asmGen","pdbx_struct_assembly_gen","asmIdx","assembly_id","asmOper","oper_expression","asmList","asym_id_list","pdbx_struct_oper_list","asm","assemblyOps","valueType","singular","VolumeModel","_header","_boxSize","_boxStart","extent","nstart","crs2xyz","cellDims","angles","isTypedArray","_buff","TypeError","headerFormat","arrays","_parseArray","_parseVector","_buffer","header","gamma","z1","z2","xaxis","yaxis","zaxis","_xyz2crs","shiftX","shiftY","_setOrigins","_getXYZdim","_getXYZbox","_toXYZData","_getVolumeInfo","CCP4Header","ispg","nsymbt","lksflg","customData","machine","nlabel","Ccp4Model","_typedCheck","u32","i32","f32","_fillHeader","xyz2crs","_getAxis","_setAxisIndices","_setBoxParams","xyzData","crsIdx","CCP4Parser","XYZParser","_atomsInf","_fileName","endnAtoms","endComment","startAtomsInf","words","_parseToAtomsInf","_parseAtomsInf","PubChemParser","jsonData","PC_Compounds","aids","aid","fromPairs","zip","coords","conformers","aids1","aid1","aids2","aid2","orders","SDFStream","_strings","_currentStart","_currentStringIndx","numb","curStr","getNextString","getCurrentString","setStart","probablyHaveDataToParse","chargeMap","orderMap","typeMap","sdfAndMolRegexp","sdfRegExp","fileFormat","SDF","MOL","possibleNameTags","possibleIDTags","possibleTitleTags","tagsNames","tags","buildChainID","codes","trunc","reverse","SDFParser","_format","_metadata","_currentMolProps","_compoundIndx","_assemblies","_atomsParsed","_atomsIndexes","getStringFromStart","bondsNum","bondType","countsLine","_parseAtoms","_parseBonds","_parseMOL","findNextDataItem","_parseDataItem","props","_tryToUpdateMoleculeData","tagsList","_searchTag","tagPossibleNames","_tryToFind","properties","_finalizeMetadata","_buildAssemblies","_buildMolecules","defineFormat","_parseCompound","findNextCompoundStart","DSN6Header","div","DSN6Model","i16","Int16Array","byteBuffer","counter","zBlock","yBlock","xBlock","inRange","_pointCalculate","blocks","_blockCalculate","_calculateInfoParams","dispersion","minDensity","maxDensity","DSN6Parser","ArrayBuffer","checkDataTypeOptions","GROReader","GROParser","_time","_residueNumber","_residueName","_atomName","_atomNumber","_atomPosition","_atomVelocity","filetype","readLine","getNext","positionX","positionY","positionZ","_parseTitle","_parseNumberOfAtoms","_parseAtom","un","am","nc","du","resNumberRegex","spacesRegex","splitToFields","MOL2Parser","_currPosIdx","_currStartIdx","MOL2Data","newPosIdx","_toStringFromStart","_toHeaderString","_setStart","_probablyHaveDataToParse","parsedStr","_setResidue","originAtomId","targetAtomId","currMolecule","molResidues","_fixSerialAtoms","_parseMolecule","_toStringFromHeader","_parseRawStrings","_findNextCompoundStart","ExporterList","someExporters","Exporter","exportSync","PDBResult","_resultArray","_currentStr","_tag","_fixedNumeration","_numeration","_tagStrNum","writeString","numeration","isBoolean","maxStrPos","_currentStrLength","newString","curStrLength","finish","repeat","cStr","bondsArrays","_getSubArrays","subArraySize","subArrays","matrixIndx","toFixed","Matrix4","writeMatrix","PDBExporter","_tags","_result","_tagExtractors","_extractHEADER","TITLE","_extractTITLE","_extractATOM","_extractCONECT","_extractCOMPND","_extractREMARK","_extractHELIX","SHEET","_extractSHEET","_stringForRemark350","_stringForRemark290","getResult","newTag","fixedBonds","writeBondsArray","strands","invert","startIndx","_getMoleculeChains","chainsString","writeEntireString","_Remark290","_Remark350","writeMatrices","biomolIndx","getChainName","SourceClass","FBX_POS_SIZE","FBX_NORM_SIZE","FBX_COL_SIZE","copyFbxPoint3","srcIdx","dstIdx","copyFbxPoint4","vector4","copyTransformedPoint3","setSubArray","copyFunctor","functorOpts","arridx","FBXModel","lastPos","lastNorm","lastCol","vertsCount","indsCount","shifted","setIndices","currentCount","getVerticesNumber","setShiftedIndices","setTransformedPositions","setTransformedNormals","FBXGeometry","_info","FBX1CGeometry","cl","FBX2CCylinder","_cutRawStart","_cutRawEnd","_facesPerSlice","addPerCylinder","_extendVertices","_extendIndices","getGeoParams","cutRaw","indicesPerQuad","startToShift","colorSize","part1End","part2End","_setColorRange","capSize","cap1End","cap2End","FBXInfoExtractor","_materials","_models","_extractModelsAndMaterials","_flattenModels","layersOfInterest","checkExportAbility","_collectInstancedGeoInfo","_collectGeoInfo","faceSize","overallVertsCount","combined","_reworkIndices","verticesCount","vertCount","setPositions","setNormals","_collectMaterialInfo","_addToPool","instCount","maxInstancedCount","instMatrix","objMatrix","sphereColor","instanceIndex","_getSphereInstanceMatrix","addInstance","oneCCylinder","splittingInfo","_gatherCylindersColoringInfo","twoCCylinder","needToSplit","additionalVertsCount","colorStart","colorEnd","is2Colored","_getCylinderInstanceMatrix","materialIdx","_checkExistingMaterial","findIndex","differs","_collectSpheresInfo","_collectCylindersInfo","instIdx","matVector1","matVector2","matVector3","idxOffset","defaultDefinitions","defaultProperties","defaultMaterialLayer","defaultLayerBlock","globalSettings","FBXResult","_writeHeader","_writeDefinitions","_writeObjects","_writeRelations","_writeConnections","FBXHeaderVersion","FBXVersion","timeStampVersion","creator","version","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","modelVersion","allModels","_verticesIndices","_normalLayer","_colorLayer","materialVersion","allMaterials","_materialProperties","modelsList","colorArray","layerElementColorNumber","layerElementColorVersion","layerElementColorName","colorsStr","_floatArrayToString","colorIndices","normalArray","layerElementNormalNumber","layerElementNormalVersion","layerElementNormalName","normalsStr","multiLayer","multiTake","shading","culling","geometryVersion","vertStr","FBXExporter","_version","miewVersion","_extractor","loaders","parsers","exporters","tempColor","CSS2DRenderer","_height","_widthHalf","_heightHalf","_vector","_viewMatrix","_projectionMatrix","_domElement","overflow","zIndex","pointerEvents","myNode","firstChild","lerpColorAsHex","setHex","getHexString","colorAsHex","setFromMatrixPosition","localOffset","getMaxScaleOnAxis","fogFactor","smoothstep","WebkitTransform","MozTransform","oTransform","_renderObject","VK_LEFT","VK_UP","VK_RIGHT","VK_DOWN","STATE","NONE","ROTATE","TRANSLATE","SCALE","TRANSLATE_PIVOT","FULL_STOP_THRESHOLD","matrix4","ObjectHandler","lastRotation","_rotate","q","quat","zeroPivot","makeRotationFromQuaternion","setObjects","rotate","rot","mousePrevPos","mouseCurPos","aboutAxis","mouse2rotation","setFromAxisAngle","translate","translateOnAxis","timeSinceLastUpdate","timeSinceMove","intertia","dynamicDampingFactor","intertiaThreshold","stop","eyeDirection","cameraUpDirection","cameraSidewaysDirection","moveDirection","mouseDelta","mousePrev","mouseCur","axisRotateFactor","setLength","rotateFactor","ObjectControls","objectPivot","getAltObj","hotkeysEnabled","screen","_state","_mousePrevPos","_mouseCurPos","_mainObj","_altObj","_affectedObj","_isAltObjFreeRotationAllowed","_isTranslationAllowed","_isKeysTranslatingObj","_pressedKeys","_clock","_lastUpdateTime","_listeners","mousedown","mouseup","mousemove","mousewheel","touchstartend","touchmove","getKeyBindObject","keydownup","handleResize","resetKeys","contextmenu","stopPropagation","preventDefault","innerWidth","innerHeight","getBoundingClientRect","ownerDocument","documentElement","pageXOffset","clientLeft","pageYOffset","clientTop","enableHotkeys","allowTranslation","allow","allowAltObjFreeRotation","keysTranslateObj","isEditingAltObj","convertMouseToOnCircle","pageX","pageY","screenSize","convertMouseToViewport","rotateByMouse","aboutZAxis","getOrientation","setOrientation","getScale","setScale","curTime","_lastMouseMoveTime","speedX","speedY","altObj","button","workWithAltObj","altKey","ctrlKey","shiftKey","translatePivotByMouse","wheelDelta","detail","touches","_touchDistanceCur","_touchDistanceStart","_scaleStart","newScale","keyCode","translatePivotInWorld","setX","setY","setZ","translatePivot","setPivot","newPivot","Picker","_lastMousePos","_mouseTotalDist","_lastClickBeginTime","_lastClickPos","_clickBeginTime","touchstart","touchend","picked","pickObject","screenPos","rayCaster","unproject","fogFarValue","getMouseInViewport","curPos","timeSinceLastClickBegin","clickDist","_lastTouchdownPos","changedTouches","Axes","targetCamera","_target","_targetCamera","_object","_full","autoClear","setViewport","clear","cDataOffset","cFirstMask","cFirstShift","cSecMask1","cSecShift1","cSecMask2","cSecShift2","cThirdMask","cStrMask","cStrShift","c219","c220","cHelixIdx","cSheetIdx","secTypes","cSecNames","_createSecondary","strArray","nRes","resid","rIdx","fromUInt20ToInt20","uint20","FrameInfo","payload","callbacks","isLoading","_framesRange","frameIsReady","_frameRequest","_callbacks","_framesRequestLength","_downloadDataFn","parseBinaryData","setFrame","framesStart","framesEnd","_framesCount","onDone","onLoadStatusChanged","onFail","onError","_bufferRequestStart","_prepareBuffer","arrayBuffer","dataView","DataView","atomsCount","getUint32","framesCount","_atomsCount","maxSize","chunkedFramesCount","timeStep","iName","_timeStep","posData","coordIdx","secondaryArr","Int8Array","hiWord","loWord","_secondaryData","_currFrame","myResidues","sec","oldSec","nSec","compRes","getSec","frameIdx","_cachedResidues","_updateSecondary","_parseBuffer","vec","_vec","SceneObject","paramsStr","LinesObj","_id1","_id2","err","getAtomByFullname","_atom1","_getAtomFromName","_atom2","dynamic","_line","computeLineDistances","_raycaster","_intersects","verticesNeedUpdate","OutlineMaterial","srcDepthTex","srcTexSize","DEPTH_OUTLINE","FXAAMaterial","bgTransparent","BG_TRANSPARENT","AOMaterial","diffuseTexture","normalTexture","depthTexture","camNearFar","projMatrix","kernelRadius","depthThreshold","_kernelOffsets","AOHorBlurMaterial","aoMap","samplesOffsets","AOVertBlurWithBlendMaterial","fogNearFar","useFog","AnaglyphMaterial","srcL","srcR","View","orientation","_transitionTime","ViewInterpolator","startView","endView","_endTime","_isPaused","_srcView","_dstView","_isMoving","transTime","wasStarted","success","createView","slerp","setup","getCurrentView","MAX_COOKIE_LEN","COUNT_SUFFIX","_chunkString","chunkLen","lc","Cookies","removeCookie","cntKey","_toCount","cntVal","_getSimpleCookie","_removeSimpleCookie","setCookie","_setSimpleCookie","getCookie","cookie","_getExpirationDate","today","EXP_PERIOD_YEARS","setFullYear","toUTCString","_exists","webVRPoC","showEnterVR","cursor","currentSession","onSessionEnded","onSessionStarted","session","_gfx","xr","setReferenceSpaceType","setSession","onmouseenter","onmouseleave","onclick","sessionInit","optionalFeatures","requestSession","then","moveSceneBehindHeadset","showWebXRNotFound","stylizeElement","bottom","padding","border","borderRadius","font","isSessionSupported","supported","textDecoration","WebVRPoC","onToggle","_mainCamera","_button","_onToggle","_molContainer","_user","_scalingPivot","_controller1","_controller2","_pressedGripsCounter","_distance","startScalingByControllers","stopScalingByControllers","anotherController","gfx","createWebVRButton","_mainFog","_plugVRNodesIntoScene","_setControllersListeners","getController","_createControllerMesh","handleGripsDown","handleGripsUp","setAnimationLoop","getSession","_unplugVRNodesFromScene","cylinder","rotateX","scaler","container","EDIT_MODE","COMPLEX","COMPONENT","FRAGMENT","LOADER_NOT_FOUND","PARSER_NOT_FOUND","updateFogRange","removeExtension","hasValidResidues","hasValidRes","reportProgress","percent","TOTAL_PERCENT","chooseFogColor","Miew","settingsCookie","cookiePath","_interpolator","_container","getElementById","head","getElementsByClassName","_containerRoot","_running","_halting","_building","_needRender","_hotKeysEnabled","_cookies","restoreSettings","_spinner","_loading","_animInterval","_visuals","_curVisualName","_sourceWindow","registeredPlugins","_initOnSettingsChanged","getMaxRepresentationCount","_setContainerContents","_updateShadowCamera","shadowMatrix","OBB","halfSize","light","getOBB","frag","createDocumentFragment","_msgMode","_msgAtomInfo","_showMessage","_initGfx","_initListeners","Spinner","_onKeyDown","_onKeyUp","_objectControls","_getAltObj","_picker","_onPick","file","keepRepsInfo","job","cancel","halt","msg","_showCanvas","_requestAnimationFrame","requestAnimationFrame","arezSpritesSupported","getExtension","isAOSupported","clientWidth","clientHeight","webGLOptions","preserveDrawingBuffer","premultipliedAlpha","renderer2d","shadowMap","autoUpdate","getContext","setPixelRatio","devicePixelRatio","setSize","setClearColor","clearColor","stereoCam","selectionScene","selectionRoot","selectionPivot","light12","pixelRatio","getPixelRatio","shadowMapSize","mapSize","light3","deviceWidth","deviceHeight","offscreenBuf","minFilter","magFilter","depthBuffer","offscreenBuf2","offscreenBuf3","offscreenBuf4","volBFTex","volFFTex","volWFFTex","offscreenBuf5","offscreenBuf6","offscreenBuf7","stereoBufL","stereoBufR","_embedWebXR","stats","_fps","_onResize","_makeUniqueVisualName","baseName","random","suffix","_addVisual","_removeVisual","_forEachVisual","_releaseAllVisuals","_forEachComplexVisual","_getComplexVisual","any","_getVolumeVisual","_getVisualForComplex","getVisuals","getComplexVisualsCount","getCurrentVisual","setCurrentVisual","run","resume","_onTick","_discardComponentEdit","_discardFragmentEdit","pause","enableHotKeys","_resizeOffscreenBuffers","isAnaglyph","multi","_onUpdate","_onRender","_getBSphereRadius","_bSphereForOneVisual","_bBoxForOneVisual","_bBox","_invMatrix","_points","union","_updateFog","_setUberMaterialValues","isScriptingCommandAvailable","callNextCmd","_needRebuild","rebuild","_updateView","webVR","updateMoleculeScale","_clipPlaneUpdateValue","_fogFarUpdateValue","setRenderTarget","_renderFrame","_anaglyphMat","_size","focus","_renderShadowMap","_renderScene","setScissorTest","setScissor","cameraL","cameraR","_onBgColorChanged","_onFogColorChanged","_enableMRT","renderBuffer","textureBuffer","gl","drawBuffersWEBGL","COLOR_ATTACHMENT0","tx8","__webglTexture","bindTexture","TEXTURE_2D","fb","__webglFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT1_WEBGL","distortion","bHaveComplexes","volumeVisual","ssao","_renderWithPrepassTransparency","dstBuffer","srcBuffer","_performAO","_renderOutline","_renderSelection","_renderVolume","_performFXAA","_performDistortion","aberration","fragmentScreenQuadFromDistTex","targetBuffer","_outlineMaterial","srcDepthBuffer","srcColorBuffer","currentRenderTarget","getRenderTarget","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","setBlending","buffers","setClear","setTest","updateMatrices","_hasSelectionToRender","selPivot","selPivotChild","_checkVolumeRenderingSupport","renderTarget","oldRT","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","volumeBFMat","volumeFFMat","cubeOffsetMat","world2colorMat","volumeRenderingSupported","dstBuf","tmpBuf1","tmpBuf2","tmpBuf3","overrideMaterial","colorMask","_fxaaMaterial","_aoMaterial","_horBlurMaterial","_vertBlurMaterial","_scale","normalBuffer","srcDepthTexture","tempBuffer","tempBuffer1","_lastPick","_setEditMode","_resetObjects","setNeedRender","_resetScene","resetReps","resetPivot","rebuildAll","resetView","updateSelectionMask","_export","TheExporter","io","exporter","rePdbId","rePubchem","reUrlScheme","resolveSourceShortcut","matchesPdbId","sourceType","matchesPubchem","compound","updateBinaryMode","TheParser","fileExt","animation","_fetchData","shouldCancel","notify","TheLoader","extractName","newOptions","keyCount","loader","lengthComputable","total","loaded","promise","_parseData","dataSet","spin","onLoadEnd","anything","jobIndex","_refreshTitle","_onLoad","unload","_startAnimation","fileData","_stopAnimation","_frameInfo","isPlaying","_isAnimating","_continueAnimation","_pauseAnimation","clearInterval","minFrameTime","setInterval","_updateObjsToFrame","nextFrame","disableEvents","visualName","amberFileName","resetEd","_onLoadEd","_tweakResolution","_edLoader","loadEd","_rebuildObjects","toRemove","getGeometry","changeUnit","unitIdx","currentUnitInfo","getCurrentUnit","_updateInfoPanel","rebuildActions","setNeedsRebuild","appendix","repGet","_extractRepresentation","getSelectionCount","defPreset","repCount","_setReps","applyPreset","presList","newIdx","repRemove","repHide","_editMode","getElementsByTagName","_enterComponentEditMode","editors","beginComponentEdit","_editors","_applyComponentEdit","discard","_enterFragmentEditMode","selectedVisuals","beginFragmentEdit","isFreeRotationAllowed","_applyFragmentEdit","_updateSelection","expandSelection","shrinkSelection","firstLine","secondLine","aName","coordLine","nextAltObj","setPivotResidue","amount","setPivotAtom","getSelectionCenter","_centerInVisual","setPivotSubset","_includesInCurSelection","_includesInSelector","screenshot","fov2Tan","tan2Fov","getDataURL","dataURL","currBrowser","canvas","canvasContext","drawImage","toDataURL","screenshotURI","originalTanFov2","areaOfInterestSize","areaOfInterestTanFov2","shotAspect","setDrawingBufferSize","screenshotSave","uri","save","dataString","maxPerf","_gfxScore","_autoChangeResolution","saveSettings","resetSettings","setOptions","resetCurrentUnit","getBondCount","getResidueCount","getChainCount","objData","bThrow","Ctor","LinesObject","_addSceneObject","sceneObject","objs","removeObject","getURL","getState","compact","getScript","_compareReps","compareWithDefaults","currPreset","repsDiff","emptyReps","repsInfo","objectsState","_updateShadowmapMeshes","_updateMaterials","setMaterialValues","_fogAlphaChanged","disable","evt","Boolean","sel","VIEW_VERSION","eulerOrder","euler","setFromQuaternion","interpolator","srcView","dstView","setFromEuler","isMoving","within","None","projected","fullAtomName","complexName","project","dssp","exportCML","extractRotation","extractBasis","retMat","makeBasis","updateCMLData","xml","removeAttribute","sGroup","getPosition","getCentralPoint","oSerializer","XMLSerializer","serializeToString","motm","curChainName","curChainColor","thirdParty","lodash","three","modeIdDesc","$help","colorDesc","materialDesc","addRepDesc","setGetParameterDesc","help","PDBID","REP_NAME","DESCRIPTION","REP_INDEX","EXPRESSION","MODE_ID","COLORER_ID","MATERIAL_ID","del","PARAMETER","set_save","set_restore","set_reset","PRESET","ENCODED_VIEW","removeobj","listobj","NULL","RepresentationMap","representationMap","representationID","strId","sortedKeys","representationsStorage","keyRemap","CLIUtils","miew","repMap","listRep","repName","selectionStr","strList","helpData","joinHelpStr","clihelp","sortBy","helpItem","awaitWhileCMDisInProcess","finishAwaitingCMDInProcess","modificate","selExc","modificators","modificator","argExc","pathExc","endsWith","getNamedColor","utilFunctions","CreateObjectPair","ArgList","toJSO","cliUtils","cmd","propagateProp","Arg","_val","cliutils","echo","representations","notimplemented","script","_printCallback","_errorCallback","parsercli","cmdQueue","commandInAction"],"mappings":";;;;;;;;;;EAAA,SAAS,eAAe,CAAC,GAAG,EAAE;EAC9B,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC;EACrC,CAAC;AACD;EACA,kBAAc,GAAG,eAAe;;ECJhC,SAAS,qBAAqB,CAAC,GAAG,EAAE,CAAC,EAAE;EACvC,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,oBAAoB,CAAC,EAAE;EACzG,IAAI,OAAO;EACX,GAAG;AACH;EACA,EAAE,IAAI,IAAI,GAAG,EAAE,CAAC;EAChB,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;EAChB,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;EACjB,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;AACrB;EACA,EAAE,IAAI;EACN,IAAI,KAAK,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE;EACxF,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC1B;EACA,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM;EACxC,KAAK;EACL,GAAG,CAAC,OAAO,GAAG,EAAE;EAChB,IAAI,EAAE,GAAG,IAAI,CAAC;EACd,IAAI,EAAE,GAAG,GAAG,CAAC;EACb,GAAG,SAAS;EACZ,IAAI,IAAI;EACR,MAAM,IAAI,CAA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,EAAV,GAAe+yI,QAAf;;AAEAO,iBAAS,CAACtzI,EAAV,CAAasB,UAAb,GAA0BgyI,eAAS,CAAChyI,UAApC;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"dist/Miew.js","mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,MAAM,GAAI,YAAU;EACxB,IAAIC,CAAC,GAAC,SAAAA,CAASC,CAAC,EAACC,CAAC,EAACF,CAAC,EAACG,CAAC,EAAC;MAAC,KAAIH,CAAC,GAACA,CAAC,IAAE,CAAC,CAAC,EAACG,CAAC,GAACF,CAAC,CAACG,MAAM,EAACD,CAAC,EAAE,EAACH,CAAC,CAACC,CAAC,CAACE,CAAC,CAAC,CAAC,GAACD,CAAC,CAAC;MAAC,OAAOF,CAAC;IAAA,CAAC;IAACK,GAAG,GAAC,CAAC,CAAC,EAAC,EAAE,CAAC;IAACC,GAAG,GAAC,CAAC,CAAC,EAAC,EAAE,CAAC;IAACC,GAAG,GAAC,CAAC,CAAC,EAAC,EAAE,CAAC;IAACC,GAAG,GAAC,CAAC,CAAC,EAAC,EAAE,CAAC;IAACC,GAAG,GAAC,CAAC,CAAC,EAAC,EAAE,CAAC;IAACC,GAAG,GAAC,CAAC,CAAC,EAAC,EAAE,CAAC;IAACC,GAAG,GAAC,CAAC,CAAC,EAAC,EAAE,CAAC;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;;ACtBuB;AACK;AAC0B;AAEtD,MAAMuK,OAAO,GAAG,CAAC;;AAEjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAMpR,iBAAQ,GAAG;EACf;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEqR,KAAK,EAAE;IACL;IACA;IACA;;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,EAAE,EAAE;MACFC,IAAI,EAAE,IAAI;MACVC,IAAI,EAAE,IAAI;MACVC,KAAK,EAAE,GAAG;MACVC,SAAS,EAAE,IAAI;MACfC,OAAO,EAAE,GAAG;MACZC,QAAQ,EAAE,IAAI;MACdC,cAAc,EAAE;QACdC,IAAI,EAAE,CAAC;QACPC,GAAG,EAAE,CAAC;QACNC,MAAM,EAAE,CAAC;QACTC,IAAI,EAAE,EAAE;QACRC,KAAK,EAAE;MACT;IACF,CAAC;IAED;IACA;IACA;;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,EAAE,EAAE;MACFN,cAAc,EAAE;QACdC,IAAI,EAAE,CAAC;QACPC,GAAG,EAAE,CAAC;QACNC,MAAM,EAAE,CAAC;QACTC,IAAI,EAAE,EAAE;QACRC,KAAK,EAAE;MACT;IACF,CAAC;IAED;IACA;IACA;;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACIE,EAAE,EAAE;MACFV,SAAS,EAAE,IAAI;MACfE,QAAQ,EAAE,IAAI;MACdS,QAAQ,EAAE,GAAG;MACbC,SAAS,EAAE,EAAE;MACbf,IAAI,EAAE,IAAI;MACVgB,SAAS,EAAE;IACb,CAAC;IAED;IACA;IACA;;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,EAAE,CAAC;QACPC,KAAK,EAAE;MACT;IACF;EACF,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE6C,QAAQ,EAAE;IACR;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,EAAE,EAAE;MACFC,MAAM,EAAE,CAAC;IACX,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,EAAE,EAAE;MACF9U,KAAK,EAAE;IACT,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACI+U,EAAE,EAAE;MACFvC,MAAM,EAAE,SAAS;MACjBxS,KAAK,EAAE,QAAQ;MACfgV,SAAS,EAAE;IACb,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,EAAE,EAAE;MACFjV,KAAK,EAAE,QAAQ;MACfkV,MAAM,EAAE;IACV,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,EAAE,EAAE;MACFC,QAAQ,EAAE;IACZ,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,EAAE,EAAE;MACFD,QAAQ,EAAE,MAAM;MAChBzjB,GAAG,EAAE,CAAC;MACND,GAAG,EAAE;IACP,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;IACI4jB,EAAE,EAAE;MACFF,QAAQ,EAAE;IACZ,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;IACIG,EAAE,EAAE;MACFH,QAAQ,EAAE;IACZ,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;IACII,EAAE,EAAE;MACFJ,QAAQ,EAAE;IACZ;EACF,CAAC;EAED;AACF;AACA;AACA;EACEK,SAAS,EAAE,IAAI;EAEf;AACF;AACA;AACA;EACEC,MAAM,EAAE,IAAI;EAEZ;AACF;AACA;AACA;EACEC,OAAO,EAAE,GAAG;EAEZ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AM5c,KAAK,GAAG2G,MAAM,CAACkG,KAAK,CAAC+P,GAAG,GAAG,CAAC,CAAC;IACnCu2B,MAAM,CAAC70C,GAAG,CACR0B,KAAK,EACL,CAAC,EACD,CAAC,EACDmO,CAAC,EACD,CAAC,EACDnO,KAAK,EACL,CAAC,EACD4S,CAAC,EACD,CAAC,EACD,CAAC,EACD5S,KAAK,EACLiU,CAAC,EACD,CAAC,EACD,CAAC,EACD,CAAC,EACD,CACF,CAAC;EACH;AACF;;ACxYA;AACA,MAAMioI,kBAAkB,GAAG;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,MAAMC,iBAAiB,GAAG;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA,MAAMC,oBAAoB,GAAG;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA,MAAMC,iBAAiB,GAAG;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;AACA,MAAMC,cAAc,GAAG;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AAEW,MAAMC,SAAS,CAAC;EAC7BhxI,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACsnI,YAAY,GAAG,EAAE;IACtB,IAAI,CAACoF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ew/./src/utils/MiewCLIParser.js","webpack://Miew/./src/utils/SelectionParser.js","webpack://Miew/./vendor/js/Smooth.js","webpack://Miew/./vendor/js/mmtf.js","webpack://Miew/external umd {\"module\":\"lodash\",\"commonjs\":\"lodash\",\"commonjs2\":\"lodash\",\"amd\":\"lodash\",\"root\":\"_\"}","webpack://Miew/external umd {\"module\":\"three\",\"commonjs\":\"three\",\"commonjs2\":\"three\",\"amd\":\"three\",\"root\":\"THREE\"}","webpack://Miew/webpack/bootstrap","webpack://Miew/webpack/runtime/compat get default export","webpack://Miew/webpack/runtime/define property getters","webpack://Miew/webpack/runtime/hasOwnProperty shorthand","webpack://Miew/../../node_modules/spin.js/spin.js","webpack://Miew/./src/Timer.js","webpack://Miew/./src/gfx/Stats.js","webpack://Miew/./src/utils/EventDispatcher.js","webpack://Miew/./src/utils/logger.js","webpack://Miew/./src/utils.js","webpack://Miew/./src/utils/JobHandle.js","webpack://Miew/./src/settings.js","webpack://Miew/./src/options.js","webpack://Miew/./src/chem/Atom.js","webpack://Miew/./src/chem/Element.js","webpack://Miew/./src/chem/Bond.js","webpack://Miew/./src/chem/Residue.js","webpack://Miew/./src/chem/ResidueType.js","webpack://Miew/./src/chem/Chain.js","webpack://Miew/./src/chem/StructuralElement.js","webpack://Miew/./src/chem/Helix.js","webpack://Miew/./src/chem/Strand.js","webpack://Miew/./src/chem/Sheet.js","webpack://Miew/./src/chem/SGroup.js","webpack://Miew/./src/chem/selectors/selectArgs.js","webpack://Miew/./src/chem/selectors/selectorsBase.js","webpack://Miew/./src/chem/selectors/selectOps.js","webpack://Miew/./src/chem/selectors.js","webpack://Miew/./src/chem/BiologicalUnit.js","webpack://Miew/./src/chem/Assembly.js","webpack://Miew/./src/chem/Component.js","webpack://Miew/./src/chem/AtomPairs.js","webpack://Miew/./src/chem/AutoBond.js","webpack://Miew/./src/chem/AromaticLoopsMarker.js","webpack://Miew/./src/chem/VoxelWorld.js","webpack://Miew/./src/chem/HBondInfo.js","webpack://Miew/./src/chem/SecondaryStructureMap.js","webpack://Miew/./src/chem/Complex.js","webpack://Miew/./src/chem/Volume.js","webpack://Miew/./src/chem/Molecule.js","webpack://Miew/./src/chem.js","webpack://Miew/./src/gfx/CSS2DObject.js","webpack://Miew/./src/gfx/RCGroup.js","webpack://Miew/./src/gfx/gfxutils.js","webpack://Miew/./src/Visual.js","webpack://Miew/./src/utils/EntityList.js","webpack://Miew/./src/utils/makeContextDependent.js","webpack://Miew/./src/gfx/geometries/SphereCollisionGeo.js","webpack://Miew/./src/gfx/geometries/InstancedSpheresGeometry.js","webpack://Miew/./src/gfx/geometries/ChunkedObjectsGeometry.js","webpack://Miew/./src/gfx/geometries/SimpleSpheresGeometry.js","webpack://Miew/./src/gfx/geometries/Simple2CCylindersGeometry.js","webpack://Miew/./src/gfx/geometries/CylinderBufferGeometry.js","webpack://Miew/./src/gfx/geometries/Instanced2CCylindersGeometry.js","webpack://Miew/./src/gfx/geometries/ExtrudedObjectsGeometry.js","webpack://Miew/./src/gfx/geometries/ThickLinesGeometry.js","webpack://Miew/./src/gfx/geometries/LinesGeometry.js","webpack://Miew/./src/gfx/geometries/CylinderCollisionGeo.js","webpack://Miew/./src/gfx/geometries/ChunkedLinesGeometry.js","webpack://Miew/./src/gfx/geometries/TwoColorLinesGeometry.js","webpack://Miew/./src/gfx/geometries/CrossGeometry.js","webpack://Miew/./src/gfx/geometries/IsoSurfaceGeometry.js","webpack://Miew/./src/gfx/geometries/IsoSurfaceMarchCube.js","webpack://Miew/./src/gfx/geometries/IsoSurface.js","webpack://Miew/./src/gfx/geometries/VolumeSurfaceGeometry.js","webpack://Miew/./src/gfx/geometries/QuickSurfGeometry.js","webpack://Miew/./src/gfx/geometries/ContactSurface.js","webpack://Miew/./src/gfx/geometries/ContactSurfaceGeometry.js","webpack://Miew/./src/gfx/geometries/IsoSurfaceAtomColored.js","webpack://Miew/./src/gfx/geometries/IsosurfaceBuildNormals.js","webpack://Miew/./src/gfx/geometries/IsoSurfaceGeo.js","webpack://Miew/./src/gfx/geometries/SSIsosurfaceGeometry.js","webpack://Miew/./src/gfx/geometries/LabelsGeometry.js","webpack://Miew/./src/gfx/geometries/geometries.js","webpack://Miew/./src/gfx/capabilities.js","webpack://Miew/./src/gfx/noiseTexture.js","webpack://Miew/./src/gfx/shaders/UberMaterial.js","webpack://Miew/./src/gfx/meshes/UberObject.js","webpack://Miew/./src/gfx/meshes/ZSpriteMesh.js","webpack://Miew/./src/gfx/meshes/ZClippedMesh.js","webpack://Miew/./src/gfx/meshes/TextMesh.js","webpack://Miew/./src/gfx/meshes/SimpleMesh.js","webpack://Miew/./src/gfx/meshes/ThickLineMesh.js","webpack://Miew/./src/gfx/meshes/InstancedMesh.js","webpack://Miew/./src/gfx/meshes/meshes.js","webpack://Miew/./src/gfx/meshes/MeshCreator.js","webpack://Miew/./src/gfx/meshes/TransformGroup.js","webpack://Miew/./src/gfx/modes/groups/ChemGroup.js","webpack://Miew/./src/gfx/modes/groups/AtomsGroup.js","webpack://Miew/./src/gfx/modes/groups/AtomsSphereGroup.js","webpack://Miew/./src/gfx/modes/groups/AtomsSurfaceGroup.js","webpack://Miew/./src/gfx/modes/groups/AtomsSASSESGroupStub.js","webpack://Miew/./src/gfx/modes/groups/AtomsTextGroup.js","webpack://Miew/./src/gfx/modes/groups/AromaticGroup.js","webpack://Miew/./src/gfx/modes/groups/AromaticTorusGroup.js","webpack://Miew/./src/gfx/modes/groups/AromaticLinesGroup.js","webpack://Miew/./src/gfx/modes/groups/ResiduesGroup.js","webpack://Miew/./src/gfx/modes/groups/NucleicItemGroup.js","webpack://Miew/./src/gfx/modes/groups/NucleicCylindersGroup.js","webpack://Miew/./src/gfx/modes/groups/NucleicSpheresGroup.js","webpack://Miew/./src/gfx/modes/groups/CartoonHelper.js","webpack://Miew/./src/gfx/modes/groups/ResiduesSubseqGroup.js","webpack://Miew/./src/gfx/modes/groups/ResiduesTraceGroup.js","webpack://Miew/./src/gfx/modes/groups/BondsGroup.js","webpack://Miew/./src/gfx/modes/groups/BondsCylinderGroup.js","webpack://Miew/./src/gfx/modes/groups/BondsLinesGroup.js","webpack://Miew/./src/gfx/modes/groups/groups.js","webpack://Miew/./src/gfx/modes/processors/AtomsProcessor.js","webpack://Miew/./src/gfx/modes/processors/OrphanAtomsProcessor.js","webpack://Miew/./src/gfx/modes/processors/ResiduesProcessor.js","webpack://Miew/./src/gfx/modes/processors/NucleicProcessor.js","webpack://Miew/./src/gfx/modes/processors/SubseqsProcessor.js","webpack://Miew/./src/gfx/modes/processors/BondsProcessor.js","webpack://Miew/./src/gfx/modes/processors/AromaticProcessor.js","webpack://Miew/./src/gfx/modes/processors/processors.js","webpack://Miew/./src/gfx/modes/groups/GroupsFactory.js","webpack://Miew/./src/gfx/modes/Mode.js","webpack://Miew/./src/gfx/modes/LinesMode.js","webpack://Miew/./src/gfx/modes/LicoriceMode.js","webpack://Miew/./src/gfx/modes/BallsAndSticksMode.js","webpack://Miew/./src/gfx/modes/VanDerWaalsMode.js","webpack://Miew/./src/gfx/modes/TraceMode.js","webpack://Miew/./src/gfx/modes/TubeMode.js","webpack://Miew/./src/gfx/modes/CartoonMode.js","webpack://Miew/./src/gfx/modes/SurfaceMode.js","webpack://Miew/./src/gfx/modes/QuickSurfaceMode.js","webpack://Miew/./src/gfx/modes/IsoSurfaceMode.js","webpack://Miew/./src/gfx/modes/IsoSurfaceSASMode.js","webpack://Miew/./src/gfx/modes/IsoSurfaceSESMode.js","webpack://Miew/./src/gfx/modes/ContactSurfaceMode.js","webpack://Miew/./src/gfx/modes/TextMode.js","webpack://Miew/./src/gfx/modes.js","webpack://Miew/./src/gfx/palettes/Palette.js","webpack://Miew/./src/gfx/palettes/cpkPalette.js","webpack://Miew/./src/gfx/palettes/jmolPalette.js","webpack://Miew/./src/gfx/palettes/vmdPalette.js","webpack://Miew/./src/gfx/palettes.js","webpack://Miew/./src/gfx/colorers/Colorer.js","webpack://Miew/./src/gfx/colorers/ElementColorer.js","webpack://Miew/./src/gfx/colorers/ResidueTypeColorer.js","webpack://Miew/./src/gfx/colorers/SequenceColorer.js","webpack://Miew/./src/gfx/colorers/ChainColorer.js","webpack://Miew/./src/gfx/colorers/SecondaryStructureColorer.js","webpack://Miew/./src/gfx/colorers/UniformColorer.js","webpack://Miew/./src/gfx/colorers/ConditionalColorer.js","webpack://Miew/./src/gfx/colorers/ConformationColorer.js","webpack://Miew/./src/gfx/colorers/TemperatureColorer.js","webpack://Miew/./src/gfx/colorers/OccupancyColorer.js","webpack://Miew/./src/gfx/colorers/HydrophobicityColorer.js","webpack://Miew/./src/gfx/colorers/MoleculeColorer.js","webpack://Miew/./src/gfx/colorers/CarbonColorer.js","webpack://Miew/./src/gfx/colorers.js","webpack://Miew/./src/gfx/materials.js","webpack://Miew/./src/gfx/meshutils.js","webpack://Miew/./src/gfx/Representation.js","webpack://Miew/./src/ComplexVisualEdit.js","webpack://Miew/./src/ComplexVisual.js","webpack://Miew/./src/gfx/shaders/VolumeMaterial.js","webpack://Miew/./src/gfx/VolumeMesh.js","webpack://Miew/./src/gfx/VolumeBounds.js","webpack://Miew/./src/gfx/VolumeFarPlane.js","webpack://Miew/./src/VolumeVisual.js","webpack://Miew/./src/io/loaders/LoaderList.js","webpack://Miew/./src/io/loaders/Loader.js","webpack://Miew/./src/io/loaders/FileLoader.js","webpack://Miew/./src/io/loaders/XHRLoader.js","webpack://Miew/./src/io/loaders/ImmediateLoader.js","webpack://Miew/./src/io/loaders.js","webpack://Miew/./src/io/parsers/ParserList.js","webpack://Miew/./src/io/parsers/Parser.js","webpack://Miew/./src/io/parsers/pdb/Remark290.js","webpack://Miew/./src/io/parsers/pdb/Remark350.js","webpack://Miew/./src/io/parsers/PDBStream.js","webpack://Miew/./src/io/parsers/PDBParser.js","webpack://Miew/./src/io/parsers/CMLParser.js","webpack://Miew/./src/io/parsers/MMTFParser.js","webpack://Miew/./src/io/parsers/ParsingError.js","webpack://Miew/./src/io/parsers/readCIF.js","webpack://Miew/./src/io/parsers/CIFParser.js","webpack://Miew/./src/io/parsers/VolumeModel.js","webpack://Miew/./src/io/parsers/CCP4Parser.js","webpack://Miew/./src/io/parsers/XYZParser.js","webpack://Miew/./src/io/parsers/PubChemParser.js","webpack://Miew/./src/io/parsers/SDFStream.js","webpack://Miew/./src/io/parsers/SDFParser.js","webpack://Miew/./src/io/parsers/DSN6Parser.js","webpack://Miew/./src/io/parsers/GROReader.js","webpack://Miew/./src/io/parsers/GROParser.js","webpack://Miew/./src/io/parsers/MOL2Parser.js","webpack://Miew/./src/io/parsers.js","webpack://Miew/./src/io/exporters/ExporterList.js","webpack://Miew/./src/io/exporters/Exporter.js","webpack://Miew/./src/io/exporters/PDBResult.js","webpack://Miew/./src/io/exporters/PDBExporter.js","webpack://Miew/./src/io/exporters/fbx/FBXModel.js","webpack://Miew/./src/io/exporters/fbx/FBXGeometry.js","webpack://Miew/./src/io/exporters/fbx/FBX1CGeometry.js","webpack://Miew/./src/io/exporters/fbx/FBX2CCylinder.js","webpack://Miew/./src/io/exporters/fbx/FBXInfoExtractor.js","webpack://Miew/./src/io/exporters/fbx/FBXResult.js","webpack://Miew/./src/io/exporters/FBXExporter.js","webpack://Miew/./src/io/exporters.js","webpack://Miew/./src/io/io.js","webpack://Miew/./src/gfx/CSS2DRenderer.js","webpack://Miew/./src/utils/getTopWindow.js","webpack://Miew/./src/ui/ObjectControls.js","webpack://Miew/./src/ui/Picker.js","webpack://Miew/./src/gfx/Axes.js","webpack://Miew/./src/gfx/FrameInfo.js","webpack://Miew/./src/gfx/objects/SceneObject.js","webpack://Miew/./src/gfx/objects/LinesObj.js","webpack://Miew/./src/gfx/shaders/OutlineMaterial.js","webpack://Miew/./src/gfx/shaders/FXAAMaterial.js","webpack://Miew/./src/gfx/shaders/AOMaterial.js","webpack://Miew/./src/gfx/shaders/AOHorBlurMaterial.js","webpack://Miew/./src/gfx/shaders/AOVertBlurWithBlendMaterial.js","webpack://Miew/./src/gfx/shaders/AnaglyphMaterial.js","webpack://Miew/./src/gfx/ViewInterpolator.js","webpack://Miew/./src/utils/Cookies.js","webpack://Miew/./src/gfx/vr/createWebVRButton.js","webpack://Miew/./src/gfx/vr/WebVRPoC.js","webpack://Miew/./src/Miew.js","webpack://Miew/./src/utils/MiewCLIHelp.js","webpack://Miew/./src/Miew-cli.js","webpack://Miew/./src/index.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"lodash\"), require(\"three\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"lodash\", \"three\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Miew\"] = factory(require(\"lodash\"), require(\"three\"));\n\telse\n\t\troot[\"Miew\"] = factory(root[\"_\"], root[\"THREE\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE__535__, __WEBPACK_EXTERNAL_MODULE__698__) => {\nreturn ","/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,60],$V1=[1,62],$V2=[1,63],$V3=[1,65],$V4=[1,66],$V5=[1,67],$V6=[1,68],$V7=[1,69],$V8=[1,80],$V9=[1,72],$Va=[1,73],$Vb=[1,74],$Vc=[1,75],$Vd=[1,99],$Ve=[1,76],$Vf=[1,100],$Vg=[1,79],$Vh=[1,51],$Vi=[1,81],$Vj=[1,82],$Vk=[1,84],$Vl=[1,83],$Vm=[1,85],$Vn=[1,96],$Vo=[1,97],$Vp=[1,98],$Vq=[1,86],$Vr=[1,87],$Vs=[1,64],$Vt=[1,70],$Vu=[1,71],$Vv=[1,77],$Vw=[1,78],$Vx=[1,53],$Vy=[1,54],$Vz=[1,55],$VA=[1,61],$VB=[1,88],$VC=[1,89],$VD=[1,90],$VE=[1,91],$VF=[1,92],$VG=[1,93],$VH=[1,94],$VI=[1,95],$VJ=[1,101],$VK=[1,102],$VL=[1,103],$VM=[1,104],$VN=[1,105],$VO=[1,56],$VP=[1,57],$VQ=[1,58],$VR=[1,59],$VS=[1,115],$VT=[1,111],$VU=[1,114],$VV=[1,112],$VW=[1,113],$VX=[1,118],$VY=[1,117],$VZ=[1,134],$V_=[1,149],$V$=[1,150],$V01=[1,157],$V11=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V21=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,71,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V31=[5,6,7,9,13,15,17,18,19,20,23,25,26,27,30,33,34,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95],$V41=[5,70,72],$V51=[5,74],$V61=[71,101];\r\nvar parser = {trace: function trace () { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Command\":4,\"EOF\":5,\"RESET\":6,\"BUILD\":7,\"ALL\":8,\"HELP\":9,\"Path\":10,\"MOTM\":11,\"OneArgCommand\":12,\"GET\":13,\"STRING\":14,\"SET\":15,\"Value\":16,\"SET_SAVE\":17,\"SET_RESTORE\":18,\"SET_RESET\":19,\"PRESET\":20,\"AddRepresentation\":21,\"EditRepresentation\":22,\"REMOVE\":23,\"RepresentationReference\":24,\"HIDE\":25,\"SHOW\":26,\"LIST\":27,\"EXPAND_KEY\":28,\"SELECTOR_KEY\":29,\"SELECT\":30,\"AS\":31,\"WordAll\":32,\"SELECTOR\":33,\"WITHIN\":34,\"NUMBER\":35,\"OF\":36,\"MATERIAL\":37,\"IDENTIFIER\":38,\"ModeCMD\":39,\"ColorCMD\":40,\"VIEW\":41,\"BASE_64\":42,\"UNIT\":43,\"DSSP\":44,\"SCALE\":45,\"ROTATE\":46,\"AxesList\":47,\"TRANSLATE\":48,\"CENTER\":49,\"GetURLBranch\":50,\"Screenshot\":51,\"LINE\":52,\"ArgList\":53,\"LISTOBJ\":54,\"REMOVEOBJ\":55,\"URL\":56,\"VIEW_KEY\":57,\"SCREENSHOT\":58,\"LOAD\":59,\"Url\":60,\"FILE_KEY\":61,\"ADD\":62,\"Description\":63,\"REP\":64,\"MODE\":65,\"COLOR\":66,\"Descriptor\":67,\"RepresentationOwnProperty\":68,\"RepresentationOwnPropertyOpts\":69,\"DESC_KEY\":70,\"=\":71,\"DESC_KEY_OPTS\":72,\"AxesArg\":73,\"DESC_KEY_AXES\":74,\"Arg\":75,\"PathWoDescKey\":76,\"HEX\":77,\"BOOL\":78,\"Word\":79,\"CommandSetWoDESC_KEY\":80,\"DescKeys\":81,\"CLEAR\":82,\"FILE_LIST\":83,\"FILE_REGISTER\":84,\"FILE_DELETE\":85,\"PRESET_ADD\":86,\"PRESET_DELETE\":87,\"PRESET_UPDATE\":88,\"PRESET_RENAME\":89,\"PRESET_OPEN\":90,\"CREATE_SCENARIO\":91,\"RESET_SCENARIO\":92,\"DELETE_SCENARIO\":93,\"ADD_SCENARIO_ITEM\":94,\"LIST_SCENARIO\":95,\"PDB_KEY\":96,\"DELAY_KEY\":97,\"PRST_KEY\":98,\"DESCRIPTION_KEY\":99,\"CommandSet\":100,\".\":101,\"PresetPath\":102,\"/\":103,\"HexOrNumber\":104,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",6:\"RESET\",7:\"BUILD\",8:\"ALL\",9:\"HELP\",11:\"MOTM\",13:\"GET\",14:\"STRING\",15:\"SET\",17:\"SET_SAVE\",18:\"SET_RESTORE\",19:\"SET_RESET\",20:\"PRESET\",23:\"REMOVE\",25:\"HIDE\",26:\"SHOW\",27:\"LIST\",28:\"EXPAND_KEY\",29:\"SELECTOR_KEY\",30:\"SELECT\",31:\"AS\",33:\"SELECTOR\",34:\"WITHIN\",35:\"NUMBER\",36:\"OF\",37:\"MATERIAL\",38:\"IDENTIFIER\",41:\"VIEW\",42:\"BASE_64\",43:\"UNIT\",44:\"DSSP\",45:\"SCALE\",46:\"ROTATE\",48:\"TRANSLATE\",49:\"CENTER\",52:\"LINE\",54:\"LISTOBJ\",55:\"REMOVEOBJ\",56:\"URL\",57:\"VIEW_KEY\",58:\"SCREENSHOT\",59:\"LOAD\",61:\"FILE_KEY\",62:\"ADD\",64:\"REP\",65:\"MODE\",66:\"COLOR\",70:\"DESC_KEY\",71:\"=\",72:\"DESC_KEY_OPTS\",74:\"DESC_KEY_AXES\",77:\"HEX\",78:\"BOOL\",82:\"CLEAR\",83:\"FILE_LIST\",84:\"FILE_REGISTER\",85:\"FILE_DELETE\",86:\"PRESET_ADD\",87:\"PRESET_DELETE\",88:\"PRESET_UPDATE\",89:\"PRESET_RENAME\",90:\"PRESET_OPEN\",91:\"CREATE_SCENARIO\",92:\"RESET_SCENARIO\",93:\"DELETE_SCENARIO\",94:\"ADD_SCENARIO_ITEM\",95:\"LIST_SCENARIO\",96:\"PDB_KEY\",97:\"DELAY_KEY\",98:\"PRST_KEY\",99:\"DESCRIPTION_KEY\",101:\".\",103:\"/\"},\r\nproductions_: [0,[3,2],[3,1],[4,1],[4,1],[4,2],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,3],[4,3],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[4,2],[4,1],[4,2],[4,2],[4,2],[4,4],[4,2],[4,6],[4,2],[4,1],[4,1],[4,1],[4,2],[4,2],[4,1],[4,2],[4,1],[4,2],[4,2],[4,2],[4,1],[4,2],[4,1],[4,1],[4,3],[4,3],[4,4],[4,4],[4,1],[4,2],[50,1],[50,2],[50,2],[50,3],[50,3],[51,1],[51,2],[51,3],[12,2],[12,2],[12,2],[21,1],[21,2],[21,2],[21,3],[22,2],[22,3],[39,2],[39,3],[40,2],[40,3],[24,1],[24,1],[63,1],[63,2],[63,3],[63,4],[67,1],[67,1],[67,2],[68,3],[69,3],[47,1],[47,2],[73,2],[53,1],[53,2],[75,3],[16,1],[16,1],[16,1],[16,1],[16,1],[79,1],[79,1],[32,1],[32,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[100,1],[100,1],[76,1],[76,3],[76,3],[10,1],[10,1],[10,3],[10,3],[10,3],[60,1],[102,1],[102,3],[104,1],[104,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.miew.reset(false); yy.ClearContext(); yy.miew.resetReps(\"empty\");\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.miew.rebuild();\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.miew.rebuildAll(); yy.miew.rebuild();\r\nbreak;\r\ncase 6:\r\nthis.$ = yy.echo(yy.utils.help().toString());\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.echo(yy.utils.help($$[$0]).toString());\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.miew.motm();\r\nbreak;\r\ncase 10: case 11:\r\nthis.$ = yy.utils.propagateProp($$[$0]); yy.echo(yy.miew.get($$[$0]).toString());\r\nbreak;\r\ncase 12: case 13:\r\nthis.$ = yy.miew.set($$[$0-1], yy.utils.propagateProp($$[$0-1], $$[$0]));;\r\nbreak;\r\ncase 14:\r\nthis.$ = yy.miew.saveSettings();;\r\nbreak;\r\ncase 15:\r\nthis.$ = yy.miew.restoreSettings();;\r\nbreak;\r\ncase 16:\r\nthis.$ = yy.miew.resetSettings();;\r\nbreak;\r\ncase 17:\r\nthis.$ = yy.miew.resetReps();\r\nbreak;\r\ncase 18:\r\nthis.$ = yy.miew.applyPreset($$[$0]);\r\nbreak;\r\ncase 21:\r\nthis.$ = yy.miew.repRemove($$[$0]); yy.representations.remove($$[$0]);\r\nbreak;\r\ncase 22:\r\nthis.$ = yy.miew.repHide($$[$0]);\r\nbreak;\r\ncase 23:\r\nthis.$ = yy.miew.repHide($$[$0], false);\r\nbreak;\r\ncase 24:\r\nthis.$ = yy.echo(yy.utils.listRep(yy.miew, yy.representations, $$[$0], '-e'));\r\nbreak;\r\ncase 25:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations));\r\nbreak;\r\ncase 26:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations, $$[$0]));\r\nbreak;\r\ncase 27:\r\nthis.$ = yy.echo(yy.utils.listSelector(yy.miew, yy.Context));\r\nbreak;\r\ncase 28:\r\nthis.$ = yy.miew.select(yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0], true));\r\nbreak;\r\ncase 29:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.utils.checkArg($$[$0-3].toLowerCase(), $$[$0-2], true); yy.miew.select(yy.Context[$$[$0].toLowerCase()]);\r\nbreak;\r\ncase 30:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {selector : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0])});\r\nbreak;\r\ncase 31:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.miew.within(yy.utils.checkArg(\"select\", $$[$0-2], true), Number($$[$0-4]));\r\nbreak;\r\ncase 32:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {material : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 35:\r\nthis.$ = yy.echo(yy.miew.view());\r\nbreak;\r\ncase 36: case 37:\r\nthis.$ = yy.miew.view($$[$0]);\r\nbreak;\r\ncase 38:\r\nthis.$ = yy.echo(yy.miew.changeUnit());\r\nbreak;\r\ncase 39:\r\nthis.$ = yy.echo(yy.miew.changeUnit($$[$0]));\r\nbreak;\r\ncase 40:\r\nthis.$ = yy.miew.dssp();\r\nbreak;\r\ncase 41:\r\nthis.$ = yy.miew.scale($$[$0]);\r\nbreak;\r\ncase 42:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.rotate($$[$0][i]['x'] * Math.PI / 180.0, $$[$0][i]['y'] * Math.PI / 180.0, $$[$0][i]['z'] * Math.PI / 180.0)} \r\nbreak;\r\ncase 43:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.translate($$[$0][i]['x'] || 0, $$[$0][i]['y'] || 0, $$[$0][i]['z'] || 0)} \r\nbreak;\r\ncase 44:\r\nthis.$ = yy.miew.center();\r\nbreak;\r\ncase 45:\r\nthis.$ = yy.miew.center($$[$0]);\r\nbreak;\r\ncase 48: case 49:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-1], $$[$0]]}, true);\r\nbreak;\r\ncase 50: case 51:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-2], $$[$0-1]], opts:$$[$0].toJSO(yy.utils, 'objects', 'line')}, true);\r\nbreak;\r\ncase 52:\r\nthis.$ = yy.echo(yy.utils.listObjs(yy.miew));\r\nbreak;\r\ncase 53:\r\nthis.$ = yy.miew.removeObject($$[$0]);\r\nbreak;\r\ncase 54:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: false}));\r\nbreak;\r\ncase 55:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: true}));\r\nbreak;\r\ncase 56:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: false}));\r\nbreak;\r\ncase 57: case 58:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: true}));\r\nbreak;\r\ncase 59:\r\nthis.$ = yy.miew.screenshotSave();\r\nbreak;\r\ncase 60:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0]));\r\nbreak;\r\ncase 61:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0-1]), Number($$[$0]));\r\nbreak;\r\ncase 62: case 63: case 64:\r\nthis.$ = yy.utils.load(yy.miew, $$[$0]); yy.representations.clear();\r\nbreak;\r\ncase 65:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd()));\r\nbreak;\r\ncase 66:\r\nthis.$ = yy.echo(yy.representations.add($$[$0], yy.miew.repAdd()));\r\nbreak;\r\ncase 67:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 68:\r\nthis.$ = yy.echo(yy.representations.add($$[$0-1], yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 69:\r\nthis.$ = yy.miew.rep($$[$0]); yy.miew.repCurrent($$[$0]);\r\nbreak;\r\ncase 70:\r\nthis.$ = yy.miew.rep($$[$0-1], $$[$0]); yy.miew.repCurrent($$[$0-1]);\r\nbreak;\r\ncase 71:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 72:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 73:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 74:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 75:\r\nthis.$ = Number(yy.representations.get($$[$0]));\r\nbreak;\r\ncase 76: case 92:\r\nthis.$ = Number($$[$0]);\r\nbreak;\r\ncase 77:\r\nthis.$ = $$[$0];\r\nbreak;\r\ncase 78:\r\nthis.$ = yy._.assign($$[$0-1], $$[$0]);\r\nbreak;\r\ncase 79:\r\nthis.$ = yy._.assign($$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 80:\r\nthis.$ = yy._.assign($$[$0-3], $$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 81: case 82:\r\nthis.$ = yy.CreateObjectPair($$[$0].key, $$[$0].val);\r\nbreak;\r\ncase 83:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].key, new Array($$[$0-1].val, $$[$0].toJSO(yy.utils, $$[$0-1].key, $$[$0-1].val)));\r\nbreak;\r\ncase 84: case 85:\r\nthis.$ = Object.create({'key': yy.keyRemap($$[$0-2]), 'val': yy.utils.checkArg($$[$0-2], $$[$0])});\r\nbreak;\r\ncase 86:\r\nthis.$ = [$$[$0]];\r\nbreak;\r\ncase 87:\r\nthis.$ = $$[$0-1].concat($$[$0]);\r\nbreak;\r\ncase 88:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].toLowerCase(), Number($$[$0]));\r\nbreak;\r\ncase 89:\r\nthis.$ = new yy.ArgList($$[$0]);\r\nbreak;\r\ncase 90:\r\nthis.$ = $$[$0-1].append($$[$0]);\r\nbreak;\r\ncase 91:\r\nthis.$ = new yy.Arg($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 93:\r\nthis.$ = parseInt($$[$0]);\r\nbreak;\r\ncase 94:\r\nthis.$ = JSON.parse($$[$0]);\r\nbreak;\r\ncase 95: case 96:\r\nthis.$ = String($$[$0]);\r\nbreak;\r\ncase 157: case 158: case 161: case 162: case 163:\r\nthis.$ = $$[$0-2] + $$[$0-1] + $$[$0] //cause of could be color word in path;\r\nbreak;\r\ncase 166:\r\nthis.$ = $$[$0-2] = $$[$0-2] + $$[$0-1] + $$[$0];\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,5:[1,3],6:[1,4],7:[1,5],9:[1,6],11:[1,7],12:8,13:[1,9],15:[1,10],17:[1,11],18:[1,12],19:[1,13],20:[1,14],21:15,22:16,23:[1,17],25:[1,18],26:[1,19],27:[1,20],30:[1,21],33:[1,22],34:[1,23],37:[1,24],39:25,40:26,41:[1,27],43:[1,28],44:[1,29],45:[1,30],46:[1,31],48:[1,32],49:[1,33],50:34,51:35,52:[1,36],54:[1,37],55:[1,38],56:[1,44],58:[1,45],59:[1,39],62:[1,40],64:[1,41],65:[1,42],66:[1,43]},{1:[3]},{5:[1,46]},{1:[2,2]},{5:[2,3]},{5:[2,4],8:[1,47]},{5:[2,6],6:$V0,7:$V1,9:$V2,10:48,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,8]},{5:[2,9]},{6:$V0,7:$V1,9:$V2,10:106,13:$V3,14:[1,107],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{6:$V0,7:$V1,9:$V2,10:108,13:$V3,14:[1,109],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,14]},{5:[2,15]},{5:[2,16]},{5:[2,17],14:$VS,16:110,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,19]},{5:[2,20]},{24:116,35:$VX,38:$VY},{24:119,35:$VX,38:$VY},{24:120,35:$VX,38:$VY},{5:[2,25],24:121,28:[1,122],29:[1,123],35:$VX,38:$VY},{14:[1,124]},{14:[1,125]},{35:[1,126]},{38:[1,127]},{5:[2,33]},{5:[2,34]},{5:[2,35],14:[1,128],42:[1,129]},{5:[2,38],35:[1,130]},{5:[2,40]},{35:[1,131]},{47:132,73:133,74:$VZ},{47:135,73:133,74:$VZ},{5:[2,44],14:[1,136]},{5:[2,46]},{5:[2,47]},{6:$V0,7:$V1,9:$V2,10:138,13:$V3,14:[1,137],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,52]},{35:[1,139]},{14:[1,143],38:[1,141],60:140,61:[1,142]},{5:[2,65],38:[1,144],63:145,67:146,68:147,69:148,70:$V_,72:$V$},{24:151,35:$VX,38:$VY},{38:[1,152]},{38:[1,153]},{5:[2,54],29:[1,154],57:[1,155]},{5:[2,59],35:[1,156]},{1:[2,1]},{5:[2,5]},{5:[2,7],101:$V01},o($V11,[2,159]),o($V11,[2,160]),o($V21,[2,97]),o($V21,[2,98]),o($V11,[2,147]),o($V11,[2,148]),o($V11,[2,149]),o($V11,[2,150]),o($V11,[2,151]),o($V11,[2,152]),o($V11,[2,153]),o($V21,[2,101]),o($V21,[2,102]),o($V21,[2,103]),o($V21,[2,104]),o($V21,[2,105]),o($V21,[2,106]),o($V21,[2,107]),o($V21,[2,108]),o($V21,[2,109]),o($V21,[2,110]),o($V21,[2,111]),o($V21,[2,112]),o($V21,[2,113]),o($V21,[2,114]),o($V21,[2,115]),o($V21,[2,116]),o($V21,[2,117]),o($V21,[2,118]),o($V21,[2,119]),o($V21,[2,120]),o($V21,[2,121]),o($V21,[2,122]),o($V21,[2,123]),o($V21,[2,124]),o($V21,[2,125]),o($V21,[2,126]),o($V21,[2,127]),o($V21,[2,128]),o($V21,[2,129]),o($V21,[2,130]),o($V21,[2,131]),o($V21,[2,132]),o($V21,[2,133]),o($V21,[2,134]),o($V21,[2,135]),o($V21,[2,136]),o($V21,[2,137]),o($V21,[2,138]),o($V21,[2,139]),o($V21,[2,140]),o($V21,[2,141]),o($V21,[2,142]),o($V21,[2,143]),o($V21,[2,144]),o($V21,[2,145]),o($V21,[2,146]),{5:[2,10],101:$V01},{5:[2,11]},{14:$VS,16:158,35:$VT,38:$VU,77:$VV,78:$VW,101:$V01},{14:$VS,16:159,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,18]},o($V31,[2,92]),o($V31,[2,93]),o($V31,[2,94]),o($V31,[2,95]),o($V31,[2,96]),{5:[2,21]},o($V41,[2,75]),o($V41,[2,76]),{5:[2,22]},{5:[2,23]},{5:[2,24]},{5:[2,26]},{5:[2,27]},{5:[2,28],31:[1,160]},{5:[2,30]},{36:[1,161]},{5:[2,32]},{5:[2,36]},{5:[2,37]},{5:[2,39]},{5:[2,41]},{5:[2,42],73:162,74:$VZ},o($V51,[2,86]),{35:[1,163]},{5:[2,43],73:162,74:$VZ},{5:[2,45]},{14:[1,164]},{6:$V0,7:$V1,9:$V2,10:165,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR,101:$V01},{5:[2,53]},{5:[2,62]},{5:[2,63]},{5:[2,64]},{5:[2,164]},{5:[2,66],63:166,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,67]},{5:[2,77],67:167,68:147,69:148,70:$V_,72:$V$},o($V41,[2,81]),o($V41,[2,82],{80:52,53:168,75:169,76:170,79:171,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),{71:[1,172]},{71:[1,173]},{5:[2,69],63:174,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,71],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:175,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,73],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:176,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,55],57:[1,177]},{5:[2,56],29:[1,178]},{5:[2,60],35:[1,179]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,181],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:180,80:52,81:182,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,12]},{5:[2,13]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:183,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{14:[1,186]},o($V51,[2,87]),o($V51,[2,88]),{5:[2,48],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:187,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,49],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:188,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,101:$V01},{5:[2,68]},{5:[2,78],67:189,68:147,69:148,70:$V_,72:$V$},o($V41,[2,83],{80:52,76:170,79:171,75:190,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),o($V31,[2,89]),{71:[1,191],101:[1,192]},o($V61,[2,156]),{14:$VS,16:193,35:$VT,38:$VU,77:$VV,78:$VW},{14:$VS,16:194,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,70]},{5:[2,72],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,74],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,57]},{5:[2,58]},{5:[2,61]},o($V11,[2,161]),o($V11,[2,162]),o($V11,[2,163]),{5:[2,29]},{5:[2,99]},{5:[2,100]},{31:[1,195]},{5:[2,50],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,51],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,79],67:196,68:147,69:148,70:$V_,72:$V$},o($V31,[2,90]),{14:$VS,16:197,35:$VT,38:$VU,77:$VV,78:$VW},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,199],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,79:198,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},o($V41,[2,84]),o($V31,[2,85]),{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:200,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,80]},o($V31,[2,91]),o($V61,[2,157]),o($V61,[2,158]),{5:[2,31]}],\r\ndefaultActions: {3:[2,2],4:[2,3],7:[2,8],8:[2,9],11:[2,14],12:[2,15],13:[2,16],15:[2,19],16:[2,20],25:[2,33],26:[2,34],29:[2,40],34:[2,46],35:[2,47],37:[2,52],46:[2,1],47:[2,5],107:[2,11],110:[2,18],116:[2,21],119:[2,22],120:[2,23],121:[2,24],122:[2,26],123:[2,27],125:[2,30],127:[2,32],128:[2,36],129:[2,37],130:[2,39],131:[2,41],136:[2,45],139:[2,53],140:[2,62],141:[2,63],142:[2,64],143:[2,164],145:[2,67],158:[2,12],159:[2,13],166:[2,68],174:[2,70],177:[2,57],178:[2,58],179:[2,61],183:[2,29],184:[2,99],185:[2,100],196:[2,80],200:[2,31]},\r\nparseError: function parseError (str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function(match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex () {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin (condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState () {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules () {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState (n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState (condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* ignore whitespace */\r\nbreak;\r\ncase 1:return '';\r\nbreak;\r\ncase 2:return '';\r\nbreak;\r\ncase 3:return 42;\r\nbreak;\r\ncase 4:return 35;\r\nbreak;\r\ncase 5:return 77;\r\nbreak;\r\ncase 6:return 78;\r\nbreak;\r\ncase 7:return 78;\r\nbreak;\r\ncase 8:return 8;\r\nbreak;\r\ncase 9:return 6;\r\nbreak;\r\ncase 10:return 82;\r\nbreak;\r\ncase 11:return 7;\r\nbreak;\r\ncase 12:return 9;\r\nbreak;\r\ncase 13:return 59;\r\nbreak;\r\ncase 14:return 13\r\nbreak;\r\ncase 15:return 15\r\nbreak;\r\ncase 16:return 17\r\nbreak;\r\ncase 17:return 18\r\nbreak;\r\ncase 18:return 19\r\nbreak;\r\ncase 19:return 20\r\nbreak;\r\ncase 20:return 11\r\nbreak;\r\ncase 21:return 62\r\nbreak;\r\ncase 22:return 64\r\nbreak;\r\ncase 23:return 23\r\nbreak;\r\ncase 24:return 25\r\nbreak;\r\ncase 25:return 26\r\nbreak;\r\ncase 26:return 27\r\nbreak;\r\ncase 27:return 30\r\nbreak;\r\ncase 28:return 34\r\nbreak;\r\ncase 29:return 33\r\nbreak;\r\ncase 30:return 65\r\nbreak;\r\ncase 31:return 66\r\nbreak;\r\ncase 32:return 37\r\nbreak;\r\ncase 33:return 41\r\nbreak;\r\ncase 34:return 43\r\nbreak;\r\ncase 35:return 52\r\nbreak;\r\ncase 36:return 54\r\nbreak;\r\ncase 37:return 55\r\nbreak;\r\ncase 38:return 46\r\nbreak;\r\ncase 39:return 48\r\nbreak;\r\ncase 40:return 45\r\nbreak;\r\ncase 41:return 49\r\nbreak;\r\ncase 42:return 56\r\nbreak;\r\ncase 43:return 58;\r\nbreak;\r\ncase 44:return 44\r\nbreak;\r\ncase 45:return 83\r\nbreak;\r\ncase 46:return 84\r\nbreak;\r\ncase 47:return 85\r\nbreak;\r\ncase 48:return 86\r\nbreak;\r\ncase 49:return 87\r\nbreak;\r\ncase 50:return 88\r\nbreak;\r\ncase 51:return 89\r\nbreak;\r\ncase 52:return 90\r\nbreak;\r\ncase 53:return 91\r\nbreak;\r\ncase 54:return 92\r\nbreak;\r\ncase 55:return 93\r\nbreak;\r\ncase 56:return 94\r\nbreak;\r\ncase 57:return 95\r\nbreak;\r\ncase 58:return 70\r\nbreak;\r\ncase 59:return 70\r\nbreak;\r\ncase 60:return 72\r\nbreak;\r\ncase 61:return 72\r\nbreak;\r\ncase 62:return 74\r\nbreak;\r\ncase 63:return 74\r\nbreak;\r\ncase 64:return 74\r\nbreak;\r\ncase 65:return 31\r\nbreak;\r\ncase 66:return 36\r\nbreak;\r\ncase 67:return 96\r\nbreak;\r\ncase 68:return 97\r\nbreak;\r\ncase 69:return 98\r\nbreak;\r\ncase 70:return 99\r\nbreak;\r\ncase 71:yy_.yytext = yy.utils.unquoteString(yy_.yytext); return 14;\r\nbreak;\r\ncase 72:return 38;\r\nbreak;\r\ncase 73:return 5;\r\nbreak;\r\ncase 74:return 101;\r\nbreak;\r\ncase 75:return 103;\r\nbreak;\r\ncase 76:return '\\\\';\r\nbreak;\r\ncase 77:return 28\r\nbreak;\r\ncase 78:return 61\r\nbreak;\r\ncase 79:return 29\r\nbreak;\r\ncase 80:return 57\r\nbreak;\r\ncase 81:return 71\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:[#].*)/i,/^(?:\\/\\/.*)/i,/^(?:([_A-Z0-9\\/\\+]+==))/i,/^(?:-?[0-9]+(\\.[0-9]+)?\\b)/i,/^(?:0[xX][0-9A-F]+\\b)/i,/^(?:false\\b)/i,/^(?:true\\b)/i,/^(?:all\\b)/i,/^(?:reset\\b)/i,/^(?:clear\\b)/i,/^(?:build\\b)/i,/^(?:help\\b)/i,/^(?:load\\b)/i,/^(?:get\\b)/i,/^(?:set\\b)/i,/^(?:set_save\\b)/i,/^(?:set_restore\\b)/i,/^(?:set_reset\\b)/i,/^(?:preset\\b)/i,/^(?:motm\\b)/i,/^(?:add\\b)/i,/^(?:rep\\b)/i,/^(?:remove\\b)/i,/^(?:hide\\b)/i,/^(?:show\\b)/i,/^(?:list\\b)/i,/^(?:select\\b)/i,/^(?:within\\b)/i,/^(?:selector\\b)/i,/^(?:mode\\b)/i,/^(?:color\\b)/i,/^(?:material\\b)/i,/^(?:view\\b)/i,/^(?:unit\\b)/i,/^(?:line\\b)/i,/^(?:listobj\\b)/i,/^(?:removeobj\\b)/i,/^(?:rotate\\b)/i,/^(?:translate\\b)/i,/^(?:scale\\b)/i,/^(?:center\\b)/i,/^(?:url\\b)/i,/^(?:screenshot\\b)/i,/^(?:dssp\\b)/i,/^(?:file_list\\b)/i,/^(?:file_register\\b)/i,/^(?:file_delete\\b)/i,/^(?:preset_add\\b)/i,/^(?:preset_delete\\b)/i,/^(?:preset_update\\b)/i,/^(?:preset_rename\\b)/i,/^(?:preset_open\\b)/i,/^(?:create_scenario\\b)/i,/^(?:reset_scenario\\b)/i,/^(?:delete_scenario\\b)/i,/^(?:add_scenario_item\\b)/i,/^(?:list_scenario\\b)/i,/^(?:s\\b)/i,/^(?:mt\\b)/i,/^(?:m\\b)/i,/^(?:c\\b)/i,/^(?:x\\b)/i,/^(?:y\\b)/i,/^(?:z\\b)/i,/^(?:as\\b)/i,/^(?:of\\b)/i,/^(?:pdb\\b)/i,/^(?:delay\\b)/i,/^(?:prst\\b)/i,/^(?:desc\\b)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:\\.)/i,/^(?:\\/)/i,/^(?:\\\\)/i,/^(?:-e\\b)/i,/^(?:-f\\b)/i,/^(?:-s\\b)/i,/^(?:-v\\b)/i,/^(?:=)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[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,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,8],$V5=[1,9],$V6=[1,11],$V7=[1,12],$V8=[5,7,8,11],$V9=[1,17],$Va=[1,22],$Vb=[1,20],$Vc=[1,21],$Vd=[5,7,8,11,19];\r\nvar parser = {trace: function trace() { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Expression\":4,\"EOF\":5,\"Selector\":6,\"OR\":7,\"AND\":8,\"NOT\":9,\"(\":10,\")\":11,\"SELECTOR\":12,\"NAMED_SELECTOR\":13,\"SELECTOR_RANGED\":14,\"RangeList\":15,\"SELECTOR_NAMED\":16,\"NameList\":17,\"Range\":18,\",\":19,\"NUMBER\":20,\":\":21,\"Name\":22,\"IDENTIFIER\":23,\"STRING\":24,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",7:\"OR\",8:\"AND\",9:\"NOT\",10:\"(\",11:\")\",12:\"SELECTOR\",13:\"NAMED_SELECTOR\",14:\"SELECTOR_RANGED\",16:\"SELECTOR_NAMED\",19:\",\",20:\"NUMBER\",21:\":\",23:\"IDENTIFIER\",24:\"STRING\"},\r\nproductions_: [0,[3,2],[4,1],[4,3],[4,3],[4,2],[4,3],[6,1],[6,1],[6,2],[6,2],[15,1],[15,3],[18,1],[18,3],[17,1],[17,3],[22,1],[22,1],[22,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.keyword('or')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.keyword('and')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.keyword('not')($$[$0]);\r\nbreak;\r\ncase 6:\r\nthis.$ = $$[$0-1];\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.keyword($$[$0])();\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.GetSelector($$[$0].toLowerCase().slice(1, $$[$0].length));\r\nbreak;\r\ncase 9: case 10:\r\nthis.$ = yy.keyword($$[$0-1])($$[$0]);\r\nbreak;\r\ncase 11:\r\nthis.$ = new yy.RangeList($$[$0]);\r\nbreak;\r\ncase 12: case 16:\r\nthis.$ = $$[$0-2].append($$[$0]);\r\nbreak;\r\ncase 13:\r\nthis.$ = new yy.Range(Number($$[$0]));\r\nbreak;\r\ncase 14:\r\nthis.$ = new yy.Range(Number($$[$0-2]), Number($$[$0]));\r\nbreak;\r\ncase 15:\r\nthis.$ = new yy.ValueList($$[$0]);\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{1:[3]},{5:[1,10],7:$V6,8:$V7},o($V8,[2,2]),{4:13,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:14,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,7]),o($V8,[2,8]),{15:15,18:16,20:$V9},{17:18,20:$Va,22:19,23:$Vb,24:$Vc},{1:[2,1]},{4:23,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:24,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,5]),{7:$V6,8:$V7,11:[1,25]},o($V8,[2,9],{19:[1,26]}),o($Vd,[2,11]),o($Vd,[2,13],{21:[1,27]}),o($V8,[2,10],{19:[1,28]}),o($Vd,[2,15]),o($Vd,[2,17]),o($Vd,[2,18]),o($Vd,[2,19]),o([5,7,11],[2,3],{8:$V7}),o($V8,[2,4]),o($V8,[2,6]),{18:29,20:$V9},{20:[1,30]},{20:$Va,22:31,23:$Vb,24:$Vc},o($Vd,[2,12]),o($Vd,[2,14]),o($Vd,[2,16])],\r\ndefaultActions: {10:[2,1]},\r\nparseError: function parseError(str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function (match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex() {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin(condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState() {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules() {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState(n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState(condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* skip whitespace */\r\nbreak;\r\ncase 1:return 20;\r\nbreak;\r\ncase 2:return 7;\r\nbreak;\r\ncase 3:return 8;\r\nbreak;\r\ncase 4:return 9;\r\nbreak;\r\ncase 5:return 12;\r\nbreak;\r\ncase 6:return 16;\r\nbreak;\r\ncase 7:return 14;\r\nbreak;\r\ncase 8:return 10;\r\nbreak;\r\ncase 9:return 11;\r\nbreak;\r\ncase 10:return 19;\r\nbreak;\r\ncase 11:return 21;\r\nbreak;\r\ncase 12:return '<=';\r\nbreak;\r\ncase 13:return '>=';\r\nbreak;\r\ncase 14:return '<';\r\nbreak;\r\ncase 15:return '>';\r\nbreak;\r\ncase 16:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 24;\r\nbreak;\r\ncase 17:return 13;\r\nbreak;\r\ncase 18:return 23;\r\nbreak;\r\ncase 19:return 5;\r\nbreak;\r\ncase 20:return 'INVALID';\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:(-?(?:[1-9][0-9]+|[0-9]))\\b)/i,/^(?:OR\\b)/i,/^(?:AND\\b)/i,/^(?:NOT\\b)/i,/^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\\b)/i,/^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\\b)/i,/^(?:((SERIAL|SEQUENCE|RESIDX))\\b)/i,/^(?:\\()/i,/^(?:\\))/i,/^(?:,)/i,/^(?::)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:(@[_A-Z0-9]+))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:.)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","\r\n/*\r\nSmooth.js version 0.1.7\r\n\r\nTurn arrays into smooth functions.\r\n\r\nCopyright 2012 Spencer Cohen\r\nLicensed under MIT license (see \"Smooth.js MIT license.txt\")\r\n*/\r\n\r\n/*Constants (these are accessible by Smooth.WHATEVER in user space)\r\n*/\r\n\r\n(function() {\r\n var AbstractInterpolator, CubicInterpolator, Enum, LinearInterpolator, NearestInterpolator, PI, SincFilterInterpolator, Smooth, clipClamp, clipMirror, clipPeriodic, defaultConfig, getColumn, getType, isValidNumber, k, makeLanczosWindow, makeScaledFunction, makeSincKernel, normalizeScaleTo, shallowCopy, sin, sinc, v, validateNumber, validateVector,\r\n __hasProp = Object.prototype.hasOwnProperty,\r\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };\r\n\r\n Enum = {\r\n /*Interpolation methods\r\n */\r\n METHOD_NEAREST: 'nearest',\r\n METHOD_LINEAR: 'linear',\r\n METHOD_CUBIC: 'cubic',\r\n METHOD_LANCZOS: 'lanczos',\r\n METHOD_SINC: 'sinc',\r\n /*Input clipping modes\r\n */\r\n CLIP_CLAMP: 'clamp',\r\n CLIP_ZERO: 'zero',\r\n CLIP_PERIODIC: 'periodic',\r\n CLIP_MIRROR: 'mirror',\r\n /* Constants for control over the cubic interpolation tension\r\n */\r\n CUBIC_TENSION_DEFAULT: 0,\r\n CUBIC_TENSION_CATMULL_ROM: 0\r\n };\r\n\r\n defaultConfig = {\r\n method: Enum.METHOD_CUBIC,\r\n cubicTension: Enum.CUBIC_TENSION_DEFAULT,\r\n clip: Enum.CLIP_CLAMP,\r\n scaleTo: 0,\r\n sincFilterSize: 2,\r\n sincWindow: void 0\r\n };\r\n\r\n /*Index clipping functions\r\n */\r\n\r\n clipClamp = function(i, n) {\r\n return Math.max(0, Math.min(i, n - 1));\r\n };\r\n\r\n clipPeriodic = function(i, n) {\r\n i = i % n;\r\n if (i < 0) i += n;\r\n return i;\r\n };\r\n\r\n clipMirror = function(i, n) {\r\n var period;\r\n period = 2 * (n - 1);\r\n i = clipPeriodic(i, period);\r\n if (i > n - 1) i = period - i;\r\n return i;\r\n };\r\n\r\n /*\r\n Abstract scalar interpolation class which provides common functionality for all interpolators\r\n \r\n Subclasses must override interpolate().\r\n */\r\n\r\n AbstractInterpolator = (function() {\r\n\r\n function AbstractInterpolator(array, config) {\r\n this.array = array.slice(0);\r\n this.length = this.array.length;\r\n if (!(this.clipHelper = {\r\n clamp: this.clipHelperClamp,\r\n zero: this.clipHelperZero,\r\n periodic: this.clipHelperPeriodic,\r\n mirror: this.clipHelperMirror\r\n }[config.clip])) {\r\n throw \"Invalid clip: \" + config.clip;\r\n }\r\n }\r\n\r\n AbstractInterpolator.prototype.getClippedInput = function(i) {\r\n if ((0 <= i && i < this.length)) {\r\n return this.array[i];\r\n } else {\r\n return this.clipHelper(i);\r\n }\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperClamp = function(i) {\r\n return this.array[clipClamp(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperZero = function(i) {\r\n return 0;\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperPeriodic = function(i) {\r\n return this.array[clipPeriodic(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperMirror = function(i) {\r\n return this.array[clipMirror(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.interpolate = function(t) {\r\n throw 'Subclasses of AbstractInterpolator must override the interpolate() method.';\r\n };\r\n\r\n return AbstractInterpolator;\r\n\r\n })();\r\n\r\n NearestInterpolator = (function(_super) {\r\n\r\n __extends(NearestInterpolator, _super);\r\n\r\n function NearestInterpolator() {\r\n NearestInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n NearestInterpolator.prototype.interpolate = function(t) {\r\n return this.getClippedInput(Math.round(t));\r\n };\r\n\r\n return NearestInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n LinearInterpolator = (function(_super) {\r\n\r\n __extends(LinearInterpolator, _super);\r\n\r\n function LinearInterpolator() {\r\n LinearInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n LinearInterpolator.prototype.interpolate = function(t) {\r\n var k;\r\n k = Math.floor(t);\r\n t -= k;\r\n return (1 - t) * this.getClippedInput(k) + t * this.getClippedInput(k + 1);\r\n };\r\n\r\n return LinearInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n CubicInterpolator = (function(_super) {\r\n\r\n __extends(CubicInterpolator, _super);\r\n\r\n function CubicInterpolator(array, config) {\r\n this.tangentFactor = 1 - Math.max(-1, Math.min(1, config.cubicTension));\r\n CubicInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n CubicInterpolator.prototype.getTangent = function(k) {\r\n return this.tangentFactor * (this.getClippedInput(k + 1) - this.getClippedInput(k - 1)) / 2;\r\n };\r\n\r\n CubicInterpolator.prototype.interpolate = function(t) {\r\n var k, m, p, t2, t3;\r\n k = Math.floor(t);\r\n m = [this.getTangent(k), this.getTangent(k + 1)];\r\n p = [this.getClippedInput(k), this.getClippedInput(k + 1)];\r\n t -= k;\r\n t2 = t * t;\r\n t3 = t * t2;\r\n return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + (-2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1];\r\n };\r\n\r\n return CubicInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n sin = Math.sin, PI = Math.PI;\r\n\r\n sinc = function(x) {\r\n if (x === 0) {\r\n return 1;\r\n } else {\r\n return sin(PI * x) / (PI * x);\r\n }\r\n };\r\n\r\n makeLanczosWindow = function(a) {\r\n return function(x) {\r\n return sinc(x / a);\r\n };\r\n };\r\n\r\n makeSincKernel = function(window) {\r\n return function(x) {\r\n return sinc(x) * window(x);\r\n };\r\n };\r\n\r\n SincFilterInterpolator = (function(_super) {\r\n\r\n __extends(SincFilterInterpolator, _super);\r\n\r\n function SincFilterInterpolator(array, config) {\r\n SincFilterInterpolator.__super__.constructor.apply(this, arguments);\r\n this.a = config.sincFilterSize;\r\n if (!config.sincWindow) throw 'No sincWindow provided';\r\n this.kernel = makeSincKernel(config.sincWindow);\r\n }\r\n\r\n SincFilterInterpolator.prototype.interpolate = function(t) {\r\n var k, n, sum, _ref, _ref2;\r\n k = Math.floor(t);\r\n sum = 0;\r\n for (n = _ref = k - this.a + 1, _ref2 = k + this.a; _ref <= _ref2 ? n <= _ref2 : n >= _ref2; _ref <= _ref2 ? n++ : n--) {\r\n sum += this.kernel(t - n) * this.getClippedInput(n);\r\n }\r\n return sum;\r\n };\r\n\r\n return SincFilterInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n getColumn = function(arr, i) {\r\n var row, _i, _len, _results;\r\n _results = [];\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n row = arr[_i];\r\n _results.push(row[i]);\r\n }\r\n return _results;\r\n };\r\n\r\n makeScaledFunction = function(f, baseScale, scaleRange) {\r\n var scaleFactor, translation;\r\n if (scaleRange.join === '0,1') {\r\n return f;\r\n } else {\r\n scaleFactor = baseScale / (scaleRange[1] - scaleRange[0]);\r\n translation = scaleRange[0];\r\n return function(t) {\r\n return f(scaleFactor * (t - translation));\r\n };\r\n }\r\n };\r\n\r\n getType = function(x) {\r\n return Object.prototype.toString.call(x).slice('[object '.length, -1);\r\n };\r\n\r\n validateNumber = function(n) {\r\n if (isNaN(n)) throw 'NaN in Smooth() input';\r\n if (getType(n) !== 'Number') throw 'Non-number in Smooth() input';\r\n if (!isFinite(n)) throw 'Infinity in Smooth() input';\r\n };\r\n\r\n validateVector = function(v, dimension) {\r\n var n, _i, _len;\r\n if (getType(v) !== 'Array') throw 'Non-vector in Smooth() input';\r\n if (v.length !== dimension) throw 'Inconsistent dimension in Smooth() input';\r\n for (_i = 0, _len = v.length; _i < _len; _i++) {\r\n n = v[_i];\r\n validateNumber(n);\r\n }\r\n };\r\n\r\n isValidNumber = function(n) {\r\n return (getType(n) === 'Number') && isFinite(n) && !isNaN(n);\r\n };\r\n\r\n normalizeScaleTo = function(s) {\r\n var invalidErr;\r\n invalidErr = \"scaleTo param must be number or array of two numbers\";\r\n switch (getType(s)) {\r\n case 'Number':\r\n if (!isValidNumber(s)) throw invalidErr;\r\n s = [0, s];\r\n break;\r\n case 'Array':\r\n if (s.length !== 2) throw invalidErr;\r\n if (!(isValidNumber(s[0]) && isValidNumber(s[1]))) throw invalidErr;\r\n break;\r\n default:\r\n throw invalidErr;\r\n }\r\n return s;\r\n };\r\n\r\n shallowCopy = function(obj) {\r\n var copy, k, v;\r\n copy = {};\r\n for (k in obj) {\r\n if (!__hasProp.call(obj, k)) continue;\r\n v = obj[k];\r\n copy[k] = v;\r\n }\r\n return copy;\r\n };\r\n\r\n Smooth = function(arr, config) {\r\n var baseDomainEnd, dimension, i, interpolator, interpolatorClass, interpolators, k, n, properties, smoothFunc, v;\r\n if (config == null) config = {};\r\n properties = {};\r\n config = shallowCopy(config);\r\n properties.config = shallowCopy(config);\r\n if (config.scaleTo == null) config.scaleTo = config.period;\r\n if (config.sincFilterSize == null) {\r\n config.sincFilterSize = config.lanczosFilterSize;\r\n }\r\n for (k in defaultConfig) {\r\n if (!__hasProp.call(defaultConfig, k)) continue;\r\n v = defaultConfig[k];\r\n if (config[k] == null) config[k] = v;\r\n }\r\n if (!(interpolatorClass = {\r\n nearest: NearestInterpolator,\r\n linear: LinearInterpolator,\r\n cubic: CubicInterpolator,\r\n lanczos: SincFilterInterpolator,\r\n sinc: SincFilterInterpolator\r\n }[config.method])) {\r\n throw \"Invalid method: \" + config.method;\r\n }\r\n if (config.method === 'lanczos') {\r\n config.sincWindow = makeLanczosWindow(config.sincFilterSize);\r\n }\r\n if (arr.length < 2) throw 'Array must have at least two elements';\r\n properties.count = arr.length;\r\n smoothFunc = (function() {\r\n var _i, _j, _len, _len2;\r\n switch (getType(arr[0])) {\r\n case 'Number':\r\n properties.dimension = 'scalar';\r\n if (Smooth.deepValidation) {\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n n = arr[_i];\r\n validateNumber(n);\r\n }\r\n }\r\n interpolator = new interpolatorClass(arr, config);\r\n return function(t) {\r\n return interpolator.interpolate(t);\r\n };\r\n case 'Array':\r\n properties.dimension = dimension = arr[0].length;\r\n if (!dimension) throw 'Vectors must be non-empty';\r\n if (Smooth.deepValidation) {\r\n for (_j = 0, _len2 = arr.length; _j < _len2; _j++) {\r\n v = arr[_j];\r\n validateVector(v, dimension);\r\n }\r\n }\r\n interpolators = (function() {\r\n var _results;\r\n _results = [];\r\n for (i = 0; 0 <= dimension ? i < dimension : i > dimension; 0 <= dimension ? i++ : i--) {\r\n _results.push(new interpolatorClass(getColumn(arr, i), config));\r\n }\r\n return _results;\r\n })();\r\n return function(t) {\r\n var interpolator, _k, _len3, _results;\r\n _results = [];\r\n for (_k = 0, _len3 = interpolators.length; _k < _len3; _k++) {\r\n interpolator = interpolators[_k];\r\n _results.push(interpolator.interpolate(t));\r\n }\r\n return _results;\r\n };\r\n default:\r\n throw \"Invalid element type: \" + (getType(arr[0]));\r\n }\r\n })();\r\n if (config.clip === 'periodic') {\r\n baseDomainEnd = arr.length;\r\n } else {\r\n baseDomainEnd = arr.length - 1;\r\n }\r\n config.scaleTo || (config.scaleTo = baseDomainEnd);\r\n properties.domain = normalizeScaleTo(config.scaleTo);\r\n smoothFunc = makeScaledFunction(smoothFunc, baseDomainEnd, properties.domain);\r\n properties.domain.sort();\r\n /*copy properties\r\n */\r\n for (k in properties) {\r\n if (!__hasProp.call(properties, k)) continue;\r\n v = properties[k];\r\n smoothFunc[k] = v;\r\n }\r\n return smoothFunc;\r\n };\r\n\r\n for (k in Enum) {\r\n if (!__hasProp.call(Enum, k)) continue;\r\n v = Enum[k];\r\n Smooth[k] = v;\r\n }\r\n\r\n Smooth.deepValidation = true;\r\n\r\n (typeof exports !== \"undefined\" && exports !== null ? exports : window).Smooth = Smooth;\r\n\r\n}).call(this);\r\n","!function(r,t){if(\"function\"==typeof define&&define.amd)define([\"exports\"],t);else if(\"object\"==typeof exports&&\"undefined\"!=typeof module)t(exports);else t(r.MMTF=r.MMTF||{})}(this,function(r){\"use strict\";function t(r,t,n){for(var e=(r.byteLength,0),i=n.length;i>e;e++){var o=n.charCodeAt(e);if(128>o)r.setUint8(t++,o>>>0&127|0);else if(2048>o)r.setUint8(t++,o>>>6&31|192),r.setUint8(t++,o>>>0&63|128);else if(65536>o)r.setUint8(t++,o>>>12&15|224),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128);else{if(!(1114112>o))throw new Error(\"bad codepoint \"+o);r.setUint8(t++,o>>>18&7|240),r.setUint8(t++,o>>>12&63|128),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128)}}}function n(r){for(var t=0,n=0,e=r.length;e>n;n++){var i=r.charCodeAt(n);if(128>i)t+=1;else if(2048>i)t+=2;else if(65536>i)t+=3;else{if(!(1114112>i))throw new Error(\"bad codepoint \"+i);t+=4}}return t}function e(r,i,o){var a=typeof r;if(\"string\"===a){var u=n(r);if(32>u)return i.setUint8(o,160|u),t(i,o+1,r),1+u;if(256>u)return i.setUint8(o,217),i.setUint8(o+1,u),t(i,o+2,r),2+u;if(65536>u)return i.setUint8(o,218),i.setUint16(o+1,u),t(i,o+3,r),3+u;if(4294967296>u)return i.setUint8(o,219),i.setUint32(o+1,u),t(i,o+5,r),5+u}if(r instanceof Uint8Array){var u=r.byteLength,s=new Uint8Array(i.buffer);if(256>u)return i.setUint8(o,196),i.setUint8(o+1,u),s.set(r,o+2),2+u;if(65536>u)return i.setUint8(o,197),i.setUint16(o+1,u),s.set(r,o+3),3+u;if(4294967296>u)return i.setUint8(o,198),i.setUint32(o+1,u),s.set(r,o+5),5+u}if(\"number\"===a){if(!isFinite(r))throw new Error(\"Number not finite: \"+r);if(Math.floor(r)!==r)return i.setUint8(o,203),i.setFloat64(o+1,r),9;if(r>=0){if(128>r)return i.setUint8(o,r),1;if(256>r)return i.setUint8(o,204),i.setUint8(o+1,r),2;if(65536>r)return i.setUint8(o,205),i.setUint16(o+1,r),3;if(4294967296>r)return i.setUint8(o,206),i.setUint32(o+1,r),5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return i.setInt8(o,r),1;if(r>=-128)return i.setUint8(o,208),i.setInt8(o+1,r),2;if(r>=-32768)return i.setUint8(o,209),i.setInt16(o+1,r),3;if(r>=-2147483648)return i.setUint8(o,210),i.setInt32(o+1,r),5;throw new Error(\"Number too small -0x\"+(-r).toString(16).substr(1))}if(null===r)return i.setUint8(o,192),1;if(\"boolean\"===a)return i.setUint8(o,r?195:194),1;if(\"object\"===a){var u,f=0,c=Array.isArray(r);if(c)u=r.length;else{var d=Object.keys(r);u=d.length}var f;if(16>u?(i.setUint8(o,u|(c?144:128)),f=1):65536>u?(i.setUint8(o,c?220:222),i.setUint16(o+1,u),f=3):4294967296>u&&(i.setUint8(o,c?221:223),i.setUint32(o+1,u),f=5),c)for(var l=0;u>l;l++)f+=e(r[l],i,o+f);else for(var l=0;u>l;l++){var v=d[l];f+=e(v,i,o+f),f+=e(r[v],i,o+f)}return f}throw new Error(\"Unknown type \"+a)}function i(r){var t=typeof r;if(\"string\"===t){var e=n(r);if(32>e)return 1+e;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(r instanceof Uint8Array){var e=r.byteLength;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(\"number\"===t){if(Math.floor(r)!==r)return 9;if(r>=0){if(128>r)return 1;if(256>r)return 2;if(65536>r)return 3;if(4294967296>r)return 5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return 1;if(r>=-128)return 2;if(r>=-32768)return 3;if(r>=-2147483648)return 5;throw new Error(\"Number too small -0x\"+r.toString(16).substr(1))}if(\"boolean\"===t||null===r)return 1;if(\"object\"===t){var e,o=0;if(Array.isArray(r)){e=r.length;for(var a=0;e>a;a++)o+=i(r[a])}else{var u=Object.keys(r);e=u.length;for(var a=0;e>a;a++){var s=u[a];o+=i(s)+i(r[s])}}if(16>e)return 1+o;if(65536>e)return 3+o;if(4294967296>e)return 5+o;throw new Error(\"Array or object too long 0x\"+e.toString(16))}throw new Error(\"Unknown type \"+t)}function o(r){var t=new ArrayBuffer(i(r)),n=new DataView(t);return e(r,n,0),new Uint8Array(t)}function a(r,t,n){return t?new r(t.buffer,t.byteOffset,t.byteLength/(n||1)):void 0}function u(r){return a(DataView,r)}function s(r){return a(Uint8Array,r)}function f(r){return a(Int8Array,r)}function c(r){return a(Int32Array,r,4)}function d(r){return a(Float32Array,r,4)}function l(r,t){var n=r.length/2;t||(t=new Int16Array(n));for(var e=0,i=0;n>e;++e,i+=2)t[e]=r[i]<<8^r[i+1]<<0;return t}function v(r,t){var n=r.length;t||(t=new Uint8Array(2*n));for(var e=u(t),i=0;n>i;++i)e.setInt16(2*i,r[i]);return s(t)}function g(r,t){var n=r.length/4;t||(t=new Int32Array(n));for(var e=0,i=0;n>e;++e,i+=4)t[e]=r[i]<<24^r[i+1]<<16^r[i+2]<<8^r[i+3]<<0;return t}function L(r,t){var n=r.length;t||(t=new Uint8Array(4*n));for(var e=u(t),i=0;n>i;++i)e.setInt32(4*i,r[i]);return s(t)}function h(r,t){var n=r.length;t||(t=new Float32Array(n/4));for(var e=u(t),i=u(r),o=0,a=0,s=n/4;s>o;++o,a+=4)e.setFloat32(a,i.getFloat32(a),!0);return t}function y(r,t,n){var e=r.length,i=1/t;n||(n=new Float32Array(e));for(var o=0;e>o;++o)n[o]=r[o]*i;return n}function m(r,t,n){var e=r.length;n||(n=new Int32Array(e));for(var i=0;e>i;++i)n[i]=Math.round(r[i]*t);return n}function p(r,t){var n,e;if(!t){var i=0;for(n=0,e=r.length;e>n;n+=2)i+=r[n+1];t=new r.constructor(i)}var o=0;for(n=0,e=r.length;e>n;n+=2)for(var a=r[n],u=r[n+1],s=0;u>s;++s)t[o]=a,++o;return t}function U(r){if(0===r.length)return new Int32Array;var t,n,e=2;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]&&(e+=2);var i=new Int32Array(e),o=0,a=1;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]?(i[o]=r[t-1],i[o+1]=a,a=1,o+=2):++a;return i[o]=r[r.length-1],i[o+1]=a,i}function b(r,t){var n=r.length;t||(t=new r.constructor(n)),n&&(t[0]=r[0]);for(var e=1;n>e;++e)t[e]=r[e]+t[e-1];return t}function I(r,t){var n=r.length;t||(t=new r.constructor(n)),t[0]=r[0];for(var e=1;n>e;++e)t[e]=r[e]-r[e-1];return t}function w(r,t){var n,e,i=r instanceof Int8Array?127:32767,o=-i-1,a=r.length;if(!t){var u=0;for(n=0;a>n;++n)r[n]o&&++u;t=new Int32Array(u)}for(n=0,e=0;a>n;){for(var s=0;r[n]===i||r[n]===o;)s+=r[n],++n;s+=r[n],++n,t[e]=s,++e}return t}function C(r,t){var n,e=t?127:32767,i=-e-1,o=r.length,a=0;for(n=0;o>n;++n){var u=r[n];0===u?++a:a+=u===e||u===i?2:u>0?Math.ceil(u/e):Math.ceil(u/i)}var s=t?new Int8Array(a):new Int16Array(a),f=0;for(n=0;o>n;++n){var u=r[n];if(u>=0)for(;u>=e;)s[f]=e,++f,u-=e;else for(;i>=u;)s[f]=i,++f,u-=i;s[f]=u,++f}return s}function A(r,t){return b(p(r),t)}function x(r){return U(I(r))}function M(r,t,n){return y(p(r,c(n)),t,n)}function F(r,t){return U(m(r,t))}function S(r,t,n){return y(b(r,c(n)),t,n)}function E(r,t,n){return I(m(r,t),n)}function N(r,t,n){return y(w(r,c(n)),t,n)}function O(r,t,n){var e=w(r,c(n));return S(e,t,d(e))}function T(r,t,n){return C(E(r,t),n)}function k(r){var t=u(r),n=t.getInt32(0),e=t.getInt32(4),i=r.subarray(8,12),r=r.subarray(12);return[n,r,e,i]}function j(r,t,n,e){var i=new ArrayBuffer(12+e.byteLength),o=new Uint8Array(i),a=new DataView(i);return a.setInt32(0,r),a.setInt32(4,t),n&&o.set(n,8),o.set(e,12),o}function q(r){var t=r.length,n=s(r);return j(2,t,void 0,n)}function D(r){var t=r.length,n=L(r);return j(4,t,void 0,n)}function P(r,t){var n=r.length/t,e=L([t]),i=s(r);return j(5,n,e,i)}function z(r){var t=r.length,n=L(U(r));return j(6,t,void 0,n)}function B(r){var t=r.length,n=L(x(r));return j(8,t,void 0,n)}function V(r,t){var n=r.length,e=L([t]),i=L(F(r,t));return j(9,n,e,i)}function G(r,t){var n=r.length,e=L([t]),i=v(T(r,t));return j(10,n,e,i)}function R(r){var t={};return rr.forEach(function(n){void 0!==r[n]&&(t[n]=r[n])}),r.bondAtomList&&(t.bondAtomList=D(r.bondAtomList)),r.bondOrderList&&(t.bondOrderList=q(r.bondOrderList)),t.xCoordList=G(r.xCoordList,1e3),t.yCoordList=G(r.yCoordList,1e3),t.zCoordList=G(r.zCoordList,1e3),r.bFactorList&&(t.bFactorList=G(r.bFactorList,100)),r.atomIdList&&(t.atomIdList=B(r.atomIdList)),r.altLocList&&(t.altLocList=z(r.altLocList)),r.occupancyList&&(t.occupancyList=V(r.occupancyList,100)),t.groupIdList=B(r.groupIdList),t.groupTypeList=D(r.groupTypeList),r.secStructList&&(t.secStructList=q(r.secStructList,1)),r.insCodeList&&(t.insCodeList=z(r.insCodeList)),r.sequenceIndexList&&(t.sequenceIndexList=B(r.sequenceIndexList)),t.chainIdList=P(r.chainIdList,4),r.chainNameList&&(t.chainNameList=P(r.chainNameList,4)),t}function H(r){function t(r){for(var t={},n=0;r>n;n++){var e=o();t[e]=o()}return t}function n(t){var n=r.subarray(a,a+t);return a+=t,n}function e(t){var n=r.subarray(a,a+t);a+=t;var e=65535;if(t>e){for(var i=[],o=0;on;n++)t[n]=o();return t}function o(){var o,s,f=r[a];if(0===(128&f))return a++,f;if(128===(240&f))return s=15&f,a++,t(s);if(144===(240&f))return s=15&f,a++,i(s);if(160===(224&f))return s=31&f,a++,e(s);if(224===(224&f))return o=u.getInt8(a),a++,o;switch(f){case 192:return a++,null;case 194:return a++,!1;case 195:return a++,!0;case 196:return s=u.getUint8(a+1),a+=2,n(s);case 197:return s=u.getUint16(a+1),a+=3,n(s);case 198:return s=u.getUint32(a+1),a+=5,n(s);case 202:return o=u.getFloat32(a+1),a+=5,o;case 203:return o=u.getFloat64(a+1),a+=9,o;case 204:return o=r[a+1],a+=2,o;case 205:return o=u.getUint16(a+1),a+=3,o;case 206:return o=u.getUint32(a+1),a+=5,o;case 208:return o=u.getInt8(a+1),a+=2,o;case 209:return o=u.getInt16(a+1),a+=3,o;case 210:return o=u.getInt32(a+1),a+=5,o;case 217:return s=u.getUint8(a+1),a+=2,e(s);case 218:return s=u.getUint16(a+1),a+=3,e(s);case 219:return s=u.getUint32(a+1),a+=5,e(s);case 220:return s=u.getUint16(a+1),a+=3,i(s);case 221:return s=u.getUint32(a+1),a+=5,i(s);case 222:return s=u.getUint16(a+1),a+=3,t(s);case 223:return s=u.getUint32(a+1),a+=5,t(s)}throw new Error(\"Unknown type 0x\"+f.toString(16))}var a=0,u=new DataView(r.buffer);return o()}function W(r,t,n,e){switch(r){case 1:return h(t);case 2:return f(t);case 3:return l(t);case 4:return g(t);case 5:return s(t);case 6:return p(g(t),new Uint8Array(n));case 7:return p(g(t));case 8:return A(g(t));case 9:return M(g(t),g(e)[0]);case 10:return O(l(t),g(e)[0]);case 11:return y(l(t),g(e)[0]);case 12:return N(l(t),g(e)[0]);case 13:return N(f(t),g(e)[0]);case 14:return w(l(t));case 15:return w(f(t))}}function X(r,t){t=t||{};var n=t.ignoreFields,e={};return nr.forEach(function(t){var i=n?-1!==n.indexOf(t):!1,o=r[t];i||void 0===o||(o instanceof Uint8Array?e[t]=W.apply(null,k(o)):e[t]=o)}),e}function J(r){return String.fromCharCode.apply(null,r).replace(/\\0/g,\"\")}function K(r,t,n){n=n||{};var e,i,o,a,u,s,f=n.firstModelOnly,c=t.onModel,d=t.onChain,l=t.onGroup,v=t.onAtom,g=t.onBond,L=0,h=0,y=0,m=0,p=0,U=-1,b=r.chainNameList,I=r.secStructList,w=r.insCodeList,C=r.sequenceIndexList,A=r.atomIdList,x=r.bFactorList,M=r.altLocList,F=r.occupancyList,S=r.bondAtomList,E=r.bondOrderList;for(e=0,i=r.chainsPerModel.length;i>e&&!(f&&L>0);++e){var N=r.chainsPerModel[L];for(c&&c({chainCount:N,modelIndex:L}),o=0;N>o;++o){var O=r.groupsPerChain[h];if(d){var T=J(r.chainIdList.subarray(4*h,4*h+4)),k=null;b&&(k=J(b.subarray(4*h,4*h+4))),d({groupCount:O,chainIndex:h,modelIndex:L,chainId:T,chainName:k})}for(a=0;O>a;++a){var j=r.groupList[r.groupTypeList[y]],q=j.atomNameList.length;if(l){var D=null;I&&(D=I[y]);var P=null;r.insCodeList&&(P=String.fromCharCode(w[y]));var z=null;C&&(z=C[y]),l({atomCount:q,groupIndex:y,chainIndex:h,modelIndex:L,groupId:r.groupIdList[y],groupType:r.groupTypeList[y],groupName:j.groupName,singleLetterCode:j.singleLetterCode,chemCompType:j.chemCompType,secStruct:D,insCode:P,sequenceIndex:z})}for(u=0;q>u;++u){if(v){var B=null;A&&(B=A[m]);var V=null;x&&(V=x[m]);var G=null;M&&(G=String.fromCharCode(M[m]));var R=null;F&&(R=F[m]),v({atomIndex:m,groupIndex:y,chainIndex:h,modelIndex:L,atomId:B,element:j.elementList[u],atomName:j.atomNameList[u],formalCharge:j.formalChargeList[u],xCoord:r.xCoordList[m],yCoord:r.yCoordList[m],zCoord:r.zCoordList[m],bFactor:V,altLoc:G,occupancy:R})}m+=1}if(g){var H=j.bondAtomList;for(u=0,s=j.bondOrderList.length;s>u;++u)g({atomIndex1:m-q+H[2*u],atomIndex2:m-q+H[2*u+1],bondOrder:j.bondOrderList[u]})}y+=1}h+=1}if(p=U+1,U=m-1,g&&S)for(u=0,s=S.length;s>u;u+=2){var W=S[u],X=S[u+1];(W>=p&&U>=W||X>=p&&U>=X)&&g({atomIndex1:W,atomIndex2:X,bondOrder:E?E[u/2]:null})}L+=1}}function Q(r){return o(R(r))}function Y(r,t){r instanceof ArrayBuffer&&(r=new Uint8Array(r));var n;return n=r instanceof Uint8Array?H(r):r,X(n,t)}function Z(r,t,n,e){function i(){try{var r=Y(o.response);n(r)}catch(t){e(t)}}var o=new XMLHttpRequest;o.addEventListener(\"load\",i,!0),o.addEventListener(\"error\",e,!0),o.responseType=\"arraybuffer\",o.open(\"GET\",t+r.toUpperCase()),o.send()}function $(r,t,n){Z(r,or,t,n)}function _(r,t,n){Z(r,ar,t,n)}var rr=[\"mmtfVersion\",\"mmtfProducer\",\"unitCell\",\"spaceGroup\",\"structureId\",\"title\",\"depositionDate\",\"releaseDate\",\"experimentalMethods\",\"resolution\",\"rFree\",\"rWork\",\"bioAssemblyList\",\"ncsOperatorList\",\"entityList\",\"groupList\",\"numBonds\",\"numAtoms\",\"numGroups\",\"numChains\",\"numModels\",\"groupsPerChain\",\"chainsPerModel\"],tr=[\"xCoordList\",\"yCoordList\",\"zCoordList\",\"groupIdList\",\"groupTypeList\",\"chainIdList\",\"bFactorList\",\"atomIdList\",\"altLocList\",\"occupancyList\",\"secStructList\",\"insCodeList\",\"sequenceIndexList\",\"chainNameList\",\"bondAtomList\",\"bondOrderList\"],nr=rr.concat(tr),er=\"v1.1.0dev\",ir=\"//mmtf.rcsb.org/v1.0/\",or=ir+\"full/\",ar=ir+\"reduced/\";r.encode=Q,r.decode=Y,r.traverse=K,r.fetch=$,r.fetchReduced=_,r.version=er,r.fetchUrl=or,r.fetchReducedUrl=ar,r.encodeMsgpack=o,r.encodeMmtf=R,r.decodeMsgpack=H,r.decodeMmtf=X});","module.exports = __WEBPACK_EXTERNAL_MODULE__535__;","module.exports = __WEBPACK_EXTERNAL_MODULE__698__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar defaults = {\n lines: 12,\n length: 7,\n width: 5,\n radius: 10,\n scale: 1.0,\n corners: 1,\n color: '#000',\n fadeColor: 'transparent',\n animation: 'spinner-line-fade-default',\n rotate: 0,\n direction: 1,\n speed: 1,\n zIndex: 2e9,\n className: 'spinner',\n top: '50%',\n left: '50%',\n shadow: '0 0 1px transparent', // prevent aliased lines\n position: 'absolute',\n};\nvar Spinner = /** @class */ (function () {\n function Spinner(opts) {\n if (opts === void 0) { opts = {}; }\n this.opts = __assign(__assign({}, defaults), opts);\n }\n /**\n * Adds the spinner to the given target element. If this instance is already\n * spinning, it is automatically removed from its previous target by calling\n * stop() internally.\n */\n Spinner.prototype.spin = function (target) {\n this.stop();\n this.el = document.createElement('div');\n this.el.className = this.opts.className;\n this.el.setAttribute('role', 'progressbar');\n this.el.style.position = this.opts.position;\n this.el.style.width = \"0\";\n this.el.style.zIndex = this.opts.zIndex.toString();\n this.el.style.left = this.opts.left;\n this.el.style.top = this.opts.top;\n this.el.style.transform = \"scale(\".concat(this.opts.scale, \")\");\n if (target) {\n target.insertBefore(this.el, target.firstChild || null);\n }\n drawLines(this.el, this.opts);\n return this;\n };\n /**\n * Stops and removes the Spinner.\n * Stopped spinners may be reused by calling spin() again.\n */\n Spinner.prototype.stop = function () {\n if (this.el) {\n if (this.el.parentNode) {\n this.el.parentNode.removeChild(this.el);\n }\n this.el = undefined;\n }\n return this;\n };\n return Spinner;\n}());\nexport { Spinner };\n/**\n * Returns the line color from the given string or array.\n */\nfunction getColor(color, idx) {\n return typeof color == 'string' ? color : color[idx % color.length];\n}\n/**\n * Internal method that draws the individual lines.\n */\nfunction drawLines(el, opts) {\n var borderRadius = (Math.round(opts.corners * opts.width * 500) / 1000) + 'px';\n var shadow = 'none';\n if (opts.shadow === true) {\n shadow = '0 2px 4px #000'; // default shadow\n }\n else if (typeof opts.shadow === 'string') {\n shadow = opts.shadow;\n }\n var shadows = parseBoxShadow(shadow);\n for (var i = 0; i < opts.lines; i++) {\n var degrees = ~~(360 / opts.lines * i + opts.rotate);\n var backgroundLine = document.createElement('div');\n backgroundLine.style.position = 'absolute';\n backgroundLine.style.top = \"\".concat(-opts.width / 2, \"px\");\n backgroundLine.style.width = (opts.length + opts.width) + 'px';\n backgroundLine.style.height = opts.width + 'px';\n backgroundLine.style.background = getColor(opts.fadeColor, i);\n backgroundLine.style.borderRadius = borderRadius;\n backgroundLine.style.transformOrigin = 'left';\n backgroundLine.style.transform = \"rotate(\".concat(degrees, \"deg) translateX(\").concat(opts.radius, \"px)\");\n var delay = i * opts.direction / opts.lines / opts.speed;\n delay -= 1 / opts.speed; // so initial animation state will include trail\n var line = document.createElement('div');\n line.style.width = '100%';\n line.style.height = '100%';\n line.style.background = getColor(opts.color, i);\n line.style.borderRadius = borderRadius;\n line.style.boxShadow = normalizeShadow(shadows, degrees);\n line.style.animation = \"\".concat(1 / opts.speed, \"s linear \").concat(delay, \"s infinite \").concat(opts.animation);\n backgroundLine.appendChild(line);\n el.appendChild(backgroundLine);\n }\n}\nfunction parseBoxShadow(boxShadow) {\n var regex = /^\\s*([a-zA-Z]+\\s+)?(-?\\d+(\\.\\d+)?)([a-zA-Z]*)\\s+(-?\\d+(\\.\\d+)?)([a-zA-Z]*)(.*)$/;\n var shadows = [];\n for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) {\n var shadow = _a[_i];\n var matches = shadow.match(regex);\n if (matches === null) {\n continue; // invalid syntax\n }\n var x = +matches[2];\n var y = +matches[5];\n var xUnits = matches[4];\n var yUnits = matches[7];\n if (x === 0 && !xUnits) {\n xUnits = yUnits;\n }\n if (y === 0 && !yUnits) {\n yUnits = xUnits;\n }\n if (xUnits !== yUnits) {\n continue; // units must match to use as coordinates\n }\n shadows.push({\n prefix: matches[1] || '', // could have value of 'inset' or undefined\n x: x,\n y: y,\n xUnits: xUnits,\n yUnits: yUnits,\n end: matches[8],\n });\n }\n return shadows;\n}\n/**\n * Modify box-shadow x/y offsets to counteract rotation\n */\nfunction normalizeShadow(shadows, degrees) {\n var normalized = [];\n for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) {\n var shadow = shadows_1[_i];\n var xy = convertOffset(shadow.x, shadow.y, degrees);\n normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end);\n }\n return normalized.join(', ');\n}\nfunction convertOffset(x, y, degrees) {\n var radians = degrees * Math.PI / 180;\n var sin = Math.sin(radians);\n var cos = Math.cos(radians);\n return [\n Math.round((x * cos + y * sin) * 1000) / 1000,\n Math.round((-x * sin + y * cos) * 1000) / 1000,\n ];\n}\n","//----------------------------------------------------------------------------\r\n// Timer\r\n\r\nexport default class Timer {\r\n constructor() {\r\n this.startTime = 0;\r\n this.oldTime = 0;\r\n this.elapsedTime = 0;\r\n this.running = false;\r\n }\r\n\r\n start() {\r\n this.startTime = Timer.now();\r\n this.oldTime = this.startTime;\r\n this.running = true;\r\n }\r\n\r\n stop() {\r\n this.getElapsedTime();\r\n this.running = false;\r\n }\r\n\r\n getElapsedTime() {\r\n this.update();\r\n return this.elapsedTime;\r\n }\r\n\r\n update() {\r\n let delta = 0;\r\n if (this.running) {\r\n const newTime = Timer.now();\r\n delta = 0.001 * (newTime - this.oldTime);\r\n this.oldTime = newTime;\r\n this.elapsedTime += delta;\r\n }\r\n\r\n return delta;\r\n }\r\n}\r\n\r\nTimer.now = (function () {\r\n const p = typeof window !== 'undefined' && window.performance;\r\n return (p && p.now) ? p.now.bind(p) : Date.now;\r\n}());\r\n","import Timer from '../Timer';\r\n\r\nconst { now } = Timer;\r\n\r\nfunction createElement(tag, id, css) {\r\n const element = document.createElement(tag);\r\n element.id = id;\r\n element.style.cssText = css;\r\n return element;\r\n}\r\n\r\nclass Stats {\r\n constructor() {\r\n this.domElement = createElement('div', 'stats', 'padding:8px');\r\n this._text = createElement('p', 'fps', 'margin:0;color:silver;font-size:large');\r\n this.domElement.appendChild(this._text);\r\n\r\n this._startTime = now();\r\n this._prevTime = this._startTime;\r\n\r\n this._deltas = new Array(20);\r\n this._index = 0;\r\n this._total = 0.0;\r\n this._count = 0;\r\n }\r\n\r\n end() {\r\n const time = now();\r\n const delta = time - this._startTime;\r\n\r\n if (this._count < this._deltas.length) {\r\n this._count++;\r\n } else {\r\n this._total -= this._deltas[this._index];\r\n }\r\n this._total += delta;\r\n this._deltas[this._index] = delta;\r\n this._index = (this._index + 1) % this._deltas.length;\r\n\r\n this.ms = this._total / this._count;\r\n this.fps = 1000 / this.ms;\r\n\r\n if (time > this._prevTime + 1000) {\r\n this._text.textContent = this.fps.toPrecision(2);\r\n this._prevTime = time;\r\n }\r\n\r\n return time;\r\n }\r\n\r\n update() {\r\n this._startTime = this.end();\r\n }\r\n\r\n show(on) {\r\n if (on === undefined) {\r\n on = true;\r\n }\r\n this.domElement.style.display = on ? 'block' : 'none';\r\n }\r\n}\r\n\r\nexport default Stats;\r\n","/**\r\n * This class introduces the simplest event system.\r\n */\r\n\r\nimport _ from 'lodash';\r\n\r\nfunction isUndefOrEqual(param, value) {\r\n return !param || param === value;\r\n}\r\n\r\n/**\r\n * Creates empty dispatcher.\r\n *\r\n * @exports EventDispatcher\r\n * @constructor\r\n */\r\nfunction EventDispatcher() {\r\n this._handlers = {};\r\n}\r\n\r\n/**\r\n * Binds callback on specific event type. Optional `context` parameter\r\n * could be used as 'this' for the `callback`.\r\n * @param {string} type Event name.\r\n * @param {function} callback Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.addEventListener = function (type, callback, context) {\r\n let handlers = this._handlers[type];\r\n\r\n if (!handlers) {\r\n this._handlers[type] = [];\r\n handlers = this._handlers[type];\r\n }\r\n\r\n const params = [callback, context];\r\n function _checkPar(par) {\r\n return par[0] === params[0] && par[1] === params[1];\r\n }\r\n\r\n if (_.find(handlers, _checkPar) === undefined) {\r\n handlers.push(params);\r\n }\r\n};\r\n\r\n/**\r\n * Removes a previously-bound callback function from an object.\r\n * If no `context` is specified, all versions of the `callback` with different\r\n * contexts will be removed.\r\n * If no `callback` is specified, all callbacks of the `type` will be removed.\r\n * If no `type` is specified, callbacks for all events will be removed.\r\n * @param {?string} [type] Event type.\r\n * @param {function} [callback] Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.removeEventListener = function (type, callback, context) {\r\n const self = this;\r\n _.forEach(self._handlers, (handler, ev) => {\r\n _.remove(handler, (values) => isUndefOrEqual(type, ev)\r\n && isUndefOrEqual(callback, values[0])\r\n && isUndefOrEqual(context, values[1] || self));\r\n });\r\n\r\n this._handlers = _.omitBy(self._handlers, (handler) => handler.length === 0);\r\n};\r\n\r\n/**\r\n * Makes all the callbacks for the specific `event` to trigger.\r\n * @param {Object} event Event.\r\n * @param {string} event.type Type of the event.\r\n */\r\nEventDispatcher.prototype.dispatchEvent = function (event) {\r\n const self = this;\r\n\r\n _.forEach(this._handlers[event.type], (callback) => {\r\n const context = callback[1] || self;\r\n callback[0].apply(context, [event]);\r\n });\r\n};\r\n\r\nexport default EventDispatcher;\r\n","/**\r\n * This module contains class for logging.\r\n * Returns an instance of a logger that have already been created.\r\n * Allows users to log messages for five different levels,\r\n * enable console output and catch signal on each message.\r\n */\r\nimport _ from 'lodash';\r\nimport EventDispatcher from './EventDispatcher';\r\n\r\nconst priorities = {\r\n debug: 0,\r\n info: 1,\r\n report: 2,\r\n warn: 3,\r\n error: 4,\r\n};\r\n\r\n/**\r\n * Create new Logger.\r\n *\r\n * @exports Logger\r\n * @extends EventDispatcher\r\n * @constructor\r\n */\r\nfunction Logger() {\r\n EventDispatcher.call(this);\r\n /** Boolean flag that toggles output to browser console.\r\n * @type {boolean}\r\n */\r\n this.console = false;\r\n this._priority = priorities.warn;\r\n}\r\n\r\nLogger.prototype = Object.create(EventDispatcher.prototype);\r\nLogger.prototype.constructor = Logger;\r\n\r\n/**\r\n * Create new clean instance of the logger.\r\n * @returns {Logger}\r\n */\r\nLogger.prototype.instantiate = function () {\r\n return new Logger();\r\n};\r\n\r\nfunction verify(number) {\r\n if (!_.isNumber(number)) {\r\n throw new Error('Wrong log level specified!');\r\n }\r\n return number;\r\n}\r\n\r\n/**\r\n * @property {string} current threshold for signals and console output.\r\n * @name Logger#level\r\n */\r\nObject.defineProperty(Logger.prototype, 'level', {\r\n get() {\r\n return _.findKey(priorities, (value) => value === this._priority);\r\n },\r\n set(level) {\r\n this._priority = verify(priorities[level]);\r\n },\r\n});\r\n\r\n/**\r\n * Returns the list of all possible level values.\r\n * @returns {Array}\r\n */\r\nLogger.prototype.levels = function () {\r\n return Object.keys(priorities);\r\n};\r\n\r\n/**\r\n * Add new message with specified level.\r\n * @param {string} level - level of the message, must be one of the\r\n * {'debug' | 'info' | 'report' | 'warn' | 'error'}\r\n * @param {string} message\r\n */\r\nLogger.prototype.message = function (level, message) {\r\n const priority = verify(priorities[level]);\r\n this._message(priority, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('debug', ...);\r\n * @param message\r\n */\r\nLogger.prototype.debug = function (message) {\r\n this._message(priorities.debug, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('info', ...);\r\n * @param message\r\n */\r\nLogger.prototype.info = function (message) {\r\n this._message(priorities.info, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('report', ...);\r\n * @param message\r\n */\r\nLogger.prototype.report = function (message) {\r\n this._message(priorities.report, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('warn', ...);\r\n * @param message\r\n */\r\nLogger.prototype.warn = function (message) {\r\n this._message(priorities.warn, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('error', ...);\r\n * @param message\r\n */\r\nLogger.prototype.error = function (message) {\r\n this._message(priorities.error, message);\r\n};\r\n\r\n/**\r\n * Add new message with specified priority.\r\n * @param {number} priority - priority of the message\r\n * @param {string} message\r\n * @private\r\n */\r\nLogger.prototype._message = function (priority, message) {\r\n if (priority < this._priority) {\r\n return;\r\n }\r\n const level = _.findKey(priorities, (value) => value === priority);\r\n message = String(message);\r\n if (this.console) {\r\n const output = `miew:${level}: ${message}`;\r\n if (level === 'error') {\r\n console.error(output); // NOSONAR\r\n } else if (level === 'warn') {\r\n console.warn(output); // NOSONAR\r\n } else {\r\n console.log(output); // NOSONAR\r\n }\r\n }\r\n this.dispatchEvent({ type: 'message', level, message });\r\n};\r\n\r\nexport default new Logger();\r\n","import _ from 'lodash';\r\nimport logger from './utils/logger';\r\n\r\nconst browserType = {\r\n DEFAULT: 0,\r\n SAFARI: 1,\r\n};\r\n//----------------------------------------------------------------------------\r\n// Query string\r\n\r\n/**\r\n * Escape only dangerous chars in a query string component, use a plus instead of a space.\r\n *\r\n * [RFC 3986](https://tools.ietf.org/html/rfc3986) allows the following chars in the query (see 3.4):\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! $ & ' ( ) * + , ; = : @ / ?\r\n *\r\n * For query string elements we need to escape ampersand, equal sign, and plus,\r\n * but encodeURIComponent() function encodes anything except for the following:\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! ' ( ) *\r\n *\r\n * @param {string} text - key or value to encode\r\n * @param {string} excludeExp - regexp for symbols to exclude from encoding\r\n * @returns {string} encoded string\r\n */\r\nfunction encodeQueryComponent(text, excludeExp) {\r\n const encode = (code) => String.fromCharCode(parseInt(code.substr(1), 16));\r\n return encodeURIComponent(text).replace(excludeExp, encode).replace(/%20/g, '+');\r\n}\r\n\r\n/**\r\n * Unescape dangerous chars in a query string component.\r\n *\r\n * @param {string} text - encoded key or value\r\n * @returns {string} decoded string\r\n * @see {@link encodeQueryComponent}\r\n */\r\nfunction decodeQueryComponent(text) {\r\n return decodeURIComponent(text.replace(/\\+/g, ' '));\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Array} array of (key, value) pairs.\r\n */\r\nfunction getUrlParameters(url) {\r\n url = url || window.location.search;\r\n\r\n const query = url.substring(url.indexOf('?') + 1);\r\n const search = /([^&=]+)=?([^&]*)/g;\r\n const result = [];\r\n let match;\r\n\r\n while ((match = search.exec(query)) !== null) { // eslint-disable-line no-cond-assign\r\n result.push([decodeQueryComponent(match[1]), decodeQueryComponent(match[2])]);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters as a hash.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Object}\r\n */\r\nfunction getUrlParametersAsDict(url) {\r\n const result = {};\r\n const a = getUrlParameters(url);\r\n for (let i = 0; i < a.length; ++i) {\r\n const [key, value] = a[i];\r\n result[key] = value;\r\n }\r\n return result;\r\n}\r\n\r\nfunction resolveURL(str) {\r\n if (typeof URL !== 'undefined') {\r\n try {\r\n if (typeof window !== 'undefined') {\r\n return new URL(str, window.location).href;\r\n }\r\n return new URL(str).href;\r\n } catch (error) {\r\n // IE 11 has a URL object with no constructor available so just try a different approach instead\r\n }\r\n }\r\n if (typeof document !== 'undefined') {\r\n const anchor = document.createElement('a');\r\n anchor.href = str;\r\n return anchor.href;\r\n }\r\n return str;\r\n}\r\n\r\n/**\r\n * Generates regular expression object that includes all symbols\r\n * listed in the argument\r\n * @param symbolStr {string} - String containing characters list.\r\n * @returns {RegExp} - Regular expression.\r\n */\r\nfunction generateRegExp(symbolStr) {\r\n const symbolList = [];\r\n\r\n for (let i = 0, n = symbolStr.length; i < n; ++i) {\r\n symbolList[symbolList.length] = symbolStr[i].charCodeAt(0).toString(16);\r\n }\r\n\r\n const listStr = symbolList.join('|');\r\n\r\n return new RegExp(`%(?:${listStr})`, 'gi');\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Create HTML element\r\n\r\nfunction createElement(tag, attrs, content) {\r\n const element = document.createElement(tag);\r\n let i;\r\n let n;\r\n if (attrs) {\r\n const keys = Object.keys(attrs);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n element.setAttribute(key, attrs[key]);\r\n }\r\n }\r\n if (content) {\r\n if (!(content instanceof Array)) {\r\n content = [content];\r\n }\r\n for (i = 0, n = content.length; i < n; ++i) {\r\n const child = content[i];\r\n if (typeof child === 'string') {\r\n element.appendChild(document.createTextNode(child));\r\n } else if (child instanceof HTMLElement) {\r\n element.appendChild(child);\r\n }\r\n }\r\n }\r\n return element;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Easy inheritance\r\n\r\n/**\r\n * Derive the class from the base.\r\n * @param cls {function} - Class (constructor) to derive.\r\n * @param base {function} - Class (constructor) to derive from.\r\n * @param members {object=} - Optional instance members to add.\r\n * @param statics {object=} - Optional static class members to add.\r\n * @returns {function} Original class.\r\n */\r\nfunction deriveClass(cls, base, members, statics) {\r\n cls.prototype = _.assign(Object.create(base.prototype), { constructor: cls }, members);\r\n if (statics) {\r\n _.assign(cls, statics);\r\n }\r\n return cls;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Deep prototyping\r\n\r\nfunction deriveDeep(obj, needZeroOwnProperties) {\r\n let res = obj;\r\n let i;\r\n let n;\r\n if (obj instanceof Array) {\r\n res = new Array(obj.length);\r\n for (i = 0, n = obj.length; i < n; ++i) {\r\n res[i] = deriveDeep(obj[i]);\r\n }\r\n } else if (obj instanceof Object) {\r\n res = Object.create(obj);\r\n const keys = Object.keys(obj);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = obj[key];\r\n const copy = deriveDeep(value);\r\n if (copy !== value) {\r\n res[key] = copy;\r\n }\r\n }\r\n if (needZeroOwnProperties && Object.keys(res).length > 0) {\r\n res = Object.create(res);\r\n }\r\n }\r\n return res;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Colors\r\n\r\nfunction hexColor(color) {\r\n const hex = (`0000000${color.toString(16)}`).substr(-6);\r\n return `#${hex}`;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Debug tracing\r\n\r\nfunction DebugTracer(namespace) {\r\n let enabled = false;\r\n\r\n this.enable = function (on) {\r\n enabled = on;\r\n };\r\n\r\n let indent = 0;\r\n const methods = Object.keys(namespace);\r\n\r\n function wrap(method_, name_) {\r\n return function (...args) {\r\n const spaces = DebugTracer.spaces.substr(0, indent * 2);\r\n if (enabled) {\r\n logger.debug(`${spaces + name_} {`);\r\n }\r\n indent++;\r\n const result = method_.apply(this, args); // eslint-disable-line no-invalid-this\r\n indent--;\r\n if (enabled) {\r\n logger.debug(`${spaces}} // ${name_}`);\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n for (let i = 0, n = methods.length; i < n; ++i) {\r\n const name = methods[i];\r\n const method = namespace[name];\r\n if (method instanceof Function && name !== 'constructor') {\r\n namespace[name] = wrap(method, name);\r\n }\r\n }\r\n}\r\n\r\nDebugTracer.spaces = ' ';\r\n\r\nclass OutOfMemoryError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'OutOfMemoryError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction allocateTyped(TypedArrayName, size) {\r\n let result = null;\r\n try {\r\n result = new TypedArrayName(size);\r\n } catch (e) {\r\n if (e instanceof RangeError) {\r\n throw new OutOfMemoryError(e.message);\r\n } else {\r\n throw e;\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Float array conversion\r\n\r\nfunction bytesToBase64(/** ArrayBuffer */ buffer) {\r\n const bytes = new Uint8Array(buffer);\r\n let binary = '';\r\n for (let i = 0; i < bytes.byteLength; i++) {\r\n binary += String.fromCharCode(bytes[i]);\r\n }\r\n return window.btoa(binary);\r\n}\r\n\r\nfunction bytesFromBase64(/** string */ str) {\r\n const binary = window.atob(str);\r\n const bytes = new Uint8Array(binary.length);\r\n for (let i = 0; i < bytes.length; ++i) {\r\n bytes[i] = binary[i].charCodeAt(0);\r\n }\r\n return bytes.buffer;\r\n}\r\n\r\nfunction arrayToBase64(/** number[] */ array, /** function */ TypedArrayClass) {\r\n return bytesToBase64(new TypedArrayClass(array).buffer);\r\n}\r\n\r\nfunction arrayFromBase64(/** string */ str, /** function */ TypedArrayClass) {\r\n return Array.prototype.slice.call(new TypedArrayClass(bytesFromBase64(str)));\r\n}\r\n\r\n// NOTE: this is 1-level comparison\r\nfunction compareOptionsWithDefaults(opts, defOpts) {\r\n const optsStr = [];\r\n if (defOpts && opts) {\r\n const keys = Object.keys(opts);\r\n for (let p = 0; p < keys.length; ++p) {\r\n const key = keys[p];\r\n const value = opts[key];\r\n // TODO add processing for tree structure\r\n if (!(value instanceof Object) && typeof defOpts[key] !== 'undefined' && defOpts[key] !== value) {\r\n optsStr.push(`${key}:${value}`);\r\n }\r\n }\r\n if (optsStr.length > 0) {\r\n return `!${optsStr.join()}`;\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nfunction isAlmostPlainObject(o) {\r\n if (_.isPlainObject(o)) {\r\n return true;\r\n }\r\n const proto = o && Object.getPrototypeOf(o);\r\n return !!proto && !proto.hasOwnProperty('constructor') && isAlmostPlainObject(proto);\r\n}\r\n\r\n/**\r\n * Build an object that contains properties (and subproperties) of `src` different from those\r\n * in `dst`. Objects are parsed recursively, other values (including arrays) are compared for\r\n * equality using `_.isEqual()`.\r\n * @param {!object} src - a new object to compare, may contain changed or new properties\r\n * @param {!object} dst - an old reference object\r\n */\r\nfunction objectsDiff(src, dst) {\r\n const diff = {};\r\n _.forIn(src, (srcValue, key) => {\r\n const dstValue = dst[key];\r\n if (isAlmostPlainObject(srcValue) && isAlmostPlainObject(dstValue)) {\r\n const deepDiff = objectsDiff(srcValue, dstValue);\r\n if (!_.isEmpty(deepDiff)) {\r\n diff[key] = deepDiff;\r\n }\r\n } else if (!_.isEqual(srcValue, dstValue)) {\r\n diff[key] = srcValue;\r\n }\r\n });\r\n return diff;\r\n}\r\n\r\nfunction forInRecursive(object, callback) {\r\n function iterateThrough(obj, prefix) {\r\n _.forIn(obj, (value, key) => {\r\n const newPref = prefix + (prefix.length > 0 ? '.' : '');\r\n if (value instanceof Object) {\r\n iterateThrough(value, newPref + key);\r\n } else if (value !== undefined) {\r\n callback(value, newPref + key);\r\n }\r\n });\r\n }\r\n iterateThrough(object, '');\r\n}\r\n\r\nfunction enquoteString(value) {\r\n if (_.isString(value)) {\r\n return `\"${value.replace(/\"/g, '\\\\\"')}\"`;\r\n }\r\n return value;\r\n}\r\n\r\nfunction unquoteString(value) {\r\n if (!_.isString(value)) {\r\n return value;\r\n }\r\n if (value[0] === '\"' && value[value.length - 1] === '\"') {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\\"/g, '\"');\r\n }\r\n if (value[0] === \"'\" && value[value.length - 1] === \"'\") {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\'/g, \"'\");\r\n }\r\n throw new SyntaxError('Incorrect string format, can\\'t unqute it');\r\n}\r\n\r\nfunction getFileExtension(fileName) {\r\n return fileName.slice((Math.max(0, fileName.lastIndexOf('.')) || Infinity));\r\n}\r\n\r\nfunction splitFileName(fileName) {\r\n const ext = getFileExtension(fileName);\r\n const name = fileName.slice(0, fileName.length - ext.length);\r\n return [name, ext];\r\n}\r\n\r\nfunction dataUrlToBlob(url) {\r\n const parts = url.split(/[:;,]/);\r\n const partsCount = parts.length;\r\n if (partsCount >= 3 && parts[partsCount - 2] === 'base64') {\r\n return new Blob([bytesFromBase64(parts[partsCount - 1])]);\r\n }\r\n return null;\r\n}\r\n\r\nfunction getBrowser() {\r\n if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1\r\n && navigator.userAgent\r\n && navigator.userAgent.indexOf('CriOS') === -1\r\n && navigator.userAgent.indexOf('FxiOS') === -1) {\r\n return browserType.SAFARI;\r\n }\r\n return browserType.DEFAULT;\r\n}\r\n\r\nfunction shotOpen(url) {\r\n if (typeof window !== 'undefined') {\r\n window.open().document.write(``);\r\n }\r\n}\r\n\r\nfunction shotDownload(dataUrl, filename) {\r\n if (!dataUrl || dataUrl.substr(0, 5) !== 'data:') {\r\n return;\r\n }\r\n if (!filename) {\r\n filename = ['screenshot-', +new Date(), '.png'].join('');\r\n }\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(dataUrlToBlob(dataUrl), filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(dataUrlToBlob(dataUrl));\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction download(data, filename, type) {\r\n const blobData = new Blob([data]);\r\n\r\n if (!filename) {\r\n filename = ['data', +new Date()].join('');\r\n }\r\n\r\n if (!type) {\r\n filename += blobData.type || '.bin';\r\n } else {\r\n filename += `.${type}`;\r\n }\r\n\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(blobData, filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(blobData);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction copySubArrays(src, dst, indices, itemSize) {\r\n for (let i = 0, n = indices.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n dst[i * itemSize + j] = src[indices[i] * itemSize + j];\r\n }\r\n }\r\n}\r\n\r\nfunction shallowCloneNode(node) {\r\n const newNode = node.cloneNode(true);\r\n newNode.worldPos = node.worldPos;\r\n // .style property is readonly, so \"newNode.style = node.style;\" won't work (and we don't need it, right?)\r\n return newNode;\r\n}\r\n\r\nconst unquotedStringRE = /^[a-zA-Z0-9_]*$/;\r\nconst enquoteHelper = ['\"', '', '\"'];\r\n\r\n// verify and correct if needed selctor identifier\r\nfunction correctSelectorIdentifier(value) {\r\n if (unquotedStringRE.test(value)) {\r\n return value;\r\n }\r\n // quote incorrect identifier\r\n enquoteHelper[1] = value;\r\n return enquoteHelper.join('');\r\n}\r\n\r\n/**\r\n * Concatenates two TypedArray. Doesn't check null refs o type equality\r\n * Attention! It must be use very rarely because requires memory reallocation every time. Use MergeTypedArraysUnsafe to\r\n * unite array of subarrays.\r\n * @param{TypedArray} first - destination array\r\n * @param{TypedArray} second - source array\r\n * @returns{TypedArray} resulting concatenated array\r\n */\r\nfunction concatTypedArraysUnsafe(first, second) {\r\n const result = new first.constructor(first.length + second.length);\r\n result.set(first);\r\n result.set(second, first.length);\r\n return result;\r\n}\r\n\r\n/**\r\n * Merges array of TypedArray into TypedArray. Doesn't check null refs o type equality\r\n * @param{array} array - source array of subarrays\r\n * @returns{TypedArray} resulting merged array\r\n */\r\nfunction mergeTypedArraysUnsafe(array) {\r\n if (array.length <= 0) {\r\n return null;\r\n }\r\n // count the size\r\n const size = array.reduce((acc, cur) => acc + cur.length, 0);\r\n // create combined array\r\n const result = new array[0].constructor(size);\r\n for (let i = 0, start = 0; i < array.length; i++) {\r\n const count = array[i].length;\r\n result.set(array[i], start);\r\n start += count;\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Exports\r\n\r\nexport default {\r\n browserType,\r\n encodeQueryComponent,\r\n decodeQueryComponent,\r\n getUrlParameters,\r\n getUrlParametersAsDict,\r\n resolveURL,\r\n generateRegExp,\r\n createElement,\r\n deriveClass,\r\n deriveDeep,\r\n hexColor,\r\n DebugTracer,\r\n OutOfMemoryError,\r\n allocateTyped,\r\n bytesFromBase64,\r\n bytesToBase64,\r\n arrayFromBase64,\r\n arrayToBase64,\r\n compareOptionsWithDefaults,\r\n objectsDiff,\r\n forInRecursive,\r\n enquoteString,\r\n unquoteString,\r\n getBrowser,\r\n shotOpen,\r\n shotDownload,\r\n copySubArrays,\r\n shallowCloneNode,\r\n correctSelectorIdentifier,\r\n getFileExtension,\r\n splitFileName,\r\n download,\r\n concatTypedArraysUnsafe,\r\n mergeTypedArraysUnsafe,\r\n};\r\n","import EventDispatcher from './EventDispatcher';\r\n\r\nexport default class JobHandle extends EventDispatcher {\r\n constructor() {\r\n super();\r\n this._shouldCancel = false;\r\n }\r\n\r\n cancel() {\r\n this._shouldCancel = true;\r\n this.dispatchEvent({ type: 'cancel' });\r\n }\r\n\r\n shouldCancel() {\r\n return this._shouldCancel;\r\n }\r\n\r\n // slaves use this to notify master about their events\r\n // master routes these notifications to a single event slot\r\n notify(event) {\r\n this.dispatchEvent({ type: 'notification', slaveEvent: event });\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport utils from './utils';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\n\r\nconst VERSION = 0;\r\n\r\n//----------------------------------------------------------------------------\r\n// DEFAULT SETTINGS\r\n//----------------------------------------------------------------------------\r\n\r\n/**\r\n * Polygonal complexity settings.\r\n *\r\n * @typedef PolyComplexity\r\n * @property {number} poor\r\n * @property {number} low\r\n * @property {number} medium\r\n * @property {number} high\r\n * @property {number} ultra\r\n */\r\n\r\n/**\r\n * @alias SettingsObject\r\n * @namespace\r\n */\r\nconst defaults = {\r\n /**\r\n * Default options for all available modes.\r\n * Use {@link Mode.id} as a dictionary key to access mode options.\r\n *\r\n * Usually you don't need to override these settings. You may specify mode options as a parameter during\r\n * {@link Mode} construction.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {LinesModeOptions} LN - Lines mode options.\r\n * @property {LicoriceModeOptions} LC - Licorice mode options.\r\n * @property {BallsAndSticksModeOptions} BS - Balls and Sticks mode options.\r\n * @property {VanDerWaalsModeOptions} VW - Van der Waals mode options.\r\n * @property {TraceModeOptions} TR - Trace mode options.\r\n * @property {TubeModeOptions} TU - Tube mode options.\r\n * @property {CartoonModeOptions} CA - Cartoon mode options.\r\n * @property {QuickSurfaceModeOptions} QS - Contact Surface mode options.\r\n * @property {IsoSurfaceSASModeOptions} SA - Solvent Accessible Surface mode options.\r\n * @property {IsoSurfaceSESModeOptions} SE - Solvent Excluded Surface mode options.\r\n * @property {ContactSurfaceModeOptions} CS - Contact Surface mode options.\r\n * @property {TextModeOptions} TX - Text mode options.\r\n * @property {VolumeDensityModeOptions} VD - Volume Density mode options.\r\n */\r\n modes: {\r\n //----------------------------------------------------------------------------\r\n // BALLS AND STICKS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Balls and Sticks mode options.\r\n *\r\n * @typedef BallsAndSticksModeOptions\r\n *\r\n * @property {number} atom - Sphere radius as a fraction of Van der Waals atom radius.\r\n * @property {number} bond - Cylinder radius in angstroms.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n BS: {\r\n atom: 0.23,\r\n bond: 0.15,\r\n space: 0.5,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VAN DER WAALS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Van der Waals mode options.\r\n *\r\n * @typedef VanDerWaalsModeOptions\r\n *\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VW: {\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 8,\r\n high: 16,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LINES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Lines mode options.\r\n *\r\n * @typedef LinesModeOptions\r\n *\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {number} offsarom - Offset between bonds and aromatic cycle.\r\n * @property {number} chunkarom - Number of pieces in a-loop arc, corresponding to atom.\r\n * @property {number} atom - Collision radius for atoms picking.\r\n * @property {number} lineWidth - Line width in pixels (not used in thin lines).\r\n */\r\n LN: {\r\n multibond: true,\r\n showarom: true,\r\n offsarom: 0.2,\r\n chunkarom: 10,\r\n atom: 0.23,\r\n lineWidth: 2,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LICORICE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Licorice mode options.\r\n *\r\n * @typedef LicoriceModeOptions\r\n *\r\n * @property {number} bond - Bond cylinder radius.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Poly complexity values for render modes.\r\n */\r\n LC: {\r\n bond: 0.20,\r\n space: 0.0,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SAS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Accessible Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSASModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SA: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Excluded Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSESModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SE: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // QUICK SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Quick Surface mode options.\r\n *\r\n * @typedef QuickSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} scale - Radius scale for the surface being built.\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} gaussLim - Gauss lim for coloring the bigger the value, the smoother our colors are.\r\n * @property {PolyComplexity} gridSpacing - Poly complexity values for render modes. In this case the value\r\n * corresponds to the grid density.\r\n */\r\n QS: {\r\n isoValue: 0.5,\r\n gaussLim: {\r\n poor: 1.5,\r\n low: 2.0,\r\n medium: 2.5,\r\n high: 3.0,\r\n ultra: 4.0,\r\n },\r\n scale: 1.0,\r\n wireframe: false,\r\n gridSpacing: {\r\n poor: 2,\r\n low: 1.5,\r\n medium: 1,\r\n high: 0.5,\r\n ultra: 0.25,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CONTACT SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Contact Surface mode options.\r\n *\r\n * @typedef ContactSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} probeRadius - Probe radius.\r\n * @property {number} probePositions\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Radius scale for the surface being built.\r\n * Poly complexity values for render modes. In this case the value corresponds to the grid density.\r\n */\r\n CS: {\r\n probeRadius: 1.4,\r\n isoValue: 1.5,\r\n wireframe: false,\r\n probePositions: 30,\r\n polyComplexity: {\r\n poor: 0.5,\r\n low: 1.0,\r\n medium: 1.5,\r\n high: 1.75,\r\n ultra: 2.0,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TRACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Trace mode options.\r\n *\r\n * @typedef TraceModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n TR: {\r\n radius: 0.30,\r\n polyComplexity: {\r\n poor: 12,\r\n low: 16,\r\n medium: 32,\r\n high: 64,\r\n ultra: 64,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TUBE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Tube mode options.\r\n *\r\n * @typedef TubeModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {number} tension - Tension for interpolation.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n TU: {\r\n radius: 0.30,\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CARTOON\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Cartoon mode options.\r\n *\r\n * @typedef CartoonModeOptions\r\n *\r\n * @property {number} radius - Standard tube radius.\r\n * @property {number} depth - Height of the secondary structure ribbon.\r\n * @property {number} tension - Tension for interpolation.\r\n * @proprety {object} ss - Secondary structure parameters.\r\n * @proprety {object} ss.helix - Options for helices render.\r\n * @proprety {number} ss.helix.width - Width of the secondary structure ribbon.\r\n * @proprety {number} ss.helix.arrow - Secondary structure's arrow width.\r\n * @proprety {object} ss.strand - Options for strands render.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * polyComplexity must be even for producing symmetric arrows.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n CA: {\r\n radius: 0.30,\r\n depth: 0.25,\r\n ss: {\r\n helix: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n strand: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n },\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TEXT\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Text mode options.\r\n *\r\n * @typedef TextModeOptions\r\n *\r\n * @property {string} template - Format string for building output text.\r\n * @property {string} horizontalAlign - Text alignment ('left', 'right', 'center').\r\n * @property {string} verticalAlign - Vertical text box alignment ('top', 'bottom', 'middle').\r\n * @property {number} dx - Text offset x in angstroms.\r\n * @property {number} dy - Text offset y in angstroms.\r\n * @property {number} dz - Text offset z in angstroms.\r\n * @property {string} fg - Color rule for foreground.\r\n * @property {string} bg - Color rule for background.\r\n * @property {boolean} showBg - Flag, that toggles background rendering.\r\n *\r\n */\r\n TX: {\r\n template: '{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}',\r\n horizontalAlign: 'center',\r\n verticalAlign: 'middle',\r\n dx: 0,\r\n dy: 0,\r\n dz: 1,\r\n fg: 'none',\r\n bg: '0x202020',\r\n showBg: true,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VOLUME DENSITY\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Volume density mode options.\r\n *\r\n * @typedef VolumeDensityModeOptions\r\n *\r\n * @property {number} kSigma - Noise threshold coefficient.\r\n * @property {boolean} frame - flag, that turns on box frame painting.\r\n * @property {boolean} isoMode - flag, that turns on IsoSurface mode instead of Volume Rendering.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VD: {\r\n kSigma: 1.0,\r\n kSigmaMed: 2.0,\r\n kSigmaMax: 4.0,\r\n frame: true,\r\n isoMode: false,\r\n polyComplexity: {\r\n poor: 2,\r\n low: 3,\r\n medium: 4,\r\n high: 8,\r\n ultra: 10,\r\n },\r\n },\r\n },\r\n\r\n /**\r\n * Default options for all available colorers.\r\n * Use {@link Colorer.id} as a dictionary key to access colorer options.\r\n *\r\n * Usually you don't need to override these settings. You may specify colorer options as a parameter during\r\n * {@link Colorer} construction.\r\n *\r\n * Not all colorers have options.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {ElementColorerOptions} EL - Element colorer options.\r\n * @property {SequenceColorerOptions} SQ - Sequence colorer options.\r\n * @property {MoleculeColorerOptions} MO - Molecule colorer options.\r\n * @property {UniformColorerOptions} UN - Uniform colorer options.\r\n * @property {ConditionalColorerOptions} CO - Conditional colorer options.\r\n * @property {TemperatureColorerOptions} TM - Temperature colorer options.\r\n * @property {OccupancyColorerOptions} OC - Occupancy colorer options.\r\n * @property {HydrophobicityColorerOptions} HY - Hydrophobicity colorer options.\r\n */\r\n colorers: {\r\n /**\r\n * Element colorer options.\r\n *\r\n * @typedef ElementColorerOptions\r\n *\r\n * @property {number} carbon - Carbon color or -1 to use default.\r\n */\r\n EL: {\r\n carbon: -1,\r\n },\r\n\r\n /**\r\n * Uniform colorer options.\r\n *\r\n * @typedef UniformColorerOptions\r\n *\r\n * @property {number} color - Single color to paint with.\r\n */\r\n UN: {\r\n color: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Conditional colorer options.\r\n *\r\n * @typedef ConditionalColorerOptions\r\n *\r\n * @property {string} subset - Selector string.\r\n * @property {number} color - Color of selected atoms.\r\n * @property {number} baseColor - Color of other atoms.\r\n */\r\n CO: {\r\n subset: 'charged',\r\n color: 0xFF0000,\r\n baseColor: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Carbon colorer options.\r\n *\r\n * @typedef CarbonColorerOptions\r\n *\r\n * @property {number} color - Single color to paint carbons\r\n * @property {number} factor - Color factor for not carbon atoms.\r\n */\r\n CB: {\r\n color: 0x909090,\r\n factor: 0.6,\r\n },\r\n\r\n /**\r\n * Sequence colorer options.\r\n *\r\n * @typedef SequenceColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n SQ: {\r\n gradient: 'rainbow',\r\n },\r\n\r\n /**\r\n * Temperature colorer options.\r\n *\r\n * @typedef TemperatureColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n * @property {number} min - Minimal temperature.\r\n * @property {number} max - Maximal temperature.\r\n */\r\n TM: {\r\n gradient: 'temp',\r\n min: 5,\r\n max: 40,\r\n },\r\n\r\n /**\r\n * Occupancy colorer options.\r\n *\r\n * @typedef OccupancyColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n OC: {\r\n gradient: 'reds',\r\n },\r\n\r\n /**\r\n * Hydrophobicity colorer options.\r\n *\r\n * @typedef HydrophobicityColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n HY: {\r\n gradient: 'blue-red',\r\n },\r\n\r\n /**\r\n * Molecule colorer options.\r\n *\r\n * @typedef MoleculeColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n MO: {\r\n gradient: 'rainbow',\r\n },\r\n },\r\n\r\n /*\r\n * Use antialiasing in WebGL.\r\n * @type {boolean}\r\n */\r\n antialias: true,\r\n\r\n /*\r\n * Camera field of view in degrees.\r\n * @type {number}\r\n */\r\n camFov: 45.0,\r\n\r\n /*\r\n * Camera near plane distance.\r\n * @type {number}\r\n */\r\n camNear: 0.5,\r\n\r\n /*\r\n * Camera far plane distance.\r\n * @type {number}\r\n */\r\n camFar: 100.0,\r\n\r\n camDistance: 2.5,\r\n\r\n radiusToFit: 1.0,\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogNearFactor: 0.5, // [0, 1]\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogFarFactor: 1, // [0, 1]\r\n fogAlpha: 1.0,\r\n fogColor: 0x000000,\r\n fogColorEnable: false,\r\n\r\n /**\r\n * Palette used for molecule coloring.\r\n * @type {string}\r\n */\r\n palette: 'JM',\r\n\r\n /*\r\n * Geometry resolution.\r\n * @type {string}\r\n */\r\n resolution: 'medium',\r\n\r\n autoResolution: false/* true */,\r\n\r\n autoPreset: true,\r\n\r\n preset: 'default', // TODO: remove 'preset' from settings, implement autodetection\r\n\r\n presets: {\r\n // Default\r\n default: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n empty: [],\r\n\r\n // Wireframe\r\n wire: [{\r\n mode: 'LN',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Small molecules\r\n small: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Proteins, nucleic acids etc.\r\n macro: [{\r\n mode: 'CA',\r\n colorer: 'SS',\r\n selector: 'not hetatm',\r\n material: 'SF',\r\n }, {\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'hetatm and not water',\r\n material: 'SF',\r\n }],\r\n },\r\n\r\n objects: {\r\n line: {\r\n color: 0xFFFFFFFF,\r\n dashSize: 0.3,\r\n gapSize: 0.05,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n\r\n bg: {\r\n color: 0x202020,\r\n transparent: false,\r\n },\r\n\r\n draft: {\r\n clipPlane: false,\r\n clipPlaneFactor: 0.5,\r\n clipPlaneSpeed: 0.00003,\r\n },\r\n\r\n /*\r\n * Separate group for plugins.\r\n * Each plugin handles its field by itself.\r\n */\r\n plugins: {\r\n\r\n },\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n axes: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fog: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fps: true,\r\n\r\n /**\r\n * Switch using of z-sprites for sphere and cylinder geometry\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zSprites: true,\r\n\r\n isoSurfaceFakeOpacity: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n suspendRender: true,\r\n\r\n nowater: false,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autobuild: true,\r\n\r\n /**\r\n * Anti-aliasing.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fxaa: true,\r\n /**\r\n * Outline depths\r\n * @type {boolean}\r\n * @instance\r\n */\r\n outline: {\r\n on: false,\r\n color: 0x000000,\r\n threshold: 0.1,\r\n thickness: 1,\r\n },\r\n\r\n /**\r\n * Ambient Occlusion special effect.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n ao: false,\r\n\r\n /**\r\n * Shadows options.\r\n *\r\n * @property {boolean} shadowMap - enable/disable.\r\n * @property {string} basic/percentage-closer filtering/non-uniform randomizing pcf.\r\n * @property {number} radius for percentage-closer filtering.\r\n */\r\n shadow: {\r\n on: false,\r\n type: 'random'/* basic, pcf, random */,\r\n radius: 1.0,\r\n },\r\n\r\n /**\r\n * Auto-rotation with constant speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n autoRotation: 0.0,\r\n\r\n /**\r\n * Set maximum fps for animation.\r\n * @type {number}\r\n * @instance\r\n */\r\n maxfps: 30,\r\n\r\n /**\r\n * Set fbx output precision.\r\n * @type {number}\r\n * @instance\r\n */\r\n fbxprec: 4,\r\n\r\n /**\r\n * Auto-rotation axis.\r\n *\r\n * - true: complex auto-rotation is about vertical axis\r\n * - false: rotation axis is defined by last user rotation\r\n *\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autoRotationAxisFixed: true,\r\n\r\n /**\r\n * Enable zooming with mouse wheel or pinch gesture.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zooming: true,\r\n\r\n /**\r\n * Enable picking atoms & residues with left mouse button or touch.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n picking: true,\r\n\r\n /**\r\n * Set picking mode ('atom', 'residue', 'chain', 'molecule').\r\n * @type {string}\r\n * @instance\r\n */\r\n pick: 'atom',\r\n\r\n /**\r\n * Make \"component\" and \"fragment\" editing modes available.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n editing: false,\r\n\r\n /**\r\n * Detect aromatic loops.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n aromatic: false,\r\n\r\n /**\r\n * Load only one biological unit from all those described in PDB file.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n singleUnit: true,\r\n\r\n /**\r\n * Set stereo mode ('NONE', 'SIMPLE', 'DISTORTED', 'ANAGLYPH', 'WEBVR').\r\n * @type {string}\r\n * @instance\r\n */\r\n stereo: 'NONE',\r\n\r\n /**\r\n * Enable smooth transition between views\r\n * @type {boolean}\r\n * @instance\r\n */\r\n interpolateViews: true,\r\n\r\n /**\r\n * Set transparency mode ('standard', 'prepass').\r\n * @type {string}\r\n * @instance\r\n */\r\n transparency: 'prepass',\r\n\r\n /**\r\n * Mouse translation speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n translationSpeed: 2,\r\n\r\n debug: {\r\n example: 3.5,\r\n text: 'hello!',\r\n good: true,\r\n ssaoKernelRadius: 0.7,\r\n ssaoFactor: 0.7,\r\n stereoBarrel: 0.25,\r\n },\r\n use: {\r\n multiFile: false,\r\n },\r\n};\r\n\r\n//----------------------------------------------------------------------------\r\n// SETTINGS CLASS\r\n//----------------------------------------------------------------------------\r\n\r\nfunction Settings() {\r\n EventDispatcher.call(this);\r\n\r\n this.old = null;\r\n this.now = {};\r\n this._changed = {};\r\n\r\n this.reset();\r\n}\r\n\r\nutils.deriveClass(Settings, EventDispatcher, {\r\n defaults,\r\n\r\n set(path, value) {\r\n if (_.isString(path)) {\r\n const oldValue = _.get(this.now, path);\r\n if (oldValue !== value) {\r\n _.set(this.now, path, value);\r\n this._notifyChange(path, value);\r\n }\r\n } else {\r\n const diff = utils.objectsDiff(path, this.now);\r\n if (!_.isEmpty(diff)) {\r\n _.merge(this.now, diff);\r\n this._notifyChanges(diff);\r\n }\r\n }\r\n },\r\n\r\n get(path, defaultValue) {\r\n return _.get(this.now, path, defaultValue);\r\n },\r\n\r\n reset() {\r\n const diff = utils.objectsDiff(defaults, this.now);\r\n this.now = _.cloneDeep(defaults);\r\n this.old = null;\r\n this._notifyChanges(diff);\r\n this._changed = {};\r\n },\r\n\r\n checkpoint() {\r\n this.old = _.cloneDeep(this.now);\r\n this._changed = {};\r\n },\r\n\r\n _notifyChange(path, value) {\r\n this._changed[path] = true;\r\n this.dispatchEvent({ type: `change:${path}`, value });\r\n },\r\n\r\n _notifyChanges(diff) {\r\n utils.forInRecursive(diff, (deepValue, deepPath) => {\r\n this._notifyChange(deepPath, deepValue);\r\n });\r\n },\r\n\r\n changed() {\r\n if (!this.old) {\r\n return [];\r\n }\r\n const { old, now } = this;\r\n const keys = _.filter(Object.keys(this._changed), (key) => _.get(old, key) !== _.get(now, key));\r\n return keys;\r\n },\r\n\r\n applyDiffs(diffs) {\r\n if (diffs.hasOwnProperty('VERSION') && diffs.VERSION !== VERSION) {\r\n throw new Error('Settings version does not match!');\r\n }\r\n // VERSION shouldn't be presented inside settings structure\r\n delete diffs.VERSION;\r\n this.reset();\r\n this.set(diffs);\r\n },\r\n\r\n getDiffs(versioned) {\r\n const diffs = utils.objectsDiff(this.now, defaults);\r\n if (versioned) {\r\n diffs.VERSION = VERSION;\r\n }\r\n return diffs;\r\n },\r\n\r\n setPluginOpts(plugin, opts) {\r\n defaults.plugins[plugin] = _.cloneDeep(opts);\r\n this.now.plugins[plugin] = _.cloneDeep(opts);\r\n },\r\n});\r\n\r\nexport default new Settings();\r\n","import _ from 'lodash';\r\nimport settings from './settings';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\n\r\nlet repIndex = 0;\r\n\r\nfunction asBoolean(value) {\r\n return !(!value || value === '0' || (_.isString(value) && value.toLowerCase() === 'false'));\r\n}\r\n\r\nconst adapters = {\r\n string: String,\r\n number: Number,\r\n boolean: asBoolean,\r\n};\r\n\r\n// Level 1 assignment symbol\r\nconst cL1Ass = '=';\r\n\r\nconst cOptsSep = '!';\r\n// Level 2 (options) assignment symbol\r\nconst cL2Ass = ':';\r\n// Level 2 (options) separator symbol\r\nconst cLSep = ',';\r\n\r\nconst cCommonIgnoreSymbols = '$;@/?';\r\n/**\r\n * We may (and should) leave as is for better readability:\r\n *\r\n * $ , ; : @ / ?\r\n */\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n */\r\nfunction getLevel1ExcludedExpr() {\r\n const cLevel1Ignores = ':,';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel1Ignores);\r\n}\r\n\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n * (options, etc, ..)\r\n */\r\nfunction getLevel2ExcludedExpr() {\r\n const cLevel2Ignores = ' ';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel2Ignores);\r\n}\r\n\r\nconst cL1ExclExpr = getLevel1ExcludedExpr();\r\nfunction encodeQueryComponentL1(value) {\r\n return utils.encodeQueryComponent(value, cL1ExclExpr);\r\n}\r\n\r\nconst cL2ExclExpr = getLevel2ExcludedExpr();\r\nfunction encodeQueryComponentL2(value) {\r\n return utils.encodeQueryComponent(value, cL2ExclExpr);\r\n}\r\n\r\nfunction ensureRepList(opts) {\r\n let { reps } = opts;\r\n if (!reps) {\r\n const { presets } = settings.now;\r\n let preset = opts.preset || settings.now.preset;\r\n reps = presets[preset];\r\n if (!reps) {\r\n logger.warn(`Unknown preset \"${preset}\"`);\r\n [preset] = Object.keys(presets);\r\n reps = presets[preset]; // fall back to any preset\r\n }\r\n opts.preset = preset;\r\n opts.reps = utils.deriveDeep(reps, true);\r\n }\r\n}\r\n\r\nfunction ensureRepAssign(opts, prop, value) {\r\n ensureRepList(opts);\r\n const rep = opts.reps[repIndex];\r\n // prop specified twice therefore start new rep by cloning the current\r\n if (rep.hasOwnProperty(prop)) {\r\n repIndex = opts.reps.length;\r\n opts.reps[repIndex] = utils.deriveDeep(rep, true);\r\n }\r\n if (value !== undefined) {\r\n opts.reps[repIndex][prop] = value;\r\n }\r\n}\r\n\r\nfunction addObject(opts, params, options) {\r\n if (opts._objects === undefined) {\r\n opts._objects = [];\r\n }\r\n\r\n const [type, newOpts] = options;\r\n const newObj = {\r\n type,\r\n params,\r\n };\r\n\r\n if (newOpts !== undefined) {\r\n newObj.opts = newOpts;\r\n }\r\n\r\n opts._objects[opts._objects.length] = newObj;\r\n}\r\n\r\nfunction parseParams(str, params) {\r\n const sep = str.indexOf(',');\r\n if (sep >= 0) {\r\n params.push(str.substr(sep + 1).split(','));\r\n return str.substr(0, sep);\r\n }\r\n // keep this untouched if no params were extracted\r\n return str;\r\n}\r\n\r\nfunction extractArgs(input, defaultsDict, params) {\r\n if (input) {\r\n const bang = input.indexOf(cOptsSep);\r\n const inputVal = parseParams(input.substr(0, bang >= 0 ? bang : undefined), params);\r\n if (bang >= 0) {\r\n const args = input.substr(bang + 1).split(cLSep);\r\n input = inputVal;\r\n if (defaultsDict) {\r\n const defaults = defaultsDict[input];\r\n const opts = utils.deriveDeep(defaults, true);\r\n args.forEach((arg) => {\r\n const pair = arg.split(cL2Ass, 2);\r\n const key = decodeURIComponent(pair[0]);\r\n const value = decodeURIComponent(pair[1]);\r\n const adapter = adapters[typeof _.get(defaults, key)];\r\n if (adapter) {\r\n _.set(opts, key, adapter(value));\r\n } else {\r\n logger.warn(`Unknown argument \"${key}\" for option \"${input}\"`);\r\n }\r\n });\r\n if (Object.keys(opts).length > 0) {\r\n input = [input, opts];\r\n }\r\n }\r\n } else {\r\n input = inputVal;\r\n }\r\n }\r\n return input;\r\n}\r\n\r\nconst actions = {\r\n\r\n l: 'load',\r\n load: String,\r\n t: 'type',\r\n type: String,\r\n v: 'view',\r\n view: String,\r\n u: 'unit',\r\n unit: Number,\r\n menu: asBoolean,\r\n\r\n // Commands\r\n\r\n o: 'object',\r\n object(value, opts) {\r\n const params = [];\r\n let options = extractArgs(value, settings.defaults.objects, params);\r\n if (!Array.isArray(options)) {\r\n options = [options];\r\n }\r\n addObject(opts, params[0], options);\r\n },\r\n\r\n p: 'preset',\r\n preset(value, opts) {\r\n opts.preset = value;\r\n opts.reps = null;\r\n ensureRepList(opts);\r\n },\r\n\r\n r: 'rep',\r\n rep(value, opts) {\r\n ensureRepList(opts);\r\n repIndex = Number(value);\r\n // clamp the index to one greater than the last\r\n repIndex = repIndex <= opts.reps.length ? (repIndex < 0 ? 0 : repIndex) : opts.reps.length;\r\n // create a new rep if it is adjacent to the existing ones\r\n if (repIndex === opts.reps.length) {\r\n // if there is no rep to derive from, derive from the first rep of the default\r\n opts.reps[repIndex] = repIndex > 0 ? utils.deriveDeep(opts.reps[repIndex - 1], true)\r\n : utils.deriveDeep(settings.defaults.presets.default[0], true);\r\n }\r\n },\r\n\r\n s: 'select',\r\n select(value, opts) {\r\n ensureRepAssign(opts, 'selector', value);\r\n },\r\n\r\n m: 'mode',\r\n mode(value, opts) {\r\n ensureRepAssign(opts, 'mode', extractArgs(value, settings.defaults.modes));\r\n },\r\n\r\n c: 'color',\r\n color(value, opts) {\r\n ensureRepAssign(opts, 'colorer', extractArgs(value, settings.defaults.colorers));\r\n },\r\n\r\n mt: 'material',\r\n material(value, opts) {\r\n ensureRepAssign(opts, 'material', extractArgs(value, settings.defaults.materials));\r\n },\r\n\r\n dup(value, opts) {\r\n ensureRepList(opts);\r\n const { reps } = opts;\r\n const rep = reps[repIndex];\r\n repIndex = reps.length;\r\n reps[repIndex] = utils.deriveDeep(rep, true);\r\n },\r\n\r\n // Settings shortcuts\r\n\r\n ar: 'autoResolution',\r\n};\r\n\r\nfunction _fromArray(entries) {\r\n repIndex = 0;\r\n\r\n const opts = {};\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const /** string[] */ entry = entries[i];\r\n let /** string? */ key = entry[0];\r\n const /** string? */ value = entry[1];\r\n let /** function|string? */ action = actions[key];\r\n\r\n // unwind shortcuts and aliases\r\n while (_.isString(action)) {\r\n key = action;\r\n action = actions[key];\r\n }\r\n\r\n // either set a property or use specialized parser\r\n if (!action) {\r\n const adapter = adapters[typeof _.get(settings.defaults, key)];\r\n if (adapter) {\r\n _.set(opts, `settings.${key}`, adapter(value));\r\n } else {\r\n logger.warn(`Unknown option \"${key}\"`);\r\n }\r\n } else if (_.isFunction(action)) {\r\n const result = action(value, opts);\r\n if (result !== undefined) {\r\n opts[key] = result;\r\n }\r\n }\r\n }\r\n\r\n return opts;\r\n}\r\n\r\nfunction fromAttr(attr) {\r\n return _fromArray(utils.getUrlParameters(`?${attr || ''}`));\r\n}\r\n\r\nfunction fromURL(url) {\r\n return _fromArray(utils.getUrlParameters(url));\r\n}\r\n\r\nfunction _processOptsForURL(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = encodeQueryComponentL2(key) + cL2Ass + encodeQueryComponentL2(value);\r\n });\r\n return str.join(cLSep);\r\n}\r\n\r\nfunction _processArgsForURL(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]}${cOptsSep}${_processOptsForURL(args[1])}`;\r\n}\r\n\r\nfunction _processObjForURL(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += `,${objOpts.params.join(',')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += cOptsSep + _processOptsForURL(objOpts.opts);\r\n }\r\n return res;\r\n}\r\n\r\nfunction toURL(opts) {\r\n const stringList = [];\r\n let idx = 0;\r\n\r\n function checkAndAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n stringList[idx++] = encodeQueryComponentL1(prefix)\r\n + cL1Ass + encodeQueryComponentL1(value);\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n if (_.isEmpty(repList[i])) {\r\n continue;\r\n }\r\n checkAndAdd('r', i);\r\n checkAndAdd('s', repList[i].selector);\r\n checkAndAdd('m', _processArgsForURL(repList[i].mode));\r\n checkAndAdd('c', _processArgsForURL(repList[i].colorer));\r\n checkAndAdd('mt', _processArgsForURL(repList[i].material));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('o', _processObjForURL(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('l', opts.load);\r\n checkAndAdd('u', opts.unit);\r\n checkAndAdd('p', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n checkAndAdd('v', opts.view);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(key, value);\r\n });\r\n\r\n let url = '';\r\n if (typeof window !== 'undefined') {\r\n const { location } = window;\r\n url = `${location.protocol}//${location.host}${location.pathname}`;\r\n }\r\n if (stringList.length > 0) {\r\n url += `?${stringList.join('&')}`;\r\n }\r\n\r\n return url;\r\n}\r\n\r\nfunction _processOptsForScript(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = `${key}=${utils.enquoteString(value)}`;\r\n });\r\n return str.join(' ');\r\n}\r\n\r\nfunction _processArgsForScript(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]} ${_processOptsForScript(args[1])}`;\r\n}\r\n\r\nfunction _processObjForScript(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += ` ${objOpts.params.map(utils.enquoteString).join(' ')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += ` ${_processOptsForScript(objOpts.opts)}`;\r\n }\r\n return res;\r\n}\r\n\r\nfunction _processRepsForScript(rep, index) {\r\n const repString = [];\r\n let strIdx = 0;\r\n function localAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n repString[strIdx++] = prefix + value;\r\n }\r\n }\r\n if (_.isEmpty(rep)) {\r\n return null;\r\n }\r\n localAdd('', index);\r\n localAdd('s=', utils.enquoteString(rep.selector));\r\n localAdd('m=', _processArgsForScript(rep.mode));\r\n localAdd('c=', _processArgsForScript(rep.colorer));\r\n localAdd('mt=', _processArgsForScript(rep.material));\r\n return repString.join(' ');\r\n}\r\n\r\nfunction toScript(opts) {\r\n const commandsList = [];\r\n let idx = 0;\r\n function checkAndAdd(command, value, saveQuotes) {\r\n if (value !== null && value !== undefined) {\r\n const quote = (typeof value === 'string' && saveQuotes) ? '\"' : '';\r\n commandsList[idx++] = `${command} ${quote}${value}${quote}`.trim();\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n checkAndAdd('rep', _processRepsForScript(repList[i], i));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('', _processObjForScript(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('set', 'autobuild false');\r\n checkAndAdd('load', opts.load, true);\r\n checkAndAdd('unit', opts.unit);\r\n checkAndAdd('preset', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(`set ${key}`, value, true);\r\n });\r\n checkAndAdd('view', opts.view);\r\n checkAndAdd('set', 'autobuild true');\r\n return commandsList.join('\\n');\r\n}\r\n\r\nexport default {\r\n fromURL,\r\n fromAttr,\r\n adapters,\r\n toURL,\r\n toScript,\r\n};\r\n","/**\r\n * Atom measurements.\r\n *\r\n * @param {Residue} residue - (required) Residue containing the atom\r\n * @param {string} name - (required) Name, unique in the residue\r\n * @param {Element} type - (required) Chemical element reference\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n *\r\n * @param {number} role - Role of atom inside monomer: Lead and wing are particularity interesting\r\n * @param {boolean} het - Non-standard residue indicator\r\n *\r\n * @param {number} serial - Serial number, unique in the model\r\n * @param {string} location - Alternative location indicator (usually space or A-Z)\r\n * @param {number} occupancy - Occupancy percentage, from 0 to 1\r\n * @param {number} temperature - Temperature\r\n * @param {number} charge - Charge\r\n *\r\n * @exports Atom\r\n * @constructor\r\n */\r\n\r\nclass Atom {\r\n constructor(residue, name, type, position, role, het, serial, location, occupancy, temperature, charge) {\r\n this.index = -1;\r\n this.residue = residue;\r\n this.name = name;\r\n this.element = type;\r\n this.position = position;\r\n this.role = role;\r\n this.mask = 1 | 0;\r\n\r\n this.het = het;\r\n\r\n this.serial = serial;\r\n this.location = (location || ' ').charCodeAt(0);\r\n this.occupancy = occupancy || 1;\r\n this.temperature = temperature;\r\n this.charge = charge;\r\n this.hydrogenCount = -1; // explicitly invalid\r\n this.radicalCount = 0;\r\n this.valence = -1; // explicitly invalid\r\n\r\n this.bonds = [];\r\n\r\n this.flags = 0x0000;\r\n if (type.name === 'H') {\r\n this.flags |= Atom.Flags.HYDROGEN;\r\n } else if (type.name === 'C') {\r\n this.flags |= Atom.Flags.CARBON;\r\n }\r\n }\r\n\r\n isHet() {\r\n return this.het;\r\n }\r\n\r\n isHydrogen() {\r\n return this.element.number === 1;\r\n }\r\n\r\n getVisualName() {\r\n const { name } = this;\r\n if (name.length > 0) {\r\n return name;\r\n }\r\n return this.element.name.trim();\r\n }\r\n\r\n forEachBond(process) {\r\n const { bonds } = this;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n getFullName() {\r\n let name = '';\r\n if (this.residue !== null) {\r\n if (this.residue._chain !== null) {\r\n name += `${this.residue._chain.getName()}.`;\r\n }\r\n name += `${this.residue._sequence}.`;\r\n }\r\n name += this.name;\r\n return name;\r\n }\r\n\r\n /**\r\n * Enumeration of atom flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n CARBON: 0x0001,\r\n // OXYGEN: 0x0002,\r\n // NITROGEN: 0x0004,\r\n HYDROGEN: 0x0008,\r\n /** Non-polar hydrogen (it is also a HYDROGEN) */\r\n NONPOLARH: 0x1008,\r\n };\r\n}\r\n\r\nexport default Atom;\r\n","class Element {\r\n constructor(number, name, fullName, weight, radius, radiusBonding, hValency) {\r\n this.number = number;\r\n this.name = name;\r\n this.fullName = fullName;\r\n this.weight = weight;\r\n this.radius = radius;\r\n this.radiusBonding = radiusBonding;\r\n this.hydrogenValency = hValency;\r\n }\r\n\r\n static Constants = {\r\n /* eslint-disable no-magic-numbers */\r\n U1: 1,\r\n Lead: 2,\r\n U2: 3,\r\n Wing: 4,\r\n U18: 18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n static Role = {\r\n /* eslint-disable no-magic-numbers */\r\n N: Element.Constants.U1,\r\n CA: Element.Constants.Lead,\r\n C: Element.Constants.U2,\r\n O: Element.Constants.Wing,\r\n SG: Element.Constants.U18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByAtomicNumber = [\r\n /* eslint-disable no-magic-numbers */\r\n null,\r\n new Element(1, 'H', 'Hydrogen', 1.008, 1.2, 0.23, [1]),\r\n new Element(2, 'HE', 'Helium', 4.003, 1.4, 0.93, [0]),\r\n new Element(3, 'LI', 'Lithium', 6.941, 1.82, 0.68, [1]),\r\n new Element(4, 'BE', 'Beryllium', 9.012, 1.7, 0.35, [2]),\r\n new Element(5, 'B', 'Boron', 10.81, 2.08, 0.83, [3]),\r\n new Element(6, 'C', 'Carbon', 12.011, 1.95, 0.68, [4]),\r\n new Element(7, 'N', 'Nitrogen', 14.007, 1.85, 0.68, [3, 5]),\r\n new Element(8, 'O', 'Oxygen', 15.999, 1.7, 0.68, [2, 4]),\r\n new Element(9, 'F', 'Fluorine', 18.998, 1.73, 0.64, [1]),\r\n new Element(10, 'NE', 'Neon', 20.18, 1.54, 1.12, [0]),\r\n new Element(11, 'NA', 'Sodium', 22.99, 2.27, 0.97, [1]),\r\n new Element(12, 'MG', 'Magnesium', 24.305, 1.73, 1.1, [2]),\r\n new Element(13, 'AL', 'Aluminum', 26.981, 2.05, 1.35, [3]),\r\n new Element(14, 'SI', 'Silicon', 28.086, 2.1, 1.2, [4]),\r\n new Element(15, 'P', 'Phosphorus', 30.974, 2.08, 0.75, [3, 5]),\r\n new Element(16, 'S', 'Sulfur', 32.07, 2, 1.02, [2, 4, 6]),\r\n new Element(17, 'CL', 'Chlorine', 35.453, 1.97, 0.99, [1, 3, 5, 7]),\r\n new Element(18, 'AR', 'Argon', 39.948, 1.88, 1.57, [0]),\r\n new Element(19, 'K', 'Potassium', 39.1, 2.75, 1.33, [1]),\r\n new Element(20, 'CA', 'Calcium', 40.08, 1.973, 0.99, [2]),\r\n new Element(21, 'SC', 'Scandium', 44.956, 1.7, 1.44, [0]),\r\n new Element(22, 'TI', 'Titanium', 47.88, 1.7, 1.47, [0]),\r\n new Element(23, 'V', 'Vanadium', 50.941, 1.7, 1.33, [0]),\r\n new Element(24, 'CR', 'Chromium', 52, 1.7, 1.35, [0]),\r\n new Element(25, 'MN', 'Manganese', 54.938, 1.7, 1.35, [0]),\r\n new Element(26, 'FE', 'Iron', 55.847, 1.7, 1.34, [0]),\r\n new Element(27, 'CO', 'Cobalt', 58.93, 1.7, 1.33, [0]),\r\n new Element(28, 'NI', 'Nickel', 58.69, 1.63, 1.5, [0]),\r\n new Element(29, 'CU', 'Copper', 63.55, 1.4, 1.52, [0]),\r\n new Element(30, 'ZN', 'Zinc', 65.39, 1.39, 1.45, [0]),\r\n new Element(31, 'GA', 'Gallium', 69.72, 1.87, 1.22, [3]),\r\n new Element(32, 'GE', 'Germanium', 72.61, 1.7, 1.17, [4]),\r\n new Element(33, 'AS', 'Arsenic', 74.92, 1.85, 1.21, [3, 5]),\r\n new Element(34, 'SE', 'Selenium', 78.96, 1.9, 1.22, [2, 4, 6]),\r\n new Element(35, 'BR', 'Bromine', 79.9, 2.1, 1.21, [1, 3, 5, 7]),\r\n new Element(36, 'KR', 'Krypton', 83.8, 2.02, 1.91, [0]),\r\n new Element(37, 'RB', 'Rubidium', 85.47, 1.7, 1.47, [1]),\r\n new Element(38, 'SR', 'Strontium', 87.62, 1.7, 1.12, [2]),\r\n new Element(39, 'Y', 'Yttrium', 88.91, 1.7, 1.78, [0]),\r\n new Element(40, 'ZR', 'Zirconium', 91.22, 1.7, 1.56, [0]),\r\n new Element(41, 'NB', 'Niobium', 92.91, 1.7, 1.48, [0]),\r\n new Element(42, 'MO', 'Molybdenum', 95.94, 1.7, 1.47, [0]),\r\n new Element(43, 'TC', 'Technetium', 98.91, 1.7, 1.35, [0]),\r\n new Element(44, 'RU', 'Ruthenium', 101.07, 1.7, 1.4, [0]),\r\n new Element(45, 'RH', 'Rhodium', 102.91, 1.7, 1.45, [0]),\r\n new Element(46, 'PD', 'Palladium', 106.42, 1.63, 1.5, [0]),\r\n new Element(47, 'AG', 'Silver', 107.87, 1.72, 1.59, [0]),\r\n new Element(48, 'CD', 'Cadmium', 112.41, 1.58, 1.69, [0]),\r\n new Element(49, 'IN', 'Indium', 114.82, 1.93, 1.63, [3]),\r\n new Element(50, 'SN', 'Tin', 118.71, 2.17, 1.46, [2, 4]),\r\n new Element(51, 'SB', 'Antimony', 121.75, 2.2, 1.46, [3, 5]),\r\n new Element(52, 'TE', 'Tellurium', 127.6, 2.06, 1.47, [2, 4, 6]),\r\n new Element(53, 'I', 'Iodine', 126.91, 2.15, 1.4, [1, 3, 5, 7]),\r\n new Element(54, 'XE', 'Xenon', 131.29, 2.16, 1.98, [0]),\r\n new Element(55, 'CS', 'Cesium', 132.91, 1.7, 1.67, [1]),\r\n new Element(56, 'BA', 'Barium', 137.33, 1.7, 1.34, [2]),\r\n new Element(57, 'LA', 'Lanthanum', 138.91, 1.7, 1.87, [0]),\r\n new Element(58, 'CE', 'Cerium', 140.12, 1.7, 1.83, [0]),\r\n new Element(59, 'PR', 'Praseodymium', 140.91, 1.7, 1.82, [0]),\r\n new Element(60, 'ND', 'Neodymium', 144.24, 1.7, 1.81, [0]),\r\n new Element(61, 'PM', 'Promethium', 144.9, 1.7, 1.8, [0]),\r\n new Element(62, 'SM', 'Samarium', 150.36, 1.7, 1.8, [0]),\r\n new Element(63, 'EU', 'Europium', 151.96, 1.7, 1.99, [0]),\r\n new Element(64, 'GD', 'Gadolinium', 157.25, 1.7, 1.79, [0]),\r\n new Element(65, 'TB', 'Terbium', 158.93, 1.7, 1.76, [0]),\r\n new Element(66, 'DY', 'Dysprosium', 162.5, 1.7, 1.75, [0]),\r\n new Element(67, 'HO', 'Holmium', 164.93, 1.7, 1.74, [0]),\r\n new Element(68, 'ER', 'Erbium', 167.26, 1.7, 1.73, [0]),\r\n new Element(69, 'TM', 'Thulium', 168.93, 1.7, 1.72, [0]),\r\n new Element(70, 'YB', 'Ytterbium', 173.04, 1.7, 1.94, [0]),\r\n new Element(71, 'LU', 'Lutetium', 174.97, 1.7, 1.72, [0]),\r\n new Element(72, 'HF', 'Hafnium', 178.49, 1.7, 1.57, [0]),\r\n new Element(73, 'TA', 'Tantalum', 180.95, 1.7, 1.43, [0]),\r\n new Element(74, 'W', 'Tungsten', 183.85, 1.7, 1.37, [0]),\r\n new Element(75, 'RE', 'Rhenium', 186.21, 1.7, 1.35, [0]),\r\n new Element(76, 'OS', 'Osmium', 190.2, 1.7, 1.37, [0]),\r\n new Element(77, 'IR', 'Iridium', 192.22, 1.7, 1.32, [0]),\r\n new Element(78, 'PT', 'Platinum', 195.08, 1.72, 1.5, [0]),\r\n new Element(79, 'AU', 'Gold', 196.97, 1.66, 1.5, [0]),\r\n new Element(80, 'HG', 'Mercury', 200.59, 1.55, 1.7, [0]),\r\n new Element(81, 'TL', 'Thallium', 204.38, 1.96, 1.55, [1, 3]),\r\n new Element(82, 'PB', 'Lead', 207.2, 2.02, 1.54, [2, 4]),\r\n new Element(83, 'BI', 'Bismuth', 208.98, 1.7, 1.54, [3, 5]),\r\n new Element(84, 'PO', 'Polonium', 210, 1.7, 1.68, [2, 4, 6]),\r\n new Element(85, 'AT', 'Astatine', 210, 1.7, 1.7, [1, 3, 5, 7]),\r\n new Element(86, 'RN', 'Radon', 222, 1.7, 2.4, [0]),\r\n new Element(87, 'FR', 'Francium', 223, 1.7, 2, [1]),\r\n new Element(88, 'RA', 'Radium', 226.03, 1.7, 1.9, [2]),\r\n new Element(89, 'AC', 'Actinium', 227.03, 1.7, 1.88, [0]),\r\n new Element(90, 'TH', 'Thorium', 232.04, 1.7, 1.79, [0]),\r\n new Element(91, 'PA', 'Protactinium', 231.04, 1.7, 1.61, [0]),\r\n new Element(92, 'U', 'Uranium', 238.03, 1.86, 1.58, [0]),\r\n new Element(93, 'NP', 'Neptunium', 237.05, 1.7, 1.55, [0]),\r\n new Element(94, 'PU', 'Plutonium', 239.1, 1.7, 1.53, [0]),\r\n new Element(95, 'AM', 'Americium', 243.1, 1.7, 1.51, [0]),\r\n new Element(96, 'CM', 'Curium', 247.1, 1.7, 1.5, [0]),\r\n new Element(97, 'BK', 'Berkelium', 247.1, 1.7, 1.5, [0]),\r\n new Element(98, 'CF', 'Californium', 252.1, 1.7, 1.5, [0]),\r\n new Element(99, 'ES', 'Einsteinium', 252.1, 1.7, 1.5, [0]),\r\n new Element(100, 'FM', 'Fermium', 257.1, 1.7, 1.5, [0]),\r\n new Element(101, 'MD', 'Mendelevium', 256.1, 1.7, 1.5, [0]),\r\n new Element(102, 'NO', 'Nobelium', 259.1, 1.7, 1.5, [0]),\r\n new Element(103, 'LR', 'Lawrencium', 260.1, 1.7, 1.5, [0]),\r\n new Element(104, 'RF', 'Rutherfordium', 261, 1.7, 1.6, [0]),\r\n new Element(105, 'DB', 'Dubnium', 262, 1.7, 1.6, [0]),\r\n new Element(106, 'SG', 'Seaborgium', 263, 1.7, 1.6, [0]),\r\n new Element(107, 'BH', 'Bohrium', 262, 1.7, 1.6, [0]),\r\n new Element(108, 'HS', 'Hassium', 265, 1.7, 1.6, [0]),\r\n new Element(109, 'MT', 'Meitnerium', 268, 1.7, 1.6, [0]),\r\n /* eslint-enable no-magic-numbers */\r\n ];\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByName = {\r\n // Duplicate atomic numbers (isotopes)\r\n /* eslint-disable no-magic-numbers */\r\n D: new Element(1, 'D', 'Deuterium', 2.014, 1.2, 0.23, [1]),\r\n T: new Element(1, 'T', 'Tritium', 3.016, 1.2, 0.23, [1]),\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // All regular elements will be added later, automatically\r\n };\r\n}\r\n\r\n(function () {\r\n const byAtomicNumber = Element.ByAtomicNumber;\r\n const byName = Element.ByName;\r\n for (let i = 0, n = byAtomicNumber.length; i < n; ++i) {\r\n const element = byAtomicNumber[i];\r\n if (element) {\r\n byName[element.name] = element;\r\n }\r\n }\r\n}());\r\n\r\n// find atom type by chemical element (or create if missing)\r\nElement.getByName = function (element) {\r\n let type = Element.ByName[element];\r\n if (!type) {\r\n type = Element.ByName[element] = new Element(0, element, 'Unknown', 0, 1.0, 0.01, [0]);\r\n }\r\n return type;\r\n};\r\n\r\nexport default Element;\r\n","const cBondTypes = {\r\n /** Was generated manually */\r\n UNKNOWN: 0,\r\n /** Simple covalent bond */\r\n COVALENT: 1,\r\n /** Aromatic bond */\r\n AROMATIC: 2,\r\n};\r\n\r\nfunction getAtomPos(atom) {\r\n return atom.position;\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Atom} left - The first atom.\r\n * @param {Atom} right - The second atom.\r\n * @param {number} order - Order of current bond.\r\n * @param {number} type - Bond type.\r\n * @param {boolean} fixed - Indicator of a pre-specified connection (in contrast with guessed one).\r\n *\r\n * @exports Bond\r\n * @constructor\r\n */\r\nclass Bond {\r\n constructor(left, right, order, type, fixed) {\r\n this._left = left;\r\n this._right = right;\r\n this._fixed = fixed;\r\n this._index = -1;\r\n if (left > right) {\r\n throw new Error('In a bond atom indices must be in increasing order');\r\n }\r\n this._order = order;\r\n this._type = type;\r\n }\r\n\r\n getLeft() {\r\n return this._left;\r\n }\r\n\r\n getRight() {\r\n return this._right;\r\n }\r\n\r\n getOrder() {\r\n return this._order;\r\n }\r\n\r\n calcLength() {\r\n return this._left.position.distanceTo(this._right.position);\r\n }\r\n\r\n _forEachNeighbour(currAtom, process) {\r\n const { bonds } = currAtom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]._left !== currAtom ? bonds[i]._left : bonds[i]._right);\r\n }\r\n }\r\n\r\n forEachLevelOne(process) {\r\n const left = this._left;\r\n const right = this._right;\r\n this._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n this._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n }\r\n\r\n forEachLevelTwo(process) {\r\n // TODO refactor this piece of an art?\r\n const left = this._left;\r\n const right = this._right;\r\n const self = this;\r\n self._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === left) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n self._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === right) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n }\r\n\r\n _fixDir(refPoint, currDir, posGetter) {\r\n // count atoms to the right and to the left of the current plane\r\n let rightCount = 0;\r\n let leftCount = 0;\r\n const tmpVec = refPoint.clone();\r\n function checkDir(atom) {\r\n tmpVec.copy(posGetter(atom));\r\n tmpVec.sub(refPoint);\r\n const dotProd = currDir.dot(tmpVec);\r\n if (dotProd > 0) {\r\n ++rightCount;\r\n } else {\r\n ++leftCount;\r\n }\r\n }\r\n function checkCarbon(atom) {\r\n if (atom.element.name === 'C') {\r\n checkDir(atom);\r\n }\r\n }\r\n // count all atoms to the left and right of our plane, start from level 1 and carbons\r\n const stages = [\r\n [this.forEachLevelOne, checkCarbon],\r\n [this.forEachLevelOne, checkDir],\r\n [this.forEachLevelTwo, checkCarbon],\r\n [this.forEachLevelTwo, checkDir],\r\n ];\r\n\r\n for (let stageId = 0; stageId < stages.length; ++stageId) {\r\n stages[stageId][0].call(this, stages[stageId][1]);\r\n if (leftCount > rightCount) {\r\n return currDir.multiplyScalar(-1);\r\n }\r\n if (leftCount < rightCount) {\r\n return currDir;\r\n }\r\n }\r\n return currDir;\r\n }\r\n\r\n calcNormalDir(posGetter) {\r\n const left = this._left;\r\n const right = this._right;\r\n let first = left;\r\n let second = right;\r\n posGetter = posGetter === undefined ? getAtomPos : posGetter;\r\n if (left.bonds.length > right.bonds.length) {\r\n first = right;\r\n second = left;\r\n }\r\n let third = first;\r\n let maxNeibs = 0;\r\n const { bonds } = second;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n let another = bonds[i]._left;\r\n if (bonds[i]._left === second) {\r\n another = bonds[i]._right;\r\n }\r\n if (another.bonds.length > maxNeibs && another !== first) {\r\n third = another;\r\n maxNeibs = another.bonds.length;\r\n }\r\n }\r\n const secondPos = posGetter(second);\r\n const firstV = posGetter(first).clone().sub(secondPos);\r\n const secondV = posGetter(third).clone().sub(secondPos);\r\n secondV.crossVectors(firstV, secondV);\r\n if (secondV.lengthSq() < 0.0001) {\r\n secondV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n secondV.normalize();\r\n firstV.crossVectors(secondV, firstV);\r\n if (firstV.lengthSq() < 0.0001) {\r\n firstV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n return this._fixDir(secondPos, firstV, posGetter);\r\n }\r\n\r\n static BondType = cBondTypes;\r\n}\r\n\r\nBond.prototype.BondType = cBondTypes;\r\n\r\nexport default Bond;\r\n","import * as THREE from 'three';\r\nimport Atom from './Atom';\r\nimport Element from './Element';\r\n\r\nconst cNucleicControlNames = ['C3\\'', 'C3*', 'P', 'H5T', 'H3T'];\r\nconst cNucleicWing1Names = ['OP1', 'O1P'];\r\nconst cNucleicWing2Names = ['OP2', 'O2P'];\r\n\r\nconst cCylinderSource = ['C3\\'', 'C3*', 'C1', 'C1\\'', 'C1*', 'P'];\r\nconst cCylinderTarget = [{\r\n types: ['A', 'DA', 'G', 'DG'],\r\n atoms: ['N1'],\r\n}, {\r\n types: ['C', 'DC'],\r\n atoms: ['N3'],\r\n}, {\r\n types: ['T', 'DT', 'U', 'DU'],\r\n atoms: ['O4'],\r\n}];\r\n\r\n/**\r\n * Residue instance.\r\n *\r\n * @param {Chain} chain - Chain this residue belongs to.\r\n * @param {ResidueType} type - Generic residue instance type.\r\n * @param {number} sequence - Sequence ID.\r\n * @param {string} icode - One character insertion code (usually space or A-Z).\r\n *\r\n * @exports Residue\r\n * @constructor\r\n */\r\nclass Residue {\r\n constructor(chain, type, sequence, icode) {\r\n this._chain = chain;\r\n this._component = null;\r\n this._type = type;\r\n this._sequence = sequence;\r\n this._icode = icode;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n\r\n this._atoms = [];\r\n this._secondary = null;\r\n this._firstAtom = null;\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n this._lastAtom = null;\r\n this._controlPoint = null;\r\n this._midPoint = null;\r\n this._wingVector = null;\r\n this._cylinders = null;\r\n this._isValid = true;\r\n this._het = false;\r\n this._molecule = null;\r\n this.temperature = null;\r\n this.occupancy = null;\r\n }\r\n\r\n // Getters and setters\r\n getChain() {\r\n return this._chain;\r\n }\r\n\r\n getMolecule() {\r\n return this._molecule;\r\n }\r\n\r\n getType() {\r\n return this._type;\r\n }\r\n\r\n getSequence() {\r\n return this._sequence;\r\n }\r\n\r\n getSecondary() {\r\n return this._secondary;\r\n }\r\n\r\n getICode() {\r\n return this._icode;\r\n }\r\n\r\n // Other methods\r\n\r\n addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge) {\r\n const atom = new Atom(this, name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n const complex = this._chain.getComplex();\r\n complex.addAtom(atom);\r\n this._atoms.push(atom);\r\n this._het = this._het || het;\r\n return atom;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n if (process(atoms[i])) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n _findAtomByName(name) {\r\n let res = null;\r\n this.forEachAtom((atom) => {\r\n if (atom.name === name) {\r\n res = atom;\r\n return true;\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _findFirstAtomInList(names) {\r\n let res = null;\r\n for (let i = 0; i < names.length; ++i) {\r\n res = this._findAtomByName(names[i]);\r\n if (res !== null) {\r\n return res;\r\n }\r\n }\r\n return res;\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n mask &= atoms[i].mask;\r\n }\r\n this._mask = mask;\r\n }\r\n\r\n getCylinderTargetList() {\r\n const type = this._type._name;\r\n for (let i = 0, n = cCylinderTarget.length; i < n; ++i) {\r\n for (let j = 0, m = cCylinderTarget[i].types.length; j < m; ++j) {\r\n if (type === cCylinderTarget[i].types[j]) {\r\n return cCylinderTarget[i].atoms;\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n _detectLeadWing(dst, next, getAtomPosition) {\r\n const leadAtom = this._findFirstAtomInList(cNucleicControlNames);\r\n let wingStart = this._findFirstAtomInList(cNucleicWing1Names);\r\n let wingEnd = this._findFirstAtomInList(cNucleicWing2Names);\r\n\r\n if (wingStart === null && next !== null) {\r\n wingStart = next._findFirstAtomInList(cNucleicWing1Names);\r\n }\r\n\r\n if (wingEnd === null && next !== null) {\r\n wingEnd = next._findFirstAtomInList(cNucleicWing2Names);\r\n }\r\n\r\n if (leadAtom === null || wingStart === null || wingEnd === null) {\r\n return;\r\n }\r\n\r\n dst._leadAtom = leadAtom;\r\n dst._controlPoint = getAtomPosition(leadAtom);\r\n dst._wingVector = getAtomPosition(wingEnd).clone().sub(getAtomPosition(wingStart));\r\n dst._isValid = true;\r\n\r\n const cylSource = this._findFirstAtomInList(cCylinderSource);\r\n const targetList = this.getCylinderTargetList();\r\n const cylTarget = targetList !== null ? this._findFirstAtomInList(targetList) : null;\r\n if (cylSource === null || cylTarget === null) {\r\n return;\r\n }\r\n dst._cylinders = [getAtomPosition(cylSource), getAtomPosition(cylTarget)];\r\n }\r\n\r\n calcWing(prevLeadPos, currLeadPos, prevWingPos, prevWing) {\r\n const vectorA = currLeadPos.clone().sub(prevLeadPos);\r\n const vectorB = prevLeadPos.clone().sub(prevWingPos);\r\n vectorB.crossVectors(vectorA, vectorB);\r\n vectorB.crossVectors(vectorA, vectorB).normalize();\r\n if (prevWing !== null && prevWing.length() > 0.0001) {\r\n const needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2;\r\n if (needToNegate) {\r\n vectorB.negate();\r\n }\r\n }\r\n return vectorB;\r\n }\r\n\r\n _innerFinalize(prevRes, prev, nextRes, dst, chainAsNucleic, getAtomPosition) {\r\n const bFirstInChain = prev === null;\r\n\r\n const lp = getAtomPosition(this._leadAtom);\r\n const currLeadPos = new THREE.Vector3(lp.x, lp.y, lp.z);\r\n if (chainAsNucleic) {\r\n this._detectLeadWing(dst, nextRes, getAtomPosition);\r\n return;\r\n }\r\n\r\n if (bFirstInChain) { // for first one in chain\r\n dst._midPoint = getAtomPosition(this._firstAtom).clone();\r\n } else {\r\n const prevLeadPos = prev._controlPoint; // lead point of previous monomer\r\n dst._midPoint = prevLeadPos.clone().lerp(currLeadPos, 0.5);\r\n dst._wingVector = this.calcWing(prevLeadPos, currLeadPos, getAtomPosition(prevRes._wingAtom), prev._wingVector);\r\n }\r\n dst._controlPoint = currLeadPos;\r\n }\r\n\r\n _finalize2(prev, next, asNucleic) {\r\n // Should be called AFTER first finalize\r\n this._innerFinalize(prev, prev, next, this, asNucleic, (atom) => atom.position);\r\n }\r\n\r\n isConnected(anotherResidue) {\r\n if (this._chain !== anotherResidue._chain) {\r\n return false;\r\n }\r\n if (this === anotherResidue) {\r\n return true;\r\n }\r\n let res = false;\r\n this.forEachAtom((atom) => {\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue === anotherResidue || bond._right.residue === anotherResidue) {\r\n res = true;\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _finalize() {\r\n const self = this;\r\n [this._firstAtom] = this._atoms;\r\n this._lastAtom = this._atoms[this._atoms.length - 1];\r\n\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n\r\n let tempCount = 0;\r\n let temperature = 0; // average temperature\r\n let occupCount = 0;\r\n let occupancy = 0; // average occupancy\r\n this.forEachAtom((a) => {\r\n if (self._leadAtom === null) {\r\n if (a.role === Element.Constants.Lead) {\r\n self._leadAtom = a;\r\n }\r\n }\r\n if (self._wingAtom === null) {\r\n if (a.role === Element.Constants.Wing) {\r\n self._wingAtom = a;\r\n }\r\n }\r\n if (a.temperature) {\r\n temperature += a.temperature;\r\n tempCount++;\r\n }\r\n if (a.occupancy) {\r\n occupancy += a.occupancy;\r\n occupCount++;\r\n }\r\n return (self._leadAtom !== null && self._wingAtom !== null);\r\n });\r\n\r\n if (tempCount > 0) {\r\n this.temperature = temperature / tempCount;\r\n }\r\n if (occupCount > 0) {\r\n this.occupancy = occupancy / occupCount;\r\n }\r\n\r\n // Still try to make monomer look valid\r\n if (this._leadAtom === null || this._wingAtom === null) {\r\n this._isValid = false;\r\n }\r\n if (this._leadAtom === null) {\r\n this._leadAtom = this._firstAtom;\r\n }\r\n if (this._wingAtom === null) {\r\n this._wingAtom = this._lastAtom;\r\n }\r\n }\r\n}\r\n\r\nexport default Residue;\r\n","/**\r\n * Residue type.\r\n *\r\n * Predefined acid or created with HET, HETNAM, etc.\r\n *\r\n * @param {string} name - Short name, either standard (ALA, MET, etc.) or non-standard one.\r\n * @param {string} fullName - Full residue name.\r\n * @param {string} letterCode - 1-letter symbol.\r\n *\r\n * @exports ResidueType\r\n * @constructor\r\n */\r\nclass ResidueType {\r\n constructor(name, fullName, letterCode) {\r\n this._name = name;\r\n this._fullName = fullName;\r\n this.letterCode = letterCode;\r\n this.flags = 0x0000;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\n static StandardTypes = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: new ResidueType('ALA', 'Alanine', 'A'),\r\n ARG: new ResidueType('ARG', 'Arginine', 'R'),\r\n ASN: new ResidueType('ASN', 'Asparagine', 'N'),\r\n ASP: new ResidueType('ASP', 'Aspartic Acid', 'D'),\r\n CYS: new ResidueType('CYS', 'Cysteine', 'C'),\r\n GLN: new ResidueType('GLN', 'Glutamine', 'Q'),\r\n GLU: new ResidueType('GLU', 'Glutamic Acid', 'E'),\r\n GLY: new ResidueType('GLY', 'Glycine', 'G'),\r\n HIS: new ResidueType('HIS', 'Histidine', 'H'),\r\n ILE: new ResidueType('ILE', 'Isoleucine', 'I'),\r\n LEU: new ResidueType('LEU', 'Leucine', 'L'),\r\n LYS: new ResidueType('LYS', 'Lysine', 'K'),\r\n MET: new ResidueType('MET', 'Methionine', 'M'),\r\n PHE: new ResidueType('PHE', 'Phenylalanine', 'F'),\r\n PRO: new ResidueType('PRO', 'Proline', 'P'),\r\n PYL: new ResidueType('PYL', 'Pyrrolysine', 'O'),\r\n SEC: new ResidueType('SEC', 'Selenocysteine', 'U'),\r\n SER: new ResidueType('SER', 'Serine', 'S'),\r\n THR: new ResidueType('THR', 'Threonine', 'T'),\r\n TRP: new ResidueType('TRP', 'Tryptophan', 'W'),\r\n TYR: new ResidueType('TYR', 'Tyrosine', 'Y'),\r\n VAL: new ResidueType('VAL', 'Valine', 'V'),\r\n A: new ResidueType('A', 'Adenine', 'A'),\r\n C: new ResidueType('C', 'Cytosine', 'C'),\r\n G: new ResidueType('G', 'Guanine', 'G'),\r\n I: new ResidueType('I', 'Inosine', 'I'),\r\n T: new ResidueType('T', 'Thymine', 'T'),\r\n U: new ResidueType('U', 'Uracil', 'U'),\r\n DA: new ResidueType('DA', 'Adenine', 'A'),\r\n DC: new ResidueType('DC', 'Cytosine', 'C'),\r\n DG: new ResidueType('DG', 'Guanine', 'G'),\r\n DI: new ResidueType('DI', 'Inosine', 'I'),\r\n DT: new ResidueType('DT', 'Thymine', 'T'),\r\n DU: new ResidueType('DU', 'Uracil', 'U'),\r\n '+A': new ResidueType('+A', 'Adenine', 'A'),\r\n '+C': new ResidueType('+C', 'Cytosine', 'C'),\r\n '+G': new ResidueType('+G', 'Guanine', 'G'),\r\n '+I': new ResidueType('+I', 'Inosine', 'I'),\r\n '+T': new ResidueType('+T', 'Thymine', 'T'),\r\n '+U': new ResidueType('+U', 'Uracil', 'U'),\r\n WAT: new ResidueType('WAT', 'Water', ''),\r\n H2O: new ResidueType('H2O', 'Water', ''),\r\n HOH: new ResidueType('HOH', 'Water', ''),\r\n DOD: new ResidueType('DOD', 'Water', ''),\r\n UNK: new ResidueType('UNK', 'Unknown', ''),\r\n UNL: new ResidueType('UNL', 'Unknown Ligand', ''),\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n /**\r\n * Enumeration of residue flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n // Amino acids\r\n /** Amino acid residue */\r\n PROTEIN: 0x0001,\r\n /** Basic amino acid residue */\r\n BASIC: 0x0002,\r\n /** Acidic amino acid residue */\r\n ACIDIC: 0x0004,\r\n /** Polar uncharged side chain amino acid residue */\r\n POLAR: 0x0008,\r\n /** Non-polar hydrophobic side chain amino acid residue */\r\n NONPOLAR: 0x0010,\r\n /** Aromatic amino acid residue */\r\n AROMATIC: 0x0020,\r\n\r\n // Nucleic acids\r\n\r\n /** Nucleic residue */\r\n NUCLEIC: 0x0100,\r\n /** Purine nucleic residue */\r\n PURINE: 0x0200,\r\n /** Pyrimidine nucleic residue */\r\n PYRIMIDINE: 0x0400,\r\n /** DNA */\r\n DNA: 0x0800,\r\n /** RNA */\r\n RNA: 0x1000,\r\n\r\n /** Water */\r\n WATER: 0x10000,\r\n };\r\n}\r\n\r\n// Flag combinations\r\nfunction _addFlag(flag, list) {\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const res = ResidueType.StandardTypes[list[i]];\r\n if (res) {\r\n res.flags |= flag;\r\n }\r\n }\r\n}\r\n\r\nconst { Flags } = ResidueType;\r\n_addFlag(Flags.WATER, ['WAT', 'H2O', 'HOH', 'DOD']);\r\n\r\n_addFlag(Flags.PROTEIN, [\r\n 'ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLY', 'GLU', 'GLN', 'HIS', 'ILE',\r\n 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'PYL', 'SEC', 'SER', 'THR', 'TRP',\r\n 'TYR', 'VAL',\r\n]);\r\n_addFlag(Flags.BASIC, ['ARG', 'HIS', 'LYS']);\r\n_addFlag(Flags.ACIDIC, ['ASP', 'GLU']);\r\n_addFlag(Flags.POLAR, ['ASN', 'CYS', 'GLN', 'SER', 'THR', 'TYR']);\r\n_addFlag(Flags.NONPOLAR, ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'VAL', 'GLY']);\r\n_addFlag(Flags.AROMATIC, ['PHE', 'TRP', 'TYR']);\r\n\r\n_addFlag(Flags.NUCLEIC, [\r\n 'A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I',\r\n 'C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U',\r\n]);\r\n_addFlag(Flags.PURINE, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I']);\r\n_addFlag(Flags.PYRIMIDINE, ['C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']);\r\n_addFlag(Flags.DNA, ['DA', 'DG', 'DI', 'DC', 'DT', 'DU']);\r\n_addFlag(Flags.RNA, ['A', 'G', 'I', 'C', 'T', 'U']);\r\n// Table of kdHydrophobicity\r\nconst hydro = {\r\n ILE: 4.5,\r\n VAL: 4.2,\r\n LEU: 3.8,\r\n PHE: 2.8,\r\n CYS: 2.5,\r\n MET: 1.9,\r\n ALA: 1.8,\r\n GLY: -0.4,\r\n THR: -0.7,\r\n SER: -0.8,\r\n TRP: -0.9,\r\n TYR: -1.3,\r\n PRO: -1.6,\r\n HIS: -3.2,\r\n GLU: -3.5,\r\n GLN: -3.5,\r\n ASP: -3.5,\r\n ASN: -3.5,\r\n LYS: -3.9,\r\n ARG: -4.5,\r\n};\r\n\r\nfunction _addParam(param, list) {\r\n const keys = Object.keys(list);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = list[key];\r\n ResidueType.StandardTypes[key][param] = value;\r\n }\r\n}\r\n\r\n_addParam('hydrophobicity', hydro);\r\n\r\nexport default ResidueType;\r\n","import * as THREE from 'three';\r\nimport Residue from './Residue';\r\nimport ResidueType from './ResidueType';\r\n\r\n/**\r\n * Residues in chain are either amino acid either nucleic acid (and water)\r\n * There might be some modified/mutated residues, which type could not be determined by their name (nucleic or amino); In this\r\n * case firstly program definites the chain type (by well-known residues) and then definites modified/mutated residues\r\n */\r\nconst ChainType = {\r\n UNKNOWN: 0,\r\n PROTEIN: 1,\r\n NUCLEIC: 2,\r\n};\r\n\r\n/**\r\n * Residue chain.\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n * @param {string} name - One character identifier (usually space, A-Z, 0-9, or a-z).\r\n *\r\n * @exports Chain\r\n * @constructor\r\n */\r\nclass Chain {\r\n constructor(complex, name) {\r\n this._complex = complex;\r\n this._name = name;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n this._residues = [];\r\n\r\n this.minSequence = Number.POSITIVE_INFINITY;\r\n this.maxSequence = Number.NEGATIVE_INFINITY;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n _determineType() {\r\n const residues = this._residues;\r\n\r\n const { PROTEIN, NUCLEIC } = ResidueType.Flags;\r\n\r\n this.type = ChainType.UNKNOWN;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const { flags } = residues[i]._type;\r\n\r\n if ((flags & NUCLEIC) !== 0) {\r\n this.type = ChainType.NUCLEIC;\r\n break;\r\n } else if ((flags & PROTEIN) !== 0) {\r\n this.type = ChainType.PROTEIN;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Finds thre residue with specified sequence number and inserion code\r\n * @param {Number} seqNum sequence number\r\n * @param {string} iCode insertion code\r\n * @returns {*} Residue or null if not found\r\n */\r\n findResidue(seqNum, iCode) {\r\n const residues = this._residues;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n if (res._sequence === seqNum && res._icode === iCode) {\r\n return [res, i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _finalize() {\r\n this._determineType();\r\n\r\n const residues = this._residues;\r\n\r\n let prev = null;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const next = (i + 1 < n) ? residues[i + 1] : null;\r\n const curr = residues[i];\r\n // TODO: skip invalid residues\r\n if (1 /* curr._isValid */) { // eslint-disable-line no-constant-condition\r\n curr._finalize2(prev, next, this.type === ChainType.NUCLEIC);\r\n prev = curr;\r\n }\r\n }\r\n\r\n // fix very first wing\r\n if (residues.length > 1 && residues[1]._wingVector) {\r\n const p = residues[1]._wingVector;\r\n residues[0]._wingVector = new THREE.Vector3(p.x, p.y, p.z);\r\n } else if (residues.length > 0) {\r\n residues[0]._wingVector = new THREE.Vector3(1, 0, 0);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const residues = this._residues;\r\n let prev = null;\r\n let prevData = null;\r\n const frameRes = frameData._residues;\r\n const n = residues.length;\r\n function getAtomPos(atom) {\r\n return frameData.getAtomPos(atom.index);\r\n }\r\n\r\n for (let i = 0; i < n; ++i) {\r\n const curr = residues[i];\r\n const currData = frameRes[curr._index];\r\n const nextRes = (i + 1 < n) ? residues[i + 1] : null;\r\n curr._innerFinalize(prev, prevData, nextRes, currData, this.type === ChainType.NUCLEIC, getAtomPos);\r\n prev = curr;\r\n prevData = currData;\r\n }\r\n\r\n frameRes[residues[0]._index]._wingVector = n > 1\r\n ? frameRes[residues[1]._index]._wingVector\r\n : new THREE.Vector3(1, 0, 0);\r\n }\r\n\r\n /**\r\n * Create a new residue.\r\n *\r\n * @param {string} name - Residue name.\r\n * @param {number} sequence - Residue sequence number.\r\n * @param {string} iCode - Insertion code.\r\n * @returns {Residue} - Newly created residue instance.\r\n */\r\n addResidue(name, sequence, iCode) {\r\n let type = this._complex.getResidueType(name);\r\n if (type === null) {\r\n type = this._complex.addResidueType(name);\r\n }\r\n const residue = new Residue(this, type, sequence, iCode);\r\n this._complex.addResidue(residue);\r\n this._residues.push(residue);\r\n\r\n if (type.flags & (ResidueType.Flags.NUCLEIC | ResidueType.Flags.PROTEIN)) {\r\n if (this.maxSequence < sequence) {\r\n this.maxSequence = sequence;\r\n }\r\n if (this.minSequence > sequence) {\r\n this.minSequence = sequence;\r\n }\r\n }\r\n\r\n return residue;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this._mask = mask;\r\n }\r\n}\r\n\r\nexport default Chain;\r\n","import Residue from './Residue';\r\n\r\n/** An element of protein secondary structure. */\r\nclass StructuralElement {\r\n /**\r\n * Create a secondary structural element of the specified type.\r\n *\r\n * @param {StructuralElement.Type} type Secondary structure type.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n */\r\n constructor(type, init, term) {\r\n /**\r\n * Secondary structure type.\r\n * @type {StructuralElement.Type}\r\n */\r\n this.type = type;\r\n /**\r\n * Generic secondary structure type.\r\n * @type {StructuralElement.Generic}\r\n */\r\n this.generic = StructuralElement.genericByType[this.type] || 'loop';\r\n /**\r\n * Initial residue.\r\n * @type Residue\r\n */\r\n this.init = init;\r\n /**\r\n * Terminal residue.\r\n * @type Residue\r\n */\r\n this.term = term;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n if (this.init instanceof Residue && this.term instanceof Residue) {\r\n return;\r\n }\r\n\r\n // Link all intermediate residues to this structural element\r\n const start = complex.splitUnifiedSerial(this.init);\r\n const end = complex.splitUnifiedSerial(this.term);\r\n for (let chainId = start.chain; chainId <= end.chain; chainId++) {\r\n for (let serialId = start.serial; serialId <= end.serial; serialId++) {\r\n for (let { iCode } = start; iCode <= end.iCode; iCode++) {\r\n const hashCode = complex.getUnifiedSerial(chainId, serialId, iCode);\r\n if (residueHash[hashCode]) {\r\n residueHash[hashCode]._secondary = this;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Replace unfined serials by objects\r\n this.init = residueHash[this.init];\r\n this.term = residueHash[this.term];\r\n }\r\n}\r\n\r\n/**\r\n * Specific type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Generic\r\n */\r\nStructuralElement.Type = {\r\n /** A strand of a [beta-sheet](https://en.wikipedia.org/wiki/Beta_sheet). */\r\n STRAND: 'E',\r\n /** An isolated beta-bridge (too small for a beta-sheet). */\r\n BRIDGE: 'B',\r\n\r\n /** A [3/10 helix](https://en.wikipedia.org/wiki/310_helix) (hydrogen bonding is 3 residues apart). */\r\n HELIX_310: 'G',\r\n /** An [alpha-helix](https://en.wikipedia.org/wiki/Alpha_helix) (hydrogen bonding is 4 residues apart). */\r\n HELIX_ALPHA: 'H',\r\n /** A [pi-helix](https://en.wikipedia.org/wiki/Pi_helix) (hydrogen bonding is 5 residues apart). */\r\n HELIX_PI: 'I',\r\n /** A generic helix of unspecified bonding distance. */\r\n HELIX: 'X',\r\n\r\n /** An isolated 3/10-like helical turn. */\r\n TURN_310: '3',\r\n /** An isolated alpha-like helical turn. */\r\n TURN_ALPHA: '4',\r\n /** An isolated pi-like helical turn. */\r\n TURN_PI: '5',\r\n /** An isolated helical [turn](https://en.wikipedia.org/wiki/Turn_(biochemistry)) of unspecified bonding distance. */\r\n TURN: 'T',\r\n\r\n /** A bend (a region of high curvature). */\r\n BEND: 'S',\r\n /** Just a protein section with no particular conformation. */\r\n COIL: 'C',\r\n};\r\n\r\n/**\r\n * Generic type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Type\r\n */\r\nStructuralElement.Generic = {\r\n /** A strand of a sheet. */\r\n STRAND: 'strand',\r\n /** A helix. */\r\n HELIX: 'helix',\r\n /** Just a protein section with no particular conformation. */\r\n LOOP: 'loop',\r\n};\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\nconst StructuralElementGeneric = StructuralElement.Generic;\r\n\r\n/**\r\n * A mapping from specific types to generic ones.\r\n * @type {Object}\r\n */\r\nStructuralElement.genericByType = {\r\n [StructuralElementType.STRAND]: StructuralElementGeneric.STRAND,\r\n [StructuralElementType.HELIX_310]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_ALPHA]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_PI]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX]: StructuralElementGeneric.HELIX,\r\n};\r\n\r\nexport default StructuralElement;\r\n","import StructuralElement from './StructuralElement';\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\nexport const typeByPDBHelixClass = {\r\n 1: StructuralElementType.HELIX_ALPHA,\r\n 3: StructuralElementType.HELIX_PI,\r\n 5: StructuralElementType.HELIX_310,\r\n};\r\n\r\n/**\r\n * Helical secondary structure of a protein.\r\n * @extends StructuralElement\r\n */\r\nclass Helix extends StructuralElement {\r\n /**\r\n * Create a helix.\r\n *\r\n * @param {number} helixClass A helix class according to the\r\n * [PDB Format](http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX).\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} serial Serial number of the helix (see PDB Format).\r\n * @param {string} name Helix identifier (see PDB Format).\r\n * @param {string} comment Comment about this helix (see PDB Format).\r\n * @param {number} length Length of this helix, in residues (see PDB Format).\r\n */\r\n constructor(helixClass, init, term, serial, name, comment, length) {\r\n super(typeByPDBHelixClass[helixClass] || StructuralElement.Type.HELIX, init, term);\r\n\r\n /**\r\n * Serial number of the helix (see PDB Format).\r\n * @type {number}\r\n */\r\n this.serial = serial;\r\n /**\r\n * Helix identifier (see PDB Format).\r\n * @type {string}\r\n */\r\n this.name = name;\r\n /**\r\n * Comment about this helix (see PDB Format).\r\n * @type {string}\r\n */\r\n this.comment = comment;\r\n /**\r\n * Length of this helix, in residues (see PDB Format).\r\n * @type {number}\r\n */\r\n this.length = length;\r\n }\r\n}\r\n\r\nexport default Helix;\r\n","import StructuralElement from './StructuralElement';\r\n\r\n/**\r\n * A single strand of a sheet in a protein secondary structure.\r\n * @extends StructuralElement\r\n */\r\nclass Strand extends StructuralElement {\r\n /**\r\n * Create a strand.\r\n *\r\n * @param {Sheet} sheet Parent sheet this strand belongs to.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} sense Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @param {Atom} atomCur Atom in current strand (see PDB Format).\r\n * @param {Atom} atomPrev Atom in previous strand (see PDB Format).\r\n */\r\n constructor(sheet, init, term, sense, atomCur, atomPrev) {\r\n super(StructuralElement.Type.STRAND, init, term);\r\n\r\n /**\r\n * Parent sheet this strand belongs to.\r\n * @type {Sheet}\r\n */\r\n this.sheet = sheet;\r\n /**\r\n * Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @type {number}\r\n */\r\n this.sense = sense;\r\n /**\r\n * Atom in current strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomCur = atomCur;\r\n /**\r\n * Atom in previous strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomPrev = atomPrev;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n *\r\n * @override\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n super._finalize(serialAtomMap, residueHash, complex);\r\n\r\n let as = this.atomCur;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomCur = serialAtomMap[as];\r\n }\r\n as = this.atomPrev;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomPrev = serialAtomMap[as];\r\n }\r\n }\r\n}\r\n\r\nexport default Strand;\r\n","import Strand from './Strand';\r\n\r\n/**\r\n * Sheet secondary structure of a protein.\r\n *\r\n * @param {string} name -\r\n * @param {number} width -\r\n *\r\n * @exports Sheet\r\n * @constructor\r\n */\r\nclass Sheet {\r\n constructor(name, width) {\r\n this._name = name;\r\n this._width = width;\r\n\r\n this._strands = [];\r\n }\r\n\r\n // Getters and setters\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getWidth() {\r\n return this._width;\r\n }\r\n\r\n addStrand(strand) {\r\n this._strands.push(strand);\r\n this._width = this._strands.length;\r\n }\r\n\r\n addEmptyStrand() {\r\n this._strands.push(new Strand(null, null, null, null, null, null));\r\n }\r\n\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n const s = this._strands;\r\n for (let i = 0, n = s.length; i < n; ++i) {\r\n s[i]._finalize(serialAtomMap, residueHash, complex);\r\n }\r\n if (!this._width) {\r\n this._width = s.length;\r\n }\r\n if (s.length !== this._width) {\r\n throw new Error(`Sheet ${this._name} is inconsistent.`);\r\n }\r\n }\r\n}\r\n\r\nexport default Sheet;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Atom measurements.\r\n *\r\n * @param {string} id - SGroup id\r\n * @param {string} name - Name of the group\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n * @param {array} atoms - Atoms group consists of\r\n * @param {object} saveNode - XML node from file for saving\r\n *\r\n * @exports SGroup\r\n * @constructor\r\n */\r\nclass SGroup {\r\n constructor(id, name, position, atoms, saveNode) {\r\n this._id = id;\r\n this._name = name;\r\n this._position = position || new THREE.Vector3();\r\n this._atoms = atoms || [];\r\n this._charge = 0; // default group charge\r\n this._repeat = 1; // how many times group repeated: always > 0\r\n this._center = null;\r\n this.xmlNodeRef = saveNode || null;\r\n }\r\n\r\n /**\r\n * Get atom full name.\r\n * @returns {string} Atom full name.\r\n */\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getPosition() {\r\n return this._position;\r\n }\r\n\r\n getCentralPoint() {\r\n return this._center;\r\n }\r\n\r\n _rebuildSGroupOnAtomChange() {\r\n const nLimon = 100000000;\r\n if (this._center === null) {\r\n return; // nothing to do if we are not relative\r\n }\r\n\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n for (let j = 0, n = this._atoms.length; j < n; j++) {\r\n const aPos = this._atoms[j].position;\r\n bLow.set(Math.min(bLow.x, aPos.x), Math.min(bLow.y, aPos.y), Math.min(bLow.z, aPos.z));\r\n bHight.set(Math.max(bHight.x, aPos.x), Math.max(bHight.y, aPos.y), Math.max(bHight.z, aPos.z));\r\n }\r\n this._center.addVectors(bLow, bHight);\r\n this._center.multiplyScalar(0.5);\r\n }\r\n}\r\n\r\nexport default SGroup;\r\n","import utils from '../../utils';\r\n\r\n//----------------------------------------------------------------------------\r\nclass Range {\r\n constructor(min, max) {\r\n this.min = min;\r\n this.max = typeof max === 'undefined' ? min : max;\r\n }\r\n\r\n includes(value) {\r\n return this.min <= value && value <= this.max;\r\n }\r\n\r\n toString() {\r\n const { min, max } = this;\r\n return min === max ? String(min) : [min, max].join(':');\r\n }\r\n\r\n toJSON() {\r\n return [this.min, this.max];\r\n }\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\nclass List {\r\n constructor(arg) {\r\n if (arg instanceof this.constructor) {\r\n // delegate construction to a different class\r\n // eslint-disable-next-line no-constructor-return\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n }\r\n\r\n append(value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n }\r\n\r\n toString() {\r\n return this._values.join(',');\r\n }\r\n\r\n toJSON() {\r\n const values = this._values;\r\n const result = [];\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n result[i] = value.toJSON ? value.toJSON() : value;\r\n }\r\n return result;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nclass RangeList extends List {\r\n includes(value) {\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n if (list[i].includes(value)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nconst valuesArray = [];\r\n\r\nclass ValueList extends List {\r\n constructor(arg, upperOnly) {\r\n const list = super(arg);\r\n if (upperOnly) {\r\n this.upperOnly = true;\r\n const values = list._values;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n if (typeof value === 'string') {\r\n values[i] = value.toUpperCase();\r\n }\r\n }\r\n } else {\r\n this.upperOnly = false;\r\n }\r\n // return constructed object\r\n // eslint-disable-next-line no-constructor-return\r\n return list;\r\n }\r\n\r\n includes(value) {\r\n // we do not convert to upper case here for perfomance reasons\r\n // if list is upper case only, value must be converted before it is sent up to here\r\n return this._values.indexOf(value) !== -1;\r\n }\r\n\r\n toString() {\r\n // Quote values that are not correct identifiers\r\n const values = this._values;\r\n valuesArray.length = 0;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n valuesArray[i] = utils.correctSelectorIdentifier(String(values[i]));\r\n }\r\n return valuesArray.join(',');\r\n }\r\n\r\n _validate(value) {\r\n return (this.upperOnly && typeof value === 'string') ? value.toUpperCase() : value;\r\n }\r\n\r\n append(value) {\r\n super.append(this._validate(value));\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n super.remove(this._validate(value));\r\n return this;\r\n }\r\n}\r\n\r\nexport {\r\n Range,\r\n List,\r\n RangeList,\r\n ValueList,\r\n};\r\n","import { RangeList, ValueList } from './selectArgs';\r\n\r\n/** Base class for atom selectors. */\r\nclass Selector {\r\n toString() {\r\n return this.keyword;\r\n }\r\n\r\n toJSON() {\r\n return [this.name];\r\n }\r\n}\r\n\r\nSelector.prototype.name = 'Error';\r\nSelector.prototype.keyword = 'error';\r\n\r\n/** Base class for list-based atom selectors. */\r\nclass ListSelector extends Selector {\r\n constructor(list) {\r\n super();\r\n this.list = list;\r\n }\r\n\r\n toString() {\r\n return `${this.keyword} ${this.list}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.list.toJSON()];\r\n }\r\n}\r\n\r\nclass RangeListSelector extends ListSelector {\r\n constructor(arg) {\r\n super(new RangeList(arg));\r\n }\r\n}\r\n\r\nclass ValueListSelector extends ListSelector {\r\n constructor(arg, caseSensitive) {\r\n super(new ValueList(arg, !caseSensitive));\r\n }\r\n}\r\n\r\nclass NoneSelector extends Selector {\r\n includesAtom(_atom) {\r\n return false;\r\n }\r\n}\r\n\r\nNoneSelector.prototype.name = 'None';\r\nNoneSelector.prototype.keyword = 'none';\r\n\r\nclass AllSelector extends Selector {\r\n includesAtom(_atom) {\r\n return true;\r\n }\r\n}\r\n\r\nAllSelector.prototype.name = 'All';\r\nAllSelector.prototype.keyword = 'all';\r\n\r\nexport {\r\n Selector,\r\n ListSelector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n};\r\n","import { Selector, NoneSelector } from './selectorsBase';\r\n\r\n//----------------------------------------------------------------------------\r\n// Operators\r\n//----------------------------------------------------------------------------\r\nconst none = new NoneSelector();\r\n\r\nclass PrefixOperator extends Selector {\r\n constructor(rhs) {\r\n super();\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nPrefixOperator.prototype.priority = 1;\r\n\r\nclass InfixOperator extends Selector {\r\n constructor(lhs, rhs) {\r\n super();\r\n this.lhs = lhs || none;\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const lhs = this.lhs.priority && this.lhs.priority > this.priority ? `(${this.lhs})` : this.lhs;\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${lhs} ${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.lhs.toJSON(), this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nInfixOperator.prototype.priority = 1000;\r\n\r\nexport { PrefixOperator, InfixOperator };\r\n","import Atom from './Atom';\r\nimport ResidueType from './ResidueType';\r\nimport { parser } from '../utils/SelectionParser';\r\nimport { Range, RangeList, ValueList } from './selectors/selectArgs';\r\nimport { PrefixOperator, InfixOperator } from './selectors/selectOps';\r\nimport {\r\n Selector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n} from './selectors/selectorsBase';\r\n\r\nconst keywords = {};\r\n\r\n//----------------------------------------------------------------------------\r\n// Named selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineSelector(name, SelectorClass) {\r\n const keyword = name.toLowerCase();\r\n SelectorClass.prototype.keyword = keyword;\r\n SelectorClass.prototype.name = name;\r\n\r\n const factory = ((...args) => new SelectorClass(...args));\r\n factory.SelectorClass = SelectorClass;\r\n keywords[keyword] = factory;\r\n\r\n return SelectorClass;\r\n}\r\n\r\ndefineSelector('Serial', class SerialSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.serial);\r\n }\r\n});\r\n\r\ndefineSelector('Name', class NameSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.name);\r\n }\r\n});\r\n\r\ndefineSelector('AltLoc', class AltLocSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(String.fromCharCode(atom.location));\r\n }\r\n});\r\n\r\ndefineSelector('Elem', class ElemSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.element.name);\r\n }\r\n});\r\n\r\ndefineSelector('Residue', class ResidueSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._type._name);\r\n }\r\n});\r\n\r\ndefineSelector('Sequence', class SequenceSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._sequence);\r\n }\r\n});\r\n\r\ndefineSelector('ICode', class ICodeSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._icode);\r\n }\r\n});\r\n\r\ndefineSelector('ResIdx', class ResIdxSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._index);\r\n }\r\n});\r\n\r\ndefineSelector('Chain', class ChainSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._chain._name);\r\n }\r\n});\r\n\r\ndefineSelector('Hetatm', class HetatmSelector extends Selector {\r\n includesAtom(atom) {\r\n return atom.het;\r\n }\r\n});\r\n\r\ndefineSelector('PolarH', class PolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.HYDROGEN;\r\n }\r\n});\r\n\r\ndefineSelector('NonPolarH', class NonPolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.NONPOLARH;\r\n }\r\n});\r\n\r\ndefineSelector('All', AllSelector);\r\n\r\ndefineSelector('None', NoneSelector);\r\n\r\nconst NULL_SELECTOR = keywords.none();\r\n\r\n//----------------------------------------------------------------------------\r\n// Named operators\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineOperator(name, priority, OperatorClass) {\r\n OperatorClass.prototype.priority = priority;\r\n return defineSelector(name, OperatorClass);\r\n}\r\ndefineOperator('Not', 1, class NotOperator extends PrefixOperator {\r\n includesAtom(atom) {\r\n return !this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('And', 2, class AndOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) && this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('Or', 3, class OrOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) || this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\n//----------------------------------------------------------------------------\r\n// Flag selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction byResidueTypeFlag(flag, name) {\r\n return defineSelector(name, class extends Selector {\r\n includesAtom(atom) {\r\n return (atom.residue._type.flags & flag) !== 0;\r\n }\r\n });\r\n}\r\n\r\nbyResidueTypeFlag(ResidueType.Flags.PROTEIN, 'Protein');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC, 'Basic');\r\nbyResidueTypeFlag(ResidueType.Flags.ACIDIC, 'Acidic');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC | ResidueType.Flags.ACIDIC, 'Charged');\r\nbyResidueTypeFlag(ResidueType.Flags.POLAR, 'Polar');\r\nbyResidueTypeFlag(ResidueType.Flags.NONPOLAR, 'NonPolar');\r\nbyResidueTypeFlag(ResidueType.Flags.AROMATIC, 'Aromatic');\r\nbyResidueTypeFlag(ResidueType.Flags.NUCLEIC, 'Nucleic');\r\nbyResidueTypeFlag(ResidueType.Flags.PURINE, 'Purine');\r\nbyResidueTypeFlag(ResidueType.Flags.PYRIMIDINE, 'Pyrimidine');\r\nbyResidueTypeFlag(ResidueType.Flags.WATER, 'Water');\r\n\r\n//----------------------------------------------------------------------------\r\nconst selectors = Object.create(keywords);\r\n\r\nselectors.Selector = Selector;\r\nselectors.RangeListSelector = RangeListSelector;\r\nselectors.ValueListSelector = ValueListSelector;\r\nselectors.Range = Range;\r\nselectors.RangeList = RangeList;\r\nselectors.ValueList = ValueList;\r\nselectors.PrefixOperator = PrefixOperator;\r\nselectors.InfixOperator = InfixOperator;\r\nselectors.Context = Object.create({});\r\n\r\nselectors.GetSelector = function (key) {\r\n if (!selectors.Context.hasOwnProperty(key)) {\r\n const exc = { message: `selector ${key} is not registered` };\r\n throw exc;\r\n }\r\n return selectors.Context[key] || NULL_SELECTOR;\r\n};\r\n\r\nselectors.ClearContext = function () {\r\n Object.keys(selectors.Context).forEach((k) => { delete selectors.Context[k]; });\r\n};\r\n\r\nselectors.keyword = function (key) {\r\n return keywords[key.toLowerCase()] || keywords.none;\r\n};\r\n\r\nselectors.parse = function (str) {\r\n const res = {};\r\n try {\r\n res.selector = parser.parse(str);\r\n } catch (e) {\r\n res.selector = NULL_SELECTOR;\r\n res.error = e.message;\r\n }\r\n return res;\r\n};\r\n\r\nparser.yy = selectors;\r\nparser.yy.parseError = parser.parseError; // workaround for incorrect JISON parser generator for AMD module\r\n\r\nexport default selectors;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\n\r\n/**\r\n * Basic biological unit class.\r\n *\r\n * @exports BiologicalUnit\r\n * @constructor\r\n */\r\nclass BiologicalUnit {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._selector = selectors.keyword('All')();\r\n this._boundaries = {\r\n boundingBox: new THREE.Box3(),\r\n boundingSphere: new THREE.Sphere(),\r\n };\r\n }\r\n\r\n computeBoundaries() {\r\n const atoms = this._complex._atoms;\r\n const n = atoms.length;\r\n const selector = this._selector;\r\n\r\n const { boundingBox } = this._boundaries;\r\n boundingBox.makeEmpty();\r\n if (n === 1) {\r\n boundingBox.expandByPoint(atoms[0].position);\r\n const bbc = new THREE.Vector3();\r\n boundingBox.getCenter(bbc);\r\n const s = 2 * atoms[0].element.radius;\r\n boundingBox.setFromCenterAndSize(bbc, new THREE.Vector3(s, s, s));\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (selector.includesAtom(atoms[i])) {\r\n boundingBox.expandByPoint(atoms[i].position);\r\n }\r\n }\r\n }\r\n\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n if (n === 1) {\r\n this._boundaries.boundingSphere.set(center, atoms[0].element.radius);\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (!selector.includesAtom(atoms[i])) {\r\n continue;\r\n }\r\n const pos = atoms[i].position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n this._boundaries.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n }\r\n\r\n getTransforms() {\r\n return [];\r\n }\r\n\r\n getSelector() {\r\n return this._selector;\r\n }\r\n\r\n getBoundaries() {\r\n return this._boundaries;\r\n }\r\n\r\n finalize() {\r\n }\r\n}\r\n\r\nexport default BiologicalUnit;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\nimport BiologicalUnit from './BiologicalUnit';\r\n\r\n/**\r\n * Biological assembly.\r\n *\r\n * @exports Assembly\r\n * @constructor\r\n */\r\n\r\nclass Assembly extends BiologicalUnit {\r\n constructor(complex) {\r\n super(complex);\r\n this.chains = [];\r\n this.matrices = [];\r\n }\r\n\r\n computeBoundaries() {\r\n super.computeBoundaries();\r\n // fix up the boundaries\r\n const { matrices } = this;\r\n const oldCenter = this._boundaries.boundingSphere.center;\r\n const oldRad = this._boundaries.boundingSphere.radius;\r\n const boundingBox = this._boundaries.boundingBox = new THREE.Box3();\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = matrices.length; i < n; ++i) {\r\n boundingBox.expandByPoint(oldCenter.clone().applyMatrix4(matrices[i]));\r\n }\r\n\r\n const newRad = boundingBox.max.distanceTo(boundingBox.min) / 2 + oldRad;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n this._boundaries.boundingSphere = new THREE.Sphere().set(center, newRad);\r\n boundingBox.max.addScalar(oldRad);\r\n boundingBox.min.subScalar(oldRad);\r\n }\r\n\r\n /**\r\n * Mark a chain as belonging to this biological assembly.\r\n * @param {string} chain - chain identifier, usually a single letter\r\n */\r\n addChain(chain) {\r\n this.chains[this.chains.length] = chain;\r\n }\r\n\r\n /**\r\n * Add a transformation matrix.\r\n * @param {THREE.Matrix4} matrix - transformation matrix\r\n */\r\n addMatrix(matrix) {\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n getTransforms() {\r\n return this.matrices;\r\n }\r\n\r\n finalize() {\r\n if (this.chains.length > 0) {\r\n this._selector = selectors.keyword('Chain')(this.chains);\r\n } else {\r\n this._selector = selectors.keyword('None')();\r\n }\r\n }\r\n}\r\n\r\nexport default Assembly;\r\n","/**\r\n * This class represents connected component as a part of a complex.\r\n * WARNING! The whole component entity is build under the assumption that residues\r\n * are placed in the chains and complex in ascending order of indices\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n *\r\n * @exports Component\r\n * @constructor\r\n */\r\nclass Component {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._index = -1;\r\n this._residueIndices = [];\r\n this._cycles = [];\r\n this._subDivs = [];\r\n this._residueCount = 0;\r\n }\r\n\r\n getResidues() {\r\n return this._complex._residues;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residueCount;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._complex._residues;\r\n const resIdc = this._residueIndices;\r\n for (let idIdc = 0, idCount = resIdc.length; idIdc < idCount; ++idIdc) {\r\n for (let idx = resIdc[idIdc].start, last = resIdc[idIdc].end; idx <= last; ++idx) {\r\n process(residues[idx]);\r\n }\r\n }\r\n }\r\n\r\n setSubDivs(subDivs) {\r\n this._subDivs = subDivs;\r\n let curr = 0;\r\n const resIdc = [];\r\n let resCnt = 0;\r\n for (let i = 0, n = subDivs.length; i < n; ++i) {\r\n if (i === n - 1 || subDivs[i].end + 1 !== subDivs[i + 1].start) {\r\n const { start } = subDivs[curr];\r\n const { end } = subDivs[i];\r\n resIdc[resIdc.length] = {\r\n start,\r\n end,\r\n };\r\n resCnt += end - start + 1;\r\n curr = i + 1;\r\n }\r\n }\r\n\r\n this._residueIndices = resIdc;\r\n this._residueCount = resCnt;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._complex._bonds;\r\n\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue._component === this) {\r\n process(bond);\r\n }\r\n }\r\n }\r\n\r\n update() {\r\n this.forEachCycle((cycle) => {\r\n cycle.update();\r\n });\r\n }\r\n\r\n forEachAtom(process) {\r\n this.forEachResidue((residue) => {\r\n residue.forEachAtom(process);\r\n });\r\n }\r\n\r\n addCycle(cycle) {\r\n this._cycles.push(cycle);\r\n }\r\n\r\n forEachCycle(process) {\r\n const cycles = this._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n process(cycles[i]);\r\n }\r\n }\r\n\r\n markResidues() {\r\n const self = this;\r\n self.forEachResidue((residue) => {\r\n residue._component = self;\r\n });\r\n }\r\n\r\n _forEachSubChain(mask, process) {\r\n const residues = this._complex._residues;\r\n const subs = this._subDivs;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let idx = subs[i].start, last = subs[i].end; idx <= last; ++idx) {\r\n const currRes = residues[idx];\r\n if (mask & currRes._mask && currRes._isValid) {\r\n let end = idx + 1;\r\n for (; end <= last; ++end) {\r\n const endRes = residues[end];\r\n if (!(mask & endRes._mask && endRes._isValid)) {\r\n break;\r\n }\r\n }\r\n process(i, idx, end - 1);\r\n idx = end;\r\n }\r\n }\r\n }\r\n }\r\n\r\n getMaskedSequences(mask) {\r\n const subs = [];\r\n let idx = 0;\r\n this._forEachSubChain(mask, (_subIdx, start, end) => {\r\n subs[idx++] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n\r\n getMaskedSubdivSequences(mask) {\r\n const subs = [];\r\n let currIdx = -1;\r\n let lastSubIdx = -1;\r\n const subDivs = this._subDivs;\r\n\r\n this._forEachSubChain(mask, (subIdx, start, end) => {\r\n if (lastSubIdx !== subIdx) {\r\n ++currIdx;\r\n subs[currIdx] = {\r\n arr: [],\r\n boundaries: subDivs[subIdx],\r\n };\r\n lastSubIdx = subIdx;\r\n }\r\n subs[currIdx].arr[subs[currIdx].arr.length] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n}\r\n\r\nexport default Component;\r\n","import utils from '../utils';\r\n\r\nconst cMaxPairsForHashCode = 32;\r\nconst cHashTableSize = 1024 * 1024;\r\nconst cNumbersPerPair = 4;\r\nconst cMaxNeighbours = 14;\r\nconst cInvalidVal = -1;\r\n// 89237 is a large simple number, can be used for pseudo random hash code create\r\nconst cBigPrime = 89237;\r\n\r\nclass AtomPairs {\r\n constructor(maxPairsEstimate) {\r\n this.numPairs = 0;\r\n this.numMaxPairs = maxPairsEstimate;\r\n this.intBuffer = utils.allocateTyped(Int32Array, maxPairsEstimate * cNumbersPerPair);\r\n for (let i = 0; i < maxPairsEstimate * cNumbersPerPair; i++) {\r\n this.intBuffer[i] = cInvalidVal;\r\n }\r\n this.hashBuffer = utils.allocateTyped(Int32Array, cHashTableSize * cMaxPairsForHashCode);\r\n for (let i = 0; i < cHashTableSize * cMaxPairsForHashCode; i++) {\r\n this.hashBuffer[i] = cInvalidVal;\r\n }\r\n }\r\n\r\n /**\r\n * Destroy all pairs memory\r\n */\r\n destroy() {\r\n this.intBuffer = null;\r\n this.hashBuffer = null;\r\n }\r\n\r\n /**\r\n * Add pair of atoms to collection\r\n * @param {number} indexA - Index of the 1st vertex.\r\n * @param {number} indexB - Index of the 2nd vertex.\r\n */\r\n addPair(indexA, indexB) {\r\n const ia = (indexA < indexB) ? indexA : indexB;\r\n const ib = (indexA > indexB) ? indexA : indexB;\r\n const codeToAdd = ia + (ib << cMaxNeighbours);\r\n\r\n const hashCode = (ia + (ib * cBigPrime)) & (cHashTableSize - 1);\r\n let j = hashCode * cMaxPairsForHashCode;\r\n let apI = 0;\r\n for (; apI < cMaxPairsForHashCode; apI++) {\r\n const code = this.hashBuffer[j + apI];\r\n if (code === cInvalidVal) {\r\n break;\r\n }\r\n if (code === codeToAdd) {\r\n return false;\r\n }\r\n }\r\n // add this new hash code\r\n if (apI >= cMaxPairsForHashCode) {\r\n throw new Error('addPair: increase cMaxPairsForHashCode');\r\n }\r\n this.hashBuffer[j + apI] = codeToAdd;\r\n\r\n // actually add\r\n if (this.numPairs >= this.numMaxPairs) {\r\n throw new Error('addPair: increase num pairs');\r\n }\r\n j = this.numPairs * cNumbersPerPair;\r\n this.intBuffer[j] = ia;\r\n this.intBuffer[j + 1] = ib;\r\n this.intBuffer[j + 2] = codeToAdd;\r\n this.numPairs++;\r\n return true;\r\n }\r\n}\r\n\r\nexport default AtomPairs;\r\n","import AtomPairs from './AtomPairs';\r\nimport Bond from './Bond';\r\n\r\nconst cProfileBondBuilder = false;\r\nconst cEstBondsMultiplier = 4;\r\nconst cSpaceCode = 32;\r\nconst cBondTolerance = 0.45;\r\nconst cVMDTolerance = 0.6;\r\nconst cBondRadInJMOL = true;\r\nconst cEpsilon = 0.001;\r\n\r\n/**\r\n * Get radius used for building bonds.\r\n *\r\n * @param {Atom} atom - Atom object.\r\n * @returns {number} special value for bonding radius for this atom\r\n */\r\nfunction _getBondingRadius(atom) {\r\n const { element } = atom;\r\n if (element) {\r\n return element.radiusBonding;\r\n }\r\n throw new Error('_getBondingRadius: Logic error.');\r\n}\r\n\r\nfunction _isAtomEligible(atom) {\r\n // build for all non-hetatm and for hetatm without bonds\r\n return !atom.isHet() || (atom.bonds && atom.bonds.length === 0);\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Complex} complex molecular complex\r\n\r\n * @exports AutoBond\r\n * @constructor\r\n */\r\nclass AutoBond {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._maxRad = 1.8;\r\n const bBox = this._complex.getDefaultBoundaries().boundingBox;\r\n this._vBoxMin = bBox.min.clone();\r\n this._vBoxMax = bBox.max.clone();\r\n\r\n this._pairCollection = null;\r\n }\r\n\r\n /**\r\n * Add existing pairs of connectors (from pdb file after its reading)\r\n * @returns {number} 0\r\n */\r\n _addExistingPairs() {\r\n const atoms = this._complex.getAtoms();\r\n const numAtoms = atoms.length;\r\n let aInd = 0;\r\n const collection = this._pairCollection;\r\n\r\n for (; aInd < numAtoms; aInd++) {\r\n const { bonds } = atoms[aInd];\r\n const numBondsForAtom = bonds.length;\r\n for (let bInd = 0; bInd < numBondsForAtom; bInd++) {\r\n const bond = bonds[bInd];\r\n const indTo = bond._left.index;\r\n if (indTo === aInd) {\r\n collection.addPair(aInd, bond._right.index);\r\n }\r\n } // for (b) all bonds in atom\r\n } // for (a)\r\n return 0;\r\n }\r\n\r\n _findPairs() {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const atoms = this._complex._atoms;\r\n const atomsNum = atoms.length;\r\n const self = this;\r\n\r\n let rA;\r\n let isHydrogenA;\r\n let posA;\r\n let locationA;\r\n let atomA;\r\n\r\n const processAtom = function (atomB) {\r\n if (isHydrogenA && atomB.isHydrogen()) {\r\n return;\r\n }\r\n\r\n const locationB = atomB.location;\r\n if ((locationA !== cSpaceCode)\r\n && (locationB !== cSpaceCode)\r\n && (locationA !== locationB)) {\r\n return;\r\n }\r\n\r\n const dist2 = posA.distanceToSquared(atomB.position);\r\n const rB = atomB.element.radiusBonding;\r\n const maxAcceptable = cBondRadInJMOL ? rA + rB + cBondTolerance : cVMDTolerance * (rA + rB);\r\n\r\n if (dist2 > (maxAcceptable * maxAcceptable)) {\r\n return;\r\n }\r\n\r\n if (dist2 < cEpsilon) {\r\n return;\r\n }\r\n\r\n self._pairCollection.addPair(atomA.index, atomB.index);\r\n };\r\n\r\n for (let i = 0; i < atomsNum; ++i) {\r\n atomA = atoms[i];\r\n if (!_isAtomEligible(atomA)) {\r\n continue;\r\n }\r\n\r\n rA = atomA.element.radiusBonding;\r\n isHydrogenA = atomA.isHydrogen();\r\n posA = atomA.position;\r\n locationA = atomA.location;\r\n\r\n vw.forEachAtomWithinRadius(posA, 2 * this._maxRad + cBondTolerance, processAtom);\r\n }\r\n }\r\n\r\n _addPairs() {\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0, k = 0; i < this._pairCollection.numPairs; i++, k += 4) {\r\n const iA = this._pairCollection.intBuffer[k];\r\n const iB = this._pairCollection.intBuffer[k + 1];\r\n this._addPair(atoms[iA], atoms[iB]);\r\n }\r\n }\r\n\r\n _addPair(atomA, atomB) {\r\n const bondsA = atomA.bonds;\r\n const indexA = atomA.index;\r\n const indexB = atomB.index;\r\n for (let j = 0, numBonds = bondsA.length; j < numBonds; ++j) {\r\n const bond = bondsA[j];\r\n if (bond._left.index === indexB || bond._right.index === indexB) {\r\n return;\r\n }\r\n }\r\n const left = indexA < indexB ? atomA : atomB;\r\n const right = indexA < indexB ? atomB : atomA;\r\n const newBond = this._complex.addBond(left, right, 0, Bond.BondType.UNKNOWN, false);\r\n bondsA.push(newBond);\r\n atomB.bonds.push(newBond);\r\n }\r\n\r\n build() {\r\n if (cProfileBondBuilder) {\r\n console.time('Bonds Builder');\r\n }\r\n this._buildInner();\r\n\r\n if (cProfileBondBuilder) {\r\n console.timeEnd('Bonds Builder');\r\n }\r\n }\r\n\r\n _buildInner() {\r\n const atoms = this._complex._atoms;\r\n if (atoms.length < 2) {\r\n return;\r\n }\r\n if (atoms[0].index < 0) {\r\n throw new Error('AutoBond: Atoms in complex were not indexed.');\r\n }\r\n\r\n this._calcBoundingBox();\r\n this._pairCollection = new AtomPairs(atoms.length * cEstBondsMultiplier);\r\n this._addExistingPairs();\r\n this._findPairs();\r\n this._addPairs();\r\n }\r\n\r\n _calcBoundingBox() {\r\n const atoms = this._complex._atoms;\r\n const nAtoms = atoms.length;\r\n let maxRad = _getBondingRadius(atoms[0]);\r\n for (let i = 1; i < nAtoms; ++i) {\r\n maxRad = Math.max(maxRad, _getBondingRadius(atoms[i]));\r\n }\r\n this._vBoxMax.addScalar(maxRad);\r\n this._vBoxMin.addScalar(-maxRad);\r\n this._maxRad = maxRad * 1.2;\r\n }\r\n\r\n destroy() {\r\n if (this._pairCollection) {\r\n this._pairCollection.destroy();\r\n }\r\n }\r\n}\r\n\r\nexport default AutoBond;\r\n","import * as THREE from 'three';\r\nimport Bond from './Bond';\r\nimport Element from './Element';\r\n\r\nconst cCrossThresh = 0.1;\r\nconst cAromaticType = Bond.BondType.AROMATIC;\r\nconst cAromaticAtoms = [\r\n Element.ByName.C.number,\r\n Element.ByName.N.number,\r\n // Element.ByName.O.number,\r\n // Element.ByName.S.number,\r\n];\r\n\r\n/** Conditions for bonds:\r\n * - Cross product with each subsequent bond to add is collinear and point to the same direction\r\n * - Each pair of a adjacent bonds belong to not more than one cycle\r\n * - If there is more than one candidates we try them in ascending order of angle values\r\n */\r\n\r\nconst _coDirVectors = (function () {\r\n const v1Tmp = new THREE.Vector3();\r\n const v2Tmp = new THREE.Vector3();\r\n const cp = new THREE.Vector3();\r\n return function (v1, v2) {\r\n v1Tmp.copy(v1).normalize();\r\n v2Tmp.copy(v2).normalize();\r\n cp.crossVectors(v1Tmp, v2Tmp);\r\n if (cp.length() > cCrossThresh) {\r\n return false;\r\n }\r\n // zero vector in out terms must be collinear to any\r\n return v1Tmp.dot(v2Tmp) >= 0;\r\n };\r\n}());\r\n\r\nfunction _insertAscending(arr, val) {\r\n let idx = 0;\r\n while (idx < arr.length && arr[idx] < val) {\r\n ++idx;\r\n }\r\n arr.splice(idx, 0, val);\r\n}\r\n\r\nfunction _anotherAtom(bond, currAtom) {\r\n return bond._left === currAtom ? bond._right : bond._left;\r\n}\r\n\r\nfunction _cosBetween(v1, v2) {\r\n const theta = v1.dot(v2) / (Math.sqrt(v1.lengthSq() * v2.lengthSq()));\r\n return THREE.MathUtils.clamp(theta, -1, 1);\r\n}\r\n\r\nfunction _markAromatic(bond) {\r\n bond._type = cAromaticType;\r\n}\r\n\r\nclass Cycle {\r\n constructor(atomsList) {\r\n this.atoms = atomsList;\r\n this.update();\r\n }\r\n\r\n update() {\r\n const { atoms } = this;\r\n const center = new THREE.Vector3();\r\n const nA = atoms.length;\r\n for (let j = 0; j < nA; ++j) {\r\n center.add(atoms[j].position);\r\n }\r\n center.multiplyScalar(1.0 / nA);\r\n this.center = center;\r\n this.radius = center.distanceTo(atoms[0].position.clone().lerp(atoms[1].position, 0.5));\r\n }\r\n\r\n forEachBond(process) {\r\n const { atoms } = this;\r\n const nA = atoms.length;\r\n let currAtom = atoms[0];\r\n let nextAtom;\r\n\r\n function checkBond(bond) {\r\n if (bond._left === nextAtom || bond._right === nextAtom) {\r\n process(bond);\r\n }\r\n }\r\n\r\n for (let i = 0; i < nA; ++i) {\r\n nextAtom = atoms[(i + 1) % nA];\r\n currAtom.forEachBond(checkBond);\r\n currAtom = nextAtom;\r\n }\r\n }\r\n}\r\n\r\nfunction _isAromatic(bond) {\r\n return bond._type === cAromaticType;\r\n}\r\n\r\nfunction _isPossibleAromatic(bond) {\r\n if (bond.type === cAromaticType) {\r\n return true;\r\n }\r\n const rightIdx = cAromaticAtoms.indexOf(bond._right.element.number);\r\n const leftIdx = cAromaticAtoms.indexOf(bond._left.element.number);\r\n return rightIdx !== -1 && leftIdx !== -1;\r\n}\r\n\r\nfunction _checkCycleSimple(cycle) {\r\n return cycle.length > 3;\r\n}\r\n\r\nfunction _checkCycleComplex(cycle) {\r\n console.assert(cycle.length > 2);\r\n return true;\r\n}\r\n\r\nclass AromaticLoopsMarker {\r\n constructor(complex) {\r\n this._complex = complex;\r\n const bondsData = new Array(complex._bonds.length);\r\n const bondMarks = new Array(complex._bonds.length);\r\n for (let i = 0, n = bondsData.length; i < n; ++i) {\r\n bondsData[i] = [];\r\n bondMarks[i] = false;\r\n }\r\n this._bondsData = bondsData;\r\n this._bondMarks = bondMarks;\r\n this._resetCycles();\r\n }\r\n\r\n _resetCycles() {\r\n this._cycles = [];\r\n this._currIdx = -1;\r\n }\r\n\r\n _haveSameCycle(bondsData, bond1, bond2) {\r\n const arr1 = bondsData[bond1._index];\r\n const arr2 = bondsData[bond2._index];\r\n const n1 = arr1.length;\r\n const n2 = arr2.length;\r\n let i1 = 0;\r\n let i2 = 0;\r\n while (i1 < n1 && i2 < n2) {\r\n if (arr1[i1] === arr2[i2]) {\r\n return true;\r\n }\r\n if (arr1[i1] > arr2[i2]) {\r\n ++i2;\r\n } else {\r\n ++i1;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _tryBond(prevBond, currRight, currDir) {\r\n const bondsOrder = [];\r\n const bondsData = this._bondsData;\r\n const currLeft = _anotherAtom(prevBond, currRight);\r\n const currVec = currRight.position.clone().sub(currLeft.position);\r\n const startAtomRef = this._currStart;\r\n const self = this;\r\n const bondMarks = this._bondMarks;\r\n let checkAromatic = this._checkBond;\r\n bondMarks[prevBond._index] = true;\r\n checkAromatic = checkAromatic === undefined ? _isAromatic : checkAromatic;\r\n currRight.forEachBond((newBond) => {\r\n if (!checkAromatic(newBond)\r\n || newBond === prevBond\r\n || bondMarks[newBond._index]\r\n || self._haveSameCycle(bondsData, prevBond, newBond)) {\r\n return;\r\n }\r\n const anotherAtom = _anotherAtom(newBond, currRight);\r\n const anotherVec = anotherAtom.position.clone().sub(currRight.position);\r\n const val = anotherAtom === startAtomRef ? -2.0 : 1 - _cosBetween(currVec, anotherVec);\r\n const newDir = anotherVec.cross(currVec);\r\n if (!_coDirVectors(newDir, currDir)) {\r\n return;\r\n }\r\n let idx = 0;\r\n while (idx < bondsOrder.length && bondsOrder[idx].val < val) {\r\n ++idx;\r\n }\r\n bondsOrder.splice(idx, 0, { bond: newBond, val, dir: newDir });\r\n });\r\n\r\n for (let i = 0, n = bondsOrder.length; i < n; ++i) {\r\n const { bond } = bondsOrder[i];\r\n const newRight = bond._left === currRight ? bond._right : bond._left;\r\n if (newRight === startAtomRef) {\r\n ++this._currIdx;\r\n this._cycles.push([currRight]);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n if (this._tryBond(bond, newRight, bondsOrder[i].dir)) {\r\n _insertAscending(bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(currRight);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n }\r\n bondMarks[prevBond._index] = false;\r\n return false;\r\n }\r\n\r\n _startCycle(bond) {\r\n // start from left to right\r\n this._currStart = bond._left;\r\n if (this._tryBond(bond, bond._right, new THREE.Vector3())) {\r\n _insertAscending(this._bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(bond._left);\r\n }\r\n }\r\n\r\n _findLoops(checkBond, checkCycle) {\r\n this._checkBond = checkBond;\r\n const complex = this._complex;\r\n const self = this;\r\n\r\n complex.forEachComponent((component) => {\r\n self._resetCycles();\r\n component.forEachBond((bond) => {\r\n if (checkBond(bond)) {\r\n self._startCycle(bond);\r\n }\r\n });\r\n const cycles = self._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n const cycle = cycles[i];\r\n if (!checkCycle(cycle)) {\r\n continue;\r\n }\r\n const newCycle = new Cycle(cycle);\r\n newCycle.forEachBond(_markAromatic);\r\n component.addCycle(newCycle);\r\n }\r\n });\r\n }\r\n\r\n markCycles() {\r\n this._findLoops(_isAromatic, _checkCycleSimple);\r\n }\r\n\r\n detectCycles() {\r\n this._findLoops(_isPossibleAromatic, _checkCycleComplex);\r\n }\r\n}\r\n\r\nexport default AromaticLoopsMarker;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\n/**\r\n * Calculate min & max radius of a sphere slice between zMin & zMax\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {number} zMin - lower bound of the slice\r\n * @param {number} zMax - upper bound of the slice\r\n */\r\nfunction _getSphereSliceRadiusRange(center, radius, zMin, zMax) {\r\n const dzMin = zMin - center.z;\r\n const dzMax = zMax - center.z;\r\n const rzMin = Math.sqrt(Math.max(radius * radius - dzMin * dzMin, 0.0));\r\n const rzMax = Math.sqrt(Math.max(radius * radius - dzMax * dzMax, 0.0));\r\n\r\n const rMin = Math.min(rzMin, rzMax);\r\n let rMax;\r\n\r\n if (zMin <= center.z && zMax >= center.z) {\r\n // sphere's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(rzMin, rzMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * Calculate min & max radius of a circle slice between yMin & yMax.\r\n *\r\n * To maintain analogy with _getSphereSliceRadiusRange we call radius what in fact is\r\n * half-width (along X axis) of the slice, i.e. 1D-sphere radius.\r\n *\r\n * @param {Vector3} center - center of the circle (z can be ignored)\r\n * @param {number} radius - circle radius\r\n * @param {number} yMin - lower bound of the slice\r\n * @param {number} yMax - upper bound of the slice\r\n * @returns {Array} - array of two numbers (min & max radius, or half-width)\r\n */\r\nfunction _getCircleSliceRadiusRange(center, radius, yMin, yMax) {\r\n const dyMin = yMin - center.y;\r\n const dyMax = yMax - center.y;\r\n const ryMin = Math.sqrt(Math.max(radius * radius - dyMin * dyMin, 0.0));\r\n const ryMax = Math.sqrt(Math.max(radius * radius - dyMax * dyMax, 0.0));\r\n\r\n const rMin = Math.min(ryMin, ryMax);\r\n let rMax;\r\n\r\n if (yMin <= center.y && yMax >= center.y) {\r\n // slice's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(ryMin, ryMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * VoxelWorld constructor\r\n *\r\n * @param {Box3} box - bounding box of the volume to be partitioned\r\n * @param {Vector3} vCellSizeHint - target voxel size (actual voxel size may differ from this)\r\n */\r\nclass VoxelWorld {\r\n constructor(box, vCellSizeHint) {\r\n this._box = box.clone();\r\n const size = new THREE.Vector3();\r\n box.getSize(size);\r\n this._count = size.clone().divide(vCellSizeHint).floor().max(new THREE.Vector3(1, 1, 1));\r\n this._last = this._count.clone().subScalar(1);\r\n this._cellSize = size.clone().divide(this._count);\r\n this._cellInnerR = 0.5 * Math.min(Math.min(this._cellSize.x, this._cellSize.y), this._cellSize.z);\r\n this._cellOuterR = 0.5 * Math.sqrt(this._cellSize.dot(this._cellSize));\r\n\r\n // array of voxels, each element contains index of first atom in voxel\r\n const numVoxels = this._count.x * this._count.y * this._count.z;\r\n this._voxels = utils.allocateTyped(Int32Array, numVoxels);\r\n for (let i = 0; i < numVoxels; ++i) {\r\n this._voxels[i] = -1;\r\n }\r\n\r\n // array of atoms that stores multiple single-linked lists\r\n // two elements for each atom: Atom ref, index of next atom (in this array\r\n this._atoms = [];\r\n }\r\n\r\n /**\r\n * Add all atoms from a complex to voxel world\r\n *\r\n * @param {Complex} complex - complex\r\n */\r\n addAtoms(complex) {\r\n const self = this;\r\n\r\n let idx = this._atoms.length;\r\n\r\n // resize array of atoms\r\n this._atoms.length += 2 * complex.getAtomCount();\r\n\r\n complex.forEachAtom((atom) => {\r\n // find which voxel contains this atom\r\n const voxelIdx = self._findVoxel(atom.position);\r\n\r\n // push current atom to the head of voxel's atom list\r\n self._atoms[idx] = atom;\r\n self._atoms[idx + 1] = self._voxels[voxelIdx];\r\n self._voxels[voxelIdx] = idx;\r\n\r\n idx += 2;\r\n });\r\n }\r\n\r\n /**\r\n * Get voxel that contains specified 3D point (we use clamp at the edges)\r\n *\r\n * @param {Vector3} point - a point in 3D\r\n * @returns {number} - index of voxel\r\n */\r\n static _zero = new THREE.Vector3(0, 0, 0);\r\n\r\n static _voxel = new THREE.Vector3();\r\n\r\n _findVoxel(point) {\r\n const zero = VoxelWorld._zero;\r\n const voxel = VoxelWorld._voxel;\r\n voxel.copy(point)\r\n .sub(this._box.min)\r\n .divide(this._cellSize)\r\n .floor()\r\n .clamp(zero, this._last);\r\n return voxel.x + this._count.x * (voxel.y + this._count.y * voxel.z);\r\n }\r\n\r\n /**\r\n * Call a function for each atom in voxel\r\n *\r\n * @param {number} voxel - index of voxel\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomInVoxel(voxel, process) {\r\n for (let i = this._voxels[voxel]; i >= 0; i = this._atoms[i + 1]) {\r\n process(this._atoms[i]);\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _xRange = new THREE.Vector2();\r\n\r\n static _yRange = new THREE.Vector2();\r\n\r\n static _zRange = new THREE.Vector2();\r\n\r\n _forEachVoxelWithinRadius(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n\r\n // switch to a faster method unless cell size is much smaller than sphere radius\r\n if (radius / this._cellInnerR < 10) {\r\n this._forEachVoxelWithinRadiusSimple(center, radius, process);\r\n return;\r\n }\r\n\r\n let rRangeXY;\r\n let rRangeX;\r\n let xVal;\r\n let yVal;\r\n let zVal;\r\n let isInsideX;\r\n let isInsideY;\r\n let isInsideZ;\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor()\r\n .clampScalar(0, this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n\r\n isInsideZ = (center.z - radius <= zVal[0]) && (zVal[1] <= center.z + radius);\r\n\r\n rRangeXY = _getSphereSliceRadiusRange(center, radius, zVal[0], zVal[1]);\r\n\r\n yRange.set(center.y - rRangeXY[1], center.y + rRangeXY[1]);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor()\r\n .clampScalar(0, this._count.y - 1);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n\r\n isInsideY = (center.y - rRangeXY[0] <= yVal[0]) && (yVal[1] <= center.y + rRangeXY[0]);\r\n\r\n rRangeX = _getCircleSliceRadiusRange(center, rRangeXY[1], yVal[0], yVal[1]);\r\n\r\n xRange.set(center.x - rRangeX[1], center.x + rRangeX[1]);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor()\r\n .clampScalar(0, this._count.x - 1);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n isInsideX = (center.x - rRangeX[0] <= xVal[0]) && (xVal[1] <= center.x + rRangeX[0]);\r\n\r\n process(x + this._count.x * (y + this._count.y * z), isInsideX && isInsideY && isInsideZ);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n * This is a version of method that doesn't try to \"calculate\" what voxels fall inside radius\r\n * but instead just checks all voxels inside sphere's bounding box. This should be faster\r\n * unless cell size is much smaller than sphere radius.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _vCenter = new THREE.Vector3();\r\n\r\n _forEachVoxelWithinRadiusSimple(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n const vCenter = VoxelWorld._vCenter;\r\n\r\n const distTouch2 = (radius + this._cellOuterR) * (radius + this._cellOuterR);\r\n let distInside2 = -1.0;\r\n if (radius > this._cellOuterR) {\r\n distInside2 = (radius - this._cellOuterR) * (radius - this._cellOuterR);\r\n }\r\n\r\n // calculate bounding box for the sphere\r\n xRange.set(center.x - radius, center.x + radius);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor();\r\n xRange.x = Math.min(Math.max(xRange.x, 0), this._count.x - 1);\r\n xRange.y = Math.min(Math.max(xRange.y, 0), this._count.x - 1);\r\n\r\n yRange.set(center.y - radius, center.y + radius);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor();\r\n yRange.x = Math.min(Math.max(yRange.x, 0), this._count.y - 1);\r\n yRange.y = Math.min(Math.max(yRange.y, 0), this._count.y - 1);\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor();\r\n zRange.x = Math.min(Math.max(zRange.x, 0), this._count.z - 1);\r\n zRange.y = Math.min(Math.max(zRange.y, 0), this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n const zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n vCenter.z = 0.5 * (zVal[0] + zVal[1]);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n const yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n vCenter.y = 0.5 * (yVal[0] + yVal[1]);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n const xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n vCenter.x = 0.5 * (xVal[0] + xVal[1]);\r\n\r\n const d2 = center.distanceToSquared(vCenter);\r\n if (d2 <= distTouch2) {\r\n process(x + this._count.x * (y + this._count.y * z), d2 <= distInside2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each atom within given sphere\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinRadius(center, radius, process) {\r\n const self = this;\r\n const r2 = radius * radius;\r\n\r\n self._forEachVoxelWithinRadius(center, radius, (voxel, isInside) => {\r\n if (isInside) {\r\n self._forEachAtomInVoxel(voxel, process);\r\n } else {\r\n self._forEachAtomInVoxel(voxel, (atom) => {\r\n if (center.distanceToSquared(atom.position) <= r2) {\r\n process(atom);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by mask\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} mask - bit mask\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromMasked(complex, mask, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by selector\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} selector - selector\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromSelected(complex, selector, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms\r\n *\r\n * @param {function} forEachAtom - enumerator of atoms in the group\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) {\r\n const self = this;\r\n const r2 = dist * dist;\r\n\r\n const voxels = [];\r\n const atoms = [];\r\n let idx = 0;\r\n\r\n // build \"within radius\" atom list for each voxel\r\n forEachAtom((atom) => {\r\n self._forEachVoxelWithinRadius(atom.position, dist, (voxel, isInside) => {\r\n if (isInside) {\r\n // this voxel is inside circle -- no check will be required\r\n voxels[voxel] = -1;\r\n } else if (typeof voxels[voxel] === 'undefined') {\r\n // this voxel isn't covered yet -- start building list of atoms\r\n atoms.push(atom);\r\n atoms.push(-1);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n } else if (voxels[voxel] !== -1) {\r\n // this voxel has a list of atoms required for distance check -- add atom to the list\r\n atoms.push(atom);\r\n atoms.push(voxels[voxel]);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n }\r\n });\r\n });\r\n\r\n let voxel;\r\n\r\n const processIfWithin = function (atom) {\r\n if (typeof voxels[voxel] === 'undefined') {\r\n return;\r\n }\r\n\r\n idx = voxels[voxel];\r\n if (idx === -1) {\r\n // this voxel is fully covered\r\n process(atom);\r\n return;\r\n }\r\n\r\n // check distance to each atom within radius from this voxel\r\n for (; idx >= 0; idx = atoms[idx + 1]) {\r\n if (atom.position.distanceToSquared(atoms[idx].position) < r2) {\r\n process(atom);\r\n break;\r\n }\r\n }\r\n };\r\n\r\n // for each marked voxel\r\n for (voxel in voxels) {\r\n if (voxels.hasOwnProperty(voxel)) {\r\n self._forEachAtomInVoxel(voxel, processIfWithin);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default VoxelWorld;\r\n","import ResidueType from './ResidueType';\r\nimport PairCollection from './AtomPairs';\r\n\r\nconst MINIMAL_DISTANCE = 0.5;\r\nconst MIN_HBOND_ENERGY = -9.9;\r\nconst MAX_HBOND_ENERGY = -0.5;\r\nconst COUPLING_CONSTANT = -27.888; // = -332 * 0.42 * 0.2\r\nconst MAX_COUPLING_DISTANCE = 5.0; // how far is the closest atom of a potential partner residue from CA atom\r\nconst MAX_RESIDUES_THRESHOLD = 1000;\r\n\r\nexport default class HBondInfo {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._hbonds = []; // array of bond info for each residue\r\n if (this._complex._residues.length > MAX_RESIDUES_THRESHOLD) {\r\n this._buildVW(); // optimized version using voxel grid\r\n } else {\r\n this._build(); // test all pairs of residues\r\n }\r\n }\r\n\r\n isBond(from, to) {\r\n if (this._hbonds[from]) {\r\n const [acc0, acc1] = this._hbonds[from].acceptor;\r\n if (acc0 && acc0.residue === to && acc0.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n if (acc1 && acc1.residue === to && acc1.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n\r\n for (let i = 0; i < this._complex._residues.length - 1; ++i) {\r\n const ri = this._complex._residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let preri = null;\r\n if (i > 0 && (this._complex._residues[i - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && ri._sequence === this._complex._residues[i - 1]._sequence + 1) {\r\n preri = this._complex._residues[i - 1];\r\n }\r\n\r\n for (let j = i + 1; j < this._complex._residues.length; ++j) {\r\n const rj = this._complex._residues[j];\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = null;\r\n if ((this._complex._residues[j - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && rj._sequence === this._complex._residues[j - 1]._sequence + 1) {\r\n prerj = this._complex._residues[j - 1];\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (j !== i + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _buildVW() {\r\n const self = this;\r\n const residues = this._complex._residues;\r\n let ri;\r\n let preri;\r\n\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const pairs = new PairCollection(this._complex._residues.length * this._complex._residues.length / 2);\r\n\r\n function processAtom(atom) {\r\n const rj = atom.residue;\r\n\r\n if (rj._index === ri._index) {\r\n return;\r\n }\r\n\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n return;\r\n }\r\n\r\n if (!pairs.addPair(ri._index, rj._index)) {\r\n // we've seen this pair\r\n return;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = rj._index > 0 ? residues[rj._index - 1] : null;\r\n if (prerj\r\n && ((prerj.getType().flags & ResidueType.Flags.PROTEIN) === 0 || rj._sequence !== prerj._sequence + 1)) {\r\n prerj = null;\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (rj._index !== ri._index + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n\r\n for (let i = 0; i < residues.length - 1; ++i) {\r\n ri = residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n preri = i > 0 ? residues[i - 1] : null;\r\n if (preri\r\n && ((preri.getType().flags & ResidueType.Flags.PROTEIN) === 0 || ri._sequence !== preri._sequence + 1)) {\r\n preri = null;\r\n }\r\n\r\n vw.forEachAtomWithinRadius(this._residueGetCAlpha(ri), MAX_COUPLING_DISTANCE, processAtom);\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _residueGetCO(res) {\r\n let c = null;\r\n let o = null;\r\n\r\n res.forEachAtom((a) => {\r\n if (a.name === 'C') {\r\n c = a.position;\r\n } else if (a.name === 'O') {\r\n o = a.position;\r\n }\r\n });\r\n\r\n return [c, o];\r\n }\r\n\r\n // TODO Support hydrogen defined in complex\r\n _residueGetNH(prev, res) {\r\n const [c, o] = this._residueGetCO(prev);\r\n\r\n let n;\r\n res.forEachAtom((a) => {\r\n if (a.name === 'N') {\r\n n = a.position;\r\n }\r\n });\r\n\r\n if (c && o && n) {\r\n // calculate hydrogen position\r\n const h = c.clone();\r\n h.sub(o);\r\n h.multiplyScalar(1.0 / h.length());\r\n h.add(n);\r\n\r\n return [n, h];\r\n }\r\n\r\n return [null, null];\r\n }\r\n\r\n _calcHBondEnergy(predonor, donor, acceptor) {\r\n let result = 0;\r\n\r\n if (predonor === null) {\r\n return result;\r\n }\r\n\r\n if (donor.getType().getName() !== 'PRO') {\r\n const [n, h] = this._residueGetNH(predonor, donor);\r\n const [c, o] = this._residueGetCO(acceptor);\r\n\r\n if (n === null || h === null || c === null || o === null) {\r\n return result;\r\n }\r\n\r\n const distanceHO = h.distanceTo(o);\r\n const distanceHC = h.distanceTo(c);\r\n const distanceNC = n.distanceTo(c);\r\n const distanceNO = n.distanceTo(o);\r\n\r\n if (distanceHO < MINIMAL_DISTANCE || distanceHC < MINIMAL_DISTANCE\r\n || distanceNC < MINIMAL_DISTANCE || distanceNO < MINIMAL_DISTANCE) {\r\n result = MIN_HBOND_ENERGY;\r\n } else {\r\n result = COUPLING_CONSTANT / distanceHO - COUPLING_CONSTANT / distanceHC\r\n + COUPLING_CONSTANT / distanceNC - COUPLING_CONSTANT / distanceNO;\r\n }\r\n\r\n // DSSP compatibility mode:\r\n result = Math.round(result * 1000) / 1000;\r\n\r\n if (result < MIN_HBOND_ENERGY) {\r\n result = MIN_HBOND_ENERGY;\r\n }\r\n }\r\n\r\n // update donor\r\n if (typeof this._hbonds[donor._index] === 'undefined') {\r\n this._hbonds[donor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const donorInfo = this._hbonds[donor._index];\r\n\r\n if (donorInfo.acceptor.length < 2) {\r\n donorInfo.acceptor.push({\r\n residue: acceptor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (donorInfo.acceptor.length > 1) {\r\n if (result < donorInfo.acceptor[0].energy) {\r\n donorInfo.acceptor[1].residue = donorInfo.acceptor[0].residue;\r\n donorInfo.acceptor[1].energy = donorInfo.acceptor[0].energy;\r\n donorInfo.acceptor[0].residue = acceptor._index;\r\n donorInfo.acceptor[0].energy = result;\r\n } else if (result < donorInfo.acceptor[1].energy) {\r\n donorInfo.acceptor[1].residue = acceptor._index;\r\n donorInfo.acceptor[1].energy = result;\r\n }\r\n }\r\n\r\n // update acceptor\r\n if (typeof this._hbonds[acceptor._index] === 'undefined') {\r\n this._hbonds[acceptor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const accInfo = this._hbonds[acceptor._index];\r\n\r\n if (accInfo.donor.length < 2) {\r\n accInfo.donor.push({\r\n residue: donor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (accInfo.donor.length > 1) {\r\n if (result < accInfo.donor[0].energy) {\r\n accInfo.donor[1].residue = accInfo.donor[0].residue;\r\n accInfo.donor[1].energy = accInfo.donor[0].energy;\r\n accInfo.donor[0].residue = donor._index;\r\n accInfo.donor[0].energy = result;\r\n } else if (result < accInfo.donor[1].energy) {\r\n accInfo.donor[1].residue = donor._index;\r\n accInfo.donor[1].energy = result;\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n","import HBondInfo from './HBondInfo';\r\nimport ResidueType from './ResidueType';\r\n\r\nconst BridgeType = Object.freeze({\r\n NO_BRIDGE: 0,\r\n PARALLEL: 1,\r\n ANTI_PARALLEL: 2,\r\n});\r\n\r\nconst HelixFlag = Object.freeze({\r\n START: 1,\r\n MIDDLE: 2,\r\n END: 3,\r\n START_AND_END: 4,\r\n});\r\n\r\nconst StructureType = Object.freeze({\r\n STRAND: 'E',\r\n BRIDGE: 'B',\r\n HELIX_310: 'G',\r\n HELIX_ALPHA: 'H',\r\n HELIX_PI: 'I',\r\n TURN: 'T',\r\n BEND: 'S',\r\n LOOP: ' ',\r\n});\r\n\r\nexport default class SecondaryStructureMap {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._build();\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n this._hbonds = new HBondInfo(this._complex);\r\n this._ss = []; // DSSP map by residue\r\n\r\n // auxilliary data\r\n this._sheet = [];\r\n this._betaPartners = [];\r\n this._bend = [];\r\n for (let i = 0; i < this._complex.getResidues().length; ++i) {\r\n this._betaPartners[i] = [];\r\n }\r\n this._helixFlags = [];\r\n this._helixFlags[3] = [];\r\n this._helixFlags[4] = [];\r\n this._helixFlags[5] = [];\r\n\r\n // calculate peptide chain lengths\r\n this._chainLengths = [];\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i].getResidues();\r\n let len = 0;\r\n for (; len < chain.length; ++len) {\r\n if ((chain[len].getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n break;\r\n }\r\n }\r\n this._chainLengths[i] = len;\r\n }\r\n\r\n this._buildBetaSheets();\r\n\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n self._buildAlphaHelices(this._complex._chains[i].getResidues(), this._chainLengths[i], false);\r\n }\r\n }\r\n\r\n _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) {\r\n // Helix and Turn\r\n for (let stride = 3; stride <= 5; ++stride) {\r\n if (inResidues.length < stride) {\r\n break;\r\n }\r\n\r\n for (let i = 0; i + stride < chainLength; ++i) {\r\n if (this._hbonds.isBond(inResidues[i + stride]._index, inResidues[i]._index)\r\n /* && NoChainBreak(res[i], res[i + stride]) */) {\r\n this._helixFlags[stride][inResidues[i + stride]._index] = HelixFlag.END;\r\n for (let j = i + 1; j < i + stride; ++j) {\r\n if (typeof this._helixFlags[stride][inResidues[j]._index] === 'undefined') {\r\n this._helixFlags[stride][inResidues[j]._index] = HelixFlag.MIDDLE;\r\n }\r\n }\r\n\r\n if (this._helixFlags[stride][inResidues[i]._index] === HelixFlag.END) {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START_AND_END;\r\n } else {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 2; i < chainLength - 2; ++i) {\r\n const kappa = this._kappa(inResidues[i - 2], inResidues[i], inResidues[i + 2]);\r\n this._bend[inResidues[i]._index] = (kappa !== 360 && kappa > 70);\r\n }\r\n\r\n for (let i = 1; i + 4 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 4) && this._isHelixStart(inResidues[i - 1]._index, 4)) {\r\n for (let j = i; j <= i + 3; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_ALPHA;\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 3 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 3) && this._isHelixStart(inResidues[i - 1]._index, 3)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 2; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_310;\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 2; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_310;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 5 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 5) && this._isHelixStart(inResidues[i - 1]._index, 5)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 4; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_PI\r\n || (inPreferPiHelices && this._ss[inResidues[j]._index] === StructureType.HELIX_ALPHA);\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 4; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_PI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 1 < chainLength; ++i) {\r\n if (typeof this._ss[inResidues[i]._index] === 'undefined') {\r\n let isTurn = false;\r\n for (let stride = 3; stride <= 5 && !isTurn; ++stride) {\r\n for (let k = 1; k < stride && !isTurn; ++k) {\r\n isTurn = (i >= k) && this._isHelixStart(inResidues[i - k]._index, stride);\r\n }\r\n }\r\n\r\n if (isTurn) {\r\n this._ss[inResidues[i]._index] = StructureType.TURN;\r\n } else if (this._bend[inResidues[i]._index]) {\r\n this._ss[inResidues[i]._index] = StructureType.BEND;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _cosinusAngle(p1, p2, p3, p4) {\r\n const v12 = p1.clone().sub(p2);\r\n const v34 = p3.clone().sub(p4);\r\n\r\n let result = 0;\r\n\r\n const x = v12.dot(v12) * v34.dot(v34);\r\n if (x > 0) {\r\n result = v12.dot(v34) / Math.sqrt(x);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _kappa(prevPrev, res, nextNext) {\r\n const curCA = this._residueGetCAlpha(res);\r\n const ppCA = this._residueGetCAlpha(prevPrev);\r\n const nnCA = this._residueGetCAlpha(nextNext);\r\n if (curCA === null || ppCA === null || nnCA === null) {\r\n return 180;\r\n }\r\n\r\n const ckap = this._cosinusAngle(curCA, ppCA, nnCA, curCA);\r\n const skap = Math.sqrt(1 - ckap * ckap);\r\n return Math.atan2(skap, ckap) * 180 / Math.PI;\r\n }\r\n\r\n _isHelixStart(res, stride) {\r\n return (this._helixFlags[stride][res] === HelixFlag.START\r\n || this._helixFlags[stride][res] === HelixFlag.START_AND_END);\r\n }\r\n\r\n _buildBetaSheets() {\r\n // find bridges\r\n // check each chain against each other chain, and against itself\r\n const bridges = [];\r\n for (let a = 0; a < this._complex._chains.length; ++a) {\r\n const lenA = this._chainLengths[a];\r\n if (lenA <= 4) {\r\n continue;\r\n }\r\n\r\n const chainA = this._complex._chains[a].getResidues();\r\n\r\n for (let b = a; b < this._complex._chains.length; ++b) {\r\n const lenB = this._chainLengths[b];\r\n if (lenB <= 4) {\r\n continue;\r\n }\r\n\r\n const chainB = this._complex._chains[b].getResidues();\r\n\r\n for (let i = 1; i + 1 < lenA; ++i) {\r\n const ri = chainA[i];\r\n\r\n let j = 1;\r\n if (b === a) {\r\n j = i + 3; // check for self-bridges forward down the chain\r\n }\r\n\r\n for (; j + 1 < lenB; ++j) {\r\n const rj = chainB[j];\r\n\r\n const type = this._testBridge(chainA, i, chainB, j);\r\n if (type === BridgeType.NO_BRIDGE) {\r\n continue;\r\n }\r\n\r\n // there is a bridge, try to attach it to previously found sequence\r\n let found = false;\r\n for (const bridge of bridges) {\r\n if (type !== bridge.type || ri._index !== bridge.i[bridge.i.length - 1] + 1) {\r\n continue;\r\n }\r\n\r\n if (type === BridgeType.PARALLEL && bridge.j[bridge.j.length - 1] + 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.push(rj._index);\r\n found = true;\r\n break;\r\n }\r\n\r\n if (type === BridgeType.ANTI_PARALLEL && bridge.j[0] - 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.unshift(rj._index);\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n // this bridge cannot be attached anywhere, start a new sequence\r\n if (!found) {\r\n bridges.push({\r\n type,\r\n i: [ri._index],\r\n chainI: ri.getChain()._index,\r\n j: [rj._index],\r\n chainJ: rj.getChain()._index,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // extend ladders\r\n bridges.sort((a, b) => {\r\n if (a.chainI < b.chainI || (a.chainI === b.chainI && a.i[0] < b.i[0])) {\r\n return -1;\r\n }\r\n return 1;\r\n });\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n for (let j = i + 1; j < bridges.length; ++j) {\r\n const ibi = bridges[i].i[0];\r\n const iei = bridges[i].i[bridges[i].i.length - 1];\r\n const jbi = bridges[i].j[0];\r\n const jei = bridges[i].j[bridges[i].j.length - 1];\r\n const ibj = bridges[j].i[0];\r\n const iej = bridges[j].i[bridges[j].i.length - 1];\r\n const jbj = bridges[j].j[0];\r\n const jej = bridges[j].j[bridges[j].j.length - 1];\r\n\r\n if (bridges[i].type !== bridges[j].type\r\n || this._hasChainBreak(Math.min(ibi, ibj), Math.max(iei, iej))\r\n || this._hasChainBreak(Math.min(jbi, jbj), Math.max(jei, jej))\r\n || ibj - iei >= 6 || (iei >= ibj && ibi <= iej)) {\r\n continue;\r\n }\r\n\r\n let bulge = false;\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bulge = ((jbj - jei < 6 && ibj - iei < 3) || (jbj - jei < 3));\r\n } else {\r\n bulge = ((jbi - jej < 6 && ibj - iei < 3) || (jbi - jej < 3));\r\n }\r\n\r\n if (bulge) {\r\n bridges[i].i = bridges[i].i.concat(bridges[j].i);\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bridges[i].j = bridges[i].j.concat(bridges[j].j);\r\n } else {\r\n bridges[i].j = bridges[j].j.concat(bridges[i].j);\r\n }\r\n bridges.splice(j--, 1);\r\n }\r\n }\r\n }\r\n\r\n // Sheet\r\n const ladderset = new Set();\r\n for (let i = 0; i < bridges.length; ++i) {\r\n ladderset.add(bridges[i]);\r\n }\r\n\r\n let sheet = 1;\r\n let ladder = 0;\r\n while (ladderset.size > 0) {\r\n let bridge = ladderset.values().next().value;\r\n ladderset.delete(bridge);\r\n\r\n const sheetset = new Set();\r\n sheetset.add(bridge);\r\n\r\n let toMove;\r\n do {\r\n toMove = new Set();\r\n for (const a of sheetset.values()) {\r\n for (const b of ladderset.values()) {\r\n if (this._areBridgesLinked(a, b)) {\r\n toMove.add(b);\r\n }\r\n }\r\n }\r\n for (bridge of toMove.values()) {\r\n sheetset.add(bridge);\r\n ladderset.delete(bridge);\r\n }\r\n } while (toMove.size > 0);\r\n\r\n for (bridge of sheetset.values()) {\r\n bridge.ladder = ladder;\r\n bridge.sheet = sheet;\r\n bridge.link = sheetset;\r\n ++ladder;\r\n }\r\n\r\n ++sheet;\r\n }\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n const bridge = bridges[i];\r\n\r\n // find out if any of the i and j set members already have\r\n // a bridge assigned, if so, we're assigning bridge 2\r\n\r\n let betai = 0;\r\n let betaj = 0;\r\n\r\n for (let l = 0; l < bridge.i.length; ++l) {\r\n if (this._betaPartners[bridge.i[l]][0]) {\r\n betai = 1;\r\n break;\r\n }\r\n }\r\n\r\n for (let l = 0; l < bridge.j.length; ++l) {\r\n if (this._betaPartners[bridge.j[l]][0]) {\r\n betaj = 1;\r\n break;\r\n }\r\n }\r\n\r\n let ss = StructureType.BRIDGE;\r\n if (bridge.i.length > 1) {\r\n ss = StructureType.STRAND;\r\n }\r\n\r\n if (bridge.type === BridgeType.PARALLEL) {\r\n let j = 0;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n\r\n j = 0;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n } else {\r\n let j = bridge.j.length - 1;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n\r\n j = bridge.i.length - 1;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n }\r\n\r\n for (let k = bridge.i[0]; k <= bridge.i[bridge.i.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n\r\n for (let k = bridge.j[0]; k <= bridge.j[bridge.j.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _testBridge(chainA, from, chainB, to) {\r\n let result = BridgeType.NO_BRIDGE;\r\n\r\n const a = chainA[from - 1]._index;\r\n const b = chainA[from]._index;\r\n const c = chainA[from + 1]._index;\r\n const d = chainB[to - 1]._index;\r\n const e = chainB[to]._index;\r\n const f = chainB[to + 1]._index;\r\n\r\n const isBond = this._hbonds.isBond.bind(this._hbonds);\r\n if ((isBond(c, e) && isBond(e, a)) || (isBond(f, b) && isBond(b, d))) {\r\n result = BridgeType.PARALLEL;\r\n } else if ((isBond(c, d) && isBond(f, a)) || (isBond(e, b) && isBond(b, e))) {\r\n result = BridgeType.ANTI_PARALLEL;\r\n }\r\n return result;\r\n }\r\n\r\n // return true if any of the residues in bridge a is identical to any of the residues in bridge b\r\n _areBridgesLinked(a, b) {\r\n const ai = new Set(a.i);\r\n const aj = new Set(a.j);\r\n\r\n for (const i of b.i) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n for (const i of b.j) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n _hasChainBreak(from, to) {\r\n for (let i = from + 1; i <= to; ++i) {\r\n if (this._complex._residues[i]._sequence !== this._complex._residues[i - 1]._sequence + 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\nSecondaryStructureMap.StructureType = StructureType;\r\n","import * as THREE from 'three';\r\nimport logger from '../utils/logger';\r\nimport Atom from './Atom';\r\nimport Chain from './Chain';\r\nimport Helix from './Helix';\r\nimport Strand from './Strand';\r\nimport Sheet from './Sheet';\r\nimport Component from './Component';\r\nimport ResidueType from './ResidueType';\r\nimport Bond from './Bond';\r\nimport AutoBond from './AutoBond';\r\nimport AromaticLoopsMarker from './AromaticLoopsMarker';\r\nimport BiologicalUnit from './BiologicalUnit';\r\nimport selectors from './selectors';\r\nimport VoxelWorld from './VoxelWorld';\r\nimport SecondaryStructureMap from './SecondaryStructureMap';\r\nimport StructuralElement from './StructuralElement';\r\n\r\nconst VOXEL_SIZE = 5.0;\r\n\r\nconst { StructureType } = SecondaryStructureMap;\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX\r\nconst helixClassMap = {\r\n [StructureType.HELIX_ALPHA]: 1,\r\n [StructureType.HELIX_PI]: 3,\r\n [StructureType.HELIX_310]: 5,\r\n};\r\n\r\nconst loopMap = {\r\n [StructureType.BRIDGE]: StructuralElementType.BRIDGE,\r\n [StructureType.TURN]: StructuralElementType.TURN,\r\n [StructureType.BEND]: StructuralElementType.BEND,\r\n [StructureType.LOOP]: StructuralElementType.COIL,\r\n};\r\n\r\n/**\r\n * The entire complex of the molecules under study.\r\n *\r\n * @exports Complex\r\n * @constructor\r\n */\r\nclass Complex {\r\n constructor() {\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n\r\n this._residueTypes = Object.create(ResidueType.StandardTypes);\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n this._molecules = [];\r\n this._maskNeedsUpdate = false;\r\n\r\n this.metadata = {};\r\n\r\n this.symmetry = [];\r\n this.units = [new BiologicalUnit(this)];\r\n this._currentUnit = 0; // default biological unit is the asymmetric unit\r\n }\r\n\r\n addAtom(atom) {\r\n const index = this._atoms.length;\r\n this._atoms.push(atom);\r\n return index;\r\n }\r\n\r\n addSheet(sheet) {\r\n const index = this._sheets.length;\r\n this._sheets.push(sheet);\r\n return index;\r\n }\r\n\r\n addHelix(helix) {\r\n const index = this._helices.length;\r\n this._helices.push(helix);\r\n return index;\r\n }\r\n\r\n getAtoms() {\r\n return this._atoms;\r\n }\r\n\r\n getBonds() {\r\n return this._bonds;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n addResidue(residue) {\r\n const index = this._residues.length;\r\n this._residues.push(residue);\r\n return index;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n this.forEachChain((chain) => {\r\n chain.updateToFrame(frameData);\r\n });\r\n }\r\n\r\n addResidueType(resName) {\r\n const rt = this._residueTypes[resName] = new ResidueType(resName, 'Unknown', '');\r\n return rt;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n getSGroupCount() {\r\n return this._sgroups.length;\r\n }\r\n\r\n getSGroups() {\r\n return this._sgroups;\r\n }\r\n\r\n /*\r\n Extract atom by its fullname: #chainName#.#residueId#.#atomName#\r\n */\r\n getAtomByFullname(fullName) {\r\n const parts = fullName.split('.');\r\n if (parts.length !== 3) {\r\n return null;\r\n }\r\n\r\n const chainName = parts[0];\r\n const resId = parseInt(parts[1], 10);\r\n if (Number.isNaN(resId)) {\r\n return null;\r\n }\r\n const atomName = parts[2].toUpperCase();\r\n\r\n let currAtom = null;\r\n this.forEachChain((chain) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (chain._name.localeCompare(chainName) === 0) {\r\n chain.forEachResidue((residue) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (residue._sequence === resId) {\r\n residue.forEachAtom((atom) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (atomName.localeCompare(atom.name) === 0) {\r\n currAtom = atom;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n });\r\n\r\n return currAtom;\r\n }\r\n\r\n /**\r\n * Create a new chain.\r\n *\r\n * @param {string} name - Chain name.\r\n * @returns {Chain} - Newly created chain.\r\n */\r\n addChain(name) {\r\n const result = new Chain(this, name);\r\n this._chains.push(result);\r\n return result;\r\n }\r\n\r\n getChain(name) {\r\n for (let i = 0, n = this._chains.length; i < n; ++i) {\r\n const chain = this._chains[i];\r\n if (chain.getName() === name) {\r\n return chain;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n getChainCount() {\r\n return this._chains.length;\r\n }\r\n\r\n getMolecules() {\r\n return this._molecules;\r\n }\r\n\r\n getMoleculeCount() {\r\n return this._molecules.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n process(atoms[i]);\r\n }\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._bonds;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n forEachChain(process) {\r\n const chains = this._chains;\r\n for (let i = 0, n = chains.length; i < n; ++i) {\r\n process(chains[i]);\r\n }\r\n }\r\n\r\n forEachMolecule(process) {\r\n const molecules = this._molecules;\r\n const n = molecules.length;\r\n for (let i = 0; i < n; ++i) {\r\n process(molecules[i]);\r\n }\r\n }\r\n\r\n forEachSGroup(process) {\r\n const groups = this._sgroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n process(groups[i]);\r\n }\r\n }\r\n\r\n forEachComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n forEachVisibleComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n addBond(left, right, order, type, fixed) {\r\n const bond = new Bond(left, right, order, type, fixed);\r\n this._bonds.push(bond);\r\n return bond;\r\n }\r\n\r\n getBondCount() {\r\n return this._bonds.length;\r\n }\r\n\r\n getResidueType(name) {\r\n return this._residueTypes[name] || null;\r\n }\r\n\r\n getUnifiedSerial(chain, serial, iCode) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n return serial + iCode * maxSerial + chain * chainShift;\r\n }\r\n\r\n splitUnifiedSerial(uniSerial) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n const chainId = Math.floor(uniSerial / chainShift);\r\n const remnant = uniSerial - chainId * chainShift;\r\n const insCode = Math.floor(remnant / maxSerial);\r\n const ser = remnant - insCode * maxSerial;\r\n return { chain: chainId, serial: ser, iCode: insCode };\r\n }\r\n\r\n _fillCmpEdit() {\r\n const self = this;\r\n const components = this._components;\r\n\r\n function addComp() {\r\n const comp = new Component(self);\r\n comp._index = components.length;\r\n components[comp._index] = comp;\r\n return comp;\r\n }\r\n\r\n this.forEachChain((chain) => {\r\n const residues = chain._residues;\r\n const resCount = residues.length;\r\n if (resCount < 1) {\r\n return;\r\n }\r\n let comp = addComp();\r\n let currStart = residues[0]._index;\r\n\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)\r\n || currRes._index !== nextRes._index - 1) {\r\n // the last condition is broken and incorrect\r\n // the refactoring of the Component is required in order to fix this issue\r\n comp.setSubDivs([{\r\n start: currStart,\r\n end: currRes._index,\r\n }]);\r\n if (nextRes) {\r\n currStart = nextRes._index;\r\n comp = addComp();\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n // This function was added in the moment of despair\r\n // It was the dark times for miew\r\n _fillCmpNoedit() {\r\n const comp = new Component(this);\r\n comp._index = 0;\r\n\r\n const residues = this._residues;\r\n const resCount = residues.length;\r\n if (resCount === 0) {\r\n return;\r\n }\r\n\r\n const currSubDivs = [];\r\n let currStart = 0;\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)) {\r\n // wrap up this interval\r\n currSubDivs[currSubDivs.length] = {\r\n start: currStart,\r\n end: i,\r\n };\r\n if (nextRes) {\r\n currStart = i + 1;\r\n }\r\n }\r\n }\r\n\r\n comp.setSubDivs(currSubDivs);\r\n this._components[comp._index] = comp;\r\n }\r\n\r\n /**\r\n * Fill components information.\r\n * @param {boolean} enableEditing - Restructure Complex to enable per-component editing.\r\n */\r\n _fillComponents(enableEditing) {\r\n if (enableEditing) {\r\n this._fillCmpEdit();\r\n } else {\r\n this._fillCmpNoedit();\r\n }\r\n }\r\n\r\n getCurrentUnit() {\r\n return this._currentUnit;\r\n }\r\n\r\n getDefaultBoundaries() {\r\n return this.units[0].getBoundaries();\r\n }\r\n\r\n getBoundaries() {\r\n return this.units[this._currentUnit].getBoundaries();\r\n }\r\n\r\n getTransforms() {\r\n return this.units[this._currentUnit].getTransforms();\r\n }\r\n\r\n getSelector() {\r\n return this.units[this._currentUnit].getSelector();\r\n }\r\n\r\n resetCurrentUnit() {\r\n this._currentUnit = 0;\r\n this.setCurrentUnit(1);\r\n }\r\n\r\n setCurrentUnit(newUnit) {\r\n if (newUnit !== null && newUnit !== undefined\r\n && newUnit !== this._currentUnit\r\n && newUnit >= 0\r\n && newUnit < this.units.length) {\r\n this._currentUnit = newUnit;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n _computeBounds() {\r\n const { units } = this;\r\n for (let i = 0, n = units.length; i < n; ++i) {\r\n units[i].computeBoundaries();\r\n }\r\n }\r\n\r\n onAtomPositionChanged() {\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n this.forEachComponent((c) => {\r\n c.update();\r\n });\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n this._finalizeBonds();\r\n this.forEachSGroup((s) => {\r\n s._rebuildSGroupOnAtomChange();\r\n });\r\n }\r\n\r\n update() {\r\n if (this._maskNeedsUpdate) {\r\n this.updateStructuresMask();\r\n this._maskNeedsUpdate = false;\r\n }\r\n }\r\n\r\n _finalizeBonds() {\r\n const bonds = this.getBonds();\r\n const n = bonds.length;\r\n for (let i = 0; i < n; ++i) {\r\n bonds[i]._index = i;\r\n }\r\n }\r\n\r\n /**\r\n * Finalizes complex's inner data(i.e. after parsing).\r\n * @param {objects} opts - Build bonds automatically.\r\n * @param {boolean} opts.needAutoBonding - Build bonds automatically.\r\n * @param {boolean} opts.detectAromaticLoops - Find/mark aromatic loops.\r\n * @param {boolean} opts.enableEditing - Restructure Complex to enable per-component editing.\r\n * @param {Array} [opts.serialAtomMap] - Array of atoms ordered by their serials.\r\n */\r\n finalize(opts) {\r\n opts = opts || {};\r\n // Put bonds into atoms\r\n const bonds = this._bonds;\r\n let i;\r\n let n;\r\n // remove invalid bonds\r\n for (i = bonds.length - 1; i >= 0; i--) {\r\n const bond = bonds[i];\r\n if (bond._left === null || bond._right === null) {\r\n bonds.splice(i, 1);\r\n } else {\r\n bond._left.bonds.push(bond);\r\n bond._right.bonds.push(bond);\r\n }\r\n }\r\n\r\n const residues = this._residues;\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._finalize();\r\n }\r\n\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n\r\n // WARNING! this MUST be done BEFORE computeBounds is called\r\n const { units } = this;\r\n for (i = 0, n = units.length; i < n; ++i) {\r\n units[i].finalize();\r\n }\r\n // try setting first biomolecule by defaults\r\n this.setCurrentUnit(1);\r\n\r\n const residueHash = {};\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n // This code is extremely dangerous for non-PDB formats\r\n residueHash[this.getUnifiedSerial(\r\n res.getChain().getName().charCodeAt(0),\r\n res.getSequence(),\r\n res.getICode().charCodeAt(0),\r\n )] = res;\r\n }\r\n\r\n const { structures } = this;\r\n for (i = 0, n = structures.length; i < n; ++i) {\r\n structures[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const helices = this._helices;\r\n for (i = 0, n = helices.length; i < n; ++i) {\r\n helices[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const sheets = this._sheets;\r\n for (i = 0, n = sheets.length; i < n; ++i) {\r\n sheets[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n\r\n const atoms = this._atoms;\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const currAtom = atoms[i];\r\n currAtom.index = i;\r\n }\r\n\r\n if (opts.needAutoBonding) {\r\n const autoConnector = new AutoBond(this);\r\n autoConnector.build();\r\n autoConnector.destroy();\r\n }\r\n\r\n const chains = this._chains;\r\n for (i = 0, n = chains.length; i < n; ++i) {\r\n chains[i]._index = i;\r\n }\r\n\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._index = i;\r\n }\r\n\r\n // mark non-polar hydrogens\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n if (atom.flags & Atom.Flags.HYDROGEN && atom.bonds.length === 1) {\r\n const bond = atom.bonds[0];\r\n const other = (bond._left !== atom && bond._left) || bond._right;\r\n if (other.flags & Atom.Flags.CARBON) {\r\n atom.flags |= Atom.Flags.NONPOLARH;\r\n }\r\n }\r\n }\r\n\r\n this._finalizeBonds();\r\n this._fillComponents(opts.enableEditing);\r\n\r\n const marker = new AromaticLoopsMarker(this);\r\n marker.markCycles();\r\n if (opts.detectAromaticLoops) { // TODO remove this condition clause, it is for debug purposes only!\r\n marker.detectCycles(); // TODO add conditional detection\r\n }\r\n\r\n this._finalizeMolecules();\r\n }\r\n\r\n _finalizeMolecules() {\r\n // add reference to molecule into residue\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const molecule = this._molecules[i];\r\n const count = molecule.residues.length;\r\n for (let j = 0; j < count; j++) {\r\n const residue = molecule.residues[j];\r\n residue._molecule = molecule;\r\n }\r\n }\r\n }\r\n\r\n updateStructuresMask() {\r\n const updater = (structure) => structure.collectMask();\r\n this.forEachResidue(updater);\r\n this.forEachChain(updater);\r\n this.forEachMolecule(updater);\r\n }\r\n\r\n countAtomsByMask(mask) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n getNumAtomsBySelector(selector) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n resetAtomMask(mask) {\r\n this.forEachAtom((atom) => {\r\n atom.mask = mask;\r\n });\r\n }\r\n\r\n markAtoms(selector, mask) {\r\n const setMask = mask;\r\n const clearMask = ~setMask;\r\n let count = 0;\r\n const totalSelector = selectors.keyword('And')(selector, this.getSelector());\r\n\r\n this.forEachAtom((atom) => {\r\n if (totalSelector.includesAtom(atom)) {\r\n atom.mask |= setMask;\r\n count++;\r\n } else {\r\n atom.mask &= clearMask;\r\n }\r\n });\r\n this._maskNeedsUpdate = true;\r\n\r\n return count;\r\n }\r\n\r\n markAtomsAdditionally(selector, mask) {\r\n const setMask = mask;\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom) && (atom.mask & mask) !== mask) {\r\n atom.mask |= setMask;\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n clearAtomBits(mask) {\r\n const clearMask = ~mask;\r\n this.forEachAtom((atom) => {\r\n atom.mask &= clearMask;\r\n });\r\n const reseter = (a) => {\r\n a._mask &= clearMask;\r\n };\r\n this.forEachAtom(reseter);\r\n this.forEachResidue(reseter);\r\n this.forEachChain(reseter);\r\n this.forEachMolecule(reseter);\r\n }\r\n\r\n getAtomNames() {\r\n if (this.hasOwnProperty('_atomNames')) {\r\n return this._atomNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.name] = 1;\r\n });\r\n this._atomNames = Object.keys(dict);\r\n\r\n return this._atomNames;\r\n }\r\n\r\n getElements() {\r\n if (this.hasOwnProperty('_elements')) {\r\n return this._elements;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.element.name] = 1;\r\n });\r\n this._elements = Object.keys(dict);\r\n\r\n return this._elements;\r\n }\r\n\r\n getResidueNames() {\r\n if (this.hasOwnProperty('_residueNames')) {\r\n return this._residueNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachResidue((res) => {\r\n dict[res._type._name] = 1;\r\n });\r\n this._residueNames = Object.keys(dict);\r\n\r\n return this._residueNames;\r\n }\r\n\r\n getChainNames() {\r\n if (this.hasOwnProperty('_chainNames')) {\r\n return this._chainNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachChain((chain) => {\r\n dict[chain._name] = 1;\r\n });\r\n this._chainNames = Object.keys(dict);\r\n\r\n return this._chainNames;\r\n }\r\n\r\n getAltLocNames() {\r\n if (this.hasOwnProperty('_altlocNames')) {\r\n return this._altlocNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[String.fromCharCode(atom.location)] = 1;\r\n });\r\n this._altlocNames = Object.keys(dict);\r\n\r\n return this._altlocNames;\r\n }\r\n\r\n getVoxelWorld() {\r\n if (!this.hasOwnProperty('_voxelWorld')) {\r\n try {\r\n this._voxelWorld = new VoxelWorld(\r\n this.getDefaultBoundaries().boundingBox,\r\n new THREE.Vector3(VOXEL_SIZE, VOXEL_SIZE, VOXEL_SIZE),\r\n );\r\n this._voxelWorld.addAtoms(this);\r\n } catch (e) {\r\n logger.warn('Unable to create voxel world');\r\n this._voxelWorld = null;\r\n }\r\n }\r\n\r\n return this._voxelWorld;\r\n }\r\n\r\n /**\r\n * Simple function to make unified routine procedure without code duplication.\r\n * @param {Array} srcArray - Source chemical structure array (will be part of resulting chemical structure array).\r\n * @param {Array} dstArray - Resulting chemical structure array.\r\n * @param {number} param - Parameter for processor.\r\n * @param {function} functor - Processor for every element in array.\r\n */\r\n addElement(srcArray, dstArray, param, functor) {\r\n const { length } = srcArray;\r\n for (let i = 0; i < length; ++i) {\r\n const elem = srcArray[i];\r\n functor(elem, param);\r\n dstArray.push(elem);\r\n }\r\n }\r\n\r\n // this function joins multiple complexes into one (this)\r\n // atom, bond, ... objects are reused -- so input complexes are no longer valid\r\n joinComplexes(complexes) {\r\n // clear target complex\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n\r\n const self = this;\r\n let atomBias = 0;\r\n let bondBias = 0;\r\n let residueBias = 0;\r\n let chainBias = 0;\r\n let componentBias = 0;\r\n\r\n function processAtom(atom, bias) {\r\n atom.serial += bias;\r\n atom.index += bias;\r\n }\r\n\r\n function processBond(bond, bias) {\r\n bond._index += bias;\r\n }\r\n\r\n function processResidue(residue, bias) {\r\n residue._index += bias;\r\n }\r\n\r\n function processChain(chain, bias) {\r\n chain._complex = self;\r\n chain._index += bias;\r\n }\r\n\r\n function processComponent(component, bias) {\r\n component._complex = self;\r\n component._index += bias;\r\n }\r\n\r\n /**\r\n * Simple function to do nothing.\r\n */\r\n function doNothing() {\r\n }\r\n\r\n for (let i = 0; i < complexes.length; ++i) {\r\n const c = complexes[i];\r\n this.addElement(c._atoms, this._atoms, atomBias, processAtom);\r\n this.addElement(c._bonds, this._bonds, bondBias, processBond);\r\n this.addElement(c._residues, this._residues, residueBias, processResidue);\r\n this.addElement(c._chains, this._chains, chainBias, processChain);\r\n this.addElement(c._sheets, this._sheets, 0, doNothing);\r\n this.addElement(c._helices, this._helices, 0, doNothing);\r\n this.addElement(c._sgroups, this._sgroups, 0, doNothing);\r\n this.addElement(c._components, this._components, componentBias, processComponent);\r\n this.addElement(c.structures, this.structures, 0, doNothing);\r\n // merge residue types\r\n for (const rt in c._residueTypes) {\r\n if (c._residueTypes.hasOwnProperty(rt)) {\r\n this._residueTypes[rt] = c._residueTypes[rt];\r\n }\r\n }\r\n\r\n atomBias += c._atoms.length;\r\n bondBias += c._bonds.length;\r\n residueBias += c._residues.length;\r\n chainBias += c._chains.length;\r\n componentBias += c._components.length;\r\n }\r\n\r\n this._computeBounds();\r\n }\r\n\r\n /**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n */\r\n dssp() {\r\n const ssMap = new SecondaryStructureMap(this);\r\n\r\n const structures = this.structures = [];\r\n const helices = this._helices = [];\r\n const sheets = this._sheets = [];\r\n\r\n const getSheet = (index) => {\r\n let item = sheets[index];\r\n if (!item) {\r\n item = sheets[index] = new Sheet(String(index), 0);\r\n }\r\n return item;\r\n };\r\n\r\n let lastCode;\r\n let lastSheetIndex;\r\n let lastHelixIndex = 0;\r\n let curStructure = null;\r\n for (let i = 0, n = this._residues.length; i < n; ++i) {\r\n const curCode = ssMap._ss[i];\r\n const curResidue = this._residues[i];\r\n const curSheetIndex = ssMap._sheet[i];\r\n\r\n // expand the last structure\r\n if (curCode === lastCode && curSheetIndex === lastSheetIndex) {\r\n curResidue._secondary = curStructure;\r\n if (curStructure) {\r\n curStructure.term = curResidue;\r\n }\r\n if (curStructure instanceof Helix) {\r\n curStructure.length++;\r\n }\r\n continue;\r\n }\r\n\r\n // create a new structure\r\n const helixClass = helixClassMap[curCode];\r\n const loopType = loopMap[curCode];\r\n if (curCode === StructureType.STRAND) {\r\n const curSheet = getSheet(curSheetIndex);\r\n curStructure = new Strand(curSheet, curResidue, curResidue, 0, null, null);\r\n curSheet.addStrand(curStructure);\r\n } else if (helixClass !== undefined) {\r\n lastHelixIndex++;\r\n curStructure = new Helix(helixClass, curResidue, curResidue, lastHelixIndex, String(lastHelixIndex), '', 1);\r\n helices.push(curStructure);\r\n } else if (loopType !== undefined) {\r\n curStructure = new StructuralElement(loopType, curResidue, curResidue);\r\n } else {\r\n curStructure = null;\r\n }\r\n\r\n if (curStructure) {\r\n structures.push(curStructure);\r\n }\r\n\r\n curResidue._secondary = curStructure;\r\n\r\n lastCode = curCode;\r\n lastSheetIndex = curSheetIndex;\r\n }\r\n\r\n this._sheets = sheets.filter((_sheet) => true); // squeeze sheets array\r\n }\r\n}\r\n\r\nComplex.prototype.id = 'Complex';\r\nComplex.prototype.name = '';\r\n\r\nexport default Complex;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\nfunction pow2ceil(v) {\r\n let p = 2;\r\n v = (v - 1) >> 1;\r\n while (v) {\r\n p <<= 1;\r\n v >>= 1;\r\n }\r\n return p;\r\n}\r\n\r\n/**\r\n * Volume constructor\r\n *\r\n * @param {Object} type - Float32Array, Int8Array, etc...\r\n * @param {Object|Array} dimensions - number of data points on each axis (x, y, z)\r\n * @param {Box3} box - bounding box defining data place in metric space,\r\n * it's corners correspond to extreme data points\r\n * @param {Number} vecSize - dimension of the field data point (1 = scalar, 3 = 3D vector)\r\n * @param {Object} data - typed array of the same type as specified by the 1st parameter,\r\n * layout: point by point along X,\r\n * row by row along Y,\r\n * plane by plane along Z\r\n * @param {Number} volumeInfo - volume info values to define threshold to filter the noise\r\n */\r\n\r\nclass Volume {\r\n constructor(type, dimensions, box, vecSize, data, volumeInfo) {\r\n this._box = box.clone();\r\n this._dimVec = Math.max(Math.floor(vecSize || 1), 1);\r\n this._volumeInfo = volumeInfo;\r\n\r\n if (dimensions instanceof Array) {\r\n [this._dimX, this._dimY, this._dimZ] = dimensions;\r\n } else {\r\n this._dimX = dimensions.x;\r\n this._dimY = dimensions.y;\r\n this._dimZ = dimensions.z;\r\n }\r\n this._dimX = Math.max(Math.floor(this._dimX), 1);\r\n this._dimY = Math.max(Math.floor(this._dimY), 1);\r\n this._dimZ = Math.max(Math.floor(this._dimZ), 1);\r\n\r\n this._rowElements = this._dimVec * this._dimX;\r\n this._planeElements = this._rowElements * this._dimY;\r\n this._totalElements = this._planeElements * this._dimZ;\r\n\r\n this._data = data || utils.allocateTyped(type, this._totalElements);\r\n\r\n // override getter/setter for vector fields\r\n switch (this._dimVec) {\r\n case 1:\r\n break;\r\n\r\n case 2:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n };\r\n break;\r\n\r\n case 3:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1], this._data[idx + 2]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n this._data[idx + 2] = c;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n this._data[idx + 2] += c;\r\n };\r\n break;\r\n\r\n default:\r\n throw new Error('Volume: invalid vector dimension');\r\n }\r\n }\r\n\r\n // default getter assumes it's a scalar field\r\n getValue(x, y, z) {\r\n return this._data[x + y * this._rowElements + z * this._planeElements];\r\n }\r\n\r\n // default setter assumes it's a scalar field\r\n setValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] = val;\r\n }\r\n\r\n // default adder assumes it's a scalar field\r\n addValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] += val;\r\n }\r\n\r\n getDimensions() {\r\n return [this._dimX, this._dimY, this._dimZ];\r\n }\r\n\r\n getBox() {\r\n return this._box;\r\n }\r\n\r\n getVolumeInfo() {\r\n return this._volumeInfo;\r\n }\r\n\r\n getCellSize() {\r\n const boxSize = new THREE.Vector3();\r\n this._box.getSize(boxSize);\r\n const res = new THREE.Vector3();\r\n res.x = this._dimX > 1 ? boxSize.x / (this._dimX - 1) : 0;\r\n res.y = this._dimY > 1 ? boxSize.y / (this._dimY - 1) : 0;\r\n res.z = this._dimZ > 1 ? boxSize.z / (this._dimZ - 1) : 0;\r\n return res;\r\n }\r\n\r\n computeGradient() {\r\n if (this._dimVec !== 1) {\r\n // gradient can only be computed for scalar fields\r\n return null;\r\n }\r\n\r\n // create a 3D vector field of gradients\r\n const gradient = new Volume(Float32Array, [this._dimX, this._dimY, this._dimZ], this._box, 3);\r\n\r\n // calculate cell side lengths\r\n const vl = this.getCellSize();\r\n\r\n // gradient axis scaling values and averaging factors, to correctly\r\n // calculate the gradient for volumes with irregular cell spacing\r\n const vs = new THREE.Vector3(-0.5 / vl.x, -0.5 / vl.y, -0.5 / vl.z);\r\n\r\n // TODO Check for intended bug in VMD (min is zero)\r\n function clamp(val, min, max) {\r\n return Math.min(max, Math.max(min, val));\r\n }\r\n\r\n const xSize = this._dimX;\r\n const ySize = this._dimY;\r\n const zSize = this._dimZ;\r\n const volMap = this._data;\r\n\r\n function _voxelValue(x, y, z) {\r\n return volMap[z * xSize * ySize + y * xSize + x];\r\n }\r\n\r\n for (let zi = 0; zi < zSize; ++zi) {\r\n const zm = clamp(zi - 1, 0, zSize - 1);\r\n const zp = clamp(zi + 1, 0, zSize - 1);\r\n\r\n for (let yi = 0; yi < ySize; ++yi) {\r\n const ym = clamp(yi - 1, 0, ySize - 1);\r\n const yp = clamp(yi + 1, 0, ySize - 1);\r\n\r\n for (let xi = 0; xi < xSize; ++xi) {\r\n const xm = clamp(xi - 1, 0, xSize - 1);\r\n const xp = clamp(xi + 1, 0, xSize - 1);\r\n\r\n // Calculate the volume gradient at each grid cell.\r\n // Gradients are now stored unnormalized, since we need them in pure\r\n // form in order to draw field lines etc. Shading code will now have\r\n // to do renormalization for itself on-the-fly.\r\n\r\n // XXX this gradient is only correct for orthogonal grids, since\r\n // we're using the array index offsets rather to calculate the gradient\r\n // rather than voxel coordinate offsets. This will have to be\r\n // re-worked for non-orthogonal datasets.\r\n\r\n gradient.setValue(\r\n xi,\r\n yi,\r\n zi,\r\n (_voxelValue(xp, yi, zi) - _voxelValue(xm, yi, zi)) * vs.x,\r\n (_voxelValue(xi, yp, zi) - _voxelValue(xi, ym, zi)) * vs.y,\r\n (_voxelValue(xi, yi, zp) - _voxelValue(xi, yi, zm)) * vs.z,\r\n );\r\n }\r\n }\r\n }\r\n\r\n return gradient;\r\n }\r\n\r\n normalize() {\r\n const data = this._data;\r\n\r\n // get min/max\r\n let min = data[0];\r\n let max = data[0];\r\n for (let i = 1; i < data.length; ++i) {\r\n min = Math.min(min, data[i]);\r\n max = Math.max(max, data[i]);\r\n }\r\n\r\n const d = 1.0 / (max - min);\r\n if (d === 0) {\r\n return;\r\n }\r\n\r\n // normalize\r\n for (let i = 0; i < data.length; ++i) {\r\n data[i] = d * (data[i] - min);\r\n }\r\n }\r\n\r\n getTiledTextureStride() {\r\n return [this._dimX + 2, this._dimY + 2];\r\n }\r\n\r\n buildTiledTexture() {\r\n let tilesX = Math.ceil(Math.sqrt(this._dimZ * this._dimY / this._dimX));\r\n\r\n let width = tilesX * (this._dimX + 2) - 1;\r\n width = pow2ceil(width);\r\n tilesX = Math.floor(width / (this._dimX + 2));\r\n\r\n const tilesY = Math.ceil(this._dimZ / tilesX);\r\n let height = tilesY * (this._dimY + 2) - 1;\r\n height = pow2ceil(height);\r\n\r\n const data = new Uint8Array(width * height);\r\n\r\n let src;\r\n let dst;\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // process each pixel row of this tile row\r\n for (let row = 0; row < this._dimY; ++row) {\r\n src = tileRow * tilesX * this._planeElements + row * this._rowElements;\r\n dst = width * (tileRow * (this._dimY + 2) + row);\r\n // copy a series of rows through several XY planes\r\n for (let t = 0; t < tilesX; ++t) {\r\n // copy one row of one XY plane\r\n for (let x = 0; x < this._dimX; ++x) {\r\n data[dst++] = 255.0 * this._data[src++];\r\n }\r\n\r\n // repeat last pixel of previous tile\r\n data[dst++] = 255.0 * this._data[src - 1];\r\n\r\n if (t < tilesX - 1) {\r\n // skip to the same row of next XY plane\r\n src += this._planeElements - this._rowElements;\r\n // repeat first pixel of next tile\r\n data[dst++] = 255.0 * this._data[src];\r\n }\r\n }\r\n }\r\n }\r\n\r\n // fill pixels between tile rows with copy of edge pixels\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // copy last pixel row of this tile row to the following pixel row of the texture\r\n src = width * (tileRow * (this._dimY + 2) + this._dimY - 1);\r\n dst = src + width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n if (tileRow < tilesY - 1) {\r\n // copy first pixel row of next tile row to the preceding pixel row of the texture\r\n src = width * (tileRow + 1) * (this._dimY + 2);\r\n dst = src - width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n }\r\n }\r\n\r\n const texture = new THREE.DataTexture(\r\n data,\r\n width,\r\n height,\r\n THREE.LuminanceFormat,\r\n THREE.UnsignedByteType,\r\n THREE.UVMapping,\r\n THREE.ClampToEdgeWrapping,\r\n THREE.ClampToEdgeWrapping,\r\n THREE.LinearFilter,\r\n THREE.LinearFilter,\r\n );\r\n texture.needsUpdate = true;\r\n return texture;\r\n }\r\n\r\n /* ********************************************************************************\r\n *\r\n * Methods that provide direct access to internal array (for better performance)\r\n *\r\n ******************************************************************************** */\r\n\r\n getData() {\r\n return this._data;\r\n }\r\n\r\n getDirectIdx(x, y, z) {\r\n return x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n }\r\n\r\n getStrideX() {\r\n return this._dimVec;\r\n }\r\n\r\n getStrideY() {\r\n return this._rowElements;\r\n }\r\n\r\n getStrideZ() {\r\n return this._planeElements;\r\n }\r\n}\r\n\r\nVolume.prototype.id = 'Volume';\r\n\r\nexport default Volume;\r\n","/**\r\n * Residue Molecule.\r\n *\r\n * @param {Complex} complex - Molecular complex this Molecule belongs to.\r\n * @param {String} name - Molecule's name.\r\n * @param {Integer} index - Molecule's index in file.\r\n *\r\n * @exports Molecule\r\n * @constructor\r\n */\r\nclass Molecule {\r\n constructor(complex, name, index) {\r\n this.complex = complex;\r\n this.name = name || '';\r\n this.residues = [];\r\n this.mask = 1 | 0;\r\n this.index = index || -1; // start with 1\r\n }\r\n\r\n forEachResidue(process) {\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this.mask = mask;\r\n }\r\n}\r\n\r\nexport default Molecule;\r\n","import Atom from './chem/Atom';\r\nimport Element from './chem/Element';\r\nimport Bond from './chem/Bond';\r\nimport Residue from './chem/Residue';\r\nimport ResidueType from './chem/ResidueType';\r\nimport Chain from './chem/Chain';\r\nimport Helix from './chem/Helix';\r\nimport Strand from './chem/Strand';\r\nimport Sheet from './chem/Sheet';\r\nimport SGroup from './chem/SGroup';\r\nimport Assembly from './chem/Assembly';\r\nimport Complex from './chem/Complex';\r\nimport Volume from './chem/Volume';\r\nimport VoxelWorld from './chem/VoxelWorld';\r\nimport selectors from './chem/selectors';\r\nimport Molecule from './chem/Molecule';\r\n\r\nexport default {\r\n Atom,\r\n Element,\r\n Bond,\r\n Residue,\r\n ResidueType,\r\n Chain,\r\n Helix,\r\n Strand,\r\n Sheet,\r\n SGroup,\r\n Assembly,\r\n Complex,\r\n Volume,\r\n VoxelWorld,\r\n selectors,\r\n Molecule,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\n\r\nclass CSS2DObject extends THREE.Object3D {\r\n constructor(element) {\r\n super();\r\n const self = this;\r\n this._element = element;\r\n this._element.style.position = 'absolute';\r\n this.addEventListener('removed', () => {\r\n if (self._element.parentNode !== null) {\r\n self._element.parentNode.removeChild(self._element);\r\n }\r\n });\r\n }\r\n\r\n getElement() {\r\n return this._element;\r\n }\r\n\r\n /**\r\n * Sets label transparency.\r\n *\r\n * @param {number} transp - in [0; 1] 1 means fully transparent\r\n */\r\n setTransparency(transp) {\r\n const el = this.getElement();\r\n if (el === null) {\r\n return;\r\n }\r\n if (transp === 1.0) {\r\n el.style.display = 'none';\r\n return;\r\n }\r\n el.style.display = 'inline';\r\n const op = 1.0 - transp;\r\n const top = op.toString();\r\n const op100 = op * 100;\r\n el.style.opacity = top;\r\n el.style.filter = `alpha(opacity=${op100})`; // IE fallback\r\n }\r\n\r\n clone() {\r\n const obj = new CSS2DObject(this._element);\r\n obj.copy(this);\r\n return obj;\r\n }\r\n}\r\n\r\nexport default CSS2DObject;\r\n","import * as THREE from 'three';\r\n\r\nclass RCGroup extends THREE.Group {\r\n raycast(raycaster, intersects) {\r\n if (!this.visible) {\r\n return;\r\n }\r\n\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n children[i].raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].enableSubset) {\r\n children[i].enableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].disableSubset) {\r\n children[i].disableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n isEmpty() {\r\n return this.children.length === 0;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].updateToFrame) {\r\n children[i].updateToFrame(frameData);\r\n }\r\n }\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n Array.prototype.push.apply(totalSubset, children[i].getSubset(mask, innerOnly));\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default RCGroup;\r\n","/* eslint-disable no-magic-numbers */\r\nimport * as THREE from 'three';\r\nimport logger from '../utils/logger';\r\nimport CSS2DObject from './CSS2DObject';\r\nimport RCGroup from './RCGroup';\r\nimport vertexScreenQuadShader from './shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromTex from './shaders/ScreenQuadFromTex.frag';\r\nimport fragmentScreenQuadFromTexWithDistortion from './shaders/ScreenQuadFromTexWithDistortion.frag';\r\n\r\nconst LAYERS = {\r\n DEFAULT: 0, VOLUME: 1, TRANSPARENT: 2, PREPASS_TRANSPARENT: 3, VOLUME_BFPLANE: 4, COLOR_FROM_POSITION: 5, SHADOWMAP: 6,\r\n};\r\n\r\nconst SELECTION_LAYERS = [ // These layers, that are used in the selection by ray casting\r\n LAYERS.DEFAULT, LAYERS.TRANSPARENT,\r\n];\r\n\r\nTHREE.Object3D.prototype.resetTransform = function () {\r\n this.position.set(0, 0, 0);\r\n this.quaternion.set(0, 0, 0, 1);\r\n this.scale.set(1, 1, 1);\r\n};\r\n\r\n// update world matrix of this object and all its ancestors\r\nTHREE.Object3D.prototype.updateMatrixWorldRecursive = function () {\r\n if (this.parent != null) {\r\n this.parent.updateMatrixWorldRecursive();\r\n }\r\n this.updateMatrixWorld();\r\n};\r\n// add object to parent, saving objects' world transform\r\nTHREE.Object3D.prototype.addSavingWorldTransform = (function () {\r\n const _worldMatrixInverse = new THREE.Matrix4();\r\n\r\n return function (object) {\r\n if (object instanceof THREE.Object3D) {\r\n _worldMatrixInverse.copy(this.matrixWorld).invert();\r\n _worldMatrixInverse.multiply(object.matrixWorld);\r\n object.matrix.copy(_worldMatrixInverse);\r\n object.matrix.decompose(object.position, object.quaternion, object.scale);\r\n this.add(object);\r\n }\r\n };\r\n}());\r\n\r\n// render a tiny transparent quad in the center of the screen\r\nTHREE.WebGLRenderer.prototype.renderDummyQuad = (function () {\r\n const _material = new THREE.MeshBasicMaterial({ transparent: true, opacity: 0.0, depthWrite: false });\r\n\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneGeometry(0.01, 0.01), _material);\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n return function () {\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuad = (function () {\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneGeometry(1.0, 1.0));\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n return function (material) {\r\n _quad.material = material;\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.isIdentity = (function () {\r\n const identity = new THREE.Matrix4();\r\n return function () {\r\n return identity.equals(this);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.applyToPointsArray = function (array, stride, w) {\r\n if (!array || !stride || stride < 3) {\r\n return array;\r\n }\r\n w = w || 0; // use point as normal by default\r\n const e = this.elements;\r\n for (let i = 0; i < array.length; i += stride) {\r\n const x = array[i];\r\n const y = array[i + 1];\r\n const z = array[i + 2];\r\n\r\n const persp = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\r\n\r\n array[i] = (e[0] * x + e[4] * y + e[8] * z + e[12] * w) * persp;\r\n array[i + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13] * w) * persp;\r\n array[i + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14] * w) * persp;\r\n }\r\n return array;\r\n};\r\n\r\nclass ScreenQuadMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n if (params.uniforms === undefined) {\r\n params.uniforms = {};\r\n }\r\n params.uniforms.srcTex = { type: 't', value: null };\r\n params.vertexShader = vertexScreenQuadShader;\r\n params.transparent = false;\r\n params.depthTest = false;\r\n params.depthWrite = false;\r\n super(params);\r\n }\r\n}\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTex = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { opacity: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTex,\r\n transparent: true,\r\n });\r\n\r\n return function (srcTex, opacity) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.transparent = (opacity < 1.0);\r\n _material.uniforms.opacity.value = opacity;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { coef: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTexWithDistortion,\r\n });\r\n\r\n return function (srcTex, coef) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.uniforms.coef.value = coef;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\n/**\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setMinimalFov = function (angle) {\r\n if (this.aspect >= 1.0) {\r\n this.fov = angle;\r\n } else {\r\n this.fov = THREE.MathUtils.radToDeg(2 * Math.atan(Math.tan(THREE.MathUtils.degToRad(angle) * 0.5) / this.aspect));\r\n }\r\n};\r\n\r\n/**\r\n * @param {THREE.PerspectiveCamera} camera - Base camera for this stereo camera.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.StereoCamera.prototype.updateHalfSized = function (camera, angle) {\r\n const originalAspect = camera.aspect;\r\n const originalFov = camera.fov;\r\n\r\n camera.aspect = originalAspect / 2.0;\r\n camera.setMinimalFov(angle);\r\n camera.updateProjectionMatrix();\r\n\r\n this.update(camera);\r\n\r\n camera.aspect = originalAspect;\r\n camera.fov = originalFov;\r\n camera.updateProjectionMatrix();\r\n};\r\n\r\n/**\r\n * @param {number} radius - Radius of bounding sphere in angstroms to fit on screen.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setDistanceToFit = function (radius, angle) {\r\n this.position.z = radius / Math.sin(0.5 * THREE.MathUtils.degToRad(angle));\r\n};\r\n\r\n/**\r\n * @param {RCGroup} gfxObj - All objects on scene.\r\n * @param {THREE.PerspectiveCamera} camera - Camera used for rendering.\r\n * @param {number} clipPlane - Distance to clip plane.\r\n * @param {number} fogFarPlane - Distance to fog far plane.\r\n */\r\nTHREE.Raycaster.prototype.intersectVisibleObject = function (gfxObj, camera, clipPlane, fogFarPlane) {\r\n const intersects = this.intersectObject(gfxObj, false);\r\n if (intersects.length === 0) {\r\n return null;\r\n }\r\n\r\n // find point closest to camera that doesn't get clipped by camera near plane or clipPlane (if it exists)\r\n const nearPlane = Math.min(camera.near, clipPlane);\r\n let i;\r\n let p = intersects[0];\r\n const v = new THREE.Vector3();\r\n for (i = 0; i < intersects.length; ++i) {\r\n p = intersects[i];\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -nearPlane) {\r\n break;\r\n }\r\n }\r\n if (i === intersects.length) {\r\n return null;\r\n }\r\n\r\n // check that selected intersection point is not clipped by camera far plane or occluded by fog (if it exists)\r\n const farPlane = Math.min(camera.far, fogFarPlane);\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -farPlane) {\r\n return null;\r\n }\r\n return p;\r\n};\r\n\r\nTHREE.Matrix4.prototype.extractScale = (function () {\r\n const _v = new THREE.Vector3();\r\n\r\n return function (scale) {\r\n if (scale === undefined) {\r\n logger.debug('extractScale(): new is too expensive operation to do it on-the-fly');\r\n scale = _v.clone();\r\n }\r\n\r\n const te = this.elements;\r\n scale.x = _v.set(te[0], te[1], te[2]).length();\r\n scale.y = _v.set(te[4], te[5], te[6]).length();\r\n scale.z = _v.set(te[8], te[9], te[10]).length();\r\n\r\n // if determine is negative, we need to invert one scale\r\n const det = this.determinant();\r\n if (det < 0) {\r\n scale.x = -scale.x;\r\n }\r\n return scale;\r\n };\r\n}());\r\n\r\nfunction _calcCylinderMatrix(posBegin, posEnd, radius) {\r\n const posCenter = posBegin.clone().lerp(posEnd, 0.5);\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(radius, posBegin.distanceTo(posEnd), radius);\r\n\r\n const matRotHalf = new THREE.Matrix4();\r\n matRotHalf.makeRotationX(Math.PI / 2);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n const vUp = new THREE.Vector3(0, 1, 0);\r\n matRotLook.lookAt(posCenter, posEnd, vUp);\r\n\r\n matRotLook.multiply(matRotHalf);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(posCenter);\r\n return matRotLook;\r\n}\r\n\r\nfunction _calcChunkMatrix(eye, target, up, rad) {\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(rad.x, rad.y, 0);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n matRotLook.lookAt(eye, target, up);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(eye);\r\n\r\n return matRotLook;\r\n}\r\n\r\nfunction _groupHasGeometryToRender(group) {\r\n let hasGeoms = false;\r\n group.traverse((node) => {\r\n if (node.hasOwnProperty('geometry') || node instanceof CSS2DObject) {\r\n hasGeoms = true;\r\n }\r\n });\r\n return hasGeoms;\r\n}\r\n\r\nfunction _buildDistorionMesh(widthSegments, heightSegements, coef) {\r\n // solve equation r_u = r_d * (1 + k * r_d^2)\r\n // for r_d using iterations\r\n // takes: r_u^2\r\n // returns: r_d / r_u factor that can be used to distort point coords\r\n function calcInverseBarrel(r2) {\r\n const epsilon = 1e-5;\r\n let prevR2 = 0.0;\r\n let curR2 = r2;\r\n let dr = 1.0;\r\n while (Math.abs(curR2 - prevR2) > epsilon) {\r\n dr = 1.0 + coef * curR2;\r\n prevR2 = curR2;\r\n curR2 = r2 / (dr * dr);\r\n }\r\n\r\n return 1.0 / dr;\r\n }\r\n\r\n const geo = new THREE.PlaneGeometry(2.0, 2.0, widthSegments, heightSegements);\r\n\r\n const pos = geo.getAttribute('position');\r\n for (let i = 0; i < pos.count; ++i) {\r\n const x = pos.array[3 * i];\r\n const y = pos.array[3 * i + 1];\r\n const c = calcInverseBarrel(x * x + y * y);\r\n pos.setXY(i, c * x, c * y);\r\n }\r\n\r\n return geo;\r\n}\r\n\r\nTHREE.BufferAttribute.prototype.copyAtList = function (attribute, indexList) {\r\n console.assert(\r\n this.itemSize === attribute.itemSize,\r\n 'DEBUG: BufferAttribute.copyAtList buffers have different item size.',\r\n );\r\n const { itemSize } = this;\r\n for (let i = 0, n = indexList.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n this.array[i * itemSize + j] = attribute.array[indexList[i] * itemSize + j];\r\n }\r\n }\r\n return this;\r\n};\r\n\r\nfunction fillArray(array, value, startIndex, endIndex) {\r\n startIndex = (typeof startIndex !== 'undefined') ? startIndex : 0;\r\n endIndex = (typeof endIndex !== 'undefined') ? endIndex : array.length;\r\n for (let i = startIndex; i < endIndex; ++i) {\r\n array[i] = value;\r\n }\r\n}\r\n\r\n/** @param {THREE.Object3D} object - Parent object. */\r\nfunction removeChildren(object) {\r\n const { children } = object;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n child.parent = null;\r\n child.dispatchEvent({ type: 'removed' });\r\n }\r\n object.children = [];\r\n}\r\n\r\nfunction clearTree(object) {\r\n object.traverse((obj) => {\r\n if (obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line) {\r\n obj.geometry.dispose();\r\n }\r\n });\r\n removeChildren(object);\r\n}\r\n\r\nfunction destroyObject(object) {\r\n clearTree(object);\r\n if (object.parent) {\r\n object.parent.remove(object);\r\n } else {\r\n object.dispatchEvent({ type: 'removed' });\r\n }\r\n}\r\n\r\nfunction belongToSelectLayers(object) {\r\n for (let i = 0; i < SELECTION_LAYERS.length; i++) {\r\n if (((object.layers.mask >> SELECTION_LAYERS[i]) & 1) === 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction processObjRenderOrder(root, idMaterial) {\r\n // set renderOrder to 0 for Backdrop and to 1 in other cases to render Backdrop earlier all other materials\r\n const renderOrder = +(idMaterial !== 'BA');\r\n root.traverse((object) => {\r\n if (object.isGroup) {\r\n object.renderOrder = renderOrder;\r\n }\r\n });\r\n}\r\n\r\nfunction applySelectionMaterial(geo) {\r\n geo.traverse((node) => {\r\n if ('material' in node) {\r\n node.material = node.material.clone(true);\r\n // using z-offset to magically fix selection rendering artifact (on z-sprites)\r\n node.material.setValues({\r\n depthFunc: THREE.LessEqualDepth,\r\n overrideColor: true,\r\n fog: false,\r\n lights: false,\r\n shadowmap: false,\r\n });\r\n node.material.setUberOptions({ fixedColor: new THREE.Color(0xFFFF00), zOffset: -1e-6 });\r\n }\r\n });\r\n}\r\n\r\nfunction getMiddlePoint(point1, point2, optionalTarget) {\r\n const result = optionalTarget || new THREE.Vector3();\r\n\r\n result.set(0, 0, 0);\r\n result.addScaledVector(point1, 0.5);\r\n result.addScaledVector(point2, 0.5);\r\n\r\n return result;\r\n}\r\n\r\n// Monkey-patch for \"InstancedBufferGeometry.instanceCount becomes undefined after copy()\"\r\n// https://github.com/mrdoob/three.js/issues/22151\r\nconst _oldInstancedBufferGeometryCopy = THREE.InstancedBufferGeometry.prototype.copy;\r\n\r\nTHREE.InstancedBufferGeometry.prototype.copy = function (source) {\r\n _oldInstancedBufferGeometryCopy.call(this, source);\r\n if (this.instanceCount === undefined) {\r\n this.instanceCount = Infinity;\r\n }\r\n};\r\n\r\nexport default {\r\n calcCylinderMatrix: _calcCylinderMatrix,\r\n calcChunkMatrix: _calcChunkMatrix,\r\n groupHasGeometryToRender: _groupHasGeometryToRender,\r\n buildDistorionMesh: _buildDistorionMesh,\r\n RCGroup,\r\n fillArray,\r\n clearTree,\r\n destroyObject,\r\n belongToSelectLayers,\r\n processObjRenderOrder,\r\n applySelectionMaterial,\r\n getMiddlePoint,\r\n LAYERS,\r\n};\r\n","import * as THREE from 'three';\r\nimport gfxutils from './gfx/gfxutils';\r\n\r\nconst _defaultBoundaries = {\r\n boundingBox: new THREE.Box3(new THREE.Vector3(-1, -1, -1), new THREE.Vector3(1, 1, 1)),\r\n boundingSphere: new THREE.Sphere(new THREE.Vector3(0, 0, 0), 1),\r\n};\r\n\r\nclass Visual extends gfxutils.RCGroup {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this.name = name;\r\n this._dataSource = dataSource;\r\n }\r\n\r\n release() {\r\n if (this.parent) {\r\n this.parent.remove(this);\r\n }\r\n }\r\n\r\n getDataSource() {\r\n return this._dataSource;\r\n }\r\n\r\n getBoundaries() {\r\n return _defaultBoundaries;\r\n }\r\n}\r\n\r\nexport default Visual;\r\n","function _ensureArray(x) {\r\n if (x === null || x === undefined || Array.isArray(x)) {\r\n return x;\r\n }\r\n return [x];\r\n}\r\n\r\n/** An indexed list of objects or classes. */\r\nclass EntityList {\r\n /**\r\n * Create a list of objects.\r\n * The objects can be indexed by one or more properties for the later retrieval.\r\n *\r\n * @param {!Array=} entities A list of objects to automatically register at creation time.\r\n * @param {!Array=} indices A list of property names to use for case-insensitive indexing.\r\n * By default, a single `.id` property is used.\r\n * @see EntityList#register\r\n */\r\n constructor(entities = [], indices = ['id']) {\r\n this._list = [];\r\n this._dict = {};\r\n this._indices = [...indices];\r\n this._indices.forEach((index) => {\r\n this._dict[index] = {};\r\n });\r\n\r\n entities.forEach((entity) => this.register(entity));\r\n }\r\n\r\n /**\r\n * Add a value to the end of a list.\r\n * The list will contain only one copy of the value.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromList\r\n * @see EntityList.registerInDict\r\n */\r\n static registerInList(list, value) {\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a value from a list if it is there.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to remove.\r\n * @see EntityList.registerInList\r\n */\r\n static unregisterFromList(list, value) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Add a value to a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromDict\r\n * @see EntityList.registerInList\r\n */\r\n static registerInDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key] = dict[key] || [];\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Remove a value from a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.registerInDict\r\n */\r\n static unregisterFromDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key];\r\n if (list) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n if (list.length === 0) {\r\n delete dict[key];\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Add an entity to this list.\r\n *\r\n * @param {!Object} entity An object or a class to register. The object must include all\r\n * properties specified as indices on construction.\r\n * @see EntityList#unregister\r\n */\r\n register(entity) {\r\n EntityList.registerInList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.registerInDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * Remove an entity from this list.\r\n *\r\n * @param {!Object} entity An object or a class to unregister. The object may be\r\n * missing from the list but it must include all properties specified as indices\r\n * on construction.\r\n * @see EntityList#register\r\n */\r\n unregister(entity) {\r\n EntityList.unregisterFromList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.unregisterFromDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * An ordered list of all registered entities.\r\n * It is a read-only copy, use {@link EntityList#register} and {@link EntityList#unregister}\r\n * to modify it.\r\n *\r\n * @type {!Array}\r\n */\r\n get all() {\r\n return [...this._list];\r\n }\r\n\r\n /**\r\n * The first registered entity.\r\n * Use it if you do not care which entity you are referring to.\r\n *\r\n * @type {Object=}\r\n */\r\n get first() {\r\n return this._list[0];\r\n }\r\n\r\n /**\r\n * Retrieve a list of keys for the index.\r\n *\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {!Array} An unordered list of keys in the index, i.e. particular property\r\n * values for all registered entities.\r\n */\r\n keys(index) {\r\n return Object.keys(this._dict[index || this._indices[0]]);\r\n }\r\n\r\n /**\r\n * Retrieve an entity by its key.\r\n *\r\n * @param {string} key A case-insensitive property value to look-up.\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {Object=} An object registered in the index under the key. If there are multiple\r\n * objects under the same key, the first one is returned.\r\n */\r\n get(key, index) {\r\n const dict = this._dict[index || this._indices[0]];\r\n if (dict) {\r\n const values = dict[key && key.toLowerCase()];\r\n return values && values.length > 0 ? values[0] : undefined;\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nexport default EntityList;\r\n","import settings from '../settings';\r\nimport logger from './logger';\r\n\r\nfunction makeContextDependent(prototype) {\r\n Object.defineProperties(prototype, {\r\n logger: {\r\n get() {\r\n return this.context && this.context.logger ? this.context.logger : logger;\r\n },\r\n },\r\n settings: {\r\n get() {\r\n return this.context && this.context.settings ? this.context.settings : settings;\r\n },\r\n },\r\n });\r\n}\r\n\r\nexport default makeContextDependent;\r\n","import * as THREE from 'three';\r\n\r\nclass CollisionSphere {\r\n constructor(position, radius) {\r\n this._position = position;\r\n this._radius = radius;\r\n }\r\n\r\n static _sphere = new THREE.Sphere();\r\n\r\n raycast(raycaster) {\r\n const sphere = CollisionSphere._sphere;\r\n sphere.set(this._position, this._radius);\r\n\r\n const p = new THREE.Vector3();\r\n if (raycaster.ray.intersectSphere(sphere, p)) {\r\n return {\r\n distance: raycaster.ray.origin.distanceTo(p),\r\n point: p,\r\n };\r\n }\r\n return null;\r\n }\r\n}\r\n\r\nconst SphereCollisionGeo = (base) => class extends base {\r\n constructor(count, ...args) {\r\n super(...args);\r\n this._objects = new Array(count);\r\n this.boundingSphere = null;\r\n this.boundingBox = null;\r\n }\r\n\r\n setSphere(idx, position, radius) {\r\n this._objects[idx] = new CollisionSphere(position, radius);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n // TODO raycast with bounding sphere? How to deal with updates?\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const inters = this._objects[i].raycast(raycaster);\r\n if (inters) {\r\n inters.chunkIdx = i;\r\n intersects.push(inters);\r\n }\r\n }\r\n }\r\n\r\n computeBoundingBox() {\r\n const objects = this._objects;\r\n let { boundingBox } = this;\r\n if (boundingBox === null) {\r\n this.boundingBox = boundingBox = new THREE.Box3();\r\n }\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n boundingBox.expandByPoint(objects[i]._position);\r\n }\r\n }\r\n\r\n computeBoundingSphere() {\r\n this.computeBoundingBox();\r\n const objects = this._objects;\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n const pos = objects[i]._position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n if (this.boundingSphere === null) {\r\n this.boundingSphere = new THREE.Sphere();\r\n }\r\n this.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n};\r\nexport default SphereCollisionGeo;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst tmpColor = new THREE.Color();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\nclass InstancedSpheresGeometry extends SphereCollisionGeo(THREE.InstancedBufferGeometry) {\r\n constructor(spheresCount, sphereComplexity, useZSprites) {\r\n super(spheresCount);\r\n this._sphGeometry = useZSprites ? new THREE.PlaneGeometry(2, 2, 1, 1)\r\n : new THREE.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI);\r\n this._init(spheresCount, this._sphGeometry);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n setArrayXYZW(this._offsets, itemIdx * OFFSET_SIZE, itemPos.x, itemPos.y, itemPos.z, itemRad);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n\r\n setColor(itemIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n setArrayXYZ(this._colors, itemIdx * COLOR_SIZE, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('offset').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[chunkIndices[i]] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._sphGeometry);\r\n\r\n copySubArrays(this._offsets, geom._offsets, chunkIndices, OFFSET_SIZE);\r\n copySubArrays(this._colors, geom._colors, chunkIndices, COLOR_SIZE);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(spheresCount, sphereGeo) {\r\n this.copy(sphereGeo);\r\n\r\n this._offsets = utils.allocateTyped(Float32Array, spheresCount * OFFSET_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, spheresCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('offset', new THREE.InstancedBufferAttribute(this._offsets, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._colors, COLOR_SIZE, false, 1));\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(alpha, 1, false, 1));\r\n }\r\n}\r\nexport default InstancedSpheresGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VEC_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n */\r\n\r\nclass ChunkedObjectsGeometry extends THREE.BufferGeometry {\r\n constructor(chunkGeo, chunksCount) {\r\n super();\r\n\r\n if (this.constructor === ChunkedObjectsGeometry) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n\r\n this._chunkGeo = chunkGeo;\r\n\r\n this._init(chunkGeo, chunksCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('normal').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n const idx = i * VEC_SIZE;\r\n colors[idx] = tmpColor.r;\r\n colors[idx + 1] = tmpColor.g;\r\n colors[idx + 2] = tmpColor.b;\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n _.fill(alphaArr, value, left, left + chunkSize);\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n // use THREE.Mesh raycasting interface for the Geometry. The Mesh is\r\n // created with existed geometry and default material, so it doesn't slowdown.\r\n const mesh = new THREE.Mesh();\r\n mesh.geometry = this;\r\n mesh.raycast(raycaster, inters);\r\n\r\n const facesPerChunk = this._chunkGeo.index.count / 3;\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('faceIndex')) {\r\n continue;\r\n }\r\n inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk);\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.BufferGeometry();\r\n this._init.call(geom, this._chunkGeo, instanceCount);\r\n\r\n const srcPos = this._positions;\r\n const srcNorm = this._normals;\r\n const srcColor = this._colors;\r\n\r\n const dstPos = geom._positions;\r\n const dstNorm = geom._normals;\r\n const dstColor = geom._colors;\r\n\r\n const chunkSize = this._chunkSize * VEC_SIZE;\r\n\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const ptIdxBegin = chunkIndices[i] * chunkSize;\r\n const ptIdxEnd = ptIdxBegin + chunkSize;\r\n dstPos.set(srcPos.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstNorm.set(srcNorm.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstColor.set(srcColor.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n }\r\n\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(chunkGeo, chunksCount) {\r\n const chunkSize = this._chunkSize = chunkGeo.attributes.position.count;\r\n const chunkIndex = chunkGeo.index.array;\r\n const chunkIndexSize = chunkIndex.length;\r\n const pointsCount = this._chunkSize * chunksCount;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n const indexSize = chunkIndexSize * chunksCount;\r\n const index = this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, indexSize);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._normals = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n for (let i = 0; i < chunksCount; ++i) {\r\n const offset = i * chunkIndexSize;\r\n const posOffset = i * chunkSize;\r\n index.set(chunkIndex, offset);\r\n for (let j = 0; j < chunkIndexSize; ++j) {\r\n index[offset + j] += posOffset;\r\n }\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, VEC_SIZE));\r\n this.setAttribute('normal', new THREE.BufferAttribute(this._normals, VEC_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, VEC_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n }\r\n}\r\nexport default ChunkedObjectsGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst VEC_SIZE = 3;\r\n\r\nclass SimpleSpheresGeometry extends SphereCollisionGeo(ChunkedObjectsGeometry) {\r\n constructor(spheresCount, sphereComplexity) {\r\n const sphGeometry = new THREE.SphereBufferGeometry(\r\n 1,\r\n sphereComplexity * 2,\r\n sphereComplexity,\r\n 0,\r\n Math.PI * 2,\r\n 0,\r\n Math.PI,\r\n );\r\n super(spheresCount, sphGeometry, spheresCount);\r\n\r\n const normals = this._normals;\r\n const geoNormals = sphGeometry.attributes.normal.array;\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._tmpPositions = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n for (let i = 0; i < spheresCount; ++i) {\r\n normals.set(geoNormals, chunkSize * VEC_SIZE * i);\r\n }\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n const tmpPos = this._tmpPositions;\r\n const chunkSize = this._chunkSize;\r\n const geoPos = this._chunkPos;\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n const idx = i * 3;\r\n tmpPos[idx] = itemPos.x + geoPos[idx] * itemRad;\r\n tmpPos[idx + 1] = itemPos.y + geoPos[idx + 1] * itemRad;\r\n tmpPos[idx + 2] = itemPos.z + geoPos[idx + 2] * itemRad;\r\n }\r\n\r\n this._positions.set(tmpPos, chunkSize * itemIdx * VEC_SIZE);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n}\r\nexport default SimpleSpheresGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst centerPos = new THREE.Vector3();\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\nclass Simple2CCylindersGeometry extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, 2 * instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const firstOffset = chunkSize * 2 * itemIdx * VEC_SIZE;\r\n const secondOffset = firstOffset + chunkSize * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n centerPos.lerpVectors(botPos, topPos, 0.5);\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, centerPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, firstOffset);\r\n\r\n // now shift center to get another part of the cylinder\r\n centerPos.sub(botPos);\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpArray[idx] += centerPos.x;\r\n tmpArray[idx + 1] += centerPos.y;\r\n tmpArray[idx + 2] += centerPos.z;\r\n }\r\n this._positions.set(tmpArray, secondOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, firstOffset);\r\n this._normals.set(tmpArray, secondOffset);\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const first = 2 * itemIdx;\r\n super.setColor(first, colorVal1);\r\n\r\n const second = first + 1;\r\n super.setColor(second, colorVal2);\r\n }\r\n}\r\n\r\nexport default Simple2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_POINTS_COUNT_16BIT = 65536;\r\nconst PTS_PER_TRIANGLE = 3;\r\n\r\nclass CylinderBufferGeometry extends THREE.BufferGeometry {\r\n constructor(\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n ) {\r\n super();\r\n\r\n const thetaStart = 0;\r\n const thetaLength = 2 * Math.PI;\r\n\r\n this.type = 'CylinderBufferGeometry';\r\n\r\n this.parameters = {\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n };\r\n\r\n const hasTop = openEnded === false && radiusTop > 0;\r\n const hasBottom = openEnded === false && radiusBottom > 0;\r\n const vertexCount = (heightSegments + 1) * radialSegments\r\n + hasTop * (radialSegments + 1)\r\n + hasBottom * (radialSegments + 1);\r\n const facesCount = (2 * heightSegments + hasTop + hasBottom) * radialSegments;\r\n\r\n const heightHalf = height / 2;\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const positions = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const normals = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const indices = new THREE.Uint16BufferAttribute(utils.allocateTyped(Uint16Array, facesCount * PTS_PER_TRIANGLE), 1);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const uvs = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 2), 2);\r\n console.assert(vertexCount < MAX_POINTS_COUNT_16BIT, 'DEBUG: Cylinder Geometry has too many vertices (65536 max).');\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n const tanTheta = -(radiusBottom - radiusTop) / height;\r\n\r\n // setup cylinder data\r\n for (let y = 0; y <= heightSegments; y++) {\r\n // faces\r\n if (y !== heightSegments) {\r\n for (let i = 0; i < radialSegments; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + radialSegments + i;\r\n const v3 = currVtxIdx + radialSegments + ((i + 1) % radialSegments);\r\n const v4 = currVtxIdx + ((i + 1) % radialSegments);\r\n\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n // vertices\r\n const v = y / heightSegments;\r\n const radius = v * (radiusBottom - radiusTop) + radiusTop;\r\n\r\n for (let x = 0; x < radialSegments; x++) {\r\n const u = x / radialSegments;\r\n\r\n const vx = radius * Math.sin(u * thetaLength + thetaStart);\r\n const vy = v * height - heightHalf;\r\n const vz = radius * Math.cos(u * thetaLength + thetaStart);\r\n\r\n const normal = new THREE.Vector3(\r\n vx,\r\n Math.sqrt(vx * vx + vz * vz) * tanTheta,\r\n vz,\r\n ).normalize();\r\n\r\n positions.setXYZ(currVtxIdx, vx, vy, vz);\r\n normals.setXYZ(currVtxIdx, normal.x, normal.y, normal.z);\r\n uvs.setXY(currVtxIdx, u, v);\r\n ++currVtxIdx;\r\n }\r\n }\r\n\r\n // top cap\r\n if (hasTop) {\r\n const startTIdx = currVtxIdx;\r\n const lastIdx = currVtxIdx + radialSegments;\r\n for (let fTIdx = 0; fTIdx < radialSegments; ++fTIdx) {\r\n const currSrcIdx = currVtxIdx - radialSegments;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcIdx),\r\n positions.getY(currSrcIdx),\r\n positions.getZ(currSrcIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n\r\n const nextTVtx = startTIdx + ((fTIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, currVtxIdx, nextTVtx, lastIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n ++currVtxIdx;\r\n }\r\n\r\n // bottom cap\r\n if (hasBottom) {\r\n const startBIdx = currVtxIdx;\r\n const lastBIdx = currVtxIdx + radialSegments;\r\n for (let fBIdx = 0; fBIdx < radialSegments; ++fBIdx) {\r\n const currSrcBIdx = fBIdx;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcBIdx),\r\n positions.getY(currSrcBIdx),\r\n positions.getZ(currSrcBIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n\r\n const nextBVtx = startBIdx + ((fBIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, nextBVtx, currVtxIdx, lastBIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, -heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n }\r\n\r\n this.setIndex(indices);\r\n this.setAttribute('position', positions);\r\n this.setAttribute('normal', normals);\r\n this.setAttribute('uv', uvs);\r\n }\r\n\r\n clone() {\r\n const { parameters } = this;\r\n\r\n return new CylinderBufferGeometry(\r\n parameters.radiusTop,\r\n parameters.radiusBottom,\r\n parameters.height,\r\n parameters.radialSegments,\r\n parameters.heightSegments,\r\n parameters.openEnded,\r\n );\r\n }\r\n}\r\n\r\nexport default CylinderBufferGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport CylinderBufferGeometry from './CylinderBufferGeometry';\r\n\r\nconst tmpColor = new THREE.Color();\r\nconst invMatrix = new THREE.Matrix4();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction sortNumber(a, b) {\r\n return a - b;\r\n}\r\n\r\nfunction _prepareCylinderInfo(chunkIndices) {\r\n chunkIndices.sort(sortNumber);\r\n const chunksIdx = [];\r\n const cylinderInfo = [];\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const val = chunkIndices[i];\r\n const even = (val | 0) % 2 === 0;\r\n const newPar = {\r\n first: false,\r\n second: false,\r\n };\r\n if (even) {\r\n newPar.first = true;\r\n newPar.second = i + 1 < n && chunkIndices[i + 1] === chunkIndices[i] + 1;\r\n if (newPar.second) {\r\n ++i;\r\n }\r\n } else {\r\n newPar.second = true;\r\n }\r\n chunksIdx.push(Math.floor(val / 2));\r\n cylinderInfo.push(newPar);\r\n }\r\n return { indices: chunksIdx, cylinderInfo };\r\n}\r\n\r\nfunction _assignOpacity(cylinderInfo, color1, color2) {\r\n for (let i = 0, n = cylinderInfo.length; i < n; ++i) {\r\n const info = cylinderInfo[i];\r\n if (!info.first) {\r\n color1[COLOR_SIZE * i] = -0.5;\r\n }\r\n if (!info.second) {\r\n color2[COLOR_SIZE * i] = -0.5;\r\n }\r\n }\r\n}\r\nclass Instanced2CCylindersGeometry extends THREE.InstancedBufferGeometry {\r\n constructor(instanceCount, polyComplexity, useZSprites, openEnded) {\r\n super();\r\n this._useZSprites = useZSprites;\r\n this._cylGeometry = useZSprites ? new THREE.PlaneGeometry(2, 2, 1, 1)\r\n : new CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, openEnded);\r\n this._init(instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n this._collisionGeo = new Simple2CCylindersGeometry(instanceCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const matrix = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n let me = matrix.elements;\r\n const mtxOffset = itemIdx * OFFSET_SIZE;\r\n\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, itemRad);\r\n setArrayXYZW(this._matVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._matVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._matVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n\r\n if (this._useZSprites) {\r\n invMatrix.copy(matrix).invert();\r\n me = invMatrix.elements;\r\n setArrayXYZW(this._invmatVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._invmatVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._invmatVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n }\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const colorIdx = itemIdx * COLOR_SIZE;\r\n tmpColor.set(colorVal1);\r\n setArrayXYZ(this._color1, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n tmpColor.set(colorVal2);\r\n setArrayXYZ(this._color2, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n computeBoundingSphere() {\r\n this._collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = this._collisionGeo.boundingSphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n this._collisionGeo.computeBoundingBox();\r\n this.boundingBox = this._collisionGeo.boundingBox;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('matVector1').needsUpdate = true;\r\n this.getAttribute('matVector2').needsUpdate = true;\r\n this.getAttribute('matVector3').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('color2').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n if (this._useZSprites) {\r\n this.getAttribute('invmatVector1').needsUpdate = true;\r\n this.getAttribute('invmatVector2').needsUpdate = true;\r\n this.getAttribute('invmatVector3').needsUpdate = true;\r\n }\r\n\r\n this._collisionGeo.finishUpdate();\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[Math.floor(chunkIndices[i] / 2)] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const info = _prepareCylinderInfo(chunkIndices);\r\n const cylinderIndices = info.indices;\r\n const instanceCount = cylinderIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n copySubArrays(this._matVector1, geom._matVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector2, geom._matVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector3, geom._matVector3, cylinderIndices, OFFSET_SIZE);\r\n\r\n if (this._useZSprites) {\r\n copySubArrays(this._invmatVector1, geom._invmatVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector2, geom._invmatVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector3, geom._invmatVector3, cylinderIndices, OFFSET_SIZE);\r\n }\r\n\r\n copySubArrays(this._color1, geom._color1, cylinderIndices, COLOR_SIZE);\r\n copySubArrays(this._color2, geom._color2, cylinderIndices, COLOR_SIZE);\r\n _assignOpacity(info.cylinderInfo, geom._color1, geom._color2);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n getGeoParams() {\r\n return this._cylGeometry.parameters;\r\n }\r\n\r\n _init(instanceCount, cylinderGeo, useZSprites) {\r\n this.copy(cylinderGeo);\r\n this._matVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._color1 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n this._color2 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, instanceCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('matVector1', new THREE.InstancedBufferAttribute(this._matVector1, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector2', new THREE.InstancedBufferAttribute(this._matVector2, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector3', new THREE.InstancedBufferAttribute(this._matVector3, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._color1, COLOR_SIZE, false, 1));\r\n this.setAttribute('color2', new THREE.InstancedBufferAttribute(this._color2, COLOR_SIZE, false, 1));\r\n\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(this._alpha, 1, false, 1));\r\n\r\n if (useZSprites) {\r\n this._invmatVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n\r\n this.setAttribute(\r\n 'invmatVector1',\r\n new THREE.InstancedBufferAttribute(this._invmatVector1, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector2',\r\n new THREE.InstancedBufferAttribute(this._invmatVector2, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector3',\r\n new THREE.InstancedBufferAttribute(this._invmatVector3, OFFSET_SIZE, false, 1),\r\n );\r\n }\r\n }\r\n}\r\n\r\nexport default Instanced2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst TRI_SIZE = 3;\r\nconst tmpPrev = new THREE.Vector3();\r\nconst tmpNext = new THREE.Vector3();\r\nconst tmpRes = new THREE.Vector3();\r\nconst simpleNormal = new THREE.Vector3(1.0, 0.0, 0.0);\r\nconst normalOnCut = new THREE.Vector3();\r\nconst nearRingPt = new THREE.Vector3();\r\n\r\nfunction _createExtrudedChunkGeometry(shape, ringsCount) {\r\n const geo = new THREE.BufferGeometry();\r\n const ptsCount = shape.length;\r\n const totalPts = ptsCount * ringsCount;\r\n const type = totalPts <= 65536 ? Uint16Array : Uint32Array;\r\n const facesPerChunk = (ringsCount - 1) * ptsCount * 2;\r\n const indices = new THREE.BufferAttribute(utils.allocateTyped(type, facesPerChunk * TRI_SIZE), 1);\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n for (let y = 0; y < ringsCount; y++) {\r\n // faces\r\n if (y !== ringsCount - 1) {\r\n for (let i = 0; i < ptsCount; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + ptsCount + i;\r\n const v3 = currVtxIdx + ptsCount + ((i + 1) % ptsCount);\r\n const v4 = currVtxIdx + ((i + 1) % ptsCount);\r\n\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n currVtxIdx += ptsCount;\r\n }\r\n\r\n geo.setIndex(indices);\r\n const pos = utils.allocateTyped(Float32Array, totalPts * VEC_SIZE);\r\n geo.setAttribute('position', new THREE.BufferAttribute(pos, VEC_SIZE));\r\n\r\n geo._positions = shape;\r\n\r\n return geo;\r\n}\r\n\r\nclass ExtrudedObjectsGeometry extends ChunkedObjectsGeometry {\r\n constructor(shape, ringsCount, chunksCount) {\r\n const chunkGeo = _createExtrudedChunkGeometry(shape, ringsCount);\r\n super(chunkGeo, chunksCount);\r\n this._ringsCount = ringsCount;\r\n\r\n const tmpShape = this._tmpShape = [];\r\n for (let i = 0; i < shape.length; ++i) {\r\n tmpShape[i] = new THREE.Vector3();\r\n }\r\n }\r\n\r\n setItem(itemIdx, matrices, hasSlope = false, hasCut = false) {\r\n const ptsCount = this._chunkGeo._positions.length;\r\n const ringsCount = this._ringsCount;\r\n const chunkStartIdx = ptsCount * this._ringsCount * itemIdx * VEC_SIZE;\r\n\r\n this._setPoints(matrices, ptsCount, ringsCount, chunkStartIdx);\r\n\r\n if (hasSlope) {\r\n this._setSlopeNormals(ptsCount, ringsCount, chunkStartIdx);\r\n } else {\r\n this._setBaseNormals(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n\r\n if (hasCut) {\r\n this._addCut(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n }\r\n\r\n _setPoints(matrices, ptsCount, ringsCount, chunkStartIdx) {\r\n const tmpShape = this._tmpShape;\r\n const positions = this._positions;\r\n const shape = this._chunkGeo._positions;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i) {\r\n const mtx = matrices[i];\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpShape[j].copy(shape[j]).applyMatrix4(mtx).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _setBaseNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, false);\r\n }\r\n }\r\n\r\n _setSlopeNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const normals = this._normals;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First ring\r\n // In all cases, besides cut, second ring is coincident to first. So values of first ring's normals doesn't\r\n // matter (In the cut case special handler will be applied later and will set them to correct values)\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n simpleNormal.toArray(normals, vtxIdx);\r\n }\r\n // second ring\r\n // If it isn't first Item we take normals' values from the last ring of the previous item (these rings are coincident)\r\n // else we count normals' values based on next ring information\r\n if (vtxIdx - 2 * nPtsInRing > 0) {\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(normals, vtxIdx - 2 * nPtsInRing).toArray(normals, vtxIdx);\r\n }\r\n } else {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, +nPtsInRing);\r\n vtxIdx += nPtsInRing;\r\n }\r\n // other rings\r\n // we count normals' values based on previous ring information\r\n for (let i = 2; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, -nPtsInRing);\r\n }\r\n }\r\n\r\n // Counting normals:\r\n // - Slope\r\n // Radius changes throught part => normals aren't parallel with the plane contains section points\r\n // normal = vTangentInSectionPlane x vToSuchPointInPrevSection (all vectors are scaled for being 1 in length)\r\n // - No slope\r\n // Radius doesn't change throught part => normals are parallel with the plane contains section points\r\n // normal = vToPrevPointInSection + vToNextPointInSection (all vectors are scaled for being 1 in length)\r\n _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) {\r\n const tmpShape = this._tmpShape;\r\n const normals = this._normals;\r\n\r\n tmpShape[0].fromArray(this._positions, vtxIdx);\r\n tmpShape[ptsCount - 1].fromArray(this._positions, vtxIdx + (ptsCount - 1) * VEC_SIZE);\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n if (j < ptsCount - 1) {\r\n tmpShape[j + 1].fromArray(this._positions, vtxIdx + VEC_SIZE);\r\n }\r\n\r\n if (isSlope) {\r\n nearRingPt.fromArray(this._positions, vtxIdx + shiftToExtraPt);\r\n\r\n tmpPrev.subVectors(tmpShape[(j + ptsCount - 1) % ptsCount], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], nearRingPt).normalize();\r\n tmpRes.crossVectors(tmpNext, tmpPrev).normalize().toArray(normals, vtxIdx);\r\n } else {\r\n tmpPrev.subVectors(tmpShape[j], tmpShape[(j + ptsCount - 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpRes.addVectors(tmpPrev, tmpNext).normalize().toArray(normals, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _addCut(ptsCount, ringsCount, chunkStartIdx) {\r\n // Nothing to do if item is flat or only line\r\n if (ptsCount < 3 || ringsCount < 2) {\r\n return;\r\n }\r\n const positions = this._positions;\r\n const normals = this._normals;\r\n const tmpShape = this._tmpShape;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n // Normal to the cut plane is equal to cross product of two vectors which are lying in it\r\n tmpShape[0].fromArray(positions, chunkStartIdx);\r\n tmpShape[1].fromArray(positions, chunkStartIdx + VEC_SIZE);\r\n tmpShape[2].fromArray(positions, chunkStartIdx + 2 * VEC_SIZE);\r\n\r\n tmpPrev.subVectors(tmpShape[1], tmpShape[0]).normalize();\r\n tmpNext.subVectors(tmpShape[1], tmpShape[2]).normalize();\r\n normalOnCut.crossVectors(tmpPrev, tmpNext).normalize();\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First and second rings normals' values are equal to value of normal to the cutting plane\r\n for (let j = 0; j < ptsCount * 2; ++j, vtxIdx += VEC_SIZE) {\r\n normalOnCut.toArray(normals, vtxIdx);\r\n }\r\n if (ringsCount > 2) {\r\n // Third ring points are coincident to first ring points, but have different normals. It makes sharp angle near cut\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(positions, vtxIdx - nPtsInRing).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default ExtrudedObjectsGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VERTEX_PER_SEGMENT = 4;\r\nconst POS_SIZE = 4;\r\nconst DIR_SIZE = 3;\r\nconst COL_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\nconst direction = new THREE.Vector3();\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction getSubset(arr, startSegmentIdx, segmentsCount, elemSize) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT;\r\n const end = start + segmentsCount * VERTEX_PER_SEGMENT;\r\n return arr.subarray(start * elemSize, end * elemSize);\r\n}\r\n\r\n/**\r\n * This class represents lines geometry which consists of screen-aligned narrow quad of variable width.\r\n *\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * collision geometry.\r\n */\r\n\r\nclass ThickLinesGeometry extends THREE.BufferGeometry {\r\n constructor(segmentsCount) {\r\n super();\r\n this._initVertices(segmentsCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n this.getAttribute('direction').needsUpdate = true;\r\n }\r\n\r\n setColor(segmentIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n setSegment(segmentIdx, pos1, pos2) {\r\n direction.subVectors(pos1, pos2);\r\n direction.normalize();\r\n const positions = this._positions;\r\n const directions = this._directions;\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n let dirIdx = segmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n }\r\n\r\n setOpacity(startSegIdx, endSegIdx, value) {\r\n const start = startSegIdx * VERTEX_PER_SEGMENT;\r\n const end = endSegIdx * VERTEX_PER_SEGMENT;\r\n _.fill(this.alpha, value, end, start);\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubsetSegments(startSegmentIdx, segmentsCount) {\r\n return [\r\n getSubset(this._positions, startSegmentIdx, segmentsCount, POS_SIZE),\r\n getSubset(this._directions, startSegmentIdx, segmentsCount, DIR_SIZE),\r\n ];\r\n }\r\n\r\n getSubsetColors(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._colors, startSegmentIdx, segmentsCount, COL_SIZE);\r\n }\r\n\r\n getSubsetOpacities(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._alpha, startSegmentIdx, segmentsCount, 1);\r\n }\r\n\r\n getNumVertexPerSegment() {\r\n return VERTEX_PER_SEGMENT;\r\n }\r\n\r\n getPositionSize() {\r\n return POS_SIZE;\r\n }\r\n\r\n setSegments(startSegmentIdx, positions) {\r\n const startPos = startSegmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n if (positions instanceof Array && positions.length === 2) {\r\n this._positions.set(positions[0], startPos);\r\n const startDir = startSegmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n this._directions.set(positions[1], startDir); // dirs are geo part of vertex\r\n } else {\r\n this._positions.set(positions, startPos);\r\n }\r\n }\r\n\r\n setColors(startSegmentIdx, colors) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n this._colors.set(colors, start);\r\n }\r\n\r\n _initVertices(segmentsCount) {\r\n this._buffersSize = segmentsCount * VERTEX_PER_SEGMENT;\r\n const pointsCount = this._buffersSize;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, segmentsCount * 6);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * POS_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * COL_SIZE);\r\n this._directions = utils.allocateTyped(Float32Array, pointsCount * DIR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n const index = this._index;\r\n let indexOffset = 0;\r\n let pointOffset = 0;\r\n for (let j = 0; j < segmentsCount; j++, indexOffset += 6, pointOffset += VERTEX_PER_SEGMENT) {\r\n index[indexOffset] = pointOffset;\r\n index[indexOffset + 1] = pointOffset + 1;\r\n index[indexOffset + 2] = pointOffset + 3;\r\n index[indexOffset + 3] = pointOffset;\r\n index[indexOffset + 4] = pointOffset + 2;\r\n index[indexOffset + 5] = pointOffset + 3;\r\n }\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, POS_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, COL_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n this.setAttribute('direction', new THREE.BufferAttribute(this._directions, DIR_SIZE));\r\n }\r\n}\r\n\r\nexport default ThickLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport BaseLinesGeometry from './ThickLinesGeometry';\r\n\r\n/**\r\n * This class represents geometry which consists lines. This can build bounding volumes\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n */\r\nclass LinesGeometry extends BaseLinesGeometry {\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n if (boundingBox) {\r\n boundingBox.getCenter(center);\r\n }\r\n const positions = this._positions;\r\n const sphere = this.boundingSphere || new THREE.Sphere();\r\n const size = this._positions.length;\r\n const pos = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n pos.set(positions[i], positions[i + 1], positions[i + 2]);\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n sphere.set(center, Math.sqrt(radiusSquared));\r\n this.boundingSphere = sphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n const positions = this._positions;\r\n const box = new THREE.Box3();\r\n const size = this._positions.length;\r\n const tmpVec = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n tmpVec.set(positions[i], positions[i + 1], positions[i + 2]);\r\n box.expandByPoint(tmpVec);\r\n }\r\n this.boundingBox = box;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n}\r\n\r\nexport default LinesGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\nclass CylinderCollisionGeo extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const itemOffset = chunkSize * itemIdx * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, itemOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, itemOffset);\r\n }\r\n}\r\nexport default CylinderCollisionGeo;\r\n","import LinesGeometry from './LinesGeometry';\r\nimport CylinderCollisionGeo from './CylinderCollisionGeo';\r\n\r\nconst COLLISION_RAD = 0.1;\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n *\r\n * @param {number} chunksCount Total chunks count.\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * @param {boolean} enableCollision Enable or disable collision where each segment is\r\n * a collidable cylinder.\r\n * collision geometry.\r\n */\r\nclass ChunkedLinesGeometry extends LinesGeometry {\r\n constructor(chunksCount, segmentsCount, enableCollision) {\r\n super(chunksCount * segmentsCount);\r\n this._init(segmentsCount);\r\n this._collisionGeo = enableCollision ? new CylinderCollisionGeo(chunksCount * segmentsCount, 3) : null;\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = collisionGeo.boundingSphere;\r\n return;\r\n }\r\n super.computeBoundingSphere();\r\n }\r\n\r\n computeBoundingBox() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingBox();\r\n this.boundingBox = collisionGeo.boundingBox;\r\n return;\r\n }\r\n super.computeBoundingBox();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const collisionGeo = this._collisionGeo;\r\n if (!collisionGeo) {\r\n return;\r\n }\r\n const segCount = this._chunkSize;\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n for (let i = 0, n = intersects.length; i < n; ++i) {\r\n let { chunkIdx } = intersects[i];\r\n if (chunkIdx === undefined) {\r\n continue;\r\n }\r\n chunkIdx = (chunkIdx / segCount) | 0;\r\n intersects[i].chunkIdx = chunkIdx;\r\n }\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n super.setColor(i, colorVal);\r\n }\r\n }\r\n\r\n setSegment(chunkIdx, segIdx, pos1, pos2) {\r\n const chunkSize = this._chunkSize;\r\n const idx = chunkIdx * chunkSize + segIdx;\r\n super.setSegment(idx, pos1, pos2);\r\n if (this._collisionGeo) {\r\n this._collisionGeo.setItem(chunkIdx * chunkSize + segIdx, pos1, pos2, COLLISION_RAD);\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n super.setOpacity(left, left + chunkSize - 1, value);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const chunkSize = this._chunkSize;\r\n const subset = new ChunkedLinesGeometry(instanceCount, chunkSize, false);\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const startSegIdx = chunkIndices[i] * chunkSize;\r\n subset.setSegments(dstPtOffset, this.getSubsetSegments(startSegIdx, chunkSize));\r\n subset.setColors(dstPtOffset, this.getSubsetColors(startSegIdx, chunkSize));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(chunkSize) {\r\n this._chunkSize = chunkSize;\r\n }\r\n}\r\n\r\nexport default ChunkedLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport LinesGeometry from './LinesGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\n\r\nconst COLLISION_RAD = 0.3;\r\nconst tmpVector = new THREE.Vector3();\r\n\r\nclass TwoColorLinesGeometry extends LinesGeometry {\r\n constructor(segmentsCount) {\r\n super(segmentsCount * 2);\r\n this._init(segmentsCount);\r\n this._collisionGeo = new Simple2CCylindersGeometry(segmentsCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos) {\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, COLLISION_RAD);\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n tmpVector.lerpVectors(botPos, topPos, 0.5);\r\n super.setSegment(offset, botPos, tmpVector);\r\n super.setSegment(offset + 1, tmpVector, topPos);\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n super.setColor(offset, colorVal1);\r\n super.setColor(offset + 1, colorVal2);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n if (this._collisionGeo) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n getSubset(segmentIndices) {\r\n const instanceCount = segmentIndices.length;\r\n const subset = new TwoColorLinesGeometry(instanceCount, false);\r\n for (let i = 0, n = instanceCount; i < n; ++i) {\r\n const startSegIdx = segmentIndices[i];\r\n subset.setSegments(i, this.getSubsetSegments(startSegIdx, 1));\r\n subset.setColors(i, this.getSubsetColors(startSegIdx, 1));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(segmentsCount) {\r\n this._segCounts = segmentsCount * 2;\r\n }\r\n}\r\n// (???)parent = LinesGeometry.prototype;\r\n\r\nexport default TwoColorLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst vectors = [\r\n new THREE.Vector3(1, 0, 0),\r\n new THREE.Vector3(-1, 0, 0),\r\n new THREE.Vector3(0, 1, 0),\r\n new THREE.Vector3(0, -1, 0),\r\n new THREE.Vector3(0, 0, 1),\r\n new THREE.Vector3(0, 0, -1),\r\n];\r\nconst vecCount = vectors.length;\r\nconst tempPos1 = new THREE.Vector3();\r\nconst tempPos2 = new THREE.Vector3();\r\n\r\nclass CrossGeometry extends SphereCollisionGeo(ChunkedLinesGeometry) {\r\n constructor(chunksCount) {\r\n super(chunksCount, chunksCount, (vecCount / 2) | 0, false);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n\r\n for (let i = 0; i < vecCount / 2; ++i) {\r\n const first = i * 2;\r\n tempPos1.x = itemPos.x + vectors[first].x * itemRad;\r\n tempPos1.y = itemPos.y + vectors[first].y * itemRad;\r\n tempPos1.z = itemPos.z + vectors[first].z * itemRad;\r\n const second = first + 1;\r\n tempPos2.x = itemPos.x + vectors[second].x * itemRad;\r\n tempPos2.y = itemPos.y + vectors[second].y * itemRad;\r\n tempPos2.z = itemPos.z + vectors[second].z * itemRad;\r\n this.setSegment(itemIdx, i, tempPos1, tempPos2);\r\n }\r\n }\r\n}\r\nexport default CrossGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst POS_RAD_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This is a base class for isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\nclass IsoSurfaceGeometry extends THREE.BufferGeometry {\r\n constructor(spheresCount, opts) {\r\n super();\r\n\r\n this._opts = opts;\r\n this.zClip = this._opts.zClip;\r\n this._posRad = utils.allocateTyped(Float32Array, spheresCount * POS_RAD_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n }\r\n\r\n setItem(chunkIdx, pos, radius) {\r\n const posRad = this._posRad;\r\n let idx = POS_RAD_SIZE * chunkIdx;\r\n posRad[idx++] = pos.x;\r\n posRad[idx++] = pos.y;\r\n posRad[idx++] = pos.z;\r\n posRad[idx] = radius;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n let idx = COLOR_SIZE * chunkIdx;\r\n colors[idx++] = tmpColor.r;\r\n colors[idx++] = tmpColor.g;\r\n colors[idx] = tmpColor.b;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n finishUpdate() {\r\n this._build();\r\n }\r\n\r\n setOpacity() {\r\n // not implemented\r\n }\r\n\r\n raycast() {\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\nexport default IsoSurfaceGeometry;\r\n","import utils from '../../utils';\r\n\r\n/**\r\n * Class for marching cube\r\n * Stores 8 points and 8 float values are stored together in linear array\r\n * Int values for has intersection or not - in integer32 linear array\r\n * Int values for bits flags - in integer32 linear array\r\n *\r\n */\r\nclass IsoSurfaceMarchCube {\r\n constructor() {\r\n this.pointsValuesLinear = null;\r\n this.hasIntersection = null;\r\n this.bitsInside = null;\r\n }\r\n\r\n create(numCellsPerSide) {\r\n const vx7000000 = 0x7000000;\r\n const n3 = numCellsPerSide * numCellsPerSide * numCellsPerSide;\r\n if (n3 > vx7000000) {\r\n throw new Error('Too large cube dimension: lead to memory huge uasge');\r\n }\r\n this.pointsValuesLinear = utils.allocateTyped(Float32Array, (2 << (2 + 2)) * n3);\r\n this.hasIntersection = utils.allocateTyped(Int32Array, n3);\r\n this.bitsInside = utils.allocateTyped(Int32Array, n3);\r\n return 0;\r\n }\r\n\r\n destroy() {\r\n this.bitsInside = null;\r\n this.hasIntersection = null;\r\n this.pointsValuesLinear = null;\r\n }\r\n}\r\n\r\n/* eslint-disable no-magic-numbers */\r\nIsoSurfaceMarchCube.prototype.striIndicesMarchCube = [\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1,\r\n 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1,\r\n 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1,\r\n 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1,\r\n 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1,\r\n 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1,\r\n 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1,\r\n 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1,\r\n 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1,\r\n 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1,\r\n 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1,\r\n 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1,\r\n 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1,\r\n 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1,\r\n 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1,\r\n 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1,\r\n 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1,\r\n 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1,\r\n 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1,\r\n 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1,\r\n 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1,\r\n 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1,\r\n 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1,\r\n 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1,\r\n 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1,\r\n 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1,\r\n 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1,\r\n 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1,\r\n 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1,\r\n 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1,\r\n 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1,\r\n 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1,\r\n 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1,\r\n 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1,\r\n 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1,\r\n 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1,\r\n 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1,\r\n 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1,\r\n 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1,\r\n 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1,\r\n 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1,\r\n 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1,\r\n 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1,\r\n 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1,\r\n 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1,\r\n 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1,\r\n 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1,\r\n 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1,\r\n 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1,\r\n 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1,\r\n 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1,\r\n 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1,\r\n 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1,\r\n 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1,\r\n 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1,\r\n 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1,\r\n 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1,\r\n 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1,\r\n 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1,\r\n 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1,\r\n 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1,\r\n 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1,\r\n 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1,\r\n 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1,\r\n 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1,\r\n 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1,\r\n 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1,\r\n 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1,\r\n 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1,\r\n 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1,\r\n 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1,\r\n 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1,\r\n 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1,\r\n 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1,\r\n 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1,\r\n 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1,\r\n 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1,\r\n 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1,\r\n 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1,\r\n 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1,\r\n 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1,\r\n 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1,\r\n 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1,\r\n 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1,\r\n 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1,\r\n 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1,\r\n 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1,\r\n 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1,\r\n 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1,\r\n 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1,\r\n 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1,\r\n 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1,\r\n 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n];\r\n/* eslint-enable no-magic-numbers */\r\n\r\nexport default IsoSurfaceMarchCube;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport utils from '../../utils';\r\n\r\nconst edgeTable = [\r\n 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,\r\n 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,\r\n 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,\r\n 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,\r\n 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,\r\n 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,\r\n 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac,\r\n 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,\r\n 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c,\r\n 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,\r\n 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc,\r\n 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,\r\n 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c,\r\n 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,\r\n 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc,\r\n 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,\r\n 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,\r\n 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,\r\n 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,\r\n 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,\r\n 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,\r\n 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,\r\n 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,\r\n 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460,\r\n 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,\r\n 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,\r\n 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,\r\n 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,\r\n 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,\r\n 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,\r\n 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,\r\n 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0];\r\n\r\nfunction _voxelGradientFast(v, point, grad) {\r\n const g = v.getValue(point.x, point.y, point.z);\r\n grad.set(g[0], g[1], g[2]);\r\n}\r\n\r\n// Helper class GridCell\r\nclass GridCell {\r\n constructor() {\r\n this._arrSize = 8;\r\n this.p = new Array(this._arrSize);\r\n this.g = new Array(this._arrSize);\r\n this.val = new Array(this._arrSize);\r\n for (let i = 0; i < this._arrSize; ++i) {\r\n this.p[i] = new THREE.Vector3();\r\n this.g[i] = new THREE.Vector3();\r\n }\r\n this.cubeIndex = 0;\r\n }\r\n}\r\n\r\n// Helper class Triangle\r\nclass Triangle {\r\n constructor() {\r\n this.a = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.b = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.c = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n }\r\n}\r\n\r\nfunction createArray(arrSize) {\r\n const arr = new Array(arrSize);\r\n for (let i = 0; i < arrSize; ++i) {\r\n arr[i] = new THREE.Vector3();\r\n }\r\n\r\n return arr;\r\n}\r\n\r\nclass IsoSurface {\r\n constructor() {\r\n this._numTriangles = 0;\r\n this._numVertices = 0;\r\n this._position = [];\r\n this._normals = [];\r\n this._colors = null;\r\n this._indices = [];\r\n this._volumetricData = null;\r\n this._xAxis = new THREE.Vector3();\r\n this._yAxis = new THREE.Vector3();\r\n this._zAxis = new THREE.Vector3();\r\n this._xDir = new THREE.Vector3();\r\n this._yDir = new THREE.Vector3();\r\n this._zDir = new THREE.Vector3();\r\n }\r\n\r\n _prepareAxesAndDirs() {\r\n const volData = this._volumetricData;\r\n\r\n const cellSize = volData.getCellSize();\r\n\r\n // calculate cell axes\r\n const xAxis = this._xAxis;\r\n const yAxis = this._yAxis;\r\n const zAxis = this._zAxis;\r\n const xDir = this._xDir;\r\n const yDir = this._yDir;\r\n const zDir = this._zDir;\r\n\r\n xAxis.set(cellSize.x, 0, 0);\r\n yAxis.set(0, cellSize.y, 0);\r\n zAxis.set(0, 0, cellSize.z);\r\n\r\n xDir.set(1, 0, 0);\r\n yDir.set(0, 1, 0);\r\n zDir.set(0, 0, 1);\r\n\r\n // flip normals if coordinate system is in the wrong handedness\r\n const tmp = new THREE.Vector3();\r\n tmp.crossVectors(xDir, yDir);\r\n if (tmp.dot(zDir) < 0) {\r\n xDir.negate();\r\n yDir.negate();\r\n zDir.negate();\r\n }\r\n\r\n // check that the grid is in the all-positive octant of the coordinate system\r\n if (xDir.x < 0 || xDir.y < 0 || xDir.z < 0\r\n || yDir.x < 0 || yDir.y < 0 || yDir.z < 0\r\n || zDir.x < 0 || zDir.y < 0 || zDir.z < 0) {\r\n return false;\r\n }\r\n\r\n // check that the grid is axis-aligned\r\n const notZero = (axe) => Math.abs(axe) > Number.EPSILON;\r\n return !(notZero(xAxis.y) || notZero(xAxis.z)\r\n || notZero(yAxis.x) || notZero(yAxis.z)\r\n || notZero(zAxis.x) || notZero(zAxis.y));\r\n }\r\n\r\n _vertexInterp(isoLevel, grid, ind1, ind2, vertex, normal) {\r\n const p1 = grid.p[ind1];\r\n const p2 = grid.p[ind2];\r\n const n1 = grid.g[ind1];\r\n const n2 = grid.g[ind2];\r\n const valP1 = grid.val[ind1];\r\n const valP2 = grid.val[ind2];\r\n const isoDiffP1 = isoLevel - valP1;\r\n const diffValP2P1 = valP2 - valP1;\r\n\r\n let mu = 0.0;\r\n\r\n if (Math.abs(diffValP2P1) > 0.0) {\r\n mu = isoDiffP1 / diffValP2P1;\r\n }\r\n mu = mu > 1.0 ? 1.0 : mu;\r\n vertex.lerpVectors(p1, p2, mu);\r\n normal.lerpVectors(n1, n2, mu);\r\n }\r\n\r\n static _triTable = IsoSurfaceMarchCube.prototype.striIndicesMarchCube;\r\n\r\n static _arrSize = 12;\r\n\r\n static _firstIndices = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3];\r\n\r\n static _secondIndices = [1, 2, 3, 0, 5, 6, 7, 4, 4, 5, 6, 7];\r\n\r\n static _vertexList = createArray(IsoSurface._arrSize);\r\n\r\n static _normalList = createArray(IsoSurface._arrSize);\r\n\r\n _polygonize(grid, isoLevel, triangles) {\r\n const { cubeIndex } = grid;\r\n let i = 0;\r\n const arrSize = IsoSurface._arrSize;\r\n const firstIndices = IsoSurface._firstIndices;\r\n const secondIndices = IsoSurface._secondIndices;\r\n const vertexList = IsoSurface._vertexList;\r\n const normalList = IsoSurface._normalList;\r\n\r\n for (; i < arrSize; ++i) {\r\n if (edgeTable[cubeIndex] & (1 << i)) {\r\n this._vertexInterp(\r\n isoLevel,\r\n grid,\r\n firstIndices[i],\r\n secondIndices[i],\r\n vertexList[i],\r\n normalList[i],\r\n );\r\n }\r\n }\r\n\r\n let triCount = 0;\r\n const triTblIdx = cubeIndex * 16;\r\n const triTable = IsoSurface._triTable;\r\n\r\n for (i = 0; triTable[triTblIdx + i] !== -1; i += 3) {\r\n triangles[triCount].a.p.copy(vertexList[triTable[triTblIdx + i]]);\r\n triangles[triCount].a.n.copy(normalList[triTable[triTblIdx + i]]);\r\n\r\n triangles[triCount].b.p.copy(vertexList[triTable[triTblIdx + i + 1]]);\r\n triangles[triCount].b.n.copy(normalList[triTable[triTblIdx + i + 1]]);\r\n\r\n triangles[triCount].c.p.copy(vertexList[triTable[triTblIdx + i + 2]]);\r\n triangles[triCount].c.n.copy(normalList[triTable[triTblIdx + i + 2]]);\r\n ++triCount;\r\n }\r\n\r\n return triCount;\r\n }\r\n\r\n _doGridPosNorms(isoValue, step, appendSimple) {\r\n const vol = this._volumetricData;\r\n const volData = this._volumetricData.getData();\r\n const dim = vol.getDimensions();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n const zSize = dim[2];\r\n const stepX = step * vol.getStrideX();\r\n const stepY = step * vol.getStrideY();\r\n const stepZ = step * vol.getStrideZ();\r\n\r\n const gc = new GridCell();\r\n const gcVal = gc.val;\r\n const gcValSize = gc.val.length;\r\n const additions = [\r\n new THREE.Vector3(0, 0, 0), // 0\r\n new THREE.Vector3(step, 0, 0), // 1\r\n new THREE.Vector3(step, step, 0), // 2\r\n new THREE.Vector3(0, step, 0), // 3\r\n new THREE.Vector3(0, 0, step), // 4\r\n new THREE.Vector3(step, 0, step), // 5\r\n new THREE.Vector3(step, step, step), // 6\r\n new THREE.Vector3(0, step, step), // 7\r\n ];\r\n\r\n const tmpTriCount = 5;\r\n const triangles = new Array(tmpTriCount);\r\n for (let j = 0; j < tmpTriCount; ++j) {\r\n triangles[j] = new Triangle();\r\n }\r\n\r\n let appendVertex;\r\n const self = this;\r\n const positions = this._position;\r\n const normals = this._normals;\r\n if (appendSimple) {\r\n // Special case for axis-aligned grid with positive unit vector normals\r\n appendVertex = (function () {\r\n const axis = new THREE.Vector3(self._xAxis.x, self._yAxis.y, self._zAxis.z);\r\n return function (triVertex) {\r\n const vertex = triVertex.p.clone();\r\n vertex.multiply(axis);\r\n positions.push(vertex.add(self._origin));\r\n normals.push(triVertex.n.clone());\r\n };\r\n }());\r\n } else {\r\n appendVertex = (function () {\r\n const posMtx = new THREE.Matrix3();\r\n posMtx.set(\r\n self._xAxis.x,\r\n self._yAxis.x,\r\n self._zAxis.x,\r\n self._xAxis.y,\r\n self._yAxis.y,\r\n self._zAxis.y,\r\n self._xAxis.z,\r\n self._yAxis.z,\r\n self._zAxis.z,\r\n );\r\n const normMtx = new THREE.Matrix3();\r\n normMtx.set(\r\n self._xDir.x,\r\n self._yDir.x,\r\n self._zDir.x,\r\n self._xDir.y,\r\n self._yDir.y,\r\n self._zDir.y,\r\n self._xDir.z,\r\n self._yDir.z,\r\n self._zDir.z,\r\n );\r\n\r\n return function (triVertex) {\r\n positions.push(triVertex.p.clone().applyMatrix3(posMtx).add(self._origin));\r\n normals.push(triVertex.n.clone().applyMatrix3(normMtx));\r\n };\r\n }());\r\n }\r\n const indices = this._indices;\r\n\r\n let globTriCount = 0;\r\n\r\n for (let z = 0; z < (zSize - step); z += step) {\r\n for (let y = 0; y < (ySize - step); y += step) {\r\n let idx = vol.getDirectIdx(0, y, z);\r\n for (let x = 0; x < (xSize - step); x += step, idx += stepX) {\r\n /* eslint-disable no-multi-spaces */\r\n /* eslint-disable computed-property-spacing */\r\n gcVal[0] = volData[idx];\r\n gcVal[1] = volData[idx + stepX];\r\n gcVal[3] = volData[idx + stepY];\r\n gcVal[2] = volData[idx + stepX + stepY];\r\n gcVal[4] = volData[idx + stepZ];\r\n gcVal[5] = volData[idx + stepX + stepZ];\r\n gcVal[7] = volData[idx + stepY + stepZ];\r\n gcVal[6] = volData[idx + stepX + stepY + stepZ];\r\n /* eslint-enable no-multi-spaces */\r\n /* eslint-enable computed-property-spacing */\r\n\r\n // Determine the index into the edge table which\r\n // tells us which vertices are inside of the surface\r\n let cubeIndex = 0;\r\n let i = 0;\r\n for (; i < gcValSize; ++i) {\r\n if (gcVal[i] < isoValue) {\r\n cubeIndex |= (1 << i);\r\n }\r\n }\r\n\r\n if (edgeTable[cubeIndex] === 0) {\r\n continue;\r\n }\r\n\r\n gc.cubeIndex = cubeIndex;\r\n for (i = 0; i < gcValSize; ++i) {\r\n gc.p[i].set(x + additions[i].x, y + additions[i].y, z + additions[i].z);\r\n _voxelGradientFast(this._gradient, gc.p[i], gc.g[i]);\r\n }\r\n\r\n // calculate vertices and facets for this cube,\r\n // calculate normals by interpolating between the negated\r\n // normalized volume gradients for the 8 reference voxels\r\n const triCount = this._polygonize(gc, isoValue, triangles);\r\n globTriCount += triCount;\r\n\r\n // append triangles using different techniques\r\n for (i = 0; i < triCount; ++i) {\r\n indices.push(this._numTriangles * 3);\r\n indices.push(this._numTriangles * 3 + 1);\r\n indices.push(this._numTriangles * 3 + 2);\r\n ++this._numTriangles;\r\n\r\n appendVertex(triangles[i].a);\r\n appendVertex(triangles[i].b);\r\n appendVertex(triangles[i].c);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return globTriCount;\r\n }\r\n\r\n compute(volData, origin, isoValue, step) {\r\n this._volumetricData = volData;\r\n this._origin = origin;\r\n\r\n this._gradient = volData.computeGradient();\r\n\r\n this._doGridPosNorms(isoValue, step, this._prepareAxesAndDirs());\r\n }\r\n\r\n _remapIndices(vertexMap, idcCount) {\r\n const indices = this._indices;\r\n const newIndices = utils.allocateTyped(Uint32Array, idcCount);\r\n for (let i = 0; i < idcCount; ++i) {\r\n indices[i] = vertexMap[indices[i]];\r\n newIndices[i] = indices[i];\r\n }\r\n this._indices = newIndices;\r\n }\r\n\r\n _remapVertices(vertices, normals, count) {\r\n const newPositions = utils.allocateTyped(Float32Array, count * 3);\r\n const newNormals = utils.allocateTyped(Float32Array, count * 3);\r\n for (let i = 0; i < count; ++i) {\r\n const pos = vertices[i];\r\n newPositions[i * 3] = pos.x;\r\n newPositions[i * 3 + 1] = pos.y;\r\n newPositions[i * 3 + 2] = pos.z;\r\n const norm = normals[i].normalize();\r\n newNormals[i * 3] = norm.x;\r\n newNormals[i * 3 + 1] = norm.y;\r\n newNormals[i * 3 + 2] = norm.z;\r\n }\r\n this._position = newPositions;\r\n this._normals = newNormals;\r\n }\r\n\r\n vertexFusion(offset, len) {\r\n const faceVer = this._indices.length;\r\n const vertices = this._position;\r\n const normals = this._normals;\r\n const oldVerCount = vertices.length | 0;\r\n if (faceVer === 0 || oldVerCount === 0) {\r\n return;\r\n }\r\n const vMap = utils.allocateTyped(Uint32Array, oldVerCount);\r\n vMap[0] = 0;\r\n let newVer = 1;\r\n\r\n let i = 1;\r\n for (; i < oldVerCount; ++i) {\r\n const start = newVer - offset < 0 ? 0 : newVer - offset;\r\n const end = start + len > newVer ? newVer : start + len;\r\n let matchedIndex = -1;\r\n\r\n for (let j = start; j < end; ++j) {\r\n if (Math.abs(vertices[i] - vertices[j]) < Number.EPSILON) {\r\n matchedIndex = j;\r\n break;\r\n }\r\n }\r\n\r\n if (matchedIndex !== -1) {\r\n vMap[i] = matchedIndex;\r\n } else {\r\n vertices[newVer].copy(vertices[i]);\r\n normals[newVer].copy(normals[i]);\r\n vMap[i] = newVer;\r\n ++newVer;\r\n }\r\n }\r\n\r\n this._remapIndices(vMap, faceVer);\r\n this._remapVertices(vertices, normals, newVer);\r\n }\r\n\r\n // Assign per-vertex colors from a volumetric texture map (same dimensions as the original volumetric data).\r\n // Along with color dominating atom is determined for each vertex\r\n // and vertices with atom out of \"visible\" subset get filtered out.\r\n // XXX only handles orthogonal volumes currently\r\n setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) {\r\n let i;\r\n let idx;\r\n const numVerts = this._position.length / 3;\r\n const vertices = this._position;\r\n const origin = this._origin;\r\n const dim = this._volumetricData.getDimensions();\r\n const xs = dim[0] - 1;\r\n const ys = dim[1] - 1;\r\n const zs = dim[2] - 1;\r\n\r\n const colorData = colorMap.getData();\r\n const strideX = colorMap.getStrideX();\r\n const strideY = colorMap.getStrideY();\r\n const strideZ = colorMap.getStrideZ();\r\n\r\n let atomWeightData;\r\n let atomStrideX;\r\n let atomStrideY;\r\n let atomStrideZ;\r\n\r\n if (visibilitySelector !== null) {\r\n atomWeightData = atomWeightMap.getData();\r\n atomStrideX = atomWeightMap.getStrideX();\r\n atomStrideY = atomWeightMap.getStrideY();\r\n atomStrideZ = atomWeightMap.getStrideZ();\r\n }\r\n\r\n const xInv = 1.0 / this._xAxis.x;\r\n const yInv = 1.0 / this._yAxis.y;\r\n const zInv = 1.0 / this._zAxis.z;\r\n\r\n let atomLookup = [];\r\n let atomWeights = [];\r\n const colors = utils.allocateTyped(Float32Array, numVerts * 3);\r\n\r\n function interp(mu, idx1, idx2, c) {\r\n c[0] = (1 - mu) * colorData[idx1] + mu * colorData[idx2];\r\n c[1] = (1 - mu) * colorData[idx1 + 1] + mu * colorData[idx2 + 1];\r\n c[2] = (1 - mu) * colorData[idx1 + 2] + mu * colorData[idx2 + 2];\r\n }\r\n\r\n function collectWeight(ai, coefX, coefY, coefZ) {\r\n const a = atomMap[ai]; // atomWeightMap is a scalar field, so index into atom map should be the same\r\n if (a != null) {\r\n atomLookup[a.index] = a;\r\n const w = coefX * coefY * coefZ * atomWeightData[ai];\r\n if (typeof atomWeights[a.index] === 'undefined') {\r\n atomWeights[a.index] = w;\r\n } else {\r\n atomWeights[a.index] += w;\r\n }\r\n }\r\n }\r\n\r\n const vMap = utils.allocateTyped(Int32Array, numVerts);\r\n let newVerCount = 0;\r\n\r\n for (i = 0; i < numVerts; i++) {\r\n const ind = i * 3;\r\n const vx = (vertices[ind] - origin.x) * xInv;\r\n const vy = (vertices[ind + 1] - origin.y) * yInv;\r\n const vz = (vertices[ind + 2] - origin.z) * zInv;\r\n const x = Math.min(Math.max(vx, 0), xs) | 0;\r\n const y = Math.min(Math.max(vy, 0), ys) | 0;\r\n const z = Math.min(Math.max(vz, 0), zs) | 0;\r\n\r\n const mux = (vx - x);\r\n const muy = (vy - y);\r\n const muz = (vz - z);\r\n\r\n if (visibilitySelector != null) {\r\n // collect atom weights\r\n atomLookup = [];\r\n atomWeights = [];\r\n idx = atomWeightMap.getDirectIdx(x, y, z);\r\n collectWeight(idx, 1 - mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideX, mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideY, 1 - mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideX + atomStrideY, mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideZ, 1 - mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideZ, mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideY + atomStrideZ, 1 - mux, muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideY + atomStrideZ, mux, muy, muz);\r\n\r\n // find dominant atom\r\n let maxWeight = 0.0;\r\n let dominantIdx = -1;\r\n for (const atomIdx in atomWeights) {\r\n if (atomWeights[atomIdx] > maxWeight) {\r\n dominantIdx = atomIdx;\r\n maxWeight = atomWeights[atomIdx];\r\n }\r\n }\r\n\r\n if (dominantIdx < 0 || !visibilitySelector.includesAtom(atomLookup[dominantIdx])) {\r\n // this vertex doesn't belong to visible subset and will be skipped\r\n vMap[i] = -1;\r\n continue;\r\n }\r\n }\r\n\r\n vMap[i] = newVerCount++;\r\n\r\n // color tri-linear interpolation\r\n const dx = (x < xs) ? strideX : 0;\r\n const dy = (y < ys) ? strideY : 0;\r\n const dz = (z < zs) ? strideZ : 0;\r\n\r\n const c0 = [0, 0, 0];\r\n const c1 = [0, 0, 0];\r\n const c2 = [0, 0, 0];\r\n const c3 = [0, 0, 0];\r\n\r\n idx = colorMap.getDirectIdx(x, y, z);\r\n interp(mux, idx, idx + dx, c0);\r\n interp(mux, idx + dy, idx + dx + dy, c1);\r\n interp(mux, idx + dz, idx + dx + dz, c2);\r\n interp(mux, idx + dy + dz, idx + dx + dy + dz, c3);\r\n\r\n const cz0 = [0, 0, 0];\r\n cz0[0] = (1 - muy) * c0[0] + muy * c1[0];\r\n cz0[1] = (1 - muy) * c0[1] + muy * c1[1];\r\n cz0[2] = (1 - muy) * c0[2] + muy * c1[2];\r\n\r\n const cz1 = [0, 0, 0];\r\n cz1[0] = (1 - muy) * c2[0] + muy * c3[0];\r\n cz1[1] = (1 - muy) * c2[1] + muy * c3[1];\r\n cz1[2] = (1 - muy) * c2[2] + muy * c3[2];\r\n\r\n colors[ind] = (1 - muz) * cz0[0] + muz * cz1[0];\r\n colors[ind + 1] = (1 - muz) * cz0[1] + muz * cz1[1];\r\n colors[ind + 2] = (1 - muz) * cz0[2] + muz * cz1[2];\r\n }\r\n this._colors = colors;\r\n\r\n if (visibilitySelector != null) {\r\n // shift visible vertices towards beginning of array\r\n for (i = 0; i < numVerts; ++i) {\r\n const j = vMap[i];\r\n if (j < 0) {\r\n continue;\r\n }\r\n\r\n // assert: j <= i\r\n this._position[j * 3] = this._position[i * 3];\r\n this._position[j * 3 + 1] = this._position[i * 3 + 1];\r\n this._position[j * 3 + 2] = this._position[i * 3 + 2];\r\n this._normals[j * 3] = this._normals[i * 3];\r\n this._normals[j * 3 + 1] = this._normals[i * 3 + 1];\r\n this._normals[j * 3 + 2] = this._normals[i * 3 + 2];\r\n this._colors[j * 3] = this._colors[i * 3];\r\n this._colors[j * 3 + 1] = this._colors[i * 3 + 1];\r\n this._colors[j * 3 + 2] = this._colors[i * 3 + 2];\r\n }\r\n\r\n // rebuild index list\r\n const numTriangles = this._indices.length / 3;\r\n let newTriCount = 0;\r\n for (i = 0; i < numTriangles; ++i) {\r\n const i0 = vMap[this._indices[3 * i]];\r\n const i1 = vMap[this._indices[3 * i + 1]];\r\n const i2 = vMap[this._indices[3 * i + 2]];\r\n if (i0 >= 0 && i1 >= 0 && i2 >= 0) {\r\n this._indices[3 * newTriCount] = i0;\r\n this._indices[3 * newTriCount + 1] = i1;\r\n this._indices[3 * newTriCount + 2] = i2;\r\n ++newTriCount;\r\n }\r\n }\r\n\r\n // shrink arrays to data size\r\n this._position = new Float32Array(this._position.buffer.slice(0, newVerCount * 3 * 4));\r\n this._normals = new Float32Array(this._normals.buffer.slice(0, newVerCount * 3 * 4));\r\n this._colors = new Float32Array(this._colors.buffer.slice(0, newVerCount * 3 * 4));\r\n this._indices = new Uint32Array(this._indices.buffer.slice(0, newTriCount * 3 * 4));\r\n }\r\n }\r\n\r\n toMesh() {\r\n const geo = new THREE.BufferGeometry();\r\n geo.setIndex(new THREE.BufferAttribute(this._indices, 1));\r\n geo.setAttribute('position', new THREE.BufferAttribute(this._position, 3));\r\n geo.setAttribute('normal', new THREE.BufferAttribute(this._normals, 3));\r\n geo.setAttribute('color', new THREE.BufferAttribute(this._colors, 3));\r\n geo.computeBoundingSphere();\r\n return geo;\r\n }\r\n}\r\nexport default IsoSurface;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurface from './IsoSurface';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * This is a base class for volumetric maps based isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass VolumeSurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n const params = this._opts;\r\n this.numVoxels = [128, 128, 128];\r\n this.xAxis = new THREE.Vector3(1.0, 0.0, 0.0);\r\n this.yAxis = new THREE.Vector3(0.0, 1.0, 0.0);\r\n this.zAxis = new THREE.Vector3(0.0, 0.0, 1.0);\r\n\r\n this.origin = new THREE.Vector3(0.0, 0.0, 0.0);\r\n this._visibilitySelector = params.visibilitySelector;\r\n\r\n this._calcSurface(params);\r\n }\r\n\r\n _findMinMax(posRadArray) {\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n const maxPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n const minPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n for (let i = 1; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n for (let itemIdx = 0; itemIdx < itemSize; ++itemIdx) {\r\n const tmpVal = posRadArray[ind + itemIdx];\r\n maxPosRad[itemIdx] = Math.max(tmpVal, maxPosRad[itemIdx]);\r\n minPosRad[itemIdx] = Math.min(tmpVal, minPosRad[itemIdx]);\r\n }\r\n }\r\n return { maxPosRad, minPosRad };\r\n }\r\n\r\n _findNumVoxels(posRadArray, params) {\r\n const { numVoxels } = this;\r\n const minMaxValues = this._findMinMax(posRadArray);\r\n const minCoordRad = minMaxValues.minPosRad;\r\n const maxCoordRad = minMaxValues.maxPosRad;\r\n\r\n // minrad\r\n if (minCoordRad[3] > 4.0) {\r\n params.gridSpacing *= minCoordRad[3];\r\n }\r\n\r\n let gridPadding = params.radScale * maxCoordRad[3] * 1.7;\r\n let padRad = gridPadding;\r\n padRad = 0.65 * Math.sqrt(4.0 / 3.0 * Math.PI * padRad * padRad * padRad);\r\n gridPadding = Math.max(gridPadding, padRad);\r\n\r\n let i = 0;\r\n for (; i < 3; ++i) {\r\n minCoordRad[i] -= gridPadding;\r\n maxCoordRad[i] += gridPadding;\r\n }\r\n\r\n for (i = 0; i < 3; ++i) {\r\n numVoxels[i] = Math.ceil((maxCoordRad[i] - minCoordRad[i]) / params.gridSpacing);\r\n }\r\n this.xAxis.x = (numVoxels[0] - 1) * params.gridSpacing;\r\n this.yAxis.y = (numVoxels[1] - 1) * params.gridSpacing;\r\n this.zAxis.z = (numVoxels[2] - 1) * params.gridSpacing;\r\n\r\n [this.origin.x, this.origin.y, this.origin.z] = minCoordRad;\r\n\r\n return { bbox: minMaxValues, dim: numVoxels };\r\n }\r\n\r\n _makeSurface(surface, params) {\r\n const isoSurf = new IsoSurface();\r\n isoSurf.compute(surface.volMap, this.origin, params.isoValue, 1);\r\n isoSurf.vertexFusion(9, 9);// normalization is included\r\n\r\n if (isoSurf._numTriangles > 0) {\r\n isoSurf.setColorVolTex(surface.volTexMap, surface.atomMap, surface.atomWeightMap, this._visibilitySelector);\r\n this.setIndex(new THREE.BufferAttribute(isoSurf._indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(isoSurf._position, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(isoSurf._normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(isoSurf._colors, 3));\r\n } else { // geometry should have at least empty position attributes to be processed in wireframe mode by three.js\r\n this.setAttribute('position', new THREE.BufferAttribute(utils.allocateTyped(Float32Array, 0), 3));\r\n }\r\n }\r\n\r\n _calcSurface(params) {\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n\r\n if (packedArrays.posRad.length === 0) {\r\n return;\r\n }\r\n const boundaries = this._findNumVoxels(packedArrays.posRad, params);\r\n\r\n const box = new THREE.Box3(\r\n this.origin,\r\n new THREE.Vector3(this.xAxis.x, this.yAxis.y, this.zAxis.z).add(this.origin),\r\n );\r\n const surface = this._computeSurface(packedArrays, box, boundaries, params);\r\n\r\n this._makeSurface(surface, params);\r\n }\r\n}\r\n\r\nexport default VolumeSurfaceGeometry;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass QuickSurfGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n // beware of shifting this multiple times!\r\n this._shiftByOrigin(packedArrays.posRad);\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3),\r\n };\r\n\r\n if (this._visibilitySelector != null) {\r\n surface.atomMap = [];\r\n surface.atomWeightMap = new Volume(Float32Array, this.numVoxels, box);\r\n }\r\n\r\n this.gaussdensity(surface, packedArrays, null, params);\r\n return surface;\r\n }\r\n\r\n gaussdensity(surface, packedArrays, atomicNum, params) {\r\n const numAtoms = packedArrays.posRad.length / 4;\r\n const { posRad, colors } = packedArrays;\r\n const { numVoxels } = this;\r\n const { radScale, gaussLim, gridSpacing } = params;\r\n const invIsoValue = 1.0 / params.isoValue;\r\n const invGridSpacing = 1.0 / gridSpacing;\r\n const maxVoxelX = numVoxels[0] - 1;\r\n const maxVoxelY = numVoxels[1] - 1;\r\n const maxVoxelZ = numVoxels[2] - 1;\r\n // TODO is densityMap and volTexMap initialized?\r\n\r\n const { volMap, volTexMap } = surface;\r\n const volData = volMap.getData();\r\n const strideX = volMap.getStrideX();\r\n\r\n const volTexData = volTexMap.getData();\r\n const texStrideX = volTexMap.getStrideX();\r\n\r\n let atomWeightData;\r\n if (this._visibilitySelector != null) {\r\n atomWeightData = surface.atomWeightMap.getData();\r\n }\r\n\r\n const { atomMap } = surface;\r\n\r\n for (let i = 0; i < numAtoms; ++i) {\r\n const ind = i * 4;\r\n const scaledRad = posRad[ind + 3] * radScale;\r\n const atomicNumFactor = atomicNum === null ? 1.0 : atomicNum[i];\r\n const radInv = 1 / (2 * scaledRad * scaledRad);\r\n let radLim = gaussLim * scaledRad;\r\n const radLim2 = radLim * radLim;\r\n radLim *= invGridSpacing;\r\n\r\n let tmp = posRad[ind] * invGridSpacing;\r\n const xMin = Math.max((tmp - radLim) | 0, 0);\r\n const xMax = Math.min((tmp + radLim) | 0, maxVoxelX);\r\n tmp = posRad[ind + 1] * invGridSpacing;\r\n const yMin = Math.max((tmp - radLim) | 0, 0);\r\n const yMax = Math.min((tmp + radLim) | 0, maxVoxelY);\r\n tmp = posRad[ind + 2] * invGridSpacing;\r\n const zMin = Math.max((tmp - radLim) | 0, 0);\r\n const zMax = Math.min((tmp + radLim) | 0, maxVoxelZ);\r\n\r\n let dz = zMin * gridSpacing - posRad[ind + 2];\r\n for (let z = zMin; z <= zMax; ++z, dz += gridSpacing) {\r\n let dy = yMin * gridSpacing - posRad[ind + 1];\r\n for (let y = yMin; y <= yMax; ++y, dy += gridSpacing) {\r\n const dy2dz2 = dy * dy + dz * dz;\r\n\r\n if (dy2dz2 >= radLim2) {\r\n continue;\r\n }\r\n\r\n let addr = volMap.getDirectIdx(xMin, y, z);\r\n let texAddr = volTexMap.getDirectIdx(xMin, y, z);\r\n let dx = xMin * gridSpacing - posRad[ind];\r\n for (let x = xMin; x <= xMax; ++x, dx += gridSpacing, addr += strideX, texAddr += texStrideX) {\r\n const r2 = dx * dx + dy2dz2;\r\n const expVal = -r2 * radInv;\r\n\r\n let density = Math.exp(expVal) * atomicNumFactor;\r\n\r\n // store most relevant atom (with highest density)\r\n if (this._visibilitySelector != null\r\n && density > atomWeightData[addr]) { // NOSONAR\r\n atomWeightData[addr] = density;\r\n // we use same index into atom map and atomWeightMap\r\n atomMap[addr] = packedArrays.atoms[i];\r\n }\r\n\r\n volData[addr] += density;\r\n\r\n // TODO check for volTexMap routine?\r\n density *= invIsoValue;\r\n const colInd = i * 3;\r\n volTexData[texAddr] += density * colors[colInd];\r\n volTexData[texAddr + 1] += density * colors[colInd + 1];\r\n volTexData[texAddr + 2] += density * colors[colInd + 2];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n _shiftByOrigin(posRadArray) {\r\n const originX = this.origin.x;\r\n const originY = this.origin.y;\r\n const originZ = this.origin.z;\r\n\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n for (let i = 0; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n posRadArray[ind] -= originX;\r\n posRadArray[ind + 1] -= originY;\r\n posRadArray[ind + 2] -= originZ;\r\n }\r\n }\r\n}\r\n\r\nexport default QuickSurfGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * Modifed from SpatialHash\r\n *\r\n * Main differences are:\r\n * - Optimized grid size to ensure we only ever need to look +/-1 cell\r\n * - Aware of atomic radii and will only output atoms within rAtom + rExtra\r\n * (see withinRadii method)\r\n *\r\n * (Uses rounding rather than bitshifting as consequence of arbitrary grid size)\r\n * @class\r\n * @param {Float32Array} posRad - x, y, z coordinates and radiuses\r\n * @param {Float32Array} min - xyz min coordinates\r\n * @param {Float32Array} max - xyz max coordinates\r\n * @param {number} maxDistance - max distance\r\n */\r\nfunction AVHash(posRad, min, max, maxDistance) {\r\n const itemSize = 4;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const minX = min[0];\r\n const minY = min[1];\r\n const minZ = min[2];\r\n\r\n const maxX = max[0];\r\n const maxY = max[1];\r\n const maxZ = max[2];\r\n\r\n function hashFunc(w, minW) {\r\n return Math.floor((w - minW) / maxDistance);\r\n }\r\n\r\n const iDim = hashFunc(maxX, minX) + 1;\r\n const jDim = hashFunc(maxY, minY) + 1;\r\n const kDim = hashFunc(maxZ, minZ) + 1;\r\n\r\n const nCells = iDim * jDim * kDim;\r\n\r\n const jkDim = jDim * kDim;\r\n\r\n /* Get cellID for cartesian x,y,z */\r\n const cellID = function (x, y, z) {\r\n return (((hashFunc(x, minX) * jDim) + hashFunc(y, minY)) * kDim) + hashFunc(z, minZ);\r\n };\r\n\r\n /* Initial building, could probably be optimized further */\r\n const preHash = [];\r\n let i;\r\n let cid;\r\n for (i = 0; i < nAtoms; i++) {\r\n const iIdx = itemSize * i;\r\n cid = cellID(posRad[iIdx], posRad[iIdx + 1], posRad[iIdx + 2]);\r\n\r\n if (preHash[cid] === undefined) {\r\n preHash[cid] = [i];\r\n } else {\r\n preHash[cid].push(i);\r\n }\r\n }\r\n\r\n const cellOffsets = utils.allocateTyped(Uint32Array, nCells);\r\n const cellLengths = utils.allocateTyped(Uint16Array, nCells);\r\n const data = utils.allocateTyped(Uint32Array, nAtoms);\r\n\r\n let offset = 0;\r\n let maxCellLength = 0;\r\n let j;\r\n for (i = 0; i < nCells; i++) {\r\n const start = cellOffsets[i] = offset;\r\n\r\n const subArray = preHash[i];\r\n\r\n if (subArray !== undefined) {\r\n for (j = 0; j < subArray.length; j++) {\r\n data[offset] = subArray[j];\r\n offset++;\r\n }\r\n }\r\n\r\n const cellLength = offset - start;\r\n cellLengths[i] = cellLength;\r\n\r\n if (cellLength > maxCellLength) {\r\n maxCellLength = cellLength;\r\n }\r\n }\r\n\r\n // Maximum number of neighbours we could ever produce (27 adjacent cells of equal population)\r\n this.neighbourListLength = (27 * maxCellLength) + 1;\r\n\r\n /**\r\n * Populate the supplied out array with atom indices that are within rAtom + rExtra\r\n * of x,y,z\r\n *\r\n * -1 in out array indicates the end of the list\r\n *\r\n * @param {number} x - x coordinate\r\n * @param {number} y - y coordinate\r\n * @param {number} z - z coordinate\r\n * @param {number} rExtra - additional radius\r\n * @param {Float32Array} out - pre-allocated output array\r\n * @return {undefined}\r\n */\r\n this.withinRadii = function (x, y, z, rExtra, out) {\r\n let outIdx = 0;\r\n\r\n const nearI = hashFunc(x, minX);\r\n const nearJ = hashFunc(y, minY);\r\n const nearK = hashFunc(z, minZ);\r\n\r\n const loI = Math.max(0, nearI - 1);\r\n const loJ = Math.max(0, nearJ - 1);\r\n const loK = Math.max(0, nearK - 1);\r\n\r\n const hiI = Math.min(iDim - 1, nearI + 1);\r\n const hiJ = Math.min(jDim - 1, nearJ + 1);\r\n const hiK = Math.min(kDim - 1, nearK + 1);\r\n\r\n for (i = loI; i <= hiI; ++i) {\r\n const iOffset = i * jkDim;\r\n\r\n for (j = loJ; j <= hiJ; ++j) {\r\n const jOffset = j * kDim;\r\n\r\n for (let k = loK; k <= hiK; ++k) {\r\n cid = iOffset + jOffset + k;\r\n\r\n const cellStart = cellOffsets[cid];\r\n const cellEnd = cellStart + cellLengths[cid];\r\n\r\n for (let dataIndex = cellStart; dataIndex < cellEnd; dataIndex++) {\r\n const atomIndex = data[dataIndex];\r\n const baseIndex = itemSize * atomIndex;\r\n const dx = posRad[baseIndex] - x;\r\n const dy = posRad[baseIndex + 1] - y;\r\n const dz = posRad[baseIndex + 2] - z;\r\n const rSum = posRad[baseIndex + 3] + rExtra;\r\n\r\n if ((dx * dx + dy * dy + dz * dz) <= (rSum * rSum)) {\r\n out[outIdx++] = data[dataIndex];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Add terminator\r\n out[outIdx] = -1;\r\n };\r\n}\r\nfunction ContactSurface(packedArrays, boundaries, params, _indexList) {\r\n // Field generation method adapted from AstexViewer (Mike Hartshorn)\r\n // by Fred Ludlow.\r\n // Other parts based heavily on NGL (Alexander Rose) EDT Surface class\r\n //\r\n // Should work as a drop-in alternative to EDTSurface (though some of\r\n // the EDT paramters are not relevant in this method).\r\n\r\n const itemSize = 4;\r\n const { posRad, colors, atoms } = packedArrays;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const { bbox } = boundaries;\r\n\r\n const min = bbox.minPosRad;\r\n const max = bbox.maxPosRad;\r\n\r\n let r2; // Atom positions, expanded radii (squared)\r\n let maxRadius;\r\n\r\n // Parameters\r\n let probeRadius;\r\n let scaleFactor;\r\n let probePositions;\r\n\r\n // Cache last value for obscured test\r\n let lastClip = -1;\r\n\r\n // Grid params\r\n let dim;\r\n let grid;\r\n let volTex;\r\n let weights;\r\n let weightsMap = null;\r\n let atomMap = null;\r\n let visibilitySelector = null;\r\n\r\n // grid indices -> xyz coords\r\n let gridx;\r\n let gridy;\r\n let gridz;\r\n\r\n // Lookup tables:\r\n let sinTable;\r\n let cosTable;\r\n\r\n // Spatial Hash\r\n let hash;\r\n\r\n // Neighbour array to be filled by hash\r\n let neighbours;\r\n\r\n // Vectors for Torus Projection\r\n const mid = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n1 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n2 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n let ngTorus;\r\n\r\n function uniformArray(TypeName, n, a) {\r\n const array = utils.allocateTyped(TypeName, n);\r\n for (let innI = 0; innI < n; ++innI) {\r\n array[innI] = a;\r\n }\r\n\r\n return array;\r\n }\r\n\r\n function fillGridDim(a, start, step) {\r\n for (let innI = 0; innI < a.length; innI++) {\r\n a[innI] = start + (step * innI);\r\n }\r\n }\r\n\r\n function initializeGrid() {\r\n ({ scaleFactor } = params);\r\n ({ dim } = boundaries);\r\n\r\n ngTorus = Math.min(5, 2 + Math.floor(probeRadius * scaleFactor));\r\n\r\n const gridSize = dim[0] * dim[1] * dim[2];\r\n grid = uniformArray(Float32Array, gridSize, -1001.0);\r\n volTex = utils.allocateTyped(Float32Array, gridSize * 3);\r\n weights = utils.allocateTyped(Float32Array, gridSize);\r\n if (visibilitySelector) {\r\n weightsMap = utils.allocateTyped(Float32Array, gridSize);\r\n atomMap = [];\r\n }\r\n\r\n gridx = utils.allocateTyped(Float32Array, dim[0]);\r\n gridy = utils.allocateTyped(Float32Array, dim[1]);\r\n gridz = utils.allocateTyped(Float32Array, dim[2]);\r\n\r\n fillGridDim(gridx, min[0], 1 / scaleFactor);\r\n fillGridDim(gridy, min[1], 1 / scaleFactor);\r\n fillGridDim(gridz, min[2], 1 / scaleFactor);\r\n }\r\n\r\n function initializeAngleTables() {\r\n let theta = 0.0;\r\n const step = 2 * Math.PI / probePositions;\r\n\r\n cosTable = utils.allocateTyped(Float32Array, probePositions);\r\n sinTable = utils.allocateTyped(Float32Array, probePositions);\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n cosTable[innI] = Math.cos(theta);\r\n sinTable[innI] = Math.sin(theta);\r\n theta += step;\r\n }\r\n }\r\n\r\n function initializeHash() {\r\n hash = new AVHash(posRad, min, max, 2.01 * maxRadius);\r\n neighbours = new Int32Array(hash.neighbourListLength);\r\n }\r\n\r\n function init() {\r\n ({\r\n probeRadius,\r\n scaleFactor,\r\n probePositions,\r\n visibilitySelector,\r\n } = params);\r\n r2 = utils.allocateTyped(Float32Array, nAtoms);\r\n maxRadius = 0;\r\n for (let innI = 0; innI < nAtoms; ++innI) {\r\n const rExt = posRad[innI * itemSize + 3] += probeRadius;\r\n if (rExt > maxRadius) {\r\n maxRadius = rExt;\r\n }\r\n r2[innI] = rExt * rExt;\r\n }\r\n\r\n initializeGrid();\r\n initializeAngleTables();\r\n initializeHash();\r\n\r\n lastClip = -1;\r\n }\r\n\r\n function singleAtomObscures(ai, innX, innY, innZ) {\r\n const innCI = itemSize * ai;\r\n const ra2 = r2[ai];\r\n const dx = posRad[innCI] - innX;\r\n const dy = posRad[innCI + 1] - innY;\r\n const dz = posRad[innCI + 2] - innZ;\r\n const d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n return d2 < ra2;\r\n }\r\n\r\n function obscured(innX, innY, innZ, a, b) {\r\n // Is the point at x,y,z obscured by any of the atoms\r\n // specifeid by indices in neighbours. Ignore indices\r\n // a and b (these are the relevant atoms in projectPoints/Torii)\r\n\r\n // Cache the last clipped atom (as very often the same one in\r\n // subsequent calls)\r\n let ai;\r\n\r\n if (lastClip !== -1) {\r\n ai = lastClip;\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n return ai;\r\n }\r\n lastClip = -1;\r\n }\r\n\r\n let ni = 0;\r\n ai = neighbours[ni];\r\n while (ai >= 0) {\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n lastClip = ai;\r\n return ai;\r\n }\r\n ai = neighbours[++ni];\r\n }\r\n\r\n lastClip = -1;\r\n\r\n return -1;\r\n }\r\n\r\n function projectPoints() {\r\n // For each atom:\r\n // Iterate over a subsection of the grid, for each point:\r\n // If current value < 0.0, unvisited, set positive\r\n //\r\n // In any case: Project this point onto surface of the atomic sphere\r\n // If this projected point is not obscured by any other atom\r\n // Calcualte delta distance and set grid value to minimum of\r\n // itself and delta\r\n\r\n // Should we alias frequently accessed closure constiables??\r\n // Assume JS engine capable of optimizing this\r\n // anyway...\r\n const maxRad = 4.0;\r\n const sigma = (maxRad) / 3;\r\n const sigma2Inv = 1 / (2 * sigma * sigma);\r\n\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innCI = itemSize * innI;\r\n const ax = posRad[innCI];\r\n const ay = posRad[innCI + 1];\r\n const az = posRad[innCI + 2];\r\n const ar = posRad[innCI + 3];\r\n const ar2 = r2[innI];\r\n\r\n hash.withinRadii(ax, ay, az, ar, neighbours);\r\n\r\n // Number of grid points, round this up...\r\n const ng = Math.ceil(ar * scaleFactor);\r\n\r\n // Center of the atom, mapped to grid points (take floor)\r\n const iax = Math.floor(scaleFactor * (ax - min[0]));\r\n const iay = Math.floor(scaleFactor * (ay - min[1]));\r\n const iaz = Math.floor(scaleFactor * (az - min[2]));\r\n\r\n // Extents of grid to consider for this atom\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n // Add two to these points:\r\n // - iax are floor'd values so this ensures coverage\r\n // - these are loop limits (exclusive)\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n const colIdx = innI * 3;\r\n const cr = colors[colIdx];\r\n const cg = colors[colIdx + 1];\r\n const cb = colors[colIdx + 2];\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n const dz = gridz[iz] - az;\r\n const zOffset = dim[1] * dim[0] * iz;\r\n\r\n for (let iy = miny; iy < maxy; iy++) {\r\n const dy = gridy[iy] - ay;\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n\r\n for (let ix = minx; ix < maxx; ix++) {\r\n const idx = ix + zyOffset;\r\n const dx = gridx[ix] - ax;\r\n const d2 = dzy2 + dx * dx;\r\n\r\n if (d2 < ar2) {\r\n const w = Math.exp(-d2 * sigma2Inv);\r\n const cIdx = idx * 3;\r\n volTex[cIdx] += cr * w;\r\n volTex[cIdx + 1] += cg * w;\r\n volTex[cIdx + 2] += cb * w;\r\n weights[idx] += w;\r\n if (visibilitySelector !== null && w > weightsMap[idx]) {\r\n weightsMap[idx] = w;\r\n atomMap[idx] = atoms[innI];\r\n }\r\n\r\n if (grid[idx] < 0.0) {\r\n // Unvisited, make positive\r\n grid[idx] = -grid[idx];\r\n }\r\n // Project on to the surface of the sphere\r\n // sp is the projected point ( dx, dy, dz ) * ( ra / d )\r\n const d = Math.sqrt(d2);\r\n const ap = ar / d;\r\n let spx = dx * ap;\r\n let spy = dy * ap;\r\n let spz = dz * ap;\r\n\r\n spx += ax;\r\n spy += ay;\r\n spz += az;\r\n\r\n if (obscured(spx, spy, spz, innI, -1) === -1) {\r\n const dd = ar - d;\r\n if (dd < grid[idx]) {\r\n grid[idx] = dd;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function normalToLine(out, p) {\r\n out.x = out.y = out.z = 1.0;\r\n if (p.x !== 0) {\r\n out.x = (p.y + p.z) / -p.x;\r\n } else if (p.y !== 0) {\r\n out.y = (p.x + p.z) / -p.y;\r\n } else if (p.z !== 0) {\r\n out.z = (p.x + p.y) / -p.z;\r\n }\r\n return out;\r\n }\r\n\r\n function projectTorus(a, b) {\r\n const aIdx = itemSize * a;\r\n const bIdx = itemSize * b;\r\n const xa = posRad[aIdx];\r\n const ya = posRad[aIdx + 1];\r\n const za = posRad[aIdx + 2];\r\n const r1 = posRad[aIdx + 3];\r\n let dx = mid.x = posRad[bIdx] - xa;\r\n let dy = mid.y = posRad[bIdx + 1] - ya;\r\n let dz = mid.z = posRad[bIdx + 2] - za;\r\n const innR2 = posRad[bIdx + 3];\r\n let d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n // This check now redundant as already done in AVHash.withinRadii\r\n // if( d2 > (( r1 + r2 ) * ( r1 + r2 )) ){ return; }\r\n\r\n const d = Math.sqrt(d2);\r\n\r\n // Find angle between a->b vector and the circle\r\n // of their intersection by cosine rule\r\n const cosA = (r1 * r1 + d * d - innR2 * innR2) / (2.0 * r1 * d);\r\n\r\n // distance along a->b at intersection\r\n const dmp = r1 * cosA;\r\n\r\n mid.normalize();\r\n\r\n // Create normal to line\r\n normalToLine(n1, mid);\r\n n1.normalize();\r\n\r\n // Cross together for second normal vector\r\n n2.crossVectors(mid, n1);\r\n n2.normalize();\r\n\r\n // r is radius of circle of intersection\r\n const rInt = Math.sqrt(r1 * r1 - dmp * dmp);\r\n\r\n n1.multiplyScalar(rInt);\r\n n2.multiplyScalar(rInt);\r\n mid.multiplyScalar(dmp);\r\n\r\n mid.x += xa;\r\n mid.y += ya;\r\n mid.z += za;\r\n\r\n lastClip = -1;\r\n\r\n const ng = ngTorus;\r\n\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n const cost = cosTable[innI];\r\n const sint = sinTable[innI];\r\n\r\n const px = mid.x + cost * n1.x + sint * n2.x;\r\n const py = mid.y + cost * n1.y + sint * n2.y;\r\n const pz = mid.z + cost * n1.z + sint * n2.z;\r\n\r\n if (obscured(px, py, pz, a, b) === -1) {\r\n // As above, iterate over our grid...\r\n // px, py, pz in grid coords\r\n const iax = Math.floor(scaleFactor * (px - min[0]));\r\n const iay = Math.floor(scaleFactor * (py - min[1]));\r\n const iaz = Math.floor(scaleFactor * (pz - min[2]));\r\n\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n dz = pz - gridz[iz];\r\n const zOffset = dim[1] * dim[0] * iz;\r\n for (let iy = miny; iy < maxy; iy++) {\r\n dy = py - gridy[iy];\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n for (let ix = minx; ix < maxx; ix++) {\r\n dx = px - gridx[ix];\r\n d2 = dzy2 + dx * dx;\r\n const idx = ix + zyOffset;\r\n const current = grid[idx];\r\n\r\n if (current > 0.0 && d2 < (current * current)) {\r\n grid[idx] = Math.sqrt(d2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function projectTorii() {\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innIdx = itemSize * innI;\r\n hash.withinRadii(\r\n posRad[innIdx],\r\n posRad[innIdx + 1],\r\n posRad[innIdx + 2],\r\n posRad[innIdx + 3],\r\n neighbours,\r\n );\r\n let ia = 0;\r\n let ni = neighbours[ia];\r\n while (ni >= 0) {\r\n if (innI < ni) {\r\n projectTorus(innI, ni);\r\n }\r\n ni = neighbours[++ia];\r\n }\r\n }\r\n }\r\n\r\n function fixNegatives() {\r\n for (let innI = 0, n = grid.length; innI < n; innI++) {\r\n if (grid[innI] < 0) grid[innI] = 0;\r\n let w = weights[innI];\r\n if (w > 0) {\r\n w = 1 / w;\r\n const innInnI = innI * 3;\r\n volTex[innInnI] *= w;\r\n volTex[innInnI + 1] *= w;\r\n volTex[innInnI + 2] *= w;\r\n }\r\n }\r\n }\r\n\r\n function getVolume() {\r\n // Basic steps are:\r\n // 1) Initialize\r\n // 2) Project points\r\n // 3) Project torii\r\n console.time('ContactSurface.getVolume');\r\n\r\n console.time('ContactSurface.init');\r\n init();\r\n console.timeEnd('ContactSurface.init');\r\n\r\n console.time('ContactSurface.projectPoints');\r\n projectPoints();\r\n console.timeEnd('ContactSurface.projectPoints');\r\n\r\n console.time('ContactSurface.projectTorii');\r\n projectTorii();\r\n console.timeEnd('ContactSurface.projectTorii');\r\n fixNegatives();\r\n console.timeEnd('ContactSurface.getVolume');\r\n }\r\n\r\n this.build = function () {\r\n // type and cutoff left in for compatibility with EDTSurface.getSurface\r\n // function signature\r\n getVolume();\r\n this.volTexMap = volTex;\r\n this.weightsMap = weightsMap;\r\n this.atomMap = atomMap;\r\n this.volMap = grid;\r\n };\r\n}\r\nexport default ContactSurface;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport ContactSurface from './ContactSurface';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'contact' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass ContactSurfaceGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n const contactSurface = new ContactSurface(packedArrays, boundaries, params);\r\n contactSurface.build();\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.volMap),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3, contactSurface.volTexMap),\r\n atomMap: contactSurface.atomMap,\r\n atomWeightMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.weightsMap),\r\n };\r\n return surface;\r\n }\r\n}\r\n\r\nexport default ContactSurfaceGeometry;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for colored atom. Need for atom structure clusterization\r\n *\r\n * @param {Vector3} vCenter Center of atom\r\n * @param {number} radiusAt Radius of atom\r\n */\r\nclass IsoSurfaceAtomColored {\r\n constructor(vCenter, radiusAt) {\r\n this.coord = new THREE.Vector3();\r\n this.coord.copy(vCenter);\r\n this.radius = radiusAt;\r\n this.colorX = 0.99999;\r\n this.colorY = 0.0;\r\n this.colorZ = 0.0;\r\n this.atomType = 0;\r\n this.srcAtom = null;\r\n }\r\n}\r\nexport default IsoSurfaceAtomColored;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n// suppress some JSHint warnings\r\n/* jshint bitwise: false */\r\n\r\n/**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numAtoms - Number of atoms in molecule\r\n * @param {Element} atoms - Array of atoms\r\n * @param {Vector3} vBoxMin - Bounding box min\r\n * @param {Vector3} vBoxMax - Bounding box max\r\n * @param {number} probeRadius - Normals for output\r\n *\r\n */\r\nclass IsosurfaceBuildNormals {\r\n constructor(numAtoms, atoms, vBoxMin, vBoxMax, probeRadius) {\r\n this._numAtoms = numAtoms;\r\n this._atoms = atoms;\r\n this._vBoxMin = new THREE.Vector3();\r\n this._vBoxMax = new THREE.Vector3();\r\n this._vBoxMin.copy(vBoxMin);\r\n this._vBoxMax.copy(vBoxMax);\r\n this._probeRadius = probeRadius;\r\n\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n }\r\n\r\n createVoxels() {\r\n let numAtomsRefs;\r\n let rad;\r\n const ATOM_VOXEL_REF_SCALE = 4.5;\r\n\r\n const numAtoms = this._numAtoms | 0;\r\n const atoms = this._atoms;\r\n const dx = this._vBoxMax.x - this._vBoxMin.x;\r\n const dy = this._vBoxMax.y - this._vBoxMin.y;\r\n const dz = this._vBoxMax.z - this._vBoxMin.z;\r\n let w = (dx < dy) ? dx : dy;\r\n w = (dz < w) ? dz : w;\r\n let maxRad = 0.0;\r\n let aveRad = 0.0;\r\n\r\n let i;\r\n for (i = 0; i < numAtoms; i++) {\r\n rad = (atoms[i].radius + this._probeRadius) * 2.0;\r\n maxRad = (rad > maxRad) ? rad : maxRad;\r\n aveRad += rad;\r\n }\r\n let numCells = Math.floor(w / maxRad);\r\n if (numCells < 2) {\r\n numCells = 2;\r\n }\r\n aveRad /= numAtoms;\r\n\r\n this._numCells = numCells;\r\n this._aveRad = aveRad;\r\n this._maxRad = maxRad;\r\n\r\n const side = numCells;\r\n const side2 = numCells * numCells;\r\n const side3 = numCells * numCells * numCells;\r\n\r\n const xScale = this._xScale = 1.0 / (this._vBoxMax.x - this._vBoxMin.x);\r\n const yScale = this._yScale = 1.0 / (this._vBoxMax.y - this._vBoxMin.y);\r\n const zScale = this._zScale = 1.0 / (this._vBoxMax.z - this._vBoxMin.z);\r\n\r\n // estimate number of individual atom refs in each voxel list\r\n let maxAtomsRefs = 0;\r\n\r\n const xNumVoxMult = xScale * numCells;\r\n const yNumVoxMult = yScale * numCells;\r\n const zNumVoxMult = zScale * numCells;\r\n\r\n for (i = 0; i < numAtoms; i++) {\r\n const radAffect = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n const diaAffect = radAffect * 2.0;\r\n let numVoxX = Math.floor(xNumVoxMult * diaAffect + 0.8);\r\n let numVoxY = Math.floor(yNumVoxMult * diaAffect + 0.8);\r\n let numVoxZ = Math.floor(zNumVoxMult * diaAffect + 0.8);\r\n // avoid case numVox? == 0\r\n // also use loop i <=\r\n numVoxX++;\r\n numVoxY++;\r\n numVoxZ++;\r\n maxAtomsRefs += numVoxX * numVoxY * numVoxZ;\r\n } // for (i)\r\n // maxAtomsRefs = numAtoms * MAX_ATOMS_IN_SINGLE_VOXEL;\r\n\r\n this._voxelList = utils.allocateTyped(Int32Array, side3);\r\n const atomsList = [];\r\n atomsList.length = maxAtomsRefs;\r\n if ((this._voxelList === null) || (atomsList === null)) {\r\n return 0 - 1;\r\n }\r\n // init voxel list\r\n for (i = 0; i < side3; i++) {\r\n this._voxelList[i] = -1;\r\n }\r\n numAtomsRefs = 0;\r\n\r\n // create voxel lists\r\n for (i = 0; i < numAtoms; i++) {\r\n // use multiplier 4 to locate this atom in different voxels\r\n rad = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n let xIndMin = Math.floor((atoms[i].coord.x - this._vBoxMin.x - rad) * numCells * xScale);\r\n let yIndMin = Math.floor((atoms[i].coord.y - this._vBoxMin.y - rad) * numCells * yScale);\r\n let zIndMin = Math.floor((atoms[i].coord.z - this._vBoxMin.z - rad) * numCells * zScale);\r\n let xIndMax = Math.floor((atoms[i].coord.x - this._vBoxMin.x + rad) * numCells * xScale);\r\n let yIndMax = Math.floor((atoms[i].coord.y - this._vBoxMin.y + rad) * numCells * yScale);\r\n let zIndMax = Math.floor((atoms[i].coord.z - this._vBoxMin.z + rad) * numCells * zScale);\r\n\r\n xIndMin = (xIndMin >= 0) ? xIndMin : 0;\r\n yIndMin = (yIndMin >= 0) ? yIndMin : 0;\r\n zIndMin = (zIndMin >= 0) ? zIndMin : 0;\r\n\r\n xIndMax = (xIndMax < numCells) ? xIndMax : (numCells - 1);\r\n yIndMax = (yIndMax < numCells) ? yIndMax : (numCells - 1);\r\n zIndMax = (zIndMax < numCells) ? zIndMax : (numCells - 1);\r\n\r\n for (let z = zIndMin; z <= zIndMax; z++) {\r\n for (let y = yIndMin; y <= yIndMax; y++) {\r\n for (let x = xIndMin; x <= xIndMax; x++) {\r\n // add atom with index \"i\" to this voxel list\r\n const indVoxel = x + y * side + z * side2;\r\n // assert indVoxel >= 0\r\n // assert indVoxel < side3\r\n\r\n // add first\r\n if (this._voxelList[indVoxel] < 0) {\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = 0 - 1;\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n numAtomsRefs++;\r\n // assert numAtomsRefs < maxAtomsRefs - 1\r\n continue;\r\n }\r\n // insert into head of list\r\n const indexNext = this._voxelList[indVoxel];\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = indexNext;\r\n numAtomsRefs++;\r\n } // for (x)\r\n } // for (y)\r\n } // for (z)\r\n } // for (i)\r\n\r\n // convert Array to Int32Array\r\n this._atomsList = Int32Array.from(atomsList);\r\n\r\n return 0;\r\n }\r\n\r\n destroyVoxels() {\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n\r\n this._atoms = null;\r\n this._vertices = null;\r\n this._vBoxMin = null;\r\n this._vBoxMax = null;\r\n }\r\n\r\n /**\r\n * Enumerate all atoms affecting specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n * @param {func(atom)} process - function to call for each atom\r\n */\r\n forEachRelatedAtom(point, process) {\r\n // find corresponding voxel\r\n const xInd = Math.floor((point.x - this._vBoxMin.x) * this._numCells * this._xScale);\r\n const yInd = Math.floor((point.y - this._vBoxMin.y) * this._numCells * this._yScale);\r\n const zInd = Math.floor((point.z - this._vBoxMin.z) * this._numCells * this._zScale);\r\n const indVoxel = xInd + yInd * this._numCells + zInd * this._numCells * this._numCells;\r\n\r\n // run through atoms affecting this voxel\r\n const atoms = this._atoms;\r\n for (let ref = this._voxelList[indVoxel]; ref >= 0; ref = this._atomsList[ref * 2 + 1]) {\r\n const indexAtom = this._atomsList[ref * 2];\r\n process(atoms[indexAtom]);\r\n }\r\n }\r\n\r\n /**\r\n * Get atom closest to specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n *\r\n * @returns {IsoSurfaceAtomColored} atom, or null if not found\r\n */\r\n getClosestAtom(point) {\r\n let closest = null;\r\n let minDist2 = Number.MAX_VALUE;\r\n\r\n this.forEachRelatedAtom(point, (atom) => {\r\n const dist2 = point.distanceToSquared(atom.coord);\r\n if (dist2 < minDist2) {\r\n minDist2 = dist2;\r\n closest = atom;\r\n }\r\n });\r\n\r\n return closest;\r\n }\r\n\r\n /**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} normals - Normals for output\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildNormals(numVertices, vertices, normals) {\r\n const self = this;\r\n let numCloseAtoms = 0;\r\n let vx = 0;\r\n let vy = 0;\r\n let vz = 0;\r\n let dist2;\r\n let vNormalX = 0;\r\n let vNormalY = 0;\r\n let vNormalZ = 0;\r\n let koef = 0;\r\n let w = 0;\r\n const r25 = 2.5;\r\n const r01 = 0.1;\r\n\r\n const maxRadAffect = this._aveRad * r25;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n const expScale = -this._aveRad * r01;\r\n\r\n // some stats\r\n // numSlowAtoms = 0;\r\n\r\n const gatherNormals = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = Math.exp(expScale * koef);\r\n\r\n vNormalX += dx * w;\r\n vNormalY += dy * w;\r\n vNormalZ += dz * w;\r\n numCloseAtoms++;\r\n };\r\n\r\n let maxClosedAtoms = 0;\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n numCloseAtoms = 0;\r\n vNormalX = vNormalY = vNormalZ = 0.0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherNormals);\r\n\r\n maxClosedAtoms = (numCloseAtoms > maxClosedAtoms) ? numCloseAtoms : maxClosedAtoms;\r\n\r\n // normalize vNormal\r\n dist2 = vNormalX * vNormalX + vNormalY * vNormalY + vNormalZ * vNormalZ;\r\n if (numCloseAtoms > 0) {\r\n koef = 1.0 / Math.sqrt(dist2);\r\n vNormalX *= koef;\r\n vNormalY *= koef;\r\n vNormalZ *= koef;\r\n }\r\n normals[i].x = vNormalX;\r\n normals[i].y = vNormalY;\r\n normals[i].z = vNormalZ;\r\n } // for (i) all vertices\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Build vertex colors for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} colors - Colors for output\r\n * @param {number} radiusColorSmoothness - Radius of smoothness sphere\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildColors(numVertices, vertices, colors, radiusColorSmoothness) {\r\n const self = this;\r\n let vx = 0.0;\r\n let vy = 0.0;\r\n let vz = 0.0;\r\n let koef = 0.0;\r\n let w = 0.0;\r\n const KOEF_ADD = 0.8;\r\n\r\n const maxRadAffect = radiusColorSmoothness;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n\r\n let colorsClose = [];\r\n let weights = [];\r\n let weightsSum = 0;\r\n\r\n const gatherColors = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = 1.0 / (KOEF_ADD + koef);\r\n\r\n colorsClose.push([atom.colorX, atom.colorY, atom.colorZ]);\r\n weights.push(w); // save weights for use\r\n weightsSum += w; // calc sum of weights fo further normalization\r\n };\r\n\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n colorsClose = [];\r\n weights = [];\r\n weightsSum = 0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherColors);\r\n\r\n // normalized weighted sum of colors\r\n for (let j = 0; j < colorsClose.length; ++j) {\r\n const weightNormalized = weights[j] / weightsSum;\r\n colors[i].x += colorsClose[j][0] * weightNormalized;\r\n colors[i].y += colorsClose[j][1] * weightNormalized;\r\n colors[i].z += colorsClose[j][2] * weightNormalized;\r\n }\r\n } // for (i) all vertices\r\n return 0;\r\n }\r\n}\r\nexport default IsosurfaceBuildNormals;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for geometry (triangle mesh) representation\r\n *\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices in mesh\r\n * @param {number} maxNumTriangles Maximum possible number of triangles in mesh\r\n * @param {boolean} needVertexColors Obvious\r\n */\r\nclass IsoSurfaceGeo {\r\n constructor(maxNumVertices, maxNumTriangles, needVertexColors) {\r\n this._maxNumVertices = maxNumVertices;\r\n this._maxNumTriangles = maxNumTriangles;\r\n this._vertices = new Array(maxNumVertices);\r\n this._normals = new Array(maxNumVertices);\r\n this._colors = null;\r\n if (needVertexColors) {\r\n this._colors = new Array(maxNumVertices);\r\n }\r\n this._indices = new Array(maxNumTriangles * (1 + 2));\r\n this._numVertices = 0;\r\n this._numTriangles = 0;\r\n\r\n let i;\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._vertices[i] = new THREE.Vector3();\r\n this._normals[i] = new THREE.Vector3();\r\n }\r\n for (i = 0; i < maxNumTriangles * (1 + 2); i++) {\r\n this._indices[i] = -1;\r\n }\r\n if (needVertexColors) {\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._colors[i] = new THREE.Vector3();\r\n }\r\n }\r\n }\r\n\r\n destroy() {\r\n this._vertices = null;\r\n this._normals = null;\r\n this._indices = null;\r\n }\r\n}\r\nexport default IsoSurfaceGeo;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurfaceAtomColored from './IsoSurfaceAtomColored';\r\nimport IsosurfaceBuildNormals from './IsosurfaceBuildNormals';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport IsoSurfaceGeo from './IsoSurfaceGeo';\r\nimport chem from '../../chem';\r\nimport utils from '../../utils';\r\n\r\nconst COLOR_SIZE = 3;\r\nconst HASH_SIZE = 32768;\r\nconst { Element } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass SSIsosurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n // convert geoOut into arrays of positions, indices, normals\r\n this._innerBuild();\r\n const geoOut = this.getGeo();\r\n this.destroy();\r\n this._fromGeo(geoOut);\r\n }\r\n\r\n _fromGeo(geoOut) {\r\n let colors = null;\r\n const positions = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n const normals = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n if (geoOut._colors !== null) {\r\n colors = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n }\r\n const indices = utils.allocateTyped(Uint32Array, (1 + 2) * geoOut._numTriangles);\r\n\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++) {\r\n positions[j + 0] = (geoOut._vertices[i].x);\r\n positions[j + 1] = (geoOut._vertices[i].y);\r\n positions[j + 2] = (geoOut._vertices[i].z);\r\n normals[j + 0] = geoOut._normals[i].x;\r\n normals[j + 1] = geoOut._normals[i].y;\r\n normals[j + 2] = geoOut._normals[i].z;\r\n j += 3;\r\n }\r\n if (colors !== null) {\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++, j += 3) {\r\n colors[j + 0] = geoOut._colors[i].x;\r\n colors[j + 1] = geoOut._colors[i].y;\r\n colors[j + 2] = geoOut._colors[i].z;\r\n }\r\n }\r\n\r\n const numTri3 = geoOut._numTriangles * (1 + 2);\r\n for (let i = 0; i < numTri3; i++) {\r\n indices[i] = geoOut._indices[i];\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(positions, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(colors, 3));\r\n this.computeBoundingBox();\r\n this.computeBoundingSphere();\r\n\r\n geoOut.destroy();\r\n }\r\n\r\n convertToAtomsColored(packedArrays, atomsColored) {\r\n const { atoms, colors } = packedArrays;\r\n for (let i = 0, numAtoms = atoms.length; i < numAtoms; i++) {\r\n const vCenter = atoms[i].position;\r\n const { radius } = atoms[i].element;\r\n atomsColored[i] = new IsoSurfaceAtomColored(vCenter, radius);\r\n const nm = atoms[i].element.number;\r\n atomsColored[i].atomType = this.getType(nm);\r\n let cIdx = COLOR_SIZE * i;\r\n atomsColored[i].colorX = colors[cIdx++];\r\n atomsColored[i].colorY = colors[cIdx++];\r\n atomsColored[i].colorZ = colors[cIdx];\r\n atomsColored[i].srcAtom = atoms[i];\r\n }\r\n }\r\n\r\n getGeo() {\r\n return this.geoOut;\r\n }\r\n\r\n destroy() {\r\n this.atoms = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n }\r\n\r\n /**\r\n * Calculates bounding box for array with spheres (atoms)\r\n *\r\n * @param {Object} atoms Atoms array\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n */\r\n getBoundingBox(atoms, vBoxMin, vBoxMax) {\r\n const bigNum = 10000000.0;\r\n\r\n vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum;\r\n vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum;\r\n\r\n const probeRadius2 = this.probeRadius * this.atomRadiusScale;\r\n let radMax = 0.0;\r\n for (let i = 0, num = atoms.length; i < num; i++) {\r\n const vCenter = atoms[i].coord;\r\n const rad = atoms[i].radius + probeRadius2;\r\n radMax = (rad > radMax) ? rad : radMax;\r\n if (vCenter.x - rad < vBoxMin.x) {\r\n vBoxMin.x = vCenter.x - rad;\r\n }\r\n if (vCenter.y - rad < vBoxMin.y) {\r\n vBoxMin.y = vCenter.y - rad;\r\n }\r\n if (vCenter.z - rad < vBoxMin.z) {\r\n vBoxMin.z = vCenter.z - rad;\r\n }\r\n if (vCenter.x + rad > vBoxMax.x) {\r\n vBoxMax.x = vCenter.x + rad;\r\n }\r\n if (vCenter.y + rad > vBoxMax.y) {\r\n vBoxMax.y = vCenter.y + rad;\r\n }\r\n if (vCenter.z + rad > vBoxMax.z) {\r\n vBoxMax.z = vCenter.z + rad;\r\n }\r\n }\r\n vBoxMin.x -= radMax;\r\n vBoxMin.y -= radMax;\r\n vBoxMin.z -= radMax;\r\n vBoxMax.x += radMax;\r\n vBoxMax.y += radMax;\r\n vBoxMax.z += radMax;\r\n }\r\n\r\n /**\r\n * Calculate (x,y,z) cordinate of the cell corner point\r\n *\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {number} x Cell integer x coordinate\r\n * @param {number} y Cell integer y coordinate\r\n * @param {number} z Cell integer z coordinate\r\n * @param {number} numPoints NUm points in cell on side\r\n * @param {Vector3} vOut Output vector\r\n */\r\n getCornerCoord(vBoxMin, vBoxMax, x, y, z, numPoints, vOut) {\r\n const invNP = 1.0 / (numPoints - 1.0);\r\n const tx = x * invNP;\r\n const ty = y * invNP;\r\n const tz = z * invNP;\r\n\r\n vOut.x = vBoxMin.x * (1.0 - tx) + vBoxMax.x * tx;\r\n vOut.y = vBoxMin.y * (1.0 - ty) + vBoxMax.y * ty;\r\n vOut.z = vBoxMin.z * (1.0 - tz) + vBoxMax.z * tz;\r\n }\r\n\r\n /**\r\n * Calculate point of intersection of sphere surface\r\n * and cell edge, given by [indexA, indexB] line\r\n *\r\n * @param {number} indexA Cell vertex index in [0..11]\r\n * @param {number} indexB Cell vertex index in [0..11]\r\n * @param {array} sign Sign array for all 8 vertices\r\n * @param {object} cube Cube\r\n * @param {number} indexPointValue for value placement\r\n * @param {Vector3} vOut Point of intersection\r\n */\r\n buildEdgePoint(indexA, indexB, sign, cube, indexPointValue, vOut) {\r\n if (sign[indexA] ^ sign[indexB]) {\r\n const cTwentyFour = 24;\r\n const t = (0 - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA])\r\n / (cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexB]\r\n - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]);\r\n const xa = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 0];\r\n const ya = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 1];\r\n const za = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 2];\r\n const xb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 0];\r\n const yb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 1];\r\n const zb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 2];\r\n\r\n vOut.x = xa * (1.0 - t) + xb * t;\r\n vOut.y = ya * (1.0 - t) + yb * t;\r\n vOut.z = za * (1.0 - t) + zb * t;\r\n }\r\n }\r\n\r\n /**\r\n * Check if triangle is visible (vertices are close to atoms included in visibility set)\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} true if triangle is visible\r\n */\r\n isTriangleVisible(v0, v1, v2) {\r\n const a0 = this.voxelWorld.getClosestAtom(v0);\r\n const a1 = this.voxelWorld.getClosestAtom(v1);\r\n const a2 = this.voxelWorld.getClosestAtom(v2);\r\n if (a0 === null || a1 === null || a2 === null\r\n || a0.srcAtom === null || a1.srcAtom === null || a2.srcAtom === null) {\r\n return false;\r\n }\r\n\r\n return this.visibilitySelector.includesAtom(a0.srcAtom)\r\n && this.visibilitySelector.includesAtom(a1.srcAtom)\r\n && this.visibilitySelector.includesAtom(a2.srcAtom);\r\n }\r\n\r\n /**\r\n * Add triangle to result geometry\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} false if no more triangles can be added\r\n */\r\n addTriangle(v0, v1, v2) {\r\n if (this.visibilitySelector && !this.isTriangleVisible(v0, v1, v2)) {\r\n return true;\r\n }\r\n\r\n const geo = this.geoOut;\r\n\r\n if (geo._numTriangles >= this.maxNumTriangles) {\r\n return false;\r\n }\r\n\r\n // Add vertex with optimize\r\n const indInGeo0 = this.addVertexToGeo(geo, v0);\r\n const indInGeo1 = this.addVertexToGeo(geo, v1);\r\n const indInGeo2 = this.addVertexToGeo(geo, v2);\r\n if ((indInGeo0 | indInGeo1 | indInGeo2) < 0) {\r\n return false;\r\n }\r\n\r\n const itr = 3 * geo._numTriangles;\r\n geo._indices[itr + 0] = indInGeo0;\r\n geo._indices[itr + 1] = indInGeo1;\r\n geo._indices[itr + 2] = indInGeo2;\r\n geo._numTriangles++;\r\n return true;\r\n }\r\n\r\n /**\r\n * Build result geometry (triangle mesh) from marching cube cells\r\n *\r\n * @param {number} meshRes Marchnig cube vertex count on each side\r\n * @param {Vector3} vBoxMin Bounding box point min\r\n * @param {Vector3} vBoxMax Bounding box point max\r\n * @param {number} corners float values array for each cube point\r\n * @param {Vector3} vCellStep vector to next cube cell diagonal point\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} 0, if success (<0) is error\r\n */\r\n buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) {\r\n const arrSize = 12;\r\n const cNumVerts = 8;\r\n const numCells = meshRes - 1;\r\n const side = meshRes;\r\n const side2 = meshRes * meshRes;\r\n\r\n const vaEdges = new Array(arrSize);\r\n for (let i = 0; i < arrSize; i++) {\r\n vaEdges[i] = new THREE.Vector3();\r\n }\r\n const sign = [];\r\n for (let i = 0; i < cNumVerts; i++) {\r\n sign[i] = 1.0;\r\n }\r\n const vCorner = new THREE.Vector3();\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n if (!cube.hasIntersection[indCell]) {\r\n // next cell\r\n indCell++;\r\n continue;\r\n }\r\n const bitsInside = cube.bitsInside[indCell];\r\n\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, meshRes, vCorner);\r\n\r\n const indPointValues = indCell * (2 << (2 + 2));\r\n for (let i = 0, j = 0; i < cNumVerts; i++) {\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.x;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.y;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.z;\r\n }\r\n\r\n cube.pointsValuesLinear[indPointValues + 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 2 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3] += vCellStep.x;\r\n\r\n cube.pointsValuesLinear[indPointValues + 2 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 3 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 2] += vCellStep.z;\r\n\r\n cube.pointsValuesLinear[indPointValues + 4 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 1] += vCellStep.y;\r\n\r\n // now current cell has intersections (from -x to +x) on some cube edges\r\n const indValues = indPointValues + 24;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n sign[i] = (cube.pointsValuesLinear[indValues + i] < 0.0) ? 1 : 0;\r\n }\r\n\r\n this.buildEdgePoint(0, 1, sign, cube, indPointValues, vaEdges[0]);\r\n this.buildEdgePoint(1, 2, sign, cube, indPointValues, vaEdges[1]);\r\n this.buildEdgePoint(2, 3, sign, cube, indPointValues, vaEdges[2]);\r\n this.buildEdgePoint(3, 0, sign, cube, indPointValues, vaEdges[3]);\r\n\r\n this.buildEdgePoint(4, 5, sign, cube, indPointValues, vaEdges[4]);\r\n this.buildEdgePoint(5, 6, sign, cube, indPointValues, vaEdges[5]);\r\n this.buildEdgePoint(6, 7, sign, cube, indPointValues, vaEdges[6]);\r\n this.buildEdgePoint(7, 4, sign, cube, indPointValues, vaEdges[7]);\r\n\r\n this.buildEdgePoint(0, 4, sign, cube, indPointValues, vaEdges[8]);\r\n this.buildEdgePoint(1, 5, sign, cube, indPointValues, vaEdges[9]);\r\n this.buildEdgePoint(2, 6, sign, cube, indPointValues, vaEdges[10]);\r\n this.buildEdgePoint(3, 7, sign, cube, indPointValues, vaEdges[11]);\r\n\r\n const offs = bitsInside * (2 << (1 + 2));\r\n for (let numTri = 0, indTri = 0; numTri < (2 + 2 + 2); numTri++, indTri += 3) {\r\n // s_triIndicesMarchCube is external array, defined in mold_ind.js\r\n const i0 = cube.striIndicesMarchCube[offs + indTri];\r\n if (i0 < 0) {\r\n break;\r\n }\r\n const i1 = cube.striIndicesMarchCube[offs + indTri + 1];\r\n const i2 = cube.striIndicesMarchCube[offs + indTri + 2];\r\n\r\n if (!this.addTriangle(vaEdges[i0], vaEdges[i1], vaEdges[i2])) {\r\n return 0 - 2;\r\n }\r\n } // for numTri\r\n\r\n // next cell (cube)\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return 0;\r\n }\r\n\r\n /**\r\n * Returns number of cell with intersection with at least one sphere.\r\n * Using this number, we can estimate required number of vertices\r\n * and triangles to build result mesh.\r\n *\r\n * @param {number} side Number of points in cube voxels\r\n * @param {number} numCells Number of cells in cube voxels (per direction)\r\n * @param {array} corners Array of float values for cube corner points\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} numIntersectedCells\r\n */\r\n getNumIntersectedCells(side, numCells, corners, cube) {\r\n const side2 = side * side;\r\n const cNumVerts = 8;\r\n let numIntersectedCells = 0;\r\n\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n const cubeValuesIndex = indCell * (2 << (2 + 2)) + 24;\r\n const indCorner = x + indZ + indY;\r\n\r\n cube.pointsValuesLinear[cubeValuesIndex] = corners[indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 1] = corners[indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 2] = corners[indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 3] = corners[indCorner + side];\r\n cube.pointsValuesLinear[cubeValuesIndex + 4] = corners[side2 + indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 5] = corners[side2 + indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 6] = corners[side2 + indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 7] = corners[side2 + indCorner + side];\r\n\r\n // check read exception\r\n // assert(side2 + indCorner + side + 1 < side3);\r\n\r\n // get bit flags inside\r\n let bitsInside = 0;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n if (cube.pointsValuesLinear[cubeValuesIndex + i] < 0.0) {\r\n bitsInside |= (1 << i);\r\n }\r\n }\r\n\r\n if ((bitsInside === 0) || (bitsInside === ((1 << cNumVerts) - 1))) {\r\n cube.hasIntersection[indCell] = false;\r\n } else {\r\n cube.hasIntersection[indCell] = true;\r\n numIntersectedCells++;\r\n }\r\n cube.bitsInside[indCell] = bitsInside;\r\n // next cell\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return numIntersectedCells;\r\n }\r\n\r\n getType(letter) {\r\n /* eslint-disable no-magic-numbers */\r\n const atomT = [0, 0, 1, 1, 2, 6, 3, 6, 4, 6, 5, 6, 6, 0, 7, 3, 8, 2, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 4,\r\n 16, 5, 17, 6, 18, 6, 19, 6, 20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6,\r\n 32, 6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, 45, 6, 46, 6, 47, 6,\r\n 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, 6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6,\r\n 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6,\r\n 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, 95, 6,\r\n 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, 6, 108, 6, 109, 6];\r\n /* eslint-enable no-magic-numbers */\r\n\r\n if (letter < 1 || letter > atomT.length / 2\r\n || (Object.keys(Element.ByAtomicNumber).length * 2) !== atomT.length) {\r\n throw new Error('atomT.length should be equal Element.ByAtomicNumber.length * 2');\r\n }\r\n return atomT[letter * 2];\r\n }\r\n\r\n /**\r\n * Calculate values for marching cube grid points\r\n * positive values are outside sphere, negative - is inside\r\n *\r\n * @param {array} corners array of float values\r\n * @param {number} side Number of point in cube in 1 dimennsion\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {array} atoms Array of input atoms\r\n * @param {number} probeRad radius for atom probing\r\n */\r\n calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) {\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const vCorner = new THREE.Vector3();\r\n const vDif = new THREE.Vector3();\r\n /* eslint-disable no-magic-numbers */\r\n const aLot = +1.0e12;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n for (let i = 0; i < side3; i++) {\r\n corners[i] = aLot; // to large value\r\n }\r\n\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n for (let s = 0, numAtoms = atoms.length; s < numAtoms; s++) {\r\n const atom = atoms[s];\r\n const radius = atom.radius + probeRad;\r\n\r\n const fx = ((atom.coord.x - radius) - vBoxMin.x) * xScale;\r\n const fy = ((atom.coord.y - radius) - vBoxMin.y) * yScale;\r\n const fz = ((atom.coord.z - radius) - vBoxMin.z) * zScale;\r\n\r\n const indXMin = Math.floor(fx);\r\n const indYMin = Math.floor(fy);\r\n const indZMin = Math.floor(fz);\r\n\r\n let indXMax = Math.floor(((atom.coord.x + radius) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((atom.coord.y + radius) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((atom.coord.z + radius) - vBoxMin.z) * zScale);\r\n\r\n indXMax++;\r\n indYMax++;\r\n indZMax++;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let y = indYMin; y <= indYMax; y++) {\r\n const indY = y * side2;\r\n for (let z = indZMin; z <= indZMax; z++) {\r\n const indZ = z * side;\r\n for (let x = indXMin; x <= indXMax; x++) {\r\n const ind = indY + indZ + x;\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, side, vCorner);\r\n vDif.x = vCorner.x - atom.coord.x;\r\n vDif.y = vCorner.y - atom.coord.y;\r\n vDif.z = vCorner.z - atom.coord.z;\r\n const distToSphere = Math.sqrt(vDif.x * vDif.x + vDif.y * vDif.y + vDif.z * vDif.z);\r\n // val: < 0, if inside sphere\r\n // val: > 0, if outside sphere\r\n const val = distToSphere - radius;\r\n if (val < corners[ind]) {\r\n corners[ind] = val;\r\n }\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n } // for (s)\r\n }\r\n\r\n /**\r\n * Create memory pool for vertex hash management\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices (that will be build)\r\n * @param {number} maxNumTriangles Maximum possible number of triangles (that will be build)\r\n * @returns {number} 0, if success. (<0) is non memory\r\n */\r\n createVertexHash(maxNumVertices, maxNumTriangles) {\r\n this.hashLines = utils.allocateTyped(Int32Array, HASH_SIZE * 2);\r\n if (this.hashLines === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < HASH_SIZE; i++) {\r\n this.hashLines[j++] = 0; // num vertices in this hash line\r\n this.hashLines[j++] = 0 - 1; // index of the first entry\r\n }\r\n\r\n this.maxNumVertices = maxNumVertices;\r\n this.maxNumTriangles = maxNumTriangles;\r\n\r\n this.numHashEtriesAllocated = maxNumVertices;\r\n this.hashEntries = utils.allocateTyped(Int32Array, 2 * this.numHashEtriesAllocated);\r\n if (this.hashEntries === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < this.numHashEtriesAllocated; i++) {\r\n this.hashEntries[j++] = 0 - 1; // index of vertex\r\n this.hashEntries[j++] = 0 - 1; // next hash entry index\r\n }\r\n this.numHashEntryIndex = 0;\r\n return 0;\r\n }\r\n\r\n /**\r\n * Allocate and return new hash entry. Just check possible amount.\r\n *\r\n * @returns {number} index of hash entry, that can be used for geometry add vertex functionality\r\n */\r\n getNewHashEntry() {\r\n if (this.numHashEntryIndex < this.numHashEtriesAllocated) {\r\n const i = this.numHashEntryIndex;\r\n this.numHashEntryIndex++;\r\n return i;\r\n }\r\n return 0 - 1;\r\n }\r\n\r\n /**\r\n * Add vertex to geometry structure\r\n * using vertex hash table to quickly check, is this vertex already exist in geometry\r\n *\r\n * @param {object} geoOut Geometry to build\r\n * @param {Vector3} vAdd Vertex to add\r\n * @returns {number} index of added (or existing) vertex in geometry.\r\n */\r\n addVertexToGeo(geoOut, vAdd) {\r\n let entry;\r\n const oneHynberes = 0.01;\r\n const n815851 = 815851;\r\n const n37633 = 37633;\r\n const n2453543 = 2453543;\r\n const r106 = 1.0e-6;\r\n\r\n const hashResolution = this.marCubeResoultion << 2;\r\n const v = new THREE.Vector3();\r\n const ix = Math.floor(hashResolution * (vAdd.x - this.vBoxMin.x) / (this.vBoxMax.x + oneHynberes - this.vBoxMin.x));\r\n const iy = Math.floor(hashResolution * (vAdd.y - this.vBoxMin.y) / (this.vBoxMax.y + oneHynberes - this.vBoxMin.y));\r\n const iz = Math.floor(hashResolution * (vAdd.z - this.vBoxMin.z) / (this.vBoxMax.z + oneHynberes - this.vBoxMin.z));\r\n let iHash = ix * n815851 + iz * n37633 + iy * n2453543;\r\n iHash &= (HASH_SIZE - 1);\r\n const hLineIndex = iHash + iHash;\r\n\r\n // search vertex via hash\r\n // search in hash list\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n for (entry = this.hashLines[hLineIndex + 1]; entry >= 0; entry = this.hashEntries[entry * 2 + 1]) {\r\n const ind = this.hashEntries[entry * 2 + 0]; // vertex index\r\n v.copy(geoOut._vertices[ind]);\r\n v.x -= vAdd.x;\r\n v.y -= vAdd.y;\r\n v.z -= vAdd.z;\r\n const dot2 = v.x * v.x + v.y * v.y + v.z * v.z;\r\n if (dot2 < r106) {\r\n return ind;\r\n } // if (found)\r\n } // for (entry)\r\n } // search\r\n\r\n // add new vertex to geometry\r\n if (geoOut._numVertices >= this.maxNumVertices) {\r\n return 0 - 1;\r\n }\r\n\r\n const iVertAdd = geoOut._numVertices;\r\n geoOut._vertices[iVertAdd].copy(vAdd);\r\n\r\n // add to hash\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n entry = this.getNewHashEntry();\r\n if (entry < 0) {\r\n return 0 - 1;\r\n }\r\n const entryFirst = this.hashLines[hLineIndex + 1];\r\n this.hashLines[hLineIndex + 1] = entry;\r\n this.hashEntries[entry * 2 + 0] = iVertAdd;\r\n this.hashEntries[entry * 2 + 1] = entryFirst;\r\n\r\n this.hashLines[hLineIndex + 0]++; // num vertices in line ++\r\n }\r\n geoOut._numVertices++;\r\n return iVertAdd;\r\n }\r\n\r\n /**\r\n *\r\n * @param {number} side some placeholder description\r\n * @param {number} probeSphereRadius some placeholder description\r\n * @param {object} vBoxMin some placeholder description\r\n * @param {object} vBoxMax some placeholder description\r\n * @param {object} geoOut some placeholder description\r\n * @param {object} corners some placeholder description\r\n * @returns {number} always 0\r\n */\r\n modifyExcludedFromGeo(\r\n side,\r\n probeSphereRadius,\r\n vBoxMin,\r\n vBoxMax,\r\n geoOut,\r\n corners,\r\n ) {\r\n let ind;\r\n let distToSphere;\r\n let distToBorder;\r\n const r11 = 1.1;\r\n\r\n function innerBlockWorkAround() {\r\n if (distToBorder > 0.0) {\r\n // point is inside probe sphere\r\n if (corners[ind] < 0.0) {\r\n corners[ind] = distToBorder; // was inside surface, now is oustide ( > 0)\r\n }\r\n if (distToBorder > corners[ind]) {\r\n corners[ind] = distToBorder; // find positive maximum\r\n }\r\n } else if (distToBorder > corners[ind]) { // point is outside sphere\r\n corners[ind] = distToBorder; // find negative maximum\r\n }\r\n }\r\n\r\n const side2 = side * side;\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n const probeSpRad2 = (probeSphereRadius * 2) * (probeSphereRadius * 2);\r\n const sideInv = 1.0 / (side - 1);\r\n\r\n for (let i = 0; i < geoOut._numVertices; i++) {\r\n const vCenter = geoOut._vertices[i];\r\n\r\n const radEst = probeSphereRadius * r11;\r\n\r\n let indXMin = Math.floor(((vCenter.x - radEst) - vBoxMin.x) * xScale);\r\n let indYMin = Math.floor(((vCenter.y - radEst) - vBoxMin.y) * yScale);\r\n let indZMin = Math.floor(((vCenter.z - radEst) - vBoxMin.z) * zScale);\r\n\r\n let indXMax = Math.floor(((vCenter.x + radEst) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((vCenter.y + radEst) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((vCenter.z + radEst) - vBoxMin.z) * zScale);\r\n\r\n indXMin = (indXMin >= 0) ? indXMin : 0;\r\n indYMin = (indYMin >= 0) ? indYMin : 0;\r\n indZMin = (indZMin >= 0) ? indZMin : 0;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let iy = indYMin; iy <= indYMax; iy++) {\r\n const indY = iy * side2;\r\n for (let iz = indZMin; iz <= indZMax; iz++) {\r\n const indZ = iz * side;\r\n for (let ix = indXMin; ix <= indXMax; ix++) {\r\n ind = indY + indZ + ix;\r\n // getCornerCoord(vBoxMin, vBoxMax, ix, iy, iz, side, &vCorner);\r\n let t = ix * sideInv;\r\n const xCorner = vBoxMin.x * (1.0 - t) + vBoxMax.x * t;\r\n t = iy * sideInv;\r\n const yCorner = vBoxMin.y * (1.0 - t) + vBoxMax.y * t;\r\n t = iz * sideInv;\r\n const zCorner = vBoxMin.z * (1.0 - t) + vBoxMax.z * t;\r\n\r\n const dx = xCorner - vCenter.x;\r\n const dy = yCorner - vCenter.y;\r\n const dz = zCorner - vCenter.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 < probeSpRad2) {\r\n distToSphere = Math.sqrt(dist2);\r\n distToBorder = -(distToSphere - probeSphereRadius);\r\n innerBlockWorkAround();\r\n } // if (dist from corner point to sphere center more 2 radiuses)\r\n } // for (ix)\r\n } // for (iz)\r\n } // for (iy)\r\n } // for (i) all geo vertices\r\n return 0;\r\n }\r\n\r\n _innerBuild() {\r\n let ok;\r\n const expandFactor = 1.2;\r\n\r\n // performance test\r\n // this.performanceTest();\r\n\r\n // Create temporary atoms (but colored)\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n this.complex = this._opts.parent;\r\n this.atoms = packedArrays.atoms;\r\n this.meshResolution = this._opts.gridSpacing;\r\n this.atomRadiusScale = this._opts.radScale;\r\n this.colorMode = this._opts.colorMode;\r\n this.probeRadius = this._opts.probeRadius;\r\n this.useVertexColors = true;\r\n this.excludeProbe = this._opts.excludeProbe;\r\n this.visibilitySelector = this._opts.visibilitySelector;\r\n\r\n this.geoOut = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n this.numHashEtriesAllocated = 0;\r\n this.numHashEntryIndex = 0;\r\n this.maxNumVertices = 0;\r\n this.maxNumTriangles = 0;\r\n\r\n const atomsColored = new Array(this.atoms.length);\r\n this.convertToAtomsColored(packedArrays, atomsColored);\r\n\r\n // find bbox for spheres scene\r\n const vBoxMin = this.vBoxMin = new THREE.Vector3();\r\n const vBoxMax = this.vBoxMax = new THREE.Vector3();\r\n this.getBoundingBox(atomsColored, vBoxMin, vBoxMax);\r\n\r\n const marCubeResoultion = this.marCubeResoultion = this.meshResolution * (2 + 2);\r\n\r\n // build grid corners for Marching cube algorithm\r\n const side = marCubeResoultion;\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const corners = utils.allocateTyped(Float32Array, side3);\r\n const rProbeRadius = this.probeRadius * this.atomRadiusScale;\r\n\r\n this.calculateGridCorners(corners, side, vBoxMin, vBoxMax, atomsColored, rProbeRadius);\r\n\r\n const numCells = marCubeResoultion - 1;\r\n const cube = new IsoSurfaceMarchCube();\r\n ok = cube.create(numCells);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // copy corners to cells\r\n const vCellStep = new THREE.Vector3();\r\n vCellStep.x = (vBoxMax.x - vBoxMin.x) / numCells;\r\n vCellStep.y = (vBoxMax.y - vBoxMin.y) / numCells;\r\n vCellStep.z = (vBoxMax.z - vBoxMin.z) / numCells;\r\n\r\n let numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n let maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n let maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n\r\n // build voxel world (used to check triangle-to-atom tie and to calculate normals and colors)\r\n let probeRadForNormalsColors = rProbeRadius;\r\n if (this.excludeProbe) {\r\n probeRadForNormalsColors = 0.01;\r\n }\r\n this.voxelWorld = new IsosurfaceBuildNormals(\r\n atomsColored.length,\r\n atomsColored,\r\n vBoxMin,\r\n vBoxMax,\r\n probeRadForNormalsColors,\r\n );\r\n this.voxelWorld.createVoxels();\r\n\r\n ok = this.buildGeoFromCorners(marCubeResoultion, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n if (this.excludeProbe) {\r\n // using 3d mesh (geoOut) as a surface points\r\n // move probe sphere and try to minimuze corners values\r\n this.modifyExcludedFromGeo(side, rProbeRadius, vBoxMin, vBoxMax, this.geoOut, corners);\r\n\r\n // delete old builded geo\r\n this.geoOut._vertices = null;\r\n this.geoOut._colors = null;\r\n this.geoOut._indices = null;\r\n this.geoOut._normals = null;\r\n this.geoOut._numVertices = 0;\r\n this.geoOut._numTriangles = 0;\r\n this.geoOut = null;\r\n\r\n // estimage geo vertices budget again\r\n numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n // creates empty new geometry\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // build vertices and triangles from corners values\r\n ok = this.buildGeoFromCorners(side, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n }\r\n\r\n // build vertex normals\r\n this.voxelWorld.buildNormals(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._normals);\r\n // More value : more smooth color mixing\r\n // value about 0.7: very rough colors borders\r\n let radiusColorSmoothness = 6.5;\r\n if (this.excludeProbe) {\r\n radiusColorSmoothness -= 1.5;\r\n }\r\n if (this.useVertexColors) {\r\n this.voxelWorld.buildColors(\r\n this.geoOut._vertices.length,\r\n this.geoOut._vertices,\r\n this.geoOut._colors,\r\n radiusColorSmoothness,\r\n );\r\n }\r\n this.voxelWorld.destroyVoxels();\r\n this.voxelWorld = null;\r\n\r\n // remove objects\r\n cube.destroy();\r\n\r\n return ok;\r\n }\r\n}\r\n\r\n// All code below must be erased from every device and each developer's memory\r\n\r\nexport default SSIsosurfaceGeometry;\r\n","import * as THREE from 'three';\r\nimport EventDispatcher from '../../utils/EventDispatcher';\r\n\r\nfunction createLabel(fieldTxt, className) {\r\n const text = document.createElement('div');\r\n text.className = className;\r\n\r\n if (typeof fieldTxt === 'string') {\r\n const spanText = document.createElement('span');\r\n spanText.style.fontSize = '150%';\r\n const strings = fieldTxt.split('\\n');\r\n\r\n for (let i = 0, n = strings.length; i < n; ++i) {\r\n const spanNodeP = document.createElement('span');\r\n const spanNodeText = document.createTextNode(strings[i]);\r\n spanNodeP.appendChild(spanNodeText);\r\n spanText.appendChild(spanNodeP);\r\n if (i < n - 1) {\r\n spanText.appendChild(document.createElement('br'));\r\n }\r\n }\r\n\r\n text.appendChild(spanText);\r\n } else {\r\n text.appendChild(fieldTxt);\r\n }\r\n text.worldPos = new THREE.Vector3();\r\n return text;\r\n}\r\nclass LabelsGeometry extends EventDispatcher {\r\n constructor(instanceCount, opts) {\r\n super();\r\n this._opts = opts;\r\n this.items = [];\r\n this.needsUpdate = false;\r\n\r\n let xTranslation = -50;\r\n let yTranslation = -50;\r\n switch (opts.horizontalAlign) {\r\n case 'left':\r\n xTranslation = 0;\r\n break;\r\n case 'right':\r\n xTranslation = -100;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n switch (opts.verticalAlign) {\r\n case 'top':\r\n yTranslation = -100;\r\n break;\r\n case 'bottom':\r\n yTranslation = 0;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n const deltaPos = new THREE.Vector3(opts.dx || 0, opts.dy || 0, opts.dz || 0);\r\n this.userData = {\r\n translation: `translate(${xTranslation}%, ${yTranslation}%)`,\r\n offset: deltaPos,\r\n };\r\n }\r\n\r\n setItem(itemIdx, itemPos, fieldTxt) {\r\n const opts = this._opts;\r\n const text = this.items[itemIdx] || createLabel(fieldTxt, 'label');\r\n\r\n text.worldPos.copy(itemPos);\r\n text.style.textAlign = opts.horizontalAlign;\r\n text.style.verticalAlign = opts.verticalAlign;\r\n this.items[itemIdx] = text;\r\n }\r\n\r\n setColor(itemIdx, fColor, bColor) {\r\n const text = this.items[itemIdx];\r\n text.opts = {\r\n color: fColor,\r\n background: bColor,\r\n };\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.needsUpdate = true;\r\n this.dispatchEvent({ type: 'update' });\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n }\r\n\r\n // unimplemented functions\r\n raycast() {\r\n }\r\n\r\n setOpacity() {\r\n\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\n\r\nexport default LabelsGeometry;\r\n","import InstancedSpheresGeometry from './InstancedSpheresGeometry';\r\nimport SimpleSpheresGeometry from './SimpleSpheresGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport Instanced2CCylindersGeometry from './Instanced2CCylindersGeometry';\r\nimport ExtrudedObjectsGeometry from './ExtrudedObjectsGeometry';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport TwoColorLinesGeometry from './TwoColorLinesGeometry';\r\nimport CrossGeometry from './CrossGeometry';\r\nimport QuickSurfGeometry from './QuickSurfGeometry';\r\nimport ContactSurfaceGeometry from './ContactSurfaceGeometry';\r\nimport SSIsosurfaceGeometry from './SSIsosurfaceGeometry';\r\nimport LabelsGeometry from './LabelsGeometry';\r\n\r\nexport default {\r\n InstancedSpheresGeometry,\r\n SimpleSpheresGeometry,\r\n Simple2CCylindersGeometry,\r\n Instanced2CCylindersGeometry,\r\n ExtrudedObjectsGeometry,\r\n ChunkedLinesGeometry,\r\n TwoColorLinesGeometry,\r\n CrossGeometry,\r\n QuickSurfGeometry,\r\n ContactSurfaceGeometry,\r\n SSIsosurfaceGeometry,\r\n LabelsGeometry,\r\n};\r\n","export default {\r\n\r\n precision: 'mediump',\r\n\r\n /**\r\n *\r\n * @param {THREE.WebGLRenderer} renderer\r\n */\r\n init(renderer) {\r\n this.precision = renderer.capabilities.getMaxPrecision('highp');\r\n },\r\n};\r\n","import * as THREE from 'three';\r\n\r\nconst noiseWidth = 4;\r\nconst noiseHeight = 4;\r\nconst _noiseData = new Uint8Array([\r\n 24, 52, 0, 255, 254, 145, 0, 255, 122, 0, 0, 255, 7, 170, 0, 255,\r\n 34, 214, 0, 255, 173, 8, 0, 255, 86, 249, 0, 255, 160, 4, 0, 255,\r\n 226, 46, 0, 255, 224, 211, 0, 255, 3, 157, 0, 255, 174, 247, 0, 255,\r\n 12, 182, 0, 255, 220, 216, 0, 255, 1, 109, 0, 255, 253, 154, 0, 255,\r\n]);\r\nconst _noiseWrapS = THREE.RepeatWrapping;\r\nconst _noiseWrapT = THREE.RepeatWrapping;\r\nconst _noiseMinFilter = THREE.NearestFilter;\r\nconst _noiseMagFilter = THREE.NearestFilter;\r\nconst _noiseMapping = THREE.UVMapping;\r\nconst noiseTexture = new THREE.DataTexture(\r\n _noiseData,\r\n noiseWidth,\r\n noiseHeight,\r\n THREE.RGBAFormat,\r\n THREE.UnsignedByteType,\r\n _noiseMapping,\r\n _noiseWrapS,\r\n _noiseWrapT,\r\n _noiseMagFilter,\r\n _noiseMinFilter,\r\n 1,\r\n);\r\nnoiseTexture.needsUpdate = true;\r\n\r\nexport default {\r\n noiseWidth,\r\n noiseHeight,\r\n noiseTexture,\r\n};\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './Uber.vert';\r\nimport fragmentShader from './Uber.frag';\r\nimport capabilities from '../capabilities';\r\nimport noise from '../noiseTexture';\r\n\r\n// Length of _samplesKernel is used in Uber.frag\r\n// If you want to change length of _samplesKernel, please, remember change it in Uber.frag too.\r\n// You can easy find places for replace using word:_samplesKernel\r\nconst _samplesKernel = [\r\n new THREE.Vector2(-0.541978, 0.840393),\r\n new THREE.Vector2(0.125533, -0.992089),\r\n new THREE.Vector2(0.374329, 0.927296),\r\n new THREE.Vector2(-0.105475, 0.994422),\r\n];\r\n\r\nconst defaultUniforms = THREE.UniformsUtils.merge([\r\n\r\n THREE.UniformsLib.fog,\r\n THREE.UniformsLib.lights,\r\n\r\n {\r\n // are updated automatically by three.js (see THREE.ShaderLib.common)\r\n diffuse: { value: new THREE.Color(0xeeeeee) },\r\n opacity: { value: 1.0 },\r\n\r\n specular: { type: 'c', value: new THREE.Color(0x111111) },\r\n shininess: { type: 'f', value: 30 },\r\n fixedColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n zOffset: { type: 'f', value: 0.0 },\r\n zClipValue: { type: 'f', value: 0.0 },\r\n clipPlaneValue: { type: 'f', value: 0.0 },\r\n nearPlaneValue: { type: 'f', value: -0.5 },\r\n invModelViewMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n world2colorMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n dashedLineSize: { type: 'f', value: 0.1 },\r\n dashedLinePeriod: { type: 'f', value: 0.2 },\r\n projMatrixInv: { type: '4fv', value: new THREE.Matrix4() },\r\n viewport: { type: 'v2', value: new THREE.Vector2() },\r\n lineWidth: { type: 'f', value: 2.0 },\r\n // default value must be the same as settings\r\n fogAlpha: { type: 'f', value: 1.0 },\r\n samplesKernel: { type: 'v2v', value: null },\r\n noiseTex: { type: 't', value: null },\r\n noiseTexelSize: { type: 'v2', value: null },\r\n srcTexelSize: { type: 'v2', value: null },\r\n },\r\n\r\n]);\r\n\r\nconst uberOptionNames = [\r\n 'shininess',\r\n 'opacity',\r\n 'zOffset',\r\n 'diffuse',\r\n 'specular',\r\n 'fixedColor',\r\n 'zClipCoef',\r\n 'zClipValue',\r\n 'clipPlaneValue',\r\n 'world2colorMatrix',\r\n 'dashedLineSize',\r\n 'dashedLinePeriod',\r\n 'projMatrixInv',\r\n 'viewport',\r\n 'lineWidth',\r\n 'fogAlpha',\r\n 'samplesKernel',\r\n 'noiseTex',\r\n 'noiseTexelSize',\r\n 'srcTexelSize',\r\n];\r\n\r\n// properties that convert to uniforms\r\nconst uberOptions = {\r\n diffuse: new THREE.Color(0xffffff), // used in phong lighting\r\n specular: new THREE.Color(0x111111), // used in phong lighting\r\n shininess: 30, // used in phong lighting\r\n opacity: 1, // set mesh opacity\r\n fixedColor: new THREE.Color(0xffffff), // color to override (see OVERRIDE_COLOR)\r\n zOffset: 0.0, // used fo zsprites (see SPHERE_SPRITE CYLINDER_SPRITE)\r\n zClipCoef: 2.0, // use for Surfs clipping (mesh param, isn't used in shader) FIXME move to representation param\r\n zClipValue: 0.0, // value to clip Surfs in shader (see ZCLIP)\r\n clipPlaneValue: 0.0, // value to clip scene globally (see CLIPPLANE)\r\n world2colorMatrix: new THREE.Matrix4(),\r\n dashedLineSize: 0.1,\r\n dashedLinePeriod: 0.3,\r\n projMatrixInv: new THREE.Matrix4(),\r\n viewport: new THREE.Vector2(800, 600),\r\n lineWidth: 2.0,\r\n fogAlpha: 1.0,\r\n samplesKernel: _samplesKernel,\r\n noiseTex: noise.noiseTexture,\r\n noiseTexelSize: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight),\r\n srcTexelSize: new THREE.Vector2(1.0 / 800.0, 1.0 / 600.0),\r\n copy(source) {\r\n this.diffuse.copy(source.diffuse);\r\n this.specular.copy(source.specular);\r\n this.shininess = source.shininess;\r\n this.opacity = source.opacity;\r\n this.fixedColor.copy(source.fixedColor);\r\n this.zOffset = source.zOffset;\r\n this.zClipCoef = source.zClipCoef;\r\n this.zClipValue = source.zClipValue;\r\n this.clipPlaneValue = source.clipPlaneValue;\r\n this.world2colorMatrix.copy(source.world2colorMatrix);\r\n this.dashedLineSize = source.dashedLineSize;\r\n this.dashedLinePeriod = source.dashedLinePeriod;\r\n this.projMatrixInv = source.projMatrixInv;\r\n this.viewport = source.viewport;\r\n this.lineWidth = source.lineWidth; // used for thick lines only\r\n this.toonShading = source.toonShading;\r\n this.fogAlpha = source.fogAlpha;\r\n this.samplesKernel = source.samplesKernel;\r\n this.noiseTex = source.noiseTex;\r\n this.noiseTexelSize = source.noiseTexelSize;\r\n this.srcTexelSize = source.srcTexelSize;\r\n },\r\n};\r\n\r\nclass UberMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // add fog\r\n this.fog = true;\r\n // used for instanced geometry\r\n this.instancedPos = false;\r\n this.instancedMatrix = false;\r\n // atoms and links color\r\n this.attrColor = false;\r\n // second link color for cylinders\r\n this.attrColor2 = false;\r\n //\r\n this.attrAlphaColor = false;\r\n // overrides color for all vertices (used in selection)\r\n this.overrideColor = false;\r\n // zsrpites\r\n this.sphereSprite = false;\r\n this.cylinderSprite = false;\r\n // clip Surfs individually\r\n this.zClip = false;\r\n // clip scene with global clip plane\r\n this.clipPlane = false;\r\n // enable fake (chess-like) opacity\r\n this.fakeOpacity = false;\r\n // render only depth, don't take care about the pixel color (used for transparency depth prepass)\r\n this.prepassTransparancy = false;\r\n // used to render pixel positions\r\n this.colorFromPos = false;\r\n // used to render shadowmap\r\n this.shadowmap = false;\r\n // used to describe shadowmap type\r\n this.shadowmapType = 'random';\r\n // used to render pixel view deph\r\n this.colorFromDepth = false;\r\n // mark that rendering is for orthographic camera\r\n this.orthoCam = false;\r\n // used to render dashed line\r\n this.dashedLine = false;\r\n // mark as transparent\r\n this.transparent = true;\r\n // mark as thick lines\r\n this.thickLine = false;\r\n // makes fog begin transparency (required for transparent background)\r\n this.fogTransparent = false;\r\n // used to render surface normals to G buffer for ssao effect\r\n this.normalsToGBuffer = false;\r\n // used for toon material\r\n this.toonShading = false;\r\n\r\n // uber options of \"root\" materials are inherited from single uber-options object that resides in prototype\r\n this.uberOptions = Object.create(UberMaterial.prototype.uberOptions);\r\n\r\n // set default values\r\n super.setValues({\r\n uniforms: THREE.UniformsUtils.clone(defaultUniforms),\r\n vertexShader: this.precisionString() + vertexShader,\r\n fragmentShader: this.precisionString() + fragmentShader,\r\n lights: true,\r\n fog: true,\r\n side: THREE.DoubleSide,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n precisionString() {\r\n const { precision } = capabilities;\r\n const str = `precision ${precision} float;\\n`\r\n + `precision ${precision} int;\\n\\n`;\r\n return str;\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n\r\n this.fragmentShader = source.fragmentShader;\r\n this.vertexShader = source.vertexShader;\r\n\r\n this.uniforms = THREE.UniformsUtils.clone(source.uniforms);\r\n this.defines = { ...source.defines };\r\n this.extensions = source.extensions;\r\n\r\n this.fog = source.fog;\r\n this.instancedPos = source.instancedPos;\r\n this.instancedMatrix = source.instancedMatrix;\r\n this.attrColor = source.attrColor;\r\n this.attrColor2 = source.attrColor2;\r\n this.attrAlphaColor = source.attrAlphaColor;\r\n this.overrideColor = source.overrideColor;\r\n this.sphereSprite = source.sphereSprite;\r\n this.cylinderSprite = source.cylinderSprite;\r\n this.zClip = source.zClip;\r\n this.clipPlane = source.clipPlane;\r\n this.fakeOpacity = source.fakeOpacity;\r\n this.colorFromPos = source.colorFromPos;\r\n this.shadowmap = source.shadowmap;\r\n this.shadowmapType = source.shadowmapType;\r\n this.colorFromDepth = source.colorFromDepth;\r\n this.orthoCam = source.orthoCam;\r\n this.prepassTransparancy = source.prepassTransparancy;\r\n this.dashedLine = source.dashedLine;\r\n this.thickLine = source.thickLine;\r\n this.fogTransparent = source.fogTransparent;\r\n this.normalsToGBuffer = source.normalsToGBuffer;\r\n this.toonShading = source.toonShading;\r\n\r\n this.uberOptions.copy(source.uberOptions);\r\n\r\n return this;\r\n }\r\n\r\n // create copy of this material\r\n // its options are prototyped after this material's options\r\n createInstance() {\r\n const inst = new UberMaterial();\r\n inst.copy(this);\r\n inst.uberOptions = Object.create(this.uberOptions);\r\n return inst;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n const extensions = {};\r\n\r\n if (this.fog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.instancedPos) {\r\n defines.INSTANCED_POS = 1;\r\n }\r\n if (this.instancedMatrix) {\r\n defines.INSTANCED_MATRIX = 1;\r\n }\r\n if (this.attrColor) {\r\n defines.ATTR_COLOR = 1;\r\n }\r\n if (this.attrColor2) {\r\n defines.ATTR_COLOR2 = 1;\r\n }\r\n if (this.attrAlphaColor) {\r\n defines.ATTR_ALPHA_COLOR = 1;\r\n }\r\n if (this.overrideColor) {\r\n defines.OVERRIDE_COLOR = 1;\r\n }\r\n if (this.sphereSprite) {\r\n defines.SPHERE_SPRITE = 1;\r\n extensions.fragDepth = true;\r\n }\r\n if (this.cylinderSprite) {\r\n defines.CYLINDER_SPRITE = 1;\r\n extensions.fragDepth = true;\r\n }\r\n if (this.zClip) {\r\n defines.ZCLIP = 1;\r\n }\r\n if (this.clipPlane) {\r\n defines.CLIP_PLANE = 1;\r\n }\r\n if (this.fakeOpacity) {\r\n defines.FAKE_OPACITY = 1;\r\n }\r\n if (this.lights) {\r\n defines.USE_LIGHTS = 1;\r\n }\r\n if (this.colorFromPos) {\r\n defines.COLOR_FROM_POS = 1;\r\n }\r\n if (this.shadowmap) {\r\n defines.SHADOWMAP = 1;\r\n if (this.shadowmapType === 'pcf') {\r\n defines.SHADOWMAP_PCF_SHARP = 1;\r\n } else if (this.shadowmapType === 'random') {\r\n defines.SHADOWMAP_PCF_RAND = 1;\r\n } else {\r\n defines.SHADOWMAP_BASIC = 1;\r\n }\r\n }\r\n if (this.colorFromDepth) {\r\n defines.COLOR_FROM_DEPTH = 1;\r\n }\r\n if (this.orthoCam) {\r\n defines.ORTHOGRAPHIC_CAMERA = 1;\r\n }\r\n if (this.prepassTransparancy) {\r\n defines.PREPASS_TRANSP = 1;\r\n }\r\n if (this.dashedLine) {\r\n defines.DASHED_LINE = 1;\r\n }\r\n if (this.thickLine) {\r\n defines.THICK_LINE = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n if (this.normalsToGBuffer) {\r\n extensions.drawBuffers = true;\r\n defines.NORMALS_TO_G_BUFFER = 1;\r\n }\r\n if (this.toonShading) {\r\n defines.TOON_SHADING = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n this.extensions = extensions;\r\n }\r\n\r\n setUberOptions(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n for (const key in values) {\r\n if (!values.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n\r\n if (this.uberOptions[key] instanceof THREE.Color) {\r\n this.uberOptions[key] = values[key].clone();\r\n } else {\r\n this.uberOptions[key] = values[key];\r\n }\r\n }\r\n }\r\n\r\n clone(shallow) {\r\n if (!shallow) {\r\n return super.clone();\r\n }\r\n return this.createInstance();\r\n }\r\n\r\n updateUniforms() {\r\n const self = this;\r\n\r\n uberOptionNames.forEach((p) => {\r\n if (self.uniforms.hasOwnProperty(p)) {\r\n if (self.uberOptions[p] instanceof THREE.Color\r\n || self.uberOptions[p] instanceof THREE.Matrix4) {\r\n self.uniforms[p].value = self.uberOptions[p].clone();\r\n } else {\r\n self.uniforms[p].value = self.uberOptions[p];\r\n }\r\n }\r\n });\r\n }\r\n}\r\n\r\nUberMaterial.prototype.uberOptions = uberOptions;\r\n\r\nexport default UberMaterial;\r\n","import UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default function (SuperClass) {\r\n class NewObjectType extends SuperClass {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.onBeforeRender = NewObjectType.prototype.onBeforeRender;\r\n }\r\n\r\n onBeforeRender(renderer, scene, camera, geometry, material, group) {\r\n this._onBeforeRender(renderer, scene, camera, geometry, material, group);\r\n this._update();\r\n }\r\n\r\n _onBeforeRender() {\r\n }\r\n\r\n _update() {\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material instanceof UberMaterial) {\r\n material.updateUniforms();\r\n }\r\n }\r\n }\r\n\r\n return NewObjectType;\r\n}\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZSpriteMesh extends Mesh {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material.uniforms.invModelViewMatrix) {\r\n // NOTE: update of modelViewMatrix inside threejs is done after onBeforeRender call,\r\n // so we have to do it manually in that place\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n // get inverse matrix\r\n material.uniforms.invModelViewMatrix.value.copy(this.modelViewMatrix).invert();\r\n material.uniforms.nearPlaneValue.value = camera.near;\r\n material.uniformsNeedUpdate = true;\r\n }\r\n }\r\n}\r\n\r\nexport default ZSpriteMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZClippedMesh extends Mesh {\r\n constructor(geometry, material) {\r\n super(geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n\r\n static _mvLength = new THREE.Vector3();\r\n\r\n static _center = new THREE.Vector3();\r\n\r\n static _modelView = new THREE.Matrix4();\r\n\r\n _onBeforeRender(renderer, scene, camera) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n\r\n const geo = this.geometry;\r\n const { material } = this;\r\n if (!geo.zClip || !material.uberOptions) {\r\n return;\r\n }\r\n\r\n const zClipCoef = 0.5;\r\n\r\n const modelView = ZClippedMesh._modelView;\r\n const mvLength = ZClippedMesh._mvLength;\r\n const center = ZClippedMesh._center;\r\n\r\n modelView.multiplyMatrices(this.matrixWorld, camera.matrixWorldInverse);\r\n const s = mvLength.setFromMatrixColumn(modelView, 0).length();\r\n center.copy(geo.boundingSphere.center);\r\n\r\n this.localToWorld(center);\r\n material.uberOptions.zClipValue = camera.position.z - center.z\r\n - s * (zClipCoef * geo.boundingSphere.radius);\r\n }\r\n}\r\n\r\nexport default ZClippedMesh;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from '../CSS2DObject';\r\nimport utils from '../../utils';\r\n\r\nclass TextMesh extends THREE.Group {\r\n constructor(geometry, _material) {\r\n super();\r\n this.geometry = geometry;\r\n\r\n const self = this;\r\n self.initialized = false;\r\n this.geometry.addEventListener('update', () => {\r\n self.update();\r\n });\r\n }\r\n\r\n init() {\r\n const { children } = this;\r\n for (let i = children.length - 1; i >= 0; --i) {\r\n this.remove(children[i]);\r\n }\r\n\r\n const { items, userData } = this.geometry;\r\n for (let i = 0, n = items.length; i < n; ++i) {\r\n const srcItem = items[i];\r\n if (!srcItem) {\r\n continue;\r\n }\r\n const item = utils.shallowCloneNode(srcItem);\r\n const label = new CSS2DObject(item);\r\n label.userData = _.clone(userData);\r\n const el = label.getElement();\r\n el.style.visibility = 'visible';\r\n label.source = srcItem;\r\n this.add(label);\r\n }\r\n this.initialized = true;\r\n }\r\n\r\n update() {\r\n const geo = this.geometry;\r\n if (!geo.needsUpdate) {\r\n return;\r\n }\r\n const { children } = this;\r\n if (!this.initialized) {\r\n this.init();\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n const item = child.source;\r\n child.position.copy(item.worldPos);\r\n child.userData.color = item.opts.color;\r\n child.userData.background = item.opts.background;\r\n }\r\n }\r\n}\r\n\r\nexport default TextMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass SimpleMesh extends Mesh {\r\n constructor(geometry, material) {\r\n super(geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n}\r\n\r\nexport default SimpleMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\nconst _viewport = new THREE.Vector2();\r\n\r\nclass ThickLineMesh extends Mesh {\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!material.uberOptions) {\r\n return;\r\n }\r\n\r\n material.uberOptions.projMatrixInv.copy(camera.projectionMatrix).invert();\r\n renderer.getSize(_viewport);\r\n material.uberOptions.viewport.set(_viewport.width, _viewport.height);\r\n }\r\n}\r\n\r\nexport default ThickLineMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass InstancedMesh extends Mesh {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n}\r\n\r\nexport default InstancedMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\nimport ZSpriteMesh from './ZSpriteMesh';\r\nimport ZClippedMesh from './ZClippedMesh';\r\nimport TextMesh from './TextMesh';\r\nimport SimpleMesh from './SimpleMesh';\r\nimport ThickLineMesh from './ThickLineMesh';\r\nimport InstancedMesh from './InstancedMesh';\r\n\r\nexport default {\r\n ZClipped: ZClippedMesh,\r\n ZSprite: ZSpriteMesh,\r\n Text: TextMesh,\r\n Line: UberObject(THREE.Line),\r\n LineSegments: UberObject(THREE.LineSegments),\r\n Mesh: SimpleMesh,\r\n ThickLineMesh,\r\n Instanced: InstancedMesh,\r\n};\r\n","import geometries from '../geometries/geometries';\r\nimport meshes from './meshes';\r\nimport ThickLinesGeometry from '../geometries/ThickLinesGeometry';\r\n\r\nfunction setMatParams(params, uniforms) {\r\n return function (material) {\r\n material.setValues(params);\r\n material.setUberOptions(uniforms);\r\n };\r\n}\r\n\r\nfunction _createInstancedCylinders(useZSprites, openEnded) {\r\n function Geometry(a, b) {\r\n return new geometries.Instanced2CCylindersGeometry(a, b, useZSprites, openEnded);\r\n }\r\n return {\r\n Geometry,\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedMatrix: true,\r\n attrColor: true,\r\n attrColor2: true,\r\n attrAlphaColor: true,\r\n cylinderSprite: useZSprites,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createLineSegmentsGeoTriplet(geo, renderParams) {\r\n const thickLines = geo.prototype instanceof ThickLinesGeometry;\r\n const lineWidth = renderParams.lineWidth || 0;\r\n return {\r\n Geometry: geo,\r\n Object: thickLines ? meshes.ThickLineMesh : meshes.LineSegments,\r\n initMaterial: setMatParams({\r\n lights: false,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n thickLine: thickLines,\r\n }, {\r\n lineWidth,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createSimpleGeoTriplet(geoClass) {\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.Mesh,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createIsoSurfaceGeoTriplet(geoClass, caps, settings, renderParams) {\r\n const surfaceOpts = {\r\n wireframe: !!renderParams.wireframe,\r\n fakeOpacity: settings.now.isoSurfaceFakeOpacity,\r\n zClip: renderParams.zClip,\r\n };\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.ZClipped,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: false,\r\n wireframe: surfaceOpts.wireframe,\r\n fakeOpacity: surfaceOpts.fakeOpacity,\r\n zClip: surfaceOpts.zClip,\r\n }),\r\n };\r\n}\r\n\r\nclass MeshCreator {\r\n static createSpheres(caps, settings) {\r\n const useZSprites = settings.now.zSprites;\r\n function Geometry(a, b) {\r\n return new geometries.InstancedSpheresGeometry(a, b, useZSprites);\r\n }\r\n return {\r\n Geometry,\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedPos: true,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n sphereSprite: useZSprites,\r\n }),\r\n };\r\n }\r\n\r\n static create2CClosedCylinders(_caps, _settings) {\r\n return _createInstancedCylinders(false, false);\r\n }\r\n\r\n static create2CCylinders(caps, settings) {\r\n return _createInstancedCylinders(settings.now.zSprites, true);\r\n }\r\n\r\n static create2CLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.TwoColorLinesGeometry, renderParams);\r\n }\r\n\r\n static createCrosses(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.CrossGeometry, renderParams);\r\n }\r\n\r\n static createExtrudedChains(_caps, _settings) {\r\n return _createSimpleGeoTriplet(geometries.ExtrudedObjectsGeometry);\r\n }\r\n\r\n static createChunkedLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.ChunkedLinesGeometry, renderParams);\r\n }\r\n\r\n static createQuickSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.QuickSurfGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createContactSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.ContactSurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createSASSES(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.SSIsosurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createLabels(_caps, _settings) {\r\n return {\r\n Geometry: geometries.LabelsGeometry,\r\n Object: meshes.Text,\r\n initMaterial() {\r\n },\r\n };\r\n }\r\n}\r\n\r\nexport default MeshCreator;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../gfxutils';\r\n\r\nclass TransformGroup extends THREE.Object3D {\r\n static _inverseMatrix = new THREE.Matrix4();\r\n\r\n static _ray = new THREE.Ray();\r\n\r\n constructor(geometry, geoParams, material, transforms) {\r\n super();\r\n this._geometry = geometry;\r\n this._geoParams = geoParams;\r\n const mat = material.createInstance();\r\n geoParams.initMaterial(mat);\r\n this._material = mat;\r\n this._transforms = transforms.length > 0 ? transforms : [new THREE.Matrix4()];\r\n const meshes = this._createMeshes(geometry);\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n this.add(meshes[i]);\r\n }\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const ray = TransformGroup._ray;\r\n const inverseMatrix = TransformGroup._inverseMatrix;\r\n const { children } = this;\r\n ray.copy(raycaster.ray);\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n\r\n if (!gfxutils.belongToSelectLayers(child)) {\r\n continue;\r\n }\r\n\r\n child.updateMatrixWorld();\r\n const mtx = child.matrixWorld;\r\n inverseMatrix.copy(mtx).invert();\r\n raycaster.ray.copy(ray).applyMatrix4(inverseMatrix);\r\n const childIntersects = [];\r\n this._geometry.raycast(raycaster, childIntersects);\r\n\r\n for (let j = 0, ciCount = childIntersects.length; j < ciCount; ++j) {\r\n const inters = childIntersects[j];\r\n if (inters.point) {\r\n inters.point.applyMatrix4(mtx);\r\n inters.distance = ray.origin.distanceTo(inters.point);\r\n }\r\n inters.object = child;\r\n intersects[intersects.length] = inters;\r\n }\r\n }\r\n raycaster.ray.copy(ray);\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const geos = this._geometry.getSubset(chunkIndices);\r\n const subset = [];\r\n let subIdx = 0;\r\n\r\n for (let i = 0, n = geos.length; i < n; ++i) {\r\n const meshes = this._createMeshes(geos[i]);\r\n for (let j = 0, meshCnt = meshes.length; j < meshCnt; ++j) {\r\n subset[subIdx++] = meshes[j];\r\n }\r\n }\r\n\r\n return subset;\r\n }\r\n\r\n _createMeshes(geometry) {\r\n const transforms = this._transforms;\r\n const Mesh = this._geoParams.Object;\r\n const material = this._material;\r\n const meshes = [];\r\n for (let i = 0, n = transforms.length; i < n; ++i) {\r\n const mesh = new Mesh(geometry, material);\r\n mesh.applyMatrix4(transforms[i]);\r\n meshes[i] = mesh;\r\n }\r\n\r\n return meshes;\r\n }\r\n}\r\n\r\nexport default TransformGroup;\r\n","import RCGroup from '../../RCGroup';\r\nimport TransformGroup from '../../meshes/TransformGroup';\r\n\r\nfunction wrapper(Name, args) {\r\n const params = [Name].concat(args);\r\n return Name.bind(...params);\r\n}\r\n\r\nclass ChemGroup extends RCGroup {\r\n constructor(geoParams, selection, colorer, mode, transforms, polyComplexity, material) {\r\n super();\r\n if (this.constructor === ChemGroup) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n this._selection = selection;\r\n this._mode = mode;\r\n this._colorer = colorer;\r\n this._chunksIdc = selection.chunks;\r\n this._polyComplexity = polyComplexity;\r\n this._geo = new (wrapper(geoParams.Geometry, this._makeGeoArgs()))();\r\n this._mesh = new TransformGroup(this._geo, geoParams, material, transforms);\r\n this.add(this._mesh);\r\n this._build();\r\n }\r\n\r\n _makeGeoArgs() {\r\n throw new Error('ChemGroup subclass must override _makeGeoArgs() method');\r\n }\r\n\r\n /**\r\n * Builds subset geometry by ATOMS index list\r\n *\r\n * @param {Number} mask - Representation mask\r\n * @param {Boolean} innerOnly - if true returns inner bonds only - without halves\r\n * @returns {Array} Subset geometry\r\n */\r\n getSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : false;\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return [];\r\n }\r\n return this._mesh.getSubset(chunksList);\r\n }\r\n\r\n _changeSubsetOpacity(mask, value, innerOnly) {\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return;\r\n }\r\n this._geo.setOpacity(chunksList, value);\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 1.0, innerOnly);\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 0.0, innerOnly);\r\n }\r\n}\r\n\r\nexport default ChemGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass AtomsGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { atoms } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const atomsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const atomIdx = atomsIdc[inters[i].chunkIdx];\r\n if (atomIdx < atoms.length) {\r\n inters[i].atom = atoms[atomIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { atoms } = this._selection;\r\n const atomsIdc = this._chunksIdc;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n if ((atom.mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default AtomsGroup;\r\n","import AtomsGroup from './AtomsGroup';\r\n\r\nclass AtomsSphereGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, atom.position, mode.calcAtomRadius(atom));\r\n geo.setColor(i, colorer.getAtomColor(atom, parent));\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), mode.calcAtomRadius(atom));\r\n if (updateColor) {\r\n geo.setColor(i, frameData.getAtomColor(colorer, atom));\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsSphereGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSurfaceGroup extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n return [n, opts];\r\n }\r\n}\r\nexport default AtomsSurfaceGroup;\r\n","/* This is a stub class keep it until SAS/SES is refactored */\r\n\r\nimport AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSASSESGroupStub extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n opts.selection = this._selection;\r\n opts.colorMode = this._colorer;\r\n return [n, opts];\r\n }\r\n}\r\n\r\nexport default AtomsSASSESGroupStub;\r\n","import AtomsGroup from './AtomsGroup';\r\nimport utils from '../../../utils';\r\n\r\nfunction adjustColor(color) {\r\n let r = (color >> 16) & 255;\r\n let g = (color >> 8) & 255;\r\n let b = color & 255;\r\n\r\n if (0.2126 * r + 0.7152 * g + 0.0722 * b > 127) {\r\n r = r * 3 / 10;\r\n g = g * 3 / 10;\r\n b = b * 3 / 10;\r\n } else {\r\n r = 255 - ((255 - r) * 3 / 10);\r\n g = 255 - ((255 - g) * 3 / 10);\r\n b = 255 - ((255 - b) * 3 / 10);\r\n }\r\n\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\nfunction inverseColor(color) {\r\n const r = (color >> 16) & 255;\r\n const g = (color >> 8) & 255;\r\n const b = color & 255;\r\n\r\n return ((255 - r) << 16) | ((255 - g) << 8) | (255 - b);\r\n}\r\n\r\nfunction getAtomText(atom) {\r\n if (atom.name.getNode() !== null) {\r\n return atom.name.getNode();\r\n }\r\n\r\n return atom.getVisualName();\r\n}\r\n\r\nconst colorMappings = {\r\n none(c) {\r\n return c;\r\n },\r\n adjust: adjustColor,\r\n inverse: inverseColor,\r\n};\r\n\r\nfunction propagateColor(color, rule) {\r\n let result;\r\n if (colorMappings.hasOwnProperty(rule)) {\r\n result = utils.hexColor(colorMappings[rule](color));\r\n } else {\r\n const val = parseInt(rule, 16);\r\n if (!Number.isNaN(val) && rule.toLowerCase().startsWith('0x')) {\r\n result = utils.hexColor(val);\r\n } else {\r\n result = '#000000';\r\n }\r\n }\r\n return result;\r\n}\r\n\r\nconst templateMappings = {\r\n serial(a) {\r\n return a.serial;\r\n },\r\n name(a) {\r\n return a.getVisualName();\r\n },\r\n elem(a) {\r\n return a.element.name;\r\n },\r\n residue(a) {\r\n return a.residue.getType().getName();\r\n },\r\n sequence(a) {\r\n return a.residue.getSequence();\r\n },\r\n chain(a) {\r\n return a.residue.getChain().getName();\r\n },\r\n hetatm(a) {\r\n return a.isHet();\r\n },\r\n water(a) {\r\n return a.residue.getType().getName() === 'HOH' || a.residue.getType().getName() === 'WAT';\r\n },\r\n};\r\n\r\nconst parseTemplate = function (atom, str) {\r\n return str.replace(/\\{\\{(\\s*\\w+\\s*)\\}\\}/g, (m) => {\r\n let key = m.replace(/\\s+/g, '');\r\n key = key.substring(2, key.length - 2).toLowerCase();\r\n\r\n if (templateMappings.hasOwnProperty(key)) {\r\n return templateMappings[key](atom);\r\n }\r\n return 'null';\r\n });\r\n};\r\n\r\nclass AtomsTextGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n const opts = this._mode.getLabelOpts();\r\n return [this._selection.chunks.length, opts];\r\n }\r\n\r\n _build() {\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = colorer.getAtomColor(atom, parent);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, atom.position, text);\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = frameData.getAtomColor(colorer, atom);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), text);\r\n if (updateColor) {\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsTextGroup;\r\n","import * as THREE from 'three';\r\nimport AtomsGroup from './AtomsGroup';\r\n\r\nfunction _slerp(omega, v1, v2, t) {\r\n const oSin = Math.sin(omega);\r\n return v1.clone().multiplyScalar(Math.sin((1 - t) * omega) / oSin).addScaledVector(v2, Math.sin(t * omega) / oSin);\r\n}\r\n\r\nclass AromaticGroup extends AtomsGroup {\r\n _buildInner(radOffset, addChunk) {\r\n const chunksToIdx = this._selection.chunks;\r\n\r\n const prevVector = new THREE.Vector3();\r\n const currVector = new THREE.Vector3();\r\n const segmentsHeight = this._segmentsHeight;\r\n const leprStep = 1.0 / segmentsHeight;\r\n const colorer = this._colorer;\r\n\r\n const { cycles, parent } = this._selection;\r\n let chunkIdx = 0;\r\n let currAtomIdx = chunksToIdx[chunkIdx];\r\n\r\n for (let cIdx = 0, cCount = cycles.length; cIdx < cCount; ++cIdx) {\r\n const cycle = cycles[cIdx];\r\n const cycAtoms = cycle.atoms;\r\n const chunkPoints = [];\r\n const tmpDir = [];\r\n const { center } = cycle;\r\n const cycleRad = cycle.radius - radOffset;\r\n const n = cycAtoms.length;\r\n let i = 0;\r\n const prevPos = cycAtoms[n - 1].position;\r\n let currPos = cycAtoms[i].position;\r\n prevVector.subVectors(prevPos, center);\r\n currVector.subVectors(currPos, center);\r\n const upDir = currVector.clone().cross(prevVector).normalize();\r\n\r\n for (; i < n; ++i) {\r\n const omega = prevVector.angleTo(currVector);\r\n tmpDir[i] = _slerp(omega, prevVector, currVector, 0.5).normalize();\r\n currPos = cycAtoms[(i + 1) % n].position;\r\n prevVector.copy(currVector);\r\n currVector.subVectors(currPos, center);\r\n }\r\n\r\n for (i = 0; i < n; ++i) {\r\n if (cycAtoms[i].index !== currAtomIdx) {\r\n continue;\r\n }\r\n const start = tmpDir[i];\r\n const end = tmpDir[(i + 1) % n];\r\n const color = colorer.getAtomColor(cycAtoms[i], parent);\r\n const currAngle = start.angleTo(end);\r\n\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n chunkPoints[j] = _slerp(currAngle, start, end, j * leprStep).multiplyScalar(cycleRad).add(center);\r\n }\r\n\r\n addChunk(chunkIdx++, color, chunkPoints, center, upDir);\r\n currAtomIdx = chunksToIdx[chunkIdx];\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default AromaticGroup;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../../gfxutils';\r\nimport AromaticGroup from './AromaticGroup';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n for (let i = 0; i < parts; ++i) {\r\n const a = -2 * i / parts * Math.PI;\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\nconst { calcChunkMatrix } = gfxutils;\r\n\r\nclass AromaticTorusGroup extends AromaticGroup {\r\n _build() {\r\n const segmentsHeight = this._segmentsHeight;\r\n const torusRad = this._mode.getAromRadius();\r\n const radiusV = new THREE.Vector2(torusRad, torusRad);\r\n const radOffset = this._mode.calcStickRadius() + 2 * torusRad;\r\n const lookAtVector = new THREE.Vector3();\r\n const mtc = [];\r\n const geo = this._geo;\r\n this._buildInner(radOffset, (chunkIdx, color, points, center, upDir) => {\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n const currDir = currPoint.clone().sub(center).cross(upDir);\r\n lookAtVector.addVectors(currPoint, currDir);\r\n mtc[j] = calcChunkMatrix(currPoint, lookAtVector, upDir, radiusV);\r\n }\r\n geo.setItem(chunkIdx, mtc);\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._polyComplexity;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length];\r\n }\r\n}\r\n\r\nexport default AromaticTorusGroup;\r\n","import AromaticGroup from './AromaticGroup';\r\n\r\nclass AromaticLinesGroup extends AromaticGroup {\r\n _build() {\r\n const geo = this._geo;\r\n const radOffset = this._mode.getAromaticOffset();\r\n this._buildInner(radOffset, (chunkIdx, color, points) => {\r\n let prevPt = points[0];// do not replace with start\r\n for (let j = 1; j <= this._segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n geo.setSegment(chunkIdx, j - 1, prevPt, currPoint);\r\n prevPt = currPoint;\r\n }\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._mode.getAromaticArcChunks();\r\n return [this._selection.chunks.length, this._segmentsHeight, true];\r\n }\r\n}\r\n\r\nexport default AromaticLinesGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[inters[i].chunkIdx];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesGroup;\r\n","import ResiduesGroup from './ResiduesGroup';\r\n\r\nclass NucleicItemGroup extends ResiduesGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[Math.floor(inters[i].chunkIdx / 2)];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n let chunkIdx = 0;\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList[chunkIdx++] = 2 * i;\r\n chunksList[chunkIdx++] = 2 * i + 1;\r\n }\r\n }\r\n return chunksList;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finishUpdate();\r\n }\r\n}\r\n\r\nexport default NucleicItemGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicCylindersGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n geo.setItem(chunkIdx, cyl1, cyl2, stickRad);\r\n geo.setColor(chunkIdx, color, color);\r\n }\r\n}\r\n\r\nexport default NucleicCylindersGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicSpheresGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length * 2, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n let idx = chunkIdx * 2;\r\n geo.setItem(idx, cyl1, stickRad);\r\n geo.setColor(idx, color);\r\n idx++;\r\n geo.setItem(idx, cyl2, stickRad);\r\n geo.setColor(idx, color);\r\n }\r\n}\r\n\r\nexport default NucleicSpheresGroup;\r\n","import * as THREE from 'three';\r\nimport { Smooth } from '../../../../vendor/js/Smooth';\r\nimport gfxutils from '../../gfxutils';\r\nimport chem from '../../../chem';\r\n\r\nconst { ResidueType } = chem;\r\n\r\nconst calcMatrix = gfxutils.calcChunkMatrix;\r\n\r\nfunction _buildStructureInterpolator(points, tension) {\r\n const path = Smooth(points, {\r\n method: Smooth.METHOD_CUBIC,\r\n clip: Smooth.CLIP_CLAMP,\r\n cubicTension: tension,\r\n scaleTo: 1,\r\n });\r\n\r\n return function (t, argTrans) {\r\n let transformT = argTrans;\r\n if (transformT === null) {\r\n // map our range to the [second .. last but one]\r\n transformT = function (tt) {\r\n return (tt * ((points.length - 1) - 2) + 1) / (points.length - 1);\r\n };\r\n }\r\n const newt = transformT(t);\r\n const ans = path(newt);\r\n return new THREE.Vector3(ans[0], ans[1], ans[2]);\r\n };\r\n}\r\n\r\nfunction _addPoints(centerPoints, topPoints, idx, residue) {\r\n if (!residue._isValid) {\r\n centerPoints[idx] = centerPoints[idx - 1];\r\n topPoints[idx] = topPoints[idx - 1];\r\n return;\r\n }\r\n const cp = residue._controlPoint;\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n const tp = cp.clone().add(residue._wingVector);\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n}\r\n\r\nfunction _addPointsForLoneResidue(centerPoints, topPoints, idx, residue) {\r\n const nucleic = (residue._type.flags & ResidueType.Flags.NUCLEIC) !== 0;\r\n const nameFrom = nucleic ? 'C5\\'' : 'N';\r\n const nameTo = nucleic ? 'C3\\'' : 'C';\r\n\r\n let posFrom;\r\n let posTo;\r\n residue.forEachAtom((atom) => {\r\n const name = atom.getVisualName();\r\n if (!posFrom && name === nameFrom) {\r\n posFrom = atom.position;\r\n } else if (!posTo && name === nameTo) {\r\n posTo = atom.position;\r\n }\r\n });\r\n\r\n // provide a fallback for unknown residues\r\n if (!(posFrom && posTo)) {\r\n posFrom = residue._firstAtom.position;\r\n posTo = residue._lastAtom.position;\r\n }\r\n\r\n if (posFrom && posTo) {\r\n const shift = posTo.clone().sub(posFrom);\r\n\r\n const wing = residue._wingVector;\r\n const cp = residue._controlPoint;\r\n const tp = cp.clone().add(wing);\r\n\r\n const cpPrev = cp.clone().sub(shift);\r\n const tpPrev = cpPrev.clone().add(wing);\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n ++idx;\r\n\r\n const cpNext = cp.clone().add(shift);\r\n const tpNext = cpNext.clone().add(wing);\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n ++idx;\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n }\r\n}\r\n\r\nfunction _calcPoints(residues, firstIdx, lastIdx, boundaries) {\r\n const left = boundaries.start;\r\n const right = boundaries.end;\r\n function _prevIdx(idx) {\r\n return idx > left && residues[idx - 1]._isValid ? idx - 1 : idx;\r\n }\r\n function _nextIdx(idx) {\r\n return idx < right && residues[idx + 1]._isValid ? idx + 1 : idx;\r\n }\r\n\r\n const topPoints = [];\r\n const centerPoints = [];\r\n let arrIdx = 0;\r\n function _extrapolate2(currIdx, otherIdx) {\r\n const cp = residues[currIdx]._controlPoint.clone().lerp(residues[otherIdx]._controlPoint, -0.25);\r\n const tp = cp.clone().add(residues[currIdx]._wingVector);\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n }\r\n\r\n // a single disconnected residue\r\n const prevIdx = _prevIdx(firstIdx);\r\n const nextIdx = _nextIdx(lastIdx);\r\n if (prevIdx === nextIdx) {\r\n _addPointsForLoneResidue(centerPoints, topPoints, arrIdx, residues[firstIdx]);\r\n return { centerPoints, topPoints };\r\n }\r\n\r\n // Two points (prev-prev and next-next) are added to support edge conditions for cubic splines, they are ignored\r\n // Another two (prev and next) were added to support the outside of the sub chain\r\n\r\n // prev and prev-prev\r\n if (firstIdx === prevIdx) {\r\n // do the extrapolation\r\n _extrapolate2(firstIdx, _nextIdx(firstIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[_prevIdx(prevIdx)]);\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[prevIdx]);\r\n }\r\n\r\n // main loop\r\n for (let idx = firstIdx; idx <= lastIdx; ++idx) {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[idx]);\r\n }\r\n\r\n // next and next-next\r\n if (nextIdx === _nextIdx(nextIdx)) {\r\n // do the extrapolation\r\n _extrapolate2(lastIdx, _prevIdx(lastIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[nextIdx]);\r\n _addPoints(centerPoints, topPoints, arrIdx, residues[_nextIdx(nextIdx)]);\r\n }\r\n return { centerPoints, topPoints };\r\n}\r\n\r\nclass CartoonHelper {\r\n constructor(residues, startIdx, endIdx, segmentsCount, tension, boundaries) {\r\n const pointsArrays = _calcPoints(residues, startIdx, endIdx, boundaries);\r\n this._topInterp = _buildStructureInterpolator(pointsArrays.topPoints, tension);\r\n this._centerInterp = _buildStructureInterpolator(pointsArrays.centerPoints, tension);\r\n\r\n this._shift = 0.5 / (endIdx - startIdx + 2);\r\n this._valueStep = (1.0 - 2 * this._shift) / (2 * (endIdx - startIdx + 1) * (segmentsCount - 1));\r\n this._segmentsCount = segmentsCount;\r\n }\r\n\r\n prepareMatrices(idx, firstRad, secondRad) {\r\n const mtcCount = this._segmentsCount;\r\n const outMtc = new Array(mtcCount);\r\n const currRad = new THREE.Vector2(0, 0);\r\n\r\n const topInterp = this._topInterp;\r\n const cenInterp = this._centerInterp;\r\n\r\n let currentValue = this._shift + this._valueStep * (mtcCount - 1) * idx;\r\n\r\n for (let mtxIdx = 0; mtxIdx < mtcCount; ++mtxIdx) {\r\n const lerpVal = Math.min(1.0, mtxIdx / (mtcCount - 1));\r\n currRad.lerpVectors(firstRad, secondRad, lerpVal);\r\n\r\n const currTop = topInterp(currentValue, null);\r\n const currCenter = cenInterp(currentValue, null);\r\n currentValue += this._valueStep;\r\n const nextCenter = cenInterp(currentValue, null);\r\n\r\n outMtc[mtxIdx] = calcMatrix(currCenter.clone(), nextCenter.clone(), currTop.clone().sub(currCenter), currRad);\r\n }\r\n\r\n return outMtc;\r\n }\r\n}\r\n\r\nexport default CartoonHelper;\r\n","import * as THREE from 'three';\r\nimport ResiduesGroup from './ResiduesGroup';\r\nimport CartoonHelper from './CartoonHelper';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n\r\n for (let i = 0; i < parts; ++i) {\r\n // starts from pi/2 because it's important that points are lied on the angles of arrows (visual issues if not)\r\n const a = Math.PI / 2.0 - 2 * Math.PI * i / parts;\r\n\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\n\r\nfunction _loopThrough(subDiv, residues, segmentsHeight, tension, mode, callback) {\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n const { boundaries } = subDiv[subDivI];\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const idc = [subs[i].start, subs[i].end];\r\n const matrixHelper = new CartoonHelper(residues, idc[0], idc[1], segmentsHeight, tension, boundaries);\r\n let prevLast = null;\r\n const startIdx = subs[i].start * 2;\r\n const endIdx = subs[i].end * 2 + 1;\r\n let prevSecondRad = mode.getResidueRadius(residues[0], 0);\r\n for (let idx = startIdx; idx <= endIdx; ++idx) {\r\n const resIdx = (idx / 2 | 0);\r\n const currRes = residues[resIdx];\r\n const firstRad = mode.getResidueRadius(currRes, idx % 2);\r\n const secondRad = mode.getResidueRadius(currRes, 1 + (idx % 2));\r\n\r\n const mtc = matrixHelper.prepareMatrices(idx - idc[0] * 2, firstRad, secondRad);\r\n mtc.unshift(prevLast === null ? mtc[0] : prevLast);\r\n\r\n // Slope - radius is changed along this residue part\r\n const hasSlope = (firstRad.x !== secondRad.x) || (firstRad.y !== secondRad.y);\r\n // Cut - end radius of previous part not equal to start radius of this part. First section of this part lies in the orthogonal plane\r\n const hasCut = (firstRad.x !== prevSecondRad.x) || (firstRad.y !== prevSecondRad.y);\r\n\r\n callback(currRes, mtc, hasSlope, hasCut);\r\n\r\n prevLast = mtc[segmentsHeight];\r\n prevSecondRad = secondRad;\r\n }\r\n }\r\n }\r\n}\r\n\r\nclass ResiduesSubseqGroup extends ResiduesGroup {\r\n _makeGeoArgs() {\r\n const cmpMultiplier = this._mode.getHeightSegmentsRatio();\r\n this._segmentsHeight = this._polyComplexity * cmpMultiplier | 0;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length * 2];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n _loopThrough(this._selection.subdivs, residues, this._segmentsHeight, tension, mode, (currRes, mtc, hasSlope = false, hasCut = false) => {\r\n const color = colorer.getResidueColor(currRes, parent);\r\n chunkIdc[chunkIdx] = currRes._index;\r\n geo.setItem(chunkIdx, mtc, hasSlope, hasCut);\r\n geo.setColor(chunkIdx++, color);\r\n });\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n const frameRes = frameData.getResidues();\r\n let chunkIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n _loopThrough(this._selection.subdivs, frameRes, this._segmentsHeight, tension, mode, (currRes, mtc) => {\r\n geo.setItem(chunkIdx, mtc);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n });\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default ResiduesSubseqGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesTraceGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const subDiv = this._selection.subdivs;\r\n let chunksCount = 0;\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n chunksCount += subs[i].end - subs[i].start;\r\n }\r\n }\r\n return [chunksCount, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n chunkIdc[chunkIdx] = { first: prevRes._index, second: currRes._index };\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n geo.finalize();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n const { residues } = this._selection;\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksToIdx = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const chunk = chunksToIdx[Math.floor(chunkIdx / 2)];\r\n const resIdx = chunkIdx % 2 === 0 ? chunk.first : chunk.second;\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const chunksToIdx = this._chunksIdc;\r\n const { residues } = this._selection;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const chunk = chunksToIdx[i];\r\n if (residues[chunk.first]._mask & mask) {\r\n chunksList.push(i * 2);\r\n }\r\n if (residues[chunk.second]._mask & mask) {\r\n chunksList.push(i * 2 + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesTraceGroup;\r\n","import ChemGroup from './ChemGroup';\r\nimport Bond from '../../../chem/Bond';\r\n\r\nfunction getCylinderCount(bondOrder) {\r\n return bondOrder < 2 ? 1 : bondOrder;\r\n}\r\n\r\nclass BondsGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const drawMultiple = this._mode.drawMultiorderBonds();\r\n const showAromatic = this._mode.showAromaticLoops();\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n let bondsCount = 0;\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n bondsCount += this.getBondOrder(bonds[bondsIdc[i]], drawMultiple, showAromatic);\r\n }\r\n return [bondsCount, this._polyComplexity];\r\n }\r\n\r\n getBondOrder(bond, drawMultiple, showAromatic) {\r\n let bondOrder = 1;\r\n if (drawMultiple && (!showAromatic || bond._type !== Bond.BondType.AROMATIC)) {\r\n bondOrder = getCylinderCount(bond._order);\r\n }\r\n return bondOrder;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const { bonds } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const bondsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const bondIdx = bondsIdc[Math.floor(chunkIdx / 2)];\r\n if (bondIdx < bonds.length) {\r\n const bond = bonds[bondIdx];\r\n inters[i].atom = chunkIdx % 2 === 0 ? bond._left : bond._right;\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask, innerOnly) {\r\n const chunksList = [];\r\n const { bonds } = this._selection;\r\n const chunksToIdx = this._chunksIdc;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const bond = bonds[chunksToIdx[i]];\r\n if ((bond._left.mask & mask) && (!innerOnly || (bond._right.mask & mask))) {\r\n chunksList.push(2 * i);\r\n }\r\n if ((bond._right.mask & mask) && (!innerOnly || (bond._left.mask & mask))) {\r\n chunksList.push(2 * i + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default BondsGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nclass BondsCylinderGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsCylinderGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nconst STEP_SIZE = 0.15;\r\n\r\nclass BondsLinesGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsLinesGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\nimport AtomsSurfaceGroup from './AtomsSurfaceGroup';\r\nimport AtomsSASSESGroupStub from './AtomsSASSESGroupStub';\r\nimport AtomsTextGroup from './AtomsTextGroup';\r\nimport AromaticTorusGroup from './AromaticTorusGroup';\r\nimport AromaticLinesGroup from './AromaticLinesGroup';\r\nimport NucleicCylindersGroup from './NucleicCylindersGroup';\r\nimport NucleicSpheresGroup from './NucleicSpheresGroup';\r\nimport ResiduesSubseqGroup from './ResiduesSubseqGroup';\r\nimport ResiduesTraceGroup from './ResiduesTraceGroup';\r\nimport BondsCylinderGroup from './BondsCylinderGroup';\r\nimport BondsLinesGroup from './BondsLinesGroup';\r\n\r\nexport default {\r\n AtomsSphereGroup,\r\n AtomsSurfaceGroup,\r\n AtomsSASSESGroupStub,\r\n AtomsTextGroup,\r\n AromaticTorusGroup,\r\n AromaticLinesGroup,\r\n NucleicCylindersGroup,\r\n NucleicSpheresGroup,\r\n ResiduesSubseqGroup,\r\n ResiduesTraceGroup,\r\n BondsCylinderGroup,\r\n BondsLinesGroup,\r\n};\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AtomsProcessor extends RCGroup {\r\n constructor(AtomsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n this._mode = mode;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let atomCount = 0;\r\n component.forEachAtom((atom) => {\r\n if (!self._checkAtom(atom, mask)) {\r\n return;\r\n }\r\n atomsIdc[atomCount++] = atom.index;\r\n });\r\n if (atomCount === 0) {\r\n return;\r\n }\r\n const atomsGroup = new AtomsGroup(geoParams, {\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n _checkAtom(atom, mask) {\r\n return atom.mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AtomsProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\n\r\nclass OrphanAtomsProcessor extends AtomsProcessor {\r\n _checkAtom(atom, mask) {\r\n if (!(atom.mask & mask)) {\r\n return false;\r\n }\r\n\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n if ((bonds[i]._left.mask & mask) && (bonds[i]._right.mask & mask)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n\r\nexport default OrphanAtomsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass ResiduesProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n component.forEachResidue((residue) => {\r\n if (self._checkResidue(residue, mask)) {\r\n resIdc[chunksCount++] = residue._index;\r\n }\r\n });\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n checkResidue(residue, mask) {\r\n return residue._mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default ResiduesProcessor;\r\n","import ResidueProcessor from './ResiduesProcessor';\r\n\r\nclass NucleicProcessor extends ResidueProcessor {\r\n _checkResidue(residue, mask) {\r\n return mask & residue._mask && residue._cylinders !== null;\r\n }\r\n}\r\nexport default NucleicProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass SubseqsProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const subDivs = component.getMaskedSubdivSequences(mask);\r\n\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n for (let subDivI = 0, subDivN = subDivs.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDivs[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let j = subs[i].start, jEnd = subs[i].end; j <= jEnd; ++j) {\r\n resIdc[chunksCount++] = residues[j]._index;\r\n }\r\n }\r\n }\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n subdivs: subDivs,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default SubseqsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass BondsProcessor extends RCGroup {\r\n constructor(BondsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const bonds = complex.getBonds();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const bondsIdc = [];\r\n let bondsCount = 0;\r\n component.forEachBond((bond) => {\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n if (!(atom1.mask & mask) || !(atom2.mask & mask)) {\r\n return;\r\n }\r\n bondsIdc[bondsCount++] = bond._index;\r\n });\r\n if (bondsCount === 0) {\r\n return;\r\n }\r\n const bondsGroup = new BondsGroup(geoParams, {\r\n bonds,\r\n chunks: bondsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n bondsGroup._component = component;\r\n self.add(bondsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default BondsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AromaticProcessor extends RCGroup {\r\n constructor(AromaticGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n if (!mode.showAromaticLoops()) {\r\n return;\r\n }\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let chunksCount = 0;\r\n const cycles = [];\r\n let cycleIdx = 0;\r\n component.forEachCycle((cycle) => {\r\n const cycAtoms = cycle.atoms;\r\n let perCycle = 0;\r\n for (let i = 0, n = cycAtoms.length; i < n; ++i) {\r\n if ((cycAtoms[i].mask & mask) !== 0) {\r\n ++perCycle;\r\n atomsIdc[chunksCount++] = cycAtoms[i].index;\r\n }\r\n }\r\n if (perCycle > 0) {\r\n cycles[cycleIdx++] = cycle;\r\n }\r\n });\r\n\r\n const atomsGroup = new AromaticGroup(geoParams, {\r\n cycles,\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AromaticProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\nimport OrphanAtomsProcessor from './OrphanAtomsProcessor';\r\nimport ResiduesProcessor from './ResiduesProcessor';\r\nimport NucleicProcessor from './NucleicProcessor';\r\nimport SubseqsProcessor from './SubseqsProcessor';\r\nimport BondsProcessor from './BondsProcessor';\r\nimport AromaticProcessor from './AromaticProcessor';\r\n\r\nexport default {\r\n Atoms: AtomsProcessor,\r\n OrphanAtoms: OrphanAtomsProcessor,\r\n Residues: ResiduesProcessor,\r\n Nucleic: NucleicProcessor,\r\n Subseqs: SubseqsProcessor,\r\n Bonds: BondsProcessor,\r\n Aromatic: AromaticProcessor,\r\n};\r\n","import MeshCreator from '../../meshes/MeshCreator';\r\nimport groups from './groups';\r\nimport processors from '../processors/processors';\r\n\r\nfunction _bakeGroup(triplet, Processor, Group) {\r\n return function (complex, colorer, mode, polyComplexity, mask, material) {\r\n return new Processor(Group, triplet, complex, colorer, mode, polyComplexity, mask, material);\r\n };\r\n}\r\n\r\nclass GroupsFactory {\r\n static AtomsSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static OrphanedAtomsCrosses(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createCrosses(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.OrphanAtoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static BondsCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsCylinderGroup);\r\n }\r\n\r\n static BondsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.create2CLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsLinesGroup);\r\n }\r\n\r\n static CartoonChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesSubseqGroup);\r\n }\r\n\r\n static TraceChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CClosedCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesTraceGroup);\r\n }\r\n\r\n static NucleicSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicSpheresGroup);\r\n }\r\n\r\n static NucleicCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicCylindersGroup);\r\n }\r\n\r\n static ALoopsTorus(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticTorusGroup);\r\n }\r\n\r\n static ALoopsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createChunkedLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticLinesGroup);\r\n }\r\n\r\n static QuickSurfGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createQuickSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static ContactSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createContactSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static SASSESSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createSASSES(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSASSESGroupStub);\r\n }\r\n\r\n static TextLabelsGeo(caps, settings) {\r\n const gfxTriplet = MeshCreator.createLabels(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsTextGroup);\r\n }\r\n}\r\n\r\nexport default GroupsFactory;\r\n","import _ from 'lodash';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport factory from './groups/GroupsFactory';\r\n\r\n/**\r\n * Create new mode.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the mode after its creation.\r\n *\r\n * @exports Mode\r\n * @this Mode\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available modes used for building and displaying molecule geometry.\r\n */\r\nclass Mode {\r\n constructor(opts) {\r\n if (this.constructor === Mode) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Mode options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(this.settings.now.modes[this.id], true), opts);\r\n }\r\n\r\n /**\r\n * Get mode identification, probably with options.\r\n * @returns {string|Array} Mode identifier string ({@link Mode#id}) or two-element array containing both mode\r\n * identifier and options ({@link Mode#opts}).\r\n * Options are returned if they were changed during or after the mode creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, this.settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const polyComplexity = this.opts.polyComplexity ? this.opts.polyComplexity[this.settings.now.resolution] : 0;\r\n const groupList = this.depGroups;\r\n const groupCount = groupList.length;\r\n const group = new gfxutils.RCGroup();\r\n const self = this;\r\n for (let i = 0; i < groupCount; ++i) {\r\n let currGroup = groupList[i];\r\n let renderParams = {};\r\n if (_.isArray(currGroup)) {\r\n renderParams = currGroup[1].call(this);\r\n [currGroup] = currGroup;\r\n }\r\n const Group = factory[currGroup](null, this.settings, renderParams);\r\n const newGroup = new Group(complex, colorer, self, polyComplexity, mask, material);\r\n if (newGroup.children.length > 0) {\r\n group.add(newGroup);\r\n }\r\n }\r\n return group;\r\n }\r\n}\r\n\r\nmakeContextDependent(Mode.prototype);\r\n\r\n/**\r\n* Mode identifier.\r\n* @type {string}\r\n*/\r\nMode.prototype.id = '__';\r\n\r\n/**\r\n * Mode geo groups.\r\n * @type {Array}\r\n */\r\nMode.prototype.depGroups = [];\r\n\r\nexport default Mode;\r\n","import Mode from './Mode';\r\n\r\nfunction getRenderParams() {\r\n return {\r\n lineWidth: this.opts.lineWidth,\r\n };\r\n}\r\n\r\nclass LinesMode extends Mode {\r\n static id = 'LN';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const groups = this.depGroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n groups[i] = [groups[i], getRenderParams];\r\n }\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n\r\n calcAtomRadius() {\r\n return this.opts.atom;\r\n }\r\n\r\n getAromaticOffset() {\r\n return this.opts.offsarom;\r\n }\r\n\r\n getAromaticArcChunks() {\r\n return this.opts.chunkarom;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n}\r\n\r\nLinesMode.prototype.id = 'LN';\r\nLinesMode.prototype.name = 'Lines';\r\nLinesMode.prototype.shortName = 'Lines';\r\nLinesMode.prototype.depGroups = [\r\n 'ALoopsLines',\r\n 'BondsLines',\r\n 'OrphanedAtomsCrosses',\r\n];\r\n\r\nexport default LinesMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass LicoriceMode extends Mode {\r\n static id = 'LC';\r\n\r\n calcAtomRadius(_atom) {\r\n return this.opts.bond;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nLicoriceMode.prototype.id = 'LC';\r\nLicoriceMode.prototype.name = 'Licorice';\r\nLicoriceMode.prototype.shortName = 'Licorice';\r\nLicoriceMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default LicoriceMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass BallsAndSticksMode extends Mode {\r\n static id = 'BS';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius * this.opts.atom;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nBallsAndSticksMode.prototype.id = 'BS';\r\nBallsAndSticksMode.prototype.name = 'Balls and Sticks';\r\nBallsAndSticksMode.prototype.shortName = 'Balls';\r\nBallsAndSticksMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default BallsAndSticksMode;\r\n","import Mode from './Mode';\r\n\r\nclass VanDerWaalsMode extends Mode {\r\n static id = 'VW';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n}\r\n\r\nVanDerWaalsMode.prototype.id = 'VW';\r\nVanDerWaalsMode.prototype.name = 'Van der Waals';\r\nVanDerWaalsMode.prototype.shortName = 'VDW';\r\nVanDerWaalsMode.prototype.depGroups = ['AtomsSpheres'];\r\n\r\nexport default VanDerWaalsMode;\r\n","import Mode from './Mode';\r\n\r\nclass TraceMode extends Mode {\r\n static id = 'TR';\r\n\r\n calcStickRadius() {\r\n return this.opts.radius;\r\n }\r\n}\r\n\r\nTraceMode.prototype.id = 'TR';\r\nTraceMode.prototype.name = 'Trace';\r\nTraceMode.prototype.shortName = 'Trace';\r\nTraceMode.prototype.depGroups = ['TraceChains'];\r\n\r\nexport default TraceMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass TubeMode extends Mode {\r\n static id = 'TU';\r\n\r\n getResidueRadius(_residue) {\r\n return this.TUBE_RADIUS;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const rad = this.opts.radius;\r\n this.TUBE_RADIUS = new THREE.Vector2(rad, rad);\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nTubeMode.prototype.id = 'TU';\r\nTubeMode.prototype.name = 'Tube';\r\nTubeMode.prototype.shortName = 'Tube';\r\nTubeMode.prototype.depGroups = ['CartoonChains'];\r\n\r\nexport default TubeMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass CartoonMode extends Mode {\r\n static id = 'CA';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n // cache for secondary structure options\r\n this.secCache = {};\r\n }\r\n\r\n getResidueStartRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (!second || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return secOpts.start;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueEndRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (second === null || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return this.ARROW_END;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueRadius(residue, val) {\r\n const startRad = this.getResidueStartRadius(residue);\r\n if (val === 0) {\r\n return startRad;\r\n }\r\n\r\n const endRad = this.getResidueEndRadius(residue);\r\n if (val === 2) {\r\n return endRad;\r\n }\r\n\r\n return startRad.clone().lerp(endRad, val / 2.0);\r\n }\r\n\r\n calcStickRadius(_res) {\r\n return this.opts.radius;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const tubeRad = this.opts.radius;\r\n const secHeight = this.opts.depth;\r\n\r\n this.TUBE_RADIUS = new THREE.Vector2(tubeRad, tubeRad);\r\n this.ARROW_END = new THREE.Vector2(secHeight, tubeRad);\r\n const secCache = {};\r\n const secData = this.opts.ss;\r\n /* eslint-disable guard-for-in */\r\n for (const prop in secData) {\r\n secCache[prop] = {\r\n center: new THREE.Vector2(secHeight, secData[prop].width),\r\n start: new THREE.Vector2(secHeight, secData[prop].arrow),\r\n };\r\n }\r\n this.secCache = secCache;\r\n /* eslint-enable guard-for-in */\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nCartoonMode.prototype.id = 'CA';\r\nCartoonMode.prototype.name = 'Cartoon';\r\nCartoonMode.prototype.shortName = 'Cartoon';\r\nCartoonMode.prototype.depGroups = [\r\n 'CartoonChains',\r\n 'NucleicSpheres',\r\n 'NucleicCylinders',\r\n];\r\n\r\nexport default CartoonMode;\r\n","import chem from '../../chem';\r\nimport Mode from './Mode';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction getRenderParams() {\r\n return {\r\n wireframe: this.opts.wireframe,\r\n zClip: this.opts.zClip,\r\n };\r\n}\r\n\r\nclass SurfaceMode extends Mode {\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const surfaces = this.surfaceNames;\r\n const groups = this.depGroups;\r\n for (let i = 0, n = surfaces.length; i < n; ++i) {\r\n groups[groups.length] = [surfaces[i], getRenderParams];\r\n }\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getVisibilitySelector() {\r\n let visibilitySelector = null;\r\n if (this.opts.subset !== '') {\r\n const res = selectors.parse(this.opts.subset);\r\n if (!res.error) {\r\n visibilitySelector = res.selector;\r\n }\r\n }\r\n return visibilitySelector;\r\n }\r\n}\r\n\r\nSurfaceMode.prototype.isSurface = true;\r\nSurfaceMode.prototype.surfaceNames = [];\r\n\r\nexport default SurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass QuickSurfaceMode extends SurfaceMode {\r\n static id = 'QS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n useBeads: false,\r\n isoValue: this.opts.isoValue,\r\n gaussLim: this.opts.gaussLim[this.settings.now.resolution],\r\n radScale: this.opts.scale,\r\n gridSpacing: this.opts.gridSpacing[this.settings.now.resolution],\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nQuickSurfaceMode.prototype.id = 'QS';\r\nQuickSurfaceMode.prototype.name = 'Quick Surface';\r\nQuickSurfaceMode.prototype.shortName = 'Quick Surf';\r\nQuickSurfaceMode.prototype.surfaceNames = ['QuickSurfGeo'];\r\n\r\nexport default QuickSurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass IsoSurfaceMode extends SurfaceMode {\r\n constructor(excludeProbe, opts) {\r\n super(opts);\r\n this._excludeProbe = excludeProbe;\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getSurfaceOpts() {\r\n return {\r\n gridSpacing: this.opts.polyComplexity[this.settings.now.resolution],\r\n radScale: this._radScale,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n probeRadius: this.opts.probeRadius,\r\n excludeProbe: this._excludeProbe,\r\n };\r\n }\r\n}\r\n\r\nIsoSurfaceMode.prototype.id = 'SU';\r\nIsoSurfaceMode.prototype.name = 'Surface';\r\nIsoSurfaceMode.prototype.shortName = 'Surface';\r\nIsoSurfaceMode.prototype.surfaceNames = ['SASSESSurfaceGeo'];\r\n\r\nIsoSurfaceMode.prototype._radScale = 1;\r\nIsoSurfaceMode.prototype._excludeProbe = false;\r\n\r\nexport default IsoSurfaceMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSASMode extends IsoSurfaceMode {\r\n static id = 'SA';\r\n\r\n constructor(opts) {\r\n super(false, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSASMode.prototype.id = 'SA';\r\nIsoSurfaceSASMode.prototype.name = 'Solvent Accessible Surface';\r\nIsoSurfaceSASMode.prototype.shortName = 'SAS';\r\n\r\nexport default IsoSurfaceSASMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSESMode extends IsoSurfaceMode {\r\n static id = 'SE';\r\n\r\n constructor(opts) {\r\n super(true, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSESMode.prototype.id = 'SE';\r\nIsoSurfaceSESMode.prototype.name = 'Solvent Excluded Surface';\r\nIsoSurfaceSESMode.prototype.shortName = 'SES';\r\n\r\nexport default IsoSurfaceSESMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass ContactSurfaceMode extends SurfaceMode {\r\n static id = 'CS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n probeRadius: this.opts.probeRadius,\r\n radScale: this.opts.polyComplexity[this.settings.now.resolution],\r\n scaleFactor: this.opts.polyComplexity[this.settings.now.resolution],\r\n gridSpacing: 1.0 / this.opts.polyComplexity[this.settings.now.resolution],\r\n isoValue: this.opts.isoValue,\r\n probePositions: this.opts.probePositions,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nContactSurfaceMode.prototype.id = 'CS';\r\nContactSurfaceMode.prototype.name = 'Contact Surface';\r\nContactSurfaceMode.prototype.shortName = 'Contact Surf';\r\nContactSurfaceMode.prototype.isSurface = true;\r\nContactSurfaceMode.prototype.surfaceNames = ['ContactSurfaceGeo'];\r\n\r\nexport default ContactSurfaceMode;\r\n","import _ from 'lodash';\r\nimport Mode from './Mode';\r\n\r\nclass TextMode extends Mode {\r\n static id = 'TX';\r\n\r\n getTemplateOptions() {\r\n return this.opts.template;\r\n }\r\n\r\n getLabelOpts() {\r\n return _.merge(this.opts, {\r\n colors: true,\r\n adjustColor: true,\r\n transparent: true,\r\n });\r\n }\r\n}\r\n\r\nTextMode.prototype.id = 'TX';\r\nTextMode.prototype.name = 'Text mode';\r\nTextMode.prototype.shortName = 'Text';\r\nTextMode.prototype.depGroups = ['TextLabelsGeo'];\r\n\r\nexport default TextMode;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport LinesMode from './modes/LinesMode';\r\nimport LicoriceMode from './modes/LicoriceMode';\r\nimport BallsAndSticksMode from './modes/BallsAndSticksMode';\r\nimport VanDerWaalsMode from './modes/VanDerWaalsMode';\r\nimport TraceMode from './modes/TraceMode';\r\nimport TubeMode from './modes/TubeMode';\r\nimport CartoonMode from './modes/CartoonMode';\r\nimport QuickSurfaceMode from './modes/QuickSurfaceMode';\r\nimport IsoSurfaceSASMode from './modes/IsoSurfaceSASMode';\r\nimport IsoSurfaceSESMode from './modes/IsoSurfaceSESMode';\r\nimport ContactSurfaceMode from './modes/ContactSurfaceMode';\r\nimport TextMode from './modes/TextMode';\r\n\r\nconst modes = new EntityList([\r\n LinesMode,\r\n LicoriceMode,\r\n BallsAndSticksMode,\r\n VanDerWaalsMode,\r\n TraceMode,\r\n TubeMode,\r\n CartoonMode,\r\n QuickSurfaceMode,\r\n IsoSurfaceSASMode,\r\n IsoSurfaceSESMode,\r\n ContactSurfaceMode,\r\n TextMode,\r\n]);\r\n\r\nexport default modes;\r\n","import _ from 'lodash';\r\n\r\nfunction clamp(x, a, b) {\r\n return x <= b ? x < 0 ? 0 : x : b;\r\n}\r\n\r\nfunction lerpColor(c1, c2, alpha) {\r\n const beta = 1 - alpha;\r\n const r1 = (c1 >> 16) & 0xff;\r\n const g1 = (c1 >> 8) & 0xff;\r\n const b1 = c1 & 0xff;\r\n const r2 = (c2 >> 16) & 0xff;\r\n const g2 = (c2 >> 8) & 0xff;\r\n const b2 = c2 & 0xff;\r\n const r = beta * r1 + alpha * r2;\r\n const g = beta * g1 + alpha * g2;\r\n const b = beta * b1 + alpha * b2;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\nclass Palette {\r\n constructor(name, id) {\r\n this.name = name || 'Custom';\r\n this.id = id || 'CP';\r\n }\r\n\r\n getElementColor(name, asIs = false) {\r\n const color = this.elementColors[name];\r\n return color === undefined && !asIs ? this.defaultElementColor : color;\r\n }\r\n\r\n getResidueColor(name, asIs = false) {\r\n const color = this.residueColors[name];\r\n return color === undefined && !asIs ? this.defaultResidueColor : color;\r\n }\r\n\r\n getChainColor(name) {\r\n let chain = name.charCodeAt(0);\r\n chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F)\r\n % this.chainColors.length;\r\n return this.chainColors[chain];\r\n }\r\n\r\n getSecondaryColor(type, asIs = false) {\r\n const color = this.secondaryColors[type];\r\n return color === undefined && !asIs ? this.defaultSecondaryColor : color;\r\n }\r\n\r\n getSequentialColor(index) {\r\n const { colors } = this;\r\n const len = colors.length;\r\n return index < 0 ? colors[(index % len) + len] : colors[index % len];\r\n }\r\n\r\n getGradientColor(value, gradientName) {\r\n const gradient = this.gradients[gradientName];\r\n if (!gradient) {\r\n return this.defaultNamedColor;\r\n }\r\n const count = gradient.length;\r\n const index = value * (count - 1);\r\n let left = Math.floor(index);\r\n const right = clamp(left + 1, 0, count - 1);\r\n left = clamp(left, 0, count - 1);\r\n return lerpColor(gradient[left], gradient[right], index - left);\r\n }\r\n\r\n getNamedColor(name, asIs = false) {\r\n const color = this.namedColors[name];\r\n return color === undefined && !asIs ? this.defaultNamedColor : color;\r\n }\r\n}\r\n\r\n_.assign(Palette.prototype, {\r\n colors: [0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0x808080],\r\n\r\n minRangeColor: 0x000000,\r\n midRangeColor: 0x7F7F7F,\r\n maxRangeColor: 0xFFFFFF,\r\n\r\n defaultElementColor: 0xFFFFFF,\r\n elementColors: {},\r\n\r\n defaultResidueColor: 0xFFFFFF,\r\n residueColors: {},\r\n\r\n chainColors: [0xFFFFFF],\r\n\r\n defaultSecondaryColor: 0xFFFFFF,\r\n secondaryColors: {},\r\n\r\n defaultGradientColor: 0x000000,\r\n\r\n defaultNamedColor: 0xFFFFFF,\r\n namedColorsArray: [\r\n /* eslint-disable no-multi-spaces */\r\n ['indianred', 0xcd5c5c],\r\n ['lightcoral', 0xf08080],\r\n ['salmon', 0xfa8072],\r\n ['darksalmon', 0xe9967a],\r\n ['lightsalmon', 0xffa07a],\r\n ['crimson', 0xdc143c],\r\n ['red', 0xff0000],\r\n ['firebrick', 0xb22222],\r\n ['darkred', 0x8b0000],\r\n ['pink', 0xffc0cb],\r\n ['lightpink', 0xffb6c1],\r\n ['hotpink', 0xff69b4],\r\n ['deeppink', 0xff1493],\r\n ['mediumvioletred', 0xc71585],\r\n ['palevioletred', 0xdb7093],\r\n ['coral', 0xff7f50],\r\n ['tomato', 0xff6347],\r\n ['orangered', 0xff4500],\r\n ['darkorange', 0xff8c00],\r\n ['orange', 0xffa500],\r\n ['gold', 0xffd700],\r\n ['yellow', 0xffff00],\r\n ['lightyellow', 0xffffe0],\r\n ['lemonchiffon', 0xfffacd],\r\n ['lightgoldenrodyellow', 0xfafad2],\r\n ['papayawhip', 0xffefd5],\r\n ['moccasin', 0xffe4b5],\r\n ['peachpuff', 0xffdab9],\r\n ['palegoldenrod', 0xeee8aa],\r\n ['khaki', 0xf0e68c],\r\n ['darkkhaki', 0xbdb76b],\r\n ['lavender', 0xe6e6fa],\r\n ['thistle', 0xd8bfd8],\r\n ['plum', 0xdda0dd],\r\n ['violet', 0xee82ee],\r\n ['orchid', 0xda70d6],\r\n ['fuchsia', 0xff00ff],\r\n ['magenta', 0xff00ff],\r\n ['mediumorchid', 0xba55d3],\r\n ['mediumpurple', 0x9370db],\r\n ['rebeccapurple', 0x663399],\r\n ['blueviolet', 0x8a2be2],\r\n ['darkviolet', 0x9400d3],\r\n ['darkorchid', 0x9932cc],\r\n ['darkmagenta', 0x8b008b],\r\n ['purple', 0x800080],\r\n ['indigo', 0x4b0082],\r\n ['slateblue', 0x6a5acd],\r\n ['mediumslateblue', 0x7b68ee],\r\n ['darkslateblue', 0x483d8b],\r\n ['greenyellow', 0xadff2f],\r\n ['chartreuse', 0x7fff00],\r\n ['lawngreen', 0x7cfc00],\r\n ['lime', 0x00ff00],\r\n ['limegreen', 0x32cd32],\r\n ['palegreen', 0x98fb98],\r\n ['lightgreen', 0x90ee90],\r\n ['mediumspringgreen', 0x00fa9a],\r\n ['springgreen', 0x00ff7f],\r\n ['mediumseagreen', 0x3cb371],\r\n ['seagreen', 0x2e8b57],\r\n ['forestgreen', 0x228b22],\r\n ['green', 0x008000],\r\n ['darkgreen', 0x006400],\r\n ['yellowgreen', 0x9acd32],\r\n ['olivedrab', 0x6b8e23],\r\n ['olive', 0x808000],\r\n ['darkolivegreen', 0x556b2f],\r\n ['mediumaquamarine', 0x66cdaa],\r\n ['darkseagreen', 0x8fbc8f],\r\n ['lightseagreen', 0x20b2aa],\r\n ['darkcyan', 0x008b8b],\r\n ['teal', 0x008080],\r\n ['aqua', 0x00ffff],\r\n ['cyan', 0x00ffff],\r\n ['lightcyan', 0xe0ffff],\r\n ['paleturquoise', 0xafeeee],\r\n ['aquamarine', 0x7fffd4],\r\n ['turquoise', 0x40e0d0],\r\n ['mediumturquoise', 0x48d1cc],\r\n ['darkturquoise', 0x00ced1],\r\n ['cadetblue', 0x5f9ea0],\r\n ['steelblue', 0x4682b4],\r\n ['lightsteelblue', 0xb0c4de],\r\n ['powderblue', 0xb0e0e6],\r\n ['lightblue', 0xadd8e6],\r\n ['skyblue', 0x87ceeb],\r\n ['lightskyblue', 0x87cefa],\r\n ['deepskyblue', 0x00bfff],\r\n ['dodgerblue', 0x1e90ff],\r\n ['cornflowerblue', 0x6495ed],\r\n ['royalblue', 0x4169e1],\r\n ['blue', 0x0000ff],\r\n ['mediumblue', 0x0000cd],\r\n ['darkblue', 0x00008b],\r\n ['navy', 0x000080],\r\n ['midnightblue', 0x191970],\r\n ['cornsilk', 0xfff8dc],\r\n ['blanchedalmond', 0xffebcd],\r\n ['bisque', 0xffe4c4],\r\n ['navajowhite', 0xffdead],\r\n ['wheat', 0xf5deb3],\r\n ['burlywood', 0xdeb887],\r\n ['tan', 0xd2b48c],\r\n ['rosybrown', 0xbc8f8f],\r\n ['sandybrown', 0xf4a460],\r\n ['goldenrod', 0xdaa520],\r\n ['darkgoldenrod', 0xb8860b],\r\n ['peru', 0xcd853f],\r\n ['chocolate', 0xd2691e],\r\n ['saddlebrown', 0x8b4513],\r\n ['sienna', 0xa0522d],\r\n ['brown', 0xa52a2a],\r\n ['maroon', 0x800000],\r\n ['white', 0xffffff],\r\n ['snow', 0xfffafa],\r\n ['honeydew', 0xf0fff0],\r\n ['mintcream', 0xf5fffa],\r\n ['azure', 0xf0ffff],\r\n ['aliceblue', 0xf0f8ff],\r\n ['ghostwhite', 0xf8f8ff],\r\n ['whitesmoke', 0xf5f5f5],\r\n ['seashell', 0xfff5ee],\r\n ['beige', 0xf5f5dc],\r\n ['oldlace', 0xfdf5e6],\r\n ['floralwhite', 0xfffaf0],\r\n ['ivory', 0xfffff0],\r\n ['antiquewhite', 0xfaebd7],\r\n ['linen', 0xfaf0e6],\r\n ['lavenderblush', 0xfff0f5],\r\n ['mistyrose', 0xffe4e1],\r\n ['gainsboro', 0xdcdcdc],\r\n ['lightgray', 0xd3d3d3],\r\n ['silver', 0xc0c0c0],\r\n ['darkgray', 0xa9a9a9],\r\n ['gray', 0x808080],\r\n ['dimgray', 0x696969],\r\n ['lightslategray', 0x778899],\r\n ['slategray', 0x708090],\r\n ['darkslategray', 0x2f4f4f],\r\n ['black', 0x000000],\r\n /* eslint-enable no-multi-spaces */\r\n ],\r\n\r\n namedColors: {},\r\n /* eslint-enable no-magic-numbers */\r\n\r\n gradients: {\r\n rainbow: [\r\n 0x0000ff, // blue\r\n 0x00ffff, // cyan\r\n 0x00ff00, // green\r\n 0xffff00, // yellow\r\n 0xff0000, // red\r\n ],\r\n temp: [\r\n 0x0000ff, // blue\r\n 0x007fff, // light-blue\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n hot: [\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n cold: [\r\n 0xffffff, // white\r\n 0x007fff, // light-blue\r\n 0x0000ff, // blue\r\n ],\r\n 'blue-red': [\r\n 0x0000ff, // blue\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n reds: [\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n blues: [\r\n 0xffffff, // white\r\n 0x0000ff, // blue\r\n ],\r\n },\r\n});\r\n\r\nconst { namedColorsArray, namedColors } = Palette.prototype;\r\n\r\nfor (let i = 0, { length } = namedColorsArray; i < length; ++i) {\r\n const [name, value] = namedColorsArray[i];\r\n namedColors[name] = value;\r\n}\r\n\r\nexport default Palette;\r\n","import Palette from './Palette';\r\n\r\nconst palette = new Palette('CPK', 'CP');\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x202020,\r\n N: 0x2060FF,\r\n O: 0xEE2010,\r\n F: 0x00FF00,\r\n P: 0x8020FF,\r\n S: 0xFFFF00,\r\n CL: 0x00BB00,\r\n FE: 0xD0D0D0,\r\n CO: 0xD0D0D0,\r\n NI: 0xD0D0D0,\r\n CU: 0xD0D0D0,\r\n BR: 0x008800,\r\n I: 0x005500,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('Jmol', 'JM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0x0055FF, //\r\n 0x00ABFF, //\r\n 0x00FFFF, // cyan\r\n 0x00FFAB, //\r\n 0x00FF55, //\r\n 0x00FF00, // green\r\n 0x55FF00, //\r\n 0xABFF00, //\r\n 0xFFFF00, // yellow\r\n 0xFFAB00, //\r\n 0xFF5500, //\r\n 0xFF0000, // red\r\n 0xFF0055, //\r\n 0xFF00AB, //\r\n 0xFF00FF, // magenta\r\n 0xAB00FF, //\r\n 0x5500FF, //\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n D: 0xFFFFC0,\r\n T: 0xFFFFA0,\r\n HE: 0xD9FFFF,\r\n LI: 0xCC80FF,\r\n BE: 0xC2FF00,\r\n B: 0xFFB5B5,\r\n C: 0x909090,\r\n N: 0x3050F8,\r\n O: 0xFF0D0D,\r\n F: 0x90E050,\r\n NE: 0xB3E3F5,\r\n NA: 0xAB5CF2,\r\n MG: 0x8AFF00,\r\n AL: 0xBFA6A6,\r\n SI: 0xF0C8A0,\r\n P: 0xFF8000,\r\n S: 0xFFFF30,\r\n CL: 0x1FF01F,\r\n AR: 0x80D1E3,\r\n K: 0x8F40D4,\r\n CA: 0x3DFF00,\r\n SC: 0xE6E6E6,\r\n TI: 0xBFC2C7,\r\n V: 0xA6A6AB,\r\n CR: 0x8A99C7,\r\n MN: 0x9C7AC7,\r\n FE: 0xE06633,\r\n CO: 0xF090A0,\r\n NI: 0x50D050,\r\n CU: 0xC88033,\r\n ZN: 0x7D80B0,\r\n GA: 0xC28F8F,\r\n GE: 0x668F8F,\r\n AS: 0xBD80E3,\r\n SE: 0xFFA100,\r\n BR: 0xA62929,\r\n KR: 0x5CB8D1,\r\n RB: 0x702EB0,\r\n SR: 0x00FF00,\r\n Y: 0x94FFFF,\r\n ZR: 0x94E0E0,\r\n NB: 0x73C2C9,\r\n MO: 0x54B5B5,\r\n TC: 0x3B9E9E,\r\n RU: 0x248F8F,\r\n RH: 0x0A7D8C,\r\n PD: 0x006985,\r\n AG: 0xC0C0C0,\r\n CD: 0xFFD98F,\r\n IN: 0xA67573,\r\n SN: 0x668080,\r\n SB: 0x9E63B5,\r\n TE: 0xD47A00,\r\n I: 0x940094,\r\n XE: 0x429EB0,\r\n CS: 0x57178F,\r\n BA: 0x00C900,\r\n LA: 0x70D4FF,\r\n CE: 0xFFFFC7,\r\n PR: 0xD9FFC7,\r\n ND: 0xC7FFC7,\r\n PM: 0xA3FFC7,\r\n SM: 0x8FFFC7,\r\n EU: 0x61FFC7,\r\n GD: 0x45FFC7,\r\n TB: 0x30FFC7,\r\n DY: 0x1FFFC7,\r\n HO: 0x00FF9C,\r\n ER: 0x00E675,\r\n TM: 0x00D452,\r\n YB: 0x00BF38,\r\n LU: 0x00AB24,\r\n HF: 0x4DC2FF,\r\n TA: 0x4DA6FF,\r\n W: 0x2194D6,\r\n RE: 0x267DAB,\r\n OS: 0x266696,\r\n IR: 0x175487,\r\n PT: 0xD0D0E0,\r\n AU: 0xFFD123,\r\n HG: 0xB8B8D0,\r\n TL: 0xA6544D,\r\n PB: 0x575961,\r\n BI: 0x9E4FB5,\r\n PO: 0xAB5C00,\r\n AT: 0x754F45,\r\n RN: 0x428296,\r\n FR: 0x420066,\r\n RA: 0x007D00,\r\n AC: 0x70ABFA,\r\n TH: 0x00BAFF,\r\n PA: 0x00A1FF,\r\n U: 0x008FFF,\r\n NP: 0x0080FF,\r\n PU: 0x006BFF,\r\n AM: 0x545CF2,\r\n CM: 0x785CE3,\r\n BK: 0x8A4FE3,\r\n CF: 0xA136D4,\r\n ES: 0xB31FD4,\r\n FM: 0xB31FBA,\r\n MD: 0xB30DA6,\r\n NO: 0xBD0D87,\r\n LR: 0xC70066,\r\n RF: 0xCC0059,\r\n DB: 0xD1004F,\r\n SG: 0xD90045,\r\n BH: 0xE00038,\r\n HS: 0xE6002E,\r\n MT: 0xEB0026,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0xBEA06E;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0xC8C8C8,\r\n ARG: 0x145AFF,\r\n ASN: 0x00DCDC,\r\n ASP: 0xE60A0A,\r\n CYS: 0xE6E600,\r\n GLN: 0x00DCDC,\r\n GLU: 0xE60A0A,\r\n GLY: 0xEBEBEB,\r\n HIS: 0x8282D2,\r\n ILE: 0x0F820F,\r\n LEU: 0x0F820F,\r\n LYS: 0x145AFF,\r\n MET: 0xE6E600,\r\n PHE: 0x3232AA,\r\n PRO: 0xDC9682,\r\n SER: 0xFA9600,\r\n THR: 0xFA9600,\r\n TRP: 0xB45AB4,\r\n TYR: 0x3232AA,\r\n VAL: 0x0F820F,\r\n A: 0xA0A0FF,\r\n C: 0xFF8C4B,\r\n G: 0xFF7070,\r\n I: 0x80FFFF,\r\n T: 0xA0FFA0,\r\n U: 0xFF8080,\r\n DA: 0xA0A0FF,\r\n DC: 0xFF8C4B,\r\n DG: 0xFF7070,\r\n DI: 0x80FFFF,\r\n DT: 0xA0FFA0,\r\n DU: 0xFF8080,\r\n '+A': 0xA0A0FF,\r\n '+C': 0xFF8C4B,\r\n '+G': 0xFF7070,\r\n '+I': 0x80FFFF,\r\n '+T': 0xA0FFA0,\r\n '+U': 0xFF8080,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [\r\n // ' '->0 'A'->1, 'B'->2\r\n 0xFFffffff, // ' ' & '0' white\r\n //\r\n 0xFFC0D0FF, // skyblue\r\n 0xFFB0FFB0, // pastel green\r\n 0xFFFFC0C8, // pink\r\n 0xFFFFFF80, // pastel yellow\r\n 0xFFFFC0FF, // pastel magenta\r\n 0xFFB0F0F0, // pastel cyan\r\n 0xFFFFD070, // pastel gold\r\n 0xFFF08080, // lightcoral\r\n\r\n 0xFFF5DEB3, // wheat\r\n 0xFF00BFFF, // deepskyblue\r\n 0xFFCD5C5C, // indianred\r\n 0xFF66CDAA, // mediumaquamarine\r\n 0xFF9ACD32, // yellowgreen\r\n 0xFFEE82EE, // violet\r\n 0xFF00CED1, // darkturquoise\r\n 0xFF00FF7F, // springgreen\r\n 0xFF3CB371, // mediumseagreen\r\n\r\n 0xFF00008B, // darkblue\r\n 0xFFBDB76B, // darkkhaki\r\n 0xFF006400, // darkgreen\r\n 0xFF800000, // maroon\r\n 0xFF808000, // olive\r\n 0xFF800080, // purple\r\n 0xFF008080, // teal\r\n 0xFFB8860B, // darkgoldenrod\r\n 0xFFB22222, // firebrick\r\n];\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xFF0080,\r\n [StructuralElementType.HELIX_PI]: 0x600080,\r\n [StructuralElementType.HELIX_310]: 0xA00080,\r\n [StructuralElementType.STRAND]: 0xFFC800,\r\n [StructuralElementType.TURN]: 0x6080FF,\r\n dna: 0xAE00FE,\r\n rna: 0xFD0162,\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('VMD', 'VM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0xFF0000, // red\r\n 0x606060, // gray\r\n 0xFF8000, // orange\r\n 0xFFFF00, // yellow\r\n 0x808033, // tan\r\n 0x999999, // silver\r\n 0x00FF00, // green\r\n 0xFFFFFF, // white\r\n 0xFF9999, // pink\r\n 0x40C0C0, // cyan\r\n 0xA600A6, // purple\r\n 0x80E666, // lime\r\n 0xE666B3, // mauve\r\n 0x804D00, // ochre\r\n 0x8080C0, // ice blue\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\npalette.defaultElementColor = 0x804D00;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x40BFBF,\r\n N: 0x0000FF,\r\n O: 0xFF0000,\r\n P: 0x808033,\r\n S: 0xFFFF00,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0x40C0C0;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0x0000FF,\r\n ARG: 0xFFFFFF,\r\n ASN: 0x808033,\r\n ASP: 0xFF0000,\r\n CYS: 0xFFFF00,\r\n GLN: 0xFF8000,\r\n GLU: 0xFF9999,\r\n GLY: 0xFFFFFF,\r\n HIS: 0x40C0C0,\r\n ILE: 0x00FF00,\r\n LEU: 0xFF9999,\r\n LYS: 0x40C0C0,\r\n MET: 0xFFFF00,\r\n PHE: 0xA600A6,\r\n PRO: 0x804C00,\r\n SER: 0xFFFF00,\r\n THR: 0xE666B3,\r\n TRP: 0x999999,\r\n TYR: 0x00FF00,\r\n VAL: 0x808033,\r\n A: 0x0000FF,\r\n C: 0xFF8000,\r\n G: 0xFFFF00,\r\n T: 0xA600A6,\r\n U: 0x00FF00,\r\n DA: 0x0000FF,\r\n DC: 0xFF8000,\r\n DG: 0xFFFF00,\r\n DT: 0xA600A6,\r\n DU: 0x00FF00,\r\n '+A': 0x0000FF,\r\n '+C': 0xFF8000,\r\n '+G': 0xFFFF00,\r\n '+T': 0xA600A6,\r\n '+U': 0x00FF00,\r\n WAT: 0x40C0C0,\r\n H2O: 0x40C0C0,\r\n HOH: 0x40C0C0,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [0xFFFFFF].concat(palette.colors);\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xA600A6,\r\n [StructuralElementType.HELIX_310]: 0x0000FF,\r\n [StructuralElementType.HELIX_PI]: 0xFF0000,\r\n [StructuralElementType.STRAND]: 0xFFFF00,\r\n [StructuralElementType.BRIDGE]: 0x808033,\r\n [StructuralElementType.TURN]: 0x40C0C0,\r\n};\r\n\r\nexport default palette;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport cpkPalette from './palettes/cpkPalette';\r\nimport jmolPalette from './palettes/jmolPalette';\r\nimport vmdPalette from './palettes/vmdPalette';\r\n\r\nconst palettes = new EntityList([\r\n cpkPalette,\r\n jmolPalette,\r\n vmdPalette,\r\n]);\r\n\r\nexport default palettes;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport palettes from '../palettes';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports Colorer\r\n * @this Colorer\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available coloring algorithms used for building and displaying molecule geometry.\r\n */\r\nclass Colorer {\r\n constructor(opts) {\r\n if (this.constructor === Colorer) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Colorer options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(settings.now.colorers[this.id], true), opts);\r\n /**\r\n * Palette in use.\r\n * @type {Palette}\r\n */\r\n this.palette = palettes.first;\r\n }\r\n\r\n /**\r\n * Get Colorer identification, probably with options.\r\n * @returns {string|Array} Colorer identifier string ({@link Colorer#id}) or two-element array containing both colorer\r\n * identifier and options ({@link Colorer#opts}).\r\n * Options are returned if they were changed during or after colorer creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, settings.now.colorers[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n}\r\n\r\n/**\r\n * Colorer identifier.\r\n * @type {string}\r\n */\r\n\r\nColorer.prototype.id = '__';\r\n\r\nexport default Colorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Element\r\n *\r\n * @exports ElementColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on chemical element.\r\n */\r\nclass ElementColorer extends Colorer {\r\n static id = 'EL';\r\n\r\n getAtomColor(atom, _complex) {\r\n const type = atom.element.name;\r\n if (type === 'C' && this.opts.carbon >= 0) {\r\n return this.opts.carbon;\r\n }\r\n return this.palette.getElementColor(type);\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nElementColorer.prototype.id = 'EL';\r\nElementColorer.prototype.name = 'Element';\r\nElementColorer.prototype.shortName = 'Element';\r\n\r\nexport default ElementColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Coloring algorithm based on residue type.\r\n *\r\n * @see ResidueType\r\n *\r\n * @exports ResidueTypeColorer\r\n * @constructor\r\n */\r\nclass ResidueTypeColorer extends Colorer {\r\n static id = 'RT';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getResidueColor(residue._type._name);\r\n }\r\n}\r\n\r\nResidueTypeColorer.prototype.id = 'RT';\r\nResidueTypeColorer.prototype.name = 'Residue Type';\r\nResidueTypeColorer.prototype.shortName = 'Residue';\r\n\r\nexport default ResidueTypeColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass SequenceColorer extends Colorer {\r\n static id = 'SQ';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const chain = residue._chain;\r\n if (chain.minSequence === Number.POSITIVE_INFINITY && chain.maxSequence === Number.NEGATIVE_INFINITY) {\r\n return this.palette.defaultNamedColor;\r\n }\r\n const min = chain.minSequence;\r\n const max = chain.maxSequence > min ? chain.maxSequence : min + 1;\r\n return this.palette.getGradientColor((residue._sequence - min) / (max - min), this.opts.gradient);\r\n }\r\n}\r\n\r\nSequenceColorer.prototype.id = 'SQ';\r\nSequenceColorer.prototype.name = 'Sequence';\r\nSequenceColorer.prototype.shortName = 'Sequence';\r\n\r\nexport default SequenceColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ChainColorer extends Colorer {\r\n static id = 'CH';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getChainColor(residue.getChain()._name);\r\n }\r\n}\r\n\r\nChainColorer.prototype.id = 'CH';\r\nChainColorer.prototype.name = 'Chain';\r\nChainColorer.prototype.shortName = 'Chain';\r\n\r\nexport default ChainColorer;\r\n","import Colorer from './Colorer';\r\nimport ResidueType from '../../chem/ResidueType';\r\n\r\nclass SecondaryStructureColorer extends Colorer {\r\n static id = 'SS';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n if (residue._type.flags & ResidueType.Flags.DNA) {\r\n return this.palette.getSecondaryColor('dna');\r\n }\r\n if (residue._type.flags & ResidueType.Flags.RNA) {\r\n return this.palette.getSecondaryColor('rna');\r\n }\r\n const secondary = residue.getSecondary();\r\n if (secondary) {\r\n let color = this.palette.getSecondaryColor(secondary.type, true);\r\n if (color === undefined) {\r\n color = this.palette.getSecondaryColor(secondary.generic);\r\n }\r\n return color;\r\n }\r\n return this.palette.defaultSecondaryColor;\r\n }\r\n}\r\n\r\nSecondaryStructureColorer.prototype.id = 'SS';\r\nSecondaryStructureColorer.prototype.name = 'Secondary Structure';\r\nSecondaryStructureColorer.prototype.shortName = 'Structure';\r\n\r\nexport default SecondaryStructureColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass UniformColorer extends Colorer {\r\n static id = 'UN';\r\n\r\n getAtomColor(_atom, _complex) {\r\n return this.opts.color;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nUniformColorer.prototype.id = 'UN';\r\nUniformColorer.prototype.name = 'Uniform';\r\nUniformColorer.prototype.shortName = 'Uniform';\r\n\r\nexport default UniformColorer;\r\n","import Colorer from './Colorer';\r\nimport selectors from '../../chem/selectors';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports ConditionalColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on a selector string used as a condition.\r\n */\r\nclass ConditionalColorer extends Colorer {\r\n static id = 'CO';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n const parsed = selectors.parse(this.opts.subset);\r\n this._subsetCached = parsed.error ? selectors.none() : parsed.selector;\r\n }\r\n\r\n getAtomColor(atom, _complex) {\r\n return this._subsetCached.includesAtom(atom) ? this.opts.color : this.opts.baseColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const subset = this._subsetCached;\r\n const atoms = residue._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n if (!subset.includesAtom(atoms[i])) {\r\n return this.opts.baseColor;\r\n }\r\n }\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nConditionalColorer.prototype.id = 'CO';\r\nConditionalColorer.prototype.name = 'Conditional';\r\nConditionalColorer.prototype.shortName = 'Conditional';\r\n\r\nexport default ConditionalColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ConformationColorer extends Colorer {\r\n static id = 'CF';\r\n\r\n getAtomColor(atom, _complex) {\r\n return this.palette.getChainColor(String.fromCharCode(atom.location));\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nConformationColorer.prototype.id = 'CF';\r\nConformationColorer.prototype.name = 'Conformation';\r\nConformationColorer.prototype.shortName = 'Conformation';\r\n\r\nexport default ConformationColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Temperature\r\n *\r\n * @exports TemperatureColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on temperature of chemical element.\r\n */\r\nclass TemperatureColorer extends Colorer {\r\n static id = 'TM';\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n let factor = 1;\r\n if (atom.temperature && opts) {\r\n if (opts.min === opts.max) {\r\n factor = atom.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (atom.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n if (!opts) {\r\n return this.palette.defaultGradientColor;\r\n }\r\n if (residue.temperature) {\r\n let factor = 0;\r\n if (opts.min === opts.max) {\r\n factor = residue.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (residue.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n}\r\n\r\nTemperatureColorer.prototype.id = 'TM'; // [T]e[M]perature\r\nTemperatureColorer.prototype.name = 'Temperature';\r\nTemperatureColorer.prototype.shortName = 'Temperature';\r\n\r\nexport default TemperatureColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Occupancy\r\n *\r\n * @exports OccupancyColorer\r\n * @augments Occupancy\r\n * @constructor\r\n * @classdesc Coloring algorithm based on occupancy of chemical element.\r\n */\r\nclass OccupancyColorer extends Colorer {\r\n static id = 'OC';\r\n\r\n _getColorByOccupancy(occupancy, opts) {\r\n if (occupancy !== undefined) {\r\n const factor = 1 - occupancy;\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n return this._getColorByOccupancy(atom.occupancy, opts);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n return this._getColorByOccupancy(residue.occupancy, opts);\r\n }\r\n}\r\n\r\nOccupancyColorer.prototype.id = 'OC'; // [OC]cupancy\r\nOccupancyColorer.prototype.name = 'Occupancy';\r\nOccupancyColorer.prototype.shortName = 'Occupancy';\r\n\r\nexport default OccupancyColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass HydrophobicityColorer extends Colorer {\r\n static id = 'HY';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n let color = this.palette.defaultResidueColor;\r\n if (residue._type.hydrophobicity !== undefined) {\r\n // Kyte Doolitle hydro [-4.5,4.5]->[0.1]\r\n const min = -4.5;\r\n const max = 4.5;\r\n color = this.palette.getGradientColor((residue._type.hydrophobicity - min) / (max - min), this.opts.gradient);\r\n }\r\n return color;\r\n }\r\n}\r\n\r\nHydrophobicityColorer.prototype.id = 'HY';\r\nHydrophobicityColorer.prototype.name = 'Hydrophobicity';\r\nHydrophobicityColorer.prototype.shortName = 'Hydrophobicity';\r\n\r\nexport default HydrophobicityColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass MoleculeColorer extends Colorer {\r\n static id = 'MO';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const molecule = residue._molecule;\r\n const count = _complex.getMoleculeCount();\r\n if (count > 1) {\r\n return this.palette.getGradientColor((molecule.index - 1) / (count - 1), this.opts.gradient);\r\n }\r\n return this.palette.getGradientColor(0, this.opts.gradient);\r\n }\r\n}\r\n\r\nMoleculeColorer.prototype.id = 'MO';\r\nMoleculeColorer.prototype.name = 'Molecule';\r\nMoleculeColorer.prototype.shortName = 'Molecule';\r\n\r\nexport default MoleculeColorer;\r\n","import Colorer from './Colorer';\r\nimport Atom from '../../chem/Atom';\r\n\r\nfunction scaleColor(c, factor) {\r\n const r1 = (c >> 16) & 0xff;\r\n const g1 = (c >> 8) & 0xff;\r\n const b1 = c & 0xff;\r\n const r = factor * r1;\r\n const g = factor * g1;\r\n const b = factor * b1;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports CarbonColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on selection carbon atoms.\r\n */\r\nclass CarbonColorer extends Colorer {\r\n static id = 'CB';\r\n\r\n getAtomColor(atom, _complex) {\r\n const colorCarbon = this.opts.color;\r\n const colorNotCarbon = scaleColor(colorCarbon, this.opts.factor);\r\n return (atom.flags & Atom.Flags.CARBON) ? colorCarbon : colorNotCarbon;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nCarbonColorer.prototype.id = 'CB';\r\nCarbonColorer.prototype.name = 'Carbon';\r\nCarbonColorer.prototype.shortName = 'Carbon';\r\n\r\nexport default CarbonColorer;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport ElementColorer from './colorers/ElementColorer';\r\nimport ResidueTypeColorer from './colorers/ResidueTypeColorer';\r\nimport SequenceColorer from './colorers/SequenceColorer';\r\nimport ChainColorer from './colorers/ChainColorer';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\nimport UniformColorer from './colorers/UniformColorer';\r\nimport ConditionalColorer from './colorers/ConditionalColorer';\r\nimport ConformationColorer from './colorers/ConformationColorer';\r\nimport TemperatureColorer from './colorers/TemperatureColorer';\r\nimport OccupancyColorer from './colorers/OccupancyColorer';\r\nimport HydrophobicityColorer from './colorers/HydrophobicityColorer';\r\nimport MoleculeColorer from './colorers/MoleculeColorer';\r\nimport CarbonColorer from './colorers/CarbonColorer';\r\n\r\nconst colorers = new EntityList([\r\n ElementColorer,\r\n ResidueTypeColorer,\r\n SequenceColorer,\r\n ChainColorer,\r\n SecondaryStructureColorer,\r\n UniformColorer,\r\n ConditionalColorer,\r\n ConformationColorer,\r\n TemperatureColorer,\r\n OccupancyColorer,\r\n HydrophobicityColorer,\r\n MoleculeColorer,\r\n CarbonColorer,\r\n]);\r\n\r\nexport default colorers;\r\n","import * as THREE from 'three';\r\nimport EntityList from '../utils/EntityList';\r\n\r\nfunction neutralColor(intensity) {\r\n return new THREE.Color(intensity, intensity, intensity);\r\n}\r\n\r\nconst materialList = [\r\n {\r\n id: 'DF',\r\n name: 'Diffuse',\r\n shortName: 'Diffuse',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'SF',\r\n name: 'Soft Plastic',\r\n shortName: 'Soft',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.1),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'PL',\r\n name: 'Glossy Plastic',\r\n shortName: 'Glossy',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.28),\r\n shininess: 100,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'ME',\r\n name: 'Metal',\r\n shortName: 'Metal',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.55),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TR',\r\n name: 'Transparent',\r\n shortName: 'Transparent',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'GL',\r\n name: 'Glass',\r\n shortName: 'Glass',\r\n uberOptions: {\r\n diffuse: neutralColor(0.50),\r\n specular: neutralColor(0.65),\r\n shininess: 100,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'BA',\r\n name: 'Backdrop',\r\n shortName: 'Backdrop',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: false,\r\n depthWrite: false,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TN',\r\n name: 'Toon',\r\n shortName: 'Toon',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: true,\r\n },\r\n }, {\r\n id: 'FL',\r\n name: 'Flat',\r\n shortName: 'Flat',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 0,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n },\r\n },\r\n];\r\n\r\nconst materials = new EntityList(materialList);\r\n\r\nexport default materials;\r\n","/**\r\n * Utils functions which is worked with meshes\r\n *\r\n * functions for doing something with all/specified meshes\r\n * functions for traversihg tree and create auxiliary meshes for transparency/shadowmaps...\r\n * functions for calculating data connected with meshes\r\n */\r\nimport * as THREE from 'three';\r\nimport UberMaterial from './shaders/UberMaterial';\r\nimport gfxutils from './gfxutils';\r\n\r\nfunction _gatherObjects(root, meshTypes) {\r\n const meshes = [];\r\n root.traverse((object) => {\r\n for (let i = 0; i < meshTypes.length; i++) {\r\n if (object instanceof meshTypes[i]) {\r\n meshes[meshes.length] = object;\r\n break;\r\n }\r\n }\r\n });\r\n return meshes;\r\n}\r\n\r\n// new mesh with the same geometry and specified material values and layer\r\nfunction createDerivativeMesh(mesh, values, layer) {\r\n const material = mesh.material.createInstance();\r\n material.setValues(values);\r\n\r\n const newMesh = new mesh.constructor(mesh.geometry, material);\r\n newMesh.material.needsUpdate = true;\r\n newMesh.applyMatrix4(mesh.matrix);\r\n newMesh.layers.set(layer);\r\n return newMesh;\r\n}\r\n\r\nfunction traverseMeshes(root, meshTypes, func) {\r\n const meshes = _gatherObjects(root, meshTypes);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n if (!mesh.parent) {\r\n continue;\r\n }\r\n func(mesh);\r\n }\r\n}\r\n\r\nfunction applyTransformsToMeshes(root, mtc) {\r\n const mtcCount = mtc.length;\r\n if (mtcCount < 1) {\r\n return;\r\n }\r\n\r\n const meshTypes = [THREE.Mesh, THREE.LineSegments, THREE.Line];\r\n traverseMeshes(root, meshTypes, (mesh) => {\r\n mesh.applyMatrix4(mtc[0]);\r\n for (let j = 1; j < mtcCount; ++j) {\r\n const newMesh = new mesh.constructor(mesh.geometry, mesh.material);\r\n mesh.parent.add(newMesh);\r\n newMesh.applyMatrix4(mtc[j]);\r\n }\r\n });\r\n}\r\n\r\nconst processTransparentMaterial = (function () {\r\n const matValues = {\r\n prepassTransparancy: true,\r\n fakeOpacity: false,\r\n transparent: false,\r\n colorFromDepth: false,\r\n lights: false,\r\n shadowmap: false,\r\n fog: false,\r\n };\r\n\r\n return function (root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n mesh.material.setValues({ prepassTransparancy: false, fakeOpacity: false });\r\n mesh.material.needsUpdate = true;\r\n mesh.layers.set(gfxutils.LAYERS.TRANSPARENT);\r\n\r\n const prepassTranspMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.PREPASS_TRANSPARENT);\r\n mesh.parent.add(prepassTranspMesh);\r\n });\r\n };\r\n}());\r\n\r\nconst processColFromPosMaterial = (function () {\r\n const matValues = {\r\n colorFromPos: true,\r\n transparent: false,\r\n colorFromDepth: false,\r\n lights: false,\r\n shadowmap: false,\r\n fog: false,\r\n overrideColor: false,\r\n fogTransparent: false,\r\n attrColor: false,\r\n attrColor2: false,\r\n attrAlphaColor: false,\r\n fakeOpacity: false,\r\n };\r\n\r\n return function (root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n const colFromPosMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.COLOR_FROM_POSITION);\r\n mesh.parent.add(colFromPosMesh);\r\n });\r\n };\r\n}());\r\n\r\nconst createShadowmapMaterial = (function () {\r\n const matValues = {\r\n colorFromDepth: true,\r\n orthoCam: true,\r\n lights: false,\r\n shadowmap: false,\r\n fog: false,\r\n };\r\n\r\n return function (root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n if (!mesh.receiveShadow && mesh.material.shadowmap) { // remove shadow from non-receivers\r\n mesh.material.setValues({ shadowmap: false });\r\n }\r\n if (!mesh.material.lights) { // skip creating shadowmap meshes for materials without lighting\r\n return;\r\n }\r\n if (!mesh.castShadow) { // skip creating shadowmap meshes for non-casters\r\n return;\r\n }\r\n if (!gfxutils.belongToSelectLayers(mesh)) { // skip creating shadowmap meshes for selection layer\r\n return;\r\n }\r\n\r\n const shadowmapMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.SHADOWMAP);\r\n shadowmapMesh.isShadowmapMesh = true;\r\n mesh.parent.add(shadowmapMesh);\r\n });\r\n };\r\n}());\r\n\r\nfunction removeShadowmapMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n if (mesh.isShadowmapMesh) {\r\n mesh.parent.remove(mesh);\r\n }\r\n });\r\n}\r\n\r\nfunction forEachMeshInGroup(group, process) {\r\n function processObj(object) {\r\n if (object instanceof THREE.Mesh) {\r\n process(object);\r\n }\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n processObj(object.children[i]);\r\n }\r\n }\r\n processObj(group);\r\n}\r\n\r\nfunction _countMeshTriangles(mesh) {\r\n const geom = mesh.geometry;\r\n if (geom instanceof THREE.InstancedBufferGeometry) {\r\n const attribs = geom.attributes;\r\n for (const property in attribs) {\r\n if (attribs.hasOwnProperty(property) && attribs[property] instanceof THREE.InstancedBufferAttribute) {\r\n const currAttr = attribs[property];\r\n const indexSize = geom.index ? geom.index.array.length / 3 : 0;\r\n return indexSize * currAttr.array.length / currAttr.itemSize;\r\n }\r\n }\r\n return 0;\r\n }\r\n if (geom instanceof THREE.BufferGeometry) {\r\n return geom.index ? geom.index.array.length / 3 : 0;\r\n }\r\n return geom.faces ? geom.faces.length : 0;\r\n}\r\n\r\nfunction countTriangles(group) {\r\n let totalCount = 0;\r\n forEachMeshInGroup(group, (mesh) => {\r\n totalCount += _countMeshTriangles(mesh);\r\n });\r\n return totalCount;\r\n}\r\n\r\nexport default {\r\n applyTransformsToMeshes,\r\n processTransparentMaterial,\r\n processColFromPosMaterial,\r\n createShadowmapMaterial,\r\n removeShadowmapMaterial,\r\n forEachMeshInGroup,\r\n countTriangles,\r\n};\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport UberMaterial from './shaders/UberMaterial';\r\nimport gfxutils from './gfxutils';\r\nimport meshutils from './meshutils';\r\nimport settings from '../settings';\r\nimport materials from './materials';\r\nimport chem from '../chem';\r\n\r\nconst { selectors } = chem;\r\n\r\nclass Representation {\r\n constructor(index, mode, colorer, selector) {\r\n const startMaterialValues = {\r\n clipPlane: settings.now.draft.clipPlane,\r\n fogTransparent: settings.now.bg.transparent,\r\n shadowmap: settings.now.shadow.on,\r\n shadowmapType: settings.now.shadow.type,\r\n };\r\n this.index = index;\r\n this.mode = mode;\r\n this.colorer = colorer;\r\n this.selector = selector;\r\n this.selectorString = '';\r\n this.count = 0;\r\n this.material = new UberMaterial();\r\n this.material.setValues(startMaterialValues);\r\n this.material.setUberOptions({ fogAlpha: settings.now.fogAlpha });\r\n this.materialPreset = materials.first;\r\n this.needsRebuild = true;\r\n this.visible = true;\r\n\r\n // apply mode params & preset\r\n this.setMode(mode);\r\n }\r\n\r\n markAtoms(complex) {\r\n this.count = complex.markAtoms(this.selector, 1 << this.index);\r\n this.needsRebuild = true;\r\n return this.count;\r\n }\r\n\r\n unmarkAtoms(complex) {\r\n complex.clearAtomBits(1 << this.index);\r\n this.count = 0;\r\n }\r\n\r\n setMode(mode) {\r\n this.mode = mode;\r\n }\r\n\r\n setMaterialPreset(preset) {\r\n this.materialPreset = preset;\r\n this.material.setUberOptions(preset.uberOptions);\r\n this.material.setValues(preset.values);\r\n }\r\n\r\n reset() {\r\n this.geo = null;\r\n this.selectionGeo = null;\r\n }\r\n\r\n buildGeometry(complex) {\r\n this.reset();\r\n this.needsRebuild = false;\r\n\r\n if (settings.now.ao) {\r\n this.material.setValues({ normalsToGBuffer: settings.now.ao });\r\n }\r\n\r\n this.geo = this.mode.buildGeometry(complex, this.colorer, 1 << this.index, this.material);\r\n\r\n if (this.material.uberOptions.opacity < 0.99 && settings.now.transparency === 'prepass') {\r\n meshutils.processTransparentMaterial(this.geo, this.material);\r\n }\r\n this.geo.visible = this.visible;\r\n\r\n gfxutils.processObjRenderOrder(this.geo, this.materialPreset.id);\r\n meshutils.processColFromPosMaterial(this.geo, this.material);\r\n\r\n if (settings.now.shadow.on) {\r\n meshutils.createShadowmapMaterial(this.geo, this.material);\r\n }\r\n\r\n return this.geo;\r\n }\r\n\r\n buildSelectionGeometry(mask) {\r\n let sg = null;\r\n\r\n if (this.geo && ('getSubset' in this.geo)) {\r\n const meshes = this.geo.getSubset(mask);\r\n if (meshes && meshes.length > 0) {\r\n sg = new THREE.Group();\r\n sg.matrixAutoUpdate = false;\r\n sg.matrix = this.geo.matrix;\r\n\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n sg.add(m);\r\n }\r\n }\r\n }\r\n\r\n if (sg) {\r\n sg.visible = this.visible;\r\n }\r\n\r\n this.selectionGeo = sg;\r\n return this.selectionGeo;\r\n }\r\n\r\n /**\r\n * Create object that represents difference between current and another rep\r\n * anotherRep could be undefined. In this case everything is reported.\r\n */\r\n compare(repSettings) {\r\n const diff = {};\r\n\r\n const selStr = String(this.selector);\r\n if (!repSettings || selStr.valueOf() !== String(repSettings.selector).valueOf()) {\r\n diff.selector = selStr;\r\n }\r\n\r\n const modeDiff = this.mode.identify();\r\n if (!repSettings || Array.isArray(modeDiff) || modeDiff !== repSettings.mode) {\r\n diff.mode = modeDiff;\r\n }\r\n\r\n const colorerDiff = this.colorer.identify();\r\n if (!repSettings || Array.isArray(colorerDiff) || colorerDiff !== repSettings.colorer) {\r\n diff.colorer = colorerDiff;\r\n }\r\n\r\n if (!repSettings || this.materialPreset.id !== repSettings.material) {\r\n diff.material = this.materialPreset.id;\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n /**\r\n * Change representation. Write fields what was changed into new object, return it.\r\n */\r\n change(repSettings, complex, mode, color) {\r\n const diff = {};\r\n\r\n // modify selector\r\n if (repSettings.selector) {\r\n const newSelectorObject = selectors.parse(repSettings.selector).selector;\r\n const newSelector = String(newSelectorObject);\r\n if (this.selectorString !== newSelector) {\r\n diff.selector = newSelector;\r\n this.selectorString = newSelector;\r\n this.selector = newSelectorObject;\r\n this.markAtoms(complex);\r\n }\r\n }\r\n\r\n // modify mode\r\n if (repSettings.mode) {\r\n const newMode = repSettings.mode;\r\n if (!_.isEqual(this.mode.identify(), newMode)) {\r\n diff.mode = newMode;\r\n this.setMode(mode);\r\n }\r\n }\r\n\r\n // modify colorer\r\n if (repSettings.colorer) {\r\n const newColorer = repSettings.colorer;\r\n if (!_.isEqual(this.colorer.identify(), newColorer)) {\r\n diff.colorer = newColorer;\r\n this.colorer = color;\r\n }\r\n }\r\n\r\n // modify material\r\n if (repSettings.material) {\r\n const newMaterial = repSettings.material;\r\n if (!_.isEqual(this.materialPreset.id, newMaterial)) {\r\n diff.material = newMaterial;\r\n this.setMaterialPreset(materials.get(repSettings.material));\r\n }\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n show(visible) {\r\n this.visible = visible;\r\n if (this.geo) {\r\n this.geo.visible = visible;\r\n }\r\n if (this.selectionGeo) {\r\n this.selectionGeo.visible = visible;\r\n }\r\n }\r\n}\r\n\r\nexport default Representation;\r\n","import * as THREE from 'three';\r\nimport logger from './utils/logger';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport './gfx/modes';\r\n\r\nfunction _traverseComponentGroups(root, component, callback) {\r\n const { children } = root;\r\n if (!children) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n if (child._component === component) {\r\n callback(child);\r\n }\r\n if (child instanceof gfxutils.RCGroup) {\r\n _traverseComponentGroups(child, component, callback);\r\n }\r\n }\r\n}\r\n\r\nfunction ComplexEditor() {\r\n}\r\n\r\nclass ComplexComponentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n // init component matrices\r\n this._componentTransforms = [];\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n const component = complex._components[i];\r\n this._componentTransforms[component._index] = new THREE.Object3D();\r\n }\r\n\r\n this._inProgress = true;\r\n\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const complex = this._complexVisual.getComplex();\r\n\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n this._bakeComponentTransform(complex._components[i]);\r\n }\r\n\r\n complex.onAtomPositionChanged();\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n const visual = this._complexVisual;\r\n const component = visual.getSelectedComponent();\r\n\r\n if (component === null) {\r\n return res;\r\n }\r\n\r\n const selection = this._complexVisual.getSelectionGeo();\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n // find all geo nodes for this component\r\n _traverseComponentGroups(visual, component, (child) => {\r\n res.objects.push(child);\r\n });\r\n\r\n // find all selection nodes for this component\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component') && geo._component === component) {\r\n res.objects.push(geo);\r\n }\r\n }\r\n }\r\n\r\n // add dummy object that stores component transformation\r\n res.objects.push(this._componentTransforms[component._index]);\r\n\r\n const bbmin = new THREE.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n const bbmax = new THREE.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (j = 0; j < atoms.length; ++j) {\r\n if (atoms[j].mask & selectionMask) {\r\n bbmin.min(atoms[j].position);\r\n bbmax.max(atoms[j].position);\r\n }\r\n }\r\n });\r\n\r\n res.pivot.lerpVectors(bbmin, bbmax, 0.5);\r\n return res;\r\n }\r\n\r\n _bakeComponentTransform(component) {\r\n const t = this._componentTransforms[component._index];\r\n if (t && (!(t.position.x === 0 && t.position.y === 0 && t.position.z === 0)\r\n || !(t.quaternion.x === 0 && t.quaternion.y === 0 && t.quaternion.z === 0 && t.quaternion.w === 1))) {\r\n t.updateMatrix();\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (let j = 0; j < atoms.length; ++j) {\r\n atoms[j].position.applyMatrix4(t.matrix);\r\n }\r\n });\r\n }\r\n }\r\n\r\n _resetComponentTransform() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n for (i = 0; i < this._componentTransforms.length; ++i) {\r\n geo = this._componentTransforms[i];\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n\r\n // reset all geo nodes\r\n for (i = 0; i < visual.children.length; ++i) {\r\n reprNode = visual.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n // reset all selection nodes\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nclass ComplexFragmentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n const atoms = this._getSelectionBorderAtoms();\r\n if (atoms.length < 1 || atoms.length > 2) {\r\n logger.error('Can only edit fragments with one or two bound atoms.');\r\n return false;\r\n }\r\n\r\n this._fragmentBoundAtoms = atoms;\r\n\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n\r\n // hide selected fragment in main model\r\n visual.disableSubset(selectionMask, true);\r\n\r\n // hide selection geo in main model\r\n for (let k = 0; k < selection.children.length; ++k) {\r\n selection.children[k].visible = false;\r\n }\r\n\r\n // create visible fragment representation to rotate\r\n const pivotPos = atoms[0].position.clone();\r\n\r\n if (atoms.length === 2) {\r\n pivotPos.lerp(atoms[1].position, 0.5);\r\n }\r\n\r\n this._fragmentGeo = new THREE.Group();\r\n visual.add(this._fragmentGeo);\r\n this._fragmentGeo.position.copy(pivotPos);\r\n\r\n this._fragmentSelectionGeo = new THREE.Group();\r\n selection.add(this._fragmentSelectionGeo);\r\n this._fragmentSelectionGeo.position.copy(pivotPos);\r\n\r\n const offset = pivotPos.clone();\r\n offset.negate();\r\n\r\n for (let i = 0; i < visual.children.length; ++i) {\r\n const g = visual.children[i];\r\n if (!('getSubset' in g)) {\r\n continue;\r\n }\r\n\r\n const vg = new THREE.Group();\r\n this._fragmentGeo.add(vg);\r\n\r\n const sg = new THREE.Group();\r\n this._fragmentSelectionGeo.add(sg);\r\n\r\n const meshes = g.getSubset(selectionMask, true);\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n vg.add(m);\r\n m.position.copy(offset);\r\n }\r\n\r\n const smeshes = g.getSubset(selectionMask, true);\r\n for (let h = 0; h < smeshes.length; h++) {\r\n const sm = smeshes[h];\r\n sg.add(sm);\r\n sm.position.copy(offset);\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(this._fragmentSelectionGeo);\r\n\r\n this._inProgress = true;\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selectionBit = visual.getSelectionBit();\r\n\r\n const p = this._fragmentGeo.position;\r\n const m = this._fragmentGeo.matrix.clone();\r\n m.multiply(new THREE.Matrix4().makeTranslation(-p.x, -p.y, -p.z));\r\n\r\n this._bakeAtomTransform(m, 1 << selectionBit);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << selectionBit, true);\r\n\r\n visual.getComplex().onAtomPositionChanged();\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n this._fragmentGeo.parent.remove(this._fragmentGeo);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << visual.getSelectionBit(), true);\r\n\r\n // show selection geo in main model (+ remove fragment selection geo)\r\n for (let i = 0; i < selection.children.length; ++i) {\r\n const node = selection.children[i];\r\n if (node.visible) {\r\n selection.remove(node);\r\n } else {\r\n node.visible = true;\r\n }\r\n }\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n isFreeRotationAllowed() {\r\n return (this._fragmentBoundAtoms.length < 2);\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n res.objects.push(this._fragmentGeo, this._fragmentSelectionGeo);\r\n\r\n const boundAtoms = this._fragmentBoundAtoms;\r\n if (boundAtoms.length === 1) {\r\n if (boundAtoms[0].bonds.length === 1) {\r\n // single external bond allows rotation about bond axis\r\n const bond = boundAtoms[0].bonds[0];\r\n res.axis = new THREE.Vector3().subVectors(bond._right.position, bond._left.position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n } else if (boundAtoms.length === 2) {\r\n // two bound atoms allow rotation only about axis running through their centers\r\n res.axis = new THREE.Vector3().subVectors(boundAtoms[1].position, boundAtoms[0].position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _getSelectionBorderAtoms() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n const selectionMask = 1 << this._complexVisual.getSelectionBit();\r\n const atomHash = {};\r\n\r\n complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n atomHash[bond._left.index] = 1;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n atomHash[bond._right.index] = 1;\r\n }\r\n });\r\n\r\n const atoms = [];\r\n const keys = Object.keys(atomHash);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const idx = keys[i];\r\n atoms.push(complex._atoms[idx]);\r\n }\r\n\r\n return atoms;\r\n }\r\n\r\n _bakeAtomTransform(matrix, mask) {\r\n this._complexVisual.getComplex().forEachAtom((atom) => {\r\n if (atom.mask & mask) {\r\n atom.position.applyMatrix4(matrix);\r\n }\r\n });\r\n }\r\n}\r\n\r\nexport default {\r\n ComponentEditor: ComplexComponentEditor,\r\n FragmentEditor: ComplexFragmentEditor,\r\n};\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\nimport chem from './chem';\r\nimport settings from './settings';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport Visual from './Visual';\r\nimport ComplexVisualEdit from './ComplexVisualEdit';\r\nimport meshutils from './gfx/meshutils';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction lookupAndCreate(entityList, specs) {\r\n if (!Array.isArray(specs)) {\r\n specs = [specs];\r\n }\r\n const [id, opts] = specs;\r\n const Entity = entityList.get(id) || entityList.first;\r\n return new Entity(opts);\r\n}\r\n\r\nclass ComplexVisual extends Visual {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this._complex = dataSource;\r\n\r\n /** @type {Representation[]} */\r\n this._reprList = [];\r\n /** @type {?Representation} */\r\n this._repr = null;\r\n this._reprListChanged = true;\r\n\r\n this._selectionBit = 0;\r\n this._reprUsedBits = 0;\r\n this._selectionCount = 0;\r\n\r\n this._selectionGeometry = new THREE.Group();\r\n }\r\n\r\n getBoundaries() {\r\n return this._complex.getBoundaries();\r\n }\r\n\r\n release() {\r\n if (this._selectionGeometry.parent) {\r\n this._selectionGeometry.remove(this._selectionGeometry);\r\n }\r\n Visual.prototype.release.call(this);\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getSelectionCount() {\r\n return this._selectionCount;\r\n }\r\n\r\n getSelectionGeo() {\r\n return this._selectionGeometry;\r\n }\r\n\r\n getSelectionBit() {\r\n return this._selectionBit;\r\n }\r\n\r\n getEditor() {\r\n return this._editor;\r\n }\r\n\r\n resetReps(reps) {\r\n // Create all necessary representations\r\n if (this._complex) {\r\n this._complex.clearAtomBits(~0);\r\n }\r\n this._reprListChanged = true;\r\n this._reprUsedBits = 0;\r\n this._reprList.length = reps.length;\r\n for (let i = 0, n = reps.length; i < n; ++i) {\r\n const rep = reps[i];\r\n\r\n let selector;\r\n let selectorString;\r\n if (typeof rep.selector === 'string') {\r\n selectorString = rep.selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else if (typeof rep.selector === 'undefined') {\r\n selectorString = settings.now.presets.default[0].selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else {\r\n ({ selector } = rep);\r\n selectorString = selector.toString();\r\n }\r\n const mode = lookupAndCreate(modes, rep.mode);\r\n const colorer = lookupAndCreate(colorers, rep.colorer);\r\n const material = materials.get(rep.material) || materials.first;\r\n\r\n this._reprList[i] = new Representation(i, mode, colorer, selector);\r\n this._reprList[i].setMaterialPreset(material);\r\n this._reprList[i].selectorString = selectorString;\r\n\r\n if (this._complex) {\r\n this._complex.markAtoms(selector, 1 << i);\r\n }\r\n\r\n this._reprUsedBits |= 1 << i;\r\n }\r\n this._repr = reps.length > 0 ? this._reprList[0] : null;\r\n\r\n this._selectionBit = reps.length;\r\n this._reprUsedBits |= 1 << this._selectionBit; // selection uses one bit\r\n this._selectionCount = 0;\r\n\r\n if (this._complex) {\r\n this._complex.update();\r\n }\r\n }\r\n\r\n /**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\n repCount() {\r\n return this._reprList.length;\r\n }\r\n\r\n /**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\n repCurrent(index) {\r\n if (index >= 0 && index < this._reprList.length) {\r\n this._repr = this._reprList[index];\r\n } else {\r\n index = this._reprList.indexOf(this._repr);\r\n }\r\n return index;\r\n }\r\n\r\n /**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {Object} {desc, index, status} field desc contains rep description, index - index of correspondent rep,\r\n * status - one of three strings: 'created', 'changed', ''. 'created' means new rep was created during this function,\r\n * 'changed' - rep was changed during this function. '' - something else.\r\n */\r\n rep(index, rep) {\r\n // if index is missing then it is the current\r\n if (!rep && (index === undefined || index instanceof Object)) {\r\n rep = index;\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index > this._reprList.length) {\r\n logger.error(`Rep ${index} does not exist!`);\r\n return null;\r\n }\r\n\r\n // a special case of adding just after the end\r\n if (index === this._reprList.length) {\r\n const res = this.repAdd(rep);\r\n logger.warn(`Rep ${index} does not exist! New representation was created.`);\r\n return { desc: res.desc, index, status: 'created' };\r\n }\r\n\r\n // gather description\r\n const target = this._reprList[index];\r\n const desc = {\r\n selector: target.selectorString,\r\n mode: target.mode.identify(),\r\n colorer: target.colorer.identify(),\r\n material: target.materialPreset.id,\r\n };\r\n\r\n // modification is requested\r\n if (rep) {\r\n // modify\r\n const diff = target.change(\r\n rep,\r\n this._complex,\r\n lookupAndCreate(modes, rep.mode),\r\n lookupAndCreate(colorers, rep.colorer),\r\n );\r\n\r\n // something was changed\r\n if (!_.isEmpty(diff)) {\r\n target.needsRebuild = true;\r\n for (const key in diff) {\r\n if (diff.hasOwnProperty(key)) {\r\n desc[key] = diff[key];\r\n logger.debug(`rep[${index}].${key} changed to ${diff[key]}`);\r\n }\r\n }\r\n\r\n // safety trick: lower resolution for surface modes\r\n if (diff.mode && target.mode.isSurface\r\n && (settings.now.resolution === 'ultra' || settings.now.resolution === 'high')) {\r\n logger.report('Surface resolution was changed to \"medium\" to avoid hang-ups.');\r\n settings.set('resolution', 'medium');\r\n }\r\n return { desc, index, status: 'changed' };\r\n }\r\n }\r\n return { desc, index, status: '' };\r\n }\r\n\r\n /**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\n repGet(index) {\r\n // if index is missing then it is the current\r\n if (index === undefined || index instanceof Object) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return null;\r\n }\r\n\r\n return this._reprList[index];\r\n }\r\n\r\n _getFreeReprIdx() {\r\n let bits = this._reprUsedBits;\r\n for (let i = 0; i <= ComplexVisual.NUM_REPRESENTATION_BITS; ++i, bits >>= 1) {\r\n if ((bits & 1) === 0) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {Object} {desc, index} field desc contains added rep description, index - index of this rep.\r\n */\r\n repAdd(rep) {\r\n if (this._reprList.length >= ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n return null;\r\n }\r\n\r\n const newSelectionBit = this._getFreeReprIdx();\r\n if (newSelectionBit < 0) {\r\n return null; // no more slots for representations\r\n }\r\n\r\n const originalSelection = this.buildSelectorFromMask(1 << this._selectionBit);\r\n\r\n // Fill in default values\r\n const def = settings.now.presets.default[0];\r\n const desc = _.merge({\r\n selector: def.selector,\r\n mode: def.mode,\r\n colorer: def.colorer,\r\n material: def.material,\r\n }, rep);\r\n\r\n const selector = (typeof desc.selector === 'string') ? selectors.parse(desc.selector).selector : desc.selector;\r\n const target = new Representation(\r\n this._selectionBit,\r\n lookupAndCreate(modes, desc.mode),\r\n lookupAndCreate(colorers, desc.colorer),\r\n selector,\r\n );\r\n target.selectorString = selector.toString();\r\n target.setMaterialPreset(materials.get(desc.material));\r\n target.markAtoms(this._complex);\r\n this._reprList.push(target);\r\n\r\n // change selection bit\r\n this._selectionBit = newSelectionBit;\r\n this._reprUsedBits |= 1 << this._selectionBit;\r\n\r\n // restore selection using new selection bit\r\n this._complex.markAtoms(originalSelection, 1 << this._selectionBit);\r\n\r\n return { desc, index: this._reprList.length - 1 };\r\n }\r\n\r\n /**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\n repRemove(index) {\r\n if (index === undefined) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // catch out of bounds case\r\n let count = this._reprList.length;\r\n if (index < 0 || index >= count || count <= 1) { // do not allow to remove the single rep\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.unmarkAtoms(this._complex);\r\n this._reprUsedBits &= ~(1 << target.index);\r\n\r\n this._reprList.splice(index, 1);\r\n\r\n // update current rep\r\n if (target === this._repr) {\r\n --count;\r\n index = index < count ? index : count - 1;\r\n this._repr = this._reprList[index];\r\n }\r\n this._reprListChanged = true;\r\n }\r\n\r\n /**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\n repHide(index, hide) {\r\n if (hide === undefined) {\r\n hide = true;\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.show(!hide);\r\n }\r\n\r\n /**\r\n * Select atoms with selector\r\n * @param {Selector} selector - selector\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\n select(selector, append) {\r\n if (append) {\r\n this._selectionCount += this._complex.markAtomsAdditionally(selector, 1 << this._selectionBit);\r\n } else {\r\n this._selectionCount = this._complex.markAtoms(selector, 1 << this._selectionBit);\r\n }\r\n this._complex.updateStructuresMask();\r\n this.rebuildSelectionGeometry();\r\n }\r\n\r\n resetSelectionMask() {\r\n if (this._selectionCount !== 0) {\r\n this._selectionCount = 0;\r\n if (this._complex) {\r\n this._complex.clearAtomBits(1 << this._selectionBit);\r\n }\r\n }\r\n }\r\n\r\n updateSelectionMask(pickedObj) {\r\n const self = this;\r\n const { atom } = pickedObj;\r\n let { residue, chain, molecule } = pickedObj;\r\n const setMask = 1 << this._selectionBit;\r\n const clearMask = ~setMask;\r\n\r\n if (atom) {\r\n residue = atom.residue;\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (atom.mask & setMask) {\r\n atom.mask &= clearMask;\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n if (molecule) {\r\n molecule.mask &= clearMask;\r\n }\r\n this._selectionCount--;\r\n } else {\r\n atom.mask |= setMask;\r\n this._selectionCount++;\r\n\r\n // select residue if all atoms in it are selected\r\n residue.collectMask();\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (residue) {\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (residue._mask & setMask) {\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n residue.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n } else {\r\n residue._mask |= setMask;\r\n residue.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (chain || molecule) {\r\n const obj = chain || molecule;\r\n if (obj._mask & setMask) {\r\n obj._mask &= clearMask;\r\n obj.forEachResidue((r) => {\r\n if (r._mask & setMask) {\r\n r._mask &= clearMask;\r\n r.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n r._mask &= clearMask;\r\n }\r\n });\r\n } else {\r\n obj._mask |= setMask;\r\n obj.forEachResidue((r) => {\r\n if (!(r._mask & setMask)) {\r\n r._mask |= setMask;\r\n r.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n const otherObj = chain ? r.getMolecule() : r.getChain();\r\n if (otherObj) {\r\n otherObj.collectMask();\r\n }\r\n }\r\n });\r\n }\r\n } else {\r\n this.resetSelectionMask();\r\n }\r\n }\r\n\r\n expandSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms to add\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // select marked atoms\r\n const deselectionMask = ~tmpMask;\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask = (atom.mask & deselectionMask) | selectionMask;\r\n ++self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n shrinkSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms neighbouring to unselected ones\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // mark hanging atoms\r\n this._complex.forEachAtom((atom) => {\r\n if ((atom.mask & selectionMask) && (atom.bonds.length === 1)) {\r\n atom.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // deselect marked atoms\r\n const deselectionMask = ~(selectionMask | tmpMask);\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask &= deselectionMask;\r\n --self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n getSelectedComponent() {\r\n const selectionMask = 1 << this._selectionBit;\r\n\r\n let component = null;\r\n let multiple = false;\r\n\r\n // find which component is selected (exclusively)\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & selectionMask) {\r\n if (component === null) {\r\n component = atom.residue._component;\r\n } else if (component !== atom.residue._component) {\r\n multiple = true;\r\n }\r\n }\r\n });\r\n\r\n return multiple ? null : component;\r\n }\r\n\r\n getSelectionCenter(center, includesAtom, selRule) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._complex.forEachAtom((atom) => {\r\n if (includesAtom(atom, selRule)) {\r\n center.add(atom.position);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.applyMatrix4(this.matrix);\r\n return true;\r\n }\r\n\r\n needsRebuild() {\r\n if (this._reprListChanged) {\r\n return true;\r\n }\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n if (repr.needsRebuild) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Rebuild molecule geometry asynchronously.\r\n */\r\n rebuild() {\r\n const self = this;\r\n\r\n // Destroy current geometry\r\n gfxutils.clearTree(this);\r\n\r\n return new Promise(((resolve) => {\r\n // Nothing to do?\r\n const complex = self._complex;\r\n if (!complex) {\r\n resolve();\r\n return;\r\n }\r\n\r\n let errorOccured = false;\r\n setTimeout(() => {\r\n console.time('build');\r\n const reprList = self._reprList;\r\n const palette = palettes.get(settings.now.palette) || palettes.first;\r\n let hasGeometry = false;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n repr.colorer.palette = palette;\r\n\r\n if (repr.needsRebuild) {\r\n repr.reset();\r\n\r\n try {\r\n repr.buildGeometry(complex);\r\n } catch (e) {\r\n if (e instanceof utils.OutOfMemoryError) {\r\n repr.needsRebuild = false;\r\n repr.reset();\r\n logger.error(`Not enough memory to build geometry for representation ${repr.index + 1}`);\r\n errorOccured = true;\r\n } else {\r\n throw e;\r\n }\r\n }\r\n\r\n if (DEBUG && !errorOccured) {\r\n logger.debug(`Triangles count: ${meshutils.countTriangles(repr.geo)}`);\r\n }\r\n }\r\n\r\n hasGeometry = errorOccured || hasGeometry || gfxutils.groupHasGeometryToRender(repr.geo);\r\n\r\n if (repr.geo) {\r\n self.add(repr.geo);\r\n }\r\n }\r\n\r\n self._reprListChanged = false;\r\n\r\n console.timeEnd('build');\r\n resolve();\r\n }, 10);\r\n }));\r\n }\r\n\r\n setNeedsRebuild() {\r\n // invalidate all representations\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n reprList[i].needsRebuild = true;\r\n }\r\n }\r\n\r\n rebuildSelectionGeometry() {\r\n const mask = 1 << this._selectionBit;\r\n\r\n gfxutils.clearTree(this._selectionGeometry);\r\n\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const repr = this._reprList[i];\r\n const sg = repr.buildSelectionGeometry(mask);\r\n if (!sg) {\r\n continue;\r\n }\r\n\r\n this._selectionGeometry.add(sg);\r\n for (let j = 0; j < sg.children.length; j++) {\r\n const m = sg.children[j];\r\n\r\n // copy component transform (that's not applied yet)\r\n // TODO make this code obsolete, accessing editor is bad\r\n if (this._editor && this._editor._componentTransforms) {\r\n const t = this._editor._componentTransforms[m._component._index];\r\n if (t) {\r\n m.position.copy(t.position);\r\n m.quaternion.copy(t.quaternion);\r\n }\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(sg);\r\n }\r\n }\r\n\r\n _buildSelectorFromSortedLists(atoms, residues, chains) {\r\n const complex = this._complex;\r\n\r\n function optimizeList(list) {\r\n const result = [];\r\n let k = 0;\r\n let first = NaN;\r\n let last = NaN;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const value = list[i];\r\n if (value === last + 1) {\r\n last = value;\r\n } else {\r\n if (!Number.isNaN(first)) {\r\n result[k++] = new selectors.Range(first, last);\r\n }\r\n first = last = value;\r\n }\r\n }\r\n if (!Number.isNaN(first)) {\r\n result[k] = new selectors.Range(first, last);\r\n }\r\n return result;\r\n }\r\n\r\n let expression = null;\r\n if (chains.length === complex._chains.length) {\r\n expression = selectors.all();\r\n } else {\r\n let selector;\r\n if (chains.length > 0) {\r\n selector = selectors.chain(chains);\r\n expression = expression ? selectors.or(expression, selector) : selector;// NOSONAR\r\n }\r\n if (Object.keys(residues).length > 0) {\r\n for (const ch in residues) {\r\n if (residues.hasOwnProperty(ch)) {\r\n selector = selectors.and(\r\n selectors.chain(ch),\r\n selectors.residx(optimizeList(residues[ch])),\r\n );\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n }\r\n }\r\n if (atoms.length > 0) {\r\n selector = selectors.serial(optimizeList(atoms));\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n\r\n if (!expression) {\r\n expression = selectors.none();\r\n }\r\n }\r\n\r\n return expression;\r\n }\r\n\r\n buildSelectorFromMask(mask) {\r\n const complex = this._complex;\r\n const chains = [];\r\n const residues = {};\r\n const atoms = [];\r\n\r\n complex.forEachChain((chain) => {\r\n if (chain._mask & mask) {\r\n chains.push(chain._name);\r\n }\r\n });\r\n\r\n complex.forEachResidue((residue) => {\r\n if (residue._mask & mask && !(residue._chain._mask & mask)) {\r\n const c = residue._chain._name;\r\n if (!(c in residues)) {\r\n residues[c] = [residue._index];\r\n } else {\r\n residues[c].push(residue._index);\r\n }\r\n }\r\n });\r\n\r\n complex.forEachAtom((atom) => {\r\n if (atom.mask & mask && !(atom.residue._mask & mask)) {\r\n atoms.push(atom.serial);\r\n }\r\n });\r\n\r\n return this._buildSelectorFromSortedLists(atoms, residues, chains);\r\n }\r\n\r\n forSelectedResidues(process) {\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.forEachResidue((residue) => {\r\n if (residue._mask & selectionMask) {\r\n process(residue);\r\n }\r\n });\r\n }\r\n\r\n beginComponentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.ComponentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n beginFragmentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.FragmentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n // should only be called by editors\r\n finalizeEdit() {\r\n this._editor = null;\r\n }\r\n\r\n setMaterialValues(values, needTraverse = false, process = undefined) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setValues(values);\r\n if (needTraverse) {\r\n rep.geo.traverse((object) => {\r\n if (object instanceof THREE.Mesh) {\r\n object.material.setValues(values);\r\n\r\n if (process !== undefined) {\r\n process(object);\r\n }\r\n\r\n object.material.needsUpdate = true;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n setUberOptions(values) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setUberOptions(values);\r\n }\r\n }\r\n\r\n /**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\n within(selector, radius) {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return false;\r\n }\r\n\r\n // mark atoms of the group as selected\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.markAtoms(selector, selectionMask);\r\n\r\n // mark all atoms within distance as selected\r\n if (vw) {\r\n vw.forEachAtomWithinDistFromMasked(this._complex, selectionMask, Number(radius), (atom) => {\r\n atom.mask |= selectionMask;\r\n });\r\n }\r\n\r\n // update selection count\r\n this._selectionCount = this._complex.countAtomsByMask(selectionMask);\r\n\r\n // update secondary structure mask\r\n this._complex.updateStructuresMask();\r\n\r\n return this.buildSelectorFromMask(selectionMask);\r\n }\r\n}\r\n// 32 bits = 30 bits for reps + 1 for selection + 1 for selection expansion\r\nComplexVisual.NUM_REPRESENTATION_BITS = 30;\r\n\r\nexport default ComplexVisual;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexVolumeFaces from './VolumeFaces.vert';\r\nimport fragmentVolumeFaces from './VolumeFaces.frag';\r\nimport vertexVolume from './Volume.vert';\r\nimport fragmentVolume from './Volume.frag';\r\nimport vertexFarPlane from './VolumeFarPlane.vert';\r\nimport fragmentFarPlane from './VolumeFarPlane.frag';\r\nimport settings from '../../settings';\r\n\r\nconst volumeUniforms = THREE.UniformsUtils.merge([\r\n {\r\n volumeDim: { type: 'v3', value: new THREE.Vector3(512, 512, 512) },\r\n tileTex: { type: 't', value: null },\r\n tileTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n tileStride: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n\r\n boxAngles: { type: 'v3', value: new THREE.Vector3(1, 1, 1) },\r\n delta: { type: 'v3', value: new THREE.Vector3(0, 0, 0) },\r\n\r\n _isoLevel0: { type: 'v2', value: new THREE.Vector3(0.5, 0.75, 1.0) },\r\n _flipV: { type: 'f', value: 0.0 },\r\n _BFLeft: { type: 't', value: null },\r\n _BFRight: { type: 't', value: null },\r\n _FFLeft: { type: 't', value: null },\r\n _FFRight: { type: 't', value: null },\r\n _WFFLeft: { type: 't', value: null },\r\n _WFFRight: { type: 't', value: null },\r\n },\r\n]);\r\n\r\nfunction overrideUniforms(params, defUniforms) {\r\n const uniforms = THREE.UniformsUtils.clone(defUniforms);\r\n for (const p in params) {\r\n if (uniforms.hasOwnProperty(p)) {\r\n uniforms[p].value = params[p];\r\n }\r\n }\r\n return uniforms;\r\n}\r\n\r\nfunction facesPosMaterialParams(params, sideType) {\r\n return {\r\n uniforms: overrideUniforms(params, {}),\r\n vertexShader: vertexVolumeFaces,\r\n fragmentShader: fragmentVolumeFaces,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n side: sideType,\r\n };\r\n}\r\n\r\nclass BackFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const backFaceParams = facesPosMaterialParams(params, THREE.BackSide);\r\n super(backFaceParams);\r\n }\r\n}\r\n\r\nclass ShaderParams {\r\n constructor(params, uniforms, vertexShader, fragmentShader) {\r\n this.uniforms = overrideUniforms(params, uniforms);\r\n this.vertexShader = vertexShader;\r\n this.fragmentShader = fragmentShader;\r\n this.transparent = false;\r\n this.depthTest = false;\r\n this.depthWrite = false;\r\n this.side = THREE.FrontSide;\r\n }\r\n}\r\n\r\nclass BackFacePosMaterialFarPlane extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const matUniforms = THREE.UniformsUtils.merge([\r\n {\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n farZ: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n matWorld2Volume: { type: '4fv', value: new THREE.Matrix4() },\r\n },\r\n ]);\r\n\r\n const shaderParams = new ShaderParams(params, matUniforms, vertexFarPlane, fragmentFarPlane);\r\n super(shaderParams);\r\n }\r\n}\r\n\r\nclass FrontFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const frontFaceParams = facesPosMaterialParams(params, THREE.FrontSide);\r\n super(frontFaceParams);\r\n }\r\n}\r\n\r\nclass VolumeMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const shaderParams = new ShaderParams(params, volumeUniforms, vertexVolume, fragmentVolume);\r\n shaderParams.transparent = true;\r\n shaderParams.depthTest = true;\r\n\r\n super(shaderParams);\r\n this.updateDefines();\r\n }\r\n\r\n updateDefines() {\r\n this.defines = {\r\n ISO_MODE: settings.now.modes.VD.isoMode,\r\n STEPS_COUNT: settings.now.modes.VD.polyComplexity[settings.now.resolution] * 100,\r\n };\r\n this.needsUpdate = true;\r\n }\r\n}\r\n\r\nexport default {\r\n BackFacePosMaterial,\r\n BackFacePosMaterialFarPlane,\r\n FrontFacePosMaterial,\r\n VolumeMaterial,\r\n};\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport settings from '../settings';\r\n\r\nclass VolumeMesh extends THREE.Mesh {\r\n volumeInfo = {}; // data for noise filter\r\n\r\n constructor() {\r\n const geo = new THREE.BufferGeometry();\r\n super(geo);\r\n this.clipPlane = new THREE.Plane();\r\n const size = new THREE.Vector3(0.5, 0.5, 0.5);\r\n this.size = size;\r\n\r\n this.cullFlag = [\r\n true, true, true, true,\r\n true, true, true, true,\r\n false, false, false, false, false, false,\r\n ];\r\n\r\n this.faces = [\r\n { indices: [], norm: new THREE.Vector3(0, 0, -1) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 1) },\r\n { indices: [], norm: new THREE.Vector3(0, -1, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 1, 0) },\r\n { indices: [], norm: new THREE.Vector3(-1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 0) },\r\n ];\r\n\r\n this.vertices = [\r\n new THREE.Vector3(-size.x, -size.y, -size.z),\r\n new THREE.Vector3(-size.x, size.y, -size.z),\r\n new THREE.Vector3(size.x, -size.y, -size.z),\r\n new THREE.Vector3(size.x, size.y, -size.z),\r\n new THREE.Vector3(-size.x, -size.y, size.z),\r\n new THREE.Vector3(-size.x, size.y, size.z),\r\n new THREE.Vector3(size.x, -size.y, size.z),\r\n new THREE.Vector3(size.x, size.y, size.z),\r\n new THREE.Vector3(0.0, 0.0, 0.0), // Placeholder for section\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n ];\r\n\r\n geo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(this.vertices.length * 3), 3));\r\n\r\n this.name = 'VolumeMesh';\r\n }\r\n\r\n static _corners = [\r\n // x, y, z, edge1, edge2, edge3\r\n [-1, -1, -1, 0, 4, 8],\r\n [1, -1, -1, 0, 5, 9],\r\n [1, 1, -1, 1, 5, 10],\r\n [-1, 1, -1, 1, 4, 11],\r\n [-1, -1, 1, 2, 6, 8],\r\n [1, -1, 1, 2, 7, 9],\r\n [1, 1, 1, 3, 7, 10],\r\n [-1, 1, 1, 3, 6, 11],\r\n ];\r\n\r\n static _edges = [\r\n // corner1, corner2, center_x, center_y, center_z\r\n [0, 1, 0, -1, -1],\r\n [2, 3, 0, 1, -1],\r\n [4, 5, 0, -1, 1],\r\n [6, 7, 0, 1, 1],\r\n [0, 3, -1, 0, -1],\r\n [1, 2, 1, 0, -1],\r\n [4, 7, -1, 0, 1],\r\n [5, 6, 1, 0, 1],\r\n [0, 4, -1, -1, 0],\r\n [1, 5, 1, -1, 0],\r\n [2, 6, -1, 1, 0],\r\n [3, 7, 1, 1, 0],\r\n ];\r\n\r\n static _edgeIntersections = (function () {\r\n const edgeIntersections = [];\r\n for (let j = 0; j < 12; ++j) {\r\n edgeIntersections.push(new THREE.Vector3());\r\n }\r\n return edgeIntersections;\r\n }());\r\n\r\n _updateVertices() {\r\n // Algorithm:\r\n // 1. Get plane parameters\r\n // 2. Compute culling flags for all vertices\r\n // 3. If intersection occurs => compute from 3 to 6 intersection points\r\n const corners = VolumeMesh._corners;\r\n const edges = VolumeMesh._edges;\r\n const edgeIntersections = VolumeMesh._edgeIntersections;\r\n\r\n let i;\r\n\r\n const norm = this.clipPlane.normal;\r\n const D = this.clipPlane.constant;\r\n\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n const cornerMark = [0, 0, 0, 0, 0, 0, 0, 0];\r\n const edgeMark = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];\r\n\r\n const curEdge = new THREE.Vector3();\r\n let curEdgeInter = null;\r\n\r\n function CheckX() {\r\n if (norm.x === 0) return 0;\r\n const x = -(norm.dot(curEdge) + D) / norm.x;\r\n if (-size.x <= x && x <= size.x) {\r\n curEdgeInter.set(x, curEdge.y, curEdge.z);\r\n if (x === size.x) return 2;\r\n if (x === -size.x) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckY() {\r\n if (norm.y === 0) return 0;\r\n const y = -(norm.dot(curEdge) + D) / norm.y;\r\n if (-size.y <= y && y <= size.y) {\r\n curEdgeInter.set(curEdge.x, y, curEdge.z);\r\n if (y === size.y) return 2;\r\n if (y === -size.y) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckZ() {\r\n if (norm.z === 0) return 0;\r\n const z = -(norm.dot(curEdge) + D) / norm.z;\r\n if (-size.z <= z && z <= size.z) {\r\n curEdgeInter.set(curEdge.x, curEdge.y, z);\r\n if (z === size.z) return 2;\r\n if (z === -size.z) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n // for each edge\r\n for (let curEdgeIdx = 0; curEdgeIdx < 12; ++curEdgeIdx) {\r\n const curEdgeSource = edges[curEdgeIdx];\r\n curEdgeInter = edgeIntersections[curEdgeIdx];\r\n\r\n curEdge.set(curEdgeSource[2], curEdgeSource[3], curEdgeSource[4]);\r\n curEdge.multiply(size);\r\n\r\n // calculate intersection point\r\n let flag = 0;\r\n if (curEdgeSource[2] === 0) flag = CheckX();\r\n if (curEdgeSource[3] === 0) flag = CheckY();\r\n if (curEdgeSource[4] === 0) flag = CheckZ();\r\n\r\n // mark corresponding corner (if plane cuts through one)\r\n if (flag === -2) {\r\n cornerMark[curEdgeSource[0]] = 1;\r\n } else if (flag === 2) {\r\n cornerMark[curEdgeSource[1]] = 1;\r\n } else if (flag === 0) {\r\n // edge is not intersected by the plane (doesn't produce a vertex)\r\n edgeMark[curEdgeIdx] = 0;\r\n }\r\n }\r\n\r\n const face = {\r\n indices: [],\r\n norm: norm.clone().negate(),\r\n };\r\n\r\n let nextVertex = 8;\r\n\r\n // for each marked corner\r\n for (i = 0; i < 8; ++i) {\r\n if (cornerMark[i] === 1) {\r\n // add corner as vertex to the face\r\n vert[nextVertex].set(corners[i][0], corners[i][1], corners[i][2]).multiply(size);\r\n face.indices.push(nextVertex++);\r\n // skip adjacent edges\r\n edgeMark[corners[i][3]] = 0;\r\n edgeMark[corners[i][4]] = 0;\r\n edgeMark[corners[i][5]] = 0;\r\n }\r\n }\r\n\r\n // for each edge that has internal intersection\r\n for (i = 0; i < 12; ++i) {\r\n if (edgeMark[i] === 1) {\r\n // add intersection point as vertex to the face\r\n vert[nextVertex].copy(edgeIntersections[i]);\r\n face.indices.push(nextVertex++);\r\n }\r\n }\r\n\r\n this.faces[6] = face;\r\n\r\n const diff = new THREE.Vector3();\r\n const coplanarPoint = new THREE.Vector3();\r\n this.clipPlane.coplanarPoint(coplanarPoint);\r\n for (i = 0; i < vert.length; ++i) {\r\n this.cullFlag[i] = false;\r\n if (i < 8) {\r\n // corners should be culled by clipping plane\r\n diff.subVectors(vert[i], coplanarPoint);\r\n this.cullFlag[i] = (norm.dot(diff) >= 0.0);\r\n } else if (i < 8 + face.indices.length) {\r\n // cross section vertices don't get culled\r\n this.cullFlag[i] = true;\r\n }\r\n }\r\n\r\n // write data to vertex buffer\r\n const positions = this.geometry.getAttribute('position');\r\n let idx = 0;\r\n for (i = 0; i < vert.length; ++i) {\r\n positions.array[idx++] = vert[i].x;\r\n positions.array[idx++] = vert[i].y;\r\n positions.array[idx++] = vert[i].z;\r\n }\r\n positions.needsUpdate = true;\r\n }\r\n\r\n _collectVertices(face, filter) {\r\n let i;\r\n const vert = this.vertices;\r\n face.indices = [];\r\n for (i = 0; i < vert.length; ++i) {\r\n if (this.cullFlag[i] && filter(vert[i])) {\r\n face.indices.push(i);\r\n }\r\n }\r\n }\r\n\r\n _sortIndices(face, right) {\r\n let i;\r\n let j;\r\n const vert = this.vertices;\r\n const angle = [];\r\n\r\n const dir = new THREE.Vector3();\r\n for (i = 1; i < face.indices.length; ++i) {\r\n dir.subVectors(vert[face.indices[i]], vert[face.indices[0]]);\r\n dir.normalize();\r\n dir.cross(right);\r\n dir.negate();\r\n angle[i] = face.norm.dot(dir);\r\n }\r\n\r\n // Exchange sort\r\n for (i = 1; i < face.indices.length - 1; ++i) {\r\n for (j = i + 1; j < face.indices.length; ++j) {\r\n if (angle[j] < angle[i]) {\r\n // swap\r\n let t = angle[i];\r\n angle[i] = angle[j];\r\n angle[j] = t;\r\n\r\n t = face.indices[i];\r\n face.indices[i] = face.indices[j];\r\n face.indices[j] = t;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _updateIndices() {\r\n // Algorithm:\r\n // 1. Get plane vertices (from 3 to 6 vertices)\r\n // 2. Get \"right\" vector in plane\r\n // 3. Sort vertices using Graham-like method\r\n // 4. Create indices\r\n\r\n let i;\r\n let faceIdx;\r\n let face;\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n this._collectVertices(this.faces[0], (vertex) => vertex.z === -size.z);\r\n this._collectVertices(this.faces[1], (vertex) => vertex.z === size.z);\r\n this._collectVertices(this.faces[2], (vertex) => vertex.y === -size.y);\r\n this._collectVertices(this.faces[3], (vertex) => vertex.y === size.y);\r\n this._collectVertices(this.faces[4], (vertex) => vertex.x === -size.x);\r\n this._collectVertices(this.faces[5], (vertex) => vertex.x === size.x);\r\n\r\n const vCenter = new THREE.Vector3();\r\n const vRight = new THREE.Vector3();\r\n const vDir = new THREE.Vector3();\r\n\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n\r\n if (face.indices.length === 0) continue;\r\n\r\n vCenter.set(0, 0, 0);\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vCenter.add(vert[face.indices[i]]);\r\n }\r\n vCenter.multiplyScalar(1.0 / face.indices.length);\r\n vRight.subVectors(vert[face.indices[0]], vCenter);\r\n vRight.normalize();\r\n\r\n const rightProj = [];\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vDir.subVectors(vert[face.indices[i]], vCenter);\r\n rightProj[i] = vDir.dot(vRight);\r\n }\r\n for (i = 1; i < face.indices.length; ++i) {\r\n if (rightProj[i] < rightProj[0]) {\r\n // swap\r\n let t = rightProj[0];\r\n rightProj[0] = rightProj[i];\r\n rightProj[i] = t;\r\n\r\n [t] = face.indices;\r\n face.indices[0] = face.indices[i];\r\n face.indices[i] = t;\r\n }\r\n }\r\n\r\n this._sortIndices(face, vRight);\r\n }\r\n\r\n let numIndices = 0;\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n if (face.indices.length >= 3) {\r\n numIndices += 3 * (face.indices.length - 2);\r\n }\r\n }\r\n let offset = 0;\r\n const indices = new Uint16Array(numIndices);\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n for (i = 0; i < face.indices.length - 2; ++i) {\r\n indices[offset] = face.indices[0]; // eslint-disable-line prefer-destructuring\r\n indices[offset + 1] = face.indices[i + 1];\r\n indices[offset + 2] = face.indices[i + 2];\r\n offset += 3;\r\n }\r\n }\r\n\r\n this.geometry.setIndex(new THREE.BufferAttribute(indices, 1));\r\n }\r\n\r\n setDataSource(dataSource) {\r\n const vm = new VolumeMaterial.VolumeMaterial();\r\n const dim = dataSource.getDimensions();\r\n const stride = dataSource.getTiledTextureStride();\r\n const texture = dataSource.buildTiledTexture();\r\n const bbox = dataSource.getBox();\r\n vm.uniforms.volumeDim.value.set(dim[0], dim[1], dim[2]);\r\n vm.uniforms.tileTex.value = texture;\r\n vm.uniforms.tileTexSize.value.set(texture.image.width, texture.image.height);\r\n vm.uniforms.tileStride.value.set(stride[0], stride[1]);\r\n Object.assign(this.volumeInfo, dataSource.getVolumeInfo());\r\n\r\n const volInfo = this.volumeInfo;\r\n vm.uniforms.delta.value.copy(volInfo.delta);\r\n vm.uniforms.boxAngles.value.set(volInfo.obtuseAngle[0], volInfo.obtuseAngle[1], volInfo.obtuseAngle[2]);\r\n\r\n this.material = vm;\r\n\r\n bbox.getSize(this.scale);\r\n bbox.getCenter(this.position);\r\n }\r\n\r\n _updateIsoLevel() {\r\n const { kSigma, kSigmaMed, kSigmaMax } = settings.now.modes.VD;\r\n const volInfo = this.volumeInfo;\r\n const mean = volInfo.dmean - volInfo.dmin;\r\n const span = volInfo.dmax - volInfo.dmin;\r\n const level = (k) => (mean + k * volInfo.sd) / span;\r\n this.material.uniforms._isoLevel0.value.set(level(kSigma), level(kSigmaMed), level(kSigmaMax));\r\n }\r\n\r\n static _nearClipPlaneOffset = 0.2;\r\n\r\n static _pos = new THREE.Vector3();\r\n\r\n static _norm = new THREE.Vector3();\r\n\r\n static _norm4D = new THREE.Vector4();\r\n\r\n static _matrixWorldToLocal = new THREE.Matrix4();\r\n\r\n static _clipPlane = new THREE.Plane();\r\n\r\n rebuild(camera) {\r\n const nearClipPlaneOffset = VolumeMesh._nearClipPlaneOffset;\r\n const pos = VolumeMesh._pos;\r\n const norm = VolumeMesh._norm;\r\n const norm4D = VolumeMesh._norm4D;\r\n const matrixWorldToLocal = VolumeMesh._matrixWorldToLocal;\r\n const clipPlane = VolumeMesh._clipPlane;\r\n\r\n this._updateIsoLevel();\r\n\r\n // get clip plane in local space\r\n camera.getWorldDirection(norm);\r\n camera.getWorldPosition(pos);\r\n pos.addScaledVector(norm, camera.near + nearClipPlaneOffset);\r\n\r\n // transform pos to local CS\r\n matrixWorldToLocal.copy(this.matrixWorld).invert();\r\n pos.applyMatrix4(matrixWorldToLocal);\r\n\r\n // transform norm to local CS\r\n norm4D.set(norm.x, norm.y, norm.z, 0.0); // NOTE: use homogeneous norm for proper transformation\r\n norm4D.applyMatrix4(matrixWorldToLocal);\r\n norm.copy(norm4D);\r\n norm.normalize();\r\n\r\n clipPlane.setFromNormalAndCoplanarPoint(norm, pos);\r\n\r\n if (!this.clipPlane.equals(clipPlane)) {\r\n this.clipPlane = clipPlane.clone();\r\n this._updateVertices();\r\n this._updateIndices();\r\n }\r\n }\r\n}\r\n\r\nexport default VolumeMesh;\r\n","import * as THREE from 'three';\r\nimport gfxutils from './gfxutils';\r\n\r\nfunction _flattenArray(input) {\r\n const n = input.length;\r\n const output = new Float32Array(n * 3);\r\n for (let i = 0; i < n; ++i) {\r\n const j = 3 * i;\r\n const v = input[i];\r\n output[j] = v.x;\r\n output[j + 1] = v.y;\r\n output[j + 2] = v.z;\r\n }\r\n return output;\r\n}\r\n\r\nclass VolumeBounds {\r\n static _projectionTable = { // corresponds between (origin axes and angles between them) and between saving vector coordinates\r\n XY: ['x', 2],\r\n XZ: ['y', 1],\r\n YZ: ['z', 0],\r\n };\r\n\r\n constructor(bBox, volInfo) {\r\n const { delta } = volInfo; // {x: XY, y : XZ, z: YZ}\r\n const { obtuseAngle } = volInfo; // 1 - obtuse, 0 - acute\r\n\r\n const bSize = new THREE.Vector3();\r\n bBox.getSize(bSize);\r\n bSize.multiplyScalar(0.5);\r\n\r\n const offsetVert = this._getBaseVertices(delta, obtuseAngle);\r\n\r\n const geometry = new THREE.BufferGeometry();\r\n const vertices = [];\r\n\r\n for (let i = 0; i < 4; i++) {\r\n vertices.push(offsetVert[i].clone().multiply(bSize));\r\n vertices.push(offsetVert[(i + 1) % 4].clone().multiply(bSize));\r\n }\r\n const translation = new THREE.Vector3(2 * bSize.x * (1 - delta.x - delta.y), 0, 0);\r\n for (let i = 0; i < 8; i++) {\r\n vertices.push(vertices[i].clone().add(translation));\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n vertices.push(vertices[i * 2].clone());\r\n vertices.push(vertices[i * 2 + 8].clone());\r\n }\r\n const center = new THREE.Vector3();\r\n bBox.getCenter(center);\r\n vertices.forEach((vertex) => vertex.add(center)); // pivot shift\r\n\r\n const flatVertices = _flattenArray(vertices);\r\n geometry.setAttribute('position', new THREE.BufferAttribute(flatVertices, 3));\r\n\r\n this._lines = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ color: 0xFFFFFF }));\r\n this._lines.layers.set(gfxutils.LAYERS.VOLUME);\r\n }\r\n\r\n // Set one edge (4 points) of frame, from which with parallel transfer the rest of the frame points can be obtained\r\n _getBaseVertices(delta, obtuseAngle) {\r\n const projTable = VolumeBounds._projectionTable;\r\n\r\n const proj = ((index, inv) => { // tricky function to take account of projections: their position(related to box) and sign\r\n const currDelta = delta[projTable[index][0]];\r\n const angleValue = -0.5 * (inv - 1) + inv * obtuseAngle[projTable[index][1]];// inv = 1: alpha; inv = -1: 1 - alpha\r\n return angleValue * currDelta;\r\n });\r\n\r\n const offsetVert = [\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', 1)), -1 + 2 * proj('YZ', 1), -1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', 1)), -1 + 2 * proj('YZ', -1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', -1)), 1 - 2 * proj('YZ', 1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', -1)), 1 - 2 * proj('YZ', -1), -1),\r\n ];\r\n\r\n return offsetVert;\r\n }\r\n\r\n getMesh() {\r\n return this._lines;\r\n }\r\n}\r\n\r\nexport default VolumeBounds;\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport meshes from './meshes/meshes';\r\nimport gfxutils from './gfxutils';\r\n\r\n// Thes geometric far plane is required for correct filling in the BFTexture in case, when far plane cuts the volume\r\n// cube. In cut place of cube there is no correct data in BFTexture and volume rendering integral is calculated\r\n// with errors.\r\n// Far plane cuts the cube in case of large volume scale (zoom), because farplane doesn't change\r\nclass VolumeFarPlane {\r\n // create plane with unit corners coords (for future rescale in vshader according to camera properties)\r\n constructor(volume, width, height) {\r\n const planeGeo = this._initPlaneGeo(width, height);\r\n\r\n const mat = new VolumeMaterial.BackFacePosMaterialFarPlane();\r\n this._plane = new meshes.Mesh(planeGeo, mat);\r\n this._plane.frustumCulled = false;\r\n this._plane.doubleSided = true;\r\n const matWorldToVolume = new THREE.Matrix4();\r\n\r\n this._plane._onBeforeRender = function (_renderer, _scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!volume || !material) {\r\n return;\r\n }\r\n\r\n // count point in world at farplane place\r\n const planeCamPos = new THREE.Vector4(0, 0, -(camera.far - 0.1), 1);\r\n planeCamPos.applyMatrix4(camera.matrixWorld);\r\n\r\n // recalc matrices to make plane be placed as farplane in the World relative to camera\r\n this.matrix.identity();\r\n this.matrix.makeTranslation(planeCamPos.x, planeCamPos.y, planeCamPos.z);\r\n this.matrixWorld.copy(this.matrix);\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n this.normalMatrix.getNormalMatrix(this.modelViewMatrix);\r\n\r\n // build worldToVolume matrix to transform plane into volumeCS (volumeCS coords are written to BackFaceTexture)\r\n const volumeMatrix = volume.matrixWorld;\r\n matWorldToVolume.copy(volumeMatrix).invert();\r\n\r\n // update material props\r\n material.uniforms.aspectRatio.value = camera.aspect;\r\n material.uniforms.farZ.value = camera.far;\r\n material.uniforms.tanHalfFOV.value = Math.tan(THREE.MathUtils.DEG2RAD * 0.5 * camera.fov);\r\n material.uniforms.matWorld2Volume.value = matWorldToVolume;\r\n };\r\n\r\n // set it to special layer to draw only into BFTexture\r\n this._plane.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n }\r\n\r\n _initPlaneGeo(width, height) {\r\n const planeGeo = new THREE.BufferGeometry();\r\n\r\n width = width || 1;\r\n height = height || 1;\r\n\r\n const vertices = new Float32Array([\r\n -0.5 * width, 0.5 * height, 0,\r\n 0.5 * width, 0.5 * height, 0,\r\n -0.5 * width, -0.5 * height, 0,\r\n 0.5 * width, -0.5 * height, 0,\r\n ]);\r\n\r\n planeGeo.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\r\n planeGeo.setIndex([0, 2, 1, 2, 3, 1]);\r\n\r\n return planeGeo;\r\n }\r\n\r\n getMesh() {\r\n return this._plane;\r\n }\r\n}\r\n\r\nexport default VolumeFarPlane;\r\n","import * as THREE from 'three';\r\nimport VolumeMesh from './gfx/VolumeMesh';\r\nimport VolumeBounds from './gfx/VolumeBounds';\r\nimport VolumeFarPlane from './gfx/VolumeFarPlane';\r\nimport Visual from './Visual';\r\nimport settings from './settings';\r\n\r\nclass VolumeVisual extends Visual {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this._mesh = new VolumeMesh();\r\n this._mesh.setDataSource(dataSource);\r\n this.add(this._mesh);\r\n\r\n this._frame = new VolumeBounds(this.getBoundaries().boundingBox, this._mesh.volumeInfo);\r\n this.add(this._frame.getMesh());\r\n this.showFrame(settings.now.modes.VD.frame);\r\n\r\n this._farPlane = new VolumeFarPlane(this._mesh, 2, 2);\r\n this.add(this._farPlane.getMesh());\r\n }\r\n\r\n getBoundaries() {\r\n const box = this._dataSource.getBox();\r\n const sphere = new THREE.Sphere();\r\n box.getBoundingSphere(sphere);\r\n\r\n return {\r\n boundingBox: box,\r\n boundingSphere: sphere,\r\n };\r\n }\r\n\r\n getMesh() {\r\n return this._mesh;\r\n }\r\n\r\n showFrame(needShow) {\r\n this._frame.getMesh().material.visible = needShow;\r\n }\r\n}\r\n\r\nexport default VolumeVisual;\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available loaders.\r\n * @extends EntityList\r\n */\r\nclass LoaderList extends EntityList {\r\n /**\r\n * Create a list of loaders.\r\n * The loaders are indexed by supported source types (`.types` property of a Loader\r\n * subclass).\r\n * The loaders can be retrieved later by matching against specs (see {@link LoaderList#find}).\r\n *\r\n * @param {!Array=} someLoaders A list of {@link Loader} subclasses to\r\n * automatically register at creation time.\r\n * @see LoaderList#register\r\n */\r\n constructor(someLoaders = []) {\r\n super(someLoaders, ['types']);\r\n }\r\n\r\n /**\r\n * Find a suitable loader for a source type.\r\n *\r\n * @param {Object} specs Loader specifications.\r\n * @param {string=} specs.type Supported source type.\r\n * @param {*=} specs.source Source to load from.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.type) {\r\n list = this._dict.types[specs.type.toLowerCase()] || [];\r\n } else if (specs.source) {\r\n return this._list.filter((SomeLoader) => SomeLoader.canProbablyLoad && SomeLoader.canProbablyLoad(specs.source));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default LoaderList;\r\n","import EventDispatcher from '../../utils/EventDispatcher';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Loader extends EventDispatcher {\r\n constructor(source, options) {\r\n super();\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n this._agent = null;\r\n }\r\n\r\n load() {\r\n return Promise.reject(new Error('Loading from this source is not implemented'));\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n if (this._agent) {\r\n this._agent.abort();\r\n }\r\n }\r\n\r\n static extractName(_source) {\r\n return undefined;\r\n }\r\n}\r\n\r\nmakeContextDependent(Loader.prototype);\r\n","import Loader from './Loader';\r\n\r\nexport default class FileLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = options.binary === true;\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const blob = this._source;\r\n const reader = this._agent = new FileReader();\r\n\r\n reader.addEventListener('load', () => {\r\n resolve(reader.result);\r\n });\r\n reader.addEventListener('error', () => {\r\n reject(reader.error);\r\n });\r\n reader.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n reader.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n if (this._binary) {\r\n reader.readAsArrayBuffer(blob);\r\n } else {\r\n reader.readAsText(blob);\r\n }\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return (File && source instanceof File) || (Blob && source instanceof Blob);\r\n }\r\n\r\n static extractName(source) {\r\n return source && source.name;\r\n }\r\n}\r\n\r\nFileLoader.types = ['file', 'blob'];\r\n","import _ from 'lodash';\r\nimport Loader from './Loader';\r\n\r\n// we don't need to detect all kinds of URLs, just the evident ones\r\nconst urlStartRegexp = /^(https?|ftp):\\/\\//i;\r\n\r\nexport default class XHRLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = (options.binary === true);\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const url = this._source;\r\n const request = this._agent = new XMLHttpRequest();\r\n\r\n request.addEventListener('load', () => {\r\n if (request.status === 200) {\r\n resolve(request.response);\r\n } else {\r\n reject(new Error(`HTTP ${request.status} while fetching ${url}`));\r\n }\r\n });\r\n request.addEventListener('error', () => {\r\n reject(new Error('HTTP request failed'));\r\n });\r\n request.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n request.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n request.open('GET', url);\r\n if (this._binary) {\r\n request.responseType = 'arraybuffer';\r\n } else {\r\n request.responseType = 'text';\r\n }\r\n request.send();\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return _.isString(source) && urlStartRegexp.test(source);\r\n }\r\n\r\n static extractName(source) {\r\n if (source) {\r\n const last = (source.indexOf('?') + 1 || source.lastIndexOf('#') + 1 || source.length + 1) - 1;\r\n return source.slice(source.lastIndexOf('/', last) + 1, last);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nXHRLoader.types = ['url'];\r\n","import Loader from './Loader';\r\n\r\nexport default class ImmediateLoader extends Loader {\r\n load() {\r\n return new Promise((resolve) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n resolve(this._source);\r\n });\r\n }\r\n\r\n static canProbablyLoad(_source) {\r\n return false;\r\n }\r\n}\r\n\r\nImmediateLoader.types = ['immediate'];\r\n","import LoaderList from './loaders/LoaderList';\r\n\r\nimport FileLoader from './loaders/FileLoader';\r\nimport XHRLoader from './loaders/XHRLoader';\r\nimport ImmediateLoader from './loaders/ImmediateLoader';\r\n\r\nexport default new LoaderList([\r\n // note: order might be important\r\n FileLoader,\r\n XHRLoader,\r\n ImmediateLoader,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available parsers.\r\n * @extends EntityList\r\n */\r\nclass ParserList extends EntityList {\r\n /**\r\n * Create a list of parsers.\r\n * The parsers are indexed by supported data formats and file extensions (`.formats` and\r\n * `.extensions` properties of a Parser subclass).\r\n * The parsers can be retrieved later by matching against specs (see {@link ParsrerList#find}).\r\n *\r\n * @param {!Array=} someParsers A list of {@link Parser} subclasses to\r\n * automatically register at creation time.\r\n * @see ParserList#register\r\n */\r\n constructor(someParsers = []) {\r\n super(someParsers, ['formats', 'extensions']);\r\n }\r\n\r\n /**\r\n * Find a suitable parser for data.\r\n *\r\n * @param {Object} specs Parser specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {string=} specs.ext Supported filename extension.\r\n * @param {*=} specs.data Data to parse.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n } else if (specs.ext) {\r\n list = this._dict.extensions[specs.ext.toLowerCase()] || [];\r\n }\r\n // autodetect only if no format is forced\r\n if (list.length === 0 && !specs.format && specs.data) {\r\n return this._list.filter((SomeParser) => SomeParser.canProbablyParse && SomeParser.canProbablyParse(specs.data));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ParserList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Parser {\r\n constructor(data, options) {\r\n this._data = data;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n parseSync() {\r\n throw new Error('Parsing this type of data is not implemented');\r\n }\r\n\r\n parse() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Parsing aborted'));\r\n }\r\n return resolve(this.parseSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n // only for volume Parsers\r\n getModel() {\r\n this.model._parseHeader(this._data);\r\n return this.model;\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Parser.prototype);\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 290\".\r\n *\r\n * @exports Remark290\r\n * @constructor\r\n */\r\nclass Remark290 {\r\n constructor() {\r\n /** @type {THREE.Matrix4[]} */\r\n this.matrices = [];\r\n\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (stream.readString(12, 18) === ' SMTRY') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === this.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n }\r\n }\r\n}\r\n\r\nRemark290.prototype.id = 290;\r\n\r\nexport default Remark290;\r\n","import * as THREE from 'three';\r\nimport chem from '../../../chem';\r\n\r\nconst { Assembly } = chem;\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 350\".\r\n *\r\n * @exports Remark350\r\n * @constructor\r\n */\r\nclass Remark350 {\r\n constructor(complex) {\r\n /** @type {Complex} */\r\n this._complex = complex;\r\n /** @type {Assembly[]} */\r\n this.assemblies = [];\r\n\r\n /** @type {?Assembly} */\r\n this._assembly = null;\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?Assembly} */\r\n let assembly = this._assembly;\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (assembly && stream.readString(12, 18) === ' BIOMT') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === assembly.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n } else if (assembly && stream.readString(35, 41) === 'CHAINS:') {\r\n const entries = stream.readString(42, 80).split(',');\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const chain = entries[i].trim();\r\n if (chain.length > 0) {\r\n assembly.addChain(chain);\r\n }\r\n }\r\n } else if (stream.readString(12, 23) === 'BIOMOLECULE:') {\r\n // assert molIndex === this.assemblies.length + 1\r\n this._matrix = null;\r\n this._matrixIndex = -1;\r\n this._assembly = assembly = new Assembly(this._complex);\r\n this.assemblies.push(assembly);\r\n }\r\n }\r\n}\r\n\r\nRemark350.prototype.id = 350;\r\n\r\nexport default Remark350;\r\n","/** Helper class for stream-like reading input files. */\r\nclass PDBStream {\r\n /**\r\n * Create a stream\r\n * @param {String} data Input data\r\n */\r\n constructor(data) {\r\n /** @type String */\r\n this._data = data; // Input file\r\n /** @type Number */\r\n this._start = 0; // Starting position of line\r\n /** @type Number */\r\n this._nextCR = -1; // Position of next CR (0x0D)\r\n /** @type Number */\r\n this._nextLF = -1; // Position of next LF (0x0A)\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n /** @type Number */\r\n this._end = data.length; // End of data\r\n\r\n this.next();\r\n }\r\n\r\n /**\r\n * Reading next line.\r\n * @returns {String} Next line in data (ending with LF or CR)\r\n */\r\n readLine() {\r\n return this._data.slice(this._start, this._next);\r\n }\r\n\r\n /**\r\n * Reading character from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {String} Character from position\r\n */\r\n readChar(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data[pos] : ' ';\r\n }\r\n\r\n /**\r\n * Reading character code from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {Number} Character code from position\r\n */\r\n readCharCode(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data.charCodeAt(pos) : 32;\r\n }\r\n\r\n /**\r\n * Reading string from begin to end points.\r\n * For a reason unknown, numbering assumed not to start from 0, but from 1.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {String} String from begin to end\r\n */\r\n readString(begin, end) {\r\n const from = this._start + begin - 1;\r\n const to = this._start + end;\r\n return this._data.slice(from, to < this._next ? to : this._next);\r\n }\r\n\r\n /**\r\n * Reading integer from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Integer from begin to end\r\n */\r\n readInt(begin, end) {\r\n return parseInt(this.readString(begin, end), 10);\r\n }\r\n\r\n /**\r\n * Reading float from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Float from begin to end\r\n */\r\n readFloat(begin, end) {\r\n return parseFloat(this.readString(begin, end));\r\n }\r\n\r\n /**\r\n * Checking for end of data.\r\n * @returns {boolean} True if data is ended, false otherwise\r\n */\r\n end() {\r\n return this._start >= this._end;\r\n }\r\n\r\n /**\r\n * Procedure to re-arrange current pointers in data.\r\n */\r\n next() {\r\n const start = this._next + 1;\r\n this._start = start < this._end ? start : this._end;\r\n\r\n // support CR, LF, CR+LF line endings\r\n // do not support LF+CR, CR+CR+LF, and other strange combinations\r\n\r\n if (this._start > this._nextCR) {\r\n this._nextCR = (this._data.indexOf('\\r', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n if (this._start > this._nextLF) {\r\n this._nextLF = (this._data.indexOf('\\n', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n this._next = this._nextCR + 1 < this._nextLF ? this._nextCR : this._nextLF;\r\n }\r\n}\r\n\r\nexport default PDBStream;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport Remark290 from './pdb/Remark290';\r\nimport Remark350 from './pdb/Remark350';\r\nimport PDBStream from './PDBStream';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst TAG_LENGTH = 6;\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\n// the most frequently used beginnings; although HEADER is mandatory, it is often missing in handmade files\r\nconst pdbStartRegexp = /^(HEADER\\s|COMPND\\s|REMARK\\s|ATOM {2}|HETATM|MODEL )/i;\r\n\r\nconst remarkParsers = {\r\n // NOTE: please forget the idea to build the method name in runtime, it can be obfuscated.\r\n 290: Remark290,\r\n 350: Remark350,\r\n};\r\n\r\nclass PDBParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._sheet = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._compaundFound = false;\r\n this._biomoleculeFound = false;\r\n this._allowedChainsIDs = null;\r\n this._lastMolId = -1;\r\n\r\n this._remarks = {};\r\n this._remark = null;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n this._compndCurrToken = '';\r\n\r\n this._options.fileType = 'pdb';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && pdbStartRegexp.test(data);\r\n }\r\n\r\n _finalize() {\r\n this._fixBondsArray();\r\n this._fixChains();\r\n\r\n // keep crystallographic symmetry transformations\r\n const remark290 = this._remarks[290];\r\n this._complex.symmetry = _.isUndefined(remark290) ? [] : remark290.matrices;\r\n\r\n // add loaded biological assemblies\r\n const remark350 = this._remarks[350];\r\n this._complex.units = this._complex.units.concat(_.isUndefined(remark350) ? [] : remark350.assemblies);\r\n\r\n // add loaded macromolecules\r\n this._finalizeMolecules();\r\n\r\n // create secondary structure etc.\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _finalizeMolecules() {\r\n // get chains from complex\r\n const chainDict = {};\r\n let i;\r\n const chains = this._complex._chains;\r\n for (i = 0; i < chains.length; ++i) {\r\n const chainObj = chains[i];\r\n const chainName = chainObj._name;\r\n chainDict[chainName] = chainObj;\r\n }\r\n\r\n // aggregate residues from chains\r\n for (i = 0; i < this._molecules.length; i++) {\r\n const m = this._molecules[i];\r\n let residues = [];\r\n for (let j = 0; j < m._chains.length; j++) {\r\n const name = m._chains[j];\r\n const chain = chainDict[name];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, m._name, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _fixChains() {\r\n const idChainMap = {};\r\n const complex = this._complex;\r\n\r\n // prepare\r\n for (let i = 0; i < complex._chains.length; i++) {\r\n const chain = complex._chains[i];\r\n idChainMap[chain._name.charCodeAt(0)] = chain;\r\n }\r\n }\r\n\r\n // FIXME: This function is redundant, CONECT records always follow ATOM and HETATM. Build the map online.\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseATOM(stream) {\r\n if (this._modelId !== 1) {\r\n return;\r\n }\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const het = stream.readCharCode(1) === 0x48;\r\n\r\n // field names according to wwPDB Format\r\n // NOTE: Chimera allows (nonstandard) use of columns 6-11 for the integer atom serial number in ATOM records.\r\n const serial = het ? stream.readInt(7, 11) : stream.readInt(6, 11);\r\n let name = stream.readString(13, 16);\r\n const altLoc = stream.readChar(17);\r\n const resName = stream.readString(18, 20).trim();\r\n const chainID = stream.readChar(22);\r\n const resSeq = stream.readInt(23, 26);\r\n const iCode = stream.readChar(27);\r\n const x = stream.readFloat(31, 38);\r\n const y = stream.readFloat(39, 46);\r\n const z = stream.readFloat(47, 54);\r\n const occupancy = stream.readFloat(55, 60);\r\n const tempFactor = stream.readFloat(61, 66);\r\n const element = stream.readString(77, 78).trim() || nameToElement(name);\r\n const charge = stream.readInt(79, 80) || 0;\r\n /* eslint-enable no-magic-numbers */\r\n // skip waters (there may be lots of them)\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n // PDB uses positional system for atom names. It helps derive element type from the name\r\n // but names may include extra spaces. From this point on we don't need those spaces anymore.\r\n name = name.trim();\r\n\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name]; // FIXME: Maybe should use type as additional index (\" CA \" vs. \"CA \")\r\n\r\n // NOTE: Residues of a particular chain are not required to be listed next to each other.\r\n // https://github.com/biasmv/pv/commit/7319b898b7473ba380c26699e3b028b2b1a7e1a1\r\n let chain = this._chain;\r\n if (!chain || chain.getName() !== chainID) {\r\n this._chain = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n _parseENDMDL() {\r\n this._modelId += 1;\r\n }\r\n\r\n _parseCONECT(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const serial0 = stream.readInt(7, 11);\r\n const serial1 = stream.readInt(12, 16);\r\n const serial2 = stream.readInt(17, 21);\r\n const serial3 = stream.readInt(22, 26);\r\n const serial4 = stream.readInt(27, 31);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const complex = this._complex;\r\n\r\n // Keep bonds ordered by atom serial\r\n if (serial1 && serial1 > serial0) {\r\n complex.addBond(serial0, serial1, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial2 && serial2 > serial0) {\r\n complex.addBond(serial0, serial2, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial3 && serial3 > serial0) {\r\n complex.addBond(serial0, serial3, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial4 && serial4 > serial0) {\r\n complex.addBond(serial0, serial4, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n }\r\n\r\n _parseCOMPND(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const str = stream.readString(11, 80);\r\n const tokenIdx = str.indexOf(':');\r\n this._compndCurrToken = tokenIdx > 0 ? str.substring(0, tokenIdx).trim() : this._compndCurrToken;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // start reading new molecule\r\n if (this._compndCurrToken === 'MOL_ID') {\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = parseInt(str.substring(tokenIdx + 1, str.indexOf(';')), 10);\r\n this._molecules.push(this._molecule);\r\n // parse molecule name\r\n } else if (this._compndCurrToken === 'MOLECULE' && this._molecule != null) {\r\n this._molecule._name = str.substring(tokenIdx + 1, str.indexOf(';')).trim();\r\n // parse molecule chains\r\n } else if (this._compndCurrToken === 'CHAIN' && this._molecule != null) {\r\n let chainStr = str.substring(tokenIdx + 1, 80).trim();\r\n const lastChar = chainStr[chainStr.length - 1];\r\n if (lastChar === ';' || lastChar === ',') {\r\n chainStr = chainStr.slice(0, -1);\r\n }\r\n chainStr = chainStr.replace(/\\s+/g, '');\r\n const chains = chainStr.split(',');\r\n this._molecule._chains = this._molecule._chains.concat(chains);\r\n }\r\n }\r\n\r\n _parseREMARK(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const remarkNum = stream.readInt(8, 10);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // create remark parser if needed\r\n let remark = this._remarks[remarkNum];\r\n if (_.isUndefined(remark)) {\r\n const RemarkParser = remarkParsers[remarkNum];\r\n if (_.isFunction(RemarkParser)) {\r\n this._remarks[remarkNum] = remark = new RemarkParser(this._complex);\r\n }\r\n }\r\n\r\n // delegate parsing\r\n if (!_.isUndefined(remark)) {\r\n remark.parse(stream);\r\n }\r\n }\r\n\r\n _parseHELIX(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [20, 22, 32, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addHelix(obj);\r\n this._complex.structures.push(obj);\r\n });\r\n }\r\n\r\n _parseSHEET(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [22, 23, 33, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addSheet(obj);\r\n });\r\n }\r\n\r\n _parseSTRUCTURE(stream, pars, adder) {\r\n const startId = 0;\r\n const startIndex = 1;\r\n const endId = 2;\r\n const endIndex = 3;\r\n\r\n // identify fields: debugging and stuff\r\n /* eslint-disable no-magic-numbers */\r\n const codeOfS = 0x53;\r\n const serialNumber = stream.readInt(8, 10);\r\n const structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim()\r\n const comment = stream.readString(41, 70).trim();\r\n const helLength = stream.readInt(72, 76);\r\n const helixClass = stream.readInt(39, 40);\r\n const shWidth = stream.readInt(15, 16);\r\n const shCur = stream.readInt(42, 45);\r\n const shPrev = stream.readInt(57, 60);\r\n /* eslint-enable no-magic-numbers */\r\n // file fields\r\n const startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0);\r\n const endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0);\r\n const startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3);\r\n let iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4);\r\n let startICode = 0;\r\n\r\n if (iCodeStr.length > 0) {\r\n startICode = iCodeStr.charCodeAt(0);\r\n }\r\n const endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3);\r\n iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4);\r\n let endICode = 0;\r\n if (iCodeStr.length > 0) {\r\n endICode = iCodeStr.charCodeAt(0);\r\n }\r\n\r\n let obj;\r\n let cs = this._sheet;\r\n if (stream.readCharCode(1) === codeOfS) {\r\n if (cs !== null && cs.getName() !== structureName) {\r\n cs = null;\r\n this._sheet = null;\r\n }\r\n if (cs === null) {\r\n this._sheet = obj = new Sheet(structureName, shWidth);\r\n adder(obj);\r\n } else {\r\n obj = cs;\r\n }\r\n const strand = new Strand(\r\n obj,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n helixClass,\r\n shCur,\r\n shPrev,\r\n );\r\n obj.addStrand(strand);\r\n this._complex.structures.push(strand);\r\n } else {\r\n obj = new Helix(\r\n helixClass,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n serialNumber,\r\n structureName,\r\n comment,\r\n helLength,\r\n );\r\n adder(obj);\r\n }\r\n }\r\n\r\n _parseHEADER(stream) {\r\n const { metadata } = this._complex;\r\n metadata.classification = stream.readString(11, 50).trim();\r\n metadata.date = stream.readString(51, 59).trim();\r\n\r\n const id = stream.readString(63, 66).trim();\r\n metadata.id = id;\r\n if (id) {\r\n this._complex.name = id;\r\n }\r\n metadata.format = 'pdb';\r\n }\r\n\r\n _parseTITLE(stream) {\r\n const { metadata } = this._complex;\r\n metadata.title = metadata.title || [];\r\n\r\n const line = stream.readInt(9, 10) || 1;\r\n metadata.title[line - 1] = stream.readString(11, 80).trim();\r\n }\r\n\r\n static tagParsers = {\r\n HEADER: PDBParser.prototype._parseHEADER,\r\n 'TITLE ': PDBParser.prototype._parseTITLE,\r\n 'ATOM ': PDBParser.prototype._parseATOM,\r\n HETATM: PDBParser.prototype._parseATOM,\r\n ENDMDL: PDBParser.prototype._parseENDMDL,\r\n CONECT: PDBParser.prototype._parseCONECT,\r\n COMPND: PDBParser.prototype._parseCOMPND,\r\n REMARK: PDBParser.prototype._parseREMARK,\r\n // 'SOURCE': PDBParser.prototype._parseSOURCE,\r\n 'HELIX ': PDBParser.prototype._parseHELIX,\r\n 'SHEET ': PDBParser.prototype._parseSHEET,\r\n\r\n // nonstandard extension to allow range 100,000 - 999,999\r\n 'ATOM 1': PDBParser.prototype._parseATOM,\r\n 'ATOM 2': PDBParser.prototype._parseATOM,\r\n 'ATOM 3': PDBParser.prototype._parseATOM,\r\n 'ATOM 4': PDBParser.prototype._parseATOM,\r\n 'ATOM 5': PDBParser.prototype._parseATOM,\r\n 'ATOM 6': PDBParser.prototype._parseATOM,\r\n 'ATOM 7': PDBParser.prototype._parseATOM,\r\n 'ATOM 8': PDBParser.prototype._parseATOM,\r\n 'ATOM 9': PDBParser.prototype._parseATOM,\r\n };\r\n\r\n parseSync() {\r\n const stream = new PDBStream(this._data);\r\n const result = this._complex = new Complex();\r\n\r\n // parse PDB line by line\r\n while (!stream.end()) {\r\n const tag = stream.readString(1, TAG_LENGTH);\r\n const func = PDBParser.tagParsers[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, stream);\r\n }\r\n stream.next();\r\n }\r\n\r\n // Resolve indices and serials to objects\r\n this._finalize();\r\n\r\n // cleanup\r\n this._serialAtomMap = null;\r\n this._sheet = null;\r\n this._residue = null;\r\n this._chain = null;\r\n this._complex = null;\r\n\r\n if (result.getAtomCount() === 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\nPDBParser.formats = ['pdb'];\r\nPDBParser.extensions = ['.pdb', '.ent'];\r\n\r\nexport default PDBParser;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n SGroup,\r\n Bond,\r\n} = chem;\r\n\r\nconst cOrderCharCodes = {\r\n A: 0,\r\n S: 1,\r\n D: 2,\r\n T: 3,\r\n};\r\n\r\nconst cmlStartRegexp = /\\s*<\\?xml\\b[^?>]*\\?>\\s*<(?:cml|molecule)\\b/i;\r\n\r\nclass CMLParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._complex = null;\r\n this._residue = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._lastMolId = -1;\r\n this._readOnlyOneMolecule = false;\r\n this._options.fileType = 'cml';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && cmlStartRegexp.test(data);\r\n }\r\n\r\n _rebuidBondIndexes(atoms, bonds) {\r\n const count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n\r\n const countBonds = bonds.length;\r\n for (let j = 0; j < countBonds; j++) {\r\n const idxs = bonds[j].atomRefs2.split(' ');\r\n if (idxs[0] === atomId) {\r\n bonds[j].start = i;\r\n }\r\n\r\n if (idxs[1] === atomId) {\r\n bonds[j].end = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _createSGroup(molecule, moleculeArr) {\r\n const newGroup = new SGroup(\r\n molecule.id,\r\n molecule.fieldData,\r\n new THREE.Vector3(parseFloat(molecule.x), parseFloat(molecule.y), 0),\r\n molecule.atomRefs,\r\n molecule,\r\n );\r\n if (molecule.placement === 'Relative') {\r\n newGroup._center = new THREE.Vector3(0, 0, 0);\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_CHARGE') {\r\n newGroup._charge = parseInt(molecule.fieldData, 10) || 0;\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_COEFFICIENT') {\r\n newGroup._repeat = parseInt(molecule.fieldData, 10) || 1;\r\n }\r\n moleculeArr.push(newGroup);\r\n }\r\n\r\n _extractSGroup(molecule, moleculeArr) {\r\n if (!Array.isArray(moleculeArr)) {\r\n moleculeArr = [];\r\n }\r\n\r\n if (molecule) {\r\n if (Array.isArray(molecule)) {\r\n const count = molecule.length;\r\n for (let i = 0; i < count; i++) {\r\n if (molecule[i].molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule[i].molecule));\r\n }\r\n this._createSGroup(molecule[i], moleculeArr);\r\n }\r\n } else {\r\n if (molecule.molecule) {\r\n if (molecule.molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule.molecule));\r\n }\r\n }\r\n this._createSGroup(molecule, moleculeArr);\r\n }\r\n }\r\n\r\n return moleculeArr;\r\n }\r\n\r\n _extractSGroups(molecule, atoms) {\r\n const moleculeArr = this._extractSGroup(molecule);\r\n\r\n const count = atoms.length;\r\n let i;\r\n let j;\r\n\r\n for (i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n const firstAtomRef = moleculeArr[j]._atoms.split(' ')[0];\r\n if (firstAtomRef === atomId) {\r\n if (!atoms[i].sgroupRef) {\r\n atoms[i].sgroupRef = [];\r\n }\r\n atoms[i].sgroupRef.push(moleculeArr[j]);\r\n }\r\n }\r\n }\r\n // build sGroups centers\r\n let atomMap = {}; // sgrpmap cache\r\n let mapEntry = null;\r\n const nLimon = 100000000;\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n\r\n function cycleFuncInner(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n moleculeArr[j]._atoms.push(mapEntry.a);\r\n }\r\n }\r\n\r\n function cycleFunc(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n bLow.set(Math.min(bLow.x, mapEntry.x), Math.min(bLow.y, mapEntry.y), Math.min(bLow.z, mapEntry.z));\r\n bHight.set(Math.max(bHight.x, mapEntry.x), Math.max(bHight.y, mapEntry.y), Math.max(bHight.z, mapEntry.z));\r\n cycleFuncInner(e);\r\n }\r\n }\r\n\r\n for (i = 0; i < atoms.length; i++) {\r\n atomMap[atoms[i].id] = {};\r\n atomMap[atoms[i].id].x = atoms[i].x2;\r\n if (atoms[i].x3) {\r\n atomMap[atoms[i].id].x = atoms[i].x3;\r\n }\r\n atomMap[atoms[i].id].x = parseFloat(atomMap[atoms[i].id].x);\r\n atomMap[atoms[i].id].y = atoms[i].y2;\r\n if (atoms[i].y3) {\r\n atomMap[atoms[i].id].y = atoms[i].y3;\r\n }\r\n atomMap[atoms[i].id].y = parseFloat(atomMap[atoms[i].id].y);\r\n atomMap[atoms[i].id].z = '0.0';\r\n if (atoms[i].z3) {\r\n atomMap[atoms[i].id].z = atoms[i].z3;\r\n }\r\n atomMap[atoms[i].id].z = parseFloat(atomMap[atoms[i].id].z);\r\n atomMap[atoms[i].id].a = atoms[i];\r\n }\r\n\r\n let atomsRef;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n if (moleculeArr[j]._center !== null) {\r\n bLow.set(nLimon, nLimon, nLimon);\r\n bHight.set(-nLimon, -nLimon, -nLimon);\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFunc);\r\n\r\n moleculeArr[j]._center.addVectors(bLow, bHight);\r\n moleculeArr[j]._center.multiplyScalar(0.5);\r\n } else {\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFuncInner);\r\n }\r\n }\r\n atomMap = null;\r\n }\r\n\r\n _traverseData(dom) {\r\n function isArray(o) {\r\n return Object.prototype.toString.apply(o) === '[object Array]';\r\n }\r\n\r\n function parseNode(xmlNode, result) {\r\n if (xmlNode.nodeName === '#text' && xmlNode.nodeValue.trim() === '') {\r\n return;\r\n }\r\n\r\n const jsonNode = {};\r\n jsonNode.xmlNode = xmlNode;\r\n const existing = result[xmlNode.nodeName];\r\n if (existing) {\r\n if (!isArray(existing)) {\r\n result[xmlNode.nodeName] = [existing, jsonNode];\r\n } else {\r\n result[xmlNode.nodeName].push(jsonNode);\r\n }\r\n } else {\r\n result[xmlNode.nodeName] = jsonNode;\r\n }\r\n\r\n let length;\r\n let i;\r\n if (xmlNode.attributes) {\r\n ({ length } = xmlNode.attributes);\r\n for (i = 0; i < length; i++) {\r\n const attribute = xmlNode.attributes[i];\r\n jsonNode[attribute.nodeName] = attribute.nodeValue;\r\n }\r\n }\r\n\r\n ({ length } = xmlNode.childNodes);\r\n for (i = 0; i < length; i++) {\r\n parseNode(xmlNode.childNodes[i], jsonNode);\r\n }\r\n }\r\n\r\n const result = {};\r\n if (dom.childNodes.length) {\r\n parseNode(dom.childNodes[0], result);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _findSuitableMolecule(data, molSet) {\r\n for (const key in data) {\r\n if (key === 'xmlNode') {\r\n continue;\r\n } else if (key === 'molecule') {\r\n if (data.molecule) {\r\n if (data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n molSet.push(data);\r\n }\r\n if (Array.isArray(data.molecule)) {\r\n for (let i = 0; i < data.molecule.length; i++) {\r\n if (data.molecule[i].atomArray && data.molecule[i].atomArray.atom) {\r\n molSet.push({ molecule: data.molecule[i] });\r\n }\r\n }\r\n }\r\n }\r\n } else if (data[key] && data[key] !== null && typeof (data[key]) === 'object') {\r\n this._findSuitableMolecule(data[key], molSet);\r\n }\r\n }\r\n }\r\n\r\n _selectComponents(text) {\r\n const parser = new DOMParser();\r\n const doc = parser.parseFromString(text, 'application/xml');\r\n const traversedData = this._traverseData(doc);\r\n let rawData;\r\n const self = this;\r\n\r\n function prepareComponentCompound(data) {\r\n let atoms = [];\r\n if (data.molecule && data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n if (!Array.isArray(data.molecule.atomArray.atom)) {\r\n atoms.push(data.molecule.atomArray.atom);\r\n } else {\r\n atoms = data.molecule.atomArray.atom;\r\n }\r\n } else if (!data.molecule) {\r\n const ret = {};\r\n ret.atomLabels = null;\r\n ret.labelsCount = 1;\r\n return ret;\r\n }\r\n\r\n if (data.molecule.molecule) {\r\n self._extractSGroups(data.molecule.molecule, atoms);\r\n }\r\n\r\n let atom;\r\n let count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges = [];\r\n }\r\n\r\n let localBond = [];\r\n if (data.molecule.bondArray && data.molecule.bondArray.bond) {\r\n if (!Array.isArray(data.molecule.bondArray.bond)) {\r\n localBond.push(data.molecule.bondArray.bond);\r\n } else {\r\n localBond = data.molecule.bondArray.bond;\r\n }\r\n }\r\n let bond;\r\n count = localBond.length;\r\n self._rebuidBondIndexes(atoms, localBond);\r\n\r\n function addCurrBond(index) {\r\n bond = localBond[index];\r\n atom = atoms[bond.start];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.end);\r\n atom = atoms[bond.end];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.start);\r\n return true;\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n if (!addCurrBond(i)) {\r\n // ignore invalid bond\r\n continue;\r\n }\r\n const orderAttr = bond.xmlNode.getAttribute('order');\r\n const tc = parseInt(orderAttr, 10);\r\n // the default bond order is unknown\r\n localBond[i].order = 0;\r\n localBond[i].type = Bond.BondType.UNKNOWN;\r\n if (tc > 1) {\r\n localBond[i].order = tc;\r\n } else {\r\n // another option - bond order is a string\r\n const order = cOrderCharCodes[orderAttr];\r\n if (order !== undefined) {\r\n localBond[i].order = order;\r\n if (orderAttr === 'A') {\r\n localBond[i].type = Bond.BondType.AROMATIC;\r\n }\r\n }\r\n }\r\n }\r\n\r\n count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges.sort();\r\n }\r\n\r\n const labels = self._breadWidthSearch(atoms, 0); // for now\r\n\r\n const retStruct = {};\r\n retStruct.atoms = atoms;\r\n retStruct.bonds = localBond;\r\n retStruct.labels = labels.atomLabels;\r\n retStruct.count = Math.min(1, labels.labelsCount); // for now\r\n retStruct.curr = -1;\r\n retStruct.originalCML = doc;\r\n\r\n return retStruct;\r\n }\r\n\r\n if (traversedData.cml) {\r\n rawData = traversedData.cml;\r\n } else {\r\n rawData = traversedData;\r\n }\r\n const retData = [];\r\n const filteredData = [];\r\n this._findSuitableMolecule(rawData, filteredData);\r\n if (this._readOnlyOneMolecule && filteredData.length > 1) {\r\n filteredData.splice(1, filteredData.length - 1);\r\n }\r\n filteredData.forEach((d) => {\r\n const rd = prepareComponentCompound(d);\r\n if (rd.atoms.length > 0) {\r\n retData.push(rd);\r\n }\r\n });\r\n return retData;\r\n }\r\n\r\n _packLabel(compId, molId) {\r\n const shift = 16;\r\n return (molId << shift) + compId;\r\n }\r\n\r\n _unpackLabel(l) {\r\n const shift = 16;\r\n const mask = (1 << shift) - 1;\r\n return { molId: l >>> shift, compId: l & mask };\r\n }\r\n\r\n _breadWidthSearch(atoms, molID) {\r\n const atomLabels = new Array(atoms.length);\r\n\r\n let id;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n atomLabels[id] = this._packLabel(0, molID);\r\n }\r\n\r\n const breadthQueue = [];\r\n let componentID = 0;\r\n let labeledAtoms = atoms.length;\r\n\r\n while (labeledAtoms > 0) {\r\n componentID++;\r\n\r\n let startID = -1;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n if (this._unpackLabel(atomLabels[id]).compId === 0) {\r\n startID = id;\r\n break;\r\n }\r\n }\r\n\r\n if (startID < 0) {\r\n break;\r\n }\r\n\r\n // Bread first search\r\n breadthQueue.push(atoms[startID]);\r\n atomLabels[startID] = this._packLabel(componentID, molID);\r\n labeledAtoms--;\r\n\r\n while (breadthQueue.length > 0) {\r\n const curr = breadthQueue.shift();\r\n if (!curr) {\r\n continue;\r\n }\r\n\r\n for (let i = 0; i < curr.edges.length; i++) {\r\n if (atomLabels[curr.edges[i]] !== componentID) {\r\n breadthQueue.push(atoms[curr.edges[i]]);\r\n atomLabels[curr.edges[i]] = componentID;\r\n labeledAtoms--;\r\n }\r\n }\r\n }\r\n }\r\n const ret = {};\r\n ret.atomLabels = atomLabels;\r\n ret.labelsCount = componentID;\r\n return ret;\r\n }\r\n\r\n _parseBond(eAtom, mainAtom, order, type) {\r\n if (eAtom >= 0) {\r\n const h = [Math.min(eAtom, mainAtom), Math.max(eAtom, mainAtom)];\r\n this._complex.addBond(h[0], h[1], order, type, true);\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseSet(varData) {\r\n const complex = this._complex = new Complex();\r\n const data = varData;\r\n const currentLabel = data.curr;\r\n const { atoms, labels } = data;\r\n let atom = null;\r\n let i;\r\n let j;\r\n const count = atoms.length;\r\n\r\n function addFunc(a) {\r\n a.xmlNodeRef = atom;\r\n if (atom.x2) {\r\n atom.x3 = atom.x2;\r\n delete atom.x2;\r\n }\r\n if (atom.y2) {\r\n atom.y3 = atom.y2;\r\n delete atom.y2;\r\n }\r\n if (!(atom.z3)) {\r\n atom.z3 = '0.0';\r\n }\r\n atom.complexAtom = a;\r\n }\r\n\r\n let chains = {};\r\n // parse atoms in label order\r\n const reorder = [];\r\n for (i = 0; i < count; i++) {\r\n reorder.push(i);\r\n }\r\n reorder.sort((a, b) => labels[a] - labels[b]);\r\n for (i = 0; i < count; i++) {\r\n const atomCharge = 0;\r\n const lLabel = labels[reorder[i]];\r\n if (this._unpackLabel(lLabel).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[reorder[i]];\r\n const atomFullNameStruct = atom.elementType;\r\n\r\n if (atom.sgroupRef) {\r\n const countRef = atom.sgroupRef.length;\r\n for (let k = 0; k < countRef; ++k) {\r\n complex._sgroups.push(atom.sgroupRef[k]);\r\n }\r\n }\r\n\r\n if (atom.x3 || atom.x2) {\r\n const currAtomComp = this._unpackLabel(lLabel).compId;\r\n // use ' ' by default instead of synthetic creation of chain names\r\n const chainID = ' '; //= String.fromCharCode('A'.charCodeAt(0) + currAtomComp);\r\n const resSeq = currAtomComp;\r\n const iCode = ' ';\r\n let strLabel = currAtomComp.toString();\r\n if (strLabel.length === 1) {\r\n strLabel = `0${strLabel}`;\r\n }\r\n const resName = `N${strLabel}`;\r\n let chain = chains[chainID];\r\n if (!chain || chain.getName() !== chainID) {\r\n chains[chainID] = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n // _x, _y, _z, mname, mindex, atomNameFull, atomName, chainID, serial, isHet, atlLocInd, atomNameToTypeF\r\n let xyz = null;\r\n if (atom.x3) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x3), parseFloat(atom.y3), parseFloat(atom.z3));\r\n } else if (atom.x2) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x2), parseFloat(atom.y2), 0);\r\n }\r\n let element = Element.ByName[atom.elementType.toUpperCase()];\r\n if (!element) {\r\n element = (JSON.parse(JSON.stringify(Element.ByName[\r\n Object.keys(Element.ByName)[Object.keys(Element.ByName).length - 1]])));\r\n element.number += 1;\r\n element.name = atom.elementType.toUpperCase();\r\n element.fullName = 'Unknown';\r\n Element.ByName[atom.elementType.toUpperCase()] = element;\r\n }\r\n const atomSerial = parseInt(atom.id.replace(/[^0-9]/, ''), 10);\r\n const added = residue.addAtom(\r\n atomFullNameStruct,\r\n element,\r\n xyz,\r\n Element.Role.SG,\r\n true,\r\n atomSerial,\r\n ' ',\r\n 1.0,\r\n 0.0,\r\n atomCharge,\r\n );\r\n if (atom.hydrogenCount) {\r\n added.hydrogenCount = parseInt(atom.hydrogenCount, 10);\r\n }\r\n if (atom.mrvValence) {\r\n added.valence = parseInt(atom.mrvValence, 10);\r\n }\r\n addFunc(added);\r\n }\r\n }\r\n }\r\n chains = null;// NOSONAR\r\n for (i = 0; i < data.bonds.length; i++) {\r\n const cb = data.bonds[i];\r\n if (this._unpackLabel(labels[cb.start]).molId === this._unpackLabel(currentLabel).molId\r\n && this._unpackLabel(labels[cb.end]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[cb.start];\r\n if (!atom || !(atoms[cb.end])) {\r\n continue; // skip invalid\r\n }\r\n this._parseBond(\r\n parseInt(atom.id.replace(/[^0-9]/, ''), 10),\r\n parseInt(atoms[cb.end].id.replace(/[^0-9]/, ''), 10),\r\n cb.order,\r\n cb.type,\r\n );\r\n }\r\n }\r\n\r\n for (i = 0; i < this._complex.getSGroupCount(); i++) {\r\n const sGrp = this._complex.getSGroups()[i];\r\n for (j = 0; j < sGrp._atoms.length; j++) {\r\n sGrp._atoms[j] = sGrp._atoms[j].complexAtom;\r\n }\r\n }\r\n for (i = 0; i < count; i++) {\r\n if (this._unpackLabel(labels[i]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[i];\r\n atom.complexAtom = null;\r\n delete atom.complexAtom;\r\n }\r\n }\r\n this._complex.originalCML = data.originalCML;\r\n this._fixBondsArray();\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n this._serialAtomMap = null;\r\n this._complex = null;\r\n return complex;\r\n }\r\n\r\n parseSync() {\r\n const complexes = [];\r\n const self = this;\r\n const moleculaSet = this._selectComponents(this._data);\r\n moleculaSet.forEach((molSet) => {\r\n molSet.curr = 2;\r\n if (molSet.count === 0) {\r\n molSet.count = 1;\r\n }\r\n for (let i = 0; i < molSet.count; i++) {\r\n molSet.curr = (i + 1);\r\n complexes.push(self._parseSet(molSet, false));\r\n }\r\n });\r\n\r\n let totalAtomsParsed = 0;\r\n complexes.forEach((c) => {\r\n totalAtomsParsed += c.getAtomCount();\r\n });\r\n if (totalAtomsParsed <= 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n if (complexes.length > 1) {\r\n const joinedComplex = new Complex();\r\n joinedComplex.joinComplexes(complexes);\r\n joinedComplex.originalCML = complexes[0].originalCML;\r\n return joinedComplex;\r\n }\r\n if (complexes.length === 1) {\r\n return complexes[0];\r\n }\r\n return new Complex();\r\n }\r\n}\r\n\r\nCMLParser.formats = ['cml'];\r\nCMLParser.extensions = ['.cml'];\r\n\r\nexport default CMLParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport MMTF from '../../../vendor/js/mmtf';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst {\r\n Complex,\r\n Chain,\r\n Atom,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nclass ArrayComparator {\r\n constructor(original) {\r\n this._original = Array.from(original);\r\n this._original.sort();\r\n\r\n this._sum = 0;\r\n for (let i = 0; i < this._original.length; ++i) {\r\n this._sum += this._original[i];\r\n }\r\n }\r\n\r\n compare(candidate) {\r\n const len = candidate.length;\r\n if (len !== this._original.length) {\r\n return false;\r\n }\r\n\r\n let sum = 0;\r\n let i;\r\n for (i = 0; i < len; ++i) {\r\n sum += candidate[i];\r\n }\r\n\r\n if (sum !== this._sum) {\r\n return false;\r\n }\r\n\r\n const sorted = Array.from(candidate);\r\n sorted.sort();\r\n\r\n for (i = 0; i < len; ++i) {\r\n if (sorted[i] !== this._original[i]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\nArrayComparator.prototype.constructor = ArrayComparator;\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see https://github.com/rcsb/mmtf-javascript/blob/master/src/mmtf-traverse.js\r\nconst secStructToType = [\r\n StructuralElementType.HELIX_PI, // 0\r\n StructuralElementType.BEND, // 1\r\n StructuralElementType.HELIX_ALPHA, // 2\r\n StructuralElementType.STRAND, // 3\r\n StructuralElementType.HELIX_310, // 4\r\n StructuralElementType.BRIDGE, // 5\r\n StructuralElementType.TURN, // 6\r\n StructuralElementType.COIL, // 7\r\n];\r\n\r\nfunction getFirstByte(buf) {\r\n const bytes = new Uint8Array(buf, 0, 1);\r\n return bytes[0];\r\n}\r\n\r\nclass MMTFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'mmtf';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n // check if it's binary MessagePack format containing a map (dictionary)\r\n // see https://github.com/msgpack/msgpack/blob/master/spec.md\r\n return _.isArrayBuffer(data) && ((getFirstByte(data) | 1) === 0xDF);\r\n }\r\n\r\n _onModel(_modelData) {\r\n }\r\n\r\n _onChain(chainData) {\r\n if (chainData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const chain = new Chain(this._complex, chainData.chainName);\r\n this._complex._chains[chainData.chainIndex] = chain;\r\n chain._index = chainData.chainIndex;\r\n }\r\n\r\n _onGroup(groupData) {\r\n if (groupData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n if (this.settings.now.nowater) {\r\n // skip water\r\n if (groupData.groupName === 'HOH' || groupData.groupName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n const chain = this._complex._chains[groupData.chainIndex];\r\n const icode = !groupData.insCode.charCodeAt(0) ? '' : groupData.insCode;\r\n const residue = chain.addResidue(groupData.groupName, groupData.groupId, icode);\r\n residue._index = groupData.groupIndex;\r\n\r\n this._updateSecStructure(this._complex, residue, groupData);\r\n }\r\n\r\n _onAtom(atomData) {\r\n if (atomData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const altLoc = !atomData.altLoc.charCodeAt(0) ? '' : atomData.altLoc;\r\n const atom = new Atom(\r\n atomData.groupIndex, // we store residue index here to replace it later with actual reference\r\n atomData.atomName,\r\n Element.getByName(atomData.element.toUpperCase()),\r\n new THREE.Vector3(atomData.xCoord, atomData.yCoord, atomData.zCoord),\r\n Element.Role[atomData.atomName],\r\n false, // hetero atoms will be marked later\r\n atomData.atomId,\r\n altLoc,\r\n atomData.occupancy,\r\n atomData.bFactor,\r\n atomData.formalCharge,\r\n );\r\n\r\n this._complex._atoms[atomData.atomIndex] = atom;\r\n atom.index = atomData.atomIndex;\r\n\r\n this._serialAtomMap[atomData.atomId] = atom;\r\n }\r\n\r\n _onBond(bondData) {\r\n const right = Math.max(bondData.atomIndex1, bondData.atomIndex2);\r\n if (right >= this._complex._atoms.length) {\r\n return;\r\n }\r\n const left = Math.min(bondData.atomIndex1, bondData.atomIndex2);\r\n this._complex.addBond(\r\n this._complex._atoms[left],\r\n this._complex._atoms[right],\r\n bondData.bondOrder,\r\n Bond.BondType.UNKNOWN,\r\n true,\r\n );\r\n }\r\n\r\n _updateSecStructure(complex, residue, groupData) {\r\n const helixClasses = [3, -1, 1, -1, 5];\r\n\r\n if (!_.isUndefined(groupData) && groupData.secStruct === this._ssType) {\r\n residue._secondary = this._ssStruct;\r\n if (this._ssStruct) {\r\n this._ssStruct.term = residue;\r\n }\r\n return;\r\n }\r\n\r\n if (!_.isUndefined(groupData)) {\r\n // start new secondary structure\r\n const type = secStructToType[groupData.secStruct];\r\n this._ssType = groupData.secStruct;\r\n this._ssStart = residue;\r\n\r\n let struct = null;\r\n switch (this._ssType) {\r\n case -1: // undefined\r\n case 7: // coil\r\n break;\r\n case 0: // pi helix\r\n case 2: // alpha helix\r\n case 4: // 3-10 helix\r\n struct = new Helix(helixClasses[this._ssType], residue, residue, 0, '', '', 0);\r\n complex._helices.push(struct);\r\n break;\r\n case 3: { // extended\r\n const sheet = new Sheet('', 0);\r\n complex._sheets.push(sheet);\r\n struct = new Strand(sheet, residue, residue, 0, null, null);\r\n break;\r\n }\r\n default:\r\n if (type !== undefined) {\r\n struct = new StructuralElement(type, residue, residue);\r\n }\r\n break;\r\n }\r\n\r\n this._ssStruct = struct;\r\n residue._secondary = struct;\r\n if (struct) {\r\n complex.structures.push(struct);\r\n }\r\n }\r\n }\r\n\r\n _updateMolecules(mmtfData) {\r\n const entities = mmtfData.entityList;\r\n if (!entities) {\r\n return;\r\n }\r\n\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < entities.length; i++) {\r\n const entity = entities[i];\r\n const chains = entity.chainIndexList;\r\n let residues = [];\r\n for (let j = 0; j < chains.length; j++) {\r\n const chainIndex = chains[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, entity.description, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n // populate complex with chains, residues and atoms\r\n _traverse(mmtfData) {\r\n const self = this;\r\n\r\n // get metadata\r\n const { metadata } = this._complex;\r\n metadata.id = mmtfData.structureId;\r\n metadata.title = [];\r\n metadata.title[0] = mmtfData.title;\r\n metadata.date = mmtfData.releaseDate;\r\n metadata.format = 'mmtf';\r\n\r\n // create event callback functions\r\n const eventCallbacks = {\r\n onModel(modelData) {\r\n self._onModel(modelData);\r\n },\r\n onChain(chainData) {\r\n self._onChain(chainData);\r\n },\r\n onGroup(groupData) {\r\n self._onGroup(groupData);\r\n },\r\n onAtom(atomData) {\r\n self._onAtom(atomData);\r\n },\r\n onBond(bondData) {\r\n self._onBond(bondData);\r\n },\r\n };\r\n\r\n // temporary variables used during traversal to track secondary structures\r\n this._ssType = -1;\r\n this._ssStruct = null;\r\n this._ssStart = null;\r\n\r\n // traverse the structure and listen to the events\r\n MMTF.traverse(mmtfData, eventCallbacks);\r\n\r\n this._updateSecStructure(this._complex);\r\n this._updateMolecules(mmtfData);\r\n }\r\n\r\n // During traversal atoms and residues don't come sequentially\r\n // so a residue for certain atom can be unavailable. Thus we\r\n // store residue index in atom.\r\n // This function being called after traversal replaces the index\r\n // with actual reference, and also populates atom lists in residues.\r\n _linkAtomsToResidues() {\r\n for (let i = 0; i < this._complex._atoms.length; ++i) {\r\n const atom = this._complex._atoms[i];\r\n const residue = this._complex._residues[atom.residue];\r\n atom.residue = residue;\r\n residue._atoms.push(atom);\r\n }\r\n }\r\n\r\n _findSynonymousChains() {\r\n const named = {};\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!named.hasOwnProperty(name)) {\r\n named[name] = [];\r\n }\r\n\r\n named[name].push(chain._index);\r\n }\r\n\r\n return named;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _parseAssemblyInfo(mmtfData) {\r\n let i;\r\n let j;\r\n let k;\r\n const assemblies = [];\r\n const { logger } = this;\r\n\r\n for (i = 0; i < mmtfData.bioAssemblyList.length; ++i) {\r\n const baInfo = mmtfData.bioAssemblyList[i];\r\n if (baInfo.transformList.length === 0) {\r\n continue;\r\n }\r\n\r\n const chains = baInfo.transformList[0].chainIndexList;\r\n const chainListCheck = new ArrayComparator(chains);\r\n\r\n // build list of chain names\r\n const chainNames = {};\r\n for (j = 0; j < chains.length; ++j) {\r\n chainNames[this._complex._chains[chains[j]].getName()] = 1;\r\n }\r\n\r\n // all chains with the same name should belong to assembly if one of them belongs\r\n const allChains = [];\r\n let name;\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n // just concat arrays -- there should be no duplicates\r\n Array.prototype.push.apply(allChains, this._chainsByName[name]);\r\n }\r\n }\r\n if (!chainListCheck.compare(allChains)) {\r\n // assembly is missing some of the chains\r\n logger.debug('MMTF: Assembly is missing some of the synonymous chains. Skipping...');\r\n }\r\n\r\n const a = new Assembly(this._complex);\r\n\r\n // add chains to assembly\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n a.addChain(name);\r\n }\r\n }\r\n\r\n // add unique matrices to assembly\r\n a.addMatrix(new THREE.Matrix4().fromArray(baInfo.transformList[0].matrix).transpose());\r\n for (j = 1; j < baInfo.transformList.length; ++j) {\r\n const transform = baInfo.transformList[j];\r\n\r\n if (!chainListCheck.compare(transform.chainIndexList)) {\r\n // list of chains for this transform doesn't match that for other transforms\r\n // this is illegal in our structure\r\n logger.debug('MMTF: Chain lists differ for different transforms in one assembly. Skipping...');\r\n continue;\r\n }\r\n\r\n const m = new THREE.Matrix4().fromArray(transform.matrix).transpose();\r\n\r\n // check if matrix is already in the list\r\n for (k = 0; k < a.matrices.length; ++k) {\r\n if (a.matrices[k].equals(m)) {\r\n break;\r\n }\r\n }\r\n\r\n if (k === a.matrices.length) {\r\n a.addMatrix(m);\r\n }\r\n }\r\n\r\n a.finalize();\r\n assemblies.push(a);\r\n }\r\n\r\n return assemblies;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _markHeteroAtoms(mmtfData) {\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < mmtfData.entityList.length; ++i) {\r\n const entity = mmtfData.entityList[i];\r\n if (entity.type !== 'polymer') {\r\n for (let j = 0; j < entity.chainIndexList.length; ++j) {\r\n const chainIndex = entity.chainIndexList[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n for (let k = 0; k < chain._residues.length; ++k) {\r\n const res = chain._residues[k];\r\n for (let m = 0; m < res._atoms.length; ++m) {\r\n res._atoms[m].het = true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // joins chains with the same name into single chain\r\n _joinSynonymousChains() {\r\n let i;\r\n let j;\r\n\r\n const primaryChainsArray = [];\r\n const primaryChainsHash = {};\r\n\r\n // join chains\r\n for (i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!primaryChainsHash.hasOwnProperty(name)) {\r\n // new name -- this is a primary chain\r\n primaryChainsHash[name] = chain;\r\n chain._index = primaryChainsArray.length; // update index as this array will later replace original chain list\r\n primaryChainsArray.push(chain);\r\n continue;\r\n }\r\n\r\n // this chain should be joined with the primary chain of the same name\r\n const primary = primaryChainsHash[name];\r\n for (j = 0; j < chain._residues.length; ++j) {\r\n const residue = chain._residues[j];\r\n primary._residues.push(residue);\r\n residue._chain = primary;\r\n }\r\n }\r\n\r\n // replace chains list with one containing only primary chains\r\n // dropping references to all chains but primary\r\n this._complex._chains = primaryChainsArray;\r\n }\r\n\r\n parseSync() {\r\n const mmtfData = MMTF.decode(this._data);\r\n\r\n this._complex = new Complex();\r\n this._serialAtomMap = {}; // filled during traversal\r\n\r\n this._traverse(mmtfData);\r\n this._linkAtomsToResidues();\r\n this._markHeteroAtoms(mmtfData);\r\n this._chainsByName = this._findSynonymousChains();\r\n Array.prototype.push.apply(this._complex.units, this._parseAssemblyInfo(mmtfData));\r\n this._joinSynonymousChains();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n return this._complex;\r\n }\r\n}\r\n\r\nMMTFParser.formats = ['mmtf'];\r\nMMTFParser.extensions = ['.mmtf'];\r\nMMTFParser.binary = true;\r\n\r\nexport default MMTFParser;\r\n","class ParsingError extends Error {\r\n constructor(message, line, column) {\r\n super(`data:${line}:${column}: ${message}`);\r\n\r\n if (Error.captureStackTrace) {\r\n Error.captureStackTrace(this, ParsingError);\r\n }\r\n\r\n this.name = 'ParsingError';\r\n this.parseLine = line;\r\n this.parseColumn = column;\r\n }\r\n}\r\n\r\nexport default ParsingError;\r\n","import _ from 'lodash';\r\nimport ParsingError from './ParsingError';\r\n\r\n// Implemented and being tested against: https://www.iucr.org/resources/cif/spec/version1.1/cifsyntax\r\n\r\nfunction _isWhitespace(ch) {\r\n return ch === 32 || ch === 10 || ch === 13 || ch === 9;\r\n}\r\n\r\nfunction _inlineIndexOf(ch0, str, idx) {\r\n const len = str.length;\r\n let ch = -1;\r\n while (idx < len) {\r\n ch = str.charCodeAt(idx);\r\n if (ch === ch0 || ch === 10) {\r\n break;\r\n }\r\n ++idx;\r\n }\r\n return ch === ch0 ? idx : -1;\r\n}\r\n\r\nexport default function readCIF(source) {\r\n let i = 0;\r\n let j = 0;\r\n const n = source.length;\r\n let code = NaN;\r\n let newline = true;\r\n let line = 1;\r\n let column = 1;\r\n let begin;\r\n let state = 0; // 0 - start, 1 - block, 2 - item, 3 - loop, 4 - values, 5 - value\r\n const result = {};\r\n let block = {};\r\n let keys = [];\r\n let keysCount = 0;\r\n let key = '';\r\n let values = [];\r\n let valuesCount = 0;\r\n let value;\r\n\r\n function _parseValue() {\r\n let val;\r\n if ((code === 46 || code === 63) && (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))) { // '.' or '?' .....\r\n // it's a missing value\r\n ++column;\r\n ++i;\r\n return undefined;\r\n }\r\n if (newline && code === 59) { // ';' ......................................................................\r\n // parse multi-line string\r\n j = i;\r\n let lines = 0;\r\n do {\r\n j = _inlineIndexOf(10, source, j + 1); // '\\n'\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated text block found', line, column);\r\n }\r\n ++lines;\r\n } while ((j + 1 < n && source.charCodeAt(j + 1) !== code) || j + 1 >= n);\r\n val = source.substring(i + 1, j).replace(/\\r/g, '');\r\n i = j + 2;\r\n line += lines;\r\n column = 1;\r\n newline = false;\r\n return val;\r\n }\r\n if (code === 39 || code === 34) { // ''' or '\"' ...........................................................\r\n // parse quoted string\r\n j = i;\r\n do {\r\n j = _inlineIndexOf(code, source, j + 1);\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated quoted string found', line, column);\r\n }\r\n } while (j + 1 < n && !_isWhitespace(source.charCodeAt(j + 1)));\r\n val = source.substring(i + 1, j);\r\n column += j - i + 1;\r\n i = j + 1;\r\n return val;\r\n } // ......................................................................................................\r\n // parse until the first whitespace\r\n j = i;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n val = source.substring(i, j);\r\n column += j - i;\r\n i = j;\r\n // try to convert to a number\r\n const num = Number(val);\r\n if (!Number.isNaN(num)) {\r\n return num;\r\n }\r\n // or leave as an unquoted string\r\n return val;\r\n }\r\n\r\n function _storeKey(tag) {\r\n keys[keysCount++] = tag;\r\n }\r\n\r\n function _storeValue(val) {\r\n const keyIndex = valuesCount % keysCount;\r\n values[keyIndex].push(val);\r\n ++valuesCount;\r\n return val;\r\n }\r\n\r\n while (i <= n) {\r\n code = source.charCodeAt(i); // 'NaN' in place of ''\r\n if (code === 13) { // '\\r' .......................................................................................\r\n // just ignore\r\n } else if (code === 10) { // '\\n' ................................................................................\r\n // take note of new lines\r\n newline = true;\r\n ++line;\r\n column = 1;\r\n } else {\r\n // process inline characters\r\n if (code === 32 || code === 9) { // ' ' or '\\t' ................................................................\r\n // just ignore\r\n } else if (code === 35) { // '#' ...............................................................................\r\n // skip the comment until before the end of the line\r\n i = _inlineIndexOf(10, source, i + 1); // '\\n'\r\n if (i === -1) {\r\n break;\r\n } else {\r\n continue; // don't forget to process the new line\r\n }\r\n } else if (state === 0) { // start =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n j = i + 5;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new data block\r\n result[source.substring(begin, i)] = block = {};\r\n state = 1; // block\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Data block name missing', line, column);\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 1) { // block =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n continue; // parse again in a different state\r\n } else if (code === 95) { // '_' .............................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // start new item\r\n key = source.substring(begin, i);\r\n state = 2; // item\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n i += 5;\r\n column += 5;\r\n if (i < n && !_isWhitespace(source.charCodeAt(i))) {\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n } else {\r\n // start new loop\r\n keys = [];\r\n keysCount = 0;\r\n values = [];\r\n valuesCount = 0;\r\n state = 3; // loop\r\n continue; // don't forget to process the whitespace\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 2) { // item ==============================================================================\r\n if (Number.isNaN(code)) {\r\n break;\r\n }\r\n value = _parseValue();\r\n _.set(block, key, value);\r\n state = 1; // block\r\n continue;\r\n } else if (state === 3) { // loop ==============================================================================\r\n if (code === 95) { // '_' ....................................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new key\r\n _storeKey(source.substring(begin, i));\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else { // ..................................................................................................\r\n if (keysCount > 0) {\r\n for (let keyIndex = 0; keyIndex < keysCount; ++keyIndex) {\r\n value = [];\r\n values[keyIndex] = value;\r\n _.set(block, keys[keyIndex], value);\r\n }\r\n state = 4;\r\n continue; // parse again in a different state\r\n }\r\n throw new ParsingError('Data tags are missing inside a loop', line, column);\r\n }\r\n } else if (state === 4) { // values ============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n } else if (code === 95) { // '_' .............................................................................\r\n state = 1; // block\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n state = 1; // block\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n state = 0;\r\n } else { // ..................................................................................................\r\n _storeValue(_parseValue());\r\n }\r\n continue; // parse again in a different state\r\n } else { // ====================================================================================================\r\n throw new ParsingError(`Unexpected internal state ${state}`, line, column);\r\n }\r\n\r\n newline = false;\r\n ++column;\r\n }\r\n ++i;\r\n }\r\n\r\n if (state === 2) { // item\r\n throw new ParsingError(`Unexpected end of file in state ${state}`, line, column);\r\n }\r\n\r\n return result;\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\nimport readCIF from './readCIF';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nconst cRequiredAtomFields = [\r\n 'auth_seq_id',\r\n 'Cartn_x',\r\n 'Cartn_y',\r\n 'Cartn_z',\r\n 'label_atom_id',\r\n];\r\n\r\nconst cSecondaryCoding = {\r\n helx: 'helix',\r\n turn: 'turn',\r\n strn: 'strand',\r\n};\r\n\r\nfunction getTypeFromId(string) {\r\n const typeId = /[A-Za-z]+/.exec(string);\r\n if (!typeId) {\r\n return null;\r\n }\r\n\r\n return cSecondaryCoding[typeId[0].toLowerCase()];\r\n}\r\n\r\n/**\r\n * Make valid object an array\r\n * @param arrayLikeObject\r\n * @return {array, object} array or object\r\n */\r\nfunction arrize(arrayLikeObject) {\r\n if (arrayLikeObject === null || arrayLikeObject === undefined || _.isArray(arrayLikeObject)) {\r\n return arrayLikeObject;\r\n }\r\n return [arrayLikeObject];\r\n}\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\nclass AtomDataError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'AtomDataError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction _getOperations(operList) {\r\n if (!operList) {\r\n return null;\r\n }\r\n const idc = arrize(operList.id);\r\n const { matrix, vector } = operList;\r\n if (!idc || !matrix || !vector) {\r\n return null;\r\n }\r\n\r\n const ops = [];\r\n for (let i = 0, n = idc.length; i < n; ++i) {\r\n const mtx = new THREE.Matrix4();\r\n const { elements } = mtx;\r\n\r\n for (let row = 0; row < 3; ++row) {\r\n const matrixData = matrix[row + 1];\r\n elements[row] = arrize(matrixData[1])[i];\r\n elements[row + 4] = arrize(matrixData[2])[i];\r\n elements[row + 8] = arrize(matrixData[3])[i];\r\n elements[row + 12] = arrize(vector[row + 1])[i];\r\n }\r\n ops[idc[i]] = mtx;\r\n }\r\n return ops;\r\n}\r\n\r\nfunction _extractOperations(assemblyGen, opsDict) {\r\n assemblyGen = _.isString(assemblyGen) ? assemblyGen : `${assemblyGen}`;\r\n const l = assemblyGen.replace(/\\)\\s*\\(/g, '!').replace(/[()']/g, '');\r\n const groupStr = l.split('!');\r\n const gps = [];\r\n\r\n for (let grIdx = 0, grCount = groupStr.length; grIdx < grCount; ++grIdx) {\r\n const gr = groupStr[grIdx].split(',');\r\n const gp = [];\r\n let idx = 0;\r\n for (let i = 0, n = gr.length; i < n; ++i) {\r\n const s = gr[i];\r\n if (s.includes('-')) {\r\n const es = s.split('-');\r\n let j = parseInt(es[0], 10);\r\n const m = parseInt(es[1], 10);\r\n for (; j <= m; ++j) {\r\n gp[idx++] = opsDict[j];\r\n }\r\n } else {\r\n gp[idx++] = opsDict[s];\r\n }\r\n }\r\n gps.push(gp);\r\n }\r\n\r\n // traverse all groups from the end of array and make all mults\r\n const matrices = [];\r\n let cnt = 0;\r\n function traverse(level, mtx) {\r\n for (let ii = 0, nn = gps[level].length; ii < nn; ++ii) {\r\n const newMtx = mtx ? mtx.clone() : new THREE.Matrix4();\r\n newMtx.multiplyMatrices(gps[level][ii], newMtx);\r\n if (level === 0) {\r\n matrices[cnt++] = newMtx;\r\n } else {\r\n traverse(level - 1, newMtx);\r\n }\r\n }\r\n }\r\n traverse(gps.length - 1);\r\n return matrices;\r\n}\r\n\r\nclass CIFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this.asymDict = {};\r\n this.molecules = [];\r\n this._options.fileType = 'cif';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*data_/i.test(data);\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing CIF file..');\r\n const data = readCIF(this._data);\r\n return this._toComplex(data);\r\n }\r\n\r\n /**\r\n * Convert intermediate structure into our valid Complex object\r\n * @param cifData intermediate CIF object\r\n * @returns {Complex} complex\r\n * @private\r\n */\r\n _toComplex(cifData) {\r\n const complex = new Complex();\r\n const complexData = cifData[Object.keys(cifData)[0]];\r\n this._extractAtoms(complex, complexData);\r\n this._extractSecondary(complex, complexData);\r\n this._extractAssemblies(complex, complexData);\r\n this._extractMolecules(complex, complexData);\r\n this._extractMetadata(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n\r\n return complex;\r\n }\r\n\r\n /**\r\n * Extract metadata\r\n * @param complex structure to fill\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n\r\n _extractMetadata(complex, complexData) {\r\n const { metadata } = complex;\r\n metadata.id = complexData.entry.id;\r\n metadata.classification = complexData.struct_keywords.pdbx_keywords;\r\n const databaserev = complexData.database_PDB_rev;\r\n metadata.date = (databaserev && databaserev.date_original) ? databaserev.date_original : '';\r\n metadata.format = 'cif';\r\n metadata.title = [];\r\n metadata.title[0] = complexData.struct.title;\r\n }\r\n\r\n /**\r\n * Extract molecules information from CIF structure (should be called strictly after _extractAtoms)\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractMolecules(complex, complexData) {\r\n const molData = complexData.entity;\r\n const names = arrize(molData.pdbx_description);\r\n const count = names.length;\r\n let i;\r\n\r\n // molecules names from cif\r\n for (i = 0; i < count; i++) {\r\n if (this.molecules[i]) { // molecule was created during atoms processing\r\n this.molecules[i].name = names[i];\r\n } else { // molecule wasn't created, because there is no atom which is contained\r\n this.molecules[i] = { name: names[i], residues: [] };\r\n }\r\n }\r\n\r\n // reorganize molecules for complex and check chains\r\n const molecules = complex.getMolecules();\r\n for (i = 0; i < count; i++) {\r\n const molecule = this.molecules[i];\r\n molecules[i] = new Molecule(complex, molecule.name, i + 1);\r\n molecules[i].residues = molecule.residues;\r\n }\r\n }\r\n\r\n /**\r\n * Extract atom information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAtoms(complex, complexData) {\r\n const atomData = complexData.atom_site;\r\n if (!atomData) {\r\n throw new AtomDataError('CIF parsing error: atom_site is not specified!');\r\n }\r\n\r\n for (let f = 0, n = cRequiredAtomFields.length; f < n; ++f) {\r\n if (!atomData[cRequiredAtomFields[f]]) {\r\n throw new AtomDataError(`CIF parsing error: requires field ${cRequiredAtomFields[f]} not found!`);\r\n }\r\n }\r\n\r\n const { asymDict } = this;\r\n // required fields\r\n const resIdc = arrize(atomData.auth_seq_id);\r\n const x = arrize(atomData.Cartn_x);\r\n const y = arrize(atomData.Cartn_y);\r\n const z = arrize(atomData.Cartn_z);\r\n const names = arrize(atomData.label_atom_id);\r\n const count = names.length;\r\n // optional fields\r\n const group = arrize(atomData.group_PDB) || [];\r\n const chainIdc = arrize(atomData.auth_asym_id) || [];\r\n const chainLabelIdc = arrize(atomData.label_asym_id) || [];\r\n const serials = arrize(atomData.id) || [];\r\n const iCodes = arrize(atomData.pdbx_PDB_ins_code) || [];\r\n const resNames = arrize(atomData.label_comp_id) || [];\r\n const elements = arrize(atomData.type_symbol) || [];\r\n const tempFactors = arrize(atomData.B_iso_or_equiv) || [];\r\n const occupancies = arrize(atomData.occupancy) || [];\r\n const charges = arrize(atomData.pdbx_formal_charge) || [];\r\n const altLocs = arrize(atomData.label_alt_id) || [];\r\n const models = arrize(atomData.pdbx_PDB_model_num) || [];\r\n const molecules = arrize(atomData.label_entity_id) || [];\r\n\r\n let chain = null;\r\n let residue = null;\r\n for (let i = 0; i < count; ++i) {\r\n const model = models[i] || 1;\r\n if (model !== 1) {\r\n continue;\r\n }\r\n const chainID = String(chainIdc[i] || ' ');\r\n\r\n if (!chain || chain.getName() !== chainID) {\r\n chain = complex.getChain(chainID) || complex.addChain(chainID);\r\n }\r\n asymDict[String(chainLabelIdc[i] || ' ')] = chainID;\r\n const resSeq = resIdc[i];\r\n const iCode = String(iCodes[i] || ' ');\r\n const resName = String(resNames[i] || '');\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n residue = chain.addResidue(resName, resSeq, iCode);\r\n\r\n // store residue in appropriate molecule\r\n const moleculeIdx = molecules[i] - 1;\r\n let entity = this.molecules[moleculeIdx];\r\n if (!entity) { // create new molecule if it hasn't been created\r\n this.molecules[moleculeIdx] = { name: '', residues: [] };\r\n entity = this.molecules[moleculeIdx];\r\n }\r\n entity.residues.push(residue);\r\n }\r\n\r\n const name = names[i];\r\n const element = elements[i] || nameToElement(name);\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name.trim()];\r\n const xyz = new THREE.Vector3(x[i], y[i], z[i]);\r\n const het = group[i] === 'HETATM' || false;\r\n const serial = serials[i] || i;\r\n const tempFactor = tempFactors[i] || 0.0;\r\n const occupancy = occupancies[i] || 0.0;\r\n const altLoc = String(altLocs[i] || '');\r\n const charge = charges[i] || 0;\r\n\r\n residue.addAtom(\r\n name,\r\n type,\r\n xyz,\r\n role,\r\n het,\r\n serial,\r\n altLoc,\r\n occupancy,\r\n tempFactor,\r\n charge,\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Extracts secondary structure information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex - complex to fill\r\n * @param complexData - CIF complex data\r\n * @private\r\n */\r\n _extractSecondary(complex, complexData) {\r\n if (complexData.struct_conf) {\r\n this._extractConfs(complex, complexData.struct_conf);\r\n }\r\n if (complexData.struct_sheet_range) {\r\n this._extractSheets(complex, complexData.struct_sheet_range);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts sheets information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param sheetData\r\n * @private\r\n */\r\n _extractSheets(complex, sheetData) {\r\n const { asymDict } = this;\r\n if (!sheetData.sheet_id || !sheetData.id || !sheetData.beg_label_seq_id || !sheetData.end_label_seq_id\r\n || !sheetData.beg_label_asym_id) {\r\n return;\r\n }\r\n // Strand(sheet, start, end, sense, cur, prev)\r\n const sheets = complex._sheets;\r\n\r\n function getSheet(name) {\r\n const n = sheets.length;\r\n for (let i = 0; i < n; ++i) {\r\n if (sheets[i]._name === name) {\r\n return sheets[i];\r\n }\r\n }\r\n sheets[n] = new Sheet(name, 0);\r\n return sheets[n];\r\n }\r\n\r\n const sheetNames = arrize(sheetData.sheet_id);\r\n const strandNames = arrize(sheetData.id);\r\n const starts = arrize(sheetData.beg_auth_seq_id);\r\n const ends = arrize(sheetData.end_auth_seq_id);\r\n const chains = arrize(sheetData.beg_label_asym_id);\r\n const stICodes = arrize(sheetData.pdbx_beg_PDB_ins_code) || [];\r\n const endICodes = arrize(sheetData.pdbx_end_PDB_ins_code) || [];\r\n\r\n for (let i = 0, n = strandNames.length; i < n; ++i) {\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n const sheet = getSheet(sheetNames[i]);\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n\r\n const strand = new Strand(sheet, start[0], end[0], 0, null, null);\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = strand;\r\n }\r\n sheet.addStrand(strand);\r\n complex.structures.push(strand);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts helix/turn/strand(?) information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param helicesData\r\n * @private\r\n */\r\n _extractConfs(complex, helicesData) {\r\n const { asymDict } = this;\r\n if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id\r\n || !helicesData.beg_label_asym_id) {\r\n return;\r\n }\r\n\r\n const types = arrize(helicesData.conf_type_id);\r\n const starts = arrize(helicesData.beg_auth_seq_id);\r\n const stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || [];\r\n const ends = arrize(helicesData.end_auth_seq_id);\r\n const endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || [];\r\n const comments = arrize(helicesData.details) || [];\r\n const lengths = arrize(helicesData.pdbx_PDB_helix_length) || [];\r\n const helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || [];\r\n const names = arrize(helicesData.id) || [];\r\n const chains = arrize(helicesData.beg_label_asym_id);\r\n\r\n for (let i = 0, n = types.length; i < n; ++i) {\r\n const type = getTypeFromId(types[i]);\r\n if (!type) {\r\n continue;\r\n }\r\n const name = names[i] || types[i];\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n const comment = comments[i] || '';\r\n const length = lengths[i] || 0;\r\n const helixClass = helixClasses[i] || ' ';\r\n let struct;\r\n if (type === 'helix') {\r\n const idx = complex._helices.length;\r\n struct = new Helix(helixClass, start[0], end[0], idx, name, comment, length);\r\n complex.addHelix(struct);\r\n complex.structures.push(struct);\r\n } else if (type === 'turn') {\r\n struct = new StructuralElement(StructuralElement.Type.TURN, start[0], end[0]);\r\n complex.structures.push(struct);\r\n } else {\r\n struct = null;\r\n }\r\n if (!struct) {\r\n continue;\r\n }\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = struct;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Extract biological assemblies information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAssemblies(complex, complexData) {\r\n const { asymDict } = this;\r\n const asmGen = complexData.pdbx_struct_assembly_gen;\r\n if (!asmGen) {\r\n return;\r\n }\r\n\r\n const asmIdx = arrize(asmGen.assembly_id);\r\n const asmOper = arrize(asmGen.oper_expression);\r\n const asmList = arrize(asmGen.asym_id_list);\r\n if (!asmIdx || !asmOper || !asmList) {\r\n return;\r\n }\r\n\r\n const operList = _getOperations(complexData.pdbx_struct_oper_list);\r\n if (!operList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = asmIdx.length; i < n; ++i) {\r\n const asm = new Assembly(complex);\r\n const assemblyOps = _extractOperations(asmOper[i], operList);\r\n const entries = asmList[i].split(',');\r\n for (let ii = 0, nn = entries.length; ii < nn; ++ii) {\r\n const chain = entries[ii].trim();\r\n if (chain.length > 0) {\r\n asm.addChain(asymDict[chain]);\r\n }\r\n }\r\n asm.matrices = assemblyOps;\r\n complex.units.push(asm);\r\n }\r\n }\r\n}\r\n\r\nCIFParser.formats = ['cif', 'mmcif'];\r\nCIFParser.extensions = ['.cif', '.mmcif'];\r\n\r\nexport default CIFParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Volume from '../../chem/Volume';\r\n\r\nexport const valueType = {\r\n singular: 0,\r\n vector: 1,\r\n array: 2,\r\n buffer: 3,\r\n};\r\n\r\nclass VolumeModel {\r\n _xyz2crs = [];\r\n\r\n _origin = new THREE.Vector3(0, 0, 0);\r\n\r\n constructor() {\r\n this._header = {};\r\n this._boxSize = new THREE.Vector3();\r\n this._boxStart = new THREE.Vector3();\r\n this._header.delta = {};\r\n this._header.extent = [];\r\n this._header.nstart = [];\r\n this._header.grid = [];\r\n this._header.crs2xyz = [];\r\n this._header.cellDims = new THREE.Vector3();\r\n this._header.angles = [];\r\n this._header.origin = new THREE.Vector3(0, 0, 0);\r\n this._header.dmin = 0;\r\n this._header.dmean = 0;\r\n this._header.dmax = 0;\r\n }\r\n\r\n _typedCheck() {\r\n if (_.isTypedArray(this._buff)) {\r\n this._buff = this._buff.buffer;\r\n } else if (!_.isArrayBuffer(this._buff)) {\r\n throw new TypeError('Expected ArrayBuffer or TypedArray');\r\n }\r\n }\r\n\r\n _fillHeader(headerFormat, arrays) {\r\n for (const key in headerFormat) {\r\n if (headerFormat.hasOwnProperty(key)) {\r\n switch (headerFormat[key][0]) {\r\n case valueType.singular:\r\n this._header[key] = arrays[headerFormat[key][1]][headerFormat[key][2]];\r\n break;\r\n\r\n case valueType.array:\r\n this._parseArray(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.vector:\r\n this._parseVector(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.buffer:\r\n this._header[key] = new Uint8Array(\r\n arrays[headerFormat[key][1]],\r\n [headerFormat[key][2]] * 4,\r\n [headerFormat[key][3]] * 4,\r\n );\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _parseVector(vector, arr, pos) {\r\n [vector.x, vector.y, vector.z] = [arr[pos], arr[pos + 1], arr[pos + 2]];\r\n }\r\n\r\n _parseArray(vector, arr, pos) {\r\n vector[0] = arr[pos];\r\n vector[1] = arr[pos + 1];\r\n vector[2] = arr[pos + 2];\r\n }\r\n\r\n _parseHeader(_buffer) {}\r\n\r\n _setAxisIndices() {}\r\n\r\n _setOrigins() {}\r\n\r\n _getAxis() {\r\n const header = this._header;\r\n\r\n const xScale = header.cellDims.x / header.grid[0];\r\n const yScale = header.cellDims.y / header.grid[1];\r\n const zScale = header.cellDims.z / header.grid[2];\r\n\r\n const [alpha, beta, gamma] = header.angles;\r\n\r\n const z1 = Math.cos(beta);\r\n const z2 = (Math.cos(alpha) - Math.cos(beta)\r\n * Math.cos(gamma)) / Math.sin(gamma);\r\n const z3 = Math.sqrt(1.0 - z1 * z1 - z2 * z2);\r\n\r\n const xaxis = new THREE.Vector3(xScale, 0, 0);\r\n const yaxis = new THREE.Vector3(Math.cos(gamma) * yScale, Math.sin(gamma) * yScale, 0);\r\n const zaxis = new THREE.Vector3(z1 * zScale, z2 * zScale, z3 * zScale);\r\n\r\n return [xaxis, yaxis, zaxis];\r\n }\r\n\r\n _getXYZdim() {\r\n return [this._header.extent[this._xyz2crs[0]],\r\n this._header.extent[this._xyz2crs[1]],\r\n this._header.extent[this._xyz2crs[2]]];\r\n }\r\n\r\n _getVolumeInfo() {\r\n const volInfo = _.pick(this._header, ['dmean', 'dmin', 'dmax', 'sd', 'delta']);\r\n volInfo.obtuseAngle = this._header.angles.map((angle) => Number(angle >= (Math.PI / 2)));\r\n return volInfo;\r\n }\r\n\r\n _setBoxParams(xaxis, yaxis, zaxis) {\r\n // if axes are not orthogonal, the origins might not match with box coordinates - need to make shift\r\n let shiftX = 0;\r\n let shiftY = 0;\r\n const [alpha, beta, gamma] = this._header.angles;\r\n\r\n if (gamma >= Math.PI / 2) {\r\n shiftX += Math.abs(yaxis.x);\r\n }\r\n if (beta >= Math.PI / 2) {\r\n shiftX += Math.abs(zaxis.x);\r\n }\r\n if (alpha >= Math.PI / 2) {\r\n shiftY += Math.abs(zaxis.y);\r\n }\r\n\r\n this._boxStart = new THREE.Vector3(this._origin.x - shiftX, this._origin.y - shiftY, this._origin.z);\r\n this._boxSize = new THREE.Vector3(\r\n Math.abs(xaxis.x) + Math.abs(yaxis.x) + Math.abs(zaxis.x),\r\n Math.abs(yaxis.y) + Math.abs(zaxis.y),\r\n Math.abs(zaxis.z),\r\n );\r\n\r\n const delta = (axe, proj) => (Math.abs(axe[proj]) / this._boxSize[proj]);\r\n this._header.delta.x = delta(yaxis, 'x');\r\n this._header.delta.y = delta(zaxis, 'x');\r\n this._header.delta.z = delta(zaxis, 'y');\r\n }\r\n\r\n _getXYZbox() {\r\n return new THREE.Box3(this._boxStart.clone(), this._boxStart.clone().add(this._boxSize));\r\n }\r\n\r\n _toXYZData() {}\r\n\r\n parse(data) {\r\n this._parseHeader(data);\r\n this._setOrigins();\r\n return new Volume(Float32Array, this._getXYZdim(), this._getXYZbox(), 1, this._toXYZData(), this._getVolumeInfo());\r\n }\r\n}\r\n\r\nexport default VolumeModel;\r\n","import Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\nconst CCP4Header = {\r\n extent: [valueType.array, 'u32', 0],\r\n type: [valueType.singular, 'u32', 3],\r\n nstart: [valueType.array, 'i32', 4],\r\n grid: [valueType.array, 'u32', 7],\r\n cellDims: [valueType.vector, 'f32', 10],\r\n angles: [valueType.array, 'f32', 13],\r\n crs2xyz: [valueType.array, 'i32', 16],\r\n dmin: [valueType.singular, 'f32', 19],\r\n dmax: [valueType.singular, 'f32', 20],\r\n dmean: [valueType.singular, 'f32', 21],\r\n ispg: [valueType.singular, 'u32', 22],\r\n nsymbt: [valueType.singular, 'u32', 23],\r\n lksflg: [valueType.singular, 'u32', 24],\r\n customData: [valueType.buffer, 'buffer', 25, 9],\r\n origin: [valueType.vector, 'f32', 34],\r\n map: [valueType.buffer, 'buffer', 52, 1],\r\n machine: [valueType.singular, 'u32', 53],\r\n sd: [valueType.singular, 'f32', 54],\r\n nlabel: [valueType.singular, 'f32', 55],\r\n label: [valueType.buffer, 'buffer', 56, 200],\r\n};\r\n\r\nclass Ccp4Model extends VolumeModel {\r\n // read header (http://www.ccp4.ac.uk/html/maplib.html)\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n const arrays = {};\r\n arrays.u32 = new Uint32Array(this._buff, 0, 56);\r\n arrays.i32 = new Int32Array(this._buff, 0, 56);\r\n arrays.f32 = new Float32Array(this._buff, 0, 56);\r\n arrays.buffer = this._buff;\r\n const header = this._header;\r\n\r\n this._fillHeader(CCP4Header, arrays);\r\n\r\n // calculate non-orthogonal unit cell coordinates\r\n header.angles.forEach((angle, i, a) => { a[i] *= Math.PI / 180.0; });\r\n }\r\n\r\n _setAxisIndices() {\r\n const header = this._header;\r\n\r\n if (header.cellDims.x === 0.0 && header.cellDims.y === 0.0 && header.cellDims.z === 0.0) {\r\n header.cellDims.set(1.0, 1.0, 1.0);\r\n }\r\n // Apply header conversion\r\n // Mapping between CCP4 column, row, section and VMD x, y, z.\r\n const { crs2xyz } = this._header;\r\n if (crs2xyz[0] === 0 && crs2xyz[1] === 0 && crs2xyz[2] === 0) {\r\n crs2xyz[0] = 1;\r\n crs2xyz[1] = 2;\r\n crs2xyz[2] = 3;\r\n }\r\n\r\n const xyz2crs = this._xyz2crs;\r\n xyz2crs[crs2xyz[0] - 1] = 0; // column\r\n xyz2crs[crs2xyz[1] - 1] = 1; // row\r\n xyz2crs[crs2xyz[2] - 1] = 2; // section\r\n }\r\n\r\n _setOrigins() {\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n const header = this._header;\r\n const xyz2crs = this._xyz2crs;\r\n // Handle both MRC-2000 and older format maps\r\n if (header.origin.x === 0.0 && header.origin.y === 0.0 && header.origin.z === 0.0) {\r\n this._origin.addScaledVector(xaxis, header.nstart[xyz2crs[0]]);\r\n this._origin.addScaledVector(yaxis, header.nstart[xyz2crs[1]]);\r\n this._origin.addScaledVector(zaxis, header.nstart[xyz2crs[2]]);\r\n } else {\r\n this._origin = header.origin;\r\n // Use ORIGIN records rather than old n[xyz]start records\r\n // http://www2.mrc-lmb.cam.ac.uk/image2000.html\r\n // XXX the ORIGIN field is only used by the EM community, and\r\n // has undefined meaning for non-orthogonal maps and/or non-cubic voxels, etc.\r\n }\r\n xaxis.multiplyScalar(header.extent[xyz2crs[0]] - 1);\r\n yaxis.multiplyScalar(header.extent[xyz2crs[1]] - 1);\r\n zaxis.multiplyScalar(header.extent[xyz2crs[2]] - 1);\r\n\r\n if (header.type === 2) {\r\n this._data = new Float32Array(\r\n this._buff,\r\n 1024 + header.nsymbt,\r\n header.extent[0] * header.extent[1] * header.extent[2],\r\n );\r\n } else {\r\n throw new Error(`CCP4: Unsupported format ${header.type}`);\r\n }\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const data = this._data;\r\n const xyz2crs = this._xyz2crs;\r\n const xyzData = new Float32Array(data.length);\r\n\r\n const dim = this._getXYZdim();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n\r\n let crsIdx = 0;\r\n const coord = [];\r\n let x;\r\n let y;\r\n let z;\r\n for (coord[2] = 0; coord[2] < header.extent[2]; coord[2]++) { // Site\r\n for (coord[1] = 0; coord[1] < header.extent[1]; coord[1]++) { // Row\r\n for (coord[0] = 0; coord[0] < header.extent[0]; coord[0]++, crsIdx++) { // Column\r\n x = coord[xyz2crs[0]];\r\n y = coord[xyz2crs[1]];\r\n z = coord[xyz2crs[2]];\r\n xyzData[x + xSize * (y + ySize * z)] = data[crsIdx];\r\n }\r\n }\r\n }\r\n\r\n return xyzData;\r\n }\r\n}\r\n\r\nclass CCP4Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'ccp4';\r\n this.model = new Ccp4Model();\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false; // Autodetection is not implemented yet\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nCCP4Parser.formats = ['ccp4'];\r\nCCP4Parser.extensions = ['.ccp4', '.map', '.mrc'];\r\nCCP4Parser.binary = true;\r\n\r\nexport default CCP4Parser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element, Molecule } = chem;\r\n\r\nclass XYZParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n this._options.fileType = 'xyz';\r\n this._fileName = options.name;\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*\\d+ *\\n[^\\n]*\\n\\s*\\w{1,3}\\s+-?\\d/.test(data);\r\n }\r\n\r\n _parseToAtomsInf(source) {\r\n const endnAtoms = source.indexOf('\\n');\r\n const nAtoms = parseInt(source.substring(0, endnAtoms), 10);\r\n const endComment = source.indexOf('\\n', endnAtoms + 1);\r\n let comment = source.slice(endnAtoms + 1, endComment).trim();\r\n if (comment.length === 0) {\r\n comment = this._fileName;\r\n }\r\n\r\n const startAtomsInf = endComment + source.substring(endComment).search(/\\S/);\r\n this._atomsInf = source.substring(startAtomsInf).split(/[\\s,]*\\n[\\s,]*/);\r\n if (!Number.isNaN(nAtoms) && (this._atomsInf.length - 1 !== nAtoms)) {\r\n this._complex.error = {\r\n message: 'wrong number of atoms',\r\n };\r\n return;\r\n }\r\n\r\n this._complex.metadata.format = 'xyz';\r\n this._complex.name = comment;\r\n }\r\n\r\n _parseAtomsInf() {\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n\r\n const chain = this._complex.addChain('A');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0; i < this._atomsInf.length - 1; i++) {\r\n const words = this._atomsInf[i].split(/[\\s,]+/);\r\n\r\n if (words.length !== 4) {\r\n this._complex.error = {\r\n message: 'missed parameters',\r\n };\r\n break;\r\n }\r\n\r\n const serial = i + 1;\r\n const name = words[0];\r\n const xyz = new THREE.Vector3(parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3]));\r\n const type = Element.getByName(name);\r\n const role = undefined;\r\n\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n const molecule = new Molecule(this._complex, this._complex.name, 1);\r\n molecule.residues = residue;\r\n this._complex._molecules[0] = molecule;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n\r\n this._parseToAtomsInf(this._data);\r\n this._parseAtomsInf();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n return result;\r\n }\r\n\r\n static formats = ['xyz'];\r\n\r\n static extensions = ['.xyz'];\r\n}\r\n\r\nexport default XYZParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element } = chem;\r\n\r\nclass PubChemParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'pubchem+json';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && data[0] === '{';\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing PubChem JSON file...');\r\n return this._toComplex(JSON.parse(this._data));\r\n }\r\n\r\n _toComplex(jsonData) {\r\n const complex = new Complex();\r\n const complexData = jsonData.PC_Compounds && jsonData.PC_Compounds[0];\r\n if (complexData) {\r\n this._extractAtoms(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n }\r\n return complex;\r\n }\r\n\r\n _extractAtoms(complex, complexData) {\r\n let aids = complexData.atoms && complexData.atoms.aid;\r\n let elements = aids && complexData.atoms.element;\r\n if (!elements || aids.length !== elements.length) {\r\n throw new Error('Unable to parse atom elements');\r\n }\r\n elements = _.fromPairs(_.zip(aids, elements));\r\n const atoms = {};\r\n\r\n const coords = complexData.coords && complexData.coords[0];\r\n const model = coords && coords.conformers && coords.conformers[0];\r\n const xs = model && model.x;\r\n const ys = model && model.y;\r\n const zs = (model && model.z) || [];\r\n aids = coords && coords.aid;\r\n if (!aids || !xs || !ys) {\r\n throw new Error('Coordinates are not found in the file');\r\n }\r\n\r\n const chain = complex.addChain(' ');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0, n = aids.length; i < n; ++i) {\r\n const aid = aids[i];\r\n const element = Element.ByAtomicNumber[elements[aid]];\r\n const xyz = new THREE.Vector3(xs[i], ys[i], zs[i] || 0.0);\r\n atoms[aid] = residue.addAtom(element.name, element, xyz, undefined, true, aid, ' ', 1.0, 0.0, 0);\r\n }\r\n\r\n const aids1 = complexData.bonds && complexData.bonds.aid1;\r\n const aids2 = complexData.bonds && complexData.bonds.aid2;\r\n const orders = (complexData.bonds && complexData.bonds.order) || [];\r\n if (!aids1 || !aids2 || aids1.length !== aids2.length) {\r\n return;\r\n }\r\n\r\n for (let j = 0, m = aids1.length; j < m; ++j) {\r\n complex.addBond(atoms[aids1[j]], atoms[aids2[j]], orders[j] || 1, 0, true);\r\n }\r\n }\r\n}\r\n\r\nPubChemParser.formats = ['pubchem', 'pubchem+json', 'pc'];\r\nPubChemParser.extensions = ['.json'];\r\n\r\nexport default PubChemParser;\r\n","import _ from 'lodash';\r\n\r\nexport default class SDFStream {\r\n constructor(data) {\r\n this._strings = data.split(/\\r?\\n|\\r/);\r\n this._currentStart = 0;\r\n this._currentStringIndx = 0;\r\n }\r\n\r\n setStart(start) {\r\n if (start >= this._strings.length) {\r\n this._currentStart = this._strings.length - 1;\r\n this._currentStringIndx = this._strings.length - 1;\r\n } else {\r\n this._currentStart = start;\r\n this._currentStringIndx = start;\r\n }\r\n }\r\n\r\n getNextString() {\r\n return this._strings[++this._currentStringIndx];\r\n }\r\n\r\n getCurrentString() {\r\n return this._strings[this._currentStringIndx];\r\n }\r\n\r\n getStringFromStart(numb) {\r\n this._currentStringIndx = this._currentStart + numb;\r\n return this._strings[this._currentStart + numb];\r\n }\r\n\r\n findNextDataItem() {\r\n let curStr = this.getNextString();\r\n let res = false;\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n if (curStr.match(/>\\s+<(.*)>/)) {\r\n res = true;\r\n break;\r\n }\r\n curStr = this.getNextString();\r\n }\r\n\r\n return res;\r\n }\r\n\r\n findNextCompoundStart() {\r\n let curStr = this.getCurrentString();\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n curStr = this.getNextString();\r\n }\r\n this.setStart(++this._currentStringIndx);\r\n return this.probablyHaveDataToParse();\r\n }\r\n\r\n probablyHaveDataToParse() {\r\n return this._currentStringIndx < this._strings.length - 2;\r\n }\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport SDFStream from './SDFStream';\r\nimport Assembly from '../../chem/Assembly';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst chargeMap = [0, 3, 2, 1, 0, -1, -2, -3];\r\nconst orderMap = [0, 1, 2, 3, 1, 1, 1, 2];\r\nconst typeMap = [\r\n Bond.BondType.UNKNOWN, // 0 - error\r\n Bond.BondType.COVALENT, // 1 - single\r\n Bond.BondType.COVALENT, // 2 - double\r\n Bond.BondType.COVALENT, // 3 - triple\r\n Bond.BondType.AROMATIC, // 4 - aromatic\r\n Bond.BondType.UNKNOWN, // 5 - single or double\r\n Bond.BondType.AROMATIC, // 6 - single or aromatic\r\n Bond.BondType.AROMATIC, // 7 - double or aromatic\r\n // 8 - any\r\n // 9 - coordination\r\n // 10 - hydrogen\r\n];\r\n\r\nconst sdfAndMolRegexp = /.*(M\\s\\sEND).*|.*(^$$$$).*|.*>\\s+<(.+)>.*/;\r\nconst sdfRegExp = /.*($$$$).*|.*>\\s+<(.+)>.*/;\r\n\r\nconst fileFormat = { SDF: 'sdf', MOL: 'mol' };\r\n\r\nconst possibleNameTags = ['PUBCHEM_IUPAC_TRADITIONAL_NAME', /PUBCHEM_(.+)_NAME/, /(.+)name/, /(.+)NAME/];\r\nconst possibleIDTags = ['PUBCHEM_COMPOUND_CID', 'id', 'ID', /.*CID/, /.*ID/, /.*id/];\r\nconst possibleTitleTags = ['msg', 'MSG', 'message', 'title', 'description', 'desc'];\r\nconst tagsNames = ['name', 'id', 'title'];\r\nconst tags = { name: possibleNameTags, id: possibleIDTags, title: possibleTitleTags };\r\n\r\nfunction buildChainID(index) {\r\n if (!index) {\r\n return 'A';\r\n }\r\n\r\n const codes = [];\r\n while (index) {\r\n codes.push(65 + (index % 26));\r\n index = Math.trunc(index / 26);\r\n }\r\n if (codes.length > 1) {\r\n codes.reverse();\r\n codes[0] -= 1;\r\n }\r\n\r\n return String.fromCharCode(...codes);\r\n}\r\n\r\nexport default class SDFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._format = 'sdf';\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._molecules = null;\r\n this._metadata = {};\r\n this._metadata.molecules = [];\r\n this._currentMolProps = {};\r\n this._compoundIndx = -1;\r\n this._assemblies = [];\r\n this._atomsParsed = 0;\r\n this._atomsIndexes = [];\r\n }\r\n\r\n canProbablyParse(data) {\r\n return _.isString(data) && sdfAndMolRegexp.test(data);\r\n }\r\n\r\n _parseHeader(stream) {\r\n const molecule = {};\r\n molecule.name = stream.getStringFromStart(0);\r\n const date = parseInt(stream.getStringFromStart(1).substr(10, 6).trim(), 10);\r\n molecule.date = date.toString() || '';\r\n molecule.title = stream.getStringFromStart(2);\r\n this._metadata.molecules.push(molecule);\r\n }\r\n\r\n _parseAtoms(stream, atomsNum) {\r\n let curStr;\r\n let serial = this._atomsParsed;\r\n\r\n // each molecule = chain\\residue\r\n const chainID = buildChainID(this._compoundIndx);\r\n const resName = 'UNK';\r\n const resSeq = 1;\r\n\r\n this._chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = this._chain.addResidue(resName, resSeq, ' ');\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n curStr = stream.getNextString();\r\n serial++;\r\n const x = parseFloat(curStr.substr(0, 10));\r\n const y = parseFloat(curStr.substr(10, 10));\r\n const z = parseFloat(curStr.substr(20, 10));\r\n const charge = chargeMap[parseInt(curStr.substr(36, 3), 10)];\r\n const xyz = new THREE.Vector3(x, y, z);\r\n let name = curStr.substr(31, 3).trim().toUpperCase();\r\n const type = Element.getByName(name);\r\n if (!this._atomsIndexes[name]) {\r\n this._atomsIndexes[name] = 0;\r\n }\r\n this._atomsIndexes[name] += 1;\r\n name += this._atomsIndexes[name]; // every atom need to have unique name.\r\n\r\n this._residue.addAtom(name, type, xyz, undefined, true, serial, ' ', 1.0, 0.0, charge);\r\n }\r\n }\r\n\r\n _parseBonds(stream, bondsNum) {\r\n let curStr;\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n curStr = stream.getNextString();\r\n let atom1 = parseInt(curStr.substr(0, 3), 10) + this._atomsParsed;\r\n let atom2 = parseInt(curStr.substr(3, 3), 10) + this._atomsParsed;\r\n const bondType = parseInt(curStr.substr(6, 3), 10);\r\n\r\n if (atom1 > atom2) {\r\n [atom1, atom2] = [atom2, atom1];\r\n }\r\n this._complex.addBond(\r\n atom1,\r\n atom2,\r\n orderMap[bondType] || 1,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true,\r\n );\r\n }\r\n }\r\n\r\n _parseMOL(stream) {\r\n this._compoundIndx++;\r\n\r\n this._parseHeader(stream);\r\n const countsLine = stream.getStringFromStart(3);\r\n const atomsNum = parseInt(countsLine.substr(0, 3), 10);\r\n const bondsNum = parseInt(countsLine.substr(3, 3), 10);\r\n this._parseAtoms(stream, atomsNum);\r\n this._parseBonds(stream, bondsNum);\r\n\r\n this._atomsParsed += atomsNum;\r\n\r\n this._metadata.molecules[this._compoundIndx]._residues = [];\r\n this._metadata.molecules[this._compoundIndx]._residues.push(this._residue);\r\n }\r\n\r\n _parseDataItem(stream) {\r\n const tag = stream.getCurrentString();\r\n\r\n let data = [];\r\n let curStr = stream.getNextString();\r\n\r\n // read data\r\n while (curStr.trim() !== '') {\r\n data.push(curStr);\r\n curStr = stream.getNextString();\r\n }\r\n if (data.length === 1) {\r\n [data] = data;\r\n }\r\n this._currentMolProps[tag.replace(/[<>]/g, '').trim()] = data;\r\n }\r\n\r\n _parseCompound(stream) {\r\n this._parseMOL(stream);\r\n\r\n // parse data items block\r\n if (this._format === fileFormat.SDF) {\r\n this._currentMolProps = {};\r\n while (stream.findNextDataItem()) {\r\n this._parseDataItem(stream);\r\n }\r\n if (Object.keys(this._currentMolProps).length !== 0) {\r\n const molecule = this._metadata.molecules[this._compoundIndx];\r\n molecule.props = this._currentMolProps;\r\n this._tryToUpdateMoleculeData(molecule);\r\n }\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n console.log('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _buildAssemblies() {\r\n const chains = this._complex._chains;\r\n\r\n if (chains.length === 1) {\r\n return this._assemblies;\r\n }\r\n\r\n for (let i = 0; i < chains.length; i++) {\r\n const assembly = new Assembly(this._complex);\r\n const matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n assembly.addChain(chains[i]._name);\r\n this._assemblies.push(assembly);\r\n }\r\n\r\n return this._assemblies;\r\n }\r\n\r\n _buildMolecules() {\r\n this._complex._molecules = [];\r\n const { molecules } = this._metadata;\r\n for (let i = 0; i < molecules.length; i++) {\r\n const molecule = new Molecule(this._complex, molecules[i].name, i + 1);\r\n molecule.residues = molecules[i]._residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n\r\n return this._complex._molecules;\r\n }\r\n\r\n _searchTag(tag, props) {\r\n for (let i = 0; i < props.length; i++) {\r\n if ((tag instanceof RegExp && tag.test(props[i].tag)) || tag === props[i].tag) {\r\n return props[i].data;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToFind(tagsList, props) {\r\n for (let j = 0; j < tagsList.length; j++) {\r\n const res = this._searchTag(tagsList[j], props);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToUpdateMoleculeData(molecule) {\r\n let res = false;\r\n for (let i = 0; i < tagsNames.length; i++) {\r\n const tagPossibleNames = tags[tagsNames[i]];\r\n const data = this._tryToFind(tagPossibleNames, molecule.props);\r\n if (data) {\r\n molecule[tagsNames[i]] = data;\r\n res = true;\r\n }\r\n }\r\n\r\n molecule.name = molecule.name || molecule.id;\r\n if (molecule.name.match(/^\\d+$/)) {\r\n molecule.name = `CID: ${molecule.name}`;\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _finalizeMetadata() {\r\n const { molecules } = this._metadata;\r\n const { metadata } = this._complex;\r\n const complex = this._complex;\r\n\r\n if (molecules.length === 1) {\r\n complex.name = molecules[0].name;\r\n metadata.title = molecules[0].title;\r\n metadata.date = molecules[0].date;\r\n metadata.properties = molecules[0].props;\r\n } else if (molecules.length > 1) {\r\n metadata.molecules = [];\r\n for (let i = 0; i < molecules.length; i++) {\r\n metadata.molecules.push({\r\n name: molecules[i].name, date: molecules[i].date, title: molecules[i].title, properties: molecules[i].props,\r\n });\r\n }\r\n }\r\n }\r\n\r\n _finalize() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n this._complex._finalizeBonds();\r\n this._fixBondsArray();\r\n this._finalizeMetadata();\r\n this._buildAssemblies();\r\n this._complex.units = this._complex.units.concat(this._assemblies);\r\n this._buildMolecules();\r\n this._complex.finalize({\r\n needAutoBonding: false, detectAromaticLoops: false, enableEditing: false, serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n defineFormat(data) {\r\n let format;\r\n if (sdfRegExp.test(data)) {\r\n format = fileFormat.SDF;\r\n } else {\r\n format = fileFormat.MOL;\r\n }\r\n\r\n return format;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const stream = new SDFStream(this._data);\r\n\r\n this._format = this.defineFormat(this._data);\r\n result.metadata.format = this._format;\r\n\r\n do {\r\n this._parseCompound(stream);\r\n } while (stream.findNextCompoundStart());\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nSDFParser.formats = ['mol', 'sdf'];\r\nSDFParser.extensions = ['.mol', '.sdf'];\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\n// http://www.uoxray.uoregon.edu/tnt/manual/node104.html\r\nconst DSN6Header = {\r\n nstart: [valueType.array, 'i16', 0],\r\n extent: [valueType.array, 'i16', 3],\r\n grid: [valueType.array, 'i16', 6],\r\n cellDims: [valueType.vector, 'i16', 9],\r\n angles: [valueType.array, 'i16', 12],\r\n div: [valueType.singular, 'i16', 15],\r\n adder: [valueType.singular, 'i16', 16],\r\n scaleFactor: [valueType.singular, 'i16', 17],\r\n};\r\n\r\nclass DSN6Model extends VolumeModel {\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n\r\n const arrays = {};\r\n arrays.i16 = new Int16Array(this._buff);\r\n\r\n // check and reverse if big endian\r\n if (arrays.i16[18] !== 100) {\r\n for (let i = 0, n = arrays.i16.length; i < n; ++i) {\r\n const val = arrays.i16[i];\r\n arrays.i16[i] = ((val & 0xff) << 8) | ((val >> 8) & 0xff);\r\n }\r\n }\r\n if (arrays.i16[18] !== 100) {\r\n throw new Error('DSN6: Incorrect format ');\r\n }\r\n\r\n const header = this._header;\r\n\r\n this._fillHeader(DSN6Header, arrays);\r\n header.cellDims.multiplyScalar(1.0 / header.scaleFactor);\r\n header.angles.forEach((angle, i, a) => { a[i] *= (Math.PI / 180.0) / header.scaleFactor; });\r\n header.div /= 100;\r\n }\r\n\r\n _setAxisIndices() {\r\n this._xyz2crs[0] = 0;\r\n this._xyz2crs[1] = 1;\r\n this._xyz2crs[2] = 2;\r\n }\r\n\r\n _setOrigins() {\r\n const header = this._header;\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n this._origin.addScaledVector(xaxis, header.nstart[0]);\r\n this._origin.addScaledVector(yaxis, header.nstart[1]);\r\n this._origin.addScaledVector(zaxis, header.nstart[2]);\r\n\r\n xaxis.multiplyScalar(header.extent[0]);\r\n yaxis.multiplyScalar(header.extent[1]);\r\n zaxis.multiplyScalar(header.extent[2]);\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _pointCalculate(xyzData, byteBuffer, z, y, x, pos, i) {\r\n const header = this._header;\r\n\r\n if (x < header.extent[0] && y < header.extent[1] && z < header.extent[2]) {\r\n const idx = x + header.extent[0] * (y + header.extent[1] * z);\r\n xyzData[idx] = (byteBuffer[pos.counter] - header.adder) / header.div;\r\n ++pos.counter;\r\n } else {\r\n pos.counter += 8 - i;\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n _blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos) {\r\n for (let k = 0; k < 8; ++k) {\r\n const z = 8 * zBlock + k;\r\n for (let j = 0; j < 8; ++j) {\r\n const y = 8 * yBlock + j;\r\n let inRange = true;\r\n let i = 0;\r\n while (inRange && i < 8) {\r\n const x = 8 * xBlock + i;\r\n inRange = this._pointCalculate(xyzData, byteBuffer, z, y, x, pos, i);\r\n i++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const byteBuffer = new Uint8Array(this._buff);\r\n const xyzData = new Float32Array(header.extent[0] * header.extent[1] * header.extent[2]);\r\n\r\n const blocks = new THREE.Vector3(header.extent[0] / 8, header.extent[1] / 8, header.extent[2] / 8);\r\n\r\n const pos = {};\r\n pos.counter = 512;\r\n\r\n for (let zBlock = 0; zBlock < blocks.z; ++zBlock) {\r\n for (let yBlock = 0; yBlock < blocks.y; ++yBlock) {\r\n for (let xBlock = 0; xBlock < blocks.x; ++xBlock) {\r\n this._blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos);\r\n }\r\n }\r\n }\r\n this._calculateInfoParams(xyzData);\r\n return xyzData;\r\n }\r\n\r\n _calculateInfoParams(xyzData) {\r\n this._header.dmean /= xyzData.length;\r\n let dispersion = 0;\r\n let minDensity = xyzData[0];\r\n let maxDensity = xyzData[0];\r\n for (let j = 0; j < xyzData.length; j++) {\r\n dispersion += (this._header.dmean - xyzData[j]) ** 2;\r\n\r\n if (xyzData[j] < minDensity) {\r\n minDensity = xyzData[j];\r\n }\r\n if (xyzData[j] > maxDensity) {\r\n maxDensity = xyzData[j];\r\n }\r\n }\r\n this._header.sd = Math.sqrt(dispersion / xyzData.length);\r\n this._header.dmax = maxDensity;\r\n this._header.dmin = minDensity;\r\n }\r\n}\r\n\r\nclass DSN6Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'dsn6';\r\n this.model = new DSN6Model();\r\n }\r\n\r\n static canParse(data, options) {\r\n if (!data) {\r\n return false;\r\n }\r\n return data instanceof ArrayBuffer && Parser.checkDataTypeOptions(options, 'dsn6');\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false;\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nDSN6Parser.formats = ['dsn6'];\r\nDSN6Parser.extensions = ['.dsn6', '.omap'];\r\nDSN6Parser.binary = true;\r\n\r\nexport default DSN6Parser;\r\n","import PDBStream from './PDBStream';\r\n\r\n/**\r\n * Little helper class for GRO Parser usage.\r\n * @extends PDBStream\r\n */\r\nclass GROReader extends PDBStream {\r\n constructor(data) {\r\n super(data);\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n this.next();\r\n }\r\n\r\n /**\r\n * Getting end of string.\r\n * @returns {Number} Pointer to end of string\r\n */\r\n getNext() {\r\n return this._next;\r\n }\r\n}\r\n\r\nexport default GROReader;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport GROReader from './GROReader';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Molecule,\r\n} = chem;\r\n\r\n/**\r\n * Gromos87 file format parser.\r\n * @extends Parser\r\n */\r\nclass GROParser extends Parser {\r\n /**\r\n * Create parser for .gro file format\r\n *\r\n * @param {String} data Input file\r\n * @param {String} options Input options (optional field)\r\n */\r\n constructor(data, options) {\r\n super(data, options);\r\n /** @type Date */\r\n this._time = null; // Time in ps, optional field for animations\r\n /** @type Number */\r\n this._numAtoms = null; // Number of atoms in complex\r\n /** @type Number */\r\n this._residueNumber = null; // Number of exact residue\r\n /** @type String */\r\n this._residueName = ''; // Scientific name of exact residue\r\n /** @type String */\r\n this._atomName = ''; // Scientific name of exact atom\r\n /** @type Number */\r\n this._atomNumber = null; // Sorted number of exact atom\r\n /** @type Array */\r\n this._atomPosition = []; // Array which contains x, y, z position of exact atom\r\n /** @type Array */\r\n this._atomVelocity = []; // Array which contains x, y, z velocity of exact atom (optional)\r\n /** @type Complex */\r\n this._complex = null; // Complex structure for unified molecule representation\r\n /** @type Vector3 */\r\n this._molecules = []; // Molecules array\r\n /** @type Molecule */\r\n this._molecule = null; // Single molecule\r\n /** @type String */\r\n this._options.filetype = 'gro'; // Extension of data file.\r\n }\r\n\r\n /**\r\n * General check for possibility of parsing.\r\n * @param {String} data - Input file\r\n * @returns {boolean} true if this file is in ascii, false otherwise\r\n */\r\n canProbablyParse(data) {\r\n return _.isString(this._data) && /^\\s*[^\\n]*\\n\\s*\\d+ *\\n\\s*\\d+[^\\n\\d]{3}\\s*\\w+\\s*\\d+\\s*-?\\d/.test(data);\r\n }\r\n\r\n /**\r\n * Parsing title of molecule complex.\r\n * NOTE: that names are ESTIMATES, there is no strict rules in Gromos87 standard for first line in input file.\r\n * @param {GROReader} line - Line containing title and time.\r\n */\r\n _parseTitle(line) {\r\n const { metadata } = this._complex;\r\n metadata.id = line.readLine().trim();\r\n metadata.name = metadata.id.slice(metadata.id.lastIndexOf('\\\\') + 1, metadata.id.lastIndexOf('.'));\r\n metadata.format = 'gro';\r\n }\r\n\r\n /**\r\n * Parsing line containing number of atoms information.\r\n * @param {GROReader} line - Line containing number of atoms.\r\n */\r\n _parseNumberOfAtoms(line) {\r\n this._numAtoms = line.readInt(0, line.getNext());\r\n if (Number.isNaN(this._numAtoms)) {\r\n throw new Error('Line 2 is not representing atom number. Consider checking input file');\r\n }\r\n }\r\n\r\n /**\r\n * Parsing line containing information about residues, atoms etc. Also information about box vectors.\r\n * Format of atoms MUST (by Gromos87 standard) be this: (note that numbering starts not from 0, but from 1!)\r\n * ResidueNumber[1 - 5] ResidueName[6 - 10] AtomName[11 - 15] AtomNumber[16 - 20] Position[21 - 45] Velocity[46 - 69]\r\n * @param {GROReader} line - Line containing information about atom.\r\n */\r\n _parseAtom(line) {\r\n this._residueNumber = line.readInt(1, 5);\r\n this._residueName = line.readString(6, 10).trim();\r\n this._atomName = line.readString(11, 15).trim();\r\n this._atomNumber = line.readInt(16, 20);\r\n const positionX = line.readFloat(21, 28) * 10;\r\n const positionY = line.readFloat(29, 36) * 10;\r\n const positionZ = line.readFloat(37, 45) * 10;\r\n if (Number.isNaN(positionX) || Number.isNaN(positionY) || Number.isNaN(positionZ)) {\r\n this._complex.error = {\r\n message: `Atom position is invalid in \"${line.readLine()}\"`,\r\n };\r\n return;\r\n }\r\n /* const velocityX = line.readFloat(46, 53);\r\n const velocityY = line.readFloat(54, 61);\r\n const velocityZ = line.readFloat(62, 69); */\r\n /* Adding residue and atom to complex structure */\r\n const type = Element.getByName(this._atomName[0]); /* MAGIC 0. REASONS: This name is something like \"CA\", where\r\n C - is an element an A is something else. But what about Calcium? */\r\n if (type.fullName === 'Unknown') {\r\n this._complex.error = {\r\n message: `${this._atomName[0]} hasn't been recognised as an atom name.`,\r\n };\r\n return;\r\n }\r\n const role = Element.Role[this._atomName];\r\n /* Firstly, create a dummy chain */\r\n let chain = this._chain;\r\n if (!chain) {\r\n this._chain = chain = this._complex.addChain('A');\r\n }\r\n /* Secondly, add residue to that chain */\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== this._residueNumber) {\r\n this._residue = residue = chain.addResidue(this._residueName, this._residueNumber, ' ');\r\n }\r\n /* Lastly, add atom to that residue */\r\n this._atomPosition = new THREE.Vector3(positionX, positionY, positionZ);\r\n /* Adding default constants to correct atom addition process */\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n residue.addAtom(this._atomName, type, this._atomPosition, role, het, this._atomNumber, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n /**\r\n * Some finalizing procedures. In '.gro' file format there is only 1 chain and 1 molecule.\r\n */\r\n _finalize() {\r\n const molecule = new Molecule(this._complex, this._complex.metadata.name, 1);\r\n // aggregate residues from chain\r\n molecule.residues = this._chain._residues;\r\n molecule._chains = this._chain;\r\n this._complex._molecules[0] = molecule;\r\n this._molecules.push(molecule);\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n /**\r\n * Main parsing procedure.\r\n * @returns {Complex} Complex structure for visualizing.\r\n */\r\n parseSync() {\r\n /* Create \"Complex\" variable */\r\n const result = this._complex = new Complex();\r\n /* Parse input file line-by-line */\r\n const reader = new GROReader(this._data);\r\n let counter = 0; /* Simple counter regarding to format of .gro file */\r\n /* First two lines - technical information, other lines - Atoms */\r\n this._parseTitle(reader);\r\n reader.next();\r\n this._parseNumberOfAtoms(reader);\r\n reader.next();\r\n for (counter = 0; counter < this._numAtoms; ++counter) {\r\n if (!reader.end()) {\r\n this._parseAtom(reader);\r\n reader.next();\r\n } else break;\r\n }\r\n /* If number of atoms in second line is less then actual atoms in file */\r\n if (counter < this._numAtoms) {\r\n this._complex.error = {\r\n message: 'File ended unexpectedly.',\r\n };\r\n }\r\n /* Catch errors occurred in parsing process */\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n\r\n /* Finalizing data */\r\n this._finalize();\r\n\r\n /* Cleaning up */\r\n this._atomPosition = null;\r\n this._complex = null;\r\n this._molecules = null;\r\n this._molecule = null;\r\n\r\n /* Return resulting Complex variable */\r\n return result;\r\n }\r\n}\r\n\r\nGROParser.formats = ['gro'];\r\nGROParser.extensions = ['.gro'];\r\n\r\nexport default GROParser;\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst orderMap = {\r\n un: 0,\r\n 1: 1,\r\n 2: 2,\r\n 3: 3,\r\n ar: 1,\r\n am: 1,\r\n nc: 0,\r\n du: 1,\r\n};\r\nconst typeMap = {\r\n un: Bond.BondType.UNKNOWN, // unknown (cannot be determined from the parameter tables)\r\n 1: Bond.BondType.COVALENT, // single\r\n 2: Bond.BondType.COVALENT, // double\r\n 3: Bond.BondType.COVALENT, // triple\r\n ar: Bond.BondType.AROMATIC, // aromatic\r\n am: Bond.BondType.COVALENT, // amide\r\n nc: Bond.BondType.UNKNOWN, // not connected\r\n du: Bond.BondType.COVALENT, // dummy\r\n};\r\n\r\nconst resNumberRegex = /\\d+$/;\r\nconst spacesRegex = /\\s+/;\r\n\r\nfunction splitToFields(str) {\r\n return str.trim().split(spacesRegex);\r\n}\r\n/* There is no jsdoc documentation because of eslint corrections:\r\n * not all Parser methods are implemented\r\n */\r\n\r\nclass MOL2Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._compoundIndx = -1;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n\r\n this._currPosIdx = 0;\r\n this._currStartIdx = 0;\r\n\r\n this._serialAtomMap = {};\r\n\r\n this._options.fileType = 'mol2';\r\n }\r\n\r\n _parseRawStrings(data) {\r\n return data.split(/\\r?\\n|\\r/);\r\n }\r\n\r\n _toStringFromStart(numb, MOL2Data) {\r\n const newPosIdx = this._currStartIdx + numb;\r\n this._currPosIdx = (newPosIdx < MOL2Data.length) ? newPosIdx : this._currStartIdx;\r\n }\r\n\r\n _toHeaderString(header, MOL2Data) {\r\n this._toStringFromStart(0, MOL2Data);\r\n while (this._currPosIdx < MOL2Data.length) {\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`)) {\r\n return;\r\n }\r\n this._currPosIdx++;\r\n }\r\n this._toStringFromStart(0, MOL2Data);\r\n }\r\n\r\n _toStringFromHeader(header, numb, MOL2Data) {\r\n this._toHeaderString(header, MOL2Data);\r\n const newPosIdx = this._currPosIdx + numb;\r\n\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`) && newPosIdx < MOL2Data.length) {\r\n this._currPosIdx = newPosIdx;\r\n }\r\n }\r\n\r\n _setStart(startPos, MOL2Data) {\r\n if (startPos >= MOL2Data.length) {\r\n this._currStartIdx = this._currPosIdx = MOL2Data.length - 1;\r\n } else {\r\n this._currStartIdx = this._currPosIdx = startPos;\r\n }\r\n }\r\n\r\n _probablyHaveDataToParse(MOL2Data) {\r\n return this._currPosIdx < MOL2Data.length - 2;\r\n }\r\n\r\n _findNextCompoundStart(MOL2Data) {\r\n while (this._currPosIdx < MOL2Data.length && MOL2Data[this._currPosIdx].trim() !== '@MOLECULE>') {\r\n this._currPosIdx++;\r\n }\r\n this._setStart(++this._currPosIdx, MOL2Data);\r\n return this._probablyHaveDataToParse(MOL2Data);\r\n }\r\n\r\n _parseMolecule(MOL2Data) {\r\n this._toHeaderString('MOLECULE', MOL2Data);\r\n\r\n const { metadata } = this._complex;\r\n metadata.name = MOL2Data[++this._currPosIdx];\r\n metadata.format = 'mol2';\r\n\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = this._compoundIndx + 1;\r\n this._molecules.push(this._molecule);\r\n }\r\n\r\n /* Atom format description:\r\n * atomId atomName x y z element [resSeq [resName [charge [statusBit]]]]\r\n * statusBits is the internal SYBYL status bits associated with the atom.\r\n * These should never be set by the user.\r\n * Source: http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf\r\n */\r\n _parseAtoms(atomsNum, MOL2Data) {\r\n this._toHeaderString('ATOM', MOL2Data);\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 6) {\r\n throw new Error('MOL2 parsing error: Not enough information to create atom!');\r\n }\r\n const atomId = parseInt(parsedStr[0], 10);\r\n const atomName = parsedStr[1];\r\n\r\n const x = parseFloat(parsedStr[2]);\r\n const y = parseFloat(parsedStr[3]);\r\n const z = parseFloat(parsedStr[4]);\r\n\r\n const element = parsedStr[5].split('.')[0].toUpperCase();\r\n\r\n let charge = 0;\r\n if (parsedStr.length >= 9) {\r\n charge = parseFloat(parsedStr[8]) || 0.0;\r\n }\r\n\r\n let chain = this._chain;\r\n if (!chain) {\r\n // .mol2 may contain information about multiple molecules, but they can't be visualized\r\n // at the same time now. There is no need to create different chain IDs then.\r\n this._chain = chain = this._complex.getChain('A') || this._complex.addChain('A');\r\n this._residue = null;\r\n }\r\n if (!this._setResidue(parsedStr)) {\r\n continue;\r\n }\r\n\r\n // These fields are not listed in mol2 format. Set them default.\r\n // Atoms and het atoms doesn't differ in .mol2,\r\n // but het atoms have special residues. It can be used in next updates\r\n const het = false;\r\n const altLoc = ' ';\r\n const occupancy = 1.0;\r\n const tempFactor = 0.0;\r\n const type = Element.getByName(element);\r\n const role = Element.Role[atomName];\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n this._residue.addAtom(atomName, type, xyz, role, het, atomId, altLoc, occupancy, tempFactor, charge);\r\n }\r\n }\r\n\r\n _setResidue(parsedStr) {\r\n let resSeq = 1;\r\n let resName = 'UNK'; // The same meaning has '<0>' in some mol2 files\r\n\r\n if (parsedStr.length >= 7) {\r\n resSeq = parseInt(parsedStr[6], 10);\r\n }\r\n if (parsedStr.length >= 8 && parsedStr[7] !== '<0>') {\r\n resName = parsedStr[7].replace(resNumberRegex, '');\r\n }\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return false;\r\n }\r\n }\r\n const residue = this._residue;\r\n const chain = this._chain;\r\n if (!residue || residue.getSequence() !== resSeq) {\r\n this._residue = chain.addResidue(resName, resSeq, 'A');\r\n }\r\n return true;\r\n }\r\n\r\n /* Bond format description\r\n * bondId originAtomId targetAtomId bondType [statusBits]\r\n */\r\n _parseBonds(bondsNum, MOL2Data) {\r\n this._toHeaderString('BOND', MOL2Data);\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 3) {\r\n throw new Error('MOL2 parsing error: Missing information about bonds!');\r\n }\r\n\r\n let originAtomId = parseInt(parsedStr[1], 10);\r\n let targetAtomId = parseInt(parsedStr[2], 10);\r\n const bondType = parsedStr[3];\r\n\r\n if (originAtomId > targetAtomId) {\r\n [originAtomId, targetAtomId] = [targetAtomId, originAtomId];\r\n }\r\n this._complex.addBond(\r\n originAtomId,\r\n targetAtomId,\r\n orderMap[bondType] || 0,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true,\r\n );\r\n }\r\n }\r\n\r\n _fixSerialAtoms() {\r\n const atoms = this._complex._atoms;\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n this._serialAtomMap[atom.serial] = atom;\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n if (Object.keys(serialAtomMap).length === 0) {\r\n throw new Error('MOL2 parsing error: Missing atom information!');\r\n }\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _finalizeMolecules() {\r\n // Get chain from complex\r\n const chain = this._complex._chains[0];\r\n this._complex._molecules = [];\r\n\r\n // Aggregate residues from chains\r\n // (to be precise from the chain 'A')\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const currMolecule = this._molecules[i];\r\n const molResidues = chain._residues;\r\n const molecule = new Molecule(this._complex, currMolecule._name, i + 1);\r\n molecule.residues = molResidues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _finalize() {\r\n this._complex._finalizeBonds();\r\n this._fixSerialAtoms();\r\n this._fixBondsArray();\r\n this._finalizeMolecules();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _parseCompound(MOL2Data) {\r\n this._compoundIndx++;\r\n this._parseMolecule(MOL2Data);\r\n\r\n // Ignoring comments and everything before @MOLECULE block\r\n this._toStringFromHeader('MOLECULE', 2, MOL2Data);\r\n\r\n const parsedStr = MOL2Data[this._currPosIdx].trim().split(spacesRegex);\r\n const atomsNum = parsedStr[0];\r\n const bondsNum = parsedStr[1];\r\n\r\n this._parseAtoms(atomsNum, MOL2Data);\r\n this._parseBonds(bondsNum, MOL2Data);\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const MOL2Data = this._parseRawStrings(this._data);\r\n do {\r\n this._parseCompound(MOL2Data);\r\n } while (this._findNextCompoundStart(MOL2Data));\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nMOL2Parser.formats = ['mol2'];\r\nMOL2Parser.extensions = ['.mol2', '.ml2', '.sy2'];\r\n\r\nexport default MOL2Parser;\r\n","import ParserList from './parsers/ParserList';\r\n\r\nimport PDBParser from './parsers/PDBParser';\r\nimport CMLParser from './parsers/CMLParser';\r\nimport MMTFParser from './parsers/MMTFParser';\r\nimport CIFParser from './parsers/CIFParser';\r\nimport CCP4Parser from './parsers/CCP4Parser';\r\nimport XYZParser from './parsers/XYZParser';\r\nimport PubChemParser from './parsers/PubChemParser';\r\nimport SDFParser from './parsers/SDFParser';\r\nimport DSN6Parser from './parsers/DSN6Parser';\r\nimport GROParser from './parsers/GROParser';\r\nimport MOL2Parser from './parsers/MOL2Parser';\r\n\r\nexport default new ParserList([\r\n // note: order might be important\r\n PDBParser,\r\n CIFParser,\r\n MMTFParser,\r\n XYZParser,\r\n CMLParser,\r\n PubChemParser,\r\n SDFParser,\r\n CCP4Parser,\r\n DSN6Parser,\r\n GROParser,\r\n MOL2Parser,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available exporters.\r\n * @extends EntityList\r\n */\r\nclass ExporterList extends EntityList {\r\n /**\r\n * Create a list of exporters.\r\n * The exporters are indexed by supported data formats (`.formats` and\r\n * `.extensions` properties of a Exporter subclass).\r\n * The Exporters can be retrieved later by matching against specs (see {@link ExporterList#find}).\r\n *\r\n * @param {!Array=} someExporters A list of {@link Exporter} subclasses to\r\n * automatically register at creation time.\r\n * @see ExporterList#register\r\n */\r\n constructor(someExporters = []) {\r\n super(someExporters, ['formats']);\r\n }\r\n\r\n /**\r\n * Find a suitable exporter for data.\r\n *\r\n * @param {Object} specs Exporter specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {*=} specs.data Data to export.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ExporterList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Exporter {\r\n constructor(source, options) {\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n exportSync() {\r\n throw new Error('Exporting to this source is not implemented');\r\n }\r\n\r\n export() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Export aborted'));\r\n }\r\n return resolve(this.exportSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Exporter.prototype);\r\n","import _ from 'lodash';\r\nimport { Matrix4 } from 'three';\r\n\r\nexport default class PDBResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._currentStr = -1;\r\n this._tag = null;\r\n this._fixedNumeration = false;\r\n this._numeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n\r\n getResult() {\r\n this.writeString('\\n', 81, 81);\r\n return this._resultArray.join('');\r\n }\r\n\r\n _currentStrLength() {\r\n const curStr = this._resultArray[this._currentStr];\r\n return curStr ? curStr.length : 0;\r\n }\r\n\r\n // numeration can be number or boolean\r\n // if numeration is number then just put this number to 8-10 pos in string\r\n // if numeration is boolean then increase number for all new strings\r\n newTag(tag, numeration) {\r\n if (!tag) {\r\n this._tag = null;\r\n } else {\r\n this._tag = tag;\r\n }\r\n if (!_.isUndefined(numeration)) {\r\n if (_.isNumber(numeration)) {\r\n this._tagStrNum = numeration;\r\n this._numeration = true;\r\n this._fixedNumeration = true;\r\n } else if (_.isBoolean(numeration)) {\r\n this._tagStrNum = 0;\r\n this._numeration = numeration;\r\n this._fixedNumeration = false;\r\n }\r\n } else {\r\n this._numeration = false;\r\n this._fixedNumeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n }\r\n\r\n newString(tag) {\r\n this.writeString('\\n', 81, 81);\r\n this._currentStr++;\r\n this._resultArray.push('');\r\n\r\n if (tag) {\r\n this.writeString(tag, 1, 6);\r\n } else if (this._tag) {\r\n this.writeString(this._tag, 1, 6);\r\n }\r\n\r\n if (this._numeration) {\r\n if (!this._fixedNumeration) {\r\n this._tagStrNum++;\r\n }\r\n if (this._tagStrNum !== 1) {\r\n this.writeString(this._tagStrNum.toString(), 10, 8);\r\n }\r\n }\r\n }\r\n\r\n writeEntireString(string, maxStrPos, concat) {\r\n if (!maxStrPos) {\r\n maxStrPos = 81;\r\n }\r\n for (let j = 0; j < string.length; j++) {\r\n if (this._currentStrLength() === maxStrPos && j !== string.length - 1) {\r\n this.newString();\r\n if (concat) { // pretty hardcoddy\r\n this.writeString(concat.tag, concat.begin, concat.end);\r\n }\r\n }\r\n if (string[j] === '\\n') {\r\n this.newString();\r\n } else {\r\n this.writeString(string[j]);\r\n }\r\n }\r\n }\r\n\r\n writeString(string, begin, end) {\r\n let curStr = this._resultArray[this._currentStr];\r\n let str;\r\n\r\n const curStrLength = curStr ? curStr.length : 0;\r\n\r\n if (_.isUndefined(string)) {\r\n return;\r\n }\r\n\r\n if (!_.isNumber(begin)) {\r\n begin = curStrLength + 1;\r\n }\r\n\r\n if (!_.isNumber(end)) {\r\n end = curStrLength + string.length;\r\n }\r\n\r\n if (!_.isString(string)) {\r\n str = string.toString();\r\n } else {\r\n str = string;\r\n }\r\n\r\n const finish = begin < end ? end : begin;\r\n const start = begin < end ? begin : end;\r\n\r\n if (str.length > Math.abs(begin - end) + 1) {\r\n str = str.substr(0, Math.abs(begin - end + 1));\r\n }\r\n\r\n // spaces before start of new data\r\n if (start > curStrLength + 1) {\r\n this._resultArray[this._currentStr] += ' '.repeat(start - curStrLength - 1);\r\n } else if (start <= curStrLength) {\r\n const cStr = this._resultArray[this._currentStr];\r\n this._resultArray[this._currentStr] = cStr.slice(0, start - 1);\r\n }\r\n\r\n // if reverse order\r\n // reverse order of end and begin means that user wants to align text right\r\n if (end < begin) {\r\n const len = begin - end + 1;\r\n str = ' '.repeat(len - str.length) + str;\r\n }\r\n\r\n // some hardcode fix for space between string numeration and data\r\n // (see pdb file format description)\r\n if (start === 11 && this._numeration && this._tagStrNum !== 1) {\r\n str = ` ${str}`;\r\n }\r\n\r\n // append new data to string\r\n this._resultArray[this._currentStr] += str;\r\n curStr = this._resultArray[this._currentStr];\r\n\r\n if (finish > curStr.length) {\r\n this._resultArray[this._currentStr] += ' '.repeat(finish - curStr.length);\r\n }\r\n }\r\n\r\n writeBondsArray(bonds, atom) {\r\n const bondsArrays = this._getSubArrays(bonds, 4);\r\n\r\n for (let k = 0; k < bondsArrays.length; k++) {\r\n this.newString();\r\n this.writeString(atom.serial, 11, 7);\r\n\r\n for (let j = 0; j < bondsArrays[k].length; j++) {\r\n const serial = (bondsArrays[k][j]._left.serial === atom.serial)\r\n ? bondsArrays[k][j]._right.serial : bondsArrays[k][j]._left.serial;\r\n\r\n this.writeString(serial, 16 + 5 * j, 12 + 5 * j);\r\n }\r\n }\r\n }\r\n\r\n _getSubArrays(arr, subArraySize) {\r\n const subArrays = [];\r\n for (let i = 0; i < arr.length; i += subArraySize) {\r\n subArrays.push(arr.slice(i, i + subArraySize));\r\n }\r\n return subArrays;\r\n }\r\n\r\n // function for writing matrix in Remark290 and Remark350 tags\r\n // (see pdb file description)\r\n writeMatrix(matrix, matrixIndx, tag) {\r\n for (let j = 0; j < 3; j++) {\r\n this.newString();\r\n this.writeString(tag, 14, 18);\r\n this.writeString((j + 1).toString(), 19, 19);\r\n this.writeString(matrixIndx.toString(), 23, 20);\r\n for (let k = 0; k < 3; k++) {\r\n const numb = parseFloat(matrix.elements[j * 4 + k]).toFixed(6);\r\n this.writeString(numb.toString(), 33 + k * 10, 24 + k * 10);\r\n }\r\n\r\n const numb = parseFloat(matrix.elements[j * 4 + 3]).toFixed(5);\r\n this.writeString(numb.toString(), 68, 55);\r\n }\r\n }\r\n\r\n writeMatrices(matrices, string) {\r\n if (!matrices) {\r\n return;\r\n }\r\n const matrix = new Matrix4();\r\n for (let j = 0; j < matrices.length; j++) {\r\n matrix.copy(matrices[j]).transpose();\r\n this.writeMatrix(matrix, j + 1, string);\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport Complex from '../../chem/Complex';\r\nimport Exporter from './Exporter';\r\nimport PDBResult from './PDBResult';\r\nimport Assembly from '../../chem/Assembly';\r\nimport { typeByPDBHelixClass } from '../../chem/Helix';\r\n\r\nexport default class PDBExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n this._tags = ['HEADER', 'TITLE', 'COMPND', 'REMARK', 'HELIX', 'SHEET', 'ATOM and HETATM', 'CONECT'];\r\n this._result = null;\r\n this._tagExtractors = {\r\n HEADER: this._extractHEADER,\r\n TITLE: this._extractTITLE,\r\n 'ATOM and HETATM': this._extractATOM,\r\n CONECT: this._extractCONECT,\r\n COMPND: this._extractCOMPND,\r\n REMARK: this._extractREMARK,\r\n HELIX: this._extractHELIX,\r\n SHEET: this._extractSHEET,\r\n };\r\n this._stringForRemark350 = 'COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN\\n'\r\n + 'BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE\\n'\r\n + 'MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS\\n'\r\n + 'GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND\\n'\r\n + 'CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.';\r\n\r\n this._stringForRemark290 = 'CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS\\n'\r\n + 'THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM\\n'\r\n + 'RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY\\n'\r\n + 'RELATED MOLECULES.';\r\n }\r\n\r\n exportSync() {\r\n const result = new PDBResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n for (let i = 0; i < this._tags.length; i++) {\r\n const tag = this._tags[i];\r\n const func = this._tagExtractors[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, result);\r\n }\r\n }\r\n\r\n this._result = result.getResult();\r\n\r\n return this._result;\r\n }\r\n\r\n _extractHEADER(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n result.newTag('HEADER');\r\n result.newString();\r\n if (metadata.classification) {\r\n result.writeString(metadata.classification, 11, 50);\r\n }\r\n if (metadata.date) {\r\n result.writeString(metadata.date, 51, 59);\r\n }\r\n if (metadata.id) {\r\n result.writeString(metadata.id, 63, 66);\r\n }\r\n }\r\n\r\n _extractTITLE(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n if (!metadata.title) {\r\n return;\r\n }\r\n result.newTag('TITLE', true);\r\n for (let i = 0; i < metadata.title.length; i++) {\r\n result.newString();\r\n result.writeString(metadata.title[i], 11, 80);\r\n }\r\n }\r\n\r\n _extractCONECT(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n\r\n const atoms = this._source._atoms;\r\n result.newTag('CONECT');\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const fixedBonds = atoms[i].bonds.filter((bond) => bond._fixed);\r\n if (fixedBonds.length !== 0) {\r\n result.writeBondsArray(fixedBonds.reverse(), atoms[i]);\r\n }\r\n }\r\n }\r\n\r\n _extractSHEET(result) {\r\n if (!this._source._sheets) {\r\n return;\r\n }\r\n\r\n result.newTag('SHEET');\r\n\r\n const sheets = this._source._sheets;\r\n for (let i = 0; i < sheets.length; i++) {\r\n if (sheets[i]._strands) {\r\n const strands = sheets[i]._strands;\r\n for (let j = 0; j < strands.length; j++) {\r\n result.newString();\r\n result.writeString(j + 1, 10, 8);\r\n result.writeString(sheets[i]._name, 14, 12);\r\n result.writeString(strands.length, 16, 15);\r\n result.writeString(strands[j].init._type._name, 18, 20);\r\n result.writeString(strands[j].init._chain._name, 22, 22);\r\n result.writeString(strands[j].init._sequence, 26, 23);\r\n result.writeString(strands[j].init._icode, 27, 27);\r\n result.writeString(strands[j].term._type._name, 29, 31);\r\n result.writeString(strands[j].init._chain._name, 33, 33);\r\n result.writeString(strands[j].term._sequence, 37, 34);\r\n result.writeString(strands[j].term._icode, 38, 38);\r\n result.writeString(strands[j].sense, 40, 39);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _extractHELIX(result) {\r\n if (!this._source._helices) {\r\n return;\r\n }\r\n\r\n result.newTag('HELIX');\r\n const helices = this._source._helices;\r\n for (let i = 0; i < helices.length; i++) {\r\n const helix = helices[i];\r\n const helixClass = _.invert(typeByPDBHelixClass);\r\n result.newString();\r\n result.writeString(helix.serial, 10, 8);\r\n result.writeString(helix.name, 14, 12);\r\n result.writeString(helix.init._type._name, 16, 18);\r\n result.writeString(helix.init._chain._name, 20, 20);\r\n result.writeString(helix.init._sequence, 25, 22);\r\n result.writeString(helix.init._icode, 26, 26);\r\n result.writeString(helix.term._type._name, 28, 30);\r\n result.writeString(helix.term._chain._name, 32, 32);\r\n result.writeString(helix.term._sequence, 37, 34);\r\n result.writeString(helix.term._icode, 38, 38);\r\n result.writeString(helixClass[helix.type], 40, 39);\r\n result.writeString(helix.comment, 41, 70);\r\n result.writeString(helix.length, 76, 72);\r\n }\r\n }\r\n\r\n _extractATOM(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n const atoms = this._source._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const tag = atoms[i].het ? 'HETATM' : 'ATOM';\r\n result.newString(tag);\r\n const startIndx = (atoms[i].element.name.length > 1 || atoms[i].name.length > 3) ? 13 : 14;\r\n result.writeString(atoms[i].serial, 11, 7);\r\n result.writeString(atoms[i].name, startIndx, 16);\r\n result.writeString(String.fromCharCode(atoms[i].location), 17, 17);\r\n result.writeString(atoms[i].residue._type._name, 20, 18);\r\n result.writeString(atoms[i].residue._chain._name, 22, 22);\r\n result.writeString(atoms[i].residue._sequence, 26, 23);\r\n result.writeString(atoms[i].residue._icode, 27, 27);\r\n result.writeString(atoms[i].position.x.toFixed(3), 38, 31);\r\n result.writeString(atoms[i].position.y.toFixed(3), 46, 39);\r\n result.writeString(atoms[i].position.z.toFixed(3), 54, 47);\r\n result.writeString(atoms[i].occupancy.toFixed(2), 60, 55);\r\n result.writeString(atoms[i].temperature.toFixed(2), 66, 61);\r\n result.writeString(atoms[i].element.name, 78, 77);\r\n if (atoms[i].charge) {\r\n result.writeString(atoms[i].charge, 79, 80);\r\n }\r\n }\r\n }\r\n\r\n _extractCOMPND(result) {\r\n if (!this._source._molecules) {\r\n return;\r\n }\r\n const molecules = this._source._molecules;\r\n result.newTag('COMPND', true);\r\n\r\n for (let i = 0; i < molecules.length; i++) {\r\n const chains = this._getMoleculeChains(molecules[i]);\r\n result.newString();\r\n result.writeString(`MOL_ID: ${molecules[i].index};`, 11, 80);\r\n result.newString();\r\n result.writeString(`MOLECULE: ${molecules[i].name};`, 11, 80);\r\n result.newString();\r\n result.writeString('CHAIN: ', 11, 18);\r\n const chainsString = `${chains.join(', ')};`;\r\n result.writeEntireString(chainsString, 81);\r\n }\r\n }\r\n\r\n _extractREMARK(result) {\r\n this._Remark290(result);\r\n this._Remark350(result);\r\n }\r\n\r\n _Remark290(result) {\r\n if (!this._source.symmetry) {\r\n return;\r\n }\r\n\r\n if (this._source.symmetry.length !== 0) {\r\n const matrices = this._source.symmetry;\r\n result.newTag('REMARK', 290);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark290);\r\n result.writeMatrices(matrices, 'SMTRY');\r\n result.newString();\r\n result.newString();\r\n result.writeString('REMARK: NULL', 11, 80);\r\n }\r\n }\r\n\r\n _Remark350(result) {\r\n if (!this._source.units) {\r\n return;\r\n }\r\n const { units } = this._source;\r\n let biomolIndx = 0;\r\n\r\n result.newTag('REMARK', 350);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark350);\r\n\r\n const assemblies = units.filter((unit) => unit instanceof Assembly);\r\n\r\n for (let i = 0; i < assemblies.length; i++) {\r\n result.newString();\r\n result.newString();\r\n biomolIndx++;\r\n result.writeString(`BIOMOLECULE: ${biomolIndx}`, 11, 80);\r\n const chains = assemblies[i].chains.join(', ');\r\n result.newString();\r\n result.writeString('APPLY THE FOLLOWING TO CHAINS: ');\r\n result.writeEntireString(chains, 69, { tag: 'AND CHAINS: ', begin: 31, end: 42 });\r\n\r\n const { matrices } = assemblies[i];\r\n result.writeMatrices(matrices, 'BIOMT');\r\n }\r\n }\r\n\r\n _getMoleculeChains(molecule) {\r\n function getChainName(residue) {\r\n return residue._chain._name;\r\n }\r\n const chainNames = molecule.residues.map(getChainName);\r\n return chainNames.filter((item, pos) => chainNames.indexOf(item) === pos);\r\n }\r\n}\r\n\r\nPDBExporter.formats = ['pdb'];\r\nPDBExporter.SourceClass = Complex;\r\n","import * as THREE from 'three';\r\n\r\nconst FBX_POS_SIZE = 3;\r\nconst FBX_NORM_SIZE = 3;\r\nconst FBX_COL_SIZE = 4;\r\n\r\nfunction copyFbxPoint3(src, srcIdx, dst, dstIdx) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n}\r\n\r\nfunction copyFbxPoint4(src, srcIdx, dst, dstIdx, value) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n dst[dstIdx + 3] = value;\r\n}\r\n\r\nconst vector4 = new THREE.Vector4();\r\nfunction copyTransformedPoint3(src, srcIdx, dst, dstIdx, opts) {\r\n vector4.set(src[srcIdx], src[srcIdx + 1], src[srcIdx + 2], opts.w);\r\n vector4.applyMatrix4(opts.matrix);\r\n dst[dstIdx] = vector4.x;\r\n dst[dstIdx + 1] = vector4.y;\r\n dst[dstIdx + 2] = vector4.z;\r\n}\r\n\r\nfunction setSubArray(src, dst, count, copyFunctor, functorOpts) {\r\n if ((dst.array.length - dst.start) / dst.stride < count\r\n || (src.array.length - src.start) / src.stride < count) {\r\n return; // we've got no space\r\n }\r\n if (src.stride === dst.stride) { // stride is the same\r\n dst.array.set(src.array, dst.start);\r\n } else {\r\n let idx = dst.start;\r\n let arridx = src.start;\r\n for (let i = 0; i < count; ++i, idx += dst.stride, arridx += src.stride) {\r\n copyFunctor(src.array, arridx, dst.array, idx, functorOpts);\r\n }\r\n }\r\n}\r\n\r\nexport default class FBXModel {\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.lastPos = 0;\r\n this.lastNorm = 0;\r\n this.lastCol = 0;\r\n this.lastIdx = 0;\r\n }\r\n\r\n init(vertsCount, indsCount) {\r\n this.positions = new Float32Array(vertsCount * FBX_POS_SIZE);\r\n this.normals = new Float32Array(vertsCount * FBX_NORM_SIZE);\r\n this.colors = new Float32Array(vertsCount * FBX_COL_SIZE);\r\n this.indices = new Int32Array(indsCount);\r\n }\r\n\r\n setPositions(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.positions,\r\n start: this.lastPos,\r\n stride: FBX_POS_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setTransformedPositions(array, start, count, stride, matrix) {\r\n let idx = this.lastPos;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 1 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_POS_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.positions, idx, opts);\r\n }\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setNormals(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.normals,\r\n start: this.lastNorm,\r\n stride: FBX_NORM_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setTransformedNormals(array, start, count, stride, matrix) {\r\n let idx = this.lastNorm;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 0 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_NORM_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.normals, idx, opts);\r\n }\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setColors(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.colors,\r\n start: this.lastCol,\r\n stride: FBX_COL_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint4, 1);\r\n this.lastCol += count * FBX_COL_SIZE;\r\n }\r\n\r\n setIndices(array, start, count) {\r\n this.indices.set(array, this.lastIdx);\r\n this.lastIdx += count;\r\n }\r\n\r\n setShiftedIndices(array, count, shift) {\r\n const shifted = array.map((x) => x + shift);\r\n this.setIndices(shifted, 0, count);\r\n }\r\n\r\n getVerticesNumber() {\r\n return this.lastPos / FBX_POS_SIZE;\r\n }\r\n\r\n addInstance(matrix, geo) {\r\n // add indices at first to take old number of vertices for shift\r\n const currentCount = this.getVerticesNumber();\r\n this.setShiftedIndices(geo.indices, geo.indices.length, currentCount);\r\n // simply write vertices at empty space\r\n const size = geo.itemSize;\r\n this.setTransformedPositions(geo.positions, 0, geo.vertsCount, size.position, matrix);\r\n this.setTransformedNormals(geo.normals, 0, geo.vertsCount, size.normal, matrix);\r\n this.setColors(geo.colors, 0, geo.vertsCount, size.color);\r\n }\r\n}\r\n","/** Base class for fbx geometry contains simply organized attributes: positions+normals+colors, indices. */\r\nexport default class FBXGeometry {\r\n /**\r\n * Create a base geo with necessary members.\r\n */\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.vertsCount = 0;\r\n this.itemSize = null;\r\n }\r\n\r\n /**\r\n * Initialize base geo storing items info from attributes.\r\n * @param {Object} geo - THREE.BufferGeometry.\r\n */\r\n init(geo, _info) {\r\n const { attributes } = geo;\r\n // save item size\r\n this.itemSize = {\r\n position: attributes.position.itemSize,\r\n normal: attributes.normal.itemSize,\r\n color: attributes.color.itemSize,\r\n };\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes and creates colors filled with defined value.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX1CGeometry extends FBXGeometry {\r\n /**\r\n * Initialize geo storing positions, normals, indices and create colors.\r\n * @param {Object} geo - THREE.BufferGeometry.\r\n */\r\n init(geo, _info) {\r\n super.init(geo, _info);\r\n const {\r\n attributes: {\r\n position,\r\n normal,\r\n },\r\n index,\r\n } = geo;\r\n // copy vertices attributes\r\n this.vertsCount = position.count;\r\n this.positions = position.array;\r\n this.normals = normal.array;\r\n // create color array\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n // indices\r\n this.indices = index.array;\r\n }\r\n\r\n /**\r\n * Set defined color for all items in color attribute\r\n * @param {Object} color - THREE.Color.\r\n */\r\n setColors(color) {\r\n let offset = 0;\r\n for (let i = 0, l = this.colors.length, cl = this.itemSize.color; i < l; i += cl) {\r\n this.colors[offset++] = color.r;\r\n this.colors[offset++] = color.g;\r\n this.colors[offset++] = color.b;\r\n }\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes from cylinder geometry and creates colors filled with two\r\n * defined values.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX2CCylinder extends FBXGeometry {\r\n constructor() {\r\n super();\r\n this._cutRawStart = 0;\r\n this._cutRawEnd = 0;\r\n this._facesPerSlice = 0;\r\n }\r\n\r\n /**\r\n * Initialize geo by creating new attributes, because we extend number of vertices to make cylinder two-colored.\r\n * Indices remain the same. We process open- end close-ended cylinders and consider cylinders od 2 segments\r\n * in height ONLY.\r\n * NOTE: cylinder consists of 2 height segments and stores parts in the order: tube, topCap, bottomCap\r\n * @param {Object} geo - THREE.BufferGeometry.\r\n * @param {Object} info - information needed for geo extend\r\n */\r\n init(geo, info) {\r\n super.init(geo, info);\r\n const {\r\n attributes: {\r\n position,\r\n },\r\n index,\r\n } = geo;\r\n // extend vertices arrays\r\n this.vertsCount = position.count + info.addPerCylinder;\r\n this._facesPerSlice = info.addPerCylinder;\r\n this.positions = new Float32Array(this.vertsCount * position.itemSize);\r\n this.normals = new Float32Array(this.vertsCount * this.itemSize.normal);\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n this._extendVertices(geo, info);\r\n // number of indices stays the same\r\n this.indices = new Uint32Array(index.count);\r\n this._extendIndices(geo, info);\r\n }\r\n\r\n /** Extend vertex attributes to have one more slice to make sharp middle startColor-endColor line. */\r\n _extendVertices(geo, info) {\r\n const { position } = geo.attributes;\r\n const { normal } = geo.attributes;\r\n const geoParams = geo.getGeoParams();\r\n const cutRaw = 1; // we expect cylinders of 2 segments in height => so half segment = 1\r\n this._cutRawStart = cutRaw * geoParams.radialSegments;\r\n this._cutRawEnd = this._cutRawStart + info.addPerCylinder;\r\n { // write first half of cylinder\r\n let temp = position.array.slice(0, this._cutRawEnd * position.itemSize);\r\n this.positions.set(temp, 0);\r\n temp = normal.array.slice(0, this._cutRawEnd * normal.itemSize);\r\n this.normals.set(temp, 0);\r\n }\r\n { // write second part of cylinder\r\n let temp = position.array.slice(this._cutRawStart * position.itemSize, position.array.length);\r\n this.positions.set(temp, this._cutRawEnd * position.itemSize);\r\n temp = normal.array.slice(this._cutRawStart * normal.itemSize, normal.array.length);\r\n this.normals.set(temp, this._cutRawEnd * normal.itemSize);\r\n }\r\n }\r\n\r\n /** Shift values of second part (+caps) indices by newly added vertices count. Number of faces remains the same. */\r\n _extendIndices(geo, info) {\r\n const { index } = geo;\r\n const indicesPerQuad = 6; // quad = 2 triangles => 6 indices\r\n const startToShift = info.addPerCylinder * indicesPerQuad;\r\n const shift = info.addPerCylinder;\r\n let shifted = index.array.slice(startToShift, index.count);\r\n shifted = shifted.map((x) => x + shift); // shift only the endings\r\n this.indices.set(index.array, 0);\r\n this.indices.set(shifted, startToShift);\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {number} start - start color index\r\n * @param {number} end - start color index\r\n * @param {array} array - array of colors\r\n * @param {array} color - color value components\r\n */\r\n _setColorRange(start, end, array, color) {\r\n const colorSize = color.length;\r\n for (let i = start; i < end; i += colorSize) {\r\n array.set(color, i);\r\n }\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {Object} color1 - THREE.Color.\r\n * @param {Object} color2 - THREE.Color.\r\n */\r\n setColors(color1, color2) {\r\n const colorSize = this.itemSize.color;\r\n const part1End = this._cutRawEnd * colorSize;\r\n const part2End = part1End * 2;\r\n this._setColorRange(0, part1End, this.colors, color1.toArray());\r\n this._setColorRange(part1End, part2End, this.colors, color2.toArray());\r\n if (part2End < this.colors.length) { // cylinder has caps, lets paint them\r\n const capSize = (this._facesPerSlice + 1) * colorSize;\r\n const cap1End = part2End + capSize;\r\n this._setColorRange(part2End, cap1End, this.colors, color2.toArray());\r\n const cap2End = cap1End + capSize; // should be equal to this.colors.length;\r\n this._setColorRange(cap1End, cap2End, this.colors, color1.toArray());\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\n\r\nimport utils from '../../../utils';\r\nimport gfxutils from '../../../gfx/gfxutils';\r\nimport logger from '../../../utils/logger';\r\n\r\nimport FBXModel from './FBXModel';\r\nimport ThickLineMesh from '../../../gfx/meshes/ThickLineMesh';\r\nimport ZSpriteMesh from '../../../gfx/meshes/ZSpriteMesh';\r\nimport InstancedSpheresGeometry from '../../../gfx/geometries/InstancedSpheresGeometry';\r\nimport Instanced2CCylindersGeometry from '../../../gfx/geometries/Instanced2CCylindersGeometry';\r\nimport FBX1CGeometry from './FBX1CGeometry';\r\nimport FBX2CCylinder from './FBX2CCylinder';\r\n\r\nexport default class FBXInfoExtractor {\r\n constructor() {\r\n this._materials = [];\r\n this._models = [];\r\n }\r\n\r\n process(data) {\r\n this._extractModelsAndMaterials(data);\r\n const models = this._flattenModels();\r\n\r\n return {\r\n name: data.name,\r\n models,\r\n materials: this._materials,\r\n };\r\n }\r\n\r\n /**\r\n * Extract fbx object information from ComplexVisual\r\n * @param {object} data - complexVisual to get geometry info from\r\n */\r\n _extractModelsAndMaterials(data) {\r\n const layersOfInterest = new THREE.Layers();\r\n layersOfInterest.set(gfxutils.LAYERS.DEFAULT);\r\n layersOfInterest.enable(gfxutils.LAYERS.TRANSPARENT);\r\n data.traverse((object) => {\r\n if (object instanceof THREE.Mesh && object.layers.test(layersOfInterest) && this.checkExportAbility(object)) {\r\n if (object.geometry.type === 'InstancedBufferGeometry') {\r\n this._collectInstancedGeoInfo(object);\r\n } else {\r\n this._collectGeoInfo(object);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Reworking indices buffer, see https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/\r\n * basically, every triangle in Miew has been represented hat way (e.g.) : 0,1,7, but we must (for FBX) rework that\r\n * into: 0,1,-8.\r\n * @param {array} indices - belongs to [0, maxVertIndex]\r\n */\r\n _reworkIndices(indices) {\r\n const faceSize = 3;\r\n for (let i = faceSize - 1; i < indices.length; i += faceSize) {\r\n indices[i] *= -1;\r\n indices[i]--;\r\n }\r\n }\r\n\r\n /**\r\n * Combine geometry from several models having the same material into one Model and finally prepare indices\r\n * @returns {array} models, combined by material id\r\n */\r\n _flattenModels() {\r\n let overallVertsCount = 0;\r\n function shift(x) {\r\n return x + overallVertsCount;\r\n }\r\n const combined = [];\r\n // flatten models geometry\r\n for (let i = 0, n = this._models.length; i < n; i++) {\r\n const models = this._models[i];\r\n let indices = [];\r\n let positions = [];\r\n let normals = [];\r\n let colors = [];\r\n // reorganize every attributes as array of arrays\r\n overallVertsCount = 0;\r\n for (let j = 0; j < models.length; j++) {\r\n const m = models[j];\r\n indices.push(m.indices.map(shift));\r\n overallVertsCount += m.getVerticesNumber();\r\n positions.push(m.positions);\r\n normals.push(m.normals);\r\n colors.push(m.colors);\r\n }\r\n // join all subarrays into one\r\n indices = utils.mergeTypedArraysUnsafe(indices);\r\n this._reworkIndices(indices);\r\n positions = utils.mergeTypedArraysUnsafe(positions);\r\n normals = utils.mergeTypedArraysUnsafe(normals);\r\n colors = utils.mergeTypedArraysUnsafe(colors);\r\n combined.push({\r\n indices,\r\n positions,\r\n normals,\r\n colors,\r\n verticesCount: overallVertsCount,\r\n });\r\n }\r\n return combined;\r\n }\r\n\r\n /**\r\n * Check ability to export the kind of mesh.\r\n * @param {object} mesh - given mesh to check\r\n * @returns {boolean} result of check\r\n */\r\n checkExportAbility(mesh) {\r\n // check mesh on not being empty\r\n if (mesh.geometry.attributes.position.count === 0) {\r\n return false;\r\n }\r\n // check type of mesh\r\n // if (mesh.geometry.isInstancedBufferGeometry && settings.now.zSprites) {\r\n if (mesh instanceof ZSpriteMesh) {\r\n logger.warn('Currently we cannot export \\'sprites\\' modes, like BS, WV, LC. Please turn of settings \\'zSprites\\' and try again');\r\n return false;\r\n }\r\n if (mesh instanceof ThickLineMesh) {\r\n logger.warn('Currently we cannot export Lines mode');\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Save geometry info from common mesh, like Surface or Cartoon\r\n */\r\n _collectGeoInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n normal,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const vertCount = position.count;\r\n model.init(vertCount, index.count);\r\n if (matrix.isIdentity()) {\r\n model.setPositions(position.array, 0, vertCount, position.itemSize);\r\n model.setNormals(normal.array, 0, vertCount, normal.itemSize);\r\n } else {\r\n model.setTransformedPositions(position.array, 0, vertCount, position.itemSize, matrix);\r\n model.setTransformedNormals(normal.array, 0, vertCount, normal.itemSize, matrix);\r\n }\r\n model.setColors(color.array, 0, vertCount, color.itemSize);\r\n model.setIndices(index.array, 0, index.count);\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Collect instanced spheres geometry and materials.\r\n * @param {object} mesh - mesh with instanced spheres info\r\n */\r\n _collectSpheresInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.instanceCount;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount, instCount * indsCount);\r\n const geo = new FBX1CGeometry();\r\n geo.init(mesh.geometry);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const sphereColor = new THREE.Color();\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n sphereColor.fromArray(color.array, colorIdx);\r\n geo.setColors(sphereColor);\r\n // add instance to the model\r\n this._getSphereInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Getting all instanced cylinders from given mesh.\r\n * Divide cylinder (add additional vertexes) for prettiness therefore algorithm is a bit complicated\r\n * @param {object} mesh - given mesh with instanced cylinders\r\n */\r\n _collectCylindersInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n color2,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.instanceCount;\r\n const oneCCylinder = new FBX1CGeometry();\r\n oneCCylinder.init(mesh.geometry);\r\n const splittingInfo = this._gatherCylindersColoringInfo(mesh.geometry);\r\n let twoCCylinder = null;\r\n if (splittingInfo.needToSplit > 0) {\r\n twoCCylinder = new FBX2CCylinder();\r\n twoCCylinder.init(mesh.geometry, splittingInfo);\r\n }\r\n const additionalVertsCount = splittingInfo.addPerCylinder * splittingInfo.needToSplit;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount + additionalVertsCount, instCount * indsCount);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const colorStart = new THREE.Color();\r\n const colorEnd = new THREE.Color();\r\n let geo = {};\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n if (splittingInfo.is2Colored[instanceIndex]) {\r\n // .color2 contains starting color, and .color contains starting color (see uber.frag ATTR_COLOR2)\r\n colorStart.fromArray(color2.array, colorIdx);\r\n colorEnd.fromArray(color.array, colorIdx);\r\n if (twoCCylinder) {\r\n twoCCylinder.setColors(colorStart, colorEnd);\r\n geo = twoCCylinder;\r\n }\r\n } else {\r\n // has one color per cylinder\r\n colorStart.fromArray(color.array, colorIdx);\r\n oneCCylinder.setColors(colorStart);\r\n geo = oneCCylinder;\r\n }\r\n // add instance to the model\r\n this._getCylinderInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Adding model to pool of models or extend existing ones\r\n * @param {object} model - model to add\r\n * @param {object} material - material to add\r\n */\r\n _addToPool(model, material) {\r\n const materialIdx = this._checkExistingMaterial(material);\r\n if (materialIdx < 0) { // new model-material pair\r\n this._models.push([model]);\r\n this._materials.push(material);\r\n } else { // add model to existing model-material pair\r\n const models = this._models[materialIdx];\r\n models.push(model);\r\n }\r\n }\r\n\r\n /**\r\n * Checking if given material already was registered in materials pool (no need to create new one)\r\n * @param {object} material - given material\r\n * @returns {number} number of model-material pair\r\n */\r\n _checkExistingMaterial(material) {\r\n return _.findIndex(this._materials, (m) => _.isEqual(m, material));\r\n }\r\n\r\n _gatherCylindersColoringInfo(geo) {\r\n const instCount = geo.instanceCount;\r\n const color1 = geo.attributes.color.array;\r\n const color2 = geo.attributes.color2.array;\r\n const stride = geo.attributes.color.itemSize;\r\n const is2Colored = new Array(instCount);\r\n // analyze color instance attributes\r\n let needToSplit = 0;\r\n let colIdx = 0;\r\n for (let i = 0; i < instCount; i++, colIdx += stride) {\r\n const differs = (Math.abs(color1[colIdx] - color2[colIdx]) > 0.0000001) // compare ending colors\r\n || (Math.abs(color1[colIdx + 1] - color2[colIdx + 1]) > 0.0000001)\r\n || (Math.abs(color1[colIdx + 2] - color2[colIdx + 2]) > 0.0000001);\r\n is2Colored[i] = differs;\r\n needToSplit += differs; // count number of 2-colored cylinders\r\n }\r\n // calc number of vertices to add into 2-colored\r\n const geoParams = geo.getGeoParams();\r\n const addPerCylinder = geoParams.radialSegments;\r\n return { is2Colored, needToSplit, addPerCylinder };\r\n }\r\n\r\n /**\r\n * Collect instanced models and materials.\r\n * @param {object} mesh - given mesh with instanced something (spheres or cylinders)\r\n */\r\n _collectInstancedGeoInfo(mesh) {\r\n if (mesh.geometry instanceof InstancedSpheresGeometry) {\r\n this._collectSpheresInfo(mesh);\r\n } else if (mesh.geometry instanceof Instanced2CCylindersGeometry) {\r\n this._collectCylindersInfo(mesh);\r\n }\r\n }\r\n\r\n /**\r\n * Collect Material info from given mesh.\r\n * @param {object} mesh - given mesh with material info\r\n * @returns {object} material\r\n */\r\n _collectMaterialInfo(mesh) {\r\n const { uberOptions } = mesh.material;\r\n return ({\r\n diffuse: uberOptions.diffuse.toArray(),\r\n opacity: uberOptions.opacity,\r\n shininess: uberOptions.shininess,\r\n specular: uberOptions.specular.toArray(),\r\n });\r\n }\r\n\r\n _getCylinderInstanceMatrix(geo, instIdx, matrix) {\r\n const matVector1 = geo.attributes.matVector1.array;\r\n const matVector2 = geo.attributes.matVector2.array;\r\n const matVector3 = geo.attributes.matVector3.array;\r\n const idxOffset = instIdx * 4; // used 4 because offset arrays are stored in quads\r\n matrix.set(\r\n matVector1[idxOffset],\r\n matVector1[idxOffset + 1],\r\n matVector1[idxOffset + 2],\r\n matVector1[idxOffset + 3],\r\n matVector2[idxOffset],\r\n matVector2[idxOffset + 1],\r\n matVector2[idxOffset + 2],\r\n matVector2[idxOffset + 3],\r\n matVector3[idxOffset],\r\n matVector3[idxOffset + 1],\r\n matVector3[idxOffset + 2],\r\n matVector3[idxOffset + 3],\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n );\r\n }\r\n\r\n _getSphereInstanceMatrix(geo, instIdx, matrix) {\r\n const { offset } = geo.attributes;\r\n const idx = instIdx * offset.itemSize;\r\n const x = offset.array[idx];\r\n const y = offset.array[idx + 1];\r\n const z = offset.array[idx + 2];\r\n const scale = offset.array[idx + 3];\r\n matrix.set(\r\n scale,\r\n 0,\r\n 0,\r\n x,\r\n 0,\r\n scale,\r\n 0,\r\n y,\r\n 0,\r\n 0,\r\n scale,\r\n z,\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n );\r\n }\r\n}\r\n","// Forming default definitions block\r\nconst defaultDefinitions = `\r\nDefinitions: {\r\n Version: 100\r\n Count: 3\r\n ObjectType: \"Model\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Geometry\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Material\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Pose\" {\r\n Count: 1\r\n }\r\n ObjectType: \"GlobalSettings\" {\r\n Count: 1\r\n }\r\n} `;\r\n\r\n// Default model properties\r\nconst defaultProperties = `Properties60: {\r\n Property: \"QuaternionInterpolate\", \"bool\", \"\",0\r\n Property: \"Visibility\", \"Visibility\", \"A\",1\r\n Property: \"Lcl Translation\", \"Lcl Translation\", \"A\",0.000000000000000,0.000000000000000,-1789.238037109375000\r\n Property: \"Lcl Rotation\", \"Lcl Rotation\", \"A\",0.000009334667643,-0.000000000000000,0.000000000000000\r\n Property: \"Lcl Scaling\", \"Lcl Scaling\", \"A\",1.000000000000000,1.000000000000000,1.000000000000000\r\n Property: \"RotationOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationActive\", \"bool\", \"\",0\r\n Property: \"TranslationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMinX\", \"bool\", \"\",0\r\n Property: \"TranslationMinY\", \"bool\", \"\",0\r\n Property: \"TranslationMinZ\", \"bool\", \"\",0\r\n Property: \"TranslationMaxX\", \"bool\", \"\",0\r\n Property: \"TranslationMaxY\", \"bool\", \"\",0\r\n Property: \"TranslationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationOrder\", \"enum\", \"\",0\r\n Property: \"RotationSpaceForLimitOnly\", \"bool\", \"\",0\r\n Property: \"AxisLen\", \"double\", \"\",10\r\n Property: \"PreRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"PostRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationActive\", \"bool\", \"\",0\r\n Property: \"RotationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMinX\", \"bool\", \"\",0\r\n Property: \"RotationMinY\", \"bool\", \"\",0\r\n Property: \"RotationMinZ\", \"bool\", \"\",0\r\n Property: \"RotationMaxX\", \"bool\", \"\",0\r\n Property: \"RotationMaxY\", \"bool\", \"\",0\r\n Property: \"RotationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationStiffnessX\", \"double\", \"\",0\r\n Property: \"RotationStiffnessY\", \"double\", \"\",0\r\n Property: \"RotationStiffnessZ\", \"double\", \"\",0\r\n Property: \"MinDampRangeX\", \"double\", \"\",0\r\n Property: \"MinDampRangeY\", \"double\", \"\",0\r\n Property: \"MinDampRangeZ\", \"double\", \"\",0\r\n Property: \"MaxDampRangeX\", \"double\", \"\",0\r\n Property: \"MaxDampRangeY\", \"double\", \"\",0\r\n Property: \"MaxDampRangeZ\", \"double\", \"\",0\r\n Property: \"MinDampStrengthX\", \"double\", \"\",0\r\n Property: \"MinDampStrengthY\", \"double\", \"\",0\r\n Property: \"MinDampStrengthZ\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthX\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthY\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthZ\", \"double\", \"\",0\r\n Property: \"PreferedAngleX\", \"double\", \"\",0\r\n Property: \"PreferedAngleY\", \"double\", \"\",0\r\n Property: \"PreferedAngleZ\", \"double\", \"\",0\r\n Property: \"InheritType\", \"enum\", \"\",0\r\n Property: \"ScalingActive\", \"bool\", \"\",0\r\n Property: \"ScalingMin\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMax\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMinX\", \"bool\", \"\",0\r\n Property: \"ScalingMinY\", \"bool\", \"\",0\r\n Property: \"ScalingMinZ\", \"bool\", \"\",0\r\n Property: \"ScalingMaxX\", \"bool\", \"\",0\r\n Property: \"ScalingMaxY\", \"bool\", \"\",0\r\n Property: \"ScalingMaxZ\", \"bool\", \"\",0\r\n Property: \"GeometricTranslation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricScaling\", \"Vector3D\", \"\",1,1,1\r\n Property: \"LookAtProperty\", \"object\", \"\"\r\n Property: \"UpVectorProperty\", \"object\", \"\"\r\n Property: \"Show\", \"bool\", \"\",1\r\n Property: \"NegativePercentShapeSupport\", \"bool\", \"\",1\r\n Property: \"DefaultAttributeIndex\", \"int\", \"\",0\r\n Property: \"Color\", \"Color\", \"A+\",0,0,0\r\n Property: \"Size\", \"double\", \"\",100\r\n Property: \"Look\", \"enum\", \"\",1\r\n }`;\r\n\r\n// Default materials layer\r\nconst defaultMaterialLayer = `\r\n LayerElementMaterial: 0 {\r\n Version: 101\r\n Name: \"\"\r\n MappingInformationType: \"AllSame\"\r\n ReferenceInformationType: \"Direct\"\r\n Materials: 0\r\n }`;\r\n\r\n// Default layers block\r\nconst defaultLayerBlock = `\r\n Layer: 0 {\r\n Version: 100\r\n LayerElement: {\r\n Type: \"LayerElementNormal\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementColor\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementMaterial\"\r\n TypedIndex: 0\r\n }\r\n }`;\r\n\r\n/**\r\n * globalSettings info in output file.\r\n */\r\nconst globalSettings = `GlobalSettings: {\r\n Version: 1000\r\n Properties60: {\r\n Property: \"UpAxis\", \"int\", \"\",1\r\n Property: \"UpAxisSign\", \"int\", \"\",1\r\n Property: \"FrontAxis\", \"int\", \"\",2\r\n Property: \"FrontAxisSign\", \"int\", \"\",1\r\n Property: \"CoordAxis\", \"int\", \"\",0\r\n Property: \"CoordAxisSign\", \"int\", \"\",1\r\n Property: \"UnitScaleFactor\", \"double\", \"\",1\r\n }\r\n }`;\r\n\r\nexport default class FBXResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._info = null;\r\n }\r\n\r\n getResult(info) {\r\n this._info = info;\r\n this._resultArray.push(this._writeHeader());\r\n this._resultArray.push(this._writeDefinitions());\r\n this._resultArray.push(this._writeObjects(info.models, info.materials));\r\n this._resultArray.push(this._writeRelations());\r\n this._resultArray.push(this._writeConnections()); // connections between models and materials)\r\n this._info = null;\r\n return this._resultArray.join('');\r\n }\r\n\r\n /**\r\n * Add FBXHeader info to output file.\r\n * Some fields are really confusing, but it seems that all listed fields are very informative\r\n */\r\n _writeHeader() {\r\n const FBXHeaderVersion = 1003; // 1003 is some number which appears to present in many 6.1 ASCII files\r\n const FBXVersion = 6100; // Mandatory and only supported version\r\n const date = new Date();\r\n const timeStampVersion = 1000;\r\n const creator = `Miew FBX Exporter v${this._info.version}`; // Supposed to be an engine\r\n\r\n return `; FBX 6.1.0 project file\r\n; Created by ${creator} Copyright (c) 2015-2024 EPAM Systems, Inc.\r\n; For support please contact miew@epam.com\r\n; ----------------------------------------------------\r\n\r\nFBXHeaderExtension: {\r\n FBXHeaderVersion: ${FBXHeaderVersion}\r\n FBXVersion: ${FBXVersion}\r\n CreationTimeStamp: {\r\n Version: ${timeStampVersion}\r\n Year: ${date.getFullYear()}\r\n Month: ${date.getMonth() + 1}\r\n Day: ${date.getDate()}\r\n Hour: ${date.getHours()}\r\n Minute: ${date.getMinutes()}\r\n Second: ${date.getSeconds()}\r\n Millisecond: ${date.getMilliseconds()}\r\n }\r\n Creator: \"${creator}\"\r\n OtherFlags: {\r\n FlagPLE: 0\r\n }\r\n}\r\nCreationTime: \"${date}\"\r\nCreator: \"${creator}\"\r\n`;\r\n }\r\n\r\n /**\r\n * Add Definitions info to output file.\r\n * Not exactly sure if this section is template section (as it is in 7.4+) or it should every time be like this\r\n */\r\n _writeDefinitions() {\r\n return `\r\n; Object definitions\r\n;------------------------------------------------------------------\r\n\r\n${defaultDefinitions}\r\n`;\r\n }\r\n\r\n /**\r\n * Adding gathered information about Models to resulting string.\r\n * Reminder - there may be more then 1 model in scene, but we must place materials after ALL models.\r\n * @returns {string} string containing all models (vertices, indices, colors, normals etc)\r\n */\r\n _models() {\r\n const modelVersion = 232;\r\n let allModels = '';\r\n const { models } = this._info;\r\n for (let i = 0; i < models.length; ++i) {\r\n const model = models[i];\r\n const vertCount = model.verticesCount;\r\n allModels += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n Version: ${modelVersion}\r\n ${defaultProperties}\r\n ${this._verticesIndices(model.positions, model.indices)}\r\n ${this._normalLayer(model.normals)}\r\n ${this._colorLayer(model.colors, vertCount)}\r\n ${defaultMaterialLayer}\r\n ${defaultLayerBlock}\r\n }`;\r\n }\r\n return allModels;\r\n }\r\n\r\n /**\r\n * Add Material info to result\r\n */\r\n _materials() {\r\n const materialVersion = 102;\r\n let allMaterials = '';\r\n const { materials } = this._info;\r\n for (let i = 0; i < materials.length; ++i) {\r\n const material = materials[i];\r\n allMaterials += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n Version: ${materialVersion}\r\n ShadingModel: \"lambert\"\r\n MultiLayer: 0\r\n ${this._materialProperties(material)}\r\n }`;\r\n }\r\n return allMaterials;\r\n }\r\n\r\n /**\r\n * Add Objects info to output file.\r\n */\r\n _writeObjects() {\r\n return `\r\n; Object properties\r\n;------------------------------------------------------------------\r\n\r\nObjects: {\r\n ${this._models()}\r\n ${this._materials()}\r\n ${globalSettings}\r\n}\r\n`;\r\n }\r\n\r\n /**\r\n * Add Relations info to output file.\r\n */\r\n _writeRelations() {\r\n let modelsList = '';\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n }`;\r\n }\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n }`;\r\n }\r\n\r\n return `\r\n; Object relations\r\n;------------------------------------------------------------------\r\n\r\nRelations: {\r\n ${modelsList}\r\n Model: \"Model::Producer Perspective\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Top\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Bottom\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Front\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Back\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Right\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Left\", \"Camera\" {\r\n }\r\n Model: \"Model::Camera Switcher\", \"CameraSwitcher\" {\r\n }\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Add Connections info to output file.\r\n */\r\n _writeConnections() {\r\n let modelsList = '';\r\n const { name } = this._info;\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Connect: \"OO\", \"Model::${name}_${i}\", \"Model::Scene\"`;\r\n }\r\n\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Connect: \"OO\", \"Material::${name}_${i}_default\", \"Model::${name}_${i}\"`;\r\n }\r\n\r\n return `\r\n; Object connections\r\n;------------------------------------------------------------------\r\n\r\nConnections: {\r\n ${modelsList}\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Write float array to string with limited precision\r\n * @param {Float32Array} array - array to be fixed\r\n * @returns {String} String with fixed floats\r\n */\r\n _floatArrayToString(array) {\r\n const str = [];\r\n for (let i = 0; i < array.length; ++i) {\r\n str[i] = array[i].toFixed(6);\r\n }\r\n return str.join(',');\r\n }\r\n\r\n /**\r\n * Adding color layer to resulting file\r\n * @param {Float32Array} colorArray attribute\r\n * @param {number} vertCount - number of vertices in the model\r\n * @returns {string} color layer info\r\n */\r\n _colorLayer(colorArray, vertCount) {\r\n const layerElementColorNumber = 0;\r\n const layerElementColorVersion = 101;\r\n const layerElementColorName = '';\r\n const colorsStr = this._floatArrayToString(colorArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n // As said [..Array(...)] - fastest and easiest way to produce [0, 1, .....] array\r\n const colorIndices = [...Array(vertCount).keys()];\r\n return `\r\n LayerElementColor: ${layerElementColorNumber} {\r\n Version: ${layerElementColorVersion}\r\n Name: \"${layerElementColorName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\"\r\n Colors: ${colorsStr}\r\n ColorIndex: ${colorIndices}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding normal layer to resulting file\r\n * @param {Float32Array} normalArray attribute\r\n * @returns {string} normal layer info\r\n */\r\n _normalLayer(normalArray) {\r\n const layerElementNormalNumber = 0;\r\n const layerElementNormalVersion = 101;\r\n const layerElementNormalName = '';\r\n const normalsStr = this._floatArrayToString(normalArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n return `\r\n LayerElementNormal: ${layerElementNormalNumber} {\r\n Version: ${layerElementNormalVersion}\r\n Name: \"${layerElementNormalName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\"\r\n Normals: ${normalsStr}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding vertices and indices to resulting string\r\n * @return {string} resulting string in FBX notation\r\n */\r\n _verticesIndices(positions, indices) {\r\n const multiLayer = 0;\r\n const multiTake = 1;\r\n const shading = 'Y';\r\n const culling = 'CullingOff';\r\n const geometryVersion = 124;\r\n const vertStr = this._floatArrayToString(positions);\r\n /* About _correctArrayNotation: Float32Arrays will contains only Float32 numbers, which implies that it will be floating points with 17 numbers after point.\r\n * We cannot (and it's logically incorrect) save all this information, so we convert this Float32Array into Array-like object with numbers with only 6 numbers after point\r\n * Reminder - this is big memory loss (as we must save at one moment two arrays with similar information) */\r\n return `MultiLayer: ${multiLayer}\r\n MultiTake: ${multiTake}\r\n Shading: ${shading}\r\n Culling: \"${culling}\"\r\n Vertices: ${vertStr}\r\n PolygonVertexIndex: ${indices}\r\n GeometryVersion: ${geometryVersion}`;\r\n }\r\n\r\n /**\r\n * Forming material properties block.\r\n * @param {Object} material - given material of model\r\n * @returns {String} material properties string\r\n */\r\n _materialProperties(material) {\r\n return `Properties60: {\r\n Property: \"ShadingModel\", \"KString\", \"\", \"Lambert\"\r\n Property: \"MultiLayer\", \"bool\", \"\",0\r\n Property: \"EmissiveColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"EmissiveFactor\", \"double\", \"\",0.0000\r\n Property: \"AmbientColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"AmbientFactor\", \"double\", \"\",0.0000\r\n Property: \"DiffuseColor\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"DiffuseFactor\", \"double\", \"\",1.0000\r\n Property: \"Bump\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TransparentColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"TransparencyFactor\", \"double\", \"\",0.0000\r\n Property: \"SpecularColor\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"SpecularFactor\", \"double\", \"\",1.0000\r\n Property: \"ShininessExponent\", \"double\", \"\",${material.shininess}\r\n Property: \"ReflectionColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"ReflectionFactor\", \"double\", \"\",1\r\n Property: \"Ambient\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"Diffuse\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"Specular\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"Shininess\", \"double\", \"\",${material.shininess}\r\n Property: \"Opacity\", \"double\", \"\",${material.opacity}\r\n Property: \"Reflectivity\", \"double\", \"\",0\r\n }`;\r\n }\r\n}\r\n","import Exporter from './Exporter';\r\nimport FBXInfoExtractor from './fbx/FBXInfoExtractor';\r\nimport FBXResult from './fbx/FBXResult';\r\nimport ComplexVisual from '../../ComplexVisual';\r\n\r\nexport default class FBXExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n // Data\r\n this._data = source;\r\n this._version = options.miewVersion || '0.0-UNSPECIFIED';\r\n this._extractor = new FBXInfoExtractor();\r\n }\r\n\r\n /**\r\n * Entry point to exporter.\r\n */\r\n exportSync() {\r\n // Creating mandatory blocks\r\n const result = new FBXResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n const info = this._extractor.process(this._data);\r\n info.version = this._version;\r\n this._result = result.getResult(info);\r\n return this._result;\r\n }\r\n}\r\n\r\nFBXExporter.formats = ['fbx'];\r\nFBXExporter.SourceClass = ComplexVisual;\r\n","import ExporterList from './exporters/ExporterList';\r\n\r\nimport PDBExporter from './exporters/PDBExporter';\r\nimport FBXExporter from './exporters/FBXExporter';\r\n\r\nexport default new ExporterList([\r\n PDBExporter,\r\n FBXExporter,\r\n]);\r\n","import loaders from './loaders';\r\nimport parsers from './parsers';\r\nimport exporters from './exporters';\r\n\r\nexport default {\r\n loaders,\r\n parsers,\r\n exporters,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from './CSS2DObject';\r\n\r\nconst tempColor = new THREE.Color();\r\n\r\nclass CSS2DRenderer {\r\n constructor() {\r\n this._width = 0;\r\n this._height = 0;\r\n this._widthHalf = 0;\r\n this._heightHalf = 0;\r\n\r\n this._vector = new THREE.Vector3();\r\n this._viewMatrix = new THREE.Matrix4();\r\n this._projectionMatrix = new THREE.Matrix4();\r\n\r\n this._domElement = document.createElement('div');\r\n this._domElement.style.overflow = 'hidden';\r\n this._domElement.style.position = 'absolute';\r\n this._domElement.style.top = '0';\r\n this._domElement.style.zIndex = '0'; // start a new Stacking Context to enclose all z-ordered children\r\n this._domElement.style.pointerEvents = 'none';\r\n }\r\n\r\n getElement() {\r\n return this._domElement;\r\n }\r\n\r\n reset() {\r\n const myNode = this.getElement();\r\n while (myNode.firstChild) {\r\n myNode.removeChild(myNode.firstChild);\r\n }\r\n }\r\n\r\n setSize(width, height) {\r\n this._width = width;\r\n this._height = height;\r\n\r\n this._widthHalf = this._width / 2;\r\n this._heightHalf = this._height / 2;\r\n\r\n this._domElement.style.width = `${width}px`;\r\n this._domElement.style.height = `${height}px`;\r\n }\r\n\r\n _renderObject(object, camera, scene) {\r\n function lerpColorAsHex(a, b, t) {\r\n tempColor.setHex(a);\r\n tempColor.lerp(b, t);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n function colorAsHex(a) {\r\n tempColor.setHex(a);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n if (object instanceof CSS2DObject) {\r\n this._vector.setFromMatrixPosition(object.matrixWorld);\r\n\r\n if (object.userData !== undefined && object.userData.offset !== undefined) {\r\n const localOffset = new THREE.Vector3(object.userData.offset.x, object.userData.offset.y, 0);\r\n this._vector.add(localOffset.multiplyScalar(object.matrixWorld.getMaxScaleOnAxis()));\r\n }\r\n\r\n this._vector.applyMatrix4(this._viewMatrix);\r\n\r\n const visibility = this._vector.z > -camera.near ? 'hidden' : 'visible';\r\n const zIndex = 10000 * (camera.far - (-this._vector.z)) / (camera.far - camera.near);\r\n\r\n const element = object.getElement();\r\n if (typeof scene.fog === 'undefined') {\r\n element.style.color = colorAsHex(object.userData.color);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = colorAsHex(object.userData.background);\r\n }\r\n } else {\r\n const fogFactor = THREE.MathUtils.smoothstep(-this._vector.z, scene.fog.near, scene.fog.far);\r\n element.style.color = lerpColorAsHex(object.userData.color, scene.fog.color, fogFactor);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = lerpColorAsHex(object.userData.background, scene.fog.color, fogFactor);\r\n }\r\n }\r\n\r\n this._vector.applyMatrix4(this._projectionMatrix);\r\n\r\n const style = `${object.userData !== {} ? object.userData.translation : 'translate(-50%, -50%) '\r\n }translate(${this._vector.x * this._widthHalf + this._widthHalf}px,${\r\n -this._vector.y * this._heightHalf + this._heightHalf}px)`;\r\n element.style.visibility = visibility;\r\n element.style.WebkitTransform = style;\r\n element.style.MozTransform = style;\r\n element.style.oTransform = style;\r\n element.style.transform = style;\r\n element.style.zIndex = Number(zIndex).toFixed(0);\r\n\r\n if (element.parentNode !== this._domElement) {\r\n this._domElement.appendChild(element);\r\n }\r\n }\r\n\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n this._renderObject(object.children[i], camera, scene);\r\n }\r\n }\r\n\r\n render(scene, camera) {\r\n scene.updateMatrixWorld();\r\n\r\n if (camera.parent === null) {\r\n camera.updateMatrixWorld();\r\n }\r\n\r\n camera.matrixWorldInverse.copy(camera.matrixWorld).invert();\r\n\r\n this._viewMatrix.copy(camera.matrixWorldInverse);\r\n this._projectionMatrix.copy(camera.projectionMatrix);\r\n\r\n this._renderObject(scene, camera, scene);\r\n }\r\n}\r\nexport default CSS2DRenderer;\r\n","export default function getTopWindow() {\r\n // intercept the exception if we have cross-origin iframe\r\n try {\r\n if (window.top.location.href !== undefined) {\r\n return window.top;\r\n }\r\n } catch (e) {\r\n // provide fallback\r\n }\r\n return window;\r\n}\r\n","import * as THREE from 'three';\r\nimport Timer from '../Timer';\r\nimport settings from '../settings';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\nimport getTopWindow from '../utils/getTopWindow';\r\n\r\nconst VK_LEFT = 37;\r\nconst VK_UP = 38;\r\nconst VK_RIGHT = 39;\r\nconst VK_DOWN = 40;\r\n\r\nconst STATE = {\r\n NONE: -1, ROTATE: 0, TRANSLATE: 1, SCALE: 2, TRANSLATE_PIVOT: 3,\r\n};\r\n\r\n// pausing for this amount of time before releasing mouse button prevents inertial rotation (seconds)\r\nconst FULL_STOP_THRESHOLD = 0.1;\r\n\r\nconst quaternion = new THREE.Quaternion();\r\nconst matrix4 = new THREE.Matrix4();\r\n\r\n// pivot -- local offset of the rotation pivot point\r\nfunction ObjectHandler(objects, camera, pivot, options) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n this.camera = camera;\r\n this.pivot = pivot;\r\n this.axis = new THREE.Vector3(0, 0, 1);\r\n this.options = options;\r\n\r\n this.lastRotation = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n}\r\n\r\nObjectHandler.prototype._rotate = (function () {\r\n const p = new THREE.Vector3();\r\n const q = new THREE.Quaternion();\r\n const s = new THREE.Vector3();\r\n\r\n const m = new THREE.Matrix4();\r\n\r\n return function (quat) {\r\n const zeroPivot = (this.pivot.x === 0.0 && this.pivot.y === 0.0 && this.pivot.z === 0.0);\r\n\r\n m.copy(this.object.matrix);\r\n\r\n if (zeroPivot) {\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n } else {\r\n m.multiply(matrix4.makeTranslation(this.pivot.x, this.pivot.y, this.pivot.z));\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n m.multiply(matrix4.makeTranslation(-this.pivot.x, -this.pivot.y, -this.pivot.z));\r\n }\r\n\r\n m.decompose(p, q, s);\r\n\r\n // update objects\r\n if (!zeroPivot) {\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].position.copy(p);\r\n }\r\n }\r\n\r\n for (let j = 0; j < this.objects.length; ++j) {\r\n this.objects[j].quaternion.copy(q);\r\n this.objects[j].updateMatrix();\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.setObjects = function (objects) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n};\r\n\r\nObjectHandler.prototype.rotate = (function () {\r\n const rot = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n\r\n return function (quat, mousePrevPos, mouseCurPos, aboutAxis) {\r\n this.mouse2rotation(rot, mousePrevPos, mouseCurPos, aboutAxis);\r\n quat.setFromAxisAngle(rot.axis, rot.angle);\r\n\r\n if (rot.angle) {\r\n this._rotate(quat);\r\n }\r\n\r\n this.lastRotation = rot;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.translate = (function () {\r\n const dir = new THREE.Vector3();\r\n const pivot = new THREE.Vector3();\r\n\r\n return function (delta) {\r\n // reverse-project viewport movement to view coords (compensate for screen aspect ratio)\r\n dir.set(\r\n delta.x / this.camera.projectionMatrix.elements[0],\r\n delta.y / this.camera.projectionMatrix.elements[5],\r\n 0,\r\n );\r\n let dist = dir.length();\r\n dir.normalize();\r\n\r\n // transform movement direction to object local coords\r\n dir.transformDirection(matrix4.copy(this.object.matrixWorld).invert());\r\n\r\n // visible translate distance shouldn't depend on camera-to-object distance\r\n pivot.copy(this.pivot);\r\n this.object.localToWorld(pivot);\r\n dist *= Math.abs(pivot.z - this.camera.position.z);\r\n\r\n // visible translate distance shouldn't depend on object scale\r\n dist /= this.object.matrixWorld.getMaxScaleOnAxis();\r\n\r\n // all objects are translated similar to principal object\r\n // (we assume they all have identical pivot and scale)\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].translateOnAxis(dir, dist);\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.update = (function () {\r\n const axis = new THREE.Vector3();\r\n\r\n return function (timeSinceLastUpdate, timeSinceMove) {\r\n if (settings.now.autoRotation !== 0.0) {\r\n // auto-rotation with constant speed\r\n\r\n // if rotation axis is fixed or hasn't been defined yet\r\n if (settings.now.autoRotationAxisFixed || this.lastRotation.axis.length() === 0.0) {\r\n // use Y-axis (transformed to local object coords)\r\n axis.set(0, 1, 0).transformDirection(matrix4.copy(this.object.matrixWorld).invert());\r\n } else {\r\n // use axis defined by last user rotation\r\n axis.copy(this.lastRotation.axis);\r\n }\r\n\r\n this._rotate(quaternion.setFromAxisAngle(axis, settings.now.autoRotation * timeSinceLastUpdate));\r\n return true;\r\n }\r\n\r\n if (this.options.intertia && this.lastRotation.angle) {\r\n // inertial object rotation\r\n const angle = this.lastRotation.angle * ((1.0 - this.options.dynamicDampingFactor) ** (40.0 * timeSinceMove));\r\n\r\n if (Math.abs(angle) <= this.options.intertiaThreshold) {\r\n this.lastRotation.angle = 0.0;\r\n } else {\r\n this._rotate(quaternion.setFromAxisAngle(this.lastRotation.axis, angle));\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.stop = function () {\r\n this.lastRotation.angle = 0.0;\r\n};\r\n\r\n// calculate (axis, angle) pair from mouse/touch movement\r\nObjectHandler.prototype.mouse2rotation = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n const eye = new THREE.Vector3();\r\n const eyeDirection = new THREE.Vector3();\r\n\r\n const cameraUpDirection = new THREE.Vector3();\r\n const cameraSidewaysDirection = new THREE.Vector3();\r\n\r\n const moveDirection = new THREE.Vector3();\r\n\r\n const mouseDelta = new THREE.Vector2();\r\n\r\n return function (rot, mousePrev, mouseCur, aboutAxis) {\r\n if (aboutAxis) {\r\n rot.axis.copy(this.axis);\r\n rot.angle = this.options.axisRotateFactor * (mouseCur.y - mousePrev.y);\r\n\r\n /* cool method that allows rotation around Z axis to be \"tied\" to mouse cursor\r\n\r\n res.axis.copy(this.axis);\r\n\r\n var pivot = this.pivot.clone();\r\n this.object.localToWorld(pivot);\r\n pivot.project(this.camera);\r\n\r\n var v1 = new THREE.Vector3(mousePrev.x, mousePrev.y, this.camera.position.z);\r\n v1.sub(pivot);\r\n var v2 = new THREE.Vector3(mouseCur.x, mouseCur.y, this.camera.position.z);\r\n v2.sub(pivot);\r\n\r\n v1.sub(res.axis.clone().multiplyScalar(v1.dot(res.axis)));\r\n v2.sub(res.axis.clone().multiplyScalar(v2.dot(res.axis)));\r\n\r\n var abs = v1.length() * v2.length();\r\n if (abs > 0) {\r\n res.angle = res.axis.dot(v1.cross(v2)) / abs;\r\n }\r\n */\r\n } else {\r\n mouseDelta.subVectors(mouseCur, mousePrev);\r\n const angle = mouseDelta.length();\r\n if (angle === 0.0) {\r\n return;\r\n }\r\n\r\n center.copy(this.pivot);\r\n this.object.localToWorld(center);\r\n eye.subVectors(this.camera.position, center);\r\n eyeDirection.copy(eye).normalize();\r\n\r\n cameraUpDirection.copy(this.camera.up).normalize();\r\n cameraSidewaysDirection.crossVectors(cameraUpDirection, eyeDirection).normalize();\r\n\r\n cameraUpDirection.setLength(mouseDelta.y);\r\n cameraSidewaysDirection.setLength(mouseDelta.x);\r\n\r\n moveDirection.copy(cameraUpDirection.add(cameraSidewaysDirection));\r\n\r\n rot.axis.crossVectors(moveDirection, eye);\r\n\r\n rot.angle = -angle * this.options.rotateFactor;\r\n }\r\n\r\n rot.axis.transformDirection(matrix4.copy(this.object.matrixWorld).invert());\r\n\r\n // make sure angle is always positive (thus 'axis' defines both axis and direction of rotation)\r\n if (rot.angle < 0.0) {\r\n rot.axis.negate();\r\n rot.angle = -rot.angle;\r\n }\r\n };\r\n}());\r\n\r\nfunction ObjectControls(object, objectPivot, camera, domElement, getAltObj) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.object = object;\r\n this.objectPivot = objectPivot;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.getAltObj = getAltObj;\r\n\r\n // API\r\n\r\n this.enabled = true;\r\n this.hotkeysEnabled = true;\r\n\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n\r\n this.options = {\r\n rotateFactor: Math.PI, // full screen slide (along short side) would roughly mean 180 deg. rotation\r\n axisRotateFactor: 4 * Math.PI, // full screen slide (along short side) would roughly mean 720 deg. rotation\r\n intertia: true,\r\n dynamicDampingFactor: 0.1,\r\n intertiaThreshold: 1e-3,\r\n };\r\n\r\n // internals\r\n\r\n this._state = STATE.NONE;\r\n\r\n this._mousePrevPos = new THREE.Vector2();\r\n this._mouseCurPos = new THREE.Vector2();\r\n\r\n this._mainObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._altObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._affectedObj = this._mainObj;\r\n this._isAltObjFreeRotationAllowed = true;\r\n this._isTranslationAllowed = true;\r\n this._isKeysTranslatingObj = false;\r\n\r\n this._pressedKeys = [];\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n this._lastUpdateTime = this._clock.getElapsedTime();\r\n\r\n // events\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousewheel',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'DOMMouseScroll',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseout',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchmove',\r\n handler(e) {\r\n self.touchmove(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keydown',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keyup',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'blur',\r\n handler() {\r\n self.resetKeys();\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'contextmenu',\r\n handler(e) {\r\n self.contextmenu(e);\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n\r\n this.resetKeys();\r\n\r\n // force an update at start\r\n this.update();\r\n}\r\n\r\n// methods\r\n\r\nObjectControls.prototype = Object.create(EventDispatcher.prototype);\r\nObjectControls.prototype.constructor = ObjectControls;\r\n\r\nObjectControls.prototype.resetKeys = function () {\r\n this._pressedKeys[VK_LEFT] = false;\r\n this._pressedKeys[VK_UP] = false;\r\n this._pressedKeys[VK_RIGHT] = false;\r\n this._pressedKeys[VK_DOWN] = false;\r\n};\r\n\r\nObjectControls.prototype.contextmenu = function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n};\r\n\r\nObjectControls.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nObjectControls.prototype.enable = function (enable) {\r\n this.enabled = enable;\r\n};\r\n\r\nObjectControls.prototype.enableHotkeys = function (enable) {\r\n this.hotkeysEnabled = enable;\r\n};\r\n\r\nObjectControls.prototype.allowTranslation = function (allow) {\r\n this._isTranslationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.allowAltObjFreeRotation = function (allow) {\r\n this._isAltObjFreeRotationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.keysTranslateObj = function (on) {\r\n this._isKeysTranslatingObj = on;\r\n};\r\n\r\nObjectControls.prototype.isEditingAltObj = function () {\r\n return ((this._state === STATE.ROTATE) || (this._state === STATE.TRANSLATE))\r\n && (this._affectedObj === this._altObj);\r\n};\r\n\r\n// convert page coords of mouse/touch to uniform coords with smaller side being [-0.5, 0.5]\r\n// (uniform coords keep direct proportion with screen distance travelled by mouse regardless of screen aspect ratio)\r\nObjectControls.prototype.convertMouseToOnCircle = function (coords, pageX, pageY) {\r\n const screenSize = Math.min(this.screen.width, this.screen.height);\r\n\r\n if (screenSize === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n ((pageX - this.screen.width * 0.5 - this.screen.left) / screenSize),\r\n ((0.5 * this.screen.height + this.screen.top - pageY) / screenSize),\r\n );\r\n};\r\n\r\n// convert page coords of mouse/touch to viewport coords with both sides being [-1, 1]\r\n// (those are non-uniform coords affected by screen aspect ratio)\r\nObjectControls.prototype.convertMouseToViewport = function (coords, pageX, pageY) {\r\n if (this.screen.width === 0 || this.screen.height === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n (2.0 * (pageX - this.screen.width * 0.5 - this.screen.left) / this.screen.width),\r\n (2.0 * (0.5 * this.screen.height + this.screen.top - pageY) / this.screen.height),\r\n );\r\n};\r\n\r\nObjectControls.prototype.stop = function () {\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n};\r\n\r\n// rotate object based on latest mouse/touch movement\r\nObjectControls.prototype.rotateByMouse = (function () {\r\n const quat = new THREE.Quaternion();\r\n\r\n return function (aboutZAxis) {\r\n this._affectedObj.rotate(quat, this._mousePrevPos, this._mouseCurPos, aboutZAxis);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n };\r\n}());\r\n\r\n// rotate object by specified quaternion\r\nObjectControls.prototype.rotate = function (quat) {\r\n this.object.quaternion.multiply(quat);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n};\r\n\r\n// get object's orientation\r\nObjectControls.prototype.getOrientation = function () {\r\n return this.object.quaternion;\r\n};\r\n\r\n// set object's orientation\r\nObjectControls.prototype.setOrientation = function (quat) {\r\n this.object.quaternion.copy(quat);\r\n};\r\n\r\n// translate object based on latest mouse/touch movement\r\nObjectControls.prototype.translate = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this._affectedObj.translate(delta);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n };\r\n}());\r\n\r\n// get object scale\r\nObjectControls.prototype.getScale = function () {\r\n return this.object.scale.x;\r\n};\r\n\r\n// set uniform object scale\r\nObjectControls.prototype.setScale = function (scale) {\r\n this.object.scale.set(scale, scale, scale);\r\n};\r\n\r\n// scale object by factor (factor should be greater than zero)\r\nObjectControls.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n return;\r\n }\r\n this.setScale(this.object.scale.x * factor);\r\n this.dispatchEvent({ type: 'change', action: 'zoom', factor });\r\n};\r\n\r\nObjectControls.prototype.update = (function () {\r\n const shift = new THREE.Vector2();\r\n\r\n return function () {\r\n const curTime = this._clock.getElapsedTime();\r\n const timeSinceLastUpdate = curTime - this._lastUpdateTime;\r\n\r\n // update object handler\r\n if (this._state === STATE.NONE) {\r\n const timeSinceMove = curTime - this._lastMouseMoveTime;\r\n if (this._mainObj.update(timeSinceLastUpdate, timeSinceMove)\r\n || this._altObj.update(timeSinceLastUpdate, timeSinceMove)) {\r\n this.dispatchEvent({ type: 'change', action: 'auto' });\r\n }\r\n }\r\n\r\n // apply arrow keys\r\n if (this._isKeysTranslatingObj) {\r\n const speedX = Number(this._pressedKeys[VK_RIGHT]) - Number(this._pressedKeys[VK_LEFT]);\r\n const speedY = Number(this._pressedKeys[VK_UP]) - Number(this._pressedKeys[VK_DOWN]);\r\n if (speedX !== 0.0 || speedY !== 0.0) {\r\n const delta = timeSinceLastUpdate;\r\n\r\n // update object translation\r\n const altObj = this.getAltObj();\r\n if (altObj.objects.length > 0) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n\r\n shift.set(delta * speedX, delta * speedY);\r\n this._altObj.translate(shift);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n }\r\n }\r\n }\r\n\r\n this._lastUpdateTime = curTime;\r\n };\r\n}());\r\n\r\nObjectControls.prototype.reset = function () {\r\n this._state = STATE.NONE;\r\n\r\n this.object.quaternion.copy(quaternion.set(0, 0, 0, 1));\r\n};\r\n\r\n// listeners\r\n\r\nObjectControls.prototype.mousedown = function (event) {\r\n if (this.enabled === false || this._state !== STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (this._state === STATE.NONE) {\r\n if (event.button === 0) {\r\n this._affectedObj.stop(); // can edit only one object at a time\r\n\r\n let workWithAltObj = false;\r\n\r\n if (event.altKey) {\r\n const altObj = this.getAltObj();\r\n workWithAltObj = (altObj.objects.length > 0);\r\n if (workWithAltObj) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n this._affectedObj = workWithAltObj ? this._altObj : this._mainObj;\r\n\r\n this._state = (workWithAltObj && event.ctrlKey && this._isTranslationAllowed) ? STATE.TRANSLATE : STATE.ROTATE;\r\n } else if (event.button === 2) {\r\n this._state = STATE.TRANSLATE_PIVOT;\r\n }\r\n }\r\n\r\n if (this._state === STATE.ROTATE) {\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n\r\n if (this._state === STATE.TRANSLATE || this._state === STATE.TRANSLATE_PIVOT) {\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousemove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this.rotateByMouse((event.altKey && !this._isAltObjFreeRotationAllowed) || event.shiftKey);\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.TRANSLATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translate();\r\n break;\r\n\r\n case STATE.TRANSLATE_PIVOT:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translatePivotByMouse();\r\n break;\r\n\r\n default: break;\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousewheel = function (event) {\r\n if (this.enabled === false || !settings.now.zooming || this._state !== STATE.NONE || event.shiftKey) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n let delta = 0;\r\n\r\n if (event.wheelDelta) {\r\n // WebKit / Opera / Explorer 9\r\n delta = event.wheelDelta / 40;\r\n } else if (event.detail) {\r\n // Firefox\r\n delta = -event.detail / 3;\r\n }\r\n\r\n let factor = 1.0 + delta * 0.05;\r\n factor = Math.max(factor, 0.01);\r\n this.scale(factor);\r\n};\r\n\r\nObjectControls.prototype.mouseup = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n this._state = STATE.NONE;\r\n\r\n if (this._clock.getElapsedTime() - this._lastMouseMoveTime > FULL_STOP_THRESHOLD) {\r\n this._affectedObj.stop();\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchstartend = function (event) {\r\n if (this.enabled === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (event.touches.length) {\r\n case 1:\r\n this._state = STATE.ROTATE;\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n break;\r\n\r\n case 2: {\r\n // prevent inertial rotation\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n\r\n this._state = STATE.SCALE;\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = this._touchDistanceStart = Math.sqrt(dx * dx + dy * dy);\r\n this._scaleStart = this.object.scale.x;\r\n break;\r\n }\r\n\r\n default:\r\n this._state = STATE.NONE;\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchmove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this.rotateByMouse(false);\r\n\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.SCALE:\r\n if (settings.now.zooming) {\r\n // update scale\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = Math.sqrt(dx * dx + dy * dy);\r\n const newScale = this._scaleStart * this._touchDistanceCur / this._touchDistanceStart;\r\n const factor = newScale / this.object.scale.x;\r\n this.scale(factor);\r\n }\r\n break;\r\n\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.keydownup = function (event) {\r\n if (this.enabled === false || this.hotkeysEnabled === false) {\r\n return;\r\n }\r\n\r\n switch (event.keyCode) {\r\n case VK_LEFT:\r\n case VK_UP:\r\n case VK_RIGHT:\r\n case VK_DOWN:\r\n this._pressedKeys[event.keyCode] = (event.type === 'keydown');\r\n event.preventDefault();\r\n event.stopPropagation();\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.getKeyBindObject = function () {\r\n return getTopWindow();\r\n};\r\n\r\nObjectControls.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nObjectControls.prototype.translatePivotByMouse = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this.translatePivotInWorld(settings.now.translationSpeed * delta.x, settings.now.translationSpeed * delta.y, 0);\r\n };\r\n}());\r\n\r\n// Translate in WorldCS, translation is scaled with root scale matrix\r\nObjectControls.prototype.translatePivotInWorld = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.applyMatrix4(this.object.matrixWorld);\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n pos.applyMatrix4(matrix4.copy(this.object.matrixWorld).invert());\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Translate in ModelCS, x, y, z are Ang\r\nObjectControls.prototype.translatePivot = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Set pivot\r\nObjectControls.prototype.setPivot = function (newPivot) {\r\n this.objectPivot.position.copy(newPivot);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\nexport default ObjectControls;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\nimport Timer from '../Timer';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\n\r\nfunction Picker(gfxObj, camera, domElement) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.gfxObj = gfxObj;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n this._lastMousePos = new THREE.Vector2(0, 0);\r\n this._mouseTotalDist = 0.0;\r\n this._lastClickBeginTime = -1000.0;\r\n this._lastClickPos = new THREE.Vector2(0, 0);\r\n this._clickBeginTime = 0.0;\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstart(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchend(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n}\r\n\r\nPicker.prototype = Object.create(EventDispatcher.prototype);\r\nPicker.prototype.constructor = Picker;\r\n\r\nPicker.prototype.reset = function () {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n};\r\n\r\nPicker.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nPicker.prototype.pickObject = function (screenPos) {\r\n if (!this.gfxObj) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n const { gfxObj } = this;\r\n const rayCaster = new THREE.Raycaster();\r\n rayCaster.ray.origin.setFromMatrixPosition(this.camera.matrixWorld);\r\n rayCaster.ray.direction.set(screenPos.x, screenPos.y, 0.5).unproject(this.camera).sub(rayCaster.ray.origin).normalize();\r\n\r\n const clipPlane = (settings.now.draft.clipPlane && this.clipPlaneValue) ? this.clipPlaneValue : Infinity;\r\n const fogFarPlane = (settings.now.fog && this.fogFarValue) ? this.fogFarValue : Infinity;\r\n const point = rayCaster.intersectVisibleObject(gfxObj, this.camera, clipPlane, fogFarPlane);\r\n if (!point) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n let picked = {};\r\n if (point.residue || point.atom) {\r\n const residue = point.residue || point.atom.residue;\r\n if (settings.now.pick === 'chain') {\r\n picked = { chain: residue.getChain() };\r\n } else if (settings.now.pick === 'molecule') {\r\n picked = { molecule: residue.getMolecule() };\r\n } else if (point.residue || settings.now.pick === 'residue') {\r\n picked = { residue };\r\n } else if (point.atom) {\r\n picked = { atom: point.atom };\r\n }\r\n }\r\n this.picked = picked;\r\n this.dispatchEvent({ type: 'newpick', obj: picked });\r\n};\r\n\r\nPicker.prototype.getMouseInViewport = function (pageX, pageY) {\r\n return new THREE.Vector2(\r\n (pageX - this.screen.left) / this.screen.width * 2 - 1,\r\n -(pageY - this.screen.top) / this.screen.height * 2 + 1,\r\n );\r\n};\r\n\r\nPicker.prototype.mousedown = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n this._lastMousePos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist = 0.0;\r\n this._clickBeginTime = this._clock.getElapsedTime();\r\n }\r\n};\r\n\r\nPicker.prototype.mousemove = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n const pos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist += pos.sub(this._lastMousePos).length();\r\n};\r\n\r\nPicker.prototype.mouseup = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n if (this._mouseTotalDist < 0.01) {\r\n const curTime = this._clock.getElapsedTime();\r\n const curPos = this.getMouseInViewport(event.pageX, event.pageY);\r\n\r\n const timeSinceLastClickBegin = curTime - this._lastClickBeginTime;\r\n if (timeSinceLastClickBegin < 0.7) {\r\n const clickDist = new THREE.Vector2().subVectors(curPos, this._lastClickPos);\r\n if (clickDist.length() < 0.01) {\r\n // it's a double click\r\n this.dispatchEvent({ type: 'dblclick', obj: this.picked });\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = -1000; // this click cannot serve as first click in double-click\r\n return;\r\n }\r\n }\r\n\r\n setTimeout(() => {\r\n self.pickObject(curPos);\r\n }, 0);\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = this._clickBeginTime;\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.touchstart = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 1) {\r\n this._lastTouchdownPos = this.getMouseInViewport(event.touches[0].pageX, event.touches[0].pageY);\r\n }\r\n};\r\n\r\nPicker.prototype.touchend = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 0\r\n && event.changedTouches.length === 1) {\r\n const pos = this.getMouseInViewport(event.changedTouches[0].pageX, event.changedTouches[0].pageY);\r\n const dist = pos.sub(this._lastTouchdownPos).length();\r\n if (dist < 0.01) {\r\n setTimeout(() => {\r\n self.pickObject(self._lastTouchdownPos);\r\n }, 0);\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nexport default Picker;\r\n","import * as THREE from 'three';\r\n\r\nclass Axes {\r\n constructor(target, targetCamera) {\r\n this._target = target;\r\n this._targetCamera = targetCamera;\r\n this._camera = new THREE.PerspectiveCamera(targetCamera.fov, targetCamera.aspect, 1, 100);\r\n this._object = new THREE.AxesHelper(1);\r\n this._scene = new THREE.Scene();\r\n this._scene.add(this._object);\r\n this._full = new THREE.Vector2();\r\n\r\n this._update();\r\n }\r\n\r\n _update() {\r\n const { fov } = this._targetCamera;\r\n const camera = this._camera;\r\n camera.aspect = this._targetCamera.aspect;\r\n camera.setMinimalFov(fov);\r\n camera.setDistanceToFit(1.0, fov);\r\n camera.updateProjectionMatrix();\r\n\r\n this._object.quaternion.copy(this._target.quaternion);\r\n }\r\n\r\n render(renderer) {\r\n this._update();\r\n\r\n renderer.getSize(this._full);\r\n const width = this._full.width * 0.25;\r\n const height = this._full.height * 0.25;\r\n\r\n const { autoClear } = renderer;\r\n renderer.autoClear = false;\r\n renderer.setViewport(0.0, 0.0, width, height);\r\n renderer.clear(false, true, false);\r\n renderer.render(this._scene, this._camera);\r\n renderer.setViewport(0, 0, this._full.width, this._full.height);\r\n renderer.autoClear = autoClear;\r\n }\r\n}\r\nexport default Axes;\r\n","import * as THREE from 'three';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\n\r\nconst cDataOffset = 12;\r\nconst cFirstMask = 0x0FFFFF00;\r\nconst cFirstShift = 8;\r\nconst cSecMask1 = 0x000000FF;\r\nconst cSecShift1 = 12;\r\nconst cSecMask2 = 0xFFF00000;\r\nconst cSecShift2 = 20;\r\nconst cThirdMask = 0x000FFFFF;\r\nconst cStrMask = 0xF0000000;\r\nconst cStrShift = 28;\r\nconst c219 = 1 << 19;\r\nconst c220 = 1 << 20;\r\n\r\nconst cHelixIdx = 1;\r\nconst cSheetIdx = 2;\r\nconst secTypes = ['helix', 'strand'];\r\nconst cSecNames = ['fs', 'ps', 'ns', 'us'];\r\n\r\nfunction _createSecondary(strArray, complex) {\r\n const residues = complex._residues;\r\n const nRes = residues.length;\r\n const resid = new Uint8Array(nRes);\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, n = strArray.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n resid[atom.residue._index] = strArray[i];\r\n }\r\n\r\n const secondary = [];\r\n let rIdx = 0;\r\n while (rIdx < nRes) {\r\n if (resid[rIdx] !== 0) {\r\n const start = rIdx;\r\n const val = resid[rIdx];\r\n while (rIdx < nRes - 1 && resid[rIdx + 1] === val\r\n && residues[rIdx].isConnected(residues[rIdx + 1])) {\r\n ++rIdx;\r\n }\r\n secondary.push({ start, end: rIdx, type: secTypes[val - 1] });\r\n }\r\n ++rIdx;\r\n }\r\n return secondary;\r\n}\r\n\r\nfunction fromUInt20ToInt20(uint20) {\r\n return uint20 >= c219 ? uint20 - c220 : uint20;\r\n}\r\n\r\nclass FrameInfo {\r\n constructor(complex, payload, callbacks) {\r\n this._complex = complex;\r\n this._secondary = null;\r\n this.isLoading = false;\r\n this._framesRange = {\r\n start: 0,\r\n end: -1,\r\n };\r\n this.frameIsReady = false;\r\n this._buffer = null;\r\n this._frameRequest = null;\r\n this._callbacks = callbacks;\r\n if (typeof payload === 'function') {\r\n this._framesRequestLength = 1;\r\n this._downloadDataFn = payload;\r\n } else {\r\n this.parseBinaryData(payload, true);\r\n }\r\n this.reset();\r\n this.setFrame(0);\r\n }\r\n\r\n _prepareBuffer(framesStart, framesEnd) {\r\n if (framesStart === undefined || framesStart === null) {\r\n framesStart = 0;\r\n }\r\n if (framesEnd === undefined || framesEnd === null) {\r\n framesEnd = framesStart + this._framesRequestLength;\r\n }\r\n if (this._framesCount !== undefined) {\r\n framesEnd = Math.min(this._framesCount - 1, framesEnd);\r\n }\r\n if (this._downloadDataFn) {\r\n const self = this;\r\n const onDone = function (data) {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n self._buffer = {\r\n data,\r\n state: 'ready',\r\n start: framesStart,\r\n end: framesEnd,\r\n };\r\n if (self._frameRequest !== null) {\r\n const idx = self._frameRequest;\r\n self._frameRequest = null;\r\n self.setFrame(idx);\r\n }\r\n };\r\n const onFail = function () {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onError === 'function') {\r\n self._callbacks.onError('Streaming failed');\r\n }\r\n };\r\n if (!this._buffer) {\r\n this._buffer = {};\r\n }\r\n this._buffer.state = 'downloading';\r\n this.isLoading = true;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n this._downloadDataFn({ start: framesStart, end: framesEnd + 1 }, onDone, onFail);\r\n }\r\n }\r\n\r\n _parseBuffer() {\r\n if (this._buffer && this._buffer.state === 'ready') {\r\n this._framesRange = {\r\n start: this._buffer.start,\r\n end: this._buffer.end,\r\n };\r\n this.parseBinaryData(this._buffer.data, false);\r\n let _bufferRequestStart = (this._buffer.end + 1) % this._framesCount;\r\n if (_bufferRequestStart >= this._framesCount) {\r\n _bufferRequestStart = 0;\r\n }\r\n this._buffer = {\r\n state: 'none',\r\n };\r\n this._prepareBuffer(_bufferRequestStart, _bufferRequestStart + this._framesRequestLength);\r\n if (this._frameRequest !== null) {\r\n const idx = this._frameRequest;\r\n this._frameRequest = null;\r\n this.setFrame(idx);\r\n }\r\n }\r\n }\r\n\r\n parseBinaryData(arrayBuffer) {\r\n const dataView = new DataView(arrayBuffer);\r\n let offset = 0;\r\n const atomsCount = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const framesCount = dataView.getUint32(offset, true);\r\n this._framesCount = framesCount;\r\n this._framesRange.end = this._framesRange.end > 0\r\n ? Math.min(this._framesRange.end, framesCount - 1) : framesCount - 1;\r\n offset += 4;\r\n this._atomsCount = atomsCount;\r\n const maxSize = 1024 * 1024; // 1 MB\r\n this._framesRequestLength = Math.ceil(maxSize / (atomsCount * 8));\r\n const chunkedFramesCount = this._framesRange.end - this._framesRange.start + 1;\r\n if (atomsCount !== this._complex._atoms.length\r\n || arrayBuffer.byteLength !== cDataOffset + chunkedFramesCount * atomsCount * 8) {\r\n throw new Error();\r\n }\r\n const complex = this._complex;\r\n let timeStep = dataView.getUint32(offset, true);\r\n let iName = 0;\r\n while (timeStep > 1000 && iName < cSecNames.length - 1) {\r\n timeStep /= 1000;\r\n ++iName;\r\n }\r\n\r\n this._timeStep = `${timeStep.toString()} ${cSecNames[iName]}`;\r\n offset += 4;\r\n const secondary = [];\r\n const posData = new Float32Array(chunkedFramesCount * atomsCount * 3);\r\n let coordIdx = 0;\r\n const secondaryArr = new Int8Array(atomsCount);\r\n for (let j = 0; j < chunkedFramesCount; ++j) {\r\n for (let i = 0; i < atomsCount; ++i) {\r\n const hiWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const loWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const str = (loWord & cStrMask) >>> cStrShift;\r\n const x = fromUInt20ToInt20(((loWord & cFirstMask) >>> cFirstShift) >> 0);\r\n const y = fromUInt20ToInt20((((loWord & cSecMask1) << cSecShift1)\r\n | ((hiWord & cSecMask2) >>> cSecShift2)) >> 0);\r\n const z = fromUInt20ToInt20((hiWord & cThirdMask) >> 0);\r\n secondaryArr[i] = 0;\r\n if (str > 0 && str < 4) {\r\n secondaryArr[i] = cHelixIdx;\r\n } else if (str === 4) {\r\n secondaryArr[i] = cSheetIdx;\r\n }\r\n posData[coordIdx++] = x / 100;\r\n posData[coordIdx++] = y / 100;\r\n posData[coordIdx++] = z / 100;\r\n }\r\n secondary.push(_createSecondary(secondaryArr, complex));\r\n }\r\n this._secondaryData = secondary;\r\n this._data = posData;\r\n }\r\n\r\n nextFrame() {\r\n this.setFrame((this._currFrame + 1) % this._framesCount);\r\n }\r\n\r\n needsColorUpdate(colorer) {\r\n return colorer instanceof SecondaryStructureColorer;\r\n }\r\n\r\n getAtomColor(colorer, atom) {\r\n return colorer.getResidueColor(this._residues[atom.residue._index], this._complex);\r\n }\r\n\r\n getResidueColor(colorer, residue) {\r\n return colorer.getResidueColor(this._residues[residue._index], this._complex);\r\n }\r\n\r\n _updateSecondary() {\r\n let i;\r\n const myResidues = this._residues;\r\n let n = myResidues.length;\r\n for (i = 0; i < n; ++i) {\r\n myResidues[i]._secondary = null;\r\n }\r\n const sec = this._secondaryData[this._currFrame - this._framesRange.start];\r\n for (i = 0, n = sec.length; i < n; ++i) {\r\n const oldSec = sec[i];\r\n const { start, end } = oldSec;\r\n const nSec = {\r\n _start: myResidues[start],\r\n _end: myResidues[end],\r\n type: oldSec.type,\r\n generic: oldSec.generic,\r\n };\r\n for (let j = start; j <= end; ++j) {\r\n myResidues[j]._secondary = nSec;\r\n }\r\n }\r\n }\r\n\r\n reset() {\r\n const compRes = this._complex._residues;\r\n const n = compRes.length;\r\n this._residues = new Array(n);\r\n const myResidues = this._residues;\r\n const getSec = function () {\r\n return this._secondary;\r\n };\r\n for (let i = 0; i < n; ++i) {\r\n myResidues[i] = {\r\n _type: compRes[i]._type,\r\n _isValid: compRes[i]._isValid,\r\n _controlPoint: null,\r\n _wingVector: null,\r\n _secondary: null,\r\n getSecondary: getSec,\r\n };\r\n }\r\n }\r\n\r\n setFrame(frameIdx) {\r\n this.frameIsReady = false;\r\n if (frameIdx >= this._framesRange.start && frameIdx <= this._framesRange.end) {\r\n this._currFrame = frameIdx;\r\n this._cachedResidues = false;\r\n this._updateSecondary();\r\n this.frameIsReady = true;\r\n } else {\r\n this._frameRequest = frameIdx;\r\n if (!this._buffer) {\r\n this._prepareBuffer(frameIdx);\r\n } else {\r\n const self = this;\r\n switch (this._buffer.state) {\r\n case 'none':\r\n this._prepareBuffer(frameIdx);\r\n break;\r\n case 'ready':\r\n self._parseBuffer();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n disableEvents() {\r\n this._callbacks = null;\r\n }\r\n\r\n /**\r\n * Returns link to atom pos vector, clone it if needed\r\n */\r\n\r\n static _vec = new THREE.Vector3();\r\n\r\n getAtomPos(atomIdx) {\r\n const vec = FrameInfo._vec;\r\n const self = this;\r\n const data = self._data;\r\n const idx = (self._atomsCount * (self._currFrame - self._framesRange.start) + atomIdx) * 3;\r\n vec.set(data[idx], data[idx + 1], data[idx + 2]);\r\n return vec;\r\n }\r\n\r\n getResidues() {\r\n if (this._cachedResidues) {\r\n return this._residues;\r\n }\r\n this._complex.updateToFrame(this);\r\n return this._residues;\r\n }\r\n}\r\nexport default FrameInfo;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\n\r\n/**\r\n * Create new scene object.\r\n *\r\n * @param {array=} params - Object required params.\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports SceneObject\r\n * @this SceneObject\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all scene objects that are not reps.\r\n */\r\nclass SceneObject {\r\n constructor(params, opts) {\r\n if (this.constructor === SceneObject) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Object's options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.params = params;\r\n this.opts = _.merge(utils.deriveDeep(settings.now.objects[this.type], true), opts);\r\n this.needsRebuild = false;\r\n this._mesh = null;\r\n this.id = null;\r\n }\r\n\r\n /**\r\n * Get object identification, probably with options.\r\n * @returns {Object} field type contains type information, params - object's formal parameters,\r\n * opts - changed options\r\n * Options are returned if they were changed during or after object creation.\r\n */\r\n identify() {\r\n const result = {\r\n type: this.type,\r\n params: this.params,\r\n };\r\n const diff = utils.objectsDiff(this.opts, settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n result.opts = diff;\r\n }\r\n return result;\r\n }\r\n\r\n toString() {\r\n const paramsStr = `o=${this.type},${this.params.join(',')}`;\r\n const optsStr = utils.compareOptionsWithDefaults(this.opts, settings.defaults.objects[this.type]);\r\n return paramsStr + optsStr;\r\n }\r\n\r\n getGeometry() {\r\n return this._mesh;\r\n }\r\n\r\n destroy() {\r\n if (this._mesh) {\r\n gfxutils.destroyObject(this._mesh);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Scene object identifier.\r\n * @type {string}\r\n */\r\nSceneObject.prototype.type = '__';\r\n\r\nexport default SceneObject;\r\n","import * as THREE from 'three';\r\nimport SceneObject from './SceneObject';\r\nimport meshutils from '../meshutils';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\nimport meshes from '../meshes/meshes';\r\nimport settings from '../../settings';\r\n\r\nclass LinesObj extends SceneObject {\r\n constructor(params, opts) {\r\n super(params, opts);\r\n if (params.length < 2) {\r\n throw new Error('Wrong number of argumets on line object creation!');\r\n }\r\n [this._id1, this._id2] = params;\r\n }\r\n\r\n _getAtomFromName(complex, atomId) {\r\n const err = ' - Wrong atom format it must be \\'#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME\\' (e.g. \\'A.38.CO1\\')';\r\n const atom1 = complex.getAtomByFullname(atomId);\r\n if (!atom1) {\r\n throw new Error(atomId + err);\r\n }\r\n return atom1;\r\n }\r\n\r\n build(complex) {\r\n const geom = new THREE.BufferGeometry();\r\n this._atom1 = this._getAtomFromName(complex, this._id1);\r\n this._atom2 = this._getAtomFromName(complex, this._id2);\r\n\r\n const p1 = this._atom1.position;\r\n const p2 = this._atom2.position;\r\n const vertices = new Float32Array([\r\n p1.x, p1.y, p1.z,\r\n p2.x, p2.y, p2.z,\r\n ]);\r\n\r\n geom.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\r\n geom.computeBoundingBox();\r\n\r\n this._line = new meshes.Line(geom, new UberMaterial({\r\n lights: false,\r\n overrideColor: true,\r\n dashedLine: true,\r\n fogTransparent: settings.now.bg.transparent,\r\n }));\r\n this._line.computeLineDistances();\r\n this._line.material.setUberOptions({\r\n fixedColor: new THREE.Color(this.opts.color),\r\n dashedLineSize: this.opts.dashSize,\r\n dashedLinePeriod: this.opts.dashSize + this.opts.gapSize,\r\n });\r\n this._line.material.updateUniforms();\r\n\r\n this._line.raycast = function (_raycaster, _intersects) {};\r\n this._mesh = this._line;\r\n const transforms = complex.getTransforms();\r\n if (transforms.length > 0) {\r\n this._mesh = new THREE.Group();\r\n this._mesh.add(this._line);\r\n meshutils.applyTransformsToMeshes(this._mesh, transforms);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n if (!this._atom1 || !this._atom2 || !this._line) {\r\n return;\r\n }\r\n\r\n const geo = this._line.geometry;\r\n geo.vertices[0].copy(frameData.getAtomPos(this._atom1.index));\r\n geo.vertices[1].copy(frameData.getAtomPos(this._atom2.index));\r\n this._line.computeLineDistances();\r\n geo.computeBoundingSphere();\r\n\r\n geo.verticesNeedUpdate = true;\r\n }\r\n}\r\n\r\nLinesObj.prototype.constructor = LinesObj;\r\nLinesObj.prototype.type = 'line';\r\n\r\nexport default LinesObj;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Outline.frag';\r\n\r\nclass OutlineMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n // add depth outline\r\n super(params);\r\n\r\n const settings = {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcDepthTex: { type: 't', value: null },\r\n srcTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n color: { type: 'v3', value: null },\r\n threshold: { type: 'f', value: null },\r\n opacity: { type: 'f', value: 1.0 },\r\n thickness: { type: 'v2', value: new THREE.Vector2(1, 1) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: true,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n\r\n this.setValues(settings);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n const defines = {};\r\n\r\n if (this.depth) {\r\n defines.DEPTH_OUTLINE = 1;\r\n }\r\n\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nOutlineMaterial.prototype.depth = false;\r\n\r\nexport default OutlineMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './FXAA.frag';\r\n\r\nclass FXAAMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n bgColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.bgTransparent) {\r\n defines.BG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nFXAAMaterial.prototype.bgTransparent = false;\r\n\r\nexport default FXAAMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AO.frag';\r\nimport noise from '../noiseTexture';\r\n\r\nconst _samplesKernel = [\r\n // hemisphere samples adopted to sphere\r\n new THREE.Vector3(0.295184, 0.077723, 0.068429),\r\n new THREE.Vector3(-0.271976, -0.365221, 0.838363),\r\n new THREE.Vector3(0.547713, 0.467576, 0.488515),\r\n new THREE.Vector3(0.662808, -0.031733, 0.584758),\r\n new THREE.Vector3(-0.025717, 0.218955, 0.657094),\r\n new THREE.Vector3(-0.310153, -0.365223, 0.370701),\r\n new THREE.Vector3(-0.101407, -0.006313, 0.747665),\r\n new THREE.Vector3(-0.769138, 0.360399, 0.086847),\r\n new THREE.Vector3(-0.271988, -0.275140, 0.905353),\r\n new THREE.Vector3(0.096740, -0.566901, 0.700151),\r\n new THREE.Vector3(0.562872, -0.735136, 0.094647),\r\n new THREE.Vector3(0.379877, 0.359278, 0.190061),\r\n new THREE.Vector3(0.519064, -0.023055, 0.405068),\r\n new THREE.Vector3(-0.301036, 0.114696, 0.088885),\r\n new THREE.Vector3(-0.282922, 0.598305, 0.487214),\r\n new THREE.Vector3(-0.181859, 0.251670, 0.679702),\r\n new THREE.Vector3(-0.191463, -0.635818, 0.512919),\r\n new THREE.Vector3(-0.293655, 0.427423, 0.078921),\r\n new THREE.Vector3(-0.267983, 0.680534, 0.132880),\r\n new THREE.Vector3(0.139611, 0.319637, 0.477439),\r\n new THREE.Vector3(-0.352086, 0.311040, 0.653913),\r\n new THREE.Vector3(0.321032, 0.805279, 0.487345),\r\n new THREE.Vector3(0.073516, 0.820734, 0.414183),\r\n new THREE.Vector3(-0.155324, 0.589983, 0.411460),\r\n new THREE.Vector3(0.335976, 0.170782, 0.527627),\r\n new THREE.Vector3(0.463460, -0.355658, 0.167689),\r\n new THREE.Vector3(0.222654, 0.596550, 0.769406),\r\n new THREE.Vector3(0.922138, -0.042070, 0.147555),\r\n new THREE.Vector3(-0.727050, -0.329192, 0.369826),\r\n new THREE.Vector3(-0.090731, 0.533820, 0.463767),\r\n new THREE.Vector3(-0.323457, -0.876559, 0.238524),\r\n new THREE.Vector3(-0.663277, -0.372384, 0.342856),\r\n];\r\n\r\nclass AOMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n noiseTexture: { type: 't', value: noise.noiseTexture },\r\n noiseTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight) },\r\n diffuseTexture: { type: 't', value: null },\r\n normalTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n camNearFar: { type: 'v2', value: new THREE.Vector2(1.0, 10.0) },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n samplesKernel: { type: 'v3v', value: _samplesKernel },\r\n kernelRadius: { type: 'f', value: 1.0 },\r\n depthThreshold: { type: 'f', value: 1.0 },\r\n factor: { type: 'f', value: 1.0 },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOHorBlur.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOHorBlurMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOHorBlurMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOVertBlurWithBlend.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOVertBlurWithBlendMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n diffuseTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n fogNearFar: { type: 'v2', value: new THREE.Vector2(100.0, 100.0) },\r\n fogColor: { type: 'v4', value: new THREE.Vector4(0.0, 0.5, 0.0, 1.0) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.useFog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nAOVertBlurWithBlendMaterial.prototype.useFog = true;\r\nAOVertBlurWithBlendMaterial.prototype.fogTransparent = false;\r\n\r\nexport default AOVertBlurWithBlendMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Anaglyph.frag';\r\n\r\nclass AnaglyphMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n const settings = {\r\n uniforms: {\r\n srcL: { type: 't', value: null },\r\n srcR: { type: 't', value: null },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n this.setValues(settings);\r\n }\r\n}\r\n\r\nexport default AnaglyphMaterial;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\n\r\nclass View {\r\n constructor() {\r\n this.position = new THREE.Vector3(0, 0, 0);\r\n this.scale = 1;\r\n this.orientation = new THREE.Quaternion(0, 0, 0, 1);\r\n }\r\n\r\n set(position, scale, orientation) {\r\n this.position = position;\r\n this.scale = scale;\r\n this.orientation = orientation;\r\n }\r\n}\r\n\r\nconst _transitionTime = 1.5; // in seconds\r\n\r\nexport default class ViewInterpolator {\r\n setup(startView, endView) {\r\n this._startTime = undefined;\r\n this._endTime = undefined;\r\n this._isPaused = false;\r\n\r\n this._srcView = startView;\r\n this._dstView = endView;\r\n this._isMoving = false;\r\n }\r\n\r\n isMoving() {\r\n return this._isMoving;\r\n }\r\n\r\n wasStarted() {\r\n return typeof this._startTime !== 'undefined' && typeof this._endTime !== 'undefined';\r\n }\r\n\r\n start() {\r\n this._startTime = Date.now();\r\n const transTime = settings.now.interpolateViews ? _transitionTime * 1000 : 0;\r\n this._endTime = this._startTime + transTime;\r\n this._isMoving = true;\r\n }\r\n\r\n getCurrentView() {\r\n if (typeof this._srcView === 'undefined' || typeof this._dstView === 'undefined'\r\n || !this._isMoving || !this.wasStarted()) {\r\n return { success: false };\r\n }\r\n\r\n let view = this.createView();\r\n const time = Date.now();\r\n if (time > this._endTime) {\r\n view = this._dstView;\r\n this.reset();\r\n return { success: true, view };\r\n }\r\n\r\n const factor = (time - this._startTime) / (this._endTime - this._startTime);\r\n view.position.copy(this._srcView.position);\r\n view.position.lerp(this._dstView.position, factor);\r\n view.scale = (1 - factor) * this._srcView.scale + factor * this._dstView.scale;\r\n view.orientation.copy(this._srcView.orientation);\r\n view.orientation.slerp(this._dstView.orientation, factor);\r\n return { success: true, view };\r\n }\r\n\r\n reset() {\r\n this._startTime = this._endTime = 0;\r\n this._isMoving = false;\r\n }\r\n\r\n pause() {\r\n if (!this._isPaused) {\r\n this.setup(this.getCurrentView().view, this._dstView);\r\n this._isPaused = true;\r\n }\r\n }\r\n\r\n resume() {\r\n this._isPaused = false;\r\n }\r\n\r\n createView() {\r\n return new View();\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport makeContextDependent from './makeContextDependent';\r\n\r\nconst MAX_COOKIE_LEN = 4000;\r\nconst COUNT_SUFFIX = 'Cnt';\r\n\r\nfunction _chunkString(string, chunkLen) {\r\n const l = string.length;\r\n const chunks = [];\r\n for (let c = 0, lc = 0; lc < l; c++, lc += chunkLen) {\r\n chunks[c] = string.slice(lc, lc + chunkLen);\r\n }\r\n return chunks;\r\n}\r\n\r\n/**\r\n * Create new context dependent Cookie holder object.\r\n * @param context\r\n * @param {Object} opts - options\r\n * @param {string} opts.path - cookie path\r\n * @constructor\r\n */\r\nfunction Cookies(context, opts) {\r\n this.context = context;\r\n this._opts = _.merge({\r\n path: '/',\r\n }, opts);\r\n}\r\n\r\nmakeContextDependent(Cookies.prototype);\r\n\r\n/**\r\n * Remove cookie by the name.\r\n * @param key\r\n */\r\nCookies.prototype.removeCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n this._removeSimpleCookie(key);\r\n return;\r\n }\r\n this._removeSimpleCookie(cntKey);\r\n cntVal = parseInt(cntVal, 10);\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._removeSimpleCookie(key + i);\r\n }\r\n};\r\n\r\n/**\r\n * Set new cookie value. Automatically splits\r\n * values that are too large into multiple cookies.\r\n * @param key\r\n * @param value\r\n */\r\nCookies.prototype.setCookie = function (key, value) {\r\n this.removeCookie(key);\r\n value = encodeURIComponent(value);\r\n const values = _chunkString(value, MAX_COOKIE_LEN - key.length - 1);\r\n const cntVal = values.length;\r\n if (cntVal === 1) {\r\n this._setSimpleCookie(key, value);\r\n return;\r\n }\r\n const cntKey = this._toCount(key);\r\n this._setSimpleCookie(cntKey, cntVal.toString());\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._setSimpleCookie(key + i, values[i]);\r\n }\r\n};\r\n\r\n/**\r\n * Obtain the value of a compound cookie.\r\n * @param key\r\n */\r\nCookies.prototype.getCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n return this._getSimpleCookie(key);\r\n }\r\n cntVal = parseInt(cntVal, 10);\r\n const value = [];\r\n for (let i = 0; i < cntVal; ++i) {\r\n value[i] = this._getSimpleCookie(key + i);\r\n }\r\n return value.join('');\r\n};\r\n\r\nCookies.prototype._toCount = function (key) {\r\n return key + COUNT_SUFFIX;\r\n};\r\n\r\nCookies.prototype._removeSimpleCookie = function (key) {\r\n document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\r\n};\r\n\r\nCookies.prototype._getExpirationDate = function () {\r\n const today = new Date();\r\n const EXP_PERIOD_YEARS = 10;\r\n today.setFullYear(today.getFullYear() + EXP_PERIOD_YEARS);\r\n return today;\r\n};\r\n\r\nCookies.prototype._setSimpleCookie = function (key, value) {\r\n document.cookie = `${key}=${value\r\n };expires=${this._getExpirationDate().toUTCString()\r\n };path=${this._opts.path}`;\r\n};\r\n\r\nCookies.prototype._getSimpleCookie = function (key) {\r\n const matches = document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n return matches ? decodeURIComponent(matches[1]) : '';\r\n};\r\n\r\nCookies.prototype._exists = function (key) {\r\n return document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n};\r\n\r\nexport default Cookies;\r\n","/*\r\n * Toggling WebVR is done through button.click because of limitations on calling requestPresent in webVR:\r\n * VRDisplay::requestPresent should be called from user gesture:\r\n * https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestPresent\r\n */\r\nexport default function (webVRPoC) {\r\n function showEnterVR(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'pointer';\r\n button.style.left = 'calc(50% - 50px)';\r\n button.style.width = '100px';\r\n\r\n button.textContent = 'ENTER VR';\r\n\r\n let currentSession = null;\r\n\r\n function onSessionEnded(/* event */) {\r\n currentSession.removeEventListener('end', onSessionEnded);\r\n button.textContent = 'ENTER VR';\r\n currentSession = null;\r\n }\r\n\r\n function onSessionStarted(session) {\r\n session.addEventListener('end', onSessionEnded);\r\n webVRPoC._gfx.renderer.xr.setReferenceSpaceType('local');\r\n webVRPoC._gfx.renderer.xr.setSession(session);\r\n button.textContent = 'EXIT VR';\r\n currentSession = session;\r\n }\r\n\r\n button.onmouseenter = function () { button.style.opacity = '1.0'; };\r\n button.onmouseleave = function () { button.style.opacity = '0.5'; };\r\n\r\n button.onclick = function () {\r\n if (currentSession === null) {\r\n // WebXR's requestReferenceSpace only works if the corresponding feature\r\n // was requested at session creation time. For simplicity, just ask for\r\n // the interesting ones as optional features, but be aware that the\r\n // requestReferenceSpace call will fail if it turns out to be unavailable.\r\n // ('local' is always available for immersive sessions and doesn't need to\r\n // be requested separately.)\r\n\r\n const sessionInit = { optionalFeatures: ['local-floor', 'bounded-floor'] };\r\n navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted);\r\n webVRPoC.moveSceneBehindHeadset();\r\n } else {\r\n currentSession.end();\r\n }\r\n };\r\n }\r\n\r\n function showWebXRNotFound(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'auto';\r\n button.style.left = 'calc(50% - 75px)';\r\n button.style.width = '150px';\r\n button.textContent = 'VR NOT FOUND';\r\n button.onmouseenter = null;\r\n button.onmouseleave = null;\r\n button.onclick = null;\r\n }\r\n\r\n function stylizeElement(element) {\r\n element.style.position = 'absolute';\r\n element.style.bottom = '20px';\r\n element.style.padding = '12px 6px';\r\n element.style.border = '1px solid #fff';\r\n element.style.borderRadius = '4px';\r\n element.style.background = 'transparent';\r\n element.style.color = '#fff';\r\n element.style.font = 'normal 13px sans-serif';\r\n element.style.textAlign = 'center';\r\n element.style.opacity = '0.5';\r\n element.style.outline = 'none';\r\n element.style.zIndex = '999';\r\n }\r\n\r\n if ('xr' in navigator) {\r\n const button = document.createElement('button');\r\n button.style.display = 'none';\r\n stylizeElement(button);\r\n navigator.xr.isSessionSupported('immersive-vr').then((supported) => (\r\n supported ? showEnterVR(button) : showWebXRNotFound(button)\r\n ));\r\n return button;\r\n }\r\n const message = document.createElement('a');\r\n message.href = 'https://webvr.info';\r\n message.innerHTML = 'WEBXR NOT SUPPORTED';\r\n message.style.left = 'calc(50% - 90px)';\r\n message.style.width = '180px';\r\n message.style.textDecoration = 'none';\r\n stylizeElement(message);\r\n return message;\r\n}\r\n","import * as THREE from 'three';\r\nimport createWebVRButton from './createWebVRButton';\r\nimport gfxutils from '../gfxutils';\r\nimport logger from '../../utils/logger';\r\nimport settings from '../../settings';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default class WebVRPoC {\r\n constructor(onToggle) {\r\n this._mainCamera = new THREE.PerspectiveCamera();\r\n this._button = null;\r\n this._onToggle = onToggle;\r\n\r\n this._molContainer = new gfxutils.RCGroup();\r\n this._user = new gfxutils.RCGroup();\r\n this._scalingPivot = new THREE.Object3D();\r\n this._user.add(this._scalingPivot);\r\n\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n this._pressedGripsCounter = 0;\r\n this._distance = 0;\r\n\r\n this._gfx = null;\r\n }\r\n\r\n startScalingByControllers() {\r\n // reset scale\r\n this._distance = this._controller1.position.distanceTo(this._controller2.position);\r\n gfxutils.getMiddlePoint(this._controller1.position, this._controller2.position, this._scalingPivot.position);\r\n this._scalingPivot.scale.set(1, 1, 1);\r\n this._scalingPivot.updateMatrix();\r\n this._scalingPivot.updateMatrixWorld();\r\n // link molecule to pivot\r\n this._scalingPivot.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n stopScalingByControllers() {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n handleGripsDown(event) {\r\n this._pressedGripsCounter++;\r\n if (this._pressedGripsCounter === 2) {\r\n this.startScalingByControllers();\r\n } else if (this._pressedGripsCounter === 1) {\r\n event.target.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n handleGripsUp(event) {\r\n this._pressedGripsCounter--;\r\n if (this._pressedGripsCounter === 1) {\r\n this.stopScalingByControllers();\r\n // reattach molecule to other controller\r\n const anotherController = event.target === this._controller1 ? this._controller2 : this._controller1;\r\n anotherController.addSavingWorldTransform(this._molContainer);\r\n } else if (this._pressedGripsCounter === 0) {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n enable(gfx) {\r\n if (!gfx) {\r\n logger.warn('WebVR couldn\\'t be enabled, because gfx is not defined');\r\n return;\r\n }\r\n this._gfx = gfx;\r\n const { renderer, camera } = gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n if (!camera) {\r\n throw new Error('No camera is available to toggle WebVR');\r\n }\r\n\r\n // enable xr in renderer\r\n renderer.xr.enabled = true;\r\n // add button for turning vr mode\r\n if (!this._button) {\r\n this._button = createWebVRButton(this);\r\n document.body.appendChild(this._button);\r\n } else {\r\n this._button.style.display = 'block';\r\n }\r\n // store fog setting\r\n this._mainFog = settings.now.fog;\r\n settings.set('fog', false);\r\n\r\n this._plugVRNodesIntoScene(gfx, renderer);\r\n this._setControllersListeners();\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n _plugVRNodesIntoScene(gfx, renderer) {\r\n // store common scene camera\r\n this._mainCamera.copy(gfx.camera);\r\n // add hierarchical structure for webVR into scene\r\n gfx.scene.add(this._user);\r\n // turn on webvr transformation\r\n gfx.scene.add(this._molContainer);\r\n this._molContainer.add(gfx.root);\r\n\r\n this._controller1 = renderer.xr.getController(0);\r\n this._controller2 = renderer.xr.getController(1);\r\n const mesh = this._createControllerMesh();\r\n this._controller1.add(mesh);\r\n this._controller2.add(mesh.clone());\r\n this._user.add(this._controller1);\r\n this._user.add(this._controller2);\r\n }\r\n\r\n _setControllersListeners() {\r\n this._controller1.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n\r\n this._controller1.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n }\r\n\r\n disable() {\r\n if (!this._gfx) {\r\n return;\r\n }\r\n const { renderer, camera } = this._gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n\r\n // nullify webxr callback for animation frame\r\n renderer.setAnimationLoop(null);\r\n const session = renderer.xr.getSession();\r\n if (session) {\r\n session.end();\r\n }\r\n renderer.xr.enabled = false;\r\n // remove button of VR entering\r\n if (this._button) {\r\n this._button.style.display = 'none';\r\n }\r\n // restore fog param\r\n settings.set('fog', this._mainFog);\r\n\r\n this._unplugVRNodesFromScene(camera);\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(false);\r\n }\r\n }\r\n\r\n _unplugVRNodesFromScene(camera) {\r\n // restore common camera\r\n if (this._mainCamera && camera) {\r\n camera.copy(this._mainCamera);\r\n }\r\n // turn off webvr transformation\r\n const root = this._molContainer.children[0];\r\n if (root) {\r\n this._gfx.scene.add(root);\r\n }\r\n this._molContainer.parent.remove(this._molContainer);\r\n if (this._user) {\r\n this._gfx.scene.remove(this._user);\r\n }\r\n // free scene nodes\r\n this._molContainer = null;\r\n this._user = null;\r\n this._scalingPivot = null;\r\n this._user = null;\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n }\r\n\r\n _createControllerMesh() {\r\n // visualize controllers with cylinders\r\n const geometry = new THREE.CylinderGeometry(0.04, 0.04, 0.3);\r\n const material = new UberMaterial({ lights: false, overrideColor: true });\r\n material.setUberOptions({ fixedColor: new THREE.Color(0x4444ff) });\r\n material.updateUniforms();\r\n const cylinder = new THREE.Mesh(geometry, material);\r\n cylinder.rotateX(-Math.PI / 2);\r\n return cylinder;\r\n }\r\n\r\n updateMoleculeScale() {\r\n if (!this._controller1 || !this._controller2) {\r\n return;\r\n }\r\n\r\n const self = this;\r\n // update molecule scaling by controllers\r\n if (self._pressedGripsCounter === 2) {\r\n // recalc scaling pivot\r\n gfxutils.getMiddlePoint(self._controller1.position, self._controller2.position, self._scalingPivot.position);\r\n // recalc scaler\r\n const dist = self._controller1.position.distanceTo(self._controller2.position);\r\n const scaler = dist / self._distance;\r\n self._scalingPivot.scale.multiplyScalar(scaler);\r\n // save cur distance for next frame\r\n self._distance = dist;\r\n }\r\n }\r\n\r\n /**\r\n * Reposition molecule right before the camera.\r\n * @note The proper way is to initiate headset in the place of common Miew's camera.\r\n * But threejs limitations on setting new XRReferenceSpace enforce the molecule repositioning\r\n * Hope, something will change.\r\n */\r\n moveSceneBehindHeadset() {\r\n const gfx = this._gfx;\r\n const { camera } = gfx;\r\n\r\n // set container position in camera space\r\n const container = this._molContainer;\r\n container.matrix.identity();\r\n container.position.set(0, 0, -4.0);\r\n container.updateMatrix();\r\n\r\n // update container world matrix\r\n container.matrixWorld.multiplyMatrices(camera.matrixWorld, container.matrix);\r\n // readd to scene\r\n gfx.scene.addSavingWorldTransform(container);\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n getCanvas() {\r\n const gfx = this._gfx;\r\n return (gfx && gfx.renderer) ? gfx.renderer.domElement : null;\r\n }\r\n}\r\n","/* global PACKAGE_VERSION:false */\r\nimport _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport { Spinner } from 'spin.js';\r\nimport Stats from './gfx/Stats';\r\nimport utils from './utils';\r\nimport JobHandle from './utils/JobHandle';\r\nimport options from './options';\r\nimport settings from './settings';\r\nimport chem from './chem';\r\nimport Visual from './Visual';\r\nimport ComplexVisual from './ComplexVisual';\r\nimport Complex from './chem/Complex';\r\nimport VolumeVisual from './VolumeVisual';\r\nimport io from './io/io';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport CSS2DRenderer from './gfx/CSS2DRenderer';\r\nimport ObjectControls from './ui/ObjectControls';\r\nimport Picker from './ui/Picker';\r\nimport Axes from './gfx/Axes';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport meshutils from './gfx/meshutils';\r\nimport FrameInfo from './gfx/FrameInfo';\r\nimport meshes from './gfx/meshes/meshes';\r\nimport LinesObject from './gfx/objects/LinesObj';\r\nimport UberMaterial from './gfx/shaders/UberMaterial';\r\nimport OutlineMaterial from './gfx/shaders/OutlineMaterial';\r\nimport FXAAMaterial from './gfx/shaders/FXAAMaterial';\r\nimport AOMaterial from './gfx/shaders/AOMaterial';\r\nimport AOHorBlurMaterial from './gfx/shaders/AOHorBlurMaterial';\r\nimport AOVertBlurWithBlendMaterial from './gfx/shaders/AOVertBlurWithBlendMaterial';\r\nimport AnaglyphMaterial from './gfx/shaders/AnaglyphMaterial';\r\nimport VolumeMaterial from './gfx/shaders/VolumeMaterial';\r\nimport ViewInterpolator from './gfx/ViewInterpolator';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\nimport logger from './utils/logger';\r\nimport Cookies from './utils/Cookies';\r\nimport capabilities from './gfx/capabilities';\r\nimport WebVRPoC from './gfx/vr/WebVRPoC';\r\nimport vertexScreenQuadShader from './gfx/shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromDistTex from './gfx/shaders/ScreenQuadFromDistortionTex.frag';\r\nimport getTopWindow from './utils/getTopWindow';\r\n\r\nconst {\r\n selectors,\r\n Atom,\r\n Residue,\r\n Chain,\r\n Molecule,\r\n} = chem;\r\n\r\nconst EDIT_MODE = { COMPLEX: 0, COMPONENT: 1, FRAGMENT: 2 };\r\n\r\nconst LOADER_NOT_FOUND = 'Could not find suitable loader for this source';\r\nconst PARSER_NOT_FOUND = 'Could not find suitable parser for this source';\r\n\r\n// Color management changed a lot in threejs 152+ version.\r\n// To keep miew colors we disable the new color management system\r\nTHREE.ColorManagement.enabled = false;\r\n\r\nconst { createElement } = utils;\r\n\r\nfunction updateFogRange(fog, center, radius) {\r\n fog.near = center - radius * settings.now.fogNearFactor;\r\n fog.far = center + radius * settings.now.fogFarFactor;\r\n}\r\n\r\nfunction removeExtension(fileName) {\r\n const dot = fileName.lastIndexOf('.');\r\n if (dot >= 0) {\r\n fileName = fileName.substr(0, dot);\r\n }\r\n return fileName;\r\n}\r\n\r\nfunction hasValidResidues(complex) {\r\n let hasValidRes = false;\r\n complex.forEachComponent((component) => {\r\n component.forEachResidue((residue) => {\r\n if (residue._isValid) {\r\n hasValidRes = true;\r\n }\r\n });\r\n });\r\n return hasValidRes;\r\n}\r\n\r\nfunction reportProgress(log, action, percent) {\r\n const TOTAL_PERCENT = 100;\r\n if (percent !== undefined) {\r\n log.debug(`${action}... ${Math.floor(percent * TOTAL_PERCENT)}%`);\r\n } else {\r\n log.debug(`${action}...`);\r\n }\r\n}\r\n\r\nfunction chooseFogColor() {\r\n return settings.now.fogColorEnable ? settings.now.fogColor : settings.now.bg.color;\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\n/**\r\n * Main 3D Molecular Viewer class.\r\n *\r\n * @param {object} opts - Viewer options.\r\n * @param {HTMLElement=} opts.container - DOM element that serves as a viewer container.\r\n * @param {object=} opts.settings - An object with properties to override default settings.\r\n * @param {string=} opts.settingsCookie='settings' - The name of the cookie to save current settings to.\r\n * @param {string=} opts.cookiePath='/' - The path option for cookies. Defaults to root.\r\n *\r\n * @exports Miew\r\n * @constructor\r\n */\r\nfunction Miew(opts) {\r\n EventDispatcher.call(this);\r\n this._opts = _.merge({\r\n settingsCookie: 'settings',\r\n cookiePath: '/',\r\n }, opts);\r\n /** @type {?object} */\r\n this._gfx = null;\r\n /** @type {ViewInterpolator} */\r\n this._interpolator = new ViewInterpolator();\r\n /** @type {HTMLElement} */\r\n this._container = (opts && opts.container)\r\n || document.getElementById('miew-container')\r\n || _.head(document.getElementsByClassName('miew-container'))\r\n || document.body;\r\n /** @type {HTMLElement} */\r\n this._containerRoot = this._container;\r\n\r\n /** @type {boolean} */\r\n this._running = false;\r\n /** @type {boolean} */\r\n this._halting = false;\r\n /** @type {boolean} */\r\n this._building = false;\r\n /** @type {boolean} */\r\n this._needRender = true;\r\n /** @type {boolean} */\r\n this._hotKeysEnabled = true;\r\n\r\n /** @type {Settings} */\r\n this.settings = settings;\r\n const log = logger;\r\n log.console = DEBUG;\r\n log.level = DEBUG ? 'debug' : 'info';\r\n /**\r\n * @type {Logger}\r\n * @example\r\n * miew.logger.addEventListener('message', function _onLogMessage(evt) {\r\n * console.log(evt.message);\r\n * });\r\n */\r\n this.logger = log;\r\n\r\n this._cookies = new Cookies(this);\r\n this.restoreSettings();\r\n if (opts && opts.settings) {\r\n this.settings.set(opts.settings);\r\n }\r\n\r\n /** @type {?Spinner} */\r\n this._spinner = null;\r\n /** @type {JobHandle[]} */\r\n this._loading = [];\r\n /** @type {?number}\r\n * @deprecated until Animation system refactoring\r\n */\r\n this._animInterval = null;\r\n\r\n /** @type {object} */\r\n this._visuals = {};\r\n /** @type {?string} */\r\n this._curVisualName = null;\r\n\r\n /** @type {array} */\r\n this._objects = [];\r\n\r\n /** @type {object} */\r\n this._sourceWindow = null;\r\n\r\n this.reset();\r\n\r\n if (this._repr) {\r\n log.debug(`Selected ${this._repr.mode.name} mode with ${this._repr.colorer.name} colorer.`);\r\n }\r\n\r\n const self = this;\r\n Miew.registeredPlugins.forEach((plugin) => {\r\n plugin.call(self);\r\n });\r\n\r\n this._initOnSettingsChanged();\r\n}\r\n\r\nMiew.prototype = Object.create(EventDispatcher.prototype);\r\nMiew.prototype.constructor = Miew;\r\n\r\nMiew.prototype.getMaxRepresentationCount = function () {\r\n return ComplexVisual.NUM_REPRESENTATION_BITS;\r\n};\r\n\r\n/**\r\n * Replace viewer container contents with a DOM element.\r\n * @param {HTMLElement} container - parent container.\r\n * @param {HTMLElement} element - DOM element to show.\r\n * @private\r\n */\r\nfunction _setContainerContents(container, element) {\r\n const parent = container;\r\n while (parent.firstChild) {\r\n parent.removeChild(parent.firstChild);\r\n }\r\n parent.appendChild(element);\r\n}\r\n\r\n/**\r\n * Update Shadow Camera target position and frustum.\r\n * @private\r\n */\r\nMiew.prototype._updateShadowCamera = (function () {\r\n const shadowMatrix = new THREE.Matrix4();\r\n const direction = new THREE.Vector3();\r\n const OBB = { center: new THREE.Vector3(), halfSize: new THREE.Vector3() };\r\n\r\n return function () {\r\n this._gfx.scene.updateMatrixWorld();\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = this._gfx.scene.children[i];\r\n shadowMatrix.copy(light.shadow.camera.matrixWorldInverse);\r\n this.getOBB(shadowMatrix, OBB);\r\n\r\n direction.subVectors(light.target.position, light.position);\r\n light.position.subVectors(OBB.center, direction);\r\n light.target.position.copy(OBB.center);\r\n\r\n light.shadow.bias = 0.09;\r\n light.shadow.camera.bottom = -OBB.halfSize.y;\r\n light.shadow.camera.top = OBB.halfSize.y;\r\n light.shadow.camera.right = OBB.halfSize.x;\r\n light.shadow.camera.left = -OBB.halfSize.x;\r\n light.shadow.camera.near = direction.length() - OBB.halfSize.z;\r\n light.shadow.camera.far = direction.length() + OBB.halfSize.z;\r\n\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Initialize the viewer.\r\n * @returns {boolean} true on success.\r\n * @throws Forwards exception raised during initialization.\r\n * @see Miew#term\r\n */\r\nMiew.prototype.init = function () {\r\n const container = this._container;\r\n const elem = utils.createElement('div', { class: 'miew-canvas' });\r\n _setContainerContents(container, elem);\r\n this._container = elem;\r\n\r\n const frag = document.createDocumentFragment();\r\n frag.appendChild(this._msgMode = createElement(\r\n 'div',\r\n { class: 'mode-message overlay' },\r\n createElement('p', {}, 'COMPONENT EDIT MODE'),\r\n ));\r\n frag.appendChild(this._msgAtomInfo = createElement(\r\n 'div',\r\n { class: 'atom-info overlay' },\r\n createElement('p', {}, ''),\r\n ));\r\n container.appendChild(frag);\r\n\r\n if (this._gfx !== null) { // block double init\r\n return true;\r\n }\r\n\r\n const self = this;\r\n this._showMessage('Viewer is being initialized...');\r\n try {\r\n this._initGfx();\r\n\r\n this._initListeners();\r\n this._spinner = new Spinner({\r\n lines: 13,\r\n length: 28,\r\n width: 14,\r\n radius: 42,\r\n color: '#fff',\r\n zIndex: 700,\r\n });\r\n\r\n const target = getTopWindow();\r\n target.addEventListener('keydown', (event) => {\r\n self._onKeyDown(event);\r\n });\r\n\r\n target.addEventListener('keyup', (event) => {\r\n self._onKeyUp(event);\r\n });\r\n\r\n this._objectControls = new ObjectControls(\r\n this._gfx.root,\r\n this._gfx.pivot,\r\n this._gfx.camera,\r\n this._gfx.renderer.domElement,\r\n () => self._getAltObj(),\r\n );\r\n this._objectControls.addEventListener('change', (e) => {\r\n if (settings.now.shadow.on) {\r\n self._updateShadowCamera();\r\n }\r\n // route rotate, zoom, translate and translatePivot events to the external API\r\n switch (e.action) {\r\n case 'rotate':\r\n self.dispatchEvent({ type: 'rotate', quaternion: e.quaternion });\r\n break;\r\n case 'zoom':\r\n self.dispatchEvent({ type: 'zoom', factor: e.factor });\r\n break;\r\n default:\r\n self.dispatchEvent({ type: e.action });\r\n }\r\n self.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n });\r\n\r\n const gfx = this._gfx;\r\n this._picker = new Picker(gfx.root, gfx.camera, gfx.renderer.domElement);\r\n this._picker.addEventListener('newpick', (event) => {\r\n self._onPick(event);\r\n });\r\n this._picker.addEventListener('dblclick', (event) => {\r\n self.center(event);\r\n });\r\n } catch (error) {\r\n if (error.name === 'TypeError' && error.message === 'Cannot read property \\'getExtension\\' of null') {\r\n this._showMessage('Could not create WebGL context.');\r\n } else if (error.message.search(/webgl/i) > 1) {\r\n this._showMessage(error.message);\r\n } else {\r\n this._showMessage('Viewer initialization failed.');\r\n throw error;\r\n }\r\n return false;\r\n }\r\n\r\n // automatically load default file\r\n const file = this._opts && this._opts.load;\r\n if (file) {\r\n const type = this._opts && this._opts.type;\r\n this.load(file, { fileType: type, keepRepsInfo: true });\r\n }\r\n\r\n return true;\r\n};\r\n\r\n/**\r\n * Terminate the viewer completely.\r\n * @see Miew#init\r\n */\r\nMiew.prototype.term = function () {\r\n this._showMessage('Viewer has been terminated.');\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n this.halt();\r\n this._gfx = null;\r\n};\r\n\r\n/**\r\n * Display message inside the viewer container, hiding WebGL canvas.\r\n * @param {string} msg - Message to show.\r\n * @private\r\n */\r\nMiew.prototype._showMessage = function (msg) {\r\n const element = document.createElement('div');\r\n element.setAttribute('class', 'miew-message');\r\n element.appendChild(document.createElement('p')).appendChild(document.createTextNode(msg));\r\n _setContainerContents(this._container, element);\r\n};\r\n\r\n/**\r\n * Display WebGL canvas inside the viewer container, hiding any message shown.\r\n * @private\r\n */\r\nMiew.prototype._showCanvas = function () {\r\n _setContainerContents(this._container, this._gfx.renderer.domElement);\r\n};\r\n\r\nMiew.prototype._requestAnimationFrame = function (callback) {\r\n const { xr } = this._gfx.renderer;\r\n if (xr && xr.enabled) {\r\n this._gfx.renderer.setAnimationLoop(callback);\r\n return;\r\n }\r\n requestAnimationFrame(callback);\r\n};\r\n\r\nfunction arezSpritesSupported(context) {\r\n return context.getExtension('EXT_frag_depth');\r\n}\r\n\r\nfunction isAOSupported(context) {\r\n return (context.getExtension('WEBGL_depth_texture')\r\n && context.getExtension('WEBGL_draw_buffers'));\r\n}\r\n\r\n/**\r\n * Initialize WebGL and set 3D scene up.\r\n * @private\r\n */\r\nMiew.prototype._initGfx = function () {\r\n const gfx = {\r\n width: this._container.clientWidth,\r\n height: this._container.clientHeight,\r\n };\r\n\r\n const webGLOptions = { preserveDrawingBuffer: true, alpha: true, premultipliedAlpha: false };\r\n if (settings.now.antialias) {\r\n webGLOptions.antialias = true;\r\n }\r\n\r\n gfx.renderer2d = new CSS2DRenderer();\r\n\r\n gfx.renderer = new THREE.WebGL1Renderer(webGLOptions);\r\n gfx.renderer.shadowMap.enabled = settings.now.shadow.on;\r\n gfx.renderer.shadowMap.autoUpdate = false;\r\n gfx.renderer.shadowMap.type = THREE.PCFShadowMap;\r\n capabilities.init(gfx.renderer);\r\n\r\n // z-sprites and ambient occlusion possibility\r\n if (!arezSpritesSupported(gfx.renderer.getContext())) {\r\n settings.set('zSprites', false);\r\n }\r\n if (!isAOSupported(gfx.renderer.getContext())) {\r\n settings.set('ao', false);\r\n }\r\n\r\n gfx.renderer.autoClear = false;\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n gfx.camera = new THREE.PerspectiveCamera(\r\n settings.now.camFov,\r\n gfx.width / gfx.height,\r\n settings.now.camNear,\r\n settings.now.camFar,\r\n );\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.position.z = settings.now.camDistance;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n\r\n gfx.stereoCam = new THREE.StereoCamera();\r\n\r\n gfx.scene = new THREE.Scene();\r\n\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color, settings.now.camNear, settings.now.camFar);\r\n\r\n gfx.root = new gfxutils.RCGroup();\r\n gfx.scene.add(gfx.root);\r\n\r\n gfx.pivot = new gfxutils.RCGroup();\r\n gfx.root.add(gfx.pivot);\r\n\r\n gfx.selectionScene = new THREE.Scene();\r\n gfx.selectionRoot = new THREE.Group();\r\n gfx.selectionRoot.matrixAutoUpdate = false;\r\n gfx.selectionScene.add(gfx.selectionRoot);\r\n\r\n gfx.selectionPivot = new THREE.Group();\r\n gfx.selectionPivot.matrixAutoUpdate = false;\r\n gfx.selectionRoot.add(gfx.selectionPivot);\r\n\r\n const light12 = new THREE.DirectionalLight(0xffffff, 0.45);\r\n light12.position.set(0, 0.414, 1);\r\n light12.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n light12.castShadow = true;\r\n light12.shadow.bias = 0.09;\r\n light12.shadow.radius = settings.now.shadow.radius;\r\n light12.shadow.camera.layers.set(gfxutils.LAYERS.SHADOWMAP);\r\n\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n const shadowMapSize = Math.max(gfx.width, gfx.height) * pixelRatio;\r\n light12.shadow.mapSize.width = shadowMapSize;\r\n light12.shadow.mapSize.height = shadowMapSize;\r\n light12.target.position.set(0.0, 0.0, 0.0);\r\n gfx.scene.add(light12);\r\n gfx.scene.add(light12.target);\r\n\r\n const light3 = new THREE.AmbientLight(0x666666);\r\n light3.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.scene.add(light3);\r\n\r\n // add axes\r\n gfx.axes = new Axes(gfx.root, gfx.camera);\r\n const deviceWidth = gfx.width * pixelRatio;\r\n const deviceHeight = gfx.height * pixelRatio;\r\n\r\n gfx.offscreenBuf = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat, depthBuffer: true,\r\n },\r\n );\r\n\r\n if (gfx.renderer.getContext().getExtension('WEBGL_depth_texture')) {\r\n gfx.offscreenBuf.depthTexture = new THREE.DepthTexture();\r\n gfx.offscreenBuf.depthTexture.type = THREE.UnsignedShortType;\r\n }\r\n\r\n gfx.offscreenBuf2 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf3 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf4 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf3;\r\n gfx.volFFTex = gfx.offscreenBuf4;\r\n gfx.volWFFTex = gfx.offscreenBuf;\r\n\r\n // use float textures for volume rendering if possible\r\n if (gfx.renderer.getContext().getExtension('OES_texture_float')) {\r\n gfx.offscreenBuf5 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf6 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf7 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: true,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf5;\r\n gfx.volFFTex = gfx.offscreenBuf6;\r\n gfx.volWFFTex = gfx.offscreenBuf7;\r\n } else {\r\n this.logger.warn('Device doesn\\'t support OES_texture_float extension');\r\n }\r\n\r\n gfx.stereoBufL = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.stereoBufR = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n this._gfx = gfx;\r\n this._showCanvas();\r\n\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n\r\n this._container.appendChild(gfx.renderer2d.getElement());\r\n\r\n // add FPS counter\r\n const stats = new Stats();\r\n stats.domElement.style.position = 'absolute';\r\n stats.domElement.style.right = '0';\r\n stats.domElement.style.bottom = '0';\r\n this._container.appendChild(stats.domElement);\r\n this._fps = stats;\r\n this._fps.show(settings.now.fps);\r\n};\r\n\r\n/**\r\n * Setup event listeners.\r\n * @private\r\n */\r\nMiew.prototype._initListeners = function () {\r\n const self = this;\r\n window.addEventListener('resize', () => {\r\n self._onResize();\r\n });\r\n};\r\n\r\n/**\r\n * Try to add numbers to the base name to make it unique among visuals\r\n * @private\r\n */\r\nMiew.prototype._makeUniqueVisualName = function (baseName) {\r\n if (!baseName) {\r\n return Math.random().toString();\r\n }\r\n\r\n let name = baseName;\r\n let suffix = 1;\r\n while (this._visuals.hasOwnProperty(name)) {\r\n name = `${baseName} (${suffix.toString()})`;\r\n suffix++;\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Add visual to the viewer\r\n * @private\r\n */\r\nMiew.prototype._addVisual = function (visual) {\r\n if (!visual) {\r\n return null;\r\n }\r\n\r\n // change visual name in order to make it unique\r\n const name = this._makeUniqueVisualName(visual.name);\r\n visual.name = name;\r\n\r\n this._visuals[name] = visual;\r\n this._gfx.pivot.add(visual);\r\n if (visual.getSelectionGeo) {\r\n this._gfx.selectionPivot.add(visual.getSelectionGeo());\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Remove visual from the viewer\r\n * @private\r\n */\r\nMiew.prototype._removeVisual = function (visual) {\r\n let name = '';\r\n let obj = null;\r\n if (visual instanceof Visual) {\r\n ({ name } = visual);\r\n obj = visual;\r\n } else if (typeof visual === 'string') {\r\n name = visual;\r\n obj = this._visuals[name];\r\n }\r\n\r\n if (!obj || !this._visuals.hasOwnProperty(name) || this._visuals[name] !== obj) {\r\n return;\r\n }\r\n\r\n if (name === this._curVisualName) {\r\n this._curVisualName = undefined;\r\n }\r\n\r\n delete this._visuals[name];\r\n obj.release(); // removes nodes from scene\r\n\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Call specified function for each Visual\r\n * @private\r\n */\r\nMiew.prototype._forEachVisual = function (callback) {\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Release (destroy) all visuals in the scene\r\n * @private\r\n */\r\nMiew.prototype._releaseAllVisuals = function () {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n this._visuals[name].release();\r\n }\r\n }\r\n\r\n this._visuals = {};\r\n};\r\n\r\n/**\r\n * Call specified function for each ComplexVisual\r\n * @private\r\n */\r\nMiew.prototype._forEachComplexVisual = function (callback) {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)\r\n && this._visuals[name] instanceof ComplexVisual) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual with specified name, or current (if not found), or any, or null\r\n * @private\r\n */\r\nMiew.prototype._getComplexVisual = function (name) {\r\n name = name || this._curVisualName;\r\n let any = null;\r\n let named = null;\r\n this._forEachComplexVisual((visual) => {\r\n any = visual;\r\n if (visual.name === name) {\r\n named = visual;\r\n }\r\n });\r\n return named || any;\r\n};\r\n\r\n/**\r\n * Returns first found VolumeVisual (no more than one should be present actually)\r\n * @private\r\n */\r\nMiew.prototype._getVolumeVisual = function () {\r\n let any = null;\r\n this._forEachVisual((visual) => {\r\n if (visual instanceof VolumeVisual) {\r\n any = visual;\r\n }\r\n });\r\n return any;\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual corresponding to specified complex\r\n * @private\r\n */\r\nMiew.prototype._getVisualForComplex = function (complex) {\r\n if (!complex) {\r\n return null;\r\n }\r\n\r\n let found = null;\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getComplex() === complex) {\r\n found = visual;\r\n }\r\n });\r\n return found;\r\n};\r\n\r\n/*\r\n * Get a list of names of visuals currently shown by the viewer\r\n */\r\nMiew.prototype.getVisuals = function () {\r\n return Object.keys(this._visuals);\r\n};\r\n\r\n/*\r\n * Get complex visuals count\r\n */\r\nMiew.prototype.getComplexVisualsCount = function () {\r\n let count = 0;\r\n this._forEachComplexVisual(() => count++);\r\n return count;\r\n};\r\n\r\n/*\r\n * Get current visual\r\n */\r\nMiew.prototype.getCurrentVisual = function () {\r\n return this._curVisualName;\r\n};\r\n\r\n/*\r\n * Set current visual.\r\n * All further operations will be performed on this visual (complex) if not stated otherwise.\r\n */\r\nMiew.prototype.setCurrentVisual = function (name) {\r\n if (!this._visuals[name]) {\r\n return;\r\n }\r\n\r\n this._curVisualName = name;\r\n};\r\n\r\n/**\r\n * Run the viewer, start processing update/render frames periodically.\r\n * Has no effect if already running.\r\n * @see Miew#halt\r\n */\r\nMiew.prototype.run = function () {\r\n if (!this._running) {\r\n this._running = true;\r\n if (this._halting) {\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._objectControls.enable(true);\r\n this._interpolator.resume();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to stop.\r\n * Will be processed during the next frame.\r\n * @see Miew#run\r\n */\r\nMiew.prototype.halt = function () {\r\n if (this._running) {\r\n this._discardComponentEdit();\r\n this._discardFragmentEdit();\r\n this._objectControls.enable(false);\r\n this._interpolator.pause();\r\n this._halting = true;\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to start / stop responsing\r\n * on hot keys.\r\n * @param enabled - start (true) or stop (false) response on hot keys.\r\n */\r\nMiew.prototype.enableHotKeys = function (enabled) {\r\n this._hotKeysEnabled = enabled;\r\n this._objectControls.enableHotkeys(enabled);\r\n};\r\n\r\n/**\r\n * Callback which processes window resize.\r\n * @private\r\n */\r\nMiew.prototype._onResize = function () {\r\n const gfx = this._gfx;\r\n if (!gfx) {\r\n return;\r\n }\r\n\r\n this._needRender = true;\r\n\r\n gfx.width = this._container.clientWidth;\r\n gfx.height = this._container.clientHeight;\r\n\r\n gfx.camera.aspect = gfx.width / gfx.height;\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n this.dispatchEvent({ type: 'resize' });\r\n};\r\n\r\nMiew.prototype._resizeOffscreenBuffers = function (width, height, stereo) {\r\n const gfx = this._gfx;\r\n stereo = stereo || 'NONE';\r\n const isAnaglyph = (stereo === 'NONE' || stereo === 'ANAGLYPH');\r\n const multi = isAnaglyph ? 1 : 0.5;\r\n gfx.offscreenBuf.setSize(multi * width, height);\r\n gfx.offscreenBuf2.setSize(multi * width, height);\r\n gfx.offscreenBuf3.setSize(multi * width, height);\r\n gfx.offscreenBuf4.setSize(multi * width, height);\r\n if (gfx.offscreenBuf5) {\r\n gfx.offscreenBuf5.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf6) {\r\n gfx.offscreenBuf6.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf7) {\r\n gfx.offscreenBuf7.setSize(multi * width, height);\r\n }\r\n if (isAnaglyph) {\r\n gfx.stereoBufL.setSize(width, height);\r\n gfx.stereoBufR.setSize(width, height);\r\n }\r\n};\r\n\r\n/**\r\n * Callback which processes update/render frames.\r\n * @private\r\n */\r\nMiew.prototype._onTick = function () {\r\n if (this._halting) {\r\n this._running = false;\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._fps.update();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n\r\n this._onUpdate();\r\n if (this._needRender) {\r\n this._onRender();\r\n this._needRender = !settings.now.suspendRender || settings.now.stereo === 'WEBVR';\r\n }\r\n};\r\n\r\nMiew.prototype._getBSphereRadius = function () {\r\n // calculate radius that would include all visuals\r\n let radius = 0;\r\n this._forEachVisual((visual) => {\r\n radius = Math.max(radius, visual.getBoundaries().boundingSphere.radius);\r\n });\r\n return radius * this._objectControls.getScale();\r\n};\r\n\r\n/**\r\n * Calculate bounding box that would include all visuals and being axis aligned in world defined by\r\n * transformation matrix: matrix\r\n * @param {Matrix4} matrix - transformation matrix.\r\n * @param {object} OBB - calculating bounding box.\r\n * @param {Vector3} OBB.center - OBB center.\r\n * @param {Vector3} OBB.halfSize - half magnitude of OBB sizes.\r\n */\r\nMiew.prototype.getOBB = (function () {\r\n const _bSphereForOneVisual = new THREE.Sphere();\r\n const _bBoxForOneVisual = new THREE.Box3();\r\n const _bBox = new THREE.Box3();\r\n\r\n const _invMatrix = new THREE.Matrix4();\r\n\r\n const _points = [\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n ];\r\n\r\n return function (matrix, OBB) {\r\n _bBox.makeEmpty();\r\n\r\n this._forEachVisual((visual) => {\r\n _bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere);\r\n _bSphereForOneVisual.applyMatrix4(visual.matrixWorld).applyMatrix4(matrix);\r\n _bSphereForOneVisual.getBoundingBox(_bBoxForOneVisual);\r\n _bBox.union(_bBoxForOneVisual);\r\n });\r\n _bBox.getCenter(OBB.center);\r\n\r\n _invMatrix.copy(matrix).invert();\r\n OBB.center.applyMatrix4(_invMatrix);\r\n\r\n const { min } = _bBox;\r\n const { max } = _bBox;\r\n _points[0].set(min.x, min.y, min.z); // 000\r\n _points[1].set(max.x, min.y, min.z); // 100\r\n _points[2].set(min.x, max.y, min.z); // 010\r\n _points[3].set(min.x, min.y, max.z); // 001\r\n for (let i = 0, l = _points.length; i < l; i++) {\r\n _points[i].applyMatrix4(_invMatrix);\r\n }\r\n\r\n OBB.halfSize.set(\r\n Math.abs(_points[0].x - _points[1].x),\r\n Math.abs(_points[0].y - _points[2].y),\r\n Math.abs(_points[0].z - _points[3].z),\r\n ).multiplyScalar(0.5);\r\n };\r\n}());\r\n\r\nMiew.prototype._updateFog = function () {\r\n const gfx = this._gfx;\r\n\r\n if (settings.now.fog) {\r\n if (typeof gfx.scene.fog === 'undefined' || gfx.scene.fog === null) {\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color);\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n updateFogRange(gfx.scene.fog, gfx.camera.position.z, this._getBSphereRadius());\r\n } else if (gfx.scene.fog) {\r\n gfx.scene.fog = undefined;\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n};\r\n\r\nMiew.prototype._onUpdate = function () {\r\n if (this.isScriptingCommandAvailable !== undefined && this.isScriptingCommandAvailable() && !this._building) {\r\n this.callNextCmd();\r\n }\r\n\r\n this._objectControls.update();\r\n\r\n this._forEachComplexVisual((visual) => {\r\n visual.getComplex().update();\r\n });\r\n\r\n if (settings.now.autobuild && !this._loading.length && !this._building && this._needRebuild()) {\r\n this.rebuild();\r\n }\r\n\r\n if (!this._loading.length && !this._building && !this._needRebuild()) {\r\n this._updateView();\r\n }\r\n\r\n this._updateFog();\r\n\r\n if (this._gfx.renderer.xr.enabled) {\r\n this.webVR.updateMoleculeScale();\r\n }\r\n};\r\n\r\nMiew.prototype._onRender = function () {\r\n const gfx = this._gfx;\r\n\r\n // update all matrices\r\n gfx.scene.updateMatrixWorld();\r\n gfx.camera.updateMatrixWorld();\r\n\r\n this._clipPlaneUpdateValue(this._getBSphereRadius());\r\n this._fogFarUpdateValue();\r\n\r\n gfx.renderer.setRenderTarget(null);\r\n gfx.renderer.clear();\r\n\r\n this._renderFrame(settings.now.stereo);\r\n};\r\n\r\nMiew.prototype._renderFrame = (function () {\r\n const _anaglyphMat = new AnaglyphMaterial();\r\n const _size = new THREE.Vector2();\r\n\r\n return function (stereo) {\r\n const gfx = this._gfx;\r\n const { renderer } = gfx;\r\n\r\n renderer.getSize(_size);\r\n\r\n if (stereo !== 'NONE') {\r\n gfx.camera.focus = gfx.camera.position.z; // set focus to the center of the object\r\n gfx.stereoCam.aspect = 1.0;\r\n\r\n // in anaglyph mode we render full-size image for each eye\r\n // while in other stereo modes only half-size (two images on the screen)\r\n if (stereo === 'ANAGLYPH') {\r\n gfx.stereoCam.update(gfx.camera);\r\n } else {\r\n gfx.stereoCam.updateHalfSized(gfx.camera, settings.now.camFov);\r\n }\r\n }\r\n\r\n // resize offscreen buffers to match the target\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n this._resizeOffscreenBuffers(_size.width * pixelRatio, _size.height * pixelRatio, stereo);\r\n\r\n this._renderShadowMap();\r\n\r\n switch (stereo) {\r\n case 'WEBVR':\r\n case 'NONE':\r\n this._renderScene(gfx.camera, false);\r\n break;\r\n case 'SIMPLE':\r\n case 'DISTORTED':\r\n renderer.setScissorTest(true);\r\n\r\n renderer.setScissor(0, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(0, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraL, stereo === 'DISTORTED');\r\n\r\n renderer.setScissor(_size.width / 2, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(_size.width / 2, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraR, stereo === 'DISTORTED');\r\n\r\n renderer.setScissorTest(false);\r\n break;\r\n case 'ANAGLYPH':\r\n this._renderScene(this._gfx.stereoCam.cameraL, false, gfx.stereoBufL);\r\n this._renderScene(this._gfx.stereoCam.cameraR, false, gfx.stereoBufR);\r\n renderer.setRenderTarget(null);\r\n _anaglyphMat.uniforms.srcL.value = gfx.stereoBufL.texture;\r\n _anaglyphMat.uniforms.srcR.value = gfx.stereoBufR.texture;\r\n gfx.renderer.renderScreenQuad(_anaglyphMat);\r\n break;\r\n default:\r\n }\r\n\r\n gfx.renderer2d.render(gfx.scene, gfx.camera);\r\n\r\n if (settings.now.axes && gfx.axes && !gfx.renderer.xr.enabled) {\r\n gfx.axes.render(renderer);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._onBgColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx) {\r\n if (gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onFogColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx && gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._setUberMaterialValues = function (values) {\r\n this._gfx.root.traverse((obj) => {\r\n if ((obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line)\r\n && obj.material instanceof UberMaterial) {\r\n obj.material.setValues(values);\r\n obj.material.needsUpdate = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._enableMRT = function (on, renderBuffer, textureBuffer) {\r\n const gfx = this._gfx;\r\n const gl = gfx.renderer.getContext();\r\n const ext = gl.getExtension('WEBGL_draw_buffers');\r\n const { properties } = gfx.renderer;\r\n\r\n if (!on) {\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, null]);\r\n return;\r\n }\r\n\r\n // take extra texture from Texture Buffer\r\n gfx.renderer.setRenderTarget(textureBuffer);\r\n const tx8 = properties.get(textureBuffer.texture).__webglTexture;\r\n gl.bindTexture(gl.TEXTURE_2D, tx8);\r\n\r\n // take texture and framebuffer from renderbuffer\r\n gfx.renderer.setRenderTarget(renderBuffer);\r\n const fb = properties.get(renderBuffer).__webglFramebuffer;\r\n const tx = properties.get(renderBuffer.texture).__webglTexture;\r\n\r\n // set framebuffer\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n fb.width = renderBuffer.width;\r\n fb.height = renderBuffer.height;\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tx, 0);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, ext.COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, tx8, 0);\r\n\r\n // mapping textures\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, ext.COLOR_ATTACHMENT1_WEBGL]);\r\n};\r\n\r\nMiew.prototype._renderScene = (function () {\r\n return function (camera, distortion, target) {\r\n distortion = distortion || false;\r\n target = target || null;\r\n\r\n const gfx = this._gfx;\r\n\r\n // render to offscreen buffer\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.clear();\r\n if (gfx.renderer.xr.enabled) {\r\n gfx.renderer.render(gfx.scene, camera);\r\n return;\r\n }\r\n\r\n // clean buffer for normals texture\r\n gfx.renderer.setClearColor(0x000000, 0.0);\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf4);\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.clear();\r\n\r\n const bHaveComplexes = (this._getComplexVisual() !== null);\r\n const volumeVisual = this._getVolumeVisual();\r\n const ssao = bHaveComplexes && settings.now.ao;\r\n\r\n if (ssao) {\r\n this._enableMRT(true, gfx.offscreenBuf, gfx.offscreenBuf4);\r\n }\r\n\r\n if (settings.now.transparency === 'prepass') {\r\n this._renderWithPrepassTransparency(camera, gfx.offscreenBuf);\r\n } else if (settings.now.transparency === 'standard') {\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n }\r\n\r\n if (ssao) {\r\n this._enableMRT(false, null, null);\r\n }\r\n\r\n // when fxaa we should get resulting image in temp off-screen buff2 for further postprocessing with fxaa filter\r\n // otherwise we render to canvas\r\n const outline = bHaveComplexes && settings.now.outline.on;\r\n const fxaa = bHaveComplexes && settings.now.fxaa;\r\n const volume = (volumeVisual !== null) && (volumeVisual.getMesh().material != null);\r\n let dstBuffer = (ssao || outline || volume || fxaa || distortion) ? gfx.offscreenBuf2 : target;\r\n let srcBuffer = gfx.offscreenBuf;\r\n\r\n if (ssao) {\r\n this._performAO(\r\n srcBuffer,\r\n gfx.offscreenBuf4,\r\n gfx.offscreenBuf.depthTexture,\r\n dstBuffer,\r\n gfx.offscreenBuf3,\r\n gfx.offscreenBuf2,\r\n );\r\n if (!fxaa && !distortion && !volume && !outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = target;\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n } else {\r\n // just copy color buffer to dst buffer\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n\r\n // outline\r\n if (outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = (volume || fxaa || distortion) ? gfx.offscreenBuf3 : target;\r\n if (srcBuffer != null) {\r\n this._renderOutline(camera, gfx.offscreenBuf, srcBuffer, dstBuffer);\r\n }\r\n }\r\n\r\n // render selected part with outline material\r\n this._renderSelection(camera, gfx.offscreenBuf, dstBuffer);\r\n\r\n if (volume) {\r\n // copy current picture to the buffer that retains depth-data of the original molecule render\r\n // so that volume renderer could use depth-test\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n dstBuffer = gfx.offscreenBuf;\r\n this._renderVolume(volumeVisual, camera, dstBuffer, gfx.volBFTex, gfx.volFFTex, gfx.volWFFTex);\r\n\r\n // if this is the last stage -- copy image to target\r\n if (!fxaa && !distortion) {\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n }\r\n }\r\n\r\n srcBuffer = dstBuffer;\r\n\r\n if (fxaa) {\r\n dstBuffer = distortion ? gfx.offscreenBuf4 : target;\r\n this._performFXAA(srcBuffer, dstBuffer);\r\n srcBuffer = dstBuffer;\r\n }\r\n\r\n if (distortion) {\r\n dstBuffer = target;\r\n this._performDistortion(srcBuffer, dstBuffer, true);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._performDistortion = (function () {\r\n const _scene = new THREE.Scene();\r\n const _camera = new THREE.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, -500, 1000);\r\n\r\n const _material = new THREE.RawShaderMaterial({\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n aberration: { type: 'fv3', value: new THREE.Vector3(1.0) },\r\n },\r\n vertexShader: vertexScreenQuadShader,\r\n fragmentShader: fragmentScreenQuadFromDistTex,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n const _geo = gfxutils.buildDistorionMesh(10, 10, settings.now.debug.stereoBarrel);\r\n _scene.add(new meshes.Mesh(_geo, _material));\r\n\r\n return function (srcBuffer, targetBuffer, mesh) {\r\n this._gfx.renderer.setRenderTarget(targetBuffer);\r\n this._gfx.renderer.clear();\r\n\r\n if (mesh) {\r\n _material.uniforms.srcTex.value = srcBuffer.texture;\r\n _material.uniforms.aberration.value.set(0.995, 1.0, 1.01);\r\n this._gfx.renderer.render(_scene, _camera);\r\n } else {\r\n this._gfx.renderer.renderScreenQuadFromTexWithDistortion(srcBuffer, settings.now.debug.stereoBarrel);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._renderOutline = (function () {\r\n const _outlineMaterial = new OutlineMaterial({ depth: true });\r\n\r\n return function (camera, srcDepthBuffer, srcColorBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcColorBuffer.texture;\r\n _outlineMaterial.uniforms.srcDepthTex.value = srcDepthBuffer.depthTexture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcDepthBuffer.width, srcDepthBuffer.height);\r\n _outlineMaterial.uniforms.color.value = new THREE.Color(settings.now.outline.color);\r\n _outlineMaterial.uniforms.threshold.value = settings.now.outline.threshold;\r\n _outlineMaterial.uniforms.thickness.value = new THREE.Vector2(\r\n settings.now.outline.thickness,\r\n settings.now.outline.thickness,\r\n );\r\n\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._renderShadowMap = (function () {\r\n const pars = { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };\r\n\r\n return function () {\r\n if (!settings.now.shadow.on) {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n const currentRenderTarget = gfx.renderer.getRenderTarget();\r\n const activeCubeFace = gfx.renderer.getActiveCubeFace();\r\n const activeMipmapLevel = gfx.renderer.getActiveMipmapLevel();\r\n\r\n const _state = gfx.renderer.state;\r\n\r\n // Set GL state for depth map.\r\n _state.setBlending(THREE.NoBlending);\r\n _state.buffers.color.setClear(1, 1, 1, 1);\r\n _state.buffers.depth.setTest(true);\r\n _state.setScissorTest(false);\r\n\r\n for (let i = 0; i < gfx.scene.children.length; i++) {\r\n if (gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = gfx.scene.children[i];\r\n\r\n if (light.shadow.map == null) {\r\n light.shadow.map = new THREE.WebGLRenderTarget(light.shadow.mapSize.width, light.shadow.mapSize.height, pars);\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n light.shadow.updateMatrices(light);\r\n\r\n gfx.renderer.setRenderTarget(light.shadow.map);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.render(gfx.scene, light.shadow.camera);\r\n }\r\n }\r\n gfx.renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);\r\n };\r\n}());\r\n\r\n/**\r\n * Check if there is selection which must be rendered or not.\r\n * @private\r\n * @returns {boolean} true on existing selection to render\r\n */\r\nMiew.prototype._hasSelectionToRender = function () {\r\n const selPivot = this._gfx.selectionPivot;\r\n\r\n for (let i = 0; i < selPivot.children.length; i++) {\r\n const selPivotChild = selPivot.children[i];\r\n if (selPivotChild.children.length > 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n\r\nMiew.prototype._renderSelection = (function () {\r\n const _outlineMaterial = new OutlineMaterial();\r\n\r\n return function (camera, srcBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // clear offscreen buffer (leave z-buffer intact)\r\n gfx.renderer.setClearColor('black', 0);\r\n\r\n // render selection to offscreen buffer\r\n gfx.renderer.setRenderTarget(srcBuffer);\r\n gfx.renderer.clear(true, false, false);\r\n if (self._hasSelectionToRender()) {\r\n gfx.selectionRoot.matrix = gfx.root.matrix;\r\n gfx.selectionPivot.matrix = gfx.pivot.matrix;\r\n gfx.renderer.render(gfx.selectionScene, camera);\r\n } else {\r\n // just render something to force \"target clear\" operation to finish\r\n gfx.renderer.renderDummyQuad();\r\n }\r\n\r\n // overlay to screen\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 0.6);\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcBuffer.width, srcBuffer.height);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._checkVolumeRenderingSupport = function (renderTarget) {\r\n if (!renderTarget) {\r\n return false;\r\n }\r\n const gfx = this._gfx;\r\n const oldRT = gfx.renderer.getRenderTarget();\r\n\r\n gfx.renderer.setRenderTarget(renderTarget);\r\n const context = gfx.renderer.getContext();\r\n const result = context.checkFramebufferStatus(context.FRAMEBUFFER);\r\n gfx.renderer.setRenderTarget(oldRT);\r\n if (result !== context.FRAMEBUFFER_COMPLETE) {\r\n // floatFrameBufferWarning = ;\r\n this.logger.warn('Device doesn\\'t support electron density rendering');\r\n return false;\r\n }\r\n return true;\r\n};\r\n\r\nMiew.prototype._renderVolume = (function () {\r\n const volumeBFMat = new VolumeMaterial.BackFacePosMaterial();\r\n const volumeFFMat = new VolumeMaterial.FrontFacePosMaterial();\r\n const cubeOffsetMat = new THREE.Matrix4().makeTranslation(0.5, 0.5, 0.5);\r\n const world2colorMat = new THREE.Matrix4();\r\n\r\n let volumeRenderingSupported;\r\n\r\n return function (volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) {\r\n const gfx = this._gfx;\r\n\r\n if (typeof volumeRenderingSupported === 'undefined') {\r\n volumeRenderingSupported = this._checkVolumeRenderingSupport(tmpBuf1);\r\n }\r\n\r\n if (!volumeRenderingSupported) {\r\n return;\r\n }\r\n\r\n const mesh = volumeVisual.getMesh();\r\n\r\n mesh.rebuild(gfx.camera);\r\n\r\n // use main camera to prepare special textures to be used by volumetric rendering\r\n // these textures have the size of the window and are stored in offscreen buffers\r\n gfx.renderer.setClearColor('black', 0);\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n // draw plane with its own material, because it differs slightly from volumeBFMat\r\n camera.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeBFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeFFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.scene.overrideMaterial = null;\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n\r\n // prepare texture that contains molecule positions\r\n world2colorMat.copy(mesh.matrixWorld).invert();\r\n UberMaterial.prototype.uberOptions.world2colorMatrix.multiplyMatrices(cubeOffsetMat, world2colorMat);\r\n camera.layers.set(gfxutils.LAYERS.COLOR_FROM_POSITION);\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // render volume\r\n const vm = mesh.material;\r\n vm.uniforms._BFRight.value = tmpBuf1.texture;\r\n vm.uniforms._FFRight.value = tmpBuf2.texture;\r\n vm.uniforms._WFFRight.value = tmpBuf3.texture;\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.renderer.setRenderTarget(dstBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\n/* Render scene with 'ZPrepass transparency Effect'\r\n * Idea: transparent objects are rendered in two passes. The first one writes result only into depth buffer.\r\n * The second pass reads depth buffer and writes only to color buffer. The method results in\r\n * correct image of front part of the semi-transparent objects, but we can see only front transparent objects\r\n * and opaque objects inside, there is no transparent objects inside.\r\n * Notes: 1. Opaque objects should be rendered strictly before semi-transparent ones.\r\n * 2. Realization doesn't use camera layers because scene traversing is used for material changes and\r\n * we can use it to select needed meshes and don't complicate meshes builders with layers\r\n */\r\nMiew.prototype._renderWithPrepassTransparency = (function () {\r\n return function (camera, targetBuffer) {\r\n const gfx = this._gfx;\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n\r\n // opaque objects\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // transparent objects z prepass\r\n camera.layers.set(gfxutils.LAYERS.PREPASS_TRANSPARENT);\r\n gfx.renderer.getContext().colorMask(false, false, false, false); // don't update color buffer\r\n gfx.renderer.render(gfx.scene, camera);\r\n gfx.renderer.getContext().colorMask(true, true, true, true); // update color buffer\r\n\r\n // transparent objects color pass\r\n camera.layers.set(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // restore default layer\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\nMiew.prototype._performFXAA = (function () {\r\n const _fxaaMaterial = new FXAAMaterial();\r\n\r\n return function (srcBuffer, targetBuffer) {\r\n if (typeof srcBuffer === 'undefined' || typeof targetBuffer === 'undefined') {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n\r\n // clear canvas\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.clear();\r\n\r\n // do fxaa processing of offscreen buff2\r\n _fxaaMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _fxaaMaterial.uniforms.srcTexelSize.value.set(1.0 / srcBuffer.width, 1.0 / srcBuffer.height);\r\n _fxaaMaterial.uniforms.bgColor.value.set(settings.now.bg.color);\r\n\r\n if (_fxaaMaterial.bgTransparent !== settings.now.bg.transparent) {\r\n _fxaaMaterial.setValues({ bgTransparent: settings.now.bg.transparent });\r\n _fxaaMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.renderScreenQuad(_fxaaMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._performAO = (function () {\r\n const _aoMaterial = new AOMaterial();\r\n const _horBlurMaterial = new AOHorBlurMaterial();\r\n const _vertBlurMaterial = new AOVertBlurWithBlendMaterial();\r\n\r\n const _scale = new THREE.Vector3();\r\n return function (srcColorBuffer, normalBuffer, srcDepthTexture, targetBuffer, tempBuffer, tempBuffer1) {\r\n if (!srcColorBuffer || !normalBuffer || !srcDepthTexture || !targetBuffer || !tempBuffer || !tempBuffer1) {\r\n return;\r\n }\r\n const gfx = this._gfx;\r\n const tanHalfFOV = Math.tan(THREE.MathUtils.DEG2RAD * 0.5 * gfx.camera.fov);\r\n\r\n _aoMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _aoMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _aoMaterial.uniforms.normalTexture.value = normalBuffer.texture;\r\n _aoMaterial.uniforms.srcTexelSize.value.set(1.0 / srcColorBuffer.width, 1.0 / srcColorBuffer.height);\r\n _aoMaterial.uniforms.camNearFar.value.set(gfx.camera.near, gfx.camera.far);\r\n _aoMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _aoMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _aoMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n gfx.root.matrix.extractScale(_scale);\r\n _aoMaterial.uniforms.kernelRadius.value = settings.now.debug.ssaoKernelRadius * _scale.x;\r\n _aoMaterial.uniforms.depthThreshold.value = 2.0 * this._getBSphereRadius(); // diameter\r\n _aoMaterial.uniforms.factor.value = settings.now.debug.ssaoFactor;\r\n // N: should be tempBuffer1 for proper use of buffers (see buffers using outside the function)\r\n gfx.renderer.setRenderTarget(tempBuffer1);\r\n gfx.renderer.renderScreenQuad(_aoMaterial);\r\n\r\n _horBlurMaterial.uniforms.aoMap.value = tempBuffer1.texture;\r\n _horBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer1.width, 1.0 / tempBuffer1.height);\r\n _horBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n gfx.renderer.setRenderTarget(tempBuffer);\r\n gfx.renderer.renderScreenQuad(_horBlurMaterial);\r\n\r\n _vertBlurMaterial.uniforms.aoMap.value = tempBuffer.texture;\r\n _vertBlurMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _vertBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer.width, 1.0 / tempBuffer.height);\r\n _vertBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _vertBlurMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _vertBlurMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _vertBlurMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n const { fog } = gfx.scene;\r\n if (fog) {\r\n _vertBlurMaterial.uniforms.fogNearFar.value.set(fog.near, fog.far);\r\n _vertBlurMaterial.uniforms.fogColor.value.set(fog.color.r, fog.color.g, fog.color.b, settings.now.fogAlpha);\r\n }\r\n if ((_vertBlurMaterial.useFog !== settings.now.fog)\r\n || (_vertBlurMaterial.fogTransparent !== settings.now.bg.transparent)) {\r\n _vertBlurMaterial.setValues({ useFog: settings.now.fog, fogTransparent: settings.now.bg.transparent });\r\n _vertBlurMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_vertBlurMaterial);\r\n };\r\n}());\r\n\r\n/**\r\n * Reset the viewer, unload molecules.\r\n * @param {boolean=} keepReps - Keep representations while resetting viewer state.\r\n */\r\nMiew.prototype.reset = function (/* keepReps */) {\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._lastPick = null;\r\n\r\n this._releaseAllVisuals();\r\n\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._resetObjects();\r\n\r\n if (this._gfx) {\r\n gfxutils.clearTree(this._gfx.pivot);\r\n this._gfx.renderer2d.reset();\r\n }\r\n\r\n this.setNeedRender();\r\n};\r\n\r\nMiew.prototype._resetScene = function () {\r\n this._objectControls.reset();\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n this.resetReps();\r\n this.resetPivot();\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype.resetView = function () {\r\n // reset controls\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._resetScene();\r\n\r\n // reset selection\r\n this._forEachComplexVisual((visual) => {\r\n visual.updateSelectionMask({});\r\n visual.rebuildSelectionGeometry();\r\n });\r\n};\r\n\r\nMiew.prototype._export = function (format) {\r\n const TheExporter = _.head(io.exporters.find({ format }));\r\n if (!TheExporter) {\r\n this.logger.error('Could not find suitable exporter for this source');\r\n return Promise.reject(new Error('Could not find suitable exporter for this source'));\r\n }\r\n this.dispatchEvent({ type: 'exporting' });\r\n\r\n if (this._visuals[this._curVisualName] instanceof ComplexVisual) {\r\n let dataSource = null;\r\n if (TheExporter.SourceClass === ComplexVisual) {\r\n dataSource = this._visuals[this._curVisualName];\r\n } else if (TheExporter.SourceClass === Complex) {\r\n dataSource = this._visuals[this._curVisualName]._complex;\r\n }\r\n const exporter = new TheExporter(dataSource, { miewVersion: Miew.VERSION });\r\n return exporter.export().then((data) => data);\r\n }\r\n if (this._visuals[this._curVisualName] instanceof VolumeVisual) {\r\n return Promise.reject(new Error('Sorry, exporter for volume data not implemented yet'));\r\n }\r\n return Promise.reject(new Error('Unexpected format of data'));\r\n};\r\n\r\nconst rePdbId = /^(?:(pdb|cif|ccp4|dsn6):\\s*)?(\\d[a-z\\d]{3})$/i;\r\nconst rePubchem = /^(?:pc|pubchem):\\s*([a-z]+)$/i;\r\nconst reUrlScheme = /^([a-z][a-z\\d\\-+.]*):/i;\r\n\r\nfunction resolveSourceShortcut(source, opts) {\r\n if (!_.isString(source)) {\r\n return source;\r\n }\r\n\r\n // e.g. \"cif:1CRN\"\r\n const matchesPdbId = rePdbId.exec(source);\r\n if (matchesPdbId) {\r\n let [, format = 'pdb', id] = matchesPdbId;\r\n\r\n format = format.toLowerCase();\r\n id = id.toUpperCase();\r\n\r\n switch (format) {\r\n case 'pdb':\r\n source = `https://files.rcsb.org/download/${id}.pdb`;\r\n break;\r\n case 'cif':\r\n source = `https://files.rcsb.org/download/${id}.cif`;\r\n break;\r\n case 'ccp4':\r\n source = `https://www.ebi.ac.uk/pdbe/coordinates/files/${id.toLowerCase()}.ccp4`;\r\n break;\r\n case 'dsn6':\r\n source = `https://edmaps.rcsb.org/maps/${id.toLowerCase()}_2fofc.dsn6`;\r\n break;\r\n default:\r\n throw new Error('Unexpected data format shortcut');\r\n }\r\n\r\n opts.fileType = format;\r\n opts.fileName = `${id}.${format}`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // e.g. \"pc:aspirin\"\r\n const matchesPubchem = rePubchem.exec(source);\r\n if (matchesPubchem) {\r\n const compound = matchesPubchem[1].toLowerCase();\r\n source = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${compound}/JSON?record_type=3d`;\r\n opts.fileType = 'pubchem';\r\n opts.fileName = `${compound}.json`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // otherwise is should be an URL\r\n if (opts.sourceType === 'url' || opts.sourceType === undefined) {\r\n opts.sourceType = 'url';\r\n\r\n // e.g. \"./data/1CRN.pdb\"\r\n if (!reUrlScheme.test(source)) {\r\n source = utils.resolveURL(source);\r\n }\r\n }\r\n\r\n return source;\r\n}\r\n\r\nfunction updateBinaryMode(opts) {\r\n let { binary } = opts;\r\n\r\n // detect by format\r\n if (opts.fileType !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n } else {\r\n throw new Error('Could not find suitable parser for this format');\r\n }\r\n }\r\n\r\n // detect by file extension\r\n if (binary === undefined && opts.fileExt !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ ext: opts.fileExt }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n }\r\n }\r\n\r\n // temporary workaround for animation\r\n if (opts.fileExt !== undefined && opts.fileExt.toLowerCase() === '.man') {\r\n opts.binary = true;\r\n opts.animation = true; // who cares?\r\n }\r\n\r\n // update if detected\r\n if (binary !== undefined) {\r\n if (opts.binary !== undefined && opts.binary !== binary) {\r\n opts.context.logger.warn('Overriding incorrect binary mode');\r\n }\r\n }\r\n\r\n opts.binary = binary || false;\r\n}\r\n\r\nfunction _fetchData(source, opts, job) {\r\n return new Promise(((resolve) => {\r\n if (job.shouldCancel()) {\r\n throw new Error('Operation cancelled');\r\n }\r\n job.notify({ type: 'fetching' });\r\n\r\n // allow for source shortcuts\r\n source = resolveSourceShortcut(source, opts);\r\n\r\n // detect a proper loader\r\n const TheLoader = _.head(io.loaders.find({ type: opts.sourceType, source }));\r\n if (!TheLoader) {\r\n throw new Error(LOADER_NOT_FOUND);\r\n }\r\n\r\n // split file name\r\n const fileName = opts.fileName || TheLoader.extractName(source);\r\n if (fileName) {\r\n const [name, fileExt] = utils.splitFileName(fileName);\r\n _.defaults(opts, { name, fileExt, fileName });\r\n }\r\n\r\n // should it be text or binary?\r\n updateBinaryMode(opts);\r\n\r\n // FIXME: All new settings retrieved from server are applied after the loading is complete. However, we need some\r\n // flags to alter the loading process itself. Here we apply them in advance. Dirty hack. Kill the server, remove\r\n // all hacks and everybody's happy.\r\n let newOptions = _.get(opts, 'preset.expression');\r\n if (!_.isUndefined(newOptions)) {\r\n newOptions = JSON.parse(newOptions);\r\n if (newOptions && newOptions.settings) {\r\n const keys = ['singleUnit'];\r\n for (let keyIndex = 0, keyCount = keys.length; keyIndex < keyCount; ++keyIndex) {\r\n const key = keys[keyIndex];\r\n const value = _.get(newOptions.settings, key);\r\n if (!_.isUndefined(value)) {\r\n settings.set(key, value);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // create a loader\r\n const loader = new TheLoader(source, opts);\r\n loader.context = opts.context;\r\n job.addEventListener('cancel', () => loader.abort());\r\n\r\n loader.addEventListener('progress', (event) => {\r\n if (event.lengthComputable && event.total > 0) {\r\n reportProgress(loader.logger, 'Fetching', event.loaded / event.total);\r\n } else {\r\n reportProgress(loader.logger, 'Fetching');\r\n }\r\n });\r\n\r\n console.time('fetch');\r\n const promise = loader.load()\r\n .then((data) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.info('Fetching finished');\r\n job.notify({ type: 'fetchingDone', data });\r\n return data;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Fetching failed');\r\n job.notify({ type: 'fetchingDone', error });\r\n throw error;\r\n });\r\n resolve(promise);\r\n }));\r\n}\r\n\r\nfunction _parseData(data, opts, job) {\r\n if (job.shouldCancel()) {\r\n return Promise.reject(new Error('Operation cancelled'));\r\n }\r\n\r\n job.notify({ type: 'parsing' });\r\n\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType, ext: opts.fileExt, data }));\r\n if (!TheParser) {\r\n return Promise.reject(new Error('Could not find suitable parser'));\r\n }\r\n\r\n const parser = new TheParser(data, opts);\r\n parser.context = opts.context;\r\n job.addEventListener('cancel', () => parser.abort());\r\n\r\n console.time('parse');\r\n return parser.parse()\r\n .then((dataSet) => {\r\n console.timeEnd('parse');\r\n job.notify({ type: 'parsingDone', data: dataSet });\r\n return dataSet;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('parse');\r\n opts.error = error;\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Parsing failed');\r\n job.notify({ type: 'parsingDone', error });\r\n throw error;\r\n });\r\n}\r\n\r\n/**\r\n * Load molecule asynchronously.\r\n * @param {string|File} source - Molecule source to load (e.g. PDB ID, URL or File object).\r\n * @param {object=} opts - Options.\r\n * @param {string=} opts.sourceType - Data source type (e.g. 'url', 'file').\r\n * @param {string=} opts.fileType - Data contents type (e.g. 'pdb', 'cml').\r\n * @param {string=} opts.mdFile - .nc file path.\r\n * @param {boolean=} opts.keepRepsInfo - prevent reset of object and reps information.\r\n * @returns {Promise} name of the visual that was added to the viewer\r\n */\r\nMiew.prototype.load = function (source, opts) {\r\n opts = _.merge({}, opts, {\r\n context: this,\r\n });\r\n\r\n // for a single-file scenario\r\n if (!this.settings.now.use.multiFile) {\r\n // abort all loaders in progress\r\n if (this._loading.length) {\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n }\r\n\r\n // reset\r\n if (!opts.animation) { // FIXME: sometimes it is set AFTERWARDS!\r\n this.reset(true);\r\n }\r\n }\r\n\r\n this._interpolator.reset();\r\n\r\n this.dispatchEvent({ type: 'loading', options: opts, source });\r\n\r\n const job = new JobHandle();\r\n this._loading.push(job);\r\n job.addEventListener('notification', (e) => {\r\n this.dispatchEvent(e.slaveEvent);\r\n });\r\n\r\n this._spinner.spin(this._container);\r\n\r\n const onLoadEnd = (anything) => {\r\n const jobIndex = this._loading.indexOf(job);\r\n if (jobIndex !== -1) {\r\n this._loading.splice(jobIndex, 1);\r\n }\r\n this._spinner.stop();\r\n this._refreshTitle();\r\n job.notify({ type: 'loadingDone', anything });\r\n return anything;\r\n };\r\n\r\n return _fetchData(source, opts, job)\r\n .then((data) => _parseData(data, opts, job))\r\n .then((object) => {\r\n const name = this._onLoad(object, opts);\r\n return onLoadEnd(name);\r\n })\r\n .catch((err) => {\r\n this.logger.error('Could not load data');\r\n this.logger.debug(err);\r\n throw onLoadEnd(err);\r\n });\r\n};\r\n\r\n/**\r\n * Unload molecule (delete corresponding visual).\r\n * @param {string=} name - name of the visual\r\n */\r\nMiew.prototype.unload = function (name) {\r\n this._removeVisual(name || this.getCurrentVisual());\r\n this.resetPivot();\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n};\r\n\r\n/**\r\n * Start new animation. Now is broken.\r\n * @param fileData - new data to animate\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._startAnimation = function (fileData) {\r\n this._stopAnimation();\r\n const self = this;\r\n const visual = this._getComplexVisual();\r\n if (visual === null) {\r\n this.logger.error('Unable to start animation - no molecule is loaded.');\r\n return;\r\n }\r\n try {\r\n this._frameInfo = new FrameInfo(\r\n visual.getComplex(),\r\n fileData,\r\n {\r\n onLoadStatusChanged() {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo ? self._frameInfo.isLoading : true,\r\n },\r\n });\r\n },\r\n onError(message) {\r\n self._stopAnimation();\r\n self.logger.error(message);\r\n },\r\n },\r\n );\r\n } catch (e) {\r\n this.logger.error('Animation file does not fit to current complex!');\r\n return;\r\n }\r\n this._continueAnimation();\r\n};\r\n\r\n/**\r\n * Pause current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._pauseAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n this._isAnimating = false;\r\n clearInterval(this._animInterval);\r\n this._animInterval = null;\r\n if (this._frameInfo) {\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: this._isAnimating,\r\n isLoading: this._frameInfo.isLoading,\r\n },\r\n });\r\n }\r\n};\r\n\r\n/**\r\n * Continue current animation after pausing. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._continueAnimation = function () {\r\n this._isAnimating = true;\r\n let minFrameTime = 1000 / settings.now.maxfps;\r\n minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime;\r\n const self = this;\r\n const { pivot } = self._gfx;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.resetSelectionMask();\r\n visual.rebuildSelectionGeometry();\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n }\r\n this._animInterval = setInterval(() => {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo.isLoading,\r\n },\r\n });\r\n if (self._frameInfo.frameIsReady) {\r\n pivot.updateToFrame(self._frameInfo);\r\n self._updateObjsToFrame(self._frameInfo);\r\n self._refreshTitle(` Frame ${self._frameInfo._currFrame} of ${self._frameInfo._framesCount\r\n } time interval - ${self._frameInfo._timeStep}`);\r\n try {\r\n self._frameInfo.nextFrame();\r\n } catch (e) {\r\n self.logger.error('Error during animation');\r\n self._stopAnimation();\r\n return;\r\n }\r\n self._needRender = true;\r\n }\r\n }, minFrameTime);\r\n};\r\n\r\n/**\r\n * Stop current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._stopAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n clearInterval(this._animInterval);\r\n this._frameInfo.disableEvents();\r\n this._frameInfo = null;\r\n this._animInterval = null;\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: null,\r\n });\r\n};\r\n\r\n/**\r\n * Invoked upon successful loading of some data source\r\n * @param {DataSource} dataSource - Data source for visualization (molecular complex or other)\r\n * @param {object} opts - Options.\r\n * @private\r\n */\r\nMiew.prototype._onLoad = function (dataSource, opts) {\r\n const gfx = this._gfx;\r\n let visualName = null;\r\n\r\n if (opts.animation) {\r\n this._refreshTitle();\r\n this._startAnimation(dataSource);\r\n return null;\r\n }\r\n this._stopAnimation();\r\n if (!opts || !opts.keepRepsInfo) {\r\n this._opts.reps = null;\r\n this._opts._objects = null;\r\n }\r\n\r\n if (dataSource.id === 'Complex') {\r\n const complex = dataSource;\r\n\r\n // update title\r\n if (opts.fileName) {\r\n complex.name = complex.name || removeExtension(opts.fileName).toUpperCase();\r\n } else if (opts.amberFileName) {\r\n complex.name = complex.name || removeExtension(opts.amberFileName).toUpperCase();\r\n } else {\r\n complex.name = `Dynamic ${opts.fileType} molecule`;\r\n }\r\n\r\n visualName = this._addVisual(new ComplexVisual(complex.name, complex));\r\n this._curVisualName = visualName;\r\n\r\n const desc = this.info();\r\n this.logger.info(`Parsed ${opts.fileName} (${\r\n desc.atoms} atoms, ${\r\n desc.bonds} bonds, ${\r\n desc.residues} residues, ${\r\n desc.chains} chains).`);\r\n\r\n if (_.isNumber(this._opts.unit)) {\r\n complex.setCurrentUnit(this._opts.unit);\r\n }\r\n\r\n if (opts.preset) {\r\n // ...removed server access...\r\n } else if (settings.now.autoPreset) {\r\n switch (opts.fileType) {\r\n case 'cml':\r\n this.resetReps('small');\r\n break;\r\n case 'pdb':\r\n case 'mmtf':\r\n case 'cif':\r\n if (hasValidResidues(complex)) {\r\n this.resetReps('macro');\r\n } else {\r\n this.resetReps('small');\r\n }\r\n break;\r\n default:\r\n this.resetReps('default');\r\n break;\r\n }\r\n } else {\r\n this.resetReps('default');\r\n }\r\n } else if (dataSource.id === 'Volume') {\r\n this.resetEd();\r\n visualName = this._onLoadEd(dataSource);\r\n }\r\n\r\n gfx.camera.updateProjectionMatrix();\r\n this._updateFog();\r\n\r\n // reset global transform\r\n gfx.root.resetTransform();\r\n this.resetPivot();\r\n\r\n // set scale to fit everything on the screen\r\n this._objectControls.setScale(settings.now.radiusToFit / this._getBSphereRadius());\r\n\r\n this._resetObjects();\r\n\r\n if (settings.now.autoResolution) {\r\n this._tweakResolution();\r\n }\r\n\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n this._refreshTitle();\r\n\r\n return visualName;\r\n};\r\n\r\nMiew.prototype.resetEd = function () {\r\n if (this._edLoader) {\r\n this._edLoader.abort();\r\n this._edLoader = null;\r\n }\r\n\r\n // free all resources\r\n this._removeVisual(this._getVolumeVisual());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype.loadEd = function (source) {\r\n this.resetEd();\r\n\r\n const TheLoader = _.head(io.loaders.find({ source }));\r\n if (!TheLoader) {\r\n this.logger.error(LOADER_NOT_FOUND);\r\n return Promise.reject(new Error(LOADER_NOT_FOUND));\r\n }\r\n\r\n const loader = this._edLoader = new TheLoader(source, { binary: true });\r\n loader.context = this;\r\n return loader.load().then((data) => {\r\n const TheParser = _.head(io.parsers.find({ format: 'ccp4' }));\r\n if (!TheParser) {\r\n throw new Error(PARSER_NOT_FOUND);\r\n }\r\n const parser = new TheParser(data);\r\n parser.context = this;\r\n return parser.parse().then((dataSource) => {\r\n this._onLoadEd(dataSource);\r\n });\r\n }).catch((error) => {\r\n this.logger.error('Could not load ED data');\r\n this.logger.debug(error);\r\n });\r\n};\r\n\r\nMiew.prototype._onLoadEd = function (dataSource) {\r\n dataSource.normalize();\r\n\r\n const volumeVisual = new VolumeVisual('volume', dataSource);\r\n volumeVisual.getMesh().layers.set(gfxutils.LAYERS.VOLUME); // volume mesh is not visible to common render\r\n const visualName = this._addVisual(volumeVisual);\r\n\r\n this._needRender = true;\r\n return visualName;\r\n};\r\n\r\nMiew.prototype._needRebuild = function () {\r\n let needsRebuild = false;\r\n this._forEachComplexVisual((visual) => {\r\n needsRebuild = needsRebuild || visual.needsRebuild();\r\n });\r\n return needsRebuild;\r\n};\r\n\r\nMiew.prototype._rebuildObjects = function () {\r\n const self = this;\r\n const gfx = this._gfx;\r\n let i;\r\n let n;\r\n\r\n // remove old object geometry\r\n const toRemove = [];\r\n for (i = 0; i < gfx.pivot.children.length; ++i) {\r\n const child = gfx.pivot.children[i];\r\n if (!(child instanceof Visual)) {\r\n toRemove.push(child);\r\n }\r\n }\r\n for (i = 0; i < toRemove.length; ++i) {\r\n toRemove[i].parent.remove(toRemove[i]);\r\n }\r\n\r\n setTimeout(() => {\r\n const objList = self._objects;\r\n for (i = 0, n = objList.length; i < n; ++i) {\r\n const obj = objList[i];\r\n if (obj.needsRebuild) {\r\n obj.build();\r\n }\r\n if (obj.getGeometry()) {\r\n gfx.pivot.add(obj.getGeometry());\r\n }\r\n }\r\n }, 10);\r\n};\r\n\r\nMiew.prototype.changeUnit = function (unitIdx, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n throw new Error('There is no complex to change!');\r\n }\r\n\r\n function currentUnitInfo() {\r\n const unit = visual ? visual.getComplex().getCurrentUnit() : 0;\r\n const type = unit > 0 ? (`Bio molecule ${unit}`) : 'Asymmetric unit';\r\n return `Current unit: ${unit} (${type})`;\r\n }\r\n\r\n if (unitIdx === undefined) {\r\n return currentUnitInfo();\r\n }\r\n if (_.isString(unitIdx)) {\r\n unitIdx = Math.max(parseInt(unitIdx, 10), 0);\r\n }\r\n if (visual.getComplex().setCurrentUnit(unitIdx)) {\r\n this._resetScene();\r\n this._updateInfoPanel();\r\n }\r\n return currentUnitInfo();\r\n};\r\n\r\n/**\r\n * Start to rebuild geometry asynchronously.\r\n */\r\nMiew.prototype.rebuild = function () {\r\n if (this._building) {\r\n this.logger.warn('Miew.rebuild(): already building!');\r\n return;\r\n }\r\n this._building = true;\r\n\r\n this.dispatchEvent({ type: 'rebuilding' });\r\n\r\n this._rebuildObjects();\r\n\r\n this._gfx.renderer2d.reset();\r\n\r\n const rebuildActions = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.needsRebuild()) {\r\n rebuildActions.push(visual.rebuild().then(() => new Promise(((resolve) => {\r\n visual.rebuildSelectionGeometry();\r\n resolve();\r\n }))));\r\n }\r\n });\r\n\r\n // Start asynchronous rebuild\r\n const self = this;\r\n this._spinner.spin(this._container);\r\n Promise.all(rebuildActions).then(() => {\r\n self._spinner.stop();\r\n\r\n self._needRender = true;\r\n\r\n self._refreshTitle();\r\n this.dispatchEvent({ type: 'buildingDone' });\r\n self._building = false;\r\n });\r\n};\r\n\r\n/** Mark all representations for rebuilding */\r\nMiew.prototype.rebuildAll = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setNeedsRebuild();\r\n });\r\n};\r\n\r\nMiew.prototype._refreshTitle = function (appendix) {\r\n let title;\r\n appendix = appendix === undefined ? '' : appendix;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n title = visual.getComplex().name;\r\n const rep = visual.repGet(visual.repCurrent());\r\n title += (rep ? ` – ${rep.mode.name} Mode` : '');\r\n } else {\r\n title = Object.keys(this._visuals).length > 0 ? 'Unknown' : 'No Data';\r\n }\r\n title += appendix;\r\n\r\n this.dispatchEvent({ type: 'titleChanged', data: title });\r\n};\r\n\r\nMiew.prototype.setNeedRender = function () {\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._extractRepresentation = function () {\r\n const changed = [];\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCount() === 0) {\r\n return;\r\n }\r\n\r\n const selector = visual.buildSelectorFromMask(1 << visual.getSelectionBit());\r\n const defPreset = settings.now.presets.default;\r\n const res = visual.repAdd({\r\n selector,\r\n mode: defPreset[0].mode.id,\r\n colorer: defPreset[0].colorer.id,\r\n material: defPreset[0].material.id,\r\n });\r\n if (!res) {\r\n if (visual.repCount() === ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n this.logger.warn(`Number of representations is limited to ${ComplexVisual.NUM_REPRESENTATION_BITS}`);\r\n }\r\n return;\r\n }\r\n\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n visual.repCurrent(res.index);\r\n\r\n changed.push(visual.name);\r\n });\r\n\r\n if (changed.length > 0) {\r\n this.logger.report(`New representation from selection for complexes: ${changed.join(', ')}`);\r\n }\r\n};\r\n\r\n/**\r\n * Change current representation list.\r\n * @param {array} reps - Representation list.\r\n */\r\nMiew.prototype._setReps = function (reps) {\r\n reps = reps || (this._opts && this._opts.reps) || [];\r\n this._forEachComplexVisual((visual) => visual.resetReps(reps));\r\n};\r\n\r\n/**\r\n * Apply existing preset to current scene.\r\n * @param preset\r\n */\r\nMiew.prototype.applyPreset = function (preset) {\r\n const { presets } = settings.now;\r\n const presList = [\r\n preset || settings.defaults.preset,\r\n settings.defaults.preset,\r\n Object.keys(presets)[0],\r\n ];\r\n let reps = null;\r\n for (let i = 0; !reps && i < presList.length; ++i) {\r\n settings.set('preset', presList[i]);\r\n reps = presets[settings.now.preset];\r\n if (!reps) {\r\n this.logger.warn(`Unknown preset \"${settings.now.preset}\"`);\r\n }\r\n }\r\n this._setReps(reps);\r\n};\r\n\r\n/**\r\n * Reset current representation list to initial values.\r\n * @param {string} [preset] - The source preset in case of uninitialized representation list.\r\n */\r\nMiew.prototype.resetReps = function (preset) {\r\n const reps = this._opts && this._opts.reps;\r\n if (reps) {\r\n this._setReps(reps);\r\n } else {\r\n this.applyPreset(preset);\r\n }\r\n};\r\n\r\n/**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\nMiew.prototype.repCount = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repCount() : 0;\r\n};\r\n\r\n/**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {string=} [name] - Complex name. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\nMiew.prototype.repCurrent = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n const newIdx = visual ? visual.repCurrent(index) : -1;\r\n if (index && newIdx !== index) {\r\n this.logger.warn(`Representation ${index} was not found. Current rep remains unchanged.`);\r\n }\r\n return newIdx;\r\n};\r\n\r\n/**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {?object} Representation description.\r\n */\r\nMiew.prototype.rep = function (index, rep) {\r\n const visual = this._getComplexVisual('');\r\n if (!visual) {\r\n return null;\r\n }\r\n const res = visual.rep(index, rep);\r\n if (res.status === 'created') {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n } else if (res.status === 'changed') {\r\n this.dispatchEvent({ type: 'repChanged', index: res.index, name: visual.name });\r\n }\r\n return res.desc;\r\n};\r\n\r\n/**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\nMiew.prototype.repGet = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repGet(index) : null;\r\n};\r\n\r\n/**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {number} Index of the new representation.\r\n */\r\nMiew.prototype.repAdd = function (rep, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return -1;\r\n }\r\n\r\n const res = visual.repAdd(rep);\r\n if (res) {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name });\r\n return res.index;\r\n }\r\n return -1;\r\n};\r\n\r\n/**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\nMiew.prototype.repRemove = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n visual.repRemove(index);\r\n this.dispatchEvent({ type: 'repRemoved', index, name });\r\n};\r\n\r\n/**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\nMiew.prototype.repHide = function (index, hide, name) {\r\n this._needRender = true;\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repHide(index, hide) : null;\r\n};\r\n\r\nMiew.prototype._setEditMode = function (mode) {\r\n this._editMode = mode;\r\n\r\n const elem = this._msgMode;\r\n if (elem) {\r\n elem.style.opacity = (mode === EDIT_MODE.COMPLEX) ? 0.0 : 1.0;\r\n\r\n if (mode !== EDIT_MODE.COMPLEX) {\r\n const t = elem.getElementsByTagName('p')[0];\r\n t.innerHTML = (mode === EDIT_MODE.COMPONENT) ? 'COMPONENT EDIT MODE' : 'FRAGMENT EDIT MODE';\r\n }\r\n }\r\n\r\n this.dispatchEvent({ type: 'editModeChanged', data: mode === EDIT_MODE.COMPLEX });\r\n};\r\n\r\nMiew.prototype._enterComponentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const editors = [];\r\n this._forEachComplexVisual((visual) => {\r\n const editor = visual.beginComponentEdit();\r\n if (editor) {\r\n editors.push(editor);\r\n }\r\n });\r\n\r\n if (editors === []) {\r\n return;\r\n }\r\n\r\n this._editors = editors;\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- ON');\r\n this._setEditMode(EDIT_MODE.COMPONENT);\r\n this._objectControls.keysTranslateObj(true);\r\n};\r\n\r\nMiew.prototype._applyComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._needRender = true;\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._enterFragmentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const selectedVisuals = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual instanceof ComplexVisual\r\n && visual.getSelectionCount() > 0) {\r\n selectedVisuals.push(visual);\r\n }\r\n });\r\n\r\n if (selectedVisuals.length !== 1) {\r\n // either we have no selection or\r\n // we have selected atoms in two or more visuals -- not supported\r\n return;\r\n }\r\n\r\n const editor = selectedVisuals[0].beginFragmentEdit();\r\n if (!editor) {\r\n return;\r\n }\r\n this._editors = [editor];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- ON (single bond)');\r\n this._setEditMode(EDIT_MODE.FRAGMENT);\r\n this._objectControls.allowTranslation(false);\r\n this._objectControls.allowAltObjFreeRotation(editor.isFreeRotationAllowed());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._applyFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onPick = function (event) {\r\n if (!settings.now.picking) {\r\n // picking is disabled\r\n return;\r\n }\r\n\r\n if (this._animInterval !== null) {\r\n // animation playback is on\r\n return;\r\n }\r\n\r\n if (this._editMode === EDIT_MODE.FRAGMENT) {\r\n // prevent picking in fragment edit mode\r\n return;\r\n }\r\n\r\n if (this._objectControls.isEditingAltObj()) {\r\n // prevent picking during component rotation\r\n return;\r\n }\r\n\r\n // update last pick & find complex\r\n let complex = null;\r\n if (event.obj.atom) {\r\n complex = event.obj.atom.residue.getChain().getComplex();\r\n this._lastPick = event.obj.atom;\r\n } else if (event.obj.residue) {\r\n complex = event.obj.residue.getChain().getComplex();\r\n this._lastPick = event.obj.residue;\r\n } else if (event.obj.chain) {\r\n complex = event.obj.chain.getComplex();\r\n this._lastPick = event.obj.chain;\r\n } else if (event.obj.molecule) {\r\n complex = event.obj.molecule.complex;\r\n this._lastPick = event.obj.molecule;\r\n } else {\r\n this._lastPick = null;\r\n }\r\n\r\n function _updateSelection(visual) {\r\n visual.updateSelectionMask(event.obj);\r\n visual.rebuildSelectionGeometry();\r\n }\r\n\r\n // update visual\r\n if (complex) {\r\n const visual = this._getVisualForComplex(complex);\r\n if (visual) {\r\n _updateSelection(visual);\r\n this._needRender = true;\r\n }\r\n } else {\r\n this._forEachComplexVisual(_updateSelection);\r\n this._needRender = true;\r\n }\r\n\r\n this._updateInfoPanel();\r\n this.dispatchEvent(event);\r\n};\r\n\r\nMiew.prototype._onKeyDown = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n // editing keys\r\n if (settings.now.editing) {\r\n switch (event.code) {\r\n case 'KeyC':\r\n this._enterComponentEditMode();\r\n break;\r\n case 'KeyF':\r\n this._enterFragmentEditMode();\r\n break;\r\n case 'KeyA':\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._applyComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._applyFragmentEdit();\r\n break;\r\n default:\r\n break;\r\n }\r\n break;\r\n case 'KeyD':\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._discardComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._discardFragmentEdit();\r\n break;\r\n default:\r\n break;\r\n }\r\n break;\r\n default:\r\n }\r\n }\r\n\r\n // other keys\r\n switch (event.code) {\r\n case 'NumpadAdd':\r\n if (event.altKey) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.expandSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n }\r\n break;\r\n case 'NumpadSubtract':\r\n if (event.altKey) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.shrinkSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n }\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nMiew.prototype._onKeyUp = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n if (event.code === 'KeyX') {\r\n this._extractRepresentation();\r\n }\r\n};\r\n\r\nMiew.prototype._updateInfoPanel = function () {\r\n const info = this._msgAtomInfo.getElementsByTagName('p')[0];\r\n let atom;\r\n let residue;\r\n\r\n let count = 0;\r\n this._forEachComplexVisual((visual) => {\r\n count += visual.getSelectionCount();\r\n });\r\n\r\n while (info.firstChild) {\r\n info.removeChild(info.firstChild);\r\n }\r\n\r\n if (count === 0) {\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n return;\r\n }\r\n\r\n let firstLine = `${String(count)} atom${count !== 1 ? 's' : ''} selected`;\r\n if (this._lastPick !== null) {\r\n firstLine += ', the last pick:';\r\n }\r\n let secondLine = '';\r\n let aName = '';\r\n let coordLine = '';\r\n\r\n if (this._lastPick instanceof Atom) {\r\n atom = this._lastPick;\r\n residue = atom.residue;\r\n\r\n aName = atom.name;\r\n const location = (atom.location !== 32) ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space\r\n secondLine = `${atom.element.fullName} #${atom.serial}${location}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}.`;\r\n secondLine += aName;\r\n\r\n coordLine = `Coord: (${atom.position.x.toFixed(2).toString()},\\\r\n ${atom.position.y.toFixed(2).toString()},\\\r\n ${atom.position.z.toFixed(2).toString()})`;\r\n } else if (this._lastPick instanceof Residue) {\r\n residue = this._lastPick;\r\n\r\n secondLine = `${residue._type._fullName}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}`;\r\n } else if (this._lastPick instanceof Chain) {\r\n secondLine = `chain ${this._lastPick._name}`;\r\n } else if (this._lastPick instanceof Molecule) {\r\n secondLine = `molecule ${this._lastPick._name}`;\r\n }\r\n\r\n info.appendChild(document.createTextNode(firstLine));\r\n\r\n if (secondLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(secondLine));\r\n }\r\n\r\n if (coordLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(coordLine));\r\n }\r\n\r\n this._msgAtomInfo.style.opacity = 1.0;\r\n};\r\n\r\nMiew.prototype._getAltObj = function () {\r\n if (this._editors) {\r\n let altObj = null;\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n const nextAltObj = this._editors[i].getAltObj();\r\n if (nextAltObj.objects.length > 0) {\r\n if (altObj) {\r\n // we have selected atoms in two or more visuals -- not supported\r\n altObj = null;\r\n break;\r\n }\r\n altObj = nextAltObj;\r\n }\r\n }\r\n if (altObj) {\r\n return altObj;\r\n }\r\n }\r\n\r\n return {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n};\r\n\r\nMiew.prototype.resetPivot = (function () {\r\n const boundingBox = new THREE.Box3();\r\n const center = new THREE.Vector3();\r\n\r\n return function () {\r\n boundingBox.makeEmpty();\r\n this._forEachVisual((visual) => {\r\n boundingBox.union(visual.getBoundaries().boundingBox);\r\n });\r\n\r\n boundingBox.getCenter(center);\r\n this._objectControls.setPivot(center.negate());\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotResidue = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (residue) {\r\n const visual = this._getVisualForComplex(residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n if (residue._controlPoint) {\r\n center.copy(residue._controlPoint);\r\n } else {\r\n let x = 0;\r\n let y = 0;\r\n let z = 0;\r\n const amount = residue._atoms.length;\r\n for (let i = 0; i < amount; ++i) {\r\n const p = residue._atoms[i].position;\r\n x += p.x / amount;\r\n y += p.y / amount;\r\n z += p.z / amount;\r\n }\r\n center.set(x, y, z);\r\n }\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotAtom = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (atom) {\r\n const visual = this._getVisualForComplex(atom.residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n center.copy(atom.position);\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.getSelectionCenter = (function () {\r\n const _centerInVisual = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n return function (center, includesAtom, selector) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCenter(_centerInVisual, includesAtom, selector || visual.getSelectionBit())) {\r\n center.add(_centerInVisual);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.negate();\r\n return true;\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotSubset = (function () {\r\n const _center = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n function _includesInCurSelection(atom, selectionBit) {\r\n return atom.mask & (1 << selectionBit);\r\n }\r\n\r\n function _includesInSelector(atom, selector) {\r\n return selector.selector.includesAtom(atom);\r\n }\r\n\r\n return function (selector) {\r\n const includesAtom = (selector) ? _includesInSelector : _includesInCurSelection;\r\n\r\n if (this.getSelectionCenter(_center, includesAtom, selector)) {\r\n this._objectControls.setPivot(_center);\r\n this.dispatchEvent({ type: 'transform' });\r\n } else {\r\n this.logger.warn('selection is empty. Center operation not performed');\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Makes a screenshot.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n * @returns {string} Data URL representing the image contents.\r\n */\r\nMiew.prototype.screenshot = function (width, height) {\r\n const gfx = this._gfx;\r\n const deviceWidth = gfx.renderer.domElement.width;\r\n const deviceHeight = gfx.renderer.domElement.height;\r\n\r\n function fov2Tan(fov) {\r\n return Math.tan(THREE.MathUtils.degToRad(0.5 * fov));\r\n }\r\n\r\n function tan2Fov(tan) {\r\n return THREE.MathUtils.radToDeg(Math.atan(tan)) * 2.0;\r\n }\r\n\r\n function getDataURL() {\r\n let dataURL;\r\n const currBrowser = utils.getBrowser();\r\n\r\n if (currBrowser === utils.browserType.SAFARI) {\r\n const canvas = document.createElement('canvas');\r\n const canvasContext = canvas.getContext('2d');\r\n\r\n canvas.width = width === undefined ? deviceWidth : width;\r\n canvas.height = height === undefined ? deviceHeight : height;\r\n\r\n canvasContext.drawImage(gfx.renderer.domElement, 0, 0, canvas.width, canvas.height);\r\n dataURL = canvas.toDataURL('image/png');\r\n } else {\r\n // Copy current canvas to screenshot\r\n dataURL = gfx.renderer.domElement.toDataURL('image/png');\r\n }\r\n return dataURL;\r\n }\r\n height = height || width;\r\n\r\n let screenshotURI;\r\n if ((width === undefined && height === undefined)\r\n || (width === deviceWidth && height === deviceHeight)) {\r\n // renderer.domElement.toDataURL('image/png') returns flipped image in Safari\r\n // It hasn't been resolved yet, but getScreenshotSafari()\r\n // fixes it using an extra canvas.\r\n screenshotURI = getDataURL();\r\n } else {\r\n const originalAspect = gfx.camera.aspect;\r\n const originalFov = gfx.camera.fov;\r\n const originalTanFov2 = fov2Tan(gfx.camera.fov);\r\n\r\n // screenshot should contain the principal area of interest (a centered square touching screen sides)\r\n const areaOfInterestSize = Math.min(gfx.width, gfx.height);\r\n const areaOfInterestTanFov2 = originalTanFov2 * areaOfInterestSize / gfx.height;\r\n\r\n // set appropriate camera aspect & FOV\r\n const shotAspect = width / height;\r\n gfx.renderer.setPixelRatio(1);\r\n gfx.camera.aspect = shotAspect;\r\n gfx.camera.fov = tan2Fov(areaOfInterestTanFov2 / Math.min(shotAspect, 1.0));\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n // resize canvas to the required size of screenshot\r\n gfx.renderer.setDrawingBufferSize(width, height, 1);\r\n\r\n // make screenshot\r\n this._renderFrame(settings.now.stereo);\r\n screenshotURI = getDataURL();\r\n\r\n // restore original camera & canvas proportions\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.camera.aspect = originalAspect;\r\n gfx.camera.fov = originalFov;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.renderer.setDrawingBufferSize(gfx.width, gfx.height, window.devicePixelRatio);\r\n this._needRender = true;\r\n }\r\n\r\n return screenshotURI;\r\n};\r\n\r\n/**\r\n * Makes screenshot and initiates a download.\r\n * @param {string} [filename] - Name of a file. Default to a 'screenshot-XXXXX.png', where XXXXX is a current\r\n * date/time in seconds.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n */\r\nMiew.prototype.screenshotSave = function (filename, width, height) {\r\n const uri = this.screenshot(width, height);\r\n utils.shotDownload(uri, filename);\r\n};\r\n\r\nMiew.prototype.save = function (opts) {\r\n this._export(opts.fileType).then((dataString) => {\r\n const filename = this._visuals[this._curVisualName]._complex.name;\r\n utils.download(dataString, filename, opts.fileType);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone' });\r\n }).catch((error) => {\r\n this.logger.error('Could not export data');\r\n this.logger.debug(error);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone', error });\r\n });\r\n};\r\n\r\nMiew.prototype._tweakResolution = function () {\r\n const maxPerf = [\r\n ['poor', 100],\r\n ['low', 500],\r\n ['medium', 1000],\r\n ['high', 5000],\r\n ['ultra', Number.MAX_VALUE],\r\n ];\r\n\r\n let atomCount = 0;\r\n this._forEachComplexVisual((visual) => {\r\n atomCount += visual.getComplex().getAtomCount();\r\n });\r\n\r\n if (atomCount > 0) {\r\n const performance = this._gfxScore * 10e5 / atomCount;\r\n // set resolution based on estimated performance\r\n for (let i = 0; i < maxPerf.length; ++i) {\r\n if (performance < maxPerf[i][1]) {\r\n this._autoChangeResolution(maxPerf[i][0]);\r\n break;\r\n }\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._autoChangeResolution = function (resolution) {\r\n if (resolution !== settings.now.resolution) {\r\n this.logger.report(`Your rendering resolution was changed to \"${resolution}\" for best performance.`);\r\n }\r\n settings.now.resolution = resolution;\r\n};\r\n\r\n/**\r\n * Save current settings to cookies.\r\n */\r\nMiew.prototype.saveSettings = function () {\r\n this._cookies.setCookie(this._opts.settingsCookie, JSON.stringify(this.settings.getDiffs(true)));\r\n};\r\n\r\n/**\r\n * Load settings from cookies.\r\n */\r\nMiew.prototype.restoreSettings = function () {\r\n try {\r\n const cookie = this._cookies.getCookie(this._opts.settingsCookie);\r\n const diffs = cookie ? JSON.parse(cookie) : {};\r\n this.settings.applyDiffs(diffs, true);\r\n } catch (e) {\r\n this.logger.error(`Cookies parse error: ${e.message}`);\r\n }\r\n};\r\n\r\n/**\r\n * Reset current settings to the defaults.\r\n */\r\nMiew.prototype.resetSettings = function () {\r\n this.settings.reset();\r\n};\r\n\r\n/*\r\n * DANGEROUS and TEMPORARY. The method should change or disappear in future versions.\r\n * @param {string|object} opts - See {@link Miew} constructor.\r\n * @see {@link Miew#set}, {@link Miew#repAdd}, {@link Miew#rep}.\r\n */\r\nMiew.prototype.setOptions = function (opts) {\r\n if (typeof opts === 'string') {\r\n opts = Miew.options.fromAttr(opts);\r\n }\r\n if (opts.reps) {\r\n this._opts.reps = null;\r\n }\r\n _.merge(this._opts, opts);\r\n if (opts.settings) {\r\n this.set(opts.settings);\r\n }\r\n\r\n this._opts._objects = opts._objects;\r\n this._resetObjects();\r\n\r\n if (opts.load) {\r\n this.load(opts.load, { fileType: opts.type });\r\n }\r\n\r\n if (opts.preset) {\r\n settings.now.preset = opts.preset;\r\n }\r\n\r\n if (opts.reps) {\r\n this.resetReps(opts.preset);\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.getComplex().resetCurrentUnit();\r\n if (_.isNumber(opts.unit)) {\r\n visual.getComplex().setCurrentUnit(opts.unit);\r\n }\r\n this.resetView();\r\n this.rebuildAll();\r\n }\r\n};\r\n\r\nMiew.prototype.info = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return {};\r\n }\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n return {\r\n id: metadata.id || complex.name || 'UNKNOWN',\r\n title: (metadata.title && metadata.title.join(' ')) || 'UNKNOWN DATA',\r\n atoms: complex.getAtomCount(),\r\n bonds: complex.getBondCount(),\r\n residues: complex.getResidueCount(),\r\n chains: complex.getChainCount(),\r\n };\r\n};\r\n\r\n/*\r\n * OBJECTS SEGMENT\r\n */\r\n\r\nMiew.prototype.addObject = function (objData, bThrow) {\r\n let Ctor = null;\r\n\r\n if (objData.type === LinesObject.prototype.type) {\r\n Ctor = LinesObject;\r\n }\r\n\r\n if (Ctor === null) {\r\n throw new Error(`Unknown scene object type - ${objData.type}`);\r\n }\r\n\r\n try {\r\n const newObj = new Ctor(objData.params, objData.opts);\r\n this._addSceneObject(newObj);\r\n } catch (error) {\r\n if (!bThrow) {\r\n this.logger.debug(`Error during scene object creation: ${error.message}`);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._addSceneObject = function (sceneObject) {\r\n const visual = this._getComplexVisual();\r\n if (sceneObject.build && visual) {\r\n sceneObject.build(visual.getComplex());\r\n this._gfx.pivot.add(sceneObject.getGeometry());\r\n }\r\n const objects = this._objects;\r\n objects[objects.length] = sceneObject;\r\n};\r\n\r\nMiew.prototype._updateObjsToFrame = function (frameData) {\r\n const objs = this._objects;\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n if (objs[i].updateToFrame) {\r\n objs[i].updateToFrame(frameData);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._resetObjects = function () {\r\n const objs = this._opts._objects;\r\n\r\n this._objects = [];\r\n if (objs) {\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n this.addObject(objs[i], false);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype.removeObject = function (index) {\r\n const obj = this._objects[index];\r\n if (!obj) {\r\n throw new Error(`Scene object with index ${index} does not exist`);\r\n }\r\n obj.destroy();\r\n this._objects.splice(index, 1);\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Get a string with a URL to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {string} URL\r\n */\r\nMiew.prototype.getURL = function (opts) {\r\n return options.toURL(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n })));\r\n};\r\n\r\n/**\r\n * Get a string with a script to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=true] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=true] - when this flag is true, a view information is included\r\n * @returns {string} script\r\n */\r\nMiew.prototype.getScript = function (opts) {\r\n return options.toScript(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: true,\r\n view: true,\r\n })));\r\n};\r\n\r\n/*\r\n * Generates object that represents the current state of representations list\r\n * @param {boolean} compareWithDefaults - when this flag is true, reps list is compared (if possible)\r\n * to preset's defaults and only diffs are generated\r\n */\r\nMiew.prototype._compareReps = function (complexVisual, compareWithDefaults) {\r\n const ans = {};\r\n let repCount = 0;\r\n\r\n if (complexVisual) {\r\n repCount = complexVisual.repCount();\r\n }\r\n\r\n const currPreset = settings.defaults.presets[settings.now.preset];\r\n let compare = compareWithDefaults;\r\n if (currPreset === undefined || currPreset.length > repCount) {\r\n compare = false;\r\n ans.preset = 'empty';\r\n } else if (settings.now.preset !== settings.defaults.preset) {\r\n ans.preset = settings.now.preset;\r\n }\r\n\r\n const repsDiff = [];\r\n let emptyReps = true;\r\n for (let i = 0, n = repCount; i < n; ++i) {\r\n repsDiff[i] = complexVisual.repGet(i).compare(compare ? currPreset[i] : null);\r\n if (!_.isEmpty(repsDiff[i])) {\r\n emptyReps = false;\r\n }\r\n }\r\n if (!emptyReps) {\r\n ans.reps = repsDiff;\r\n }\r\n return ans;\r\n};\r\n\r\n/*\r\n * Obtain object that represents current state of miew (might be used as options in constructor).\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {Object} State object.\r\n */\r\nMiew.prototype.getState = function (opts) {\r\n const state = {};\r\n\r\n opts = _.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n });\r\n\r\n // load\r\n const visual = this._getComplexVisual();\r\n if (visual !== null) {\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n if (metadata.id) {\r\n const format = metadata.format ? `${metadata.format}:` : '';\r\n state.load = format + metadata.id;\r\n }\r\n const unit = complex.getCurrentUnit();\r\n if (unit !== 1) {\r\n state.unit = unit;\r\n }\r\n }\r\n\r\n // representations\r\n const repsInfo = this._compareReps(visual, opts.compact);\r\n if (repsInfo.preset) {\r\n state.preset = repsInfo.preset;\r\n }\r\n\r\n if (repsInfo.reps) {\r\n state.reps = repsInfo.reps;\r\n }\r\n\r\n // objects\r\n const objects = this._objects;\r\n const objectsState = [];\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n objectsState[i] = objects[i].identify();\r\n }\r\n if (objects.length > 0) {\r\n state._objects = objectsState;\r\n }\r\n\r\n // view\r\n if (opts.view) {\r\n state.view = this.view();\r\n }\r\n\r\n // settings\r\n if (opts.settings) {\r\n const diff = this.settings.getDiffs(false);\r\n if (!_.isEmpty(diff)) {\r\n state.settings = diff;\r\n }\r\n }\r\n\r\n return state;\r\n};\r\n\r\n/**\r\n * Get parameter value.\r\n * @param {string} param - Parameter name or path (e.g. 'modes.BS.atom').\r\n * @param {*=} value - Default value.\r\n * @returns {*} Parameter value.\r\n */\r\nMiew.prototype.get = function (param, value) {\r\n return settings.get(param, value);\r\n};\r\n\r\nMiew.prototype._clipPlaneUpdateValue = function (radius) {\r\n const clipPlaneValue = Math.max(\r\n this._gfx.camera.position.z - radius * settings.now.draft.clipPlaneFactor,\r\n settings.now.camNear,\r\n );\r\n\r\n const opts = { clipPlaneValue };\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions(opts);\r\n });\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setUberOptions(opts);\r\n }\r\n }\r\n if (this._picker !== null) {\r\n this._picker.clipPlaneValue = clipPlaneValue;\r\n }\r\n};\r\n\r\nMiew.prototype._fogFarUpdateValue = function () {\r\n if (this._picker !== null) {\r\n if (this._gfx.scene.fog) {\r\n this._picker.fogFarValue = this._gfx.scene.fog.far;\r\n } else {\r\n this._picker.fogFarValue = undefined;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._updateShadowmapMeshes = function (process) {\r\n this._forEachComplexVisual((visual) => {\r\n const reprList = visual._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n process(repr.geo, repr.material);\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._updateMaterials = function (values, needTraverse = false, process = undefined) {\r\n this._forEachComplexVisual((visual) => visual.setMaterialValues(values, needTraverse, process));\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setValues(values);\r\n obj._line.material.needsUpdate = true;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._fogAlphaChanged = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions({\r\n fogAlpha: settings.now.fogAlpha,\r\n });\r\n });\r\n};\r\n\r\nMiew.prototype._embedWebXR = function () {\r\n // switch off\r\n if (settings.now.stereo !== 'WEBVR') {\r\n if (this.webVR) {\r\n this.webVR.disable();\r\n }\r\n this.webVR = null;\r\n return;\r\n }\r\n // switch on\r\n if (!this.webVR) {\r\n this.webVR = new WebVRPoC(() => {\r\n this._requestAnimationFrame(() => this._onTick());\r\n this._needRender = true;\r\n this._onResize();\r\n });\r\n }\r\n this.webVR.enable(this._gfx);\r\n};\r\n\r\nMiew.prototype._initOnSettingsChanged = function () {\r\n const on = (props, func) => {\r\n props = _.isArray(props) ? props : [props];\r\n props.forEach((prop) => {\r\n this.settings.addEventListener(`change:${prop}`, func);\r\n });\r\n };\r\n\r\n on('modes.VD.frame', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.showFrame(settings.now.modes.VD.frame);\r\n this._needRender = true;\r\n });\r\n\r\n on('modes.VD.isoMode', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n });\r\n\r\n on('bg.color', () => {\r\n this._onBgColorChanged();\r\n });\r\n\r\n on('ao', () => {\r\n if (settings.now.ao && !isAOSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support ao');\r\n settings.set('ao', false);\r\n } else {\r\n const values = { normalsToGBuffer: settings.now.ao };\r\n this._setUberMaterialValues(values);\r\n }\r\n });\r\n\r\n on('zSprites', () => {\r\n if (settings.now.zSprites && !arezSpritesSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support zSprites');\r\n settings.set('zSprites', false);\r\n }\r\n this.rebuildAll();\r\n });\r\n\r\n on('fogColor', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('fogColorEnable', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('bg.transparent', (evt) => {\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n // update materials\r\n this._updateMaterials({ fogTransparent: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('draft.clipPlane', (evt) => {\r\n // update materials\r\n this._updateMaterials({ clipPlane: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('shadow.on', (evt) => {\r\n // update materials\r\n const values = { shadowmap: evt.value, shadowmapType: settings.now.shadow.type };\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.shadowMap.enabled = Boolean(values.shadowmap);\r\n }\r\n this._updateMaterials(values, true);\r\n if (values.shadowmap) {\r\n this._updateShadowCamera();\r\n this._updateShadowmapMeshes(meshutils.createShadowmapMaterial);\r\n } else {\r\n this._updateShadowmapMeshes(meshutils.removeShadowmapMaterial);\r\n }\r\n this._needRender = true;\r\n });\r\n\r\n on('shadow.type', (evt) => {\r\n // update materials if shadowmap is enable\r\n if (settings.now.shadow.on) {\r\n this._updateMaterials({ shadowmapType: evt.value }, true);\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on('shadow.radius', (evt) => {\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].shadow !== undefined) {\r\n const light = this._gfx.scene.children[i];\r\n light.shadow.radius = evt.value;\r\n this._needRender = true;\r\n }\r\n }\r\n });\r\n\r\n on('fps', () => {\r\n this._fps.show(settings.now.fps);\r\n });\r\n\r\n on(['fog', 'fogNearFactor', 'fogFarFactor'], () => {\r\n this._updateFog();\r\n this._needRender = true;\r\n });\r\n\r\n on('fogAlpha', () => {\r\n const { fogAlpha } = settings.now;\r\n if (fogAlpha < 0 || fogAlpha > 1) {\r\n this.logger.warn('fogAlpha must belong range [0,1]');\r\n }\r\n this._fogAlphaChanged();\r\n this._needRender = true;\r\n });\r\n\r\n on('autoResolution', (evt) => {\r\n if (evt.value && !this._gfxScore) {\r\n this.logger.warn('Benchmarks are missed, autoresolution will not work! '\r\n + 'Autoresolution should be set during miew startup.');\r\n }\r\n });\r\n\r\n on('stereo', () => {\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n this._needRender = true;\r\n });\r\n\r\n on(['transparency', 'palette'], () => {\r\n this.rebuildAll();\r\n });\r\n\r\n on('resolution', () => {\r\n // update complex visuals\r\n this.rebuildAll();\r\n\r\n // update volume visual\r\n const volume = this._getVolumeVisual();\r\n if (volume) {\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on(['axes', 'fxaa', 'ao',\r\n 'outline.on', 'outline.color', 'outline.threshold', 'outline.thickness'], () => {\r\n this._needRender = true;\r\n });\r\n};\r\n\r\n/**\r\n * Set parameter value.\r\n * @param {string|object} params - Parameter name or path (e.g. 'modes.BS.atom') or even settings object.\r\n * @param {*=} value - Value.\r\n */\r\nMiew.prototype.set = function (params, value) {\r\n settings.set(params, value);\r\n};\r\n\r\n/**\r\n * Select atoms with selection string.\r\n * @param {string} expression - string expression of selection\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\nMiew.prototype.select = function (expression, append) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n let sel = expression;\r\n if (_.isString(expression)) {\r\n sel = selectors.parse(expression).selector;\r\n }\r\n\r\n visual.select(sel, append);\r\n this._lastPick = null;\r\n\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n};\r\n\r\nconst VIEW_VERSION = '1';\r\n\r\n/**\r\n * Get or set view info packed into string.\r\n *\r\n * **Note:** view is stored for *left-handed* cs, euler angles are stored in radians and *ZXY-order*,\r\n *\r\n * @param {string=} expression - Optional string encoded the view\r\n */\r\nMiew.prototype.view = function (expression) {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n let transform = [];\r\n const eulerOrder = 'ZXY';\r\n\r\n function encode() {\r\n const pos = pivot.position;\r\n const scale = self._objectControls.getScale() / settings.now.radiusToFit;\r\n const euler = new THREE.Euler();\r\n euler.setFromQuaternion(self._objectControls.getOrientation(), eulerOrder);\r\n transform = [\r\n pos.x, pos.y, pos.z,\r\n scale,\r\n euler.x, euler.y, euler.z,\r\n ];\r\n return VIEW_VERSION + utils.arrayToBase64(transform, Float32Array);\r\n }\r\n\r\n function decode() {\r\n // backwards compatible: old non-versioned view is the 0th version\r\n if (expression.length === 40) {\r\n expression = `0${expression}`;\r\n }\r\n\r\n const version = expression[0];\r\n transform = utils.arrayFromBase64(expression.substr(1), Float32Array);\r\n\r\n // apply adapter for old versions\r\n if (version !== VIEW_VERSION) {\r\n if (version === '0') {\r\n // cancel radiusToFit included in old views\r\n transform[3] /= 8.0;\r\n } else {\r\n // do nothing\r\n self.logger.warn(`Encoded view version mismatch, stored as ${version} vs ${VIEW_VERSION} expected`);\r\n return;\r\n }\r\n }\r\n\r\n const interpolator = self._interpolator;\r\n const srcView = interpolator.createView();\r\n srcView.position.copy(pivot.position);\r\n srcView.scale = self._objectControls.getScale();\r\n srcView.orientation.copy(self._objectControls.getOrientation());\r\n\r\n const dstView = interpolator.createView();\r\n dstView.position.set(transform[0], transform[1], transform[2]);\r\n\r\n // hack to make preset views work after we moved centering offset to visual nodes\r\n // FIXME should only store main pivot offset in preset\r\n if (self._getComplexVisual()) {\r\n dstView.position.sub(self._getComplexVisual().position);\r\n }\r\n\r\n dstView.scale = transform[3]; // eslint-disable-line prefer-destructuring\r\n dstView.orientation.setFromEuler(new THREE.Euler(transform[4], transform[5], transform[6], eulerOrder));\r\n\r\n interpolator.setup(srcView, dstView);\r\n }\r\n\r\n if (typeof expression === 'undefined') {\r\n return encode();\r\n }\r\n decode();\r\n\r\n return expression;\r\n};\r\n\r\n/*\r\n * Update current view due to viewinterpolator state\r\n */\r\nMiew.prototype._updateView = function () {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n\r\n const interpolator = this._interpolator;\r\n if (!interpolator.wasStarted()) {\r\n interpolator.start();\r\n }\r\n\r\n if (!interpolator.isMoving()) {\r\n return;\r\n }\r\n\r\n const res = interpolator.getCurrentView();\r\n if (res.success) {\r\n const curr = res.view;\r\n pivot.position.copy(curr.position);\r\n self._objectControls.setScale(curr.scale * settings.now.radiusToFit);\r\n self._objectControls.setOrientation(curr.orientation);\r\n this.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n }\r\n};\r\n\r\n/**\r\n * Translate object by vector\r\n * @param {number} x - translation value (Ang) along model's X axis\r\n * @param {number} y - translation value (Ang) along model's Y axis\r\n * @param {number} z - translation value (Ang) along model's Z axis\r\n */\r\nMiew.prototype.translate = function (x, y, z) {\r\n this._objectControls.translatePivot(x, y, z);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Rotate object by Euler angles\r\n * @param {number} x - rotation angle around X axis in radians\r\n * @param {number} y - rotation angle around Y axis in radians\r\n * @param {number} z - rotation angle around Z axis in radians\r\n */\r\nMiew.prototype.rotate = function (x, y, z) {\r\n this._objectControls.rotate(new THREE.Quaternion().setFromEuler(new THREE.Euler(x, y, z, 'XYZ')));\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Scale object by factor\r\n * @param {number} factor - scale multiplier, should greater than zero\r\n */\r\nMiew.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n throw new RangeError('Scale should be greater than zero');\r\n }\r\n this._objectControls.scale(factor);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Center view on selection\r\n * @param {empty | subset | string} selector - defines part of molecule which must be centered (\r\n * empty - center on current selection;\r\n * subset - center on picked atom/residue/molecule;\r\n * string - center on atoms correspond to selection string)\r\n */\r\nMiew.prototype.center = function (selector) {\r\n // no arguments - center on current selection;\r\n if (selector === undefined) {\r\n this.setPivotSubset();\r\n this._needRender = true;\r\n return;\r\n }\r\n // subset with atom or residue - center on picked atom/residue;\r\n if (selector.obj !== undefined && ('atom' in selector.obj || 'residue' in selector.obj)) { // from event with selection\r\n if ('atom' in selector.obj) {\r\n this.setPivotAtom(selector.obj.atom);\r\n } else {\r\n this.setPivotResidue(selector.obj.residue);\r\n }\r\n this._needRender = true;\r\n return;\r\n }\r\n // string - center on atoms correspond to selection string\r\n if (selector.obj === undefined && selector !== '') {\r\n const sel = selectors.parse(selector);\r\n if (sel.error === undefined) {\r\n this.setPivotSubset(sel);\r\n this._needRender = true;\r\n return;\r\n }\r\n }\r\n // empty subset or incorrect/empty string - center on all molecule;\r\n this.resetPivot();\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\nMiew.prototype.within = function (selector, radius) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return selectors.None();\r\n }\r\n\r\n if (selector instanceof String) {\r\n selector = selectors.parse(selector);\r\n }\r\n\r\n const res = visual.within(selector, radius);\r\n if (res) {\r\n visual.rebuildSelectionGeometry();\r\n this._needRender = true;\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Get atom position in 2D canvas coords\r\n * @param {string} fullAtomName - full atom name, like A.38.CG\r\n * @returns {Object} {x, y} or false if atom not found\r\n */\r\nMiew.prototype.projected = function (fullAtomName, complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return false;\r\n }\r\n\r\n const atom = visual.getComplex().getAtomByFullname(fullAtomName);\r\n if (atom === null) {\r\n return false;\r\n }\r\n\r\n const pos = atom.position.clone();\r\n // we consider atom position to be affected only by common complex transform\r\n // ignoring any transformations that may add during editing\r\n this._gfx.pivot.updateMatrixWorldRecursive();\r\n this._gfx.camera.updateMatrixWorldRecursive();\r\n this._gfx.pivot.localToWorld(pos);\r\n pos.project(this._gfx.camera);\r\n\r\n return {\r\n x: (pos.x + 1.0) * 0.5 * this._gfx.width,\r\n y: (1.0 - pos.y) * 0.5 * this._gfx.height,\r\n };\r\n};\r\n\r\n/**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n *\r\n * @param {string=} complexName - complex name\r\n */\r\nMiew.prototype.dssp = function (complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return;\r\n }\r\n visual.getComplex().dssp();\r\n\r\n // rebuild dependent representations (cartoon or ss-colored)\r\n visual._reprList.forEach((rep) => {\r\n if (rep.mode.id === 'CA' || rep.colorer.id === 'SS') {\r\n rep.needsRebuild = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype.exportCML = function () {\r\n const self = this;\r\n\r\n function extractRotation(m) {\r\n const xAxis = new THREE.Vector3();\r\n const yAxis = new THREE.Vector3();\r\n const zAxis = new THREE.Vector3();\r\n m.extractBasis(xAxis, yAxis, zAxis);\r\n xAxis.normalize();\r\n yAxis.normalize();\r\n zAxis.normalize();\r\n const retMat = new THREE.Matrix4();\r\n retMat.identity();\r\n retMat.makeBasis(xAxis, yAxis, zAxis);\r\n return retMat;\r\n }\r\n\r\n function updateCMLData(complex) {\r\n const { root } = self._gfx;\r\n const mat = extractRotation(root.matrixWorld);\r\n const v4 = new THREE.Vector4(0, 0, 0, 0);\r\n const vCenter = new THREE.Vector4(0, 0, 0, 0);\r\n let xml = null;\r\n let ap = null;\r\n\r\n // update atoms in cml\r\n complex.forEachAtom((atom) => {\r\n if (atom.xmlNodeRef && atom.xmlNodeRef.xmlNode) {\r\n xml = atom.xmlNodeRef.xmlNode;\r\n ap = atom.position;\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n v4.applyMatrix4(mat);\r\n xml.setAttribute('x3', v4.x.toString());\r\n xml.setAttribute('y3', v4.y.toString());\r\n xml.setAttribute('z3', v4.z.toString());\r\n xml.removeAttribute('x2');\r\n xml.removeAttribute('y2');\r\n }\r\n });\r\n // update stereo groups in cml\r\n complex.forEachSGroup((sGroup) => {\r\n if (sGroup.xmlNodeRef && sGroup.xmlNodeRef.xmlNode) {\r\n xml = sGroup.xmlNodeRef.xmlNode;\r\n ap = sGroup.getPosition();\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n const cp = sGroup.getCentralPoint();\r\n if (cp === null) {\r\n v4.applyMatrix4(mat);\r\n } else {\r\n vCenter.set(cp.x, cp.y, cp.z, 0.0);\r\n v4.add(vCenter);\r\n v4.applyMatrix4(mat); // pos in global space\r\n vCenter.set(cp.x, cp.y, cp.z, 1.0);\r\n vCenter.applyMatrix4(mat);\r\n v4.sub(vCenter);\r\n }\r\n xml.setAttribute('x', v4.x.toString());\r\n xml.setAttribute('y', v4.y.toString());\r\n xml.setAttribute('z', v4.z.toString());\r\n }\r\n });\r\n }\r\n\r\n const visual = self._getComplexVisual();\r\n const complex = visual ? visual.getComplex() : null;\r\n if (complex && complex.originalCML) {\r\n updateCMLData(complex);\r\n\r\n // serialize xml structure to string\r\n const oSerializer = new XMLSerializer();\r\n return oSerializer.serializeToString(complex.originalCML);\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Reproduce the RCSB PDB Molecule of the Month style by David S. Goodsell\r\n *\r\n * @see http://pdb101.rcsb.org/motm/motm-about\r\n */\r\nMiew.prototype.motm = function () {\r\n settings.set({\r\n fogColorEnable: true,\r\n fogColor: 0x000000,\r\n outline: { on: true, threshold: 0.01 },\r\n bg: { color: 0xffffff },\r\n });\r\n\r\n this._forEachComplexVisual((visual) => {\r\n const rep = [];\r\n const complex = visual.getComplex();\r\n const palette = palettes.get(settings.now.palette);\r\n for (let i = 0; i < complex.getChainCount(); i++) {\r\n const curChainName = complex._chains[i]._name;\r\n const curChainColor = palette.getChainColor(curChainName);\r\n rep[i] = {\r\n selector: `chain ${curChainName}`,\r\n mode: 'VW',\r\n colorer: ['CB', { color: curChainColor, factor: 0.9 }],\r\n material: 'FL',\r\n };\r\n }\r\n visual.resetReps(rep);\r\n });\r\n};\r\n\r\nMiew.prototype.VERSION = (typeof PACKAGE_VERSION !== 'undefined' && PACKAGE_VERSION) || '0.0.0-dev';\r\n\r\n// Uncomment this to get debug trace:\r\n// Miew.prototype.debugTracer = new utils.DebugTracer(Miew.prototype);\r\n\r\n_.assign(Miew, /** @lends Miew */ {\r\n VERSION: Miew.prototype.VERSION,\r\n\r\n registeredPlugins: [],\r\n\r\n // export namespaces // TODO: WIP: refactoring external interface\r\n chem,\r\n io,\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n utils,\r\n gfx: {\r\n Representation,\r\n },\r\n\r\n /**\r\n * Third-party libraries packaged together with Miew.\r\n *\r\n * @property {object} lodash - [Lodash](https://lodash.com/), a modern JavaScript utility library delivering\r\n * modularity, performance & extras.\r\n * @property {object} three - [three.js](https://threejs.org/), JavaScript 3D library.\r\n *\r\n * @example\r\n * var _ = Miew.thirdParty.lodash;\r\n * var opts = _.merge({ ... }, Miew.options.fromURL(window.location.search));\r\n * var miew = new Miew(opts);\r\n */\r\n thirdParty: {\r\n lodash: _,\r\n three: THREE,\r\n },\r\n});\r\n\r\nexport default Miew;\r\n","import palettes from '../gfx/palettes';\r\nimport settings from '../settings';\r\n\r\nconst modeIdDesc = {\r\n $help: [\r\n 'Rendering mode shortcut',\r\n ' BS - balls and sticks mode',\r\n ' LN - lines mode',\r\n ' LC - licorice mode',\r\n ' VW - van der waals mode',\r\n ' TR - trace mode',\r\n ' TU - tube mode',\r\n ' CA - cartoon mode',\r\n ' SA - isosurface mode',\r\n ' QS - quick surface mode',\r\n ' SE - solvent excluded mode',\r\n ' TX - text mode',\r\n ],\r\n BS: {\r\n $help: [\r\n ' Balls and sticks',\r\n ' aromrad = #aromatic radius',\r\n ' atom = #atom radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n CA: {\r\n $help: [\r\n ' Cartoon',\r\n ' arrow = #arrow size',\r\n ' depth = #depth of surface',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = #',\r\n ' width = #secondary width\\n',\r\n ],\r\n },\r\n LN: {\r\n $help: [\r\n ' Lines',\r\n ' atom = #atom radius',\r\n ' chunkarom = ',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' offsarom = \\n',\r\n ],\r\n },\r\n LC: {\r\n $help: [\r\n ' Licorice',\r\n ' aromrad = #aromatic radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n VW: {\r\n $help: [\r\n ' Van der Waals',\r\n ' nothing\\n',\r\n ],\r\n },\r\n TR: {\r\n $help: [\r\n ' Trace',\r\n ' radius = #tube radius\\n',\r\n ],\r\n },\r\n TU: {\r\n $help: [\r\n ' Tube',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = \\n',\r\n ],\r\n },\r\n SA: {\r\n $help: [\r\n ' Surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n QS: {\r\n $help: [\r\n ' Quick surface',\r\n ' isoValue = ',\r\n ' scale = ',\r\n ' wireframe = ',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n SE: {\r\n $help: [\r\n ' Solvent excluded surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n TX: {\r\n $help: [\r\n ' Text mode',\r\n ' template = string that can include \"{{ id }}\"',\r\n ' it will be replaced by value, id can be one of next:',\r\n ' serial, name, type, sequence, residue, chain, hetatm, water\\n',\r\n ' horizontalAlign = {\"left\", \"right\", \"center\"}',\r\n ' verticalAlign = {\"top\", \"bottom\", \"middle\"}',\r\n ' dx = #offset along x',\r\n ' dy = #offset along y',\r\n ' dz = #offset along z',\r\n ' fg = #text color modificator',\r\n ' could be keyword, named color or hex',\r\n ' fg = #back color modificator',\r\n ' could be keyword, named color or hex',\r\n ' showBg = #if set show background',\r\n ' plate under text',\r\n ],\r\n },\r\n};\r\n\r\nconst colorDesc = {\r\n $help: [\r\n 'Coloring mode shortcut',\r\n ' EL - color by element',\r\n ' CH - color by chain',\r\n ' SQ - color by sequence',\r\n ' RT - color by residue type',\r\n ' SS - color by secondary structure',\r\n ' UN - uniform',\r\n ],\r\n UN: {\r\n $help: [\r\n 'Parameters of coloring modes customization',\r\n ' Uniform',\r\n ' color = #RGB->HEX->dec\\n',\r\n ],\r\n color: {\r\n $help: Object.keys(palettes.get(settings.now.palette).namedColors).sort().join('\\n'),\r\n },\r\n },\r\n};\r\n\r\nconst materialDesc = {\r\n $help: [\r\n 'Material shortcut',\r\n ' DF - diffuse',\r\n ' TR - transparent',\r\n ' SF - soft plastic',\r\n ' PL - glossy plastic',\r\n ' ME - metal',\r\n ' GL - glass',\r\n ],\r\n};\r\n\r\nconst addRepDesc = {\r\n $help: [\r\n 'Short (packed) representation description as a set of variables',\r\n ' s=',\r\n ' selector property',\r\n ' m=[!:[,...]]',\r\n ' render mode property',\r\n ' c=[!:[,...]]',\r\n ' color mode property',\r\n ' mt=',\r\n ' material property',\r\n ],\r\n s: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n m: modeIdDesc,\r\n c: colorDesc,\r\n mt: materialDesc,\r\n};\r\n\r\nconst setGetParameterDesc = {\r\n $help: [\r\n 'Parameters of rendering modes customization: modes',\r\n 'Parameters of colorer customization: colorers',\r\n 'Autobuild: autobuild = (|)',\r\n ],\r\n modes: modeIdDesc,\r\n colorers: colorDesc,\r\n};\r\n\r\nconst help = {\r\n $help: [\r\n 'help (| )',\r\n 'You can get detailed information about command options',\r\n ' using \"help cmd.opt.opt.[...]\"\\n',\r\n ' you can use one line comments',\r\n ' everything started from (#|//) will be skipped',\r\n ' Example: >build //some comment\\n',\r\n 'List of available commands:',\r\n ],\r\n reset: {\r\n $help: [\r\n 'Reload current object, delete all representations',\r\n ' Nothing will work until load new object',\r\n ],\r\n },\r\n load: {\r\n $help: [\r\n 'load (||-f [<*.NC FILE URL STRING>])',\r\n ' Load new pdb object from selected source',\r\n ],\r\n PDBID: {\r\n $help: 'pdb id in remote molecule database',\r\n },\r\n URL: {\r\n $help: 'url to source file',\r\n },\r\n f: {\r\n $help: [\r\n 'open file system dialog to fetch local file',\r\n 'optionally you can determine trajectory file',\r\n 'via URL for *.top model',\r\n ],\r\n },\r\n },\r\n clear: {\r\n $help: 'No args. Clear terminal',\r\n },\r\n add: {\r\n $help: [\r\n 'add [] []',\r\n ' Add new item to representation set with',\r\n ' default or params',\r\n ],\r\n REP_NAME: {\r\n $help: 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n rep: {\r\n $help: [\r\n 'rep [|] []',\r\n ' set current representation by name or index',\r\n ' edit current representation by ',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n remove: {\r\n $help: [\r\n 'remove (|)',\r\n 'Remove representation by name or index',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n },\r\n selector: {\r\n $help: [\r\n 'selector ',\r\n ' set selector from EXPRESSION to current representation',\r\n ],\r\n EXPRESSION: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n },\r\n mode: {\r\n $help: [\r\n 'mode [=...]',\r\n ' set rendering mode and apply parameters to current representation',\r\n ],\r\n MODE_ID: modeIdDesc,\r\n },\r\n color: {\r\n $help: [\r\n 'color [=...]',\r\n ' set colorer and apply parameters to current representation',\r\n ],\r\n COLORER_ID: colorDesc,\r\n },\r\n material: {\r\n $help: [\r\n 'material ',\r\n ' set material to current representation',\r\n ],\r\n MATERIAL_ID: materialDesc,\r\n },\r\n build: {\r\n $help: 'build help str',\r\n add: {\r\n $help: 'build.add',\r\n new: {\r\n $help: [\r\n 'add.new',\r\n 'add.new new line 1',\r\n 'add.new new line 2',\r\n 'add.new new line 3',\r\n ],\r\n },\r\n },\r\n del: {\r\n $help: 'build.del',\r\n },\r\n },\r\n list: {\r\n $help: [\r\n 'list [-e|-s||]',\r\n 'Print representations if no args print list of representations',\r\n ' -e expand list and show all representations',\r\n ' -s show all user-registered selectors',\r\n ' | show only current representation',\r\n ],\r\n },\r\n hide: {\r\n $help: [\r\n 'hide (|)',\r\n 'Hide representation referenced in args',\r\n ],\r\n },\r\n show: {\r\n $help: [\r\n 'show (|)',\r\n 'Show representation referenced in args',\r\n ],\r\n },\r\n get: {\r\n $help: [\r\n 'get ',\r\n 'Print value',\r\n ' - path to option use get.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set: {\r\n $help: [\r\n 'set ',\r\n 'Set with ',\r\n ' - path to option use set.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set_save: {\r\n $help: [\r\n 'set_save',\r\n 'Save current settings to cookie',\r\n ],\r\n },\r\n set_restore: {\r\n $help: [\r\n 'set_restore',\r\n 'Load and apply settings from cookie',\r\n ],\r\n },\r\n set_reset: {\r\n $help: [\r\n 'set_reset',\r\n 'Reset current settings to the defaults',\r\n ],\r\n },\r\n preset: {\r\n $help: [\r\n 'preset []',\r\n 'Reset current representation or set preset to ',\r\n ],\r\n PRESET: {\r\n $help: [\r\n 'default',\r\n 'wire',\r\n 'small',\r\n 'macro',\r\n ],\r\n },\r\n },\r\n unit: {\r\n $help: [\r\n 'unit []',\r\n 'Change current biological structure view. Zero value means asymmetric unit,',\r\n 'positive values set an assembly with corresponding number.',\r\n 'Being called with no parameters command prints current unit information.',\r\n ],\r\n },\r\n view: {\r\n $help: [\r\n 'view []',\r\n 'Get current encoded view or set if ENCODED_VIEW placed as argument',\r\n ],\r\n ENCODED_VIEW: {\r\n $help: [\r\n 'encoded view matrix string (binary code)',\r\n ],\r\n },\r\n },\r\n rotate: {\r\n $help: [\r\n 'rotate (x|y|z) [] [(x|y|z) []]...',\r\n 'Rotate scene',\r\n ],\r\n },\r\n scale: {\r\n $help: [\r\n 'scale ',\r\n 'Scale scene',\r\n ],\r\n },\r\n select: {\r\n $help: [\r\n 'select [as ]',\r\n 'Select atoms using selector defined in SELECTOR_STRING',\r\n ' and if SELECTOR_NAME is defined register it in viewer',\r\n ' you can use it later as a complex selector',\r\n ],\r\n },\r\n within: {\r\n $help: [\r\n 'within of as ',\r\n 'Build within named selector',\r\n ' DISTANCE ',\r\n ' SELECTOR_STRING ',\r\n ' SELECTOR_NAME ',\r\n ],\r\n },\r\n url: {\r\n $help: [\r\n 'url [-s] [-v]',\r\n 'Report URL encoded scene',\r\n ' if -s set that include settings in the URL',\r\n ' if -v set that include view in the URL',\r\n ],\r\n },\r\n screenshot: {\r\n $help: [\r\n 'screenshot [ []]',\r\n 'Make a screenshot of the scene',\r\n ' WIDTH in pixels',\r\n ' HEIGHT in pixels, equal to WIDTH by default',\r\n ],\r\n },\r\n line: {\r\n $help: [\r\n 'line [=]',\r\n 'Draw dashed line between two specified atoms',\r\n ],\r\n },\r\n removeobj: {\r\n $help: [\r\n 'removeobj ',\r\n 'Remove scene object by its index. Indices could be obtained by command',\r\n ],\r\n },\r\n listobj: {\r\n $help: [\r\n 'listobj',\r\n 'Display the list of all existing scene objects',\r\n ],\r\n },\r\n};\r\n\r\nexport default help;\r\n","import _ from 'lodash';\r\nimport Miew from './Miew';\r\nimport { parser as parsercli } from './utils/MiewCLIParser';\r\nimport clihelp from './utils/MiewCLIHelp';\r\nimport logger from './utils/logger';\r\nimport utils from './utils';\r\n\r\nconst {\r\n chem: { selectors },\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n} = Miew;\r\n\r\nfunction None() {\r\n}\r\n\r\nconst NULL = (function () {\r\n const obj = new None();\r\n return function () {\r\n return obj;\r\n };\r\n}());\r\n\r\nclass RepresentationMap {\r\n constructor() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n\r\n get(strId) {\r\n return this.representationMap[strId] || this.representationID[strId] || '';\r\n }\r\n\r\n add(strId, index) {\r\n if (strId === -1) {\r\n return 'Can not create representation: there is no data';\r\n }\r\n\r\n if (index !== undefined) {\r\n if (!this.representationMap.hasOwnProperty(strId)) {\r\n this.representationMap[strId.toString()] = index;\r\n this.representationID[index] = strId.toString();\r\n } else {\r\n return 'This name has already existed, registered without name';\r\n }\r\n }\r\n return `Representation ${strId} successfully added`;\r\n }\r\n\r\n remove(index) {\r\n if (index && this.representationID.hasOwnProperty(index)) {\r\n delete this.representationMap[this.representationID[index]];\r\n delete this.representationID[index];\r\n }\r\n\r\n const sortedKeys = Object.keys(this.representationID).sort();\r\n for (const i in sortedKeys) {\r\n if (sortedKeys.hasOwnProperty(i)) {\r\n const id = sortedKeys[i];\r\n if (id > index) {\r\n this.representationID[id - 1] = this.representationID[id];\r\n this.representationMap[this.representationID[id]] -= 1;\r\n delete this.representationID[id];\r\n }\r\n }\r\n }\r\n }\r\n\r\n clear() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n}\r\n\r\nconst representationsStorage = new RepresentationMap();\r\n\r\nfunction keyRemap(key) {\r\n const keys = {\r\n s: 'selector',\r\n m: 'mode',\r\n c: 'colorer',\r\n mt: 'material',\r\n mode: 'modes',\r\n color: 'colorers',\r\n colorer: 'colorers',\r\n select: 'selector',\r\n material: 'materials',\r\n selector: 'selector',\r\n };\r\n const ans = keys[key];\r\n return ans === undefined ? key : ans;\r\n}\r\n\r\nclass CLIUtils {\r\n list(miew, repMap, key) {\r\n let ret = '';\r\n if (miew && repMap !== undefined) {\r\n if (key === undefined || key === '-e') {\r\n const count = miew.repCount();\r\n\r\n for (let i = 0; i < count; i++) {\r\n ret += this.listRep(miew, repMap, i, key);\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n\r\n listRep(miew, repMap, repIndex, key) {\r\n let ret = '';\r\n const rep = miew.repGet(repIndex);\r\n if (!rep) {\r\n logger.warn(`Rep ${repIndex} does not exist!`);\r\n return ret;\r\n }\r\n const index = repIndex;\r\n const repName = repMap.get(index);\r\n\r\n const { mode, colorer } = rep;\r\n const selectionStr = rep.selectorString;\r\n const material = rep.materialPreset;\r\n\r\n ret += `#${index} : ${mode.name}${repName === '' ? '' : `, ${repName}`}\\n`;\r\n\r\n if (key !== undefined) {\r\n ret += ` selection : \"${selectionStr}\"\\n`;\r\n ret += ` mode : (${mode.id}), ${mode.name}\\n`;\r\n ret += ` colorer : (${colorer.id}), ${colorer.name}\\n`;\r\n ret += ` material : (${material.id}), ${material.name}\\n`;\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listSelector(miew, context) {\r\n let ret = '';\r\n\r\n for (const k in context) {\r\n if (context.hasOwnProperty(k)) {\r\n ret += `${k} : \"${context[k]}\"\\n`;\r\n }\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listObjs(miew) {\r\n const objs = miew._objects;\r\n\r\n if (!objs || !Array.isArray(objs) || objs.length === 0) {\r\n return 'There are no objects on the scene';\r\n }\r\n\r\n const strList = [];\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n strList[i] = `${i}: ${objs[i].toString()}`;\r\n }\r\n\r\n return strList.join('\\n');\r\n }\r\n\r\n joinHelpStr(helpData) {\r\n if (helpData instanceof Array) {\r\n return helpData.join('\\n');\r\n }\r\n return helpData;\r\n }\r\n\r\n help(path) {\r\n if (_.isUndefined(path)) {\r\n return `${this.joinHelpStr(clihelp.$help)}\\n${_.slice(_.sortBy(_.keys(clihelp)), 1).join(', ')}\\n`;\r\n }\r\n\r\n const helpItem = _.get(clihelp, path);\r\n return _.isUndefined(helpItem) ? this.help() : `${this.joinHelpStr(helpItem.$help)}\\n`;\r\n }\r\n\r\n load(miew, arg) {\r\n if (miew === undefined || arg === undefined || arg === '-f') {\r\n return;\r\n }\r\n miew.awaitWhileCMDisInProcess();\r\n const finish = () => miew.finishAwaitingCMDInProcess();\r\n miew.load(arg).then(finish, finish);\r\n }\r\n\r\n checkArg(key, arg, modificate) {\r\n if (key !== undefined && arg !== undefined) {\r\n if (keyRemap(key) === 'selector') {\r\n const res = selectors.parse(arg);\r\n\r\n if (res.error !== undefined) {\r\n const selExc = { message: res.error };\r\n throw selExc;\r\n }\r\n\r\n if (modificate !== undefined && modificate) {\r\n return res.selector;\r\n }\r\n return arg;\r\n }\r\n\r\n const modificators = {\r\n colorers,\r\n modes,\r\n materials,\r\n };\r\n\r\n let modificator = key;\r\n let temp;\r\n while (modificator !== temp) {\r\n temp = modificator;\r\n modificator = keyRemap(temp);\r\n }\r\n\r\n if (modificators[modificator].get(arg) === undefined) {\r\n const exc = { message: `${arg} is not existed in ${modificator}` };\r\n throw exc;\r\n }\r\n return arg;\r\n }\r\n return NULL;\r\n }\r\n\r\n propagateProp(path, arg) {\r\n if (path !== undefined) {\r\n let argExc = {};\r\n const adapter = options.adapters[typeof _.get(settings.defaults, path)];\r\n if (adapter === undefined) {\r\n const pathExc = { message: `${path} is not existed` };\r\n throw pathExc;\r\n }\r\n\r\n if ((path.endsWith('.color') || path.endsWith('.baseColor')\r\n || path.endsWith('.EL.carbon')) && typeof arg !== 'number') {\r\n arg = palettes.get(settings.now.palette).getNamedColor(arg);\r\n }\r\n\r\n if (path.endsWith('.fg') || path.endsWith('.bg')) {\r\n if (typeof arg !== 'number') {\r\n const val = palettes.get(settings.now.palette).getNamedColor(arg, true);\r\n if (val !== undefined) {\r\n arg = `0x${val.toString(16)}`;\r\n }\r\n } else {\r\n arg = `0x${arg.toString(16)}`;\r\n }\r\n }\r\n\r\n if (path.endsWith('.template')) {\r\n arg = arg.replace(/\\\\n/g, '\\n');// NOSONAR\r\n }\r\n\r\n if (arg !== undefined && adapter(arg) !== arg && adapter(arg) !== (arg > 0)) {\r\n argExc = { message: `${path} must be a \"${typeof _.get(settings.defaults, path)}\"` };\r\n throw argExc;\r\n }\r\n }\r\n return arg;\r\n }\r\n\r\n unquoteString(value) {\r\n return utils.unquoteString(value);\r\n }\r\n}\r\n// repIndexOrRepMap could be RepresentationMap or index\r\n\r\nconst utilFunctions = new CLIUtils();\r\n\r\nfunction CreateObjectPair(a, b) {\r\n const obj = {};\r\n obj[a] = b;\r\n return obj;\r\n}\r\n\r\nfunction ArgList(arg) {\r\n if (arg instanceof this.constructor) {\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n}\r\n\r\nArgList.prototype.append = function (value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n};\r\n\r\nArgList.prototype.remove = function (value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n};\r\n\r\nArgList.prototype.toJSO = function (cliUtils, cmd, arg) {\r\n const res = {};\r\n\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n _.set(res, list[i].id, cliUtils.propagateProp(`${keyRemap(cmd)}.${arg}.${list[i].id}`, list[i].val));\r\n }\r\n\r\n return res;\r\n};\r\n\r\nfunction Arg(_id, _val) {\r\n this.id = _id;\r\n this.val = _val;\r\n}\r\n\r\nconst cliutils = Object.create({});\r\n\r\ncliutils.Arg = Arg;\r\ncliutils.ArgList = ArgList;\r\n\r\ncliutils.miew = null;\r\ncliutils.echo = null;\r\ncliutils.representations = representationsStorage;\r\ncliutils.utils = utilFunctions;\r\n\r\ncliutils._ = _;\r\ncliutils.CreateObjectPair = CreateObjectPair;\r\ncliutils.keyRemap = keyRemap;\r\ncliutils.Context = selectors.Context;\r\ncliutils.ClearContext = selectors.ClearContext;\r\n\r\ncliutils.NULL = NULL;\r\n\r\ncliutils.notimplemented = function () {\r\n return this.NULL;\r\n};\r\n\r\nMiew.prototype.script = function (script, _printCallback, _errorCallback) {\r\n parsercli.yy.miew = this;\r\n parsercli.yy.echo = _printCallback;\r\n parsercli.yy.error = _errorCallback;\r\n if (this.cmdQueue === undefined) {\r\n this.cmdQueue = [];\r\n }\r\n\r\n if (this.commandInAction === undefined) {\r\n this.commandInAction = false;\r\n }\r\n\r\n this.cmdQueue = this.cmdQueue.concat(script.split('\\n'));\r\n};\r\n\r\nMiew.prototype.awaitWhileCMDisInProcess = function () {\r\n this.commandInAction = true;\r\n};\r\n\r\nMiew.prototype.finishAwaitingCMDInProcess = function () {\r\n this.commandInAction = false;\r\n};\r\n\r\nMiew.prototype.isScriptingCommandAvailable = function () {\r\n return this.commandInAction !== undefined\r\n && !this.commandInAction\r\n && this.cmdQueue !== undefined\r\n && this.cmdQueue.length > 0;\r\n};\r\n\r\nMiew.prototype.callNextCmd = function () {\r\n if (this.isScriptingCommandAvailable()) {\r\n const cmd = this.cmdQueue.shift();\r\n\r\n const res = {};\r\n res.success = false;\r\n try {\r\n parsercli.parse(cmd);\r\n res.success = true;\r\n } catch (e) {\r\n res.error = e.message;\r\n parsercli.yy.error(res.error);\r\n this.finishAwaitingCMDInProcess();\r\n }\r\n return res;\r\n }\r\n return '';\r\n};\r\n\r\nparsercli.yy = cliutils;\r\n// workaround for incorrect JISON parser generator for AMD module\r\nparsercli.yy.parseError = parsercli.parseError;\r\n","import Miew from './Miew';\r\nimport './Miew-cli';\r\n\r\nexport default Miew;\r\n"],"names":["parser","o","k","v","l","length","$V0","$V1","$V2","$V3","$V4","$V5","$V6","$V7","$V8","$V9","$Va","$Vb","$Vc","$Vd","$Ve","$Vf","$Vg","$Vh","$Vi","$Vj","$Vk","$Vl","$Vm","$Vn","$Vo","$Vp","$Vq","$Vr","$Vs","$Vt","$Vu","$Vv","$Vw","$Vx","$Vy","$Vz","$VA","$VB","$VC","$VD","$VE","$VF","$VG","$VH","$VI","$VJ","$VK","$VL","$VM","$VN","$VO","$VP","$VQ","$VR","$VS","$VT","$VU","$VV","$VW","$VX","$VY","$VZ","$V_","$V$","$V01","$V11","$V21","$V31","$V41","$V51","$V61","trace","yy","symbols_","terminals_","productions_","performAction","anonymous","yytext","yyleng","yylineno","yystate","$$","_$","$0","$","miew","reset","ClearContext","resetReps","rebuild","rebuildAll","echo","utils","help","toString","motm","propagateProp","get","set","saveSettings","restoreSettings","resetSettings","applyPreset","repRemove","representations","remove","repHide","listRep","list","listSelector","Context","select","checkArg","toLowerCase","rep","repCurrent","selector","within","Number","material","toUpperCase","view","changeUnit","dssp","scale","i","n","rotate","Math","PI","translate","center","addObject","type","params","opts","toJSO","listObjs","removeObject","getURL","settings","screenshotSave","load","clear","add","repAdd","mode","Array","colorer","_","assign","CreateObjectPair","key","val","Object","create","keyRemap","concat","ArgList","append","Arg","parseInt","JSON","parse","String","table","defaultActions","parseError","str","hash","recoverable","error","Error","input","self","stack","tstack","vstack","lstack","recovering","TERROR","EOF","args","slice","call","arguments","lexer","sharedState","prototype","hasOwnProperty","setInput","yylloc","yyloc","push","ranges","options","getPrototypeOf","popStack","lex","token","pop","symbol","preErrorSymbol","state","action","a","r","yyval","p","len","newState","expected","errStr","showPosition","join","text","match","line","loc","first_line","last_line","first_column","last_column","range","apply","_input","_more","_backtrack","done","matched","conditionStack","offset","ch","lines","unput","split","substr","oldLines","more","reject","backtrack_lexer","less","pastInput","past","replace","upcomingInput","next","pre","c","test_match","indexed_rule","backup","matches","tempMatch","index","rules","_currentRules","flex","begin","condition","popState","conditions","topState","abs","pushState","stateStackSize","yy_","$avoiding_name_collisions","YY_START","YYSTATE","unquoteString","Parser","module","exports","keyword","GetSelector","RangeList","Range","ValueList","AbstractInterpolator","CubicInterpolator","Enum","LinearInterpolator","NearestInterpolator","SincFilterInterpolator","Smooth","clipClamp","clipMirror","clipPeriodic","defaultConfig","getColumn","getType","isValidNumber","makeLanczosWindow","makeScaledFunction","makeSincKernel","normalizeScaleTo","shallowCopy","sin","sinc","validateNumber","validateVector","__hasProp","__extends","child","parent","ctor","constructor","__super__","METHOD_NEAREST","METHOD_LINEAR","METHOD_CUBIC","METHOD_LANCZOS","METHOD_SINC","CLIP_CLAMP","CLIP_ZERO","CLIP_PERIODIC","CLIP_MIRROR","CUBIC_TENSION_DEFAULT","CUBIC_TENSION_CATMULL_ROM","method","cubicTension","clip","scaleTo","sincFilterSize","sincWindow","max","min","period","array","config","clipHelper","clamp","clipHelperClamp","zero","clipHelperZero","periodic","clipHelperPeriodic","mirror","clipHelperMirror","getClippedInput","interpolate","t","_super","round","floor","tangentFactor","getTangent","m","t2","t3","x","window","kernel","sum","_ref","_ref2","arr","row","_i","_len","_results","f","baseScale","scaleRange","scaleFactor","translation","isNaN","isFinite","dimension","s","invalidErr","obj","copy","baseDomainEnd","interpolator","interpolatorClass","interpolators","properties","smoothFunc","lanczosFilterSize","nearest","linear","cubic","lanczos","count","_j","_len2","deepValidation","_k","_len3","domain","sort","define","amd","MMTF","e","byteLength","charCodeAt","setUint8","u","setUint16","setUint32","Uint8Array","buffer","setFloat64","setInt8","setInt16","setInt32","isArray","d","keys","ArrayBuffer","DataView","byteOffset","Int8Array","Int32Array","Float32Array","Int16Array","g","L","h","setFloat32","getFloat32","y","U","b","I","w","C","ceil","A","M","F","S","E","N","O","T","getInt32","subarray","j","q","D","P","z","B","V","G","R","rr","forEach","bondAtomList","bondOrderList","xCoordList","yCoordList","zCoordList","bFactorList","atomIdList","altLocList","occupancyList","groupIdList","groupTypeList","secStructList","insCodeList","sequenceIndexList","chainIdList","chainNameList","H","fromCharCode","getInt8","getUint8","getUint16","getUint32","getFloat64","getInt16","W","X","ignoreFields","nr","indexOf","J","K","firstModelOnly","onModel","onChain","onGroup","onAtom","onBond","chainsPerModel","chainCount","modelIndex","groupsPerChain","groupCount","chainIndex","chainId","chainName","groupList","atomNameList","atomCount","groupIndex","groupId","groupType","groupName","singleLetterCode","chemCompType","secStruct","insCode","sequenceIndex","atomIndex","atomId","element","elementList","atomName","formalCharge","formalChargeList","xCoord","yCoord","zCoord","bFactor","altLoc","occupancy","atomIndex1","atomIndex2","bondOrder","Q","Y","Z","response","XMLHttpRequest","addEventListener","responseType","open","send","or","ar","tr","er","ir","encode","decode","traverse","fetch","fetchReduced","version","fetchUrl","fetchReducedUrl","encodeMsgpack","encodeMmtf","decodeMsgpack","decodeMmtf","__assign","defaults","width","radius","corners","color","fadeColor","animation","direction","speed","zIndex","className","top","left","shadow","position","Spinner","spin","target","stop","el","document","createElement","setAttribute","style","transform","insertBefore","firstChild","drawLines","parentNode","removeChild","undefined","getColor","idx","borderRadius","shadows","parseBoxShadow","degrees","backgroundLine","height","background","transformOrigin","delay","boxShadow","normalizeShadow","appendChild","regex","_a","xUnits","yUnits","prefix","end","normalized","shadows_1","xy","convertOffset","radians","cos","Timer","startTime","oldTime","elapsedTime","running","start","now","getElapsedTime","update","delta","newTime","performance","bind","Date","tag","id","css","cssText","Stats","domElement","_text","_startTime","_prevTime","_deltas","_index","_total","_count","time","ms","fps","textContent","toPrecision","show","on","display","isUndefOrEqual","param","value","EventDispatcher","_handlers","callback","context","handlers","_checkPar","par","find","removeEventListener","handler","ev","values","omitBy","dispatchEvent","event","priorities","debug","info","report","warn","Logger","console","_priority","instantiate","verify","number","isNumber","defineProperty","findKey","level","levels","message","priority","_message","output","log","logger","browserType","DEFAULT","SAFARI","encodeQueryComponent","excludeExp","code","encodeURIComponent","decodeQueryComponent","decodeURIComponent","getUrlParameters","url","location","search","query","substring","result","exec","getUrlParametersAsDict","resolveURL","URL","href","anchor","generateRegExp","symbolStr","symbolList","listStr","RegExp","attrs","content","createTextNode","HTMLElement","deriveClass","cls","base","members","statics","deriveDeep","needZeroOwnProperties","res","hexColor","hex","DebugTracer","namespace","enabled","enable","indent","methods","wrap","method_","name_","spaces","_key","name","Function","OutOfMemoryError","allocateTyped","TypedArrayName","size","RangeError","bytesToBase64","bytes","binary","btoa","bytesFromBase64","atob","arrayToBase64","TypedArrayClass","arrayFromBase64","compareOptionsWithDefaults","defOpts","optsStr","isAlmostPlainObject","isPlainObject","proto","objectsDiff","src","dst","diff","forIn","srcValue","dstValue","deepDiff","isEmpty","isEqual","forInRecursive","object","iterateThrough","newPref","enquoteString","isString","SyntaxError","getFileExtension","fileName","lastIndexOf","Infinity","splitFileName","ext","dataUrlToBlob","parts","partsCount","Blob","getBrowser","navigator","vendor","userAgent","shotOpen","write","shotDownload","dataUrl","filename","msSaveBlob","link","download","innerHTML","createObjectURL","body","click","data","blobData","copySubArrays","indices","itemSize","shallowCloneNode","node","newNode","cloneNode","worldPos","unquotedStringRE","enquoteHelper","correctSelectorIdentifier","test","concatTypedArraysUnsafe","first","second","mergeTypedArraysUnsafe","reduce","acc","cur","JobHandle","_shouldCancel","cancel","shouldCancel","notify","slaveEvent","VERSION","modes","BS","atom","bond","space","multibond","aromrad","showarom","polyComplexity","poor","low","medium","high","ultra","VW","LN","offsarom","chunkarom","lineWidth","LC","SA","zClip","probeRadius","subset","wireframe","SE","QS","isoValue","gaussLim","gridSpacing","CS","probePositions","TR","TU","heightSegmentsRatio","tension","CA","depth","ss","helix","arrow","strand","TX","template","horizontalAlign","verticalAlign","dx","dy","dz","fg","bg","showBg","VD","kSigma","kSigmaMed","kSigmaMax","frame","isoMode","colorers","EL","carbon","UN","CO","baseColor","CB","factor","SQ","gradient","TM","OC","HY","MO","antialias","camFov","camNear","camFar","camDistance","radiusToFit","fogNearFactor","fogFarFactor","fogAlpha","fogColor","fogColorEnable","palette","resolution","autoResolution","autoPreset","preset","presets","default","empty","wire","small","macro","objects","dashSize","gapSize","transparent","draft","clipPlane","clipPlaneFactor","clipPlaneSpeed","plugins","axes","fog","zSprites","isoSurfaceFakeOpacity","suspendRender","nowater","autobuild","fxaa","outline","threshold","thickness","ao","autoRotation","maxfps","fbxprec","autoRotationAxisFixed","zooming","picking","pick","editing","aromatic","singleUnit","stereo","interpolateViews","transparency","translationSpeed","example","good","ssaoKernelRadius","ssaoFactor","stereoBarrel","use","multiFile","Settings","old","_changed","path","oldValue","_notifyChange","merge","_notifyChanges","defaultValue","cloneDeep","checkpoint","deepValue","deepPath","changed","filter","applyDiffs","diffs","getDiffs","versioned","setPluginOpts","plugin","repIndex","asBoolean","adapters","string","boolean","cL1Ass","cOptsSep","cL2Ass","cLSep","cCommonIgnoreSymbols","getLevel1ExcludedExpr","cLevel1Ignores","getLevel2ExcludedExpr","cLevel2Ignores","cL1ExclExpr","encodeQueryComponentL1","cL2ExclExpr","encodeQueryComponentL2","ensureRepList","reps","ensureRepAssign","prop","_objects","newOpts","newObj","parseParams","sep","extractArgs","defaultsDict","bang","inputVal","arg","pair","adapter","actions","unit","menu","mt","materials","dup","_fromArray","entries","entry","isFunction","fromAttr","attr","fromURL","_processOptsForURL","_processArgsForURL","_processObjForURL","objOpts","toURL","stringList","checkAndAdd","addReps","repList","addObjects","objList","protocol","host","pathname","_processOptsForScript","_processArgsForScript","_processObjForScript","map","_processRepsForScript","repString","strIdx","localAdd","toScript","commandsList","command","saveQuotes","quote","trim","Atom","residue","role","het","serial","temperature","charge","mask","hydrogenCount","radicalCount","valence","bonds","flags","Flags","HYDROGEN","CARBON","isHet","isHydrogen","getVisualName","forEachBond","process","getFullName","_chain","getName","_sequence","NONPOLARH","Element","fullName","weight","radiusBonding","hValency","hydrogenValency","Constants","U1","Lead","U2","Wing","U18","Role","SG","ByAtomicNumber","ByName","byAtomicNumber","byName","getByName","cBondTypes","UNKNOWN","COVALENT","AROMATIC","getAtomPos","Bond","right","order","fixed","_left","_right","_fixed","_order","_type","getLeft","getRight","getOrder","calcLength","distanceTo","_forEachNeighbour","currAtom","forEachLevelOne","forEachLevelTwo","l2Atom","_fixDir","refPoint","currDir","posGetter","rightCount","leftCount","tmpVec","clone","checkDir","sub","dotProd","dot","checkCarbon","stages","stageId","multiplyScalar","calcNormalDir","third","maxNeibs","another","secondPos","firstV","secondV","crossVectors","lengthSq","normalize","BondType","THREE","cNucleicControlNames","cNucleicWing1Names","cNucleicWing2Names","cCylinderSource","cCylinderTarget","types","atoms","Residue","chain","sequence","icode","_component","_icode","_mask","_atoms","_secondary","_firstAtom","_leadAtom","_wingAtom","_lastAtom","_controlPoint","_midPoint","_wingVector","_cylinders","_isValid","_het","_molecule","getChain","getMolecule","getSequence","getSecondary","getICode","addAtom","xyz","tempFactor","complex","getComplex","getAtomCount","forEachAtom","_findAtomByName","_findFirstAtomInList","names","collectMask","getCylinderTargetList","_name","_detectLeadWing","getAtomPosition","leadAtom","wingStart","wingEnd","cylSource","targetList","cylTarget","calcWing","prevLeadPos","currLeadPos","prevWingPos","prevWing","vectorA","vectorB","needToNegate","angleTo","negate","_innerFinalize","prevRes","prev","nextRes","chainAsNucleic","bFirstInChain","lp","Vector3","lerp","_finalize2","asNucleic","isConnected","anotherResidue","_finalize","tempCount","occupCount","ResidueType","letterCode","_fullName","StandardTypes","ALA","ARG","ASN","ASP","CYS","GLN","GLU","GLY","HIS","ILE","LEU","LYS","MET","PHE","PRO","PYL","SEC","SER","THR","TRP","TYR","VAL","DA","DC","DG","DI","DT","DU","WAT","H2O","HOH","DOD","UNK","UNL","PROTEIN","BASIC","ACIDIC","POLAR","NONPOLAR","NUCLEIC","PURINE","PYRIMIDINE","DNA","RNA","WATER","_addFlag","flag","hydro","_addParam","ChainType","Chain","_complex","_residues","minSequence","POSITIVE_INFINITY","maxSequence","NEGATIVE_INFINITY","getResidues","_determineType","residues","findResidue","seqNum","iCode","curr","updateToFrame","frameData","prevData","frameRes","currData","addResidue","getResidueType","addResidueType","getResidueCount","forEachResidue","StructuralElement","init","term","generic","genericByType","serialAtomMap","residueHash","splitUnifiedSerial","serialId","hashCode","getUnifiedSerial","Type","STRAND","BRIDGE","HELIX_310","HELIX_ALPHA","HELIX_PI","HELIX","TURN_310","TURN_ALPHA","TURN_PI","TURN","BEND","COIL","Generic","LOOP","StructuralElementType","StructuralElementGeneric","typeByPDBHelixClass","Helix","helixClass","comment","Strand","sheet","sense","atomCur","atomPrev","as","Sheet","_width","_strands","getWidth","addStrand","addEmptyStrand","SGroup","saveNode","_id","_position","_charge","_repeat","_center","xmlNodeRef","getPosition","getCentralPoint","_rebuildSGroupOnAtomChange","nLimon","bLow","bHight","aPos","addVectors","includes","toJSON","List","_values","splice","valuesArray","upperOnly","_validate","Selector","ListSelector","RangeListSelector","ValueListSelector","caseSensitive","NoneSelector","includesAtom","_atom","AllSelector","none","PrefixOperator","rhs","InfixOperator","lhs","keywords","defineSelector","SelectorClass","factory","SerialSelector","NameSelector","AltLocSelector","ElemSelector","ResidueSelector","SequenceSelector","ICodeSelector","ResIdxSelector","ChainSelector","HetatmSelector","PolarHSelector","NonPolarHSelector","NULL_SELECTOR","defineOperator","OperatorClass","NotOperator","AndOperator","OrOperator","byResidueTypeFlag","selectors","exc","BiologicalUnit","_selector","_boundaries","boundingBox","Box3","boundingSphere","Sphere","computeBoundaries","makeEmpty","expandByPoint","bbc","getCenter","setFromCenterAndSize","radiusSquared","pos","lengthSquared","distanceToSquared","sqrt","getTransforms","getSelector","getBoundaries","finalize","Assembly","chains","matrices","oldCenter","oldRad","applyMatrix4","newRad","addScalar","subScalar","addChain","addMatrix","matrix","Component","_residueIndices","_cycles","_subDivs","_residueCount","resIdc","idIdc","idCount","last","setSubDivs","subDivs","resCnt","_bonds","forEachCycle","cycle","addCycle","cycles","markResidues","_forEachSubChain","subs","currRes","endRes","getMaskedSequences","_subIdx","getMaskedSubdivSequences","currIdx","lastSubIdx","subIdx","boundaries","cMaxPairsForHashCode","cHashTableSize","cNumbersPerPair","cMaxNeighbours","cInvalidVal","cBigPrime","AtomPairs","maxPairsEstimate","numPairs","numMaxPairs","intBuffer","hashBuffer","destroy","addPair","indexA","indexB","ia","ib","codeToAdd","apI","cProfileBondBuilder","cEstBondsMultiplier","cSpaceCode","cBondTolerance","cVMDTolerance","cBondRadInJMOL","cEpsilon","_getBondingRadius","_isAtomEligible","AutoBond","_maxRad","bBox","getDefaultBoundaries","_vBoxMin","_vBoxMax","_pairCollection","_addExistingPairs","getAtoms","numAtoms","aInd","collection","numBondsForAtom","bInd","indTo","_findPairs","vw","getVoxelWorld","atomsNum","rA","isHydrogenA","posA","locationA","atomA","processAtom","atomB","locationB","dist2","rB","maxAcceptable","forEachAtomWithinRadius","_addPairs","iA","iB","_addPair","bondsA","numBonds","newBond","addBond","build","_buildInner","timeEnd","_calcBoundingBox","nAtoms","maxRad","cCrossThresh","cAromaticType","cAromaticAtoms","_coDirVectors","v1Tmp","v2Tmp","cp","v1","v2","_insertAscending","_anotherAtom","_cosBetween","theta","MathUtils","_markAromatic","Cycle","atomsList","nA","nextAtom","checkBond","_isAromatic","_isPossibleAromatic","rightIdx","leftIdx","_checkCycleSimple","_checkCycleComplex","assert","AromaticLoopsMarker","bondsData","bondMarks","_bondsData","_bondMarks","_resetCycles","_currIdx","_haveSameCycle","bond1","bond2","arr1","arr2","n1","n2","i1","i2","_tryBond","prevBond","currRight","bondsOrder","currLeft","currVec","startAtomRef","_currStart","checkAromatic","_checkBond","anotherAtom","anotherVec","newDir","cross","dir","newRight","_startCycle","_findLoops","checkCycle","forEachComponent","component","newCycle","markCycles","detectCycles","_getSphereSliceRadiusRange","zMin","zMax","dzMin","dzMax","rzMin","rzMax","rMin","rMax","_getCircleSliceRadiusRange","yMin","yMax","dyMin","dyMax","ryMin","ryMax","VoxelWorld","box","vCellSizeHint","_box","getSize","divide","_last","_cellSize","_cellInnerR","_cellOuterR","numVoxels","_voxels","addAtoms","voxelIdx","_findVoxel","_zero","_voxel","point","voxel","_forEachAtomInVoxel","_xRange","Vector2","_yRange","_zRange","_forEachVoxelWithinRadius","xRange","yRange","zRange","_forEachVoxelWithinRadiusSimple","rRangeXY","rRangeX","xVal","yVal","zVal","isInsideX","isInsideY","isInsideZ","divideScalar","clampScalar","_vCenter","vCenter","distTouch2","distInside2","d2","r2","isInside","forEachAtomWithinDistFromMasked","dist","_forEachAtomWithinDistFromGroup","atomProc","forEachAtomWithinDistFromSelected","voxels","processIfWithin","PairCollection","MINIMAL_DISTANCE","MIN_HBOND_ENERGY","MAX_HBOND_ENERGY","COUPLING_CONSTANT","MAX_COUPLING_DISTANCE","MAX_RESIDUES_THRESHOLD","HBondInfo","_hbonds","_buildVW","_build","isBond","from","to","acc0","acc1","acceptor","energy","ri","preri","rj","prerj","_calcHBondEnergy","pairs","_residueGetCAlpha","_residueGetCO","_residueGetNH","predonor","donor","distanceHO","distanceHC","distanceNC","distanceNO","donorInfo","accInfo","BridgeType","freeze","NO_BRIDGE","PARALLEL","ANTI_PARALLEL","HelixFlag","START","MIDDLE","END","START_AND_END","StructureType","SecondaryStructureMap","_ss","_sheet","_betaPartners","_bend","_helixFlags","_chainLengths","_chains","_buildBetaSheets","_buildAlphaHelices","inResidues","chainLength","inPreferPiHelices","stride","kappa","_kappa","_isHelixStart","isTurn","_cosinusAngle","p1","p2","p3","p4","v12","v34","prevPrev","nextNext","curCA","ppCA","nnCA","ckap","skap","atan2","bridges","lenA","chainA","lenB","chainB","_testBridge","found","bridge","unshift","chainI","chainJ","ibi","iei","jbi","jei","ibj","iej","jbj","jej","_hasChainBreak","bulge","ladderset","Set","ladder","delete","sheetset","toMove","_areBridgesLinked","betai","betaj","parallel","ai","aj","has","VOXEL_SIZE","helixClassMap","loopMap","Complex","_components","_helices","_sheets","structures","_residueTypes","_sgroups","_molecules","_maskNeedsUpdate","metadata","symmetry","units","_currentUnit","addSheet","addHelix","getBonds","forEachChain","resName","rt","getSGroupCount","getSGroups","getAtomByFullname","resId","localeCompare","getChainCount","getMolecules","getMoleculeCount","forEachMolecule","molecules","forEachSGroup","groups","components","forEachVisibleComponent","getBondCount","maxSerial","chainShift","uniSerial","remnant","ser","_fillCmpEdit","addComp","comp","resCount","currStart","_fillCmpNoedit","currSubDivs","_fillComponents","enableEditing","getCurrentUnit","resetCurrentUnit","setCurrentUnit","newUnit","_computeBounds","onAtomPositionChanged","_finalizeBonds","updateStructuresMask","helices","sheets","needAutoBonding","autoConnector","other","marker","detectAromaticLoops","_finalizeMolecules","molecule","updater","structure","countAtomsByMask","getNumAtomsBySelector","resetAtomMask","markAtoms","setMask","clearMask","totalSelector","markAtomsAdditionally","clearAtomBits","reseter","getAtomNames","_atomNames","dict","getElements","_elements","getResidueNames","_residueNames","getChainNames","_chainNames","getAltLocNames","_altlocNames","_voxelWorld","addElement","srcArray","dstArray","functor","elem","joinComplexes","complexes","atomBias","bondBias","residueBias","chainBias","componentBias","bias","processBond","processResidue","processChain","processComponent","doNothing","ssMap","getSheet","item","lastCode","lastSheetIndex","lastHelixIndex","curStructure","curCode","curResidue","curSheetIndex","loopType","curSheet","pow2ceil","Volume","dimensions","vecSize","volumeInfo","_dimVec","_volumeInfo","_dimX","_dimY","_dimZ","_rowElements","_planeElements","_totalElements","_data","getValue","setValue","addValue","getDimensions","getBox","getVolumeInfo","getCellSize","boxSize","computeGradient","vl","vs","xSize","ySize","zSize","volMap","_voxelValue","zi","zm","zp","yi","ym","yp","xi","xm","xp","getTiledTextureStride","buildTiledTexture","tilesX","tilesY","tileRow","texture","DataTexture","LuminanceFormat","UnsignedByteType","UVMapping","ClampToEdgeWrapping","LinearFilter","needsUpdate","getData","getDirectIdx","getStrideX","getStrideY","getStrideZ","Molecule","CSS2DObject","Object3D","_element","getElement","setTransparency","transp","op","op100","opacity","RCGroup","Group","raycast","raycaster","intersects","visible","children","enableSubset","innerOnly","disableSubset","getSubset","totalSubset","vertexScreenQuadShader","fragmentScreenQuadFromTex","fragmentScreenQuadFromTexWithDistortion","LAYERS","VOLUME","TRANSPARENT","PREPASS_TRANSPARENT","VOLUME_BFPLANE","COLOR_FROM_POSITION","SHADOWMAP","SELECTION_LAYERS","resetTransform","quaternion","updateMatrixWorldRecursive","updateMatrixWorld","addSavingWorldTransform","_worldMatrixInverse","Matrix4","matrixWorld","invert","multiply","decompose","WebGLRenderer","renderDummyQuad","_material","MeshBasicMaterial","depthWrite","_scene","Scene","_quad","Mesh","PlaneGeometry","_camera","OrthographicCamera","render","renderScreenQuad","isIdentity","identity","equals","applyToPointsArray","elements","persp","ScreenQuadMaterial","RawShaderMaterial","uniforms","srcTex","vertexShader","depthTest","renderScreenQuadFromTex","fragmentShader","renderScreenQuadFromTexWithDistortion","coef","PerspectiveCamera","setMinimalFov","angle","aspect","fov","radToDeg","atan","tan","degToRad","StereoCamera","updateHalfSized","camera","originalAspect","originalFov","updateProjectionMatrix","setDistanceToFit","Raycaster","intersectVisibleObject","gfxObj","fogFarPlane","intersectObject","nearPlane","near","matrixWorldInverse","farPlane","far","extractScale","_v","te","det","determinant","_calcCylinderMatrix","posBegin","posEnd","posCenter","matScale","makeScale","matRotHalf","makeRotationX","matRotLook","vUp","lookAt","setPosition","_calcChunkMatrix","eye","up","rad","_groupHasGeometryToRender","group","hasGeoms","_buildDistorionMesh","widthSegments","heightSegements","calcInverseBarrel","epsilon","prevR2","curR2","dr","geo","getAttribute","setXY","BufferAttribute","copyAtList","attribute","indexList","fillArray","startIndex","endIndex","removeChildren","clearTree","LineSegments","Line","geometry","dispose","destroyObject","belongToSelectLayers","layers","processObjRenderOrder","root","idMaterial","renderOrder","isGroup","applySelectionMaterial","setValues","depthFunc","LessEqualDepth","overrideColor","lights","shadowmap","setUberOptions","fixedColor","Color","zOffset","getMiddlePoint","point1","point2","optionalTarget","addScaledVector","_oldInstancedBufferGeometryCopy","InstancedBufferGeometry","source","instanceCount","calcCylinderMatrix","calcChunkMatrix","groupHasGeometryToRender","buildDistorionMesh","gfxutils","_defaultBoundaries","Visual","dataSource","_dataSource","release","getDataSource","_ensureArray","EntityList","entities","_list","_dict","_indices","entity","register","registerInList","unregisterFromList","registerInDict","unregisterFromDict","unregister","all","makeContextDependent","defineProperties","CollisionSphere","_radius","_sphere","sphere","ray","intersectSphere","distance","origin","SphereCollisionGeo","setSphere","inters","chunkIdx","computeBoundingBox","computeBoundingSphere","tmpColor","OFFSET_SIZE","COLOR_SIZE","setArrayXYZ","setArrayXYZW","InstancedSpheresGeometry","spheresCount","sphereComplexity","useZSprites","_sphGeometry","SphereBufferGeometry","_init","setItem","itemIdx","itemPos","itemRad","_offsets","setColor","colorVal","_colors","startUpdate","finishUpdate","setOpacity","chunkIndices","alphaArr","_alpha","geom","sphereGeo","alpha","fill","InstancedBufferAttribute","MAX_IDC_16BIT","VEC_SIZE","ChunkedObjectsGeometry","BufferGeometry","chunkGeo","chunksCount","_chunkGeo","colors","chunkSize","_chunkSize","mesh","facesPerChunk","faceIndex","srcPos","_positions","srcNorm","_normals","srcColor","dstPos","dstNorm","dstColor","dstPtOffset","ptIdxBegin","ptIdxEnd","attributes","chunkIndex","chunkIndexSize","pointsCount","use32bitIndex","indexSize","Uint32Array","Uint16Array","posOffset","setIndex","SimpleSpheresGeometry","sphGeometry","normals","geoNormals","normal","_chunkPos","_tmpPositions","tmpPos","geoPos","centerPos","tmpVector","normMtx","Matrix3","Simple2CCylindersGeometry","cylGeometry","CylinderGeometry","_chunkNorms","_tmpVector","botPos","topPos","firstOffset","secondOffset","tmpArray","geoNorm","lerpVectors","mtx1","getNormalMatrix","fromArray","toArray","applyMatrix3","colorVal1","colorVal2","MAX_POINTS_COUNT_16BIT","PTS_PER_TRIANGLE","CylinderBufferGeometry","radiusTop","radiusBottom","radialSegments","heightSegments","openEnded","thetaStart","thetaLength","parameters","hasTop","hasBottom","vertexCount","facesCount","heightHalf","positions","Uint16BufferAttribute","uvs","currVtxIdx","currFaceIdx","tanTheta","v3","v4","setXYZ","vx","vy","vz","startTIdx","lastIdx","fTIdx","currSrcIdx","getX","getY","getZ","nextTVtx","startBIdx","lastBIdx","fBIdx","currSrcBIdx","nextBVtx","invMatrix","sortNumber","_prepareCylinderInfo","chunksIdx","cylinderInfo","even","newPar","_assignOpacity","color1","color2","Instanced2CCylindersGeometry","_useZSprites","_cylGeometry","_collisionGeo","me","mtxOffset","_matVector1","_matVector2","_matVector3","_invmatVector1","_invmatVector2","_invmatVector3","colorIdx","_color1","_color2","cylinderIndices","getGeoParams","cylinderGeo","TRI_SIZE","tmpPrev","tmpNext","tmpRes","simpleNormal","normalOnCut","nearRingPt","_createExtrudedChunkGeometry","shape","ringsCount","ptsCount","totalPts","ExtrudedObjectsGeometry","_ringsCount","tmpShape","_tmpShape","hasSlope","hasCut","chunkStartIdx","_setPoints","_setSlopeNormals","_setBaseNormals","_addCut","vtxIdx","mtx","nPtsInRing","_countNormalsInRing","isSlope","shiftToExtraPt","subVectors","VERTEX_PER_SEGMENT","POS_SIZE","DIR_SIZE","COL_SIZE","startSegmentIdx","segmentsCount","elemSize","ThickLinesGeometry","_initVertices","segmentIdx","setSegment","pos1","pos2","directions","_directions","dirIdx","startSegIdx","endSegIdx","getSubsetSegments","getSubsetColors","getSubsetOpacities","getNumVertexPerSegment","getPositionSize","setSegments","startPos","startDir","setColors","_buffersSize","indexOffset","pointOffset","BaseLinesGeometry","LinesGeometry","posSize","CylinderCollisionGeo","itemOffset","COLLISION_RAD","ChunkedLinesGeometry","enableCollision","collisionGeo","segCount","segIdx","TwoColorLinesGeometry","segmentIndices","_segCounts","vectors","vecCount","tempPos1","tempPos2","CrossGeometry","POS_RAD_SIZE","IsoSurfaceGeometry","_opts","_posRad","posRad","IsoSurfaceMarchCube","pointsValuesLinear","hasIntersection","bitsInside","numCellsPerSide","vx7000000","n3","striIndicesMarchCube","edgeTable","_voxelGradientFast","grad","GridCell","_arrSize","cubeIndex","Triangle","createArray","arrSize","IsoSurface","_numTriangles","_numVertices","_volumetricData","_xAxis","_yAxis","_zAxis","_xDir","_yDir","_zDir","_prepareAxesAndDirs","volData","cellSize","xAxis","yAxis","zAxis","xDir","yDir","zDir","tmp","notZero","axe","EPSILON","_vertexInterp","isoLevel","grid","ind1","ind2","vertex","valP1","valP2","isoDiffP1","diffValP2P1","mu","_triTable","_firstIndices","_secondIndices","_vertexList","_normalList","_polygonize","triangles","firstIndices","secondIndices","vertexList","normalList","triCount","triTblIdx","triTable","_doGridPosNorms","step","appendSimple","vol","dim","stepX","stepY","stepZ","gc","gcVal","gcValSize","additions","tmpTriCount","appendVertex","axis","triVertex","_origin","posMtx","globTriCount","_gradient","compute","_remapIndices","vertexMap","idcCount","newIndices","_remapVertices","vertices","newPositions","newNormals","norm","vertexFusion","faceVer","oldVerCount","vMap","newVer","matchedIndex","setColorVolTex","colorMap","atomMap","atomWeightMap","visibilitySelector","numVerts","xs","ys","zs","colorData","strideX","strideY","strideZ","atomWeightData","atomStrideX","atomStrideY","atomStrideZ","xInv","yInv","zInv","atomLookup","atomWeights","interp","idx1","idx2","collectWeight","coefX","coefY","coefZ","newVerCount","ind","mux","muy","muz","maxWeight","dominantIdx","atomIdx","c0","c1","c2","c3","cz0","cz1","numTriangles","newTriCount","i0","toMesh","VolumeSurfaceGeometry","_visibilitySelector","_calcSurface","_findMinMax","posRadArray","itemsCount","maxPosRad","minPosRad","tmpVal","_findNumVoxels","minMaxValues","minCoordRad","maxCoordRad","gridPadding","radScale","padRad","bbox","_makeSurface","surface","isoSurf","volTexMap","packedArrays","_computeSurface","chem","QuickSurfGeometry","_shiftByOrigin","gaussdensity","atomicNum","invIsoValue","invGridSpacing","maxVoxelX","maxVoxelY","maxVoxelZ","volTexData","texStrideX","scaledRad","atomicNumFactor","radInv","radLim","radLim2","xMin","xMax","dy2dz2","addr","texAddr","expVal","density","exp","colInd","originX","originY","originZ","AVHash","maxDistance","minX","minY","minZ","maxX","maxY","maxZ","hashFunc","minW","iDim","jDim","kDim","nCells","jkDim","cellID","preHash","cid","iIdx","cellOffsets","cellLengths","maxCellLength","subArray","cellLength","neighbourListLength","withinRadii","rExtra","out","outIdx","nearI","nearJ","nearK","loI","loJ","loK","hiI","hiJ","hiK","iOffset","jOffset","cellStart","cellEnd","dataIndex","baseIndex","rSum","ContactSurface","_indexList","maxRadius","lastClip","volTex","weights","weightsMap","gridx","gridy","gridz","sinTable","cosTable","neighbours","mid","ngTorus","uniformArray","TypeName","innI","fillGridDim","initializeGrid","gridSize","initializeAngleTables","initializeHash","rExt","singleAtomObscures","innX","innY","innZ","innCI","ra2","obscured","ni","projectPoints","sigma","sigma2Inv","ax","ay","az","ar2","ng","iax","iay","iaz","minx","miny","minz","maxx","maxy","maxz","colIdx","cr","cg","cb","iz","iy","dzy2","zyOffset","ix","cIdx","ap","spx","spy","spz","dd","normalToLine","projectTorus","aIdx","bIdx","xa","ya","za","r1","innR2","cosA","dmp","rInt","cost","sint","px","py","pz","current","projectTorii","innIdx","fixNegatives","innInnI","getVolume","ContactSurfaceGeometry","contactSurface","IsoSurfaceAtomColored","radiusAt","coord","colorX","colorY","colorZ","atomType","srcAtom","IsosurfaceBuildNormals","vBoxMin","vBoxMax","_numAtoms","_probeRadius","_atomsList","_voxelList","createVoxels","numAtomsRefs","ATOM_VOXEL_REF_SCALE","aveRad","numCells","_numCells","_aveRad","side","side2","side3","xScale","_xScale","yScale","_yScale","zScale","_zScale","maxAtomsRefs","xNumVoxMult","yNumVoxMult","zNumVoxMult","radAffect","diaAffect","numVoxX","numVoxY","numVoxZ","xIndMin","yIndMin","zIndMin","xIndMax","yIndMax","zIndMax","indVoxel","indexNext","destroyVoxels","_vertices","forEachRelatedAtom","xInd","yInd","zInd","ref","indexAtom","getClosestAtom","closest","minDist2","MAX_VALUE","buildNormals","numVertices","numCloseAtoms","vNormalX","vNormalY","vNormalZ","koef","r25","r01","maxRadAffect","maxRadAffect2","expScale","gatherNormals","maxClosedAtoms","buildColors","radiusColorSmoothness","KOEF_ADD","colorsClose","weightsSum","gatherColors","weightNormalized","IsoSurfaceGeo","maxNumVertices","maxNumTriangles","needVertexColors","_maxNumVertices","_maxNumTriangles","HASH_SIZE","SSIsosurfaceGeometry","_innerBuild","geoOut","getGeo","_fromGeo","numTri3","convertToAtomsColored","atomsColored","nm","hashLines","hashEntries","getBoundingBox","bigNum","probeRadius2","atomRadiusScale","radMax","num","getCornerCoord","numPoints","vOut","invNP","tx","ty","tz","buildEdgePoint","sign","cube","indexPointValue","cTwentyFour","xb","yb","zb","isTriangleVisible","v0","a0","voxelWorld","a1","a2","addTriangle","indInGeo0","addVertexToGeo","indInGeo1","indInGeo2","itr","buildGeoFromCorners","meshRes","vCellStep","cNumVerts","vaEdges","vCorner","indCell","indY","indZ","indPointValues","indValues","offs","numTri","indTri","getNumIntersectedCells","numIntersectedCells","cubeValuesIndex","indCorner","letter","atomT","calculateGridCorners","probeRad","vDif","aLot","fx","fy","fz","indXMin","indYMin","indZMin","indXMax","indYMax","indZMax","distToSphere","createVertexHash","numHashEtriesAllocated","numHashEntryIndex","getNewHashEntry","vAdd","oneHynberes","n815851","n37633","n2453543","r106","hashResolution","marCubeResoultion","iHash","hLineIndex","dot2","iVertAdd","entryFirst","modifyExcludedFromGeo","probeSphereRadius","distToBorder","r11","innerBlockWorkAround","probeSpRad2","sideInv","radEst","xCorner","yCorner","zCorner","ok","expandFactor","meshResolution","colorMode","useVertexColors","excludeProbe","rProbeRadius","numIntersectedCellsEstim","probeRadForNormalsColors","createLabel","fieldTxt","spanText","fontSize","strings","spanNodeP","spanNodeText","LabelsGeometry","items","xTranslation","yTranslation","deltaPos","userData","textAlign","fColor","bColor","precision","renderer","capabilities","getMaxPrecision","noiseWidth","noiseHeight","_noiseData","_noiseWrapS","RepeatWrapping","_noiseWrapT","_noiseMinFilter","NearestFilter","_noiseMagFilter","_noiseMapping","noiseTexture","RGBAFormat","noise","_samplesKernel","defaultUniforms","UniformsUtils","UniformsLib","diffuse","specular","shininess","zClipValue","clipPlaneValue","nearPlaneValue","invModelViewMatrix","world2colorMatrix","dashedLineSize","dashedLinePeriod","projMatrixInv","viewport","samplesKernel","noiseTex","noiseTexelSize","srcTexelSize","uberOptionNames","uberOptions","zClipCoef","toonShading","UberMaterial","instancedPos","instancedMatrix","attrColor","attrColor2","attrAlphaColor","sphereSprite","cylinderSprite","fakeOpacity","prepassTransparancy","colorFromPos","shadowmapType","colorFromDepth","orthoCam","dashedLine","thickLine","fogTransparent","normalsToGBuffer","precisionString","DoubleSide","defines","extensions","createInstance","inst","USE_FOG","INSTANCED_POS","INSTANCED_MATRIX","ATTR_COLOR","ATTR_COLOR2","ATTR_ALPHA_COLOR","OVERRIDE_COLOR","SPHERE_SPRITE","fragDepth","CYLINDER_SPRITE","ZCLIP","CLIP_PLANE","FAKE_OPACITY","USE_LIGHTS","COLOR_FROM_POS","SHADOWMAP_PCF_SHARP","SHADOWMAP_PCF_RAND","SHADOWMAP_BASIC","COLOR_FROM_DEPTH","ORTHOGRAPHIC_CAMERA","PREPASS_TRANSP","DASHED_LINE","THICK_LINE","FOG_TRANSPARENT","drawBuffers","NORMALS_TO_G_BUFFER","TOON_SHADING","shallow","updateUniforms","SuperClass","NewObjectType","onBeforeRender","scene","_onBeforeRender","_update","UberObject","ZSpriteMesh","castShadow","receiveShadow","_geometry","_group","modelViewMatrix","multiplyMatrices","uniformsNeedUpdate","ZClippedMesh","_mvLength","_modelView","modelView","mvLength","setFromMatrixColumn","localToWorld","TextMesh","initialized","srcItem","label","visibility","SimpleMesh","_viewport","ThickLineMesh","projectionMatrix","InstancedMesh","ZClipped","ZSprite","Text","Instanced","geometries","meshes","setMatParams","_createInstancedCylinders","Geometry","initMaterial","_createLineSegmentsGeoTriplet","renderParams","thickLines","_createSimpleGeoTriplet","geoClass","_createIsoSurfaceGeoTriplet","caps","surfaceOpts","MeshCreator","createSpheres","create2CClosedCylinders","_caps","_settings","create2CCylinders","create2CLines","createCrosses","createExtrudedChains","createChunkedLines","createQuickSurface","createContactSurface","createSASSES","createLabels","TransformGroup","_inverseMatrix","_ray","Ray","geoParams","transforms","_geoParams","mat","_transforms","_createMeshes","inverseMatrix","childIntersects","ciCount","geos","meshCnt","wrapper","Name","ChemGroup","selection","_selection","_mode","_colorer","_chunksIdc","chunks","_polyComplexity","_geo","_makeGeoArgs","_mesh","chunksList","_calcChunksList","_changeSubsetOpacity","AtomsGroup","atomsIdc","AtomsSphereGroup","calcAtomRadius","getAtomColor","updateColor","needsColorUpdate","AtomsSurfaceGroup","selectedAtoms","getSurfaceOpts","AtomsSASSESGroupStub","adjustColor","inverseColor","getAtomText","getNode","colorMappings","adjust","inverse","propagateColor","rule","startsWith","templateMappings","hetatm","water","parseTemplate","AtomsTextGroup","getLabelOpts","fgColor","bgColor","_slerp","omega","oSin","AromaticGroup","radOffset","addChunk","chunksToIdx","prevVector","currVector","segmentsHeight","_segmentsHeight","leprStep","currAtomIdx","cCount","cycAtoms","chunkPoints","tmpDir","cycleRad","prevPos","currPos","upDir","currAngle","_createShape","pts","AromaticTorusGroup","torusRad","getAromRadius","radiusV","calcStickRadius","lookAtVector","mtc","points","currPoint","AromaticLinesGroup","getAromaticOffset","prevPt","getAromaticArcChunks","ResiduesGroup","chunksIdc","resIdx","NucleicItemGroup","stickRad","getResidueColor","_processItem","NucleicCylindersGroup","cyl1","cyl2","NucleicSpheresGroup","calcMatrix","_buildStructureInterpolator","argTrans","transformT","tt","newt","ans","_addPoints","centerPoints","topPoints","tp","_addPointsForLoneResidue","nucleic","nameFrom","nameTo","posFrom","posTo","shift","wing","cpPrev","tpPrev","cpNext","tpNext","_calcPoints","firstIdx","_prevIdx","_nextIdx","arrIdx","_extrapolate2","otherIdx","prevIdx","nextIdx","CartoonHelper","startIdx","endIdx","pointsArrays","_topInterp","_centerInterp","_shift","_valueStep","_segmentsCount","prepareMatrices","firstRad","secondRad","mtcCount","outMtc","currRad","topInterp","cenInterp","currentValue","mtxIdx","lerpVal","currTop","currCenter","nextCenter","_loopThrough","subDiv","subDivI","subDivN","idc","matrixHelper","prevLast","prevSecondRad","getResidueRadius","ResiduesSubseqGroup","cmpMultiplier","getHeightSegmentsRatio","getTension","chunkIdc","subdivs","ResiduesTraceGroup","chunk","getCylinderCount","BondsGroup","drawMultiple","drawMultiorderBonds","showAromatic","showAromaticLoops","bondsIdc","bondsCount","getBondOrder","bondIdx","BondsCylinderGroup","emptyOffset","calcSpaceFraction","normDir","leftPos","rightPos","currBondIdx","atom1","atom2","a1Pos","a2Pos","minRad","currStickRad","STEP_SIZE","BondsLinesGroup","bondDir","a1Hangs","a2Hangs","AtomsProcessor","_checkAtom","atomsGroup","meshIdx","chSubset","subsetEl","OrphanAtomsProcessor","ResiduesProcessor","ResidueGroup","_checkResidue","residuesGroup","checkResidue","ResidueProcessor","NucleicProcessor","SubseqsProcessor","jEnd","BondsProcessor","bondsGroup","AromaticProcessor","cycleIdx","perCycle","Atoms","OrphanAtoms","Residues","Nucleic","Subseqs","Bonds","Aromatic","processors","_bakeGroup","triplet","Processor","GroupsFactory","AtomsSpheres","gfxTriplet","OrphanedAtomsCrosses","BondsCylinders","BondsLines","CartoonChains","TraceChains","NucleicSpheres","NucleicCylinders","ALoopsTorus","ALoopsLines","QuickSurfGeo","ContactSurfaceGeo","SASSESSurfaceGeo","TextLabelsGeo","Mode","identify","buildGeometry","depGroups","currGroup","newGroup","getRenderParams","LinesMode","shortName","LicoriceMode","BallsAndSticksMode","VanDerWaalsMode","TraceMode","TubeMode","_residue","TUBE_RADIUS","CartoonMode","secCache","getResidueStartRadius","secOpts","getResidueEndRadius","ARROW_END","startRad","endRad","_res","tubeRad","secHeight","secData","SurfaceMode","surfaces","surfaceNames","getVisibilitySelector","isSurface","QuickSurfaceMode","useBeads","IsoSurfaceMode","_excludeProbe","_radScale","IsoSurfaceSASMode","IsoSurfaceSESMode","ContactSurfaceMode","TextMode","getTemplateOptions","lerpColor","beta","g1","b1","g2","b2","Palette","getElementColor","asIs","elementColors","defaultElementColor","residueColors","defaultResidueColor","getChainColor","chainColors","getSecondaryColor","secondaryColors","defaultSecondaryColor","getSequentialColor","getGradientColor","gradientName","gradients","defaultNamedColor","getNamedColor","namedColors","minRangeColor","midRangeColor","maxRangeColor","defaultGradientColor","namedColorsArray","rainbow","temp","hot","cold","reds","blues","CL","FE","NI","CU","BR","HE","LI","BE","NE","NA","MG","AL","SI","AR","SC","TI","CR","MN","ZN","GA","GE","AS","KR","RB","SR","ZR","NB","TC","RU","RH","PD","AG","CD","IN","SN","SB","TE","XE","BA","LA","CE","PR","ND","PM","SM","EU","GD","TB","DY","HO","ER","YB","LU","HF","TA","RE","OS","IR","PT","AU","HG","TL","PB","BI","PO","AT","RN","FR","RA","AC","TH","PA","NP","PU","AM","CM","BK","CF","ES","FM","MD","NO","LR","RF","DB","BH","HS","MT","dna","rna","cpkPalette","jmolPalette","vmdPalette","palettes","Colorer","ElementColorer","ResidueTypeColorer","SequenceColorer","ChainColorer","SecondaryStructureColorer","secondary","UniformColorer","ConditionalColorer","parsed","_subsetCached","ConformationColorer","TemperatureColorer","OccupancyColorer","_getColorByOccupancy","HydrophobicityColorer","hydrophobicity","MoleculeColorer","scaleColor","CarbonColorer","colorCarbon","colorNotCarbon","neutralColor","intensity","materialList","_gatherObjects","meshTypes","createDerivativeMesh","layer","newMesh","traverseMeshes","func","applyTransformsToMeshes","processTransparentMaterial","matValues","prepassTranspMesh","processColFromPosMaterial","colFromPosMesh","createShadowmapMaterial","shadowmapMesh","isShadowmapMesh","removeShadowmapMaterial","forEachMeshInGroup","processObj","_countMeshTriangles","attribs","property","currAttr","faces","countTriangles","totalCount","meshutils","Representation","startMaterialValues","selectorString","materialPreset","needsRebuild","setMode","unmarkAtoms","setMaterialPreset","selectionGeo","buildSelectionGeometry","sg","matrixAutoUpdate","compare","repSettings","selStr","valueOf","modeDiff","colorerDiff","change","newSelectorObject","newSelector","newMode","newColorer","newMaterial","_traverseComponentGroups","ComplexEditor","ComplexComponentEditor","complexVisual","_complexVisual","_inProgress","_componentTransforms","_bakeComponentTransform","_resetComponentTransform","finalizeEdit","discard","getAltObj","pivot","visual","getSelectedComponent","getSelectionGeo","selectionMask","getSelectionBit","reprNode","bbmin","bbmax","updateMatrix","ComplexFragmentEditor","_getSelectionBorderAtoms","_fragmentBoundAtoms","pivotPos","_fragmentGeo","_fragmentSelectionGeo","vg","smeshes","sm","selectionBit","makeTranslation","_bakeAtomTransform","isFreeRotationAllowed","boundAtoms","transformDirection","atomHash","ComponentEditor","FragmentEditor","ComplexVisualEdit","lookupAndCreate","entityList","specs","Entity","ComplexVisual","_reprList","_repr","_reprListChanged","_selectionBit","_reprUsedBits","_selectionCount","_selectionGeometry","getSelectionCount","getEditor","_editor","repCount","desc","status","repGet","_getFreeReprIdx","bits","NUM_REPRESENTATION_BITS","newSelectionBit","originalSelection","buildSelectorFromMask","def","hide","rebuildSelectionGeometry","resetSelectionMask","updateSelectionMask","pickedObj","otherObj","expandSelection","tmpMask","deselectionMask","shrinkSelection","multiple","getSelectionCenter","selRule","reprList","repr","Promise","resolve","errorOccured","setTimeout","hasGeometry","DEBUG","setNeedsRebuild","_buildSelectorFromSortedLists","optimizeList","NaN","expression","and","residx","forSelectedResidues","beginComponentEdit","editor","beginFragmentEdit","setMaterialValues","needTraverse","vertexVolumeFaces","fragmentVolumeFaces","vertexVolume","fragmentVolume","vertexFarPlane","fragmentFarPlane","volumeUniforms","volumeDim","tileTex","tileTexSize","tileStride","boxAngles","_isoLevel0","_flipV","_BFLeft","_BFRight","_FFLeft","_FFRight","_WFFLeft","_WFFRight","overrideUniforms","defUniforms","facesPosMaterialParams","sideType","BackFacePosMaterial","ShaderMaterial","backFaceParams","BackSide","ShaderParams","FrontSide","BackFacePosMaterialFarPlane","matUniforms","aspectRatio","farZ","tanHalfFOV","matWorld2Volume","shaderParams","FrontFacePosMaterial","frontFaceParams","VolumeMaterial","updateDefines","ISO_MODE","STEPS_COUNT","VolumeMesh","Plane","cullFlag","_corners","_edges","_edgeIntersections","edgeIntersections","_updateVertices","edges","constant","vert","cornerMark","edgeMark","curEdge","curEdgeInter","CheckX","CheckY","CheckZ","curEdgeIdx","curEdgeSource","face","nextVertex","coplanarPoint","_collectVertices","_sortIndices","_updateIndices","faceIdx","vRight","vDir","rightProj","numIndices","setDataSource","vm","image","volInfo","obtuseAngle","_updateIsoLevel","mean","dmean","dmin","span","dmax","sd","_nearClipPlaneOffset","_pos","_norm","_norm4D","Vector4","_matrixWorldToLocal","_clipPlane","nearClipPlaneOffset","norm4D","matrixWorldToLocal","getWorldDirection","getWorldPosition","setFromNormalAndCoplanarPoint","_flattenArray","VolumeBounds","_projectionTable","XY","XZ","YZ","bSize","offsetVert","_getBaseVertices","flatVertices","_lines","LineBasicMaterial","projTable","proj","inv","currDelta","angleValue","getMesh","VolumeFarPlane","volume","planeGeo","_initPlaneGeo","_plane","frustumCulled","doubleSided","matWorldToVolume","_renderer","planeCamPos","normalMatrix","volumeMatrix","DEG2RAD","VolumeVisual","_frame","showFrame","_farPlane","getBoundingSphere","needShow","LoaderList","someLoaders","SomeLoader","canProbablyLoad","Loader","_source","_options","_abort","_agent","abort","extractName","FileLoader","_binary","blob","reader","FileReader","readAsArrayBuffer","readAsText","File","urlStartRegexp","XHRLoader","request","ImmediateLoader","ParserList","someParsers","format","formats","SomeParser","canProbablyParse","parseSync","getModel","model","_parseHeader","Remark290","_matrix","_matrixIndex","stream","readString","matrixRow","readCharCode","matrixData","matrixIndex","parseFloat","Remark350","assemblies","_assembly","assembly","PDBStream","_start","_nextCR","_nextLF","_next","_end","readLine","readChar","readInt","readFloat","TAG_LENGTH","nameToElement","veryLong","pdbStartRegexp","remarkParsers","PDBParser","_serialAtomMap","_modelId","_compaundFound","_biomoleculeFound","_allowedChainsIDs","_lastMolId","_remarks","_remark","_compndCurrToken","fileType","_fixBondsArray","_fixChains","remark290","isUndefined","remark350","chainDict","chainObj","idChainMap","nj","_parseATOM","chainID","resSeq","_parseENDMDL","_parseCONECT","serial0","serial1","serial2","serial3","serial4","_parseCOMPND","tokenIdx","chainStr","lastChar","_parseREMARK","remarkNum","remark","RemarkParser","_parseHELIX","fields","_parseSTRUCTURE","_parseSHEET","pars","adder","startId","endId","codeOfS","serialNumber","structureName","helLength","shWidth","shCur","shPrev","startChainID","endChainID","startSequenceNumber","iCodeStr","startICode","endSequenceNumber","endICode","cs","_parseHEADER","classification","date","_parseTITLE","title","tagParsers","HEADER","HETATM","ENDMDL","CONECT","COMPND","REMARK","cOrderCharCodes","cmlStartRegexp","CMLParser","_readOnlyOneMolecule","_rebuidBondIndexes","countBonds","idxs","atomRefs2","_createSGroup","moleculeArr","fieldData","atomRefs","placement","fieldName","_extractSGroup","_extractSGroups","firstAtomRef","sgroupRef","mapEntry","cycleFuncInner","cycleFunc","x2","x3","y2","y3","z3","atomsRef","_traverseData","dom","parseNode","xmlNode","nodeName","nodeValue","jsonNode","existing","childNodes","_findSuitableMolecule","molSet","atomArray","_selectComponents","DOMParser","doc","parseFromString","traversedData","rawData","prepareComponentCompound","ret","atomLabels","labelsCount","localBond","bondArray","addCurrBond","orderAttr","tc","labels","_breadWidthSearch","retStruct","originalCML","cml","retData","filteredData","rd","_packLabel","compId","molId","_unpackLabel","molID","breadthQueue","componentID","labeledAtoms","startID","_parseBond","eAtom","mainAtom","_parseSet","varData","currentLabel","addFunc","complexAtom","reorder","atomCharge","lLabel","atomFullNameStruct","elementType","countRef","currAtomComp","strLabel","stringify","atomSerial","added","mrvValence","sGrp","moleculaSet","totalAtomsParsed","joinedComplex","ArrayComparator","original","_original","_sum","candidate","sorted","secStructToType","getFirstByte","buf","MMTFParser","isArrayBuffer","_onModel","_modelData","_onChain","chainData","_onGroup","groupData","_updateSecStructure","_onAtom","atomData","_onBond","bondData","helixClasses","_ssType","_ssStruct","_ssStart","struct","_updateMolecules","mmtfData","chainsInModel0","chainIndexList","description","_traverse","structureId","releaseDate","eventCallbacks","modelData","_linkAtomsToResidues","_findSynonymousChains","named","_parseAssemblyInfo","bioAssemblyList","baInfo","transformList","chainListCheck","chainNames","allChains","_chainsByName","transpose","_markHeteroAtoms","_joinSynonymousChains","primaryChainsArray","primaryChainsHash","primary","ParsingError","column","captureStackTrace","parseLine","parseColumn","_isWhitespace","_inlineIndexOf","ch0","readCIF","newline","block","keysCount","valuesCount","_parseValue","_storeKey","_storeValue","keyIndex","cRequiredAtomFields","cSecondaryCoding","helx","turn","strn","getTypeFromId","typeId","arrize","arrayLikeObject","AtomDataError","_getOperations","operList","vector","ops","_extractOperations","assemblyGen","opsDict","groupStr","gps","grIdx","grCount","gr","gp","es","cnt","ii","nn","newMtx","CIFParser","asymDict","_toComplex","cifData","complexData","_extractAtoms","_extractSecondary","_extractAssemblies","_extractMolecules","_extractMetadata","struct_keywords","pdbx_keywords","databaserev","database_PDB_rev","date_original","molData","pdbx_description","atom_site","auth_seq_id","Cartn_x","Cartn_y","Cartn_z","label_atom_id","group_PDB","chainIdc","auth_asym_id","chainLabelIdc","label_asym_id","serials","iCodes","pdbx_PDB_ins_code","resNames","label_comp_id","type_symbol","tempFactors","B_iso_or_equiv","occupancies","charges","pdbx_formal_charge","altLocs","label_alt_id","models","pdbx_PDB_model_num","label_entity_id","moleculeIdx","struct_conf","_extractConfs","struct_sheet_range","_extractSheets","sheetData","sheet_id","beg_label_seq_id","end_label_seq_id","beg_label_asym_id","sheetNames","strandNames","starts","beg_auth_seq_id","ends","end_auth_seq_id","stICodes","pdbx_beg_PDB_ins_code","endICodes","pdbx_end_PDB_ins_code","helicesData","conf_type_id","comments","details","lengths","pdbx_PDB_helix_length","pdbx_PDB_helix_class","asmGen","pdbx_struct_assembly_gen","asmIdx","assembly_id","asmOper","oper_expression","asmList","asym_id_list","pdbx_struct_oper_list","asm","assemblyOps","valueType","singular","VolumeModel","_xyz2crs","_header","_boxSize","_boxStart","extent","nstart","crs2xyz","cellDims","angles","_typedCheck","isTypedArray","_buff","TypeError","_fillHeader","headerFormat","arrays","_parseArray","_parseVector","_buffer","_setAxisIndices","_setOrigins","_getAxis","header","gamma","z1","z2","xaxis","yaxis","zaxis","_getXYZdim","_getVolumeInfo","_setBoxParams","shiftX","shiftY","_getXYZbox","_toXYZData","CCP4Header","ispg","nsymbt","lksflg","customData","machine","nlabel","Ccp4Model","u32","i32","f32","xyz2crs","xyzData","crsIdx","CCP4Parser","XYZParser","_atomsInf","_fileName","_parseToAtomsInf","endnAtoms","endComment","startAtomsInf","_parseAtomsInf","words","PubChemParser","jsonData","PC_Compounds","aids","aid","fromPairs","zip","coords","conformers","aids1","aid1","aids2","aid2","orders","SDFStream","_strings","_currentStart","_currentStringIndx","setStart","getNextString","getCurrentString","getStringFromStart","numb","findNextDataItem","curStr","findNextCompoundStart","probablyHaveDataToParse","chargeMap","orderMap","typeMap","sdfAndMolRegexp","sdfRegExp","fileFormat","SDF","MOL","possibleNameTags","possibleIDTags","possibleTitleTags","tagsNames","tags","buildChainID","codes","trunc","reverse","SDFParser","_format","_metadata","_currentMolProps","_compoundIndx","_assemblies","_atomsParsed","_atomsIndexes","_parseAtoms","_parseBonds","bondsNum","bondType","_parseMOL","countsLine","_parseDataItem","_parseCompound","props","_tryToUpdateMoleculeData","_buildAssemblies","_buildMolecules","_searchTag","_tryToFind","tagsList","tagPossibleNames","_finalizeMetadata","defineFormat","DSN6Header","div","DSN6Model","i16","_pointCalculate","byteBuffer","counter","_blockCalculate","zBlock","yBlock","xBlock","inRange","blocks","_calculateInfoParams","dispersion","minDensity","maxDensity","DSN6Parser","canParse","checkDataTypeOptions","GROReader","getNext","GROParser","_time","_residueNumber","_residueName","_atomName","_atomNumber","_atomPosition","_atomVelocity","filetype","_parseTitle","_parseNumberOfAtoms","_parseAtom","positionX","positionY","positionZ","un","am","nc","du","resNumberRegex","spacesRegex","splitToFields","MOL2Parser","_currPosIdx","_currStartIdx","_parseRawStrings","_toStringFromStart","MOL2Data","newPosIdx","_toHeaderString","_toStringFromHeader","_setStart","_probablyHaveDataToParse","_findNextCompoundStart","_parseMolecule","parsedStr","_setResidue","originAtomId","targetAtomId","_fixSerialAtoms","currMolecule","molResidues","ExporterList","someExporters","Exporter","exportSync","export","PDBResult","_resultArray","_currentStr","_tag","_fixedNumeration","_numeration","_tagStrNum","getResult","writeString","_currentStrLength","newTag","numeration","isBoolean","newString","writeEntireString","maxStrPos","curStrLength","finish","repeat","cStr","writeBondsArray","bondsArrays","_getSubArrays","subArraySize","subArrays","writeMatrix","matrixIndx","toFixed","writeMatrices","PDBExporter","_tags","_result","_tagExtractors","_extractHEADER","TITLE","_extractTITLE","_extractATOM","_extractCONECT","_extractCOMPND","_extractREMARK","_extractHELIX","SHEET","_extractSHEET","_stringForRemark350","_stringForRemark290","fixedBonds","strands","startIndx","_getMoleculeChains","chainsString","_Remark290","_Remark350","biomolIndx","getChainName","SourceClass","FBX_POS_SIZE","FBX_NORM_SIZE","FBX_COL_SIZE","copyFbxPoint3","srcIdx","dstIdx","copyFbxPoint4","vector4","copyTransformedPoint3","setSubArray","copyFunctor","functorOpts","arridx","FBXModel","lastPos","lastNorm","lastCol","vertsCount","indsCount","setPositions","setTransformedPositions","setNormals","setTransformedNormals","setIndices","setShiftedIndices","shifted","getVerticesNumber","addInstance","currentCount","FBXGeometry","_info","FBX1CGeometry","cl","FBX2CCylinder","_cutRawStart","_cutRawEnd","_facesPerSlice","addPerCylinder","_extendVertices","_extendIndices","cutRaw","indicesPerQuad","startToShift","_setColorRange","colorSize","part1End","part2End","capSize","cap1End","cap2End","FBXInfoExtractor","_materials","_models","_extractModelsAndMaterials","_flattenModels","layersOfInterest","Layers","checkExportAbility","_collectInstancedGeoInfo","_collectGeoInfo","_reworkIndices","faceSize","overallVertsCount","combined","verticesCount","vertCount","_collectMaterialInfo","_addToPool","_collectSpheresInfo","instCount","instMatrix","objMatrix","sphereColor","instanceIndex","_getSphereInstanceMatrix","_collectCylindersInfo","oneCCylinder","splittingInfo","_gatherCylindersColoringInfo","twoCCylinder","needToSplit","additionalVertsCount","colorStart","colorEnd","is2Colored","_getCylinderInstanceMatrix","materialIdx","_checkExistingMaterial","findIndex","differs","instIdx","matVector1","matVector2","matVector3","idxOffset","defaultDefinitions","defaultProperties","defaultMaterialLayer","defaultLayerBlock","globalSettings","FBXResult","_writeHeader","_writeDefinitions","_writeObjects","_writeRelations","_writeConnections","FBXHeaderVersion","FBXVersion","timeStampVersion","creator","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","modelVersion","allModels","_verticesIndices","_normalLayer","_colorLayer","materialVersion","allMaterials","_materialProperties","modelsList","_floatArrayToString","colorArray","layerElementColorNumber","layerElementColorVersion","layerElementColorName","colorsStr","colorIndices","normalArray","layerElementNormalNumber","layerElementNormalVersion","layerElementNormalName","normalsStr","multiLayer","multiTake","shading","culling","geometryVersion","vertStr","FBXExporter","_version","miewVersion","_extractor","loaders","parsers","exporters","tempColor","CSS2DRenderer","_height","_widthHalf","_heightHalf","_vector","_viewMatrix","_projectionMatrix","_domElement","overflow","pointerEvents","myNode","setSize","_renderObject","lerpColorAsHex","setHex","getHexString","colorAsHex","setFromMatrixPosition","localOffset","getMaxScaleOnAxis","fogFactor","smoothstep","WebkitTransform","MozTransform","oTransform","getTopWindow","VK_LEFT","VK_UP","VK_RIGHT","VK_DOWN","STATE","NONE","ROTATE","TRANSLATE","SCALE","TRANSLATE_PIVOT","FULL_STOP_THRESHOLD","Quaternion","matrix4","ObjectHandler","lastRotation","_rotate","quat","zeroPivot","makeRotationFromQuaternion","setObjects","rot","mousePrevPos","mouseCurPos","aboutAxis","mouse2rotation","setFromAxisAngle","translateOnAxis","timeSinceLastUpdate","timeSinceMove","intertia","dynamicDampingFactor","intertiaThreshold","eyeDirection","cameraUpDirection","cameraSidewaysDirection","moveDirection","mouseDelta","mousePrev","mouseCur","axisRotateFactor","setLength","rotateFactor","ObjectControls","objectPivot","hotkeysEnabled","screen","_state","_mousePrevPos","_mouseCurPos","_mainObj","_altObj","_affectedObj","_isAltObjFreeRotationAllowed","_isTranslationAllowed","_isKeysTranslatingObj","_pressedKeys","_clock","_lastUpdateTime","_listeners","mousedown","mouseup","mousemove","mousewheel","touchstartend","touchmove","getKeyBindObject","keydownup","handleResize","resetKeys","contextmenu","stopPropagation","preventDefault","innerWidth","innerHeight","getBoundingClientRect","ownerDocument","documentElement","pageXOffset","clientLeft","pageYOffset","clientTop","enableHotkeys","allowTranslation","allow","allowAltObjFreeRotation","keysTranslateObj","isEditingAltObj","convertMouseToOnCircle","pageX","pageY","screenSize","convertMouseToViewport","rotateByMouse","aboutZAxis","getOrientation","setOrientation","getScale","setScale","curTime","_lastMouseMoveTime","speedX","speedY","altObj","button","workWithAltObj","altKey","ctrlKey","shiftKey","translatePivotByMouse","wheelDelta","detail","touches","_touchDistanceCur","_touchDistanceStart","_scaleStart","newScale","keyCode","translatePivotInWorld","setX","setY","setZ","translatePivot","setPivot","newPivot","Picker","_lastMousePos","_mouseTotalDist","_lastClickBeginTime","_lastClickPos","_clickBeginTime","touchstart","touchend","picked","pickObject","screenPos","rayCaster","unproject","fogFarValue","getMouseInViewport","curPos","timeSinceLastClickBegin","clickDist","_lastTouchdownPos","changedTouches","Axes","targetCamera","_target","_targetCamera","_object","AxesHelper","_full","autoClear","setViewport","cDataOffset","cFirstMask","cFirstShift","cSecMask1","cSecShift1","cSecMask2","cSecShift2","cThirdMask","cStrMask","cStrShift","c219","c220","cHelixIdx","cSheetIdx","secTypes","cSecNames","_createSecondary","strArray","nRes","resid","rIdx","fromUInt20ToInt20","uint20","FrameInfo","payload","callbacks","isLoading","_framesRange","frameIsReady","_frameRequest","_callbacks","_framesRequestLength","_downloadDataFn","parseBinaryData","setFrame","_prepareBuffer","framesStart","framesEnd","_framesCount","onDone","onLoadStatusChanged","onFail","onError","_parseBuffer","_bufferRequestStart","arrayBuffer","dataView","atomsCount","framesCount","_atomsCount","maxSize","chunkedFramesCount","timeStep","iName","_timeStep","posData","coordIdx","secondaryArr","hiWord","loWord","_secondaryData","nextFrame","_currFrame","_updateSecondary","myResidues","sec","oldSec","nSec","compRes","getSec","frameIdx","_cachedResidues","disableEvents","_vec","vec","SceneObject","paramsStr","getGeometry","LinesObj","_id1","_id2","_getAtomFromName","err","_atom1","_atom2","_line","computeLineDistances","_raycaster","_intersects","verticesNeedUpdate","OutlineMaterial","srcDepthTex","srcTexSize","DEPTH_OUTLINE","FXAAMaterial","bgTransparent","BG_TRANSPARENT","AOMaterial","diffuseTexture","normalTexture","depthTexture","camNearFar","projMatrix","kernelRadius","depthThreshold","_kernelOffsets","AOHorBlurMaterial","aoMap","samplesOffsets","AOVertBlurWithBlendMaterial","fogNearFar","useFog","AnaglyphMaterial","srcL","srcR","View","orientation","_transitionTime","ViewInterpolator","setup","startView","endView","_endTime","_isPaused","_srcView","_dstView","_isMoving","isMoving","wasStarted","transTime","getCurrentView","success","createView","slerp","pause","resume","MAX_COOKIE_LEN","COUNT_SUFFIX","_chunkString","chunkLen","lc","Cookies","removeCookie","cntKey","_toCount","cntVal","_getSimpleCookie","_removeSimpleCookie","setCookie","_setSimpleCookie","getCookie","cookie","_getExpirationDate","today","EXP_PERIOD_YEARS","setFullYear","toUTCString","_exists","webVRPoC","showEnterVR","cursor","currentSession","onSessionEnded","onSessionStarted","session","_gfx","xr","setReferenceSpaceType","setSession","onmouseenter","onmouseleave","onclick","sessionInit","optionalFeatures","requestSession","then","moveSceneBehindHeadset","showWebXRNotFound","stylizeElement","bottom","padding","border","font","isSessionSupported","supported","textDecoration","createWebVRButton","WebVRPoC","onToggle","_mainCamera","_button","_onToggle","_molContainer","_user","_scalingPivot","_controller1","_controller2","_pressedGripsCounter","_distance","startScalingByControllers","stopScalingByControllers","handleGripsDown","handleGripsUp","anotherController","gfx","_mainFog","_plugVRNodesIntoScene","_setControllersListeners","getController","_createControllerMesh","disable","setAnimationLoop","getSession","_unplugVRNodesFromScene","cylinder","rotateX","updateMoleculeScale","scaler","container","getCanvas","io","LinesObject","fragmentScreenQuadFromDistTex","EDIT_MODE","COMPLEX","COMPONENT","FRAGMENT","LOADER_NOT_FOUND","PARSER_NOT_FOUND","ColorManagement","updateFogRange","removeExtension","hasValidResidues","hasValidRes","reportProgress","percent","TOTAL_PERCENT","chooseFogColor","Miew","settingsCookie","cookiePath","_interpolator","_container","getElementById","head","getElementsByClassName","_containerRoot","_running","_halting","_building","_needRender","_hotKeysEnabled","_cookies","_spinner","_loading","_animInterval","_visuals","_curVisualName","_sourceWindow","registeredPlugins","_initOnSettingsChanged","getMaxRepresentationCount","_setContainerContents","_updateShadowCamera","shadowMatrix","OBB","halfSize","light","getOBB","class","frag","createDocumentFragment","_msgMode","_msgAtomInfo","_showMessage","_initGfx","_initListeners","_onKeyDown","_onKeyUp","_objectControls","_getAltObj","_picker","_onPick","file","keepRepsInfo","job","halt","msg","_showCanvas","_requestAnimationFrame","requestAnimationFrame","arezSpritesSupported","getExtension","isAOSupported","clientWidth","clientHeight","webGLOptions","preserveDrawingBuffer","premultipliedAlpha","renderer2d","WebGL1Renderer","shadowMap","autoUpdate","PCFShadowMap","getContext","setPixelRatio","devicePixelRatio","setClearColor","clearColor","stereoCam","Fog","selectionScene","selectionRoot","selectionPivot","light12","DirectionalLight","pixelRatio","getPixelRatio","shadowMapSize","mapSize","light3","AmbientLight","deviceWidth","deviceHeight","offscreenBuf","WebGLRenderTarget","minFilter","magFilter","depthBuffer","DepthTexture","UnsignedShortType","offscreenBuf2","offscreenBuf3","offscreenBuf4","volBFTex","volFFTex","volWFFTex","offscreenBuf5","FloatType","offscreenBuf6","offscreenBuf7","stereoBufL","stereoBufR","_embedWebXR","stats","_fps","_onResize","_makeUniqueVisualName","baseName","random","suffix","_addVisual","_removeVisual","_forEachVisual","_releaseAllVisuals","_forEachComplexVisual","_getComplexVisual","any","_getVolumeVisual","_getVisualForComplex","getVisuals","getComplexVisualsCount","getCurrentVisual","setCurrentVisual","run","_onTick","_discardComponentEdit","_discardFragmentEdit","enableHotKeys","_resizeOffscreenBuffers","isAnaglyph","multi","_onUpdate","_onRender","_getBSphereRadius","_bSphereForOneVisual","_bBoxForOneVisual","_bBox","_invMatrix","_points","union","_updateFog","_setUberMaterialValues","isScriptingCommandAvailable","callNextCmd","_needRebuild","_updateView","webVR","_clipPlaneUpdateValue","_fogFarUpdateValue","setRenderTarget","_renderFrame","_anaglyphMat","_size","focus","_renderShadowMap","_renderScene","setScissorTest","setScissor","cameraL","cameraR","_onBgColorChanged","_onFogColorChanged","_enableMRT","renderBuffer","textureBuffer","gl","drawBuffersWEBGL","COLOR_ATTACHMENT0","tx8","__webglTexture","bindTexture","TEXTURE_2D","fb","__webglFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT1_WEBGL","distortion","bHaveComplexes","volumeVisual","ssao","_renderWithPrepassTransparency","dstBuffer","srcBuffer","_performAO","_renderOutline","_renderSelection","_renderVolume","_performFXAA","_performDistortion","aberration","targetBuffer","_outlineMaterial","srcDepthBuffer","srcColorBuffer","currentRenderTarget","getRenderTarget","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","setBlending","NoBlending","buffers","setClear","setTest","updateMatrices","_hasSelectionToRender","selPivot","selPivotChild","_checkVolumeRenderingSupport","renderTarget","oldRT","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","volumeBFMat","volumeFFMat","cubeOffsetMat","world2colorMat","volumeRenderingSupported","dstBuf","tmpBuf1","tmpBuf2","tmpBuf3","overrideMaterial","colorMask","_fxaaMaterial","_aoMaterial","_horBlurMaterial","_vertBlurMaterial","_scale","normalBuffer","srcDepthTexture","tempBuffer","tempBuffer1","_lastPick","_setEditMode","_resetObjects","setNeedRender","_resetScene","resetPivot","resetView","_export","TheExporter","exporter","rePdbId","rePubchem","reUrlScheme","resolveSourceShortcut","matchesPdbId","sourceType","matchesPubchem","compound","updateBinaryMode","TheParser","fileExt","_fetchData","TheLoader","newOptions","keyCount","loader","lengthComputable","total","loaded","promise","catch","_parseData","dataSet","onLoadEnd","anything","jobIndex","_refreshTitle","_onLoad","unload","_startAnimation","fileData","_stopAnimation","_frameInfo","isPlaying","_isAnimating","_continueAnimation","_pauseAnimation","clearInterval","minFrameTime","setInterval","_updateObjsToFrame","visualName","amberFileName","resetEd","_onLoadEd","_tweakResolution","_edLoader","loadEd","_rebuildObjects","toRemove","unitIdx","currentUnitInfo","_updateInfoPanel","rebuildActions","appendix","_extractRepresentation","defPreset","_setReps","presList","newIdx","_editMode","getElementsByTagName","_enterComponentEditMode","editors","_editors","_applyComponentEdit","_enterFragmentEditMode","selectedVisuals","_applyFragmentEdit","_updateSelection","firstLine","secondLine","aName","coordLine","nextAltObj","setPivotResidue","amount","setPivotAtom","_centerInVisual","setPivotSubset","_includesInCurSelection","_includesInSelector","screenshot","fov2Tan","tan2Fov","getDataURL","dataURL","currBrowser","canvas","canvasContext","drawImage","toDataURL","screenshotURI","originalTanFov2","areaOfInterestSize","areaOfInterestTanFov2","shotAspect","setDrawingBufferSize","uri","save","dataString","maxPerf","_gfxScore","_autoChangeResolution","setOptions","objData","bThrow","Ctor","_addSceneObject","sceneObject","objs","getState","compact","getScript","_compareReps","compareWithDefaults","currPreset","repsDiff","emptyReps","repsInfo","objectsState","_updateShadowmapMeshes","_updateMaterials","_fogAlphaChanged","evt","Boolean","sel","VIEW_VERSION","eulerOrder","euler","Euler","setFromQuaternion","srcView","dstView","setFromEuler","None","projected","fullAtomName","complexName","project","exportCML","extractRotation","extractBasis","retMat","makeBasis","updateCMLData","xml","removeAttribute","sGroup","oSerializer","XMLSerializer","serializeToString","curChainName","curChainColor","PACKAGE_VERSION","thirdParty","lodash","three","modeIdDesc","$help","colorDesc","materialDesc","addRepDesc","setGetParameterDesc","PDBID","REP_NAME","DESCRIPTION","REP_INDEX","EXPRESSION","MODE_ID","COLORER_ID","MATERIAL_ID","new","del","PARAMETER","set_save","set_restore","set_reset","PRESET","ENCODED_VIEW","removeobj","listobj","parsercli","clihelp","NULL","RepresentationMap","representationMap","representationID","strId","sortedKeys","representationsStorage","CLIUtils","repMap","repName","selectionStr","strList","joinHelpStr","helpData","sortBy","helpItem","awaitWhileCMDisInProcess","finishAwaitingCMDInProcess","modificate","selExc","modificators","modificator","argExc","pathExc","endsWith","utilFunctions","cliUtils","cmd","_val","cliutils","notimplemented","script","_printCallback","_errorCallback","cmdQueue","commandInAction"],"sourceRoot":""} \ No newline at end of file diff --git a/packages/miew/dist/Miew.min.css b/packages/miew/dist/Miew.min.css index 44ab08ba4..520672bb4 100644 --- a/packages/miew/dist/Miew.min.css +++ b/packages/miew/dist/Miew.min.css @@ -1,2 +1,2 @@ -@keyframes spinner-line-fade-more{0%,to{opacity:0}1%{opacity:1}}@keyframes spinner-line-fade-quick{0%,39%,to{opacity:.25}40%{opacity:1}}@keyframes spinner-line-fade-default{0%,to{opacity:.22}1%{opacity:1}}@keyframes spinner-line-shrink{0%,25%,to{transform:scale(.5);opacity:.25}26%{transform:scale(1);opacity:1}}.miew-canvas>canvas{display:block;width:100%;height:100%}.miew-canvas,.miew-container{width:100%;height:100%;overflow:hidden;position:relative}.miew-message{background-color:#ccc;display:table;width:100%;height:100%}.miew-message p{display:table-cell;vertical-align:middle;text-align:center;font-size:large}.mode-message{position:absolute;top:10px;right:10px;border-radius:4px;color:silver;background-color:rgba(64,64,64,.75);display:flex;align-items:left;justify-content:left;opacity:0}.atom-info{margin:10px;text-align:left}.overlay{pointer-events:none} +@keyframes spinner-line-fade-more{0%,to{opacity:0}1%{opacity:1}}@keyframes spinner-line-fade-quick{0%,39%,to{opacity:.25}40%{opacity:1}}@keyframes spinner-line-fade-default{0%,to{opacity:.22}1%{opacity:1}}@keyframes spinner-line-shrink{0%,25%,to{opacity:.25;transform:scale(.5)}26%{opacity:1;transform:scale(1)}}.miew-canvas>canvas{display:block;height:100%;width:100%}.miew-canvas,.miew-container{height:100%;overflow:hidden;position:relative;width:100%}.miew-message{background-color:#ccc;display:table;height:100%;width:100%}.miew-message p{display:table-cell;font-size:large;text-align:center;vertical-align:middle}.mode-message{align-items:left;background-color:rgba(64,64,64,.75);border-radius:4px;color:silver;display:flex;justify-content:left;opacity:0;position:absolute;right:10px;top:10px}.atom-info{margin:10px;text-align:left}.overlay{pointer-events:none} /*# sourceMappingURL=Miew.min.css.map */ \ No newline at end of file diff --git a/packages/miew/dist/Miew.min.css.map b/packages/miew/dist/Miew.min.css.map index 37bc12c0c..96183e13d 100644 --- a/packages/miew/dist/Miew.min.css.map +++ b/packages/miew/dist/Miew.min.css.map @@ -1 +1 @@ -{"version":3,"sources":["Miew.css"],"names":[],"mappings":"AAAA,kCACE,MACE,SACF,CACA,GACE,SACF,CACF,CAEA,mCACE,UACE,WACF,CACA,IACE,SACF,CACF,CAEA,qCACE,MACE,WACF,CACA,GACE,SACF,CACF,CAEA,+BACE,UAEE,mBAAqB,CACrB,WACF,CACA,IACE,kBAAmB,CACnB,SACF,CACF,CAEA,oBACE,aAAc,CACd,UAAW,CACX,WACF,CAEA,6BAEE,UAAW,CACX,WAAY,CACZ,eAAgB,CAChB,iBACF,CAEA,cAEE,qBAAsB,CACtB,aAAc,CACd,UAAW,CACX,WACF,CAEA,gBACI,kBAAmB,CACnB,qBAAsB,CACtB,iBAAkB,CAClB,eACF,CAEF,cACE,iBAAkB,CAClB,QAAS,CACT,UAAW,CACX,iBAAkB,CAClB,YAAa,CACb,mCAAwC,CACxC,YAAa,CACb,gBAAiB,CACjB,oBAAqB,CACrB,SACF,CAEA,WACE,WAAY,CACZ,eACF,CAEA,SACE,mBACF","file":"Miew.min.css","sourcesContent":["@keyframes spinner-line-fade-more {\r\n 0%, 100% {\r\n opacity: 0; /* minimum opacity */\r\n }\r\n 1% {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n@keyframes spinner-line-fade-quick {\r\n 0%, 39%, 100% {\r\n opacity: 0.25; /* minimum opacity */\r\n }\r\n 40% {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n@keyframes spinner-line-fade-default {\r\n 0%, 100% {\r\n opacity: 0.22; /* minimum opacity */\r\n }\r\n 1% {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n@keyframes spinner-line-shrink {\r\n 0%, 25%, 100% {\r\n /* minimum scale and opacity */\r\n transform: scale(0.5);\r\n opacity: 0.25;\r\n }\r\n 26% {\r\n transform: scale(1);\r\n opacity: 1;\r\n }\r\n}\r\n\r\n.miew-canvas > canvas {\r\n display: block;\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.miew-container,\r\n.miew-canvas {\r\n width: 100%;\r\n height: 100%;\r\n overflow: hidden;\r\n position: relative;\r\n}\r\n\r\n.miew-message {\r\n /* trick for centered error-reporting*/\r\n background-color: #ccc;\r\n display: table;\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.miew-message p {\r\n display: table-cell;\r\n vertical-align: middle;\r\n text-align: center;\r\n font-size: large;\r\n }\r\n\r\n.mode-message {\r\n position: absolute;\r\n top: 10px;\r\n right: 10px;\r\n border-radius: 4px;\r\n color: silver;\r\n background-color: rgba(64, 64, 64, 0.75);\r\n display: flex;\r\n align-items: left;\r\n justify-content: left;\r\n opacity: 0;\r\n}\r\n\r\n.atom-info {\r\n margin: 10px;\r\n text-align: left;\r\n}\r\n\r\n.overlay {\r\n pointer-events: none;\r\n}\r\n"]} \ No newline at end of file +{"version":3,"sources":["Miew.css"],"names":[],"mappings":"AAAA,kCACE,MACE,SACF,CACA,GACE,SACF,CACF,CAEA,mCACE,UACE,WACF,CACA,IACE,SACF,CACF,CAEA,qCACE,MACE,WACF,CACA,GACE,SACF,CACF,CAEA,+BACE,UAGE,WAAa,CADb,mBAEF,CACA,IAEE,SAAU,CADV,kBAEF,CACF,CAEA,oBACE,aAAc,CAEd,WAAY,CADZ,UAEF,CAEA,6BAGE,WAAY,CACZ,eAAgB,CAChB,iBAAkB,CAHlB,UAIF,CAEA,cAEE,qBAAsB,CACtB,aAAc,CAEd,WAAY,CADZ,UAEF,CAEA,gBACI,kBAAmB,CAGnB,eAAgB,CADhB,iBAAkB,CADlB,qBAGF,CAEF,cAQE,gBAAiB,CAFjB,mCAAwC,CAFxC,iBAAkB,CAClB,YAAa,CAEb,YAAa,CAEb,oBAAqB,CACrB,SAAU,CATV,iBAAkB,CAElB,UAAW,CADX,QASF,CAEA,WACE,WAAY,CACZ,eACF,CAEA,SACE,mBACF","file":"Miew.min.css","sourcesContent":["@keyframes spinner-line-fade-more {\n 0%, 100% {\n opacity: 0; /* minimum opacity */\n }\n 1% {\n opacity: 1;\n }\n}\n\n@keyframes spinner-line-fade-quick {\n 0%, 39%, 100% {\n opacity: 0.25; /* minimum opacity */\n }\n 40% {\n opacity: 1;\n }\n}\n\n@keyframes spinner-line-fade-default {\n 0%, 100% {\n opacity: 0.22; /* minimum opacity */\n }\n 1% {\n opacity: 1;\n }\n}\n\n@keyframes spinner-line-shrink {\n 0%, 25%, 100% {\n /* minimum scale and opacity */\n transform: scale(0.5);\n opacity: 0.25;\n }\n 26% {\n transform: scale(1);\n opacity: 1;\n }\n}\n\n.miew-canvas > canvas {\r\n display: block;\r\n width: 100%;\r\n height: 100%;\r\n}\n\n.miew-container,\r\n.miew-canvas {\r\n width: 100%;\r\n height: 100%;\r\n overflow: hidden;\r\n position: relative;\r\n}\n\n.miew-message {\r\n /* trick for centered error-reporting*/\r\n background-color: #ccc;\r\n display: table;\r\n width: 100%;\r\n height: 100%;\r\n}\n\n.miew-message p {\r\n display: table-cell;\r\n vertical-align: middle;\r\n text-align: center;\r\n font-size: large;\r\n }\n\n.mode-message {\r\n position: absolute;\r\n top: 10px;\r\n right: 10px;\r\n border-radius: 4px;\r\n color: silver;\r\n background-color: rgba(64, 64, 64, 0.75);\r\n display: flex;\r\n align-items: left;\r\n justify-content: left;\r\n opacity: 0;\r\n}\n\n.atom-info {\r\n margin: 10px;\r\n text-align: left;\r\n}\n\n.overlay {\r\n pointer-events: none;\r\n}\r\n"]} \ No newline at end of file diff --git a/packages/miew/dist/Miew.min.js b/packages/miew/dist/Miew.min.js index 8188fa62e..ac96aec19 100644 --- a/packages/miew/dist/Miew.min.js +++ b/packages/miew/dist/Miew.min.js @@ -1,12 +1,12 @@ -/** Miew - 3D Molecular Viewer v0.9.0 Copyright (c) 2015-2020 EPAM Systems, Inc. */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("lodash"),require("three")):"function"==typeof define&&define.amd?define(["lodash","three"],t):(e=e||self).Miew=t(e._,e.THREE)}(this,function(w,me){"use strict";w=w&&Object.prototype.hasOwnProperty.call(w,"default")?w.default:w;var r=function(e){if(Array.isArray(e))return e};var n=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}};var i=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var y=function(e,t){return r(e)||n(e,t)||i()},t=function(){return(t=Object.assign||function(e){for(var t,r=1,n=arguments.length;rthis._prevTime+1e3&&(this._text.textContent=this.fps.toPrecision(2),this._prevTime=e),e}},{key:"update",value:function(){this._startTime=this.end()}},{key:"show",value:function(e){void 0===e&&(e=!0),this.domElement.style.display=e?"block":"none"}}]),e}(),v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e,t){return e(t={exports:{}},t.exports),t.exports}var x=g(function(t){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(e){return typeof e}:t.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}t.exports=r});var S=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var Y=function(e,t){return!t||"object"!==x(t)&&"function"!=typeof t?S(e):t},X=g(function(t){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}t.exports=r}),b=g(function(r){function n(e,t){return r.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(e,t)}r.exports=n});var A=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)};var C=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},E=g(function(n){function i(e,t,r){return!function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),1}catch(e){return}}}()?n.exports=i=function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&b(i,r.prototype),i}:n.exports=i=Reflect.construct,i.apply(null,arguments)}n.exports=i}),k=g(function(t){function n(e){var r="function"==typeof Map?new Map:void 0;return t.exports=n=function(e){if(null===e||!C(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return E(e,arguments,X(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),b(t,e)},n(e)}t.exports=n});function T(e,t){return!e||e===t}function R(){this._handlers={}}R.prototype.addEventListener=function(e,t,r){var n=this._handlers[e];n||(this._handlers[e]=[],n=this._handlers[e]);var i=[t,r];void 0===w.find(n,function(e){return e[0]===i[0]&&e[1]===i[1]})&&n.push(i)},R.prototype.removeEventListener=function(r,n,i){var o=this;w.forEach(o._handlers,function(e,t){w.remove(e,function(e){return T(r,t)&&T(n,e[0])&&T(i,e[1]||o)})}),this._handlers=w.omitBy(o._handlers,function(e){return 0===e.length})},R.prototype.dispatchEvent=function(r){var n=this;w.forEach(this._handlers[r.type],function(e){var t=e[1]||n;e[0].apply(t,[r])})};var M={debug:0,info:1,report:2,warn:3,error:4};function P(){R.call(this),this.console=!1,this._priority=M.warn}function N(e){if(!w.isNumber(e))throw new Error("Wrong log level specified!");return e}((P.prototype=Object.create(R.prototype)).constructor=P).prototype.instantiate=function(){return new P},Object.defineProperty(P.prototype,"level",{get:function(){var t=this;return w.findKey(M,function(e){return e===t._priority})},set:function(e){this._priority=N(M[e])}}),P.prototype.levels=function(){return Object.keys(M)},P.prototype.message=function(e,t){var r=N(M[e]);this._message(r,t)},P.prototype.debug=function(e){this._message(M.debug,e)},P.prototype.info=function(e){this._message(M.info,e)},P.prototype.report=function(e){this._message(M.report,e)},P.prototype.warn=function(e){this._message(M.warn,e)},P.prototype.error=function(e){this._message(M.error,e)},P.prototype._message=function(t,e){if(!(t'))},shotDownload:function(e,t){if(e&&"data:"===e.substr(0,5))if(t=t||["screenshot-",+new Date,".png"].join(""),"undefined"!=typeof window&&window.navigator&&window.navigator.msSaveBlob)window.navigator.msSaveBlob(j(e),t);else if("undefined"!=typeof document){var r=document.createElement("a");r.download=t,r.innerHTML="download",r.href=window.URL.createObjectURL(j(e)),document.body.appendChild(r),r.click(),document.body.removeChild(r)}},copySubArrays:function(e,t,r,n){for(var i=0,o=r.length;ir.bonds.length&&(n=r,i=t);for(var o=n,s=0,a=i.bonds,l=0,c=a.length;ls&&u!==n&&(s=(o=u).bonds.length)}var h=e(i),d=e(n).clone().sub(h),f=e(o).clone().sub(h);return f.crossVectors(d,f),f.lengthSq()<1e-4&&f.set(0,1,0),d.normalize(),f.normalize(),d.crossVectors(f,d),d.lengthSq()<1e-4&&d.set(0,1,0),d.normalize(),this._fixDir(h,d,e)}}]),o}();Ce(Re,"BondType",ke),Re.prototype.BondType=ke;var Me=["C3'","C3*","P","H5T","H3T"],Pe=["OP1","O1P"],Ne=["OP2","O2P"],Ie=["C3'","C3*","C1","C1'","C1*","P"],Le=[{types:["A","DA","G","DG"],atoms:["N1"]},{types:["C","DC"],atoms:["N3"]},{types:["T","DT","U","DU"],atoms:["O4"]}],Oe=function(){function i(e,t,r,n){W(this,i),this._chain=e,this._component=null,this._type=t,this._sequence=r,this._icode=n,this._mask=1,this._index=-1,this._atoms=[],this._secondary=null,this._firstAtom=null,this._leadAtom=null,this._wingAtom=null,this._lastAtom=null,this._controlPoint=null,this._midPoint=null,this._wingVector=null,this._cylinders=null,this._isValid=!0,this._het=!1,this._molecule=null,this.temperature=null,this.occupancy=null}return p(i,[{key:"getChain",value:function(){return this._chain}},{key:"getMolecule",value:function(){return this._molecule}},{key:"getType",value:function(){return this._type}},{key:"getSequence",value:function(){return this._sequence}},{key:"getSecondary",value:function(){return this._secondary}},{key:"getICode",value:function(){return this._icode}},{key:"addAtom",value:function(e,t,r,n,i,o,s,a,l,c){var u=new Ae(this,e,t,r,n,i,o,s,a,l,c);return this._chain.getComplex().addAtom(u),this._atoms.push(u),this._het=this._het||i,u}},{key:"getAtomCount",value:function(){return this._atoms.length}},{key:"forEachAtom",value:function(e){for(var t=this._atoms,r=0,n=t.length;rMath.PI/2&&o.negate());return o}},{key:"_innerFinalize",value:function(e,t,r,n,i,o){var s=null===t,a=o(this._leadAtom),l=new me.Vector3(a.x,a.y,a.z);if(i)this._detectLeadWing(n,r,o);else{if(s)n._midPoint=o(this._firstAtom).clone();else{var c=t._controlPoint;n._midPoint=c.clone().lerp(l,.5),n._wingVector=this.calcWing(c,l,o(e._wingAtom),t._wingVector)}n._controlPoint=l}}},{key:"_finalize2",value:function(e,t,r){this._innerFinalize(e,e,t,this,r,function(e){return e.position})}},{key:"isConnected",value:function(o){if(this._chain!==o._chain)return!1;if(this===o)return!0;var s=!1;return this.forEachAtom(function(e){for(var t=e.bonds,r=0,n=t.length;rt&&(this.minSequence=t)),i}},{key:"getResidueCount",value:function(){return this._residues.length}},{key:"forEachResidue",value:function(e){for(var t=this._residues,r=0,n=t.length;rt[0].length)){if(t=r,n=o,this.options.backtrack_lexer){if(!1!==(e=this.test_match(r,i[o])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,i[n]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return 0=";case 14:return"<";case 15:return">";case 16:return t.yytext=t.yytext.substr(1,t.yyleng-2),24;case 17:return 13;case 18:return 23;case 19:return 5;case 20:return"INVALID"}},rules:[/^(?:\s+)/i,/^(?:(-?(?:[1-9][0-9]+|[0-9]))\b)/i,/^(?:OR\b)/i,/^(?:AND\b)/i,/^(?:NOT\b)/i,/^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\b)/i,/^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\b)/i,/^(?:((SERIAL|SEQUENCE|RESIDX))\b)/i,/^(?:\()/i,/^(?:\))/i,/^(?:,)/i,/^(?::)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i,/^(?:(@[_A-Z0-9]+))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}},ut.lexer=ht,new((gt.prototype=ut).Parser=gt))}.parser,xt=function(){function r(e,t){W(this,r),this.min=e,this.max=void 0===t?e:t}return p(r,[{key:"includes",value:function(e){return this.min<=e&&e<=this.max}},{key:"toString",value:function(){var e=this.min,t=this.max;return e===t?String(e):[e,t].join(":")}},{key:"toJSON",value:function(){return[this.min,this.max]}}]),r}(),bt=function(){function t(e){if(W(this,t),e instanceof this.constructor)return e;e instanceof Array?this._values=e.slice(0):this._values=e?[e]:[]}return p(t,[{key:"append",value:function(e){var t=this._values;return t[t.length]=e,this}},{key:"remove",value:function(e){var t=this._values,r=t.indexOf(e);return 0<=r&&t.splice(r,1),this}},{key:"toString",value:function(){return this._values.join(",")}},{key:"toJSON",value:function(){for(var e=this._values,t=[],r=0,n=e.length;rthis.priority?"(".concat(this.rhs,")"):this.rhs;return"".concat(this.keyword," ").concat(e)}},{key:"toJSON",value:function(){return[this.name,this.rhs.toJSON()]}}]),r}();Nt.prototype.priority=1;var It=function(){function n(e,t){var r;return W(this,n),(r=Y(this,X(n).call(this))).lhs=e||Pt,r.rhs=t||Pt,r}return A(n,At),p(n,[{key:"toString",value:function(){var e=this.lhs.priority&&this.lhs.priority>this.priority?"(".concat(this.lhs,")"):this.lhs,t=this.rhs.priority&&this.rhs.priority>this.priority?"(".concat(this.rhs,")"):this.rhs;return"".concat(e," ").concat(this.keyword," ").concat(t)}},{key:"toJSON",value:function(){return[this.name,this.lhs.toJSON(),this.rhs.toJSON()]}}]),n}();It.prototype.priority=1e3;var Lt={};function Ot(e,n){var t=e.toLowerCase();n.prototype.keyword=t,n.prototype.name=e;function r(){for(var e=arguments.length,t=new Array(e),r=0;r=this.numMaxPairs)throw new Error("addPair: increase num pairs");return o=4*this.numPairs,this.intBuffer[o]=r,this.intBuffer[o+1]=n,this.intBuffer[o+2]=i,this.numPairs++,!0}}]),n}();function Wt(e){var t=e.element;if(t)return t.radiusBonding;throw new Error("_getBondingRadius: Logic error.")}var Yt,Xt,qt,$t=function(){function r(e){W(this,r),this._complex=e,this._maxRad=1.8;var t=this._complex.getDefaultBoundaries().boundingBox;this._vBoxMin=t.min.clone(),this._vBoxMax=t.max.clone(),this._pairCollection=null}return p(r,[{key:"_addExistingPairs",value:function(){for(var e=this._complex.getAtoms(),t=e.length,r=0,n=this._pairCollection;ri[l]?++l:++a}return!1}},{key:"_tryBond",value:function(c,u,h){var d=[],f=this._bondsData,e=er(c,u),p=u.position.clone().sub(e.position),m=this._currStart,_=this,v=this._bondMarks,g=this._checkBond;v[c._index]=!0,g=void 0===g?nr:g,u.forEachBond(function(e){if(g(e)&&e!==c&&!v[e._index]&&!_._haveSameCycle(f,c,e)){var t,r,n,i=er(e,u),o=i.position.clone().sub(u.position),s=i===m?-2:1-(r=o,n=(t=p).dot(r)/Math.sqrt(t.lengthSq()*r.lengthSq()),me.Math.clamp(n,-1,1)),a=o.cross(p);if(Qt(a,h)){for(var l=0;l=w.z?S:Math.max(T,R)],i.set(e.y-s[1],e.y+s[1]),i.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor().clampScalar(0,this._count.y-1);for(var P=i.x;P<=i.y;++P){c=[this._box.min.y+P*this._cellSize.y,this._box.min.y+(P+1)*this._cellSize.y],d=e.y-s[0]<=c[0]&&c[1]<=e.y+s[0],m=s[1],v=c[1],0,g=(_=c[0])-(p=e).y,y=v-p.y,x=Math.sqrt(Math.max(m*m-g*g,0)),b=Math.sqrt(Math.max(m*m-y*y,0)),a=[Math.min(x,b),_<=p.y&&v>=p.y?m:Math.max(x,b)],n.set(e.x-a[1],e.x+a[1]),n.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor().clampScalar(0,this._count.x-1);for(var N=n.x;N<=n.y;++N)l=[this._box.min.x+N*this._cellSize.x,this._box.min.x+(N+1)*this._cellSize.x],h=e.x-a[0]<=l[0]&&l[1]<=e.x+a[0],r(N+this._count.x*(P+this._count.y*M),h&&d&&f)}}}}},{key:"_forEachVoxelWithinRadiusSimple",value:function(e,t,r){var n=I._xRange,i=I._yRange,o=I._zRange,s=I._vCenter,a=(t+this._cellOuterR)*(t+this._cellOuterR),l=-1;t>this._cellOuterR&&(l=(t-this._cellOuterR)*(t-this._cellOuterR)),n.set(e.x-t,e.x+t),n.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor(),n.x=Math.min(Math.max(n.x,0),this._count.x-1),n.y=Math.min(Math.max(n.y,0),this._count.x-1),i.set(e.y-t,e.y+t),i.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor(),i.x=Math.min(Math.max(i.x,0),this._count.y-1),i.y=Math.min(Math.max(i.y,0),this._count.y-1),o.set(e.z-t,e.z+t),o.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor(),o.x=Math.min(Math.max(o.x,0),this._count.z-1),o.y=Math.min(Math.max(o.y,0),this._count.z-1);for(var c=o.x;c<=o.y;++c){var u=[this._box.min.z+c*this._cellSize.z,this._box.min.z+(c+1)*this._cellSize.z];s.z=.5*(u[0]+u[1]);for(var h=i.x;h<=i.y;++h){var d=[this._box.min.y+h*this._cellSize.y,this._box.min.y+(h+1)*this._cellSize.y];s.y=.5*(d[0]+d[1]);for(var f=n.x;f<=n.y;++f){var p=[this._box.min.x+f*this._cellSize.x,this._box.min.x+(f+1)*this._cellSize.x];s.x=.5*(p[0]+p[1]);var m=e.distanceToSquared(s);m<=a&&r(f+this._count.x*(h+this._count.y*c),m<=l)}}}}},{key:"forEachAtomWithinRadius",value:function(r,e,n){var i=this,o=e*e;i._forEachVoxelWithinRadius(r,e,function(e,t){t?i._forEachAtomInVoxel(e,n):i._forEachAtomInVoxel(e,function(e){r.distanceToSquared(e.position)<=o&&n(e)})})}},{key:"forEachAtomWithinDistFromMasked",value:function(e,r,t,n){this._forEachAtomWithinDistFromGroup(function(t){e.forEachAtom(function(e){0!=(e.mask&r)&&t(e)})},t,n)}},{key:"forEachAtomWithinDistFromSelected",value:function(e,r,t,n){this._forEachAtomWithinDistFromGroup(function(t){e.forEachAtom(function(e){r.includesAtom(e)&&t(e)})},t,n)}},{key:"_forEachAtomWithinDistFromGroup",value:function(e,t,r){var n,i=this,o=t*t,s=[],a=[],l=0;e(function(r){i._forEachVoxelWithinRadius(r.position,t,function(e,t){t?s[e]=-1:void 0===s[e]?(a.push(r),a.push(-1),s[e]=l,l+=2):-1!==s[e]&&(a.push(r),a.push(s[e]),s[e]=l,l+=2)})});function c(e){if(void 0!==s[n])if(-1!==(l=s[n])){for(;0<=l;l=a[l+1])if(e.position.distanceToSquared(a[l].position)>1;e;)t<<=1,e>>=1;return t}br.prototype.id="Complex",br.prototype.name="";var Sr=function(){function g(e,t,r,n,i,o){if(W(this,g),this._box=r.clone(),this._dimVec=Math.max(Math.floor(n||1),1),this._volumeInfo=o,t instanceof Array){var s=y(t,3);this._dimX=s[0],this._dimY=s[1],this._dimZ=s[2]}else this._dimX=t.x,this._dimY=t.y,this._dimZ=t.z;switch(this._dimX=Math.max(Math.floor(this._dimX),1),this._dimY=Math.max(Math.floor(this._dimY),1),this._dimZ=Math.max(Math.floor(this._dimZ),1),this._rowElements=this._dimVec*this._dimX,this._planeElements=this._rowElements*this._dimY,this._totalElements=this._planeElements*this._dimZ,this._data=i||_e.allocateTyped(e,this._totalElements),this._dimVec){case 1:break;case 2:this.getValue=function(e,t,r){var n=e*this._dimVec+t*this._rowElements+r*this._planeElements;return[this._data[n],this._data[1+n]]},this.setValue=function(e,t,r,n,i){var o=e*this._dimVec+t*this._rowElements+r*this._planeElements;this._data[o]=n,this._data[1+o]=i},this.addValue=function(e,t,r,n,i){var o=e*this._dimVec+t*this._rowElements+r*this._planeElements;this._data[o]+=n,this._data[1+o]+=i};break;case 3:this.getValue=function(e,t,r){var n=e*this._dimVec+t*this._rowElements+r*this._planeElements;return[this._data[n],this._data[1+n],this._data[2+n]]},this.setValue=function(e,t,r,n,i,o){var s=e*this._dimVec+t*this._rowElements+r*this._planeElements;this._data[s]=n,this._data[1+s]=i,this._data[2+s]=o},this.addValue=function(e,t,r,n,i,o){var s=e*this._dimVec+t*this._rowElements+r*this._planeElements;this._data[s]+=n,this._data[1+s]+=i,this._data[2+s]+=o};break;default:throw new Error("Volume: invalid vector dimension")}}return p(g,[{key:"getValue",value:function(e,t,r){return this._data[e+t*this._rowElements+r*this._planeElements]}},{key:"setValue",value:function(e,t,r,n){this._data[e+t*this._rowElements+r*this._planeElements]=n}},{key:"addValue",value:function(e,t,r,n){this._data[e+t*this._rowElements+r*this._planeElements]+=n}},{key:"getDimensions",value:function(){return[this._dimX,this._dimY,this._dimZ]}},{key:"getBox",value:function(){return this._box}},{key:"getVolumeInfo",value:function(){return this._volumeInfo}},{key:"getCellSize",value:function(){var e=new me.Vector3;this._box.getSize(e);var t=new me.Vector3;return t.x=1>Xr[t]&1))return!0;return!1},applyTransformsToMeshes:function(e,t){var r=t.length;if(!(r<1))for(var n=en(e,[me.Mesh,me.LineSegments,me.Line]),i=0,o=n.length;iNumber.EPSILON}return!(l(t.y)||l(t.z)||l(r.x)||l(r.z)||l(n.x)||l(n.y))}},{key:"_vertexInterp",value:function(e,t,r,n,i,o){var s=t.p[r],a=t.p[n],l=t.g[r],c=t.g[n],u=t.val[r],h=e-u,d=t.val[n]-u,f=0;0U&&(U=A[G=j]);if(G<0||!r.includesAtom(C[G])){R[n]=-1;continue}}R[n]=M++;var H=Oi[j]&&(i[j]=q,S[j]=t.atoms[C]),y[j]+=q,q*=d;var $=3*C;b[H]+=q*a[$],b[H+1]+=q*a[1+$],b[H+2]+=q*a[2+$]}}}}},{key:"_shiftByOrigin",value:function(e){for(var t=this.origin.x,r=this.origin.y,n=this.origin.z,i=e.length/4,o=0;ole[R]&&(le[R]=N,ce[R]=ie[e]),W[R]<0&&(W[R]=-W[R]);var L=Math.sqrt(P),O=o/L,V=M*O,D=A*O,z=w*O;if(-1===pe(V+=r,D+=n,z+=i,e,-1)){var F=o-L;Fr.x&&(r.x=a.x+l),a.y+l>r.y&&(r.y=a.y+l),a.z+l>r.z&&(r.z=a.z+l)}t.x-=i,t.y-=i,t.z-=i,r.x+=i,r.y+=i,r.z+=i}},{key:"getCornerCoord",value:function(e,t,r,n,i,o,s){var a=1/(o-1),l=r*a,c=n*a,u=i*a;s.x=e.x*(1-l)+t.x*l,s.y=e.y*(1-c)+t.y*c,s.z=e.z*(1-u)+t.z*u}},{key:"buildEdgePoint",value:function(e,t,r,n,i,o){if(r[e]^r[t]){var s=(0-n.pointsValuesLinear[i+24+e])/(n.pointsValuesLinear[i+24+t]-n.pointsValuesLinear[i+24+e]),a=n.pointsValuesLinear[i+3*e+0],l=n.pointsValuesLinear[i+3*e+1],c=n.pointsValuesLinear[i+3*e+2],u=n.pointsValuesLinear[i+3*t+0],h=n.pointsValuesLinear[i+3*t+1],d=n.pointsValuesLinear[i+3*t+2];o.x=a*(1-s)+u*s,o.y=l*(1-s)+h*s,o.z=c*(1-s)+d*s}}},{key:"isTriangleVisible",value:function(e,t,r){var n=this.voxelWorld.getClosestAtom(e),i=this.voxelWorld.getClosestAtom(t),o=this.voxelWorld.getClosestAtom(r);return null!==n&&null!==i&&null!==o&&null!==n.srcAtom&&null!==i.srcAtom&&null!==o.srcAtom&&(this.visibilitySelector.includesAtom(n.srcAtom)&&this.visibilitySelector.includesAtom(i.srcAtom)&&this.visibilitySelector.includesAtom(o.srcAtom))}},{key:"addTriangle",value:function(e,t,r){if(this.visibilitySelector&&!this.isTriangleVisible(e,t,r))return!0;var n=this.geoOut;if(n._numTriangles>=this.maxNumTriangles)return!1;var i=this.addVertexToGeo(n,e),o=this.addVertexToGeo(n,t),s=this.addVertexToGeo(n,r);if((i|o|s)<0)return!1;var a=3*n._numTriangles;return n._indices[0+a]=i,n._indices[1+a]=o,n._indices[2+a]=s,n._numTriangles++,!0}},{key:"buildGeoFromCorners",value:function(e,t,r,n,i,o){for(var s=e-1,a=new Array(12),l=0;l<12;l++)a[l]=new me.Vector3;for(var c=[],u=0;u<8;u++)c[u]=1;for(var h=new me.Vector3,d=0,f=0;f=this.maxNumVertices)return-1;var u=e._numVertices;if(e._vertices[u].copy(t),null!==this.vBoxMin&&null!==this.vBoxMax){if((r=this.getNewHashEntry())<0)return-1;var h=this.hashLines[1+l];this.hashLines[1+l]=r,this.hashEntries[2*r+0]=u,this.hashEntries[2*r+1]=h,this.hashLines[l]++}return e._numVertices++,u}},{key:"modifyExcludedFromGeo",value:function(e,t,r,n,i,o){var s,a,l;for(var c=e*e,u=(e-1)/(n.x-r.x),h=(e-1)/(n.y-r.y),d=(e-1)/(n.z-r.z),f=2*t*(2*t),p=1/(e-1),m=0;mo[s]&&(o[s]=l))}}return 0}},{key:"_innerBuild",value:function(){var e,t={posRad:this._posRad,colors:this._colors,atoms:this._opts.atoms};this.complex=this._opts.parent,this.atoms=t.atoms,this.meshResolution=this._opts.gridSpacing,this.atomRadiusScale=this._opts.radScale,this.colorMode=this._opts.colorMode,this.probeRadius=this._opts.probeRadius,this.useVertexColors=!0,this.excludeProbe=this._opts.excludeProbe,this.visibilitySelector=this._opts.visibilitySelector,this.geoOut=null,this.hashLines=null,this.hashEntries=null,this.numHashEtriesAllocated=0,this.numHashEntryIndex=0,this.maxNumVertices=0,this.maxNumTriangles=0;var r=new Array(this.atoms.length);this.convertToAtomsColored(t,r);var n=this.vBoxMin=new me.Vector3,i=this.vBoxMax=new me.Vector3;this.getBoundingBox(r,n,i);var o=this.marCubeResoultion=4*this.meshResolution,s=o,a=s*s*s,l=_e.allocateTyped(Float32Array,a),c=this.probeRadius*this.atomRadiusScale;this.calculateGridCorners(l,s,n,i,r,c);var u=o-1,h=new li;if((e=h.create(u))<0)return e;var d=new me.Vector3;d.x=(i.x-n.x)/u,d.y=(i.y-n.y)/u,d.z=(i.z-n.z)/u;var f=this.getNumIntersectedCells(s,u,l,h),p=Math.floor(1.2*f),m=Math.floor(1.2*f*2);if(this.geoOut=new Si(p,m,this.useVertexColors),(e=this.createVertexHash(p,m))<0)return e;var _=c;if(this.excludeProbe&&(_=.01),this.voxelWorld=new wi(r.length,r,n,i,_),this.voxelWorld.createVoxels(),e=this.buildGeoFromCorners(o,n,i,l,d,h),this.excludeProbe){if(this.modifyExcludedFromGeo(s,c,n,i,this.geoOut,l),this.geoOut._vertices=null,this.geoOut._colors=null,this.geoOut._indices=null,this.geoOut._normals=null,this.geoOut._numVertices=0,this.geoOut._numTriangles=0,this.geoOut=null,f=this.getNumIntersectedCells(s,u,l,h),p=Math.floor(1.2*f),m=Math.floor(1.2*f*2),this.geoOut=new Si(p,m,this.useVertexColors),(e=this.createVertexHash(p,m))<0)return e;e=this.buildGeoFromCorners(s,n,i,l,d,h)}this.voxelWorld.buildNormals(this.geoOut._vertices.length,this.geoOut._vertices,this.geoOut._normals);var v=6.5;return this.excludeProbe&&(v-=1.5),this.useVertexColors&&this.voxelWorld.buildColors(this.geoOut._vertices.length,this.geoOut._vertices,this.geoOut._colors,v),this.voxelWorld.destroyVoxels(),this.voxelWorld=null,h.destroy(),e}}]),e}(),LabelsGeometry:function(){function s(e,t){var r;W(this,s),(r=Y(this,X(s).call(this)))._opts=t,r.items=[],r.needsUpdate=!1;var n=-50,i=-50;switch(t.horizontalAlign){case"left":n=0;break;case"right":n=-100}switch(t.verticalAlign){case"top":i=-100;break;case"bottom":i=0}var o=new me.Vector3(t.dx||0,t.dy||0,t.dz||0);return r.userData={translation:"translate(".concat(n,"%, ").concat(i,"%)"),offset:o},r}return A(s,R),p(s,[{key:"setItem",value:function(e,t,r){var n=this._opts,i=this.items[e]||function(e,t){var r=document.createElement("div");if(r.className=t,"string"==typeof e){var n=document.createElement("span");n.style.fontSize="150%";for(var i=e.split("\n"),o=0,s=i.length;o>16&255,r=e>>8&255,n=255&e;return n=127<.2126*t+.7152*r+.0722*n?(t=3*t/10,r=3*r/10,3*n/10):(t=255-3*(255-t)/10,r=255-3*(255-r)/10,255-3*(255-n)/10),t<<16|r<<8|n},inverse:function(e){return 255-(e>>16&255)<<16|255-(e>>8&255)<<8|255-(255&e)}};function Ji(e,t){var r;if(Qi.hasOwnProperty(t))r=_e.hexColor(Qi[t](e));else{var n=parseInt(t,16);r=!Number.isNaN(n)&&t.toLowerCase().startsWith("0x")?_e.hexColor(n):"#000000"}return r}function eo(r,e){return e.replace(/\{\{(\s*\w+\s*)\}\}/g,function(e){var t=e.replace(/\s+/g,"");return t=t.substring(2,t.length-2).toLowerCase(),to.hasOwnProperty(t)?to[t](r):"null"})}var to={serial:function(e){return e.serial},name:function(e){return e.getVisualName()},elem:function(e){return e.element.name},residue:function(e){return e.residue.getType().getName()},sequence:function(e){return e.residue.getSequence()},chain:function(e){return e.residue.getChain().getName()},hetatm:function(e){return e.isHet()},water:function(e){return"HOH"===e.residue.getType().getName()||"WAT"===e.residue.getType().getName()}},ro=function(){function e(){return W(this,e),Y(this,X(e).apply(this,arguments))}return A(e,Xi),p(e,[{key:"_makeGeoArgs",value:function(){var e=this._mode.getLabelOpts();return[this._selection.chunks.length,e]}},{key:"_build",value:function(){for(var e=this._mode.getLabelOpts(),t=this._selection.chunks,r=this._selection,n=r.atoms,i=r.parent,o=this._colorer,s=this._geo,a=0,l=t.length;a(()=>{var r={89:e=>{var t=function(){var e=function(e,t,r,n){for(r=r||{},n=e.length;n--;r[e[n]]=t);return r},t=[1,60],r=[1,62],n=[1,63],s=[1,65],i=[1,66],o=[1,67],a=[1,68],l=[1,69],c=[1,80],h=[1,72],u=[1,73],d=[1,74],p=[1,75],m=[1,99],f=[1,76],_=[1,100],g=[1,79],y=[1,51],x=[1,81],b=[1,82],w=[1,84],S=[1,83],v=[1,85],C=[1,96],A=[1,97],E=[1,98],T=[1,86],R=[1,87],M=[1,64],P=[1,70],N=[1,71],L=[1,77],I=[1,78],O=[1,53],V=[1,54],D=[1,55],k=[1,61],z=[1,88],F=[1,89],B=[1,90],U=[1,91],G=[1,92],j=[1,93],H=[1,94],$=[1,95],W=[1,101],Y=[1,102],X=[1,103],q=[1,104],Z=[1,105],K=[1,56],Q=[1,57],J=[1,58],ee=[1,59],te=[1,115],re=[1,111],ne=[1,114],se=[1,112],ie=[1,113],oe=[1,118],ae=[1,117],le=[1,134],ce=[1,149],he=[1,150],ue=[1,157],de=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],pe=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,71,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],me=[5,6,7,9,13,15,17,18,19,20,23,25,26,27,30,33,34,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95],fe=[5,70,72],_e=[5,74],ge=[71,101],ye={trace:function(){},yy:{},symbols_:{error:2,Program:3,Command:4,EOF:5,RESET:6,BUILD:7,ALL:8,HELP:9,Path:10,MOTM:11,OneArgCommand:12,GET:13,STRING:14,SET:15,Value:16,SET_SAVE:17,SET_RESTORE:18,SET_RESET:19,PRESET:20,AddRepresentation:21,EditRepresentation:22,REMOVE:23,RepresentationReference:24,HIDE:25,SHOW:26,LIST:27,EXPAND_KEY:28,SELECTOR_KEY:29,SELECT:30,AS:31,WordAll:32,SELECTOR:33,WITHIN:34,NUMBER:35,OF:36,MATERIAL:37,IDENTIFIER:38,ModeCMD:39,ColorCMD:40,VIEW:41,BASE_64:42,UNIT:43,DSSP:44,SCALE:45,ROTATE:46,AxesList:47,TRANSLATE:48,CENTER:49,GetURLBranch:50,Screenshot:51,LINE:52,ArgList:53,LISTOBJ:54,REMOVEOBJ:55,URL:56,VIEW_KEY:57,SCREENSHOT:58,LOAD:59,Url:60,FILE_KEY:61,ADD:62,Description:63,REP:64,MODE:65,COLOR:66,Descriptor:67,RepresentationOwnProperty:68,RepresentationOwnPropertyOpts:69,DESC_KEY:70,"=":71,DESC_KEY_OPTS:72,AxesArg:73,DESC_KEY_AXES:74,Arg:75,PathWoDescKey:76,HEX:77,BOOL:78,Word:79,CommandSetWoDESC_KEY:80,DescKeys:81,CLEAR:82,FILE_LIST:83,FILE_REGISTER:84,FILE_DELETE:85,PRESET_ADD:86,PRESET_DELETE:87,PRESET_UPDATE:88,PRESET_RENAME:89,PRESET_OPEN:90,CREATE_SCENARIO:91,RESET_SCENARIO:92,DELETE_SCENARIO:93,ADD_SCENARIO_ITEM:94,LIST_SCENARIO:95,PDB_KEY:96,DELAY_KEY:97,PRST_KEY:98,DESCRIPTION_KEY:99,CommandSet:100,".":101,PresetPath:102,"/":103,HexOrNumber:104,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",6:"RESET",7:"BUILD",8:"ALL",9:"HELP",11:"MOTM",13:"GET",14:"STRING",15:"SET",17:"SET_SAVE",18:"SET_RESTORE",19:"SET_RESET",20:"PRESET",23:"REMOVE",25:"HIDE",26:"SHOW",27:"LIST",28:"EXPAND_KEY",29:"SELECTOR_KEY",30:"SELECT",31:"AS",33:"SELECTOR",34:"WITHIN",35:"NUMBER",36:"OF",37:"MATERIAL",38:"IDENTIFIER",41:"VIEW",42:"BASE_64",43:"UNIT",44:"DSSP",45:"SCALE",46:"ROTATE",48:"TRANSLATE",49:"CENTER",52:"LINE",54:"LISTOBJ",55:"REMOVEOBJ",56:"URL",57:"VIEW_KEY",58:"SCREENSHOT",59:"LOAD",61:"FILE_KEY",62:"ADD",64:"REP",65:"MODE",66:"COLOR",70:"DESC_KEY",71:"=",72:"DESC_KEY_OPTS",74:"DESC_KEY_AXES",77:"HEX",78:"BOOL",82:"CLEAR",83:"FILE_LIST",84:"FILE_REGISTER",85:"FILE_DELETE",86:"PRESET_ADD",87:"PRESET_DELETE",88:"PRESET_UPDATE",89:"PRESET_RENAME",90:"PRESET_OPEN",91:"CREATE_SCENARIO",92:"RESET_SCENARIO",93:"DELETE_SCENARIO",94:"ADD_SCENARIO_ITEM",95:"LIST_SCENARIO",96:"PDB_KEY",97:"DELAY_KEY",98:"PRST_KEY",99:"DESCRIPTION_KEY",101:".",103:"/"},productions_:[0,[3,2],[3,1],[4,1],[4,1],[4,2],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,3],[4,3],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[4,2],[4,1],[4,2],[4,2],[4,2],[4,4],[4,2],[4,6],[4,2],[4,1],[4,1],[4,1],[4,2],[4,2],[4,1],[4,2],[4,1],[4,2],[4,2],[4,2],[4,1],[4,2],[4,1],[4,1],[4,3],[4,3],[4,4],[4,4],[4,1],[4,2],[50,1],[50,2],[50,2],[50,3],[50,3],[51,1],[51,2],[51,3],[12,2],[12,2],[12,2],[21,1],[21,2],[21,2],[21,3],[22,2],[22,3],[39,2],[39,3],[40,2],[40,3],[24,1],[24,1],[63,1],[63,2],[63,3],[63,4],[67,1],[67,1],[67,2],[68,3],[69,3],[47,1],[47,2],[73,2],[53,1],[53,2],[75,3],[16,1],[16,1],[16,1],[16,1],[16,1],[79,1],[79,1],[32,1],[32,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[100,1],[100,1],[76,1],[76,3],[76,3],[10,1],[10,1],[10,3],[10,3],[10,3],[60,1],[102,1],[102,3],[104,1],[104,1]],performAction:function(e,t,r,n,s,i,o){var a=i.length-1;switch(s){case 1:return i[a-1];case 3:this.$=n.miew.reset(!1),n.ClearContext(),n.miew.resetReps("empty");break;case 4:this.$=n.miew.rebuild();break;case 5:this.$=n.miew.rebuildAll(),n.miew.rebuild();break;case 6:this.$=n.echo(n.utils.help().toString());break;case 7:this.$=n.echo(n.utils.help(i[a]).toString());break;case 8:this.$=n.miew.motm();break;case 10:case 11:this.$=n.utils.propagateProp(i[a]),n.echo(n.miew.get(i[a]).toString());break;case 12:case 13:this.$=n.miew.set(i[a-1],n.utils.propagateProp(i[a-1],i[a]));break;case 14:this.$=n.miew.saveSettings();break;case 15:this.$=n.miew.restoreSettings();break;case 16:this.$=n.miew.resetSettings();break;case 17:this.$=n.miew.resetReps();break;case 18:this.$=n.miew.applyPreset(i[a]);break;case 21:this.$=n.miew.repRemove(i[a]),n.representations.remove(i[a]);break;case 22:this.$=n.miew.repHide(i[a]);break;case 23:this.$=n.miew.repHide(i[a],!1);break;case 24:this.$=n.echo(n.utils.listRep(n.miew,n.representations,i[a],"-e"));break;case 25:this.$=n.echo(n.utils.list(n.miew,n.representations));break;case 26:this.$=n.echo(n.utils.list(n.miew,n.representations,i[a]));break;case 27:this.$=n.echo(n.utils.listSelector(n.miew,n.Context));break;case 28:this.$=n.miew.select(n.utils.checkArg(i[a-1].toLowerCase(),i[a],!0));break;case 29:this.$=n.Context[i[a].toLowerCase()]=n.utils.checkArg(i[a-3].toLowerCase(),i[a-2],!0),n.miew.select(n.Context[i[a].toLowerCase()]);break;case 30:this.$=n.miew.rep(n.miew.repCurrent(),{selector:n.utils.checkArg(i[a-1].toLowerCase(),i[a])});break;case 31:this.$=n.Context[i[a].toLowerCase()]=n.miew.within(n.utils.checkArg("select",i[a-2],!0),Number(i[a-4]));break;case 32:this.$=n.miew.rep(n.miew.repCurrent(),{material:n.utils.checkArg(i[a-1].toLowerCase(),i[a].toUpperCase())});break;case 35:this.$=n.echo(n.miew.view());break;case 36:case 37:this.$=n.miew.view(i[a]);break;case 38:this.$=n.echo(n.miew.changeUnit());break;case 39:this.$=n.echo(n.miew.changeUnit(i[a]));break;case 40:this.$=n.miew.dssp();break;case 41:this.$=n.miew.scale(i[a]);break;case 42:for(var l=0,c=i[a].length;l2&&A.push("'"+this.terminals_[S]+"'");R=d.showPosition?"Parse error on line "+(l+1)+":\n"+d.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(R,{text:d.match,token:this.terminals_[g]||g,line:d.yylineno,loc:f,expected:A})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+g);switch(b[0]){case 1:r.push(g),s.push(d.yytext),i.push(d.yylloc),r.push(b[1]),g=null,y?(g=y,y=null):(c=d.yyleng,a=d.yytext,l=d.yylineno,f=d.yylloc,h>0&&h--);break;case 2:if(v=this.productions_[b[1]][1],T.$=s[s.length-v],T._$={first_line:i[i.length-(v||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(v||1)].first_column,last_column:i[i.length-1].last_column},_&&(T._$.range=[i[i.length-(v||1)].range[0],i[i.length-1].range[1]]),void 0!==(w=this.performAction.apply(T,[a,c,l,p.yy,b[1],s,i].concat(u))))return w;v&&(r=r.slice(0,-1*v*2),s=s.slice(0,-1*v),i=i.slice(0,-1*v)),r.push(this.productions_[b[1]][0]),s.push(T.$),i.push(T._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}},xe={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,r=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var r,n,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(n=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],r=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var i in s)this[i]=s[i];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,r,n;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),i=0;it[0].length)){if(t=r,n=i,this.options.backtrack_lexer){if(!1!==(e=this.test_match(r,s[i])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,s[n]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(e,t,r,n){switch(r){case 0:break;case 1:case 2:return"";case 3:return 42;case 4:return 35;case 5:return 77;case 6:case 7:return 78;case 8:return 8;case 9:return 6;case 10:return 82;case 11:return 7;case 12:return 9;case 13:return 59;case 14:return 13;case 15:return 15;case 16:return 17;case 17:return 18;case 18:return 19;case 19:return 20;case 20:return 11;case 21:return 62;case 22:return 64;case 23:return 23;case 24:return 25;case 25:return 26;case 26:return 27;case 27:return 30;case 28:return 34;case 29:return 33;case 30:return 65;case 31:return 66;case 32:return 37;case 33:return 41;case 34:return 43;case 35:return 52;case 36:return 54;case 37:return 55;case 38:return 46;case 39:return 48;case 40:return 45;case 41:return 49;case 42:return 56;case 43:return 58;case 44:return 44;case 45:return 83;case 46:return 84;case 47:return 85;case 48:return 86;case 49:return 87;case 50:return 88;case 51:return 89;case 52:return 90;case 53:return 91;case 54:return 92;case 55:return 93;case 56:return 94;case 57:return 95;case 58:case 59:return 70;case 60:case 61:return 72;case 62:case 63:case 64:return 74;case 65:return 31;case 66:return 36;case 67:return 96;case 68:return 97;case 69:return 98;case 70:return 99;case 71:return t.yytext=e.utils.unquoteString(t.yytext),14;case 72:return 38;case 73:return 5;case 74:return 101;case 75:return 103;case 76:return"\\";case 77:return 28;case 78:return 61;case 79:return 29;case 80:return 57;case 81:return 71}},rules:[/^(?:\s+)/i,/^(?:[#].*)/i,/^(?:\/\/.*)/i,/^(?:([_A-Z0-9\/\+]+==))/i,/^(?:-?[0-9]+(\.[0-9]+)?\b)/i,/^(?:0[xX][0-9A-F]+\b)/i,/^(?:false\b)/i,/^(?:true\b)/i,/^(?:all\b)/i,/^(?:reset\b)/i,/^(?:clear\b)/i,/^(?:build\b)/i,/^(?:help\b)/i,/^(?:load\b)/i,/^(?:get\b)/i,/^(?:set\b)/i,/^(?:set_save\b)/i,/^(?:set_restore\b)/i,/^(?:set_reset\b)/i,/^(?:preset\b)/i,/^(?:motm\b)/i,/^(?:add\b)/i,/^(?:rep\b)/i,/^(?:remove\b)/i,/^(?:hide\b)/i,/^(?:show\b)/i,/^(?:list\b)/i,/^(?:select\b)/i,/^(?:within\b)/i,/^(?:selector\b)/i,/^(?:mode\b)/i,/^(?:color\b)/i,/^(?:material\b)/i,/^(?:view\b)/i,/^(?:unit\b)/i,/^(?:line\b)/i,/^(?:listobj\b)/i,/^(?:removeobj\b)/i,/^(?:rotate\b)/i,/^(?:translate\b)/i,/^(?:scale\b)/i,/^(?:center\b)/i,/^(?:url\b)/i,/^(?:screenshot\b)/i,/^(?:dssp\b)/i,/^(?:file_list\b)/i,/^(?:file_register\b)/i,/^(?:file_delete\b)/i,/^(?:preset_add\b)/i,/^(?:preset_delete\b)/i,/^(?:preset_update\b)/i,/^(?:preset_rename\b)/i,/^(?:preset_open\b)/i,/^(?:create_scenario\b)/i,/^(?:reset_scenario\b)/i,/^(?:delete_scenario\b)/i,/^(?:add_scenario_item\b)/i,/^(?:list_scenario\b)/i,/^(?:s\b)/i,/^(?:mt\b)/i,/^(?:m\b)/i,/^(?:c\b)/i,/^(?:x\b)/i,/^(?:y\b)/i,/^(?:z\b)/i,/^(?:as\b)/i,/^(?:of\b)/i,/^(?:pdb\b)/i,/^(?:delay\b)/i,/^(?:prst\b)/i,/^(?:desc\b)/i,/^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:\.)/i,/^(?:\/)/i,/^(?:\\)/i,/^(?:-e\b)/i,/^(?:-f\b)/i,/^(?:-s\b)/i,/^(?:-v\b)/i,/^(?:=)/i],conditions:{INITIAL:{rules:[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,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],inclusive:!0}}};function be(){this.yy={}}return ye.lexer=xe,be.prototype=ye,ye.Parser=be,new be}();e.exports={parser:t}},99:e=>{var t=function(){var e=function(e,t,r,n){for(r=r||{},n=e.length;n--;r[e[n]]=t);return r},t=[1,4],r=[1,5],n=[1,6],s=[1,7],i=[1,8],o=[1,9],a=[1,11],l=[1,12],c=[5,7,8,11],h=[1,17],u=[1,22],d=[1,20],p=[1,21],m=[5,7,8,11,19],f={trace:function(){},yy:{},symbols_:{error:2,Program:3,Expression:4,EOF:5,Selector:6,OR:7,AND:8,NOT:9,"(":10,")":11,SELECTOR:12,NAMED_SELECTOR:13,SELECTOR_RANGED:14,RangeList:15,SELECTOR_NAMED:16,NameList:17,Range:18,",":19,NUMBER:20,":":21,Name:22,IDENTIFIER:23,STRING:24,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:"OR",8:"AND",9:"NOT",10:"(",11:")",12:"SELECTOR",13:"NAMED_SELECTOR",14:"SELECTOR_RANGED",16:"SELECTOR_NAMED",19:",",20:"NUMBER",21:":",23:"IDENTIFIER",24:"STRING"},productions_:[0,[3,2],[4,1],[4,3],[4,3],[4,2],[4,3],[6,1],[6,1],[6,2],[6,2],[15,1],[15,3],[18,1],[18,3],[17,1],[17,3],[22,1],[22,1],[22,1]],performAction:function(e,t,r,n,s,i,o){var a=i.length-1;switch(s){case 1:return i[a-1];case 3:this.$=n.keyword("or")(i[a-2],i[a]);break;case 4:this.$=n.keyword("and")(i[a-2],i[a]);break;case 5:this.$=n.keyword("not")(i[a]);break;case 6:this.$=i[a-1];break;case 7:this.$=n.keyword(i[a])();break;case 8:this.$=n.GetSelector(i[a].toLowerCase().slice(1,i[a].length));break;case 9:case 10:this.$=n.keyword(i[a-1])(i[a]);break;case 11:this.$=new n.RangeList(i[a]);break;case 12:case 16:this.$=i[a-2].append(i[a]);break;case 13:this.$=new n.Range(Number(i[a]));break;case 14:this.$=new n.Range(Number(i[a-2]),Number(i[a]));break;case 15:this.$=new n.ValueList(i[a])}},table:[{3:1,4:2,6:3,9:t,10:r,12:n,13:s,14:i,16:o},{1:[3]},{5:[1,10],7:a,8:l},e(c,[2,2]),{4:13,6:3,9:t,10:r,12:n,13:s,14:i,16:o},{4:14,6:3,9:t,10:r,12:n,13:s,14:i,16:o},e(c,[2,7]),e(c,[2,8]),{15:15,18:16,20:h},{17:18,20:u,22:19,23:d,24:p},{1:[2,1]},{4:23,6:3,9:t,10:r,12:n,13:s,14:i,16:o},{4:24,6:3,9:t,10:r,12:n,13:s,14:i,16:o},e(c,[2,5]),{7:a,8:l,11:[1,25]},e(c,[2,9],{19:[1,26]}),e(m,[2,11]),e(m,[2,13],{21:[1,27]}),e(c,[2,10],{19:[1,28]}),e(m,[2,15]),e(m,[2,17]),e(m,[2,18]),e(m,[2,19]),e([5,7,11],[2,3],{8:l}),e(c,[2,4]),e(c,[2,6]),{18:29,20:h},{20:[1,30]},{20:u,22:31,23:d,24:p},e(m,[2,12]),e(m,[2,14]),e(m,[2,16])],defaultActions:{10:[2,1]},parseError:function(e,t){if(!t.recoverable){var r=new Error(e);throw r.hash=t,r}this.trace(e)},parse:function(e){var t=this,r=[0],n=[],s=[null],i=[],o=this.table,a="",l=0,c=0,h=0,u=i.slice.call(arguments,1),d=Object.create(this.lexer),p={yy:{}};for(var m in this.yy)Object.prototype.hasOwnProperty.call(this.yy,m)&&(p.yy[m]=this.yy[m]);d.setInput(e,p.yy),p.yy.lexer=d,p.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var f=d.yylloc;i.push(f);var _=d.options&&d.options.ranges;"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var g,y,x,b,w,S,v,C,A,E,T={};;){if(x=r[r.length-1],this.defaultActions[x]?b=this.defaultActions[x]:(null==g&&(E=void 0,"number"!=typeof(E=n.pop()||d.lex()||1)&&(E instanceof Array&&(E=(n=E).pop()),E=t.symbols_[E]||E),g=E),b=o[x]&&o[x][g]),void 0===b||!b.length||!b[0]){var R="";for(S in A=[],o[x])this.terminals_[S]&&S>2&&A.push("'"+this.terminals_[S]+"'");R=d.showPosition?"Parse error on line "+(l+1)+":\n"+d.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(R,{text:d.match,token:this.terminals_[g]||g,line:d.yylineno,loc:f,expected:A})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+g);switch(b[0]){case 1:r.push(g),s.push(d.yytext),i.push(d.yylloc),r.push(b[1]),g=null,y?(g=y,y=null):(c=d.yyleng,a=d.yytext,l=d.yylineno,f=d.yylloc,h>0&&h--);break;case 2:if(v=this.productions_[b[1]][1],T.$=s[s.length-v],T._$={first_line:i[i.length-(v||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(v||1)].first_column,last_column:i[i.length-1].last_column},_&&(T._$.range=[i[i.length-(v||1)].range[0],i[i.length-1].range[1]]),void 0!==(w=this.performAction.apply(T,[a,c,l,p.yy,b[1],s,i].concat(u))))return w;v&&(r=r.slice(0,-1*v*2),s=s.slice(0,-1*v),i=i.slice(0,-1*v)),r.push(this.productions_[b[1]][0]),s.push(T.$),i.push(T._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}},_={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,r=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var r,n,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(n=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],r=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var i in s)this[i]=s[i];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,r,n;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),i=0;it[0].length)){if(t=r,n=i,this.options.backtrack_lexer){if(!1!==(e=this.test_match(r,s[i])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,s[n]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(e,t,r,n){switch(r){case 0:break;case 1:return 20;case 2:return 7;case 3:return 8;case 4:return 9;case 5:return 12;case 6:return 16;case 7:return 14;case 8:return 10;case 9:return 11;case 10:return 19;case 11:return 21;case 12:return"<=";case 13:return">=";case 14:return"<";case 15:return">";case 16:return t.yytext=t.yytext.substr(1,t.yyleng-2),24;case 17:return 13;case 18:return 23;case 19:return 5;case 20:return"INVALID"}},rules:[/^(?:\s+)/i,/^(?:(-?(?:[1-9][0-9]+|[0-9]))\b)/i,/^(?:OR\b)/i,/^(?:AND\b)/i,/^(?:NOT\b)/i,/^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\b)/i,/^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\b)/i,/^(?:((SERIAL|SEQUENCE|RESIDX))\b)/i,/^(?:\()/i,/^(?:\))/i,/^(?:,)/i,/^(?::)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i,/^(?:(@[_A-Z0-9]+))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};function g(){this.yy={}}return f.lexer=_,g.prototype=f,f.Parser=g,new g}();e.exports={parser:t}},690:function(e,t){ /* - Smooth.js version 0.1.7 +Smooth.js version 0.1.7 - Turn arrays into smooth functions. +Turn arrays into smooth functions. - Copyright 2012 Spencer Cohen - Licensed under MIT license (see "Smooth.js MIT license.txt") - */ -(function(){function e(e,t){for(var r in t)k.call(t,r)&&(e[r]=t[r]);function n(){this.constructor=e}return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e}var t,n,r,p,m,i,_,v,o,s,a,g,y,x,l,c,b,w,u,S,C,h,d,f,A,E,k=Object.prototype.hasOwnProperty;function T(e,t){if(this.array=e.slice(0),this.length=this.array.length,!(this.clipHelper={clamp:this.clipHelperClamp,zero:this.clipHelperZero,periodic:this.clipHelperPeriodic,mirror:this.clipHelperMirror}[t.clip]))throw"Invalid clip: "+t.clip}function R(){R.__super__.constructor.apply(this,arguments)}function M(){M.__super__.constructor.apply(this,arguments)}function P(e,t){this.tangentFactor=1-Math.max(-1,Math.min(1,t.cubicTension)),P.__super__.constructor.apply(this,arguments)}function N(e,t){if(N.__super__.constructor.apply(this,arguments),this.a=t.sincFilterSize,!t.sincWindow)throw"No sincWindow provided";this.kernel=u(t.sincWindow)}for(c in g={method:(r={METHOD_NEAREST:"nearest",METHOD_LINEAR:"linear",METHOD_CUBIC:"cubic",METHOD_LANCZOS:"lanczos",METHOD_SINC:"sinc",CLIP_CLAMP:"clamp",CLIP_ZERO:"zero",CLIP_PERIODIC:"periodic",CLIP_MIRROR:"mirror",CUBIC_TENSION_DEFAULT:0,CUBIC_TENSION_CATMULL_ROM:0}).METHOD_CUBIC,cubicTension:r.CUBIC_TENSION_DEFAULT,clip:r.CLIP_CLAMP,scaleTo:0,sincFilterSize:2,sincWindow:void 0},o=function(e,t){return Math.max(0,Math.min(e,t-1))},a=function(e,t){return(e%=t)<0&&(e+=t),e},s=function(e,t){var r;return t-1<(e=a(e,r=2*(t-1)))&&(e=r-e),e},T.prototype.getClippedInput=function(e){return 0<=e&&e>16&255)+o*(i>>16&255)<<16|s*(n>>8&255)+o*(i>>8&255)<<8|s*(255&n)+o*(255&i)}},{key:"getNamedColor",value:function(e,t){var r=1r?t.maxSequence:r+1;return this.palette.getGradientColor((e._sequence-r)/(n-r),this.opts.gradient)}}]),e}();Ce(vs,"id","SQ"),vs.prototype.id="SQ",vs.prototype.name="Sequence",vs.prototype.shortName="Sequence";var gs=function(){function e(){return W(this,e),Y(this,X(e).apply(this,arguments))}return A(e,ps),p(e,[{key:"getAtomColor",value:function(e,t){return this.getResidueColor(e.residue,t)}},{key:"getResidueColor",value:function(e){return this.palette.getChainColor(e.getChain()._name)}}]),e}();Ce(gs,"id","CH"),gs.prototype.id="CH",gs.prototype.name="Chain",gs.prototype.shortName="Chain";var ys=function(){function e(){return W(this,e),Y(this,X(e).apply(this,arguments))}return A(e,ps),p(e,[{key:"getAtomColor",value:function(e,t){return this.getResidueColor(e.residue,t)}},{key:"getResidueColor",value:function(e){if(e._type.flags&Ve.Flags.DNA)return this.palette.getSecondaryColor("dna");if(e._type.flags&Ve.Flags.RNA)return this.palette.getSecondaryColor("rna");var t=e.getSecondary();if(t){var r=this.palette.getSecondaryColor(t.type,!0);return void 0===r&&(r=this.palette.getSecondaryColor(t.generic)),r}return this.palette.defaultSecondaryColor}}]),e}();Ce(ys,"id","SS"),ys.prototype.id="SS",ys.prototype.name="Secondary Structure",ys.prototype.shortName="Structure";var xs=function(){function e(){return W(this,e),Y(this,X(e).apply(this,arguments))}return A(e,ps),p(e,[{key:"getAtomColor",value:function(){return this.opts.color}},{key:"getResidueColor",value:function(){return this.opts.color}}]),e}();Ce(xs,"id","UN"),xs.prototype.id="UN",xs.prototype.name="Uniform",xs.prototype.shortName="Uniform";var bs=function(){function n(e){var t;W(this,n),t=Y(this,X(n).call(this,e));var r=Ft.parse(t.opts.subset);return t._subsetCached=r.error?Ft.none():r.selector,t}return A(n,ps),p(n,[{key:"getAtomColor",value:function(e){return this._subsetCached.includesAtom(e)?this.opts.color:this.opts.baseColor}},{key:"getResidueColor",value:function(e){for(var t=this._subsetCached,r=!0,n=e._atoms,i=0,o=n.length;it.max?1:0:(e.temperature-t.min)/(t.max-t.min),this.palette.getGradientColor(r,t.gradient)):this.palette.defaultGradientColor}},{key:"getResidueColor",value:function(e){var t=this.opts;if(!t)return this.palette.defaultGradientColor;if(e.temperature){var r=0;return r=t.min===t.max?e.temperature>t.max?1:0:(e.temperature-t.min)/(t.max-t.min),this.palette.getGradientColor(r,t.gradient)}return this.palette.defaultGradientColor}}]),e}();Ce(Ss,"id","TM"),Ss.prototype.id="TM",Ss.prototype.name="Temperature",Ss.prototype.shortName="Temperature";var Cs=function(){function e(){return W(this,e),Y(this,X(e).apply(this,arguments))}return A(e,ps),p(e,[{key:"getAtomColor",value:function(e){var t=this.opts;if(e.occupancy&&t){var r=1-e.occupancy;return this.palette.getGradientColor(r,t.gradient)}return this.palette.defaultGradientColor}},{key:"getResidueColor",value:function(e){var t=this.opts;if(!t)return this.palette.defaultGradientColor;if(0>16&255)<<16|r*(t>>8&255)<<8|r*(255&t));return e.flags&Ae.Flags.CARBON?n:i}},{key:"getResidueColor",value:function(){return this.opts.color}}]),e}();Ce(ks,"id","CB"),ks.prototype.id="CB",ks.prototype.name="Carbon",ks.prototype.shortName="Carbon";var Ts=new un([ms,_s,vs,gs,ys,xs,bs,ws,Ss,Cs,As,Es,ks]);function Rs(e){return new me.Color(e,e,e)}var Ms=new un([{id:"DF",name:"Diffuse",shortName:"Diffuse",uberOptions:{diffuse:Rs(1),specular:Rs(0),shininess:1,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"SF",name:"Soft Plastic",shortName:"Soft",uberOptions:{diffuse:Rs(1),specular:Rs(.1),shininess:30,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"PL",name:"Glossy Plastic",shortName:"Glossy",uberOptions:{diffuse:Rs(.56),specular:Rs(.28),shininess:100,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"ME",name:"Metal",shortName:"Metal",uberOptions:{diffuse:Rs(.56),specular:Rs(.55),shininess:30,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"TR",name:"Transparent",shortName:"Transparent",uberOptions:{diffuse:Rs(1),specular:Rs(0),shininess:1,opacity:.5},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!0,toonShading:!1}},{id:"GL",name:"Glass",shortName:"Glass",uberOptions:{diffuse:Rs(.5),specular:Rs(.65),shininess:100,opacity:.5},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!0,toonShading:!1}},{id:"BA",name:"Backdrop",shortName:"Backdrop",uberOptions:{diffuse:Rs(1),specular:Rs(0),shininess:1,opacity:1},values:{lights:!1,fog:!1,depthWrite:!1,transparent:!1,toonShading:!1}},{id:"TN",name:"Toon",shortName:"Toon",uberOptions:{diffuse:Rs(1),specular:Rs(0),shininess:1,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!0}},{id:"FL",name:"Flat",shortName:"Flat",uberOptions:{diffuse:Rs(1),specular:Rs(0),shininess:0,opacity:1},values:{lights:!1,fog:!0,depthWrite:!0,transparent:!1}}]),Ps=Cr.selectors,Ns=function(){function o(e,t,r,n){W(this,o);var i={clipPlane:Q.now.draft.clipPlane,fogTransparent:Q.now.bg.transparent,shadowmap:Q.now.shadow.on,shadowmapType:Q.now.shadow.type};this.index=e,this.mode=t,this.colorer=r,this.selector=n,this.selectorString="",this.count=0,this.material=new jr,this.material.setValues(i),this.material.setUberOptions({fogAlpha:Q.now.fogAlpha}),this.materialPreset=Ms.first,this.needsRebuild=!0,this.visible=!0,this.setMode(t)}return p(o,[{key:"markAtoms",value:function(e){return this.count=e.markAtoms(this.selector,1<this._reprList.length)return I.error("Rep ".concat(e," does not exist!")),null;if(e===this._reprList.length){var r=this.repAdd(t);return I.warn("Rep ".concat(e," does not exist! New representation was created.")),{desc:r.desc,index:e,status:"created"}}var n=this._reprList[e],i={selector:n.selectorString,mode:n.mode.identify(),colorer:n.colorer.identify(),material:n.materialPreset.id};if(t){var o=n.change(t,this._complex,Vs($o,t.mode),Vs(Ts,t.colorer));if(!w.isEmpty(o)){for(var s in n.needsRebuild=!0,o)o.hasOwnProperty(s)&&(i[s]=o[s],I.debug("rep[".concat(e,"].").concat(s," changed to ").concat(o[s])));return o.mode&&n.mode.isSurface&&("ultra"===Q.now.resolution||"high"===Q.now.resolution)&&(I.report('Surface resolution was changed to "medium" to avoid hang-ups.'),Q.set("resolution","medium")),{desc:i,index:e,status:"changed"}}}return{desc:i,index:e,status:""}}},{key:"repGet",value:function(e){return(void 0===e||e instanceof Object)&&(e=this.repCurrent()),e<0||e>=this._reprList.length?null:this._reprList[e]}},{key:"_getFreeReprIdx",value:function(){for(var e=this._reprUsedBits,t=0;t<=a.NUM_REPRESENTATION_BITS;++t,e>>=1)if(0==(1&e))return t;return-1}},{key:"repAdd",value:function(e){if(this._reprList.length>=a.NUM_REPRESENTATION_BITS)return null;var t=this._getFreeReprIdx();if(t<0)return null;var r=this.buildSelectorFromMask(1<=this._reprList.length||this._reprList[e].show(!t)}},{key:"select",value:function(e,t){t?this._selectionCount+=this._complex.markAtomsAdditionally(e,1< 1.0)\r\n return NO_COLOR;\r\n\r\n currDelta.x += mix(textCoord.y, 1.0 - textCoord.y, boxAngles.z) * delta.x;\r\n\r\n textCoord.x = (boxCoord.x - currDelta.x) / (1. - delta.x - delta.y);\r\n if (textCoord.x < 0.0 || textCoord.x > 1.0)\r\n return NO_COLOR;\r\n\r\n return sample3DTexture(textCoord);\r\n}\r\n\r\nfloat CalcColor(vec3 iter, vec3 dir) {\r\n float d = 1. / 128.;\r\n vec3 dx = vec3(d, 0.0, 0.0);\r\n vec3 dy = vec3(0.0, d, 0.0);\r\n vec3 dz = vec3(0.0, 0.0, d);\r\n\r\n // #Opt: coordInc.x:(iter + dx).x > 1. ? 0.: sample3DTextureInclined(iter + dx).x,\r\n vec3 coordInc = mix(\r\n vec3(\r\n sample3DTextureInclined(iter + dx).x,\r\n sample3DTextureInclined(iter + dy).x,\r\n sample3DTextureInclined(iter + dz).x\r\n ),\r\n vec3(0. ,0. , 0.),\r\n vec3(floor((iter + dx).x), floor((iter + dy).y), floor((iter + dz).z))\r\n );\r\n\r\n // #Opt: coordDec.x:(iter - dx).x < 0. ? 0.: sample3DTextureInclined(iter - dx).x,\r\n vec3 coordDec = mix(\r\n vec3(0. ,0. , 0.),\r\n vec3(\r\n sample3DTextureInclined(iter - dx).x,\r\n sample3DTextureInclined(iter - dy).x,\r\n sample3DTextureInclined(iter - dz).x\r\n ),\r\n vec3(ceil((iter - dx).x), ceil((iter - dy).y), ceil((iter - dz).z))\r\n );\r\n\r\n vec3 N = normalize(coordInc - coordDec);\r\n float dif = max(0.0, dot(N, dir));\r\n return dif;\r\n}\r\n\r\nvec3 AccuracyIso(vec3 left, vec3 right, float volLeft, float threshold) {\r\n for (int i = 0; i < 5; i++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if ((volLeft - threshold) * (vol - threshold) < 0.)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec3 CorrectIso(vec3 left, vec3 right, float tr) {\r\n for (int j = 0; j < 5; j++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if (vol < tr)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec4 GetIso1(vec3 start, vec3 back, float molDist, vec3 dir, float tr, int count) {\r\n float vol, stepSize = (float(count) + 2.) / float(STEPS_COUNT);\r\n vec3 step = stepSize * dir, iterator = start, left, right;\r\n vec4 acc = NO_COLOR;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n vol = sample3DTextureInclined(iterator).r;\r\n if (length(iterator - back) <= stepSize || (vol > tr))\r\n break;\r\n }\r\n\r\n if (vol > tr)\r\n acc = vec4(CorrectIso(iterator, iterator - step, tr).xyz, 1.);\r\n\r\n return acc;\r\n}\r\n\r\nfloat easeOut(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return 1.0 - (1.0 - t) * (1.0 - t);\r\n}\r\n\r\nfloat easeIn(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return t * t;\r\n}\r\n\r\nvec3 GetColSimple(float vol) {\r\n float t = easeOut(_isoLevel0.x, _isoLevel0.y, vol);\r\n float s = easeIn(_isoLevel0.y, _isoLevel0.z, vol);\r\n return vec3(0.5, 0.6, 0.7) * (1.0 - t) + 2.0 * vec3(s, 0, 0);\r\n}\r\n\r\nvec4 VolRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 acc = NO_COLOR, iso;\r\n vec3 iterator = start, sumColor = vec3(0., 0., 0.);\r\n float stepSize, alpha, sumAlpha = 0.0, vol, curStepSize, molD;\r\n vec3 step, col, colOld, right;\r\n float tr0 = _isoLevel0.x;\r\n float dif, r, kd, finish;\r\n int count = 0, stopMol = 0;\r\n\r\n for (int k = 0; k < 3; k++) {\r\n stepSize = (float(k) + 2.) / float(STEPS_COUNT);\r\n kd = 140. * tr0 * stepSize;\r\n r = 1. - kd;\r\n step = stepSize * dir;\r\n iso = GetIso1(iterator, back, molDist, dir, tr0, k);\r\n if (iso.a < 0.1 || length(iso.xyz - start) > molDist)\r\n break;\r\n iterator = iso.xyz;\r\n dif = 1.;// CalcColor(iterator, dir);\r\n colOld = GetColSimple(tr0);\r\n curStepSize = stepSize;\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n molD = length(iterator - start);\r\n vol = sample3DTextureInclined(iterator).r;\r\n finish = distance(iterator, back) - stepSize;\r\n if (finish < 0.0 || vol < tr0 || (sumAlpha > 0.97) || molD > molDist)\r\n break;\r\n alpha = (1. - r);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4.* colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n colOld = col;\r\n } // for i\r\n\r\n if (finish < 0.0 || sumAlpha > 0.97)\r\n break;\r\n\r\n if (molD > molDist) {\r\n curStepSize = stepSize - (molD - molDist);\r\n right = iterator - (molD - molDist) * dir;\r\n vol = sample3DTextureInclined(right).r;\r\n } else {\r\n vec3 left = iterator - step;\r\n right = CorrectIso(left, iterator, tr0);\r\n curStepSize = distance(left, right);\r\n vol = tr0;\r\n }\r\n\r\n alpha = (1. - r) * curStepSize / stepSize;\r\n dif = 1.;// CalcColor(right, dir);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * curStepSize / stepSize * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4. * colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n\r\n if (molD > molDist)\r\n break;\r\n } // for k\r\n acc.rgb = 1. * sumColor / sumAlpha;\r\n acc.a = sumAlpha;\r\n return acc;\r\n}\r\n\r\nvec4 VolRender1(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n float stepSize = 1.0 / float(STEPS_COUNT);\r\n float len = length(back - start);\r\n vec3 step = stepSize * dir;\r\n vec3 iterator = start;\r\n float acc = 0.0;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n if (float(i) * stepSize > len)\r\n break;\r\n iterator = iterator + step;\r\n if (sample3DTextureInclined(iterator).r > _isoLevel0.x)\r\n acc += 10. * sample3DTextureInclined(iterator).r / float(STEPS_COUNT);\r\n }\r\n\r\n return vec4(1.,1.,1., acc);\r\n}\r\n\r\nvec4 IsoRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 tst = GetIso1(start, back, 2., dir, _isoLevel0.x, 0);\r\n vec4 col = NO_COLOR;\r\n\r\n if (length(tst.xyz - start) < molDist && tst.a > 0.1) {\r\n float dif = CalcColor(tst.xyz, dir);\r\n dif = 0.9 * dif * dif;\r\n col = vec4(dif, dif, dif, 1);\r\n }\r\n return col;\r\n}\r\n\r\nvec4 VolRender2(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n return sample3DTexture(start);\r\n}\r\n\r\nvoid main() {\r\n vec3 tc = screenSpacePos.xyz / screenSpacePos.w * 0.5 + 0.5;\r\n\r\n if (_flipV > 0.0) {\r\n tc.y = 1.0 - tc.y;\r\n }\r\n\r\n vec3 start;\r\n vec3 back;\r\n vec3 molBack;\r\n if (projectionMatrix[0][2] < 0.0) {\r\n start = texture2D(_FFLeft, tc.xy).xyz;\r\n back = texture2D(_BFLeft, tc.xy).xyz;\r\n molBack = texture2D(_WFFLeft, tc.xy).xyz;\r\n } else {\r\n start = texture2D(_FFRight, tc.xy).xyz;\r\n back = texture2D(_BFRight, tc.xy).xyz;\r\n molBack = texture2D(_WFFRight, tc.xy).xyz;\r\n }\r\n\r\n vec3 dir = normalize(back - start);\r\n\r\n float molDist = 2.0;\r\n if (length(molBack) > 0.001) {\r\n molDist = distance(start, molBack);\r\n }\r\n\r\n #ifdef ISO_MODE\r\n gl_FragColor = IsoRender(start, back, molDist, dir);\r\n #else\r\n gl_FragColor = VolRender(start, back, molDist, dir);\r\n #endif\r\n}\r\n");return r.transparent=!0,r.depthTest=!0,(t=Y(this,X(n).call(this,r))).updateDefines(),t}return A(n,e),p(n,[{key:"updateDefines",value:function(){this.defines={ISO_MODE:Q.now.modes.VD.isoMode,STEPS_COUNT:100*Q.now.modes.VD.polyComplexity[Q.now.resolution]},this.needsUpdate=!0}}]),n}(me.ShaderMaterial)},Ys=function(e){function C(){var e;W(this,C);var t=new me.BufferGeometry;e=Y(this,X(C).call(this,t)),Ce(S(e),"volumeInfo",{}),e.clipPlane=new me.Plane;var r=new me.Vector3(.5,.5,.5);return e.size=r,e.cullFlag=[!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1,!1],e.faces=[{indices:[],norm:new me.Vector3(0,0,-1)},{indices:[],norm:new me.Vector3(0,0,1)},{indices:[],norm:new me.Vector3(0,-1,0)},{indices:[],norm:new me.Vector3(0,1,0)},{indices:[],norm:new me.Vector3(-1,0,0)},{indices:[],norm:new me.Vector3(1,0,0)},{indices:[],norm:new me.Vector3(0,0,0)}],e.vertices=[new me.Vector3(-r.x,-r.y,-r.z),new me.Vector3(-r.x,r.y,-r.z),new me.Vector3(r.x,-r.y,-r.z),new me.Vector3(r.x,r.y,-r.z),new me.Vector3(-r.x,-r.y,r.z),new me.Vector3(-r.x,r.y,r.z),new me.Vector3(r.x,-r.y,r.z),new me.Vector3(r.x,r.y,r.z),new me.Vector3(0,0,0),new me.Vector3(0,0,0),new me.Vector3(0,0,0),new me.Vector3(0,0,0),new me.Vector3(0,0,0),new me.Vector3(0,0,0)],t.setAttribute("position",new me.BufferAttribute(new Float32Array(3*e.vertices.length),3)),e.name="VolumeMesh",e}return A(C,e),p(C,[{key:"_updateVertices",value:function(){var e,t=C._corners,r=C._edges,n=C._edgeIntersections,i=this.clipPlane.normal,o=this.clipPlane.constant,s=this.vertices,a=this.size,l=[0,0,0,0,0,0,0,0],c=[1,1,1,1,1,1,1,1,1,1,1,1],u=new me.Vector3,h=null;function d(){if(0===i.x)return 0;var e=-(i.dot(u)+o)/i.x;return-a.x<=e&&e<=a.x?(h.set(e,u.y,u.z),e===a.x?2:e==-a.x?-2:1):0}function f(){if(0===i.y)return 0;var e=-(i.dot(u)+o)/i.y;return-a.y<=e&&e<=a.y?(h.set(u.x,e,u.z),e===a.y?2:e==-a.y?-2:1):0}function p(){if(0===i.z)return 0;var e=-(i.dot(u)+o)/i.z;return-a.z<=e&&e<=a.z?(h.set(u.x,u.y,e),e===a.z?2:e==-a.z?-2:1):0}for(var m=0;m<12;++m){var _=r[m];h=n[m],u.set(_[2],_[3],_[4]),u.multiply(a);var v=0;0===_[2]&&(v=d()),0===_[3]&&(v=f()),0===_[4]&&(v=p()),-2===v?l[_[0]]=1:2===v?l[_[1]]=1:0===v&&(c[m]=0)}var g={indices:[],norm:i.clone().negate()},y=8;for(e=0;e<8;++e)1===l[e]&&(s[y].set(t[e][0],t[e][1],t[e][2]).multiply(a),g.indices.push(y++),c[t[e][3]]=0,c[t[e][4]]=0,c[t[e][5]]=0);for(e=0;e<12;++e)1===c[e]&&(s[y].copy(n[e]),g.indices.push(y++));this.faces[6]=g;var x=new me.Vector3,b=new me.Vector3;for(this.clipPlane.coplanarPoint(b),e=0;e=this._end}},{key:"next",value:function(){var e=this._next+1;this._start=ethis._nextCR&&(this._nextCR=(this._data.indexOf("\r",this._start)+1||this._end+1)-1),this._start>this._nextLF&&(this._nextLF=(this._data.indexOf("\n",this._start)+1||this._end+1)-1),this._next=this._nextCR+1]*\?>\s*<(?:cml|molecule)\b/i,Aa=function(){function n(e,t){var r;return W(this,n),(r=Y(this,X(n).call(this,e,t)))._complex=null,r._residue=null,r._serialAtomMap=null,r._modelId=1,r._lastMolId=-1,r._readOnlyOneMolecule=!1,r._options.fileType="cml",r}return A(n,ia),p(n,[{key:"_rebuidBondIndexes",value:function(e,t){for(var r=e.length,n=0;n>>16,compId:65535&e}}},{key:"_breadWidthSearch",value:function(e,t){var r,n=new Array(e.length);for(r=0;r>>0&127|0);else if(o<2048)e.setUint8(t++,o>>>6&31|192),e.setUint8(t++,o>>>0&63|128);else if(o<65536)e.setUint8(t++,o>>>12&15|224),e.setUint8(t++,o>>>6&63|128),e.setUint8(t++,o>>>0&63|128);else{if(!(o<1114112))throw new Error("bad codepoint "+o);e.setUint8(t++,o>>>18&7|240),e.setUint8(t++,o>>>12&63|128),e.setUint8(t++,o>>>6&63|128),e.setUint8(t++,o>>>0&63|128)}}}function f(e){for(var t=0,r=0,n=e.length;ro&&++a;t=new Int32Array(a)}for(n=r=0;r=this._complex._atoms.length)){var r=Math.min(e.atomIndex1,e.atomIndex2);this._complex.addBond(this._complex._atoms[r],this._complex._atoms[t],e.bondOrder,La.BondType.UNKNOWN,!0)}}},{key:"_updateSecStructure",value:function(e,t,r){if(!w.isUndefined(r)&&r.secStruct===this._ssType)return t._secondary=this._ssStruct,void(this._ssStruct&&(this._ssStruct.term=t));if(!w.isUndefined(r)){var n=Fa[r.secStruct];this._ssType=r.secStruct,this._ssStart=t;var i=null;switch(this._ssType){case-1:case 7:break;case 0:case 2:case 4:i=new Pa([3,-1,1,-1,5][this._ssType],t,t,0,"","",0),e._helices.push(i);break;case 3:var o=new Na("",0);e._sheets.push(o),i=new Ia(o,t,t,0,null,null);break;default:void 0!==n&&(i=new He(n,t,t))}this._ssStruct=i,(t._secondary=i)&&e.structures.push(i)}}},{key:"_updateMolecules",value:function(e){var t=e.entityList;if(t)for(var r=e.chainsPerModel[0],n=0;n=Math.PI/2)}),e}},{key:"_setBoxParams",value:function(e,t,r){var n=this,i=0,o=0,s=y(this._header.angles,3),a=s[0],l=s[1];s[2]>=Math.PI/2&&(i+=Math.abs(t.x)),l>=Math.PI/2&&(i+=Math.abs(r.x)),a>=Math.PI/2&&(o+=Math.abs(r.y)),this._boxStart=new me.Vector3(this._origin.x-i,this._origin.y-o,this._origin.z),this._boxSize=new me.Vector3(Math.abs(e.x)+Math.abs(t.x)+Math.abs(r.x),Math.abs(t.y)+Math.abs(r.y),Math.abs(r.z));function c(e,t){return Math.abs(e[t])/n._boxSize[t]}this._header.delta.x=c(t,"x"),this._header.delta.y=c(r,"x"),this._header.delta.z=c(r,"y")}},{key:"_getXYZbox",value:function(){return new me.Box3(this._boxStart.clone(),this._boxStart.clone().add(this._boxSize))}},{key:"_toXYZData",value:function(){}},{key:"parse",value:function(e){return this._parseHeader(e),this._setOrigins(),new Sr(Float32Array,this._getXYZdim(),this._getXYZbox(),1,this._toXYZData(),this._getVolumeInfo())}}]),e}(),ll={extent:[ol,"u32",0],type:[nl,"u32",3],nstart:[ol,"i32",4],grid:[ol,"u32",7],cellDims:[il,"f32",10],angles:[ol,"f32",13],crs2xyz:[ol,"i32",16],dmin:[nl,"f32",19],dmax:[nl,"f32",20],dmean:[nl,"f32",21],ispg:[nl,"u32",22],nsymbt:[nl,"u32",23],lksflg:[nl,"u32",24],customData:[sl,"buffer",25,9],origin:[il,"f32",34],map:[sl,"buffer",52,1],machine:[nl,"u32",53],sd:[nl,"f32",54],nlabel:[nl,"f32",55],label:[sl,"buffer",56,200]},cl=function(){function e(){return W(this,e),Y(this,X(e).apply(this,arguments))}return A(e,al),p(e,[{key:"_parseHeader",value:function(e){this._buff=e,this._typedCheck();var t={};t.u32=new Uint32Array(this._buff,0,56),t.i32=new Int32Array(this._buff,0,56),t.f32=new Float32Array(this._buff,0,56),t.buffer=this._buff;var r=this._header;this._fillHeader(ll,t),r.angles.forEach(function(e,t,r){r[t]*=Math.PI/180})}},{key:"_setAxisIndices",value:function(){var e=this._header;0===e.cellDims.x&&0===e.cellDims.y&&0===e.cellDims.z&&e.cellDims.set(1,1,1);var t=this._header.crs2xyz;0===t[0]&&0===t[1]&&0===t[2]&&(t[0]=1,t[1]=2,t[2]=3);var r=this._xyz2crs;r[t[0]-1]=0,r[t[1]-1]=1,r[t[2]-1]=2}},{key:"_setOrigins",value:function(){var e=this._getAxis(),t=y(e,3),r=t[0],n=t[1],i=t[2];this._setAxisIndices();var o=this._header,s=this._xyz2crs;if(0===o.origin.x&&0===o.origin.y&&0===o.origin.z?(this._origin.addScaledVector(r,o.nstart[s[0]]),this._origin.addScaledVector(n,o.nstart[s[1]]),this._origin.addScaledVector(i,o.nstart[s[2]])):this._origin=o.origin,r.multiplyScalar(o.extent[s[0]]-1),n.multiplyScalar(o.extent[s[1]]-1),i.multiplyScalar(o.extent[s[2]]-1),2!==o.type)throw new Error("CCP4: Unsupported format ".concat(o.type));this._data=new Float32Array(this._buff,1024+o.nsymbt,o.extent[0]*o.extent[1]*o.extent[2]),this._setBoxParams(r,n,i)}},{key:"_toXYZData",value:function(){var e=this._header,t=this._data,r=this._xyz2crs,n=new Float32Array(t.length),i=this._getXYZdim(),o=i[0],s=i[1],a=0,l=[];for(l[2]=0;l[2]=this._strings.length?(this._currentStart=this._strings.length-1,this._currentStringIndx=this._strings.length-1):(this._currentStart=e,this._currentStringIndx=e)}},{key:"getNextString",value:function(){return this._strings[++this._currentStringIndx]}},{key:"getCurrentString",value:function(){return this._strings[this._currentStringIndx]}},{key:"getStringFromStart",value:function(e){return this._currentStringIndx=this._currentStart+e,this._strings[this._currentStart+e]}},{key:"findNextDataItem",value:function(){for(var e=this.getNextString(),t=!1;!w.isUndefined(e)&&"$$$$"!==e.trim();){if(e.match(/>\s+<(.*)>/)){t=!0;break}e=this.getNextString()}return t}},{key:"findNextCompoundStart",value:function(){for(var e=this.getCurrentString();!w.isUndefined(e)&&"$$$$"!==e.trim();)e=this.getNextString();return this.setStart(++this._currentStringIndx),this.probablyHaveDataToParse()}},{key:"probablyHaveDataToParse",value:function(){return this._currentStringIndx\s+<(.+)>.*/,kl=/.*($$$$).*|.*>\s+<(.+)>.*/,Tl="sdf",Rl="mol",Ml=["name","id","title"],Pl={name:["PUBCHEM_IUPAC_TRADITIONAL_NAME",/PUBCHEM_(.+)_NAME/,/(.+)name/,/(.+)NAME/],id:["PUBCHEM_COMPOUND_CID","id","ID",/.*CID/,/.*ID/,/.*id/],title:["msg","MSG","message","title","description","desc"]};var Nl=function(){function n(e,t){var r;return W(this,n),(r=Y(this,X(n).call(this,e,t)))._format="sdf",r._complex=null,r._chain=null,r._residue=null,r._molecules=null,r._metadata={},r._metadata.molecules=[],r._currentMolProps={},r._compoundIndx=-1,r._assemblies=[],r._atomsParsed=0,r._atomsIndexes=[],r}return A(n,ia),p(n,[{key:"canProbablyParse",value:function(e){return w.isString(e)&&El.test(e)}},{key:"_parseHeader",value:function(e){var t={};t.name=e.getStringFromStart(0);var r=parseInt(e.getStringFromStart(1).substr(10,6).trim(),10);t.date=r.toString()||"",t.title=e.getStringFromStart(2),this._metadata.molecules.push(t)}},{key:"_parseAtoms",value:function(e,t){var r,n=this._atomsParsed,i=function(e){if(!e)return"A";for(var t=[];e;)t.push(65+e%26),e=Math.trunc(e/26);return 1]/g,"").trim()]=r}},{key:"_parseCompound",value:function(e){if(this._parseMOL(e),this._format===Tl){for(this._currentMolProps={};e.findNextDataItem();)this._parseDataItem(e);if(0!==Object.keys(this._currentMolProps).length){var t=this._metadata.molecules[this._compoundIndx];t.props=this._currentMolProps,this._tryToUpdateMoleculeData(t)}}}},{key:"_fixBondsArray",value:function(){for(var e=this._serialAtomMap,t=this._complex._bonds,r=0;r>8&255}if(100!==t.i16[18])throw new Error("DSN6: Incorrect format ");var o=this._header;this._fillHeader(Il,t),o.cellDims.multiplyScalar(1/o.scaleFactor),o.angles.forEach(function(e,t,r){r[t]*=Math.PI/180/o.scaleFactor}),o.div/=100}},{key:"_setAxisIndices",value:function(){this._xyz2crs[0]=0,this._xyz2crs[1]=1,this._xyz2crs[2]=2}},{key:"_setOrigins",value:function(){var e=this._header,t=this._getAxis(),r=y(t,3),n=r[0],i=r[1],o=r[2];this._setAxisIndices(),this._origin.addScaledVector(n,e.nstart[0]),this._origin.addScaledVector(i,e.nstart[1]),this._origin.addScaledVector(o,e.nstart[2]),n.multiplyScalar(e.extent[0]),i.multiplyScalar(e.extent[1]),o.multiplyScalar(e.extent[2]),this._setBoxParams(n,i,o)}},{key:"_pointCalculate",value:function(e,t,r,n,i,o,s){var a=this._header;return in&&(n=e[i]);this._header.sd=Math.sqrt(t/e.length),this._header.dmax=n,this._header.dmin=r}}]),e}(),Ol=function(){function n(e,t){var r;return W(this,n),(r=Y(this,X(n).call(this,e,t)))._options.fileType="dsn6",r.model=new Ll,r}return A(n,ia),p(n,[{key:"parseSync",value:function(){return this.model.parse(this._data)}}],[{key:"canParse",value:function(e,t){return!!e&&(e instanceof ArrayBuffer&&ia.checkDataTypeOptions(t,"dsn6"))}},{key:"canProbablyParse",value:function(){return!1}}]),n}();Ol.formats=["dsn6"],Ol.extensions=[".dsn6",".omap"],Ol.binary=!0;var Vl=function(){function r(e){var t;return W(this,r),(t=Y(this,X(r).call(this,e)))._next=-1,t.next(),t}return A(r,la),p(r,[{key:"getNext",value:function(){return this._next}}]),r}(),Dl=Cr.Complex,zl=Cr.Element,Fl=Cr.Molecule,Bl=function(){function n(e,t){var r;return W(this,n),(r=Y(this,X(n).call(this,e,t)))._time=null,r._numAtoms=null,r._residueNumber=null,r._residueName="",r._atomName="",r._atomNumber=null,r._atomPosition=[],r._atomVelocity=[],r._complex=null,r._molecules=[],r._molecule=null,r._options.filetype="gro",r}return A(n,ia),p(n,[{key:"canProbablyParse",value:function(e){return w.isString(this._data)&&/^\s*[^\n]*\n\s*\d+ *\n\s*\d+[^\n\d]{3}\s*\w+\s*\d+\s*-?\d/.test(e)}},{key:"_parseTitle",value:function(e){var t=this._complex.metadata;t.id=e.readLine().trim(),t.name=t.id.slice(t.id.lastIndexOf("\\")+1,t.id.lastIndexOf(".")),t.format="gro"}},{key:"_parseNumberOfAtoms",value:function(e){if(this._numAtoms=e.readInt(0,e.getNext()),Number.isNaN(this._numAtoms))throw new Error("Line 2 is not representing atom number. Consider checking input file")}},{key:"_parseAtom",value:function(e){this._residueNumber=e.readInt(1,5),this._residueName=e.readString(6,10).trim(),this._atomName=e.readString(11,15).trim(),this._atomNumber=e.readInt(16,20);var t=10*e.readFloat(21,28),r=10*e.readFloat(29,36),n=10*e.readFloat(37,45);if(Number.isNaN(t)||Number.isNaN(r)||Number.isNaN(n))this._complex.error={message:'Atom position is invalid in "'.concat(e.readLine(),'"')};else{var i=zl.getByName(this._atomName[0]);if("Unknown"!==i.fullName){var o=zl.Role[this._atomName],s=this._chain;s||(this._chain=s=this._complex.addChain("A"));var a=this._residue;a&&a.getSequence()===this._residueNumber||(this._residue=a=s.addResidue(this._residueName,this._residueNumber," ")),this._atomPosition=new me.Vector3(t,r,n);a.addAtom(this._atomName,i,this._atomPosition,o,!0,this._atomNumber," ",1,1,0)}else this._complex.error={message:"".concat(this._atomName[0]," hasn't been recognised as an atom name.")}}}},{key:"_finalize",value:function(){var e=new Fl(this._complex,this._complex.metadata.name,1);e.residues=this._chain._residues,e._chains=this._chain,this._complex._molecules[0]=e,this._molecules.push(e),this._complex.finalize({needAutoBonding:!0,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing,serialAtomMap:this._serialAtomMap})}},{key:"parseSync",value:function(){var e=this._complex=new Dl,t=new Vl(this._data),r=0;for(this._parseTitle(t),t.next(),this._parseNumberOfAtoms(t),t.next(),r=0;r".concat(e)))return;this._currPosIdx++}this._toStringFromStart(0,t)}},{key:"_toStringFromHeader",value:function(e,t,r){this._toHeaderString(e,r);var n=this._currPosIdx+t;r[this._currPosIdx].match("@".concat(e))&&n=t.length?this._currStartIdx=this._currPosIdx=t.length-1:this._currStartIdx=this._currPosIdx=e}},{key:"_probablyHaveDataToParse",value:function(e){return this._currPosIdxMOLECULE>"!==e[this._currPosIdx].trim();)this._currPosIdx++;return this._setStart(++this._currPosIdx,e),this._probablyHaveDataToParse(e)}},{key:"_parseMolecule",value:function(e){this._toHeaderString("MOLECULE",e);var t=this._complex.metadata;t.name=e[++this._currPosIdx],t.format="mol2",this._molecule={_index:"",_chains:[]},this._molecule._index=this._compoundIndx+1,this._molecules.push(this._molecule)}},{key:"_parseAtoms",value:function(e,t){this._toHeaderString("ATOM",t);for(var r=0;r"!==e[7]&&(r=e[7].replace(Xl,"")),this.settings.now.nowater&&("HOH"===r||"WAT"===r))return!1;var n=this._residue,i=this._chain;return n&&n.getSequence()===t||(this._residue=i.addResidue(r,t,"A")),!0}},{key:"_parseBonds",value:function(e,t){this._toHeaderString("BOND",t);for(var r=0;rMath.abs(t-r)+1&&(n=n.substr(0,Math.abs(t-r+1))),o+1(i=this._resultArray[this._currentStr]).length&&(this._resultArray[this._currentStr]+=" ".repeat(s-i.length))}}},{key:"writeBondsArray",value:function(e,t){for(var r=this._getSubArrays(e,4),n=0;n-t.near?"hidden":"visible",a=1e4*(t.far- -this._vector.z)/(t.far-t.near),l=e.getElement();if(void 0===r.fog)l.style.color=i(e.userData.color),"transparent"!==e.userData.background&&(l.style.background=i(e.userData.background));else{var c=me.Math.smoothstep(-this._vector.z,r.fog.near,r.fog.far);l.style.color=n(e.userData.color,r.fog.color,c),"transparent"!==e.userData.background&&(l.style.background=n(e.userData.background,r.fog.color,c))}this._vector.applyMatrix4(this._projectionMatrix);var u="".concat(e.userData!=={}?e.userData.translation:"translate(-50%, -50%) ","translate(").concat(this._vector.x*this._widthHalf+this._widthHalf,"px,").concat(-this._vector.y*this._heightHalf+this._heightHalf,"px)");l.style.visibility=s,l.style.WebkitTransform=u,l.style.MozTransform=u,l.style.oTransform=u,l.style.transform=u,l.style.zIndex=Number(a).toFixed(0),l.parentNode!==this._domElement&&this._domElement.appendChild(l)}for(var h=0,d=e.children.length;h=this._framesCount&&(e=0),this._buffer={state:"none"},this._prepareBuffer(e,e+this._framesRequestLength),null!==this._frameRequest){var t=this._frameRequest;this._frameRequest=null,this.setFrame(t)}}}},{key:"parseBinaryData",value:function(e){var t=new DataView(e),r=0,n=t.getUint32(r,!0);r+=4;var i=t.getUint32(r,!0);this._framesCount=i,this._framesRange.end=0>>28,g=Qc((268435200&_)>>>8>>0),y=Qc(((255&_)<<12|(4293918720&m)>>>20)>>0),x=Qc((1048575&m)>>0);(d[p]=0)=this._framesRange.start&&e<=this._framesRange.end)this._currFrame=e,this._cachedResidues=!1,this._updateSecondary(),this.frameIsReady=!0;else if(this._frameRequest=e,this._buffer){switch(this._buffer.state){case"none":this._prepareBuffer(e);break;case"ready":this._parseBuffer()}}else this._prepareBuffer(e)}},{key:"disableEvents",value:function(){this._callbacks=null}},{key:"getAtomPos",value:function(e){var t=i._vec,r=this._data,n=3*(this._atomsCount*(this._currFrame-this._framesRange.start)+e);return t.set(r[n],r[1+n],r[2+n]),t}},{key:"getResidues",value:function(){return this._cachedResidues||this._complex.updateToFrame(this),this._residues}}]),i}();Ce(Jc,"_vec",new me.Vector3);var eu=function(){function r(e,t){if(W(this,r),this.constructor===r)throw new Error("Can not instantiate abstract class!");this.params=e,this.opts=w.merge(_e.deriveDeep(Q.now.objects[this.type],!0),t),this.needsRebuild=!1,this._mesh=null,this.id=null}return p(r,[{key:"identify",value:function(){var e={type:this.type,params:this.params},t=_e.objectsDiff(this.opts,Q.now.modes[this.id]);return w.isEmpty(t)||(e.opts=t),e}},{key:"toString",value:function(){return"o=".concat(this.type,",").concat(this.params.join(","))+_e.compareOptionsWithDefaults(this.opts,Q.defaults.objects[this.type])}},{key:"getGeometry",value:function(){return this._mesh}},{key:"destroy",value:function(){this._mesh&&tn.destroyObject(this._mesh)}}]),r}();eu.prototype.type="__";var tu=function(){function i(e,t){var r;if(W(this,i),r=Y(this,X(i).call(this,e,t)),e.length<2)throw new Error("Wrong number of argumets on line object creation!");var n=y(e,2);return r._id1=n[0],r._id2=n[1],r}return A(i,eu),p(i,[{key:"_getAtomFromName",value:function(e,t){var r=e.getAtomByFullname(t);if(!r)throw new Error(t+" - Wrong atom format it must be '#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME' (e.g. 'A.38.CO1')");return r}},{key:"build",value:function(e){var t=new me.Geometry;this._atom1=this._getAtomFromName(e,this._id1),this._atom2=this._getAtomFromName(e,this._id2),t.vertices[0]=this._atom1.position.clone(),t.vertices[1]=this._atom2.position.clone(),t.dynamic=!0,t.computeBoundingBox(),this._line=new Fi.Line(t,new jr({lights:!1,overrideColor:!0,dashedLine:!0,fogTransparent:Q.now.bg.transparent})),this._line.computeLineDistances(),this._line.material.setUberOptions({fixedColor:new me.Color(this.opts.color),dashedLineSize:this.opts.dashSize,dashedLinePeriod:this.opts.dashSize+this.opts.gapSize}),this._line.material.updateUniforms(),this._line.raycast=function(e,t){},this._mesh=this._line;var r=e.getTransforms();0 threshold ) ? vec4(color.rgb, 1.0) : gl_FragColor = texture2D(srcTex, vUv);\r\n\r\n #else\r\n vec4 c00 = texture2D(srcTex, vUv + vec2(-pixelSize.x,-pixelSize.y));\r\n vec4 c01 = texture2D(srcTex, vUv + vec2(0,-pixelSize.y));\r\n vec4 c02 = texture2D(srcTex, vUv + vec2(pixelSize.x,-pixelSize.y));\r\n vec4 c10 = texture2D(srcTex, vUv + vec2(-pixelSize.x,0));\r\n vec4 c12 = texture2D(srcTex, vUv + vec2(pixelSize.x,0));\r\n vec4 c20 = texture2D(srcTex, vUv + vec2(-pixelSize.x,pixelSize.y));\r\n vec4 c21 = texture2D(srcTex, vUv + vec2(0,pixelSize.y));\r\n vec4 c22 = texture2D(srcTex, vUv + vec2(pixelSize.x,pixelSize.y));\r\n\r\n vec4 horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n vec4 vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n vec4 grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n gl_FragColor = grad;\r\n #endif\r\n}\r\n",transparent:!0,depthTest:!1,depthWrite:!1};return t.setValues(r),t}return A(n,e),p(n,[{key:"copy",value:function(e){ft(X(n.prototype),"copy",this).call(this,e),this.depth=e.depth}},{key:"setValues",value:function(e){if(void 0!==e){ft(X(n.prototype),"setValues",this).call(this,e);var t={};this.depth&&(t.DEPTH_OUTLINE=1),this.defines=t}}}]),n}(me.RawShaderMaterial);ru.prototype.depth=!1;var nu=function(e){function r(e){var t;return W(this,r),(t=Y(this,X(r).call(this,e))).setValues.call(S(t),{uniforms:{srcTex:{type:"t",value:null},srcTexelSize:{type:"v2",value:new me.Vector2(1/512,1/512)},bgColor:{type:"c",value:new me.Color(16777215)}},vertexShader:kr,fragmentShader:"precision highp float;\r\n\r\n// edge end finding algorithm parameters\r\n#define FXAA_QUALITY_PS 8\r\n#define FXAA_QUALITY_P0 1.0\r\n#define FXAA_QUALITY_P1 1.5\r\n#define FXAA_QUALITY_P2 2.0\r\n#define FXAA_QUALITY_P3 2.0\r\n#define FXAA_QUALITY_P4 2.0\r\n#define FXAA_QUALITY_P5 2.0\r\n#define FXAA_QUALITY_P6 4.0\r\n#define FXAA_QUALITY_P7 12.0\r\n// constants\r\nfloat fxaaQualityEdgeThreshold = 0.125;\r\nfloat fxaaQualityEdgeThresholdMin = 0.0625;\r\nfloat fxaaQualitySubpix = 0.7; //0.65;\r\n// global params\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexelSize;\r\nuniform vec3 bgColor;\r\n// from vs\r\nvarying vec2 vUv;\r\n//=====================================================================//\r\n// calc luminance from rgb\r\n//'float FxaaLuma(vec3 rgb) {return rgb.y * (0.587/0.299) + rgb.x; } // Lotte's idea about game luminance\r\nfloat FxaaLuma(vec3 rgb) {return dot(rgb, vec3(0.299, 0.587, 0.114)); } // real luminance calculation\r\n // for non-real scene rendering\r\n// texture sampling by pixel position(coords) and offset(in pixels)\r\n vec3 FxaaTex(sampler2D tex, vec2 pos, vec2 off, vec2 res ) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos + off * res );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos + off * res ).xyz;\r\n #endif\r\n}\r\nvec3 FxaaTexTop(sampler2D tex, vec2 pos) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos).xyz;\r\n #endif\r\n}\r\nvec4 FxaaTexTopAlpha(sampler2D tex, vec2 pos) {\r\n return texture2D( tex, pos);\r\n}\r\n\r\n//=====================================================================//\r\nvoid main() {\r\n // renaming\r\n vec2 posM = vUv;\r\n // get luminance for neighbours\r\n float lumaS = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, 1.0 ), srcTexelSize));\r\n float lumaE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 0.0 ), srcTexelSize));\r\n float lumaN = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, -1.0 ), srcTexelSize));\r\n float lumaW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 0.0 ), srcTexelSize));\r\n float lumaM = FxaaLuma(FxaaTexTop(srcTex, posM));\r\n // find max and min luminance\r\n float rangeMax = max(max(lumaN, lumaW), max(lumaE, max(lumaS, lumaM)));\r\n float rangeMin = min(min(lumaN, lumaW), min(lumaE, min(lumaS, lumaM)));\r\n // calc maximum non-edge range\r\n float rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\r\n float range = rangeMax - rangeMin;\r\n float rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\r\n // exit when luma contrast is small (is not edge)\r\n if(range < rangeMaxClamped){\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n return;\r\n }\r\n float subpixRcpRange = 1.0/range;\r\n // note: the sampling coordinates can be calculated in vertex shader but the approach doesn't affect performance\r\n // visibly, thus we decided to leave calculation here for better readability.\r\n // calc other neighbours luminance\r\n float lumaNE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, -1.0 ), srcTexelSize));\r\n float lumaSW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 1.0 ), srcTexelSize));\r\n float lumaSE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 1.0 ), srcTexelSize));\r\n float lumaNW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, -1.0 ), srcTexelSize));\r\n/*--------------span calculation and subpix amount calulation-----------------*/\r\n float lumaNS = lumaN + lumaS;\r\n float lumaWE = lumaW + lumaE;\r\n float subpixNSWE = lumaNS + lumaWE;\r\n float edgeHorz1 = (-2.0 * lumaM) + lumaNS;\r\n float edgeVert1 = (-2.0 * lumaM) + lumaWE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNESE = lumaNE + lumaSE;\r\n float lumaNWNE = lumaNW + lumaNE;\r\n float edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\r\n float edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNWSW = lumaNW + lumaSW;\r\n float lumaSWSE = lumaSW + lumaSE;\r\n float edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\r\n float edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\r\n float edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\r\n float edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\r\n float edgeHorz = abs(edgeHorz3) + edgeHorz4;\r\n float edgeVert = abs(edgeVert3) + edgeVert4;\r\n/*--------------------subpix amount calulation------------------------------*/\r\n float subpixNWSWNESE = lumaNWSW + lumaNESE;\r\n float lengthSign = srcTexelSize.x;\r\n bool horzSpan = edgeHorz >= edgeVert;\r\n // debug code edge span visualization\r\n/*' if (horzSpan)\r\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);\r\n else\r\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\r\n return;*/\r\n float subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\r\n/*--------------------------------------------------------------------------*/\r\n if(!horzSpan) lumaN = lumaW;\r\n if(!horzSpan) lumaS = lumaE;\r\n if(horzSpan) lengthSign = srcTexelSize.y;\r\n float subpixB = (subpixA * (1.0/12.0)) - lumaM;\r\n/*--------------------------------------------------------------------------*/\r\n float gradientN = lumaN - lumaM;\r\n float gradientS = lumaS - lumaM;\r\n float lumaNN = lumaN + lumaM;\r\n float lumaSS = lumaS + lumaM;\r\n bool pairN = abs(gradientN) >= abs(gradientS);\r\n float gradient = max(abs(gradientN), abs(gradientS));\r\n if(pairN) lengthSign = -lengthSign;\r\n float subpixC = clamp(abs(subpixB) * subpixRcpRange, 0.0, 1.0);\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posB;\r\n posB = posM;\r\n vec2 offNP;\r\n offNP.x = (!horzSpan) ? 0.0 : srcTexelSize.x;\r\n offNP.y = ( horzSpan) ? 0.0 : srcTexelSize.y;\r\n if(!horzSpan) posB.x += lengthSign * 0.5;\r\n if( horzSpan) posB.y += lengthSign * 0.5;\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posN;\r\n posN = posB - offNP * FXAA_QUALITY_P0;\r\n vec2 posP;\r\n posP = posB + offNP * FXAA_QUALITY_P0;\r\n float subpixD = ((-2.0)*subpixC) + 3.0;\r\n float lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN));\r\n float subpixE = subpixC * subpixC;\r\n float lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP));\r\n/*--------------------------------------------------------------------------*/\r\n if(!pairN) lumaNN = lumaSS;\r\n float gradientScaled = gradient * 1.0/4.0;\r\n float lumaMM = lumaM - lumaNN * 0.5;\r\n float subpixF = subpixD * subpixE;\r\n bool lumaMLTZero = lumaMM < 0.0;\r\n/*---------------------looped edge-end search-------------------------------*/\r\n lumaEndN -= lumaNN * 0.5;\r\n lumaEndP -= lumaNN * 0.5;\r\n bool doneN = abs(lumaEndN) >= gradientScaled;\r\n bool doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P1;\r\n bool doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P1;\r\n/*--------------------------------------------------------------------------*/\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P2;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P2;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 3)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P3;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P3;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 4)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P4;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P4;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 5)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P5;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P5;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 6)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P6;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P6;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 7)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P7;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P7;\r\n/*--------------------------------------------------------------------------*/\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n/*----------------calculate subpix offset due to edge ends-------------------*/\r\n float dstN = posM.x - posN.x;\r\n float dstP = posP.x - posM.x;\r\n if(!horzSpan) dstN = posM.y - posN.y;\r\n if(!horzSpan) dstP = posP.y - posM.y;\r\n/*--------------------------------------------------------------------------*/\r\n bool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\r\n float spanLength = (dstP + dstN);\r\n bool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\r\n float spanLengthRcp = 1.0 / spanLength;\r\n/*--------------------------------------------------------------------------*/\r\n bool directionN = dstN < dstP;\r\n float dst = min(dstN, dstP);\r\n bool goodSpan = directionN ? goodSpanN : goodSpanP;\r\n float subpixG = subpixF * subpixF;\r\n float pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\r\n float subpixH = subpixG * fxaaQualitySubpix;\r\n/*-----------------calc texture offest using subpix-------------------------*/\r\n float pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\r\n float pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\r\n\r\n float offset = pixelOffsetSubpix * lengthSign;\r\n #ifdef BG_TRANSPARENT\r\n // get original texel\r\n vec4 rgbaA = FxaaTexTopAlpha(srcTex, posM);\r\n // calc step to blended texel\r\n vec2 step = sign((!horzSpan) ? vec2 (offset, 0.0) : vec2 (0.0, offset));\r\n // get neighboring texel\r\n vec4 rgbaB = FxaaTexTopAlpha(srcTex, posM + step * srcTexelSize);\r\n // calc blend factor from offset\r\n float f = (!horzSpan) ? offset / srcTexelSize.x : offset / srcTexelSize.y;\r\n f = abs(f);\r\n // calc alpha (special formula to emulate blending with bg)\r\n gl_FragColor.a = 1.0 - mix(1.0 - rgbaA.a, 1.0 - rgbaB.a, f);\r\n // calc color (special formula to emulate blending with bg)\r\n gl_FragColor.rgb = mix(rgbaA.rgb * rgbaA.a, rgbaB.rgb * rgbaB.a, f) / gl_FragColor.a;\r\n #else\r\n if(!horzSpan) {\r\n posM.x += offset;\r\n } else {\r\n posM.y += offset;\r\n }\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n #endif\r\n return;\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1}),t.setValues(e),t}return A(r,e),p(r,[{key:"copy",value:function(e){ft(X(r.prototype),"copy",this).call(this,e),this.depth=e.depth}},{key:"setValues",value:function(e){if(void 0!==e){ft(X(r.prototype),"setValues",this).call(this,e);var t={};this.bgTransparent&&(t.BG_TRANSPARENT=1),this.defines=t}}}]),r}(me.RawShaderMaterial);nu.prototype.bgTransparent=!1;var iu=[new me.Vector3(.295184,.077723,.068429),new me.Vector3(-.271976,-.365221,.838363),new me.Vector3(.547713,.467576,.488515),new me.Vector3(.662808,-.031733,.584758),new me.Vector3(-.025717,.218955,.657094),new me.Vector3(-.310153,-.365223,.370701),new me.Vector3(-.101407,-.006313,.747665),new me.Vector3(-.769138,.360399,.086847),new me.Vector3(-.271988,-.27514,.905353),new me.Vector3(.09674,-.566901,.700151),new me.Vector3(.562872,-.735136,.094647),new me.Vector3(.379877,.359278,.190061),new me.Vector3(.519064,-.023055,.405068),new me.Vector3(-.301036,.114696,.088885),new me.Vector3(-.282922,.598305,.487214),new me.Vector3(-.181859,.25167,.679702),new me.Vector3(-.191463,-.635818,.512919),new me.Vector3(-.293655,.427423,.078921),new me.Vector3(-.267983,.680534,.13288),new me.Vector3(.139611,.319637,.477439),new me.Vector3(-.352086,.31104,.653913),new me.Vector3(.321032,.805279,.487345),new me.Vector3(.073516,.820734,.414183),new me.Vector3(-.155324,.589983,.41146),new me.Vector3(.335976,.170782,.527627),new me.Vector3(.46346,-.355658,.167689),new me.Vector3(.222654,.59655,.769406),new me.Vector3(.922138,-.04207,.147555),new me.Vector3(-.72705,-.329192,.369826),new me.Vector3(-.090731,.53382,.463767),new me.Vector3(-.323457,-.876559,.238524),new me.Vector3(-.663277,-.372384,.342856)],ou=function(e){function t(){var e;return W(this,t),(e=Y(this,X(t).call(this))).setValues.call(S(e),{uniforms:{noiseTexture:{type:"t",value:zr.noiseTexture},noiseTexelSize:{type:"v2",value:new me.Vector2(1/zr.noiseWidth,1/zr.noiseHeight)},diffuseTexture:{type:"t",value:null},normalTexture:{type:"t",value:null},depthTexture:{type:"t",value:null},srcTexelSize:{type:"v2",value:new me.Vector2(1/512,1/512)},camNearFar:{type:"v2",value:new me.Vector2(1,10)},projMatrix:{type:"mat4",value:new me.Matrix4},aspectRatio:{type:"f",value:0},tanHalfFOV:{type:"f",value:0},samplesKernel:{type:"v3v",value:iu},kernelRadius:{type:"f",value:1},depthThreshold:{type:"f",value:1},factor:{type:"f",value:1}},vertexShader:kr,fragmentShader:"precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 32\r\nuniform vec3 samplesKernel[MAX_SAMPLES_COUNT];\r\nuniform sampler2D noiseTexture;\r\nuniform vec2 noiseTexelSize;\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D depthTexture;\r\nuniform sampler2D normalTexture;\r\nuniform vec2 srcTexelSize;\r\nuniform vec2 camNearFar;\r\nuniform mat4 projMatrix;\r\n\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\nuniform float kernelRadius;\r\nuniform float depthThreshold;\r\nuniform float factor;\r\n\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n // remap coordinates to prevent noise exture rescale\r\n vec2 vUvNoise = vUv / srcTexelSize * noiseTexelSize;\r\n vec4 normalData = texture2D(normalTexture, vUv);\r\n // return for background fragments (their normals are zero vectors)\r\n if (length(normalData.rgb) < EPSILON) {\r\n // 0.0 in alpha component means that it is background fragment\r\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\r\n return;\r\n }\r\n //[0, 1] -> [-1, 1]\r\n vec3 normal = (normalData.rgb * 2.0 - 1.0);\r\n // normalData.a store 1.0 if normal was build for frontfaced surface\r\n // and 0.0 in other case\r\n if (normalData.a < EPSILON) {\r\n normal *= -1.0;\r\n }\r\n // get random vector for sampling sphere rotation\r\n vec3 randN = texture2D(noiseTexture, vUvNoise).rgb * 2.0 - 1.0;\r\n randN = normalize(randN);\r\n // build TBN (randomly rotated around normal)\r\n vec3 tangent = normalize(randN - normal * dot(randN, normal));\r\n vec3 bitangent = cross(tangent, normal);\r\n mat3 TBN = mat3(tangent, bitangent, normal);\r\n // calc AO value\r\n float AO = 0.0;\r\n for (int i = 0 ; i < MAX_SAMPLES_COUNT ; i++) {\r\n // rotate sampling kernel around normal\r\n vec3 reflectedSample = TBN * samplesKernel[i];\r\n // get sample\r\n vec3 samplePos = viewPos + reflectedSample * kernelRadius;\r\n\r\n // project sample to screen to get sample's screen pos\r\n vec4 SampleScrPos = vec4(samplePos, 1.0);\r\n // eye -> clip\r\n SampleScrPos = projMatrix * SampleScrPos;\r\n // normalize\r\n SampleScrPos.xy /= SampleScrPos.w;\r\n //[-1, 1] -> [0, 1]\r\n SampleScrPos.xy = (SampleScrPos.xy + vec2(1.0)) * 0.5;\r\n\r\n // get view z for sample projected to the objct surface\r\n float sampleDepth = CalcViewZ(SampleScrPos.xy);\r\n // calc occlusion made by object surface at the sample\r\n AO += step(samplePos.z, sampleDepth);\r\n }\r\n // calc result AO-map color\r\n AO = 1.0 - max(0.0, AO / float(MAX_SAMPLES_COUNT) * factor);\r\n // write value to AO-map\r\n gl_FragColor = vec4(AO, AO, AO, 1.0);\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1}),e}return A(t,e),t}(me.RawShaderMaterial),su=[-2,-1,0,1,2],au=function(e){function t(){var e;return W(this,t),(e=Y(this,X(t).call(this))).setValues.call(S(e),{uniforms:{depthTexture:{type:"t",value:null},srcTexelSize:{type:"v2",value:new me.Vector2(1/512,1/512)},aoMap:{type:"t",value:null},samplesOffsets:{type:"fv1",value:su}},vertexShader:kr,fragmentShader:"precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = res;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x + samplesOffsets[i] * srcTexelSize.x, y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb = res.rgb / weightSum;\r\n gl_FragColor = res;\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1}),e}return A(t,e),t}(me.RawShaderMaterial),lu=[-2,-1,0,1,2],cu=function(e){function r(e){var t;return W(this,r),(t=Y(this,X(r).call(this,e))).setValues.call(S(t),{uniforms:{diffuseTexture:{type:"t",value:null},depthTexture:{type:"t",value:null},srcTexelSize:{type:"v2",value:new me.Vector2(1/512,1/512)},aoMap:{type:"t",value:null},samplesOffsets:{type:"fv1",value:lu},projMatrix:{type:"mat4",value:new me.Matrix4},aspectRatio:{type:"f",value:0},tanHalfFOV:{type:"f",value:0},fogNearFar:{type:"v2",value:new me.Vector2(100,100)},fogColor:{type:"v4",value:new me.Vector4(0,.5,0,1)}},vertexShader:kr,fragmentShader:"precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nuniform mat4 projMatrix;\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\n#ifdef USE_FOG\r\n uniform vec2 fogNearFar;\r\n uniform vec4 fogColor;\r\n#endif\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 color = texture2D(diffuseTexture, vec2(x, y));\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x, y + samplesOffsets[i] * srcTexelSize.y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb /= weightSum;\r\n\r\n #if defined(USE_FOG) && !defined(FOG_TRANSPARENT)\r\n // Add fog to the result value\r\n // Proper way to get an image with fog and ao requires formula:\r\n // gl_FragColor = fragColor*AO*(1-fogFactor) + fogColor*fogFactor\r\n // But we have already fogged molecule to add AO too. Let's split the straight formula into our real steps!\r\n // We have: AO, fogFactor, fogColor,\r\n // color = fragColor*(1-fogFactor) + fogColor*fogFactor (it comes from diffuseTexture,\r\n // where molecule has been already drawn with fog)\r\n // Transform:\r\n // fragColor*AO*(1-fogFactor) + fogColor*fogFactor =\r\n // = [fragColor*(1-fogFactor) = color - fogColor*fogFactor] =\r\n // = (color - fogColor*fogFactor)*AO + fogColor*fogFactor =\r\n // = color*AO + fogColor*fogFactor*(1 - AO)\r\n // Result: gl_FragColor = color*AO + fogColor*fogFactor*(1 - AO)\r\n float fogFactor = smoothstep(fogNearFar.x, fogNearFar.y, - viewPos.z) * fogColor.a;\r\n gl_FragColor.rgb = color.rgb * res.rgb + fogColor.rgb * fogFactor *(vec3(1.0, 1.0, 1.0) - res.rgb);\r\n #else\r\n gl_FragColor.rgb = color.rgb * res.rgb;\r\n #endif\r\n gl_FragColor.a = color.a;\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1}),t.setValues(e),t}return A(r,e),p(r,[{key:"setValues",value:function(e){if(void 0!==e){ft(X(r.prototype),"setValues",this).call(this,e);var t={};this.useFog&&(t.USE_FOG=1),this.fogTransparent&&(t.FOG_TRANSPARENT=1),this.defines=t}}}]),r}(me.RawShaderMaterial);cu.prototype.useFog=!0,cu.prototype.fogTransparent=!1;var uu=function(e){function r(){var e;W(this,r),e=Y(this,X(r).call(this));var t={uniforms:{srcL:{type:"t",value:null},srcR:{type:"t",value:null}},vertexShader:kr,fragmentShader:"precision highp float;\r\n\r\nuniform sampler2D srcL;\r\nuniform sampler2D srcR;\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vec4 l = texture2D(srcL, vUv);\r\n vec4 r = texture2D(srcR, vUv);\r\n gl_FragColor = vec4(l.r, r.g, r.b, 1.0);\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1};return e.setValues(t),e}return A(r,e),r}(me.RawShaderMaterial),hu=function(){function e(){W(this,e),this.position=new me.Vector3(0,0,0),this.scale=1,this.orientation=new me.Quaternion(0,0,0,1)}return p(e,[{key:"set",value:function(e,t,r){this.position=e,this.scale=t,this.orientation=r}}]),e}(),du=function(){function e(){W(this,e)}return p(e,[{key:"setup",value:function(e,t){this._startTime=void 0,this._endTime=void 0,this._isPaused=!1,this._srcView=e,this._dstView=t,this._isMoving=!1}},{key:"isMoving",value:function(){return this._isMoving}},{key:"wasStarted",value:function(){return void 0!==this._startTime&&void 0!==this._endTime}},{key:"start",value:function(){this._startTime=Date.now();var e=Q.now.interpolateViews?1500:0;this._endTime=this._startTime+e,this._isMoving=!0}},{key:"getCurrentView",value:function(){if(void 0===this._srcView||void 0===this._dstView||!this._isMoving||!this.wasStarted())return{success:!1};var e=this.createView(),t=Date.now();if(t>this._endTime)return e=this._dstView,this.reset(),{success:!0,view:e};var r=(t-this._startTime)/(this._endTime-this._startTime);return e.position.copy(this._srcView.position),e.position.lerp(this._dstView.position,r),e.scale=(1-r)*this._srcView.scale+r*this._dstView.scale,e.orientation.copy(this._srcView.orientation),e.orientation.slerp(this._dstView.orientation,r),{success:!0,view:e}}},{key:"reset",value:function(){this._startTime=this._endTime=0,this._isMoving=!1}},{key:"pause",value:function(){this._isPaused||(this.setup(this.getCurrentView().view,this._dstView),this._isPaused=!0)}},{key:"resume",value:function(){this._isPaused=!1}},{key:"createView",value:function(){return new hu}}]),e}();function fu(e,t){this.context=e,this._opts=w.merge({path:"/"},t)}function pu(i){function e(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="transparent",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if("xr"in navigator){var r=document.createElement("button");return r.style.display="none",e(r),navigator.xr.isSessionSupported("immersive-vr").then(function(e){return e?function(t){t.style.display="",t.style.cursor="pointer",t.style.left="calc(50% - 50px)",t.style.width="100px",t.textContent="ENTER VR";var r=null;function n(){r.removeEventListener("end",n),t.textContent="ENTER VR",r=null}function e(e){e.addEventListener("end",n),i._gfx.renderer.xr.setReferenceSpaceType("local"),i._gfx.renderer.xr.setSession(e),t.textContent="EXIT VR",r=e}t.onmouseenter=function(){t.style.opacity="1.0"},t.onmouseleave=function(){t.style.opacity="0.5"},t.onclick=function(){if(null===r){navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor"]}).then(e),i.moveSceneBehindHeadset()}else r.end()}}(r):((t=r).style.display="",t.style.cursor="auto",t.style.left="calc(50% - 75px)",t.style.width="150px",t.textContent="VR NOT FOUND",t.onmouseenter=null,t.onmouseleave=null,void(t.onclick=null));var t}),r}var t=document.createElement("a");return t.href="https://webvr.info",t.innerHTML="WEBXR NOT SUPPORTED",t.style.left="calc(50% - 90px)",t.style.width="180px",t.style.textDecoration="none",e(t),t}hn(fu.prototype),fu.prototype.removeCookie=function(e){var t=this._toCount(e),r=this._getSimpleCookie(t);if(r){this._removeSimpleCookie(t),r=parseInt(r,10);for(var n=0;nn?(o=!1,r.preset="empty"):Q.now.preset!==Q.defaults.preset&&(r.preset=Q.now.preset);for(var s=[],a=!0,l=0,c=n;lt[0].length)){if(t=r,n=o,this.options.backtrack_lexer){if(!1!==(e=this.test_match(r,i[o])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,i[n]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return 0 #aromatic radius"," atom = #atom radius"," bond = #bond radius"," multibond = #use multibond"," showarom = #show aromatic"," space = #space value\n"]},CA:{$help:[" Cartoon"," arrow = #arrow size"," depth = #depth of surface"," heightSegmentsRatio = "," radius = #tube radius"," tension = #"," width = #secondary width\n"]},LN:{$help:[" Lines"," atom = #atom radius"," chunkarom = "," multibond = #use multibond"," showarom = #show aromatic"," offsarom = \n"]},LC:{$help:[" Licorice"," aromrad = #aromatic radius"," bond = #bond radius"," multibond = #use multibond"," showarom = #show aromatic"," space = #space value\n"]},VW:{$help:[" Van der Waals"," nothing\n"]},TR:{$help:[" Trace"," radius = #tube radius\n"]},TU:{$help:[" Tube"," heightSegmentsRatio = "," radius = #tube radius"," tension = \n"]},SA:{$help:[" Surface"," zClip = #clip z plane\n"]},QS:{$help:[" Quick surface"," isoValue = "," scale = "," wireframe = "," zClip = #clip z plane\n"]},SE:{$help:[" Solvent excluded surface"," zClip = #clip z plane\n"]},TX:{$help:[" Text mode",' template = string that can include "{{ id }}"'," it will be replaced by value, id can be one of next:"," serial, name, type, sequence, residue, chain, hetatm, water\n",' horizontalAlign = {"left", "right", "center"}',' verticalAlign = {"top", "bottom", "middle"}'," dx = #offset along x"," dy = #offset along y"," dz = #offset along z"," fg = #text color modificator"," could be keyword, named color or hex"," fg = #back color modificator"," could be keyword, named color or hex"," showBg = #if set show background"," plate under text"]}},Ud={$help:["Coloring mode shortcut"," EL - color by element"," CH - color by chain"," SQ - color by sequence"," RT - color by residue type"," SS - color by secondary structure"," UN - uniform"],UN:{$help:["Parameters of coloring modes customization"," Uniform"," color = #RGB->HEX->dec\n"],color:{$help:Object.keys(fs.get(Q.now.palette).namedColors).sort().join("\n")}}},Gd={$help:["Material shortcut"," DF - diffuse"," TR - transparent"," SF - soft plastic"," PL - glossy plastic"," ME - metal"," GL - glass"]},jd={$help:["Short (packed) representation description as a set of variables"," s="," selector property"," m=[!:[,...]]"," render mode property"," c=[!:[,...]]"," color mode property"," mt="," material property"],s:{$help:"Selection expression string as it is in menu->representations->selection"},m:Bd,c:Ud,mt:Gd},Hd={$help:["Parameters of rendering modes customization: modes","Parameters of colorer customization: colorers","Autobuild: autobuild = (|)"],modes:Bd,colorers:Ud},Wd={$help:["help (| )","You can get detailed information about command options",' using "help cmd.opt.opt.[...]"\n'," you can use one line comments"," everything started from (#|//) will be skipped"," Example: >build //some comment\n","List of available commands:"],reset:{$help:["Reload current object, delete all representations"," Nothing will work until load new object"]},load:{$help:["load (||-f [<*.NC FILE URL STRING>])"," Load new pdb object from selected source"],PDBID:{$help:"pdb id in remote molecule database"},URL:{$help:"url to source file"},f:{$help:["open file system dialog to fetch local file","optionally you can determine trajectory file","via URL for *.top model"]}},clear:{$help:"No args. Clear terminal"},add:{$help:["add [] []"," Add new item to representation set with"," default or params"],REP_NAME:{$help:"Identifier string [_,a-z,A-Z,0-9] can not start from digit"},DESCRIPTION:jd},rep:{$help:["rep [|] []"," set current representation by name or index"," edit current representation by "],REP_NAME:{$help:["Identifier string [_,a-z,A-Z,0-9] can not start from digit","Must be declared before"]},REP_INDEX:{$help:"Index of available representation"},DESCRIPTION:jd},remove:{$help:["remove (|)","Remove representation by name or index"],REP_NAME:{$help:["Identifier string [_,a-z,A-Z,0-9] can not start from digit","Must be declared before"]},REP_INDEX:{$help:"Index of available representation"}},selector:{$help:["selector "," set selector from EXPRESSION to current representation"],EXPRESSION:{$help:"Selection expression string as it is in menu->representations->selection"}},mode:{$help:["mode [=...]"," set rendering mode and apply parameters to current representation"],MODE_ID:Bd},color:{$help:["color [=...]"," set colorer and apply parameters to current representation"],COLORER_ID:Ud},material:{$help:["material "," set material to current representation"],MATERIAL_ID:Gd},build:{$help:"build help str",add:{$help:"build.add",new:{$help:["add.new","add.new new line 1","add.new new line 2","add.new new line 3"]}},del:{$help:"build.del"}},list:{$help:["list [-e|-s||]","Print representations if no args print list of representations"," -e expand list and show all representations"," -s show all user-registered selectors"," | show only current representation"]},hide:{$help:["hide (|)","Hide representation referenced in args"]},show:{$help:["show (|)","Show representation referenced in args"]},get:{$help:["get ","Print value"," - path to option use get.PARAMETER to get more info"],PARAMETER:Hd},set:{$help:["set ","Set with "," - path to option use set.PARAMETER to get more info"],PARAMETER:Hd},set_save:{$help:["set_save","Save current settings to cookie"]},set_restore:{$help:["set_restore","Load and apply settings from cookie"]},set_reset:{$help:["set_reset","Reset current settings to the defaults"]},preset:{$help:["preset []","Reset current representation or set preset to "],PRESET:{$help:["default","wire","small","macro"]}},unit:{$help:["unit []","Change current biological structure view. Zero value means asymmetric unit,","positive values set an assembly with corresponding number.","Being called with no parameters command prints current unit information."]},view:{$help:["view []","Get current encoded view or set if ENCODED_VIEW placed as argument"],ENCODED_VIEW:{$help:["encoded view matrix string (binary code)"]}},rotate:{$help:["rotate (x|y|z) [] [(x|y|z) []]...","Rotate scene"]},scale:{$help:["scale ","Scale scene"]},select:{$help:["select [as ]","Select atoms using selector defined in SELECTOR_STRING"," and if SELECTOR_NAME is defined register it in viewer"," you can use it later as a complex selector"]},within:{$help:["within of as ","Build within named selector"," DISTANCE "," SELECTOR_STRING "," SELECTOR_NAME "]},url:{$help:["url [-s] [-v]","Report URL encoded scene"," if -s set that include settings in the URL"," if -v set that include view in the URL"]},screenshot:{$help:["screenshot [ []]","Make a screenshot of the scene"," WIDTH in pixels"," HEIGHT in pixels, equal to WIDTH by default"]},line:{$help:["line [=]","Draw dashed line between two specified atoms"]},removeobj:{$help:["removeobj ","Remove scene object by its index. Indices could be obtained by command"]},listobj:{$help:["listobj","Display the list of all existing scene objects"]}},Yd=rh.chem.selectors,Xd=rh.modes,qd=rh.colorers,$d=rh.materials,Zd=rh.palettes,Kd=rh.options,Qd=rh.settings;function Jd(){}var ef,tf=(ef=new Jd,function(){return ef}),rf=new(function(){function e(){W(this,e),this.representationMap={},this.representationID={}}return p(e,[{key:"get",value:function(e){return this.representationMap[e]||this.representationID[e]||""}},{key:"add",value:function(e,t){if(-1===e)return"Can not create representation: there is no data";if(void 0!==t){if(this.representationMap.hasOwnProperty(e))return"This name has already existed, registered without name";this.representationMap[e.toString()]=t,this.representationID[t]=e.toString()}return"Representation ".concat(e," successfully added")}},{key:"remove",value:function(e){e&&this.representationID.hasOwnProperty(e)&&(delete this.representationMap[this.representationID[e]],delete this.representationID[e]);var t=Object.keys(this.representationID).sort();for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];e"===a?"":", ".concat(a),"\n"),void 0!==n&&(i+=' selection : "'.concat(u,'"\n'),i+=" mode : (".concat(l.id,"), ").concat(l.name,"\n"),i+=" colorer : (".concat(c.id,"), ").concat(c.name,"\n"),i+=" material : (".concat(h.id,"), ").concat(h.name,"\n")),i}},{key:"listSelector",value:function(e,t){var r="";for(var n in t)t.hasOwnProperty(n)&&(r+="".concat(n,' : "').concat(t[n],'"\n'));return r}},{key:"listObjs",value:function(e){var t=e._objects;if(!t||!Array.isArray(t)||0===t.length)return"There are no objects on the scene";for(var r=[],n=0,i=t.length;nt-1&&(e=r-e),e},e=function(){function e(e,t){if(this.array=e.slice(0),this.length=this.array.length,!(this.clipHelper={clamp:this.clipHelperClamp,zero:this.clipHelperZero,periodic:this.clipHelperPeriodic,mirror:this.clipHelperMirror}[t.clip]))throw"Invalid clip: "+t.clip}return e.prototype.getClippedInput=function(e){return 0<=e&&e=i;s<=i?r++:r--)n+=this.kernel(e-r)*this.getClippedInput(r);return n},t}(e),p=function(e,t){var r,n,s,i;for(i=[],n=0,s=e.length;no;0<=o?c++:c--)r.push(new u(p(e,c),t));return r}(),function(e){var t,r,n,s;for(s=[],r=0,n=f.length;rn;n++){var i=r.charCodeAt(n);if(128>i)e.setUint8(t++,i>>>0&127|0);else if(2048>i)e.setUint8(t++,i>>>6&31|192),e.setUint8(t++,i>>>0&63|128);else if(65536>i)e.setUint8(t++,i>>>12&15|224),e.setUint8(t++,i>>>6&63|128),e.setUint8(t++,i>>>0&63|128);else{if(!(1114112>i))throw new Error("bad codepoint "+i);e.setUint8(t++,i>>>18&7|240),e.setUint8(t++,i>>>12&63|128),e.setUint8(t++,i>>>6&63|128),e.setUint8(t++,i>>>0&63|128)}}}function r(e){for(var t=0,r=0,n=e.length;n>r;r++){var s=e.charCodeAt(r);if(128>s)t+=1;else if(2048>s)t+=2;else if(65536>s)t+=3;else{if(!(1114112>s))throw new Error("bad codepoint "+s);t+=4}}return t}function n(e,s,i){var o=typeof e;if("string"===o){if(32>(a=r(e)))return s.setUint8(i,160|a),t(s,i+1,e),1+a;if(256>a)return s.setUint8(i,217),s.setUint8(i+1,a),t(s,i+2,e),2+a;if(65536>a)return s.setUint8(i,218),s.setUint16(i+1,a),t(s,i+3,e),3+a;if(4294967296>a)return s.setUint8(i,219),s.setUint32(i+1,a),t(s,i+5,e),5+a}if(e instanceof Uint8Array){var a=e.byteLength,l=new Uint8Array(s.buffer);if(256>a)return s.setUint8(i,196),s.setUint8(i+1,a),l.set(e,i+2),2+a;if(65536>a)return s.setUint8(i,197),s.setUint16(i+1,a),l.set(e,i+3),3+a;if(4294967296>a)return s.setUint8(i,198),s.setUint32(i+1,a),l.set(e,i+5),5+a}if("number"===o){if(!isFinite(e))throw new Error("Number not finite: "+e);if(Math.floor(e)!==e)return s.setUint8(i,203),s.setFloat64(i+1,e),9;if(e>=0){if(128>e)return s.setUint8(i,e),1;if(256>e)return s.setUint8(i,204),s.setUint8(i+1,e),2;if(65536>e)return s.setUint8(i,205),s.setUint16(i+1,e),3;if(4294967296>e)return s.setUint8(i,206),s.setUint32(i+1,e),5;throw new Error("Number too big 0x"+e.toString(16))}if(e>=-32)return s.setInt8(i,e),1;if(e>=-128)return s.setUint8(i,208),s.setInt8(i+1,e),2;if(e>=-32768)return s.setUint8(i,209),s.setInt16(i+1,e),3;if(e>=-2147483648)return s.setUint8(i,210),s.setInt32(i+1,e),5;throw new Error("Number too small -0x"+(-e).toString(16).substr(1))}if(null===e)return s.setUint8(i,192),1;if("boolean"===o)return s.setUint8(i,e?195:194),1;if("object"===o){var c=0,h=Array.isArray(e);if(h)a=e.length;else{var u=Object.keys(e);a=u.length}if(16>a?(s.setUint8(i,a|(h?144:128)),c=1):65536>a?(s.setUint8(i,h?220:222),s.setUint16(i+1,a),c=3):4294967296>a&&(s.setUint8(i,h?221:223),s.setUint32(i+1,a),c=5),h)for(var d=0;a>d;d++)c+=n(e[d],s,i+c);else for(d=0;a>d;d++){var p=u[d];c+=n(p,s,i+c),c+=n(e[p],s,i+c)}return c}throw new Error("Unknown type "+o)}function s(e){var t=typeof e;if("string"===t){if(32>(n=r(e)))return 1+n;if(256>n)return 2+n;if(65536>n)return 3+n;if(4294967296>n)return 5+n}if(e instanceof Uint8Array){if(256>(n=e.byteLength))return 2+n;if(65536>n)return 3+n;if(4294967296>n)return 5+n}if("number"===t){if(Math.floor(e)!==e)return 9;if(e>=0){if(128>e)return 1;if(256>e)return 2;if(65536>e)return 3;if(4294967296>e)return 5;throw new Error("Number too big 0x"+e.toString(16))}if(e>=-32)return 1;if(e>=-128)return 2;if(e>=-32768)return 3;if(e>=-2147483648)return 5;throw new Error("Number too small -0x"+e.toString(16).substr(1))}if("boolean"===t||null===e)return 1;if("object"===t){var n,i=0;if(Array.isArray(e)){n=e.length;for(var o=0;n>o;o++)i+=s(e[o])}else{var a=Object.keys(e);for(n=a.length,o=0;n>o;o++){var l=a[o];i+=s(l)+s(e[l])}}if(16>n)return 1+i;if(65536>n)return 3+i;if(4294967296>n)return 5+i;throw new Error("Array or object too long 0x"+n.toString(16))}throw new Error("Unknown type "+t)}function i(e){var t=new ArrayBuffer(s(e));return n(e,new DataView(t),0),new Uint8Array(t)}function o(e,t,r){return t?new e(t.buffer,t.byteOffset,t.byteLength/(r||1)):void 0}function a(e){return o(DataView,e)}function l(e){return o(Uint8Array,e)}function c(e){return o(Int8Array,e)}function h(e){return o(Int32Array,e,4)}function u(e){return o(Float32Array,e,4)}function d(e,t){var r=e.length/2;t||(t=new Int16Array(r));for(var n=0,s=0;r>n;++n,s+=2)t[n]=e[s]<<8^e[s+1]<<0;return t}function p(e,t){var r=e.length;t||(t=new Uint8Array(2*r));for(var n=a(t),s=0;r>s;++s)n.setInt16(2*s,e[s]);return l(t)}function m(e,t){var r=e.length/4;t||(t=new Int32Array(r));for(var n=0,s=0;r>n;++n,s+=4)t[n]=e[s]<<24^e[s+1]<<16^e[s+2]<<8^e[s+3]<<0;return t}function f(e,t){var r=e.length;t||(t=new Uint8Array(4*r));for(var n=a(t),s=0;r>s;++s)n.setInt32(4*s,e[s]);return l(t)}function _(e,t){var r=e.length;t||(t=new Float32Array(r/4));for(var n=a(t),s=a(e),i=0,o=0,l=r/4;l>i;++i,o+=4)n.setFloat32(o,s.getFloat32(o),!0);return t}function g(e,t,r){var n=e.length,s=1/t;r||(r=new Float32Array(n));for(var i=0;n>i;++i)r[i]=e[i]*s;return r}function y(e,t,r){var n=e.length;r||(r=new Int32Array(n));for(var s=0;n>s;++s)r[s]=Math.round(e[s]*t);return r}function x(e,t){var r,n;if(!t){var s=0;for(r=0,n=e.length;n>r;r+=2)s+=e[r+1];t=new e.constructor(s)}var i=0;for(r=0,n=e.length;n>r;r+=2)for(var o=e[r],a=e[r+1],l=0;a>l;++l)t[i]=o,++i;return t}function b(e){if(0===e.length)return new Int32Array;var t,r,n=2;for(t=1,r=e.length;r>t;++t)e[t-1]!==e[t]&&(n+=2);var s=new Int32Array(n),i=0,o=1;for(t=1,r=e.length;r>t;++t)e[t-1]!==e[t]?(s[i]=e[t-1],s[i+1]=o,o=1,i+=2):++o;return s[i]=e[e.length-1],s[i+1]=o,s}function w(e,t){var r=e.length;t||(t=new e.constructor(r)),r&&(t[0]=e[0]);for(var n=1;r>n;++n)t[n]=e[n]+t[n-1];return t}function S(e,t){var r=e.length;t||(t=new e.constructor(r)),t[0]=e[0];for(var n=1;r>n;++n)t[n]=e[n]-e[n-1];return t}function v(e,t){var r,n,s=e instanceof Int8Array?127:32767,i=-s-1,o=e.length;if(!t){var a=0;for(r=0;o>r;++r)e[r]i&&++a;t=new Int32Array(a)}for(r=0,n=0;o>r;){for(var l=0;e[r]===s||e[r]===i;)l+=e[r],++r;l+=e[r],++r,t[n]=l,++n}return t}function C(e,t){var r,n=t?127:32767,s=-n-1,i=e.length,o=0;for(r=0;i>r;++r)0===(c=e[r])?++o:o+=c===n||c===s?2:c>0?Math.ceil(c/n):Math.ceil(c/s);var a=t?new Int8Array(o):new Int16Array(o),l=0;for(r=0;i>r;++r){var c;if((c=e[r])>=0)for(;c>=n;)a[l]=n,++l,c-=n;else for(;s>=c;)a[l]=s,++l,c-=s;a[l]=c,++l}return a}function A(e,t){return w(x(e),t)}function E(e){return b(S(e))}function T(e,t,r){return g(x(e,h(r)),t,r)}function R(e,t){return b(y(e,t))}function M(e,t,r){return g(w(e,h(r)),t,r)}function P(e,t,r){return S(y(e,t),r)}function N(e,t,r){return g(v(e,h(r)),t,r)}function L(e,t,r){var n=v(e,h(r));return M(n,t,u(n))}function I(e,t,r){return C(P(e,t),r)}function O(e){var t=a(e),r=t.getInt32(0),n=t.getInt32(4),s=e.subarray(8,12);return[r,e=e.subarray(12),n,s]}function V(e,t,r,n){var s=new ArrayBuffer(12+n.byteLength),i=new Uint8Array(s),o=new DataView(s);return o.setInt32(0,e),o.setInt32(4,t),r&&i.set(r,8),i.set(n,12),i}function D(e){return V(2,e.length,void 0,l(e))}function k(e){return V(4,e.length,void 0,f(e))}function z(e,t){return V(5,e.length/t,f([t]),l(e))}function F(e){return V(6,e.length,void 0,f(b(e)))}function B(e){return V(8,e.length,void 0,f(E(e)))}function U(e,t){return V(9,e.length,f([t]),f(R(e,t)))}function G(e,t){return V(10,e.length,f([t]),p(I(e,t)))}function j(e){var t={};return ee.forEach((function(r){void 0!==e[r]&&(t[r]=e[r])})),e.bondAtomList&&(t.bondAtomList=k(e.bondAtomList)),e.bondOrderList&&(t.bondOrderList=D(e.bondOrderList)),t.xCoordList=G(e.xCoordList,1e3),t.yCoordList=G(e.yCoordList,1e3),t.zCoordList=G(e.zCoordList,1e3),e.bFactorList&&(t.bFactorList=G(e.bFactorList,100)),e.atomIdList&&(t.atomIdList=B(e.atomIdList)),e.altLocList&&(t.altLocList=F(e.altLocList)),e.occupancyList&&(t.occupancyList=U(e.occupancyList,100)),t.groupIdList=B(e.groupIdList),t.groupTypeList=k(e.groupTypeList),e.secStructList&&(t.secStructList=D(e.secStructList,1)),e.insCodeList&&(t.insCodeList=F(e.insCodeList)),e.sequenceIndexList&&(t.sequenceIndexList=B(e.sequenceIndexList)),t.chainIdList=z(e.chainIdList,4),e.chainNameList&&(t.chainNameList=z(e.chainNameList,4)),t}function H(e){function t(e){for(var t={},r=0;e>r;r++)t[i()]=i();return t}function r(t){var r=e.subarray(o,o+t);return o+=t,r}function n(t){var r=e.subarray(o,o+t);o+=t;var n=65535;if(t>n){for(var s=[],i=0;ir;r++)t[r]=i();return t}function i(){var i,l,c=e[o];if(0==(128&c))return o++,c;if(128==(240&c))return o++,t(l=15&c);if(144==(240&c))return o++,s(l=15&c);if(160==(224&c))return o++,n(l=31&c);if(224==(224&c))return i=a.getInt8(o),o++,i;switch(c){case 192:return o++,null;case 194:return o++,!1;case 195:return o++,!0;case 196:return l=a.getUint8(o+1),o+=2,r(l);case 197:return l=a.getUint16(o+1),o+=3,r(l);case 198:return l=a.getUint32(o+1),o+=5,r(l);case 202:return i=a.getFloat32(o+1),o+=5,i;case 203:return i=a.getFloat64(o+1),o+=9,i;case 204:return i=e[o+1],o+=2,i;case 205:return i=a.getUint16(o+1),o+=3,i;case 206:return i=a.getUint32(o+1),o+=5,i;case 208:return i=a.getInt8(o+1),o+=2,i;case 209:return i=a.getInt16(o+1),o+=3,i;case 210:return i=a.getInt32(o+1),o+=5,i;case 217:return l=a.getUint8(o+1),o+=2,n(l);case 218:return l=a.getUint16(o+1),o+=3,n(l);case 219:return l=a.getUint32(o+1),o+=5,n(l);case 220:return l=a.getUint16(o+1),o+=3,s(l);case 221:return l=a.getUint32(o+1),o+=5,s(l);case 222:return l=a.getUint16(o+1),o+=3,t(l);case 223:return l=a.getUint32(o+1),o+=5,t(l)}throw new Error("Unknown type 0x"+c.toString(16))}var o=0,a=new DataView(e.buffer);return i()}function $(e,t,r,n){switch(e){case 1:return _(t);case 2:return c(t);case 3:return d(t);case 4:return m(t);case 5:return l(t);case 6:return x(m(t),new Uint8Array(r));case 7:return x(m(t));case 8:return A(m(t));case 9:return T(m(t),m(n)[0]);case 10:return L(d(t),m(n)[0]);case 11:return g(d(t),m(n)[0]);case 12:return N(d(t),m(n)[0]);case 13:return N(c(t),m(n)[0]);case 14:return v(d(t));case 15:return v(c(t))}}function W(e,t){var r=(t=t||{}).ignoreFields,n={};return re.forEach((function(t){var s=!!r&&-1!==r.indexOf(t),i=e[t];s||void 0===i||(i instanceof Uint8Array?n[t]=$.apply(null,O(i)):n[t]=i)})),n}function Y(e){return String.fromCharCode.apply(null,e).replace(/\0/g,"")}function X(e,t,r){var n,s,i,o,a,l,c=(r=r||{}).firstModelOnly,h=t.onModel,u=t.onChain,d=t.onGroup,p=t.onAtom,m=t.onBond,f=0,_=0,g=0,y=0,x=0,b=-1,w=e.chainNameList,S=e.secStructList,v=e.insCodeList,C=e.sequenceIndexList,A=e.atomIdList,E=e.bFactorList,T=e.altLocList,R=e.occupancyList,M=e.bondAtomList,P=e.bondOrderList;for(n=0,s=e.chainsPerModel.length;s>n&&!(c&&f>0);++n){var N=e.chainsPerModel[f];for(h&&h({chainCount:N,modelIndex:f}),i=0;N>i;++i){var L=e.groupsPerChain[_];if(u){var I=Y(e.chainIdList.subarray(4*_,4*_+4)),O=null;w&&(O=Y(w.subarray(4*_,4*_+4))),u({groupCount:L,chainIndex:_,modelIndex:f,chainId:I,chainName:O})}for(o=0;L>o;++o){var V=e.groupList[e.groupTypeList[g]],D=V.atomNameList.length;if(d){var k=null;S&&(k=S[g]);var z=null;e.insCodeList&&(z=String.fromCharCode(v[g]));var F=null;C&&(F=C[g]),d({atomCount:D,groupIndex:g,chainIndex:_,modelIndex:f,groupId:e.groupIdList[g],groupType:e.groupTypeList[g],groupName:V.groupName,singleLetterCode:V.singleLetterCode,chemCompType:V.chemCompType,secStruct:k,insCode:z,sequenceIndex:F})}for(a=0;D>a;++a){if(p){var B=null;A&&(B=A[y]);var U=null;E&&(U=E[y]);var G=null;T&&(G=String.fromCharCode(T[y]));var j=null;R&&(j=R[y]),p({atomIndex:y,groupIndex:g,chainIndex:_,modelIndex:f,atomId:B,element:V.elementList[a],atomName:V.atomNameList[a],formalCharge:V.formalChargeList[a],xCoord:e.xCoordList[y],yCoord:e.yCoordList[y],zCoord:e.zCoordList[y],bFactor:U,altLoc:G,occupancy:j})}y+=1}if(m){var H=V.bondAtomList;for(a=0,l=V.bondOrderList.length;l>a;++a)m({atomIndex1:y-D+H[2*a],atomIndex2:y-D+H[2*a+1],bondOrder:V.bondOrderList[a]})}g+=1}_+=1}if(x=b+1,b=y-1,m&&M)for(a=0,l=M.length;l>a;a+=2){var $=M[a],W=M[a+1];($>=x&&b>=$||W>=x&&b>=W)&&m({atomIndex1:$,atomIndex2:W,bondOrder:P?P[a/2]:null})}f+=1}}function q(e){return i(j(e))}function Z(e,t){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),W(e instanceof Uint8Array?H(e):e,t)}function K(e,t,r,n){function s(){try{var e=Z(i.response);r(e)}catch(e){n(e)}}var i=new XMLHttpRequest;i.addEventListener("load",s,!0),i.addEventListener("error",n,!0),i.responseType="arraybuffer",i.open("GET",t+e.toUpperCase()),i.send()}function Q(e,t,r){K(e,ie,t,r)}function J(e,t,r){K(e,oe,t,r)}var ee=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"],te=["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"],re=ee.concat(te),ne="v1.1.0dev",se="//mmtf.rcsb.org/v1.0/",ie=se+"full/",oe=se+"reduced/";e.encode=q,e.decode=Z,e.traverse=X,e.fetch=Q,e.fetchReduced=J,e.version=ne,e.fetchUrl=ie,e.fetchReducedUrl=oe,e.encodeMsgpack=i,e.encodeMmtf=j,e.decodeMsgpack=H,e.decodeMmtf=W})?r.apply(t,n):r)||(e.exports=s)},535:t=>{"use strict";t.exports=e},698:e=>{"use strict";e.exports=t}},n={};function s(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e].call(i.exports,i,i.exports,s),i.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};return(()=>{"use strict";s.d(i,{default:()=>Mu});var e=s(535),t=s.n(e),r=s(698),n=function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;rthis._prevTime+1e3&&(this._text.textContent=this.fps.toPrecision(2),this._prevTime=e),e}update(){this._startTime=this.end()}show(e){void 0===e&&(e=!0),this.domElement.style.display=e?"block":"none"}};function f(e,t){return!e||e===t}function _(){this._handlers={}}_.prototype.addEventListener=function(e,r,n){let s=this._handlers[e];s||(this._handlers[e]=[],s=this._handlers[e]);const i=[r,n];void 0===t().find(s,(function(e){return e[0]===i[0]&&e[1]===i[1]}))&&s.push(i)},_.prototype.removeEventListener=function(e,r,n){const s=this;t().forEach(s._handlers,((i,o)=>{t().remove(i,(t=>f(e,o)&&f(r,t[0])&&f(n,t[1]||s)))})),this._handlers=t().omitBy(s._handlers,(e=>0===e.length))},_.prototype.dispatchEvent=function(e){const r=this;t().forEach(this._handlers[e.type],(t=>{const n=t[1]||r;t[0].apply(n,[e])}))};const g=_,y={debug:0,info:1,report:2,warn:3,error:4};function x(){g.call(this),this.console=!1,this._priority=y.warn}function b(e){if(!t().isNumber(e))throw new Error("Wrong log level specified!");return e}x.prototype=Object.create(g.prototype),x.prototype.constructor=x,x.prototype.instantiate=function(){return new x},Object.defineProperty(x.prototype,"level",{get(){return t().findKey(y,(e=>e===this._priority))},set(e){this._priority=b(y[e])}}),x.prototype.levels=function(){return Object.keys(y)},x.prototype.message=function(e,t){const r=b(y[e]);this._message(r,t)},x.prototype.debug=function(e){this._message(y.debug,e)},x.prototype.info=function(e){this._message(y.info,e)},x.prototype.report=function(e){this._message(y.report,e)},x.prototype.warn=function(e){this._message(y.warn,e)},x.prototype.error=function(e){this._message(y.error,e)},x.prototype._message=function(e,r){if(et===e));if(r=String(r),this.console){}this.dispatchEvent({type:"message",level:n,message:r})};const w=new x,S={DEFAULT:0,SAFARI:1};function v(e){return decodeURIComponent(e.replace(/\+/g," "))}function C(e){const t=(e=e||window.location.search).substring(e.indexOf("?")+1),r=/([^&=]+)=?([^&]*)/g,n=[];let s;for(;null!==(s=r.exec(t));)n.push([v(s[1]),v(s[2])]);return n}function A(e){let t=!1;this.enable=function(e){t=e};let r=0;const n=Object.keys(e);function s(e,n){return function(){const s=A.spaces.substr(0,2*r);t&&w.debug(`${s+n} {`),r++;for(var i=arguments.length,o=new Array(i),a=0;a=3&&"base64"===t[r-2]?new Blob([R(t[r-1])]):null}const L=/^[a-zA-Z0-9_]*$/,I=['"',"",'"'];const O={browserType:S,encodeQueryComponent:function(e,t){return encodeURIComponent(e).replace(t,(e=>String.fromCharCode(parseInt(e.substr(1),16)))).replace(/%20/g,"+")},decodeQueryComponent:v,getUrlParameters:C,getUrlParametersAsDict:function(e){const t={},r=C(e);for(let e=0;e0&&(i=Object.create(i))}return i},hexColor:function(e){return`#${`0000000${e.toString(16)}`.substr(-6)}`},DebugTracer:A,OutOfMemoryError:E,allocateTyped:function(e,t){let r=null;try{r=new e(t)}catch(e){throw e instanceof RangeError?new E(e.message):e}return r},bytesFromBase64:R,bytesToBase64:T,arrayFromBase64:function(e,t){return Array.prototype.slice.call(new t(R(e)))},arrayToBase64:function(e,t){return T(new t(e).buffer)},compareOptionsWithDefaults:function(e,t){const r=[];if(t&&e){const n=Object.keys(e);for(let s=0;s0)return`!${r.join()}`}return""},objectsDiff:function e(r,n){const s={};return t().forIn(r,((r,i)=>{const o=n[i];if(M(r)&&M(o)){const n=e(r,o);t().isEmpty(n)||(s[i]=n)}else t().isEqual(r,o)||(s[i]=r)})),s},forInRecursive:function(e,r){!function e(n,s){t().forIn(n,((t,n)=>{const i=s+(s.length>0?".":"");t instanceof Object?e(t,i+n):void 0!==t&&r(t,i+n)}))}(e,"")},enquoteString:function(e){return t().isString(e)?`"${e.replace(/"/g,'\\"')}"`:e},unquoteString:function(e){if(!t().isString(e))return e;if('"'===e[0]&&'"'===e[e.length-1])return(e=e.slice(1,e.length-1)).replace(/\\"/g,'"');if("'"===e[0]&&"'"===e[e.length-1])return(e=e.slice(1,e.length-1)).replace(/\\'/g,"'");throw new SyntaxError("Incorrect string format, can't unqute it")},getBrowser:function(){return navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1===navigator.userAgent.indexOf("CriOS")&&-1===navigator.userAgent.indexOf("FxiOS")?S.SAFARI:S.DEFAULT},shotOpen:function(e){"undefined"!=typeof window&&window.open().document.write(``)},shotDownload:function(e,t){if(e&&"data:"===e.substr(0,5))if(t||(t=["screenshot-",+new Date,".png"].join("")),"undefined"!=typeof window&&window.navigator&&window.navigator.msSaveBlob)window.navigator.msSaveBlob(N(e),t);else if("undefined"!=typeof document){const r=document.createElement("a");r.download=t,r.innerHTML="download",r.href=window.URL.createObjectURL(N(e)),document.body.appendChild(r),r.click(),document.body.removeChild(r)}},copySubArrays:function(e,t,r,n){for(let s=0,i=r.length;se+t.length),0),r=new e[0].constructor(t);for(let t=0,n=0;t{this._notifyChange(t,e)}))},changed(){if(!this.old)return[];const{old:e,now:r}=this;return t().filter(Object.keys(this._changed),(n=>t().get(e,n)!==t().get(r,n)))},applyDiffs(e){if(e.hasOwnProperty("VERSION")&&0!==e.VERSION)throw new Error("Settings version does not match!");delete e.VERSION,this.reset(),this.set(e)},getDiffs(e){const t=O.objectsDiff(this.now,D);return e&&(t.VERSION=0),t},setPluginOpts(e,r){D.plugins[e]=t().cloneDeep(r),this.now.plugins[e]=t().cloneDeep(r)}});const z=new k;let F=0;function B(e){return!(!e||"0"===e||t().isString(e)&&"false"===e.toLowerCase())}const U={string:String,number:Number,boolean:B},G="!",j=":",H=",",$="$;@/?";const W=O.generateRegExp($+":,");function Y(e){return O.encodeQueryComponent(e,W)}const X=O.generateRegExp($+" ");function q(e){return O.encodeQueryComponent(e,X)}function Z(e){let{reps:t}=e;if(!t){const{presets:r}=z.now;let n=e.preset||z.now.preset;t=r[n],t||(w.warn(`Unknown preset "${n}"`),[n]=Object.keys(r),t=r[n]),e.preset=n,e.reps=O.deriveDeep(t,!0)}}function K(e,t,r){Z(e);const n=e.reps[F];n.hasOwnProperty(t)&&(F=e.reps.length,e.reps[F]=O.deriveDeep(n,!0)),void 0!==r&&(e.reps[F][t]=r)}function Q(e,r,n){if(e){const s=e.indexOf(G),i=function(e,t){const r=e.indexOf(",");return r>=0?(t.push(e.substr(r+1).split(",")),e.substr(0,r)):e}(e.substr(0,s>=0?s:void 0),n);if(s>=0){const n=e.substr(s+1).split(H);if(e=i,r){const s=r[e],i=O.deriveDeep(s,!0);n.forEach((r=>{const n=r.split(j,2),o=decodeURIComponent(n[0]),a=decodeURIComponent(n[1]),l=U[typeof t().get(s,o)];l?t().set(i,o,l(a)):w.warn(`Unknown argument "${o}" for option "${e}"`)})),Object.keys(i).length>0&&(e=[e,i])}}else e=i}return e}const J={l:"load",load:String,t:"type",type:String,v:"view",view:String,u:"unit",unit:Number,menu:B,o:"object",object(e,t){const r=[];let n=Q(e,z.defaults.objects,r);Array.isArray(n)||(n=[n]),function(e,t,r){void 0===e._objects&&(e._objects=[]);const[n,s]=r,i={type:n,params:t};void 0!==s&&(i.opts=s),e._objects[e._objects.length]=i}(t,r[0],n)},p:"preset",preset(e,t){t.preset=e,t.reps=null,Z(t)},r:"rep",rep(e,t){Z(t),F=Number(e),F=F<=t.reps.length?F<0?0:F:t.reps.length,F===t.reps.length&&(t.reps[F]=F>0?O.deriveDeep(t.reps[F-1],!0):O.deriveDeep(z.defaults.presets.default[0],!0))},s:"select",select(e,t){K(t,"selector",e)},m:"mode",mode(e,t){K(t,"mode",Q(e,z.defaults.modes))},c:"color",color(e,t){K(t,"colorer",Q(e,z.defaults.colorers))},mt:"material",material(e,t){K(t,"material",Q(e,z.defaults.materials))},dup(e,t){Z(t);const{reps:r}=t,n=r[F];F=r.length,r[F]=O.deriveDeep(n,!0)},ar:"autoResolution"};function ee(e){F=0;const r={};for(let n=0,s=e.length;n{t[r++]=q(n)+j+q(e)})),t.join(H)}function re(e){return t().isArray(e)?e.length<2?e[0]:`${e[0]}${G}${te(e[1])}`:e}function ne(e){if(!e||!e.type)return;let r=e.type;return t().isArray(e.params)&&e.params.length>0&&(r+=`,${e.params.join(",")}`),e.opts&&(r+=G+te(e.opts)),r}function se(e){const t=[];let r=0;return O.forInRecursive(e,((e,n)=>{t[r++]=`${n}=${O.enquoteString(e)}`})),t.join(" ")}function ie(e){return t().isArray(e)?e.length<2?e[0]:`${e[0]} ${se(e[1])}`:e}function oe(e){if(!e||!e.type)return;let r=e.type;return t().isArray(e.params)&&e.params.length>0&&(r+=` ${e.params.map(O.enquoteString).join(" ")}`),e.opts&&(r+=` ${se(e.opts)}`),r}function ae(e,r){const n=[];let s=0;function i(e,t){null!=t&&(n[s++]=e+t)}return t().isEmpty(e)?null:(i("",r),i("s=",O.enquoteString(e.selector)),i("m=",ie(e.mode)),i("c=",ie(e.colorer)),i("mt=",ie(e.material)),n.join(" "))}const le={fromURL:function(e){return ee(O.getUrlParameters(e))},fromAttr:function(e){return ee(O.getUrlParameters(`?${e||""}`))},adapters:U,toURL:function(e){const r=[];let n=0;function s(e,t){null!=t&&(r[n++]=Y(e)+"="+Y(t))}s("l",e.load),s("u",e.unit),s("p",e.preset),function(e){if(e)for(let r=0,n=e.length;r{"preset"!==t&&s(t,e)}));let i="";if("undefined"!=typeof window){const{location:e}=window;i=`${e.protocol}//${e.host}${e.pathname}`}return r.length>0&&(i+=`?${r.join("&")}`),i},toScript:function(e){const t=[];let r=0;function n(e,n,s){if(null!=n){const i="string"==typeof n&&s?'"':"";t[r++]=`${e} ${i}${n}${i}`.trim()}}return n("set","autobuild false"),n("load",e.load,!0),n("unit",e.unit),n("preset",e.preset),function(e){if(e)for(let t=0,r=e.length;t{"preset"!==t&&n(`set ${t}`,e,!0)})),n("view",e.view),n("set","autobuild true"),t.join("\n")}};class ce{constructor(e,t,r,n,s,i,o,a,l,c,h){this.index=-1,this.residue=e,this.name=t,this.element=r,this.position=n,this.role=s,this.mask=1,this.het=i,this.serial=o,this.location=(a||" ").charCodeAt(0),this.occupancy=l||1,this.temperature=c,this.charge=h,this.hydrogenCount=-1,this.radicalCount=0,this.valence=-1,this.bonds=[],this.flags=0,"H"===r.name?this.flags|=ce.Flags.HYDROGEN:"C"===r.name&&(this.flags|=ce.Flags.CARBON)}isHet(){return this.het}isHydrogen(){return 1===this.element.number}getVisualName(){const{name:e}=this;return e.length>0?e:this.element.name.trim()}forEachBond(e){const{bonds:t}=this;for(let r=0,n=t.length;r({N:ue.Constants.U1,CA:ue.Constants.Lead,C:ue.Constants.U2,O:ue.Constants.Wing,SG:ue.Constants.U18}))();static ByAtomicNumber=(()=>[null,new ue(1,"H","Hydrogen",1.008,1.2,.23,[1]),new ue(2,"HE","Helium",4.003,1.4,.93,[0]),new ue(3,"LI","Lithium",6.941,1.82,.68,[1]),new ue(4,"BE","Beryllium",9.012,1.7,.35,[2]),new ue(5,"B","Boron",10.81,2.08,.83,[3]),new ue(6,"C","Carbon",12.011,1.95,.68,[4]),new ue(7,"N","Nitrogen",14.007,1.85,.68,[3,5]),new ue(8,"O","Oxygen",15.999,1.7,.68,[2,4]),new ue(9,"F","Fluorine",18.998,1.73,.64,[1]),new ue(10,"NE","Neon",20.18,1.54,1.12,[0]),new ue(11,"NA","Sodium",22.99,2.27,.97,[1]),new ue(12,"MG","Magnesium",24.305,1.73,1.1,[2]),new ue(13,"AL","Aluminum",26.981,2.05,1.35,[3]),new ue(14,"SI","Silicon",28.086,2.1,1.2,[4]),new ue(15,"P","Phosphorus",30.974,2.08,.75,[3,5]),new ue(16,"S","Sulfur",32.07,2,1.02,[2,4,6]),new ue(17,"CL","Chlorine",35.453,1.97,.99,[1,3,5,7]),new ue(18,"AR","Argon",39.948,1.88,1.57,[0]),new ue(19,"K","Potassium",39.1,2.75,1.33,[1]),new ue(20,"CA","Calcium",40.08,1.973,.99,[2]),new ue(21,"SC","Scandium",44.956,1.7,1.44,[0]),new ue(22,"TI","Titanium",47.88,1.7,1.47,[0]),new ue(23,"V","Vanadium",50.941,1.7,1.33,[0]),new ue(24,"CR","Chromium",52,1.7,1.35,[0]),new ue(25,"MN","Manganese",54.938,1.7,1.35,[0]),new ue(26,"FE","Iron",55.847,1.7,1.34,[0]),new ue(27,"CO","Cobalt",58.93,1.7,1.33,[0]),new ue(28,"NI","Nickel",58.69,1.63,1.5,[0]),new ue(29,"CU","Copper",63.55,1.4,1.52,[0]),new ue(30,"ZN","Zinc",65.39,1.39,1.45,[0]),new ue(31,"GA","Gallium",69.72,1.87,1.22,[3]),new ue(32,"GE","Germanium",72.61,1.7,1.17,[4]),new ue(33,"AS","Arsenic",74.92,1.85,1.21,[3,5]),new ue(34,"SE","Selenium",78.96,1.9,1.22,[2,4,6]),new ue(35,"BR","Bromine",79.9,2.1,1.21,[1,3,5,7]),new ue(36,"KR","Krypton",83.8,2.02,1.91,[0]),new ue(37,"RB","Rubidium",85.47,1.7,1.47,[1]),new ue(38,"SR","Strontium",87.62,1.7,1.12,[2]),new ue(39,"Y","Yttrium",88.91,1.7,1.78,[0]),new ue(40,"ZR","Zirconium",91.22,1.7,1.56,[0]),new ue(41,"NB","Niobium",92.91,1.7,1.48,[0]),new ue(42,"MO","Molybdenum",95.94,1.7,1.47,[0]),new ue(43,"TC","Technetium",98.91,1.7,1.35,[0]),new ue(44,"RU","Ruthenium",101.07,1.7,1.4,[0]),new ue(45,"RH","Rhodium",102.91,1.7,1.45,[0]),new ue(46,"PD","Palladium",106.42,1.63,1.5,[0]),new ue(47,"AG","Silver",107.87,1.72,1.59,[0]),new ue(48,"CD","Cadmium",112.41,1.58,1.69,[0]),new ue(49,"IN","Indium",114.82,1.93,1.63,[3]),new ue(50,"SN","Tin",118.71,2.17,1.46,[2,4]),new ue(51,"SB","Antimony",121.75,2.2,1.46,[3,5]),new ue(52,"TE","Tellurium",127.6,2.06,1.47,[2,4,6]),new ue(53,"I","Iodine",126.91,2.15,1.4,[1,3,5,7]),new ue(54,"XE","Xenon",131.29,2.16,1.98,[0]),new ue(55,"CS","Cesium",132.91,1.7,1.67,[1]),new ue(56,"BA","Barium",137.33,1.7,1.34,[2]),new ue(57,"LA","Lanthanum",138.91,1.7,1.87,[0]),new ue(58,"CE","Cerium",140.12,1.7,1.83,[0]),new ue(59,"PR","Praseodymium",140.91,1.7,1.82,[0]),new ue(60,"ND","Neodymium",144.24,1.7,1.81,[0]),new ue(61,"PM","Promethium",144.9,1.7,1.8,[0]),new ue(62,"SM","Samarium",150.36,1.7,1.8,[0]),new ue(63,"EU","Europium",151.96,1.7,1.99,[0]),new ue(64,"GD","Gadolinium",157.25,1.7,1.79,[0]),new ue(65,"TB","Terbium",158.93,1.7,1.76,[0]),new ue(66,"DY","Dysprosium",162.5,1.7,1.75,[0]),new ue(67,"HO","Holmium",164.93,1.7,1.74,[0]),new ue(68,"ER","Erbium",167.26,1.7,1.73,[0]),new ue(69,"TM","Thulium",168.93,1.7,1.72,[0]),new ue(70,"YB","Ytterbium",173.04,1.7,1.94,[0]),new ue(71,"LU","Lutetium",174.97,1.7,1.72,[0]),new ue(72,"HF","Hafnium",178.49,1.7,1.57,[0]),new ue(73,"TA","Tantalum",180.95,1.7,1.43,[0]),new ue(74,"W","Tungsten",183.85,1.7,1.37,[0]),new ue(75,"RE","Rhenium",186.21,1.7,1.35,[0]),new ue(76,"OS","Osmium",190.2,1.7,1.37,[0]),new ue(77,"IR","Iridium",192.22,1.7,1.32,[0]),new ue(78,"PT","Platinum",195.08,1.72,1.5,[0]),new ue(79,"AU","Gold",196.97,1.66,1.5,[0]),new ue(80,"HG","Mercury",200.59,1.55,1.7,[0]),new ue(81,"TL","Thallium",204.38,1.96,1.55,[1,3]),new ue(82,"PB","Lead",207.2,2.02,1.54,[2,4]),new ue(83,"BI","Bismuth",208.98,1.7,1.54,[3,5]),new ue(84,"PO","Polonium",210,1.7,1.68,[2,4,6]),new ue(85,"AT","Astatine",210,1.7,1.7,[1,3,5,7]),new ue(86,"RN","Radon",222,1.7,2.4,[0]),new ue(87,"FR","Francium",223,1.7,2,[1]),new ue(88,"RA","Radium",226.03,1.7,1.9,[2]),new ue(89,"AC","Actinium",227.03,1.7,1.88,[0]),new ue(90,"TH","Thorium",232.04,1.7,1.79,[0]),new ue(91,"PA","Protactinium",231.04,1.7,1.61,[0]),new ue(92,"U","Uranium",238.03,1.86,1.58,[0]),new ue(93,"NP","Neptunium",237.05,1.7,1.55,[0]),new ue(94,"PU","Plutonium",239.1,1.7,1.53,[0]),new ue(95,"AM","Americium",243.1,1.7,1.51,[0]),new ue(96,"CM","Curium",247.1,1.7,1.5,[0]),new ue(97,"BK","Berkelium",247.1,1.7,1.5,[0]),new ue(98,"CF","Californium",252.1,1.7,1.5,[0]),new ue(99,"ES","Einsteinium",252.1,1.7,1.5,[0]),new ue(100,"FM","Fermium",257.1,1.7,1.5,[0]),new ue(101,"MD","Mendelevium",256.1,1.7,1.5,[0]),new ue(102,"NO","Nobelium",259.1,1.7,1.5,[0]),new ue(103,"LR","Lawrencium",260.1,1.7,1.5,[0]),new ue(104,"RF","Rutherfordium",261,1.7,1.6,[0]),new ue(105,"DB","Dubnium",262,1.7,1.6,[0]),new ue(106,"SG","Seaborgium",263,1.7,1.6,[0]),new ue(107,"BH","Bohrium",262,1.7,1.6,[0]),new ue(108,"HS","Hassium",265,1.7,1.6,[0]),new ue(109,"MT","Meitnerium",268,1.7,1.6,[0])])();static ByName=(()=>({D:new ue(1,"D","Deuterium",2.014,1.2,.23,[1]),T:new ue(1,"T","Tritium",3.016,1.2,.23,[1])}))()}!function(){const e=ue.ByAtomicNumber,t=ue.ByName;for(let r=0,n=e.length;rt)throw new Error("In a bond atom indices must be in increasing order");this._order=r,this._type=n}getLeft(){return this._left}getRight(){return this._right}getOrder(){return this._order}calcLength(){return this._left.position.distanceTo(this._right.position)}_forEachNeighbour(e,t){const{bonds:r}=e;for(let n=0,s=r.length;n{t!==r&&e(t)})),this._forEachNeighbour(r,(r=>{r!==t&&e(r)}))}forEachLevelTwo(e){const t=this._left,r=this._right,n=this;n._forEachNeighbour(t,(s=>{s!==r&&n._forEachNeighbour(s,(r=>{r!==t&&e(r)}))})),n._forEachNeighbour(r,(s=>{s!==t&&n._forEachNeighbour(s,(t=>{t!==r&&e(t)}))}))}_fixDir(e,t,r){let n=0,s=0;const i=e.clone();function o(o){i.copy(r(o)),i.sub(e);t.dot(i)>0?++n:++s}function a(e){"C"===e.element.name&&o(e)}const l=[[this.forEachLevelOne,a],[this.forEachLevelOne,o],[this.forEachLevelTwo,a],[this.forEachLevelTwo,o]];for(let e=0;en)return t.multiplyScalar(-1);if(sr.bonds.length&&(n=r,s=t);let i=n,o=0;const{bonds:a}=s;for(let e=0,t=a.length;eo&&t!==n&&(i=t,o=t.bonds.length)}const l=e(s),c=e(n).clone().sub(l),h=e(i).clone().sub(l);return h.crossVectors(c,h),h.lengthSq()<1e-4&&h.set(0,1,0),c.normalize(),h.normalize(),c.crossVectors(h,c),c.lengthSq()<1e-4&&c.set(0,1,0),c.normalize(),this._fixDir(l,c,e)}static BondType=(()=>pe)()}fe.prototype.BondType=pe;const _e=fe,ge=["C3'","C3*","P","H5T","H3T"],ye=["OP1","O1P"],xe=["OP2","O2P"],be=["C3'","C3*","C1","C1'","C1*","P"],we=[{types:["A","DA","G","DG"],atoms:["N1"]},{types:["C","DC"],atoms:["N3"]},{types:["T","DT","U","DU"],atoms:["O4"]}];const Se=class{constructor(e,t,r,n){this._chain=e,this._component=null,this._type=t,this._sequence=r,this._icode=n,this._mask=1,this._index=-1,this._atoms=[],this._secondary=null,this._firstAtom=null,this._leadAtom=null,this._wingAtom=null,this._lastAtom=null,this._controlPoint=null,this._midPoint=null,this._wingVector=null,this._cylinders=null,this._isValid=!0,this._het=!1,this._molecule=null,this.temperature=null,this.occupancy=null}getChain(){return this._chain}getMolecule(){return this._molecule}getType(){return this._type}getSequence(){return this._sequence}getSecondary(){return this._secondary}getICode(){return this._icode}addAtom(e,t,r,n,s,i,o,a,l,c){const h=new he(this,e,t,r,n,s,i,o,a,l,c);return this._chain.getComplex().addAtom(h),this._atoms.push(h),this._het=this._het||s,h}getAtomCount(){return this._atoms.length}forEachAtom(e){const t=this._atoms;for(let r=0,n=t.length;rr.name===e&&(t=r,!0))),t}_findFirstAtomInList(e){let t=null;for(let r=0;r1e-4){i.length()>1e-4&&Math.abs(n.angleTo(i))>Math.PI/2&&i.negate()}return i}_innerFinalize(e,t,n,s,i,o){const a=null===t,l=o(this._leadAtom),c=new r.Vector3(l.x,l.y,l.z);if(i)this._detectLeadWing(s,n,o);else{if(a)s._midPoint=o(this._firstAtom).clone();else{const r=t._controlPoint;s._midPoint=r.clone().lerp(c,.5),s._wingVector=this.calcWing(r,c,o(e._wingAtom),t._wingVector)}s._controlPoint=c}}_finalize2(e,t,r){this._innerFinalize(e,e,t,this,r,(e=>e.position))}isConnected(e){if(this._chain!==e._chain)return!1;if(this===e)return!0;let t=!1;return this.forEachAtom((r=>{const{bonds:n}=r;for(let r=0,s=n.length;r(null===e._leadAtom&&i.role===de.Constants.Lead&&(e._leadAtom=i),null===e._wingAtom&&i.role===de.Constants.Wing&&(e._wingAtom=i),i.temperature&&(r+=i.temperature,t++),i.occupancy&&(s+=i.occupancy,n++),null!==e._leadAtom&&null!==e._wingAtom))),t>0&&(this.temperature=r/t),n>0&&(this.occupancy=s/n),null!==this._leadAtom&&null!==this._wingAtom||(this._isValid=!1),null===this._leadAtom&&(this._leadAtom=this._firstAtom),null===this._wingAtom&&(this._wingAtom=this._lastAtom)}};class ve{constructor(e,t,r){this._name=e,this._fullName=t,this.letterCode=r,this.flags=0}getName(){return this._name}static StandardTypes=(()=>({ALA:new ve("ALA","Alanine","A"),ARG:new ve("ARG","Arginine","R"),ASN:new ve("ASN","Asparagine","N"),ASP:new ve("ASP","Aspartic Acid","D"),CYS:new ve("CYS","Cysteine","C"),GLN:new ve("GLN","Glutamine","Q"),GLU:new ve("GLU","Glutamic Acid","E"),GLY:new ve("GLY","Glycine","G"),HIS:new ve("HIS","Histidine","H"),ILE:new ve("ILE","Isoleucine","I"),LEU:new ve("LEU","Leucine","L"),LYS:new ve("LYS","Lysine","K"),MET:new ve("MET","Methionine","M"),PHE:new ve("PHE","Phenylalanine","F"),PRO:new ve("PRO","Proline","P"),PYL:new ve("PYL","Pyrrolysine","O"),SEC:new ve("SEC","Selenocysteine","U"),SER:new ve("SER","Serine","S"),THR:new ve("THR","Threonine","T"),TRP:new ve("TRP","Tryptophan","W"),TYR:new ve("TYR","Tyrosine","Y"),VAL:new ve("VAL","Valine","V"),A:new ve("A","Adenine","A"),C:new ve("C","Cytosine","C"),G:new ve("G","Guanine","G"),I:new ve("I","Inosine","I"),T:new ve("T","Thymine","T"),U:new ve("U","Uracil","U"),DA:new ve("DA","Adenine","A"),DC:new ve("DC","Cytosine","C"),DG:new ve("DG","Guanine","G"),DI:new ve("DI","Inosine","I"),DT:new ve("DT","Thymine","T"),DU:new ve("DU","Uracil","U"),"+A":new ve("+A","Adenine","A"),"+C":new ve("+C","Cytosine","C"),"+G":new ve("+G","Guanine","G"),"+I":new ve("+I","Inosine","I"),"+T":new ve("+T","Thymine","T"),"+U":new ve("+U","Uracil","U"),WAT:new ve("WAT","Water",""),H2O:new ve("H2O","Water",""),HOH:new ve("HOH","Water",""),DOD:new ve("DOD","Water",""),UNK:new ve("UNK","Unknown",""),UNL:new ve("UNL","Unknown Ligand","")}))();static Flags={PROTEIN:1,BASIC:2,ACIDIC:4,POLAR:8,NONPOLAR:16,AROMATIC:32,NUCLEIC:256,PURINE:512,PYRIMIDINE:1024,DNA:2048,RNA:4096,WATER:65536}}function Ce(e,t){for(let r=0,n=t.length;r1&&e[1]._wingVector){const t=e[1]._wingVector;e[0]._wingVector=new r.Vector3(t.x,t.y,t.z)}else e.length>0&&(e[0]._wingVector=new r.Vector3(1,0,0))}updateToFrame(e){const t=this._residues;let n=null,s=null;const i=e._residues,o=t.length;function a(t){return e.getAtomPos(t.index)}for(let e=0;e1?i[t[1]._index]._wingVector:new r.Vector3(1,0,0)}addResidue(e,t,r){let n=this._complex.getResidueType(e);null===n&&(n=this._complex.addResidueType(e));const s=new Se(this,n,t,r);return this._complex.addResidue(s),this._residues.push(s),n.flags&(Ee.Flags.NUCLEIC|Ee.Flags.PROTEIN)&&(this.maxSequencet&&(this.minSequence=t)),s}getResidueCount(){return this._residues.length}forEachResidue(e){const t=this._residues;for(let r=0,n=t.length;r=0&&t.splice(r,1),this}toString(){return this._values.join(",")}toJSON(){const e=this._values,t=[];for(let r=0,n=e.length;rthis.priority?`(${this.rhs})`:this.rhs;return`${this.keyword} ${e}`}toJSON(){return[this.name,this.rhs.toJSON()]}}Je.prototype.priority=1;class et extends We{constructor(e,t){super(),this.lhs=e||Qe,this.rhs=t||Qe}toString(){const e=this.lhs.priority&&this.lhs.priority>this.priority?`(${this.lhs})`:this.lhs,t=this.rhs.priority&&this.rhs.priority>this.priority?`(${this.rhs})`:this.rhs;return`${e} ${this.keyword} ${t}`}toJSON(){return[this.name,this.lhs.toJSON(),this.rhs.toJSON()]}}et.prototype.priority=1e3;const tt={};function rt(e,t){const r=e.toLowerCase();t.prototype.keyword=r,t.prototype.name=e;const n=function(){for(var e=arguments.length,r=new Array(e),n=0;n{delete ot.Context[e]}))},ot.keyword=function(e){return tt[e.toLowerCase()]||tt.none},ot.parse=function(e){const t={};try{t.selector=Ue.parser.parse(e)}catch(e){t.selector=nt,t.error=e.message}return t},Ue.parser.yy=ot,Ue.parser.yy.parseError=Ue.parser.parseError;const at=ot;const lt=class{constructor(e){this._complex=e,this._selector=at.keyword("All")(),this._boundaries={boundingBox:new r.Box3,boundingSphere:new r.Sphere}}computeBoundaries(){const e=this._complex._atoms,t=e.length,n=this._selector,{boundingBox:s}=this._boundaries;if(s.makeEmpty(),1===t){s.expandByPoint(e[0].position);const t=new r.Vector3;s.getCenter(t);const n=2*e[0].element.radius;s.setFromCenterAndSize(t,new r.Vector3(n,n,n))}else for(let r=0;r0?this._selector=at.keyword("Chain")(this.chains):this._selector=at.keyword("None")()}};const ht=class{constructor(e){this._complex=e,this._index=-1,this._residueIndices=[],this._cycles=[],this._subDivs=[],this._residueCount=0}getResidues(){return this._complex._residues}getResidueCount(){return this._residueCount}forEachResidue(e){const t=this._complex._residues,r=this._residueIndices;for(let n=0,s=r.length;n{e.update()}))}forEachAtom(e){this.forEachResidue((t=>{t.forEachAtom(e)}))}addCycle(e){this._cycles.push(e)}forEachCycle(e){const t=this._cycles;for(let r=0,n=t.length;r{t._component=e}))}_forEachSubChain(e,t){const r=this._complex._residues,n=this._subDivs;for(let s=0,i=n.length;s{t[r++]={start:n,end:s}})),t}getMaskedSubdivSequences(e){const t=[];let r=-1,n=-1;const s=this._subDivs;return this._forEachSubChain(e,((e,i,o)=>{n!==e&&(++r,t[r]={arr:[],boundaries:s[e]},n=e),t[r].arr[t[r].arr.length]={start:i,end:o}})),t}};const ut=class{constructor(e){this.numPairs=0,this.numMaxPairs=e,this.intBuffer=O.allocateTyped(Int32Array,4*e);for(let t=0;t<4*e;t++)this.intBuffer[t]=-1;this.hashBuffer=O.allocateTyped(Int32Array,33554432);for(let e=0;e<33554432;e++)this.hashBuffer[e]=-1}destroy(){this.intBuffer=null,this.hashBuffer=null}addPair(e,t){const r=et?e:t,s=r+(n<<14);let i=32*(r+89237*n&1048575),o=0;for(;o<32;o++){const e=this.hashBuffer[i+o];if(-1===e)break;if(e===s)return!1}if(o>=32)throw new Error("addPair: increase cMaxPairsForHashCode");if(this.hashBuffer[i+o]=s,this.numPairs>=this.numMaxPairs)throw new Error("addPair: increase num pairs");return i=4*this.numPairs,this.intBuffer[i]=r,this.intBuffer[i+1]=n,this.intBuffer[i+2]=s,this.numPairs++,!0}};function dt(e){const{element:t}=e;if(t)return t.radiusBonding;throw new Error("_getBondingRadius: Logic error.")}const pt=class{constructor(e){this._complex=e,this._maxRad=1.8;const t=this._complex.getDefaultBoundaries().boundingBox;this._vBoxMin=t.min.clone(),this._vBoxMax=t.max.clone(),this._pairCollection=null}_addExistingPairs(){const e=this._complex.getAtoms(),t=e.length;let r=0;const n=this._pairCollection;for(;rh*h||r<.001||n._pairCollection.addPair(l.index,e.index)};for(let n=0;n.1)&&e.dot(t)>=0}}();function gt(e,t){let r=0;for(;r3}function Ct(e){return!0}const At=class{constructor(e){this._complex=e;const t=new Array(e._bonds.length),r=new Array(e._bonds.length);for(let e=0,n=t.length;es[l]?++l:++a}return!1}_tryBond(e,t,n){const s=[],i=this._bondsData,o=yt(e,t),a=t.position.clone().sub(o.position),l=this._currStart,c=this,h=this._bondMarks;let u=this._checkBond;h[e._index]=!0,u=void 0===u?wt:u,t.forEachBond((o=>{if(!u(o)||o===e||h[o._index]||c._haveSameCycle(i,e,o))return;const d=yt(o,t),p=d.position.clone().sub(t.position),m=d===l?-2:1-function(e,t){const n=e.dot(t)/Math.sqrt(e.lengthSq()*t.lengthSq());return r.MathUtils.clamp(n,-1,1)}(a,p),f=p.cross(a);if(!_t(f,n))return;let _=0;for(;_{n._resetCycles(),r.forEachBond((t=>{e(t)&&n._startCycle(t)}));const s=n._cycles;for(let e=0,n=s.length;e=e.z?t:Math.max(o,a),[l,c]}function Tt(e,t,r,n){const s=r-e.y,i=n-e.y,o=Math.sqrt(Math.max(t*t-s*s,0)),a=Math.sqrt(Math.max(t*t-i*i,0)),l=Math.min(o,a);let c;return c=r<=e.y&&n>=e.y?t:Math.max(o,a),[l,c]}class Rt{constructor(e,t){this._box=e.clone();const n=new r.Vector3;e.getSize(n),this._count=n.clone().divide(t).floor().max(new r.Vector3(1,1,1)),this._last=this._count.clone().subScalar(1),this._cellSize=n.clone().divide(this._count),this._cellInnerR=.5*Math.min(Math.min(this._cellSize.x,this._cellSize.y),this._cellSize.z),this._cellOuterR=.5*Math.sqrt(this._cellSize.dot(this._cellSize));const s=this._count.x*this._count.y*this._count.z;this._voxels=O.allocateTyped(Int32Array,s);for(let e=0;e{const n=t._findVoxel(e.position);t._atoms[r]=e,t._atoms[r+1]=t._voxels[n],t._voxels[n]=r,r+=2}))}static _zero=(()=>new r.Vector3(0,0,0))();static _voxel=(()=>new r.Vector3)();_findVoxel(e){const t=Rt._zero,r=Rt._voxel;return r.copy(e).sub(this._box.min).divide(this._cellSize).floor().clamp(t,this._last),r.x+this._count.x*(r.y+this._count.y*r.z)}_forEachAtomInVoxel(e,t){for(let r=this._voxels[e];r>=0;r=this._atoms[r+1])t(this._atoms[r])}static _xRange=(()=>new r.Vector2)();static _yRange=(()=>new r.Vector2)();static _zRange=(()=>new r.Vector2)();_forEachVoxelWithinRadius(e,t,r){const n=Rt._xRange,s=Rt._yRange,i=Rt._zRange;if(t/this._cellInnerR<10)return void this._forEachVoxelWithinRadiusSimple(e,t,r);let o,a,l,c,h,u,d,p;i.set(e.z-t,e.z+t),i.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor().clampScalar(0,this._count.z-1);for(let m=i.x;m<=i.y;++m){h=[this._box.min.z+m*this._cellSize.z,this._box.min.z+(m+1)*this._cellSize.z],p=e.z-t<=h[0]&&h[1]<=e.z+t,o=Et(e,t,h[0],h[1]),s.set(e.y-o[1],e.y+o[1]),s.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor().clampScalar(0,this._count.y-1);for(let t=s.x;t<=s.y;++t){c=[this._box.min.y+t*this._cellSize.y,this._box.min.y+(t+1)*this._cellSize.y],d=e.y-o[0]<=c[0]&&c[1]<=e.y+o[0],a=Tt(e,o[1],c[0],c[1]),n.set(e.x-a[1],e.x+a[1]),n.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor().clampScalar(0,this._count.x-1);for(let{x:s}=n;s<=n.y;++s)l=[this._box.min.x+s*this._cellSize.x,this._box.min.x+(s+1)*this._cellSize.x],u=e.x-a[0]<=l[0]&&l[1]<=e.x+a[0],r(s+this._count.x*(t+this._count.y*m),u&&d&&p)}}}static _vCenter=(()=>new r.Vector3)();_forEachVoxelWithinRadiusSimple(e,t,r){const n=Rt._xRange,s=Rt._yRange,i=Rt._zRange,o=Rt._vCenter,a=(t+this._cellOuterR)*(t+this._cellOuterR);let l=-1;t>this._cellOuterR&&(l=(t-this._cellOuterR)*(t-this._cellOuterR)),n.set(e.x-t,e.x+t),n.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor(),n.x=Math.min(Math.max(n.x,0),this._count.x-1),n.y=Math.min(Math.max(n.y,0),this._count.x-1),s.set(e.y-t,e.y+t),s.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor(),s.x=Math.min(Math.max(s.x,0),this._count.y-1),s.y=Math.min(Math.max(s.y,0),this._count.y-1),i.set(e.z-t,e.z+t),i.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor(),i.x=Math.min(Math.max(i.x,0),this._count.z-1),i.y=Math.min(Math.max(i.y,0),this._count.z-1);for(let t=i.x;t<=i.y;++t){const i=[this._box.min.z+t*this._cellSize.z,this._box.min.z+(t+1)*this._cellSize.z];o.z=.5*(i[0]+i[1]);for(let i=s.x;i<=s.y;++i){const s=[this._box.min.y+i*this._cellSize.y,this._box.min.y+(i+1)*this._cellSize.y];o.y=.5*(s[0]+s[1]);for(let{x:s}=n;s<=n.y;++s){const n=[this._box.min.x+s*this._cellSize.x,this._box.min.x+(s+1)*this._cellSize.x];o.x=.5*(n[0]+n[1]);const c=e.distanceToSquared(o);c<=a&&r(s+this._count.x*(i+this._count.y*t),c<=l)}}}}forEachAtomWithinRadius(e,t,r){const n=this,s=t*t;n._forEachVoxelWithinRadius(e,t,((t,i)=>{i?n._forEachAtomInVoxel(t,r):n._forEachAtomInVoxel(t,(t=>{e.distanceToSquared(t.position)<=s&&r(t)}))}))}forEachAtomWithinDistFromMasked(e,t,r,n){this._forEachAtomWithinDistFromGroup((r=>{e.forEachAtom((e=>{0!=(e.mask&t)&&r(e)}))}),r,n)}forEachAtomWithinDistFromSelected(e,t,r,n){this._forEachAtomWithinDistFromGroup((r=>{e.forEachAtom((e=>{t.includesAtom(e)&&r(e)}))}),r,n)}_forEachAtomWithinDistFromGroup(e,t,r){const n=this,s=t*t,i=[],o=[];let a,l=0;e((e=>{n._forEachVoxelWithinRadius(e.position,t,((t,r)=>{r?i[t]=-1:void 0===i[t]?(o.push(e),o.push(-1),i[t]=l,l+=2):-1!==i[t]&&(o.push(e),o.push(i[t]),i[t]=l,l+=2)}))}));const c=function(e){if(void 0!==i[a])if(l=i[a],-1!==l){for(;l>=0;l=o[l+1])if(e.position.distanceToSquared(o[l].position)1e3?this._buildVW():this._build()}isBond(e,t){if(this._hbonds[e]){const[r,n]=this._hbonds[e].acceptor;if(r&&r.residue===t&&r.energy<-.5)return!0;if(n&&n.residue===t&&n.energy<-.5)return!0}return!1}_build(){const e=this;for(let t=0;t0&&this._complex._residues[t-1].getType().flags&Ee.Flags.PROTEIN&&r._sequence===this._complex._residues[t-1]._sequence+1&&(n=this._complex._residues[t-1]);for(let s=t+1;s0?t[o._index-1]:null;!a||0!=(a.getType().flags&Ee.Flags.PROTEIN)&&o._sequence===a._sequence+1||(a=null),e._calcHBondEnergy(n,r,o),o._index!==r._index+1&&e._calcHBondEnergy(a,o,r)}for(let e=0;e0?t[e-1]:null,!n||0!=(n.getType().flags&Ee.Flags.PROTEIN)&&r._sequence===n._sequence+1||(n=null),s.forEachAtomWithinRadius(this._residueGetCAlpha(r),5,o))}_residueGetCAlpha(e){for(let t=0;t{"C"===e.name?t=e.position:"O"===e.name&&(r=e.position)})),[t,r]}_residueGetNH(e,t){const[r,n]=this._residueGetCO(e);let s;if(t.forEachAtom((e=>{"N"===e.name&&(s=e.position)})),r&&n&&s){const e=r.clone();return e.sub(n),e.multiplyScalar(1/e.length()),e.add(s),[s,e]}return[null,null]}_calcHBondEnergy(e,t,r){let n=0;if(null===e)return n;if("PRO"!==t.getType().getName()){const[s,i]=this._residueGetNH(e,t),[o,a]=this._residueGetCO(r);if(null===s||null===i||null===o||null===a)return n;const l=i.distanceTo(a),c=i.distanceTo(o),h=s.distanceTo(o),u=s.distanceTo(a);n=l1&&(n1&&(n70}for(let r=1;r+4=s&&this._isHelixStart(e[r-s]._index,n);t?this._ss[e[r]._index]=Dt.TURN:this._bend[e[r]._index]&&(this._ss[e[r]._index]=Dt.BEND)}}_residueGetCAlpha(e){for(let t=0;t0&&(o=s.dot(i)/Math.sqrt(a)),o}_kappa(e,t,r){const n=this._residueGetCAlpha(t),s=this._residueGetCAlpha(e),i=this._residueGetCAlpha(r);if(null===n||null===s||null===i)return 180;const o=this._cosinusAngle(n,s,i,n),a=Math.sqrt(1-o*o);return 180*Math.atan2(a,o)/Math.PI}_isHelixStart(e,t){return this._helixFlags[t][e]===Vt.START||this._helixFlags[t][e]===Vt.START_AND_END}_buildBetaSheets(){const e=[];for(let t=0;te.chainI=6||s>=a&&n<=l)continue;let u=!1;u=e[t].type===Ot.PARALLEL?c-o<6&&a-s<3||c-o<3:i-h<6&&a-s<3||i-h<3,u&&(e[t].i=e[t].i.concat(e[r].i),e[t].type===Ot.PARALLEL?e[t].j=e[t].j.concat(e[r].j):e[t].j=e[r].j.concat(e[t].j),e.splice(r--,1))}const t=new Set;for(let r=0;r0;){let e=t.values().next().value;t.delete(e);const s=new Set;let i;s.add(e);do{i=new Set;for(const e of s.values())for(const r of t.values())this._areBridgesLinked(e,r)&&i.add(r);for(e of i.values())s.add(e),t.delete(e)}while(i.size>0);for(e of s.values())e.ladder=n,e.sheet=r,e.link=s,++n;++r}for(let t=0;t1&&(i=Dt.STRAND),r.type===Ot.PARALLEL){let e=0;for(let t=0;t{t.updateToFrame(e)}))}addResidueType(e){return this._residueTypes[e]=new Ee(e,"Unknown","")}getResidueCount(){return this._residues.length}getResidues(){return this._residues}getSGroupCount(){return this._sgroups.length}getSGroups(){return this._sgroups}getAtomByFullname(e){const t=e.split(".");if(3!==t.length)return null;const r=t[0],n=parseInt(t[1],10);if(Number.isNaN(n))return null;const s=t[2].toUpperCase();let i=null;return this.forEachChain((e=>{i||0===e._name.localeCompare(r)&&e.forEachResidue((e=>{i||e._sequence===n&&e.forEachAtom((e=>{i||0===s.localeCompare(e.name)&&(i=e)}))}))})),i}addChain(e){const t=new Pe(this,e);return this._chains.push(t),t}getChain(e){for(let t=0,r=this._chains.length;t{const t=e._residues,n=t.length;if(n<1)return;let s=r(),i=t[0]._index;for(let e=0;e=0&&e{e._finalize()})),this.forEachComponent((e=>{e.update()})),this._computeBounds(),this._finalizeBonds(),this.forEachSGroup((e=>{e._rebuildSGroupOnAtomChange()}))}update(){this._maskNeedsUpdate&&(this.updateStructuresMask(),this._maskNeedsUpdate=!1)}_finalizeBonds(){const e=this.getBonds(),t=e.length;for(let r=0;r=0;r--){const e=t[r];null===e._left||null===e._right?t.splice(r,1):(e._left.bonds.push(e),e._right.bonds.push(e))}const s=this._residues;for(r=0,n=s.length;r{e._finalize()}));const{units:i}=this;for(r=0,n=i.length;re.collectMask();this.forEachResidue(e),this.forEachChain(e),this.forEachMolecule(e)}countAtomsByMask(e){let t=0;return this.forEachAtom((r=>{0!=(r.mask&e)&&t++})),t}getNumAtomsBySelector(e){let t=0;return this.forEachAtom((r=>{e.includesAtom(r)&&t++})),t}resetAtomMask(e){this.forEachAtom((t=>{t.mask=e}))}markAtoms(e,t){const r=t,n=~r;let s=0;const i=at.keyword("And")(e,this.getSelector());return this.forEachAtom((e=>{i.includesAtom(e)?(e.mask|=r,s++):e.mask&=n})),this._maskNeedsUpdate=!0,s}markAtomsAdditionally(e,t){const r=t;let n=0;return this.forEachAtom((s=>{e.includesAtom(s)&&(s.mask&t)!==t&&(s.mask|=r,n++)})),n}clearAtomBits(e){const t=~e;this.forEachAtom((e=>{e.mask&=t}));const r=e=>{e._mask&=t};this.forEachAtom(r),this.forEachResidue(r),this.forEachChain(r),this.forEachMolecule(r)}getAtomNames(){if(this.hasOwnProperty("_atomNames"))return this._atomNames;const e={};return this.forEachAtom((t=>{e[t.name]=1})),this._atomNames=Object.keys(e),this._atomNames}getElements(){if(this.hasOwnProperty("_elements"))return this._elements;const e={};return this.forEachAtom((t=>{e[t.element.name]=1})),this._elements=Object.keys(e),this._elements}getResidueNames(){if(this.hasOwnProperty("_residueNames"))return this._residueNames;const e={};return this.forEachResidue((t=>{e[t._type._name]=1})),this._residueNames=Object.keys(e),this._residueNames}getChainNames(){if(this.hasOwnProperty("_chainNames"))return this._chainNames;const e={};return this.forEachChain((t=>{e[t._name]=1})),this._chainNames=Object.keys(e),this._chainNames}getAltLocNames(){if(this.hasOwnProperty("_altlocNames"))return this._altlocNames;const e={};return this.forEachAtom((t=>{e[String.fromCharCode(t.location)]=1})),this._altlocNames=Object.keys(e),this._altlocNames}getVoxelWorld(){if(!this.hasOwnProperty("_voxelWorld"))try{this._voxelWorld=new Mt(this.getDefaultBoundaries().boundingBox,new r.Vector3(5,5,5)),this._voxelWorld.addAtoms(this)}catch(e){w.warn("Unable to create voxel world"),this._voxelWorld=null}return this._voxelWorld}addElement(e,t,r,n){const{length:s}=e;for(let i=0;i{let t=n[e];return t||(t=n[e]=new Fe(String(e),0)),t};let i,o,a=0,l=null;for(let n=0,c=this._residues.length;n!0))}}Gt.prototype.id="Complex",Gt.prototype.name="";const jt=Gt;function Ht(e){let t=2;for(e=e-1>>1;e;)t<<=1,e>>=1;return t}class $t{constructor(e,t,r,n,s,i){switch(this._box=r.clone(),this._dimVec=Math.max(Math.floor(n||1),1),this._volumeInfo=i,t instanceof Array?[this._dimX,this._dimY,this._dimZ]=t:(this._dimX=t.x,this._dimY=t.y,this._dimZ=t.z),this._dimX=Math.max(Math.floor(this._dimX),1),this._dimY=Math.max(Math.floor(this._dimY),1),this._dimZ=Math.max(Math.floor(this._dimZ),1),this._rowElements=this._dimVec*this._dimX,this._planeElements=this._rowElements*this._dimY,this._totalElements=this._planeElements*this._dimZ,this._data=s||O.allocateTyped(e,this._totalElements),this._dimVec){case 1:break;case 2:this.getValue=function(e,t,r){const n=e*this._dimVec+t*this._rowElements+r*this._planeElements;return[this._data[n],this._data[n+1]]},this.setValue=function(e,t,r,n,s){const i=e*this._dimVec+t*this._rowElements+r*this._planeElements;this._data[i]=n,this._data[i+1]=s},this.addValue=function(e,t,r,n,s){const i=e*this._dimVec+t*this._rowElements+r*this._planeElements;this._data[i]+=n,this._data[i+1]+=s};break;case 3:this.getValue=function(e,t,r){const n=e*this._dimVec+t*this._rowElements+r*this._planeElements;return[this._data[n],this._data[n+1],this._data[n+2]]},this.setValue=function(e,t,r,n,s,i){const o=e*this._dimVec+t*this._rowElements+r*this._planeElements;this._data[o]=n,this._data[o+1]=s,this._data[o+2]=i},this.addValue=function(e,t,r,n,s,i){const o=e*this._dimVec+t*this._rowElements+r*this._planeElements;this._data[o]+=n,this._data[o+1]+=s,this._data[o+2]+=i};break;default:throw new Error("Volume: invalid vector dimension")}}getValue(e,t,r){return this._data[e+t*this._rowElements+r*this._planeElements]}setValue(e,t,r,n){this._data[e+t*this._rowElements+r*this._planeElements]=n}addValue(e,t,r,n){this._data[e+t*this._rowElements+r*this._planeElements]+=n}getDimensions(){return[this._dimX,this._dimY,this._dimZ]}getBox(){return this._box}getVolumeInfo(){return this._volumeInfo}getCellSize(){const e=new r.Vector3;this._box.getSize(e);const t=new r.Vector3;return t.x=this._dimX>1?e.x/(this._dimX-1):0,t.y=this._dimY>1?e.y/(this._dimY-1):0,t.z=this._dimZ>1?e.z/(this._dimZ-1):0,t}computeGradient(){if(1!==this._dimVec)return null;const e=new $t(Float32Array,[this._dimX,this._dimY,this._dimZ],this._box,3),t=this.getCellSize(),n=new r.Vector3(-.5/t.x,-.5/t.y,-.5/t.z);function s(e,t,r){return Math.min(r,Math.max(t,e))}const i=this._dimX,o=this._dimY,a=this._dimZ,l=this._data;function c(e,t,r){return l[r*i*o+t*i+e]}for(let t=0;t{null!==t._element.parentNode&&t._element.parentNode.removeChild(t._element)}))}getElement(){return this._element}setTransparency(e){const t=this.getElement();if(null===t)return;if(1===e)return void(t.style.display="none");t.style.display="inline";const r=1-e,n=r.toString(),s=100*r;t.style.opacity=n,t.style.filter=`alpha(opacity=${s})`}clone(){const e=new Xt(this._element);return e.copy(this),e}}const qt=Xt;class Zt extends r.Group{raycast(e,t){if(!this.visible)return;const{children:r}=this;for(let n=0,s=r.length;n{(e instanceof r.Mesh||e instanceof r.LineSegments||e instanceof r.Line)&&e.geometry.dispose()})),function(e){const{children:t}=e;for(let e=0,r=t.length;e=1?this.fov=e:this.fov=r.MathUtils.radToDeg(2*Math.atan(Math.tan(.5*r.MathUtils.degToRad(e))/this.aspect))},r.StereoCamera.prototype.updateHalfSized=function(e,t){const r=e.aspect,n=e.fov;e.aspect=r/2,e.setMinimalFov(t),e.updateProjectionMatrix(),this.update(e),e.aspect=r,e.fov=n,e.updateProjectionMatrix()},r.PerspectiveCamera.prototype.setDistanceToFit=function(e,t){this.position.z=e/Math.sin(.5*r.MathUtils.degToRad(t))},r.Raycaster.prototype.intersectVisibleObject=function(e,t,n,s){const i=this.intersectObject(e,!1);if(0===i.length)return null;const o=Math.min(t.near,n);let a,l=i[0];const c=new r.Vector3;for(a=0;a{(e.hasOwnProperty("geometry")||e instanceof qt)&&(t=!0)})),t},buildDistorionMesh:function(e,t,n){function s(e){let t=0,r=e,s=1;for(;Math.abs(r-t)>1e-5;)s=1+n*r,t=r,r=e/(s*s);return 1/s}const i=new r.PlaneGeometry(2,2,e,t),o=i.getAttribute("position");for(let e=0;e>er[t]&1))return!0;return!1},processObjRenderOrder:function(e,t){const r=+("BA"!==t);e.traverse((e=>{e.isGroup&&(e.renderOrder=r)}))},applySelectionMaterial:function(e){e.traverse((e=>{"material"in e&&(e.material=e.material.clone(!0),e.material.setValues({depthFunc:r.LessEqualDepth,overrideColor:!0,fog:!1,lights:!1,shadowmap:!1}),e.material.setUberOptions({fixedColor:new r.Color(16776960),zOffset:-1e-6}))}))},getMiddlePoint:function(e,t,n){const s=n||new r.Vector3;return s.set(0,0,0),s.addScaledVector(e,.5),s.addScaledVector(t,.5),s},LAYERS:Jt},ir={boundingBox:new r.Box3(new r.Vector3(-1,-1,-1),new r.Vector3(1,1,1)),boundingSphere:new r.Sphere(new r.Vector3(0,0,0),1)};class or extends sr.RCGroup{constructor(e,t){super(e,t),this.name=e,this._dataSource=t}release(){this.parent&&this.parent.remove(this)}getDataSource(){return this._dataSource}getBoundaries(){return ir}}const ar=or;function lr(e){return null==e||Array.isArray(e)?e:[e]}class cr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["id"];this._list=[],this._dict={},this._indices=[...t],this._indices.forEach((e=>{this._dict[e]={}})),e.forEach((e=>this.register(e)))}static registerInList(e,t){e.includes(t)||e.push(t)}static unregisterFromList(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}static registerInDict(e,t,r){t.forEach((t=>{t=t.toLowerCase();const n=e[t]=e[t]||[];n.includes(r)||n.push(r)}))}static unregisterFromDict(e,t,r){t.forEach((t=>{t=t.toLowerCase();const n=e[t];if(n){const s=n.indexOf(r);-1!==s&&n.splice(s,1),0===n.length&&delete e[t]}}))}register(e){cr.registerInList(this._list,e),this._indices.forEach((t=>{cr.registerInDict(this._dict[t],lr(e[t]),e)}))}unregister(e){cr.unregisterFromList(this._list,e),this._indices.forEach((t=>{cr.unregisterFromDict(this._dict[t],lr(e[t]),e)}))}get all(){return[...this._list]}get first(){return this._list[0]}keys(e){return Object.keys(this._dict[e||this._indices[0]])}get(e,t){const r=this._dict[t||this._indices[0]];if(r){const t=r[e&&e.toLowerCase()];return t&&t.length>0?t[0]:void 0}}}const hr=cr;const ur=function(e){Object.defineProperties(e,{logger:{get(){return this.context&&this.context.logger?this.context.logger:w}},settings:{get(){return this.context&&this.context.settings?this.context.settings:z}}})};class dr{constructor(e,t){this._position=e,this._radius=t}static _sphere=(()=>new r.Sphere)();raycast(e){const t=dr._sphere;t.set(this._position,this._radius);const n=new r.Vector3;return e.ray.intersectSphere(t,n)?{distance:e.ray.origin.distanceTo(n),point:n}:null}}const pr=e=>class extends e{constructor(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n65535,c=o*n,h=this._index=O.allocateTyped(l?Uint32Array:Uint16Array,c);this._positions=O.allocateTyped(Float32Array,3*a),this._normals=O.allocateTyped(Float32Array,3*a),this._colors=O.allocateTyped(Float32Array,3*a);const u=this._alpha=O.allocateTyped(Float32Array,a);t().fill(u,1);for(let e=0;e0,c=!1===o&&t>0,h=(i+1)*s+l*(s+1)+c*(s+1),u=(2*i+l+c)*s,d=n/2,p=new r.BufferAttribute(O.allocateTyped(Float32Array,3*h),3),m=new r.BufferAttribute(O.allocateTyped(Float32Array,3*h),3),f=new r.Uint16BufferAttribute(O.allocateTyped(Uint16Array,3*u),1),_=new r.BufferAttribute(O.allocateTyped(Float32Array,2*h),2);let g=0,y=0;const x=-(t-e)/n;for(let o=0;o<=i;o++){if(o!==i)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=this._chunkGeo._positions.length,i=this._ringsCount,o=s*this._ringsCount*e*3;this._setPoints(t,s,i,o),r?this._setSlopeNormals(s,i,o):this._setBaseNormals(s,i,o),n&&this._addCut(s,i,o)}_setPoints(e,t,r,n){const s=this._tmpShape,i=this._positions,o=this._chunkGeo._positions;for(let a=0,l=n;a0)for(let t=0;t2)for(let t=0;t65535;this._index=O.allocateTyped(s?Uint32Array:Uint16Array,6*e),this._positions=O.allocateTyped(Float32Array,4*n),this._colors=O.allocateTyped(Float32Array,3*n),this._directions=O.allocateTyped(Float32Array,3*n);const i=this._alpha=O.allocateTyped(Float32Array,n);t().fill(i,1);const o=this._index;let a=0,l=0;for(let t=0;t117440512)throw new Error("Too large cube dimension: lead to memory huge uasge");return this.pointsValuesLinear=O.allocateTyped(Float32Array,32*t),this.hasIntersection=O.allocateTyped(Int32Array,t),this.bitsInside=O.allocateTyped(Int32Array,t),0}destroy(){this.bitsInside=null,this.hasIntersection=null,this.pointsValuesLinear=null}}_n.prototype.striIndicesMarchCube=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-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,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];const gn=_n,yn=[0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0];function xn(e,t,r){const n=e.getValue(t.x,t.y,t.z);r.set(n[0],n[1],n[2])}class bn{constructor(){this._arrSize=8,this.p=new Array(this._arrSize),this.g=new Array(this._arrSize),this.val=new Array(this._arrSize);for(let e=0;eMath.abs(e)>Number.EPSILON;return!(c(t.y)||c(t.z)||c(n.x)||c(n.z)||c(s.x)||c(s.y))}_vertexInterp(e,t,r,n,s,i){const o=t.p[r],a=t.p[n],l=t.g[r],c=t.g[n],h=t.val[r],u=e-h,d=t.val[n]-h;let p=0;Math.abs(d)>0&&(p=u/d),p=p>1?1:p,s.lerpVectors(o,a,p),i.lerpVectors(l,c,p)}static _triTable=(()=>gn.prototype.striIndicesMarchCube)();static _arrSize=12;static _firstIndices=[0,1,2,3,4,5,6,7,0,1,2,3];static _secondIndices=[1,2,3,0,5,6,7,4,4,5,6,7];static _vertexList=(()=>Sn(vn._arrSize))();static _normalList=(()=>Sn(vn._arrSize))();_polygonize(e,t,r){const{cubeIndex:n}=e;let s=0;const i=vn._arrSize,o=vn._firstIndices,a=vn._secondIndices,l=vn._vertexList,c=vn._normalList;for(;sa?a:r+t;let c=-1;for(let e=r;ee&&(t=r,e=A[r]);if(t<0||!n.includesAtom(C[t])){M[s]=-1;continue}}M[s]=P++;const D=g=0&&r>=0&&n>=0&&(this._indices[3*t]=e,this._indices[3*t+1]=r,this._indices[3*t+2]=n,++t)}this._position=new Float32Array(this._position.buffer.slice(0,3*P*4)),this._normals=new Float32Array(this._normals.buffer.slice(0,3*P*4)),this._colors=new Float32Array(this._colors.buffer.slice(0,3*P*4)),this._indices=new Uint32Array(this._indices.buffer.slice(0,3*t*4))}}toMesh(){const e=new r.BufferGeometry;return e.setIndex(new r.BufferAttribute(this._indices,1)),e.setAttribute("position",new r.BufferAttribute(this._position,3)),e.setAttribute("normal",new r.BufferAttribute(this._normals,3)),e.setAttribute("color",new r.BufferAttribute(this._colors,3)),e.computeBoundingSphere(),e}}const Cn=vn;const An=class extends fn{_build(){const e=this._opts;this.numVoxels=[128,128,128],this.xAxis=new r.Vector3(1,0,0),this.yAxis=new r.Vector3(0,1,0),this.zAxis=new r.Vector3(0,0,1),this.origin=new r.Vector3(0,0,0),this._visibilitySelector=e.visibilitySelector,this._calcSurface(e)}_findMinMax(e){const t=e.length/4,r=[e[0],e[1],e[2],e[3]],n=[e[0],e[1],e[2],e[3]];for(let s=1;s4&&(t.gridSpacing*=s[3]);let o=t.radScale*i[3]*1.7,a=o;a=.65*Math.sqrt(4/3*Math.PI*a*a*a),o=Math.max(o,a);let l=0;for(;l<3;++l)s[l]-=o,i[l]+=o;for(l=0;l<3;++l)r[l]=Math.ceil((i[l]-s[l])/t.gridSpacing);return this.xAxis.x=(r[0]-1)*t.gridSpacing,this.yAxis.y=(r[1]-1)*t.gridSpacing,this.zAxis.z=(r[2]-1)*t.gridSpacing,[this.origin.x,this.origin.y,this.origin.z]=s,{bbox:n,dim:r}}_makeSurface(e,t){const n=new Cn;n.compute(e.volMap,this.origin,t.isoValue,1),n.vertexFusion(9,9),n._numTriangles>0?(n.setColorVolTex(e.volTexMap,e.atomMap,e.atomWeightMap,this._visibilitySelector),this.setIndex(new r.BufferAttribute(n._indices,1)),this.setAttribute("position",new r.BufferAttribute(n._position,3)),this.setAttribute("normal",new r.BufferAttribute(n._normals,3)),this.setAttribute("color",new r.BufferAttribute(n._colors,3))):this.setAttribute("position",new r.BufferAttribute(O.allocateTyped(Float32Array,0),3))}_calcSurface(e){const t={posRad:this._posRad,colors:this._colors,atoms:this._opts.atoms};if(0===t.posRad.length)return;const n=this._findNumVoxels(t.posRad,e),s=new r.Box3(this.origin,new r.Vector3(this.xAxis.x,this.yAxis.y,this.zAxis.z).add(this.origin)),i=this._computeSurface(t,s,n,e);this._makeSurface(i,e)}},{Volume:En}=Yt;const Tn=class extends An{_computeSurface(e,t,r,n){this._shiftByOrigin(e.posRad);const s={volMap:new En(Float32Array,this.numVoxels,t),volTexMap:new En(Float32Array,this.numVoxels,t,3)};return null!=this._visibilitySelector&&(s.atomMap=[],s.atomWeightMap=new En(Float32Array,this.numVoxels,t)),this.gaussdensity(s,e,null,n),s}gaussdensity(e,t,r,n){const s=t.posRad.length/4,{posRad:i,colors:o}=t,{numVoxels:a}=this,{radScale:l,gaussLim:c,gridSpacing:h}=n,u=1/n.isoValue,d=1/h,p=a[0]-1,m=a[1]-1,f=a[2]-1,{volMap:_,volTexMap:g}=e,y=_.getData(),x=_.getStrideX(),b=g.getData(),w=g.getStrideX();let S;null!=this._visibilitySelector&&(S=e.atomWeightMap.getData());const{atomMap:v}=e;for(let e=0;e=E)continue;let d=_.getDirectIdx(R,l,r),p=g.getDirectIdx(R,l,r),m=R*h-i[n];for(let r=R;r<=M;++r,m+=h,d+=x,p+=w){const r=-(m*m+c)*C;let n=Math.exp(r)*a;null!=this._visibilitySelector&&n>S[d]&&(S[d]=n,v[d]=t.atoms[e]),y[d]+=n,n*=u;const s=3*e;b[p]+=n*o[s],b[p+1]+=n*o[s+1],b[p+2]+=n*o[s+2]}}}}}_shiftByOrigin(e){const t=this.origin.x,r=this.origin.y,n=this.origin.z,s=e.length/4;for(let i=0;iR&&(R=r)}this.neighbourListLength=27*R+1,this.withinRadii=function(t,r,n,s,l){let c=0;const h=u(t,i),f=u(r,o),g=u(n,a),b=Math.max(0,h-1),w=Math.max(0,f-1),S=Math.max(0,g-1),T=Math.min(d-1,h+1),R=Math.min(p-1,f+1),M=Math.min(m-1,g+1);for(y=b;y<=T;++y){const i=y*_;for(E=w;E<=R;++E){const o=E*m;for(let a=S;a<=M;++a){x=i+o+a;const h=v[x],u=h+C[x];for(let i=h;im&&(m=t),p[e]=t*t}F(),function(){let e=0;const t=2*Math.PI/g;E=O.allocateTyped(Float32Array,g),A=O.allocateTyped(Float32Array,g);for(let r=0;r=0;){if(i!==n&&i!==s&&U(i,e,t,r))return M=i,i;i=R[++o]}return M=-1,-1}function j(e,t){const r=i*e,n=i*t,s=o[r],a=o[r+1],l=o[r+2],c=o[r+3];let h=I.x=o[n]-s,d=I.y=o[n+1]-a,p=I.z=o[n+2]-l;const m=o[n+3];let f=h*h+d*d+p*p;const b=Math.sqrt(f),w=c*((c*c+b*b-m*m)/(2*c*b));var T,R;I.normalize(),R=I,(T=V).x=T.y=T.z=1,0!==R.x?T.x=(R.y+R.z)/-R.x:0!==R.y?T.y=(R.x+R.z)/-R.y:0!==R.z&&(T.z=(R.x+R.y)/-R.z),V.normalize(),D.crossVectors(I,V),D.normalize();const P=Math.sqrt(c*c-w*w);V.multiplyScalar(P),D.multiplyScalar(P),I.multiplyScalar(w),I.x+=s,I.y+=a,I.z+=l,M=-1;const N=k;for(let r=0;r0&&fP[o]&&(P[o]=t,N[o]=l[e]),x[o]<0&&(x[o]=-x[o]);const u=Math.sqrt(m),d=c/u;let f=p*d,_=a*d,g=i*d;if(f+=r,_+=n,g+=s,-1===G(f,_,g,e,-1)){const e=c-u;e=0;)e0){t=1/t;const r=3*e;b[r]*=t,b[r+1]*=t,b[r+2]*=t}}}()}this.build=function(){H(),this.volTexMap=b,this.weightsMap=P,this.atomMap=N,this.volMap=x}},{Volume:Pn}=Yt;const Nn=class extends An{_computeSurface(e,t,r,n){const s=new Mn(e,r,n);s.build();return{volMap:new Pn(Float32Array,this.numVoxels,t,1,s.volMap),volTexMap:new Pn(Float32Array,this.numVoxels,t,3,s.volTexMap),atomMap:s.atomMap,atomWeightMap:new Pn(Float32Array,this.numVoxels,t,1,s.weightsMap)}}};const Ln=class{constructor(e,t){this.coord=new r.Vector3,this.coord.copy(e),this.radius=t,this.colorX=.99999,this.colorY=0,this.colorZ=0,this.atomType=0,this.srcAtom=null}};const In=class{constructor(e,t,n,s,i){this._numAtoms=e,this._atoms=t,this._vBoxMin=new r.Vector3,this._vBoxMax=new r.Vector3,this._vBoxMin.copy(n),this._vBoxMax.copy(s),this._probeRadius=i,this._atomsList=null,this._voxelList=null}createVoxels(){let e,t;const r=0|this._numAtoms,n=this._atoms,s=this._vBoxMax.x-this._vBoxMin.x,i=this._vBoxMax.y-this._vBoxMin.y,o=this._vBoxMax.z-this._vBoxMin.z;let a=sc?t:c,h+=t;let u=Math.floor(a/c);u<2&&(u=2),h/=r,this._numCells=u,this._aveRad=h,this._maxRad=c;const d=u,p=u*u,m=u*u*u,f=this._xScale=1/(this._vBoxMax.x-this._vBoxMin.x),_=this._yScale=1/(this._vBoxMax.y-this._vBoxMin.y),g=this._zScale=1/(this._vBoxMax.z-this._vBoxMin.z);let y=0;const x=f*u,b=_*u,w=g*u;for(l=0;l=0?r:0,s=s>=0?s:0,i=i>=0?i:0,o=o=0;e=this._atomsList[2*e+1]){t(o[this._atomsList[2*e]])}}getClosestAtom(e){let t=null,r=Number.MAX_VALUE;return this.forEachRelatedAtom(e,(n=>{const s=e.distanceToSquared(n.coord);sf)return;const g=e.radius+n._probeRadius;d=s-g*g,d<0&&(d=-d),p=Math.exp(_*d),c+=t*p,h+=r*p,u+=m*p,i++};let y=0;for(let n=0;ny?i:y,s=c*c+h*h+u*u,i>0&&(d=1/Math.sqrt(s),c*=d,h*=d,u*=d),r[n].x=c,r[n].y=h,r[n].z=u;return 0}buildColors(e,t,r,n){const s=this;let i=0,o=0,a=0,l=0,c=0;const h=n*n;let u=[],d=[],p=0;const m=function(e){const t=i-e.coord.x,r=o-e.coord.y,n=a-e.coord.z,m=t*t+r*r+n*n;if(m>h)return;const f=e.radius+s._probeRadius;l=m-f*f,l<0&&(l=-l),c=1/(.8+l),u.push([e.colorX,e.colorY,e.colorZ]),d.push(c),p+=c};for(let n=0;ni?a:i,o.x-ar.x&&(r.x=o.x+a),o.y+a>r.y&&(r.y=o.y+a),o.z+a>r.z&&(r.z=o.z+a)}t.x-=i,t.y-=i,t.z-=i,r.x+=i,r.y+=i,r.z+=i}getCornerCoord(e,t,r,n,s,i,o){const a=1/(i-1),l=r*a,c=n*a,h=s*a;o.x=e.x*(1-l)+t.x*l,o.y=e.y*(1-c)+t.y*c,o.z=e.z*(1-h)+t.z*h}buildEdgePoint(e,t,r,n,s,i){if(r[e]^r[t]){const r=24,o=(0-n.pointsValuesLinear[s+r+e])/(n.pointsValuesLinear[s+r+t]-n.pointsValuesLinear[s+r+e]),a=n.pointsValuesLinear[s+3*e+0],l=n.pointsValuesLinear[s+3*e+1],c=n.pointsValuesLinear[s+3*e+2],h=n.pointsValuesLinear[s+3*t+0],u=n.pointsValuesLinear[s+3*t+1],d=n.pointsValuesLinear[s+3*t+2];i.x=a*(1-o)+h*o,i.y=l*(1-o)+u*o,i.z=c*(1-o)+d*o}}isTriangleVisible(e,t,r){const n=this.voxelWorld.getClosestAtom(e),s=this.voxelWorld.getClosestAtom(t),i=this.voxelWorld.getClosestAtom(r);return null!==n&&null!==s&&null!==i&&null!==n.srcAtom&&null!==s.srcAtom&&null!==i.srcAtom&&(this.visibilitySelector.includesAtom(n.srcAtom)&&this.visibilitySelector.includesAtom(s.srcAtom)&&this.visibilitySelector.includesAtom(i.srcAtom))}addTriangle(e,t,r){if(this.visibilitySelector&&!this.isTriangleVisible(e,t,r))return!0;const n=this.geoOut;if(n._numTriangles>=this.maxNumTriangles)return!1;const s=this.addVertexToGeo(n,e),i=this.addVertexToGeo(n,t),o=this.addVertexToGeo(n,r);if((s|i|o)<0)return!1;const a=3*n._numTriangles;return n._indices[a+0]=s,n._indices[a+1]=i,n._indices[a+2]=o,n._numTriangles++,!0}buildGeoFromCorners(e,t,n,s,i,o){const a=e-1,l=e,c=e*e,h=new Array(12);for(let e=0;e<12;e++)h[e]=new r.Vector3;const u=[];for(let e=0;e<8;e++)u[e]=1;const d=new r.Vector3;let p=0,m=0;for(let r=0;rt.length/2||2*Object.keys(Dn.ByAtomicNumber).length!==t.length)throw new Error("atomT.length should be equal Element.ByAtomicNumber.length * 2");return t[2*e]}calculateGridCorners(e,t,n,s,i,o){const a=t*t,l=a*t,c=new r.Vector3,h=new r.Vector3;for(let t=0;t=0;n=this.hashEntries[2*n+1]){const r=this.hashEntries[2*n+0];o.copy(e._vertices[r]),o.x-=t.x,o.y-=t.y,o.z-=t.z;if(o.x*o.x+o.y*o.y+o.z*o.z<1e-6)return r}if(e._numVertices>=this.maxNumVertices)return-1;const u=e._numVertices;if(e._vertices[u].copy(t),null!==this.vBoxMin&&null!==this.vBoxMax){if(n=this.getNewHashEntry(),n<0)return-1;const e=this.hashLines[h+1];this.hashLines[h+1]=n,this.hashEntries[2*n+0]=u,this.hashEntries[2*n+1]=e,this.hashLines[h+0]++}return e._numVertices++,u}modifyExcludedFromGeo(e,t,r,n,s,i){let o,a,l;const c=e*e,h=(e-1)/(n.x-r.x),u=(e-1)/(n.y-r.y),d=(e-1)/(n.z-r.z),p=2*t*(2*t),m=1/(e-1);for(let f=0;f=0?y:0,x=x>=0?x:0,b=b>=0?b:0,w=w<=e-1?w:e-1,S=S<=e-1?S:e-1,v=v<=e-1?v:e-1;for(let s=x;s<=S;s++){const h=s*c;for(let c=b;c<=v;c++){const u=c*e;for(let e=y;e<=w;e++){o=h+u+e;let d=e*m;const f=r.x*(1-d)+n.x*d;d=s*m;const g=r.y*(1-d)+n.y*d;d=c*m;const y=r.z*(1-d)+n.z*d,x=f-_.x,b=g-_.y,w=y-_.z,S=x*x+b*b+w*w;S0?(i[o]<0&&(i[o]=l),l>i[o]&&(i[o]=l)):l>i[o]&&(i[o]=l))}}}}return 0}_innerBuild(){let e;const t=1.2,n={posRad:this._posRad,colors:this._colors,atoms:this._opts.atoms};this.complex=this._opts.parent,this.atoms=n.atoms,this.meshResolution=this._opts.gridSpacing,this.atomRadiusScale=this._opts.radScale,this.colorMode=this._opts.colorMode,this.probeRadius=this._opts.probeRadius,this.useVertexColors=!0,this.excludeProbe=this._opts.excludeProbe,this.visibilitySelector=this._opts.visibilitySelector,this.geoOut=null,this.hashLines=null,this.hashEntries=null,this.numHashEtriesAllocated=0,this.numHashEntryIndex=0,this.maxNumVertices=0,this.maxNumTriangles=0;const s=new Array(this.atoms.length);this.convertToAtomsColored(n,s);const i=this.vBoxMin=new r.Vector3,o=this.vBoxMax=new r.Vector3;this.getBoundingBox(s,i,o);const a=this.marCubeResoultion=4*this.meshResolution,l=a,c=l*l*l,h=O.allocateTyped(Float32Array,c),u=this.probeRadius*this.atomRadiusScale;this.calculateGridCorners(h,l,i,o,s,u);const d=a-1,p=new gn;if(e=p.create(d),e<0)return e;const m=new r.Vector3;m.x=(o.x-i.x)/d,m.y=(o.y-i.y)/d,m.z=(o.z-i.z)/d;let f=this.getNumIntersectedCells(l,d,h,p),_=Math.floor(f*t),g=Math.floor(f*t*2);if(this.geoOut=new On(_,g,this.useVertexColors),e=this.createVertexHash(_,g),e<0)return e;let y=u;if(this.excludeProbe&&(y=.01),this.voxelWorld=new In(s.length,s,i,o,y),this.voxelWorld.createVoxels(),e=this.buildGeoFromCorners(a,i,o,h,m,p),this.excludeProbe){if(this.modifyExcludedFromGeo(l,u,i,o,this.geoOut,h),this.geoOut._vertices=null,this.geoOut._colors=null,this.geoOut._indices=null,this.geoOut._normals=null,this.geoOut._numVertices=0,this.geoOut._numTriangles=0,this.geoOut=null,f=this.getNumIntersectedCells(l,d,h,p),_=Math.floor(f*t),g=Math.floor(f*t*2),this.geoOut=new On(_,g,this.useVertexColors),e=this.createVertexHash(_,g),e<0)return e;e=this.buildGeoFromCorners(l,i,o,h,m,p)}this.voxelWorld.buildNormals(this.geoOut._vertices.length,this.geoOut._vertices,this.geoOut._normals);let x=6.5;return this.excludeProbe&&(x-=1.5),this.useVertexColors&&this.voxelWorld.buildColors(this.geoOut._vertices.length,this.geoOut._vertices,this.geoOut._colors,x),this.voxelWorld.destroyVoxels(),this.voxelWorld=null,p.destroy(),e}};const zn={InstancedSpheresGeometry:gr,SimpleSpheresGeometry:Sr,Simple2CCylindersGeometry:Er,Instanced2CCylindersGeometry:Dr,ExtrudedObjectsGeometry:jr,ChunkedLinesGeometry:rn,TwoColorLinesGeometry:on,CrossGeometry:dn,QuickSurfGeometry:Tn,ContactSurfaceGeometry:Nn,SSIsosurfaceGeometry:kn,LabelsGeometry:class extends g{constructor(e,t){super(),this._opts=t,this.items=[],this.needsUpdate=!1;let n=-50,s=-50;switch(t.horizontalAlign){case"left":n=0;break;case"right":n=-100}switch(t.verticalAlign){case"top":s=-100;break;case"bottom":s=0}const i=new r.Vector3(t.dx||0,t.dy||0,t.dz||0);this.userData={translation:`translate(${n}%, ${s}%)`,offset:i}}setItem(e,t,n){const s=this._opts,i=this.items[e]||function(e,t){const n=document.createElement("div");if(n.className=t,"string"==typeof e){const t=document.createElement("span");t.style.fontSize="150%";const r=e.split("\n");for(let e=0,n=r.length;e 0\r\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n attribute vec3 color;\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n attribute vec3 color2;\r\n varying vec3 vColor2;\r\n attribute vec2 uv;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_POS\r\n attribute vec4 offset;\r\n #ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n varying vec4 spritePosEye;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n attribute vec4 matVector1;\r\n attribute vec4 matVector2;\r\n attribute vec4 matVector3;\r\n attribute vec4 invmatVector1;\r\n attribute vec4 invmatVector2;\r\n attribute vec4 invmatVector3;\r\n\r\n #ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n varying vec4 spritePosEye;\r\n #endif\r\n#endif\r\n\r\nuniform mat4 modelViewMatrix; // optional\r\nuniform mat4 projectionMatrix; // optional\r\nuniform mat3 normalMatrix; // optional\r\nuniform mat4 modelMatrix; // optional\r\n\r\n#ifdef DASHED_LINE\r\n attribute float lineDistance;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n#ifdef THICK_LINE\r\n attribute vec3 direction;\r\n uniform mat4 projMatrixInv;\r\n uniform vec2 viewport;\r\n uniform float lineWidth;\r\n\r\n vec4 transform(vec4 coord){\r\n return projectionMatrix * modelViewMatrix * coord;\r\n }\r\n\r\n vec2 project(vec4 device){\r\n vec3 device_normal = device.xyz/device.w;\r\n vec2 clip_pos = (device_normal*0.5+0.5).xy;\r\n return clip_pos * viewport;\r\n }\r\n\r\n vec4 unproject(vec2 screen, float z, float w){\r\n vec2 clip_pos = screen/viewport;\r\n vec2 device_normal = clip_pos*2.0-1.0;\r\n return vec4(device_normal*w, z, w);\r\n }\r\n#endif\r\n\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n alphaCol = alphaColor;\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n vec3 objectNormal = vec3(\r\n dot(normal, matVector1.xyz),\r\n dot(normal, matVector2.xyz),\r\n dot(normal, matVector3.xyz));\r\n#else\r\n vec3 objectNormal = vec3( normal );\r\n#endif\r\n\r\nvec3 transformedNormal = normalMatrix * objectNormal;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n vNormal = normalize(transformedNormal);\r\n#endif\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n viewNormal = normalize(mat3(modelViewMatrix)*objectNormal);\r\n#endif\r\n\r\n vec4 localPos = vec4(position.xyz, 1.0);\r\n vec4 worldPos = modelMatrix * localPos;\r\n vec4 mvPosition = modelViewMatrix * localPos;\r\n\r\n// make thick line offset\r\n#ifdef THICK_LINE\r\n // get screen pos\r\n vec4 dPos = transform(vec4(position.xyz, 1.0));\r\n vec2 sPos = project(dPos);\r\n // move pos forward\r\n vec3 position2 = position.xyz + direction.xyz * 0.5;\r\n // get screen offset pos\r\n vec4 dPos2 = transform(vec4(position2.xyz, 1.0));\r\n vec2 sPos2 = project(dPos2);\r\n // screen line direction\r\n vec2 sDir = normalize(sPos2 - sPos);\r\n // vertex offset (orthogonal to line direction)\r\n vec2 offset1 = vec2(-sDir.y, sDir.x);\r\n // move screen vertex\r\n vec2 newPos = sPos + offset1 * position.w * lineWidth;\r\n // get moved pos in view space\r\n vec4 dNewPos = unproject(newPos, dPos.z, dPos.w);\r\n mvPosition.xyz = (projMatrixInv * dNewPos).xyz;\r\n#endif // THICK_LINE\r\n\r\n#ifdef INSTANCED_POS\r\n #ifdef SPHERE_SPRITE\r\n instOffset = offset;\r\n\r\n vec4 posEye = modelViewMatrix * vec4( offset.xyz, 1.0 );\r\n float scale = length(modelViewMatrix[0]);\r\n mvPosition = posEye + vec4( position.xyz * offset.w * scale * INSTANCED_SPRITE_OVERSCALE, 0.0 );\r\n posEye.w = offset.w * scale;\r\n\r\n spritePosEye = posEye;\r\n #else\r\n localPos = vec4( offset.xyz + position.xyz * offset.w, 1.0 );\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n #ifdef CYLINDER_SPRITE\r\n matVec1 = matVector1;\r\n matVec2 = matVector2;\r\n matVec3 = matVector3;\r\n invmatVec1 = invmatVector1;\r\n invmatVec2 = invmatVector2;\r\n invmatVec3 = invmatVector3;\r\n\r\n // calculate eye coords of cylinder endpoints\r\n vec4 v = vec4(0, -0.5, 0, 1);\r\n vec4 p1 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n v.y = 0.5;\r\n vec4 p2 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n\r\n // sprite is placed at the center of cylinder\r\n vec4 posEye;\r\n posEye.xyz = mix(p1.xyz, p2.xyz, 0.5);\r\n posEye.w = 1.0;\r\n spritePosEye = posEye;\r\n\r\n // cylinder radius in eye space\r\n float rad = length(modelViewMatrix[0]) * length(vec3(matVector1.x, matVector2.x, matVector3.x));\r\n vec2 spriteSize;\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // In ortho projection we skip z coordinate\r\n // basic sprite size at screen plane (covers only cylinder axis)\r\n vec2 spriteSizeScreen = abs(p2.xy - p1.xy);\r\n\r\n spriteSize = vec2(1.0, 1.0) * INSTANCED_SPRITE_OVERSCALE * (spriteSizeScreen + 2.0 * rad);\r\n #else\r\n // basic sprite size at screen plane (covers only cylinder axis)\r\n vec2 spriteSizeScreen = abs(p2.xy / p2.z - p1.xy / p1.z);\r\n\r\n // full sprite size in eye coords\r\n float minZ = min(abs(p1.z), abs(p2.z));\r\n spriteSize = vec2(1.0, 1.0) * INSTANCED_SPRITE_OVERSCALE * abs(posEye.z) * (spriteSizeScreen + 2.0 * rad / minZ);\r\n #endif\r\n\r\n mvPosition = posEye + vec4( position.xy * 0.5 * spriteSize, 0, 0 );\r\n #else\r\n localPos = vec4(dot(localPos, matVector1), dot(localPos, matVector2), dot(localPos, matVector3), 1.0);\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n gl_Position = projectionMatrix * mvPosition;\r\n\r\n vWorldPosition = worldPos.xyz;\r\n vViewPosition = - mvPosition.xyz;\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t vec4 worldPosition;\r\n\t // see THREE.WebGLProgram.unrollLoops\r\n\t #pragma unroll_loop_start\r\n\t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * vec4(vWorldPosition, 1.0);\r\n vDirectionalShadowNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(objectNormal, 0.0))).xyz;\r\n\t }\r\n\t #pragma unroll_loop_end\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n vColor = color.xyz;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n vColor2 = color2;\r\n #ifndef CYLINDER_SPRITE\r\n vUv = uv;\r\n #endif\r\n#endif\r\n\r\n#ifdef DASHED_LINE\r\n vLineDistance = lineDistance;\r\n#endif\r\n}\r\n",fragmentShader:this.precisionString()+"#if defined (NORMALS_TO_G_BUFFER)\r\n #define fragColor gl_FragData[0]\r\n#else\r\n #define fragColor gl_FragColor\r\n#endif\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n varying float alphaCol;\r\n#endif\r\n\r\n#ifdef COLOR_FROM_POS\r\n uniform mat4 world2colorMatrix;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\r\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ]; //only for sprites\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n vec4 vDirLightWorldCoord[ NUM_DIR_LIGHTS ];\r\n vec3 vDirLightWorldNormal[ NUM_DIR_LIGHTS ];\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n // We use 4 instead uniform variable or define because this value is used in for(... i < value; ...) with\r\n // unroll_loop and unroll_loop has pattern:\r\n // /#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g\r\n uniform vec2 samplesKernel[4]; // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n uniform sampler2D noiseTex;\r\n uniform vec2 noiseTexelSize;\r\n uniform vec2 srcTexelSize;\r\n uniform mat4 projectionMatrix;\r\n #endif\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n varying vec3 vColor2;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\nuniform vec3 diffuse;\r\nuniform vec3 emissive;\r\nuniform vec3 specular;\r\nuniform float shininess;\r\nuniform vec3 fixedColor;\r\nuniform float opacity;\r\nuniform float zClipValue;\r\nuniform float clipPlaneValue;\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n varying vec3 viewNormal;\r\n#endif\r\n\r\n#define RECIPROCAL_PI 0.31830988618\r\n#define saturate(a) clamp( a, 0.0, 1.0 )\r\n\r\n#ifdef USE_FOG\r\n uniform vec3 fogColor;\r\n uniform float fogAlpha;\r\n uniform float fogNear;\r\n uniform float fogFar;\r\n#endif\r\n\r\nvarying vec3 vWorldPosition; // world position of the pixel (invalid when INSTANCED_SPRITE is defined)\r\nvarying vec3 vViewPosition;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n varying vec3 vNormal;\r\n#endif\r\n\r\n/////////////////////////////////////////// ZSprites ////////////////////////////////////////////////\r\n#if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r\n uniform float nearPlaneValue;\r\n#endif\r\n\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 spritePosEye;\r\n#endif\r\n\r\n#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n uniform float zOffset;\r\n\r\n #if !defined(USE_LIGHTS) || !defined(SHADOWMAP) || !defined(SHADOWMAP_PCF_RAND) || !(NUM_DIR_LIGHTS > 0)\r\n uniform mat4 projectionMatrix;\r\n #endif\r\n\r\n float calcDepthForSprites(vec4 pixelPosEye, float zOffset, mat4 projMatrix) {\r\n vec4 pixelPosScreen = projMatrix * pixelPosEye;\r\n return 0.5 * (pixelPosScreen.z / pixelPosScreen.w + 1.0) + zOffset;\r\n }\r\n#endif\r\n\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n\r\n bool intersect_ray_sphere(in vec3 origin, in vec3 ray, out vec3 point, out float frontFaced) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray, ray);\r\n float b = dot(ray, origin);\r\n float c = dot(origin, origin) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return false;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n // choose nearest point inside frustum\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // orthografic camera is used for dirLight sources. So in it for all spheres the point with smaller 't' is visible\r\n // t1 is always smaller than t2 (from calculations)\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n #else\r\n // for perspective camera first intersection can be in front of near plane. If not intersection is p1 else - p2\r\n // t* = 0.0 corresponds to point of intersection near plane by the ray from camera to curPixel\r\n if (t1 >= 0.0) {\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n }\r\n if (t2 >= 0.0) {\r\n point = p2;\r\n frontFaced = -1.0;\r\n return true;\r\n }\r\n #endif\r\n\r\n return false;\r\n }\r\n\r\n bool get_sphere_point(in vec3 pixelPosEye, out vec3 point, out float frontFaced) {\r\n vec3 origin, ray;\r\n\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // transform vector from sprite center to curPixel into sphere local coords\r\n origin = pixelPosEye.xyz - spritePosEye.xyz;\r\n origin = (invModelViewMatrix * vec4(origin, 0.0)).xyz / instOffset.w;\r\n\r\n // transform camera orientation vector into sphere local coords\r\n ray = (invModelViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\r\n #else\r\n // find point of intersection near plane by the ray from camera to curPixel\r\n vec4 v = vec4(-(nearPlaneValue / pixelPosEye.z) * pixelPosEye, 1.0);\r\n\r\n // transform intersection point into sphere local coords\r\n v = invModelViewMatrix * v;\r\n origin = (v.xyz - instOffset.xyz) / instOffset.w;\r\n\r\n // transform vector from camera pos to curPixel into sphere local coords\r\n ray = (invModelViewMatrix * vec4(pixelPosEye, 0.0)).xyz;\r\n #endif\r\n ray = normalize(ray);\r\n\r\n return intersect_ray_sphere(origin, ray, point, frontFaced);\r\n }\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n varying vec4 spritePosEye;\r\n\r\n bool intersect_ray_cylinder(in vec3 origin, in vec3 ray, out vec3 point, out float frontFaced) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray.xz, ray.xz);\r\n float b = dot(ray.xz, origin.xz);\r\n float c = dot(origin.xz, origin.xz) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return false;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n float halfHeight = 0.5;\r\n\r\n // choose nearest point\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // orthografic camera is used for dirLight sources. So in it for all cylinders the point with smaller 't' is visible\r\n // if it is not outside of cylinnder (t1 is always smaller than t2).\r\n if (p1.y >= -halfHeight && p1.y <= halfHeight) {\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n }\r\n if (p2.y >= -halfHeight && p2.y <= halfHeight) {\r\n point = p2;\r\n frontFaced = -1.0;\r\n return true;\r\n }\r\n #else\r\n // for perspective camera first intersection can be in front of near plane. If not intersection is p1 else - p2\r\n // t* = 0.0 corresponds to point of intersection near plane by the ray from camera to curPixel\r\n if (t1 >= 0.0 && p1.y >= -halfHeight && p1.y <= halfHeight) {\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n }\r\n if (t2 >= 0.0 && p2.y >= -halfHeight && p2.y <= halfHeight) {\r\n point = p2;\r\n frontFaced = -1.0;\r\n return true;\r\n }\r\n #endif\r\n\r\n return false;\r\n }\r\n\r\n bool get_cylinder_point(in vec3 pixelPosEye, out vec3 point, out float frontFaced) {\r\n vec3 origin, ray;\r\n vec4 v;\r\n\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // transform vector from sprite center to curPixel into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye.xyz - spritePosEye.xyz, 0.0);\r\n origin = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n\r\n // transform camera orientation vector into cylinder local coords\r\n v = invModelViewMatrix * vec4(0.0, 0.0, -1.0, 0.0);\r\n ray = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n #else\r\n // find point of intersection near plane by the ray from camera to curPixel\r\n v = vec4(-(nearPlaneValue / pixelPosEye.z) * pixelPosEye, 1.0);\r\n\r\n // transform intersection point into cylinder local coords\r\n v = invModelViewMatrix * v;\r\n origin = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n\r\n // transform vector from camera pos to curPixel into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye, 0.0);\r\n ray = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n #endif\r\n ray = normalize(ray);\r\n\r\n return intersect_ray_cylinder(origin, ray, point, frontFaced);\r\n }\r\n#endif\r\n\r\n///////////////////////////////////// Pack and unpack ///////////////////////////////////////////////\r\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\r\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\r\n\r\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\r\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\r\n\r\n\r\nconst float ShiftRight8 = 1. / 256.;\r\n\r\nvec4 packDepthToRGBA( const in float v ) {\r\n vec4 r = vec4( fract( v * PackFactors ), v );\r\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\r\n return r * PackUpscale;\r\n}\r\n\r\nfloat unpackRGBAToDepth( const in vec4 v ) {\r\n return dot( v, UnpackFactors );\r\n}\r\n\r\n////////////////////////////////////////// All Lighting /////////////////////////////////////////////////\r\n#ifdef TOON_SHADING\r\n #define LOW_TOON_BORDER 0.0\r\n #define MEDIUM_TOON_BORDER 0.7\r\n #define HIGH_TOON_BORDER 1.0\r\n\r\n #define MEDIUM_TOON_RANGE 0.5\r\n #define HIGH_TOON_RANGE 0.95\r\n#endif\r\n#if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n struct ReflectedLight {\r\n vec3 directDiffuse;\r\n vec3 directSpecular;\r\n vec3 indirectDiffuse;\r\n };\r\n\r\n struct BlinnPhongMaterial {\r\n vec3 diffuseColor;\r\n vec3 specularColor;\r\n float specularShininess;\r\n };\r\n\r\n struct GeometricContext {\r\n vec3 normal;\r\n vec3 viewDir;\r\n };\r\n\r\n struct DirectionalLight {\r\n vec3 direction;\r\n vec3 color;\r\n };\r\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\r\n\r\n struct DirectionalLightShadow {\r\n vec2 shadowMapSize;\r\n float shadowBias;\r\n float shadowRadius;\r\n };\r\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHTS ];\r\n\r\n uniform vec3 ambientLightColor;\r\n\r\n /////////////////////////////////////////// Shadowmap ////////////////////////////////////////////////\r\n\r\n #if defined(SHADOWMAP)\r\n \tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\r\n \t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\r\n \t}\r\n\r\n float getShadow( sampler2D shadowMap, DirectionalLightShadow dirLight, vec4 shadowCoord, vec3 vViewPosition, vec3 vNormal ) {\r\n \t float shadow = 0.0;\r\n\r\n // When shadows for sprites will appear use here for them normals as it done for G-buffer\r\n shadowCoord.xyz += dirLight.shadowBias * vNormal;\r\n shadowCoord.xyz /= shadowCoord.w;\r\n\r\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\r\n bool inFrustum = all( inFrustumVec );\r\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\r\n bool frustumTest = all( frustumTestVec );\r\n\r\n if ( frustumTest ) {\r\n #ifdef SHADOWMAP_BASIC\r\n \t shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\r\n \t#endif\r\n\r\n \t#ifdef SHADOWMAP_PCF_SHARP\r\n \t vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n float dx0 = - texelSize.x * dirLight.shadowRadius;\r\n float dy0 = - texelSize.y * dirLight.shadowRadius;\r\n float dx1 = + texelSize.x * dirLight.shadowRadius;\r\n float dy1 = + texelSize.y * dirLight.shadowRadius;\r\n\r\n shadow = (\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\r\n ) * ( 1.0 / 9.0 );\r\n #endif\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n vec4 vUv = ((projectionMatrix * vec4(vViewPosition, 1.0)) + 1.0) / 2.0;\r\n vec2 vUvNoise = vUv.xy / srcTexelSize * noiseTexelSize;\r\n\r\n vec2 noiseVec = normalize(texture2D(noiseTex, vUvNoise).rg);\r\n mat2 mNoise = mat2(noiseVec.x, noiseVec.y, -noiseVec.y, noiseVec.x);\r\n\r\n vec2 offset;\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < 4; i ++ ) { // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n offset = mNoise * ( normalize( samplesKernel[ i ]) * texelSize * dirLight.shadowRadius );\r\n shadow += texture2DCompare( shadowMap, shadowCoord.xy + offset, shadowCoord.z );\r\n }\r\n #pragma unroll_loop_end\r\n shadow /= float( 4 ); // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n #endif\r\n }\r\n return shadow;//(shadow != 1.0) ? 0.5 : 1.0;//vec4(shadow, shadow, shadow, 1.0);\r\n }\r\n #endif\r\n\r\n /////////////////////////////////////////// Lighting /////////////////////////////////////////////////\r\n\r\n vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\r\n return RECIPROCAL_PI * diffuseColor;\r\n } // validated\r\n\r\n vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\r\n // Original approximation by Christophe Schlick '94\r\n //;float fresnel = pow( 1.0 - dotLH, 5.0 );\r\n // Optimized variant (presented by Epic at SIGGRAPH '13)\r\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\r\n return ( 1.0 - specularColor ) * fresnel + specularColor;\r\n } // validated\r\n\r\n float G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\r\n // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\r\n return 0.25;\r\n }\r\n\r\n float D_BlinnPhong( const in float shininess, const in float dotNH ) {\r\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\r\n }\r\n\r\n vec3 BRDF_Specular_BlinnPhong( const in DirectionalLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\r\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\r\n float dotNH = saturate(dot( geometry.normal, halfDir ));\r\n float dotLH = saturate(dot( incidentLight.direction, halfDir ));\r\n\r\n vec3 F = F_Schlick( specularColor, dotLH );\r\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\r\n float D = D_BlinnPhong( shininess, dotNH );\r\n\r\n return F * ( G * D );\r\n } // validated\r\n\r\n void RE_Direct_BlinnPhong( const in DirectionalLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight, float penumbra ) {\r\n\r\n float dotNL = saturate( dot( geometry.normal, directLight.direction ));\r\n #ifdef TOON_SHADING\r\n if(dotNL < MEDIUM_TOON_RANGE){\r\n dotNL = LOW_TOON_BORDER;\r\n }\r\n else if(dotNL < HIGH_TOON_RANGE){\r\n dotNL = MEDIUM_TOON_BORDER;\r\n }\r\n else{\r\n dotNL = HIGH_TOON_BORDER;\r\n }\r\n #endif\r\n\r\n vec3 irradiance = dotNL * directLight.color;\r\n reflectedLight.directDiffuse += penumbra * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n reflectedLight.directSpecular += penumbra * irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess );\r\n }\r\n\r\n void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\r\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n }\r\n\r\n vec3 calcLighting(const in GeometricContext geometry, const in BlinnPhongMaterial material, vec3 vViewPosition) {\r\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\r\n vec3 irradiance = ambientLightColor;\r\n\r\n float shadowMask = 1.0;\r\n // see THREE.WebGLProgram.unrollLoops\r\n \t#pragma unroll_loop_start\r\n \t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n \t #ifdef SHADOWMAP\r\n \t shadowMask = getShadow( directionalShadowMap[ i ], directionalLightShadows[ i ], vDirLightWorldCoord[ i ], vViewPosition, vDirLightWorldNormal[ i ] );\r\n #endif\r\n\r\n \t\t if ( shadowMask > 0.0 ) RE_Direct_BlinnPhong( directionalLights[ i ], geometry, material, reflectedLight, shadowMask );\r\n \t\t}\r\n \t\t#pragma unroll_loop_end\r\n\r\n RE_IndirectDiffuse_BlinnPhong(irradiance, material, reflectedLight);\r\n\r\n return saturate(reflectedLight.indirectDiffuse + reflectedLight.directDiffuse + reflectedLight.directSpecular);\r\n }\r\n#endif\r\n\r\n/////////////////////////////////////////// Dashed Line ///////////////////////////////////////////////\r\n#ifdef DASHED_LINE\r\n uniform float dashedLineSize;\r\n uniform float dashedLinePeriod;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef CLIP_PLANE\r\n if (vViewPosition.z < clipPlaneValue) discard;\r\n#endif\r\n\r\n#ifdef ZCLIP\r\n if (vViewPosition.z < zClipValue) discard;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n #if NUM_DIR_LIGHTS > 0\r\n // see THREE.WebGLProgram.unrollLoops\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirLightWorldCoord[ i ] = vDirectionalShadowCoord[ i ];\r\n vDirLightWorldNormal[ i ] = vDirectionalShadowNormal[ i ];\r\n }\r\n #pragma unroll_loop_end\r\n #endif\r\n#endif\r\n\r\n vec4 pixelPosWorld = vec4(vWorldPosition, 1.0);\r\n vec4 pixelPosEye;\r\n\r\n#ifdef SPHERE_SPRITE\r\n\r\n vec3 viewNormalSprites;\r\n float frontFaced = 1.0;\r\n vec3 normal;\r\n\r\n/* quick-and-dirty method\r\n normal.xy = ' + INSTANCED_SPRITE_OVERSCALE + ' * (2.0 * vUv - 1.0);\r\n float r2 = dot(normal.xy, normal.xy);\r\n if (r2 > 1.0) discard;\r\n float normalZ = sqrt(1.0 - r2);\r\n normal.z = normalZ;\r\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\r\n pixelPosEye = vec4(spritePosEye.xyz, 1.0);\r\n pixelPosEye.z += spritePosEye.w * normalZ;\r\n*/\r\n\r\n // ray-trace sphere surface\r\n {\r\n vec3 p;\r\n if (!get_sphere_point(-vViewPosition, p, frontFaced)) discard;\r\n vec4 v = vec4(instOffset.xyz + p * instOffset.w, 1.0);\r\n pixelPosWorld = modelMatrix * v;\r\n pixelPosEye = modelViewMatrix * v;\r\n normal = normalize(normalMatrix * p);\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*p);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n #if NUM_DIR_LIGHTS > 0\r\n // see THREE.WebGLProgram.unrollLoops\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirLightWorldCoord[ i ] = directionalShadowMatrix[ i ] * pixelPosWorld;\r\n vDirLightWorldNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(p, 0.0))).xyz;\r\n }\r\n #pragma unroll_loop_end\r\n #endif\r\n #endif\r\n }\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n vec3 normal;\r\n vec3 viewNormalSprites;\r\n float frontFaced = 1.0;\r\n float cylinderY = 0.0;\r\n\r\n // ray-trace cylinder surface\r\n {\r\n vec3 p;\r\n if (!get_cylinder_point(-vViewPosition, p, frontFaced)) discard;\r\n\r\n cylinderY = 0.5 * (p.y + 1.0);\r\n\r\n vec4 v = vec4(p, 1.0);\r\n v = vec4(dot(v, matVec1), dot(v, matVec2), dot(v, matVec3), 1.0);\r\n pixelPosWorld = modelMatrix * v;\r\n pixelPosEye = modelViewMatrix * v;\r\n\r\n vec3 localNormal = normalize(vec3(p.x, 0.0, p.z));\r\n normal = vec3(\r\n dot(localNormal, matVec1.xyz),\r\n dot(localNormal, matVec2.xyz),\r\n dot(localNormal, matVec3.xyz));\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*normal);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n #if NUM_DIR_LIGHTS > 0\r\n // see THREE.WebGLProgram.unrollLoops\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirLightWorldCoord[ i ] = directionalShadowMatrix[ i ] * pixelPosWorld;\r\n vDirLightWorldNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(normal, 0.0))).xyz;\r\n }\r\n #pragma unroll_loop_end\r\n #endif\r\n #endif\r\n\r\n normal = normalize(normalMatrix * normal);\r\n }\r\n#endif\r\n\r\n #ifdef ATTR_COLOR\r\n vec3 vertexColor = vColor;\r\n #else\r\n vec3 vertexColor = vec3(1.0, 1.0, 1.0);\r\n #endif\r\n\r\n #ifdef ATTR_COLOR2\r\n #ifdef CYLINDER_SPRITE\r\n float colorCoef = cylinderY; // cylinder parameter is calculated from ray-tracing\r\n #else\r\n float colorCoef = vUv.y; // cylinder parameter is interpolated as tex coord\r\n #endif\r\n // choose either color or color2\r\n vertexColor = mix(vColor2, vColor, step(0.5, colorCoef));\r\n #endif\r\n\r\n // negative red component is a special condition\r\n if (vertexColor.x < 0.0) discard;\r\n\r\n #ifdef DASHED_LINE\r\n if ( mod( vLineDistance, dashedLinePeriod ) > dashedLineSize ) discard;\r\n #endif\r\n\r\n // transparency prepass writes only z, so we don't need to calc the color\r\n #ifdef PREPASS_TRANSP\r\n fragColor = vec4(1.0, 1.0, 1.0, 1.0);\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n return;\r\n #endif\r\n\r\n float totalOpacity = opacity;\r\n\r\n #ifdef ATTR_ALPHA_COLOR\r\n totalOpacity *= alphaCol;\r\n #endif\r\n\r\n // discard fully transparent pixels\r\n if (totalOpacity == 0.0) discard;\r\n\r\n #ifdef FAKE_OPACITY\r\n // discard pixels in checker pattern\r\n vec2 dm_coord = floor(gl_FragCoord.xy);\r\n dm_coord = fract(dm_coord * 0.5);\r\n if (totalOpacity < 1.0 && (dm_coord.x < 0.5 ^^ dm_coord.y < 0.5)) discard;\r\n vec4 diffuseColor = vec4(diffuse, 1.0);\r\n #else\r\n vec4 diffuseColor = vec4(diffuse, totalOpacity);\r\n #endif\r\n\r\n float flipNormal;\r\n #if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n flipNormal = 1.0;\r\n #ifdef DOUBLE_SIDED\r\n flipNormal = float( gl_FrontFacing );\r\n #endif\r\n vec3 normal = normalize( vNormal ) * flipNormal;\r\n #endif\r\n\r\n diffuseColor.rgb *= vertexColor;\r\n\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n\r\n #ifdef NORMALS_TO_G_BUFFER\r\n #if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r\n vec3 viewNormaInColor = viewNormalSprites;\r\n #else\r\n vec3 viewNormaInColor = viewNormal;\r\n float frontFaced = float( gl_FrontFacing );\r\n #endif\r\n // [-1, 1] -> [0, 1]\r\n viewNormaInColor = 0.5 * viewNormaInColor + 0.5;\r\n gl_FragData[1] = vec4(viewNormaInColor, frontFaced);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n vec3 viewDir;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n viewDir = -pixelPosEye.xyz;\r\n #else\r\n viewDir = vViewPosition;\r\n #endif\r\n GeometricContext geometry = GeometricContext(normal, normalize( viewDir ));\r\n BlinnPhongMaterial material = BlinnPhongMaterial(diffuseColor.rgb, specular, shininess);\r\n vec3 outgoingLight = calcLighting(geometry, material, viewDir);\r\n #else\r\n vec3 outgoingLight = diffuseColor.rgb;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_DEPTH\r\n float depth = 0.0;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n depth = gl_FragDepthEXT;\r\n #else\r\n depth = gl_FragCoord.z;\r\n #endif\r\n fragColor = packDepthToRGBA(depth);\r\n return;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_POS\r\n fragColor = world2colorMatrix * pixelPosWorld;\r\n #else\r\n #ifdef OVERRIDE_COLOR\r\n fragColor = vec4(fixedColor, diffuseColor.a);\r\n #else\r\n fragColor = vec4(outgoingLight, diffuseColor.a);//vec4(vNormal, 1.0);\r\n #endif\r\n\r\n #ifdef USE_FOG\r\n float viewDistance;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n viewDistance = abs(pixelPosEye.z);\r\n #else\r\n viewDistance = vViewPosition.z;\r\n #endif\r\n float fogFactor = smoothstep( fogNear, fogFar, viewDistance) * fogAlpha;\r\n #ifdef FOG_TRANSPARENT\r\n fragColor.a = fragColor.a * (1.0 - fogFactor);\r\n #else\r\n fragColor.rgb = mix( fragColor.rgb, fogColor, fogFactor );\r\n #endif\r\n #endif\r\n\r\n #endif\r\n}\r\n",lights:!0,fog:!0,side:r.DoubleSide}),this.setValues(e)}precisionString(){const{precision:e}=Fn;return`precision ${e} float;\nprecision ${e} int;\n\n`}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=r.UniformsUtils.clone(e.uniforms),this.defines={...e.defines},this.extensions=e.extensions,this.fog=e.fog,this.instancedPos=e.instancedPos,this.instancedMatrix=e.instancedMatrix,this.attrColor=e.attrColor,this.attrColor2=e.attrColor2,this.attrAlphaColor=e.attrAlphaColor,this.overrideColor=e.overrideColor,this.sphereSprite=e.sphereSprite,this.cylinderSprite=e.cylinderSprite,this.zClip=e.zClip,this.clipPlane=e.clipPlane,this.fakeOpacity=e.fakeOpacity,this.colorFromPos=e.colorFromPos,this.shadowmap=e.shadowmap,this.shadowmapType=e.shadowmapType,this.colorFromDepth=e.colorFromDepth,this.orthoCam=e.orthoCam,this.prepassTransparancy=e.prepassTransparancy,this.dashedLine=e.dashedLine,this.thickLine=e.thickLine,this.fogTransparent=e.fogTransparent,this.normalsToGBuffer=e.normalsToGBuffer,this.toonShading=e.toonShading,this.uberOptions.copy(e.uberOptions),this}createInstance(){const e=new Qn;return e.copy(this),e.uberOptions=Object.create(this.uberOptions),e}setValues(e){if(void 0===e)return;super.setValues(e);const t={},r={};this.fog&&(t.USE_FOG=1),this.instancedPos&&(t.INSTANCED_POS=1),this.instancedMatrix&&(t.INSTANCED_MATRIX=1),this.attrColor&&(t.ATTR_COLOR=1),this.attrColor2&&(t.ATTR_COLOR2=1),this.attrAlphaColor&&(t.ATTR_ALPHA_COLOR=1),this.overrideColor&&(t.OVERRIDE_COLOR=1),this.sphereSprite&&(t.SPHERE_SPRITE=1,r.fragDepth=!0),this.cylinderSprite&&(t.CYLINDER_SPRITE=1,r.fragDepth=!0),this.zClip&&(t.ZCLIP=1),this.clipPlane&&(t.CLIP_PLANE=1),this.fakeOpacity&&(t.FAKE_OPACITY=1),this.lights&&(t.USE_LIGHTS=1),this.colorFromPos&&(t.COLOR_FROM_POS=1),this.shadowmap&&(t.SHADOWMAP=1,"pcf"===this.shadowmapType?t.SHADOWMAP_PCF_SHARP=1:"random"===this.shadowmapType?t.SHADOWMAP_PCF_RAND=1:t.SHADOWMAP_BASIC=1),this.colorFromDepth&&(t.COLOR_FROM_DEPTH=1),this.orthoCam&&(t.ORTHOGRAPHIC_CAMERA=1),this.prepassTransparancy&&(t.PREPASS_TRANSP=1),this.dashedLine&&(t.DASHED_LINE=1),this.thickLine&&(t.THICK_LINE=1),this.fogTransparent&&(t.FOG_TRANSPARENT=1),this.normalsToGBuffer&&(r.drawBuffers=!0,t.NORMALS_TO_G_BUFFER=1),this.toonShading&&(t.TOON_SHADING=1),this.defines=t,this.extensions=r}setUberOptions(e){if(void 0!==e)for(const t in e)e.hasOwnProperty(t)&&(this.uberOptions[t]instanceof r.Color?this.uberOptions[t]=e[t].clone():this.uberOptions[t]=e[t])}clone(e){return e?this.createInstance():super.clone()}updateUniforms(){const e=this;Zn.forEach((t=>{e.uniforms.hasOwnProperty(t)&&(e.uberOptions[t]instanceof r.Color||e.uberOptions[t]instanceof r.Matrix4?e.uniforms[t].value=e.uberOptions[t].clone():e.uniforms[t].value=e.uberOptions[t])}))}}Qn.prototype.uberOptions=Kn;const Jn=Qn;function es(e){class t extends e{constructor(){super(...arguments),this.onBeforeRender=t.prototype.onBeforeRender}onBeforeRender(e,t,r,n,s,i){this._onBeforeRender(e,t,r,n,s,i),this._update()}_onBeforeRender(){}_update(){const{material:e}=this;e&&e instanceof Jn&&e.updateUniforms()}}return t}const ts=es(r.Mesh);const rs=class extends ts{constructor(){super(...arguments),this.castShadow=!0,this.receiveShadow=!0}_onBeforeRender(e,t,r,n,s,i){ts.prototype._onBeforeRender.call(this,e,t,r);const{material:o}=this;o&&o.uniforms.invModelViewMatrix&&(this.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,this.matrixWorld),o.uniforms.invModelViewMatrix.value.copy(this.modelViewMatrix).invert(),o.uniforms.nearPlaneValue.value=r.near,o.uniformsNeedUpdate=!0)}},ns=es(r.Mesh);class ss extends ns{constructor(e,t){super(e,t),this.castShadow=!0,this.receiveShadow=!0}static _mvLength=(()=>new r.Vector3)();static _center=(()=>new r.Vector3)();static _modelView=(()=>new r.Matrix4)();_onBeforeRender(e,t,r){ns.prototype._onBeforeRender.call(this,e,t,r);const n=this.geometry,{material:s}=this;if(!n.zClip||!s.uberOptions)return;const i=ss._modelView,o=ss._mvLength,a=ss._center;i.multiplyMatrices(this.matrixWorld,r.matrixWorldInverse);const l=o.setFromMatrixColumn(i,0).length();a.copy(n.boundingSphere.center),this.localToWorld(a),s.uberOptions.zClipValue=r.position.z-a.z-l*(.5*n.boundingSphere.radius)}}const is=ss;class os extends r.Group{constructor(e,t){super(),this.geometry=e;const r=this;r.initialized=!1,this.geometry.addEventListener("update",(()=>{r.update()}))}init(){const{children:e}=this;for(let t=e.length-1;t>=0;--t)this.remove(e[t]);const{items:r,userData:n}=this.geometry;for(let e=0,s=r.length;enew r.Matrix4)();static _ray=(()=>new r.Ray)();constructor(e,t,n,s){super(),this._geometry=e,this._geoParams=t;const i=n.createInstance();t.initMaterial(i),this._material=i,this._transforms=s.length>0?s:[new r.Matrix4];const o=this._createMeshes(e);for(let e=0,t=o.length;ee,adjust:function(e){let t=e>>16&255,r=e>>8&255,n=255&e;return.2126*t+.7152*r+.0722*n>127?(t=3*t/10,r=3*r/10,n=3*n/10):(t=255-3*(255-t)/10,r=255-3*(255-r)/10,n=255-3*(255-n)/10),t<<16|r<<8|n},inverse:function(e){return 255-(e>>16&255)<<16|255-(e>>8&255)<<8|255-(255&e)}};function Ns(e,t){let r;if(Ps.hasOwnProperty(t))r=O.hexColor(Ps[t](e));else{const e=parseInt(t,16);r=!Number.isNaN(e)&&t.toLowerCase().startsWith("0x")?O.hexColor(e):"#000000"}return r}const Ls={serial:e=>e.serial,name:e=>e.getVisualName(),elem:e=>e.element.name,residue:e=>e.residue.getType().getName(),sequence:e=>e.residue.getSequence(),chain:e=>e.residue.getChain().getName(),hetatm:e=>e.isHet(),water:e=>"HOH"===e.residue.getType().getName()||"WAT"===e.residue.getType().getName()},Is=function(e,t){return t.replace(/\{\{(\s*\w+\s*)\}\}/g,(t=>{let r=t.replace(/\s+/g,"");return r=r.substring(2,r.length-2).toLowerCase(),Ls.hasOwnProperty(r)?Ls[r](e):"null"}))};const Os=class extends As{_makeGeoArgs(){const e=this._mode.getLabelOpts();return[this._selection.chunks.length,e]}_build(){const e=this._mode.getLabelOpts(),t=this._selection.chunks,{atoms:r,parent:n}=this._selection,s=this._colorer,i=this._geo;for(let o=0,a=t.length;o{for(let t=0;t<=e;++t){const e=s[t],r=e.clone().sub(l).cross(c);i.addVectors(e,r),o[t]=zs(e,i,c,n)}a.setItem(t,o),a.setColor(t,r)})),a.finalize()}_makeGeoArgs(){return this._segmentsHeight=this._polyComplexity,[ks(1,this._polyComplexity),this._segmentsHeight+1,this._selection.chunks.length]}};const Bs=class extends Ds{_build(){const e=this._geo,t=this._mode.getAromaticOffset();this._buildInner(t,((t,r,n)=>{let s=n[0];for(let r=1;r<=this._segmentsHeight;++r){const i=n[r];e.setSegment(t,r-1,s,i),s=i}e.setColor(t,r)})),e.finalize()}_makeGeoArgs(){return this._segmentsHeight=this._mode.getAromaticArcChunks(),[this._selection.chunks.length,this._segmentsHeight,!0]}};const Us=class extends Cs{raycast(e,t){const{residues:r}=this._selection,n=[];this._mesh.raycast(e,n);const s=this._chunksIdc;for(let e=0,i=n.length;es&&e[t-1]._isValid?t-1:t}function a(t){return t{const t=e.getVisualName();a||t!==i?l||t!==o||(l=e.position):a=e.position})),a&&l||(a=n._firstAtom.position,l=n._lastAtom.position),a&&l){const s=l.clone().sub(a),i=n._wingVector,o=n._controlPoint,c=o.clone().add(i),h=o.clone().sub(s),u=h.clone().add(i);e[r]=[h.x,h.y,h.z],t[r]=[u.x,u.y,u.z],e[++r]=[h.x,h.y,h.z],t[r]=[u.x,u.y,u.z],e[++r]=[o.x,o.y,o.z],t[r]=[c.x,c.y,c.z],++r;const d=o.clone().add(s),p=d.clone().add(i);e[r]=[d.x,d.y,d.z],t[r]=[p.x,p.y,p.z],e[++r]=[d.x,d.y,d.z],t[r]=[p.x,p.y,p.z]}}(c,l,h,e[t]),{centerPoints:c,topPoints:l};t===d?u(t,a(t)):(qs(c,l,h++,e[o(d)]),qs(c,l,h++,e[d]));for(let n=t;n<=r;++n)qs(c,l,h++,e[n]);return p===a(p)?u(r,o(r)):(qs(c,l,h++,e[p]),qs(c,l,h,e[a(p)])),{centerPoints:c,topPoints:l}}const Ks=class{constructor(e,t,r,n,s,i){const o=Zs(e,t,r,i);this._topInterp=Xs(o.topPoints,s),this._centerInterp=Xs(o.centerPoints,s),this._shift=.5/(r-t+2),this._valueStep=(1-2*this._shift)/(2*(r-t+1)*(n-1)),this._segmentsCount=n}prepareMatrices(e,t,n){const s=this._segmentsCount,i=new Array(s),o=new r.Vector2(0,0),a=this._topInterp,l=this._centerInterp;let c=this._shift+this._valueStep*(s-1)*e;for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],l=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const c=n.getResidueColor(e,t);a[o]=e._index,i.setItem(o,r,s,l),i.setColor(o++,c)})),this._chunksIdc=a,i.finalize()}updateToFrame(e){const{parent:t}=this._selection,r=this._mode,n=this._colorer,s=r.getTension(),i=this._geo,o=e.getResidues();let a=0;const l=e.needsColorUpdate(n);Js(this._selection.subdivs,o,this._segmentsHeight,s,r,((e,r)=>{i.setItem(a,r),l&&i.setColor(a,n.getResidueColor(e,t)),a++})),i.finalize()}};const ti=class extends Cs{_makeGeoArgs(){const e=this._selection.subdivs;let t=0;for(let r=0,n=e.length;r1&&0!==t&&(h.lerpVectors(_,g,si/b),u.lerpVectors(_,g,1-si/b)),t*=si,h.addScaledVector(w,t),u.addScaledVector(w,t),o.setItem(d,h,u),o.setColor(d++,i.getAtomColor(m,n),i.getAtomColor(f,n))}}o.finalize(),this._chunksIdc=p}updateToFrame(e){const t=this._selection.chunks,{bonds:n}=this._selection,s=this._mode,i=this._colorer,o=this._geo,a=s.drawMultiorderBonds(),l=s.showAromaticLoops(),c=new r.Vector3,h=new r.Vector3,u=new r.Vector3;let d=0;const p=e.needsColorUpdate(i);for(let r=0,s=t.length;r1&&0!==r&&(h.lerpVectors(_,g,si/b),u.lerpVectors(_,g,1-si/b)),r*=si,h.addScaledVector(w,r),u.addScaledVector(w,r),o.setItem(d,h,u),p&&o.setColor(d,e.getAtomColor(i,m),e.getAtomColor(i,f)),d++}}o.finalize()}}};const oi=class extends Kt{constructor(e,t,r,n,s,i,o,a){super();const l=this;this._complex=r,this._mode=s;const c=r.getAtoms(),h=r.getTransforms();r.forEachComponent((u=>{const d=[];let p=0;if(u.forEachAtom((e=>{l._checkAtom(e,o)&&(d[p++]=e.index)})),0===p)return;const m=new e(t,{atoms:c,chunks:d,parent:r},n,s,h,i,a);m._component=u,l.add(m)}))}_checkAtom(e,t){return e.mask&t}getSubset(e,t){const r=[],{children:n}=this;let s=0;for(let i=0,o=n.length;i{let d=0;const p=[];if(u.forEachResidue((e=>{l._checkResidue(e,o)&&(p[d++]=e._index)})),0===d)return;const m=new e(t,{residues:c,chunks:p,parent:r},n,s,h,i,a);m._component=u,l.add(m)}))}checkResidue(e,t){return e._mask&t}getSubset(e,t){const r=[],{children:n}=this;let s=0;for(let i=0,o=n.length;i{const d=u.getMaskedSubdivSequences(o);let p=0;const m=[];for(let e=0,t=d.length;e{const d=[];let p=0;if(u.forEachBond((e=>{const t=e._left,r=e._right;t.mask&o&&r.mask&o&&(d[p++]=e._index)})),0===p)return;const m=new e(t,{bonds:c,chunks:d,parent:r},n,s,h,i,a);m._component=u,l.add(m)}))}getSubset(e,t){const r=[],{children:n}=this;let s=0;for(let i=0,o=n.length;i{const d=[];let p=0;const m=[];let f=0;u.forEachCycle((e=>{const t=e.atoms;let r=0;for(let e=0,n=t.length;e0&&(m[f++]=e)}));const _=new e(t,{cycles:m,atoms:c,chunks:d,parent:r},n,s,h,i,a);_._component=u,l.add(_)}))}getSubset(e,t){const r=[],{children:n}=this;let s=0;for(let i=0,o=n.length;i0&&l.add(d)}return l}}ur(_i.prototype),_i.prototype.id="__",_i.prototype.depGroups=[];const gi=_i;function yi(){return{lineWidth:this.opts.lineWidth}}class xi extends gi{static id="LN";constructor(e){super(e),this.depGroups=this.depGroups.slice(0);const t=this.depGroups;for(let e=0,r=t.length;e1&&void 0!==arguments[1]&&arguments[1];const r=this.elementColors[e];return void 0!==r||t?r:this.defaultElementColor}getResidueColor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=this.residueColors[e];return void 0!==r||t?r:this.defaultResidueColor}getChainColor(e){let t=e.charCodeAt(0);return t=(31&(t<0?0:t>=256?t-256:t))%this.chainColors.length,this.chainColors[t]}getSecondaryColor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=this.secondaryColors[e];return void 0!==r||t?r:this.defaultSecondaryColor}getSequentialColor(e){const{colors:t}=this,r=t.length;return e<0?t[e%r+r]:t[e%r]}getGradientColor(e,t){const r=this.gradients[t];if(!r)return this.defaultNamedColor;const n=r.length,s=e*(n-1);let i=Math.floor(s);const o=qi(i+1,0,n-1);return i=qi(i,0,n-1),function(e,t,r){const n=1-r;return n*(e>>16&255)+r*(t>>16&255)<<16|n*(e>>8&255)+r*(t>>8&255)<<8|n*(255&e)+r*(255&t)}(r[i],r[o],s-i)}getNamedColor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=this.namedColors[e];return void 0!==r||t?r:this.defaultNamedColor}}t().assign(Zi.prototype,{colors:[16777215,16711680,65280,255,8421504],minRangeColor:0,midRangeColor:8355711,maxRangeColor:16777215,defaultElementColor:16777215,elementColors:{},defaultResidueColor:16777215,residueColors:{},chainColors:[16777215],defaultSecondaryColor:16777215,secondaryColors:{},defaultGradientColor:0,defaultNamedColor:16777215,namedColorsArray:[["indianred",13458524],["lightcoral",15761536],["salmon",16416882],["darksalmon",15308410],["lightsalmon",16752762],["crimson",14423100],["red",16711680],["firebrick",11674146],["darkred",9109504],["pink",16761035],["lightpink",16758465],["hotpink",16738740],["deeppink",16716947],["mediumvioletred",13047173],["palevioletred",14381203],["coral",16744272],["tomato",16737095],["orangered",16729344],["darkorange",16747520],["orange",16753920],["gold",16766720],["yellow",16776960],["lightyellow",16777184],["lemonchiffon",16775885],["lightgoldenrodyellow",16448210],["papayawhip",16773077],["moccasin",16770229],["peachpuff",16767673],["palegoldenrod",15657130],["khaki",15787660],["darkkhaki",12433259],["lavender",15132410],["thistle",14204888],["plum",14524637],["violet",15631086],["orchid",14315734],["fuchsia",16711935],["magenta",16711935],["mediumorchid",12211667],["mediumpurple",9662683],["rebeccapurple",6697881],["blueviolet",9055202],["darkviolet",9699539],["darkorchid",10040012],["darkmagenta",9109643],["purple",8388736],["indigo",4915330],["slateblue",6970061],["mediumslateblue",8087790],["darkslateblue",4734347],["greenyellow",11403055],["chartreuse",8388352],["lawngreen",8190976],["lime",65280],["limegreen",3329330],["palegreen",10025880],["lightgreen",9498256],["mediumspringgreen",64154],["springgreen",65407],["mediumseagreen",3978097],["seagreen",3050327],["forestgreen",2263842],["green",32768],["darkgreen",25600],["yellowgreen",10145074],["olivedrab",7048739],["olive",8421376],["darkolivegreen",5597999],["mediumaquamarine",6737322],["darkseagreen",9419919],["lightseagreen",2142890],["darkcyan",35723],["teal",32896],["aqua",65535],["cyan",65535],["lightcyan",14745599],["paleturquoise",11529966],["aquamarine",8388564],["turquoise",4251856],["mediumturquoise",4772300],["darkturquoise",52945],["cadetblue",6266528],["steelblue",4620980],["lightsteelblue",11584734],["powderblue",11591910],["lightblue",11393254],["skyblue",8900331],["lightskyblue",8900346],["deepskyblue",49151],["dodgerblue",2003199],["cornflowerblue",6591981],["royalblue",4286945],["blue",255],["mediumblue",205],["darkblue",139],["navy",128],["midnightblue",1644912],["cornsilk",16775388],["blanchedalmond",16772045],["bisque",16770244],["navajowhite",16768685],["wheat",16113331],["burlywood",14596231],["tan",13808780],["rosybrown",12357519],["sandybrown",16032864],["goldenrod",14329120],["darkgoldenrod",12092939],["peru",13468991],["chocolate",13789470],["saddlebrown",9127187],["sienna",10506797],["brown",10824234],["maroon",8388608],["white",16777215],["snow",16775930],["honeydew",15794160],["mintcream",16121850],["azure",15794175],["aliceblue",15792383],["ghostwhite",16316671],["whitesmoke",16119285],["seashell",16774638],["beige",16119260],["oldlace",16643558],["floralwhite",16775920],["ivory",16777200],["antiquewhite",16444375],["linen",16445670],["lavenderblush",16773365],["mistyrose",16770273],["gainsboro",14474460],["lightgray",13882323],["silver",12632256],["darkgray",11119017],["gray",8421504],["dimgray",6908265],["lightslategray",7833753],["slategray",7372944],["darkslategray",3100495],["black",0]],namedColors:{},gradients:{rainbow:[255,65535,65280,16776960,16711680],temp:[255,32767,16777215,16744192,16711680],hot:[16777215,16744192,16711680],cold:[16777215,32767,255],"blue-red":[255,16777215,16711680],reds:[16777215,16711680],blues:[16777215,255]}});const{namedColorsArray:Ki,namedColors:Qi}=Zi.prototype;for(let e=0,{length:t}=Ki;e=0?this.opts.carbon:this.palette.getElementColor(r)}getResidueColor(e,t){return this.palette.defaultResidueColor}}ho.prototype.id="EL",ho.prototype.name="Element",ho.prototype.shortName="Element";const uo=ho;class po extends co{static id="RT";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){return this.palette.getResidueColor(e._type._name)}}po.prototype.id="RT",po.prototype.name="Residue Type",po.prototype.shortName="Residue";const mo=po;class fo extends co{static id="SQ";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){const r=e._chain;if(r.minSequence===Number.POSITIVE_INFINITY&&r.maxSequence===Number.NEGATIVE_INFINITY)return this.palette.defaultNamedColor;const n=r.minSequence,s=r.maxSequence>n?r.maxSequence:n+1;return this.palette.getGradientColor((e._sequence-n)/(s-n),this.opts.gradient)}}fo.prototype.id="SQ",fo.prototype.name="Sequence",fo.prototype.shortName="Sequence";const _o=fo;class go extends co{static id="CH";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){return this.palette.getChainColor(e.getChain()._name)}}go.prototype.id="CH",go.prototype.name="Chain",go.prototype.shortName="Chain";const yo=go;class xo extends co{static id="SS";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){if(e._type.flags&Ee.Flags.DNA)return this.palette.getSecondaryColor("dna");if(e._type.flags&Ee.Flags.RNA)return this.palette.getSecondaryColor("rna");const r=e.getSecondary();if(r){let e=this.palette.getSecondaryColor(r.type,!0);return void 0===e&&(e=this.palette.getSecondaryColor(r.generic)),e}return this.palette.defaultSecondaryColor}}xo.prototype.id="SS",xo.prototype.name="Secondary Structure",xo.prototype.shortName="Structure";const bo=xo;class wo extends co{static id="UN";getAtomColor(e,t){return this.opts.color}getResidueColor(e,t){return this.opts.color}}wo.prototype.id="UN",wo.prototype.name="Uniform",wo.prototype.shortName="Uniform";const So=wo;class vo extends co{static id="CO";constructor(e){super(e);const t=at.parse(this.opts.subset);this._subsetCached=t.error?at.none():t.selector}getAtomColor(e,t){return this._subsetCached.includesAtom(e)?this.opts.color:this.opts.baseColor}getResidueColor(e,t){const r=this._subsetCached,n=e._atoms;for(let e=0,t=n.length;er.max?1:0:(e.temperature-r.min)/(r.max-r.min),this.palette.getGradientColor(n,r.gradient)):this.palette.defaultGradientColor}getResidueColor(e,t){const{opts:r}=this;if(!r)return this.palette.defaultGradientColor;if(e.temperature){let t=0;return t=r.min===r.max?e.temperature>r.max?1:0:(e.temperature-r.min)/(r.max-r.min),this.palette.getGradientColor(t,r.gradient)}return this.palette.defaultGradientColor}}To.prototype.id="TM",To.prototype.name="Temperature",To.prototype.shortName="Temperature";const Ro=To;class Mo extends co{static id="OC";_getColorByOccupancy(e,t){if(void 0!==e){const r=1-e;return this.palette.getGradientColor(r,t.gradient)}return this.palette.defaultGradientColor}getAtomColor(e,t){const{opts:r}=this;return this._getColorByOccupancy(e.occupancy,r)}getResidueColor(e,t){const{opts:r}=this;return this._getColorByOccupancy(e.occupancy,r)}}Mo.prototype.id="OC",Mo.prototype.name="Occupancy",Mo.prototype.shortName="Occupancy";const Po=Mo;class No extends co{static id="HY";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){let r=this.palette.defaultResidueColor;if(void 0!==e._type.hydrophobicity){const t=-4.5,n=4.5;r=this.palette.getGradientColor((e._type.hydrophobicity-t)/(n-t),this.opts.gradient)}return r}}No.prototype.id="HY",No.prototype.name="Hydrophobicity",No.prototype.shortName="Hydrophobicity";const Lo=No;class Io extends co{static id="MO";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){const r=e._molecule,n=t.getMoleculeCount();return n>1?this.palette.getGradientColor((r.index-1)/(n-1),this.opts.gradient):this.palette.getGradientColor(0,this.opts.gradient)}}Io.prototype.id="MO",Io.prototype.name="Molecule",Io.prototype.shortName="Molecule";const Oo=Io;class Vo extends co{static id="CB";getAtomColor(e,t){const r=this.opts.color,n=(s=r,(i=this.opts.factor)*(s>>16&255)<<16|i*(s>>8&255)<<8|i*(255&s));var s,i;return e.flags&he.Flags.CARBON?r:n}getResidueColor(e,t){return this.opts.color}}Vo.prototype.id="CB",Vo.prototype.name="Carbon",Vo.prototype.shortName="Carbon";const Do=new hr([uo,mo,_o,yo,bo,So,Co,Eo,Ro,Po,Lo,Oo,Vo]);function ko(e){return new r.Color(e,e,e)}const zo=[{id:"DF",name:"Diffuse",shortName:"Diffuse",uberOptions:{diffuse:ko(1),specular:ko(0),shininess:1,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"SF",name:"Soft Plastic",shortName:"Soft",uberOptions:{diffuse:ko(1),specular:ko(.1),shininess:30,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"PL",name:"Glossy Plastic",shortName:"Glossy",uberOptions:{diffuse:ko(.56),specular:ko(.28),shininess:100,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"ME",name:"Metal",shortName:"Metal",uberOptions:{diffuse:ko(.56),specular:ko(.55),shininess:30,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"TR",name:"Transparent",shortName:"Transparent",uberOptions:{diffuse:ko(1),specular:ko(0),shininess:1,opacity:.5},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!0,toonShading:!1}},{id:"GL",name:"Glass",shortName:"Glass",uberOptions:{diffuse:ko(.5),specular:ko(.65),shininess:100,opacity:.5},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!0,toonShading:!1}},{id:"BA",name:"Backdrop",shortName:"Backdrop",uberOptions:{diffuse:ko(1),specular:ko(0),shininess:1,opacity:1},values:{lights:!1,fog:!1,depthWrite:!1,transparent:!1,toonShading:!1}},{id:"TN",name:"Toon",shortName:"Toon",uberOptions:{diffuse:ko(1),specular:ko(0),shininess:1,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!0}},{id:"FL",name:"Flat",shortName:"Flat",uberOptions:{diffuse:ko(1),specular:ko(0),shininess:0,opacity:1},values:{lights:!1,fog:!0,depthWrite:!0,transparent:!1}}],Fo=new hr(zo);function Bo(e,t,r){const n=e.material.createInstance();n.setValues(t);const s=new e.constructor(e.geometry,n);return s.material.needsUpdate=!0,s.applyMatrix4(e.matrix),s.layers.set(r),s}function Uo(e,t,r){const n=function(e,t){const r=[];return e.traverse((e=>{for(let n=0;n{e.applyMatrix4(t[0]);for(let r=1;r{t.material.setValues({prepassTransparancy:!1,fakeOpacity:!1}),t.material.needsUpdate=!0,t.layers.set(sr.LAYERS.TRANSPARENT);const r=Bo(t,e,sr.LAYERS.PREPASS_TRANSPARENT);t.parent.add(r)}))}}(),processColFromPosMaterial:function(){const e={colorFromPos:!0,transparent:!1,colorFromDepth:!1,lights:!1,shadowmap:!1,fog:!1,overrideColor:!1,fogTransparent:!1,attrColor:!1,attrColor2:!1,attrAlphaColor:!1,fakeOpacity:!1};return function(t,n){n instanceof Jn&&Uo(t,[r.Mesh,r.LineSegments],(t=>{const r=Bo(t,e,sr.LAYERS.COLOR_FROM_POSITION);t.parent.add(r)}))}}(),createShadowmapMaterial:function(){const e={colorFromDepth:!0,orthoCam:!0,lights:!1,shadowmap:!1,fog:!1};return function(t,n){n instanceof Jn&&Uo(t,[r.Mesh,r.LineSegments],(t=>{if(!t.receiveShadow&&t.material.shadowmap&&t.material.setValues({shadowmap:!1}),!t.material.lights)return;if(!t.castShadow)return;if(!sr.belongToSelectLayers(t))return;const r=Bo(t,e,sr.LAYERS.SHADOWMAP);r.isShadowmapMesh=!0,t.parent.add(r)}))}}(),removeShadowmapMaterial:function(e,t){t instanceof Jn&&Uo(e,[r.Mesh,r.LineSegments],(e=>{e.isShadowmapMesh&&e.parent.remove(e)}))},forEachMeshInGroup:Go,countTriangles:function(e){let t=0;return Go(e,(e=>{t+=function(e){const t=e.geometry;if(t instanceof r.InstancedBufferGeometry){const e=t.attributes;for(const n in e)if(e.hasOwnProperty(n)&&e[n]instanceof r.InstancedBufferAttribute){const r=e[n];return(t.index?t.index.array.length/3:0)*r.array.length/r.itemSize}return 0}return t instanceof r.BufferGeometry?t.index?t.index.array.length/3:0:t.faces?t.faces.length:0}(e)})),t}},{selectors:Ho}=Yt;const $o=class{constructor(e,t,r,n){const s={clipPlane:z.now.draft.clipPlane,fogTransparent:z.now.bg.transparent,shadowmap:z.now.shadow.on,shadowmapType:z.now.shadow.type};this.index=e,this.mode=t,this.colorer=r,this.selector=n,this.selectorString="",this.count=0,this.material=new Jn,this.material.setValues(s),this.material.setUberOptions({fogAlpha:z.now.fogAlpha}),this.materialPreset=Fo.first,this.needsRebuild=!0,this.visible=!0,this.setMode(t)}markAtoms(e){return this.count=e.markAtoms(this.selector,1<0){t=new r.Group,t.matrixAutoUpdate=!1,t.matrix=this.geo.matrix;for(let e=0;e{e.objects.push(t)})),o=0;o{const t=e._atoms;for(a=0;a{const r=e._atoms;for(let e=0;e2)return w.error("Can only edit fragments with one or two bound atoms."),!1;this._fragmentBoundAtoms=n;const s=1<{e._left.mask&t?0==(e._right.mask&t)&&(r[e._left.index]=1):e._right.mask&t&&(r[e._right.index]=1)}));const n=[],s=Object.keys(r);for(let t=0,r=s.length;t{r.mask&t&&r.position.applyMatrix4(e)}))}}},{selectors:qo}=Yt;function Zo(e,t){Array.isArray(t)||(t=[t]);const[r,n]=t;return new(e.get(r)||e.first)(n)}class Ko extends ar{constructor(e,t){super(e,t),this._complex=t,this._reprList=[],this._repr=null,this._reprListChanged=!0,this._selectionBit=0,this._reprUsedBits=0,this._selectionCount=0,this._selectionGeometry=new r.Group}getBoundaries(){return this._complex.getBoundaries()}release(){this._selectionGeometry.parent&&this._selectionGeometry.remove(this._selectionGeometry),ar.prototype.release.call(this)}getComplex(){return this._complex}getSelectionCount(){return this._selectionCount}getSelectionGeo(){return this._selectionGeometry}getSelectionBit(){return this._selectionBit}getEditor(){return this._editor}resetReps(e){this._complex&&this._complex.clearAtomBits(-1),this._reprListChanged=!0,this._reprUsedBits=0,this._reprList.length=e.length;for(let t=0,r=e.length;t0?this._reprList[0]:null,this._selectionBit=e.length,this._reprUsedBits|=1<=0&&ethis._reprList.length)return w.error(`Rep ${e} does not exist!`),null;if(e===this._reprList.length){const t=this.repAdd(r);return w.warn(`Rep ${e} does not exist! New representation was created.`),{desc:t.desc,index:e,status:"created"}}const n=this._reprList[e],s={selector:n.selectorString,mode:n.mode.identify(),colorer:n.colorer.identify(),material:n.materialPreset.id};if(r){const i=n.change(r,this._complex,Zo(Xi,r.mode),Zo(Do,r.colorer));if(!t().isEmpty(i)){n.needsRebuild=!0;for(const t in i)i.hasOwnProperty(t)&&(s[t]=i[t],w.debug(`rep[${e}].${t} changed to ${i[t]}`));return i.mode&&n.mode.isSurface&&("ultra"===z.now.resolution||"high"===z.now.resolution)&&(w.report('Surface resolution was changed to "medium" to avoid hang-ups.'),z.set("resolution","medium")),{desc:s,index:e,status:"changed"}}}return{desc:s,index:e,status:""}}repGet(e){return(void 0===e||e instanceof Object)&&(e=this.repCurrent()),e<0||e>=this._reprList.length?null:this._reprList[e]}_getFreeReprIdx(){let e=this._reprUsedBits;for(let t=0;t<=Ko.NUM_REPRESENTATION_BITS;++t,e>>=1)if(0==(1&e))return t;return-1}repAdd(e){if(this._reprList.length>=Ko.NUM_REPRESENTATION_BITS)return null;const r=this._getFreeReprIdx();if(r<0)return null;const n=this.buildSelectorFromMask(1<=t||t<=1)return;const r=this._reprList[e];r.unmarkAtoms(this._complex),this._reprUsedBits&=~(1<=this._reprList.length)return;this._reprList[e].show(!t)}select(e,t){t?this._selectionCount+=this._complex.markAtomsAdditionally(e,1<{e.mask&o&&(e.mask&=a,t._selectionCount--)}))):(n._mask|=o,n.forEachAtom((e=>{e.mask&o||(e.mask|=o,t._selectionCount++)})),s.collectMask(),i&&i.collectMask());else if(s||i){const e=s||i;e._mask&o?(e._mask&=a,e.forEachResidue((e=>{e._mask&o&&(e._mask&=a,e.forEachAtom((e=>{e.mask&o&&(e.mask&=a,t._selectionCount--)})),e._mask&=a)}))):(e._mask|=o,e.forEachResidue((e=>{if(!(e._mask&o)){e._mask|=o,e.forEachAtom((e=>{e.mask&o||(e.mask|=o,t._selectionCount++)}));const r=s?e.getMolecule():e.getChain();r&&r.collectMask()}})))}else this.resetSelectionMask()}expandSelection(){const e=this,t=1<{e._left.mask&t?0==(e._right.mask&t)&&(e._right.mask|=r):e._right.mask&t&&(e._left.mask|=r)}));this._complex.forEachAtom((n=>{n.mask&r&&(n.mask=2147483647&n.mask|t,++e._selectionCount)})),this._complex.updateStructuresMask()}shrinkSelection(){const e=this,t=1<{e._left.mask&t?0==(e._right.mask&t)&&(e._left.mask|=r):e._right.mask&t&&(e._right.mask|=r)})),this._complex.forEachAtom((e=>{e.mask&t&&1===e.bonds.length&&(e.mask|=r)}));const n=~(t|r);this._complex.forEachAtom((t=>{t.mask&r&&(t.mask&=n,--e._selectionCount)})),this._complex.updateStructuresMask()}getSelectedComponent(){const e=1<{n.mask&e&&(null===t?t=n.residue._component:t!==n.residue._component&&(r=!0))})),r?null:t}getSelectionCenter(e,t,r){e.set(0,0,0);let n=0;return this._complex.forEachAtom((s=>{t(s,r)&&(e.add(s.position),n++)})),0!==n&&(e.divideScalar(n),e.applyMatrix4(this.matrix),!0)}needsRebuild(){if(this._reprListChanged)return!0;const e=this._reprList;for(let t=0,r=e.length;t{const r=e._complex;if(!r)return void t();let n=!1;setTimeout((()=>{const s=e._reprList,i=ao.get(z.now.palette)||ao.first;let o=!1;for(let t=0,a=s.length;t0&&(n=qo.chain(r),i=i?qo.or(i,n):n),Object.keys(t).length>0)for(const e in t)t.hasOwnProperty(e)&&(n=qo.and(qo.chain(e),qo.residx(s(t[e]))),i=i?qo.or(i,n):n);e.length>0&&(n=qo.serial(s(e)),i=i?qo.or(i,n):n),i||(i=qo.none())}return i}buildSelectorFromMask(e){const t=this._complex,r=[],n={},s=[];return t.forEachChain((t=>{t._mask&e&&r.push(t._name)})),t.forEachResidue((t=>{if(t._mask&e&&!(t._chain._mask&e)){const e=t._chain._name;e in n?n[e].push(t._index):n[e]=[t._index]}})),t.forEachAtom((t=>{t.mask&e&&!(t.residue._mask&e)&&s.push(t.serial)})),this._buildSelectorFromSortedLists(s,n,r)}forSelectedResidues(e){const t=1<{r._mask&t&&e(r)}))}beginComponentEdit(){if(this._editor)return null;const e=new Xo.ComponentEditor(this);return e.begin()?(this._editor=e,e):null}beginFragmentEdit(){if(this._editor)return null;const e=new Xo.FragmentEditor(this);return e.begin()?(this._editor=e,e):null}finalizeEdit(){this._editor=null}setMaterialValues(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(let s=0,i=this._reprList.length;s{t instanceof r.Mesh&&(t.material.setValues(e),void 0!==n&&n(t),t.material.needsUpdate=!0)}))}}setUberOptions(e){for(let t=0,r=this._reprList.length;t{e.mask|=n})),this._selectionCount=this._complex.countAtomsByMask(n),this._complex.updateStructuresMask(),this.buildSelectorFromMask(n)}}Ko.NUM_REPRESENTATION_BITS=30;const Qo=Ko,Jo=r.UniformsUtils.merge([{volumeDim:{type:"v3",value:new r.Vector3(512,512,512)},tileTex:{type:"t",value:null},tileTexSize:{type:"v2",value:new r.Vector2(512,512)},tileStride:{type:"v2",value:new r.Vector2(512,512)},boxAngles:{type:"v3",value:new r.Vector3(1,1,1)},delta:{type:"v3",value:new r.Vector3(0,0,0)},_isoLevel0:{type:"v2",value:new r.Vector3(.5,.75,1)},_flipV:{type:"f",value:0},_BFLeft:{type:"t",value:null},_BFRight:{type:"t",value:null},_FFLeft:{type:"t",value:null},_FFRight:{type:"t",value:null},_WFFLeft:{type:"t",value:null},_WFFRight:{type:"t",value:null}}]);function ea(e,t){const n=r.UniformsUtils.clone(t);for(const t in e)n.hasOwnProperty(t)&&(n[t].value=e[t]);return n}function ta(e,t){return{uniforms:ea(e,{}),vertexShader:"varying vec3 pos;\r\n\r\nvoid main() {\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n pos = position.xyz + 0.5;\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n}",fragmentShader:"varying vec3 pos;\r\n\r\nvoid main() {\r\n gl_FragColor = vec4(pos, 0.5);\r\n}",transparent:!1,depthTest:!1,depthWrite:!1,side:t}}class ra extends r.ShaderMaterial{constructor(e){super(ta(e,r.BackSide))}}class na{constructor(e,t,n,s){this.uniforms=ea(e,t),this.vertexShader=n,this.fragmentShader=s,this.transparent=!1,this.depthTest=!1,this.depthWrite=!1,this.side=r.FrontSide}}class sa extends r.ShaderMaterial{constructor(e){const t=r.UniformsUtils.merge([{aspectRatio:{type:"f",value:0},farZ:{type:"f",value:0},tanHalfFOV:{type:"f",value:0},matWorld2Volume:{type:"4fv",value:new r.Matrix4}}]);super(new na(e,t,"varying vec4 volPos;\r\nuniform float aspectRatio;\r\nuniform float farZ;\r\nuniform float tanHalfFOV;\r\nuniform mat4 matWorld2Volume;\r\n\r\nvoid main() {\r\n // rescale plane to fill in the whole far plane area seen from camera\r\n vec3 pos = position.xyz;\r\n pos.x = pos.x * tanHalfFOV * farZ * aspectRatio;\r\n pos.y = pos.y * tanHalfFOV * farZ;\r\n // common transformation\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\r\n // calc pos in volume CS\r\n volPos = matWorld2Volume * modelMatrix * vec4(pos, 1.0);\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n volPos = volPos + 0.5;\r\n volPos.w = 0.5;\r\n}\r\n","varying vec4 volPos;\r\n\r\nvoid main() {\r\n gl_FragColor = volPos;\r\n}"))}}class ia extends r.ShaderMaterial{constructor(e){super(ta(e,r.FrontSide))}}class oa extends r.ShaderMaterial{constructor(e){const t=new na(e,Jo,"varying vec4 screenSpacePos;\r\n\r\nvoid main() {\r\n screenSpacePos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n gl_Position = screenSpacePos;\r\n}","uniform mat4 projectionMatrix;\r\n\r\n// 3D volume texture\r\nuniform vec3 volumeDim; // volume dimensions, pixels\r\nuniform sampler2D tileTex; // tiled texture containing all Z-slices of a 3D data\r\nuniform vec2 tileTexSize; // size of tiled texture, pixels\r\nuniform vec2 tileStride; // UV stride between slices in tile tex, pixels\r\n\r\nuniform vec3 boxAngles;//value of angles({x: alpha, y:beta, z:gamma}) types 1 - if angle is obtuse, 0 - if acute\r\nuniform vec3 delta; //Projection box delta's from non-orthogonal origin axes; {x: XY, y : XZ, z: YZ}\r\n\r\nuniform vec3 _isoLevel0;\r\nuniform float _flipV;\r\nuniform sampler2D _BFLeft;\r\nuniform sampler2D _BFRight;\r\nuniform sampler2D _FFLeft;\r\nuniform sampler2D _FFRight;\r\nuniform sampler2D _WFFLeft;\r\nuniform sampler2D _WFFRight;\r\n\r\nvarying vec4 screenSpacePos;\r\n\r\n#define NO_COLOR vec4(0., 0., 0., 0.)\r\n\r\nvec4 sample3DTexture(vec3 texCoord) {\r\n // a pair of Z slices is determined by nearest slice border\r\n float zSliceBorder = floor(texCoord.z * volumeDim.z + 0.5);\r\n float zSliceNumber1 = max(zSliceBorder - 1.0, 0.0);\r\n float zSliceNumber2 = min(zSliceBorder, volumeDim.z - 1.0);\r\n\r\n float rowTiles = floor(tileTexSize.x / tileStride.x);\r\n\r\n // calculate coords in tile texture for both slices\r\n vec2 tileOffset = vec2(mod(zSliceNumber1, rowTiles), floor(zSliceNumber1 / rowTiles));\r\n vec2 texCoordSlice1 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n tileOffset = vec2(mod(zSliceNumber2, rowTiles), floor(zSliceNumber2 / rowTiles));\r\n vec2 texCoordSlice2 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n\r\n // bilinear filtering\r\n vec4 colorSlice1 = texture2D(tileTex, texCoordSlice1);\r\n vec4 colorSlice2 = texture2D(tileTex, texCoordSlice2);\r\n float weightSlice2 = texCoord.z * volumeDim.z - (zSliceNumber1 + 0.5);\r\n return mix(colorSlice1, colorSlice2, weightSlice2);\r\n}\r\n\r\nvec4 sample3DTextureInclined(vec3 boxCoord) { // delta:{ x: XY, y : XZ, z: YZ }\r\n vec3 textCoord = boxCoord;\r\n vec2 currDelta = mix(boxCoord.zz, vec2(1., 1.) - boxCoord.zz, boxAngles.yx) * delta.yz;\r\n\r\n textCoord.y = (boxCoord.y - currDelta.y) / (1. - delta.z);\r\n if (textCoord.y < 0.0 || textCoord.y > 1.0)\r\n return NO_COLOR;\r\n\r\n currDelta.x += mix(textCoord.y, 1.0 - textCoord.y, boxAngles.z) * delta.x;\r\n\r\n textCoord.x = (boxCoord.x - currDelta.x) / (1. - delta.x - delta.y);\r\n if (textCoord.x < 0.0 || textCoord.x > 1.0)\r\n return NO_COLOR;\r\n\r\n return sample3DTexture(textCoord);\r\n}\r\n\r\nfloat CalcColor(vec3 iter, vec3 dir) {\r\n float d = 1. / 128.;\r\n vec3 dx = vec3(d, 0.0, 0.0);\r\n vec3 dy = vec3(0.0, d, 0.0);\r\n vec3 dz = vec3(0.0, 0.0, d);\r\n\r\n // #Opt: coordInc.x:(iter + dx).x > 1. ? 0.: sample3DTextureInclined(iter + dx).x,\r\n vec3 coordInc = mix(\r\n vec3(\r\n sample3DTextureInclined(iter + dx).x,\r\n sample3DTextureInclined(iter + dy).x,\r\n sample3DTextureInclined(iter + dz).x\r\n ),\r\n vec3(0. ,0. , 0.),\r\n vec3(floor((iter + dx).x), floor((iter + dy).y), floor((iter + dz).z))\r\n );\r\n\r\n // #Opt: coordDec.x:(iter - dx).x < 0. ? 0.: sample3DTextureInclined(iter - dx).x,\r\n vec3 coordDec = mix(\r\n vec3(0. ,0. , 0.),\r\n vec3(\r\n sample3DTextureInclined(iter - dx).x,\r\n sample3DTextureInclined(iter - dy).x,\r\n sample3DTextureInclined(iter - dz).x\r\n ),\r\n vec3(ceil((iter - dx).x), ceil((iter - dy).y), ceil((iter - dz).z))\r\n );\r\n\r\n vec3 N = normalize(coordInc - coordDec);\r\n float dif = max(0.0, dot(N, dir));\r\n return dif;\r\n}\r\n\r\nvec3 AccuracyIso(vec3 left, vec3 right, float volLeft, float threshold) {\r\n for (int i = 0; i < 5; i++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if ((volLeft - threshold) * (vol - threshold) < 0.)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec3 CorrectIso(vec3 left, vec3 right, float tr) {\r\n for (int j = 0; j < 5; j++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if (vol < tr)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec4 GetIso1(vec3 start, vec3 back, float molDist, vec3 dir, float tr, int count) {\r\n float vol, stepSize = (float(count) + 2.) / float(STEPS_COUNT);\r\n vec3 step = stepSize * dir, iterator = start, left, right;\r\n vec4 acc = NO_COLOR;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n vol = sample3DTextureInclined(iterator).r;\r\n if (length(iterator - back) <= stepSize || (vol > tr))\r\n break;\r\n }\r\n\r\n if (vol > tr)\r\n acc = vec4(CorrectIso(iterator, iterator - step, tr).xyz, 1.);\r\n\r\n return acc;\r\n}\r\n\r\nfloat easeOut(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return 1.0 - (1.0 - t) * (1.0 - t);\r\n}\r\n\r\nfloat easeIn(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return t * t;\r\n}\r\n\r\nvec3 GetColSimple(float vol) {\r\n float t = easeOut(_isoLevel0.x, _isoLevel0.y, vol);\r\n float s = easeIn(_isoLevel0.y, _isoLevel0.z, vol);\r\n return vec3(0.5, 0.6, 0.7) * (1.0 - t) + 2.0 * vec3(s, 0, 0);\r\n}\r\n\r\nvec4 VolRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 acc = NO_COLOR, iso;\r\n vec3 iterator = start, sumColor = vec3(0., 0., 0.);\r\n float stepSize, alpha, sumAlpha = 0.0, vol, curStepSize, molD;\r\n vec3 step, col, colOld, right;\r\n float tr0 = _isoLevel0.x;\r\n float dif, r, kd, finish;\r\n int count = 0, stopMol = 0;\r\n\r\n for (int k = 0; k < 3; k++) {\r\n stepSize = (float(k) + 2.) / float(STEPS_COUNT);\r\n kd = 140. * tr0 * stepSize;\r\n r = 1. - kd;\r\n step = stepSize * dir;\r\n iso = GetIso1(iterator, back, molDist, dir, tr0, k);\r\n if (iso.a < 0.1 || length(iso.xyz - start) > molDist)\r\n break;\r\n iterator = iso.xyz;\r\n dif = 1.;// CalcColor(iterator, dir);\r\n colOld = GetColSimple(tr0);\r\n curStepSize = stepSize;\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n molD = length(iterator - start);\r\n vol = sample3DTextureInclined(iterator).r;\r\n finish = distance(iterator, back) - stepSize;\r\n if (finish < 0.0 || vol < tr0 || (sumAlpha > 0.97) || molD > molDist)\r\n break;\r\n alpha = (1. - r);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4.* colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n colOld = col;\r\n } // for i\r\n\r\n if (finish < 0.0 || sumAlpha > 0.97)\r\n break;\r\n\r\n if (molD > molDist) {\r\n curStepSize = stepSize - (molD - molDist);\r\n right = iterator - (molD - molDist) * dir;\r\n vol = sample3DTextureInclined(right).r;\r\n } else {\r\n vec3 left = iterator - step;\r\n right = CorrectIso(left, iterator, tr0);\r\n curStepSize = distance(left, right);\r\n vol = tr0;\r\n }\r\n\r\n alpha = (1. - r) * curStepSize / stepSize;\r\n dif = 1.;// CalcColor(right, dir);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * curStepSize / stepSize * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4. * colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n\r\n if (molD > molDist)\r\n break;\r\n } // for k\r\n acc.rgb = 1. * sumColor / sumAlpha;\r\n acc.a = sumAlpha;\r\n return acc;\r\n}\r\n\r\nvec4 VolRender1(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n float stepSize = 1.0 / float(STEPS_COUNT);\r\n float len = length(back - start);\r\n vec3 step = stepSize * dir;\r\n vec3 iterator = start;\r\n float acc = 0.0;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n if (float(i) * stepSize > len)\r\n break;\r\n iterator = iterator + step;\r\n if (sample3DTextureInclined(iterator).r > _isoLevel0.x)\r\n acc += 10. * sample3DTextureInclined(iterator).r / float(STEPS_COUNT);\r\n }\r\n\r\n return vec4(1.,1.,1., acc);\r\n}\r\n\r\nvec4 IsoRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 tst = GetIso1(start, back, 2., dir, _isoLevel0.x, 0);\r\n vec4 col = NO_COLOR;\r\n\r\n if (length(tst.xyz - start) < molDist && tst.a > 0.1) {\r\n float dif = CalcColor(tst.xyz, dir);\r\n dif = 0.9 * dif * dif;\r\n col = vec4(dif, dif, dif, 1);\r\n }\r\n return col;\r\n}\r\n\r\nvec4 VolRender2(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n return sample3DTexture(start);\r\n}\r\n\r\nvoid main() {\r\n vec3 tc = screenSpacePos.xyz / screenSpacePos.w * 0.5 + 0.5;\r\n\r\n if (_flipV > 0.0) {\r\n tc.y = 1.0 - tc.y;\r\n }\r\n\r\n vec3 start;\r\n vec3 back;\r\n vec3 molBack;\r\n if (projectionMatrix[0][2] < 0.0) {\r\n start = texture2D(_FFLeft, tc.xy).xyz;\r\n back = texture2D(_BFLeft, tc.xy).xyz;\r\n molBack = texture2D(_WFFLeft, tc.xy).xyz;\r\n } else {\r\n start = texture2D(_FFRight, tc.xy).xyz;\r\n back = texture2D(_BFRight, tc.xy).xyz;\r\n molBack = texture2D(_WFFRight, tc.xy).xyz;\r\n }\r\n\r\n vec3 dir = normalize(back - start);\r\n\r\n float molDist = 2.0;\r\n if (length(molBack) > 0.001) {\r\n molDist = distance(start, molBack);\r\n }\r\n\r\n #ifdef ISO_MODE\r\n gl_FragColor = IsoRender(start, back, molDist, dir);\r\n #else\r\n gl_FragColor = VolRender(start, back, molDist, dir);\r\n #endif\r\n}\r\n");t.transparent=!0,t.depthTest=!0,super(t),this.updateDefines()}updateDefines(){this.defines={ISO_MODE:z.now.modes.VD.isoMode,STEPS_COUNT:100*z.now.modes.VD.polyComplexity[z.now.resolution]},this.needsUpdate=!0}}const aa={BackFacePosMaterial:ra,BackFacePosMaterialFarPlane:sa,FrontFacePosMaterial:ia,VolumeMaterial:oa};class la extends r.Mesh{volumeInfo={};constructor(){const e=new r.BufferGeometry;super(e),this.clipPlane=new r.Plane;const t=new r.Vector3(.5,.5,.5);this.size=t,this.cullFlag=[!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1,!1],this.faces=[{indices:[],norm:new r.Vector3(0,0,-1)},{indices:[],norm:new r.Vector3(0,0,1)},{indices:[],norm:new r.Vector3(0,-1,0)},{indices:[],norm:new r.Vector3(0,1,0)},{indices:[],norm:new r.Vector3(-1,0,0)},{indices:[],norm:new r.Vector3(1,0,0)},{indices:[],norm:new r.Vector3(0,0,0)}],this.vertices=[new r.Vector3(-t.x,-t.y,-t.z),new r.Vector3(-t.x,t.y,-t.z),new r.Vector3(t.x,-t.y,-t.z),new r.Vector3(t.x,t.y,-t.z),new r.Vector3(-t.x,-t.y,t.z),new r.Vector3(-t.x,t.y,t.z),new r.Vector3(t.x,-t.y,t.z),new r.Vector3(t.x,t.y,t.z),new r.Vector3(0,0,0),new r.Vector3(0,0,0),new r.Vector3(0,0,0),new r.Vector3(0,0,0),new r.Vector3(0,0,0),new r.Vector3(0,0,0)],e.setAttribute("position",new r.BufferAttribute(new Float32Array(3*this.vertices.length),3)),this.name="VolumeMesh"}static _corners=[[-1,-1,-1,0,4,8],[1,-1,-1,0,5,9],[1,1,-1,1,5,10],[-1,1,-1,1,4,11],[-1,-1,1,2,6,8],[1,-1,1,2,7,9],[1,1,1,3,7,10],[-1,1,1,3,6,11]];static _edges=[[0,1,0,-1,-1],[2,3,0,1,-1],[4,5,0,-1,1],[6,7,0,1,1],[0,3,-1,0,-1],[1,2,1,0,-1],[4,7,-1,0,1],[5,6,1,0,1],[0,4,-1,-1,0],[1,5,1,-1,0],[2,6,-1,1,0],[3,7,1,1,0]];static _edgeIntersections=function(){const e=[];for(let t=0;t<12;++t)e.push(new r.Vector3);return e}();_updateVertices(){const e=la._corners,t=la._edges,n=la._edgeIntersections;let s;const i=this.clipPlane.normal,o=this.clipPlane.constant,a=this.vertices,{size:l}=this,c=[0,0,0,0,0,0,0,0],h=[1,1,1,1,1,1,1,1,1,1,1,1],u=new r.Vector3;let d=null;function p(){if(0===i.x)return 0;const e=-(i.dot(u)+o)/i.x;return-l.x<=e&&e<=l.x?(d.set(e,u.y,u.z),e===l.x?2:e===-l.x?-2:1):0}function m(){if(0===i.y)return 0;const e=-(i.dot(u)+o)/i.y;return-l.y<=e&&e<=l.y?(d.set(u.x,e,u.z),e===l.y?2:e===-l.y?-2:1):0}function f(){if(0===i.z)return 0;const e=-(i.dot(u)+o)/i.z;return-l.z<=e&&e<=l.z?(d.set(u.x,u.y,e),e===l.z?2:e===-l.z?-2:1):0}for(let e=0;e<12;++e){const r=t[e];d=n[e],u.set(r[2],r[3],r[4]),u.multiply(l);let s=0;0===r[2]&&(s=p()),0===r[3]&&(s=m()),0===r[4]&&(s=f()),-2===s?c[r[0]]=1:2===s?c[r[1]]=1:0===s&&(h[e]=0)}const _={indices:[],norm:i.clone().negate()};let g=8;for(s=0;s<8;++s)1===c[s]&&(a[g].set(e[s][0],e[s][1],e[s][2]).multiply(l),_.indices.push(g++),h[e[s][3]]=0,h[e[s][4]]=0,h[e[s][5]]=0);for(s=0;s<12;++s)1===h[s]&&(a[g].copy(n[s]),_.indices.push(g++));this.faces[6]=_;const y=new r.Vector3,x=new r.Vector3;for(this.clipPlane.coplanarPoint(x),s=0;s=0):s<8+_.indices.length&&(this.cullFlag[s]=!0);const b=this.geometry.getAttribute("position");let w=0;for(s=0;se.z===-i.z)),this._collectVertices(this.faces[1],(e=>e.z===i.z)),this._collectVertices(this.faces[2],(e=>e.y===-i.y)),this._collectVertices(this.faces[3],(e=>e.y===i.y)),this._collectVertices(this.faces[4],(e=>e.x===-i.x)),this._collectVertices(this.faces[5],(e=>e.x===i.x));const o=new r.Vector3,a=new r.Vector3,l=new r.Vector3;for(t=0;t=3&&(c+=3*(n.indices.length-2));let h=0;const u=new Uint16Array(c);for(t=0;t(s+e*n.sd)/i;this.material.uniforms._isoLevel0.value.set(o(e),o(t),o(r))}static _nearClipPlaneOffset=.2;static _pos=(()=>new r.Vector3)();static _norm=(()=>new r.Vector3)();static _norm4D=(()=>new r.Vector4)();static _matrixWorldToLocal=(()=>new r.Matrix4)();static _clipPlane=(()=>new r.Plane)();rebuild(e){const t=la._nearClipPlaneOffset,r=la._pos,n=la._norm,s=la._norm4D,i=la._matrixWorldToLocal,o=la._clipPlane;this._updateIsoLevel(),e.getWorldDirection(n),e.getWorldPosition(r),r.addScaledVector(n,e.near+t),i.copy(this.matrixWorld).invert(),r.applyMatrix4(i),s.set(n.x,n.y,n.z,0),s.applyMatrix4(i),n.copy(s),n.normalize(),o.setFromNormalAndCoplanarPoint(n,r),this.clipPlane.equals(o)||(this.clipPlane=o.clone(),this._updateVertices(),this._updateIndices())}}const ca=la;class ha{static _projectionTable={XY:["x",2],XZ:["y",1],YZ:["z",0]};constructor(e,t){const{delta:n}=t,{obtuseAngle:s}=t,i=new r.Vector3;e.getSize(i),i.multiplyScalar(.5);const o=this._getBaseVertices(n,s),a=new r.BufferGeometry,l=[];for(let e=0;e<4;e++)l.push(o[e].clone().multiply(i)),l.push(o[(e+1)%4].clone().multiply(i));const c=new r.Vector3(2*i.x*(1-n.x-n.y),0,0);for(let e=0;e<8;e++)l.push(l[e].clone().add(c));for(let e=0;e<4;e++)l.push(l[2*e].clone()),l.push(l[2*e+8].clone());const h=new r.Vector3;e.getCenter(h),l.forEach((e=>e.add(h)));const u=function(e){const t=e.length,r=new Float32Array(3*t);for(let n=0;n{const i=e[n[r][0]];return(-.5*(s-1)+s*t[n[r][1]])*i};return[new r.Vector3(2*(s("XZ",1)+s("XY",1))-1,2*s("YZ",1)-1,-1),new r.Vector3(2*(s("XZ",-1)+s("XY",1))-1,2*s("YZ",-1)-1,1),new r.Vector3(2*(s("XZ",-1)+s("XY",-1))-1,1-2*s("YZ",1),1),new r.Vector3(2*(s("XZ",1)+s("XY",-1))-1,1-2*s("YZ",-1),-1)]}getMesh(){return this._lines}}const ua=ha;const da=class{constructor(e,t,n){const s=this._initPlaneGeo(t,n),i=new aa.BackFacePosMaterialFarPlane;this._plane=new fs.Mesh(s,i),this._plane.frustumCulled=!1,this._plane.doubleSided=!0;const o=new r.Matrix4;this._plane._onBeforeRender=function(t,n,s,i,a,l){const{material:c}=this;if(!e||!c)return;const h=new r.Vector4(0,0,-(s.far-.1),1);h.applyMatrix4(s.matrixWorld),this.matrix.identity(),this.matrix.makeTranslation(h.x,h.y,h.z),this.matrixWorld.copy(this.matrix),this.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,this.matrixWorld),this.normalMatrix.getNormalMatrix(this.modelViewMatrix);const u=e.matrixWorld;o.copy(u).invert(),c.uniforms.aspectRatio.value=s.aspect,c.uniforms.farZ.value=s.far,c.uniforms.tanHalfFOV.value=Math.tan(.5*r.MathUtils.DEG2RAD*s.fov),c.uniforms.matWorld2Volume.value=o},this._plane.layers.set(sr.LAYERS.VOLUME_BFPLANE)}_initPlaneGeo(e,t){const n=new r.BufferGeometry;e=e||1,t=t||1;const s=new Float32Array([-.5*e,.5*t,0,.5*e,.5*t,0,-.5*e,-.5*t,0,.5*e,-.5*t,0]);return n.setAttribute("position",new r.BufferAttribute(s,3)),n.setIndex([0,2,1,2,3,1]),n}getMesh(){return this._plane}};const pa=class extends ar{constructor(e,t){super(e,t),this._mesh=new ca,this._mesh.setDataSource(t),this.add(this._mesh),this._frame=new ua(this.getBoundaries().boundingBox,this._mesh.volumeInfo),this.add(this._frame.getMesh()),this.showFrame(z.now.modes.VD.frame),this._farPlane=new da(this._mesh,2,2),this.add(this._farPlane.getMesh())}getBoundaries(){const e=this._dataSource.getBox(),t=new r.Sphere;return e.getBoundingSphere(t),{boundingBox:e,boundingSphere:t}}getMesh(){return this._mesh}showFrame(e){this._frame.getMesh().material.visible=e}};const ma=class extends hr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],["types"])}find(e){let t=[];if(e.type)t=this._dict.types[e.type.toLowerCase()]||[];else if(e.source)return this._list.filter((t=>t.canProbablyLoad&&t.canProbablyLoad(e.source)));return[...t]}};class fa extends g{constructor(e,t){super(),this._source=e,this._options=t||{},this._abort=!1,this._agent=null}load(){return Promise.reject(new Error("Loading from this source is not implemented"))}abort(){this._abort=!0,this._agent&&this._agent.abort()}static extractName(e){}}ur(fa.prototype);class _a extends fa{constructor(e,t){super(e,t),t=this._options,this._binary=!0===t.binary}load(){return new Promise(((e,t)=>{if(this._abort)throw new Error("Loading aborted");const r=this._source,n=this._agent=new FileReader;n.addEventListener("load",(()=>{e(n.result)})),n.addEventListener("error",(()=>{t(n.error)})),n.addEventListener("abort",(()=>{t(new Error("Loading aborted"))})),n.addEventListener("progress",(e=>{this.dispatchEvent(e)})),this._binary?n.readAsArrayBuffer(r):n.readAsText(r)}))}static canProbablyLoad(e){return File&&e instanceof File||Blob&&e instanceof Blob}static extractName(e){return e&&e.name}}_a.types=["file","blob"];const ga=/^(https?|ftp):\/\//i;class ya extends fa{constructor(e,t){super(e,t),t=this._options,this._binary=!0===t.binary}load(){return new Promise(((e,t)=>{if(this._abort)throw new Error("Loading aborted");const r=this._source,n=this._agent=new XMLHttpRequest;n.addEventListener("load",(()=>{200===n.status?e(n.response):t(new Error(`HTTP ${n.status} while fetching ${r}`))})),n.addEventListener("error",(()=>{t(new Error("HTTP request failed"))})),n.addEventListener("abort",(()=>{t(new Error("Loading aborted"))})),n.addEventListener("progress",(e=>{this.dispatchEvent(e)})),n.open("GET",r),this._binary?n.responseType="arraybuffer":n.responseType="text",n.send()}))}static canProbablyLoad(e){return t().isString(e)&&ga.test(e)}static extractName(e){if(e){const t=(e.indexOf("?")+1||e.lastIndexOf("#")+1||e.length+1)-1;return e.slice(e.lastIndexOf("/",t)+1,t)}}}ya.types=["url"];class xa extends fa{load(){return new Promise((e=>{if(this._abort)throw new Error("Loading aborted");e(this._source)}))}static canProbablyLoad(e){return!1}}xa.types=["immediate"];const ba=new ma([_a,ya,xa]);const wa=class extends hr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],["formats","extensions"])}find(e){let t=[];return e.format?t=this._dict.formats[e.format.toLowerCase()]||[]:e.ext&&(t=this._dict.extensions[e.ext.toLowerCase()]||[]),0===t.length&&!e.format&&e.data?this._list.filter((t=>t.canProbablyParse&&t.canProbablyParse(e.data))):[...t]}};class Sa{constructor(e,t){this._data=e,this._options=t||{},this._abort=!1}parseSync(){throw new Error("Parsing this type of data is not implemented")}parse(){return new Promise(((e,t)=>{setTimeout((()=>{try{return this._abort?t(new Error("Parsing aborted")):e(this.parseSync())}catch(e){return t(e)}}))}))}getModel(){return this.model._parseHeader(this._data),this.model}abort(){this._abort=!0}}ur(Sa.prototype);class va{constructor(){this.matrices=[],this._matrix=null,this._matrixIndex=-1}parse(e){let t=this._matrix;if(" SMTRY"===e.readString(12,18)){const n=e.readCharCode(19)-49,s=e.readString(20,80).trim().split(/\s+/),i=parseInt(s[0],10);null!==this._matrix&&i===this._matrixIndex||(this._matrixIndex=i,this._matrix=t=new r.Matrix4,this.matrices[this.matrices.length]=t);const{elements:o}=t;o[n]=parseFloat(s[1]),o[n+4]=parseFloat(s[2]),o[n+8]=parseFloat(s[3]),o[n+12]=parseFloat(s[4])}}}va.prototype.id=290;const Ca=va,{Assembly:Aa}=Yt;class Ea{constructor(e){this._complex=e,this.assemblies=[],this._assembly=null,this._matrix=null,this._matrixIndex=-1}parse(e){let t=this._assembly,n=this._matrix;if(t&&" BIOMT"===e.readString(12,18)){const s=e.readCharCode(19)-49,i=e.readString(20,80).trim().split(/\s+/),o=parseInt(i[0],10);null!==this._matrix&&o===this._matrixIndex||(this._matrixIndex=o,this._matrix=n=new r.Matrix4,t.addMatrix(n));const{elements:a}=n;a[s]=parseFloat(i[1]),a[s+4]=parseFloat(i[2]),a[s+8]=parseFloat(i[3]),a[s+12]=parseFloat(i[4])}else if(t&&"CHAINS:"===e.readString(35,41)){const r=e.readString(42,80).split(",");for(let e=0,n=r.length;e0&&t.addChain(n)}}else"BIOMOLECULE:"===e.readString(12,23)&&(this._matrix=null,this._matrixIndex=-1,this._assembly=t=new Aa(this._complex),this.assemblies.push(t))}}Ea.prototype.id=350;const Ta=Ea;const Ra=class{constructor(e){this._data=e,this._start=0,this._nextCR=-1,this._nextLF=-1,this._next=-1,this._end=e.length,this.next()}readLine(){return this._data.slice(this._start,this._next)}readChar(e){return(e=this._start+e-1)=this._end}next(){const e=this._next+1;this._start=ethis._nextCR&&(this._nextCR=(this._data.indexOf("\r",this._start)+1||this._end+1)-1),this._start>this._nextLF&&(this._nextLF=(this._data.indexOf("\n",this._start)+1||this._end+1)-1),this._next=this._nextCR+1t&&o.addBond(t,r,0,Oa.BondType.UNKNOWN,!0),n&&n>t&&o.addBond(t,n,0,Oa.BondType.UNKNOWN,!0),s&&s>t&&o.addBond(t,s,0,Oa.BondType.UNKNOWN,!0),i&&i>t&&o.addBond(t,i,0,Oa.BondType.UNKNOWN,!0)}_parseCOMPND(e){const t=e.readString(11,80),r=t.indexOf(":");if(this._compndCurrToken=r>0?t.substring(0,r).trim():this._compndCurrToken,"MOL_ID"===this._compndCurrToken)this._molecule={_index:"",_chains:[]},this._molecule._index=parseInt(t.substring(r+1,t.indexOf(";")),10),this._molecules.push(this._molecule);else if("MOLECULE"===this._compndCurrToken&&null!=this._molecule)this._molecule._name=t.substring(r+1,t.indexOf(";")).trim();else if("CHAIN"===this._compndCurrToken&&null!=this._molecule){let e=t.substring(r+1,80).trim();const n=e[e.length-1];";"!==n&&","!==n||(e=e.slice(0,-1)),e=e.replace(/\s+/g,"");const s=e.split(",");this._molecule._chains=this._molecule._chains.concat(s)}}_parseREMARK(e){const r=e.readInt(8,10);let n=this._remarks[r];if(t().isUndefined(n)){const e=ka[r];t().isFunction(e)&&(this._remarks[r]=n=new e(this._complex))}t().isUndefined(n)||n.parse(e)}_parseHELIX(e){this._parseSTRUCTURE(e,[20,22,32,34],(e=>{this._complex.addHelix(e),this._complex.structures.push(e)}))}_parseSHEET(e){this._parseSTRUCTURE(e,[22,23,33,34],(e=>{this._complex.addSheet(e)}))}_parseSTRUCTURE(e,t,r){const n=e.readInt(8,10),s=e.readString(12,14).trim(),i=e.readString(41,70).trim(),o=e.readInt(72,76),a=e.readInt(39,40),l=e.readInt(15,16),c=e.readInt(42,45),h=e.readInt(57,60),u=e.readString(t[0],t[2]+1).charCodeAt(0),d=e.readString(t[2],t[2]+1).charCodeAt(0),p=e.readInt(t[1],t[1]+3);let m=e.readString(t[1]+4,t[1]+4),f=0;m.length>0&&(f=m.charCodeAt(0));const _=e.readInt(t[3],t[3]+3);m=e.readString(t[3]+4,t[3]+4);let g,y=0;m.length>0&&(y=m.charCodeAt(0));let x=this._sheet;if(83===e.readCharCode(1)){null!==x&&x.getName()!==s&&(x=null,this._sheet=null),null===x?(this._sheet=g=new La(s,l),r(g)):g=x;const e=new Ia(g,this._complex.getUnifiedSerial(u,p,f),this._complex.getUnifiedSerial(d,_,y),a,c,h);g.addStrand(e),this._complex.structures.push(e)}else g=new Na(a,this._complex.getUnifiedSerial(u,p,f),this._complex.getUnifiedSerial(d,_,y),n,s,i,o),r(g)}_parseHEADER(e){const{metadata:t}=this._complex;t.classification=e.readString(11,50).trim(),t.date=e.readString(51,59).trim();const r=e.readString(63,66).trim();t.id=r,r&&(this._complex.name=r),t.format="pdb"}_parseTITLE(e){const{metadata:t}=this._complex;t.title=t.title||[];const r=e.readInt(9,10)||1;t.title[r-1]=e.readString(11,80).trim()}static tagParsers=(()=>({HEADER:za.prototype._parseHEADER,"TITLE ":za.prototype._parseTITLE,"ATOM ":za.prototype._parseATOM,HETATM:za.prototype._parseATOM,ENDMDL:za.prototype._parseENDMDL,CONECT:za.prototype._parseCONECT,COMPND:za.prototype._parseCOMPND,REMARK:za.prototype._parseREMARK,"HELIX ":za.prototype._parseHELIX,"SHEET ":za.prototype._parseSHEET,"ATOM 1":za.prototype._parseATOM,"ATOM 2":za.prototype._parseATOM,"ATOM 3":za.prototype._parseATOM,"ATOM 4":za.prototype._parseATOM,"ATOM 5":za.prototype._parseATOM,"ATOM 6":za.prototype._parseATOM,"ATOM 7":za.prototype._parseATOM,"ATOM 8":za.prototype._parseATOM,"ATOM 9":za.prototype._parseATOM}))();parseSync(){const e=new Ra(this._data),r=this._complex=new Ma;for(;!e.end();){const r=e.readString(1,6),n=za.tagParsers[r];t().isFunction(n)&&n.call(this,e),e.next()}if(this._finalize(),this._serialAtomMap=null,this._sheet=null,this._residue=null,this._chain=null,this._complex=null,0===r.getAtomCount())throw new Error("The data does not contain valid atoms");return r}}za.formats=["pdb"],za.extensions=[".pdb",".ent"];const Fa=za,{Complex:Ba,Element:Ua,SGroup:Ga,Bond:ja}=Yt,Ha={A:0,S:1,D:2,T:3},$a=/\s*<\?xml\b[^?>]*\?>\s*<(?:cml|molecule)\b/i;class Wa extends Sa{constructor(e,t){super(e,t),this._complex=null,this._residue=null,this._serialAtomMap=null,this._modelId=1,this._lastMolId=-1,this._readOnlyOneMolecule=!1,this._options.fileType="cml"}static canProbablyParse(e){return t().isString(e)&&$a.test(e)}_rebuidBondIndexes(e,t){const r=e.length;for(let n=0;n1&&o.splice(1,o.length-1),o.forEach((e=>{const r=function(e){let r,n=[];if(e.molecule&&e.molecule.atomArray&&e.molecule.atomArray.atom)Array.isArray(e.molecule.atomArray.atom)?n=e.molecule.atomArray.atom:n.push(e.molecule.atomArray.atom);else if(!e.molecule){return{atomLabels:null,labelsCount:1}}e.molecule.molecule&&s._extractSGroups(e.molecule.molecule,n);let i=n.length;for(let e=0;e1)a[e].order=s;else{const r=Ha[t];void 0!==r&&(a[e].order=r,"A"===t&&(a[e].type=ja.BondType.AROMATIC))}}i=n.length;for(let e=0;e0&&i.push(r)})),i}_packLabel(e,t){return(t<<16)+e}_unpackLabel(e){return{molId:e>>>16,compId:65535&e}}_breadWidthSearch(e,t){const r=new Array(e.length);let n;for(n=0;n0;){i++;let a=-1;for(n=0;n0;){const t=s.shift();if(t)for(let n=0;n=0){const s=[Math.min(e,t),Math.max(e,t)];this._complex.addBond(s[0],s[1],r,n,!0)}}_fixBondsArray(){const e=this._serialAtomMap={},t=this._complex,r=t._atoms;for(let t=0,n=r.length;to[e]-o[t])),a=0;a{r.curr=2,0===r.count&&(r.count=1);for(let n=0;n{r+=e.getAtomCount()})),r<=0)throw new Error("The data does not contain valid atoms");if(e.length>1){const t=new Ba;return t.joinComplexes(e),t.originalCML=e[0].originalCML,t}return 1===e.length?e[0]:new Ba}}Wa.formats=["cml"],Wa.extensions=[".cml"];const Ya=Wa;var Xa=s(660),qa=s.n(Xa);const{Complex:Za,Chain:Ka,Atom:Qa,Element:Ja,Helix:el,Sheet:tl,Strand:rl,Bond:nl,Assembly:sl,Molecule:il}=Yt;class ol{constructor(e){this._original=Array.from(e),this._original.sort(),this._sum=0;for(let e=0;e=this._complex._atoms.length)return;const r=Math.min(e.atomIndex1,e.atomIndex2);this._complex.addBond(this._complex._atoms[r],this._complex._atoms[t],e.bondOrder,nl.BondType.UNKNOWN,!0)}_updateSecStructure(e,r,n){const s=[3,-1,1,-1,5];if(!t().isUndefined(n)&&n.secStruct===this._ssType)return r._secondary=this._ssStruct,void(this._ssStruct&&(this._ssStruct.term=r));if(!t().isUndefined(n)){const t=ll[n.secStruct];this._ssType=n.secStruct,this._ssStart=r;let i=null;switch(this._ssType){case-1:case 7:break;case 0:case 2:case 4:i=new el(s[this._ssType],r,r,0,"","",0),e._helices.push(i);break;case 3:{const t=new tl("",0);e._sheets.push(t),i=new rl(t,r,r,0,null,null);break}default:void 0!==t&&(i=new Oe(t,r,r))}this._ssStruct=i,r._secondary=i,i&&e.structures.push(i)}}_updateMolecules(e){const t=e.entityList;if(!t)return;const r=e.chainsPerModel[0];for(let e=0;e=r)continue;const n=this._complex._chains[t];i=i.concat(n._residues.slice())}const o=new il(this._complex,n.description,e+1);o.residues=i,this._complex._molecules[e]=o}}_traverse(e){const t=this,{metadata:r}=this._complex;r.id=e.structureId,r.title=[],r.title[0]=e.title,r.date=e.releaseDate,r.format="mmtf";const n={onModel(e){t._onModel(e)},onChain(e){t._onChain(e)},onGroup(e){t._onGroup(e)},onAtom(e){t._onAtom(e)},onBond(e){t._onBond(e)}};this._ssType=-1,this._ssStruct=null,this._ssStart=null,qa().traverse(e,n),this._updateSecStructure(this._complex),this._updateMolecules(e)}_linkAtomsToResidues(){for(let e=0;e=t)continue;const s=this._complex._chains[r];for(let e=0;e=s||pl(e.charCodeAt(r+1))))return++c,void++r;if(a&&59===o){n=r;let i=0;do{if(n=ml(10,e,n+1),-1===n)throw new dl("Unterminated text block found",l,c);++i}while(n+1=s);return t=e.substring(r+1,n).replace(/\r/g,""),r=n+2,l+=i,c=1,a=!1,t}if(39===o||34===o){n=r;do{if(n=ml(o,e,n+1),-1===n)throw new dl("Unterminated quoted string found",l,c)}while(n+10){for(let e=0;e0&&r.addChain(n[t])}r.matrices=s,e.units.push(r)}}}Ml.formats=["cif","mmcif"],Ml.extensions=[".cif",".mmcif"];const Pl=Ml,Nl=0,Ll=1,Il=2,Ol=3;const Vl=class{_xyz2crs=[];_origin=(()=>new r.Vector3(0,0,0))();constructor(){this._header={},this._boxSize=new r.Vector3,this._boxStart=new r.Vector3,this._header.delta={},this._header.extent=[],this._header.nstart=[],this._header.grid=[],this._header.crs2xyz=[],this._header.cellDims=new r.Vector3,this._header.angles=[],this._header.origin=new r.Vector3(0,0,0),this._header.dmin=0,this._header.dmean=0,this._header.dmax=0}_typedCheck(){if(t().isTypedArray(this._buff))this._buff=this._buff.buffer;else if(!t().isArrayBuffer(this._buff))throw new TypeError("Expected ArrayBuffer or TypedArray")}_fillHeader(e,t){for(const r in e)if(e.hasOwnProperty(r))switch(e[r][0]){case Nl:this._header[r]=t[e[r][1]][e[r][2]];break;case Il:this._parseArray(this._header[r],t[e[r][1]],e[r][2]);break;case Ll:this._parseVector(this._header[r],t[e[r][1]],e[r][2]);break;case Ol:this._header[r]=new Uint8Array(t[e[r][1]],4*[e[r][2]],4*[e[r][3]])}}_parseVector(e,t,r){[e.x,e.y,e.z]=[t[r],t[r+1],t[r+2]]}_parseArray(e,t,r){e[0]=t[r],e[1]=t[r+1],e[2]=t[r+2]}_parseHeader(e){}_setAxisIndices(){}_setOrigins(){}_getAxis(){const e=this._header,t=e.cellDims.x/e.grid[0],n=e.cellDims.y/e.grid[1],s=e.cellDims.z/e.grid[2],[i,o,a]=e.angles,l=Math.cos(o),c=(Math.cos(i)-Math.cos(o)*Math.cos(a))/Math.sin(a),h=Math.sqrt(1-l*l-c*c);return[new r.Vector3(t,0,0),new r.Vector3(Math.cos(a)*n,Math.sin(a)*n,0),new r.Vector3(l*s,c*s,h*s)]}_getXYZdim(){return[this._header.extent[this._xyz2crs[0]],this._header.extent[this._xyz2crs[1]],this._header.extent[this._xyz2crs[2]]]}_getVolumeInfo(){const e=t().pick(this._header,["dmean","dmin","dmax","sd","delta"]);return e.obtuseAngle=this._header.angles.map((e=>Number(e>=Math.PI/2))),e}_setBoxParams(e,t,n){let s=0,i=0;const[o,a,l]=this._header.angles;l>=Math.PI/2&&(s+=Math.abs(t.x)),a>=Math.PI/2&&(s+=Math.abs(n.x)),o>=Math.PI/2&&(i+=Math.abs(n.y)),this._boxStart=new r.Vector3(this._origin.x-s,this._origin.y-i,this._origin.z),this._boxSize=new r.Vector3(Math.abs(e.x)+Math.abs(t.x)+Math.abs(n.x),Math.abs(t.y)+Math.abs(n.y),Math.abs(n.z));const c=(e,t)=>Math.abs(e[t])/this._boxSize[t];this._header.delta.x=c(t,"x"),this._header.delta.y=c(n,"x"),this._header.delta.z=c(n,"y")}_getXYZbox(){return new r.Box3(this._boxStart.clone(),this._boxStart.clone().add(this._boxSize))}_toXYZData(){}parse(e){return this._parseHeader(e),this._setOrigins(),new Wt(Float32Array,this._getXYZdim(),this._getXYZbox(),1,this._toXYZData(),this._getVolumeInfo())}},Dl={extent:[Il,"u32",0],type:[Nl,"u32",3],nstart:[Il,"i32",4],grid:[Il,"u32",7],cellDims:[Ll,"f32",10],angles:[Il,"f32",13],crs2xyz:[Il,"i32",16],dmin:[Nl,"f32",19],dmax:[Nl,"f32",20],dmean:[Nl,"f32",21],ispg:[Nl,"u32",22],nsymbt:[Nl,"u32",23],lksflg:[Nl,"u32",24],customData:[Ol,"buffer",25,9],origin:[Ll,"f32",34],map:[Ol,"buffer",52,1],machine:[Nl,"u32",53],sd:[Nl,"f32",54],nlabel:[Nl,"f32",55],label:[Ol,"buffer",56,200]};class kl extends Vl{_parseHeader(e){this._buff=e,this._typedCheck();const t={};t.u32=new Uint32Array(this._buff,0,56),t.i32=new Int32Array(this._buff,0,56),t.f32=new Float32Array(this._buff,0,56),t.buffer=this._buff;const r=this._header;this._fillHeader(Dl,t),r.angles.forEach(((e,t,r)=>{r[t]*=Math.PI/180}))}_setAxisIndices(){const e=this._header;0===e.cellDims.x&&0===e.cellDims.y&&0===e.cellDims.z&&e.cellDims.set(1,1,1);const{crs2xyz:t}=this._header;0===t[0]&&0===t[1]&&0===t[2]&&(t[0]=1,t[1]=2,t[2]=3);const r=this._xyz2crs;r[t[0]-1]=0,r[t[1]-1]=1,r[t[2]-1]=2}_setOrigins(){const[e,t,r]=this._getAxis();this._setAxisIndices();const n=this._header,s=this._xyz2crs;if(0===n.origin.x&&0===n.origin.y&&0===n.origin.z?(this._origin.addScaledVector(e,n.nstart[s[0]]),this._origin.addScaledVector(t,n.nstart[s[1]]),this._origin.addScaledVector(r,n.nstart[s[2]])):this._origin=n.origin,e.multiplyScalar(n.extent[s[0]]-1),t.multiplyScalar(n.extent[s[1]]-1),r.multiplyScalar(n.extent[s[2]]-1),2!==n.type)throw new Error(`CCP4: Unsupported format ${n.type}`);this._data=new Float32Array(this._buff,1024+n.nsymbt,n.extent[0]*n.extent[1]*n.extent[2]),this._setBoxParams(e,t,r)}_toXYZData(){const e=this._header,t=this._data,r=this._xyz2crs,n=new Float32Array(t.length),s=this._getXYZdim(),i=s[0],o=s[1];let a=0;const l=[];let c,h,u;for(l[2]=0;l[2]=this._strings.length?(this._currentStart=this._strings.length-1,this._currentStringIndx=this._strings.length-1):(this._currentStart=e,this._currentStringIndx=e)}getNextString(){return this._strings[++this._currentStringIndx]}getCurrentString(){return this._strings[this._currentStringIndx]}getStringFromStart(e){return this._currentStringIndx=this._currentStart+e,this._strings[this._currentStart+e]}findNextDataItem(){let e=this.getNextString(),r=!1;for(;!t().isUndefined(e)&&"$$$$"!==e.trim();){if(e.match(/>\s+<(.*)>/)){r=!0;break}e=this.getNextString()}return r}findNextCompoundStart(){let e=this.getCurrentString();for(;!t().isUndefined(e)&&"$$$$"!==e.trim();)e=this.getNextString();return this.setStart(++this._currentStringIndx),this.probablyHaveDataToParse()}probablyHaveDataToParse(){return this._currentStringIndx\s+<(.+)>.*/,nc=/.*($$$$).*|.*>\s+<(.+)>.*/,sc="sdf",ic="mol",oc=["name","id","title"],ac={name:["PUBCHEM_IUPAC_TRADITIONAL_NAME",/PUBCHEM_(.+)_NAME/,/(.+)name/,/(.+)NAME/],id:["PUBCHEM_COMPOUND_CID","id","ID",/.*CID/,/.*ID/,/.*id/],title:["msg","MSG","message","title","description","desc"]};class lc extends Sa{constructor(e,t){super(e,t),this._format="sdf",this._complex=null,this._chain=null,this._residue=null,this._molecules=null,this._metadata={},this._metadata.molecules=[],this._currentMolProps={},this._compoundIndx=-1,this._assemblies=[],this._atomsParsed=0,this._atomsIndexes=[]}canProbablyParse(e){return t().isString(e)&&rc.test(e)}_parseHeader(e){const t={};t.name=e.getStringFromStart(0);const r=parseInt(e.getStringFromStart(1).substr(10,6).trim(),10);t.date=r.toString()||"",t.title=e.getStringFromStart(2),this._metadata.molecules.push(t)}_parseAtoms(e,t){let n,s=this._atomsParsed;const i=function(e){if(!e)return"A";const t=[];for(;e;)t.push(65+e%26),e=Math.trunc(e/26);return t.length>1&&(t.reverse(),t[0]-=1),String.fromCharCode(...t)}(this._compoundIndx);this._chain=this._complex.getChain(i)||this._complex.addChain(i),this._residue=this._chain.addResidue("UNK",1," ");for(let i=0;in&&([t,n]=[n,t]),this._complex.addBond(t,n,ec[s]||1,tc[s]||Kl.BondType.UNKNOWN,!0)}}_parseMOL(e){this._compoundIndx++,this._parseHeader(e);const t=e.getStringFromStart(3),r=parseInt(t.substr(0,3),10),n=parseInt(t.substr(3,3),10);this._parseAtoms(e,r),this._parseBonds(e,n),this._atomsParsed+=r,this._metadata.molecules[this._compoundIndx]._residues=[],this._metadata.molecules[this._compoundIndx]._residues.push(this._residue)}_parseDataItem(e){const t=e.getCurrentString();let r=[],n=e.getNextString();for(;""!==n.trim();)r.push(n),n=e.getNextString();1===r.length&&([r]=r),this._currentMolProps[t.replace(/[<>]/g,"").trim()]=r}_parseCompound(e){if(this._parseMOL(e),this._format===sc){for(this._currentMolProps={};e.findNextDataItem();)this._parseDataItem(e);if(0!==Object.keys(this._currentMolProps).length){const e=this._metadata.molecules[this._compoundIndx];e.props=this._currentMolProps,this._tryToUpdateMoleculeData(e)}}}_fixBondsArray(){const e=this._serialAtomMap,t=this._complex._bonds;for(let r=0;r1){t.molecules=[];for(let r=0;r>8&255}if(100!==t.i16[18])throw new Error("DSN6: Incorrect format ");const r=this._header;this._fillHeader(cc,t),r.cellDims.multiplyScalar(1/r.scaleFactor),r.angles.forEach(((e,t,n)=>{n[t]*=Math.PI/180/r.scaleFactor})),r.div/=100}_setAxisIndices(){this._xyz2crs[0]=0,this._xyz2crs[1]=1,this._xyz2crs[2]=2}_setOrigins(){const e=this._header,[t,r,n]=this._getAxis();this._setAxisIndices(),this._origin.addScaledVector(t,e.nstart[0]),this._origin.addScaledVector(r,e.nstart[1]),this._origin.addScaledVector(n,e.nstart[2]),t.multiplyScalar(e.extent[0]),r.multiplyScalar(e.extent[1]),n.multiplyScalar(e.extent[2]),this._setBoxParams(t,r,n)}_pointCalculate(e,t,r,n,s,i,o){const a=this._header;if(!(sn&&(n=e[s]);this._header.sd=Math.sqrt(t/e.length),this._header.dmax=n,this._header.dmin=r}}class uc extends Sa{constructor(e,t){super(e,t),this._options.fileType="dsn6",this.model=new hc}static canParse(e,t){return!!e&&(e instanceof ArrayBuffer&&Sa.checkDataTypeOptions(t,"dsn6"))}static canProbablyParse(e){return!1}parseSync(){return this.model.parse(this._data)}}uc.formats=["dsn6"],uc.extensions=[".dsn6",".omap"],uc.binary=!0;const dc=uc;const pc=class extends Ra{constructor(e){super(e),this._next=-1,this.next()}getNext(){return this._next}},{Complex:mc,Element:fc,Molecule:_c}=Yt;class gc extends Sa{constructor(e,t){super(e,t),this._time=null,this._numAtoms=null,this._residueNumber=null,this._residueName="",this._atomName="",this._atomNumber=null,this._atomPosition=[],this._atomVelocity=[],this._complex=null,this._molecules=[],this._molecule=null,this._options.filetype="gro"}canProbablyParse(e){return t().isString(this._data)&&/^\s*[^\n]*\n\s*\d+ *\n\s*\d+[^\n\d]{3}\s*\w+\s*\d+\s*-?\d/.test(e)}_parseTitle(e){const{metadata:t}=this._complex;t.id=e.readLine().trim(),t.name=t.id.slice(t.id.lastIndexOf("\\")+1,t.id.lastIndexOf(".")),t.format="gro"}_parseNumberOfAtoms(e){if(this._numAtoms=e.readInt(0,e.getNext()),Number.isNaN(this._numAtoms))throw new Error("Line 2 is not representing atom number. Consider checking input file")}_parseAtom(e){this._residueNumber=e.readInt(1,5),this._residueName=e.readString(6,10).trim(),this._atomName=e.readString(11,15).trim(),this._atomNumber=e.readInt(16,20);const t=10*e.readFloat(21,28),n=10*e.readFloat(29,36),s=10*e.readFloat(37,45);if(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(s))return void(this._complex.error={message:`Atom position is invalid in "${e.readLine()}"`});const i=fc.getByName(this._atomName[0]);if("Unknown"===i.fullName)return void(this._complex.error={message:`${this._atomName[0]} hasn't been recognised as an atom name.`});const o=fc.Role[this._atomName];let a=this._chain;a||(this._chain=a=this._complex.addChain("A"));let l=this._residue;l&&l.getSequence()===this._residueNumber||(this._residue=l=a.addResidue(this._residueName,this._residueNumber," ")),this._atomPosition=new r.Vector3(t,n,s);l.addAtom(this._atomName,i,this._atomPosition,o,!0,this._atomNumber," ",1,1,0)}_finalize(){const e=new _c(this._complex,this._complex.metadata.name,1);e.residues=this._chain._residues,e._chains=this._chain,this._complex._molecules[0]=e,this._molecules.push(e),this._complex.finalize({needAutoBonding:!0,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing,serialAtomMap:this._serialAtomMap})}parseSync(){const e=this._complex=new mc,t=new pc(this._data);let r=0;for(this._parseTitle(t),t.next(),this._parseNumberOfAtoms(t),t.next(),r=0;r${e}`))return;this._currPosIdx++}this._toStringFromStart(0,t)}_toStringFromHeader(e,t,r){this._toHeaderString(e,r);const n=this._currPosIdx+t;r[this._currPosIdx].match(`@${e}`)&&n=t.length?this._currStartIdx=this._currPosIdx=t.length-1:this._currStartIdx=this._currPosIdx=e}_probablyHaveDataToParse(e){return this._currPosIdxMOLECULE>"!==e[this._currPosIdx].trim();)this._currPosIdx++;return this._setStart(++this._currPosIdx,e),this._probablyHaveDataToParse(e)}_parseMolecule(e){this._toHeaderString("MOLECULE",e);const{metadata:t}=this._complex;t.name=e[++this._currPosIdx],t.format="mol2",this._molecule={_index:"",_chains:[]},this._molecule._index=this._compoundIndx+1,this._molecules.push(this._molecule)}_parseAtoms(e,t){this._toHeaderString("ATOM",t);for(let n=0;n=9&&(c=parseFloat(e[8])||0);let h=this._chain;if(h||(this._chain=h=this._complex.getChain("A")||this._complex.addChain("A"),this._residue=null),!this._setResidue(e))continue;const u=!1,d=" ",p=1,m=0,f=bc.getByName(l),_=bc.Role[s],g=new r.Vector3(i,o,a);this._residue.addAtom(s,f,g,_,u,n,d,p,m,c)}}_setResidue(e){let t=1,r="UNK";if(e.length>=7&&(t=parseInt(e[6],10)),e.length>=8&&"<0>"!==e[7]&&(r=e[7].replace(Ac,"")),this.settings.now.nowater&&("HOH"===r||"WAT"===r))return!1;const n=this._residue,s=this._chain;return n&&n.getSequence()===t||(this._residue=s.addResidue(r,t,"A")),!0}_parseBonds(e,t){this._toHeaderString("BOND",t);for(let r=0;rn&&([r,n]=[n,r]),this._complex.addBond(r,n,vc[s]||0,Cc[s]||wc.BondType.UNKNOWN,!0)}}_fixSerialAtoms(){const e=this._complex._atoms;for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[],["formats"])}find(e){let t=[];return e.format&&(t=this._dict.formats[e.format.toLowerCase()]||[]),[...t]}};class Nc{constructor(e,t){this._source=e,this._options=t||{},this._abort=!1}exportSync(){throw new Error("Exporting to this source is not implemented")}export(){return new Promise(((e,t)=>{setTimeout((()=>{try{return this._abort?t(new Error("Export aborted")):e(this.exportSync())}catch(e){return t(e)}}))}))}abort(){this._abort=!0}}ur(Nc.prototype);class Lc{constructor(){this._resultArray=[],this._currentStr=-1,this._tag=null,this._fixedNumeration=!1,this._numeration=!1,this._tagStrNum=0}getResult(){return this.writeString("\n",81,81),this._resultArray.join("")}_currentStrLength(){const e=this._resultArray[this._currentStr];return e?e.length:0}newTag(e,r){this._tag=e||null,t().isUndefined(r)?(this._numeration=!1,this._fixedNumeration=!1,this._tagStrNum=0):t().isNumber(r)?(this._tagStrNum=r,this._numeration=!0,this._fixedNumeration=!0):t().isBoolean(r)&&(this._tagStrNum=0,this._numeration=r,this._fixedNumeration=!1)}newString(e){this.writeString("\n",81,81),this._currentStr++,this._resultArray.push(""),e?this.writeString(e,1,6):this._tag&&this.writeString(this._tag,1,6),this._numeration&&(this._fixedNumeration||this._tagStrNum++,1!==this._tagStrNum&&this.writeString(this._tagStrNum.toString(),10,8))}writeEntireString(e,t,r){t||(t=81);for(let n=0;nMath.abs(r-n)+1&&(s=s.substr(0,Math.abs(r-n+1))),l>o+1)this._resultArray[this._currentStr]+=" ".repeat(l-o-1);else if(l<=o){const e=this._resultArray[this._currentStr];this._resultArray[this._currentStr]=e.slice(0,l-1)}if(ni.length&&(this._resultArray[this._currentStr]+=" ".repeat(a-i.length))}writeBondsArray(e,t){const r=this._getSubArrays(e,4);for(let e=0;ee._fixed));0!==n.length&&e.writeBondsArray(n.reverse(),t[r])}}_extractSHEET(e){if(!this._source._sheets)return;e.newTag("SHEET");const t=this._source._sheets;for(let r=0;r1||t[r].name.length>3?13:14;e.writeString(t[r].serial,11,7),e.writeString(t[r].name,s,16),e.writeString(String.fromCharCode(t[r].location),17,17),e.writeString(t[r].residue._type._name,20,18),e.writeString(t[r].residue._chain._name,22,22),e.writeString(t[r].residue._sequence,26,23),e.writeString(t[r].residue._icode,27,27),e.writeString(t[r].position.x.toFixed(3),38,31),e.writeString(t[r].position.y.toFixed(3),46,39),e.writeString(t[r].position.z.toFixed(3),54,47),e.writeString(t[r].occupancy.toFixed(2),60,55),e.writeString(t[r].temperature.toFixed(2),66,61),e.writeString(t[r].element.name,78,77),t[r].charge&&e.writeString(t[r].charge,79,80)}}_extractCOMPND(e){if(!this._source._molecules)return;const t=this._source._molecules;e.newTag("COMPND",!0);for(let r=0;re instanceof ct));for(let t=0;tt.indexOf(e)===r))}}Ic.formats=["pdb"],Ic.SourceClass=jt;function Oc(e,t,r,n){r[n]=e[t],r[n+1]=e[t+1],r[n+2]=e[t+2]}function Vc(e,t,r,n,s){r[n]=e[t],r[n+1]=e[t+1],r[n+2]=e[t+2],r[n+3]=s}const Dc=new r.Vector4;function kc(e,t,r,n,s){Dc.set(e[t],e[t+1],e[t+2],s.w),Dc.applyMatrix4(s.matrix),r[n]=Dc.x,r[n+1]=Dc.y,r[n+2]=Dc.z}function zc(e,t,r,n,s){if(!((t.array.length-t.start)/t.stridee+r));this.setIndices(n,0,t)}getVerticesNumber(){return this.lastPos/3}addInstance(e,t){const r=this.getVerticesNumber();this.setShiftedIndices(t.indices,t.indices.length,r);const n=t.itemSize;this.setTransformedPositions(t.positions,0,t.vertsCount,n.position,e),this.setTransformedNormals(t.normals,0,t.vertsCount,n.normal,e),this.setColors(t.colors,0,t.vertsCount,n.color)}}class Bc{constructor(){this.positions=null,this.normals=null,this.colors=null,this.indices=null,this.vertsCount=0,this.itemSize=null}init(e,t){const{attributes:r}=e;this.itemSize={position:r.position.itemSize,normal:r.normal.itemSize,color:r.color.itemSize}}}class Uc extends Bc{init(e,t){super.init(e,t);const{attributes:{position:r,normal:n},index:s}=e;this.vertsCount=r.count,this.positions=r.array,this.normals=n.array,this.colors=new Float32Array(this.vertsCount*this.itemSize.color),this.indices=s.array}setColors(e){let t=0;for(let r=0,n=this.colors.length,s=this.itemSize.color;re+s)),this.indices.set(r.array,0),this.indices.set(i,n)}_setColorRange(e,t,r,n){const s=n.length;for(let i=e;i{e instanceof r.Mesh&&e.layers.test(t)&&this.checkExportAbility(e)&&("InstancedBufferGeometry"===e.geometry.type?this._collectInstancedGeoInfo(e):this._collectGeoInfo(e))}))}_reworkIndices(e){for(let t=2;t0&&(u=new Gc,u.init(e.geometry,h));const d=h.addPerCylinder*h.needToSplit,p=t.count,m=i.count;a.init(l*p+d,l*m);const f=new r.Matrix4,_=new r.Matrix4,g=new r.Color,y=new r.Color;let x={};for(let t=0;tt().isEqual(r,e)))}_gatherCylindersColoringInfo(e){const t=e.instanceCount,r=e.attributes.color.array,n=e.attributes.color2.array,s=e.attributes.color.itemSize,i=new Array(t);let o=0,a=0;for(let e=0;e1e-7||Math.abs(r[a+1]-n[a+1])>1e-7||Math.abs(r[a+2]-n[a+2])>1e-7;i[e]=t,o+=t}return{is2Colored:i,needToSplit:o,addPerCylinder:e.getGeoParams().radialSegments}}_collectInstancedGeoInfo(e){e.geometry instanceof gr?this._collectSpheresInfo(e):e.geometry instanceof Dr&&this._collectCylindersInfo(e)}_collectMaterialInfo(e){const{uberOptions:t}=e.material;return{diffuse:t.diffuse.toArray(),opacity:t.opacity,shininess:t.shininess,specular:t.specular.toArray()}}_getCylinderInstanceMatrix(e,t,r){const n=e.attributes.matVector1.array,s=e.attributes.matVector2.array,i=e.attributes.matVector3.array,o=4*t;r.set(n[o],n[o+1],n[o+2],n[o+3],s[o],s[o+1],s[o+2],s[o+3],i[o],i[o+1],i[o+2],i[o+3],0,0,0,1)}_getSphereInstanceMatrix(e,t,r){const{offset:n}=e.attributes,s=t*n.itemSize,i=n.array[s],o=n.array[s+1],a=n.array[s+2],l=n.array[s+3];r.set(l,0,0,i,0,l,0,o,0,0,l,a,0,0,0,1)}}class Hc{constructor(){this._resultArray=[],this._info=null}getResult(e){return this._info=e,this._resultArray.push(this._writeHeader()),this._resultArray.push(this._writeDefinitions()),this._resultArray.push(this._writeObjects(e.models,e.materials)),this._resultArray.push(this._writeRelations()),this._resultArray.push(this._writeConnections()),this._info=null,this._resultArray.join("")}_writeHeader(){const e=new Date,t=`Miew FBX Exporter v${this._info.version}`;return`; FBX 6.1.0 project file\n; Created by ${t} Copyright (c) 2015-2024 EPAM Systems, Inc.\n; For support please contact miew@epam.com\n; ----------------------------------------------------\n\nFBXHeaderExtension: {\n FBXHeaderVersion: 1003\n FBXVersion: 6100\n CreationTimeStamp: {\n Version: 1000\n Year: ${e.getFullYear()}\n Month: ${e.getMonth()+1}\n Day: ${e.getDate()}\n Hour: ${e.getHours()}\n Minute: ${e.getMinutes()}\n Second: ${e.getSeconds()}\n Millisecond: ${e.getMilliseconds()}\n }\n Creator: "${t}"\n OtherFlags: {\n FlagPLE: 0\n }\n}\nCreationTime: "${e}"\nCreator: "${t}"\n`}_writeDefinitions(){return'\n; Object definitions\n;------------------------------------------------------------------\n\n\nDefinitions: {\n Version: 100\n Count: 3\n ObjectType: "Model" {\n Count: 1\n }\n ObjectType: "Geometry" {\n Count: 1\n }\n ObjectType: "Material" {\n Count: 1\n }\n ObjectType: "Pose" {\n Count: 1\n }\n ObjectType: "GlobalSettings" {\n Count: 1\n }\n} \n'}_models(){let e="";const{models:t}=this._info;for(let r=0;r-t.near?"hidden":"visible",a=1e4*(t.far- -this._vector.z)/(t.far-t.near),l=e.getElement();if(void 0===n.fog)l.style.color=i(e.userData.color),"transparent"!==e.userData.background&&(l.style.background=i(e.userData.background));else{const t=r.MathUtils.smoothstep(-this._vector.z,n.fog.near,n.fog.far);l.style.color=s(e.userData.color,n.fog.color,t),"transparent"!==e.userData.background&&(l.style.background=s(e.userData.background,n.fog.color,t))}this._vector.applyMatrix4(this._projectionMatrix);const c=`${e.userData!=={}?e.userData.translation:"translate(-50%, -50%) "}translate(${this._vector.x*this._widthHalf+this._widthHalf}px,${-this._vector.y*this._heightHalf+this._heightHalf}px)`;l.style.visibility=o,l.style.WebkitTransform=c,l.style.MozTransform=c,l.style.oTransform=c,l.style.transform=c,l.style.zIndex=Number(a).toFixed(0),l.parentNode!==this._domElement&&this._domElement.appendChild(l)}for(let r=0,s=e.children.length;r0&&(this._altObj.setObjects(i.objects),this._altObj.pivot=i.pivot,"axis"in i?this._altObj.axis=i.axis.clone():this._altObj.axis.set(0,0,1),e.set(s*t,s*n),this._altObj.translate(e),this.dispatchEvent({type:"change",action:"translate"}))}}this._lastUpdateTime=t}}(),sh.prototype.reset=function(){this._state=Zc,this.object.quaternion.copy(th.set(0,0,0,1))},sh.prototype.mousedown=function(e){if(!1!==this.enabled&&this._state===Zc){if(e.preventDefault(),e.stopPropagation(),this._state===Zc)if(0===e.button){this._affectedObj.stop();let t=!1;if(e.altKey){const e=this.getAltObj();t=e.objects.length>0,t&&(this._altObj.setObjects(e.objects),this._altObj.pivot=e.pivot,"axis"in e?this._altObj.axis=e.axis.clone():this._altObj.axis.set(0,0,1))}this._affectedObj=t?this._altObj:this._mainObj,this._state=t&&e.ctrlKey&&this._isTranslationAllowed?Qc:Kc}else 2===e.button&&(this._state=eh);this._state===Kc&&(this.convertMouseToOnCircle(this._mouseCurPos,e.pageX,e.pageY),this._mousePrevPos.copy(this._mouseCurPos)),this._state!==Qc&&this._state!==eh||(this.convertMouseToViewport(this._mouseCurPos,e.pageX,e.pageY),this._mousePrevPos.copy(this._mouseCurPos))}},sh.prototype.mousemove=function(e){if(!1!==this.enabled&&this._state!==Zc)switch(e.preventDefault(),e.stopPropagation(),this._state){case Kc:this._mousePrevPos.copy(this._mouseCurPos),this.convertMouseToOnCircle(this._mouseCurPos,e.pageX,e.pageY),this.rotateByMouse(e.altKey&&!this._isAltObjFreeRotationAllowed||e.shiftKey),this._lastMouseMoveTime=this._clock.getElapsedTime();break;case Qc:this._mousePrevPos.copy(this._mouseCurPos),this.convertMouseToViewport(this._mouseCurPos,e.pageX,e.pageY),this.translate();break;case eh:this._mousePrevPos.copy(this._mouseCurPos),this.convertMouseToViewport(this._mouseCurPos,e.pageX,e.pageY),this.translatePivotByMouse()}},sh.prototype.mousewheel=function(e){if(!1===this.enabled||!z.now.zooming||this._state!==Zc||e.shiftKey)return;e.preventDefault();let t=0;e.wheelDelta?t=e.wheelDelta/40:e.detail&&(t=-e.detail/3);let r=1+.05*t;r=Math.max(r,.01),this.scale(r)},sh.prototype.mouseup=function(e){!1!==this.enabled&&this._state!==Zc&&(e.preventDefault(),e.stopPropagation(),this._state=Zc,this._clock.getElapsedTime()-this._lastMouseMoveTime>.1&&this._affectedObj.stop())},sh.prototype.touchstartend=function(e){if(!1!==this.enabled)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:this._state=Kc,this.convertMouseToOnCircle(this._mouseCurPos,e.touches[0].pageX,e.touches[0].pageY),this._mousePrevPos.copy(this._mouseCurPos);break;case 2:{this._mainObj.stop(),this._altObj.stop(),this._state=Jc;const t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;this._touchDistanceCur=this._touchDistanceStart=Math.sqrt(t*t+r*r),this._scaleStart=this.object.scale.x;break}default:this._state=Zc}},sh.prototype.touchmove=function(e){if(!1!==this.enabled&&this._state!==Zc)switch(e.preventDefault(),e.stopPropagation(),this._state){case Kc:this._mousePrevPos.copy(this._mouseCurPos),this.convertMouseToOnCircle(this._mouseCurPos,e.touches[0].pageX,e.touches[0].pageY),this.rotateByMouse(!1),this._lastMouseMoveTime=this._clock.getElapsedTime();break;case Jc:if(z.now.zooming){const t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;this._touchDistanceCur=Math.sqrt(t*t+r*r);const n=this._scaleStart*this._touchDistanceCur/this._touchDistanceStart/this.object.scale.x;this.scale(n)}}},sh.prototype.keydownup=function(e){if(!1!==this.enabled&&!1!==this.hotkeysEnabled)switch(e.keyCode){case 37:case 38:case 39:case 40:this._pressedKeys[e.keyCode]="keydown"===e.type,e.preventDefault(),e.stopPropagation()}},sh.prototype.getKeyBindObject=function(){return qc()},sh.prototype.dispose=function(){for(let e=0;e{t.pickObject(s)}),0),this._lastClickPos=s,this._lastClickBeginTime=this._clickBeginTime}},oh.prototype.touchstart=function(e){e.preventDefault(),e.stopPropagation(),1===e.touches.length&&(this._lastTouchdownPos=this.getMouseInViewport(e.touches[0].pageX,e.touches[0].pageY))},oh.prototype.touchend=function(e){const t=this;if(e.preventDefault(),e.stopPropagation(),0===e.touches.length&&1===e.changedTouches.length){this.getMouseInViewport(e.changedTouches[0].pageX,e.changedTouches[0].pageY).sub(this._lastTouchdownPos).length()<.01&&setTimeout((()=>{t.pickObject(t._lastTouchdownPos)}),0)}},oh.prototype.dispose=function(){for(let e=0;e=524288?e-1048576:e}class ph{constructor(e,t,r){this._complex=e,this._secondary=null,this.isLoading=!1,this._framesRange={start:0,end:-1},this.frameIsReady=!1,this._buffer=null,this._frameRequest=null,this._callbacks=r,"function"==typeof t?(this._framesRequestLength=1,this._downloadDataFn=t):this.parseBinaryData(t,!0),this.reset(),this.setFrame(0)}_prepareBuffer(e,t){if(null==e&&(e=0),null==t&&(t=e+this._framesRequestLength),void 0!==this._framesCount&&(t=Math.min(this._framesCount-1,t)),this._downloadDataFn){const r=this,n=function(n){if(r.isLoading=!1,r._callbacks&&"function"==typeof r._callbacks.onLoadStatusChanged&&r._callbacks.onLoadStatusChanged(),r._buffer={data:n,state:"ready",start:e,end:t},null!==r._frameRequest){const e=r._frameRequest;r._frameRequest=null,r.setFrame(e)}},s=function(){r.isLoading=!1,r._callbacks&&"function"==typeof r._callbacks.onError&&r._callbacks.onError("Streaming failed")};this._buffer||(this._buffer={}),this._buffer.state="downloading",this.isLoading=!0,r._callbacks&&"function"==typeof r._callbacks.onLoadStatusChanged&&r._callbacks.onLoadStatusChanged(),this._downloadDataFn({start:e,end:t+1},n,s)}}_parseBuffer(){if(this._buffer&&"ready"===this._buffer.state){this._framesRange={start:this._buffer.start,end:this._buffer.end},this.parseBinaryData(this._buffer.data,!1);let e=(this._buffer.end+1)%this._framesCount;if(e>=this._framesCount&&(e=0),this._buffer={state:"none"},this._prepareBuffer(e,e+this._framesRequestLength),null!==this._frameRequest){const e=this._frameRequest;this._frameRequest=null,this.setFrame(e)}}}parseBinaryData(e){const t=new DataView(e);let r=0;const n=t.getUint32(r,!0);r+=4;const s=t.getUint32(r,!0);this._framesCount=s,this._framesRange.end=this._framesRange.end>0?Math.min(this._framesRange.end,s-1):s-1,r+=4,this._atomsCount=n;this._framesRequestLength=Math.ceil(1048576/(8*n));const i=this._framesRange.end-this._framesRange.start+1;if(n!==this._complex._atoms.length||e.byteLength!==12+i*n*8)throw new Error;const o=this._complex;let a=t.getUint32(r,!0),l=0;for(;a>1e3&&l>>28,o=dh((268435200&s)>>>8>>0),a=dh(((255&s)<<12|(4293918720&n)>>>20)>>0),l=dh((1048575&n)>>0);d[e]=0,i>0&&i<4?d[e]=1:4===i&&(d[e]=2),h[u++]=o/100,h[u++]=a/100,h[u++]=l/100}c.push(uh(d,o))}this._secondaryData=c,this._data=h}nextFrame(){this.setFrame((this._currFrame+1)%this._framesCount)}needsColorUpdate(e){return e instanceof bo}getAtomColor(e,t){return e.getResidueColor(this._residues[t.residue._index],this._complex)}getResidueColor(e,t){return e.getResidueColor(this._residues[t._index],this._complex)}_updateSecondary(){let e;const t=this._residues;let r=t.length;for(e=0;e=this._framesRange.start&&e<=this._framesRange.end)this._currFrame=e,this._cachedResidues=!1,this._updateSecondary(),this.frameIsReady=!0;else if(this._frameRequest=e,this._buffer){const t=this;switch(this._buffer.state){case"none":this._prepareBuffer(e);break;case"ready":t._parseBuffer()}}else this._prepareBuffer(e)}disableEvents(){this._callbacks=null}static _vec=(()=>new r.Vector3)();getAtomPos(e){const t=ph._vec,r=this,n=r._data,s=3*(r._atomsCount*(r._currFrame-r._framesRange.start)+e);return t.set(n[s],n[s+1],n[s+2]),t}getResidues(){return this._cachedResidues||this._complex.updateToFrame(this),this._residues}}const mh=ph;class fh{constructor(e,r){if(this.constructor===fh)throw new Error("Can not instantiate abstract class!");this.params=e,this.opts=t().merge(O.deriveDeep(z.now.objects[this.type],!0),r),this.needsRebuild=!1,this._mesh=null,this.id=null}identify(){const e={type:this.type,params:this.params},r=O.objectsDiff(this.opts,z.now.modes[this.id]);return t().isEmpty(r)||(e.opts=r),e}toString(){return`o=${this.type},${this.params.join(",")}`+O.compareOptionsWithDefaults(this.opts,z.defaults.objects[this.type])}getGeometry(){return this._mesh}destroy(){this._mesh&&sr.destroyObject(this._mesh)}}fh.prototype.type="__";const _h=fh;class gh extends _h{constructor(e,t){if(super(e,t),e.length<2)throw new Error("Wrong number of argumets on line object creation!");[this._id1,this._id2]=e}_getAtomFromName(e,t){const r=e.getAtomByFullname(t);if(!r)throw new Error(t+" - Wrong atom format it must be '#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME' (e.g. 'A.38.CO1')");return r}build(e){const t=new r.BufferGeometry;this._atom1=this._getAtomFromName(e,this._id1),this._atom2=this._getAtomFromName(e,this._id2);const n=this._atom1.position,s=this._atom2.position,i=new Float32Array([n.x,n.y,n.z,s.x,s.y,s.z]);t.setAttribute("position",new r.BufferAttribute(i,3)),t.computeBoundingBox(),this._line=new fs.Line(t,new Jn({lights:!1,overrideColor:!0,dashedLine:!0,fogTransparent:z.now.bg.transparent})),this._line.computeLineDistances(),this._line.material.setUberOptions({fixedColor:new r.Color(this.opts.color),dashedLineSize:this.opts.dashSize,dashedLinePeriod:this.opts.dashSize+this.opts.gapSize}),this._line.material.updateUniforms(),this._line.raycast=function(e,t){},this._mesh=this._line;const o=e.getTransforms();o.length>0&&(this._mesh=new r.Group,this._mesh.add(this._line),jo.applyTransformsToMeshes(this._mesh,o))}updateToFrame(e){if(!this._atom1||!this._atom2||!this._line)return;const t=this._line.geometry;t.vertices[0].copy(e.getAtomPos(this._atom1.index)),t.vertices[1].copy(e.getAtomPos(this._atom2.index)),this._line.computeLineDistances(),t.computeBoundingSphere(),t.verticesNeedUpdate=!0}}gh.prototype.constructor=gh,gh.prototype.type="line";const yh=gh;class xh extends r.RawShaderMaterial{constructor(e){super(e);const t={uniforms:{srcTex:{type:"t",value:null},srcDepthTex:{type:"t",value:null},srcTexSize:{type:"v2",value:new r.Vector2(512,512)},color:{type:"v3",value:null},threshold:{type:"f",value:null},opacity:{type:"f",value:1},thickness:{type:"v2",value:new r.Vector2(1,1)}},vertexShader:Qt,fragmentShader:"precision highp float;\r\n\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexSize;\r\nuniform vec2 thickness;\r\nvarying vec2 vUv;\r\n\r\n#ifdef DEPTH_OUTLINE\r\n uniform sampler2D srcDepthTex; //depthTexture\r\n uniform vec3 color;\r\n uniform float threshold;\r\n#endif\r\n\r\nvoid main() {\r\n\r\n vec2 pixelSize = thickness / srcTexSize;\r\n\r\n #ifdef DEPTH_OUTLINE\r\n float c00 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,-pixelSize.y)).x;\r\n float c01 = texture2D(srcDepthTex, vUv + vec2(0,-pixelSize.y)).x;\r\n float c02 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,-pixelSize.y)).x;\r\n float c10 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,0)).x;\r\n float c12 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,0)).x;\r\n float c20 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,pixelSize.y)).x;\r\n float c21 = texture2D(srcDepthTex, vUv + vec2(0,pixelSize.y)).x;\r\n float c22 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,pixelSize.y)).x;\r\n\r\n float horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n float vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n float grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n\r\n gl_FragColor = ( grad > threshold ) ? vec4(color.rgb, 1.0) : gl_FragColor = texture2D(srcTex, vUv);\r\n\r\n #else\r\n vec4 c00 = texture2D(srcTex, vUv + vec2(-pixelSize.x,-pixelSize.y));\r\n vec4 c01 = texture2D(srcTex, vUv + vec2(0,-pixelSize.y));\r\n vec4 c02 = texture2D(srcTex, vUv + vec2(pixelSize.x,-pixelSize.y));\r\n vec4 c10 = texture2D(srcTex, vUv + vec2(-pixelSize.x,0));\r\n vec4 c12 = texture2D(srcTex, vUv + vec2(pixelSize.x,0));\r\n vec4 c20 = texture2D(srcTex, vUv + vec2(-pixelSize.x,pixelSize.y));\r\n vec4 c21 = texture2D(srcTex, vUv + vec2(0,pixelSize.y));\r\n vec4 c22 = texture2D(srcTex, vUv + vec2(pixelSize.x,pixelSize.y));\r\n\r\n vec4 horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n vec4 vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n vec4 grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n gl_FragColor = grad;\r\n #endif\r\n}\r\n",transparent:!0,depthTest:!1,depthWrite:!1};this.setValues(t)}copy(e){super.copy(e),this.depth=e.depth}setValues(e){if(void 0===e)return;super.setValues(e);const t={};this.depth&&(t.DEPTH_OUTLINE=1),this.defines=t}}xh.prototype.depth=!1;const bh=xh;class wh extends r.RawShaderMaterial{constructor(e){super(e),this.setValues.call(this,{uniforms:{srcTex:{type:"t",value:null},srcTexelSize:{type:"v2",value:new r.Vector2(1/512,1/512)},bgColor:{type:"c",value:new r.Color(16777215)}},vertexShader:Qt,fragmentShader:"precision highp float;\r\n\r\n// edge end finding algorithm parameters\r\n#define FXAA_QUALITY_PS 8\r\n#define FXAA_QUALITY_P0 1.0\r\n#define FXAA_QUALITY_P1 1.5\r\n#define FXAA_QUALITY_P2 2.0\r\n#define FXAA_QUALITY_P3 2.0\r\n#define FXAA_QUALITY_P4 2.0\r\n#define FXAA_QUALITY_P5 2.0\r\n#define FXAA_QUALITY_P6 4.0\r\n#define FXAA_QUALITY_P7 12.0\r\n// constants\r\nfloat fxaaQualityEdgeThreshold = 0.125;\r\nfloat fxaaQualityEdgeThresholdMin = 0.0625;\r\nfloat fxaaQualitySubpix = 0.7; //0.65;\r\n// global params\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexelSize;\r\nuniform vec3 bgColor;\r\n// from vs\r\nvarying vec2 vUv;\r\n//=====================================================================//\r\n// calc luminance from rgb\r\n//'float FxaaLuma(vec3 rgb) {return rgb.y * (0.587/0.299) + rgb.x; } // Lotte's idea about game luminance\r\nfloat FxaaLuma(vec3 rgb) {return dot(rgb, vec3(0.299, 0.587, 0.114)); } // real luminance calculation\r\n // for non-real scene rendering\r\n// texture sampling by pixel position(coords) and offset(in pixels)\r\n vec3 FxaaTex(sampler2D tex, vec2 pos, vec2 off, vec2 res ) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos + off * res );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos + off * res ).xyz;\r\n #endif\r\n}\r\nvec3 FxaaTexTop(sampler2D tex, vec2 pos) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos).xyz;\r\n #endif\r\n}\r\nvec4 FxaaTexTopAlpha(sampler2D tex, vec2 pos) {\r\n return texture2D( tex, pos);\r\n}\r\n\r\n//=====================================================================//\r\nvoid main() {\r\n // renaming\r\n vec2 posM = vUv;\r\n // get luminance for neighbours\r\n float lumaS = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, 1.0 ), srcTexelSize));\r\n float lumaE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 0.0 ), srcTexelSize));\r\n float lumaN = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, -1.0 ), srcTexelSize));\r\n float lumaW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 0.0 ), srcTexelSize));\r\n float lumaM = FxaaLuma(FxaaTexTop(srcTex, posM));\r\n // find max and min luminance\r\n float rangeMax = max(max(lumaN, lumaW), max(lumaE, max(lumaS, lumaM)));\r\n float rangeMin = min(min(lumaN, lumaW), min(lumaE, min(lumaS, lumaM)));\r\n // calc maximum non-edge range\r\n float rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\r\n float range = rangeMax - rangeMin;\r\n float rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\r\n // exit when luma contrast is small (is not edge)\r\n if(range < rangeMaxClamped){\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n return;\r\n }\r\n float subpixRcpRange = 1.0/range;\r\n // note: the sampling coordinates can be calculated in vertex shader but the approach doesn't affect performance\r\n // visibly, thus we decided to leave calculation here for better readability.\r\n // calc other neighbours luminance\r\n float lumaNE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, -1.0 ), srcTexelSize));\r\n float lumaSW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 1.0 ), srcTexelSize));\r\n float lumaSE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 1.0 ), srcTexelSize));\r\n float lumaNW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, -1.0 ), srcTexelSize));\r\n/*--------------span calculation and subpix amount calulation-----------------*/\r\n float lumaNS = lumaN + lumaS;\r\n float lumaWE = lumaW + lumaE;\r\n float subpixNSWE = lumaNS + lumaWE;\r\n float edgeHorz1 = (-2.0 * lumaM) + lumaNS;\r\n float edgeVert1 = (-2.0 * lumaM) + lumaWE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNESE = lumaNE + lumaSE;\r\n float lumaNWNE = lumaNW + lumaNE;\r\n float edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\r\n float edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNWSW = lumaNW + lumaSW;\r\n float lumaSWSE = lumaSW + lumaSE;\r\n float edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\r\n float edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\r\n float edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\r\n float edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\r\n float edgeHorz = abs(edgeHorz3) + edgeHorz4;\r\n float edgeVert = abs(edgeVert3) + edgeVert4;\r\n/*--------------------subpix amount calulation------------------------------*/\r\n float subpixNWSWNESE = lumaNWSW + lumaNESE;\r\n float lengthSign = srcTexelSize.x;\r\n bool horzSpan = edgeHorz >= edgeVert;\r\n // debug code edge span visualization\r\n/*' if (horzSpan)\r\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);\r\n else\r\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\r\n return;*/\r\n float subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\r\n/*--------------------------------------------------------------------------*/\r\n if(!horzSpan) lumaN = lumaW;\r\n if(!horzSpan) lumaS = lumaE;\r\n if(horzSpan) lengthSign = srcTexelSize.y;\r\n float subpixB = (subpixA * (1.0/12.0)) - lumaM;\r\n/*--------------------------------------------------------------------------*/\r\n float gradientN = lumaN - lumaM;\r\n float gradientS = lumaS - lumaM;\r\n float lumaNN = lumaN + lumaM;\r\n float lumaSS = lumaS + lumaM;\r\n bool pairN = abs(gradientN) >= abs(gradientS);\r\n float gradient = max(abs(gradientN), abs(gradientS));\r\n if(pairN) lengthSign = -lengthSign;\r\n float subpixC = clamp(abs(subpixB) * subpixRcpRange, 0.0, 1.0);\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posB;\r\n posB = posM;\r\n vec2 offNP;\r\n offNP.x = (!horzSpan) ? 0.0 : srcTexelSize.x;\r\n offNP.y = ( horzSpan) ? 0.0 : srcTexelSize.y;\r\n if(!horzSpan) posB.x += lengthSign * 0.5;\r\n if( horzSpan) posB.y += lengthSign * 0.5;\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posN;\r\n posN = posB - offNP * FXAA_QUALITY_P0;\r\n vec2 posP;\r\n posP = posB + offNP * FXAA_QUALITY_P0;\r\n float subpixD = ((-2.0)*subpixC) + 3.0;\r\n float lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN));\r\n float subpixE = subpixC * subpixC;\r\n float lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP));\r\n/*--------------------------------------------------------------------------*/\r\n if(!pairN) lumaNN = lumaSS;\r\n float gradientScaled = gradient * 1.0/4.0;\r\n float lumaMM = lumaM - lumaNN * 0.5;\r\n float subpixF = subpixD * subpixE;\r\n bool lumaMLTZero = lumaMM < 0.0;\r\n/*---------------------looped edge-end search-------------------------------*/\r\n lumaEndN -= lumaNN * 0.5;\r\n lumaEndP -= lumaNN * 0.5;\r\n bool doneN = abs(lumaEndN) >= gradientScaled;\r\n bool doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P1;\r\n bool doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P1;\r\n/*--------------------------------------------------------------------------*/\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P2;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P2;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 3)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P3;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P3;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 4)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P4;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P4;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 5)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P5;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P5;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 6)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P6;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P6;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 7)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P7;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P7;\r\n/*--------------------------------------------------------------------------*/\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n/*----------------calculate subpix offset due to edge ends-------------------*/\r\n float dstN = posM.x - posN.x;\r\n float dstP = posP.x - posM.x;\r\n if(!horzSpan) dstN = posM.y - posN.y;\r\n if(!horzSpan) dstP = posP.y - posM.y;\r\n/*--------------------------------------------------------------------------*/\r\n bool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\r\n float spanLength = (dstP + dstN);\r\n bool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\r\n float spanLengthRcp = 1.0 / spanLength;\r\n/*--------------------------------------------------------------------------*/\r\n bool directionN = dstN < dstP;\r\n float dst = min(dstN, dstP);\r\n bool goodSpan = directionN ? goodSpanN : goodSpanP;\r\n float subpixG = subpixF * subpixF;\r\n float pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\r\n float subpixH = subpixG * fxaaQualitySubpix;\r\n/*-----------------calc texture offest using subpix-------------------------*/\r\n float pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\r\n float pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\r\n\r\n float offset = pixelOffsetSubpix * lengthSign;\r\n #ifdef BG_TRANSPARENT\r\n // get original texel\r\n vec4 rgbaA = FxaaTexTopAlpha(srcTex, posM);\r\n // calc step to blended texel\r\n vec2 step = sign((!horzSpan) ? vec2 (offset, 0.0) : vec2 (0.0, offset));\r\n // get neighboring texel\r\n vec4 rgbaB = FxaaTexTopAlpha(srcTex, posM + step * srcTexelSize);\r\n // calc blend factor from offset\r\n float f = (!horzSpan) ? offset / srcTexelSize.x : offset / srcTexelSize.y;\r\n f = abs(f);\r\n // calc alpha (special formula to emulate blending with bg)\r\n gl_FragColor.a = 1.0 - mix(1.0 - rgbaA.a, 1.0 - rgbaB.a, f);\r\n // calc color (special formula to emulate blending with bg)\r\n gl_FragColor.rgb = mix(rgbaA.rgb * rgbaA.a, rgbaB.rgb * rgbaB.a, f) / gl_FragColor.a;\r\n #else\r\n if(!horzSpan) {\r\n posM.x += offset;\r\n } else {\r\n posM.y += offset;\r\n }\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n #endif\r\n return;\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1}),this.setValues(e)}copy(e){super.copy(e),this.depth=e.depth}setValues(e){if(void 0===e)return;super.setValues(e);const t={};this.bgTransparent&&(t.BG_TRANSPARENT=1),this.defines=t}}wh.prototype.bgTransparent=!1;const Sh=wh,vh=[new r.Vector3(.295184,.077723,.068429),new r.Vector3(-.271976,-.365221,.838363),new r.Vector3(.547713,.467576,.488515),new r.Vector3(.662808,-.031733,.584758),new r.Vector3(-.025717,.218955,.657094),new r.Vector3(-.310153,-.365223,.370701),new r.Vector3(-.101407,-.006313,.747665),new r.Vector3(-.769138,.360399,.086847),new r.Vector3(-.271988,-.27514,.905353),new r.Vector3(.09674,-.566901,.700151),new r.Vector3(.562872,-.735136,.094647),new r.Vector3(.379877,.359278,.190061),new r.Vector3(.519064,-.023055,.405068),new r.Vector3(-.301036,.114696,.088885),new r.Vector3(-.282922,.598305,.487214),new r.Vector3(-.181859,.25167,.679702),new r.Vector3(-.191463,-.635818,.512919),new r.Vector3(-.293655,.427423,.078921),new r.Vector3(-.267983,.680534,.13288),new r.Vector3(.139611,.319637,.477439),new r.Vector3(-.352086,.31104,.653913),new r.Vector3(.321032,.805279,.487345),new r.Vector3(.073516,.820734,.414183),new r.Vector3(-.155324,.589983,.41146),new r.Vector3(.335976,.170782,.527627),new r.Vector3(.46346,-.355658,.167689),new r.Vector3(.222654,.59655,.769406),new r.Vector3(.922138,-.04207,.147555),new r.Vector3(-.72705,-.329192,.369826),new r.Vector3(-.090731,.53382,.463767),new r.Vector3(-.323457,-.876559,.238524),new r.Vector3(-.663277,-.372384,.342856)];class Ch extends r.RawShaderMaterial{constructor(){super(),this.setValues.call(this,{uniforms:{noiseTexture:{type:"t",value:Yn.noiseTexture},noiseTexelSize:{type:"v2",value:new r.Vector2(1/Yn.noiseWidth,1/Yn.noiseHeight)},diffuseTexture:{type:"t",value:null},normalTexture:{type:"t",value:null},depthTexture:{type:"t",value:null},srcTexelSize:{type:"v2",value:new r.Vector2(1/512,1/512)},camNearFar:{type:"v2",value:new r.Vector2(1,10)},projMatrix:{type:"mat4",value:new r.Matrix4},aspectRatio:{type:"f",value:0},tanHalfFOV:{type:"f",value:0},samplesKernel:{type:"v3v",value:vh},kernelRadius:{type:"f",value:1},depthThreshold:{type:"f",value:1},factor:{type:"f",value:1}},vertexShader:Qt,fragmentShader:"precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 32\r\nuniform vec3 samplesKernel[MAX_SAMPLES_COUNT];\r\nuniform sampler2D noiseTexture;\r\nuniform vec2 noiseTexelSize;\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D depthTexture;\r\nuniform sampler2D normalTexture;\r\nuniform vec2 srcTexelSize;\r\nuniform vec2 camNearFar;\r\nuniform mat4 projMatrix;\r\n\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\nuniform float kernelRadius;\r\nuniform float depthThreshold;\r\nuniform float factor;\r\n\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n // remap coordinates to prevent noise exture rescale\r\n vec2 vUvNoise = vUv / srcTexelSize * noiseTexelSize;\r\n vec4 normalData = texture2D(normalTexture, vUv);\r\n // return for background fragments (their normals are zero vectors)\r\n if (length(normalData.rgb) < EPSILON) {\r\n // 0.0 in alpha component means that it is background fragment\r\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\r\n return;\r\n }\r\n //[0, 1] -> [-1, 1]\r\n vec3 normal = (normalData.rgb * 2.0 - 1.0);\r\n // normalData.a store 1.0 if normal was build for frontfaced surface\r\n // and 0.0 in other case\r\n if (normalData.a < EPSILON) {\r\n normal *= -1.0;\r\n }\r\n // get random vector for sampling sphere rotation\r\n vec3 randN = texture2D(noiseTexture, vUvNoise).rgb * 2.0 - 1.0;\r\n randN = normalize(randN);\r\n // build TBN (randomly rotated around normal)\r\n vec3 tangent = normalize(randN - normal * dot(randN, normal));\r\n vec3 bitangent = cross(tangent, normal);\r\n mat3 TBN = mat3(tangent, bitangent, normal);\r\n // calc AO value\r\n float AO = 0.0;\r\n for (int i = 0 ; i < MAX_SAMPLES_COUNT ; i++) {\r\n // rotate sampling kernel around normal\r\n vec3 reflectedSample = TBN * samplesKernel[i];\r\n // get sample\r\n vec3 samplePos = viewPos + reflectedSample * kernelRadius;\r\n\r\n // project sample to screen to get sample's screen pos\r\n vec4 SampleScrPos = vec4(samplePos, 1.0);\r\n // eye -> clip\r\n SampleScrPos = projMatrix * SampleScrPos;\r\n // normalize\r\n SampleScrPos.xy /= SampleScrPos.w;\r\n //[-1, 1] -> [0, 1]\r\n SampleScrPos.xy = (SampleScrPos.xy + vec2(1.0)) * 0.5;\r\n\r\n // get view z for sample projected to the objct surface\r\n float sampleDepth = CalcViewZ(SampleScrPos.xy);\r\n // calc occlusion made by object surface at the sample\r\n AO += step(samplePos.z, sampleDepth);\r\n }\r\n // calc result AO-map color\r\n AO = 1.0 - max(0.0, AO / float(MAX_SAMPLES_COUNT) * factor);\r\n // write value to AO-map\r\n gl_FragColor = vec4(AO, AO, AO, 1.0);\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1})}}const Ah=Ch,Eh=[-2,-1,0,1,2];class Th extends r.RawShaderMaterial{constructor(){super(),this.setValues.call(this,{uniforms:{depthTexture:{type:"t",value:null},srcTexelSize:{type:"v2",value:new r.Vector2(1/512,1/512)},aoMap:{type:"t",value:null},samplesOffsets:{type:"fv1",value:Eh}},vertexShader:Qt,fragmentShader:"precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = res;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x + samplesOffsets[i] * srcTexelSize.x, y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb = res.rgb / weightSum;\r\n gl_FragColor = res;\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1})}}const Rh=Th,Mh=[-2,-1,0,1,2];class Ph extends r.RawShaderMaterial{constructor(e){super(e),this.setValues.call(this,{uniforms:{diffuseTexture:{type:"t",value:null},depthTexture:{type:"t",value:null},srcTexelSize:{type:"v2",value:new r.Vector2(1/512,1/512)},aoMap:{type:"t",value:null},samplesOffsets:{type:"fv1",value:Mh},projMatrix:{type:"mat4",value:new r.Matrix4},aspectRatio:{type:"f",value:0},tanHalfFOV:{type:"f",value:0},fogNearFar:{type:"v2",value:new r.Vector2(100,100)},fogColor:{type:"v4",value:new r.Vector4(0,.5,0,1)}},vertexShader:Qt,fragmentShader:"precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nuniform mat4 projMatrix;\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\n#ifdef USE_FOG\r\n uniform vec2 fogNearFar;\r\n uniform vec4 fogColor;\r\n#endif\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 color = texture2D(diffuseTexture, vec2(x, y));\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x, y + samplesOffsets[i] * srcTexelSize.y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb /= weightSum;\r\n\r\n #if defined(USE_FOG) && !defined(FOG_TRANSPARENT)\r\n // Add fog to the result value\r\n // Proper way to get an image with fog and ao requires formula:\r\n // gl_FragColor = fragColor*AO*(1-fogFactor) + fogColor*fogFactor\r\n // But we have already fogged molecule to add AO too. Let's split the straight formula into our real steps!\r\n // We have: AO, fogFactor, fogColor,\r\n // color = fragColor*(1-fogFactor) + fogColor*fogFactor (it comes from diffuseTexture,\r\n // where molecule has been already drawn with fog)\r\n // Transform:\r\n // fragColor*AO*(1-fogFactor) + fogColor*fogFactor =\r\n // = [fragColor*(1-fogFactor) = color - fogColor*fogFactor] =\r\n // = (color - fogColor*fogFactor)*AO + fogColor*fogFactor =\r\n // = color*AO + fogColor*fogFactor*(1 - AO)\r\n // Result: gl_FragColor = color*AO + fogColor*fogFactor*(1 - AO)\r\n float fogFactor = smoothstep(fogNearFar.x, fogNearFar.y, - viewPos.z) * fogColor.a;\r\n gl_FragColor.rgb = color.rgb * res.rgb + fogColor.rgb * fogFactor *(vec3(1.0, 1.0, 1.0) - res.rgb);\r\n #else\r\n gl_FragColor.rgb = color.rgb * res.rgb;\r\n #endif\r\n gl_FragColor.a = color.a;\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1}),this.setValues(e)}setValues(e){if(void 0===e)return;super.setValues(e);const t={};this.useFog&&(t.USE_FOG=1),this.fogTransparent&&(t.FOG_TRANSPARENT=1),this.defines=t}}Ph.prototype.useFog=!0,Ph.prototype.fogTransparent=!1;const Nh=Ph;class Lh extends r.RawShaderMaterial{constructor(){super();const e={uniforms:{srcL:{type:"t",value:null},srcR:{type:"t",value:null}},vertexShader:Qt,fragmentShader:"precision highp float;\r\n\r\nuniform sampler2D srcL;\r\nuniform sampler2D srcR;\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vec4 l = texture2D(srcL, vUv);\r\n vec4 r = texture2D(srcR, vUv);\r\n gl_FragColor = vec4(l.r, r.g, r.b, 1.0);\r\n}\r\n",transparent:!1,depthTest:!1,depthWrite:!1};this.setValues(e)}}const Ih=Lh;class Oh{constructor(){this.position=new r.Vector3(0,0,0),this.scale=1,this.orientation=new r.Quaternion(0,0,0,1)}set(e,t,r){this.position=e,this.scale=t,this.orientation=r}}class Vh{setup(e,t){this._startTime=void 0,this._endTime=void 0,this._isPaused=!1,this._srcView=e,this._dstView=t,this._isMoving=!1}isMoving(){return this._isMoving}wasStarted(){return void 0!==this._startTime&&void 0!==this._endTime}start(){this._startTime=Date.now();const e=z.now.interpolateViews?1500:0;this._endTime=this._startTime+e,this._isMoving=!0}getCurrentView(){if(void 0===this._srcView||void 0===this._dstView||!this._isMoving||!this.wasStarted())return{success:!1};let e=this.createView();const t=Date.now();if(t>this._endTime)return e=this._dstView,this.reset(),{success:!0,view:e};const r=(t-this._startTime)/(this._endTime-this._startTime);return e.position.copy(this._srcView.position),e.position.lerp(this._dstView.position,r),e.scale=(1-r)*this._srcView.scale+r*this._dstView.scale,e.orientation.copy(this._srcView.orientation),e.orientation.slerp(this._dstView.orientation,r),{success:!0,view:e}}reset(){this._startTime=this._endTime=0,this._isMoving=!1}pause(){this._isPaused||(this.setup(this.getCurrentView().view,this._dstView),this._isPaused=!0)}resume(){this._isPaused=!1}createView(){return new Oh}}function Dh(e,r){this.context=e,this._opts=t().merge({path:"/"},r)}ur(Dh.prototype),Dh.prototype.removeCookie=function(e){const t=this._toCount(e);let r=this._getSimpleCookie(t);if(r){this._removeSimpleCookie(t),r=parseInt(r,10);for(let t=0;tt?function(t){t.style.display="",t.style.cursor="pointer",t.style.left="calc(50% - 50px)",t.style.width="100px",t.textContent="ENTER VR";let r=null;function n(){r.removeEventListener("end",n),t.textContent="ENTER VR",r=null}function s(s){s.addEventListener("end",n),e._gfx.renderer.xr.setReferenceSpaceType("local"),e._gfx.renderer.xr.setSession(s),t.textContent="EXIT VR",r=s}t.onmouseenter=function(){t.style.opacity="1.0"},t.onmouseleave=function(){t.style.opacity="0.5"},t.onclick=function(){if(null===r){const t={optionalFeatures:["local-floor","bounded-floor"]};navigator.xr.requestSession("immersive-vr",t).then(s),e.moveSceneBehindHeadset()}else r.end()}}(r):function(e){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.textContent="VR NOT FOUND",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}(r))),r}const r=document.createElement("a");return r.href="https://webvr.info",r.innerHTML="WEBXR NOT SUPPORTED",r.style.left="calc(50% - 90px)",r.style.width="180px",r.style.textDecoration="none",t(r),r}class Fh{constructor(e){this._mainCamera=new r.PerspectiveCamera,this._button=null,this._onToggle=e,this._molContainer=new sr.RCGroup,this._user=new sr.RCGroup,this._scalingPivot=new r.Object3D,this._user.add(this._scalingPivot),this._controller1=null,this._controller2=null,this._pressedGripsCounter=0,this._distance=0,this._gfx=null}startScalingByControllers(){this._distance=this._controller1.position.distanceTo(this._controller2.position),sr.getMiddlePoint(this._controller1.position,this._controller2.position,this._scalingPivot.position),this._scalingPivot.scale.set(1,1,1),this._scalingPivot.updateMatrix(),this._scalingPivot.updateMatrixWorld(),this._scalingPivot.addSavingWorldTransform(this._molContainer)}stopScalingByControllers(){this._gfx.scene.addSavingWorldTransform(this._molContainer)}handleGripsDown(e){this._pressedGripsCounter++,2===this._pressedGripsCounter?this.startScalingByControllers():1===this._pressedGripsCounter&&e.target.addSavingWorldTransform(this._molContainer)}handleGripsUp(e){if(this._pressedGripsCounter--,1===this._pressedGripsCounter){this.stopScalingByControllers();(e.target===this._controller1?this._controller2:this._controller1).addSavingWorldTransform(this._molContainer)}else 0===this._pressedGripsCounter&&this._gfx.scene.addSavingWorldTransform(this._molContainer)}enable(e){if(!e)return void w.warn("WebVR couldn't be enabled, because gfx is not defined");this._gfx=e;const{renderer:t,camera:r}=e;if(!t)throw new Error("No renderer is available to toggle WebVR");if(!r)throw new Error("No camera is available to toggle WebVR");t.xr.enabled=!0,this._button?this._button.style.display="block":(this._button=zh(this),document.body.appendChild(this._button)),this._mainFog=z.now.fog,z.set("fog",!1),this._plugVRNodesIntoScene(e,t),this._setControllersListeners(),this._onToggle&&this._onToggle(!0)}_plugVRNodesIntoScene(e,t){this._mainCamera.copy(e.camera),e.scene.add(this._user),e.scene.add(this._molContainer),this._molContainer.add(e.root),this._controller1=t.xr.getController(0),this._controller2=t.xr.getController(1);const r=this._createControllerMesh();this._controller1.add(r),this._controller2.add(r.clone()),this._user.add(this._controller1),this._user.add(this._controller2)}_setControllersListeners(){this._controller1.addEventListener("selectstart",(e=>{this.handleGripsDown(e)})),this._controller1.addEventListener("selectend",(e=>{this.handleGripsUp(e)})),this._controller2.addEventListener("selectstart",(e=>{this.handleGripsDown(e)})),this._controller2.addEventListener("selectend",(e=>{this.handleGripsUp(e)})),this._controller1.addEventListener("squeezestart",(e=>{this.handleGripsDown(e)})),this._controller1.addEventListener("squeezeend",(e=>{this.handleGripsUp(e)})),this._controller2.addEventListener("squeezestart",(e=>{this.handleGripsDown(e)})),this._controller2.addEventListener("squeezeend",(e=>{this.handleGripsUp(e)}))}disable(){if(!this._gfx)return;const{renderer:e,camera:t}=this._gfx;if(!e)throw new Error("No renderer is available to toggle WebVR");e.setAnimationLoop(null);const r=e.xr.getSession();r&&r.end(),e.xr.enabled=!1,this._button&&(this._button.style.display="none"),z.set("fog",this._mainFog),this._unplugVRNodesFromScene(t),this._onToggle&&this._onToggle(!1)}_unplugVRNodesFromScene(e){this._mainCamera&&e&&e.copy(this._mainCamera);const t=this._molContainer.children[0];t&&this._gfx.scene.add(t),this._molContainer.parent.remove(this._molContainer),this._user&&this._gfx.scene.remove(this._user),this._molContainer=null,this._user=null,this._scalingPivot=null,this._user=null,this._controller1=null,this._controller2=null}_createControllerMesh(){const e=new r.CylinderGeometry(.04,.04,.3),t=new Jn({lights:!1,overrideColor:!0});t.setUberOptions({fixedColor:new r.Color(4474111)}),t.updateUniforms();const n=new r.Mesh(e,t);return n.rotateX(-Math.PI/2),n}updateMoleculeScale(){if(!this._controller1||!this._controller2)return;const e=this;if(2===e._pressedGripsCounter){sr.getMiddlePoint(e._controller1.position,e._controller2.position,e._scalingPivot.position);const t=e._controller1.position.distanceTo(e._controller2.position),r=t/e._distance;e._scalingPivot.scale.multiplyScalar(r),e._distance=t}}moveSceneBehindHeadset(){const e=this._gfx,{camera:t}=e,r=this._molContainer;r.matrix.identity(),r.position.set(0,0,-4),r.updateMatrix(),r.matrixWorld.multiplyMatrices(t.matrixWorld,r.matrix),e.scene.addSavingWorldTransform(r),this._onToggle&&this._onToggle(!0)}getCanvas(){const e=this._gfx;return e&&e.renderer?e.renderer.domElement:null}}const{selectors:Bh,Atom:Uh,Residue:Gh,Chain:jh,Molecule:Hh}=Yt,$h=0,Wh=1,Yh=2,Xh="Could not find suitable loader for this source";r.ColorManagement.enabled=!1;const{createElement:qh}=O;function Zh(e){const t=e.lastIndexOf(".");return t>=0&&(e=e.substr(0,t)),e}function Kh(e,t,r){void 0!==r?e.debug(`${t}... ${Math.floor(100*r)}%`):e.debug(`${t}...`)}function Qh(){return z.now.fogColorEnable?z.now.fogColor:z.now.bg.color}function Jh(e){g.call(this),this._opts=t().merge({settingsCookie:"settings",cookiePath:"/"},e),this._gfx=null,this._interpolator=new Vh,this._container=e&&e.container||document.getElementById("miew-container")||t().head(document.getElementsByClassName("miew-container"))||document.body,this._containerRoot=this._container,this._running=!1,this._halting=!1,this._building=!1,this._needRender=!0,this._hotKeysEnabled=!0,this.settings=z;const r=w;r.console=!1,r.level="info",this.logger=r,this._cookies=new kh(this),this.restoreSettings(),e&&e.settings&&this.settings.set(e.settings),this._spinner=null,this._loading=[],this._animInterval=null,this._visuals={},this._curVisualName=null,this._objects=[],this._sourceWindow=null,this.reset(),this._repr&&r.debug(`Selected ${this._repr.mode.name} mode with ${this._repr.colorer.name} colorer.`);const n=this;Jh.registeredPlugins.forEach((e=>{e.call(n)})),this._initOnSettingsChanged()}function eu(e,t){const r=e;for(;r.firstChild;)r.removeChild(r.firstChild);r.appendChild(t)}function tu(e){return e.getExtension("EXT_frag_depth")}function ru(e){return e.getExtension("WEBGL_depth_texture")&&e.getExtension("WEBGL_draw_buffers")}Jh.prototype=Object.create(g.prototype),Jh.prototype.constructor=Jh,Jh.prototype.getMaxRepresentationCount=function(){return Qo.NUM_REPRESENTATION_BITS},Jh.prototype._updateShadowCamera=function(){const e=new r.Matrix4,t=new r.Vector3,n={center:new r.Vector3,halfSize:new r.Vector3};return function(){this._gfx.scene.updateMatrixWorld();for(let r=0;r{n._onKeyDown(e)})),e.addEventListener("keyup",(e=>{n._onKeyUp(e)})),this._objectControls=new ih(this._gfx.root,this._gfx.pivot,this._gfx.camera,this._gfx.renderer.domElement,(()=>n._getAltObj())),this._objectControls.addEventListener("change",(e=>{switch(z.now.shadow.on&&n._updateShadowCamera(),e.action){case"rotate":n.dispatchEvent({type:"rotate",quaternion:e.quaternion});break;case"zoom":n.dispatchEvent({type:"zoom",factor:e.factor});break;default:n.dispatchEvent({type:e.action})}n.dispatchEvent({type:"transform"}),n._needRender=!0}));const t=this._gfx;this._picker=new ah(t.root,t.camera,t.renderer.domElement),this._picker.addEventListener("newpick",(e=>{n._onPick(e)})),this._picker.addEventListener("dblclick",(e=>{n.center(e)}))}catch(e){if("TypeError"===e.name&&"Cannot read property 'getExtension' of null"===e.message)this._showMessage("Could not create WebGL context.");else{if(!(e.message.search(/webgl/i)>1))throw this._showMessage("Viewer initialization failed."),e;this._showMessage(e.message)}return!1}const s=this._opts&&this._opts.load;if(s){const e=this._opts&&this._opts.type;this.load(s,{fileType:e,keepRepsInfo:!0})}return!0},Jh.prototype.term=function(){this._showMessage("Viewer has been terminated."),this._loading.forEach((e=>{e.cancel()})),this._loading.length=0,this.halt(),this._gfx=null},Jh.prototype._showMessage=function(e){const t=document.createElement("div");t.setAttribute("class","miew-message"),t.appendChild(document.createElement("p")).appendChild(document.createTextNode(e)),eu(this._container,t)},Jh.prototype._showCanvas=function(){eu(this._container,this._gfx.renderer.domElement)},Jh.prototype._requestAnimationFrame=function(e){const{xr:t}=this._gfx.renderer;t&&t.enabled?this._gfx.renderer.setAnimationLoop(e):requestAnimationFrame(e)},Jh.prototype._initGfx=function(){const e={width:this._container.clientWidth,height:this._container.clientHeight},t={preserveDrawingBuffer:!0,alpha:!0,premultipliedAlpha:!1};z.now.antialias&&(t.antialias=!0),e.renderer2d=new Xc,e.renderer=new r.WebGL1Renderer(t),e.renderer.shadowMap.enabled=z.now.shadow.on,e.renderer.shadowMap.autoUpdate=!1,e.renderer.shadowMap.type=r.PCFShadowMap,Fn.init(e.renderer),tu(e.renderer.getContext())||z.set("zSprites",!1),ru(e.renderer.getContext())||z.set("ao",!1),e.renderer.autoClear=!1,e.renderer.setPixelRatio(window.devicePixelRatio),e.renderer.setSize(e.width,e.height),e.renderer.setClearColor(z.now.bg.color,Number(!z.now.bg.transparent)),e.renderer.clearColor(),e.renderer2d.setSize(e.width,e.height),e.camera=new r.PerspectiveCamera(z.now.camFov,e.width/e.height,z.now.camNear,z.now.camFar),e.camera.setMinimalFov(z.now.camFov),e.camera.position.z=z.now.camDistance,e.camera.updateProjectionMatrix(),e.camera.layers.set(sr.LAYERS.DEFAULT),e.camera.layers.enable(sr.LAYERS.VOLUME),e.camera.layers.enable(sr.LAYERS.VOLUME_BFPLANE),e.stereoCam=new r.StereoCamera,e.scene=new r.Scene;const n=Qh();e.scene.fog=new r.Fog(n,z.now.camNear,z.now.camFar),e.root=new sr.RCGroup,e.scene.add(e.root),e.pivot=new sr.RCGroup,e.root.add(e.pivot),e.selectionScene=new r.Scene,e.selectionRoot=new r.Group,e.selectionRoot.matrixAutoUpdate=!1,e.selectionScene.add(e.selectionRoot),e.selectionPivot=new r.Group,e.selectionPivot.matrixAutoUpdate=!1,e.selectionRoot.add(e.selectionPivot);const s=new r.DirectionalLight(16777215,.45);s.position.set(0,.414,1),s.layers.enable(sr.LAYERS.TRANSPARENT),s.castShadow=!0,s.shadow.bias=.09,s.shadow.radius=z.now.shadow.radius,s.shadow.camera.layers.set(sr.LAYERS.SHADOWMAP);const i=e.renderer.getPixelRatio(),o=Math.max(e.width,e.height)*i;s.shadow.mapSize.width=o,s.shadow.mapSize.height=o,s.target.position.set(0,0,0),e.scene.add(s),e.scene.add(s.target);const a=new r.AmbientLight(6710886);a.layers.enable(sr.LAYERS.TRANSPARENT),e.scene.add(a),e.axes=new lh(e.root,e.camera);const l=e.width*i,c=e.height*i;e.offscreenBuf=new r.WebGLRenderTarget(l,c,{minFilter:r.LinearFilter,magFilter:r.NearestFilter,format:r.RGBAFormat,depthBuffer:!0}),e.renderer.getContext().getExtension("WEBGL_depth_texture")&&(e.offscreenBuf.depthTexture=new r.DepthTexture,e.offscreenBuf.depthTexture.type=r.UnsignedShortType),e.offscreenBuf2=new r.WebGLRenderTarget(l,c,{minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBAFormat,depthBuffer:!1}),e.offscreenBuf3=new r.WebGLRenderTarget(l,c,{minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBAFormat,depthBuffer:!1}),e.offscreenBuf4=new r.WebGLRenderTarget(l,c,{minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBAFormat,depthBuffer:!1}),e.volBFTex=e.offscreenBuf3,e.volFFTex=e.offscreenBuf4,e.volWFFTex=e.offscreenBuf,e.renderer.getContext().getExtension("OES_texture_float")?(e.offscreenBuf5=new r.WebGLRenderTarget(l,c,{minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBAFormat,type:r.FloatType,depthBuffer:!1}),e.offscreenBuf6=new r.WebGLRenderTarget(l,c,{minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBAFormat,type:r.FloatType,depthBuffer:!1}),e.offscreenBuf7=new r.WebGLRenderTarget(l,c,{minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBAFormat,type:r.FloatType,depthBuffer:!0}),e.volBFTex=e.offscreenBuf5,e.volFFTex=e.offscreenBuf6,e.volWFFTex=e.offscreenBuf7):this.logger.warn("Device doesn't support OES_texture_float extension"),e.stereoBufL=new r.WebGLRenderTarget(l,c,{minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBAFormat,depthBuffer:!1}),e.stereoBufR=new r.WebGLRenderTarget(l,c,{minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBAFormat,depthBuffer:!1}),this._gfx=e,this._showCanvas(),this._embedWebXR("WEBVR"===z.now.stereo),this._container.appendChild(e.renderer2d.getElement());const h=new m;h.domElement.style.position="absolute",h.domElement.style.right="0",h.domElement.style.bottom="0",this._container.appendChild(h.domElement),this._fps=h,this._fps.show(z.now.fps)},Jh.prototype._initListeners=function(){const e=this;window.addEventListener("resize",(()=>{e._onResize()}))},Jh.prototype._makeUniqueVisualName=function(e){if(!e)return Math.random().toString();let t=e,r=1;for(;this._visuals.hasOwnProperty(t);)t=`${e} (${r.toString()})`,r++;return t},Jh.prototype._addVisual=function(e){if(!e)return null;const t=this._makeUniqueVisualName(e.name);return e.name=t,this._visuals[t]=e,this._gfx.pivot.add(e),e.getSelectionGeo&&this._gfx.selectionPivot.add(e.getSelectionGeo()),t},Jh.prototype._removeVisual=function(e){let t="",r=null;e instanceof ar?(({name:t}=e),r=e):"string"==typeof e&&(t=e,r=this._visuals[t]),r&&this._visuals.hasOwnProperty(t)&&this._visuals[t]===r&&(t===this._curVisualName&&(this._curVisualName=void 0),delete this._visuals[t],r.release(),this._needRender=!0)},Jh.prototype._forEachVisual=function(e){for(const t in this._visuals)this._visuals.hasOwnProperty(t)&&e(this._visuals[t])},Jh.prototype._releaseAllVisuals=function(){if(this._gfx&&this._gfx.pivot){for(const e in this._visuals)this._visuals.hasOwnProperty(e)&&this._visuals[e].release();this._visuals={}}},Jh.prototype._forEachComplexVisual=function(e){if(this._gfx&&this._gfx.pivot)for(const t in this._visuals)this._visuals.hasOwnProperty(t)&&this._visuals[t]instanceof Qo&&e(this._visuals[t])},Jh.prototype._getComplexVisual=function(e){e=e||this._curVisualName;let t=null,r=null;return this._forEachComplexVisual((n=>{t=n,n.name===e&&(r=n)})),r||t},Jh.prototype._getVolumeVisual=function(){let e=null;return this._forEachVisual((t=>{t instanceof pa&&(e=t)})),e},Jh.prototype._getVisualForComplex=function(e){if(!e)return null;let t=null;return this._forEachComplexVisual((r=>{r.getComplex()===e&&(t=r)})),t},Jh.prototype.getVisuals=function(){return Object.keys(this._visuals)},Jh.prototype.getComplexVisualsCount=function(){let e=0;return this._forEachComplexVisual((()=>e++)),e},Jh.prototype.getCurrentVisual=function(){return this._curVisualName},Jh.prototype.setCurrentVisual=function(e){this._visuals[e]&&(this._curVisualName=e)},Jh.prototype.run=function(){if(!this._running){if(this._running=!0,this._halting)return void(this._halting=!1);this._objectControls.enable(!0),this._interpolator.resume(),this._requestAnimationFrame((()=>this._onTick()))}},Jh.prototype.halt=function(){this._running&&(this._discardComponentEdit(),this._discardFragmentEdit(),this._objectControls.enable(!1),this._interpolator.pause(),this._halting=!0)},Jh.prototype.enableHotKeys=function(e){this._hotKeysEnabled=e,this._objectControls.enableHotkeys(e)},Jh.prototype._onResize=function(){const e=this._gfx;e&&(this._needRender=!0,e.width=this._container.clientWidth,e.height=this._container.clientHeight,e.camera.aspect=e.width/e.height,e.camera.setMinimalFov(z.now.camFov),e.camera.updateProjectionMatrix(),e.renderer.setSize(e.width,e.height),e.renderer2d.setSize(e.width,e.height),this.dispatchEvent({type:"resize"}))},Jh.prototype._resizeOffscreenBuffers=function(e,t,r){const n=this._gfx,s="NONE"===(r=r||"NONE")||"ANAGLYPH"===r,i=s?1:.5;n.offscreenBuf.setSize(i*e,t),n.offscreenBuf2.setSize(i*e,t),n.offscreenBuf3.setSize(i*e,t),n.offscreenBuf4.setSize(i*e,t),n.offscreenBuf5&&n.offscreenBuf5.setSize(i*e,t),n.offscreenBuf6&&n.offscreenBuf6.setSize(i*e,t),n.offscreenBuf7&&n.offscreenBuf7.setSize(i*e,t),s&&(n.stereoBufL.setSize(e,t),n.stereoBufR.setSize(e,t))},Jh.prototype._onTick=function(){if(this._halting)return this._running=!1,void(this._halting=!1);this._fps.update(),this._requestAnimationFrame((()=>this._onTick())),this._onUpdate(),this._needRender&&(this._onRender(),this._needRender=!z.now.suspendRender||"WEBVR"===z.now.stereo)},Jh.prototype._getBSphereRadius=function(){let e=0;return this._forEachVisual((t=>{e=Math.max(e,t.getBoundaries().boundingSphere.radius)})),e*this._objectControls.getScale()},Jh.prototype.getOBB=function(){const e=new r.Sphere,t=new r.Box3,n=new r.Box3,s=new r.Matrix4,i=[new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3];return function(r,o){n.makeEmpty(),this._forEachVisual((s=>{e.copy(s.getBoundaries().boundingSphere),e.applyMatrix4(s.matrixWorld).applyMatrix4(r),e.getBoundingBox(t),n.union(t)})),n.getCenter(o.center),s.copy(r).invert(),o.center.applyMatrix4(s);const{min:a}=n,{max:l}=n;i[0].set(a.x,a.y,a.z),i[1].set(l.x,a.y,a.z),i[2].set(a.x,l.y,a.z),i[3].set(a.x,a.y,l.z);for(let e=0,t=i.length;e{e.getComplex().update()})),z.now.autobuild&&!this._loading.length&&!this._building&&this._needRebuild()&&this.rebuild(),this._loading.length||this._building||this._needRebuild()||this._updateView(),this._updateFog(),this._gfx.renderer.xr.enabled&&this.webVR.updateMoleculeScale()},Jh.prototype._onRender=function(){const e=this._gfx;e.scene.updateMatrixWorld(),e.camera.updateMatrixWorld(),this._clipPlaneUpdateValue(this._getBSphereRadius()),this._fogFarUpdateValue(),e.renderer.setRenderTarget(null),e.renderer.clear(),this._renderFrame(z.now.stereo)},Jh.prototype._renderFrame=function(){const e=new Ih,t=new r.Vector2;return function(r){const n=this._gfx,{renderer:s}=n;s.getSize(t),"NONE"!==r&&(n.camera.focus=n.camera.position.z,n.stereoCam.aspect=1,"ANAGLYPH"===r?n.stereoCam.update(n.camera):n.stereoCam.updateHalfSized(n.camera,z.now.camFov));const i=n.renderer.getPixelRatio();switch(this._resizeOffscreenBuffers(t.width*i,t.height*i,r),this._renderShadowMap(),r){case"WEBVR":case"NONE":this._renderScene(n.camera,!1);break;case"SIMPLE":case"DISTORTED":s.setScissorTest(!0),s.setScissor(0,0,t.width/2,t.height),s.setViewport(0,0,t.width/2,t.height),this._renderScene(this._gfx.stereoCam.cameraL,"DISTORTED"===r),s.setScissor(t.width/2,0,t.width/2,t.height),s.setViewport(t.width/2,0,t.width/2,t.height),this._renderScene(this._gfx.stereoCam.cameraR,"DISTORTED"===r),s.setScissorTest(!1);break;case"ANAGLYPH":this._renderScene(this._gfx.stereoCam.cameraL,!1,n.stereoBufL),this._renderScene(this._gfx.stereoCam.cameraR,!1,n.stereoBufR),s.setRenderTarget(null),e.uniforms.srcL.value=n.stereoBufL.texture,e.uniforms.srcR.value=n.stereoBufR.texture,n.renderer.renderScreenQuad(e)}n.renderer2d.render(n.scene,n.camera),z.now.axes&&n.axes&&!n.renderer.xr.enabled&&n.axes.render(s)}}(),Jh.prototype._onBgColorChanged=function(){const e=this._gfx,t=Qh();e&&(e.scene.fog&&e.scene.fog.color.set(t),e.renderer.setClearColor(z.now.bg.color,Number(!z.now.bg.transparent))),this._needRender=!0},Jh.prototype._onFogColorChanged=function(){const e=this._gfx,t=Qh();e&&e.scene.fog&&e.scene.fog.color.set(t),this._needRender=!0},Jh.prototype._setUberMaterialValues=function(e){this._gfx.root.traverse((t=>{(t instanceof r.Mesh||t instanceof r.LineSegments||t instanceof r.Line)&&t.material instanceof Jn&&(t.material.setValues(e),t.material.needsUpdate=!0)}))},Jh.prototype._enableMRT=function(e,t,r){const n=this._gfx,s=n.renderer.getContext(),i=s.getExtension("WEBGL_draw_buffers"),{properties:o}=n.renderer;if(!e)return void i.drawBuffersWEBGL([s.COLOR_ATTACHMENT0,null]);n.renderer.setRenderTarget(r);const a=o.get(r.texture).__webglTexture;s.bindTexture(s.TEXTURE_2D,a),n.renderer.setRenderTarget(t);const l=o.get(t).__webglFramebuffer,c=o.get(t.texture).__webglTexture;s.bindFramebuffer(s.FRAMEBUFFER,l),l.width=t.width,l.height=t.height,s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,c,0),s.framebufferTexture2D(s.FRAMEBUFFER,i.COLOR_ATTACHMENT1_WEBGL,s.TEXTURE_2D,a,0),i.drawBuffersWEBGL([s.COLOR_ATTACHMENT0,i.COLOR_ATTACHMENT1_WEBGL])},Jh.prototype._renderScene=function(e,t,r){t=t||!1,r=r||null;const n=this._gfx;if(n.renderer.setClearColor(z.now.bg.color,Number(!z.now.bg.transparent)),n.renderer.setRenderTarget(r),n.renderer.clear(),n.renderer.xr.enabled)return void n.renderer.render(n.scene,e);n.renderer.setClearColor(0,0),n.renderer.setRenderTarget(n.offscreenBuf4),n.renderer.clearColor(),n.renderer.setClearColor(z.now.bg.color,Number(!z.now.bg.transparent)),n.renderer.setRenderTarget(n.offscreenBuf),n.renderer.clear();const s=null!==this._getComplexVisual(),i=this._getVolumeVisual(),o=s&&z.now.ao;o&&this._enableMRT(!0,n.offscreenBuf,n.offscreenBuf4),"prepass"===z.now.transparency?this._renderWithPrepassTransparency(e,n.offscreenBuf):"standard"===z.now.transparency&&(n.renderer.setRenderTarget(n.offscreenBuf),n.renderer.render(n.scene,e)),o&&this._enableMRT(!1,null,null);const a=s&&z.now.outline.on,l=s&&z.now.fxaa,c=null!==i&&null!=i.getMesh().material;let h=o||a||c||l||t?n.offscreenBuf2:r,u=n.offscreenBuf;o?(this._performAO(u,n.offscreenBuf4,n.offscreenBuf.depthTexture,h,n.offscreenBuf3,n.offscreenBuf2),l||t||c||a||(u=h,h=r,n.renderer.setRenderTarget(h),n.renderer.renderScreenQuadFromTex(u.texture,1))):(n.renderer.setRenderTarget(h),n.renderer.renderScreenQuadFromTex(u.texture,1)),a&&(u=h,h=c||l||t?n.offscreenBuf3:r,null!=u&&this._renderOutline(e,n.offscreenBuf,u,h)),this._renderSelection(e,n.offscreenBuf,h),c&&(n.renderer.setRenderTarget(n.offscreenBuf),n.renderer.renderScreenQuadFromTex(h.texture,1),h=n.offscreenBuf,this._renderVolume(i,e,h,n.volBFTex,n.volFFTex,n.volWFFTex),l||t||(n.renderer.setRenderTarget(r),n.renderer.renderScreenQuadFromTex(h.texture,1))),u=h,l&&(h=t?n.offscreenBuf4:r,this._performFXAA(u,h),u=h),t&&(h=r,this._performDistortion(u,h,!0))},Jh.prototype._performDistortion=function(){const e=new r.Scene,t=new r.OrthographicCamera(-1,1,1,-1,-500,1e3),n=new r.RawShaderMaterial({uniforms:{srcTex:{type:"t",value:null},aberration:{type:"fv3",value:new r.Vector3(1)}},vertexShader:Qt,fragmentShader:"precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform vec3 aberration;\r\n\r\nvoid main() {\r\n vec2 uv = vUv * 2.0 - 1.0;\r\n \r\n gl_FragColor.r = texture2D(srcTex, 0.5 * (uv * aberration[0] + 1.0)).r;\r\n gl_FragColor.g = texture2D(srcTex, 0.5 * (uv * aberration[1] + 1.0)).g;\r\n gl_FragColor.b = texture2D(srcTex, 0.5 * (uv * aberration[2] + 1.0)).b;\r\n gl_FragColor.a = 1.0;\r\n}",transparent:!1,depthTest:!1,depthWrite:!1}),s=sr.buildDistorionMesh(10,10,z.now.debug.stereoBarrel);return e.add(new fs.Mesh(s,n)),function(r,s,i){this._gfx.renderer.setRenderTarget(s),this._gfx.renderer.clear(),i?(n.uniforms.srcTex.value=r.texture,n.uniforms.aberration.value.set(.995,1,1.01),this._gfx.renderer.render(e,t)):this._gfx.renderer.renderScreenQuadFromTexWithDistortion(r,z.now.debug.stereoBarrel)}}(),Jh.prototype._renderOutline=function(){const e=new bh({depth:!0});return function(t,n,s,i){const o=this._gfx;e.uniforms.srcTex.value=s.texture,e.uniforms.srcDepthTex.value=n.depthTexture,e.uniforms.srcTexSize.value.set(n.width,n.height),e.uniforms.color.value=new r.Color(z.now.outline.color),e.uniforms.threshold.value=z.now.outline.threshold,e.uniforms.thickness.value=new r.Vector2(z.now.outline.thickness,z.now.outline.thickness),o.renderer.setRenderTarget(i),o.renderer.renderScreenQuad(e)}}(),Jh.prototype._renderShadowMap=function(){const e={minFilter:r.NearestFilter,magFilter:r.NearestFilter,format:r.RGBAFormat};return function(){if(!z.now.shadow.on)return;const t=this._gfx,n=t.renderer.getRenderTarget(),s=t.renderer.getActiveCubeFace(),i=t.renderer.getActiveMipmapLevel(),o=t.renderer.state;o.setBlending(r.NoBlending),o.buffers.color.setClear(1,1,1,1),o.buffers.depth.setTest(!0),o.setScissorTest(!1);for(let n=0;n0)return!0}return!1},Jh.prototype._renderSelection=function(){const e=new bh;return function(t,r,n){const s=this._gfx;s.renderer.setClearColor("black",0),s.renderer.setRenderTarget(r),s.renderer.clear(!0,!1,!1),this._hasSelectionToRender()?(s.selectionRoot.matrix=s.root.matrix,s.selectionPivot.matrix=s.pivot.matrix,s.renderer.render(s.selectionScene,t)):s.renderer.renderDummyQuad(),s.renderer.setRenderTarget(n),s.renderer.renderScreenQuadFromTex(r.texture,.6),e.uniforms.srcTex.value=r.texture,e.uniforms.srcTexSize.value.set(r.width,r.height),s.renderer.renderScreenQuad(e)}}(),Jh.prototype._checkVolumeRenderingSupport=function(e){if(!e)return!1;const t=this._gfx,r=t.renderer.getRenderTarget();t.renderer.setRenderTarget(e);const n=t.renderer.getContext(),s=n.checkFramebufferStatus(n.FRAMEBUFFER);return t.renderer.setRenderTarget(r),s===n.FRAMEBUFFER_COMPLETE||(this.logger.warn("Device doesn't support electron density rendering"),!1)},Jh.prototype._renderVolume=function(){const e=new aa.BackFacePosMaterial,t=new aa.FrontFacePosMaterial,n=(new r.Matrix4).makeTranslation(.5,.5,.5),s=new r.Matrix4;let i;return function(r,o,a,l,c,h){const u=this._gfx;if(void 0===i&&(i=this._checkVolumeRenderingSupport(l)),!i)return;const d=r.getMesh();d.rebuild(u.camera),u.renderer.setClearColor("black",0),u.renderer.setRenderTarget(l),u.renderer.clear(),u.renderer.setRenderTarget(c),u.renderer.clear(),u.renderer.setRenderTarget(h),u.renderer.clear(),u.renderer.setRenderTarget(l),o.layers.set(sr.LAYERS.VOLUME_BFPLANE),u.renderer.render(u.scene,o),o.layers.set(sr.LAYERS.VOLUME),u.scene.overrideMaterial=e,u.renderer.render(u.scene,o),u.renderer.setRenderTarget(c),o.layers.set(sr.LAYERS.VOLUME),u.scene.overrideMaterial=t,u.renderer.render(u.scene,o),u.scene.overrideMaterial=null,o.layers.set(sr.LAYERS.DEFAULT),s.copy(d.matrixWorld).invert(),Jn.prototype.uberOptions.world2colorMatrix.multiplyMatrices(n,s),o.layers.set(sr.LAYERS.COLOR_FROM_POSITION),u.renderer.setRenderTarget(h),u.renderer.render(u.scene,o);const p=d.material;p.uniforms._BFRight.value=l.texture,p.uniforms._FFRight.value=c.texture,p.uniforms._WFFRight.value=h.texture,o.layers.set(sr.LAYERS.VOLUME),u.renderer.setRenderTarget(a),u.renderer.render(u.scene,o),o.layers.set(sr.LAYERS.DEFAULT)}}(),Jh.prototype._renderWithPrepassTransparency=function(e,t){const r=this._gfx;r.renderer.setRenderTarget(t),e.layers.set(sr.LAYERS.DEFAULT),r.renderer.render(r.scene,e),e.layers.set(sr.LAYERS.PREPASS_TRANSPARENT),r.renderer.getContext().colorMask(!1,!1,!1,!1),r.renderer.render(r.scene,e),r.renderer.getContext().colorMask(!0,!0,!0,!0),e.layers.set(sr.LAYERS.TRANSPARENT),r.renderer.render(r.scene,e),e.layers.set(sr.LAYERS.DEFAULT)},Jh.prototype._performFXAA=function(){const e=new Sh;return function(t,r){if(void 0===t||void 0===r)return;const n=this._gfx;n.renderer.setClearColor(z.now.bg.color,Number(!z.now.bg.transparent)),n.renderer.setRenderTarget(r),n.renderer.clear(),e.uniforms.srcTex.value=t.texture,e.uniforms.srcTexelSize.value.set(1/t.width,1/t.height),e.uniforms.bgColor.value.set(z.now.bg.color),e.bgTransparent!==z.now.bg.transparent&&(e.setValues({bgTransparent:z.now.bg.transparent}),e.needsUpdate=!0),n.renderer.renderScreenQuad(e)}}(),Jh.prototype._performAO=function(){const e=new Ah,t=new Rh,n=new Nh,s=new r.Vector3;return function(i,o,a,l,c,h){if(!(i&&o&&a&&l&&c&&h))return;const u=this._gfx,d=Math.tan(.5*r.MathUtils.DEG2RAD*u.camera.fov);e.uniforms.diffuseTexture.value=i.texture,e.uniforms.depthTexture.value=a,e.uniforms.normalTexture.value=o.texture,e.uniforms.srcTexelSize.value.set(1/i.width,1/i.height),e.uniforms.camNearFar.value.set(u.camera.near,u.camera.far),e.uniforms.projMatrix.value=u.camera.projectionMatrix,e.uniforms.aspectRatio.value=u.camera.aspect,e.uniforms.tanHalfFOV.value=d,u.root.matrix.extractScale(s),e.uniforms.kernelRadius.value=z.now.debug.ssaoKernelRadius*s.x,e.uniforms.depthThreshold.value=2*this._getBSphereRadius(),e.uniforms.factor.value=z.now.debug.ssaoFactor,u.renderer.setRenderTarget(h),u.renderer.renderScreenQuad(e),t.uniforms.aoMap.value=h.texture,t.uniforms.srcTexelSize.value.set(1/h.width,1/h.height),t.uniforms.depthTexture.value=a,u.renderer.setRenderTarget(c),u.renderer.renderScreenQuad(t),n.uniforms.aoMap.value=c.texture,n.uniforms.diffuseTexture.value=i.texture,n.uniforms.srcTexelSize.value.set(1/c.width,1/c.height),n.uniforms.depthTexture.value=a,n.uniforms.projMatrix.value=u.camera.projectionMatrix,n.uniforms.aspectRatio.value=u.camera.aspect,n.uniforms.tanHalfFOV.value=d;const{fog:p}=u.scene;p&&(n.uniforms.fogNearFar.value.set(p.near,p.far),n.uniforms.fogColor.value.set(p.color.r,p.color.g,p.color.b,z.now.fogAlpha)),n.useFog===z.now.fog&&n.fogTransparent===z.now.bg.transparent||(n.setValues({useFog:z.now.fog,fogTransparent:z.now.bg.transparent}),n.needsUpdate=!0),u.renderer.setRenderTarget(l),u.renderer.renderScreenQuad(n)}}(),Jh.prototype.reset=function(){this._picker&&this._picker.reset(),this._lastPick=null,this._releaseAllVisuals(),this._setEditMode($h),this._resetObjects(),this._gfx&&(sr.clearTree(this._gfx.pivot),this._gfx.renderer2d.reset()),this.setNeedRender()},Jh.prototype._resetScene=function(){this._objectControls.reset(),this._objectControls.allowTranslation(!0),this._objectControls.allowAltObjFreeRotation(!0),this.resetReps(),this.resetPivot(),this.rebuildAll()},Jh.prototype.resetView=function(){this._picker&&this._picker.reset(),this._setEditMode($h),this._resetScene(),this._forEachComplexVisual((e=>{e.updateSelectionMask({}),e.rebuildSelectionGeometry()}))},Jh.prototype._export=function(e){const r=t().head(Wc.exporters.find({format:e}));if(!r)return this.logger.error("Could not find suitable exporter for this source"),Promise.reject(new Error("Could not find suitable exporter for this source"));if(this.dispatchEvent({type:"exporting"}),this._visuals[this._curVisualName]instanceof Qo){let e=null;r.SourceClass===Qo?e=this._visuals[this._curVisualName]:r.SourceClass===jt&&(e=this._visuals[this._curVisualName]._complex);return new r(e,{miewVersion:Jh.VERSION}).export().then((e=>e))}return this._visuals[this._curVisualName]instanceof pa?Promise.reject(new Error("Sorry, exporter for volume data not implemented yet")):Promise.reject(new Error("Unexpected format of data"))};const nu=/^(?:(pdb|cif|ccp4|dsn6):\s*)?(\d[a-z\d]{3})$/i,su=/^(?:pc|pubchem):\s*([a-z]+)$/i,iu=/^([a-z][a-z\d\-+.]*):/i;function ou(e,r,n){return new Promise((s=>{if(n.shouldCancel())throw new Error("Operation cancelled");n.notify({type:"fetching"}),e=function(e,r){if(!t().isString(e))return e;const n=nu.exec(e);if(n){let[,t="pdb",s]=n;switch(t=t.toLowerCase(),s=s.toUpperCase(),t){case"pdb":e=`https://files.rcsb.org/download/${s}.pdb`;break;case"cif":e=`https://files.rcsb.org/download/${s}.cif`;break;case"ccp4":e=`https://www.ebi.ac.uk/pdbe/coordinates/files/${s.toLowerCase()}.ccp4`;break;case"dsn6":e=`https://edmaps.rcsb.org/maps/${s.toLowerCase()}_2fofc.dsn6`;break;default:throw new Error("Unexpected data format shortcut")}return r.fileType=t,r.fileName=`${s}.${t}`,r.sourceType="url",e}const s=su.exec(e);if(s){const t=s[1].toLowerCase();return e=`https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${t}/JSON?record_type=3d`,r.fileType="pubchem",r.fileName=`${t}.json`,r.sourceType="url",e}return"url"!==r.sourceType&&void 0!==r.sourceType||(r.sourceType="url",iu.test(e)||(e=O.resolveURL(e))),e}(e,r);const i=t().head(Wc.loaders.find({type:r.sourceType,source:e}));if(!i)throw new Error(Xh);const o=r.fileName||i.extractName(e);if(o){const[e,n]=O.splitFileName(o);t().defaults(r,{name:e,fileExt:n,fileName:o})}!function(e){let{binary:r}=e;if(void 0!==e.fileType){const n=t().head(Wc.parsers.find({format:e.fileType}));if(!n)throw new Error("Could not find suitable parser for this format");r=n.binary||!1}if(void 0===r&&void 0!==e.fileExt){const n=t().head(Wc.parsers.find({ext:e.fileExt}));n&&(r=n.binary||!1)}void 0!==e.fileExt&&".man"===e.fileExt.toLowerCase()&&(e.binary=!0,e.animation=!0),void 0!==r&&void 0!==e.binary&&e.binary!==r&&e.context.logger.warn("Overriding incorrect binary mode"),e.binary=r||!1}(r);let a=t().get(r,"preset.expression");if(!t().isUndefined(a)&&(a=JSON.parse(a),a&&a.settings)){const e=["singleUnit"];for(let r=0,n=e.length;rl.abort())),l.addEventListener("progress",(e=>{e.lengthComputable&&e.total>0?Kh(l.logger,"Fetching",e.loaded/e.total):Kh(l.logger,"Fetching")}));s(l.load().then((e=>(r.context.logger.info("Fetching finished"),n.notify({type:"fetchingDone",data:e}),e))).catch((e=>{throw r.context.logger.debug(e.message),e.stack&&r.context.logger.debug(e.stack),r.context.logger.error("Fetching failed"),n.notify({type:"fetchingDone",error:e}),e})))}))}Jh.prototype.load=function(e,r){r=t().merge({},r,{context:this}),this.settings.now.use.multiFile||(this._loading.length&&(this._loading.forEach((e=>{e.cancel()})),this._loading.length=0),r.animation||this.reset(!0)),this._interpolator.reset(),this.dispatchEvent({type:"loading",options:r,source:e});const n=new V;this._loading.push(n),n.addEventListener("notification",(e=>{this.dispatchEvent(e.slaveEvent)})),this._spinner.spin(this._container);const s=e=>{const t=this._loading.indexOf(n);return-1!==t&&this._loading.splice(t,1),this._spinner.stop(),this._refreshTitle(),n.notify({type:"loadingDone",anything:e}),e};return ou(e,r,n).then((e=>function(e,r,n){if(n.shouldCancel())return Promise.reject(new Error("Operation cancelled"));n.notify({type:"parsing"});const s=t().head(Wc.parsers.find({format:r.fileType,ext:r.fileExt,data:e}));if(!s)return Promise.reject(new Error("Could not find suitable parser"));const i=new s(e,r);return i.context=r.context,n.addEventListener("cancel",(()=>i.abort())),i.parse().then((e=>(n.notify({type:"parsingDone",data:e}),e))).catch((e=>{throw r.error=e,r.context.logger.debug(e.message),e.stack&&r.context.logger.debug(e.stack),r.context.logger.error("Parsing failed"),n.notify({type:"parsingDone",error:e}),e}))}(e,r,n))).then((e=>{const t=this._onLoad(e,r);return s(t)})).catch((e=>{throw this.logger.error("Could not load data"),this.logger.debug(e),s(e)}))},Jh.prototype.unload=function(e){this._removeVisual(e||this.getCurrentVisual()),this.resetPivot(),z.now.shadow.on&&this._updateShadowCamera()},Jh.prototype._startAnimation=function(e){this._stopAnimation();const t=this,r=this._getComplexVisual();if(null!==r){try{this._frameInfo=new mh(r.getComplex(),e,{onLoadStatusChanged(){t.dispatchEvent({type:"mdPlayerStateChanged",state:{isPlaying:t._isAnimating,isLoading:!t._frameInfo||t._frameInfo.isLoading}})},onError(e){t._stopAnimation(),t.logger.error(e)}})}catch(e){return void this.logger.error("Animation file does not fit to current complex!")}this._continueAnimation()}else this.logger.error("Unable to start animation - no molecule is loaded.")},Jh.prototype._pauseAnimation=function(){null!==this._animInterval&&(this._isAnimating=!1,clearInterval(this._animInterval),this._animInterval=null,this._frameInfo&&this.dispatchEvent({type:"mdPlayerStateChanged",state:{isPlaying:this._isAnimating,isLoading:this._frameInfo.isLoading}}))},Jh.prototype._continueAnimation=function(){this._isAnimating=!0;let e=1e3/z.now.maxfps;e=Number.isNaN(e)?0:e;const t=this,{pivot:r}=t._gfx,n=this._getComplexVisual();n&&(n.resetSelectionMask(),n.rebuildSelectionGeometry(),this._msgAtomInfo.style.opacity=0),this._animInterval=setInterval((()=>{if(t.dispatchEvent({type:"mdPlayerStateChanged",state:{isPlaying:t._isAnimating,isLoading:t._frameInfo.isLoading}}),t._frameInfo.frameIsReady){r.updateToFrame(t._frameInfo),t._updateObjsToFrame(t._frameInfo),t._refreshTitle(` Frame ${t._frameInfo._currFrame} of ${t._frameInfo._framesCount} time interval - ${t._frameInfo._timeStep}`);try{t._frameInfo.nextFrame()}catch(e){return t.logger.error("Error during animation"),void t._stopAnimation()}t._needRender=!0}}),e)},Jh.prototype._stopAnimation=function(){null!==this._animInterval&&(clearInterval(this._animInterval),this._frameInfo.disableEvents(),this._frameInfo=null,this._animInterval=null,this.dispatchEvent({type:"mdPlayerStateChanged",state:null}))},Jh.prototype._onLoad=function(e,r){const n=this._gfx;let s=null;if(r.animation)return this._refreshTitle(),this._startAnimation(e),null;if(this._stopAnimation(),r&&r.keepRepsInfo||(this._opts.reps=null,this._opts._objects=null),"Complex"===e.id){const n=e;r.fileName?n.name=n.name||Zh(r.fileName).toUpperCase():r.amberFileName?n.name=n.name||Zh(r.amberFileName).toUpperCase():n.name=`Dynamic ${r.fileType} molecule`,s=this._addVisual(new Qo(n.name,n)),this._curVisualName=s;const i=this.info();if(this.logger.info(`Parsed ${r.fileName} (${i.atoms} atoms, ${i.bonds} bonds, ${i.residues} residues, ${i.chains} chains).`),t().isNumber(this._opts.unit)&&n.setCurrentUnit(this._opts.unit),r.preset);else if(z.now.autoPreset)switch(r.fileType){case"cml":this.resetReps("small");break;case"pdb":case"mmtf":case"cif":!function(e){let t=!1;return e.forEachComponent((e=>{e.forEachResidue((e=>{e._isValid&&(t=!0)}))})),t}(n)?this.resetReps("small"):this.resetReps("macro");break;default:this.resetReps("default")}else this.resetReps("default")}else"Volume"===e.id&&(this.resetEd(),s=this._onLoadEd(e));return n.camera.updateProjectionMatrix(),this._updateFog(),n.root.resetTransform(),this.resetPivot(),this._objectControls.setScale(z.now.radiusToFit/this._getBSphereRadius()),this._resetObjects(),z.now.autoResolution&&this._tweakResolution(),z.now.shadow.on&&this._updateShadowCamera(),this._opts.view&&(this.view(this._opts.view),delete this._opts.view),this._refreshTitle(),s},Jh.prototype.resetEd=function(){this._edLoader&&(this._edLoader.abort(),this._edLoader=null),this._removeVisual(this._getVolumeVisual()),this._needRender=!0},Jh.prototype.loadEd=function(e){this.resetEd();const r=t().head(Wc.loaders.find({source:e}));if(!r)return this.logger.error(Xh),Promise.reject(new Error(Xh));const n=this._edLoader=new r(e,{binary:!0});return n.context=this,n.load().then((e=>{const r=t().head(Wc.parsers.find({format:"ccp4"}));if(!r)throw new Error("Could not find suitable parser for this source");const n=new r(e);return n.context=this,n.parse().then((e=>{this._onLoadEd(e)}))})).catch((e=>{this.logger.error("Could not load ED data"),this.logger.debug(e)}))},Jh.prototype._onLoadEd=function(e){e.normalize();const t=new pa("volume",e);t.getMesh().layers.set(sr.LAYERS.VOLUME);const r=this._addVisual(t);return this._needRender=!0,r},Jh.prototype._needRebuild=function(){let e=!1;return this._forEachComplexVisual((t=>{e=e||t.needsRebuild()})),e},Jh.prototype._rebuildObjects=function(){const e=this,t=this._gfx;let r,n;const s=[];for(r=0;r{const s=e._objects;for(r=0,n=s.length;r0?`Bio molecule ${e}`:"Asymmetric unit"})`}return void 0===e||(t().isString(e)&&(e=Math.max(parseInt(e,10),0)),n.getComplex().setCurrentUnit(e)&&(this._resetScene(),this._updateInfoPanel())),s()},Jh.prototype.rebuild=function(){if(this._building)return void this.logger.warn("Miew.rebuild(): already building!");this._building=!0,this.dispatchEvent({type:"rebuilding"}),this._rebuildObjects(),this._gfx.renderer2d.reset();const e=[];this._forEachComplexVisual((t=>{t.needsRebuild()&&e.push(t.rebuild().then((()=>new Promise((e=>{t.rebuildSelectionGeometry(),e()})))))}));const t=this;this._spinner.spin(this._container),Promise.all(e).then((()=>{t._spinner.stop(),t._needRender=!0,t._refreshTitle(),this.dispatchEvent({type:"buildingDone"}),t._building=!1}))},Jh.prototype.rebuildAll=function(){this._forEachComplexVisual((e=>{e.setNeedsRebuild()}))},Jh.prototype._refreshTitle=function(e){let t;e=void 0===e?"":e;const r=this._getComplexVisual();if(r){t=r.getComplex().name;const e=r.repGet(r.repCurrent());t+=e?` – ${e.mode.name} Mode`:""}else t=Object.keys(this._visuals).length>0?"Unknown":"No Data";t+=e,this.dispatchEvent({type:"titleChanged",data:t})},Jh.prototype.setNeedRender=function(){this._needRender=!0},Jh.prototype._extractRepresentation=function(){const e=[];this._forEachComplexVisual((t=>{if(0===t.getSelectionCount())return;const r=t.buildSelectorFromMask(1<0&&this.logger.report(`New representation from selection for complexes: ${e.join(", ")}`)},Jh.prototype._setReps=function(e){e=e||this._opts&&this._opts.reps||[],this._forEachComplexVisual((t=>t.resetReps(e)))},Jh.prototype.applyPreset=function(e){const{presets:t}=z.now,r=[e||z.defaults.preset,z.defaults.preset,Object.keys(t)[0]];let n=null;for(let e=0;!n&&e{const r=t.beginComponentEdit();r&&e.push(r)})),e!==[]&&(this._editors=e,this.logger.info("COMPONENT EDIT MODE -- ON"),this._setEditMode(Wh),this._objectControls.keysTranslateObj(!0))},Jh.prototype._applyComponentEdit=function(){if(this._editMode===Wh){this._objectControls.stop(),this._objectControls.keysTranslateObj(!1);for(let e=0;e{t instanceof Qo&&t.getSelectionCount()>0&&e.push(t)})),1!==e.length)return;const t=e[0].beginFragmentEdit();t&&(this._editors=[t],this.logger.info("FRAGMENT EDIT MODE -- ON (single bond)"),this._setEditMode(Yh),this._objectControls.allowTranslation(!1),this._objectControls.allowAltObjFreeRotation(t.isFreeRotationAllowed()),this._needRender=!0)},Jh.prototype._applyFragmentEdit=function(){if(this._editMode===Yh){this._objectControls.stop();for(let e=0;e{e.expandSelection(),e.rebuildSelectionGeometry()})),this._updateInfoPanel(),this._needRender=!0);break;case"NumpadSubtract":e.altKey&&(e.preventDefault(),e.stopPropagation(),this._forEachComplexVisual((e=>{e.shrinkSelection(),e.rebuildSelectionGeometry()})),this._updateInfoPanel(),this._needRender=!0)}}},Jh.prototype._onKeyUp=function(e){this._running&&this._hotKeysEnabled&&"KeyX"===e.code&&this._extractRepresentation()},Jh.prototype._updateInfoPanel=function(){const e=this._msgAtomInfo.getElementsByTagName("p")[0];let t,r,n=0;for(this._forEachComplexVisual((e=>{n+=e.getSelectionCount()}));e.firstChild;)e.removeChild(e.firstChild);if(0===n)return void(this._msgAtomInfo.style.opacity=0);let s=`${String(n)} atom${1!==n?"s":""} selected`;null!==this._lastPick&&(s+=", the last pick:");let i="",o="",a="";if(this._lastPick instanceof Uh){t=this._lastPick,r=t.residue,o=t.name;const e=32!==t.location?String.fromCharCode(t.location):"";i=`${t.element.fullName} #${t.serial}${e}: ${r._chain._name}.${r._type._name}${r._sequence}${r._icode.trim()}.`,i+=o,a=`Coord: (${t.position.x.toFixed(2).toString()}, ${t.position.y.toFixed(2).toString()}, ${t.position.z.toFixed(2).toString()})`}else this._lastPick instanceof Gh?(r=this._lastPick,i=`${r._type._fullName}: ${r._chain._name}.${r._type._name}${r._sequence}${r._icode.trim()}`):this._lastPick instanceof jh?i=`chain ${this._lastPick._name}`:this._lastPick instanceof Hh&&(i=`molecule ${this._lastPick._name}`);e.appendChild(document.createTextNode(s)),""!==i&&(e.appendChild(document.createElement("br")),e.appendChild(document.createTextNode(i))),""!==a&&(e.appendChild(document.createElement("br")),e.appendChild(document.createTextNode(a))),this._msgAtomInfo.style.opacity=1},Jh.prototype._getAltObj=function(){if(this._editors){let e=null;for(let t=0;t0){if(e){e=null;break}e=r}}if(e)return e}return{objects:[],pivot:new r.Vector3(0,0,0)}},Jh.prototype.resetPivot=function(){const e=new r.Box3,t=new r.Vector3;return function(){e.makeEmpty(),this._forEachVisual((t=>{e.union(t.getBoundaries().boundingBox)})),e.getCenter(t),this._objectControls.setPivot(t.negate()),this.dispatchEvent({type:"transform"})}}(),Jh.prototype.setPivotResidue=function(){const e=new r.Vector3;return function(t){const r=this._getVisualForComplex(t.getChain().getComplex());if(r){if(t._controlPoint)e.copy(t._controlPoint);else{let r=0,n=0,s=0;const i=t._atoms.length;for(let e=0;e{i.getSelectionCenter(e,r,n||i.getSelectionBit())&&(t.add(e),s++)})),0!==s&&(t.divideScalar(s),t.negate(),!0)}}(),Jh.prototype.setPivotSubset=function(){const e=new r.Vector3(0,0,0);function t(e,t){return e.mask&1<{const r=this._visuals[this._curVisualName]._complex.name;O.download(t,r,e.fileType),this._refreshTitle(),this.dispatchEvent({type:"exportingDone"})})).catch((e=>{this.logger.error("Could not export data"),this.logger.debug(e),this._refreshTitle(),this.dispatchEvent({type:"exportingDone",error:e})}))},Jh.prototype._tweakResolution=function(){const e=[["poor",100],["low",500],["medium",1e3],["high",5e3],["ultra",Number.MAX_VALUE]];let t=0;if(this._forEachComplexVisual((e=>{t+=e.getComplex().getAtomCount()})),t>0){const r=1e6*this._gfxScore/t;for(let t=0;ts?(o=!1,n.preset="empty"):z.now.preset!==z.defaults.preset&&(n.preset=z.now.preset);const a=[];let l=!0;for(let r=0,n=s;r0&&(r._objects=o),e.view&&(r.view=this.view()),e.settings){const e=this.settings.getDiffs(!1);t().isEmpty(e)||(r.settings=e)}return r},Jh.prototype.get=function(e,t){return z.get(e,t)},Jh.prototype._clipPlaneUpdateValue=function(e){const t=Math.max(this._gfx.camera.position.z-e*z.now.draft.clipPlaneFactor,z.now.camNear),r={clipPlaneValue:t};this._forEachComplexVisual((e=>{e.setUberOptions(r)}));for(let e=0,t=this._objects.length;e{const r=t._reprList;for(let t=0,n=r.length;t1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;this._forEachComplexVisual((n=>n.setMaterialValues(e,t,r)));for(let t=0,r=this._objects.length;t{e.setUberOptions({fogAlpha:z.now.fogAlpha})}))},Jh.prototype._embedWebXR=function(){if("WEBVR"!==z.now.stereo)return this.webVR&&this.webVR.disable(),void(this.webVR=null);this.webVR||(this.webVR=new Fh((()=>{this._requestAnimationFrame((()=>this._onTick())),this._needRender=!0,this._onResize()}))),this.webVR.enable(this._gfx)},Jh.prototype._initOnSettingsChanged=function(){const e=(e,r)=>{(e=t().isArray(e)?e:[e]).forEach((e=>{this.settings.addEventListener(`change:${e}`,r)}))};e("modes.VD.frame",(()=>{const e=this._getVolumeVisual();null!==e&&(e.showFrame(z.now.modes.VD.frame),this._needRender=!0)})),e("modes.VD.isoMode",(()=>{const e=this._getVolumeVisual();null!==e&&(e.getMesh().material.updateDefines(),this._needRender=!0)})),e("bg.color",(()=>{this._onBgColorChanged()})),e("ao",(()=>{if(z.now.ao&&!ru(this._gfx.renderer.getContext()))this.logger.warn("Your device or browser does not support ao"),z.set("ao",!1);else{const e={normalsToGBuffer:z.now.ao};this._setUberMaterialValues(e)}})),e("zSprites",(()=>{z.now.zSprites&&!tu(this._gfx.renderer.getContext())&&(this.logger.warn("Your device or browser does not support zSprites"),z.set("zSprites",!1)),this.rebuildAll()})),e("fogColor",(()=>{this._onFogColorChanged()})),e("fogColorEnable",(()=>{this._onFogColorChanged()})),e("bg.transparent",(e=>{const t=this._gfx;t&&t.renderer.setClearColor(z.now.bg.color,Number(!z.now.bg.transparent)),this._updateMaterials({fogTransparent:e.value}),this.rebuildAll()})),e("draft.clipPlane",(e=>{this._updateMaterials({clipPlane:e.value}),this.rebuildAll()})),e("shadow.on",(e=>{const t={shadowmap:e.value,shadowmapType:z.now.shadow.type},r=this._gfx;r&&(r.renderer.shadowMap.enabled=Boolean(t.shadowmap)),this._updateMaterials(t,!0),t.shadowmap?(this._updateShadowCamera(),this._updateShadowmapMeshes(jo.createShadowmapMaterial)):this._updateShadowmapMeshes(jo.removeShadowmapMaterial),this._needRender=!0})),e("shadow.type",(e=>{z.now.shadow.on&&(this._updateMaterials({shadowmapType:e.value},!0),this._needRender=!0)})),e("shadow.radius",(e=>{for(let t=0;t{this._fps.show(z.now.fps)})),e(["fog","fogNearFactor","fogFarFactor"],(()=>{this._updateFog(),this._needRender=!0})),e("fogAlpha",(()=>{const{fogAlpha:e}=z.now;(e<0||e>1)&&this.logger.warn("fogAlpha must belong range [0,1]"),this._fogAlphaChanged(),this._needRender=!0})),e("autoResolution",(e=>{e.value&&!this._gfxScore&&this.logger.warn("Benchmarks are missed, autoresolution will not work! Autoresolution should be set during miew startup.")})),e("stereo",(()=>{this._embedWebXR("WEBVR"===z.now.stereo),this._needRender=!0})),e(["transparency","palette"],(()=>{this.rebuildAll()})),e("resolution",(()=>{this.rebuildAll();const e=this._getVolumeVisual();e&&(e.getMesh().material.updateDefines(),this._needRender=!0)})),e(["axes","fxaa","ao","outline.on","outline.color","outline.threshold","outline.thickness"],(()=>{this._needRender=!0}))},Jh.prototype.set=function(e,t){z.set(e,t)},Jh.prototype.select=function(e,r){const n=this._getComplexVisual();if(!n)return;let s=e;t().isString(e)&&(s=Bh.parse(e).selector),n.select(s,r),this._lastPick=null,this._updateInfoPanel(),this._needRender=!0};Jh.prototype.view=function(e){const t=this,{pivot:n}=this._gfx;let s=[];return void 0===e?function(){const e=n.position,i=t._objectControls.getScale()/z.now.radiusToFit,o=new r.Euler;return o.setFromQuaternion(t._objectControls.getOrientation(),"ZXY"),s=[e.x,e.y,e.z,i,o.x,o.y,o.z],"1"+O.arrayToBase64(s,Float32Array)}():(function(){40===e.length&&(e=`0${e}`);const i=e[0];if(s=O.arrayFromBase64(e.substr(1),Float32Array),"1"!==i){if("0"!==i)return void t.logger.warn(`Encoded view version mismatch, stored as ${i} vs 1 expected`);s[3]/=8}const o=t._interpolator,a=o.createView();a.position.copy(n.position),a.scale=t._objectControls.getScale(),a.orientation.copy(t._objectControls.getOrientation());const l=o.createView();l.position.set(s[0],s[1],s[2]),t._getComplexVisual()&&l.position.sub(t._getComplexVisual().position),l.scale=s[3],l.orientation.setFromEuler(new r.Euler(s[4],s[5],s[6],"ZXY")),o.setup(a,l)}(),e)},Jh.prototype._updateView=function(){const e=this,{pivot:t}=this._gfx,r=this._interpolator;if(r.wasStarted()||r.start(),!r.isMoving())return;const n=r.getCurrentView();if(n.success){const r=n.view;t.position.copy(r.position),e._objectControls.setScale(r.scale*z.now.radiusToFit),e._objectControls.setOrientation(r.orientation),this.dispatchEvent({type:"transform"}),e._needRender=!0}},Jh.prototype.translate=function(e,t,r){this._objectControls.translatePivot(e,t,r),this.dispatchEvent({type:"transform"}),this._needRender=!0},Jh.prototype.rotate=function(e,t,n){this._objectControls.rotate((new r.Quaternion).setFromEuler(new r.Euler(e,t,n,"XYZ"))),this.dispatchEvent({type:"transform"}),this._needRender=!0},Jh.prototype.scale=function(e){if(e<=0)throw new RangeError("Scale should be greater than zero");this._objectControls.scale(e),this.dispatchEvent({type:"transform"}),this._needRender=!0},Jh.prototype.center=function(e){if(void 0===e)return this.setPivotSubset(),void(this._needRender=!0);if(void 0!==e.obj&&("atom"in e.obj||"residue"in e.obj))return"atom"in e.obj?this.setPivotAtom(e.obj.atom):this.setPivotResidue(e.obj.residue),void(this._needRender=!0);if(void 0===e.obj&&""!==e){const t=Bh.parse(e);if(void 0===t.error)return this.setPivotSubset(t),void(this._needRender=!0)}this.resetPivot(),this._needRender=!0},Jh.prototype.within=function(e,t){const r=this._getComplexVisual();if(!r)return Bh.None();e instanceof String&&(e=Bh.parse(e));const n=r.within(e,t);return n&&(r.rebuildSelectionGeometry(),this._needRender=!0),n},Jh.prototype.projected=function(e,t){const r=this._getComplexVisual(t);if(!r)return!1;const n=r.getComplex().getAtomByFullname(e);if(null===n)return!1;const s=n.position.clone();return this._gfx.pivot.updateMatrixWorldRecursive(),this._gfx.camera.updateMatrixWorldRecursive(),this._gfx.pivot.localToWorld(s),s.project(this._gfx.camera),{x:.5*(s.x+1)*this._gfx.width,y:.5*(1-s.y)*this._gfx.height}},Jh.prototype.dssp=function(e){const t=this._getComplexVisual(e);t&&(t.getComplex().dssp(),t._reprList.forEach((e=>{"CA"!==e.mode.id&&"SS"!==e.colorer.id||(e.needsRebuild=!0)})))},Jh.prototype.exportCML=function(){const e=this;const t=e._getComplexVisual(),n=t?t.getComplex():null;if(n&&n.originalCML){!function(t){const{root:n}=e._gfx,s=function(e){const t=new r.Vector3,n=new r.Vector3,s=new r.Vector3;e.extractBasis(t,n,s),t.normalize(),n.normalize(),s.normalize();const i=new r.Matrix4;return i.identity(),i.makeBasis(t,n,s),i}(n.matrixWorld),i=new r.Vector4(0,0,0,0),o=new r.Vector4(0,0,0,0);let a=null,l=null;t.forEachAtom((e=>{e.xmlNodeRef&&e.xmlNodeRef.xmlNode&&(a=e.xmlNodeRef.xmlNode,l=e.position,i.set(l.x,l.y,l.z,1),i.applyMatrix4(s),a.setAttribute("x3",i.x.toString()),a.setAttribute("y3",i.y.toString()),a.setAttribute("z3",i.z.toString()),a.removeAttribute("x2"),a.removeAttribute("y2"))})),t.forEachSGroup((e=>{if(e.xmlNodeRef&&e.xmlNodeRef.xmlNode){a=e.xmlNodeRef.xmlNode,l=e.getPosition(),i.set(l.x,l.y,l.z,1);const t=e.getCentralPoint();null===t?i.applyMatrix4(s):(o.set(t.x,t.y,t.z,0),i.add(o),i.applyMatrix4(s),o.set(t.x,t.y,t.z,1),o.applyMatrix4(s),i.sub(o)),a.setAttribute("x",i.x.toString()),a.setAttribute("y",i.y.toString()),a.setAttribute("z",i.z.toString())}}))}(n);return(new XMLSerializer).serializeToString(n.originalCML)}return null},Jh.prototype.motm=function(){z.set({fogColorEnable:!0,fogColor:0,outline:{on:!0,threshold:.01},bg:{color:16777215}}),this._forEachComplexVisual((e=>{const t=[],r=e.getComplex(),n=ao.get(z.now.palette);for(let e=0;e #aromatic radius"," atom = #atom radius"," bond = #bond radius"," multibond = #use multibond"," showarom = #show aromatic"," space = #space value\n"]},CA:{$help:[" Cartoon"," arrow = #arrow size"," depth = #depth of surface"," heightSegmentsRatio = "," radius = #tube radius"," tension = #"," width = #secondary width\n"]},LN:{$help:[" Lines"," atom = #atom radius"," chunkarom = "," multibond = #use multibond"," showarom = #show aromatic"," offsarom = \n"]},LC:{$help:[" Licorice"," aromrad = #aromatic radius"," bond = #bond radius"," multibond = #use multibond"," showarom = #show aromatic"," space = #space value\n"]},VW:{$help:[" Van der Waals"," nothing\n"]},TR:{$help:[" Trace"," radius = #tube radius\n"]},TU:{$help:[" Tube"," heightSegmentsRatio = "," radius = #tube radius"," tension = \n"]},SA:{$help:[" Surface"," zClip = #clip z plane\n"]},QS:{$help:[" Quick surface"," isoValue = "," scale = "," wireframe = "," zClip = #clip z plane\n"]},SE:{$help:[" Solvent excluded surface"," zClip = #clip z plane\n"]},TX:{$help:[" Text mode",' template = string that can include "{{ id }}"'," it will be replaced by value, id can be one of next:"," serial, name, type, sequence, residue, chain, hetatm, water\n",' horizontalAlign = {"left", "right", "center"}',' verticalAlign = {"top", "bottom", "middle"}'," dx = #offset along x"," dy = #offset along y"," dz = #offset along z"," fg = #text color modificator"," could be keyword, named color or hex"," fg = #back color modificator"," could be keyword, named color or hex"," showBg = #if set show background"," plate under text"]}},hu={$help:["Coloring mode shortcut"," EL - color by element"," CH - color by chain"," SQ - color by sequence"," RT - color by residue type"," SS - color by secondary structure"," UN - uniform"],UN:{$help:["Parameters of coloring modes customization"," Uniform"," color = #RGB->HEX->dec\n"],color:{$help:Object.keys(ao.get(z.now.palette).namedColors).sort().join("\n")}}},uu={$help:["Material shortcut"," DF - diffuse"," TR - transparent"," SF - soft plastic"," PL - glossy plastic"," ME - metal"," GL - glass"]},du={$help:["Short (packed) representation description as a set of variables"," s="," selector property"," m=[!:[,...]]"," render mode property"," c=[!:[,...]]"," color mode property"," mt="," material property"],s:{$help:"Selection expression string as it is in menu->representations->selection"},m:cu,c:hu,mt:uu},pu={$help:["Parameters of rendering modes customization: modes","Parameters of colorer customization: colorers","Autobuild: autobuild = (|)"],modes:cu,colorers:hu},mu={$help:["help (| )","You can get detailed information about command options",' using "help cmd.opt.opt.[...]"\n'," you can use one line comments"," everything started from (#|//) will be skipped"," Example: >build //some comment\n","List of available commands:"],reset:{$help:["Reload current object, delete all representations"," Nothing will work until load new object"]},load:{$help:["load (||-f [<*.NC FILE URL STRING>])"," Load new pdb object from selected source"],PDBID:{$help:"pdb id in remote molecule database"},URL:{$help:"url to source file"},f:{$help:["open file system dialog to fetch local file","optionally you can determine trajectory file","via URL for *.top model"]}},clear:{$help:"No args. Clear terminal"},add:{$help:["add [] []"," Add new item to representation set with"," default or params"],REP_NAME:{$help:"Identifier string [_,a-z,A-Z,0-9] can not start from digit"},DESCRIPTION:du},rep:{$help:["rep [|] []"," set current representation by name or index"," edit current representation by "],REP_NAME:{$help:["Identifier string [_,a-z,A-Z,0-9] can not start from digit","Must be declared before"]},REP_INDEX:{$help:"Index of available representation"},DESCRIPTION:du},remove:{$help:["remove (|)","Remove representation by name or index"],REP_NAME:{$help:["Identifier string [_,a-z,A-Z,0-9] can not start from digit","Must be declared before"]},REP_INDEX:{$help:"Index of available representation"}},selector:{$help:["selector "," set selector from EXPRESSION to current representation"],EXPRESSION:{$help:"Selection expression string as it is in menu->representations->selection"}},mode:{$help:["mode [=...]"," set rendering mode and apply parameters to current representation"],MODE_ID:cu},color:{$help:["color [=...]"," set colorer and apply parameters to current representation"],COLORER_ID:hu},material:{$help:["material "," set material to current representation"],MATERIAL_ID:uu},build:{$help:"build help str",add:{$help:"build.add",new:{$help:["add.new","add.new new line 1","add.new new line 2","add.new new line 3"]}},del:{$help:"build.del"}},list:{$help:["list [-e|-s||]","Print representations if no args print list of representations"," -e expand list and show all representations"," -s show all user-registered selectors"," | show only current representation"]},hide:{$help:["hide (|)","Hide representation referenced in args"]},show:{$help:["show (|)","Show representation referenced in args"]},get:{$help:["get ","Print value"," - path to option use get.PARAMETER to get more info"],PARAMETER:pu},set:{$help:["set ","Set with "," - path to option use set.PARAMETER to get more info"],PARAMETER:pu},set_save:{$help:["set_save","Save current settings to cookie"]},set_restore:{$help:["set_restore","Load and apply settings from cookie"]},set_reset:{$help:["set_reset","Reset current settings to the defaults"]},preset:{$help:["preset []","Reset current representation or set preset to "],PRESET:{$help:["default","wire","small","macro"]}},unit:{$help:["unit []","Change current biological structure view. Zero value means asymmetric unit,","positive values set an assembly with corresponding number.","Being called with no parameters command prints current unit information."]},view:{$help:["view []","Get current encoded view or set if ENCODED_VIEW placed as argument"],ENCODED_VIEW:{$help:["encoded view matrix string (binary code)"]}},rotate:{$help:["rotate (x|y|z) [] [(x|y|z) []]...","Rotate scene"]},scale:{$help:["scale ","Scale scene"]},select:{$help:["select [as ]","Select atoms using selector defined in SELECTOR_STRING"," and if SELECTOR_NAME is defined register it in viewer"," you can use it later as a complex selector"]},within:{$help:["within of as ","Build within named selector"," DISTANCE "," SELECTOR_STRING "," SELECTOR_NAME "]},url:{$help:["url [-s] [-v]","Report URL encoded scene"," if -s set that include settings in the URL"," if -v set that include view in the URL"]},screenshot:{$help:["screenshot [ []]","Make a screenshot of the scene"," WIDTH in pixels"," HEIGHT in pixels, equal to WIDTH by default"]},line:{$help:["line [=]","Draw dashed line between two specified atoms"]},removeobj:{$help:["removeobj ","Remove scene object by its index. Indices could be obtained by command"]},listobj:{$help:["listobj","Display the list of all existing scene objects"]}},{chem:{selectors:fu},modes:_u,colorers:gu,materials:yu,palettes:xu,options:bu,settings:wu}=au;function Su(){}const vu=function(){const e=new Su;return function(){return e}}();const Cu=new class{constructor(){this.representationMap={},this.representationID={}}get(e){return this.representationMap[e]||this.representationID[e]||""}add(e,t){if(-1===e)return"Can not create representation: there is no data";if(void 0!==t){if(this.representationMap.hasOwnProperty(e))return"This name has already existed, registered without name";this.representationMap[e.toString()]=t,this.representationID[t]=e.toString()}return`Representation ${e} successfully added`}remove(e){e&&this.representationID.hasOwnProperty(e)&&(delete this.representationMap[this.representationID[e]],delete this.representationID[e]);const t=Object.keys(this.representationID).sort();for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];n>e&&(this.representationID[n-1]=this.representationID[n],this.representationMap[this.representationID[n]]-=1,delete this.representationID[n])}}clear(){this.representationMap={},this.representationID={}}};function Au(e){const t={s:"selector",m:"mode",c:"colorer",mt:"material",mode:"modes",color:"colorers",colorer:"colorers",select:"selector",material:"materials",selector:"selector"}[e];return void 0===t?e:t}const Eu=new class{list(e,t,r){let n="";if(e&&void 0!==t&&(void 0===r||"-e"===r)){const s=e.repCount();for(let i=0;i"===a?"":`, ${a}`}\n`,void 0!==n&&(s+=` selection : "${h}"\n`,s+=` mode : (${l.id}), ${l.name}\n`,s+=` colorer : (${c.id}), ${c.name}\n`,s+=` material : (${u.id}), ${u.name}\n`),s}listSelector(e,t){let r="";for(const e in t)t.hasOwnProperty(e)&&(r+=`${e} : "${t[e]}"\n`);return r}listObjs(e){const t=e._objects;if(!t||!Array.isArray(t)||0===t.length)return"There are no objects on the scene";const r=[];for(let e=0,n=t.length;ee.finishAwaitingCMDInProcess();e.load(t).then(r,r)}checkArg(e,t,r){if(void 0!==e&&void 0!==t){if("selector"===Au(e)){const e=fu.parse(t);if(void 0!==e.error){throw{message:e.error}}return void 0!==r&&r?e.selector:t}const n={colorers:gu,modes:_u,materials:yu};let s,i=e;for(;i!==s;)s=i,i=Au(s);if(void 0===n[i].get(t)){throw{message:`${t} is not existed in ${i}`}}return t}return vu}propagateProp(e,r){if(void 0!==e){let n={};const s=bu.adapters[typeof t().get(wu.defaults,e)];if(void 0===s){throw{message:`${e} is not existed`}}if((e.endsWith(".color")||e.endsWith(".baseColor")||e.endsWith(".EL.carbon"))&&"number"!=typeof r&&(r=xu.get(wu.now.palette).getNamedColor(r)),e.endsWith(".fg")||e.endsWith(".bg"))if("number"!=typeof r){const e=xu.get(wu.now.palette).getNamedColor(r,!0);void 0!==e&&(r=`0x${e.toString(16)}`)}else r=`0x${r.toString(16)}`;if(e.endsWith(".template")&&(r=r.replace(/\\n/g,"\n")),void 0!==r&&s(r)!==r&&s(r)!==r>0)throw n={message:`${e} must be a "${typeof t().get(wu.defaults,e)}"`},n}return r}unquoteString(e){return O.unquoteString(e)}};function Tu(e){if(e instanceof this.constructor)return e;this._values=e instanceof Array?e.slice(0):e?[e]:[]}Tu.prototype.append=function(e){const t=this._values;return t[t.length]=e,this},Tu.prototype.remove=function(e){const t=this._values,r=t.indexOf(e);return r>=0&&t.splice(r,1),this},Tu.prototype.toJSO=function(e,r,n){const s={},i=this._values;for(let o=0,a=i.length;o0},au.prototype.callNextCmd=function(){if(this.isScriptingCommandAvailable()){const e=this.cmdQueue.shift(),t={success:!1};try{lu.parser.parse(e),t.success=!0}catch(e){t.error=e.message,lu.parser.yy.error(t.error),this.finishAwaitingCMDInProcess()}return t}return""},lu.parser.yy=Ru,lu.parser.yy.parseError=lu.parser.parseError;const Mu=au})(),i=i.default})())); //# sourceMappingURL=Miew.min.js.map \ No newline at end of file diff --git a/packages/miew/dist/Miew.min.js.map b/packages/miew/dist/Miew.min.js.map index 0ed99d6b5..62d6a8913 100644 --- a/packages/miew/dist/Miew.min.js.map +++ b/packages/miew/dist/Miew.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../node_modules/spin.js/spin.js","../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../src/Timer.js","../../src/gfx/Stats.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../src/utils/EventDispatcher.js","../../src/utils/logger.js","../../src/utils.js","../../src/utils/JobHandle.js","../../src/settings.js","../../src/options.js","../../node_modules/@babel/runtime/helpers/defineProperty.js","../../src/chem/Atom.js","../../src/chem/Element.js","../../src/chem/Bond.js","../../src/chem/Residue.js","../../src/chem/ResidueType.js","../../src/chem/Chain.js","../../src/chem/StructuralElement.js","../../src/chem/Helix.js","../../node_modules/@babel/runtime/helpers/superPropBase.js","../../src/utils/SelectionParser.js","../../node_modules/@babel/runtime/helpers/get.js","../../src/chem/Strand.js","../../src/chem/Sheet.js","../../src/chem/SGroup.js","../../src/chem/selectors/selectArgs.js","../../src/chem/selectors/selectorsBase.js","../../src/chem/selectors/selectOps.js","../../src/chem/selectors.js","../../src/chem/BiologicalUnit.js","../../src/chem/Assembly.js","../../src/chem/Component.js","../../src/chem/AtomPairs.js","../../src/chem/AutoBond.js","../../src/chem/AromaticLoopsMarker.js","../../src/chem/VoxelWorld.js","../../src/chem/HBondInfo.js","../../src/chem/SecondaryStructureMap.js","../../src/chem/Complex.js","../../src/chem/Volume.js","../../src/chem.js","../../src/chem/Molecule.js","../../src/gfx/CSS2DObject.js","../../src/gfx/RCGroup.js","../../src/gfx/capabilities.js","../../src/gfx/noiseTexture.js","../../src/gfx/shaders/UberMaterial.js","../../src/gfx/gfxutils.js","../../src/Visual.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../src/utils/EntityList.js","../../src/utils/makeContextDependent.js","../../src/gfx/geometries/SphereCollisionGeo.js","../../src/gfx/geometries/InstancedSpheresGeometry.js","../../src/gfx/geometries/RaycastableBufferGeometry.js","../../src/gfx/geometries/ChunkedObjectsGeometry.js","../../src/gfx/geometries/SimpleSpheresGeometry.js","../../src/gfx/geometries/Simple2CCylindersGeometry.js","../../src/gfx/geometries/CylinderBufferGeometry.js","../../src/gfx/geometries/Instanced2CCylindersGeometry.js","../../src/gfx/geometries/ExtrudedObjectsGeometry.js","../../src/gfx/geometries/ThickLinesGeometry.js","../../src/gfx/geometries/LinesGeometry.js","../../src/gfx/geometries/CylinderCollisionGeo.js","../../src/gfx/geometries/ChunkedLinesGeometry.js","../../src/gfx/geometries/TwoColorLinesGeometry.js","../../src/gfx/geometries/CrossGeometry.js","../../src/gfx/geometries/IsoSurfaceGeometry.js","../../src/gfx/geometries/IsoSurfaceMarchCube.js","../../src/gfx/geometries/IsoSurface.js","../../src/gfx/geometries/VolumeSurfaceGeometry.js","../../src/gfx/geometries/QuickSurfGeometry.js","../../src/gfx/geometries/ContactSurface.js","../../src/gfx/geometries/IsoSurfaceAtomColored.js","../../src/gfx/geometries/ContactSurfaceGeometry.js","../../src/gfx/geometries/IsosurfaceBuildNormals.js","../../src/gfx/geometries/IsoSurfaceGeo.js","../../src/gfx/geometries/SSIsosurfaceGeometry.js","../../src/gfx/geometries/geometries.js","../../src/gfx/geometries/LabelsGeometry.js","../../src/gfx/meshes/UberObject.js","../../src/gfx/meshes/ZSpriteMesh.js","../../src/gfx/meshes/ZClippedMesh.js","../../src/gfx/meshes/TextMesh.js","../../src/gfx/meshes/SimpleMesh.js","../../src/gfx/meshes/ThickLineMesh.js","../../src/gfx/meshes/InstancedMesh.js","../../src/gfx/meshes/meshes.js","../../src/gfx/meshes/MeshCreator.js","../../src/gfx/meshes/TransformGroup.js","../../src/gfx/modes/groups/ChemGroup.js","../../src/gfx/modes/groups/AtomsGroup.js","../../src/gfx/modes/groups/AtomsSphereGroup.js","../../src/gfx/modes/groups/AtomsSurfaceGroup.js","../../src/gfx/modes/groups/AtomsSASSESGroupStub.js","../../src/gfx/modes/groups/AtomsTextGroup.js","../../src/gfx/modes/groups/AromaticGroup.js","../../src/gfx/modes/groups/AromaticTorusGroup.js","../../src/gfx/modes/groups/AromaticLinesGroup.js","../../src/gfx/modes/groups/ResiduesGroup.js","../../src/gfx/modes/groups/NucleicItemGroup.js","../../src/gfx/modes/groups/NucleicCylindersGroup.js","../../src/gfx/modes/groups/NucleicSpheresGroup.js","../../vendor/js/Smooth.js","../../src/gfx/modes/groups/CartoonHelper.js","../../src/gfx/modes/groups/ResiduesSubseqGroup.js","../../src/gfx/modes/groups/ResiduesTraceGroup.js","../../src/gfx/modes/groups/BondsGroup.js","../../src/gfx/modes/groups/groups.js","../../src/gfx/modes/groups/BondsCylinderGroup.js","../../src/gfx/modes/groups/BondsLinesGroup.js","../../src/gfx/modes/processors/AtomsProcessor.js","../../src/gfx/modes/processors/OrphanAtomsProcessor.js","../../src/gfx/modes/processors/ResiduesProcessor.js","../../src/gfx/modes/processors/processors.js","../../src/gfx/modes/processors/NucleicProcessor.js","../../src/gfx/modes/processors/SubseqsProcessor.js","../../src/gfx/modes/processors/BondsProcessor.js","../../src/gfx/modes/processors/AromaticProcessor.js","../../src/gfx/modes/groups/GroupsFactory.js","../../src/gfx/modes/Mode.js","../../src/gfx/modes/LinesMode.js","../../src/gfx/modes/LicoriceMode.js","../../src/gfx/modes/BallsAndSticksMode.js","../../src/gfx/modes/VanDerWaalsMode.js","../../src/gfx/modes/TraceMode.js","../../src/gfx/modes/TubeMode.js","../../src/gfx/modes/CartoonMode.js","../../src/gfx/modes/SurfaceMode.js","../../src/gfx/modes/QuickSurfaceMode.js","../../src/gfx/modes/IsoSurfaceMode.js","../../src/gfx/modes/IsoSurfaceSASMode.js","../../src/gfx/modes/IsoSurfaceSESMode.js","../../src/gfx/modes/ContactSurfaceMode.js","../../src/gfx/modes/TextMode.js","../../src/gfx/modes.js","../../src/gfx/palettes/Palette.js","../../src/gfx/palettes/cpkPalette.js","../../src/gfx/palettes/jmolPalette.js","../../src/gfx/palettes/vmdPalette.js","../../src/gfx/palettes.js","../../src/gfx/colorers/Colorer.js","../../src/gfx/colorers/ElementColorer.js","../../src/gfx/colorers/ResidueTypeColorer.js","../../src/gfx/colorers/SequenceColorer.js","../../src/gfx/colorers/ChainColorer.js","../../src/gfx/colorers/SecondaryStructureColorer.js","../../src/gfx/colorers/UniformColorer.js","../../src/gfx/colorers/ConditionalColorer.js","../../src/gfx/colorers/ConformationColorer.js","../../src/gfx/colorers/TemperatureColorer.js","../../src/gfx/colorers/OccupancyColorer.js","../../src/gfx/colorers/HydrophobicityColorer.js","../../src/gfx/colorers/MoleculeColorer.js","../../src/gfx/colorers/CarbonColorer.js","../../src/gfx/colorers.js","../../src/gfx/materials.js","../../src/gfx/Representation.js","../../src/ComplexVisualEdit.js","../../src/ComplexVisual.js","../../src/gfx/shaders/VolumeMaterial.js","../../src/gfx/VolumeMesh.js","../../src/gfx/VolumeBounds.js","../../src/gfx/VolumeFarPlane.js","../../src/VolumeVisual.js","../../src/io/loaders/LoaderList.js","../../src/io/loaders/Loader.js","../../src/io/loaders/FileLoader.js","../../src/io/loaders/XHRLoader.js","../../src/io/loaders/ImmediateLoader.js","../../src/io/loaders.js","../../src/io/parsers/ParserList.js","../../src/io/parsers/Parser.js","../../src/io/parsers/pdb/Remark290.js","../../src/io/parsers/pdb/Remark350.js","../../src/io/parsers/PDBStream.js","../../src/io/parsers/PDBParser.js","../../src/io/parsers/CMLParser.js","../../vendor/js/mmtf.js","../../src/io/parsers/MMTFParser.js","../../src/io/parsers/ParsingError.js","../../src/io/parsers/readCIF.js","../../src/io/parsers/CIFParser.js","../../src/io/parsers/VolumeModel.js","../../src/io/parsers/CCP4Parser.js","../../src/io/parsers/XYZParser.js","../../src/io/parsers/PubChemParser.js","../../src/io/parsers/SDFStream.js","../../src/io/parsers/SDFParser.js","../../src/io/parsers/DSN6Parser.js","../../src/io/parsers/GROReader.js","../../src/io/parsers/GROParser.js","../../src/io/parsers/MOL2Parser.js","../../src/io/parsers.js","../../src/io/exporters/ExporterList.js","../../src/io/exporters/Exporter.js","../../src/io/exporters/PDBResult.js","../../src/io/exporters/PDBExporter.js","../../src/io/exporters/fbx/FBXModel.js","../../src/io/exporters/fbx/FBXGeometry.js","../../src/io/exporters/fbx/FBX1CGeometry.js","../../src/io/exporters/fbx/FBX2CCylinder.js","../../src/io/exporters/fbx/FBXInfoExtractor.js","../../src/io/exporters/fbx/FBXResult.js","../../src/io/exporters/FBXExporter.js","../../src/io/exporters.js","../../src/ui/ObjectControls.js","../../src/io/io.js","../../src/gfx/CSS2DRenderer.js","../../src/ui/Picker.js","../../src/gfx/Axes.js","../../src/gfx/FrameInfo.js","../../src/gfx/objects/SceneObject.js","../../src/gfx/objects/LinesObj.js","../../src/gfx/shaders/OutlineMaterial.js","../../src/gfx/shaders/FXAAMaterial.js","../../src/gfx/shaders/AOMaterial.js","../../src/gfx/shaders/AOHorBlurMaterial.js","../../src/gfx/shaders/AOVertBlurWithBlendMaterial.js","../../src/gfx/shaders/AnaglyphMaterial.js","../../src/gfx/ViewInterpolator.js","../../src/utils/Cookies.js","../../src/gfx/vr/createWebVRButton.js","../../src/Miew.js","../../src/gfx/vr/WebVRPoC.js","../../src/utils/MiewCLIParser.js","../../src/utils/MiewCLIHelp.js","../../src/Miew-cli.js"],"names":["arrayWithHoles","arr","Array","isArray","iterableToArrayLimit","i","Symbol","iterator","Object","prototype","toString","call","_arr","_n","_d","_e","undefined","_s","_i","next","done","push","value","length","err","nonIterableRest","TypeError","slicedToArray","__assign","assign","t","s","n","arguments","p","hasOwnProperty","apply","this","defaults","lines","width","radius","scale","corners","color","fadeColor","animation","rotate","direction","speed","zIndex","className","top","left","shadow","position","Spinner","spin","target","stop","el","document","createElement","opts","setAttribute","css","transform","insertBefore","firstChild","borderRadius","Math","round","shadows","boxShadow","regex","_a","split","matches","match","x","y","xUnits","yUnits","prefix","end","parseBoxShadow","degrees","backgroundLine","height","background","getColor","transformOrigin","delay","line","normalizeShadow","appendChild","drawLines","requestAnimationFrame","cancelAnimationFrame","clearTimeout","animateId","parentNode","removeChild","props","prop","style","idx","radians","sin","cos","normalized","shadows_1","xy","PI","join","classCallCheck","instance","Constructor","_defineProperties","descriptor","enumerable","configurable","writable","defineProperty","key","createClass","protoProps","staticProps","Timer","startTime","oldTime","elapsedTime","running","now","getElapsedTime","update","delta","newTime","window","performance","bind","Date","tag","id","element","cssText","Stats","domElement","_text","_startTime","_prevTime","_deltas","_index","_total","_count","time","ms","fps","textContent","toPrecision","on","display","_typeof","obj","module","exports","constructor","assertThisInitialized","self","ReferenceError","possibleConstructorReturn","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","_setPrototypeOf","inherits","subClass","superClass","create","isNativeFunction","fn","Function","indexOf","_construct","Parent","args","Class","Reflect","construct","sham","Proxy","e","isNativeReflectConstruct","a","_wrapNativeSuper","_cache","Map","has","get","set","Wrapper","isUndefOrEqual","param","EventDispatcher","_handlers","addEventListener","type","callback","context","handlers","params","_","find","par","removeEventListener","forEach","handler","ev","remove","values","omitBy","dispatchEvent","event","priorities","debug","info","report","warn","error","Logger","console","_priority","verify","number","isNumber","Error","instantiate","_this","findKey","level","levels","keys","message","priority","_message","String","concat","logger","browserType","DEFAULT","SAFARI","decodeQueryComponent","text","decodeURIComponent","replace","getUrlParameters","url","query","location","search","substring","result","exec","DebugTracer","namespace","enabled","enable","indent","methods","wrap","method_","name_","spaces","substr","_len","_key","name","method","OutOfMemoryError","bytesToBase64","buffer","bytes","Uint8Array","binary","byteLength","fromCharCode","btoa","bytesFromBase64","str","atob","charCodeAt","isAlmostPlainObject","isPlainObject","proto","getFileExtension","fileName","slice","max","lastIndexOf","Infinity","dataUrlToBlob","parts","partsCount","Blob","unquotedStringRE","enquoteHelper","utils","encodeQueryComponent","excludeExp","encodeURIComponent","code","parseInt","getUrlParametersAsDict","_a$i","resolveURL","URL","href","anchor","generateRegExp","symbolStr","symbolList","listStr","RegExp","attrs","content","child","createTextNode","HTMLElement","deriveClass","cls","base","members","statics","deriveDeep","needZeroOwnProperties","res","copy","hexColor","hex","allocateTyped","TypedArrayName","size","RangeError","arrayFromBase64","TypedArrayClass","arrayToBase64","array","compareOptionsWithDefaults","defOpts","optsStr","objectsDiff","src","dst","diff","forIn","srcValue","dstValue","deepDiff","isEmpty","isEqual","forInRecursive","object","iterateThrough","newPref","enquoteString","isString","unquoteString","SyntaxError","getBrowser","navigator","vendor","userAgent","shotOpen","open","write","shotDownload","dataUrl","filename","msSaveBlob","link","download","innerHTML","createObjectURL","body","click","copySubArrays","indices","itemSize","j","shallowCloneNode","node","newNode","cloneNode","worldPos","correctSelectorIdentifier","test","splitFileName","ext","data","blobData","concatTypedArraysUnsafe","first","second","mergeTypedArraysUnsafe","reduce","acc","cur","start","count","JobHandle","_shouldCancel","slaveEvent","modes","BS","atom","bond","space","multibond","aromrad","showarom","polyComplexity","poor","low","medium","high","ultra","VW","LN","offsarom","chunkarom","lineWidth","LC","SA","zClip","probeRadius","subset","wireframe","SE","QS","isoValue","gaussLim","gridSpacing","CS","probePositions","TR","TU","heightSegmentsRatio","tension","CA","depth","ss","helix","arrow","strand","TX","template","horizontalAlign","verticalAlign","dx","dy","dz","fg","bg","showBg","VD","kSigma","kSigmaMed","kSigmaMax","frame","isoMode","colorers","EL","carbon","UN","CO","baseColor","CB","factor","SQ","gradient","TM","min","OC","HY","MO","antialias","camFov","camNear","camFar","camDistance","radiusToFit","fogNearFactor","fogFarFactor","fogAlpha","fogColor","fogColorEnable","palette","resolution","autoResolution","autoPreset","preset","presets","default","mode","colorer","selector","material","empty","wire","small","macro","objects","dashSize","gapSize","transparent","draft","clipPlane","clipPlaneFactor","clipPlaneSpeed","plugins","axes","fog","zSprites","isoSurfaceFakeOpacity","suspendRender","nowater","autobuild","fxaa","outline","threshold","thickness","ao","autoRotation","maxfps","fbxprec","autoRotationAxisFixed","zooming","picking","pick","editing","aromatic","singleUnit","stereo","interpolateViews","transparency","translationSpeed","example","good","ssaoKernelRadius","ssaoFactor","stereoBarrel","use","multiFile","Settings","old","_changed","reset","path","_notifyChange","merge","_notifyChanges","defaultValue","cloneDeep","checkpoint","deepValue","deepPath","changed","filter","applyDiffs","diffs","VERSION","getDiffs","versioned","setPluginOpts","plugin","settings","repIndex","asBoolean","toLowerCase","adapters","string","Number","boolean","cOptsSep","cL2Ass","cLSep","cL1ExclExpr","cCommonIgnoreSymbols","encodeQueryComponentL1","cL2ExclExpr","encodeQueryComponentL2","ensureRepList","reps","_Object$keys","ensureRepAssign","rep","extractArgs","input","defaultsDict","bang","inputVal","sep","arg","pair","adapter","_typeof_1","actions","l","load","v","view","u","unit","menu","options","_objects","_options","newOpts","newObj","addObject","r","select","m","c","mt","materials","dup","ar","_fromArray","entries","entry","action","isFunction","_processOptsForURL","_processArgsForURL","_processObjForURL","objOpts","_processOptsForScript","_processArgsForScript","_processObjForScript","map","_processRepsForScript","index","repString","strIdx","localAdd","fromURL","fromAttr","attr","toURL","stringList","checkAndAdd","repList","addReps","objList","addObjects","protocol","host","pathname","toScript","commandsList","command","saveQuotes","quote","trim","Atom","residue","role","het","serial","occupancy","temperature","charge","mask","hydrogenCount","radicalCount","valence","bonds","flags","Flags","HYDROGEN","CARBON","process","_chain","getName","_sequence","NONPOLARH","Element","fullName","weight","radiusBonding","hValency","hydrogenValency","U1","Lead","U2","Wing","U18","N","Constants","C","O","SG","D","T","byAtomicNumber","ByAtomicNumber","byName","ByName","getByName","cBondTypes","UNKNOWN","COVALENT","AROMATIC","getAtomPos","Bond","right","order","fixed","_left","_right","_fixed","_order","_type","distanceTo","currAtom","_forEachNeighbour","l2Atom","refPoint","currDir","posGetter","rightCount","leftCount","tmpVec","clone","checkDir","sub","dot","checkCarbon","stages","forEachLevelOne","forEachLevelTwo","stageId","multiplyScalar","third","maxNeibs","another","secondPos","firstV","secondV","crossVectors","lengthSq","normalize","_fixDir","BondType","cNucleicControlNames","cNucleicWing1Names","cNucleicWing2Names","cCylinderSource","cCylinderTarget","types","atoms","Residue","chain","sequence","icode","_component","_icode","_mask","_atoms","_secondary","_firstAtom","_leadAtom","_wingAtom","_lastAtom","_controlPoint","_midPoint","_wingVector","_cylinders","_isValid","_het","_molecule","xyz","altLoc","tempFactor","getComplex","addAtom","forEachAtom","names","_findAtomByName","_name","getAtomPosition","leadAtom","_findFirstAtomInList","wingStart","wingEnd","cylSource","targetList","getCylinderTargetList","cylTarget","prevLeadPos","currLeadPos","prevWingPos","prevWing","vectorA","vectorB","abs","angleTo","negate","prevRes","prev","nextRes","chainAsNucleic","bFirstInChain","lp","THREE","z","_detectLeadWing","lerp","calcWing","asNucleic","_innerFinalize","anotherResidue","_this$_atoms","tempCount","occupCount","ResidueType","letterCode","_fullName","_addFlag","flag","list","StandardTypes","ALA","ARG","ASN","ASP","CYS","GLN","GLU","GLY","HIS","ILE","LEU","LYS","MET","PHE","PRO","PYL","SEC","SER","THR","TRP","TYR","VAL","A","G","I","U","DA","DC","DG","DI","DT","DU","+A","+C","+G","+I","+T","+U","WAT","H2O","HOH","DOD","UNK","UNL","PROTEIN","BASIC","ACIDIC","POLAR","NONPOLAR","NUCLEIC","PURINE","PYRIMIDINE","DNA","RNA","WATER","_addParam","ChainType","Chain","complex","_complex","_residues","minSequence","POSITIVE_INFINITY","maxSequence","NEGATIVE_INFINITY","residues","_ResidueType$Flags","seqNum","iCode","_determineType","curr","_finalize2","frameData","prevData","frameRes","currData","getResidueType","addResidueType","addResidue","StructuralElement","init","term","generic","genericByType","serialAtomMap","residueHash","splitUnifiedSerial","chainId","serialId","hashCode","getUnifiedSerial","Type","STRAND","BRIDGE","HELIX_310","HELIX_ALPHA","HELIX_PI","HELIX","TURN_310","TURN_ALPHA","TURN_PI","TURN","BEND","COIL","Generic","LOOP","StructuralElementType","StructuralElementGeneric","_StructuralElement$ge","typeByPDBHelixClass","1","3","5","Helix","helixClass","comment","$V0","$V1","$V2","$V3","$V4","$V5","$V6","$V7","$V8","$V9","$Va","$Vb","$Vc","$Vd","parser","lexer","superPropBase","property","_get","receiver","desc","getOwnPropertyDescriptor","Strand","sheet","sense","atomCur","atomPrev","as","isNaN","Sheet","_width","_strands","_finalize","SGroup","saveNode","_id","_position","_charge","_repeat","_center","xmlNodeRef","bLow","bHight","aPos","addVectors","k","Parser","yy","trace","symbols_","Program","Expression","EOF","Selector","OR","AND","NOT","(",")","SELECTOR","NAMED_SELECTOR","SELECTOR_RANGED","RangeList","SELECTOR_NAMED","NameList","Range",",","NUMBER",":","Name","IDENTIFIER","STRING","$accept","$end","terminals_","2","7","8","9","10","11","12","13","14","16","19","20","21","23","24","productions_","performAction","yytext","yyleng","yylineno","yystate","$$","$0","$","keyword","GetSelector","append","ValueList","table","4","6","15","18","17","22","defaultActions","parseError","hash","recoverable","parse","stack","tstack","vstack","lstack","sharedState","setInput","yylloc","yyloc","ranges","symbol","state","len","newState","expected","token","yyval","pop","lex","errStr","showPosition","loc","_$","first_line","last_line","first_column","last_column","range","_input","_more","_backtrack","matched","conditionStack","offset","ch","unput","oldLines","more","reject","backtrack_lexer","less","pastInput","past","upcomingInput","pre","test_match","indexed_rule","backup","tempMatch","rules","_currentRules","flex","begin","condition","popState","conditions","topState","pushState","stateStackSize","case-insensitive","yy_","$avoiding_name_collisions","INITIAL","inclusive","List","_values","splice","toJSON","includes","valuesArray","upperOnly","toUpperCase","_validate","ListSelector","RangeListSelector","ValueListSelector","caseSensitive","NoneSelector","AllSelector","none","PrefixOperator","rhs","InfixOperator","lhs","_this2","keywords","defineSelector","SelectorClass","factory","SerialSelector","NameSelector","AltLocSelector","ElemSelector","ResidueSelector","SequenceSelector","ICodeSelector","ResIdxSelector","ChainSelector","HetatmSelector","PolarHSelector","NonPolarHSelector","NULL_SELECTOR","defineOperator","OperatorClass","byResidueTypeFlag","_class","NotOperator","includesAtom","AndOperator","OrOperator","selectors","Context","ClearContext","BiologicalUnit","_selector","_boundaries","boundingBox","boundingSphere","makeEmpty","expandByPoint","bbc","getCenter","setFromCenterAndSize","radiusSquared","center","pos","lengthSquared","distanceToSquared","sqrt","Assembly","chains","matrices","oldCenter","oldRad","applyMatrix4","newRad","addScalar","subScalar","matrix","Component","_residueIndices","_cycles","_subDivs","_residueCount","resIdc","idIdc","idCount","last","subDivs","resCnt","_bonds","forEachCycle","cycle","forEachResidue","cycles","subs","currRes","endRes","_forEachSubChain","_subIdx","currIdx","lastSubIdx","subIdx","boundaries","cHashTableSize","AtomPairs","maxPairsEstimate","numPairs","numMaxPairs","intBuffer","Int32Array","hashBuffer","indexA","indexB","ia","ib","codeToAdd","apI","_getBondingRadius","v1Tmp","v2Tmp","cp","AutoBond","_maxRad","bBox","getDefaultBoundaries","_vBoxMin","_vBoxMax","_pairCollection","getAtoms","numAtoms","aInd","collection","numBondsForAtom","bInd","addPair","vw","getVoxelWorld","rA","isHydrogenA","posA","locationA","atomA","atomsNum","processAtom","atomB","isHydrogen","locationB","dist2","rB","maxAcceptable","isHet","forEachAtomWithinRadius","iA","iB","_addPair","bondsA","numBonds","newBond","addBond","_buildInner","_calcBoundingBox","_addExistingPairs","_findPairs","_addPairs","nAtoms","maxRad","destroy","cAromaticType","cAromaticAtoms","_coDirVectors","v1","v2","_insertAscending","val","_anotherAtom","_markAromatic","Cycle","atomsList","nA","add","nextAtom","checkBond","forEachBond","_isAromatic","_isPossibleAromatic","rightIdx","leftIdx","_checkCycleSimple","_checkCycleComplex","AromaticLoopsMarker","bondsData","bondMarks","_bondsData","_bondMarks","_resetCycles","_currIdx","bond1","bond2","arr1","arr2","n1","n2","i1","i2","prevBond","currRight","bondsOrder","currLeft","currVec","startAtomRef","_currStart","checkAromatic","_checkBond","_haveSameCycle","theta","anotherAtom","anotherVec","clamp","newDir","cross","dir","newRight","_tryBond","checkCycle","forEachComponent","component","_startCycle","newCycle","addCycle","_findLoops","VoxelWorld","box","vCellSizeHint","_box","getSize","divide","floor","_last","_cellSize","_cellInnerR","_cellOuterR","numVoxels","_voxels","getAtomCount","voxelIdx","_findVoxel","point","zero","_zero","voxel","_voxel","xRange","_xRange","yRange","_yRange","zRange","_zRange","_forEachVoxelWithinRadiusSimple","rRangeXY","rRangeX","xVal","yVal","zVal","isInsideX","isInsideY","isInsideZ","yMin","yMax","dyMin","dyMax","ryMin","ryMax","zMin","zMax","dzMin","dzMax","rzMin","rzMax","divideScalar","clampScalar","vCenter","_vCenter","distTouch2","distInside2","d2","r2","_forEachVoxelWithinRadius","isInside","_forEachAtomInVoxel","dist","_forEachAtomWithinDistFromGroup","atomProc","voxels","processIfWithin","COUPLING_CONSTANT","HBondInfo","_hbonds","_buildVW","_build","from","to","_this$_hbonds$from$ac","acceptor","acc0","acc1","energy","ri","getType","preri","rj","prerj","_calcHBondEnergy","pairs","PairCollection","_residueGetCAlpha","_this$_residueGetCO","_residueGetCO","_this$_residueGetCO2","h","predonor","donor","_this$_residueGetNH","_residueGetNH","_this$_residueGetNH2","_this$_residueGetCO3","_this$_residueGetCO4","distanceHO","distanceHC","distanceNC","distanceNO","donorInfo","accInfo","BridgeType","freeze","NO_BRIDGE","PARALLEL","ANTI_PARALLEL","HelixFlag","START","MIDDLE","END","START_AND_END","StructureType","SecondaryStructureMap","_ss","_sheet","_betaPartners","_bend","getResidues","_helixFlags","_chainLengths","_chains","_buildBetaSheets","_buildAlphaHelices","inResidues","chainLength","inPreferPiHelices","stride","isBond","kappa","_kappa","_isHelixStart","isTurn","p1","p2","p3","p4","v12","v34","prevPrev","nextNext","curCA","ppCA","nnCA","ckap","_cosinusAngle","skap","atan2","bridges","lenA","chainA","b","lenB","chainB","_testBridge","found","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","bridge","unshift","chainI","getChain","chainJ","sort","ibi","iei","jbi","jei","ibj","iej","jbj","jej","_hasChainBreak","ladderset","Set","ladder","sheetset","toMove","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_step2","_iterator2","_iteratorNormalCompletion4","_didIteratorError4","_iteratorError4","_step4","_iterator4","_areBridgesLinked","_iteratorNormalCompletion3","_didIteratorError3","_iteratorError3","_step3","_iterator3","_iteratorNormalCompletion5","_didIteratorError5","_iteratorError5","_step5","_iterator5","betai","betaj","parallel","d","f","ai","aj","_iteratorNormalCompletion6","_didIteratorError6","_iteratorError6","_step6","_iterator6","_iteratorNormalCompletion7","_didIteratorError7","_iteratorError7","_step7","_iterator7","helixClassMap","_helixClassMap","loopMap","_loopMap","Complex","_components","_helices","_sheets","structures","_residueTypes","_sgroups","_molecules","_maskNeedsUpdate","metadata","symmetry","units","_currentUnit","forEachChain","updateToFrame","resName","chainName","resId","atomName","localeCompare","molecules","groups","components","maxSerial","uniSerial","remnant","insCode","addComp","comp","resCount","currStart","isConnected","setSubDivs","currSubDivs","enableEditing","_fillCmpEdit","_fillCmpNoedit","getBoundaries","getTransforms","getSelector","setCurrentUnit","newUnit","computeBoundaries","_computeBounds","_finalizeBonds","forEachSGroup","_rebuildSGroupOnAtomChange","updateStructuresMask","getBonds","finalize","getSequence","getICode","helices","sheets","needAutoBonding","autoConnector","build","_fillComponents","marker","markCycles","detectAromaticLoops","detectCycles","_finalizeMolecules","molecule","updater","structure","collectMask","forEachMolecule","setMask","clearMask","totalSelector","reseter","_atomNames","dict","_elements","_residueNames","_chainNames","_altlocNames","_voxelWorld","addAtoms","srcArray","dstArray","functor","elem","complexes","atomBias","bondBias","residueBias","chainBias","componentBias","bias","processBond","processResidue","processChain","processComponent","doNothing","rt","addElement","lastCode","lastSheetIndex","ssMap","lastHelixIndex","curStructure","curCode","curResidue","curSheetIndex","loopType","curSheet","addStrand","pow2ceil","Volume","dimensions","vecSize","volumeInfo","_dimVec","_volumeInfo","_dimensions","_dimX","_dimY","_dimZ","_rowElements","_planeElements","_totalElements","_data","getValue","setValue","addValue","boxSize","Float32Array","vl","getCellSize","vs","xSize","ySize","zSize","volMap","_voxelValue","zi","zm","zp","yi","ym","yp","xi","xm","xp","tilesX","ceil","tilesY","tileRow","row","texture","needsUpdate","chem","Molecule","CSS2DObject","_element","transp","getElement","op","op100","opacity","RCGroup","raycaster","intersects","visible","children","raycast","innerOnly","enableSubset","disableSubset","totalSubset","getSubset","capabilities","precision","renderer","getMaxPrecision","_noiseData","_noiseWrapS","_noiseWrapT","_noiseMinFilter","_noiseMagFilter","_noiseMapping","noiseTexture","noise","noiseWidth","noiseHeight","_samplesKernel","defaultUniforms","lights","diffuse","specular","shininess","fixedColor","zOffset","zClipValue","clipPlaneValue","invModelViewMatrix","world2colorMatrix","dashedLineSize","dashedLinePeriod","projMatrixInv","viewport","samplesKernel","noiseTex","noiseTexelSize","srcTexelSize","uberOptionNames","UberMaterial","instancedPos","instancedMatrix","attrColor","attrColor2","attrAlphaColor","overrideColor","sphereSprite","cylinderSprite","fakeOpacity","prepassTransparancy","colorFromPos","shadowmap","shadowmapType","colorFromDepth","dashedLine","thickLine","fogTransparent","normalsToGBuffer","toonShading","uberOptions","setValues","uniforms","vertexShader","precisionString","fragmentShader","side","zClipCoef","source","defines","_objectSpread","extensions","createInstance","inst","USE_FOG","INSTANCED_POS","INSTANCED_MATRIX","ATTR_COLOR","ATTR_COLOR2","ATTR_ALPHA_COLOR","OVERRIDE_COLOR","SPHERE_SPRITE","fragDepth","CYLINDER_SPRITE","ZCLIP","CLIP_PLANE","FAKE_OPACITY","USE_LIGHTS","COLOR_FROM_POS","SHADOWMAP","SHADOWMAP_PCF_SHARP","SHADOWMAP_PCF_RAND","SHADOWMAP_BASIC","COLOR_FROM_DEPTH","PREPASS_TRANSP","DASHED_LINE","THICK_LINE","FOG_TRANSPARENT","drawBuffers","NORMALS_TO_G_BUFFER","TOON_SHADING","setUberOptions","shallow","updateUniforms","_worldMatrixInverse","identity","LAYERS","VOLUME","TRANSPARENT","PREPASS_TRANSPARENT","VOLUME_BFPLANE","COLOR_FROM_POSITION","SELECTION_LAYERS","resetTransform","quaternion","updateMatrixWorldRecursive","parent","updateMatrixWorld","addSavingWorldTransform","getInverse","matrixWorld","multiply","decompose","renderDummyQuad","_material","depthWrite","_scene","_quad","_camera","render","renderScreenQuad","isIdentity","equals","applyToPointsArray","w","elements","persp","_v","ScreenQuadMaterial","srcTex","vertexScreenQuadShader","depthTest","_forEachMeshInGroup","group","processObj","clearTree","traverse","geometry","dispose","removeChildren","_getMeshesArr","root","meshTypes","meshes","renderScreenQuadFromTex","renderScreenQuadFromTexWithDistortion","coef","setMinimalFov","angle","aspect","fov","radToDeg","atan","tan","degToRad","updateHalfSized","camera","originalAspect","originalFov","updateProjectionMatrix","setDistanceToFit","intersectVisibleObject","gfxObj","fogFarPlane","intersectObject","nearPlane","near","matrixWorldInverse","farPlane","far","extractScale","te","determinant","copyAtList","attribute","indexList","gfxutils","calcCylinderMatrix","posBegin","posEnd","posCenter","matScale","makeScale","matRotHalf","makeRotationX","matRotLook","vUp","lookAt","setPosition","calcChunkMatrix","eye","up","rad","forEachMeshInGroup","countTriangles","totalCount","mesh","geom","attribs","attributes","currAttr","faces","_countMeshTriangles","groupHasGeometryToRender","hasGeoms","buildDistorionMesh","widthSegments","heightSegements","calcInverseBarrel","prevR2","curR2","dr","geo","getAttribute","setXY","fillArray","startIndex","endIndex","destroyObject","belongToSelectLayers","layers","applyTransformsToMeshes","mtc","mtcCount","applyMatrix","newMesh","processTransparentMaterial","_loop","prepassMat","prepassMesh","processColFromPosMaterial","_loop2","colFromPosMat","colFromPosMesh","createShadowmapMaterial","_loop3","receiveShadow","castShadow","shadowmapMat","shadowmapMesh","isShadowmapMesh","removeShadowmapMaterial","processObjRenderOrder","idMaterial","renderOrder","isGroup","makeVisibleMeshes","checker","applySelectionMaterial","depthFunc","getMiddlePoint","point1","point2","optionalTarget","addScaledVector","_defaultBoundaries","Visual","dataSource","_dataSource","release","getDataSource","arrayWithoutHoles","iterableToArray","iter","nonIterableSpread","toConsumableArray","_ensureArray","EntityList","entities","_list","_dict","_indices","entity","register","registerInList","registerInDict","_this3","unregisterFromList","unregisterFromDict","makeContextDependent","defineProperties","CollisionSphere","_radius","sphere","_sphere","ray","intersectSphere","distance","origin","SphereCollisionGeo","_getPrototypeOf2","inters","chunkIdx","computeBoundingBox","tmpColor","InstancedSpheresGeometry","spheresCount","sphereComplexity","useZSprites","_sphGeometry","_init","itemIdx","itemPos","itemRad","_offsets","setSphere","colorVal","_colors","g","finishUpdate","computeBoundingSphere","chunkIndices","alphaArr","_alpha","instanceCount","sphereGeo","alpha","fill","RaycastableBufferGeometry","uv1","uv2","uv3","barycoord","_barycoord","barycoordFromPoint","pA","pB","pC","intersectTriangle","uv","vA","_vA","vB","_vB","vC","_vC","intersectionPoint","_intersectionPoint","fromBufferAttribute","intersection","checkIntersection","uvA","_uvA","uvB","_uvB","uvC","_uvC","uvIntersection","normal","getNormal","face","faceIndex","intersectsSphere","intersectsBox","_this$attributes","getX","checkBufferGeometryIntersection","ChunkedObjectsGeometry","chunkGeo","chunksCount","_chunkGeo","colors","chunkSize","_chunkSize","facesPerChunk","srcPos","_positions","srcNorm","_normals","srcColor","dstPos","dstNorm","dstColor","dstPtOffset","ptIdxBegin","ptIdxEnd","subarray","chunkIndex","chunkIndexSize","pointsCount","use32bitIndex","indexSize","Uint32Array","Uint16Array","posOffset","setIndex","SimpleSpheresGeometry","sphGeometry","normals","geoNormals","_chunkPos","_tmpPositions","tmpPos","geoPos","centerPos","tmpVector","normMtx","Simple2CCylindersGeometry","cylGeometry","_chunkNorms","_tmpVector","botPos","topPos","firstOffset","secondOffset","tmpArray","geoNorm","lerpVectors","mtx1","getNormalMatrix","fromArray","toArray","applyMatrix3","colorVal1","colorVal2","CylinderBufferGeometry","radiusTop","radiusBottom","radialSegments","heightSegments","openEnded","thetaLength","hasTop","parameters","hasBottom","vertexCount","facesCount","heightHalf","positions","uvs","currVtxIdx","currFaceIdx","tanTheta","v3","v4","setXYZ","vx","vy","vz","startTIdx","lastIdx","fTIdx","currSrcIdx","getY","getZ","nextTVtx","startBIdx","lastBIdx","fBIdx","currSrcBIdx","nextBVtx","invMatrix","setArrayXYZ","setArrayXYZW","sortNumber","Instanced2CCylindersGeometry","_useZSprites","_cylGeometry","_collisionGeo","me","mtxOffset","setItem","_matVector1","_matVector2","_matVector3","_invmatVector1","_invmatVector2","_invmatVector3","colorIdx","_color1","_color2","chunksIdx","cylinderInfo","newPar","_prepareCylinderInfo","cylinderIndices","color1","color2","_assignOpacity","cylinderGeo","VEC_SIZE","TRI_SIZE","tmpPrev","tmpNext","tmpRes","simpleNormal","normalOnCut","nearRingPt","ExtrudedObjectsGeometry","shape","ringsCount","ptsCount","totalPts","_createExtrudedChunkGeometry","_ringsCount","tmpShape","_tmpShape","hasSlope","hasCut","chunkStartIdx","_setPoints","_setSlopeNormals","_setBaseNormals","_addCut","vtxIdx","mtx","nPtsInRing","_countNormalsInRing","isSlope","shiftToExtraPt","subVectors","startSegmentIdx","segmentsCount","elemSize","ThickLinesGeometry","_initVertices","segmentIdx","pos1","pos2","directions","_directions","dirIdx","startSegIdx","endSegIdx","startPos","startDir","_buffersSize","indexOffset","pointOffset","LinesGeometry","BaseLinesGeometry","posSize","getPositionSize","CylinderCollisionGeo","itemOffset","ChunkedLinesGeometry","enableCollision","collisionGeo","segCount","segIdx","setSegments","getSubsetSegments","setColors","getSubsetColors","TwoColorLinesGeometry","segmentIndices","_segCounts","vectors","vecCount","tempPos1","tempPos2","CrossGeometry","setSegment","IsoSurfaceGeometry","_opts","_posRad","posRad","IsoSurfaceMarchCube","pointsValuesLinear","hasIntersection","bitsInside","numCellsPerSide","n3","striIndicesMarchCube","edgeTable","GridCell","_arrSize","cubeIndex","Triangle","createArray","arrSize","IsoSurface","_numTriangles","_numVertices","_volumetricData","_xAxis","_yAxis","_zAxis","_xDir","_yDir","_zDir","cellSize","xAxis","yAxis","zAxis","xDir","yDir","zDir","tmp","notZero","axe","EPSILON","isoLevel","grid","ind1","ind2","vertex","valP1","isoDiffP1","diffValP2P1","mu","triangles","firstIndices","_firstIndices","secondIndices","_secondIndices","vertexList","_vertexList","normalList","_normalList","_vertexInterp","triCount","triTblIdx","triTable","_triTable","step","appendSimple","appendVertex","vol","volData","getData","dim","getDimensions","stepX","getStrideX","stepY","getStrideY","stepZ","getStrideZ","gc","gcVal","gcValSize","additions","axis","triVertex","_origin","posMtx","grad","globTriCount","getDirectIdx","_gradient","_polygonize","computeGradient","_doGridPosNorms","_prepareAxesAndDirs","vertexMap","idcCount","newIndices","vertices","newPositions","newNormals","norm","faceVer","oldVerCount","vMap","newVer","matchedIndex","_remapIndices","_remapVertices","colorMap","atomMap","atomWeightMap","visibilitySelector","atomWeightData","atomStrideX","atomStrideY","atomStrideZ","numVerts","xs","ys","zs","colorData","strideX","strideY","strideZ","xInv","yInv","zInv","atomLookup","atomWeights","interp","idx1","idx2","collectWeight","coefX","coefY","coefZ","newVerCount","ind","mux","muy","muz","maxWeight","dominantIdx","atomIdx","c0","c1","c2","c3","cz0","cz1","numTriangles","newTriCount","i0","VolumeSurfaceGeometry","_visibilitySelector","_calcSurface","posRadArray","itemsCount","maxPosRad","minPosRad","tmpVal","minMaxValues","_findMinMax","minCoordRad","maxCoordRad","gridPadding","radScale","padRad","_minCoordRad","bbox","surface","isoSurf","compute","vertexFusion","setColorVolTex","volTexMap","packedArrays","_findNumVoxels","_computeSurface","_makeSurface","QuickSurfGeometry","_shiftByOrigin","gaussdensity","atomicNum","invIsoValue","invGridSpacing","maxVoxelX","maxVoxelY","maxVoxelZ","volTexData","texStrideX","scaledRad","atomicNumFactor","radInv","radLim","radLim2","xMin","xMax","dy2dz2","addr","texAddr","expVal","density","exp","colInd","originX","originY","originZ","AVHash","maxDistance","minX","minY","minZ","maxX","maxY","maxZ","hashFunc","minW","cid","iDim","jDim","kDim","nCells","jkDim","preHash","iIdx","cellOffsets","cellLengths","maxCellLength","subArray","cellLength","neighbourListLength","withinRadii","rExtra","out","outIdx","nearI","nearJ","nearK","loI","loJ","loK","hiI","hiJ","hiK","iOffset","jOffset","cellStart","cellEnd","dataIndex","baseIndex","rSum","ContactSurface","_indexList","maxRadius","scaleFactor","volTex","weights","gridx","gridy","gridz","sinTable","cosTable","neighbours","ngTorus","lastClip","weightsMap","mid","fillGridDim","innI","initializeGrid","gridSize","TypeName","uniformArray","rExt","initializeAngleTables","singleAtomObscures","innX","innY","innZ","innCI","ra2","obscured","ni","projectTorus","aIdx","bIdx","xa","ya","za","r1","innR2","dmp","rInt","ng","cost","sint","px","py","pz","iax","iay","iaz","minx","miny","minz","maxx","maxy","maxz","iz","iy","dzy2","zyOffset","ix","current","getVolume","ax","ay","az","ar2","colIdx","cr","cg","cb","cIdx","ap","spx","spy","spz","dd","projectPoints","innIdx","projectTorii","innInnI","fixNegatives","IsoSurfaceAtomColored","radiusAt","coord","colorX","colorY","colorZ","atomType","srcAtom","ContactSurfaceGeometry","contactSurface","IsosurfaceBuildNormals","vBoxMin","vBoxMax","_numAtoms","_probeRadius","_atomsList","_voxelList","numAtomsRefs","aveRad","numCells","_numCells","_aveRad","side2","side3","xScale","_xScale","yScale","_yScale","zScale","_zScale","maxAtomsRefs","xNumVoxMult","yNumVoxMult","zNumVoxMult","diaAffect","numVoxX","numVoxY","numVoxZ","xIndMin","yIndMin","zIndMin","xIndMax","yIndMax","zIndMax","indVoxel","indexNext","_vertices","xInd","yInd","zInd","ref","closest","minDist2","MAX_VALUE","forEachRelatedAtom","numVertices","numCloseAtoms","vNormalX","vNormalY","vNormalZ","koef","maxRadAffect","maxRadAffect2","expScale","gatherNormals","radiusColorSmoothness","colorsClose","weightsSum","gatherColors","weightNormalized","IsoSurfaceGeo","maxNumVertices","maxNumTriangles","needVertexColors","_maxNumVertices","_maxNumTriangles","geometries","SSIsosurfaceGeometry","_innerBuild","geoOut","getGeo","_fromGeo","numTri3","atomsColored","nm","hashLines","hashEntries","probeRadius2","atomRadiusScale","radMax","num","numPoints","vOut","invNP","tx","ty","tz","sign","cube","indexPointValue","xb","yb","zb","v0","a0","voxelWorld","getClosestAtom","a1","a2","isTriangleVisible","indInGeo0","addVertexToGeo","indInGeo1","indInGeo2","itr","meshRes","vCellStep","vaEdges","vCorner","indCell","indY","indZ","getCornerCoord","indPointValues","indValues","buildEdgePoint","offs","numTri","indTri","addTriangle","numIntersectedCells","cubeValuesIndex","indCorner","letter","atomT","probeRad","vDif","fx","fy","fz","indXMin","indYMin","indZMin","indXMax","indYMax","indZMax","HASH_SIZE","numHashEtriesAllocated","numHashEntryIndex","vAdd","hashResolution","marCubeResoultion","iHash","hLineIndex","iVertAdd","getNewHashEntry","entryFirst","probeSphereRadius","distToSphere","distToBorder","probeSpRad2","sideInv","radEst","xCorner","yCorner","zCorner","ok","meshResolution","colorMode","useVertexColors","excludeProbe","convertToAtomsColored","getBoundingBox","rProbeRadius","calculateGridCorners","numIntersectedCellsEstim","getNumIntersectedCells","createVertexHash","probeRadForNormalsColors","createVoxels","buildGeoFromCorners","modifyExcludedFromGeo","buildNormals","buildColors","destroyVoxels","LabelsGeometry","items","xTranslation","yTranslation","deltaPos","userData","translation","fieldTxt","spanText","fontSize","strings","spanNodeP","spanNodeText","createLabel","textAlign","fColor","bColor","UberObject","SuperClass","NewObjectType","rest","onBeforeRender","scene","_onBeforeRender","_update","Mesh","ZSpriteMesh","modelViewMatrix","multiplyMatrices","uniformsNeedUpdate","ZClippedMesh","modelView","_modelView","mvLength","_mvLength","setFromMatrixColumn","localToWorld","TextMesh","initialized","_this$geometry","srcItem","item","label","visibility","SimpleMesh","_viewport","ThickLineMesh","projectionMatrix","InstancedMesh","ZClipped","ZSprite","Text","Line","LineSegments","Instanced","setMatParams","_createInstancedCylinders","Geometry","initMaterial","_createLineSegmentsGeoTriplet","renderParams","thickLines","_createIsoSurfaceGeoTriplet","geoClass","caps","surfaceOpts","MeshCreator","_caps","_settings","TransformGroup","geoParams","transforms","_geometry","_geoParams","mat","_transforms","_createMeshes","_ray","inverseMatrix","_inverseMatrix","childIntersects","ciCount","geos","meshCnt","ChemGroup","selection","_selection","_mode","_colorer","_chunksIdc","chunks","_polyComplexity","_geo","_makeGeoArgs","_mesh","chunksList","_calcChunksList","setOpacity","_changeSubsetOpacity","AtomsGroup","atomsIdc","AtomsSphereGroup","_this$_selection","calcAtomRadius","setColor","getAtomColor","updateColor","needsColorUpdate","AtomsSurfaceGroup","selectedAtoms","getSurfaceOpts","AtomsSASSESGroupStub","getAtomText","getNode","getVisualName","colorMappings","adjust","inverse","propagateColor","rule","startsWith","parseTemplate","templateMappings","hetatm","water","AtomsTextGroup","getLabelOpts","fgColor","bgColor","_slerp","omega","oSin","AromaticGroup","radOffset","addChunk","chunksToIdx","prevVector","currVector","segmentsHeight","_segmentsHeight","leprStep","currAtomIdx","cCount","cycAtoms","chunkPoints","tmpDir","cycleRad","prevPos","currPos","upDir","currAngle","AromaticTorusGroup","torusRad","getAromRadius","radiusV","calcStickRadius","lookAtVector","points","currPoint","pts","_createShape","AromaticLinesGroup","getAromaticOffset","prevPt","getAromaticArcChunks","ResiduesGroup","chunksIdc","resIdx","NucleicItemGroup","stickRad","getResidueColor","_processItem","NucleicCylindersGroup","cyl1","cyl2","NucleicSpheresGroup","__extends","__hasProp","ctor","__super__","AbstractInterpolator","CubicInterpolator","Enum","LinearInterpolator","NearestInterpolator","SincFilterInterpolator","Smooth","clipClamp","clipMirror","clipPeriodic","defaultConfig","getColumn","isValidNumber","makeLanczosWindow","makeScaledFunction","makeSincKernel","normalizeScaleTo","shallowCopy","sinc","validateNumber","validateVector","config","clipHelper","clipHelperClamp","clipHelperZero","periodic","clipHelperPeriodic","mirror","clipHelperMirror","clip","tangentFactor","cubicTension","sincFilterSize","sincWindow","kernel","METHOD_NEAREST","METHOD_LINEAR","METHOD_CUBIC","METHOD_LANCZOS","METHOD_SINC","CLIP_CLAMP","CLIP_ZERO","CLIP_PERIODIC","CLIP_MIRROR","CUBIC_TENSION_DEFAULT","CUBIC_TENSION_CATMULL_ROM","scaleTo","period","getClippedInput","interpolate","getTangent","t2","t3","sum","_ref","_ref2","_results","baseScale","scaleRange","isFinite","dimension","invalidErr","baseDomainEnd","interpolator","interpolatorClass","interpolators","properties","smoothFunc","lanczosFilterSize","nearest","linear","cubic","lanczos","_j","_len2","deepValidation","_k","_len3","domain","calcMatrix","_buildStructureInterpolator","argTrans","transformT","tt","newt","ans","_addPoints","centerPoints","topPoints","tp","_calcPoints","firstIdx","_prevIdx","_nextIdx","arrIdx","_extrapolate2","otherIdx","prevIdx","nextIdx","posFrom","posTo","nucleic","nameFrom","nameTo","shift","wing","cpPrev","tpPrev","cpNext","tpNext","_addPointsForLoneResidue","CartoonHelper","startIdx","endIdx","pointsArrays","_topInterp","_centerInterp","_shift","_valueStep","_segmentsCount","firstRad","secondRad","outMtc","currRad","topInterp","cenInterp","currentValue","mtxIdx","lerpVal","currTop","currCenter","nextCenter","_loopThrough","subDiv","subDivI","subDivN","idc","matrixHelper","prevLast","prevSecondRad","getResidueRadius","prepareMatrices","ResiduesSubseqGroup","cmpMultiplier","getHeightSegmentsRatio","getTension","chunkIdc","subdivs","ResiduesTraceGroup","chunk","BondsGroup","drawMultiple","drawMultiorderBonds","showAromatic","showAromaticLoops","bondsIdc","bondsCount","getBondOrder","bondOrder","bondIdx","BondsCylinderGroup","normDir","emptyOffset","calcSpaceFraction","leftPos","rightPos","currBondIdx","atom1","atom2","a1Pos","a2Pos","calcNormalDir","currStickRad","BondsLinesGroup","bondDir","a1Hangs","a2Hangs","AtomsProcessor","atomCount","_checkAtom","atomsGroup","meshIdx","chSubset","subsetEl","OrphanAtomsProcessor","ResiduesProcessor","ResidueGroup","_checkResidue","residuesGroup","processors","Atoms","OrphanAtoms","Residues","Nucleic","NucleicProcessor","ResidueProcessor","Subseqs","SubseqsProcessor","getMaskedSubdivSequences","jEnd","Bonds","BondsProcessor","bondsGroup","Aromatic","AromaticProcessor","cycleIdx","perCycle","_bakeGroup","triplet","Processor","Group","GroupsFactory","createSpheres","createCrosses","create2CCylinders","create2CLines","createExtrudedChains","create2CClosedCylinders","createChunkedLines","createQuickSurface","createContactSurface","createSASSES","createLabels","Mode","groupList","depGroups","groupCount","currGroup","newGroup","getRenderParams","LinesMode","shortName","LicoriceMode","BallsAndSticksMode","VanDerWaalsMode","TraceMode","TubeMode","TUBE_RADIUS","buildGeometry","CartoonMode","secCache","getSecondary","secOpts","ARROW_END","startRad","getResidueStartRadius","endRad","getResidueEndRadius","tubeRad","secHeight","secData","SurfaceMode","surfaces","surfaceNames","isSurface","QuickSurfaceMode","useBeads","getVisibilitySelector","IsoSurfaceMode","_excludeProbe","_radScale","IsoSurfaceSASMode","IsoSurfaceSESMode","ContactSurfaceMode","TextMode","adjustColor","Palette","asIs","elementColors","defaultElementColor","residueColors","defaultResidueColor","chainColors","secondaryColors","defaultSecondaryColor","gradientName","gradients","defaultNamedColor","beta","namedColors","minRangeColor","midRangeColor","maxRangeColor","defaultGradientColor","namedColorsArray","rainbow","temp","hot","cold","blue-red","reds","blues","_namedColorsArray$i","H","F","P","S","CL","FE","NI","CU","BR","HE","LI","BE","B","NE","NA","MG","AL","SI","AR","K","SC","TI","V","CR","MN","ZN","GA","GE","AS","KR","RB","SR","Y","ZR","NB","TC","RU","RH","PD","AG","CD","IN","SN","SB","TE","XE","BA","LA","CE","PR","ND","PM","SM","EU","GD","TB","DY","HO","ER","YB","LU","HF","TA","W","RE","OS","IR","PT","AU","HG","TL","PB","BI","PO","AT","RN","FR","RA","AC","TH","PA","NP","PU","AM","CM","BK","CF","ES","FM","MD","NO","LR","RF","DB","BH","HS","MT","_palette$secondaryCol","_palette$secondaryCol$1","palettes","cpkPalette","jmolPalette","vmdPalette","Colorer","ElementColorer","getElementColor","ResidueTypeColorer","SequenceColorer","getGradientColor","ChainColorer","getChainColor","SecondaryStructureColorer","getSecondaryColor","secondary","UniformColorer","ConditionalColorer","parsed","_subsetCached","ConformationColorer","TemperatureColorer","OccupancyColorer","HydrophobicityColorer","hydrophobicity","MoleculeColorer","getMoleculeCount","CarbonColorer","colorCarbon","colorNotCarbon","neutralColor","intensity","Representation","startMaterialValues","selectorString","materialPreset","needsRebuild","setMode","markAtoms","clearAtomBits","selectionGeo","sg","matrixAutoUpdate","repSettings","selStr","valueOf","modeDiff","identify","colorerDiff","newSelectorObject","newSelector","newMode","newColorer","newMaterial","setMaterialPreset","ComplexEditor","ComplexVisualEdit","ComponentEditor","ComplexComponentEditor","complexVisual","_complexVisual","_inProgress","_componentTransforms","_bakeComponentTransform","onAtomPositionChanged","_resetComponentTransform","finalizeEdit","pivot","visual","getSelectedComponent","reprNode","getSelectionGeo","selectionMask","getSelectionBit","_traverseComponentGroups","bbmin","bbmax","updateMatrix","FragmentEditor","ComplexFragmentEditor","_getSelectionBorderAtoms","_fragmentBoundAtoms","pivotPos","_fragmentGeo","_fragmentSelectionGeo","vg","smeshes","sm","selectionBit","makeTranslation","_bakeAtomTransform","boundAtoms","transformDirection","atomHash","lookupAndCreate","entityList","specs","_specs2","ComplexVisual","_reprList","_repr","_reprListChanged","_selectionBit","_reprUsedBits","_selectionCount","_selectionGeometry","_editor","repCurrent","repAdd","status","change","bits","NUM_REPRESENTATION_BITS","newSelectionBit","_getFreeReprIdx","originalSelection","buildSelectorFromMask","def","unmarkAtoms","hide","show","markAtomsAdditionally","rebuildSelectionGeometry","pickedObj","otherObj","getMolecule","resetSelectionMask","deselectionMask","multiple","selRule","reprList","Promise","resolve","errorOccured","setTimeout","hasGeometry","repr","buildSelectionGeometry","optimizeList","NaN","expression","all","or","and","residx","_buildSelectorFromSortedLists","editor","needTraverse","forEachAtomWithinDistFromMasked","countAtomsByMask","volumeUniforms","volumeDim","tileTex","tileTexSize","tileStride","boxAngles","_isoLevel0","_flipV","_BFLeft","_BFRight","_FFLeft","_FFRight","_WFFLeft","_WFFRight","overrideUniforms","defUniforms","facesPosMaterialParams","sideType","vertexVolumeFaces","fragmentVolumeFaces","ShaderParams","BackFacePosMaterial","backFaceParams","VolumeMaterial$1","BackFacePosMaterialFarPlane","matUniforms","aspectRatio","farZ","tanHalfFOV","matWorld2Volume","shaderParams","FrontFacePosMaterial","frontFaceParams","VolumeMaterial","updateDefines","ISO_MODE","STEPS_COUNT","VolumeMesh","cullFlag","_corners","edges","_edges","edgeIntersections","_edgeIntersections","constant","vert","cornerMark","edgeMark","curEdge","curEdgeInter","CheckX","CheckY","CheckZ","curEdgeIdx","curEdgeSource","nextVertex","coplanarPoint","faceIdx","_collectVertices","vRight","vDir","rightProj","_sortIndices","numIndices","vm","getTiledTextureStride","buildTiledTexture","getBox","image","getVolumeInfo","volInfo","obtuseAngle","mean","sd","span","_settings$now$modes$V","dmean","dmin","dmax","nearClipPlaneOffset","_nearClipPlaneOffset","_pos","_norm","norm4D","_norm4D","matrixWorldToLocal","_matrixWorldToLocal","_clipPlane","_updateIsoLevel","getWorldDirection","getWorldPosition","setFromNormalAndCoplanarPoint","_updateVertices","_updateIndices","VolumeBounds","bSize","offsetVert","_getBaseVertices","_lines","proj","inv","currDelta","projTable","_projectionTable","XY","XZ","YZ","VolumeFarPlane","volume","planeGeo","_initPlaneGeo","_plane","frustumCulled","doubleSided","matWorldToVolume","_renderer","_group","planeCamPos","normalMatrix","volumeMatrix","DEG2RAD","VolumeVisual","setDataSource","_frame","getMesh","showFrame","_farPlane","getBoundingSphere","needShow","LoaderList","someLoaders","SomeLoader","canProbablyLoad","Loader","_source","_abort","_agent","abort","FileLoader","_binary","blob","reader","FileReader","readAsArrayBuffer","readAsText","File","urlStartRegexp","XHRLoader","request","XMLHttpRequest","response","responseType","send","ImmediateLoader","loaders","ParserList","someParsers","format","formats","SomeParser","canProbablyParse","parseSync","model","_parseHeader","Remark290","_matrix","_matrixIndex","stream","readString","matrixRow","readCharCode","matrixData","matrixIndex","parseFloat","Remark350","assemblies","_assembly","assembly","addMatrix","addChain","PDBStream","_start","_nextCR","_nextLF","_next","_end","pdbStartRegexp","remarkParsers","290","350","PDBParser","_residue","_serialAtomMap","_modelId","_compaundFound","_biomoleculeFound","_allowedChainsIDs","_lastMolId","_remarks","_remark","_compndCurrToken","fileType","_fixBondsArray","_fixChains","remark290","isUndefined","remark350","chainDict","chainObj","idChainMap","nj","veryLong","readInt","readChar","chainID","resSeq","readFloat","Role","serial0","serial1","serial2","serial3","serial4","tokenIdx","chainStr","lastChar","remarkNum","remark","RemarkParser","_parseSTRUCTURE","addHelix","addSheet","pars","adder","serialNumber","structureName","helLength","shWidth","shCur","shPrev","startChainID","endChainID","startSequenceNumber","iCodeStr","startICode","endSequenceNumber","endICode","cs","classification","date","title","func","tagParsers","HEADER","_parseHEADER","TITLE ","_parseTITLE","ATOM ","_parseATOM","HETATM","ENDMDL","_parseENDMDL","CONECT","_parseCONECT","COMPND","_parseCOMPND","REMARK","_parseREMARK","HELIX ","_parseHELIX","SHEET ","_parseSHEET","ATOM 1","ATOM 2","ATOM 3","ATOM 4","ATOM 5","ATOM 6","ATOM 7","ATOM 8","ATOM 9","cOrderCharCodes","cmlStartRegexp","CMLParser","_readOnlyOneMolecule","atomId","countBonds","idxs","atomRefs2","moleculeArr","fieldData","atomRefs","placement","fieldName","_extractSGroup","_createSGroup","sgroupRef","atomsRef","mapEntry","cycleFuncInner","cycleFunc","x2","x3","y2","y3","z3","dom","childNodes","parseNode","xmlNode","nodeName","nodeValue","jsonNode","existing","molSet","atomArray","_findSuitableMolecule","rawData","doc","DOMParser","parseFromString","traversedData","_traverseData","cml","retData","filteredData","rd","ret","_extractSGroups","localBond","bondArray","_rebuidBondIndexes","orderAttr","tc","labels","_breadWidthSearch","retStruct","atomLabels","labelsCount","originalCML","prepareComponentCompound","compId","molId","molID","_packLabel","breadthQueue","componentID","labeledAtoms","startID","_unpackLabel","eAtom","mainAtom","varData","currentLabel","reorder","lLabel","atomFullNameStruct","elementType","countRef","currAtomComp","strLabel","JSON","stringify","atomSerial","added","mrvValence","complexAtom","_parseBond","getSGroupCount","sGrp","getSGroups","_selectComponents","_parseSet","totalAtomsParsed","joinedComplex","joinComplexes","setUint8","ArrayBuffer","setUint16","setUint32","setFloat64","setInt8","setInt16","setInt32","DataView","byteOffset","Int8Array","Int16Array","L","q","R","rr","bondAtomList","bondOrderList","xCoordList","yCoordList","zCoordList","bFactorList","atomIdList","altLocList","occupancyList","groupIdList","groupTypeList","secStructList","insCodeList","sequenceIndexList","chainIdList","chainNameList","getInt8","getUint8","getUint16","getUint32","getFloat32","getFloat64","getInt16","getInt32","setFloat32","X","ignoreFields","nr","J","Z","ir","encode","decode","firstModelOnly","onModel","onChain","onGroup","onAtom","onBond","M","E","chainsPerModel","chainCount","modelIndex","groupsPerChain","chainIndex","atomNameList","groupIndex","groupId","groupType","groupName","singleLetterCode","chemCompType","secStruct","sequenceIndex","atomIndex","elementList","formalCharge","formalChargeList","xCoord","yCoord","zCoord","bFactor","atomIndex1","atomIndex2","fetch","fetchReduced","version","fetchUrl","fetchReducedUrl","encodeMsgpack","encodeMmtf","decodeMsgpack","decodeMmtf","ArrayComparator","original","_original","_sum","candidate","sorted","secStructToType","MMTFParser","chainData","groupData","_updateSecStructure","atomData","bondData","_ssType","_ssStruct","_ssStart","struct","mmtfData","chainsInModel0","chainIndexList","description","structureId","releaseDate","eventCallbacks","modelData","_onModel","_onChain","_onGroup","_onAtom","_onBond","MMTF","_updateMolecules","named","bioAssemblyList","baInfo","transformList","chainListCheck","chainNames","allChains","_chainsByName","compare","transpose","primaryChainsArray","primaryChainsHash","primary","_traverse","_linkAtomsToResidues","_markHeteroAtoms","_findSynonymousChains","_parseAssemblyInfo","_joinSynonymousChains","isArrayBuffer","ParsingError","column","captureStackTrace","parseLine","parseColumn","_isWhitespace","_inlineIndexOf","ch0","cRequiredAtomFields","cSecondaryCoding","helx","turn","strn","arrize","arrayLikeObject","AtomDataError","_extractOperations","assemblyGen","opsDict","groupStr","gps","grIdx","grCount","gr","gp","es","cnt","ii","nn","newMtx","CIFParser","asymDict","newline","block","keysCount","valuesCount","_parseValue","keyIndex","readCIF","_toComplex","cifData","complexData","_extractAtoms","_extractSecondary","_extractAssemblies","_extractMolecules","_extractMetadata","struct_keywords","pdbx_keywords","databaserev","database_PDB_rev","date_original","pdbx_description","getMolecules","atom_site","auth_seq_id","Cartn_x","Cartn_y","Cartn_z","label_atom_id","group_PDB","chainIdc","auth_asym_id","chainLabelIdc","label_asym_id","serials","iCodes","pdbx_PDB_ins_code","resNames","label_comp_id","type_symbol","tempFactors","B_iso_or_equiv","occupancies","charges","pdbx_formal_charge","altLocs","label_alt_id","models","pdbx_PDB_model_num","label_entity_id","moleculeIdx","struct_conf","_extractConfs","struct_sheet_range","_extractSheets","sheetData","sheet_id","beg_label_seq_id","end_label_seq_id","beg_label_asym_id","sheetNames","strandNames","starts","beg_auth_seq_id","ends","end_auth_seq_id","stICodes","pdbx_beg_PDB_ins_code","endICodes","pdbx_end_PDB_ins_code","getSheet","findResidue","helicesData","conf_type_id","typeId","comments","details","lengths","pdbx_PDB_helix_length","helixClasses","pdbx_PDB_helix_class","asmGen","pdbx_struct_assembly_gen","asmIdx","assembly_id","asmOper","oper_expression","asmList","asym_id_list","operList","vector","ops","_getOperations","pdbx_struct_oper_list","asm","assemblyOps","valueType","VolumeModel","_header","_boxSize","_boxStart","extent","nstart","crs2xyz","cellDims","angles","isTypedArray","_buff","headerFormat","arrays","_parseArray","_parseVector","header","_header$angles","gamma","z1","z2","_xyz2crs","xaxis","yaxis","zaxis","shiftX","shiftY","_this$_header$angles","_setOrigins","_getXYZdim","_getXYZbox","_toXYZData","_getVolumeInfo","CCP4Header","ispg","nsymbt","lksflg","customData","machine","nlabel","Ccp4Model","_buffer","_typedCheck","u32","i32","f32","_fillHeader","xyz2crs","_this$_getAxis","_getAxis","_this$_getAxis2","_setAxisIndices","_setBoxParams","xyzData","crsIdx","CCP4Parser","XYZParser","_atomsInf","_fileName","endnAtoms","endComment","startAtomsInf","words","_parseToAtomsInf","_parseAtomsInf","PubChemParser","jsonData","PC_Compounds","aids","aid","fromPairs","zip","coords","conformers","aids1","aid1","aids2","aid2","orders","SDFStream","_strings","_currentStart","_currentStringIndx","numb","curStr","getNextString","getCurrentString","setStart","probablyHaveDataToParse","chargeMap","orderMap","typeMap","sdfAndMolRegexp","sdfRegExp","fileFormat","tagsNames","tags","SDFParser","_format","_metadata","_currentMolProps","_compoundIndx","_assemblies","_atomsParsed","_atomsIndexes","getStringFromStart","codes","trunc","reverse","buildChainID","bondsNum","bondType","countsLine","_parseAtoms","_parseBonds","_parseMOL","findNextDataItem","_parseDataItem","_tryToUpdateMoleculeData","tagsList","_searchTag","tagPossibleNames","_tryToFind","_finalizeMetadata","_buildAssemblies","_buildMolecules","defineFormat","_parseCompound","findNextCompoundStart","DSN6Header","div","DSN6Model","i16","byteBuffer","counter","zBlock","yBlock","xBlock","inRange","_pointCalculate","blocks","_blockCalculate","_calculateInfoParams","dispersion","minDensity","maxDensity","pow","DSN6Parser","checkDataTypeOptions","GROReader","GROParser","_time","_residueNumber","_residueName","_atomName","_atomNumber","_atomPosition","_atomVelocity","filetype","readLine","getNext","positionX","positionY","positionZ","_parseTitle","_parseNumberOfAtoms","_parseAtom","un","am","nc","du","resNumberRegex","spacesRegex","splitToFields","MOL2Parser","_currPosIdx","_currStartIdx","MOL2Data","newPosIdx","_toStringFromStart","_toHeaderString","_setStart","_probablyHaveDataToParse","parsedStr","_setResidue","originAtomId","targetAtomId","currMolecule","molResidues","_fixSerialAtoms","_parseMolecule","_toStringFromHeader","_parseRawStrings","_findNextCompoundStart","parsers","ExporterList","someExporters","Exporter","exportSync","PDBResult","_resultArray","_currentStr","_tag","_fixedNumeration","_numeration","_tagStrNum","writeString","numeration","isBoolean","maxStrPos","_currentStrLength","newString","curStrLength","finish","repeat","cStr","bondsArrays","_getSubArrays","subArraySize","subArrays","matrixIndx","toFixed","Matrix4","writeMatrix","PDBExporter","_tags","_result","_tagExtractors","_extractHEADER","TITLE","_extractTITLE","ATOM and HETATM","_extractATOM","_extractCONECT","_extractCOMPND","_extractREMARK","_extractHELIX","SHEET","_extractSHEET","_stringForRemark350","_stringForRemark290","getResult","newTag","fixedBonds","writeBondsArray","strands","invert","startIndx","_getMoleculeChains","chainsString","writeEntireString","_Remark290","_Remark350","writeMatrices","biomolIndx","SourceClass","copyFbxPoint3","srcIdx","dstIdx","copyFbxPoint4","vector4","copyTransformedPoint3","setSubArray","copyFunctor","functorOpts","arridx","FBXModel","lastPos","lastNorm","lastCol","vertsCount","indsCount","shifted","setIndices","currentCount","getVerticesNumber","setShiftedIndices","setTransformedPositions","setTransformedNormals","FBXGeometry","FBX1CGeometry","_info","_geo$attributes","cl","FBX2CCylinder","_cutRawStart","_cutRawEnd","_facesPerSlice","addPerCylinder","_extendVertices","_extendIndices","getGeoParams","startToShift","colorSize","part1End","part2End","_setColorRange","capSize","cap1End","cap2End","FBXInfoExtractor","_materials","_models","_extractModelsAndMaterials","_flattenModels","layersOfInterest","checkExportAbility","_collectInstancedGeoInfo","_collectGeoInfo","faceSize","overallVertsCount","combined","_reworkIndices","verticesCount","_mesh$geometry","_mesh$geometry$attrib","vertCount","setPositions","setNormals","_collectMaterialInfo","_addToPool","_mesh$geometry2","_mesh$geometry2$attri","instCount","maxInstancedCount","instMatrix","objMatrix","sphereColor","instanceIndex","_getSphereInstanceMatrix","addInstance","_mesh$geometry3","_mesh$geometry3$attri","oneCCylinder","splittingInfo","_gatherCylindersColoringInfo","twoCCylinder","needToSplit","additionalVertsCount","colorStart","colorEnd","is2Colored","_getCylinderInstanceMatrix","materialIdx","_checkExistingMaterial","findIndex","differs","_collectSpheresInfo","_collectCylindersInfo","instIdx","matVector1","matVector2","matVector3","idxOffset","FBXResult","_writeHeader","_writeDefinitions","_writeObjects","_writeRelations","_writeConnections","creator","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","allModels","_verticesIndices","_normalLayer","_colorLayer","allMaterials","_materialProperties","modelsList","materialList","colorArray","colorsStr","_floatArrayToString","colorIndices","normalArray","normalsStr","vertStr","FBXExporter","_version","miewVersion","_extractor","rot","eyeDirection","cameraUpDirection","cameraSidewaysDirection","moveDirection","mouseDelta","quat","io","exporters","tempColor","CSS2DRenderer","_height","_widthHalf","_heightHalf","_vector","_viewMatrix","_projectionMatrix","_domElement","overflow","pointerEvents","myNode","lerpColorAsHex","setHex","getHexString","colorAsHex","setFromMatrixPosition","localOffset","getMaxScaleOnAxis","fogFactor","smoothstep","WebkitTransform","MozTransform","oTransform","_renderObject","STATE","matrix4","ObjectHandler","lastRotation","ObjectControls","objectPivot","getAltObj","hotkeysEnabled","screen","rotateFactor","axisRotateFactor","intertia","dynamicDampingFactor","intertiaThreshold","_state","_mousePrevPos","_mouseCurPos","_mainObj","_altObj","_affectedObj","_isAltObjFreeRotationAllowed","_isTranslationAllowed","_isKeysTranslatingObj","_pressedKeys","_clock","_lastUpdateTime","_listeners","mousedown","mouseup","mousemove","mousewheel","touchstartend","touchmove","getKeyBindObject","keydownup","handleResize","resetKeys","contextmenu","Picker","_lastMousePos","_mouseTotalDist","_lastClickBeginTime","_lastClickPos","_clickBeginTime","touchstart","touchend","_rotate","zeroPivot","makeRotationFromQuaternion","setObjects","_objects2","mousePrevPos","mouseCurPos","aboutAxis","mouse2rotation","setFromAxisAngle","translate","translateOnAxis","timeSinceLastUpdate","timeSinceMove","mousePrev","mouseCur","setLength","stopPropagation","preventDefault","innerWidth","innerHeight","getBoundingClientRect","ownerDocument","documentElement","pageXOffset","clientLeft","pageYOffset","clientTop","enableHotkeys","allowTranslation","allow","allowAltObjFreeRotation","keysTranslateObj","isEditingAltObj","convertMouseToOnCircle","pageX","pageY","screenSize","convertMouseToViewport","rotateByMouse","aboutZAxis","getOrientation","setOrientation","getScale","setScale","curTime","_lastMouseMoveTime","speedX","speedY","altObj","button","workWithAltObj","altKey","ctrlKey","shiftKey","translatePivotByMouse","wheelDelta","detail","touches","_touchDistanceCur","_touchDistanceStart","_scaleStart","keyCode","translatePivotInWorld","setX","setY","setZ","translatePivot","setPivot","newPivot","picked","pickObject","screenPos","rayCaster","unproject","fogFarValue","getMouseInViewport","curPos","_lastTouchdownPos","changedTouches","Axes","targetCamera","_target","_targetCamera","_object","_full","autoClear","setViewport","clear","c219","c220","secTypes","cSecNames","_createSecondary","strArray","nRes","resid","rIdx","fromUInt20ToInt20","uint20","FrameInfo","payload","callbacks","isLoading","_framesRange","frameIsReady","_frameRequest","_callbacks","_framesRequestLength","_downloadDataFn","parseBinaryData","setFrame","framesStart","framesEnd","_framesCount","onLoadStatusChanged","onError","_bufferRequestStart","_prepareBuffer","arrayBuffer","dataView","atomsCount","framesCount","_atomsCount","chunkedFramesCount","timeStep","iName","_timeStep","posData","coordIdx","secondaryArr","hiWord","loWord","_secondaryData","_currFrame","myResidues","sec","oldSec","nSec","compRes","getSec","frameIdx","_cachedResidues","_updateSecondary","_parseBuffer","vec","_vec","SceneObject","LinesObj","_params","_id1","_id2","getAtomByFullname","_atom1","_getAtomFromName","_atom2","dynamic","_line","computeLineDistances","_raycaster","_intersects","verticesNeedUpdate","OutlineMaterial","srcDepthTex","srcTexSize","DEPTH_OUTLINE","FXAAMaterial","bgTransparent","BG_TRANSPARENT","AOMaterial","diffuseTexture","normalTexture","depthTexture","camNearFar","projMatrix","kernelRadius","depthThreshold","_kernelOffsets","AOHorBlurMaterial","aoMap","samplesOffsets","AOVertBlurWithBlendMaterial","fogNearFar","useFog","AnaglyphMaterial","srcL","srcR","View","orientation","ViewInterpolator","startView","endView","_endTime","_isPaused","_srcView","_dstView","_isMoving","transTime","_transitionTime","wasStarted","success","createView","slerp","setup","getCurrentView","Cookies","createWebVRButton","webVRPoC","stylizeElement","bottom","padding","border","font","xr","isSessionSupported","then","supported","cursor","currentSession","onSessionEnded","onSessionStarted","session","_gfx","setReferenceSpaceType","setSession","onmouseenter","onmouseleave","onclick","requestSession","optionalFeatures","moveSceneBehindHeadset","showEnterVR","textDecoration","removeCookie","cntKey","_toCount","cntVal","_getSimpleCookie","_removeSimpleCookie","setCookie","chunkLen","lc","_chunkString","_setSimpleCookie","getCookie","cookie","_getExpirationDate","today","setFullYear","toUTCString","_exists","shadowMatrix","OBB","_bSphereForOneVisual","_bBoxForOneVisual","_bBox","_invMatrix","_points","_anaglyphMat","_size","_outlineMaterial","volumeRenderingSupported","volumeBFMat","volumeFFMat","cubeOffsetMat","world2colorMat","_fxaaMaterial","_aoMaterial","_horBlurMaterial","_vertBlurMaterial","_scale","WebVRPoC","onToggle","_mainCamera","_button","_onToggle","_molContainer","_user","_scalingPivot","_controller1","_controller2","_pressedGripsCounter","_distance","startScalingByControllers","stopScalingByControllers","gfx","_mainFog","_plugVRNodesIntoScene","_setControllersListeners","getController","_createControllerMesh","handleGripsDown","handleGripsUp","_this$_gfx","setAnimationLoop","getSession","_unplugVRNodesFromScene","cylinder","rotateX","scaler","container","EDIT_MODE","LOADER_NOT_FOUND","removeExtension","reportProgress","log","percent","chooseFogColor","Miew","settingsCookie","cookiePath","_interpolator","_container","getElementById","head","getElementsByClassName","_containerRoot","_running","_halting","_building","_needRender","_hotKeysEnabled","_cookies","restoreSettings","_spinner","_loading","_animInterval","_visuals","_curVisualName","_sourceWindow","registeredPlugins","_initOnSettingsChanged","_setContainerContents","arezSpritesSupported","getExtension","isAOSupported","getMaxRepresentationCount","_updateShadowCamera","halfSize","light","getOBB","class","frag","createDocumentFragment","_msgMode","_msgAtomInfo","_showMessage","_initGfx","_initListeners","_onKeyDown","_onKeyUp","_objectControls","_getAltObj","_picker","_onPick","file","keepRepsInfo","job","cancel","halt","msg","_showCanvas","_requestAnimationFrame","clientWidth","clientHeight","webGLOptions","preserveDrawingBuffer","premultipliedAlpha","renderer2d","shadowMap","autoUpdate","getContext","setPixelRatio","devicePixelRatio","setSize","setClearColor","clearColor","stereoCam","selectionScene","selectionRoot","selectionPivot","light12","pixelRatio","getPixelRatio","shadowMapSize","mapSize","light3","deviceWidth","deviceHeight","offscreenBuf","minFilter","magFilter","depthBuffer","offscreenBuf2","offscreenBuf3","offscreenBuf4","volBFTex","volFFTex","volWFFTex","offscreenBuf5","offscreenBuf6","offscreenBuf7","stereoBufL","stereoBufR","_embedWebXR","stats","_fps","_onResize","_makeUniqueVisualName","baseName","random","suffix","_addVisual","_removeVisual","_forEachVisual","_releaseAllVisuals","_forEachComplexVisual","_getComplexVisual","any","_getVolumeVisual","_getVisualForComplex","getVisuals","getComplexVisualsCount","getCurrentVisual","setCurrentVisual","run","resume","_onTick","_discardComponentEdit","_discardFragmentEdit","pause","enableHotKeys","_resizeOffscreenBuffers","isAnaglyph","multi","_onUpdate","_onRender","_getBSphereRadius","union","_updateFog","_setUberMaterialValues","isScriptingCommandAvailable","callNextCmd","_needRebuild","rebuild","_updateView","webVR","updateMoleculeScale","_clipPlaneUpdateValue","_fogFarUpdateValue","setRenderTarget","_renderFrame","focus","_renderShadowMap","_renderScene","setScissorTest","setScissor","cameraL","cameraR","_onBgColorChanged","_onFogColorChanged","_enableMRT","renderBuffer","textureBuffer","gl","tx8","__webglTexture","bindTexture","TEXTURE_2D","fb","__webglFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT0","COLOR_ATTACHMENT1_WEBGL","drawBuffersWEBGL","distortion","bHaveComplexes","volumeVisual","ssao","_renderWithPrepassTransparency","dstBuffer","srcBuffer","_performAO","_renderOutline","_renderSelection","_renderVolume","_performFXAA","_performDistortion","aberration","targetBuffer","srcDepthBuffer","srcColorBuffer","currentRenderTarget","getRenderTarget","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","setBlending","buffers","setClear","setTest","updateMatrices","_hasSelectionToRender","selPivot","_checkVolumeRenderingSupport","renderTarget","oldRT","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","dstBuf","tmpBuf1","tmpBuf2","tmpBuf3","overrideMaterial","colorMask","normalBuffer","srcDepthTexture","tempBuffer","tempBuffer1","_lastPick","_setEditMode","_resetObjects","setNeedRender","_resetScene","resetReps","resetPivot","rebuildAll","resetView","updateSelectionMask","_export","TheExporter","_centerInVisual","rePdbId","rePubchem","reUrlScheme","_fetchData","shouldCancel","notify","matchesPdbId","_matchesPdbId","_matchesPdbId$","sourceType","matchesPubchem","compound","resolveSourceShortcut","TheLoader","extractName","_utils$splitFileName","_utils$splitFileName2","fileExt","TheParser","updateBinaryMode","newOptions","keyCount","loader","lengthComputable","total","loaded","_includesInCurSelection","_includesInSelector","onLoadEnd","anything","jobIndex","_refreshTitle","dataSet","_parseData","_onLoad","unload","_startAnimation","fileData","_stopAnimation","_frameInfo","isPlaying","_isAnimating","_continueAnimation","_pauseAnimation","clearInterval","minFrameTime","setInterval","_updateObjsToFrame","nextFrame","disableEvents","hasValidRes","visualName","amberFileName","resetEd","_onLoadEd","_tweakResolution","_edLoader","loadEd","_this4","_rebuildObjects","toRemove","getGeometry","changeUnit","unitIdx","currentUnitInfo","getCurrentUnit","_updateInfoPanel","_this5","rebuildActions","setNeedsRebuild","appendix","repGet","_extractRepresentation","_this6","getSelectionCount","defPreset","repCount","_setReps","applyPreset","presList","newIdx","repRemove","repHide","_editMode","getElementsByTagName","_enterComponentEditMode","editors","beginComponentEdit","_editors","_applyComponentEdit","discard","_enterFragmentEditMode","selectedVisuals","beginFragmentEdit","isFreeRotationAllowed","_applyFragmentEdit","_updateSelection","expandSelection","shrinkSelection","firstLine","secondLine","aName","coordLine","nextAltObj","setPivotResidue","amount","setPivotAtom","getSelectionCenter","setPivotSubset","screenshot","screenshotURI","getDataURL","dataURL","canvas","canvasContext","drawImage","toDataURL","areaOfInterestTanFov2","shotAspect","setDrawingBufferSize","screenshotSave","uri","save","_this7","dataString","maxPerf","_gfxScore","_autoChangeResolution","saveSettings","resetSettings","setOptions","resetCurrentUnit","getBondCount","getResidueCount","getChainCount","objData","bThrow","Ctor","LinesObject","_addSceneObject","sceneObject","objs","removeObject","getURL","getState","compact","getScript","_compareReps","compareWithDefaults","currPreset","repsDiff","emptyReps","repsInfo","objectsState","_updateShadowmapMeshes","_updateMaterials","setMaterialValues","_fogAlphaChanged","_this8","disable","_this9","evt","Boolean","sel","$Ve","$Vf","$Vg","$Vh","$Vi","$Vj","$Vk","$Vl","$Vm","$Vn","$Vo","$Vp","$Vq","$Vr","$Vs","$Vt","$Vu","$Vv","$Vw","$Vx","$Vy","$Vz","$VA","$VB","$VC","$VD","$VE","$VF","$VG","$VH","$VI","$VJ","$VK","$VL","$VM","$VN","$VO","$VP","$VQ","$VR","$VS","$VT","$VU","$VV","$VW","$VX","$VY","$VZ","$V_","$V$","$V01","$V11","$V21","$V31","$V41","$V51","$V61","euler","eulerOrder","setFromQuaternion","srcView","dstView","setFromEuler","isMoving","within","None","projected","fullAtomName","complexName","project","dssp","exportCML","xml","extractBasis","retMat","makeBasis","extractRotation","removeAttribute","sGroup","getPosition","getCentralPoint","XMLSerializer","serializeToString","motm","curChainName","curChainColor","thirdParty","lodash","three","Command","RESET","BUILD","ALL","HELP","Path","MOTM","OneArgCommand","GET","SET","Value","SET_SAVE","SET_RESTORE","SET_RESET","PRESET","AddRepresentation","EditRepresentation","REMOVE","RepresentationReference","HIDE","SHOW","LIST","EXPAND_KEY","SELECTOR_KEY","SELECT","WordAll","WITHIN","OF","MATERIAL","ModeCMD","ColorCMD","VIEW","BASE_64","UNIT","DSSP","SCALE","ROTATE","AxesList","TRANSLATE","CENTER","GetURLBranch","Screenshot","LINE","ArgList","LISTOBJ","REMOVEOBJ","VIEW_KEY","SCREENSHOT","LOAD","Url","FILE_KEY","ADD","Description","REP","MODE","COLOR","Descriptor","RepresentationOwnProperty","RepresentationOwnPropertyOpts","DESC_KEY","=","DESC_KEY_OPTS","AxesArg","DESC_KEY_AXES","Arg","PathWoDescKey","HEX","BOOL","Word","CommandSetWoDESC_KEY","DescKeys","CLEAR","FILE_LIST","FILE_REGISTER","FILE_DELETE","PRESET_ADD","PRESET_DELETE","PRESET_UPDATE","PRESET_RENAME","PRESET_OPEN","CREATE_SCENARIO","RESET_SCENARIO","DELETE_SCENARIO","ADD_SCENARIO_ITEM","LIST_SCENARIO","PDB_KEY","DELAY_KEY","PRST_KEY","DESCRIPTION_KEY","CommandSet",".","PresetPath","/","HexOrNumber","25","26","27","28","29","30","31","33","34","35","36","37","38","41","42","43","44","45","46","48","49","52","54","55","56","57","58","59","61","62","64","65","66","70","71","72","74","77","78","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","101","103","miew","echo","help","propagateProp","representations","listRep","listSelector","checkArg","toJSO","listObjs","CreateObjectPair","keyRemap","39","40","50","51","79","80","81","47","73","60","63","67","68","69","53","75","76","32","107","110","116","119","120","121","122","123","125","127","128","129","130","131","136","139","140","141","142","143","145","158","159","166","174","177","178","179","183","184","185","196","200","modeIdDesc","$help","colorDesc","materialDesc","addRepDesc","setGetParameterDesc","PDBID","REP_NAME","DESCRIPTION","REP_INDEX","EXPRESSION","MODE_ID","COLORER_ID","MATERIAL_ID","new","del","PARAMETER","set_save","set_restore","set_reset","ENCODED_VIEW","removeobj","listobj","NULL","representationsStorage","RepresentationMap","representationMap","representationID","strId","sortedKeys","utilFunctions","CLIUtils","repMap","repName","selectionStr","strList","helpData","joinHelpStr","clihelp","sortBy","helpItem","awaitWhileCMDisInProcess","finishAwaitingCMDInProcess","modificate","modificators","modificator","endsWith","getNamedColor","cliUtils","cmd","cliutils","_val","notimplemented","script","_printCallback","_errorCallback","parsercli","cmdQueue","commandInAction"],"mappings":";iUAIA,IAAAA,EAJA,SAAyBC,GACvB,GAAIC,MAAMC,QAAQF,GAAM,OAAOA,GC6BjC,IAAAG,EA9BA,SAA+BH,EAAKI,GAClC,GAAMC,OAAOC,YAAYC,OAAOP,IAAgD,uBAAxCO,OAAOC,UAAUC,SAASC,KAAKV,GAAvE,CAIA,IAAIW,EAAO,GACPC,GAAK,EACLC,GAAK,EACLC,OAAKC,EAET,IACE,IAAK,IAAiCC,EAA7BC,EAAKjB,EAAIK,OAAOC,cAAmBM,GAAMI,EAAKC,EAAGC,QAAQC,QAChER,EAAKS,KAAKJ,EAAGK,QAETjB,GAAKO,EAAKW,SAAWlB,GAH8CQ,GAAK,IAK9E,MAAOW,GACPV,GAAK,EACLC,EAAKS,EACN,QACC,IACOX,GAAsB,MAAhBK,EAAW,QAAWA,EAAW,SAC7C,QACC,GAAIJ,EAAI,MAAMC,GAIlB,OAAOH,ICvBT,IAAAa,EAJA,WACE,MAAM,IAAIC,UAAU,yDCStB,IAAAC,EAJA,SAAwB1B,EAAKI,GAC3B,OAAOL,EAAeC,IAAQG,EAAqBH,EAAKI,IAAMoB,KCP5DG,EAAsC,WAStC,OARAA,EAAWpB,OAAOqB,QAAU,SAASC,GACjC,IAAK,IAAIC,EAAG1B,EAAI,EAAG2B,EAAIC,UAAUV,OAAQlB,EAAI2B,EAAG3B,IAE5C,IAAK,IAAI6B,KADTH,EAAIE,UAAU5B,GACOG,OAAOC,UAAU0B,eAAexB,KAAKoB,EAAGG,KACzDJ,EAAEI,GAAKH,EAAEG,IAEjB,OAAOJ,IAEKM,MAAMC,KAAMJ,YAE5BK,EAAW,C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ACA,6BACA,0CACA,0CACA,gCAGJjnK,GAAI,CACFinK,MAAO,CACL,cACA,4CACA,wCACA,0CACA,0CACA,4CAGJtnK,GAAI,CACFsnK,MAAO,CACL,mBACA,oBAGJpmK,GAAI,CACFomK,MAAO,CACL,WACA,4CAGJnmK,GAAI,CACFmmK,MAAO,CACL,UACA,uCACA,wCACA,gCAGJhnK,GAAI,CACFgnK,MAAO,CACL,aACA,yCAGJ1mK,GAAI,CACF0mK,MAAO,CACL,mBACA,4BACA,yBACA,2BACA,yCAGJ3mK,GAAI,CACF2mK,MAAO,CACL,8BACA,yCAGJ1lK,GAAI,CACF0lK,MAAO,CACL,eACA,sEACA,iEACA,0EACA,+DACA,6DACA,sCACA,sCACA,sCACA,8CACA,kDACA,8CACA,kDACA,gDACA,iCAKAC,GAAY,CAChBD,MAAO,CACL,yBACA,4BACA,0BACA,6BACA,iCACA,wCACA,oBAEFvkK,GAAI,CACFukK,MAAO,CACL,6CACA,aACA,iDAEFt/K,MAAO,CACLs/K,MAAO1hL,OAAO2O,KAAKqlG,GAAShoG,IAAIyX,EAAS5b,IAAI6W,SAASquF,aAAaruD,OAAOh4C,KAAK,SAK/Ek7K,GAAe,CACnBF,MAAO,CACL,oBACA,mBACA,uBACA,wBACA,0BACA,iBACA,mBAIEG,GAAa,CACjBH,MAAO,CACL,kEACA,qBACA,4BACA,8CACA,+BACA,iDACA,8BACA,uBACA,6BAEFngL,EAAG,CACDmgL,MAAO,4EAETl7J,EAAGi7J,GACHh7J,EAAGk7J,GACHj7J,GAAIk7J,IAGAE,GAAsB,CAC1BJ,MAAO,CACL,qDACA,gDACA,4CAEFpoK,MAAOmoK,GACPzkK,SAAU2kK,IAGN/D,GAAO,CACX8D,MAAO,CACL,wCACA,yDACA,sCACA,mCACA,oDACA,sCACA,+BAEFp/J,MAAO,CACLo/J,MAAO,CACL,oDACA,gDAGJh8J,KAAM,CACJg8J,MAAO,CACL,mDACA,gDAEFK,MAAO,CACLL,MAAO,sCAETruK,IA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Q,GACRgI,UAAS,GACT63E,SAAQ,GACRvqG,QAAO,GACPrD,SAAQ,EACRhD,MAAK,EACLooJ,IAAK,CACH1vC,eAAcA,IAehBwpD,WAAY,CACVC,OAAQ1+J,IACR2+J,MAAO/8H,KAIX,Y,aCnqIA,MAAMg9H,GAAa,CACjBC,MAAO,CACL,0BACA,iCACA,sBACA,yBACA,8BACA,sBACA,qBACA,wBACA,2BACA,8BACA,iCACA,sBAEFh1I,GAAI,CACFg1I,MAAO,CACL,sBACA,4CACA,wCACA,wCACA,0CACA,0CACA,4CAGJ7yI,GAAI,CACF6yI,MAAO,CACL,aACA,uCACA,6CACA,uCACA,wCACA,6BACA,+CAGJl0I,GAAI,CACFk0I,MAAO,CACL,WACA,wCACA,6BACA,0CACA,0CACA,gCAGJ9zI,GAAI,CACF8zI,MAAO,CACL,cACA,4CACA,wCACA,0CACA,0CACA,4CAGJn0I,GAAI,CACFm0I,MAAO,CACL,mBACA,oBAGJjzI,GAAI,CACFizI,MAAO,CACL,WACA,4CAGJhzI,GAAI,CACFgzI,MAAO,CACL,UACA,uCACA,wCACA,gCAGJ7zI,GAAI,CACF6zI,MAAO,CACL,aACA,yCAGJvzI,GAAI,CACFuzI,MAAO,CACL,mBACA,4BACA,yBACA,2BACA,yCAGJxzI,GAAI,CACFwzI,MAAO,CACL,8BACA,yCAGJvyI,GAAI,CACFuyI,MAAO,CACL,eACA,sEACA,iEACA,0EACA,+DACA,6DACA,sCACA,sCACA,sCACA,8CACA,kDACA,8CACA,kDACA,gDACA,iCAKAC,GAAY,CAChBD,MAAO,CACL,yBACA,4BACA,0BACA,6BACA,iCACA,wCACA,oBAEFpxI,GAAI,CACFoxI,MAAO,CACL,6CACA,aACA,iDAEFllJ,MAAO,CACLklJ,MAAOx+J,OAAOyP,KAAKq9F,GAASvwG,IAAI2C,EAAS8d,IAAI0R,SAAS23E,aAAa53F,OAAOjL,KAAK,SAK/Ek7J,GAAe,CACnBF,MAAO,CACL,oBACA,mBACA,uBACA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K,SAAS3nE,QAEpBh1E,EAAM,CACZA,SAAc,GACd,IACE08I,GAAAA,OAAUphK,MAAM6gK,GAChBn8I,EAAI+6H,SAAU,CAChB,CAAE,MAAOxxI,GACPyW,EAAIlkB,MAAQyN,EAAE8R,QACdqhJ,GAAAA,OAAU/mK,GAAGmG,MAAMkkB,EAAIlkB,OACvBpL,KAAKkrK,4BACP,CACA,OAAO57I,CACT,CACA,MAAO,EACT,EAEA08I,GAAAA,OAAU/mK,GAAKymK,GAEfM,GAAAA,OAAU/mK,GAAG+F,WAAaghK,GAAAA,OAAUhhK,WCzYpC,W,kBvOOA","sources":["webpack://Miew/webpack/universalModuleDefinition","webpack://Miew/./src/utils/MiewCLIParser.js","webpack://Miew/./src/utils/SelectionParser.js","webpack://Miew/./vendor/js/Smooth.js","webpack://Miew/./vendor/js/mmtf.js","webpack://Miew/external umd {\"module\":\"lodash\",\"commonjs\":\"lodash\",\"commonjs2\":\"lodash\",\"amd\":\"lodash\",\"root\":\"_\"}","webpack://Miew/external umd {\"module\":\"three\",\"commonjs\":\"three\",\"commonjs2\":\"three\",\"amd\":\"three\",\"root\":\"THREE\"}","webpack://Miew/webpack/bootstrap","webpack://Miew/webpack/runtime/compat get default export","webpack://Miew/webpack/runtime/define property getters","webpack://Miew/webpack/runtime/hasOwnProperty shorthand","webpack://Miew/../../node_modules/spin.js/spin.js","webpack://Miew/./src/Timer.js","webpack://Miew/./src/gfx/Stats.js","webpack://Miew/./src/utils/EventDispatcher.js","webpack://Miew/./src/utils/logger.js","webpack://Miew/./src/utils.js","webpack://Miew/./src/utils/JobHandle.js","webpack://Miew/./src/settings.js","webpack://Miew/./src/options.js","webpack://Miew/./src/chem/Atom.js","webpack://Miew/./src/chem/Element.js","webpack://Miew/./src/chem/Bond.js","webpack://Miew/./src/chem/Residue.js","webpack://Miew/./src/chem/ResidueType.js","webpack://Miew/./src/chem/Chain.js","webpack://Miew/./src/chem/StructuralElement.js","webpack://Miew/./src/chem/Helix.js","webpack://Miew/./src/chem/Strand.js","webpack://Miew/./src/chem/Sheet.js","webpack://Miew/./src/chem/SGroup.js","webpack://Miew/./src/chem/selectors/selectArgs.js","webpack://Miew/./src/chem/selectors/selectorsBase.js","webpack://Miew/./src/chem/selectors/selectOps.js","webpack://Miew/./src/chem/selectors.js","webpack://Miew/./src/chem/BiologicalUnit.js","webpack://Miew/./src/chem/Assembly.js","webpack://Miew/./src/chem/Component.js","webpack://Miew/./src/chem/AtomPairs.js","webpack://Miew/./src/chem/AutoBond.js","webpack://Miew/./src/chem/AromaticLoopsMarker.js","webpack://Miew/./src/chem/VoxelWorld.js","webpack://Miew/./src/chem/HBondInfo.js","webpack://Miew/./src/chem/SecondaryStructureMap.js","webpack://Miew/./src/chem/Complex.js","webpack://Miew/./src/chem/Volume.js","webpack://Miew/./src/chem/Molecule.js","webpack://Miew/./src/chem.js","webpack://Miew/./src/gfx/CSS2DObject.js","webpack://Miew/./src/gfx/RCGroup.js","webpack://Miew/./src/gfx/gfxutils.js","webpack://Miew/./src/Visual.js","webpack://Miew/./src/utils/EntityList.js","webpack://Miew/./src/utils/makeContextDependent.js","webpack://Miew/./src/gfx/geometries/SphereCollisionGeo.js","webpack://Miew/./src/gfx/geometries/InstancedSpheresGeometry.js","webpack://Miew/./src/gfx/geometries/ChunkedObjectsGeometry.js","webpack://Miew/./src/gfx/geometries/SimpleSpheresGeometry.js","webpack://Miew/./src/gfx/geometries/Simple2CCylindersGeometry.js","webpack://Miew/./src/gfx/geometries/CylinderBufferGeometry.js","webpack://Miew/./src/gfx/geometries/Instanced2CCylindersGeometry.js","webpack://Miew/./src/gfx/geometries/ExtrudedObjectsGeometry.js","webpack://Miew/./src/gfx/geometries/ThickLinesGeometry.js","webpack://Miew/./src/gfx/geometries/LinesGeometry.js","webpack://Miew/./src/gfx/geometries/CylinderCollisionGeo.js","webpack://Miew/./src/gfx/geometries/ChunkedLinesGeometry.js","webpack://Miew/./src/gfx/geometries/TwoColorLinesGeometry.js","webpack://Miew/./src/gfx/geometries/CrossGeometry.js","webpack://Miew/./src/gfx/geometries/IsoSurfaceGeometry.js","webpack://Miew/./src/gfx/geometries/IsoSurfaceMarchCube.js","webpack://Miew/./src/gfx/geometries/IsoSurface.js","webpack://Miew/./src/gfx/geometries/VolumeSurfaceGeometry.js","webpack://Miew/./src/gfx/geometries/QuickSurfGeometry.js","webpack://Miew/./src/gfx/geometries/ContactSurface.js","webpack://Miew/./src/gfx/geometries/ContactSurfaceGeometry.js","webpack://Miew/./src/gfx/geometries/IsoSurfaceAtomColored.js","webpack://Miew/./src/gfx/geometries/IsosurfaceBuildNormals.js","webpack://Miew/./src/gfx/geometries/IsoSurfaceGeo.js","webpack://Miew/./src/gfx/geometries/SSIsosurfaceGeometry.js","webpack://Miew/./src/gfx/geometries/LabelsGeometry.js","webpack://Miew/./src/gfx/geometries/geometries.js","webpack://Miew/./src/gfx/capabilities.js","webpack://Miew/./src/gfx/noiseTexture.js","webpack://Miew/./src/gfx/shaders/UberMaterial.js","webpack://Miew/./src/gfx/meshes/UberObject.js","webpack://Miew/./src/gfx/meshes/ZSpriteMesh.js","webpack://Miew/./src/gfx/meshes/ZClippedMesh.js","webpack://Miew/./src/gfx/meshes/TextMesh.js","webpack://Miew/./src/gfx/meshes/SimpleMesh.js","webpack://Miew/./src/gfx/meshes/ThickLineMesh.js","webpack://Miew/./src/gfx/meshes/InstancedMesh.js","webpack://Miew/./src/gfx/meshes/meshes.js","webpack://Miew/./src/gfx/meshes/MeshCreator.js","webpack://Miew/./src/gfx/meshes/TransformGroup.js","webpack://Miew/./src/gfx/modes/groups/ChemGroup.js","webpack://Miew/./src/gfx/modes/groups/AtomsGroup.js","webpack://Miew/./src/gfx/modes/groups/AtomsSphereGroup.js","webpack://Miew/./src/gfx/modes/groups/AtomsSurfaceGroup.js","webpack://Miew/./src/gfx/modes/groups/AtomsSASSESGroupStub.js","webpack://Miew/./src/gfx/modes/groups/AtomsTextGroup.js","webpack://Miew/./src/gfx/modes/groups/AromaticGroup.js","webpack://Miew/./src/gfx/modes/groups/AromaticTorusGroup.js","webpack://Miew/./src/gfx/modes/groups/AromaticLinesGroup.js","webpack://Miew/./src/gfx/modes/groups/ResiduesGroup.js","webpack://Miew/./src/gfx/modes/groups/NucleicItemGroup.js","webpack://Miew/./src/gfx/modes/groups/NucleicCylindersGroup.js","webpack://Miew/./src/gfx/modes/groups/NucleicSpheresGroup.js","webpack://Miew/./src/gfx/modes/groups/CartoonHelper.js","webpack://Miew/./src/gfx/modes/groups/ResiduesSubseqGroup.js","webpack://Miew/./src/gfx/modes/groups/ResiduesTraceGroup.js","webpack://Miew/./src/gfx/modes/groups/BondsGroup.js","webpack://Miew/./src/gfx/modes/groups/BondsCylinderGroup.js","webpack://Miew/./src/gfx/modes/groups/BondsLinesGroup.js","webpack://Miew/./src/gfx/modes/groups/groups.js","webpack://Miew/./src/gfx/modes/processors/AtomsProcessor.js","webpack://Miew/./src/gfx/modes/processors/OrphanAtomsProcessor.js","webpack://Miew/./src/gfx/modes/processors/ResiduesProcessor.js","webpack://Miew/./src/gfx/modes/processors/NucleicProcessor.js","webpack://Miew/./src/gfx/modes/processors/SubseqsProcessor.js","webpack://Miew/./src/gfx/modes/processors/BondsProcessor.js","webpack://Miew/./src/gfx/modes/processors/AromaticProcessor.js","webpack://Miew/./src/gfx/modes/processors/processors.js","webpack://Miew/./src/gfx/modes/groups/GroupsFactory.js","webpack://Miew/./src/gfx/modes/Mode.js","webpack://Miew/./src/gfx/modes/LinesMode.js","webpack://Miew/./src/gfx/modes/LicoriceMode.js","webpack://Miew/./src/gfx/modes/BallsAndSticksMode.js","webpack://Miew/./src/gfx/modes/VanDerWaalsMode.js","webpack://Miew/./src/gfx/modes/TraceMode.js","webpack://Miew/./src/gfx/modes/TubeMode.js","webpack://Miew/./src/gfx/modes/CartoonMode.js","webpack://Miew/./src/gfx/modes/SurfaceMode.js","webpack://Miew/./src/gfx/modes/QuickSurfaceMode.js","webpack://Miew/./src/gfx/modes/IsoSurfaceMode.js","webpack://Miew/./src/gfx/modes/IsoSurfaceSASMode.js","webpack://Miew/./src/gfx/modes/IsoSurfaceSESMode.js","webpack://Miew/./src/gfx/modes/ContactSurfaceMode.js","webpack://Miew/./src/gfx/modes/TextMode.js","webpack://Miew/./src/gfx/modes.js","webpack://Miew/./src/gfx/palettes/Palette.js","webpack://Miew/./src/gfx/palettes/cpkPalette.js","webpack://Miew/./src/gfx/palettes/jmolPalette.js","webpack://Miew/./src/gfx/palettes/vmdPalette.js","webpack://Miew/./src/gfx/palettes.js","webpack://Miew/./src/gfx/colorers/Colorer.js","webpack://Miew/./src/gfx/colorers/ElementColorer.js","webpack://Miew/./src/gfx/colorers/ResidueTypeColorer.js","webpack://Miew/./src/gfx/colorers/SequenceColorer.js","webpack://Miew/./src/gfx/colorers/ChainColorer.js","webpack://Miew/./src/gfx/colorers/SecondaryStructureColorer.js","webpack://Miew/./src/gfx/colorers/UniformColorer.js","webpack://Miew/./src/gfx/colorers/ConditionalColorer.js","webpack://Miew/./src/gfx/colorers/ConformationColorer.js","webpack://Miew/./src/gfx/colorers/TemperatureColorer.js","webpack://Miew/./src/gfx/colorers/OccupancyColorer.js","webpack://Miew/./src/gfx/colorers/HydrophobicityColorer.js","webpack://Miew/./src/gfx/colorers/MoleculeColorer.js","webpack://Miew/./src/gfx/colorers/CarbonColorer.js","webpack://Miew/./src/gfx/colorers.js","webpack://Miew/./src/gfx/materials.js","webpack://Miew/./src/gfx/meshutils.js","webpack://Miew/./src/gfx/Representation.js","webpack://Miew/./src/ComplexVisualEdit.js","webpack://Miew/./src/ComplexVisual.js","webpack://Miew/./src/gfx/shaders/VolumeMaterial.js","webpack://Miew/./src/gfx/VolumeMesh.js","webpack://Miew/./src/gfx/VolumeBounds.js","webpack://Miew/./src/gfx/VolumeFarPlane.js","webpack://Miew/./src/VolumeVisual.js","webpack://Miew/./src/io/loaders/LoaderList.js","webpack://Miew/./src/io/loaders/Loader.js","webpack://Miew/./src/io/loaders/FileLoader.js","webpack://Miew/./src/io/loaders/XHRLoader.js","webpack://Miew/./src/io/loaders/ImmediateLoader.js","webpack://Miew/./src/io/loaders.js","webpack://Miew/./src/io/parsers/ParserList.js","webpack://Miew/./src/io/parsers/Parser.js","webpack://Miew/./src/io/parsers/pdb/Remark290.js","webpack://Miew/./src/io/parsers/pdb/Remark350.js","webpack://Miew/./src/io/parsers/PDBStream.js","webpack://Miew/./src/io/parsers/PDBParser.js","webpack://Miew/./src/io/parsers/CMLParser.js","webpack://Miew/./src/io/parsers/MMTFParser.js","webpack://Miew/./src/io/parsers/ParsingError.js","webpack://Miew/./src/io/parsers/readCIF.js","webpack://Miew/./src/io/parsers/CIFParser.js","webpack://Miew/./src/io/parsers/VolumeModel.js","webpack://Miew/./src/io/parsers/CCP4Parser.js","webpack://Miew/./src/io/parsers/XYZParser.js","webpack://Miew/./src/io/parsers/PubChemParser.js","webpack://Miew/./src/io/parsers/SDFStream.js","webpack://Miew/./src/io/parsers/SDFParser.js","webpack://Miew/./src/io/parsers/DSN6Parser.js","webpack://Miew/./src/io/parsers/GROReader.js","webpack://Miew/./src/io/parsers/GROParser.js","webpack://Miew/./src/io/parsers/MOL2Parser.js","webpack://Miew/./src/io/parsers.js","webpack://Miew/./src/io/exporters/ExporterList.js","webpack://Miew/./src/io/exporters/Exporter.js","webpack://Miew/./src/io/exporters/PDBResult.js","webpack://Miew/./src/io/exporters/PDBExporter.js","webpack://Miew/./src/io/exporters/fbx/FBXModel.js","webpack://Miew/./src/io/exporters/fbx/FBXGeometry.js","webpack://Miew/./src/io/exporters/fbx/FBX1CGeometry.js","webpack://Miew/./src/io/exporters/fbx/FBX2CCylinder.js","webpack://Miew/./src/io/exporters/fbx/FBXInfoExtractor.js","webpack://Miew/./src/io/exporters/fbx/FBXResult.js","webpack://Miew/./src/io/exporters/FBXExporter.js","webpack://Miew/./src/io/exporters.js","webpack://Miew/./src/io/io.js","webpack://Miew/./src/gfx/CSS2DRenderer.js","webpack://Miew/./src/utils/getTopWindow.js","webpack://Miew/./src/ui/ObjectControls.js","webpack://Miew/./src/ui/Picker.js","webpack://Miew/./src/gfx/Axes.js","webpack://Miew/./src/gfx/FrameInfo.js","webpack://Miew/./src/gfx/objects/SceneObject.js","webpack://Miew/./src/gfx/objects/LinesObj.js","webpack://Miew/./src/gfx/shaders/OutlineMaterial.js","webpack://Miew/./src/gfx/shaders/FXAAMaterial.js","webpack://Miew/./src/gfx/shaders/AOMaterial.js","webpack://Miew/./src/gfx/shaders/AOHorBlurMaterial.js","webpack://Miew/./src/gfx/shaders/AOVertBlurWithBlendMaterial.js","webpack://Miew/./src/gfx/shaders/AnaglyphMaterial.js","webpack://Miew/./src/gfx/ViewInterpolator.js","webpack://Miew/./src/utils/Cookies.js","webpack://Miew/./src/gfx/vr/createWebVRButton.js","webpack://Miew/./src/gfx/vr/WebVRPoC.js","webpack://Miew/./src/Miew.js","webpack://Miew/./src/utils/MiewCLIHelp.js","webpack://Miew/./src/Miew-cli.js","webpack://Miew/./src/index.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"lodash\"), require(\"three\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"lodash\", \"three\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Miew\"] = factory(require(\"lodash\"), require(\"three\"));\n\telse\n\t\troot[\"Miew\"] = factory(root[\"_\"], root[\"THREE\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE__535__, __WEBPACK_EXTERNAL_MODULE__698__) => {\nreturn ","/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,60],$V1=[1,62],$V2=[1,63],$V3=[1,65],$V4=[1,66],$V5=[1,67],$V6=[1,68],$V7=[1,69],$V8=[1,80],$V9=[1,72],$Va=[1,73],$Vb=[1,74],$Vc=[1,75],$Vd=[1,99],$Ve=[1,76],$Vf=[1,100],$Vg=[1,79],$Vh=[1,51],$Vi=[1,81],$Vj=[1,82],$Vk=[1,84],$Vl=[1,83],$Vm=[1,85],$Vn=[1,96],$Vo=[1,97],$Vp=[1,98],$Vq=[1,86],$Vr=[1,87],$Vs=[1,64],$Vt=[1,70],$Vu=[1,71],$Vv=[1,77],$Vw=[1,78],$Vx=[1,53],$Vy=[1,54],$Vz=[1,55],$VA=[1,61],$VB=[1,88],$VC=[1,89],$VD=[1,90],$VE=[1,91],$VF=[1,92],$VG=[1,93],$VH=[1,94],$VI=[1,95],$VJ=[1,101],$VK=[1,102],$VL=[1,103],$VM=[1,104],$VN=[1,105],$VO=[1,56],$VP=[1,57],$VQ=[1,58],$VR=[1,59],$VS=[1,115],$VT=[1,111],$VU=[1,114],$VV=[1,112],$VW=[1,113],$VX=[1,118],$VY=[1,117],$VZ=[1,134],$V_=[1,149],$V$=[1,150],$V01=[1,157],$V11=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V21=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,71,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V31=[5,6,7,9,13,15,17,18,19,20,23,25,26,27,30,33,34,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95],$V41=[5,70,72],$V51=[5,74],$V61=[71,101];\r\nvar parser = {trace: function trace () { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Command\":4,\"EOF\":5,\"RESET\":6,\"BUILD\":7,\"ALL\":8,\"HELP\":9,\"Path\":10,\"MOTM\":11,\"OneArgCommand\":12,\"GET\":13,\"STRING\":14,\"SET\":15,\"Value\":16,\"SET_SAVE\":17,\"SET_RESTORE\":18,\"SET_RESET\":19,\"PRESET\":20,\"AddRepresentation\":21,\"EditRepresentation\":22,\"REMOVE\":23,\"RepresentationReference\":24,\"HIDE\":25,\"SHOW\":26,\"LIST\":27,\"EXPAND_KEY\":28,\"SELECTOR_KEY\":29,\"SELECT\":30,\"AS\":31,\"WordAll\":32,\"SELECTOR\":33,\"WITHIN\":34,\"NUMBER\":35,\"OF\":36,\"MATERIAL\":37,\"IDENTIFIER\":38,\"ModeCMD\":39,\"ColorCMD\":40,\"VIEW\":41,\"BASE_64\":42,\"UNIT\":43,\"DSSP\":44,\"SCALE\":45,\"ROTATE\":46,\"AxesList\":47,\"TRANSLATE\":48,\"CENTER\":49,\"GetURLBranch\":50,\"Screenshot\":51,\"LINE\":52,\"ArgList\":53,\"LISTOBJ\":54,\"REMOVEOBJ\":55,\"URL\":56,\"VIEW_KEY\":57,\"SCREENSHOT\":58,\"LOAD\":59,\"Url\":60,\"FILE_KEY\":61,\"ADD\":62,\"Description\":63,\"REP\":64,\"MODE\":65,\"COLOR\":66,\"Descriptor\":67,\"RepresentationOwnProperty\":68,\"RepresentationOwnPropertyOpts\":69,\"DESC_KEY\":70,\"=\":71,\"DESC_KEY_OPTS\":72,\"AxesArg\":73,\"DESC_KEY_AXES\":74,\"Arg\":75,\"PathWoDescKey\":76,\"HEX\":77,\"BOOL\":78,\"Word\":79,\"CommandSetWoDESC_KEY\":80,\"DescKeys\":81,\"CLEAR\":82,\"FILE_LIST\":83,\"FILE_REGISTER\":84,\"FILE_DELETE\":85,\"PRESET_ADD\":86,\"PRESET_DELETE\":87,\"PRESET_UPDATE\":88,\"PRESET_RENAME\":89,\"PRESET_OPEN\":90,\"CREATE_SCENARIO\":91,\"RESET_SCENARIO\":92,\"DELETE_SCENARIO\":93,\"ADD_SCENARIO_ITEM\":94,\"LIST_SCENARIO\":95,\"PDB_KEY\":96,\"DELAY_KEY\":97,\"PRST_KEY\":98,\"DESCRIPTION_KEY\":99,\"CommandSet\":100,\".\":101,\"PresetPath\":102,\"/\":103,\"HexOrNumber\":104,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",6:\"RESET\",7:\"BUILD\",8:\"ALL\",9:\"HELP\",11:\"MOTM\",13:\"GET\",14:\"STRING\",15:\"SET\",17:\"SET_SAVE\",18:\"SET_RESTORE\",19:\"SET_RESET\",20:\"PRESET\",23:\"REMOVE\",25:\"HIDE\",26:\"SHOW\",27:\"LIST\",28:\"EXPAND_KEY\",29:\"SELECTOR_KEY\",30:\"SELECT\",31:\"AS\",33:\"SELECTOR\",34:\"WITHIN\",35:\"NUMBER\",36:\"OF\",37:\"MATERIAL\",38:\"IDENTIFIER\",41:\"VIEW\",42:\"BASE_64\",43:\"UNIT\",44:\"DSSP\",45:\"SCALE\",46:\"ROTATE\",48:\"TRANSLATE\",49:\"CENTER\",52:\"LINE\",54:\"LISTOBJ\",55:\"REMOVEOBJ\",56:\"URL\",57:\"VIEW_KEY\",58:\"SCREENSHOT\",59:\"LOAD\",61:\"FILE_KEY\",62:\"ADD\",64:\"REP\",65:\"MODE\",66:\"COLOR\",70:\"DESC_KEY\",71:\"=\",72:\"DESC_KEY_OPTS\",74:\"DESC_KEY_AXES\",77:\"HEX\",78:\"BOOL\",82:\"CLEAR\",83:\"FILE_LIST\",84:\"FILE_REGISTER\",85:\"FILE_DELETE\",86:\"PRESET_ADD\",87:\"PRESET_DELETE\",88:\"PRESET_UPDATE\",89:\"PRESET_RENAME\",90:\"PRESET_OPEN\",91:\"CREATE_SCENARIO\",92:\"RESET_SCENARIO\",93:\"DELETE_SCENARIO\",94:\"ADD_SCENARIO_ITEM\",95:\"LIST_SCENARIO\",96:\"PDB_KEY\",97:\"DELAY_KEY\",98:\"PRST_KEY\",99:\"DESCRIPTION_KEY\",101:\".\",103:\"/\"},\r\nproductions_: [0,[3,2],[3,1],[4,1],[4,1],[4,2],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,3],[4,3],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[4,2],[4,1],[4,2],[4,2],[4,2],[4,4],[4,2],[4,6],[4,2],[4,1],[4,1],[4,1],[4,2],[4,2],[4,1],[4,2],[4,1],[4,2],[4,2],[4,2],[4,1],[4,2],[4,1],[4,1],[4,3],[4,3],[4,4],[4,4],[4,1],[4,2],[50,1],[50,2],[50,2],[50,3],[50,3],[51,1],[51,2],[51,3],[12,2],[12,2],[12,2],[21,1],[21,2],[21,2],[21,3],[22,2],[22,3],[39,2],[39,3],[40,2],[40,3],[24,1],[24,1],[63,1],[63,2],[63,3],[63,4],[67,1],[67,1],[67,2],[68,3],[69,3],[47,1],[47,2],[73,2],[53,1],[53,2],[75,3],[16,1],[16,1],[16,1],[16,1],[16,1],[79,1],[79,1],[32,1],[32,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[100,1],[100,1],[76,1],[76,3],[76,3],[10,1],[10,1],[10,3],[10,3],[10,3],[60,1],[102,1],[102,3],[104,1],[104,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.miew.reset(false); yy.ClearContext(); yy.miew.resetReps(\"empty\");\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.miew.rebuild();\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.miew.rebuildAll(); yy.miew.rebuild();\r\nbreak;\r\ncase 6:\r\nthis.$ = yy.echo(yy.utils.help().toString());\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.echo(yy.utils.help($$[$0]).toString());\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.miew.motm();\r\nbreak;\r\ncase 10: case 11:\r\nthis.$ = yy.utils.propagateProp($$[$0]); yy.echo(yy.miew.get($$[$0]).toString());\r\nbreak;\r\ncase 12: case 13:\r\nthis.$ = yy.miew.set($$[$0-1], yy.utils.propagateProp($$[$0-1], $$[$0]));;\r\nbreak;\r\ncase 14:\r\nthis.$ = yy.miew.saveSettings();;\r\nbreak;\r\ncase 15:\r\nthis.$ = yy.miew.restoreSettings();;\r\nbreak;\r\ncase 16:\r\nthis.$ = yy.miew.resetSettings();;\r\nbreak;\r\ncase 17:\r\nthis.$ = yy.miew.resetReps();\r\nbreak;\r\ncase 18:\r\nthis.$ = yy.miew.applyPreset($$[$0]);\r\nbreak;\r\ncase 21:\r\nthis.$ = yy.miew.repRemove($$[$0]); yy.representations.remove($$[$0]);\r\nbreak;\r\ncase 22:\r\nthis.$ = yy.miew.repHide($$[$0]);\r\nbreak;\r\ncase 23:\r\nthis.$ = yy.miew.repHide($$[$0], false);\r\nbreak;\r\ncase 24:\r\nthis.$ = yy.echo(yy.utils.listRep(yy.miew, yy.representations, $$[$0], '-e'));\r\nbreak;\r\ncase 25:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations));\r\nbreak;\r\ncase 26:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations, $$[$0]));\r\nbreak;\r\ncase 27:\r\nthis.$ = yy.echo(yy.utils.listSelector(yy.miew, yy.Context));\r\nbreak;\r\ncase 28:\r\nthis.$ = yy.miew.select(yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0], true));\r\nbreak;\r\ncase 29:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.utils.checkArg($$[$0-3].toLowerCase(), $$[$0-2], true); yy.miew.select(yy.Context[$$[$0].toLowerCase()]);\r\nbreak;\r\ncase 30:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {selector : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0])});\r\nbreak;\r\ncase 31:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.miew.within(yy.utils.checkArg(\"select\", $$[$0-2], true), Number($$[$0-4]));\r\nbreak;\r\ncase 32:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {material : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 35:\r\nthis.$ = yy.echo(yy.miew.view());\r\nbreak;\r\ncase 36: case 37:\r\nthis.$ = yy.miew.view($$[$0]);\r\nbreak;\r\ncase 38:\r\nthis.$ = yy.echo(yy.miew.changeUnit());\r\nbreak;\r\ncase 39:\r\nthis.$ = yy.echo(yy.miew.changeUnit($$[$0]));\r\nbreak;\r\ncase 40:\r\nthis.$ = yy.miew.dssp();\r\nbreak;\r\ncase 41:\r\nthis.$ = yy.miew.scale($$[$0]);\r\nbreak;\r\ncase 42:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.rotate($$[$0][i]['x'] * Math.PI / 180.0, $$[$0][i]['y'] * Math.PI / 180.0, $$[$0][i]['z'] * Math.PI / 180.0)} \r\nbreak;\r\ncase 43:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.translate($$[$0][i]['x'] || 0, $$[$0][i]['y'] || 0, $$[$0][i]['z'] || 0)} \r\nbreak;\r\ncase 44:\r\nthis.$ = yy.miew.center();\r\nbreak;\r\ncase 45:\r\nthis.$ = yy.miew.center($$[$0]);\r\nbreak;\r\ncase 48: case 49:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-1], $$[$0]]}, true);\r\nbreak;\r\ncase 50: case 51:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-2], $$[$0-1]], opts:$$[$0].toJSO(yy.utils, 'objects', 'line')}, true);\r\nbreak;\r\ncase 52:\r\nthis.$ = yy.echo(yy.utils.listObjs(yy.miew));\r\nbreak;\r\ncase 53:\r\nthis.$ = yy.miew.removeObject($$[$0]);\r\nbreak;\r\ncase 54:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: false}));\r\nbreak;\r\ncase 55:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: true}));\r\nbreak;\r\ncase 56:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: false}));\r\nbreak;\r\ncase 57: case 58:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: true}));\r\nbreak;\r\ncase 59:\r\nthis.$ = yy.miew.screenshotSave();\r\nbreak;\r\ncase 60:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0]));\r\nbreak;\r\ncase 61:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0-1]), Number($$[$0]));\r\nbreak;\r\ncase 62: case 63: case 64:\r\nthis.$ = yy.utils.load(yy.miew, $$[$0]); yy.representations.clear();\r\nbreak;\r\ncase 65:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd()));\r\nbreak;\r\ncase 66:\r\nthis.$ = yy.echo(yy.representations.add($$[$0], yy.miew.repAdd()));\r\nbreak;\r\ncase 67:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 68:\r\nthis.$ = yy.echo(yy.representations.add($$[$0-1], yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 69:\r\nthis.$ = yy.miew.rep($$[$0]); yy.miew.repCurrent($$[$0]);\r\nbreak;\r\ncase 70:\r\nthis.$ = yy.miew.rep($$[$0-1], $$[$0]); yy.miew.repCurrent($$[$0-1]);\r\nbreak;\r\ncase 71:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 72:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 73:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 74:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 75:\r\nthis.$ = Number(yy.representations.get($$[$0]));\r\nbreak;\r\ncase 76: case 92:\r\nthis.$ = Number($$[$0]);\r\nbreak;\r\ncase 77:\r\nthis.$ = $$[$0];\r\nbreak;\r\ncase 78:\r\nthis.$ = yy._.assign($$[$0-1], $$[$0]);\r\nbreak;\r\ncase 79:\r\nthis.$ = yy._.assign($$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 80:\r\nthis.$ = yy._.assign($$[$0-3], $$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 81: case 82:\r\nthis.$ = yy.CreateObjectPair($$[$0].key, $$[$0].val);\r\nbreak;\r\ncase 83:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].key, new Array($$[$0-1].val, $$[$0].toJSO(yy.utils, $$[$0-1].key, $$[$0-1].val)));\r\nbreak;\r\ncase 84: case 85:\r\nthis.$ = Object.create({'key': yy.keyRemap($$[$0-2]), 'val': yy.utils.checkArg($$[$0-2], $$[$0])});\r\nbreak;\r\ncase 86:\r\nthis.$ = [$$[$0]];\r\nbreak;\r\ncase 87:\r\nthis.$ = $$[$0-1].concat($$[$0]);\r\nbreak;\r\ncase 88:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].toLowerCase(), Number($$[$0]));\r\nbreak;\r\ncase 89:\r\nthis.$ = new yy.ArgList($$[$0]);\r\nbreak;\r\ncase 90:\r\nthis.$ = $$[$0-1].append($$[$0]);\r\nbreak;\r\ncase 91:\r\nthis.$ = new yy.Arg($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 93:\r\nthis.$ = parseInt($$[$0]);\r\nbreak;\r\ncase 94:\r\nthis.$ = JSON.parse($$[$0]);\r\nbreak;\r\ncase 95: case 96:\r\nthis.$ = String($$[$0]);\r\nbreak;\r\ncase 157: case 158: case 161: case 162: case 163:\r\nthis.$ = $$[$0-2] + $$[$0-1] + $$[$0] //cause of could be color word in path;\r\nbreak;\r\ncase 166:\r\nthis.$ = $$[$0-2] = $$[$0-2] + $$[$0-1] + $$[$0];\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,5:[1,3],6:[1,4],7:[1,5],9:[1,6],11:[1,7],12:8,13:[1,9],15:[1,10],17:[1,11],18:[1,12],19:[1,13],20:[1,14],21:15,22:16,23:[1,17],25:[1,18],26:[1,19],27:[1,20],30:[1,21],33:[1,22],34:[1,23],37:[1,24],39:25,40:26,41:[1,27],43:[1,28],44:[1,29],45:[1,30],46:[1,31],48:[1,32],49:[1,33],50:34,51:35,52:[1,36],54:[1,37],55:[1,38],56:[1,44],58:[1,45],59:[1,39],62:[1,40],64:[1,41],65:[1,42],66:[1,43]},{1:[3]},{5:[1,46]},{1:[2,2]},{5:[2,3]},{5:[2,4],8:[1,47]},{5:[2,6],6:$V0,7:$V1,9:$V2,10:48,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,8]},{5:[2,9]},{6:$V0,7:$V1,9:$V2,10:106,13:$V3,14:[1,107],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{6:$V0,7:$V1,9:$V2,10:108,13:$V3,14:[1,109],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,14]},{5:[2,15]},{5:[2,16]},{5:[2,17],14:$VS,16:110,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,19]},{5:[2,20]},{24:116,35:$VX,38:$VY},{24:119,35:$VX,38:$VY},{24:120,35:$VX,38:$VY},{5:[2,25],24:121,28:[1,122],29:[1,123],35:$VX,38:$VY},{14:[1,124]},{14:[1,125]},{35:[1,126]},{38:[1,127]},{5:[2,33]},{5:[2,34]},{5:[2,35],14:[1,128],42:[1,129]},{5:[2,38],35:[1,130]},{5:[2,40]},{35:[1,131]},{47:132,73:133,74:$VZ},{47:135,73:133,74:$VZ},{5:[2,44],14:[1,136]},{5:[2,46]},{5:[2,47]},{6:$V0,7:$V1,9:$V2,10:138,13:$V3,14:[1,137],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,52]},{35:[1,139]},{14:[1,143],38:[1,141],60:140,61:[1,142]},{5:[2,65],38:[1,144],63:145,67:146,68:147,69:148,70:$V_,72:$V$},{24:151,35:$VX,38:$VY},{38:[1,152]},{38:[1,153]},{5:[2,54],29:[1,154],57:[1,155]},{5:[2,59],35:[1,156]},{1:[2,1]},{5:[2,5]},{5:[2,7],101:$V01},o($V11,[2,159]),o($V11,[2,160]),o($V21,[2,97]),o($V21,[2,98]),o($V11,[2,147]),o($V11,[2,148]),o($V11,[2,149]),o($V11,[2,150]),o($V11,[2,151]),o($V11,[2,152]),o($V11,[2,153]),o($V21,[2,101]),o($V21,[2,102]),o($V21,[2,103]),o($V21,[2,104]),o($V21,[2,105]),o($V21,[2,106]),o($V21,[2,107]),o($V21,[2,108]),o($V21,[2,109]),o($V21,[2,110]),o($V21,[2,111]),o($V21,[2,112]),o($V21,[2,113]),o($V21,[2,114]),o($V21,[2,115]),o($V21,[2,116]),o($V21,[2,117]),o($V21,[2,118]),o($V21,[2,119]),o($V21,[2,120]),o($V21,[2,121]),o($V21,[2,122]),o($V21,[2,123]),o($V21,[2,124]),o($V21,[2,125]),o($V21,[2,126]),o($V21,[2,127]),o($V21,[2,128]),o($V21,[2,129]),o($V21,[2,130]),o($V21,[2,131]),o($V21,[2,132]),o($V21,[2,133]),o($V21,[2,134]),o($V21,[2,135]),o($V21,[2,136]),o($V21,[2,137]),o($V21,[2,138]),o($V21,[2,139]),o($V21,[2,140]),o($V21,[2,141]),o($V21,[2,142]),o($V21,[2,143]),o($V21,[2,144]),o($V21,[2,145]),o($V21,[2,146]),{5:[2,10],101:$V01},{5:[2,11]},{14:$VS,16:158,35:$VT,38:$VU,77:$VV,78:$VW,101:$V01},{14:$VS,16:159,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,18]},o($V31,[2,92]),o($V31,[2,93]),o($V31,[2,94]),o($V31,[2,95]),o($V31,[2,96]),{5:[2,21]},o($V41,[2,75]),o($V41,[2,76]),{5:[2,22]},{5:[2,23]},{5:[2,24]},{5:[2,26]},{5:[2,27]},{5:[2,28],31:[1,160]},{5:[2,30]},{36:[1,161]},{5:[2,32]},{5:[2,36]},{5:[2,37]},{5:[2,39]},{5:[2,41]},{5:[2,42],73:162,74:$VZ},o($V51,[2,86]),{35:[1,163]},{5:[2,43],73:162,74:$VZ},{5:[2,45]},{14:[1,164]},{6:$V0,7:$V1,9:$V2,10:165,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR,101:$V01},{5:[2,53]},{5:[2,62]},{5:[2,63]},{5:[2,64]},{5:[2,164]},{5:[2,66],63:166,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,67]},{5:[2,77],67:167,68:147,69:148,70:$V_,72:$V$},o($V41,[2,81]),o($V41,[2,82],{80:52,53:168,75:169,76:170,79:171,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),{71:[1,172]},{71:[1,173]},{5:[2,69],63:174,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,71],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:175,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,73],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:176,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,55],57:[1,177]},{5:[2,56],29:[1,178]},{5:[2,60],35:[1,179]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,181],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:180,80:52,81:182,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,12]},{5:[2,13]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:183,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{14:[1,186]},o($V51,[2,87]),o($V51,[2,88]),{5:[2,48],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:187,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,49],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:188,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,101:$V01},{5:[2,68]},{5:[2,78],67:189,68:147,69:148,70:$V_,72:$V$},o($V41,[2,83],{80:52,76:170,79:171,75:190,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),o($V31,[2,89]),{71:[1,191],101:[1,192]},o($V61,[2,156]),{14:$VS,16:193,35:$VT,38:$VU,77:$VV,78:$VW},{14:$VS,16:194,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,70]},{5:[2,72],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,74],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,57]},{5:[2,58]},{5:[2,61]},o($V11,[2,161]),o($V11,[2,162]),o($V11,[2,163]),{5:[2,29]},{5:[2,99]},{5:[2,100]},{31:[1,195]},{5:[2,50],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,51],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,79],67:196,68:147,69:148,70:$V_,72:$V$},o($V31,[2,90]),{14:$VS,16:197,35:$VT,38:$VU,77:$VV,78:$VW},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,199],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,79:198,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},o($V41,[2,84]),o($V31,[2,85]),{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:200,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,80]},o($V31,[2,91]),o($V61,[2,157]),o($V61,[2,158]),{5:[2,31]}],\r\ndefaultActions: {3:[2,2],4:[2,3],7:[2,8],8:[2,9],11:[2,14],12:[2,15],13:[2,16],15:[2,19],16:[2,20],25:[2,33],26:[2,34],29:[2,40],34:[2,46],35:[2,47],37:[2,52],46:[2,1],47:[2,5],107:[2,11],110:[2,18],116:[2,21],119:[2,22],120:[2,23],121:[2,24],122:[2,26],123:[2,27],125:[2,30],127:[2,32],128:[2,36],129:[2,37],130:[2,39],131:[2,41],136:[2,45],139:[2,53],140:[2,62],141:[2,63],142:[2,64],143:[2,164],145:[2,67],158:[2,12],159:[2,13],166:[2,68],174:[2,70],177:[2,57],178:[2,58],179:[2,61],183:[2,29],184:[2,99],185:[2,100],196:[2,80],200:[2,31]},\r\nparseError: function parseError (str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function(match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex () {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin (condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState () {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules () {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState (n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState (condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* ignore whitespace */\r\nbreak;\r\ncase 1:return '';\r\nbreak;\r\ncase 2:return '';\r\nbreak;\r\ncase 3:return 42;\r\nbreak;\r\ncase 4:return 35;\r\nbreak;\r\ncase 5:return 77;\r\nbreak;\r\ncase 6:return 78;\r\nbreak;\r\ncase 7:return 78;\r\nbreak;\r\ncase 8:return 8;\r\nbreak;\r\ncase 9:return 6;\r\nbreak;\r\ncase 10:return 82;\r\nbreak;\r\ncase 11:return 7;\r\nbreak;\r\ncase 12:return 9;\r\nbreak;\r\ncase 13:return 59;\r\nbreak;\r\ncase 14:return 13\r\nbreak;\r\ncase 15:return 15\r\nbreak;\r\ncase 16:return 17\r\nbreak;\r\ncase 17:return 18\r\nbreak;\r\ncase 18:return 19\r\nbreak;\r\ncase 19:return 20\r\nbreak;\r\ncase 20:return 11\r\nbreak;\r\ncase 21:return 62\r\nbreak;\r\ncase 22:return 64\r\nbreak;\r\ncase 23:return 23\r\nbreak;\r\ncase 24:return 25\r\nbreak;\r\ncase 25:return 26\r\nbreak;\r\ncase 26:return 27\r\nbreak;\r\ncase 27:return 30\r\nbreak;\r\ncase 28:return 34\r\nbreak;\r\ncase 29:return 33\r\nbreak;\r\ncase 30:return 65\r\nbreak;\r\ncase 31:return 66\r\nbreak;\r\ncase 32:return 37\r\nbreak;\r\ncase 33:return 41\r\nbreak;\r\ncase 34:return 43\r\nbreak;\r\ncase 35:return 52\r\nbreak;\r\ncase 36:return 54\r\nbreak;\r\ncase 37:return 55\r\nbreak;\r\ncase 38:return 46\r\nbreak;\r\ncase 39:return 48\r\nbreak;\r\ncase 40:return 45\r\nbreak;\r\ncase 41:return 49\r\nbreak;\r\ncase 42:return 56\r\nbreak;\r\ncase 43:return 58;\r\nbreak;\r\ncase 44:return 44\r\nbreak;\r\ncase 45:return 83\r\nbreak;\r\ncase 46:return 84\r\nbreak;\r\ncase 47:return 85\r\nbreak;\r\ncase 48:return 86\r\nbreak;\r\ncase 49:return 87\r\nbreak;\r\ncase 50:return 88\r\nbreak;\r\ncase 51:return 89\r\nbreak;\r\ncase 52:return 90\r\nbreak;\r\ncase 53:return 91\r\nbreak;\r\ncase 54:return 92\r\nbreak;\r\ncase 55:return 93\r\nbreak;\r\ncase 56:return 94\r\nbreak;\r\ncase 57:return 95\r\nbreak;\r\ncase 58:return 70\r\nbreak;\r\ncase 59:return 70\r\nbreak;\r\ncase 60:return 72\r\nbreak;\r\ncase 61:return 72\r\nbreak;\r\ncase 62:return 74\r\nbreak;\r\ncase 63:return 74\r\nbreak;\r\ncase 64:return 74\r\nbreak;\r\ncase 65:return 31\r\nbreak;\r\ncase 66:return 36\r\nbreak;\r\ncase 67:return 96\r\nbreak;\r\ncase 68:return 97\r\nbreak;\r\ncase 69:return 98\r\nbreak;\r\ncase 70:return 99\r\nbreak;\r\ncase 71:yy_.yytext = yy.utils.unquoteString(yy_.yytext); return 14;\r\nbreak;\r\ncase 72:return 38;\r\nbreak;\r\ncase 73:return 5;\r\nbreak;\r\ncase 74:return 101;\r\nbreak;\r\ncase 75:return 103;\r\nbreak;\r\ncase 76:return '\\\\';\r\nbreak;\r\ncase 77:return 28\r\nbreak;\r\ncase 78:return 61\r\nbreak;\r\ncase 79:return 29\r\nbreak;\r\ncase 80:return 57\r\nbreak;\r\ncase 81:return 71\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:[#].*)/i,/^(?:\\/\\/.*)/i,/^(?:([_A-Z0-9\\/\\+]+==))/i,/^(?:-?[0-9]+(\\.[0-9]+)?\\b)/i,/^(?:0[xX][0-9A-F]+\\b)/i,/^(?:false\\b)/i,/^(?:true\\b)/i,/^(?:all\\b)/i,/^(?:reset\\b)/i,/^(?:clear\\b)/i,/^(?:build\\b)/i,/^(?:help\\b)/i,/^(?:load\\b)/i,/^(?:get\\b)/i,/^(?:set\\b)/i,/^(?:set_save\\b)/i,/^(?:set_restore\\b)/i,/^(?:set_reset\\b)/i,/^(?:preset\\b)/i,/^(?:motm\\b)/i,/^(?:add\\b)/i,/^(?:rep\\b)/i,/^(?:remove\\b)/i,/^(?:hide\\b)/i,/^(?:show\\b)/i,/^(?:list\\b)/i,/^(?:select\\b)/i,/^(?:within\\b)/i,/^(?:selector\\b)/i,/^(?:mode\\b)/i,/^(?:color\\b)/i,/^(?:material\\b)/i,/^(?:view\\b)/i,/^(?:unit\\b)/i,/^(?:line\\b)/i,/^(?:listobj\\b)/i,/^(?:removeobj\\b)/i,/^(?:rotate\\b)/i,/^(?:translate\\b)/i,/^(?:scale\\b)/i,/^(?:center\\b)/i,/^(?:url\\b)/i,/^(?:screenshot\\b)/i,/^(?:dssp\\b)/i,/^(?:file_list\\b)/i,/^(?:file_register\\b)/i,/^(?:file_delete\\b)/i,/^(?:preset_add\\b)/i,/^(?:preset_delete\\b)/i,/^(?:preset_update\\b)/i,/^(?:preset_rename\\b)/i,/^(?:preset_open\\b)/i,/^(?:create_scenario\\b)/i,/^(?:reset_scenario\\b)/i,/^(?:delete_scenario\\b)/i,/^(?:add_scenario_item\\b)/i,/^(?:list_scenario\\b)/i,/^(?:s\\b)/i,/^(?:mt\\b)/i,/^(?:m\\b)/i,/^(?:c\\b)/i,/^(?:x\\b)/i,/^(?:y\\b)/i,/^(?:z\\b)/i,/^(?:as\\b)/i,/^(?:of\\b)/i,/^(?:pdb\\b)/i,/^(?:delay\\b)/i,/^(?:prst\\b)/i,/^(?:desc\\b)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:\\.)/i,/^(?:\\/)/i,/^(?:\\\\)/i,/^(?:-e\\b)/i,/^(?:-f\\b)/i,/^(?:-s\\b)/i,/^(?:-v\\b)/i,/^(?:=)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[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,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,8],$V5=[1,9],$V6=[1,11],$V7=[1,12],$V8=[5,7,8,11],$V9=[1,17],$Va=[1,22],$Vb=[1,20],$Vc=[1,21],$Vd=[5,7,8,11,19];\r\nvar parser = {trace: function trace() { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Expression\":4,\"EOF\":5,\"Selector\":6,\"OR\":7,\"AND\":8,\"NOT\":9,\"(\":10,\")\":11,\"SELECTOR\":12,\"NAMED_SELECTOR\":13,\"SELECTOR_RANGED\":14,\"RangeList\":15,\"SELECTOR_NAMED\":16,\"NameList\":17,\"Range\":18,\",\":19,\"NUMBER\":20,\":\":21,\"Name\":22,\"IDENTIFIER\":23,\"STRING\":24,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",7:\"OR\",8:\"AND\",9:\"NOT\",10:\"(\",11:\")\",12:\"SELECTOR\",13:\"NAMED_SELECTOR\",14:\"SELECTOR_RANGED\",16:\"SELECTOR_NAMED\",19:\",\",20:\"NUMBER\",21:\":\",23:\"IDENTIFIER\",24:\"STRING\"},\r\nproductions_: [0,[3,2],[4,1],[4,3],[4,3],[4,2],[4,3],[6,1],[6,1],[6,2],[6,2],[15,1],[15,3],[18,1],[18,3],[17,1],[17,3],[22,1],[22,1],[22,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.keyword('or')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.keyword('and')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.keyword('not')($$[$0]);\r\nbreak;\r\ncase 6:\r\nthis.$ = $$[$0-1];\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.keyword($$[$0])();\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.GetSelector($$[$0].toLowerCase().slice(1, $$[$0].length));\r\nbreak;\r\ncase 9: case 10:\r\nthis.$ = yy.keyword($$[$0-1])($$[$0]);\r\nbreak;\r\ncase 11:\r\nthis.$ = new yy.RangeList($$[$0]);\r\nbreak;\r\ncase 12: case 16:\r\nthis.$ = $$[$0-2].append($$[$0]);\r\nbreak;\r\ncase 13:\r\nthis.$ = new yy.Range(Number($$[$0]));\r\nbreak;\r\ncase 14:\r\nthis.$ = new yy.Range(Number($$[$0-2]), Number($$[$0]));\r\nbreak;\r\ncase 15:\r\nthis.$ = new yy.ValueList($$[$0]);\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{1:[3]},{5:[1,10],7:$V6,8:$V7},o($V8,[2,2]),{4:13,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:14,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,7]),o($V8,[2,8]),{15:15,18:16,20:$V9},{17:18,20:$Va,22:19,23:$Vb,24:$Vc},{1:[2,1]},{4:23,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:24,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,5]),{7:$V6,8:$V7,11:[1,25]},o($V8,[2,9],{19:[1,26]}),o($Vd,[2,11]),o($Vd,[2,13],{21:[1,27]}),o($V8,[2,10],{19:[1,28]}),o($Vd,[2,15]),o($Vd,[2,17]),o($Vd,[2,18]),o($Vd,[2,19]),o([5,7,11],[2,3],{8:$V7}),o($V8,[2,4]),o($V8,[2,6]),{18:29,20:$V9},{20:[1,30]},{20:$Va,22:31,23:$Vb,24:$Vc},o($Vd,[2,12]),o($Vd,[2,14]),o($Vd,[2,16])],\r\ndefaultActions: {10:[2,1]},\r\nparseError: function parseError(str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function (match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex() {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin(condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState() {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules() {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState(n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState(condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* skip whitespace */\r\nbreak;\r\ncase 1:return 20;\r\nbreak;\r\ncase 2:return 7;\r\nbreak;\r\ncase 3:return 8;\r\nbreak;\r\ncase 4:return 9;\r\nbreak;\r\ncase 5:return 12;\r\nbreak;\r\ncase 6:return 16;\r\nbreak;\r\ncase 7:return 14;\r\nbreak;\r\ncase 8:return 10;\r\nbreak;\r\ncase 9:return 11;\r\nbreak;\r\ncase 10:return 19;\r\nbreak;\r\ncase 11:return 21;\r\nbreak;\r\ncase 12:return '<=';\r\nbreak;\r\ncase 13:return '>=';\r\nbreak;\r\ncase 14:return '<';\r\nbreak;\r\ncase 15:return '>';\r\nbreak;\r\ncase 16:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 24;\r\nbreak;\r\ncase 17:return 13;\r\nbreak;\r\ncase 18:return 23;\r\nbreak;\r\ncase 19:return 5;\r\nbreak;\r\ncase 20:return 'INVALID';\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:(-?(?:[1-9][0-9]+|[0-9]))\\b)/i,/^(?:OR\\b)/i,/^(?:AND\\b)/i,/^(?:NOT\\b)/i,/^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\\b)/i,/^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\\b)/i,/^(?:((SERIAL|SEQUENCE|RESIDX))\\b)/i,/^(?:\\()/i,/^(?:\\))/i,/^(?:,)/i,/^(?::)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:(@[_A-Z0-9]+))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:.)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","\r\n/*\r\nSmooth.js version 0.1.7\r\n\r\nTurn arrays into smooth functions.\r\n\r\nCopyright 2012 Spencer Cohen\r\nLicensed under MIT license (see \"Smooth.js MIT license.txt\")\r\n*/\r\n\r\n/*Constants (these are accessible by Smooth.WHATEVER in user space)\r\n*/\r\n\r\n(function() {\r\n var AbstractInterpolator, CubicInterpolator, Enum, LinearInterpolator, NearestInterpolator, PI, SincFilterInterpolator, Smooth, clipClamp, clipMirror, clipPeriodic, defaultConfig, getColumn, getType, isValidNumber, k, makeLanczosWindow, makeScaledFunction, makeSincKernel, normalizeScaleTo, shallowCopy, sin, sinc, v, validateNumber, validateVector,\r\n __hasProp = Object.prototype.hasOwnProperty,\r\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };\r\n\r\n Enum = {\r\n /*Interpolation methods\r\n */\r\n METHOD_NEAREST: 'nearest',\r\n METHOD_LINEAR: 'linear',\r\n METHOD_CUBIC: 'cubic',\r\n METHOD_LANCZOS: 'lanczos',\r\n METHOD_SINC: 'sinc',\r\n /*Input clipping modes\r\n */\r\n CLIP_CLAMP: 'clamp',\r\n CLIP_ZERO: 'zero',\r\n CLIP_PERIODIC: 'periodic',\r\n CLIP_MIRROR: 'mirror',\r\n /* Constants for control over the cubic interpolation tension\r\n */\r\n CUBIC_TENSION_DEFAULT: 0,\r\n CUBIC_TENSION_CATMULL_ROM: 0\r\n };\r\n\r\n defaultConfig = {\r\n method: Enum.METHOD_CUBIC,\r\n cubicTension: Enum.CUBIC_TENSION_DEFAULT,\r\n clip: Enum.CLIP_CLAMP,\r\n scaleTo: 0,\r\n sincFilterSize: 2,\r\n sincWindow: void 0\r\n };\r\n\r\n /*Index clipping functions\r\n */\r\n\r\n clipClamp = function(i, n) {\r\n return Math.max(0, Math.min(i, n - 1));\r\n };\r\n\r\n clipPeriodic = function(i, n) {\r\n i = i % n;\r\n if (i < 0) i += n;\r\n return i;\r\n };\r\n\r\n clipMirror = function(i, n) {\r\n var period;\r\n period = 2 * (n - 1);\r\n i = clipPeriodic(i, period);\r\n if (i > n - 1) i = period - i;\r\n return i;\r\n };\r\n\r\n /*\r\n Abstract scalar interpolation class which provides common functionality for all interpolators\r\n \r\n Subclasses must override interpolate().\r\n */\r\n\r\n AbstractInterpolator = (function() {\r\n\r\n function AbstractInterpolator(array, config) {\r\n this.array = array.slice(0);\r\n this.length = this.array.length;\r\n if (!(this.clipHelper = {\r\n clamp: this.clipHelperClamp,\r\n zero: this.clipHelperZero,\r\n periodic: this.clipHelperPeriodic,\r\n mirror: this.clipHelperMirror\r\n }[config.clip])) {\r\n throw \"Invalid clip: \" + config.clip;\r\n }\r\n }\r\n\r\n AbstractInterpolator.prototype.getClippedInput = function(i) {\r\n if ((0 <= i && i < this.length)) {\r\n return this.array[i];\r\n } else {\r\n return this.clipHelper(i);\r\n }\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperClamp = function(i) {\r\n return this.array[clipClamp(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperZero = function(i) {\r\n return 0;\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperPeriodic = function(i) {\r\n return this.array[clipPeriodic(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperMirror = function(i) {\r\n return this.array[clipMirror(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.interpolate = function(t) {\r\n throw 'Subclasses of AbstractInterpolator must override the interpolate() method.';\r\n };\r\n\r\n return AbstractInterpolator;\r\n\r\n })();\r\n\r\n NearestInterpolator = (function(_super) {\r\n\r\n __extends(NearestInterpolator, _super);\r\n\r\n function NearestInterpolator() {\r\n NearestInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n NearestInterpolator.prototype.interpolate = function(t) {\r\n return this.getClippedInput(Math.round(t));\r\n };\r\n\r\n return NearestInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n LinearInterpolator = (function(_super) {\r\n\r\n __extends(LinearInterpolator, _super);\r\n\r\n function LinearInterpolator() {\r\n LinearInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n LinearInterpolator.prototype.interpolate = function(t) {\r\n var k;\r\n k = Math.floor(t);\r\n t -= k;\r\n return (1 - t) * this.getClippedInput(k) + t * this.getClippedInput(k + 1);\r\n };\r\n\r\n return LinearInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n CubicInterpolator = (function(_super) {\r\n\r\n __extends(CubicInterpolator, _super);\r\n\r\n function CubicInterpolator(array, config) {\r\n this.tangentFactor = 1 - Math.max(-1, Math.min(1, config.cubicTension));\r\n CubicInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n CubicInterpolator.prototype.getTangent = function(k) {\r\n return this.tangentFactor * (this.getClippedInput(k + 1) - this.getClippedInput(k - 1)) / 2;\r\n };\r\n\r\n CubicInterpolator.prototype.interpolate = function(t) {\r\n var k, m, p, t2, t3;\r\n k = Math.floor(t);\r\n m = [this.getTangent(k), this.getTangent(k + 1)];\r\n p = [this.getClippedInput(k), this.getClippedInput(k + 1)];\r\n t -= k;\r\n t2 = t * t;\r\n t3 = t * t2;\r\n return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + (-2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1];\r\n };\r\n\r\n return CubicInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n sin = Math.sin, PI = Math.PI;\r\n\r\n sinc = function(x) {\r\n if (x === 0) {\r\n return 1;\r\n } else {\r\n return sin(PI * x) / (PI * x);\r\n }\r\n };\r\n\r\n makeLanczosWindow = function(a) {\r\n return function(x) {\r\n return sinc(x / a);\r\n };\r\n };\r\n\r\n makeSincKernel = function(window) {\r\n return function(x) {\r\n return sinc(x) * window(x);\r\n };\r\n };\r\n\r\n SincFilterInterpolator = (function(_super) {\r\n\r\n __extends(SincFilterInterpolator, _super);\r\n\r\n function SincFilterInterpolator(array, config) {\r\n SincFilterInterpolator.__super__.constructor.apply(this, arguments);\r\n this.a = config.sincFilterSize;\r\n if (!config.sincWindow) throw 'No sincWindow provided';\r\n this.kernel = makeSincKernel(config.sincWindow);\r\n }\r\n\r\n SincFilterInterpolator.prototype.interpolate = function(t) {\r\n var k, n, sum, _ref, _ref2;\r\n k = Math.floor(t);\r\n sum = 0;\r\n for (n = _ref = k - this.a + 1, _ref2 = k + this.a; _ref <= _ref2 ? n <= _ref2 : n >= _ref2; _ref <= _ref2 ? n++ : n--) {\r\n sum += this.kernel(t - n) * this.getClippedInput(n);\r\n }\r\n return sum;\r\n };\r\n\r\n return SincFilterInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n getColumn = function(arr, i) {\r\n var row, _i, _len, _results;\r\n _results = [];\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n row = arr[_i];\r\n _results.push(row[i]);\r\n }\r\n return _results;\r\n };\r\n\r\n makeScaledFunction = function(f, baseScale, scaleRange) {\r\n var scaleFactor, translation;\r\n if (scaleRange.join === '0,1') {\r\n return f;\r\n } else {\r\n scaleFactor = baseScale / (scaleRange[1] - scaleRange[0]);\r\n translation = scaleRange[0];\r\n return function(t) {\r\n return f(scaleFactor * (t - translation));\r\n };\r\n }\r\n };\r\n\r\n getType = function(x) {\r\n return Object.prototype.toString.call(x).slice('[object '.length, -1);\r\n };\r\n\r\n validateNumber = function(n) {\r\n if (isNaN(n)) throw 'NaN in Smooth() input';\r\n if (getType(n) !== 'Number') throw 'Non-number in Smooth() input';\r\n if (!isFinite(n)) throw 'Infinity in Smooth() input';\r\n };\r\n\r\n validateVector = function(v, dimension) {\r\n var n, _i, _len;\r\n if (getType(v) !== 'Array') throw 'Non-vector in Smooth() input';\r\n if (v.length !== dimension) throw 'Inconsistent dimension in Smooth() input';\r\n for (_i = 0, _len = v.length; _i < _len; _i++) {\r\n n = v[_i];\r\n validateNumber(n);\r\n }\r\n };\r\n\r\n isValidNumber = function(n) {\r\n return (getType(n) === 'Number') && isFinite(n) && !isNaN(n);\r\n };\r\n\r\n normalizeScaleTo = function(s) {\r\n var invalidErr;\r\n invalidErr = \"scaleTo param must be number or array of two numbers\";\r\n switch (getType(s)) {\r\n case 'Number':\r\n if (!isValidNumber(s)) throw invalidErr;\r\n s = [0, s];\r\n break;\r\n case 'Array':\r\n if (s.length !== 2) throw invalidErr;\r\n if (!(isValidNumber(s[0]) && isValidNumber(s[1]))) throw invalidErr;\r\n break;\r\n default:\r\n throw invalidErr;\r\n }\r\n return s;\r\n };\r\n\r\n shallowCopy = function(obj) {\r\n var copy, k, v;\r\n copy = {};\r\n for (k in obj) {\r\n if (!__hasProp.call(obj, k)) continue;\r\n v = obj[k];\r\n copy[k] = v;\r\n }\r\n return copy;\r\n };\r\n\r\n Smooth = function(arr, config) {\r\n var baseDomainEnd, dimension, i, interpolator, interpolatorClass, interpolators, k, n, properties, smoothFunc, v;\r\n if (config == null) config = {};\r\n properties = {};\r\n config = shallowCopy(config);\r\n properties.config = shallowCopy(config);\r\n if (config.scaleTo == null) config.scaleTo = config.period;\r\n if (config.sincFilterSize == null) {\r\n config.sincFilterSize = config.lanczosFilterSize;\r\n }\r\n for (k in defaultConfig) {\r\n if (!__hasProp.call(defaultConfig, k)) continue;\r\n v = defaultConfig[k];\r\n if (config[k] == null) config[k] = v;\r\n }\r\n if (!(interpolatorClass = {\r\n nearest: NearestInterpolator,\r\n linear: LinearInterpolator,\r\n cubic: CubicInterpolator,\r\n lanczos: SincFilterInterpolator,\r\n sinc: SincFilterInterpolator\r\n }[config.method])) {\r\n throw \"Invalid method: \" + config.method;\r\n }\r\n if (config.method === 'lanczos') {\r\n config.sincWindow = makeLanczosWindow(config.sincFilterSize);\r\n }\r\n if (arr.length < 2) throw 'Array must have at least two elements';\r\n properties.count = arr.length;\r\n smoothFunc = (function() {\r\n var _i, _j, _len, _len2;\r\n switch (getType(arr[0])) {\r\n case 'Number':\r\n properties.dimension = 'scalar';\r\n if (Smooth.deepValidation) {\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n n = arr[_i];\r\n validateNumber(n);\r\n }\r\n }\r\n interpolator = new interpolatorClass(arr, config);\r\n return function(t) {\r\n return interpolator.interpolate(t);\r\n };\r\n case 'Array':\r\n properties.dimension = dimension = arr[0].length;\r\n if (!dimension) throw 'Vectors must be non-empty';\r\n if (Smooth.deepValidation) {\r\n for (_j = 0, _len2 = arr.length; _j < _len2; _j++) {\r\n v = arr[_j];\r\n validateVector(v, dimension);\r\n }\r\n }\r\n interpolators = (function() {\r\n var _results;\r\n _results = [];\r\n for (i = 0; 0 <= dimension ? i < dimension : i > dimension; 0 <= dimension ? i++ : i--) {\r\n _results.push(new interpolatorClass(getColumn(arr, i), config));\r\n }\r\n return _results;\r\n })();\r\n return function(t) {\r\n var interpolator, _k, _len3, _results;\r\n _results = [];\r\n for (_k = 0, _len3 = interpolators.length; _k < _len3; _k++) {\r\n interpolator = interpolators[_k];\r\n _results.push(interpolator.interpolate(t));\r\n }\r\n return _results;\r\n };\r\n default:\r\n throw \"Invalid element type: \" + (getType(arr[0]));\r\n }\r\n })();\r\n if (config.clip === 'periodic') {\r\n baseDomainEnd = arr.length;\r\n } else {\r\n baseDomainEnd = arr.length - 1;\r\n }\r\n config.scaleTo || (config.scaleTo = baseDomainEnd);\r\n properties.domain = normalizeScaleTo(config.scaleTo);\r\n smoothFunc = makeScaledFunction(smoothFunc, baseDomainEnd, properties.domain);\r\n properties.domain.sort();\r\n /*copy properties\r\n */\r\n for (k in properties) {\r\n if (!__hasProp.call(properties, k)) continue;\r\n v = properties[k];\r\n smoothFunc[k] = v;\r\n }\r\n return smoothFunc;\r\n };\r\n\r\n for (k in Enum) {\r\n if (!__hasProp.call(Enum, k)) continue;\r\n v = Enum[k];\r\n Smooth[k] = v;\r\n }\r\n\r\n Smooth.deepValidation = true;\r\n\r\n (typeof exports !== \"undefined\" && exports !== null ? exports : window).Smooth = Smooth;\r\n\r\n}).call(this);\r\n","!function(r,t){if(\"function\"==typeof define&&define.amd)define([\"exports\"],t);else if(\"object\"==typeof exports&&\"undefined\"!=typeof module)t(exports);else t(r.MMTF=r.MMTF||{})}(this,function(r){\"use strict\";function t(r,t,n){for(var e=(r.byteLength,0),i=n.length;i>e;e++){var o=n.charCodeAt(e);if(128>o)r.setUint8(t++,o>>>0&127|0);else if(2048>o)r.setUint8(t++,o>>>6&31|192),r.setUint8(t++,o>>>0&63|128);else if(65536>o)r.setUint8(t++,o>>>12&15|224),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128);else{if(!(1114112>o))throw new Error(\"bad codepoint \"+o);r.setUint8(t++,o>>>18&7|240),r.setUint8(t++,o>>>12&63|128),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128)}}}function n(r){for(var t=0,n=0,e=r.length;e>n;n++){var i=r.charCodeAt(n);if(128>i)t+=1;else if(2048>i)t+=2;else if(65536>i)t+=3;else{if(!(1114112>i))throw new Error(\"bad codepoint \"+i);t+=4}}return t}function e(r,i,o){var a=typeof r;if(\"string\"===a){var u=n(r);if(32>u)return i.setUint8(o,160|u),t(i,o+1,r),1+u;if(256>u)return i.setUint8(o,217),i.setUint8(o+1,u),t(i,o+2,r),2+u;if(65536>u)return i.setUint8(o,218),i.setUint16(o+1,u),t(i,o+3,r),3+u;if(4294967296>u)return i.setUint8(o,219),i.setUint32(o+1,u),t(i,o+5,r),5+u}if(r instanceof Uint8Array){var u=r.byteLength,s=new Uint8Array(i.buffer);if(256>u)return i.setUint8(o,196),i.setUint8(o+1,u),s.set(r,o+2),2+u;if(65536>u)return i.setUint8(o,197),i.setUint16(o+1,u),s.set(r,o+3),3+u;if(4294967296>u)return i.setUint8(o,198),i.setUint32(o+1,u),s.set(r,o+5),5+u}if(\"number\"===a){if(!isFinite(r))throw new Error(\"Number not finite: \"+r);if(Math.floor(r)!==r)return i.setUint8(o,203),i.setFloat64(o+1,r),9;if(r>=0){if(128>r)return i.setUint8(o,r),1;if(256>r)return i.setUint8(o,204),i.setUint8(o+1,r),2;if(65536>r)return i.setUint8(o,205),i.setUint16(o+1,r),3;if(4294967296>r)return i.setUint8(o,206),i.setUint32(o+1,r),5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return i.setInt8(o,r),1;if(r>=-128)return i.setUint8(o,208),i.setInt8(o+1,r),2;if(r>=-32768)return i.setUint8(o,209),i.setInt16(o+1,r),3;if(r>=-2147483648)return i.setUint8(o,210),i.setInt32(o+1,r),5;throw new Error(\"Number too small -0x\"+(-r).toString(16).substr(1))}if(null===r)return i.setUint8(o,192),1;if(\"boolean\"===a)return i.setUint8(o,r?195:194),1;if(\"object\"===a){var u,f=0,c=Array.isArray(r);if(c)u=r.length;else{var d=Object.keys(r);u=d.length}var f;if(16>u?(i.setUint8(o,u|(c?144:128)),f=1):65536>u?(i.setUint8(o,c?220:222),i.setUint16(o+1,u),f=3):4294967296>u&&(i.setUint8(o,c?221:223),i.setUint32(o+1,u),f=5),c)for(var l=0;u>l;l++)f+=e(r[l],i,o+f);else for(var l=0;u>l;l++){var v=d[l];f+=e(v,i,o+f),f+=e(r[v],i,o+f)}return f}throw new Error(\"Unknown type \"+a)}function i(r){var t=typeof r;if(\"string\"===t){var e=n(r);if(32>e)return 1+e;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(r instanceof Uint8Array){var e=r.byteLength;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(\"number\"===t){if(Math.floor(r)!==r)return 9;if(r>=0){if(128>r)return 1;if(256>r)return 2;if(65536>r)return 3;if(4294967296>r)return 5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return 1;if(r>=-128)return 2;if(r>=-32768)return 3;if(r>=-2147483648)return 5;throw new Error(\"Number too small -0x\"+r.toString(16).substr(1))}if(\"boolean\"===t||null===r)return 1;if(\"object\"===t){var e,o=0;if(Array.isArray(r)){e=r.length;for(var a=0;e>a;a++)o+=i(r[a])}else{var u=Object.keys(r);e=u.length;for(var a=0;e>a;a++){var s=u[a];o+=i(s)+i(r[s])}}if(16>e)return 1+o;if(65536>e)return 3+o;if(4294967296>e)return 5+o;throw new Error(\"Array or object too long 0x\"+e.toString(16))}throw new Error(\"Unknown type \"+t)}function o(r){var t=new ArrayBuffer(i(r)),n=new DataView(t);return e(r,n,0),new Uint8Array(t)}function a(r,t,n){return t?new r(t.buffer,t.byteOffset,t.byteLength/(n||1)):void 0}function u(r){return a(DataView,r)}function s(r){return a(Uint8Array,r)}function f(r){return a(Int8Array,r)}function c(r){return a(Int32Array,r,4)}function d(r){return a(Float32Array,r,4)}function l(r,t){var n=r.length/2;t||(t=new Int16Array(n));for(var e=0,i=0;n>e;++e,i+=2)t[e]=r[i]<<8^r[i+1]<<0;return t}function v(r,t){var n=r.length;t||(t=new Uint8Array(2*n));for(var e=u(t),i=0;n>i;++i)e.setInt16(2*i,r[i]);return s(t)}function g(r,t){var n=r.length/4;t||(t=new Int32Array(n));for(var e=0,i=0;n>e;++e,i+=4)t[e]=r[i]<<24^r[i+1]<<16^r[i+2]<<8^r[i+3]<<0;return t}function L(r,t){var n=r.length;t||(t=new Uint8Array(4*n));for(var e=u(t),i=0;n>i;++i)e.setInt32(4*i,r[i]);return s(t)}function h(r,t){var n=r.length;t||(t=new Float32Array(n/4));for(var e=u(t),i=u(r),o=0,a=0,s=n/4;s>o;++o,a+=4)e.setFloat32(a,i.getFloat32(a),!0);return t}function y(r,t,n){var e=r.length,i=1/t;n||(n=new Float32Array(e));for(var o=0;e>o;++o)n[o]=r[o]*i;return n}function m(r,t,n){var e=r.length;n||(n=new Int32Array(e));for(var i=0;e>i;++i)n[i]=Math.round(r[i]*t);return n}function p(r,t){var n,e;if(!t){var i=0;for(n=0,e=r.length;e>n;n+=2)i+=r[n+1];t=new r.constructor(i)}var o=0;for(n=0,e=r.length;e>n;n+=2)for(var a=r[n],u=r[n+1],s=0;u>s;++s)t[o]=a,++o;return t}function U(r){if(0===r.length)return new Int32Array;var t,n,e=2;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]&&(e+=2);var i=new Int32Array(e),o=0,a=1;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]?(i[o]=r[t-1],i[o+1]=a,a=1,o+=2):++a;return i[o]=r[r.length-1],i[o+1]=a,i}function b(r,t){var n=r.length;t||(t=new r.constructor(n)),n&&(t[0]=r[0]);for(var e=1;n>e;++e)t[e]=r[e]+t[e-1];return t}function I(r,t){var n=r.length;t||(t=new r.constructor(n)),t[0]=r[0];for(var e=1;n>e;++e)t[e]=r[e]-r[e-1];return t}function w(r,t){var n,e,i=r instanceof Int8Array?127:32767,o=-i-1,a=r.length;if(!t){var u=0;for(n=0;a>n;++n)r[n]o&&++u;t=new Int32Array(u)}for(n=0,e=0;a>n;){for(var s=0;r[n]===i||r[n]===o;)s+=r[n],++n;s+=r[n],++n,t[e]=s,++e}return t}function C(r,t){var n,e=t?127:32767,i=-e-1,o=r.length,a=0;for(n=0;o>n;++n){var u=r[n];0===u?++a:a+=u===e||u===i?2:u>0?Math.ceil(u/e):Math.ceil(u/i)}var s=t?new Int8Array(a):new Int16Array(a),f=0;for(n=0;o>n;++n){var u=r[n];if(u>=0)for(;u>=e;)s[f]=e,++f,u-=e;else for(;i>=u;)s[f]=i,++f,u-=i;s[f]=u,++f}return s}function A(r,t){return b(p(r),t)}function x(r){return U(I(r))}function M(r,t,n){return y(p(r,c(n)),t,n)}function F(r,t){return U(m(r,t))}function S(r,t,n){return y(b(r,c(n)),t,n)}function E(r,t,n){return I(m(r,t),n)}function N(r,t,n){return y(w(r,c(n)),t,n)}function O(r,t,n){var e=w(r,c(n));return S(e,t,d(e))}function T(r,t,n){return C(E(r,t),n)}function k(r){var t=u(r),n=t.getInt32(0),e=t.getInt32(4),i=r.subarray(8,12),r=r.subarray(12);return[n,r,e,i]}function j(r,t,n,e){var i=new ArrayBuffer(12+e.byteLength),o=new Uint8Array(i),a=new DataView(i);return a.setInt32(0,r),a.setInt32(4,t),n&&o.set(n,8),o.set(e,12),o}function q(r){var t=r.length,n=s(r);return j(2,t,void 0,n)}function D(r){var t=r.length,n=L(r);return j(4,t,void 0,n)}function P(r,t){var n=r.length/t,e=L([t]),i=s(r);return j(5,n,e,i)}function z(r){var t=r.length,n=L(U(r));return j(6,t,void 0,n)}function B(r){var t=r.length,n=L(x(r));return j(8,t,void 0,n)}function V(r,t){var n=r.length,e=L([t]),i=L(F(r,t));return j(9,n,e,i)}function G(r,t){var n=r.length,e=L([t]),i=v(T(r,t));return j(10,n,e,i)}function R(r){var t={};return rr.forEach(function(n){void 0!==r[n]&&(t[n]=r[n])}),r.bondAtomList&&(t.bondAtomList=D(r.bondAtomList)),r.bondOrderList&&(t.bondOrderList=q(r.bondOrderList)),t.xCoordList=G(r.xCoordList,1e3),t.yCoordList=G(r.yCoordList,1e3),t.zCoordList=G(r.zCoordList,1e3),r.bFactorList&&(t.bFactorList=G(r.bFactorList,100)),r.atomIdList&&(t.atomIdList=B(r.atomIdList)),r.altLocList&&(t.altLocList=z(r.altLocList)),r.occupancyList&&(t.occupancyList=V(r.occupancyList,100)),t.groupIdList=B(r.groupIdList),t.groupTypeList=D(r.groupTypeList),r.secStructList&&(t.secStructList=q(r.secStructList,1)),r.insCodeList&&(t.insCodeList=z(r.insCodeList)),r.sequenceIndexList&&(t.sequenceIndexList=B(r.sequenceIndexList)),t.chainIdList=P(r.chainIdList,4),r.chainNameList&&(t.chainNameList=P(r.chainNameList,4)),t}function H(r){function t(r){for(var t={},n=0;r>n;n++){var e=o();t[e]=o()}return t}function n(t){var n=r.subarray(a,a+t);return a+=t,n}function e(t){var n=r.subarray(a,a+t);a+=t;var e=65535;if(t>e){for(var i=[],o=0;on;n++)t[n]=o();return t}function o(){var o,s,f=r[a];if(0===(128&f))return a++,f;if(128===(240&f))return s=15&f,a++,t(s);if(144===(240&f))return s=15&f,a++,i(s);if(160===(224&f))return s=31&f,a++,e(s);if(224===(224&f))return o=u.getInt8(a),a++,o;switch(f){case 192:return a++,null;case 194:return a++,!1;case 195:return a++,!0;case 196:return s=u.getUint8(a+1),a+=2,n(s);case 197:return s=u.getUint16(a+1),a+=3,n(s);case 198:return s=u.getUint32(a+1),a+=5,n(s);case 202:return o=u.getFloat32(a+1),a+=5,o;case 203:return o=u.getFloat64(a+1),a+=9,o;case 204:return o=r[a+1],a+=2,o;case 205:return o=u.getUint16(a+1),a+=3,o;case 206:return o=u.getUint32(a+1),a+=5,o;case 208:return o=u.getInt8(a+1),a+=2,o;case 209:return o=u.getInt16(a+1),a+=3,o;case 210:return o=u.getInt32(a+1),a+=5,o;case 217:return s=u.getUint8(a+1),a+=2,e(s);case 218:return s=u.getUint16(a+1),a+=3,e(s);case 219:return s=u.getUint32(a+1),a+=5,e(s);case 220:return s=u.getUint16(a+1),a+=3,i(s);case 221:return s=u.getUint32(a+1),a+=5,i(s);case 222:return s=u.getUint16(a+1),a+=3,t(s);case 223:return s=u.getUint32(a+1),a+=5,t(s)}throw new Error(\"Unknown type 0x\"+f.toString(16))}var a=0,u=new DataView(r.buffer);return o()}function W(r,t,n,e){switch(r){case 1:return h(t);case 2:return f(t);case 3:return l(t);case 4:return g(t);case 5:return s(t);case 6:return p(g(t),new Uint8Array(n));case 7:return p(g(t));case 8:return A(g(t));case 9:return M(g(t),g(e)[0]);case 10:return O(l(t),g(e)[0]);case 11:return y(l(t),g(e)[0]);case 12:return N(l(t),g(e)[0]);case 13:return N(f(t),g(e)[0]);case 14:return w(l(t));case 15:return w(f(t))}}function X(r,t){t=t||{};var n=t.ignoreFields,e={};return nr.forEach(function(t){var i=n?-1!==n.indexOf(t):!1,o=r[t];i||void 0===o||(o instanceof Uint8Array?e[t]=W.apply(null,k(o)):e[t]=o)}),e}function J(r){return String.fromCharCode.apply(null,r).replace(/\\0/g,\"\")}function K(r,t,n){n=n||{};var e,i,o,a,u,s,f=n.firstModelOnly,c=t.onModel,d=t.onChain,l=t.onGroup,v=t.onAtom,g=t.onBond,L=0,h=0,y=0,m=0,p=0,U=-1,b=r.chainNameList,I=r.secStructList,w=r.insCodeList,C=r.sequenceIndexList,A=r.atomIdList,x=r.bFactorList,M=r.altLocList,F=r.occupancyList,S=r.bondAtomList,E=r.bondOrderList;for(e=0,i=r.chainsPerModel.length;i>e&&!(f&&L>0);++e){var N=r.chainsPerModel[L];for(c&&c({chainCount:N,modelIndex:L}),o=0;N>o;++o){var O=r.groupsPerChain[h];if(d){var T=J(r.chainIdList.subarray(4*h,4*h+4)),k=null;b&&(k=J(b.subarray(4*h,4*h+4))),d({groupCount:O,chainIndex:h,modelIndex:L,chainId:T,chainName:k})}for(a=0;O>a;++a){var j=r.groupList[r.groupTypeList[y]],q=j.atomNameList.length;if(l){var D=null;I&&(D=I[y]);var P=null;r.insCodeList&&(P=String.fromCharCode(w[y]));var z=null;C&&(z=C[y]),l({atomCount:q,groupIndex:y,chainIndex:h,modelIndex:L,groupId:r.groupIdList[y],groupType:r.groupTypeList[y],groupName:j.groupName,singleLetterCode:j.singleLetterCode,chemCompType:j.chemCompType,secStruct:D,insCode:P,sequenceIndex:z})}for(u=0;q>u;++u){if(v){var B=null;A&&(B=A[m]);var V=null;x&&(V=x[m]);var G=null;M&&(G=String.fromCharCode(M[m]));var R=null;F&&(R=F[m]),v({atomIndex:m,groupIndex:y,chainIndex:h,modelIndex:L,atomId:B,element:j.elementList[u],atomName:j.atomNameList[u],formalCharge:j.formalChargeList[u],xCoord:r.xCoordList[m],yCoord:r.yCoordList[m],zCoord:r.zCoordList[m],bFactor:V,altLoc:G,occupancy:R})}m+=1}if(g){var H=j.bondAtomList;for(u=0,s=j.bondOrderList.length;s>u;++u)g({atomIndex1:m-q+H[2*u],atomIndex2:m-q+H[2*u+1],bondOrder:j.bondOrderList[u]})}y+=1}h+=1}if(p=U+1,U=m-1,g&&S)for(u=0,s=S.length;s>u;u+=2){var W=S[u],X=S[u+1];(W>=p&&U>=W||X>=p&&U>=X)&&g({atomIndex1:W,atomIndex2:X,bondOrder:E?E[u/2]:null})}L+=1}}function Q(r){return o(R(r))}function Y(r,t){r instanceof ArrayBuffer&&(r=new Uint8Array(r));var n;return n=r instanceof Uint8Array?H(r):r,X(n,t)}function Z(r,t,n,e){function i(){try{var r=Y(o.response);n(r)}catch(t){e(t)}}var o=new XMLHttpRequest;o.addEventListener(\"load\",i,!0),o.addEventListener(\"error\",e,!0),o.responseType=\"arraybuffer\",o.open(\"GET\",t+r.toUpperCase()),o.send()}function $(r,t,n){Z(r,or,t,n)}function _(r,t,n){Z(r,ar,t,n)}var rr=[\"mmtfVersion\",\"mmtfProducer\",\"unitCell\",\"spaceGroup\",\"structureId\",\"title\",\"depositionDate\",\"releaseDate\",\"experimentalMethods\",\"resolution\",\"rFree\",\"rWork\",\"bioAssemblyList\",\"ncsOperatorList\",\"entityList\",\"groupList\",\"numBonds\",\"numAtoms\",\"numGroups\",\"numChains\",\"numModels\",\"groupsPerChain\",\"chainsPerModel\"],tr=[\"xCoordList\",\"yCoordList\",\"zCoordList\",\"groupIdList\",\"groupTypeList\",\"chainIdList\",\"bFactorList\",\"atomIdList\",\"altLocList\",\"occupancyList\",\"secStructList\",\"insCodeList\",\"sequenceIndexList\",\"chainNameList\",\"bondAtomList\",\"bondOrderList\"],nr=rr.concat(tr),er=\"v1.1.0dev\",ir=\"//mmtf.rcsb.org/v1.0/\",or=ir+\"full/\",ar=ir+\"reduced/\";r.encode=Q,r.decode=Y,r.traverse=K,r.fetch=$,r.fetchReduced=_,r.version=er,r.fetchUrl=or,r.fetchReducedUrl=ar,r.encodeMsgpack=o,r.encodeMmtf=R,r.decodeMsgpack=H,r.decodeMmtf=X});","module.exports = __WEBPACK_EXTERNAL_MODULE__535__;","module.exports = __WEBPACK_EXTERNAL_MODULE__698__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar defaults = {\n lines: 12,\n length: 7,\n width: 5,\n radius: 10,\n scale: 1.0,\n corners: 1,\n color: '#000',\n fadeColor: 'transparent',\n animation: 'spinner-line-fade-default',\n rotate: 0,\n direction: 1,\n speed: 1,\n zIndex: 2e9,\n className: 'spinner',\n top: '50%',\n left: '50%',\n shadow: '0 0 1px transparent', // prevent aliased lines\n position: 'absolute',\n};\nvar Spinner = /** @class */ (function () {\n function Spinner(opts) {\n if (opts === void 0) { opts = {}; }\n this.opts = __assign(__assign({}, defaults), opts);\n }\n /**\n * Adds the spinner to the given target element. If this instance is already\n * spinning, it is automatically removed from its previous target by calling\n * stop() internally.\n */\n Spinner.prototype.spin = function (target) {\n this.stop();\n this.el = document.createElement('div');\n this.el.className = this.opts.className;\n this.el.setAttribute('role', 'progressbar');\n this.el.style.position = this.opts.position;\n this.el.style.width = \"0\";\n this.el.style.zIndex = this.opts.zIndex.toString();\n this.el.style.left = this.opts.left;\n this.el.style.top = this.opts.top;\n this.el.style.transform = \"scale(\".concat(this.opts.scale, \")\");\n if (target) {\n target.insertBefore(this.el, target.firstChild || null);\n }\n drawLines(this.el, this.opts);\n return this;\n };\n /**\n * Stops and removes the Spinner.\n * Stopped spinners may be reused by calling spin() again.\n */\n Spinner.prototype.stop = function () {\n if (this.el) {\n if (this.el.parentNode) {\n this.el.parentNode.removeChild(this.el);\n }\n this.el = undefined;\n }\n return this;\n };\n return Spinner;\n}());\nexport { Spinner };\n/**\n * Returns the line color from the given string or array.\n */\nfunction getColor(color, idx) {\n return typeof color == 'string' ? color : color[idx % color.length];\n}\n/**\n * Internal method that draws the individual lines.\n */\nfunction drawLines(el, opts) {\n var borderRadius = (Math.round(opts.corners * opts.width * 500) / 1000) + 'px';\n var shadow = 'none';\n if (opts.shadow === true) {\n shadow = '0 2px 4px #000'; // default shadow\n }\n else if (typeof opts.shadow === 'string') {\n shadow = opts.shadow;\n }\n var shadows = parseBoxShadow(shadow);\n for (var i = 0; i < opts.lines; i++) {\n var degrees = ~~(360 / opts.lines * i + opts.rotate);\n var backgroundLine = document.createElement('div');\n backgroundLine.style.position = 'absolute';\n backgroundLine.style.top = \"\".concat(-opts.width / 2, \"px\");\n backgroundLine.style.width = (opts.length + opts.width) + 'px';\n backgroundLine.style.height = opts.width + 'px';\n backgroundLine.style.background = getColor(opts.fadeColor, i);\n backgroundLine.style.borderRadius = borderRadius;\n backgroundLine.style.transformOrigin = 'left';\n backgroundLine.style.transform = \"rotate(\".concat(degrees, \"deg) translateX(\").concat(opts.radius, \"px)\");\n var delay = i * opts.direction / opts.lines / opts.speed;\n delay -= 1 / opts.speed; // so initial animation state will include trail\n var line = document.createElement('div');\n line.style.width = '100%';\n line.style.height = '100%';\n line.style.background = getColor(opts.color, i);\n line.style.borderRadius = borderRadius;\n line.style.boxShadow = normalizeShadow(shadows, degrees);\n line.style.animation = \"\".concat(1 / opts.speed, \"s linear \").concat(delay, \"s infinite \").concat(opts.animation);\n backgroundLine.appendChild(line);\n el.appendChild(backgroundLine);\n }\n}\nfunction parseBoxShadow(boxShadow) {\n var regex = /^\\s*([a-zA-Z]+\\s+)?(-?\\d+(\\.\\d+)?)([a-zA-Z]*)\\s+(-?\\d+(\\.\\d+)?)([a-zA-Z]*)(.*)$/;\n var shadows = [];\n for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) {\n var shadow = _a[_i];\n var matches = shadow.match(regex);\n if (matches === null) {\n continue; // invalid syntax\n }\n var x = +matches[2];\n var y = +matches[5];\n var xUnits = matches[4];\n var yUnits = matches[7];\n if (x === 0 && !xUnits) {\n xUnits = yUnits;\n }\n if (y === 0 && !yUnits) {\n yUnits = xUnits;\n }\n if (xUnits !== yUnits) {\n continue; // units must match to use as coordinates\n }\n shadows.push({\n prefix: matches[1] || '', // could have value of 'inset' or undefined\n x: x,\n y: y,\n xUnits: xUnits,\n yUnits: yUnits,\n end: matches[8],\n });\n }\n return shadows;\n}\n/**\n * Modify box-shadow x/y offsets to counteract rotation\n */\nfunction normalizeShadow(shadows, degrees) {\n var normalized = [];\n for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) {\n var shadow = shadows_1[_i];\n var xy = convertOffset(shadow.x, shadow.y, degrees);\n normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end);\n }\n return normalized.join(', ');\n}\nfunction convertOffset(x, y, degrees) {\n var radians = degrees * Math.PI / 180;\n var sin = Math.sin(radians);\n var cos = Math.cos(radians);\n return [\n Math.round((x * cos + y * sin) * 1000) / 1000,\n Math.round((-x * sin + y * cos) * 1000) / 1000,\n ];\n}\n","//----------------------------------------------------------------------------\r\n// Timer\r\n\r\nexport default class Timer {\r\n constructor() {\r\n this.startTime = 0;\r\n this.oldTime = 0;\r\n this.elapsedTime = 0;\r\n this.running = false;\r\n }\r\n\r\n start() {\r\n this.startTime = Timer.now();\r\n this.oldTime = this.startTime;\r\n this.running = true;\r\n }\r\n\r\n stop() {\r\n this.getElapsedTime();\r\n this.running = false;\r\n }\r\n\r\n getElapsedTime() {\r\n this.update();\r\n return this.elapsedTime;\r\n }\r\n\r\n update() {\r\n let delta = 0;\r\n if (this.running) {\r\n const newTime = Timer.now();\r\n delta = 0.001 * (newTime - this.oldTime);\r\n this.oldTime = newTime;\r\n this.elapsedTime += delta;\r\n }\r\n\r\n return delta;\r\n }\r\n}\r\n\r\nTimer.now = (function () {\r\n const p = typeof window !== 'undefined' && window.performance;\r\n return (p && p.now) ? p.now.bind(p) : Date.now;\r\n}());\r\n","import Timer from '../Timer';\r\n\r\nconst { now } = Timer;\r\n\r\nfunction createElement(tag, id, css) {\r\n const element = document.createElement(tag);\r\n element.id = id;\r\n element.style.cssText = css;\r\n return element;\r\n}\r\n\r\nclass Stats {\r\n constructor() {\r\n this.domElement = createElement('div', 'stats', 'padding:8px');\r\n this._text = createElement('p', 'fps', 'margin:0;color:silver;font-size:large');\r\n this.domElement.appendChild(this._text);\r\n\r\n this._startTime = now();\r\n this._prevTime = this._startTime;\r\n\r\n this._deltas = new Array(20);\r\n this._index = 0;\r\n this._total = 0.0;\r\n this._count = 0;\r\n }\r\n\r\n end() {\r\n const time = now();\r\n const delta = time - this._startTime;\r\n\r\n if (this._count < this._deltas.length) {\r\n this._count++;\r\n } else {\r\n this._total -= this._deltas[this._index];\r\n }\r\n this._total += delta;\r\n this._deltas[this._index] = delta;\r\n this._index = (this._index + 1) % this._deltas.length;\r\n\r\n this.ms = this._total / this._count;\r\n this.fps = 1000 / this.ms;\r\n\r\n if (time > this._prevTime + 1000) {\r\n this._text.textContent = this.fps.toPrecision(2);\r\n this._prevTime = time;\r\n }\r\n\r\n return time;\r\n }\r\n\r\n update() {\r\n this._startTime = this.end();\r\n }\r\n\r\n show(on) {\r\n if (on === undefined) {\r\n on = true;\r\n }\r\n this.domElement.style.display = on ? 'block' : 'none';\r\n }\r\n}\r\n\r\nexport default Stats;\r\n","/**\r\n * This class introduces the simplest event system.\r\n */\r\n\r\nimport _ from 'lodash';\r\n\r\nfunction isUndefOrEqual(param, value) {\r\n return !param || param === value;\r\n}\r\n\r\n/**\r\n * Creates empty dispatcher.\r\n *\r\n * @exports EventDispatcher\r\n * @constructor\r\n */\r\nfunction EventDispatcher() {\r\n this._handlers = {};\r\n}\r\n\r\n/**\r\n * Binds callback on specific event type. Optional `context` parameter\r\n * could be used as 'this' for the `callback`.\r\n * @param {string} type Event name.\r\n * @param {function} callback Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.addEventListener = function (type, callback, context) {\r\n let handlers = this._handlers[type];\r\n\r\n if (!handlers) {\r\n this._handlers[type] = [];\r\n handlers = this._handlers[type];\r\n }\r\n\r\n const params = [callback, context];\r\n function _checkPar(par) {\r\n return par[0] === params[0] && par[1] === params[1];\r\n }\r\n\r\n if (_.find(handlers, _checkPar) === undefined) {\r\n handlers.push(params);\r\n }\r\n};\r\n\r\n/**\r\n * Removes a previously-bound callback function from an object.\r\n * If no `context` is specified, all versions of the `callback` with different\r\n * contexts will be removed.\r\n * If no `callback` is specified, all callbacks of the `type` will be removed.\r\n * If no `type` is specified, callbacks for all events will be removed.\r\n * @param {?string} [type] Event type.\r\n * @param {function} [callback] Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.removeEventListener = function (type, callback, context) {\r\n const self = this;\r\n _.forEach(self._handlers, (handler, ev) => {\r\n _.remove(handler, (values) => isUndefOrEqual(type, ev)\r\n && isUndefOrEqual(callback, values[0])\r\n && isUndefOrEqual(context, values[1] || self));\r\n });\r\n\r\n this._handlers = _.omitBy(self._handlers, (handler) => handler.length === 0);\r\n};\r\n\r\n/**\r\n * Makes all the callbacks for the specific `event` to trigger.\r\n * @param {Object} event Event.\r\n * @param {string} event.type Type of the event.\r\n */\r\nEventDispatcher.prototype.dispatchEvent = function (event) {\r\n const self = this;\r\n\r\n _.forEach(this._handlers[event.type], (callback) => {\r\n const context = callback[1] || self;\r\n callback[0].apply(context, [event]);\r\n });\r\n};\r\n\r\nexport default EventDispatcher;\r\n","/**\r\n * This module contains class for logging.\r\n * Returns an instance of a logger that have already been created.\r\n * Allows users to log messages for five different levels,\r\n * enable console output and catch signal on each message.\r\n */\r\nimport _ from 'lodash';\r\nimport EventDispatcher from './EventDispatcher';\r\n\r\nconst priorities = {\r\n debug: 0,\r\n info: 1,\r\n report: 2,\r\n warn: 3,\r\n error: 4,\r\n};\r\n\r\n/**\r\n * Create new Logger.\r\n *\r\n * @exports Logger\r\n * @extends EventDispatcher\r\n * @constructor\r\n */\r\nfunction Logger() {\r\n EventDispatcher.call(this);\r\n /** Boolean flag that toggles output to browser console.\r\n * @type {boolean}\r\n */\r\n this.console = false;\r\n this._priority = priorities.warn;\r\n}\r\n\r\nLogger.prototype = Object.create(EventDispatcher.prototype);\r\nLogger.prototype.constructor = Logger;\r\n\r\n/**\r\n * Create new clean instance of the logger.\r\n * @returns {Logger}\r\n */\r\nLogger.prototype.instantiate = function () {\r\n return new Logger();\r\n};\r\n\r\nfunction verify(number) {\r\n if (!_.isNumber(number)) {\r\n throw new Error('Wrong log level specified!');\r\n }\r\n return number;\r\n}\r\n\r\n/**\r\n * @property {string} current threshold for signals and console output.\r\n * @name Logger#level\r\n */\r\nObject.defineProperty(Logger.prototype, 'level', {\r\n get() {\r\n return _.findKey(priorities, (value) => value === this._priority);\r\n },\r\n set(level) {\r\n this._priority = verify(priorities[level]);\r\n },\r\n});\r\n\r\n/**\r\n * Returns the list of all possible level values.\r\n * @returns {Array}\r\n */\r\nLogger.prototype.levels = function () {\r\n return Object.keys(priorities);\r\n};\r\n\r\n/**\r\n * Add new message with specified level.\r\n * @param {string} level - level of the message, must be one of the\r\n * {'debug' | 'info' | 'report' | 'warn' | 'error'}\r\n * @param {string} message\r\n */\r\nLogger.prototype.message = function (level, message) {\r\n const priority = verify(priorities[level]);\r\n this._message(priority, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('debug', ...);\r\n * @param message\r\n */\r\nLogger.prototype.debug = function (message) {\r\n this._message(priorities.debug, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('info', ...);\r\n * @param message\r\n */\r\nLogger.prototype.info = function (message) {\r\n this._message(priorities.info, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('report', ...);\r\n * @param message\r\n */\r\nLogger.prototype.report = function (message) {\r\n this._message(priorities.report, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('warn', ...);\r\n * @param message\r\n */\r\nLogger.prototype.warn = function (message) {\r\n this._message(priorities.warn, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('error', ...);\r\n * @param message\r\n */\r\nLogger.prototype.error = function (message) {\r\n this._message(priorities.error, message);\r\n};\r\n\r\n/**\r\n * Add new message with specified priority.\r\n * @param {number} priority - priority of the message\r\n * @param {string} message\r\n * @private\r\n */\r\nLogger.prototype._message = function (priority, message) {\r\n if (priority < this._priority) {\r\n return;\r\n }\r\n const level = _.findKey(priorities, (value) => value === priority);\r\n message = String(message);\r\n if (this.console) {\r\n const output = `miew:${level}: ${message}`;\r\n if (level === 'error') {\r\n console.error(output); // NOSONAR\r\n } else if (level === 'warn') {\r\n console.warn(output); // NOSONAR\r\n } else {\r\n console.log(output); // NOSONAR\r\n }\r\n }\r\n this.dispatchEvent({ type: 'message', level, message });\r\n};\r\n\r\nexport default new Logger();\r\n","import _ from 'lodash';\r\nimport logger from './utils/logger';\r\n\r\nconst browserType = {\r\n DEFAULT: 0,\r\n SAFARI: 1,\r\n};\r\n//----------------------------------------------------------------------------\r\n// Query string\r\n\r\n/**\r\n * Escape only dangerous chars in a query string component, use a plus instead of a space.\r\n *\r\n * [RFC 3986](https://tools.ietf.org/html/rfc3986) allows the following chars in the query (see 3.4):\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! $ & ' ( ) * + , ; = : @ / ?\r\n *\r\n * For query string elements we need to escape ampersand, equal sign, and plus,\r\n * but encodeURIComponent() function encodes anything except for the following:\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! ' ( ) *\r\n *\r\n * @param {string} text - key or value to encode\r\n * @param {string} excludeExp - regexp for symbols to exclude from encoding\r\n * @returns {string} encoded string\r\n */\r\nfunction encodeQueryComponent(text, excludeExp) {\r\n const encode = (code) => String.fromCharCode(parseInt(code.substr(1), 16));\r\n return encodeURIComponent(text).replace(excludeExp, encode).replace(/%20/g, '+');\r\n}\r\n\r\n/**\r\n * Unescape dangerous chars in a query string component.\r\n *\r\n * @param {string} text - encoded key or value\r\n * @returns {string} decoded string\r\n * @see {@link encodeQueryComponent}\r\n */\r\nfunction decodeQueryComponent(text) {\r\n return decodeURIComponent(text.replace(/\\+/g, ' '));\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Array} array of (key, value) pairs.\r\n */\r\nfunction getUrlParameters(url) {\r\n url = url || window.location.search;\r\n\r\n const query = url.substring(url.indexOf('?') + 1);\r\n const search = /([^&=]+)=?([^&]*)/g;\r\n const result = [];\r\n let match;\r\n\r\n while ((match = search.exec(query)) !== null) { // eslint-disable-line no-cond-assign\r\n result.push([decodeQueryComponent(match[1]), decodeQueryComponent(match[2])]);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters as a hash.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Object}\r\n */\r\nfunction getUrlParametersAsDict(url) {\r\n const result = {};\r\n const a = getUrlParameters(url);\r\n for (let i = 0; i < a.length; ++i) {\r\n const [key, value] = a[i];\r\n result[key] = value;\r\n }\r\n return result;\r\n}\r\n\r\nfunction resolveURL(str) {\r\n if (typeof URL !== 'undefined') {\r\n try {\r\n if (typeof window !== 'undefined') {\r\n return new URL(str, window.location).href;\r\n }\r\n return new URL(str).href;\r\n } catch (error) {\r\n // IE 11 has a URL object with no constructor available so just try a different approach instead\r\n }\r\n }\r\n if (typeof document !== 'undefined') {\r\n const anchor = document.createElement('a');\r\n anchor.href = str;\r\n return anchor.href;\r\n }\r\n return str;\r\n}\r\n\r\n/**\r\n * Generates regular expression object that includes all symbols\r\n * listed in the argument\r\n * @param symbolStr {string} - String containing characters list.\r\n * @returns {RegExp} - Regular expression.\r\n */\r\nfunction generateRegExp(symbolStr) {\r\n const symbolList = [];\r\n\r\n for (let i = 0, n = symbolStr.length; i < n; ++i) {\r\n symbolList[symbolList.length] = symbolStr[i].charCodeAt(0).toString(16);\r\n }\r\n\r\n const listStr = symbolList.join('|');\r\n\r\n return new RegExp(`%(?:${listStr})`, 'gi');\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Create HTML element\r\n\r\nfunction createElement(tag, attrs, content) {\r\n const element = document.createElement(tag);\r\n let i;\r\n let n;\r\n if (attrs) {\r\n const keys = Object.keys(attrs);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n element.setAttribute(key, attrs[key]);\r\n }\r\n }\r\n if (content) {\r\n if (!(content instanceof Array)) {\r\n content = [content];\r\n }\r\n for (i = 0, n = content.length; i < n; ++i) {\r\n const child = content[i];\r\n if (typeof child === 'string') {\r\n element.appendChild(document.createTextNode(child));\r\n } else if (child instanceof HTMLElement) {\r\n element.appendChild(child);\r\n }\r\n }\r\n }\r\n return element;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Easy inheritance\r\n\r\n/**\r\n * Derive the class from the base.\r\n * @param cls {function} - Class (constructor) to derive.\r\n * @param base {function} - Class (constructor) to derive from.\r\n * @param members {object=} - Optional instance members to add.\r\n * @param statics {object=} - Optional static class members to add.\r\n * @returns {function} Original class.\r\n */\r\nfunction deriveClass(cls, base, members, statics) {\r\n cls.prototype = _.assign(Object.create(base.prototype), { constructor: cls }, members);\r\n if (statics) {\r\n _.assign(cls, statics);\r\n }\r\n return cls;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Deep prototyping\r\n\r\nfunction deriveDeep(obj, needZeroOwnProperties) {\r\n let res = obj;\r\n let i;\r\n let n;\r\n if (obj instanceof Array) {\r\n res = new Array(obj.length);\r\n for (i = 0, n = obj.length; i < n; ++i) {\r\n res[i] = deriveDeep(obj[i]);\r\n }\r\n } else if (obj instanceof Object) {\r\n res = Object.create(obj);\r\n const keys = Object.keys(obj);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = obj[key];\r\n const copy = deriveDeep(value);\r\n if (copy !== value) {\r\n res[key] = copy;\r\n }\r\n }\r\n if (needZeroOwnProperties && Object.keys(res).length > 0) {\r\n res = Object.create(res);\r\n }\r\n }\r\n return res;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Colors\r\n\r\nfunction hexColor(color) {\r\n const hex = (`0000000${color.toString(16)}`).substr(-6);\r\n return `#${hex}`;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Debug tracing\r\n\r\nfunction DebugTracer(namespace) {\r\n let enabled = false;\r\n\r\n this.enable = function (on) {\r\n enabled = on;\r\n };\r\n\r\n let indent = 0;\r\n const methods = Object.keys(namespace);\r\n\r\n function wrap(method_, name_) {\r\n return function (...args) {\r\n const spaces = DebugTracer.spaces.substr(0, indent * 2);\r\n if (enabled) {\r\n logger.debug(`${spaces + name_} {`);\r\n }\r\n indent++;\r\n const result = method_.apply(this, args); // eslint-disable-line no-invalid-this\r\n indent--;\r\n if (enabled) {\r\n logger.debug(`${spaces}} // ${name_}`);\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n for (let i = 0, n = methods.length; i < n; ++i) {\r\n const name = methods[i];\r\n const method = namespace[name];\r\n if (method instanceof Function && name !== 'constructor') {\r\n namespace[name] = wrap(method, name);\r\n }\r\n }\r\n}\r\n\r\nDebugTracer.spaces = ' ';\r\n\r\nclass OutOfMemoryError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'OutOfMemoryError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction allocateTyped(TypedArrayName, size) {\r\n let result = null;\r\n try {\r\n result = new TypedArrayName(size);\r\n } catch (e) {\r\n if (e instanceof RangeError) {\r\n throw new OutOfMemoryError(e.message);\r\n } else {\r\n throw e;\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Float array conversion\r\n\r\nfunction bytesToBase64(/** ArrayBuffer */ buffer) {\r\n const bytes = new Uint8Array(buffer);\r\n let binary = '';\r\n for (let i = 0; i < bytes.byteLength; i++) {\r\n binary += String.fromCharCode(bytes[i]);\r\n }\r\n return window.btoa(binary);\r\n}\r\n\r\nfunction bytesFromBase64(/** string */ str) {\r\n const binary = window.atob(str);\r\n const bytes = new Uint8Array(binary.length);\r\n for (let i = 0; i < bytes.length; ++i) {\r\n bytes[i] = binary[i].charCodeAt(0);\r\n }\r\n return bytes.buffer;\r\n}\r\n\r\nfunction arrayToBase64(/** number[] */ array, /** function */ TypedArrayClass) {\r\n return bytesToBase64(new TypedArrayClass(array).buffer);\r\n}\r\n\r\nfunction arrayFromBase64(/** string */ str, /** function */ TypedArrayClass) {\r\n return Array.prototype.slice.call(new TypedArrayClass(bytesFromBase64(str)));\r\n}\r\n\r\n// NOTE: this is 1-level comparison\r\nfunction compareOptionsWithDefaults(opts, defOpts) {\r\n const optsStr = [];\r\n if (defOpts && opts) {\r\n const keys = Object.keys(opts);\r\n for (let p = 0; p < keys.length; ++p) {\r\n const key = keys[p];\r\n const value = opts[key];\r\n // TODO add processing for tree structure\r\n if (!(value instanceof Object) && typeof defOpts[key] !== 'undefined' && defOpts[key] !== value) {\r\n optsStr.push(`${key}:${value}`);\r\n }\r\n }\r\n if (optsStr.length > 0) {\r\n return `!${optsStr.join()}`;\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nfunction isAlmostPlainObject(o) {\r\n if (_.isPlainObject(o)) {\r\n return true;\r\n }\r\n const proto = o && Object.getPrototypeOf(o);\r\n return !!proto && !proto.hasOwnProperty('constructor') && isAlmostPlainObject(proto);\r\n}\r\n\r\n/**\r\n * Build an object that contains properties (and subproperties) of `src` different from those\r\n * in `dst`. Objects are parsed recursively, other values (including arrays) are compared for\r\n * equality using `_.isEqual()`.\r\n * @param {!object} src - a new object to compare, may contain changed or new properties\r\n * @param {!object} dst - an old reference object\r\n */\r\nfunction objectsDiff(src, dst) {\r\n const diff = {};\r\n _.forIn(src, (srcValue, key) => {\r\n const dstValue = dst[key];\r\n if (isAlmostPlainObject(srcValue) && isAlmostPlainObject(dstValue)) {\r\n const deepDiff = objectsDiff(srcValue, dstValue);\r\n if (!_.isEmpty(deepDiff)) {\r\n diff[key] = deepDiff;\r\n }\r\n } else if (!_.isEqual(srcValue, dstValue)) {\r\n diff[key] = srcValue;\r\n }\r\n });\r\n return diff;\r\n}\r\n\r\nfunction forInRecursive(object, callback) {\r\n function iterateThrough(obj, prefix) {\r\n _.forIn(obj, (value, key) => {\r\n const newPref = prefix + (prefix.length > 0 ? '.' : '');\r\n if (value instanceof Object) {\r\n iterateThrough(value, newPref + key);\r\n } else if (value !== undefined) {\r\n callback(value, newPref + key);\r\n }\r\n });\r\n }\r\n iterateThrough(object, '');\r\n}\r\n\r\nfunction enquoteString(value) {\r\n if (_.isString(value)) {\r\n return `\"${value.replace(/\"/g, '\\\\\"')}\"`;\r\n }\r\n return value;\r\n}\r\n\r\nfunction unquoteString(value) {\r\n if (!_.isString(value)) {\r\n return value;\r\n }\r\n if (value[0] === '\"' && value[value.length - 1] === '\"') {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\\"/g, '\"');\r\n }\r\n if (value[0] === \"'\" && value[value.length - 1] === \"'\") {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\'/g, \"'\");\r\n }\r\n throw new SyntaxError('Incorrect string format, can\\'t unqute it');\r\n}\r\n\r\nfunction getFileExtension(fileName) {\r\n return fileName.slice((Math.max(0, fileName.lastIndexOf('.')) || Infinity));\r\n}\r\n\r\nfunction splitFileName(fileName) {\r\n const ext = getFileExtension(fileName);\r\n const name = fileName.slice(0, fileName.length - ext.length);\r\n return [name, ext];\r\n}\r\n\r\nfunction dataUrlToBlob(url) {\r\n const parts = url.split(/[:;,]/);\r\n const partsCount = parts.length;\r\n if (partsCount >= 3 && parts[partsCount - 2] === 'base64') {\r\n return new Blob([bytesFromBase64(parts[partsCount - 1])]);\r\n }\r\n return null;\r\n}\r\n\r\nfunction getBrowser() {\r\n if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1\r\n && navigator.userAgent\r\n && navigator.userAgent.indexOf('CriOS') === -1\r\n && navigator.userAgent.indexOf('FxiOS') === -1) {\r\n return browserType.SAFARI;\r\n }\r\n return browserType.DEFAULT;\r\n}\r\n\r\nfunction shotOpen(url) {\r\n if (typeof window !== 'undefined') {\r\n window.open().document.write(``);\r\n }\r\n}\r\n\r\nfunction shotDownload(dataUrl, filename) {\r\n if (!dataUrl || dataUrl.substr(0, 5) !== 'data:') {\r\n return;\r\n }\r\n if (!filename) {\r\n filename = ['screenshot-', +new Date(), '.png'].join('');\r\n }\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(dataUrlToBlob(dataUrl), filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(dataUrlToBlob(dataUrl));\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction download(data, filename, type) {\r\n const blobData = new Blob([data]);\r\n\r\n if (!filename) {\r\n filename = ['data', +new Date()].join('');\r\n }\r\n\r\n if (!type) {\r\n filename += blobData.type || '.bin';\r\n } else {\r\n filename += `.${type}`;\r\n }\r\n\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(blobData, filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(blobData);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction copySubArrays(src, dst, indices, itemSize) {\r\n for (let i = 0, n = indices.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n dst[i * itemSize + j] = src[indices[i] * itemSize + j];\r\n }\r\n }\r\n}\r\n\r\nfunction shallowCloneNode(node) {\r\n const newNode = node.cloneNode(true);\r\n newNode.worldPos = node.worldPos;\r\n // .style property is readonly, so \"newNode.style = node.style;\" won't work (and we don't need it, right?)\r\n return newNode;\r\n}\r\n\r\nconst unquotedStringRE = /^[a-zA-Z0-9_]*$/;\r\nconst enquoteHelper = ['\"', '', '\"'];\r\n\r\n// verify and correct if needed selctor identifier\r\nfunction correctSelectorIdentifier(value) {\r\n if (unquotedStringRE.test(value)) {\r\n return value;\r\n }\r\n // quote incorrect identifier\r\n enquoteHelper[1] = value;\r\n return enquoteHelper.join('');\r\n}\r\n\r\n/**\r\n * Concatenates two TypedArray. Doesn't check null refs o type equality\r\n * Attention! It must be use very rarely because requires memory reallocation every time. Use MergeTypedArraysUnsafe to\r\n * unite array of subarrays.\r\n * @param{TypedArray} first - destination array\r\n * @param{TypedArray} second - source array\r\n * @returns{TypedArray} resulting concatenated array\r\n */\r\nfunction concatTypedArraysUnsafe(first, second) {\r\n const result = new first.constructor(first.length + second.length);\r\n result.set(first);\r\n result.set(second, first.length);\r\n return result;\r\n}\r\n\r\n/**\r\n * Merges array of TypedArray into TypedArray. Doesn't check null refs o type equality\r\n * @param{array} array - source array of subarrays\r\n * @returns{TypedArray} resulting merged array\r\n */\r\nfunction mergeTypedArraysUnsafe(array) {\r\n if (array.length <= 0) {\r\n return null;\r\n }\r\n // count the size\r\n const size = array.reduce((acc, cur) => acc + cur.length, 0);\r\n // create combined array\r\n const result = new array[0].constructor(size);\r\n for (let i = 0, start = 0; i < array.length; i++) {\r\n const count = array[i].length;\r\n result.set(array[i], start);\r\n start += count;\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Exports\r\n\r\nexport default {\r\n browserType,\r\n encodeQueryComponent,\r\n decodeQueryComponent,\r\n getUrlParameters,\r\n getUrlParametersAsDict,\r\n resolveURL,\r\n generateRegExp,\r\n createElement,\r\n deriveClass,\r\n deriveDeep,\r\n hexColor,\r\n DebugTracer,\r\n OutOfMemoryError,\r\n allocateTyped,\r\n bytesFromBase64,\r\n bytesToBase64,\r\n arrayFromBase64,\r\n arrayToBase64,\r\n compareOptionsWithDefaults,\r\n objectsDiff,\r\n forInRecursive,\r\n enquoteString,\r\n unquoteString,\r\n getBrowser,\r\n shotOpen,\r\n shotDownload,\r\n copySubArrays,\r\n shallowCloneNode,\r\n correctSelectorIdentifier,\r\n getFileExtension,\r\n splitFileName,\r\n download,\r\n concatTypedArraysUnsafe,\r\n mergeTypedArraysUnsafe,\r\n};\r\n","import EventDispatcher from './EventDispatcher';\r\n\r\nexport default class JobHandle extends EventDispatcher {\r\n constructor() {\r\n super();\r\n this._shouldCancel = false;\r\n }\r\n\r\n cancel() {\r\n this._shouldCancel = true;\r\n this.dispatchEvent({ type: 'cancel' });\r\n }\r\n\r\n shouldCancel() {\r\n return this._shouldCancel;\r\n }\r\n\r\n // slaves use this to notify master about their events\r\n // master routes these notifications to a single event slot\r\n notify(event) {\r\n this.dispatchEvent({ type: 'notification', slaveEvent: event });\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport utils from './utils';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\n\r\nconst VERSION = 0;\r\n\r\n//----------------------------------------------------------------------------\r\n// DEFAULT SETTINGS\r\n//----------------------------------------------------------------------------\r\n\r\n/**\r\n * Polygonal complexity settings.\r\n *\r\n * @typedef PolyComplexity\r\n * @property {number} poor\r\n * @property {number} low\r\n * @property {number} medium\r\n * @property {number} high\r\n * @property {number} ultra\r\n */\r\n\r\n/**\r\n * @alias SettingsObject\r\n * @namespace\r\n */\r\nconst defaults = {\r\n /**\r\n * Default options for all available modes.\r\n * Use {@link Mode.id} as a dictionary key to access mode options.\r\n *\r\n * Usually you don't need to override these settings. You may specify mode options as a parameter during\r\n * {@link Mode} construction.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {LinesModeOptions} LN - Lines mode options.\r\n * @property {LicoriceModeOptions} LC - Licorice mode options.\r\n * @property {BallsAndSticksModeOptions} BS - Balls and Sticks mode options.\r\n * @property {VanDerWaalsModeOptions} VW - Van der Waals mode options.\r\n * @property {TraceModeOptions} TR - Trace mode options.\r\n * @property {TubeModeOptions} TU - Tube mode options.\r\n * @property {CartoonModeOptions} CA - Cartoon mode options.\r\n * @property {QuickSurfaceModeOptions} QS - Contact Surface mode options.\r\n * @property {IsoSurfaceSASModeOptions} SA - Solvent Accessible Surface mode options.\r\n * @property {IsoSurfaceSESModeOptions} SE - Solvent Excluded Surface mode options.\r\n * @property {ContactSurfaceModeOptions} CS - Contact Surface mode options.\r\n * @property {TextModeOptions} TX - Text mode options.\r\n * @property {VolumeDensityModeOptions} VD - Volume Density mode options.\r\n */\r\n modes: {\r\n //----------------------------------------------------------------------------\r\n // BALLS AND STICKS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Balls and Sticks mode options.\r\n *\r\n * @typedef BallsAndSticksModeOptions\r\n *\r\n * @property {number} atom - Sphere radius as a fraction of Van der Waals atom radius.\r\n * @property {number} bond - Cylinder radius in angstroms.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n BS: {\r\n atom: 0.23,\r\n bond: 0.15,\r\n space: 0.5,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VAN DER WAALS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Van der Waals mode options.\r\n *\r\n * @typedef VanDerWaalsModeOptions\r\n *\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VW: {\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 8,\r\n high: 16,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LINES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Lines mode options.\r\n *\r\n * @typedef LinesModeOptions\r\n *\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {number} offsarom - Offset between bonds and aromatic cycle.\r\n * @property {number} chunkarom - Number of pieces in a-loop arc, corresponding to atom.\r\n * @property {number} atom - Collision radius for atoms picking.\r\n * @property {number} lineWidth - Line width in pixels (not used in thin lines).\r\n */\r\n LN: {\r\n multibond: true,\r\n showarom: true,\r\n offsarom: 0.2,\r\n chunkarom: 10,\r\n atom: 0.23,\r\n lineWidth: 2,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LICORICE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Licorice mode options.\r\n *\r\n * @typedef LicoriceModeOptions\r\n *\r\n * @property {number} bond - Bond cylinder radius.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Poly complexity values for render modes.\r\n */\r\n LC: {\r\n bond: 0.20,\r\n space: 0.0,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SAS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Accessible Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSASModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SA: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Excluded Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSESModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SE: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // QUICK SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Quick Surface mode options.\r\n *\r\n * @typedef QuickSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} scale - Radius scale for the surface being built.\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} gaussLim - Gauss lim for coloring the bigger the value, the smoother our colors are.\r\n * @property {PolyComplexity} gridSpacing - Poly complexity values for render modes. In this case the value\r\n * corresponds to the grid density.\r\n */\r\n QS: {\r\n isoValue: 0.5,\r\n gaussLim: {\r\n poor: 1.5,\r\n low: 2.0,\r\n medium: 2.5,\r\n high: 3.0,\r\n ultra: 4.0,\r\n },\r\n scale: 1.0,\r\n wireframe: false,\r\n gridSpacing: {\r\n poor: 2,\r\n low: 1.5,\r\n medium: 1,\r\n high: 0.5,\r\n ultra: 0.25,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CONTACT SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Contact Surface mode options.\r\n *\r\n * @typedef ContactSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} probeRadius - Probe radius.\r\n * @property {number} probePositions\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Radius scale for the surface being built.\r\n * Poly complexity values for render modes. In this case the value corresponds to the grid density.\r\n */\r\n CS: {\r\n probeRadius: 1.4,\r\n isoValue: 1.5,\r\n wireframe: false,\r\n probePositions: 30,\r\n polyComplexity: {\r\n poor: 0.5,\r\n low: 1.0,\r\n medium: 1.5,\r\n high: 1.75,\r\n ultra: 2.0,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TRACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Trace mode options.\r\n *\r\n * @typedef TraceModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n TR: {\r\n radius: 0.30,\r\n polyComplexity: {\r\n poor: 12,\r\n low: 16,\r\n medium: 32,\r\n high: 64,\r\n ultra: 64,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TUBE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Tube mode options.\r\n *\r\n * @typedef TubeModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {number} tension - Tension for interpolation.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n TU: {\r\n radius: 0.30,\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CARTOON\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Cartoon mode options.\r\n *\r\n * @typedef CartoonModeOptions\r\n *\r\n * @property {number} radius - Standard tube radius.\r\n * @property {number} depth - Height of the secondary structure ribbon.\r\n * @property {number} tension - Tension for interpolation.\r\n * @proprety {object} ss - Secondary structure parameters.\r\n * @proprety {object} ss.helix - Options for helices render.\r\n * @proprety {number} ss.helix.width - Width of the secondary structure ribbon.\r\n * @proprety {number} ss.helix.arrow - Secondary structure's arrow width.\r\n * @proprety {object} ss.strand - Options for strands render.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * polyComplexity must be even for producing symmetric arrows.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n CA: {\r\n radius: 0.30,\r\n depth: 0.25,\r\n ss: {\r\n helix: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n strand: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n },\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TEXT\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Text mode options.\r\n *\r\n * @typedef TextModeOptions\r\n *\r\n * @property {string} template - Format string for building output text.\r\n * @property {string} horizontalAlign - Text alignment ('left', 'right', 'center').\r\n * @property {string} verticalAlign - Vertical text box alignment ('top', 'bottom', 'middle').\r\n * @property {number} dx - Text offset x in angstroms.\r\n * @property {number} dy - Text offset y in angstroms.\r\n * @property {number} dz - Text offset z in angstroms.\r\n * @property {string} fg - Color rule for foreground.\r\n * @property {string} bg - Color rule for background.\r\n * @property {boolean} showBg - Flag, that toggles background rendering.\r\n *\r\n */\r\n TX: {\r\n template: '{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}',\r\n horizontalAlign: 'center',\r\n verticalAlign: 'middle',\r\n dx: 0,\r\n dy: 0,\r\n dz: 1,\r\n fg: 'none',\r\n bg: '0x202020',\r\n showBg: true,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VOLUME DENSITY\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Volume density mode options.\r\n *\r\n * @typedef VolumeDensityModeOptions\r\n *\r\n * @property {number} kSigma - Noise threshold coefficient.\r\n * @property {boolean} frame - flag, that turns on box frame painting.\r\n * @property {boolean} isoMode - flag, that turns on IsoSurface mode instead of Volume Rendering.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VD: {\r\n kSigma: 1.0,\r\n kSigmaMed: 2.0,\r\n kSigmaMax: 4.0,\r\n frame: true,\r\n isoMode: false,\r\n polyComplexity: {\r\n poor: 2,\r\n low: 3,\r\n medium: 4,\r\n high: 8,\r\n ultra: 10,\r\n },\r\n },\r\n },\r\n\r\n /**\r\n * Default options for all available colorers.\r\n * Use {@link Colorer.id} as a dictionary key to access colorer options.\r\n *\r\n * Usually you don't need to override these settings. You may specify colorer options as a parameter during\r\n * {@link Colorer} construction.\r\n *\r\n * Not all colorers have options.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {ElementColorerOptions} EL - Element colorer options.\r\n * @property {SequenceColorerOptions} SQ - Sequence colorer options.\r\n * @property {MoleculeColorerOptions} MO - Molecule colorer options.\r\n * @property {UniformColorerOptions} UN - Uniform colorer options.\r\n * @property {ConditionalColorerOptions} CO - Conditional colorer options.\r\n * @property {TemperatureColorerOptions} TM - Temperature colorer options.\r\n * @property {OccupancyColorerOptions} OC - Occupancy colorer options.\r\n * @property {HydrophobicityColorerOptions} HY - Hydrophobicity colorer options.\r\n */\r\n colorers: {\r\n /**\r\n * Element colorer options.\r\n *\r\n * @typedef ElementColorerOptions\r\n *\r\n * @property {number} carbon - Carbon color or -1 to use default.\r\n */\r\n EL: {\r\n carbon: -1,\r\n },\r\n\r\n /**\r\n * Uniform colorer options.\r\n *\r\n * @typedef UniformColorerOptions\r\n *\r\n * @property {number} color - Single color to paint with.\r\n */\r\n UN: {\r\n color: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Conditional colorer options.\r\n *\r\n * @typedef ConditionalColorerOptions\r\n *\r\n * @property {string} subset - Selector string.\r\n * @property {number} color - Color of selected atoms.\r\n * @property {number} baseColor - Color of other atoms.\r\n */\r\n CO: {\r\n subset: 'charged',\r\n color: 0xFF0000,\r\n baseColor: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Carbon colorer options.\r\n *\r\n * @typedef CarbonColorerOptions\r\n *\r\n * @property {number} color - Single color to paint carbons\r\n * @property {number} factor - Color factor for not carbon atoms.\r\n */\r\n CB: {\r\n color: 0x909090,\r\n factor: 0.6,\r\n },\r\n\r\n /**\r\n * Sequence colorer options.\r\n *\r\n * @typedef SequenceColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n SQ: {\r\n gradient: 'rainbow',\r\n },\r\n\r\n /**\r\n * Temperature colorer options.\r\n *\r\n * @typedef TemperatureColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n * @property {number} min - Minimal temperature.\r\n * @property {number} max - Maximal temperature.\r\n */\r\n TM: {\r\n gradient: 'temp',\r\n min: 5,\r\n max: 40,\r\n },\r\n\r\n /**\r\n * Occupancy colorer options.\r\n *\r\n * @typedef OccupancyColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n OC: {\r\n gradient: 'reds',\r\n },\r\n\r\n /**\r\n * Hydrophobicity colorer options.\r\n *\r\n * @typedef HydrophobicityColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n HY: {\r\n gradient: 'blue-red',\r\n },\r\n\r\n /**\r\n * Molecule colorer options.\r\n *\r\n * @typedef MoleculeColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n MO: {\r\n gradient: 'rainbow',\r\n },\r\n },\r\n\r\n /*\r\n * Use antialiasing in WebGL.\r\n * @type {boolean}\r\n */\r\n antialias: true,\r\n\r\n /*\r\n * Camera field of view in degrees.\r\n * @type {number}\r\n */\r\n camFov: 45.0,\r\n\r\n /*\r\n * Camera near plane distance.\r\n * @type {number}\r\n */\r\n camNear: 0.5,\r\n\r\n /*\r\n * Camera far plane distance.\r\n * @type {number}\r\n */\r\n camFar: 100.0,\r\n\r\n camDistance: 2.5,\r\n\r\n radiusToFit: 1.0,\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogNearFactor: 0.5, // [0, 1]\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogFarFactor: 1, // [0, 1]\r\n fogAlpha: 1.0,\r\n fogColor: 0x000000,\r\n fogColorEnable: false,\r\n\r\n /**\r\n * Palette used for molecule coloring.\r\n * @type {string}\r\n */\r\n palette: 'JM',\r\n\r\n /*\r\n * Geometry resolution.\r\n * @type {string}\r\n */\r\n resolution: 'medium',\r\n\r\n autoResolution: false/* true */,\r\n\r\n autoPreset: true,\r\n\r\n preset: 'default', // TODO: remove 'preset' from settings, implement autodetection\r\n\r\n presets: {\r\n // Default\r\n default: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n empty: [],\r\n\r\n // Wireframe\r\n wire: [{\r\n mode: 'LN',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Small molecules\r\n small: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Proteins, nucleic acids etc.\r\n macro: [{\r\n mode: 'CA',\r\n colorer: 'SS',\r\n selector: 'not hetatm',\r\n material: 'SF',\r\n }, {\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'hetatm and not water',\r\n material: 'SF',\r\n }],\r\n },\r\n\r\n objects: {\r\n line: {\r\n color: 0xFFFFFFFF,\r\n dashSize: 0.3,\r\n gapSize: 0.05,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n\r\n bg: {\r\n color: 0x202020,\r\n transparent: false,\r\n },\r\n\r\n draft: {\r\n clipPlane: false,\r\n clipPlaneFactor: 0.5,\r\n clipPlaneSpeed: 0.00003,\r\n },\r\n\r\n /*\r\n * Separate group for plugins.\r\n * Each plugin handles its field by itself.\r\n */\r\n plugins: {\r\n\r\n },\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n axes: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fog: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fps: true,\r\n\r\n /**\r\n * Switch using of z-sprites for sphere and cylinder geometry\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zSprites: true,\r\n\r\n isoSurfaceFakeOpacity: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n suspendRender: true,\r\n\r\n nowater: false,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autobuild: true,\r\n\r\n /**\r\n * Anti-aliasing.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fxaa: true,\r\n /**\r\n * Outline depths\r\n * @type {boolean}\r\n * @instance\r\n */\r\n outline: {\r\n on: false,\r\n color: 0x000000,\r\n threshold: 0.1,\r\n thickness: 1,\r\n },\r\n\r\n /**\r\n * Ambient Occlusion special effect.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n ao: false,\r\n\r\n /**\r\n * Shadows options.\r\n *\r\n * @property {boolean} shadowMap - enable/disable.\r\n * @property {string} basic/percentage-closer filtering/non-uniform randomizing pcf.\r\n * @property {number} radius for percentage-closer filtering.\r\n */\r\n shadow: {\r\n on: false,\r\n type: 'random'/* basic, pcf, random */,\r\n radius: 1.0,\r\n },\r\n\r\n /**\r\n * Auto-rotation with constant speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n autoRotation: 0.0,\r\n\r\n /**\r\n * Set maximum fps for animation.\r\n * @type {number}\r\n * @instance\r\n */\r\n maxfps: 30,\r\n\r\n /**\r\n * Set fbx output precision.\r\n * @type {number}\r\n * @instance\r\n */\r\n fbxprec: 4,\r\n\r\n /**\r\n * Auto-rotation axis.\r\n *\r\n * - true: complex auto-rotation is about vertical axis\r\n * - false: rotation axis is defined by last user rotation\r\n *\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autoRotationAxisFixed: true,\r\n\r\n /**\r\n * Enable zooming with mouse wheel or pinch gesture.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zooming: true,\r\n\r\n /**\r\n * Enable picking atoms & residues with left mouse button or touch.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n picking: true,\r\n\r\n /**\r\n * Set picking mode ('atom', 'residue', 'chain', 'molecule').\r\n * @type {string}\r\n * @instance\r\n */\r\n pick: 'atom',\r\n\r\n /**\r\n * Make \"component\" and \"fragment\" editing modes available.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n editing: false,\r\n\r\n /**\r\n * Detect aromatic loops.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n aromatic: false,\r\n\r\n /**\r\n * Load only one biological unit from all those described in PDB file.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n singleUnit: true,\r\n\r\n /**\r\n * Set stereo mode ('NONE', 'SIMPLE', 'DISTORTED', 'ANAGLYPH', 'WEBVR').\r\n * @type {string}\r\n * @instance\r\n */\r\n stereo: 'NONE',\r\n\r\n /**\r\n * Enable smooth transition between views\r\n * @type {boolean}\r\n * @instance\r\n */\r\n interpolateViews: true,\r\n\r\n /**\r\n * Set transparency mode ('standard', 'prepass').\r\n * @type {string}\r\n * @instance\r\n */\r\n transparency: 'prepass',\r\n\r\n /**\r\n * Mouse translation speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n translationSpeed: 2,\r\n\r\n debug: {\r\n example: 3.5,\r\n text: 'hello!',\r\n good: true,\r\n ssaoKernelRadius: 0.7,\r\n ssaoFactor: 0.7,\r\n stereoBarrel: 0.25,\r\n },\r\n use: {\r\n multiFile: false,\r\n },\r\n};\r\n\r\n//----------------------------------------------------------------------------\r\n// SETTINGS CLASS\r\n//----------------------------------------------------------------------------\r\n\r\nfunction Settings() {\r\n EventDispatcher.call(this);\r\n\r\n this.old = null;\r\n this.now = {};\r\n this._changed = {};\r\n\r\n this.reset();\r\n}\r\n\r\nutils.deriveClass(Settings, EventDispatcher, {\r\n defaults,\r\n\r\n set(path, value) {\r\n if (_.isString(path)) {\r\n const oldValue = _.get(this.now, path);\r\n if (oldValue !== value) {\r\n _.set(this.now, path, value);\r\n this._notifyChange(path, value);\r\n }\r\n } else {\r\n const diff = utils.objectsDiff(path, this.now);\r\n if (!_.isEmpty(diff)) {\r\n _.merge(this.now, diff);\r\n this._notifyChanges(diff);\r\n }\r\n }\r\n },\r\n\r\n get(path, defaultValue) {\r\n return _.get(this.now, path, defaultValue);\r\n },\r\n\r\n reset() {\r\n const diff = utils.objectsDiff(defaults, this.now);\r\n this.now = _.cloneDeep(defaults);\r\n this.old = null;\r\n this._notifyChanges(diff);\r\n this._changed = {};\r\n },\r\n\r\n checkpoint() {\r\n this.old = _.cloneDeep(this.now);\r\n this._changed = {};\r\n },\r\n\r\n _notifyChange(path, value) {\r\n this._changed[path] = true;\r\n this.dispatchEvent({ type: `change:${path}`, value });\r\n },\r\n\r\n _notifyChanges(diff) {\r\n utils.forInRecursive(diff, (deepValue, deepPath) => {\r\n this._notifyChange(deepPath, deepValue);\r\n });\r\n },\r\n\r\n changed() {\r\n if (!this.old) {\r\n return [];\r\n }\r\n const { old, now } = this;\r\n const keys = _.filter(Object.keys(this._changed), (key) => _.get(old, key) !== _.get(now, key));\r\n return keys;\r\n },\r\n\r\n applyDiffs(diffs) {\r\n if (diffs.hasOwnProperty('VERSION') && diffs.VERSION !== VERSION) {\r\n throw new Error('Settings version does not match!');\r\n }\r\n // VERSION shouldn't be presented inside settings structure\r\n delete diffs.VERSION;\r\n this.reset();\r\n this.set(diffs);\r\n },\r\n\r\n getDiffs(versioned) {\r\n const diffs = utils.objectsDiff(this.now, defaults);\r\n if (versioned) {\r\n diffs.VERSION = VERSION;\r\n }\r\n return diffs;\r\n },\r\n\r\n setPluginOpts(plugin, opts) {\r\n defaults.plugins[plugin] = _.cloneDeep(opts);\r\n this.now.plugins[plugin] = _.cloneDeep(opts);\r\n },\r\n});\r\n\r\nexport default new Settings();\r\n","import _ from 'lodash';\r\nimport settings from './settings';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\n\r\nlet repIndex = 0;\r\n\r\nfunction asBoolean(value) {\r\n return !(!value || value === '0' || (_.isString(value) && value.toLowerCase() === 'false'));\r\n}\r\n\r\nconst adapters = {\r\n string: String,\r\n number: Number,\r\n boolean: asBoolean,\r\n};\r\n\r\n// Level 1 assignment symbol\r\nconst cL1Ass = '=';\r\n\r\nconst cOptsSep = '!';\r\n// Level 2 (options) assignment symbol\r\nconst cL2Ass = ':';\r\n// Level 2 (options) separator symbol\r\nconst cLSep = ',';\r\n\r\nconst cCommonIgnoreSymbols = '$;@/?';\r\n/**\r\n * We may (and should) leave as is for better readability:\r\n *\r\n * $ , ; : @ / ?\r\n */\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n */\r\nfunction getLevel1ExcludedExpr() {\r\n const cLevel1Ignores = ':,';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel1Ignores);\r\n}\r\n\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n * (options, etc, ..)\r\n */\r\nfunction getLevel2ExcludedExpr() {\r\n const cLevel2Ignores = ' ';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel2Ignores);\r\n}\r\n\r\nconst cL1ExclExpr = getLevel1ExcludedExpr();\r\nfunction encodeQueryComponentL1(value) {\r\n return utils.encodeQueryComponent(value, cL1ExclExpr);\r\n}\r\n\r\nconst cL2ExclExpr = getLevel2ExcludedExpr();\r\nfunction encodeQueryComponentL2(value) {\r\n return utils.encodeQueryComponent(value, cL2ExclExpr);\r\n}\r\n\r\nfunction ensureRepList(opts) {\r\n let { reps } = opts;\r\n if (!reps) {\r\n const { presets } = settings.now;\r\n let preset = opts.preset || settings.now.preset;\r\n reps = presets[preset];\r\n if (!reps) {\r\n logger.warn(`Unknown preset \"${preset}\"`);\r\n [preset] = Object.keys(presets);\r\n reps = presets[preset]; // fall back to any preset\r\n }\r\n opts.preset = preset;\r\n opts.reps = utils.deriveDeep(reps, true);\r\n }\r\n}\r\n\r\nfunction ensureRepAssign(opts, prop, value) {\r\n ensureRepList(opts);\r\n const rep = opts.reps[repIndex];\r\n // prop specified twice therefore start new rep by cloning the current\r\n if (rep.hasOwnProperty(prop)) {\r\n repIndex = opts.reps.length;\r\n opts.reps[repIndex] = utils.deriveDeep(rep, true);\r\n }\r\n if (value !== undefined) {\r\n opts.reps[repIndex][prop] = value;\r\n }\r\n}\r\n\r\nfunction addObject(opts, params, options) {\r\n if (opts._objects === undefined) {\r\n opts._objects = [];\r\n }\r\n\r\n const [type, newOpts] = options;\r\n const newObj = {\r\n type,\r\n params,\r\n };\r\n\r\n if (newOpts !== undefined) {\r\n newObj.opts = newOpts;\r\n }\r\n\r\n opts._objects[opts._objects.length] = newObj;\r\n}\r\n\r\nfunction parseParams(str, params) {\r\n const sep = str.indexOf(',');\r\n if (sep >= 0) {\r\n params.push(str.substr(sep + 1).split(','));\r\n return str.substr(0, sep);\r\n }\r\n // keep this untouched if no params were extracted\r\n return str;\r\n}\r\n\r\nfunction extractArgs(input, defaultsDict, params) {\r\n if (input) {\r\n const bang = input.indexOf(cOptsSep);\r\n const inputVal = parseParams(input.substr(0, bang >= 0 ? bang : undefined), params);\r\n if (bang >= 0) {\r\n const args = input.substr(bang + 1).split(cLSep);\r\n input = inputVal;\r\n if (defaultsDict) {\r\n const defaults = defaultsDict[input];\r\n const opts = utils.deriveDeep(defaults, true);\r\n args.forEach((arg) => {\r\n const pair = arg.split(cL2Ass, 2);\r\n const key = decodeURIComponent(pair[0]);\r\n const value = decodeURIComponent(pair[1]);\r\n const adapter = adapters[typeof _.get(defaults, key)];\r\n if (adapter) {\r\n _.set(opts, key, adapter(value));\r\n } else {\r\n logger.warn(`Unknown argument \"${key}\" for option \"${input}\"`);\r\n }\r\n });\r\n if (Object.keys(opts).length > 0) {\r\n input = [input, opts];\r\n }\r\n }\r\n } else {\r\n input = inputVal;\r\n }\r\n }\r\n return input;\r\n}\r\n\r\nconst actions = {\r\n\r\n l: 'load',\r\n load: String,\r\n t: 'type',\r\n type: String,\r\n v: 'view',\r\n view: String,\r\n u: 'unit',\r\n unit: Number,\r\n menu: asBoolean,\r\n\r\n // Commands\r\n\r\n o: 'object',\r\n object(value, opts) {\r\n const params = [];\r\n let options = extractArgs(value, settings.defaults.objects, params);\r\n if (!Array.isArray(options)) {\r\n options = [options];\r\n }\r\n addObject(opts, params[0], options);\r\n },\r\n\r\n p: 'preset',\r\n preset(value, opts) {\r\n opts.preset = value;\r\n opts.reps = null;\r\n ensureRepList(opts);\r\n },\r\n\r\n r: 'rep',\r\n rep(value, opts) {\r\n ensureRepList(opts);\r\n repIndex = Number(value);\r\n // clamp the index to one greater than the last\r\n repIndex = repIndex <= opts.reps.length ? (repIndex < 0 ? 0 : repIndex) : opts.reps.length;\r\n // create a new rep if it is adjacent to the existing ones\r\n if (repIndex === opts.reps.length) {\r\n // if there is no rep to derive from, derive from the first rep of the default\r\n opts.reps[repIndex] = repIndex > 0 ? utils.deriveDeep(opts.reps[repIndex - 1], true)\r\n : utils.deriveDeep(settings.defaults.presets.default[0], true);\r\n }\r\n },\r\n\r\n s: 'select',\r\n select(value, opts) {\r\n ensureRepAssign(opts, 'selector', value);\r\n },\r\n\r\n m: 'mode',\r\n mode(value, opts) {\r\n ensureRepAssign(opts, 'mode', extractArgs(value, settings.defaults.modes));\r\n },\r\n\r\n c: 'color',\r\n color(value, opts) {\r\n ensureRepAssign(opts, 'colorer', extractArgs(value, settings.defaults.colorers));\r\n },\r\n\r\n mt: 'material',\r\n material(value, opts) {\r\n ensureRepAssign(opts, 'material', extractArgs(value, settings.defaults.materials));\r\n },\r\n\r\n dup(value, opts) {\r\n ensureRepList(opts);\r\n const { reps } = opts;\r\n const rep = reps[repIndex];\r\n repIndex = reps.length;\r\n reps[repIndex] = utils.deriveDeep(rep, true);\r\n },\r\n\r\n // Settings shortcuts\r\n\r\n ar: 'autoResolution',\r\n};\r\n\r\nfunction _fromArray(entries) {\r\n repIndex = 0;\r\n\r\n const opts = {};\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const /** string[] */ entry = entries[i];\r\n let /** string? */ key = entry[0];\r\n const /** string? */ value = entry[1];\r\n let /** function|string? */ action = actions[key];\r\n\r\n // unwind shortcuts and aliases\r\n while (_.isString(action)) {\r\n key = action;\r\n action = actions[key];\r\n }\r\n\r\n // either set a property or use specialized parser\r\n if (!action) {\r\n const adapter = adapters[typeof _.get(settings.defaults, key)];\r\n if (adapter) {\r\n _.set(opts, `settings.${key}`, adapter(value));\r\n } else {\r\n logger.warn(`Unknown option \"${key}\"`);\r\n }\r\n } else if (_.isFunction(action)) {\r\n const result = action(value, opts);\r\n if (result !== undefined) {\r\n opts[key] = result;\r\n }\r\n }\r\n }\r\n\r\n return opts;\r\n}\r\n\r\nfunction fromAttr(attr) {\r\n return _fromArray(utils.getUrlParameters(`?${attr || ''}`));\r\n}\r\n\r\nfunction fromURL(url) {\r\n return _fromArray(utils.getUrlParameters(url));\r\n}\r\n\r\nfunction _processOptsForURL(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = encodeQueryComponentL2(key) + cL2Ass + encodeQueryComponentL2(value);\r\n });\r\n return str.join(cLSep);\r\n}\r\n\r\nfunction _processArgsForURL(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]}${cOptsSep}${_processOptsForURL(args[1])}`;\r\n}\r\n\r\nfunction _processObjForURL(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += `,${objOpts.params.join(',')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += cOptsSep + _processOptsForURL(objOpts.opts);\r\n }\r\n return res;\r\n}\r\n\r\nfunction toURL(opts) {\r\n const stringList = [];\r\n let idx = 0;\r\n\r\n function checkAndAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n stringList[idx++] = encodeQueryComponentL1(prefix)\r\n + cL1Ass + encodeQueryComponentL1(value);\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n if (_.isEmpty(repList[i])) {\r\n continue;\r\n }\r\n checkAndAdd('r', i);\r\n checkAndAdd('s', repList[i].selector);\r\n checkAndAdd('m', _processArgsForURL(repList[i].mode));\r\n checkAndAdd('c', _processArgsForURL(repList[i].colorer));\r\n checkAndAdd('mt', _processArgsForURL(repList[i].material));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('o', _processObjForURL(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('l', opts.load);\r\n checkAndAdd('u', opts.unit);\r\n checkAndAdd('p', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n checkAndAdd('v', opts.view);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(key, value);\r\n });\r\n\r\n let url = '';\r\n if (typeof window !== 'undefined') {\r\n const { location } = window;\r\n url = `${location.protocol}//${location.host}${location.pathname}`;\r\n }\r\n if (stringList.length > 0) {\r\n url += `?${stringList.join('&')}`;\r\n }\r\n\r\n return url;\r\n}\r\n\r\nfunction _processOptsForScript(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = `${key}=${utils.enquoteString(value)}`;\r\n });\r\n return str.join(' ');\r\n}\r\n\r\nfunction _processArgsForScript(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]} ${_processOptsForScript(args[1])}`;\r\n}\r\n\r\nfunction _processObjForScript(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += ` ${objOpts.params.map(utils.enquoteString).join(' ')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += ` ${_processOptsForScript(objOpts.opts)}`;\r\n }\r\n return res;\r\n}\r\n\r\nfunction _processRepsForScript(rep, index) {\r\n const repString = [];\r\n let strIdx = 0;\r\n function localAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n repString[strIdx++] = prefix + value;\r\n }\r\n }\r\n if (_.isEmpty(rep)) {\r\n return null;\r\n }\r\n localAdd('', index);\r\n localAdd('s=', utils.enquoteString(rep.selector));\r\n localAdd('m=', _processArgsForScript(rep.mode));\r\n localAdd('c=', _processArgsForScript(rep.colorer));\r\n localAdd('mt=', _processArgsForScript(rep.material));\r\n return repString.join(' ');\r\n}\r\n\r\nfunction toScript(opts) {\r\n const commandsList = [];\r\n let idx = 0;\r\n function checkAndAdd(command, value, saveQuotes) {\r\n if (value !== null && value !== undefined) {\r\n const quote = (typeof value === 'string' && saveQuotes) ? '\"' : '';\r\n commandsList[idx++] = `${command} ${quote}${value}${quote}`.trim();\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n checkAndAdd('rep', _processRepsForScript(repList[i], i));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('', _processObjForScript(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('set', 'autobuild false');\r\n checkAndAdd('load', opts.load, true);\r\n checkAndAdd('unit', opts.unit);\r\n checkAndAdd('preset', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(`set ${key}`, value, true);\r\n });\r\n checkAndAdd('view', opts.view);\r\n checkAndAdd('set', 'autobuild true');\r\n return commandsList.join('\\n');\r\n}\r\n\r\nexport default {\r\n fromURL,\r\n fromAttr,\r\n adapters,\r\n toURL,\r\n toScript,\r\n};\r\n","/**\r\n * Atom measurements.\r\n *\r\n * @param {Residue} residue - (required) Residue containing the atom\r\n * @param {string} name - (required) Name, unique in the residue\r\n * @param {Element} type - (required) Chemical element reference\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n *\r\n * @param {number} role - Role of atom inside monomer: Lead and wing are particularity interesting\r\n * @param {boolean} het - Non-standard residue indicator\r\n *\r\n * @param {number} serial - Serial number, unique in the model\r\n * @param {string} location - Alternative location indicator (usually space or A-Z)\r\n * @param {number} occupancy - Occupancy percentage, from 0 to 1\r\n * @param {number} temperature - Temperature\r\n * @param {number} charge - Charge\r\n *\r\n * @exports Atom\r\n * @constructor\r\n */\r\n\r\nclass Atom {\r\n constructor(residue, name, type, position, role, het, serial, location, occupancy, temperature, charge) {\r\n this.index = -1;\r\n this.residue = residue;\r\n this.name = name;\r\n this.element = type;\r\n this.position = position;\r\n this.role = role;\r\n this.mask = 1 | 0;\r\n\r\n this.het = het;\r\n\r\n this.serial = serial;\r\n this.location = (location || ' ').charCodeAt(0);\r\n this.occupancy = occupancy || 1;\r\n this.temperature = temperature;\r\n this.charge = charge;\r\n this.hydrogenCount = -1; // explicitly invalid\r\n this.radicalCount = 0;\r\n this.valence = -1; // explicitly invalid\r\n\r\n this.bonds = [];\r\n\r\n this.flags = 0x0000;\r\n if (type.name === 'H') {\r\n this.flags |= Atom.Flags.HYDROGEN;\r\n } else if (type.name === 'C') {\r\n this.flags |= Atom.Flags.CARBON;\r\n }\r\n }\r\n\r\n isHet() {\r\n return this.het;\r\n }\r\n\r\n isHydrogen() {\r\n return this.element.number === 1;\r\n }\r\n\r\n getVisualName() {\r\n const { name } = this;\r\n if (name.length > 0) {\r\n return name;\r\n }\r\n return this.element.name.trim();\r\n }\r\n\r\n forEachBond(process) {\r\n const { bonds } = this;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n getFullName() {\r\n let name = '';\r\n if (this.residue !== null) {\r\n if (this.residue._chain !== null) {\r\n name += `${this.residue._chain.getName()}.`;\r\n }\r\n name += `${this.residue._sequence}.`;\r\n }\r\n name += this.name;\r\n return name;\r\n }\r\n\r\n /**\r\n * Enumeration of atom flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n CARBON: 0x0001,\r\n // OXYGEN: 0x0002,\r\n // NITROGEN: 0x0004,\r\n HYDROGEN: 0x0008,\r\n /** Non-polar hydrogen (it is also a HYDROGEN) */\r\n NONPOLARH: 0x1008,\r\n };\r\n}\r\n\r\nexport default Atom;\r\n","class Element {\r\n constructor(number, name, fullName, weight, radius, radiusBonding, hValency) {\r\n this.number = number;\r\n this.name = name;\r\n this.fullName = fullName;\r\n this.weight = weight;\r\n this.radius = radius;\r\n this.radiusBonding = radiusBonding;\r\n this.hydrogenValency = hValency;\r\n }\r\n\r\n static Constants = {\r\n /* eslint-disable no-magic-numbers */\r\n U1: 1,\r\n Lead: 2,\r\n U2: 3,\r\n Wing: 4,\r\n U18: 18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n static Role = {\r\n /* eslint-disable no-magic-numbers */\r\n N: Element.Constants.U1,\r\n CA: Element.Constants.Lead,\r\n C: Element.Constants.U2,\r\n O: Element.Constants.Wing,\r\n SG: Element.Constants.U18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByAtomicNumber = [\r\n /* eslint-disable no-magic-numbers */\r\n null,\r\n new Element(1, 'H', 'Hydrogen', 1.008, 1.2, 0.23, [1]),\r\n new Element(2, 'HE', 'Helium', 4.003, 1.4, 0.93, [0]),\r\n new Element(3, 'LI', 'Lithium', 6.941, 1.82, 0.68, [1]),\r\n new Element(4, 'BE', 'Beryllium', 9.012, 1.7, 0.35, [2]),\r\n new Element(5, 'B', 'Boron', 10.81, 2.08, 0.83, [3]),\r\n new Element(6, 'C', 'Carbon', 12.011, 1.95, 0.68, [4]),\r\n new Element(7, 'N', 'Nitrogen', 14.007, 1.85, 0.68, [3, 5]),\r\n new Element(8, 'O', 'Oxygen', 15.999, 1.7, 0.68, [2, 4]),\r\n new Element(9, 'F', 'Fluorine', 18.998, 1.73, 0.64, [1]),\r\n new Element(10, 'NE', 'Neon', 20.18, 1.54, 1.12, [0]),\r\n new Element(11, 'NA', 'Sodium', 22.99, 2.27, 0.97, [1]),\r\n new Element(12, 'MG', 'Magnesium', 24.305, 1.73, 1.1, [2]),\r\n new Element(13, 'AL', 'Aluminum', 26.981, 2.05, 1.35, [3]),\r\n new Element(14, 'SI', 'Silicon', 28.086, 2.1, 1.2, [4]),\r\n new Element(15, 'P', 'Phosphorus', 30.974, 2.08, 0.75, [3, 5]),\r\n new Element(16, 'S', 'Sulfur', 32.07, 2, 1.02, [2, 4, 6]),\r\n new Element(17, 'CL', 'Chlorine', 35.453, 1.97, 0.99, [1, 3, 5, 7]),\r\n new Element(18, 'AR', 'Argon', 39.948, 1.88, 1.57, [0]),\r\n new Element(19, 'K', 'Potassium', 39.1, 2.75, 1.33, [1]),\r\n new Element(20, 'CA', 'Calcium', 40.08, 1.973, 0.99, [2]),\r\n new Element(21, 'SC', 'Scandium', 44.956, 1.7, 1.44, [0]),\r\n new Element(22, 'TI', 'Titanium', 47.88, 1.7, 1.47, [0]),\r\n new Element(23, 'V', 'Vanadium', 50.941, 1.7, 1.33, [0]),\r\n new Element(24, 'CR', 'Chromium', 52, 1.7, 1.35, [0]),\r\n new Element(25, 'MN', 'Manganese', 54.938, 1.7, 1.35, [0]),\r\n new Element(26, 'FE', 'Iron', 55.847, 1.7, 1.34, [0]),\r\n new Element(27, 'CO', 'Cobalt', 58.93, 1.7, 1.33, [0]),\r\n new Element(28, 'NI', 'Nickel', 58.69, 1.63, 1.5, [0]),\r\n new Element(29, 'CU', 'Copper', 63.55, 1.4, 1.52, [0]),\r\n new Element(30, 'ZN', 'Zinc', 65.39, 1.39, 1.45, [0]),\r\n new Element(31, 'GA', 'Gallium', 69.72, 1.87, 1.22, [3]),\r\n new Element(32, 'GE', 'Germanium', 72.61, 1.7, 1.17, [4]),\r\n new Element(33, 'AS', 'Arsenic', 74.92, 1.85, 1.21, [3, 5]),\r\n new Element(34, 'SE', 'Selenium', 78.96, 1.9, 1.22, [2, 4, 6]),\r\n new Element(35, 'BR', 'Bromine', 79.9, 2.1, 1.21, [1, 3, 5, 7]),\r\n new Element(36, 'KR', 'Krypton', 83.8, 2.02, 1.91, [0]),\r\n new Element(37, 'RB', 'Rubidium', 85.47, 1.7, 1.47, [1]),\r\n new Element(38, 'SR', 'Strontium', 87.62, 1.7, 1.12, [2]),\r\n new Element(39, 'Y', 'Yttrium', 88.91, 1.7, 1.78, [0]),\r\n new Element(40, 'ZR', 'Zirconium', 91.22, 1.7, 1.56, [0]),\r\n new Element(41, 'NB', 'Niobium', 92.91, 1.7, 1.48, [0]),\r\n new Element(42, 'MO', 'Molybdenum', 95.94, 1.7, 1.47, [0]),\r\n new Element(43, 'TC', 'Technetium', 98.91, 1.7, 1.35, [0]),\r\n new Element(44, 'RU', 'Ruthenium', 101.07, 1.7, 1.4, [0]),\r\n new Element(45, 'RH', 'Rhodium', 102.91, 1.7, 1.45, [0]),\r\n new Element(46, 'PD', 'Palladium', 106.42, 1.63, 1.5, [0]),\r\n new Element(47, 'AG', 'Silver', 107.87, 1.72, 1.59, [0]),\r\n new Element(48, 'CD', 'Cadmium', 112.41, 1.58, 1.69, [0]),\r\n new Element(49, 'IN', 'Indium', 114.82, 1.93, 1.63, [3]),\r\n new Element(50, 'SN', 'Tin', 118.71, 2.17, 1.46, [2, 4]),\r\n new Element(51, 'SB', 'Antimony', 121.75, 2.2, 1.46, [3, 5]),\r\n new Element(52, 'TE', 'Tellurium', 127.6, 2.06, 1.47, [2, 4, 6]),\r\n new Element(53, 'I', 'Iodine', 126.91, 2.15, 1.4, [1, 3, 5, 7]),\r\n new Element(54, 'XE', 'Xenon', 131.29, 2.16, 1.98, [0]),\r\n new Element(55, 'CS', 'Cesium', 132.91, 1.7, 1.67, [1]),\r\n new Element(56, 'BA', 'Barium', 137.33, 1.7, 1.34, [2]),\r\n new Element(57, 'LA', 'Lanthanum', 138.91, 1.7, 1.87, [0]),\r\n new Element(58, 'CE', 'Cerium', 140.12, 1.7, 1.83, [0]),\r\n new Element(59, 'PR', 'Praseodymium', 140.91, 1.7, 1.82, [0]),\r\n new Element(60, 'ND', 'Neodymium', 144.24, 1.7, 1.81, [0]),\r\n new Element(61, 'PM', 'Promethium', 144.9, 1.7, 1.8, [0]),\r\n new Element(62, 'SM', 'Samarium', 150.36, 1.7, 1.8, [0]),\r\n new Element(63, 'EU', 'Europium', 151.96, 1.7, 1.99, [0]),\r\n new Element(64, 'GD', 'Gadolinium', 157.25, 1.7, 1.79, [0]),\r\n new Element(65, 'TB', 'Terbium', 158.93, 1.7, 1.76, [0]),\r\n new Element(66, 'DY', 'Dysprosium', 162.5, 1.7, 1.75, [0]),\r\n new Element(67, 'HO', 'Holmium', 164.93, 1.7, 1.74, [0]),\r\n new Element(68, 'ER', 'Erbium', 167.26, 1.7, 1.73, [0]),\r\n new Element(69, 'TM', 'Thulium', 168.93, 1.7, 1.72, [0]),\r\n new Element(70, 'YB', 'Ytterbium', 173.04, 1.7, 1.94, [0]),\r\n new Element(71, 'LU', 'Lutetium', 174.97, 1.7, 1.72, [0]),\r\n new Element(72, 'HF', 'Hafnium', 178.49, 1.7, 1.57, [0]),\r\n new Element(73, 'TA', 'Tantalum', 180.95, 1.7, 1.43, [0]),\r\n new Element(74, 'W', 'Tungsten', 183.85, 1.7, 1.37, [0]),\r\n new Element(75, 'RE', 'Rhenium', 186.21, 1.7, 1.35, [0]),\r\n new Element(76, 'OS', 'Osmium', 190.2, 1.7, 1.37, [0]),\r\n new Element(77, 'IR', 'Iridium', 192.22, 1.7, 1.32, [0]),\r\n new Element(78, 'PT', 'Platinum', 195.08, 1.72, 1.5, [0]),\r\n new Element(79, 'AU', 'Gold', 196.97, 1.66, 1.5, [0]),\r\n new Element(80, 'HG', 'Mercury', 200.59, 1.55, 1.7, [0]),\r\n new Element(81, 'TL', 'Thallium', 204.38, 1.96, 1.55, [1, 3]),\r\n new Element(82, 'PB', 'Lead', 207.2, 2.02, 1.54, [2, 4]),\r\n new Element(83, 'BI', 'Bismuth', 208.98, 1.7, 1.54, [3, 5]),\r\n new Element(84, 'PO', 'Polonium', 210, 1.7, 1.68, [2, 4, 6]),\r\n new Element(85, 'AT', 'Astatine', 210, 1.7, 1.7, [1, 3, 5, 7]),\r\n new Element(86, 'RN', 'Radon', 222, 1.7, 2.4, [0]),\r\n new Element(87, 'FR', 'Francium', 223, 1.7, 2, [1]),\r\n new Element(88, 'RA', 'Radium', 226.03, 1.7, 1.9, [2]),\r\n new Element(89, 'AC', 'Actinium', 227.03, 1.7, 1.88, [0]),\r\n new Element(90, 'TH', 'Thorium', 232.04, 1.7, 1.79, [0]),\r\n new Element(91, 'PA', 'Protactinium', 231.04, 1.7, 1.61, [0]),\r\n new Element(92, 'U', 'Uranium', 238.03, 1.86, 1.58, [0]),\r\n new Element(93, 'NP', 'Neptunium', 237.05, 1.7, 1.55, [0]),\r\n new Element(94, 'PU', 'Plutonium', 239.1, 1.7, 1.53, [0]),\r\n new Element(95, 'AM', 'Americium', 243.1, 1.7, 1.51, [0]),\r\n new Element(96, 'CM', 'Curium', 247.1, 1.7, 1.5, [0]),\r\n new Element(97, 'BK', 'Berkelium', 247.1, 1.7, 1.5, [0]),\r\n new Element(98, 'CF', 'Californium', 252.1, 1.7, 1.5, [0]),\r\n new Element(99, 'ES', 'Einsteinium', 252.1, 1.7, 1.5, [0]),\r\n new Element(100, 'FM', 'Fermium', 257.1, 1.7, 1.5, [0]),\r\n new Element(101, 'MD', 'Mendelevium', 256.1, 1.7, 1.5, [0]),\r\n new Element(102, 'NO', 'Nobelium', 259.1, 1.7, 1.5, [0]),\r\n new Element(103, 'LR', 'Lawrencium', 260.1, 1.7, 1.5, [0]),\r\n new Element(104, 'RF', 'Rutherfordium', 261, 1.7, 1.6, [0]),\r\n new Element(105, 'DB', 'Dubnium', 262, 1.7, 1.6, [0]),\r\n new Element(106, 'SG', 'Seaborgium', 263, 1.7, 1.6, [0]),\r\n new Element(107, 'BH', 'Bohrium', 262, 1.7, 1.6, [0]),\r\n new Element(108, 'HS', 'Hassium', 265, 1.7, 1.6, [0]),\r\n new Element(109, 'MT', 'Meitnerium', 268, 1.7, 1.6, [0]),\r\n /* eslint-enable no-magic-numbers */\r\n ];\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByName = {\r\n // Duplicate atomic numbers (isotopes)\r\n /* eslint-disable no-magic-numbers */\r\n D: new Element(1, 'D', 'Deuterium', 2.014, 1.2, 0.23, [1]),\r\n T: new Element(1, 'T', 'Tritium', 3.016, 1.2, 0.23, [1]),\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // All regular elements will be added later, automatically\r\n };\r\n}\r\n\r\n(function () {\r\n const byAtomicNumber = Element.ByAtomicNumber;\r\n const byName = Element.ByName;\r\n for (let i = 0, n = byAtomicNumber.length; i < n; ++i) {\r\n const element = byAtomicNumber[i];\r\n if (element) {\r\n byName[element.name] = element;\r\n }\r\n }\r\n}());\r\n\r\n// find atom type by chemical element (or create if missing)\r\nElement.getByName = function (element) {\r\n let type = Element.ByName[element];\r\n if (!type) {\r\n type = Element.ByName[element] = new Element(0, element, 'Unknown', 0, 1.0, 0.01, [0]);\r\n }\r\n return type;\r\n};\r\n\r\nexport default Element;\r\n","const cBondTypes = {\r\n /** Was generated manually */\r\n UNKNOWN: 0,\r\n /** Simple covalent bond */\r\n COVALENT: 1,\r\n /** Aromatic bond */\r\n AROMATIC: 2,\r\n};\r\n\r\nfunction getAtomPos(atom) {\r\n return atom.position;\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Atom} left - The first atom.\r\n * @param {Atom} right - The second atom.\r\n * @param {number} order - Order of current bond.\r\n * @param {number} type - Bond type.\r\n * @param {boolean} fixed - Indicator of a pre-specified connection (in contrast with guessed one).\r\n *\r\n * @exports Bond\r\n * @constructor\r\n */\r\nclass Bond {\r\n constructor(left, right, order, type, fixed) {\r\n this._left = left;\r\n this._right = right;\r\n this._fixed = fixed;\r\n this._index = -1;\r\n if (left > right) {\r\n throw new Error('In a bond atom indices must be in increasing order');\r\n }\r\n this._order = order;\r\n this._type = type;\r\n }\r\n\r\n getLeft() {\r\n return this._left;\r\n }\r\n\r\n getRight() {\r\n return this._right;\r\n }\r\n\r\n getOrder() {\r\n return this._order;\r\n }\r\n\r\n calcLength() {\r\n return this._left.position.distanceTo(this._right.position);\r\n }\r\n\r\n _forEachNeighbour(currAtom, process) {\r\n const { bonds } = currAtom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]._left !== currAtom ? bonds[i]._left : bonds[i]._right);\r\n }\r\n }\r\n\r\n forEachLevelOne(process) {\r\n const left = this._left;\r\n const right = this._right;\r\n this._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n this._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n }\r\n\r\n forEachLevelTwo(process) {\r\n // TODO refactor this piece of an art?\r\n const left = this._left;\r\n const right = this._right;\r\n const self = this;\r\n self._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === left) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n self._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === right) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n }\r\n\r\n _fixDir(refPoint, currDir, posGetter) {\r\n // count atoms to the right and to the left of the current plane\r\n let rightCount = 0;\r\n let leftCount = 0;\r\n const tmpVec = refPoint.clone();\r\n function checkDir(atom) {\r\n tmpVec.copy(posGetter(atom));\r\n tmpVec.sub(refPoint);\r\n const dotProd = currDir.dot(tmpVec);\r\n if (dotProd > 0) {\r\n ++rightCount;\r\n } else {\r\n ++leftCount;\r\n }\r\n }\r\n function checkCarbon(atom) {\r\n if (atom.element.name === 'C') {\r\n checkDir(atom);\r\n }\r\n }\r\n // count all atoms to the left and right of our plane, start from level 1 and carbons\r\n const stages = [\r\n [this.forEachLevelOne, checkCarbon],\r\n [this.forEachLevelOne, checkDir],\r\n [this.forEachLevelTwo, checkCarbon],\r\n [this.forEachLevelTwo, checkDir],\r\n ];\r\n\r\n for (let stageId = 0; stageId < stages.length; ++stageId) {\r\n stages[stageId][0].call(this, stages[stageId][1]);\r\n if (leftCount > rightCount) {\r\n return currDir.multiplyScalar(-1);\r\n }\r\n if (leftCount < rightCount) {\r\n return currDir;\r\n }\r\n }\r\n return currDir;\r\n }\r\n\r\n calcNormalDir(posGetter) {\r\n const left = this._left;\r\n const right = this._right;\r\n let first = left;\r\n let second = right;\r\n posGetter = posGetter === undefined ? getAtomPos : posGetter;\r\n if (left.bonds.length > right.bonds.length) {\r\n first = right;\r\n second = left;\r\n }\r\n let third = first;\r\n let maxNeibs = 0;\r\n const { bonds } = second;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n let another = bonds[i]._left;\r\n if (bonds[i]._left === second) {\r\n another = bonds[i]._right;\r\n }\r\n if (another.bonds.length > maxNeibs && another !== first) {\r\n third = another;\r\n maxNeibs = another.bonds.length;\r\n }\r\n }\r\n const secondPos = posGetter(second);\r\n const firstV = posGetter(first).clone().sub(secondPos);\r\n const secondV = posGetter(third).clone().sub(secondPos);\r\n secondV.crossVectors(firstV, secondV);\r\n if (secondV.lengthSq() < 0.0001) {\r\n secondV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n secondV.normalize();\r\n firstV.crossVectors(secondV, firstV);\r\n if (firstV.lengthSq() < 0.0001) {\r\n firstV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n return this._fixDir(secondPos, firstV, posGetter);\r\n }\r\n\r\n static BondType = cBondTypes;\r\n}\r\n\r\nBond.prototype.BondType = cBondTypes;\r\n\r\nexport default Bond;\r\n","import * as THREE from 'three';\r\nimport Atom from './Atom';\r\nimport Element from './Element';\r\n\r\nconst cNucleicControlNames = ['C3\\'', 'C3*', 'P', 'H5T', 'H3T'];\r\nconst cNucleicWing1Names = ['OP1', 'O1P'];\r\nconst cNucleicWing2Names = ['OP2', 'O2P'];\r\n\r\nconst cCylinderSource = ['C3\\'', 'C3*', 'C1', 'C1\\'', 'C1*', 'P'];\r\nconst cCylinderTarget = [{\r\n types: ['A', 'DA', 'G', 'DG'],\r\n atoms: ['N1'],\r\n}, {\r\n types: ['C', 'DC'],\r\n atoms: ['N3'],\r\n}, {\r\n types: ['T', 'DT', 'U', 'DU'],\r\n atoms: ['O4'],\r\n}];\r\n\r\n/**\r\n * Residue instance.\r\n *\r\n * @param {Chain} chain - Chain this residue belongs to.\r\n * @param {ResidueType} type - Generic residue instance type.\r\n * @param {number} sequence - Sequence ID.\r\n * @param {string} icode - One character insertion code (usually space or A-Z).\r\n *\r\n * @exports Residue\r\n * @constructor\r\n */\r\nclass Residue {\r\n constructor(chain, type, sequence, icode) {\r\n this._chain = chain;\r\n this._component = null;\r\n this._type = type;\r\n this._sequence = sequence;\r\n this._icode = icode;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n\r\n this._atoms = [];\r\n this._secondary = null;\r\n this._firstAtom = null;\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n this._lastAtom = null;\r\n this._controlPoint = null;\r\n this._midPoint = null;\r\n this._wingVector = null;\r\n this._cylinders = null;\r\n this._isValid = true;\r\n this._het = false;\r\n this._molecule = null;\r\n this.temperature = null;\r\n this.occupancy = null;\r\n }\r\n\r\n // Getters and setters\r\n getChain() {\r\n return this._chain;\r\n }\r\n\r\n getMolecule() {\r\n return this._molecule;\r\n }\r\n\r\n getType() {\r\n return this._type;\r\n }\r\n\r\n getSequence() {\r\n return this._sequence;\r\n }\r\n\r\n getSecondary() {\r\n return this._secondary;\r\n }\r\n\r\n getICode() {\r\n return this._icode;\r\n }\r\n\r\n // Other methods\r\n\r\n addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge) {\r\n const atom = new Atom(this, name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n const complex = this._chain.getComplex();\r\n complex.addAtom(atom);\r\n this._atoms.push(atom);\r\n this._het = this._het || het;\r\n return atom;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n if (process(atoms[i])) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n _findAtomByName(name) {\r\n let res = null;\r\n this.forEachAtom((atom) => {\r\n if (atom.name === name) {\r\n res = atom;\r\n return true;\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _findFirstAtomInList(names) {\r\n let res = null;\r\n for (let i = 0; i < names.length; ++i) {\r\n res = this._findAtomByName(names[i]);\r\n if (res !== null) {\r\n return res;\r\n }\r\n }\r\n return res;\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n mask &= atoms[i].mask;\r\n }\r\n this._mask = mask;\r\n }\r\n\r\n getCylinderTargetList() {\r\n const type = this._type._name;\r\n for (let i = 0, n = cCylinderTarget.length; i < n; ++i) {\r\n for (let j = 0, m = cCylinderTarget[i].types.length; j < m; ++j) {\r\n if (type === cCylinderTarget[i].types[j]) {\r\n return cCylinderTarget[i].atoms;\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n _detectLeadWing(dst, next, getAtomPosition) {\r\n const leadAtom = this._findFirstAtomInList(cNucleicControlNames);\r\n let wingStart = this._findFirstAtomInList(cNucleicWing1Names);\r\n let wingEnd = this._findFirstAtomInList(cNucleicWing2Names);\r\n\r\n if (wingStart === null && next !== null) {\r\n wingStart = next._findFirstAtomInList(cNucleicWing1Names);\r\n }\r\n\r\n if (wingEnd === null && next !== null) {\r\n wingEnd = next._findFirstAtomInList(cNucleicWing2Names);\r\n }\r\n\r\n if (leadAtom === null || wingStart === null || wingEnd === null) {\r\n return;\r\n }\r\n\r\n dst._leadAtom = leadAtom;\r\n dst._controlPoint = getAtomPosition(leadAtom);\r\n dst._wingVector = getAtomPosition(wingEnd).clone().sub(getAtomPosition(wingStart));\r\n dst._isValid = true;\r\n\r\n const cylSource = this._findFirstAtomInList(cCylinderSource);\r\n const targetList = this.getCylinderTargetList();\r\n const cylTarget = targetList !== null ? this._findFirstAtomInList(targetList) : null;\r\n if (cylSource === null || cylTarget === null) {\r\n return;\r\n }\r\n dst._cylinders = [getAtomPosition(cylSource), getAtomPosition(cylTarget)];\r\n }\r\n\r\n calcWing(prevLeadPos, currLeadPos, prevWingPos, prevWing) {\r\n const vectorA = currLeadPos.clone().sub(prevLeadPos);\r\n const vectorB = prevLeadPos.clone().sub(prevWingPos);\r\n vectorB.crossVectors(vectorA, vectorB);\r\n vectorB.crossVectors(vectorA, vectorB).normalize();\r\n if (prevWing !== null && prevWing.length() > 0.0001) {\r\n const needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2;\r\n if (needToNegate) {\r\n vectorB.negate();\r\n }\r\n }\r\n return vectorB;\r\n }\r\n\r\n _innerFinalize(prevRes, prev, nextRes, dst, chainAsNucleic, getAtomPosition) {\r\n const bFirstInChain = prev === null;\r\n\r\n const lp = getAtomPosition(this._leadAtom);\r\n const currLeadPos = new THREE.Vector3(lp.x, lp.y, lp.z);\r\n if (chainAsNucleic) {\r\n this._detectLeadWing(dst, nextRes, getAtomPosition);\r\n return;\r\n }\r\n\r\n if (bFirstInChain) { // for first one in chain\r\n dst._midPoint = getAtomPosition(this._firstAtom).clone();\r\n } else {\r\n const prevLeadPos = prev._controlPoint; // lead point of previous monomer\r\n dst._midPoint = prevLeadPos.clone().lerp(currLeadPos, 0.5);\r\n dst._wingVector = this.calcWing(prevLeadPos, currLeadPos, getAtomPosition(prevRes._wingAtom), prev._wingVector);\r\n }\r\n dst._controlPoint = currLeadPos;\r\n }\r\n\r\n _finalize2(prev, next, asNucleic) {\r\n // Should be called AFTER first finalize\r\n this._innerFinalize(prev, prev, next, this, asNucleic, (atom) => atom.position);\r\n }\r\n\r\n isConnected(anotherResidue) {\r\n if (this._chain !== anotherResidue._chain) {\r\n return false;\r\n }\r\n if (this === anotherResidue) {\r\n return true;\r\n }\r\n let res = false;\r\n this.forEachAtom((atom) => {\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue === anotherResidue || bond._right.residue === anotherResidue) {\r\n res = true;\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _finalize() {\r\n const self = this;\r\n [this._firstAtom] = this._atoms;\r\n this._lastAtom = this._atoms[this._atoms.length - 1];\r\n\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n\r\n let tempCount = 0;\r\n let temperature = 0; // average temperature\r\n let occupCount = 0;\r\n let occupancy = 0; // average occupancy\r\n this.forEachAtom((a) => {\r\n if (self._leadAtom === null) {\r\n if (a.role === Element.Constants.Lead) {\r\n self._leadAtom = a;\r\n }\r\n }\r\n if (self._wingAtom === null) {\r\n if (a.role === Element.Constants.Wing) {\r\n self._wingAtom = a;\r\n }\r\n }\r\n if (a.temperature) {\r\n temperature += a.temperature;\r\n tempCount++;\r\n }\r\n if (a.occupancy) {\r\n occupancy += a.occupancy;\r\n occupCount++;\r\n }\r\n return (self._leadAtom !== null && self._wingAtom !== null);\r\n });\r\n\r\n if (tempCount > 0) {\r\n this.temperature = temperature / tempCount;\r\n }\r\n if (occupCount > 0) {\r\n this.occupancy = occupancy / occupCount;\r\n }\r\n\r\n // Still try to make monomer look valid\r\n if (this._leadAtom === null || this._wingAtom === null) {\r\n this._isValid = false;\r\n }\r\n if (this._leadAtom === null) {\r\n this._leadAtom = this._firstAtom;\r\n }\r\n if (this._wingAtom === null) {\r\n this._wingAtom = this._lastAtom;\r\n }\r\n }\r\n}\r\n\r\nexport default Residue;\r\n","/**\r\n * Residue type.\r\n *\r\n * Predefined acid or created with HET, HETNAM, etc.\r\n *\r\n * @param {string} name - Short name, either standard (ALA, MET, etc.) or non-standard one.\r\n * @param {string} fullName - Full residue name.\r\n * @param {string} letterCode - 1-letter symbol.\r\n *\r\n * @exports ResidueType\r\n * @constructor\r\n */\r\nclass ResidueType {\r\n constructor(name, fullName, letterCode) {\r\n this._name = name;\r\n this._fullName = fullName;\r\n this.letterCode = letterCode;\r\n this.flags = 0x0000;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\n static StandardTypes = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: new ResidueType('ALA', 'Alanine', 'A'),\r\n ARG: new ResidueType('ARG', 'Arginine', 'R'),\r\n ASN: new ResidueType('ASN', 'Asparagine', 'N'),\r\n ASP: new ResidueType('ASP', 'Aspartic Acid', 'D'),\r\n CYS: new ResidueType('CYS', 'Cysteine', 'C'),\r\n GLN: new ResidueType('GLN', 'Glutamine', 'Q'),\r\n GLU: new ResidueType('GLU', 'Glutamic Acid', 'E'),\r\n GLY: new ResidueType('GLY', 'Glycine', 'G'),\r\n HIS: new ResidueType('HIS', 'Histidine', 'H'),\r\n ILE: new ResidueType('ILE', 'Isoleucine', 'I'),\r\n LEU: new ResidueType('LEU', 'Leucine', 'L'),\r\n LYS: new ResidueType('LYS', 'Lysine', 'K'),\r\n MET: new ResidueType('MET', 'Methionine', 'M'),\r\n PHE: new ResidueType('PHE', 'Phenylalanine', 'F'),\r\n PRO: new ResidueType('PRO', 'Proline', 'P'),\r\n PYL: new ResidueType('PYL', 'Pyrrolysine', 'O'),\r\n SEC: new ResidueType('SEC', 'Selenocysteine', 'U'),\r\n SER: new ResidueType('SER', 'Serine', 'S'),\r\n THR: new ResidueType('THR', 'Threonine', 'T'),\r\n TRP: new ResidueType('TRP', 'Tryptophan', 'W'),\r\n TYR: new ResidueType('TYR', 'Tyrosine', 'Y'),\r\n VAL: new ResidueType('VAL', 'Valine', 'V'),\r\n A: new ResidueType('A', 'Adenine', 'A'),\r\n C: new ResidueType('C', 'Cytosine', 'C'),\r\n G: new ResidueType('G', 'Guanine', 'G'),\r\n I: new ResidueType('I', 'Inosine', 'I'),\r\n T: new ResidueType('T', 'Thymine', 'T'),\r\n U: new ResidueType('U', 'Uracil', 'U'),\r\n DA: new ResidueType('DA', 'Adenine', 'A'),\r\n DC: new ResidueType('DC', 'Cytosine', 'C'),\r\n DG: new ResidueType('DG', 'Guanine', 'G'),\r\n DI: new ResidueType('DI', 'Inosine', 'I'),\r\n DT: new ResidueType('DT', 'Thymine', 'T'),\r\n DU: new ResidueType('DU', 'Uracil', 'U'),\r\n '+A': new ResidueType('+A', 'Adenine', 'A'),\r\n '+C': new ResidueType('+C', 'Cytosine', 'C'),\r\n '+G': new ResidueType('+G', 'Guanine', 'G'),\r\n '+I': new ResidueType('+I', 'Inosine', 'I'),\r\n '+T': new ResidueType('+T', 'Thymine', 'T'),\r\n '+U': new ResidueType('+U', 'Uracil', 'U'),\r\n WAT: new ResidueType('WAT', 'Water', ''),\r\n H2O: new ResidueType('H2O', 'Water', ''),\r\n HOH: new ResidueType('HOH', 'Water', ''),\r\n DOD: new ResidueType('DOD', 'Water', ''),\r\n UNK: new ResidueType('UNK', 'Unknown', ''),\r\n UNL: new ResidueType('UNL', 'Unknown Ligand', ''),\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n /**\r\n * Enumeration of residue flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n // Amino acids\r\n /** Amino acid residue */\r\n PROTEIN: 0x0001,\r\n /** Basic amino acid residue */\r\n BASIC: 0x0002,\r\n /** Acidic amino acid residue */\r\n ACIDIC: 0x0004,\r\n /** Polar uncharged side chain amino acid residue */\r\n POLAR: 0x0008,\r\n /** Non-polar hydrophobic side chain amino acid residue */\r\n NONPOLAR: 0x0010,\r\n /** Aromatic amino acid residue */\r\n AROMATIC: 0x0020,\r\n\r\n // Nucleic acids\r\n\r\n /** Nucleic residue */\r\n NUCLEIC: 0x0100,\r\n /** Purine nucleic residue */\r\n PURINE: 0x0200,\r\n /** Pyrimidine nucleic residue */\r\n PYRIMIDINE: 0x0400,\r\n /** DNA */\r\n DNA: 0x0800,\r\n /** RNA */\r\n RNA: 0x1000,\r\n\r\n /** Water */\r\n WATER: 0x10000,\r\n };\r\n}\r\n\r\n// Flag combinations\r\nfunction _addFlag(flag, list) {\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const res = ResidueType.StandardTypes[list[i]];\r\n if (res) {\r\n res.flags |= flag;\r\n }\r\n }\r\n}\r\n\r\nconst { Flags } = ResidueType;\r\n_addFlag(Flags.WATER, ['WAT', 'H2O', 'HOH', 'DOD']);\r\n\r\n_addFlag(Flags.PROTEIN, [\r\n 'ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLY', 'GLU', 'GLN', 'HIS', 'ILE',\r\n 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'PYL', 'SEC', 'SER', 'THR', 'TRP',\r\n 'TYR', 'VAL',\r\n]);\r\n_addFlag(Flags.BASIC, ['ARG', 'HIS', 'LYS']);\r\n_addFlag(Flags.ACIDIC, ['ASP', 'GLU']);\r\n_addFlag(Flags.POLAR, ['ASN', 'CYS', 'GLN', 'SER', 'THR', 'TYR']);\r\n_addFlag(Flags.NONPOLAR, ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'VAL', 'GLY']);\r\n_addFlag(Flags.AROMATIC, ['PHE', 'TRP', 'TYR']);\r\n\r\n_addFlag(Flags.NUCLEIC, [\r\n 'A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I',\r\n 'C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U',\r\n]);\r\n_addFlag(Flags.PURINE, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I']);\r\n_addFlag(Flags.PYRIMIDINE, ['C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']);\r\n_addFlag(Flags.DNA, ['DA', 'DG', 'DI', 'DC', 'DT', 'DU']);\r\n_addFlag(Flags.RNA, ['A', 'G', 'I', 'C', 'T', 'U']);\r\n// Table of kdHydrophobicity\r\nconst hydro = {\r\n ILE: 4.5,\r\n VAL: 4.2,\r\n LEU: 3.8,\r\n PHE: 2.8,\r\n CYS: 2.5,\r\n MET: 1.9,\r\n ALA: 1.8,\r\n GLY: -0.4,\r\n THR: -0.7,\r\n SER: -0.8,\r\n TRP: -0.9,\r\n TYR: -1.3,\r\n PRO: -1.6,\r\n HIS: -3.2,\r\n GLU: -3.5,\r\n GLN: -3.5,\r\n ASP: -3.5,\r\n ASN: -3.5,\r\n LYS: -3.9,\r\n ARG: -4.5,\r\n};\r\n\r\nfunction _addParam(param, list) {\r\n const keys = Object.keys(list);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = list[key];\r\n ResidueType.StandardTypes[key][param] = value;\r\n }\r\n}\r\n\r\n_addParam('hydrophobicity', hydro);\r\n\r\nexport default ResidueType;\r\n","import * as THREE from 'three';\r\nimport Residue from './Residue';\r\nimport ResidueType from './ResidueType';\r\n\r\n/**\r\n * Residues in chain are either amino acid either nucleic acid (and water)\r\n * There might be some modified/mutated residues, which type could not be determined by their name (nucleic or amino); In this\r\n * case firstly program definites the chain type (by well-known residues) and then definites modified/mutated residues\r\n */\r\nconst ChainType = {\r\n UNKNOWN: 0,\r\n PROTEIN: 1,\r\n NUCLEIC: 2,\r\n};\r\n\r\n/**\r\n * Residue chain.\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n * @param {string} name - One character identifier (usually space, A-Z, 0-9, or a-z).\r\n *\r\n * @exports Chain\r\n * @constructor\r\n */\r\nclass Chain {\r\n constructor(complex, name) {\r\n this._complex = complex;\r\n this._name = name;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n this._residues = [];\r\n\r\n this.minSequence = Number.POSITIVE_INFINITY;\r\n this.maxSequence = Number.NEGATIVE_INFINITY;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n _determineType() {\r\n const residues = this._residues;\r\n\r\n const { PROTEIN, NUCLEIC } = ResidueType.Flags;\r\n\r\n this.type = ChainType.UNKNOWN;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const { flags } = residues[i]._type;\r\n\r\n if ((flags & NUCLEIC) !== 0) {\r\n this.type = ChainType.NUCLEIC;\r\n break;\r\n } else if ((flags & PROTEIN) !== 0) {\r\n this.type = ChainType.PROTEIN;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Finds thre residue with specified sequence number and inserion code\r\n * @param {Number} seqNum sequence number\r\n * @param {string} iCode insertion code\r\n * @returns {*} Residue or null if not found\r\n */\r\n findResidue(seqNum, iCode) {\r\n const residues = this._residues;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n if (res._sequence === seqNum && res._icode === iCode) {\r\n return [res, i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _finalize() {\r\n this._determineType();\r\n\r\n const residues = this._residues;\r\n\r\n let prev = null;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const next = (i + 1 < n) ? residues[i + 1] : null;\r\n const curr = residues[i];\r\n // TODO: skip invalid residues\r\n if (1 /* curr._isValid */) { // eslint-disable-line no-constant-condition\r\n curr._finalize2(prev, next, this.type === ChainType.NUCLEIC);\r\n prev = curr;\r\n }\r\n }\r\n\r\n // fix very first wing\r\n if (residues.length > 1 && residues[1]._wingVector) {\r\n const p = residues[1]._wingVector;\r\n residues[0]._wingVector = new THREE.Vector3(p.x, p.y, p.z);\r\n } else if (residues.length > 0) {\r\n residues[0]._wingVector = new THREE.Vector3(1, 0, 0);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const residues = this._residues;\r\n let prev = null;\r\n let prevData = null;\r\n const frameRes = frameData._residues;\r\n const n = residues.length;\r\n function getAtomPos(atom) {\r\n return frameData.getAtomPos(atom.index);\r\n }\r\n\r\n for (let i = 0; i < n; ++i) {\r\n const curr = residues[i];\r\n const currData = frameRes[curr._index];\r\n const nextRes = (i + 1 < n) ? residues[i + 1] : null;\r\n curr._innerFinalize(prev, prevData, nextRes, currData, this.type === ChainType.NUCLEIC, getAtomPos);\r\n prev = curr;\r\n prevData = currData;\r\n }\r\n\r\n frameRes[residues[0]._index]._wingVector = n > 1\r\n ? frameRes[residues[1]._index]._wingVector\r\n : new THREE.Vector3(1, 0, 0);\r\n }\r\n\r\n /**\r\n * Create a new residue.\r\n *\r\n * @param {string} name - Residue name.\r\n * @param {number} sequence - Residue sequence number.\r\n * @param {string} iCode - Insertion code.\r\n * @returns {Residue} - Newly created residue instance.\r\n */\r\n addResidue(name, sequence, iCode) {\r\n let type = this._complex.getResidueType(name);\r\n if (type === null) {\r\n type = this._complex.addResidueType(name);\r\n }\r\n const residue = new Residue(this, type, sequence, iCode);\r\n this._complex.addResidue(residue);\r\n this._residues.push(residue);\r\n\r\n if (type.flags & (ResidueType.Flags.NUCLEIC | ResidueType.Flags.PROTEIN)) {\r\n if (this.maxSequence < sequence) {\r\n this.maxSequence = sequence;\r\n }\r\n if (this.minSequence > sequence) {\r\n this.minSequence = sequence;\r\n }\r\n }\r\n\r\n return residue;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this._mask = mask;\r\n }\r\n}\r\n\r\nexport default Chain;\r\n","import Residue from './Residue';\r\n\r\n/** An element of protein secondary structure. */\r\nclass StructuralElement {\r\n /**\r\n * Create a secondary structural element of the specified type.\r\n *\r\n * @param {StructuralElement.Type} type Secondary structure type.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n */\r\n constructor(type, init, term) {\r\n /**\r\n * Secondary structure type.\r\n * @type {StructuralElement.Type}\r\n */\r\n this.type = type;\r\n /**\r\n * Generic secondary structure type.\r\n * @type {StructuralElement.Generic}\r\n */\r\n this.generic = StructuralElement.genericByType[this.type] || 'loop';\r\n /**\r\n * Initial residue.\r\n * @type Residue\r\n */\r\n this.init = init;\r\n /**\r\n * Terminal residue.\r\n * @type Residue\r\n */\r\n this.term = term;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n if (this.init instanceof Residue && this.term instanceof Residue) {\r\n return;\r\n }\r\n\r\n // Link all intermediate residues to this structural element\r\n const start = complex.splitUnifiedSerial(this.init);\r\n const end = complex.splitUnifiedSerial(this.term);\r\n for (let chainId = start.chain; chainId <= end.chain; chainId++) {\r\n for (let serialId = start.serial; serialId <= end.serial; serialId++) {\r\n for (let { iCode } = start; iCode <= end.iCode; iCode++) {\r\n const hashCode = complex.getUnifiedSerial(chainId, serialId, iCode);\r\n if (residueHash[hashCode]) {\r\n residueHash[hashCode]._secondary = this;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Replace unfined serials by objects\r\n this.init = residueHash[this.init];\r\n this.term = residueHash[this.term];\r\n }\r\n}\r\n\r\n/**\r\n * Specific type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Generic\r\n */\r\nStructuralElement.Type = {\r\n /** A strand of a [beta-sheet](https://en.wikipedia.org/wiki/Beta_sheet). */\r\n STRAND: 'E',\r\n /** An isolated beta-bridge (too small for a beta-sheet). */\r\n BRIDGE: 'B',\r\n\r\n /** A [3/10 helix](https://en.wikipedia.org/wiki/310_helix) (hydrogen bonding is 3 residues apart). */\r\n HELIX_310: 'G',\r\n /** An [alpha-helix](https://en.wikipedia.org/wiki/Alpha_helix) (hydrogen bonding is 4 residues apart). */\r\n HELIX_ALPHA: 'H',\r\n /** A [pi-helix](https://en.wikipedia.org/wiki/Pi_helix) (hydrogen bonding is 5 residues apart). */\r\n HELIX_PI: 'I',\r\n /** A generic helix of unspecified bonding distance. */\r\n HELIX: 'X',\r\n\r\n /** An isolated 3/10-like helical turn. */\r\n TURN_310: '3',\r\n /** An isolated alpha-like helical turn. */\r\n TURN_ALPHA: '4',\r\n /** An isolated pi-like helical turn. */\r\n TURN_PI: '5',\r\n /** An isolated helical [turn](https://en.wikipedia.org/wiki/Turn_(biochemistry)) of unspecified bonding distance. */\r\n TURN: 'T',\r\n\r\n /** A bend (a region of high curvature). */\r\n BEND: 'S',\r\n /** Just a protein section with no particular conformation. */\r\n COIL: 'C',\r\n};\r\n\r\n/**\r\n * Generic type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Type\r\n */\r\nStructuralElement.Generic = {\r\n /** A strand of a sheet. */\r\n STRAND: 'strand',\r\n /** A helix. */\r\n HELIX: 'helix',\r\n /** Just a protein section with no particular conformation. */\r\n LOOP: 'loop',\r\n};\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\nconst StructuralElementGeneric = StructuralElement.Generic;\r\n\r\n/**\r\n * A mapping from specific types to generic ones.\r\n * @type {Object}\r\n */\r\nStructuralElement.genericByType = {\r\n [StructuralElementType.STRAND]: StructuralElementGeneric.STRAND,\r\n [StructuralElementType.HELIX_310]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_ALPHA]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_PI]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX]: StructuralElementGeneric.HELIX,\r\n};\r\n\r\nexport default StructuralElement;\r\n","import StructuralElement from './StructuralElement';\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\nexport const typeByPDBHelixClass = {\r\n 1: StructuralElementType.HELIX_ALPHA,\r\n 3: StructuralElementType.HELIX_PI,\r\n 5: StructuralElementType.HELIX_310,\r\n};\r\n\r\n/**\r\n * Helical secondary structure of a protein.\r\n * @extends StructuralElement\r\n */\r\nclass Helix extends StructuralElement {\r\n /**\r\n * Create a helix.\r\n *\r\n * @param {number} helixClass A helix class according to the\r\n * [PDB Format](http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX).\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} serial Serial number of the helix (see PDB Format).\r\n * @param {string} name Helix identifier (see PDB Format).\r\n * @param {string} comment Comment about this helix (see PDB Format).\r\n * @param {number} length Length of this helix, in residues (see PDB Format).\r\n */\r\n constructor(helixClass, init, term, serial, name, comment, length) {\r\n super(typeByPDBHelixClass[helixClass] || StructuralElement.Type.HELIX, init, term);\r\n\r\n /**\r\n * Serial number of the helix (see PDB Format).\r\n * @type {number}\r\n */\r\n this.serial = serial;\r\n /**\r\n * Helix identifier (see PDB Format).\r\n * @type {string}\r\n */\r\n this.name = name;\r\n /**\r\n * Comment about this helix (see PDB Format).\r\n * @type {string}\r\n */\r\n this.comment = comment;\r\n /**\r\n * Length of this helix, in residues (see PDB Format).\r\n * @type {number}\r\n */\r\n this.length = length;\r\n }\r\n}\r\n\r\nexport default Helix;\r\n","import StructuralElement from './StructuralElement';\r\n\r\n/**\r\n * A single strand of a sheet in a protein secondary structure.\r\n * @extends StructuralElement\r\n */\r\nclass Strand extends StructuralElement {\r\n /**\r\n * Create a strand.\r\n *\r\n * @param {Sheet} sheet Parent sheet this strand belongs to.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} sense Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @param {Atom} atomCur Atom in current strand (see PDB Format).\r\n * @param {Atom} atomPrev Atom in previous strand (see PDB Format).\r\n */\r\n constructor(sheet, init, term, sense, atomCur, atomPrev) {\r\n super(StructuralElement.Type.STRAND, init, term);\r\n\r\n /**\r\n * Parent sheet this strand belongs to.\r\n * @type {Sheet}\r\n */\r\n this.sheet = sheet;\r\n /**\r\n * Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @type {number}\r\n */\r\n this.sense = sense;\r\n /**\r\n * Atom in current strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomCur = atomCur;\r\n /**\r\n * Atom in previous strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomPrev = atomPrev;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n *\r\n * @override\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n super._finalize(serialAtomMap, residueHash, complex);\r\n\r\n let as = this.atomCur;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomCur = serialAtomMap[as];\r\n }\r\n as = this.atomPrev;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomPrev = serialAtomMap[as];\r\n }\r\n }\r\n}\r\n\r\nexport default Strand;\r\n","import Strand from './Strand';\r\n\r\n/**\r\n * Sheet secondary structure of a protein.\r\n *\r\n * @param {string} name -\r\n * @param {number} width -\r\n *\r\n * @exports Sheet\r\n * @constructor\r\n */\r\nclass Sheet {\r\n constructor(name, width) {\r\n this._name = name;\r\n this._width = width;\r\n\r\n this._strands = [];\r\n }\r\n\r\n // Getters and setters\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getWidth() {\r\n return this._width;\r\n }\r\n\r\n addStrand(strand) {\r\n this._strands.push(strand);\r\n this._width = this._strands.length;\r\n }\r\n\r\n addEmptyStrand() {\r\n this._strands.push(new Strand(null, null, null, null, null, null));\r\n }\r\n\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n const s = this._strands;\r\n for (let i = 0, n = s.length; i < n; ++i) {\r\n s[i]._finalize(serialAtomMap, residueHash, complex);\r\n }\r\n if (!this._width) {\r\n this._width = s.length;\r\n }\r\n if (s.length !== this._width) {\r\n throw new Error(`Sheet ${this._name} is inconsistent.`);\r\n }\r\n }\r\n}\r\n\r\nexport default Sheet;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Atom measurements.\r\n *\r\n * @param {string} id - SGroup id\r\n * @param {string} name - Name of the group\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n * @param {array} atoms - Atoms group consists of\r\n * @param {object} saveNode - XML node from file for saving\r\n *\r\n * @exports SGroup\r\n * @constructor\r\n */\r\nclass SGroup {\r\n constructor(id, name, position, atoms, saveNode) {\r\n this._id = id;\r\n this._name = name;\r\n this._position = position || new THREE.Vector3();\r\n this._atoms = atoms || [];\r\n this._charge = 0; // default group charge\r\n this._repeat = 1; // how many times group repeated: always > 0\r\n this._center = null;\r\n this.xmlNodeRef = saveNode || null;\r\n }\r\n\r\n /**\r\n * Get atom full name.\r\n * @returns {string} Atom full name.\r\n */\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getPosition() {\r\n return this._position;\r\n }\r\n\r\n getCentralPoint() {\r\n return this._center;\r\n }\r\n\r\n _rebuildSGroupOnAtomChange() {\r\n const nLimon = 100000000;\r\n if (this._center === null) {\r\n return; // nothing to do if we are not relative\r\n }\r\n\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n for (let j = 0, n = this._atoms.length; j < n; j++) {\r\n const aPos = this._atoms[j].position;\r\n bLow.set(Math.min(bLow.x, aPos.x), Math.min(bLow.y, aPos.y), Math.min(bLow.z, aPos.z));\r\n bHight.set(Math.max(bHight.x, aPos.x), Math.max(bHight.y, aPos.y), Math.max(bHight.z, aPos.z));\r\n }\r\n this._center.addVectors(bLow, bHight);\r\n this._center.multiplyScalar(0.5);\r\n }\r\n}\r\n\r\nexport default SGroup;\r\n","import utils from '../../utils';\r\n\r\n//----------------------------------------------------------------------------\r\nclass Range {\r\n constructor(min, max) {\r\n this.min = min;\r\n this.max = typeof max === 'undefined' ? min : max;\r\n }\r\n\r\n includes(value) {\r\n return this.min <= value && value <= this.max;\r\n }\r\n\r\n toString() {\r\n const { min, max } = this;\r\n return min === max ? String(min) : [min, max].join(':');\r\n }\r\n\r\n toJSON() {\r\n return [this.min, this.max];\r\n }\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\nclass List {\r\n constructor(arg) {\r\n if (arg instanceof this.constructor) {\r\n // delegate construction to a different class\r\n // eslint-disable-next-line no-constructor-return\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n }\r\n\r\n append(value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n }\r\n\r\n toString() {\r\n return this._values.join(',');\r\n }\r\n\r\n toJSON() {\r\n const values = this._values;\r\n const result = [];\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n result[i] = value.toJSON ? value.toJSON() : value;\r\n }\r\n return result;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nclass RangeList extends List {\r\n includes(value) {\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n if (list[i].includes(value)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nconst valuesArray = [];\r\n\r\nclass ValueList extends List {\r\n constructor(arg, upperOnly) {\r\n const list = super(arg);\r\n if (upperOnly) {\r\n this.upperOnly = true;\r\n const values = list._values;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n if (typeof value === 'string') {\r\n values[i] = value.toUpperCase();\r\n }\r\n }\r\n } else {\r\n this.upperOnly = false;\r\n }\r\n // return constructed object\r\n // eslint-disable-next-line no-constructor-return\r\n return list;\r\n }\r\n\r\n includes(value) {\r\n // we do not convert to upper case here for perfomance reasons\r\n // if list is upper case only, value must be converted before it is sent up to here\r\n return this._values.indexOf(value) !== -1;\r\n }\r\n\r\n toString() {\r\n // Quote values that are not correct identifiers\r\n const values = this._values;\r\n valuesArray.length = 0;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n valuesArray[i] = utils.correctSelectorIdentifier(String(values[i]));\r\n }\r\n return valuesArray.join(',');\r\n }\r\n\r\n _validate(value) {\r\n return (this.upperOnly && typeof value === 'string') ? value.toUpperCase() : value;\r\n }\r\n\r\n append(value) {\r\n super.append(this._validate(value));\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n super.remove(this._validate(value));\r\n return this;\r\n }\r\n}\r\n\r\nexport {\r\n Range,\r\n List,\r\n RangeList,\r\n ValueList,\r\n};\r\n","import { RangeList, ValueList } from './selectArgs';\r\n\r\n/** Base class for atom selectors. */\r\nclass Selector {\r\n toString() {\r\n return this.keyword;\r\n }\r\n\r\n toJSON() {\r\n return [this.name];\r\n }\r\n}\r\n\r\nSelector.prototype.name = 'Error';\r\nSelector.prototype.keyword = 'error';\r\n\r\n/** Base class for list-based atom selectors. */\r\nclass ListSelector extends Selector {\r\n constructor(list) {\r\n super();\r\n this.list = list;\r\n }\r\n\r\n toString() {\r\n return `${this.keyword} ${this.list}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.list.toJSON()];\r\n }\r\n}\r\n\r\nclass RangeListSelector extends ListSelector {\r\n constructor(arg) {\r\n super(new RangeList(arg));\r\n }\r\n}\r\n\r\nclass ValueListSelector extends ListSelector {\r\n constructor(arg, caseSensitive) {\r\n super(new ValueList(arg, !caseSensitive));\r\n }\r\n}\r\n\r\nclass NoneSelector extends Selector {\r\n includesAtom(_atom) {\r\n return false;\r\n }\r\n}\r\n\r\nNoneSelector.prototype.name = 'None';\r\nNoneSelector.prototype.keyword = 'none';\r\n\r\nclass AllSelector extends Selector {\r\n includesAtom(_atom) {\r\n return true;\r\n }\r\n}\r\n\r\nAllSelector.prototype.name = 'All';\r\nAllSelector.prototype.keyword = 'all';\r\n\r\nexport {\r\n Selector,\r\n ListSelector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n};\r\n","import { Selector, NoneSelector } from './selectorsBase';\r\n\r\n//----------------------------------------------------------------------------\r\n// Operators\r\n//----------------------------------------------------------------------------\r\nconst none = new NoneSelector();\r\n\r\nclass PrefixOperator extends Selector {\r\n constructor(rhs) {\r\n super();\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nPrefixOperator.prototype.priority = 1;\r\n\r\nclass InfixOperator extends Selector {\r\n constructor(lhs, rhs) {\r\n super();\r\n this.lhs = lhs || none;\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const lhs = this.lhs.priority && this.lhs.priority > this.priority ? `(${this.lhs})` : this.lhs;\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${lhs} ${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.lhs.toJSON(), this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nInfixOperator.prototype.priority = 1000;\r\n\r\nexport { PrefixOperator, InfixOperator };\r\n","import Atom from './Atom';\r\nimport ResidueType from './ResidueType';\r\nimport { parser } from '../utils/SelectionParser';\r\nimport { Range, RangeList, ValueList } from './selectors/selectArgs';\r\nimport { PrefixOperator, InfixOperator } from './selectors/selectOps';\r\nimport {\r\n Selector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n} from './selectors/selectorsBase';\r\n\r\nconst keywords = {};\r\n\r\n//----------------------------------------------------------------------------\r\n// Named selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineSelector(name, SelectorClass) {\r\n const keyword = name.toLowerCase();\r\n SelectorClass.prototype.keyword = keyword;\r\n SelectorClass.prototype.name = name;\r\n\r\n const factory = ((...args) => new SelectorClass(...args));\r\n factory.SelectorClass = SelectorClass;\r\n keywords[keyword] = factory;\r\n\r\n return SelectorClass;\r\n}\r\n\r\ndefineSelector('Serial', class SerialSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.serial);\r\n }\r\n});\r\n\r\ndefineSelector('Name', class NameSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.name);\r\n }\r\n});\r\n\r\ndefineSelector('AltLoc', class AltLocSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(String.fromCharCode(atom.location));\r\n }\r\n});\r\n\r\ndefineSelector('Elem', class ElemSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.element.name);\r\n }\r\n});\r\n\r\ndefineSelector('Residue', class ResidueSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._type._name);\r\n }\r\n});\r\n\r\ndefineSelector('Sequence', class SequenceSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._sequence);\r\n }\r\n});\r\n\r\ndefineSelector('ICode', class ICodeSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._icode);\r\n }\r\n});\r\n\r\ndefineSelector('ResIdx', class ResIdxSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._index);\r\n }\r\n});\r\n\r\ndefineSelector('Chain', class ChainSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._chain._name);\r\n }\r\n});\r\n\r\ndefineSelector('Hetatm', class HetatmSelector extends Selector {\r\n includesAtom(atom) {\r\n return atom.het;\r\n }\r\n});\r\n\r\ndefineSelector('PolarH', class PolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.HYDROGEN;\r\n }\r\n});\r\n\r\ndefineSelector('NonPolarH', class NonPolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.NONPOLARH;\r\n }\r\n});\r\n\r\ndefineSelector('All', AllSelector);\r\n\r\ndefineSelector('None', NoneSelector);\r\n\r\nconst NULL_SELECTOR = keywords.none();\r\n\r\n//----------------------------------------------------------------------------\r\n// Named operators\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineOperator(name, priority, OperatorClass) {\r\n OperatorClass.prototype.priority = priority;\r\n return defineSelector(name, OperatorClass);\r\n}\r\ndefineOperator('Not', 1, class NotOperator extends PrefixOperator {\r\n includesAtom(atom) {\r\n return !this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('And', 2, class AndOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) && this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('Or', 3, class OrOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) || this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\n//----------------------------------------------------------------------------\r\n// Flag selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction byResidueTypeFlag(flag, name) {\r\n return defineSelector(name, class extends Selector {\r\n includesAtom(atom) {\r\n return (atom.residue._type.flags & flag) !== 0;\r\n }\r\n });\r\n}\r\n\r\nbyResidueTypeFlag(ResidueType.Flags.PROTEIN, 'Protein');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC, 'Basic');\r\nbyResidueTypeFlag(ResidueType.Flags.ACIDIC, 'Acidic');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC | ResidueType.Flags.ACIDIC, 'Charged');\r\nbyResidueTypeFlag(ResidueType.Flags.POLAR, 'Polar');\r\nbyResidueTypeFlag(ResidueType.Flags.NONPOLAR, 'NonPolar');\r\nbyResidueTypeFlag(ResidueType.Flags.AROMATIC, 'Aromatic');\r\nbyResidueTypeFlag(ResidueType.Flags.NUCLEIC, 'Nucleic');\r\nbyResidueTypeFlag(ResidueType.Flags.PURINE, 'Purine');\r\nbyResidueTypeFlag(ResidueType.Flags.PYRIMIDINE, 'Pyrimidine');\r\nbyResidueTypeFlag(ResidueType.Flags.WATER, 'Water');\r\n\r\n//----------------------------------------------------------------------------\r\nconst selectors = Object.create(keywords);\r\n\r\nselectors.Selector = Selector;\r\nselectors.RangeListSelector = RangeListSelector;\r\nselectors.ValueListSelector = ValueListSelector;\r\nselectors.Range = Range;\r\nselectors.RangeList = RangeList;\r\nselectors.ValueList = ValueList;\r\nselectors.PrefixOperator = PrefixOperator;\r\nselectors.InfixOperator = InfixOperator;\r\nselectors.Context = Object.create({});\r\n\r\nselectors.GetSelector = function (key) {\r\n if (!selectors.Context.hasOwnProperty(key)) {\r\n const exc = { message: `selector ${key} is not registered` };\r\n throw exc;\r\n }\r\n return selectors.Context[key] || NULL_SELECTOR;\r\n};\r\n\r\nselectors.ClearContext = function () {\r\n Object.keys(selectors.Context).forEach((k) => { delete selectors.Context[k]; });\r\n};\r\n\r\nselectors.keyword = function (key) {\r\n return keywords[key.toLowerCase()] || keywords.none;\r\n};\r\n\r\nselectors.parse = function (str) {\r\n const res = {};\r\n try {\r\n res.selector = parser.parse(str);\r\n } catch (e) {\r\n res.selector = NULL_SELECTOR;\r\n res.error = e.message;\r\n }\r\n return res;\r\n};\r\n\r\nparser.yy = selectors;\r\nparser.yy.parseError = parser.parseError; // workaround for incorrect JISON parser generator for AMD module\r\n\r\nexport default selectors;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\n\r\n/**\r\n * Basic biological unit class.\r\n *\r\n * @exports BiologicalUnit\r\n * @constructor\r\n */\r\nclass BiologicalUnit {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._selector = selectors.keyword('All')();\r\n this._boundaries = {\r\n boundingBox: new THREE.Box3(),\r\n boundingSphere: new THREE.Sphere(),\r\n };\r\n }\r\n\r\n computeBoundaries() {\r\n const atoms = this._complex._atoms;\r\n const n = atoms.length;\r\n const selector = this._selector;\r\n\r\n const { boundingBox } = this._boundaries;\r\n boundingBox.makeEmpty();\r\n if (n === 1) {\r\n boundingBox.expandByPoint(atoms[0].position);\r\n const bbc = new THREE.Vector3();\r\n boundingBox.getCenter(bbc);\r\n const s = 2 * atoms[0].element.radius;\r\n boundingBox.setFromCenterAndSize(bbc, new THREE.Vector3(s, s, s));\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (selector.includesAtom(atoms[i])) {\r\n boundingBox.expandByPoint(atoms[i].position);\r\n }\r\n }\r\n }\r\n\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n if (n === 1) {\r\n this._boundaries.boundingSphere.set(center, atoms[0].element.radius);\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (!selector.includesAtom(atoms[i])) {\r\n continue;\r\n }\r\n const pos = atoms[i].position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n this._boundaries.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n }\r\n\r\n getTransforms() {\r\n return [];\r\n }\r\n\r\n getSelector() {\r\n return this._selector;\r\n }\r\n\r\n getBoundaries() {\r\n return this._boundaries;\r\n }\r\n\r\n finalize() {\r\n }\r\n}\r\n\r\nexport default BiologicalUnit;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\nimport BiologicalUnit from './BiologicalUnit';\r\n\r\n/**\r\n * Biological assembly.\r\n *\r\n * @exports Assembly\r\n * @constructor\r\n */\r\n\r\nclass Assembly extends BiologicalUnit {\r\n constructor(complex) {\r\n super(complex);\r\n this.chains = [];\r\n this.matrices = [];\r\n }\r\n\r\n computeBoundaries() {\r\n super.computeBoundaries();\r\n // fix up the boundaries\r\n const { matrices } = this;\r\n const oldCenter = this._boundaries.boundingSphere.center;\r\n const oldRad = this._boundaries.boundingSphere.radius;\r\n const boundingBox = this._boundaries.boundingBox = new THREE.Box3();\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = matrices.length; i < n; ++i) {\r\n boundingBox.expandByPoint(oldCenter.clone().applyMatrix4(matrices[i]));\r\n }\r\n\r\n const newRad = boundingBox.max.distanceTo(boundingBox.min) / 2 + oldRad;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n this._boundaries.boundingSphere = new THREE.Sphere().set(center, newRad);\r\n boundingBox.max.addScalar(oldRad);\r\n boundingBox.min.subScalar(oldRad);\r\n }\r\n\r\n /**\r\n * Mark a chain as belonging to this biological assembly.\r\n * @param {string} chain - chain identifier, usually a single letter\r\n */\r\n addChain(chain) {\r\n this.chains[this.chains.length] = chain;\r\n }\r\n\r\n /**\r\n * Add a transformation matrix.\r\n * @param {THREE.Matrix4} matrix - transformation matrix\r\n */\r\n addMatrix(matrix) {\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n getTransforms() {\r\n return this.matrices;\r\n }\r\n\r\n finalize() {\r\n if (this.chains.length > 0) {\r\n this._selector = selectors.keyword('Chain')(this.chains);\r\n } else {\r\n this._selector = selectors.keyword('None')();\r\n }\r\n }\r\n}\r\n\r\nexport default Assembly;\r\n","/**\r\n * This class represents connected component as a part of a complex.\r\n * WARNING! The whole component entity is build under the assumption that residues\r\n * are placed in the chains and complex in ascending order of indices\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n *\r\n * @exports Component\r\n * @constructor\r\n */\r\nclass Component {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._index = -1;\r\n this._residueIndices = [];\r\n this._cycles = [];\r\n this._subDivs = [];\r\n this._residueCount = 0;\r\n }\r\n\r\n getResidues() {\r\n return this._complex._residues;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residueCount;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._complex._residues;\r\n const resIdc = this._residueIndices;\r\n for (let idIdc = 0, idCount = resIdc.length; idIdc < idCount; ++idIdc) {\r\n for (let idx = resIdc[idIdc].start, last = resIdc[idIdc].end; idx <= last; ++idx) {\r\n process(residues[idx]);\r\n }\r\n }\r\n }\r\n\r\n setSubDivs(subDivs) {\r\n this._subDivs = subDivs;\r\n let curr = 0;\r\n const resIdc = [];\r\n let resCnt = 0;\r\n for (let i = 0, n = subDivs.length; i < n; ++i) {\r\n if (i === n - 1 || subDivs[i].end + 1 !== subDivs[i + 1].start) {\r\n const { start } = subDivs[curr];\r\n const { end } = subDivs[i];\r\n resIdc[resIdc.length] = {\r\n start,\r\n end,\r\n };\r\n resCnt += end - start + 1;\r\n curr = i + 1;\r\n }\r\n }\r\n\r\n this._residueIndices = resIdc;\r\n this._residueCount = resCnt;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._complex._bonds;\r\n\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue._component === this) {\r\n process(bond);\r\n }\r\n }\r\n }\r\n\r\n update() {\r\n this.forEachCycle((cycle) => {\r\n cycle.update();\r\n });\r\n }\r\n\r\n forEachAtom(process) {\r\n this.forEachResidue((residue) => {\r\n residue.forEachAtom(process);\r\n });\r\n }\r\n\r\n addCycle(cycle) {\r\n this._cycles.push(cycle);\r\n }\r\n\r\n forEachCycle(process) {\r\n const cycles = this._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n process(cycles[i]);\r\n }\r\n }\r\n\r\n markResidues() {\r\n const self = this;\r\n self.forEachResidue((residue) => {\r\n residue._component = self;\r\n });\r\n }\r\n\r\n _forEachSubChain(mask, process) {\r\n const residues = this._complex._residues;\r\n const subs = this._subDivs;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let idx = subs[i].start, last = subs[i].end; idx <= last; ++idx) {\r\n const currRes = residues[idx];\r\n if (mask & currRes._mask && currRes._isValid) {\r\n let end = idx + 1;\r\n for (; end <= last; ++end) {\r\n const endRes = residues[end];\r\n if (!(mask & endRes._mask && endRes._isValid)) {\r\n break;\r\n }\r\n }\r\n process(i, idx, end - 1);\r\n idx = end;\r\n }\r\n }\r\n }\r\n }\r\n\r\n getMaskedSequences(mask) {\r\n const subs = [];\r\n let idx = 0;\r\n this._forEachSubChain(mask, (_subIdx, start, end) => {\r\n subs[idx++] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n\r\n getMaskedSubdivSequences(mask) {\r\n const subs = [];\r\n let currIdx = -1;\r\n let lastSubIdx = -1;\r\n const subDivs = this._subDivs;\r\n\r\n this._forEachSubChain(mask, (subIdx, start, end) => {\r\n if (lastSubIdx !== subIdx) {\r\n ++currIdx;\r\n subs[currIdx] = {\r\n arr: [],\r\n boundaries: subDivs[subIdx],\r\n };\r\n lastSubIdx = subIdx;\r\n }\r\n subs[currIdx].arr[subs[currIdx].arr.length] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n}\r\n\r\nexport default Component;\r\n","import utils from '../utils';\r\n\r\nconst cMaxPairsForHashCode = 32;\r\nconst cHashTableSize = 1024 * 1024;\r\nconst cNumbersPerPair = 4;\r\nconst cMaxNeighbours = 14;\r\nconst cInvalidVal = -1;\r\n// 89237 is a large simple number, can be used for pseudo random hash code create\r\nconst cBigPrime = 89237;\r\n\r\nclass AtomPairs {\r\n constructor(maxPairsEstimate) {\r\n this.numPairs = 0;\r\n this.numMaxPairs = maxPairsEstimate;\r\n this.intBuffer = utils.allocateTyped(Int32Array, maxPairsEstimate * cNumbersPerPair);\r\n for (let i = 0; i < maxPairsEstimate * cNumbersPerPair; i++) {\r\n this.intBuffer[i] = cInvalidVal;\r\n }\r\n this.hashBuffer = utils.allocateTyped(Int32Array, cHashTableSize * cMaxPairsForHashCode);\r\n for (let i = 0; i < cHashTableSize * cMaxPairsForHashCode; i++) {\r\n this.hashBuffer[i] = cInvalidVal;\r\n }\r\n }\r\n\r\n /**\r\n * Destroy all pairs memory\r\n */\r\n destroy() {\r\n this.intBuffer = null;\r\n this.hashBuffer = null;\r\n }\r\n\r\n /**\r\n * Add pair of atoms to collection\r\n * @param {number} indexA - Index of the 1st vertex.\r\n * @param {number} indexB - Index of the 2nd vertex.\r\n */\r\n addPair(indexA, indexB) {\r\n const ia = (indexA < indexB) ? indexA : indexB;\r\n const ib = (indexA > indexB) ? indexA : indexB;\r\n const codeToAdd = ia + (ib << cMaxNeighbours);\r\n\r\n const hashCode = (ia + (ib * cBigPrime)) & (cHashTableSize - 1);\r\n let j = hashCode * cMaxPairsForHashCode;\r\n let apI = 0;\r\n for (; apI < cMaxPairsForHashCode; apI++) {\r\n const code = this.hashBuffer[j + apI];\r\n if (code === cInvalidVal) {\r\n break;\r\n }\r\n if (code === codeToAdd) {\r\n return false;\r\n }\r\n }\r\n // add this new hash code\r\n if (apI >= cMaxPairsForHashCode) {\r\n throw new Error('addPair: increase cMaxPairsForHashCode');\r\n }\r\n this.hashBuffer[j + apI] = codeToAdd;\r\n\r\n // actually add\r\n if (this.numPairs >= this.numMaxPairs) {\r\n throw new Error('addPair: increase num pairs');\r\n }\r\n j = this.numPairs * cNumbersPerPair;\r\n this.intBuffer[j] = ia;\r\n this.intBuffer[j + 1] = ib;\r\n this.intBuffer[j + 2] = codeToAdd;\r\n this.numPairs++;\r\n return true;\r\n }\r\n}\r\n\r\nexport default AtomPairs;\r\n","import AtomPairs from './AtomPairs';\r\nimport Bond from './Bond';\r\n\r\nconst cProfileBondBuilder = false;\r\nconst cEstBondsMultiplier = 4;\r\nconst cSpaceCode = 32;\r\nconst cBondTolerance = 0.45;\r\nconst cVMDTolerance = 0.6;\r\nconst cBondRadInJMOL = true;\r\nconst cEpsilon = 0.001;\r\n\r\n/**\r\n * Get radius used for building bonds.\r\n *\r\n * @param {Atom} atom - Atom object.\r\n * @returns {number} special value for bonding radius for this atom\r\n */\r\nfunction _getBondingRadius(atom) {\r\n const { element } = atom;\r\n if (element) {\r\n return element.radiusBonding;\r\n }\r\n throw new Error('_getBondingRadius: Logic error.');\r\n}\r\n\r\nfunction _isAtomEligible(atom) {\r\n // build for all non-hetatm and for hetatm without bonds\r\n return !atom.isHet() || (atom.bonds && atom.bonds.length === 0);\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Complex} complex molecular complex\r\n\r\n * @exports AutoBond\r\n * @constructor\r\n */\r\nclass AutoBond {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._maxRad = 1.8;\r\n const bBox = this._complex.getDefaultBoundaries().boundingBox;\r\n this._vBoxMin = bBox.min.clone();\r\n this._vBoxMax = bBox.max.clone();\r\n\r\n this._pairCollection = null;\r\n }\r\n\r\n /**\r\n * Add existing pairs of connectors (from pdb file after its reading)\r\n * @returns {number} 0\r\n */\r\n _addExistingPairs() {\r\n const atoms = this._complex.getAtoms();\r\n const numAtoms = atoms.length;\r\n let aInd = 0;\r\n const collection = this._pairCollection;\r\n\r\n for (; aInd < numAtoms; aInd++) {\r\n const { bonds } = atoms[aInd];\r\n const numBondsForAtom = bonds.length;\r\n for (let bInd = 0; bInd < numBondsForAtom; bInd++) {\r\n const bond = bonds[bInd];\r\n const indTo = bond._left.index;\r\n if (indTo === aInd) {\r\n collection.addPair(aInd, bond._right.index);\r\n }\r\n } // for (b) all bonds in atom\r\n } // for (a)\r\n return 0;\r\n }\r\n\r\n _findPairs() {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const atoms = this._complex._atoms;\r\n const atomsNum = atoms.length;\r\n const self = this;\r\n\r\n let rA;\r\n let isHydrogenA;\r\n let posA;\r\n let locationA;\r\n let atomA;\r\n\r\n const processAtom = function (atomB) {\r\n if (isHydrogenA && atomB.isHydrogen()) {\r\n return;\r\n }\r\n\r\n const locationB = atomB.location;\r\n if ((locationA !== cSpaceCode)\r\n && (locationB !== cSpaceCode)\r\n && (locationA !== locationB)) {\r\n return;\r\n }\r\n\r\n const dist2 = posA.distanceToSquared(atomB.position);\r\n const rB = atomB.element.radiusBonding;\r\n const maxAcceptable = cBondRadInJMOL ? rA + rB + cBondTolerance : cVMDTolerance * (rA + rB);\r\n\r\n if (dist2 > (maxAcceptable * maxAcceptable)) {\r\n return;\r\n }\r\n\r\n if (dist2 < cEpsilon) {\r\n return;\r\n }\r\n\r\n self._pairCollection.addPair(atomA.index, atomB.index);\r\n };\r\n\r\n for (let i = 0; i < atomsNum; ++i) {\r\n atomA = atoms[i];\r\n if (!_isAtomEligible(atomA)) {\r\n continue;\r\n }\r\n\r\n rA = atomA.element.radiusBonding;\r\n isHydrogenA = atomA.isHydrogen();\r\n posA = atomA.position;\r\n locationA = atomA.location;\r\n\r\n vw.forEachAtomWithinRadius(posA, 2 * this._maxRad + cBondTolerance, processAtom);\r\n }\r\n }\r\n\r\n _addPairs() {\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0, k = 0; i < this._pairCollection.numPairs; i++, k += 4) {\r\n const iA = this._pairCollection.intBuffer[k];\r\n const iB = this._pairCollection.intBuffer[k + 1];\r\n this._addPair(atoms[iA], atoms[iB]);\r\n }\r\n }\r\n\r\n _addPair(atomA, atomB) {\r\n const bondsA = atomA.bonds;\r\n const indexA = atomA.index;\r\n const indexB = atomB.index;\r\n for (let j = 0, numBonds = bondsA.length; j < numBonds; ++j) {\r\n const bond = bondsA[j];\r\n if (bond._left.index === indexB || bond._right.index === indexB) {\r\n return;\r\n }\r\n }\r\n const left = indexA < indexB ? atomA : atomB;\r\n const right = indexA < indexB ? atomB : atomA;\r\n const newBond = this._complex.addBond(left, right, 0, Bond.BondType.UNKNOWN, false);\r\n bondsA.push(newBond);\r\n atomB.bonds.push(newBond);\r\n }\r\n\r\n build() {\r\n if (cProfileBondBuilder) {\r\n console.time('Bonds Builder');\r\n }\r\n this._buildInner();\r\n\r\n if (cProfileBondBuilder) {\r\n console.timeEnd('Bonds Builder');\r\n }\r\n }\r\n\r\n _buildInner() {\r\n const atoms = this._complex._atoms;\r\n if (atoms.length < 2) {\r\n return;\r\n }\r\n if (atoms[0].index < 0) {\r\n throw new Error('AutoBond: Atoms in complex were not indexed.');\r\n }\r\n\r\n this._calcBoundingBox();\r\n this._pairCollection = new AtomPairs(atoms.length * cEstBondsMultiplier);\r\n this._addExistingPairs();\r\n this._findPairs();\r\n this._addPairs();\r\n }\r\n\r\n _calcBoundingBox() {\r\n const atoms = this._complex._atoms;\r\n const nAtoms = atoms.length;\r\n let maxRad = _getBondingRadius(atoms[0]);\r\n for (let i = 1; i < nAtoms; ++i) {\r\n maxRad = Math.max(maxRad, _getBondingRadius(atoms[i]));\r\n }\r\n this._vBoxMax.addScalar(maxRad);\r\n this._vBoxMin.addScalar(-maxRad);\r\n this._maxRad = maxRad * 1.2;\r\n }\r\n\r\n destroy() {\r\n if (this._pairCollection) {\r\n this._pairCollection.destroy();\r\n }\r\n }\r\n}\r\n\r\nexport default AutoBond;\r\n","import * as THREE from 'three';\r\nimport Bond from './Bond';\r\nimport Element from './Element';\r\n\r\nconst cCrossThresh = 0.1;\r\nconst cAromaticType = Bond.BondType.AROMATIC;\r\nconst cAromaticAtoms = [\r\n Element.ByName.C.number,\r\n Element.ByName.N.number,\r\n // Element.ByName.O.number,\r\n // Element.ByName.S.number,\r\n];\r\n\r\n/** Conditions for bonds:\r\n * - Cross product with each subsequent bond to add is collinear and point to the same direction\r\n * - Each pair of a adjacent bonds belong to not more than one cycle\r\n * - If there is more than one candidates we try them in ascending order of angle values\r\n */\r\n\r\nconst _coDirVectors = (function () {\r\n const v1Tmp = new THREE.Vector3();\r\n const v2Tmp = new THREE.Vector3();\r\n const cp = new THREE.Vector3();\r\n return function (v1, v2) {\r\n v1Tmp.copy(v1).normalize();\r\n v2Tmp.copy(v2).normalize();\r\n cp.crossVectors(v1Tmp, v2Tmp);\r\n if (cp.length() > cCrossThresh) {\r\n return false;\r\n }\r\n // zero vector in out terms must be collinear to any\r\n return v1Tmp.dot(v2Tmp) >= 0;\r\n };\r\n}());\r\n\r\nfunction _insertAscending(arr, val) {\r\n let idx = 0;\r\n while (idx < arr.length && arr[idx] < val) {\r\n ++idx;\r\n }\r\n arr.splice(idx, 0, val);\r\n}\r\n\r\nfunction _anotherAtom(bond, currAtom) {\r\n return bond._left === currAtom ? bond._right : bond._left;\r\n}\r\n\r\nfunction _cosBetween(v1, v2) {\r\n const theta = v1.dot(v2) / (Math.sqrt(v1.lengthSq() * v2.lengthSq()));\r\n return THREE.MathUtils.clamp(theta, -1, 1);\r\n}\r\n\r\nfunction _markAromatic(bond) {\r\n bond._type = cAromaticType;\r\n}\r\n\r\nclass Cycle {\r\n constructor(atomsList) {\r\n this.atoms = atomsList;\r\n this.update();\r\n }\r\n\r\n update() {\r\n const { atoms } = this;\r\n const center = new THREE.Vector3();\r\n const nA = atoms.length;\r\n for (let j = 0; j < nA; ++j) {\r\n center.add(atoms[j].position);\r\n }\r\n center.multiplyScalar(1.0 / nA);\r\n this.center = center;\r\n this.radius = center.distanceTo(atoms[0].position.clone().lerp(atoms[1].position, 0.5));\r\n }\r\n\r\n forEachBond(process) {\r\n const { atoms } = this;\r\n const nA = atoms.length;\r\n let currAtom = atoms[0];\r\n let nextAtom;\r\n\r\n function checkBond(bond) {\r\n if (bond._left === nextAtom || bond._right === nextAtom) {\r\n process(bond);\r\n }\r\n }\r\n\r\n for (let i = 0; i < nA; ++i) {\r\n nextAtom = atoms[(i + 1) % nA];\r\n currAtom.forEachBond(checkBond);\r\n currAtom = nextAtom;\r\n }\r\n }\r\n}\r\n\r\nfunction _isAromatic(bond) {\r\n return bond._type === cAromaticType;\r\n}\r\n\r\nfunction _isPossibleAromatic(bond) {\r\n if (bond.type === cAromaticType) {\r\n return true;\r\n }\r\n const rightIdx = cAromaticAtoms.indexOf(bond._right.element.number);\r\n const leftIdx = cAromaticAtoms.indexOf(bond._left.element.number);\r\n return rightIdx !== -1 && leftIdx !== -1;\r\n}\r\n\r\nfunction _checkCycleSimple(cycle) {\r\n return cycle.length > 3;\r\n}\r\n\r\nfunction _checkCycleComplex(cycle) {\r\n console.assert(cycle.length > 2);\r\n return true;\r\n}\r\n\r\nclass AromaticLoopsMarker {\r\n constructor(complex) {\r\n this._complex = complex;\r\n const bondsData = new Array(complex._bonds.length);\r\n const bondMarks = new Array(complex._bonds.length);\r\n for (let i = 0, n = bondsData.length; i < n; ++i) {\r\n bondsData[i] = [];\r\n bondMarks[i] = false;\r\n }\r\n this._bondsData = bondsData;\r\n this._bondMarks = bondMarks;\r\n this._resetCycles();\r\n }\r\n\r\n _resetCycles() {\r\n this._cycles = [];\r\n this._currIdx = -1;\r\n }\r\n\r\n _haveSameCycle(bondsData, bond1, bond2) {\r\n const arr1 = bondsData[bond1._index];\r\n const arr2 = bondsData[bond2._index];\r\n const n1 = arr1.length;\r\n const n2 = arr2.length;\r\n let i1 = 0;\r\n let i2 = 0;\r\n while (i1 < n1 && i2 < n2) {\r\n if (arr1[i1] === arr2[i2]) {\r\n return true;\r\n }\r\n if (arr1[i1] > arr2[i2]) {\r\n ++i2;\r\n } else {\r\n ++i1;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _tryBond(prevBond, currRight, currDir) {\r\n const bondsOrder = [];\r\n const bondsData = this._bondsData;\r\n const currLeft = _anotherAtom(prevBond, currRight);\r\n const currVec = currRight.position.clone().sub(currLeft.position);\r\n const startAtomRef = this._currStart;\r\n const self = this;\r\n const bondMarks = this._bondMarks;\r\n let checkAromatic = this._checkBond;\r\n bondMarks[prevBond._index] = true;\r\n checkAromatic = checkAromatic === undefined ? _isAromatic : checkAromatic;\r\n currRight.forEachBond((newBond) => {\r\n if (!checkAromatic(newBond)\r\n || newBond === prevBond\r\n || bondMarks[newBond._index]\r\n || self._haveSameCycle(bondsData, prevBond, newBond)) {\r\n return;\r\n }\r\n const anotherAtom = _anotherAtom(newBond, currRight);\r\n const anotherVec = anotherAtom.position.clone().sub(currRight.position);\r\n const val = anotherAtom === startAtomRef ? -2.0 : 1 - _cosBetween(currVec, anotherVec);\r\n const newDir = anotherVec.cross(currVec);\r\n if (!_coDirVectors(newDir, currDir)) {\r\n return;\r\n }\r\n let idx = 0;\r\n while (idx < bondsOrder.length && bondsOrder[idx].val < val) {\r\n ++idx;\r\n }\r\n bondsOrder.splice(idx, 0, { bond: newBond, val, dir: newDir });\r\n });\r\n\r\n for (let i = 0, n = bondsOrder.length; i < n; ++i) {\r\n const { bond } = bondsOrder[i];\r\n const newRight = bond._left === currRight ? bond._right : bond._left;\r\n if (newRight === startAtomRef) {\r\n ++this._currIdx;\r\n this._cycles.push([currRight]);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n if (this._tryBond(bond, newRight, bondsOrder[i].dir)) {\r\n _insertAscending(bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(currRight);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n }\r\n bondMarks[prevBond._index] = false;\r\n return false;\r\n }\r\n\r\n _startCycle(bond) {\r\n // start from left to right\r\n this._currStart = bond._left;\r\n if (this._tryBond(bond, bond._right, new THREE.Vector3())) {\r\n _insertAscending(this._bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(bond._left);\r\n }\r\n }\r\n\r\n _findLoops(checkBond, checkCycle) {\r\n this._checkBond = checkBond;\r\n const complex = this._complex;\r\n const self = this;\r\n\r\n complex.forEachComponent((component) => {\r\n self._resetCycles();\r\n component.forEachBond((bond) => {\r\n if (checkBond(bond)) {\r\n self._startCycle(bond);\r\n }\r\n });\r\n const cycles = self._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n const cycle = cycles[i];\r\n if (!checkCycle(cycle)) {\r\n continue;\r\n }\r\n const newCycle = new Cycle(cycle);\r\n newCycle.forEachBond(_markAromatic);\r\n component.addCycle(newCycle);\r\n }\r\n });\r\n }\r\n\r\n markCycles() {\r\n this._findLoops(_isAromatic, _checkCycleSimple);\r\n }\r\n\r\n detectCycles() {\r\n this._findLoops(_isPossibleAromatic, _checkCycleComplex);\r\n }\r\n}\r\n\r\nexport default AromaticLoopsMarker;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\n/**\r\n * Calculate min & max radius of a sphere slice between zMin & zMax\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {number} zMin - lower bound of the slice\r\n * @param {number} zMax - upper bound of the slice\r\n */\r\nfunction _getSphereSliceRadiusRange(center, radius, zMin, zMax) {\r\n const dzMin = zMin - center.z;\r\n const dzMax = zMax - center.z;\r\n const rzMin = Math.sqrt(Math.max(radius * radius - dzMin * dzMin, 0.0));\r\n const rzMax = Math.sqrt(Math.max(radius * radius - dzMax * dzMax, 0.0));\r\n\r\n const rMin = Math.min(rzMin, rzMax);\r\n let rMax;\r\n\r\n if (zMin <= center.z && zMax >= center.z) {\r\n // sphere's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(rzMin, rzMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * Calculate min & max radius of a circle slice between yMin & yMax.\r\n *\r\n * To maintain analogy with _getSphereSliceRadiusRange we call radius what in fact is\r\n * half-width (along X axis) of the slice, i.e. 1D-sphere radius.\r\n *\r\n * @param {Vector3} center - center of the circle (z can be ignored)\r\n * @param {number} radius - circle radius\r\n * @param {number} yMin - lower bound of the slice\r\n * @param {number} yMax - upper bound of the slice\r\n * @returns {Array} - array of two numbers (min & max radius, or half-width)\r\n */\r\nfunction _getCircleSliceRadiusRange(center, radius, yMin, yMax) {\r\n const dyMin = yMin - center.y;\r\n const dyMax = yMax - center.y;\r\n const ryMin = Math.sqrt(Math.max(radius * radius - dyMin * dyMin, 0.0));\r\n const ryMax = Math.sqrt(Math.max(radius * radius - dyMax * dyMax, 0.0));\r\n\r\n const rMin = Math.min(ryMin, ryMax);\r\n let rMax;\r\n\r\n if (yMin <= center.y && yMax >= center.y) {\r\n // slice's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(ryMin, ryMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * VoxelWorld constructor\r\n *\r\n * @param {Box3} box - bounding box of the volume to be partitioned\r\n * @param {Vector3} vCellSizeHint - target voxel size (actual voxel size may differ from this)\r\n */\r\nclass VoxelWorld {\r\n constructor(box, vCellSizeHint) {\r\n this._box = box.clone();\r\n const size = new THREE.Vector3();\r\n box.getSize(size);\r\n this._count = size.clone().divide(vCellSizeHint).floor().max(new THREE.Vector3(1, 1, 1));\r\n this._last = this._count.clone().subScalar(1);\r\n this._cellSize = size.clone().divide(this._count);\r\n this._cellInnerR = 0.5 * Math.min(Math.min(this._cellSize.x, this._cellSize.y), this._cellSize.z);\r\n this._cellOuterR = 0.5 * Math.sqrt(this._cellSize.dot(this._cellSize));\r\n\r\n // array of voxels, each element contains index of first atom in voxel\r\n const numVoxels = this._count.x * this._count.y * this._count.z;\r\n this._voxels = utils.allocateTyped(Int32Array, numVoxels);\r\n for (let i = 0; i < numVoxels; ++i) {\r\n this._voxels[i] = -1;\r\n }\r\n\r\n // array of atoms that stores multiple single-linked lists\r\n // two elements for each atom: Atom ref, index of next atom (in this array\r\n this._atoms = [];\r\n }\r\n\r\n /**\r\n * Add all atoms from a complex to voxel world\r\n *\r\n * @param {Complex} complex - complex\r\n */\r\n addAtoms(complex) {\r\n const self = this;\r\n\r\n let idx = this._atoms.length;\r\n\r\n // resize array of atoms\r\n this._atoms.length += 2 * complex.getAtomCount();\r\n\r\n complex.forEachAtom((atom) => {\r\n // find which voxel contains this atom\r\n const voxelIdx = self._findVoxel(atom.position);\r\n\r\n // push current atom to the head of voxel's atom list\r\n self._atoms[idx] = atom;\r\n self._atoms[idx + 1] = self._voxels[voxelIdx];\r\n self._voxels[voxelIdx] = idx;\r\n\r\n idx += 2;\r\n });\r\n }\r\n\r\n /**\r\n * Get voxel that contains specified 3D point (we use clamp at the edges)\r\n *\r\n * @param {Vector3} point - a point in 3D\r\n * @returns {number} - index of voxel\r\n */\r\n static _zero = new THREE.Vector3(0, 0, 0);\r\n\r\n static _voxel = new THREE.Vector3();\r\n\r\n _findVoxel(point) {\r\n const zero = VoxelWorld._zero;\r\n const voxel = VoxelWorld._voxel;\r\n voxel.copy(point)\r\n .sub(this._box.min)\r\n .divide(this._cellSize)\r\n .floor()\r\n .clamp(zero, this._last);\r\n return voxel.x + this._count.x * (voxel.y + this._count.y * voxel.z);\r\n }\r\n\r\n /**\r\n * Call a function for each atom in voxel\r\n *\r\n * @param {number} voxel - index of voxel\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomInVoxel(voxel, process) {\r\n for (let i = this._voxels[voxel]; i >= 0; i = this._atoms[i + 1]) {\r\n process(this._atoms[i]);\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _xRange = new THREE.Vector2();\r\n\r\n static _yRange = new THREE.Vector2();\r\n\r\n static _zRange = new THREE.Vector2();\r\n\r\n _forEachVoxelWithinRadius(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n\r\n // switch to a faster method unless cell size is much smaller than sphere radius\r\n if (radius / this._cellInnerR < 10) {\r\n this._forEachVoxelWithinRadiusSimple(center, radius, process);\r\n return;\r\n }\r\n\r\n let rRangeXY;\r\n let rRangeX;\r\n let xVal;\r\n let yVal;\r\n let zVal;\r\n let isInsideX;\r\n let isInsideY;\r\n let isInsideZ;\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor()\r\n .clampScalar(0, this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n\r\n isInsideZ = (center.z - radius <= zVal[0]) && (zVal[1] <= center.z + radius);\r\n\r\n rRangeXY = _getSphereSliceRadiusRange(center, radius, zVal[0], zVal[1]);\r\n\r\n yRange.set(center.y - rRangeXY[1], center.y + rRangeXY[1]);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor()\r\n .clampScalar(0, this._count.y - 1);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n\r\n isInsideY = (center.y - rRangeXY[0] <= yVal[0]) && (yVal[1] <= center.y + rRangeXY[0]);\r\n\r\n rRangeX = _getCircleSliceRadiusRange(center, rRangeXY[1], yVal[0], yVal[1]);\r\n\r\n xRange.set(center.x - rRangeX[1], center.x + rRangeX[1]);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor()\r\n .clampScalar(0, this._count.x - 1);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n isInsideX = (center.x - rRangeX[0] <= xVal[0]) && (xVal[1] <= center.x + rRangeX[0]);\r\n\r\n process(x + this._count.x * (y + this._count.y * z), isInsideX && isInsideY && isInsideZ);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n * This is a version of method that doesn't try to \"calculate\" what voxels fall inside radius\r\n * but instead just checks all voxels inside sphere's bounding box. This should be faster\r\n * unless cell size is much smaller than sphere radius.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _vCenter = new THREE.Vector3();\r\n\r\n _forEachVoxelWithinRadiusSimple(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n const vCenter = VoxelWorld._vCenter;\r\n\r\n const distTouch2 = (radius + this._cellOuterR) * (radius + this._cellOuterR);\r\n let distInside2 = -1.0;\r\n if (radius > this._cellOuterR) {\r\n distInside2 = (radius - this._cellOuterR) * (radius - this._cellOuterR);\r\n }\r\n\r\n // calculate bounding box for the sphere\r\n xRange.set(center.x - radius, center.x + radius);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor();\r\n xRange.x = Math.min(Math.max(xRange.x, 0), this._count.x - 1);\r\n xRange.y = Math.min(Math.max(xRange.y, 0), this._count.x - 1);\r\n\r\n yRange.set(center.y - radius, center.y + radius);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor();\r\n yRange.x = Math.min(Math.max(yRange.x, 0), this._count.y - 1);\r\n yRange.y = Math.min(Math.max(yRange.y, 0), this._count.y - 1);\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor();\r\n zRange.x = Math.min(Math.max(zRange.x, 0), this._count.z - 1);\r\n zRange.y = Math.min(Math.max(zRange.y, 0), this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n const zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n vCenter.z = 0.5 * (zVal[0] + zVal[1]);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n const yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n vCenter.y = 0.5 * (yVal[0] + yVal[1]);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n const xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n vCenter.x = 0.5 * (xVal[0] + xVal[1]);\r\n\r\n const d2 = center.distanceToSquared(vCenter);\r\n if (d2 <= distTouch2) {\r\n process(x + this._count.x * (y + this._count.y * z), d2 <= distInside2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each atom within given sphere\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinRadius(center, radius, process) {\r\n const self = this;\r\n const r2 = radius * radius;\r\n\r\n self._forEachVoxelWithinRadius(center, radius, (voxel, isInside) => {\r\n if (isInside) {\r\n self._forEachAtomInVoxel(voxel, process);\r\n } else {\r\n self._forEachAtomInVoxel(voxel, (atom) => {\r\n if (center.distanceToSquared(atom.position) <= r2) {\r\n process(atom);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by mask\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} mask - bit mask\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromMasked(complex, mask, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by selector\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} selector - selector\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromSelected(complex, selector, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms\r\n *\r\n * @param {function} forEachAtom - enumerator of atoms in the group\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) {\r\n const self = this;\r\n const r2 = dist * dist;\r\n\r\n const voxels = [];\r\n const atoms = [];\r\n let idx = 0;\r\n\r\n // build \"within radius\" atom list for each voxel\r\n forEachAtom((atom) => {\r\n self._forEachVoxelWithinRadius(atom.position, dist, (voxel, isInside) => {\r\n if (isInside) {\r\n // this voxel is inside circle -- no check will be required\r\n voxels[voxel] = -1;\r\n } else if (typeof voxels[voxel] === 'undefined') {\r\n // this voxel isn't covered yet -- start building list of atoms\r\n atoms.push(atom);\r\n atoms.push(-1);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n } else if (voxels[voxel] !== -1) {\r\n // this voxel has a list of atoms required for distance check -- add atom to the list\r\n atoms.push(atom);\r\n atoms.push(voxels[voxel]);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n }\r\n });\r\n });\r\n\r\n let voxel;\r\n\r\n const processIfWithin = function (atom) {\r\n if (typeof voxels[voxel] === 'undefined') {\r\n return;\r\n }\r\n\r\n idx = voxels[voxel];\r\n if (idx === -1) {\r\n // this voxel is fully covered\r\n process(atom);\r\n return;\r\n }\r\n\r\n // check distance to each atom within radius from this voxel\r\n for (; idx >= 0; idx = atoms[idx + 1]) {\r\n if (atom.position.distanceToSquared(atoms[idx].position) < r2) {\r\n process(atom);\r\n break;\r\n }\r\n }\r\n };\r\n\r\n // for each marked voxel\r\n for (voxel in voxels) {\r\n if (voxels.hasOwnProperty(voxel)) {\r\n self._forEachAtomInVoxel(voxel, processIfWithin);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default VoxelWorld;\r\n","import ResidueType from './ResidueType';\r\nimport PairCollection from './AtomPairs';\r\n\r\nconst MINIMAL_DISTANCE = 0.5;\r\nconst MIN_HBOND_ENERGY = -9.9;\r\nconst MAX_HBOND_ENERGY = -0.5;\r\nconst COUPLING_CONSTANT = -27.888; // = -332 * 0.42 * 0.2\r\nconst MAX_COUPLING_DISTANCE = 5.0; // how far is the closest atom of a potential partner residue from CA atom\r\nconst MAX_RESIDUES_THRESHOLD = 1000;\r\n\r\nexport default class HBondInfo {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._hbonds = []; // array of bond info for each residue\r\n if (this._complex._residues.length > MAX_RESIDUES_THRESHOLD) {\r\n this._buildVW(); // optimized version using voxel grid\r\n } else {\r\n this._build(); // test all pairs of residues\r\n }\r\n }\r\n\r\n isBond(from, to) {\r\n if (this._hbonds[from]) {\r\n const [acc0, acc1] = this._hbonds[from].acceptor;\r\n if (acc0 && acc0.residue === to && acc0.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n if (acc1 && acc1.residue === to && acc1.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n\r\n for (let i = 0; i < this._complex._residues.length - 1; ++i) {\r\n const ri = this._complex._residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let preri = null;\r\n if (i > 0 && (this._complex._residues[i - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && ri._sequence === this._complex._residues[i - 1]._sequence + 1) {\r\n preri = this._complex._residues[i - 1];\r\n }\r\n\r\n for (let j = i + 1; j < this._complex._residues.length; ++j) {\r\n const rj = this._complex._residues[j];\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = null;\r\n if ((this._complex._residues[j - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && rj._sequence === this._complex._residues[j - 1]._sequence + 1) {\r\n prerj = this._complex._residues[j - 1];\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (j !== i + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _buildVW() {\r\n const self = this;\r\n const residues = this._complex._residues;\r\n let ri;\r\n let preri;\r\n\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const pairs = new PairCollection(this._complex._residues.length * this._complex._residues.length / 2);\r\n\r\n function processAtom(atom) {\r\n const rj = atom.residue;\r\n\r\n if (rj._index === ri._index) {\r\n return;\r\n }\r\n\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n return;\r\n }\r\n\r\n if (!pairs.addPair(ri._index, rj._index)) {\r\n // we've seen this pair\r\n return;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = rj._index > 0 ? residues[rj._index - 1] : null;\r\n if (prerj\r\n && ((prerj.getType().flags & ResidueType.Flags.PROTEIN) === 0 || rj._sequence !== prerj._sequence + 1)) {\r\n prerj = null;\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (rj._index !== ri._index + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n\r\n for (let i = 0; i < residues.length - 1; ++i) {\r\n ri = residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n preri = i > 0 ? residues[i - 1] : null;\r\n if (preri\r\n && ((preri.getType().flags & ResidueType.Flags.PROTEIN) === 0 || ri._sequence !== preri._sequence + 1)) {\r\n preri = null;\r\n }\r\n\r\n vw.forEachAtomWithinRadius(this._residueGetCAlpha(ri), MAX_COUPLING_DISTANCE, processAtom);\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _residueGetCO(res) {\r\n let c = null;\r\n let o = null;\r\n\r\n res.forEachAtom((a) => {\r\n if (a.name === 'C') {\r\n c = a.position;\r\n } else if (a.name === 'O') {\r\n o = a.position;\r\n }\r\n });\r\n\r\n return [c, o];\r\n }\r\n\r\n // TODO Support hydrogen defined in complex\r\n _residueGetNH(prev, res) {\r\n const [c, o] = this._residueGetCO(prev);\r\n\r\n let n;\r\n res.forEachAtom((a) => {\r\n if (a.name === 'N') {\r\n n = a.position;\r\n }\r\n });\r\n\r\n if (c && o && n) {\r\n // calculate hydrogen position\r\n const h = c.clone();\r\n h.sub(o);\r\n h.multiplyScalar(1.0 / h.length());\r\n h.add(n);\r\n\r\n return [n, h];\r\n }\r\n\r\n return [null, null];\r\n }\r\n\r\n _calcHBondEnergy(predonor, donor, acceptor) {\r\n let result = 0;\r\n\r\n if (predonor === null) {\r\n return result;\r\n }\r\n\r\n if (donor.getType().getName() !== 'PRO') {\r\n const [n, h] = this._residueGetNH(predonor, donor);\r\n const [c, o] = this._residueGetCO(acceptor);\r\n\r\n if (n === null || h === null || c === null || o === null) {\r\n return result;\r\n }\r\n\r\n const distanceHO = h.distanceTo(o);\r\n const distanceHC = h.distanceTo(c);\r\n const distanceNC = n.distanceTo(c);\r\n const distanceNO = n.distanceTo(o);\r\n\r\n if (distanceHO < MINIMAL_DISTANCE || distanceHC < MINIMAL_DISTANCE\r\n || distanceNC < MINIMAL_DISTANCE || distanceNO < MINIMAL_DISTANCE) {\r\n result = MIN_HBOND_ENERGY;\r\n } else {\r\n result = COUPLING_CONSTANT / distanceHO - COUPLING_CONSTANT / distanceHC\r\n + COUPLING_CONSTANT / distanceNC - COUPLING_CONSTANT / distanceNO;\r\n }\r\n\r\n // DSSP compatibility mode:\r\n result = Math.round(result * 1000) / 1000;\r\n\r\n if (result < MIN_HBOND_ENERGY) {\r\n result = MIN_HBOND_ENERGY;\r\n }\r\n }\r\n\r\n // update donor\r\n if (typeof this._hbonds[donor._index] === 'undefined') {\r\n this._hbonds[donor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const donorInfo = this._hbonds[donor._index];\r\n\r\n if (donorInfo.acceptor.length < 2) {\r\n donorInfo.acceptor.push({\r\n residue: acceptor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (donorInfo.acceptor.length > 1) {\r\n if (result < donorInfo.acceptor[0].energy) {\r\n donorInfo.acceptor[1].residue = donorInfo.acceptor[0].residue;\r\n donorInfo.acceptor[1].energy = donorInfo.acceptor[0].energy;\r\n donorInfo.acceptor[0].residue = acceptor._index;\r\n donorInfo.acceptor[0].energy = result;\r\n } else if (result < donorInfo.acceptor[1].energy) {\r\n donorInfo.acceptor[1].residue = acceptor._index;\r\n donorInfo.acceptor[1].energy = result;\r\n }\r\n }\r\n\r\n // update acceptor\r\n if (typeof this._hbonds[acceptor._index] === 'undefined') {\r\n this._hbonds[acceptor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const accInfo = this._hbonds[acceptor._index];\r\n\r\n if (accInfo.donor.length < 2) {\r\n accInfo.donor.push({\r\n residue: donor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (accInfo.donor.length > 1) {\r\n if (result < accInfo.donor[0].energy) {\r\n accInfo.donor[1].residue = accInfo.donor[0].residue;\r\n accInfo.donor[1].energy = accInfo.donor[0].energy;\r\n accInfo.donor[0].residue = donor._index;\r\n accInfo.donor[0].energy = result;\r\n } else if (result < accInfo.donor[1].energy) {\r\n accInfo.donor[1].residue = donor._index;\r\n accInfo.donor[1].energy = result;\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n","import HBondInfo from './HBondInfo';\r\nimport ResidueType from './ResidueType';\r\n\r\nconst BridgeType = Object.freeze({\r\n NO_BRIDGE: 0,\r\n PARALLEL: 1,\r\n ANTI_PARALLEL: 2,\r\n});\r\n\r\nconst HelixFlag = Object.freeze({\r\n START: 1,\r\n MIDDLE: 2,\r\n END: 3,\r\n START_AND_END: 4,\r\n});\r\n\r\nconst StructureType = Object.freeze({\r\n STRAND: 'E',\r\n BRIDGE: 'B',\r\n HELIX_310: 'G',\r\n HELIX_ALPHA: 'H',\r\n HELIX_PI: 'I',\r\n TURN: 'T',\r\n BEND: 'S',\r\n LOOP: ' ',\r\n});\r\n\r\nexport default class SecondaryStructureMap {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._build();\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n this._hbonds = new HBondInfo(this._complex);\r\n this._ss = []; // DSSP map by residue\r\n\r\n // auxilliary data\r\n this._sheet = [];\r\n this._betaPartners = [];\r\n this._bend = [];\r\n for (let i = 0; i < this._complex.getResidues().length; ++i) {\r\n this._betaPartners[i] = [];\r\n }\r\n this._helixFlags = [];\r\n this._helixFlags[3] = [];\r\n this._helixFlags[4] = [];\r\n this._helixFlags[5] = [];\r\n\r\n // calculate peptide chain lengths\r\n this._chainLengths = [];\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i].getResidues();\r\n let len = 0;\r\n for (; len < chain.length; ++len) {\r\n if ((chain[len].getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n break;\r\n }\r\n }\r\n this._chainLengths[i] = len;\r\n }\r\n\r\n this._buildBetaSheets();\r\n\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n self._buildAlphaHelices(this._complex._chains[i].getResidues(), this._chainLengths[i], false);\r\n }\r\n }\r\n\r\n _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) {\r\n // Helix and Turn\r\n for (let stride = 3; stride <= 5; ++stride) {\r\n if (inResidues.length < stride) {\r\n break;\r\n }\r\n\r\n for (let i = 0; i + stride < chainLength; ++i) {\r\n if (this._hbonds.isBond(inResidues[i + stride]._index, inResidues[i]._index)\r\n /* && NoChainBreak(res[i], res[i + stride]) */) {\r\n this._helixFlags[stride][inResidues[i + stride]._index] = HelixFlag.END;\r\n for (let j = i + 1; j < i + stride; ++j) {\r\n if (typeof this._helixFlags[stride][inResidues[j]._index] === 'undefined') {\r\n this._helixFlags[stride][inResidues[j]._index] = HelixFlag.MIDDLE;\r\n }\r\n }\r\n\r\n if (this._helixFlags[stride][inResidues[i]._index] === HelixFlag.END) {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START_AND_END;\r\n } else {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 2; i < chainLength - 2; ++i) {\r\n const kappa = this._kappa(inResidues[i - 2], inResidues[i], inResidues[i + 2]);\r\n this._bend[inResidues[i]._index] = (kappa !== 360 && kappa > 70);\r\n }\r\n\r\n for (let i = 1; i + 4 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 4) && this._isHelixStart(inResidues[i - 1]._index, 4)) {\r\n for (let j = i; j <= i + 3; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_ALPHA;\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 3 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 3) && this._isHelixStart(inResidues[i - 1]._index, 3)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 2; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_310;\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 2; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_310;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 5 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 5) && this._isHelixStart(inResidues[i - 1]._index, 5)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 4; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_PI\r\n || (inPreferPiHelices && this._ss[inResidues[j]._index] === StructureType.HELIX_ALPHA);\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 4; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_PI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 1 < chainLength; ++i) {\r\n if (typeof this._ss[inResidues[i]._index] === 'undefined') {\r\n let isTurn = false;\r\n for (let stride = 3; stride <= 5 && !isTurn; ++stride) {\r\n for (let k = 1; k < stride && !isTurn; ++k) {\r\n isTurn = (i >= k) && this._isHelixStart(inResidues[i - k]._index, stride);\r\n }\r\n }\r\n\r\n if (isTurn) {\r\n this._ss[inResidues[i]._index] = StructureType.TURN;\r\n } else if (this._bend[inResidues[i]._index]) {\r\n this._ss[inResidues[i]._index] = StructureType.BEND;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _cosinusAngle(p1, p2, p3, p4) {\r\n const v12 = p1.clone().sub(p2);\r\n const v34 = p3.clone().sub(p4);\r\n\r\n let result = 0;\r\n\r\n const x = v12.dot(v12) * v34.dot(v34);\r\n if (x > 0) {\r\n result = v12.dot(v34) / Math.sqrt(x);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _kappa(prevPrev, res, nextNext) {\r\n const curCA = this._residueGetCAlpha(res);\r\n const ppCA = this._residueGetCAlpha(prevPrev);\r\n const nnCA = this._residueGetCAlpha(nextNext);\r\n if (curCA === null || ppCA === null || nnCA === null) {\r\n return 180;\r\n }\r\n\r\n const ckap = this._cosinusAngle(curCA, ppCA, nnCA, curCA);\r\n const skap = Math.sqrt(1 - ckap * ckap);\r\n return Math.atan2(skap, ckap) * 180 / Math.PI;\r\n }\r\n\r\n _isHelixStart(res, stride) {\r\n return (this._helixFlags[stride][res] === HelixFlag.START\r\n || this._helixFlags[stride][res] === HelixFlag.START_AND_END);\r\n }\r\n\r\n _buildBetaSheets() {\r\n // find bridges\r\n // check each chain against each other chain, and against itself\r\n const bridges = [];\r\n for (let a = 0; a < this._complex._chains.length; ++a) {\r\n const lenA = this._chainLengths[a];\r\n if (lenA <= 4) {\r\n continue;\r\n }\r\n\r\n const chainA = this._complex._chains[a].getResidues();\r\n\r\n for (let b = a; b < this._complex._chains.length; ++b) {\r\n const lenB = this._chainLengths[b];\r\n if (lenB <= 4) {\r\n continue;\r\n }\r\n\r\n const chainB = this._complex._chains[b].getResidues();\r\n\r\n for (let i = 1; i + 1 < lenA; ++i) {\r\n const ri = chainA[i];\r\n\r\n let j = 1;\r\n if (b === a) {\r\n j = i + 3; // check for self-bridges forward down the chain\r\n }\r\n\r\n for (; j + 1 < lenB; ++j) {\r\n const rj = chainB[j];\r\n\r\n const type = this._testBridge(chainA, i, chainB, j);\r\n if (type === BridgeType.NO_BRIDGE) {\r\n continue;\r\n }\r\n\r\n // there is a bridge, try to attach it to previously found sequence\r\n let found = false;\r\n for (const bridge of bridges) {\r\n if (type !== bridge.type || ri._index !== bridge.i[bridge.i.length - 1] + 1) {\r\n continue;\r\n }\r\n\r\n if (type === BridgeType.PARALLEL && bridge.j[bridge.j.length - 1] + 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.push(rj._index);\r\n found = true;\r\n break;\r\n }\r\n\r\n if (type === BridgeType.ANTI_PARALLEL && bridge.j[0] - 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.unshift(rj._index);\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n // this bridge cannot be attached anywhere, start a new sequence\r\n if (!found) {\r\n bridges.push({\r\n type,\r\n i: [ri._index],\r\n chainI: ri.getChain()._index,\r\n j: [rj._index],\r\n chainJ: rj.getChain()._index,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // extend ladders\r\n bridges.sort((a, b) => {\r\n if (a.chainI < b.chainI || (a.chainI === b.chainI && a.i[0] < b.i[0])) {\r\n return -1;\r\n }\r\n return 1;\r\n });\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n for (let j = i + 1; j < bridges.length; ++j) {\r\n const ibi = bridges[i].i[0];\r\n const iei = bridges[i].i[bridges[i].i.length - 1];\r\n const jbi = bridges[i].j[0];\r\n const jei = bridges[i].j[bridges[i].j.length - 1];\r\n const ibj = bridges[j].i[0];\r\n const iej = bridges[j].i[bridges[j].i.length - 1];\r\n const jbj = bridges[j].j[0];\r\n const jej = bridges[j].j[bridges[j].j.length - 1];\r\n\r\n if (bridges[i].type !== bridges[j].type\r\n || this._hasChainBreak(Math.min(ibi, ibj), Math.max(iei, iej))\r\n || this._hasChainBreak(Math.min(jbi, jbj), Math.max(jei, jej))\r\n || ibj - iei >= 6 || (iei >= ibj && ibi <= iej)) {\r\n continue;\r\n }\r\n\r\n let bulge = false;\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bulge = ((jbj - jei < 6 && ibj - iei < 3) || (jbj - jei < 3));\r\n } else {\r\n bulge = ((jbi - jej < 6 && ibj - iei < 3) || (jbi - jej < 3));\r\n }\r\n\r\n if (bulge) {\r\n bridges[i].i = bridges[i].i.concat(bridges[j].i);\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bridges[i].j = bridges[i].j.concat(bridges[j].j);\r\n } else {\r\n bridges[i].j = bridges[j].j.concat(bridges[i].j);\r\n }\r\n bridges.splice(j--, 1);\r\n }\r\n }\r\n }\r\n\r\n // Sheet\r\n const ladderset = new Set();\r\n for (let i = 0; i < bridges.length; ++i) {\r\n ladderset.add(bridges[i]);\r\n }\r\n\r\n let sheet = 1;\r\n let ladder = 0;\r\n while (ladderset.size > 0) {\r\n let bridge = ladderset.values().next().value;\r\n ladderset.delete(bridge);\r\n\r\n const sheetset = new Set();\r\n sheetset.add(bridge);\r\n\r\n let toMove;\r\n do {\r\n toMove = new Set();\r\n for (const a of sheetset.values()) {\r\n for (const b of ladderset.values()) {\r\n if (this._areBridgesLinked(a, b)) {\r\n toMove.add(b);\r\n }\r\n }\r\n }\r\n for (bridge of toMove.values()) {\r\n sheetset.add(bridge);\r\n ladderset.delete(bridge);\r\n }\r\n } while (toMove.size > 0);\r\n\r\n for (bridge of sheetset.values()) {\r\n bridge.ladder = ladder;\r\n bridge.sheet = sheet;\r\n bridge.link = sheetset;\r\n ++ladder;\r\n }\r\n\r\n ++sheet;\r\n }\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n const bridge = bridges[i];\r\n\r\n // find out if any of the i and j set members already have\r\n // a bridge assigned, if so, we're assigning bridge 2\r\n\r\n let betai = 0;\r\n let betaj = 0;\r\n\r\n for (let l = 0; l < bridge.i.length; ++l) {\r\n if (this._betaPartners[bridge.i[l]][0]) {\r\n betai = 1;\r\n break;\r\n }\r\n }\r\n\r\n for (let l = 0; l < bridge.j.length; ++l) {\r\n if (this._betaPartners[bridge.j[l]][0]) {\r\n betaj = 1;\r\n break;\r\n }\r\n }\r\n\r\n let ss = StructureType.BRIDGE;\r\n if (bridge.i.length > 1) {\r\n ss = StructureType.STRAND;\r\n }\r\n\r\n if (bridge.type === BridgeType.PARALLEL) {\r\n let j = 0;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n\r\n j = 0;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n } else {\r\n let j = bridge.j.length - 1;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n\r\n j = bridge.i.length - 1;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n }\r\n\r\n for (let k = bridge.i[0]; k <= bridge.i[bridge.i.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n\r\n for (let k = bridge.j[0]; k <= bridge.j[bridge.j.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _testBridge(chainA, from, chainB, to) {\r\n let result = BridgeType.NO_BRIDGE;\r\n\r\n const a = chainA[from - 1]._index;\r\n const b = chainA[from]._index;\r\n const c = chainA[from + 1]._index;\r\n const d = chainB[to - 1]._index;\r\n const e = chainB[to]._index;\r\n const f = chainB[to + 1]._index;\r\n\r\n const isBond = this._hbonds.isBond.bind(this._hbonds);\r\n if ((isBond(c, e) && isBond(e, a)) || (isBond(f, b) && isBond(b, d))) {\r\n result = BridgeType.PARALLEL;\r\n } else if ((isBond(c, d) && isBond(f, a)) || (isBond(e, b) && isBond(b, e))) {\r\n result = BridgeType.ANTI_PARALLEL;\r\n }\r\n return result;\r\n }\r\n\r\n // return true if any of the residues in bridge a is identical to any of the residues in bridge b\r\n _areBridgesLinked(a, b) {\r\n const ai = new Set(a.i);\r\n const aj = new Set(a.j);\r\n\r\n for (const i of b.i) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n for (const i of b.j) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n _hasChainBreak(from, to) {\r\n for (let i = from + 1; i <= to; ++i) {\r\n if (this._complex._residues[i]._sequence !== this._complex._residues[i - 1]._sequence + 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\nSecondaryStructureMap.StructureType = StructureType;\r\n","import * as THREE from 'three';\r\nimport logger from '../utils/logger';\r\nimport Atom from './Atom';\r\nimport Chain from './Chain';\r\nimport Helix from './Helix';\r\nimport Strand from './Strand';\r\nimport Sheet from './Sheet';\r\nimport Component from './Component';\r\nimport ResidueType from './ResidueType';\r\nimport Bond from './Bond';\r\nimport AutoBond from './AutoBond';\r\nimport AromaticLoopsMarker from './AromaticLoopsMarker';\r\nimport BiologicalUnit from './BiologicalUnit';\r\nimport selectors from './selectors';\r\nimport VoxelWorld from './VoxelWorld';\r\nimport SecondaryStructureMap from './SecondaryStructureMap';\r\nimport StructuralElement from './StructuralElement';\r\n\r\nconst VOXEL_SIZE = 5.0;\r\n\r\nconst { StructureType } = SecondaryStructureMap;\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX\r\nconst helixClassMap = {\r\n [StructureType.HELIX_ALPHA]: 1,\r\n [StructureType.HELIX_PI]: 3,\r\n [StructureType.HELIX_310]: 5,\r\n};\r\n\r\nconst loopMap = {\r\n [StructureType.BRIDGE]: StructuralElementType.BRIDGE,\r\n [StructureType.TURN]: StructuralElementType.TURN,\r\n [StructureType.BEND]: StructuralElementType.BEND,\r\n [StructureType.LOOP]: StructuralElementType.COIL,\r\n};\r\n\r\n/**\r\n * The entire complex of the molecules under study.\r\n *\r\n * @exports Complex\r\n * @constructor\r\n */\r\nclass Complex {\r\n constructor() {\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n\r\n this._residueTypes = Object.create(ResidueType.StandardTypes);\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n this._molecules = [];\r\n this._maskNeedsUpdate = false;\r\n\r\n this.metadata = {};\r\n\r\n this.symmetry = [];\r\n this.units = [new BiologicalUnit(this)];\r\n this._currentUnit = 0; // default biological unit is the asymmetric unit\r\n }\r\n\r\n addAtom(atom) {\r\n const index = this._atoms.length;\r\n this._atoms.push(atom);\r\n return index;\r\n }\r\n\r\n addSheet(sheet) {\r\n const index = this._sheets.length;\r\n this._sheets.push(sheet);\r\n return index;\r\n }\r\n\r\n addHelix(helix) {\r\n const index = this._helices.length;\r\n this._helices.push(helix);\r\n return index;\r\n }\r\n\r\n getAtoms() {\r\n return this._atoms;\r\n }\r\n\r\n getBonds() {\r\n return this._bonds;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n addResidue(residue) {\r\n const index = this._residues.length;\r\n this._residues.push(residue);\r\n return index;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n this.forEachChain((chain) => {\r\n chain.updateToFrame(frameData);\r\n });\r\n }\r\n\r\n addResidueType(resName) {\r\n const rt = this._residueTypes[resName] = new ResidueType(resName, 'Unknown', '');\r\n return rt;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n getSGroupCount() {\r\n return this._sgroups.length;\r\n }\r\n\r\n getSGroups() {\r\n return this._sgroups;\r\n }\r\n\r\n /*\r\n Extract atom by its fullname: #chainName#.#residueId#.#atomName#\r\n */\r\n getAtomByFullname(fullName) {\r\n const parts = fullName.split('.');\r\n if (parts.length !== 3) {\r\n return null;\r\n }\r\n\r\n const chainName = parts[0];\r\n const resId = parseInt(parts[1], 10);\r\n if (Number.isNaN(resId)) {\r\n return null;\r\n }\r\n const atomName = parts[2].toUpperCase();\r\n\r\n let currAtom = null;\r\n this.forEachChain((chain) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (chain._name.localeCompare(chainName) === 0) {\r\n chain.forEachResidue((residue) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (residue._sequence === resId) {\r\n residue.forEachAtom((atom) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (atomName.localeCompare(atom.name) === 0) {\r\n currAtom = atom;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n });\r\n\r\n return currAtom;\r\n }\r\n\r\n /**\r\n * Create a new chain.\r\n *\r\n * @param {string} name - Chain name.\r\n * @returns {Chain} - Newly created chain.\r\n */\r\n addChain(name) {\r\n const result = new Chain(this, name);\r\n this._chains.push(result);\r\n return result;\r\n }\r\n\r\n getChain(name) {\r\n for (let i = 0, n = this._chains.length; i < n; ++i) {\r\n const chain = this._chains[i];\r\n if (chain.getName() === name) {\r\n return chain;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n getChainCount() {\r\n return this._chains.length;\r\n }\r\n\r\n getMolecules() {\r\n return this._molecules;\r\n }\r\n\r\n getMoleculeCount() {\r\n return this._molecules.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n process(atoms[i]);\r\n }\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._bonds;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n forEachChain(process) {\r\n const chains = this._chains;\r\n for (let i = 0, n = chains.length; i < n; ++i) {\r\n process(chains[i]);\r\n }\r\n }\r\n\r\n forEachMolecule(process) {\r\n const molecules = this._molecules;\r\n const n = molecules.length;\r\n for (let i = 0; i < n; ++i) {\r\n process(molecules[i]);\r\n }\r\n }\r\n\r\n forEachSGroup(process) {\r\n const groups = this._sgroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n process(groups[i]);\r\n }\r\n }\r\n\r\n forEachComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n forEachVisibleComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n addBond(left, right, order, type, fixed) {\r\n const bond = new Bond(left, right, order, type, fixed);\r\n this._bonds.push(bond);\r\n return bond;\r\n }\r\n\r\n getBondCount() {\r\n return this._bonds.length;\r\n }\r\n\r\n getResidueType(name) {\r\n return this._residueTypes[name] || null;\r\n }\r\n\r\n getUnifiedSerial(chain, serial, iCode) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n return serial + iCode * maxSerial + chain * chainShift;\r\n }\r\n\r\n splitUnifiedSerial(uniSerial) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n const chainId = Math.floor(uniSerial / chainShift);\r\n const remnant = uniSerial - chainId * chainShift;\r\n const insCode = Math.floor(remnant / maxSerial);\r\n const ser = remnant - insCode * maxSerial;\r\n return { chain: chainId, serial: ser, iCode: insCode };\r\n }\r\n\r\n _fillCmpEdit() {\r\n const self = this;\r\n const components = this._components;\r\n\r\n function addComp() {\r\n const comp = new Component(self);\r\n comp._index = components.length;\r\n components[comp._index] = comp;\r\n return comp;\r\n }\r\n\r\n this.forEachChain((chain) => {\r\n const residues = chain._residues;\r\n const resCount = residues.length;\r\n if (resCount < 1) {\r\n return;\r\n }\r\n let comp = addComp();\r\n let currStart = residues[0]._index;\r\n\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)\r\n || currRes._index !== nextRes._index - 1) {\r\n // the last condition is broken and incorrect\r\n // the refactoring of the Component is required in order to fix this issue\r\n comp.setSubDivs([{\r\n start: currStart,\r\n end: currRes._index,\r\n }]);\r\n if (nextRes) {\r\n currStart = nextRes._index;\r\n comp = addComp();\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n // This function was added in the moment of despair\r\n // It was the dark times for miew\r\n _fillCmpNoedit() {\r\n const comp = new Component(this);\r\n comp._index = 0;\r\n\r\n const residues = this._residues;\r\n const resCount = residues.length;\r\n if (resCount === 0) {\r\n return;\r\n }\r\n\r\n const currSubDivs = [];\r\n let currStart = 0;\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)) {\r\n // wrap up this interval\r\n currSubDivs[currSubDivs.length] = {\r\n start: currStart,\r\n end: i,\r\n };\r\n if (nextRes) {\r\n currStart = i + 1;\r\n }\r\n }\r\n }\r\n\r\n comp.setSubDivs(currSubDivs);\r\n this._components[comp._index] = comp;\r\n }\r\n\r\n /**\r\n * Fill components information.\r\n * @param {boolean} enableEditing - Restructure Complex to enable per-component editing.\r\n */\r\n _fillComponents(enableEditing) {\r\n if (enableEditing) {\r\n this._fillCmpEdit();\r\n } else {\r\n this._fillCmpNoedit();\r\n }\r\n }\r\n\r\n getCurrentUnit() {\r\n return this._currentUnit;\r\n }\r\n\r\n getDefaultBoundaries() {\r\n return this.units[0].getBoundaries();\r\n }\r\n\r\n getBoundaries() {\r\n return this.units[this._currentUnit].getBoundaries();\r\n }\r\n\r\n getTransforms() {\r\n return this.units[this._currentUnit].getTransforms();\r\n }\r\n\r\n getSelector() {\r\n return this.units[this._currentUnit].getSelector();\r\n }\r\n\r\n resetCurrentUnit() {\r\n this._currentUnit = 0;\r\n this.setCurrentUnit(1);\r\n }\r\n\r\n setCurrentUnit(newUnit) {\r\n if (newUnit !== null && newUnit !== undefined\r\n && newUnit !== this._currentUnit\r\n && newUnit >= 0\r\n && newUnit < this.units.length) {\r\n this._currentUnit = newUnit;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n _computeBounds() {\r\n const { units } = this;\r\n for (let i = 0, n = units.length; i < n; ++i) {\r\n units[i].computeBoundaries();\r\n }\r\n }\r\n\r\n onAtomPositionChanged() {\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n this.forEachComponent((c) => {\r\n c.update();\r\n });\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n this._finalizeBonds();\r\n this.forEachSGroup((s) => {\r\n s._rebuildSGroupOnAtomChange();\r\n });\r\n }\r\n\r\n update() {\r\n if (this._maskNeedsUpdate) {\r\n this.updateStructuresMask();\r\n this._maskNeedsUpdate = false;\r\n }\r\n }\r\n\r\n _finalizeBonds() {\r\n const bonds = this.getBonds();\r\n const n = bonds.length;\r\n for (let i = 0; i < n; ++i) {\r\n bonds[i]._index = i;\r\n }\r\n }\r\n\r\n /**\r\n * Finalizes complex's inner data(i.e. after parsing).\r\n * @param {objects} opts - Build bonds automatically.\r\n * @param {boolean} opts.needAutoBonding - Build bonds automatically.\r\n * @param {boolean} opts.detectAromaticLoops - Find/mark aromatic loops.\r\n * @param {boolean} opts.enableEditing - Restructure Complex to enable per-component editing.\r\n * @param {Array} [opts.serialAtomMap] - Array of atoms ordered by their serials.\r\n */\r\n finalize(opts) {\r\n opts = opts || {};\r\n // Put bonds into atoms\r\n const bonds = this._bonds;\r\n let i;\r\n let n;\r\n // remove invalid bonds\r\n for (i = bonds.length - 1; i >= 0; i--) {\r\n const bond = bonds[i];\r\n if (bond._left === null || bond._right === null) {\r\n bonds.splice(i, 1);\r\n } else {\r\n bond._left.bonds.push(bond);\r\n bond._right.bonds.push(bond);\r\n }\r\n }\r\n\r\n const residues = this._residues;\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._finalize();\r\n }\r\n\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n\r\n // WARNING! this MUST be done BEFORE computeBounds is called\r\n const { units } = this;\r\n for (i = 0, n = units.length; i < n; ++i) {\r\n units[i].finalize();\r\n }\r\n // try setting first biomolecule by defaults\r\n this.setCurrentUnit(1);\r\n\r\n const residueHash = {};\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n // This code is extremely dangerous for non-PDB formats\r\n residueHash[this.getUnifiedSerial(\r\n res.getChain().getName().charCodeAt(0),\r\n res.getSequence(),\r\n res.getICode().charCodeAt(0),\r\n )] = res;\r\n }\r\n\r\n const { structures } = this;\r\n for (i = 0, n = structures.length; i < n; ++i) {\r\n structures[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const helices = this._helices;\r\n for (i = 0, n = helices.length; i < n; ++i) {\r\n helices[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const sheets = this._sheets;\r\n for (i = 0, n = sheets.length; i < n; ++i) {\r\n sheets[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n\r\n const atoms = this._atoms;\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const currAtom = atoms[i];\r\n currAtom.index = i;\r\n }\r\n\r\n if (opts.needAutoBonding) {\r\n const autoConnector = new AutoBond(this);\r\n autoConnector.build();\r\n autoConnector.destroy();\r\n }\r\n\r\n const chains = this._chains;\r\n for (i = 0, n = chains.length; i < n; ++i) {\r\n chains[i]._index = i;\r\n }\r\n\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._index = i;\r\n }\r\n\r\n // mark non-polar hydrogens\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n if (atom.flags & Atom.Flags.HYDROGEN && atom.bonds.length === 1) {\r\n const bond = atom.bonds[0];\r\n const other = (bond._left !== atom && bond._left) || bond._right;\r\n if (other.flags & Atom.Flags.CARBON) {\r\n atom.flags |= Atom.Flags.NONPOLARH;\r\n }\r\n }\r\n }\r\n\r\n this._finalizeBonds();\r\n this._fillComponents(opts.enableEditing);\r\n\r\n const marker = new AromaticLoopsMarker(this);\r\n marker.markCycles();\r\n if (opts.detectAromaticLoops) { // TODO remove this condition clause, it is for debug purposes only!\r\n marker.detectCycles(); // TODO add conditional detection\r\n }\r\n\r\n this._finalizeMolecules();\r\n }\r\n\r\n _finalizeMolecules() {\r\n // add reference to molecule into residue\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const molecule = this._molecules[i];\r\n const count = molecule.residues.length;\r\n for (let j = 0; j < count; j++) {\r\n const residue = molecule.residues[j];\r\n residue._molecule = molecule;\r\n }\r\n }\r\n }\r\n\r\n updateStructuresMask() {\r\n const updater = (structure) => structure.collectMask();\r\n this.forEachResidue(updater);\r\n this.forEachChain(updater);\r\n this.forEachMolecule(updater);\r\n }\r\n\r\n countAtomsByMask(mask) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n getNumAtomsBySelector(selector) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n resetAtomMask(mask) {\r\n this.forEachAtom((atom) => {\r\n atom.mask = mask;\r\n });\r\n }\r\n\r\n markAtoms(selector, mask) {\r\n const setMask = mask;\r\n const clearMask = ~setMask;\r\n let count = 0;\r\n const totalSelector = selectors.keyword('And')(selector, this.getSelector());\r\n\r\n this.forEachAtom((atom) => {\r\n if (totalSelector.includesAtom(atom)) {\r\n atom.mask |= setMask;\r\n count++;\r\n } else {\r\n atom.mask &= clearMask;\r\n }\r\n });\r\n this._maskNeedsUpdate = true;\r\n\r\n return count;\r\n }\r\n\r\n markAtomsAdditionally(selector, mask) {\r\n const setMask = mask;\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom) && (atom.mask & mask) !== mask) {\r\n atom.mask |= setMask;\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n clearAtomBits(mask) {\r\n const clearMask = ~mask;\r\n this.forEachAtom((atom) => {\r\n atom.mask &= clearMask;\r\n });\r\n const reseter = (a) => {\r\n a._mask &= clearMask;\r\n };\r\n this.forEachAtom(reseter);\r\n this.forEachResidue(reseter);\r\n this.forEachChain(reseter);\r\n this.forEachMolecule(reseter);\r\n }\r\n\r\n getAtomNames() {\r\n if (this.hasOwnProperty('_atomNames')) {\r\n return this._atomNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.name] = 1;\r\n });\r\n this._atomNames = Object.keys(dict);\r\n\r\n return this._atomNames;\r\n }\r\n\r\n getElements() {\r\n if (this.hasOwnProperty('_elements')) {\r\n return this._elements;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.element.name] = 1;\r\n });\r\n this._elements = Object.keys(dict);\r\n\r\n return this._elements;\r\n }\r\n\r\n getResidueNames() {\r\n if (this.hasOwnProperty('_residueNames')) {\r\n return this._residueNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachResidue((res) => {\r\n dict[res._type._name] = 1;\r\n });\r\n this._residueNames = Object.keys(dict);\r\n\r\n return this._residueNames;\r\n }\r\n\r\n getChainNames() {\r\n if (this.hasOwnProperty('_chainNames')) {\r\n return this._chainNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachChain((chain) => {\r\n dict[chain._name] = 1;\r\n });\r\n this._chainNames = Object.keys(dict);\r\n\r\n return this._chainNames;\r\n }\r\n\r\n getAltLocNames() {\r\n if (this.hasOwnProperty('_altlocNames')) {\r\n return this._altlocNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[String.fromCharCode(atom.location)] = 1;\r\n });\r\n this._altlocNames = Object.keys(dict);\r\n\r\n return this._altlocNames;\r\n }\r\n\r\n getVoxelWorld() {\r\n if (!this.hasOwnProperty('_voxelWorld')) {\r\n try {\r\n this._voxelWorld = new VoxelWorld(\r\n this.getDefaultBoundaries().boundingBox,\r\n new THREE.Vector3(VOXEL_SIZE, VOXEL_SIZE, VOXEL_SIZE),\r\n );\r\n this._voxelWorld.addAtoms(this);\r\n } catch (e) {\r\n logger.warn('Unable to create voxel world');\r\n this._voxelWorld = null;\r\n }\r\n }\r\n\r\n return this._voxelWorld;\r\n }\r\n\r\n /**\r\n * Simple function to make unified routine procedure without code duplication.\r\n * @param {Array} srcArray - Source chemical structure array (will be part of resulting chemical structure array).\r\n * @param {Array} dstArray - Resulting chemical structure array.\r\n * @param {number} param - Parameter for processor.\r\n * @param {function} functor - Processor for every element in array.\r\n */\r\n addElement(srcArray, dstArray, param, functor) {\r\n const { length } = srcArray;\r\n for (let i = 0; i < length; ++i) {\r\n const elem = srcArray[i];\r\n functor(elem, param);\r\n dstArray.push(elem);\r\n }\r\n }\r\n\r\n // this function joins multiple complexes into one (this)\r\n // atom, bond, ... objects are reused -- so input complexes are no longer valid\r\n joinComplexes(complexes) {\r\n // clear target complex\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n\r\n const self = this;\r\n let atomBias = 0;\r\n let bondBias = 0;\r\n let residueBias = 0;\r\n let chainBias = 0;\r\n let componentBias = 0;\r\n\r\n function processAtom(atom, bias) {\r\n atom.serial += bias;\r\n atom.index += bias;\r\n }\r\n\r\n function processBond(bond, bias) {\r\n bond._index += bias;\r\n }\r\n\r\n function processResidue(residue, bias) {\r\n residue._index += bias;\r\n }\r\n\r\n function processChain(chain, bias) {\r\n chain._complex = self;\r\n chain._index += bias;\r\n }\r\n\r\n function processComponent(component, bias) {\r\n component._complex = self;\r\n component._index += bias;\r\n }\r\n\r\n /**\r\n * Simple function to do nothing.\r\n */\r\n function doNothing() {\r\n }\r\n\r\n for (let i = 0; i < complexes.length; ++i) {\r\n const c = complexes[i];\r\n this.addElement(c._atoms, this._atoms, atomBias, processAtom);\r\n this.addElement(c._bonds, this._bonds, bondBias, processBond);\r\n this.addElement(c._residues, this._residues, residueBias, processResidue);\r\n this.addElement(c._chains, this._chains, chainBias, processChain);\r\n this.addElement(c._sheets, this._sheets, 0, doNothing);\r\n this.addElement(c._helices, this._helices, 0, doNothing);\r\n this.addElement(c._sgroups, this._sgroups, 0, doNothing);\r\n this.addElement(c._components, this._components, componentBias, processComponent);\r\n this.addElement(c.structures, this.structures, 0, doNothing);\r\n // merge residue types\r\n for (const rt in c._residueTypes) {\r\n if (c._residueTypes.hasOwnProperty(rt)) {\r\n this._residueTypes[rt] = c._residueTypes[rt];\r\n }\r\n }\r\n\r\n atomBias += c._atoms.length;\r\n bondBias += c._bonds.length;\r\n residueBias += c._residues.length;\r\n chainBias += c._chains.length;\r\n componentBias += c._components.length;\r\n }\r\n\r\n this._computeBounds();\r\n }\r\n\r\n /**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n */\r\n dssp() {\r\n const ssMap = new SecondaryStructureMap(this);\r\n\r\n const structures = this.structures = [];\r\n const helices = this._helices = [];\r\n const sheets = this._sheets = [];\r\n\r\n const getSheet = (index) => {\r\n let item = sheets[index];\r\n if (!item) {\r\n item = sheets[index] = new Sheet(String(index), 0);\r\n }\r\n return item;\r\n };\r\n\r\n let lastCode;\r\n let lastSheetIndex;\r\n let lastHelixIndex = 0;\r\n let curStructure = null;\r\n for (let i = 0, n = this._residues.length; i < n; ++i) {\r\n const curCode = ssMap._ss[i];\r\n const curResidue = this._residues[i];\r\n const curSheetIndex = ssMap._sheet[i];\r\n\r\n // expand the last structure\r\n if (curCode === lastCode && curSheetIndex === lastSheetIndex) {\r\n curResidue._secondary = curStructure;\r\n if (curStructure) {\r\n curStructure.term = curResidue;\r\n }\r\n if (curStructure instanceof Helix) {\r\n curStructure.length++;\r\n }\r\n continue;\r\n }\r\n\r\n // create a new structure\r\n const helixClass = helixClassMap[curCode];\r\n const loopType = loopMap[curCode];\r\n if (curCode === StructureType.STRAND) {\r\n const curSheet = getSheet(curSheetIndex);\r\n curStructure = new Strand(curSheet, curResidue, curResidue, 0, null, null);\r\n curSheet.addStrand(curStructure);\r\n } else if (helixClass !== undefined) {\r\n lastHelixIndex++;\r\n curStructure = new Helix(helixClass, curResidue, curResidue, lastHelixIndex, String(lastHelixIndex), '', 1);\r\n helices.push(curStructure);\r\n } else if (loopType !== undefined) {\r\n curStructure = new StructuralElement(loopType, curResidue, curResidue);\r\n } else {\r\n curStructure = null;\r\n }\r\n\r\n if (curStructure) {\r\n structures.push(curStructure);\r\n }\r\n\r\n curResidue._secondary = curStructure;\r\n\r\n lastCode = curCode;\r\n lastSheetIndex = curSheetIndex;\r\n }\r\n\r\n this._sheets = sheets.filter((_sheet) => true); // squeeze sheets array\r\n }\r\n}\r\n\r\nComplex.prototype.id = 'Complex';\r\nComplex.prototype.name = '';\r\n\r\nexport default Complex;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\nfunction pow2ceil(v) {\r\n let p = 2;\r\n v = (v - 1) >> 1;\r\n while (v) {\r\n p <<= 1;\r\n v >>= 1;\r\n }\r\n return p;\r\n}\r\n\r\n/**\r\n * Volume constructor\r\n *\r\n * @param {Object} type - Float32Array, Int8Array, etc...\r\n * @param {Object|Array} dimensions - number of data points on each axis (x, y, z)\r\n * @param {Box3} box - bounding box defining data place in metric space,\r\n * it's corners correspond to extreme data points\r\n * @param {Number} vecSize - dimension of the field data point (1 = scalar, 3 = 3D vector)\r\n * @param {Object} data - typed array of the same type as specified by the 1st parameter,\r\n * layout: point by point along X,\r\n * row by row along Y,\r\n * plane by plane along Z\r\n * @param {Number} volumeInfo - volume info values to define threshold to filter the noise\r\n */\r\n\r\nclass Volume {\r\n constructor(type, dimensions, box, vecSize, data, volumeInfo) {\r\n this._box = box.clone();\r\n this._dimVec = Math.max(Math.floor(vecSize || 1), 1);\r\n this._volumeInfo = volumeInfo;\r\n\r\n if (dimensions instanceof Array) {\r\n [this._dimX, this._dimY, this._dimZ] = dimensions;\r\n } else {\r\n this._dimX = dimensions.x;\r\n this._dimY = dimensions.y;\r\n this._dimZ = dimensions.z;\r\n }\r\n this._dimX = Math.max(Math.floor(this._dimX), 1);\r\n this._dimY = Math.max(Math.floor(this._dimY), 1);\r\n this._dimZ = Math.max(Math.floor(this._dimZ), 1);\r\n\r\n this._rowElements = this._dimVec * this._dimX;\r\n this._planeElements = this._rowElements * this._dimY;\r\n this._totalElements = this._planeElements * this._dimZ;\r\n\r\n this._data = data || utils.allocateTyped(type, this._totalElements);\r\n\r\n // override getter/setter for vector fields\r\n switch (this._dimVec) {\r\n case 1:\r\n break;\r\n\r\n case 2:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n };\r\n break;\r\n\r\n case 3:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1], this._data[idx + 2]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n this._data[idx + 2] = c;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n this._data[idx + 2] += c;\r\n };\r\n break;\r\n\r\n default:\r\n throw new Error('Volume: invalid vector dimension');\r\n }\r\n }\r\n\r\n // default getter assumes it's a scalar field\r\n getValue(x, y, z) {\r\n return this._data[x + y * this._rowElements + z * this._planeElements];\r\n }\r\n\r\n // default setter assumes it's a scalar field\r\n setValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] = val;\r\n }\r\n\r\n // default adder assumes it's a scalar field\r\n addValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] += val;\r\n }\r\n\r\n getDimensions() {\r\n return [this._dimX, this._dimY, this._dimZ];\r\n }\r\n\r\n getBox() {\r\n return this._box;\r\n }\r\n\r\n getVolumeInfo() {\r\n return this._volumeInfo;\r\n }\r\n\r\n getCellSize() {\r\n const boxSize = new THREE.Vector3();\r\n this._box.getSize(boxSize);\r\n const res = new THREE.Vector3();\r\n res.x = this._dimX > 1 ? boxSize.x / (this._dimX - 1) : 0;\r\n res.y = this._dimY > 1 ? boxSize.y / (this._dimY - 1) : 0;\r\n res.z = this._dimZ > 1 ? boxSize.z / (this._dimZ - 1) : 0;\r\n return res;\r\n }\r\n\r\n computeGradient() {\r\n if (this._dimVec !== 1) {\r\n // gradient can only be computed for scalar fields\r\n return null;\r\n }\r\n\r\n // create a 3D vector field of gradients\r\n const gradient = new Volume(Float32Array, [this._dimX, this._dimY, this._dimZ], this._box, 3);\r\n\r\n // calculate cell side lengths\r\n const vl = this.getCellSize();\r\n\r\n // gradient axis scaling values and averaging factors, to correctly\r\n // calculate the gradient for volumes with irregular cell spacing\r\n const vs = new THREE.Vector3(-0.5 / vl.x, -0.5 / vl.y, -0.5 / vl.z);\r\n\r\n // TODO Check for intended bug in VMD (min is zero)\r\n function clamp(val, min, max) {\r\n return Math.min(max, Math.max(min, val));\r\n }\r\n\r\n const xSize = this._dimX;\r\n const ySize = this._dimY;\r\n const zSize = this._dimZ;\r\n const volMap = this._data;\r\n\r\n function _voxelValue(x, y, z) {\r\n return volMap[z * xSize * ySize + y * xSize + x];\r\n }\r\n\r\n for (let zi = 0; zi < zSize; ++zi) {\r\n const zm = clamp(zi - 1, 0, zSize - 1);\r\n const zp = clamp(zi + 1, 0, zSize - 1);\r\n\r\n for (let yi = 0; yi < ySize; ++yi) {\r\n const ym = clamp(yi - 1, 0, ySize - 1);\r\n const yp = clamp(yi + 1, 0, ySize - 1);\r\n\r\n for (let xi = 0; xi < xSize; ++xi) {\r\n const xm = clamp(xi - 1, 0, xSize - 1);\r\n const xp = clamp(xi + 1, 0, xSize - 1);\r\n\r\n // Calculate the volume gradient at each grid cell.\r\n // Gradients are now stored unnormalized, since we need them in pure\r\n // form in order to draw field lines etc. Shading code will now have\r\n // to do renormalization for itself on-the-fly.\r\n\r\n // XXX this gradient is only correct for orthogonal grids, since\r\n // we're using the array index offsets rather to calculate the gradient\r\n // rather than voxel coordinate offsets. This will have to be\r\n // re-worked for non-orthogonal datasets.\r\n\r\n gradient.setValue(\r\n xi,\r\n yi,\r\n zi,\r\n (_voxelValue(xp, yi, zi) - _voxelValue(xm, yi, zi)) * vs.x,\r\n (_voxelValue(xi, yp, zi) - _voxelValue(xi, ym, zi)) * vs.y,\r\n (_voxelValue(xi, yi, zp) - _voxelValue(xi, yi, zm)) * vs.z,\r\n );\r\n }\r\n }\r\n }\r\n\r\n return gradient;\r\n }\r\n\r\n normalize() {\r\n const data = this._data;\r\n\r\n // get min/max\r\n let min = data[0];\r\n let max = data[0];\r\n for (let i = 1; i < data.length; ++i) {\r\n min = Math.min(min, data[i]);\r\n max = Math.max(max, data[i]);\r\n }\r\n\r\n const d = 1.0 / (max - min);\r\n if (d === 0) {\r\n return;\r\n }\r\n\r\n // normalize\r\n for (let i = 0; i < data.length; ++i) {\r\n data[i] = d * (data[i] - min);\r\n }\r\n }\r\n\r\n getTiledTextureStride() {\r\n return [this._dimX + 2, this._dimY + 2];\r\n }\r\n\r\n buildTiledTexture() {\r\n let tilesX = Math.ceil(Math.sqrt(this._dimZ * this._dimY / this._dimX));\r\n\r\n let width = tilesX * (this._dimX + 2) - 1;\r\n width = pow2ceil(width);\r\n tilesX = Math.floor(width / (this._dimX + 2));\r\n\r\n const tilesY = Math.ceil(this._dimZ / tilesX);\r\n let height = tilesY * (this._dimY + 2) - 1;\r\n height = pow2ceil(height);\r\n\r\n const data = new Uint8Array(width * height);\r\n\r\n let src;\r\n let dst;\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // process each pixel row of this tile row\r\n for (let row = 0; row < this._dimY; ++row) {\r\n src = tileRow * tilesX * this._planeElements + row * this._rowElements;\r\n dst = width * (tileRow * (this._dimY + 2) + row);\r\n // copy a series of rows through several XY planes\r\n for (let t = 0; t < tilesX; ++t) {\r\n // copy one row of one XY plane\r\n for (let x = 0; x < this._dimX; ++x) {\r\n data[dst++] = 255.0 * this._data[src++];\r\n }\r\n\r\n // repeat last pixel of previous tile\r\n data[dst++] = 255.0 * this._data[src - 1];\r\n\r\n if (t < tilesX - 1) {\r\n // skip to the same row of next XY plane\r\n src += this._planeElements - this._rowElements;\r\n // repeat first pixel of next tile\r\n data[dst++] = 255.0 * this._data[src];\r\n }\r\n }\r\n }\r\n }\r\n\r\n // fill pixels between tile rows with copy of edge pixels\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // copy last pixel row of this tile row to the following pixel row of the texture\r\n src = width * (tileRow * (this._dimY + 2) + this._dimY - 1);\r\n dst = src + width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n if (tileRow < tilesY - 1) {\r\n // copy first pixel row of next tile row to the preceding pixel row of the texture\r\n src = width * (tileRow + 1) * (this._dimY + 2);\r\n dst = src - width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n }\r\n }\r\n\r\n const texture = new THREE.DataTexture(\r\n data,\r\n width,\r\n height,\r\n THREE.LuminanceFormat,\r\n THREE.UnsignedByteType,\r\n THREE.UVMapping,\r\n THREE.ClampToEdgeWrapping,\r\n THREE.ClampToEdgeWrapping,\r\n THREE.LinearFilter,\r\n THREE.LinearFilter,\r\n );\r\n texture.needsUpdate = true;\r\n return texture;\r\n }\r\n\r\n /* ********************************************************************************\r\n *\r\n * Methods that provide direct access to internal array (for better performance)\r\n *\r\n ******************************************************************************** */\r\n\r\n getData() {\r\n return this._data;\r\n }\r\n\r\n getDirectIdx(x, y, z) {\r\n return x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n }\r\n\r\n getStrideX() {\r\n return this._dimVec;\r\n }\r\n\r\n getStrideY() {\r\n return this._rowElements;\r\n }\r\n\r\n getStrideZ() {\r\n return this._planeElements;\r\n }\r\n}\r\n\r\nVolume.prototype.id = 'Volume';\r\n\r\nexport default Volume;\r\n","/**\r\n * Residue Molecule.\r\n *\r\n * @param {Complex} complex - Molecular complex this Molecule belongs to.\r\n * @param {String} name - Molecule's name.\r\n * @param {Integer} index - Molecule's index in file.\r\n *\r\n * @exports Molecule\r\n * @constructor\r\n */\r\nclass Molecule {\r\n constructor(complex, name, index) {\r\n this.complex = complex;\r\n this.name = name || '';\r\n this.residues = [];\r\n this.mask = 1 | 0;\r\n this.index = index || -1; // start with 1\r\n }\r\n\r\n forEachResidue(process) {\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this.mask = mask;\r\n }\r\n}\r\n\r\nexport default Molecule;\r\n","import Atom from './chem/Atom';\r\nimport Element from './chem/Element';\r\nimport Bond from './chem/Bond';\r\nimport Residue from './chem/Residue';\r\nimport ResidueType from './chem/ResidueType';\r\nimport Chain from './chem/Chain';\r\nimport Helix from './chem/Helix';\r\nimport Strand from './chem/Strand';\r\nimport Sheet from './chem/Sheet';\r\nimport SGroup from './chem/SGroup';\r\nimport Assembly from './chem/Assembly';\r\nimport Complex from './chem/Complex';\r\nimport Volume from './chem/Volume';\r\nimport VoxelWorld from './chem/VoxelWorld';\r\nimport selectors from './chem/selectors';\r\nimport Molecule from './chem/Molecule';\r\n\r\nexport default {\r\n Atom,\r\n Element,\r\n Bond,\r\n Residue,\r\n ResidueType,\r\n Chain,\r\n Helix,\r\n Strand,\r\n Sheet,\r\n SGroup,\r\n Assembly,\r\n Complex,\r\n Volume,\r\n VoxelWorld,\r\n selectors,\r\n Molecule,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\n\r\nclass CSS2DObject extends THREE.Object3D {\r\n constructor(element) {\r\n super();\r\n const self = this;\r\n this._element = element;\r\n this._element.style.position = 'absolute';\r\n this.addEventListener('removed', () => {\r\n if (self._element.parentNode !== null) {\r\n self._element.parentNode.removeChild(self._element);\r\n }\r\n });\r\n }\r\n\r\n getElement() {\r\n return this._element;\r\n }\r\n\r\n /**\r\n * Sets label transparency.\r\n *\r\n * @param {number} transp - in [0; 1] 1 means fully transparent\r\n */\r\n setTransparency(transp) {\r\n const el = this.getElement();\r\n if (el === null) {\r\n return;\r\n }\r\n if (transp === 1.0) {\r\n el.style.display = 'none';\r\n return;\r\n }\r\n el.style.display = 'inline';\r\n const op = 1.0 - transp;\r\n const top = op.toString();\r\n const op100 = op * 100;\r\n el.style.opacity = top;\r\n el.style.filter = `alpha(opacity=${op100})`; // IE fallback\r\n }\r\n\r\n clone() {\r\n const obj = new CSS2DObject(this._element);\r\n obj.copy(this);\r\n return obj;\r\n }\r\n}\r\n\r\nexport default CSS2DObject;\r\n","import * as THREE from 'three';\r\n\r\nclass RCGroup extends THREE.Group {\r\n raycast(raycaster, intersects) {\r\n if (!this.visible) {\r\n return;\r\n }\r\n\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n children[i].raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].enableSubset) {\r\n children[i].enableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].disableSubset) {\r\n children[i].disableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n isEmpty() {\r\n return this.children.length === 0;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].updateToFrame) {\r\n children[i].updateToFrame(frameData);\r\n }\r\n }\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n Array.prototype.push.apply(totalSubset, children[i].getSubset(mask, innerOnly));\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default RCGroup;\r\n","/* eslint-disable no-magic-numbers */\r\nimport * as THREE from 'three';\r\nimport logger from '../utils/logger';\r\nimport CSS2DObject from './CSS2DObject';\r\nimport RCGroup from './RCGroup';\r\nimport vertexScreenQuadShader from './shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromTex from './shaders/ScreenQuadFromTex.frag';\r\nimport fragmentScreenQuadFromTexWithDistortion from './shaders/ScreenQuadFromTexWithDistortion.frag';\r\n\r\nconst LAYERS = {\r\n DEFAULT: 0, VOLUME: 1, TRANSPARENT: 2, PREPASS_TRANSPARENT: 3, VOLUME_BFPLANE: 4, COLOR_FROM_POSITION: 5, SHADOWMAP: 6,\r\n};\r\n\r\nconst SELECTION_LAYERS = [ // These layers, that are used in the selection by ray casting\r\n LAYERS.DEFAULT, LAYERS.TRANSPARENT,\r\n];\r\n\r\nTHREE.Object3D.prototype.resetTransform = function () {\r\n this.position.set(0, 0, 0);\r\n this.quaternion.set(0, 0, 0, 1);\r\n this.scale.set(1, 1, 1);\r\n};\r\n\r\n// update world matrix of this object and all its ancestors\r\nTHREE.Object3D.prototype.updateMatrixWorldRecursive = function () {\r\n if (this.parent != null) {\r\n this.parent.updateMatrixWorldRecursive();\r\n }\r\n this.updateMatrixWorld();\r\n};\r\n// add object to parent, saving objects' world transform\r\nTHREE.Object3D.prototype.addSavingWorldTransform = (function () {\r\n const _worldMatrixInverse = new THREE.Matrix4();\r\n\r\n return function (object) {\r\n if (object instanceof THREE.Object3D) {\r\n _worldMatrixInverse.copy(this.matrixWorld).invert();\r\n _worldMatrixInverse.multiply(object.matrixWorld);\r\n object.matrix.copy(_worldMatrixInverse);\r\n object.matrix.decompose(object.position, object.quaternion, object.scale);\r\n this.add(object);\r\n }\r\n };\r\n}());\r\n\r\n// render a tiny transparent quad in the center of the screen\r\nTHREE.WebGLRenderer.prototype.renderDummyQuad = (function () {\r\n const _material = new THREE.MeshBasicMaterial({ transparent: true, opacity: 0.0, depthWrite: false });\r\n\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneGeometry(0.01, 0.01), _material);\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n return function () {\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuad = (function () {\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneGeometry(1.0, 1.0));\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n return function (material) {\r\n _quad.material = material;\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.isIdentity = (function () {\r\n const identity = new THREE.Matrix4();\r\n return function () {\r\n return identity.equals(this);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.applyToPointsArray = function (array, stride, w) {\r\n if (!array || !stride || stride < 3) {\r\n return array;\r\n }\r\n w = w || 0; // use point as normal by default\r\n const e = this.elements;\r\n for (let i = 0; i < array.length; i += stride) {\r\n const x = array[i];\r\n const y = array[i + 1];\r\n const z = array[i + 2];\r\n\r\n const persp = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\r\n\r\n array[i] = (e[0] * x + e[4] * y + e[8] * z + e[12] * w) * persp;\r\n array[i + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13] * w) * persp;\r\n array[i + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14] * w) * persp;\r\n }\r\n return array;\r\n};\r\n\r\nclass ScreenQuadMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n if (params.uniforms === undefined) {\r\n params.uniforms = {};\r\n }\r\n params.uniforms.srcTex = { type: 't', value: null };\r\n params.vertexShader = vertexScreenQuadShader;\r\n params.transparent = false;\r\n params.depthTest = false;\r\n params.depthWrite = false;\r\n super(params);\r\n }\r\n}\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTex = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { opacity: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTex,\r\n transparent: true,\r\n });\r\n\r\n return function (srcTex, opacity) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.transparent = (opacity < 1.0);\r\n _material.uniforms.opacity.value = opacity;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { coef: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTexWithDistortion,\r\n });\r\n\r\n return function (srcTex, coef) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.uniforms.coef.value = coef;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\n/**\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setMinimalFov = function (angle) {\r\n if (this.aspect >= 1.0) {\r\n this.fov = angle;\r\n } else {\r\n this.fov = THREE.MathUtils.radToDeg(2 * Math.atan(Math.tan(THREE.MathUtils.degToRad(angle) * 0.5) / this.aspect));\r\n }\r\n};\r\n\r\n/**\r\n * @param {THREE.PerspectiveCamera} camera - Base camera for this stereo camera.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.StereoCamera.prototype.updateHalfSized = function (camera, angle) {\r\n const originalAspect = camera.aspect;\r\n const originalFov = camera.fov;\r\n\r\n camera.aspect = originalAspect / 2.0;\r\n camera.setMinimalFov(angle);\r\n camera.updateProjectionMatrix();\r\n\r\n this.update(camera);\r\n\r\n camera.aspect = originalAspect;\r\n camera.fov = originalFov;\r\n camera.updateProjectionMatrix();\r\n};\r\n\r\n/**\r\n * @param {number} radius - Radius of bounding sphere in angstroms to fit on screen.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setDistanceToFit = function (radius, angle) {\r\n this.position.z = radius / Math.sin(0.5 * THREE.MathUtils.degToRad(angle));\r\n};\r\n\r\n/**\r\n * @param {RCGroup} gfxObj - All objects on scene.\r\n * @param {THREE.PerspectiveCamera} camera - Camera used for rendering.\r\n * @param {number} clipPlane - Distance to clip plane.\r\n * @param {number} fogFarPlane - Distance to fog far plane.\r\n */\r\nTHREE.Raycaster.prototype.intersectVisibleObject = function (gfxObj, camera, clipPlane, fogFarPlane) {\r\n const intersects = this.intersectObject(gfxObj, false);\r\n if (intersects.length === 0) {\r\n return null;\r\n }\r\n\r\n // find point closest to camera that doesn't get clipped by camera near plane or clipPlane (if it exists)\r\n const nearPlane = Math.min(camera.near, clipPlane);\r\n let i;\r\n let p = intersects[0];\r\n const v = new THREE.Vector3();\r\n for (i = 0; i < intersects.length; ++i) {\r\n p = intersects[i];\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -nearPlane) {\r\n break;\r\n }\r\n }\r\n if (i === intersects.length) {\r\n return null;\r\n }\r\n\r\n // check that selected intersection point is not clipped by camera far plane or occluded by fog (if it exists)\r\n const farPlane = Math.min(camera.far, fogFarPlane);\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -farPlane) {\r\n return null;\r\n }\r\n return p;\r\n};\r\n\r\nTHREE.Matrix4.prototype.extractScale = (function () {\r\n const _v = new THREE.Vector3();\r\n\r\n return function (scale) {\r\n if (scale === undefined) {\r\n logger.debug('extractScale(): new is too expensive operation to do it on-the-fly');\r\n scale = _v.clone();\r\n }\r\n\r\n const te = this.elements;\r\n scale.x = _v.set(te[0], te[1], te[2]).length();\r\n scale.y = _v.set(te[4], te[5], te[6]).length();\r\n scale.z = _v.set(te[8], te[9], te[10]).length();\r\n\r\n // if determine is negative, we need to invert one scale\r\n const det = this.determinant();\r\n if (det < 0) {\r\n scale.x = -scale.x;\r\n }\r\n return scale;\r\n };\r\n}());\r\n\r\nfunction _calcCylinderMatrix(posBegin, posEnd, radius) {\r\n const posCenter = posBegin.clone().lerp(posEnd, 0.5);\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(radius, posBegin.distanceTo(posEnd), radius);\r\n\r\n const matRotHalf = new THREE.Matrix4();\r\n matRotHalf.makeRotationX(Math.PI / 2);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n const vUp = new THREE.Vector3(0, 1, 0);\r\n matRotLook.lookAt(posCenter, posEnd, vUp);\r\n\r\n matRotLook.multiply(matRotHalf);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(posCenter);\r\n return matRotLook;\r\n}\r\n\r\nfunction _calcChunkMatrix(eye, target, up, rad) {\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(rad.x, rad.y, 0);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n matRotLook.lookAt(eye, target, up);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(eye);\r\n\r\n return matRotLook;\r\n}\r\n\r\nfunction _groupHasGeometryToRender(group) {\r\n let hasGeoms = false;\r\n group.traverse((node) => {\r\n if (node.hasOwnProperty('geometry') || node instanceof CSS2DObject) {\r\n hasGeoms = true;\r\n }\r\n });\r\n return hasGeoms;\r\n}\r\n\r\nfunction _buildDistorionMesh(widthSegments, heightSegements, coef) {\r\n // solve equation r_u = r_d * (1 + k * r_d^2)\r\n // for r_d using iterations\r\n // takes: r_u^2\r\n // returns: r_d / r_u factor that can be used to distort point coords\r\n function calcInverseBarrel(r2) {\r\n const epsilon = 1e-5;\r\n let prevR2 = 0.0;\r\n let curR2 = r2;\r\n let dr = 1.0;\r\n while (Math.abs(curR2 - prevR2) > epsilon) {\r\n dr = 1.0 + coef * curR2;\r\n prevR2 = curR2;\r\n curR2 = r2 / (dr * dr);\r\n }\r\n\r\n return 1.0 / dr;\r\n }\r\n\r\n const geo = new THREE.PlaneGeometry(2.0, 2.0, widthSegments, heightSegements);\r\n\r\n const pos = geo.getAttribute('position');\r\n for (let i = 0; i < pos.count; ++i) {\r\n const x = pos.array[3 * i];\r\n const y = pos.array[3 * i + 1];\r\n const c = calcInverseBarrel(x * x + y * y);\r\n pos.setXY(i, c * x, c * y);\r\n }\r\n\r\n return geo;\r\n}\r\n\r\nTHREE.BufferAttribute.prototype.copyAtList = function (attribute, indexList) {\r\n console.assert(\r\n this.itemSize === attribute.itemSize,\r\n 'DEBUG: BufferAttribute.copyAtList buffers have different item size.',\r\n );\r\n const { itemSize } = this;\r\n for (let i = 0, n = indexList.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n this.array[i * itemSize + j] = attribute.array[indexList[i] * itemSize + j];\r\n }\r\n }\r\n return this;\r\n};\r\n\r\nfunction fillArray(array, value, startIndex, endIndex) {\r\n startIndex = (typeof startIndex !== 'undefined') ? startIndex : 0;\r\n endIndex = (typeof endIndex !== 'undefined') ? endIndex : array.length;\r\n for (let i = startIndex; i < endIndex; ++i) {\r\n array[i] = value;\r\n }\r\n}\r\n\r\n/** @param {THREE.Object3D} object - Parent object. */\r\nfunction removeChildren(object) {\r\n const { children } = object;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n child.parent = null;\r\n child.dispatchEvent({ type: 'removed' });\r\n }\r\n object.children = [];\r\n}\r\n\r\nfunction clearTree(object) {\r\n object.traverse((obj) => {\r\n if (obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line) {\r\n obj.geometry.dispose();\r\n }\r\n });\r\n removeChildren(object);\r\n}\r\n\r\nfunction destroyObject(object) {\r\n clearTree(object);\r\n if (object.parent) {\r\n object.parent.remove(object);\r\n } else {\r\n object.dispatchEvent({ type: 'removed' });\r\n }\r\n}\r\n\r\nfunction belongToSelectLayers(object) {\r\n for (let i = 0; i < SELECTION_LAYERS.length; i++) {\r\n if (((object.layers.mask >> SELECTION_LAYERS[i]) & 1) === 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction processObjRenderOrder(root, idMaterial) {\r\n // set renderOrder to 0 for Backdrop and to 1 in other cases to render Backdrop earlier all other materials\r\n const renderOrder = +(idMaterial !== 'BA');\r\n root.traverse((object) => {\r\n if (object.isGroup) {\r\n object.renderOrder = renderOrder;\r\n }\r\n });\r\n}\r\n\r\nfunction applySelectionMaterial(geo) {\r\n geo.traverse((node) => {\r\n if ('material' in node) {\r\n node.material = node.material.clone(true);\r\n // using z-offset to magically fix selection rendering artifact (on z-sprites)\r\n node.material.setValues({\r\n depthFunc: THREE.LessEqualDepth,\r\n overrideColor: true,\r\n fog: false,\r\n lights: false,\r\n shadowmap: false,\r\n });\r\n node.material.setUberOptions({ fixedColor: new THREE.Color(0xFFFF00), zOffset: -1e-6 });\r\n }\r\n });\r\n}\r\n\r\nfunction getMiddlePoint(point1, point2, optionalTarget) {\r\n const result = optionalTarget || new THREE.Vector3();\r\n\r\n result.set(0, 0, 0);\r\n result.addScaledVector(point1, 0.5);\r\n result.addScaledVector(point2, 0.5);\r\n\r\n return result;\r\n}\r\n\r\n// Monkey-patch for \"InstancedBufferGeometry.instanceCount becomes undefined after copy()\"\r\n// https://github.com/mrdoob/three.js/issues/22151\r\nconst _oldInstancedBufferGeometryCopy = THREE.InstancedBufferGeometry.prototype.copy;\r\n\r\nTHREE.InstancedBufferGeometry.prototype.copy = function (source) {\r\n _oldInstancedBufferGeometryCopy.call(this, source);\r\n if (this.instanceCount === undefined) {\r\n this.instanceCount = Infinity;\r\n }\r\n};\r\n\r\nexport default {\r\n calcCylinderMatrix: _calcCylinderMatrix,\r\n calcChunkMatrix: _calcChunkMatrix,\r\n groupHasGeometryToRender: _groupHasGeometryToRender,\r\n buildDistorionMesh: _buildDistorionMesh,\r\n RCGroup,\r\n fillArray,\r\n clearTree,\r\n destroyObject,\r\n belongToSelectLayers,\r\n processObjRenderOrder,\r\n applySelectionMaterial,\r\n getMiddlePoint,\r\n LAYERS,\r\n};\r\n","import * as THREE from 'three';\r\nimport gfxutils from './gfx/gfxutils';\r\n\r\nconst _defaultBoundaries = {\r\n boundingBox: new THREE.Box3(new THREE.Vector3(-1, -1, -1), new THREE.Vector3(1, 1, 1)),\r\n boundingSphere: new THREE.Sphere(new THREE.Vector3(0, 0, 0), 1),\r\n};\r\n\r\nclass Visual extends gfxutils.RCGroup {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this.name = name;\r\n this._dataSource = dataSource;\r\n }\r\n\r\n release() {\r\n if (this.parent) {\r\n this.parent.remove(this);\r\n }\r\n }\r\n\r\n getDataSource() {\r\n return this._dataSource;\r\n }\r\n\r\n getBoundaries() {\r\n return _defaultBoundaries;\r\n }\r\n}\r\n\r\nexport default Visual;\r\n","function _ensureArray(x) {\r\n if (x === null || x === undefined || Array.isArray(x)) {\r\n return x;\r\n }\r\n return [x];\r\n}\r\n\r\n/** An indexed list of objects or classes. */\r\nclass EntityList {\r\n /**\r\n * Create a list of objects.\r\n * The objects can be indexed by one or more properties for the later retrieval.\r\n *\r\n * @param {!Array=} entities A list of objects to automatically register at creation time.\r\n * @param {!Array=} indices A list of property names to use for case-insensitive indexing.\r\n * By default, a single `.id` property is used.\r\n * @see EntityList#register\r\n */\r\n constructor(entities = [], indices = ['id']) {\r\n this._list = [];\r\n this._dict = {};\r\n this._indices = [...indices];\r\n this._indices.forEach((index) => {\r\n this._dict[index] = {};\r\n });\r\n\r\n entities.forEach((entity) => this.register(entity));\r\n }\r\n\r\n /**\r\n * Add a value to the end of a list.\r\n * The list will contain only one copy of the value.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromList\r\n * @see EntityList.registerInDict\r\n */\r\n static registerInList(list, value) {\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a value from a list if it is there.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to remove.\r\n * @see EntityList.registerInList\r\n */\r\n static unregisterFromList(list, value) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Add a value to a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromDict\r\n * @see EntityList.registerInList\r\n */\r\n static registerInDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key] = dict[key] || [];\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Remove a value from a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.registerInDict\r\n */\r\n static unregisterFromDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key];\r\n if (list) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n if (list.length === 0) {\r\n delete dict[key];\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Add an entity to this list.\r\n *\r\n * @param {!Object} entity An object or a class to register. The object must include all\r\n * properties specified as indices on construction.\r\n * @see EntityList#unregister\r\n */\r\n register(entity) {\r\n EntityList.registerInList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.registerInDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * Remove an entity from this list.\r\n *\r\n * @param {!Object} entity An object or a class to unregister. The object may be\r\n * missing from the list but it must include all properties specified as indices\r\n * on construction.\r\n * @see EntityList#register\r\n */\r\n unregister(entity) {\r\n EntityList.unregisterFromList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.unregisterFromDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * An ordered list of all registered entities.\r\n * It is a read-only copy, use {@link EntityList#register} and {@link EntityList#unregister}\r\n * to modify it.\r\n *\r\n * @type {!Array}\r\n */\r\n get all() {\r\n return [...this._list];\r\n }\r\n\r\n /**\r\n * The first registered entity.\r\n * Use it if you do not care which entity you are referring to.\r\n *\r\n * @type {Object=}\r\n */\r\n get first() {\r\n return this._list[0];\r\n }\r\n\r\n /**\r\n * Retrieve a list of keys for the index.\r\n *\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {!Array} An unordered list of keys in the index, i.e. particular property\r\n * values for all registered entities.\r\n */\r\n keys(index) {\r\n return Object.keys(this._dict[index || this._indices[0]]);\r\n }\r\n\r\n /**\r\n * Retrieve an entity by its key.\r\n *\r\n * @param {string} key A case-insensitive property value to look-up.\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {Object=} An object registered in the index under the key. If there are multiple\r\n * objects under the same key, the first one is returned.\r\n */\r\n get(key, index) {\r\n const dict = this._dict[index || this._indices[0]];\r\n if (dict) {\r\n const values = dict[key && key.toLowerCase()];\r\n return values && values.length > 0 ? values[0] : undefined;\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nexport default EntityList;\r\n","import settings from '../settings';\r\nimport logger from './logger';\r\n\r\nfunction makeContextDependent(prototype) {\r\n Object.defineProperties(prototype, {\r\n logger: {\r\n get() {\r\n return this.context && this.context.logger ? this.context.logger : logger;\r\n },\r\n },\r\n settings: {\r\n get() {\r\n return this.context && this.context.settings ? this.context.settings : settings;\r\n },\r\n },\r\n });\r\n}\r\n\r\nexport default makeContextDependent;\r\n","import * as THREE from 'three';\r\n\r\nclass CollisionSphere {\r\n constructor(position, radius) {\r\n this._position = position;\r\n this._radius = radius;\r\n }\r\n\r\n static _sphere = new THREE.Sphere();\r\n\r\n raycast(raycaster) {\r\n const sphere = CollisionSphere._sphere;\r\n sphere.set(this._position, this._radius);\r\n\r\n const p = new THREE.Vector3();\r\n if (raycaster.ray.intersectSphere(sphere, p)) {\r\n return {\r\n distance: raycaster.ray.origin.distanceTo(p),\r\n point: p,\r\n };\r\n }\r\n return null;\r\n }\r\n}\r\n\r\nconst SphereCollisionGeo = (base) => class extends base {\r\n constructor(count, ...args) {\r\n super(...args);\r\n this._objects = new Array(count);\r\n this.boundingSphere = null;\r\n this.boundingBox = null;\r\n }\r\n\r\n setSphere(idx, position, radius) {\r\n this._objects[idx] = new CollisionSphere(position, radius);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n // TODO raycast with bounding sphere? How to deal with updates?\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const inters = this._objects[i].raycast(raycaster);\r\n if (inters) {\r\n inters.chunkIdx = i;\r\n intersects.push(inters);\r\n }\r\n }\r\n }\r\n\r\n computeBoundingBox() {\r\n const objects = this._objects;\r\n let { boundingBox } = this;\r\n if (boundingBox === null) {\r\n this.boundingBox = boundingBox = new THREE.Box3();\r\n }\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n boundingBox.expandByPoint(objects[i]._position);\r\n }\r\n }\r\n\r\n computeBoundingSphere() {\r\n this.computeBoundingBox();\r\n const objects = this._objects;\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n const pos = objects[i]._position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n if (this.boundingSphere === null) {\r\n this.boundingSphere = new THREE.Sphere();\r\n }\r\n this.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n};\r\nexport default SphereCollisionGeo;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst tmpColor = new THREE.Color();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\nclass InstancedSpheresGeometry extends SphereCollisionGeo(THREE.InstancedBufferGeometry) {\r\n constructor(spheresCount, sphereComplexity, useZSprites) {\r\n super(spheresCount);\r\n this._sphGeometry = useZSprites ? new THREE.PlaneGeometry(2, 2, 1, 1)\r\n : new THREE.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI);\r\n this._init(spheresCount, this._sphGeometry);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n setArrayXYZW(this._offsets, itemIdx * OFFSET_SIZE, itemPos.x, itemPos.y, itemPos.z, itemRad);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n\r\n setColor(itemIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n setArrayXYZ(this._colors, itemIdx * COLOR_SIZE, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('offset').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[chunkIndices[i]] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._sphGeometry);\r\n\r\n copySubArrays(this._offsets, geom._offsets, chunkIndices, OFFSET_SIZE);\r\n copySubArrays(this._colors, geom._colors, chunkIndices, COLOR_SIZE);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(spheresCount, sphereGeo) {\r\n this.copy(sphereGeo);\r\n\r\n this._offsets = utils.allocateTyped(Float32Array, spheresCount * OFFSET_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, spheresCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('offset', new THREE.InstancedBufferAttribute(this._offsets, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._colors, COLOR_SIZE, false, 1));\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(alpha, 1, false, 1));\r\n }\r\n}\r\nexport default InstancedSpheresGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VEC_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n */\r\n\r\nclass ChunkedObjectsGeometry extends THREE.BufferGeometry {\r\n constructor(chunkGeo, chunksCount) {\r\n super();\r\n\r\n if (this.constructor === ChunkedObjectsGeometry) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n\r\n this._chunkGeo = chunkGeo;\r\n\r\n this._init(chunkGeo, chunksCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('normal').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n const idx = i * VEC_SIZE;\r\n colors[idx] = tmpColor.r;\r\n colors[idx + 1] = tmpColor.g;\r\n colors[idx + 2] = tmpColor.b;\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n _.fill(alphaArr, value, left, left + chunkSize);\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n // use THREE.Mesh raycasting interface for the Geometry. The Mesh is\r\n // created with existed geometry and default material, so it doesn't slowdown.\r\n const mesh = new THREE.Mesh();\r\n mesh.geometry = this;\r\n mesh.raycast(raycaster, inters);\r\n\r\n const facesPerChunk = this._chunkGeo.index.count / 3;\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('faceIndex')) {\r\n continue;\r\n }\r\n inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk);\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.BufferGeometry();\r\n this._init.call(geom, this._chunkGeo, instanceCount);\r\n\r\n const srcPos = this._positions;\r\n const srcNorm = this._normals;\r\n const srcColor = this._colors;\r\n\r\n const dstPos = geom._positions;\r\n const dstNorm = geom._normals;\r\n const dstColor = geom._colors;\r\n\r\n const chunkSize = this._chunkSize * VEC_SIZE;\r\n\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const ptIdxBegin = chunkIndices[i] * chunkSize;\r\n const ptIdxEnd = ptIdxBegin + chunkSize;\r\n dstPos.set(srcPos.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstNorm.set(srcNorm.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstColor.set(srcColor.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n }\r\n\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(chunkGeo, chunksCount) {\r\n const chunkSize = this._chunkSize = chunkGeo.attributes.position.count;\r\n const chunkIndex = chunkGeo.index.array;\r\n const chunkIndexSize = chunkIndex.length;\r\n const pointsCount = this._chunkSize * chunksCount;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n const indexSize = chunkIndexSize * chunksCount;\r\n const index = this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, indexSize);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._normals = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n for (let i = 0; i < chunksCount; ++i) {\r\n const offset = i * chunkIndexSize;\r\n const posOffset = i * chunkSize;\r\n index.set(chunkIndex, offset);\r\n for (let j = 0; j < chunkIndexSize; ++j) {\r\n index[offset + j] += posOffset;\r\n }\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, VEC_SIZE));\r\n this.setAttribute('normal', new THREE.BufferAttribute(this._normals, VEC_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, VEC_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n }\r\n}\r\nexport default ChunkedObjectsGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst VEC_SIZE = 3;\r\n\r\nclass SimpleSpheresGeometry extends SphereCollisionGeo(ChunkedObjectsGeometry) {\r\n constructor(spheresCount, sphereComplexity) {\r\n const sphGeometry = new THREE.SphereBufferGeometry(\r\n 1,\r\n sphereComplexity * 2,\r\n sphereComplexity,\r\n 0,\r\n Math.PI * 2,\r\n 0,\r\n Math.PI,\r\n );\r\n super(spheresCount, sphGeometry, spheresCount);\r\n\r\n const normals = this._normals;\r\n const geoNormals = sphGeometry.attributes.normal.array;\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._tmpPositions = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n for (let i = 0; i < spheresCount; ++i) {\r\n normals.set(geoNormals, chunkSize * VEC_SIZE * i);\r\n }\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n const tmpPos = this._tmpPositions;\r\n const chunkSize = this._chunkSize;\r\n const geoPos = this._chunkPos;\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n const idx = i * 3;\r\n tmpPos[idx] = itemPos.x + geoPos[idx] * itemRad;\r\n tmpPos[idx + 1] = itemPos.y + geoPos[idx + 1] * itemRad;\r\n tmpPos[idx + 2] = itemPos.z + geoPos[idx + 2] * itemRad;\r\n }\r\n\r\n this._positions.set(tmpPos, chunkSize * itemIdx * VEC_SIZE);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n}\r\nexport default SimpleSpheresGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst centerPos = new THREE.Vector3();\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\nclass Simple2CCylindersGeometry extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, 2 * instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const firstOffset = chunkSize * 2 * itemIdx * VEC_SIZE;\r\n const secondOffset = firstOffset + chunkSize * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n centerPos.lerpVectors(botPos, topPos, 0.5);\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, centerPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, firstOffset);\r\n\r\n // now shift center to get another part of the cylinder\r\n centerPos.sub(botPos);\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpArray[idx] += centerPos.x;\r\n tmpArray[idx + 1] += centerPos.y;\r\n tmpArray[idx + 2] += centerPos.z;\r\n }\r\n this._positions.set(tmpArray, secondOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, firstOffset);\r\n this._normals.set(tmpArray, secondOffset);\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const first = 2 * itemIdx;\r\n super.setColor(first, colorVal1);\r\n\r\n const second = first + 1;\r\n super.setColor(second, colorVal2);\r\n }\r\n}\r\n\r\nexport default Simple2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_POINTS_COUNT_16BIT = 65536;\r\nconst PTS_PER_TRIANGLE = 3;\r\n\r\nclass CylinderBufferGeometry extends THREE.BufferGeometry {\r\n constructor(\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n ) {\r\n super();\r\n\r\n const thetaStart = 0;\r\n const thetaLength = 2 * Math.PI;\r\n\r\n this.type = 'CylinderBufferGeometry';\r\n\r\n this.parameters = {\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n };\r\n\r\n const hasTop = openEnded === false && radiusTop > 0;\r\n const hasBottom = openEnded === false && radiusBottom > 0;\r\n const vertexCount = (heightSegments + 1) * radialSegments\r\n + hasTop * (radialSegments + 1)\r\n + hasBottom * (radialSegments + 1);\r\n const facesCount = (2 * heightSegments + hasTop + hasBottom) * radialSegments;\r\n\r\n const heightHalf = height / 2;\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const positions = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const normals = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const indices = new THREE.Uint16BufferAttribute(utils.allocateTyped(Uint16Array, facesCount * PTS_PER_TRIANGLE), 1);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const uvs = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 2), 2);\r\n console.assert(vertexCount < MAX_POINTS_COUNT_16BIT, 'DEBUG: Cylinder Geometry has too many vertices (65536 max).');\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n const tanTheta = -(radiusBottom - radiusTop) / height;\r\n\r\n // setup cylinder data\r\n for (let y = 0; y <= heightSegments; y++) {\r\n // faces\r\n if (y !== heightSegments) {\r\n for (let i = 0; i < radialSegments; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + radialSegments + i;\r\n const v3 = currVtxIdx + radialSegments + ((i + 1) % radialSegments);\r\n const v4 = currVtxIdx + ((i + 1) % radialSegments);\r\n\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n // vertices\r\n const v = y / heightSegments;\r\n const radius = v * (radiusBottom - radiusTop) + radiusTop;\r\n\r\n for (let x = 0; x < radialSegments; x++) {\r\n const u = x / radialSegments;\r\n\r\n const vx = radius * Math.sin(u * thetaLength + thetaStart);\r\n const vy = v * height - heightHalf;\r\n const vz = radius * Math.cos(u * thetaLength + thetaStart);\r\n\r\n const normal = new THREE.Vector3(\r\n vx,\r\n Math.sqrt(vx * vx + vz * vz) * tanTheta,\r\n vz,\r\n ).normalize();\r\n\r\n positions.setXYZ(currVtxIdx, vx, vy, vz);\r\n normals.setXYZ(currVtxIdx, normal.x, normal.y, normal.z);\r\n uvs.setXY(currVtxIdx, u, v);\r\n ++currVtxIdx;\r\n }\r\n }\r\n\r\n // top cap\r\n if (hasTop) {\r\n const startTIdx = currVtxIdx;\r\n const lastIdx = currVtxIdx + radialSegments;\r\n for (let fTIdx = 0; fTIdx < radialSegments; ++fTIdx) {\r\n const currSrcIdx = currVtxIdx - radialSegments;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcIdx),\r\n positions.getY(currSrcIdx),\r\n positions.getZ(currSrcIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n\r\n const nextTVtx = startTIdx + ((fTIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, currVtxIdx, nextTVtx, lastIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n ++currVtxIdx;\r\n }\r\n\r\n // bottom cap\r\n if (hasBottom) {\r\n const startBIdx = currVtxIdx;\r\n const lastBIdx = currVtxIdx + radialSegments;\r\n for (let fBIdx = 0; fBIdx < radialSegments; ++fBIdx) {\r\n const currSrcBIdx = fBIdx;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcBIdx),\r\n positions.getY(currSrcBIdx),\r\n positions.getZ(currSrcBIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n\r\n const nextBVtx = startBIdx + ((fBIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, nextBVtx, currVtxIdx, lastBIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, -heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n }\r\n\r\n this.setIndex(indices);\r\n this.setAttribute('position', positions);\r\n this.setAttribute('normal', normals);\r\n this.setAttribute('uv', uvs);\r\n }\r\n\r\n clone() {\r\n const { parameters } = this;\r\n\r\n return new CylinderBufferGeometry(\r\n parameters.radiusTop,\r\n parameters.radiusBottom,\r\n parameters.height,\r\n parameters.radialSegments,\r\n parameters.heightSegments,\r\n parameters.openEnded,\r\n );\r\n }\r\n}\r\n\r\nexport default CylinderBufferGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport CylinderBufferGeometry from './CylinderBufferGeometry';\r\n\r\nconst tmpColor = new THREE.Color();\r\nconst invMatrix = new THREE.Matrix4();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction sortNumber(a, b) {\r\n return a - b;\r\n}\r\n\r\nfunction _prepareCylinderInfo(chunkIndices) {\r\n chunkIndices.sort(sortNumber);\r\n const chunksIdx = [];\r\n const cylinderInfo = [];\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const val = chunkIndices[i];\r\n const even = (val | 0) % 2 === 0;\r\n const newPar = {\r\n first: false,\r\n second: false,\r\n };\r\n if (even) {\r\n newPar.first = true;\r\n newPar.second = i + 1 < n && chunkIndices[i + 1] === chunkIndices[i] + 1;\r\n if (newPar.second) {\r\n ++i;\r\n }\r\n } else {\r\n newPar.second = true;\r\n }\r\n chunksIdx.push(Math.floor(val / 2));\r\n cylinderInfo.push(newPar);\r\n }\r\n return { indices: chunksIdx, cylinderInfo };\r\n}\r\n\r\nfunction _assignOpacity(cylinderInfo, color1, color2) {\r\n for (let i = 0, n = cylinderInfo.length; i < n; ++i) {\r\n const info = cylinderInfo[i];\r\n if (!info.first) {\r\n color1[COLOR_SIZE * i] = -0.5;\r\n }\r\n if (!info.second) {\r\n color2[COLOR_SIZE * i] = -0.5;\r\n }\r\n }\r\n}\r\nclass Instanced2CCylindersGeometry extends THREE.InstancedBufferGeometry {\r\n constructor(instanceCount, polyComplexity, useZSprites, openEnded) {\r\n super();\r\n this._useZSprites = useZSprites;\r\n this._cylGeometry = useZSprites ? new THREE.PlaneGeometry(2, 2, 1, 1)\r\n : new CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, openEnded);\r\n this._init(instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n this._collisionGeo = new Simple2CCylindersGeometry(instanceCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const matrix = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n let me = matrix.elements;\r\n const mtxOffset = itemIdx * OFFSET_SIZE;\r\n\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, itemRad);\r\n setArrayXYZW(this._matVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._matVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._matVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n\r\n if (this._useZSprites) {\r\n invMatrix.copy(matrix).invert();\r\n me = invMatrix.elements;\r\n setArrayXYZW(this._invmatVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._invmatVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._invmatVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n }\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const colorIdx = itemIdx * COLOR_SIZE;\r\n tmpColor.set(colorVal1);\r\n setArrayXYZ(this._color1, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n tmpColor.set(colorVal2);\r\n setArrayXYZ(this._color2, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n computeBoundingSphere() {\r\n this._collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = this._collisionGeo.boundingSphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n this._collisionGeo.computeBoundingBox();\r\n this.boundingBox = this._collisionGeo.boundingBox;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('matVector1').needsUpdate = true;\r\n this.getAttribute('matVector2').needsUpdate = true;\r\n this.getAttribute('matVector3').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('color2').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n if (this._useZSprites) {\r\n this.getAttribute('invmatVector1').needsUpdate = true;\r\n this.getAttribute('invmatVector2').needsUpdate = true;\r\n this.getAttribute('invmatVector3').needsUpdate = true;\r\n }\r\n\r\n this._collisionGeo.finishUpdate();\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[Math.floor(chunkIndices[i] / 2)] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const info = _prepareCylinderInfo(chunkIndices);\r\n const cylinderIndices = info.indices;\r\n const instanceCount = cylinderIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n copySubArrays(this._matVector1, geom._matVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector2, geom._matVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector3, geom._matVector3, cylinderIndices, OFFSET_SIZE);\r\n\r\n if (this._useZSprites) {\r\n copySubArrays(this._invmatVector1, geom._invmatVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector2, geom._invmatVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector3, geom._invmatVector3, cylinderIndices, OFFSET_SIZE);\r\n }\r\n\r\n copySubArrays(this._color1, geom._color1, cylinderIndices, COLOR_SIZE);\r\n copySubArrays(this._color2, geom._color2, cylinderIndices, COLOR_SIZE);\r\n _assignOpacity(info.cylinderInfo, geom._color1, geom._color2);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n getGeoParams() {\r\n return this._cylGeometry.parameters;\r\n }\r\n\r\n _init(instanceCount, cylinderGeo, useZSprites) {\r\n this.copy(cylinderGeo);\r\n this._matVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._color1 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n this._color2 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, instanceCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('matVector1', new THREE.InstancedBufferAttribute(this._matVector1, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector2', new THREE.InstancedBufferAttribute(this._matVector2, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector3', new THREE.InstancedBufferAttribute(this._matVector3, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._color1, COLOR_SIZE, false, 1));\r\n this.setAttribute('color2', new THREE.InstancedBufferAttribute(this._color2, COLOR_SIZE, false, 1));\r\n\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(this._alpha, 1, false, 1));\r\n\r\n if (useZSprites) {\r\n this._invmatVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n\r\n this.setAttribute(\r\n 'invmatVector1',\r\n new THREE.InstancedBufferAttribute(this._invmatVector1, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector2',\r\n new THREE.InstancedBufferAttribute(this._invmatVector2, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector3',\r\n new THREE.InstancedBufferAttribute(this._invmatVector3, OFFSET_SIZE, false, 1),\r\n );\r\n }\r\n }\r\n}\r\n\r\nexport default Instanced2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst TRI_SIZE = 3;\r\nconst tmpPrev = new THREE.Vector3();\r\nconst tmpNext = new THREE.Vector3();\r\nconst tmpRes = new THREE.Vector3();\r\nconst simpleNormal = new THREE.Vector3(1.0, 0.0, 0.0);\r\nconst normalOnCut = new THREE.Vector3();\r\nconst nearRingPt = new THREE.Vector3();\r\n\r\nfunction _createExtrudedChunkGeometry(shape, ringsCount) {\r\n const geo = new THREE.BufferGeometry();\r\n const ptsCount = shape.length;\r\n const totalPts = ptsCount * ringsCount;\r\n const type = totalPts <= 65536 ? Uint16Array : Uint32Array;\r\n const facesPerChunk = (ringsCount - 1) * ptsCount * 2;\r\n const indices = new THREE.BufferAttribute(utils.allocateTyped(type, facesPerChunk * TRI_SIZE), 1);\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n for (let y = 0; y < ringsCount; y++) {\r\n // faces\r\n if (y !== ringsCount - 1) {\r\n for (let i = 0; i < ptsCount; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + ptsCount + i;\r\n const v3 = currVtxIdx + ptsCount + ((i + 1) % ptsCount);\r\n const v4 = currVtxIdx + ((i + 1) % ptsCount);\r\n\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n currVtxIdx += ptsCount;\r\n }\r\n\r\n geo.setIndex(indices);\r\n const pos = utils.allocateTyped(Float32Array, totalPts * VEC_SIZE);\r\n geo.setAttribute('position', new THREE.BufferAttribute(pos, VEC_SIZE));\r\n\r\n geo._positions = shape;\r\n\r\n return geo;\r\n}\r\n\r\nclass ExtrudedObjectsGeometry extends ChunkedObjectsGeometry {\r\n constructor(shape, ringsCount, chunksCount) {\r\n const chunkGeo = _createExtrudedChunkGeometry(shape, ringsCount);\r\n super(chunkGeo, chunksCount);\r\n this._ringsCount = ringsCount;\r\n\r\n const tmpShape = this._tmpShape = [];\r\n for (let i = 0; i < shape.length; ++i) {\r\n tmpShape[i] = new THREE.Vector3();\r\n }\r\n }\r\n\r\n setItem(itemIdx, matrices, hasSlope = false, hasCut = false) {\r\n const ptsCount = this._chunkGeo._positions.length;\r\n const ringsCount = this._ringsCount;\r\n const chunkStartIdx = ptsCount * this._ringsCount * itemIdx * VEC_SIZE;\r\n\r\n this._setPoints(matrices, ptsCount, ringsCount, chunkStartIdx);\r\n\r\n if (hasSlope) {\r\n this._setSlopeNormals(ptsCount, ringsCount, chunkStartIdx);\r\n } else {\r\n this._setBaseNormals(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n\r\n if (hasCut) {\r\n this._addCut(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n }\r\n\r\n _setPoints(matrices, ptsCount, ringsCount, chunkStartIdx) {\r\n const tmpShape = this._tmpShape;\r\n const positions = this._positions;\r\n const shape = this._chunkGeo._positions;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i) {\r\n const mtx = matrices[i];\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpShape[j].copy(shape[j]).applyMatrix4(mtx).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _setBaseNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, false);\r\n }\r\n }\r\n\r\n _setSlopeNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const normals = this._normals;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First ring\r\n // In all cases, besides cut, second ring is coincident to first. So values of first ring's normals doesn't\r\n // matter (In the cut case special handler will be applied later and will set them to correct values)\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n simpleNormal.toArray(normals, vtxIdx);\r\n }\r\n // second ring\r\n // If it isn't first Item we take normals' values from the last ring of the previous item (these rings are coincident)\r\n // else we count normals' values based on next ring information\r\n if (vtxIdx - 2 * nPtsInRing > 0) {\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(normals, vtxIdx - 2 * nPtsInRing).toArray(normals, vtxIdx);\r\n }\r\n } else {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, +nPtsInRing);\r\n vtxIdx += nPtsInRing;\r\n }\r\n // other rings\r\n // we count normals' values based on previous ring information\r\n for (let i = 2; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, -nPtsInRing);\r\n }\r\n }\r\n\r\n // Counting normals:\r\n // - Slope\r\n // Radius changes throught part => normals aren't parallel with the plane contains section points\r\n // normal = vTangentInSectionPlane x vToSuchPointInPrevSection (all vectors are scaled for being 1 in length)\r\n // - No slope\r\n // Radius doesn't change throught part => normals are parallel with the plane contains section points\r\n // normal = vToPrevPointInSection + vToNextPointInSection (all vectors are scaled for being 1 in length)\r\n _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) {\r\n const tmpShape = this._tmpShape;\r\n const normals = this._normals;\r\n\r\n tmpShape[0].fromArray(this._positions, vtxIdx);\r\n tmpShape[ptsCount - 1].fromArray(this._positions, vtxIdx + (ptsCount - 1) * VEC_SIZE);\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n if (j < ptsCount - 1) {\r\n tmpShape[j + 1].fromArray(this._positions, vtxIdx + VEC_SIZE);\r\n }\r\n\r\n if (isSlope) {\r\n nearRingPt.fromArray(this._positions, vtxIdx + shiftToExtraPt);\r\n\r\n tmpPrev.subVectors(tmpShape[(j + ptsCount - 1) % ptsCount], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], nearRingPt).normalize();\r\n tmpRes.crossVectors(tmpNext, tmpPrev).normalize().toArray(normals, vtxIdx);\r\n } else {\r\n tmpPrev.subVectors(tmpShape[j], tmpShape[(j + ptsCount - 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpRes.addVectors(tmpPrev, tmpNext).normalize().toArray(normals, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _addCut(ptsCount, ringsCount, chunkStartIdx) {\r\n // Nothing to do if item is flat or only line\r\n if (ptsCount < 3 || ringsCount < 2) {\r\n return;\r\n }\r\n const positions = this._positions;\r\n const normals = this._normals;\r\n const tmpShape = this._tmpShape;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n // Normal to the cut plane is equal to cross product of two vectors which are lying in it\r\n tmpShape[0].fromArray(positions, chunkStartIdx);\r\n tmpShape[1].fromArray(positions, chunkStartIdx + VEC_SIZE);\r\n tmpShape[2].fromArray(positions, chunkStartIdx + 2 * VEC_SIZE);\r\n\r\n tmpPrev.subVectors(tmpShape[1], tmpShape[0]).normalize();\r\n tmpNext.subVectors(tmpShape[1], tmpShape[2]).normalize();\r\n normalOnCut.crossVectors(tmpPrev, tmpNext).normalize();\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First and second rings normals' values are equal to value of normal to the cutting plane\r\n for (let j = 0; j < ptsCount * 2; ++j, vtxIdx += VEC_SIZE) {\r\n normalOnCut.toArray(normals, vtxIdx);\r\n }\r\n if (ringsCount > 2) {\r\n // Third ring points are coincident to first ring points, but have different normals. It makes sharp angle near cut\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(positions, vtxIdx - nPtsInRing).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default ExtrudedObjectsGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VERTEX_PER_SEGMENT = 4;\r\nconst POS_SIZE = 4;\r\nconst DIR_SIZE = 3;\r\nconst COL_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\nconst direction = new THREE.Vector3();\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction getSubset(arr, startSegmentIdx, segmentsCount, elemSize) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT;\r\n const end = start + segmentsCount * VERTEX_PER_SEGMENT;\r\n return arr.subarray(start * elemSize, end * elemSize);\r\n}\r\n\r\n/**\r\n * This class represents lines geometry which consists of screen-aligned narrow quad of variable width.\r\n *\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * collision geometry.\r\n */\r\n\r\nclass ThickLinesGeometry extends THREE.BufferGeometry {\r\n constructor(segmentsCount) {\r\n super();\r\n this._initVertices(segmentsCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n this.getAttribute('direction').needsUpdate = true;\r\n }\r\n\r\n setColor(segmentIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n setSegment(segmentIdx, pos1, pos2) {\r\n direction.subVectors(pos1, pos2);\r\n direction.normalize();\r\n const positions = this._positions;\r\n const directions = this._directions;\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n let dirIdx = segmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n }\r\n\r\n setOpacity(startSegIdx, endSegIdx, value) {\r\n const start = startSegIdx * VERTEX_PER_SEGMENT;\r\n const end = endSegIdx * VERTEX_PER_SEGMENT;\r\n _.fill(this.alpha, value, end, start);\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubsetSegments(startSegmentIdx, segmentsCount) {\r\n return [\r\n getSubset(this._positions, startSegmentIdx, segmentsCount, POS_SIZE),\r\n getSubset(this._directions, startSegmentIdx, segmentsCount, DIR_SIZE),\r\n ];\r\n }\r\n\r\n getSubsetColors(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._colors, startSegmentIdx, segmentsCount, COL_SIZE);\r\n }\r\n\r\n getSubsetOpacities(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._alpha, startSegmentIdx, segmentsCount, 1);\r\n }\r\n\r\n getNumVertexPerSegment() {\r\n return VERTEX_PER_SEGMENT;\r\n }\r\n\r\n getPositionSize() {\r\n return POS_SIZE;\r\n }\r\n\r\n setSegments(startSegmentIdx, positions) {\r\n const startPos = startSegmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n if (positions instanceof Array && positions.length === 2) {\r\n this._positions.set(positions[0], startPos);\r\n const startDir = startSegmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n this._directions.set(positions[1], startDir); // dirs are geo part of vertex\r\n } else {\r\n this._positions.set(positions, startPos);\r\n }\r\n }\r\n\r\n setColors(startSegmentIdx, colors) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n this._colors.set(colors, start);\r\n }\r\n\r\n _initVertices(segmentsCount) {\r\n this._buffersSize = segmentsCount * VERTEX_PER_SEGMENT;\r\n const pointsCount = this._buffersSize;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, segmentsCount * 6);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * POS_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * COL_SIZE);\r\n this._directions = utils.allocateTyped(Float32Array, pointsCount * DIR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n const index = this._index;\r\n let indexOffset = 0;\r\n let pointOffset = 0;\r\n for (let j = 0; j < segmentsCount; j++, indexOffset += 6, pointOffset += VERTEX_PER_SEGMENT) {\r\n index[indexOffset] = pointOffset;\r\n index[indexOffset + 1] = pointOffset + 1;\r\n index[indexOffset + 2] = pointOffset + 3;\r\n index[indexOffset + 3] = pointOffset;\r\n index[indexOffset + 4] = pointOffset + 2;\r\n index[indexOffset + 5] = pointOffset + 3;\r\n }\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, POS_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, COL_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n this.setAttribute('direction', new THREE.BufferAttribute(this._directions, DIR_SIZE));\r\n }\r\n}\r\n\r\nexport default ThickLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport BaseLinesGeometry from './ThickLinesGeometry';\r\n\r\n/**\r\n * This class represents geometry which consists lines. This can build bounding volumes\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n */\r\nclass LinesGeometry extends BaseLinesGeometry {\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n if (boundingBox) {\r\n boundingBox.getCenter(center);\r\n }\r\n const positions = this._positions;\r\n const sphere = this.boundingSphere || new THREE.Sphere();\r\n const size = this._positions.length;\r\n const pos = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n pos.set(positions[i], positions[i + 1], positions[i + 2]);\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n sphere.set(center, Math.sqrt(radiusSquared));\r\n this.boundingSphere = sphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n const positions = this._positions;\r\n const box = new THREE.Box3();\r\n const size = this._positions.length;\r\n const tmpVec = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n tmpVec.set(positions[i], positions[i + 1], positions[i + 2]);\r\n box.expandByPoint(tmpVec);\r\n }\r\n this.boundingBox = box;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n}\r\n\r\nexport default LinesGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\nclass CylinderCollisionGeo extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const itemOffset = chunkSize * itemIdx * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, itemOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, itemOffset);\r\n }\r\n}\r\nexport default CylinderCollisionGeo;\r\n","import LinesGeometry from './LinesGeometry';\r\nimport CylinderCollisionGeo from './CylinderCollisionGeo';\r\n\r\nconst COLLISION_RAD = 0.1;\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n *\r\n * @param {number} chunksCount Total chunks count.\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * @param {boolean} enableCollision Enable or disable collision where each segment is\r\n * a collidable cylinder.\r\n * collision geometry.\r\n */\r\nclass ChunkedLinesGeometry extends LinesGeometry {\r\n constructor(chunksCount, segmentsCount, enableCollision) {\r\n super(chunksCount * segmentsCount);\r\n this._init(segmentsCount);\r\n this._collisionGeo = enableCollision ? new CylinderCollisionGeo(chunksCount * segmentsCount, 3) : null;\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = collisionGeo.boundingSphere;\r\n return;\r\n }\r\n super.computeBoundingSphere();\r\n }\r\n\r\n computeBoundingBox() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingBox();\r\n this.boundingBox = collisionGeo.boundingBox;\r\n return;\r\n }\r\n super.computeBoundingBox();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const collisionGeo = this._collisionGeo;\r\n if (!collisionGeo) {\r\n return;\r\n }\r\n const segCount = this._chunkSize;\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n for (let i = 0, n = intersects.length; i < n; ++i) {\r\n let { chunkIdx } = intersects[i];\r\n if (chunkIdx === undefined) {\r\n continue;\r\n }\r\n chunkIdx = (chunkIdx / segCount) | 0;\r\n intersects[i].chunkIdx = chunkIdx;\r\n }\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n super.setColor(i, colorVal);\r\n }\r\n }\r\n\r\n setSegment(chunkIdx, segIdx, pos1, pos2) {\r\n const chunkSize = this._chunkSize;\r\n const idx = chunkIdx * chunkSize + segIdx;\r\n super.setSegment(idx, pos1, pos2);\r\n if (this._collisionGeo) {\r\n this._collisionGeo.setItem(chunkIdx * chunkSize + segIdx, pos1, pos2, COLLISION_RAD);\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n super.setOpacity(left, left + chunkSize - 1, value);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const chunkSize = this._chunkSize;\r\n const subset = new ChunkedLinesGeometry(instanceCount, chunkSize, false);\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const startSegIdx = chunkIndices[i] * chunkSize;\r\n subset.setSegments(dstPtOffset, this.getSubsetSegments(startSegIdx, chunkSize));\r\n subset.setColors(dstPtOffset, this.getSubsetColors(startSegIdx, chunkSize));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(chunkSize) {\r\n this._chunkSize = chunkSize;\r\n }\r\n}\r\n\r\nexport default ChunkedLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport LinesGeometry from './LinesGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\n\r\nconst COLLISION_RAD = 0.3;\r\nconst tmpVector = new THREE.Vector3();\r\n\r\nclass TwoColorLinesGeometry extends LinesGeometry {\r\n constructor(segmentsCount) {\r\n super(segmentsCount * 2);\r\n this._init(segmentsCount);\r\n this._collisionGeo = new Simple2CCylindersGeometry(segmentsCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos) {\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, COLLISION_RAD);\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n tmpVector.lerpVectors(botPos, topPos, 0.5);\r\n super.setSegment(offset, botPos, tmpVector);\r\n super.setSegment(offset + 1, tmpVector, topPos);\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n super.setColor(offset, colorVal1);\r\n super.setColor(offset + 1, colorVal2);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n if (this._collisionGeo) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n getSubset(segmentIndices) {\r\n const instanceCount = segmentIndices.length;\r\n const subset = new TwoColorLinesGeometry(instanceCount, false);\r\n for (let i = 0, n = instanceCount; i < n; ++i) {\r\n const startSegIdx = segmentIndices[i];\r\n subset.setSegments(i, this.getSubsetSegments(startSegIdx, 1));\r\n subset.setColors(i, this.getSubsetColors(startSegIdx, 1));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(segmentsCount) {\r\n this._segCounts = segmentsCount * 2;\r\n }\r\n}\r\n// (???)parent = LinesGeometry.prototype;\r\n\r\nexport default TwoColorLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst vectors = [\r\n new THREE.Vector3(1, 0, 0),\r\n new THREE.Vector3(-1, 0, 0),\r\n new THREE.Vector3(0, 1, 0),\r\n new THREE.Vector3(0, -1, 0),\r\n new THREE.Vector3(0, 0, 1),\r\n new THREE.Vector3(0, 0, -1),\r\n];\r\nconst vecCount = vectors.length;\r\nconst tempPos1 = new THREE.Vector3();\r\nconst tempPos2 = new THREE.Vector3();\r\n\r\nclass CrossGeometry extends SphereCollisionGeo(ChunkedLinesGeometry) {\r\n constructor(chunksCount) {\r\n super(chunksCount, chunksCount, (vecCount / 2) | 0, false);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n\r\n for (let i = 0; i < vecCount / 2; ++i) {\r\n const first = i * 2;\r\n tempPos1.x = itemPos.x + vectors[first].x * itemRad;\r\n tempPos1.y = itemPos.y + vectors[first].y * itemRad;\r\n tempPos1.z = itemPos.z + vectors[first].z * itemRad;\r\n const second = first + 1;\r\n tempPos2.x = itemPos.x + vectors[second].x * itemRad;\r\n tempPos2.y = itemPos.y + vectors[second].y * itemRad;\r\n tempPos2.z = itemPos.z + vectors[second].z * itemRad;\r\n this.setSegment(itemIdx, i, tempPos1, tempPos2);\r\n }\r\n }\r\n}\r\nexport default CrossGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst POS_RAD_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This is a base class for isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\nclass IsoSurfaceGeometry extends THREE.BufferGeometry {\r\n constructor(spheresCount, opts) {\r\n super();\r\n\r\n this._opts = opts;\r\n this.zClip = this._opts.zClip;\r\n this._posRad = utils.allocateTyped(Float32Array, spheresCount * POS_RAD_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n }\r\n\r\n setItem(chunkIdx, pos, radius) {\r\n const posRad = this._posRad;\r\n let idx = POS_RAD_SIZE * chunkIdx;\r\n posRad[idx++] = pos.x;\r\n posRad[idx++] = pos.y;\r\n posRad[idx++] = pos.z;\r\n posRad[idx] = radius;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n let idx = COLOR_SIZE * chunkIdx;\r\n colors[idx++] = tmpColor.r;\r\n colors[idx++] = tmpColor.g;\r\n colors[idx] = tmpColor.b;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n finishUpdate() {\r\n this._build();\r\n }\r\n\r\n setOpacity() {\r\n // not implemented\r\n }\r\n\r\n raycast() {\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\nexport default IsoSurfaceGeometry;\r\n","import utils from '../../utils';\r\n\r\n/**\r\n * Class for marching cube\r\n * Stores 8 points and 8 float values are stored together in linear array\r\n * Int values for has intersection or not - in integer32 linear array\r\n * Int values for bits flags - in integer32 linear array\r\n *\r\n */\r\nclass IsoSurfaceMarchCube {\r\n constructor() {\r\n this.pointsValuesLinear = null;\r\n this.hasIntersection = null;\r\n this.bitsInside = null;\r\n }\r\n\r\n create(numCellsPerSide) {\r\n const vx7000000 = 0x7000000;\r\n const n3 = numCellsPerSide * numCellsPerSide * numCellsPerSide;\r\n if (n3 > vx7000000) {\r\n throw new Error('Too large cube dimension: lead to memory huge uasge');\r\n }\r\n this.pointsValuesLinear = utils.allocateTyped(Float32Array, (2 << (2 + 2)) * n3);\r\n this.hasIntersection = utils.allocateTyped(Int32Array, n3);\r\n this.bitsInside = utils.allocateTyped(Int32Array, n3);\r\n return 0;\r\n }\r\n\r\n destroy() {\r\n this.bitsInside = null;\r\n this.hasIntersection = null;\r\n this.pointsValuesLinear = null;\r\n }\r\n}\r\n\r\n/* eslint-disable no-magic-numbers */\r\nIsoSurfaceMarchCube.prototype.striIndicesMarchCube = [\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1,\r\n 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1,\r\n 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1,\r\n 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1,\r\n 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1,\r\n 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1,\r\n 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1,\r\n 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1,\r\n 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1,\r\n 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1,\r\n 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1,\r\n 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1,\r\n 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1,\r\n 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1,\r\n 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1,\r\n 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1,\r\n 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1,\r\n 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1,\r\n 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1,\r\n 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1,\r\n 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1,\r\n 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1,\r\n 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1,\r\n 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1,\r\n 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1,\r\n 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1,\r\n 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1,\r\n 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1,\r\n 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1,\r\n 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1,\r\n 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1,\r\n 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1,\r\n 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1,\r\n 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1,\r\n 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1,\r\n 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1,\r\n 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1,\r\n 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1,\r\n 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1,\r\n 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1,\r\n 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1,\r\n 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1,\r\n 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1,\r\n 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1,\r\n 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1,\r\n 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1,\r\n 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1,\r\n 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1,\r\n 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1,\r\n 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1,\r\n 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1,\r\n 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1,\r\n 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1,\r\n 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1,\r\n 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1,\r\n 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1,\r\n 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1,\r\n 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1,\r\n 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1,\r\n 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1,\r\n 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1,\r\n 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1,\r\n 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1,\r\n 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1,\r\n 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1,\r\n 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1,\r\n 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1,\r\n 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1,\r\n 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1,\r\n 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1,\r\n 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1,\r\n 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1,\r\n 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1,\r\n 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1,\r\n 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1,\r\n 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1,\r\n 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1,\r\n 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1,\r\n 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1,\r\n 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1,\r\n 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1,\r\n 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1,\r\n 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1,\r\n 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1,\r\n 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1,\r\n 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1,\r\n 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1,\r\n 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1,\r\n 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1,\r\n 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1,\r\n 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1,\r\n 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1,\r\n 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n];\r\n/* eslint-enable no-magic-numbers */\r\n\r\nexport default IsoSurfaceMarchCube;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport utils from '../../utils';\r\n\r\nconst edgeTable = [\r\n 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,\r\n 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,\r\n 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,\r\n 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,\r\n 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,\r\n 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd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aa5, 0xbac,\r\n 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,\r\n 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,\r\n 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,\r\n 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,\r\n 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,\r\n 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,\r\n 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0];\r\n\r\nfunction _voxelGradientFast(v, point, grad) {\r\n const g = v.getValue(point.x, point.y, point.z);\r\n grad.set(g[0], g[1], g[2]);\r\n}\r\n\r\n// Helper class GridCell\r\nclass GridCell {\r\n constructor() {\r\n this._arrSize = 8;\r\n this.p = new Array(this._arrSize);\r\n this.g = new Array(this._arrSize);\r\n this.val = new Array(this._arrSize);\r\n for (let i = 0; i < this._arrSize; ++i) {\r\n this.p[i] = new THREE.Vector3();\r\n this.g[i] = new THREE.Vector3();\r\n }\r\n this.cubeIndex = 0;\r\n }\r\n}\r\n\r\n// Helper class Triangle\r\nclass Triangle {\r\n constructor() {\r\n this.a = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.b = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.c = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n }\r\n}\r\n\r\nfunction createArray(arrSize) {\r\n const arr = new Array(arrSize);\r\n for (let i = 0; i < arrSize; ++i) {\r\n arr[i] = new THREE.Vector3();\r\n }\r\n\r\n return arr;\r\n}\r\n\r\nclass IsoSurface {\r\n constructor() {\r\n this._numTriangles = 0;\r\n this._numVertices = 0;\r\n this._position = [];\r\n this._normals = [];\r\n this._colors = null;\r\n this._indices = [];\r\n this._volumetricData = null;\r\n this._xAxis = new THREE.Vector3();\r\n this._yAxis = new THREE.Vector3();\r\n this._zAxis = new THREE.Vector3();\r\n this._xDir = new THREE.Vector3();\r\n this._yDir = new THREE.Vector3();\r\n this._zDir = new THREE.Vector3();\r\n }\r\n\r\n _prepareAxesAndDirs() {\r\n const volData = this._volumetricData;\r\n\r\n const cellSize = volData.getCellSize();\r\n\r\n // calculate cell axes\r\n const xAxis = this._xAxis;\r\n const yAxis = this._yAxis;\r\n const zAxis = this._zAxis;\r\n const xDir = this._xDir;\r\n const yDir = this._yDir;\r\n const zDir = this._zDir;\r\n\r\n xAxis.set(cellSize.x, 0, 0);\r\n yAxis.set(0, cellSize.y, 0);\r\n zAxis.set(0, 0, cellSize.z);\r\n\r\n xDir.set(1, 0, 0);\r\n yDir.set(0, 1, 0);\r\n zDir.set(0, 0, 1);\r\n\r\n // flip normals if coordinate system is in the wrong handedness\r\n const tmp = new THREE.Vector3();\r\n tmp.crossVectors(xDir, yDir);\r\n if (tmp.dot(zDir) < 0) {\r\n xDir.negate();\r\n yDir.negate();\r\n zDir.negate();\r\n }\r\n\r\n // check that the grid is in the all-positive octant of the coordinate system\r\n if (xDir.x < 0 || xDir.y < 0 || xDir.z < 0\r\n || yDir.x < 0 || yDir.y < 0 || yDir.z < 0\r\n || zDir.x < 0 || zDir.y < 0 || zDir.z < 0) {\r\n return false;\r\n }\r\n\r\n // check that the grid is axis-aligned\r\n const notZero = (axe) => Math.abs(axe) > Number.EPSILON;\r\n return !(notZero(xAxis.y) || notZero(xAxis.z)\r\n || notZero(yAxis.x) || notZero(yAxis.z)\r\n || notZero(zAxis.x) || notZero(zAxis.y));\r\n }\r\n\r\n _vertexInterp(isoLevel, grid, ind1, ind2, vertex, normal) {\r\n const p1 = grid.p[ind1];\r\n const p2 = grid.p[ind2];\r\n const n1 = grid.g[ind1];\r\n const n2 = grid.g[ind2];\r\n const valP1 = grid.val[ind1];\r\n const valP2 = grid.val[ind2];\r\n const isoDiffP1 = isoLevel - valP1;\r\n const diffValP2P1 = valP2 - valP1;\r\n\r\n let mu = 0.0;\r\n\r\n if (Math.abs(diffValP2P1) > 0.0) {\r\n mu = isoDiffP1 / diffValP2P1;\r\n }\r\n mu = mu > 1.0 ? 1.0 : mu;\r\n vertex.lerpVectors(p1, p2, mu);\r\n normal.lerpVectors(n1, n2, mu);\r\n }\r\n\r\n static _triTable = IsoSurfaceMarchCube.prototype.striIndicesMarchCube;\r\n\r\n static _arrSize = 12;\r\n\r\n static _firstIndices = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3];\r\n\r\n static _secondIndices = [1, 2, 3, 0, 5, 6, 7, 4, 4, 5, 6, 7];\r\n\r\n static _vertexList = createArray(IsoSurface._arrSize);\r\n\r\n static _normalList = createArray(IsoSurface._arrSize);\r\n\r\n _polygonize(grid, isoLevel, triangles) {\r\n const { cubeIndex } = grid;\r\n let i = 0;\r\n const arrSize = IsoSurface._arrSize;\r\n const firstIndices = IsoSurface._firstIndices;\r\n const secondIndices = IsoSurface._secondIndices;\r\n const vertexList = IsoSurface._vertexList;\r\n const normalList = IsoSurface._normalList;\r\n\r\n for (; i < arrSize; ++i) {\r\n if (edgeTable[cubeIndex] & (1 << i)) {\r\n this._vertexInterp(\r\n isoLevel,\r\n grid,\r\n firstIndices[i],\r\n secondIndices[i],\r\n vertexList[i],\r\n normalList[i],\r\n );\r\n }\r\n }\r\n\r\n let triCount = 0;\r\n const triTblIdx = cubeIndex * 16;\r\n const triTable = IsoSurface._triTable;\r\n\r\n for (i = 0; triTable[triTblIdx + i] !== -1; i += 3) {\r\n triangles[triCount].a.p.copy(vertexList[triTable[triTblIdx + i]]);\r\n triangles[triCount].a.n.copy(normalList[triTable[triTblIdx + i]]);\r\n\r\n triangles[triCount].b.p.copy(vertexList[triTable[triTblIdx + i + 1]]);\r\n triangles[triCount].b.n.copy(normalList[triTable[triTblIdx + i + 1]]);\r\n\r\n triangles[triCount].c.p.copy(vertexList[triTable[triTblIdx + i + 2]]);\r\n triangles[triCount].c.n.copy(normalList[triTable[triTblIdx + i + 2]]);\r\n ++triCount;\r\n }\r\n\r\n return triCount;\r\n }\r\n\r\n _doGridPosNorms(isoValue, step, appendSimple) {\r\n const vol = this._volumetricData;\r\n const volData = this._volumetricData.getData();\r\n const dim = vol.getDimensions();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n const zSize = dim[2];\r\n const stepX = step * vol.getStrideX();\r\n const stepY = step * vol.getStrideY();\r\n const stepZ = step * vol.getStrideZ();\r\n\r\n const gc = new GridCell();\r\n const gcVal = gc.val;\r\n const gcValSize = gc.val.length;\r\n const additions = [\r\n new THREE.Vector3(0, 0, 0), // 0\r\n new THREE.Vector3(step, 0, 0), // 1\r\n new THREE.Vector3(step, step, 0), // 2\r\n new THREE.Vector3(0, step, 0), // 3\r\n new THREE.Vector3(0, 0, step), // 4\r\n new THREE.Vector3(step, 0, step), // 5\r\n new THREE.Vector3(step, step, step), // 6\r\n new THREE.Vector3(0, step, step), // 7\r\n ];\r\n\r\n const tmpTriCount = 5;\r\n const triangles = new Array(tmpTriCount);\r\n for (let j = 0; j < tmpTriCount; ++j) {\r\n triangles[j] = new Triangle();\r\n }\r\n\r\n let appendVertex;\r\n const self = this;\r\n const positions = this._position;\r\n const normals = this._normals;\r\n if (appendSimple) {\r\n // Special case for axis-aligned grid with positive unit vector normals\r\n appendVertex = (function () {\r\n const axis = new THREE.Vector3(self._xAxis.x, self._yAxis.y, self._zAxis.z);\r\n return function (triVertex) {\r\n const vertex = triVertex.p.clone();\r\n vertex.multiply(axis);\r\n positions.push(vertex.add(self._origin));\r\n normals.push(triVertex.n.clone());\r\n };\r\n }());\r\n } else {\r\n appendVertex = (function () {\r\n const posMtx = new THREE.Matrix3();\r\n posMtx.set(\r\n self._xAxis.x,\r\n self._yAxis.x,\r\n self._zAxis.x,\r\n self._xAxis.y,\r\n self._yAxis.y,\r\n self._zAxis.y,\r\n self._xAxis.z,\r\n self._yAxis.z,\r\n self._zAxis.z,\r\n );\r\n const normMtx = new THREE.Matrix3();\r\n normMtx.set(\r\n self._xDir.x,\r\n self._yDir.x,\r\n self._zDir.x,\r\n self._xDir.y,\r\n self._yDir.y,\r\n self._zDir.y,\r\n self._xDir.z,\r\n self._yDir.z,\r\n self._zDir.z,\r\n );\r\n\r\n return function (triVertex) {\r\n positions.push(triVertex.p.clone().applyMatrix3(posMtx).add(self._origin));\r\n normals.push(triVertex.n.clone().applyMatrix3(normMtx));\r\n };\r\n }());\r\n }\r\n const indices = this._indices;\r\n\r\n let globTriCount = 0;\r\n\r\n for (let z = 0; z < (zSize - step); z += step) {\r\n for (let y = 0; y < (ySize - step); y += step) {\r\n let idx = vol.getDirectIdx(0, y, z);\r\n for (let x = 0; x < (xSize - step); x += step, idx += stepX) {\r\n /* eslint-disable no-multi-spaces */\r\n /* eslint-disable computed-property-spacing */\r\n gcVal[0] = volData[idx];\r\n gcVal[1] = volData[idx + stepX];\r\n gcVal[3] = volData[idx + stepY];\r\n gcVal[2] = volData[idx + stepX + stepY];\r\n gcVal[4] = volData[idx + stepZ];\r\n gcVal[5] = volData[idx + stepX + stepZ];\r\n gcVal[7] = volData[idx + stepY + stepZ];\r\n gcVal[6] = volData[idx + stepX + stepY + stepZ];\r\n /* eslint-enable no-multi-spaces */\r\n /* eslint-enable computed-property-spacing */\r\n\r\n // Determine the index into the edge table which\r\n // tells us which vertices are inside of the surface\r\n let cubeIndex = 0;\r\n let i = 0;\r\n for (; i < gcValSize; ++i) {\r\n if (gcVal[i] < isoValue) {\r\n cubeIndex |= (1 << i);\r\n }\r\n }\r\n\r\n if (edgeTable[cubeIndex] === 0) {\r\n continue;\r\n }\r\n\r\n gc.cubeIndex = cubeIndex;\r\n for (i = 0; i < gcValSize; ++i) {\r\n gc.p[i].set(x + additions[i].x, y + additions[i].y, z + additions[i].z);\r\n _voxelGradientFast(this._gradient, gc.p[i], gc.g[i]);\r\n }\r\n\r\n // calculate vertices and facets for this cube,\r\n // calculate normals by interpolating between the negated\r\n // normalized volume gradients for the 8 reference voxels\r\n const triCount = this._polygonize(gc, isoValue, triangles);\r\n globTriCount += triCount;\r\n\r\n // append triangles using different techniques\r\n for (i = 0; i < triCount; ++i) {\r\n indices.push(this._numTriangles * 3);\r\n indices.push(this._numTriangles * 3 + 1);\r\n indices.push(this._numTriangles * 3 + 2);\r\n ++this._numTriangles;\r\n\r\n appendVertex(triangles[i].a);\r\n appendVertex(triangles[i].b);\r\n appendVertex(triangles[i].c);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return globTriCount;\r\n }\r\n\r\n compute(volData, origin, isoValue, step) {\r\n this._volumetricData = volData;\r\n this._origin = origin;\r\n\r\n this._gradient = volData.computeGradient();\r\n\r\n this._doGridPosNorms(isoValue, step, this._prepareAxesAndDirs());\r\n }\r\n\r\n _remapIndices(vertexMap, idcCount) {\r\n const indices = this._indices;\r\n const newIndices = utils.allocateTyped(Uint32Array, idcCount);\r\n for (let i = 0; i < idcCount; ++i) {\r\n indices[i] = vertexMap[indices[i]];\r\n newIndices[i] = indices[i];\r\n }\r\n this._indices = newIndices;\r\n }\r\n\r\n _remapVertices(vertices, normals, count) {\r\n const newPositions = utils.allocateTyped(Float32Array, count * 3);\r\n const newNormals = utils.allocateTyped(Float32Array, count * 3);\r\n for (let i = 0; i < count; ++i) {\r\n const pos = vertices[i];\r\n newPositions[i * 3] = pos.x;\r\n newPositions[i * 3 + 1] = pos.y;\r\n newPositions[i * 3 + 2] = pos.z;\r\n const norm = normals[i].normalize();\r\n newNormals[i * 3] = norm.x;\r\n newNormals[i * 3 + 1] = norm.y;\r\n newNormals[i * 3 + 2] = norm.z;\r\n }\r\n this._position = newPositions;\r\n this._normals = newNormals;\r\n }\r\n\r\n vertexFusion(offset, len) {\r\n const faceVer = this._indices.length;\r\n const vertices = this._position;\r\n const normals = this._normals;\r\n const oldVerCount = vertices.length | 0;\r\n if (faceVer === 0 || oldVerCount === 0) {\r\n return;\r\n }\r\n const vMap = utils.allocateTyped(Uint32Array, oldVerCount);\r\n vMap[0] = 0;\r\n let newVer = 1;\r\n\r\n let i = 1;\r\n for (; i < oldVerCount; ++i) {\r\n const start = newVer - offset < 0 ? 0 : newVer - offset;\r\n const end = start + len > newVer ? newVer : start + len;\r\n let matchedIndex = -1;\r\n\r\n for (let j = start; j < end; ++j) {\r\n if (Math.abs(vertices[i] - vertices[j]) < Number.EPSILON) {\r\n matchedIndex = j;\r\n break;\r\n }\r\n }\r\n\r\n if (matchedIndex !== -1) {\r\n vMap[i] = matchedIndex;\r\n } else {\r\n vertices[newVer].copy(vertices[i]);\r\n normals[newVer].copy(normals[i]);\r\n vMap[i] = newVer;\r\n ++newVer;\r\n }\r\n }\r\n\r\n this._remapIndices(vMap, faceVer);\r\n this._remapVertices(vertices, normals, newVer);\r\n }\r\n\r\n // Assign per-vertex colors from a volumetric texture map (same dimensions as the original volumetric data).\r\n // Along with color dominating atom is determined for each vertex\r\n // and vertices with atom out of \"visible\" subset get filtered out.\r\n // XXX only handles orthogonal volumes currently\r\n setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) {\r\n let i;\r\n let idx;\r\n const numVerts = this._position.length / 3;\r\n const vertices = this._position;\r\n const origin = this._origin;\r\n const dim = this._volumetricData.getDimensions();\r\n const xs = dim[0] - 1;\r\n const ys = dim[1] - 1;\r\n const zs = dim[2] - 1;\r\n\r\n const colorData = colorMap.getData();\r\n const strideX = colorMap.getStrideX();\r\n const strideY = colorMap.getStrideY();\r\n const strideZ = colorMap.getStrideZ();\r\n\r\n let atomWeightData;\r\n let atomStrideX;\r\n let atomStrideY;\r\n let atomStrideZ;\r\n\r\n if (visibilitySelector !== null) {\r\n atomWeightData = atomWeightMap.getData();\r\n atomStrideX = atomWeightMap.getStrideX();\r\n atomStrideY = atomWeightMap.getStrideY();\r\n atomStrideZ = atomWeightMap.getStrideZ();\r\n }\r\n\r\n const xInv = 1.0 / this._xAxis.x;\r\n const yInv = 1.0 / this._yAxis.y;\r\n const zInv = 1.0 / this._zAxis.z;\r\n\r\n let atomLookup = [];\r\n let atomWeights = [];\r\n const colors = utils.allocateTyped(Float32Array, numVerts * 3);\r\n\r\n function interp(mu, idx1, idx2, c) {\r\n c[0] = (1 - mu) * colorData[idx1] + mu * colorData[idx2];\r\n c[1] = (1 - mu) * colorData[idx1 + 1] + mu * colorData[idx2 + 1];\r\n c[2] = (1 - mu) * colorData[idx1 + 2] + mu * colorData[idx2 + 2];\r\n }\r\n\r\n function collectWeight(ai, coefX, coefY, coefZ) {\r\n const a = atomMap[ai]; // atomWeightMap is a scalar field, so index into atom map should be the same\r\n if (a != null) {\r\n atomLookup[a.index] = a;\r\n const w = coefX * coefY * coefZ * atomWeightData[ai];\r\n if (typeof atomWeights[a.index] === 'undefined') {\r\n atomWeights[a.index] = w;\r\n } else {\r\n atomWeights[a.index] += w;\r\n }\r\n }\r\n }\r\n\r\n const vMap = utils.allocateTyped(Int32Array, numVerts);\r\n let newVerCount = 0;\r\n\r\n for (i = 0; i < numVerts; i++) {\r\n const ind = i * 3;\r\n const vx = (vertices[ind] - origin.x) * xInv;\r\n const vy = (vertices[ind + 1] - origin.y) * yInv;\r\n const vz = (vertices[ind + 2] - origin.z) * zInv;\r\n const x = Math.min(Math.max(vx, 0), xs) | 0;\r\n const y = Math.min(Math.max(vy, 0), ys) | 0;\r\n const z = Math.min(Math.max(vz, 0), zs) | 0;\r\n\r\n const mux = (vx - x);\r\n const muy = (vy - y);\r\n const muz = (vz - z);\r\n\r\n if (visibilitySelector != null) {\r\n // collect atom weights\r\n atomLookup = [];\r\n atomWeights = [];\r\n idx = atomWeightMap.getDirectIdx(x, y, z);\r\n collectWeight(idx, 1 - mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideX, mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideY, 1 - mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideX + atomStrideY, mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideZ, 1 - mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideZ, mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideY + atomStrideZ, 1 - mux, muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideY + atomStrideZ, mux, muy, muz);\r\n\r\n // find dominant atom\r\n let maxWeight = 0.0;\r\n let dominantIdx = -1;\r\n for (const atomIdx in atomWeights) {\r\n if (atomWeights[atomIdx] > maxWeight) {\r\n dominantIdx = atomIdx;\r\n maxWeight = atomWeights[atomIdx];\r\n }\r\n }\r\n\r\n if (dominantIdx < 0 || !visibilitySelector.includesAtom(atomLookup[dominantIdx])) {\r\n // this vertex doesn't belong to visible subset and will be skipped\r\n vMap[i] = -1;\r\n continue;\r\n }\r\n }\r\n\r\n vMap[i] = newVerCount++;\r\n\r\n // color tri-linear interpolation\r\n const dx = (x < xs) ? strideX : 0;\r\n const dy = (y < ys) ? strideY : 0;\r\n const dz = (z < zs) ? strideZ : 0;\r\n\r\n const c0 = [0, 0, 0];\r\n const c1 = [0, 0, 0];\r\n const c2 = [0, 0, 0];\r\n const c3 = [0, 0, 0];\r\n\r\n idx = colorMap.getDirectIdx(x, y, z);\r\n interp(mux, idx, idx + dx, c0);\r\n interp(mux, idx + dy, idx + dx + dy, c1);\r\n interp(mux, idx + dz, idx + dx + dz, c2);\r\n interp(mux, idx + dy + dz, idx + dx + dy + dz, c3);\r\n\r\n const cz0 = [0, 0, 0];\r\n cz0[0] = (1 - muy) * c0[0] + muy * c1[0];\r\n cz0[1] = (1 - muy) * c0[1] + muy * c1[1];\r\n cz0[2] = (1 - muy) * c0[2] + muy * c1[2];\r\n\r\n const cz1 = [0, 0, 0];\r\n cz1[0] = (1 - muy) * c2[0] + muy * c3[0];\r\n cz1[1] = (1 - muy) * c2[1] + muy * c3[1];\r\n cz1[2] = (1 - muy) * c2[2] + muy * c3[2];\r\n\r\n colors[ind] = (1 - muz) * cz0[0] + muz * cz1[0];\r\n colors[ind + 1] = (1 - muz) * cz0[1] + muz * cz1[1];\r\n colors[ind + 2] = (1 - muz) * cz0[2] + muz * cz1[2];\r\n }\r\n this._colors = colors;\r\n\r\n if (visibilitySelector != null) {\r\n // shift visible vertices towards beginning of array\r\n for (i = 0; i < numVerts; ++i) {\r\n const j = vMap[i];\r\n if (j < 0) {\r\n continue;\r\n }\r\n\r\n // assert: j <= i\r\n this._position[j * 3] = this._position[i * 3];\r\n this._position[j * 3 + 1] = this._position[i * 3 + 1];\r\n this._position[j * 3 + 2] = this._position[i * 3 + 2];\r\n this._normals[j * 3] = this._normals[i * 3];\r\n this._normals[j * 3 + 1] = this._normals[i * 3 + 1];\r\n this._normals[j * 3 + 2] = this._normals[i * 3 + 2];\r\n this._colors[j * 3] = this._colors[i * 3];\r\n this._colors[j * 3 + 1] = this._colors[i * 3 + 1];\r\n this._colors[j * 3 + 2] = this._colors[i * 3 + 2];\r\n }\r\n\r\n // rebuild index list\r\n const numTriangles = this._indices.length / 3;\r\n let newTriCount = 0;\r\n for (i = 0; i < numTriangles; ++i) {\r\n const i0 = vMap[this._indices[3 * i]];\r\n const i1 = vMap[this._indices[3 * i + 1]];\r\n const i2 = vMap[this._indices[3 * i + 2]];\r\n if (i0 >= 0 && i1 >= 0 && i2 >= 0) {\r\n this._indices[3 * newTriCount] = i0;\r\n this._indices[3 * newTriCount + 1] = i1;\r\n this._indices[3 * newTriCount + 2] = i2;\r\n ++newTriCount;\r\n }\r\n }\r\n\r\n // shrink arrays to data size\r\n this._position = new Float32Array(this._position.buffer.slice(0, newVerCount * 3 * 4));\r\n this._normals = new Float32Array(this._normals.buffer.slice(0, newVerCount * 3 * 4));\r\n this._colors = new Float32Array(this._colors.buffer.slice(0, newVerCount * 3 * 4));\r\n this._indices = new Uint32Array(this._indices.buffer.slice(0, newTriCount * 3 * 4));\r\n }\r\n }\r\n\r\n toMesh() {\r\n const geo = new THREE.BufferGeometry();\r\n geo.setIndex(new THREE.BufferAttribute(this._indices, 1));\r\n geo.setAttribute('position', new THREE.BufferAttribute(this._position, 3));\r\n geo.setAttribute('normal', new THREE.BufferAttribute(this._normals, 3));\r\n geo.setAttribute('color', new THREE.BufferAttribute(this._colors, 3));\r\n geo.computeBoundingSphere();\r\n return geo;\r\n }\r\n}\r\nexport default IsoSurface;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurface from './IsoSurface';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * This is a base class for volumetric maps based isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass VolumeSurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n const params = this._opts;\r\n this.numVoxels = [128, 128, 128];\r\n this.xAxis = new THREE.Vector3(1.0, 0.0, 0.0);\r\n this.yAxis = new THREE.Vector3(0.0, 1.0, 0.0);\r\n this.zAxis = new THREE.Vector3(0.0, 0.0, 1.0);\r\n\r\n this.origin = new THREE.Vector3(0.0, 0.0, 0.0);\r\n this._visibilitySelector = params.visibilitySelector;\r\n\r\n this._calcSurface(params);\r\n }\r\n\r\n _findMinMax(posRadArray) {\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n const maxPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n const minPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n for (let i = 1; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n for (let itemIdx = 0; itemIdx < itemSize; ++itemIdx) {\r\n const tmpVal = posRadArray[ind + itemIdx];\r\n maxPosRad[itemIdx] = Math.max(tmpVal, maxPosRad[itemIdx]);\r\n minPosRad[itemIdx] = Math.min(tmpVal, minPosRad[itemIdx]);\r\n }\r\n }\r\n return { maxPosRad, minPosRad };\r\n }\r\n\r\n _findNumVoxels(posRadArray, params) {\r\n const { numVoxels } = this;\r\n const minMaxValues = this._findMinMax(posRadArray);\r\n const minCoordRad = minMaxValues.minPosRad;\r\n const maxCoordRad = minMaxValues.maxPosRad;\r\n\r\n // minrad\r\n if (minCoordRad[3] > 4.0) {\r\n params.gridSpacing *= minCoordRad[3];\r\n }\r\n\r\n let gridPadding = params.radScale * maxCoordRad[3] * 1.7;\r\n let padRad = gridPadding;\r\n padRad = 0.65 * Math.sqrt(4.0 / 3.0 * Math.PI * padRad * padRad * padRad);\r\n gridPadding = Math.max(gridPadding, padRad);\r\n\r\n let i = 0;\r\n for (; i < 3; ++i) {\r\n minCoordRad[i] -= gridPadding;\r\n maxCoordRad[i] += gridPadding;\r\n }\r\n\r\n for (i = 0; i < 3; ++i) {\r\n numVoxels[i] = Math.ceil((maxCoordRad[i] - minCoordRad[i]) / params.gridSpacing);\r\n }\r\n this.xAxis.x = (numVoxels[0] - 1) * params.gridSpacing;\r\n this.yAxis.y = (numVoxels[1] - 1) * params.gridSpacing;\r\n this.zAxis.z = (numVoxels[2] - 1) * params.gridSpacing;\r\n\r\n [this.origin.x, this.origin.y, this.origin.z] = minCoordRad;\r\n\r\n return { bbox: minMaxValues, dim: numVoxels };\r\n }\r\n\r\n _makeSurface(surface, params) {\r\n const isoSurf = new IsoSurface();\r\n isoSurf.compute(surface.volMap, this.origin, params.isoValue, 1);\r\n isoSurf.vertexFusion(9, 9);// normalization is included\r\n\r\n if (isoSurf._numTriangles > 0) {\r\n isoSurf.setColorVolTex(surface.volTexMap, surface.atomMap, surface.atomWeightMap, this._visibilitySelector);\r\n this.setIndex(new THREE.BufferAttribute(isoSurf._indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(isoSurf._position, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(isoSurf._normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(isoSurf._colors, 3));\r\n } else { // geometry should have at least empty position attributes to be processed in wireframe mode by three.js\r\n this.setAttribute('position', new THREE.BufferAttribute(utils.allocateTyped(Float32Array, 0), 3));\r\n }\r\n }\r\n\r\n _calcSurface(params) {\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n\r\n if (packedArrays.posRad.length === 0) {\r\n return;\r\n }\r\n const boundaries = this._findNumVoxels(packedArrays.posRad, params);\r\n\r\n const box = new THREE.Box3(\r\n this.origin,\r\n new THREE.Vector3(this.xAxis.x, this.yAxis.y, this.zAxis.z).add(this.origin),\r\n );\r\n const surface = this._computeSurface(packedArrays, box, boundaries, params);\r\n\r\n this._makeSurface(surface, params);\r\n }\r\n}\r\n\r\nexport default VolumeSurfaceGeometry;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass QuickSurfGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n // beware of shifting this multiple times!\r\n this._shiftByOrigin(packedArrays.posRad);\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3),\r\n };\r\n\r\n if (this._visibilitySelector != null) {\r\n surface.atomMap = [];\r\n surface.atomWeightMap = new Volume(Float32Array, this.numVoxels, box);\r\n }\r\n\r\n this.gaussdensity(surface, packedArrays, null, params);\r\n return surface;\r\n }\r\n\r\n gaussdensity(surface, packedArrays, atomicNum, params) {\r\n const numAtoms = packedArrays.posRad.length / 4;\r\n const { posRad, colors } = packedArrays;\r\n const { numVoxels } = this;\r\n const { radScale, gaussLim, gridSpacing } = params;\r\n const invIsoValue = 1.0 / params.isoValue;\r\n const invGridSpacing = 1.0 / gridSpacing;\r\n const maxVoxelX = numVoxels[0] - 1;\r\n const maxVoxelY = numVoxels[1] - 1;\r\n const maxVoxelZ = numVoxels[2] - 1;\r\n // TODO is densityMap and volTexMap initialized?\r\n\r\n const { volMap, volTexMap } = surface;\r\n const volData = volMap.getData();\r\n const strideX = volMap.getStrideX();\r\n\r\n const volTexData = volTexMap.getData();\r\n const texStrideX = volTexMap.getStrideX();\r\n\r\n let atomWeightData;\r\n if (this._visibilitySelector != null) {\r\n atomWeightData = surface.atomWeightMap.getData();\r\n }\r\n\r\n const { atomMap } = surface;\r\n\r\n for (let i = 0; i < numAtoms; ++i) {\r\n const ind = i * 4;\r\n const scaledRad = posRad[ind + 3] * radScale;\r\n const atomicNumFactor = atomicNum === null ? 1.0 : atomicNum[i];\r\n const radInv = 1 / (2 * scaledRad * scaledRad);\r\n let radLim = gaussLim * scaledRad;\r\n const radLim2 = radLim * radLim;\r\n radLim *= invGridSpacing;\r\n\r\n let tmp = posRad[ind] * invGridSpacing;\r\n const xMin = Math.max((tmp - radLim) | 0, 0);\r\n const xMax = Math.min((tmp + radLim) | 0, maxVoxelX);\r\n tmp = posRad[ind + 1] * invGridSpacing;\r\n const yMin = Math.max((tmp - radLim) | 0, 0);\r\n const yMax = Math.min((tmp + radLim) | 0, maxVoxelY);\r\n tmp = posRad[ind + 2] * invGridSpacing;\r\n const zMin = Math.max((tmp - radLim) | 0, 0);\r\n const zMax = Math.min((tmp + radLim) | 0, maxVoxelZ);\r\n\r\n let dz = zMin * gridSpacing - posRad[ind + 2];\r\n for (let z = zMin; z <= zMax; ++z, dz += gridSpacing) {\r\n let dy = yMin * gridSpacing - posRad[ind + 1];\r\n for (let y = yMin; y <= yMax; ++y, dy += gridSpacing) {\r\n const dy2dz2 = dy * dy + dz * dz;\r\n\r\n if (dy2dz2 >= radLim2) {\r\n continue;\r\n }\r\n\r\n let addr = volMap.getDirectIdx(xMin, y, z);\r\n let texAddr = volTexMap.getDirectIdx(xMin, y, z);\r\n let dx = xMin * gridSpacing - posRad[ind];\r\n for (let x = xMin; x <= xMax; ++x, dx += gridSpacing, addr += strideX, texAddr += texStrideX) {\r\n const r2 = dx * dx + dy2dz2;\r\n const expVal = -r2 * radInv;\r\n\r\n let density = Math.exp(expVal) * atomicNumFactor;\r\n\r\n // store most relevant atom (with highest density)\r\n if (this._visibilitySelector != null\r\n && density > atomWeightData[addr]) { // NOSONAR\r\n atomWeightData[addr] = density;\r\n // we use same index into atom map and atomWeightMap\r\n atomMap[addr] = packedArrays.atoms[i];\r\n }\r\n\r\n volData[addr] += density;\r\n\r\n // TODO check for volTexMap routine?\r\n density *= invIsoValue;\r\n const colInd = i * 3;\r\n volTexData[texAddr] += density * colors[colInd];\r\n volTexData[texAddr + 1] += density * colors[colInd + 1];\r\n volTexData[texAddr + 2] += density * colors[colInd + 2];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n _shiftByOrigin(posRadArray) {\r\n const originX = this.origin.x;\r\n const originY = this.origin.y;\r\n const originZ = this.origin.z;\r\n\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n for (let i = 0; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n posRadArray[ind] -= originX;\r\n posRadArray[ind + 1] -= originY;\r\n posRadArray[ind + 2] -= originZ;\r\n }\r\n }\r\n}\r\n\r\nexport default QuickSurfGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * Modifed from SpatialHash\r\n *\r\n * Main differences are:\r\n * - Optimized grid size to ensure we only ever need to look +/-1 cell\r\n * - Aware of atomic radii and will only output atoms within rAtom + rExtra\r\n * (see withinRadii method)\r\n *\r\n * (Uses rounding rather than bitshifting as consequence of arbitrary grid size)\r\n * @class\r\n * @param {Float32Array} posRad - x, y, z coordinates and radiuses\r\n * @param {Float32Array} min - xyz min coordinates\r\n * @param {Float32Array} max - xyz max coordinates\r\n * @param {number} maxDistance - max distance\r\n */\r\nfunction AVHash(posRad, min, max, maxDistance) {\r\n const itemSize = 4;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const minX = min[0];\r\n const minY = min[1];\r\n const minZ = min[2];\r\n\r\n const maxX = max[0];\r\n const maxY = max[1];\r\n const maxZ = max[2];\r\n\r\n function hashFunc(w, minW) {\r\n return Math.floor((w - minW) / maxDistance);\r\n }\r\n\r\n const iDim = hashFunc(maxX, minX) + 1;\r\n const jDim = hashFunc(maxY, minY) + 1;\r\n const kDim = hashFunc(maxZ, minZ) + 1;\r\n\r\n const nCells = iDim * jDim * kDim;\r\n\r\n const jkDim = jDim * kDim;\r\n\r\n /* Get cellID for cartesian x,y,z */\r\n const cellID = function (x, y, z) {\r\n return (((hashFunc(x, minX) * jDim) + hashFunc(y, minY)) * kDim) + hashFunc(z, minZ);\r\n };\r\n\r\n /* Initial building, could probably be optimized further */\r\n const preHash = [];\r\n let i;\r\n let cid;\r\n for (i = 0; i < nAtoms; i++) {\r\n const iIdx = itemSize * i;\r\n cid = cellID(posRad[iIdx], posRad[iIdx + 1], posRad[iIdx + 2]);\r\n\r\n if (preHash[cid] === undefined) {\r\n preHash[cid] = [i];\r\n } else {\r\n preHash[cid].push(i);\r\n }\r\n }\r\n\r\n const cellOffsets = utils.allocateTyped(Uint32Array, nCells);\r\n const cellLengths = utils.allocateTyped(Uint16Array, nCells);\r\n const data = utils.allocateTyped(Uint32Array, nAtoms);\r\n\r\n let offset = 0;\r\n let maxCellLength = 0;\r\n let j;\r\n for (i = 0; i < nCells; i++) {\r\n const start = cellOffsets[i] = offset;\r\n\r\n const subArray = preHash[i];\r\n\r\n if (subArray !== undefined) {\r\n for (j = 0; j < subArray.length; j++) {\r\n data[offset] = subArray[j];\r\n offset++;\r\n }\r\n }\r\n\r\n const cellLength = offset - start;\r\n cellLengths[i] = cellLength;\r\n\r\n if (cellLength > maxCellLength) {\r\n maxCellLength = cellLength;\r\n }\r\n }\r\n\r\n // Maximum number of neighbours we could ever produce (27 adjacent cells of equal population)\r\n this.neighbourListLength = (27 * maxCellLength) + 1;\r\n\r\n /**\r\n * Populate the supplied out array with atom indices that are within rAtom + rExtra\r\n * of x,y,z\r\n *\r\n * -1 in out array indicates the end of the list\r\n *\r\n * @param {number} x - x coordinate\r\n * @param {number} y - y coordinate\r\n * @param {number} z - z coordinate\r\n * @param {number} rExtra - additional radius\r\n * @param {Float32Array} out - pre-allocated output array\r\n * @return {undefined}\r\n */\r\n this.withinRadii = function (x, y, z, rExtra, out) {\r\n let outIdx = 0;\r\n\r\n const nearI = hashFunc(x, minX);\r\n const nearJ = hashFunc(y, minY);\r\n const nearK = hashFunc(z, minZ);\r\n\r\n const loI = Math.max(0, nearI - 1);\r\n const loJ = Math.max(0, nearJ - 1);\r\n const loK = Math.max(0, nearK - 1);\r\n\r\n const hiI = Math.min(iDim - 1, nearI + 1);\r\n const hiJ = Math.min(jDim - 1, nearJ + 1);\r\n const hiK = Math.min(kDim - 1, nearK + 1);\r\n\r\n for (i = loI; i <= hiI; ++i) {\r\n const iOffset = i * jkDim;\r\n\r\n for (j = loJ; j <= hiJ; ++j) {\r\n const jOffset = j * kDim;\r\n\r\n for (let k = loK; k <= hiK; ++k) {\r\n cid = iOffset + jOffset + k;\r\n\r\n const cellStart = cellOffsets[cid];\r\n const cellEnd = cellStart + cellLengths[cid];\r\n\r\n for (let dataIndex = cellStart; dataIndex < cellEnd; dataIndex++) {\r\n const atomIndex = data[dataIndex];\r\n const baseIndex = itemSize * atomIndex;\r\n const dx = posRad[baseIndex] - x;\r\n const dy = posRad[baseIndex + 1] - y;\r\n const dz = posRad[baseIndex + 2] - z;\r\n const rSum = posRad[baseIndex + 3] + rExtra;\r\n\r\n if ((dx * dx + dy * dy + dz * dz) <= (rSum * rSum)) {\r\n out[outIdx++] = data[dataIndex];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Add terminator\r\n out[outIdx] = -1;\r\n };\r\n}\r\nfunction ContactSurface(packedArrays, boundaries, params, _indexList) {\r\n // Field generation method adapted from AstexViewer (Mike Hartshorn)\r\n // by Fred Ludlow.\r\n // Other parts based heavily on NGL (Alexander Rose) EDT Surface class\r\n //\r\n // Should work as a drop-in alternative to EDTSurface (though some of\r\n // the EDT paramters are not relevant in this method).\r\n\r\n const itemSize = 4;\r\n const { posRad, colors, atoms } = packedArrays;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const { bbox } = boundaries;\r\n\r\n const min = bbox.minPosRad;\r\n const max = bbox.maxPosRad;\r\n\r\n let r2; // Atom positions, expanded radii (squared)\r\n let maxRadius;\r\n\r\n // Parameters\r\n let probeRadius;\r\n let scaleFactor;\r\n let probePositions;\r\n\r\n // Cache last value for obscured test\r\n let lastClip = -1;\r\n\r\n // Grid params\r\n let dim;\r\n let grid;\r\n let volTex;\r\n let weights;\r\n let weightsMap = null;\r\n let atomMap = null;\r\n let visibilitySelector = null;\r\n\r\n // grid indices -> xyz coords\r\n let gridx;\r\n let gridy;\r\n let gridz;\r\n\r\n // Lookup tables:\r\n let sinTable;\r\n let cosTable;\r\n\r\n // Spatial Hash\r\n let hash;\r\n\r\n // Neighbour array to be filled by hash\r\n let neighbours;\r\n\r\n // Vectors for Torus Projection\r\n const mid = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n1 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n2 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n let ngTorus;\r\n\r\n function uniformArray(TypeName, n, a) {\r\n const array = utils.allocateTyped(TypeName, n);\r\n for (let innI = 0; innI < n; ++innI) {\r\n array[innI] = a;\r\n }\r\n\r\n return array;\r\n }\r\n\r\n function fillGridDim(a, start, step) {\r\n for (let innI = 0; innI < a.length; innI++) {\r\n a[innI] = start + (step * innI);\r\n }\r\n }\r\n\r\n function initializeGrid() {\r\n ({ scaleFactor } = params);\r\n ({ dim } = boundaries);\r\n\r\n ngTorus = Math.min(5, 2 + Math.floor(probeRadius * scaleFactor));\r\n\r\n const gridSize = dim[0] * dim[1] * dim[2];\r\n grid = uniformArray(Float32Array, gridSize, -1001.0);\r\n volTex = utils.allocateTyped(Float32Array, gridSize * 3);\r\n weights = utils.allocateTyped(Float32Array, gridSize);\r\n if (visibilitySelector) {\r\n weightsMap = utils.allocateTyped(Float32Array, gridSize);\r\n atomMap = [];\r\n }\r\n\r\n gridx = utils.allocateTyped(Float32Array, dim[0]);\r\n gridy = utils.allocateTyped(Float32Array, dim[1]);\r\n gridz = utils.allocateTyped(Float32Array, dim[2]);\r\n\r\n fillGridDim(gridx, min[0], 1 / scaleFactor);\r\n fillGridDim(gridy, min[1], 1 / scaleFactor);\r\n fillGridDim(gridz, min[2], 1 / scaleFactor);\r\n }\r\n\r\n function initializeAngleTables() {\r\n let theta = 0.0;\r\n const step = 2 * Math.PI / probePositions;\r\n\r\n cosTable = utils.allocateTyped(Float32Array, probePositions);\r\n sinTable = utils.allocateTyped(Float32Array, probePositions);\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n cosTable[innI] = Math.cos(theta);\r\n sinTable[innI] = Math.sin(theta);\r\n theta += step;\r\n }\r\n }\r\n\r\n function initializeHash() {\r\n hash = new AVHash(posRad, min, max, 2.01 * maxRadius);\r\n neighbours = new Int32Array(hash.neighbourListLength);\r\n }\r\n\r\n function init() {\r\n ({\r\n probeRadius,\r\n scaleFactor,\r\n probePositions,\r\n visibilitySelector,\r\n } = params);\r\n r2 = utils.allocateTyped(Float32Array, nAtoms);\r\n maxRadius = 0;\r\n for (let innI = 0; innI < nAtoms; ++innI) {\r\n const rExt = posRad[innI * itemSize + 3] += probeRadius;\r\n if (rExt > maxRadius) {\r\n maxRadius = rExt;\r\n }\r\n r2[innI] = rExt * rExt;\r\n }\r\n\r\n initializeGrid();\r\n initializeAngleTables();\r\n initializeHash();\r\n\r\n lastClip = -1;\r\n }\r\n\r\n function singleAtomObscures(ai, innX, innY, innZ) {\r\n const innCI = itemSize * ai;\r\n const ra2 = r2[ai];\r\n const dx = posRad[innCI] - innX;\r\n const dy = posRad[innCI + 1] - innY;\r\n const dz = posRad[innCI + 2] - innZ;\r\n const d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n return d2 < ra2;\r\n }\r\n\r\n function obscured(innX, innY, innZ, a, b) {\r\n // Is the point at x,y,z obscured by any of the atoms\r\n // specifeid by indices in neighbours. Ignore indices\r\n // a and b (these are the relevant atoms in projectPoints/Torii)\r\n\r\n // Cache the last clipped atom (as very often the same one in\r\n // subsequent calls)\r\n let ai;\r\n\r\n if (lastClip !== -1) {\r\n ai = lastClip;\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n return ai;\r\n }\r\n lastClip = -1;\r\n }\r\n\r\n let ni = 0;\r\n ai = neighbours[ni];\r\n while (ai >= 0) {\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n lastClip = ai;\r\n return ai;\r\n }\r\n ai = neighbours[++ni];\r\n }\r\n\r\n lastClip = -1;\r\n\r\n return -1;\r\n }\r\n\r\n function projectPoints() {\r\n // For each atom:\r\n // Iterate over a subsection of the grid, for each point:\r\n // If current value < 0.0, unvisited, set positive\r\n //\r\n // In any case: Project this point onto surface of the atomic sphere\r\n // If this projected point is not obscured by any other atom\r\n // Calcualte delta distance and set grid value to minimum of\r\n // itself and delta\r\n\r\n // Should we alias frequently accessed closure constiables??\r\n // Assume JS engine capable of optimizing this\r\n // anyway...\r\n const maxRad = 4.0;\r\n const sigma = (maxRad) / 3;\r\n const sigma2Inv = 1 / (2 * sigma * sigma);\r\n\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innCI = itemSize * innI;\r\n const ax = posRad[innCI];\r\n const ay = posRad[innCI + 1];\r\n const az = posRad[innCI + 2];\r\n const ar = posRad[innCI + 3];\r\n const ar2 = r2[innI];\r\n\r\n hash.withinRadii(ax, ay, az, ar, neighbours);\r\n\r\n // Number of grid points, round this up...\r\n const ng = Math.ceil(ar * scaleFactor);\r\n\r\n // Center of the atom, mapped to grid points (take floor)\r\n const iax = Math.floor(scaleFactor * (ax - min[0]));\r\n const iay = Math.floor(scaleFactor * (ay - min[1]));\r\n const iaz = Math.floor(scaleFactor * (az - min[2]));\r\n\r\n // Extents of grid to consider for this atom\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n // Add two to these points:\r\n // - iax are floor'd values so this ensures coverage\r\n // - these are loop limits (exclusive)\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n const colIdx = innI * 3;\r\n const cr = colors[colIdx];\r\n const cg = colors[colIdx + 1];\r\n const cb = colors[colIdx + 2];\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n const dz = gridz[iz] - az;\r\n const zOffset = dim[1] * dim[0] * iz;\r\n\r\n for (let iy = miny; iy < maxy; iy++) {\r\n const dy = gridy[iy] - ay;\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n\r\n for (let ix = minx; ix < maxx; ix++) {\r\n const idx = ix + zyOffset;\r\n const dx = gridx[ix] - ax;\r\n const d2 = dzy2 + dx * dx;\r\n\r\n if (d2 < ar2) {\r\n const w = Math.exp(-d2 * sigma2Inv);\r\n const cIdx = idx * 3;\r\n volTex[cIdx] += cr * w;\r\n volTex[cIdx + 1] += cg * w;\r\n volTex[cIdx + 2] += cb * w;\r\n weights[idx] += w;\r\n if (visibilitySelector !== null && w > weightsMap[idx]) {\r\n weightsMap[idx] = w;\r\n atomMap[idx] = atoms[innI];\r\n }\r\n\r\n if (grid[idx] < 0.0) {\r\n // Unvisited, make positive\r\n grid[idx] = -grid[idx];\r\n }\r\n // Project on to the surface of the sphere\r\n // sp is the projected point ( dx, dy, dz ) * ( ra / d )\r\n const d = Math.sqrt(d2);\r\n const ap = ar / d;\r\n let spx = dx * ap;\r\n let spy = dy * ap;\r\n let spz = dz * ap;\r\n\r\n spx += ax;\r\n spy += ay;\r\n spz += az;\r\n\r\n if (obscured(spx, spy, spz, innI, -1) === -1) {\r\n const dd = ar - d;\r\n if (dd < grid[idx]) {\r\n grid[idx] = dd;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function normalToLine(out, p) {\r\n out.x = out.y = out.z = 1.0;\r\n if (p.x !== 0) {\r\n out.x = (p.y + p.z) / -p.x;\r\n } else if (p.y !== 0) {\r\n out.y = (p.x + p.z) / -p.y;\r\n } else if (p.z !== 0) {\r\n out.z = (p.x + p.y) / -p.z;\r\n }\r\n return out;\r\n }\r\n\r\n function projectTorus(a, b) {\r\n const aIdx = itemSize * a;\r\n const bIdx = itemSize * b;\r\n const xa = posRad[aIdx];\r\n const ya = posRad[aIdx + 1];\r\n const za = posRad[aIdx + 2];\r\n const r1 = posRad[aIdx + 3];\r\n let dx = mid.x = posRad[bIdx] - xa;\r\n let dy = mid.y = posRad[bIdx + 1] - ya;\r\n let dz = mid.z = posRad[bIdx + 2] - za;\r\n const innR2 = posRad[bIdx + 3];\r\n let d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n // This check now redundant as already done in AVHash.withinRadii\r\n // if( d2 > (( r1 + r2 ) * ( r1 + r2 )) ){ return; }\r\n\r\n const d = Math.sqrt(d2);\r\n\r\n // Find angle between a->b vector and the circle\r\n // of their intersection by cosine rule\r\n const cosA = (r1 * r1 + d * d - innR2 * innR2) / (2.0 * r1 * d);\r\n\r\n // distance along a->b at intersection\r\n const dmp = r1 * cosA;\r\n\r\n mid.normalize();\r\n\r\n // Create normal to line\r\n normalToLine(n1, mid);\r\n n1.normalize();\r\n\r\n // Cross together for second normal vector\r\n n2.crossVectors(mid, n1);\r\n n2.normalize();\r\n\r\n // r is radius of circle of intersection\r\n const rInt = Math.sqrt(r1 * r1 - dmp * dmp);\r\n\r\n n1.multiplyScalar(rInt);\r\n n2.multiplyScalar(rInt);\r\n mid.multiplyScalar(dmp);\r\n\r\n mid.x += xa;\r\n mid.y += ya;\r\n mid.z += za;\r\n\r\n lastClip = -1;\r\n\r\n const ng = ngTorus;\r\n\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n const cost = cosTable[innI];\r\n const sint = sinTable[innI];\r\n\r\n const px = mid.x + cost * n1.x + sint * n2.x;\r\n const py = mid.y + cost * n1.y + sint * n2.y;\r\n const pz = mid.z + cost * n1.z + sint * n2.z;\r\n\r\n if (obscured(px, py, pz, a, b) === -1) {\r\n // As above, iterate over our grid...\r\n // px, py, pz in grid coords\r\n const iax = Math.floor(scaleFactor * (px - min[0]));\r\n const iay = Math.floor(scaleFactor * (py - min[1]));\r\n const iaz = Math.floor(scaleFactor * (pz - min[2]));\r\n\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n dz = pz - gridz[iz];\r\n const zOffset = dim[1] * dim[0] * iz;\r\n for (let iy = miny; iy < maxy; iy++) {\r\n dy = py - gridy[iy];\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n for (let ix = minx; ix < maxx; ix++) {\r\n dx = px - gridx[ix];\r\n d2 = dzy2 + dx * dx;\r\n const idx = ix + zyOffset;\r\n const current = grid[idx];\r\n\r\n if (current > 0.0 && d2 < (current * current)) {\r\n grid[idx] = Math.sqrt(d2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function projectTorii() {\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innIdx = itemSize * innI;\r\n hash.withinRadii(\r\n posRad[innIdx],\r\n posRad[innIdx + 1],\r\n posRad[innIdx + 2],\r\n posRad[innIdx + 3],\r\n neighbours,\r\n );\r\n let ia = 0;\r\n let ni = neighbours[ia];\r\n while (ni >= 0) {\r\n if (innI < ni) {\r\n projectTorus(innI, ni);\r\n }\r\n ni = neighbours[++ia];\r\n }\r\n }\r\n }\r\n\r\n function fixNegatives() {\r\n for (let innI = 0, n = grid.length; innI < n; innI++) {\r\n if (grid[innI] < 0) grid[innI] = 0;\r\n let w = weights[innI];\r\n if (w > 0) {\r\n w = 1 / w;\r\n const innInnI = innI * 3;\r\n volTex[innInnI] *= w;\r\n volTex[innInnI + 1] *= w;\r\n volTex[innInnI + 2] *= w;\r\n }\r\n }\r\n }\r\n\r\n function getVolume() {\r\n // Basic steps are:\r\n // 1) Initialize\r\n // 2) Project points\r\n // 3) Project torii\r\n console.time('ContactSurface.getVolume');\r\n\r\n console.time('ContactSurface.init');\r\n init();\r\n console.timeEnd('ContactSurface.init');\r\n\r\n console.time('ContactSurface.projectPoints');\r\n projectPoints();\r\n console.timeEnd('ContactSurface.projectPoints');\r\n\r\n console.time('ContactSurface.projectTorii');\r\n projectTorii();\r\n console.timeEnd('ContactSurface.projectTorii');\r\n fixNegatives();\r\n console.timeEnd('ContactSurface.getVolume');\r\n }\r\n\r\n this.build = function () {\r\n // type and cutoff left in for compatibility with EDTSurface.getSurface\r\n // function signature\r\n getVolume();\r\n this.volTexMap = volTex;\r\n this.weightsMap = weightsMap;\r\n this.atomMap = atomMap;\r\n this.volMap = grid;\r\n };\r\n}\r\nexport default ContactSurface;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport ContactSurface from './ContactSurface';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'contact' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass ContactSurfaceGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n const contactSurface = new ContactSurface(packedArrays, boundaries, params);\r\n contactSurface.build();\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.volMap),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3, contactSurface.volTexMap),\r\n atomMap: contactSurface.atomMap,\r\n atomWeightMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.weightsMap),\r\n };\r\n return surface;\r\n }\r\n}\r\n\r\nexport default ContactSurfaceGeometry;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for colored atom. Need for atom structure clusterization\r\n *\r\n * @param {Vector3} vCenter Center of atom\r\n * @param {number} radiusAt Radius of atom\r\n */\r\nclass IsoSurfaceAtomColored {\r\n constructor(vCenter, radiusAt) {\r\n this.coord = new THREE.Vector3();\r\n this.coord.copy(vCenter);\r\n this.radius = radiusAt;\r\n this.colorX = 0.99999;\r\n this.colorY = 0.0;\r\n this.colorZ = 0.0;\r\n this.atomType = 0;\r\n this.srcAtom = null;\r\n }\r\n}\r\nexport default IsoSurfaceAtomColored;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n// suppress some JSHint warnings\r\n/* jshint bitwise: false */\r\n\r\n/**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numAtoms - Number of atoms in molecule\r\n * @param {Element} atoms - Array of atoms\r\n * @param {Vector3} vBoxMin - Bounding box min\r\n * @param {Vector3} vBoxMax - Bounding box max\r\n * @param {number} probeRadius - Normals for output\r\n *\r\n */\r\nclass IsosurfaceBuildNormals {\r\n constructor(numAtoms, atoms, vBoxMin, vBoxMax, probeRadius) {\r\n this._numAtoms = numAtoms;\r\n this._atoms = atoms;\r\n this._vBoxMin = new THREE.Vector3();\r\n this._vBoxMax = new THREE.Vector3();\r\n this._vBoxMin.copy(vBoxMin);\r\n this._vBoxMax.copy(vBoxMax);\r\n this._probeRadius = probeRadius;\r\n\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n }\r\n\r\n createVoxels() {\r\n let numAtomsRefs;\r\n let rad;\r\n const ATOM_VOXEL_REF_SCALE = 4.5;\r\n\r\n const numAtoms = this._numAtoms | 0;\r\n const atoms = this._atoms;\r\n const dx = this._vBoxMax.x - this._vBoxMin.x;\r\n const dy = this._vBoxMax.y - this._vBoxMin.y;\r\n const dz = this._vBoxMax.z - this._vBoxMin.z;\r\n let w = (dx < dy) ? dx : dy;\r\n w = (dz < w) ? dz : w;\r\n let maxRad = 0.0;\r\n let aveRad = 0.0;\r\n\r\n let i;\r\n for (i = 0; i < numAtoms; i++) {\r\n rad = (atoms[i].radius + this._probeRadius) * 2.0;\r\n maxRad = (rad > maxRad) ? rad : maxRad;\r\n aveRad += rad;\r\n }\r\n let numCells = Math.floor(w / maxRad);\r\n if (numCells < 2) {\r\n numCells = 2;\r\n }\r\n aveRad /= numAtoms;\r\n\r\n this._numCells = numCells;\r\n this._aveRad = aveRad;\r\n this._maxRad = maxRad;\r\n\r\n const side = numCells;\r\n const side2 = numCells * numCells;\r\n const side3 = numCells * numCells * numCells;\r\n\r\n const xScale = this._xScale = 1.0 / (this._vBoxMax.x - this._vBoxMin.x);\r\n const yScale = this._yScale = 1.0 / (this._vBoxMax.y - this._vBoxMin.y);\r\n const zScale = this._zScale = 1.0 / (this._vBoxMax.z - this._vBoxMin.z);\r\n\r\n // estimate number of individual atom refs in each voxel list\r\n let maxAtomsRefs = 0;\r\n\r\n const xNumVoxMult = xScale * numCells;\r\n const yNumVoxMult = yScale * numCells;\r\n const zNumVoxMult = zScale * numCells;\r\n\r\n for (i = 0; i < numAtoms; i++) {\r\n const radAffect = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n const diaAffect = radAffect * 2.0;\r\n let numVoxX = Math.floor(xNumVoxMult * diaAffect + 0.8);\r\n let numVoxY = Math.floor(yNumVoxMult * diaAffect + 0.8);\r\n let numVoxZ = Math.floor(zNumVoxMult * diaAffect + 0.8);\r\n // avoid case numVox? == 0\r\n // also use loop i <=\r\n numVoxX++;\r\n numVoxY++;\r\n numVoxZ++;\r\n maxAtomsRefs += numVoxX * numVoxY * numVoxZ;\r\n } // for (i)\r\n // maxAtomsRefs = numAtoms * MAX_ATOMS_IN_SINGLE_VOXEL;\r\n\r\n this._voxelList = utils.allocateTyped(Int32Array, side3);\r\n const atomsList = [];\r\n atomsList.length = maxAtomsRefs;\r\n if ((this._voxelList === null) || (atomsList === null)) {\r\n return 0 - 1;\r\n }\r\n // init voxel list\r\n for (i = 0; i < side3; i++) {\r\n this._voxelList[i] = -1;\r\n }\r\n numAtomsRefs = 0;\r\n\r\n // create voxel lists\r\n for (i = 0; i < numAtoms; i++) {\r\n // use multiplier 4 to locate this atom in different voxels\r\n rad = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n let xIndMin = Math.floor((atoms[i].coord.x - this._vBoxMin.x - rad) * numCells * xScale);\r\n let yIndMin = Math.floor((atoms[i].coord.y - this._vBoxMin.y - rad) * numCells * yScale);\r\n let zIndMin = Math.floor((atoms[i].coord.z - this._vBoxMin.z - rad) * numCells * zScale);\r\n let xIndMax = Math.floor((atoms[i].coord.x - this._vBoxMin.x + rad) * numCells * xScale);\r\n let yIndMax = Math.floor((atoms[i].coord.y - this._vBoxMin.y + rad) * numCells * yScale);\r\n let zIndMax = Math.floor((atoms[i].coord.z - this._vBoxMin.z + rad) * numCells * zScale);\r\n\r\n xIndMin = (xIndMin >= 0) ? xIndMin : 0;\r\n yIndMin = (yIndMin >= 0) ? yIndMin : 0;\r\n zIndMin = (zIndMin >= 0) ? zIndMin : 0;\r\n\r\n xIndMax = (xIndMax < numCells) ? xIndMax : (numCells - 1);\r\n yIndMax = (yIndMax < numCells) ? yIndMax : (numCells - 1);\r\n zIndMax = (zIndMax < numCells) ? zIndMax : (numCells - 1);\r\n\r\n for (let z = zIndMin; z <= zIndMax; z++) {\r\n for (let y = yIndMin; y <= yIndMax; y++) {\r\n for (let x = xIndMin; x <= xIndMax; x++) {\r\n // add atom with index \"i\" to this voxel list\r\n const indVoxel = x + y * side + z * side2;\r\n // assert indVoxel >= 0\r\n // assert indVoxel < side3\r\n\r\n // add first\r\n if (this._voxelList[indVoxel] < 0) {\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = 0 - 1;\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n numAtomsRefs++;\r\n // assert numAtomsRefs < maxAtomsRefs - 1\r\n continue;\r\n }\r\n // insert into head of list\r\n const indexNext = this._voxelList[indVoxel];\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = indexNext;\r\n numAtomsRefs++;\r\n } // for (x)\r\n } // for (y)\r\n } // for (z)\r\n } // for (i)\r\n\r\n // convert Array to Int32Array\r\n this._atomsList = Int32Array.from(atomsList);\r\n\r\n return 0;\r\n }\r\n\r\n destroyVoxels() {\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n\r\n this._atoms = null;\r\n this._vertices = null;\r\n this._vBoxMin = null;\r\n this._vBoxMax = null;\r\n }\r\n\r\n /**\r\n * Enumerate all atoms affecting specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n * @param {func(atom)} process - function to call for each atom\r\n */\r\n forEachRelatedAtom(point, process) {\r\n // find corresponding voxel\r\n const xInd = Math.floor((point.x - this._vBoxMin.x) * this._numCells * this._xScale);\r\n const yInd = Math.floor((point.y - this._vBoxMin.y) * this._numCells * this._yScale);\r\n const zInd = Math.floor((point.z - this._vBoxMin.z) * this._numCells * this._zScale);\r\n const indVoxel = xInd + yInd * this._numCells + zInd * this._numCells * this._numCells;\r\n\r\n // run through atoms affecting this voxel\r\n const atoms = this._atoms;\r\n for (let ref = this._voxelList[indVoxel]; ref >= 0; ref = this._atomsList[ref * 2 + 1]) {\r\n const indexAtom = this._atomsList[ref * 2];\r\n process(atoms[indexAtom]);\r\n }\r\n }\r\n\r\n /**\r\n * Get atom closest to specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n *\r\n * @returns {IsoSurfaceAtomColored} atom, or null if not found\r\n */\r\n getClosestAtom(point) {\r\n let closest = null;\r\n let minDist2 = Number.MAX_VALUE;\r\n\r\n this.forEachRelatedAtom(point, (atom) => {\r\n const dist2 = point.distanceToSquared(atom.coord);\r\n if (dist2 < minDist2) {\r\n minDist2 = dist2;\r\n closest = atom;\r\n }\r\n });\r\n\r\n return closest;\r\n }\r\n\r\n /**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} normals - Normals for output\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildNormals(numVertices, vertices, normals) {\r\n const self = this;\r\n let numCloseAtoms = 0;\r\n let vx = 0;\r\n let vy = 0;\r\n let vz = 0;\r\n let dist2;\r\n let vNormalX = 0;\r\n let vNormalY = 0;\r\n let vNormalZ = 0;\r\n let koef = 0;\r\n let w = 0;\r\n const r25 = 2.5;\r\n const r01 = 0.1;\r\n\r\n const maxRadAffect = this._aveRad * r25;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n const expScale = -this._aveRad * r01;\r\n\r\n // some stats\r\n // numSlowAtoms = 0;\r\n\r\n const gatherNormals = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = Math.exp(expScale * koef);\r\n\r\n vNormalX += dx * w;\r\n vNormalY += dy * w;\r\n vNormalZ += dz * w;\r\n numCloseAtoms++;\r\n };\r\n\r\n let maxClosedAtoms = 0;\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n numCloseAtoms = 0;\r\n vNormalX = vNormalY = vNormalZ = 0.0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherNormals);\r\n\r\n maxClosedAtoms = (numCloseAtoms > maxClosedAtoms) ? numCloseAtoms : maxClosedAtoms;\r\n\r\n // normalize vNormal\r\n dist2 = vNormalX * vNormalX + vNormalY * vNormalY + vNormalZ * vNormalZ;\r\n if (numCloseAtoms > 0) {\r\n koef = 1.0 / Math.sqrt(dist2);\r\n vNormalX *= koef;\r\n vNormalY *= koef;\r\n vNormalZ *= koef;\r\n }\r\n normals[i].x = vNormalX;\r\n normals[i].y = vNormalY;\r\n normals[i].z = vNormalZ;\r\n } // for (i) all vertices\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Build vertex colors for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} colors - Colors for output\r\n * @param {number} radiusColorSmoothness - Radius of smoothness sphere\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildColors(numVertices, vertices, colors, radiusColorSmoothness) {\r\n const self = this;\r\n let vx = 0.0;\r\n let vy = 0.0;\r\n let vz = 0.0;\r\n let koef = 0.0;\r\n let w = 0.0;\r\n const KOEF_ADD = 0.8;\r\n\r\n const maxRadAffect = radiusColorSmoothness;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n\r\n let colorsClose = [];\r\n let weights = [];\r\n let weightsSum = 0;\r\n\r\n const gatherColors = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = 1.0 / (KOEF_ADD + koef);\r\n\r\n colorsClose.push([atom.colorX, atom.colorY, atom.colorZ]);\r\n weights.push(w); // save weights for use\r\n weightsSum += w; // calc sum of weights fo further normalization\r\n };\r\n\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n colorsClose = [];\r\n weights = [];\r\n weightsSum = 0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherColors);\r\n\r\n // normalized weighted sum of colors\r\n for (let j = 0; j < colorsClose.length; ++j) {\r\n const weightNormalized = weights[j] / weightsSum;\r\n colors[i].x += colorsClose[j][0] * weightNormalized;\r\n colors[i].y += colorsClose[j][1] * weightNormalized;\r\n colors[i].z += colorsClose[j][2] * weightNormalized;\r\n }\r\n } // for (i) all vertices\r\n return 0;\r\n }\r\n}\r\nexport default IsosurfaceBuildNormals;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for geometry (triangle mesh) representation\r\n *\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices in mesh\r\n * @param {number} maxNumTriangles Maximum possible number of triangles in mesh\r\n * @param {boolean} needVertexColors Obvious\r\n */\r\nclass IsoSurfaceGeo {\r\n constructor(maxNumVertices, maxNumTriangles, needVertexColors) {\r\n this._maxNumVertices = maxNumVertices;\r\n this._maxNumTriangles = maxNumTriangles;\r\n this._vertices = new Array(maxNumVertices);\r\n this._normals = new Array(maxNumVertices);\r\n this._colors = null;\r\n if (needVertexColors) {\r\n this._colors = new Array(maxNumVertices);\r\n }\r\n this._indices = new Array(maxNumTriangles * (1 + 2));\r\n this._numVertices = 0;\r\n this._numTriangles = 0;\r\n\r\n let i;\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._vertices[i] = new THREE.Vector3();\r\n this._normals[i] = new THREE.Vector3();\r\n }\r\n for (i = 0; i < maxNumTriangles * (1 + 2); i++) {\r\n this._indices[i] = -1;\r\n }\r\n if (needVertexColors) {\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._colors[i] = new THREE.Vector3();\r\n }\r\n }\r\n }\r\n\r\n destroy() {\r\n this._vertices = null;\r\n this._normals = null;\r\n this._indices = null;\r\n }\r\n}\r\nexport default IsoSurfaceGeo;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurfaceAtomColored from './IsoSurfaceAtomColored';\r\nimport IsosurfaceBuildNormals from './IsosurfaceBuildNormals';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport IsoSurfaceGeo from './IsoSurfaceGeo';\r\nimport chem from '../../chem';\r\nimport utils from '../../utils';\r\n\r\nconst COLOR_SIZE = 3;\r\nconst HASH_SIZE = 32768;\r\nconst { Element } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass SSIsosurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n // convert geoOut into arrays of positions, indices, normals\r\n this._innerBuild();\r\n const geoOut = this.getGeo();\r\n this.destroy();\r\n this._fromGeo(geoOut);\r\n }\r\n\r\n _fromGeo(geoOut) {\r\n let colors = null;\r\n const positions = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n const normals = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n if (geoOut._colors !== null) {\r\n colors = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n }\r\n const indices = utils.allocateTyped(Uint32Array, (1 + 2) * geoOut._numTriangles);\r\n\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++) {\r\n positions[j + 0] = (geoOut._vertices[i].x);\r\n positions[j + 1] = (geoOut._vertices[i].y);\r\n positions[j + 2] = (geoOut._vertices[i].z);\r\n normals[j + 0] = geoOut._normals[i].x;\r\n normals[j + 1] = geoOut._normals[i].y;\r\n normals[j + 2] = geoOut._normals[i].z;\r\n j += 3;\r\n }\r\n if (colors !== null) {\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++, j += 3) {\r\n colors[j + 0] = geoOut._colors[i].x;\r\n colors[j + 1] = geoOut._colors[i].y;\r\n colors[j + 2] = geoOut._colors[i].z;\r\n }\r\n }\r\n\r\n const numTri3 = geoOut._numTriangles * (1 + 2);\r\n for (let i = 0; i < numTri3; i++) {\r\n indices[i] = geoOut._indices[i];\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(positions, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(colors, 3));\r\n this.computeBoundingBox();\r\n this.computeBoundingSphere();\r\n\r\n geoOut.destroy();\r\n }\r\n\r\n convertToAtomsColored(packedArrays, atomsColored) {\r\n const { atoms, colors } = packedArrays;\r\n for (let i = 0, numAtoms = atoms.length; i < numAtoms; i++) {\r\n const vCenter = atoms[i].position;\r\n const { radius } = atoms[i].element;\r\n atomsColored[i] = new IsoSurfaceAtomColored(vCenter, radius);\r\n const nm = atoms[i].element.number;\r\n atomsColored[i].atomType = this.getType(nm);\r\n let cIdx = COLOR_SIZE * i;\r\n atomsColored[i].colorX = colors[cIdx++];\r\n atomsColored[i].colorY = colors[cIdx++];\r\n atomsColored[i].colorZ = colors[cIdx];\r\n atomsColored[i].srcAtom = atoms[i];\r\n }\r\n }\r\n\r\n getGeo() {\r\n return this.geoOut;\r\n }\r\n\r\n destroy() {\r\n this.atoms = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n }\r\n\r\n /**\r\n * Calculates bounding box for array with spheres (atoms)\r\n *\r\n * @param {Object} atoms Atoms array\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n */\r\n getBoundingBox(atoms, vBoxMin, vBoxMax) {\r\n const bigNum = 10000000.0;\r\n\r\n vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum;\r\n vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum;\r\n\r\n const probeRadius2 = this.probeRadius * this.atomRadiusScale;\r\n let radMax = 0.0;\r\n for (let i = 0, num = atoms.length; i < num; i++) {\r\n const vCenter = atoms[i].coord;\r\n const rad = atoms[i].radius + probeRadius2;\r\n radMax = (rad > radMax) ? rad : radMax;\r\n if (vCenter.x - rad < vBoxMin.x) {\r\n vBoxMin.x = vCenter.x - rad;\r\n }\r\n if (vCenter.y - rad < vBoxMin.y) {\r\n vBoxMin.y = vCenter.y - rad;\r\n }\r\n if (vCenter.z - rad < vBoxMin.z) {\r\n vBoxMin.z = vCenter.z - rad;\r\n }\r\n if (vCenter.x + rad > vBoxMax.x) {\r\n vBoxMax.x = vCenter.x + rad;\r\n }\r\n if (vCenter.y + rad > vBoxMax.y) {\r\n vBoxMax.y = vCenter.y + rad;\r\n }\r\n if (vCenter.z + rad > vBoxMax.z) {\r\n vBoxMax.z = vCenter.z + rad;\r\n }\r\n }\r\n vBoxMin.x -= radMax;\r\n vBoxMin.y -= radMax;\r\n vBoxMin.z -= radMax;\r\n vBoxMax.x += radMax;\r\n vBoxMax.y += radMax;\r\n vBoxMax.z += radMax;\r\n }\r\n\r\n /**\r\n * Calculate (x,y,z) cordinate of the cell corner point\r\n *\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {number} x Cell integer x coordinate\r\n * @param {number} y Cell integer y coordinate\r\n * @param {number} z Cell integer z coordinate\r\n * @param {number} numPoints NUm points in cell on side\r\n * @param {Vector3} vOut Output vector\r\n */\r\n getCornerCoord(vBoxMin, vBoxMax, x, y, z, numPoints, vOut) {\r\n const invNP = 1.0 / (numPoints - 1.0);\r\n const tx = x * invNP;\r\n const ty = y * invNP;\r\n const tz = z * invNP;\r\n\r\n vOut.x = vBoxMin.x * (1.0 - tx) + vBoxMax.x * tx;\r\n vOut.y = vBoxMin.y * (1.0 - ty) + vBoxMax.y * ty;\r\n vOut.z = vBoxMin.z * (1.0 - tz) + vBoxMax.z * tz;\r\n }\r\n\r\n /**\r\n * Calculate point of intersection of sphere surface\r\n * and cell edge, given by [indexA, indexB] line\r\n *\r\n * @param {number} indexA Cell vertex index in [0..11]\r\n * @param {number} indexB Cell vertex index in [0..11]\r\n * @param {array} sign Sign array for all 8 vertices\r\n * @param {object} cube Cube\r\n * @param {number} indexPointValue for value placement\r\n * @param {Vector3} vOut Point of intersection\r\n */\r\n buildEdgePoint(indexA, indexB, sign, cube, indexPointValue, vOut) {\r\n if (sign[indexA] ^ sign[indexB]) {\r\n const cTwentyFour = 24;\r\n const t = (0 - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA])\r\n / (cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexB]\r\n - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]);\r\n const xa = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 0];\r\n const ya = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 1];\r\n const za = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 2];\r\n const xb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 0];\r\n const yb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 1];\r\n const zb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 2];\r\n\r\n vOut.x = xa * (1.0 - t) + xb * t;\r\n vOut.y = ya * (1.0 - t) + yb * t;\r\n vOut.z = za * (1.0 - t) + zb * t;\r\n }\r\n }\r\n\r\n /**\r\n * Check if triangle is visible (vertices are close to atoms included in visibility set)\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} true if triangle is visible\r\n */\r\n isTriangleVisible(v0, v1, v2) {\r\n const a0 = this.voxelWorld.getClosestAtom(v0);\r\n const a1 = this.voxelWorld.getClosestAtom(v1);\r\n const a2 = this.voxelWorld.getClosestAtom(v2);\r\n if (a0 === null || a1 === null || a2 === null\r\n || a0.srcAtom === null || a1.srcAtom === null || a2.srcAtom === null) {\r\n return false;\r\n }\r\n\r\n return this.visibilitySelector.includesAtom(a0.srcAtom)\r\n && this.visibilitySelector.includesAtom(a1.srcAtom)\r\n && this.visibilitySelector.includesAtom(a2.srcAtom);\r\n }\r\n\r\n /**\r\n * Add triangle to result geometry\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} false if no more triangles can be added\r\n */\r\n addTriangle(v0, v1, v2) {\r\n if (this.visibilitySelector && !this.isTriangleVisible(v0, v1, v2)) {\r\n return true;\r\n }\r\n\r\n const geo = this.geoOut;\r\n\r\n if (geo._numTriangles >= this.maxNumTriangles) {\r\n return false;\r\n }\r\n\r\n // Add vertex with optimize\r\n const indInGeo0 = this.addVertexToGeo(geo, v0);\r\n const indInGeo1 = this.addVertexToGeo(geo, v1);\r\n const indInGeo2 = this.addVertexToGeo(geo, v2);\r\n if ((indInGeo0 | indInGeo1 | indInGeo2) < 0) {\r\n return false;\r\n }\r\n\r\n const itr = 3 * geo._numTriangles;\r\n geo._indices[itr + 0] = indInGeo0;\r\n geo._indices[itr + 1] = indInGeo1;\r\n geo._indices[itr + 2] = indInGeo2;\r\n geo._numTriangles++;\r\n return true;\r\n }\r\n\r\n /**\r\n * Build result geometry (triangle mesh) from marching cube cells\r\n *\r\n * @param {number} meshRes Marchnig cube vertex count on each side\r\n * @param {Vector3} vBoxMin Bounding box point min\r\n * @param {Vector3} vBoxMax Bounding box point max\r\n * @param {number} corners float values array for each cube point\r\n * @param {Vector3} vCellStep vector to next cube cell diagonal point\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} 0, if success (<0) is error\r\n */\r\n buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) {\r\n const arrSize = 12;\r\n const cNumVerts = 8;\r\n const numCells = meshRes - 1;\r\n const side = meshRes;\r\n const side2 = meshRes * meshRes;\r\n\r\n const vaEdges = new Array(arrSize);\r\n for (let i = 0; i < arrSize; i++) {\r\n vaEdges[i] = new THREE.Vector3();\r\n }\r\n const sign = [];\r\n for (let i = 0; i < cNumVerts; i++) {\r\n sign[i] = 1.0;\r\n }\r\n const vCorner = new THREE.Vector3();\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n if (!cube.hasIntersection[indCell]) {\r\n // next cell\r\n indCell++;\r\n continue;\r\n }\r\n const bitsInside = cube.bitsInside[indCell];\r\n\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, meshRes, vCorner);\r\n\r\n const indPointValues = indCell * (2 << (2 + 2));\r\n for (let i = 0, j = 0; i < cNumVerts; i++) {\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.x;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.y;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.z;\r\n }\r\n\r\n cube.pointsValuesLinear[indPointValues + 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 2 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3] += vCellStep.x;\r\n\r\n cube.pointsValuesLinear[indPointValues + 2 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 3 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 2] += vCellStep.z;\r\n\r\n cube.pointsValuesLinear[indPointValues + 4 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 1] += vCellStep.y;\r\n\r\n // now current cell has intersections (from -x to +x) on some cube edges\r\n const indValues = indPointValues + 24;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n sign[i] = (cube.pointsValuesLinear[indValues + i] < 0.0) ? 1 : 0;\r\n }\r\n\r\n this.buildEdgePoint(0, 1, sign, cube, indPointValues, vaEdges[0]);\r\n this.buildEdgePoint(1, 2, sign, cube, indPointValues, vaEdges[1]);\r\n this.buildEdgePoint(2, 3, sign, cube, indPointValues, vaEdges[2]);\r\n this.buildEdgePoint(3, 0, sign, cube, indPointValues, vaEdges[3]);\r\n\r\n this.buildEdgePoint(4, 5, sign, cube, indPointValues, vaEdges[4]);\r\n this.buildEdgePoint(5, 6, sign, cube, indPointValues, vaEdges[5]);\r\n this.buildEdgePoint(6, 7, sign, cube, indPointValues, vaEdges[6]);\r\n this.buildEdgePoint(7, 4, sign, cube, indPointValues, vaEdges[7]);\r\n\r\n this.buildEdgePoint(0, 4, sign, cube, indPointValues, vaEdges[8]);\r\n this.buildEdgePoint(1, 5, sign, cube, indPointValues, vaEdges[9]);\r\n this.buildEdgePoint(2, 6, sign, cube, indPointValues, vaEdges[10]);\r\n this.buildEdgePoint(3, 7, sign, cube, indPointValues, vaEdges[11]);\r\n\r\n const offs = bitsInside * (2 << (1 + 2));\r\n for (let numTri = 0, indTri = 0; numTri < (2 + 2 + 2); numTri++, indTri += 3) {\r\n // s_triIndicesMarchCube is external array, defined in mold_ind.js\r\n const i0 = cube.striIndicesMarchCube[offs + indTri];\r\n if (i0 < 0) {\r\n break;\r\n }\r\n const i1 = cube.striIndicesMarchCube[offs + indTri + 1];\r\n const i2 = cube.striIndicesMarchCube[offs + indTri + 2];\r\n\r\n if (!this.addTriangle(vaEdges[i0], vaEdges[i1], vaEdges[i2])) {\r\n return 0 - 2;\r\n }\r\n } // for numTri\r\n\r\n // next cell (cube)\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return 0;\r\n }\r\n\r\n /**\r\n * Returns number of cell with intersection with at least one sphere.\r\n * Using this number, we can estimate required number of vertices\r\n * and triangles to build result mesh.\r\n *\r\n * @param {number} side Number of points in cube voxels\r\n * @param {number} numCells Number of cells in cube voxels (per direction)\r\n * @param {array} corners Array of float values for cube corner points\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} numIntersectedCells\r\n */\r\n getNumIntersectedCells(side, numCells, corners, cube) {\r\n const side2 = side * side;\r\n const cNumVerts = 8;\r\n let numIntersectedCells = 0;\r\n\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n const cubeValuesIndex = indCell * (2 << (2 + 2)) + 24;\r\n const indCorner = x + indZ + indY;\r\n\r\n cube.pointsValuesLinear[cubeValuesIndex] = corners[indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 1] = corners[indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 2] = corners[indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 3] = corners[indCorner + side];\r\n cube.pointsValuesLinear[cubeValuesIndex + 4] = corners[side2 + indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 5] = corners[side2 + indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 6] = corners[side2 + indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 7] = corners[side2 + indCorner + side];\r\n\r\n // check read exception\r\n // assert(side2 + indCorner + side + 1 < side3);\r\n\r\n // get bit flags inside\r\n let bitsInside = 0;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n if (cube.pointsValuesLinear[cubeValuesIndex + i] < 0.0) {\r\n bitsInside |= (1 << i);\r\n }\r\n }\r\n\r\n if ((bitsInside === 0) || (bitsInside === ((1 << cNumVerts) - 1))) {\r\n cube.hasIntersection[indCell] = false;\r\n } else {\r\n cube.hasIntersection[indCell] = true;\r\n numIntersectedCells++;\r\n }\r\n cube.bitsInside[indCell] = bitsInside;\r\n // next cell\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return numIntersectedCells;\r\n }\r\n\r\n getType(letter) {\r\n /* eslint-disable no-magic-numbers */\r\n const atomT = [0, 0, 1, 1, 2, 6, 3, 6, 4, 6, 5, 6, 6, 0, 7, 3, 8, 2, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 4,\r\n 16, 5, 17, 6, 18, 6, 19, 6, 20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6,\r\n 32, 6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, 45, 6, 46, 6, 47, 6,\r\n 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, 6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6,\r\n 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6,\r\n 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, 95, 6,\r\n 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, 6, 108, 6, 109, 6];\r\n /* eslint-enable no-magic-numbers */\r\n\r\n if (letter < 1 || letter > atomT.length / 2\r\n || (Object.keys(Element.ByAtomicNumber).length * 2) !== atomT.length) {\r\n throw new Error('atomT.length should be equal Element.ByAtomicNumber.length * 2');\r\n }\r\n return atomT[letter * 2];\r\n }\r\n\r\n /**\r\n * Calculate values for marching cube grid points\r\n * positive values are outside sphere, negative - is inside\r\n *\r\n * @param {array} corners array of float values\r\n * @param {number} side Number of point in cube in 1 dimennsion\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {array} atoms Array of input atoms\r\n * @param {number} probeRad radius for atom probing\r\n */\r\n calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) {\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const vCorner = new THREE.Vector3();\r\n const vDif = new THREE.Vector3();\r\n /* eslint-disable no-magic-numbers */\r\n const aLot = +1.0e12;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n for (let i = 0; i < side3; i++) {\r\n corners[i] = aLot; // to large value\r\n }\r\n\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n for (let s = 0, numAtoms = atoms.length; s < numAtoms; s++) {\r\n const atom = atoms[s];\r\n const radius = atom.radius + probeRad;\r\n\r\n const fx = ((atom.coord.x - radius) - vBoxMin.x) * xScale;\r\n const fy = ((atom.coord.y - radius) - vBoxMin.y) * yScale;\r\n const fz = ((atom.coord.z - radius) - vBoxMin.z) * zScale;\r\n\r\n const indXMin = Math.floor(fx);\r\n const indYMin = Math.floor(fy);\r\n const indZMin = Math.floor(fz);\r\n\r\n let indXMax = Math.floor(((atom.coord.x + radius) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((atom.coord.y + radius) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((atom.coord.z + radius) - vBoxMin.z) * zScale);\r\n\r\n indXMax++;\r\n indYMax++;\r\n indZMax++;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let y = indYMin; y <= indYMax; y++) {\r\n const indY = y * side2;\r\n for (let z = indZMin; z <= indZMax; z++) {\r\n const indZ = z * side;\r\n for (let x = indXMin; x <= indXMax; x++) {\r\n const ind = indY + indZ + x;\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, side, vCorner);\r\n vDif.x = vCorner.x - atom.coord.x;\r\n vDif.y = vCorner.y - atom.coord.y;\r\n vDif.z = vCorner.z - atom.coord.z;\r\n const distToSphere = Math.sqrt(vDif.x * vDif.x + vDif.y * vDif.y + vDif.z * vDif.z);\r\n // val: < 0, if inside sphere\r\n // val: > 0, if outside sphere\r\n const val = distToSphere - radius;\r\n if (val < corners[ind]) {\r\n corners[ind] = val;\r\n }\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n } // for (s)\r\n }\r\n\r\n /**\r\n * Create memory pool for vertex hash management\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices (that will be build)\r\n * @param {number} maxNumTriangles Maximum possible number of triangles (that will be build)\r\n * @returns {number} 0, if success. (<0) is non memory\r\n */\r\n createVertexHash(maxNumVertices, maxNumTriangles) {\r\n this.hashLines = utils.allocateTyped(Int32Array, HASH_SIZE * 2);\r\n if (this.hashLines === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < HASH_SIZE; i++) {\r\n this.hashLines[j++] = 0; // num vertices in this hash line\r\n this.hashLines[j++] = 0 - 1; // index of the first entry\r\n }\r\n\r\n this.maxNumVertices = maxNumVertices;\r\n this.maxNumTriangles = maxNumTriangles;\r\n\r\n this.numHashEtriesAllocated = maxNumVertices;\r\n this.hashEntries = utils.allocateTyped(Int32Array, 2 * this.numHashEtriesAllocated);\r\n if (this.hashEntries === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < this.numHashEtriesAllocated; i++) {\r\n this.hashEntries[j++] = 0 - 1; // index of vertex\r\n this.hashEntries[j++] = 0 - 1; // next hash entry index\r\n }\r\n this.numHashEntryIndex = 0;\r\n return 0;\r\n }\r\n\r\n /**\r\n * Allocate and return new hash entry. Just check possible amount.\r\n *\r\n * @returns {number} index of hash entry, that can be used for geometry add vertex functionality\r\n */\r\n getNewHashEntry() {\r\n if (this.numHashEntryIndex < this.numHashEtriesAllocated) {\r\n const i = this.numHashEntryIndex;\r\n this.numHashEntryIndex++;\r\n return i;\r\n }\r\n return 0 - 1;\r\n }\r\n\r\n /**\r\n * Add vertex to geometry structure\r\n * using vertex hash table to quickly check, is this vertex already exist in geometry\r\n *\r\n * @param {object} geoOut Geometry to build\r\n * @param {Vector3} vAdd Vertex to add\r\n * @returns {number} index of added (or existing) vertex in geometry.\r\n */\r\n addVertexToGeo(geoOut, vAdd) {\r\n let entry;\r\n const oneHynberes = 0.01;\r\n const n815851 = 815851;\r\n const n37633 = 37633;\r\n const n2453543 = 2453543;\r\n const r106 = 1.0e-6;\r\n\r\n const hashResolution = this.marCubeResoultion << 2;\r\n const v = new THREE.Vector3();\r\n const ix = Math.floor(hashResolution * (vAdd.x - this.vBoxMin.x) / (this.vBoxMax.x + oneHynberes - this.vBoxMin.x));\r\n const iy = Math.floor(hashResolution * (vAdd.y - this.vBoxMin.y) / (this.vBoxMax.y + oneHynberes - this.vBoxMin.y));\r\n const iz = Math.floor(hashResolution * (vAdd.z - this.vBoxMin.z) / (this.vBoxMax.z + oneHynberes - this.vBoxMin.z));\r\n let iHash = ix * n815851 + iz * n37633 + iy * n2453543;\r\n iHash &= (HASH_SIZE - 1);\r\n const hLineIndex = iHash + iHash;\r\n\r\n // search vertex via hash\r\n // search in hash list\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n for (entry = this.hashLines[hLineIndex + 1]; entry >= 0; entry = this.hashEntries[entry * 2 + 1]) {\r\n const ind = this.hashEntries[entry * 2 + 0]; // vertex index\r\n v.copy(geoOut._vertices[ind]);\r\n v.x -= vAdd.x;\r\n v.y -= vAdd.y;\r\n v.z -= vAdd.z;\r\n const dot2 = v.x * v.x + v.y * v.y + v.z * v.z;\r\n if (dot2 < r106) {\r\n return ind;\r\n } // if (found)\r\n } // for (entry)\r\n } // search\r\n\r\n // add new vertex to geometry\r\n if (geoOut._numVertices >= this.maxNumVertices) {\r\n return 0 - 1;\r\n }\r\n\r\n const iVertAdd = geoOut._numVertices;\r\n geoOut._vertices[iVertAdd].copy(vAdd);\r\n\r\n // add to hash\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n entry = this.getNewHashEntry();\r\n if (entry < 0) {\r\n return 0 - 1;\r\n }\r\n const entryFirst = this.hashLines[hLineIndex + 1];\r\n this.hashLines[hLineIndex + 1] = entry;\r\n this.hashEntries[entry * 2 + 0] = iVertAdd;\r\n this.hashEntries[entry * 2 + 1] = entryFirst;\r\n\r\n this.hashLines[hLineIndex + 0]++; // num vertices in line ++\r\n }\r\n geoOut._numVertices++;\r\n return iVertAdd;\r\n }\r\n\r\n /**\r\n *\r\n * @param {number} side some placeholder description\r\n * @param {number} probeSphereRadius some placeholder description\r\n * @param {object} vBoxMin some placeholder description\r\n * @param {object} vBoxMax some placeholder description\r\n * @param {object} geoOut some placeholder description\r\n * @param {object} corners some placeholder description\r\n * @returns {number} always 0\r\n */\r\n modifyExcludedFromGeo(\r\n side,\r\n probeSphereRadius,\r\n vBoxMin,\r\n vBoxMax,\r\n geoOut,\r\n corners,\r\n ) {\r\n let ind;\r\n let distToSphere;\r\n let distToBorder;\r\n const r11 = 1.1;\r\n\r\n function innerBlockWorkAround() {\r\n if (distToBorder > 0.0) {\r\n // point is inside probe sphere\r\n if (corners[ind] < 0.0) {\r\n corners[ind] = distToBorder; // was inside surface, now is oustide ( > 0)\r\n }\r\n if (distToBorder > corners[ind]) {\r\n corners[ind] = distToBorder; // find positive maximum\r\n }\r\n } else if (distToBorder > corners[ind]) { // point is outside sphere\r\n corners[ind] = distToBorder; // find negative maximum\r\n }\r\n }\r\n\r\n const side2 = side * side;\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n const probeSpRad2 = (probeSphereRadius * 2) * (probeSphereRadius * 2);\r\n const sideInv = 1.0 / (side - 1);\r\n\r\n for (let i = 0; i < geoOut._numVertices; i++) {\r\n const vCenter = geoOut._vertices[i];\r\n\r\n const radEst = probeSphereRadius * r11;\r\n\r\n let indXMin = Math.floor(((vCenter.x - radEst) - vBoxMin.x) * xScale);\r\n let indYMin = Math.floor(((vCenter.y - radEst) - vBoxMin.y) * yScale);\r\n let indZMin = Math.floor(((vCenter.z - radEst) - vBoxMin.z) * zScale);\r\n\r\n let indXMax = Math.floor(((vCenter.x + radEst) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((vCenter.y + radEst) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((vCenter.z + radEst) - vBoxMin.z) * zScale);\r\n\r\n indXMin = (indXMin >= 0) ? indXMin : 0;\r\n indYMin = (indYMin >= 0) ? indYMin : 0;\r\n indZMin = (indZMin >= 0) ? indZMin : 0;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let iy = indYMin; iy <= indYMax; iy++) {\r\n const indY = iy * side2;\r\n for (let iz = indZMin; iz <= indZMax; iz++) {\r\n const indZ = iz * side;\r\n for (let ix = indXMin; ix <= indXMax; ix++) {\r\n ind = indY + indZ + ix;\r\n // getCornerCoord(vBoxMin, vBoxMax, ix, iy, iz, side, &vCorner);\r\n let t = ix * sideInv;\r\n const xCorner = vBoxMin.x * (1.0 - t) + vBoxMax.x * t;\r\n t = iy * sideInv;\r\n const yCorner = vBoxMin.y * (1.0 - t) + vBoxMax.y * t;\r\n t = iz * sideInv;\r\n const zCorner = vBoxMin.z * (1.0 - t) + vBoxMax.z * t;\r\n\r\n const dx = xCorner - vCenter.x;\r\n const dy = yCorner - vCenter.y;\r\n const dz = zCorner - vCenter.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 < probeSpRad2) {\r\n distToSphere = Math.sqrt(dist2);\r\n distToBorder = -(distToSphere - probeSphereRadius);\r\n innerBlockWorkAround();\r\n } // if (dist from corner point to sphere center more 2 radiuses)\r\n } // for (ix)\r\n } // for (iz)\r\n } // for (iy)\r\n } // for (i) all geo vertices\r\n return 0;\r\n }\r\n\r\n _innerBuild() {\r\n let ok;\r\n const expandFactor = 1.2;\r\n\r\n // performance test\r\n // this.performanceTest();\r\n\r\n // Create temporary atoms (but colored)\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n this.complex = this._opts.parent;\r\n this.atoms = packedArrays.atoms;\r\n this.meshResolution = this._opts.gridSpacing;\r\n this.atomRadiusScale = this._opts.radScale;\r\n this.colorMode = this._opts.colorMode;\r\n this.probeRadius = this._opts.probeRadius;\r\n this.useVertexColors = true;\r\n this.excludeProbe = this._opts.excludeProbe;\r\n this.visibilitySelector = this._opts.visibilitySelector;\r\n\r\n this.geoOut = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n this.numHashEtriesAllocated = 0;\r\n this.numHashEntryIndex = 0;\r\n this.maxNumVertices = 0;\r\n this.maxNumTriangles = 0;\r\n\r\n const atomsColored = new Array(this.atoms.length);\r\n this.convertToAtomsColored(packedArrays, atomsColored);\r\n\r\n // find bbox for spheres scene\r\n const vBoxMin = this.vBoxMin = new THREE.Vector3();\r\n const vBoxMax = this.vBoxMax = new THREE.Vector3();\r\n this.getBoundingBox(atomsColored, vBoxMin, vBoxMax);\r\n\r\n const marCubeResoultion = this.marCubeResoultion = this.meshResolution * (2 + 2);\r\n\r\n // build grid corners for Marching cube algorithm\r\n const side = marCubeResoultion;\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const corners = utils.allocateTyped(Float32Array, side3);\r\n const rProbeRadius = this.probeRadius * this.atomRadiusScale;\r\n\r\n this.calculateGridCorners(corners, side, vBoxMin, vBoxMax, atomsColored, rProbeRadius);\r\n\r\n const numCells = marCubeResoultion - 1;\r\n const cube = new IsoSurfaceMarchCube();\r\n ok = cube.create(numCells);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // copy corners to cells\r\n const vCellStep = new THREE.Vector3();\r\n vCellStep.x = (vBoxMax.x - vBoxMin.x) / numCells;\r\n vCellStep.y = (vBoxMax.y - vBoxMin.y) / numCells;\r\n vCellStep.z = (vBoxMax.z - vBoxMin.z) / numCells;\r\n\r\n let numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n let maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n let maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n\r\n // build voxel world (used to check triangle-to-atom tie and to calculate normals and colors)\r\n let probeRadForNormalsColors = rProbeRadius;\r\n if (this.excludeProbe) {\r\n probeRadForNormalsColors = 0.01;\r\n }\r\n this.voxelWorld = new IsosurfaceBuildNormals(\r\n atomsColored.length,\r\n atomsColored,\r\n vBoxMin,\r\n vBoxMax,\r\n probeRadForNormalsColors,\r\n );\r\n this.voxelWorld.createVoxels();\r\n\r\n ok = this.buildGeoFromCorners(marCubeResoultion, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n if (this.excludeProbe) {\r\n // using 3d mesh (geoOut) as a surface points\r\n // move probe sphere and try to minimuze corners values\r\n this.modifyExcludedFromGeo(side, rProbeRadius, vBoxMin, vBoxMax, this.geoOut, corners);\r\n\r\n // delete old builded geo\r\n this.geoOut._vertices = null;\r\n this.geoOut._colors = null;\r\n this.geoOut._indices = null;\r\n this.geoOut._normals = null;\r\n this.geoOut._numVertices = 0;\r\n this.geoOut._numTriangles = 0;\r\n this.geoOut = null;\r\n\r\n // estimage geo vertices budget again\r\n numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n // creates empty new geometry\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // build vertices and triangles from corners values\r\n ok = this.buildGeoFromCorners(side, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n }\r\n\r\n // build vertex normals\r\n this.voxelWorld.buildNormals(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._normals);\r\n // More value : more smooth color mixing\r\n // value about 0.7: very rough colors borders\r\n let radiusColorSmoothness = 6.5;\r\n if (this.excludeProbe) {\r\n radiusColorSmoothness -= 1.5;\r\n }\r\n if (this.useVertexColors) {\r\n this.voxelWorld.buildColors(\r\n this.geoOut._vertices.length,\r\n this.geoOut._vertices,\r\n this.geoOut._colors,\r\n radiusColorSmoothness,\r\n );\r\n }\r\n this.voxelWorld.destroyVoxels();\r\n this.voxelWorld = null;\r\n\r\n // remove objects\r\n cube.destroy();\r\n\r\n return ok;\r\n }\r\n}\r\n\r\n// All code below must be erased from every device and each developer's memory\r\n\r\nexport default SSIsosurfaceGeometry;\r\n","import * as THREE from 'three';\r\nimport EventDispatcher from '../../utils/EventDispatcher';\r\n\r\nfunction createLabel(fieldTxt, className) {\r\n const text = document.createElement('div');\r\n text.className = className;\r\n\r\n if (typeof fieldTxt === 'string') {\r\n const spanText = document.createElement('span');\r\n spanText.style.fontSize = '150%';\r\n const strings = fieldTxt.split('\\n');\r\n\r\n for (let i = 0, n = strings.length; i < n; ++i) {\r\n const spanNodeP = document.createElement('span');\r\n const spanNodeText = document.createTextNode(strings[i]);\r\n spanNodeP.appendChild(spanNodeText);\r\n spanText.appendChild(spanNodeP);\r\n if (i < n - 1) {\r\n spanText.appendChild(document.createElement('br'));\r\n }\r\n }\r\n\r\n text.appendChild(spanText);\r\n } else {\r\n text.appendChild(fieldTxt);\r\n }\r\n text.worldPos = new THREE.Vector3();\r\n return text;\r\n}\r\nclass LabelsGeometry extends EventDispatcher {\r\n constructor(instanceCount, opts) {\r\n super();\r\n this._opts = opts;\r\n this.items = [];\r\n this.needsUpdate = false;\r\n\r\n let xTranslation = -50;\r\n let yTranslation = -50;\r\n switch (opts.horizontalAlign) {\r\n case 'left':\r\n xTranslation = 0;\r\n break;\r\n case 'right':\r\n xTranslation = -100;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n switch (opts.verticalAlign) {\r\n case 'top':\r\n yTranslation = -100;\r\n break;\r\n case 'bottom':\r\n yTranslation = 0;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n const deltaPos = new THREE.Vector3(opts.dx || 0, opts.dy || 0, opts.dz || 0);\r\n this.userData = {\r\n translation: `translate(${xTranslation}%, ${yTranslation}%)`,\r\n offset: deltaPos,\r\n };\r\n }\r\n\r\n setItem(itemIdx, itemPos, fieldTxt) {\r\n const opts = this._opts;\r\n const text = this.items[itemIdx] || createLabel(fieldTxt, 'label');\r\n\r\n text.worldPos.copy(itemPos);\r\n text.style.textAlign = opts.horizontalAlign;\r\n text.style.verticalAlign = opts.verticalAlign;\r\n this.items[itemIdx] = text;\r\n }\r\n\r\n setColor(itemIdx, fColor, bColor) {\r\n const text = this.items[itemIdx];\r\n text.opts = {\r\n color: fColor,\r\n background: bColor,\r\n };\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.needsUpdate = true;\r\n this.dispatchEvent({ type: 'update' });\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n }\r\n\r\n // unimplemented functions\r\n raycast() {\r\n }\r\n\r\n setOpacity() {\r\n\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\n\r\nexport default LabelsGeometry;\r\n","import InstancedSpheresGeometry from './InstancedSpheresGeometry';\r\nimport SimpleSpheresGeometry from './SimpleSpheresGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport Instanced2CCylindersGeometry from './Instanced2CCylindersGeometry';\r\nimport ExtrudedObjectsGeometry from './ExtrudedObjectsGeometry';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport TwoColorLinesGeometry from './TwoColorLinesGeometry';\r\nimport CrossGeometry from './CrossGeometry';\r\nimport QuickSurfGeometry from './QuickSurfGeometry';\r\nimport ContactSurfaceGeometry from './ContactSurfaceGeometry';\r\nimport SSIsosurfaceGeometry from './SSIsosurfaceGeometry';\r\nimport LabelsGeometry from './LabelsGeometry';\r\n\r\nexport default {\r\n InstancedSpheresGeometry,\r\n SimpleSpheresGeometry,\r\n Simple2CCylindersGeometry,\r\n Instanced2CCylindersGeometry,\r\n ExtrudedObjectsGeometry,\r\n ChunkedLinesGeometry,\r\n TwoColorLinesGeometry,\r\n CrossGeometry,\r\n QuickSurfGeometry,\r\n ContactSurfaceGeometry,\r\n SSIsosurfaceGeometry,\r\n LabelsGeometry,\r\n};\r\n","export default {\r\n\r\n precision: 'mediump',\r\n\r\n /**\r\n *\r\n * @param {THREE.WebGLRenderer} renderer\r\n */\r\n init(renderer) {\r\n this.precision = renderer.capabilities.getMaxPrecision('highp');\r\n },\r\n};\r\n","import * as THREE from 'three';\r\n\r\nconst noiseWidth = 4;\r\nconst noiseHeight = 4;\r\nconst _noiseData = new Uint8Array([\r\n 24, 52, 0, 255, 254, 145, 0, 255, 122, 0, 0, 255, 7, 170, 0, 255,\r\n 34, 214, 0, 255, 173, 8, 0, 255, 86, 249, 0, 255, 160, 4, 0, 255,\r\n 226, 46, 0, 255, 224, 211, 0, 255, 3, 157, 0, 255, 174, 247, 0, 255,\r\n 12, 182, 0, 255, 220, 216, 0, 255, 1, 109, 0, 255, 253, 154, 0, 255,\r\n]);\r\nconst _noiseWrapS = THREE.RepeatWrapping;\r\nconst _noiseWrapT = THREE.RepeatWrapping;\r\nconst _noiseMinFilter = THREE.NearestFilter;\r\nconst _noiseMagFilter = THREE.NearestFilter;\r\nconst _noiseMapping = THREE.UVMapping;\r\nconst noiseTexture = new THREE.DataTexture(\r\n _noiseData,\r\n noiseWidth,\r\n noiseHeight,\r\n THREE.RGBAFormat,\r\n THREE.UnsignedByteType,\r\n _noiseMapping,\r\n _noiseWrapS,\r\n _noiseWrapT,\r\n _noiseMagFilter,\r\n _noiseMinFilter,\r\n 1,\r\n);\r\nnoiseTexture.needsUpdate = true;\r\n\r\nexport default {\r\n noiseWidth,\r\n noiseHeight,\r\n noiseTexture,\r\n};\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './Uber.vert';\r\nimport fragmentShader from './Uber.frag';\r\nimport capabilities from '../capabilities';\r\nimport noise from '../noiseTexture';\r\n\r\n// Length of _samplesKernel is used in Uber.frag\r\n// If you want to change length of _samplesKernel, please, remember change it in Uber.frag too.\r\n// You can easy find places for replace using word:_samplesKernel\r\nconst _samplesKernel = [\r\n new THREE.Vector2(-0.541978, 0.840393),\r\n new THREE.Vector2(0.125533, -0.992089),\r\n new THREE.Vector2(0.374329, 0.927296),\r\n new THREE.Vector2(-0.105475, 0.994422),\r\n];\r\n\r\nconst defaultUniforms = THREE.UniformsUtils.merge([\r\n\r\n THREE.UniformsLib.fog,\r\n THREE.UniformsLib.lights,\r\n\r\n {\r\n // are updated automatically by three.js (see THREE.ShaderLib.common)\r\n diffuse: { value: new THREE.Color(0xeeeeee) },\r\n opacity: { value: 1.0 },\r\n\r\n specular: { type: 'c', value: new THREE.Color(0x111111) },\r\n shininess: { type: 'f', value: 30 },\r\n fixedColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n zOffset: { type: 'f', value: 0.0 },\r\n zClipValue: { type: 'f', value: 0.0 },\r\n clipPlaneValue: { type: 'f', value: 0.0 },\r\n nearPlaneValue: { type: 'f', value: -0.5 },\r\n invModelViewMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n world2colorMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n dashedLineSize: { type: 'f', value: 0.1 },\r\n dashedLinePeriod: { type: 'f', value: 0.2 },\r\n projMatrixInv: { type: '4fv', value: new THREE.Matrix4() },\r\n viewport: { type: 'v2', value: new THREE.Vector2() },\r\n lineWidth: { type: 'f', value: 2.0 },\r\n // default value must be the same as settings\r\n fogAlpha: { type: 'f', value: 1.0 },\r\n samplesKernel: { type: 'v2v', value: null },\r\n noiseTex: { type: 't', value: null },\r\n noiseTexelSize: { type: 'v2', value: null },\r\n srcTexelSize: { type: 'v2', value: null },\r\n },\r\n\r\n]);\r\n\r\nconst uberOptionNames = [\r\n 'shininess',\r\n 'opacity',\r\n 'zOffset',\r\n 'diffuse',\r\n 'specular',\r\n 'fixedColor',\r\n 'zClipCoef',\r\n 'zClipValue',\r\n 'clipPlaneValue',\r\n 'world2colorMatrix',\r\n 'dashedLineSize',\r\n 'dashedLinePeriod',\r\n 'projMatrixInv',\r\n 'viewport',\r\n 'lineWidth',\r\n 'fogAlpha',\r\n 'samplesKernel',\r\n 'noiseTex',\r\n 'noiseTexelSize',\r\n 'srcTexelSize',\r\n];\r\n\r\n// properties that convert to uniforms\r\nconst uberOptions = {\r\n diffuse: new THREE.Color(0xffffff), // used in phong lighting\r\n specular: new THREE.Color(0x111111), // used in phong lighting\r\n shininess: 30, // used in phong lighting\r\n opacity: 1, // set mesh opacity\r\n fixedColor: new THREE.Color(0xffffff), // color to override (see OVERRIDE_COLOR)\r\n zOffset: 0.0, // used fo zsprites (see SPHERE_SPRITE CYLINDER_SPRITE)\r\n zClipCoef: 2.0, // use for Surfs clipping (mesh param, isn't used in shader) FIXME move to representation param\r\n zClipValue: 0.0, // value to clip Surfs in shader (see ZCLIP)\r\n clipPlaneValue: 0.0, // value to clip scene globally (see CLIPPLANE)\r\n world2colorMatrix: new THREE.Matrix4(),\r\n dashedLineSize: 0.1,\r\n dashedLinePeriod: 0.3,\r\n projMatrixInv: new THREE.Matrix4(),\r\n viewport: new THREE.Vector2(800, 600),\r\n lineWidth: 2.0,\r\n fogAlpha: 1.0,\r\n samplesKernel: _samplesKernel,\r\n noiseTex: noise.noiseTexture,\r\n noiseTexelSize: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight),\r\n srcTexelSize: new THREE.Vector2(1.0 / 800.0, 1.0 / 600.0),\r\n copy(source) {\r\n this.diffuse.copy(source.diffuse);\r\n this.specular.copy(source.specular);\r\n this.shininess = source.shininess;\r\n this.opacity = source.opacity;\r\n this.fixedColor.copy(source.fixedColor);\r\n this.zOffset = source.zOffset;\r\n this.zClipCoef = source.zClipCoef;\r\n this.zClipValue = source.zClipValue;\r\n this.clipPlaneValue = source.clipPlaneValue;\r\n this.world2colorMatrix.copy(source.world2colorMatrix);\r\n this.dashedLineSize = source.dashedLineSize;\r\n this.dashedLinePeriod = source.dashedLinePeriod;\r\n this.projMatrixInv = source.projMatrixInv;\r\n this.viewport = source.viewport;\r\n this.lineWidth = source.lineWidth; // used for thick lines only\r\n this.toonShading = source.toonShading;\r\n this.fogAlpha = source.fogAlpha;\r\n this.samplesKernel = source.samplesKernel;\r\n this.noiseTex = source.noiseTex;\r\n this.noiseTexelSize = source.noiseTexelSize;\r\n this.srcTexelSize = source.srcTexelSize;\r\n },\r\n};\r\n\r\nclass UberMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // add fog\r\n this.fog = true;\r\n // used for instanced geometry\r\n this.instancedPos = false;\r\n this.instancedMatrix = false;\r\n // atoms and links color\r\n this.attrColor = false;\r\n // second link color for cylinders\r\n this.attrColor2 = false;\r\n //\r\n this.attrAlphaColor = false;\r\n // overrides color for all vertices (used in selection)\r\n this.overrideColor = false;\r\n // zsrpites\r\n this.sphereSprite = false;\r\n this.cylinderSprite = false;\r\n // clip Surfs individually\r\n this.zClip = false;\r\n // clip scene with global clip plane\r\n this.clipPlane = false;\r\n // enable fake (chess-like) opacity\r\n this.fakeOpacity = false;\r\n // render only depth, don't take care about the pixel color (used for transparency depth prepass)\r\n this.prepassTransparancy = false;\r\n // used to render pixel positions\r\n this.colorFromPos = false;\r\n // used to render shadowmap\r\n this.shadowmap = false;\r\n // used to describe shadowmap type\r\n this.shadowmapType = 'random';\r\n // used to render pixel view deph\r\n this.colorFromDepth = false;\r\n // mark that rendering is for orthographic camera\r\n this.orthoCam = false;\r\n // used to render dashed line\r\n this.dashedLine = false;\r\n // mark as transparent\r\n this.transparent = true;\r\n // mark as thick lines\r\n this.thickLine = false;\r\n // makes fog begin transparency (required for transparent background)\r\n this.fogTransparent = false;\r\n // used to render surface normals to G buffer for ssao effect\r\n this.normalsToGBuffer = false;\r\n // used for toon material\r\n this.toonShading = false;\r\n\r\n // uber options of \"root\" materials are inherited from single uber-options object that resides in prototype\r\n this.uberOptions = Object.create(UberMaterial.prototype.uberOptions);\r\n\r\n // set default values\r\n super.setValues({\r\n uniforms: THREE.UniformsUtils.clone(defaultUniforms),\r\n vertexShader: this.precisionString() + vertexShader,\r\n fragmentShader: this.precisionString() + fragmentShader,\r\n lights: true,\r\n fog: true,\r\n side: THREE.DoubleSide,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n precisionString() {\r\n const { precision } = capabilities;\r\n const str = `precision ${precision} float;\\n`\r\n + `precision ${precision} int;\\n\\n`;\r\n return str;\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n\r\n this.fragmentShader = source.fragmentShader;\r\n this.vertexShader = source.vertexShader;\r\n\r\n this.uniforms = THREE.UniformsUtils.clone(source.uniforms);\r\n this.defines = { ...source.defines };\r\n this.extensions = source.extensions;\r\n\r\n this.fog = source.fog;\r\n this.instancedPos = source.instancedPos;\r\n this.instancedMatrix = source.instancedMatrix;\r\n this.attrColor = source.attrColor;\r\n this.attrColor2 = source.attrColor2;\r\n this.attrAlphaColor = source.attrAlphaColor;\r\n this.overrideColor = source.overrideColor;\r\n this.sphereSprite = source.sphereSprite;\r\n this.cylinderSprite = source.cylinderSprite;\r\n this.zClip = source.zClip;\r\n this.clipPlane = source.clipPlane;\r\n this.fakeOpacity = source.fakeOpacity;\r\n this.colorFromPos = source.colorFromPos;\r\n this.shadowmap = source.shadowmap;\r\n this.shadowmapType = source.shadowmapType;\r\n this.colorFromDepth = source.colorFromDepth;\r\n this.orthoCam = source.orthoCam;\r\n this.prepassTransparancy = source.prepassTransparancy;\r\n this.dashedLine = source.dashedLine;\r\n this.thickLine = source.thickLine;\r\n this.fogTransparent = source.fogTransparent;\r\n this.normalsToGBuffer = source.normalsToGBuffer;\r\n this.toonShading = source.toonShading;\r\n\r\n this.uberOptions.copy(source.uberOptions);\r\n\r\n return this;\r\n }\r\n\r\n // create copy of this material\r\n // its options are prototyped after this material's options\r\n createInstance() {\r\n const inst = new UberMaterial();\r\n inst.copy(this);\r\n inst.uberOptions = Object.create(this.uberOptions);\r\n return inst;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n const extensions = {};\r\n\r\n if (this.fog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.instancedPos) {\r\n defines.INSTANCED_POS = 1;\r\n }\r\n if (this.instancedMatrix) {\r\n defines.INSTANCED_MATRIX = 1;\r\n }\r\n if (this.attrColor) {\r\n defines.ATTR_COLOR = 1;\r\n }\r\n if (this.attrColor2) {\r\n defines.ATTR_COLOR2 = 1;\r\n }\r\n if (this.attrAlphaColor) {\r\n defines.ATTR_ALPHA_COLOR = 1;\r\n }\r\n if (this.overrideColor) {\r\n defines.OVERRIDE_COLOR = 1;\r\n }\r\n if (this.sphereSprite) {\r\n defines.SPHERE_SPRITE = 1;\r\n extensions.fragDepth = true;\r\n }\r\n if (this.cylinderSprite) {\r\n defines.CYLINDER_SPRITE = 1;\r\n extensions.fragDepth = true;\r\n }\r\n if (this.zClip) {\r\n defines.ZCLIP = 1;\r\n }\r\n if (this.clipPlane) {\r\n defines.CLIP_PLANE = 1;\r\n }\r\n if (this.fakeOpacity) {\r\n defines.FAKE_OPACITY = 1;\r\n }\r\n if (this.lights) {\r\n defines.USE_LIGHTS = 1;\r\n }\r\n if (this.colorFromPos) {\r\n defines.COLOR_FROM_POS = 1;\r\n }\r\n if (this.shadowmap) {\r\n defines.SHADOWMAP = 1;\r\n if (this.shadowmapType === 'pcf') {\r\n defines.SHADOWMAP_PCF_SHARP = 1;\r\n } else if (this.shadowmapType === 'random') {\r\n defines.SHADOWMAP_PCF_RAND = 1;\r\n } else {\r\n defines.SHADOWMAP_BASIC = 1;\r\n }\r\n }\r\n if (this.colorFromDepth) {\r\n defines.COLOR_FROM_DEPTH = 1;\r\n }\r\n if (this.orthoCam) {\r\n defines.ORTHOGRAPHIC_CAMERA = 1;\r\n }\r\n if (this.prepassTransparancy) {\r\n defines.PREPASS_TRANSP = 1;\r\n }\r\n if (this.dashedLine) {\r\n defines.DASHED_LINE = 1;\r\n }\r\n if (this.thickLine) {\r\n defines.THICK_LINE = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n if (this.normalsToGBuffer) {\r\n extensions.drawBuffers = true;\r\n defines.NORMALS_TO_G_BUFFER = 1;\r\n }\r\n if (this.toonShading) {\r\n defines.TOON_SHADING = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n this.extensions = extensions;\r\n }\r\n\r\n setUberOptions(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n for (const key in values) {\r\n if (!values.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n\r\n if (this.uberOptions[key] instanceof THREE.Color) {\r\n this.uberOptions[key] = values[key].clone();\r\n } else {\r\n this.uberOptions[key] = values[key];\r\n }\r\n }\r\n }\r\n\r\n clone(shallow) {\r\n if (!shallow) {\r\n return super.clone();\r\n }\r\n return this.createInstance();\r\n }\r\n\r\n updateUniforms() {\r\n const self = this;\r\n\r\n uberOptionNames.forEach((p) => {\r\n if (self.uniforms.hasOwnProperty(p)) {\r\n if (self.uberOptions[p] instanceof THREE.Color\r\n || self.uberOptions[p] instanceof THREE.Matrix4) {\r\n self.uniforms[p].value = self.uberOptions[p].clone();\r\n } else {\r\n self.uniforms[p].value = self.uberOptions[p];\r\n }\r\n }\r\n });\r\n }\r\n}\r\n\r\nUberMaterial.prototype.uberOptions = uberOptions;\r\n\r\nexport default UberMaterial;\r\n","import UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default function (SuperClass) {\r\n class NewObjectType extends SuperClass {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.onBeforeRender = NewObjectType.prototype.onBeforeRender;\r\n }\r\n\r\n onBeforeRender(renderer, scene, camera, geometry, material, group) {\r\n this._onBeforeRender(renderer, scene, camera, geometry, material, group);\r\n this._update();\r\n }\r\n\r\n _onBeforeRender() {\r\n }\r\n\r\n _update() {\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material instanceof UberMaterial) {\r\n material.updateUniforms();\r\n }\r\n }\r\n }\r\n\r\n return NewObjectType;\r\n}\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZSpriteMesh extends Mesh {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material.uniforms.invModelViewMatrix) {\r\n // NOTE: update of modelViewMatrix inside threejs is done after onBeforeRender call,\r\n // so we have to do it manually in that place\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n // get inverse matrix\r\n material.uniforms.invModelViewMatrix.value.copy(this.modelViewMatrix).invert();\r\n material.uniforms.nearPlaneValue.value = camera.near;\r\n material.uniformsNeedUpdate = true;\r\n }\r\n }\r\n}\r\n\r\nexport default ZSpriteMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZClippedMesh extends Mesh {\r\n constructor(geometry, material) {\r\n super(geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n\r\n static _mvLength = new THREE.Vector3();\r\n\r\n static _center = new THREE.Vector3();\r\n\r\n static _modelView = new THREE.Matrix4();\r\n\r\n _onBeforeRender(renderer, scene, camera) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n\r\n const geo = this.geometry;\r\n const { material } = this;\r\n if (!geo.zClip || !material.uberOptions) {\r\n return;\r\n }\r\n\r\n const zClipCoef = 0.5;\r\n\r\n const modelView = ZClippedMesh._modelView;\r\n const mvLength = ZClippedMesh._mvLength;\r\n const center = ZClippedMesh._center;\r\n\r\n modelView.multiplyMatrices(this.matrixWorld, camera.matrixWorldInverse);\r\n const s = mvLength.setFromMatrixColumn(modelView, 0).length();\r\n center.copy(geo.boundingSphere.center);\r\n\r\n this.localToWorld(center);\r\n material.uberOptions.zClipValue = camera.position.z - center.z\r\n - s * (zClipCoef * geo.boundingSphere.radius);\r\n }\r\n}\r\n\r\nexport default ZClippedMesh;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from '../CSS2DObject';\r\nimport utils from '../../utils';\r\n\r\nclass TextMesh extends THREE.Group {\r\n constructor(geometry, _material) {\r\n super();\r\n this.geometry = geometry;\r\n\r\n const self = this;\r\n self.initialized = false;\r\n this.geometry.addEventListener('update', () => {\r\n self.update();\r\n });\r\n }\r\n\r\n init() {\r\n const { children } = this;\r\n for (let i = children.length - 1; i >= 0; --i) {\r\n this.remove(children[i]);\r\n }\r\n\r\n const { items, userData } = this.geometry;\r\n for (let i = 0, n = items.length; i < n; ++i) {\r\n const srcItem = items[i];\r\n if (!srcItem) {\r\n continue;\r\n }\r\n const item = utils.shallowCloneNode(srcItem);\r\n const label = new CSS2DObject(item);\r\n label.userData = _.clone(userData);\r\n const el = label.getElement();\r\n el.style.visibility = 'visible';\r\n label.source = srcItem;\r\n this.add(label);\r\n }\r\n this.initialized = true;\r\n }\r\n\r\n update() {\r\n const geo = this.geometry;\r\n if (!geo.needsUpdate) {\r\n return;\r\n }\r\n const { children } = this;\r\n if (!this.initialized) {\r\n this.init();\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n const item = child.source;\r\n child.position.copy(item.worldPos);\r\n child.userData.color = item.opts.color;\r\n child.userData.background = item.opts.background;\r\n }\r\n }\r\n}\r\n\r\nexport default TextMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass SimpleMesh extends Mesh {\r\n constructor(geometry, material) {\r\n super(geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n}\r\n\r\nexport default SimpleMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\nconst _viewport = new THREE.Vector2();\r\n\r\nclass ThickLineMesh extends Mesh {\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!material.uberOptions) {\r\n return;\r\n }\r\n\r\n material.uberOptions.projMatrixInv.copy(camera.projectionMatrix).invert();\r\n renderer.getSize(_viewport);\r\n material.uberOptions.viewport.set(_viewport.width, _viewport.height);\r\n }\r\n}\r\n\r\nexport default ThickLineMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass InstancedMesh extends Mesh {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n}\r\n\r\nexport default InstancedMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\nimport ZSpriteMesh from './ZSpriteMesh';\r\nimport ZClippedMesh from './ZClippedMesh';\r\nimport TextMesh from './TextMesh';\r\nimport SimpleMesh from './SimpleMesh';\r\nimport ThickLineMesh from './ThickLineMesh';\r\nimport InstancedMesh from './InstancedMesh';\r\n\r\nexport default {\r\n ZClipped: ZClippedMesh,\r\n ZSprite: ZSpriteMesh,\r\n Text: TextMesh,\r\n Line: UberObject(THREE.Line),\r\n LineSegments: UberObject(THREE.LineSegments),\r\n Mesh: SimpleMesh,\r\n ThickLineMesh,\r\n Instanced: InstancedMesh,\r\n};\r\n","import geometries from '../geometries/geometries';\r\nimport meshes from './meshes';\r\nimport ThickLinesGeometry from '../geometries/ThickLinesGeometry';\r\n\r\nfunction setMatParams(params, uniforms) {\r\n return function (material) {\r\n material.setValues(params);\r\n material.setUberOptions(uniforms);\r\n };\r\n}\r\n\r\nfunction _createInstancedCylinders(useZSprites, openEnded) {\r\n function Geometry(a, b) {\r\n return new geometries.Instanced2CCylindersGeometry(a, b, useZSprites, openEnded);\r\n }\r\n return {\r\n Geometry,\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedMatrix: true,\r\n attrColor: true,\r\n attrColor2: true,\r\n attrAlphaColor: true,\r\n cylinderSprite: useZSprites,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createLineSegmentsGeoTriplet(geo, renderParams) {\r\n const thickLines = geo.prototype instanceof ThickLinesGeometry;\r\n const lineWidth = renderParams.lineWidth || 0;\r\n return {\r\n Geometry: geo,\r\n Object: thickLines ? meshes.ThickLineMesh : meshes.LineSegments,\r\n initMaterial: setMatParams({\r\n lights: false,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n thickLine: thickLines,\r\n }, {\r\n lineWidth,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createSimpleGeoTriplet(geoClass) {\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.Mesh,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createIsoSurfaceGeoTriplet(geoClass, caps, settings, renderParams) {\r\n const surfaceOpts = {\r\n wireframe: !!renderParams.wireframe,\r\n fakeOpacity: settings.now.isoSurfaceFakeOpacity,\r\n zClip: renderParams.zClip,\r\n };\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.ZClipped,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: false,\r\n wireframe: surfaceOpts.wireframe,\r\n fakeOpacity: surfaceOpts.fakeOpacity,\r\n zClip: surfaceOpts.zClip,\r\n }),\r\n };\r\n}\r\n\r\nclass MeshCreator {\r\n static createSpheres(caps, settings) {\r\n const useZSprites = settings.now.zSprites;\r\n function Geometry(a, b) {\r\n return new geometries.InstancedSpheresGeometry(a, b, useZSprites);\r\n }\r\n return {\r\n Geometry,\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedPos: true,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n sphereSprite: useZSprites,\r\n }),\r\n };\r\n }\r\n\r\n static create2CClosedCylinders(_caps, _settings) {\r\n return _createInstancedCylinders(false, false);\r\n }\r\n\r\n static create2CCylinders(caps, settings) {\r\n return _createInstancedCylinders(settings.now.zSprites, true);\r\n }\r\n\r\n static create2CLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.TwoColorLinesGeometry, renderParams);\r\n }\r\n\r\n static createCrosses(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.CrossGeometry, renderParams);\r\n }\r\n\r\n static createExtrudedChains(_caps, _settings) {\r\n return _createSimpleGeoTriplet(geometries.ExtrudedObjectsGeometry);\r\n }\r\n\r\n static createChunkedLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.ChunkedLinesGeometry, renderParams);\r\n }\r\n\r\n static createQuickSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.QuickSurfGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createContactSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.ContactSurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createSASSES(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.SSIsosurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createLabels(_caps, _settings) {\r\n return {\r\n Geometry: geometries.LabelsGeometry,\r\n Object: meshes.Text,\r\n initMaterial() {\r\n },\r\n };\r\n }\r\n}\r\n\r\nexport default MeshCreator;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../gfxutils';\r\n\r\nclass TransformGroup extends THREE.Object3D {\r\n static _inverseMatrix = new THREE.Matrix4();\r\n\r\n static _ray = new THREE.Ray();\r\n\r\n constructor(geometry, geoParams, material, transforms) {\r\n super();\r\n this._geometry = geometry;\r\n this._geoParams = geoParams;\r\n const mat = material.createInstance();\r\n geoParams.initMaterial(mat);\r\n this._material = mat;\r\n this._transforms = transforms.length > 0 ? transforms : [new THREE.Matrix4()];\r\n const meshes = this._createMeshes(geometry);\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n this.add(meshes[i]);\r\n }\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const ray = TransformGroup._ray;\r\n const inverseMatrix = TransformGroup._inverseMatrix;\r\n const { children } = this;\r\n ray.copy(raycaster.ray);\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n\r\n if (!gfxutils.belongToSelectLayers(child)) {\r\n continue;\r\n }\r\n\r\n child.updateMatrixWorld();\r\n const mtx = child.matrixWorld;\r\n inverseMatrix.copy(mtx).invert();\r\n raycaster.ray.copy(ray).applyMatrix4(inverseMatrix);\r\n const childIntersects = [];\r\n this._geometry.raycast(raycaster, childIntersects);\r\n\r\n for (let j = 0, ciCount = childIntersects.length; j < ciCount; ++j) {\r\n const inters = childIntersects[j];\r\n if (inters.point) {\r\n inters.point.applyMatrix4(mtx);\r\n inters.distance = ray.origin.distanceTo(inters.point);\r\n }\r\n inters.object = child;\r\n intersects[intersects.length] = inters;\r\n }\r\n }\r\n raycaster.ray.copy(ray);\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const geos = this._geometry.getSubset(chunkIndices);\r\n const subset = [];\r\n let subIdx = 0;\r\n\r\n for (let i = 0, n = geos.length; i < n; ++i) {\r\n const meshes = this._createMeshes(geos[i]);\r\n for (let j = 0, meshCnt = meshes.length; j < meshCnt; ++j) {\r\n subset[subIdx++] = meshes[j];\r\n }\r\n }\r\n\r\n return subset;\r\n }\r\n\r\n _createMeshes(geometry) {\r\n const transforms = this._transforms;\r\n const Mesh = this._geoParams.Object;\r\n const material = this._material;\r\n const meshes = [];\r\n for (let i = 0, n = transforms.length; i < n; ++i) {\r\n const mesh = new Mesh(geometry, material);\r\n mesh.applyMatrix4(transforms[i]);\r\n meshes[i] = mesh;\r\n }\r\n\r\n return meshes;\r\n }\r\n}\r\n\r\nexport default TransformGroup;\r\n","import RCGroup from '../../RCGroup';\r\nimport TransformGroup from '../../meshes/TransformGroup';\r\n\r\nfunction wrapper(Name, args) {\r\n const params = [Name].concat(args);\r\n return Name.bind(...params);\r\n}\r\n\r\nclass ChemGroup extends RCGroup {\r\n constructor(geoParams, selection, colorer, mode, transforms, polyComplexity, material) {\r\n super();\r\n if (this.constructor === ChemGroup) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n this._selection = selection;\r\n this._mode = mode;\r\n this._colorer = colorer;\r\n this._chunksIdc = selection.chunks;\r\n this._polyComplexity = polyComplexity;\r\n this._geo = new (wrapper(geoParams.Geometry, this._makeGeoArgs()))();\r\n this._mesh = new TransformGroup(this._geo, geoParams, material, transforms);\r\n this.add(this._mesh);\r\n this._build();\r\n }\r\n\r\n _makeGeoArgs() {\r\n throw new Error('ChemGroup subclass must override _makeGeoArgs() method');\r\n }\r\n\r\n /**\r\n * Builds subset geometry by ATOMS index list\r\n *\r\n * @param {Number} mask - Representation mask\r\n * @param {Boolean} innerOnly - if true returns inner bonds only - without halves\r\n * @returns {Array} Subset geometry\r\n */\r\n getSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : false;\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return [];\r\n }\r\n return this._mesh.getSubset(chunksList);\r\n }\r\n\r\n _changeSubsetOpacity(mask, value, innerOnly) {\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return;\r\n }\r\n this._geo.setOpacity(chunksList, value);\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 1.0, innerOnly);\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 0.0, innerOnly);\r\n }\r\n}\r\n\r\nexport default ChemGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass AtomsGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { atoms } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const atomsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const atomIdx = atomsIdc[inters[i].chunkIdx];\r\n if (atomIdx < atoms.length) {\r\n inters[i].atom = atoms[atomIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { atoms } = this._selection;\r\n const atomsIdc = this._chunksIdc;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n if ((atom.mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default AtomsGroup;\r\n","import AtomsGroup from './AtomsGroup';\r\n\r\nclass AtomsSphereGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, atom.position, mode.calcAtomRadius(atom));\r\n geo.setColor(i, colorer.getAtomColor(atom, parent));\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), mode.calcAtomRadius(atom));\r\n if (updateColor) {\r\n geo.setColor(i, frameData.getAtomColor(colorer, atom));\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsSphereGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSurfaceGroup extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n return [n, opts];\r\n }\r\n}\r\nexport default AtomsSurfaceGroup;\r\n","/* This is a stub class keep it until SAS/SES is refactored */\r\n\r\nimport AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSASSESGroupStub extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n opts.selection = this._selection;\r\n opts.colorMode = this._colorer;\r\n return [n, opts];\r\n }\r\n}\r\n\r\nexport default AtomsSASSESGroupStub;\r\n","import AtomsGroup from './AtomsGroup';\r\nimport utils from '../../../utils';\r\n\r\nfunction adjustColor(color) {\r\n let r = (color >> 16) & 255;\r\n let g = (color >> 8) & 255;\r\n let b = color & 255;\r\n\r\n if (0.2126 * r + 0.7152 * g + 0.0722 * b > 127) {\r\n r = r * 3 / 10;\r\n g = g * 3 / 10;\r\n b = b * 3 / 10;\r\n } else {\r\n r = 255 - ((255 - r) * 3 / 10);\r\n g = 255 - ((255 - g) * 3 / 10);\r\n b = 255 - ((255 - b) * 3 / 10);\r\n }\r\n\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\nfunction inverseColor(color) {\r\n const r = (color >> 16) & 255;\r\n const g = (color >> 8) & 255;\r\n const b = color & 255;\r\n\r\n return ((255 - r) << 16) | ((255 - g) << 8) | (255 - b);\r\n}\r\n\r\nfunction getAtomText(atom) {\r\n if (atom.name.getNode() !== null) {\r\n return atom.name.getNode();\r\n }\r\n\r\n return atom.getVisualName();\r\n}\r\n\r\nconst colorMappings = {\r\n none(c) {\r\n return c;\r\n },\r\n adjust: adjustColor,\r\n inverse: inverseColor,\r\n};\r\n\r\nfunction propagateColor(color, rule) {\r\n let result;\r\n if (colorMappings.hasOwnProperty(rule)) {\r\n result = utils.hexColor(colorMappings[rule](color));\r\n } else {\r\n const val = parseInt(rule, 16);\r\n if (!Number.isNaN(val) && rule.toLowerCase().startsWith('0x')) {\r\n result = utils.hexColor(val);\r\n } else {\r\n result = '#000000';\r\n }\r\n }\r\n return result;\r\n}\r\n\r\nconst templateMappings = {\r\n serial(a) {\r\n return a.serial;\r\n },\r\n name(a) {\r\n return a.getVisualName();\r\n },\r\n elem(a) {\r\n return a.element.name;\r\n },\r\n residue(a) {\r\n return a.residue.getType().getName();\r\n },\r\n sequence(a) {\r\n return a.residue.getSequence();\r\n },\r\n chain(a) {\r\n return a.residue.getChain().getName();\r\n },\r\n hetatm(a) {\r\n return a.isHet();\r\n },\r\n water(a) {\r\n return a.residue.getType().getName() === 'HOH' || a.residue.getType().getName() === 'WAT';\r\n },\r\n};\r\n\r\nconst parseTemplate = function (atom, str) {\r\n return str.replace(/\\{\\{(\\s*\\w+\\s*)\\}\\}/g, (m) => {\r\n let key = m.replace(/\\s+/g, '');\r\n key = key.substring(2, key.length - 2).toLowerCase();\r\n\r\n if (templateMappings.hasOwnProperty(key)) {\r\n return templateMappings[key](atom);\r\n }\r\n return 'null';\r\n });\r\n};\r\n\r\nclass AtomsTextGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n const opts = this._mode.getLabelOpts();\r\n return [this._selection.chunks.length, opts];\r\n }\r\n\r\n _build() {\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = colorer.getAtomColor(atom, parent);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, atom.position, text);\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = frameData.getAtomColor(colorer, atom);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), text);\r\n if (updateColor) {\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsTextGroup;\r\n","import * as THREE from 'three';\r\nimport AtomsGroup from './AtomsGroup';\r\n\r\nfunction _slerp(omega, v1, v2, t) {\r\n const oSin = Math.sin(omega);\r\n return v1.clone().multiplyScalar(Math.sin((1 - t) * omega) / oSin).addScaledVector(v2, Math.sin(t * omega) / oSin);\r\n}\r\n\r\nclass AromaticGroup extends AtomsGroup {\r\n _buildInner(radOffset, addChunk) {\r\n const chunksToIdx = this._selection.chunks;\r\n\r\n const prevVector = new THREE.Vector3();\r\n const currVector = new THREE.Vector3();\r\n const segmentsHeight = this._segmentsHeight;\r\n const leprStep = 1.0 / segmentsHeight;\r\n const colorer = this._colorer;\r\n\r\n const { cycles, parent } = this._selection;\r\n let chunkIdx = 0;\r\n let currAtomIdx = chunksToIdx[chunkIdx];\r\n\r\n for (let cIdx = 0, cCount = cycles.length; cIdx < cCount; ++cIdx) {\r\n const cycle = cycles[cIdx];\r\n const cycAtoms = cycle.atoms;\r\n const chunkPoints = [];\r\n const tmpDir = [];\r\n const { center } = cycle;\r\n const cycleRad = cycle.radius - radOffset;\r\n const n = cycAtoms.length;\r\n let i = 0;\r\n const prevPos = cycAtoms[n - 1].position;\r\n let currPos = cycAtoms[i].position;\r\n prevVector.subVectors(prevPos, center);\r\n currVector.subVectors(currPos, center);\r\n const upDir = currVector.clone().cross(prevVector).normalize();\r\n\r\n for (; i < n; ++i) {\r\n const omega = prevVector.angleTo(currVector);\r\n tmpDir[i] = _slerp(omega, prevVector, currVector, 0.5).normalize();\r\n currPos = cycAtoms[(i + 1) % n].position;\r\n prevVector.copy(currVector);\r\n currVector.subVectors(currPos, center);\r\n }\r\n\r\n for (i = 0; i < n; ++i) {\r\n if (cycAtoms[i].index !== currAtomIdx) {\r\n continue;\r\n }\r\n const start = tmpDir[i];\r\n const end = tmpDir[(i + 1) % n];\r\n const color = colorer.getAtomColor(cycAtoms[i], parent);\r\n const currAngle = start.angleTo(end);\r\n\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n chunkPoints[j] = _slerp(currAngle, start, end, j * leprStep).multiplyScalar(cycleRad).add(center);\r\n }\r\n\r\n addChunk(chunkIdx++, color, chunkPoints, center, upDir);\r\n currAtomIdx = chunksToIdx[chunkIdx];\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default AromaticGroup;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../../gfxutils';\r\nimport AromaticGroup from './AromaticGroup';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n for (let i = 0; i < parts; ++i) {\r\n const a = -2 * i / parts * Math.PI;\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\nconst { calcChunkMatrix } = gfxutils;\r\n\r\nclass AromaticTorusGroup extends AromaticGroup {\r\n _build() {\r\n const segmentsHeight = this._segmentsHeight;\r\n const torusRad = this._mode.getAromRadius();\r\n const radiusV = new THREE.Vector2(torusRad, torusRad);\r\n const radOffset = this._mode.calcStickRadius() + 2 * torusRad;\r\n const lookAtVector = new THREE.Vector3();\r\n const mtc = [];\r\n const geo = this._geo;\r\n this._buildInner(radOffset, (chunkIdx, color, points, center, upDir) => {\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n const currDir = currPoint.clone().sub(center).cross(upDir);\r\n lookAtVector.addVectors(currPoint, currDir);\r\n mtc[j] = calcChunkMatrix(currPoint, lookAtVector, upDir, radiusV);\r\n }\r\n geo.setItem(chunkIdx, mtc);\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._polyComplexity;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length];\r\n }\r\n}\r\n\r\nexport default AromaticTorusGroup;\r\n","import AromaticGroup from './AromaticGroup';\r\n\r\nclass AromaticLinesGroup extends AromaticGroup {\r\n _build() {\r\n const geo = this._geo;\r\n const radOffset = this._mode.getAromaticOffset();\r\n this._buildInner(radOffset, (chunkIdx, color, points) => {\r\n let prevPt = points[0];// do not replace with start\r\n for (let j = 1; j <= this._segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n geo.setSegment(chunkIdx, j - 1, prevPt, currPoint);\r\n prevPt = currPoint;\r\n }\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._mode.getAromaticArcChunks();\r\n return [this._selection.chunks.length, this._segmentsHeight, true];\r\n }\r\n}\r\n\r\nexport default AromaticLinesGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[inters[i].chunkIdx];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesGroup;\r\n","import ResiduesGroup from './ResiduesGroup';\r\n\r\nclass NucleicItemGroup extends ResiduesGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[Math.floor(inters[i].chunkIdx / 2)];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n let chunkIdx = 0;\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList[chunkIdx++] = 2 * i;\r\n chunksList[chunkIdx++] = 2 * i + 1;\r\n }\r\n }\r\n return chunksList;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finishUpdate();\r\n }\r\n}\r\n\r\nexport default NucleicItemGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicCylindersGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n geo.setItem(chunkIdx, cyl1, cyl2, stickRad);\r\n geo.setColor(chunkIdx, color, color);\r\n }\r\n}\r\n\r\nexport default NucleicCylindersGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicSpheresGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length * 2, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n let idx = chunkIdx * 2;\r\n geo.setItem(idx, cyl1, stickRad);\r\n geo.setColor(idx, color);\r\n idx++;\r\n geo.setItem(idx, cyl2, stickRad);\r\n geo.setColor(idx, color);\r\n }\r\n}\r\n\r\nexport default NucleicSpheresGroup;\r\n","import * as THREE from 'three';\r\nimport { Smooth } from '../../../../vendor/js/Smooth';\r\nimport gfxutils from '../../gfxutils';\r\nimport chem from '../../../chem';\r\n\r\nconst { ResidueType } = chem;\r\n\r\nconst calcMatrix = gfxutils.calcChunkMatrix;\r\n\r\nfunction _buildStructureInterpolator(points, tension) {\r\n const path = Smooth(points, {\r\n method: Smooth.METHOD_CUBIC,\r\n clip: Smooth.CLIP_CLAMP,\r\n cubicTension: tension,\r\n scaleTo: 1,\r\n });\r\n\r\n return function (t, argTrans) {\r\n let transformT = argTrans;\r\n if (transformT === null) {\r\n // map our range to the [second .. last but one]\r\n transformT = function (tt) {\r\n return (tt * ((points.length - 1) - 2) + 1) / (points.length - 1);\r\n };\r\n }\r\n const newt = transformT(t);\r\n const ans = path(newt);\r\n return new THREE.Vector3(ans[0], ans[1], ans[2]);\r\n };\r\n}\r\n\r\nfunction _addPoints(centerPoints, topPoints, idx, residue) {\r\n if (!residue._isValid) {\r\n centerPoints[idx] = centerPoints[idx - 1];\r\n topPoints[idx] = topPoints[idx - 1];\r\n return;\r\n }\r\n const cp = residue._controlPoint;\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n const tp = cp.clone().add(residue._wingVector);\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n}\r\n\r\nfunction _addPointsForLoneResidue(centerPoints, topPoints, idx, residue) {\r\n const nucleic = (residue._type.flags & ResidueType.Flags.NUCLEIC) !== 0;\r\n const nameFrom = nucleic ? 'C5\\'' : 'N';\r\n const nameTo = nucleic ? 'C3\\'' : 'C';\r\n\r\n let posFrom;\r\n let posTo;\r\n residue.forEachAtom((atom) => {\r\n const name = atom.getVisualName();\r\n if (!posFrom && name === nameFrom) {\r\n posFrom = atom.position;\r\n } else if (!posTo && name === nameTo) {\r\n posTo = atom.position;\r\n }\r\n });\r\n\r\n // provide a fallback for unknown residues\r\n if (!(posFrom && posTo)) {\r\n posFrom = residue._firstAtom.position;\r\n posTo = residue._lastAtom.position;\r\n }\r\n\r\n if (posFrom && posTo) {\r\n const shift = posTo.clone().sub(posFrom);\r\n\r\n const wing = residue._wingVector;\r\n const cp = residue._controlPoint;\r\n const tp = cp.clone().add(wing);\r\n\r\n const cpPrev = cp.clone().sub(shift);\r\n const tpPrev = cpPrev.clone().add(wing);\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n ++idx;\r\n\r\n const cpNext = cp.clone().add(shift);\r\n const tpNext = cpNext.clone().add(wing);\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n ++idx;\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n }\r\n}\r\n\r\nfunction _calcPoints(residues, firstIdx, lastIdx, boundaries) {\r\n const left = boundaries.start;\r\n const right = boundaries.end;\r\n function _prevIdx(idx) {\r\n return idx > left && residues[idx - 1]._isValid ? idx - 1 : idx;\r\n }\r\n function _nextIdx(idx) {\r\n return idx < right && residues[idx + 1]._isValid ? idx + 1 : idx;\r\n }\r\n\r\n const topPoints = [];\r\n const centerPoints = [];\r\n let arrIdx = 0;\r\n function _extrapolate2(currIdx, otherIdx) {\r\n const cp = residues[currIdx]._controlPoint.clone().lerp(residues[otherIdx]._controlPoint, -0.25);\r\n const tp = cp.clone().add(residues[currIdx]._wingVector);\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n }\r\n\r\n // a single disconnected residue\r\n const prevIdx = _prevIdx(firstIdx);\r\n const nextIdx = _nextIdx(lastIdx);\r\n if (prevIdx === nextIdx) {\r\n _addPointsForLoneResidue(centerPoints, topPoints, arrIdx, residues[firstIdx]);\r\n return { centerPoints, topPoints };\r\n }\r\n\r\n // Two points (prev-prev and next-next) are added to support edge conditions for cubic splines, they are ignored\r\n // Another two (prev and next) were added to support the outside of the sub chain\r\n\r\n // prev and prev-prev\r\n if (firstIdx === prevIdx) {\r\n // do the extrapolation\r\n _extrapolate2(firstIdx, _nextIdx(firstIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[_prevIdx(prevIdx)]);\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[prevIdx]);\r\n }\r\n\r\n // main loop\r\n for (let idx = firstIdx; idx <= lastIdx; ++idx) {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[idx]);\r\n }\r\n\r\n // next and next-next\r\n if (nextIdx === _nextIdx(nextIdx)) {\r\n // do the extrapolation\r\n _extrapolate2(lastIdx, _prevIdx(lastIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[nextIdx]);\r\n _addPoints(centerPoints, topPoints, arrIdx, residues[_nextIdx(nextIdx)]);\r\n }\r\n return { centerPoints, topPoints };\r\n}\r\n\r\nclass CartoonHelper {\r\n constructor(residues, startIdx, endIdx, segmentsCount, tension, boundaries) {\r\n const pointsArrays = _calcPoints(residues, startIdx, endIdx, boundaries);\r\n this._topInterp = _buildStructureInterpolator(pointsArrays.topPoints, tension);\r\n this._centerInterp = _buildStructureInterpolator(pointsArrays.centerPoints, tension);\r\n\r\n this._shift = 0.5 / (endIdx - startIdx + 2);\r\n this._valueStep = (1.0 - 2 * this._shift) / (2 * (endIdx - startIdx + 1) * (segmentsCount - 1));\r\n this._segmentsCount = segmentsCount;\r\n }\r\n\r\n prepareMatrices(idx, firstRad, secondRad) {\r\n const mtcCount = this._segmentsCount;\r\n const outMtc = new Array(mtcCount);\r\n const currRad = new THREE.Vector2(0, 0);\r\n\r\n const topInterp = this._topInterp;\r\n const cenInterp = this._centerInterp;\r\n\r\n let currentValue = this._shift + this._valueStep * (mtcCount - 1) * idx;\r\n\r\n for (let mtxIdx = 0; mtxIdx < mtcCount; ++mtxIdx) {\r\n const lerpVal = Math.min(1.0, mtxIdx / (mtcCount - 1));\r\n currRad.lerpVectors(firstRad, secondRad, lerpVal);\r\n\r\n const currTop = topInterp(currentValue, null);\r\n const currCenter = cenInterp(currentValue, null);\r\n currentValue += this._valueStep;\r\n const nextCenter = cenInterp(currentValue, null);\r\n\r\n outMtc[mtxIdx] = calcMatrix(currCenter.clone(), nextCenter.clone(), currTop.clone().sub(currCenter), currRad);\r\n }\r\n\r\n return outMtc;\r\n }\r\n}\r\n\r\nexport default CartoonHelper;\r\n","import * as THREE from 'three';\r\nimport ResiduesGroup from './ResiduesGroup';\r\nimport CartoonHelper from './CartoonHelper';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n\r\n for (let i = 0; i < parts; ++i) {\r\n // starts from pi/2 because it's important that points are lied on the angles of arrows (visual issues if not)\r\n const a = Math.PI / 2.0 - 2 * Math.PI * i / parts;\r\n\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\n\r\nfunction _loopThrough(subDiv, residues, segmentsHeight, tension, mode, callback) {\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n const { boundaries } = subDiv[subDivI];\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const idc = [subs[i].start, subs[i].end];\r\n const matrixHelper = new CartoonHelper(residues, idc[0], idc[1], segmentsHeight, tension, boundaries);\r\n let prevLast = null;\r\n const startIdx = subs[i].start * 2;\r\n const endIdx = subs[i].end * 2 + 1;\r\n let prevSecondRad = mode.getResidueRadius(residues[0], 0);\r\n for (let idx = startIdx; idx <= endIdx; ++idx) {\r\n const resIdx = (idx / 2 | 0);\r\n const currRes = residues[resIdx];\r\n const firstRad = mode.getResidueRadius(currRes, idx % 2);\r\n const secondRad = mode.getResidueRadius(currRes, 1 + (idx % 2));\r\n\r\n const mtc = matrixHelper.prepareMatrices(idx - idc[0] * 2, firstRad, secondRad);\r\n mtc.unshift(prevLast === null ? mtc[0] : prevLast);\r\n\r\n // Slope - radius is changed along this residue part\r\n const hasSlope = (firstRad.x !== secondRad.x) || (firstRad.y !== secondRad.y);\r\n // Cut - end radius of previous part not equal to start radius of this part. First section of this part lies in the orthogonal plane\r\n const hasCut = (firstRad.x !== prevSecondRad.x) || (firstRad.y !== prevSecondRad.y);\r\n\r\n callback(currRes, mtc, hasSlope, hasCut);\r\n\r\n prevLast = mtc[segmentsHeight];\r\n prevSecondRad = secondRad;\r\n }\r\n }\r\n }\r\n}\r\n\r\nclass ResiduesSubseqGroup extends ResiduesGroup {\r\n _makeGeoArgs() {\r\n const cmpMultiplier = this._mode.getHeightSegmentsRatio();\r\n this._segmentsHeight = this._polyComplexity * cmpMultiplier | 0;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length * 2];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n _loopThrough(this._selection.subdivs, residues, this._segmentsHeight, tension, mode, (currRes, mtc, hasSlope = false, hasCut = false) => {\r\n const color = colorer.getResidueColor(currRes, parent);\r\n chunkIdc[chunkIdx] = currRes._index;\r\n geo.setItem(chunkIdx, mtc, hasSlope, hasCut);\r\n geo.setColor(chunkIdx++, color);\r\n });\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n const frameRes = frameData.getResidues();\r\n let chunkIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n _loopThrough(this._selection.subdivs, frameRes, this._segmentsHeight, tension, mode, (currRes, mtc) => {\r\n geo.setItem(chunkIdx, mtc);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n });\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default ResiduesSubseqGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesTraceGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const subDiv = this._selection.subdivs;\r\n let chunksCount = 0;\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n chunksCount += subs[i].end - subs[i].start;\r\n }\r\n }\r\n return [chunksCount, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n chunkIdc[chunkIdx] = { first: prevRes._index, second: currRes._index };\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n geo.finalize();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n const { residues } = this._selection;\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksToIdx = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const chunk = chunksToIdx[Math.floor(chunkIdx / 2)];\r\n const resIdx = chunkIdx % 2 === 0 ? chunk.first : chunk.second;\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const chunksToIdx = this._chunksIdc;\r\n const { residues } = this._selection;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const chunk = chunksToIdx[i];\r\n if (residues[chunk.first]._mask & mask) {\r\n chunksList.push(i * 2);\r\n }\r\n if (residues[chunk.second]._mask & mask) {\r\n chunksList.push(i * 2 + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesTraceGroup;\r\n","import ChemGroup from './ChemGroup';\r\nimport Bond from '../../../chem/Bond';\r\n\r\nfunction getCylinderCount(bondOrder) {\r\n return bondOrder < 2 ? 1 : bondOrder;\r\n}\r\n\r\nclass BondsGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const drawMultiple = this._mode.drawMultiorderBonds();\r\n const showAromatic = this._mode.showAromaticLoops();\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n let bondsCount = 0;\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n bondsCount += this.getBondOrder(bonds[bondsIdc[i]], drawMultiple, showAromatic);\r\n }\r\n return [bondsCount, this._polyComplexity];\r\n }\r\n\r\n getBondOrder(bond, drawMultiple, showAromatic) {\r\n let bondOrder = 1;\r\n if (drawMultiple && (!showAromatic || bond._type !== Bond.BondType.AROMATIC)) {\r\n bondOrder = getCylinderCount(bond._order);\r\n }\r\n return bondOrder;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const { bonds } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const bondsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const bondIdx = bondsIdc[Math.floor(chunkIdx / 2)];\r\n if (bondIdx < bonds.length) {\r\n const bond = bonds[bondIdx];\r\n inters[i].atom = chunkIdx % 2 === 0 ? bond._left : bond._right;\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask, innerOnly) {\r\n const chunksList = [];\r\n const { bonds } = this._selection;\r\n const chunksToIdx = this._chunksIdc;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const bond = bonds[chunksToIdx[i]];\r\n if ((bond._left.mask & mask) && (!innerOnly || (bond._right.mask & mask))) {\r\n chunksList.push(2 * i);\r\n }\r\n if ((bond._right.mask & mask) && (!innerOnly || (bond._left.mask & mask))) {\r\n chunksList.push(2 * i + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default BondsGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nclass BondsCylinderGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsCylinderGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nconst STEP_SIZE = 0.15;\r\n\r\nclass BondsLinesGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsLinesGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\nimport AtomsSurfaceGroup from './AtomsSurfaceGroup';\r\nimport AtomsSASSESGroupStub from './AtomsSASSESGroupStub';\r\nimport AtomsTextGroup from './AtomsTextGroup';\r\nimport AromaticTorusGroup from './AromaticTorusGroup';\r\nimport AromaticLinesGroup from './AromaticLinesGroup';\r\nimport NucleicCylindersGroup from './NucleicCylindersGroup';\r\nimport NucleicSpheresGroup from './NucleicSpheresGroup';\r\nimport ResiduesSubseqGroup from './ResiduesSubseqGroup';\r\nimport ResiduesTraceGroup from './ResiduesTraceGroup';\r\nimport BondsCylinderGroup from './BondsCylinderGroup';\r\nimport BondsLinesGroup from './BondsLinesGroup';\r\n\r\nexport default {\r\n AtomsSphereGroup,\r\n AtomsSurfaceGroup,\r\n AtomsSASSESGroupStub,\r\n AtomsTextGroup,\r\n AromaticTorusGroup,\r\n AromaticLinesGroup,\r\n NucleicCylindersGroup,\r\n NucleicSpheresGroup,\r\n ResiduesSubseqGroup,\r\n ResiduesTraceGroup,\r\n BondsCylinderGroup,\r\n BondsLinesGroup,\r\n};\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AtomsProcessor extends RCGroup {\r\n constructor(AtomsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n this._mode = mode;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let atomCount = 0;\r\n component.forEachAtom((atom) => {\r\n if (!self._checkAtom(atom, mask)) {\r\n return;\r\n }\r\n atomsIdc[atomCount++] = atom.index;\r\n });\r\n if (atomCount === 0) {\r\n return;\r\n }\r\n const atomsGroup = new AtomsGroup(geoParams, {\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n _checkAtom(atom, mask) {\r\n return atom.mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AtomsProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\n\r\nclass OrphanAtomsProcessor extends AtomsProcessor {\r\n _checkAtom(atom, mask) {\r\n if (!(atom.mask & mask)) {\r\n return false;\r\n }\r\n\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n if ((bonds[i]._left.mask & mask) && (bonds[i]._right.mask & mask)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n\r\nexport default OrphanAtomsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass ResiduesProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n component.forEachResidue((residue) => {\r\n if (self._checkResidue(residue, mask)) {\r\n resIdc[chunksCount++] = residue._index;\r\n }\r\n });\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n checkResidue(residue, mask) {\r\n return residue._mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default ResiduesProcessor;\r\n","import ResidueProcessor from './ResiduesProcessor';\r\n\r\nclass NucleicProcessor extends ResidueProcessor {\r\n _checkResidue(residue, mask) {\r\n return mask & residue._mask && residue._cylinders !== null;\r\n }\r\n}\r\nexport default NucleicProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass SubseqsProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const subDivs = component.getMaskedSubdivSequences(mask);\r\n\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n for (let subDivI = 0, subDivN = subDivs.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDivs[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let j = subs[i].start, jEnd = subs[i].end; j <= jEnd; ++j) {\r\n resIdc[chunksCount++] = residues[j]._index;\r\n }\r\n }\r\n }\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n subdivs: subDivs,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default SubseqsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass BondsProcessor extends RCGroup {\r\n constructor(BondsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const bonds = complex.getBonds();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const bondsIdc = [];\r\n let bondsCount = 0;\r\n component.forEachBond((bond) => {\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n if (!(atom1.mask & mask) || !(atom2.mask & mask)) {\r\n return;\r\n }\r\n bondsIdc[bondsCount++] = bond._index;\r\n });\r\n if (bondsCount === 0) {\r\n return;\r\n }\r\n const bondsGroup = new BondsGroup(geoParams, {\r\n bonds,\r\n chunks: bondsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n bondsGroup._component = component;\r\n self.add(bondsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default BondsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AromaticProcessor extends RCGroup {\r\n constructor(AromaticGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n if (!mode.showAromaticLoops()) {\r\n return;\r\n }\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let chunksCount = 0;\r\n const cycles = [];\r\n let cycleIdx = 0;\r\n component.forEachCycle((cycle) => {\r\n const cycAtoms = cycle.atoms;\r\n let perCycle = 0;\r\n for (let i = 0, n = cycAtoms.length; i < n; ++i) {\r\n if ((cycAtoms[i].mask & mask) !== 0) {\r\n ++perCycle;\r\n atomsIdc[chunksCount++] = cycAtoms[i].index;\r\n }\r\n }\r\n if (perCycle > 0) {\r\n cycles[cycleIdx++] = cycle;\r\n }\r\n });\r\n\r\n const atomsGroup = new AromaticGroup(geoParams, {\r\n cycles,\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AromaticProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\nimport OrphanAtomsProcessor from './OrphanAtomsProcessor';\r\nimport ResiduesProcessor from './ResiduesProcessor';\r\nimport NucleicProcessor from './NucleicProcessor';\r\nimport SubseqsProcessor from './SubseqsProcessor';\r\nimport BondsProcessor from './BondsProcessor';\r\nimport AromaticProcessor from './AromaticProcessor';\r\n\r\nexport default {\r\n Atoms: AtomsProcessor,\r\n OrphanAtoms: OrphanAtomsProcessor,\r\n Residues: ResiduesProcessor,\r\n Nucleic: NucleicProcessor,\r\n Subseqs: SubseqsProcessor,\r\n Bonds: BondsProcessor,\r\n Aromatic: AromaticProcessor,\r\n};\r\n","import MeshCreator from '../../meshes/MeshCreator';\r\nimport groups from './groups';\r\nimport processors from '../processors/processors';\r\n\r\nfunction _bakeGroup(triplet, Processor, Group) {\r\n return function (complex, colorer, mode, polyComplexity, mask, material) {\r\n return new Processor(Group, triplet, complex, colorer, mode, polyComplexity, mask, material);\r\n };\r\n}\r\n\r\nclass GroupsFactory {\r\n static AtomsSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static OrphanedAtomsCrosses(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createCrosses(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.OrphanAtoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static BondsCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsCylinderGroup);\r\n }\r\n\r\n static BondsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.create2CLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsLinesGroup);\r\n }\r\n\r\n static CartoonChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesSubseqGroup);\r\n }\r\n\r\n static TraceChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CClosedCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesTraceGroup);\r\n }\r\n\r\n static NucleicSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicSpheresGroup);\r\n }\r\n\r\n static NucleicCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicCylindersGroup);\r\n }\r\n\r\n static ALoopsTorus(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticTorusGroup);\r\n }\r\n\r\n static ALoopsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createChunkedLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticLinesGroup);\r\n }\r\n\r\n static QuickSurfGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createQuickSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static ContactSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createContactSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static SASSESSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createSASSES(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSASSESGroupStub);\r\n }\r\n\r\n static TextLabelsGeo(caps, settings) {\r\n const gfxTriplet = MeshCreator.createLabels(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsTextGroup);\r\n }\r\n}\r\n\r\nexport default GroupsFactory;\r\n","import _ from 'lodash';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport factory from './groups/GroupsFactory';\r\n\r\n/**\r\n * Create new mode.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the mode after its creation.\r\n *\r\n * @exports Mode\r\n * @this Mode\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available modes used for building and displaying molecule geometry.\r\n */\r\nclass Mode {\r\n constructor(opts) {\r\n if (this.constructor === Mode) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Mode options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(this.settings.now.modes[this.id], true), opts);\r\n }\r\n\r\n /**\r\n * Get mode identification, probably with options.\r\n * @returns {string|Array} Mode identifier string ({@link Mode#id}) or two-element array containing both mode\r\n * identifier and options ({@link Mode#opts}).\r\n * Options are returned if they were changed during or after the mode creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, this.settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const polyComplexity = this.opts.polyComplexity ? this.opts.polyComplexity[this.settings.now.resolution] : 0;\r\n const groupList = this.depGroups;\r\n const groupCount = groupList.length;\r\n const group = new gfxutils.RCGroup();\r\n const self = this;\r\n for (let i = 0; i < groupCount; ++i) {\r\n let currGroup = groupList[i];\r\n let renderParams = {};\r\n if (_.isArray(currGroup)) {\r\n renderParams = currGroup[1].call(this);\r\n [currGroup] = currGroup;\r\n }\r\n const Group = factory[currGroup](null, this.settings, renderParams);\r\n const newGroup = new Group(complex, colorer, self, polyComplexity, mask, material);\r\n if (newGroup.children.length > 0) {\r\n group.add(newGroup);\r\n }\r\n }\r\n return group;\r\n }\r\n}\r\n\r\nmakeContextDependent(Mode.prototype);\r\n\r\n/**\r\n* Mode identifier.\r\n* @type {string}\r\n*/\r\nMode.prototype.id = '__';\r\n\r\n/**\r\n * Mode geo groups.\r\n * @type {Array}\r\n */\r\nMode.prototype.depGroups = [];\r\n\r\nexport default Mode;\r\n","import Mode from './Mode';\r\n\r\nfunction getRenderParams() {\r\n return {\r\n lineWidth: this.opts.lineWidth,\r\n };\r\n}\r\n\r\nclass LinesMode extends Mode {\r\n static id = 'LN';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const groups = this.depGroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n groups[i] = [groups[i], getRenderParams];\r\n }\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n\r\n calcAtomRadius() {\r\n return this.opts.atom;\r\n }\r\n\r\n getAromaticOffset() {\r\n return this.opts.offsarom;\r\n }\r\n\r\n getAromaticArcChunks() {\r\n return this.opts.chunkarom;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n}\r\n\r\nLinesMode.prototype.id = 'LN';\r\nLinesMode.prototype.name = 'Lines';\r\nLinesMode.prototype.shortName = 'Lines';\r\nLinesMode.prototype.depGroups = [\r\n 'ALoopsLines',\r\n 'BondsLines',\r\n 'OrphanedAtomsCrosses',\r\n];\r\n\r\nexport default LinesMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass LicoriceMode extends Mode {\r\n static id = 'LC';\r\n\r\n calcAtomRadius(_atom) {\r\n return this.opts.bond;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nLicoriceMode.prototype.id = 'LC';\r\nLicoriceMode.prototype.name = 'Licorice';\r\nLicoriceMode.prototype.shortName = 'Licorice';\r\nLicoriceMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default LicoriceMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass BallsAndSticksMode extends Mode {\r\n static id = 'BS';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius * this.opts.atom;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nBallsAndSticksMode.prototype.id = 'BS';\r\nBallsAndSticksMode.prototype.name = 'Balls and Sticks';\r\nBallsAndSticksMode.prototype.shortName = 'Balls';\r\nBallsAndSticksMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default BallsAndSticksMode;\r\n","import Mode from './Mode';\r\n\r\nclass VanDerWaalsMode extends Mode {\r\n static id = 'VW';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n}\r\n\r\nVanDerWaalsMode.prototype.id = 'VW';\r\nVanDerWaalsMode.prototype.name = 'Van der Waals';\r\nVanDerWaalsMode.prototype.shortName = 'VDW';\r\nVanDerWaalsMode.prototype.depGroups = ['AtomsSpheres'];\r\n\r\nexport default VanDerWaalsMode;\r\n","import Mode from './Mode';\r\n\r\nclass TraceMode extends Mode {\r\n static id = 'TR';\r\n\r\n calcStickRadius() {\r\n return this.opts.radius;\r\n }\r\n}\r\n\r\nTraceMode.prototype.id = 'TR';\r\nTraceMode.prototype.name = 'Trace';\r\nTraceMode.prototype.shortName = 'Trace';\r\nTraceMode.prototype.depGroups = ['TraceChains'];\r\n\r\nexport default TraceMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass TubeMode extends Mode {\r\n static id = 'TU';\r\n\r\n getResidueRadius(_residue) {\r\n return this.TUBE_RADIUS;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const rad = this.opts.radius;\r\n this.TUBE_RADIUS = new THREE.Vector2(rad, rad);\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nTubeMode.prototype.id = 'TU';\r\nTubeMode.prototype.name = 'Tube';\r\nTubeMode.prototype.shortName = 'Tube';\r\nTubeMode.prototype.depGroups = ['CartoonChains'];\r\n\r\nexport default TubeMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass CartoonMode extends Mode {\r\n static id = 'CA';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n // cache for secondary structure options\r\n this.secCache = {};\r\n }\r\n\r\n getResidueStartRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (!second || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return secOpts.start;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueEndRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (second === null || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return this.ARROW_END;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueRadius(residue, val) {\r\n const startRad = this.getResidueStartRadius(residue);\r\n if (val === 0) {\r\n return startRad;\r\n }\r\n\r\n const endRad = this.getResidueEndRadius(residue);\r\n if (val === 2) {\r\n return endRad;\r\n }\r\n\r\n return startRad.clone().lerp(endRad, val / 2.0);\r\n }\r\n\r\n calcStickRadius(_res) {\r\n return this.opts.radius;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const tubeRad = this.opts.radius;\r\n const secHeight = this.opts.depth;\r\n\r\n this.TUBE_RADIUS = new THREE.Vector2(tubeRad, tubeRad);\r\n this.ARROW_END = new THREE.Vector2(secHeight, tubeRad);\r\n const secCache = {};\r\n const secData = this.opts.ss;\r\n /* eslint-disable guard-for-in */\r\n for (const prop in secData) {\r\n secCache[prop] = {\r\n center: new THREE.Vector2(secHeight, secData[prop].width),\r\n start: new THREE.Vector2(secHeight, secData[prop].arrow),\r\n };\r\n }\r\n this.secCache = secCache;\r\n /* eslint-enable guard-for-in */\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nCartoonMode.prototype.id = 'CA';\r\nCartoonMode.prototype.name = 'Cartoon';\r\nCartoonMode.prototype.shortName = 'Cartoon';\r\nCartoonMode.prototype.depGroups = [\r\n 'CartoonChains',\r\n 'NucleicSpheres',\r\n 'NucleicCylinders',\r\n];\r\n\r\nexport default CartoonMode;\r\n","import chem from '../../chem';\r\nimport Mode from './Mode';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction getRenderParams() {\r\n return {\r\n wireframe: this.opts.wireframe,\r\n zClip: this.opts.zClip,\r\n };\r\n}\r\n\r\nclass SurfaceMode extends Mode {\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const surfaces = this.surfaceNames;\r\n const groups = this.depGroups;\r\n for (let i = 0, n = surfaces.length; i < n; ++i) {\r\n groups[groups.length] = [surfaces[i], getRenderParams];\r\n }\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getVisibilitySelector() {\r\n let visibilitySelector = null;\r\n if (this.opts.subset !== '') {\r\n const res = selectors.parse(this.opts.subset);\r\n if (!res.error) {\r\n visibilitySelector = res.selector;\r\n }\r\n }\r\n return visibilitySelector;\r\n }\r\n}\r\n\r\nSurfaceMode.prototype.isSurface = true;\r\nSurfaceMode.prototype.surfaceNames = [];\r\n\r\nexport default SurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass QuickSurfaceMode extends SurfaceMode {\r\n static id = 'QS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n useBeads: false,\r\n isoValue: this.opts.isoValue,\r\n gaussLim: this.opts.gaussLim[this.settings.now.resolution],\r\n radScale: this.opts.scale,\r\n gridSpacing: this.opts.gridSpacing[this.settings.now.resolution],\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nQuickSurfaceMode.prototype.id = 'QS';\r\nQuickSurfaceMode.prototype.name = 'Quick Surface';\r\nQuickSurfaceMode.prototype.shortName = 'Quick Surf';\r\nQuickSurfaceMode.prototype.surfaceNames = ['QuickSurfGeo'];\r\n\r\nexport default QuickSurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass IsoSurfaceMode extends SurfaceMode {\r\n constructor(excludeProbe, opts) {\r\n super(opts);\r\n this._excludeProbe = excludeProbe;\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getSurfaceOpts() {\r\n return {\r\n gridSpacing: this.opts.polyComplexity[this.settings.now.resolution],\r\n radScale: this._radScale,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n probeRadius: this.opts.probeRadius,\r\n excludeProbe: this._excludeProbe,\r\n };\r\n }\r\n}\r\n\r\nIsoSurfaceMode.prototype.id = 'SU';\r\nIsoSurfaceMode.prototype.name = 'Surface';\r\nIsoSurfaceMode.prototype.shortName = 'Surface';\r\nIsoSurfaceMode.prototype.surfaceNames = ['SASSESSurfaceGeo'];\r\n\r\nIsoSurfaceMode.prototype._radScale = 1;\r\nIsoSurfaceMode.prototype._excludeProbe = false;\r\n\r\nexport default IsoSurfaceMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSASMode extends IsoSurfaceMode {\r\n static id = 'SA';\r\n\r\n constructor(opts) {\r\n super(false, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSASMode.prototype.id = 'SA';\r\nIsoSurfaceSASMode.prototype.name = 'Solvent Accessible Surface';\r\nIsoSurfaceSASMode.prototype.shortName = 'SAS';\r\n\r\nexport default IsoSurfaceSASMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSESMode extends IsoSurfaceMode {\r\n static id = 'SE';\r\n\r\n constructor(opts) {\r\n super(true, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSESMode.prototype.id = 'SE';\r\nIsoSurfaceSESMode.prototype.name = 'Solvent Excluded Surface';\r\nIsoSurfaceSESMode.prototype.shortName = 'SES';\r\n\r\nexport default IsoSurfaceSESMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass ContactSurfaceMode extends SurfaceMode {\r\n static id = 'CS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n probeRadius: this.opts.probeRadius,\r\n radScale: this.opts.polyComplexity[this.settings.now.resolution],\r\n scaleFactor: this.opts.polyComplexity[this.settings.now.resolution],\r\n gridSpacing: 1.0 / this.opts.polyComplexity[this.settings.now.resolution],\r\n isoValue: this.opts.isoValue,\r\n probePositions: this.opts.probePositions,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nContactSurfaceMode.prototype.id = 'CS';\r\nContactSurfaceMode.prototype.name = 'Contact Surface';\r\nContactSurfaceMode.prototype.shortName = 'Contact Surf';\r\nContactSurfaceMode.prototype.isSurface = true;\r\nContactSurfaceMode.prototype.surfaceNames = ['ContactSurfaceGeo'];\r\n\r\nexport default ContactSurfaceMode;\r\n","import _ from 'lodash';\r\nimport Mode from './Mode';\r\n\r\nclass TextMode extends Mode {\r\n static id = 'TX';\r\n\r\n getTemplateOptions() {\r\n return this.opts.template;\r\n }\r\n\r\n getLabelOpts() {\r\n return _.merge(this.opts, {\r\n colors: true,\r\n adjustColor: true,\r\n transparent: true,\r\n });\r\n }\r\n}\r\n\r\nTextMode.prototype.id = 'TX';\r\nTextMode.prototype.name = 'Text mode';\r\nTextMode.prototype.shortName = 'Text';\r\nTextMode.prototype.depGroups = ['TextLabelsGeo'];\r\n\r\nexport default TextMode;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport LinesMode from './modes/LinesMode';\r\nimport LicoriceMode from './modes/LicoriceMode';\r\nimport BallsAndSticksMode from './modes/BallsAndSticksMode';\r\nimport VanDerWaalsMode from './modes/VanDerWaalsMode';\r\nimport TraceMode from './modes/TraceMode';\r\nimport TubeMode from './modes/TubeMode';\r\nimport CartoonMode from './modes/CartoonMode';\r\nimport QuickSurfaceMode from './modes/QuickSurfaceMode';\r\nimport IsoSurfaceSASMode from './modes/IsoSurfaceSASMode';\r\nimport IsoSurfaceSESMode from './modes/IsoSurfaceSESMode';\r\nimport ContactSurfaceMode from './modes/ContactSurfaceMode';\r\nimport TextMode from './modes/TextMode';\r\n\r\nconst modes = new EntityList([\r\n LinesMode,\r\n LicoriceMode,\r\n BallsAndSticksMode,\r\n VanDerWaalsMode,\r\n TraceMode,\r\n TubeMode,\r\n CartoonMode,\r\n QuickSurfaceMode,\r\n IsoSurfaceSASMode,\r\n IsoSurfaceSESMode,\r\n ContactSurfaceMode,\r\n TextMode,\r\n]);\r\n\r\nexport default modes;\r\n","import _ from 'lodash';\r\n\r\nfunction clamp(x, a, b) {\r\n return x <= b ? x < 0 ? 0 : x : b;\r\n}\r\n\r\nfunction lerpColor(c1, c2, alpha) {\r\n const beta = 1 - alpha;\r\n const r1 = (c1 >> 16) & 0xff;\r\n const g1 = (c1 >> 8) & 0xff;\r\n const b1 = c1 & 0xff;\r\n const r2 = (c2 >> 16) & 0xff;\r\n const g2 = (c2 >> 8) & 0xff;\r\n const b2 = c2 & 0xff;\r\n const r = beta * r1 + alpha * r2;\r\n const g = beta * g1 + alpha * g2;\r\n const b = beta * b1 + alpha * b2;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\nclass Palette {\r\n constructor(name, id) {\r\n this.name = name || 'Custom';\r\n this.id = id || 'CP';\r\n }\r\n\r\n getElementColor(name, asIs = false) {\r\n const color = this.elementColors[name];\r\n return color === undefined && !asIs ? this.defaultElementColor : color;\r\n }\r\n\r\n getResidueColor(name, asIs = false) {\r\n const color = this.residueColors[name];\r\n return color === undefined && !asIs ? this.defaultResidueColor : color;\r\n }\r\n\r\n getChainColor(name) {\r\n let chain = name.charCodeAt(0);\r\n chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F)\r\n % this.chainColors.length;\r\n return this.chainColors[chain];\r\n }\r\n\r\n getSecondaryColor(type, asIs = false) {\r\n const color = this.secondaryColors[type];\r\n return color === undefined && !asIs ? this.defaultSecondaryColor : color;\r\n }\r\n\r\n getSequentialColor(index) {\r\n const { colors } = this;\r\n const len = colors.length;\r\n return index < 0 ? colors[(index % len) + len] : colors[index % len];\r\n }\r\n\r\n getGradientColor(value, gradientName) {\r\n const gradient = this.gradients[gradientName];\r\n if (!gradient) {\r\n return this.defaultNamedColor;\r\n }\r\n const count = gradient.length;\r\n const index = value * (count - 1);\r\n let left = Math.floor(index);\r\n const right = clamp(left + 1, 0, count - 1);\r\n left = clamp(left, 0, count - 1);\r\n return lerpColor(gradient[left], gradient[right], index - left);\r\n }\r\n\r\n getNamedColor(name, asIs = false) {\r\n const color = this.namedColors[name];\r\n return color === undefined && !asIs ? this.defaultNamedColor : color;\r\n }\r\n}\r\n\r\n_.assign(Palette.prototype, {\r\n colors: [0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0x808080],\r\n\r\n minRangeColor: 0x000000,\r\n midRangeColor: 0x7F7F7F,\r\n maxRangeColor: 0xFFFFFF,\r\n\r\n defaultElementColor: 0xFFFFFF,\r\n elementColors: {},\r\n\r\n defaultResidueColor: 0xFFFFFF,\r\n residueColors: {},\r\n\r\n chainColors: [0xFFFFFF],\r\n\r\n defaultSecondaryColor: 0xFFFFFF,\r\n secondaryColors: {},\r\n\r\n defaultGradientColor: 0x000000,\r\n\r\n defaultNamedColor: 0xFFFFFF,\r\n namedColorsArray: [\r\n /* eslint-disable no-multi-spaces */\r\n ['indianred', 0xcd5c5c],\r\n ['lightcoral', 0xf08080],\r\n ['salmon', 0xfa8072],\r\n ['darksalmon', 0xe9967a],\r\n ['lightsalmon', 0xffa07a],\r\n ['crimson', 0xdc143c],\r\n ['red', 0xff0000],\r\n ['firebrick', 0xb22222],\r\n ['darkred', 0x8b0000],\r\n ['pink', 0xffc0cb],\r\n ['lightpink', 0xffb6c1],\r\n ['hotpink', 0xff69b4],\r\n ['deeppink', 0xff1493],\r\n ['mediumvioletred', 0xc71585],\r\n ['palevioletred', 0xdb7093],\r\n ['coral', 0xff7f50],\r\n ['tomato', 0xff6347],\r\n ['orangered', 0xff4500],\r\n ['darkorange', 0xff8c00],\r\n ['orange', 0xffa500],\r\n ['gold', 0xffd700],\r\n ['yellow', 0xffff00],\r\n ['lightyellow', 0xffffe0],\r\n ['lemonchiffon', 0xfffacd],\r\n ['lightgoldenrodyellow', 0xfafad2],\r\n ['papayawhip', 0xffefd5],\r\n ['moccasin', 0xffe4b5],\r\n ['peachpuff', 0xffdab9],\r\n ['palegoldenrod', 0xeee8aa],\r\n ['khaki', 0xf0e68c],\r\n ['darkkhaki', 0xbdb76b],\r\n ['lavender', 0xe6e6fa],\r\n ['thistle', 0xd8bfd8],\r\n ['plum', 0xdda0dd],\r\n ['violet', 0xee82ee],\r\n ['orchid', 0xda70d6],\r\n ['fuchsia', 0xff00ff],\r\n ['magenta', 0xff00ff],\r\n ['mediumorchid', 0xba55d3],\r\n ['mediumpurple', 0x9370db],\r\n ['rebeccapurple', 0x663399],\r\n ['blueviolet', 0x8a2be2],\r\n ['darkviolet', 0x9400d3],\r\n ['darkorchid', 0x9932cc],\r\n ['darkmagenta', 0x8b008b],\r\n ['purple', 0x800080],\r\n ['indigo', 0x4b0082],\r\n ['slateblue', 0x6a5acd],\r\n ['mediumslateblue', 0x7b68ee],\r\n ['darkslateblue', 0x483d8b],\r\n ['greenyellow', 0xadff2f],\r\n ['chartreuse', 0x7fff00],\r\n ['lawngreen', 0x7cfc00],\r\n ['lime', 0x00ff00],\r\n ['limegreen', 0x32cd32],\r\n ['palegreen', 0x98fb98],\r\n ['lightgreen', 0x90ee90],\r\n ['mediumspringgreen', 0x00fa9a],\r\n ['springgreen', 0x00ff7f],\r\n ['mediumseagreen', 0x3cb371],\r\n ['seagreen', 0x2e8b57],\r\n ['forestgreen', 0x228b22],\r\n ['green', 0x008000],\r\n ['darkgreen', 0x006400],\r\n ['yellowgreen', 0x9acd32],\r\n ['olivedrab', 0x6b8e23],\r\n ['olive', 0x808000],\r\n ['darkolivegreen', 0x556b2f],\r\n ['mediumaquamarine', 0x66cdaa],\r\n ['darkseagreen', 0x8fbc8f],\r\n ['lightseagreen', 0x20b2aa],\r\n ['darkcyan', 0x008b8b],\r\n ['teal', 0x008080],\r\n ['aqua', 0x00ffff],\r\n ['cyan', 0x00ffff],\r\n ['lightcyan', 0xe0ffff],\r\n ['paleturquoise', 0xafeeee],\r\n ['aquamarine', 0x7fffd4],\r\n ['turquoise', 0x40e0d0],\r\n ['mediumturquoise', 0x48d1cc],\r\n ['darkturquoise', 0x00ced1],\r\n ['cadetblue', 0x5f9ea0],\r\n ['steelblue', 0x4682b4],\r\n ['lightsteelblue', 0xb0c4de],\r\n ['powderblue', 0xb0e0e6],\r\n ['lightblue', 0xadd8e6],\r\n ['skyblue', 0x87ceeb],\r\n ['lightskyblue', 0x87cefa],\r\n ['deepskyblue', 0x00bfff],\r\n ['dodgerblue', 0x1e90ff],\r\n ['cornflowerblue', 0x6495ed],\r\n ['royalblue', 0x4169e1],\r\n ['blue', 0x0000ff],\r\n ['mediumblue', 0x0000cd],\r\n ['darkblue', 0x00008b],\r\n ['navy', 0x000080],\r\n ['midnightblue', 0x191970],\r\n ['cornsilk', 0xfff8dc],\r\n ['blanchedalmond', 0xffebcd],\r\n ['bisque', 0xffe4c4],\r\n ['navajowhite', 0xffdead],\r\n ['wheat', 0xf5deb3],\r\n ['burlywood', 0xdeb887],\r\n ['tan', 0xd2b48c],\r\n ['rosybrown', 0xbc8f8f],\r\n ['sandybrown', 0xf4a460],\r\n ['goldenrod', 0xdaa520],\r\n ['darkgoldenrod', 0xb8860b],\r\n ['peru', 0xcd853f],\r\n ['chocolate', 0xd2691e],\r\n ['saddlebrown', 0x8b4513],\r\n ['sienna', 0xa0522d],\r\n ['brown', 0xa52a2a],\r\n ['maroon', 0x800000],\r\n ['white', 0xffffff],\r\n ['snow', 0xfffafa],\r\n ['honeydew', 0xf0fff0],\r\n ['mintcream', 0xf5fffa],\r\n ['azure', 0xf0ffff],\r\n ['aliceblue', 0xf0f8ff],\r\n ['ghostwhite', 0xf8f8ff],\r\n ['whitesmoke', 0xf5f5f5],\r\n ['seashell', 0xfff5ee],\r\n ['beige', 0xf5f5dc],\r\n ['oldlace', 0xfdf5e6],\r\n ['floralwhite', 0xfffaf0],\r\n ['ivory', 0xfffff0],\r\n ['antiquewhite', 0xfaebd7],\r\n ['linen', 0xfaf0e6],\r\n ['lavenderblush', 0xfff0f5],\r\n ['mistyrose', 0xffe4e1],\r\n ['gainsboro', 0xdcdcdc],\r\n ['lightgray', 0xd3d3d3],\r\n ['silver', 0xc0c0c0],\r\n ['darkgray', 0xa9a9a9],\r\n ['gray', 0x808080],\r\n ['dimgray', 0x696969],\r\n ['lightslategray', 0x778899],\r\n ['slategray', 0x708090],\r\n ['darkslategray', 0x2f4f4f],\r\n ['black', 0x000000],\r\n /* eslint-enable no-multi-spaces */\r\n ],\r\n\r\n namedColors: {},\r\n /* eslint-enable no-magic-numbers */\r\n\r\n gradients: {\r\n rainbow: [\r\n 0x0000ff, // blue\r\n 0x00ffff, // cyan\r\n 0x00ff00, // green\r\n 0xffff00, // yellow\r\n 0xff0000, // red\r\n ],\r\n temp: [\r\n 0x0000ff, // blue\r\n 0x007fff, // light-blue\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n hot: [\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n cold: [\r\n 0xffffff, // white\r\n 0x007fff, // light-blue\r\n 0x0000ff, // blue\r\n ],\r\n 'blue-red': [\r\n 0x0000ff, // blue\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n reds: [\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n blues: [\r\n 0xffffff, // white\r\n 0x0000ff, // blue\r\n ],\r\n },\r\n});\r\n\r\nconst { namedColorsArray, namedColors } = Palette.prototype;\r\n\r\nfor (let i = 0, { length } = namedColorsArray; i < length; ++i) {\r\n const [name, value] = namedColorsArray[i];\r\n namedColors[name] = value;\r\n}\r\n\r\nexport default Palette;\r\n","import Palette from './Palette';\r\n\r\nconst palette = new Palette('CPK', 'CP');\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x202020,\r\n N: 0x2060FF,\r\n O: 0xEE2010,\r\n F: 0x00FF00,\r\n P: 0x8020FF,\r\n S: 0xFFFF00,\r\n CL: 0x00BB00,\r\n FE: 0xD0D0D0,\r\n CO: 0xD0D0D0,\r\n NI: 0xD0D0D0,\r\n CU: 0xD0D0D0,\r\n BR: 0x008800,\r\n I: 0x005500,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('Jmol', 'JM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0x0055FF, //\r\n 0x00ABFF, //\r\n 0x00FFFF, // cyan\r\n 0x00FFAB, //\r\n 0x00FF55, //\r\n 0x00FF00, // green\r\n 0x55FF00, //\r\n 0xABFF00, //\r\n 0xFFFF00, // yellow\r\n 0xFFAB00, //\r\n 0xFF5500, //\r\n 0xFF0000, // red\r\n 0xFF0055, //\r\n 0xFF00AB, //\r\n 0xFF00FF, // magenta\r\n 0xAB00FF, //\r\n 0x5500FF, //\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n D: 0xFFFFC0,\r\n T: 0xFFFFA0,\r\n HE: 0xD9FFFF,\r\n LI: 0xCC80FF,\r\n BE: 0xC2FF00,\r\n B: 0xFFB5B5,\r\n C: 0x909090,\r\n N: 0x3050F8,\r\n O: 0xFF0D0D,\r\n F: 0x90E050,\r\n NE: 0xB3E3F5,\r\n NA: 0xAB5CF2,\r\n MG: 0x8AFF00,\r\n AL: 0xBFA6A6,\r\n SI: 0xF0C8A0,\r\n P: 0xFF8000,\r\n S: 0xFFFF30,\r\n CL: 0x1FF01F,\r\n AR: 0x80D1E3,\r\n K: 0x8F40D4,\r\n CA: 0x3DFF00,\r\n SC: 0xE6E6E6,\r\n TI: 0xBFC2C7,\r\n V: 0xA6A6AB,\r\n CR: 0x8A99C7,\r\n MN: 0x9C7AC7,\r\n FE: 0xE06633,\r\n CO: 0xF090A0,\r\n NI: 0x50D050,\r\n CU: 0xC88033,\r\n ZN: 0x7D80B0,\r\n GA: 0xC28F8F,\r\n GE: 0x668F8F,\r\n AS: 0xBD80E3,\r\n SE: 0xFFA100,\r\n BR: 0xA62929,\r\n KR: 0x5CB8D1,\r\n RB: 0x702EB0,\r\n SR: 0x00FF00,\r\n Y: 0x94FFFF,\r\n ZR: 0x94E0E0,\r\n NB: 0x73C2C9,\r\n MO: 0x54B5B5,\r\n TC: 0x3B9E9E,\r\n RU: 0x248F8F,\r\n RH: 0x0A7D8C,\r\n PD: 0x006985,\r\n AG: 0xC0C0C0,\r\n CD: 0xFFD98F,\r\n IN: 0xA67573,\r\n SN: 0x668080,\r\n SB: 0x9E63B5,\r\n TE: 0xD47A00,\r\n I: 0x940094,\r\n XE: 0x429EB0,\r\n CS: 0x57178F,\r\n BA: 0x00C900,\r\n LA: 0x70D4FF,\r\n CE: 0xFFFFC7,\r\n PR: 0xD9FFC7,\r\n ND: 0xC7FFC7,\r\n PM: 0xA3FFC7,\r\n SM: 0x8FFFC7,\r\n EU: 0x61FFC7,\r\n GD: 0x45FFC7,\r\n TB: 0x30FFC7,\r\n DY: 0x1FFFC7,\r\n HO: 0x00FF9C,\r\n ER: 0x00E675,\r\n TM: 0x00D452,\r\n YB: 0x00BF38,\r\n LU: 0x00AB24,\r\n HF: 0x4DC2FF,\r\n TA: 0x4DA6FF,\r\n W: 0x2194D6,\r\n RE: 0x267DAB,\r\n OS: 0x266696,\r\n IR: 0x175487,\r\n PT: 0xD0D0E0,\r\n AU: 0xFFD123,\r\n HG: 0xB8B8D0,\r\n TL: 0xA6544D,\r\n PB: 0x575961,\r\n BI: 0x9E4FB5,\r\n PO: 0xAB5C00,\r\n AT: 0x754F45,\r\n RN: 0x428296,\r\n FR: 0x420066,\r\n RA: 0x007D00,\r\n AC: 0x70ABFA,\r\n TH: 0x00BAFF,\r\n PA: 0x00A1FF,\r\n U: 0x008FFF,\r\n NP: 0x0080FF,\r\n PU: 0x006BFF,\r\n AM: 0x545CF2,\r\n CM: 0x785CE3,\r\n BK: 0x8A4FE3,\r\n CF: 0xA136D4,\r\n ES: 0xB31FD4,\r\n FM: 0xB31FBA,\r\n MD: 0xB30DA6,\r\n NO: 0xBD0D87,\r\n LR: 0xC70066,\r\n RF: 0xCC0059,\r\n DB: 0xD1004F,\r\n SG: 0xD90045,\r\n BH: 0xE00038,\r\n HS: 0xE6002E,\r\n MT: 0xEB0026,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0xBEA06E;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0xC8C8C8,\r\n ARG: 0x145AFF,\r\n ASN: 0x00DCDC,\r\n ASP: 0xE60A0A,\r\n CYS: 0xE6E600,\r\n GLN: 0x00DCDC,\r\n GLU: 0xE60A0A,\r\n GLY: 0xEBEBEB,\r\n HIS: 0x8282D2,\r\n ILE: 0x0F820F,\r\n LEU: 0x0F820F,\r\n LYS: 0x145AFF,\r\n MET: 0xE6E600,\r\n PHE: 0x3232AA,\r\n PRO: 0xDC9682,\r\n SER: 0xFA9600,\r\n THR: 0xFA9600,\r\n TRP: 0xB45AB4,\r\n TYR: 0x3232AA,\r\n VAL: 0x0F820F,\r\n A: 0xA0A0FF,\r\n C: 0xFF8C4B,\r\n G: 0xFF7070,\r\n I: 0x80FFFF,\r\n T: 0xA0FFA0,\r\n U: 0xFF8080,\r\n DA: 0xA0A0FF,\r\n DC: 0xFF8C4B,\r\n DG: 0xFF7070,\r\n DI: 0x80FFFF,\r\n DT: 0xA0FFA0,\r\n DU: 0xFF8080,\r\n '+A': 0xA0A0FF,\r\n '+C': 0xFF8C4B,\r\n '+G': 0xFF7070,\r\n '+I': 0x80FFFF,\r\n '+T': 0xA0FFA0,\r\n '+U': 0xFF8080,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [\r\n // ' '->0 'A'->1, 'B'->2\r\n 0xFFffffff, // ' ' & '0' white\r\n //\r\n 0xFFC0D0FF, // skyblue\r\n 0xFFB0FFB0, // pastel green\r\n 0xFFFFC0C8, // pink\r\n 0xFFFFFF80, // pastel yellow\r\n 0xFFFFC0FF, // pastel magenta\r\n 0xFFB0F0F0, // pastel cyan\r\n 0xFFFFD070, // pastel gold\r\n 0xFFF08080, // lightcoral\r\n\r\n 0xFFF5DEB3, // wheat\r\n 0xFF00BFFF, // deepskyblue\r\n 0xFFCD5C5C, // indianred\r\n 0xFF66CDAA, // mediumaquamarine\r\n 0xFF9ACD32, // yellowgreen\r\n 0xFFEE82EE, // violet\r\n 0xFF00CED1, // darkturquoise\r\n 0xFF00FF7F, // springgreen\r\n 0xFF3CB371, // mediumseagreen\r\n\r\n 0xFF00008B, // darkblue\r\n 0xFFBDB76B, // darkkhaki\r\n 0xFF006400, // darkgreen\r\n 0xFF800000, // maroon\r\n 0xFF808000, // olive\r\n 0xFF800080, // purple\r\n 0xFF008080, // teal\r\n 0xFFB8860B, // darkgoldenrod\r\n 0xFFB22222, // firebrick\r\n];\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xFF0080,\r\n [StructuralElementType.HELIX_PI]: 0x600080,\r\n [StructuralElementType.HELIX_310]: 0xA00080,\r\n [StructuralElementType.STRAND]: 0xFFC800,\r\n [StructuralElementType.TURN]: 0x6080FF,\r\n dna: 0xAE00FE,\r\n rna: 0xFD0162,\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('VMD', 'VM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0xFF0000, // red\r\n 0x606060, // gray\r\n 0xFF8000, // orange\r\n 0xFFFF00, // yellow\r\n 0x808033, // tan\r\n 0x999999, // silver\r\n 0x00FF00, // green\r\n 0xFFFFFF, // white\r\n 0xFF9999, // pink\r\n 0x40C0C0, // cyan\r\n 0xA600A6, // purple\r\n 0x80E666, // lime\r\n 0xE666B3, // mauve\r\n 0x804D00, // ochre\r\n 0x8080C0, // ice blue\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\npalette.defaultElementColor = 0x804D00;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x40BFBF,\r\n N: 0x0000FF,\r\n O: 0xFF0000,\r\n P: 0x808033,\r\n S: 0xFFFF00,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0x40C0C0;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0x0000FF,\r\n ARG: 0xFFFFFF,\r\n ASN: 0x808033,\r\n ASP: 0xFF0000,\r\n CYS: 0xFFFF00,\r\n GLN: 0xFF8000,\r\n GLU: 0xFF9999,\r\n GLY: 0xFFFFFF,\r\n HIS: 0x40C0C0,\r\n ILE: 0x00FF00,\r\n LEU: 0xFF9999,\r\n LYS: 0x40C0C0,\r\n MET: 0xFFFF00,\r\n PHE: 0xA600A6,\r\n PRO: 0x804C00,\r\n SER: 0xFFFF00,\r\n THR: 0xE666B3,\r\n TRP: 0x999999,\r\n TYR: 0x00FF00,\r\n VAL: 0x808033,\r\n A: 0x0000FF,\r\n C: 0xFF8000,\r\n G: 0xFFFF00,\r\n T: 0xA600A6,\r\n U: 0x00FF00,\r\n DA: 0x0000FF,\r\n DC: 0xFF8000,\r\n DG: 0xFFFF00,\r\n DT: 0xA600A6,\r\n DU: 0x00FF00,\r\n '+A': 0x0000FF,\r\n '+C': 0xFF8000,\r\n '+G': 0xFFFF00,\r\n '+T': 0xA600A6,\r\n '+U': 0x00FF00,\r\n WAT: 0x40C0C0,\r\n H2O: 0x40C0C0,\r\n HOH: 0x40C0C0,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [0xFFFFFF].concat(palette.colors);\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xA600A6,\r\n [StructuralElementType.HELIX_310]: 0x0000FF,\r\n [StructuralElementType.HELIX_PI]: 0xFF0000,\r\n [StructuralElementType.STRAND]: 0xFFFF00,\r\n [StructuralElementType.BRIDGE]: 0x808033,\r\n [StructuralElementType.TURN]: 0x40C0C0,\r\n};\r\n\r\nexport default palette;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport cpkPalette from './palettes/cpkPalette';\r\nimport jmolPalette from './palettes/jmolPalette';\r\nimport vmdPalette from './palettes/vmdPalette';\r\n\r\nconst palettes = new EntityList([\r\n cpkPalette,\r\n jmolPalette,\r\n vmdPalette,\r\n]);\r\n\r\nexport default palettes;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport palettes from '../palettes';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports Colorer\r\n * @this Colorer\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available coloring algorithms used for building and displaying molecule geometry.\r\n */\r\nclass Colorer {\r\n constructor(opts) {\r\n if (this.constructor === Colorer) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Colorer options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(settings.now.colorers[this.id], true), opts);\r\n /**\r\n * Palette in use.\r\n * @type {Palette}\r\n */\r\n this.palette = palettes.first;\r\n }\r\n\r\n /**\r\n * Get Colorer identification, probably with options.\r\n * @returns {string|Array} Colorer identifier string ({@link Colorer#id}) or two-element array containing both colorer\r\n * identifier and options ({@link Colorer#opts}).\r\n * Options are returned if they were changed during or after colorer creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, settings.now.colorers[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n}\r\n\r\n/**\r\n * Colorer identifier.\r\n * @type {string}\r\n */\r\n\r\nColorer.prototype.id = '__';\r\n\r\nexport default Colorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Element\r\n *\r\n * @exports ElementColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on chemical element.\r\n */\r\nclass ElementColorer extends Colorer {\r\n static id = 'EL';\r\n\r\n getAtomColor(atom, _complex) {\r\n const type = atom.element.name;\r\n if (type === 'C' && this.opts.carbon >= 0) {\r\n return this.opts.carbon;\r\n }\r\n return this.palette.getElementColor(type);\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nElementColorer.prototype.id = 'EL';\r\nElementColorer.prototype.name = 'Element';\r\nElementColorer.prototype.shortName = 'Element';\r\n\r\nexport default ElementColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Coloring algorithm based on residue type.\r\n *\r\n * @see ResidueType\r\n *\r\n * @exports ResidueTypeColorer\r\n * @constructor\r\n */\r\nclass ResidueTypeColorer extends Colorer {\r\n static id = 'RT';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getResidueColor(residue._type._name);\r\n }\r\n}\r\n\r\nResidueTypeColorer.prototype.id = 'RT';\r\nResidueTypeColorer.prototype.name = 'Residue Type';\r\nResidueTypeColorer.prototype.shortName = 'Residue';\r\n\r\nexport default ResidueTypeColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass SequenceColorer extends Colorer {\r\n static id = 'SQ';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const chain = residue._chain;\r\n if (chain.minSequence === Number.POSITIVE_INFINITY && chain.maxSequence === Number.NEGATIVE_INFINITY) {\r\n return this.palette.defaultNamedColor;\r\n }\r\n const min = chain.minSequence;\r\n const max = chain.maxSequence > min ? chain.maxSequence : min + 1;\r\n return this.palette.getGradientColor((residue._sequence - min) / (max - min), this.opts.gradient);\r\n }\r\n}\r\n\r\nSequenceColorer.prototype.id = 'SQ';\r\nSequenceColorer.prototype.name = 'Sequence';\r\nSequenceColorer.prototype.shortName = 'Sequence';\r\n\r\nexport default SequenceColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ChainColorer extends Colorer {\r\n static id = 'CH';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getChainColor(residue.getChain()._name);\r\n }\r\n}\r\n\r\nChainColorer.prototype.id = 'CH';\r\nChainColorer.prototype.name = 'Chain';\r\nChainColorer.prototype.shortName = 'Chain';\r\n\r\nexport default ChainColorer;\r\n","import Colorer from './Colorer';\r\nimport ResidueType from '../../chem/ResidueType';\r\n\r\nclass SecondaryStructureColorer extends Colorer {\r\n static id = 'SS';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n if (residue._type.flags & ResidueType.Flags.DNA) {\r\n return this.palette.getSecondaryColor('dna');\r\n }\r\n if (residue._type.flags & ResidueType.Flags.RNA) {\r\n return this.palette.getSecondaryColor('rna');\r\n }\r\n const secondary = residue.getSecondary();\r\n if (secondary) {\r\n let color = this.palette.getSecondaryColor(secondary.type, true);\r\n if (color === undefined) {\r\n color = this.palette.getSecondaryColor(secondary.generic);\r\n }\r\n return color;\r\n }\r\n return this.palette.defaultSecondaryColor;\r\n }\r\n}\r\n\r\nSecondaryStructureColorer.prototype.id = 'SS';\r\nSecondaryStructureColorer.prototype.name = 'Secondary Structure';\r\nSecondaryStructureColorer.prototype.shortName = 'Structure';\r\n\r\nexport default SecondaryStructureColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass UniformColorer extends Colorer {\r\n static id = 'UN';\r\n\r\n getAtomColor(_atom, _complex) {\r\n return this.opts.color;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nUniformColorer.prototype.id = 'UN';\r\nUniformColorer.prototype.name = 'Uniform';\r\nUniformColorer.prototype.shortName = 'Uniform';\r\n\r\nexport default UniformColorer;\r\n","import Colorer from './Colorer';\r\nimport selectors from '../../chem/selectors';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports ConditionalColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on a selector string used as a condition.\r\n */\r\nclass ConditionalColorer extends Colorer {\r\n static id = 'CO';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n const parsed = selectors.parse(this.opts.subset);\r\n this._subsetCached = parsed.error ? selectors.none() : parsed.selector;\r\n }\r\n\r\n getAtomColor(atom, _complex) {\r\n return this._subsetCached.includesAtom(atom) ? this.opts.color : this.opts.baseColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const subset = this._subsetCached;\r\n const atoms = residue._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n if (!subset.includesAtom(atoms[i])) {\r\n return this.opts.baseColor;\r\n }\r\n }\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nConditionalColorer.prototype.id = 'CO';\r\nConditionalColorer.prototype.name = 'Conditional';\r\nConditionalColorer.prototype.shortName = 'Conditional';\r\n\r\nexport default ConditionalColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ConformationColorer extends Colorer {\r\n static id = 'CF';\r\n\r\n getAtomColor(atom, _complex) {\r\n return this.palette.getChainColor(String.fromCharCode(atom.location));\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nConformationColorer.prototype.id = 'CF';\r\nConformationColorer.prototype.name = 'Conformation';\r\nConformationColorer.prototype.shortName = 'Conformation';\r\n\r\nexport default ConformationColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Temperature\r\n *\r\n * @exports TemperatureColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on temperature of chemical element.\r\n */\r\nclass TemperatureColorer extends Colorer {\r\n static id = 'TM';\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n let factor = 1;\r\n if (atom.temperature && opts) {\r\n if (opts.min === opts.max) {\r\n factor = atom.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (atom.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n if (!opts) {\r\n return this.palette.defaultGradientColor;\r\n }\r\n if (residue.temperature) {\r\n let factor = 0;\r\n if (opts.min === opts.max) {\r\n factor = residue.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (residue.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n}\r\n\r\nTemperatureColorer.prototype.id = 'TM'; // [T]e[M]perature\r\nTemperatureColorer.prototype.name = 'Temperature';\r\nTemperatureColorer.prototype.shortName = 'Temperature';\r\n\r\nexport default TemperatureColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Occupancy\r\n *\r\n * @exports OccupancyColorer\r\n * @augments Occupancy\r\n * @constructor\r\n * @classdesc Coloring algorithm based on occupancy of chemical element.\r\n */\r\nclass OccupancyColorer extends Colorer {\r\n static id = 'OC';\r\n\r\n _getColorByOccupancy(occupancy, opts) {\r\n if (occupancy !== undefined) {\r\n const factor = 1 - occupancy;\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n return this._getColorByOccupancy(atom.occupancy, opts);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n return this._getColorByOccupancy(residue.occupancy, opts);\r\n }\r\n}\r\n\r\nOccupancyColorer.prototype.id = 'OC'; // [OC]cupancy\r\nOccupancyColorer.prototype.name = 'Occupancy';\r\nOccupancyColorer.prototype.shortName = 'Occupancy';\r\n\r\nexport default OccupancyColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass HydrophobicityColorer extends Colorer {\r\n static id = 'HY';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n let color = this.palette.defaultResidueColor;\r\n if (residue._type.hydrophobicity !== undefined) {\r\n // Kyte Doolitle hydro [-4.5,4.5]->[0.1]\r\n const min = -4.5;\r\n const max = 4.5;\r\n color = this.palette.getGradientColor((residue._type.hydrophobicity - min) / (max - min), this.opts.gradient);\r\n }\r\n return color;\r\n }\r\n}\r\n\r\nHydrophobicityColorer.prototype.id = 'HY';\r\nHydrophobicityColorer.prototype.name = 'Hydrophobicity';\r\nHydrophobicityColorer.prototype.shortName = 'Hydrophobicity';\r\n\r\nexport default HydrophobicityColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass MoleculeColorer extends Colorer {\r\n static id = 'MO';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const molecule = residue._molecule;\r\n const count = _complex.getMoleculeCount();\r\n if (count > 1) {\r\n return this.palette.getGradientColor((molecule.index - 1) / (count - 1), this.opts.gradient);\r\n }\r\n return this.palette.getGradientColor(0, this.opts.gradient);\r\n }\r\n}\r\n\r\nMoleculeColorer.prototype.id = 'MO';\r\nMoleculeColorer.prototype.name = 'Molecule';\r\nMoleculeColorer.prototype.shortName = 'Molecule';\r\n\r\nexport default MoleculeColorer;\r\n","import Colorer from './Colorer';\r\nimport Atom from '../../chem/Atom';\r\n\r\nfunction scaleColor(c, factor) {\r\n const r1 = (c >> 16) & 0xff;\r\n const g1 = (c >> 8) & 0xff;\r\n const b1 = c & 0xff;\r\n const r = factor * r1;\r\n const g = factor * g1;\r\n const b = factor * b1;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports CarbonColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on selection carbon atoms.\r\n */\r\nclass CarbonColorer extends Colorer {\r\n static id = 'CB';\r\n\r\n getAtomColor(atom, _complex) {\r\n const colorCarbon = this.opts.color;\r\n const colorNotCarbon = scaleColor(colorCarbon, this.opts.factor);\r\n return (atom.flags & Atom.Flags.CARBON) ? colorCarbon : colorNotCarbon;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nCarbonColorer.prototype.id = 'CB';\r\nCarbonColorer.prototype.name = 'Carbon';\r\nCarbonColorer.prototype.shortName = 'Carbon';\r\n\r\nexport default CarbonColorer;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport ElementColorer from './colorers/ElementColorer';\r\nimport ResidueTypeColorer from './colorers/ResidueTypeColorer';\r\nimport SequenceColorer from './colorers/SequenceColorer';\r\nimport ChainColorer from './colorers/ChainColorer';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\nimport UniformColorer from './colorers/UniformColorer';\r\nimport ConditionalColorer from './colorers/ConditionalColorer';\r\nimport ConformationColorer from './colorers/ConformationColorer';\r\nimport TemperatureColorer from './colorers/TemperatureColorer';\r\nimport OccupancyColorer from './colorers/OccupancyColorer';\r\nimport HydrophobicityColorer from './colorers/HydrophobicityColorer';\r\nimport MoleculeColorer from './colorers/MoleculeColorer';\r\nimport CarbonColorer from './colorers/CarbonColorer';\r\n\r\nconst colorers = new EntityList([\r\n ElementColorer,\r\n ResidueTypeColorer,\r\n SequenceColorer,\r\n ChainColorer,\r\n SecondaryStructureColorer,\r\n UniformColorer,\r\n ConditionalColorer,\r\n ConformationColorer,\r\n TemperatureColorer,\r\n OccupancyColorer,\r\n HydrophobicityColorer,\r\n MoleculeColorer,\r\n CarbonColorer,\r\n]);\r\n\r\nexport default colorers;\r\n","import * as THREE from 'three';\r\nimport EntityList from '../utils/EntityList';\r\n\r\nfunction neutralColor(intensity) {\r\n return new THREE.Color(intensity, intensity, intensity);\r\n}\r\n\r\nconst materialList = [\r\n {\r\n id: 'DF',\r\n name: 'Diffuse',\r\n shortName: 'Diffuse',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'SF',\r\n name: 'Soft Plastic',\r\n shortName: 'Soft',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.1),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'PL',\r\n name: 'Glossy Plastic',\r\n shortName: 'Glossy',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.28),\r\n shininess: 100,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'ME',\r\n name: 'Metal',\r\n shortName: 'Metal',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.55),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TR',\r\n name: 'Transparent',\r\n shortName: 'Transparent',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'GL',\r\n name: 'Glass',\r\n shortName: 'Glass',\r\n uberOptions: {\r\n diffuse: neutralColor(0.50),\r\n specular: neutralColor(0.65),\r\n shininess: 100,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'BA',\r\n name: 'Backdrop',\r\n shortName: 'Backdrop',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: false,\r\n depthWrite: false,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TN',\r\n name: 'Toon',\r\n shortName: 'Toon',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: true,\r\n },\r\n }, {\r\n id: 'FL',\r\n name: 'Flat',\r\n shortName: 'Flat',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 0,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n },\r\n },\r\n];\r\n\r\nconst materials = new EntityList(materialList);\r\n\r\nexport default materials;\r\n","/**\r\n * Utils functions which is worked with meshes\r\n *\r\n * functions for doing something with all/specified meshes\r\n * functions for traversihg tree and create auxiliary meshes for transparency/shadowmaps...\r\n * functions for calculating data connected with meshes\r\n */\r\nimport * as THREE from 'three';\r\nimport UberMaterial from './shaders/UberMaterial';\r\nimport gfxutils from './gfxutils';\r\n\r\nfunction _gatherObjects(root, meshTypes) {\r\n const meshes = [];\r\n root.traverse((object) => {\r\n for (let i = 0; i < meshTypes.length; i++) {\r\n if (object instanceof meshTypes[i]) {\r\n meshes[meshes.length] = object;\r\n break;\r\n }\r\n }\r\n });\r\n return meshes;\r\n}\r\n\r\n// new mesh with the same geometry and specified material values and layer\r\nfunction createDerivativeMesh(mesh, values, layer) {\r\n const material = mesh.material.createInstance();\r\n material.setValues(values);\r\n\r\n const newMesh = new mesh.constructor(mesh.geometry, material);\r\n newMesh.material.needsUpdate = true;\r\n newMesh.applyMatrix4(mesh.matrix);\r\n newMesh.layers.set(layer);\r\n return newMesh;\r\n}\r\n\r\nfunction traverseMeshes(root, meshTypes, func) {\r\n const meshes = _gatherObjects(root, meshTypes);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n if (!mesh.parent) {\r\n continue;\r\n }\r\n func(mesh);\r\n }\r\n}\r\n\r\nfunction applyTransformsToMeshes(root, mtc) {\r\n const mtcCount = mtc.length;\r\n if (mtcCount < 1) {\r\n return;\r\n }\r\n\r\n const meshTypes = [THREE.Mesh, THREE.LineSegments, THREE.Line];\r\n traverseMeshes(root, meshTypes, (mesh) => {\r\n mesh.applyMatrix4(mtc[0]);\r\n for (let j = 1; j < mtcCount; ++j) {\r\n const newMesh = new mesh.constructor(mesh.geometry, mesh.material);\r\n mesh.parent.add(newMesh);\r\n newMesh.applyMatrix4(mtc[j]);\r\n }\r\n });\r\n}\r\n\r\nconst processTransparentMaterial = (function () {\r\n const matValues = {\r\n prepassTransparancy: true,\r\n fakeOpacity: false,\r\n transparent: false,\r\n colorFromDepth: false,\r\n lights: false,\r\n shadowmap: false,\r\n fog: false,\r\n };\r\n\r\n return function (root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n mesh.material.setValues({ prepassTransparancy: false, fakeOpacity: false });\r\n mesh.material.needsUpdate = true;\r\n mesh.layers.set(gfxutils.LAYERS.TRANSPARENT);\r\n\r\n const prepassTranspMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.PREPASS_TRANSPARENT);\r\n mesh.parent.add(prepassTranspMesh);\r\n });\r\n };\r\n}());\r\n\r\nconst processColFromPosMaterial = (function () {\r\n const matValues = {\r\n colorFromPos: true,\r\n transparent: false,\r\n colorFromDepth: false,\r\n lights: false,\r\n shadowmap: false,\r\n fog: false,\r\n overrideColor: false,\r\n fogTransparent: false,\r\n attrColor: false,\r\n attrColor2: false,\r\n attrAlphaColor: false,\r\n fakeOpacity: false,\r\n };\r\n\r\n return function (root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n const colFromPosMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.COLOR_FROM_POSITION);\r\n mesh.parent.add(colFromPosMesh);\r\n });\r\n };\r\n}());\r\n\r\nconst createShadowmapMaterial = (function () {\r\n const matValues = {\r\n colorFromDepth: true,\r\n orthoCam: true,\r\n lights: false,\r\n shadowmap: false,\r\n fog: false,\r\n };\r\n\r\n return function (root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n if (!mesh.receiveShadow && mesh.material.shadowmap) { // remove shadow from non-receivers\r\n mesh.material.setValues({ shadowmap: false });\r\n }\r\n if (!mesh.material.lights) { // skip creating shadowmap meshes for materials without lighting\r\n return;\r\n }\r\n if (!mesh.castShadow) { // skip creating shadowmap meshes for non-casters\r\n return;\r\n }\r\n if (!gfxutils.belongToSelectLayers(mesh)) { // skip creating shadowmap meshes for selection layer\r\n return;\r\n }\r\n\r\n const shadowmapMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.SHADOWMAP);\r\n shadowmapMesh.isShadowmapMesh = true;\r\n mesh.parent.add(shadowmapMesh);\r\n });\r\n };\r\n}());\r\n\r\nfunction removeShadowmapMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n if (mesh.isShadowmapMesh) {\r\n mesh.parent.remove(mesh);\r\n }\r\n });\r\n}\r\n\r\nfunction forEachMeshInGroup(group, process) {\r\n function processObj(object) {\r\n if (object instanceof THREE.Mesh) {\r\n process(object);\r\n }\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n processObj(object.children[i]);\r\n }\r\n }\r\n processObj(group);\r\n}\r\n\r\nfunction _countMeshTriangles(mesh) {\r\n const geom = mesh.geometry;\r\n if (geom instanceof THREE.InstancedBufferGeometry) {\r\n const attribs = geom.attributes;\r\n for (const property in attribs) {\r\n if (attribs.hasOwnProperty(property) && attribs[property] instanceof THREE.InstancedBufferAttribute) {\r\n const currAttr = attribs[property];\r\n const indexSize = geom.index ? geom.index.array.length / 3 : 0;\r\n return indexSize * currAttr.array.length / currAttr.itemSize;\r\n }\r\n }\r\n return 0;\r\n }\r\n if (geom instanceof THREE.BufferGeometry) {\r\n return geom.index ? geom.index.array.length / 3 : 0;\r\n }\r\n return geom.faces ? geom.faces.length : 0;\r\n}\r\n\r\nfunction countTriangles(group) {\r\n let totalCount = 0;\r\n forEachMeshInGroup(group, (mesh) => {\r\n totalCount += _countMeshTriangles(mesh);\r\n });\r\n return totalCount;\r\n}\r\n\r\nexport default {\r\n applyTransformsToMeshes,\r\n processTransparentMaterial,\r\n processColFromPosMaterial,\r\n createShadowmapMaterial,\r\n removeShadowmapMaterial,\r\n forEachMeshInGroup,\r\n countTriangles,\r\n};\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport UberMaterial from './shaders/UberMaterial';\r\nimport gfxutils from './gfxutils';\r\nimport meshutils from './meshutils';\r\nimport settings from '../settings';\r\nimport materials from './materials';\r\nimport chem from '../chem';\r\n\r\nconst { selectors } = chem;\r\n\r\nclass Representation {\r\n constructor(index, mode, colorer, selector) {\r\n const startMaterialValues = {\r\n clipPlane: settings.now.draft.clipPlane,\r\n fogTransparent: settings.now.bg.transparent,\r\n shadowmap: settings.now.shadow.on,\r\n shadowmapType: settings.now.shadow.type,\r\n };\r\n this.index = index;\r\n this.mode = mode;\r\n this.colorer = colorer;\r\n this.selector = selector;\r\n this.selectorString = '';\r\n this.count = 0;\r\n this.material = new UberMaterial();\r\n this.material.setValues(startMaterialValues);\r\n this.material.setUberOptions({ fogAlpha: settings.now.fogAlpha });\r\n this.materialPreset = materials.first;\r\n this.needsRebuild = true;\r\n this.visible = true;\r\n\r\n // apply mode params & preset\r\n this.setMode(mode);\r\n }\r\n\r\n markAtoms(complex) {\r\n this.count = complex.markAtoms(this.selector, 1 << this.index);\r\n this.needsRebuild = true;\r\n return this.count;\r\n }\r\n\r\n unmarkAtoms(complex) {\r\n complex.clearAtomBits(1 << this.index);\r\n this.count = 0;\r\n }\r\n\r\n setMode(mode) {\r\n this.mode = mode;\r\n }\r\n\r\n setMaterialPreset(preset) {\r\n this.materialPreset = preset;\r\n this.material.setUberOptions(preset.uberOptions);\r\n this.material.setValues(preset.values);\r\n }\r\n\r\n reset() {\r\n this.geo = null;\r\n this.selectionGeo = null;\r\n }\r\n\r\n buildGeometry(complex) {\r\n this.reset();\r\n this.needsRebuild = false;\r\n\r\n if (settings.now.ao) {\r\n this.material.setValues({ normalsToGBuffer: settings.now.ao });\r\n }\r\n\r\n this.geo = this.mode.buildGeometry(complex, this.colorer, 1 << this.index, this.material);\r\n\r\n if (this.material.uberOptions.opacity < 0.99 && settings.now.transparency === 'prepass') {\r\n meshutils.processTransparentMaterial(this.geo, this.material);\r\n }\r\n this.geo.visible = this.visible;\r\n\r\n gfxutils.processObjRenderOrder(this.geo, this.materialPreset.id);\r\n meshutils.processColFromPosMaterial(this.geo, this.material);\r\n\r\n if (settings.now.shadow.on) {\r\n meshutils.createShadowmapMaterial(this.geo, this.material);\r\n }\r\n\r\n return this.geo;\r\n }\r\n\r\n buildSelectionGeometry(mask) {\r\n let sg = null;\r\n\r\n if (this.geo && ('getSubset' in this.geo)) {\r\n const meshes = this.geo.getSubset(mask);\r\n if (meshes && meshes.length > 0) {\r\n sg = new THREE.Group();\r\n sg.matrixAutoUpdate = false;\r\n sg.matrix = this.geo.matrix;\r\n\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n sg.add(m);\r\n }\r\n }\r\n }\r\n\r\n if (sg) {\r\n sg.visible = this.visible;\r\n }\r\n\r\n this.selectionGeo = sg;\r\n return this.selectionGeo;\r\n }\r\n\r\n /**\r\n * Create object that represents difference between current and another rep\r\n * anotherRep could be undefined. In this case everything is reported.\r\n */\r\n compare(repSettings) {\r\n const diff = {};\r\n\r\n const selStr = String(this.selector);\r\n if (!repSettings || selStr.valueOf() !== String(repSettings.selector).valueOf()) {\r\n diff.selector = selStr;\r\n }\r\n\r\n const modeDiff = this.mode.identify();\r\n if (!repSettings || Array.isArray(modeDiff) || modeDiff !== repSettings.mode) {\r\n diff.mode = modeDiff;\r\n }\r\n\r\n const colorerDiff = this.colorer.identify();\r\n if (!repSettings || Array.isArray(colorerDiff) || colorerDiff !== repSettings.colorer) {\r\n diff.colorer = colorerDiff;\r\n }\r\n\r\n if (!repSettings || this.materialPreset.id !== repSettings.material) {\r\n diff.material = this.materialPreset.id;\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n /**\r\n * Change representation. Write fields what was changed into new object, return it.\r\n */\r\n change(repSettings, complex, mode, color) {\r\n const diff = {};\r\n\r\n // modify selector\r\n if (repSettings.selector) {\r\n const newSelectorObject = selectors.parse(repSettings.selector).selector;\r\n const newSelector = String(newSelectorObject);\r\n if (this.selectorString !== newSelector) {\r\n diff.selector = newSelector;\r\n this.selectorString = newSelector;\r\n this.selector = newSelectorObject;\r\n this.markAtoms(complex);\r\n }\r\n }\r\n\r\n // modify mode\r\n if (repSettings.mode) {\r\n const newMode = repSettings.mode;\r\n if (!_.isEqual(this.mode.identify(), newMode)) {\r\n diff.mode = newMode;\r\n this.setMode(mode);\r\n }\r\n }\r\n\r\n // modify colorer\r\n if (repSettings.colorer) {\r\n const newColorer = repSettings.colorer;\r\n if (!_.isEqual(this.colorer.identify(), newColorer)) {\r\n diff.colorer = newColorer;\r\n this.colorer = color;\r\n }\r\n }\r\n\r\n // modify material\r\n if (repSettings.material) {\r\n const newMaterial = repSettings.material;\r\n if (!_.isEqual(this.materialPreset.id, newMaterial)) {\r\n diff.material = newMaterial;\r\n this.setMaterialPreset(materials.get(repSettings.material));\r\n }\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n show(visible) {\r\n this.visible = visible;\r\n if (this.geo) {\r\n this.geo.visible = visible;\r\n }\r\n if (this.selectionGeo) {\r\n this.selectionGeo.visible = visible;\r\n }\r\n }\r\n}\r\n\r\nexport default Representation;\r\n","import * as THREE from 'three';\r\nimport logger from './utils/logger';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport './gfx/modes';\r\n\r\nfunction _traverseComponentGroups(root, component, callback) {\r\n const { children } = root;\r\n if (!children) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n if (child._component === component) {\r\n callback(child);\r\n }\r\n if (child instanceof gfxutils.RCGroup) {\r\n _traverseComponentGroups(child, component, callback);\r\n }\r\n }\r\n}\r\n\r\nfunction ComplexEditor() {\r\n}\r\n\r\nclass ComplexComponentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n // init component matrices\r\n this._componentTransforms = [];\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n const component = complex._components[i];\r\n this._componentTransforms[component._index] = new THREE.Object3D();\r\n }\r\n\r\n this._inProgress = true;\r\n\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const complex = this._complexVisual.getComplex();\r\n\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n this._bakeComponentTransform(complex._components[i]);\r\n }\r\n\r\n complex.onAtomPositionChanged();\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n const visual = this._complexVisual;\r\n const component = visual.getSelectedComponent();\r\n\r\n if (component === null) {\r\n return res;\r\n }\r\n\r\n const selection = this._complexVisual.getSelectionGeo();\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n // find all geo nodes for this component\r\n _traverseComponentGroups(visual, component, (child) => {\r\n res.objects.push(child);\r\n });\r\n\r\n // find all selection nodes for this component\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component') && geo._component === component) {\r\n res.objects.push(geo);\r\n }\r\n }\r\n }\r\n\r\n // add dummy object that stores component transformation\r\n res.objects.push(this._componentTransforms[component._index]);\r\n\r\n const bbmin = new THREE.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n const bbmax = new THREE.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (j = 0; j < atoms.length; ++j) {\r\n if (atoms[j].mask & selectionMask) {\r\n bbmin.min(atoms[j].position);\r\n bbmax.max(atoms[j].position);\r\n }\r\n }\r\n });\r\n\r\n res.pivot.lerpVectors(bbmin, bbmax, 0.5);\r\n return res;\r\n }\r\n\r\n _bakeComponentTransform(component) {\r\n const t = this._componentTransforms[component._index];\r\n if (t && (!(t.position.x === 0 && t.position.y === 0 && t.position.z === 0)\r\n || !(t.quaternion.x === 0 && t.quaternion.y === 0 && t.quaternion.z === 0 && t.quaternion.w === 1))) {\r\n t.updateMatrix();\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (let j = 0; j < atoms.length; ++j) {\r\n atoms[j].position.applyMatrix4(t.matrix);\r\n }\r\n });\r\n }\r\n }\r\n\r\n _resetComponentTransform() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n for (i = 0; i < this._componentTransforms.length; ++i) {\r\n geo = this._componentTransforms[i];\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n\r\n // reset all geo nodes\r\n for (i = 0; i < visual.children.length; ++i) {\r\n reprNode = visual.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n // reset all selection nodes\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nclass ComplexFragmentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n const atoms = this._getSelectionBorderAtoms();\r\n if (atoms.length < 1 || atoms.length > 2) {\r\n logger.error('Can only edit fragments with one or two bound atoms.');\r\n return false;\r\n }\r\n\r\n this._fragmentBoundAtoms = atoms;\r\n\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n\r\n // hide selected fragment in main model\r\n visual.disableSubset(selectionMask, true);\r\n\r\n // hide selection geo in main model\r\n for (let k = 0; k < selection.children.length; ++k) {\r\n selection.children[k].visible = false;\r\n }\r\n\r\n // create visible fragment representation to rotate\r\n const pivotPos = atoms[0].position.clone();\r\n\r\n if (atoms.length === 2) {\r\n pivotPos.lerp(atoms[1].position, 0.5);\r\n }\r\n\r\n this._fragmentGeo = new THREE.Group();\r\n visual.add(this._fragmentGeo);\r\n this._fragmentGeo.position.copy(pivotPos);\r\n\r\n this._fragmentSelectionGeo = new THREE.Group();\r\n selection.add(this._fragmentSelectionGeo);\r\n this._fragmentSelectionGeo.position.copy(pivotPos);\r\n\r\n const offset = pivotPos.clone();\r\n offset.negate();\r\n\r\n for (let i = 0; i < visual.children.length; ++i) {\r\n const g = visual.children[i];\r\n if (!('getSubset' in g)) {\r\n continue;\r\n }\r\n\r\n const vg = new THREE.Group();\r\n this._fragmentGeo.add(vg);\r\n\r\n const sg = new THREE.Group();\r\n this._fragmentSelectionGeo.add(sg);\r\n\r\n const meshes = g.getSubset(selectionMask, true);\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n vg.add(m);\r\n m.position.copy(offset);\r\n }\r\n\r\n const smeshes = g.getSubset(selectionMask, true);\r\n for (let h = 0; h < smeshes.length; h++) {\r\n const sm = smeshes[h];\r\n sg.add(sm);\r\n sm.position.copy(offset);\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(this._fragmentSelectionGeo);\r\n\r\n this._inProgress = true;\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selectionBit = visual.getSelectionBit();\r\n\r\n const p = this._fragmentGeo.position;\r\n const m = this._fragmentGeo.matrix.clone();\r\n m.multiply(new THREE.Matrix4().makeTranslation(-p.x, -p.y, -p.z));\r\n\r\n this._bakeAtomTransform(m, 1 << selectionBit);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << selectionBit, true);\r\n\r\n visual.getComplex().onAtomPositionChanged();\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n this._fragmentGeo.parent.remove(this._fragmentGeo);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << visual.getSelectionBit(), true);\r\n\r\n // show selection geo in main model (+ remove fragment selection geo)\r\n for (let i = 0; i < selection.children.length; ++i) {\r\n const node = selection.children[i];\r\n if (node.visible) {\r\n selection.remove(node);\r\n } else {\r\n node.visible = true;\r\n }\r\n }\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n isFreeRotationAllowed() {\r\n return (this._fragmentBoundAtoms.length < 2);\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n res.objects.push(this._fragmentGeo, this._fragmentSelectionGeo);\r\n\r\n const boundAtoms = this._fragmentBoundAtoms;\r\n if (boundAtoms.length === 1) {\r\n if (boundAtoms[0].bonds.length === 1) {\r\n // single external bond allows rotation about bond axis\r\n const bond = boundAtoms[0].bonds[0];\r\n res.axis = new THREE.Vector3().subVectors(bond._right.position, bond._left.position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n } else if (boundAtoms.length === 2) {\r\n // two bound atoms allow rotation only about axis running through their centers\r\n res.axis = new THREE.Vector3().subVectors(boundAtoms[1].position, boundAtoms[0].position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _getSelectionBorderAtoms() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n const selectionMask = 1 << this._complexVisual.getSelectionBit();\r\n const atomHash = {};\r\n\r\n complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n atomHash[bond._left.index] = 1;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n atomHash[bond._right.index] = 1;\r\n }\r\n });\r\n\r\n const atoms = [];\r\n const keys = Object.keys(atomHash);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const idx = keys[i];\r\n atoms.push(complex._atoms[idx]);\r\n }\r\n\r\n return atoms;\r\n }\r\n\r\n _bakeAtomTransform(matrix, mask) {\r\n this._complexVisual.getComplex().forEachAtom((atom) => {\r\n if (atom.mask & mask) {\r\n atom.position.applyMatrix4(matrix);\r\n }\r\n });\r\n }\r\n}\r\n\r\nexport default {\r\n ComponentEditor: ComplexComponentEditor,\r\n FragmentEditor: ComplexFragmentEditor,\r\n};\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\nimport chem from './chem';\r\nimport settings from './settings';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport Visual from './Visual';\r\nimport ComplexVisualEdit from './ComplexVisualEdit';\r\nimport meshutils from './gfx/meshutils';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction lookupAndCreate(entityList, specs) {\r\n if (!Array.isArray(specs)) {\r\n specs = [specs];\r\n }\r\n const [id, opts] = specs;\r\n const Entity = entityList.get(id) || entityList.first;\r\n return new Entity(opts);\r\n}\r\n\r\nclass ComplexVisual extends Visual {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this._complex = dataSource;\r\n\r\n /** @type {Representation[]} */\r\n this._reprList = [];\r\n /** @type {?Representation} */\r\n this._repr = null;\r\n this._reprListChanged = true;\r\n\r\n this._selectionBit = 0;\r\n this._reprUsedBits = 0;\r\n this._selectionCount = 0;\r\n\r\n this._selectionGeometry = new THREE.Group();\r\n }\r\n\r\n getBoundaries() {\r\n return this._complex.getBoundaries();\r\n }\r\n\r\n release() {\r\n if (this._selectionGeometry.parent) {\r\n this._selectionGeometry.remove(this._selectionGeometry);\r\n }\r\n Visual.prototype.release.call(this);\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getSelectionCount() {\r\n return this._selectionCount;\r\n }\r\n\r\n getSelectionGeo() {\r\n return this._selectionGeometry;\r\n }\r\n\r\n getSelectionBit() {\r\n return this._selectionBit;\r\n }\r\n\r\n getEditor() {\r\n return this._editor;\r\n }\r\n\r\n resetReps(reps) {\r\n // Create all necessary representations\r\n if (this._complex) {\r\n this._complex.clearAtomBits(~0);\r\n }\r\n this._reprListChanged = true;\r\n this._reprUsedBits = 0;\r\n this._reprList.length = reps.length;\r\n for (let i = 0, n = reps.length; i < n; ++i) {\r\n const rep = reps[i];\r\n\r\n let selector;\r\n let selectorString;\r\n if (typeof rep.selector === 'string') {\r\n selectorString = rep.selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else if (typeof rep.selector === 'undefined') {\r\n selectorString = settings.now.presets.default[0].selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else {\r\n ({ selector } = rep);\r\n selectorString = selector.toString();\r\n }\r\n const mode = lookupAndCreate(modes, rep.mode);\r\n const colorer = lookupAndCreate(colorers, rep.colorer);\r\n const material = materials.get(rep.material) || materials.first;\r\n\r\n this._reprList[i] = new Representation(i, mode, colorer, selector);\r\n this._reprList[i].setMaterialPreset(material);\r\n this._reprList[i].selectorString = selectorString;\r\n\r\n if (this._complex) {\r\n this._complex.markAtoms(selector, 1 << i);\r\n }\r\n\r\n this._reprUsedBits |= 1 << i;\r\n }\r\n this._repr = reps.length > 0 ? this._reprList[0] : null;\r\n\r\n this._selectionBit = reps.length;\r\n this._reprUsedBits |= 1 << this._selectionBit; // selection uses one bit\r\n this._selectionCount = 0;\r\n\r\n if (this._complex) {\r\n this._complex.update();\r\n }\r\n }\r\n\r\n /**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\n repCount() {\r\n return this._reprList.length;\r\n }\r\n\r\n /**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\n repCurrent(index) {\r\n if (index >= 0 && index < this._reprList.length) {\r\n this._repr = this._reprList[index];\r\n } else {\r\n index = this._reprList.indexOf(this._repr);\r\n }\r\n return index;\r\n }\r\n\r\n /**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {Object} {desc, index, status} field desc contains rep description, index - index of correspondent rep,\r\n * status - one of three strings: 'created', 'changed', ''. 'created' means new rep was created during this function,\r\n * 'changed' - rep was changed during this function. '' - something else.\r\n */\r\n rep(index, rep) {\r\n // if index is missing then it is the current\r\n if (!rep && (index === undefined || index instanceof Object)) {\r\n rep = index;\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index > this._reprList.length) {\r\n logger.error(`Rep ${index} does not exist!`);\r\n return null;\r\n }\r\n\r\n // a special case of adding just after the end\r\n if (index === this._reprList.length) {\r\n const res = this.repAdd(rep);\r\n logger.warn(`Rep ${index} does not exist! New representation was created.`);\r\n return { desc: res.desc, index, status: 'created' };\r\n }\r\n\r\n // gather description\r\n const target = this._reprList[index];\r\n const desc = {\r\n selector: target.selectorString,\r\n mode: target.mode.identify(),\r\n colorer: target.colorer.identify(),\r\n material: target.materialPreset.id,\r\n };\r\n\r\n // modification is requested\r\n if (rep) {\r\n // modify\r\n const diff = target.change(\r\n rep,\r\n this._complex,\r\n lookupAndCreate(modes, rep.mode),\r\n lookupAndCreate(colorers, rep.colorer),\r\n );\r\n\r\n // something was changed\r\n if (!_.isEmpty(diff)) {\r\n target.needsRebuild = true;\r\n for (const key in diff) {\r\n if (diff.hasOwnProperty(key)) {\r\n desc[key] = diff[key];\r\n logger.debug(`rep[${index}].${key} changed to ${diff[key]}`);\r\n }\r\n }\r\n\r\n // safety trick: lower resolution for surface modes\r\n if (diff.mode && target.mode.isSurface\r\n && (settings.now.resolution === 'ultra' || settings.now.resolution === 'high')) {\r\n logger.report('Surface resolution was changed to \"medium\" to avoid hang-ups.');\r\n settings.set('resolution', 'medium');\r\n }\r\n return { desc, index, status: 'changed' };\r\n }\r\n }\r\n return { desc, index, status: '' };\r\n }\r\n\r\n /**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\n repGet(index) {\r\n // if index is missing then it is the current\r\n if (index === undefined || index instanceof Object) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return null;\r\n }\r\n\r\n return this._reprList[index];\r\n }\r\n\r\n _getFreeReprIdx() {\r\n let bits = this._reprUsedBits;\r\n for (let i = 0; i <= ComplexVisual.NUM_REPRESENTATION_BITS; ++i, bits >>= 1) {\r\n if ((bits & 1) === 0) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {Object} {desc, index} field desc contains added rep description, index - index of this rep.\r\n */\r\n repAdd(rep) {\r\n if (this._reprList.length >= ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n return null;\r\n }\r\n\r\n const newSelectionBit = this._getFreeReprIdx();\r\n if (newSelectionBit < 0) {\r\n return null; // no more slots for representations\r\n }\r\n\r\n const originalSelection = this.buildSelectorFromMask(1 << this._selectionBit);\r\n\r\n // Fill in default values\r\n const def = settings.now.presets.default[0];\r\n const desc = _.merge({\r\n selector: def.selector,\r\n mode: def.mode,\r\n colorer: def.colorer,\r\n material: def.material,\r\n }, rep);\r\n\r\n const selector = (typeof desc.selector === 'string') ? selectors.parse(desc.selector).selector : desc.selector;\r\n const target = new Representation(\r\n this._selectionBit,\r\n lookupAndCreate(modes, desc.mode),\r\n lookupAndCreate(colorers, desc.colorer),\r\n selector,\r\n );\r\n target.selectorString = selector.toString();\r\n target.setMaterialPreset(materials.get(desc.material));\r\n target.markAtoms(this._complex);\r\n this._reprList.push(target);\r\n\r\n // change selection bit\r\n this._selectionBit = newSelectionBit;\r\n this._reprUsedBits |= 1 << this._selectionBit;\r\n\r\n // restore selection using new selection bit\r\n this._complex.markAtoms(originalSelection, 1 << this._selectionBit);\r\n\r\n return { desc, index: this._reprList.length - 1 };\r\n }\r\n\r\n /**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\n repRemove(index) {\r\n if (index === undefined) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // catch out of bounds case\r\n let count = this._reprList.length;\r\n if (index < 0 || index >= count || count <= 1) { // do not allow to remove the single rep\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.unmarkAtoms(this._complex);\r\n this._reprUsedBits &= ~(1 << target.index);\r\n\r\n this._reprList.splice(index, 1);\r\n\r\n // update current rep\r\n if (target === this._repr) {\r\n --count;\r\n index = index < count ? index : count - 1;\r\n this._repr = this._reprList[index];\r\n }\r\n this._reprListChanged = true;\r\n }\r\n\r\n /**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\n repHide(index, hide) {\r\n if (hide === undefined) {\r\n hide = true;\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.show(!hide);\r\n }\r\n\r\n /**\r\n * Select atoms with selector\r\n * @param {Selector} selector - selector\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\n select(selector, append) {\r\n if (append) {\r\n this._selectionCount += this._complex.markAtomsAdditionally(selector, 1 << this._selectionBit);\r\n } else {\r\n this._selectionCount = this._complex.markAtoms(selector, 1 << this._selectionBit);\r\n }\r\n this._complex.updateStructuresMask();\r\n this.rebuildSelectionGeometry();\r\n }\r\n\r\n resetSelectionMask() {\r\n if (this._selectionCount !== 0) {\r\n this._selectionCount = 0;\r\n if (this._complex) {\r\n this._complex.clearAtomBits(1 << this._selectionBit);\r\n }\r\n }\r\n }\r\n\r\n updateSelectionMask(pickedObj) {\r\n const self = this;\r\n const { atom } = pickedObj;\r\n let { residue, chain, molecule } = pickedObj;\r\n const setMask = 1 << this._selectionBit;\r\n const clearMask = ~setMask;\r\n\r\n if (atom) {\r\n residue = atom.residue;\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (atom.mask & setMask) {\r\n atom.mask &= clearMask;\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n if (molecule) {\r\n molecule.mask &= clearMask;\r\n }\r\n this._selectionCount--;\r\n } else {\r\n atom.mask |= setMask;\r\n this._selectionCount++;\r\n\r\n // select residue if all atoms in it are selected\r\n residue.collectMask();\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (residue) {\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (residue._mask & setMask) {\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n residue.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n } else {\r\n residue._mask |= setMask;\r\n residue.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (chain || molecule) {\r\n const obj = chain || molecule;\r\n if (obj._mask & setMask) {\r\n obj._mask &= clearMask;\r\n obj.forEachResidue((r) => {\r\n if (r._mask & setMask) {\r\n r._mask &= clearMask;\r\n r.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n r._mask &= clearMask;\r\n }\r\n });\r\n } else {\r\n obj._mask |= setMask;\r\n obj.forEachResidue((r) => {\r\n if (!(r._mask & setMask)) {\r\n r._mask |= setMask;\r\n r.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n const otherObj = chain ? r.getMolecule() : r.getChain();\r\n if (otherObj) {\r\n otherObj.collectMask();\r\n }\r\n }\r\n });\r\n }\r\n } else {\r\n this.resetSelectionMask();\r\n }\r\n }\r\n\r\n expandSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms to add\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // select marked atoms\r\n const deselectionMask = ~tmpMask;\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask = (atom.mask & deselectionMask) | selectionMask;\r\n ++self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n shrinkSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms neighbouring to unselected ones\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // mark hanging atoms\r\n this._complex.forEachAtom((atom) => {\r\n if ((atom.mask & selectionMask) && (atom.bonds.length === 1)) {\r\n atom.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // deselect marked atoms\r\n const deselectionMask = ~(selectionMask | tmpMask);\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask &= deselectionMask;\r\n --self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n getSelectedComponent() {\r\n const selectionMask = 1 << this._selectionBit;\r\n\r\n let component = null;\r\n let multiple = false;\r\n\r\n // find which component is selected (exclusively)\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & selectionMask) {\r\n if (component === null) {\r\n component = atom.residue._component;\r\n } else if (component !== atom.residue._component) {\r\n multiple = true;\r\n }\r\n }\r\n });\r\n\r\n return multiple ? null : component;\r\n }\r\n\r\n getSelectionCenter(center, includesAtom, selRule) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._complex.forEachAtom((atom) => {\r\n if (includesAtom(atom, selRule)) {\r\n center.add(atom.position);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.applyMatrix4(this.matrix);\r\n return true;\r\n }\r\n\r\n needsRebuild() {\r\n if (this._reprListChanged) {\r\n return true;\r\n }\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n if (repr.needsRebuild) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Rebuild molecule geometry asynchronously.\r\n */\r\n rebuild() {\r\n const self = this;\r\n\r\n // Destroy current geometry\r\n gfxutils.clearTree(this);\r\n\r\n return new Promise(((resolve) => {\r\n // Nothing to do?\r\n const complex = self._complex;\r\n if (!complex) {\r\n resolve();\r\n return;\r\n }\r\n\r\n let errorOccured = false;\r\n setTimeout(() => {\r\n console.time('build');\r\n const reprList = self._reprList;\r\n const palette = palettes.get(settings.now.palette) || palettes.first;\r\n let hasGeometry = false;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n repr.colorer.palette = palette;\r\n\r\n if (repr.needsRebuild) {\r\n repr.reset();\r\n\r\n try {\r\n repr.buildGeometry(complex);\r\n } catch (e) {\r\n if (e instanceof utils.OutOfMemoryError) {\r\n repr.needsRebuild = false;\r\n repr.reset();\r\n logger.error(`Not enough memory to build geometry for representation ${repr.index + 1}`);\r\n errorOccured = true;\r\n } else {\r\n throw e;\r\n }\r\n }\r\n\r\n if (DEBUG && !errorOccured) {\r\n logger.debug(`Triangles count: ${meshutils.countTriangles(repr.geo)}`);\r\n }\r\n }\r\n\r\n hasGeometry = errorOccured || hasGeometry || gfxutils.groupHasGeometryToRender(repr.geo);\r\n\r\n if (repr.geo) {\r\n self.add(repr.geo);\r\n }\r\n }\r\n\r\n self._reprListChanged = false;\r\n\r\n console.timeEnd('build');\r\n resolve();\r\n }, 10);\r\n }));\r\n }\r\n\r\n setNeedsRebuild() {\r\n // invalidate all representations\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n reprList[i].needsRebuild = true;\r\n }\r\n }\r\n\r\n rebuildSelectionGeometry() {\r\n const mask = 1 << this._selectionBit;\r\n\r\n gfxutils.clearTree(this._selectionGeometry);\r\n\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const repr = this._reprList[i];\r\n const sg = repr.buildSelectionGeometry(mask);\r\n if (!sg) {\r\n continue;\r\n }\r\n\r\n this._selectionGeometry.add(sg);\r\n for (let j = 0; j < sg.children.length; j++) {\r\n const m = sg.children[j];\r\n\r\n // copy component transform (that's not applied yet)\r\n // TODO make this code obsolete, accessing editor is bad\r\n if (this._editor && this._editor._componentTransforms) {\r\n const t = this._editor._componentTransforms[m._component._index];\r\n if (t) {\r\n m.position.copy(t.position);\r\n m.quaternion.copy(t.quaternion);\r\n }\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(sg);\r\n }\r\n }\r\n\r\n _buildSelectorFromSortedLists(atoms, residues, chains) {\r\n const complex = this._complex;\r\n\r\n function optimizeList(list) {\r\n const result = [];\r\n let k = 0;\r\n let first = NaN;\r\n let last = NaN;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const value = list[i];\r\n if (value === last + 1) {\r\n last = value;\r\n } else {\r\n if (!Number.isNaN(first)) {\r\n result[k++] = new selectors.Range(first, last);\r\n }\r\n first = last = value;\r\n }\r\n }\r\n if (!Number.isNaN(first)) {\r\n result[k] = new selectors.Range(first, last);\r\n }\r\n return result;\r\n }\r\n\r\n let expression = null;\r\n if (chains.length === complex._chains.length) {\r\n expression = selectors.all();\r\n } else {\r\n let selector;\r\n if (chains.length > 0) {\r\n selector = selectors.chain(chains);\r\n expression = expression ? selectors.or(expression, selector) : selector;// NOSONAR\r\n }\r\n if (Object.keys(residues).length > 0) {\r\n for (const ch in residues) {\r\n if (residues.hasOwnProperty(ch)) {\r\n selector = selectors.and(\r\n selectors.chain(ch),\r\n selectors.residx(optimizeList(residues[ch])),\r\n );\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n }\r\n }\r\n if (atoms.length > 0) {\r\n selector = selectors.serial(optimizeList(atoms));\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n\r\n if (!expression) {\r\n expression = selectors.none();\r\n }\r\n }\r\n\r\n return expression;\r\n }\r\n\r\n buildSelectorFromMask(mask) {\r\n const complex = this._complex;\r\n const chains = [];\r\n const residues = {};\r\n const atoms = [];\r\n\r\n complex.forEachChain((chain) => {\r\n if (chain._mask & mask) {\r\n chains.push(chain._name);\r\n }\r\n });\r\n\r\n complex.forEachResidue((residue) => {\r\n if (residue._mask & mask && !(residue._chain._mask & mask)) {\r\n const c = residue._chain._name;\r\n if (!(c in residues)) {\r\n residues[c] = [residue._index];\r\n } else {\r\n residues[c].push(residue._index);\r\n }\r\n }\r\n });\r\n\r\n complex.forEachAtom((atom) => {\r\n if (atom.mask & mask && !(atom.residue._mask & mask)) {\r\n atoms.push(atom.serial);\r\n }\r\n });\r\n\r\n return this._buildSelectorFromSortedLists(atoms, residues, chains);\r\n }\r\n\r\n forSelectedResidues(process) {\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.forEachResidue((residue) => {\r\n if (residue._mask & selectionMask) {\r\n process(residue);\r\n }\r\n });\r\n }\r\n\r\n beginComponentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.ComponentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n beginFragmentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.FragmentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n // should only be called by editors\r\n finalizeEdit() {\r\n this._editor = null;\r\n }\r\n\r\n setMaterialValues(values, needTraverse = false, process = undefined) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setValues(values);\r\n if (needTraverse) {\r\n rep.geo.traverse((object) => {\r\n if (object instanceof THREE.Mesh) {\r\n object.material.setValues(values);\r\n\r\n if (process !== undefined) {\r\n process(object);\r\n }\r\n\r\n object.material.needsUpdate = true;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n setUberOptions(values) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setUberOptions(values);\r\n }\r\n }\r\n\r\n /**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\n within(selector, radius) {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return false;\r\n }\r\n\r\n // mark atoms of the group as selected\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.markAtoms(selector, selectionMask);\r\n\r\n // mark all atoms within distance as selected\r\n if (vw) {\r\n vw.forEachAtomWithinDistFromMasked(this._complex, selectionMask, Number(radius), (atom) => {\r\n atom.mask |= selectionMask;\r\n });\r\n }\r\n\r\n // update selection count\r\n this._selectionCount = this._complex.countAtomsByMask(selectionMask);\r\n\r\n // update secondary structure mask\r\n this._complex.updateStructuresMask();\r\n\r\n return this.buildSelectorFromMask(selectionMask);\r\n }\r\n}\r\n// 32 bits = 30 bits for reps + 1 for selection + 1 for selection expansion\r\nComplexVisual.NUM_REPRESENTATION_BITS = 30;\r\n\r\nexport default ComplexVisual;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexVolumeFaces from './VolumeFaces.vert';\r\nimport fragmentVolumeFaces from './VolumeFaces.frag';\r\nimport vertexVolume from './Volume.vert';\r\nimport fragmentVolume from './Volume.frag';\r\nimport vertexFarPlane from './VolumeFarPlane.vert';\r\nimport fragmentFarPlane from './VolumeFarPlane.frag';\r\nimport settings from '../../settings';\r\n\r\nconst volumeUniforms = THREE.UniformsUtils.merge([\r\n {\r\n volumeDim: { type: 'v3', value: new THREE.Vector3(512, 512, 512) },\r\n tileTex: { type: 't', value: null },\r\n tileTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n tileStride: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n\r\n boxAngles: { type: 'v3', value: new THREE.Vector3(1, 1, 1) },\r\n delta: { type: 'v3', value: new THREE.Vector3(0, 0, 0) },\r\n\r\n _isoLevel0: { type: 'v2', value: new THREE.Vector3(0.5, 0.75, 1.0) },\r\n _flipV: { type: 'f', value: 0.0 },\r\n _BFLeft: { type: 't', value: null },\r\n _BFRight: { type: 't', value: null },\r\n _FFLeft: { type: 't', value: null },\r\n _FFRight: { type: 't', value: null },\r\n _WFFLeft: { type: 't', value: null },\r\n _WFFRight: { type: 't', value: null },\r\n },\r\n]);\r\n\r\nfunction overrideUniforms(params, defUniforms) {\r\n const uniforms = THREE.UniformsUtils.clone(defUniforms);\r\n for (const p in params) {\r\n if (uniforms.hasOwnProperty(p)) {\r\n uniforms[p].value = params[p];\r\n }\r\n }\r\n return uniforms;\r\n}\r\n\r\nfunction facesPosMaterialParams(params, sideType) {\r\n return {\r\n uniforms: overrideUniforms(params, {}),\r\n vertexShader: vertexVolumeFaces,\r\n fragmentShader: fragmentVolumeFaces,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n side: sideType,\r\n };\r\n}\r\n\r\nclass BackFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const backFaceParams = facesPosMaterialParams(params, THREE.BackSide);\r\n super(backFaceParams);\r\n }\r\n}\r\n\r\nclass ShaderParams {\r\n constructor(params, uniforms, vertexShader, fragmentShader) {\r\n this.uniforms = overrideUniforms(params, uniforms);\r\n this.vertexShader = vertexShader;\r\n this.fragmentShader = fragmentShader;\r\n this.transparent = false;\r\n this.depthTest = false;\r\n this.depthWrite = false;\r\n this.side = THREE.FrontSide;\r\n }\r\n}\r\n\r\nclass BackFacePosMaterialFarPlane extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const matUniforms = THREE.UniformsUtils.merge([\r\n {\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n farZ: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n matWorld2Volume: { type: '4fv', value: new THREE.Matrix4() },\r\n },\r\n ]);\r\n\r\n const shaderParams = new ShaderParams(params, matUniforms, vertexFarPlane, fragmentFarPlane);\r\n super(shaderParams);\r\n }\r\n}\r\n\r\nclass FrontFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const frontFaceParams = facesPosMaterialParams(params, THREE.FrontSide);\r\n super(frontFaceParams);\r\n }\r\n}\r\n\r\nclass VolumeMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const shaderParams = new ShaderParams(params, volumeUniforms, vertexVolume, fragmentVolume);\r\n shaderParams.transparent = true;\r\n shaderParams.depthTest = true;\r\n\r\n super(shaderParams);\r\n this.updateDefines();\r\n }\r\n\r\n updateDefines() {\r\n this.defines = {\r\n ISO_MODE: settings.now.modes.VD.isoMode,\r\n STEPS_COUNT: settings.now.modes.VD.polyComplexity[settings.now.resolution] * 100,\r\n };\r\n this.needsUpdate = true;\r\n }\r\n}\r\n\r\nexport default {\r\n BackFacePosMaterial,\r\n BackFacePosMaterialFarPlane,\r\n FrontFacePosMaterial,\r\n VolumeMaterial,\r\n};\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport settings from '../settings';\r\n\r\nclass VolumeMesh extends THREE.Mesh {\r\n volumeInfo = {}; // data for noise filter\r\n\r\n constructor() {\r\n const geo = new THREE.BufferGeometry();\r\n super(geo);\r\n this.clipPlane = new THREE.Plane();\r\n const size = new THREE.Vector3(0.5, 0.5, 0.5);\r\n this.size = size;\r\n\r\n this.cullFlag = [\r\n true, true, true, true,\r\n true, true, true, true,\r\n false, false, false, false, false, false,\r\n ];\r\n\r\n this.faces = [\r\n { indices: [], norm: new THREE.Vector3(0, 0, -1) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 1) },\r\n { indices: [], norm: new THREE.Vector3(0, -1, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 1, 0) },\r\n { indices: [], norm: new THREE.Vector3(-1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 0) },\r\n ];\r\n\r\n this.vertices = [\r\n new THREE.Vector3(-size.x, -size.y, -size.z),\r\n new THREE.Vector3(-size.x, size.y, -size.z),\r\n new THREE.Vector3(size.x, -size.y, -size.z),\r\n new THREE.Vector3(size.x, size.y, -size.z),\r\n new THREE.Vector3(-size.x, -size.y, size.z),\r\n new THREE.Vector3(-size.x, size.y, size.z),\r\n new THREE.Vector3(size.x, -size.y, size.z),\r\n new THREE.Vector3(size.x, size.y, size.z),\r\n new THREE.Vector3(0.0, 0.0, 0.0), // Placeholder for section\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n ];\r\n\r\n geo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(this.vertices.length * 3), 3));\r\n\r\n this.name = 'VolumeMesh';\r\n }\r\n\r\n static _corners = [\r\n // x, y, z, edge1, edge2, edge3\r\n [-1, -1, -1, 0, 4, 8],\r\n [1, -1, -1, 0, 5, 9],\r\n [1, 1, -1, 1, 5, 10],\r\n [-1, 1, -1, 1, 4, 11],\r\n [-1, -1, 1, 2, 6, 8],\r\n [1, -1, 1, 2, 7, 9],\r\n [1, 1, 1, 3, 7, 10],\r\n [-1, 1, 1, 3, 6, 11],\r\n ];\r\n\r\n static _edges = [\r\n // corner1, corner2, center_x, center_y, center_z\r\n [0, 1, 0, -1, -1],\r\n [2, 3, 0, 1, -1],\r\n [4, 5, 0, -1, 1],\r\n [6, 7, 0, 1, 1],\r\n [0, 3, -1, 0, -1],\r\n [1, 2, 1, 0, -1],\r\n [4, 7, -1, 0, 1],\r\n [5, 6, 1, 0, 1],\r\n [0, 4, -1, -1, 0],\r\n [1, 5, 1, -1, 0],\r\n [2, 6, -1, 1, 0],\r\n [3, 7, 1, 1, 0],\r\n ];\r\n\r\n static _edgeIntersections = (function () {\r\n const edgeIntersections = [];\r\n for (let j = 0; j < 12; ++j) {\r\n edgeIntersections.push(new THREE.Vector3());\r\n }\r\n return edgeIntersections;\r\n }());\r\n\r\n _updateVertices() {\r\n // Algorithm:\r\n // 1. Get plane parameters\r\n // 2. Compute culling flags for all vertices\r\n // 3. If intersection occurs => compute from 3 to 6 intersection points\r\n const corners = VolumeMesh._corners;\r\n const edges = VolumeMesh._edges;\r\n const edgeIntersections = VolumeMesh._edgeIntersections;\r\n\r\n let i;\r\n\r\n const norm = this.clipPlane.normal;\r\n const D = this.clipPlane.constant;\r\n\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n const cornerMark = [0, 0, 0, 0, 0, 0, 0, 0];\r\n const edgeMark = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];\r\n\r\n const curEdge = new THREE.Vector3();\r\n let curEdgeInter = null;\r\n\r\n function CheckX() {\r\n if (norm.x === 0) return 0;\r\n const x = -(norm.dot(curEdge) + D) / norm.x;\r\n if (-size.x <= x && x <= size.x) {\r\n curEdgeInter.set(x, curEdge.y, curEdge.z);\r\n if (x === size.x) return 2;\r\n if (x === -size.x) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckY() {\r\n if (norm.y === 0) return 0;\r\n const y = -(norm.dot(curEdge) + D) / norm.y;\r\n if (-size.y <= y && y <= size.y) {\r\n curEdgeInter.set(curEdge.x, y, curEdge.z);\r\n if (y === size.y) return 2;\r\n if (y === -size.y) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckZ() {\r\n if (norm.z === 0) return 0;\r\n const z = -(norm.dot(curEdge) + D) / norm.z;\r\n if (-size.z <= z && z <= size.z) {\r\n curEdgeInter.set(curEdge.x, curEdge.y, z);\r\n if (z === size.z) return 2;\r\n if (z === -size.z) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n // for each edge\r\n for (let curEdgeIdx = 0; curEdgeIdx < 12; ++curEdgeIdx) {\r\n const curEdgeSource = edges[curEdgeIdx];\r\n curEdgeInter = edgeIntersections[curEdgeIdx];\r\n\r\n curEdge.set(curEdgeSource[2], curEdgeSource[3], curEdgeSource[4]);\r\n curEdge.multiply(size);\r\n\r\n // calculate intersection point\r\n let flag = 0;\r\n if (curEdgeSource[2] === 0) flag = CheckX();\r\n if (curEdgeSource[3] === 0) flag = CheckY();\r\n if (curEdgeSource[4] === 0) flag = CheckZ();\r\n\r\n // mark corresponding corner (if plane cuts through one)\r\n if (flag === -2) {\r\n cornerMark[curEdgeSource[0]] = 1;\r\n } else if (flag === 2) {\r\n cornerMark[curEdgeSource[1]] = 1;\r\n } else if (flag === 0) {\r\n // edge is not intersected by the plane (doesn't produce a vertex)\r\n edgeMark[curEdgeIdx] = 0;\r\n }\r\n }\r\n\r\n const face = {\r\n indices: [],\r\n norm: norm.clone().negate(),\r\n };\r\n\r\n let nextVertex = 8;\r\n\r\n // for each marked corner\r\n for (i = 0; i < 8; ++i) {\r\n if (cornerMark[i] === 1) {\r\n // add corner as vertex to the face\r\n vert[nextVertex].set(corners[i][0], corners[i][1], corners[i][2]).multiply(size);\r\n face.indices.push(nextVertex++);\r\n // skip adjacent edges\r\n edgeMark[corners[i][3]] = 0;\r\n edgeMark[corners[i][4]] = 0;\r\n edgeMark[corners[i][5]] = 0;\r\n }\r\n }\r\n\r\n // for each edge that has internal intersection\r\n for (i = 0; i < 12; ++i) {\r\n if (edgeMark[i] === 1) {\r\n // add intersection point as vertex to the face\r\n vert[nextVertex].copy(edgeIntersections[i]);\r\n face.indices.push(nextVertex++);\r\n }\r\n }\r\n\r\n this.faces[6] = face;\r\n\r\n const diff = new THREE.Vector3();\r\n const coplanarPoint = new THREE.Vector3();\r\n this.clipPlane.coplanarPoint(coplanarPoint);\r\n for (i = 0; i < vert.length; ++i) {\r\n this.cullFlag[i] = false;\r\n if (i < 8) {\r\n // corners should be culled by clipping plane\r\n diff.subVectors(vert[i], coplanarPoint);\r\n this.cullFlag[i] = (norm.dot(diff) >= 0.0);\r\n } else if (i < 8 + face.indices.length) {\r\n // cross section vertices don't get culled\r\n this.cullFlag[i] = true;\r\n }\r\n }\r\n\r\n // write data to vertex buffer\r\n const positions = this.geometry.getAttribute('position');\r\n let idx = 0;\r\n for (i = 0; i < vert.length; ++i) {\r\n positions.array[idx++] = vert[i].x;\r\n positions.array[idx++] = vert[i].y;\r\n positions.array[idx++] = vert[i].z;\r\n }\r\n positions.needsUpdate = true;\r\n }\r\n\r\n _collectVertices(face, filter) {\r\n let i;\r\n const vert = this.vertices;\r\n face.indices = [];\r\n for (i = 0; i < vert.length; ++i) {\r\n if (this.cullFlag[i] && filter(vert[i])) {\r\n face.indices.push(i);\r\n }\r\n }\r\n }\r\n\r\n _sortIndices(face, right) {\r\n let i;\r\n let j;\r\n const vert = this.vertices;\r\n const angle = [];\r\n\r\n const dir = new THREE.Vector3();\r\n for (i = 1; i < face.indices.length; ++i) {\r\n dir.subVectors(vert[face.indices[i]], vert[face.indices[0]]);\r\n dir.normalize();\r\n dir.cross(right);\r\n dir.negate();\r\n angle[i] = face.norm.dot(dir);\r\n }\r\n\r\n // Exchange sort\r\n for (i = 1; i < face.indices.length - 1; ++i) {\r\n for (j = i + 1; j < face.indices.length; ++j) {\r\n if (angle[j] < angle[i]) {\r\n // swap\r\n let t = angle[i];\r\n angle[i] = angle[j];\r\n angle[j] = t;\r\n\r\n t = face.indices[i];\r\n face.indices[i] = face.indices[j];\r\n face.indices[j] = t;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _updateIndices() {\r\n // Algorithm:\r\n // 1. Get plane vertices (from 3 to 6 vertices)\r\n // 2. Get \"right\" vector in plane\r\n // 3. Sort vertices using Graham-like method\r\n // 4. Create indices\r\n\r\n let i;\r\n let faceIdx;\r\n let face;\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n this._collectVertices(this.faces[0], (vertex) => vertex.z === -size.z);\r\n this._collectVertices(this.faces[1], (vertex) => vertex.z === size.z);\r\n this._collectVertices(this.faces[2], (vertex) => vertex.y === -size.y);\r\n this._collectVertices(this.faces[3], (vertex) => vertex.y === size.y);\r\n this._collectVertices(this.faces[4], (vertex) => vertex.x === -size.x);\r\n this._collectVertices(this.faces[5], (vertex) => vertex.x === size.x);\r\n\r\n const vCenter = new THREE.Vector3();\r\n const vRight = new THREE.Vector3();\r\n const vDir = new THREE.Vector3();\r\n\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n\r\n if (face.indices.length === 0) continue;\r\n\r\n vCenter.set(0, 0, 0);\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vCenter.add(vert[face.indices[i]]);\r\n }\r\n vCenter.multiplyScalar(1.0 / face.indices.length);\r\n vRight.subVectors(vert[face.indices[0]], vCenter);\r\n vRight.normalize();\r\n\r\n const rightProj = [];\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vDir.subVectors(vert[face.indices[i]], vCenter);\r\n rightProj[i] = vDir.dot(vRight);\r\n }\r\n for (i = 1; i < face.indices.length; ++i) {\r\n if (rightProj[i] < rightProj[0]) {\r\n // swap\r\n let t = rightProj[0];\r\n rightProj[0] = rightProj[i];\r\n rightProj[i] = t;\r\n\r\n [t] = face.indices;\r\n face.indices[0] = face.indices[i];\r\n face.indices[i] = t;\r\n }\r\n }\r\n\r\n this._sortIndices(face, vRight);\r\n }\r\n\r\n let numIndices = 0;\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n if (face.indices.length >= 3) {\r\n numIndices += 3 * (face.indices.length - 2);\r\n }\r\n }\r\n let offset = 0;\r\n const indices = new Uint16Array(numIndices);\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n for (i = 0; i < face.indices.length - 2; ++i) {\r\n indices[offset] = face.indices[0]; // eslint-disable-line prefer-destructuring\r\n indices[offset + 1] = face.indices[i + 1];\r\n indices[offset + 2] = face.indices[i + 2];\r\n offset += 3;\r\n }\r\n }\r\n\r\n this.geometry.setIndex(new THREE.BufferAttribute(indices, 1));\r\n }\r\n\r\n setDataSource(dataSource) {\r\n const vm = new VolumeMaterial.VolumeMaterial();\r\n const dim = dataSource.getDimensions();\r\n const stride = dataSource.getTiledTextureStride();\r\n const texture = dataSource.buildTiledTexture();\r\n const bbox = dataSource.getBox();\r\n vm.uniforms.volumeDim.value.set(dim[0], dim[1], dim[2]);\r\n vm.uniforms.tileTex.value = texture;\r\n vm.uniforms.tileTexSize.value.set(texture.image.width, texture.image.height);\r\n vm.uniforms.tileStride.value.set(stride[0], stride[1]);\r\n Object.assign(this.volumeInfo, dataSource.getVolumeInfo());\r\n\r\n const volInfo = this.volumeInfo;\r\n vm.uniforms.delta.value.copy(volInfo.delta);\r\n vm.uniforms.boxAngles.value.set(volInfo.obtuseAngle[0], volInfo.obtuseAngle[1], volInfo.obtuseAngle[2]);\r\n\r\n this.material = vm;\r\n\r\n bbox.getSize(this.scale);\r\n bbox.getCenter(this.position);\r\n }\r\n\r\n _updateIsoLevel() {\r\n const { kSigma, kSigmaMed, kSigmaMax } = settings.now.modes.VD;\r\n const volInfo = this.volumeInfo;\r\n const mean = volInfo.dmean - volInfo.dmin;\r\n const span = volInfo.dmax - volInfo.dmin;\r\n const level = (k) => (mean + k * volInfo.sd) / span;\r\n this.material.uniforms._isoLevel0.value.set(level(kSigma), level(kSigmaMed), level(kSigmaMax));\r\n }\r\n\r\n static _nearClipPlaneOffset = 0.2;\r\n\r\n static _pos = new THREE.Vector3();\r\n\r\n static _norm = new THREE.Vector3();\r\n\r\n static _norm4D = new THREE.Vector4();\r\n\r\n static _matrixWorldToLocal = new THREE.Matrix4();\r\n\r\n static _clipPlane = new THREE.Plane();\r\n\r\n rebuild(camera) {\r\n const nearClipPlaneOffset = VolumeMesh._nearClipPlaneOffset;\r\n const pos = VolumeMesh._pos;\r\n const norm = VolumeMesh._norm;\r\n const norm4D = VolumeMesh._norm4D;\r\n const matrixWorldToLocal = VolumeMesh._matrixWorldToLocal;\r\n const clipPlane = VolumeMesh._clipPlane;\r\n\r\n this._updateIsoLevel();\r\n\r\n // get clip plane in local space\r\n camera.getWorldDirection(norm);\r\n camera.getWorldPosition(pos);\r\n pos.addScaledVector(norm, camera.near + nearClipPlaneOffset);\r\n\r\n // transform pos to local CS\r\n matrixWorldToLocal.copy(this.matrixWorld).invert();\r\n pos.applyMatrix4(matrixWorldToLocal);\r\n\r\n // transform norm to local CS\r\n norm4D.set(norm.x, norm.y, norm.z, 0.0); // NOTE: use homogeneous norm for proper transformation\r\n norm4D.applyMatrix4(matrixWorldToLocal);\r\n norm.copy(norm4D);\r\n norm.normalize();\r\n\r\n clipPlane.setFromNormalAndCoplanarPoint(norm, pos);\r\n\r\n if (!this.clipPlane.equals(clipPlane)) {\r\n this.clipPlane = clipPlane.clone();\r\n this._updateVertices();\r\n this._updateIndices();\r\n }\r\n }\r\n}\r\n\r\nexport default VolumeMesh;\r\n","import * as THREE from 'three';\r\nimport gfxutils from './gfxutils';\r\n\r\nfunction _flattenArray(input) {\r\n const n = input.length;\r\n const output = new Float32Array(n * 3);\r\n for (let i = 0; i < n; ++i) {\r\n const j = 3 * i;\r\n const v = input[i];\r\n output[j] = v.x;\r\n output[j + 1] = v.y;\r\n output[j + 2] = v.z;\r\n }\r\n return output;\r\n}\r\n\r\nclass VolumeBounds {\r\n static _projectionTable = { // corresponds between (origin axes and angles between them) and between saving vector coordinates\r\n XY: ['x', 2],\r\n XZ: ['y', 1],\r\n YZ: ['z', 0],\r\n };\r\n\r\n constructor(bBox, volInfo) {\r\n const { delta } = volInfo; // {x: XY, y : XZ, z: YZ}\r\n const { obtuseAngle } = volInfo; // 1 - obtuse, 0 - acute\r\n\r\n const bSize = new THREE.Vector3();\r\n bBox.getSize(bSize);\r\n bSize.multiplyScalar(0.5);\r\n\r\n const offsetVert = this._getBaseVertices(delta, obtuseAngle);\r\n\r\n const geometry = new THREE.BufferGeometry();\r\n const vertices = [];\r\n\r\n for (let i = 0; i < 4; i++) {\r\n vertices.push(offsetVert[i].clone().multiply(bSize));\r\n vertices.push(offsetVert[(i + 1) % 4].clone().multiply(bSize));\r\n }\r\n const translation = new THREE.Vector3(2 * bSize.x * (1 - delta.x - delta.y), 0, 0);\r\n for (let i = 0; i < 8; i++) {\r\n vertices.push(vertices[i].clone().add(translation));\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n vertices.push(vertices[i * 2].clone());\r\n vertices.push(vertices[i * 2 + 8].clone());\r\n }\r\n const center = new THREE.Vector3();\r\n bBox.getCenter(center);\r\n vertices.forEach((vertex) => vertex.add(center)); // pivot shift\r\n\r\n const flatVertices = _flattenArray(vertices);\r\n geometry.setAttribute('position', new THREE.BufferAttribute(flatVertices, 3));\r\n\r\n this._lines = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ color: 0xFFFFFF }));\r\n this._lines.layers.set(gfxutils.LAYERS.VOLUME);\r\n }\r\n\r\n // Set one edge (4 points) of frame, from which with parallel transfer the rest of the frame points can be obtained\r\n _getBaseVertices(delta, obtuseAngle) {\r\n const projTable = VolumeBounds._projectionTable;\r\n\r\n const proj = ((index, inv) => { // tricky function to take account of projections: their position(related to box) and sign\r\n const currDelta = delta[projTable[index][0]];\r\n const angleValue = -0.5 * (inv - 1) + inv * obtuseAngle[projTable[index][1]];// inv = 1: alpha; inv = -1: 1 - alpha\r\n return angleValue * currDelta;\r\n });\r\n\r\n const offsetVert = [\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', 1)), -1 + 2 * proj('YZ', 1), -1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', 1)), -1 + 2 * proj('YZ', -1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', -1)), 1 - 2 * proj('YZ', 1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', -1)), 1 - 2 * proj('YZ', -1), -1),\r\n ];\r\n\r\n return offsetVert;\r\n }\r\n\r\n getMesh() {\r\n return this._lines;\r\n }\r\n}\r\n\r\nexport default VolumeBounds;\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport meshes from './meshes/meshes';\r\nimport gfxutils from './gfxutils';\r\n\r\n// Thes geometric far plane is required for correct filling in the BFTexture in case, when far plane cuts the volume\r\n// cube. In cut place of cube there is no correct data in BFTexture and volume rendering integral is calculated\r\n// with errors.\r\n// Far plane cuts the cube in case of large volume scale (zoom), because farplane doesn't change\r\nclass VolumeFarPlane {\r\n // create plane with unit corners coords (for future rescale in vshader according to camera properties)\r\n constructor(volume, width, height) {\r\n const planeGeo = this._initPlaneGeo(width, height);\r\n\r\n const mat = new VolumeMaterial.BackFacePosMaterialFarPlane();\r\n this._plane = new meshes.Mesh(planeGeo, mat);\r\n this._plane.frustumCulled = false;\r\n this._plane.doubleSided = true;\r\n const matWorldToVolume = new THREE.Matrix4();\r\n\r\n this._plane._onBeforeRender = function (_renderer, _scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!volume || !material) {\r\n return;\r\n }\r\n\r\n // count point in world at farplane place\r\n const planeCamPos = new THREE.Vector4(0, 0, -(camera.far - 0.1), 1);\r\n planeCamPos.applyMatrix4(camera.matrixWorld);\r\n\r\n // recalc matrices to make plane be placed as farplane in the World relative to camera\r\n this.matrix.identity();\r\n this.matrix.makeTranslation(planeCamPos.x, planeCamPos.y, planeCamPos.z);\r\n this.matrixWorld.copy(this.matrix);\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n this.normalMatrix.getNormalMatrix(this.modelViewMatrix);\r\n\r\n // build worldToVolume matrix to transform plane into volumeCS (volumeCS coords are written to BackFaceTexture)\r\n const volumeMatrix = volume.matrixWorld;\r\n matWorldToVolume.copy(volumeMatrix).invert();\r\n\r\n // update material props\r\n material.uniforms.aspectRatio.value = camera.aspect;\r\n material.uniforms.farZ.value = camera.far;\r\n material.uniforms.tanHalfFOV.value = Math.tan(THREE.MathUtils.DEG2RAD * 0.5 * camera.fov);\r\n material.uniforms.matWorld2Volume.value = matWorldToVolume;\r\n };\r\n\r\n // set it to special layer to draw only into BFTexture\r\n this._plane.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n }\r\n\r\n _initPlaneGeo(width, height) {\r\n const planeGeo = new THREE.BufferGeometry();\r\n\r\n width = width || 1;\r\n height = height || 1;\r\n\r\n const vertices = new Float32Array([\r\n -0.5 * width, 0.5 * height, 0,\r\n 0.5 * width, 0.5 * height, 0,\r\n -0.5 * width, -0.5 * height, 0,\r\n 0.5 * width, -0.5 * height, 0,\r\n ]);\r\n\r\n planeGeo.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\r\n planeGeo.setIndex([0, 2, 1, 2, 3, 1]);\r\n\r\n return planeGeo;\r\n }\r\n\r\n getMesh() {\r\n return this._plane;\r\n }\r\n}\r\n\r\nexport default VolumeFarPlane;\r\n","import * as THREE from 'three';\r\nimport VolumeMesh from './gfx/VolumeMesh';\r\nimport VolumeBounds from './gfx/VolumeBounds';\r\nimport VolumeFarPlane from './gfx/VolumeFarPlane';\r\nimport Visual from './Visual';\r\nimport settings from './settings';\r\n\r\nclass VolumeVisual extends Visual {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this._mesh = new VolumeMesh();\r\n this._mesh.setDataSource(dataSource);\r\n this.add(this._mesh);\r\n\r\n this._frame = new VolumeBounds(this.getBoundaries().boundingBox, this._mesh.volumeInfo);\r\n this.add(this._frame.getMesh());\r\n this.showFrame(settings.now.modes.VD.frame);\r\n\r\n this._farPlane = new VolumeFarPlane(this._mesh, 2, 2);\r\n this.add(this._farPlane.getMesh());\r\n }\r\n\r\n getBoundaries() {\r\n const box = this._dataSource.getBox();\r\n const sphere = new THREE.Sphere();\r\n box.getBoundingSphere(sphere);\r\n\r\n return {\r\n boundingBox: box,\r\n boundingSphere: sphere,\r\n };\r\n }\r\n\r\n getMesh() {\r\n return this._mesh;\r\n }\r\n\r\n showFrame(needShow) {\r\n this._frame.getMesh().material.visible = needShow;\r\n }\r\n}\r\n\r\nexport default VolumeVisual;\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available loaders.\r\n * @extends EntityList\r\n */\r\nclass LoaderList extends EntityList {\r\n /**\r\n * Create a list of loaders.\r\n * The loaders are indexed by supported source types (`.types` property of a Loader\r\n * subclass).\r\n * The loaders can be retrieved later by matching against specs (see {@link LoaderList#find}).\r\n *\r\n * @param {!Array=} someLoaders A list of {@link Loader} subclasses to\r\n * automatically register at creation time.\r\n * @see LoaderList#register\r\n */\r\n constructor(someLoaders = []) {\r\n super(someLoaders, ['types']);\r\n }\r\n\r\n /**\r\n * Find a suitable loader for a source type.\r\n *\r\n * @param {Object} specs Loader specifications.\r\n * @param {string=} specs.type Supported source type.\r\n * @param {*=} specs.source Source to load from.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.type) {\r\n list = this._dict.types[specs.type.toLowerCase()] || [];\r\n } else if (specs.source) {\r\n return this._list.filter((SomeLoader) => SomeLoader.canProbablyLoad && SomeLoader.canProbablyLoad(specs.source));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default LoaderList;\r\n","import EventDispatcher from '../../utils/EventDispatcher';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Loader extends EventDispatcher {\r\n constructor(source, options) {\r\n super();\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n this._agent = null;\r\n }\r\n\r\n load() {\r\n return Promise.reject(new Error('Loading from this source is not implemented'));\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n if (this._agent) {\r\n this._agent.abort();\r\n }\r\n }\r\n\r\n static extractName(_source) {\r\n return undefined;\r\n }\r\n}\r\n\r\nmakeContextDependent(Loader.prototype);\r\n","import Loader from './Loader';\r\n\r\nexport default class FileLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = options.binary === true;\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const blob = this._source;\r\n const reader = this._agent = new FileReader();\r\n\r\n reader.addEventListener('load', () => {\r\n resolve(reader.result);\r\n });\r\n reader.addEventListener('error', () => {\r\n reject(reader.error);\r\n });\r\n reader.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n reader.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n if (this._binary) {\r\n reader.readAsArrayBuffer(blob);\r\n } else {\r\n reader.readAsText(blob);\r\n }\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return (File && source instanceof File) || (Blob && source instanceof Blob);\r\n }\r\n\r\n static extractName(source) {\r\n return source && source.name;\r\n }\r\n}\r\n\r\nFileLoader.types = ['file', 'blob'];\r\n","import _ from 'lodash';\r\nimport Loader from './Loader';\r\n\r\n// we don't need to detect all kinds of URLs, just the evident ones\r\nconst urlStartRegexp = /^(https?|ftp):\\/\\//i;\r\n\r\nexport default class XHRLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = (options.binary === true);\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const url = this._source;\r\n const request = this._agent = new XMLHttpRequest();\r\n\r\n request.addEventListener('load', () => {\r\n if (request.status === 200) {\r\n resolve(request.response);\r\n } else {\r\n reject(new Error(`HTTP ${request.status} while fetching ${url}`));\r\n }\r\n });\r\n request.addEventListener('error', () => {\r\n reject(new Error('HTTP request failed'));\r\n });\r\n request.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n request.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n request.open('GET', url);\r\n if (this._binary) {\r\n request.responseType = 'arraybuffer';\r\n } else {\r\n request.responseType = 'text';\r\n }\r\n request.send();\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return _.isString(source) && urlStartRegexp.test(source);\r\n }\r\n\r\n static extractName(source) {\r\n if (source) {\r\n const last = (source.indexOf('?') + 1 || source.lastIndexOf('#') + 1 || source.length + 1) - 1;\r\n return source.slice(source.lastIndexOf('/', last) + 1, last);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nXHRLoader.types = ['url'];\r\n","import Loader from './Loader';\r\n\r\nexport default class ImmediateLoader extends Loader {\r\n load() {\r\n return new Promise((resolve) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n resolve(this._source);\r\n });\r\n }\r\n\r\n static canProbablyLoad(_source) {\r\n return false;\r\n }\r\n}\r\n\r\nImmediateLoader.types = ['immediate'];\r\n","import LoaderList from './loaders/LoaderList';\r\n\r\nimport FileLoader from './loaders/FileLoader';\r\nimport XHRLoader from './loaders/XHRLoader';\r\nimport ImmediateLoader from './loaders/ImmediateLoader';\r\n\r\nexport default new LoaderList([\r\n // note: order might be important\r\n FileLoader,\r\n XHRLoader,\r\n ImmediateLoader,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available parsers.\r\n * @extends EntityList\r\n */\r\nclass ParserList extends EntityList {\r\n /**\r\n * Create a list of parsers.\r\n * The parsers are indexed by supported data formats and file extensions (`.formats` and\r\n * `.extensions` properties of a Parser subclass).\r\n * The parsers can be retrieved later by matching against specs (see {@link ParsrerList#find}).\r\n *\r\n * @param {!Array=} someParsers A list of {@link Parser} subclasses to\r\n * automatically register at creation time.\r\n * @see ParserList#register\r\n */\r\n constructor(someParsers = []) {\r\n super(someParsers, ['formats', 'extensions']);\r\n }\r\n\r\n /**\r\n * Find a suitable parser for data.\r\n *\r\n * @param {Object} specs Parser specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {string=} specs.ext Supported filename extension.\r\n * @param {*=} specs.data Data to parse.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n } else if (specs.ext) {\r\n list = this._dict.extensions[specs.ext.toLowerCase()] || [];\r\n }\r\n // autodetect only if no format is forced\r\n if (list.length === 0 && !specs.format && specs.data) {\r\n return this._list.filter((SomeParser) => SomeParser.canProbablyParse && SomeParser.canProbablyParse(specs.data));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ParserList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Parser {\r\n constructor(data, options) {\r\n this._data = data;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n parseSync() {\r\n throw new Error('Parsing this type of data is not implemented');\r\n }\r\n\r\n parse() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Parsing aborted'));\r\n }\r\n return resolve(this.parseSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n // only for volume Parsers\r\n getModel() {\r\n this.model._parseHeader(this._data);\r\n return this.model;\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Parser.prototype);\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 290\".\r\n *\r\n * @exports Remark290\r\n * @constructor\r\n */\r\nclass Remark290 {\r\n constructor() {\r\n /** @type {THREE.Matrix4[]} */\r\n this.matrices = [];\r\n\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (stream.readString(12, 18) === ' SMTRY') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === this.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n }\r\n }\r\n}\r\n\r\nRemark290.prototype.id = 290;\r\n\r\nexport default Remark290;\r\n","import * as THREE from 'three';\r\nimport chem from '../../../chem';\r\n\r\nconst { Assembly } = chem;\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 350\".\r\n *\r\n * @exports Remark350\r\n * @constructor\r\n */\r\nclass Remark350 {\r\n constructor(complex) {\r\n /** @type {Complex} */\r\n this._complex = complex;\r\n /** @type {Assembly[]} */\r\n this.assemblies = [];\r\n\r\n /** @type {?Assembly} */\r\n this._assembly = null;\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?Assembly} */\r\n let assembly = this._assembly;\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (assembly && stream.readString(12, 18) === ' BIOMT') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === assembly.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n } else if (assembly && stream.readString(35, 41) === 'CHAINS:') {\r\n const entries = stream.readString(42, 80).split(',');\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const chain = entries[i].trim();\r\n if (chain.length > 0) {\r\n assembly.addChain(chain);\r\n }\r\n }\r\n } else if (stream.readString(12, 23) === 'BIOMOLECULE:') {\r\n // assert molIndex === this.assemblies.length + 1\r\n this._matrix = null;\r\n this._matrixIndex = -1;\r\n this._assembly = assembly = new Assembly(this._complex);\r\n this.assemblies.push(assembly);\r\n }\r\n }\r\n}\r\n\r\nRemark350.prototype.id = 350;\r\n\r\nexport default Remark350;\r\n","/** Helper class for stream-like reading input files. */\r\nclass PDBStream {\r\n /**\r\n * Create a stream\r\n * @param {String} data Input data\r\n */\r\n constructor(data) {\r\n /** @type String */\r\n this._data = data; // Input file\r\n /** @type Number */\r\n this._start = 0; // Starting position of line\r\n /** @type Number */\r\n this._nextCR = -1; // Position of next CR (0x0D)\r\n /** @type Number */\r\n this._nextLF = -1; // Position of next LF (0x0A)\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n /** @type Number */\r\n this._end = data.length; // End of data\r\n\r\n this.next();\r\n }\r\n\r\n /**\r\n * Reading next line.\r\n * @returns {String} Next line in data (ending with LF or CR)\r\n */\r\n readLine() {\r\n return this._data.slice(this._start, this._next);\r\n }\r\n\r\n /**\r\n * Reading character from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {String} Character from position\r\n */\r\n readChar(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data[pos] : ' ';\r\n }\r\n\r\n /**\r\n * Reading character code from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {Number} Character code from position\r\n */\r\n readCharCode(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data.charCodeAt(pos) : 32;\r\n }\r\n\r\n /**\r\n * Reading string from begin to end points.\r\n * For a reason unknown, numbering assumed not to start from 0, but from 1.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {String} String from begin to end\r\n */\r\n readString(begin, end) {\r\n const from = this._start + begin - 1;\r\n const to = this._start + end;\r\n return this._data.slice(from, to < this._next ? to : this._next);\r\n }\r\n\r\n /**\r\n * Reading integer from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Integer from begin to end\r\n */\r\n readInt(begin, end) {\r\n return parseInt(this.readString(begin, end), 10);\r\n }\r\n\r\n /**\r\n * Reading float from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Float from begin to end\r\n */\r\n readFloat(begin, end) {\r\n return parseFloat(this.readString(begin, end));\r\n }\r\n\r\n /**\r\n * Checking for end of data.\r\n * @returns {boolean} True if data is ended, false otherwise\r\n */\r\n end() {\r\n return this._start >= this._end;\r\n }\r\n\r\n /**\r\n * Procedure to re-arrange current pointers in data.\r\n */\r\n next() {\r\n const start = this._next + 1;\r\n this._start = start < this._end ? start : this._end;\r\n\r\n // support CR, LF, CR+LF line endings\r\n // do not support LF+CR, CR+CR+LF, and other strange combinations\r\n\r\n if (this._start > this._nextCR) {\r\n this._nextCR = (this._data.indexOf('\\r', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n if (this._start > this._nextLF) {\r\n this._nextLF = (this._data.indexOf('\\n', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n this._next = this._nextCR + 1 < this._nextLF ? this._nextCR : this._nextLF;\r\n }\r\n}\r\n\r\nexport default PDBStream;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport Remark290 from './pdb/Remark290';\r\nimport Remark350 from './pdb/Remark350';\r\nimport PDBStream from './PDBStream';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst TAG_LENGTH = 6;\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\n// the most frequently used beginnings; although HEADER is mandatory, it is often missing in handmade files\r\nconst pdbStartRegexp = /^(HEADER\\s|COMPND\\s|REMARK\\s|ATOM {2}|HETATM|MODEL )/i;\r\n\r\nconst remarkParsers = {\r\n // NOTE: please forget the idea to build the method name in runtime, it can be obfuscated.\r\n 290: Remark290,\r\n 350: Remark350,\r\n};\r\n\r\nclass PDBParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._sheet = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._compaundFound = false;\r\n this._biomoleculeFound = false;\r\n this._allowedChainsIDs = null;\r\n this._lastMolId = -1;\r\n\r\n this._remarks = {};\r\n this._remark = null;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n this._compndCurrToken = '';\r\n\r\n this._options.fileType = 'pdb';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && pdbStartRegexp.test(data);\r\n }\r\n\r\n _finalize() {\r\n this._fixBondsArray();\r\n this._fixChains();\r\n\r\n // keep crystallographic symmetry transformations\r\n const remark290 = this._remarks[290];\r\n this._complex.symmetry = _.isUndefined(remark290) ? [] : remark290.matrices;\r\n\r\n // add loaded biological assemblies\r\n const remark350 = this._remarks[350];\r\n this._complex.units = this._complex.units.concat(_.isUndefined(remark350) ? [] : remark350.assemblies);\r\n\r\n // add loaded macromolecules\r\n this._finalizeMolecules();\r\n\r\n // create secondary structure etc.\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _finalizeMolecules() {\r\n // get chains from complex\r\n const chainDict = {};\r\n let i;\r\n const chains = this._complex._chains;\r\n for (i = 0; i < chains.length; ++i) {\r\n const chainObj = chains[i];\r\n const chainName = chainObj._name;\r\n chainDict[chainName] = chainObj;\r\n }\r\n\r\n // aggregate residues from chains\r\n for (i = 0; i < this._molecules.length; i++) {\r\n const m = this._molecules[i];\r\n let residues = [];\r\n for (let j = 0; j < m._chains.length; j++) {\r\n const name = m._chains[j];\r\n const chain = chainDict[name];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, m._name, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _fixChains() {\r\n const idChainMap = {};\r\n const complex = this._complex;\r\n\r\n // prepare\r\n for (let i = 0; i < complex._chains.length; i++) {\r\n const chain = complex._chains[i];\r\n idChainMap[chain._name.charCodeAt(0)] = chain;\r\n }\r\n }\r\n\r\n // FIXME: This function is redundant, CONECT records always follow ATOM and HETATM. Build the map online.\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseATOM(stream) {\r\n if (this._modelId !== 1) {\r\n return;\r\n }\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const het = stream.readCharCode(1) === 0x48;\r\n\r\n // field names according to wwPDB Format\r\n // NOTE: Chimera allows (nonstandard) use of columns 6-11 for the integer atom serial number in ATOM records.\r\n const serial = het ? stream.readInt(7, 11) : stream.readInt(6, 11);\r\n let name = stream.readString(13, 16);\r\n const altLoc = stream.readChar(17);\r\n const resName = stream.readString(18, 20).trim();\r\n const chainID = stream.readChar(22);\r\n const resSeq = stream.readInt(23, 26);\r\n const iCode = stream.readChar(27);\r\n const x = stream.readFloat(31, 38);\r\n const y = stream.readFloat(39, 46);\r\n const z = stream.readFloat(47, 54);\r\n const occupancy = stream.readFloat(55, 60);\r\n const tempFactor = stream.readFloat(61, 66);\r\n const element = stream.readString(77, 78).trim() || nameToElement(name);\r\n const charge = stream.readInt(79, 80) || 0;\r\n /* eslint-enable no-magic-numbers */\r\n // skip waters (there may be lots of them)\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n // PDB uses positional system for atom names. It helps derive element type from the name\r\n // but names may include extra spaces. From this point on we don't need those spaces anymore.\r\n name = name.trim();\r\n\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name]; // FIXME: Maybe should use type as additional index (\" CA \" vs. \"CA \")\r\n\r\n // NOTE: Residues of a particular chain are not required to be listed next to each other.\r\n // https://github.com/biasmv/pv/commit/7319b898b7473ba380c26699e3b028b2b1a7e1a1\r\n let chain = this._chain;\r\n if (!chain || chain.getName() !== chainID) {\r\n this._chain = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n _parseENDMDL() {\r\n this._modelId += 1;\r\n }\r\n\r\n _parseCONECT(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const serial0 = stream.readInt(7, 11);\r\n const serial1 = stream.readInt(12, 16);\r\n const serial2 = stream.readInt(17, 21);\r\n const serial3 = stream.readInt(22, 26);\r\n const serial4 = stream.readInt(27, 31);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const complex = this._complex;\r\n\r\n // Keep bonds ordered by atom serial\r\n if (serial1 && serial1 > serial0) {\r\n complex.addBond(serial0, serial1, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial2 && serial2 > serial0) {\r\n complex.addBond(serial0, serial2, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial3 && serial3 > serial0) {\r\n complex.addBond(serial0, serial3, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial4 && serial4 > serial0) {\r\n complex.addBond(serial0, serial4, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n }\r\n\r\n _parseCOMPND(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const str = stream.readString(11, 80);\r\n const tokenIdx = str.indexOf(':');\r\n this._compndCurrToken = tokenIdx > 0 ? str.substring(0, tokenIdx).trim() : this._compndCurrToken;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // start reading new molecule\r\n if (this._compndCurrToken === 'MOL_ID') {\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = parseInt(str.substring(tokenIdx + 1, str.indexOf(';')), 10);\r\n this._molecules.push(this._molecule);\r\n // parse molecule name\r\n } else if (this._compndCurrToken === 'MOLECULE' && this._molecule != null) {\r\n this._molecule._name = str.substring(tokenIdx + 1, str.indexOf(';')).trim();\r\n // parse molecule chains\r\n } else if (this._compndCurrToken === 'CHAIN' && this._molecule != null) {\r\n let chainStr = str.substring(tokenIdx + 1, 80).trim();\r\n const lastChar = chainStr[chainStr.length - 1];\r\n if (lastChar === ';' || lastChar === ',') {\r\n chainStr = chainStr.slice(0, -1);\r\n }\r\n chainStr = chainStr.replace(/\\s+/g, '');\r\n const chains = chainStr.split(',');\r\n this._molecule._chains = this._molecule._chains.concat(chains);\r\n }\r\n }\r\n\r\n _parseREMARK(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const remarkNum = stream.readInt(8, 10);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // create remark parser if needed\r\n let remark = this._remarks[remarkNum];\r\n if (_.isUndefined(remark)) {\r\n const RemarkParser = remarkParsers[remarkNum];\r\n if (_.isFunction(RemarkParser)) {\r\n this._remarks[remarkNum] = remark = new RemarkParser(this._complex);\r\n }\r\n }\r\n\r\n // delegate parsing\r\n if (!_.isUndefined(remark)) {\r\n remark.parse(stream);\r\n }\r\n }\r\n\r\n _parseHELIX(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [20, 22, 32, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addHelix(obj);\r\n this._complex.structures.push(obj);\r\n });\r\n }\r\n\r\n _parseSHEET(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [22, 23, 33, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addSheet(obj);\r\n });\r\n }\r\n\r\n _parseSTRUCTURE(stream, pars, adder) {\r\n const startId = 0;\r\n const startIndex = 1;\r\n const endId = 2;\r\n const endIndex = 3;\r\n\r\n // identify fields: debugging and stuff\r\n /* eslint-disable no-magic-numbers */\r\n const codeOfS = 0x53;\r\n const serialNumber = stream.readInt(8, 10);\r\n const structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim()\r\n const comment = stream.readString(41, 70).trim();\r\n const helLength = stream.readInt(72, 76);\r\n const helixClass = stream.readInt(39, 40);\r\n const shWidth = stream.readInt(15, 16);\r\n const shCur = stream.readInt(42, 45);\r\n const shPrev = stream.readInt(57, 60);\r\n /* eslint-enable no-magic-numbers */\r\n // file fields\r\n const startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0);\r\n const endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0);\r\n const startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3);\r\n let iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4);\r\n let startICode = 0;\r\n\r\n if (iCodeStr.length > 0) {\r\n startICode = iCodeStr.charCodeAt(0);\r\n }\r\n const endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3);\r\n iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4);\r\n let endICode = 0;\r\n if (iCodeStr.length > 0) {\r\n endICode = iCodeStr.charCodeAt(0);\r\n }\r\n\r\n let obj;\r\n let cs = this._sheet;\r\n if (stream.readCharCode(1) === codeOfS) {\r\n if (cs !== null && cs.getName() !== structureName) {\r\n cs = null;\r\n this._sheet = null;\r\n }\r\n if (cs === null) {\r\n this._sheet = obj = new Sheet(structureName, shWidth);\r\n adder(obj);\r\n } else {\r\n obj = cs;\r\n }\r\n const strand = new Strand(\r\n obj,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n helixClass,\r\n shCur,\r\n shPrev,\r\n );\r\n obj.addStrand(strand);\r\n this._complex.structures.push(strand);\r\n } else {\r\n obj = new Helix(\r\n helixClass,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n serialNumber,\r\n structureName,\r\n comment,\r\n helLength,\r\n );\r\n adder(obj);\r\n }\r\n }\r\n\r\n _parseHEADER(stream) {\r\n const { metadata } = this._complex;\r\n metadata.classification = stream.readString(11, 50).trim();\r\n metadata.date = stream.readString(51, 59).trim();\r\n\r\n const id = stream.readString(63, 66).trim();\r\n metadata.id = id;\r\n if (id) {\r\n this._complex.name = id;\r\n }\r\n metadata.format = 'pdb';\r\n }\r\n\r\n _parseTITLE(stream) {\r\n const { metadata } = this._complex;\r\n metadata.title = metadata.title || [];\r\n\r\n const line = stream.readInt(9, 10) || 1;\r\n metadata.title[line - 1] = stream.readString(11, 80).trim();\r\n }\r\n\r\n static tagParsers = {\r\n HEADER: PDBParser.prototype._parseHEADER,\r\n 'TITLE ': PDBParser.prototype._parseTITLE,\r\n 'ATOM ': PDBParser.prototype._parseATOM,\r\n HETATM: PDBParser.prototype._parseATOM,\r\n ENDMDL: PDBParser.prototype._parseENDMDL,\r\n CONECT: PDBParser.prototype._parseCONECT,\r\n COMPND: PDBParser.prototype._parseCOMPND,\r\n REMARK: PDBParser.prototype._parseREMARK,\r\n // 'SOURCE': PDBParser.prototype._parseSOURCE,\r\n 'HELIX ': PDBParser.prototype._parseHELIX,\r\n 'SHEET ': PDBParser.prototype._parseSHEET,\r\n\r\n // nonstandard extension to allow range 100,000 - 999,999\r\n 'ATOM 1': PDBParser.prototype._parseATOM,\r\n 'ATOM 2': PDBParser.prototype._parseATOM,\r\n 'ATOM 3': PDBParser.prototype._parseATOM,\r\n 'ATOM 4': PDBParser.prototype._parseATOM,\r\n 'ATOM 5': PDBParser.prototype._parseATOM,\r\n 'ATOM 6': PDBParser.prototype._parseATOM,\r\n 'ATOM 7': PDBParser.prototype._parseATOM,\r\n 'ATOM 8': PDBParser.prototype._parseATOM,\r\n 'ATOM 9': PDBParser.prototype._parseATOM,\r\n };\r\n\r\n parseSync() {\r\n const stream = new PDBStream(this._data);\r\n const result = this._complex = new Complex();\r\n\r\n // parse PDB line by line\r\n while (!stream.end()) {\r\n const tag = stream.readString(1, TAG_LENGTH);\r\n const func = PDBParser.tagParsers[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, stream);\r\n }\r\n stream.next();\r\n }\r\n\r\n // Resolve indices and serials to objects\r\n this._finalize();\r\n\r\n // cleanup\r\n this._serialAtomMap = null;\r\n this._sheet = null;\r\n this._residue = null;\r\n this._chain = null;\r\n this._complex = null;\r\n\r\n if (result.getAtomCount() === 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\nPDBParser.formats = ['pdb'];\r\nPDBParser.extensions = ['.pdb', '.ent'];\r\n\r\nexport default PDBParser;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n SGroup,\r\n Bond,\r\n} = chem;\r\n\r\nconst cOrderCharCodes = {\r\n A: 0,\r\n S: 1,\r\n D: 2,\r\n T: 3,\r\n};\r\n\r\nconst cmlStartRegexp = /\\s*<\\?xml\\b[^?>]*\\?>\\s*<(?:cml|molecule)\\b/i;\r\n\r\nclass CMLParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._complex = null;\r\n this._residue = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._lastMolId = -1;\r\n this._readOnlyOneMolecule = false;\r\n this._options.fileType = 'cml';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && cmlStartRegexp.test(data);\r\n }\r\n\r\n _rebuidBondIndexes(atoms, bonds) {\r\n const count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n\r\n const countBonds = bonds.length;\r\n for (let j = 0; j < countBonds; j++) {\r\n const idxs = bonds[j].atomRefs2.split(' ');\r\n if (idxs[0] === atomId) {\r\n bonds[j].start = i;\r\n }\r\n\r\n if (idxs[1] === atomId) {\r\n bonds[j].end = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _createSGroup(molecule, moleculeArr) {\r\n const newGroup = new SGroup(\r\n molecule.id,\r\n molecule.fieldData,\r\n new THREE.Vector3(parseFloat(molecule.x), parseFloat(molecule.y), 0),\r\n molecule.atomRefs,\r\n molecule,\r\n );\r\n if (molecule.placement === 'Relative') {\r\n newGroup._center = new THREE.Vector3(0, 0, 0);\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_CHARGE') {\r\n newGroup._charge = parseInt(molecule.fieldData, 10) || 0;\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_COEFFICIENT') {\r\n newGroup._repeat = parseInt(molecule.fieldData, 10) || 1;\r\n }\r\n moleculeArr.push(newGroup);\r\n }\r\n\r\n _extractSGroup(molecule, moleculeArr) {\r\n if (!Array.isArray(moleculeArr)) {\r\n moleculeArr = [];\r\n }\r\n\r\n if (molecule) {\r\n if (Array.isArray(molecule)) {\r\n const count = molecule.length;\r\n for (let i = 0; i < count; i++) {\r\n if (molecule[i].molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule[i].molecule));\r\n }\r\n this._createSGroup(molecule[i], moleculeArr);\r\n }\r\n } else {\r\n if (molecule.molecule) {\r\n if (molecule.molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule.molecule));\r\n }\r\n }\r\n this._createSGroup(molecule, moleculeArr);\r\n }\r\n }\r\n\r\n return moleculeArr;\r\n }\r\n\r\n _extractSGroups(molecule, atoms) {\r\n const moleculeArr = this._extractSGroup(molecule);\r\n\r\n const count = atoms.length;\r\n let i;\r\n let j;\r\n\r\n for (i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n const firstAtomRef = moleculeArr[j]._atoms.split(' ')[0];\r\n if (firstAtomRef === atomId) {\r\n if (!atoms[i].sgroupRef) {\r\n atoms[i].sgroupRef = [];\r\n }\r\n atoms[i].sgroupRef.push(moleculeArr[j]);\r\n }\r\n }\r\n }\r\n // build sGroups centers\r\n let atomMap = {}; // sgrpmap cache\r\n let mapEntry = null;\r\n const nLimon = 100000000;\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n\r\n function cycleFuncInner(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n moleculeArr[j]._atoms.push(mapEntry.a);\r\n }\r\n }\r\n\r\n function cycleFunc(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n bLow.set(Math.min(bLow.x, mapEntry.x), Math.min(bLow.y, mapEntry.y), Math.min(bLow.z, mapEntry.z));\r\n bHight.set(Math.max(bHight.x, mapEntry.x), Math.max(bHight.y, mapEntry.y), Math.max(bHight.z, mapEntry.z));\r\n cycleFuncInner(e);\r\n }\r\n }\r\n\r\n for (i = 0; i < atoms.length; i++) {\r\n atomMap[atoms[i].id] = {};\r\n atomMap[atoms[i].id].x = atoms[i].x2;\r\n if (atoms[i].x3) {\r\n atomMap[atoms[i].id].x = atoms[i].x3;\r\n }\r\n atomMap[atoms[i].id].x = parseFloat(atomMap[atoms[i].id].x);\r\n atomMap[atoms[i].id].y = atoms[i].y2;\r\n if (atoms[i].y3) {\r\n atomMap[atoms[i].id].y = atoms[i].y3;\r\n }\r\n atomMap[atoms[i].id].y = parseFloat(atomMap[atoms[i].id].y);\r\n atomMap[atoms[i].id].z = '0.0';\r\n if (atoms[i].z3) {\r\n atomMap[atoms[i].id].z = atoms[i].z3;\r\n }\r\n atomMap[atoms[i].id].z = parseFloat(atomMap[atoms[i].id].z);\r\n atomMap[atoms[i].id].a = atoms[i];\r\n }\r\n\r\n let atomsRef;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n if (moleculeArr[j]._center !== null) {\r\n bLow.set(nLimon, nLimon, nLimon);\r\n bHight.set(-nLimon, -nLimon, -nLimon);\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFunc);\r\n\r\n moleculeArr[j]._center.addVectors(bLow, bHight);\r\n moleculeArr[j]._center.multiplyScalar(0.5);\r\n } else {\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFuncInner);\r\n }\r\n }\r\n atomMap = null;\r\n }\r\n\r\n _traverseData(dom) {\r\n function isArray(o) {\r\n return Object.prototype.toString.apply(o) === '[object Array]';\r\n }\r\n\r\n function parseNode(xmlNode, result) {\r\n if (xmlNode.nodeName === '#text' && xmlNode.nodeValue.trim() === '') {\r\n return;\r\n }\r\n\r\n const jsonNode = {};\r\n jsonNode.xmlNode = xmlNode;\r\n const existing = result[xmlNode.nodeName];\r\n if (existing) {\r\n if (!isArray(existing)) {\r\n result[xmlNode.nodeName] = [existing, jsonNode];\r\n } else {\r\n result[xmlNode.nodeName].push(jsonNode);\r\n }\r\n } else {\r\n result[xmlNode.nodeName] = jsonNode;\r\n }\r\n\r\n let length;\r\n let i;\r\n if (xmlNode.attributes) {\r\n ({ length } = xmlNode.attributes);\r\n for (i = 0; i < length; i++) {\r\n const attribute = xmlNode.attributes[i];\r\n jsonNode[attribute.nodeName] = attribute.nodeValue;\r\n }\r\n }\r\n\r\n ({ length } = xmlNode.childNodes);\r\n for (i = 0; i < length; i++) {\r\n parseNode(xmlNode.childNodes[i], jsonNode);\r\n }\r\n }\r\n\r\n const result = {};\r\n if (dom.childNodes.length) {\r\n parseNode(dom.childNodes[0], result);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _findSuitableMolecule(data, molSet) {\r\n for (const key in data) {\r\n if (key === 'xmlNode') {\r\n continue;\r\n } else if (key === 'molecule') {\r\n if (data.molecule) {\r\n if (data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n molSet.push(data);\r\n }\r\n if (Array.isArray(data.molecule)) {\r\n for (let i = 0; i < data.molecule.length; i++) {\r\n if (data.molecule[i].atomArray && data.molecule[i].atomArray.atom) {\r\n molSet.push({ molecule: data.molecule[i] });\r\n }\r\n }\r\n }\r\n }\r\n } else if (data[key] && data[key] !== null && typeof (data[key]) === 'object') {\r\n this._findSuitableMolecule(data[key], molSet);\r\n }\r\n }\r\n }\r\n\r\n _selectComponents(text) {\r\n const parser = new DOMParser();\r\n const doc = parser.parseFromString(text, 'application/xml');\r\n const traversedData = this._traverseData(doc);\r\n let rawData;\r\n const self = this;\r\n\r\n function prepareComponentCompound(data) {\r\n let atoms = [];\r\n if (data.molecule && data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n if (!Array.isArray(data.molecule.atomArray.atom)) {\r\n atoms.push(data.molecule.atomArray.atom);\r\n } else {\r\n atoms = data.molecule.atomArray.atom;\r\n }\r\n } else if (!data.molecule) {\r\n const ret = {};\r\n ret.atomLabels = null;\r\n ret.labelsCount = 1;\r\n return ret;\r\n }\r\n\r\n if (data.molecule.molecule) {\r\n self._extractSGroups(data.molecule.molecule, atoms);\r\n }\r\n\r\n let atom;\r\n let count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges = [];\r\n }\r\n\r\n let localBond = [];\r\n if (data.molecule.bondArray && data.molecule.bondArray.bond) {\r\n if (!Array.isArray(data.molecule.bondArray.bond)) {\r\n localBond.push(data.molecule.bondArray.bond);\r\n } else {\r\n localBond = data.molecule.bondArray.bond;\r\n }\r\n }\r\n let bond;\r\n count = localBond.length;\r\n self._rebuidBondIndexes(atoms, localBond);\r\n\r\n function addCurrBond(index) {\r\n bond = localBond[index];\r\n atom = atoms[bond.start];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.end);\r\n atom = atoms[bond.end];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.start);\r\n return true;\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n if (!addCurrBond(i)) {\r\n // ignore invalid bond\r\n continue;\r\n }\r\n const orderAttr = bond.xmlNode.getAttribute('order');\r\n const tc = parseInt(orderAttr, 10);\r\n // the default bond order is unknown\r\n localBond[i].order = 0;\r\n localBond[i].type = Bond.BondType.UNKNOWN;\r\n if (tc > 1) {\r\n localBond[i].order = tc;\r\n } else {\r\n // another option - bond order is a string\r\n const order = cOrderCharCodes[orderAttr];\r\n if (order !== undefined) {\r\n localBond[i].order = order;\r\n if (orderAttr === 'A') {\r\n localBond[i].type = Bond.BondType.AROMATIC;\r\n }\r\n }\r\n }\r\n }\r\n\r\n count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges.sort();\r\n }\r\n\r\n const labels = self._breadWidthSearch(atoms, 0); // for now\r\n\r\n const retStruct = {};\r\n retStruct.atoms = atoms;\r\n retStruct.bonds = localBond;\r\n retStruct.labels = labels.atomLabels;\r\n retStruct.count = Math.min(1, labels.labelsCount); // for now\r\n retStruct.curr = -1;\r\n retStruct.originalCML = doc;\r\n\r\n return retStruct;\r\n }\r\n\r\n if (traversedData.cml) {\r\n rawData = traversedData.cml;\r\n } else {\r\n rawData = traversedData;\r\n }\r\n const retData = [];\r\n const filteredData = [];\r\n this._findSuitableMolecule(rawData, filteredData);\r\n if (this._readOnlyOneMolecule && filteredData.length > 1) {\r\n filteredData.splice(1, filteredData.length - 1);\r\n }\r\n filteredData.forEach((d) => {\r\n const rd = prepareComponentCompound(d);\r\n if (rd.atoms.length > 0) {\r\n retData.push(rd);\r\n }\r\n });\r\n return retData;\r\n }\r\n\r\n _packLabel(compId, molId) {\r\n const shift = 16;\r\n return (molId << shift) + compId;\r\n }\r\n\r\n _unpackLabel(l) {\r\n const shift = 16;\r\n const mask = (1 << shift) - 1;\r\n return { molId: l >>> shift, compId: l & mask };\r\n }\r\n\r\n _breadWidthSearch(atoms, molID) {\r\n const atomLabels = new Array(atoms.length);\r\n\r\n let id;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n atomLabels[id] = this._packLabel(0, molID);\r\n }\r\n\r\n const breadthQueue = [];\r\n let componentID = 0;\r\n let labeledAtoms = atoms.length;\r\n\r\n while (labeledAtoms > 0) {\r\n componentID++;\r\n\r\n let startID = -1;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n if (this._unpackLabel(atomLabels[id]).compId === 0) {\r\n startID = id;\r\n break;\r\n }\r\n }\r\n\r\n if (startID < 0) {\r\n break;\r\n }\r\n\r\n // Bread first search\r\n breadthQueue.push(atoms[startID]);\r\n atomLabels[startID] = this._packLabel(componentID, molID);\r\n labeledAtoms--;\r\n\r\n while (breadthQueue.length > 0) {\r\n const curr = breadthQueue.shift();\r\n if (!curr) {\r\n continue;\r\n }\r\n\r\n for (let i = 0; i < curr.edges.length; i++) {\r\n if (atomLabels[curr.edges[i]] !== componentID) {\r\n breadthQueue.push(atoms[curr.edges[i]]);\r\n atomLabels[curr.edges[i]] = componentID;\r\n labeledAtoms--;\r\n }\r\n }\r\n }\r\n }\r\n const ret = {};\r\n ret.atomLabels = atomLabels;\r\n ret.labelsCount = componentID;\r\n return ret;\r\n }\r\n\r\n _parseBond(eAtom, mainAtom, order, type) {\r\n if (eAtom >= 0) {\r\n const h = [Math.min(eAtom, mainAtom), Math.max(eAtom, mainAtom)];\r\n this._complex.addBond(h[0], h[1], order, type, true);\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseSet(varData) {\r\n const complex = this._complex = new Complex();\r\n const data = varData;\r\n const currentLabel = data.curr;\r\n const { atoms, labels } = data;\r\n let atom = null;\r\n let i;\r\n let j;\r\n const count = atoms.length;\r\n\r\n function addFunc(a) {\r\n a.xmlNodeRef = atom;\r\n if (atom.x2) {\r\n atom.x3 = atom.x2;\r\n delete atom.x2;\r\n }\r\n if (atom.y2) {\r\n atom.y3 = atom.y2;\r\n delete atom.y2;\r\n }\r\n if (!(atom.z3)) {\r\n atom.z3 = '0.0';\r\n }\r\n atom.complexAtom = a;\r\n }\r\n\r\n let chains = {};\r\n // parse atoms in label order\r\n const reorder = [];\r\n for (i = 0; i < count; i++) {\r\n reorder.push(i);\r\n }\r\n reorder.sort((a, b) => labels[a] - labels[b]);\r\n for (i = 0; i < count; i++) {\r\n const atomCharge = 0;\r\n const lLabel = labels[reorder[i]];\r\n if (this._unpackLabel(lLabel).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[reorder[i]];\r\n const atomFullNameStruct = atom.elementType;\r\n\r\n if (atom.sgroupRef) {\r\n const countRef = atom.sgroupRef.length;\r\n for (let k = 0; k < countRef; ++k) {\r\n complex._sgroups.push(atom.sgroupRef[k]);\r\n }\r\n }\r\n\r\n if (atom.x3 || atom.x2) {\r\n const currAtomComp = this._unpackLabel(lLabel).compId;\r\n // use ' ' by default instead of synthetic creation of chain names\r\n const chainID = ' '; //= String.fromCharCode('A'.charCodeAt(0) + currAtomComp);\r\n const resSeq = currAtomComp;\r\n const iCode = ' ';\r\n let strLabel = currAtomComp.toString();\r\n if (strLabel.length === 1) {\r\n strLabel = `0${strLabel}`;\r\n }\r\n const resName = `N${strLabel}`;\r\n let chain = chains[chainID];\r\n if (!chain || chain.getName() !== chainID) {\r\n chains[chainID] = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n // _x, _y, _z, mname, mindex, atomNameFull, atomName, chainID, serial, isHet, atlLocInd, atomNameToTypeF\r\n let xyz = null;\r\n if (atom.x3) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x3), parseFloat(atom.y3), parseFloat(atom.z3));\r\n } else if (atom.x2) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x2), parseFloat(atom.y2), 0);\r\n }\r\n let element = Element.ByName[atom.elementType.toUpperCase()];\r\n if (!element) {\r\n element = (JSON.parse(JSON.stringify(Element.ByName[\r\n Object.keys(Element.ByName)[Object.keys(Element.ByName).length - 1]])));\r\n element.number += 1;\r\n element.name = atom.elementType.toUpperCase();\r\n element.fullName = 'Unknown';\r\n Element.ByName[atom.elementType.toUpperCase()] = element;\r\n }\r\n const atomSerial = parseInt(atom.id.replace(/[^0-9]/, ''), 10);\r\n const added = residue.addAtom(\r\n atomFullNameStruct,\r\n element,\r\n xyz,\r\n Element.Role.SG,\r\n true,\r\n atomSerial,\r\n ' ',\r\n 1.0,\r\n 0.0,\r\n atomCharge,\r\n );\r\n if (atom.hydrogenCount) {\r\n added.hydrogenCount = parseInt(atom.hydrogenCount, 10);\r\n }\r\n if (atom.mrvValence) {\r\n added.valence = parseInt(atom.mrvValence, 10);\r\n }\r\n addFunc(added);\r\n }\r\n }\r\n }\r\n chains = null;// NOSONAR\r\n for (i = 0; i < data.bonds.length; i++) {\r\n const cb = data.bonds[i];\r\n if (this._unpackLabel(labels[cb.start]).molId === this._unpackLabel(currentLabel).molId\r\n && this._unpackLabel(labels[cb.end]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[cb.start];\r\n if (!atom || !(atoms[cb.end])) {\r\n continue; // skip invalid\r\n }\r\n this._parseBond(\r\n parseInt(atom.id.replace(/[^0-9]/, ''), 10),\r\n parseInt(atoms[cb.end].id.replace(/[^0-9]/, ''), 10),\r\n cb.order,\r\n cb.type,\r\n );\r\n }\r\n }\r\n\r\n for (i = 0; i < this._complex.getSGroupCount(); i++) {\r\n const sGrp = this._complex.getSGroups()[i];\r\n for (j = 0; j < sGrp._atoms.length; j++) {\r\n sGrp._atoms[j] = sGrp._atoms[j].complexAtom;\r\n }\r\n }\r\n for (i = 0; i < count; i++) {\r\n if (this._unpackLabel(labels[i]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[i];\r\n atom.complexAtom = null;\r\n delete atom.complexAtom;\r\n }\r\n }\r\n this._complex.originalCML = data.originalCML;\r\n this._fixBondsArray();\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n this._serialAtomMap = null;\r\n this._complex = null;\r\n return complex;\r\n }\r\n\r\n parseSync() {\r\n const complexes = [];\r\n const self = this;\r\n const moleculaSet = this._selectComponents(this._data);\r\n moleculaSet.forEach((molSet) => {\r\n molSet.curr = 2;\r\n if (molSet.count === 0) {\r\n molSet.count = 1;\r\n }\r\n for (let i = 0; i < molSet.count; i++) {\r\n molSet.curr = (i + 1);\r\n complexes.push(self._parseSet(molSet, false));\r\n }\r\n });\r\n\r\n let totalAtomsParsed = 0;\r\n complexes.forEach((c) => {\r\n totalAtomsParsed += c.getAtomCount();\r\n });\r\n if (totalAtomsParsed <= 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n if (complexes.length > 1) {\r\n const joinedComplex = new Complex();\r\n joinedComplex.joinComplexes(complexes);\r\n joinedComplex.originalCML = complexes[0].originalCML;\r\n return joinedComplex;\r\n }\r\n if (complexes.length === 1) {\r\n return complexes[0];\r\n }\r\n return new Complex();\r\n }\r\n}\r\n\r\nCMLParser.formats = ['cml'];\r\nCMLParser.extensions = ['.cml'];\r\n\r\nexport default CMLParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport MMTF from '../../../vendor/js/mmtf';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst {\r\n Complex,\r\n Chain,\r\n Atom,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nclass ArrayComparator {\r\n constructor(original) {\r\n this._original = Array.from(original);\r\n this._original.sort();\r\n\r\n this._sum = 0;\r\n for (let i = 0; i < this._original.length; ++i) {\r\n this._sum += this._original[i];\r\n }\r\n }\r\n\r\n compare(candidate) {\r\n const len = candidate.length;\r\n if (len !== this._original.length) {\r\n return false;\r\n }\r\n\r\n let sum = 0;\r\n let i;\r\n for (i = 0; i < len; ++i) {\r\n sum += candidate[i];\r\n }\r\n\r\n if (sum !== this._sum) {\r\n return false;\r\n }\r\n\r\n const sorted = Array.from(candidate);\r\n sorted.sort();\r\n\r\n for (i = 0; i < len; ++i) {\r\n if (sorted[i] !== this._original[i]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\nArrayComparator.prototype.constructor = ArrayComparator;\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see https://github.com/rcsb/mmtf-javascript/blob/master/src/mmtf-traverse.js\r\nconst secStructToType = [\r\n StructuralElementType.HELIX_PI, // 0\r\n StructuralElementType.BEND, // 1\r\n StructuralElementType.HELIX_ALPHA, // 2\r\n StructuralElementType.STRAND, // 3\r\n StructuralElementType.HELIX_310, // 4\r\n StructuralElementType.BRIDGE, // 5\r\n StructuralElementType.TURN, // 6\r\n StructuralElementType.COIL, // 7\r\n];\r\n\r\nfunction getFirstByte(buf) {\r\n const bytes = new Uint8Array(buf, 0, 1);\r\n return bytes[0];\r\n}\r\n\r\nclass MMTFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'mmtf';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n // check if it's binary MessagePack format containing a map (dictionary)\r\n // see https://github.com/msgpack/msgpack/blob/master/spec.md\r\n return _.isArrayBuffer(data) && ((getFirstByte(data) | 1) === 0xDF);\r\n }\r\n\r\n _onModel(_modelData) {\r\n }\r\n\r\n _onChain(chainData) {\r\n if (chainData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const chain = new Chain(this._complex, chainData.chainName);\r\n this._complex._chains[chainData.chainIndex] = chain;\r\n chain._index = chainData.chainIndex;\r\n }\r\n\r\n _onGroup(groupData) {\r\n if (groupData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n if (this.settings.now.nowater) {\r\n // skip water\r\n if (groupData.groupName === 'HOH' || groupData.groupName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n const chain = this._complex._chains[groupData.chainIndex];\r\n const icode = !groupData.insCode.charCodeAt(0) ? '' : groupData.insCode;\r\n const residue = chain.addResidue(groupData.groupName, groupData.groupId, icode);\r\n residue._index = groupData.groupIndex;\r\n\r\n this._updateSecStructure(this._complex, residue, groupData);\r\n }\r\n\r\n _onAtom(atomData) {\r\n if (atomData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const altLoc = !atomData.altLoc.charCodeAt(0) ? '' : atomData.altLoc;\r\n const atom = new Atom(\r\n atomData.groupIndex, // we store residue index here to replace it later with actual reference\r\n atomData.atomName,\r\n Element.getByName(atomData.element.toUpperCase()),\r\n new THREE.Vector3(atomData.xCoord, atomData.yCoord, atomData.zCoord),\r\n Element.Role[atomData.atomName],\r\n false, // hetero atoms will be marked later\r\n atomData.atomId,\r\n altLoc,\r\n atomData.occupancy,\r\n atomData.bFactor,\r\n atomData.formalCharge,\r\n );\r\n\r\n this._complex._atoms[atomData.atomIndex] = atom;\r\n atom.index = atomData.atomIndex;\r\n\r\n this._serialAtomMap[atomData.atomId] = atom;\r\n }\r\n\r\n _onBond(bondData) {\r\n const right = Math.max(bondData.atomIndex1, bondData.atomIndex2);\r\n if (right >= this._complex._atoms.length) {\r\n return;\r\n }\r\n const left = Math.min(bondData.atomIndex1, bondData.atomIndex2);\r\n this._complex.addBond(\r\n this._complex._atoms[left],\r\n this._complex._atoms[right],\r\n bondData.bondOrder,\r\n Bond.BondType.UNKNOWN,\r\n true,\r\n );\r\n }\r\n\r\n _updateSecStructure(complex, residue, groupData) {\r\n const helixClasses = [3, -1, 1, -1, 5];\r\n\r\n if (!_.isUndefined(groupData) && groupData.secStruct === this._ssType) {\r\n residue._secondary = this._ssStruct;\r\n if (this._ssStruct) {\r\n this._ssStruct.term = residue;\r\n }\r\n return;\r\n }\r\n\r\n if (!_.isUndefined(groupData)) {\r\n // start new secondary structure\r\n const type = secStructToType[groupData.secStruct];\r\n this._ssType = groupData.secStruct;\r\n this._ssStart = residue;\r\n\r\n let struct = null;\r\n switch (this._ssType) {\r\n case -1: // undefined\r\n case 7: // coil\r\n break;\r\n case 0: // pi helix\r\n case 2: // alpha helix\r\n case 4: // 3-10 helix\r\n struct = new Helix(helixClasses[this._ssType], residue, residue, 0, '', '', 0);\r\n complex._helices.push(struct);\r\n break;\r\n case 3: { // extended\r\n const sheet = new Sheet('', 0);\r\n complex._sheets.push(sheet);\r\n struct = new Strand(sheet, residue, residue, 0, null, null);\r\n break;\r\n }\r\n default:\r\n if (type !== undefined) {\r\n struct = new StructuralElement(type, residue, residue);\r\n }\r\n break;\r\n }\r\n\r\n this._ssStruct = struct;\r\n residue._secondary = struct;\r\n if (struct) {\r\n complex.structures.push(struct);\r\n }\r\n }\r\n }\r\n\r\n _updateMolecules(mmtfData) {\r\n const entities = mmtfData.entityList;\r\n if (!entities) {\r\n return;\r\n }\r\n\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < entities.length; i++) {\r\n const entity = entities[i];\r\n const chains = entity.chainIndexList;\r\n let residues = [];\r\n for (let j = 0; j < chains.length; j++) {\r\n const chainIndex = chains[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, entity.description, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n // populate complex with chains, residues and atoms\r\n _traverse(mmtfData) {\r\n const self = this;\r\n\r\n // get metadata\r\n const { metadata } = this._complex;\r\n metadata.id = mmtfData.structureId;\r\n metadata.title = [];\r\n metadata.title[0] = mmtfData.title;\r\n metadata.date = mmtfData.releaseDate;\r\n metadata.format = 'mmtf';\r\n\r\n // create event callback functions\r\n const eventCallbacks = {\r\n onModel(modelData) {\r\n self._onModel(modelData);\r\n },\r\n onChain(chainData) {\r\n self._onChain(chainData);\r\n },\r\n onGroup(groupData) {\r\n self._onGroup(groupData);\r\n },\r\n onAtom(atomData) {\r\n self._onAtom(atomData);\r\n },\r\n onBond(bondData) {\r\n self._onBond(bondData);\r\n },\r\n };\r\n\r\n // temporary variables used during traversal to track secondary structures\r\n this._ssType = -1;\r\n this._ssStruct = null;\r\n this._ssStart = null;\r\n\r\n // traverse the structure and listen to the events\r\n MMTF.traverse(mmtfData, eventCallbacks);\r\n\r\n this._updateSecStructure(this._complex);\r\n this._updateMolecules(mmtfData);\r\n }\r\n\r\n // During traversal atoms and residues don't come sequentially\r\n // so a residue for certain atom can be unavailable. Thus we\r\n // store residue index in atom.\r\n // This function being called after traversal replaces the index\r\n // with actual reference, and also populates atom lists in residues.\r\n _linkAtomsToResidues() {\r\n for (let i = 0; i < this._complex._atoms.length; ++i) {\r\n const atom = this._complex._atoms[i];\r\n const residue = this._complex._residues[atom.residue];\r\n atom.residue = residue;\r\n residue._atoms.push(atom);\r\n }\r\n }\r\n\r\n _findSynonymousChains() {\r\n const named = {};\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!named.hasOwnProperty(name)) {\r\n named[name] = [];\r\n }\r\n\r\n named[name].push(chain._index);\r\n }\r\n\r\n return named;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _parseAssemblyInfo(mmtfData) {\r\n let i;\r\n let j;\r\n let k;\r\n const assemblies = [];\r\n const { logger } = this;\r\n\r\n for (i = 0; i < mmtfData.bioAssemblyList.length; ++i) {\r\n const baInfo = mmtfData.bioAssemblyList[i];\r\n if (baInfo.transformList.length === 0) {\r\n continue;\r\n }\r\n\r\n const chains = baInfo.transformList[0].chainIndexList;\r\n const chainListCheck = new ArrayComparator(chains);\r\n\r\n // build list of chain names\r\n const chainNames = {};\r\n for (j = 0; j < chains.length; ++j) {\r\n chainNames[this._complex._chains[chains[j]].getName()] = 1;\r\n }\r\n\r\n // all chains with the same name should belong to assembly if one of them belongs\r\n const allChains = [];\r\n let name;\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n // just concat arrays -- there should be no duplicates\r\n Array.prototype.push.apply(allChains, this._chainsByName[name]);\r\n }\r\n }\r\n if (!chainListCheck.compare(allChains)) {\r\n // assembly is missing some of the chains\r\n logger.debug('MMTF: Assembly is missing some of the synonymous chains. Skipping...');\r\n }\r\n\r\n const a = new Assembly(this._complex);\r\n\r\n // add chains to assembly\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n a.addChain(name);\r\n }\r\n }\r\n\r\n // add unique matrices to assembly\r\n a.addMatrix(new THREE.Matrix4().fromArray(baInfo.transformList[0].matrix).transpose());\r\n for (j = 1; j < baInfo.transformList.length; ++j) {\r\n const transform = baInfo.transformList[j];\r\n\r\n if (!chainListCheck.compare(transform.chainIndexList)) {\r\n // list of chains for this transform doesn't match that for other transforms\r\n // this is illegal in our structure\r\n logger.debug('MMTF: Chain lists differ for different transforms in one assembly. Skipping...');\r\n continue;\r\n }\r\n\r\n const m = new THREE.Matrix4().fromArray(transform.matrix).transpose();\r\n\r\n // check if matrix is already in the list\r\n for (k = 0; k < a.matrices.length; ++k) {\r\n if (a.matrices[k].equals(m)) {\r\n break;\r\n }\r\n }\r\n\r\n if (k === a.matrices.length) {\r\n a.addMatrix(m);\r\n }\r\n }\r\n\r\n a.finalize();\r\n assemblies.push(a);\r\n }\r\n\r\n return assemblies;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _markHeteroAtoms(mmtfData) {\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < mmtfData.entityList.length; ++i) {\r\n const entity = mmtfData.entityList[i];\r\n if (entity.type !== 'polymer') {\r\n for (let j = 0; j < entity.chainIndexList.length; ++j) {\r\n const chainIndex = entity.chainIndexList[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n for (let k = 0; k < chain._residues.length; ++k) {\r\n const res = chain._residues[k];\r\n for (let m = 0; m < res._atoms.length; ++m) {\r\n res._atoms[m].het = true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // joins chains with the same name into single chain\r\n _joinSynonymousChains() {\r\n let i;\r\n let j;\r\n\r\n const primaryChainsArray = [];\r\n const primaryChainsHash = {};\r\n\r\n // join chains\r\n for (i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!primaryChainsHash.hasOwnProperty(name)) {\r\n // new name -- this is a primary chain\r\n primaryChainsHash[name] = chain;\r\n chain._index = primaryChainsArray.length; // update index as this array will later replace original chain list\r\n primaryChainsArray.push(chain);\r\n continue;\r\n }\r\n\r\n // this chain should be joined with the primary chain of the same name\r\n const primary = primaryChainsHash[name];\r\n for (j = 0; j < chain._residues.length; ++j) {\r\n const residue = chain._residues[j];\r\n primary._residues.push(residue);\r\n residue._chain = primary;\r\n }\r\n }\r\n\r\n // replace chains list with one containing only primary chains\r\n // dropping references to all chains but primary\r\n this._complex._chains = primaryChainsArray;\r\n }\r\n\r\n parseSync() {\r\n const mmtfData = MMTF.decode(this._data);\r\n\r\n this._complex = new Complex();\r\n this._serialAtomMap = {}; // filled during traversal\r\n\r\n this._traverse(mmtfData);\r\n this._linkAtomsToResidues();\r\n this._markHeteroAtoms(mmtfData);\r\n this._chainsByName = this._findSynonymousChains();\r\n Array.prototype.push.apply(this._complex.units, this._parseAssemblyInfo(mmtfData));\r\n this._joinSynonymousChains();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n return this._complex;\r\n }\r\n}\r\n\r\nMMTFParser.formats = ['mmtf'];\r\nMMTFParser.extensions = ['.mmtf'];\r\nMMTFParser.binary = true;\r\n\r\nexport default MMTFParser;\r\n","class ParsingError extends Error {\r\n constructor(message, line, column) {\r\n super(`data:${line}:${column}: ${message}`);\r\n\r\n if (Error.captureStackTrace) {\r\n Error.captureStackTrace(this, ParsingError);\r\n }\r\n\r\n this.name = 'ParsingError';\r\n this.parseLine = line;\r\n this.parseColumn = column;\r\n }\r\n}\r\n\r\nexport default ParsingError;\r\n","import _ from 'lodash';\r\nimport ParsingError from './ParsingError';\r\n\r\n// Implemented and being tested against: https://www.iucr.org/resources/cif/spec/version1.1/cifsyntax\r\n\r\nfunction _isWhitespace(ch) {\r\n return ch === 32 || ch === 10 || ch === 13 || ch === 9;\r\n}\r\n\r\nfunction _inlineIndexOf(ch0, str, idx) {\r\n const len = str.length;\r\n let ch = -1;\r\n while (idx < len) {\r\n ch = str.charCodeAt(idx);\r\n if (ch === ch0 || ch === 10) {\r\n break;\r\n }\r\n ++idx;\r\n }\r\n return ch === ch0 ? idx : -1;\r\n}\r\n\r\nexport default function readCIF(source) {\r\n let i = 0;\r\n let j = 0;\r\n const n = source.length;\r\n let code = NaN;\r\n let newline = true;\r\n let line = 1;\r\n let column = 1;\r\n let begin;\r\n let state = 0; // 0 - start, 1 - block, 2 - item, 3 - loop, 4 - values, 5 - value\r\n const result = {};\r\n let block = {};\r\n let keys = [];\r\n let keysCount = 0;\r\n let key = '';\r\n let values = [];\r\n let valuesCount = 0;\r\n let value;\r\n\r\n function _parseValue() {\r\n let val;\r\n if ((code === 46 || code === 63) && (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))) { // '.' or '?' .....\r\n // it's a missing value\r\n ++column;\r\n ++i;\r\n return undefined;\r\n }\r\n if (newline && code === 59) { // ';' ......................................................................\r\n // parse multi-line string\r\n j = i;\r\n let lines = 0;\r\n do {\r\n j = _inlineIndexOf(10, source, j + 1); // '\\n'\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated text block found', line, column);\r\n }\r\n ++lines;\r\n } while ((j + 1 < n && source.charCodeAt(j + 1) !== code) || j + 1 >= n);\r\n val = source.substring(i + 1, j).replace(/\\r/g, '');\r\n i = j + 2;\r\n line += lines;\r\n column = 1;\r\n newline = false;\r\n return val;\r\n }\r\n if (code === 39 || code === 34) { // ''' or '\"' ...........................................................\r\n // parse quoted string\r\n j = i;\r\n do {\r\n j = _inlineIndexOf(code, source, j + 1);\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated quoted string found', line, column);\r\n }\r\n } while (j + 1 < n && !_isWhitespace(source.charCodeAt(j + 1)));\r\n val = source.substring(i + 1, j);\r\n column += j - i + 1;\r\n i = j + 1;\r\n return val;\r\n } // ......................................................................................................\r\n // parse until the first whitespace\r\n j = i;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n val = source.substring(i, j);\r\n column += j - i;\r\n i = j;\r\n // try to convert to a number\r\n const num = Number(val);\r\n if (!Number.isNaN(num)) {\r\n return num;\r\n }\r\n // or leave as an unquoted string\r\n return val;\r\n }\r\n\r\n function _storeKey(tag) {\r\n keys[keysCount++] = tag;\r\n }\r\n\r\n function _storeValue(val) {\r\n const keyIndex = valuesCount % keysCount;\r\n values[keyIndex].push(val);\r\n ++valuesCount;\r\n return val;\r\n }\r\n\r\n while (i <= n) {\r\n code = source.charCodeAt(i); // 'NaN' in place of ''\r\n if (code === 13) { // '\\r' .......................................................................................\r\n // just ignore\r\n } else if (code === 10) { // '\\n' ................................................................................\r\n // take note of new lines\r\n newline = true;\r\n ++line;\r\n column = 1;\r\n } else {\r\n // process inline characters\r\n if (code === 32 || code === 9) { // ' ' or '\\t' ................................................................\r\n // just ignore\r\n } else if (code === 35) { // '#' ...............................................................................\r\n // skip the comment until before the end of the line\r\n i = _inlineIndexOf(10, source, i + 1); // '\\n'\r\n if (i === -1) {\r\n break;\r\n } else {\r\n continue; // don't forget to process the new line\r\n }\r\n } else if (state === 0) { // start =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n j = i + 5;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new data block\r\n result[source.substring(begin, i)] = block = {};\r\n state = 1; // block\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Data block name missing', line, column);\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 1) { // block =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n continue; // parse again in a different state\r\n } else if (code === 95) { // '_' .............................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // start new item\r\n key = source.substring(begin, i);\r\n state = 2; // item\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n i += 5;\r\n column += 5;\r\n if (i < n && !_isWhitespace(source.charCodeAt(i))) {\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n } else {\r\n // start new loop\r\n keys = [];\r\n keysCount = 0;\r\n values = [];\r\n valuesCount = 0;\r\n state = 3; // loop\r\n continue; // don't forget to process the whitespace\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 2) { // item ==============================================================================\r\n if (Number.isNaN(code)) {\r\n break;\r\n }\r\n value = _parseValue();\r\n _.set(block, key, value);\r\n state = 1; // block\r\n continue;\r\n } else if (state === 3) { // loop ==============================================================================\r\n if (code === 95) { // '_' ....................................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new key\r\n _storeKey(source.substring(begin, i));\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else { // ..................................................................................................\r\n if (keysCount > 0) {\r\n for (let keyIndex = 0; keyIndex < keysCount; ++keyIndex) {\r\n value = [];\r\n values[keyIndex] = value;\r\n _.set(block, keys[keyIndex], value);\r\n }\r\n state = 4;\r\n continue; // parse again in a different state\r\n }\r\n throw new ParsingError('Data tags are missing inside a loop', line, column);\r\n }\r\n } else if (state === 4) { // values ============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n } else if (code === 95) { // '_' .............................................................................\r\n state = 1; // block\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n state = 1; // block\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n state = 0;\r\n } else { // ..................................................................................................\r\n _storeValue(_parseValue());\r\n }\r\n continue; // parse again in a different state\r\n } else { // ====================================================================================================\r\n throw new ParsingError(`Unexpected internal state ${state}`, line, column);\r\n }\r\n\r\n newline = false;\r\n ++column;\r\n }\r\n ++i;\r\n }\r\n\r\n if (state === 2) { // item\r\n throw new ParsingError(`Unexpected end of file in state ${state}`, line, column);\r\n }\r\n\r\n return result;\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\nimport readCIF from './readCIF';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nconst cRequiredAtomFields = [\r\n 'auth_seq_id',\r\n 'Cartn_x',\r\n 'Cartn_y',\r\n 'Cartn_z',\r\n 'label_atom_id',\r\n];\r\n\r\nconst cSecondaryCoding = {\r\n helx: 'helix',\r\n turn: 'turn',\r\n strn: 'strand',\r\n};\r\n\r\nfunction getTypeFromId(string) {\r\n const typeId = /[A-Za-z]+/.exec(string);\r\n if (!typeId) {\r\n return null;\r\n }\r\n\r\n return cSecondaryCoding[typeId[0].toLowerCase()];\r\n}\r\n\r\n/**\r\n * Make valid object an array\r\n * @param arrayLikeObject\r\n * @return {array, object} array or object\r\n */\r\nfunction arrize(arrayLikeObject) {\r\n if (arrayLikeObject === null || arrayLikeObject === undefined || _.isArray(arrayLikeObject)) {\r\n return arrayLikeObject;\r\n }\r\n return [arrayLikeObject];\r\n}\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\nclass AtomDataError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'AtomDataError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction _getOperations(operList) {\r\n if (!operList) {\r\n return null;\r\n }\r\n const idc = arrize(operList.id);\r\n const { matrix, vector } = operList;\r\n if (!idc || !matrix || !vector) {\r\n return null;\r\n }\r\n\r\n const ops = [];\r\n for (let i = 0, n = idc.length; i < n; ++i) {\r\n const mtx = new THREE.Matrix4();\r\n const { elements } = mtx;\r\n\r\n for (let row = 0; row < 3; ++row) {\r\n const matrixData = matrix[row + 1];\r\n elements[row] = arrize(matrixData[1])[i];\r\n elements[row + 4] = arrize(matrixData[2])[i];\r\n elements[row + 8] = arrize(matrixData[3])[i];\r\n elements[row + 12] = arrize(vector[row + 1])[i];\r\n }\r\n ops[idc[i]] = mtx;\r\n }\r\n return ops;\r\n}\r\n\r\nfunction _extractOperations(assemblyGen, opsDict) {\r\n assemblyGen = _.isString(assemblyGen) ? assemblyGen : `${assemblyGen}`;\r\n const l = assemblyGen.replace(/\\)\\s*\\(/g, '!').replace(/[()']/g, '');\r\n const groupStr = l.split('!');\r\n const gps = [];\r\n\r\n for (let grIdx = 0, grCount = groupStr.length; grIdx < grCount; ++grIdx) {\r\n const gr = groupStr[grIdx].split(',');\r\n const gp = [];\r\n let idx = 0;\r\n for (let i = 0, n = gr.length; i < n; ++i) {\r\n const s = gr[i];\r\n if (s.includes('-')) {\r\n const es = s.split('-');\r\n let j = parseInt(es[0], 10);\r\n const m = parseInt(es[1], 10);\r\n for (; j <= m; ++j) {\r\n gp[idx++] = opsDict[j];\r\n }\r\n } else {\r\n gp[idx++] = opsDict[s];\r\n }\r\n }\r\n gps.push(gp);\r\n }\r\n\r\n // traverse all groups from the end of array and make all mults\r\n const matrices = [];\r\n let cnt = 0;\r\n function traverse(level, mtx) {\r\n for (let ii = 0, nn = gps[level].length; ii < nn; ++ii) {\r\n const newMtx = mtx ? mtx.clone() : new THREE.Matrix4();\r\n newMtx.multiplyMatrices(gps[level][ii], newMtx);\r\n if (level === 0) {\r\n matrices[cnt++] = newMtx;\r\n } else {\r\n traverse(level - 1, newMtx);\r\n }\r\n }\r\n }\r\n traverse(gps.length - 1);\r\n return matrices;\r\n}\r\n\r\nclass CIFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this.asymDict = {};\r\n this.molecules = [];\r\n this._options.fileType = 'cif';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*data_/i.test(data);\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing CIF file..');\r\n const data = readCIF(this._data);\r\n return this._toComplex(data);\r\n }\r\n\r\n /**\r\n * Convert intermediate structure into our valid Complex object\r\n * @param cifData intermediate CIF object\r\n * @returns {Complex} complex\r\n * @private\r\n */\r\n _toComplex(cifData) {\r\n const complex = new Complex();\r\n const complexData = cifData[Object.keys(cifData)[0]];\r\n this._extractAtoms(complex, complexData);\r\n this._extractSecondary(complex, complexData);\r\n this._extractAssemblies(complex, complexData);\r\n this._extractMolecules(complex, complexData);\r\n this._extractMetadata(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n\r\n return complex;\r\n }\r\n\r\n /**\r\n * Extract metadata\r\n * @param complex structure to fill\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n\r\n _extractMetadata(complex, complexData) {\r\n const { metadata } = complex;\r\n metadata.id = complexData.entry.id;\r\n metadata.classification = complexData.struct_keywords.pdbx_keywords;\r\n const databaserev = complexData.database_PDB_rev;\r\n metadata.date = (databaserev && databaserev.date_original) ? databaserev.date_original : '';\r\n metadata.format = 'cif';\r\n metadata.title = [];\r\n metadata.title[0] = complexData.struct.title;\r\n }\r\n\r\n /**\r\n * Extract molecules information from CIF structure (should be called strictly after _extractAtoms)\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractMolecules(complex, complexData) {\r\n const molData = complexData.entity;\r\n const names = arrize(molData.pdbx_description);\r\n const count = names.length;\r\n let i;\r\n\r\n // molecules names from cif\r\n for (i = 0; i < count; i++) {\r\n if (this.molecules[i]) { // molecule was created during atoms processing\r\n this.molecules[i].name = names[i];\r\n } else { // molecule wasn't created, because there is no atom which is contained\r\n this.molecules[i] = { name: names[i], residues: [] };\r\n }\r\n }\r\n\r\n // reorganize molecules for complex and check chains\r\n const molecules = complex.getMolecules();\r\n for (i = 0; i < count; i++) {\r\n const molecule = this.molecules[i];\r\n molecules[i] = new Molecule(complex, molecule.name, i + 1);\r\n molecules[i].residues = molecule.residues;\r\n }\r\n }\r\n\r\n /**\r\n * Extract atom information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAtoms(complex, complexData) {\r\n const atomData = complexData.atom_site;\r\n if (!atomData) {\r\n throw new AtomDataError('CIF parsing error: atom_site is not specified!');\r\n }\r\n\r\n for (let f = 0, n = cRequiredAtomFields.length; f < n; ++f) {\r\n if (!atomData[cRequiredAtomFields[f]]) {\r\n throw new AtomDataError(`CIF parsing error: requires field ${cRequiredAtomFields[f]} not found!`);\r\n }\r\n }\r\n\r\n const { asymDict } = this;\r\n // required fields\r\n const resIdc = arrize(atomData.auth_seq_id);\r\n const x = arrize(atomData.Cartn_x);\r\n const y = arrize(atomData.Cartn_y);\r\n const z = arrize(atomData.Cartn_z);\r\n const names = arrize(atomData.label_atom_id);\r\n const count = names.length;\r\n // optional fields\r\n const group = arrize(atomData.group_PDB) || [];\r\n const chainIdc = arrize(atomData.auth_asym_id) || [];\r\n const chainLabelIdc = arrize(atomData.label_asym_id) || [];\r\n const serials = arrize(atomData.id) || [];\r\n const iCodes = arrize(atomData.pdbx_PDB_ins_code) || [];\r\n const resNames = arrize(atomData.label_comp_id) || [];\r\n const elements = arrize(atomData.type_symbol) || [];\r\n const tempFactors = arrize(atomData.B_iso_or_equiv) || [];\r\n const occupancies = arrize(atomData.occupancy) || [];\r\n const charges = arrize(atomData.pdbx_formal_charge) || [];\r\n const altLocs = arrize(atomData.label_alt_id) || [];\r\n const models = arrize(atomData.pdbx_PDB_model_num) || [];\r\n const molecules = arrize(atomData.label_entity_id) || [];\r\n\r\n let chain = null;\r\n let residue = null;\r\n for (let i = 0; i < count; ++i) {\r\n const model = models[i] || 1;\r\n if (model !== 1) {\r\n continue;\r\n }\r\n const chainID = String(chainIdc[i] || ' ');\r\n\r\n if (!chain || chain.getName() !== chainID) {\r\n chain = complex.getChain(chainID) || complex.addChain(chainID);\r\n }\r\n asymDict[String(chainLabelIdc[i] || ' ')] = chainID;\r\n const resSeq = resIdc[i];\r\n const iCode = String(iCodes[i] || ' ');\r\n const resName = String(resNames[i] || '');\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n residue = chain.addResidue(resName, resSeq, iCode);\r\n\r\n // store residue in appropriate molecule\r\n const moleculeIdx = molecules[i] - 1;\r\n let entity = this.molecules[moleculeIdx];\r\n if (!entity) { // create new molecule if it hasn't been created\r\n this.molecules[moleculeIdx] = { name: '', residues: [] };\r\n entity = this.molecules[moleculeIdx];\r\n }\r\n entity.residues.push(residue);\r\n }\r\n\r\n const name = names[i];\r\n const element = elements[i] || nameToElement(name);\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name.trim()];\r\n const xyz = new THREE.Vector3(x[i], y[i], z[i]);\r\n const het = group[i] === 'HETATM' || false;\r\n const serial = serials[i] || i;\r\n const tempFactor = tempFactors[i] || 0.0;\r\n const occupancy = occupancies[i] || 0.0;\r\n const altLoc = String(altLocs[i] || '');\r\n const charge = charges[i] || 0;\r\n\r\n residue.addAtom(\r\n name,\r\n type,\r\n xyz,\r\n role,\r\n het,\r\n serial,\r\n altLoc,\r\n occupancy,\r\n tempFactor,\r\n charge,\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Extracts secondary structure information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex - complex to fill\r\n * @param complexData - CIF complex data\r\n * @private\r\n */\r\n _extractSecondary(complex, complexData) {\r\n if (complexData.struct_conf) {\r\n this._extractConfs(complex, complexData.struct_conf);\r\n }\r\n if (complexData.struct_sheet_range) {\r\n this._extractSheets(complex, complexData.struct_sheet_range);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts sheets information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param sheetData\r\n * @private\r\n */\r\n _extractSheets(complex, sheetData) {\r\n const { asymDict } = this;\r\n if (!sheetData.sheet_id || !sheetData.id || !sheetData.beg_label_seq_id || !sheetData.end_label_seq_id\r\n || !sheetData.beg_label_asym_id) {\r\n return;\r\n }\r\n // Strand(sheet, start, end, sense, cur, prev)\r\n const sheets = complex._sheets;\r\n\r\n function getSheet(name) {\r\n const n = sheets.length;\r\n for (let i = 0; i < n; ++i) {\r\n if (sheets[i]._name === name) {\r\n return sheets[i];\r\n }\r\n }\r\n sheets[n] = new Sheet(name, 0);\r\n return sheets[n];\r\n }\r\n\r\n const sheetNames = arrize(sheetData.sheet_id);\r\n const strandNames = arrize(sheetData.id);\r\n const starts = arrize(sheetData.beg_auth_seq_id);\r\n const ends = arrize(sheetData.end_auth_seq_id);\r\n const chains = arrize(sheetData.beg_label_asym_id);\r\n const stICodes = arrize(sheetData.pdbx_beg_PDB_ins_code) || [];\r\n const endICodes = arrize(sheetData.pdbx_end_PDB_ins_code) || [];\r\n\r\n for (let i = 0, n = strandNames.length; i < n; ++i) {\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n const sheet = getSheet(sheetNames[i]);\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n\r\n const strand = new Strand(sheet, start[0], end[0], 0, null, null);\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = strand;\r\n }\r\n sheet.addStrand(strand);\r\n complex.structures.push(strand);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts helix/turn/strand(?) information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param helicesData\r\n * @private\r\n */\r\n _extractConfs(complex, helicesData) {\r\n const { asymDict } = this;\r\n if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id\r\n || !helicesData.beg_label_asym_id) {\r\n return;\r\n }\r\n\r\n const types = arrize(helicesData.conf_type_id);\r\n const starts = arrize(helicesData.beg_auth_seq_id);\r\n const stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || [];\r\n const ends = arrize(helicesData.end_auth_seq_id);\r\n const endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || [];\r\n const comments = arrize(helicesData.details) || [];\r\n const lengths = arrize(helicesData.pdbx_PDB_helix_length) || [];\r\n const helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || [];\r\n const names = arrize(helicesData.id) || [];\r\n const chains = arrize(helicesData.beg_label_asym_id);\r\n\r\n for (let i = 0, n = types.length; i < n; ++i) {\r\n const type = getTypeFromId(types[i]);\r\n if (!type) {\r\n continue;\r\n }\r\n const name = names[i] || types[i];\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n const comment = comments[i] || '';\r\n const length = lengths[i] || 0;\r\n const helixClass = helixClasses[i] || ' ';\r\n let struct;\r\n if (type === 'helix') {\r\n const idx = complex._helices.length;\r\n struct = new Helix(helixClass, start[0], end[0], idx, name, comment, length);\r\n complex.addHelix(struct);\r\n complex.structures.push(struct);\r\n } else if (type === 'turn') {\r\n struct = new StructuralElement(StructuralElement.Type.TURN, start[0], end[0]);\r\n complex.structures.push(struct);\r\n } else {\r\n struct = null;\r\n }\r\n if (!struct) {\r\n continue;\r\n }\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = struct;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Extract biological assemblies information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAssemblies(complex, complexData) {\r\n const { asymDict } = this;\r\n const asmGen = complexData.pdbx_struct_assembly_gen;\r\n if (!asmGen) {\r\n return;\r\n }\r\n\r\n const asmIdx = arrize(asmGen.assembly_id);\r\n const asmOper = arrize(asmGen.oper_expression);\r\n const asmList = arrize(asmGen.asym_id_list);\r\n if (!asmIdx || !asmOper || !asmList) {\r\n return;\r\n }\r\n\r\n const operList = _getOperations(complexData.pdbx_struct_oper_list);\r\n if (!operList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = asmIdx.length; i < n; ++i) {\r\n const asm = new Assembly(complex);\r\n const assemblyOps = _extractOperations(asmOper[i], operList);\r\n const entries = asmList[i].split(',');\r\n for (let ii = 0, nn = entries.length; ii < nn; ++ii) {\r\n const chain = entries[ii].trim();\r\n if (chain.length > 0) {\r\n asm.addChain(asymDict[chain]);\r\n }\r\n }\r\n asm.matrices = assemblyOps;\r\n complex.units.push(asm);\r\n }\r\n }\r\n}\r\n\r\nCIFParser.formats = ['cif', 'mmcif'];\r\nCIFParser.extensions = ['.cif', '.mmcif'];\r\n\r\nexport default CIFParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Volume from '../../chem/Volume';\r\n\r\nexport const valueType = {\r\n singular: 0,\r\n vector: 1,\r\n array: 2,\r\n buffer: 3,\r\n};\r\n\r\nclass VolumeModel {\r\n _xyz2crs = [];\r\n\r\n _origin = new THREE.Vector3(0, 0, 0);\r\n\r\n constructor() {\r\n this._header = {};\r\n this._boxSize = new THREE.Vector3();\r\n this._boxStart = new THREE.Vector3();\r\n this._header.delta = {};\r\n this._header.extent = [];\r\n this._header.nstart = [];\r\n this._header.grid = [];\r\n this._header.crs2xyz = [];\r\n this._header.cellDims = new THREE.Vector3();\r\n this._header.angles = [];\r\n this._header.origin = new THREE.Vector3(0, 0, 0);\r\n this._header.dmin = 0;\r\n this._header.dmean = 0;\r\n this._header.dmax = 0;\r\n }\r\n\r\n _typedCheck() {\r\n if (_.isTypedArray(this._buff)) {\r\n this._buff = this._buff.buffer;\r\n } else if (!_.isArrayBuffer(this._buff)) {\r\n throw new TypeError('Expected ArrayBuffer or TypedArray');\r\n }\r\n }\r\n\r\n _fillHeader(headerFormat, arrays) {\r\n for (const key in headerFormat) {\r\n if (headerFormat.hasOwnProperty(key)) {\r\n switch (headerFormat[key][0]) {\r\n case valueType.singular:\r\n this._header[key] = arrays[headerFormat[key][1]][headerFormat[key][2]];\r\n break;\r\n\r\n case valueType.array:\r\n this._parseArray(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.vector:\r\n this._parseVector(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.buffer:\r\n this._header[key] = new Uint8Array(\r\n arrays[headerFormat[key][1]],\r\n [headerFormat[key][2]] * 4,\r\n [headerFormat[key][3]] * 4,\r\n );\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _parseVector(vector, arr, pos) {\r\n [vector.x, vector.y, vector.z] = [arr[pos], arr[pos + 1], arr[pos + 2]];\r\n }\r\n\r\n _parseArray(vector, arr, pos) {\r\n vector[0] = arr[pos];\r\n vector[1] = arr[pos + 1];\r\n vector[2] = arr[pos + 2];\r\n }\r\n\r\n _parseHeader(_buffer) {}\r\n\r\n _setAxisIndices() {}\r\n\r\n _setOrigins() {}\r\n\r\n _getAxis() {\r\n const header = this._header;\r\n\r\n const xScale = header.cellDims.x / header.grid[0];\r\n const yScale = header.cellDims.y / header.grid[1];\r\n const zScale = header.cellDims.z / header.grid[2];\r\n\r\n const [alpha, beta, gamma] = header.angles;\r\n\r\n const z1 = Math.cos(beta);\r\n const z2 = (Math.cos(alpha) - Math.cos(beta)\r\n * Math.cos(gamma)) / Math.sin(gamma);\r\n const z3 = Math.sqrt(1.0 - z1 * z1 - z2 * z2);\r\n\r\n const xaxis = new THREE.Vector3(xScale, 0, 0);\r\n const yaxis = new THREE.Vector3(Math.cos(gamma) * yScale, Math.sin(gamma) * yScale, 0);\r\n const zaxis = new THREE.Vector3(z1 * zScale, z2 * zScale, z3 * zScale);\r\n\r\n return [xaxis, yaxis, zaxis];\r\n }\r\n\r\n _getXYZdim() {\r\n return [this._header.extent[this._xyz2crs[0]],\r\n this._header.extent[this._xyz2crs[1]],\r\n this._header.extent[this._xyz2crs[2]]];\r\n }\r\n\r\n _getVolumeInfo() {\r\n const volInfo = _.pick(this._header, ['dmean', 'dmin', 'dmax', 'sd', 'delta']);\r\n volInfo.obtuseAngle = this._header.angles.map((angle) => Number(angle >= (Math.PI / 2)));\r\n return volInfo;\r\n }\r\n\r\n _setBoxParams(xaxis, yaxis, zaxis) {\r\n // if axes are not orthogonal, the origins might not match with box coordinates - need to make shift\r\n let shiftX = 0;\r\n let shiftY = 0;\r\n const [alpha, beta, gamma] = this._header.angles;\r\n\r\n if (gamma >= Math.PI / 2) {\r\n shiftX += Math.abs(yaxis.x);\r\n }\r\n if (beta >= Math.PI / 2) {\r\n shiftX += Math.abs(zaxis.x);\r\n }\r\n if (alpha >= Math.PI / 2) {\r\n shiftY += Math.abs(zaxis.y);\r\n }\r\n\r\n this._boxStart = new THREE.Vector3(this._origin.x - shiftX, this._origin.y - shiftY, this._origin.z);\r\n this._boxSize = new THREE.Vector3(\r\n Math.abs(xaxis.x) + Math.abs(yaxis.x) + Math.abs(zaxis.x),\r\n Math.abs(yaxis.y) + Math.abs(zaxis.y),\r\n Math.abs(zaxis.z),\r\n );\r\n\r\n const delta = (axe, proj) => (Math.abs(axe[proj]) / this._boxSize[proj]);\r\n this._header.delta.x = delta(yaxis, 'x');\r\n this._header.delta.y = delta(zaxis, 'x');\r\n this._header.delta.z = delta(zaxis, 'y');\r\n }\r\n\r\n _getXYZbox() {\r\n return new THREE.Box3(this._boxStart.clone(), this._boxStart.clone().add(this._boxSize));\r\n }\r\n\r\n _toXYZData() {}\r\n\r\n parse(data) {\r\n this._parseHeader(data);\r\n this._setOrigins();\r\n return new Volume(Float32Array, this._getXYZdim(), this._getXYZbox(), 1, this._toXYZData(), this._getVolumeInfo());\r\n }\r\n}\r\n\r\nexport default VolumeModel;\r\n","import Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\nconst CCP4Header = {\r\n extent: [valueType.array, 'u32', 0],\r\n type: [valueType.singular, 'u32', 3],\r\n nstart: [valueType.array, 'i32', 4],\r\n grid: [valueType.array, 'u32', 7],\r\n cellDims: [valueType.vector, 'f32', 10],\r\n angles: [valueType.array, 'f32', 13],\r\n crs2xyz: [valueType.array, 'i32', 16],\r\n dmin: [valueType.singular, 'f32', 19],\r\n dmax: [valueType.singular, 'f32', 20],\r\n dmean: [valueType.singular, 'f32', 21],\r\n ispg: [valueType.singular, 'u32', 22],\r\n nsymbt: [valueType.singular, 'u32', 23],\r\n lksflg: [valueType.singular, 'u32', 24],\r\n customData: [valueType.buffer, 'buffer', 25, 9],\r\n origin: [valueType.vector, 'f32', 34],\r\n map: [valueType.buffer, 'buffer', 52, 1],\r\n machine: [valueType.singular, 'u32', 53],\r\n sd: [valueType.singular, 'f32', 54],\r\n nlabel: [valueType.singular, 'f32', 55],\r\n label: [valueType.buffer, 'buffer', 56, 200],\r\n};\r\n\r\nclass Ccp4Model extends VolumeModel {\r\n // read header (http://www.ccp4.ac.uk/html/maplib.html)\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n const arrays = {};\r\n arrays.u32 = new Uint32Array(this._buff, 0, 56);\r\n arrays.i32 = new Int32Array(this._buff, 0, 56);\r\n arrays.f32 = new Float32Array(this._buff, 0, 56);\r\n arrays.buffer = this._buff;\r\n const header = this._header;\r\n\r\n this._fillHeader(CCP4Header, arrays);\r\n\r\n // calculate non-orthogonal unit cell coordinates\r\n header.angles.forEach((angle, i, a) => { a[i] *= Math.PI / 180.0; });\r\n }\r\n\r\n _setAxisIndices() {\r\n const header = this._header;\r\n\r\n if (header.cellDims.x === 0.0 && header.cellDims.y === 0.0 && header.cellDims.z === 0.0) {\r\n header.cellDims.set(1.0, 1.0, 1.0);\r\n }\r\n // Apply header conversion\r\n // Mapping between CCP4 column, row, section and VMD x, y, z.\r\n const { crs2xyz } = this._header;\r\n if (crs2xyz[0] === 0 && crs2xyz[1] === 0 && crs2xyz[2] === 0) {\r\n crs2xyz[0] = 1;\r\n crs2xyz[1] = 2;\r\n crs2xyz[2] = 3;\r\n }\r\n\r\n const xyz2crs = this._xyz2crs;\r\n xyz2crs[crs2xyz[0] - 1] = 0; // column\r\n xyz2crs[crs2xyz[1] - 1] = 1; // row\r\n xyz2crs[crs2xyz[2] - 1] = 2; // section\r\n }\r\n\r\n _setOrigins() {\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n const header = this._header;\r\n const xyz2crs = this._xyz2crs;\r\n // Handle both MRC-2000 and older format maps\r\n if (header.origin.x === 0.0 && header.origin.y === 0.0 && header.origin.z === 0.0) {\r\n this._origin.addScaledVector(xaxis, header.nstart[xyz2crs[0]]);\r\n this._origin.addScaledVector(yaxis, header.nstart[xyz2crs[1]]);\r\n this._origin.addScaledVector(zaxis, header.nstart[xyz2crs[2]]);\r\n } else {\r\n this._origin = header.origin;\r\n // Use ORIGIN records rather than old n[xyz]start records\r\n // http://www2.mrc-lmb.cam.ac.uk/image2000.html\r\n // XXX the ORIGIN field is only used by the EM community, and\r\n // has undefined meaning for non-orthogonal maps and/or non-cubic voxels, etc.\r\n }\r\n xaxis.multiplyScalar(header.extent[xyz2crs[0]] - 1);\r\n yaxis.multiplyScalar(header.extent[xyz2crs[1]] - 1);\r\n zaxis.multiplyScalar(header.extent[xyz2crs[2]] - 1);\r\n\r\n if (header.type === 2) {\r\n this._data = new Float32Array(\r\n this._buff,\r\n 1024 + header.nsymbt,\r\n header.extent[0] * header.extent[1] * header.extent[2],\r\n );\r\n } else {\r\n throw new Error(`CCP4: Unsupported format ${header.type}`);\r\n }\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const data = this._data;\r\n const xyz2crs = this._xyz2crs;\r\n const xyzData = new Float32Array(data.length);\r\n\r\n const dim = this._getXYZdim();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n\r\n let crsIdx = 0;\r\n const coord = [];\r\n let x;\r\n let y;\r\n let z;\r\n for (coord[2] = 0; coord[2] < header.extent[2]; coord[2]++) { // Site\r\n for (coord[1] = 0; coord[1] < header.extent[1]; coord[1]++) { // Row\r\n for (coord[0] = 0; coord[0] < header.extent[0]; coord[0]++, crsIdx++) { // Column\r\n x = coord[xyz2crs[0]];\r\n y = coord[xyz2crs[1]];\r\n z = coord[xyz2crs[2]];\r\n xyzData[x + xSize * (y + ySize * z)] = data[crsIdx];\r\n }\r\n }\r\n }\r\n\r\n return xyzData;\r\n }\r\n}\r\n\r\nclass CCP4Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'ccp4';\r\n this.model = new Ccp4Model();\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false; // Autodetection is not implemented yet\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nCCP4Parser.formats = ['ccp4'];\r\nCCP4Parser.extensions = ['.ccp4', '.map', '.mrc'];\r\nCCP4Parser.binary = true;\r\n\r\nexport default CCP4Parser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element, Molecule } = chem;\r\n\r\nclass XYZParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n this._options.fileType = 'xyz';\r\n this._fileName = options.name;\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*\\d+ *\\n[^\\n]*\\n\\s*\\w{1,3}\\s+-?\\d/.test(data);\r\n }\r\n\r\n _parseToAtomsInf(source) {\r\n const endnAtoms = source.indexOf('\\n');\r\n const nAtoms = parseInt(source.substring(0, endnAtoms), 10);\r\n const endComment = source.indexOf('\\n', endnAtoms + 1);\r\n let comment = source.slice(endnAtoms + 1, endComment).trim();\r\n if (comment.length === 0) {\r\n comment = this._fileName;\r\n }\r\n\r\n const startAtomsInf = endComment + source.substring(endComment).search(/\\S/);\r\n this._atomsInf = source.substring(startAtomsInf).split(/[\\s,]*\\n[\\s,]*/);\r\n if (!Number.isNaN(nAtoms) && (this._atomsInf.length - 1 !== nAtoms)) {\r\n this._complex.error = {\r\n message: 'wrong number of atoms',\r\n };\r\n return;\r\n }\r\n\r\n this._complex.metadata.format = 'xyz';\r\n this._complex.name = comment;\r\n }\r\n\r\n _parseAtomsInf() {\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n\r\n const chain = this._complex.addChain('A');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0; i < this._atomsInf.length - 1; i++) {\r\n const words = this._atomsInf[i].split(/[\\s,]+/);\r\n\r\n if (words.length !== 4) {\r\n this._complex.error = {\r\n message: 'missed parameters',\r\n };\r\n break;\r\n }\r\n\r\n const serial = i + 1;\r\n const name = words[0];\r\n const xyz = new THREE.Vector3(parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3]));\r\n const type = Element.getByName(name);\r\n const role = undefined;\r\n\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n const molecule = new Molecule(this._complex, this._complex.name, 1);\r\n molecule.residues = residue;\r\n this._complex._molecules[0] = molecule;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n\r\n this._parseToAtomsInf(this._data);\r\n this._parseAtomsInf();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n return result;\r\n }\r\n\r\n static formats = ['xyz'];\r\n\r\n static extensions = ['.xyz'];\r\n}\r\n\r\nexport default XYZParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element } = chem;\r\n\r\nclass PubChemParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'pubchem+json';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && data[0] === '{';\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing PubChem JSON file...');\r\n return this._toComplex(JSON.parse(this._data));\r\n }\r\n\r\n _toComplex(jsonData) {\r\n const complex = new Complex();\r\n const complexData = jsonData.PC_Compounds && jsonData.PC_Compounds[0];\r\n if (complexData) {\r\n this._extractAtoms(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n }\r\n return complex;\r\n }\r\n\r\n _extractAtoms(complex, complexData) {\r\n let aids = complexData.atoms && complexData.atoms.aid;\r\n let elements = aids && complexData.atoms.element;\r\n if (!elements || aids.length !== elements.length) {\r\n throw new Error('Unable to parse atom elements');\r\n }\r\n elements = _.fromPairs(_.zip(aids, elements));\r\n const atoms = {};\r\n\r\n const coords = complexData.coords && complexData.coords[0];\r\n const model = coords && coords.conformers && coords.conformers[0];\r\n const xs = model && model.x;\r\n const ys = model && model.y;\r\n const zs = (model && model.z) || [];\r\n aids = coords && coords.aid;\r\n if (!aids || !xs || !ys) {\r\n throw new Error('Coordinates are not found in the file');\r\n }\r\n\r\n const chain = complex.addChain(' ');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0, n = aids.length; i < n; ++i) {\r\n const aid = aids[i];\r\n const element = Element.ByAtomicNumber[elements[aid]];\r\n const xyz = new THREE.Vector3(xs[i], ys[i], zs[i] || 0.0);\r\n atoms[aid] = residue.addAtom(element.name, element, xyz, undefined, true, aid, ' ', 1.0, 0.0, 0);\r\n }\r\n\r\n const aids1 = complexData.bonds && complexData.bonds.aid1;\r\n const aids2 = complexData.bonds && complexData.bonds.aid2;\r\n const orders = (complexData.bonds && complexData.bonds.order) || [];\r\n if (!aids1 || !aids2 || aids1.length !== aids2.length) {\r\n return;\r\n }\r\n\r\n for (let j = 0, m = aids1.length; j < m; ++j) {\r\n complex.addBond(atoms[aids1[j]], atoms[aids2[j]], orders[j] || 1, 0, true);\r\n }\r\n }\r\n}\r\n\r\nPubChemParser.formats = ['pubchem', 'pubchem+json', 'pc'];\r\nPubChemParser.extensions = ['.json'];\r\n\r\nexport default PubChemParser;\r\n","import _ from 'lodash';\r\n\r\nexport default class SDFStream {\r\n constructor(data) {\r\n this._strings = data.split(/\\r?\\n|\\r/);\r\n this._currentStart = 0;\r\n this._currentStringIndx = 0;\r\n }\r\n\r\n setStart(start) {\r\n if (start >= this._strings.length) {\r\n this._currentStart = this._strings.length - 1;\r\n this._currentStringIndx = this._strings.length - 1;\r\n } else {\r\n this._currentStart = start;\r\n this._currentStringIndx = start;\r\n }\r\n }\r\n\r\n getNextString() {\r\n return this._strings[++this._currentStringIndx];\r\n }\r\n\r\n getCurrentString() {\r\n return this._strings[this._currentStringIndx];\r\n }\r\n\r\n getStringFromStart(numb) {\r\n this._currentStringIndx = this._currentStart + numb;\r\n return this._strings[this._currentStart + numb];\r\n }\r\n\r\n findNextDataItem() {\r\n let curStr = this.getNextString();\r\n let res = false;\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n if (curStr.match(/>\\s+<(.*)>/)) {\r\n res = true;\r\n break;\r\n }\r\n curStr = this.getNextString();\r\n }\r\n\r\n return res;\r\n }\r\n\r\n findNextCompoundStart() {\r\n let curStr = this.getCurrentString();\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n curStr = this.getNextString();\r\n }\r\n this.setStart(++this._currentStringIndx);\r\n return this.probablyHaveDataToParse();\r\n }\r\n\r\n probablyHaveDataToParse() {\r\n return this._currentStringIndx < this._strings.length - 2;\r\n }\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport SDFStream from './SDFStream';\r\nimport Assembly from '../../chem/Assembly';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst chargeMap = [0, 3, 2, 1, 0, -1, -2, -3];\r\nconst orderMap = [0, 1, 2, 3, 1, 1, 1, 2];\r\nconst typeMap = [\r\n Bond.BondType.UNKNOWN, // 0 - error\r\n Bond.BondType.COVALENT, // 1 - single\r\n Bond.BondType.COVALENT, // 2 - double\r\n Bond.BondType.COVALENT, // 3 - triple\r\n Bond.BondType.AROMATIC, // 4 - aromatic\r\n Bond.BondType.UNKNOWN, // 5 - single or double\r\n Bond.BondType.AROMATIC, // 6 - single or aromatic\r\n Bond.BondType.AROMATIC, // 7 - double or aromatic\r\n // 8 - any\r\n // 9 - coordination\r\n // 10 - hydrogen\r\n];\r\n\r\nconst sdfAndMolRegexp = /.*(M\\s\\sEND).*|.*(^$$$$).*|.*>\\s+<(.+)>.*/;\r\nconst sdfRegExp = /.*($$$$).*|.*>\\s+<(.+)>.*/;\r\n\r\nconst fileFormat = { SDF: 'sdf', MOL: 'mol' };\r\n\r\nconst possibleNameTags = ['PUBCHEM_IUPAC_TRADITIONAL_NAME', /PUBCHEM_(.+)_NAME/, /(.+)name/, /(.+)NAME/];\r\nconst possibleIDTags = ['PUBCHEM_COMPOUND_CID', 'id', 'ID', /.*CID/, /.*ID/, /.*id/];\r\nconst possibleTitleTags = ['msg', 'MSG', 'message', 'title', 'description', 'desc'];\r\nconst tagsNames = ['name', 'id', 'title'];\r\nconst tags = { name: possibleNameTags, id: possibleIDTags, title: possibleTitleTags };\r\n\r\nfunction buildChainID(index) {\r\n if (!index) {\r\n return 'A';\r\n }\r\n\r\n const codes = [];\r\n while (index) {\r\n codes.push(65 + (index % 26));\r\n index = Math.trunc(index / 26);\r\n }\r\n if (codes.length > 1) {\r\n codes.reverse();\r\n codes[0] -= 1;\r\n }\r\n\r\n return String.fromCharCode(...codes);\r\n}\r\n\r\nexport default class SDFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._format = 'sdf';\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._molecules = null;\r\n this._metadata = {};\r\n this._metadata.molecules = [];\r\n this._currentMolProps = {};\r\n this._compoundIndx = -1;\r\n this._assemblies = [];\r\n this._atomsParsed = 0;\r\n this._atomsIndexes = [];\r\n }\r\n\r\n canProbablyParse(data) {\r\n return _.isString(data) && sdfAndMolRegexp.test(data);\r\n }\r\n\r\n _parseHeader(stream) {\r\n const molecule = {};\r\n molecule.name = stream.getStringFromStart(0);\r\n const date = parseInt(stream.getStringFromStart(1).substr(10, 6).trim(), 10);\r\n molecule.date = date.toString() || '';\r\n molecule.title = stream.getStringFromStart(2);\r\n this._metadata.molecules.push(molecule);\r\n }\r\n\r\n _parseAtoms(stream, atomsNum) {\r\n let curStr;\r\n let serial = this._atomsParsed;\r\n\r\n // each molecule = chain\\residue\r\n const chainID = buildChainID(this._compoundIndx);\r\n const resName = 'UNK';\r\n const resSeq = 1;\r\n\r\n this._chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = this._chain.addResidue(resName, resSeq, ' ');\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n curStr = stream.getNextString();\r\n serial++;\r\n const x = parseFloat(curStr.substr(0, 10));\r\n const y = parseFloat(curStr.substr(10, 10));\r\n const z = parseFloat(curStr.substr(20, 10));\r\n const charge = chargeMap[parseInt(curStr.substr(36, 3), 10)];\r\n const xyz = new THREE.Vector3(x, y, z);\r\n let name = curStr.substr(31, 3).trim().toUpperCase();\r\n const type = Element.getByName(name);\r\n if (!this._atomsIndexes[name]) {\r\n this._atomsIndexes[name] = 0;\r\n }\r\n this._atomsIndexes[name] += 1;\r\n name += this._atomsIndexes[name]; // every atom need to have unique name.\r\n\r\n this._residue.addAtom(name, type, xyz, undefined, true, serial, ' ', 1.0, 0.0, charge);\r\n }\r\n }\r\n\r\n _parseBonds(stream, bondsNum) {\r\n let curStr;\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n curStr = stream.getNextString();\r\n let atom1 = parseInt(curStr.substr(0, 3), 10) + this._atomsParsed;\r\n let atom2 = parseInt(curStr.substr(3, 3), 10) + this._atomsParsed;\r\n const bondType = parseInt(curStr.substr(6, 3), 10);\r\n\r\n if (atom1 > atom2) {\r\n [atom1, atom2] = [atom2, atom1];\r\n }\r\n this._complex.addBond(\r\n atom1,\r\n atom2,\r\n orderMap[bondType] || 1,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true,\r\n );\r\n }\r\n }\r\n\r\n _parseMOL(stream) {\r\n this._compoundIndx++;\r\n\r\n this._parseHeader(stream);\r\n const countsLine = stream.getStringFromStart(3);\r\n const atomsNum = parseInt(countsLine.substr(0, 3), 10);\r\n const bondsNum = parseInt(countsLine.substr(3, 3), 10);\r\n this._parseAtoms(stream, atomsNum);\r\n this._parseBonds(stream, bondsNum);\r\n\r\n this._atomsParsed += atomsNum;\r\n\r\n this._metadata.molecules[this._compoundIndx]._residues = [];\r\n this._metadata.molecules[this._compoundIndx]._residues.push(this._residue);\r\n }\r\n\r\n _parseDataItem(stream) {\r\n const tag = stream.getCurrentString();\r\n\r\n let data = [];\r\n let curStr = stream.getNextString();\r\n\r\n // read data\r\n while (curStr.trim() !== '') {\r\n data.push(curStr);\r\n curStr = stream.getNextString();\r\n }\r\n if (data.length === 1) {\r\n [data] = data;\r\n }\r\n this._currentMolProps[tag.replace(/[<>]/g, '').trim()] = data;\r\n }\r\n\r\n _parseCompound(stream) {\r\n this._parseMOL(stream);\r\n\r\n // parse data items block\r\n if (this._format === fileFormat.SDF) {\r\n this._currentMolProps = {};\r\n while (stream.findNextDataItem()) {\r\n this._parseDataItem(stream);\r\n }\r\n if (Object.keys(this._currentMolProps).length !== 0) {\r\n const molecule = this._metadata.molecules[this._compoundIndx];\r\n molecule.props = this._currentMolProps;\r\n this._tryToUpdateMoleculeData(molecule);\r\n }\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n console.log('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _buildAssemblies() {\r\n const chains = this._complex._chains;\r\n\r\n if (chains.length === 1) {\r\n return this._assemblies;\r\n }\r\n\r\n for (let i = 0; i < chains.length; i++) {\r\n const assembly = new Assembly(this._complex);\r\n const matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n assembly.addChain(chains[i]._name);\r\n this._assemblies.push(assembly);\r\n }\r\n\r\n return this._assemblies;\r\n }\r\n\r\n _buildMolecules() {\r\n this._complex._molecules = [];\r\n const { molecules } = this._metadata;\r\n for (let i = 0; i < molecules.length; i++) {\r\n const molecule = new Molecule(this._complex, molecules[i].name, i + 1);\r\n molecule.residues = molecules[i]._residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n\r\n return this._complex._molecules;\r\n }\r\n\r\n _searchTag(tag, props) {\r\n for (let i = 0; i < props.length; i++) {\r\n if ((tag instanceof RegExp && tag.test(props[i].tag)) || tag === props[i].tag) {\r\n return props[i].data;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToFind(tagsList, props) {\r\n for (let j = 0; j < tagsList.length; j++) {\r\n const res = this._searchTag(tagsList[j], props);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToUpdateMoleculeData(molecule) {\r\n let res = false;\r\n for (let i = 0; i < tagsNames.length; i++) {\r\n const tagPossibleNames = tags[tagsNames[i]];\r\n const data = this._tryToFind(tagPossibleNames, molecule.props);\r\n if (data) {\r\n molecule[tagsNames[i]] = data;\r\n res = true;\r\n }\r\n }\r\n\r\n molecule.name = molecule.name || molecule.id;\r\n if (molecule.name.match(/^\\d+$/)) {\r\n molecule.name = `CID: ${molecule.name}`;\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _finalizeMetadata() {\r\n const { molecules } = this._metadata;\r\n const { metadata } = this._complex;\r\n const complex = this._complex;\r\n\r\n if (molecules.length === 1) {\r\n complex.name = molecules[0].name;\r\n metadata.title = molecules[0].title;\r\n metadata.date = molecules[0].date;\r\n metadata.properties = molecules[0].props;\r\n } else if (molecules.length > 1) {\r\n metadata.molecules = [];\r\n for (let i = 0; i < molecules.length; i++) {\r\n metadata.molecules.push({\r\n name: molecules[i].name, date: molecules[i].date, title: molecules[i].title, properties: molecules[i].props,\r\n });\r\n }\r\n }\r\n }\r\n\r\n _finalize() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n this._complex._finalizeBonds();\r\n this._fixBondsArray();\r\n this._finalizeMetadata();\r\n this._buildAssemblies();\r\n this._complex.units = this._complex.units.concat(this._assemblies);\r\n this._buildMolecules();\r\n this._complex.finalize({\r\n needAutoBonding: false, detectAromaticLoops: false, enableEditing: false, serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n defineFormat(data) {\r\n let format;\r\n if (sdfRegExp.test(data)) {\r\n format = fileFormat.SDF;\r\n } else {\r\n format = fileFormat.MOL;\r\n }\r\n\r\n return format;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const stream = new SDFStream(this._data);\r\n\r\n this._format = this.defineFormat(this._data);\r\n result.metadata.format = this._format;\r\n\r\n do {\r\n this._parseCompound(stream);\r\n } while (stream.findNextCompoundStart());\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nSDFParser.formats = ['mol', 'sdf'];\r\nSDFParser.extensions = ['.mol', '.sdf'];\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\n// http://www.uoxray.uoregon.edu/tnt/manual/node104.html\r\nconst DSN6Header = {\r\n nstart: [valueType.array, 'i16', 0],\r\n extent: [valueType.array, 'i16', 3],\r\n grid: [valueType.array, 'i16', 6],\r\n cellDims: [valueType.vector, 'i16', 9],\r\n angles: [valueType.array, 'i16', 12],\r\n div: [valueType.singular, 'i16', 15],\r\n adder: [valueType.singular, 'i16', 16],\r\n scaleFactor: [valueType.singular, 'i16', 17],\r\n};\r\n\r\nclass DSN6Model extends VolumeModel {\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n\r\n const arrays = {};\r\n arrays.i16 = new Int16Array(this._buff);\r\n\r\n // check and reverse if big endian\r\n if (arrays.i16[18] !== 100) {\r\n for (let i = 0, n = arrays.i16.length; i < n; ++i) {\r\n const val = arrays.i16[i];\r\n arrays.i16[i] = ((val & 0xff) << 8) | ((val >> 8) & 0xff);\r\n }\r\n }\r\n if (arrays.i16[18] !== 100) {\r\n throw new Error('DSN6: Incorrect format ');\r\n }\r\n\r\n const header = this._header;\r\n\r\n this._fillHeader(DSN6Header, arrays);\r\n header.cellDims.multiplyScalar(1.0 / header.scaleFactor);\r\n header.angles.forEach((angle, i, a) => { a[i] *= (Math.PI / 180.0) / header.scaleFactor; });\r\n header.div /= 100;\r\n }\r\n\r\n _setAxisIndices() {\r\n this._xyz2crs[0] = 0;\r\n this._xyz2crs[1] = 1;\r\n this._xyz2crs[2] = 2;\r\n }\r\n\r\n _setOrigins() {\r\n const header = this._header;\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n this._origin.addScaledVector(xaxis, header.nstart[0]);\r\n this._origin.addScaledVector(yaxis, header.nstart[1]);\r\n this._origin.addScaledVector(zaxis, header.nstart[2]);\r\n\r\n xaxis.multiplyScalar(header.extent[0]);\r\n yaxis.multiplyScalar(header.extent[1]);\r\n zaxis.multiplyScalar(header.extent[2]);\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _pointCalculate(xyzData, byteBuffer, z, y, x, pos, i) {\r\n const header = this._header;\r\n\r\n if (x < header.extent[0] && y < header.extent[1] && z < header.extent[2]) {\r\n const idx = x + header.extent[0] * (y + header.extent[1] * z);\r\n xyzData[idx] = (byteBuffer[pos.counter] - header.adder) / header.div;\r\n ++pos.counter;\r\n } else {\r\n pos.counter += 8 - i;\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n _blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos) {\r\n for (let k = 0; k < 8; ++k) {\r\n const z = 8 * zBlock + k;\r\n for (let j = 0; j < 8; ++j) {\r\n const y = 8 * yBlock + j;\r\n let inRange = true;\r\n let i = 0;\r\n while (inRange && i < 8) {\r\n const x = 8 * xBlock + i;\r\n inRange = this._pointCalculate(xyzData, byteBuffer, z, y, x, pos, i);\r\n i++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const byteBuffer = new Uint8Array(this._buff);\r\n const xyzData = new Float32Array(header.extent[0] * header.extent[1] * header.extent[2]);\r\n\r\n const blocks = new THREE.Vector3(header.extent[0] / 8, header.extent[1] / 8, header.extent[2] / 8);\r\n\r\n const pos = {};\r\n pos.counter = 512;\r\n\r\n for (let zBlock = 0; zBlock < blocks.z; ++zBlock) {\r\n for (let yBlock = 0; yBlock < blocks.y; ++yBlock) {\r\n for (let xBlock = 0; xBlock < blocks.x; ++xBlock) {\r\n this._blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos);\r\n }\r\n }\r\n }\r\n this._calculateInfoParams(xyzData);\r\n return xyzData;\r\n }\r\n\r\n _calculateInfoParams(xyzData) {\r\n this._header.dmean /= xyzData.length;\r\n let dispersion = 0;\r\n let minDensity = xyzData[0];\r\n let maxDensity = xyzData[0];\r\n for (let j = 0; j < xyzData.length; j++) {\r\n dispersion += (this._header.dmean - xyzData[j]) ** 2;\r\n\r\n if (xyzData[j] < minDensity) {\r\n minDensity = xyzData[j];\r\n }\r\n if (xyzData[j] > maxDensity) {\r\n maxDensity = xyzData[j];\r\n }\r\n }\r\n this._header.sd = Math.sqrt(dispersion / xyzData.length);\r\n this._header.dmax = maxDensity;\r\n this._header.dmin = minDensity;\r\n }\r\n}\r\n\r\nclass DSN6Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'dsn6';\r\n this.model = new DSN6Model();\r\n }\r\n\r\n static canParse(data, options) {\r\n if (!data) {\r\n return false;\r\n }\r\n return data instanceof ArrayBuffer && Parser.checkDataTypeOptions(options, 'dsn6');\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false;\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nDSN6Parser.formats = ['dsn6'];\r\nDSN6Parser.extensions = ['.dsn6', '.omap'];\r\nDSN6Parser.binary = true;\r\n\r\nexport default DSN6Parser;\r\n","import PDBStream from './PDBStream';\r\n\r\n/**\r\n * Little helper class for GRO Parser usage.\r\n * @extends PDBStream\r\n */\r\nclass GROReader extends PDBStream {\r\n constructor(data) {\r\n super(data);\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n this.next();\r\n }\r\n\r\n /**\r\n * Getting end of string.\r\n * @returns {Number} Pointer to end of string\r\n */\r\n getNext() {\r\n return this._next;\r\n }\r\n}\r\n\r\nexport default GROReader;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport GROReader from './GROReader';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Molecule,\r\n} = chem;\r\n\r\n/**\r\n * Gromos87 file format parser.\r\n * @extends Parser\r\n */\r\nclass GROParser extends Parser {\r\n /**\r\n * Create parser for .gro file format\r\n *\r\n * @param {String} data Input file\r\n * @param {String} options Input options (optional field)\r\n */\r\n constructor(data, options) {\r\n super(data, options);\r\n /** @type Date */\r\n this._time = null; // Time in ps, optional field for animations\r\n /** @type Number */\r\n this._numAtoms = null; // Number of atoms in complex\r\n /** @type Number */\r\n this._residueNumber = null; // Number of exact residue\r\n /** @type String */\r\n this._residueName = ''; // Scientific name of exact residue\r\n /** @type String */\r\n this._atomName = ''; // Scientific name of exact atom\r\n /** @type Number */\r\n this._atomNumber = null; // Sorted number of exact atom\r\n /** @type Array */\r\n this._atomPosition = []; // Array which contains x, y, z position of exact atom\r\n /** @type Array */\r\n this._atomVelocity = []; // Array which contains x, y, z velocity of exact atom (optional)\r\n /** @type Complex */\r\n this._complex = null; // Complex structure for unified molecule representation\r\n /** @type Vector3 */\r\n this._molecules = []; // Molecules array\r\n /** @type Molecule */\r\n this._molecule = null; // Single molecule\r\n /** @type String */\r\n this._options.filetype = 'gro'; // Extension of data file.\r\n }\r\n\r\n /**\r\n * General check for possibility of parsing.\r\n * @param {String} data - Input file\r\n * @returns {boolean} true if this file is in ascii, false otherwise\r\n */\r\n canProbablyParse(data) {\r\n return _.isString(this._data) && /^\\s*[^\\n]*\\n\\s*\\d+ *\\n\\s*\\d+[^\\n\\d]{3}\\s*\\w+\\s*\\d+\\s*-?\\d/.test(data);\r\n }\r\n\r\n /**\r\n * Parsing title of molecule complex.\r\n * NOTE: that names are ESTIMATES, there is no strict rules in Gromos87 standard for first line in input file.\r\n * @param {GROReader} line - Line containing title and time.\r\n */\r\n _parseTitle(line) {\r\n const { metadata } = this._complex;\r\n metadata.id = line.readLine().trim();\r\n metadata.name = metadata.id.slice(metadata.id.lastIndexOf('\\\\') + 1, metadata.id.lastIndexOf('.'));\r\n metadata.format = 'gro';\r\n }\r\n\r\n /**\r\n * Parsing line containing number of atoms information.\r\n * @param {GROReader} line - Line containing number of atoms.\r\n */\r\n _parseNumberOfAtoms(line) {\r\n this._numAtoms = line.readInt(0, line.getNext());\r\n if (Number.isNaN(this._numAtoms)) {\r\n throw new Error('Line 2 is not representing atom number. Consider checking input file');\r\n }\r\n }\r\n\r\n /**\r\n * Parsing line containing information about residues, atoms etc. Also information about box vectors.\r\n * Format of atoms MUST (by Gromos87 standard) be this: (note that numbering starts not from 0, but from 1!)\r\n * ResidueNumber[1 - 5] ResidueName[6 - 10] AtomName[11 - 15] AtomNumber[16 - 20] Position[21 - 45] Velocity[46 - 69]\r\n * @param {GROReader} line - Line containing information about atom.\r\n */\r\n _parseAtom(line) {\r\n this._residueNumber = line.readInt(1, 5);\r\n this._residueName = line.readString(6, 10).trim();\r\n this._atomName = line.readString(11, 15).trim();\r\n this._atomNumber = line.readInt(16, 20);\r\n const positionX = line.readFloat(21, 28) * 10;\r\n const positionY = line.readFloat(29, 36) * 10;\r\n const positionZ = line.readFloat(37, 45) * 10;\r\n if (Number.isNaN(positionX) || Number.isNaN(positionY) || Number.isNaN(positionZ)) {\r\n this._complex.error = {\r\n message: `Atom position is invalid in \"${line.readLine()}\"`,\r\n };\r\n return;\r\n }\r\n /* const velocityX = line.readFloat(46, 53);\r\n const velocityY = line.readFloat(54, 61);\r\n const velocityZ = line.readFloat(62, 69); */\r\n /* Adding residue and atom to complex structure */\r\n const type = Element.getByName(this._atomName[0]); /* MAGIC 0. REASONS: This name is something like \"CA\", where\r\n C - is an element an A is something else. But what about Calcium? */\r\n if (type.fullName === 'Unknown') {\r\n this._complex.error = {\r\n message: `${this._atomName[0]} hasn't been recognised as an atom name.`,\r\n };\r\n return;\r\n }\r\n const role = Element.Role[this._atomName];\r\n /* Firstly, create a dummy chain */\r\n let chain = this._chain;\r\n if (!chain) {\r\n this._chain = chain = this._complex.addChain('A');\r\n }\r\n /* Secondly, add residue to that chain */\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== this._residueNumber) {\r\n this._residue = residue = chain.addResidue(this._residueName, this._residueNumber, ' ');\r\n }\r\n /* Lastly, add atom to that residue */\r\n this._atomPosition = new THREE.Vector3(positionX, positionY, positionZ);\r\n /* Adding default constants to correct atom addition process */\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n residue.addAtom(this._atomName, type, this._atomPosition, role, het, this._atomNumber, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n /**\r\n * Some finalizing procedures. In '.gro' file format there is only 1 chain and 1 molecule.\r\n */\r\n _finalize() {\r\n const molecule = new Molecule(this._complex, this._complex.metadata.name, 1);\r\n // aggregate residues from chain\r\n molecule.residues = this._chain._residues;\r\n molecule._chains = this._chain;\r\n this._complex._molecules[0] = molecule;\r\n this._molecules.push(molecule);\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n /**\r\n * Main parsing procedure.\r\n * @returns {Complex} Complex structure for visualizing.\r\n */\r\n parseSync() {\r\n /* Create \"Complex\" variable */\r\n const result = this._complex = new Complex();\r\n /* Parse input file line-by-line */\r\n const reader = new GROReader(this._data);\r\n let counter = 0; /* Simple counter regarding to format of .gro file */\r\n /* First two lines - technical information, other lines - Atoms */\r\n this._parseTitle(reader);\r\n reader.next();\r\n this._parseNumberOfAtoms(reader);\r\n reader.next();\r\n for (counter = 0; counter < this._numAtoms; ++counter) {\r\n if (!reader.end()) {\r\n this._parseAtom(reader);\r\n reader.next();\r\n } else break;\r\n }\r\n /* If number of atoms in second line is less then actual atoms in file */\r\n if (counter < this._numAtoms) {\r\n this._complex.error = {\r\n message: 'File ended unexpectedly.',\r\n };\r\n }\r\n /* Catch errors occurred in parsing process */\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n\r\n /* Finalizing data */\r\n this._finalize();\r\n\r\n /* Cleaning up */\r\n this._atomPosition = null;\r\n this._complex = null;\r\n this._molecules = null;\r\n this._molecule = null;\r\n\r\n /* Return resulting Complex variable */\r\n return result;\r\n }\r\n}\r\n\r\nGROParser.formats = ['gro'];\r\nGROParser.extensions = ['.gro'];\r\n\r\nexport default GROParser;\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst orderMap = {\r\n un: 0,\r\n 1: 1,\r\n 2: 2,\r\n 3: 3,\r\n ar: 1,\r\n am: 1,\r\n nc: 0,\r\n du: 1,\r\n};\r\nconst typeMap = {\r\n un: Bond.BondType.UNKNOWN, // unknown (cannot be determined from the parameter tables)\r\n 1: Bond.BondType.COVALENT, // single\r\n 2: Bond.BondType.COVALENT, // double\r\n 3: Bond.BondType.COVALENT, // triple\r\n ar: Bond.BondType.AROMATIC, // aromatic\r\n am: Bond.BondType.COVALENT, // amide\r\n nc: Bond.BondType.UNKNOWN, // not connected\r\n du: Bond.BondType.COVALENT, // dummy\r\n};\r\n\r\nconst resNumberRegex = /\\d+$/;\r\nconst spacesRegex = /\\s+/;\r\n\r\nfunction splitToFields(str) {\r\n return str.trim().split(spacesRegex);\r\n}\r\n/* There is no jsdoc documentation because of eslint corrections:\r\n * not all Parser methods are implemented\r\n */\r\n\r\nclass MOL2Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._compoundIndx = -1;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n\r\n this._currPosIdx = 0;\r\n this._currStartIdx = 0;\r\n\r\n this._serialAtomMap = {};\r\n\r\n this._options.fileType = 'mol2';\r\n }\r\n\r\n _parseRawStrings(data) {\r\n return data.split(/\\r?\\n|\\r/);\r\n }\r\n\r\n _toStringFromStart(numb, MOL2Data) {\r\n const newPosIdx = this._currStartIdx + numb;\r\n this._currPosIdx = (newPosIdx < MOL2Data.length) ? newPosIdx : this._currStartIdx;\r\n }\r\n\r\n _toHeaderString(header, MOL2Data) {\r\n this._toStringFromStart(0, MOL2Data);\r\n while (this._currPosIdx < MOL2Data.length) {\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`)) {\r\n return;\r\n }\r\n this._currPosIdx++;\r\n }\r\n this._toStringFromStart(0, MOL2Data);\r\n }\r\n\r\n _toStringFromHeader(header, numb, MOL2Data) {\r\n this._toHeaderString(header, MOL2Data);\r\n const newPosIdx = this._currPosIdx + numb;\r\n\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`) && newPosIdx < MOL2Data.length) {\r\n this._currPosIdx = newPosIdx;\r\n }\r\n }\r\n\r\n _setStart(startPos, MOL2Data) {\r\n if (startPos >= MOL2Data.length) {\r\n this._currStartIdx = this._currPosIdx = MOL2Data.length - 1;\r\n } else {\r\n this._currStartIdx = this._currPosIdx = startPos;\r\n }\r\n }\r\n\r\n _probablyHaveDataToParse(MOL2Data) {\r\n return this._currPosIdx < MOL2Data.length - 2;\r\n }\r\n\r\n _findNextCompoundStart(MOL2Data) {\r\n while (this._currPosIdx < MOL2Data.length && MOL2Data[this._currPosIdx].trim() !== '@MOLECULE>') {\r\n this._currPosIdx++;\r\n }\r\n this._setStart(++this._currPosIdx, MOL2Data);\r\n return this._probablyHaveDataToParse(MOL2Data);\r\n }\r\n\r\n _parseMolecule(MOL2Data) {\r\n this._toHeaderString('MOLECULE', MOL2Data);\r\n\r\n const { metadata } = this._complex;\r\n metadata.name = MOL2Data[++this._currPosIdx];\r\n metadata.format = 'mol2';\r\n\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = this._compoundIndx + 1;\r\n this._molecules.push(this._molecule);\r\n }\r\n\r\n /* Atom format description:\r\n * atomId atomName x y z element [resSeq [resName [charge [statusBit]]]]\r\n * statusBits is the internal SYBYL status bits associated with the atom.\r\n * These should never be set by the user.\r\n * Source: http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf\r\n */\r\n _parseAtoms(atomsNum, MOL2Data) {\r\n this._toHeaderString('ATOM', MOL2Data);\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 6) {\r\n throw new Error('MOL2 parsing error: Not enough information to create atom!');\r\n }\r\n const atomId = parseInt(parsedStr[0], 10);\r\n const atomName = parsedStr[1];\r\n\r\n const x = parseFloat(parsedStr[2]);\r\n const y = parseFloat(parsedStr[3]);\r\n const z = parseFloat(parsedStr[4]);\r\n\r\n const element = parsedStr[5].split('.')[0].toUpperCase();\r\n\r\n let charge = 0;\r\n if (parsedStr.length >= 9) {\r\n charge = parseFloat(parsedStr[8]) || 0.0;\r\n }\r\n\r\n let chain = this._chain;\r\n if (!chain) {\r\n // .mol2 may contain information about multiple molecules, but they can't be visualized\r\n // at the same time now. There is no need to create different chain IDs then.\r\n this._chain = chain = this._complex.getChain('A') || this._complex.addChain('A');\r\n this._residue = null;\r\n }\r\n if (!this._setResidue(parsedStr)) {\r\n continue;\r\n }\r\n\r\n // These fields are not listed in mol2 format. Set them default.\r\n // Atoms and het atoms doesn't differ in .mol2,\r\n // but het atoms have special residues. It can be used in next updates\r\n const het = false;\r\n const altLoc = ' ';\r\n const occupancy = 1.0;\r\n const tempFactor = 0.0;\r\n const type = Element.getByName(element);\r\n const role = Element.Role[atomName];\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n this._residue.addAtom(atomName, type, xyz, role, het, atomId, altLoc, occupancy, tempFactor, charge);\r\n }\r\n }\r\n\r\n _setResidue(parsedStr) {\r\n let resSeq = 1;\r\n let resName = 'UNK'; // The same meaning has '<0>' in some mol2 files\r\n\r\n if (parsedStr.length >= 7) {\r\n resSeq = parseInt(parsedStr[6], 10);\r\n }\r\n if (parsedStr.length >= 8 && parsedStr[7] !== '<0>') {\r\n resName = parsedStr[7].replace(resNumberRegex, '');\r\n }\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return false;\r\n }\r\n }\r\n const residue = this._residue;\r\n const chain = this._chain;\r\n if (!residue || residue.getSequence() !== resSeq) {\r\n this._residue = chain.addResidue(resName, resSeq, 'A');\r\n }\r\n return true;\r\n }\r\n\r\n /* Bond format description\r\n * bondId originAtomId targetAtomId bondType [statusBits]\r\n */\r\n _parseBonds(bondsNum, MOL2Data) {\r\n this._toHeaderString('BOND', MOL2Data);\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 3) {\r\n throw new Error('MOL2 parsing error: Missing information about bonds!');\r\n }\r\n\r\n let originAtomId = parseInt(parsedStr[1], 10);\r\n let targetAtomId = parseInt(parsedStr[2], 10);\r\n const bondType = parsedStr[3];\r\n\r\n if (originAtomId > targetAtomId) {\r\n [originAtomId, targetAtomId] = [targetAtomId, originAtomId];\r\n }\r\n this._complex.addBond(\r\n originAtomId,\r\n targetAtomId,\r\n orderMap[bondType] || 0,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true,\r\n );\r\n }\r\n }\r\n\r\n _fixSerialAtoms() {\r\n const atoms = this._complex._atoms;\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n this._serialAtomMap[atom.serial] = atom;\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n if (Object.keys(serialAtomMap).length === 0) {\r\n throw new Error('MOL2 parsing error: Missing atom information!');\r\n }\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _finalizeMolecules() {\r\n // Get chain from complex\r\n const chain = this._complex._chains[0];\r\n this._complex._molecules = [];\r\n\r\n // Aggregate residues from chains\r\n // (to be precise from the chain 'A')\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const currMolecule = this._molecules[i];\r\n const molResidues = chain._residues;\r\n const molecule = new Molecule(this._complex, currMolecule._name, i + 1);\r\n molecule.residues = molResidues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _finalize() {\r\n this._complex._finalizeBonds();\r\n this._fixSerialAtoms();\r\n this._fixBondsArray();\r\n this._finalizeMolecules();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _parseCompound(MOL2Data) {\r\n this._compoundIndx++;\r\n this._parseMolecule(MOL2Data);\r\n\r\n // Ignoring comments and everything before @MOLECULE block\r\n this._toStringFromHeader('MOLECULE', 2, MOL2Data);\r\n\r\n const parsedStr = MOL2Data[this._currPosIdx].trim().split(spacesRegex);\r\n const atomsNum = parsedStr[0];\r\n const bondsNum = parsedStr[1];\r\n\r\n this._parseAtoms(atomsNum, MOL2Data);\r\n this._parseBonds(bondsNum, MOL2Data);\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const MOL2Data = this._parseRawStrings(this._data);\r\n do {\r\n this._parseCompound(MOL2Data);\r\n } while (this._findNextCompoundStart(MOL2Data));\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nMOL2Parser.formats = ['mol2'];\r\nMOL2Parser.extensions = ['.mol2', '.ml2', '.sy2'];\r\n\r\nexport default MOL2Parser;\r\n","import ParserList from './parsers/ParserList';\r\n\r\nimport PDBParser from './parsers/PDBParser';\r\nimport CMLParser from './parsers/CMLParser';\r\nimport MMTFParser from './parsers/MMTFParser';\r\nimport CIFParser from './parsers/CIFParser';\r\nimport CCP4Parser from './parsers/CCP4Parser';\r\nimport XYZParser from './parsers/XYZParser';\r\nimport PubChemParser from './parsers/PubChemParser';\r\nimport SDFParser from './parsers/SDFParser';\r\nimport DSN6Parser from './parsers/DSN6Parser';\r\nimport GROParser from './parsers/GROParser';\r\nimport MOL2Parser from './parsers/MOL2Parser';\r\n\r\nexport default new ParserList([\r\n // note: order might be important\r\n PDBParser,\r\n CIFParser,\r\n MMTFParser,\r\n XYZParser,\r\n CMLParser,\r\n PubChemParser,\r\n SDFParser,\r\n CCP4Parser,\r\n DSN6Parser,\r\n GROParser,\r\n MOL2Parser,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available exporters.\r\n * @extends EntityList\r\n */\r\nclass ExporterList extends EntityList {\r\n /**\r\n * Create a list of exporters.\r\n * The exporters are indexed by supported data formats (`.formats` and\r\n * `.extensions` properties of a Exporter subclass).\r\n * The Exporters can be retrieved later by matching against specs (see {@link ExporterList#find}).\r\n *\r\n * @param {!Array=} someExporters A list of {@link Exporter} subclasses to\r\n * automatically register at creation time.\r\n * @see ExporterList#register\r\n */\r\n constructor(someExporters = []) {\r\n super(someExporters, ['formats']);\r\n }\r\n\r\n /**\r\n * Find a suitable exporter for data.\r\n *\r\n * @param {Object} specs Exporter specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {*=} specs.data Data to export.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ExporterList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Exporter {\r\n constructor(source, options) {\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n exportSync() {\r\n throw new Error('Exporting to this source is not implemented');\r\n }\r\n\r\n export() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Export aborted'));\r\n }\r\n return resolve(this.exportSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Exporter.prototype);\r\n","import _ from 'lodash';\r\nimport { Matrix4 } from 'three';\r\n\r\nexport default class PDBResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._currentStr = -1;\r\n this._tag = null;\r\n this._fixedNumeration = false;\r\n this._numeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n\r\n getResult() {\r\n this.writeString('\\n', 81, 81);\r\n return this._resultArray.join('');\r\n }\r\n\r\n _currentStrLength() {\r\n const curStr = this._resultArray[this._currentStr];\r\n return curStr ? curStr.length : 0;\r\n }\r\n\r\n // numeration can be number or boolean\r\n // if numeration is number then just put this number to 8-10 pos in string\r\n // if numeration is boolean then increase number for all new strings\r\n newTag(tag, numeration) {\r\n if (!tag) {\r\n this._tag = null;\r\n } else {\r\n this._tag = tag;\r\n }\r\n if (!_.isUndefined(numeration)) {\r\n if (_.isNumber(numeration)) {\r\n this._tagStrNum = numeration;\r\n this._numeration = true;\r\n this._fixedNumeration = true;\r\n } else if (_.isBoolean(numeration)) {\r\n this._tagStrNum = 0;\r\n this._numeration = numeration;\r\n this._fixedNumeration = false;\r\n }\r\n } else {\r\n this._numeration = false;\r\n this._fixedNumeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n }\r\n\r\n newString(tag) {\r\n this.writeString('\\n', 81, 81);\r\n this._currentStr++;\r\n this._resultArray.push('');\r\n\r\n if (tag) {\r\n this.writeString(tag, 1, 6);\r\n } else if (this._tag) {\r\n this.writeString(this._tag, 1, 6);\r\n }\r\n\r\n if (this._numeration) {\r\n if (!this._fixedNumeration) {\r\n this._tagStrNum++;\r\n }\r\n if (this._tagStrNum !== 1) {\r\n this.writeString(this._tagStrNum.toString(), 10, 8);\r\n }\r\n }\r\n }\r\n\r\n writeEntireString(string, maxStrPos, concat) {\r\n if (!maxStrPos) {\r\n maxStrPos = 81;\r\n }\r\n for (let j = 0; j < string.length; j++) {\r\n if (this._currentStrLength() === maxStrPos && j !== string.length - 1) {\r\n this.newString();\r\n if (concat) { // pretty hardcoddy\r\n this.writeString(concat.tag, concat.begin, concat.end);\r\n }\r\n }\r\n if (string[j] === '\\n') {\r\n this.newString();\r\n } else {\r\n this.writeString(string[j]);\r\n }\r\n }\r\n }\r\n\r\n writeString(string, begin, end) {\r\n let curStr = this._resultArray[this._currentStr];\r\n let str;\r\n\r\n const curStrLength = curStr ? curStr.length : 0;\r\n\r\n if (_.isUndefined(string)) {\r\n return;\r\n }\r\n\r\n if (!_.isNumber(begin)) {\r\n begin = curStrLength + 1;\r\n }\r\n\r\n if (!_.isNumber(end)) {\r\n end = curStrLength + string.length;\r\n }\r\n\r\n if (!_.isString(string)) {\r\n str = string.toString();\r\n } else {\r\n str = string;\r\n }\r\n\r\n const finish = begin < end ? end : begin;\r\n const start = begin < end ? begin : end;\r\n\r\n if (str.length > Math.abs(begin - end) + 1) {\r\n str = str.substr(0, Math.abs(begin - end + 1));\r\n }\r\n\r\n // spaces before start of new data\r\n if (start > curStrLength + 1) {\r\n this._resultArray[this._currentStr] += ' '.repeat(start - curStrLength - 1);\r\n } else if (start <= curStrLength) {\r\n const cStr = this._resultArray[this._currentStr];\r\n this._resultArray[this._currentStr] = cStr.slice(0, start - 1);\r\n }\r\n\r\n // if reverse order\r\n // reverse order of end and begin means that user wants to align text right\r\n if (end < begin) {\r\n const len = begin - end + 1;\r\n str = ' '.repeat(len - str.length) + str;\r\n }\r\n\r\n // some hardcode fix for space between string numeration and data\r\n // (see pdb file format description)\r\n if (start === 11 && this._numeration && this._tagStrNum !== 1) {\r\n str = ` ${str}`;\r\n }\r\n\r\n // append new data to string\r\n this._resultArray[this._currentStr] += str;\r\n curStr = this._resultArray[this._currentStr];\r\n\r\n if (finish > curStr.length) {\r\n this._resultArray[this._currentStr] += ' '.repeat(finish - curStr.length);\r\n }\r\n }\r\n\r\n writeBondsArray(bonds, atom) {\r\n const bondsArrays = this._getSubArrays(bonds, 4);\r\n\r\n for (let k = 0; k < bondsArrays.length; k++) {\r\n this.newString();\r\n this.writeString(atom.serial, 11, 7);\r\n\r\n for (let j = 0; j < bondsArrays[k].length; j++) {\r\n const serial = (bondsArrays[k][j]._left.serial === atom.serial)\r\n ? bondsArrays[k][j]._right.serial : bondsArrays[k][j]._left.serial;\r\n\r\n this.writeString(serial, 16 + 5 * j, 12 + 5 * j);\r\n }\r\n }\r\n }\r\n\r\n _getSubArrays(arr, subArraySize) {\r\n const subArrays = [];\r\n for (let i = 0; i < arr.length; i += subArraySize) {\r\n subArrays.push(arr.slice(i, i + subArraySize));\r\n }\r\n return subArrays;\r\n }\r\n\r\n // function for writing matrix in Remark290 and Remark350 tags\r\n // (see pdb file description)\r\n writeMatrix(matrix, matrixIndx, tag) {\r\n for (let j = 0; j < 3; j++) {\r\n this.newString();\r\n this.writeString(tag, 14, 18);\r\n this.writeString((j + 1).toString(), 19, 19);\r\n this.writeString(matrixIndx.toString(), 23, 20);\r\n for (let k = 0; k < 3; k++) {\r\n const numb = parseFloat(matrix.elements[j * 4 + k]).toFixed(6);\r\n this.writeString(numb.toString(), 33 + k * 10, 24 + k * 10);\r\n }\r\n\r\n const numb = parseFloat(matrix.elements[j * 4 + 3]).toFixed(5);\r\n this.writeString(numb.toString(), 68, 55);\r\n }\r\n }\r\n\r\n writeMatrices(matrices, string) {\r\n if (!matrices) {\r\n return;\r\n }\r\n const matrix = new Matrix4();\r\n for (let j = 0; j < matrices.length; j++) {\r\n matrix.copy(matrices[j]).transpose();\r\n this.writeMatrix(matrix, j + 1, string);\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport Complex from '../../chem/Complex';\r\nimport Exporter from './Exporter';\r\nimport PDBResult from './PDBResult';\r\nimport Assembly from '../../chem/Assembly';\r\nimport { typeByPDBHelixClass } from '../../chem/Helix';\r\n\r\nexport default class PDBExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n this._tags = ['HEADER', 'TITLE', 'COMPND', 'REMARK', 'HELIX', 'SHEET', 'ATOM and HETATM', 'CONECT'];\r\n this._result = null;\r\n this._tagExtractors = {\r\n HEADER: this._extractHEADER,\r\n TITLE: this._extractTITLE,\r\n 'ATOM and HETATM': this._extractATOM,\r\n CONECT: this._extractCONECT,\r\n COMPND: this._extractCOMPND,\r\n REMARK: this._extractREMARK,\r\n HELIX: this._extractHELIX,\r\n SHEET: this._extractSHEET,\r\n };\r\n this._stringForRemark350 = 'COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN\\n'\r\n + 'BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE\\n'\r\n + 'MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS\\n'\r\n + 'GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND\\n'\r\n + 'CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.';\r\n\r\n this._stringForRemark290 = 'CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS\\n'\r\n + 'THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM\\n'\r\n + 'RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY\\n'\r\n + 'RELATED MOLECULES.';\r\n }\r\n\r\n exportSync() {\r\n const result = new PDBResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n for (let i = 0; i < this._tags.length; i++) {\r\n const tag = this._tags[i];\r\n const func = this._tagExtractors[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, result);\r\n }\r\n }\r\n\r\n this._result = result.getResult();\r\n\r\n return this._result;\r\n }\r\n\r\n _extractHEADER(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n result.newTag('HEADER');\r\n result.newString();\r\n if (metadata.classification) {\r\n result.writeString(metadata.classification, 11, 50);\r\n }\r\n if (metadata.date) {\r\n result.writeString(metadata.date, 51, 59);\r\n }\r\n if (metadata.id) {\r\n result.writeString(metadata.id, 63, 66);\r\n }\r\n }\r\n\r\n _extractTITLE(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n if (!metadata.title) {\r\n return;\r\n }\r\n result.newTag('TITLE', true);\r\n for (let i = 0; i < metadata.title.length; i++) {\r\n result.newString();\r\n result.writeString(metadata.title[i], 11, 80);\r\n }\r\n }\r\n\r\n _extractCONECT(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n\r\n const atoms = this._source._atoms;\r\n result.newTag('CONECT');\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const fixedBonds = atoms[i].bonds.filter((bond) => bond._fixed);\r\n if (fixedBonds.length !== 0) {\r\n result.writeBondsArray(fixedBonds.reverse(), atoms[i]);\r\n }\r\n }\r\n }\r\n\r\n _extractSHEET(result) {\r\n if (!this._source._sheets) {\r\n return;\r\n }\r\n\r\n result.newTag('SHEET');\r\n\r\n const sheets = this._source._sheets;\r\n for (let i = 0; i < sheets.length; i++) {\r\n if (sheets[i]._strands) {\r\n const strands = sheets[i]._strands;\r\n for (let j = 0; j < strands.length; j++) {\r\n result.newString();\r\n result.writeString(j + 1, 10, 8);\r\n result.writeString(sheets[i]._name, 14, 12);\r\n result.writeString(strands.length, 16, 15);\r\n result.writeString(strands[j].init._type._name, 18, 20);\r\n result.writeString(strands[j].init._chain._name, 22, 22);\r\n result.writeString(strands[j].init._sequence, 26, 23);\r\n result.writeString(strands[j].init._icode, 27, 27);\r\n result.writeString(strands[j].term._type._name, 29, 31);\r\n result.writeString(strands[j].init._chain._name, 33, 33);\r\n result.writeString(strands[j].term._sequence, 37, 34);\r\n result.writeString(strands[j].term._icode, 38, 38);\r\n result.writeString(strands[j].sense, 40, 39);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _extractHELIX(result) {\r\n if (!this._source._helices) {\r\n return;\r\n }\r\n\r\n result.newTag('HELIX');\r\n const helices = this._source._helices;\r\n for (let i = 0; i < helices.length; i++) {\r\n const helix = helices[i];\r\n const helixClass = _.invert(typeByPDBHelixClass);\r\n result.newString();\r\n result.writeString(helix.serial, 10, 8);\r\n result.writeString(helix.name, 14, 12);\r\n result.writeString(helix.init._type._name, 16, 18);\r\n result.writeString(helix.init._chain._name, 20, 20);\r\n result.writeString(helix.init._sequence, 25, 22);\r\n result.writeString(helix.init._icode, 26, 26);\r\n result.writeString(helix.term._type._name, 28, 30);\r\n result.writeString(helix.term._chain._name, 32, 32);\r\n result.writeString(helix.term._sequence, 37, 34);\r\n result.writeString(helix.term._icode, 38, 38);\r\n result.writeString(helixClass[helix.type], 40, 39);\r\n result.writeString(helix.comment, 41, 70);\r\n result.writeString(helix.length, 76, 72);\r\n }\r\n }\r\n\r\n _extractATOM(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n const atoms = this._source._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const tag = atoms[i].het ? 'HETATM' : 'ATOM';\r\n result.newString(tag);\r\n const startIndx = (atoms[i].element.name.length > 1 || atoms[i].name.length > 3) ? 13 : 14;\r\n result.writeString(atoms[i].serial, 11, 7);\r\n result.writeString(atoms[i].name, startIndx, 16);\r\n result.writeString(String.fromCharCode(atoms[i].location), 17, 17);\r\n result.writeString(atoms[i].residue._type._name, 20, 18);\r\n result.writeString(atoms[i].residue._chain._name, 22, 22);\r\n result.writeString(atoms[i].residue._sequence, 26, 23);\r\n result.writeString(atoms[i].residue._icode, 27, 27);\r\n result.writeString(atoms[i].position.x.toFixed(3), 38, 31);\r\n result.writeString(atoms[i].position.y.toFixed(3), 46, 39);\r\n result.writeString(atoms[i].position.z.toFixed(3), 54, 47);\r\n result.writeString(atoms[i].occupancy.toFixed(2), 60, 55);\r\n result.writeString(atoms[i].temperature.toFixed(2), 66, 61);\r\n result.writeString(atoms[i].element.name, 78, 77);\r\n if (atoms[i].charge) {\r\n result.writeString(atoms[i].charge, 79, 80);\r\n }\r\n }\r\n }\r\n\r\n _extractCOMPND(result) {\r\n if (!this._source._molecules) {\r\n return;\r\n }\r\n const molecules = this._source._molecules;\r\n result.newTag('COMPND', true);\r\n\r\n for (let i = 0; i < molecules.length; i++) {\r\n const chains = this._getMoleculeChains(molecules[i]);\r\n result.newString();\r\n result.writeString(`MOL_ID: ${molecules[i].index};`, 11, 80);\r\n result.newString();\r\n result.writeString(`MOLECULE: ${molecules[i].name};`, 11, 80);\r\n result.newString();\r\n result.writeString('CHAIN: ', 11, 18);\r\n const chainsString = `${chains.join(', ')};`;\r\n result.writeEntireString(chainsString, 81);\r\n }\r\n }\r\n\r\n _extractREMARK(result) {\r\n this._Remark290(result);\r\n this._Remark350(result);\r\n }\r\n\r\n _Remark290(result) {\r\n if (!this._source.symmetry) {\r\n return;\r\n }\r\n\r\n if (this._source.symmetry.length !== 0) {\r\n const matrices = this._source.symmetry;\r\n result.newTag('REMARK', 290);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark290);\r\n result.writeMatrices(matrices, 'SMTRY');\r\n result.newString();\r\n result.newString();\r\n result.writeString('REMARK: NULL', 11, 80);\r\n }\r\n }\r\n\r\n _Remark350(result) {\r\n if (!this._source.units) {\r\n return;\r\n }\r\n const { units } = this._source;\r\n let biomolIndx = 0;\r\n\r\n result.newTag('REMARK', 350);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark350);\r\n\r\n const assemblies = units.filter((unit) => unit instanceof Assembly);\r\n\r\n for (let i = 0; i < assemblies.length; i++) {\r\n result.newString();\r\n result.newString();\r\n biomolIndx++;\r\n result.writeString(`BIOMOLECULE: ${biomolIndx}`, 11, 80);\r\n const chains = assemblies[i].chains.join(', ');\r\n result.newString();\r\n result.writeString('APPLY THE FOLLOWING TO CHAINS: ');\r\n result.writeEntireString(chains, 69, { tag: 'AND CHAINS: ', begin: 31, end: 42 });\r\n\r\n const { matrices } = assemblies[i];\r\n result.writeMatrices(matrices, 'BIOMT');\r\n }\r\n }\r\n\r\n _getMoleculeChains(molecule) {\r\n function getChainName(residue) {\r\n return residue._chain._name;\r\n }\r\n const chainNames = molecule.residues.map(getChainName);\r\n return chainNames.filter((item, pos) => chainNames.indexOf(item) === pos);\r\n }\r\n}\r\n\r\nPDBExporter.formats = ['pdb'];\r\nPDBExporter.SourceClass = Complex;\r\n","import * as THREE from 'three';\r\n\r\nconst FBX_POS_SIZE = 3;\r\nconst FBX_NORM_SIZE = 3;\r\nconst FBX_COL_SIZE = 4;\r\n\r\nfunction copyFbxPoint3(src, srcIdx, dst, dstIdx) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n}\r\n\r\nfunction copyFbxPoint4(src, srcIdx, dst, dstIdx, value) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n dst[dstIdx + 3] = value;\r\n}\r\n\r\nconst vector4 = new THREE.Vector4();\r\nfunction copyTransformedPoint3(src, srcIdx, dst, dstIdx, opts) {\r\n vector4.set(src[srcIdx], src[srcIdx + 1], src[srcIdx + 2], opts.w);\r\n vector4.applyMatrix4(opts.matrix);\r\n dst[dstIdx] = vector4.x;\r\n dst[dstIdx + 1] = vector4.y;\r\n dst[dstIdx + 2] = vector4.z;\r\n}\r\n\r\nfunction setSubArray(src, dst, count, copyFunctor, functorOpts) {\r\n if ((dst.array.length - dst.start) / dst.stride < count\r\n || (src.array.length - src.start) / src.stride < count) {\r\n return; // we've got no space\r\n }\r\n if (src.stride === dst.stride) { // stride is the same\r\n dst.array.set(src.array, dst.start);\r\n } else {\r\n let idx = dst.start;\r\n let arridx = src.start;\r\n for (let i = 0; i < count; ++i, idx += dst.stride, arridx += src.stride) {\r\n copyFunctor(src.array, arridx, dst.array, idx, functorOpts);\r\n }\r\n }\r\n}\r\n\r\nexport default class FBXModel {\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.lastPos = 0;\r\n this.lastNorm = 0;\r\n this.lastCol = 0;\r\n this.lastIdx = 0;\r\n }\r\n\r\n init(vertsCount, indsCount) {\r\n this.positions = new Float32Array(vertsCount * FBX_POS_SIZE);\r\n this.normals = new Float32Array(vertsCount * FBX_NORM_SIZE);\r\n this.colors = new Float32Array(vertsCount * FBX_COL_SIZE);\r\n this.indices = new Int32Array(indsCount);\r\n }\r\n\r\n setPositions(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.positions,\r\n start: this.lastPos,\r\n stride: FBX_POS_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setTransformedPositions(array, start, count, stride, matrix) {\r\n let idx = this.lastPos;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 1 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_POS_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.positions, idx, opts);\r\n }\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setNormals(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.normals,\r\n start: this.lastNorm,\r\n stride: FBX_NORM_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setTransformedNormals(array, start, count, stride, matrix) {\r\n let idx = this.lastNorm;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 0 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_NORM_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.normals, idx, opts);\r\n }\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setColors(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.colors,\r\n start: this.lastCol,\r\n stride: FBX_COL_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint4, 1);\r\n this.lastCol += count * FBX_COL_SIZE;\r\n }\r\n\r\n setIndices(array, start, count) {\r\n this.indices.set(array, this.lastIdx);\r\n this.lastIdx += count;\r\n }\r\n\r\n setShiftedIndices(array, count, shift) {\r\n const shifted = array.map((x) => x + shift);\r\n this.setIndices(shifted, 0, count);\r\n }\r\n\r\n getVerticesNumber() {\r\n return this.lastPos / FBX_POS_SIZE;\r\n }\r\n\r\n addInstance(matrix, geo) {\r\n // add indices at first to take old number of vertices for shift\r\n const currentCount = this.getVerticesNumber();\r\n this.setShiftedIndices(geo.indices, geo.indices.length, currentCount);\r\n // simply write vertices at empty space\r\n const size = geo.itemSize;\r\n this.setTransformedPositions(geo.positions, 0, geo.vertsCount, size.position, matrix);\r\n this.setTransformedNormals(geo.normals, 0, geo.vertsCount, size.normal, matrix);\r\n this.setColors(geo.colors, 0, geo.vertsCount, size.color);\r\n }\r\n}\r\n","/** Base class for fbx geometry contains simply organized attributes: positions+normals+colors, indices. */\r\nexport default class FBXGeometry {\r\n /**\r\n * Create a base geo with necessary members.\r\n */\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.vertsCount = 0;\r\n this.itemSize = null;\r\n }\r\n\r\n /**\r\n * Initialize base geo storing items info from attributes.\r\n * @param {Object} geo - THREE.BufferGeometry.\r\n */\r\n init(geo, _info) {\r\n const { attributes } = geo;\r\n // save item size\r\n this.itemSize = {\r\n position: attributes.position.itemSize,\r\n normal: attributes.normal.itemSize,\r\n color: attributes.color.itemSize,\r\n };\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes and creates colors filled with defined value.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX1CGeometry extends FBXGeometry {\r\n /**\r\n * Initialize geo storing positions, normals, indices and create colors.\r\n * @param {Object} geo - THREE.BufferGeometry.\r\n */\r\n init(geo, _info) {\r\n super.init(geo, _info);\r\n const {\r\n attributes: {\r\n position,\r\n normal,\r\n },\r\n index,\r\n } = geo;\r\n // copy vertices attributes\r\n this.vertsCount = position.count;\r\n this.positions = position.array;\r\n this.normals = normal.array;\r\n // create color array\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n // indices\r\n this.indices = index.array;\r\n }\r\n\r\n /**\r\n * Set defined color for all items in color attribute\r\n * @param {Object} color - THREE.Color.\r\n */\r\n setColors(color) {\r\n let offset = 0;\r\n for (let i = 0, l = this.colors.length, cl = this.itemSize.color; i < l; i += cl) {\r\n this.colors[offset++] = color.r;\r\n this.colors[offset++] = color.g;\r\n this.colors[offset++] = color.b;\r\n }\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes from cylinder geometry and creates colors filled with two\r\n * defined values.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX2CCylinder extends FBXGeometry {\r\n constructor() {\r\n super();\r\n this._cutRawStart = 0;\r\n this._cutRawEnd = 0;\r\n this._facesPerSlice = 0;\r\n }\r\n\r\n /**\r\n * Initialize geo by creating new attributes, because we extend number of vertices to make cylinder two-colored.\r\n * Indices remain the same. We process open- end close-ended cylinders and consider cylinders od 2 segments\r\n * in height ONLY.\r\n * NOTE: cylinder consists of 2 height segments and stores parts in the order: tube, topCap, bottomCap\r\n * @param {Object} geo - THREE.BufferGeometry.\r\n * @param {Object} info - information needed for geo extend\r\n */\r\n init(geo, info) {\r\n super.init(geo, info);\r\n const {\r\n attributes: {\r\n position,\r\n },\r\n index,\r\n } = geo;\r\n // extend vertices arrays\r\n this.vertsCount = position.count + info.addPerCylinder;\r\n this._facesPerSlice = info.addPerCylinder;\r\n this.positions = new Float32Array(this.vertsCount * position.itemSize);\r\n this.normals = new Float32Array(this.vertsCount * this.itemSize.normal);\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n this._extendVertices(geo, info);\r\n // number of indices stays the same\r\n this.indices = new Uint32Array(index.count);\r\n this._extendIndices(geo, info);\r\n }\r\n\r\n /** Extend vertex attributes to have one more slice to make sharp middle startColor-endColor line. */\r\n _extendVertices(geo, info) {\r\n const { position } = geo.attributes;\r\n const { normal } = geo.attributes;\r\n const geoParams = geo.getGeoParams();\r\n const cutRaw = 1; // we expect cylinders of 2 segments in height => so half segment = 1\r\n this._cutRawStart = cutRaw * geoParams.radialSegments;\r\n this._cutRawEnd = this._cutRawStart + info.addPerCylinder;\r\n { // write first half of cylinder\r\n let temp = position.array.slice(0, this._cutRawEnd * position.itemSize);\r\n this.positions.set(temp, 0);\r\n temp = normal.array.slice(0, this._cutRawEnd * normal.itemSize);\r\n this.normals.set(temp, 0);\r\n }\r\n { // write second part of cylinder\r\n let temp = position.array.slice(this._cutRawStart * position.itemSize, position.array.length);\r\n this.positions.set(temp, this._cutRawEnd * position.itemSize);\r\n temp = normal.array.slice(this._cutRawStart * normal.itemSize, normal.array.length);\r\n this.normals.set(temp, this._cutRawEnd * normal.itemSize);\r\n }\r\n }\r\n\r\n /** Shift values of second part (+caps) indices by newly added vertices count. Number of faces remains the same. */\r\n _extendIndices(geo, info) {\r\n const { index } = geo;\r\n const indicesPerQuad = 6; // quad = 2 triangles => 6 indices\r\n const startToShift = info.addPerCylinder * indicesPerQuad;\r\n const shift = info.addPerCylinder;\r\n let shifted = index.array.slice(startToShift, index.count);\r\n shifted = shifted.map((x) => x + shift); // shift only the endings\r\n this.indices.set(index.array, 0);\r\n this.indices.set(shifted, startToShift);\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {number} start - start color index\r\n * @param {number} end - start color index\r\n * @param {array} array - array of colors\r\n * @param {array} color - color value components\r\n */\r\n _setColorRange(start, end, array, color) {\r\n const colorSize = color.length;\r\n for (let i = start; i < end; i += colorSize) {\r\n array.set(color, i);\r\n }\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {Object} color1 - THREE.Color.\r\n * @param {Object} color2 - THREE.Color.\r\n */\r\n setColors(color1, color2) {\r\n const colorSize = this.itemSize.color;\r\n const part1End = this._cutRawEnd * colorSize;\r\n const part2End = part1End * 2;\r\n this._setColorRange(0, part1End, this.colors, color1.toArray());\r\n this._setColorRange(part1End, part2End, this.colors, color2.toArray());\r\n if (part2End < this.colors.length) { // cylinder has caps, lets paint them\r\n const capSize = (this._facesPerSlice + 1) * colorSize;\r\n const cap1End = part2End + capSize;\r\n this._setColorRange(part2End, cap1End, this.colors, color2.toArray());\r\n const cap2End = cap1End + capSize; // should be equal to this.colors.length;\r\n this._setColorRange(cap1End, cap2End, this.colors, color1.toArray());\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\n\r\nimport utils from '../../../utils';\r\nimport gfxutils from '../../../gfx/gfxutils';\r\nimport logger from '../../../utils/logger';\r\n\r\nimport FBXModel from './FBXModel';\r\nimport ThickLineMesh from '../../../gfx/meshes/ThickLineMesh';\r\nimport ZSpriteMesh from '../../../gfx/meshes/ZSpriteMesh';\r\nimport InstancedSpheresGeometry from '../../../gfx/geometries/InstancedSpheresGeometry';\r\nimport Instanced2CCylindersGeometry from '../../../gfx/geometries/Instanced2CCylindersGeometry';\r\nimport FBX1CGeometry from './FBX1CGeometry';\r\nimport FBX2CCylinder from './FBX2CCylinder';\r\n\r\nexport default class FBXInfoExtractor {\r\n constructor() {\r\n this._materials = [];\r\n this._models = [];\r\n }\r\n\r\n process(data) {\r\n this._extractModelsAndMaterials(data);\r\n const models = this._flattenModels();\r\n\r\n return {\r\n name: data.name,\r\n models,\r\n materials: this._materials,\r\n };\r\n }\r\n\r\n /**\r\n * Extract fbx object information from ComplexVisual\r\n * @param {object} data - complexVisual to get geometry info from\r\n */\r\n _extractModelsAndMaterials(data) {\r\n const layersOfInterest = new THREE.Layers();\r\n layersOfInterest.set(gfxutils.LAYERS.DEFAULT);\r\n layersOfInterest.enable(gfxutils.LAYERS.TRANSPARENT);\r\n data.traverse((object) => {\r\n if (object instanceof THREE.Mesh && object.layers.test(layersOfInterest) && this.checkExportAbility(object)) {\r\n if (object.geometry.type === 'InstancedBufferGeometry') {\r\n this._collectInstancedGeoInfo(object);\r\n } else {\r\n this._collectGeoInfo(object);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Reworking indices buffer, see https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/\r\n * basically, every triangle in Miew has been represented hat way (e.g.) : 0,1,7, but we must (for FBX) rework that\r\n * into: 0,1,-8.\r\n * @param {array} indices - belongs to [0, maxVertIndex]\r\n */\r\n _reworkIndices(indices) {\r\n const faceSize = 3;\r\n for (let i = faceSize - 1; i < indices.length; i += faceSize) {\r\n indices[i] *= -1;\r\n indices[i]--;\r\n }\r\n }\r\n\r\n /**\r\n * Combine geometry from several models having the same material into one Model and finally prepare indices\r\n * @returns {array} models, combined by material id\r\n */\r\n _flattenModels() {\r\n let overallVertsCount = 0;\r\n function shift(x) {\r\n return x + overallVertsCount;\r\n }\r\n const combined = [];\r\n // flatten models geometry\r\n for (let i = 0, n = this._models.length; i < n; i++) {\r\n const models = this._models[i];\r\n let indices = [];\r\n let positions = [];\r\n let normals = [];\r\n let colors = [];\r\n // reorganize every attributes as array of arrays\r\n overallVertsCount = 0;\r\n for (let j = 0; j < models.length; j++) {\r\n const m = models[j];\r\n indices.push(m.indices.map(shift));\r\n overallVertsCount += m.getVerticesNumber();\r\n positions.push(m.positions);\r\n normals.push(m.normals);\r\n colors.push(m.colors);\r\n }\r\n // join all subarrays into one\r\n indices = utils.mergeTypedArraysUnsafe(indices);\r\n this._reworkIndices(indices);\r\n positions = utils.mergeTypedArraysUnsafe(positions);\r\n normals = utils.mergeTypedArraysUnsafe(normals);\r\n colors = utils.mergeTypedArraysUnsafe(colors);\r\n combined.push({\r\n indices,\r\n positions,\r\n normals,\r\n colors,\r\n verticesCount: overallVertsCount,\r\n });\r\n }\r\n return combined;\r\n }\r\n\r\n /**\r\n * Check ability to export the kind of mesh.\r\n * @param {object} mesh - given mesh to check\r\n * @returns {boolean} result of check\r\n */\r\n checkExportAbility(mesh) {\r\n // check mesh on not being empty\r\n if (mesh.geometry.attributes.position.count === 0) {\r\n return false;\r\n }\r\n // check type of mesh\r\n // if (mesh.geometry.isInstancedBufferGeometry && settings.now.zSprites) {\r\n if (mesh instanceof ZSpriteMesh) {\r\n logger.warn('Currently we cannot export \\'sprites\\' modes, like BS, WV, LC. Please turn of settings \\'zSprites\\' and try again');\r\n return false;\r\n }\r\n if (mesh instanceof ThickLineMesh) {\r\n logger.warn('Currently we cannot export Lines mode');\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Save geometry info from common mesh, like Surface or Cartoon\r\n */\r\n _collectGeoInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n normal,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const vertCount = position.count;\r\n model.init(vertCount, index.count);\r\n if (matrix.isIdentity()) {\r\n model.setPositions(position.array, 0, vertCount, position.itemSize);\r\n model.setNormals(normal.array, 0, vertCount, normal.itemSize);\r\n } else {\r\n model.setTransformedPositions(position.array, 0, vertCount, position.itemSize, matrix);\r\n model.setTransformedNormals(normal.array, 0, vertCount, normal.itemSize, matrix);\r\n }\r\n model.setColors(color.array, 0, vertCount, color.itemSize);\r\n model.setIndices(index.array, 0, index.count);\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Collect instanced spheres geometry and materials.\r\n * @param {object} mesh - mesh with instanced spheres info\r\n */\r\n _collectSpheresInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.instanceCount;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount, instCount * indsCount);\r\n const geo = new FBX1CGeometry();\r\n geo.init(mesh.geometry);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const sphereColor = new THREE.Color();\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n sphereColor.fromArray(color.array, colorIdx);\r\n geo.setColors(sphereColor);\r\n // add instance to the model\r\n this._getSphereInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Getting all instanced cylinders from given mesh.\r\n * Divide cylinder (add additional vertexes) for prettiness therefore algorithm is a bit complicated\r\n * @param {object} mesh - given mesh with instanced cylinders\r\n */\r\n _collectCylindersInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n color2,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.instanceCount;\r\n const oneCCylinder = new FBX1CGeometry();\r\n oneCCylinder.init(mesh.geometry);\r\n const splittingInfo = this._gatherCylindersColoringInfo(mesh.geometry);\r\n let twoCCylinder = null;\r\n if (splittingInfo.needToSplit > 0) {\r\n twoCCylinder = new FBX2CCylinder();\r\n twoCCylinder.init(mesh.geometry, splittingInfo);\r\n }\r\n const additionalVertsCount = splittingInfo.addPerCylinder * splittingInfo.needToSplit;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount + additionalVertsCount, instCount * indsCount);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const colorStart = new THREE.Color();\r\n const colorEnd = new THREE.Color();\r\n let geo = {};\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n if (splittingInfo.is2Colored[instanceIndex]) {\r\n // .color2 contains starting color, and .color contains starting color (see uber.frag ATTR_COLOR2)\r\n colorStart.fromArray(color2.array, colorIdx);\r\n colorEnd.fromArray(color.array, colorIdx);\r\n if (twoCCylinder) {\r\n twoCCylinder.setColors(colorStart, colorEnd);\r\n geo = twoCCylinder;\r\n }\r\n } else {\r\n // has one color per cylinder\r\n colorStart.fromArray(color.array, colorIdx);\r\n oneCCylinder.setColors(colorStart);\r\n geo = oneCCylinder;\r\n }\r\n // add instance to the model\r\n this._getCylinderInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Adding model to pool of models or extend existing ones\r\n * @param {object} model - model to add\r\n * @param {object} material - material to add\r\n */\r\n _addToPool(model, material) {\r\n const materialIdx = this._checkExistingMaterial(material);\r\n if (materialIdx < 0) { // new model-material pair\r\n this._models.push([model]);\r\n this._materials.push(material);\r\n } else { // add model to existing model-material pair\r\n const models = this._models[materialIdx];\r\n models.push(model);\r\n }\r\n }\r\n\r\n /**\r\n * Checking if given material already was registered in materials pool (no need to create new one)\r\n * @param {object} material - given material\r\n * @returns {number} number of model-material pair\r\n */\r\n _checkExistingMaterial(material) {\r\n return _.findIndex(this._materials, (m) => _.isEqual(m, material));\r\n }\r\n\r\n _gatherCylindersColoringInfo(geo) {\r\n const instCount = geo.instanceCount;\r\n const color1 = geo.attributes.color.array;\r\n const color2 = geo.attributes.color2.array;\r\n const stride = geo.attributes.color.itemSize;\r\n const is2Colored = new Array(instCount);\r\n // analyze color instance attributes\r\n let needToSplit = 0;\r\n let colIdx = 0;\r\n for (let i = 0; i < instCount; i++, colIdx += stride) {\r\n const differs = (Math.abs(color1[colIdx] - color2[colIdx]) > 0.0000001) // compare ending colors\r\n || (Math.abs(color1[colIdx + 1] - color2[colIdx + 1]) > 0.0000001)\r\n || (Math.abs(color1[colIdx + 2] - color2[colIdx + 2]) > 0.0000001);\r\n is2Colored[i] = differs;\r\n needToSplit += differs; // count number of 2-colored cylinders\r\n }\r\n // calc number of vertices to add into 2-colored\r\n const geoParams = geo.getGeoParams();\r\n const addPerCylinder = geoParams.radialSegments;\r\n return { is2Colored, needToSplit, addPerCylinder };\r\n }\r\n\r\n /**\r\n * Collect instanced models and materials.\r\n * @param {object} mesh - given mesh with instanced something (spheres or cylinders)\r\n */\r\n _collectInstancedGeoInfo(mesh) {\r\n if (mesh.geometry instanceof InstancedSpheresGeometry) {\r\n this._collectSpheresInfo(mesh);\r\n } else if (mesh.geometry instanceof Instanced2CCylindersGeometry) {\r\n this._collectCylindersInfo(mesh);\r\n }\r\n }\r\n\r\n /**\r\n * Collect Material info from given mesh.\r\n * @param {object} mesh - given mesh with material info\r\n * @returns {object} material\r\n */\r\n _collectMaterialInfo(mesh) {\r\n const { uberOptions } = mesh.material;\r\n return ({\r\n diffuse: uberOptions.diffuse.toArray(),\r\n opacity: uberOptions.opacity,\r\n shininess: uberOptions.shininess,\r\n specular: uberOptions.specular.toArray(),\r\n });\r\n }\r\n\r\n _getCylinderInstanceMatrix(geo, instIdx, matrix) {\r\n const matVector1 = geo.attributes.matVector1.array;\r\n const matVector2 = geo.attributes.matVector2.array;\r\n const matVector3 = geo.attributes.matVector3.array;\r\n const idxOffset = instIdx * 4; // used 4 because offset arrays are stored in quads\r\n matrix.set(\r\n matVector1[idxOffset],\r\n matVector1[idxOffset + 1],\r\n matVector1[idxOffset + 2],\r\n matVector1[idxOffset + 3],\r\n matVector2[idxOffset],\r\n matVector2[idxOffset + 1],\r\n matVector2[idxOffset + 2],\r\n matVector2[idxOffset + 3],\r\n matVector3[idxOffset],\r\n matVector3[idxOffset + 1],\r\n matVector3[idxOffset + 2],\r\n matVector3[idxOffset + 3],\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n );\r\n }\r\n\r\n _getSphereInstanceMatrix(geo, instIdx, matrix) {\r\n const { offset } = geo.attributes;\r\n const idx = instIdx * offset.itemSize;\r\n const x = offset.array[idx];\r\n const y = offset.array[idx + 1];\r\n const z = offset.array[idx + 2];\r\n const scale = offset.array[idx + 3];\r\n matrix.set(\r\n scale,\r\n 0,\r\n 0,\r\n x,\r\n 0,\r\n scale,\r\n 0,\r\n y,\r\n 0,\r\n 0,\r\n scale,\r\n z,\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n );\r\n }\r\n}\r\n","// Forming default definitions block\r\nconst defaultDefinitions = `\r\nDefinitions: {\r\n Version: 100\r\n Count: 3\r\n ObjectType: \"Model\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Geometry\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Material\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Pose\" {\r\n Count: 1\r\n }\r\n ObjectType: \"GlobalSettings\" {\r\n Count: 1\r\n }\r\n} `;\r\n\r\n// Default model properties\r\nconst defaultProperties = `Properties60: {\r\n Property: \"QuaternionInterpolate\", \"bool\", \"\",0\r\n Property: \"Visibility\", \"Visibility\", \"A\",1\r\n Property: \"Lcl Translation\", \"Lcl Translation\", \"A\",0.000000000000000,0.000000000000000,-1789.238037109375000\r\n Property: \"Lcl Rotation\", \"Lcl Rotation\", \"A\",0.000009334667643,-0.000000000000000,0.000000000000000\r\n Property: \"Lcl Scaling\", \"Lcl Scaling\", \"A\",1.000000000000000,1.000000000000000,1.000000000000000\r\n Property: \"RotationOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationActive\", \"bool\", \"\",0\r\n Property: \"TranslationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMinX\", \"bool\", \"\",0\r\n Property: \"TranslationMinY\", \"bool\", \"\",0\r\n Property: \"TranslationMinZ\", \"bool\", \"\",0\r\n Property: \"TranslationMaxX\", \"bool\", \"\",0\r\n Property: \"TranslationMaxY\", \"bool\", \"\",0\r\n Property: \"TranslationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationOrder\", \"enum\", \"\",0\r\n Property: \"RotationSpaceForLimitOnly\", \"bool\", \"\",0\r\n Property: \"AxisLen\", \"double\", \"\",10\r\n Property: \"PreRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"PostRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationActive\", \"bool\", \"\",0\r\n Property: \"RotationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMinX\", \"bool\", \"\",0\r\n Property: \"RotationMinY\", \"bool\", \"\",0\r\n Property: \"RotationMinZ\", \"bool\", \"\",0\r\n Property: \"RotationMaxX\", \"bool\", \"\",0\r\n Property: \"RotationMaxY\", \"bool\", \"\",0\r\n Property: \"RotationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationStiffnessX\", \"double\", \"\",0\r\n Property: \"RotationStiffnessY\", \"double\", \"\",0\r\n Property: \"RotationStiffnessZ\", \"double\", \"\",0\r\n Property: \"MinDampRangeX\", \"double\", \"\",0\r\n Property: \"MinDampRangeY\", \"double\", \"\",0\r\n Property: \"MinDampRangeZ\", \"double\", \"\",0\r\n Property: \"MaxDampRangeX\", \"double\", \"\",0\r\n Property: \"MaxDampRangeY\", \"double\", \"\",0\r\n Property: \"MaxDampRangeZ\", \"double\", \"\",0\r\n Property: \"MinDampStrengthX\", \"double\", \"\",0\r\n Property: \"MinDampStrengthY\", \"double\", \"\",0\r\n Property: \"MinDampStrengthZ\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthX\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthY\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthZ\", \"double\", \"\",0\r\n Property: \"PreferedAngleX\", \"double\", \"\",0\r\n Property: \"PreferedAngleY\", \"double\", \"\",0\r\n Property: \"PreferedAngleZ\", \"double\", \"\",0\r\n Property: \"InheritType\", \"enum\", \"\",0\r\n Property: \"ScalingActive\", \"bool\", \"\",0\r\n Property: \"ScalingMin\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMax\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMinX\", \"bool\", \"\",0\r\n Property: \"ScalingMinY\", \"bool\", \"\",0\r\n Property: \"ScalingMinZ\", \"bool\", \"\",0\r\n Property: \"ScalingMaxX\", \"bool\", \"\",0\r\n Property: \"ScalingMaxY\", \"bool\", \"\",0\r\n Property: \"ScalingMaxZ\", \"bool\", \"\",0\r\n Property: \"GeometricTranslation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricScaling\", \"Vector3D\", \"\",1,1,1\r\n Property: \"LookAtProperty\", \"object\", \"\"\r\n Property: \"UpVectorProperty\", \"object\", \"\"\r\n Property: \"Show\", \"bool\", \"\",1\r\n Property: \"NegativePercentShapeSupport\", \"bool\", \"\",1\r\n Property: \"DefaultAttributeIndex\", \"int\", \"\",0\r\n Property: \"Color\", \"Color\", \"A+\",0,0,0\r\n Property: \"Size\", \"double\", \"\",100\r\n Property: \"Look\", \"enum\", \"\",1\r\n }`;\r\n\r\n// Default materials layer\r\nconst defaultMaterialLayer = `\r\n LayerElementMaterial: 0 {\r\n Version: 101\r\n Name: \"\"\r\n MappingInformationType: \"AllSame\"\r\n ReferenceInformationType: \"Direct\"\r\n Materials: 0\r\n }`;\r\n\r\n// Default layers block\r\nconst defaultLayerBlock = `\r\n Layer: 0 {\r\n Version: 100\r\n LayerElement: {\r\n Type: \"LayerElementNormal\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementColor\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementMaterial\"\r\n TypedIndex: 0\r\n }\r\n }`;\r\n\r\n/**\r\n * globalSettings info in output file.\r\n */\r\nconst globalSettings = `GlobalSettings: {\r\n Version: 1000\r\n Properties60: {\r\n Property: \"UpAxis\", \"int\", \"\",1\r\n Property: \"UpAxisSign\", \"int\", \"\",1\r\n Property: \"FrontAxis\", \"int\", \"\",2\r\n Property: \"FrontAxisSign\", \"int\", \"\",1\r\n Property: \"CoordAxis\", \"int\", \"\",0\r\n Property: \"CoordAxisSign\", \"int\", \"\",1\r\n Property: \"UnitScaleFactor\", \"double\", \"\",1\r\n }\r\n }`;\r\n\r\nexport default class FBXResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._info = null;\r\n }\r\n\r\n getResult(info) {\r\n this._info = info;\r\n this._resultArray.push(this._writeHeader());\r\n this._resultArray.push(this._writeDefinitions());\r\n this._resultArray.push(this._writeObjects(info.models, info.materials));\r\n this._resultArray.push(this._writeRelations());\r\n this._resultArray.push(this._writeConnections()); // connections between models and materials)\r\n this._info = null;\r\n return this._resultArray.join('');\r\n }\r\n\r\n /**\r\n * Add FBXHeader info to output file.\r\n * Some fields are really confusing, but it seems that all listed fields are very informative\r\n */\r\n _writeHeader() {\r\n const FBXHeaderVersion = 1003; // 1003 is some number which appears to present in many 6.1 ASCII files\r\n const FBXVersion = 6100; // Mandatory and only supported version\r\n const date = new Date();\r\n const timeStampVersion = 1000;\r\n const creator = `Miew FBX Exporter v${this._info.version}`; // Supposed to be an engine\r\n\r\n return `; FBX 6.1.0 project file\r\n; Created by ${creator} Copyright (c) 2015-2024 EPAM Systems, Inc.\r\n; For support please contact miew@epam.com\r\n; ----------------------------------------------------\r\n\r\nFBXHeaderExtension: {\r\n FBXHeaderVersion: ${FBXHeaderVersion}\r\n FBXVersion: ${FBXVersion}\r\n CreationTimeStamp: {\r\n Version: ${timeStampVersion}\r\n Year: ${date.getFullYear()}\r\n Month: ${date.getMonth() + 1}\r\n Day: ${date.getDate()}\r\n Hour: ${date.getHours()}\r\n Minute: ${date.getMinutes()}\r\n Second: ${date.getSeconds()}\r\n Millisecond: ${date.getMilliseconds()}\r\n }\r\n Creator: \"${creator}\"\r\n OtherFlags: {\r\n FlagPLE: 0\r\n }\r\n}\r\nCreationTime: \"${date}\"\r\nCreator: \"${creator}\"\r\n`;\r\n }\r\n\r\n /**\r\n * Add Definitions info to output file.\r\n * Not exactly sure if this section is template section (as it is in 7.4+) or it should every time be like this\r\n */\r\n _writeDefinitions() {\r\n return `\r\n; Object definitions\r\n;------------------------------------------------------------------\r\n\r\n${defaultDefinitions}\r\n`;\r\n }\r\n\r\n /**\r\n * Adding gathered information about Models to resulting string.\r\n * Reminder - there may be more then 1 model in scene, but we must place materials after ALL models.\r\n * @returns {string} string containing all models (vertices, indices, colors, normals etc)\r\n */\r\n _models() {\r\n const modelVersion = 232;\r\n let allModels = '';\r\n const { models } = this._info;\r\n for (let i = 0; i < models.length; ++i) {\r\n const model = models[i];\r\n const vertCount = model.verticesCount;\r\n allModels += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n Version: ${modelVersion}\r\n ${defaultProperties}\r\n ${this._verticesIndices(model.positions, model.indices)}\r\n ${this._normalLayer(model.normals)}\r\n ${this._colorLayer(model.colors, vertCount)}\r\n ${defaultMaterialLayer}\r\n ${defaultLayerBlock}\r\n }`;\r\n }\r\n return allModels;\r\n }\r\n\r\n /**\r\n * Add Material info to result\r\n */\r\n _materials() {\r\n const materialVersion = 102;\r\n let allMaterials = '';\r\n const { materials } = this._info;\r\n for (let i = 0; i < materials.length; ++i) {\r\n const material = materials[i];\r\n allMaterials += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n Version: ${materialVersion}\r\n ShadingModel: \"lambert\"\r\n MultiLayer: 0\r\n ${this._materialProperties(material)}\r\n }`;\r\n }\r\n return allMaterials;\r\n }\r\n\r\n /**\r\n * Add Objects info to output file.\r\n */\r\n _writeObjects() {\r\n return `\r\n; Object properties\r\n;------------------------------------------------------------------\r\n\r\nObjects: {\r\n ${this._models()}\r\n ${this._materials()}\r\n ${globalSettings}\r\n}\r\n`;\r\n }\r\n\r\n /**\r\n * Add Relations info to output file.\r\n */\r\n _writeRelations() {\r\n let modelsList = '';\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n }`;\r\n }\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n }`;\r\n }\r\n\r\n return `\r\n; Object relations\r\n;------------------------------------------------------------------\r\n\r\nRelations: {\r\n ${modelsList}\r\n Model: \"Model::Producer Perspective\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Top\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Bottom\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Front\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Back\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Right\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Left\", \"Camera\" {\r\n }\r\n Model: \"Model::Camera Switcher\", \"CameraSwitcher\" {\r\n }\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Add Connections info to output file.\r\n */\r\n _writeConnections() {\r\n let modelsList = '';\r\n const { name } = this._info;\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Connect: \"OO\", \"Model::${name}_${i}\", \"Model::Scene\"`;\r\n }\r\n\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Connect: \"OO\", \"Material::${name}_${i}_default\", \"Model::${name}_${i}\"`;\r\n }\r\n\r\n return `\r\n; Object connections\r\n;------------------------------------------------------------------\r\n\r\nConnections: {\r\n ${modelsList}\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Write float array to string with limited precision\r\n * @param {Float32Array} array - array to be fixed\r\n * @returns {String} String with fixed floats\r\n */\r\n _floatArrayToString(array) {\r\n const str = [];\r\n for (let i = 0; i < array.length; ++i) {\r\n str[i] = array[i].toFixed(6);\r\n }\r\n return str.join(',');\r\n }\r\n\r\n /**\r\n * Adding color layer to resulting file\r\n * @param {Float32Array} colorArray attribute\r\n * @param {number} vertCount - number of vertices in the model\r\n * @returns {string} color layer info\r\n */\r\n _colorLayer(colorArray, vertCount) {\r\n const layerElementColorNumber = 0;\r\n const layerElementColorVersion = 101;\r\n const layerElementColorName = '';\r\n const colorsStr = this._floatArrayToString(colorArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n // As said [..Array(...)] - fastest and easiest way to produce [0, 1, .....] array\r\n const colorIndices = [...Array(vertCount).keys()];\r\n return `\r\n LayerElementColor: ${layerElementColorNumber} {\r\n Version: ${layerElementColorVersion}\r\n Name: \"${layerElementColorName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\"\r\n Colors: ${colorsStr}\r\n ColorIndex: ${colorIndices}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding normal layer to resulting file\r\n * @param {Float32Array} normalArray attribute\r\n * @returns {string} normal layer info\r\n */\r\n _normalLayer(normalArray) {\r\n const layerElementNormalNumber = 0;\r\n const layerElementNormalVersion = 101;\r\n const layerElementNormalName = '';\r\n const normalsStr = this._floatArrayToString(normalArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n return `\r\n LayerElementNormal: ${layerElementNormalNumber} {\r\n Version: ${layerElementNormalVersion}\r\n Name: \"${layerElementNormalName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\"\r\n Normals: ${normalsStr}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding vertices and indices to resulting string\r\n * @return {string} resulting string in FBX notation\r\n */\r\n _verticesIndices(positions, indices) {\r\n const multiLayer = 0;\r\n const multiTake = 1;\r\n const shading = 'Y';\r\n const culling = 'CullingOff';\r\n const geometryVersion = 124;\r\n const vertStr = this._floatArrayToString(positions);\r\n /* About _correctArrayNotation: Float32Arrays will contains only Float32 numbers, which implies that it will be floating points with 17 numbers after point.\r\n * We cannot (and it's logically incorrect) save all this information, so we convert this Float32Array into Array-like object with numbers with only 6 numbers after point\r\n * Reminder - this is big memory loss (as we must save at one moment two arrays with similar information) */\r\n return `MultiLayer: ${multiLayer}\r\n MultiTake: ${multiTake}\r\n Shading: ${shading}\r\n Culling: \"${culling}\"\r\n Vertices: ${vertStr}\r\n PolygonVertexIndex: ${indices}\r\n GeometryVersion: ${geometryVersion}`;\r\n }\r\n\r\n /**\r\n * Forming material properties block.\r\n * @param {Object} material - given material of model\r\n * @returns {String} material properties string\r\n */\r\n _materialProperties(material) {\r\n return `Properties60: {\r\n Property: \"ShadingModel\", \"KString\", \"\", \"Lambert\"\r\n Property: \"MultiLayer\", \"bool\", \"\",0\r\n Property: \"EmissiveColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"EmissiveFactor\", \"double\", \"\",0.0000\r\n Property: \"AmbientColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"AmbientFactor\", \"double\", \"\",0.0000\r\n Property: \"DiffuseColor\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"DiffuseFactor\", \"double\", \"\",1.0000\r\n Property: \"Bump\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TransparentColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"TransparencyFactor\", \"double\", \"\",0.0000\r\n Property: \"SpecularColor\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"SpecularFactor\", \"double\", \"\",1.0000\r\n Property: \"ShininessExponent\", \"double\", \"\",${material.shininess}\r\n Property: \"ReflectionColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"ReflectionFactor\", \"double\", \"\",1\r\n Property: \"Ambient\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"Diffuse\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"Specular\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"Shininess\", \"double\", \"\",${material.shininess}\r\n Property: \"Opacity\", \"double\", \"\",${material.opacity}\r\n Property: \"Reflectivity\", \"double\", \"\",0\r\n }`;\r\n }\r\n}\r\n","import Exporter from './Exporter';\r\nimport FBXInfoExtractor from './fbx/FBXInfoExtractor';\r\nimport FBXResult from './fbx/FBXResult';\r\nimport ComplexVisual from '../../ComplexVisual';\r\n\r\nexport default class FBXExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n // Data\r\n this._data = source;\r\n this._version = options.miewVersion || '0.0-UNSPECIFIED';\r\n this._extractor = new FBXInfoExtractor();\r\n }\r\n\r\n /**\r\n * Entry point to exporter.\r\n */\r\n exportSync() {\r\n // Creating mandatory blocks\r\n const result = new FBXResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n const info = this._extractor.process(this._data);\r\n info.version = this._version;\r\n this._result = result.getResult(info);\r\n return this._result;\r\n }\r\n}\r\n\r\nFBXExporter.formats = ['fbx'];\r\nFBXExporter.SourceClass = ComplexVisual;\r\n","import ExporterList from './exporters/ExporterList';\r\n\r\nimport PDBExporter from './exporters/PDBExporter';\r\nimport FBXExporter from './exporters/FBXExporter';\r\n\r\nexport default new ExporterList([\r\n PDBExporter,\r\n FBXExporter,\r\n]);\r\n","import loaders from './loaders';\r\nimport parsers from './parsers';\r\nimport exporters from './exporters';\r\n\r\nexport default {\r\n loaders,\r\n parsers,\r\n exporters,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from './CSS2DObject';\r\n\r\nconst tempColor = new THREE.Color();\r\n\r\nclass CSS2DRenderer {\r\n constructor() {\r\n this._width = 0;\r\n this._height = 0;\r\n this._widthHalf = 0;\r\n this._heightHalf = 0;\r\n\r\n this._vector = new THREE.Vector3();\r\n this._viewMatrix = new THREE.Matrix4();\r\n this._projectionMatrix = new THREE.Matrix4();\r\n\r\n this._domElement = document.createElement('div');\r\n this._domElement.style.overflow = 'hidden';\r\n this._domElement.style.position = 'absolute';\r\n this._domElement.style.top = '0';\r\n this._domElement.style.zIndex = '0'; // start a new Stacking Context to enclose all z-ordered children\r\n this._domElement.style.pointerEvents = 'none';\r\n }\r\n\r\n getElement() {\r\n return this._domElement;\r\n }\r\n\r\n reset() {\r\n const myNode = this.getElement();\r\n while (myNode.firstChild) {\r\n myNode.removeChild(myNode.firstChild);\r\n }\r\n }\r\n\r\n setSize(width, height) {\r\n this._width = width;\r\n this._height = height;\r\n\r\n this._widthHalf = this._width / 2;\r\n this._heightHalf = this._height / 2;\r\n\r\n this._domElement.style.width = `${width}px`;\r\n this._domElement.style.height = `${height}px`;\r\n }\r\n\r\n _renderObject(object, camera, scene) {\r\n function lerpColorAsHex(a, b, t) {\r\n tempColor.setHex(a);\r\n tempColor.lerp(b, t);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n function colorAsHex(a) {\r\n tempColor.setHex(a);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n if (object instanceof CSS2DObject) {\r\n this._vector.setFromMatrixPosition(object.matrixWorld);\r\n\r\n if (object.userData !== undefined && object.userData.offset !== undefined) {\r\n const localOffset = new THREE.Vector3(object.userData.offset.x, object.userData.offset.y, 0);\r\n this._vector.add(localOffset.multiplyScalar(object.matrixWorld.getMaxScaleOnAxis()));\r\n }\r\n\r\n this._vector.applyMatrix4(this._viewMatrix);\r\n\r\n const visibility = this._vector.z > -camera.near ? 'hidden' : 'visible';\r\n const zIndex = 10000 * (camera.far - (-this._vector.z)) / (camera.far - camera.near);\r\n\r\n const element = object.getElement();\r\n if (typeof scene.fog === 'undefined') {\r\n element.style.color = colorAsHex(object.userData.color);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = colorAsHex(object.userData.background);\r\n }\r\n } else {\r\n const fogFactor = THREE.MathUtils.smoothstep(-this._vector.z, scene.fog.near, scene.fog.far);\r\n element.style.color = lerpColorAsHex(object.userData.color, scene.fog.color, fogFactor);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = lerpColorAsHex(object.userData.background, scene.fog.color, fogFactor);\r\n }\r\n }\r\n\r\n this._vector.applyMatrix4(this._projectionMatrix);\r\n\r\n const style = `${object.userData !== {} ? object.userData.translation : 'translate(-50%, -50%) '\r\n }translate(${this._vector.x * this._widthHalf + this._widthHalf}px,${\r\n -this._vector.y * this._heightHalf + this._heightHalf}px)`;\r\n element.style.visibility = visibility;\r\n element.style.WebkitTransform = style;\r\n element.style.MozTransform = style;\r\n element.style.oTransform = style;\r\n element.style.transform = style;\r\n element.style.zIndex = Number(zIndex).toFixed(0);\r\n\r\n if (element.parentNode !== this._domElement) {\r\n this._domElement.appendChild(element);\r\n }\r\n }\r\n\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n this._renderObject(object.children[i], camera, scene);\r\n }\r\n }\r\n\r\n render(scene, camera) {\r\n scene.updateMatrixWorld();\r\n\r\n if (camera.parent === null) {\r\n camera.updateMatrixWorld();\r\n }\r\n\r\n camera.matrixWorldInverse.copy(camera.matrixWorld).invert();\r\n\r\n this._viewMatrix.copy(camera.matrixWorldInverse);\r\n this._projectionMatrix.copy(camera.projectionMatrix);\r\n\r\n this._renderObject(scene, camera, scene);\r\n }\r\n}\r\nexport default CSS2DRenderer;\r\n","export default function getTopWindow() {\r\n // intercept the exception if we have cross-origin iframe\r\n try {\r\n if (window.top.location.href !== undefined) {\r\n return window.top;\r\n }\r\n } catch (e) {\r\n // provide fallback\r\n }\r\n return window;\r\n}\r\n","import * as THREE from 'three';\r\nimport Timer from '../Timer';\r\nimport settings from '../settings';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\nimport getTopWindow from '../utils/getTopWindow';\r\n\r\nconst VK_LEFT = 37;\r\nconst VK_UP = 38;\r\nconst VK_RIGHT = 39;\r\nconst VK_DOWN = 40;\r\n\r\nconst STATE = {\r\n NONE: -1, ROTATE: 0, TRANSLATE: 1, SCALE: 2, TRANSLATE_PIVOT: 3,\r\n};\r\n\r\n// pausing for this amount of time before releasing mouse button prevents inertial rotation (seconds)\r\nconst FULL_STOP_THRESHOLD = 0.1;\r\n\r\nconst quaternion = new THREE.Quaternion();\r\nconst matrix4 = new THREE.Matrix4();\r\n\r\n// pivot -- local offset of the rotation pivot point\r\nfunction ObjectHandler(objects, camera, pivot, options) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n this.camera = camera;\r\n this.pivot = pivot;\r\n this.axis = new THREE.Vector3(0, 0, 1);\r\n this.options = options;\r\n\r\n this.lastRotation = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n}\r\n\r\nObjectHandler.prototype._rotate = (function () {\r\n const p = new THREE.Vector3();\r\n const q = new THREE.Quaternion();\r\n const s = new THREE.Vector3();\r\n\r\n const m = new THREE.Matrix4();\r\n\r\n return function (quat) {\r\n const zeroPivot = (this.pivot.x === 0.0 && this.pivot.y === 0.0 && this.pivot.z === 0.0);\r\n\r\n m.copy(this.object.matrix);\r\n\r\n if (zeroPivot) {\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n } else {\r\n m.multiply(matrix4.makeTranslation(this.pivot.x, this.pivot.y, this.pivot.z));\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n m.multiply(matrix4.makeTranslation(-this.pivot.x, -this.pivot.y, -this.pivot.z));\r\n }\r\n\r\n m.decompose(p, q, s);\r\n\r\n // update objects\r\n if (!zeroPivot) {\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].position.copy(p);\r\n }\r\n }\r\n\r\n for (let j = 0; j < this.objects.length; ++j) {\r\n this.objects[j].quaternion.copy(q);\r\n this.objects[j].updateMatrix();\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.setObjects = function (objects) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n};\r\n\r\nObjectHandler.prototype.rotate = (function () {\r\n const rot = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n\r\n return function (quat, mousePrevPos, mouseCurPos, aboutAxis) {\r\n this.mouse2rotation(rot, mousePrevPos, mouseCurPos, aboutAxis);\r\n quat.setFromAxisAngle(rot.axis, rot.angle);\r\n\r\n if (rot.angle) {\r\n this._rotate(quat);\r\n }\r\n\r\n this.lastRotation = rot;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.translate = (function () {\r\n const dir = new THREE.Vector3();\r\n const pivot = new THREE.Vector3();\r\n\r\n return function (delta) {\r\n // reverse-project viewport movement to view coords (compensate for screen aspect ratio)\r\n dir.set(\r\n delta.x / this.camera.projectionMatrix.elements[0],\r\n delta.y / this.camera.projectionMatrix.elements[5],\r\n 0,\r\n );\r\n let dist = dir.length();\r\n dir.normalize();\r\n\r\n // transform movement direction to object local coords\r\n dir.transformDirection(matrix4.copy(this.object.matrixWorld).invert());\r\n\r\n // visible translate distance shouldn't depend on camera-to-object distance\r\n pivot.copy(this.pivot);\r\n this.object.localToWorld(pivot);\r\n dist *= Math.abs(pivot.z - this.camera.position.z);\r\n\r\n // visible translate distance shouldn't depend on object scale\r\n dist /= this.object.matrixWorld.getMaxScaleOnAxis();\r\n\r\n // all objects are translated similar to principal object\r\n // (we assume they all have identical pivot and scale)\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].translateOnAxis(dir, dist);\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.update = (function () {\r\n const axis = new THREE.Vector3();\r\n\r\n return function (timeSinceLastUpdate, timeSinceMove) {\r\n if (settings.now.autoRotation !== 0.0) {\r\n // auto-rotation with constant speed\r\n\r\n // if rotation axis is fixed or hasn't been defined yet\r\n if (settings.now.autoRotationAxisFixed || this.lastRotation.axis.length() === 0.0) {\r\n // use Y-axis (transformed to local object coords)\r\n axis.set(0, 1, 0).transformDirection(matrix4.copy(this.object.matrixWorld).invert());\r\n } else {\r\n // use axis defined by last user rotation\r\n axis.copy(this.lastRotation.axis);\r\n }\r\n\r\n this._rotate(quaternion.setFromAxisAngle(axis, settings.now.autoRotation * timeSinceLastUpdate));\r\n return true;\r\n }\r\n\r\n if (this.options.intertia && this.lastRotation.angle) {\r\n // inertial object rotation\r\n const angle = this.lastRotation.angle * ((1.0 - this.options.dynamicDampingFactor) ** (40.0 * timeSinceMove));\r\n\r\n if (Math.abs(angle) <= this.options.intertiaThreshold) {\r\n this.lastRotation.angle = 0.0;\r\n } else {\r\n this._rotate(quaternion.setFromAxisAngle(this.lastRotation.axis, angle));\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.stop = function () {\r\n this.lastRotation.angle = 0.0;\r\n};\r\n\r\n// calculate (axis, angle) pair from mouse/touch movement\r\nObjectHandler.prototype.mouse2rotation = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n const eye = new THREE.Vector3();\r\n const eyeDirection = new THREE.Vector3();\r\n\r\n const cameraUpDirection = new THREE.Vector3();\r\n const cameraSidewaysDirection = new THREE.Vector3();\r\n\r\n const moveDirection = new THREE.Vector3();\r\n\r\n const mouseDelta = new THREE.Vector2();\r\n\r\n return function (rot, mousePrev, mouseCur, aboutAxis) {\r\n if (aboutAxis) {\r\n rot.axis.copy(this.axis);\r\n rot.angle = this.options.axisRotateFactor * (mouseCur.y - mousePrev.y);\r\n\r\n /* cool method that allows rotation around Z axis to be \"tied\" to mouse cursor\r\n\r\n res.axis.copy(this.axis);\r\n\r\n var pivot = this.pivot.clone();\r\n this.object.localToWorld(pivot);\r\n pivot.project(this.camera);\r\n\r\n var v1 = new THREE.Vector3(mousePrev.x, mousePrev.y, this.camera.position.z);\r\n v1.sub(pivot);\r\n var v2 = new THREE.Vector3(mouseCur.x, mouseCur.y, this.camera.position.z);\r\n v2.sub(pivot);\r\n\r\n v1.sub(res.axis.clone().multiplyScalar(v1.dot(res.axis)));\r\n v2.sub(res.axis.clone().multiplyScalar(v2.dot(res.axis)));\r\n\r\n var abs = v1.length() * v2.length();\r\n if (abs > 0) {\r\n res.angle = res.axis.dot(v1.cross(v2)) / abs;\r\n }\r\n */\r\n } else {\r\n mouseDelta.subVectors(mouseCur, mousePrev);\r\n const angle = mouseDelta.length();\r\n if (angle === 0.0) {\r\n return;\r\n }\r\n\r\n center.copy(this.pivot);\r\n this.object.localToWorld(center);\r\n eye.subVectors(this.camera.position, center);\r\n eyeDirection.copy(eye).normalize();\r\n\r\n cameraUpDirection.copy(this.camera.up).normalize();\r\n cameraSidewaysDirection.crossVectors(cameraUpDirection, eyeDirection).normalize();\r\n\r\n cameraUpDirection.setLength(mouseDelta.y);\r\n cameraSidewaysDirection.setLength(mouseDelta.x);\r\n\r\n moveDirection.copy(cameraUpDirection.add(cameraSidewaysDirection));\r\n\r\n rot.axis.crossVectors(moveDirection, eye);\r\n\r\n rot.angle = -angle * this.options.rotateFactor;\r\n }\r\n\r\n rot.axis.transformDirection(matrix4.copy(this.object.matrixWorld).invert());\r\n\r\n // make sure angle is always positive (thus 'axis' defines both axis and direction of rotation)\r\n if (rot.angle < 0.0) {\r\n rot.axis.negate();\r\n rot.angle = -rot.angle;\r\n }\r\n };\r\n}());\r\n\r\nfunction ObjectControls(object, objectPivot, camera, domElement, getAltObj) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.object = object;\r\n this.objectPivot = objectPivot;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.getAltObj = getAltObj;\r\n\r\n // API\r\n\r\n this.enabled = true;\r\n this.hotkeysEnabled = true;\r\n\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n\r\n this.options = {\r\n rotateFactor: Math.PI, // full screen slide (along short side) would roughly mean 180 deg. rotation\r\n axisRotateFactor: 4 * Math.PI, // full screen slide (along short side) would roughly mean 720 deg. rotation\r\n intertia: true,\r\n dynamicDampingFactor: 0.1,\r\n intertiaThreshold: 1e-3,\r\n };\r\n\r\n // internals\r\n\r\n this._state = STATE.NONE;\r\n\r\n this._mousePrevPos = new THREE.Vector2();\r\n this._mouseCurPos = new THREE.Vector2();\r\n\r\n this._mainObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._altObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._affectedObj = this._mainObj;\r\n this._isAltObjFreeRotationAllowed = true;\r\n this._isTranslationAllowed = true;\r\n this._isKeysTranslatingObj = false;\r\n\r\n this._pressedKeys = [];\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n this._lastUpdateTime = this._clock.getElapsedTime();\r\n\r\n // events\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousewheel',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'DOMMouseScroll',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseout',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchmove',\r\n handler(e) {\r\n self.touchmove(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keydown',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keyup',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'blur',\r\n handler() {\r\n self.resetKeys();\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'contextmenu',\r\n handler(e) {\r\n self.contextmenu(e);\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n\r\n this.resetKeys();\r\n\r\n // force an update at start\r\n this.update();\r\n}\r\n\r\n// methods\r\n\r\nObjectControls.prototype = Object.create(EventDispatcher.prototype);\r\nObjectControls.prototype.constructor = ObjectControls;\r\n\r\nObjectControls.prototype.resetKeys = function () {\r\n this._pressedKeys[VK_LEFT] = false;\r\n this._pressedKeys[VK_UP] = false;\r\n this._pressedKeys[VK_RIGHT] = false;\r\n this._pressedKeys[VK_DOWN] = false;\r\n};\r\n\r\nObjectControls.prototype.contextmenu = function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n};\r\n\r\nObjectControls.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nObjectControls.prototype.enable = function (enable) {\r\n this.enabled = enable;\r\n};\r\n\r\nObjectControls.prototype.enableHotkeys = function (enable) {\r\n this.hotkeysEnabled = enable;\r\n};\r\n\r\nObjectControls.prototype.allowTranslation = function (allow) {\r\n this._isTranslationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.allowAltObjFreeRotation = function (allow) {\r\n this._isAltObjFreeRotationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.keysTranslateObj = function (on) {\r\n this._isKeysTranslatingObj = on;\r\n};\r\n\r\nObjectControls.prototype.isEditingAltObj = function () {\r\n return ((this._state === STATE.ROTATE) || (this._state === STATE.TRANSLATE))\r\n && (this._affectedObj === this._altObj);\r\n};\r\n\r\n// convert page coords of mouse/touch to uniform coords with smaller side being [-0.5, 0.5]\r\n// (uniform coords keep direct proportion with screen distance travelled by mouse regardless of screen aspect ratio)\r\nObjectControls.prototype.convertMouseToOnCircle = function (coords, pageX, pageY) {\r\n const screenSize = Math.min(this.screen.width, this.screen.height);\r\n\r\n if (screenSize === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n ((pageX - this.screen.width * 0.5 - this.screen.left) / screenSize),\r\n ((0.5 * this.screen.height + this.screen.top - pageY) / screenSize),\r\n );\r\n};\r\n\r\n// convert page coords of mouse/touch to viewport coords with both sides being [-1, 1]\r\n// (those are non-uniform coords affected by screen aspect ratio)\r\nObjectControls.prototype.convertMouseToViewport = function (coords, pageX, pageY) {\r\n if (this.screen.width === 0 || this.screen.height === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n (2.0 * (pageX - this.screen.width * 0.5 - this.screen.left) / this.screen.width),\r\n (2.0 * (0.5 * this.screen.height + this.screen.top - pageY) / this.screen.height),\r\n );\r\n};\r\n\r\nObjectControls.prototype.stop = function () {\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n};\r\n\r\n// rotate object based on latest mouse/touch movement\r\nObjectControls.prototype.rotateByMouse = (function () {\r\n const quat = new THREE.Quaternion();\r\n\r\n return function (aboutZAxis) {\r\n this._affectedObj.rotate(quat, this._mousePrevPos, this._mouseCurPos, aboutZAxis);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n };\r\n}());\r\n\r\n// rotate object by specified quaternion\r\nObjectControls.prototype.rotate = function (quat) {\r\n this.object.quaternion.multiply(quat);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n};\r\n\r\n// get object's orientation\r\nObjectControls.prototype.getOrientation = function () {\r\n return this.object.quaternion;\r\n};\r\n\r\n// set object's orientation\r\nObjectControls.prototype.setOrientation = function (quat) {\r\n this.object.quaternion.copy(quat);\r\n};\r\n\r\n// translate object based on latest mouse/touch movement\r\nObjectControls.prototype.translate = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this._affectedObj.translate(delta);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n };\r\n}());\r\n\r\n// get object scale\r\nObjectControls.prototype.getScale = function () {\r\n return this.object.scale.x;\r\n};\r\n\r\n// set uniform object scale\r\nObjectControls.prototype.setScale = function (scale) {\r\n this.object.scale.set(scale, scale, scale);\r\n};\r\n\r\n// scale object by factor (factor should be greater than zero)\r\nObjectControls.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n return;\r\n }\r\n this.setScale(this.object.scale.x * factor);\r\n this.dispatchEvent({ type: 'change', action: 'zoom', factor });\r\n};\r\n\r\nObjectControls.prototype.update = (function () {\r\n const shift = new THREE.Vector2();\r\n\r\n return function () {\r\n const curTime = this._clock.getElapsedTime();\r\n const timeSinceLastUpdate = curTime - this._lastUpdateTime;\r\n\r\n // update object handler\r\n if (this._state === STATE.NONE) {\r\n const timeSinceMove = curTime - this._lastMouseMoveTime;\r\n if (this._mainObj.update(timeSinceLastUpdate, timeSinceMove)\r\n || this._altObj.update(timeSinceLastUpdate, timeSinceMove)) {\r\n this.dispatchEvent({ type: 'change', action: 'auto' });\r\n }\r\n }\r\n\r\n // apply arrow keys\r\n if (this._isKeysTranslatingObj) {\r\n const speedX = Number(this._pressedKeys[VK_RIGHT]) - Number(this._pressedKeys[VK_LEFT]);\r\n const speedY = Number(this._pressedKeys[VK_UP]) - Number(this._pressedKeys[VK_DOWN]);\r\n if (speedX !== 0.0 || speedY !== 0.0) {\r\n const delta = timeSinceLastUpdate;\r\n\r\n // update object translation\r\n const altObj = this.getAltObj();\r\n if (altObj.objects.length > 0) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n\r\n shift.set(delta * speedX, delta * speedY);\r\n this._altObj.translate(shift);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n }\r\n }\r\n }\r\n\r\n this._lastUpdateTime = curTime;\r\n };\r\n}());\r\n\r\nObjectControls.prototype.reset = function () {\r\n this._state = STATE.NONE;\r\n\r\n this.object.quaternion.copy(quaternion.set(0, 0, 0, 1));\r\n};\r\n\r\n// listeners\r\n\r\nObjectControls.prototype.mousedown = function (event) {\r\n if (this.enabled === false || this._state !== STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (this._state === STATE.NONE) {\r\n if (event.button === 0) {\r\n this._affectedObj.stop(); // can edit only one object at a time\r\n\r\n let workWithAltObj = false;\r\n\r\n if (event.altKey) {\r\n const altObj = this.getAltObj();\r\n workWithAltObj = (altObj.objects.length > 0);\r\n if (workWithAltObj) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n this._affectedObj = workWithAltObj ? this._altObj : this._mainObj;\r\n\r\n this._state = (workWithAltObj && event.ctrlKey && this._isTranslationAllowed) ? STATE.TRANSLATE : STATE.ROTATE;\r\n } else if (event.button === 2) {\r\n this._state = STATE.TRANSLATE_PIVOT;\r\n }\r\n }\r\n\r\n if (this._state === STATE.ROTATE) {\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n\r\n if (this._state === STATE.TRANSLATE || this._state === STATE.TRANSLATE_PIVOT) {\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousemove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this.rotateByMouse((event.altKey && !this._isAltObjFreeRotationAllowed) || event.shiftKey);\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.TRANSLATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translate();\r\n break;\r\n\r\n case STATE.TRANSLATE_PIVOT:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translatePivotByMouse();\r\n break;\r\n\r\n default: break;\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousewheel = function (event) {\r\n if (this.enabled === false || !settings.now.zooming || this._state !== STATE.NONE || event.shiftKey) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n let delta = 0;\r\n\r\n if (event.wheelDelta) {\r\n // WebKit / Opera / Explorer 9\r\n delta = event.wheelDelta / 40;\r\n } else if (event.detail) {\r\n // Firefox\r\n delta = -event.detail / 3;\r\n }\r\n\r\n let factor = 1.0 + delta * 0.05;\r\n factor = Math.max(factor, 0.01);\r\n this.scale(factor);\r\n};\r\n\r\nObjectControls.prototype.mouseup = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n this._state = STATE.NONE;\r\n\r\n if (this._clock.getElapsedTime() - this._lastMouseMoveTime > FULL_STOP_THRESHOLD) {\r\n this._affectedObj.stop();\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchstartend = function (event) {\r\n if (this.enabled === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (event.touches.length) {\r\n case 1:\r\n this._state = STATE.ROTATE;\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n break;\r\n\r\n case 2: {\r\n // prevent inertial rotation\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n\r\n this._state = STATE.SCALE;\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = this._touchDistanceStart = Math.sqrt(dx * dx + dy * dy);\r\n this._scaleStart = this.object.scale.x;\r\n break;\r\n }\r\n\r\n default:\r\n this._state = STATE.NONE;\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchmove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this.rotateByMouse(false);\r\n\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.SCALE:\r\n if (settings.now.zooming) {\r\n // update scale\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = Math.sqrt(dx * dx + dy * dy);\r\n const newScale = this._scaleStart * this._touchDistanceCur / this._touchDistanceStart;\r\n const factor = newScale / this.object.scale.x;\r\n this.scale(factor);\r\n }\r\n break;\r\n\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.keydownup = function (event) {\r\n if (this.enabled === false || this.hotkeysEnabled === false) {\r\n return;\r\n }\r\n\r\n switch (event.keyCode) {\r\n case VK_LEFT:\r\n case VK_UP:\r\n case VK_RIGHT:\r\n case VK_DOWN:\r\n this._pressedKeys[event.keyCode] = (event.type === 'keydown');\r\n event.preventDefault();\r\n event.stopPropagation();\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.getKeyBindObject = function () {\r\n return getTopWindow();\r\n};\r\n\r\nObjectControls.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nObjectControls.prototype.translatePivotByMouse = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this.translatePivotInWorld(settings.now.translationSpeed * delta.x, settings.now.translationSpeed * delta.y, 0);\r\n };\r\n}());\r\n\r\n// Translate in WorldCS, translation is scaled with root scale matrix\r\nObjectControls.prototype.translatePivotInWorld = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.applyMatrix4(this.object.matrixWorld);\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n pos.applyMatrix4(matrix4.copy(this.object.matrixWorld).invert());\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Translate in ModelCS, x, y, z are Ang\r\nObjectControls.prototype.translatePivot = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Set pivot\r\nObjectControls.prototype.setPivot = function (newPivot) {\r\n this.objectPivot.position.copy(newPivot);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\nexport default ObjectControls;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\nimport Timer from '../Timer';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\n\r\nfunction Picker(gfxObj, camera, domElement) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.gfxObj = gfxObj;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n this._lastMousePos = new THREE.Vector2(0, 0);\r\n this._mouseTotalDist = 0.0;\r\n this._lastClickBeginTime = -1000.0;\r\n this._lastClickPos = new THREE.Vector2(0, 0);\r\n this._clickBeginTime = 0.0;\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstart(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchend(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n}\r\n\r\nPicker.prototype = Object.create(EventDispatcher.prototype);\r\nPicker.prototype.constructor = Picker;\r\n\r\nPicker.prototype.reset = function () {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n};\r\n\r\nPicker.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nPicker.prototype.pickObject = function (screenPos) {\r\n if (!this.gfxObj) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n const { gfxObj } = this;\r\n const rayCaster = new THREE.Raycaster();\r\n rayCaster.ray.origin.setFromMatrixPosition(this.camera.matrixWorld);\r\n rayCaster.ray.direction.set(screenPos.x, screenPos.y, 0.5).unproject(this.camera).sub(rayCaster.ray.origin).normalize();\r\n\r\n const clipPlane = (settings.now.draft.clipPlane && this.clipPlaneValue) ? this.clipPlaneValue : Infinity;\r\n const fogFarPlane = (settings.now.fog && this.fogFarValue) ? this.fogFarValue : Infinity;\r\n const point = rayCaster.intersectVisibleObject(gfxObj, this.camera, clipPlane, fogFarPlane);\r\n if (!point) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n let picked = {};\r\n if (point.residue || point.atom) {\r\n const residue = point.residue || point.atom.residue;\r\n if (settings.now.pick === 'chain') {\r\n picked = { chain: residue.getChain() };\r\n } else if (settings.now.pick === 'molecule') {\r\n picked = { molecule: residue.getMolecule() };\r\n } else if (point.residue || settings.now.pick === 'residue') {\r\n picked = { residue };\r\n } else if (point.atom) {\r\n picked = { atom: point.atom };\r\n }\r\n }\r\n this.picked = picked;\r\n this.dispatchEvent({ type: 'newpick', obj: picked });\r\n};\r\n\r\nPicker.prototype.getMouseInViewport = function (pageX, pageY) {\r\n return new THREE.Vector2(\r\n (pageX - this.screen.left) / this.screen.width * 2 - 1,\r\n -(pageY - this.screen.top) / this.screen.height * 2 + 1,\r\n );\r\n};\r\n\r\nPicker.prototype.mousedown = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n this._lastMousePos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist = 0.0;\r\n this._clickBeginTime = this._clock.getElapsedTime();\r\n }\r\n};\r\n\r\nPicker.prototype.mousemove = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n const pos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist += pos.sub(this._lastMousePos).length();\r\n};\r\n\r\nPicker.prototype.mouseup = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n if (this._mouseTotalDist < 0.01) {\r\n const curTime = this._clock.getElapsedTime();\r\n const curPos = this.getMouseInViewport(event.pageX, event.pageY);\r\n\r\n const timeSinceLastClickBegin = curTime - this._lastClickBeginTime;\r\n if (timeSinceLastClickBegin < 0.7) {\r\n const clickDist = new THREE.Vector2().subVectors(curPos, this._lastClickPos);\r\n if (clickDist.length() < 0.01) {\r\n // it's a double click\r\n this.dispatchEvent({ type: 'dblclick', obj: this.picked });\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = -1000; // this click cannot serve as first click in double-click\r\n return;\r\n }\r\n }\r\n\r\n setTimeout(() => {\r\n self.pickObject(curPos);\r\n }, 0);\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = this._clickBeginTime;\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.touchstart = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 1) {\r\n this._lastTouchdownPos = this.getMouseInViewport(event.touches[0].pageX, event.touches[0].pageY);\r\n }\r\n};\r\n\r\nPicker.prototype.touchend = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 0\r\n && event.changedTouches.length === 1) {\r\n const pos = this.getMouseInViewport(event.changedTouches[0].pageX, event.changedTouches[0].pageY);\r\n const dist = pos.sub(this._lastTouchdownPos).length();\r\n if (dist < 0.01) {\r\n setTimeout(() => {\r\n self.pickObject(self._lastTouchdownPos);\r\n }, 0);\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nexport default Picker;\r\n","import * as THREE from 'three';\r\n\r\nclass Axes {\r\n constructor(target, targetCamera) {\r\n this._target = target;\r\n this._targetCamera = targetCamera;\r\n this._camera = new THREE.PerspectiveCamera(targetCamera.fov, targetCamera.aspect, 1, 100);\r\n this._object = new THREE.AxesHelper(1);\r\n this._scene = new THREE.Scene();\r\n this._scene.add(this._object);\r\n this._full = new THREE.Vector2();\r\n\r\n this._update();\r\n }\r\n\r\n _update() {\r\n const { fov } = this._targetCamera;\r\n const camera = this._camera;\r\n camera.aspect = this._targetCamera.aspect;\r\n camera.setMinimalFov(fov);\r\n camera.setDistanceToFit(1.0, fov);\r\n camera.updateProjectionMatrix();\r\n\r\n this._object.quaternion.copy(this._target.quaternion);\r\n }\r\n\r\n render(renderer) {\r\n this._update();\r\n\r\n renderer.getSize(this._full);\r\n const width = this._full.width * 0.25;\r\n const height = this._full.height * 0.25;\r\n\r\n const { autoClear } = renderer;\r\n renderer.autoClear = false;\r\n renderer.setViewport(0.0, 0.0, width, height);\r\n renderer.clear(false, true, false);\r\n renderer.render(this._scene, this._camera);\r\n renderer.setViewport(0, 0, this._full.width, this._full.height);\r\n renderer.autoClear = autoClear;\r\n }\r\n}\r\nexport default Axes;\r\n","import * as THREE from 'three';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\n\r\nconst cDataOffset = 12;\r\nconst cFirstMask = 0x0FFFFF00;\r\nconst cFirstShift = 8;\r\nconst cSecMask1 = 0x000000FF;\r\nconst cSecShift1 = 12;\r\nconst cSecMask2 = 0xFFF00000;\r\nconst cSecShift2 = 20;\r\nconst cThirdMask = 0x000FFFFF;\r\nconst cStrMask = 0xF0000000;\r\nconst cStrShift = 28;\r\nconst c219 = 1 << 19;\r\nconst c220 = 1 << 20;\r\n\r\nconst cHelixIdx = 1;\r\nconst cSheetIdx = 2;\r\nconst secTypes = ['helix', 'strand'];\r\nconst cSecNames = ['fs', 'ps', 'ns', 'us'];\r\n\r\nfunction _createSecondary(strArray, complex) {\r\n const residues = complex._residues;\r\n const nRes = residues.length;\r\n const resid = new Uint8Array(nRes);\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, n = strArray.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n resid[atom.residue._index] = strArray[i];\r\n }\r\n\r\n const secondary = [];\r\n let rIdx = 0;\r\n while (rIdx < nRes) {\r\n if (resid[rIdx] !== 0) {\r\n const start = rIdx;\r\n const val = resid[rIdx];\r\n while (rIdx < nRes - 1 && resid[rIdx + 1] === val\r\n && residues[rIdx].isConnected(residues[rIdx + 1])) {\r\n ++rIdx;\r\n }\r\n secondary.push({ start, end: rIdx, type: secTypes[val - 1] });\r\n }\r\n ++rIdx;\r\n }\r\n return secondary;\r\n}\r\n\r\nfunction fromUInt20ToInt20(uint20) {\r\n return uint20 >= c219 ? uint20 - c220 : uint20;\r\n}\r\n\r\nclass FrameInfo {\r\n constructor(complex, payload, callbacks) {\r\n this._complex = complex;\r\n this._secondary = null;\r\n this.isLoading = false;\r\n this._framesRange = {\r\n start: 0,\r\n end: -1,\r\n };\r\n this.frameIsReady = false;\r\n this._buffer = null;\r\n this._frameRequest = null;\r\n this._callbacks = callbacks;\r\n if (typeof payload === 'function') {\r\n this._framesRequestLength = 1;\r\n this._downloadDataFn = payload;\r\n } else {\r\n this.parseBinaryData(payload, true);\r\n }\r\n this.reset();\r\n this.setFrame(0);\r\n }\r\n\r\n _prepareBuffer(framesStart, framesEnd) {\r\n if (framesStart === undefined || framesStart === null) {\r\n framesStart = 0;\r\n }\r\n if (framesEnd === undefined || framesEnd === null) {\r\n framesEnd = framesStart + this._framesRequestLength;\r\n }\r\n if (this._framesCount !== undefined) {\r\n framesEnd = Math.min(this._framesCount - 1, framesEnd);\r\n }\r\n if (this._downloadDataFn) {\r\n const self = this;\r\n const onDone = function (data) {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n self._buffer = {\r\n data,\r\n state: 'ready',\r\n start: framesStart,\r\n end: framesEnd,\r\n };\r\n if (self._frameRequest !== null) {\r\n const idx = self._frameRequest;\r\n self._frameRequest = null;\r\n self.setFrame(idx);\r\n }\r\n };\r\n const onFail = function () {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onError === 'function') {\r\n self._callbacks.onError('Streaming failed');\r\n }\r\n };\r\n if (!this._buffer) {\r\n this._buffer = {};\r\n }\r\n this._buffer.state = 'downloading';\r\n this.isLoading = true;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n this._downloadDataFn({ start: framesStart, end: framesEnd + 1 }, onDone, onFail);\r\n }\r\n }\r\n\r\n _parseBuffer() {\r\n if (this._buffer && this._buffer.state === 'ready') {\r\n this._framesRange = {\r\n start: this._buffer.start,\r\n end: this._buffer.end,\r\n };\r\n this.parseBinaryData(this._buffer.data, false);\r\n let _bufferRequestStart = (this._buffer.end + 1) % this._framesCount;\r\n if (_bufferRequestStart >= this._framesCount) {\r\n _bufferRequestStart = 0;\r\n }\r\n this._buffer = {\r\n state: 'none',\r\n };\r\n this._prepareBuffer(_bufferRequestStart, _bufferRequestStart + this._framesRequestLength);\r\n if (this._frameRequest !== null) {\r\n const idx = this._frameRequest;\r\n this._frameRequest = null;\r\n this.setFrame(idx);\r\n }\r\n }\r\n }\r\n\r\n parseBinaryData(arrayBuffer) {\r\n const dataView = new DataView(arrayBuffer);\r\n let offset = 0;\r\n const atomsCount = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const framesCount = dataView.getUint32(offset, true);\r\n this._framesCount = framesCount;\r\n this._framesRange.end = this._framesRange.end > 0\r\n ? Math.min(this._framesRange.end, framesCount - 1) : framesCount - 1;\r\n offset += 4;\r\n this._atomsCount = atomsCount;\r\n const maxSize = 1024 * 1024; // 1 MB\r\n this._framesRequestLength = Math.ceil(maxSize / (atomsCount * 8));\r\n const chunkedFramesCount = this._framesRange.end - this._framesRange.start + 1;\r\n if (atomsCount !== this._complex._atoms.length\r\n || arrayBuffer.byteLength !== cDataOffset + chunkedFramesCount * atomsCount * 8) {\r\n throw new Error();\r\n }\r\n const complex = this._complex;\r\n let timeStep = dataView.getUint32(offset, true);\r\n let iName = 0;\r\n while (timeStep > 1000 && iName < cSecNames.length - 1) {\r\n timeStep /= 1000;\r\n ++iName;\r\n }\r\n\r\n this._timeStep = `${timeStep.toString()} ${cSecNames[iName]}`;\r\n offset += 4;\r\n const secondary = [];\r\n const posData = new Float32Array(chunkedFramesCount * atomsCount * 3);\r\n let coordIdx = 0;\r\n const secondaryArr = new Int8Array(atomsCount);\r\n for (let j = 0; j < chunkedFramesCount; ++j) {\r\n for (let i = 0; i < atomsCount; ++i) {\r\n const hiWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const loWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const str = (loWord & cStrMask) >>> cStrShift;\r\n const x = fromUInt20ToInt20(((loWord & cFirstMask) >>> cFirstShift) >> 0);\r\n const y = fromUInt20ToInt20((((loWord & cSecMask1) << cSecShift1)\r\n | ((hiWord & cSecMask2) >>> cSecShift2)) >> 0);\r\n const z = fromUInt20ToInt20((hiWord & cThirdMask) >> 0);\r\n secondaryArr[i] = 0;\r\n if (str > 0 && str < 4) {\r\n secondaryArr[i] = cHelixIdx;\r\n } else if (str === 4) {\r\n secondaryArr[i] = cSheetIdx;\r\n }\r\n posData[coordIdx++] = x / 100;\r\n posData[coordIdx++] = y / 100;\r\n posData[coordIdx++] = z / 100;\r\n }\r\n secondary.push(_createSecondary(secondaryArr, complex));\r\n }\r\n this._secondaryData = secondary;\r\n this._data = posData;\r\n }\r\n\r\n nextFrame() {\r\n this.setFrame((this._currFrame + 1) % this._framesCount);\r\n }\r\n\r\n needsColorUpdate(colorer) {\r\n return colorer instanceof SecondaryStructureColorer;\r\n }\r\n\r\n getAtomColor(colorer, atom) {\r\n return colorer.getResidueColor(this._residues[atom.residue._index], this._complex);\r\n }\r\n\r\n getResidueColor(colorer, residue) {\r\n return colorer.getResidueColor(this._residues[residue._index], this._complex);\r\n }\r\n\r\n _updateSecondary() {\r\n let i;\r\n const myResidues = this._residues;\r\n let n = myResidues.length;\r\n for (i = 0; i < n; ++i) {\r\n myResidues[i]._secondary = null;\r\n }\r\n const sec = this._secondaryData[this._currFrame - this._framesRange.start];\r\n for (i = 0, n = sec.length; i < n; ++i) {\r\n const oldSec = sec[i];\r\n const { start, end } = oldSec;\r\n const nSec = {\r\n _start: myResidues[start],\r\n _end: myResidues[end],\r\n type: oldSec.type,\r\n generic: oldSec.generic,\r\n };\r\n for (let j = start; j <= end; ++j) {\r\n myResidues[j]._secondary = nSec;\r\n }\r\n }\r\n }\r\n\r\n reset() {\r\n const compRes = this._complex._residues;\r\n const n = compRes.length;\r\n this._residues = new Array(n);\r\n const myResidues = this._residues;\r\n const getSec = function () {\r\n return this._secondary;\r\n };\r\n for (let i = 0; i < n; ++i) {\r\n myResidues[i] = {\r\n _type: compRes[i]._type,\r\n _isValid: compRes[i]._isValid,\r\n _controlPoint: null,\r\n _wingVector: null,\r\n _secondary: null,\r\n getSecondary: getSec,\r\n };\r\n }\r\n }\r\n\r\n setFrame(frameIdx) {\r\n this.frameIsReady = false;\r\n if (frameIdx >= this._framesRange.start && frameIdx <= this._framesRange.end) {\r\n this._currFrame = frameIdx;\r\n this._cachedResidues = false;\r\n this._updateSecondary();\r\n this.frameIsReady = true;\r\n } else {\r\n this._frameRequest = frameIdx;\r\n if (!this._buffer) {\r\n this._prepareBuffer(frameIdx);\r\n } else {\r\n const self = this;\r\n switch (this._buffer.state) {\r\n case 'none':\r\n this._prepareBuffer(frameIdx);\r\n break;\r\n case 'ready':\r\n self._parseBuffer();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n disableEvents() {\r\n this._callbacks = null;\r\n }\r\n\r\n /**\r\n * Returns link to atom pos vector, clone it if needed\r\n */\r\n\r\n static _vec = new THREE.Vector3();\r\n\r\n getAtomPos(atomIdx) {\r\n const vec = FrameInfo._vec;\r\n const self = this;\r\n const data = self._data;\r\n const idx = (self._atomsCount * (self._currFrame - self._framesRange.start) + atomIdx) * 3;\r\n vec.set(data[idx], data[idx + 1], data[idx + 2]);\r\n return vec;\r\n }\r\n\r\n getResidues() {\r\n if (this._cachedResidues) {\r\n return this._residues;\r\n }\r\n this._complex.updateToFrame(this);\r\n return this._residues;\r\n }\r\n}\r\nexport default FrameInfo;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\n\r\n/**\r\n * Create new scene object.\r\n *\r\n * @param {array=} params - Object required params.\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports SceneObject\r\n * @this SceneObject\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all scene objects that are not reps.\r\n */\r\nclass SceneObject {\r\n constructor(params, opts) {\r\n if (this.constructor === SceneObject) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Object's options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.params = params;\r\n this.opts = _.merge(utils.deriveDeep(settings.now.objects[this.type], true), opts);\r\n this.needsRebuild = false;\r\n this._mesh = null;\r\n this.id = null;\r\n }\r\n\r\n /**\r\n * Get object identification, probably with options.\r\n * @returns {Object} field type contains type information, params - object's formal parameters,\r\n * opts - changed options\r\n * Options are returned if they were changed during or after object creation.\r\n */\r\n identify() {\r\n const result = {\r\n type: this.type,\r\n params: this.params,\r\n };\r\n const diff = utils.objectsDiff(this.opts, settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n result.opts = diff;\r\n }\r\n return result;\r\n }\r\n\r\n toString() {\r\n const paramsStr = `o=${this.type},${this.params.join(',')}`;\r\n const optsStr = utils.compareOptionsWithDefaults(this.opts, settings.defaults.objects[this.type]);\r\n return paramsStr + optsStr;\r\n }\r\n\r\n getGeometry() {\r\n return this._mesh;\r\n }\r\n\r\n destroy() {\r\n if (this._mesh) {\r\n gfxutils.destroyObject(this._mesh);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Scene object identifier.\r\n * @type {string}\r\n */\r\nSceneObject.prototype.type = '__';\r\n\r\nexport default SceneObject;\r\n","import * as THREE from 'three';\r\nimport SceneObject from './SceneObject';\r\nimport meshutils from '../meshutils';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\nimport meshes from '../meshes/meshes';\r\nimport settings from '../../settings';\r\n\r\nclass LinesObj extends SceneObject {\r\n constructor(params, opts) {\r\n super(params, opts);\r\n if (params.length < 2) {\r\n throw new Error('Wrong number of argumets on line object creation!');\r\n }\r\n [this._id1, this._id2] = params;\r\n }\r\n\r\n _getAtomFromName(complex, atomId) {\r\n const err = ' - Wrong atom format it must be \\'#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME\\' (e.g. \\'A.38.CO1\\')';\r\n const atom1 = complex.getAtomByFullname(atomId);\r\n if (!atom1) {\r\n throw new Error(atomId + err);\r\n }\r\n return atom1;\r\n }\r\n\r\n build(complex) {\r\n const geom = new THREE.BufferGeometry();\r\n this._atom1 = this._getAtomFromName(complex, this._id1);\r\n this._atom2 = this._getAtomFromName(complex, this._id2);\r\n\r\n const p1 = this._atom1.position;\r\n const p2 = this._atom2.position;\r\n const vertices = new Float32Array([\r\n p1.x, p1.y, p1.z,\r\n p2.x, p2.y, p2.z,\r\n ]);\r\n\r\n geom.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\r\n geom.computeBoundingBox();\r\n\r\n this._line = new meshes.Line(geom, new UberMaterial({\r\n lights: false,\r\n overrideColor: true,\r\n dashedLine: true,\r\n fogTransparent: settings.now.bg.transparent,\r\n }));\r\n this._line.computeLineDistances();\r\n this._line.material.setUberOptions({\r\n fixedColor: new THREE.Color(this.opts.color),\r\n dashedLineSize: this.opts.dashSize,\r\n dashedLinePeriod: this.opts.dashSize + this.opts.gapSize,\r\n });\r\n this._line.material.updateUniforms();\r\n\r\n this._line.raycast = function (_raycaster, _intersects) {};\r\n this._mesh = this._line;\r\n const transforms = complex.getTransforms();\r\n if (transforms.length > 0) {\r\n this._mesh = new THREE.Group();\r\n this._mesh.add(this._line);\r\n meshutils.applyTransformsToMeshes(this._mesh, transforms);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n if (!this._atom1 || !this._atom2 || !this._line) {\r\n return;\r\n }\r\n\r\n const geo = this._line.geometry;\r\n geo.vertices[0].copy(frameData.getAtomPos(this._atom1.index));\r\n geo.vertices[1].copy(frameData.getAtomPos(this._atom2.index));\r\n this._line.computeLineDistances();\r\n geo.computeBoundingSphere();\r\n\r\n geo.verticesNeedUpdate = true;\r\n }\r\n}\r\n\r\nLinesObj.prototype.constructor = LinesObj;\r\nLinesObj.prototype.type = 'line';\r\n\r\nexport default LinesObj;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Outline.frag';\r\n\r\nclass OutlineMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n // add depth outline\r\n super(params);\r\n\r\n const settings = {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcDepthTex: { type: 't', value: null },\r\n srcTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n color: { type: 'v3', value: null },\r\n threshold: { type: 'f', value: null },\r\n opacity: { type: 'f', value: 1.0 },\r\n thickness: { type: 'v2', value: new THREE.Vector2(1, 1) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: true,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n\r\n this.setValues(settings);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n const defines = {};\r\n\r\n if (this.depth) {\r\n defines.DEPTH_OUTLINE = 1;\r\n }\r\n\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nOutlineMaterial.prototype.depth = false;\r\n\r\nexport default OutlineMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './FXAA.frag';\r\n\r\nclass FXAAMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n bgColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.bgTransparent) {\r\n defines.BG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nFXAAMaterial.prototype.bgTransparent = false;\r\n\r\nexport default FXAAMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AO.frag';\r\nimport noise from '../noiseTexture';\r\n\r\nconst _samplesKernel = [\r\n // hemisphere samples adopted to sphere\r\n new THREE.Vector3(0.295184, 0.077723, 0.068429),\r\n new THREE.Vector3(-0.271976, -0.365221, 0.838363),\r\n new THREE.Vector3(0.547713, 0.467576, 0.488515),\r\n new THREE.Vector3(0.662808, -0.031733, 0.584758),\r\n new THREE.Vector3(-0.025717, 0.218955, 0.657094),\r\n new THREE.Vector3(-0.310153, -0.365223, 0.370701),\r\n new THREE.Vector3(-0.101407, -0.006313, 0.747665),\r\n new THREE.Vector3(-0.769138, 0.360399, 0.086847),\r\n new THREE.Vector3(-0.271988, -0.275140, 0.905353),\r\n new THREE.Vector3(0.096740, -0.566901, 0.700151),\r\n new THREE.Vector3(0.562872, -0.735136, 0.094647),\r\n new THREE.Vector3(0.379877, 0.359278, 0.190061),\r\n new THREE.Vector3(0.519064, -0.023055, 0.405068),\r\n new THREE.Vector3(-0.301036, 0.114696, 0.088885),\r\n new THREE.Vector3(-0.282922, 0.598305, 0.487214),\r\n new THREE.Vector3(-0.181859, 0.251670, 0.679702),\r\n new THREE.Vector3(-0.191463, -0.635818, 0.512919),\r\n new THREE.Vector3(-0.293655, 0.427423, 0.078921),\r\n new THREE.Vector3(-0.267983, 0.680534, 0.132880),\r\n new THREE.Vector3(0.139611, 0.319637, 0.477439),\r\n new THREE.Vector3(-0.352086, 0.311040, 0.653913),\r\n new THREE.Vector3(0.321032, 0.805279, 0.487345),\r\n new THREE.Vector3(0.073516, 0.820734, 0.414183),\r\n new THREE.Vector3(-0.155324, 0.589983, 0.411460),\r\n new THREE.Vector3(0.335976, 0.170782, 0.527627),\r\n new THREE.Vector3(0.463460, -0.355658, 0.167689),\r\n new THREE.Vector3(0.222654, 0.596550, 0.769406),\r\n new THREE.Vector3(0.922138, -0.042070, 0.147555),\r\n new THREE.Vector3(-0.727050, -0.329192, 0.369826),\r\n new THREE.Vector3(-0.090731, 0.533820, 0.463767),\r\n new THREE.Vector3(-0.323457, -0.876559, 0.238524),\r\n new THREE.Vector3(-0.663277, -0.372384, 0.342856),\r\n];\r\n\r\nclass AOMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n noiseTexture: { type: 't', value: noise.noiseTexture },\r\n noiseTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight) },\r\n diffuseTexture: { type: 't', value: null },\r\n normalTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n camNearFar: { type: 'v2', value: new THREE.Vector2(1.0, 10.0) },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n samplesKernel: { type: 'v3v', value: _samplesKernel },\r\n kernelRadius: { type: 'f', value: 1.0 },\r\n depthThreshold: { type: 'f', value: 1.0 },\r\n factor: { type: 'f', value: 1.0 },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOHorBlur.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOHorBlurMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOHorBlurMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOVertBlurWithBlend.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOVertBlurWithBlendMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n diffuseTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n fogNearFar: { type: 'v2', value: new THREE.Vector2(100.0, 100.0) },\r\n fogColor: { type: 'v4', value: new THREE.Vector4(0.0, 0.5, 0.0, 1.0) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.useFog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nAOVertBlurWithBlendMaterial.prototype.useFog = true;\r\nAOVertBlurWithBlendMaterial.prototype.fogTransparent = false;\r\n\r\nexport default AOVertBlurWithBlendMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Anaglyph.frag';\r\n\r\nclass AnaglyphMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n const settings = {\r\n uniforms: {\r\n srcL: { type: 't', value: null },\r\n srcR: { type: 't', value: null },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n this.setValues(settings);\r\n }\r\n}\r\n\r\nexport default AnaglyphMaterial;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\n\r\nclass View {\r\n constructor() {\r\n this.position = new THREE.Vector3(0, 0, 0);\r\n this.scale = 1;\r\n this.orientation = new THREE.Quaternion(0, 0, 0, 1);\r\n }\r\n\r\n set(position, scale, orientation) {\r\n this.position = position;\r\n this.scale = scale;\r\n this.orientation = orientation;\r\n }\r\n}\r\n\r\nconst _transitionTime = 1.5; // in seconds\r\n\r\nexport default class ViewInterpolator {\r\n setup(startView, endView) {\r\n this._startTime = undefined;\r\n this._endTime = undefined;\r\n this._isPaused = false;\r\n\r\n this._srcView = startView;\r\n this._dstView = endView;\r\n this._isMoving = false;\r\n }\r\n\r\n isMoving() {\r\n return this._isMoving;\r\n }\r\n\r\n wasStarted() {\r\n return typeof this._startTime !== 'undefined' && typeof this._endTime !== 'undefined';\r\n }\r\n\r\n start() {\r\n this._startTime = Date.now();\r\n const transTime = settings.now.interpolateViews ? _transitionTime * 1000 : 0;\r\n this._endTime = this._startTime + transTime;\r\n this._isMoving = true;\r\n }\r\n\r\n getCurrentView() {\r\n if (typeof this._srcView === 'undefined' || typeof this._dstView === 'undefined'\r\n || !this._isMoving || !this.wasStarted()) {\r\n return { success: false };\r\n }\r\n\r\n let view = this.createView();\r\n const time = Date.now();\r\n if (time > this._endTime) {\r\n view = this._dstView;\r\n this.reset();\r\n return { success: true, view };\r\n }\r\n\r\n const factor = (time - this._startTime) / (this._endTime - this._startTime);\r\n view.position.copy(this._srcView.position);\r\n view.position.lerp(this._dstView.position, factor);\r\n view.scale = (1 - factor) * this._srcView.scale + factor * this._dstView.scale;\r\n view.orientation.copy(this._srcView.orientation);\r\n view.orientation.slerp(this._dstView.orientation, factor);\r\n return { success: true, view };\r\n }\r\n\r\n reset() {\r\n this._startTime = this._endTime = 0;\r\n this._isMoving = false;\r\n }\r\n\r\n pause() {\r\n if (!this._isPaused) {\r\n this.setup(this.getCurrentView().view, this._dstView);\r\n this._isPaused = true;\r\n }\r\n }\r\n\r\n resume() {\r\n this._isPaused = false;\r\n }\r\n\r\n createView() {\r\n return new View();\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport makeContextDependent from './makeContextDependent';\r\n\r\nconst MAX_COOKIE_LEN = 4000;\r\nconst COUNT_SUFFIX = 'Cnt';\r\n\r\nfunction _chunkString(string, chunkLen) {\r\n const l = string.length;\r\n const chunks = [];\r\n for (let c = 0, lc = 0; lc < l; c++, lc += chunkLen) {\r\n chunks[c] = string.slice(lc, lc + chunkLen);\r\n }\r\n return chunks;\r\n}\r\n\r\n/**\r\n * Create new context dependent Cookie holder object.\r\n * @param context\r\n * @param {Object} opts - options\r\n * @param {string} opts.path - cookie path\r\n * @constructor\r\n */\r\nfunction Cookies(context, opts) {\r\n this.context = context;\r\n this._opts = _.merge({\r\n path: '/',\r\n }, opts);\r\n}\r\n\r\nmakeContextDependent(Cookies.prototype);\r\n\r\n/**\r\n * Remove cookie by the name.\r\n * @param key\r\n */\r\nCookies.prototype.removeCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n this._removeSimpleCookie(key);\r\n return;\r\n }\r\n this._removeSimpleCookie(cntKey);\r\n cntVal = parseInt(cntVal, 10);\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._removeSimpleCookie(key + i);\r\n }\r\n};\r\n\r\n/**\r\n * Set new cookie value. Automatically splits\r\n * values that are too large into multiple cookies.\r\n * @param key\r\n * @param value\r\n */\r\nCookies.prototype.setCookie = function (key, value) {\r\n this.removeCookie(key);\r\n value = encodeURIComponent(value);\r\n const values = _chunkString(value, MAX_COOKIE_LEN - key.length - 1);\r\n const cntVal = values.length;\r\n if (cntVal === 1) {\r\n this._setSimpleCookie(key, value);\r\n return;\r\n }\r\n const cntKey = this._toCount(key);\r\n this._setSimpleCookie(cntKey, cntVal.toString());\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._setSimpleCookie(key + i, values[i]);\r\n }\r\n};\r\n\r\n/**\r\n * Obtain the value of a compound cookie.\r\n * @param key\r\n */\r\nCookies.prototype.getCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n return this._getSimpleCookie(key);\r\n }\r\n cntVal = parseInt(cntVal, 10);\r\n const value = [];\r\n for (let i = 0; i < cntVal; ++i) {\r\n value[i] = this._getSimpleCookie(key + i);\r\n }\r\n return value.join('');\r\n};\r\n\r\nCookies.prototype._toCount = function (key) {\r\n return key + COUNT_SUFFIX;\r\n};\r\n\r\nCookies.prototype._removeSimpleCookie = function (key) {\r\n document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\r\n};\r\n\r\nCookies.prototype._getExpirationDate = function () {\r\n const today = new Date();\r\n const EXP_PERIOD_YEARS = 10;\r\n today.setFullYear(today.getFullYear() + EXP_PERIOD_YEARS);\r\n return today;\r\n};\r\n\r\nCookies.prototype._setSimpleCookie = function (key, value) {\r\n document.cookie = `${key}=${value\r\n };expires=${this._getExpirationDate().toUTCString()\r\n };path=${this._opts.path}`;\r\n};\r\n\r\nCookies.prototype._getSimpleCookie = function (key) {\r\n const matches = document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n return matches ? decodeURIComponent(matches[1]) : '';\r\n};\r\n\r\nCookies.prototype._exists = function (key) {\r\n return document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n};\r\n\r\nexport default Cookies;\r\n","/*\r\n * Toggling WebVR is done through button.click because of limitations on calling requestPresent in webVR:\r\n * VRDisplay::requestPresent should be called from user gesture:\r\n * https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestPresent\r\n */\r\nexport default function (webVRPoC) {\r\n function showEnterVR(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'pointer';\r\n button.style.left = 'calc(50% - 50px)';\r\n button.style.width = '100px';\r\n\r\n button.textContent = 'ENTER VR';\r\n\r\n let currentSession = null;\r\n\r\n function onSessionEnded(/* event */) {\r\n currentSession.removeEventListener('end', onSessionEnded);\r\n button.textContent = 'ENTER VR';\r\n currentSession = null;\r\n }\r\n\r\n function onSessionStarted(session) {\r\n session.addEventListener('end', onSessionEnded);\r\n webVRPoC._gfx.renderer.xr.setReferenceSpaceType('local');\r\n webVRPoC._gfx.renderer.xr.setSession(session);\r\n button.textContent = 'EXIT VR';\r\n currentSession = session;\r\n }\r\n\r\n button.onmouseenter = function () { button.style.opacity = '1.0'; };\r\n button.onmouseleave = function () { button.style.opacity = '0.5'; };\r\n\r\n button.onclick = function () {\r\n if (currentSession === null) {\r\n // WebXR's requestReferenceSpace only works if the corresponding feature\r\n // was requested at session creation time. For simplicity, just ask for\r\n // the interesting ones as optional features, but be aware that the\r\n // requestReferenceSpace call will fail if it turns out to be unavailable.\r\n // ('local' is always available for immersive sessions and doesn't need to\r\n // be requested separately.)\r\n\r\n const sessionInit = { optionalFeatures: ['local-floor', 'bounded-floor'] };\r\n navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted);\r\n webVRPoC.moveSceneBehindHeadset();\r\n } else {\r\n currentSession.end();\r\n }\r\n };\r\n }\r\n\r\n function showWebXRNotFound(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'auto';\r\n button.style.left = 'calc(50% - 75px)';\r\n button.style.width = '150px';\r\n button.textContent = 'VR NOT FOUND';\r\n button.onmouseenter = null;\r\n button.onmouseleave = null;\r\n button.onclick = null;\r\n }\r\n\r\n function stylizeElement(element) {\r\n element.style.position = 'absolute';\r\n element.style.bottom = '20px';\r\n element.style.padding = '12px 6px';\r\n element.style.border = '1px solid #fff';\r\n element.style.borderRadius = '4px';\r\n element.style.background = 'transparent';\r\n element.style.color = '#fff';\r\n element.style.font = 'normal 13px sans-serif';\r\n element.style.textAlign = 'center';\r\n element.style.opacity = '0.5';\r\n element.style.outline = 'none';\r\n element.style.zIndex = '999';\r\n }\r\n\r\n if ('xr' in navigator) {\r\n const button = document.createElement('button');\r\n button.style.display = 'none';\r\n stylizeElement(button);\r\n navigator.xr.isSessionSupported('immersive-vr').then((supported) => (\r\n supported ? showEnterVR(button) : showWebXRNotFound(button)\r\n ));\r\n return button;\r\n }\r\n const message = document.createElement('a');\r\n message.href = 'https://webvr.info';\r\n message.innerHTML = 'WEBXR NOT SUPPORTED';\r\n message.style.left = 'calc(50% - 90px)';\r\n message.style.width = '180px';\r\n message.style.textDecoration = 'none';\r\n stylizeElement(message);\r\n return message;\r\n}\r\n","import * as THREE from 'three';\r\nimport createWebVRButton from './createWebVRButton';\r\nimport gfxutils from '../gfxutils';\r\nimport logger from '../../utils/logger';\r\nimport settings from '../../settings';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default class WebVRPoC {\r\n constructor(onToggle) {\r\n this._mainCamera = new THREE.PerspectiveCamera();\r\n this._button = null;\r\n this._onToggle = onToggle;\r\n\r\n this._molContainer = new gfxutils.RCGroup();\r\n this._user = new gfxutils.RCGroup();\r\n this._scalingPivot = new THREE.Object3D();\r\n this._user.add(this._scalingPivot);\r\n\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n this._pressedGripsCounter = 0;\r\n this._distance = 0;\r\n\r\n this._gfx = null;\r\n }\r\n\r\n startScalingByControllers() {\r\n // reset scale\r\n this._distance = this._controller1.position.distanceTo(this._controller2.position);\r\n gfxutils.getMiddlePoint(this._controller1.position, this._controller2.position, this._scalingPivot.position);\r\n this._scalingPivot.scale.set(1, 1, 1);\r\n this._scalingPivot.updateMatrix();\r\n this._scalingPivot.updateMatrixWorld();\r\n // link molecule to pivot\r\n this._scalingPivot.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n stopScalingByControllers() {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n handleGripsDown(event) {\r\n this._pressedGripsCounter++;\r\n if (this._pressedGripsCounter === 2) {\r\n this.startScalingByControllers();\r\n } else if (this._pressedGripsCounter === 1) {\r\n event.target.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n handleGripsUp(event) {\r\n this._pressedGripsCounter--;\r\n if (this._pressedGripsCounter === 1) {\r\n this.stopScalingByControllers();\r\n // reattach molecule to other controller\r\n const anotherController = event.target === this._controller1 ? this._controller2 : this._controller1;\r\n anotherController.addSavingWorldTransform(this._molContainer);\r\n } else if (this._pressedGripsCounter === 0) {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n enable(gfx) {\r\n if (!gfx) {\r\n logger.warn('WebVR couldn\\'t be enabled, because gfx is not defined');\r\n return;\r\n }\r\n this._gfx = gfx;\r\n const { renderer, camera } = gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n if (!camera) {\r\n throw new Error('No camera is available to toggle WebVR');\r\n }\r\n\r\n // enable xr in renderer\r\n renderer.xr.enabled = true;\r\n // add button for turning vr mode\r\n if (!this._button) {\r\n this._button = createWebVRButton(this);\r\n document.body.appendChild(this._button);\r\n } else {\r\n this._button.style.display = 'block';\r\n }\r\n // store fog setting\r\n this._mainFog = settings.now.fog;\r\n settings.set('fog', false);\r\n\r\n this._plugVRNodesIntoScene(gfx, renderer);\r\n this._setControllersListeners();\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n _plugVRNodesIntoScene(gfx, renderer) {\r\n // store common scene camera\r\n this._mainCamera.copy(gfx.camera);\r\n // add hierarchical structure for webVR into scene\r\n gfx.scene.add(this._user);\r\n // turn on webvr transformation\r\n gfx.scene.add(this._molContainer);\r\n this._molContainer.add(gfx.root);\r\n\r\n this._controller1 = renderer.xr.getController(0);\r\n this._controller2 = renderer.xr.getController(1);\r\n const mesh = this._createControllerMesh();\r\n this._controller1.add(mesh);\r\n this._controller2.add(mesh.clone());\r\n this._user.add(this._controller1);\r\n this._user.add(this._controller2);\r\n }\r\n\r\n _setControllersListeners() {\r\n this._controller1.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n\r\n this._controller1.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n }\r\n\r\n disable() {\r\n if (!this._gfx) {\r\n return;\r\n }\r\n const { renderer, camera } = this._gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n\r\n // nullify webxr callback for animation frame\r\n renderer.setAnimationLoop(null);\r\n const session = renderer.xr.getSession();\r\n if (session) {\r\n session.end();\r\n }\r\n renderer.xr.enabled = false;\r\n // remove button of VR entering\r\n if (this._button) {\r\n this._button.style.display = 'none';\r\n }\r\n // restore fog param\r\n settings.set('fog', this._mainFog);\r\n\r\n this._unplugVRNodesFromScene(camera);\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(false);\r\n }\r\n }\r\n\r\n _unplugVRNodesFromScene(camera) {\r\n // restore common camera\r\n if (this._mainCamera && camera) {\r\n camera.copy(this._mainCamera);\r\n }\r\n // turn off webvr transformation\r\n const root = this._molContainer.children[0];\r\n if (root) {\r\n this._gfx.scene.add(root);\r\n }\r\n this._molContainer.parent.remove(this._molContainer);\r\n if (this._user) {\r\n this._gfx.scene.remove(this._user);\r\n }\r\n // free scene nodes\r\n this._molContainer = null;\r\n this._user = null;\r\n this._scalingPivot = null;\r\n this._user = null;\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n }\r\n\r\n _createControllerMesh() {\r\n // visualize controllers with cylinders\r\n const geometry = new THREE.CylinderGeometry(0.04, 0.04, 0.3);\r\n const material = new UberMaterial({ lights: false, overrideColor: true });\r\n material.setUberOptions({ fixedColor: new THREE.Color(0x4444ff) });\r\n material.updateUniforms();\r\n const cylinder = new THREE.Mesh(geometry, material);\r\n cylinder.rotateX(-Math.PI / 2);\r\n return cylinder;\r\n }\r\n\r\n updateMoleculeScale() {\r\n if (!this._controller1 || !this._controller2) {\r\n return;\r\n }\r\n\r\n const self = this;\r\n // update molecule scaling by controllers\r\n if (self._pressedGripsCounter === 2) {\r\n // recalc scaling pivot\r\n gfxutils.getMiddlePoint(self._controller1.position, self._controller2.position, self._scalingPivot.position);\r\n // recalc scaler\r\n const dist = self._controller1.position.distanceTo(self._controller2.position);\r\n const scaler = dist / self._distance;\r\n self._scalingPivot.scale.multiplyScalar(scaler);\r\n // save cur distance for next frame\r\n self._distance = dist;\r\n }\r\n }\r\n\r\n /**\r\n * Reposition molecule right before the camera.\r\n * @note The proper way is to initiate headset in the place of common Miew's camera.\r\n * But threejs limitations on setting new XRReferenceSpace enforce the molecule repositioning\r\n * Hope, something will change.\r\n */\r\n moveSceneBehindHeadset() {\r\n const gfx = this._gfx;\r\n const { camera } = gfx;\r\n\r\n // set container position in camera space\r\n const container = this._molContainer;\r\n container.matrix.identity();\r\n container.position.set(0, 0, -4.0);\r\n container.updateMatrix();\r\n\r\n // update container world matrix\r\n container.matrixWorld.multiplyMatrices(camera.matrixWorld, container.matrix);\r\n // readd to scene\r\n gfx.scene.addSavingWorldTransform(container);\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n getCanvas() {\r\n const gfx = this._gfx;\r\n return (gfx && gfx.renderer) ? gfx.renderer.domElement : null;\r\n }\r\n}\r\n","/* global PACKAGE_VERSION:false */\r\nimport _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport { Spinner } from 'spin.js';\r\nimport Stats from './gfx/Stats';\r\nimport utils from './utils';\r\nimport JobHandle from './utils/JobHandle';\r\nimport options from './options';\r\nimport settings from './settings';\r\nimport chem from './chem';\r\nimport Visual from './Visual';\r\nimport ComplexVisual from './ComplexVisual';\r\nimport Complex from './chem/Complex';\r\nimport VolumeVisual from './VolumeVisual';\r\nimport io from './io/io';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport CSS2DRenderer from './gfx/CSS2DRenderer';\r\nimport ObjectControls from './ui/ObjectControls';\r\nimport Picker from './ui/Picker';\r\nimport Axes from './gfx/Axes';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport meshutils from './gfx/meshutils';\r\nimport FrameInfo from './gfx/FrameInfo';\r\nimport meshes from './gfx/meshes/meshes';\r\nimport LinesObject from './gfx/objects/LinesObj';\r\nimport UberMaterial from './gfx/shaders/UberMaterial';\r\nimport OutlineMaterial from './gfx/shaders/OutlineMaterial';\r\nimport FXAAMaterial from './gfx/shaders/FXAAMaterial';\r\nimport AOMaterial from './gfx/shaders/AOMaterial';\r\nimport AOHorBlurMaterial from './gfx/shaders/AOHorBlurMaterial';\r\nimport AOVertBlurWithBlendMaterial from './gfx/shaders/AOVertBlurWithBlendMaterial';\r\nimport AnaglyphMaterial from './gfx/shaders/AnaglyphMaterial';\r\nimport VolumeMaterial from './gfx/shaders/VolumeMaterial';\r\nimport ViewInterpolator from './gfx/ViewInterpolator';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\nimport logger from './utils/logger';\r\nimport Cookies from './utils/Cookies';\r\nimport capabilities from './gfx/capabilities';\r\nimport WebVRPoC from './gfx/vr/WebVRPoC';\r\nimport vertexScreenQuadShader from './gfx/shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromDistTex from './gfx/shaders/ScreenQuadFromDistortionTex.frag';\r\nimport getTopWindow from './utils/getTopWindow';\r\n\r\nconst {\r\n selectors,\r\n Atom,\r\n Residue,\r\n Chain,\r\n Molecule,\r\n} = chem;\r\n\r\nconst EDIT_MODE = { COMPLEX: 0, COMPONENT: 1, FRAGMENT: 2 };\r\n\r\nconst LOADER_NOT_FOUND = 'Could not find suitable loader for this source';\r\nconst PARSER_NOT_FOUND = 'Could not find suitable parser for this source';\r\n\r\n// Color management changed a lot in threejs 152+ version.\r\n// To keep miew colors we disable the new color management system\r\nTHREE.ColorManagement.enabled = false;\r\n\r\nconst { createElement } = utils;\r\n\r\nfunction updateFogRange(fog, center, radius) {\r\n fog.near = center - radius * settings.now.fogNearFactor;\r\n fog.far = center + radius * settings.now.fogFarFactor;\r\n}\r\n\r\nfunction removeExtension(fileName) {\r\n const dot = fileName.lastIndexOf('.');\r\n if (dot >= 0) {\r\n fileName = fileName.substr(0, dot);\r\n }\r\n return fileName;\r\n}\r\n\r\nfunction hasValidResidues(complex) {\r\n let hasValidRes = false;\r\n complex.forEachComponent((component) => {\r\n component.forEachResidue((residue) => {\r\n if (residue._isValid) {\r\n hasValidRes = true;\r\n }\r\n });\r\n });\r\n return hasValidRes;\r\n}\r\n\r\nfunction reportProgress(log, action, percent) {\r\n const TOTAL_PERCENT = 100;\r\n if (percent !== undefined) {\r\n log.debug(`${action}... ${Math.floor(percent * TOTAL_PERCENT)}%`);\r\n } else {\r\n log.debug(`${action}...`);\r\n }\r\n}\r\n\r\nfunction chooseFogColor() {\r\n return settings.now.fogColorEnable ? settings.now.fogColor : settings.now.bg.color;\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\n/**\r\n * Main 3D Molecular Viewer class.\r\n *\r\n * @param {object} opts - Viewer options.\r\n * @param {HTMLElement=} opts.container - DOM element that serves as a viewer container.\r\n * @param {object=} opts.settings - An object with properties to override default settings.\r\n * @param {string=} opts.settingsCookie='settings' - The name of the cookie to save current settings to.\r\n * @param {string=} opts.cookiePath='/' - The path option for cookies. Defaults to root.\r\n *\r\n * @exports Miew\r\n * @constructor\r\n */\r\nfunction Miew(opts) {\r\n EventDispatcher.call(this);\r\n this._opts = _.merge({\r\n settingsCookie: 'settings',\r\n cookiePath: '/',\r\n }, opts);\r\n /** @type {?object} */\r\n this._gfx = null;\r\n /** @type {ViewInterpolator} */\r\n this._interpolator = new ViewInterpolator();\r\n /** @type {HTMLElement} */\r\n this._container = (opts && opts.container)\r\n || document.getElementById('miew-container')\r\n || _.head(document.getElementsByClassName('miew-container'))\r\n || document.body;\r\n /** @type {HTMLElement} */\r\n this._containerRoot = this._container;\r\n\r\n /** @type {boolean} */\r\n this._running = false;\r\n /** @type {boolean} */\r\n this._halting = false;\r\n /** @type {boolean} */\r\n this._building = false;\r\n /** @type {boolean} */\r\n this._needRender = true;\r\n /** @type {boolean} */\r\n this._hotKeysEnabled = true;\r\n\r\n /** @type {Settings} */\r\n this.settings = settings;\r\n const log = logger;\r\n log.console = DEBUG;\r\n log.level = DEBUG ? 'debug' : 'info';\r\n /**\r\n * @type {Logger}\r\n * @example\r\n * miew.logger.addEventListener('message', function _onLogMessage(evt) {\r\n * console.log(evt.message);\r\n * });\r\n */\r\n this.logger = log;\r\n\r\n this._cookies = new Cookies(this);\r\n this.restoreSettings();\r\n if (opts && opts.settings) {\r\n this.settings.set(opts.settings);\r\n }\r\n\r\n /** @type {?Spinner} */\r\n this._spinner = null;\r\n /** @type {JobHandle[]} */\r\n this._loading = [];\r\n /** @type {?number}\r\n * @deprecated until Animation system refactoring\r\n */\r\n this._animInterval = null;\r\n\r\n /** @type {object} */\r\n this._visuals = {};\r\n /** @type {?string} */\r\n this._curVisualName = null;\r\n\r\n /** @type {array} */\r\n this._objects = [];\r\n\r\n /** @type {object} */\r\n this._sourceWindow = null;\r\n\r\n this.reset();\r\n\r\n if (this._repr) {\r\n log.debug(`Selected ${this._repr.mode.name} mode with ${this._repr.colorer.name} colorer.`);\r\n }\r\n\r\n const self = this;\r\n Miew.registeredPlugins.forEach((plugin) => {\r\n plugin.call(self);\r\n });\r\n\r\n this._initOnSettingsChanged();\r\n}\r\n\r\nMiew.prototype = Object.create(EventDispatcher.prototype);\r\nMiew.prototype.constructor = Miew;\r\n\r\nMiew.prototype.getMaxRepresentationCount = function () {\r\n return ComplexVisual.NUM_REPRESENTATION_BITS;\r\n};\r\n\r\n/**\r\n * Replace viewer container contents with a DOM element.\r\n * @param {HTMLElement} container - parent container.\r\n * @param {HTMLElement} element - DOM element to show.\r\n * @private\r\n */\r\nfunction _setContainerContents(container, element) {\r\n const parent = container;\r\n while (parent.firstChild) {\r\n parent.removeChild(parent.firstChild);\r\n }\r\n parent.appendChild(element);\r\n}\r\n\r\n/**\r\n * Update Shadow Camera target position and frustum.\r\n * @private\r\n */\r\nMiew.prototype._updateShadowCamera = (function () {\r\n const shadowMatrix = new THREE.Matrix4();\r\n const direction = new THREE.Vector3();\r\n const OBB = { center: new THREE.Vector3(), halfSize: new THREE.Vector3() };\r\n\r\n return function () {\r\n this._gfx.scene.updateMatrixWorld();\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = this._gfx.scene.children[i];\r\n shadowMatrix.copy(light.shadow.camera.matrixWorldInverse);\r\n this.getOBB(shadowMatrix, OBB);\r\n\r\n direction.subVectors(light.target.position, light.position);\r\n light.position.subVectors(OBB.center, direction);\r\n light.target.position.copy(OBB.center);\r\n\r\n light.shadow.bias = 0.09;\r\n light.shadow.camera.bottom = -OBB.halfSize.y;\r\n light.shadow.camera.top = OBB.halfSize.y;\r\n light.shadow.camera.right = OBB.halfSize.x;\r\n light.shadow.camera.left = -OBB.halfSize.x;\r\n light.shadow.camera.near = direction.length() - OBB.halfSize.z;\r\n light.shadow.camera.far = direction.length() + OBB.halfSize.z;\r\n\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Initialize the viewer.\r\n * @returns {boolean} true on success.\r\n * @throws Forwards exception raised during initialization.\r\n * @see Miew#term\r\n */\r\nMiew.prototype.init = function () {\r\n const container = this._container;\r\n const elem = utils.createElement('div', { class: 'miew-canvas' });\r\n _setContainerContents(container, elem);\r\n this._container = elem;\r\n\r\n const frag = document.createDocumentFragment();\r\n frag.appendChild(this._msgMode = createElement(\r\n 'div',\r\n { class: 'mode-message overlay' },\r\n createElement('p', {}, 'COMPONENT EDIT MODE'),\r\n ));\r\n frag.appendChild(this._msgAtomInfo = createElement(\r\n 'div',\r\n { class: 'atom-info overlay' },\r\n createElement('p', {}, ''),\r\n ));\r\n container.appendChild(frag);\r\n\r\n if (this._gfx !== null) { // block double init\r\n return true;\r\n }\r\n\r\n const self = this;\r\n this._showMessage('Viewer is being initialized...');\r\n try {\r\n this._initGfx();\r\n\r\n this._initListeners();\r\n this._spinner = new Spinner({\r\n lines: 13,\r\n length: 28,\r\n width: 14,\r\n radius: 42,\r\n color: '#fff',\r\n zIndex: 700,\r\n });\r\n\r\n const target = getTopWindow();\r\n target.addEventListener('keydown', (event) => {\r\n self._onKeyDown(event);\r\n });\r\n\r\n target.addEventListener('keyup', (event) => {\r\n self._onKeyUp(event);\r\n });\r\n\r\n this._objectControls = new ObjectControls(\r\n this._gfx.root,\r\n this._gfx.pivot,\r\n this._gfx.camera,\r\n this._gfx.renderer.domElement,\r\n () => self._getAltObj(),\r\n );\r\n this._objectControls.addEventListener('change', (e) => {\r\n if (settings.now.shadow.on) {\r\n self._updateShadowCamera();\r\n }\r\n // route rotate, zoom, translate and translatePivot events to the external API\r\n switch (e.action) {\r\n case 'rotate':\r\n self.dispatchEvent({ type: 'rotate', quaternion: e.quaternion });\r\n break;\r\n case 'zoom':\r\n self.dispatchEvent({ type: 'zoom', factor: e.factor });\r\n break;\r\n default:\r\n self.dispatchEvent({ type: e.action });\r\n }\r\n self.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n });\r\n\r\n const gfx = this._gfx;\r\n this._picker = new Picker(gfx.root, gfx.camera, gfx.renderer.domElement);\r\n this._picker.addEventListener('newpick', (event) => {\r\n self._onPick(event);\r\n });\r\n this._picker.addEventListener('dblclick', (event) => {\r\n self.center(event);\r\n });\r\n } catch (error) {\r\n if (error.name === 'TypeError' && error.message === 'Cannot read property \\'getExtension\\' of null') {\r\n this._showMessage('Could not create WebGL context.');\r\n } else if (error.message.search(/webgl/i) > 1) {\r\n this._showMessage(error.message);\r\n } else {\r\n this._showMessage('Viewer initialization failed.');\r\n throw error;\r\n }\r\n return false;\r\n }\r\n\r\n // automatically load default file\r\n const file = this._opts && this._opts.load;\r\n if (file) {\r\n const type = this._opts && this._opts.type;\r\n this.load(file, { fileType: type, keepRepsInfo: true });\r\n }\r\n\r\n return true;\r\n};\r\n\r\n/**\r\n * Terminate the viewer completely.\r\n * @see Miew#init\r\n */\r\nMiew.prototype.term = function () {\r\n this._showMessage('Viewer has been terminated.');\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n this.halt();\r\n this._gfx = null;\r\n};\r\n\r\n/**\r\n * Display message inside the viewer container, hiding WebGL canvas.\r\n * @param {string} msg - Message to show.\r\n * @private\r\n */\r\nMiew.prototype._showMessage = function (msg) {\r\n const element = document.createElement('div');\r\n element.setAttribute('class', 'miew-message');\r\n element.appendChild(document.createElement('p')).appendChild(document.createTextNode(msg));\r\n _setContainerContents(this._container, element);\r\n};\r\n\r\n/**\r\n * Display WebGL canvas inside the viewer container, hiding any message shown.\r\n * @private\r\n */\r\nMiew.prototype._showCanvas = function () {\r\n _setContainerContents(this._container, this._gfx.renderer.domElement);\r\n};\r\n\r\nMiew.prototype._requestAnimationFrame = function (callback) {\r\n const { xr } = this._gfx.renderer;\r\n if (xr && xr.enabled) {\r\n this._gfx.renderer.setAnimationLoop(callback);\r\n return;\r\n }\r\n requestAnimationFrame(callback);\r\n};\r\n\r\nfunction arezSpritesSupported(context) {\r\n return context.getExtension('EXT_frag_depth');\r\n}\r\n\r\nfunction isAOSupported(context) {\r\n return (context.getExtension('WEBGL_depth_texture')\r\n && context.getExtension('WEBGL_draw_buffers'));\r\n}\r\n\r\n/**\r\n * Initialize WebGL and set 3D scene up.\r\n * @private\r\n */\r\nMiew.prototype._initGfx = function () {\r\n const gfx = {\r\n width: this._container.clientWidth,\r\n height: this._container.clientHeight,\r\n };\r\n\r\n const webGLOptions = { preserveDrawingBuffer: true, alpha: true, premultipliedAlpha: false };\r\n if (settings.now.antialias) {\r\n webGLOptions.antialias = true;\r\n }\r\n\r\n gfx.renderer2d = new CSS2DRenderer();\r\n\r\n gfx.renderer = new THREE.WebGL1Renderer(webGLOptions);\r\n gfx.renderer.shadowMap.enabled = settings.now.shadow.on;\r\n gfx.renderer.shadowMap.autoUpdate = false;\r\n gfx.renderer.shadowMap.type = THREE.PCFShadowMap;\r\n capabilities.init(gfx.renderer);\r\n\r\n // z-sprites and ambient occlusion possibility\r\n if (!arezSpritesSupported(gfx.renderer.getContext())) {\r\n settings.set('zSprites', false);\r\n }\r\n if (!isAOSupported(gfx.renderer.getContext())) {\r\n settings.set('ao', false);\r\n }\r\n\r\n gfx.renderer.autoClear = false;\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n gfx.camera = new THREE.PerspectiveCamera(\r\n settings.now.camFov,\r\n gfx.width / gfx.height,\r\n settings.now.camNear,\r\n settings.now.camFar,\r\n );\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.position.z = settings.now.camDistance;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n\r\n gfx.stereoCam = new THREE.StereoCamera();\r\n\r\n gfx.scene = new THREE.Scene();\r\n\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color, settings.now.camNear, settings.now.camFar);\r\n\r\n gfx.root = new gfxutils.RCGroup();\r\n gfx.scene.add(gfx.root);\r\n\r\n gfx.pivot = new gfxutils.RCGroup();\r\n gfx.root.add(gfx.pivot);\r\n\r\n gfx.selectionScene = new THREE.Scene();\r\n gfx.selectionRoot = new THREE.Group();\r\n gfx.selectionRoot.matrixAutoUpdate = false;\r\n gfx.selectionScene.add(gfx.selectionRoot);\r\n\r\n gfx.selectionPivot = new THREE.Group();\r\n gfx.selectionPivot.matrixAutoUpdate = false;\r\n gfx.selectionRoot.add(gfx.selectionPivot);\r\n\r\n const light12 = new THREE.DirectionalLight(0xffffff, 0.45);\r\n light12.position.set(0, 0.414, 1);\r\n light12.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n light12.castShadow = true;\r\n light12.shadow.bias = 0.09;\r\n light12.shadow.radius = settings.now.shadow.radius;\r\n light12.shadow.camera.layers.set(gfxutils.LAYERS.SHADOWMAP);\r\n\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n const shadowMapSize = Math.max(gfx.width, gfx.height) * pixelRatio;\r\n light12.shadow.mapSize.width = shadowMapSize;\r\n light12.shadow.mapSize.height = shadowMapSize;\r\n light12.target.position.set(0.0, 0.0, 0.0);\r\n gfx.scene.add(light12);\r\n gfx.scene.add(light12.target);\r\n\r\n const light3 = new THREE.AmbientLight(0x666666);\r\n light3.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.scene.add(light3);\r\n\r\n // add axes\r\n gfx.axes = new Axes(gfx.root, gfx.camera);\r\n const deviceWidth = gfx.width * pixelRatio;\r\n const deviceHeight = gfx.height * pixelRatio;\r\n\r\n gfx.offscreenBuf = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat, depthBuffer: true,\r\n },\r\n );\r\n\r\n if (gfx.renderer.getContext().getExtension('WEBGL_depth_texture')) {\r\n gfx.offscreenBuf.depthTexture = new THREE.DepthTexture();\r\n gfx.offscreenBuf.depthTexture.type = THREE.UnsignedShortType;\r\n }\r\n\r\n gfx.offscreenBuf2 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf3 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf4 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf3;\r\n gfx.volFFTex = gfx.offscreenBuf4;\r\n gfx.volWFFTex = gfx.offscreenBuf;\r\n\r\n // use float textures for volume rendering if possible\r\n if (gfx.renderer.getContext().getExtension('OES_texture_float')) {\r\n gfx.offscreenBuf5 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf6 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf7 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: true,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf5;\r\n gfx.volFFTex = gfx.offscreenBuf6;\r\n gfx.volWFFTex = gfx.offscreenBuf7;\r\n } else {\r\n this.logger.warn('Device doesn\\'t support OES_texture_float extension');\r\n }\r\n\r\n gfx.stereoBufL = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.stereoBufR = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n this._gfx = gfx;\r\n this._showCanvas();\r\n\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n\r\n this._container.appendChild(gfx.renderer2d.getElement());\r\n\r\n // add FPS counter\r\n const stats = new Stats();\r\n stats.domElement.style.position = 'absolute';\r\n stats.domElement.style.right = '0';\r\n stats.domElement.style.bottom = '0';\r\n this._container.appendChild(stats.domElement);\r\n this._fps = stats;\r\n this._fps.show(settings.now.fps);\r\n};\r\n\r\n/**\r\n * Setup event listeners.\r\n * @private\r\n */\r\nMiew.prototype._initListeners = function () {\r\n const self = this;\r\n window.addEventListener('resize', () => {\r\n self._onResize();\r\n });\r\n};\r\n\r\n/**\r\n * Try to add numbers to the base name to make it unique among visuals\r\n * @private\r\n */\r\nMiew.prototype._makeUniqueVisualName = function (baseName) {\r\n if (!baseName) {\r\n return Math.random().toString();\r\n }\r\n\r\n let name = baseName;\r\n let suffix = 1;\r\n while (this._visuals.hasOwnProperty(name)) {\r\n name = `${baseName} (${suffix.toString()})`;\r\n suffix++;\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Add visual to the viewer\r\n * @private\r\n */\r\nMiew.prototype._addVisual = function (visual) {\r\n if (!visual) {\r\n return null;\r\n }\r\n\r\n // change visual name in order to make it unique\r\n const name = this._makeUniqueVisualName(visual.name);\r\n visual.name = name;\r\n\r\n this._visuals[name] = visual;\r\n this._gfx.pivot.add(visual);\r\n if (visual.getSelectionGeo) {\r\n this._gfx.selectionPivot.add(visual.getSelectionGeo());\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Remove visual from the viewer\r\n * @private\r\n */\r\nMiew.prototype._removeVisual = function (visual) {\r\n let name = '';\r\n let obj = null;\r\n if (visual instanceof Visual) {\r\n ({ name } = visual);\r\n obj = visual;\r\n } else if (typeof visual === 'string') {\r\n name = visual;\r\n obj = this._visuals[name];\r\n }\r\n\r\n if (!obj || !this._visuals.hasOwnProperty(name) || this._visuals[name] !== obj) {\r\n return;\r\n }\r\n\r\n if (name === this._curVisualName) {\r\n this._curVisualName = undefined;\r\n }\r\n\r\n delete this._visuals[name];\r\n obj.release(); // removes nodes from scene\r\n\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Call specified function for each Visual\r\n * @private\r\n */\r\nMiew.prototype._forEachVisual = function (callback) {\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Release (destroy) all visuals in the scene\r\n * @private\r\n */\r\nMiew.prototype._releaseAllVisuals = function () {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n this._visuals[name].release();\r\n }\r\n }\r\n\r\n this._visuals = {};\r\n};\r\n\r\n/**\r\n * Call specified function for each ComplexVisual\r\n * @private\r\n */\r\nMiew.prototype._forEachComplexVisual = function (callback) {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)\r\n && this._visuals[name] instanceof ComplexVisual) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual with specified name, or current (if not found), or any, or null\r\n * @private\r\n */\r\nMiew.prototype._getComplexVisual = function (name) {\r\n name = name || this._curVisualName;\r\n let any = null;\r\n let named = null;\r\n this._forEachComplexVisual((visual) => {\r\n any = visual;\r\n if (visual.name === name) {\r\n named = visual;\r\n }\r\n });\r\n return named || any;\r\n};\r\n\r\n/**\r\n * Returns first found VolumeVisual (no more than one should be present actually)\r\n * @private\r\n */\r\nMiew.prototype._getVolumeVisual = function () {\r\n let any = null;\r\n this._forEachVisual((visual) => {\r\n if (visual instanceof VolumeVisual) {\r\n any = visual;\r\n }\r\n });\r\n return any;\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual corresponding to specified complex\r\n * @private\r\n */\r\nMiew.prototype._getVisualForComplex = function (complex) {\r\n if (!complex) {\r\n return null;\r\n }\r\n\r\n let found = null;\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getComplex() === complex) {\r\n found = visual;\r\n }\r\n });\r\n return found;\r\n};\r\n\r\n/*\r\n * Get a list of names of visuals currently shown by the viewer\r\n */\r\nMiew.prototype.getVisuals = function () {\r\n return Object.keys(this._visuals);\r\n};\r\n\r\n/*\r\n * Get complex visuals count\r\n */\r\nMiew.prototype.getComplexVisualsCount = function () {\r\n let count = 0;\r\n this._forEachComplexVisual(() => count++);\r\n return count;\r\n};\r\n\r\n/*\r\n * Get current visual\r\n */\r\nMiew.prototype.getCurrentVisual = function () {\r\n return this._curVisualName;\r\n};\r\n\r\n/*\r\n * Set current visual.\r\n * All further operations will be performed on this visual (complex) if not stated otherwise.\r\n */\r\nMiew.prototype.setCurrentVisual = function (name) {\r\n if (!this._visuals[name]) {\r\n return;\r\n }\r\n\r\n this._curVisualName = name;\r\n};\r\n\r\n/**\r\n * Run the viewer, start processing update/render frames periodically.\r\n * Has no effect if already running.\r\n * @see Miew#halt\r\n */\r\nMiew.prototype.run = function () {\r\n if (!this._running) {\r\n this._running = true;\r\n if (this._halting) {\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._objectControls.enable(true);\r\n this._interpolator.resume();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to stop.\r\n * Will be processed during the next frame.\r\n * @see Miew#run\r\n */\r\nMiew.prototype.halt = function () {\r\n if (this._running) {\r\n this._discardComponentEdit();\r\n this._discardFragmentEdit();\r\n this._objectControls.enable(false);\r\n this._interpolator.pause();\r\n this._halting = true;\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to start / stop responsing\r\n * on hot keys.\r\n * @param enabled - start (true) or stop (false) response on hot keys.\r\n */\r\nMiew.prototype.enableHotKeys = function (enabled) {\r\n this._hotKeysEnabled = enabled;\r\n this._objectControls.enableHotkeys(enabled);\r\n};\r\n\r\n/**\r\n * Callback which processes window resize.\r\n * @private\r\n */\r\nMiew.prototype._onResize = function () {\r\n const gfx = this._gfx;\r\n if (!gfx) {\r\n return;\r\n }\r\n\r\n this._needRender = true;\r\n\r\n gfx.width = this._container.clientWidth;\r\n gfx.height = this._container.clientHeight;\r\n\r\n gfx.camera.aspect = gfx.width / gfx.height;\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n this.dispatchEvent({ type: 'resize' });\r\n};\r\n\r\nMiew.prototype._resizeOffscreenBuffers = function (width, height, stereo) {\r\n const gfx = this._gfx;\r\n stereo = stereo || 'NONE';\r\n const isAnaglyph = (stereo === 'NONE' || stereo === 'ANAGLYPH');\r\n const multi = isAnaglyph ? 1 : 0.5;\r\n gfx.offscreenBuf.setSize(multi * width, height);\r\n gfx.offscreenBuf2.setSize(multi * width, height);\r\n gfx.offscreenBuf3.setSize(multi * width, height);\r\n gfx.offscreenBuf4.setSize(multi * width, height);\r\n if (gfx.offscreenBuf5) {\r\n gfx.offscreenBuf5.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf6) {\r\n gfx.offscreenBuf6.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf7) {\r\n gfx.offscreenBuf7.setSize(multi * width, height);\r\n }\r\n if (isAnaglyph) {\r\n gfx.stereoBufL.setSize(width, height);\r\n gfx.stereoBufR.setSize(width, height);\r\n }\r\n};\r\n\r\n/**\r\n * Callback which processes update/render frames.\r\n * @private\r\n */\r\nMiew.prototype._onTick = function () {\r\n if (this._halting) {\r\n this._running = false;\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._fps.update();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n\r\n this._onUpdate();\r\n if (this._needRender) {\r\n this._onRender();\r\n this._needRender = !settings.now.suspendRender || settings.now.stereo === 'WEBVR';\r\n }\r\n};\r\n\r\nMiew.prototype._getBSphereRadius = function () {\r\n // calculate radius that would include all visuals\r\n let radius = 0;\r\n this._forEachVisual((visual) => {\r\n radius = Math.max(radius, visual.getBoundaries().boundingSphere.radius);\r\n });\r\n return radius * this._objectControls.getScale();\r\n};\r\n\r\n/**\r\n * Calculate bounding box that would include all visuals and being axis aligned in world defined by\r\n * transformation matrix: matrix\r\n * @param {Matrix4} matrix - transformation matrix.\r\n * @param {object} OBB - calculating bounding box.\r\n * @param {Vector3} OBB.center - OBB center.\r\n * @param {Vector3} OBB.halfSize - half magnitude of OBB sizes.\r\n */\r\nMiew.prototype.getOBB = (function () {\r\n const _bSphereForOneVisual = new THREE.Sphere();\r\n const _bBoxForOneVisual = new THREE.Box3();\r\n const _bBox = new THREE.Box3();\r\n\r\n const _invMatrix = new THREE.Matrix4();\r\n\r\n const _points = [\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n ];\r\n\r\n return function (matrix, OBB) {\r\n _bBox.makeEmpty();\r\n\r\n this._forEachVisual((visual) => {\r\n _bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere);\r\n _bSphereForOneVisual.applyMatrix4(visual.matrixWorld).applyMatrix4(matrix);\r\n _bSphereForOneVisual.getBoundingBox(_bBoxForOneVisual);\r\n _bBox.union(_bBoxForOneVisual);\r\n });\r\n _bBox.getCenter(OBB.center);\r\n\r\n _invMatrix.copy(matrix).invert();\r\n OBB.center.applyMatrix4(_invMatrix);\r\n\r\n const { min } = _bBox;\r\n const { max } = _bBox;\r\n _points[0].set(min.x, min.y, min.z); // 000\r\n _points[1].set(max.x, min.y, min.z); // 100\r\n _points[2].set(min.x, max.y, min.z); // 010\r\n _points[3].set(min.x, min.y, max.z); // 001\r\n for (let i = 0, l = _points.length; i < l; i++) {\r\n _points[i].applyMatrix4(_invMatrix);\r\n }\r\n\r\n OBB.halfSize.set(\r\n Math.abs(_points[0].x - _points[1].x),\r\n Math.abs(_points[0].y - _points[2].y),\r\n Math.abs(_points[0].z - _points[3].z),\r\n ).multiplyScalar(0.5);\r\n };\r\n}());\r\n\r\nMiew.prototype._updateFog = function () {\r\n const gfx = this._gfx;\r\n\r\n if (settings.now.fog) {\r\n if (typeof gfx.scene.fog === 'undefined' || gfx.scene.fog === null) {\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color);\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n updateFogRange(gfx.scene.fog, gfx.camera.position.z, this._getBSphereRadius());\r\n } else if (gfx.scene.fog) {\r\n gfx.scene.fog = undefined;\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n};\r\n\r\nMiew.prototype._onUpdate = function () {\r\n if (this.isScriptingCommandAvailable !== undefined && this.isScriptingCommandAvailable() && !this._building) {\r\n this.callNextCmd();\r\n }\r\n\r\n this._objectControls.update();\r\n\r\n this._forEachComplexVisual((visual) => {\r\n visual.getComplex().update();\r\n });\r\n\r\n if (settings.now.autobuild && !this._loading.length && !this._building && this._needRebuild()) {\r\n this.rebuild();\r\n }\r\n\r\n if (!this._loading.length && !this._building && !this._needRebuild()) {\r\n this._updateView();\r\n }\r\n\r\n this._updateFog();\r\n\r\n if (this._gfx.renderer.xr.enabled) {\r\n this.webVR.updateMoleculeScale();\r\n }\r\n};\r\n\r\nMiew.prototype._onRender = function () {\r\n const gfx = this._gfx;\r\n\r\n // update all matrices\r\n gfx.scene.updateMatrixWorld();\r\n gfx.camera.updateMatrixWorld();\r\n\r\n this._clipPlaneUpdateValue(this._getBSphereRadius());\r\n this._fogFarUpdateValue();\r\n\r\n gfx.renderer.setRenderTarget(null);\r\n gfx.renderer.clear();\r\n\r\n this._renderFrame(settings.now.stereo);\r\n};\r\n\r\nMiew.prototype._renderFrame = (function () {\r\n const _anaglyphMat = new AnaglyphMaterial();\r\n const _size = new THREE.Vector2();\r\n\r\n return function (stereo) {\r\n const gfx = this._gfx;\r\n const { renderer } = gfx;\r\n\r\n renderer.getSize(_size);\r\n\r\n if (stereo !== 'NONE') {\r\n gfx.camera.focus = gfx.camera.position.z; // set focus to the center of the object\r\n gfx.stereoCam.aspect = 1.0;\r\n\r\n // in anaglyph mode we render full-size image for each eye\r\n // while in other stereo modes only half-size (two images on the screen)\r\n if (stereo === 'ANAGLYPH') {\r\n gfx.stereoCam.update(gfx.camera);\r\n } else {\r\n gfx.stereoCam.updateHalfSized(gfx.camera, settings.now.camFov);\r\n }\r\n }\r\n\r\n // resize offscreen buffers to match the target\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n this._resizeOffscreenBuffers(_size.width * pixelRatio, _size.height * pixelRatio, stereo);\r\n\r\n this._renderShadowMap();\r\n\r\n switch (stereo) {\r\n case 'WEBVR':\r\n case 'NONE':\r\n this._renderScene(gfx.camera, false);\r\n break;\r\n case 'SIMPLE':\r\n case 'DISTORTED':\r\n renderer.setScissorTest(true);\r\n\r\n renderer.setScissor(0, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(0, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraL, stereo === 'DISTORTED');\r\n\r\n renderer.setScissor(_size.width / 2, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(_size.width / 2, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraR, stereo === 'DISTORTED');\r\n\r\n renderer.setScissorTest(false);\r\n break;\r\n case 'ANAGLYPH':\r\n this._renderScene(this._gfx.stereoCam.cameraL, false, gfx.stereoBufL);\r\n this._renderScene(this._gfx.stereoCam.cameraR, false, gfx.stereoBufR);\r\n renderer.setRenderTarget(null);\r\n _anaglyphMat.uniforms.srcL.value = gfx.stereoBufL.texture;\r\n _anaglyphMat.uniforms.srcR.value = gfx.stereoBufR.texture;\r\n gfx.renderer.renderScreenQuad(_anaglyphMat);\r\n break;\r\n default:\r\n }\r\n\r\n gfx.renderer2d.render(gfx.scene, gfx.camera);\r\n\r\n if (settings.now.axes && gfx.axes && !gfx.renderer.xr.enabled) {\r\n gfx.axes.render(renderer);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._onBgColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx) {\r\n if (gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onFogColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx && gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._setUberMaterialValues = function (values) {\r\n this._gfx.root.traverse((obj) => {\r\n if ((obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line)\r\n && obj.material instanceof UberMaterial) {\r\n obj.material.setValues(values);\r\n obj.material.needsUpdate = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._enableMRT = function (on, renderBuffer, textureBuffer) {\r\n const gfx = this._gfx;\r\n const gl = gfx.renderer.getContext();\r\n const ext = gl.getExtension('WEBGL_draw_buffers');\r\n const { properties } = gfx.renderer;\r\n\r\n if (!on) {\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, null]);\r\n return;\r\n }\r\n\r\n // take extra texture from Texture Buffer\r\n gfx.renderer.setRenderTarget(textureBuffer);\r\n const tx8 = properties.get(textureBuffer.texture).__webglTexture;\r\n gl.bindTexture(gl.TEXTURE_2D, tx8);\r\n\r\n // take texture and framebuffer from renderbuffer\r\n gfx.renderer.setRenderTarget(renderBuffer);\r\n const fb = properties.get(renderBuffer).__webglFramebuffer;\r\n const tx = properties.get(renderBuffer.texture).__webglTexture;\r\n\r\n // set framebuffer\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n fb.width = renderBuffer.width;\r\n fb.height = renderBuffer.height;\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tx, 0);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, ext.COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, tx8, 0);\r\n\r\n // mapping textures\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, ext.COLOR_ATTACHMENT1_WEBGL]);\r\n};\r\n\r\nMiew.prototype._renderScene = (function () {\r\n return function (camera, distortion, target) {\r\n distortion = distortion || false;\r\n target = target || null;\r\n\r\n const gfx = this._gfx;\r\n\r\n // render to offscreen buffer\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.clear();\r\n if (gfx.renderer.xr.enabled) {\r\n gfx.renderer.render(gfx.scene, camera);\r\n return;\r\n }\r\n\r\n // clean buffer for normals texture\r\n gfx.renderer.setClearColor(0x000000, 0.0);\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf4);\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.clear();\r\n\r\n const bHaveComplexes = (this._getComplexVisual() !== null);\r\n const volumeVisual = this._getVolumeVisual();\r\n const ssao = bHaveComplexes && settings.now.ao;\r\n\r\n if (ssao) {\r\n this._enableMRT(true, gfx.offscreenBuf, gfx.offscreenBuf4);\r\n }\r\n\r\n if (settings.now.transparency === 'prepass') {\r\n this._renderWithPrepassTransparency(camera, gfx.offscreenBuf);\r\n } else if (settings.now.transparency === 'standard') {\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n }\r\n\r\n if (ssao) {\r\n this._enableMRT(false, null, null);\r\n }\r\n\r\n // when fxaa we should get resulting image in temp off-screen buff2 for further postprocessing with fxaa filter\r\n // otherwise we render to canvas\r\n const outline = bHaveComplexes && settings.now.outline.on;\r\n const fxaa = bHaveComplexes && settings.now.fxaa;\r\n const volume = (volumeVisual !== null) && (volumeVisual.getMesh().material != null);\r\n let dstBuffer = (ssao || outline || volume || fxaa || distortion) ? gfx.offscreenBuf2 : target;\r\n let srcBuffer = gfx.offscreenBuf;\r\n\r\n if (ssao) {\r\n this._performAO(\r\n srcBuffer,\r\n gfx.offscreenBuf4,\r\n gfx.offscreenBuf.depthTexture,\r\n dstBuffer,\r\n gfx.offscreenBuf3,\r\n gfx.offscreenBuf2,\r\n );\r\n if (!fxaa && !distortion && !volume && !outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = target;\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n } else {\r\n // just copy color buffer to dst buffer\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n\r\n // outline\r\n if (outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = (volume || fxaa || distortion) ? gfx.offscreenBuf3 : target;\r\n if (srcBuffer != null) {\r\n this._renderOutline(camera, gfx.offscreenBuf, srcBuffer, dstBuffer);\r\n }\r\n }\r\n\r\n // render selected part with outline material\r\n this._renderSelection(camera, gfx.offscreenBuf, dstBuffer);\r\n\r\n if (volume) {\r\n // copy current picture to the buffer that retains depth-data of the original molecule render\r\n // so that volume renderer could use depth-test\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n dstBuffer = gfx.offscreenBuf;\r\n this._renderVolume(volumeVisual, camera, dstBuffer, gfx.volBFTex, gfx.volFFTex, gfx.volWFFTex);\r\n\r\n // if this is the last stage -- copy image to target\r\n if (!fxaa && !distortion) {\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n }\r\n }\r\n\r\n srcBuffer = dstBuffer;\r\n\r\n if (fxaa) {\r\n dstBuffer = distortion ? gfx.offscreenBuf4 : target;\r\n this._performFXAA(srcBuffer, dstBuffer);\r\n srcBuffer = dstBuffer;\r\n }\r\n\r\n if (distortion) {\r\n dstBuffer = target;\r\n this._performDistortion(srcBuffer, dstBuffer, true);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._performDistortion = (function () {\r\n const _scene = new THREE.Scene();\r\n const _camera = new THREE.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, -500, 1000);\r\n\r\n const _material = new THREE.RawShaderMaterial({\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n aberration: { type: 'fv3', value: new THREE.Vector3(1.0) },\r\n },\r\n vertexShader: vertexScreenQuadShader,\r\n fragmentShader: fragmentScreenQuadFromDistTex,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n const _geo = gfxutils.buildDistorionMesh(10, 10, settings.now.debug.stereoBarrel);\r\n _scene.add(new meshes.Mesh(_geo, _material));\r\n\r\n return function (srcBuffer, targetBuffer, mesh) {\r\n this._gfx.renderer.setRenderTarget(targetBuffer);\r\n this._gfx.renderer.clear();\r\n\r\n if (mesh) {\r\n _material.uniforms.srcTex.value = srcBuffer.texture;\r\n _material.uniforms.aberration.value.set(0.995, 1.0, 1.01);\r\n this._gfx.renderer.render(_scene, _camera);\r\n } else {\r\n this._gfx.renderer.renderScreenQuadFromTexWithDistortion(srcBuffer, settings.now.debug.stereoBarrel);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._renderOutline = (function () {\r\n const _outlineMaterial = new OutlineMaterial({ depth: true });\r\n\r\n return function (camera, srcDepthBuffer, srcColorBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcColorBuffer.texture;\r\n _outlineMaterial.uniforms.srcDepthTex.value = srcDepthBuffer.depthTexture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcDepthBuffer.width, srcDepthBuffer.height);\r\n _outlineMaterial.uniforms.color.value = new THREE.Color(settings.now.outline.color);\r\n _outlineMaterial.uniforms.threshold.value = settings.now.outline.threshold;\r\n _outlineMaterial.uniforms.thickness.value = new THREE.Vector2(\r\n settings.now.outline.thickness,\r\n settings.now.outline.thickness,\r\n );\r\n\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._renderShadowMap = (function () {\r\n const pars = { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };\r\n\r\n return function () {\r\n if (!settings.now.shadow.on) {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n const currentRenderTarget = gfx.renderer.getRenderTarget();\r\n const activeCubeFace = gfx.renderer.getActiveCubeFace();\r\n const activeMipmapLevel = gfx.renderer.getActiveMipmapLevel();\r\n\r\n const _state = gfx.renderer.state;\r\n\r\n // Set GL state for depth map.\r\n _state.setBlending(THREE.NoBlending);\r\n _state.buffers.color.setClear(1, 1, 1, 1);\r\n _state.buffers.depth.setTest(true);\r\n _state.setScissorTest(false);\r\n\r\n for (let i = 0; i < gfx.scene.children.length; i++) {\r\n if (gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = gfx.scene.children[i];\r\n\r\n if (light.shadow.map == null) {\r\n light.shadow.map = new THREE.WebGLRenderTarget(light.shadow.mapSize.width, light.shadow.mapSize.height, pars);\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n light.shadow.updateMatrices(light);\r\n\r\n gfx.renderer.setRenderTarget(light.shadow.map);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.render(gfx.scene, light.shadow.camera);\r\n }\r\n }\r\n gfx.renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);\r\n };\r\n}());\r\n\r\n/**\r\n * Check if there is selection which must be rendered or not.\r\n * @private\r\n * @returns {boolean} true on existing selection to render\r\n */\r\nMiew.prototype._hasSelectionToRender = function () {\r\n const selPivot = this._gfx.selectionPivot;\r\n\r\n for (let i = 0; i < selPivot.children.length; i++) {\r\n const selPivotChild = selPivot.children[i];\r\n if (selPivotChild.children.length > 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n\r\nMiew.prototype._renderSelection = (function () {\r\n const _outlineMaterial = new OutlineMaterial();\r\n\r\n return function (camera, srcBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // clear offscreen buffer (leave z-buffer intact)\r\n gfx.renderer.setClearColor('black', 0);\r\n\r\n // render selection to offscreen buffer\r\n gfx.renderer.setRenderTarget(srcBuffer);\r\n gfx.renderer.clear(true, false, false);\r\n if (self._hasSelectionToRender()) {\r\n gfx.selectionRoot.matrix = gfx.root.matrix;\r\n gfx.selectionPivot.matrix = gfx.pivot.matrix;\r\n gfx.renderer.render(gfx.selectionScene, camera);\r\n } else {\r\n // just render something to force \"target clear\" operation to finish\r\n gfx.renderer.renderDummyQuad();\r\n }\r\n\r\n // overlay to screen\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 0.6);\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcBuffer.width, srcBuffer.height);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._checkVolumeRenderingSupport = function (renderTarget) {\r\n if (!renderTarget) {\r\n return false;\r\n }\r\n const gfx = this._gfx;\r\n const oldRT = gfx.renderer.getRenderTarget();\r\n\r\n gfx.renderer.setRenderTarget(renderTarget);\r\n const context = gfx.renderer.getContext();\r\n const result = context.checkFramebufferStatus(context.FRAMEBUFFER);\r\n gfx.renderer.setRenderTarget(oldRT);\r\n if (result !== context.FRAMEBUFFER_COMPLETE) {\r\n // floatFrameBufferWarning = ;\r\n this.logger.warn('Device doesn\\'t support electron density rendering');\r\n return false;\r\n }\r\n return true;\r\n};\r\n\r\nMiew.prototype._renderVolume = (function () {\r\n const volumeBFMat = new VolumeMaterial.BackFacePosMaterial();\r\n const volumeFFMat = new VolumeMaterial.FrontFacePosMaterial();\r\n const cubeOffsetMat = new THREE.Matrix4().makeTranslation(0.5, 0.5, 0.5);\r\n const world2colorMat = new THREE.Matrix4();\r\n\r\n let volumeRenderingSupported;\r\n\r\n return function (volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) {\r\n const gfx = this._gfx;\r\n\r\n if (typeof volumeRenderingSupported === 'undefined') {\r\n volumeRenderingSupported = this._checkVolumeRenderingSupport(tmpBuf1);\r\n }\r\n\r\n if (!volumeRenderingSupported) {\r\n return;\r\n }\r\n\r\n const mesh = volumeVisual.getMesh();\r\n\r\n mesh.rebuild(gfx.camera);\r\n\r\n // use main camera to prepare special textures to be used by volumetric rendering\r\n // these textures have the size of the window and are stored in offscreen buffers\r\n gfx.renderer.setClearColor('black', 0);\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n // draw plane with its own material, because it differs slightly from volumeBFMat\r\n camera.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeBFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeFFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.scene.overrideMaterial = null;\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n\r\n // prepare texture that contains molecule positions\r\n world2colorMat.copy(mesh.matrixWorld).invert();\r\n UberMaterial.prototype.uberOptions.world2colorMatrix.multiplyMatrices(cubeOffsetMat, world2colorMat);\r\n camera.layers.set(gfxutils.LAYERS.COLOR_FROM_POSITION);\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // render volume\r\n const vm = mesh.material;\r\n vm.uniforms._BFRight.value = tmpBuf1.texture;\r\n vm.uniforms._FFRight.value = tmpBuf2.texture;\r\n vm.uniforms._WFFRight.value = tmpBuf3.texture;\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.renderer.setRenderTarget(dstBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\n/* Render scene with 'ZPrepass transparency Effect'\r\n * Idea: transparent objects are rendered in two passes. The first one writes result only into depth buffer.\r\n * The second pass reads depth buffer and writes only to color buffer. The method results in\r\n * correct image of front part of the semi-transparent objects, but we can see only front transparent objects\r\n * and opaque objects inside, there is no transparent objects inside.\r\n * Notes: 1. Opaque objects should be rendered strictly before semi-transparent ones.\r\n * 2. Realization doesn't use camera layers because scene traversing is used for material changes and\r\n * we can use it to select needed meshes and don't complicate meshes builders with layers\r\n */\r\nMiew.prototype._renderWithPrepassTransparency = (function () {\r\n return function (camera, targetBuffer) {\r\n const gfx = this._gfx;\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n\r\n // opaque objects\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // transparent objects z prepass\r\n camera.layers.set(gfxutils.LAYERS.PREPASS_TRANSPARENT);\r\n gfx.renderer.getContext().colorMask(false, false, false, false); // don't update color buffer\r\n gfx.renderer.render(gfx.scene, camera);\r\n gfx.renderer.getContext().colorMask(true, true, true, true); // update color buffer\r\n\r\n // transparent objects color pass\r\n camera.layers.set(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // restore default layer\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\nMiew.prototype._performFXAA = (function () {\r\n const _fxaaMaterial = new FXAAMaterial();\r\n\r\n return function (srcBuffer, targetBuffer) {\r\n if (typeof srcBuffer === 'undefined' || typeof targetBuffer === 'undefined') {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n\r\n // clear canvas\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.clear();\r\n\r\n // do fxaa processing of offscreen buff2\r\n _fxaaMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _fxaaMaterial.uniforms.srcTexelSize.value.set(1.0 / srcBuffer.width, 1.0 / srcBuffer.height);\r\n _fxaaMaterial.uniforms.bgColor.value.set(settings.now.bg.color);\r\n\r\n if (_fxaaMaterial.bgTransparent !== settings.now.bg.transparent) {\r\n _fxaaMaterial.setValues({ bgTransparent: settings.now.bg.transparent });\r\n _fxaaMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.renderScreenQuad(_fxaaMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._performAO = (function () {\r\n const _aoMaterial = new AOMaterial();\r\n const _horBlurMaterial = new AOHorBlurMaterial();\r\n const _vertBlurMaterial = new AOVertBlurWithBlendMaterial();\r\n\r\n const _scale = new THREE.Vector3();\r\n return function (srcColorBuffer, normalBuffer, srcDepthTexture, targetBuffer, tempBuffer, tempBuffer1) {\r\n if (!srcColorBuffer || !normalBuffer || !srcDepthTexture || !targetBuffer || !tempBuffer || !tempBuffer1) {\r\n return;\r\n }\r\n const gfx = this._gfx;\r\n const tanHalfFOV = Math.tan(THREE.MathUtils.DEG2RAD * 0.5 * gfx.camera.fov);\r\n\r\n _aoMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _aoMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _aoMaterial.uniforms.normalTexture.value = normalBuffer.texture;\r\n _aoMaterial.uniforms.srcTexelSize.value.set(1.0 / srcColorBuffer.width, 1.0 / srcColorBuffer.height);\r\n _aoMaterial.uniforms.camNearFar.value.set(gfx.camera.near, gfx.camera.far);\r\n _aoMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _aoMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _aoMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n gfx.root.matrix.extractScale(_scale);\r\n _aoMaterial.uniforms.kernelRadius.value = settings.now.debug.ssaoKernelRadius * _scale.x;\r\n _aoMaterial.uniforms.depthThreshold.value = 2.0 * this._getBSphereRadius(); // diameter\r\n _aoMaterial.uniforms.factor.value = settings.now.debug.ssaoFactor;\r\n // N: should be tempBuffer1 for proper use of buffers (see buffers using outside the function)\r\n gfx.renderer.setRenderTarget(tempBuffer1);\r\n gfx.renderer.renderScreenQuad(_aoMaterial);\r\n\r\n _horBlurMaterial.uniforms.aoMap.value = tempBuffer1.texture;\r\n _horBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer1.width, 1.0 / tempBuffer1.height);\r\n _horBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n gfx.renderer.setRenderTarget(tempBuffer);\r\n gfx.renderer.renderScreenQuad(_horBlurMaterial);\r\n\r\n _vertBlurMaterial.uniforms.aoMap.value = tempBuffer.texture;\r\n _vertBlurMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _vertBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer.width, 1.0 / tempBuffer.height);\r\n _vertBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _vertBlurMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _vertBlurMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _vertBlurMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n const { fog } = gfx.scene;\r\n if (fog) {\r\n _vertBlurMaterial.uniforms.fogNearFar.value.set(fog.near, fog.far);\r\n _vertBlurMaterial.uniforms.fogColor.value.set(fog.color.r, fog.color.g, fog.color.b, settings.now.fogAlpha);\r\n }\r\n if ((_vertBlurMaterial.useFog !== settings.now.fog)\r\n || (_vertBlurMaterial.fogTransparent !== settings.now.bg.transparent)) {\r\n _vertBlurMaterial.setValues({ useFog: settings.now.fog, fogTransparent: settings.now.bg.transparent });\r\n _vertBlurMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_vertBlurMaterial);\r\n };\r\n}());\r\n\r\n/**\r\n * Reset the viewer, unload molecules.\r\n * @param {boolean=} keepReps - Keep representations while resetting viewer state.\r\n */\r\nMiew.prototype.reset = function (/* keepReps */) {\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._lastPick = null;\r\n\r\n this._releaseAllVisuals();\r\n\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._resetObjects();\r\n\r\n if (this._gfx) {\r\n gfxutils.clearTree(this._gfx.pivot);\r\n this._gfx.renderer2d.reset();\r\n }\r\n\r\n this.setNeedRender();\r\n};\r\n\r\nMiew.prototype._resetScene = function () {\r\n this._objectControls.reset();\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n this.resetReps();\r\n this.resetPivot();\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype.resetView = function () {\r\n // reset controls\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._resetScene();\r\n\r\n // reset selection\r\n this._forEachComplexVisual((visual) => {\r\n visual.updateSelectionMask({});\r\n visual.rebuildSelectionGeometry();\r\n });\r\n};\r\n\r\nMiew.prototype._export = function (format) {\r\n const TheExporter = _.head(io.exporters.find({ format }));\r\n if (!TheExporter) {\r\n this.logger.error('Could not find suitable exporter for this source');\r\n return Promise.reject(new Error('Could not find suitable exporter for this source'));\r\n }\r\n this.dispatchEvent({ type: 'exporting' });\r\n\r\n if (this._visuals[this._curVisualName] instanceof ComplexVisual) {\r\n let dataSource = null;\r\n if (TheExporter.SourceClass === ComplexVisual) {\r\n dataSource = this._visuals[this._curVisualName];\r\n } else if (TheExporter.SourceClass === Complex) {\r\n dataSource = this._visuals[this._curVisualName]._complex;\r\n }\r\n const exporter = new TheExporter(dataSource, { miewVersion: Miew.VERSION });\r\n return exporter.export().then((data) => data);\r\n }\r\n if (this._visuals[this._curVisualName] instanceof VolumeVisual) {\r\n return Promise.reject(new Error('Sorry, exporter for volume data not implemented yet'));\r\n }\r\n return Promise.reject(new Error('Unexpected format of data'));\r\n};\r\n\r\nconst rePdbId = /^(?:(pdb|cif|ccp4|dsn6):\\s*)?(\\d[a-z\\d]{3})$/i;\r\nconst rePubchem = /^(?:pc|pubchem):\\s*([a-z]+)$/i;\r\nconst reUrlScheme = /^([a-z][a-z\\d\\-+.]*):/i;\r\n\r\nfunction resolveSourceShortcut(source, opts) {\r\n if (!_.isString(source)) {\r\n return source;\r\n }\r\n\r\n // e.g. \"cif:1CRN\"\r\n const matchesPdbId = rePdbId.exec(source);\r\n if (matchesPdbId) {\r\n let [, format = 'pdb', id] = matchesPdbId;\r\n\r\n format = format.toLowerCase();\r\n id = id.toUpperCase();\r\n\r\n switch (format) {\r\n case 'pdb':\r\n source = `https://files.rcsb.org/download/${id}.pdb`;\r\n break;\r\n case 'cif':\r\n source = `https://files.rcsb.org/download/${id}.cif`;\r\n break;\r\n case 'ccp4':\r\n source = `https://www.ebi.ac.uk/pdbe/coordinates/files/${id.toLowerCase()}.ccp4`;\r\n break;\r\n case 'dsn6':\r\n source = `https://edmaps.rcsb.org/maps/${id.toLowerCase()}_2fofc.dsn6`;\r\n break;\r\n default:\r\n throw new Error('Unexpected data format shortcut');\r\n }\r\n\r\n opts.fileType = format;\r\n opts.fileName = `${id}.${format}`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // e.g. \"pc:aspirin\"\r\n const matchesPubchem = rePubchem.exec(source);\r\n if (matchesPubchem) {\r\n const compound = matchesPubchem[1].toLowerCase();\r\n source = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${compound}/JSON?record_type=3d`;\r\n opts.fileType = 'pubchem';\r\n opts.fileName = `${compound}.json`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // otherwise is should be an URL\r\n if (opts.sourceType === 'url' || opts.sourceType === undefined) {\r\n opts.sourceType = 'url';\r\n\r\n // e.g. \"./data/1CRN.pdb\"\r\n if (!reUrlScheme.test(source)) {\r\n source = utils.resolveURL(source);\r\n }\r\n }\r\n\r\n return source;\r\n}\r\n\r\nfunction updateBinaryMode(opts) {\r\n let { binary } = opts;\r\n\r\n // detect by format\r\n if (opts.fileType !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n } else {\r\n throw new Error('Could not find suitable parser for this format');\r\n }\r\n }\r\n\r\n // detect by file extension\r\n if (binary === undefined && opts.fileExt !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ ext: opts.fileExt }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n }\r\n }\r\n\r\n // temporary workaround for animation\r\n if (opts.fileExt !== undefined && opts.fileExt.toLowerCase() === '.man') {\r\n opts.binary = true;\r\n opts.animation = true; // who cares?\r\n }\r\n\r\n // update if detected\r\n if (binary !== undefined) {\r\n if (opts.binary !== undefined && opts.binary !== binary) {\r\n opts.context.logger.warn('Overriding incorrect binary mode');\r\n }\r\n }\r\n\r\n opts.binary = binary || false;\r\n}\r\n\r\nfunction _fetchData(source, opts, job) {\r\n return new Promise(((resolve) => {\r\n if (job.shouldCancel()) {\r\n throw new Error('Operation cancelled');\r\n }\r\n job.notify({ type: 'fetching' });\r\n\r\n // allow for source shortcuts\r\n source = resolveSourceShortcut(source, opts);\r\n\r\n // detect a proper loader\r\n const TheLoader = _.head(io.loaders.find({ type: opts.sourceType, source }));\r\n if (!TheLoader) {\r\n throw new Error(LOADER_NOT_FOUND);\r\n }\r\n\r\n // split file name\r\n const fileName = opts.fileName || TheLoader.extractName(source);\r\n if (fileName) {\r\n const [name, fileExt] = utils.splitFileName(fileName);\r\n _.defaults(opts, { name, fileExt, fileName });\r\n }\r\n\r\n // should it be text or binary?\r\n updateBinaryMode(opts);\r\n\r\n // FIXME: All new settings retrieved from server are applied after the loading is complete. However, we need some\r\n // flags to alter the loading process itself. Here we apply them in advance. Dirty hack. Kill the server, remove\r\n // all hacks and everybody's happy.\r\n let newOptions = _.get(opts, 'preset.expression');\r\n if (!_.isUndefined(newOptions)) {\r\n newOptions = JSON.parse(newOptions);\r\n if (newOptions && newOptions.settings) {\r\n const keys = ['singleUnit'];\r\n for (let keyIndex = 0, keyCount = keys.length; keyIndex < keyCount; ++keyIndex) {\r\n const key = keys[keyIndex];\r\n const value = _.get(newOptions.settings, key);\r\n if (!_.isUndefined(value)) {\r\n settings.set(key, value);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // create a loader\r\n const loader = new TheLoader(source, opts);\r\n loader.context = opts.context;\r\n job.addEventListener('cancel', () => loader.abort());\r\n\r\n loader.addEventListener('progress', (event) => {\r\n if (event.lengthComputable && event.total > 0) {\r\n reportProgress(loader.logger, 'Fetching', event.loaded / event.total);\r\n } else {\r\n reportProgress(loader.logger, 'Fetching');\r\n }\r\n });\r\n\r\n console.time('fetch');\r\n const promise = loader.load()\r\n .then((data) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.info('Fetching finished');\r\n job.notify({ type: 'fetchingDone', data });\r\n return data;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Fetching failed');\r\n job.notify({ type: 'fetchingDone', error });\r\n throw error;\r\n });\r\n resolve(promise);\r\n }));\r\n}\r\n\r\nfunction _parseData(data, opts, job) {\r\n if (job.shouldCancel()) {\r\n return Promise.reject(new Error('Operation cancelled'));\r\n }\r\n\r\n job.notify({ type: 'parsing' });\r\n\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType, ext: opts.fileExt, data }));\r\n if (!TheParser) {\r\n return Promise.reject(new Error('Could not find suitable parser'));\r\n }\r\n\r\n const parser = new TheParser(data, opts);\r\n parser.context = opts.context;\r\n job.addEventListener('cancel', () => parser.abort());\r\n\r\n console.time('parse');\r\n return parser.parse()\r\n .then((dataSet) => {\r\n console.timeEnd('parse');\r\n job.notify({ type: 'parsingDone', data: dataSet });\r\n return dataSet;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('parse');\r\n opts.error = error;\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Parsing failed');\r\n job.notify({ type: 'parsingDone', error });\r\n throw error;\r\n });\r\n}\r\n\r\n/**\r\n * Load molecule asynchronously.\r\n * @param {string|File} source - Molecule source to load (e.g. PDB ID, URL or File object).\r\n * @param {object=} opts - Options.\r\n * @param {string=} opts.sourceType - Data source type (e.g. 'url', 'file').\r\n * @param {string=} opts.fileType - Data contents type (e.g. 'pdb', 'cml').\r\n * @param {string=} opts.mdFile - .nc file path.\r\n * @param {boolean=} opts.keepRepsInfo - prevent reset of object and reps information.\r\n * @returns {Promise} name of the visual that was added to the viewer\r\n */\r\nMiew.prototype.load = function (source, opts) {\r\n opts = _.merge({}, opts, {\r\n context: this,\r\n });\r\n\r\n // for a single-file scenario\r\n if (!this.settings.now.use.multiFile) {\r\n // abort all loaders in progress\r\n if (this._loading.length) {\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n }\r\n\r\n // reset\r\n if (!opts.animation) { // FIXME: sometimes it is set AFTERWARDS!\r\n this.reset(true);\r\n }\r\n }\r\n\r\n this._interpolator.reset();\r\n\r\n this.dispatchEvent({ type: 'loading', options: opts, source });\r\n\r\n const job = new JobHandle();\r\n this._loading.push(job);\r\n job.addEventListener('notification', (e) => {\r\n this.dispatchEvent(e.slaveEvent);\r\n });\r\n\r\n this._spinner.spin(this._container);\r\n\r\n const onLoadEnd = (anything) => {\r\n const jobIndex = this._loading.indexOf(job);\r\n if (jobIndex !== -1) {\r\n this._loading.splice(jobIndex, 1);\r\n }\r\n this._spinner.stop();\r\n this._refreshTitle();\r\n job.notify({ type: 'loadingDone', anything });\r\n return anything;\r\n };\r\n\r\n return _fetchData(source, opts, job)\r\n .then((data) => _parseData(data, opts, job))\r\n .then((object) => {\r\n const name = this._onLoad(object, opts);\r\n return onLoadEnd(name);\r\n })\r\n .catch((err) => {\r\n this.logger.error('Could not load data');\r\n this.logger.debug(err);\r\n throw onLoadEnd(err);\r\n });\r\n};\r\n\r\n/**\r\n * Unload molecule (delete corresponding visual).\r\n * @param {string=} name - name of the visual\r\n */\r\nMiew.prototype.unload = function (name) {\r\n this._removeVisual(name || this.getCurrentVisual());\r\n this.resetPivot();\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n};\r\n\r\n/**\r\n * Start new animation. Now is broken.\r\n * @param fileData - new data to animate\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._startAnimation = function (fileData) {\r\n this._stopAnimation();\r\n const self = this;\r\n const visual = this._getComplexVisual();\r\n if (visual === null) {\r\n this.logger.error('Unable to start animation - no molecule is loaded.');\r\n return;\r\n }\r\n try {\r\n this._frameInfo = new FrameInfo(\r\n visual.getComplex(),\r\n fileData,\r\n {\r\n onLoadStatusChanged() {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo ? self._frameInfo.isLoading : true,\r\n },\r\n });\r\n },\r\n onError(message) {\r\n self._stopAnimation();\r\n self.logger.error(message);\r\n },\r\n },\r\n );\r\n } catch (e) {\r\n this.logger.error('Animation file does not fit to current complex!');\r\n return;\r\n }\r\n this._continueAnimation();\r\n};\r\n\r\n/**\r\n * Pause current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._pauseAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n this._isAnimating = false;\r\n clearInterval(this._animInterval);\r\n this._animInterval = null;\r\n if (this._frameInfo) {\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: this._isAnimating,\r\n isLoading: this._frameInfo.isLoading,\r\n },\r\n });\r\n }\r\n};\r\n\r\n/**\r\n * Continue current animation after pausing. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._continueAnimation = function () {\r\n this._isAnimating = true;\r\n let minFrameTime = 1000 / settings.now.maxfps;\r\n minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime;\r\n const self = this;\r\n const { pivot } = self._gfx;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.resetSelectionMask();\r\n visual.rebuildSelectionGeometry();\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n }\r\n this._animInterval = setInterval(() => {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo.isLoading,\r\n },\r\n });\r\n if (self._frameInfo.frameIsReady) {\r\n pivot.updateToFrame(self._frameInfo);\r\n self._updateObjsToFrame(self._frameInfo);\r\n self._refreshTitle(` Frame ${self._frameInfo._currFrame} of ${self._frameInfo._framesCount\r\n } time interval - ${self._frameInfo._timeStep}`);\r\n try {\r\n self._frameInfo.nextFrame();\r\n } catch (e) {\r\n self.logger.error('Error during animation');\r\n self._stopAnimation();\r\n return;\r\n }\r\n self._needRender = true;\r\n }\r\n }, minFrameTime);\r\n};\r\n\r\n/**\r\n * Stop current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._stopAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n clearInterval(this._animInterval);\r\n this._frameInfo.disableEvents();\r\n this._frameInfo = null;\r\n this._animInterval = null;\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: null,\r\n });\r\n};\r\n\r\n/**\r\n * Invoked upon successful loading of some data source\r\n * @param {DataSource} dataSource - Data source for visualization (molecular complex or other)\r\n * @param {object} opts - Options.\r\n * @private\r\n */\r\nMiew.prototype._onLoad = function (dataSource, opts) {\r\n const gfx = this._gfx;\r\n let visualName = null;\r\n\r\n if (opts.animation) {\r\n this._refreshTitle();\r\n this._startAnimation(dataSource);\r\n return null;\r\n }\r\n this._stopAnimation();\r\n if (!opts || !opts.keepRepsInfo) {\r\n this._opts.reps = null;\r\n this._opts._objects = null;\r\n }\r\n\r\n if (dataSource.id === 'Complex') {\r\n const complex = dataSource;\r\n\r\n // update title\r\n if (opts.fileName) {\r\n complex.name = complex.name || removeExtension(opts.fileName).toUpperCase();\r\n } else if (opts.amberFileName) {\r\n complex.name = complex.name || removeExtension(opts.amberFileName).toUpperCase();\r\n } else {\r\n complex.name = `Dynamic ${opts.fileType} molecule`;\r\n }\r\n\r\n visualName = this._addVisual(new ComplexVisual(complex.name, complex));\r\n this._curVisualName = visualName;\r\n\r\n const desc = this.info();\r\n this.logger.info(`Parsed ${opts.fileName} (${\r\n desc.atoms} atoms, ${\r\n desc.bonds} bonds, ${\r\n desc.residues} residues, ${\r\n desc.chains} chains).`);\r\n\r\n if (_.isNumber(this._opts.unit)) {\r\n complex.setCurrentUnit(this._opts.unit);\r\n }\r\n\r\n if (opts.preset) {\r\n // ...removed server access...\r\n } else if (settings.now.autoPreset) {\r\n switch (opts.fileType) {\r\n case 'cml':\r\n this.resetReps('small');\r\n break;\r\n case 'pdb':\r\n case 'mmtf':\r\n case 'cif':\r\n if (hasValidResidues(complex)) {\r\n this.resetReps('macro');\r\n } else {\r\n this.resetReps('small');\r\n }\r\n break;\r\n default:\r\n this.resetReps('default');\r\n break;\r\n }\r\n } else {\r\n this.resetReps('default');\r\n }\r\n } else if (dataSource.id === 'Volume') {\r\n this.resetEd();\r\n visualName = this._onLoadEd(dataSource);\r\n }\r\n\r\n gfx.camera.updateProjectionMatrix();\r\n this._updateFog();\r\n\r\n // reset global transform\r\n gfx.root.resetTransform();\r\n this.resetPivot();\r\n\r\n // set scale to fit everything on the screen\r\n this._objectControls.setScale(settings.now.radiusToFit / this._getBSphereRadius());\r\n\r\n this._resetObjects();\r\n\r\n if (settings.now.autoResolution) {\r\n this._tweakResolution();\r\n }\r\n\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n this._refreshTitle();\r\n\r\n return visualName;\r\n};\r\n\r\nMiew.prototype.resetEd = function () {\r\n if (this._edLoader) {\r\n this._edLoader.abort();\r\n this._edLoader = null;\r\n }\r\n\r\n // free all resources\r\n this._removeVisual(this._getVolumeVisual());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype.loadEd = function (source) {\r\n this.resetEd();\r\n\r\n const TheLoader = _.head(io.loaders.find({ source }));\r\n if (!TheLoader) {\r\n this.logger.error(LOADER_NOT_FOUND);\r\n return Promise.reject(new Error(LOADER_NOT_FOUND));\r\n }\r\n\r\n const loader = this._edLoader = new TheLoader(source, { binary: true });\r\n loader.context = this;\r\n return loader.load().then((data) => {\r\n const TheParser = _.head(io.parsers.find({ format: 'ccp4' }));\r\n if (!TheParser) {\r\n throw new Error(PARSER_NOT_FOUND);\r\n }\r\n const parser = new TheParser(data);\r\n parser.context = this;\r\n return parser.parse().then((dataSource) => {\r\n this._onLoadEd(dataSource);\r\n });\r\n }).catch((error) => {\r\n this.logger.error('Could not load ED data');\r\n this.logger.debug(error);\r\n });\r\n};\r\n\r\nMiew.prototype._onLoadEd = function (dataSource) {\r\n dataSource.normalize();\r\n\r\n const volumeVisual = new VolumeVisual('volume', dataSource);\r\n volumeVisual.getMesh().layers.set(gfxutils.LAYERS.VOLUME); // volume mesh is not visible to common render\r\n const visualName = this._addVisual(volumeVisual);\r\n\r\n this._needRender = true;\r\n return visualName;\r\n};\r\n\r\nMiew.prototype._needRebuild = function () {\r\n let needsRebuild = false;\r\n this._forEachComplexVisual((visual) => {\r\n needsRebuild = needsRebuild || visual.needsRebuild();\r\n });\r\n return needsRebuild;\r\n};\r\n\r\nMiew.prototype._rebuildObjects = function () {\r\n const self = this;\r\n const gfx = this._gfx;\r\n let i;\r\n let n;\r\n\r\n // remove old object geometry\r\n const toRemove = [];\r\n for (i = 0; i < gfx.pivot.children.length; ++i) {\r\n const child = gfx.pivot.children[i];\r\n if (!(child instanceof Visual)) {\r\n toRemove.push(child);\r\n }\r\n }\r\n for (i = 0; i < toRemove.length; ++i) {\r\n toRemove[i].parent.remove(toRemove[i]);\r\n }\r\n\r\n setTimeout(() => {\r\n const objList = self._objects;\r\n for (i = 0, n = objList.length; i < n; ++i) {\r\n const obj = objList[i];\r\n if (obj.needsRebuild) {\r\n obj.build();\r\n }\r\n if (obj.getGeometry()) {\r\n gfx.pivot.add(obj.getGeometry());\r\n }\r\n }\r\n }, 10);\r\n};\r\n\r\nMiew.prototype.changeUnit = function (unitIdx, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n throw new Error('There is no complex to change!');\r\n }\r\n\r\n function currentUnitInfo() {\r\n const unit = visual ? visual.getComplex().getCurrentUnit() : 0;\r\n const type = unit > 0 ? (`Bio molecule ${unit}`) : 'Asymmetric unit';\r\n return `Current unit: ${unit} (${type})`;\r\n }\r\n\r\n if (unitIdx === undefined) {\r\n return currentUnitInfo();\r\n }\r\n if (_.isString(unitIdx)) {\r\n unitIdx = Math.max(parseInt(unitIdx, 10), 0);\r\n }\r\n if (visual.getComplex().setCurrentUnit(unitIdx)) {\r\n this._resetScene();\r\n this._updateInfoPanel();\r\n }\r\n return currentUnitInfo();\r\n};\r\n\r\n/**\r\n * Start to rebuild geometry asynchronously.\r\n */\r\nMiew.prototype.rebuild = function () {\r\n if (this._building) {\r\n this.logger.warn('Miew.rebuild(): already building!');\r\n return;\r\n }\r\n this._building = true;\r\n\r\n this.dispatchEvent({ type: 'rebuilding' });\r\n\r\n this._rebuildObjects();\r\n\r\n this._gfx.renderer2d.reset();\r\n\r\n const rebuildActions = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.needsRebuild()) {\r\n rebuildActions.push(visual.rebuild().then(() => new Promise(((resolve) => {\r\n visual.rebuildSelectionGeometry();\r\n resolve();\r\n }))));\r\n }\r\n });\r\n\r\n // Start asynchronous rebuild\r\n const self = this;\r\n this._spinner.spin(this._container);\r\n Promise.all(rebuildActions).then(() => {\r\n self._spinner.stop();\r\n\r\n self._needRender = true;\r\n\r\n self._refreshTitle();\r\n this.dispatchEvent({ type: 'buildingDone' });\r\n self._building = false;\r\n });\r\n};\r\n\r\n/** Mark all representations for rebuilding */\r\nMiew.prototype.rebuildAll = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setNeedsRebuild();\r\n });\r\n};\r\n\r\nMiew.prototype._refreshTitle = function (appendix) {\r\n let title;\r\n appendix = appendix === undefined ? '' : appendix;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n title = visual.getComplex().name;\r\n const rep = visual.repGet(visual.repCurrent());\r\n title += (rep ? ` – ${rep.mode.name} Mode` : '');\r\n } else {\r\n title = Object.keys(this._visuals).length > 0 ? 'Unknown' : 'No Data';\r\n }\r\n title += appendix;\r\n\r\n this.dispatchEvent({ type: 'titleChanged', data: title });\r\n};\r\n\r\nMiew.prototype.setNeedRender = function () {\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._extractRepresentation = function () {\r\n const changed = [];\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCount() === 0) {\r\n return;\r\n }\r\n\r\n const selector = visual.buildSelectorFromMask(1 << visual.getSelectionBit());\r\n const defPreset = settings.now.presets.default;\r\n const res = visual.repAdd({\r\n selector,\r\n mode: defPreset[0].mode.id,\r\n colorer: defPreset[0].colorer.id,\r\n material: defPreset[0].material.id,\r\n });\r\n if (!res) {\r\n if (visual.repCount() === ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n this.logger.warn(`Number of representations is limited to ${ComplexVisual.NUM_REPRESENTATION_BITS}`);\r\n }\r\n return;\r\n }\r\n\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n visual.repCurrent(res.index);\r\n\r\n changed.push(visual.name);\r\n });\r\n\r\n if (changed.length > 0) {\r\n this.logger.report(`New representation from selection for complexes: ${changed.join(', ')}`);\r\n }\r\n};\r\n\r\n/**\r\n * Change current representation list.\r\n * @param {array} reps - Representation list.\r\n */\r\nMiew.prototype._setReps = function (reps) {\r\n reps = reps || (this._opts && this._opts.reps) || [];\r\n this._forEachComplexVisual((visual) => visual.resetReps(reps));\r\n};\r\n\r\n/**\r\n * Apply existing preset to current scene.\r\n * @param preset\r\n */\r\nMiew.prototype.applyPreset = function (preset) {\r\n const { presets } = settings.now;\r\n const presList = [\r\n preset || settings.defaults.preset,\r\n settings.defaults.preset,\r\n Object.keys(presets)[0],\r\n ];\r\n let reps = null;\r\n for (let i = 0; !reps && i < presList.length; ++i) {\r\n settings.set('preset', presList[i]);\r\n reps = presets[settings.now.preset];\r\n if (!reps) {\r\n this.logger.warn(`Unknown preset \"${settings.now.preset}\"`);\r\n }\r\n }\r\n this._setReps(reps);\r\n};\r\n\r\n/**\r\n * Reset current representation list to initial values.\r\n * @param {string} [preset] - The source preset in case of uninitialized representation list.\r\n */\r\nMiew.prototype.resetReps = function (preset) {\r\n const reps = this._opts && this._opts.reps;\r\n if (reps) {\r\n this._setReps(reps);\r\n } else {\r\n this.applyPreset(preset);\r\n }\r\n};\r\n\r\n/**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\nMiew.prototype.repCount = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repCount() : 0;\r\n};\r\n\r\n/**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {string=} [name] - Complex name. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\nMiew.prototype.repCurrent = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n const newIdx = visual ? visual.repCurrent(index) : -1;\r\n if (index && newIdx !== index) {\r\n this.logger.warn(`Representation ${index} was not found. Current rep remains unchanged.`);\r\n }\r\n return newIdx;\r\n};\r\n\r\n/**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {?object} Representation description.\r\n */\r\nMiew.prototype.rep = function (index, rep) {\r\n const visual = this._getComplexVisual('');\r\n if (!visual) {\r\n return null;\r\n }\r\n const res = visual.rep(index, rep);\r\n if (res.status === 'created') {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n } else if (res.status === 'changed') {\r\n this.dispatchEvent({ type: 'repChanged', index: res.index, name: visual.name });\r\n }\r\n return res.desc;\r\n};\r\n\r\n/**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\nMiew.prototype.repGet = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repGet(index) : null;\r\n};\r\n\r\n/**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {number} Index of the new representation.\r\n */\r\nMiew.prototype.repAdd = function (rep, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return -1;\r\n }\r\n\r\n const res = visual.repAdd(rep);\r\n if (res) {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name });\r\n return res.index;\r\n }\r\n return -1;\r\n};\r\n\r\n/**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\nMiew.prototype.repRemove = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n visual.repRemove(index);\r\n this.dispatchEvent({ type: 'repRemoved', index, name });\r\n};\r\n\r\n/**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\nMiew.prototype.repHide = function (index, hide, name) {\r\n this._needRender = true;\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repHide(index, hide) : null;\r\n};\r\n\r\nMiew.prototype._setEditMode = function (mode) {\r\n this._editMode = mode;\r\n\r\n const elem = this._msgMode;\r\n if (elem) {\r\n elem.style.opacity = (mode === EDIT_MODE.COMPLEX) ? 0.0 : 1.0;\r\n\r\n if (mode !== EDIT_MODE.COMPLEX) {\r\n const t = elem.getElementsByTagName('p')[0];\r\n t.innerHTML = (mode === EDIT_MODE.COMPONENT) ? 'COMPONENT EDIT MODE' : 'FRAGMENT EDIT MODE';\r\n }\r\n }\r\n\r\n this.dispatchEvent({ type: 'editModeChanged', data: mode === EDIT_MODE.COMPLEX });\r\n};\r\n\r\nMiew.prototype._enterComponentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const editors = [];\r\n this._forEachComplexVisual((visual) => {\r\n const editor = visual.beginComponentEdit();\r\n if (editor) {\r\n editors.push(editor);\r\n }\r\n });\r\n\r\n if (editors === []) {\r\n return;\r\n }\r\n\r\n this._editors = editors;\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- ON');\r\n this._setEditMode(EDIT_MODE.COMPONENT);\r\n this._objectControls.keysTranslateObj(true);\r\n};\r\n\r\nMiew.prototype._applyComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._needRender = true;\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._enterFragmentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const selectedVisuals = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual instanceof ComplexVisual\r\n && visual.getSelectionCount() > 0) {\r\n selectedVisuals.push(visual);\r\n }\r\n });\r\n\r\n if (selectedVisuals.length !== 1) {\r\n // either we have no selection or\r\n // we have selected atoms in two or more visuals -- not supported\r\n return;\r\n }\r\n\r\n const editor = selectedVisuals[0].beginFragmentEdit();\r\n if (!editor) {\r\n return;\r\n }\r\n this._editors = [editor];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- ON (single bond)');\r\n this._setEditMode(EDIT_MODE.FRAGMENT);\r\n this._objectControls.allowTranslation(false);\r\n this._objectControls.allowAltObjFreeRotation(editor.isFreeRotationAllowed());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._applyFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onPick = function (event) {\r\n if (!settings.now.picking) {\r\n // picking is disabled\r\n return;\r\n }\r\n\r\n if (this._animInterval !== null) {\r\n // animation playback is on\r\n return;\r\n }\r\n\r\n if (this._editMode === EDIT_MODE.FRAGMENT) {\r\n // prevent picking in fragment edit mode\r\n return;\r\n }\r\n\r\n if (this._objectControls.isEditingAltObj()) {\r\n // prevent picking during component rotation\r\n return;\r\n }\r\n\r\n // update last pick & find complex\r\n let complex = null;\r\n if (event.obj.atom) {\r\n complex = event.obj.atom.residue.getChain().getComplex();\r\n this._lastPick = event.obj.atom;\r\n } else if (event.obj.residue) {\r\n complex = event.obj.residue.getChain().getComplex();\r\n this._lastPick = event.obj.residue;\r\n } else if (event.obj.chain) {\r\n complex = event.obj.chain.getComplex();\r\n this._lastPick = event.obj.chain;\r\n } else if (event.obj.molecule) {\r\n complex = event.obj.molecule.complex;\r\n this._lastPick = event.obj.molecule;\r\n } else {\r\n this._lastPick = null;\r\n }\r\n\r\n function _updateSelection(visual) {\r\n visual.updateSelectionMask(event.obj);\r\n visual.rebuildSelectionGeometry();\r\n }\r\n\r\n // update visual\r\n if (complex) {\r\n const visual = this._getVisualForComplex(complex);\r\n if (visual) {\r\n _updateSelection(visual);\r\n this._needRender = true;\r\n }\r\n } else {\r\n this._forEachComplexVisual(_updateSelection);\r\n this._needRender = true;\r\n }\r\n\r\n this._updateInfoPanel();\r\n this.dispatchEvent(event);\r\n};\r\n\r\nMiew.prototype._onKeyDown = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n // editing keys\r\n if (settings.now.editing) {\r\n switch (event.code) {\r\n case 'KeyC':\r\n this._enterComponentEditMode();\r\n break;\r\n case 'KeyF':\r\n this._enterFragmentEditMode();\r\n break;\r\n case 'KeyA':\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._applyComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._applyFragmentEdit();\r\n break;\r\n default:\r\n break;\r\n }\r\n break;\r\n case 'KeyD':\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._discardComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._discardFragmentEdit();\r\n break;\r\n default:\r\n break;\r\n }\r\n break;\r\n default:\r\n }\r\n }\r\n\r\n // other keys\r\n switch (event.code) {\r\n case 'NumpadAdd':\r\n if (event.altKey) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.expandSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n }\r\n break;\r\n case 'NumpadSubtract':\r\n if (event.altKey) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.shrinkSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n }\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nMiew.prototype._onKeyUp = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n if (event.code === 'KeyX') {\r\n this._extractRepresentation();\r\n }\r\n};\r\n\r\nMiew.prototype._updateInfoPanel = function () {\r\n const info = this._msgAtomInfo.getElementsByTagName('p')[0];\r\n let atom;\r\n let residue;\r\n\r\n let count = 0;\r\n this._forEachComplexVisual((visual) => {\r\n count += visual.getSelectionCount();\r\n });\r\n\r\n while (info.firstChild) {\r\n info.removeChild(info.firstChild);\r\n }\r\n\r\n if (count === 0) {\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n return;\r\n }\r\n\r\n let firstLine = `${String(count)} atom${count !== 1 ? 's' : ''} selected`;\r\n if (this._lastPick !== null) {\r\n firstLine += ', the last pick:';\r\n }\r\n let secondLine = '';\r\n let aName = '';\r\n let coordLine = '';\r\n\r\n if (this._lastPick instanceof Atom) {\r\n atom = this._lastPick;\r\n residue = atom.residue;\r\n\r\n aName = atom.name;\r\n const location = (atom.location !== 32) ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space\r\n secondLine = `${atom.element.fullName} #${atom.serial}${location}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}.`;\r\n secondLine += aName;\r\n\r\n coordLine = `Coord: (${atom.position.x.toFixed(2).toString()},\\\r\n ${atom.position.y.toFixed(2).toString()},\\\r\n ${atom.position.z.toFixed(2).toString()})`;\r\n } else if (this._lastPick instanceof Residue) {\r\n residue = this._lastPick;\r\n\r\n secondLine = `${residue._type._fullName}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}`;\r\n } else if (this._lastPick instanceof Chain) {\r\n secondLine = `chain ${this._lastPick._name}`;\r\n } else if (this._lastPick instanceof Molecule) {\r\n secondLine = `molecule ${this._lastPick._name}`;\r\n }\r\n\r\n info.appendChild(document.createTextNode(firstLine));\r\n\r\n if (secondLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(secondLine));\r\n }\r\n\r\n if (coordLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(coordLine));\r\n }\r\n\r\n this._msgAtomInfo.style.opacity = 1.0;\r\n};\r\n\r\nMiew.prototype._getAltObj = function () {\r\n if (this._editors) {\r\n let altObj = null;\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n const nextAltObj = this._editors[i].getAltObj();\r\n if (nextAltObj.objects.length > 0) {\r\n if (altObj) {\r\n // we have selected atoms in two or more visuals -- not supported\r\n altObj = null;\r\n break;\r\n }\r\n altObj = nextAltObj;\r\n }\r\n }\r\n if (altObj) {\r\n return altObj;\r\n }\r\n }\r\n\r\n return {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n};\r\n\r\nMiew.prototype.resetPivot = (function () {\r\n const boundingBox = new THREE.Box3();\r\n const center = new THREE.Vector3();\r\n\r\n return function () {\r\n boundingBox.makeEmpty();\r\n this._forEachVisual((visual) => {\r\n boundingBox.union(visual.getBoundaries().boundingBox);\r\n });\r\n\r\n boundingBox.getCenter(center);\r\n this._objectControls.setPivot(center.negate());\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotResidue = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (residue) {\r\n const visual = this._getVisualForComplex(residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n if (residue._controlPoint) {\r\n center.copy(residue._controlPoint);\r\n } else {\r\n let x = 0;\r\n let y = 0;\r\n let z = 0;\r\n const amount = residue._atoms.length;\r\n for (let i = 0; i < amount; ++i) {\r\n const p = residue._atoms[i].position;\r\n x += p.x / amount;\r\n y += p.y / amount;\r\n z += p.z / amount;\r\n }\r\n center.set(x, y, z);\r\n }\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotAtom = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (atom) {\r\n const visual = this._getVisualForComplex(atom.residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n center.copy(atom.position);\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.getSelectionCenter = (function () {\r\n const _centerInVisual = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n return function (center, includesAtom, selector) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCenter(_centerInVisual, includesAtom, selector || visual.getSelectionBit())) {\r\n center.add(_centerInVisual);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.negate();\r\n return true;\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotSubset = (function () {\r\n const _center = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n function _includesInCurSelection(atom, selectionBit) {\r\n return atom.mask & (1 << selectionBit);\r\n }\r\n\r\n function _includesInSelector(atom, selector) {\r\n return selector.selector.includesAtom(atom);\r\n }\r\n\r\n return function (selector) {\r\n const includesAtom = (selector) ? _includesInSelector : _includesInCurSelection;\r\n\r\n if (this.getSelectionCenter(_center, includesAtom, selector)) {\r\n this._objectControls.setPivot(_center);\r\n this.dispatchEvent({ type: 'transform' });\r\n } else {\r\n this.logger.warn('selection is empty. Center operation not performed');\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Makes a screenshot.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n * @returns {string} Data URL representing the image contents.\r\n */\r\nMiew.prototype.screenshot = function (width, height) {\r\n const gfx = this._gfx;\r\n const deviceWidth = gfx.renderer.domElement.width;\r\n const deviceHeight = gfx.renderer.domElement.height;\r\n\r\n function fov2Tan(fov) {\r\n return Math.tan(THREE.MathUtils.degToRad(0.5 * fov));\r\n }\r\n\r\n function tan2Fov(tan) {\r\n return THREE.MathUtils.radToDeg(Math.atan(tan)) * 2.0;\r\n }\r\n\r\n function getDataURL() {\r\n let dataURL;\r\n const currBrowser = utils.getBrowser();\r\n\r\n if (currBrowser === utils.browserType.SAFARI) {\r\n const canvas = document.createElement('canvas');\r\n const canvasContext = canvas.getContext('2d');\r\n\r\n canvas.width = width === undefined ? deviceWidth : width;\r\n canvas.height = height === undefined ? deviceHeight : height;\r\n\r\n canvasContext.drawImage(gfx.renderer.domElement, 0, 0, canvas.width, canvas.height);\r\n dataURL = canvas.toDataURL('image/png');\r\n } else {\r\n // Copy current canvas to screenshot\r\n dataURL = gfx.renderer.domElement.toDataURL('image/png');\r\n }\r\n return dataURL;\r\n }\r\n height = height || width;\r\n\r\n let screenshotURI;\r\n if ((width === undefined && height === undefined)\r\n || (width === deviceWidth && height === deviceHeight)) {\r\n // renderer.domElement.toDataURL('image/png') returns flipped image in Safari\r\n // It hasn't been resolved yet, but getScreenshotSafari()\r\n // fixes it using an extra canvas.\r\n screenshotURI = getDataURL();\r\n } else {\r\n const originalAspect = gfx.camera.aspect;\r\n const originalFov = gfx.camera.fov;\r\n const originalTanFov2 = fov2Tan(gfx.camera.fov);\r\n\r\n // screenshot should contain the principal area of interest (a centered square touching screen sides)\r\n const areaOfInterestSize = Math.min(gfx.width, gfx.height);\r\n const areaOfInterestTanFov2 = originalTanFov2 * areaOfInterestSize / gfx.height;\r\n\r\n // set appropriate camera aspect & FOV\r\n const shotAspect = width / height;\r\n gfx.renderer.setPixelRatio(1);\r\n gfx.camera.aspect = shotAspect;\r\n gfx.camera.fov = tan2Fov(areaOfInterestTanFov2 / Math.min(shotAspect, 1.0));\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n // resize canvas to the required size of screenshot\r\n gfx.renderer.setDrawingBufferSize(width, height, 1);\r\n\r\n // make screenshot\r\n this._renderFrame(settings.now.stereo);\r\n screenshotURI = getDataURL();\r\n\r\n // restore original camera & canvas proportions\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.camera.aspect = originalAspect;\r\n gfx.camera.fov = originalFov;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.renderer.setDrawingBufferSize(gfx.width, gfx.height, window.devicePixelRatio);\r\n this._needRender = true;\r\n }\r\n\r\n return screenshotURI;\r\n};\r\n\r\n/**\r\n * Makes screenshot and initiates a download.\r\n * @param {string} [filename] - Name of a file. Default to a 'screenshot-XXXXX.png', where XXXXX is a current\r\n * date/time in seconds.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n */\r\nMiew.prototype.screenshotSave = function (filename, width, height) {\r\n const uri = this.screenshot(width, height);\r\n utils.shotDownload(uri, filename);\r\n};\r\n\r\nMiew.prototype.save = function (opts) {\r\n this._export(opts.fileType).then((dataString) => {\r\n const filename = this._visuals[this._curVisualName]._complex.name;\r\n utils.download(dataString, filename, opts.fileType);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone' });\r\n }).catch((error) => {\r\n this.logger.error('Could not export data');\r\n this.logger.debug(error);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone', error });\r\n });\r\n};\r\n\r\nMiew.prototype._tweakResolution = function () {\r\n const maxPerf = [\r\n ['poor', 100],\r\n ['low', 500],\r\n ['medium', 1000],\r\n ['high', 5000],\r\n ['ultra', Number.MAX_VALUE],\r\n ];\r\n\r\n let atomCount = 0;\r\n this._forEachComplexVisual((visual) => {\r\n atomCount += visual.getComplex().getAtomCount();\r\n });\r\n\r\n if (atomCount > 0) {\r\n const performance = this._gfxScore * 10e5 / atomCount;\r\n // set resolution based on estimated performance\r\n for (let i = 0; i < maxPerf.length; ++i) {\r\n if (performance < maxPerf[i][1]) {\r\n this._autoChangeResolution(maxPerf[i][0]);\r\n break;\r\n }\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._autoChangeResolution = function (resolution) {\r\n if (resolution !== settings.now.resolution) {\r\n this.logger.report(`Your rendering resolution was changed to \"${resolution}\" for best performance.`);\r\n }\r\n settings.now.resolution = resolution;\r\n};\r\n\r\n/**\r\n * Save current settings to cookies.\r\n */\r\nMiew.prototype.saveSettings = function () {\r\n this._cookies.setCookie(this._opts.settingsCookie, JSON.stringify(this.settings.getDiffs(true)));\r\n};\r\n\r\n/**\r\n * Load settings from cookies.\r\n */\r\nMiew.prototype.restoreSettings = function () {\r\n try {\r\n const cookie = this._cookies.getCookie(this._opts.settingsCookie);\r\n const diffs = cookie ? JSON.parse(cookie) : {};\r\n this.settings.applyDiffs(diffs, true);\r\n } catch (e) {\r\n this.logger.error(`Cookies parse error: ${e.message}`);\r\n }\r\n};\r\n\r\n/**\r\n * Reset current settings to the defaults.\r\n */\r\nMiew.prototype.resetSettings = function () {\r\n this.settings.reset();\r\n};\r\n\r\n/*\r\n * DANGEROUS and TEMPORARY. The method should change or disappear in future versions.\r\n * @param {string|object} opts - See {@link Miew} constructor.\r\n * @see {@link Miew#set}, {@link Miew#repAdd}, {@link Miew#rep}.\r\n */\r\nMiew.prototype.setOptions = function (opts) {\r\n if (typeof opts === 'string') {\r\n opts = Miew.options.fromAttr(opts);\r\n }\r\n if (opts.reps) {\r\n this._opts.reps = null;\r\n }\r\n _.merge(this._opts, opts);\r\n if (opts.settings) {\r\n this.set(opts.settings);\r\n }\r\n\r\n this._opts._objects = opts._objects;\r\n this._resetObjects();\r\n\r\n if (opts.load) {\r\n this.load(opts.load, { fileType: opts.type });\r\n }\r\n\r\n if (opts.preset) {\r\n settings.now.preset = opts.preset;\r\n }\r\n\r\n if (opts.reps) {\r\n this.resetReps(opts.preset);\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.getComplex().resetCurrentUnit();\r\n if (_.isNumber(opts.unit)) {\r\n visual.getComplex().setCurrentUnit(opts.unit);\r\n }\r\n this.resetView();\r\n this.rebuildAll();\r\n }\r\n};\r\n\r\nMiew.prototype.info = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return {};\r\n }\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n return {\r\n id: metadata.id || complex.name || 'UNKNOWN',\r\n title: (metadata.title && metadata.title.join(' ')) || 'UNKNOWN DATA',\r\n atoms: complex.getAtomCount(),\r\n bonds: complex.getBondCount(),\r\n residues: complex.getResidueCount(),\r\n chains: complex.getChainCount(),\r\n };\r\n};\r\n\r\n/*\r\n * OBJECTS SEGMENT\r\n */\r\n\r\nMiew.prototype.addObject = function (objData, bThrow) {\r\n let Ctor = null;\r\n\r\n if (objData.type === LinesObject.prototype.type) {\r\n Ctor = LinesObject;\r\n }\r\n\r\n if (Ctor === null) {\r\n throw new Error(`Unknown scene object type - ${objData.type}`);\r\n }\r\n\r\n try {\r\n const newObj = new Ctor(objData.params, objData.opts);\r\n this._addSceneObject(newObj);\r\n } catch (error) {\r\n if (!bThrow) {\r\n this.logger.debug(`Error during scene object creation: ${error.message}`);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._addSceneObject = function (sceneObject) {\r\n const visual = this._getComplexVisual();\r\n if (sceneObject.build && visual) {\r\n sceneObject.build(visual.getComplex());\r\n this._gfx.pivot.add(sceneObject.getGeometry());\r\n }\r\n const objects = this._objects;\r\n objects[objects.length] = sceneObject;\r\n};\r\n\r\nMiew.prototype._updateObjsToFrame = function (frameData) {\r\n const objs = this._objects;\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n if (objs[i].updateToFrame) {\r\n objs[i].updateToFrame(frameData);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._resetObjects = function () {\r\n const objs = this._opts._objects;\r\n\r\n this._objects = [];\r\n if (objs) {\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n this.addObject(objs[i], false);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype.removeObject = function (index) {\r\n const obj = this._objects[index];\r\n if (!obj) {\r\n throw new Error(`Scene object with index ${index} does not exist`);\r\n }\r\n obj.destroy();\r\n this._objects.splice(index, 1);\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Get a string with a URL to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {string} URL\r\n */\r\nMiew.prototype.getURL = function (opts) {\r\n return options.toURL(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n })));\r\n};\r\n\r\n/**\r\n * Get a string with a script to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=true] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=true] - when this flag is true, a view information is included\r\n * @returns {string} script\r\n */\r\nMiew.prototype.getScript = function (opts) {\r\n return options.toScript(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: true,\r\n view: true,\r\n })));\r\n};\r\n\r\n/*\r\n * Generates object that represents the current state of representations list\r\n * @param {boolean} compareWithDefaults - when this flag is true, reps list is compared (if possible)\r\n * to preset's defaults and only diffs are generated\r\n */\r\nMiew.prototype._compareReps = function (complexVisual, compareWithDefaults) {\r\n const ans = {};\r\n let repCount = 0;\r\n\r\n if (complexVisual) {\r\n repCount = complexVisual.repCount();\r\n }\r\n\r\n const currPreset = settings.defaults.presets[settings.now.preset];\r\n let compare = compareWithDefaults;\r\n if (currPreset === undefined || currPreset.length > repCount) {\r\n compare = false;\r\n ans.preset = 'empty';\r\n } else if (settings.now.preset !== settings.defaults.preset) {\r\n ans.preset = settings.now.preset;\r\n }\r\n\r\n const repsDiff = [];\r\n let emptyReps = true;\r\n for (let i = 0, n = repCount; i < n; ++i) {\r\n repsDiff[i] = complexVisual.repGet(i).compare(compare ? currPreset[i] : null);\r\n if (!_.isEmpty(repsDiff[i])) {\r\n emptyReps = false;\r\n }\r\n }\r\n if (!emptyReps) {\r\n ans.reps = repsDiff;\r\n }\r\n return ans;\r\n};\r\n\r\n/*\r\n * Obtain object that represents current state of miew (might be used as options in constructor).\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {Object} State object.\r\n */\r\nMiew.prototype.getState = function (opts) {\r\n const state = {};\r\n\r\n opts = _.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n });\r\n\r\n // load\r\n const visual = this._getComplexVisual();\r\n if (visual !== null) {\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n if (metadata.id) {\r\n const format = metadata.format ? `${metadata.format}:` : '';\r\n state.load = format + metadata.id;\r\n }\r\n const unit = complex.getCurrentUnit();\r\n if (unit !== 1) {\r\n state.unit = unit;\r\n }\r\n }\r\n\r\n // representations\r\n const repsInfo = this._compareReps(visual, opts.compact);\r\n if (repsInfo.preset) {\r\n state.preset = repsInfo.preset;\r\n }\r\n\r\n if (repsInfo.reps) {\r\n state.reps = repsInfo.reps;\r\n }\r\n\r\n // objects\r\n const objects = this._objects;\r\n const objectsState = [];\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n objectsState[i] = objects[i].identify();\r\n }\r\n if (objects.length > 0) {\r\n state._objects = objectsState;\r\n }\r\n\r\n // view\r\n if (opts.view) {\r\n state.view = this.view();\r\n }\r\n\r\n // settings\r\n if (opts.settings) {\r\n const diff = this.settings.getDiffs(false);\r\n if (!_.isEmpty(diff)) {\r\n state.settings = diff;\r\n }\r\n }\r\n\r\n return state;\r\n};\r\n\r\n/**\r\n * Get parameter value.\r\n * @param {string} param - Parameter name or path (e.g. 'modes.BS.atom').\r\n * @param {*=} value - Default value.\r\n * @returns {*} Parameter value.\r\n */\r\nMiew.prototype.get = function (param, value) {\r\n return settings.get(param, value);\r\n};\r\n\r\nMiew.prototype._clipPlaneUpdateValue = function (radius) {\r\n const clipPlaneValue = Math.max(\r\n this._gfx.camera.position.z - radius * settings.now.draft.clipPlaneFactor,\r\n settings.now.camNear,\r\n );\r\n\r\n const opts = { clipPlaneValue };\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions(opts);\r\n });\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setUberOptions(opts);\r\n }\r\n }\r\n if (this._picker !== null) {\r\n this._picker.clipPlaneValue = clipPlaneValue;\r\n }\r\n};\r\n\r\nMiew.prototype._fogFarUpdateValue = function () {\r\n if (this._picker !== null) {\r\n if (this._gfx.scene.fog) {\r\n this._picker.fogFarValue = this._gfx.scene.fog.far;\r\n } else {\r\n this._picker.fogFarValue = undefined;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._updateShadowmapMeshes = function (process) {\r\n this._forEachComplexVisual((visual) => {\r\n const reprList = visual._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n process(repr.geo, repr.material);\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._updateMaterials = function (values, needTraverse = false, process = undefined) {\r\n this._forEachComplexVisual((visual) => visual.setMaterialValues(values, needTraverse, process));\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setValues(values);\r\n obj._line.material.needsUpdate = true;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._fogAlphaChanged = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions({\r\n fogAlpha: settings.now.fogAlpha,\r\n });\r\n });\r\n};\r\n\r\nMiew.prototype._embedWebXR = function () {\r\n // switch off\r\n if (settings.now.stereo !== 'WEBVR') {\r\n if (this.webVR) {\r\n this.webVR.disable();\r\n }\r\n this.webVR = null;\r\n return;\r\n }\r\n // switch on\r\n if (!this.webVR) {\r\n this.webVR = new WebVRPoC(() => {\r\n this._requestAnimationFrame(() => this._onTick());\r\n this._needRender = true;\r\n this._onResize();\r\n });\r\n }\r\n this.webVR.enable(this._gfx);\r\n};\r\n\r\nMiew.prototype._initOnSettingsChanged = function () {\r\n const on = (props, func) => {\r\n props = _.isArray(props) ? props : [props];\r\n props.forEach((prop) => {\r\n this.settings.addEventListener(`change:${prop}`, func);\r\n });\r\n };\r\n\r\n on('modes.VD.frame', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.showFrame(settings.now.modes.VD.frame);\r\n this._needRender = true;\r\n });\r\n\r\n on('modes.VD.isoMode', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n });\r\n\r\n on('bg.color', () => {\r\n this._onBgColorChanged();\r\n });\r\n\r\n on('ao', () => {\r\n if (settings.now.ao && !isAOSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support ao');\r\n settings.set('ao', false);\r\n } else {\r\n const values = { normalsToGBuffer: settings.now.ao };\r\n this._setUberMaterialValues(values);\r\n }\r\n });\r\n\r\n on('zSprites', () => {\r\n if (settings.now.zSprites && !arezSpritesSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support zSprites');\r\n settings.set('zSprites', false);\r\n }\r\n this.rebuildAll();\r\n });\r\n\r\n on('fogColor', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('fogColorEnable', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('bg.transparent', (evt) => {\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n // update materials\r\n this._updateMaterials({ fogTransparent: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('draft.clipPlane', (evt) => {\r\n // update materials\r\n this._updateMaterials({ clipPlane: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('shadow.on', (evt) => {\r\n // update materials\r\n const values = { shadowmap: evt.value, shadowmapType: settings.now.shadow.type };\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.shadowMap.enabled = Boolean(values.shadowmap);\r\n }\r\n this._updateMaterials(values, true);\r\n if (values.shadowmap) {\r\n this._updateShadowCamera();\r\n this._updateShadowmapMeshes(meshutils.createShadowmapMaterial);\r\n } else {\r\n this._updateShadowmapMeshes(meshutils.removeShadowmapMaterial);\r\n }\r\n this._needRender = true;\r\n });\r\n\r\n on('shadow.type', (evt) => {\r\n // update materials if shadowmap is enable\r\n if (settings.now.shadow.on) {\r\n this._updateMaterials({ shadowmapType: evt.value }, true);\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on('shadow.radius', (evt) => {\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].shadow !== undefined) {\r\n const light = this._gfx.scene.children[i];\r\n light.shadow.radius = evt.value;\r\n this._needRender = true;\r\n }\r\n }\r\n });\r\n\r\n on('fps', () => {\r\n this._fps.show(settings.now.fps);\r\n });\r\n\r\n on(['fog', 'fogNearFactor', 'fogFarFactor'], () => {\r\n this._updateFog();\r\n this._needRender = true;\r\n });\r\n\r\n on('fogAlpha', () => {\r\n const { fogAlpha } = settings.now;\r\n if (fogAlpha < 0 || fogAlpha > 1) {\r\n this.logger.warn('fogAlpha must belong range [0,1]');\r\n }\r\n this._fogAlphaChanged();\r\n this._needRender = true;\r\n });\r\n\r\n on('autoResolution', (evt) => {\r\n if (evt.value && !this._gfxScore) {\r\n this.logger.warn('Benchmarks are missed, autoresolution will not work! '\r\n + 'Autoresolution should be set during miew startup.');\r\n }\r\n });\r\n\r\n on('stereo', () => {\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n this._needRender = true;\r\n });\r\n\r\n on(['transparency', 'palette'], () => {\r\n this.rebuildAll();\r\n });\r\n\r\n on('resolution', () => {\r\n // update complex visuals\r\n this.rebuildAll();\r\n\r\n // update volume visual\r\n const volume = this._getVolumeVisual();\r\n if (volume) {\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on(['axes', 'fxaa', 'ao',\r\n 'outline.on', 'outline.color', 'outline.threshold', 'outline.thickness'], () => {\r\n this._needRender = true;\r\n });\r\n};\r\n\r\n/**\r\n * Set parameter value.\r\n * @param {string|object} params - Parameter name or path (e.g. 'modes.BS.atom') or even settings object.\r\n * @param {*=} value - Value.\r\n */\r\nMiew.prototype.set = function (params, value) {\r\n settings.set(params, value);\r\n};\r\n\r\n/**\r\n * Select atoms with selection string.\r\n * @param {string} expression - string expression of selection\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\nMiew.prototype.select = function (expression, append) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n let sel = expression;\r\n if (_.isString(expression)) {\r\n sel = selectors.parse(expression).selector;\r\n }\r\n\r\n visual.select(sel, append);\r\n this._lastPick = null;\r\n\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n};\r\n\r\nconst VIEW_VERSION = '1';\r\n\r\n/**\r\n * Get or set view info packed into string.\r\n *\r\n * **Note:** view is stored for *left-handed* cs, euler angles are stored in radians and *ZXY-order*,\r\n *\r\n * @param {string=} expression - Optional string encoded the view\r\n */\r\nMiew.prototype.view = function (expression) {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n let transform = [];\r\n const eulerOrder = 'ZXY';\r\n\r\n function encode() {\r\n const pos = pivot.position;\r\n const scale = self._objectControls.getScale() / settings.now.radiusToFit;\r\n const euler = new THREE.Euler();\r\n euler.setFromQuaternion(self._objectControls.getOrientation(), eulerOrder);\r\n transform = [\r\n pos.x, pos.y, pos.z,\r\n scale,\r\n euler.x, euler.y, euler.z,\r\n ];\r\n return VIEW_VERSION + utils.arrayToBase64(transform, Float32Array);\r\n }\r\n\r\n function decode() {\r\n // backwards compatible: old non-versioned view is the 0th version\r\n if (expression.length === 40) {\r\n expression = `0${expression}`;\r\n }\r\n\r\n const version = expression[0];\r\n transform = utils.arrayFromBase64(expression.substr(1), Float32Array);\r\n\r\n // apply adapter for old versions\r\n if (version !== VIEW_VERSION) {\r\n if (version === '0') {\r\n // cancel radiusToFit included in old views\r\n transform[3] /= 8.0;\r\n } else {\r\n // do nothing\r\n self.logger.warn(`Encoded view version mismatch, stored as ${version} vs ${VIEW_VERSION} expected`);\r\n return;\r\n }\r\n }\r\n\r\n const interpolator = self._interpolator;\r\n const srcView = interpolator.createView();\r\n srcView.position.copy(pivot.position);\r\n srcView.scale = self._objectControls.getScale();\r\n srcView.orientation.copy(self._objectControls.getOrientation());\r\n\r\n const dstView = interpolator.createView();\r\n dstView.position.set(transform[0], transform[1], transform[2]);\r\n\r\n // hack to make preset views work after we moved centering offset to visual nodes\r\n // FIXME should only store main pivot offset in preset\r\n if (self._getComplexVisual()) {\r\n dstView.position.sub(self._getComplexVisual().position);\r\n }\r\n\r\n dstView.scale = transform[3]; // eslint-disable-line prefer-destructuring\r\n dstView.orientation.setFromEuler(new THREE.Euler(transform[4], transform[5], transform[6], eulerOrder));\r\n\r\n interpolator.setup(srcView, dstView);\r\n }\r\n\r\n if (typeof expression === 'undefined') {\r\n return encode();\r\n }\r\n decode();\r\n\r\n return expression;\r\n};\r\n\r\n/*\r\n * Update current view due to viewinterpolator state\r\n */\r\nMiew.prototype._updateView = function () {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n\r\n const interpolator = this._interpolator;\r\n if (!interpolator.wasStarted()) {\r\n interpolator.start();\r\n }\r\n\r\n if (!interpolator.isMoving()) {\r\n return;\r\n }\r\n\r\n const res = interpolator.getCurrentView();\r\n if (res.success) {\r\n const curr = res.view;\r\n pivot.position.copy(curr.position);\r\n self._objectControls.setScale(curr.scale * settings.now.radiusToFit);\r\n self._objectControls.setOrientation(curr.orientation);\r\n this.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n }\r\n};\r\n\r\n/**\r\n * Translate object by vector\r\n * @param {number} x - translation value (Ang) along model's X axis\r\n * @param {number} y - translation value (Ang) along model's Y axis\r\n * @param {number} z - translation value (Ang) along model's Z axis\r\n */\r\nMiew.prototype.translate = function (x, y, z) {\r\n this._objectControls.translatePivot(x, y, z);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Rotate object by Euler angles\r\n * @param {number} x - rotation angle around X axis in radians\r\n * @param {number} y - rotation angle around Y axis in radians\r\n * @param {number} z - rotation angle around Z axis in radians\r\n */\r\nMiew.prototype.rotate = function (x, y, z) {\r\n this._objectControls.rotate(new THREE.Quaternion().setFromEuler(new THREE.Euler(x, y, z, 'XYZ')));\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Scale object by factor\r\n * @param {number} factor - scale multiplier, should greater than zero\r\n */\r\nMiew.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n throw new RangeError('Scale should be greater than zero');\r\n }\r\n this._objectControls.scale(factor);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Center view on selection\r\n * @param {empty | subset | string} selector - defines part of molecule which must be centered (\r\n * empty - center on current selection;\r\n * subset - center on picked atom/residue/molecule;\r\n * string - center on atoms correspond to selection string)\r\n */\r\nMiew.prototype.center = function (selector) {\r\n // no arguments - center on current selection;\r\n if (selector === undefined) {\r\n this.setPivotSubset();\r\n this._needRender = true;\r\n return;\r\n }\r\n // subset with atom or residue - center on picked atom/residue;\r\n if (selector.obj !== undefined && ('atom' in selector.obj || 'residue' in selector.obj)) { // from event with selection\r\n if ('atom' in selector.obj) {\r\n this.setPivotAtom(selector.obj.atom);\r\n } else {\r\n this.setPivotResidue(selector.obj.residue);\r\n }\r\n this._needRender = true;\r\n return;\r\n }\r\n // string - center on atoms correspond to selection string\r\n if (selector.obj === undefined && selector !== '') {\r\n const sel = selectors.parse(selector);\r\n if (sel.error === undefined) {\r\n this.setPivotSubset(sel);\r\n this._needRender = true;\r\n return;\r\n }\r\n }\r\n // empty subset or incorrect/empty string - center on all molecule;\r\n this.resetPivot();\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\nMiew.prototype.within = function (selector, radius) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return selectors.None();\r\n }\r\n\r\n if (selector instanceof String) {\r\n selector = selectors.parse(selector);\r\n }\r\n\r\n const res = visual.within(selector, radius);\r\n if (res) {\r\n visual.rebuildSelectionGeometry();\r\n this._needRender = true;\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Get atom position in 2D canvas coords\r\n * @param {string} fullAtomName - full atom name, like A.38.CG\r\n * @returns {Object} {x, y} or false if atom not found\r\n */\r\nMiew.prototype.projected = function (fullAtomName, complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return false;\r\n }\r\n\r\n const atom = visual.getComplex().getAtomByFullname(fullAtomName);\r\n if (atom === null) {\r\n return false;\r\n }\r\n\r\n const pos = atom.position.clone();\r\n // we consider atom position to be affected only by common complex transform\r\n // ignoring any transformations that may add during editing\r\n this._gfx.pivot.updateMatrixWorldRecursive();\r\n this._gfx.camera.updateMatrixWorldRecursive();\r\n this._gfx.pivot.localToWorld(pos);\r\n pos.project(this._gfx.camera);\r\n\r\n return {\r\n x: (pos.x + 1.0) * 0.5 * this._gfx.width,\r\n y: (1.0 - pos.y) * 0.5 * this._gfx.height,\r\n };\r\n};\r\n\r\n/**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n *\r\n * @param {string=} complexName - complex name\r\n */\r\nMiew.prototype.dssp = function (complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return;\r\n }\r\n visual.getComplex().dssp();\r\n\r\n // rebuild dependent representations (cartoon or ss-colored)\r\n visual._reprList.forEach((rep) => {\r\n if (rep.mode.id === 'CA' || rep.colorer.id === 'SS') {\r\n rep.needsRebuild = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype.exportCML = function () {\r\n const self = this;\r\n\r\n function extractRotation(m) {\r\n const xAxis = new THREE.Vector3();\r\n const yAxis = new THREE.Vector3();\r\n const zAxis = new THREE.Vector3();\r\n m.extractBasis(xAxis, yAxis, zAxis);\r\n xAxis.normalize();\r\n yAxis.normalize();\r\n zAxis.normalize();\r\n const retMat = new THREE.Matrix4();\r\n retMat.identity();\r\n retMat.makeBasis(xAxis, yAxis, zAxis);\r\n return retMat;\r\n }\r\n\r\n function updateCMLData(complex) {\r\n const { root } = self._gfx;\r\n const mat = extractRotation(root.matrixWorld);\r\n const v4 = new THREE.Vector4(0, 0, 0, 0);\r\n const vCenter = new THREE.Vector4(0, 0, 0, 0);\r\n let xml = null;\r\n let ap = null;\r\n\r\n // update atoms in cml\r\n complex.forEachAtom((atom) => {\r\n if (atom.xmlNodeRef && atom.xmlNodeRef.xmlNode) {\r\n xml = atom.xmlNodeRef.xmlNode;\r\n ap = atom.position;\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n v4.applyMatrix4(mat);\r\n xml.setAttribute('x3', v4.x.toString());\r\n xml.setAttribute('y3', v4.y.toString());\r\n xml.setAttribute('z3', v4.z.toString());\r\n xml.removeAttribute('x2');\r\n xml.removeAttribute('y2');\r\n }\r\n });\r\n // update stereo groups in cml\r\n complex.forEachSGroup((sGroup) => {\r\n if (sGroup.xmlNodeRef && sGroup.xmlNodeRef.xmlNode) {\r\n xml = sGroup.xmlNodeRef.xmlNode;\r\n ap = sGroup.getPosition();\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n const cp = sGroup.getCentralPoint();\r\n if (cp === null) {\r\n v4.applyMatrix4(mat);\r\n } else {\r\n vCenter.set(cp.x, cp.y, cp.z, 0.0);\r\n v4.add(vCenter);\r\n v4.applyMatrix4(mat); // pos in global space\r\n vCenter.set(cp.x, cp.y, cp.z, 1.0);\r\n vCenter.applyMatrix4(mat);\r\n v4.sub(vCenter);\r\n }\r\n xml.setAttribute('x', v4.x.toString());\r\n xml.setAttribute('y', v4.y.toString());\r\n xml.setAttribute('z', v4.z.toString());\r\n }\r\n });\r\n }\r\n\r\n const visual = self._getComplexVisual();\r\n const complex = visual ? visual.getComplex() : null;\r\n if (complex && complex.originalCML) {\r\n updateCMLData(complex);\r\n\r\n // serialize xml structure to string\r\n const oSerializer = new XMLSerializer();\r\n return oSerializer.serializeToString(complex.originalCML);\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Reproduce the RCSB PDB Molecule of the Month style by David S. Goodsell\r\n *\r\n * @see http://pdb101.rcsb.org/motm/motm-about\r\n */\r\nMiew.prototype.motm = function () {\r\n settings.set({\r\n fogColorEnable: true,\r\n fogColor: 0x000000,\r\n outline: { on: true, threshold: 0.01 },\r\n bg: { color: 0xffffff },\r\n });\r\n\r\n this._forEachComplexVisual((visual) => {\r\n const rep = [];\r\n const complex = visual.getComplex();\r\n const palette = palettes.get(settings.now.palette);\r\n for (let i = 0; i < complex.getChainCount(); i++) {\r\n const curChainName = complex._chains[i]._name;\r\n const curChainColor = palette.getChainColor(curChainName);\r\n rep[i] = {\r\n selector: `chain ${curChainName}`,\r\n mode: 'VW',\r\n colorer: ['CB', { color: curChainColor, factor: 0.9 }],\r\n material: 'FL',\r\n };\r\n }\r\n visual.resetReps(rep);\r\n });\r\n};\r\n\r\nMiew.prototype.VERSION = (typeof PACKAGE_VERSION !== 'undefined' && PACKAGE_VERSION) || '0.0.0-dev';\r\n\r\n// Uncomment this to get debug trace:\r\n// Miew.prototype.debugTracer = new utils.DebugTracer(Miew.prototype);\r\n\r\n_.assign(Miew, /** @lends Miew */ {\r\n VERSION: Miew.prototype.VERSION,\r\n\r\n registeredPlugins: [],\r\n\r\n // export namespaces // TODO: WIP: refactoring external interface\r\n chem,\r\n io,\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n utils,\r\n gfx: {\r\n Representation,\r\n },\r\n\r\n /**\r\n * Third-party libraries packaged together with Miew.\r\n *\r\n * @property {object} lodash - [Lodash](https://lodash.com/), a modern JavaScript utility library delivering\r\n * modularity, performance & extras.\r\n * @property {object} three - [three.js](https://threejs.org/), JavaScript 3D library.\r\n *\r\n * @example\r\n * var _ = Miew.thirdParty.lodash;\r\n * var opts = _.merge({ ... }, Miew.options.fromURL(window.location.search));\r\n * var miew = new Miew(opts);\r\n */\r\n thirdParty: {\r\n lodash: _,\r\n three: THREE,\r\n },\r\n});\r\n\r\nexport default Miew;\r\n","import palettes from '../gfx/palettes';\r\nimport settings from '../settings';\r\n\r\nconst modeIdDesc = {\r\n $help: [\r\n 'Rendering mode shortcut',\r\n ' BS - balls and sticks mode',\r\n ' LN - lines mode',\r\n ' LC - licorice mode',\r\n ' VW - van der waals mode',\r\n ' TR - trace mode',\r\n ' TU - tube mode',\r\n ' CA - cartoon mode',\r\n ' SA - isosurface mode',\r\n ' QS - quick surface mode',\r\n ' SE - solvent excluded mode',\r\n ' TX - text mode',\r\n ],\r\n BS: {\r\n $help: [\r\n ' Balls and sticks',\r\n ' aromrad = #aromatic radius',\r\n ' atom = #atom radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n CA: {\r\n $help: [\r\n ' Cartoon',\r\n ' arrow = #arrow size',\r\n ' depth = #depth of surface',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = #',\r\n ' width = #secondary width\\n',\r\n ],\r\n },\r\n LN: {\r\n $help: [\r\n ' Lines',\r\n ' atom = #atom radius',\r\n ' chunkarom = ',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' offsarom = \\n',\r\n ],\r\n },\r\n LC: {\r\n $help: [\r\n ' Licorice',\r\n ' aromrad = #aromatic radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n VW: {\r\n $help: [\r\n ' Van der Waals',\r\n ' nothing\\n',\r\n ],\r\n },\r\n TR: {\r\n $help: [\r\n ' Trace',\r\n ' radius = #tube radius\\n',\r\n ],\r\n },\r\n TU: {\r\n $help: [\r\n ' Tube',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = \\n',\r\n ],\r\n },\r\n SA: {\r\n $help: [\r\n ' Surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n QS: {\r\n $help: [\r\n ' Quick surface',\r\n ' isoValue = ',\r\n ' scale = ',\r\n ' wireframe = ',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n SE: {\r\n $help: [\r\n ' Solvent excluded surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n TX: {\r\n $help: [\r\n ' Text mode',\r\n ' template = string that can include \"{{ id }}\"',\r\n ' it will be replaced by value, id can be one of next:',\r\n ' serial, name, type, sequence, residue, chain, hetatm, water\\n',\r\n ' horizontalAlign = {\"left\", \"right\", \"center\"}',\r\n ' verticalAlign = {\"top\", \"bottom\", \"middle\"}',\r\n ' dx = #offset along x',\r\n ' dy = #offset along y',\r\n ' dz = #offset along z',\r\n ' fg = #text color modificator',\r\n ' could be keyword, named color or hex',\r\n ' fg = #back color modificator',\r\n ' could be keyword, named color or hex',\r\n ' showBg = #if set show background',\r\n ' plate under text',\r\n ],\r\n },\r\n};\r\n\r\nconst colorDesc = {\r\n $help: [\r\n 'Coloring mode shortcut',\r\n ' EL - color by element',\r\n ' CH - color by chain',\r\n ' SQ - color by sequence',\r\n ' RT - color by residue type',\r\n ' SS - color by secondary structure',\r\n ' UN - uniform',\r\n ],\r\n UN: {\r\n $help: [\r\n 'Parameters of coloring modes customization',\r\n ' Uniform',\r\n ' color = #RGB->HEX->dec\\n',\r\n ],\r\n color: {\r\n $help: Object.keys(palettes.get(settings.now.palette).namedColors).sort().join('\\n'),\r\n },\r\n },\r\n};\r\n\r\nconst materialDesc = {\r\n $help: [\r\n 'Material shortcut',\r\n ' DF - diffuse',\r\n ' TR - transparent',\r\n ' SF - soft plastic',\r\n ' PL - glossy plastic',\r\n ' ME - metal',\r\n ' GL - glass',\r\n ],\r\n};\r\n\r\nconst addRepDesc = {\r\n $help: [\r\n 'Short (packed) representation description as a set of variables',\r\n ' s=',\r\n ' selector property',\r\n ' m=[!:[,...]]',\r\n ' render mode property',\r\n ' c=[!:[,...]]',\r\n ' color mode property',\r\n ' mt=',\r\n ' material property',\r\n ],\r\n s: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n m: modeIdDesc,\r\n c: colorDesc,\r\n mt: materialDesc,\r\n};\r\n\r\nconst setGetParameterDesc = {\r\n $help: [\r\n 'Parameters of rendering modes customization: modes',\r\n 'Parameters of colorer customization: colorers',\r\n 'Autobuild: autobuild = (|)',\r\n ],\r\n modes: modeIdDesc,\r\n colorers: colorDesc,\r\n};\r\n\r\nconst help = {\r\n $help: [\r\n 'help (| )',\r\n 'You can get detailed information about command options',\r\n ' using \"help cmd.opt.opt.[...]\"\\n',\r\n ' you can use one line comments',\r\n ' everything started from (#|//) will be skipped',\r\n ' Example: >build //some comment\\n',\r\n 'List of available commands:',\r\n ],\r\n reset: {\r\n $help: [\r\n 'Reload current object, delete all representations',\r\n ' Nothing will work until load new object',\r\n ],\r\n },\r\n load: {\r\n $help: [\r\n 'load (||-f [<*.NC FILE URL STRING>])',\r\n ' Load new pdb object from selected source',\r\n ],\r\n PDBID: {\r\n $help: 'pdb id in remote molecule database',\r\n },\r\n URL: {\r\n $help: 'url to source file',\r\n },\r\n f: {\r\n $help: [\r\n 'open file system dialog to fetch local file',\r\n 'optionally you can determine trajectory file',\r\n 'via URL for *.top model',\r\n ],\r\n },\r\n },\r\n clear: {\r\n $help: 'No args. Clear terminal',\r\n },\r\n add: {\r\n $help: [\r\n 'add [] []',\r\n ' Add new item to representation set with',\r\n ' default or params',\r\n ],\r\n REP_NAME: {\r\n $help: 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n rep: {\r\n $help: [\r\n 'rep [|] []',\r\n ' set current representation by name or index',\r\n ' edit current representation by ',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n remove: {\r\n $help: [\r\n 'remove (|)',\r\n 'Remove representation by name or index',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n },\r\n selector: {\r\n $help: [\r\n 'selector ',\r\n ' set selector from EXPRESSION to current representation',\r\n ],\r\n EXPRESSION: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n },\r\n mode: {\r\n $help: [\r\n 'mode [=...]',\r\n ' set rendering mode and apply parameters to current representation',\r\n ],\r\n MODE_ID: modeIdDesc,\r\n },\r\n color: {\r\n $help: [\r\n 'color [=...]',\r\n ' set colorer and apply parameters to current representation',\r\n ],\r\n COLORER_ID: colorDesc,\r\n },\r\n material: {\r\n $help: [\r\n 'material ',\r\n ' set material to current representation',\r\n ],\r\n MATERIAL_ID: materialDesc,\r\n },\r\n build: {\r\n $help: 'build help str',\r\n add: {\r\n $help: 'build.add',\r\n new: {\r\n $help: [\r\n 'add.new',\r\n 'add.new new line 1',\r\n 'add.new new line 2',\r\n 'add.new new line 3',\r\n ],\r\n },\r\n },\r\n del: {\r\n $help: 'build.del',\r\n },\r\n },\r\n list: {\r\n $help: [\r\n 'list [-e|-s||]',\r\n 'Print representations if no args print list of representations',\r\n ' -e expand list and show all representations',\r\n ' -s show all user-registered selectors',\r\n ' | show only current representation',\r\n ],\r\n },\r\n hide: {\r\n $help: [\r\n 'hide (|)',\r\n 'Hide representation referenced in args',\r\n ],\r\n },\r\n show: {\r\n $help: [\r\n 'show (|)',\r\n 'Show representation referenced in args',\r\n ],\r\n },\r\n get: {\r\n $help: [\r\n 'get ',\r\n 'Print value',\r\n ' - path to option use get.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set: {\r\n $help: [\r\n 'set ',\r\n 'Set with ',\r\n ' - path to option use set.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set_save: {\r\n $help: [\r\n 'set_save',\r\n 'Save current settings to cookie',\r\n ],\r\n },\r\n set_restore: {\r\n $help: [\r\n 'set_restore',\r\n 'Load and apply settings from cookie',\r\n ],\r\n },\r\n set_reset: {\r\n $help: [\r\n 'set_reset',\r\n 'Reset current settings to the defaults',\r\n ],\r\n },\r\n preset: {\r\n $help: [\r\n 'preset []',\r\n 'Reset current representation or set preset to ',\r\n ],\r\n PRESET: {\r\n $help: [\r\n 'default',\r\n 'wire',\r\n 'small',\r\n 'macro',\r\n ],\r\n },\r\n },\r\n unit: {\r\n $help: [\r\n 'unit []',\r\n 'Change current biological structure view. Zero value means asymmetric unit,',\r\n 'positive values set an assembly with corresponding number.',\r\n 'Being called with no parameters command prints current unit information.',\r\n ],\r\n },\r\n view: {\r\n $help: [\r\n 'view []',\r\n 'Get current encoded view or set if ENCODED_VIEW placed as argument',\r\n ],\r\n ENCODED_VIEW: {\r\n $help: [\r\n 'encoded view matrix string (binary code)',\r\n ],\r\n },\r\n },\r\n rotate: {\r\n $help: [\r\n 'rotate (x|y|z) [] [(x|y|z) []]...',\r\n 'Rotate scene',\r\n ],\r\n },\r\n scale: {\r\n $help: [\r\n 'scale ',\r\n 'Scale scene',\r\n ],\r\n },\r\n select: {\r\n $help: [\r\n 'select [as ]',\r\n 'Select atoms using selector defined in SELECTOR_STRING',\r\n ' and if SELECTOR_NAME is defined register it in viewer',\r\n ' you can use it later as a complex selector',\r\n ],\r\n },\r\n within: {\r\n $help: [\r\n 'within of as ',\r\n 'Build within named selector',\r\n ' DISTANCE ',\r\n ' SELECTOR_STRING ',\r\n ' SELECTOR_NAME ',\r\n ],\r\n },\r\n url: {\r\n $help: [\r\n 'url [-s] [-v]',\r\n 'Report URL encoded scene',\r\n ' if -s set that include settings in the URL',\r\n ' if -v set that include view in the URL',\r\n ],\r\n },\r\n screenshot: {\r\n $help: [\r\n 'screenshot [ []]',\r\n 'Make a screenshot of the scene',\r\n ' WIDTH in pixels',\r\n ' HEIGHT in pixels, equal to WIDTH by default',\r\n ],\r\n },\r\n line: {\r\n $help: [\r\n 'line [=]',\r\n 'Draw dashed line between two specified atoms',\r\n ],\r\n },\r\n removeobj: {\r\n $help: [\r\n 'removeobj ',\r\n 'Remove scene object by its index. Indices could be obtained by command',\r\n ],\r\n },\r\n listobj: {\r\n $help: [\r\n 'listobj',\r\n 'Display the list of all existing scene objects',\r\n ],\r\n },\r\n};\r\n\r\nexport default help;\r\n","import _ from 'lodash';\r\nimport Miew from './Miew';\r\nimport { parser as parsercli } from './utils/MiewCLIParser';\r\nimport clihelp from './utils/MiewCLIHelp';\r\nimport logger from './utils/logger';\r\nimport utils from './utils';\r\n\r\nconst {\r\n chem: { selectors },\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n} = Miew;\r\n\r\nfunction None() {\r\n}\r\n\r\nconst NULL = (function () {\r\n const obj = new None();\r\n return function () {\r\n return obj;\r\n };\r\n}());\r\n\r\nclass RepresentationMap {\r\n constructor() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n\r\n get(strId) {\r\n return this.representationMap[strId] || this.representationID[strId] || '';\r\n }\r\n\r\n add(strId, index) {\r\n if (strId === -1) {\r\n return 'Can not create representation: there is no data';\r\n }\r\n\r\n if (index !== undefined) {\r\n if (!this.representationMap.hasOwnProperty(strId)) {\r\n this.representationMap[strId.toString()] = index;\r\n this.representationID[index] = strId.toString();\r\n } else {\r\n return 'This name has already existed, registered without name';\r\n }\r\n }\r\n return `Representation ${strId} successfully added`;\r\n }\r\n\r\n remove(index) {\r\n if (index && this.representationID.hasOwnProperty(index)) {\r\n delete this.representationMap[this.representationID[index]];\r\n delete this.representationID[index];\r\n }\r\n\r\n const sortedKeys = Object.keys(this.representationID).sort();\r\n for (const i in sortedKeys) {\r\n if (sortedKeys.hasOwnProperty(i)) {\r\n const id = sortedKeys[i];\r\n if (id > index) {\r\n this.representationID[id - 1] = this.representationID[id];\r\n this.representationMap[this.representationID[id]] -= 1;\r\n delete this.representationID[id];\r\n }\r\n }\r\n }\r\n }\r\n\r\n clear() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n}\r\n\r\nconst representationsStorage = new RepresentationMap();\r\n\r\nfunction keyRemap(key) {\r\n const keys = {\r\n s: 'selector',\r\n m: 'mode',\r\n c: 'colorer',\r\n mt: 'material',\r\n mode: 'modes',\r\n color: 'colorers',\r\n colorer: 'colorers',\r\n select: 'selector',\r\n material: 'materials',\r\n selector: 'selector',\r\n };\r\n const ans = keys[key];\r\n return ans === undefined ? key : ans;\r\n}\r\n\r\nclass CLIUtils {\r\n list(miew, repMap, key) {\r\n let ret = '';\r\n if (miew && repMap !== undefined) {\r\n if (key === undefined || key === '-e') {\r\n const count = miew.repCount();\r\n\r\n for (let i = 0; i < count; i++) {\r\n ret += this.listRep(miew, repMap, i, key);\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n\r\n listRep(miew, repMap, repIndex, key) {\r\n let ret = '';\r\n const rep = miew.repGet(repIndex);\r\n if (!rep) {\r\n logger.warn(`Rep ${repIndex} does not exist!`);\r\n return ret;\r\n }\r\n const index = repIndex;\r\n const repName = repMap.get(index);\r\n\r\n const { mode, colorer } = rep;\r\n const selectionStr = rep.selectorString;\r\n const material = rep.materialPreset;\r\n\r\n ret += `#${index} : ${mode.name}${repName === '' ? '' : `, ${repName}`}\\n`;\r\n\r\n if (key !== undefined) {\r\n ret += ` selection : \"${selectionStr}\"\\n`;\r\n ret += ` mode : (${mode.id}), ${mode.name}\\n`;\r\n ret += ` colorer : (${colorer.id}), ${colorer.name}\\n`;\r\n ret += ` material : (${material.id}), ${material.name}\\n`;\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listSelector(miew, context) {\r\n let ret = '';\r\n\r\n for (const k in context) {\r\n if (context.hasOwnProperty(k)) {\r\n ret += `${k} : \"${context[k]}\"\\n`;\r\n }\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listObjs(miew) {\r\n const objs = miew._objects;\r\n\r\n if (!objs || !Array.isArray(objs) || objs.length === 0) {\r\n return 'There are no objects on the scene';\r\n }\r\n\r\n const strList = [];\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n strList[i] = `${i}: ${objs[i].toString()}`;\r\n }\r\n\r\n return strList.join('\\n');\r\n }\r\n\r\n joinHelpStr(helpData) {\r\n if (helpData instanceof Array) {\r\n return helpData.join('\\n');\r\n }\r\n return helpData;\r\n }\r\n\r\n help(path) {\r\n if (_.isUndefined(path)) {\r\n return `${this.joinHelpStr(clihelp.$help)}\\n${_.slice(_.sortBy(_.keys(clihelp)), 1).join(', ')}\\n`;\r\n }\r\n\r\n const helpItem = _.get(clihelp, path);\r\n return _.isUndefined(helpItem) ? this.help() : `${this.joinHelpStr(helpItem.$help)}\\n`;\r\n }\r\n\r\n load(miew, arg) {\r\n if (miew === undefined || arg === undefined || arg === '-f') {\r\n return;\r\n }\r\n miew.awaitWhileCMDisInProcess();\r\n const finish = () => miew.finishAwaitingCMDInProcess();\r\n miew.load(arg).then(finish, finish);\r\n }\r\n\r\n checkArg(key, arg, modificate) {\r\n if (key !== undefined && arg !== undefined) {\r\n if (keyRemap(key) === 'selector') {\r\n const res = selectors.parse(arg);\r\n\r\n if (res.error !== undefined) {\r\n const selExc = { message: res.error };\r\n throw selExc;\r\n }\r\n\r\n if (modificate !== undefined && modificate) {\r\n return res.selector;\r\n }\r\n return arg;\r\n }\r\n\r\n const modificators = {\r\n colorers,\r\n modes,\r\n materials,\r\n };\r\n\r\n let modificator = key;\r\n let temp;\r\n while (modificator !== temp) {\r\n temp = modificator;\r\n modificator = keyRemap(temp);\r\n }\r\n\r\n if (modificators[modificator].get(arg) === undefined) {\r\n const exc = { message: `${arg} is not existed in ${modificator}` };\r\n throw exc;\r\n }\r\n return arg;\r\n }\r\n return NULL;\r\n }\r\n\r\n propagateProp(path, arg) {\r\n if (path !== undefined) {\r\n let argExc = {};\r\n const adapter = options.adapters[typeof _.get(settings.defaults, path)];\r\n if (adapter === undefined) {\r\n const pathExc = { message: `${path} is not existed` };\r\n throw pathExc;\r\n }\r\n\r\n if ((path.endsWith('.color') || path.endsWith('.baseColor')\r\n || path.endsWith('.EL.carbon')) && typeof arg !== 'number') {\r\n arg = palettes.get(settings.now.palette).getNamedColor(arg);\r\n }\r\n\r\n if (path.endsWith('.fg') || path.endsWith('.bg')) {\r\n if (typeof arg !== 'number') {\r\n const val = palettes.get(settings.now.palette).getNamedColor(arg, true);\r\n if (val !== undefined) {\r\n arg = `0x${val.toString(16)}`;\r\n }\r\n } else {\r\n arg = `0x${arg.toString(16)}`;\r\n }\r\n }\r\n\r\n if (path.endsWith('.template')) {\r\n arg = arg.replace(/\\\\n/g, '\\n');// NOSONAR\r\n }\r\n\r\n if (arg !== undefined && adapter(arg) !== arg && adapter(arg) !== (arg > 0)) {\r\n argExc = { message: `${path} must be a \"${typeof _.get(settings.defaults, path)}\"` };\r\n throw argExc;\r\n }\r\n }\r\n return arg;\r\n }\r\n\r\n unquoteString(value) {\r\n return utils.unquoteString(value);\r\n }\r\n}\r\n// repIndexOrRepMap could be RepresentationMap or index\r\n\r\nconst utilFunctions = new CLIUtils();\r\n\r\nfunction CreateObjectPair(a, b) {\r\n const obj = {};\r\n obj[a] = b;\r\n return obj;\r\n}\r\n\r\nfunction ArgList(arg) {\r\n if (arg instanceof this.constructor) {\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n}\r\n\r\nArgList.prototype.append = function (value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n};\r\n\r\nArgList.prototype.remove = function (value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n};\r\n\r\nArgList.prototype.toJSO = function (cliUtils, cmd, arg) {\r\n const res = {};\r\n\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n _.set(res, list[i].id, cliUtils.propagateProp(`${keyRemap(cmd)}.${arg}.${list[i].id}`, list[i].val));\r\n }\r\n\r\n return res;\r\n};\r\n\r\nfunction Arg(_id, _val) {\r\n this.id = _id;\r\n this.val = _val;\r\n}\r\n\r\nconst cliutils = Object.create({});\r\n\r\ncliutils.Arg = Arg;\r\ncliutils.ArgList = ArgList;\r\n\r\ncliutils.miew = null;\r\ncliutils.echo = null;\r\ncliutils.representations = representationsStorage;\r\ncliutils.utils = utilFunctions;\r\n\r\ncliutils._ = _;\r\ncliutils.CreateObjectPair = CreateObjectPair;\r\ncliutils.keyRemap = keyRemap;\r\ncliutils.Context = selectors.Context;\r\ncliutils.ClearContext = selectors.ClearContext;\r\n\r\ncliutils.NULL = NULL;\r\n\r\ncliutils.notimplemented = function () {\r\n return this.NULL;\r\n};\r\n\r\nMiew.prototype.script = function (script, _printCallback, _errorCallback) {\r\n parsercli.yy.miew = this;\r\n parsercli.yy.echo = _printCallback;\r\n parsercli.yy.error = _errorCallback;\r\n if (this.cmdQueue === undefined) {\r\n this.cmdQueue = [];\r\n }\r\n\r\n if (this.commandInAction === undefined) {\r\n this.commandInAction = false;\r\n }\r\n\r\n this.cmdQueue = this.cmdQueue.concat(script.split('\\n'));\r\n};\r\n\r\nMiew.prototype.awaitWhileCMDisInProcess = function () {\r\n this.commandInAction = true;\r\n};\r\n\r\nMiew.prototype.finishAwaitingCMDInProcess = function () {\r\n this.commandInAction = false;\r\n};\r\n\r\nMiew.prototype.isScriptingCommandAvailable = function () {\r\n return this.commandInAction !== undefined\r\n && !this.commandInAction\r\n && this.cmdQueue !== undefined\r\n && this.cmdQueue.length > 0;\r\n};\r\n\r\nMiew.prototype.callNextCmd = function () {\r\n if (this.isScriptingCommandAvailable()) {\r\n const cmd = this.cmdQueue.shift();\r\n\r\n const res = {};\r\n res.success = false;\r\n try {\r\n parsercli.parse(cmd);\r\n res.success = true;\r\n } catch (e) {\r\n res.error = e.message;\r\n parsercli.yy.error(res.error);\r\n this.finishAwaitingCMDInProcess();\r\n }\r\n return res;\r\n }\r\n return '';\r\n};\r\n\r\nparsercli.yy = cliutils;\r\n// workaround for incorrect JISON parser generator for AMD module\r\nparsercli.yy.parseError = parsercli.parseError;\r\n","import Miew from './Miew';\r\nimport './Miew-cli';\r\n\r\nexport default Miew;\r\n"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__535__","__WEBPACK_EXTERNAL_MODULE__698__","parser","o","k","v","l","length","$V0","$V1","$V2","$V3","$V4","$V5","$V6","$V7","$V8","$V9","$Va","$Vb","$Vc","$Vd","$Ve","$Vf","$Vg","$Vh","$Vi","$Vj","$Vk","$Vl","$Vm","$Vn","$Vo","$Vp","$Vq","$Vr","$Vs","$Vt","$Vu","$Vv","$Vw","$Vx","$Vy","$Vz","$VA","$VB","$VC","$VD","$VE","$VF","$VG","$VH","$VI","$VJ","$VK","$VL","$VM","$VN","$VO","$VP","$VQ","$VR","$VS","$VT","$VU","$VV","$VW","$VX","$VY","$VZ","$V_","$V$","$V01","$V11","$V21","$V31","$V41","$V51","$V61","trace","yy","symbols_","terminals_","productions_","performAction","yytext","yyleng","yylineno","yystate","$$","_$","$0","$","miew","reset","ClearContext","resetReps","rebuild","rebuildAll","echo","utils","help","toString","motm","propagateProp","get","set","saveSettings","restoreSettings","resetSettings","applyPreset","repRemove","representations","remove","repHide","listRep","list","listSelector","Context","select","checkArg","toLowerCase","rep","repCurrent","selector","within","Number","material","toUpperCase","view","changeUnit","dssp","scale","i","n","rotate","Math","PI","translate","center","addObject","type","params","opts","toJSO","listObjs","removeObject","getURL","settings","screenshotSave","load","clear","add","repAdd","mode","Array","colorer","_","assign","CreateObjectPair","key","val","Object","create","keyRemap","concat","ArgList","append","Arg","parseInt","JSON","parse","String","table","defaultActions","parseError","str","hash","recoverable","error","Error","input","self","stack","tstack","vstack","lstack","recovering","args","slice","call","arguments","lexer","sharedState","prototype","hasOwnProperty","setInput","yylloc","yyloc","push","ranges","options","getPrototypeOf","symbol","preErrorSymbol","state","action","r","p","len","newState","expected","token","yyval","pop","lex","errStr","showPosition","join","text","match","line","loc","first_line","last_line","first_column","last_column","range","apply","EOF","_input","_more","_backtrack","done","matched","conditionStack","offset","ch","unput","lines","split","substr","oldLines","more","reject","backtrack_lexer","less","pastInput","past","replace","upcomingInput","next","pre","c","test_match","indexed_rule","backup","matches","tempMatch","index","rules","_currentRules","flex","begin","condition","popState","conditions","topState","abs","pushState","stateStackSize","yy_","$avoiding_name_collisions","YY_START","unquoteString","Parser","keyword","GetSelector","RangeList","Range","ValueList","AbstractInterpolator","CubicInterpolator","Enum","LinearInterpolator","NearestInterpolator","SincFilterInterpolator","Smooth","clipClamp","clipMirror","clipPeriodic","defaultConfig","getColumn","getType","isValidNumber","makeLanczosWindow","makeScaledFunction","makeSincKernel","normalizeScaleTo","shallowCopy","sin","sinc","validateNumber","validateVector","__hasProp","__extends","child","parent","ctor","constructor","__super__","method","METHOD_NEAREST","METHOD_LINEAR","METHOD_CUBIC","METHOD_LANCZOS","METHOD_SINC","CLIP_CLAMP","CLIP_ZERO","CLIP_PERIODIC","CLIP_MIRROR","CUBIC_TENSION_DEFAULT","CUBIC_TENSION_CATMULL_ROM","cubicTension","clip","scaleTo","sincFilterSize","sincWindow","max","min","period","array","config","clipHelper","clamp","clipHelperClamp","zero","clipHelperZero","periodic","clipHelperPeriodic","mirror","clipHelperMirror","getClippedInput","interpolate","t","_super","round","floor","tangentFactor","getTangent","m","t2","t3","x","a","window","kernel","sum","_ref","_ref2","arr","row","_i","_len","_results","f","baseScale","scaleRange","scaleFactor","translation","isNaN","isFinite","dimension","s","invalidErr","obj","copy","baseDomainEnd","interpolator","interpolatorClass","interpolators","properties","smoothFunc","lanczosFilterSize","nearest","linear","cubic","lanczos","count","_j","_len2","deepValidation","_k","_len3","domain","sort","e","byteLength","charCodeAt","setUint8","u","setUint16","setUint32","Uint8Array","buffer","setFloat64","setInt8","setInt16","setInt32","isArray","d","keys","ArrayBuffer","DataView","byteOffset","Int8Array","Int32Array","Float32Array","Int16Array","g","L","h","setFloat32","getFloat32","y","U","b","I","w","C","ceil","A","M","F","S","E","N","O","T","getInt32","subarray","j","q","D","P","z","B","V","G","R","rr","forEach","bondAtomList","bondOrderList","xCoordList","yCoordList","zCoordList","bFactorList","atomIdList","altLocList","occupancyList","groupIdList","groupTypeList","secStructList","insCodeList","sequenceIndexList","chainIdList","chainNameList","H","fromCharCode","getInt8","getUint8","getUint16","getUint32","getFloat64","getInt16","W","X","ignoreFields","nr","indexOf","J","K","firstModelOnly","onModel","onChain","onGroup","onAtom","onBond","chainsPerModel","chainCount","modelIndex","groupsPerChain","groupCount","chainIndex","chainId","chainName","groupList","atomNameList","atomCount","groupIndex","groupId","groupType","groupName","singleLetterCode","chemCompType","secStruct","insCode","sequenceIndex","atomIndex","atomId","element","elementList","atomName","formalCharge","formalChargeList","xCoord","yCoord","zCoord","bFactor","altLoc","occupancy","atomIndex1","atomIndex2","bondOrder","Q","Y","Z","response","XMLHttpRequest","addEventListener","responseType","open","send","or","ar","tr","er","ir","encode","decode","traverse","fetch","fetchReduced","version","fetchUrl","fetchReducedUrl","encodeMsgpack","encodeMmtf","decodeMsgpack","decodeMmtf","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","getter","__esModule","definition","defineProperty","enumerable","prop","__assign","defaults","width","radius","corners","color","fadeColor","animation","direction","speed","zIndex","className","top","left","shadow","position","Spinner","spin","target","stop","el","document","createElement","setAttribute","style","transform","insertBefore","firstChild","borderRadius","shadows","boxShadow","regex","_a","xUnits","yUnits","prefix","end","parseBoxShadow","degrees","backgroundLine","height","background","getColor","transformOrigin","delay","normalizeShadow","appendChild","drawLines","parentNode","removeChild","idx","normalized","shadows_1","xy","convertOffset","radians","cos","Timer","startTime","oldTime","elapsedTime","running","start","now","getElapsedTime","update","delta","newTime","performance","bind","Date","tag","id","css","cssText","domElement","_text","_startTime","_prevTime","_deltas","_index","_total","_count","time","ms","fps","textContent","toPrecision","show","on","display","isUndefOrEqual","param","value","EventDispatcher","_handlers","callback","context","handlers","par","removeEventListener","handler","ev","values","dispatchEvent","event","priorities","debug","info","report","warn","Logger","console","_priority","verify","number","instantiate","level","levels","message","priority","_message","browserType","DEFAULT","SAFARI","decodeQueryComponent","decodeURIComponent","getUrlParameters","url","query","location","search","substring","result","exec","DebugTracer","namespace","enabled","enable","indent","methods","wrap","method_","name_","spaces","logger","_key","name","Function","OutOfMemoryError","super","bytesToBase64","bytes","binary","btoa","bytesFromBase64","atob","isAlmostPlainObject","proto","getFileExtension","fileName","lastIndexOf","Infinity","dataUrlToBlob","parts","partsCount","Blob","unquotedStringRE","enquoteHelper","encodeQueryComponent","excludeExp","encodeURIComponent","code","getUrlParametersAsDict","resolveURL","URL","href","anchor","generateRegExp","symbolStr","symbolList","listStr","RegExp","attrs","content","createTextNode","HTMLElement","deriveClass","cls","base","members","statics","deriveDeep","needZeroOwnProperties","res","hexColor","allocateTyped","TypedArrayName","size","RangeError","arrayFromBase64","TypedArrayClass","arrayToBase64","compareOptionsWithDefaults","defOpts","optsStr","objectsDiff","src","dst","diff","srcValue","dstValue","deepDiff","forInRecursive","object","iterateThrough","newPref","enquoteString","SyntaxError","getBrowser","navigator","vendor","userAgent","shotOpen","write","shotDownload","dataUrl","filename","msSaveBlob","link","download","innerHTML","createObjectURL","body","click","copySubArrays","indices","itemSize","shallowCloneNode","node","newNode","cloneNode","worldPos","correctSelectorIdentifier","test","splitFileName","ext","data","blobData","concatTypedArraysUnsafe","first","second","mergeTypedArraysUnsafe","reduce","acc","cur","JobHandle","_shouldCancel","cancel","shouldCancel","notify","slaveEvent","modes","BS","atom","bond","space","multibond","aromrad","showarom","polyComplexity","poor","low","medium","high","ultra","VW","LN","offsarom","chunkarom","lineWidth","LC","SA","zClip","probeRadius","subset","wireframe","SE","QS","isoValue","gaussLim","gridSpacing","CS","probePositions","TR","TU","heightSegmentsRatio","tension","CA","depth","ss","helix","arrow","strand","TX","template","horizontalAlign","verticalAlign","dx","dy","dz","fg","bg","showBg","VD","kSigma","kSigmaMed","kSigmaMax","frame","isoMode","colorers","EL","carbon","UN","CO","baseColor","CB","factor","SQ","gradient","TM","OC","HY","MO","antialias","camFov","camNear","camFar","camDistance","radiusToFit","fogNearFactor","fogFarFactor","fogAlpha","fogColor","fogColorEnable","palette","resolution","autoResolution","autoPreset","preset","presets","default","empty","wire","small","macro","objects","dashSize","gapSize","transparent","draft","clipPlane","clipPlaneFactor","clipPlaneSpeed","plugins","axes","fog","zSprites","isoSurfaceFakeOpacity","suspendRender","nowater","autobuild","fxaa","outline","threshold","thickness","ao","autoRotation","maxfps","fbxprec","autoRotationAxisFixed","zooming","picking","pick","editing","aromatic","singleUnit","stereo","interpolateViews","transparency","translationSpeed","example","good","ssaoKernelRadius","ssaoFactor","stereoBarrel","use","multiFile","Settings","old","_changed","path","_notifyChange","_notifyChanges","defaultValue","checkpoint","deepValue","deepPath","changed","applyDiffs","diffs","VERSION","getDiffs","versioned","setPluginOpts","plugin","repIndex","asBoolean","adapters","string","boolean","cOptsSep","cL2Ass","cLSep","cCommonIgnoreSymbols","cL1ExclExpr","encodeQueryComponentL1","cL2ExclExpr","encodeQueryComponentL2","ensureRepList","reps","ensureRepAssign","extractArgs","defaultsDict","bang","inputVal","sep","parseParams","arg","pair","adapter","actions","unit","menu","_objects","newOpts","newObj","mt","materials","dup","_fromArray","entries","entry","_processOptsForURL","_processArgsForURL","_processObjForURL","objOpts","_processOptsForScript","_processArgsForScript","_processObjForScript","map","_processRepsForScript","repString","strIdx","localAdd","fromURL","fromAttr","attr","toURL","stringList","checkAndAdd","repList","addReps","objList","addObjects","protocol","host","pathname","toScript","commandsList","command","saveQuotes","quote","trim","Atom","residue","role","het","serial","temperature","charge","mask","hydrogenCount","radicalCount","valence","bonds","flags","Flags","HYDROGEN","CARBON","isHet","isHydrogen","getVisualName","forEachBond","process","getFullName","_chain","getName","_sequence","static","NONPOLARH","Element","fullName","weight","radiusBonding","hValency","hydrogenValency","U1","Lead","U2","Wing","U18","Constants","SG","byAtomicNumber","ByAtomicNumber","byName","ByName","getByName","cBondTypes","UNKNOWN","COVALENT","AROMATIC","getAtomPos","Bond","right","order","fixed","_left","_right","_fixed","_order","_type","getLeft","getRight","getOrder","calcLength","distanceTo","_forEachNeighbour","currAtom","forEachLevelOne","forEachLevelTwo","l2Atom","_fixDir","refPoint","currDir","posGetter","rightCount","leftCount","tmpVec","clone","checkDir","sub","dot","checkCarbon","stages","stageId","multiplyScalar","calcNormalDir","third","maxNeibs","another","secondPos","firstV","secondV","crossVectors","lengthSq","normalize","BondType","cNucleicControlNames","cNucleicWing1Names","cNucleicWing2Names","cCylinderSource","cCylinderTarget","types","atoms","chain","sequence","icode","_component","_icode","_mask","_atoms","_secondary","_firstAtom","_leadAtom","_wingAtom","_lastAtom","_controlPoint","_midPoint","_wingVector","_cylinders","_isValid","_het","_molecule","getChain","getMolecule","getSequence","getSecondary","getICode","addAtom","xyz","tempFactor","getComplex","getAtomCount","forEachAtom","_findAtomByName","_findFirstAtomInList","names","collectMask","getCylinderTargetList","_name","_detectLeadWing","getAtomPosition","leadAtom","wingStart","wingEnd","cylSource","targetList","cylTarget","calcWing","prevLeadPos","currLeadPos","prevWingPos","prevWing","vectorA","vectorB","angleTo","negate","_innerFinalize","prevRes","prev","nextRes","chainAsNucleic","bFirstInChain","lp","THREE","lerp","_finalize2","asNucleic","isConnected","anotherResidue","_finalize","tempCount","occupCount","ResidueType","letterCode","_fullName","ALA","ARG","ASN","ASP","CYS","GLN","GLU","GLY","HIS","ILE","LEU","LYS","MET","PHE","PRO","PYL","SEC","SER","THR","TRP","TYR","VAL","DA","DC","DG","DI","DT","DU","WAT","H2O","HOH","DOD","UNK","UNL","PROTEIN","BASIC","ACIDIC","POLAR","NONPOLAR","NUCLEIC","PURINE","PYRIMIDINE","DNA","RNA","WATER","_addFlag","flag","StandardTypes","_addParam","ChainType","complex","_complex","_residues","minSequence","POSITIVE_INFINITY","maxSequence","NEGATIVE_INFINITY","getResidues","_determineType","residues","findResidue","seqNum","iCode","curr","updateToFrame","frameData","prevData","frameRes","currData","addResidue","getResidueType","addResidueType","Residue","getResidueCount","forEachResidue","StructuralElement","init","term","generic","genericByType","serialAtomMap","residueHash","splitUnifiedSerial","serialId","hashCode","getUnifiedSerial","Type","STRAND","BRIDGE","HELIX_310","HELIX_ALPHA","HELIX_PI","HELIX","TURN_310","TURN_ALPHA","TURN_PI","TURN","BEND","COIL","Generic","LOOP","StructuralElementType","StructuralElementGeneric","typeByPDBHelixClass","helixClass","comment","sheet","sense","atomCur","atomPrev","as","_width","_strands","getWidth","addStrand","addEmptyStrand","Strand","saveNode","_id","_position","_charge","_repeat","_center","xmlNodeRef","getPosition","getCentralPoint","_rebuildSGroupOnAtomChange","nLimon","bLow","bHight","aPos","addVectors","List","_values","splice","toJSON","includes","valuesArray","upperOnly","_validate","Selector","ListSelector","RangeListSelector","ValueListSelector","caseSensitive","NoneSelector","includesAtom","_atom","AllSelector","none","PrefixOperator","rhs","InfixOperator","lhs","keywords","defineSelector","SelectorClass","NULL_SELECTOR","defineOperator","OperatorClass","byResidueTypeFlag","selectors","_selector","_boundaries","boundingBox","boundingSphere","computeBoundaries","makeEmpty","expandByPoint","bbc","getCenter","setFromCenterAndSize","radiusSquared","pos","lengthSquared","distanceToSquared","sqrt","getTransforms","getSelector","getBoundaries","finalize","BiologicalUnit","chains","matrices","oldCenter","oldRad","applyMatrix4","newRad","addScalar","subScalar","addChain","addMatrix","matrix","_residueIndices","_cycles","_subDivs","_residueCount","resIdc","idIdc","idCount","last","setSubDivs","subDivs","resCnt","_bonds","forEachCycle","cycle","addCycle","cycles","markResidues","_forEachSubChain","subs","currRes","endRes","getMaskedSequences","_subIdx","getMaskedSubdivSequences","currIdx","lastSubIdx","subIdx","boundaries","maxPairsEstimate","numPairs","numMaxPairs","intBuffer","hashBuffer","cHashTableSize","destroy","addPair","indexA","indexB","ia","ib","codeToAdd","apI","_getBondingRadius","_maxRad","bBox","getDefaultBoundaries","_vBoxMin","_vBoxMax","_pairCollection","_addExistingPairs","getAtoms","numAtoms","aInd","collection","numBondsForAtom","bInd","_findPairs","vw","getVoxelWorld","atomsNum","rA","isHydrogenA","posA","locationA","atomA","processAtom","atomB","locationB","dist2","rB","maxAcceptable","forEachAtomWithinRadius","_addPairs","iA","iB","_addPair","bondsA","numBonds","newBond","addBond","build","_buildInner","_calcBoundingBox","AtomPairs","nAtoms","maxRad","cAromaticType","cAromaticAtoms","_coDirVectors","v1Tmp","v2Tmp","cp","v1","v2","_insertAscending","_anotherAtom","_markAromatic","Cycle","atomsList","nA","nextAtom","checkBond","_isAromatic","_isPossibleAromatic","rightIdx","leftIdx","_checkCycleSimple","_checkCycleComplex","bondsData","bondMarks","_bondsData","_bondMarks","_resetCycles","_currIdx","_haveSameCycle","bond1","bond2","arr1","arr2","n1","n2","i1","i2","_tryBond","prevBond","currRight","bondsOrder","currLeft","currVec","startAtomRef","_currStart","checkAromatic","_checkBond","anotherAtom","anotherVec","theta","_cosBetween","newDir","cross","dir","newRight","_startCycle","_findLoops","checkCycle","forEachComponent","component","newCycle","markCycles","detectCycles","_getSphereSliceRadiusRange","zMin","zMax","dzMin","dzMax","rzMin","rzMax","rMin","rMax","_getCircleSliceRadiusRange","yMin","yMax","dyMin","dyMax","ryMin","ryMax","VoxelWorld","box","vCellSizeHint","_box","getSize","divide","_last","_cellSize","_cellInnerR","_cellOuterR","numVoxels","_voxels","addAtoms","voxelIdx","_findVoxel","point","_zero","voxel","_voxel","_forEachAtomInVoxel","_forEachVoxelWithinRadius","xRange","_xRange","yRange","_yRange","zRange","_zRange","_forEachVoxelWithinRadiusSimple","rRangeXY","rRangeX","xVal","yVal","zVal","isInsideX","isInsideY","isInsideZ","divideScalar","clampScalar","vCenter","_vCenter","distTouch2","distInside2","d2","r2","isInside","forEachAtomWithinDistFromMasked","dist","_forEachAtomWithinDistFromGroup","atomProc","forEachAtomWithinDistFromSelected","voxels","processIfWithin","MINIMAL_DISTANCE","MIN_HBOND_ENERGY","COUPLING_CONSTANT","HBondInfo","_hbonds","_buildVW","_build","isBond","from","to","acc0","acc1","acceptor","energy","ri","preri","rj","prerj","_calcHBondEnergy","pairs","PairCollection","_residueGetCAlpha","_residueGetCO","_residueGetNH","predonor","donor","distanceHO","distanceHC","distanceNC","distanceNO","donorInfo","accInfo","BridgeType","freeze","NO_BRIDGE","PARALLEL","ANTI_PARALLEL","HelixFlag","START","MIDDLE","END","START_AND_END","StructureType","SecondaryStructureMap","_ss","_sheet","_betaPartners","_bend","_helixFlags","_chainLengths","_chains","_buildBetaSheets","_buildAlphaHelices","inResidues","chainLength","inPreferPiHelices","stride","kappa","_kappa","_isHelixStart","isTurn","_cosinusAngle","p1","p2","p3","p4","v12","v34","prevPrev","nextNext","curCA","ppCA","nnCA","ckap","skap","atan2","bridges","lenA","chainA","lenB","chainB","_testBridge","found","bridge","unshift","chainI","chainJ","ibi","iei","jbi","jei","ibj","iej","jbj","jej","_hasChainBreak","bulge","ladderset","Set","ladder","delete","sheetset","toMove","_areBridgesLinked","betai","betaj","parallel","ai","aj","has","helixClassMap","loopMap","Complex","_components","_helices","_sheets","structures","_residueTypes","_sgroups","_molecules","_maskNeedsUpdate","metadata","symmetry","units","_currentUnit","addSheet","addHelix","getBonds","forEachChain","resName","getSGroupCount","getSGroups","getAtomByFullname","resId","localeCompare","Chain","getChainCount","getMolecules","getMoleculeCount","forEachMolecule","molecules","forEachSGroup","groups","components","forEachVisibleComponent","getBondCount","maxSerial","uniSerial","chainShift","remnant","_fillCmpEdit","addComp","comp","Component","resCount","currStart","_fillCmpNoedit","currSubDivs","_fillComponents","enableEditing","getCurrentUnit","resetCurrentUnit","setCurrentUnit","newUnit","_computeBounds","onAtomPositionChanged","_finalizeBonds","updateStructuresMask","helices","sheets","needAutoBonding","autoConnector","AutoBond","marker","AromaticLoopsMarker","detectAromaticLoops","_finalizeMolecules","molecule","updater","structure","countAtomsByMask","getNumAtomsBySelector","resetAtomMask","markAtoms","setMask","clearMask","totalSelector","markAtomsAdditionally","clearAtomBits","reseter","getAtomNames","_atomNames","dict","getElements","_elements","getResidueNames","_residueNames","getChainNames","_chainNames","getAltLocNames","_altlocNames","_voxelWorld","addElement","srcArray","dstArray","functor","elem","joinComplexes","complexes","atomBias","bondBias","residueBias","chainBias","componentBias","bias","processBond","processResidue","processChain","processComponent","doNothing","rt","ssMap","getSheet","item","Sheet","lastCode","lastSheetIndex","lastHelixIndex","curStructure","curCode","curResidue","curSheetIndex","Helix","loopType","curSheet","filter","pow2ceil","Volume","dimensions","vecSize","volumeInfo","_dimVec","_volumeInfo","_dimX","_dimY","_dimZ","_rowElements","_planeElements","_totalElements","_data","getValue","setValue","addValue","getDimensions","getBox","getVolumeInfo","getCellSize","boxSize","computeGradient","vl","vs","xSize","ySize","zSize","volMap","_voxelValue","zi","zm","zp","yi","ym","yp","xi","xm","xp","getTiledTextureStride","buildTiledTexture","tilesX","tilesY","tileRow","texture","needsUpdate","getData","getDirectIdx","getStrideX","getStrideY","getStrideZ","SGroup","Assembly","Molecule","CSS2DObject","_element","getElement","setTransparency","transp","op","op100","opacity","RCGroup","raycast","raycaster","intersects","visible","children","enableSubset","innerOnly","disableSubset","isEmpty","getSubset","totalSubset","LAYERS","VOLUME","TRANSPARENT","PREPASS_TRANSPARENT","VOLUME_BFPLANE","COLOR_FROM_POSITION","SHADOWMAP","SELECTION_LAYERS","resetTransform","quaternion","updateMatrixWorldRecursive","updateMatrixWorld","addSavingWorldTransform","_worldMatrixInverse","matrixWorld","invert","multiply","decompose","renderDummyQuad","_material","depthWrite","_scene","_quad","_camera","render","renderScreenQuad","isIdentity","identity","equals","applyToPointsArray","elements","persp","ScreenQuadMaterial","uniforms","srcTex","vertexShader","vertexScreenQuadShader","depthTest","clearTree","geometry","dispose","removeChildren","renderScreenQuadFromTex","fragmentShader","renderScreenQuadFromTexWithDistortion","coef","setMinimalFov","angle","aspect","fov","radToDeg","atan","tan","degToRad","updateHalfSized","camera","originalAspect","originalFov","updateProjectionMatrix","setDistanceToFit","intersectVisibleObject","gfxObj","fogFarPlane","intersectObject","nearPlane","near","matrixWorldInverse","farPlane","far","extractScale","_v","te","determinant","copyAtList","attribute","indexList","_oldInstancedBufferGeometryCopy","source","instanceCount","calcCylinderMatrix","posBegin","posEnd","posCenter","matScale","makeScale","matRotHalf","makeRotationX","matRotLook","vUp","lookAt","setPosition","calcChunkMatrix","eye","up","rad","groupHasGeometryToRender","group","hasGeoms","buildDistorionMesh","widthSegments","heightSegements","calcInverseBarrel","prevR2","curR2","dr","geo","getAttribute","setXY","fillArray","startIndex","endIndex","destroyObject","belongToSelectLayers","layers","processObjRenderOrder","idMaterial","renderOrder","isGroup","applySelectionMaterial","setValues","depthFunc","overrideColor","lights","shadowmap","setUberOptions","fixedColor","zOffset","getMiddlePoint","point1","point2","optionalTarget","addScaledVector","_defaultBoundaries","Visual","gfxutils","dataSource","_dataSource","release","getDataSource","_ensureArray","EntityList","entities","_list","_dict","_indices","entity","register","registerInList","unregisterFromList","registerInDict","unregisterFromDict","unregister","all","defineProperties","CollisionSphere","_radius","sphere","_sphere","ray","intersectSphere","distance","origin","setSphere","inters","chunkIdx","computeBoundingBox","computeBoundingSphere","tmpColor","InstancedSpheresGeometry","SphereCollisionGeo","spheresCount","sphereComplexity","useZSprites","_sphGeometry","_init","setItem","itemIdx","itemPos","itemRad","_offsets","setColor","colorVal","_colors","startUpdate","finishUpdate","setOpacity","chunkIndices","alphaArr","_alpha","geom","sphereGeo","alpha","ChunkedObjectsGeometry","chunkGeo","chunksCount","_chunkGeo","colors","chunkSize","_chunkSize","mesh","facesPerChunk","faceIndex","srcPos","_positions","srcNorm","_normals","srcColor","dstPos","dstNorm","dstColor","dstPtOffset","ptIdxBegin","ptIdxEnd","attributes","chunkIndex","chunkIndexSize","pointsCount","use32bitIndex","indexSize","Uint32Array","Uint16Array","posOffset","setIndex","SimpleSpheresGeometry","sphGeometry","normals","geoNormals","normal","_chunkPos","_tmpPositions","tmpPos","geoPos","centerPos","tmpVector","normMtx","_chunkNorms","_tmpVector","botPos","topPos","firstOffset","secondOffset","tmpArray","geoNorm","lerpVectors","mtx1","getNormalMatrix","fromArray","toArray","applyMatrix3","colorVal1","colorVal2","CylinderBufferGeometry","radiusTop","radiusBottom","radialSegments","heightSegments","openEnded","thetaLength","parameters","hasTop","hasBottom","vertexCount","facesCount","heightHalf","positions","uvs","currVtxIdx","currFaceIdx","tanTheta","v3","v4","setXYZ","vx","vy","vz","startTIdx","lastIdx","fTIdx","currSrcIdx","getX","getY","getZ","nextTVtx","startBIdx","lastBIdx","fBIdx","currSrcBIdx","nextBVtx","invMatrix","setArrayXYZ","setArrayXYZW","sortNumber","Instanced2CCylindersGeometry","_useZSprites","_cylGeometry","_collisionGeo","Simple2CCylindersGeometry","me","mtxOffset","_matVector1","_matVector2","_matVector3","_invmatVector1","_invmatVector2","_invmatVector3","colorIdx","_color1","_color2","chunksIdx","cylinderInfo","newPar","_prepareCylinderInfo","cylinderIndices","color1","color2","_assignOpacity","getGeoParams","cylinderGeo","tmpPrev","tmpNext","tmpRes","simpleNormal","normalOnCut","nearRingPt","shape","ringsCount","ptsCount","totalPts","_createExtrudedChunkGeometry","_ringsCount","tmpShape","_tmpShape","hasSlope","hasCut","chunkStartIdx","_setPoints","_setSlopeNormals","_setBaseNormals","_addCut","vtxIdx","mtx","nPtsInRing","_countNormalsInRing","isSlope","shiftToExtraPt","subVectors","startSegmentIdx","segmentsCount","elemSize","ThickLinesGeometry","_initVertices","segmentIdx","setSegment","pos1","pos2","directions","_directions","dirIdx","startSegIdx","endSegIdx","getSubsetSegments","getSubsetColors","getSubsetOpacities","getNumVertexPerSegment","getPositionSize","setSegments","startPos","startDir","setColors","_buffersSize","indexOffset","pointOffset","BaseLinesGeometry","posSize","itemOffset","ChunkedLinesGeometry","LinesGeometry","enableCollision","CylinderCollisionGeo","collisionGeo","segCount","segIdx","TwoColorLinesGeometry","segmentIndices","_segCounts","vectors","vecCount","tempPos1","tempPos2","CrossGeometry","IsoSurfaceGeometry","_opts","_posRad","posRad","IsoSurfaceMarchCube","pointsValuesLinear","hasIntersection","bitsInside","numCellsPerSide","n3","striIndicesMarchCube","edgeTable","_voxelGradientFast","grad","GridCell","_arrSize","cubeIndex","Triangle","createArray","arrSize","IsoSurface","_numTriangles","_numVertices","_volumetricData","_xAxis","_yAxis","_zAxis","_xDir","_yDir","_zDir","_prepareAxesAndDirs","cellSize","xAxis","yAxis","zAxis","xDir","yDir","zDir","tmp","notZero","axe","EPSILON","_vertexInterp","isoLevel","grid","ind1","ind2","vertex","valP1","isoDiffP1","diffValP2P1","mu","_polygonize","triangles","firstIndices","_firstIndices","secondIndices","_secondIndices","vertexList","_vertexList","normalList","_normalList","triCount","triTblIdx","triTable","_triTable","_doGridPosNorms","step","appendSimple","vol","volData","dim","stepX","stepY","stepZ","gc","gcVal","gcValSize","additions","appendVertex","axis","triVertex","_origin","posMtx","globTriCount","_gradient","compute","_remapIndices","vertexMap","idcCount","newIndices","_remapVertices","vertices","newPositions","newNormals","norm","vertexFusion","faceVer","oldVerCount","vMap","newVer","matchedIndex","setColorVolTex","colorMap","atomMap","atomWeightMap","visibilitySelector","numVerts","xs","ys","zs","colorData","strideX","strideY","strideZ","atomWeightData","atomStrideX","atomStrideY","atomStrideZ","xInv","yInv","zInv","atomLookup","atomWeights","interp","idx1","idx2","collectWeight","coefX","coefY","coefZ","newVerCount","ind","mux","muy","muz","maxWeight","dominantIdx","atomIdx","c0","c1","c2","c3","cz0","cz1","numTriangles","newTriCount","i0","toMesh","_visibilitySelector","_calcSurface","_findMinMax","posRadArray","itemsCount","maxPosRad","minPosRad","tmpVal","_findNumVoxels","minMaxValues","minCoordRad","maxCoordRad","gridPadding","radScale","padRad","bbox","_makeSurface","surface","isoSurf","volTexMap","packedArrays","_computeSurface","chem","VolumeSurfaceGeometry","_shiftByOrigin","gaussdensity","atomicNum","invIsoValue","invGridSpacing","maxVoxelX","maxVoxelY","maxVoxelZ","volTexData","texStrideX","scaledRad","atomicNumFactor","radInv","radLim","radLim2","xMin","xMax","dy2dz2","addr","texAddr","expVal","density","exp","colInd","originX","originY","originZ","AVHash","maxDistance","minX","minY","minZ","maxX","maxY","maxZ","hashFunc","minW","iDim","jDim","kDim","nCells","jkDim","preHash","cid","iIdx","cellOffsets","cellLengths","maxCellLength","subArray","cellLength","neighbourListLength","withinRadii","rExtra","out","outIdx","nearI","nearJ","nearK","loI","loJ","loK","hiI","hiJ","hiK","iOffset","jOffset","cellStart","cellEnd","dataIndex","baseIndex","rSum","_indexList","maxRadius","volTex","weights","gridx","gridy","gridz","sinTable","cosTable","neighbours","lastClip","weightsMap","mid","ngTorus","fillGridDim","innI","initializeGrid","gridSize","TypeName","uniformArray","rExt","initializeAngleTables","singleAtomObscures","innX","innY","innZ","innCI","ra2","obscured","ni","projectTorus","aIdx","bIdx","xa","ya","za","r1","innR2","dmp","rInt","ng","cost","sint","px","py","pz","iax","iay","iaz","minx","miny","minz","maxx","maxy","maxz","iz","iy","dzy2","zyOffset","ix","current","getVolume","ax","ay","az","ar2","colIdx","cr","cg","cb","cIdx","ap","spx","spy","spz","dd","projectPoints","innIdx","projectTorii","innInnI","fixNegatives","contactSurface","ContactSurface","radiusAt","coord","colorX","colorY","colorZ","atomType","srcAtom","vBoxMin","vBoxMax","_numAtoms","_probeRadius","_atomsList","_voxelList","createVoxels","numAtomsRefs","aveRad","numCells","_numCells","_aveRad","side","side2","side3","xScale","_xScale","yScale","_yScale","zScale","_zScale","maxAtomsRefs","xNumVoxMult","yNumVoxMult","zNumVoxMult","diaAffect","numVoxX","numVoxY","numVoxZ","xIndMin","yIndMin","zIndMin","xIndMax","yIndMax","zIndMax","indVoxel","indexNext","destroyVoxels","_vertices","forEachRelatedAtom","xInd","yInd","zInd","ref","getClosestAtom","closest","minDist2","MAX_VALUE","buildNormals","numVertices","numCloseAtoms","vNormalX","vNormalY","vNormalZ","koef","maxRadAffect","maxRadAffect2","expScale","gatherNormals","maxClosedAtoms","buildColors","radiusColorSmoothness","colorsClose","weightsSum","gatherColors","weightNormalized","maxNumVertices","maxNumTriangles","needVertexColors","_maxNumVertices","_maxNumTriangles","HASH_SIZE","_innerBuild","geoOut","getGeo","_fromGeo","numTri3","convertToAtomsColored","atomsColored","IsoSurfaceAtomColored","nm","hashLines","hashEntries","getBoundingBox","bigNum","probeRadius2","atomRadiusScale","radMax","num","getCornerCoord","numPoints","vOut","invNP","tx","ty","tz","buildEdgePoint","sign","cube","indexPointValue","cTwentyFour","xb","yb","zb","isTriangleVisible","v0","a0","voxelWorld","a1","a2","addTriangle","indInGeo0","addVertexToGeo","indInGeo1","indInGeo2","itr","buildGeoFromCorners","meshRes","vCellStep","vaEdges","vCorner","indCell","indY","indZ","indPointValues","indValues","offs","numTri","indTri","getNumIntersectedCells","numIntersectedCells","cubeValuesIndex","indCorner","letter","atomT","calculateGridCorners","probeRad","vDif","fx","fy","fz","indXMin","indYMin","indZMin","indXMax","indYMax","indZMax","createVertexHash","numHashEtriesAllocated","numHashEntryIndex","getNewHashEntry","vAdd","oneHynberes","hashResolution","marCubeResoultion","iHash","hLineIndex","iVertAdd","entryFirst","modifyExcludedFromGeo","probeSphereRadius","distToSphere","distToBorder","probeSpRad2","sideInv","radEst","xCorner","yCorner","zCorner","ok","expandFactor","meshResolution","colorMode","useVertexColors","excludeProbe","rProbeRadius","numIntersectedCellsEstim","IsoSurfaceGeo","probeRadForNormalsColors","IsosurfaceBuildNormals","ExtrudedObjectsGeometry","QuickSurfGeometry","ContactSurfaceGeometry","SSIsosurfaceGeometry","LabelsGeometry","items","xTranslation","yTranslation","deltaPos","userData","fieldTxt","spanText","fontSize","strings","spanNodeP","spanNodeText","createLabel","textAlign","fColor","bColor","precision","renderer","capabilities","getMaxPrecision","_noiseData","_noiseWrapS","_noiseWrapT","_noiseMinFilter","_noiseMagFilter","_noiseMapping","noiseTexture","noiseWidth","noiseHeight","_samplesKernel","defaultUniforms","merge","diffuse","specular","shininess","zClipValue","clipPlaneValue","nearPlaneValue","invModelViewMatrix","world2colorMatrix","dashedLineSize","dashedLinePeriod","projMatrixInv","viewport","samplesKernel","noiseTex","noiseTexelSize","srcTexelSize","uberOptionNames","uberOptions","zClipCoef","noise","toonShading","UberMaterial","instancedPos","instancedMatrix","attrColor","attrColor2","attrAlphaColor","sphereSprite","cylinderSprite","fakeOpacity","prepassTransparancy","colorFromPos","shadowmapType","colorFromDepth","orthoCam","dashedLine","thickLine","fogTransparent","normalsToGBuffer","precisionString","defines","extensions","createInstance","inst","USE_FOG","INSTANCED_POS","INSTANCED_MATRIX","ATTR_COLOR","ATTR_COLOR2","ATTR_ALPHA_COLOR","OVERRIDE_COLOR","SPHERE_SPRITE","fragDepth","CYLINDER_SPRITE","ZCLIP","CLIP_PLANE","FAKE_OPACITY","USE_LIGHTS","COLOR_FROM_POS","SHADOWMAP_PCF_SHARP","SHADOWMAP_PCF_RAND","SHADOWMAP_BASIC","COLOR_FROM_DEPTH","ORTHOGRAPHIC_CAMERA","PREPASS_TRANSP","DASHED_LINE","THICK_LINE","FOG_TRANSPARENT","drawBuffers","NORMALS_TO_G_BUFFER","TOON_SHADING","shallow","updateUniforms","SuperClass","NewObjectType","onBeforeRender","scene","_onBeforeRender","_update","Mesh","UberObject","castShadow","receiveShadow","_geometry","_group","modelViewMatrix","multiplyMatrices","uniformsNeedUpdate","ZClippedMesh","modelView","_modelView","mvLength","_mvLength","setFromMatrixColumn","localToWorld","TextMesh","initialized","srcItem","label","visibility","_viewport","projectionMatrix","ZClipped","ZSprite","ZSpriteMesh","Text","Line","LineSegments","SimpleMesh","ThickLineMesh","Instanced","InstancedMesh","setMatParams","_createInstancedCylinders","Geometry","geometries","meshes","initMaterial","_createLineSegmentsGeoTriplet","renderParams","thickLines","_createIsoSurfaceGeoTriplet","geoClass","caps","surfaceOpts","createSpheres","create2CClosedCylinders","_caps","_settings","create2CCylinders","create2CLines","createCrosses","createExtrudedChains","createChunkedLines","createQuickSurface","createContactSurface","createSASSES","createLabels","TransformGroup","geoParams","transforms","_geoParams","mat","_transforms","_createMeshes","_ray","inverseMatrix","_inverseMatrix","childIntersects","ciCount","geos","meshCnt","ChemGroup","selection","_selection","_mode","_colorer","_chunksIdc","chunks","_polyComplexity","_geo","Name","_makeGeoArgs","_mesh","chunksList","_calcChunksList","_changeSubsetOpacity","atomsIdc","AtomsGroup","calcAtomRadius","getAtomColor","updateColor","needsColorUpdate","AtomsSphereGroup","selectedAtoms","getSurfaceOpts","getAtomText","getNode","colorMappings","adjust","inverse","propagateColor","rule","startsWith","templateMappings","hetatm","water","parseTemplate","getLabelOpts","fgColor","bgColor","_slerp","omega","oSin","radOffset","addChunk","chunksToIdx","prevVector","currVector","segmentsHeight","_segmentsHeight","leprStep","currAtomIdx","cCount","cycAtoms","chunkPoints","tmpDir","cycleRad","prevPos","currPos","upDir","currAngle","_createShape","pts","AromaticGroup","torusRad","getAromRadius","radiusV","calcStickRadius","lookAtVector","mtc","points","currPoint","getAromaticOffset","prevPt","getAromaticArcChunks","chunksIdc","resIdx","ResiduesGroup","stickRad","getResidueColor","_processItem","NucleicItemGroup","cyl1","cyl2","calcMatrix","_buildStructureInterpolator","argTrans","transformT","tt","newt","ans","_addPoints","centerPoints","topPoints","tp","_calcPoints","firstIdx","_prevIdx","_nextIdx","arrIdx","_extrapolate2","otherIdx","prevIdx","nextIdx","nucleic","nameFrom","nameTo","posFrom","posTo","shift","wing","cpPrev","tpPrev","cpNext","tpNext","_addPointsForLoneResidue","startIdx","endIdx","pointsArrays","_topInterp","_centerInterp","_shift","_valueStep","_segmentsCount","prepareMatrices","firstRad","secondRad","mtcCount","outMtc","currRad","topInterp","cenInterp","currentValue","mtxIdx","lerpVal","currTop","currCenter","nextCenter","_loopThrough","subDiv","subDivI","subDivN","idc","matrixHelper","CartoonHelper","prevLast","prevSecondRad","getResidueRadius","cmpMultiplier","getHeightSegmentsRatio","getTension","chunkIdc","subdivs","chunk","drawMultiple","drawMultiorderBonds","showAromatic","showAromaticLoops","bondsIdc","bondsCount","getBondOrder","getCylinderCount","bondIdx","BondsGroup","emptyOffset","calcSpaceFraction","normDir","leftPos","rightPos","currBondIdx","atom1","atom2","a1Pos","a2Pos","currStickRad","STEP_SIZE","AtomsSurfaceGroup","AtomsSASSESGroupStub","AtomsTextGroup","AromaticTorusGroup","AromaticLinesGroup","NucleicCylindersGroup","NucleicSpheresGroup","ResiduesSubseqGroup","ResiduesTraceGroup","BondsCylinderGroup","BondsLinesGroup","bondDir","a1Hangs","a2Hangs","_checkAtom","atomsGroup","meshIdx","chSubset","subsetEl","AtomsProcessor","ResidueGroup","_checkResidue","residuesGroup","checkResidue","ResidueProcessor","jEnd","bondsGroup","cycleIdx","perCycle","Atoms","OrphanAtoms","OrphanAtomsProcessor","Residues","ResiduesProcessor","Nucleic","NucleicProcessor","Subseqs","SubseqsProcessor","Bonds","BondsProcessor","Aromatic","AromaticProcessor","_bakeGroup","triplet","Processor","Group","AtomsSpheres","MeshCreator","processors","OrphanedAtomsCrosses","BondsCylinders","BondsLines","CartoonChains","TraceChains","NucleicSpheres","NucleicCylinders","ALoopsTorus","ALoopsLines","QuickSurfGeo","ContactSurfaceGeo","SASSESSurfaceGeo","TextLabelsGeo","Mode","identify","buildGeometry","depGroups","currGroup","newGroup","makeContextDependent","getRenderParams","LinesMode","shortName","LicoriceMode","BallsAndSticksMode","VanDerWaalsMode","TraceMode","TubeMode","_residue","TUBE_RADIUS","CartoonMode","secCache","getResidueStartRadius","secOpts","getResidueEndRadius","ARROW_END","startRad","endRad","_res","tubeRad","secHeight","secData","SurfaceMode","surfaces","surfaceNames","getVisibilitySelector","isSurface","QuickSurfaceMode","useBeads","IsoSurfaceMode","_excludeProbe","_radScale","IsoSurfaceSASMode","IsoSurfaceSESMode","ContactSurfaceMode","TextMode","getTemplateOptions","adjustColor","Palette","getElementColor","asIs","elementColors","defaultElementColor","residueColors","defaultResidueColor","getChainColor","chainColors","getSecondaryColor","secondaryColors","defaultSecondaryColor","getSequentialColor","getGradientColor","gradientName","gradients","defaultNamedColor","beta","lerpColor","getNamedColor","namedColors","minRangeColor","midRangeColor","maxRangeColor","defaultGradientColor","namedColorsArray","rainbow","temp","hot","cold","reds","blues","CL","FE","NI","CU","BR","HE","LI","BE","NE","NA","MG","AL","SI","AR","SC","TI","CR","MN","ZN","GA","GE","AS","KR","RB","SR","ZR","NB","TC","RU","RH","PD","AG","CD","IN","SN","SB","TE","XE","BA","LA","CE","PR","ND","PM","SM","EU","GD","TB","DY","HO","ER","YB","LU","HF","TA","RE","OS","IR","PT","AU","HG","TL","PB","BI","PO","AT","RN","FR","RA","AC","TH","PA","NP","PU","AM","CM","BK","CF","ES","FM","MD","NO","LR","RF","DB","BH","HS","MT","dna","rna","cpkPalette","jmolPalette","Colorer","palettes","ElementColorer","ResidueTypeColorer","SequenceColorer","ChainColorer","SecondaryStructureColorer","secondary","UniformColorer","ConditionalColorer","parsed","_subsetCached","ConformationColorer","TemperatureColorer","OccupancyColorer","_getColorByOccupancy","HydrophobicityColorer","hydrophobicity","MoleculeColorer","CarbonColorer","colorCarbon","colorNotCarbon","neutralColor","intensity","materialList","createDerivativeMesh","layer","newMesh","traverseMeshes","meshTypes","func","_gatherObjects","forEachMeshInGroup","processObj","applyTransformsToMeshes","processTransparentMaterial","matValues","prepassTranspMesh","processColFromPosMaterial","colFromPosMesh","createShadowmapMaterial","shadowmapMesh","isShadowmapMesh","removeShadowmapMaterial","countTriangles","totalCount","attribs","property","currAttr","faces","_countMeshTriangles","startMaterialValues","selectorString","materialPreset","needsRebuild","setMode","unmarkAtoms","setMaterialPreset","selectionGeo","meshutils","buildSelectionGeometry","sg","matrixAutoUpdate","compare","repSettings","selStr","valueOf","modeDiff","colorerDiff","change","newSelectorObject","newSelector","newMode","newColorer","newMaterial","_traverseComponentGroups","ComplexEditor","ComponentEditor","complexVisual","_complexVisual","_inProgress","_componentTransforms","_bakeComponentTransform","_resetComponentTransform","finalizeEdit","discard","getAltObj","pivot","visual","getSelectedComponent","getSelectionGeo","selectionMask","getSelectionBit","reprNode","bbmin","bbmax","updateMatrix","FragmentEditor","_getSelectionBorderAtoms","_fragmentBoundAtoms","pivotPos","_fragmentGeo","_fragmentSelectionGeo","vg","smeshes","sm","selectionBit","makeTranslation","_bakeAtomTransform","isFreeRotationAllowed","boundAtoms","transformDirection","atomHash","lookupAndCreate","entityList","specs","ComplexVisual","_reprList","_repr","_reprListChanged","_selectionBit","_reprUsedBits","_selectionCount","_selectionGeometry","getSelectionCount","getEditor","_editor","Representation","repCount","desc","status","repGet","_getFreeReprIdx","bits","NUM_REPRESENTATION_BITS","newSelectionBit","originalSelection","buildSelectorFromMask","def","hide","rebuildSelectionGeometry","resetSelectionMask","updateSelectionMask","pickedObj","otherObj","expandSelection","tmpMask","shrinkSelection","deselectionMask","multiple","getSelectionCenter","selRule","reprList","Promise","resolve","errorOccured","setTimeout","hasGeometry","repr","DEBUG","setNeedsRebuild","_buildSelectorFromSortedLists","optimizeList","NaN","expression","and","residx","forSelectedResidues","beginComponentEdit","editor","ComplexVisualEdit","beginFragmentEdit","setMaterialValues","needTraverse","volumeUniforms","volumeDim","tileTex","tileTexSize","tileStride","boxAngles","_isoLevel0","_flipV","_BFLeft","_BFRight","_FFLeft","_FFRight","_WFFLeft","_WFFRight","overrideUniforms","defUniforms","facesPosMaterialParams","sideType","BackFacePosMaterial","ShaderParams","BackFacePosMaterialFarPlane","matUniforms","aspectRatio","farZ","tanHalfFOV","matWorld2Volume","FrontFacePosMaterial","VolumeMaterial","shaderParams","updateDefines","ISO_MODE","STEPS_COUNT","VolumeMesh","cullFlag","edgeIntersections","_updateVertices","_corners","edges","_edges","_edgeIntersections","constant","vert","cornerMark","edgeMark","curEdge","curEdgeInter","CheckX","CheckY","CheckZ","curEdgeIdx","curEdgeSource","face","nextVertex","coplanarPoint","_collectVertices","_sortIndices","_updateIndices","faceIdx","vRight","vDir","rightProj","numIndices","setDataSource","vm","image","volInfo","obtuseAngle","_updateIsoLevel","mean","dmean","dmin","span","dmax","sd","nearClipPlaneOffset","_nearClipPlaneOffset","_pos","_norm","norm4D","_norm4D","matrixWorldToLocal","_matrixWorldToLocal","_clipPlane","getWorldDirection","getWorldPosition","setFromNormalAndCoplanarPoint","VolumeBounds","XY","XZ","YZ","bSize","offsetVert","_getBaseVertices","flatVertices","output","_flattenArray","_lines","projTable","_projectionTable","proj","inv","currDelta","getMesh","volume","planeGeo","_initPlaneGeo","_plane","frustumCulled","doubleSided","matWorldToVolume","_renderer","planeCamPos","normalMatrix","volumeMatrix","DEG2RAD","_frame","showFrame","_farPlane","VolumeFarPlane","getBoundingSphere","needShow","find","SomeLoader","canProbablyLoad","Loader","_source","_options","_abort","_agent","abort","extractName","FileLoader","_binary","blob","reader","FileReader","readAsArrayBuffer","readAsText","File","urlStartRegexp","XHRLoader","request","ImmediateLoader","LoaderList","format","formats","SomeParser","canProbablyParse","parseSync","getModel","model","_parseHeader","Remark290","_matrix","_matrixIndex","stream","readString","matrixRow","readCharCode","matrixData","matrixIndex","parseFloat","Remark350","assemblies","_assembly","assembly","_start","_nextCR","_nextLF","_next","_end","readLine","readChar","readInt","readFloat","pdbStartRegexp","remarkParsers","PDBParser","_serialAtomMap","_modelId","_compaundFound","_biomoleculeFound","_allowedChainsIDs","_lastMolId","_remarks","_remark","_compndCurrToken","fileType","_fixBondsArray","_fixChains","remark290","remark350","chainDict","chainObj","idChainMap","nj","_parseATOM","chainID","resSeq","veryLong","nameToElement","Role","_parseENDMDL","_parseCONECT","serial0","serial1","serial2","serial3","serial4","_parseCOMPND","tokenIdx","chainStr","lastChar","_parseREMARK","remarkNum","remark","RemarkParser","_parseHELIX","_parseSTRUCTURE","_parseSHEET","pars","adder","serialNumber","structureName","helLength","shWidth","shCur","shPrev","startChainID","endChainID","startSequenceNumber","iCodeStr","startICode","endSequenceNumber","endICode","cs","_parseHEADER","classification","date","_parseTITLE","title","HEADER","HETATM","ENDMDL","CONECT","COMPND","REMARK","PDBStream","tagParsers","cOrderCharCodes","cmlStartRegexp","CMLParser","_readOnlyOneMolecule","_rebuidBondIndexes","countBonds","idxs","atomRefs2","_createSGroup","moleculeArr","fieldData","atomRefs","placement","fieldName","_extractSGroup","_extractSGroups","sgroupRef","mapEntry","cycleFuncInner","cycleFunc","x2","x3","y2","y3","z3","atomsRef","_traverseData","dom","childNodes","parseNode","xmlNode","nodeName","nodeValue","jsonNode","existing","_findSuitableMolecule","molSet","atomArray","_selectComponents","doc","DOMParser","parseFromString","traversedData","rawData","cml","retData","filteredData","rd","ret","localBond","bondArray","orderAttr","tc","labels","_breadWidthSearch","retStruct","atomLabels","labelsCount","originalCML","prepareComponentCompound","_packLabel","compId","molId","_unpackLabel","molID","breadthQueue","componentID","labeledAtoms","startID","_parseBond","eAtom","mainAtom","_parseSet","varData","currentLabel","reorder","atomCharge","lLabel","atomFullNameStruct","elementType","countRef","currAtomComp","strLabel","stringify","atomSerial","added","mrvValence","complexAtom","sGrp","totalAtomsParsed","joinedComplex","ArrayComparator","original","_original","_sum","candidate","sorted","secStructToType","MMTFParser","_onModel","_modelData","_onChain","chainData","_onGroup","groupData","_updateSecStructure","_onAtom","atomData","_onBond","bondData","helixClasses","_ssType","_ssStruct","_ssStart","struct","_updateMolecules","mmtfData","chainsInModel0","chainIndexList","description","_traverse","structureId","releaseDate","eventCallbacks","modelData","MMTF","_linkAtomsToResidues","_findSynonymousChains","named","_parseAssemblyInfo","bioAssemblyList","baInfo","transformList","chainListCheck","chainNames","allChains","_chainsByName","transpose","_markHeteroAtoms","_joinSynonymousChains","primaryChainsArray","primaryChainsHash","primary","ParsingError","column","captureStackTrace","parseLine","parseColumn","_isWhitespace","_inlineIndexOf","ch0","cRequiredAtomFields","cSecondaryCoding","helx","turn","strn","getTypeFromId","typeId","arrize","arrayLikeObject","AtomDataError","_extractOperations","assemblyGen","opsDict","groupStr","gps","grIdx","grCount","gr","gp","es","cnt","ii","nn","newMtx","CIFParser","asymDict","newline","block","keysCount","valuesCount","_parseValue","keyIndex","readCIF","_toComplex","cifData","complexData","_extractAtoms","_extractSecondary","_extractAssemblies","_extractMolecules","_extractMetadata","struct_keywords","pdbx_keywords","databaserev","database_PDB_rev","date_original","pdbx_description","atom_site","auth_seq_id","Cartn_x","Cartn_y","Cartn_z","label_atom_id","group_PDB","chainIdc","auth_asym_id","chainLabelIdc","label_asym_id","serials","iCodes","pdbx_PDB_ins_code","resNames","label_comp_id","type_symbol","tempFactors","B_iso_or_equiv","occupancies","charges","pdbx_formal_charge","altLocs","label_alt_id","models","pdbx_PDB_model_num","label_entity_id","moleculeIdx","struct_conf","_extractConfs","struct_sheet_range","_extractSheets","sheetData","sheet_id","beg_label_seq_id","end_label_seq_id","beg_label_asym_id","sheetNames","strandNames","starts","beg_auth_seq_id","ends","end_auth_seq_id","stICodes","pdbx_beg_PDB_ins_code","endICodes","pdbx_end_PDB_ins_code","helicesData","conf_type_id","comments","details","lengths","pdbx_PDB_helix_length","pdbx_PDB_helix_class","asmGen","pdbx_struct_assembly_gen","asmIdx","assembly_id","asmOper","oper_expression","asmList","asym_id_list","operList","vector","ops","_getOperations","pdbx_struct_oper_list","asm","assemblyOps","valueType","_xyz2crs","_header","_boxSize","_boxStart","extent","nstart","crs2xyz","cellDims","angles","_typedCheck","_buff","TypeError","_fillHeader","headerFormat","arrays","_parseArray","_parseVector","_buffer","_setAxisIndices","_setOrigins","_getAxis","header","gamma","z1","z2","_getXYZdim","_getVolumeInfo","_setBoxParams","xaxis","yaxis","zaxis","shiftX","shiftY","_getXYZbox","_toXYZData","CCP4Header","ispg","nsymbt","lksflg","customData","machine","nlabel","Ccp4Model","VolumeModel","u32","i32","f32","xyz2crs","xyzData","crsIdx","CCP4Parser","_atomsInf","_fileName","_parseToAtomsInf","endnAtoms","endComment","startAtomsInf","_parseAtomsInf","words","PubChemParser","jsonData","PC_Compounds","aids","aid","coords","conformers","aids1","aid1","aids2","aid2","orders","SDFStream","_strings","_currentStart","_currentStringIndx","setStart","getNextString","getCurrentString","getStringFromStart","numb","findNextDataItem","curStr","findNextCompoundStart","probablyHaveDataToParse","chargeMap","orderMap","typeMap","sdfAndMolRegexp","sdfRegExp","fileFormat","tagsNames","tags","SDFParser","_format","_metadata","_currentMolProps","_compoundIndx","_assemblies","_atomsParsed","_atomsIndexes","_parseAtoms","codes","trunc","reverse","buildChainID","_parseBonds","bondsNum","bondType","_parseMOL","countsLine","_parseDataItem","_parseCompound","props","_tryToUpdateMoleculeData","_buildAssemblies","_buildMolecules","_searchTag","_tryToFind","tagsList","tagPossibleNames","_finalizeMetadata","defineFormat","DSN6Header","div","DSN6Model","i16","_pointCalculate","byteBuffer","counter","_blockCalculate","zBlock","yBlock","xBlock","inRange","blocks","_calculateInfoParams","dispersion","minDensity","maxDensity","DSN6Parser","canParse","checkDataTypeOptions","getNext","GROParser","_time","_residueNumber","_residueName","_atomName","_atomNumber","_atomPosition","_atomVelocity","filetype","_parseTitle","_parseNumberOfAtoms","_parseAtom","positionX","positionY","positionZ","GROReader","un","am","nc","du","resNumberRegex","spacesRegex","splitToFields","MOL2Parser","_currPosIdx","_currStartIdx","_parseRawStrings","_toStringFromStart","MOL2Data","newPosIdx","_toHeaderString","_toStringFromHeader","_setStart","_probablyHaveDataToParse","_findNextCompoundStart","_parseMolecule","parsedStr","_setResidue","originAtomId","targetAtomId","_fixSerialAtoms","currMolecule","molResidues","ParserList","XYZParser","Exporter","exportSync","export","PDBResult","_resultArray","_currentStr","_tag","_fixedNumeration","_numeration","_tagStrNum","getResult","writeString","_currentStrLength","newTag","numeration","newString","writeEntireString","maxStrPos","curStrLength","finish","repeat","cStr","writeBondsArray","bondsArrays","_getSubArrays","subArraySize","subArrays","writeMatrix","matrixIndx","toFixed","writeMatrices","Matrix4","PDBExporter","_tags","_result","_tagExtractors","_extractHEADER","TITLE","_extractTITLE","_extractATOM","_extractCONECT","_extractCOMPND","_extractREMARK","_extractHELIX","SHEET","_extractSHEET","_stringForRemark350","_stringForRemark290","fixedBonds","strands","startIndx","_getMoleculeChains","chainsString","_Remark290","_Remark350","biomolIndx","SourceClass","copyFbxPoint3","srcIdx","dstIdx","copyFbxPoint4","vector4","copyTransformedPoint3","setSubArray","copyFunctor","functorOpts","arridx","FBXModel","lastPos","lastNorm","lastCol","vertsCount","indsCount","setPositions","setTransformedPositions","setNormals","setTransformedNormals","setIndices","setShiftedIndices","shifted","getVerticesNumber","addInstance","currentCount","FBXGeometry","_info","FBX1CGeometry","cl","FBX2CCylinder","_cutRawStart","_cutRawEnd","_facesPerSlice","addPerCylinder","_extendVertices","_extendIndices","startToShift","_setColorRange","colorSize","part1End","part2End","capSize","cap1End","cap2End","FBXInfoExtractor","_materials","_models","_extractModelsAndMaterials","_flattenModels","layersOfInterest","checkExportAbility","_collectInstancedGeoInfo","_collectGeoInfo","_reworkIndices","faceSize","overallVertsCount","combined","verticesCount","vertCount","_collectMaterialInfo","_addToPool","_collectSpheresInfo","instCount","instMatrix","objMatrix","sphereColor","instanceIndex","_getSphereInstanceMatrix","_collectCylindersInfo","oneCCylinder","splittingInfo","_gatherCylindersColoringInfo","twoCCylinder","needToSplit","additionalVertsCount","colorStart","colorEnd","is2Colored","_getCylinderInstanceMatrix","materialIdx","_checkExistingMaterial","differs","instIdx","matVector1","matVector2","matVector3","idxOffset","FBXResult","_writeHeader","_writeDefinitions","_writeObjects","_writeRelations","_writeConnections","creator","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","allModels","_verticesIndices","_normalLayer","_colorLayer","allMaterials","_materialProperties","modelsList","_floatArrayToString","colorArray","normalArray","FBXExporter","_version","miewVersion","_extractor","loaders","parsers","exporters","ExporterList","tempColor","_height","_widthHalf","_heightHalf","_vector","_viewMatrix","_projectionMatrix","_domElement","overflow","pointerEvents","myNode","setSize","_renderObject","lerpColorAsHex","setHex","getHexString","colorAsHex","setFromMatrixPosition","localOffset","getMaxScaleOnAxis","fogFactor","smoothstep","WebkitTransform","MozTransform","oTransform","getTopWindow","STATE","matrix4","ObjectHandler","lastRotation","ObjectControls","objectPivot","hotkeysEnabled","screen","rotateFactor","axisRotateFactor","intertia","dynamicDampingFactor","intertiaThreshold","_state","_mousePrevPos","_mouseCurPos","_mainObj","_altObj","_affectedObj","_isAltObjFreeRotationAllowed","_isTranslationAllowed","_isKeysTranslatingObj","_pressedKeys","_clock","_lastUpdateTime","_listeners","mousedown","mouseup","mousemove","mousewheel","touchstartend","touchmove","getKeyBindObject","keydownup","handleResize","resetKeys","contextmenu","_rotate","quat","zeroPivot","makeRotationFromQuaternion","setObjects","rot","mousePrevPos","mouseCurPos","aboutAxis","mouse2rotation","setFromAxisAngle","translateOnAxis","timeSinceLastUpdate","timeSinceMove","eyeDirection","cameraUpDirection","cameraSidewaysDirection","moveDirection","mouseDelta","mousePrev","mouseCur","setLength","stopPropagation","preventDefault","innerWidth","innerHeight","getBoundingClientRect","ownerDocument","documentElement","pageXOffset","clientLeft","pageYOffset","clientTop","enableHotkeys","allowTranslation","allow","allowAltObjFreeRotation","keysTranslateObj","isEditingAltObj","convertMouseToOnCircle","pageX","pageY","screenSize","convertMouseToViewport","rotateByMouse","aboutZAxis","getOrientation","setOrientation","getScale","setScale","curTime","_lastMouseMoveTime","speedX","speedY","altObj","button","workWithAltObj","altKey","ctrlKey","shiftKey","translatePivotByMouse","wheelDelta","detail","touches","_touchDistanceCur","_touchDistanceStart","_scaleStart","keyCode","translatePivotInWorld","setX","setY","setZ","translatePivot","setPivot","newPivot","Picker","_lastMousePos","_mouseTotalDist","_lastClickBeginTime","_lastClickPos","_clickBeginTime","touchstart","touchend","picked","pickObject","screenPos","rayCaster","unproject","fogFarValue","getMouseInViewport","curPos","_lastTouchdownPos","changedTouches","targetCamera","_target","_targetCamera","_object","_full","autoClear","setViewport","secTypes","cSecNames","_createSecondary","strArray","nRes","resid","rIdx","fromUInt20ToInt20","uint20","FrameInfo","payload","callbacks","isLoading","_framesRange","frameIsReady","_frameRequest","_callbacks","_framesRequestLength","_downloadDataFn","parseBinaryData","setFrame","_prepareBuffer","framesStart","framesEnd","_framesCount","onDone","onLoadStatusChanged","onFail","onError","_parseBuffer","_bufferRequestStart","arrayBuffer","dataView","atomsCount","framesCount","_atomsCount","chunkedFramesCount","timeStep","iName","_timeStep","posData","coordIdx","secondaryArr","hiWord","loWord","_secondaryData","nextFrame","_currFrame","_updateSecondary","myResidues","sec","oldSec","nSec","compRes","getSec","frameIdx","_cachedResidues","disableEvents","vec","_vec","SceneObject","getGeometry","LinesObj","_id1","_id2","_getAtomFromName","_atom1","_atom2","_line","computeLineDistances","_raycaster","_intersects","verticesNeedUpdate","OutlineMaterial","srcDepthTex","srcTexSize","DEPTH_OUTLINE","FXAAMaterial","bgTransparent","BG_TRANSPARENT","AOMaterial","diffuseTexture","normalTexture","depthTexture","camNearFar","projMatrix","kernelRadius","depthThreshold","_kernelOffsets","AOHorBlurMaterial","aoMap","samplesOffsets","AOVertBlurWithBlendMaterial","fogNearFar","useFog","AnaglyphMaterial","srcL","srcR","View","orientation","ViewInterpolator","setup","startView","endView","_endTime","_isPaused","_srcView","_dstView","_isMoving","isMoving","wasStarted","transTime","_transitionTime","getCurrentView","success","createView","slerp","pause","resume","Cookies","removeCookie","cntKey","_toCount","cntVal","_getSimpleCookie","_removeSimpleCookie","setCookie","chunkLen","lc","_chunkString","_setSimpleCookie","getCookie","cookie","_getExpirationDate","today","setFullYear","toUTCString","_exists","webVRPoC","stylizeElement","bottom","padding","border","font","xr","isSessionSupported","then","supported","cursor","currentSession","onSessionEnded","onSessionStarted","session","_gfx","setReferenceSpaceType","setSession","onmouseenter","onmouseleave","onclick","sessionInit","optionalFeatures","requestSession","moveSceneBehindHeadset","showEnterVR","showWebXRNotFound","textDecoration","WebVRPoC","onToggle","_mainCamera","_button","_onToggle","_molContainer","_user","_scalingPivot","_controller1","_controller2","_pressedGripsCounter","_distance","startScalingByControllers","stopScalingByControllers","handleGripsDown","handleGripsUp","gfx","createWebVRButton","_mainFog","_plugVRNodesIntoScene","_setControllersListeners","getController","_createControllerMesh","disable","setAnimationLoop","getSession","_unplugVRNodesFromScene","cylinder","rotateX","updateMoleculeScale","scaler","container","getCanvas","EDIT_MODE","LOADER_NOT_FOUND","removeExtension","reportProgress","log","percent","chooseFogColor","Miew","settingsCookie","cookiePath","_interpolator","_container","getElementById","getElementsByClassName","_containerRoot","_running","_halting","_building","_needRender","_hotKeysEnabled","_cookies","_spinner","_loading","_animInterval","_visuals","_curVisualName","_sourceWindow","registeredPlugins","_initOnSettingsChanged","_setContainerContents","arezSpritesSupported","getExtension","isAOSupported","getMaxRepresentationCount","_updateShadowCamera","shadowMatrix","OBB","halfSize","light","getOBB","class","frag","createDocumentFragment","_msgMode","_msgAtomInfo","_showMessage","_initGfx","_initListeners","_onKeyDown","_onKeyUp","_objectControls","_getAltObj","_picker","_onPick","file","keepRepsInfo","job","halt","msg","_showCanvas","_requestAnimationFrame","requestAnimationFrame","clientWidth","clientHeight","webGLOptions","preserveDrawingBuffer","premultipliedAlpha","renderer2d","CSS2DRenderer","shadowMap","autoUpdate","getContext","setPixelRatio","devicePixelRatio","setClearColor","clearColor","stereoCam","selectionScene","selectionRoot","selectionPivot","light12","pixelRatio","getPixelRatio","shadowMapSize","mapSize","light3","Axes","deviceWidth","deviceHeight","offscreenBuf","minFilter","magFilter","depthBuffer","offscreenBuf2","offscreenBuf3","offscreenBuf4","volBFTex","volFFTex","volWFFTex","offscreenBuf5","offscreenBuf6","offscreenBuf7","stereoBufL","stereoBufR","_embedWebXR","stats","Stats","_fps","_onResize","_makeUniqueVisualName","baseName","random","suffix","_addVisual","_removeVisual","_forEachVisual","_releaseAllVisuals","_forEachComplexVisual","_getComplexVisual","any","_getVolumeVisual","VolumeVisual","_getVisualForComplex","getVisuals","getComplexVisualsCount","getCurrentVisual","setCurrentVisual","run","_onTick","_discardComponentEdit","_discardFragmentEdit","enableHotKeys","_resizeOffscreenBuffers","isAnaglyph","multi","_onUpdate","_onRender","_getBSphereRadius","_bSphereForOneVisual","_bBoxForOneVisual","_bBox","_invMatrix","_points","union","_updateFog","_setUberMaterialValues","isScriptingCommandAvailable","callNextCmd","_needRebuild","_updateView","webVR","_clipPlaneUpdateValue","_fogFarUpdateValue","setRenderTarget","_renderFrame","_anaglyphMat","_size","focus","_renderShadowMap","_renderScene","setScissorTest","setScissor","cameraL","cameraR","_onBgColorChanged","_onFogColorChanged","_enableMRT","renderBuffer","textureBuffer","gl","drawBuffersWEBGL","COLOR_ATTACHMENT0","tx8","__webglTexture","bindTexture","TEXTURE_2D","fb","__webglFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT1_WEBGL","distortion","bHaveComplexes","volumeVisual","ssao","_renderWithPrepassTransparency","dstBuffer","srcBuffer","_performAO","_renderOutline","_renderSelection","_renderVolume","_performFXAA","_performDistortion","aberration","targetBuffer","_outlineMaterial","srcDepthBuffer","srcColorBuffer","currentRenderTarget","getRenderTarget","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","setBlending","buffers","setClear","setTest","updateMatrices","_hasSelectionToRender","selPivot","_checkVolumeRenderingSupport","renderTarget","oldRT","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","volumeBFMat","volumeFFMat","cubeOffsetMat","world2colorMat","volumeRenderingSupported","dstBuf","tmpBuf1","tmpBuf2","tmpBuf3","overrideMaterial","colorMask","_fxaaMaterial","_aoMaterial","_horBlurMaterial","_vertBlurMaterial","_scale","normalBuffer","srcDepthTexture","tempBuffer","tempBuffer1","_lastPick","_setEditMode","_resetObjects","setNeedRender","_resetScene","resetPivot","resetView","_export","TheExporter","io","rePdbId","rePubchem","reUrlScheme","_fetchData","matchesPdbId","sourceType","matchesPubchem","compound","resolveSourceShortcut","TheLoader","fileExt","TheParser","updateBinaryMode","newOptions","keyCount","loader","lengthComputable","total","loaded","catch","onLoadEnd","anything","jobIndex","_refreshTitle","dataSet","_parseData","_onLoad","err","unload","_startAnimation","fileData","_stopAnimation","_frameInfo","isPlaying","_isAnimating","_continueAnimation","_pauseAnimation","clearInterval","minFrameTime","setInterval","_updateObjsToFrame","visualName","amberFileName","hasValidRes","hasValidResidues","resetEd","_onLoadEd","_tweakResolution","_edLoader","loadEd","_rebuildObjects","toRemove","unitIdx","currentUnitInfo","_updateInfoPanel","rebuildActions","appendix","_extractRepresentation","defPreset","_setReps","presList","newIdx","_editMode","getElementsByTagName","_enterComponentEditMode","editors","_editors","_applyComponentEdit","_enterFragmentEditMode","selectedVisuals","_applyFragmentEdit","_updateSelection","firstLine","secondLine","aName","coordLine","nextAltObj","setPivotResidue","amount","setPivotAtom","_centerInVisual","setPivotSubset","_includesInCurSelection","_includesInSelector","screenshot","getDataURL","dataURL","canvas","canvasContext","drawImage","toDataURL","screenshotURI","areaOfInterestTanFov2","shotAspect","setDrawingBufferSize","uri","save","dataString","maxPerf","_gfxScore","_autoChangeResolution","setOptions","objData","bThrow","Ctor","LinesObject","_addSceneObject","sceneObject","objs","getState","compact","getScript","_compareReps","compareWithDefaults","currPreset","repsDiff","emptyReps","repsInfo","objectsState","_updateShadowmapMeshes","_updateMaterials","_fogAlphaChanged","evt","Boolean","sel","euler","setFromQuaternion","srcView","dstView","setFromEuler","None","projected","fullAtomName","complexName","project","exportCML","extractBasis","retMat","makeBasis","extractRotation","xml","removeAttribute","sGroup","updateCMLData","XMLSerializer","serializeToString","curChainName","curChainColor","PACKAGE_VERSION","thirdParty","lodash","three","modeIdDesc","$help","colorDesc","materialDesc","addRepDesc","setGetParameterDesc","PDBID","REP_NAME","DESCRIPTION","REP_INDEX","EXPRESSION","MODE_ID","COLORER_ID","MATERIAL_ID","new","del","PARAMETER","set_save","set_restore","set_reset","PRESET","ENCODED_VIEW","removeobj","listobj","NULL","representationsStorage","representationMap","representationID","strId","sortedKeys","utilFunctions","repMap","repName","selectionStr","strList","joinHelpStr","helpData","clihelp","helpItem","awaitWhileCMDisInProcess","finishAwaitingCMDInProcess","modificate","modificators","modificator","argExc","endsWith","cliUtils","cmd","cliutils","_val","notimplemented","script","_printCallback","_errorCallback","parsercli","cmdQueue","commandInAction"],"sourceRoot":""} \ No newline at end of file diff --git a/packages/miew/dist/Miew.module.js b/packages/miew/dist/Miew.module.js index d82596d26..5ab8b4fd6 100644 --- a/packages/miew/dist/Miew.module.js +++ b/packages/miew/dist/Miew.module.js @@ -1,40041 +1,35424 @@ -/** Miew - 3D Molecular Viewer v0.9.0 Copyright (c) 2015-2020 EPAM Systems, Inc. */ +/*! Miew - 3D Molecular Viewer v0.11.0-0 Copyright (c) 2015-2024 EPAM Systems, Inc. */ +import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash"; +import * as __WEBPACK_EXTERNAL_MODULE_three__ from "three"; +/******/ var __webpack_modules__ = ({ -import _ from 'lodash'; -import * as THREE from 'three'; -import { Vector3, Box3, Sphere, Math as Math$1, Vector2, DataTexture, LuminanceFormat, UnsignedByteType, UVMapping, ClampToEdgeWrapping, LinearFilter, Object3D, Group, RGBFormat, RepeatWrapping, NearestFilter, UniformsUtils, UniformsLib, Color, Matrix4, RawShaderMaterial, Material, DoubleSide, WebGLRenderer, MeshBasicMaterial, Scene, Mesh as Mesh$5, PlaneBufferGeometry, OrthographicCamera, PerspectiveCamera, StereoCamera, Raycaster, BufferAttribute, LineSegments, Line, LessEqualDepth, InstancedBufferGeometry, InstancedBufferAttribute, BufferGeometry, SphereBufferGeometry, Triangle as Triangle$1, Face3, Matrix3, CylinderBufferGeometry as CylinderBufferGeometry$1, Uint16BufferAttribute, Ray, ShaderMaterial, FrontSide, BackSide, Vector4, Plane, Geometry, LineBasicMaterial, Layers, Quaternion, AxesHelper, CylinderGeometry, PCFShadowMap, Fog, DirectionalLight, DirectionalLightShadow, AmbientLight, WebGLRenderTarget, RGBAFormat, DepthTexture, UnsignedShortType, FloatType, NoBlending, Euler } from 'three'; +/***/ 89: +/***/ ((module) => { -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} - -var arrayWithHoles = _arrayWithHoles; - -function _iterableToArrayLimit(arr, i) { - if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { - return; - } - - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; -} - -var iterableToArrayLimit = _iterableToArrayLimit; - -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); -} - -var nonIterableRest = _nonIterableRest; - -function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest(); -} - -var slicedToArray = _slicedToArray; - -var __assign = (undefined && undefined.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var defaults = { - lines: 12, - length: 7, - width: 5, - radius: 10, - scale: 1.0, - corners: 1, - color: '#000', - fadeColor: 'transparent', - animation: 'spinner-line-fade-default', - rotate: 0, - direction: 1, - speed: 1, - zIndex: 2e9, - className: 'spinner', - top: '50%', - left: '50%', - shadow: '0 0 1px transparent', - position: 'absolute', -}; -var Spinner = /** @class */ (function () { - function Spinner(opts) { - if (opts === void 0) { opts = {}; } - this.opts = __assign(__assign({}, defaults), opts); - } - /** - * Adds the spinner to the given target element. If this instance is already - * spinning, it is automatically removed from its previous target by calling - * stop() internally. - */ - Spinner.prototype.spin = function (target) { - this.stop(); - this.el = document.createElement('div'); - this.el.className = this.opts.className; - this.el.setAttribute('role', 'progressbar'); - css(this.el, { - position: this.opts.position, - width: 0, - zIndex: this.opts.zIndex, - left: this.opts.left, - top: this.opts.top, - transform: "scale(" + this.opts.scale + ")", - }); - if (target) { - target.insertBefore(this.el, target.firstChild || null); - } - drawLines(this.el, this.opts); - return this; - }; - /** - * Stops and removes the Spinner. - * Stopped spinners may be reused by calling spin() again. - */ - Spinner.prototype.stop = function () { - if (this.el) { - if (typeof requestAnimationFrame !== 'undefined') { - cancelAnimationFrame(this.animateId); - } - else { - clearTimeout(this.animateId); - } - if (this.el.parentNode) { - this.el.parentNode.removeChild(this.el); - } - this.el = undefined; - } - return this; - }; - return Spinner; -}()); -/** - * Sets multiple style properties at once. - */ -function css(el, props) { - for (var prop in props) { - el.style[prop] = props[prop]; - } - return el; -} -/** - * Returns the line color from the given string or array. - */ -function getColor(color, idx) { - return typeof color == 'string' ? color : color[idx % color.length]; -} -/** - * Internal method that draws the individual lines. - */ -function drawLines(el, opts) { - var borderRadius = (Math.round(opts.corners * opts.width * 500) / 1000) + 'px'; - var shadow = 'none'; - if (opts.shadow === true) { - shadow = '0 2px 4px #000'; // default shadow - } - else if (typeof opts.shadow === 'string') { - shadow = opts.shadow; - } - var shadows = parseBoxShadow(shadow); - for (var i = 0; i < opts.lines; i++) { - var degrees = ~~(360 / opts.lines * i + opts.rotate); - var backgroundLine = css(document.createElement('div'), { - position: 'absolute', - top: -opts.width / 2 + "px", - width: (opts.length + opts.width) + 'px', - height: opts.width + 'px', - background: getColor(opts.fadeColor, i), - borderRadius: borderRadius, - transformOrigin: 'left', - transform: "rotate(" + degrees + "deg) translateX(" + opts.radius + "px)", - }); - var delay = i * opts.direction / opts.lines / opts.speed; - delay -= 1 / opts.speed; // so initial animation state will include trail - var line = css(document.createElement('div'), { - width: '100%', - height: '100%', - background: getColor(opts.color, i), - borderRadius: borderRadius, - boxShadow: normalizeShadow(shadows, degrees), - animation: 1 / opts.speed + "s linear " + delay + "s infinite " + opts.animation, - }); - backgroundLine.appendChild(line); - el.appendChild(backgroundLine); - } -} -function parseBoxShadow(boxShadow) { - var regex = /^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/; - var shadows = []; - for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) { - var shadow = _a[_i]; - var matches = shadow.match(regex); - if (matches === null) { - continue; // invalid syntax - } - var x = +matches[2]; - var y = +matches[5]; - var xUnits = matches[4]; - var yUnits = matches[7]; - if (x === 0 && !xUnits) { - xUnits = yUnits; - } - if (y === 0 && !yUnits) { - yUnits = xUnits; - } - if (xUnits !== yUnits) { - continue; // units must match to use as coordinates - } - shadows.push({ - prefix: matches[1] || '', - x: x, - y: y, - xUnits: xUnits, - yUnits: yUnits, - end: matches[8], - }); - } - return shadows; -} -/** - * Modify box-shadow x/y offsets to counteract rotation - */ -function normalizeShadow(shadows, degrees) { - var normalized = []; - for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) { - var shadow = shadows_1[_i]; - var xy = convertOffset(shadow.x, shadow.y, degrees); - normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end); - } - return normalized.join(', '); -} -function convertOffset(x, y, degrees) { - var radians = degrees * Math.PI / 180; - var sin = Math.sin(radians); - var cos = Math.cos(radians); - return [ - Math.round((x * cos + y * sin) * 1000) / 1000, - Math.round((-x * sin + y * cos) * 1000) / 1000, - ]; -} - -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -var classCallCheck = _classCallCheck; - -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -var createClass = _createClass; - -//---------------------------------------------------------------------------- -// Timer -var Timer = /*#__PURE__*/function () { - function Timer() { - classCallCheck(this, Timer); - - this.startTime = 0; - this.oldTime = 0; - this.elapsedTime = 0; - this.running = false; - } - - createClass(Timer, [{ - key: "start", - value: function start() { - this.startTime = Timer.now(); - this.oldTime = this.startTime; - this.running = true; - } - }, { - key: "stop", - value: function stop() { - this.getElapsedTime(); - this.running = false; - } - }, { - key: "getElapsedTime", - value: function getElapsedTime() { - this.update(); - return this.elapsedTime; - } - }, { - key: "update", - value: function update() { - var delta = 0; - - if (this.running) { - var newTime = Timer.now(); - delta = 0.001 * (newTime - this.oldTime); - this.oldTime = newTime; - this.elapsedTime += delta; - } - - return delta; - } - }]); - - return Timer; -}(); - -Timer.now = function () { - var p = typeof window !== 'undefined' && window.performance; - return p && p.now ? p.now.bind(p) : Date.now; -}(); - -var now = Timer.now; - -function createElement(tag, id, css) { - var element = document.createElement(tag); - element.id = id; - element.style.cssText = css; - return element; -} - -var Stats = /*#__PURE__*/function () { - function Stats() { - classCallCheck(this, Stats); +/* eslint-disable */ +// DO NOT EDIT! Automatically generated from .jison +/* parser generated by jison 0.4.18 */ +/* + Returns a Parser object of the following structure: - this.domElement = createElement('div', 'stats', 'padding:8px'); - this._text = createElement('p', 'fps', 'margin:0;color:silver;font-size:large'); - this.domElement.appendChild(this._text); - this._startTime = now(); - this._prevTime = this._startTime; - this._deltas = new Array(20); - this._index = 0; - this._total = 0.0; - this._count = 0; + Parser: { + yy: {} } - createClass(Stats, [{ - key: "end", - value: function end() { - var time = now(); - var delta = time - this._startTime; - - if (this._count < this._deltas.length) { - this._count++; - } else { - this._total -= this._deltas[this._index]; - } - - this._total += delta; - this._deltas[this._index] = delta; - this._index = (this._index + 1) % this._deltas.length; - this.ms = this._total / this._count; - this.fps = 1000 / this.ms; + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), - if (time > this._prevTime + 1000) { - this._text.textContent = this.fps.toPrecision(2); - this._prevTime = time; - } + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), - return time; - } - }, { - key: "update", - value: function update() { - this._startTime = this.end(); - } - }, { - key: "show", - value: function show(on) { - if (on === undefined) { - on = true; - } + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, - this.domElement.style.display = on ? 'block' : 'none'; + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, } - }]); - - return Stats; -}(); - -var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - -function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; -} - -var _typeof_1 = createCommonjsModule(function (module) { -function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - module.exports = _typeof = function _typeof(obj) { - return typeof obj; - }; - } else { - module.exports = _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; } - return _typeof(obj); -} - -module.exports = _typeof; -}); -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } - return self; -} - -var assertThisInitialized = _assertThisInitialized; -function _possibleConstructorReturn(self, call) { - if (call && (_typeof_1(call) === "object" || typeof call === "function")) { - return call; + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) } - - return assertThisInitialized(self); -} - -var possibleConstructorReturn = _possibleConstructorReturn; - -var getPrototypeOf = createCommonjsModule(function (module) { -function _getPrototypeOf(o) { - module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} - -module.exports = _getPrototypeOf; -}); - -var setPrototypeOf = createCommonjsModule(function (module) { -function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); -} - -module.exports = _setPrototypeOf; -}); - -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } +*/ +var parser = function () { + var o = function (k, v, o, l) { + for (o = o || {}, l = k.length; l--; o[k[l]] = v); + return o; + }, + $V0 = [1, 60], + $V1 = [1, 62], + $V2 = [1, 63], + $V3 = [1, 65], + $V4 = [1, 66], + $V5 = [1, 67], + $V6 = [1, 68], + $V7 = [1, 69], + $V8 = [1, 80], + $V9 = [1, 72], + $Va = [1, 73], + $Vb = [1, 74], + $Vc = [1, 75], + $Vd = [1, 99], + $Ve = [1, 76], + $Vf = [1, 100], + $Vg = [1, 79], + $Vh = [1, 51], + $Vi = [1, 81], + $Vj = [1, 82], + $Vk = [1, 84], + $Vl = [1, 83], + $Vm = [1, 85], + $Vn = [1, 96], + $Vo = [1, 97], + $Vp = [1, 98], + $Vq = [1, 86], + $Vr = [1, 87], + $Vs = [1, 64], + $Vt = [1, 70], + $Vu = [1, 71], + $Vv = [1, 77], + $Vw = [1, 78], + $Vx = [1, 53], + $Vy = [1, 54], + $Vz = [1, 55], + $VA = [1, 61], + $VB = [1, 88], + $VC = [1, 89], + $VD = [1, 90], + $VE = [1, 91], + $VF = [1, 92], + $VG = [1, 93], + $VH = [1, 94], + $VI = [1, 95], + $VJ = [1, 101], + $VK = [1, 102], + $VL = [1, 103], + $VM = [1, 104], + $VN = [1, 105], + $VO = [1, 56], + $VP = [1, 57], + $VQ = [1, 58], + $VR = [1, 59], + $VS = [1, 115], + $VT = [1, 111], + $VU = [1, 114], + $VV = [1, 112], + $VW = [1, 113], + $VX = [1, 118], + $VY = [1, 117], + $VZ = [1, 134], + $V_ = [1, 149], + $V$ = [1, 150], + $V01 = [1, 157], + $V11 = [5, 6, 7, 9, 13, 14, 15, 17, 18, 19, 20, 23, 25, 26, 27, 30, 33, 34, 35, 37, 38, 41, 43, 45, 46, 49, 52, 54, 55, 56, 58, 59, 62, 64, 65, 66, 70, 72, 74, 77, 78, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101], + $V21 = [5, 6, 7, 9, 13, 14, 15, 17, 18, 19, 20, 23, 25, 26, 27, 30, 33, 34, 35, 37, 38, 41, 43, 45, 46, 49, 52, 54, 55, 56, 58, 59, 62, 64, 65, 66, 70, 71, 72, 74, 77, 78, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101], + $V31 = [5, 6, 7, 9, 13, 15, 17, 18, 19, 20, 23, 25, 26, 27, 30, 33, 34, 37, 38, 41, 43, 45, 46, 49, 52, 54, 55, 56, 58, 59, 62, 64, 65, 66, 70, 72, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + $V41 = [5, 70, 72], + $V51 = [5, 74], + $V61 = [71, 101]; + var parser = { + trace: function trace() {}, + yy: {}, + symbols_: { + "error": 2, + "Program": 3, + "Command": 4, + "EOF": 5, + "RESET": 6, + "BUILD": 7, + "ALL": 8, + "HELP": 9, + "Path": 10, + "MOTM": 11, + "OneArgCommand": 12, + "GET": 13, + "STRING": 14, + "SET": 15, + "Value": 16, + "SET_SAVE": 17, + "SET_RESTORE": 18, + "SET_RESET": 19, + "PRESET": 20, + "AddRepresentation": 21, + "EditRepresentation": 22, + "REMOVE": 23, + "RepresentationReference": 24, + "HIDE": 25, + "SHOW": 26, + "LIST": 27, + "EXPAND_KEY": 28, + "SELECTOR_KEY": 29, + "SELECT": 30, + "AS": 31, + "WordAll": 32, + "SELECTOR": 33, + "WITHIN": 34, + "NUMBER": 35, + "OF": 36, + "MATERIAL": 37, + "IDENTIFIER": 38, + "ModeCMD": 39, + "ColorCMD": 40, + "VIEW": 41, + "BASE_64": 42, + "UNIT": 43, + "DSSP": 44, + "SCALE": 45, + "ROTATE": 46, + "AxesList": 47, + "TRANSLATE": 48, + "CENTER": 49, + "GetURLBranch": 50, + "Screenshot": 51, + "LINE": 52, + "ArgList": 53, + "LISTOBJ": 54, + "REMOVEOBJ": 55, + "URL": 56, + "VIEW_KEY": 57, + "SCREENSHOT": 58, + "LOAD": 59, + "Url": 60, + "FILE_KEY": 61, + "ADD": 62, + "Description": 63, + "REP": 64, + "MODE": 65, + "COLOR": 66, + "Descriptor": 67, + "RepresentationOwnProperty": 68, + "RepresentationOwnPropertyOpts": 69, + "DESC_KEY": 70, + "=": 71, + "DESC_KEY_OPTS": 72, + "AxesArg": 73, + "DESC_KEY_AXES": 74, + "Arg": 75, + "PathWoDescKey": 76, + "HEX": 77, + "BOOL": 78, + "Word": 79, + "CommandSetWoDESC_KEY": 80, + "DescKeys": 81, + "CLEAR": 82, + "FILE_LIST": 83, + "FILE_REGISTER": 84, + "FILE_DELETE": 85, + "PRESET_ADD": 86, + "PRESET_DELETE": 87, + "PRESET_UPDATE": 88, + "PRESET_RENAME": 89, + "PRESET_OPEN": 90, + "CREATE_SCENARIO": 91, + "RESET_SCENARIO": 92, + "DELETE_SCENARIO": 93, + "ADD_SCENARIO_ITEM": 94, + "LIST_SCENARIO": 95, + "PDB_KEY": 96, + "DELAY_KEY": 97, + "PRST_KEY": 98, + "DESCRIPTION_KEY": 99, + "CommandSet": 100, + ".": 101, + "PresetPath": 102, + "/": 103, + "HexOrNumber": 104, + "$accept": 0, + "$end": 1 + }, + terminals_: { + 2: "error", + 5: "EOF", + 6: "RESET", + 7: "BUILD", + 8: "ALL", + 9: "HELP", + 11: "MOTM", + 13: "GET", + 14: "STRING", + 15: "SET", + 17: "SET_SAVE", + 18: "SET_RESTORE", + 19: "SET_RESET", + 20: "PRESET", + 23: "REMOVE", + 25: "HIDE", + 26: "SHOW", + 27: "LIST", + 28: "EXPAND_KEY", + 29: "SELECTOR_KEY", + 30: "SELECT", + 31: "AS", + 33: "SELECTOR", + 34: "WITHIN", + 35: "NUMBER", + 36: "OF", + 37: "MATERIAL", + 38: "IDENTIFIER", + 41: "VIEW", + 42: "BASE_64", + 43: "UNIT", + 44: "DSSP", + 45: "SCALE", + 46: "ROTATE", + 48: "TRANSLATE", + 49: "CENTER", + 52: "LINE", + 54: "LISTOBJ", + 55: "REMOVEOBJ", + 56: "URL", + 57: "VIEW_KEY", + 58: "SCREENSHOT", + 59: "LOAD", + 61: "FILE_KEY", + 62: "ADD", + 64: "REP", + 65: "MODE", + 66: "COLOR", + 70: "DESC_KEY", + 71: "=", + 72: "DESC_KEY_OPTS", + 74: "DESC_KEY_AXES", + 77: "HEX", + 78: "BOOL", + 82: "CLEAR", + 83: "FILE_LIST", + 84: "FILE_REGISTER", + 85: "FILE_DELETE", + 86: "PRESET_ADD", + 87: "PRESET_DELETE", + 88: "PRESET_UPDATE", + 89: "PRESET_RENAME", + 90: "PRESET_OPEN", + 91: "CREATE_SCENARIO", + 92: "RESET_SCENARIO", + 93: "DELETE_SCENARIO", + 94: "ADD_SCENARIO_ITEM", + 95: "LIST_SCENARIO", + 96: "PDB_KEY", + 97: "DELAY_KEY", + 98: "PRST_KEY", + 99: "DESCRIPTION_KEY", + 101: ".", + 103: "/" + }, + productions_: [0, [3, 2], [3, 1], [4, 1], [4, 1], [4, 2], [4, 1], [4, 2], [4, 1], [4, 1], [4, 2], [4, 2], [4, 3], [4, 3], [4, 1], [4, 1], [4, 1], [4, 1], [4, 2], [4, 1], [4, 1], [4, 2], [4, 2], [4, 2], [4, 2], [4, 1], [4, 2], [4, 2], [4, 2], [4, 4], [4, 2], [4, 6], [4, 2], [4, 1], [4, 1], [4, 1], [4, 2], [4, 2], [4, 1], [4, 2], [4, 1], [4, 2], [4, 2], [4, 2], [4, 1], [4, 2], [4, 1], [4, 1], [4, 3], [4, 3], [4, 4], [4, 4], [4, 1], [4, 2], [50, 1], [50, 2], [50, 2], [50, 3], [50, 3], [51, 1], [51, 2], [51, 3], [12, 2], [12, 2], [12, 2], [21, 1], [21, 2], [21, 2], [21, 3], [22, 2], [22, 3], [39, 2], [39, 3], [40, 2], [40, 3], [24, 1], [24, 1], [63, 1], [63, 2], [63, 3], [63, 4], [67, 1], [67, 1], [67, 2], [68, 3], [69, 3], [47, 1], [47, 2], [73, 2], [53, 1], [53, 2], [75, 3], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [79, 1], [79, 1], [32, 1], [32, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [81, 1], [81, 1], [81, 1], [81, 1], [81, 1], [81, 1], [81, 1], [100, 1], [100, 1], [76, 1], [76, 3], [76, 3], [10, 1], [10, 1], [10, 3], [10, 3], [10, 3], [60, 1], [102, 1], [102, 3], [104, 1], [104, 1]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { + /* this == yyval */ - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) setPrototypeOf(subClass, superClass); -} - -var inherits = _inherits; - -function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; -} - -var isNativeFunction = _isNativeFunction; - -var construct = createCommonjsModule(function (module) { -function isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); - return true; - } catch (e) { - return false; - } -} - -function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - module.exports = _construct = Reflect.construct; - } else { - module.exports = _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - - return _construct.apply(null, arguments); -} - -module.exports = _construct; -}); - -var wrapNativeSuper = createCommonjsModule(function (module) { -function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - - module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !isNativeFunction(Class)) return Class; - - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - - _cache.set(Class, Wrapper); - } - - function Wrapper() { - return construct(Class, arguments, getPrototypeOf(this).constructor); - } - - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return setPrototypeOf(Wrapper, Class); - }; - - return _wrapNativeSuper(Class); -} - -module.exports = _wrapNativeSuper; -}); - -/** - * This class introduces the simplest event system. - */ - -function isUndefOrEqual(param, value) { - return !param || param === value; -} -/** - * Creates empty dispatcher. - * - * @exports EventDispatcher - * @constructor - */ - - -function EventDispatcher() { - this._handlers = {}; -} -/** - * Binds callback on specific event type. Optional `context` parameter - * could be used as 'this' for the `callback`. - * @param {string} type Event name. - * @param {function} callback Callback function. - * @param {Object} [context] 'This' object for the callback. - */ - - -EventDispatcher.prototype.addEventListener = function (type, callback, context) { - var handlers = this._handlers[type]; - - if (!handlers) { - this._handlers[type] = []; - handlers = this._handlers[type]; - } - - var params = [callback, context]; - - function _checkPar(par) { - return par[0] === params[0] && par[1] === params[1]; - } - - if (_.find(handlers, _checkPar) === undefined) { - handlers.push(params); - } -}; -/** - * Removes a previously-bound callback function from an object. - * If no `context` is specified, all versions of the `callback` with different - * contexts will be removed. - * If no `callback` is specified, all callbacks of the `type` will be removed. - * If no `type` is specified, callbacks for all events will be removed. - * @param {?string} [type] Event type. - * @param {function} [callback] Callback function. - * @param {Object} [context] 'This' object for the callback. - */ - - -EventDispatcher.prototype.removeEventListener = function (type, callback, context) { - var self = this; - - _.forEach(self._handlers, function (handler, ev) { - _.remove(handler, function (values) { - return isUndefOrEqual(type, ev) && isUndefOrEqual(callback, values[0]) && isUndefOrEqual(context, values[1] || self); - }); - }); - - this._handlers = _.omitBy(self._handlers, function (handler) { - return handler.length === 0; - }); -}; -/** - * Makes all the callbacks for the specific `event` to trigger. - * @param {Object} event Event. - * @param {string} event.type Type of the event. - */ - - -EventDispatcher.prototype.dispatchEvent = function (event) { - var self = this; - - _.forEach(this._handlers[event.type], function (callback) { - var context = callback[1] || self; - callback[0].apply(context, [event]); - }); -}; - -/** - * This module contains class for logging. - * Returns an instance of a logger that have already been created. - * Allows users to log messages for five different levels, - * enable console output and catch signal on each message. - */ -var priorities = { - debug: 0, - info: 1, - report: 2, - warn: 3, - error: 4 -}; -/** - * Create new Logger. - * - * @exports Logger - * @extends EventDispatcher - * @constructor - */ - -function Logger() { - EventDispatcher.call(this); - /** Boolean flag that toggles output to browser console. - * @type {boolean} - */ - - this.console = false; - this._priority = priorities.warn; -} - -Logger.prototype = Object.create(EventDispatcher.prototype); -Logger.prototype.constructor = Logger; -/** - * Create new clean instance of the logger. - * @returns {Logger} - */ - -Logger.prototype.instantiate = function () { - return new Logger(); -}; - -function verify(number) { - if (!_.isNumber(number)) { - throw new Error('Wrong log level specified!'); - } - - return number; -} -/** - * @property {string} current threshold for signals and console output. - * @name Logger#level - */ - - -Object.defineProperty(Logger.prototype, 'level', { - get: function get() { - var _this = this; - - return _.findKey(priorities, function (value) { - return value === _this._priority; - }); - }, - set: function set(level) { - this._priority = verify(priorities[level]); - } -}); -/** - * Returns the list of all possible level values. - * @returns {Array} - */ - -Logger.prototype.levels = function () { - return Object.keys(priorities); -}; -/** - * Add new message with specified level. - * @param {string} level - level of the message, must be one of the - * {'debug' | 'info' | 'report' | 'warn' | 'error'} - * @param {string} message - */ - - -Logger.prototype.message = function (level, message) { - var priority = verify(priorities[level]); - - this._message(priority, message); -}; -/** - * Shortcut for message('debug', ...); - * @param message - */ - - -Logger.prototype.debug = function (message) { - this._message(priorities.debug, message); -}; -/** - * Shortcut for message('info', ...); - * @param message - */ - - -Logger.prototype.info = function (message) { - this._message(priorities.info, message); -}; -/** - * Shortcut for message('report', ...); - * @param message - */ - - -Logger.prototype.report = function (message) { - this._message(priorities.report, message); -}; -/** - * Shortcut for message('warn', ...); - * @param message - */ - - -Logger.prototype.warn = function (message) { - this._message(priorities.warn, message); -}; -/** - * Shortcut for message('error', ...); - * @param message - */ - - -Logger.prototype.error = function (message) { - this._message(priorities.error, message); -}; -/** - * Add new message with specified priority. - * @param {number} priority - priority of the message - * @param {string} message - * @private - */ - - -Logger.prototype._message = function (priority, message) { - if (priority < this._priority) { - return; - } - - var level = _.findKey(priorities, function (value) { - return value === priority; - }); - - message = String(message); - - if (this.console) { - var output = "miew:".concat(level, ": ").concat(message); - - if (level === 'error') { - console.error(output); // NOSONAR - } else if (level === 'warn') { - console.warn(output); // NOSONAR - } else { - console.log(output); // NOSONAR - } - } - - this.dispatchEvent({ - type: 'message', - level: level, - message: message - }); -}; - -var logger = new Logger(); - -var browserType = { - DEFAULT: 0, - SAFARI: 1 -}; //---------------------------------------------------------------------------- -// Query string - -/** - * Escape only dangerous chars in a query string component, use a plus instead of a space. - * - * [RFC 3986](https://tools.ietf.org/html/rfc3986) allows the following chars in the query (see 3.4): - * - * A-Z a-z 0-9 - _ . ~ ! $ & ' ( ) * + , ; = : @ / ? - * - * For query string elements we need to escape ampersand, equal sign, and plus, - * but encodeURIComponent() function encodes anything except for the following: - * - * A-Z a-z 0-9 - _ . ~ ! ' ( ) * - * - * @param {string} text - key or value to encode - * @param {string} excludeExp - regexp for symbols to exclude from encoding - * @returns {string} encoded string - */ - -function encodeQueryComponent(text, excludeExp) { - var encode = function encode(code) { - return String.fromCharCode(parseInt(code.substr(1), 16)); - }; - - return encodeURIComponent(text).replace(excludeExp, encode).replace(/%20/g, '+'); -} -/** - * Unescape dangerous chars in a query string component. - * - * @param {string} text - encoded key or value - * @returns {string} decoded string - * @see {@link encodeQueryComponent} - */ - - -function decodeQueryComponent(text) { - return decodeURIComponent(text.replace(/\+/g, ' ')); -} -/** - * Parse URL and extract an array of parameters. - * @param {string?} url - URL or query string to parse - * @returns {Array} array of (key, value) pairs. - */ - - -function getUrlParameters(url) { - url = url || window.location.search; - var query = url.substring(url.indexOf('?') + 1); - var search = /([^&=]+)=?([^&]*)/g; - var result = []; - var match; - - while ((match = search.exec(query)) !== null) { - // eslint-disable-line no-cond-assign - result.push([decodeQueryComponent(match[1]), decodeQueryComponent(match[2])]); - } - - return result; -} -/** - * Parse URL and extract an array of parameters as a hash. - * @param {string?} url - URL or query string to parse - * @returns {Object} - */ - - -function getUrlParametersAsDict(url) { - var result = {}; - var a = getUrlParameters(url); - - for (var i = 0; i < a.length; ++i) { - var _a$i = slicedToArray(a[i], 2), - key = _a$i[0], - value = _a$i[1]; - - result[key] = value; - } - - return result; -} - -function resolveURL(str) { - if (typeof URL !== 'undefined') { - try { - if (typeof window !== 'undefined') { - return new URL(str, window.location).href; - } - - return new URL(str).href; - } catch (error) {// IE 11 has a URL object with no constructor available so just try a different approach instead - } - } - - if (typeof document !== 'undefined') { - var anchor = document.createElement('a'); - anchor.href = str; - return anchor.href; - } - - return str; -} -/** - * Generates regular expression object that includes all symbols - * listed in the argument - * @param symbolStr {string} - String containing characters list. - * @returns {RegExp} - Regular expression. - */ - - -function generateRegExp(symbolStr) { - var symbolList = []; - - for (var i = 0, n = symbolStr.length; i < n; ++i) { - symbolList[symbolList.length] = symbolStr[i].charCodeAt(0).toString(16); - } - - var listStr = symbolList.join('|'); - return new RegExp("%(?:".concat(listStr, ")"), 'gi'); -} //---------------------------------------------------------------------------- -// Create HTML element - - -function createElement$1(tag, attrs, content) { - var element = document.createElement(tag); - var i; - var n; - - if (attrs) { - var keys = Object.keys(attrs); - - for (i = 0, n = keys.length; i < n; ++i) { - var key = keys[i]; - element.setAttribute(key, attrs[key]); - } - } - - if (content) { - if (!(content instanceof Array)) { - content = [content]; - } - - for (i = 0, n = content.length; i < n; ++i) { - var child = content[i]; - - if (typeof child === 'string') { - element.appendChild(document.createTextNode(child)); - } else if (child instanceof HTMLElement) { - element.appendChild(child); - } - } - } - - return element; -} //---------------------------------------------------------------------------- -// Easy inheritance - -/** - * Derive the class from the base. - * @param cls {function} - Class (constructor) to derive. - * @param base {function} - Class (constructor) to derive from. - * @param members {object=} - Optional instance members to add. - * @param statics {object=} - Optional static class members to add. - * @returns {function} Original class. - */ - - -function deriveClass(cls, base, members, statics) { - cls.prototype = _.assign(Object.create(base.prototype), { - constructor: cls - }, members); - - if (statics) { - _.assign(cls, statics); - } - - return cls; -} //---------------------------------------------------------------------------- -// Deep prototyping - - -function deriveDeep(obj, needZeroOwnProperties) { - var res = obj; - var i; - var n; - - if (obj instanceof Array) { - res = new Array(obj.length); - - for (i = 0, n = obj.length; i < n; ++i) { - res[i] = deriveDeep(obj[i]); - } - } else if (obj instanceof Object) { - res = Object.create(obj); - var keys = Object.keys(obj); - - for (i = 0, n = keys.length; i < n; ++i) { - var key = keys[i]; - var value = obj[key]; - var copy = deriveDeep(value); - - if (copy !== value) { - res[key] = copy; - } - } - - if (needZeroOwnProperties && Object.keys(res).length > 0) { - res = Object.create(res); - } - } - - return res; -} //---------------------------------------------------------------------------- -// Colors - - -function hexColor(color) { - var hex = "0000000".concat(color.toString(16)).substr(-6); - return "#".concat(hex); -} //---------------------------------------------------------------------------- -// Debug tracing - - -function DebugTracer(namespace) { - var enabled = false; - - this.enable = function (on) { - enabled = on; - }; - - var indent = 0; - var methods = Object.keys(namespace); - - function wrap(method_, name_) { - return function () { - var spaces = DebugTracer.spaces.substr(0, indent * 2); - - if (enabled) { - logger.debug("".concat(spaces + name_, " {")); - } - - indent++; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var result = method_.apply(this, args); // eslint-disable-line no-invalid-this - - indent--; - - if (enabled) { - logger.debug("".concat(spaces, "} // ").concat(name_)); - } - - return result; - }; - } - - for (var i = 0, n = methods.length; i < n; ++i) { - var name = methods[i]; - var method = namespace[name]; - - if (method instanceof Function && name !== 'constructor') { - namespace[name] = wrap(method, name); - } - } -} - -DebugTracer.spaces = ' '; - -var OutOfMemoryError = /*#__PURE__*/function (_Error) { - inherits(OutOfMemoryError, _Error); - - function OutOfMemoryError(message) { - var _this; - - classCallCheck(this, OutOfMemoryError); - - _this = possibleConstructorReturn(this, getPrototypeOf(OutOfMemoryError).call(this)); - _this.name = 'OutOfMemoryError'; - _this.message = message; - return _this; - } - - return OutOfMemoryError; -}( /*#__PURE__*/wrapNativeSuper(Error)); - -function allocateTyped(TypedArrayName, size) { - var result = null; - - try { - result = new TypedArrayName(size); - } catch (e) { - if (e instanceof RangeError) { - throw new OutOfMemoryError(e.message); - } else { - throw e; - } - } - - return result; -} //---------------------------------------------------------------------------- -// Float array conversion - - -function bytesToBase64( -/** ArrayBuffer */ -buffer) { - var bytes = new Uint8Array(buffer); - var binary = ''; - - for (var i = 0; i < bytes.byteLength; i++) { - binary += String.fromCharCode(bytes[i]); - } - - return window.btoa(binary); -} - -function bytesFromBase64( -/** string */ -str) { - var binary = window.atob(str); - var bytes = new Uint8Array(binary.length); - - for (var i = 0; i < bytes.length; ++i) { - bytes[i] = binary[i].charCodeAt(0); - } - - return bytes.buffer; -} - -function arrayToBase64( -/** number[] */ -array, -/** function */ -TypedArrayClass) { - return bytesToBase64(new TypedArrayClass(array).buffer); -} - -function arrayFromBase64( -/** string */ -str, -/** function */ -TypedArrayClass) { - return Array.prototype.slice.call(new TypedArrayClass(bytesFromBase64(str))); -} // NOTE: this is 1-level comparison - - -function compareOptionsWithDefaults(opts, defOpts) { - var optsStr = []; - - if (defOpts && opts) { - var keys = Object.keys(opts); - - for (var p = 0; p < keys.length; ++p) { - var key = keys[p]; - var value = opts[key]; // TODO add processing for tree structure - - if (!(value instanceof Object) && typeof defOpts[key] !== 'undefined' && defOpts[key] !== value) { - optsStr.push("".concat(key, ":").concat(value)); - } - } - - if (optsStr.length > 0) { - return "!".concat(optsStr.join()); - } - } - - return ''; -} - -function isAlmostPlainObject(o) { - if (_.isPlainObject(o)) { - return true; - } - - var proto = o && Object.getPrototypeOf(o); - return !!proto && !proto.hasOwnProperty('constructor') && isAlmostPlainObject(proto); -} -/** - * Build an object that contains properties (and subproperties) of `src` different from those - * in `dst`. Objects are parsed recursively, other values (including arrays) are compared for - * equality using `_.isEqual()`. - * @param {!object} src - a new object to compare, may contain changed or new properties - * @param {!object} dst - an old reference object - */ - - -function objectsDiff(src, dst) { - var diff = {}; - - _.forIn(src, function (srcValue, key) { - var dstValue = dst[key]; - - if (isAlmostPlainObject(srcValue) && isAlmostPlainObject(dstValue)) { - var deepDiff = objectsDiff(srcValue, dstValue); - - if (!_.isEmpty(deepDiff)) { - diff[key] = deepDiff; - } - } else if (!_.isEqual(srcValue, dstValue)) { - diff[key] = srcValue; - } - }); - - return diff; -} - -function forInRecursive(object, callback) { - function iterateThrough(obj, prefix) { - _.forIn(obj, function (value, key) { - var newPref = prefix + (prefix.length > 0 ? '.' : ''); - - if (value instanceof Object) { - iterateThrough(value, newPref + key); - } else if (value !== undefined) { - callback(value, newPref + key); - } - }); - } - - iterateThrough(object, ''); -} - -function enquoteString(value) { - if (_.isString(value)) { - return "\"".concat(value.replace(/"/g, '\\"'), "\""); - } - - return value; -} - -function unquoteString(value) { - if (!_.isString(value)) { - return value; - } - - if (value[0] === '"' && value[value.length - 1] === '"') { - value = value.slice(1, value.length - 1); - return value.replace(/\\"/g, '"'); - } - - if (value[0] === "'" && value[value.length - 1] === "'") { - value = value.slice(1, value.length - 1); - return value.replace(/\\'/g, "'"); - } - - throw new SyntaxError('Incorrect string format, can\'t unqute it'); -} - -function getFileExtension(fileName) { - return fileName.slice(Math.max(0, fileName.lastIndexOf('.')) || Infinity); -} - -function splitFileName(fileName) { - var ext = getFileExtension(fileName); - var name = fileName.slice(0, fileName.length - ext.length); - return [name, ext]; -} - -function dataUrlToBlob(url) { - var parts = url.split(/[:;,]/); - var partsCount = parts.length; - - if (partsCount >= 3 && parts[partsCount - 2] === 'base64') { - return new Blob([bytesFromBase64(parts[partsCount - 1])]); - } - - return null; -} - -function getBrowser() { - if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') === -1 && navigator.userAgent.indexOf('FxiOS') === -1) { - return browserType.SAFARI; - } - - return browserType.DEFAULT; -} - -function shotOpen(url) { - if (typeof window !== 'undefined') { - window.open().document.write("")); - } -} - -function shotDownload(dataUrl, filename) { - if (!dataUrl || dataUrl.substr(0, 5) !== 'data:') { - return; - } - - if (!filename) { - filename = ['screenshot-', +new Date(), '.png'].join(''); - } - - if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) { - window.navigator.msSaveBlob(dataUrlToBlob(dataUrl), filename); - } else if (typeof document !== 'undefined') { - var link = document.createElement('a'); - link.download = filename; - link.innerHTML = 'download'; - link.href = window.URL.createObjectURL(dataUrlToBlob(dataUrl)); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - } -} - -function download(data, filename, type) { - var blobData = new Blob([data]); - - if (!filename) { - filename = ['data', +new Date()].join(''); - } - - if (!type) { - filename += blobData.type || '.bin'; - } else { - filename += ".".concat(type); - } - - if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) { - window.navigator.msSaveBlob(blobData, filename); - } else if (typeof document !== 'undefined') { - var link = document.createElement('a'); - link.download = filename; - link.innerHTML = 'download'; - link.href = window.URL.createObjectURL(blobData); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - } -} - -function copySubArrays(src, dst, indices, itemSize) { - for (var i = 0, n = indices.length; i < n; ++i) { - for (var j = 0; j < itemSize; ++j) { - dst[i * itemSize + j] = src[indices[i] * itemSize + j]; - } - } -} - -function shallowCloneNode(node) { - var newNode = node.cloneNode(true); - newNode.worldPos = node.worldPos; // .style property is readonly, so "newNode.style = node.style;" won't work (and we don't need it, right?) - - return newNode; -} - -var unquotedStringRE = /^[a-zA-Z0-9_]*$/; -var enquoteHelper = ['"', '', '"']; // verify and correct if needed selctor identifier - -function correctSelectorIdentifier(value) { - if (unquotedStringRE.test(value)) { - return value; - } // quote incorrect identifier - - - enquoteHelper[1] = value; - return enquoteHelper.join(''); -} -/** - * Concatenates two TypedArray. Doesn't check null refs o type equality - * Attention! It must be use very rarely because requires memory reallocation every time. Use MergeTypedArraysUnsafe to - * unite array of subarrays. - * @param{TypedArray} first - destination array - * @param{TypedArray} second - source array - * @returns{TypedArray} resulting concatenated array - */ - - -function concatTypedArraysUnsafe(first, second) { - var result = new first.constructor(first.length + second.length); - result.set(first); - result.set(second, first.length); - return result; -} -/** - * Merges array of TypedArray into TypedArray. Doesn't check null refs o type equality - * @param{array} array - source array of subarrays - * @returns{TypedArray} resulting merged array - */ - - -function mergeTypedArraysUnsafe(array) { - if (array.length <= 0) { - return null; - } // count the size - - - var size = array.reduce(function (acc, cur) { - return acc + cur.length; - }, 0); // create combined array - - var result = new array[0].constructor(size); - - for (var i = 0, start = 0; i < array.length; i++) { - var count = array[i].length; - result.set(array[i], start); - start += count; - } - - return result; -} //---------------------------------------------------------------------------- -// Exports - - -var utils = { - browserType: browserType, - encodeQueryComponent: encodeQueryComponent, - decodeQueryComponent: decodeQueryComponent, - getUrlParameters: getUrlParameters, - getUrlParametersAsDict: getUrlParametersAsDict, - resolveURL: resolveURL, - generateRegExp: generateRegExp, - createElement: createElement$1, - deriveClass: deriveClass, - deriveDeep: deriveDeep, - hexColor: hexColor, - DebugTracer: DebugTracer, - OutOfMemoryError: OutOfMemoryError, - allocateTyped: allocateTyped, - bytesFromBase64: bytesFromBase64, - bytesToBase64: bytesToBase64, - arrayFromBase64: arrayFromBase64, - arrayToBase64: arrayToBase64, - compareOptionsWithDefaults: compareOptionsWithDefaults, - objectsDiff: objectsDiff, - forInRecursive: forInRecursive, - enquoteString: enquoteString, - unquoteString: unquoteString, - getBrowser: getBrowser, - shotOpen: shotOpen, - shotDownload: shotDownload, - copySubArrays: copySubArrays, - shallowCloneNode: shallowCloneNode, - correctSelectorIdentifier: correctSelectorIdentifier, - getFileExtension: getFileExtension, - splitFileName: splitFileName, - download: download, - concatTypedArraysUnsafe: concatTypedArraysUnsafe, - mergeTypedArraysUnsafe: mergeTypedArraysUnsafe -}; - -var JobHandle = /*#__PURE__*/function (_EventDispatcher) { - inherits(JobHandle, _EventDispatcher); - - function JobHandle() { - var _this; - - classCallCheck(this, JobHandle); - - _this = possibleConstructorReturn(this, getPrototypeOf(JobHandle).call(this)); - _this._shouldCancel = false; - return _this; - } - - createClass(JobHandle, [{ - key: "cancel", - value: function cancel() { - this._shouldCancel = true; - this.dispatchEvent({ - type: 'cancel' - }); - } - }, { - key: "shouldCancel", - value: function shouldCancel() { - return this._shouldCancel; - } // slaves use this to notify master about their events - // master routes these notifications to a single event slot - - }, { - key: "notify", - value: function notify(event) { - this.dispatchEvent({ - type: 'notification', - slaveEvent: event - }); - } - }]); - - return JobHandle; -}(EventDispatcher); - -var VERSION = 0; //---------------------------------------------------------------------------- -// DEFAULT SETTINGS -//---------------------------------------------------------------------------- - -/** - * Polygonal complexity settings. - * - * @typedef PolyComplexity - * @property {number} poor - * @property {number} low - * @property {number} medium - * @property {number} high - * @property {number} ultra - */ - -/** - * @alias SettingsObject - * @namespace - */ - -var defaults$1 = { - /** - * Default options for all available modes. - * Use {@link Mode.id} as a dictionary key to access mode options. - * - * Usually you don't need to override these settings. You may specify mode options as a parameter during - * {@link Mode} construction. - * - * @memberof SettingsObject# - * @type {Object.} - * - * @property {LinesModeOptions} LN - Lines mode options. - * @property {LicoriceModeOptions} LC - Licorice mode options. - * @property {BallsAndSticksModeOptions} BS - Balls and Sticks mode options. - * @property {VanDerWaalsModeOptions} VW - Van der Waals mode options. - * @property {TraceModeOptions} TR - Trace mode options. - * @property {TubeModeOptions} TU - Tube mode options. - * @property {CartoonModeOptions} CA - Cartoon mode options. - * @property {QuickSurfaceModeOptions} QS - Contact Surface mode options. - * @property {IsoSurfaceSASModeOptions} SA - Solvent Accessible Surface mode options. - * @property {IsoSurfaceSESModeOptions} SE - Solvent Excluded Surface mode options. - * @property {ContactSurfaceModeOptions} CS - Contact Surface mode options. - * @property {TextModeOptions} TX - Text mode options. - * @property {VolumeDensityModeOptions} VD - Volume Density mode options. - */ - modes: { - //---------------------------------------------------------------------------- - // BALLS AND STICKS - //---------------------------------------------------------------------------- - - /** - * Balls and Sticks mode options. - * - * @typedef BallsAndSticksModeOptions - * - * @property {number} atom - Sphere radius as a fraction of Van der Waals atom radius. - * @property {number} bond - Cylinder radius in angstroms. - * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all - * available space. - * @property {boolean} multibond - Toggles rendering of multiple ordered bonds. - * @property {number} aromrad - Minor radius of a torus for aromatic loops. - * @property {boolean} showarom - Toggles rendering of aromatic loops. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - BS: { - atom: 0.23, - bond: 0.15, - space: 0.5, - multibond: true, - aromrad: 0.1, - showarom: true, - polyComplexity: { - poor: 3, - low: 4, - medium: 6, - high: 12, - ultra: 32 - } - }, - //---------------------------------------------------------------------------- - // VAN DER WAALS - //---------------------------------------------------------------------------- - - /** - * Van der Waals mode options. - * - * @typedef VanDerWaalsModeOptions - * - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - VW: { - polyComplexity: { - poor: 4, - low: 6, - medium: 8, - high: 16, - ultra: 32 - } - }, - //---------------------------------------------------------------------------- - // LINES - //---------------------------------------------------------------------------- - - /** - * Lines mode options. - * - * @typedef LinesModeOptions - * - * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds. - * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops. - * @property {number} offsarom - Offset between bonds and aromatic cycle. - * @property {number} chunkarom - Number of pieces in a-loop arc, corresponding to atom. - * @property {number} atom - Collision radius for atoms picking. - * @property {number} lineWidth - Line width in pixels (not used in thin lines). - */ - LN: { - multibond: true, - showarom: true, - offsarom: 0.2, - chunkarom: 10, - atom: 0.23, - lineWidth: 2 - }, - //---------------------------------------------------------------------------- - // LICORICE - //---------------------------------------------------------------------------- - - /** - * Licorice mode options. - * - * @typedef LicoriceModeOptions - * - * @property {number} bond - Bond cylinder radius. - * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all - * available space. - * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds. - * @property {number} aromrad - Minor radius of a torus for aromatic loops. - * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops. - * @property {PolyComplexity} polyComplexity - Poly complexity values for render modes. - */ - LC: { - bond: 0.20, - space: 0.0, - multibond: true, - aromrad: 0.1, - showarom: true, - polyComplexity: { - poor: 3, - low: 4, - medium: 6, - high: 12, - ultra: 32 - } - }, - //---------------------------------------------------------------------------- - // SURFACE SAS - //---------------------------------------------------------------------------- - - /** - * Solvent Accessible Surface mode options. - * - * @typedef IsoSurfaceSASModeOptions - * - * @property {boolean} zClip - Flag, that toggles z-clipping. - * @property {number} probeRadius - Radius of the probe. - * @property {string} subset - Only parts of surface close to selected atoms will be visible. - * Empty string means whole surface is visible. - * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - SA: { - zClip: false, - probeRadius: 1.5, - subset: '', - wireframe: false, - polyComplexity: { - poor: 6, - low: 8, - medium: 16, - high: 30, - ultra: 60 - } - }, - //---------------------------------------------------------------------------- - // SURFACE SES - //---------------------------------------------------------------------------- - - /** - * Solvent Excluded Surface mode options. - * - * @typedef IsoSurfaceSESModeOptions - * - * @property {boolean} zClip - Flag, that toggles z-clipping. - * @property {number} probeRadius - Radius of the probe. - * @property {string} subset - Only parts of surface close to selected atoms will be visible. - * Empty string means whole surface is visible. - * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - SE: { - zClip: false, - probeRadius: 1.5, - subset: '', - wireframe: false, - polyComplexity: { - poor: 6, - low: 8, - medium: 16, - high: 30, - ultra: 60 - } - }, - //---------------------------------------------------------------------------- - // QUICK SURFACE - //---------------------------------------------------------------------------- - - /** - * Quick Surface mode options. - * - * @typedef QuickSurfaceModeOptions - * - * @property {number} isoValue - Isovalue of the surface to extract. - * @property {number} scale - Radius scale for the surface being built. - * @property {boolean} zClip - Flag, that toggles z-clipping. - * @property {string} subset - Only parts of surface close to selected atoms will be visible. - * Empty string means whole surface is visible. - * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. - * @property {PolyComplexity} gaussLim - Gauss lim for coloring the bigger the value, the smoother our colors are. - * @property {PolyComplexity} gridSpacing - Poly complexity values for render modes. In this case the value - * corresponds to the grid density. - */ - QS: { - isoValue: 0.5, - gaussLim: { - poor: 1.5, - low: 2.0, - medium: 2.5, - high: 3.0, - ultra: 4.0 - }, - scale: 1.0, - wireframe: false, - gridSpacing: { - poor: 2, - low: 1.5, - medium: 1, - high: 0.5, - ultra: 0.25 - }, - subset: '', - zClip: false - }, - //---------------------------------------------------------------------------- - // CONTACT SURFACE - //---------------------------------------------------------------------------- - - /** - * Contact Surface mode options. - * - * @typedef ContactSurfaceModeOptions - * - * @property {number} isoValue - Isovalue of the surface to extract. - * @property {number} probeRadius - Probe radius. - * @property {number} probePositions - * @property {boolean} zClip - Flag, that toggles z-clipping. - * @property {string} subset - Only parts of surface close to selected atoms will be visible. - * Empty string means whole surface is visible. - * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. - * @property {PolyComplexity} polyComplexity - Radius scale for the surface being built. - * Poly complexity values for render modes. In this case the value corresponds to the grid density. - */ - CS: { - probeRadius: 1.4, - isoValue: 1.5, - wireframe: false, - probePositions: 30, - polyComplexity: { - poor: 0.5, - low: 1.0, - medium: 1.5, - high: 1.75, - ultra: 2.0 - }, - subset: '', - zClip: false - }, - //---------------------------------------------------------------------------- - // TRACE - //---------------------------------------------------------------------------- - - /** - * Trace mode options. - * - * @typedef TraceModeOptions - * - * @property {number} radius - Cylinder radius. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - TR: { - radius: 0.30, - polyComplexity: { - poor: 12, - low: 16, - medium: 32, - high: 64, - ultra: 64 - } - }, - //---------------------------------------------------------------------------- - // TUBE - //---------------------------------------------------------------------------- - - /** - * Tube mode options. - * - * @typedef TubeModeOptions - * - * @property {number} radius - Cylinder radius. - * @property {number} tension - Tension for interpolation. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments. - */ - TU: { - radius: 0.30, - heightSegmentsRatio: 1.5, - tension: -0.7, - polyComplexity: { - poor: 4, - low: 6, - medium: 10, - high: 18, - ultra: 34 - } - }, - //---------------------------------------------------------------------------- - // CARTOON - //---------------------------------------------------------------------------- - - /** - * Cartoon mode options. - * - * @typedef CartoonModeOptions - * - * @property {number} radius - Standard tube radius. - * @property {number} depth - Height of the secondary structure ribbon. - * @property {number} tension - Tension for interpolation. - * @proprety {object} ss - Secondary structure parameters. - * @proprety {object} ss.helix - Options for helices render. - * @proprety {number} ss.helix.width - Width of the secondary structure ribbon. - * @proprety {number} ss.helix.arrow - Secondary structure's arrow width. - * @proprety {object} ss.strand - Options for strands render. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - * polyComplexity must be even for producing symmetric arrows. - * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments. - */ - CA: { - radius: 0.30, - depth: 0.25, - ss: { - helix: { - width: 1.0, - arrow: 2.0 - }, - strand: { - width: 1.0, - arrow: 2.0 - } - }, - heightSegmentsRatio: 1.5, - tension: -0.7, - polyComplexity: { - poor: 4, - low: 6, - medium: 10, - high: 18, - ultra: 34 - } - }, - //---------------------------------------------------------------------------- - // TEXT - //---------------------------------------------------------------------------- - - /** - * Text mode options. - * - * @typedef TextModeOptions - * - * @property {string} template - Format string for building output text. - * @property {string} horizontalAlign - Text alignment ('left', 'right', 'center'). - * @property {string} verticalAlign - Vertical text box alignment ('top', 'bottom', 'middle'). - * @property {number} dx - Text offset x in angstroms. - * @property {number} dy - Text offset y in angstroms. - * @property {number} dz - Text offset z in angstroms. - * @property {string} fg - Color rule for foreground. - * @property {string} bg - Color rule for background. - * @property {boolean} showBg - Flag, that toggles background rendering. - * - */ - TX: { - template: '{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}', - horizontalAlign: 'center', - verticalAlign: 'middle', - dx: 0, - dy: 0, - dz: 1, - fg: 'none', - bg: '0x202020', - showBg: true - }, - //---------------------------------------------------------------------------- - // VOLUME DENSITY - //---------------------------------------------------------------------------- - - /** - * Volume density mode options. - * - * @typedef VolumeDensityModeOptions - * - * @property {number} kSigma - Noise threshold coefficient. - * @property {boolean} frame - flag, that turns on box frame painting. - * @property {boolean} isoMode - flag, that turns on IsoSurface mode instead of Volume Rendering. - * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. - */ - VD: { - kSigma: 1.0, - kSigmaMed: 2.0, - kSigmaMax: 4.0, - frame: true, - isoMode: false, - polyComplexity: { - poor: 2, - low: 3, - medium: 4, - high: 8, - ultra: 10 - } - } - }, - - /** - * Default options for all available colorers. - * Use {@link Colorer.id} as a dictionary key to access colorer options. - * - * Usually you don't need to override these settings. You may specify colorer options as a parameter during - * {@link Colorer} construction. - * - * Not all colorers have options. - * - * @memberof SettingsObject# - * @type {Object.} - * - * @property {ElementColorerOptions} EL - Element colorer options. - * @property {SequenceColorerOptions} SQ - Sequence colorer options. - * @property {MoleculeColorerOptions} MO - Molecule colorer options. - * @property {UniformColorerOptions} UN - Uniform colorer options. - * @property {ConditionalColorerOptions} CO - Conditional colorer options. - * @property {TemperatureColorerOptions} TM - Temperature colorer options. - * @property {OccupancyColorerOptions} OC - Occupancy colorer options. - * @property {HydrophobicityColorerOptions} HY - Hydrophobicity colorer options. - */ - colorers: { - /** - * Element colorer options. - * - * @typedef ElementColorerOptions - * - * @property {number} carbon - Carbon color or -1 to use default. - */ - EL: { - carbon: -1 - }, - - /** - * Uniform colorer options. - * - * @typedef UniformColorerOptions - * - * @property {number} color - Single color to paint with. - */ - UN: { - color: 0xFFFFFF - }, - - /** - * Conditional colorer options. - * - * @typedef ConditionalColorerOptions - * - * @property {string} subset - Selector string. - * @property {number} color - Color of selected atoms. - * @property {number} baseColor - Color of other atoms. - */ - CO: { - subset: 'charged', - color: 0xFF0000, - baseColor: 0xFFFFFF - }, - - /** - * Carbon colorer options. - * - * @typedef CarbonColorerOptions - * - * @property {number} color - Single color to paint carbons - * @property {number} factor - Color factor for not carbon atoms. - */ - CB: { - color: 0x909090, - factor: 0.6 - }, - - /** - * Sequence colorer options. - * - * @typedef SequenceColorerOptions - * - * @property {string} gradient - Name of gradient to use. - */ - SQ: { - gradient: 'rainbow' - }, - - /** - * Temperature colorer options. - * - * @typedef TemperatureColorerOptions - * - * @property {string} gradient - Name of gradient to use. - * @property {number} min - Minimal temperature. - * @property {number} max - Maximal temperature. - */ - TM: { - gradient: 'temp', - min: 5, - max: 40 - }, - - /** - * Occupancy colorer options. - * - * @typedef OccupancyColorerOptions - * - * @property {string} gradient - Name of gradient to use. - */ - OC: { - gradient: 'reds' - }, - - /** - * Hydrophobicity colorer options. - * - * @typedef HydrophobicityColorerOptions - * - * @property {string} gradient - Name of gradient to use. - */ - HY: { - gradient: 'blue-red' - }, - - /** - * Molecule colorer options. - * - * @typedef MoleculeColorerOptions - * - * @property {string} gradient - Name of gradient to use. - */ - MO: { - gradient: 'rainbow' - } - }, - - /* - * Use antialiasing in WebGL. - * @type {boolean} - */ - antialias: true, - - /* - * Camera field of view in degrees. - * @type {number} - */ - camFov: 45.0, - - /* - * Camera near plane distance. - * @type {number} - */ - camNear: 0.5, - - /* - * Camera far plane distance. - * @type {number} - */ - camFar: 100.0, - camDistance: 2.5, - radiusToFit: 1.0, - - /** - * @type {number} - * @instance - */ - fogNearFactor: 0.5, - // [0, 1] - - /** - * @type {number} - * @instance - */ - fogFarFactor: 1, - // [0, 1] - fogAlpha: 1.0, - fogColor: 0x000000, - fogColorEnable: false, - - /** - * Palette used for molecule coloring. - * @type {string} - */ - palette: 'JM', - - /* - * Geometry resolution. - * @type {string} - */ - resolution: 'medium', - autoResolution: false - /* true */ - , - autoPreset: true, - preset: 'default', - // TODO: remove 'preset' from settings, implement autodetection - presets: { - // Default - "default": [{ - mode: 'BS', - colorer: 'EL', - selector: 'all', - material: 'SF' - }], - empty: [], - // Wireframe - wire: [{ - mode: 'LN', - colorer: 'EL', - selector: 'all', - material: 'SF' - }], - // Small molecules - small: [{ - mode: 'BS', - colorer: 'EL', - selector: 'all', - material: 'SF' - }], - // Proteins, nucleic acids etc. - macro: [{ - mode: 'CA', - colorer: 'SS', - selector: 'not hetatm', - material: 'SF' - }, { - mode: 'BS', - colorer: 'EL', - selector: 'hetatm and not water', - material: 'SF' - }] - }, - objects: { - line: { - color: 0xFFFFFFFF, - dashSize: 0.3, - gapSize: 0.05 - } - }, - //---------------------------------------------------------------------------- - bg: { - color: 0x202020, - transparent: false - }, - draft: { - clipPlane: false, - clipPlaneFactor: 0.5, - clipPlaneSpeed: 0.00003 - }, - - /* - * Separate group for plugins. - * Each plugin handles its field by itself. - */ - plugins: {}, - - /** - * @type {boolean} - * @instance - */ - axes: true, - - /** - * @type {boolean} - * @instance - */ - fog: true, - - /** - * @type {boolean} - * @instance - */ - fps: true, - - /** - * Switch using of z-sprites for sphere and cylinder geometry - * @type {boolean} - * @instance - */ - zSprites: true, - isoSurfaceFakeOpacity: true, - - /** - * @type {boolean} - * @instance - */ - suspendRender: true, - nowater: false, - - /** - * @type {boolean} - * @instance - */ - autobuild: true, - - /** - * Anti-aliasing. - * @type {boolean} - * @instance - */ - fxaa: true, - - /** - * Outline depths - * @type {boolean} - * @instance - */ - outline: { - on: false, - color: 0x000000, - threshold: 0.1, - thickness: 1 - }, - - /** - * Ambient Occlusion special effect. - * @type {boolean} - * @instance - */ - ao: false, - - /** - * Shadows options. - * - * @property {boolean} shadowMap - enable/disable. - * @property {string} basic/percentage-closer filtering/non-uniform randomizing pcf. - * @property {number} radius for percentage-closer filtering. - */ - shadow: { - on: false, - type: 'random' - /* basic, pcf, random */ - , - radius: 1.0 - }, - - /** - * Auto-rotation with constant speed. - * @type {number} - * @instance - */ - autoRotation: 0.0, - - /** - * Set maximum fps for animation. - * @type {number} - * @instance - */ - maxfps: 30, - - /** - * Set fbx output precision. - * @type {number} - * @instance - */ - fbxprec: 4, - - /** - * Auto-rotation axis. - * - * - true: complex auto-rotation is about vertical axis - * - false: rotation axis is defined by last user rotation - * - * @type {boolean} - * @instance - */ - autoRotationAxisFixed: true, - - /** - * Enable zooming with mouse wheel or pinch gesture. - * @type {boolean} - * @instance - */ - zooming: true, - - /** - * Enable picking atoms & residues with left mouse button or touch. - * @type {boolean} - * @instance - */ - picking: true, - - /** - * Set picking mode ('atom', 'residue', 'chain', 'molecule'). - * @type {string} - * @instance - */ - pick: 'atom', - - /** - * Make "component" and "fragment" editing modes available. - * @type {boolean} - * @instance - */ - editing: false, - - /** - * Detect aromatic loops. - * @type {boolean} - * @instance - */ - aromatic: false, - - /** - * Load only one biological unit from all those described in PDB file. - * @type {boolean} - * @instance - */ - singleUnit: true, - - /** - * Set stereo mode ('NONE', 'SIMPLE', 'DISTORTED', 'ANAGLYPH', 'WEBVR'). - * @type {string} - * @instance - */ - stereo: 'NONE', - - /** - * Enable smooth transition between views - * @type {boolean} - * @instance - */ - interpolateViews: true, - - /** - * Set transparency mode ('standard', 'prepass'). - * @type {string} - * @instance - */ - transparency: 'prepass', - - /** - * Mouse translation speed. - * @type {number} - * @instance - */ - translationSpeed: 2, - debug: { - example: 3.5, - text: 'hello!', - good: true, - ssaoKernelRadius: 0.7, - ssaoFactor: 0.7, - stereoBarrel: 0.25 - }, - use: { - multiFile: false - } -}; //---------------------------------------------------------------------------- -// SETTINGS CLASS -//---------------------------------------------------------------------------- - -function Settings() { - EventDispatcher.call(this); - this.old = null; - this.now = {}; - this._changed = {}; - this.reset(); -} - -utils.deriveClass(Settings, EventDispatcher, { - defaults: defaults$1, - set: function set(path, value) { - if (_.isString(path)) { - var oldValue = _.get(this.now, path); - - if (oldValue !== value) { - _.set(this.now, path, value); - - this._notifyChange(path, value); - } - } else { - var diff = utils.objectsDiff(path, this.now); - - if (!_.isEmpty(diff)) { - _.merge(this.now, diff); - - this._notifyChanges(diff); - } - } - }, - get: function get(path, defaultValue) { - return _.get(this.now, path, defaultValue); - }, - reset: function reset() { - var diff = utils.objectsDiff(defaults$1, this.now); - this.now = _.cloneDeep(defaults$1); - this.old = null; - - this._notifyChanges(diff); - - this._changed = {}; - }, - checkpoint: function checkpoint() { - this.old = _.cloneDeep(this.now); - this._changed = {}; - }, - _notifyChange: function _notifyChange(path, value) { - this._changed[path] = true; - this.dispatchEvent({ - type: "change:".concat(path), - value: value - }); - }, - _notifyChanges: function _notifyChanges(diff) { - var _this = this; - - utils.forInRecursive(diff, function (deepValue, deepPath) { - _this._notifyChange(deepPath, deepValue); - }); - }, - changed: function changed() { - if (!this.old) { - return []; - } - - var old = this.old, - now = this.now; - - var keys = _.filter(Object.keys(this._changed), function (key) { - return _.get(old, key) !== _.get(now, key); - }); - - return keys; - }, - applyDiffs: function applyDiffs(diffs) { - if (diffs.hasOwnProperty('VERSION') && diffs.VERSION !== VERSION) { - throw new Error('Settings version does not match!'); - } // VERSION shouldn't be presented inside settings structure - - - delete diffs.VERSION; - this.reset(); - this.set(diffs); - }, - getDiffs: function getDiffs(versioned) { - var diffs = utils.objectsDiff(this.now, defaults$1); - - if (versioned) { - diffs.VERSION = VERSION; - } - - return diffs; - }, - setPluginOpts: function setPluginOpts(plugin, opts) { - defaults$1.plugins[plugin] = _.cloneDeep(opts); - this.now.plugins[plugin] = _.cloneDeep(opts); - } -}); -var settings = new Settings(); - -var repIndex = 0; - -function asBoolean(value) { - return !(!value || value === '0' || _.isString(value) && value.toLowerCase() === 'false'); -} - -var adapters = { - string: String, - number: Number, - "boolean": asBoolean -}; // Level 1 assignment symbol - -var cL1Ass = '='; -var cOptsSep = '!'; // Level 2 (options) assignment symbol - -var cL2Ass = ':'; // Level 2 (options) separator symbol - -var cLSep = ','; -var cCommonIgnoreSymbols = '$;@/?'; -/** - * We may (and should) leave as is for better readability: - * - * $ , ; : @ / ? - */ - -/** - * Generate regular expression for symbols excluded for first level encryption - */ - -function getLevel1ExcludedExpr() { - var cLevel1Ignores = ':,'; - return utils.generateRegExp(cCommonIgnoreSymbols + cLevel1Ignores); -} -/** - * Generate regular expression for symbols excluded for first level encryption - * (options, etc, ..) - */ - - -function getLevel2ExcludedExpr() { - var cLevel2Ignores = ' '; - return utils.generateRegExp(cCommonIgnoreSymbols + cLevel2Ignores); -} - -var cL1ExclExpr = getLevel1ExcludedExpr(); - -function encodeQueryComponentL1(value) { - return utils.encodeQueryComponent(value, cL1ExclExpr); -} - -var cL2ExclExpr = getLevel2ExcludedExpr(); - -function encodeQueryComponentL2(value) { - return utils.encodeQueryComponent(value, cL2ExclExpr); -} - -function ensureRepList(opts) { - var reps = opts.reps; - - if (!reps) { - var presets = settings.now.presets; - var preset = opts.preset || settings.now.preset; - reps = presets[preset]; - - if (!reps) { - logger.warn("Unknown preset \"".concat(preset, "\"")); - - var _Object$keys = Object.keys(presets); - - var _Object$keys2 = slicedToArray(_Object$keys, 1); - - preset = _Object$keys2[0]; - reps = presets[preset]; // fall back to any preset - } - - opts.preset = preset; - opts.reps = utils.deriveDeep(reps, true); - } -} - -function ensureRepAssign(opts, prop, value) { - ensureRepList(opts); - var rep = opts.reps[repIndex]; // prop specified twice therefore start new rep by cloning the current - - if (rep.hasOwnProperty(prop)) { - repIndex = opts.reps.length; - opts.reps[repIndex] = utils.deriveDeep(rep, true); - } - - if (value !== undefined) { - opts.reps[repIndex][prop] = value; - } -} - -function addObject(opts, params, options) { - if (opts._objects === undefined) { - opts._objects = []; - } - - var _options = slicedToArray(options, 2), - type = _options[0], - newOpts = _options[1]; - - var newObj = { - type: type, - params: params - }; - - if (newOpts !== undefined) { - newObj.opts = newOpts; - } - - opts._objects[opts._objects.length] = newObj; -} - -function parseParams(str, params) { - var sep = str.indexOf(','); - - if (sep >= 0) { - params.push(str.substr(sep + 1).split(',')); - return str.substr(0, sep); - } // keep this untouched if no params were extracted - - - return str; -} - -function extractArgs(input, defaultsDict, params) { - if (input) { - var bang = input.indexOf(cOptsSep); - var inputVal = parseParams(input.substr(0, bang >= 0 ? bang : undefined), params); - - if (bang >= 0) { - var args = input.substr(bang + 1).split(cLSep); - input = inputVal; - - if (defaultsDict) { - var defaults = defaultsDict[input]; - var opts = utils.deriveDeep(defaults, true); - args.forEach(function (arg) { - var pair = arg.split(cL2Ass, 2); - var key = decodeURIComponent(pair[0]); - var value = decodeURIComponent(pair[1]); - - var adapter = adapters[_typeof_1(_.get(defaults, key))]; - - if (adapter) { - _.set(opts, key, adapter(value)); - } else { - logger.warn("Unknown argument \"".concat(key, "\" for option \"").concat(input, "\"")); - } - }); - - if (Object.keys(opts).length > 0) { - input = [input, opts]; - } - } - } else { - input = inputVal; - } - } - - return input; -} - -var actions = { - l: 'load', - load: String, - t: 'type', - type: String, - v: 'view', - view: String, - u: 'unit', - unit: Number, - menu: asBoolean, - // Commands - o: 'object', - object: function object(value, opts) { - var params = []; - var options = extractArgs(value, settings.defaults.objects, params); - - if (!Array.isArray(options)) { - options = [options]; - } - - addObject(opts, params[0], options); - }, - p: 'preset', - preset: function preset(value, opts) { - opts.preset = value; - opts.reps = null; - ensureRepList(opts); - }, - r: 'rep', - rep: function rep(value, opts) { - ensureRepList(opts); - repIndex = Number(value); // clamp the index to one greater than the last - - repIndex = repIndex <= opts.reps.length ? repIndex < 0 ? 0 : repIndex : opts.reps.length; // create a new rep if it is adjacent to the existing ones - - if (repIndex === opts.reps.length) { - // if there is no rep to derive from, derive from the first rep of the default - opts.reps[repIndex] = repIndex > 0 ? utils.deriveDeep(opts.reps[repIndex - 1], true) : utils.deriveDeep(settings.defaults.presets["default"][0], true); - } - }, - s: 'select', - select: function select(value, opts) { - ensureRepAssign(opts, 'selector', value); - }, - m: 'mode', - mode: function mode(value, opts) { - ensureRepAssign(opts, 'mode', extractArgs(value, settings.defaults.modes)); - }, - c: 'color', - color: function color(value, opts) { - ensureRepAssign(opts, 'colorer', extractArgs(value, settings.defaults.colorers)); - }, - mt: 'material', - material: function material(value, opts) { - ensureRepAssign(opts, 'material', extractArgs(value, settings.defaults.materials)); - }, - dup: function dup(value, opts) { - ensureRepList(opts); - var reps = opts.reps; - var rep = reps[repIndex]; - repIndex = reps.length; - reps[repIndex] = utils.deriveDeep(rep, true); - }, - // Settings shortcuts - ar: 'autoResolution' -}; - -function _fromArray(entries) { - repIndex = 0; - var opts = {}; - - for (var i = 0, n = entries.length; i < n; ++i) { - var - /** string[] */ - entry = entries[i]; - var - /** string? */ - key = entry[0]; - var - /** string? */ - value = entry[1]; - var - /** function|string? */ - action = actions[key]; // unwind shortcuts and aliases - - while (_.isString(action)) { - key = action; - action = actions[key]; - } // either set a property or use specialized parser - - - if (!action) { - var adapter = adapters[_typeof_1(_.get(settings.defaults, key))]; - - if (adapter) { - _.set(opts, "settings.".concat(key), adapter(value)); - } else { - logger.warn("Unknown option \"".concat(key, "\"")); - } - } else if (_.isFunction(action)) { - var result = action(value, opts); - - if (result !== undefined) { - opts[key] = result; - } - } - } - - return opts; -} - -function fromAttr(attr) { - return _fromArray(utils.getUrlParameters("?".concat(attr || ''))); -} - -function fromURL(url) { - return _fromArray(utils.getUrlParameters(url)); -} - -function _processOptsForURL(opts) { - var str = []; - var i = 0; - utils.forInRecursive(opts, function (value, key) { - str[i++] = encodeQueryComponentL2(key) + cL2Ass + encodeQueryComponentL2(value); - }); - return str.join(cLSep); -} - -function _processArgsForURL(args) { - if (!_.isArray(args)) { - return args; - } - - if (args.length < 2) { - return args[0]; - } - - return "".concat(args[0]).concat(cOptsSep).concat(_processOptsForURL(args[1])); -} - -function _processObjForURL(objOpts) { - if (!objOpts || !objOpts.type) { - return undefined; - } - - var res = objOpts.type; - - if (_.isArray(objOpts.params) && objOpts.params.length > 0) { - res += ",".concat(objOpts.params.join(',')); - } - - if (objOpts.opts) { - res += cOptsSep + _processOptsForURL(objOpts.opts); - } - - return res; -} - -function toURL(opts) { - var stringList = []; - var idx = 0; - - function checkAndAdd(prefix, value) { - if (value !== null && value !== undefined) { - stringList[idx++] = encodeQueryComponentL1(prefix) + cL1Ass + encodeQueryComponentL1(value); - } - } - - function addReps(repList) { - if (!repList) { - return; - } - - for (var i = 0, n = repList.length; i < n; ++i) { - if (_.isEmpty(repList[i])) { - continue; - } - - checkAndAdd('r', i); - checkAndAdd('s', repList[i].selector); - checkAndAdd('m', _processArgsForURL(repList[i].mode)); - checkAndAdd('c', _processArgsForURL(repList[i].colorer)); - checkAndAdd('mt', _processArgsForURL(repList[i].material)); - } - } - - function addObjects(objList) { - if (!objList) { - return; - } - - for (var i = 0, n = objList.length; i < n; ++i) { - checkAndAdd('o', _processObjForURL(objList[i])); - } - } - - checkAndAdd('l', opts.load); - checkAndAdd('u', opts.unit); - checkAndAdd('p', opts.preset); - addReps(opts.reps); - addObjects(opts._objects); - checkAndAdd('v', opts.view); - utils.forInRecursive(opts.settings, function (value, key) { - // I heard these lines in the whispers of the Gods - // Handle preset setting in reps - if (key === 'preset') { - return; - } - - checkAndAdd(key, value); - }); - var url = ''; - - if (typeof window !== 'undefined') { - var _window = window, - location = _window.location; - url = "".concat(location.protocol, "//").concat(location.host).concat(location.pathname); - } - - if (stringList.length > 0) { - url += "?".concat(stringList.join('&')); - } - - return url; -} - -function _processOptsForScript(opts) { - var str = []; - var i = 0; - utils.forInRecursive(opts, function (value, key) { - str[i++] = "".concat(key, "=").concat(utils.enquoteString(value)); - }); - return str.join(' '); -} - -function _processArgsForScript(args) { - if (!_.isArray(args)) { - return args; - } - - if (args.length < 2) { - return args[0]; - } - - return "".concat(args[0], " ").concat(_processOptsForScript(args[1])); -} - -function _processObjForScript(objOpts) { - if (!objOpts || !objOpts.type) { - return undefined; - } - - var res = objOpts.type; - - if (_.isArray(objOpts.params) && objOpts.params.length > 0) { - res += " ".concat(objOpts.params.map(utils.enquoteString).join(' ')); - } - - if (objOpts.opts) { - res += " ".concat(_processOptsForScript(objOpts.opts)); - } - - return res; -} - -function _processRepsForScript(rep, index) { - var repString = []; - var strIdx = 0; - - function localAdd(prefix, value) { - if (value !== null && value !== undefined) { - repString[strIdx++] = prefix + value; - } - } - - if (_.isEmpty(rep)) { - return null; - } - - localAdd('', index); - localAdd('s=', utils.enquoteString(rep.selector)); - localAdd('m=', _processArgsForScript(rep.mode)); - localAdd('c=', _processArgsForScript(rep.colorer)); - localAdd('mt=', _processArgsForScript(rep.material)); - return repString.join(' '); -} - -function toScript(opts) { - var commandsList = []; - var idx = 0; - - function checkAndAdd(command, value, saveQuotes) { - if (value !== null && value !== undefined) { - var quote = typeof value === 'string' && saveQuotes ? '"' : ''; - commandsList[idx++] = "".concat(command, " ").concat(quote).concat(value).concat(quote).trim(); - } - } - - function addReps(repList) { - if (!repList) { - return; - } - - for (var i = 0, n = repList.length; i < n; ++i) { - checkAndAdd('rep', _processRepsForScript(repList[i], i)); - } - } - - function addObjects(objList) { - if (!objList) { - return; - } - - for (var i = 0, n = objList.length; i < n; ++i) { - checkAndAdd('', _processObjForScript(objList[i])); - } - } - - checkAndAdd('set', 'autobuild false'); - checkAndAdd('load', opts.load, true); - checkAndAdd('unit', opts.unit); - checkAndAdd('preset', opts.preset); - addReps(opts.reps); - addObjects(opts._objects); - utils.forInRecursive(opts.settings, function (value, key) { - // I heard these lines in the whispers of the Gods - // Handle preset setting in reps - if (key === 'preset') { - return; - } - - checkAndAdd("set ".concat(key), value, true); - }); - checkAndAdd('view', opts.view); - checkAndAdd('set', 'autobuild true'); - return commandsList.join('\n'); -} - -var options = { - fromURL: fromURL, - fromAttr: fromAttr, - adapters: adapters, - toURL: toURL, - toScript: toScript -}; - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - -var defineProperty = _defineProperty; - -/** - * Atom measurements. - * - * @param {Residue} residue - (required) Residue containing the atom - * @param {string} name - (required) Name, unique in the residue - * @param {Element} type - (required) Chemical element reference - * @param {THREE.Vector3} position - Registered coordinates - * - * @param {number} role - Role of atom inside monomer: Lead and wing are particularity interesting - * @param {boolean} het - Non-standard residue indicator - * - * @param {number} serial - Serial number, unique in the model - * @param {string} location - Alternative location indicator (usually space or A-Z) - * @param {number} occupancy - Occupancy percentage, from 0 to 1 - * @param {number} temperature - Temperature - * @param {number} charge - Charge - * - * @exports Atom - * @constructor - */ -var Atom = /*#__PURE__*/function () { - function Atom(residue, name, type, position, role, het, serial, location, occupancy, temperature, charge) { - classCallCheck(this, Atom); - - this.index = -1; - this.residue = residue; - this.name = name; - this.element = type; - this.position = position; - this.role = role; - this.mask = 1 | 0; - this.het = het; - this.serial = serial; - this.location = (location || ' ').charCodeAt(0); - this.occupancy = occupancy || 1; - this.temperature = temperature; - this.charge = charge; - this.hydrogenCount = -1; // explicitly invalid - - this.radicalCount = 0; - this.valence = -1; // explicitly invalid - - this.bonds = []; - this.flags = 0x0000; - - if (type.name === 'H') { - this.flags |= Atom.Flags.HYDROGEN; - } else if (type.name === 'C') { - this.flags |= Atom.Flags.CARBON; - } - } - - createClass(Atom, [{ - key: "isHet", - value: function isHet() { - return this.het; - } - }, { - key: "isHydrogen", - value: function isHydrogen() { - return this.element.number === 1; - } - }, { - key: "getVisualName", - value: function getVisualName() { - var name = this.name; - - if (name.length > 0) { - return name; - } - - return this.element.name.trim(); - } - }, { - key: "forEachBond", - value: function forEachBond(process) { - var bonds = this.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - process(bonds[i]); - } - } - }, { - key: "getFullName", - value: function getFullName() { - var name = ''; - - if (this.residue !== null) { - if (this.residue._chain !== null) { - name += "".concat(this.residue._chain.getName(), "."); - } - - name += "".concat(this.residue._sequence, "."); - } - - name += this.name; - return name; - } - /** - * Enumeration of atom flag values. - * - * @enum {number} - * @readonly - */ - - }]); - - return Atom; -}(); - -defineProperty(Atom, "Flags", { - CARBON: 0x0001, - // OXYGEN: 0x0002, - // NITROGEN: 0x0004, - HYDROGEN: 0x0008, - - /** Non-polar hydrogen (it is also a HYDROGEN) */ - NONPOLARH: 0x1008 -}); - -var Element = function Element(number, name, fullName, weight, radius, radiusBonding, hValency) { - classCallCheck(this, Element); - - this.number = number; - this.name = name; - this.fullName = fullName; - this.weight = weight; - this.radius = radius; - this.radiusBonding = radiusBonding; - this.hydrogenValency = hValency; -}; - -defineProperty(Element, "Constants", { - /* eslint-disable no-magic-numbers */ - U1: 1, - Lead: 2, - U2: 3, - Wing: 4, - U18: 18 - /* eslint-enable no-magic-numbers */ - -}); - -defineProperty(Element, "Role", { - /* eslint-disable no-magic-numbers */ - N: Element.Constants.U1, - CA: Element.Constants.Lead, - C: Element.Constants.U2, - O: Element.Constants.Wing, - SG: Element.Constants.U18 - /* eslint-enable no-magic-numbers */ - -}); - -defineProperty(Element, "ByAtomicNumber", [ -/* eslint-disable no-magic-numbers */ -null, new Element(1, 'H', 'Hydrogen', 1.008, 1.2, 0.23, [1]), new Element(2, 'HE', 'Helium', 4.003, 1.4, 0.93, [0]), new Element(3, 'LI', 'Lithium', 6.941, 1.82, 0.68, [1]), new Element(4, 'BE', 'Beryllium', 9.012, 1.7, 0.35, [2]), new Element(5, 'B', 'Boron', 10.81, 2.08, 0.83, [3]), new Element(6, 'C', 'Carbon', 12.011, 1.95, 0.68, [4]), new Element(7, 'N', 'Nitrogen', 14.007, 1.85, 0.68, [3, 5]), new Element(8, 'O', 'Oxygen', 15.999, 1.7, 0.68, [2, 4]), new Element(9, 'F', 'Fluorine', 18.998, 1.73, 0.64, [1]), new Element(10, 'NE', 'Neon', 20.18, 1.54, 1.12, [0]), new Element(11, 'NA', 'Sodium', 22.99, 2.27, 0.97, [1]), new Element(12, 'MG', 'Magnesium', 24.305, 1.73, 1.1, [2]), new Element(13, 'AL', 'Aluminum', 26.981, 2.05, 1.35, [3]), new Element(14, 'SI', 'Silicon', 28.086, 2.1, 1.2, [4]), new Element(15, 'P', 'Phosphorus', 30.974, 2.08, 0.75, [3, 5]), new Element(16, 'S', 'Sulfur', 32.07, 2, 1.02, [2, 4, 6]), new Element(17, 'CL', 'Chlorine', 35.453, 1.97, 0.99, [1, 3, 5, 7]), new Element(18, 'AR', 'Argon', 39.948, 1.88, 1.57, [0]), new Element(19, 'K', 'Potassium', 39.1, 2.75, 1.33, [1]), new Element(20, 'CA', 'Calcium', 40.08, 1.973, 0.99, [2]), new Element(21, 'SC', 'Scandium', 44.956, 1.7, 1.44, [0]), new Element(22, 'TI', 'Titanium', 47.88, 1.7, 1.47, [0]), new Element(23, 'V', 'Vanadium', 50.941, 1.7, 1.33, [0]), new Element(24, 'CR', 'Chromium', 52, 1.7, 1.35, [0]), new Element(25, 'MN', 'Manganese', 54.938, 1.7, 1.35, [0]), new Element(26, 'FE', 'Iron', 55.847, 1.7, 1.34, [0]), new Element(27, 'CO', 'Cobalt', 58.93, 1.7, 1.33, [0]), new Element(28, 'NI', 'Nickel', 58.69, 1.63, 1.5, [0]), new Element(29, 'CU', 'Copper', 63.55, 1.4, 1.52, [0]), new Element(30, 'ZN', 'Zinc', 65.39, 1.39, 1.45, [0]), new Element(31, 'GA', 'Gallium', 69.72, 1.87, 1.22, [3]), new Element(32, 'GE', 'Germanium', 72.61, 1.7, 1.17, [4]), new Element(33, 'AS', 'Arsenic', 74.92, 1.85, 1.21, [3, 5]), new Element(34, 'SE', 'Selenium', 78.96, 1.9, 1.22, [2, 4, 6]), new Element(35, 'BR', 'Bromine', 79.9, 2.1, 1.21, [1, 3, 5, 7]), new Element(36, 'KR', 'Krypton', 83.8, 2.02, 1.91, [0]), new Element(37, 'RB', 'Rubidium', 85.47, 1.7, 1.47, [1]), new Element(38, 'SR', 'Strontium', 87.62, 1.7, 1.12, [2]), new Element(39, 'Y', 'Yttrium', 88.91, 1.7, 1.78, [0]), new Element(40, 'ZR', 'Zirconium', 91.22, 1.7, 1.56, [0]), new Element(41, 'NB', 'Niobium', 92.91, 1.7, 1.48, [0]), new Element(42, 'MO', 'Molybdenum', 95.94, 1.7, 1.47, [0]), new Element(43, 'TC', 'Technetium', 98.91, 1.7, 1.35, [0]), new Element(44, 'RU', 'Ruthenium', 101.07, 1.7, 1.4, [0]), new Element(45, 'RH', 'Rhodium', 102.91, 1.7, 1.45, [0]), new Element(46, 'PD', 'Palladium', 106.42, 1.63, 1.5, [0]), new Element(47, 'AG', 'Silver', 107.87, 1.72, 1.59, [0]), new Element(48, 'CD', 'Cadmium', 112.41, 1.58, 1.69, [0]), new Element(49, 'IN', 'Indium', 114.82, 1.93, 1.63, [3]), new Element(50, 'SN', 'Tin', 118.71, 2.17, 1.46, [2, 4]), new Element(51, 'SB', 'Antimony', 121.75, 2.2, 1.46, [3, 5]), new Element(52, 'TE', 'Tellurium', 127.6, 2.06, 1.47, [2, 4, 6]), new Element(53, 'I', 'Iodine', 126.91, 2.15, 1.4, [1, 3, 5, 7]), new Element(54, 'XE', 'Xenon', 131.29, 2.16, 1.98, [0]), new Element(55, 'CS', 'Cesium', 132.91, 1.7, 1.67, [1]), new Element(56, 'BA', 'Barium', 137.33, 1.7, 1.34, [2]), new Element(57, 'LA', 'Lanthanum', 138.91, 1.7, 1.87, [0]), new Element(58, 'CE', 'Cerium', 140.12, 1.7, 1.83, [0]), new Element(59, 'PR', 'Praseodymium', 140.91, 1.7, 1.82, [0]), new Element(60, 'ND', 'Neodymium', 144.24, 1.7, 1.81, [0]), new Element(61, 'PM', 'Promethium', 144.9, 1.7, 1.8, [0]), new Element(62, 'SM', 'Samarium', 150.36, 1.7, 1.8, [0]), new Element(63, 'EU', 'Europium', 151.96, 1.7, 1.99, [0]), new Element(64, 'GD', 'Gadolinium', 157.25, 1.7, 1.79, [0]), new Element(65, 'TB', 'Terbium', 158.93, 1.7, 1.76, [0]), new Element(66, 'DY', 'Dysprosium', 162.5, 1.7, 1.75, [0]), new Element(67, 'HO', 'Holmium', 164.93, 1.7, 1.74, [0]), new Element(68, 'ER', 'Erbium', 167.26, 1.7, 1.73, [0]), new Element(69, 'TM', 'Thulium', 168.93, 1.7, 1.72, [0]), new Element(70, 'YB', 'Ytterbium', 173.04, 1.7, 1.94, [0]), new Element(71, 'LU', 'Lutetium', 174.97, 1.7, 1.72, [0]), new Element(72, 'HF', 'Hafnium', 178.49, 1.7, 1.57, [0]), new Element(73, 'TA', 'Tantalum', 180.95, 1.7, 1.43, [0]), new Element(74, 'W', 'Tungsten', 183.85, 1.7, 1.37, [0]), new Element(75, 'RE', 'Rhenium', 186.21, 1.7, 1.35, [0]), new Element(76, 'OS', 'Osmium', 190.2, 1.7, 1.37, [0]), new Element(77, 'IR', 'Iridium', 192.22, 1.7, 1.32, [0]), new Element(78, 'PT', 'Platinum', 195.08, 1.72, 1.5, [0]), new Element(79, 'AU', 'Gold', 196.97, 1.66, 1.5, [0]), new Element(80, 'HG', 'Mercury', 200.59, 1.55, 1.7, [0]), new Element(81, 'TL', 'Thallium', 204.38, 1.96, 1.55, [1, 3]), new Element(82, 'PB', 'Lead', 207.2, 2.02, 1.54, [2, 4]), new Element(83, 'BI', 'Bismuth', 208.98, 1.7, 1.54, [3, 5]), new Element(84, 'PO', 'Polonium', 210, 1.7, 1.68, [2, 4, 6]), new Element(85, 'AT', 'Astatine', 210, 1.7, 1.7, [1, 3, 5, 7]), new Element(86, 'RN', 'Radon', 222, 1.7, 2.4, [0]), new Element(87, 'FR', 'Francium', 223, 1.7, 2, [1]), new Element(88, 'RA', 'Radium', 226.03, 1.7, 1.9, [2]), new Element(89, 'AC', 'Actinium', 227.03, 1.7, 1.88, [0]), new Element(90, 'TH', 'Thorium', 232.04, 1.7, 1.79, [0]), new Element(91, 'PA', 'Protactinium', 231.04, 1.7, 1.61, [0]), new Element(92, 'U', 'Uranium', 238.03, 1.86, 1.58, [0]), new Element(93, 'NP', 'Neptunium', 237.05, 1.7, 1.55, [0]), new Element(94, 'PU', 'Plutonium', 239.1, 1.7, 1.53, [0]), new Element(95, 'AM', 'Americium', 243.1, 1.7, 1.51, [0]), new Element(96, 'CM', 'Curium', 247.1, 1.7, 1.5, [0]), new Element(97, 'BK', 'Berkelium', 247.1, 1.7, 1.5, [0]), new Element(98, 'CF', 'Californium', 252.1, 1.7, 1.5, [0]), new Element(99, 'ES', 'Einsteinium', 252.1, 1.7, 1.5, [0]), new Element(100, 'FM', 'Fermium', 257.1, 1.7, 1.5, [0]), new Element(101, 'MD', 'Mendelevium', 256.1, 1.7, 1.5, [0]), new Element(102, 'NO', 'Nobelium', 259.1, 1.7, 1.5, [0]), new Element(103, 'LR', 'Lawrencium', 260.1, 1.7, 1.5, [0]), new Element(104, 'RF', 'Rutherfordium', 261, 1.7, 1.6, [0]), new Element(105, 'DB', 'Dubnium', 262, 1.7, 1.6, [0]), new Element(106, 'SG', 'Seaborgium', 263, 1.7, 1.6, [0]), new Element(107, 'BH', 'Bohrium', 262, 1.7, 1.6, [0]), new Element(108, 'HS', 'Hassium', 265, 1.7, 1.6, [0]), new Element(109, 'MT', 'Meitnerium', 268, 1.7, 1.6, [0]) -/* eslint-enable no-magic-numbers */ -]); - -defineProperty(Element, "ByName", { - // Duplicate atomic numbers (isotopes) - - /* eslint-disable no-magic-numbers */ - D: new Element(1, 'D', 'Deuterium', 2.014, 1.2, 0.23, [1]), - T: new Element(1, 'T', 'Tritium', 3.016, 1.2, 0.23, [1]) - /* eslint-enable no-magic-numbers */ - // All regular elements will be added later, automatically - -}); - -(function () { - var byAtomicNumber = Element.ByAtomicNumber; - var byName = Element.ByName; - - for (var i = 0, n = byAtomicNumber.length; i < n; ++i) { - var element = byAtomicNumber[i]; - - if (element) { - byName[element.name] = element; - } - } -})(); // find atom type by chemical element (or create if missing) - - -Element.getByName = function (element) { - var type = Element.ByName[element]; - - if (!type) { - type = Element.ByName[element] = new Element(0, element, 'Unknown', 0, 1.0, 0.01, [0]); - } - - return type; -}; - -var cBondTypes = { - /** Was generated manually */ - UNKNOWN: 0, - - /** Simple covalent bond */ - COVALENT: 1, - - /** Aromatic bond */ - AROMATIC: 2 -}; - -function getAtomPos(atom) { - return atom.position; -} -/** - * Bond between atoms. - * - * @param {Atom} left - The first atom. - * @param {Atom} right - The second atom. - * @param {number} order - Order of current bond. - * @param {number} type - Bond type. - * @param {boolean} fixed - Indicator of a pre-specified connection (in contrast with guessed one). - * - * @exports Bond - * @constructor - */ - - -var Bond = /*#__PURE__*/function () { - function Bond(left, right, order, type, fixed) { - classCallCheck(this, Bond); - - this._left = left; - this._right = right; - this._fixed = fixed; - this._index = -1; - - if (left > right) { - throw new Error('In a bond atom indices must be in increasing order'); - } - - this._order = order; - this._type = type; - } - - createClass(Bond, [{ - key: "getLeft", - value: function getLeft() { - return this._left; - } - }, { - key: "getRight", - value: function getRight() { - return this._right; - } - }, { - key: "getOrder", - value: function getOrder() { - return this._order; - } - }, { - key: "calcLength", - value: function calcLength() { - return this._left.position.distanceTo(this._right.position); - } - }, { - key: "_forEachNeighbour", - value: function _forEachNeighbour(currAtom, process) { - var bonds = currAtom.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - process(bonds[i]._left !== currAtom ? bonds[i]._left : bonds[i]._right); - } - } - }, { - key: "forEachLevelOne", - value: function forEachLevelOne(process) { - var left = this._left; - var right = this._right; - - this._forEachNeighbour(left, function (atom) { - if (atom === right) { - return; - } - - process(atom); - }); - - this._forEachNeighbour(right, function (atom) { - if (atom === left) { - return; - } - - process(atom); - }); - } - }, { - key: "forEachLevelTwo", - value: function forEachLevelTwo(process) { - // TODO refactor this piece of an art? - var left = this._left; - var right = this._right; - var self = this; - - self._forEachNeighbour(left, function (atom) { - if (atom === right) { - return; - } - - self._forEachNeighbour(atom, function (l2Atom) { - if (l2Atom === left) { - return; - } - - process(l2Atom); - }); - }); - - self._forEachNeighbour(right, function (atom) { - if (atom === left) { - return; - } - - self._forEachNeighbour(atom, function (l2Atom) { - if (l2Atom === right) { - return; - } - - process(l2Atom); - }); - }); - } - }, { - key: "_fixDir", - value: function _fixDir(refPoint, currDir, posGetter) { - // count atoms to the right and to the left of the current plane - var rightCount = 0; - var leftCount = 0; - var tmpVec = refPoint.clone(); - - function checkDir(atom) { - tmpVec.copy(posGetter(atom)); - tmpVec.sub(refPoint); - var dotProd = currDir.dot(tmpVec); - - if (dotProd > 0) { - ++rightCount; - } else { - ++leftCount; - } - } - - function checkCarbon(atom) { - if (atom.element.name === 'C') { - checkDir(atom); - } - } // count all atoms to the left and right of our plane, start from level 1 and carbons - - - var stages = [[this.forEachLevelOne, checkCarbon], [this.forEachLevelOne, checkDir], [this.forEachLevelTwo, checkCarbon], [this.forEachLevelTwo, checkDir]]; - - for (var stageId = 0; stageId < stages.length; ++stageId) { - stages[stageId][0].call(this, stages[stageId][1]); - - if (leftCount > rightCount) { - return currDir.multiplyScalar(-1); - } - - if (leftCount < rightCount) { - return currDir; - } - } - - return currDir; - } - }, { - key: "calcNormalDir", - value: function calcNormalDir(posGetter) { - var left = this._left; - var right = this._right; - var first = left; - var second = right; - posGetter = posGetter === undefined ? getAtomPos : posGetter; - - if (left.bonds.length > right.bonds.length) { - first = right; - second = left; - } - - var third = first; - var maxNeibs = 0; - var _second = second, - bonds = _second.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - var another = bonds[i]._left; - - if (bonds[i]._left === second) { - another = bonds[i]._right; - } - - if (another.bonds.length > maxNeibs && another !== first) { - third = another; - maxNeibs = another.bonds.length; - } - } - - var secondPos = posGetter(second); - var firstV = posGetter(first).clone().sub(secondPos); - var secondV = posGetter(third).clone().sub(secondPos); - secondV.crossVectors(firstV, secondV); - - if (secondV.lengthSq() < 0.0001) { - secondV.set(0, 1, 0); - } - - firstV.normalize(); - secondV.normalize(); - firstV.crossVectors(secondV, firstV); - - if (firstV.lengthSq() < 0.0001) { - firstV.set(0, 1, 0); - } - - firstV.normalize(); - return this._fixDir(secondPos, firstV, posGetter); - } - }]); - - return Bond; -}(); - -defineProperty(Bond, "BondType", cBondTypes); - -Bond.prototype.BondType = cBondTypes; - -var cNucleicControlNames = ['C3\'', 'C3*', 'P', 'H5T', 'H3T']; -var cNucleicWing1Names = ['OP1', 'O1P']; -var cNucleicWing2Names = ['OP2', 'O2P']; -var cCylinderSource = ['C3\'', 'C3*', 'C1', 'C1\'', 'C1*', 'P']; -var cCylinderTarget = [{ - types: ['A', 'DA', 'G', 'DG'], - atoms: ['N1'] -}, { - types: ['C', 'DC'], - atoms: ['N3'] -}, { - types: ['T', 'DT', 'U', 'DU'], - atoms: ['O4'] -}]; -/** - * Residue instance. - * - * @param {Chain} chain - Chain this residue belongs to. - * @param {ResidueType} type - Generic residue instance type. - * @param {number} sequence - Sequence ID. - * @param {string} icode - One character insertion code (usually space or A-Z). - * - * @exports Residue - * @constructor - */ - -var Residue = /*#__PURE__*/function () { - function Residue(chain, type, sequence, icode) { - classCallCheck(this, Residue); - - this._chain = chain; - this._component = null; - this._type = type; - this._sequence = sequence; - this._icode = icode; - this._mask = 1 | 0; - this._index = -1; - this._atoms = []; - this._secondary = null; - this._firstAtom = null; - this._leadAtom = null; - this._wingAtom = null; - this._lastAtom = null; - this._controlPoint = null; - this._midPoint = null; - this._wingVector = null; - this._cylinders = null; - this._isValid = true; - this._het = false; - this._molecule = null; - this.temperature = null; - this.occupancy = null; - } // Getters and setters - - - createClass(Residue, [{ - key: "getChain", - value: function getChain() { - return this._chain; - } - }, { - key: "getMolecule", - value: function getMolecule() { - return this._molecule; - } - }, { - key: "getType", - value: function getType() { - return this._type; - } - }, { - key: "getSequence", - value: function getSequence() { - return this._sequence; - } - }, { - key: "getSecondary", - value: function getSecondary() { - return this._secondary; - } - }, { - key: "getICode", - value: function getICode() { - return this._icode; - } // Other methods - - }, { - key: "addAtom", - value: function addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge) { - var atom = new Atom(this, name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); - - var complex = this._chain.getComplex(); - - complex.addAtom(atom); - - this._atoms.push(atom); - - this._het = this._het || het; - return atom; - } - }, { - key: "getAtomCount", - value: function getAtomCount() { - return this._atoms.length; - } - }, { - key: "forEachAtom", - value: function forEachAtom(process) { - var atoms = this._atoms; - - for (var i = 0, n = atoms.length; i < n; ++i) { - if (process(atoms[i])) { - break; - } - } - } - }, { - key: "_findAtomByName", - value: function _findAtomByName(name) { - var res = null; - this.forEachAtom(function (atom) { - if (atom.name === name) { - res = atom; - return true; - } - - return false; - }); - return res; - } - }, { - key: "_findFirstAtomInList", - value: function _findFirstAtomInList(names) { - var res = null; - - for (var i = 0; i < names.length; ++i) { - res = this._findAtomByName(names[i]); - - if (res !== null) { - return res; - } - } - - return res; - } - }, { - key: "collectMask", - value: function collectMask() { - var mask = 0xffffffff; - var atoms = this._atoms; - - for (var i = 0, n = atoms.length; i < n; ++i) { - mask &= atoms[i].mask; - } - - this._mask = mask; - } - }, { - key: "getCylinderTargetList", - value: function getCylinderTargetList() { - var type = this._type._name; - - for (var i = 0, n = cCylinderTarget.length; i < n; ++i) { - for (var j = 0, m = cCylinderTarget[i].types.length; j < m; ++j) { - if (type === cCylinderTarget[i].types[j]) { - return cCylinderTarget[i].atoms; - } - } - } - - return null; - } - }, { - key: "_detectLeadWing", - value: function _detectLeadWing(dst, next, getAtomPosition) { - var leadAtom = this._findFirstAtomInList(cNucleicControlNames); - - var wingStart = this._findFirstAtomInList(cNucleicWing1Names); - - var wingEnd = this._findFirstAtomInList(cNucleicWing2Names); - - if (wingStart === null && next !== null) { - wingStart = next._findFirstAtomInList(cNucleicWing1Names); - } - - if (wingEnd === null && next !== null) { - wingEnd = next._findFirstAtomInList(cNucleicWing2Names); - } - - if (leadAtom === null || wingStart === null || wingEnd === null) { - return; - } - - dst._leadAtom = leadAtom; - dst._controlPoint = getAtomPosition(leadAtom); - dst._wingVector = getAtomPosition(wingEnd).clone().sub(getAtomPosition(wingStart)); - dst._isValid = true; - - var cylSource = this._findFirstAtomInList(cCylinderSource); - - var targetList = this.getCylinderTargetList(); - var cylTarget = targetList !== null ? this._findFirstAtomInList(targetList) : null; - - if (cylSource === null || cylTarget === null) { - return; - } - - dst._cylinders = [getAtomPosition(cylSource), getAtomPosition(cylTarget)]; - } - }, { - key: "calcWing", - value: function calcWing(prevLeadPos, currLeadPos, prevWingPos, prevWing) { - var vectorA = currLeadPos.clone().sub(prevLeadPos); - var vectorB = prevLeadPos.clone().sub(prevWingPos); - vectorB.crossVectors(vectorA, vectorB); - vectorB.crossVectors(vectorA, vectorB).normalize(); - - if (prevWing !== null && prevWing.length() > 0.0001) { - var needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2; - - if (needToNegate) { - vectorB.negate(); - } - } - - return vectorB; - } - }, { - key: "_innerFinalize", - value: function _innerFinalize(prevRes, prev, nextRes, dst, chainAsNucleic, getAtomPosition) { - var bFirstInChain = prev === null; - var lp = getAtomPosition(this._leadAtom); - var currLeadPos = new Vector3(lp.x, lp.y, lp.z); - - if (chainAsNucleic) { - this._detectLeadWing(dst, nextRes, getAtomPosition); - - return; - } - - if (bFirstInChain) { - // for first one in chain - dst._midPoint = getAtomPosition(this._firstAtom).clone(); - } else { - var prevLeadPos = prev._controlPoint; // lead point of previous monomer - - dst._midPoint = prevLeadPos.clone().lerp(currLeadPos, 0.5); - dst._wingVector = this.calcWing(prevLeadPos, currLeadPos, getAtomPosition(prevRes._wingAtom), prev._wingVector); - } - - dst._controlPoint = currLeadPos; - } - }, { - key: "_finalize2", - value: function _finalize2(prev, next, asNucleic) { - // Should be called AFTER first finalize - this._innerFinalize(prev, prev, next, this, asNucleic, function (atom) { - return atom.position; - }); - } - }, { - key: "isConnected", - value: function isConnected(anotherResidue) { - if (this._chain !== anotherResidue._chain) { - return false; - } - - if (this === anotherResidue) { - return true; - } - - var res = false; - this.forEachAtom(function (atom) { - var bonds = atom.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - var bond = bonds[i]; - - if (bond._left.residue === anotherResidue || bond._right.residue === anotherResidue) { - res = true; - return true; - } - } - - return false; - }); - return res; - } - }, { - key: "_finalize", - value: function _finalize() { - var self = this; - - var _this$_atoms = slicedToArray(this._atoms, 1); - - this._firstAtom = _this$_atoms[0]; - this._lastAtom = this._atoms[this._atoms.length - 1]; - this._leadAtom = null; - this._wingAtom = null; - var tempCount = 0; - var temperature = 0; // average temperature - - var occupCount = 0; - var occupancy = 0; // average occupancy - - this.forEachAtom(function (a) { - if (self._leadAtom === null) { - if (a.role === Element.Constants.Lead) { - self._leadAtom = a; - } - } - - if (self._wingAtom === null) { - if (a.role === Element.Constants.Wing) { - self._wingAtom = a; - } - } - - if (a.temperature) { - temperature += a.temperature; - tempCount++; - } - - if (a.occupancy) { - occupancy += a.occupancy; - occupCount++; - } - - return self._leadAtom !== null && self._wingAtom !== null; - }); - - if (tempCount > 0) { - this.temperature = temperature / tempCount; - } - - if (occupCount > 0) { - this.occupancy = occupancy / occupCount; - } // Still try to make monomer look valid - - - if (this._leadAtom === null || this._wingAtom === null) { - this._isValid = false; - } - - if (this._leadAtom === null) { - this._leadAtom = this._firstAtom; - } - - if (this._wingAtom === null) { - this._wingAtom = this._lastAtom; - } - } - }]); - - return Residue; -}(); - -/** - * Residue type. - * - * Predefined acid or created with HET, HETNAM, etc. - * - * @param {string} name - Short name, either standard (ALA, MET, etc.) or non-standard one. - * @param {string} fullName - Full residue name. - * @param {string} letterCode - 1-letter symbol. - * - * @exports ResidueType - * @constructor - */ -var ResidueType = /*#__PURE__*/function () { - function ResidueType(name, fullName, letterCode) { - classCallCheck(this, ResidueType); - - this._name = name; - this._fullName = fullName; - this.letterCode = letterCode; - this.flags = 0x0000; - } - - createClass(ResidueType, [{ - key: "getName", - value: function getName() { - return this._name; - } // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. - - }]); - - return ResidueType; -}(); // Flag combinations - - -defineProperty(ResidueType, "StandardTypes", { - /* eslint-disable no-magic-numbers */ - ALA: new ResidueType('ALA', 'Alanine', 'A'), - ARG: new ResidueType('ARG', 'Arginine', 'R'), - ASN: new ResidueType('ASN', 'Asparagine', 'N'), - ASP: new ResidueType('ASP', 'Aspartic Acid', 'D'), - CYS: new ResidueType('CYS', 'Cysteine', 'C'), - GLN: new ResidueType('GLN', 'Glutamine', 'Q'), - GLU: new ResidueType('GLU', 'Glutamic Acid', 'E'), - GLY: new ResidueType('GLY', 'Glycine', 'G'), - HIS: new ResidueType('HIS', 'Histidine', 'H'), - ILE: new ResidueType('ILE', 'Isoleucine', 'I'), - LEU: new ResidueType('LEU', 'Leucine', 'L'), - LYS: new ResidueType('LYS', 'Lysine', 'K'), - MET: new ResidueType('MET', 'Methionine', 'M'), - PHE: new ResidueType('PHE', 'Phenylalanine', 'F'), - PRO: new ResidueType('PRO', 'Proline', 'P'), - PYL: new ResidueType('PYL', 'Pyrrolysine', 'O'), - SEC: new ResidueType('SEC', 'Selenocysteine', 'U'), - SER: new ResidueType('SER', 'Serine', 'S'), - THR: new ResidueType('THR', 'Threonine', 'T'), - TRP: new ResidueType('TRP', 'Tryptophan', 'W'), - TYR: new ResidueType('TYR', 'Tyrosine', 'Y'), - VAL: new ResidueType('VAL', 'Valine', 'V'), - A: new ResidueType('A', 'Adenine', 'A'), - C: new ResidueType('C', 'Cytosine', 'C'), - G: new ResidueType('G', 'Guanine', 'G'), - I: new ResidueType('I', 'Inosine', 'I'), - T: new ResidueType('T', 'Thymine', 'T'), - U: new ResidueType('U', 'Uracil', 'U'), - DA: new ResidueType('DA', 'Adenine', 'A'), - DC: new ResidueType('DC', 'Cytosine', 'C'), - DG: new ResidueType('DG', 'Guanine', 'G'), - DI: new ResidueType('DI', 'Inosine', 'I'), - DT: new ResidueType('DT', 'Thymine', 'T'), - DU: new ResidueType('DU', 'Uracil', 'U'), - '+A': new ResidueType('+A', 'Adenine', 'A'), - '+C': new ResidueType('+C', 'Cytosine', 'C'), - '+G': new ResidueType('+G', 'Guanine', 'G'), - '+I': new ResidueType('+I', 'Inosine', 'I'), - '+T': new ResidueType('+T', 'Thymine', 'T'), - '+U': new ResidueType('+U', 'Uracil', 'U'), - WAT: new ResidueType('WAT', 'Water', ''), - H2O: new ResidueType('H2O', 'Water', ''), - HOH: new ResidueType('HOH', 'Water', ''), - DOD: new ResidueType('DOD', 'Water', ''), - UNK: new ResidueType('UNK', 'Unknown', ''), - UNL: new ResidueType('UNL', 'Unknown Ligand', '') - /* eslint-enable no-magic-numbers */ - -}); - -defineProperty(ResidueType, "Flags", { - // Amino acids - - /** Amino acid residue */ - PROTEIN: 0x0001, - - /** Basic amino acid residue */ - BASIC: 0x0002, - - /** Acidic amino acid residue */ - ACIDIC: 0x0004, - - /** Polar uncharged side chain amino acid residue */ - POLAR: 0x0008, - - /** Non-polar hydrophobic side chain amino acid residue */ - NONPOLAR: 0x0010, - - /** Aromatic amino acid residue */ - AROMATIC: 0x0020, - // Nucleic acids - - /** Nucleic residue */ - NUCLEIC: 0x0100, - - /** Purine nucleic residue */ - PURINE: 0x0200, - - /** Pyrimidine nucleic residue */ - PYRIMIDINE: 0x0400, - - /** DNA */ - DNA: 0x0800, - - /** RNA */ - RNA: 0x1000, - - /** Water */ - WATER: 0x10000 -}); - -function _addFlag(flag, list) { - for (var i = 0, n = list.length; i < n; ++i) { - var res = ResidueType.StandardTypes[list[i]]; - - if (res) { - res.flags |= flag; - } - } -} - -var Flags = ResidueType.Flags; - -_addFlag(Flags.WATER, ['WAT', 'H2O', 'HOH', 'DOD']); - -_addFlag(Flags.PROTEIN, ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLY', 'GLU', 'GLN', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'PYL', 'SEC', 'SER', 'THR', 'TRP', 'TYR', 'VAL']); - -_addFlag(Flags.BASIC, ['ARG', 'HIS', 'LYS']); - -_addFlag(Flags.ACIDIC, ['ASP', 'GLU']); - -_addFlag(Flags.POLAR, ['ASN', 'CYS', 'GLN', 'SER', 'THR', 'TYR']); - -_addFlag(Flags.NONPOLAR, ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'VAL', 'GLY']); - -_addFlag(Flags.AROMATIC, ['PHE', 'TRP', 'TYR']); - -_addFlag(Flags.NUCLEIC, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I', 'C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']); - -_addFlag(Flags.PURINE, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I']); - -_addFlag(Flags.PYRIMIDINE, ['C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']); - -_addFlag(Flags.DNA, ['DA', 'DG', 'DI', 'DC', 'DT', 'DU']); - -_addFlag(Flags.RNA, ['A', 'G', 'I', 'C', 'T', 'U']); // Table of kdHydrophobicity - - -var hydro = { - ILE: 4.5, - VAL: 4.2, - LEU: 3.8, - PHE: 2.8, - CYS: 2.5, - MET: 1.9, - ALA: 1.8, - GLY: -0.4, - THR: -0.7, - SER: -0.8, - TRP: -0.9, - TYR: -1.3, - PRO: -1.6, - HIS: -3.2, - GLU: -3.5, - GLN: -3.5, - ASP: -3.5, - ASN: -3.5, - LYS: -3.9, - ARG: -4.5 -}; - -function _addParam(param, list) { - var keys = Object.keys(list); - - for (var i = 0, n = keys.length; i < n; ++i) { - var key = keys[i]; - var value = list[key]; - ResidueType.StandardTypes[key][param] = value; - } -} - -_addParam('hydrophobicity', hydro); - -/** - * Residues in chain are either amino acid either nucleic acid (and water) - * There might be some modified/mutated residues, which type could not be determined by their name (nucleic or amino); In this - * case firstly program definites the chain type (by well-known residues) and then definites modified/mutated residues - */ - -var ChainType = { - UNKNOWN: 0, - PROTEIN: 1, - NUCLEIC: 2 -}; -/** - * Residue chain. - * - * @param {Complex} complex - Molecular complex this chain belongs to. - * @param {string} name - One character identifier (usually space, A-Z, 0-9, or a-z). - * - * @exports Chain - * @constructor - */ - -var Chain = /*#__PURE__*/function () { - function Chain(complex, name) { - classCallCheck(this, Chain); - - this._complex = complex; - this._name = name; - this._mask = 1 | 0; - this._index = -1; - this._residues = []; - this.minSequence = Number.POSITIVE_INFINITY; - this.maxSequence = Number.NEGATIVE_INFINITY; - } - - createClass(Chain, [{ - key: "getComplex", - value: function getComplex() { - return this._complex; - } - }, { - key: "getName", - value: function getName() { - return this._name; - } - }, { - key: "getResidues", - value: function getResidues() { - return this._residues; - } - }, { - key: "_determineType", - value: function _determineType() { - var residues = this._residues; - var _ResidueType$Flags = ResidueType.Flags, - PROTEIN = _ResidueType$Flags.PROTEIN, - NUCLEIC = _ResidueType$Flags.NUCLEIC; - this.type = ChainType.UNKNOWN; - - for (var i = 0, n = residues.length; i < n; ++i) { - var flags = residues[i]._type.flags; - - if ((flags & NUCLEIC) !== 0) { - this.type = ChainType.NUCLEIC; - break; - } else if ((flags & PROTEIN) !== 0) { - this.type = ChainType.PROTEIN; - break; - } - } - } - /** - * Finds thre residue with specified sequence number and inserion code - * @param {Number} seqNum sequence number - * @param {string} iCode insertion code - * @returns {*} Residue or null if not found - */ - - }, { - key: "findResidue", - value: function findResidue(seqNum, iCode) { - var residues = this._residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - var res = residues[i]; - - if (res._sequence === seqNum && res._icode === iCode) { - return [res, i]; - } - } - - return null; - } - }, { - key: "_finalize", - value: function _finalize() { - this._determineType(); - - var residues = this._residues; - var prev = null; - - for (var i = 0, n = residues.length; i < n; ++i) { - var next = i + 1 < n ? residues[i + 1] : null; - var curr = residues[i]; // TODO: skip invalid residues - - { - // eslint-disable-line no-constant-condition - curr._finalize2(prev, next, this.type === ChainType.NUCLEIC); - - prev = curr; - } - } // fix very first wing - - - if (residues.length > 1 && residues[1]._wingVector) { - var p = residues[1]._wingVector; - residues[0]._wingVector = new Vector3(p.x, p.y, p.z); - } else if (residues.length > 0) { - residues[0]._wingVector = new Vector3(1, 0, 0); - } - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - var residues = this._residues; - var prev = null; - var prevData = null; - var frameRes = frameData._residues; - var n = residues.length; - - function getAtomPos(atom) { - return frameData.getAtomPos(atom.index); - } - - for (var i = 0; i < n; ++i) { - var curr = residues[i]; - var currData = frameRes[curr._index]; - var nextRes = i + 1 < n ? residues[i + 1] : null; - - curr._innerFinalize(prev, prevData, nextRes, currData, this.type === ChainType.NUCLEIC, getAtomPos); - - prev = curr; - prevData = currData; - } - - frameRes[residues[0]._index]._wingVector = n > 1 ? frameRes[residues[1]._index]._wingVector : new Vector3(1, 0, 0); - } - /** - * Create a new residue. - * - * @param {string} name - Residue name. - * @param {number} sequence - Residue sequence number. - * @param {string} iCode - Insertion code. - * @returns {Residue} - Newly created residue instance. - */ - - }, { - key: "addResidue", - value: function addResidue(name, sequence, iCode) { - var type = this._complex.getResidueType(name); - - if (type === null) { - type = this._complex.addResidueType(name); - } - - var residue = new Residue(this, type, sequence, iCode); - - this._complex.addResidue(residue); - - this._residues.push(residue); - - if (type.flags & (ResidueType.Flags.NUCLEIC | ResidueType.Flags.PROTEIN)) { - if (this.maxSequence < sequence) { - this.maxSequence = sequence; - } - - if (this.minSequence > sequence) { - this.minSequence = sequence; - } - } - - return residue; - } - }, { - key: "getResidueCount", - value: function getResidueCount() { - return this._residues.length; - } - }, { - key: "forEachResidue", - value: function forEachResidue(process) { - var residues = this._residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - process(residues[i]); - } - } - }, { - key: "collectMask", - value: function collectMask() { - var mask = 0xffffffff; - var residues = this._residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - mask &= residues[i]._mask; - } - - this._mask = mask; - } - }]); - - return Chain; -}(); - -var _StructuralElement$ge; -/** An element of protein secondary structure. */ - -var StructuralElement = /*#__PURE__*/function () { - /** - * Create a secondary structural element of the specified type. - * - * @param {StructuralElement.Type} type Secondary structure type. - * @param {Residue} init Initial residue. - * @param {Residue} term Terminal residue. - */ - function StructuralElement(type, init, term) { - classCallCheck(this, StructuralElement); - - /** - * Secondary structure type. - * @type {StructuralElement.Type} - */ - this.type = type; - /** - * Generic secondary structure type. - * @type {StructuralElement.Generic} - */ - - this.generic = StructuralElement.genericByType[this.type] || 'loop'; - /** - * Initial residue. - * @type Residue - */ - - this.init = init; - /** - * Terminal residue. - * @type Residue - */ - - this.term = term; - } - /** - * An internal method for making a final pass over the complex to set all required references. - * - * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring. - * Just copying it as-is right now and hoping for the best. - * - * @param {object} serialAtomMap A dictionary of atoms - * @param {object} residueHash A dictionary of hashed residues to check. - * @param {Complex} complex The molecular complex this element belongs to. - */ - - - createClass(StructuralElement, [{ - key: "_finalize", - value: function _finalize(serialAtomMap, residueHash, complex) { - if (this.init instanceof Residue && this.term instanceof Residue) { - return; - } // Link all intermediate residues to this structural element - - - var start = complex.splitUnifiedSerial(this.init); - var end = complex.splitUnifiedSerial(this.term); - - for (var chainId = start.chain; chainId <= end.chain; chainId++) { - for (var serialId = start.serial; serialId <= end.serial; serialId++) { - for (var iCode = start.iCode; iCode <= end.iCode; iCode++) { - var hashCode = complex.getUnifiedSerial(chainId, serialId, iCode); - - if (residueHash[hashCode]) { - residueHash[hashCode]._secondary = this; - } - } - } - } // Replace unfined serials by objects - - - this.init = residueHash[this.init]; - this.term = residueHash[this.term]; - } - }]); - - return StructuralElement; -}(); -/** - * Specific type of a secondary structural element. - * @enum {string} - * @see StructuralElement.Generic - */ - - -StructuralElement.Type = { - /** A strand of a [beta-sheet](https://en.wikipedia.org/wiki/Beta_sheet). */ - STRAND: 'E', - - /** An isolated beta-bridge (too small for a beta-sheet). */ - BRIDGE: 'B', - - /** A [3/10 helix](https://en.wikipedia.org/wiki/310_helix) (hydrogen bonding is 3 residues apart). */ - HELIX_310: 'G', - - /** An [alpha-helix](https://en.wikipedia.org/wiki/Alpha_helix) (hydrogen bonding is 4 residues apart). */ - HELIX_ALPHA: 'H', - - /** A [pi-helix](https://en.wikipedia.org/wiki/Pi_helix) (hydrogen bonding is 5 residues apart). */ - HELIX_PI: 'I', - - /** A generic helix of unspecified bonding distance. */ - HELIX: 'X', - - /** An isolated 3/10-like helical turn. */ - TURN_310: '3', - - /** An isolated alpha-like helical turn. */ - TURN_ALPHA: '4', - - /** An isolated pi-like helical turn. */ - TURN_PI: '5', - - /** An isolated helical [turn](https://en.wikipedia.org/wiki/Turn_(biochemistry)) of unspecified bonding distance. */ - TURN: 'T', - - /** A bend (a region of high curvature). */ - BEND: 'S', - - /** Just a protein section with no particular conformation. */ - COIL: 'C' -}; -/** - * Generic type of a secondary structural element. - * @enum {string} - * @see StructuralElement.Type - */ - -StructuralElement.Generic = { - /** A strand of a sheet. */ - STRAND: 'strand', - - /** A helix. */ - HELIX: 'helix', - - /** Just a protein section with no particular conformation. */ - LOOP: 'loop' -}; -var StructuralElementType = StructuralElement.Type; -var StructuralElementGeneric = StructuralElement.Generic; -/** - * A mapping from specific types to generic ones. - * @type {Object} - */ - -StructuralElement.genericByType = (_StructuralElement$ge = {}, defineProperty(_StructuralElement$ge, StructuralElementType.STRAND, StructuralElementGeneric.STRAND), defineProperty(_StructuralElement$ge, StructuralElementType.HELIX_310, StructuralElementGeneric.HELIX), defineProperty(_StructuralElement$ge, StructuralElementType.HELIX_ALPHA, StructuralElementGeneric.HELIX), defineProperty(_StructuralElement$ge, StructuralElementType.HELIX_PI, StructuralElementGeneric.HELIX), defineProperty(_StructuralElement$ge, StructuralElementType.HELIX, StructuralElementGeneric.HELIX), _StructuralElement$ge); - -var StructuralElementType$1 = StructuralElement.Type; -var typeByPDBHelixClass = { - 1: StructuralElementType$1.HELIX_ALPHA, - 3: StructuralElementType$1.HELIX_PI, - 5: StructuralElementType$1.HELIX_310 -}; -/** - * Helical secondary structure of a protein. - * @extends StructuralElement - */ - -var Helix = /*#__PURE__*/function (_StructuralElement) { - inherits(Helix, _StructuralElement); - - /** - * Create a helix. - * - * @param {number} helixClass A helix class according to the - * [PDB Format](http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX). - * @param {Residue} init Initial residue. - * @param {Residue} term Terminal residue. - * @param {number} serial Serial number of the helix (see PDB Format). - * @param {string} name Helix identifier (see PDB Format). - * @param {string} comment Comment about this helix (see PDB Format). - * @param {number} length Length of this helix, in residues (see PDB Format). - */ - function Helix(helixClass, init, term, serial, name, comment, length) { - var _this; - - classCallCheck(this, Helix); - - _this = possibleConstructorReturn(this, getPrototypeOf(Helix).call(this, typeByPDBHelixClass[helixClass] || StructuralElement.Type.HELIX, init, term)); - /** - * Serial number of the helix (see PDB Format). - * @type {number} - */ - - _this.serial = serial; - /** - * Helix identifier (see PDB Format). - * @type {string} - */ - - _this.name = name; - /** - * Comment about this helix (see PDB Format). - * @type {string} - */ - - _this.comment = comment; - /** - * Length of this helix, in residues (see PDB Format). - * @type {number} - */ - - _this.length = length; - return _this; - } - - return Helix; -}(StructuralElement); - -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - - return object; -} - -var superPropBase = _superPropBase; - -var get = createCommonjsModule(function (module) { -function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - module.exports = _get = Reflect.get; - } else { - module.exports = _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - } - - return _get(target, property, receiver || target); -} - -module.exports = _get; -}); - -/** - * A single strand of a sheet in a protein secondary structure. - * @extends StructuralElement - */ - -var Strand = /*#__PURE__*/function (_StructuralElement) { - inherits(Strand, _StructuralElement); - - /** - * Create a strand. - * - * @param {Sheet} sheet Parent sheet this strand belongs to. - * @param {Residue} init Initial residue. - * @param {Residue} term Terminal residue. - * @param {number} sense Sense of strand with respect to previous strand in the sheet. - * - 0 if the first strand, - * - 1 if parallel, and - * - -1 if anti-parallel. - * @param {Atom} atomCur Atom in current strand (see PDB Format). - * @param {Atom} atomPrev Atom in previous strand (see PDB Format). - */ - function Strand(sheet, init, term, sense, atomCur, atomPrev) { - var _this; - - classCallCheck(this, Strand); - - _this = possibleConstructorReturn(this, getPrototypeOf(Strand).call(this, StructuralElement.Type.STRAND, init, term)); - /** - * Parent sheet this strand belongs to. - * @type {Sheet} - */ - - _this.sheet = sheet; - /** - * Sense of strand with respect to previous strand in the sheet. - * - 0 if the first strand, - * - 1 if parallel, and - * - -1 if anti-parallel. - * @type {number} - */ - - _this.sense = sense; - /** - * Atom in current strand (see PDB Format). - * @type {Atom} - */ - - _this.atomCur = atomCur; - /** - * Atom in previous strand (see PDB Format). - * @type {Atom} - */ - - _this.atomPrev = atomPrev; - return _this; - } - /** - * An internal method for making a final pass over the complex to set all required references. - * - * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring. - * Just copying it as-is right now and hoping for the best. - * - * @param {object} serialAtomMap A dictionary of atoms - * @param {object} residueHash A dictionary of hashed residues to check. - * @param {Complex} complex The molecular complex this element belongs to. - * - * @override - */ - - - createClass(Strand, [{ - key: "_finalize", - value: function _finalize(serialAtomMap, residueHash, complex) { - get(getPrototypeOf(Strand.prototype), "_finalize", this).call(this, serialAtomMap, residueHash, complex); - - var as = this.atomCur; - - if (as !== null && !Number.isNaN(as)) { - this.atomCur = serialAtomMap[as]; - } - - as = this.atomPrev; - - if (as !== null && !Number.isNaN(as)) { - this.atomPrev = serialAtomMap[as]; - } - } - }]); - - return Strand; -}(StructuralElement); - -/** - * Sheet secondary structure of a protein. - * - * @param {string} name - - * @param {number} width - - * - * @exports Sheet - * @constructor - */ - -var Sheet = /*#__PURE__*/function () { - function Sheet(name, width) { - classCallCheck(this, Sheet); - - this._name = name; - this._width = width; - this._strands = []; - } // Getters and setters - - - createClass(Sheet, [{ - key: "getName", - value: function getName() { - return this._name; - } - }, { - key: "getWidth", - value: function getWidth() { - return this._width; - } - }, { - key: "addStrand", - value: function addStrand(strand) { - this._strands.push(strand); - - this._width = this._strands.length; - } - }, { - key: "addEmptyStrand", - value: function addEmptyStrand() { - this._strands.push(new Strand(null, null, null, null, null, null)); - } - }, { - key: "_finalize", - value: function _finalize(serialAtomMap, residueHash, complex) { - var s = this._strands; - - for (var i = 0, n = s.length; i < n; ++i) { - s[i]._finalize(serialAtomMap, residueHash, complex); - } - - if (!this._width) { - this._width = s.length; - } - - if (s.length !== this._width) { - throw new Error("Sheet ".concat(this._name, " is inconsistent.")); - } - } - }]); - - return Sheet; -}(); - -/** - * Atom measurements. - * - * @param {string} id - SGroup id - * @param {string} name - Name of the group - * @param {THREE.Vector3} position - Registered coordinates - * @param {array} atoms - Atoms group consists of - * @param {object} saveNode - XML node from file for saving - * - * @exports SGroup - * @constructor - */ - -var SGroup = /*#__PURE__*/function () { - function SGroup(id, name, position, atoms, saveNode) { - classCallCheck(this, SGroup); - - this._id = id; - this._name = name; - this._position = position || new Vector3(); - this._atoms = atoms || []; - this._charge = 0; // default group charge - - this._repeat = 1; // how many times group repeated: always > 0 - - this._center = null; - this.xmlNodeRef = saveNode || null; - } - /** - * Get atom full name. - * @returns {string} Atom full name. - */ - - - createClass(SGroup, [{ - key: "getName", - value: function getName() { - return this._name; - } - }, { - key: "getPosition", - value: function getPosition() { - return this._position; - } - }, { - key: "getCentralPoint", - value: function getCentralPoint() { - return this._center; - } - }, { - key: "_rebuildSGroupOnAtomChange", - value: function _rebuildSGroupOnAtomChange() { - var nLimon = 100000000; - - if (this._center === null) { - return; // nothing to do if we are not relative - } - - var bLow = new Vector3(nLimon, nLimon, nLimon); - var bHight = new Vector3(-nLimon, -nLimon, -nLimon); - - for (var j = 0, n = this._atoms.length; j < n; j++) { - var aPos = this._atoms[j].position; - bLow.set(Math.min(bLow.x, aPos.x), Math.min(bLow.y, aPos.y), Math.min(bLow.z, aPos.z)); - bHight.set(Math.max(bHight.x, aPos.x), Math.max(bHight.y, aPos.y), Math.max(bHight.z, aPos.z)); - } - - this._center.addVectors(bLow, bHight); - - this._center.multiplyScalar(0.5); - } - }]); - - return SGroup; -}(); - -/* eslint-disable */ -// DO NOT EDIT! Automatically generated from .jison - -/* parser generated by jison 0.4.18 */ - -/* - Returns a Parser object of the following structure: - - Parser: { - yy: {} - } - - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), - - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), - - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, - - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } - - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) - } -*/ -var parser = function () { - var o = function o(k, v, _o, l) { - for (_o = _o || {}, l = k.length; l--; _o[k[l]] = v) { - } - - return _o; - }, - $V0 = [1, 4], - $V1 = [1, 5], - $V2 = [1, 6], - $V3 = [1, 7], - $V4 = [1, 8], - $V5 = [1, 9], - $V6 = [1, 11], - $V7 = [1, 12], - $V8 = [5, 7, 8, 11], - $V9 = [1, 17], - $Va = [1, 22], - $Vb = [1, 20], - $Vc = [1, 21], - $Vd = [5, 7, 8, 11, 19]; - - var parser = { - trace: function trace() {}, - yy: {}, - symbols_: { - "error": 2, - "Program": 3, - "Expression": 4, - "EOF": 5, - "Selector": 6, - "OR": 7, - "AND": 8, - "NOT": 9, - "(": 10, - ")": 11, - "SELECTOR": 12, - "NAMED_SELECTOR": 13, - "SELECTOR_RANGED": 14, - "RangeList": 15, - "SELECTOR_NAMED": 16, - "NameList": 17, - "Range": 18, - ",": 19, - "NUMBER": 20, - ":": 21, - "Name": 22, - "IDENTIFIER": 23, - "STRING": 24, - "$accept": 0, - "$end": 1 - }, - terminals_: { - 2: "error", - 5: "EOF", - 7: "OR", - 8: "AND", - 9: "NOT", - 10: "(", - 11: ")", - 12: "SELECTOR", - 13: "NAMED_SELECTOR", - 14: "SELECTOR_RANGED", - 16: "SELECTOR_NAMED", - 19: ",", - 20: "NUMBER", - 21: ":", - 23: "IDENTIFIER", - 24: "STRING" - }, - productions_: [0, [3, 2], [4, 1], [4, 3], [4, 3], [4, 2], [4, 3], [6, 1], [6, 1], [6, 2], [6, 2], [15, 1], [15, 3], [18, 1], [18, 3], [17, 1], [17, 3], [22, 1], [22, 1], [22, 1]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate - /* action[1] */ - , $$ - /* vstack */ - , _$ - /* lstack */ - ) { - /* this == yyval */ - var $0 = $$.length - 1; - - switch (yystate) { - case 1: - return $$[$0 - 1]; - - case 3: - this.$ = yy.keyword('or')($$[$0 - 2], $$[$0]); - break; - - case 4: - this.$ = yy.keyword('and')($$[$0 - 2], $$[$0]); - break; - - case 5: - this.$ = yy.keyword('not')($$[$0]); - break; - - case 6: - this.$ = $$[$0 - 1]; - break; - - case 7: - this.$ = yy.keyword($$[$0])(); - break; - - case 8: - this.$ = yy.GetSelector($$[$0].toLowerCase().slice(1, $$[$0].length)); - break; - - case 9: - case 10: - this.$ = yy.keyword($$[$0 - 1])($$[$0]); - break; - - case 11: - this.$ = new yy.RangeList($$[$0]); - break; - - case 12: - case 16: - this.$ = $$[$0 - 2].append($$[$0]); - break; - - case 13: - this.$ = new yy.Range(Number($$[$0])); - break; - - case 14: - this.$ = new yy.Range(Number($$[$0 - 2]), Number($$[$0])); - break; - - case 15: - this.$ = new yy.ValueList($$[$0]); - break; - } - }, - table: [{ - 3: 1, - 4: 2, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, { - 1: [3] - }, { - 5: [1, 10], - 7: $V6, - 8: $V7 - }, o($V8, [2, 2]), { - 4: 13, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, { - 4: 14, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, o($V8, [2, 7]), o($V8, [2, 8]), { - 15: 15, - 18: 16, - 20: $V9 - }, { - 17: 18, - 20: $Va, - 22: 19, - 23: $Vb, - 24: $Vc - }, { - 1: [2, 1] - }, { - 4: 23, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, { - 4: 24, - 6: 3, - 9: $V0, - 10: $V1, - 12: $V2, - 13: $V3, - 14: $V4, - 16: $V5 - }, o($V8, [2, 5]), { - 7: $V6, - 8: $V7, - 11: [1, 25] - }, o($V8, [2, 9], { - 19: [1, 26] - }), o($Vd, [2, 11]), o($Vd, [2, 13], { - 21: [1, 27] - }), o($V8, [2, 10], { - 19: [1, 28] - }), o($Vd, [2, 15]), o($Vd, [2, 17]), o($Vd, [2, 18]), o($Vd, [2, 19]), o([5, 7, 11], [2, 3], { - 8: $V7 - }), o($V8, [2, 4]), o($V8, [2, 6]), { - 18: 29, - 20: $V9 - }, { - 20: [1, 30] - }, { - 20: $Va, - 22: 31, - 23: $Vb, - 24: $Vc - }, o($Vd, [2, 12]), o($Vd, [2, 14]), o($Vd, [2, 16])], - defaultActions: { - 10: [2, 1] - }, - parseError: function parseError(str, hash) { - if (hash.recoverable) { - this.trace(str); - } else { - var error = new Error(str); - error.hash = hash; - throw error; - } - }, - parse: function parse(input) { - var self = this, - stack = [0], - tstack = [], - vstack = [null], - lstack = [], - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - TERROR = 2, - EOF = 1; - var args = lstack.slice.call(arguments, 1); - var lexer = Object.create(this.lexer); - var sharedState = { - yy: {} - }; - - for (var k in this.yy) { - if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState.yy[k] = this.yy[k]; - } - } - - lexer.setInput(input, sharedState.yy); - sharedState.yy.lexer = lexer; - sharedState.yy.parser = this; - - if (typeof lexer.yylloc == 'undefined') { - lexer.yylloc = {}; - } - - var yyloc = lexer.yylloc; - lstack.push(yyloc); - var ranges = lexer.options && lexer.options.ranges; - - if (typeof sharedState.yy.parseError === 'function') { - this.parseError = sharedState.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).parseError; - } - - function lex() { - var token; - token = tstack.pop() || lexer.lex() || EOF; - - if (typeof token !== 'number') { - if (token instanceof Array) { - tstack = token; - token = tstack.pop(); - } - - token = self.symbols_[token] || token; - } - - return token; - } - - var symbol, - state, - action, - r, - yyval = {}, - p, - len, - newState, - expected; - - while (true) { - state = stack[stack.length - 1]; - - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); - } - - action = table[state] && table[state][symbol]; - } - - if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr = ''; - expected = []; - - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push('\'' + this.terminals_[p] + '\''); - } - } - - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); - } - - this.parseError(errStr, { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected - }); - } - - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); - } - - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(lexer.yytext); - lstack.push(lexer.yylloc); - stack.push(action[1]); - symbol = null; - - { - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - } - - break; - - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - - r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); - - if (typeof r !== 'undefined') { - return r; - } - - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - - case 3: - return true; - } - } - - return true; - } - }; - /* generated by jison-lex 0.3.4 */ - - var lexer = function () { - var lexer = { - EOF: 1, - parseError: function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, - // resets the lexer, sets new input - setInput: function setInput(input, yy) { - this.yy = yy || this.yy || {}; - this._input = input; - this._more = this._backtrack = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - - if (this.options.ranges) { - this.yylloc.range = [0, 0]; - } - - this.offset = 0; - return this; - }, - // consumes and returns one char from the input - input: function input() { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - - if (this.options.ranges) { - this.yylloc.range[1]++; - } - - this._input = this._input.slice(1); - return ch; - }, - // unshifts one char (or a string) into the input - unput: function unput(ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; - - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - - var r = this.yylloc.range; - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - - this.yyleng = this.yytext.length; - return this; - }, - // When called from action, caches matched text and appends it on next action - more: function more() { - this._more = true; - return this; - }, - // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. - reject: function reject() { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - } - - return this; - }, - // retain first n characters of the match - less: function less(n) { - this.unput(this.match.slice(n)); - }, - // displays already matched input, i.e. for error messages - pastInput: function pastInput() { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); - }, - // displays upcoming input, i.e. for error messages - upcomingInput: function upcomingInput() { - var next = this.match; - - if (next.length < 20) { - next += this._input.substr(0, 20 - next.length); - } - - return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); - }, - // displays the character position where the lexing error occurred, i.e. for error messages - showPosition: function showPosition() { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; - }, - // test the lexed token: return FALSE when not a match, otherwise return token - test_match: function test_match(match, indexed_rule) { - var token, lines, backup; - - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } - - lines = match[0].match(/(?:\r\n?|\n).*/g); - - if (lines) { - this.yylineno += lines.length; - } - - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length - }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); - - if (this.done && this._input) { - this.done = false; - } - - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - - return false; // rule action called reject() implying the next rule should be tested instead. - } - - return false; - }, - // return next match in input - next: function next() { - if (this.done) { - return this.EOF; - } - - if (!this._input) { - this.done = true; - } - - var token, match, tempMatch, index; - - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - - var rules = this._currentRules(); - - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); - - if (token !== false) { - return token; - } else if (this._backtrack) { - match = false; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - - if (match) { - token = this.test_match(match, rules[index]); - - if (token !== false) { - return token; - } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - - - return false; - } - - if (this._input === "") { - return this.EOF; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - } - }, - // return next match that has a token - lex: function lex() { - var r = this.next(); - - if (r) { - return r; - } else { - return this.lex(); - } - }, - // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) - begin: function begin(condition) { - this.conditionStack.push(condition); - }, - // pop the previously active lexer condition state off the condition stack - popState: function popState() { - var n = this.conditionStack.length - 1; - - if (n > 0) { - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } - }, - // produce the lexer rule set which is active for the currently active lexer condition state - _currentRules: function _currentRules() { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions["INITIAL"].rules; - } - }, - // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available - topState: function topState(n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - - if (n >= 0) { - return this.conditionStack[n]; - } else { - return "INITIAL"; - } - }, - // alias for begin(condition) - pushState: function pushState(condition) { - this.begin(condition); - }, - // return the number of states currently on the stack - stateStackSize: function stateStackSize() { - return this.conditionStack.length; - }, - options: { - "case-insensitive": true - }, - performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { - - switch ($avoiding_name_collisions) { - case 0: - /* skip whitespace */ - break; - - case 1: - return 20; - - case 2: - return 7; - - case 3: - return 8; - - case 4: - return 9; - - case 5: - return 12; - - case 6: - return 16; - - case 7: - return 14; - - case 8: - return 10; - - case 9: - return 11; - - case 10: - return 19; - - case 11: - return 21; - - case 12: - return '<='; - - case 13: - return '>='; - - case 14: - return '<'; - - case 15: - return '>'; - - case 16: - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); - return 24; - - case 17: - return 13; - - case 18: - return 23; - - case 19: - return 5; - - case 20: - return 'INVALID'; - } - }, - rules: [/^(?:\s+)/i, /^(?:(-?(?:[1-9][0-9]+|[0-9]))\b)/i, /^(?:OR\b)/i, /^(?:AND\b)/i, /^(?:NOT\b)/i, /^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\b)/i, /^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\b)/i, /^(?:((SERIAL|SEQUENCE|RESIDX))\b)/i, /^(?:\()/i, /^(?:\))/i, /^(?:,)/i, /^(?::)/i, /^(?:<=)/i, /^(?:>=)/i, /^(?:<)/i, /^(?:>)/i, /^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i, /^(?:(@[_A-Z0-9]+))/i, /^(?:([_A-Z0-9]+))/i, /^(?:$)/i, /^(?:.)/i], - conditions: { - "INITIAL": { - "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], - "inclusive": true - } - } - }; - return lexer; - }(); - - parser.lexer = lexer; - - function Parser() { - this.yy = {}; - } - - Parser.prototype = parser; - parser.Parser = Parser; - return new Parser(); -}(); - -var SelectionParser = { - parser: parser -}; -var SelectionParser_1 = SelectionParser.parser; - -var Range = /*#__PURE__*/function () { - function Range(min, max) { - classCallCheck(this, Range); - - this.min = min; - this.max = typeof max === 'undefined' ? min : max; - } - - createClass(Range, [{ - key: "includes", - value: function includes(value) { - return this.min <= value && value <= this.max; - } - }, { - key: "toString", - value: function toString() { - var min = this.min, - max = this.max; - return min === max ? String(min) : [min, max].join(':'); - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.min, this.max]; - } - }]); - - return Range; -}(); // //////////////////////////////////////////////////////////////////////////// - - -var List = /*#__PURE__*/function () { - function List(arg) { - classCallCheck(this, List); - - if (arg instanceof this.constructor) { - return arg; - } - - if (arg instanceof Array) { - this._values = arg.slice(0); - } else if (arg) { - this._values = [arg]; - } else { - this._values = []; - } - } - - createClass(List, [{ - key: "append", - value: function append(value) { - var values = this._values; - values[values.length] = value; - return this; - } - }, { - key: "remove", - value: function remove(value) { - var values = this._values; - var index = values.indexOf(value); - - if (index >= 0) { - values.splice(index, 1); - } - - return this; - } - }, { - key: "toString", - value: function toString() { - return this._values.join(','); - } - }, { - key: "toJSON", - value: function toJSON() { - var values = this._values; - var result = []; - - for (var i = 0, n = values.length; i < n; ++i) { - var value = values[i]; - result[i] = value.toJSON ? value.toJSON() : value; - } - - return result; - } - }]); - - return List; -}(); //---------------------------------------------------------------------------- - - -var RangeList = /*#__PURE__*/function (_List) { - inherits(RangeList, _List); - - function RangeList() { - classCallCheck(this, RangeList); - - return possibleConstructorReturn(this, getPrototypeOf(RangeList).apply(this, arguments)); - } - - createClass(RangeList, [{ - key: "includes", - value: function includes(value) { - var list = this._values; - - for (var i = 0, n = list.length; i < n; ++i) { - if (list[i].includes(value)) { - return true; - } - } - - return false; - } - }]); - - return RangeList; -}(List); //---------------------------------------------------------------------------- - - -var valuesArray = []; - -var ValueList = /*#__PURE__*/function (_List2) { - inherits(ValueList, _List2); - - function ValueList(arg, upperOnly) { - var _this; - - classCallCheck(this, ValueList); - - var list = _this = possibleConstructorReturn(this, getPrototypeOf(ValueList).call(this, arg)); - - if (upperOnly) { - _this.upperOnly = true; - var values = list._values; - - for (var i = 0, n = values.length; i < n; ++i) { - var value = values[i]; - - if (typeof value === 'string') { - values[i] = value.toUpperCase(); - } - } - } else { - _this.upperOnly = false; - } - - return possibleConstructorReturn(_this, list); - } - - createClass(ValueList, [{ - key: "includes", - value: function includes(value) { - // we do not convert to upper case here for perfomance reasons - // if list is upper case only, value must be converted before it is sent up to here - return this._values.indexOf(value) !== -1; - } - }, { - key: "toString", - value: function toString() { - // Quote values that are not correct identifiers - var values = this._values; - valuesArray.length = 0; - - for (var i = 0, n = values.length; i < n; ++i) { - valuesArray[i] = utils.correctSelectorIdentifier(String(values[i])); - } - - return valuesArray.join(','); - } - }, { - key: "_validate", - value: function _validate(value) { - return this.upperOnly && typeof value === 'string' ? value.toUpperCase() : value; - } - }, { - key: "append", - value: function append(value) { - get(getPrototypeOf(ValueList.prototype), "append", this).call(this, this._validate(value)); - - return this; - } - }, { - key: "remove", - value: function remove(value) { - get(getPrototypeOf(ValueList.prototype), "remove", this).call(this, this._validate(value)); - - return this; - } - }]); - - return ValueList; -}(List); - -/** Base class for atom selectors. */ - -var Selector = /*#__PURE__*/function () { - function Selector() { - classCallCheck(this, Selector); - } - - createClass(Selector, [{ - key: "toString", - value: function toString() { - return this.keyword; - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.name]; - } - }]); - - return Selector; -}(); - -Selector.prototype.name = 'Error'; -Selector.prototype.keyword = 'error'; -/** Base class for list-based atom selectors. */ - -var ListSelector = /*#__PURE__*/function (_Selector) { - inherits(ListSelector, _Selector); - - function ListSelector(list) { - var _this; - - classCallCheck(this, ListSelector); - - _this = possibleConstructorReturn(this, getPrototypeOf(ListSelector).call(this)); - _this.list = list; - return _this; - } - - createClass(ListSelector, [{ - key: "toString", - value: function toString() { - return "".concat(this.keyword, " ").concat(this.list); - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.name, this.list.toJSON()]; - } - }]); - - return ListSelector; -}(Selector); - -var RangeListSelector = /*#__PURE__*/function (_ListSelector) { - inherits(RangeListSelector, _ListSelector); - - function RangeListSelector(arg) { - classCallCheck(this, RangeListSelector); - - return possibleConstructorReturn(this, getPrototypeOf(RangeListSelector).call(this, new RangeList(arg))); - } - - return RangeListSelector; -}(ListSelector); - -var ValueListSelector = /*#__PURE__*/function (_ListSelector2) { - inherits(ValueListSelector, _ListSelector2); - - function ValueListSelector(arg, caseSensitive) { - classCallCheck(this, ValueListSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ValueListSelector).call(this, new ValueList(arg, !caseSensitive))); - } - - return ValueListSelector; -}(ListSelector); - -var NoneSelector = /*#__PURE__*/function (_Selector2) { - inherits(NoneSelector, _Selector2); - - function NoneSelector() { - classCallCheck(this, NoneSelector); - - return possibleConstructorReturn(this, getPrototypeOf(NoneSelector).apply(this, arguments)); - } - - createClass(NoneSelector, [{ - key: "includesAtom", - value: function includesAtom(_atom) { - return false; - } - }]); - - return NoneSelector; -}(Selector); - -NoneSelector.prototype.name = 'None'; -NoneSelector.prototype.keyword = 'none'; - -var AllSelector = /*#__PURE__*/function (_Selector3) { - inherits(AllSelector, _Selector3); - - function AllSelector() { - classCallCheck(this, AllSelector); - - return possibleConstructorReturn(this, getPrototypeOf(AllSelector).apply(this, arguments)); - } - - createClass(AllSelector, [{ - key: "includesAtom", - value: function includesAtom(_atom) { - return true; - } - }]); - - return AllSelector; -}(Selector); - -AllSelector.prototype.name = 'All'; -AllSelector.prototype.keyword = 'all'; - -// Operators -//---------------------------------------------------------------------------- - -var none = new NoneSelector(); - -var PrefixOperator = /*#__PURE__*/function (_Selector) { - inherits(PrefixOperator, _Selector); - - function PrefixOperator(rhs) { - var _this; - - classCallCheck(this, PrefixOperator); - - _this = possibleConstructorReturn(this, getPrototypeOf(PrefixOperator).call(this)); - _this.rhs = rhs || none; - return _this; - } - - createClass(PrefixOperator, [{ - key: "toString", - value: function toString() { - var rhs = this.rhs.priority && this.rhs.priority > this.priority ? "(".concat(this.rhs, ")") : this.rhs; - return "".concat(this.keyword, " ").concat(rhs); - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.name, this.rhs.toJSON()]; - } - }]); - - return PrefixOperator; -}(Selector); - -PrefixOperator.prototype.priority = 1; - -var InfixOperator = /*#__PURE__*/function (_Selector2) { - inherits(InfixOperator, _Selector2); - - function InfixOperator(lhs, rhs) { - var _this2; - - classCallCheck(this, InfixOperator); - - _this2 = possibleConstructorReturn(this, getPrototypeOf(InfixOperator).call(this)); - _this2.lhs = lhs || none; - _this2.rhs = rhs || none; - return _this2; - } - - createClass(InfixOperator, [{ - key: "toString", - value: function toString() { - var lhs = this.lhs.priority && this.lhs.priority > this.priority ? "(".concat(this.lhs, ")") : this.lhs; - var rhs = this.rhs.priority && this.rhs.priority > this.priority ? "(".concat(this.rhs, ")") : this.rhs; - return "".concat(lhs, " ").concat(this.keyword, " ").concat(rhs); - } - }, { - key: "toJSON", - value: function toJSON() { - return [this.name, this.lhs.toJSON(), this.rhs.toJSON()]; - } - }]); - - return InfixOperator; -}(Selector); - -InfixOperator.prototype.priority = 1000; - -var keywords = {}; //---------------------------------------------------------------------------- -// Named selectors -//---------------------------------------------------------------------------- - -function defineSelector(name, SelectorClass) { - var keyword = name.toLowerCase(); - SelectorClass.prototype.keyword = keyword; - SelectorClass.prototype.name = name; - - var factory = function factory() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return construct(SelectorClass, args); - }; - - factory.SelectorClass = SelectorClass; - keywords[keyword] = factory; - return SelectorClass; -} - -defineSelector('Serial', /*#__PURE__*/function (_RangeListSelector) { - inherits(SerialSelector, _RangeListSelector); - - function SerialSelector() { - classCallCheck(this, SerialSelector); - - return possibleConstructorReturn(this, getPrototypeOf(SerialSelector).apply(this, arguments)); - } - - createClass(SerialSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.serial); - } - }]); - - return SerialSelector; -}(RangeListSelector)); -defineSelector('Name', /*#__PURE__*/function (_ValueListSelector) { - inherits(NameSelector, _ValueListSelector); - - function NameSelector() { - classCallCheck(this, NameSelector); - - return possibleConstructorReturn(this, getPrototypeOf(NameSelector).apply(this, arguments)); - } - - createClass(NameSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.name); - } - }]); - - return NameSelector; -}(ValueListSelector)); -defineSelector('AltLoc', /*#__PURE__*/function (_ValueListSelector2) { - inherits(AltLocSelector, _ValueListSelector2); - - function AltLocSelector() { - classCallCheck(this, AltLocSelector); - - return possibleConstructorReturn(this, getPrototypeOf(AltLocSelector).apply(this, arguments)); - } - - createClass(AltLocSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(String.fromCharCode(atom.location)); - } - }]); - - return AltLocSelector; -}(ValueListSelector)); -defineSelector('Elem', /*#__PURE__*/function (_ValueListSelector3) { - inherits(ElemSelector, _ValueListSelector3); - - function ElemSelector() { - classCallCheck(this, ElemSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ElemSelector).apply(this, arguments)); - } - - createClass(ElemSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.element.name); - } - }]); - - return ElemSelector; -}(ValueListSelector)); -defineSelector('Residue', /*#__PURE__*/function (_ValueListSelector4) { - inherits(ResidueSelector, _ValueListSelector4); - - function ResidueSelector() { - classCallCheck(this, ResidueSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ResidueSelector).apply(this, arguments)); - } - - createClass(ResidueSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._type._name); - } - }]); - - return ResidueSelector; -}(ValueListSelector)); -defineSelector('Sequence', /*#__PURE__*/function (_RangeListSelector2) { - inherits(SequenceSelector, _RangeListSelector2); - - function SequenceSelector() { - classCallCheck(this, SequenceSelector); - - return possibleConstructorReturn(this, getPrototypeOf(SequenceSelector).apply(this, arguments)); - } - - createClass(SequenceSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._sequence); - } - }]); - - return SequenceSelector; -}(RangeListSelector)); -defineSelector('ICode', /*#__PURE__*/function (_ValueListSelector5) { - inherits(ICodeSelector, _ValueListSelector5); - - function ICodeSelector(arg) { - classCallCheck(this, ICodeSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ICodeSelector).call(this, arg, true)); - } - - createClass(ICodeSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._icode); - } - }]); - - return ICodeSelector; -}(ValueListSelector)); -defineSelector('ResIdx', /*#__PURE__*/function (_RangeListSelector3) { - inherits(ResIdxSelector, _RangeListSelector3); - - function ResIdxSelector() { - classCallCheck(this, ResIdxSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ResIdxSelector).apply(this, arguments)); - } - - createClass(ResIdxSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._index); - } - }]); - - return ResIdxSelector; -}(RangeListSelector)); -defineSelector('Chain', /*#__PURE__*/function (_ValueListSelector6) { - inherits(ChainSelector, _ValueListSelector6); - - function ChainSelector(arg) { - classCallCheck(this, ChainSelector); - - return possibleConstructorReturn(this, getPrototypeOf(ChainSelector).call(this, arg, true)); - } - - createClass(ChainSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.list.includes(atom.residue._chain._name); - } - }]); - - return ChainSelector; -}(ValueListSelector)); -defineSelector('Hetatm', /*#__PURE__*/function (_Selector) { - inherits(HetatmSelector, _Selector); - - function HetatmSelector() { - classCallCheck(this, HetatmSelector); - - return possibleConstructorReturn(this, getPrototypeOf(HetatmSelector).apply(this, arguments)); - } - - createClass(HetatmSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return atom.het; - } - }]); - - return HetatmSelector; -}(Selector)); -defineSelector('PolarH', /*#__PURE__*/function (_Selector2) { - inherits(PolarHSelector, _Selector2); - - function PolarHSelector() { - classCallCheck(this, PolarHSelector); - - return possibleConstructorReturn(this, getPrototypeOf(PolarHSelector).apply(this, arguments)); - } - - createClass(PolarHSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.HYDROGEN; - } - }]); - - return PolarHSelector; -}(Selector)); -defineSelector('NonPolarH', /*#__PURE__*/function (_Selector3) { - inherits(NonPolarHSelector, _Selector3); - - function NonPolarHSelector() { - classCallCheck(this, NonPolarHSelector); - - return possibleConstructorReturn(this, getPrototypeOf(NonPolarHSelector).apply(this, arguments)); - } - - createClass(NonPolarHSelector, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.NONPOLARH; - } - }]); - - return NonPolarHSelector; -}(Selector)); -defineSelector('All', AllSelector); -defineSelector('None', NoneSelector); -var NULL_SELECTOR = keywords.none(); //---------------------------------------------------------------------------- -// Named operators -//---------------------------------------------------------------------------- - -function defineOperator(name, priority, OperatorClass) { - OperatorClass.prototype.priority = priority; - return defineSelector(name, OperatorClass); -} - -defineOperator('Not', 1, /*#__PURE__*/function (_PrefixOperator) { - inherits(NotOperator, _PrefixOperator); - - function NotOperator() { - classCallCheck(this, NotOperator); - - return possibleConstructorReturn(this, getPrototypeOf(NotOperator).apply(this, arguments)); - } - - createClass(NotOperator, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return !this.rhs.includesAtom(atom); - } - }]); - - return NotOperator; -}(PrefixOperator)); -defineOperator('And', 2, /*#__PURE__*/function (_InfixOperator) { - inherits(AndOperator, _InfixOperator); - - function AndOperator() { - classCallCheck(this, AndOperator); - - return possibleConstructorReturn(this, getPrototypeOf(AndOperator).apply(this, arguments)); - } - - createClass(AndOperator, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.lhs.includesAtom(atom) && this.rhs.includesAtom(atom); - } - }]); - - return AndOperator; -}(InfixOperator)); -defineOperator('Or', 3, /*#__PURE__*/function (_InfixOperator2) { - inherits(OrOperator, _InfixOperator2); - - function OrOperator() { - classCallCheck(this, OrOperator); - - return possibleConstructorReturn(this, getPrototypeOf(OrOperator).apply(this, arguments)); - } - - createClass(OrOperator, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return this.lhs.includesAtom(atom) || this.rhs.includesAtom(atom); - } - }]); - - return OrOperator; -}(InfixOperator)); //---------------------------------------------------------------------------- -// Flag selectors -//---------------------------------------------------------------------------- - -function byResidueTypeFlag(flag, name) { - return defineSelector(name, /*#__PURE__*/function (_Selector4) { - inherits(_class, _Selector4); - - function _class() { - classCallCheck(this, _class); - - return possibleConstructorReturn(this, getPrototypeOf(_class).apply(this, arguments)); - } - - createClass(_class, [{ - key: "includesAtom", - value: function includesAtom(atom) { - return (atom.residue._type.flags & flag) !== 0; - } - }]); - - return _class; - }(Selector)); -} - -byResidueTypeFlag(ResidueType.Flags.PROTEIN, 'Protein'); -byResidueTypeFlag(ResidueType.Flags.BASIC, 'Basic'); -byResidueTypeFlag(ResidueType.Flags.ACIDIC, 'Acidic'); -byResidueTypeFlag(ResidueType.Flags.BASIC | ResidueType.Flags.ACIDIC, 'Charged'); -byResidueTypeFlag(ResidueType.Flags.POLAR, 'Polar'); -byResidueTypeFlag(ResidueType.Flags.NONPOLAR, 'NonPolar'); -byResidueTypeFlag(ResidueType.Flags.AROMATIC, 'Aromatic'); -byResidueTypeFlag(ResidueType.Flags.NUCLEIC, 'Nucleic'); -byResidueTypeFlag(ResidueType.Flags.PURINE, 'Purine'); -byResidueTypeFlag(ResidueType.Flags.PYRIMIDINE, 'Pyrimidine'); -byResidueTypeFlag(ResidueType.Flags.WATER, 'Water'); //---------------------------------------------------------------------------- - -var selectors = Object.create(keywords); -selectors.Selector = Selector; -selectors.RangeListSelector = RangeListSelector; -selectors.ValueListSelector = ValueListSelector; -selectors.Range = Range; -selectors.RangeList = RangeList; -selectors.ValueList = ValueList; -selectors.PrefixOperator = PrefixOperator; -selectors.InfixOperator = InfixOperator; -selectors.Context = Object.create({}); - -selectors.GetSelector = function (key) { - if (!selectors.Context.hasOwnProperty(key)) { - var exc = { - message: "selector ".concat(key, " is not registered") - }; - throw exc; - } - - return selectors.Context[key] || NULL_SELECTOR; -}; - -selectors.ClearContext = function () { - Object.keys(selectors.Context).forEach(function (k) { - delete selectors.Context[k]; - }); -}; - -selectors.keyword = function (key) { - return keywords[key.toLowerCase()] || keywords.none; -}; - -selectors.parse = function (str) { - var res = {}; - - try { - res.selector = SelectionParser_1.parse(str); - } catch (e) { - res.selector = NULL_SELECTOR; - res.error = e.message; - } - - return res; -}; - -SelectionParser_1.yy = selectors; -SelectionParser_1.yy.parseError = SelectionParser_1.parseError; // workaround for incorrect JISON parser generator for AMD module - -/** - * Basic biological unit class. - * - * @exports BiologicalUnit - * @constructor - */ - -var BiologicalUnit = /*#__PURE__*/function () { - function BiologicalUnit(complex) { - classCallCheck(this, BiologicalUnit); - - this._complex = complex; - this._selector = selectors.keyword('All')(); - this._boundaries = { - boundingBox: new Box3(), - boundingSphere: new Sphere() - }; - } - - createClass(BiologicalUnit, [{ - key: "computeBoundaries", - value: function computeBoundaries() { - var atoms = this._complex._atoms; - var n = atoms.length; - var selector = this._selector; - var boundingBox = this._boundaries.boundingBox; - boundingBox.makeEmpty(); - - if (n === 1) { - boundingBox.expandByPoint(atoms[0].position); - var bbc = new Vector3(); - boundingBox.getCenter(bbc); - var s = 2 * atoms[0].element.radius; - boundingBox.setFromCenterAndSize(bbc, new Vector3(s, s, s)); - } else { - for (var i = 0; i < n; ++i) { - if (selector.includesAtom(atoms[i])) { - boundingBox.expandByPoint(atoms[i].position); - } - } - } // Build bounding sphere - - - var radiusSquared = 0.0; - var center = new Vector3(); - boundingBox.getCenter(center); - - if (n === 1) { - this._boundaries.boundingSphere.set(center, atoms[0].element.radius); - } else { - for (var _i = 0; _i < n; ++_i) { - if (!selector.includesAtom(atoms[_i])) { - continue; - } - - var pos = atoms[_i].position; - var lengthSquared = center.distanceToSquared(pos); - - if (radiusSquared < lengthSquared) { - radiusSquared = lengthSquared; - } - } - - this._boundaries.boundingSphere.set(center, Math.sqrt(radiusSquared)); - } - } - }, { - key: "getTransforms", - value: function getTransforms() { - return []; - } - }, { - key: "getSelector", - value: function getSelector() { - return this._selector; - } - }, { - key: "getBoundaries", - value: function getBoundaries() { - return this._boundaries; - } - }, { - key: "finalize", - value: function finalize() {} - }]); - - return BiologicalUnit; -}(); - -/** - * Biological assembly. - * - * @exports Assembly - * @constructor - */ - -var Assembly = /*#__PURE__*/function (_BiologicalUnit) { - inherits(Assembly, _BiologicalUnit); - - function Assembly(complex) { - var _this; - - classCallCheck(this, Assembly); - - _this = possibleConstructorReturn(this, getPrototypeOf(Assembly).call(this, complex)); - _this.chains = []; - _this.matrices = []; - return _this; - } - - createClass(Assembly, [{ - key: "computeBoundaries", - value: function computeBoundaries() { - get(getPrototypeOf(Assembly.prototype), "computeBoundaries", this).call(this); // fix up the boundaries - - - var matrices = this.matrices; - var oldCenter = this._boundaries.boundingSphere.center; - var oldRad = this._boundaries.boundingSphere.radius; - var boundingBox = this._boundaries.boundingBox = new Box3(); - boundingBox.makeEmpty(); - - for (var i = 0, n = matrices.length; i < n; ++i) { - boundingBox.expandByPoint(oldCenter.clone().applyMatrix4(matrices[i])); - } - - var newRad = boundingBox.max.distanceTo(boundingBox.min) / 2 + oldRad; - var center = new Vector3(); - boundingBox.getCenter(center); - this._boundaries.boundingSphere = new Sphere().set(center, newRad); - boundingBox.max.addScalar(oldRad); - boundingBox.min.subScalar(oldRad); - } - /** - * Mark a chain as belonging to this biological assembly. - * @param {string} chain - chain identifier, usually a single letter - */ - - }, { - key: "addChain", - value: function addChain(chain) { - this.chains[this.chains.length] = chain; - } - /** - * Add a transformation matrix. - * @param {THREE.Matrix4} matrix - transformation matrix - */ - - }, { - key: "addMatrix", - value: function addMatrix(matrix) { - this.matrices[this.matrices.length] = matrix; - } - }, { - key: "getTransforms", - value: function getTransforms() { - return this.matrices; - } - }, { - key: "finalize", - value: function finalize() { - if (this.chains.length > 0) { - this._selector = selectors.keyword('Chain')(this.chains); - } else { - this._selector = selectors.keyword('None')(); - } - } - }]); - - return Assembly; -}(BiologicalUnit); - -/** - * This class represents connected component as a part of a complex. - * WARNING! The whole component entity is build under the assumption that residues - * are placed in the chains and complex in ascending order of indices - * - * @param {Complex} complex - Molecular complex this chain belongs to. - * - * @exports Component - * @constructor - */ -var Component = /*#__PURE__*/function () { - function Component(complex) { - classCallCheck(this, Component); - - this._complex = complex; - this._index = -1; - this._residueIndices = []; - this._cycles = []; - this._subDivs = []; - this._residueCount = 0; - } - - createClass(Component, [{ - key: "getResidues", - value: function getResidues() { - return this._complex._residues; - } - }, { - key: "getResidueCount", - value: function getResidueCount() { - return this._residueCount; - } - }, { - key: "forEachResidue", - value: function forEachResidue(process) { - var residues = this._complex._residues; - var resIdc = this._residueIndices; - - for (var idIdc = 0, idCount = resIdc.length; idIdc < idCount; ++idIdc) { - for (var idx = resIdc[idIdc].start, last = resIdc[idIdc].end; idx <= last; ++idx) { - process(residues[idx]); - } - } - } - }, { - key: "setSubDivs", - value: function setSubDivs(subDivs) { - this._subDivs = subDivs; - var curr = 0; - var resIdc = []; - var resCnt = 0; - - for (var i = 0, n = subDivs.length; i < n; ++i) { - if (i === n - 1 || subDivs[i].end + 1 !== subDivs[i + 1].start) { - var start = subDivs[curr].start; - var end = subDivs[i].end; - resIdc[resIdc.length] = { - start: start, - end: end - }; - resCnt += end - start + 1; - curr = i + 1; - } - } - - this._residueIndices = resIdc; - this._residueCount = resCnt; - } - }, { - key: "getComplex", - value: function getComplex() { - return this._complex; - } - }, { - key: "forEachBond", - value: function forEachBond(process) { - var bonds = this._complex._bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - var bond = bonds[i]; - - if (bond._left.residue._component === this) { - process(bond); - } - } - } - }, { - key: "update", - value: function update() { - this.forEachCycle(function (cycle) { - cycle.update(); - }); - } - }, { - key: "forEachAtom", - value: function forEachAtom(process) { - this.forEachResidue(function (residue) { - residue.forEachAtom(process); - }); - } - }, { - key: "addCycle", - value: function addCycle(cycle) { - this._cycles.push(cycle); - } - }, { - key: "forEachCycle", - value: function forEachCycle(process) { - var cycles = this._cycles; - - for (var i = 0, n = cycles.length; i < n; ++i) { - process(cycles[i]); - } - } - }, { - key: "markResidues", - value: function markResidues() { - var self = this; - self.forEachResidue(function (residue) { - residue._component = self; - }); - } - }, { - key: "_forEachSubChain", - value: function _forEachSubChain(mask, process) { - var residues = this._complex._residues; - var subs = this._subDivs; - - for (var i = 0, n = subs.length; i < n; ++i) { - for (var idx = subs[i].start, last = subs[i].end; idx <= last; ++idx) { - var currRes = residues[idx]; - - if (mask & currRes._mask && currRes._isValid) { - var end = idx + 1; - - for (; end <= last; ++end) { - var endRes = residues[end]; - - if (!(mask & endRes._mask && endRes._isValid)) { - break; - } - } - - process(i, idx, end - 1); - idx = end; - } - } - } - } - }, { - key: "getMaskedSequences", - value: function getMaskedSequences(mask) { - var subs = []; - var idx = 0; - - this._forEachSubChain(mask, function (_subIdx, start, end) { - subs[idx++] = { - start: start, - end: end - }; - }); - - return subs; - } - }, { - key: "getMaskedSubdivSequences", - value: function getMaskedSubdivSequences(mask) { - var subs = []; - var currIdx = -1; - var lastSubIdx = -1; - var subDivs = this._subDivs; - - this._forEachSubChain(mask, function (subIdx, start, end) { - if (lastSubIdx !== subIdx) { - ++currIdx; - subs[currIdx] = { - arr: [], - boundaries: subDivs[subIdx] - }; - lastSubIdx = subIdx; - } - - subs[currIdx].arr[subs[currIdx].arr.length] = { - start: start, - end: end - }; - }); - - return subs; - } - }]); - - return Component; -}(); - -var cMaxPairsForHashCode = 32; -var cHashTableSize = 1024 * 1024; -var cNumbersPerPair = 4; -var cMaxNeighbours = 14; -var cInvalidVal = -1; // 89237 is a large simple number, can be used for pseudo random hash code create - -var cBigPrime = 89237; - -var AtomPairs = /*#__PURE__*/function () { - function AtomPairs(maxPairsEstimate) { - classCallCheck(this, AtomPairs); - - this.numPairs = 0; - this.numMaxPairs = maxPairsEstimate; - this.intBuffer = utils.allocateTyped(Int32Array, maxPairsEstimate * cNumbersPerPair); - - for (var i = 0; i < maxPairsEstimate * cNumbersPerPair; i++) { - this.intBuffer[i] = cInvalidVal; - } - - this.hashBuffer = utils.allocateTyped(Int32Array, cHashTableSize * cMaxPairsForHashCode); - - for (var _i = 0; _i < cHashTableSize * cMaxPairsForHashCode; _i++) { - this.hashBuffer[_i] = cInvalidVal; - } - } - /** - * Destroy all pairs memory - */ - - - createClass(AtomPairs, [{ - key: "destroy", - value: function destroy() { - this.intBuffer = null; - this.hashBuffer = null; - } - /** - * Add pair of atoms to collection - * @param {number} indexA - Index of the 1st vertex. - * @param {number} indexB - Index of the 2nd vertex. - */ - - }, { - key: "addPair", - value: function addPair(indexA, indexB) { - var ia = indexA < indexB ? indexA : indexB; - var ib = indexA > indexB ? indexA : indexB; - var codeToAdd = ia + (ib << cMaxNeighbours); - var hashCode = ia + ib * cBigPrime & cHashTableSize - 1; - var j = hashCode * cMaxPairsForHashCode; - var apI = 0; - - for (; apI < cMaxPairsForHashCode; apI++) { - var code = this.hashBuffer[j + apI]; - - if (code === cInvalidVal) { - break; - } - - if (code === codeToAdd) { - return false; - } - } // add this new hash code - - - if (apI >= cMaxPairsForHashCode) { - throw new Error('addPair: increase cMaxPairsForHashCode'); - } - - this.hashBuffer[j + apI] = codeToAdd; // actually add - - if (this.numPairs >= this.numMaxPairs) { - throw new Error('addPair: increase num pairs'); - } - - j = this.numPairs * cNumbersPerPair; - this.intBuffer[j] = ia; - this.intBuffer[j + 1] = ib; - this.intBuffer[j + 2] = codeToAdd; - this.numPairs++; - return true; - } - }]); - - return AtomPairs; -}(); - -var cEstBondsMultiplier = 4; -var cSpaceCode = 32; -var cBondTolerance = 0.45; -var cEpsilon = 0.001; -/** - * Get radius used for building bonds. - * - * @param {Atom} atom - Atom object. - * @returns {number} special value for bonding radius for this atom - */ - -function _getBondingRadius(atom) { - var element = atom.element; - - if (element) { - return element.radiusBonding; - } - - throw new Error('_getBondingRadius: Logic error.'); -} - -function _isAtomEligible(atom) { - // build for all non-hetatm and for hetatm without bonds - return !atom.isHet() || atom.bonds && atom.bonds.length === 0; -} -/** - * Bond between atoms. - * - * @param {Complex} complex molecular complex - - * @exports AutoBond - * @constructor - */ - - -var AutoBond = /*#__PURE__*/function () { - function AutoBond(complex) { - classCallCheck(this, AutoBond); - - this._complex = complex; - this._maxRad = 1.8; - - var bBox = this._complex.getDefaultBoundaries().boundingBox; - - this._vBoxMin = bBox.min.clone(); - this._vBoxMax = bBox.max.clone(); - this._pairCollection = null; - } - /** - * Add existing pairs of connectors (from pdb file after its reading) - * @returns {number} 0 - */ - - - createClass(AutoBond, [{ - key: "_addExistingPairs", - value: function _addExistingPairs() { - var atoms = this._complex.getAtoms(); - - var numAtoms = atoms.length; - var aInd = 0; - var collection = this._pairCollection; - - for (; aInd < numAtoms; aInd++) { - var bonds = atoms[aInd].bonds; - var numBondsForAtom = bonds.length; - - for (var bInd = 0; bInd < numBondsForAtom; bInd++) { - var bond = bonds[bInd]; - var indTo = bond._left.index; - - if (indTo === aInd) { - collection.addPair(aInd, bond._right.index); - } - } // for (b) all bonds in atom - - } // for (a) - - - return 0; - } - }, { - key: "_findPairs", - value: function _findPairs() { - var vw = this._complex.getVoxelWorld(); - - if (vw === null) { - return; - } - - var atoms = this._complex._atoms; - var atomsNum = atoms.length; - var self = this; - var rA; - var isHydrogenA; - var posA; - var locationA; - var atomA; - - var processAtom = function processAtom(atomB) { - if (isHydrogenA && atomB.isHydrogen()) { - return; - } - - var locationB = atomB.location; - - if (locationA !== cSpaceCode && locationB !== cSpaceCode && locationA !== locationB) { - return; - } - - var dist2 = posA.distanceToSquared(atomB.position); - var rB = atomB.element.radiusBonding; - var maxAcceptable = rA + rB + cBondTolerance ; - - if (dist2 > maxAcceptable * maxAcceptable) { - return; - } - - if (dist2 < cEpsilon) { - return; - } - - self._pairCollection.addPair(atomA.index, atomB.index); - }; - - for (var i = 0; i < atomsNum; ++i) { - atomA = atoms[i]; - - if (!_isAtomEligible(atomA)) { - continue; - } - - rA = atomA.element.radiusBonding; - isHydrogenA = atomA.isHydrogen(); - posA = atomA.position; - locationA = atomA.location; - vw.forEachAtomWithinRadius(posA, 2 * this._maxRad + cBondTolerance, processAtom); - } - } - }, { - key: "_addPairs", - value: function _addPairs() { - var atoms = this._complex._atoms; - - for (var i = 0, k = 0; i < this._pairCollection.numPairs; i++, k += 4) { - var iA = this._pairCollection.intBuffer[k]; - var iB = this._pairCollection.intBuffer[k + 1]; - - this._addPair(atoms[iA], atoms[iB]); - } - } - }, { - key: "_addPair", - value: function _addPair(atomA, atomB) { - var bondsA = atomA.bonds; - var indexA = atomA.index; - var indexB = atomB.index; - - for (var j = 0, numBonds = bondsA.length; j < numBonds; ++j) { - var bond = bondsA[j]; - - if (bond._left.index === indexB || bond._right.index === indexB) { - return; - } - } - - var left = indexA < indexB ? atomA : atomB; - var right = indexA < indexB ? atomB : atomA; - - var newBond = this._complex.addBond(left, right, 0, Bond.BondType.UNKNOWN, false); - - bondsA.push(newBond); - atomB.bonds.push(newBond); - } - }, { - key: "build", - value: function build() { - - this._buildInner(); - } - }, { - key: "_buildInner", - value: function _buildInner() { - var atoms = this._complex._atoms; - - if (atoms.length < 2) { - return; - } - - if (atoms[0].index < 0) { - throw new Error('AutoBond: Atoms in complex were not indexed.'); - } - - this._calcBoundingBox(); - - this._pairCollection = new AtomPairs(atoms.length * cEstBondsMultiplier); - - this._addExistingPairs(); - - this._findPairs(); - - this._addPairs(); - } - }, { - key: "_calcBoundingBox", - value: function _calcBoundingBox() { - var atoms = this._complex._atoms; - var nAtoms = atoms.length; - - var maxRad = _getBondingRadius(atoms[0]); - - for (var i = 1; i < nAtoms; ++i) { - maxRad = Math.max(maxRad, _getBondingRadius(atoms[i])); - } - - this._vBoxMax.addScalar(maxRad); - - this._vBoxMin.addScalar(-maxRad); - - this._maxRad = maxRad * 1.2; - } - }, { - key: "destroy", - value: function destroy() { - if (this._pairCollection) { - this._pairCollection.destroy(); - } - } - }]); - - return AutoBond; -}(); - -var cCrossThresh = 0.1; -var cAromaticType = Bond.BondType.AROMATIC; -var cAromaticAtoms = [Element.ByName.C.number, Element.ByName.N.number // Element.ByName.O.number, -// Element.ByName.S.number, -]; -/** Conditions for bonds: - * - Cross product with each subsequent bond to add is collinear and point to the same direction - * - Each pair of a adjacent bonds belong to not more than one cycle - * - If there is more than one candidates we try them in ascending order of angle values - */ - -var _coDirVectors = function () { - var v1Tmp = new Vector3(); - var v2Tmp = new Vector3(); - var cp = new Vector3(); - return function (v1, v2) { - v1Tmp.copy(v1).normalize(); - v2Tmp.copy(v2).normalize(); - cp.crossVectors(v1Tmp, v2Tmp); - - if (cp.length() > cCrossThresh) { - return false; - } // zero vector in out terms must be collinear to any - - - return v1Tmp.dot(v2Tmp) >= 0; - }; -}(); - -function _insertAscending(arr, val) { - var idx = 0; - - while (idx < arr.length && arr[idx] < val) { - ++idx; - } - - arr.splice(idx, 0, val); -} - -function _anotherAtom(bond, currAtom) { - return bond._left === currAtom ? bond._right : bond._left; -} - -function _cosBetween(v1, v2) { - var theta = v1.dot(v2) / Math.sqrt(v1.lengthSq() * v2.lengthSq()); - return Math$1.clamp(theta, -1, 1); -} - -function _markAromatic(bond) { - bond._type = cAromaticType; -} - -var Cycle = /*#__PURE__*/function () { - function Cycle(atomsList) { - classCallCheck(this, Cycle); - - this.atoms = atomsList; - this.update(); - } - - createClass(Cycle, [{ - key: "update", - value: function update() { - var atoms = this.atoms; - var center = new Vector3(); - var nA = atoms.length; - - for (var j = 0; j < nA; ++j) { - center.add(atoms[j].position); - } - - center.multiplyScalar(1.0 / nA); - this.center = center; - this.radius = center.distanceTo(atoms[0].position.clone().lerp(atoms[1].position, 0.5)); - } - }, { - key: "forEachBond", - value: function forEachBond(process) { - var atoms = this.atoms; - var nA = atoms.length; - var currAtom = atoms[0]; - var nextAtom; - - function checkBond(bond) { - if (bond._left === nextAtom || bond._right === nextAtom) { - process(bond); - } - } - - for (var i = 0; i < nA; ++i) { - nextAtom = atoms[(i + 1) % nA]; - currAtom.forEachBond(checkBond); - currAtom = nextAtom; - } - } - }]); - - return Cycle; -}(); - -function _isAromatic(bond) { - return bond._type === cAromaticType; -} - -function _isPossibleAromatic(bond) { - if (bond.type === cAromaticType) { - return true; - } - - var rightIdx = cAromaticAtoms.indexOf(bond._right.element.number); - var leftIdx = cAromaticAtoms.indexOf(bond._left.element.number); - return rightIdx !== -1 && leftIdx !== -1; -} - -function _checkCycleSimple(cycle) { - return cycle.length > 3; -} - -function _checkCycleComplex(cycle) { - console.assert(cycle.length > 2); - return true; -} - -var AromaticLoopsMarker = /*#__PURE__*/function () { - function AromaticLoopsMarker(complex) { - classCallCheck(this, AromaticLoopsMarker); - - this._complex = complex; - var bondsData = new Array(complex._bonds.length); - var bondMarks = new Array(complex._bonds.length); - - for (var i = 0, n = bondsData.length; i < n; ++i) { - bondsData[i] = []; - bondMarks[i] = false; - } - - this._bondsData = bondsData; - this._bondMarks = bondMarks; - - this._resetCycles(); - } - - createClass(AromaticLoopsMarker, [{ - key: "_resetCycles", - value: function _resetCycles() { - this._cycles = []; - this._currIdx = -1; - } - }, { - key: "_haveSameCycle", - value: function _haveSameCycle(bondsData, bond1, bond2) { - var arr1 = bondsData[bond1._index]; - var arr2 = bondsData[bond2._index]; - var n1 = arr1.length; - var n2 = arr2.length; - var i1 = 0; - var i2 = 0; - - while (i1 < n1 && i2 < n2) { - if (arr1[i1] === arr2[i2]) { - return true; - } - - if (arr1[i1] > arr2[i2]) { - ++i2; - } else { - ++i1; - } - } - - return false; - } - }, { - key: "_tryBond", - value: function _tryBond(prevBond, currRight, currDir) { - var bondsOrder = []; - var bondsData = this._bondsData; - - var currLeft = _anotherAtom(prevBond, currRight); - - var currVec = currRight.position.clone().sub(currLeft.position); - var startAtomRef = this._currStart; - var self = this; - var bondMarks = this._bondMarks; - var checkAromatic = this._checkBond; - bondMarks[prevBond._index] = true; - checkAromatic = checkAromatic === undefined ? _isAromatic : checkAromatic; - currRight.forEachBond(function (newBond) { - if (!checkAromatic(newBond) || newBond === prevBond || bondMarks[newBond._index] || self._haveSameCycle(bondsData, prevBond, newBond)) { - return; - } - - var anotherAtom = _anotherAtom(newBond, currRight); - - var anotherVec = anotherAtom.position.clone().sub(currRight.position); - var val = anotherAtom === startAtomRef ? -2.0 : 1 - _cosBetween(currVec, anotherVec); - var newDir = anotherVec.cross(currVec); - - if (!_coDirVectors(newDir, currDir)) { - return; - } - - var idx = 0; - - while (idx < bondsOrder.length && bondsOrder[idx].val < val) { - ++idx; - } - - bondsOrder.splice(idx, 0, { - bond: newBond, - val: val, - dir: newDir - }); - }); - - for (var i = 0, n = bondsOrder.length; i < n; ++i) { - var bond = bondsOrder[i].bond; - var newRight = bond._left === currRight ? bond._right : bond._left; - - if (newRight === startAtomRef) { - ++this._currIdx; - - this._cycles.push([currRight]); - - bondMarks[prevBond._index] = false; - return true; - } - - if (this._tryBond(bond, newRight, bondsOrder[i].dir)) { - _insertAscending(bondsData[bond._index], this._currIdx); - - this._cycles[this._currIdx].push(currRight); - - bondMarks[prevBond._index] = false; - return true; - } - } - - bondMarks[prevBond._index] = false; - return false; - } - }, { - key: "_startCycle", - value: function _startCycle(bond) { - // start from left to right - this._currStart = bond._left; - - if (this._tryBond(bond, bond._right, new Vector3())) { - _insertAscending(this._bondsData[bond._index], this._currIdx); - - this._cycles[this._currIdx].push(bond._left); - } - } - }, { - key: "_findLoops", - value: function _findLoops(checkBond, checkCycle) { - this._checkBond = checkBond; - var complex = this._complex; - var self = this; - complex.forEachComponent(function (component) { - self._resetCycles(); - - component.forEachBond(function (bond) { - if (checkBond(bond)) { - self._startCycle(bond); - } - }); - var cycles = self._cycles; - - for (var i = 0, n = cycles.length; i < n; ++i) { - var cycle = cycles[i]; - - if (!checkCycle(cycle)) { - continue; - } - - var newCycle = new Cycle(cycle); - newCycle.forEachBond(_markAromatic); - component.addCycle(newCycle); - } - }); - } - }, { - key: "markCycles", - value: function markCycles() { - this._findLoops(_isAromatic, _checkCycleSimple); - } - }, { - key: "detectCycles", - value: function detectCycles() { - this._findLoops(_isPossibleAromatic, _checkCycleComplex); - } - }]); - - return AromaticLoopsMarker; -}(); - -/** - * Calculate min & max radius of a sphere slice between zMin & zMax - * - * @param {Vector3} center - center of the sphere - * @param {number} radius - sphere radius - * @param {number} zMin - lower bound of the slice - * @param {number} zMax - upper bound of the slice - */ - -function _getSphereSliceRadiusRange(center, radius, zMin, zMax) { - var dzMin = zMin - center.z; - var dzMax = zMax - center.z; - var rzMin = Math.sqrt(Math.max(radius * radius - dzMin * dzMin, 0.0)); - var rzMax = Math.sqrt(Math.max(radius * radius - dzMax * dzMax, 0.0)); - var rMin = Math.min(rzMin, rzMax); - var rMax; - - if (zMin <= center.z && zMax >= center.z) { - // sphere's main diameter is inside slice - rMax = radius; - } else { - rMax = Math.max(rzMin, rzMax); - } - - return [rMin, rMax]; -} -/** - * Calculate min & max radius of a circle slice between yMin & yMax. - * - * To maintain analogy with _getSphereSliceRadiusRange we call radius what in fact is - * half-width (along X axis) of the slice, i.e. 1D-sphere radius. - * - * @param {Vector3} center - center of the circle (z can be ignored) - * @param {number} radius - circle radius - * @param {number} yMin - lower bound of the slice - * @param {number} yMax - upper bound of the slice - * @returns {Array} - array of two numbers (min & max radius, or half-width) - */ - - -function _getCircleSliceRadiusRange(center, radius, yMin, yMax) { - var dyMin = yMin - center.y; - var dyMax = yMax - center.y; - var ryMin = Math.sqrt(Math.max(radius * radius - dyMin * dyMin, 0.0)); - var ryMax = Math.sqrt(Math.max(radius * radius - dyMax * dyMax, 0.0)); - var rMin = Math.min(ryMin, ryMax); - var rMax; - - if (yMin <= center.y && yMax >= center.y) { - // slice's main diameter is inside slice - rMax = radius; - } else { - rMax = Math.max(ryMin, ryMax); - } - - return [rMin, rMax]; -} -/** - * VoxelWorld constructor - * - * @param {Box3} box - bounding box of the volume to be partitioned - * @param {Vector3} vCellSizeHint - target voxel size (actual voxel size may differ from this) - */ - - -var VoxelWorld = /*#__PURE__*/function () { - function VoxelWorld(box, vCellSizeHint) { - classCallCheck(this, VoxelWorld); - - this._box = box.clone(); - var size = new Vector3(); - box.getSize(size); - this._count = size.clone().divide(vCellSizeHint).floor().max(new Vector3(1, 1, 1)); - this._last = this._count.clone().subScalar(1); - this._cellSize = size.clone().divide(this._count); - this._cellInnerR = 0.5 * Math.min(Math.min(this._cellSize.x, this._cellSize.y), this._cellSize.z); - this._cellOuterR = 0.5 * Math.sqrt(this._cellSize.dot(this._cellSize)); // array of voxels, each element contains index of first atom in voxel - - var numVoxels = this._count.x * this._count.y * this._count.z; - this._voxels = utils.allocateTyped(Int32Array, numVoxels); - - for (var i = 0; i < numVoxels; ++i) { - this._voxels[i] = -1; - } // array of atoms that stores multiple single-linked lists - // two elements for each atom: Atom ref, index of next atom (in this array - - - this._atoms = []; - } - /** - * Add all atoms from a complex to voxel world - * - * @param {Complex} complex - complex - */ - - - createClass(VoxelWorld, [{ - key: "addAtoms", - value: function addAtoms(complex) { - var self = this; - var idx = this._atoms.length; // resize array of atoms - - this._atoms.length += 2 * complex.getAtomCount(); - complex.forEachAtom(function (atom) { - // find which voxel contains this atom - var voxelIdx = self._findVoxel(atom.position); // push current atom to the head of voxel's atom list - - - self._atoms[idx] = atom; - self._atoms[idx + 1] = self._voxels[voxelIdx]; - self._voxels[voxelIdx] = idx; - idx += 2; - }); - } - /** - * Get voxel that contains specified 3D point (we use clamp at the edges) - * - * @param {Vector3} point - a point in 3D - * @returns {number} - index of voxel - */ - - }, { - key: "_findVoxel", - value: function _findVoxel(point) { - var zero = VoxelWorld._zero; - var voxel = VoxelWorld._voxel; - voxel.copy(point).sub(this._box.min).divide(this._cellSize).floor().clamp(zero, this._last); - return voxel.x + this._count.x * (voxel.y + this._count.y * voxel.z); - } - /** - * Call a function for each atom in voxel - * - * @param {number} voxel - index of voxel - * @param {function(Atom)} process - function to call - */ - - }, { - key: "_forEachAtomInVoxel", - value: function _forEachAtomInVoxel(voxel, process) { - for (var i = this._voxels[voxel]; i >= 0; i = this._atoms[i + 1]) { - process(this._atoms[i]); - } - } - /** - * Call a function for each voxel that is touched by given sphere. Callback also takes flag - * isInside specifying whether voxel lies inside the sphere entirely. - * - * @param {Vector3} center - center of the sphere - * @param {number} radius - sphere radius - * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside - */ - - }, { - key: "_forEachVoxelWithinRadius", - value: function _forEachVoxelWithinRadius(center, radius, process) { - var xRange = VoxelWorld._xRange; - var yRange = VoxelWorld._yRange; - var zRange = VoxelWorld._zRange; // switch to a faster method unless cell size is much smaller than sphere radius - - if (radius / this._cellInnerR < 10) { - this._forEachVoxelWithinRadiusSimple(center, radius, process); - - return; - } - - var rRangeXY; - var rRangeX; - var xVal; - var yVal; - var zVal; - var isInsideX; - var isInsideY; - var isInsideZ; - zRange.set(center.z - radius, center.z + radius); - zRange.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor().clampScalar(0, this._count.z - 1); - - for (var z = zRange.x; z <= zRange.y; ++z) { - zVal = [this._box.min.z + z * this._cellSize.z, this._box.min.z + (z + 1) * this._cellSize.z]; - isInsideZ = center.z - radius <= zVal[0] && zVal[1] <= center.z + radius; - rRangeXY = _getSphereSliceRadiusRange(center, radius, zVal[0], zVal[1]); - yRange.set(center.y - rRangeXY[1], center.y + rRangeXY[1]); - yRange.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor().clampScalar(0, this._count.y - 1); - - for (var y = yRange.x; y <= yRange.y; ++y) { - yVal = [this._box.min.y + y * this._cellSize.y, this._box.min.y + (y + 1) * this._cellSize.y]; - isInsideY = center.y - rRangeXY[0] <= yVal[0] && yVal[1] <= center.y + rRangeXY[0]; - rRangeX = _getCircleSliceRadiusRange(center, rRangeXY[1], yVal[0], yVal[1]); - xRange.set(center.x - rRangeX[1], center.x + rRangeX[1]); - xRange.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor().clampScalar(0, this._count.x - 1); - - for (var x = xRange.x; x <= xRange.y; ++x) { - xVal = [this._box.min.x + x * this._cellSize.x, this._box.min.x + (x + 1) * this._cellSize.x]; - isInsideX = center.x - rRangeX[0] <= xVal[0] && xVal[1] <= center.x + rRangeX[0]; - process(x + this._count.x * (y + this._count.y * z), isInsideX && isInsideY && isInsideZ); - } - } - } - } - /** - * Call a function for each voxel that is touched by given sphere. Callback also takes flag - * isInside specifying whether voxel lies inside the sphere entirely. - * This is a version of method that doesn't try to "calculate" what voxels fall inside radius - * but instead just checks all voxels inside sphere's bounding box. This should be faster - * unless cell size is much smaller than sphere radius. - * - * @param {Vector3} center - center of the sphere - * @param {number} radius - sphere radius - * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside - */ - - }, { - key: "_forEachVoxelWithinRadiusSimple", - value: function _forEachVoxelWithinRadiusSimple(center, radius, process) { - var xRange = VoxelWorld._xRange; - var yRange = VoxelWorld._yRange; - var zRange = VoxelWorld._zRange; - var vCenter = VoxelWorld._vCenter; - var distTouch2 = (radius + this._cellOuterR) * (radius + this._cellOuterR); - var distInside2 = -1.0; - - if (radius > this._cellOuterR) { - distInside2 = (radius - this._cellOuterR) * (radius - this._cellOuterR); - } // calculate bounding box for the sphere - - - xRange.set(center.x - radius, center.x + radius); - xRange.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor(); - xRange.x = Math.min(Math.max(xRange.x, 0), this._count.x - 1); - xRange.y = Math.min(Math.max(xRange.y, 0), this._count.x - 1); - yRange.set(center.y - radius, center.y + radius); - yRange.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor(); - yRange.x = Math.min(Math.max(yRange.x, 0), this._count.y - 1); - yRange.y = Math.min(Math.max(yRange.y, 0), this._count.y - 1); - zRange.set(center.z - radius, center.z + radius); - zRange.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor(); - zRange.x = Math.min(Math.max(zRange.x, 0), this._count.z - 1); - zRange.y = Math.min(Math.max(zRange.y, 0), this._count.z - 1); - - for (var z = zRange.x; z <= zRange.y; ++z) { - var zVal = [this._box.min.z + z * this._cellSize.z, this._box.min.z + (z + 1) * this._cellSize.z]; - vCenter.z = 0.5 * (zVal[0] + zVal[1]); - - for (var y = yRange.x; y <= yRange.y; ++y) { - var yVal = [this._box.min.y + y * this._cellSize.y, this._box.min.y + (y + 1) * this._cellSize.y]; - vCenter.y = 0.5 * (yVal[0] + yVal[1]); - - for (var x = xRange.x; x <= xRange.y; ++x) { - var xVal = [this._box.min.x + x * this._cellSize.x, this._box.min.x + (x + 1) * this._cellSize.x]; - vCenter.x = 0.5 * (xVal[0] + xVal[1]); - var d2 = center.distanceToSquared(vCenter); - - if (d2 <= distTouch2) { - process(x + this._count.x * (y + this._count.y * z), d2 <= distInside2); - } - } - } - } - } - /** - * Call a function for each atom within given sphere - * - * @param {Vector3} center - center of the sphere - * @param {number} radius - sphere radius - * @param {function(Atom)} process - function to call - */ - - }, { - key: "forEachAtomWithinRadius", - value: function forEachAtomWithinRadius(center, radius, process) { - var self = this; - var r2 = radius * radius; - - self._forEachVoxelWithinRadius(center, radius, function (voxel, isInside) { - if (isInside) { - self._forEachAtomInVoxel(voxel, process); - } else { - self._forEachAtomInVoxel(voxel, function (atom) { - if (center.distanceToSquared(atom.position) <= r2) { - process(atom); - } - }); - } - }); - } - /** - * Call a function for each atom of given complex within given distance from group of atoms defined by mask - * - * @param {Complex} complex - complex - * @param {number} mask - bit mask - * @param {number} dist - distance - * @param {function(Atom)} process - function to call - */ - - }, { - key: "forEachAtomWithinDistFromMasked", - value: function forEachAtomWithinDistFromMasked(complex, mask, dist, process) { - this._forEachAtomWithinDistFromGroup(function (atomProc) { - complex.forEachAtom(function (atom) { - if ((atom.mask & mask) !== 0) { - atomProc(atom); - } - }); - }, dist, process); - } - /** - * Call a function for each atom of given complex within given distance from group of atoms defined by selector - * - * @param {Complex} complex - complex - * @param {number} selector - selector - * @param {number} dist - distance - * @param {function(Atom)} process - function to call - */ - - }, { - key: "forEachAtomWithinDistFromSelected", - value: function forEachAtomWithinDistFromSelected(complex, selector, dist, process) { - this._forEachAtomWithinDistFromGroup(function (atomProc) { - complex.forEachAtom(function (atom) { - if (selector.includesAtom(atom)) { - atomProc(atom); - } - }); - }, dist, process); - } - /** - * Call a function for each atom of given complex within given distance from group of atoms - * - * @param {function} forEachAtom - enumerator of atoms in the group - * @param {number} dist - distance - * @param {function(Atom)} process - function to call - */ - - }, { - key: "_forEachAtomWithinDistFromGroup", - value: function _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) { - var self = this; - var r2 = dist * dist; - var voxels = []; - var atoms = []; - var idx = 0; // build "within radius" atom list for each voxel - - forEachAtom(function (atom) { - self._forEachVoxelWithinRadius(atom.position, dist, function (voxel, isInside) { - if (isInside) { - // this voxel is inside circle -- no check will be required - voxels[voxel] = -1; - } else if (typeof voxels[voxel] === 'undefined') { - // this voxel isn't covered yet -- start building list of atoms - atoms.push(atom); - atoms.push(-1); - voxels[voxel] = idx; - idx += 2; - } else if (voxels[voxel] !== -1) { - // this voxel has a list of atoms required for distance check -- add atom to the list - atoms.push(atom); - atoms.push(voxels[voxel]); - voxels[voxel] = idx; - idx += 2; - } - }); - }); - var voxel; - - var processIfWithin = function processIfWithin(atom) { - if (typeof voxels[voxel] === 'undefined') { - return; - } - - idx = voxels[voxel]; - - if (idx === -1) { - // this voxel is fully covered - process(atom); - return; - } // check distance to each atom within radius from this voxel - - - for (; idx >= 0; idx = atoms[idx + 1]) { - if (atom.position.distanceToSquared(atoms[idx].position) < r2) { - process(atom); - break; - } - } - }; // for each marked voxel - - - for (voxel in voxels) { - if (voxels.hasOwnProperty(voxel)) { - self._forEachAtomInVoxel(voxel, processIfWithin); - } - } - } - }]); - - return VoxelWorld; -}(); - -defineProperty(VoxelWorld, "_zero", new Vector3(0, 0, 0)); - -defineProperty(VoxelWorld, "_voxel", new Vector3()); - -defineProperty(VoxelWorld, "_xRange", new Vector2()); - -defineProperty(VoxelWorld, "_yRange", new Vector2()); - -defineProperty(VoxelWorld, "_zRange", new Vector2()); - -defineProperty(VoxelWorld, "_vCenter", new Vector3()); - -var MINIMAL_DISTANCE = 0.5; -var MIN_HBOND_ENERGY = -9.9; -var MAX_HBOND_ENERGY = -0.5; -var COUPLING_CONSTANT = -27.888; // = -332 * 0.42 * 0.2 - -var MAX_COUPLING_DISTANCE = 5.0; // how far is the closest atom of a potential partner residue from CA atom - -var MAX_RESIDUES_THRESHOLD = 1000; - -var HBondInfo = /*#__PURE__*/function () { - function HBondInfo(complex) { - classCallCheck(this, HBondInfo); - - this._complex = complex; - this._hbonds = []; // array of bond info for each residue - - if (this._complex._residues.length > MAX_RESIDUES_THRESHOLD) { - this._buildVW(); // optimized version using voxel grid - - } else { - this._build(); // test all pairs of residues - - } - } - - createClass(HBondInfo, [{ - key: "isBond", - value: function isBond(from, to) { - if (this._hbonds[from]) { - var _this$_hbonds$from$ac = slicedToArray(this._hbonds[from].acceptor, 2), - acc0 = _this$_hbonds$from$ac[0], - acc1 = _this$_hbonds$from$ac[1]; - - if (acc0 && acc0.residue === to && acc0.energy < MAX_HBOND_ENERGY) { - return true; - } - - if (acc1 && acc1.residue === to && acc1.energy < MAX_HBOND_ENERGY) { - return true; - } - } - - return false; - } - }, { - key: "_build", - value: function _build() { - var self = this; - - for (var i = 0; i < this._complex._residues.length - 1; ++i) { - var ri = this._complex._residues[i]; - - if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) { - continue; - } // get predecessor in chain - - - var preri = null; - - if (i > 0 && this._complex._residues[i - 1].getType().flags & ResidueType.Flags.PROTEIN && ri._sequence === this._complex._residues[i - 1]._sequence + 1) { - preri = this._complex._residues[i - 1]; - } - - for (var j = i + 1; j < this._complex._residues.length; ++j) { - var rj = this._complex._residues[j]; - - if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) { - continue; - } // get predecessor in chain - - - var prerj = null; - - if (this._complex._residues[j - 1].getType().flags & ResidueType.Flags.PROTEIN && rj._sequence === this._complex._residues[j - 1]._sequence + 1) { - prerj = this._complex._residues[j - 1]; - } - - self._calcHBondEnergy(preri, ri, rj); - - if (j !== i + 1) { - self._calcHBondEnergy(prerj, rj, ri); - } - } - } - } - }, { - key: "_buildVW", - value: function _buildVW() { - var self = this; - var residues = this._complex._residues; - var ri; - var preri; - - var vw = this._complex.getVoxelWorld(); - - if (vw === null) { - return; - } - - var pairs = new AtomPairs(this._complex._residues.length * this._complex._residues.length / 2); - - function processAtom(atom) { - var rj = atom.residue; - - if (rj._index === ri._index) { - return; - } - - if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) { - return; - } - - if (!pairs.addPair(ri._index, rj._index)) { - // we've seen this pair - return; - } // get predecessor in chain - - - var prerj = rj._index > 0 ? residues[rj._index - 1] : null; - - if (prerj && ((prerj.getType().flags & ResidueType.Flags.PROTEIN) === 0 || rj._sequence !== prerj._sequence + 1)) { - prerj = null; - } - - self._calcHBondEnergy(preri, ri, rj); - - if (rj._index !== ri._index + 1) { - self._calcHBondEnergy(prerj, rj, ri); - } - } - - for (var i = 0; i < residues.length - 1; ++i) { - ri = residues[i]; - - if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) { - continue; - } // get predecessor in chain - - - preri = i > 0 ? residues[i - 1] : null; - - if (preri && ((preri.getType().flags & ResidueType.Flags.PROTEIN) === 0 || ri._sequence !== preri._sequence + 1)) { - preri = null; - } - - vw.forEachAtomWithinRadius(this._residueGetCAlpha(ri), MAX_COUPLING_DISTANCE, processAtom); - } - } - }, { - key: "_residueGetCAlpha", - value: function _residueGetCAlpha(res) { - for (var i = 0; i < res._atoms.length; ++i) { - var name = res._atoms[i].name; - - if (name === 'CA' || name === 'C1') { - return res._atoms[i].position; - } - } - - return null; - } - }, { - key: "_residueGetCO", - value: function _residueGetCO(res) { - var c = null; - var o = null; - res.forEachAtom(function (a) { - if (a.name === 'C') { - c = a.position; - } else if (a.name === 'O') { - o = a.position; - } - }); - return [c, o]; - } // TODO Support hydrogen defined in complex - - }, { - key: "_residueGetNH", - value: function _residueGetNH(prev, res) { - var _this$_residueGetCO = this._residueGetCO(prev), - _this$_residueGetCO2 = slicedToArray(_this$_residueGetCO, 2), - c = _this$_residueGetCO2[0], - o = _this$_residueGetCO2[1]; - - var n; - res.forEachAtom(function (a) { - if (a.name === 'N') { - n = a.position; - } - }); - - if (c && o && n) { - // calculate hydrogen position - var h = c.clone(); - h.sub(o); - h.multiplyScalar(1.0 / h.length()); - h.add(n); - return [n, h]; - } - - return [null, null]; - } - }, { - key: "_calcHBondEnergy", - value: function _calcHBondEnergy(predonor, donor, acceptor) { - var result = 0; - - if (predonor === null) { - return result; - } - - if (donor.getType().getName() !== 'PRO') { - var _this$_residueGetNH = this._residueGetNH(predonor, donor), - _this$_residueGetNH2 = slicedToArray(_this$_residueGetNH, 2), - n = _this$_residueGetNH2[0], - h = _this$_residueGetNH2[1]; - - var _this$_residueGetCO3 = this._residueGetCO(acceptor), - _this$_residueGetCO4 = slicedToArray(_this$_residueGetCO3, 2), - c = _this$_residueGetCO4[0], - o = _this$_residueGetCO4[1]; - - if (n === null || h === null || c === null || o === null) { - return result; - } - - var distanceHO = h.distanceTo(o); - var distanceHC = h.distanceTo(c); - var distanceNC = n.distanceTo(c); - var distanceNO = n.distanceTo(o); - - if (distanceHO < MINIMAL_DISTANCE || distanceHC < MINIMAL_DISTANCE || distanceNC < MINIMAL_DISTANCE || distanceNO < MINIMAL_DISTANCE) { - result = MIN_HBOND_ENERGY; - } else { - result = COUPLING_CONSTANT / distanceHO - COUPLING_CONSTANT / distanceHC + COUPLING_CONSTANT / distanceNC - COUPLING_CONSTANT / distanceNO; - } // DSSP compatibility mode: - - - result = Math.round(result * 1000) / 1000; - - if (result < MIN_HBOND_ENERGY) { - result = MIN_HBOND_ENERGY; - } - } // update donor - - - if (typeof this._hbonds[donor._index] === 'undefined') { - this._hbonds[donor._index] = { - donor: [], - acceptor: [] - }; - } - - var donorInfo = this._hbonds[donor._index]; - - if (donorInfo.acceptor.length < 2) { - donorInfo.acceptor.push({ - residue: acceptor._index, - energy: result - }); - } - - if (donorInfo.acceptor.length > 1) { - if (result < donorInfo.acceptor[0].energy) { - donorInfo.acceptor[1].residue = donorInfo.acceptor[0].residue; - donorInfo.acceptor[1].energy = donorInfo.acceptor[0].energy; - donorInfo.acceptor[0].residue = acceptor._index; - donorInfo.acceptor[0].energy = result; - } else if (result < donorInfo.acceptor[1].energy) { - donorInfo.acceptor[1].residue = acceptor._index; - donorInfo.acceptor[1].energy = result; - } - } // update acceptor - - - if (typeof this._hbonds[acceptor._index] === 'undefined') { - this._hbonds[acceptor._index] = { - donor: [], - acceptor: [] - }; - } - - var accInfo = this._hbonds[acceptor._index]; - - if (accInfo.donor.length < 2) { - accInfo.donor.push({ - residue: donor._index, - energy: result - }); - } - - if (accInfo.donor.length > 1) { - if (result < accInfo.donor[0].energy) { - accInfo.donor[1].residue = accInfo.donor[0].residue; - accInfo.donor[1].energy = accInfo.donor[0].energy; - accInfo.donor[0].residue = donor._index; - accInfo.donor[0].energy = result; - } else if (result < accInfo.donor[1].energy) { - accInfo.donor[1].residue = donor._index; - accInfo.donor[1].energy = result; - } - } - - return result; - } - }]); - - return HBondInfo; -}(); - -var BridgeType = Object.freeze({ - NO_BRIDGE: 0, - PARALLEL: 1, - ANTI_PARALLEL: 2 -}); -var HelixFlag = Object.freeze({ - START: 1, - MIDDLE: 2, - END: 3, - START_AND_END: 4 -}); -var StructureType = Object.freeze({ - STRAND: 'E', - BRIDGE: 'B', - HELIX_310: 'G', - HELIX_ALPHA: 'H', - HELIX_PI: 'I', - TURN: 'T', - BEND: 'S', - LOOP: ' ' -}); - -var SecondaryStructureMap = /*#__PURE__*/function () { - function SecondaryStructureMap(complex) { - classCallCheck(this, SecondaryStructureMap); - - this._complex = complex; - - this._build(); - } - - createClass(SecondaryStructureMap, [{ - key: "_build", - value: function _build() { - var self = this; - this._hbonds = new HBondInfo(this._complex); - this._ss = []; // DSSP map by residue - // auxilliary data - - this._sheet = []; - this._betaPartners = []; - this._bend = []; - - for (var i = 0; i < this._complex.getResidues().length; ++i) { - this._betaPartners[i] = []; - } - - this._helixFlags = []; - this._helixFlags[3] = []; - this._helixFlags[4] = []; - this._helixFlags[5] = []; // calculate peptide chain lengths - - this._chainLengths = []; - - for (var _i = 0; _i < this._complex._chains.length; ++_i) { - var chain = this._complex._chains[_i].getResidues(); - - var len = 0; - - for (; len < chain.length; ++len) { - if ((chain[len].getType().flags & ResidueType.Flags.PROTEIN) === 0) { - break; - } - } - - this._chainLengths[_i] = len; - } - - this._buildBetaSheets(); - - for (var _i2 = 0; _i2 < this._complex._chains.length; ++_i2) { - self._buildAlphaHelices(this._complex._chains[_i2].getResidues(), this._chainLengths[_i2], false); - } - } - }, { - key: "_buildAlphaHelices", - value: function _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) { - // Helix and Turn - for (var stride = 3; stride <= 5; ++stride) { - if (inResidues.length < stride) { - break; - } - - for (var i = 0; i + stride < chainLength; ++i) { - if (this._hbonds.isBond(inResidues[i + stride]._index, inResidues[i]._index) - /* && NoChainBreak(res[i], res[i + stride]) */ - ) { - this._helixFlags[stride][inResidues[i + stride]._index] = HelixFlag.END; - - for (var j = i + 1; j < i + stride; ++j) { - if (typeof this._helixFlags[stride][inResidues[j]._index] === 'undefined') { - this._helixFlags[stride][inResidues[j]._index] = HelixFlag.MIDDLE; - } - } - - if (this._helixFlags[stride][inResidues[i]._index] === HelixFlag.END) { - this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START_AND_END; - } else { - this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START; - } - } - } - } - - for (var _i3 = 2; _i3 < chainLength - 2; ++_i3) { - var kappa = this._kappa(inResidues[_i3 - 2], inResidues[_i3], inResidues[_i3 + 2]); - - this._bend[inResidues[_i3]._index] = kappa !== 360 && kappa > 70; - } - - for (var _i4 = 1; _i4 + 4 < chainLength; ++_i4) { - if (this._isHelixStart(inResidues[_i4]._index, 4) && this._isHelixStart(inResidues[_i4 - 1]._index, 4)) { - for (var _j = _i4; _j <= _i4 + 3; ++_j) { - this._ss[inResidues[_j]._index] = StructureType.HELIX_ALPHA; - } - } - } - - for (var _i5 = 1; _i5 + 3 < chainLength; ++_i5) { - if (this._isHelixStart(inResidues[_i5]._index, 3) && this._isHelixStart(inResidues[_i5 - 1]._index, 3)) { - var empty = true; - - for (var _j2 = _i5; empty && _j2 <= _i5 + 2; ++_j2) { - empty = typeof this._ss[inResidues[_j2]._index] === 'undefined' || this._ss[inResidues[_j2]._index] === StructureType.HELIX_310; - } - - if (empty) { - for (var _j3 = _i5; _j3 <= _i5 + 2; ++_j3) { - this._ss[inResidues[_j3]._index] = StructureType.HELIX_310; - } - } - } - } - - for (var _i6 = 1; _i6 + 5 < chainLength; ++_i6) { - if (this._isHelixStart(inResidues[_i6]._index, 5) && this._isHelixStart(inResidues[_i6 - 1]._index, 5)) { - var _empty = true; - - for (var _j4 = _i6; _empty && _j4 <= _i6 + 4; ++_j4) { - _empty = typeof this._ss[inResidues[_j4]._index] === 'undefined' || this._ss[inResidues[_j4]._index] === StructureType.HELIX_PI || inPreferPiHelices && this._ss[inResidues[_j4]._index] === StructureType.HELIX_ALPHA; - } - - if (_empty) { - for (var _j5 = _i6; _j5 <= _i6 + 4; ++_j5) { - this._ss[inResidues[_j5]._index] = StructureType.HELIX_PI; - } - } - } - } - - for (var _i7 = 1; _i7 + 1 < chainLength; ++_i7) { - if (typeof this._ss[inResidues[_i7]._index] === 'undefined') { - var isTurn = false; - - for (var _stride = 3; _stride <= 5 && !isTurn; ++_stride) { - for (var k = 1; k < _stride && !isTurn; ++k) { - isTurn = _i7 >= k && this._isHelixStart(inResidues[_i7 - k]._index, _stride); - } - } - - if (isTurn) { - this._ss[inResidues[_i7]._index] = StructureType.TURN; - } else if (this._bend[inResidues[_i7]._index]) { - this._ss[inResidues[_i7]._index] = StructureType.BEND; - } - } - } - } - }, { - key: "_residueGetCAlpha", - value: function _residueGetCAlpha(res) { - for (var i = 0; i < res._atoms.length; ++i) { - var name = res._atoms[i].name; - - if (name === 'CA' || name === 'C1') { - return res._atoms[i].position; - } - } - - return null; - } - }, { - key: "_cosinusAngle", - value: function _cosinusAngle(p1, p2, p3, p4) { - var v12 = p1.clone().sub(p2); - var v34 = p3.clone().sub(p4); - var result = 0; - var x = v12.dot(v12) * v34.dot(v34); - - if (x > 0) { - result = v12.dot(v34) / Math.sqrt(x); - } - - return result; - } - }, { - key: "_kappa", - value: function _kappa(prevPrev, res, nextNext) { - var curCA = this._residueGetCAlpha(res); - - var ppCA = this._residueGetCAlpha(prevPrev); - - var nnCA = this._residueGetCAlpha(nextNext); - - if (curCA === null || ppCA === null || nnCA === null) { - return 180; - } - - var ckap = this._cosinusAngle(curCA, ppCA, nnCA, curCA); - - var skap = Math.sqrt(1 - ckap * ckap); - return Math.atan2(skap, ckap) * 180 / Math.PI; - } - }, { - key: "_isHelixStart", - value: function _isHelixStart(res, stride) { - return this._helixFlags[stride][res] === HelixFlag.START || this._helixFlags[stride][res] === HelixFlag.START_AND_END; - } - }, { - key: "_buildBetaSheets", - value: function _buildBetaSheets() { - // find bridges - // check each chain against each other chain, and against itself - var bridges = []; - - for (var a = 0; a < this._complex._chains.length; ++a) { - var lenA = this._chainLengths[a]; - - if (lenA <= 4) { - continue; - } - - var chainA = this._complex._chains[a].getResidues(); - - for (var b = a; b < this._complex._chains.length; ++b) { - var lenB = this._chainLengths[b]; - - if (lenB <= 4) { - continue; - } - - var chainB = this._complex._chains[b].getResidues(); - - for (var i = 1; i + 1 < lenA; ++i) { - var ri = chainA[i]; - var j = 1; - - if (b === a) { - j = i + 3; // check for self-bridges forward down the chain - } - - for (; j + 1 < lenB; ++j) { - var rj = chainB[j]; - - var type = this._testBridge(chainA, i, chainB, j); - - if (type === BridgeType.NO_BRIDGE) { - continue; - } // there is a bridge, try to attach it to previously found sequence - - - var found = false; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = bridges[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var bridge = _step.value; - - if (type !== bridge.type || ri._index !== bridge.i[bridge.i.length - 1] + 1) { - continue; - } - - if (type === BridgeType.PARALLEL && bridge.j[bridge.j.length - 1] + 1 === rj._index) { - bridge.i.push(ri._index); - bridge.j.push(rj._index); - found = true; - break; - } - - if (type === BridgeType.ANTI_PARALLEL && bridge.j[0] - 1 === rj._index) { - bridge.i.push(ri._index); - bridge.j.unshift(rj._index); - found = true; - break; - } - } // this bridge cannot be attached anywhere, start a new sequence - - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator["return"] != null) { - _iterator["return"](); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - if (!found) { - bridges.push({ - type: type, - i: [ri._index], - chainI: ri.getChain()._index, - j: [rj._index], - chainJ: rj.getChain()._index - }); - } - } - } - } - } // extend ladders - - - bridges.sort(function (a, b) { - if (a.chainI < b.chainI || a.chainI === b.chainI && a.i[0] < b.i[0]) { - return -1; - } - - return 1; - }); - - for (var _i8 = 0; _i8 < bridges.length; ++_i8) { - for (var _j6 = _i8 + 1; _j6 < bridges.length; ++_j6) { - var ibi = bridges[_i8].i[0]; - var iei = bridges[_i8].i[bridges[_i8].i.length - 1]; - var jbi = bridges[_i8].j[0]; - var jei = bridges[_i8].j[bridges[_i8].j.length - 1]; - var ibj = bridges[_j6].i[0]; - var iej = bridges[_j6].i[bridges[_j6].i.length - 1]; - var jbj = bridges[_j6].j[0]; - var jej = bridges[_j6].j[bridges[_j6].j.length - 1]; - - if (bridges[_i8].type !== bridges[_j6].type || this._hasChainBreak(Math.min(ibi, ibj), Math.max(iei, iej)) || this._hasChainBreak(Math.min(jbi, jbj), Math.max(jei, jej)) || ibj - iei >= 6 || iei >= ibj && ibi <= iej) { - continue; - } - - var bulge = false; - - if (bridges[_i8].type === BridgeType.PARALLEL) { - bulge = jbj - jei < 6 && ibj - iei < 3 || jbj - jei < 3; - } else { - bulge = jbi - jej < 6 && ibj - iei < 3 || jbi - jej < 3; - } - - if (bulge) { - bridges[_i8].i = bridges[_i8].i.concat(bridges[_j6].i); - - if (bridges[_i8].type === BridgeType.PARALLEL) { - bridges[_i8].j = bridges[_i8].j.concat(bridges[_j6].j); - } else { - bridges[_i8].j = bridges[_j6].j.concat(bridges[_i8].j); - } - - bridges.splice(_j6--, 1); - } - } - } // Sheet - - - var ladderset = new Set(); - - for (var _i9 = 0; _i9 < bridges.length; ++_i9) { - ladderset.add(bridges[_i9]); - } - - var sheet = 1; - var ladder = 0; - - while (ladderset.size > 0) { - var _bridge = ladderset.values().next().value; - ladderset["delete"](_bridge); - var sheetset = new Set(); - sheetset.add(_bridge); - var toMove = void 0; - - do { - toMove = new Set(); - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = sheetset.values()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var _a = _step2.value; - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; - - try { - for (var _iterator4 = ladderset.values()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { - var _b = _step4.value; - - if (this._areBridgesLinked(_a, _b)) { - toMove.add(_b); - } - } - } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; - } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) { - _iterator4["return"](); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } - } - } - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) { - _iterator2["return"](); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = toMove.values()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - _bridge = _step3.value; - sheetset.add(_bridge); - ladderset["delete"](_bridge); - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) { - _iterator3["return"](); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } - } while (toMove.size > 0); - - var _iteratorNormalCompletion5 = true; - var _didIteratorError5 = false; - var _iteratorError5 = undefined; - - try { - for (var _iterator5 = sheetset.values()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { - _bridge = _step5.value; - _bridge.ladder = ladder; - _bridge.sheet = sheet; - _bridge.link = sheetset; - ++ladder; - } - } catch (err) { - _didIteratorError5 = true; - _iteratorError5 = err; - } finally { - try { - if (!_iteratorNormalCompletion5 && _iterator5["return"] != null) { - _iterator5["return"](); - } - } finally { - if (_didIteratorError5) { - throw _iteratorError5; - } - } - } - - ++sheet; - } - - for (var _i10 = 0; _i10 < bridges.length; ++_i10) { - var _bridge2 = bridges[_i10]; // find out if any of the i and j set members already have - // a bridge assigned, if so, we're assigning bridge 2 - - var betai = 0; - var betaj = 0; - - for (var l = 0; l < _bridge2.i.length; ++l) { - if (this._betaPartners[_bridge2.i[l]][0]) { - betai = 1; - break; - } - } - - for (var _l = 0; _l < _bridge2.j.length; ++_l) { - if (this._betaPartners[_bridge2.j[_l]][0]) { - betaj = 1; - break; - } - } - - var ss = StructureType.BRIDGE; - - if (_bridge2.i.length > 1) { - ss = StructureType.STRAND; - } - - if (_bridge2.type === BridgeType.PARALLEL) { - var _j7 = 0; - - for (var k = 0; k < _bridge2.i.length; ++k) { - this._betaPartners[_bridge2.i[k]][betai] = { - residue: _bridge2.j[_j7++], - ladder: _bridge2.ladder, - parallel: true - }; - } - - _j7 = 0; - - for (var _k = 0; _k < _bridge2.j.length; ++_k) { - this._betaPartners[_bridge2.j[_k]][betaj] = { - residue: _bridge2.i[_j7++], - ladder: _bridge2.ladder, - parallel: true - }; - } - } else { - var _j8 = _bridge2.j.length - 1; - - for (var _k2 = 0; _k2 < _bridge2.i.length; ++_k2) { - this._betaPartners[_bridge2.i[_k2]][betai] = { - residue: _bridge2.j[_j8--], - ladder: _bridge2.ladder, - parallel: false - }; - } - - _j8 = _bridge2.i.length - 1; - - for (var _k3 = 0; _k3 < _bridge2.j.length; ++_k3) { - this._betaPartners[_bridge2.j[_k3]][betaj] = { - residue: _bridge2.i[_j8--], - ladder: _bridge2.ladder, - parallel: false - }; - } - } - - for (var _k4 = _bridge2.i[0]; _k4 <= _bridge2.i[_bridge2.i.length - 1]; ++_k4) { - if (this._ss[_k4] !== StructureType.STRAND) { - this._ss[_k4] = ss; - this._sheet[_k4] = _bridge2.sheet; - } - } - - for (var _k5 = _bridge2.j[0]; _k5 <= _bridge2.j[_bridge2.j.length - 1]; ++_k5) { - if (this._ss[_k5] !== StructureType.STRAND) { - this._ss[_k5] = ss; - this._sheet[_k5] = _bridge2.sheet; - } - } - } - } - }, { - key: "_testBridge", - value: function _testBridge(chainA, from, chainB, to) { - var result = BridgeType.NO_BRIDGE; - var a = chainA[from - 1]._index; - var b = chainA[from]._index; - var c = chainA[from + 1]._index; - var d = chainB[to - 1]._index; - var e = chainB[to]._index; - var f = chainB[to + 1]._index; - - var isBond = this._hbonds.isBond.bind(this._hbonds); - - if (isBond(c, e) && isBond(e, a) || isBond(f, b) && isBond(b, d)) { - result = BridgeType.PARALLEL; - } else if (isBond(c, d) && isBond(f, a) || isBond(e, b) && isBond(b, e)) { - result = BridgeType.ANTI_PARALLEL; - } - - return result; - } // return true if any of the residues in bridge a is identical to any of the residues in bridge b - - }, { - key: "_areBridgesLinked", - value: function _areBridgesLinked(a, b) { - var ai = new Set(a.i); - var aj = new Set(a.j); - var _iteratorNormalCompletion6 = true; - var _didIteratorError6 = false; - var _iteratorError6 = undefined; - - try { - for (var _iterator6 = b.i[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { - var i = _step6.value; - - if (ai.has(i) || aj.has(i)) { - return true; - } - } - } catch (err) { - _didIteratorError6 = true; - _iteratorError6 = err; - } finally { - try { - if (!_iteratorNormalCompletion6 && _iterator6["return"] != null) { - _iterator6["return"](); - } - } finally { - if (_didIteratorError6) { - throw _iteratorError6; - } - } - } - - var _iteratorNormalCompletion7 = true; - var _didIteratorError7 = false; - var _iteratorError7 = undefined; - - try { - for (var _iterator7 = b.j[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { - var _i11 = _step7.value; - - if (ai.has(_i11) || aj.has(_i11)) { - return true; - } - } - } catch (err) { - _didIteratorError7 = true; - _iteratorError7 = err; - } finally { - try { - if (!_iteratorNormalCompletion7 && _iterator7["return"] != null) { - _iterator7["return"](); - } - } finally { - if (_didIteratorError7) { - throw _iteratorError7; - } - } - } - - return false; - } - }, { - key: "_hasChainBreak", - value: function _hasChainBreak(from, to) { - for (var i = from + 1; i <= to; ++i) { - if (this._complex._residues[i]._sequence !== this._complex._residues[i - 1]._sequence + 1) { - return true; - } - } - - return false; - } - }]); - - return SecondaryStructureMap; -}(); -SecondaryStructureMap.StructureType = StructureType; - -var _helixClassMap, _loopMap; -var VOXEL_SIZE = 5.0; -var StructureType$1 = SecondaryStructureMap.StructureType; -var StructuralElementType$2 = StructuralElement.Type; // see http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX - -var helixClassMap = (_helixClassMap = {}, defineProperty(_helixClassMap, StructureType$1.HELIX_ALPHA, 1), defineProperty(_helixClassMap, StructureType$1.HELIX_PI, 3), defineProperty(_helixClassMap, StructureType$1.HELIX_310, 5), _helixClassMap); -var loopMap = (_loopMap = {}, defineProperty(_loopMap, StructureType$1.BRIDGE, StructuralElementType$2.BRIDGE), defineProperty(_loopMap, StructureType$1.TURN, StructuralElementType$2.TURN), defineProperty(_loopMap, StructureType$1.BEND, StructuralElementType$2.BEND), defineProperty(_loopMap, StructureType$1.LOOP, StructuralElementType$2.COIL), _loopMap); -/** - * The entire complex of the molecules under study. - * - * @exports Complex - * @constructor - */ - -var Complex = /*#__PURE__*/function () { - function Complex() { - classCallCheck(this, Complex); - - this._chains = []; - this._components = []; - this._helices = []; - this._sheets = []; - this.structures = []; - this._residueTypes = Object.create(ResidueType.StandardTypes); - this._atoms = []; - this._residues = []; - this._bonds = []; - this._sgroups = []; - this._molecules = []; - this._maskNeedsUpdate = false; - this.metadata = {}; - this.symmetry = []; - this.units = [new BiologicalUnit(this)]; - this._currentUnit = 0; // default biological unit is the asymmetric unit - } - - createClass(Complex, [{ - key: "addAtom", - value: function addAtom(atom) { - var index = this._atoms.length; - - this._atoms.push(atom); - - return index; - } - }, { - key: "addSheet", - value: function addSheet(sheet) { - var index = this._sheets.length; - - this._sheets.push(sheet); - - return index; - } - }, { - key: "addHelix", - value: function addHelix(helix) { - var index = this._helices.length; - - this._helices.push(helix); - - return index; - } - }, { - key: "getAtoms", - value: function getAtoms() { - return this._atoms; - } - }, { - key: "getBonds", - value: function getBonds() { - return this._bonds; - } - }, { - key: "getAtomCount", - value: function getAtomCount() { - return this._atoms.length; - } - }, { - key: "addResidue", - value: function addResidue(residue) { - var index = this._residues.length; - - this._residues.push(residue); - - return index; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - this.forEachChain(function (chain) { - chain.updateToFrame(frameData); - }); - } - }, { - key: "addResidueType", - value: function addResidueType(resName) { - var rt = this._residueTypes[resName] = new ResidueType(resName, 'Unknown', ''); - return rt; - } - }, { - key: "getResidueCount", - value: function getResidueCount() { - return this._residues.length; - } - }, { - key: "getResidues", - value: function getResidues() { - return this._residues; - } - }, { - key: "getSGroupCount", - value: function getSGroupCount() { - return this._sgroups.length; - } - }, { - key: "getSGroups", - value: function getSGroups() { - return this._sgroups; - } - /* - Extract atom by its fullname: #chainName#.#residueId#.#atomName# - */ - - }, { - key: "getAtomByFullname", - value: function getAtomByFullname(fullName) { - var parts = fullName.split('.'); - - if (parts.length !== 3) { - return null; - } - - var chainName = parts[0]; - var resId = parseInt(parts[1], 10); - - if (Number.isNaN(resId)) { - return null; - } - - var atomName = parts[2].toUpperCase(); - var currAtom = null; - this.forEachChain(function (chain) { - if (currAtom) { - return; - } - - if (chain._name.localeCompare(chainName) === 0) { - chain.forEachResidue(function (residue) { - if (currAtom) { - return; - } - - if (residue._sequence === resId) { - residue.forEachAtom(function (atom) { - if (currAtom) { - return; - } - - if (atomName.localeCompare(atom.name) === 0) { - currAtom = atom; - } - }); - } - }); - } - }); - return currAtom; - } - /** - * Create a new chain. - * - * @param {string} name - Chain name. - * @returns {Chain} - Newly created chain. - */ - - }, { - key: "addChain", - value: function addChain(name) { - var result = new Chain(this, name); - - this._chains.push(result); - - return result; - } - }, { - key: "getChain", - value: function getChain(name) { - for (var i = 0, n = this._chains.length; i < n; ++i) { - var chain = this._chains[i]; - - if (chain.getName() === name) { - return chain; - } - } - - return null; - } - }, { - key: "getChainCount", - value: function getChainCount() { - return this._chains.length; - } - }, { - key: "getMolecules", - value: function getMolecules() { - return this._molecules; - } - }, { - key: "getMoleculeCount", - value: function getMoleculeCount() { - return this._molecules.length; - } - }, { - key: "forEachAtom", - value: function forEachAtom(process) { - var atoms = this._atoms; - - for (var i = 0, n = atoms.length; i < n; ++i) { - process(atoms[i]); - } - } - }, { - key: "forEachBond", - value: function forEachBond(process) { - var bonds = this._bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - process(bonds[i]); - } - } - }, { - key: "forEachResidue", - value: function forEachResidue(process) { - var residues = this._residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - process(residues[i]); - } - } - }, { - key: "forEachChain", - value: function forEachChain(process) { - var chains = this._chains; - - for (var i = 0, n = chains.length; i < n; ++i) { - process(chains[i]); - } - } - }, { - key: "forEachMolecule", - value: function forEachMolecule(process) { - var molecules = this._molecules; - var n = molecules.length; - - for (var i = 0; i < n; ++i) { - process(molecules[i]); - } - } - }, { - key: "forEachSGroup", - value: function forEachSGroup(process) { - var groups = this._sgroups; - - for (var i = 0, n = groups.length; i < n; ++i) { - process(groups[i]); - } - } - }, { - key: "forEachComponent", - value: function forEachComponent(process) { - var components = this._components; - - for (var i = 0, n = components.length; i < n; ++i) { - process(components[i]); - } - } - }, { - key: "forEachVisibleComponent", - value: function forEachVisibleComponent(process) { - var components = this._components; - - for (var i = 0, n = components.length; i < n; ++i) { - process(components[i]); - } - } - }, { - key: "addBond", - value: function addBond(left, right, order, type, fixed) { - var bond = new Bond(left, right, order, type, fixed); - - this._bonds.push(bond); - - return bond; - } - }, { - key: "getBondCount", - value: function getBondCount() { - return this._bonds.length; - } - }, { - key: "getResidueType", - value: function getResidueType(name) { - return this._residueTypes[name] || null; - } - }, { - key: "getUnifiedSerial", - value: function getUnifiedSerial(chain, serial, iCode) { - /* eslint-disable no-magic-numbers */ - var maxSerial = 65536; - var chainShift = maxSerial * 256; - /* eslint-enable no-magic-numbers */ - - return serial + iCode * maxSerial + chain * chainShift; - } - }, { - key: "splitUnifiedSerial", - value: function splitUnifiedSerial(uniSerial) { - /* eslint-disable no-magic-numbers */ - var maxSerial = 65536; - var chainShift = maxSerial * 256; - /* eslint-enable no-magic-numbers */ - - var chainId = Math.floor(uniSerial / chainShift); - var remnant = uniSerial - chainId * chainShift; - var insCode = Math.floor(remnant / maxSerial); - var ser = remnant - insCode * maxSerial; - return { - chain: chainId, - serial: ser, - iCode: insCode - }; - } - }, { - key: "_fillCmpEdit", - value: function _fillCmpEdit() { - var self = this; - var components = this._components; - - function addComp() { - var comp = new Component(self); - comp._index = components.length; - components[comp._index] = comp; - return comp; - } - - this.forEachChain(function (chain) { - var residues = chain._residues; - var resCount = residues.length; - - if (resCount < 1) { - return; - } - - var comp = addComp(); - var currStart = residues[0]._index; - - for (var i = 0; i < resCount; ++i) { - var currRes = residues[i]; - currRes._component = comp; - var nextRes = i === resCount - 1 ? null : residues[i + 1]; - - if (!nextRes || !currRes.isConnected(nextRes) || currRes._index !== nextRes._index - 1) { - // the last condition is broken and incorrect - // the refactoring of the Component is required in order to fix this issue - comp.setSubDivs([{ - start: currStart, - end: currRes._index - }]); - - if (nextRes) { - currStart = nextRes._index; - comp = addComp(); - } - } - } - }); - } // This function was added in the moment of despair - // It was the dark times for miew - - }, { - key: "_fillCmpNoedit", - value: function _fillCmpNoedit() { - var comp = new Component(this); - comp._index = 0; - var residues = this._residues; - var resCount = residues.length; - - if (resCount === 0) { - return; - } - - var currSubDivs = []; - var currStart = 0; - - for (var i = 0; i < resCount; ++i) { - var currRes = residues[i]; - currRes._component = comp; - var nextRes = i === resCount - 1 ? null : residues[i + 1]; - - if (!nextRes || !currRes.isConnected(nextRes)) { - // wrap up this interval - currSubDivs[currSubDivs.length] = { - start: currStart, - end: i - }; - - if (nextRes) { - currStart = i + 1; - } - } - } - - comp.setSubDivs(currSubDivs); - this._components[comp._index] = comp; - } - /** - * Fill components information. - * @param {boolean} enableEditing - Restructure Complex to enable per-component editing. - */ - - }, { - key: "_fillComponents", - value: function _fillComponents(enableEditing) { - if (enableEditing) { - this._fillCmpEdit(); - } else { - this._fillCmpNoedit(); - } - } - }, { - key: "getCurrentUnit", - value: function getCurrentUnit() { - return this._currentUnit; - } - }, { - key: "getDefaultBoundaries", - value: function getDefaultBoundaries() { - return this.units[0].getBoundaries(); - } - }, { - key: "getBoundaries", - value: function getBoundaries() { - return this.units[this._currentUnit].getBoundaries(); - } - }, { - key: "getTransforms", - value: function getTransforms() { - return this.units[this._currentUnit].getTransforms(); - } - }, { - key: "getSelector", - value: function getSelector() { - return this.units[this._currentUnit].getSelector(); - } - }, { - key: "resetCurrentUnit", - value: function resetCurrentUnit() { - this._currentUnit = 0; - this.setCurrentUnit(1); - } - }, { - key: "setCurrentUnit", - value: function setCurrentUnit(newUnit) { - if (newUnit !== null && newUnit !== undefined && newUnit !== this._currentUnit && newUnit >= 0 && newUnit < this.units.length) { - this._currentUnit = newUnit; - return true; - } - - return false; - } - }, { - key: "_computeBounds", - value: function _computeBounds() { - var units = this.units; - - for (var i = 0, n = units.length; i < n; ++i) { - units[i].computeBoundaries(); - } - } - }, { - key: "onAtomPositionChanged", - value: function onAtomPositionChanged() { - this.forEachChain(function (a) { - a._finalize(); - }); - this.forEachComponent(function (c) { - c.update(); - }); // Update bounding sphere and box - - this._computeBounds(); - - this._finalizeBonds(); - - this.forEachSGroup(function (s) { - s._rebuildSGroupOnAtomChange(); - }); - } - }, { - key: "update", - value: function update() { - if (this._maskNeedsUpdate) { - this.updateStructuresMask(); - this._maskNeedsUpdate = false; - } - } - }, { - key: "_finalizeBonds", - value: function _finalizeBonds() { - var bonds = this.getBonds(); - var n = bonds.length; - - for (var i = 0; i < n; ++i) { - bonds[i]._index = i; - } - } - /** - * Finalizes complex's inner data(i.e. after parsing). - * @param {objects} opts - Build bonds automatically. - * @param {boolean} opts.needAutoBonding - Build bonds automatically. - * @param {boolean} opts.detectAromaticLoops - Find/mark aromatic loops. - * @param {boolean} opts.enableEditing - Restructure Complex to enable per-component editing. - * @param {Array} [opts.serialAtomMap] - Array of atoms ordered by their serials. - */ - - }, { - key: "finalize", - value: function finalize(opts) { - opts = opts || {}; // Put bonds into atoms - - var bonds = this._bonds; - var i; - var n; // remove invalid bonds - - for (i = bonds.length - 1; i >= 0; i--) { - var bond = bonds[i]; - - if (bond._left === null || bond._right === null) { - bonds.splice(i, 1); - } else { - bond._left.bonds.push(bond); - - bond._right.bonds.push(bond); - } - } - - var residues = this._residues; - - for (i = 0, n = residues.length; i < n; ++i) { - residues[i]._finalize(); - } - - this.forEachChain(function (a) { - a._finalize(); - }); // WARNING! this MUST be done BEFORE computeBounds is called - - var units = this.units; - - for (i = 0, n = units.length; i < n; ++i) { - units[i].finalize(); - } // try setting first biomolecule by defaults - - - this.setCurrentUnit(1); - var residueHash = {}; - - for (i = 0, n = residues.length; i < n; ++i) { - var res = residues[i]; // This code is extremely dangerous for non-PDB formats - - residueHash[this.getUnifiedSerial(res.getChain().getName().charCodeAt(0), res.getSequence(), res.getICode().charCodeAt(0))] = res; - } - - var structures = this.structures; - - for (i = 0, n = structures.length; i < n; ++i) { - structures[i]._finalize(opts.serialAtomMap, residueHash, this); - } - - var helices = this._helices; - - for (i = 0, n = helices.length; i < n; ++i) { - helices[i]._finalize(opts.serialAtomMap, residueHash, this); - } - - var sheets = this._sheets; - - for (i = 0, n = sheets.length; i < n; ++i) { - sheets[i]._finalize(opts.serialAtomMap, residueHash, this); - } // Update bounding sphere and box - - - this._computeBounds(); - - var atoms = this._atoms; - - for (i = 0, n = atoms.length; i < n; ++i) { - var currAtom = atoms[i]; - currAtom.index = i; - } - - if (opts.needAutoBonding) { - var autoConnector = new AutoBond(this); - autoConnector.build(); - autoConnector.destroy(); - } - - var chains = this._chains; - - for (i = 0, n = chains.length; i < n; ++i) { - chains[i]._index = i; - } - - for (i = 0, n = residues.length; i < n; ++i) { - residues[i]._index = i; - } // mark non-polar hydrogens - - - for (i = 0, n = atoms.length; i < n; ++i) { - var atom = atoms[i]; - - if (atom.flags & Atom.Flags.HYDROGEN && atom.bonds.length === 1) { - var _bond = atom.bonds[0]; - var other = _bond._left !== atom && _bond._left || _bond._right; - - if (other.flags & Atom.Flags.CARBON) { - atom.flags |= Atom.Flags.NONPOLARH; - } - } - } - - this._finalizeBonds(); - - this._fillComponents(opts.enableEditing); - - var marker = new AromaticLoopsMarker(this); - marker.markCycles(); - - if (opts.detectAromaticLoops) { - // TODO remove this condition clause, it is for debug purposes only! - marker.detectCycles(); // TODO add conditional detection - } - - this._finalizeMolecules(); - } - }, { - key: "_finalizeMolecules", - value: function _finalizeMolecules() { - // add reference to molecule into residue - for (var i = 0; i < this._molecules.length; i++) { - var molecule = this._molecules[i]; - var count = molecule.residues.length; - - for (var j = 0; j < count; j++) { - var residue = molecule.residues[j]; - residue._molecule = molecule; - } - } - } - }, { - key: "updateStructuresMask", - value: function updateStructuresMask() { - var updater = function updater(structure) { - return structure.collectMask(); - }; - - this.forEachResidue(updater); - this.forEachChain(updater); - this.forEachMolecule(updater); - } - }, { - key: "countAtomsByMask", - value: function countAtomsByMask(mask) { - var count = 0; - this.forEachAtom(function (atom) { - if ((atom.mask & mask) !== 0) { - count++; - } - }); - return count; - } - }, { - key: "getNumAtomsBySelector", - value: function getNumAtomsBySelector(selector) { - var count = 0; - this.forEachAtom(function (atom) { - if (selector.includesAtom(atom)) { - count++; - } - }); - return count; - } - }, { - key: "resetAtomMask", - value: function resetAtomMask(mask) { - this.forEachAtom(function (atom) { - atom.mask = mask; - }); - } - }, { - key: "markAtoms", - value: function markAtoms(selector, mask) { - var setMask = mask; - var clearMask = ~setMask; - var count = 0; - var totalSelector = selectors.keyword('And')(selector, this.getSelector()); - this.forEachAtom(function (atom) { - if (totalSelector.includesAtom(atom)) { - atom.mask |= setMask; - count++; - } else { - atom.mask &= clearMask; - } - }); - this._maskNeedsUpdate = true; - return count; - } - }, { - key: "markAtomsAdditionally", - value: function markAtomsAdditionally(selector, mask) { - var setMask = mask; - var count = 0; - this.forEachAtom(function (atom) { - if (selector.includesAtom(atom) && (atom.mask & mask) !== mask) { - atom.mask |= setMask; - count++; - } - }); - return count; - } - }, { - key: "clearAtomBits", - value: function clearAtomBits(mask) { - var clearMask = ~mask; - this.forEachAtom(function (atom) { - atom.mask &= clearMask; - }); - - var reseter = function reseter(a) { - a._mask &= clearMask; - }; - - this.forEachAtom(reseter); - this.forEachResidue(reseter); - this.forEachChain(reseter); - this.forEachMolecule(reseter); - } - }, { - key: "getAtomNames", - value: function getAtomNames() { - if (this.hasOwnProperty('_atomNames')) { - return this._atomNames; - } - - var dict = {}; - this.forEachAtom(function (atom) { - dict[atom.name] = 1; - }); - this._atomNames = Object.keys(dict); - return this._atomNames; - } - }, { - key: "getElements", - value: function getElements() { - if (this.hasOwnProperty('_elements')) { - return this._elements; - } - - var dict = {}; - this.forEachAtom(function (atom) { - dict[atom.element.name] = 1; - }); - this._elements = Object.keys(dict); - return this._elements; - } - }, { - key: "getResidueNames", - value: function getResidueNames() { - if (this.hasOwnProperty('_residueNames')) { - return this._residueNames; - } - - var dict = {}; - this.forEachResidue(function (res) { - dict[res._type._name] = 1; - }); - this._residueNames = Object.keys(dict); - return this._residueNames; - } - }, { - key: "getChainNames", - value: function getChainNames() { - if (this.hasOwnProperty('_chainNames')) { - return this._chainNames; - } - - var dict = {}; - this.forEachChain(function (chain) { - dict[chain._name] = 1; - }); - this._chainNames = Object.keys(dict); - return this._chainNames; - } - }, { - key: "getAltLocNames", - value: function getAltLocNames() { - if (this.hasOwnProperty('_altlocNames')) { - return this._altlocNames; - } - - var dict = {}; - this.forEachAtom(function (atom) { - dict[String.fromCharCode(atom.location)] = 1; - }); - this._altlocNames = Object.keys(dict); - return this._altlocNames; - } - }, { - key: "getVoxelWorld", - value: function getVoxelWorld() { - if (!this.hasOwnProperty('_voxelWorld')) { - try { - this._voxelWorld = new VoxelWorld(this.getDefaultBoundaries().boundingBox, new Vector3(VOXEL_SIZE, VOXEL_SIZE, VOXEL_SIZE)); - - this._voxelWorld.addAtoms(this); - } catch (e) { - logger.warn('Unable to create voxel world'); - this._voxelWorld = null; - } - } - - return this._voxelWorld; - } - /** - * Simple function to make unified routine procedure without code duplication. - * @param {Array} srcArray - Source chemical structure array (will be part of resulting chemical structure array). - * @param {Array} dstArray - Resulting chemical structure array. - * @param {number} param - Parameter for processor. - * @param {function} functor - Processor for every element in array. - */ - - }, { - key: "addElement", - value: function addElement(srcArray, dstArray, param, functor) { - var length = srcArray.length; - - for (var i = 0; i < length; ++i) { - var elem = srcArray[i]; - functor(elem, param); - dstArray.push(elem); - } - } // this function joins multiple complexes into one (this) - // atom, bond, ... objects are reused -- so input complexes are no longer valid - - }, { - key: "joinComplexes", - value: function joinComplexes(complexes) { - // clear target complex - this._chains = []; - this._components = []; - this._helices = []; - this._sheets = []; - this.structures = []; - this._atoms = []; - this._residues = []; - this._bonds = []; - this._sgroups = []; - var self = this; - var atomBias = 0; - var bondBias = 0; - var residueBias = 0; - var chainBias = 0; - var componentBias = 0; - - function processAtom(atom, bias) { - atom.serial += bias; - atom.index += bias; - } - - function processBond(bond, bias) { - bond._index += bias; - } - - function processResidue(residue, bias) { - residue._index += bias; - } - - function processChain(chain, bias) { - chain._complex = self; - chain._index += bias; - } - - function processComponent(component, bias) { - component._complex = self; - component._index += bias; - } - /** - * Simple function to do nothing. - */ - - - function doNothing() {} - - for (var i = 0; i < complexes.length; ++i) { - var c = complexes[i]; - this.addElement(c._atoms, this._atoms, atomBias, processAtom); - this.addElement(c._bonds, this._bonds, bondBias, processBond); - this.addElement(c._residues, this._residues, residueBias, processResidue); - this.addElement(c._chains, this._chains, chainBias, processChain); - this.addElement(c._sheets, this._sheets, 0, doNothing); - this.addElement(c._helices, this._helices, 0, doNothing); - this.addElement(c._sgroups, this._sgroups, 0, doNothing); - this.addElement(c._components, this._components, componentBias, processComponent); - this.addElement(c.structures, this.structures, 0, doNothing); // merge residue types - - for (var rt in c._residueTypes) { - if (c._residueTypes.hasOwnProperty(rt)) { - this._residueTypes[rt] = c._residueTypes[rt]; - } - } - - atomBias += c._atoms.length; - bondBias += c._bonds.length; - residueBias += c._residues.length; - chainBias += c._chains.length; - componentBias += c._components.length; - } - - this._computeBounds(); - } - /** - * Replace secondary structure with calculated one. - * - * DSSP algorithm implementation is used. - * - * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and - * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211. - */ - - }, { - key: "dssp", - value: function dssp() { - var ssMap = new SecondaryStructureMap(this); - var structures = this.structures = []; - var helices = this._helices = []; - var sheets = this._sheets = []; - - var getSheet = function getSheet(index) { - var item = sheets[index]; - - if (!item) { - item = sheets[index] = new Sheet(String(index), 0); - } - - return item; - }; - - var lastCode; - var lastSheetIndex; - var lastHelixIndex = 0; - var curStructure = null; - - for (var i = 0, n = this._residues.length; i < n; ++i) { - var curCode = ssMap._ss[i]; - var curResidue = this._residues[i]; - var curSheetIndex = ssMap._sheet[i]; // expand the last structure - - if (curCode === lastCode && curSheetIndex === lastSheetIndex) { - curResidue._secondary = curStructure; - - if (curStructure) { - curStructure.term = curResidue; - } - - if (curStructure instanceof Helix) { - curStructure.length++; - } - - continue; - } // create a new structure - - - var helixClass = helixClassMap[curCode]; - var loopType = loopMap[curCode]; - - if (curCode === StructureType$1.STRAND) { - var curSheet = getSheet(curSheetIndex); - curStructure = new Strand(curSheet, curResidue, curResidue, 0, null, null); - curSheet.addStrand(curStructure); - } else if (helixClass !== undefined) { - lastHelixIndex++; - curStructure = new Helix(helixClass, curResidue, curResidue, lastHelixIndex, String(lastHelixIndex), '', 1); - helices.push(curStructure); - } else if (loopType !== undefined) { - curStructure = new StructuralElement(loopType, curResidue, curResidue); - } else { - curStructure = null; - } - - if (curStructure) { - structures.push(curStructure); - } - - curResidue._secondary = curStructure; - lastCode = curCode; - lastSheetIndex = curSheetIndex; - } - - this._sheets = sheets.filter(function (_sheet) { - return true; - }); // squeeze sheets array - } - }]); - - return Complex; -}(); - -Complex.prototype.id = 'Complex'; -Complex.prototype.name = ''; - -function pow2ceil(v) { - var p = 2; - v = v - 1 >> 1; - - while (v) { - p <<= 1; - v >>= 1; - } - - return p; -} -/** - * Volume constructor - * - * @param {Object} type - Float32Array, Int8Array, etc... - * @param {Object|Array} dimensions - number of data points on each axis (x, y, z) - * @param {Box3} box - bounding box defining data place in metric space, - * it's corners correspond to extreme data points - * @param {Number} vecSize - dimension of the field data point (1 = scalar, 3 = 3D vector) - * @param {Object} data - typed array of the same type as specified by the 1st parameter, - * layout: point by point along X, - * row by row along Y, - * plane by plane along Z - * @param {Number} volumeInfo - volume info values to define threshold to filter the noise - */ - - -var Volume = /*#__PURE__*/function () { - function Volume(type, dimensions, box, vecSize, data, volumeInfo) { - classCallCheck(this, Volume); - - this._box = box.clone(); - this._dimVec = Math.max(Math.floor(vecSize || 1), 1); - this._volumeInfo = volumeInfo; - - if (dimensions instanceof Array) { - var _dimensions = slicedToArray(dimensions, 3); - - this._dimX = _dimensions[0]; - this._dimY = _dimensions[1]; - this._dimZ = _dimensions[2]; - } else { - this._dimX = dimensions.x; - this._dimY = dimensions.y; - this._dimZ = dimensions.z; - } - - this._dimX = Math.max(Math.floor(this._dimX), 1); - this._dimY = Math.max(Math.floor(this._dimY), 1); - this._dimZ = Math.max(Math.floor(this._dimZ), 1); - this._rowElements = this._dimVec * this._dimX; - this._planeElements = this._rowElements * this._dimY; - this._totalElements = this._planeElements * this._dimZ; - this._data = data || utils.allocateTyped(type, this._totalElements); // override getter/setter for vector fields - - switch (this._dimVec) { - case 1: - break; - - case 2: - this.getValue = function (x, y, z) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - return [this._data[idx], this._data[idx + 1]]; - }; - - this.setValue = function (x, y, z, a, b) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - this._data[idx] = a; - this._data[idx + 1] = b; - }; - - this.addValue = function (x, y, z, a, b) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - this._data[idx] += a; - this._data[idx + 1] += b; - }; - - break; - - case 3: - this.getValue = function (x, y, z) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - return [this._data[idx], this._data[idx + 1], this._data[idx + 2]]; - }; - - this.setValue = function (x, y, z, a, b, c) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - this._data[idx] = a; - this._data[idx + 1] = b; - this._data[idx + 2] = c; - }; - - this.addValue = function (x, y, z, a, b, c) { - var idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; - this._data[idx] += a; - this._data[idx + 1] += b; - this._data[idx + 2] += c; - }; - - break; - - default: - throw new Error('Volume: invalid vector dimension'); - } - } // default getter assumes it's a scalar field - - - createClass(Volume, [{ - key: "getValue", - value: function getValue(x, y, z) { - return this._data[x + y * this._rowElements + z * this._planeElements]; - } // default setter assumes it's a scalar field - - }, { - key: "setValue", - value: function setValue(x, y, z, val) { - this._data[x + y * this._rowElements + z * this._planeElements] = val; - } // default adder assumes it's a scalar field - - }, { - key: "addValue", - value: function addValue(x, y, z, val) { - this._data[x + y * this._rowElements + z * this._planeElements] += val; - } - }, { - key: "getDimensions", - value: function getDimensions() { - return [this._dimX, this._dimY, this._dimZ]; - } - }, { - key: "getBox", - value: function getBox() { - return this._box; - } - }, { - key: "getVolumeInfo", - value: function getVolumeInfo() { - return this._volumeInfo; - } - }, { - key: "getCellSize", - value: function getCellSize() { - var boxSize = new Vector3(); - - this._box.getSize(boxSize); - - var res = new Vector3(); - res.x = this._dimX > 1 ? boxSize.x / (this._dimX - 1) : 0; - res.y = this._dimY > 1 ? boxSize.y / (this._dimY - 1) : 0; - res.z = this._dimZ > 1 ? boxSize.z / (this._dimZ - 1) : 0; - return res; - } - }, { - key: "computeGradient", - value: function computeGradient() { - if (this._dimVec !== 1) { - // gradient can only be computed for scalar fields - return null; - } // create a 3D vector field of gradients - - - var gradient = new Volume(Float32Array, [this._dimX, this._dimY, this._dimZ], this._box, 3); // calculate cell side lengths - - var vl = this.getCellSize(); // gradient axis scaling values and averaging factors, to correctly - // calculate the gradient for volumes with irregular cell spacing - - var vs = new Vector3(-0.5 / vl.x, -0.5 / vl.y, -0.5 / vl.z); // TODO Check for intended bug in VMD (min is zero) - - function clamp(val, min, max) { - return Math.min(max, Math.max(min, val)); - } - - var xSize = this._dimX; - var ySize = this._dimY; - var zSize = this._dimZ; - var volMap = this._data; - - function _voxelValue(x, y, z) { - return volMap[z * xSize * ySize + y * xSize + x]; - } - - for (var zi = 0; zi < zSize; ++zi) { - var zm = clamp(zi - 1, 0, zSize - 1); - var zp = clamp(zi + 1, 0, zSize - 1); - - for (var yi = 0; yi < ySize; ++yi) { - var ym = clamp(yi - 1, 0, ySize - 1); - var yp = clamp(yi + 1, 0, ySize - 1); - - for (var xi = 0; xi < xSize; ++xi) { - var xm = clamp(xi - 1, 0, xSize - 1); - var xp = clamp(xi + 1, 0, xSize - 1); // Calculate the volume gradient at each grid cell. - // Gradients are now stored unnormalized, since we need them in pure - // form in order to draw field lines etc. Shading code will now have - // to do renormalization for itself on-the-fly. - // XXX this gradient is only correct for orthogonal grids, since - // we're using the array index offsets rather to calculate the gradient - // rather than voxel coordinate offsets. This will have to be - // re-worked for non-orthogonal datasets. - - gradient.setValue(xi, yi, zi, (_voxelValue(xp, yi, zi) - _voxelValue(xm, yi, zi)) * vs.x, (_voxelValue(xi, yp, zi) - _voxelValue(xi, ym, zi)) * vs.y, (_voxelValue(xi, yi, zp) - _voxelValue(xi, yi, zm)) * vs.z); - } - } - } - - return gradient; - } - }, { - key: "normalize", - value: function normalize() { - var data = this._data; // get min/max - - var min = data[0]; - var max = data[0]; - - for (var i = 1; i < data.length; ++i) { - min = Math.min(min, data[i]); - max = Math.max(max, data[i]); - } - - var d = 1.0 / (max - min); - - if (d === 0) { - return; - } // normalize - - - for (var _i = 0; _i < data.length; ++_i) { - data[_i] = d * (data[_i] - min); - } - } - }, { - key: "getTiledTextureStride", - value: function getTiledTextureStride() { - return [this._dimX + 2, this._dimY + 2]; - } - }, { - key: "buildTiledTexture", - value: function buildTiledTexture() { - var tilesX = Math.ceil(Math.sqrt(this._dimZ * this._dimY / this._dimX)); - var width = tilesX * (this._dimX + 2) - 1; - width = pow2ceil(width); - tilesX = Math.floor(width / (this._dimX + 2)); - var tilesY = Math.ceil(this._dimZ / tilesX); - var height = tilesY * (this._dimY + 2) - 1; - height = pow2ceil(height); - var data = new Uint8Array(width * height); - var src; - var dst; - - for (var tileRow = 0; tileRow < tilesY; ++tileRow) { - // process each pixel row of this tile row - for (var row = 0; row < this._dimY; ++row) { - src = tileRow * tilesX * this._planeElements + row * this._rowElements; - dst = width * (tileRow * (this._dimY + 2) + row); // copy a series of rows through several XY planes - - for (var t = 0; t < tilesX; ++t) { - // copy one row of one XY plane - for (var x = 0; x < this._dimX; ++x) { - data[dst++] = 255.0 * this._data[src++]; - } // repeat last pixel of previous tile - - - data[dst++] = 255.0 * this._data[src - 1]; - - if (t < tilesX - 1) { - // skip to the same row of next XY plane - src += this._planeElements - this._rowElements; // repeat first pixel of next tile - - data[dst++] = 255.0 * this._data[src]; - } - } - } - } // fill pixels between tile rows with copy of edge pixels - - - for (var _tileRow = 0; _tileRow < tilesY; ++_tileRow) { - // copy last pixel row of this tile row to the following pixel row of the texture - src = width * (_tileRow * (this._dimY + 2) + this._dimY - 1); - dst = src + width; - - for (var _x = 0; _x < width; ++_x) { - data[dst++] = data[src++]; - } - - if (_tileRow < tilesY - 1) { - // copy first pixel row of next tile row to the preceding pixel row of the texture - src = width * (_tileRow + 1) * (this._dimY + 2); - dst = src - width; - - for (var _x2 = 0; _x2 < width; ++_x2) { - data[dst++] = data[src++]; - } - } - } - - var texture = new DataTexture(data, width, height, LuminanceFormat, UnsignedByteType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, LinearFilter); - texture.needsUpdate = true; - return texture; - } - /* ******************************************************************************** - * - * Methods that provide direct access to internal array (for better performance) - * - ******************************************************************************** */ - - }, { - key: "getData", - value: function getData() { - return this._data; - } - }, { - key: "getDirectIdx", - value: function getDirectIdx(x, y, z) { - return x * this._dimVec + y * this._rowElements + z * this._planeElements; - } - }, { - key: "getStrideX", - value: function getStrideX() { - return this._dimVec; - } - }, { - key: "getStrideY", - value: function getStrideY() { - return this._rowElements; - } - }, { - key: "getStrideZ", - value: function getStrideZ() { - return this._planeElements; - } - }]); - - return Volume; -}(); - -Volume.prototype.id = 'Volume'; - -/** - * Residue Molecule. - * - * @param {Complex} complex - Molecular complex this Molecule belongs to. - * @param {String} name - Molecule's name. - * @param {Integer} index - Molecule's index in file. - * - * @exports Molecule - * @constructor - */ -var Molecule = /*#__PURE__*/function () { - function Molecule(complex, name, index) { - classCallCheck(this, Molecule); - - this.complex = complex; - this.name = name || ''; - this.residues = []; - this.mask = 1 | 0; - this.index = index || -1; // start with 1 - } - - createClass(Molecule, [{ - key: "forEachResidue", - value: function forEachResidue(process) { - var residues = this.residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - process(residues[i]); - } - } - }, { - key: "collectMask", - value: function collectMask() { - var mask = 0xffffffff; - var residues = this.residues; - - for (var i = 0, n = residues.length; i < n; ++i) { - mask &= residues[i]._mask; - } - - this.mask = mask; - } - }]); - - return Molecule; -}(); - -var chem = { - Atom: Atom, - Element: Element, - Bond: Bond, - Residue: Residue, - ResidueType: ResidueType, - Chain: Chain, - Helix: Helix, - Strand: Strand, - Sheet: Sheet, - SGroup: SGroup, - Assembly: Assembly, - Complex: Complex, - Volume: Volume, - VoxelWorld: VoxelWorld, - selectors: selectors, - Molecule: Molecule -}; - -var CSS2DObject = /*#__PURE__*/function (_THREE$Object3D) { - inherits(CSS2DObject, _THREE$Object3D); - - function CSS2DObject(element) { - var _this; - - classCallCheck(this, CSS2DObject); - - _this = possibleConstructorReturn(this, getPrototypeOf(CSS2DObject).call(this)); - - var self = assertThisInitialized(_this); - - _this._element = element; - _this._element.style.position = 'absolute'; - - _this.addEventListener('removed', function () { - if (self._element.parentNode !== null) { - self._element.parentNode.removeChild(self._element); - } - }); - - return _this; - } - - createClass(CSS2DObject, [{ - key: "getElement", - value: function getElement() { - return this._element; - } - /** - * Sets label transparency. - * - * @param {number} transp - in [0; 1] 1 means fully transparent - */ - - }, { - key: "setTransparency", - value: function setTransparency(transp) { - var el = this.getElement(); - - if (el === null) { - return; - } - - if (transp === 1.0) { - el.style.display = 'none'; - return; - } - - el.style.display = 'inline'; - var op = 1.0 - transp; - var top = op.toString(); - var op100 = op * 100; - el.style.opacity = top; - el.style.filter = "alpha(opacity=".concat(op100, ")"); // IE fallback - } - }, { - key: "clone", - value: function clone() { - var obj = new CSS2DObject(this._element); - obj.copy(this); - return obj; - } - }]); - - return CSS2DObject; -}(Object3D); - -var RCGroup = /*#__PURE__*/function (_THREE$Group) { - inherits(RCGroup, _THREE$Group); - - function RCGroup() { - classCallCheck(this, RCGroup); - - return possibleConstructorReturn(this, getPrototypeOf(RCGroup).apply(this, arguments)); - } - - createClass(RCGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - if (!this.visible) { - return; - } - - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - children[i].raycast(raycaster, intersects); - } - } - }, { - key: "enableSubset", - value: function enableSubset(mask, innerOnly) { - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].enableSubset) { - children[i].enableSubset(mask, innerOnly); - } - } - } - }, { - key: "disableSubset", - value: function disableSubset(mask, innerOnly) { - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].disableSubset) { - children[i].disableSubset(mask, innerOnly); - } - } - } - }, { - key: "isEmpty", - value: function isEmpty() { - return this.children.length === 0; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].updateToFrame) { - children[i].updateToFrame(frameData); - } - } - } - }, { - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - Array.prototype.push.apply(totalSubset, children[i].getSubset(mask, innerOnly)); - } - } - - return totalSubset; - } - }]); - - return RCGroup; -}(Group); - -var vertexScreenQuadShader = "uniform mat4 projectionMatrix;\r\nuniform mat4 modelViewMatrix;\r\n\r\nattribute vec2 uv;\r\nattribute vec3 position;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vUv = uv;\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\r\n}\r\n"; - -var fragmentScreenQuadFromTex = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform float opacity;\r\n\r\nvoid main() {\r\n vec4 color = texture2D(srcTex, vUv);\r\n gl_FragColor = vec4(color.xyz, color.a * opacity);\r\n}\r\n"; - -var fragmentScreenQuadFromTexWithDistortion = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform float coef;\r\n\r\nvoid main() {\r\n vec2 uv = vUv * 2.0 - 1.0;\r\n float r2 = dot(uv, uv);\r\n vec2 tc = uv * (1.0 + coef * r2);\r\n if (!all(lessThan(abs(tc), vec2(1.0))))\r\n discard;\r\n tc = 0.5 * (tc + 1.0);\r\n gl_FragColor = texture2D(srcTex, tc);\r\n}\r\n"; - -var vertexShader = "float INSTANCED_SPRITE_OVERSCALE = 1.3;\r\n\r\nattribute vec3 normal;\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n varying vec3 viewNormal;\r\n#endif\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n varying vec3 vNormal;\r\n#endif\r\n\r\n#ifdef THICK_LINE\r\n attribute vec4 position; // W contains vert pos or neg offset\r\n#else\r\n attribute vec3 position;\r\n#endif\r\n\r\nvarying vec3 vWorldPosition;\r\nvarying vec3 vViewPosition;\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n attribute float alphaColor;\r\n varying float alphaCol;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n attribute vec3 color;\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n attribute vec3 color2;\r\n varying vec3 vColor2;\r\n attribute vec2 uv;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_POS\r\n attribute vec4 offset;\r\n #ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n varying vec4 spritePosEye;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n attribute vec4 matVector1;\r\n attribute vec4 matVector2;\r\n attribute vec4 matVector3;\r\n attribute vec4 invmatVector1;\r\n attribute vec4 invmatVector2;\r\n attribute vec4 invmatVector3;\r\n\r\n #ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n #endif\r\n#endif\r\n\r\nuniform mat4 modelViewMatrix; // optional\r\nuniform mat4 projectionMatrix; // optional\r\nuniform mat3 normalMatrix; // optional\r\nuniform mat4 modelMatrix; // optional\r\n\r\n#ifdef DASHED_LINE\r\n attribute float lineDistance;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n#ifdef THICK_LINE\r\n attribute vec3 direction;\r\n uniform mat4 projMatrixInv;\r\n uniform vec2 viewport;\r\n uniform float lineWidth;\r\n\r\n vec4 transform(vec4 coord){\r\n return projectionMatrix * modelViewMatrix * coord;\r\n }\r\n\r\n vec2 project(vec4 device){\r\n vec3 device_normal = device.xyz/device.w;\r\n vec2 clip_pos = (device_normal*0.5+0.5).xy;\r\n return clip_pos * viewport;\r\n }\r\n\r\n vec4 unproject(vec2 screen, float z, float w){\r\n vec2 clip_pos = screen/viewport;\r\n vec2 device_normal = clip_pos*2.0-1.0;\r\n return vec4(device_normal*w, z, w);\r\n }\r\n#endif\r\n\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n alphaCol = alphaColor;\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n vec3 objectNormal = vec3(\r\n dot(normal, matVector1.xyz),\r\n dot(normal, matVector2.xyz),\r\n dot(normal, matVector3.xyz));\r\n#else\r\n vec3 objectNormal = vec3( normal );\r\n#endif\r\n\r\nvec3 transformedNormal = normalMatrix * objectNormal;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n vNormal = normalize(transformedNormal);\r\n#endif\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n viewNormal = normalize(mat3(modelViewMatrix)*objectNormal);\r\n#endif\r\n\r\n vec4 localPos = vec4(position.xyz, 1.0);\r\n vec4 worldPos = modelMatrix * localPos;\r\n vec4 mvPosition = modelViewMatrix * localPos;\r\n\r\n// make thick line offset\r\n#ifdef THICK_LINE\r\n // get screen pos\r\n vec4 dPos = transform(vec4(position.xyz, 1.0));\r\n vec2 sPos = project(dPos);\r\n // move pos forward\r\n vec3 position2 = position.xyz + direction.xyz * 0.5;\r\n // get screen offset pos\r\n vec4 dPos2 = transform(vec4(position2.xyz, 1.0));\r\n vec2 sPos2 = project(dPos2);\r\n // screen line direction\r\n vec2 sDir = normalize(sPos2 - sPos);\r\n // vertex offset (orthogonal to line direction)\r\n vec2 offset1 = vec2(-sDir.y, sDir.x);\r\n // move screen vertex\r\n vec2 newPos = sPos + offset1 * position.w * lineWidth;\r\n // get moved pos in view space\r\n vec4 dNewPos = unproject(newPos, dPos.z, dPos.w);\r\n mvPosition.xyz = (projMatrixInv * dNewPos).xyz;\r\n#endif // THICK_LINE\r\n\r\n#ifdef INSTANCED_POS\r\n #ifdef SPHERE_SPRITE\r\n instOffset = offset;\r\n\r\n vec4 posEye = modelViewMatrix * vec4( offset.xyz, 1.0 );\r\n float scale = length(modelViewMatrix[0]);\r\n mvPosition = posEye + vec4( position.xyz * offset.w * scale * INSTANCED_SPRITE_OVERSCALE, 0.0 );\r\n posEye.w = offset.w * scale;\r\n\r\n spritePosEye = posEye;\r\n #else\r\n localPos = vec4( offset.xyz + position.xyz * offset.w, 1.0 );\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n #ifdef CYLINDER_SPRITE\r\n matVec1 = matVector1;\r\n matVec2 = matVector2;\r\n matVec3 = matVector3;\r\n invmatVec1 = invmatVector1;\r\n invmatVec2 = invmatVector2;\r\n invmatVec3 = invmatVector3;\r\n\r\n // calculate eye coords of cylinder endpoints\r\n vec4 v = vec4(0, -0.5, 0, 1);\r\n vec4 p1 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n v.y = 0.5;\r\n vec4 p2 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n\r\n // sprite is placed at the center of cylinder\r\n vec4 posEye;\r\n posEye.xyz = mix(p1.xyz, p2.xyz, 0.5);\r\n posEye.w = 1.0;\r\n\r\n // basic sprite size at screen plane (covers only cylinder axis)\r\n vec2 spriteSizeScreen = abs(p2.xy / p2.z - p1.xy / p1.z);\r\n\r\n // cylinder radius in eye space\r\n float rad = length(modelViewMatrix[0]) * length(vec3(matVector1.x, matVector2.x, matVector3.x));\r\n\r\n // full sprite size in eye coords\r\n float minZ = min(abs(p1.z), abs(p2.z));\r\n vec2 spriteSize = INSTANCED_SPRITE_OVERSCALE * abs(posEye.z) *\r\n (spriteSizeScreen + 2.0 * rad / minZ);\r\n\r\n mvPosition = posEye + vec4( position.xy * 0.5 * spriteSize, 0, 0 );\r\n #else\r\n localPos = vec4(dot(localPos, matVector1), dot(localPos, matVector2), dot(localPos, matVector3), 1.0);\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n gl_Position = projectionMatrix * mvPosition;\r\n\r\n vWorldPosition = worldPos.xyz;\r\n vViewPosition = - mvPosition.xyz;\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t vec4 worldPosition;\r\n\t // see THREE.WebGLProgram.unrollLoops\r\n\t #pragma unroll_loop\r\n\t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * vec4(vWorldPosition, 1.0);\r\n vDirectionalShadowNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(objectNormal, 0.0))).xyz;\r\n\t }\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n vColor = color.xyz;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n vColor2 = color2;\r\n #ifndef CYLINDER_SPRITE\r\n vUv = uv;\r\n #endif\r\n#endif\r\n\r\n#ifdef DASHED_LINE\r\n vLineDistance = lineDistance;\r\n#endif\r\n}\r\n"; - -var fragmentShader = "#if defined (NORMALS_TO_G_BUFFER)\r\n #define fragColor gl_FragData[0]\r\n#else\r\n #define fragColor gl_FragColor\r\n#endif\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n varying float alphaCol;\r\n#endif\r\n\r\n#ifdef COLOR_FROM_POS\r\n uniform mat4 world2colorMatrix;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n // We use 4 instead uniform variable or define because this value is used in for(... i < value; ...) with\r\n // unroll_loop and unroll_loop has pattern:\r\n // /#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g\r\n uniform vec2 samplesKernel[4]; // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n uniform sampler2D noiseTex;\r\n uniform vec2 noiseTexelSize;\r\n uniform vec2 srcTexelSize;\r\n uniform mat4 projectionMatrix;\r\n #endif\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n varying vec3 vColor2;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\nuniform vec3 diffuse;\r\nuniform vec3 emissive;\r\nuniform vec3 specular;\r\nuniform float shininess;\r\nuniform vec3 fixedColor;\r\nuniform float opacity;\r\nuniform float zClipValue;\r\nuniform float clipPlaneValue;\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n varying vec3 viewNormal;\r\n#endif\r\n\r\n#define PI 3.14159265359\r\n#define RECIPROCAL_PI 0.31830988618\r\n#define saturate(a) clamp( a, 0.0, 1.0 )\r\n\r\n#ifdef USE_FOG\r\n uniform vec3 fogColor;\r\n uniform float fogAlpha;\r\n uniform float fogNear;\r\n uniform float fogFar;\r\n#endif\r\n\r\nvarying vec3 vWorldPosition; // world position of the pixel (invalid when INSTANCED_SPRITE is defined)\r\nvarying vec3 vViewPosition;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n varying vec3 vNormal;\r\n#endif\r\n\r\n/////////////////////////////////////////// ZSprites ////////////////////////////////////////////////\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 spritePosEye;\r\n#endif\r\n\r\n#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n uniform float zOffset;\r\n uniform mat4 projectionMatrix;\r\n\r\n float calcDepthForSprites(vec4 pixelPosEye, float zOffset, mat4 projMatrix) {\r\n vec4 pixelPosScreen = projMatrix * pixelPosEye;\r\n return 0.5 * (pixelPosScreen.z / pixelPosScreen.w + 1.0) + zOffset;\r\n }\r\n#endif\r\n\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n float intersect_ray_sphere(in vec3 origin, in vec3 ray, out vec3 point) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray, ray);\r\n float b = dot(ray, origin);\r\n float c = dot(origin, origin) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return -1.0;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n // choose nearest point\r\n if (t1 >= 0.0) {\r\n point = p1;\r\n return t1;\r\n }\r\n if (t2 >= 0.0) {\r\n point = p2;\r\n return t2;\r\n }\r\n\r\n return -1.0;\r\n }\r\n\r\n float get_sphere_point(in vec3 pixelPosEye, out vec3 point) {\r\n // transform camera pos into sphere local coords\r\n vec4 v = invModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\r\n vec3 origin = (v.xyz - instOffset.xyz) / instOffset.w;\r\n\r\n // transform (camera -> pixel) ray into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye, 0.0);\r\n vec3 ray = normalize(v.xyz);\r\n\r\n return intersect_ray_sphere(origin, ray, point);\r\n }\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n float intersect_ray_cylinder(in vec3 origin, in vec3 ray, out vec3 point) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray.xz, ray.xz);\r\n float b = dot(ray.xz, origin.xz);\r\n float c = dot(origin.xz, origin.xz) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return -1.0;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n // choose nearest point\r\n float halfHeight = 0.5;\r\n if (t1 >= 0.0 && p1.y >= -halfHeight && p1.y <= halfHeight) {\r\n point = p1;\r\n return t1;\r\n }\r\n if (t2 >= 0.0 && p2.y >= -halfHeight && p2.y <= halfHeight) {\r\n point = p2;\r\n return t2;\r\n }\r\n\r\n return -1.0;\r\n }\r\n\r\n float get_cylinder_point(in vec3 pixelPosEye, out vec3 point) {\r\n // transform camera pos into cylinder local coords\r\n vec4 v = invModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\r\n vec3 origin = vec3(\r\n dot(v, invmatVec1),\r\n dot(v, invmatVec2),\r\n dot(v, invmatVec3));\r\n\r\n // transform (camera -> pixel) ray into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye, 0.0);\r\n vec3 ray = vec3(\r\n dot(v, invmatVec1),\r\n dot(v, invmatVec2),\r\n dot(v, invmatVec3));\r\n ray = normalize(ray);\r\n\r\n return intersect_ray_cylinder(origin, ray, point);\r\n }\r\n#endif\r\n\r\n///////////////////////////////////// Pack and unpack ///////////////////////////////////////////////\r\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\r\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\r\n\r\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\r\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\r\n\r\n\r\nconst float ShiftRight8 = 1. / 256.;\r\n\r\nvec4 packDepthToRGBA( const in float v ) {\r\n vec4 r = vec4( fract( v * PackFactors ), v );\r\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\r\n return r * PackUpscale;\r\n}\r\n\r\nfloat unpackRGBAToDepth( const in vec4 v ) {\r\n return dot( v, UnpackFactors );\r\n}\r\n\r\n////////////////////////////////////////// All Lighting /////////////////////////////////////////////////\r\n#ifdef TOON_SHADING\r\n #define LOW_TOON_BORDER 0.0\r\n #define MEDIUM_TOON_BORDER 0.7\r\n #define HIGH_TOON_BORDER 1.0\r\n\r\n #define MEDIUM_TOON_RANGE 0.5\r\n #define HIGH_TOON_RANGE 0.95\r\n#endif\r\n#if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n struct ReflectedLight {\r\n vec3 directDiffuse;\r\n vec3 directSpecular;\r\n vec3 indirectDiffuse;\r\n };\r\n\r\n struct BlinnPhongMaterial {\r\n vec3 diffuseColor;\r\n vec3 specularColor;\r\n float specularShininess;\r\n };\r\n\r\n struct GeometricContext {\r\n vec3 normal;\r\n vec3 viewDir;\r\n };\r\n\r\n struct DirectionalLight {\r\n vec3 direction;\r\n vec3 color;\r\n\r\n int shadow;\r\n vec2 shadowMapSize;\r\n float shadowBias;\r\n float shadowRadius;\r\n };\r\n\r\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\r\n uniform vec3 ambientLightColor;\r\n\r\n /////////////////////////////////////////// Shadowmap ////////////////////////////////////////////////\r\n\r\n #if defined(SHADOWMAP)\r\n \tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\r\n \t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\r\n \t}\r\n\r\n float getShadow( sampler2D shadowMap, DirectionalLight dirLight, vec4 shadowCoord, vec3 vViewPosition, vec3 vNormal ) {\r\n \t float shadow = 0.0;\r\n\r\n // When shadows for sprites will appear use here for them normals as it done for G-buffer\r\n shadowCoord.xyz += dirLight.shadowBias * vNormal;\r\n shadowCoord.xyz /= shadowCoord.w;\r\n\r\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\r\n bool inFrustum = all( inFrustumVec );\r\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\r\n bool frustumTest = all( frustumTestVec );\r\n\r\n if ( frustumTest ) {\r\n #ifdef SHADOWMAP_BASIC\r\n \t shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\r\n \t#endif\r\n\r\n \t#ifdef SHADOWMAP_PCF_SHARP\r\n \t vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n float dx0 = - texelSize.x * dirLight.shadowRadius;\r\n float dy0 = - texelSize.y * dirLight.shadowRadius;\r\n float dx1 = + texelSize.x * dirLight.shadowRadius;\r\n float dy1 = + texelSize.y * dirLight.shadowRadius;\r\n\r\n shadow = (\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\r\n ) * ( 1.0 / 9.0 );\r\n #endif\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n vec4 vUv = ((projectionMatrix * vec4(vViewPosition, 1.0)) + 1.0) / 2.0;\r\n vec2 vUvNoise = vUv.xy / srcTexelSize * noiseTexelSize;\r\n\r\n vec2 noiseVec = normalize(texture2D(noiseTex, vUvNoise).rg);\r\n mat2 mNoise = mat2(noiseVec.x, noiseVec.y, -noiseVec.y, noiseVec.x);\r\n\r\n vec2 offset;\r\n #pragma unroll_loop\r\n for ( int i = 0; i < 4; i ++ ) { // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n offset = mNoise * ( normalize( samplesKernel[ i ]) * texelSize * dirLight.shadowRadius );\r\n shadow += texture2DCompare( shadowMap, shadowCoord.xy + offset, shadowCoord.z );\r\n }\r\n shadow /= float( 4 ); // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n #endif\r\n }\r\n return shadow;//(shadow != 1.0) ? 0.5 : 1.0;//vec4(shadow, shadow, shadow, 1.0);\r\n }\r\n #endif\r\n\r\n /////////////////////////////////////////// Lighting /////////////////////////////////////////////////\r\n\r\n vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\r\n return RECIPROCAL_PI * diffuseColor;\r\n } // validated\r\n\r\n vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\r\n // Original approximation by Christophe Schlick '94\r\n //;float fresnel = pow( 1.0 - dotLH, 5.0 );\r\n // Optimized variant (presented by Epic at SIGGRAPH '13)\r\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\r\n return ( 1.0 - specularColor ) * fresnel + specularColor;\r\n } // validated\r\n\r\n float G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\r\n // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\r\n return 0.25;\r\n }\r\n\r\n float D_BlinnPhong( const in float shininess, const in float dotNH ) {\r\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\r\n }\r\n\r\n vec3 BRDF_Specular_BlinnPhong( const in DirectionalLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\r\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\r\n float dotNH = saturate(dot( geometry.normal, halfDir ));\r\n float dotLH = saturate(dot( incidentLight.direction, halfDir ));\r\n\r\n vec3 F = F_Schlick( specularColor, dotLH );\r\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\r\n float D = D_BlinnPhong( shininess, dotNH );\r\n\r\n return F * ( G * D );\r\n } // validated\r\n\r\n void RE_Direct_BlinnPhong( const in DirectionalLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight, float penumbra ) {\r\n\r\n float dotNL = saturate( dot( geometry.normal, directLight.direction ));\r\n #ifdef TOON_SHADING\r\n if(dotNL < MEDIUM_TOON_RANGE){\r\n dotNL = LOW_TOON_BORDER;\r\n }\r\n else if(dotNL < HIGH_TOON_RANGE){\r\n dotNL = MEDIUM_TOON_BORDER;\r\n }\r\n else{\r\n dotNL = HIGH_TOON_BORDER;\r\n }\r\n #endif\r\n\r\n vec3 irradiance = dotNL * directLight.color * PI;\r\n reflectedLight.directDiffuse += penumbra * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n reflectedLight.directSpecular += penumbra * irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess );\r\n }\r\n\r\n void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\r\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n }\r\n\r\n vec3 calcLighting(const in GeometricContext geometry, const in BlinnPhongMaterial material, vec3 vViewPosition) {\r\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\r\n vec3 irradiance = ambientLightColor * PI;\r\n\r\n float shadowMask = 1.0;\r\n // see THREE.WebGLProgram.unrollLoops\r\n \t#pragma unroll_loop\r\n \t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n \t #ifdef SHADOWMAP\r\n \t if ( directionalLights[ i ].shadow > 0 ) shadowMask = getShadow( directionalShadowMap[ i ], directionalLights[ i ], vDirectionalShadowCoord[ i ], vViewPosition, vDirectionalShadowNormal[ i ] );\r\n \t #endif\r\n\r\n \t\t if ( shadowMask > 0.0 ) RE_Direct_BlinnPhong( directionalLights[ i ], geometry, material, reflectedLight, shadowMask );\r\n \t\t}\r\n\r\n RE_IndirectDiffuse_BlinnPhong(irradiance, material, reflectedLight);\r\n\r\n return saturate(reflectedLight.indirectDiffuse + reflectedLight.directDiffuse + reflectedLight.directSpecular);\r\n }\r\n#endif\r\n\r\n/////////////////////////////////////////// Dashed Line ///////////////////////////////////////////////\r\n#ifdef DASHED_LINE\r\n uniform float dashedLineSize;\r\n uniform float dashedLinePeriod;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef CLIP_PLANE\r\n if (vViewPosition.z < clipPlaneValue) discard;\r\n#endif\r\n\r\n#ifdef ZCLIP\r\n if (vViewPosition.z < zClipValue) discard;\r\n#endif\r\n\r\n vec4 pixelPosWorld = vec4(vWorldPosition, 1.0);\r\n vec4 pixelPosEye;\r\n\r\n#ifdef SPHERE_SPRITE\r\n\r\n vec3 viewNormalSprites;\r\n vec3 normal;\r\n\r\n/* quick-and-dirty method\r\n normal.xy = ' + INSTANCED_SPRITE_OVERSCALE + ' * (2.0 * vUv - 1.0);\r\n float r2 = dot(normal.xy, normal.xy);\r\n if (r2 > 1.0) discard;\r\n float normalZ = sqrt(1.0 - r2);\r\n normal.z = normalZ;\r\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\r\n pixelPosEye = vec4(spritePosEye.xyz, 1.0);\r\n pixelPosEye.z += spritePosEye.w * normalZ;\r\n*/\r\n\r\n // ray-trace sphere surface\r\n {\r\n vec3 p;\r\n if (get_sphere_point(-vViewPosition, p) < 0.0) discard;\r\n pixelPosWorld = modelMatrix * vec4(instOffset.xyz + p * instOffset.w, 1.0);\r\n // pixelPosEye = modelViewMatrix * vec4(instOffset.xyz + p * instOffset.w, 1.0);\r\n pixelPosEye = vec4(spritePosEye.xyz, 1.0);\r\n pixelPosEye.z += instOffset.w *\r\n (modelViewMatrix[0][2] * p.x +\r\n modelViewMatrix[1][2] * p.y +\r\n modelViewMatrix[2][2] * p.z);\r\n normal = normalize(normalMatrix * p);\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*p);\r\n #endif\r\n }\r\n\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n vec3 normal;\r\n vec3 viewNormalSprites;\r\n float cylinderY = 0.0;\r\n\r\n // ray-trace cylinder surface\r\n {\r\n vec3 p;\r\n if (get_cylinder_point(-vViewPosition, p) < 0.0) discard;\r\n\r\n cylinderY = 0.5 * (p.y + 1.0);\r\n\r\n vec4 v = vec4(p, 1.0);\r\n v = vec4(dot(v, matVec1), dot(v, matVec2), dot(v, matVec3), 1.0);\r\n pixelPosWorld = modelMatrix * v;\r\n pixelPosEye = modelViewMatrix * v;\r\n\r\n vec3 localNormal = normalize(vec3(p.x, 0.0, p.z));\r\n normal = vec3(\r\n dot(localNormal, matVec1.xyz),\r\n dot(localNormal, matVec2.xyz),\r\n dot(localNormal, matVec3.xyz));\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*normal);\r\n #endif\r\n normal = normalize(normalMatrix * normal);\r\n }\r\n#endif\r\n\r\n #ifdef ATTR_COLOR\r\n vec3 vertexColor = vColor;\r\n #else\r\n vec3 vertexColor = vec3(1.0, 1.0, 1.0);\r\n #endif\r\n\r\n #ifdef ATTR_COLOR2\r\n #ifdef CYLINDER_SPRITE\r\n float colorCoef = cylinderY; // cylinder parameter is calculated from ray-tracing\r\n #else\r\n float colorCoef = vUv.y; // cylinder parameter is interpolated as tex coord\r\n #endif\r\n // choose either color or color2\r\n vertexColor = mix(vColor2, vColor, step(0.5, colorCoef));\r\n #endif\r\n\r\n // negative red component is a special condition\r\n if (vertexColor.x < 0.0) discard;\r\n\r\n #ifdef DASHED_LINE\r\n if ( mod( vLineDistance, dashedLinePeriod ) > dashedLineSize ) discard;\r\n #endif\r\n\r\n // transparency prepass writes only z, so we don't need to calc the color\r\n #ifdef PREPASS_TRANSP\r\n fragColor = vec4(1.0, 1.0, 1.0, 1.0);\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n return;\r\n #endif\r\n\r\n float totalOpacity = opacity;\r\n\r\n #ifdef ATTR_ALPHA_COLOR\r\n totalOpacity *= alphaCol;\r\n #endif\r\n\r\n // discard fully transparent pixels\r\n if (totalOpacity == 0.0) discard;\r\n\r\n #ifdef FAKE_OPACITY\r\n // discard pixels in checker pattern\r\n vec2 dm_coord = floor(gl_FragCoord.xy);\r\n dm_coord = fract(dm_coord * 0.5);\r\n if (totalOpacity < 1.0 && (dm_coord.x < 0.5 ^^ dm_coord.y < 0.5)) discard;\r\n vec4 diffuseColor = vec4(diffuse, 1.0);\r\n #else\r\n vec4 diffuseColor = vec4(diffuse, totalOpacity);\r\n #endif\r\n\r\n float flipNormal;\r\n #if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n flipNormal = 1.0;\r\n #ifdef DOUBLE_SIDED\r\n flipNormal = float( gl_FrontFacing );\r\n #endif\r\n vec3 normal = normalize( vNormal ) * flipNormal;\r\n #endif\r\n\r\n diffuseColor.rgb *= vertexColor;\r\n\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n\r\n #ifdef NORMALS_TO_G_BUFFER\r\n #if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r\n vec3 viewNormaInColor = viewNormalSprites;\r\n float frontFaced = 1.0;\r\n #else\r\n vec3 viewNormaInColor = viewNormal;\r\n float frontFaced = float( gl_FrontFacing );\r\n #endif\r\n // [-1, 1] -> [0, 1]\r\n viewNormaInColor = 0.5 * viewNormaInColor + 0.5;\r\n gl_FragData[1] = vec4(viewNormaInColor, frontFaced);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n GeometricContext geometry = GeometricContext(normal, normalize( vViewPosition ));\r\n BlinnPhongMaterial material = BlinnPhongMaterial(diffuseColor.rgb, specular, shininess);\r\n vec3 outgoingLight = calcLighting(geometry, material, vViewPosition);\r\n #else\r\n vec3 outgoingLight = diffuseColor.rgb;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_DEPTH\r\n float depth = 0.0;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n depth = gl_FragDepthEXT;\r\n #else\r\n depth = gl_FragCoord.z;\r\n #endif\r\n fragColor = packDepthToRGBA(depth);\r\n return;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_POS\r\n fragColor = world2colorMatrix * pixelPosWorld;\r\n #else\r\n #ifdef OVERRIDE_COLOR\r\n fragColor = vec4(fixedColor, diffuseColor.a);\r\n #else\r\n fragColor = vec4(outgoingLight, diffuseColor.a);//vec4(vNormal, 1.0);\r\n #endif\r\n\r\n #ifdef USE_FOG\r\n float viewDistance;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n viewDistance = abs(pixelPosEye.z);\r\n #else\r\n viewDistance = vViewPosition.z;\r\n #endif\r\n float fogFactor = smoothstep( fogNear, fogFar, viewDistance) * fogAlpha;\r\n #ifdef FOG_TRANSPARENT\r\n fragColor.a = fragColor.a * (1.0 - fogFactor);\r\n #else\r\n fragColor.rgb = mix( fragColor.rgb, fogColor, fogFactor );\r\n #endif\r\n #endif\r\n\r\n #endif\r\n}\r\n"; - -var capabilities = { - precision: 'mediump', - - /** - * - * @param {THREE.WebGLRenderer} renderer - */ - init: function init(renderer) { - this.precision = renderer.capabilities.getMaxPrecision('highp'); - } -}; - -var noiseWidth = 4; -var noiseHeight = 4; - -var _noiseData = new Uint8Array([24, 52, 0, 254, 145, 0, 122, 0, 0, 7, 170, 0, 34, 214, 0, 173, 8, 0, 86, 249, 0, 160, 4, 0, 226, 46, 0, 224, 211, 0, 3, 157, 0, 174, 247, 0, 12, 182, 0, 220, 216, 0, 1, 109, 0, 253, 154, 0]); - -var _noiseWrapS = RepeatWrapping; -var _noiseWrapT = RepeatWrapping; -var _noiseMinFilter = NearestFilter; -var _noiseMagFilter = NearestFilter; -var _noiseMapping = UVMapping; -var noiseTexture = new DataTexture(_noiseData, noiseWidth, noiseHeight, RGBFormat, UnsignedByteType, _noiseMapping, _noiseWrapS, _noiseWrapT, _noiseMagFilter, _noiseMinFilter, 1); -noiseTexture.needsUpdate = true; -var noise = { - noiseWidth: noiseWidth, - noiseHeight: noiseHeight, - noiseTexture: noiseTexture -}; - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } -// If you want to change length of _samplesKernel, please, remember change it in Uber.frag too. -// You can easy find places for replace using word:_samplesKernel - -var _samplesKernel = [new Vector2(-0.541978, 0.840393), new Vector2(0.125533, -0.992089), new Vector2(0.374329, 0.927296), new Vector2(-0.105475, 0.994422)]; -var defaultUniforms = UniformsUtils.merge([UniformsLib.fog, UniformsLib.lights, { - // are updated automatically by three.js (see THREE.ShaderLib.common) - diffuse: { - value: new Color(0xeeeeee) - }, - opacity: { - value: 1.0 - }, - specular: { - type: 'c', - value: new Color(0x111111) - }, - shininess: { - type: 'f', - value: 30 - }, - fixedColor: { - type: 'c', - value: new Color(0xffffff) - }, - zOffset: { - type: 'f', - value: 0.0 - }, - zClipValue: { - type: 'f', - value: 0.0 - }, - clipPlaneValue: { - type: 'f', - value: 0.0 - }, - invModelViewMatrix: { - type: '4fv', - value: new Matrix4() - }, - world2colorMatrix: { - type: '4fv', - value: new Matrix4() - }, - dashedLineSize: { - type: 'f', - value: 0.1 - }, - dashedLinePeriod: { - type: 'f', - value: 0.2 - }, - projMatrixInv: { - type: '4fv', - value: new Matrix4() - }, - viewport: { - type: 'v2', - value: new Vector2() - }, - lineWidth: { - type: 'f', - value: 2.0 - }, - // default value must be the same as settings - fogAlpha: { - type: 'f', - value: 1.0 - }, - samplesKernel: { - type: 'v2v', - value: null - }, - noiseTex: { - type: 't', - value: null - }, - noiseTexelSize: { - type: 'v2', - value: null - }, - srcTexelSize: { - type: 'v2', - value: null - } -}]); -var uberOptionNames = ['shininess', 'opacity', 'zOffset', 'diffuse', 'specular', 'fixedColor', 'zClipCoef', 'zClipValue', 'clipPlaneValue', 'world2colorMatrix', 'dashedLineSize', 'dashedLinePeriod', 'projMatrixInv', 'viewport', 'lineWidth', 'fogAlpha', 'samplesKernel', 'noiseTex', 'noiseTexelSize', 'srcTexelSize']; - -function UberMaterial(params) { - RawShaderMaterial.call(this); // add fog - - this.fog = true; // used for instanced geometry - - this.instancedPos = false; - this.instancedMatrix = false; // atoms and links color - - this.attrColor = false; // second link color for cylinders - - this.attrColor2 = false; // - - this.attrAlphaColor = false; // overrides color for all vertices (used in selection) - - this.overrideColor = false; // zsrpites - - this.sphereSprite = false; - this.cylinderSprite = false; // clip Surfs individually - - this.zClip = false; // clip scene with global clip plane - - this.clipPlane = false; // enable fake (chess-like) opacity - - this.fakeOpacity = false; // render only depth, don't take care about the pixel color (used for transparency depth prepass) - - this.prepassTransparancy = false; // used to render pixel positions - - this.colorFromPos = false; // used to render shadowmap - - this.shadowmap = false; // used to describe shadowmap type - - this.shadowmapType = 'random'; // used to render pixel view deph - - this.colorFromDepth = false; // used to render dashed line - - this.dashedLine = false; // mark as transparent - - this.transparent = true; // mark as thick lines - - this.thickLine = false; // makes fog begin transparency (required for transparent background) - - this.fogTransparent = false; // used to render surface normals to G buffer for ssao effect - - this.normalsToGBuffer = false; // used for toon material - - this.toonShading = false; // uber options of "root" materials are inherited from single uber-options object that resides in prototype - - this.uberOptions = Object.create(UberMaterial.prototype.uberOptions); // set default values - - RawShaderMaterial.prototype.setValues.call(this, { - uniforms: UniformsUtils.clone(defaultUniforms), - vertexShader: this.precisionString() + vertexShader, - fragmentShader: this.precisionString() + fragmentShader, - lights: true, - fog: true, - side: DoubleSide - }); - this.setValues(params); -} - -UberMaterial.prototype = Object.create(RawShaderMaterial.prototype); -UberMaterial.prototype.constructor = UberMaterial; - -UberMaterial.prototype.precisionString = function () { - var precision = capabilities.precision; - var str = "precision ".concat(precision, " float;\n") + "precision ".concat(precision, " int;\n\n"); - return str; -}; // properties that convert to uniforms - - -UberMaterial.prototype.uberOptions = { - diffuse: new Color(0xffffff), - // used in phong lighting - specular: new Color(0x111111), - // used in phong lighting - shininess: 30, - // used in phong lighting - opacity: 1, - // set mesh opacity - fixedColor: new Color(0xffffff), - // color to override (see OVERRIDE_COLOR) - zOffset: 0.0, - // used fo zsprites (see SPHERE_SPRITE CYLINDER_SPRITE) - zClipCoef: 2.0, - // use for Surfs clipping (mesh param, isn't used in shader) FIXME move to representation param - zClipValue: 0.0, - // value to clip Surfs in shader (see ZCLIP) - clipPlaneValue: 0.0, - // value to clip scene globally (see CLIPPLANE) - world2colorMatrix: new Matrix4(), - dashedLineSize: 0.1, - dashedLinePeriod: 0.3, - projMatrixInv: new Matrix4(), - viewport: new Vector2(800, 600), - lineWidth: 2.0, - fogAlpha: 1.0, - samplesKernel: _samplesKernel, - noiseTex: noise.noiseTexture, - noiseTexelSize: new Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight), - srcTexelSize: new Vector2(1.0 / 800.0, 1.0 / 600.0), - copy: function copy(source) { - this.diffuse.copy(source.diffuse); - this.specular.copy(source.specular); - this.shininess = source.shininess; - this.opacity = source.opacity; - this.fixedColor.copy(source.fixedColor); - this.zOffset = source.zOffset; - this.zClipCoef = source.zClipCoef; - this.zClipValue = source.zClipValue; - this.clipPlaneValue = source.clipPlaneValue; - this.world2colorMatrix.copy(source.world2colorMatrix); - this.dashedLineSize = source.dashedLineSize; - this.dashedLinePeriod = source.dashedLinePeriod; - this.projMatrixInv = source.projMatrixInv; - this.viewport = source.viewport; - this.lineWidth = source.lineWidth; // used for thick lines only - - this.toonShading = source.toonShading; - this.fogAlpha = source.fogAlpha; - this.samplesKernel = source.samplesKernel; - this.noiseTex = source.noiseTex; - this.noiseTexelSize = source.noiseTexelSize; - this.srcTexelSize = source.srcTexelSize; - } -}; - -UberMaterial.prototype.copy = function (source) { - RawShaderMaterial.prototype.copy.call(this, source); - this.fragmentShader = source.fragmentShader; - this.vertexShader = source.vertexShader; - this.uniforms = UniformsUtils.clone(source.uniforms); - this.defines = _objectSpread({}, source.defines); - this.extensions = source.extensions; - this.fog = source.fog; - this.instancedPos = source.instancedPos; - this.instancedMatrix = source.instancedMatrix; - this.attrColor = source.attrColor; - this.attrColor2 = source.attrColor2; - this.attrAlphaColor = source.attrAlphaColor; - this.overrideColor = source.overrideColor; - this.sphereSprite = source.sphereSprite; - this.cylinderSprite = source.cylinderSprite; - this.zClip = source.zClip; - this.clipPlane = source.clipPlane; - this.fakeOpacity = source.fakeOpacity; - this.colorFromPos = source.colorFromPos; - this.shadowmap = source.shadowmap; - this.shadowmapType = source.shadowmapType; - this.colorFromDepth = source.colorFromDepth; - this.prepassTransparancy = source.prepassTransparancy; - this.dashedLine = source.dashedLine; - this.thickLine = source.thickLine; - this.fogTransparent = source.fogTransparent; - this.normalsToGBuffer = source.normalsToGBuffer; - this.toonShading = source.toonShading; - this.uberOptions.copy(source.uberOptions); - return this; -}; // create copy of this material -// its options are prototyped after this material's options - - -UberMaterial.prototype.createInstance = function () { - var inst = new UberMaterial(); - inst.copy(this); - inst.uberOptions = Object.create(this.uberOptions); - return inst; -}; - -UberMaterial.prototype.setValues = function (values) { - if (typeof values === 'undefined') { - return; - } // set direct values - - - RawShaderMaterial.prototype.setValues.call(this, values); - var defines = {}; - var extensions = {}; - - if (this.fog) { - defines.USE_FOG = 1; - } - - if (this.instancedPos) { - defines.INSTANCED_POS = 1; - } - - if (this.instancedMatrix) { - defines.INSTANCED_MATRIX = 1; - } - - if (this.attrColor) { - defines.ATTR_COLOR = 1; - } - - if (this.attrColor2) { - defines.ATTR_COLOR2 = 1; - } - - if (this.attrAlphaColor) { - defines.ATTR_ALPHA_COLOR = 1; - } - - if (this.overrideColor) { - defines.OVERRIDE_COLOR = 1; - } - - if (this.sphereSprite) { - defines.SPHERE_SPRITE = 1; - extensions.fragDepth = 1; - } - - if (this.cylinderSprite) { - defines.CYLINDER_SPRITE = 1; - extensions.fragDepth = 1; - } - - if (this.zClip) { - defines.ZCLIP = 1; - } - - if (this.clipPlane) { - defines.CLIP_PLANE = 1; - } - - if (this.fakeOpacity) { - defines.FAKE_OPACITY = 1; - } - - if (this.lights) { - defines.USE_LIGHTS = 1; - } - - if (this.colorFromPos) { - defines.COLOR_FROM_POS = 1; - } - - if (this.shadowmap) { - defines.SHADOWMAP = 1; - - if (this.shadowmapType === 'pcf') { - defines.SHADOWMAP_PCF_SHARP = 1; - } else if (this.shadowmapType === 'random') { - defines.SHADOWMAP_PCF_RAND = 1; - } else { - defines.SHADOWMAP_BASIC = 1; - } - } - - if (this.colorFromDepth) { - defines.COLOR_FROM_DEPTH = 1; - } - - if (this.prepassTransparancy) { - defines.PREPASS_TRANSP = 1; - } - - if (this.dashedLine) { - defines.DASHED_LINE = 1; - } - - if (this.thickLine) { - defines.THICK_LINE = 1; - } - - if (this.fogTransparent) { - defines.FOG_TRANSPARENT = 1; - } - - if (this.normalsToGBuffer) { - extensions.drawBuffers = 1; - defines.NORMALS_TO_G_BUFFER = 1; - } - - if (this.toonShading) { - defines.TOON_SHADING = 1; - } // set dependent values - - - this.defines = defines; - this.extensions = extensions; -}; - -UberMaterial.prototype.setUberOptions = function (values) { - if (typeof values === 'undefined') { - return; - } - - for (var key in values) { - if (!values.hasOwnProperty(key)) { - continue; - } - - if (this.uberOptions[key] instanceof Color) { - this.uberOptions[key] = values[key].clone(); - } else { - this.uberOptions[key] = values[key]; - } - } -}; - -UberMaterial.prototype.clone = function (shallow) { - if (!shallow) { - return Material.prototype.clone.call(this); - } - - return this.createInstance(); -}; - -UberMaterial.prototype.updateUniforms = function () { - var self = this; - uberOptionNames.forEach(function (p) { - if (self.uniforms.hasOwnProperty(p)) { - if (self.uberOptions[p] instanceof Color || self.uberOptions[p] instanceof Matrix4) { - self.uniforms[p].value = self.uberOptions[p].clone(); - } else { - self.uniforms[p].value = self.uberOptions[p]; - } - } - }); -}; - -var LAYERS = { - DEFAULT: 0, - VOLUME: 1, - TRANSPARENT: 2, - PREPASS_TRANSPARENT: 3, - VOLUME_BFPLANE: 4, - COLOR_FROM_POSITION: 5, - SHADOWMAP: 6 -}; -var SELECTION_LAYERS = [// These layers, that are used in the selection by ray casting -LAYERS.DEFAULT, LAYERS.TRANSPARENT]; - -Object3D.prototype.resetTransform = function () { - this.position.set(0, 0, 0); - this.quaternion.set(0, 0, 0, 1); - this.scale.set(1, 1, 1); -}; // update world matrix of this object and all its ancestors - - -Object3D.prototype.updateMatrixWorldRecursive = function () { - if (this.parent != null) { - this.parent.updateMatrixWorldRecursive(); - } - - this.updateMatrixWorld(); -}; // add object to parent, saving objects' world transform - - -Object3D.prototype.addSavingWorldTransform = function () { - var _worldMatrixInverse = new Matrix4(); - - return function (object) { - if (object instanceof Object3D) { - _worldMatrixInverse.getInverse(this.matrixWorld); - - _worldMatrixInverse.multiply(object.matrixWorld); - - object.matrix.copy(_worldMatrixInverse); - object.matrix.decompose(object.position, object.quaternion, object.scale); - this.add(object); - } - }; -}(); // render a tiny transparent quad in the center of the screen - - -WebGLRenderer.prototype.renderDummyQuad = function () { - var _material = new MeshBasicMaterial({ - transparent: true, - opacity: 0.0, - depthWrite: false - }); - - var _scene = new Scene(); - - var _quad = new Mesh$5(new PlaneBufferGeometry(0.01, 0.01), _material); - - _scene.add(_quad); - - var _camera = new OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000); - - _camera.position.z = 100; - return function () { - this.render(_scene, _camera); - }; -}(); - -WebGLRenderer.prototype.renderScreenQuad = function () { - var _scene = new Scene(); - - var _quad = new Mesh$5(new PlaneBufferGeometry(1.0, 1.0)); - - _scene.add(_quad); - - var _camera = new OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000); - - _camera.position.z = 100; - return function (material) { - _quad.material = material; - this.render(_scene, _camera); - }; -}(); - -Matrix4.prototype.isIdentity = function () { - var identity = new Matrix4(); - return function () { - return identity.equals(this); - }; -}(); - -Matrix4.prototype.applyToPointsArray = function (array, stride, w) { - if (!array || !stride || stride < 3) { - return array; - } - - w = w || 0; // use point as normal by default - - var e = this.elements; - - for (var i = 0; i < array.length; i += stride) { - var x = array[i]; - var y = array[i + 1]; - var z = array[i + 2]; - var persp = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]); - array[i] = (e[0] * x + e[4] * y + e[8] * z + e[12] * w) * persp; - array[i + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13] * w) * persp; - array[i + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14] * w) * persp; - } - - return array; -}; - -var ScreenQuadMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(ScreenQuadMaterial, _THREE$RawShaderMater); - - function ScreenQuadMaterial(params) { - classCallCheck(this, ScreenQuadMaterial); - - if (params.uniforms === undefined) { - params.uniforms = {}; - } - - params.uniforms.srcTex = { - type: 't', - value: null - }; - params.vertexShader = vertexScreenQuadShader; - params.transparent = false; - params.depthTest = false; - params.depthWrite = false; - return possibleConstructorReturn(this, getPrototypeOf(ScreenQuadMaterial).call(this, params)); - } - - return ScreenQuadMaterial; -}(RawShaderMaterial); - -WebGLRenderer.prototype.renderScreenQuadFromTex = function () { - var _material = new ScreenQuadMaterial({ - uniforms: { - opacity: { - type: 'f', - value: 1.0 - } - }, - fragmentShader: fragmentScreenQuadFromTex, - transparent: true - }); - - return function (srcTex, opacity) { - _material.uniforms.srcTex.value = srcTex; - _material.transparent = opacity < 1.0; - _material.uniforms.opacity.value = opacity; - this.renderScreenQuad(_material); - }; -}(); - -WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion = function () { - var _material = new ScreenQuadMaterial({ - uniforms: { - coef: { - type: 'f', - value: 1.0 - } - }, - fragmentShader: fragmentScreenQuadFromTexWithDistortion - }); - - return function (srcTex, coef) { - _material.uniforms.srcTex.value = srcTex; - _material.uniforms.coef.value = coef; - this.renderScreenQuad(_material); - }; -}(); -/** - * @param {number} angle - Field of view in degrees. - */ - - -PerspectiveCamera.prototype.setMinimalFov = function (angle) { - if (this.aspect >= 1.0) { - this.fov = angle; - } else { - this.fov = Math$1.radToDeg(2 * Math.atan(Math.tan(Math$1.degToRad(angle) * 0.5) / this.aspect)); - } -}; -/** - * @param {THREE.PerspectiveCamera} camera - Base camera for this stereo camera. - * @param {number} angle - Field of view in degrees. - */ - - -StereoCamera.prototype.updateHalfSized = function (camera, angle) { - var originalAspect = camera.aspect; - var originalFov = camera.fov; - camera.aspect = originalAspect / 2.0; - camera.setMinimalFov(angle); - camera.updateProjectionMatrix(); - this.update(camera); - camera.aspect = originalAspect; - camera.fov = originalFov; - camera.updateProjectionMatrix(); -}; -/** - * @param {number} radius - Radius of bounding sphere in angstroms to fit on screen. - * @param {number} angle - Field of view in degrees. - */ - - -PerspectiveCamera.prototype.setDistanceToFit = function (radius, angle) { - this.position.z = radius / Math.sin(0.5 * Math$1.degToRad(angle)); -}; -/** - * @param {RCGroup} gfxObj - All objects on scene. - * @param {THREE.PerspectiveCamera} camera - Camera used for rendering. - * @param {number} clipPlane - Distance to clip plane. - * @param {number} fogFarPlane - Distance to fog far plane. - */ - - -Raycaster.prototype.intersectVisibleObject = function (gfxObj, camera, clipPlane, fogFarPlane) { - var intersects = this.intersectObject(gfxObj, false); - - if (intersects.length === 0) { - return null; - } // find point closest to camera that doesn't get clipped by camera near plane or clipPlane (if it exists) - - - var nearPlane = Math.min(camera.near, clipPlane); - var i; - var p = intersects[0]; - var v = new Vector3(); - - for (i = 0; i < intersects.length; ++i) { - p = intersects[i]; - v.copy(p.point); - v.applyMatrix4(camera.matrixWorldInverse); - - if (v.z <= -nearPlane) { - break; - } - } - - if (i === intersects.length) { - return null; - } // check that selected intersection point is not clipped by camera far plane or occluded by fog (if it exists) - - - var farPlane = Math.min(camera.far, fogFarPlane); - v.copy(p.point); - v.applyMatrix4(camera.matrixWorldInverse); - - if (v.z <= -farPlane) { - return null; - } - - return p; -}; - -Matrix4.prototype.extractScale = function () { - var _v = new Vector3(); - - return function (scale) { - if (scale === undefined) { - logger.debug('extractScale(): new is too expensive operation to do it on-the-fly'); - scale = _v.clone(); - } - - var te = this.elements; - scale.x = _v.set(te[0], te[1], te[2]).length(); - scale.y = _v.set(te[4], te[5], te[6]).length(); - scale.z = _v.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale - - var det = this.determinant(); - - if (det < 0) { - scale.x = -scale.x; - } - - return scale; - }; -}(); - -function _calcCylinderMatrix(posBegin, posEnd, radius) { - var posCenter = posBegin.clone().lerp(posEnd, 0.5); - var matScale = new Matrix4(); - matScale.makeScale(radius, posBegin.distanceTo(posEnd), radius); - var matRotHalf = new Matrix4(); - matRotHalf.makeRotationX(Math.PI / 2); - var matRotLook = new Matrix4(); - var vUp = new Vector3(0, 1, 0); - matRotLook.lookAt(posCenter, posEnd, vUp); - matRotLook.multiply(matRotHalf); - matRotLook.multiply(matScale); - matRotLook.setPosition(posCenter); - return matRotLook; -} - -function _calcChunkMatrix(eye, target, up, rad) { - var matScale = new Matrix4(); - matScale.makeScale(rad.x, rad.y, 0); - var matRotLook = new Matrix4(); - matRotLook.lookAt(eye, target, up); - matRotLook.multiply(matScale); - matRotLook.setPosition(eye); - return matRotLook; -} - -function _forEachMeshInGroup(group, process) { - function processObj(object) { - if (object instanceof Mesh$5) { - process(object); - } - - for (var i = 0, l = object.children.length; i < l; i++) { - processObj(object.children[i]); - } - } - - processObj(group); -} - -function _countMeshTriangles(mesh) { - var geom = mesh.geometry; - - if (geom instanceof InstancedBufferGeometry) { - var attribs = geom.attributes; - - for (var property in attribs) { - if (attribs.hasOwnProperty(property) && attribs[property] instanceof InstancedBufferAttribute) { - var currAttr = attribs[property]; - var indexSize = geom.index ? geom.index.array.length / 3 : 0; - return indexSize * currAttr.array.length / currAttr.itemSize; - } - } - - return 0; - } - - if (geom instanceof BufferGeometry) { - return geom.index ? geom.index.array.length / 3 : 0; - } - - return geom.faces ? geom.faces.length : 0; -} - -function _countTriangles(group) { - var totalCount = 0; - - _forEachMeshInGroup(group, function (mesh) { - totalCount += _countMeshTriangles(mesh); - }); - - return totalCount; -} - -function _groupHasGeometryToRender(group) { - var hasGeoms = false; - group.traverse(function (node) { - if (node.hasOwnProperty('geometry') || node instanceof CSS2DObject) { - hasGeoms = true; - } - }); - return hasGeoms; -} - -function _buildDistorionMesh(widthSegments, heightSegements, coef) { - // solve equation r_u = r_d * (1 + k * r_d^2) - // for r_d using iterations - // takes: r_u^2 - // returns: r_d / r_u factor that can be used to distort point coords - function calcInverseBarrel(r2) { - var epsilon = 1e-5; - var prevR2 = 0.0; - var curR2 = r2; - var dr = 1.0; - - while (Math.abs(curR2 - prevR2) > epsilon) { - dr = 1.0 + coef * curR2; - prevR2 = curR2; - curR2 = r2 / (dr * dr); - } - - return 1.0 / dr; - } - - var geo = new PlaneBufferGeometry(2.0, 2.0, widthSegments, heightSegements); - var pos = geo.getAttribute('position'); - - for (var i = 0; i < pos.count; ++i) { - var x = pos.array[3 * i]; - var y = pos.array[3 * i + 1]; - var c = calcInverseBarrel(x * x + y * y); - pos.setXY(i, c * x, c * y); - } - - return geo; -} - -BufferAttribute.prototype.copyAtList = function (attribute, indexList) { - console.assert(this.itemSize === attribute.itemSize, 'false: BufferAttribute.copyAtList buffers have different item size.'); - var itemSize = this.itemSize; - - for (var i = 0, n = indexList.length; i < n; ++i) { - for (var j = 0; j < itemSize; ++j) { - this.array[i * itemSize + j] = attribute.array[indexList[i] * itemSize + j]; - } - } - - return this; -}; - -function fillArray(array, value, startIndex, endIndex) { - startIndex = typeof startIndex !== 'undefined' ? startIndex : 0; - endIndex = typeof endIndex !== 'undefined' ? endIndex : array.length; - - for (var i = startIndex; i < endIndex; ++i) { - array[i] = value; - } -} -/** @param {THREE.Object3D} object - Parent object. */ - - -function removeChildren(object) { - var children = object.children; - - for (var i = 0, n = children.length; i < n; ++i) { - var child = children[i]; - child.parent = null; - child.dispatchEvent({ - type: 'removed' - }); - } - - object.children = []; -} - -function clearTree(object) { - object.traverse(function (obj) { - if (obj instanceof Mesh$5 || obj instanceof LineSegments || obj instanceof Line) { - obj.geometry.dispose(); - } - }); - removeChildren(object); -} - -function destroyObject(object) { - clearTree(object); - - if (object.parent) { - object.parent.remove(object); - } else { - object.dispatchEvent({ - type: 'removed' - }); - } -} - -function belongToSelectLayers(object) { - for (var i = 0; i < SELECTION_LAYERS.length; i++) { - if ((object.layers.mask >> SELECTION_LAYERS[i] & 1) === 1) { - return true; - } - } - - return false; -} - -function _getMeshesArr(root, meshTypes) { - var meshes = []; - root.traverse(function (object) { - for (var i = 0; i < meshTypes.length; i++) { - if (object instanceof meshTypes[i]) { - meshes[meshes.length] = object; - break; - } - } - }); - return meshes; -} - -function applyTransformsToMeshes(root, mtc) { - var mtcCount = mtc.length; - - if (mtcCount < 1) { - return; - } - - var meshes = _getMeshesArr(root, [Mesh$5, LineSegments, Line]); - - for (var i = 0, n = meshes.length; i < n; ++i) { - var mesh = meshes[i]; - var parent = mesh.parent; - - if (!parent) { - continue; - } - - mesh.applyMatrix(mtc[0]); - - for (var j = 1; j < mtcCount; ++j) { - var newMesh = new mesh.constructor(mesh.geometry, mesh.material); - parent.add(newMesh); - newMesh.applyMatrix(mtc[j]); - } - } -} - -function processTransparentMaterial(root, material) { - if (!(material instanceof UberMaterial)) { - return; - } - - var meshes = _getMeshesArr(root, [Mesh$5, LineSegments]); - - var _loop = function _loop(i, n) { - var mesh = meshes[i]; - var parent = mesh.parent; - - if (!parent) { - return "continue"; - } - - mesh.material.setValues({ - prepassTransparancy: false, - fakeOpacity: false - }); - mesh.material.needsUpdate = true; - mesh.layers.set(LAYERS.TRANSPARENT); // copy of geometry with prepass material - - var prepassMat = mesh.material.createInstance(); - prepassMat.setValues({ - prepassTransparancy: true, - fakeOpacity: false - }); - var prepassMesh = new mesh.constructor(mesh.geometry, prepassMat); - - _.forEach(['transparent', 'colorFromDepth', 'lights', 'shadowmap', 'fog'], function (value) { - prepassMesh.material[value] = false; - }); - - prepassMesh.material.needsUpdate = true; - prepassMesh.applyMatrix(mesh.matrix); - prepassMesh.layers.set(LAYERS.PREPASS_TRANSPARENT); - parent.add(prepassMesh); - }; - - for (var i = 0, n = meshes.length; i < n; ++i) { - var _ret = _loop(i); - - if (_ret === "continue") continue; - } -} - -function processColFromPosMaterial(root, material) { - if (!(material instanceof UberMaterial)) { - return; - } - - var meshes = _getMeshesArr(root, [Mesh$5, LineSegments]); - - var _loop2 = function _loop2(i, n) { - var mesh = meshes[i]; - var parent = mesh.parent; - - if (!parent) { - return "continue"; - } // copy of geometry with colFromPosMat material - - - var colFromPosMat = mesh.material.createInstance(); - colFromPosMat.setValues({ - colorFromPos: true - }); - var colFromPosMesh = new mesh.constructor(mesh.geometry, colFromPosMat); - - _.forEach(['transparent', 'colorFromDepth', 'lights', 'shadowmap', 'fog', 'overrideColor', 'fogTransparent', 'attrColor', 'attrColor2', 'attrAlphaColor', 'fakeOpacity'], function (value) { - colFromPosMesh.material[value] = false; - }); - - colFromPosMesh.material.needsUpdate = true; - colFromPosMesh.applyMatrix(mesh.matrix); - colFromPosMesh.layers.set(LAYERS.COLOR_FROM_POSITION); - parent.add(colFromPosMesh); - }; - - for (var i = 0, n = meshes.length; i < n; ++i) { - var _ret2 = _loop2(i); - - if (_ret2 === "continue") continue; - } -} - -function createShadowmapMaterial(root, material) { - if (!(material instanceof UberMaterial)) { - return; - } - - var meshes = _getMeshesArr(root, [Mesh$5, LineSegments]); - - var _loop3 = function _loop3(i, n) { - var mesh = meshes[i]; - - if (!mesh.receiveShadow && mesh.material.shadowmap) { - // remove shadow from non-receivers - mesh.material.setValues({ - shadowmap: false - }); - } - - if (!mesh.castShadow) { - // skip creating shadowmap meshes for non-casters - return "continue"; - } // create special mesh for shadowmap - - - var parent = mesh.parent; - - if (!parent) { - return "continue"; - } // copy of geometry with shadowmap material - - - var shadowmapMat = mesh.material.createInstance(); - shadowmapMat.setValues({ - colorFromDepth: true - }); - var shadowmapMesh = new mesh.constructor(mesh.geometry, shadowmapMat); - - _.forEach(['lights', 'shadowmap', 'fog'], function (value) { - shadowmapMesh.material[value] = false; - }); - - shadowmapMesh.isShadowmapMesh = true; - shadowmapMesh.material.needsUpdate = true; - shadowmapMesh.applyMatrix(mesh.matrix); - shadowmapMesh.layers.set(LAYERS.SHADOWMAP); - parent.add(shadowmapMesh); - }; - - for (var i = 0, n = meshes.length; i < n; ++i) { - var _ret3 = _loop3(i); - - if (_ret3 === "continue") continue; - } -} - -function removeShadowmapMaterial(root, material) { - if (!(material instanceof UberMaterial)) { - return; - } - - var meshes = _getMeshesArr(root, [Mesh$5, LineSegments]); - - for (var i = 0, n = meshes.length; i < n; ++i) { - var mesh = meshes[i]; - - if (mesh.isShadowmapMesh && mesh.parent) { - mesh.parent.remove(mesh); - } - } -} - -function processObjRenderOrder(root, idMaterial) { - // set renderOrder to 0 for Backdrop and to 1 in other cases to render Backdrop earlier all other materials - var renderOrder = +(idMaterial !== 'BA'); - root.traverse(function (object) { - if (object.isGroup) { - object.renderOrder = renderOrder; - } - }); -} -/** Traverse tree and make visible only needed meshes */ - - -function makeVisibleMeshes(object, checker) { - if (object && object.traverse) { - object.traverse(function (obj) { - if (obj instanceof Mesh$5) { - obj.visible = checker(obj); - } - }); - } -} - -function applySelectionMaterial(geo) { - geo.traverse(function (node) { - if ('material' in node) { - node.material = node.material.clone(true); // using z-offset to magically fix selection rendering artifact (on z-sprites) - - node.material.setValues({ - depthFunc: LessEqualDepth, - overrideColor: true, - fog: false - }); - node.material.setUberOptions({ - fixedColor: new Color(0xFFFF00), - zOffset: -1e-6 - }); - } - }); -} - -function getMiddlePoint(point1, point2, optionalTarget) { - var result = optionalTarget || new Vector3(); - result.set(0, 0, 0); - result.addScaledVector(point1, 0.5); - result.addScaledVector(point2, 0.5); - return result; -} - -var gfxutils = { - calcCylinderMatrix: _calcCylinderMatrix, - calcChunkMatrix: _calcChunkMatrix, - forEachMeshInGroup: _forEachMeshInGroup, - countTriangles: _countTriangles, - groupHasGeometryToRender: _groupHasGeometryToRender, - buildDistorionMesh: _buildDistorionMesh, - RCGroup: RCGroup, - fillArray: fillArray, - clearTree: clearTree, - destroyObject: destroyObject, - belongToSelectLayers: belongToSelectLayers, - applyTransformsToMeshes: applyTransformsToMeshes, - processTransparentMaterial: processTransparentMaterial, - processColFromPosMaterial: processColFromPosMaterial, - createShadowmapMaterial: createShadowmapMaterial, - removeShadowmapMaterial: removeShadowmapMaterial, - processObjRenderOrder: processObjRenderOrder, - makeVisibleMeshes: makeVisibleMeshes, - applySelectionMaterial: applySelectionMaterial, - getMiddlePoint: getMiddlePoint, - LAYERS: LAYERS -}; - -var _defaultBoundaries = { - boundingBox: new Box3(new Vector3(-1, -1, -1), new Vector3(1, 1, 1)), - boundingSphere: new Sphere(new Vector3(0, 0, 0), 1) -}; - -function Visual(name, dataSource) { - gfxutils.RCGroup.call(this); - this.name = name; - this._dataSource = dataSource; -} - -utils.deriveClass(Visual, gfxutils.RCGroup); - -Visual.prototype.release = function () { - if (this.parent) { - this.parent.remove(this); - } -}; - -Visual.prototype.getDataSource = function () { - return this._dataSource; -}; - -Visual.prototype.getBoundaries = function () { - return _defaultBoundaries; -}; - -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { - arr2[i] = arr[i]; - } - - return arr2; - } -} - -var arrayWithoutHoles = _arrayWithoutHoles; - -function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); -} - -var iterableToArray = _iterableToArray; - -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); -} - -var nonIterableSpread = _nonIterableSpread; - -function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); -} - -var toConsumableArray = _toConsumableArray; - -function _ensureArray(x) { - if (x === null || x === undefined || Array.isArray(x)) { - return x; - } - - return [x]; -} -/** An indexed list of objects or classes. */ - - -var EntityList = /*#__PURE__*/function () { - /** - * Create a list of objects. - * The objects can be indexed by one or more properties for the later retrieval. - * - * @param {!Array=} entities A list of objects to automatically register at creation time. - * @param {!Array=} indices A list of property names to use for case-insensitive indexing. - * By default, a single `.id` property is used. - * @see EntityList#register - */ - function EntityList() { - var _this = this; - - var entities = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var indices = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['id']; - - classCallCheck(this, EntityList); - - this._list = []; - this._dict = {}; - this._indices = toConsumableArray(indices); - - this._indices.forEach(function (index) { - _this._dict[index] = {}; - }); - - entities.forEach(function (entity) { - return _this.register(entity); - }); - } - /** - * Add a value to the end of a list. - * The list will contain only one copy of the value. - * - * @param {!Array} list An array. - * @param {*} value A value to add. - * @see EntityList.unregisterFromList - * @see EntityList.registerInDict - */ - - - createClass(EntityList, [{ - key: "register", - - /** - * Add an entity to this list. - * - * @param {!Object} entity An object or a class to register. The object must include all - * properties specified as indices on construction. - * @see EntityList#unregister - */ - value: function register(entity) { - var _this2 = this; - - EntityList.registerInList(this._list, entity); - - this._indices.forEach(function (index) { - EntityList.registerInDict(_this2._dict[index], _ensureArray(entity[index]), entity); - }); - } - /** - * Remove an entity from this list. - * - * @param {!Object} entity An object or a class to unregister. The object may be - * missing from the list but it must include all properties specified as indices - * on construction. - * @see EntityList#register - */ - - }, { - key: "unregister", - value: function unregister(entity) { - var _this3 = this; - - EntityList.unregisterFromList(this._list, entity); - - this._indices.forEach(function (index) { - EntityList.unregisterFromDict(_this3._dict[index], _ensureArray(entity[index]), entity); - }); - } - /** - * An ordered list of all registered entities. - * It is a read-only copy, use {@link EntityList#register} and {@link EntityList#unregister} - * to modify it. - * - * @type {!Array} - */ - - }, { - key: "keys", - - /** - * Retrieve a list of keys for the index. - * - * @param {string=} index One of the indices specified during the list construction. If omitted, - * the first of the indices is used. - * @returns {!Array} An unordered list of keys in the index, i.e. particular property - * values for all registered entities. - */ - value: function keys(index) { - return Object.keys(this._dict[index || this._indices[0]]); - } - /** - * Retrieve an entity by its key. - * - * @param {string} key A case-insensitive property value to look-up. - * @param {string=} index One of the indices specified during the list construction. If omitted, - * the first of the indices is used. - * @returns {Object=} An object registered in the index under the key. If there are multiple - * objects under the same key, the first one is returned. - */ - - }, { - key: "get", - value: function get(key, index) { - var dict = this._dict[index || this._indices[0]]; - - if (dict) { - var values = dict[key && key.toLowerCase()]; - return values && values.length > 0 ? values[0] : undefined; - } - - return undefined; - } - }, { - key: "all", - get: function get() { - return toConsumableArray(this._list); - } - /** - * The first registered entity. - * Use it if you do not care which entity you are referring to. - * - * @type {Object=} - */ - - }, { - key: "first", - get: function get() { - return this._list[0]; - } - }], [{ - key: "registerInList", - value: function registerInList(list, value) { - if (!list.includes(value)) { - list.push(value); - } - } - /** - * Remove a value from a list if it is there. - * - * @param {!Array} list An array. - * @param {*} value A value to remove. - * @see EntityList.registerInList - */ - - }, { - key: "unregisterFromList", - value: function unregisterFromList(list, value) { - var pos = list.indexOf(value); - - if (pos !== -1) { - list.splice(pos, 1); - } - } - /** - * Add a value to a dictionary. - * The value may be stored under multiple different keys (aliases). - * There might be multiples values stored under the same key. - * - * @param {!Object} dict A dictionary. - * @param {!Array} keys An array of keys. - * @param {*} value A value to add. - * @see EntityList.unregisterFromDict - * @see EntityList.registerInList - */ - - }, { - key: "registerInDict", - value: function registerInDict(dict, keys, value) { - keys.forEach(function (key) { - key = key.toLowerCase(); - var list = dict[key] = dict[key] || []; - - if (!list.includes(value)) { - list.push(value); - } - }); - } - /** - * Remove a value from a dictionary. - * The value may be stored under multiple different keys (aliases). - * There might be multiples values stored under the same key. - * - * @param {!Object} dict A dictionary. - * @param {!Array} keys An array of keys. - * @param {*} value A value to add. - * @see EntityList.registerInDict - */ - - }, { - key: "unregisterFromDict", - value: function unregisterFromDict(dict, keys, value) { - keys.forEach(function (key) { - key = key.toLowerCase(); - var list = dict[key]; - - if (list) { - var pos = list.indexOf(value); - - if (pos !== -1) { - list.splice(pos, 1); - } - - if (list.length === 0) { - delete dict[key]; - } - } - }); - } - }]); - - return EntityList; -}(); - -function makeContextDependent(prototype) { - Object.defineProperties(prototype, { - logger: { - get: function get() { - return this.context && this.context.logger ? this.context.logger : logger; - } - }, - settings: { - get: function get() { - return this.context && this.context.settings ? this.context.settings : settings; - } - } - }); -} - -var CollisionSphere = /*#__PURE__*/function () { - function CollisionSphere(position, radius) { - classCallCheck(this, CollisionSphere); - - this._position = position; - this._radius = radius; - } - - createClass(CollisionSphere, [{ - key: "raycast", - value: function raycast(raycaster) { - var sphere = CollisionSphere._sphere; - sphere.set(this._position, this._radius); - var p = new Vector3(); - - if (raycaster.ray.intersectSphere(sphere, p)) { - return { - distance: raycaster.ray.origin.distanceTo(p), - point: p - }; - } - - return null; - } - }]); - - return CollisionSphere; -}(); - -defineProperty(CollisionSphere, "_sphere", new Sphere()); - -var SphereCollisionGeo = function SphereCollisionGeo(base) { - return (/*#__PURE__*/function (_base) { - inherits(_class, _base); - - function _class(count) { - var _getPrototypeOf2; - - var _this; - - classCallCheck(this, _class); - - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - _this = possibleConstructorReturn(this, (_getPrototypeOf2 = getPrototypeOf(_class)).call.apply(_getPrototypeOf2, [this].concat(args))); - _this._objects = new Array(count); - _this.boundingSphere = null; - _this.boundingBox = null; - return _this; - } - - createClass(_class, [{ - key: "setSphere", - value: function setSphere(idx, position, radius) { - this._objects[idx] = new CollisionSphere(position, radius); - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - // TODO raycast with bounding sphere? How to deal with updates? - for (var i = 0, n = this._objects.length; i < n; ++i) { - var inters = this._objects[i].raycast(raycaster); - - if (inters) { - inters.chunkIdx = i; - intersects.push(inters); - } - } - } - }, { - key: "computeBoundingBox", - value: function computeBoundingBox() { - var objects = this._objects; - var boundingBox = this.boundingBox; - - if (boundingBox === null) { - this.boundingBox = boundingBox = new Box3(); - } - - boundingBox.makeEmpty(); - - for (var i = 0, n = objects.length; i < n; ++i) { - boundingBox.expandByPoint(objects[i]._position); - } - } - }, { - key: "computeBoundingSphere", - value: function computeBoundingSphere() { - this.computeBoundingBox(); - var objects = this._objects; - var boundingBox = this.boundingBox; // Build bounding sphere - - var radiusSquared = 0.0; - var center = new Vector3(); - boundingBox.getCenter(center); - - for (var i = 0, n = objects.length; i < n; ++i) { - var pos = objects[i]._position; - var lengthSquared = center.distanceToSquared(pos); - - if (radiusSquared < lengthSquared) { - radiusSquared = lengthSquared; - } - } - - if (this.boundingSphere === null) { - this.boundingSphere = new Sphere(); - } - - this.boundingSphere.set(center, Math.sqrt(radiusSquared)); - } - }]); - - return _class; - }(base) - ); -}; - -var tmpColor = new Color(); -var OFFSET_SIZE = 4; -var COLOR_SIZE = 3; -var copySubArrays$1 = utils.copySubArrays; - -function setArrayXYZ(arr, idx, x, y, z) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; -} - -function setArrayXYZW(arr, idx, x, y, z, w) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; - arr[idx + 3] = w; -} - -var InstancedSpheresGeometry = /*#__PURE__*/function (_SphereCollisionGeo) { - inherits(InstancedSpheresGeometry, _SphereCollisionGeo); - - function InstancedSpheresGeometry(spheresCount, sphereComplexity, useZSprites) { - var _this; - - classCallCheck(this, InstancedSpheresGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(InstancedSpheresGeometry).call(this, spheresCount)); - _this._sphGeometry = useZSprites ? new PlaneBufferGeometry(2, 2, 1, 1) : new SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI); - - _this._init(spheresCount, _this._sphGeometry); - - return _this; - } - - createClass(InstancedSpheresGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, itemPos, itemRad) { - setArrayXYZW(this._offsets, itemIdx * OFFSET_SIZE, itemPos.x, itemPos.y, itemPos.z, itemRad); - this.setSphere(itemIdx, itemPos, itemRad); - } - }, { - key: "setColor", - value: function setColor(itemIdx, colorVal) { - tmpColor.set(colorVal); - setArrayXYZ(this._colors, itemIdx * COLOR_SIZE, tmpColor.r, tmpColor.g, tmpColor.b); - } - }, { - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.getAttribute('offset').needsUpdate = true; - this.getAttribute('color').needsUpdate = true; - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "setOpacity", - value: function setOpacity(chunkIndices, value) { - var alphaArr = this._alpha; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - alphaArr[chunkIndices[i]] = value; - } - - this.getAttribute('alphaColor').needsUpdate = true; - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var instanceCount = chunkIndices.length; - var geom = new InstancedBufferGeometry(); - - this._init.call(geom, instanceCount, this._sphGeometry); - - copySubArrays$1(this._offsets, geom._offsets, chunkIndices, OFFSET_SIZE); - copySubArrays$1(this._colors, geom._colors, chunkIndices, COLOR_SIZE); - geom.boundingSphere = this.boundingSphere; - geom.boundingBox = this.boundingBox; - return [geom]; - } - }, { - key: "_init", - value: function _init(spheresCount, sphereGeo) { - this.copy(sphereGeo); - this._offsets = utils.allocateTyped(Float32Array, spheresCount * OFFSET_SIZE); - this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE); - var alpha = this._alpha = utils.allocateTyped(Float32Array, spheresCount); - - _.fill(alpha, 1.0); - - this.setAttribute('offset', new InstancedBufferAttribute(this._offsets, OFFSET_SIZE, false, 1)); - this.setAttribute('color', new InstancedBufferAttribute(this._colors, COLOR_SIZE, false, 1)); - this.setAttribute('alphaColor', new InstancedBufferAttribute(alpha, 1, false, 1)); - } - }]); - - return InstancedSpheresGeometry; -}(SphereCollisionGeo(InstancedBufferGeometry)); - -/** - * This class adds raycasting interface to indexed - * THREE.BufferGeometry. - * @constructor - */ - -var RaycastableBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) { - inherits(RaycastableBufferGeometry, _THREE$BufferGeometry); - - function RaycastableBufferGeometry() { - classCallCheck(this, RaycastableBufferGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(RaycastableBufferGeometry).apply(this, arguments)); - } - - createClass(RaycastableBufferGeometry, [{ - key: "uvIntersection", - // This method was copied from three.js - value: function uvIntersection(point, p1, p2, p3, uv1, uv2, uv3) { - var barycoord = RaycastableBufferGeometry._barycoord; - Triangle$1.barycoordFromPoint(point, p1, p2, p3, barycoord); - uv1.multiplyScalar(barycoord.x); - uv2.multiplyScalar(barycoord.y); - uv3.multiplyScalar(barycoord.z); - uv1.add(uv2).add(uv3); - return uv1.clone(); - } - }, { - key: "checkIntersection", - value: function checkIntersection(object, raycaster, ray, pA, pB, pC, point) { - var intersect = ray.intersectTriangle(pA, pB, pC, false, point); - - if (intersect === null) { - return null; - } - - return { - point: point.clone() - }; - } - }, { - key: "checkBufferGeometryIntersection", - value: function checkBufferGeometryIntersection(object, raycaster, ray, position, uv, a, b, c) { - var vA = RaycastableBufferGeometry._vA; - var vB = RaycastableBufferGeometry._vB; - var vC = RaycastableBufferGeometry._vC; - var intersectionPoint = RaycastableBufferGeometry._intersectionPoint; - vA.fromBufferAttribute(position, a); - vB.fromBufferAttribute(position, b); - vC.fromBufferAttribute(position, c); - var intersection = this.checkIntersection(object, raycaster, ray, vA, vB, vC, intersectionPoint); - - if (intersection) { - if (uv) { - var uvA = RaycastableBufferGeometry._uvA; - var uvB = RaycastableBufferGeometry._uvB; - var uvC = RaycastableBufferGeometry._uvC; - uvA.fromBufferAttribute(uv, a); - uvB.fromBufferAttribute(uv, b); - uvC.fromBufferAttribute(uv, c); - intersection.uv = this.uvIntersection(intersectionPoint, vA, vB, vC, uvA, uvB, uvC); - } - - var normal = new Vector3(); - Triangle$1.getNormal(vA, vB, vC, normal); - intersection.face = new Face3(a, b, c, normal); - intersection.faceIndex = a; - } - - return intersection; - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var ray = raycaster.ray; - - if (this.boundingSphere === null) { - this.computeBoundingSphere(); - } - - if (raycaster.ray.intersectsSphere(this.boundingSphere) === false) { - return; - } - - if (this.boundingBox !== null) { - if (ray.intersectsBox(this.boundingBox) === false) { - return; - } - } - - var a; - var b; - var c; - var index = this.index, - _this$attributes = this.attributes, - position = _this$attributes.position, - uv = _this$attributes.uv; - - if (index === null) { - return; - } // indexed buffer geometry - - - for (var i = 0, l = index.count; i < l; i += 3) { - a = index.getX(i); - b = index.getX(i + 1); - c = index.getX(i + 2); - var intersection = this.checkBufferGeometryIntersection(this, raycaster, ray, position, uv, a, b, c); - - if (intersection) { - intersection.faceIndex = Math.floor(i / 3); // triangle number in indices buffer semantics - - intersects.push(intersection); - } - } - } - }]); - - return RaycastableBufferGeometry; -}(BufferGeometry); - -defineProperty(RaycastableBufferGeometry, "_vA", new Vector3()); - -defineProperty(RaycastableBufferGeometry, "_vB", new Vector3()); - -defineProperty(RaycastableBufferGeometry, "_vC", new Vector3()); - -defineProperty(RaycastableBufferGeometry, "_uvA", new Vector2()); - -defineProperty(RaycastableBufferGeometry, "_uvB", new Vector2()); - -defineProperty(RaycastableBufferGeometry, "_uvC", new Vector2()); - -defineProperty(RaycastableBufferGeometry, "_barycoord", new Vector3()); - -defineProperty(RaycastableBufferGeometry, "_intersectionPoint", new Vector3()); - -var MAX_IDC_16BIT = 65535; -var VEC_SIZE = 3; -var tmpColor$1 = new Color(); -/** - * This class represents geometry which consists of separate chunks. - * Each chunk has same index and similar geometry with equal points and faces count. - * Each chunk has by default only one color. - * @constructor - */ - -var ChunkedObjectsGeometry = /*#__PURE__*/function (_RaycastableBufferGeo) { - inherits(ChunkedObjectsGeometry, _RaycastableBufferGeo); - - function ChunkedObjectsGeometry(chunkGeo, chunksCount) { - var _this; - - classCallCheck(this, ChunkedObjectsGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(ChunkedObjectsGeometry).call(this)); - - if (_this.constructor === ChunkedObjectsGeometry) { - throw new Error('Can not instantiate abstract class!'); - } - - _this._chunkGeo = chunkGeo; - - _this._init(chunkGeo, chunksCount); - - return _this; - } - - createClass(ChunkedObjectsGeometry, [{ - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.getAttribute('position').needsUpdate = true; - this.getAttribute('normal').needsUpdate = true; - this.getAttribute('color').needsUpdate = true; - } - }, { - key: "setColor", - value: function setColor(chunkIdx, colorVal) { - tmpColor$1.set(colorVal); - var colors = this._colors; - var chunkSize = this._chunkSize; - - for (var i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) { - var idx = i * VEC_SIZE; - colors[idx] = tmpColor$1.r; - colors[idx + 1] = tmpColor$1.g; - colors[idx + 2] = tmpColor$1.b; - } - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "setOpacity", - value: function setOpacity(chunkIndices, value) { - var alphaArr = this._alpha; - var chunkSize = this._chunkSize; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var left = chunkIndices[i] * chunkSize; - - _.fill(alphaArr, value, left, left + chunkSize); - } - - this.getAttribute('alphaColor').needsUpdate = true; - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var inters = []; - - get(getPrototypeOf(ChunkedObjectsGeometry.prototype), "raycast", this).call(this, raycaster, inters); - - var facesPerChunk = this._chunkGeo.index.count / 3; - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('faceIndex')) { - continue; - } - - inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk); - intersects.push(inters[i]); - } - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var instanceCount = chunkIndices.length; - var geom = new BufferGeometry(); - - this._init.call(geom, this._chunkGeo, instanceCount); - - var srcPos = this._positions; - var srcNorm = this._normals; - var srcColor = this._colors; - var dstPos = geom._positions; - var dstNorm = geom._normals; - var dstColor = geom._colors; - var chunkSize = this._chunkSize * VEC_SIZE; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var dstPtOffset = i * chunkSize; - var ptIdxBegin = chunkIndices[i] * chunkSize; - var ptIdxEnd = ptIdxBegin + chunkSize; - dstPos.set(srcPos.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); - dstNorm.set(srcNorm.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); - dstColor.set(srcColor.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); - } - - geom.boundingSphere = this.boundingSphere; - geom.boundingBox = this.boundingBox; - return [geom]; - } - }, { - key: "_init", - value: function _init(chunkGeo, chunksCount) { - var chunkSize = this._chunkSize = chunkGeo.attributes.position.count; - var chunkIndex = chunkGeo.index.array; - var chunkIndexSize = chunkIndex.length; - var pointsCount = this._chunkSize * chunksCount; - var use32bitIndex = pointsCount > MAX_IDC_16BIT; - var indexSize = chunkIndexSize * chunksCount; - var index = this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, indexSize); - this._positions = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); - this._normals = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); - this._colors = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); - var alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount); - - _.fill(alpha, 1.0); - - for (var i = 0; i < chunksCount; ++i) { - var offset = i * chunkIndexSize; - var posOffset = i * chunkSize; - index.set(chunkIndex, offset); - - for (var j = 0; j < chunkIndexSize; ++j) { - index[offset + j] += posOffset; - } - } - - this.setIndex(new BufferAttribute(this._index, 1)); - this.setAttribute('position', new BufferAttribute(this._positions, VEC_SIZE)); - this.setAttribute('normal', new BufferAttribute(this._normals, VEC_SIZE)); - this.setAttribute('color', new BufferAttribute(this._colors, VEC_SIZE)); - this.setAttribute('alphaColor', new BufferAttribute(alpha, 1)); - } - }]); - - return ChunkedObjectsGeometry; -}(RaycastableBufferGeometry); - -var VEC_SIZE$1 = 3; - -var SimpleSpheresGeometry = /*#__PURE__*/function (_SphereCollisionGeo) { - inherits(SimpleSpheresGeometry, _SphereCollisionGeo); - - function SimpleSpheresGeometry(spheresCount, sphereComplexity) { - var _this; - - classCallCheck(this, SimpleSpheresGeometry); - - var sphGeometry = new SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI); - _this = possibleConstructorReturn(this, getPrototypeOf(SimpleSpheresGeometry).call(this, spheresCount, sphGeometry, spheresCount)); - var normals = _this._normals; - var geoNormals = sphGeometry.attributes.normal.array; - var chunkSize = _this._chunkSize; - _this._chunkPos = _this._chunkGeo.attributes.position.array; - _this._tmpPositions = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE$1); - - for (var i = 0; i < spheresCount; ++i) { - normals.set(geoNormals, chunkSize * VEC_SIZE$1 * i); - } - - return _this; - } - - createClass(SimpleSpheresGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, itemPos, itemRad) { - var tmpPos = this._tmpPositions; - var chunkSize = this._chunkSize; - var geoPos = this._chunkPos; - - for (var i = 0; i < chunkSize; ++i) { - var idx = i * 3; - tmpPos[idx] = itemPos.x + geoPos[idx] * itemRad; - tmpPos[idx + 1] = itemPos.y + geoPos[idx + 1] * itemRad; - tmpPos[idx + 2] = itemPos.z + geoPos[idx + 2] * itemRad; - } - - this._positions.set(tmpPos, chunkSize * itemIdx * VEC_SIZE$1); - - this.setSphere(itemIdx, itemPos, itemRad); - } - }]); - - return SimpleSpheresGeometry; -}(SphereCollisionGeo(ChunkedObjectsGeometry)); - -var VEC_SIZE$2 = 3; -var centerPos = new Vector3(); -var tmpVector = new Vector3(); -var normMtx = new Matrix3(); - -var Simple2CCylindersGeometry = /*#__PURE__*/function (_ChunkedObjectsGeomet) { - inherits(Simple2CCylindersGeometry, _ChunkedObjectsGeomet); - - function Simple2CCylindersGeometry(instanceCount, polyComplexity) { - var _this; - - classCallCheck(this, Simple2CCylindersGeometry); - - var cylGeometry = new CylinderBufferGeometry$1(1, 1, 1.0, Math.max(3, polyComplexity), 2, true); - _this = possibleConstructorReturn(this, getPrototypeOf(Simple2CCylindersGeometry).call(this, cylGeometry, 2 * instanceCount)); - var chunkSize = _this._chunkSize; - _this._chunkPos = _this._chunkGeo.attributes.position.array; - _this._chunkNorms = _this._chunkGeo.attributes.normal.array; - _this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE$2); - return _this; - } - - createClass(Simple2CCylindersGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, botPos, topPos, itemRad) { - var chunkSize = this._chunkSize; - var firstOffset = chunkSize * 2 * itemIdx * VEC_SIZE$2; - var secondOffset = firstOffset + chunkSize * VEC_SIZE$2; - var tmpArray = this._tmpVector; - var geoPos = this._chunkPos; - var geoNorm = this._chunkNorms; - centerPos.lerpVectors(botPos, topPos, 0.5); - var mtx1 = gfxutils.calcCylinderMatrix(botPos, centerPos, itemRad); - normMtx.getNormalMatrix(mtx1); - var idx; - - for (var i = 0; i < chunkSize; ++i) { - idx = i * VEC_SIZE$2; - tmpVector.fromArray(geoPos, idx); - tmpVector.applyMatrix4(mtx1); - tmpVector.toArray(tmpArray, idx); - } - - this._positions.set(tmpArray, firstOffset); // now shift center to get another part of the cylinder - - - centerPos.sub(botPos); - - for (var _i = 0; _i < chunkSize; ++_i) { - idx = _i * VEC_SIZE$2; - tmpArray[idx] += centerPos.x; - tmpArray[idx + 1] += centerPos.y; - tmpArray[idx + 2] += centerPos.z; - } - - this._positions.set(tmpArray, secondOffset); - - for (var _i2 = 0; _i2 < chunkSize; ++_i2) { - idx = _i2 * VEC_SIZE$2; - tmpVector.fromArray(geoNorm, idx); - tmpVector.applyMatrix3(normMtx); - tmpVector.toArray(tmpArray, idx); - } - - this._normals.set(tmpArray, firstOffset); - - this._normals.set(tmpArray, secondOffset); - } - }, { - key: "setColor", - value: function setColor(itemIdx, colorVal1, colorVal2) { - var first = 2 * itemIdx; - - get(getPrototypeOf(Simple2CCylindersGeometry.prototype), "setColor", this).call(this, first, colorVal1); - - var second = first + 1; - - get(getPrototypeOf(Simple2CCylindersGeometry.prototype), "setColor", this).call(this, second, colorVal2); - } - }]); - - return Simple2CCylindersGeometry; -}(ChunkedObjectsGeometry); - -var MAX_POINTS_COUNT_16BIT = 65536; -var PTS_PER_TRIANGLE = 3; - -var CylinderBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) { - inherits(CylinderBufferGeometry, _THREE$BufferGeometry); - - function CylinderBufferGeometry(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded) { - var _this; - - classCallCheck(this, CylinderBufferGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(CylinderBufferGeometry).call(this)); - var thetaStart = 0; - var thetaLength = 2 * Math.PI; - _this.type = 'CylinderBufferGeometry'; - _this.parameters = { - radiusTop: radiusTop, - radiusBottom: radiusBottom, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded - }; - var hasTop = openEnded === false && radiusTop > 0; - var hasBottom = openEnded === false && radiusBottom > 0; - var vertexCount = (heightSegments + 1) * radialSegments + hasTop * (radialSegments + 1) + hasBottom * (radialSegments + 1); - var facesCount = (2 * heightSegments + hasTop + hasBottom) * radialSegments; - var heightHalf = height / 2; - /* eslint-disable no-magic-numbers */ - - var positions = new BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3); - var normals = new BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3); - var indices = new Uint16BufferAttribute(utils.allocateTyped(Uint16Array, facesCount * PTS_PER_TRIANGLE), 1); - /* eslint-enable no-magic-numbers */ - - var uvs = new BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 2), 2); - console.assert(vertexCount < MAX_POINTS_COUNT_16BIT, 'false: Cylinder Geometry has too many vertices (65536 max).'); - var currVtxIdx = 0; - var currFaceIdx = 0; - var tanTheta = -(radiusBottom - radiusTop) / height; // setup cylinder data - - for (var y = 0; y <= heightSegments; y++) { - // faces - if (y !== heightSegments) { - for (var i = 0; i < radialSegments; i++) { - var v1 = currVtxIdx + i; - var v2 = currVtxIdx + radialSegments + i; - var v3 = currVtxIdx + radialSegments + (i + 1) % radialSegments; - var v4 = currVtxIdx + (i + 1) % radialSegments; - indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v1, v4, v2); - currFaceIdx++; - indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v2, v4, v3); - currFaceIdx++; - } - } // vertices - - - var v = y / heightSegments; - var radius = v * (radiusBottom - radiusTop) + radiusTop; - - for (var x = 0; x < radialSegments; x++) { - var u = x / radialSegments; - var vx = radius * Math.sin(u * thetaLength + thetaStart); - var vy = v * height - heightHalf; - var vz = radius * Math.cos(u * thetaLength + thetaStart); - var normal = new Vector3(vx, Math.sqrt(vx * vx + vz * vz) * tanTheta, vz).normalize(); - positions.setXYZ(currVtxIdx, vx, vy, vz); - normals.setXYZ(currVtxIdx, normal.x, normal.y, normal.z); - uvs.setXY(currVtxIdx, u, v); - ++currVtxIdx; - } - } // top cap - - - if (hasTop) { - var startTIdx = currVtxIdx; - var lastIdx = currVtxIdx + radialSegments; - - for (var fTIdx = 0; fTIdx < radialSegments; ++fTIdx) { - var currSrcIdx = currVtxIdx - radialSegments; - positions.setXYZ(currVtxIdx, positions.getX(currSrcIdx), positions.getY(currSrcIdx), positions.getZ(currSrcIdx)); - normals.setXYZ(currVtxIdx, 0, 1, 0); - uvs.setXY(currVtxIdx, 1, 1); - var nextTVtx = startTIdx + (fTIdx + 1) % radialSegments; - indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, currVtxIdx, nextTVtx, lastIdx); - currFaceIdx++; - currVtxIdx++; - } - - positions.setXYZ(currVtxIdx, 0, heightHalf, 0); - normals.setXYZ(currVtxIdx, 0, 1, 0); - uvs.setXY(currVtxIdx, 1, 1); - ++currVtxIdx; - } // bottom cap - - - if (hasBottom) { - var startBIdx = currVtxIdx; - var lastBIdx = currVtxIdx + radialSegments; - - for (var fBIdx = 0; fBIdx < radialSegments; ++fBIdx) { - var currSrcBIdx = fBIdx; - positions.setXYZ(currVtxIdx, positions.getX(currSrcBIdx), positions.getY(currSrcBIdx), positions.getZ(currSrcBIdx)); - normals.setXYZ(currVtxIdx, 0, -1, 0); - uvs.setXY(currVtxIdx, 0, 0); - var nextBVtx = startBIdx + (fBIdx + 1) % radialSegments; - indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, nextBVtx, currVtxIdx, lastBIdx); - currFaceIdx++; - currVtxIdx++; - } - - positions.setXYZ(currVtxIdx, 0, -heightHalf, 0); - normals.setXYZ(currVtxIdx, 0, -1, 0); - uvs.setXY(currVtxIdx, 0, 0); - } - - _this.setIndex(indices); - - _this.setAttribute('position', positions); - - _this.setAttribute('normal', normals); - - _this.setAttribute('uv', uvs); - - return _this; - } - - createClass(CylinderBufferGeometry, [{ - key: "clone", - value: function clone() { - var parameters = this.parameters; - return new CylinderBufferGeometry(parameters.radiusTop, parameters.radiusBottom, parameters.height, parameters.radialSegments, parameters.heightSegments, parameters.openEnded); - } - }]); - - return CylinderBufferGeometry; -}(BufferGeometry); - -var tmpColor$2 = new Color(); -var invMatrix = new Matrix4(); -var OFFSET_SIZE$1 = 4; -var COLOR_SIZE$1 = 3; -var copySubArrays$2 = utils.copySubArrays; - -function setArrayXYZ$1(arr, idx, x, y, z) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; -} - -function setArrayXYZW$1(arr, idx, x, y, z, w) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; - arr[idx + 3] = w; -} - -function sortNumber(a, b) { - return a - b; -} - -function _prepareCylinderInfo(chunkIndices) { - chunkIndices.sort(sortNumber); - var chunksIdx = []; - var cylinderInfo = []; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var val = chunkIndices[i]; - var even = (val | 0) % 2 === 0; - var newPar = { - first: false, - second: false - }; - - if (even) { - newPar.first = true; - newPar.second = i + 1 < n && chunkIndices[i + 1] === chunkIndices[i] + 1; - - if (newPar.second) { - ++i; - } - } else { - newPar.second = true; - } - - chunksIdx.push(Math.floor(val / 2)); - cylinderInfo.push(newPar); - } - - return { - indices: chunksIdx, - cylinderInfo: cylinderInfo - }; -} - -function _assignOpacity(cylinderInfo, color1, color2) { - for (var i = 0, n = cylinderInfo.length; i < n; ++i) { - var info = cylinderInfo[i]; - - if (!info.first) { - color1[COLOR_SIZE$1 * i] = -0.5; - } - - if (!info.second) { - color2[COLOR_SIZE$1 * i] = -0.5; - } - } -} - -var Instanced2CCylindersGeometry = /*#__PURE__*/function (_THREE$InstancedBuffe) { - inherits(Instanced2CCylindersGeometry, _THREE$InstancedBuffe); - - function Instanced2CCylindersGeometry(instanceCount, polyComplexity, useZSprites, openEnded) { - var _this; - - classCallCheck(this, Instanced2CCylindersGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(Instanced2CCylindersGeometry).call(this)); - _this._useZSprites = useZSprites; - _this._cylGeometry = useZSprites ? new PlaneBufferGeometry(2, 2, 1, 1) : new CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, openEnded); - - _this._init(instanceCount, _this._cylGeometry, _this._useZSprites); - - _this._collisionGeo = new Simple2CCylindersGeometry(instanceCount, 3); - return _this; - } - - createClass(Instanced2CCylindersGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, botPos, topPos, itemRad) { - var matrix = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad); - var me = matrix.elements; - var mtxOffset = itemIdx * OFFSET_SIZE$1; - - this._collisionGeo.setItem(itemIdx, botPos, topPos, itemRad); - - setArrayXYZW$1(this._matVector1, mtxOffset, me[0], me[4], me[8], me[12]); - setArrayXYZW$1(this._matVector2, mtxOffset, me[1], me[5], me[9], me[13]); - setArrayXYZW$1(this._matVector3, mtxOffset, me[2], me[6], me[10], me[14]); - - if (this._useZSprites) { - invMatrix.getInverse(matrix); - me = invMatrix.elements; - setArrayXYZW$1(this._invmatVector1, mtxOffset, me[0], me[4], me[8], me[12]); - setArrayXYZW$1(this._invmatVector2, mtxOffset, me[1], me[5], me[9], me[13]); - setArrayXYZW$1(this._invmatVector3, mtxOffset, me[2], me[6], me[10], me[14]); - } - } - }, { - key: "setColor", - value: function setColor(itemIdx, colorVal1, colorVal2) { - var colorIdx = itemIdx * COLOR_SIZE$1; - tmpColor$2.set(colorVal1); - setArrayXYZ$1(this._color1, colorIdx, tmpColor$2.r, tmpColor$2.g, tmpColor$2.b); - tmpColor$2.set(colorVal2); - setArrayXYZ$1(this._color2, colorIdx, tmpColor$2.r, tmpColor$2.g, tmpColor$2.b); - } - }, { - key: "computeBoundingSphere", - value: function computeBoundingSphere() { - this._collisionGeo.computeBoundingSphere(); - - this.boundingSphere = this._collisionGeo.boundingSphere; - } - }, { - key: "computeBoundingBox", - value: function computeBoundingBox() { - this._collisionGeo.computeBoundingBox(); - - this.boundingBox = this._collisionGeo.boundingBox; - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - this._collisionGeo.raycast(raycaster, intersects); - } - }, { - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.getAttribute('matVector1').needsUpdate = true; - this.getAttribute('matVector2').needsUpdate = true; - this.getAttribute('matVector3').needsUpdate = true; - this.getAttribute('color').needsUpdate = true; - this.getAttribute('color2').needsUpdate = true; - this.getAttribute('alphaColor').needsUpdate = true; - - if (this._useZSprites) { - this.getAttribute('invmatVector1').needsUpdate = true; - this.getAttribute('invmatVector2').needsUpdate = true; - this.getAttribute('invmatVector3').needsUpdate = true; - } - - this._collisionGeo.finishUpdate(); - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "setOpacity", - value: function setOpacity(chunkIndices, value) { - var alphaArr = this._alpha; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - alphaArr[Math.floor(chunkIndices[i] / 2)] = value; - } - - this.getAttribute('alphaColor').needsUpdate = true; - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var info = _prepareCylinderInfo(chunkIndices); - - var cylinderIndices = info.indices; - var instanceCount = cylinderIndices.length; - var geom = new InstancedBufferGeometry(); - - this._init.call(geom, instanceCount, this._cylGeometry, this._useZSprites); - - copySubArrays$2(this._matVector1, geom._matVector1, cylinderIndices, OFFSET_SIZE$1); - copySubArrays$2(this._matVector2, geom._matVector2, cylinderIndices, OFFSET_SIZE$1); - copySubArrays$2(this._matVector3, geom._matVector3, cylinderIndices, OFFSET_SIZE$1); - - if (this._useZSprites) { - copySubArrays$2(this._invmatVector1, geom._invmatVector1, cylinderIndices, OFFSET_SIZE$1); - copySubArrays$2(this._invmatVector2, geom._invmatVector2, cylinderIndices, OFFSET_SIZE$1); - copySubArrays$2(this._invmatVector3, geom._invmatVector3, cylinderIndices, OFFSET_SIZE$1); - } - - copySubArrays$2(this._color1, geom._color1, cylinderIndices, COLOR_SIZE$1); - copySubArrays$2(this._color2, geom._color2, cylinderIndices, COLOR_SIZE$1); - - _assignOpacity(info.cylinderInfo, geom._color1, geom._color2); - - geom.boundingSphere = this.boundingSphere; - geom.boundingBox = this.boundingBox; - return [geom]; - } - }, { - key: "getGeoParams", - value: function getGeoParams() { - return this._cylGeometry.parameters; - } - }, { - key: "_init", - value: function _init(instanceCount, cylinderGeo, useZSprites) { - this.copy(cylinderGeo); - this._matVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._matVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._matVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._color1 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE$1); - this._color2 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE$1); - var alpha = this._alpha = utils.allocateTyped(Float32Array, instanceCount); - - _.fill(alpha, 1.0); - - this.setAttribute('matVector1', new InstancedBufferAttribute(this._matVector1, OFFSET_SIZE$1, false, 1)); - this.setAttribute('matVector2', new InstancedBufferAttribute(this._matVector2, OFFSET_SIZE$1, false, 1)); - this.setAttribute('matVector3', new InstancedBufferAttribute(this._matVector3, OFFSET_SIZE$1, false, 1)); - this.setAttribute('color', new InstancedBufferAttribute(this._color1, COLOR_SIZE$1, false, 1)); - this.setAttribute('color2', new InstancedBufferAttribute(this._color2, COLOR_SIZE$1, false, 1)); - this.setAttribute('alphaColor', new InstancedBufferAttribute(this._alpha, 1, false, 1)); - - if (useZSprites) { - this._invmatVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._invmatVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this._invmatVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE$1); - this.setAttribute('invmatVector1', new InstancedBufferAttribute(this._invmatVector1, OFFSET_SIZE$1, false, 1)); - this.setAttribute('invmatVector2', new InstancedBufferAttribute(this._invmatVector2, OFFSET_SIZE$1, false, 1)); - this.setAttribute('invmatVector3', new InstancedBufferAttribute(this._invmatVector3, OFFSET_SIZE$1, false, 1)); - } - } - }]); - - return Instanced2CCylindersGeometry; -}(InstancedBufferGeometry); - -var VEC_SIZE$3 = 3; -var TRI_SIZE = 3; -var tmpPrev = new Vector3(); -var tmpNext = new Vector3(); -var tmpRes = new Vector3(); -var simpleNormal = new Vector3(1.0, 0.0, 0.0); -var normalOnCut = new Vector3(); -var nearRingPt = new Vector3(); - -function _createExtrudedChunkGeometry(shape, ringsCount) { - var geo = new BufferGeometry(); - var ptsCount = shape.length; - var totalPts = ptsCount * ringsCount; - var type = totalPts <= 65536 ? Uint16Array : Uint32Array; - var facesPerChunk = (ringsCount - 1) * ptsCount * 2; - var indices = new BufferAttribute(utils.allocateTyped(type, facesPerChunk * TRI_SIZE), 1); - var currVtxIdx = 0; - var currFaceIdx = 0; - - for (var y = 0; y < ringsCount; y++) { - // faces - if (y !== ringsCount - 1) { - for (var i = 0; i < ptsCount; i++) { - var v1 = currVtxIdx + i; - var v2 = currVtxIdx + ptsCount + i; - var v3 = currVtxIdx + ptsCount + (i + 1) % ptsCount; - var v4 = currVtxIdx + (i + 1) % ptsCount; - indices.setXYZ(currFaceIdx * TRI_SIZE, v1, v4, v2); - currFaceIdx++; - indices.setXYZ(currFaceIdx * TRI_SIZE, v2, v4, v3); - currFaceIdx++; - } - } - - currVtxIdx += ptsCount; - } - - geo.setIndex(indices); - var pos = utils.allocateTyped(Float32Array, totalPts * VEC_SIZE$3); - geo.setAttribute('position', new BufferAttribute(pos, VEC_SIZE$3)); - geo._positions = shape; - return geo; -} - -var ExtrudedObjectsGeometry = /*#__PURE__*/function (_ChunkedObjectsGeomet) { - inherits(ExtrudedObjectsGeometry, _ChunkedObjectsGeomet); - - function ExtrudedObjectsGeometry(shape, ringsCount, chunksCount) { - var _this; - - classCallCheck(this, ExtrudedObjectsGeometry); - - var chunkGeo = _createExtrudedChunkGeometry(shape, ringsCount); - - _this = possibleConstructorReturn(this, getPrototypeOf(ExtrudedObjectsGeometry).call(this, chunkGeo, chunksCount)); - _this._ringsCount = ringsCount; - var tmpShape = _this._tmpShape = []; - - for (var i = 0; i < shape.length; ++i) { - tmpShape[i] = new Vector3(); - } - - return _this; - } - - createClass(ExtrudedObjectsGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, matrices) { - var hasSlope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var hasCut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var ptsCount = this._chunkGeo._positions.length; - var ringsCount = this._ringsCount; - var chunkStartIdx = ptsCount * this._ringsCount * itemIdx * VEC_SIZE$3; - - this._setPoints(matrices, ptsCount, ringsCount, chunkStartIdx); - - if (hasSlope) { - this._setSlopeNormals(ptsCount, ringsCount, chunkStartIdx); - } else { - this._setBaseNormals(ptsCount, ringsCount, chunkStartIdx); - } - - if (hasCut) { - this._addCut(ptsCount, ringsCount, chunkStartIdx); - } - } - }, { - key: "_setPoints", - value: function _setPoints(matrices, ptsCount, ringsCount, chunkStartIdx) { - var tmpShape = this._tmpShape; - var positions = this._positions; - var shape = this._chunkGeo._positions; - - for (var i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i) { - var mtx = matrices[i]; - - for (var j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE$3) { - tmpShape[j].copy(shape[j]).applyMatrix4(mtx).toArray(positions, vtxIdx); - } - } - } - }, { - key: "_setBaseNormals", - value: function _setBaseNormals(ptsCount, ringsCount, chunkStartIdx) { - var nPtsInRing = ptsCount * VEC_SIZE$3; - - for (var i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i, vtxIdx += nPtsInRing) { - this._countNormalsInRing(ptsCount, vtxIdx, false); - } - } - }, { - key: "_setSlopeNormals", - value: function _setSlopeNormals(ptsCount, ringsCount, chunkStartIdx) { - var normals = this._normals; - var nPtsInRing = ptsCount * VEC_SIZE$3; - var vtxIdx = chunkStartIdx; // First ring - // In all cases, besides cut, second ring is coincident to first. So values of first ring's normals doesn't - // matter (In the cut case special handler will be applied later and will set them to correct values) - - for (var j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE$3) { - simpleNormal.toArray(normals, vtxIdx); - } // second ring - // If it isn't first Item we take normals' values from the last ring of the previous item (these rings are coincident) - // else we count normals' values based on next ring information - - - if (vtxIdx - 2 * nPtsInRing > 0) { - for (var _j = 0; _j < ptsCount; ++_j, vtxIdx += VEC_SIZE$3) { - tmpRes.fromArray(normals, vtxIdx - 2 * nPtsInRing).toArray(normals, vtxIdx); - } - } else { - this._countNormalsInRing(ptsCount, vtxIdx, true, +nPtsInRing); - - vtxIdx += nPtsInRing; - } // other rings - // we count normals' values based on previous ring information - - - for (var i = 2; i < ringsCount; ++i, vtxIdx += nPtsInRing) { - this._countNormalsInRing(ptsCount, vtxIdx, true, -nPtsInRing); - } - } // Counting normals: - // - Slope - // Radius changes throught part => normals aren't parallel with the plane contains section points - // normal = vTangentInSectionPlane x vToSuchPointInPrevSection (all vectors are scaled for being 1 in length) - // - No slope - // Radius doesn't change throught part => normals are parallel with the plane contains section points - // normal = vToPrevPointInSection + vToNextPointInSection (all vectors are scaled for being 1 in length) - - }, { - key: "_countNormalsInRing", - value: function _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) { - var tmpShape = this._tmpShape; - var normals = this._normals; - tmpShape[0].fromArray(this._positions, vtxIdx); - tmpShape[ptsCount - 1].fromArray(this._positions, vtxIdx + (ptsCount - 1) * VEC_SIZE$3); - - for (var j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE$3) { - if (j < ptsCount - 1) { - tmpShape[j + 1].fromArray(this._positions, vtxIdx + VEC_SIZE$3); - } - - if (isSlope) { - nearRingPt.fromArray(this._positions, vtxIdx + shiftToExtraPt); - tmpPrev.subVectors(tmpShape[(j + ptsCount - 1) % ptsCount], tmpShape[(j + 1) % ptsCount]).normalize(); - tmpNext.subVectors(tmpShape[j], nearRingPt).normalize(); - tmpRes.crossVectors(tmpNext, tmpPrev).normalize().toArray(normals, vtxIdx); - } else { - tmpPrev.subVectors(tmpShape[j], tmpShape[(j + ptsCount - 1) % ptsCount]).normalize(); - tmpNext.subVectors(tmpShape[j], tmpShape[(j + 1) % ptsCount]).normalize(); - tmpRes.addVectors(tmpPrev, tmpNext).normalize().toArray(normals, vtxIdx); - } - } - } - }, { - key: "_addCut", - value: function _addCut(ptsCount, ringsCount, chunkStartIdx) { - // Nothing to do if item is flat or only line - if (ptsCount < 3 || ringsCount < 2) { - return; - } - - var positions = this._positions; - var normals = this._normals; - var tmpShape = this._tmpShape; - var nPtsInRing = ptsCount * VEC_SIZE$3; // Normal to the cut plane is equal to cross product of two vectors which are lying in it - - tmpShape[0].fromArray(positions, chunkStartIdx); - tmpShape[1].fromArray(positions, chunkStartIdx + VEC_SIZE$3); - tmpShape[2].fromArray(positions, chunkStartIdx + 2 * VEC_SIZE$3); - tmpPrev.subVectors(tmpShape[1], tmpShape[0]).normalize(); - tmpNext.subVectors(tmpShape[1], tmpShape[2]).normalize(); - normalOnCut.crossVectors(tmpPrev, tmpNext).normalize(); - var vtxIdx = chunkStartIdx; // First and second rings normals' values are equal to value of normal to the cutting plane - - for (var j = 0; j < ptsCount * 2; ++j, vtxIdx += VEC_SIZE$3) { - normalOnCut.toArray(normals, vtxIdx); - } - - if (ringsCount > 2) { - // Third ring points are coincident to first ring points, but have different normals. It makes sharp angle near cut - for (var _j2 = 0; _j2 < ptsCount; ++_j2, vtxIdx += VEC_SIZE$3) { - tmpRes.fromArray(positions, vtxIdx - nPtsInRing).toArray(positions, vtxIdx); - } - } - } - }]); - - return ExtrudedObjectsGeometry; -}(ChunkedObjectsGeometry); - -var MAX_IDC_16BIT$1 = 65535; -var VERTEX_PER_SEGMENT = 4; -var POS_SIZE = 4; -var DIR_SIZE = 3; -var COL_SIZE = 3; -var tmpColor$3 = new Color(); -var direction = new Vector3(); - -function setArrayXYZ$2(arr, idx, x, y, z) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; -} - -function setArrayXYZW$2(arr, idx, x, y, z, w) { - arr[idx] = x; - arr[idx + 1] = y; - arr[idx + 2] = z; - arr[idx + 3] = w; -} - -function getSubset(arr, startSegmentIdx, segmentsCount, elemSize) { - var start = startSegmentIdx * VERTEX_PER_SEGMENT; - var end = start + segmentsCount * VERTEX_PER_SEGMENT; - return arr.subarray(start * elemSize, end * elemSize); -} -/** - * This class represents lines geometry which consists of screen-aligned narrow quad of variable width. - * - * @constructor - * - * @param {number} segmentsCount Number of segments per chunk. - * collision geometry. - */ - - -var ThickLinesGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) { - inherits(ThickLinesGeometry, _THREE$BufferGeometry); - - function ThickLinesGeometry(segmentsCount) { - var _this; - - classCallCheck(this, ThickLinesGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(ThickLinesGeometry).call(this)); - - _this._initVertices(segmentsCount); - - return _this; - } - - createClass(ThickLinesGeometry, [{ - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.getAttribute('position').needsUpdate = true; - this.getAttribute('color').needsUpdate = true; - this.getAttribute('alphaColor').needsUpdate = true; - this.getAttribute('direction').needsUpdate = true; - } - }, { - key: "setColor", - value: function setColor(segmentIdx, colorVal) { - tmpColor$3.set(colorVal); - var idx = segmentIdx * VERTEX_PER_SEGMENT * COL_SIZE; - setArrayXYZ$2(this._colors, idx, tmpColor$3.r, tmpColor$3.g, tmpColor$3.b); - idx += COL_SIZE; - setArrayXYZ$2(this._colors, idx, tmpColor$3.r, tmpColor$3.g, tmpColor$3.b); - idx += COL_SIZE; - setArrayXYZ$2(this._colors, idx, tmpColor$3.r, tmpColor$3.g, tmpColor$3.b); - idx += COL_SIZE; - setArrayXYZ$2(this._colors, idx, tmpColor$3.r, tmpColor$3.g, tmpColor$3.b); - } - }, { - key: "setSegment", - value: function setSegment(segmentIdx, pos1, pos2) { - direction.subVectors(pos1, pos2); - direction.normalize(); - var positions = this._positions; - var directions = this._directions; - var idx = segmentIdx * VERTEX_PER_SEGMENT * POS_SIZE; - var dirIdx = segmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE; - setArrayXYZW$2(positions, idx, pos1.x, pos1.y, pos1.z, 0.5); - setArrayXYZ$2(directions, dirIdx, direction.x, direction.y, direction.z); - idx += POS_SIZE; - dirIdx += DIR_SIZE; - setArrayXYZW$2(positions, idx, pos1.x, pos1.y, pos1.z, -0.5); - setArrayXYZ$2(directions, dirIdx, direction.x, direction.y, direction.z); - idx += POS_SIZE; - dirIdx += DIR_SIZE; - setArrayXYZW$2(positions, idx, pos2.x, pos2.y, pos2.z, 0.5); - setArrayXYZ$2(directions, dirIdx, direction.x, direction.y, direction.z); - idx += POS_SIZE; - dirIdx += DIR_SIZE; - setArrayXYZW$2(positions, idx, pos2.x, pos2.y, pos2.z, -0.5); - setArrayXYZ$2(directions, dirIdx, direction.x, direction.y, direction.z); - } - }, { - key: "setOpacity", - value: function setOpacity(startSegIdx, endSegIdx, value) { - var start = startSegIdx * VERTEX_PER_SEGMENT; - var end = endSegIdx * VERTEX_PER_SEGMENT; - - _.fill(this.alpha, value, end, start); - - this.getAttribute('alphaColor').needsUpdate = true; - } - }, { - key: "getSubsetSegments", - value: function getSubsetSegments(startSegmentIdx, segmentsCount) { - return [getSubset(this._positions, startSegmentIdx, segmentsCount, POS_SIZE), getSubset(this._directions, startSegmentIdx, segmentsCount, DIR_SIZE)]; - } - }, { - key: "getSubsetColors", - value: function getSubsetColors(startSegmentIdx, segmentsCount) { - return getSubset(this._colors, startSegmentIdx, segmentsCount, COL_SIZE); - } - }, { - key: "getSubsetOpacities", - value: function getSubsetOpacities(startSegmentIdx, segmentsCount) { - return getSubset(this._alpha, startSegmentIdx, segmentsCount, 1); - } - }, { - key: "getNumVertexPerSegment", - value: function getNumVertexPerSegment() { - return VERTEX_PER_SEGMENT; - } - }, { - key: "getPositionSize", - value: function getPositionSize() { - return POS_SIZE; - } - }, { - key: "setSegments", - value: function setSegments(startSegmentIdx, positions) { - var startPos = startSegmentIdx * VERTEX_PER_SEGMENT * POS_SIZE; - - if (positions instanceof Array && positions.length === 2) { - this._positions.set(positions[0], startPos); - - var startDir = startSegmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE; - - this._directions.set(positions[1], startDir); // dirs are geo part of vertex - - } else { - this._positions.set(positions, startPos); - } - } - }, { - key: "setColors", - value: function setColors(startSegmentIdx, colors) { - var start = startSegmentIdx * VERTEX_PER_SEGMENT * COL_SIZE; - - this._colors.set(colors, start); - } - }, { - key: "_initVertices", - value: function _initVertices(segmentsCount) { - this._buffersSize = segmentsCount * VERTEX_PER_SEGMENT; - var pointsCount = this._buffersSize; - var use32bitIndex = pointsCount > MAX_IDC_16BIT$1; - this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, segmentsCount * 6); - this._positions = utils.allocateTyped(Float32Array, pointsCount * POS_SIZE); - this._colors = utils.allocateTyped(Float32Array, pointsCount * COL_SIZE); - this._directions = utils.allocateTyped(Float32Array, pointsCount * DIR_SIZE); - var alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount); - - _.fill(alpha, 1.0); - - var index = this._index; - var indexOffset = 0; - var pointOffset = 0; - - for (var j = 0; j < segmentsCount; j++, indexOffset += 6, pointOffset += VERTEX_PER_SEGMENT) { - index[indexOffset] = pointOffset; - index[indexOffset + 1] = pointOffset + 1; - index[indexOffset + 2] = pointOffset + 3; - index[indexOffset + 3] = pointOffset; - index[indexOffset + 4] = pointOffset + 2; - index[indexOffset + 5] = pointOffset + 3; - } - - this.setIndex(new BufferAttribute(this._index, 1)); - this.setAttribute('position', new BufferAttribute(this._positions, POS_SIZE)); - this.setAttribute('color', new BufferAttribute(this._colors, COL_SIZE)); - this.setAttribute('alphaColor', new BufferAttribute(alpha, 1)); - this.setAttribute('direction', new BufferAttribute(this._directions, DIR_SIZE)); - } - }]); - - return ThickLinesGeometry; -}(BufferGeometry); - -/** - * This class represents geometry which consists lines. This can build bounding volumes - * @constructor - * - * @param {number} segmentsCount Number of segments per chunk. - */ - -var LinesGeometry = /*#__PURE__*/function (_BaseLinesGeometry) { - inherits(LinesGeometry, _BaseLinesGeometry); - - function LinesGeometry() { - classCallCheck(this, LinesGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(LinesGeometry).apply(this, arguments)); - } - - createClass(LinesGeometry, [{ - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "computeBoundingSphere", - value: function computeBoundingSphere() { - var boundingBox = this.boundingBox; // Build bounding sphere - - var radiusSquared = 0.0; - var center = new Vector3(); - - if (boundingBox) { - boundingBox.getCenter(center); - } - - var positions = this._positions; - var sphere = this.boundingSphere || new Sphere(); - var size = this._positions.length; - var pos = new Vector3(); - var posSize = this.getPositionSize(); - - for (var i = 0; i < size; i += posSize) { - pos.set(positions[i], positions[i + 1], positions[i + 2]); - var lengthSquared = center.distanceToSquared(pos); - - if (radiusSquared < lengthSquared) { - radiusSquared = lengthSquared; - } - } - - sphere.set(center, Math.sqrt(radiusSquared)); - this.boundingSphere = sphere; - } - }, { - key: "computeBoundingBox", - value: function computeBoundingBox() { - var positions = this._positions; - var box = new Box3(); - var size = this._positions.length; - var tmpVec = new Vector3(); - var posSize = this.getPositionSize(); - - for (var i = 0; i < size; i += posSize) { - tmpVec.set(positions[i], positions[i + 1], positions[i + 2]); - box.expandByPoint(tmpVec); - } - - this.boundingBox = box; - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }]); - - return LinesGeometry; -}(ThickLinesGeometry); - -var VEC_SIZE$4 = 3; -var tmpVector$1 = new Vector3(); -var normMtx$1 = new Matrix3(); - -var CylinderCollisionGeo = /*#__PURE__*/function (_ChunkedObjectsGeomet) { - inherits(CylinderCollisionGeo, _ChunkedObjectsGeomet); - - function CylinderCollisionGeo(instanceCount, polyComplexity) { - var _this; - - classCallCheck(this, CylinderCollisionGeo); - - var cylGeometry = new CylinderBufferGeometry$1(1, 1, 1.0, Math.max(3, polyComplexity), 2, true); - _this = possibleConstructorReturn(this, getPrototypeOf(CylinderCollisionGeo).call(this, cylGeometry, instanceCount)); - var chunkSize = _this._chunkSize; - _this._chunkPos = _this._chunkGeo.attributes.position.array; - _this._chunkNorms = _this._chunkGeo.attributes.normal.array; - _this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE$4); - return _this; - } - - createClass(CylinderCollisionGeo, [{ - key: "setItem", - value: function setItem(itemIdx, botPos, topPos, itemRad) { - var chunkSize = this._chunkSize; - var itemOffset = chunkSize * itemIdx * VEC_SIZE$4; - var tmpArray = this._tmpVector; - var geoPos = this._chunkPos; - var geoNorm = this._chunkNorms; - var mtx1 = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad); - normMtx$1.getNormalMatrix(mtx1); - var idx; - - for (var i = 0; i < chunkSize; ++i) { - idx = i * VEC_SIZE$4; - tmpVector$1.fromArray(geoPos, idx); - tmpVector$1.applyMatrix4(mtx1); - tmpVector$1.toArray(tmpArray, idx); - } - - this._positions.set(tmpArray, itemOffset); - - for (var _i = 0; _i < chunkSize; ++_i) { - idx = _i * VEC_SIZE$4; - tmpVector$1.fromArray(geoNorm, idx); - tmpVector$1.applyMatrix3(normMtx$1); - tmpVector$1.toArray(tmpArray, idx); - } - - this._normals.set(tmpArray, itemOffset); - } - }]); - - return CylinderCollisionGeo; -}(ChunkedObjectsGeometry); - -var COLLISION_RAD = 0.1; -/** - * This class represents geometry which consists of separate chunks. - * Each chunk has same index and similar geometry with equal points and faces count. - * Each chunk has by default only one color. - * @constructor - * - * @param {number} chunksCount Total chunks count. - * @param {number} segmentsCount Number of segments per chunk. - * @param {boolean} enableCollision Enable or disable collision where each segment is - * a collidable cylinder. - * collision geometry. - */ - -var ChunkedLinesGeometry = /*#__PURE__*/function (_LinesGeometry) { - inherits(ChunkedLinesGeometry, _LinesGeometry); - - function ChunkedLinesGeometry(chunksCount, segmentsCount, enableCollision) { - var _this; - - classCallCheck(this, ChunkedLinesGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(ChunkedLinesGeometry).call(this, chunksCount * segmentsCount)); - - _this._init(segmentsCount); - - _this._collisionGeo = enableCollision ? new CylinderCollisionGeo(chunksCount * segmentsCount, 3) : null; - return _this; - } - - createClass(ChunkedLinesGeometry, [{ - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "computeBoundingSphere", - value: function computeBoundingSphere() { - var collisionGeo = this._collisionGeo; - - if (collisionGeo) { - collisionGeo.computeBoundingSphere(); - this.boundingSphere = collisionGeo.boundingSphere; - return; - } - - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "computeBoundingSphere", this).call(this); - } - }, { - key: "computeBoundingBox", - value: function computeBoundingBox() { - var collisionGeo = this._collisionGeo; - - if (collisionGeo) { - collisionGeo.computeBoundingBox(); - this.boundingBox = collisionGeo.boundingBox; - return; - } - - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "computeBoundingBox", this).call(this); - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var collisionGeo = this._collisionGeo; - - if (!collisionGeo) { - return; - } - - var segCount = this._chunkSize; - - this._collisionGeo.raycast(raycaster, intersects); - - for (var i = 0, n = intersects.length; i < n; ++i) { - var chunkIdx = intersects[i].chunkIdx; - - if (chunkIdx === undefined) { - continue; - } - - chunkIdx = chunkIdx / segCount | 0; - intersects[i].chunkIdx = chunkIdx; - } - } - }, { - key: "setColor", - value: function setColor(chunkIdx, colorVal) { - var chunkSize = this._chunkSize; - - for (var i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) { - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "setColor", this).call(this, i, colorVal); - } - } - }, { - key: "setSegment", - value: function setSegment(chunkIdx, segIdx, pos1, pos2) { - var chunkSize = this._chunkSize; - var idx = chunkIdx * chunkSize + segIdx; - - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "setSegment", this).call(this, idx, pos1, pos2); - - if (this._collisionGeo) { - this._collisionGeo.setItem(chunkIdx * chunkSize + segIdx, pos1, pos2, COLLISION_RAD); - } - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "setOpacity", - value: function setOpacity(chunkIndices, value) { - var chunkSize = this._chunkSize; - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var left = chunkIndices[i] * chunkSize; - - get(getPrototypeOf(ChunkedLinesGeometry.prototype), "setOpacity", this).call(this, left, left + chunkSize - 1, value); - } - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var instanceCount = chunkIndices.length; - var chunkSize = this._chunkSize; - var subset = new ChunkedLinesGeometry(instanceCount, chunkSize, false); - - for (var i = 0, n = chunkIndices.length; i < n; ++i) { - var dstPtOffset = i * chunkSize; - var startSegIdx = chunkIndices[i] * chunkSize; - subset.setSegments(dstPtOffset, this.getSubsetSegments(startSegIdx, chunkSize)); - subset.setColors(dstPtOffset, this.getSubsetColors(startSegIdx, chunkSize)); - } - - subset.boundingSphere = this.boundingSphere; - subset.boundingBox = this.boundingBox; - return [subset]; - } - }, { - key: "_init", - value: function _init(chunkSize) { - this._chunkSize = chunkSize; - } - }]); - - return ChunkedLinesGeometry; -}(LinesGeometry); - -var COLLISION_RAD$1 = 0.3; -var tmpVector$2 = new Vector3(); - -var TwoColorLinesGeometry = /*#__PURE__*/function (_LinesGeometry) { - inherits(TwoColorLinesGeometry, _LinesGeometry); - - function TwoColorLinesGeometry(segmentsCount) { - var _this; - - classCallCheck(this, TwoColorLinesGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(TwoColorLinesGeometry).call(this, segmentsCount * 2)); - - _this._init(segmentsCount); - - _this._collisionGeo = new Simple2CCylindersGeometry(segmentsCount, 3); - return _this; - } - - createClass(TwoColorLinesGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, botPos, topPos) { - this._collisionGeo.setItem(itemIdx, botPos, topPos, COLLISION_RAD$1); - - var offset = 2 * itemIdx; // there are two points per segment - - tmpVector$2.lerpVectors(botPos, topPos, 0.5); - - get(getPrototypeOf(TwoColorLinesGeometry.prototype), "setSegment", this).call(this, offset, botPos, tmpVector$2); - - get(getPrototypeOf(TwoColorLinesGeometry.prototype), "setSegment", this).call(this, offset + 1, tmpVector$2, topPos); - } - }, { - key: "setColor", - value: function setColor(itemIdx, colorVal1, colorVal2) { - var offset = 2 * itemIdx; // there are two points per segment - - get(getPrototypeOf(TwoColorLinesGeometry.prototype), "setColor", this).call(this, offset, colorVal1); - - get(getPrototypeOf(TwoColorLinesGeometry.prototype), "setColor", this).call(this, offset + 1, colorVal2); - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - if (this._collisionGeo) { - this._collisionGeo.raycast(raycaster, intersects); - } - } - }, { - key: "getSubset", - value: function getSubset(segmentIndices) { - var instanceCount = segmentIndices.length; - var subset = new TwoColorLinesGeometry(instanceCount, false); - - for (var i = 0, n = instanceCount; i < n; ++i) { - var startSegIdx = segmentIndices[i]; - subset.setSegments(i, this.getSubsetSegments(startSegIdx, 1)); - subset.setColors(i, this.getSubsetColors(startSegIdx, 1)); - } - - subset.boundingSphere = this.boundingSphere; - subset.boundingBox = this.boundingBox; - return [subset]; - } - }, { - key: "_init", - value: function _init(segmentsCount) { - this._segCounts = segmentsCount * 2; - } - }]); - - return TwoColorLinesGeometry; -}(LinesGeometry); // (???)parent = LinesGeometry.prototype; - -var vectors = [new Vector3(1, 0, 0), new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1)]; -var vecCount = vectors.length; -var tempPos1 = new Vector3(); -var tempPos2 = new Vector3(); - -var CrossGeometry = /*#__PURE__*/function (_SphereCollisionGeo) { - inherits(CrossGeometry, _SphereCollisionGeo); - - function CrossGeometry(chunksCount) { - classCallCheck(this, CrossGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(CrossGeometry).call(this, chunksCount, chunksCount, vecCount / 2 | 0, false)); - } - - createClass(CrossGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, itemPos, itemRad) { - this.setSphere(itemIdx, itemPos, itemRad); - - for (var i = 0; i < vecCount / 2; ++i) { - var first = i * 2; - tempPos1.x = itemPos.x + vectors[first].x * itemRad; - tempPos1.y = itemPos.y + vectors[first].y * itemRad; - tempPos1.z = itemPos.z + vectors[first].z * itemRad; - var second = first + 1; - tempPos2.x = itemPos.x + vectors[second].x * itemRad; - tempPos2.y = itemPos.y + vectors[second].y * itemRad; - tempPos2.z = itemPos.z + vectors[second].z * itemRad; - this.setSegment(itemIdx, i, tempPos1, tempPos2); - } - } - }]); - - return CrossGeometry; -}(SphereCollisionGeo(ChunkedLinesGeometry)); - -var POS_RAD_SIZE = 4; -var COLOR_SIZE$2 = 3; -var tmpColor$4 = new Color(); -/** - * This is a base class for isosurface algorithms. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - -var IsoSurfaceGeometry = /*#__PURE__*/function (_RaycastableBufferGeo) { - inherits(IsoSurfaceGeometry, _RaycastableBufferGeo); - - function IsoSurfaceGeometry(spheresCount, opts) { - var _this; - - classCallCheck(this, IsoSurfaceGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(IsoSurfaceGeometry).call(this)); - _this._opts = opts; - _this.zClip = _this._opts.zClip; - _this._posRad = utils.allocateTyped(Float32Array, spheresCount * POS_RAD_SIZE); - _this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE$2); - return _this; - } - - createClass(IsoSurfaceGeometry, [{ - key: "setItem", - value: function setItem(chunkIdx, pos, radius) { - var posRad = this._posRad; - var idx = POS_RAD_SIZE * chunkIdx; - posRad[idx++] = pos.x; - posRad[idx++] = pos.y; - posRad[idx++] = pos.z; - posRad[idx] = radius; - } - }, { - key: "setColor", - value: function setColor(chunkIdx, colorVal) { - tmpColor$4.set(colorVal); - var colors = this._colors; - var idx = COLOR_SIZE$2 * chunkIdx; - colors[idx++] = tmpColor$4.r; - colors[idx++] = tmpColor$4.g; - colors[idx] = tmpColor$4.b; - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - this.computeBoundingSphere(); - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this._build(); - } - }, { - key: "setOpacity", - value: function setOpacity() {// not implemented - } - }, { - key: "raycast", - value: function raycast() {} - }, { - key: "getSubset", - value: function getSubset() { - return []; - } - }]); - - return IsoSurfaceGeometry; -}(RaycastableBufferGeometry); - -/** - * Class for marching cube - * Stores 8 points and 8 float values are stored together in linear array - * Int values for has intersection or not - in integer32 linear array - * Int values for bits flags - in integer32 linear array - * - */ - -var IsoSurfaceMarchCube = /*#__PURE__*/function () { - function IsoSurfaceMarchCube() { - classCallCheck(this, IsoSurfaceMarchCube); - - this.pointsValuesLinear = null; - this.hasIntersection = null; - this.bitsInside = null; - } - - createClass(IsoSurfaceMarchCube, [{ - key: "create", - value: function create(numCellsPerSide) { - var vx7000000 = 0x7000000; - var n3 = numCellsPerSide * numCellsPerSide * numCellsPerSide; - - if (n3 > vx7000000) { - throw new Error('Too large cube dimension: lead to memory huge uasge'); - } - - this.pointsValuesLinear = utils.allocateTyped(Float32Array, (2 << 2 + 2) * n3); - this.hasIntersection = utils.allocateTyped(Int32Array, n3); - this.bitsInside = utils.allocateTyped(Int32Array, n3); - return 0; - } - }, { - key: "destroy", - value: function destroy() { - this.bitsInside = null; - this.hasIntersection = null; - this.pointsValuesLinear = null; - } - }]); - - return IsoSurfaceMarchCube; -}(); -/* eslint-disable no-magic-numbers */ - - -IsoSurfaceMarchCube.prototype.striIndicesMarchCube = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1, 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1, 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1, 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1, 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1, 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1, 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1, 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1, 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1, 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1, 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1, 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1, 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1, 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1, 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1, 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1, 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1, 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1, 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1, 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1, 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1, 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1, 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1, 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1, 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1, 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1, 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1, 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1, 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1, 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1, 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1, 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1, 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1, 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1, 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1, 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1, 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1, 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1, 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1, 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1, 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1, 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1, 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1, 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1, 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1, 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1, 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1, 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1, 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1, 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1, 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1, 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1, 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1, 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1, 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1, 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1, 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1, 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1, 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1, 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1, 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1, 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1, 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1, 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1, 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1, 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1, 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1, 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1, 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1, 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1, 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1, 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1, 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1, 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1, 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1, 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1, 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1, 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1, 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1, 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1, 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1, 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1, 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1, 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1, 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1, 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1, 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1, 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1, 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1, 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1, 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1, 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1, 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1, 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1, 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1, 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1, 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1, 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1, 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1, 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1, 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1, 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1, 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1, 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1, 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1, 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1, 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1, 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1, 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; - -var edgeTable = [0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0]; - -function _voxelGradientFast(v, point, grad) { - var g = v.getValue(point.x, point.y, point.z); - grad.set(g[0], g[1], g[2]); -} // Helper class GridCell - - -var GridCell = function GridCell() { - classCallCheck(this, GridCell); - - this._arrSize = 8; - this.p = new Array(this._arrSize); - this.g = new Array(this._arrSize); - this.val = new Array(this._arrSize); - - for (var i = 0; i < this._arrSize; ++i) { - this.p[i] = new Vector3(); - this.g[i] = new Vector3(); - } - - this.cubeIndex = 0; -}; // Helper class Triangle - - -var Triangle = function Triangle() { - classCallCheck(this, Triangle); - - this.a = { - p: new Vector3(), - n: new Vector3() - }; - this.b = { - p: new Vector3(), - n: new Vector3() - }; - this.c = { - p: new Vector3(), - n: new Vector3() - }; -}; - -function createArray(arrSize) { - var arr = new Array(arrSize); - - for (var i = 0; i < arrSize; ++i) { - arr[i] = new Vector3(); - } - - return arr; -} - -var IsoSurface = /*#__PURE__*/function () { - function IsoSurface() { - classCallCheck(this, IsoSurface); - - this._numTriangles = 0; - this._numVertices = 0; - this._position = []; - this._normals = []; - this._colors = null; - this._indices = []; - this._volumetricData = null; - this._xAxis = new Vector3(); - this._yAxis = new Vector3(); - this._zAxis = new Vector3(); - this._xDir = new Vector3(); - this._yDir = new Vector3(); - this._zDir = new Vector3(); - } - - createClass(IsoSurface, [{ - key: "_prepareAxesAndDirs", - value: function _prepareAxesAndDirs() { - var volData = this._volumetricData; - var cellSize = volData.getCellSize(); // calculate cell axes - - var xAxis = this._xAxis; - var yAxis = this._yAxis; - var zAxis = this._zAxis; - var xDir = this._xDir; - var yDir = this._yDir; - var zDir = this._zDir; - xAxis.set(cellSize.x, 0, 0); - yAxis.set(0, cellSize.y, 0); - zAxis.set(0, 0, cellSize.z); - xDir.set(1, 0, 0); - yDir.set(0, 1, 0); - zDir.set(0, 0, 1); // flip normals if coordinate system is in the wrong handedness - - var tmp = new Vector3(); - tmp.crossVectors(xDir, yDir); - - if (tmp.dot(zDir) < 0) { - xDir.negate(); - yDir.negate(); - zDir.negate(); - } // check that the grid is in the all-positive octant of the coordinate system - - - if (xDir.x < 0 || xDir.y < 0 || xDir.z < 0 || yDir.x < 0 || yDir.y < 0 || yDir.z < 0 || zDir.x < 0 || zDir.y < 0 || zDir.z < 0) { - return false; - } // check that the grid is axis-aligned - - - var notZero = function notZero(axe) { - return Math.abs(axe) > Number.EPSILON; - }; - - return !(notZero(xAxis.y) || notZero(xAxis.z) || notZero(yAxis.x) || notZero(yAxis.z) || notZero(zAxis.x) || notZero(zAxis.y)); - } - }, { - key: "_vertexInterp", - value: function _vertexInterp(isoLevel, grid, ind1, ind2, vertex, normal) { - var p1 = grid.p[ind1]; - var p2 = grid.p[ind2]; - var n1 = grid.g[ind1]; - var n2 = grid.g[ind2]; - var valP1 = grid.val[ind1]; - var valP2 = grid.val[ind2]; - var isoDiffP1 = isoLevel - valP1; - var diffValP2P1 = valP2 - valP1; - var mu = 0.0; - - if (Math.abs(diffValP2P1) > 0.0) { - mu = isoDiffP1 / diffValP2P1; - } - - mu = mu > 1.0 ? 1.0 : mu; - vertex.lerpVectors(p1, p2, mu); - normal.lerpVectors(n1, n2, mu); - } - }, { - key: "_polygonize", - value: function _polygonize(grid, isoLevel, triangles) { - var cubeIndex = grid.cubeIndex; - var i = 0; - var arrSize = IsoSurface._arrSize; - var firstIndices = IsoSurface._firstIndices; - var secondIndices = IsoSurface._secondIndices; - var vertexList = IsoSurface._vertexList; - var normalList = IsoSurface._normalList; - - for (; i < arrSize; ++i) { - if (edgeTable[cubeIndex] & 1 << i) { - this._vertexInterp(isoLevel, grid, firstIndices[i], secondIndices[i], vertexList[i], normalList[i]); - } - } - - var triCount = 0; - var triTblIdx = cubeIndex * 16; - var triTable = IsoSurface._triTable; - - for (i = 0; triTable[triTblIdx + i] !== -1; i += 3) { - triangles[triCount].a.p.copy(vertexList[triTable[triTblIdx + i]]); - triangles[triCount].a.n.copy(normalList[triTable[triTblIdx + i]]); - triangles[triCount].b.p.copy(vertexList[triTable[triTblIdx + i + 1]]); - triangles[triCount].b.n.copy(normalList[triTable[triTblIdx + i + 1]]); - triangles[triCount].c.p.copy(vertexList[triTable[triTblIdx + i + 2]]); - triangles[triCount].c.n.copy(normalList[triTable[triTblIdx + i + 2]]); - ++triCount; - } - - return triCount; - } - }, { - key: "_doGridPosNorms", - value: function _doGridPosNorms(isoValue, step, appendSimple) { - var vol = this._volumetricData; - - var volData = this._volumetricData.getData(); - - var dim = vol.getDimensions(); - var xSize = dim[0]; - var ySize = dim[1]; - var zSize = dim[2]; - var stepX = step * vol.getStrideX(); - var stepY = step * vol.getStrideY(); - var stepZ = step * vol.getStrideZ(); - var gc = new GridCell(); - var gcVal = gc.val; - var gcValSize = gc.val.length; - var additions = [new Vector3(0, 0, 0), // 0 - new Vector3(step, 0, 0), // 1 - new Vector3(step, step, 0), // 2 - new Vector3(0, step, 0), // 3 - new Vector3(0, 0, step), // 4 - new Vector3(step, 0, step), // 5 - new Vector3(step, step, step), // 6 - new Vector3(0, step, step) // 7 - ]; - var tmpTriCount = 5; - var triangles = new Array(tmpTriCount); - - for (var j = 0; j < tmpTriCount; ++j) { - triangles[j] = new Triangle(); - } - - var appendVertex; - var self = this; - var positions = this._position; - var normals = this._normals; - - if (appendSimple) { - // Special case for axis-aligned grid with positive unit vector normals - appendVertex = function () { - var axis = new Vector3(self._xAxis.x, self._yAxis.y, self._zAxis.z); - return function (triVertex) { - var vertex = triVertex.p.clone(); - vertex.multiply(axis); - positions.push(vertex.add(self._origin)); - normals.push(triVertex.n.clone()); - }; - }(); - } else { - appendVertex = function () { - var posMtx = new Matrix3(); - posMtx.set(self._xAxis.x, self._yAxis.x, self._zAxis.x, self._xAxis.y, self._yAxis.y, self._zAxis.y, self._xAxis.z, self._yAxis.z, self._zAxis.z); - var normMtx = new Matrix3(); - normMtx.set(self._xDir.x, self._yDir.x, self._zDir.x, self._xDir.y, self._yDir.y, self._zDir.y, self._xDir.z, self._yDir.z, self._zDir.z); - return function (triVertex) { - positions.push(triVertex.p.clone().applyMatrix3(posMtx).add(self._origin)); - normals.push(triVertex.n.clone().applyMatrix3(normMtx)); - }; - }(); - } - - var indices = this._indices; - var globTriCount = 0; - - for (var z = 0; z < zSize - step; z += step) { - for (var y = 0; y < ySize - step; y += step) { - var idx = vol.getDirectIdx(0, y, z); - - for (var x = 0; x < xSize - step; x += step, idx += stepX) { - /* eslint-disable no-multi-spaces */ - - /* eslint-disable computed-property-spacing */ - gcVal[0] = volData[idx]; - gcVal[1] = volData[idx + stepX]; - gcVal[3] = volData[idx + stepY]; - gcVal[2] = volData[idx + stepX + stepY]; - gcVal[4] = volData[idx + stepZ]; - gcVal[5] = volData[idx + stepX + stepZ]; - gcVal[7] = volData[idx + stepY + stepZ]; - gcVal[6] = volData[idx + stepX + stepY + stepZ]; - /* eslint-enable no-multi-spaces */ - - /* eslint-enable computed-property-spacing */ - // Determine the index into the edge table which - // tells us which vertices are inside of the surface - - var cubeIndex = 0; - var i = 0; - - for (; i < gcValSize; ++i) { - if (gcVal[i] < isoValue) { - cubeIndex |= 1 << i; - } - } - - if (edgeTable[cubeIndex] === 0) { - continue; - } - - gc.cubeIndex = cubeIndex; - - for (i = 0; i < gcValSize; ++i) { - gc.p[i].set(x + additions[i].x, y + additions[i].y, z + additions[i].z); - - _voxelGradientFast(this._gradient, gc.p[i], gc.g[i]); - } // calculate vertices and facets for this cube, - // calculate normals by interpolating between the negated - // normalized volume gradients for the 8 reference voxels - - - var triCount = this._polygonize(gc, isoValue, triangles); - - globTriCount += triCount; // append triangles using different techniques - - for (i = 0; i < triCount; ++i) { - indices.push(this._numTriangles * 3); - indices.push(this._numTriangles * 3 + 1); - indices.push(this._numTriangles * 3 + 2); - ++this._numTriangles; - appendVertex(triangles[i].a); - appendVertex(triangles[i].b); - appendVertex(triangles[i].c); - } - } - } - } - - return globTriCount; - } - }, { - key: "compute", - value: function compute(volData, origin, isoValue, step) { - this._volumetricData = volData; - this._origin = origin; - this._gradient = volData.computeGradient(); - - this._doGridPosNorms(isoValue, step, this._prepareAxesAndDirs()); - } - }, { - key: "_remapIndices", - value: function _remapIndices(vertexMap, idcCount) { - var indices = this._indices; - var newIndices = utils.allocateTyped(Uint32Array, idcCount); - - for (var i = 0; i < idcCount; ++i) { - indices[i] = vertexMap[indices[i]]; - newIndices[i] = indices[i]; - } - - this._indices = newIndices; - } - }, { - key: "_remapVertices", - value: function _remapVertices(vertices, normals, count) { - var newPositions = utils.allocateTyped(Float32Array, count * 3); - var newNormals = utils.allocateTyped(Float32Array, count * 3); - - for (var i = 0; i < count; ++i) { - var pos = vertices[i]; - newPositions[i * 3] = pos.x; - newPositions[i * 3 + 1] = pos.y; - newPositions[i * 3 + 2] = pos.z; - var norm = normals[i].normalize(); - newNormals[i * 3] = norm.x; - newNormals[i * 3 + 1] = norm.y; - newNormals[i * 3 + 2] = norm.z; - } - - this._position = newPositions; - this._normals = newNormals; - } - }, { - key: "vertexFusion", - value: function vertexFusion(offset, len) { - var faceVer = this._indices.length; - var vertices = this._position; - var normals = this._normals; - var oldVerCount = vertices.length | 0; - - if (faceVer === 0 || oldVerCount === 0) { - return; - } - - var vMap = utils.allocateTyped(Uint32Array, oldVerCount); - vMap[0] = 0; - var newVer = 1; - var i = 1; - - for (; i < oldVerCount; ++i) { - var start = newVer - offset < 0 ? 0 : newVer - offset; - var end = start + len > newVer ? newVer : start + len; - var matchedIndex = -1; - - for (var j = start; j < end; ++j) { - if (Math.abs(vertices[i] - vertices[j]) < Number.EPSILON) { - matchedIndex = j; - break; - } - } - - if (matchedIndex !== -1) { - vMap[i] = matchedIndex; - } else { - vertices[newVer].copy(vertices[i]); - normals[newVer].copy(normals[i]); - vMap[i] = newVer; - ++newVer; - } - } - - this._remapIndices(vMap, faceVer); - - this._remapVertices(vertices, normals, newVer); - } // Assign per-vertex colors from a volumetric texture map (same dimensions as the original volumetric data). - // Along with color dominating atom is determined for each vertex - // and vertices with atom out of "visible" subset get filtered out. - // XXX only handles orthogonal volumes currently - - }, { - key: "setColorVolTex", - value: function setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) { - var i; - var idx; - var numVerts = this._position.length / 3; - var vertices = this._position; - var origin = this._origin; - - var dim = this._volumetricData.getDimensions(); - - var xs = dim[0] - 1; - var ys = dim[1] - 1; - var zs = dim[2] - 1; - var colorData = colorMap.getData(); - var strideX = colorMap.getStrideX(); - var strideY = colorMap.getStrideY(); - var strideZ = colorMap.getStrideZ(); - var atomWeightData; - var atomStrideX; - var atomStrideY; - var atomStrideZ; - - if (visibilitySelector !== null) { - atomWeightData = atomWeightMap.getData(); - atomStrideX = atomWeightMap.getStrideX(); - atomStrideY = atomWeightMap.getStrideY(); - atomStrideZ = atomWeightMap.getStrideZ(); - } - - var xInv = 1.0 / this._xAxis.x; - var yInv = 1.0 / this._yAxis.y; - var zInv = 1.0 / this._zAxis.z; - var atomLookup = []; - var atomWeights = []; - var colors = utils.allocateTyped(Float32Array, numVerts * 3); - - function interp(mu, idx1, idx2, c) { - c[0] = (1 - mu) * colorData[idx1] + mu * colorData[idx2]; - c[1] = (1 - mu) * colorData[idx1 + 1] + mu * colorData[idx2 + 1]; - c[2] = (1 - mu) * colorData[idx1 + 2] + mu * colorData[idx2 + 2]; - } - - function collectWeight(ai, coefX, coefY, coefZ) { - var a = atomMap[ai]; // atomWeightMap is a scalar field, so index into atom map should be the same - - if (a != null) { - atomLookup[a.index] = a; - var w = coefX * coefY * coefZ * atomWeightData[ai]; - - if (typeof atomWeights[a.index] === 'undefined') { - atomWeights[a.index] = w; - } else { - atomWeights[a.index] += w; - } - } - } - - var vMap = utils.allocateTyped(Int32Array, numVerts); - var newVerCount = 0; - - for (i = 0; i < numVerts; i++) { - var ind = i * 3; - var vx = (vertices[ind] - origin.x) * xInv; - var vy = (vertices[ind + 1] - origin.y) * yInv; - var vz = (vertices[ind + 2] - origin.z) * zInv; - var x = Math.min(Math.max(vx, 0), xs) | 0; - var y = Math.min(Math.max(vy, 0), ys) | 0; - var z = Math.min(Math.max(vz, 0), zs) | 0; - var mux = vx - x; - var muy = vy - y; - var muz = vz - z; - - if (visibilitySelector != null) { - // collect atom weights - atomLookup = []; - atomWeights = []; - idx = atomWeightMap.getDirectIdx(x, y, z); - collectWeight(idx, 1 - mux, 1 - muy, 1 - muz); - collectWeight(idx + atomStrideX, mux, 1 - muy, 1 - muz); - collectWeight(idx + atomStrideY, 1 - mux, muy, 1 - muz); - collectWeight(idx + atomStrideX + atomStrideY, mux, muy, 1 - muz); - collectWeight(idx + atomStrideZ, 1 - mux, 1 - muy, muz); - collectWeight(idx + atomStrideX + atomStrideZ, mux, 1 - muy, muz); - collectWeight(idx + atomStrideY + atomStrideZ, 1 - mux, muy, muz); - collectWeight(idx + atomStrideX + atomStrideY + atomStrideZ, mux, muy, muz); // find dominant atom - - var maxWeight = 0.0; - var dominantIdx = -1; - - for (var atomIdx in atomWeights) { - if (atomWeights[atomIdx] > maxWeight) { - dominantIdx = atomIdx; - maxWeight = atomWeights[atomIdx]; - } - } - - if (dominantIdx < 0 || !visibilitySelector.includesAtom(atomLookup[dominantIdx])) { - // this vertex doesn't belong to visible subset and will be skipped - vMap[i] = -1; - continue; - } - } - - vMap[i] = newVerCount++; // color tri-linear interpolation - - var dx = x < xs ? strideX : 0; - var dy = y < ys ? strideY : 0; - var dz = z < zs ? strideZ : 0; - var c0 = [0, 0, 0]; - var c1 = [0, 0, 0]; - var c2 = [0, 0, 0]; - var c3 = [0, 0, 0]; - idx = colorMap.getDirectIdx(x, y, z); - interp(mux, idx, idx + dx, c0); - interp(mux, idx + dy, idx + dx + dy, c1); - interp(mux, idx + dz, idx + dx + dz, c2); - interp(mux, idx + dy + dz, idx + dx + dy + dz, c3); - var cz0 = [0, 0, 0]; - cz0[0] = (1 - muy) * c0[0] + muy * c1[0]; - cz0[1] = (1 - muy) * c0[1] + muy * c1[1]; - cz0[2] = (1 - muy) * c0[2] + muy * c1[2]; - var cz1 = [0, 0, 0]; - cz1[0] = (1 - muy) * c2[0] + muy * c3[0]; - cz1[1] = (1 - muy) * c2[1] + muy * c3[1]; - cz1[2] = (1 - muy) * c2[2] + muy * c3[2]; - colors[ind] = (1 - muz) * cz0[0] + muz * cz1[0]; - colors[ind + 1] = (1 - muz) * cz0[1] + muz * cz1[1]; - colors[ind + 2] = (1 - muz) * cz0[2] + muz * cz1[2]; - } - - this._colors = colors; - - if (visibilitySelector != null) { - // shift visible vertices towards beginning of array - for (i = 0; i < numVerts; ++i) { - var j = vMap[i]; - - if (j < 0) { - continue; - } // assert: j <= i - - - this._position[j * 3] = this._position[i * 3]; - this._position[j * 3 + 1] = this._position[i * 3 + 1]; - this._position[j * 3 + 2] = this._position[i * 3 + 2]; - this._normals[j * 3] = this._normals[i * 3]; - this._normals[j * 3 + 1] = this._normals[i * 3 + 1]; - this._normals[j * 3 + 2] = this._normals[i * 3 + 2]; - this._colors[j * 3] = this._colors[i * 3]; - this._colors[j * 3 + 1] = this._colors[i * 3 + 1]; - this._colors[j * 3 + 2] = this._colors[i * 3 + 2]; - } // rebuild index list - - - var numTriangles = this._indices.length / 3; - var newTriCount = 0; - - for (i = 0; i < numTriangles; ++i) { - var i0 = vMap[this._indices[3 * i]]; - var i1 = vMap[this._indices[3 * i + 1]]; - var i2 = vMap[this._indices[3 * i + 2]]; - - if (i0 >= 0 && i1 >= 0 && i2 >= 0) { - this._indices[3 * newTriCount] = i0; - this._indices[3 * newTriCount + 1] = i1; - this._indices[3 * newTriCount + 2] = i2; - ++newTriCount; - } - } // shrink arrays to data size - - - this._position = new Float32Array(this._position.buffer.slice(0, newVerCount * 3 * 4)); - this._normals = new Float32Array(this._normals.buffer.slice(0, newVerCount * 3 * 4)); - this._colors = new Float32Array(this._colors.buffer.slice(0, newVerCount * 3 * 4)); - this._indices = new Uint32Array(this._indices.buffer.slice(0, newTriCount * 3 * 4)); - } - } - }, { - key: "toMesh", - value: function toMesh() { - var geo = new BufferGeometry(); - geo.setIndex(new BufferAttribute(this._indices, 1)); - geo.setAttribute('position', new BufferAttribute(this._position, 3)); - geo.setAttribute('normal', new BufferAttribute(this._normals, 3)); - geo.setAttribute('color', new BufferAttribute(this._colors, 3)); - geo.computeBoundingSphere(); - return geo; - } - }]); - - return IsoSurface; -}(); - -defineProperty(IsoSurface, "_triTable", IsoSurfaceMarchCube.prototype.striIndicesMarchCube); - -defineProperty(IsoSurface, "_arrSize", 12); - -defineProperty(IsoSurface, "_firstIndices", [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3]); - -defineProperty(IsoSurface, "_secondIndices", [1, 2, 3, 0, 5, 6, 7, 4, 4, 5, 6, 7]); - -defineProperty(IsoSurface, "_vertexList", createArray(IsoSurface._arrSize)); - -defineProperty(IsoSurface, "_normalList", createArray(IsoSurface._arrSize)); - -/** - * This is a base class for volumetric maps based isosurface algorithms. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - -var VolumeSurfaceGeometry = /*#__PURE__*/function (_IsoSurfaceGeometry) { - inherits(VolumeSurfaceGeometry, _IsoSurfaceGeometry); - - function VolumeSurfaceGeometry() { - classCallCheck(this, VolumeSurfaceGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(VolumeSurfaceGeometry).apply(this, arguments)); - } - - createClass(VolumeSurfaceGeometry, [{ - key: "_build", - value: function _build() { - var params = this._opts; - this.numVoxels = [128, 128, 128]; - this.xAxis = new Vector3(1.0, 0.0, 0.0); - this.yAxis = new Vector3(0.0, 1.0, 0.0); - this.zAxis = new Vector3(0.0, 0.0, 1.0); - this.origin = new Vector3(0.0, 0.0, 0.0); - this._visibilitySelector = params.visibilitySelector; - - this._calcSurface(params); - } - }, { - key: "_findMinMax", - value: function _findMinMax(posRadArray) { - var itemSize = 4; - var itemsCount = posRadArray.length / itemSize; - var maxPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]]; - var minPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]]; - - for (var i = 1; i < itemsCount; ++i) { - var ind = i * itemSize; - - for (var itemIdx = 0; itemIdx < itemSize; ++itemIdx) { - var tmpVal = posRadArray[ind + itemIdx]; - maxPosRad[itemIdx] = Math.max(tmpVal, maxPosRad[itemIdx]); - minPosRad[itemIdx] = Math.min(tmpVal, minPosRad[itemIdx]); - } - } - - return { - maxPosRad: maxPosRad, - minPosRad: minPosRad - }; - } - }, { - key: "_findNumVoxels", - value: function _findNumVoxels(posRadArray, params) { - var numVoxels = this.numVoxels; - - var minMaxValues = this._findMinMax(posRadArray); - - var minCoordRad = minMaxValues.minPosRad; - var maxCoordRad = minMaxValues.maxPosRad; // minrad - - if (minCoordRad[3] > 4.0) { - params.gridSpacing *= minCoordRad[3]; - } - - var gridPadding = params.radScale * maxCoordRad[3] * 1.7; - var padRad = gridPadding; - padRad = 0.65 * Math.sqrt(4.0 / 3.0 * Math.PI * padRad * padRad * padRad); - gridPadding = Math.max(gridPadding, padRad); - var i = 0; - - for (; i < 3; ++i) { - minCoordRad[i] -= gridPadding; - maxCoordRad[i] += gridPadding; - } - - for (i = 0; i < 3; ++i) { - numVoxels[i] = Math.ceil((maxCoordRad[i] - minCoordRad[i]) / params.gridSpacing); - } - - this.xAxis.x = (numVoxels[0] - 1) * params.gridSpacing; - this.yAxis.y = (numVoxels[1] - 1) * params.gridSpacing; - this.zAxis.z = (numVoxels[2] - 1) * params.gridSpacing; - - var _minCoordRad = slicedToArray(minCoordRad, 3); - - this.origin.x = _minCoordRad[0]; - this.origin.y = _minCoordRad[1]; - this.origin.z = _minCoordRad[2]; - return { - bbox: minMaxValues, - dim: numVoxels - }; - } - }, { - key: "_makeSurface", - value: function _makeSurface(surface, params) { - var isoSurf = new IsoSurface(); - isoSurf.compute(surface.volMap, this.origin, params.isoValue, 1); - isoSurf.vertexFusion(9, 9); // normalization is included - - if (isoSurf._numTriangles > 0) { - isoSurf.setColorVolTex(surface.volTexMap, surface.atomMap, surface.atomWeightMap, this._visibilitySelector); - this.setIndex(new BufferAttribute(isoSurf._indices, 1)); - this.setAttribute('position', new BufferAttribute(isoSurf._position, 3)); - this.setAttribute('normal', new BufferAttribute(isoSurf._normals, 3)); - this.setAttribute('color', new BufferAttribute(isoSurf._colors, 3)); - } else { - // geometry should have at least empty position attributes to be processed in wireframe mode by three.js - this.setAttribute('position', new BufferAttribute(utils.allocateTyped(Float32Array, 0), 3)); - } - } - }, { - key: "_calcSurface", - value: function _calcSurface(params) { - var packedArrays = { - posRad: this._posRad, - colors: this._colors, - atoms: this._opts.atoms - }; - - if (packedArrays.posRad.length === 0) { - return; - } - - var boundaries = this._findNumVoxels(packedArrays.posRad, params); - - var box = new Box3(this.origin, new Vector3(this.xAxis.x, this.yAxis.y, this.zAxis.z).add(this.origin)); - - var surface = this._computeSurface(packedArrays, box, boundaries, params); - - this._makeSurface(surface, params); - } - }]); - - return VolumeSurfaceGeometry; -}(IsoSurfaceGeometry); - -var Volume$1 = chem.Volume; -/** - * This class implements 'quick' isosurface geometry generation algorithm. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - -var QuickSurfGeometry = /*#__PURE__*/function (_VolumeSurfaceGeometr) { - inherits(QuickSurfGeometry, _VolumeSurfaceGeometr); - - function QuickSurfGeometry() { - classCallCheck(this, QuickSurfGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(QuickSurfGeometry).apply(this, arguments)); - } - - createClass(QuickSurfGeometry, [{ - key: "_computeSurface", - value: function _computeSurface(packedArrays, box, boundaries, params) { - // beware of shifting this multiple times! - this._shiftByOrigin(packedArrays.posRad); - - var surface = { - volMap: new Volume$1(Float32Array, this.numVoxels, box), - volTexMap: new Volume$1(Float32Array, this.numVoxels, box, 3) - }; - - if (this._visibilitySelector != null) { - surface.atomMap = []; - surface.atomWeightMap = new Volume$1(Float32Array, this.numVoxels, box); - } - - this.gaussdensity(surface, packedArrays, null, params); - return surface; - } - }, { - key: "gaussdensity", - value: function gaussdensity(surface, packedArrays, atomicNum, params) { - var numAtoms = packedArrays.posRad.length / 4; - var posRad = packedArrays.posRad, - colors = packedArrays.colors; - var numVoxels = this.numVoxels; - var radScale = params.radScale, - gaussLim = params.gaussLim, - gridSpacing = params.gridSpacing; - var invIsoValue = 1.0 / params.isoValue; - var invGridSpacing = 1.0 / gridSpacing; - var maxVoxelX = numVoxels[0] - 1; - var maxVoxelY = numVoxels[1] - 1; - var maxVoxelZ = numVoxels[2] - 1; // TODO is densityMap and volTexMap initialized? - - var volMap = surface.volMap, - volTexMap = surface.volTexMap; - var volData = volMap.getData(); - var strideX = volMap.getStrideX(); - var volTexData = volTexMap.getData(); - var texStrideX = volTexMap.getStrideX(); - var atomWeightData; - - if (this._visibilitySelector != null) { - atomWeightData = surface.atomWeightMap.getData(); - } - - var atomMap = surface.atomMap; - - for (var i = 0; i < numAtoms; ++i) { - var ind = i * 4; - var scaledRad = posRad[ind + 3] * radScale; - var atomicNumFactor = atomicNum === null ? 1.0 : atomicNum[i]; - var radInv = 1 / (2 * scaledRad * scaledRad); - var radLim = gaussLim * scaledRad; - var radLim2 = radLim * radLim; - radLim *= invGridSpacing; - var tmp = posRad[ind] * invGridSpacing; - var xMin = Math.max(tmp - radLim | 0, 0); - var xMax = Math.min(tmp + radLim | 0, maxVoxelX); - tmp = posRad[ind + 1] * invGridSpacing; - var yMin = Math.max(tmp - radLim | 0, 0); - var yMax = Math.min(tmp + radLim | 0, maxVoxelY); - tmp = posRad[ind + 2] * invGridSpacing; - var zMin = Math.max(tmp - radLim | 0, 0); - var zMax = Math.min(tmp + radLim | 0, maxVoxelZ); - var dz = zMin * gridSpacing - posRad[ind + 2]; - - for (var z = zMin; z <= zMax; ++z, dz += gridSpacing) { - var dy = yMin * gridSpacing - posRad[ind + 1]; - - for (var y = yMin; y <= yMax; ++y, dy += gridSpacing) { - var dy2dz2 = dy * dy + dz * dz; - - if (dy2dz2 >= radLim2) { - continue; - } - - var addr = volMap.getDirectIdx(xMin, y, z); - var texAddr = volTexMap.getDirectIdx(xMin, y, z); - var dx = xMin * gridSpacing - posRad[ind]; - - for (var x = xMin; x <= xMax; ++x, dx += gridSpacing, addr += strideX, texAddr += texStrideX) { - var r2 = dx * dx + dy2dz2; - var expVal = -r2 * radInv; - var density = Math.exp(expVal) * atomicNumFactor; // store most relevant atom (with highest density) - - if (this._visibilitySelector != null && density > atomWeightData[addr]) { - // NOSONAR - atomWeightData[addr] = density; // we use same index into atom map and atomWeightMap - - atomMap[addr] = packedArrays.atoms[i]; - } - - volData[addr] += density; // TODO check for volTexMap routine? - - density *= invIsoValue; - var colInd = i * 3; - volTexData[texAddr] += density * colors[colInd]; - volTexData[texAddr + 1] += density * colors[colInd + 1]; - volTexData[texAddr + 2] += density * colors[colInd + 2]; - } - } - } - } - } - }, { - key: "_shiftByOrigin", - value: function _shiftByOrigin(posRadArray) { - var originX = this.origin.x; - var originY = this.origin.y; - var originZ = this.origin.z; - var itemSize = 4; - var itemsCount = posRadArray.length / itemSize; - - for (var i = 0; i < itemsCount; ++i) { - var ind = i * itemSize; - posRadArray[ind] -= originX; - posRadArray[ind + 1] -= originY; - posRadArray[ind + 2] -= originZ; - } - } - }]); - - return QuickSurfGeometry; -}(VolumeSurfaceGeometry); - -/** - * Modifed from SpatialHash - * - * Main differences are: - * - Optimized grid size to ensure we only ever need to look +/-1 cell - * - Aware of atomic radii and will only output atoms within rAtom + rExtra - * (see withinRadii method) - * - * (Uses rounding rather than bitshifting as consequence of arbitrary grid size) - * @class - * @param {Float32Array} posRad - x, y, z coordinates and radiuses - * @param {Float32Array} min - xyz min coordinates - * @param {Float32Array} max - xyz max coordinates - * @param {number} maxDistance - max distance - */ - -function AVHash(posRad, min, max, maxDistance) { - var itemSize = 4; - var nAtoms = posRad.length / itemSize; - var minX = min[0]; - var minY = min[1]; - var minZ = min[2]; - var maxX = max[0]; - var maxY = max[1]; - var maxZ = max[2]; - - function hashFunc(w, minW) { - return Math.floor((w - minW) / maxDistance); - } - - var iDim = hashFunc(maxX, minX) + 1; - var jDim = hashFunc(maxY, minY) + 1; - var kDim = hashFunc(maxZ, minZ) + 1; - var nCells = iDim * jDim * kDim; - var jkDim = jDim * kDim; - /* Get cellID for cartesian x,y,z */ - - var cellID = function cellID(x, y, z) { - return (hashFunc(x, minX) * jDim + hashFunc(y, minY)) * kDim + hashFunc(z, minZ); - }; - /* Initial building, could probably be optimized further */ - - - var preHash = []; - var i; - var cid; - - for (i = 0; i < nAtoms; i++) { - var iIdx = itemSize * i; - cid = cellID(posRad[iIdx], posRad[iIdx + 1], posRad[iIdx + 2]); - - if (preHash[cid] === undefined) { - preHash[cid] = [i]; - } else { - preHash[cid].push(i); - } - } - - var cellOffsets = utils.allocateTyped(Uint32Array, nCells); - var cellLengths = utils.allocateTyped(Uint16Array, nCells); - var data = utils.allocateTyped(Uint32Array, nAtoms); - var offset = 0; - var maxCellLength = 0; - var j; - - for (i = 0; i < nCells; i++) { - var start = cellOffsets[i] = offset; - var subArray = preHash[i]; - - if (subArray !== undefined) { - for (j = 0; j < subArray.length; j++) { - data[offset] = subArray[j]; - offset++; - } - } - - var cellLength = offset - start; - cellLengths[i] = cellLength; - - if (cellLength > maxCellLength) { - maxCellLength = cellLength; - } - } // Maximum number of neighbours we could ever produce (27 adjacent cells of equal population) - - - this.neighbourListLength = 27 * maxCellLength + 1; - /** - * Populate the supplied out array with atom indices that are within rAtom + rExtra - * of x,y,z - * - * -1 in out array indicates the end of the list - * - * @param {number} x - x coordinate - * @param {number} y - y coordinate - * @param {number} z - z coordinate - * @param {number} rExtra - additional radius - * @param {Float32Array} out - pre-allocated output array - * @return {undefined} - */ - - this.withinRadii = function (x, y, z, rExtra, out) { - var outIdx = 0; - var nearI = hashFunc(x, minX); - var nearJ = hashFunc(y, minY); - var nearK = hashFunc(z, minZ); - var loI = Math.max(0, nearI - 1); - var loJ = Math.max(0, nearJ - 1); - var loK = Math.max(0, nearK - 1); - var hiI = Math.min(iDim - 1, nearI + 1); - var hiJ = Math.min(jDim - 1, nearJ + 1); - var hiK = Math.min(kDim - 1, nearK + 1); - - for (i = loI; i <= hiI; ++i) { - var iOffset = i * jkDim; - - for (j = loJ; j <= hiJ; ++j) { - var jOffset = j * kDim; - - for (var k = loK; k <= hiK; ++k) { - cid = iOffset + jOffset + k; - var cellStart = cellOffsets[cid]; - var cellEnd = cellStart + cellLengths[cid]; - - for (var dataIndex = cellStart; dataIndex < cellEnd; dataIndex++) { - var atomIndex = data[dataIndex]; - var baseIndex = itemSize * atomIndex; - var dx = posRad[baseIndex] - x; - var dy = posRad[baseIndex + 1] - y; - var dz = posRad[baseIndex + 2] - z; - var rSum = posRad[baseIndex + 3] + rExtra; - - if (dx * dx + dy * dy + dz * dz <= rSum * rSum) { - out[outIdx++] = data[dataIndex]; - } - } - } - } - } // Add terminator - - - out[outIdx] = -1; - }; -} - -function ContactSurface(packedArrays, boundaries, params, _indexList) { - // Field generation method adapted from AstexViewer (Mike Hartshorn) - // by Fred Ludlow. - // Other parts based heavily on NGL (Alexander Rose) EDT Surface class - // - // Should work as a drop-in alternative to EDTSurface (though some of - // the EDT paramters are not relevant in this method). - var itemSize = 4; - var posRad = packedArrays.posRad, - colors = packedArrays.colors, - atoms = packedArrays.atoms; - var nAtoms = posRad.length / itemSize; - var bbox = boundaries.bbox; - var min = bbox.minPosRad; - var max = bbox.maxPosRad; - var r2; // Atom positions, expanded radii (squared) - - var maxRadius; // Parameters - - var probeRadius; - var scaleFactor; - var probePositions; // Cache last value for obscured test - - var lastClip = -1; // Grid params - - var dim; - var grid; - var volTex; - var weights; - var weightsMap = null; - var atomMap = null; - var visibilitySelector = null; // grid indices -> xyz coords - - var gridx; - var gridy; - var gridz; // Lookup tables: - - var sinTable; - var cosTable; // Spatial Hash - - var hash; // Neighbour array to be filled by hash - - var neighbours; // Vectors for Torus Projection - - var mid = new Vector3(0.0, 0.0, 0.0); - var n1 = new Vector3(0.0, 0.0, 0.0); - var n2 = new Vector3(0.0, 0.0, 0.0); - var ngTorus; - - function uniformArray(TypeName, n, a) { - var array = utils.allocateTyped(TypeName, n); - - for (var innI = 0; innI < n; ++innI) { - array[innI] = a; - } - - return array; - } - - function fillGridDim(a, start, step) { - for (var innI = 0; innI < a.length; innI++) { - a[innI] = start + step * innI; - } - } - - function initializeGrid() { - scaleFactor = params.scaleFactor; - dim = boundaries.dim; - ngTorus = Math.min(5, 2 + Math.floor(probeRadius * scaleFactor)); - var gridSize = dim[0] * dim[1] * dim[2]; - grid = uniformArray(Float32Array, gridSize, -1001.0); - volTex = utils.allocateTyped(Float32Array, gridSize * 3); - weights = utils.allocateTyped(Float32Array, gridSize); - - if (visibilitySelector) { - weightsMap = utils.allocateTyped(Float32Array, gridSize); - atomMap = []; - } - - gridx = utils.allocateTyped(Float32Array, dim[0]); - gridy = utils.allocateTyped(Float32Array, dim[1]); - gridz = utils.allocateTyped(Float32Array, dim[2]); - fillGridDim(gridx, min[0], 1 / scaleFactor); - fillGridDim(gridy, min[1], 1 / scaleFactor); - fillGridDim(gridz, min[2], 1 / scaleFactor); - } - - function initializeAngleTables() { - var theta = 0.0; - var step = 2 * Math.PI / probePositions; - cosTable = utils.allocateTyped(Float32Array, probePositions); - sinTable = utils.allocateTyped(Float32Array, probePositions); - - for (var innI = 0; innI < probePositions; innI++) { - cosTable[innI] = Math.cos(theta); - sinTable[innI] = Math.sin(theta); - theta += step; - } - } - - function initializeHash() { - hash = new AVHash(posRad, min, max, 2.01 * maxRadius); - neighbours = new Int32Array(hash.neighbourListLength); - } - - function init() { - probeRadius = params.probeRadius; - scaleFactor = params.scaleFactor; - probePositions = params.probePositions; - visibilitySelector = params.visibilitySelector; - r2 = utils.allocateTyped(Float32Array, nAtoms); - maxRadius = 0; - - for (var innI = 0; innI < nAtoms; ++innI) { - var rExt = posRad[innI * itemSize + 3] += probeRadius; - - if (rExt > maxRadius) { - maxRadius = rExt; - } - - r2[innI] = rExt * rExt; - } - - initializeGrid(); - initializeAngleTables(); - initializeHash(); - lastClip = -1; - } - - function singleAtomObscures(ai, innX, innY, innZ) { - var innCI = itemSize * ai; - var ra2 = r2[ai]; - var dx = posRad[innCI] - innX; - var dy = posRad[innCI + 1] - innY; - var dz = posRad[innCI + 2] - innZ; - var d2 = dx * dx + dy * dy + dz * dz; - return d2 < ra2; - } - - function obscured(innX, innY, innZ, a, b) { - // Is the point at x,y,z obscured by any of the atoms - // specifeid by indices in neighbours. Ignore indices - // a and b (these are the relevant atoms in projectPoints/Torii) - // Cache the last clipped atom (as very often the same one in - // subsequent calls) - var ai; - - if (lastClip !== -1) { - ai = lastClip; - - if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) { - return ai; - } - - lastClip = -1; - } - - var ni = 0; - ai = neighbours[ni]; - - while (ai >= 0) { - if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) { - lastClip = ai; - return ai; - } - - ai = neighbours[++ni]; - } - - lastClip = -1; - return -1; - } - - function projectPoints() { - // For each atom: - // Iterate over a subsection of the grid, for each point: - // If current value < 0.0, unvisited, set positive - // - // In any case: Project this point onto surface of the atomic sphere - // If this projected point is not obscured by any other atom - // Calcualte delta distance and set grid value to minimum of - // itself and delta - // Should we alias frequently accessed closure constiables?? - // Assume JS engine capable of optimizing this - // anyway... - var maxRad = 4.0; - var sigma = maxRad / 3; - var sigma2Inv = 1 / (2 * sigma * sigma); - - for (var innI = 0; innI < nAtoms; innI++) { - var innCI = itemSize * innI; - var ax = posRad[innCI]; - var ay = posRad[innCI + 1]; - var az = posRad[innCI + 2]; - var ar = posRad[innCI + 3]; - var ar2 = r2[innI]; - hash.withinRadii(ax, ay, az, ar, neighbours); // Number of grid points, round this up... - - var ng = Math.ceil(ar * scaleFactor); // Center of the atom, mapped to grid points (take floor) - - var iax = Math.floor(scaleFactor * (ax - min[0])); - var iay = Math.floor(scaleFactor * (ay - min[1])); - var iaz = Math.floor(scaleFactor * (az - min[2])); // Extents of grid to consider for this atom - - var minx = Math.max(0, iax - ng); - var miny = Math.max(0, iay - ng); - var minz = Math.max(0, iaz - ng); // Add two to these points: - // - iax are floor'd values so this ensures coverage - // - these are loop limits (exclusive) - - var maxx = Math.min(dim[0], iax + ng + 2); - var maxy = Math.min(dim[1], iay + ng + 2); - var maxz = Math.min(dim[2], iaz + ng + 2); - var colIdx = innI * 3; - var cr = colors[colIdx]; - var cg = colors[colIdx + 1]; - var cb = colors[colIdx + 2]; - - for (var iz = minz; iz < maxz; iz++) { - var dz = gridz[iz] - az; - var zOffset = dim[1] * dim[0] * iz; - - for (var iy = miny; iy < maxy; iy++) { - var dy = gridy[iy] - ay; - var dzy2 = dz * dz + dy * dy; - var zyOffset = zOffset + dim[0] * iy; - - for (var ix = minx; ix < maxx; ix++) { - var idx = ix + zyOffset; - var dx = gridx[ix] - ax; - var d2 = dzy2 + dx * dx; - - if (d2 < ar2) { - var w = Math.exp(-d2 * sigma2Inv); - var cIdx = idx * 3; - volTex[cIdx] += cr * w; - volTex[cIdx + 1] += cg * w; - volTex[cIdx + 2] += cb * w; - weights[idx] += w; - - if (visibilitySelector !== null && w > weightsMap[idx]) { - weightsMap[idx] = w; - atomMap[idx] = atoms[innI]; - } - - if (grid[idx] < 0.0) { - // Unvisited, make positive - grid[idx] = -grid[idx]; - } // Project on to the surface of the sphere - // sp is the projected point ( dx, dy, dz ) * ( ra / d ) - - - var d = Math.sqrt(d2); - var ap = ar / d; - var spx = dx * ap; - var spy = dy * ap; - var spz = dz * ap; - spx += ax; - spy += ay; - spz += az; - - if (obscured(spx, spy, spz, innI, -1) === -1) { - var dd = ar - d; - - if (dd < grid[idx]) { - grid[idx] = dd; - } - } - } - } - } - } - } - } - - function normalToLine(out, p) { - out.x = out.y = out.z = 1.0; - - if (p.x !== 0) { - out.x = (p.y + p.z) / -p.x; - } else if (p.y !== 0) { - out.y = (p.x + p.z) / -p.y; - } else if (p.z !== 0) { - out.z = (p.x + p.y) / -p.z; - } - - return out; - } - - function projectTorus(a, b) { - var aIdx = itemSize * a; - var bIdx = itemSize * b; - var xa = posRad[aIdx]; - var ya = posRad[aIdx + 1]; - var za = posRad[aIdx + 2]; - var r1 = posRad[aIdx + 3]; - var dx = mid.x = posRad[bIdx] - xa; - var dy = mid.y = posRad[bIdx + 1] - ya; - var dz = mid.z = posRad[bIdx + 2] - za; - var innR2 = posRad[bIdx + 3]; - var d2 = dx * dx + dy * dy + dz * dz; // This check now redundant as already done in AVHash.withinRadii - // if( d2 > (( r1 + r2 ) * ( r1 + r2 )) ){ return; } - - var d = Math.sqrt(d2); // Find angle between a->b vector and the circle - // of their intersection by cosine rule - - var cosA = (r1 * r1 + d * d - innR2 * innR2) / (2.0 * r1 * d); // distance along a->b at intersection - - var dmp = r1 * cosA; - mid.normalize(); // Create normal to line - - normalToLine(n1, mid); - n1.normalize(); // Cross together for second normal vector - - n2.crossVectors(mid, n1); - n2.normalize(); // r is radius of circle of intersection - - var rInt = Math.sqrt(r1 * r1 - dmp * dmp); - n1.multiplyScalar(rInt); - n2.multiplyScalar(rInt); - mid.multiplyScalar(dmp); - mid.x += xa; - mid.y += ya; - mid.z += za; - lastClip = -1; - var ng = ngTorus; - - for (var innI = 0; innI < probePositions; innI++) { - var cost = cosTable[innI]; - var sint = sinTable[innI]; - var px = mid.x + cost * n1.x + sint * n2.x; - var py = mid.y + cost * n1.y + sint * n2.y; - var pz = mid.z + cost * n1.z + sint * n2.z; - - if (obscured(px, py, pz, a, b) === -1) { - // As above, iterate over our grid... - // px, py, pz in grid coords - var iax = Math.floor(scaleFactor * (px - min[0])); - var iay = Math.floor(scaleFactor * (py - min[1])); - var iaz = Math.floor(scaleFactor * (pz - min[2])); - var minx = Math.max(0, iax - ng); - var miny = Math.max(0, iay - ng); - var minz = Math.max(0, iaz - ng); - var maxx = Math.min(dim[0], iax + ng + 2); - var maxy = Math.min(dim[1], iay + ng + 2); - var maxz = Math.min(dim[2], iaz + ng + 2); - - for (var iz = minz; iz < maxz; iz++) { - dz = pz - gridz[iz]; - var zOffset = dim[1] * dim[0] * iz; - - for (var iy = miny; iy < maxy; iy++) { - dy = py - gridy[iy]; - var dzy2 = dz * dz + dy * dy; - var zyOffset = zOffset + dim[0] * iy; - - for (var ix = minx; ix < maxx; ix++) { - dx = px - gridx[ix]; - d2 = dzy2 + dx * dx; - var idx = ix + zyOffset; - var current = grid[idx]; - - if (current > 0.0 && d2 < current * current) { - grid[idx] = Math.sqrt(d2); - } - } - } - } - } - } - } - - function projectTorii() { - for (var innI = 0; innI < nAtoms; innI++) { - var innIdx = itemSize * innI; - hash.withinRadii(posRad[innIdx], posRad[innIdx + 1], posRad[innIdx + 2], posRad[innIdx + 3], neighbours); - var ia = 0; - var ni = neighbours[ia]; - - while (ni >= 0) { - if (innI < ni) { - projectTorus(innI, ni); - } - - ni = neighbours[++ia]; - } - } - } - - function fixNegatives() { - for (var innI = 0, n = grid.length; innI < n; innI++) { - if (grid[innI] < 0) grid[innI] = 0; - var w = weights[innI]; - - if (w > 0) { - w = 1 / w; - var innInnI = innI * 3; - volTex[innInnI] *= w; - volTex[innInnI + 1] *= w; - volTex[innInnI + 2] *= w; - } - } - } - - function getVolume() { - // Basic steps are: - // 1) Initialize - // 2) Project points - // 3) Project torii - console.time('ContactSurface.getVolume'); - console.time('ContactSurface.init'); - init(); - console.timeEnd('ContactSurface.init'); - console.time('ContactSurface.projectPoints'); - projectPoints(); - console.timeEnd('ContactSurface.projectPoints'); - console.time('ContactSurface.projectTorii'); - projectTorii(); - console.timeEnd('ContactSurface.projectTorii'); - fixNegatives(); - console.timeEnd('ContactSurface.getVolume'); - } - - this.build = function () { - // type and cutoff left in for compatibility with EDTSurface.getSurface - // function signature - getVolume(); - this.volTexMap = volTex; - this.weightsMap = weightsMap; - this.atomMap = atomMap; - this.volMap = grid; - }; -} - -var Volume$2 = chem.Volume; -/** - * This class implements 'contact' isosurface geometry generation algorithm. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - -var ContactSurfaceGeometry = /*#__PURE__*/function (_VolumeSurfaceGeometr) { - inherits(ContactSurfaceGeometry, _VolumeSurfaceGeometr); - - function ContactSurfaceGeometry() { - classCallCheck(this, ContactSurfaceGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(ContactSurfaceGeometry).apply(this, arguments)); - } - - createClass(ContactSurfaceGeometry, [{ - key: "_computeSurface", - value: function _computeSurface(packedArrays, box, boundaries, params) { - var contactSurface = new ContactSurface(packedArrays, boundaries, params); - contactSurface.build(); - var surface = { - volMap: new Volume$2(Float32Array, this.numVoxels, box, 1, contactSurface.volMap), - volTexMap: new Volume$2(Float32Array, this.numVoxels, box, 3, contactSurface.volTexMap), - atomMap: contactSurface.atomMap, - atomWeightMap: new Volume$2(Float32Array, this.numVoxels, box, 1, contactSurface.weightsMap) - }; - return surface; - } - }]); - - return ContactSurfaceGeometry; -}(VolumeSurfaceGeometry); - -/** - * Class for colored atom. Need for atom structure clusterization - * - * @param {Vector3} vCenter Center of atom - * @param {number} radiusAt Radius of atom - */ - -var IsoSurfaceAtomColored = function IsoSurfaceAtomColored(vCenter, radiusAt) { - classCallCheck(this, IsoSurfaceAtomColored); - - this.coord = new Vector3(); - this.coord.copy(vCenter); - this.radius = radiusAt; - this.colorX = 0.99999; - this.colorY = 0.0; - this.colorZ = 0.0; - this.atomType = 0; - this.srcAtom = null; -}; - -/* jshint bitwise: false */ - -/** - * Build normals for isosurface, using atoms information - * - * @param {number} numAtoms - Number of atoms in molecule - * @param {Element} atoms - Array of atoms - * @param {Vector3} vBoxMin - Bounding box min - * @param {Vector3} vBoxMax - Bounding box max - * @param {number} probeRadius - Normals for output - * - */ - -var IsosurfaceBuildNormals = /*#__PURE__*/function () { - function IsosurfaceBuildNormals(numAtoms, atoms, vBoxMin, vBoxMax, probeRadius) { - classCallCheck(this, IsosurfaceBuildNormals); - - this._numAtoms = numAtoms; - this._atoms = atoms; - this._vBoxMin = new Vector3(); - this._vBoxMax = new Vector3(); - - this._vBoxMin.copy(vBoxMin); - - this._vBoxMax.copy(vBoxMax); - - this._probeRadius = probeRadius; - this._atomsList = null; - this._voxelList = null; - } - - createClass(IsosurfaceBuildNormals, [{ - key: "createVoxels", - value: function createVoxels() { - var numAtomsRefs; - var rad; - var ATOM_VOXEL_REF_SCALE = 4.5; - var numAtoms = this._numAtoms | 0; - var atoms = this._atoms; - var dx = this._vBoxMax.x - this._vBoxMin.x; - var dy = this._vBoxMax.y - this._vBoxMin.y; - var dz = this._vBoxMax.z - this._vBoxMin.z; - var w = dx < dy ? dx : dy; - w = dz < w ? dz : w; - var maxRad = 0.0; - var aveRad = 0.0; - var i; - - for (i = 0; i < numAtoms; i++) { - rad = (atoms[i].radius + this._probeRadius) * 2.0; - maxRad = rad > maxRad ? rad : maxRad; - aveRad += rad; - } - - var numCells = Math.floor(w / maxRad); - - if (numCells < 2) { - numCells = 2; - } - - aveRad /= numAtoms; - this._numCells = numCells; - this._aveRad = aveRad; - this._maxRad = maxRad; - var side = numCells; - var side2 = numCells * numCells; - var side3 = numCells * numCells * numCells; - var xScale = this._xScale = 1.0 / (this._vBoxMax.x - this._vBoxMin.x); - var yScale = this._yScale = 1.0 / (this._vBoxMax.y - this._vBoxMin.y); - var zScale = this._zScale = 1.0 / (this._vBoxMax.z - this._vBoxMin.z); // estimate number of individual atom refs in each voxel list - - var maxAtomsRefs = 0; - var xNumVoxMult = xScale * numCells; - var yNumVoxMult = yScale * numCells; - var zNumVoxMult = zScale * numCells; - - for (i = 0; i < numAtoms; i++) { - var radAffect = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE; - var diaAffect = radAffect * 2.0; - var numVoxX = Math.floor(xNumVoxMult * diaAffect + 0.8); - var numVoxY = Math.floor(yNumVoxMult * diaAffect + 0.8); - var numVoxZ = Math.floor(zNumVoxMult * diaAffect + 0.8); // avoid case numVox? == 0 - // also use loop i <= - - numVoxX++; - numVoxY++; - numVoxZ++; - maxAtomsRefs += numVoxX * numVoxY * numVoxZ; - } // for (i) - // maxAtomsRefs = numAtoms * MAX_ATOMS_IN_SINGLE_VOXEL; - - - this._voxelList = utils.allocateTyped(Int32Array, side3); - var atomsList = []; - atomsList.length = maxAtomsRefs; - - if (this._voxelList === null || atomsList === null) { - return 0 - 1; - } // init voxel list - - - for (i = 0; i < side3; i++) { - this._voxelList[i] = -1; - } - - numAtomsRefs = 0; // create voxel lists - - for (i = 0; i < numAtoms; i++) { - // use multiplier 4 to locate this atom in different voxels - rad = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE; - var xIndMin = Math.floor((atoms[i].coord.x - this._vBoxMin.x - rad) * numCells * xScale); - var yIndMin = Math.floor((atoms[i].coord.y - this._vBoxMin.y - rad) * numCells * yScale); - var zIndMin = Math.floor((atoms[i].coord.z - this._vBoxMin.z - rad) * numCells * zScale); - var xIndMax = Math.floor((atoms[i].coord.x - this._vBoxMin.x + rad) * numCells * xScale); - var yIndMax = Math.floor((atoms[i].coord.y - this._vBoxMin.y + rad) * numCells * yScale); - var zIndMax = Math.floor((atoms[i].coord.z - this._vBoxMin.z + rad) * numCells * zScale); - xIndMin = xIndMin >= 0 ? xIndMin : 0; - yIndMin = yIndMin >= 0 ? yIndMin : 0; - zIndMin = zIndMin >= 0 ? zIndMin : 0; - xIndMax = xIndMax < numCells ? xIndMax : numCells - 1; - yIndMax = yIndMax < numCells ? yIndMax : numCells - 1; - zIndMax = zIndMax < numCells ? zIndMax : numCells - 1; - - for (var z = zIndMin; z <= zIndMax; z++) { - for (var y = yIndMin; y <= yIndMax; y++) { - for (var x = xIndMin; x <= xIndMax; x++) { - // add atom with index "i" to this voxel list - var indVoxel = x + y * side + z * side2; // assert indVoxel >= 0 - // assert indVoxel < side3 - // add first - - if (this._voxelList[indVoxel] < 0) { - atomsList[numAtomsRefs * 2 + 0] = i; - atomsList[numAtomsRefs * 2 + 1] = 0 - 1; - this._voxelList[indVoxel] = numAtomsRefs; - numAtomsRefs++; // assert numAtomsRefs < maxAtomsRefs - 1 - - continue; - } // insert into head of list - - - var indexNext = this._voxelList[indVoxel]; - this._voxelList[indVoxel] = numAtomsRefs; - atomsList[numAtomsRefs * 2 + 0] = i; - atomsList[numAtomsRefs * 2 + 1] = indexNext; - numAtomsRefs++; - } // for (x) - - } // for (y) - - } // for (z) - - } // for (i) - // convert Array to Int32Array - - - this._atomsList = Int32Array.from(atomsList); - return 0; - } - }, { - key: "destroyVoxels", - value: function destroyVoxels() { - this._atomsList = null; - this._voxelList = null; - this._atoms = null; - this._vertices = null; - this._vBoxMin = null; - this._vBoxMax = null; - } - /** - * Enumerate all atoms affecting specified point - * - * @param {Vector3} point - point in 3D - * @param {func(atom)} process - function to call for each atom - */ - - }, { - key: "forEachRelatedAtom", - value: function forEachRelatedAtom(point, process) { - // find corresponding voxel - var xInd = Math.floor((point.x - this._vBoxMin.x) * this._numCells * this._xScale); - var yInd = Math.floor((point.y - this._vBoxMin.y) * this._numCells * this._yScale); - var zInd = Math.floor((point.z - this._vBoxMin.z) * this._numCells * this._zScale); - var indVoxel = xInd + yInd * this._numCells + zInd * this._numCells * this._numCells; // run through atoms affecting this voxel - - var atoms = this._atoms; - - for (var ref = this._voxelList[indVoxel]; ref >= 0; ref = this._atomsList[ref * 2 + 1]) { - var indexAtom = this._atomsList[ref * 2]; - process(atoms[indexAtom]); - } - } - /** - * Get atom closest to specified point - * - * @param {Vector3} point - point in 3D - * - * @returns {IsoSurfaceAtomColored} atom, or null if not found - */ - - }, { - key: "getClosestAtom", - value: function getClosestAtom(point) { - var closest = null; - var minDist2 = Number.MAX_VALUE; - this.forEachRelatedAtom(point, function (atom) { - var dist2 = point.distanceToSquared(atom.coord); - - if (dist2 < minDist2) { - minDist2 = dist2; - closest = atom; - } - }); - return closest; - } - /** - * Build normals for isosurface, using atoms information - * - * @param {number} numVertices - Number of vertices in final geometry (to render) - * @param {Vector3} vertices - Geometry vertices (3d coordinates array) - * @param {Vector3} normals - Normals for output - * - * @returns {number} 0, if success - */ - - }, { - key: "buildNormals", - value: function buildNormals(numVertices, vertices, normals) { - var self = this; - var numCloseAtoms = 0; - var vx = 0; - var vy = 0; - var vz = 0; - var dist2; - var vNormalX = 0; - var vNormalY = 0; - var vNormalZ = 0; - var koef = 0; - var w = 0; - var r25 = 2.5; - var r01 = 0.1; - var maxRadAffect = this._aveRad * r25; - var maxRadAffect2 = maxRadAffect * maxRadAffect; - var expScale = -this._aveRad * r01; // some stats - // numSlowAtoms = 0; - - var gatherNormals = function gatherNormals(atom) { - var dx = vx - atom.coord.x; - var dy = vy - atom.coord.y; - var dz = vz - atom.coord.z; - dist2 = dx * dx + dy * dy + dz * dz; - - if (dist2 > maxRadAffect2) { - return; - } // get weight for gaussian smoothing - - - var rad = atom.radius + self._probeRadius; - koef = dist2 - rad * rad; - - if (koef < 0.0) { - koef = -koef; - } - - w = Math.exp(expScale * koef); - vNormalX += dx * w; - vNormalY += dy * w; - vNormalZ += dz * w; - numCloseAtoms++; - }; - - for (var i = 0; i < numVertices; i++) { - vx = vertices[i].x; - vy = vertices[i].y; - vz = vertices[i].z; - numCloseAtoms = 0; - vNormalX = vNormalY = vNormalZ = 0.0; - this.forEachRelatedAtom(vertices[i], gatherNormals); - - dist2 = vNormalX * vNormalX + vNormalY * vNormalY + vNormalZ * vNormalZ; - - if (numCloseAtoms > 0) { - koef = 1.0 / Math.sqrt(dist2); - vNormalX *= koef; - vNormalY *= koef; - vNormalZ *= koef; - } - - normals[i].x = vNormalX; - normals[i].y = vNormalY; - normals[i].z = vNormalZ; - } // for (i) all vertices - - - return 0; - } - /** - * Build vertex colors for isosurface, using atoms information - * - * @param {number} numVertices - Number of vertices in final geometry (to render) - * @param {Vector3} vertices - Geometry vertices (3d coordinates array) - * @param {Vector3} colors - Colors for output - * @param {number} radiusColorSmoothness - Radius of smoothness sphere - * - * @returns {number} 0, if success - */ - - }, { - key: "buildColors", - value: function buildColors(numVertices, vertices, colors, radiusColorSmoothness) { - var self = this; - var vx = 0.0; - var vy = 0.0; - var vz = 0.0; - var koef = 0.0; - var w = 0.0; - var KOEF_ADD = 0.8; - var maxRadAffect = radiusColorSmoothness; - var maxRadAffect2 = maxRadAffect * maxRadAffect; - var colorsClose = []; - var weights = []; - var weightsSum = 0; - - var gatherColors = function gatherColors(atom) { - var dx = vx - atom.coord.x; - var dy = vy - atom.coord.y; - var dz = vz - atom.coord.z; - var dist2 = dx * dx + dy * dy + dz * dz; - - if (dist2 > maxRadAffect2) { - return; - } // get weight for gaussian smoothing - - - var rad = atom.radius + self._probeRadius; - koef = dist2 - rad * rad; - - if (koef < 0.0) { - koef = -koef; - } - - w = 1.0 / (KOEF_ADD + koef); - colorsClose.push([atom.colorX, atom.colorY, atom.colorZ]); - weights.push(w); // save weights for use - - weightsSum += w; // calc sum of weights fo further normalization - }; // process all vertices, one by one - - - for (var i = 0; i < numVertices; i++) { - vx = vertices[i].x; - vy = vertices[i].y; - vz = vertices[i].z; - colorsClose = []; - weights = []; - weightsSum = 0; - this.forEachRelatedAtom(vertices[i], gatherColors); // normalized weighted sum of colors - - for (var j = 0; j < colorsClose.length; ++j) { - var weightNormalized = weights[j] / weightsSum; - colors[i].x += colorsClose[j][0] * weightNormalized; - colors[i].y += colorsClose[j][1] * weightNormalized; - colors[i].z += colorsClose[j][2] * weightNormalized; - } - } // for (i) all vertices - - - return 0; - } - }]); - - return IsosurfaceBuildNormals; -}(); - -/** - * Class for geometry (triangle mesh) representation - * - * - * @param {number} maxNumVertices Maximum possible number of vertices in mesh - * @param {number} maxNumTriangles Maximum possible number of triangles in mesh - * @param {boolean} needVertexColors Obvious - */ - -var IsoSurfaceGeo = /*#__PURE__*/function () { - function IsoSurfaceGeo(maxNumVertices, maxNumTriangles, needVertexColors) { - classCallCheck(this, IsoSurfaceGeo); - - this._maxNumVertices = maxNumVertices; - this._maxNumTriangles = maxNumTriangles; - this._vertices = new Array(maxNumVertices); - this._normals = new Array(maxNumVertices); - this._colors = null; - - if (needVertexColors) { - this._colors = new Array(maxNumVertices); - } - - this._indices = new Array(maxNumTriangles * (1 + 2)); - this._numVertices = 0; - this._numTriangles = 0; - var i; - - for (i = 0; i < maxNumVertices; i++) { - this._vertices[i] = new Vector3(); - this._normals[i] = new Vector3(); - } - - for (i = 0; i < maxNumTriangles * (1 + 2); i++) { - this._indices[i] = -1; - } - - if (needVertexColors) { - for (i = 0; i < maxNumVertices; i++) { - this._colors[i] = new Vector3(); - } - } - } - - createClass(IsoSurfaceGeo, [{ - key: "destroy", - value: function destroy() { - this._vertices = null; - this._normals = null; - this._indices = null; - } - }]); - - return IsoSurfaceGeo; -}(); - -var COLOR_SIZE$3 = 3; -var HASH_SIZE = 32768; -var Element$1 = chem.Element; -/** - * This class implements 'quick' isosurface geometry generation algorithm. - * @param spheresCount - number of atoms/spheres - * @param opts - geometry specific options - * @constructor - */ - -var SSIsosurfaceGeometry = /*#__PURE__*/function (_IsoSurfaceGeometry) { - inherits(SSIsosurfaceGeometry, _IsoSurfaceGeometry); - - function SSIsosurfaceGeometry() { - classCallCheck(this, SSIsosurfaceGeometry); - - return possibleConstructorReturn(this, getPrototypeOf(SSIsosurfaceGeometry).apply(this, arguments)); - } - - createClass(SSIsosurfaceGeometry, [{ - key: "_build", - value: function _build() { - // convert geoOut into arrays of positions, indices, normals - this._innerBuild(); - - var geoOut = this.getGeo(); - this.destroy(); - - this._fromGeo(geoOut); - } - }, { - key: "_fromGeo", - value: function _fromGeo(geoOut) { - var colors = null; - var positions = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); - var normals = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); - - if (geoOut._colors !== null) { - colors = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); - } - - var indices = utils.allocateTyped(Uint32Array, (1 + 2) * geoOut._numTriangles); - - for (var i = 0, j = 0; i < geoOut._numVertices; i++) { - positions[j + 0] = geoOut._vertices[i].x; - positions[j + 1] = geoOut._vertices[i].y; - positions[j + 2] = geoOut._vertices[i].z; - normals[j + 0] = geoOut._normals[i].x; - normals[j + 1] = geoOut._normals[i].y; - normals[j + 2] = geoOut._normals[i].z; - j += 3; - } - - if (colors !== null) { - for (var _i = 0, _j = 0; _i < geoOut._numVertices; _i++, _j += 3) { - colors[_j + 0] = geoOut._colors[_i].x; - colors[_j + 1] = geoOut._colors[_i].y; - colors[_j + 2] = geoOut._colors[_i].z; - } - } - - var numTri3 = geoOut._numTriangles * (1 + 2); - - for (var _i2 = 0; _i2 < numTri3; _i2++) { - indices[_i2] = geoOut._indices[_i2]; - } - - this.setIndex(new BufferAttribute(indices, 1)); - this.setAttribute('position', new BufferAttribute(positions, 3)); - this.setAttribute('normal', new BufferAttribute(normals, 3)); - this.setAttribute('color', new BufferAttribute(colors, 3)); - this.computeBoundingBox(); - this.computeBoundingSphere(); - geoOut.destroy(); - } - }, { - key: "convertToAtomsColored", - value: function convertToAtomsColored(packedArrays, atomsColored) { - var atoms = packedArrays.atoms, - colors = packedArrays.colors; - - for (var i = 0, numAtoms = atoms.length; i < numAtoms; i++) { - var vCenter = atoms[i].position; - var radius = atoms[i].element.radius; - atomsColored[i] = new IsoSurfaceAtomColored(vCenter, radius); - var nm = atoms[i].element.number; - atomsColored[i].atomType = this.getType(nm); - var cIdx = COLOR_SIZE$3 * i; - atomsColored[i].colorX = colors[cIdx++]; - atomsColored[i].colorY = colors[cIdx++]; - atomsColored[i].colorZ = colors[cIdx]; - atomsColored[i].srcAtom = atoms[i]; - } - } - }, { - key: "getGeo", - value: function getGeo() { - return this.geoOut; - } - }, { - key: "destroy", - value: function destroy() { - this.atoms = null; - this.hashLines = null; - this.hashEntries = null; - } - /** - * Calculates bounding box for array with spheres (atoms) - * - * @param {Object} atoms Atoms array - * @param {Vector3} vBoxMin Bounding box min point - * @param {Vector3} vBoxMax Bounding box max point - */ - - }, { - key: "getBoundingBox", - value: function getBoundingBox(atoms, vBoxMin, vBoxMax) { - var bigNum = 10000000.0; - vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum; - vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum; - var probeRadius2 = this.probeRadius * this.atomRadiusScale; - var radMax = 0.0; - - for (var i = 0, num = atoms.length; i < num; i++) { - var vCenter = atoms[i].coord; - var rad = atoms[i].radius + probeRadius2; - radMax = rad > radMax ? rad : radMax; - - if (vCenter.x - rad < vBoxMin.x) { - vBoxMin.x = vCenter.x - rad; - } - - if (vCenter.y - rad < vBoxMin.y) { - vBoxMin.y = vCenter.y - rad; - } - - if (vCenter.z - rad < vBoxMin.z) { - vBoxMin.z = vCenter.z - rad; - } - - if (vCenter.x + rad > vBoxMax.x) { - vBoxMax.x = vCenter.x + rad; - } - - if (vCenter.y + rad > vBoxMax.y) { - vBoxMax.y = vCenter.y + rad; - } - - if (vCenter.z + rad > vBoxMax.z) { - vBoxMax.z = vCenter.z + rad; - } - } - - vBoxMin.x -= radMax; - vBoxMin.y -= radMax; - vBoxMin.z -= radMax; - vBoxMax.x += radMax; - vBoxMax.y += radMax; - vBoxMax.z += radMax; - } - /** - * Calculate (x,y,z) cordinate of the cell corner point - * - * @param {Vector3} vBoxMin Bounding box min point - * @param {Vector3} vBoxMax Bounding box max point - * @param {number} x Cell integer x coordinate - * @param {number} y Cell integer y coordinate - * @param {number} z Cell integer z coordinate - * @param {number} numPoints NUm points in cell on side - * @param {Vector3} vOut Output vector - */ - - }, { - key: "getCornerCoord", - value: function getCornerCoord(vBoxMin, vBoxMax, x, y, z, numPoints, vOut) { - var invNP = 1.0 / (numPoints - 1.0); - var tx = x * invNP; - var ty = y * invNP; - var tz = z * invNP; - vOut.x = vBoxMin.x * (1.0 - tx) + vBoxMax.x * tx; - vOut.y = vBoxMin.y * (1.0 - ty) + vBoxMax.y * ty; - vOut.z = vBoxMin.z * (1.0 - tz) + vBoxMax.z * tz; - } - /** - * Calculate point of intersection of sphere surface - * and cell edge, given by [indexA, indexB] line - * - * @param {number} indexA Cell vertex index in [0..11] - * @param {number} indexB Cell vertex index in [0..11] - * @param {array} sign Sign array for all 8 vertices - * @param {object} cube Cube - * @param {number} indexPointValue for value placement - * @param {Vector3} vOut Point of intersection - */ - - }, { - key: "buildEdgePoint", - value: function buildEdgePoint(indexA, indexB, sign, cube, indexPointValue, vOut) { - if (sign[indexA] ^ sign[indexB]) { - var cTwentyFour = 24; - var t = (0 - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]) / (cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexB] - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]); - var xa = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 0]; - var ya = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 1]; - var za = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 2]; - var xb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 0]; - var yb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 1]; - var zb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 2]; - vOut.x = xa * (1.0 - t) + xb * t; - vOut.y = ya * (1.0 - t) + yb * t; - vOut.z = za * (1.0 - t) + zb * t; - } - } - /** - * Check if triangle is visible (vertices are close to atoms included in visibility set) - * - * @param {Vector3} v0 Vertex #0 - * @param {Vector3} v1 Vertex #1 - * @param {Vector3} v2 Vertex #2 - * @returns {boolean} true if triangle is visible - */ - - }, { - key: "isTriangleVisible", - value: function isTriangleVisible(v0, v1, v2) { - var a0 = this.voxelWorld.getClosestAtom(v0); - var a1 = this.voxelWorld.getClosestAtom(v1); - var a2 = this.voxelWorld.getClosestAtom(v2); - - if (a0 === null || a1 === null || a2 === null || a0.srcAtom === null || a1.srcAtom === null || a2.srcAtom === null) { - return false; - } - - return this.visibilitySelector.includesAtom(a0.srcAtom) && this.visibilitySelector.includesAtom(a1.srcAtom) && this.visibilitySelector.includesAtom(a2.srcAtom); - } - /** - * Add triangle to result geometry - * - * @param {Vector3} v0 Vertex #0 - * @param {Vector3} v1 Vertex #1 - * @param {Vector3} v2 Vertex #2 - * @returns {boolean} false if no more triangles can be added - */ - - }, { - key: "addTriangle", - value: function addTriangle(v0, v1, v2) { - if (this.visibilitySelector && !this.isTriangleVisible(v0, v1, v2)) { - return true; - } - - var geo = this.geoOut; - - if (geo._numTriangles >= this.maxNumTriangles) { - return false; - } // Add vertex with optimize - - - var indInGeo0 = this.addVertexToGeo(geo, v0); - var indInGeo1 = this.addVertexToGeo(geo, v1); - var indInGeo2 = this.addVertexToGeo(geo, v2); - - if ((indInGeo0 | indInGeo1 | indInGeo2) < 0) { - return false; - } - - var itr = 3 * geo._numTriangles; - geo._indices[itr + 0] = indInGeo0; - geo._indices[itr + 1] = indInGeo1; - geo._indices[itr + 2] = indInGeo2; - geo._numTriangles++; - return true; - } - /** - * Build result geometry (triangle mesh) from marching cube cells - * - * @param {number} meshRes Marchnig cube vertex count on each side - * @param {Vector3} vBoxMin Bounding box point min - * @param {Vector3} vBoxMax Bounding box point max - * @param {number} corners float values array for each cube point - * @param {Vector3} vCellStep vector to next cube cell diagonal point - * @param {object} cube IsoSurfaceMarchCube object - * @returns {number} 0, if success (<0) is error - */ - - }, { - key: "buildGeoFromCorners", - value: function buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) { - var arrSize = 12; - var cNumVerts = 8; - var numCells = meshRes - 1; - var side = meshRes; - var side2 = meshRes * meshRes; - var vaEdges = new Array(arrSize); - - for (var i = 0; i < arrSize; i++) { - vaEdges[i] = new Vector3(); - } - - var sign = []; - - for (var _i3 = 0; _i3 < cNumVerts; _i3++) { - sign[_i3] = 1.0; - } - - var vCorner = new Vector3(); - var indCell = 0; - var indY = 0; - - for (var y = 0; y < numCells; y++, indY += side2) { - var indZ = 0; - - for (var z = 0; z < numCells; z++, indZ += side) { - for (var x = 0; x < numCells; x++) { - if (!cube.hasIntersection[indCell]) { - // next cell - indCell++; - continue; - } - - var bitsInside = cube.bitsInside[indCell]; - this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, meshRes, vCorner); - var indPointValues = indCell * (2 << 2 + 2); - - for (var _i4 = 0, j = 0; _i4 < cNumVerts; _i4++) { - cube.pointsValuesLinear[indPointValues + j++] = vCorner.x; - cube.pointsValuesLinear[indPointValues + j++] = vCorner.y; - cube.pointsValuesLinear[indPointValues + j++] = vCorner.z; - } - - cube.pointsValuesLinear[indPointValues + 3] += vCellStep.x; - cube.pointsValuesLinear[indPointValues + 2 * 3] += vCellStep.x; - cube.pointsValuesLinear[indPointValues + 5 * 3] += vCellStep.x; - cube.pointsValuesLinear[indPointValues + 6 * 3] += vCellStep.x; - cube.pointsValuesLinear[indPointValues + 2 * 3 + 2] += vCellStep.z; - cube.pointsValuesLinear[indPointValues + 3 * 3 + 2] += vCellStep.z; - cube.pointsValuesLinear[indPointValues + 6 * 3 + 2] += vCellStep.z; - cube.pointsValuesLinear[indPointValues + 7 * 3 + 2] += vCellStep.z; - cube.pointsValuesLinear[indPointValues + 4 * 3 + 1] += vCellStep.y; - cube.pointsValuesLinear[indPointValues + 5 * 3 + 1] += vCellStep.y; - cube.pointsValuesLinear[indPointValues + 6 * 3 + 1] += vCellStep.y; - cube.pointsValuesLinear[indPointValues + 7 * 3 + 1] += vCellStep.y; // now current cell has intersections (from -x to +x) on some cube edges - - var indValues = indPointValues + 24; - - for (var _i5 = 0; _i5 < cNumVerts; ++_i5) { - sign[_i5] = cube.pointsValuesLinear[indValues + _i5] < 0.0 ? 1 : 0; - } - - this.buildEdgePoint(0, 1, sign, cube, indPointValues, vaEdges[0]); - this.buildEdgePoint(1, 2, sign, cube, indPointValues, vaEdges[1]); - this.buildEdgePoint(2, 3, sign, cube, indPointValues, vaEdges[2]); - this.buildEdgePoint(3, 0, sign, cube, indPointValues, vaEdges[3]); - this.buildEdgePoint(4, 5, sign, cube, indPointValues, vaEdges[4]); - this.buildEdgePoint(5, 6, sign, cube, indPointValues, vaEdges[5]); - this.buildEdgePoint(6, 7, sign, cube, indPointValues, vaEdges[6]); - this.buildEdgePoint(7, 4, sign, cube, indPointValues, vaEdges[7]); - this.buildEdgePoint(0, 4, sign, cube, indPointValues, vaEdges[8]); - this.buildEdgePoint(1, 5, sign, cube, indPointValues, vaEdges[9]); - this.buildEdgePoint(2, 6, sign, cube, indPointValues, vaEdges[10]); - this.buildEdgePoint(3, 7, sign, cube, indPointValues, vaEdges[11]); - var offs = bitsInside * (2 << 1 + 2); - - for (var numTri = 0, indTri = 0; numTri < 2 + 2 + 2; numTri++, indTri += 3) { - // s_triIndicesMarchCube is external array, defined in mold_ind.js - var i0 = cube.striIndicesMarchCube[offs + indTri]; - - if (i0 < 0) { - break; - } - - var i1 = cube.striIndicesMarchCube[offs + indTri + 1]; - var i2 = cube.striIndicesMarchCube[offs + indTri + 2]; - - if (!this.addTriangle(vaEdges[i0], vaEdges[i1], vaEdges[i2])) { - return 0 - 2; - } - } // for numTri - // next cell (cube) - - - indCell++; - } // for (x) - - } // for (z) - - } // for (y) - - - return 0; - } - /** - * Returns number of cell with intersection with at least one sphere. - * Using this number, we can estimate required number of vertices - * and triangles to build result mesh. - * - * @param {number} side Number of points in cube voxels - * @param {number} numCells Number of cells in cube voxels (per direction) - * @param {array} corners Array of float values for cube corner points - * @param {object} cube IsoSurfaceMarchCube object - * @returns {number} numIntersectedCells - */ - - }, { - key: "getNumIntersectedCells", - value: function getNumIntersectedCells(side, numCells, corners, cube) { - var side2 = side * side; - var cNumVerts = 8; - var numIntersectedCells = 0; - var indCell = 0; - var indY = 0; - - for (var y = 0; y < numCells; y++, indY += side2) { - var indZ = 0; - - for (var z = 0; z < numCells; z++, indZ += side) { - for (var x = 0; x < numCells; x++) { - var cubeValuesIndex = indCell * (2 << 2 + 2) + 24; - var indCorner = x + indZ + indY; - cube.pointsValuesLinear[cubeValuesIndex] = corners[indCorner]; - cube.pointsValuesLinear[cubeValuesIndex + 1] = corners[indCorner + 1]; - cube.pointsValuesLinear[cubeValuesIndex + 2] = corners[indCorner + side + 1]; - cube.pointsValuesLinear[cubeValuesIndex + 3] = corners[indCorner + side]; - cube.pointsValuesLinear[cubeValuesIndex + 4] = corners[side2 + indCorner]; - cube.pointsValuesLinear[cubeValuesIndex + 5] = corners[side2 + indCorner + 1]; - cube.pointsValuesLinear[cubeValuesIndex + 6] = corners[side2 + indCorner + side + 1]; - cube.pointsValuesLinear[cubeValuesIndex + 7] = corners[side2 + indCorner + side]; // check read exception - // assert(side2 + indCorner + side + 1 < side3); - // get bit flags inside - - var bitsInside = 0; - - for (var i = 0; i < cNumVerts; ++i) { - if (cube.pointsValuesLinear[cubeValuesIndex + i] < 0.0) { - bitsInside |= 1 << i; - } - } - - if (bitsInside === 0 || bitsInside === (1 << cNumVerts) - 1) { - cube.hasIntersection[indCell] = false; - } else { - cube.hasIntersection[indCell] = true; - numIntersectedCells++; - } - - cube.bitsInside[indCell] = bitsInside; // next cell - - indCell++; - } // for (x) - - } // for (z) - - } // for (y) - - - return numIntersectedCells; - } - }, { - key: "getType", - value: function getType(letter) { - /* eslint-disable no-magic-numbers */ - var atomT = [0, 0, 1, 1, 2, 6, 3, 6, 4, 6, 5, 6, 6, 0, 7, 3, 8, 2, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 4, 16, 5, 17, 6, 18, 6, 19, 6, 20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6, 32, 6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, 45, 6, 46, 6, 47, 6, 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, 6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6, 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6, 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, 95, 6, 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, 6, 108, 6, 109, 6]; - /* eslint-enable no-magic-numbers */ - - if (letter < 1 || letter > atomT.length / 2 || Object.keys(Element$1.ByAtomicNumber).length * 2 !== atomT.length) { - throw new Error('atomT.length should be equal Element.ByAtomicNumber.length * 2'); - } - - return atomT[letter * 2]; - } - /** - * Calculate values for marching cube grid points - * positive values are outside sphere, negative - is inside - * - * @param {array} corners array of float values - * @param {number} side Number of point in cube in 1 dimennsion - * @param {Vector3} vBoxMin Bounding box min point - * @param {Vector3} vBoxMax Bounding box max point - * @param {array} atoms Array of input atoms - * @param {number} probeRad radius for atom probing - */ - - }, { - key: "calculateGridCorners", - value: function calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) { - var side2 = side * side; - var side3 = side2 * side; - var vCorner = new Vector3(); - var vDif = new Vector3(); - /* eslint-disable no-magic-numbers */ - - var aLot = +1.0e12; - /* eslint-enable no-magic-numbers */ - - for (var i = 0; i < side3; i++) { - corners[i] = aLot; // to large value - } - - var xScale = (side - 1) / (vBoxMax.x - vBoxMin.x); - var yScale = (side - 1) / (vBoxMax.y - vBoxMin.y); - var zScale = (side - 1) / (vBoxMax.z - vBoxMin.z); - - for (var s = 0, numAtoms = atoms.length; s < numAtoms; s++) { - var atom = atoms[s]; - var radius = atom.radius + probeRad; - var fx = (atom.coord.x - radius - vBoxMin.x) * xScale; - var fy = (atom.coord.y - radius - vBoxMin.y) * yScale; - var fz = (atom.coord.z - radius - vBoxMin.z) * zScale; - var indXMin = Math.floor(fx); - var indYMin = Math.floor(fy); - var indZMin = Math.floor(fz); - var indXMax = Math.floor((atom.coord.x + radius - vBoxMin.x) * xScale); - var indYMax = Math.floor((atom.coord.y + radius - vBoxMin.y) * yScale); - var indZMax = Math.floor((atom.coord.z + radius - vBoxMin.z) * zScale); - indXMax++; - indYMax++; - indZMax++; - indXMax = indXMax <= side - 1 ? indXMax : side - 1; - indYMax = indYMax <= side - 1 ? indYMax : side - 1; - indZMax = indZMax <= side - 1 ? indZMax : side - 1; - - for (var y = indYMin; y <= indYMax; y++) { - var indY = y * side2; - - for (var z = indZMin; z <= indZMax; z++) { - var indZ = z * side; - - for (var x = indXMin; x <= indXMax; x++) { - var ind = indY + indZ + x; - this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, side, vCorner); - vDif.x = vCorner.x - atom.coord.x; - vDif.y = vCorner.y - atom.coord.y; - vDif.z = vCorner.z - atom.coord.z; - var distToSphere = Math.sqrt(vDif.x * vDif.x + vDif.y * vDif.y + vDif.z * vDif.z); // val: < 0, if inside sphere - // val: > 0, if outside sphere - - var val = distToSphere - radius; - - if (val < corners[ind]) { - corners[ind] = val; - } - } // for (x) - - } // for (z) - - } // for (y) - - } // for (s) - - } - /** - * Create memory pool for vertex hash management - * - * @param {number} maxNumVertices Maximum possible number of vertices (that will be build) - * @param {number} maxNumTriangles Maximum possible number of triangles (that will be build) - * @returns {number} 0, if success. (<0) is non memory - */ - - }, { - key: "createVertexHash", - value: function createVertexHash(maxNumVertices, maxNumTriangles) { - this.hashLines = utils.allocateTyped(Int32Array, HASH_SIZE * 2); - - if (this.hashLines === null) { - return 0 - 1; - } - - for (var i = 0, j = 0; i < HASH_SIZE; i++) { - this.hashLines[j++] = 0; // num vertices in this hash line - - this.hashLines[j++] = 0 - 1; // index of the first entry - } - - this.maxNumVertices = maxNumVertices; - this.maxNumTriangles = maxNumTriangles; - this.numHashEtriesAllocated = maxNumVertices; - this.hashEntries = utils.allocateTyped(Int32Array, 2 * this.numHashEtriesAllocated); - - if (this.hashEntries === null) { - return 0 - 1; - } - - for (var _i6 = 0, _j2 = 0; _i6 < this.numHashEtriesAllocated; _i6++) { - this.hashEntries[_j2++] = 0 - 1; // index of vertex - - this.hashEntries[_j2++] = 0 - 1; // next hash entry index - } - - this.numHashEntryIndex = 0; - return 0; - } - /** - * Allocate and return new hash entry. Just check possible amount. - * - * @returns {number} index of hash entry, that can be used for geometry add vertex functionality - */ - - }, { - key: "getNewHashEntry", - value: function getNewHashEntry() { - if (this.numHashEntryIndex < this.numHashEtriesAllocated) { - var i = this.numHashEntryIndex; - this.numHashEntryIndex++; - return i; - } - - return 0 - 1; - } - /** - * Add vertex to geometry structure - * using vertex hash table to quickly check, is this vertex already exist in geometry - * - * @param {object} geoOut Geometry to build - * @param {Vector3} vAdd Vertex to add - * @returns {number} index of added (or existing) vertex in geometry. - */ - - }, { - key: "addVertexToGeo", - value: function addVertexToGeo(geoOut, vAdd) { - var entry; - var oneHynberes = 0.01; - var n815851 = 815851; - var n37633 = 37633; - var n2453543 = 2453543; - var r106 = 1.0e-6; - var hashResolution = this.marCubeResoultion << 2; - var v = new Vector3(); - var ix = Math.floor(hashResolution * (vAdd.x - this.vBoxMin.x) / (this.vBoxMax.x + oneHynberes - this.vBoxMin.x)); - var iy = Math.floor(hashResolution * (vAdd.y - this.vBoxMin.y) / (this.vBoxMax.y + oneHynberes - this.vBoxMin.y)); - var iz = Math.floor(hashResolution * (vAdd.z - this.vBoxMin.z) / (this.vBoxMax.z + oneHynberes - this.vBoxMin.z)); - var iHash = ix * n815851 + iz * n37633 + iy * n2453543; - iHash &= HASH_SIZE - 1; - var hLineIndex = iHash + iHash; // search vertex via hash - // search in hash list - - if (this.vBoxMin !== null && this.vBoxMax !== null) { - for (entry = this.hashLines[hLineIndex + 1]; entry >= 0; entry = this.hashEntries[entry * 2 + 1]) { - var ind = this.hashEntries[entry * 2 + 0]; // vertex index - - v.copy(geoOut._vertices[ind]); - v.x -= vAdd.x; - v.y -= vAdd.y; - v.z -= vAdd.z; - var dot2 = v.x * v.x + v.y * v.y + v.z * v.z; - - if (dot2 < r106) { - return ind; - } // if (found) - - } // for (entry) - - } // search - // add new vertex to geometry - - - if (geoOut._numVertices >= this.maxNumVertices) { - return 0 - 1; - } - - var iVertAdd = geoOut._numVertices; - - geoOut._vertices[iVertAdd].copy(vAdd); // add to hash - - - if (this.vBoxMin !== null && this.vBoxMax !== null) { - entry = this.getNewHashEntry(); - - if (entry < 0) { - return 0 - 1; - } - - var entryFirst = this.hashLines[hLineIndex + 1]; - this.hashLines[hLineIndex + 1] = entry; - this.hashEntries[entry * 2 + 0] = iVertAdd; - this.hashEntries[entry * 2 + 1] = entryFirst; - this.hashLines[hLineIndex + 0]++; // num vertices in line ++ - } - - geoOut._numVertices++; - return iVertAdd; - } - /** - * - * @param {number} side some placeholder description - * @param {number} probeSphereRadius some placeholder description - * @param {object} vBoxMin some placeholder description - * @param {object} vBoxMax some placeholder description - * @param {object} geoOut some placeholder description - * @param {object} corners some placeholder description - * @returns {number} always 0 - */ - - }, { - key: "modifyExcludedFromGeo", - value: function modifyExcludedFromGeo(side, probeSphereRadius, vBoxMin, vBoxMax, geoOut, corners) { - var ind; - var distToSphere; - var distToBorder; - var r11 = 1.1; - - function innerBlockWorkAround() { - if (distToBorder > 0.0) { - // point is inside probe sphere - if (corners[ind] < 0.0) { - corners[ind] = distToBorder; // was inside surface, now is oustide ( > 0) - } - - if (distToBorder > corners[ind]) { - corners[ind] = distToBorder; // find positive maximum - } - } else if (distToBorder > corners[ind]) { - // point is outside sphere - corners[ind] = distToBorder; // find negative maximum - } - } - - var side2 = side * side; - var xScale = (side - 1) / (vBoxMax.x - vBoxMin.x); - var yScale = (side - 1) / (vBoxMax.y - vBoxMin.y); - var zScale = (side - 1) / (vBoxMax.z - vBoxMin.z); - var probeSpRad2 = probeSphereRadius * 2 * (probeSphereRadius * 2); - var sideInv = 1.0 / (side - 1); - - for (var i = 0; i < geoOut._numVertices; i++) { - var vCenter = geoOut._vertices[i]; - var radEst = probeSphereRadius * r11; - var indXMin = Math.floor((vCenter.x - radEst - vBoxMin.x) * xScale); - var indYMin = Math.floor((vCenter.y - radEst - vBoxMin.y) * yScale); - var indZMin = Math.floor((vCenter.z - radEst - vBoxMin.z) * zScale); - var indXMax = Math.floor((vCenter.x + radEst - vBoxMin.x) * xScale); - var indYMax = Math.floor((vCenter.y + radEst - vBoxMin.y) * yScale); - var indZMax = Math.floor((vCenter.z + radEst - vBoxMin.z) * zScale); - indXMin = indXMin >= 0 ? indXMin : 0; - indYMin = indYMin >= 0 ? indYMin : 0; - indZMin = indZMin >= 0 ? indZMin : 0; - indXMax = indXMax <= side - 1 ? indXMax : side - 1; - indYMax = indYMax <= side - 1 ? indYMax : side - 1; - indZMax = indZMax <= side - 1 ? indZMax : side - 1; - - for (var iy = indYMin; iy <= indYMax; iy++) { - var indY = iy * side2; - - for (var iz = indZMin; iz <= indZMax; iz++) { - var indZ = iz * side; - - for (var ix = indXMin; ix <= indXMax; ix++) { - ind = indY + indZ + ix; // getCornerCoord(vBoxMin, vBoxMax, ix, iy, iz, side, &vCorner); - - var t = ix * sideInv; - var xCorner = vBoxMin.x * (1.0 - t) + vBoxMax.x * t; - t = iy * sideInv; - var yCorner = vBoxMin.y * (1.0 - t) + vBoxMax.y * t; - t = iz * sideInv; - var zCorner = vBoxMin.z * (1.0 - t) + vBoxMax.z * t; - var dx = xCorner - vCenter.x; - var dy = yCorner - vCenter.y; - var dz = zCorner - vCenter.z; - var dist2 = dx * dx + dy * dy + dz * dz; - - if (dist2 < probeSpRad2) { - distToSphere = Math.sqrt(dist2); - distToBorder = -(distToSphere - probeSphereRadius); - innerBlockWorkAround(); - } // if (dist from corner point to sphere center more 2 radiuses) - - } // for (ix) - - } // for (iz) - - } // for (iy) - - } // for (i) all geo vertices - - - return 0; - } - }, { - key: "_innerBuild", - value: function _innerBuild() { - var ok; - var expandFactor = 1.2; // performance test - // this.performanceTest(); - // Create temporary atoms (but colored) - - var packedArrays = { - posRad: this._posRad, - colors: this._colors, - atoms: this._opts.atoms - }; - this.complex = this._opts.parent; - this.atoms = packedArrays.atoms; - this.meshResolution = this._opts.gridSpacing; - this.atomRadiusScale = this._opts.radScale; - this.colorMode = this._opts.colorMode; - this.probeRadius = this._opts.probeRadius; - this.useVertexColors = true; - this.excludeProbe = this._opts.excludeProbe; - this.visibilitySelector = this._opts.visibilitySelector; - this.geoOut = null; - this.hashLines = null; - this.hashEntries = null; - this.numHashEtriesAllocated = 0; - this.numHashEntryIndex = 0; - this.maxNumVertices = 0; - this.maxNumTriangles = 0; - var atomsColored = new Array(this.atoms.length); - this.convertToAtomsColored(packedArrays, atomsColored); // find bbox for spheres scene - - var vBoxMin = this.vBoxMin = new Vector3(); - var vBoxMax = this.vBoxMax = new Vector3(); - this.getBoundingBox(atomsColored, vBoxMin, vBoxMax); - var marCubeResoultion = this.marCubeResoultion = this.meshResolution * (2 + 2); // build grid corners for Marching cube algorithm - - var side = marCubeResoultion; - var side2 = side * side; - var side3 = side2 * side; - var corners = utils.allocateTyped(Float32Array, side3); - var rProbeRadius = this.probeRadius * this.atomRadiusScale; - this.calculateGridCorners(corners, side, vBoxMin, vBoxMax, atomsColored, rProbeRadius); - var numCells = marCubeResoultion - 1; - var cube = new IsoSurfaceMarchCube(); - ok = cube.create(numCells); - - if (ok < 0) { - return ok; - } // copy corners to cells - - - var vCellStep = new Vector3(); - vCellStep.x = (vBoxMax.x - vBoxMin.x) / numCells; - vCellStep.y = (vBoxMax.y - vBoxMin.y) / numCells; - vCellStep.z = (vBoxMax.z - vBoxMin.z) / numCells; - var numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube); - var maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor); - var maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2); - this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors); - ok = this.createVertexHash(maxNumVertices, maxNumTriangles); - - if (ok < 0) { - return ok; - } // build voxel world (used to check triangle-to-atom tie and to calculate normals and colors) - - - var probeRadForNormalsColors = rProbeRadius; - - if (this.excludeProbe) { - probeRadForNormalsColors = 0.01; - } - - this.voxelWorld = new IsosurfaceBuildNormals(atomsColored.length, atomsColored, vBoxMin, vBoxMax, probeRadForNormalsColors); - this.voxelWorld.createVoxels(); - ok = this.buildGeoFromCorners(marCubeResoultion, vBoxMin, vBoxMax, corners, vCellStep, cube); - - if (this.excludeProbe) { - // using 3d mesh (geoOut) as a surface points - // move probe sphere and try to minimuze corners values - this.modifyExcludedFromGeo(side, rProbeRadius, vBoxMin, vBoxMax, this.geoOut, corners); // delete old builded geo - - this.geoOut._vertices = null; - this.geoOut._colors = null; - this.geoOut._indices = null; - this.geoOut._normals = null; - this.geoOut._numVertices = 0; - this.geoOut._numTriangles = 0; - this.geoOut = null; // estimage geo vertices budget again - - numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube); - maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor); - maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2); // creates empty new geometry - - this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors); - ok = this.createVertexHash(maxNumVertices, maxNumTriangles); - - if (ok < 0) { - return ok; - } // build vertices and triangles from corners values - - - ok = this.buildGeoFromCorners(side, vBoxMin, vBoxMax, corners, vCellStep, cube); - } // build vertex normals - - - this.voxelWorld.buildNormals(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._normals); // More value : more smooth color mixing - // value about 0.7: very rough colors borders - - var radiusColorSmoothness = 6.5; - - if (this.excludeProbe) { - radiusColorSmoothness -= 1.5; - } - - if (this.useVertexColors) { - this.voxelWorld.buildColors(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._colors, radiusColorSmoothness); - } - - this.voxelWorld.destroyVoxels(); - this.voxelWorld = null; // remove objects - - cube.destroy(); - return ok; - } - }]); - - return SSIsosurfaceGeometry; -}(IsoSurfaceGeometry); // All code below must be erased from every device and each developer's memory - -function createLabel(fieldTxt, className) { - var text = document.createElement('div'); - text.className = className; - - if (typeof fieldTxt === 'string') { - var spanText = document.createElement('span'); - spanText.style.fontSize = '150%'; - var strings = fieldTxt.split('\n'); - - for (var i = 0, n = strings.length; i < n; ++i) { - var spanNodeP = document.createElement('span'); - var spanNodeText = document.createTextNode(strings[i]); - spanNodeP.appendChild(spanNodeText); - spanText.appendChild(spanNodeP); - - if (i < n - 1) { - spanText.appendChild(document.createElement('br')); - } - } - - text.appendChild(spanText); - } else { - text.appendChild(fieldTxt); - } - - text.worldPos = new Vector3(); - return text; -} - -var LabelsGeometry = /*#__PURE__*/function (_EventDispatcher) { - inherits(LabelsGeometry, _EventDispatcher); - - function LabelsGeometry(instanceCount, opts) { - var _this; - - classCallCheck(this, LabelsGeometry); - - _this = possibleConstructorReturn(this, getPrototypeOf(LabelsGeometry).call(this)); - _this._opts = opts; - _this.items = []; - _this.needsUpdate = false; - var xTranslation = -50; - var yTranslation = -50; - - switch (opts.horizontalAlign) { - case 'left': - xTranslation = 0; - break; - - case 'right': - xTranslation = -100; - break; - } - - switch (opts.verticalAlign) { - case 'top': - yTranslation = -100; - break; - - case 'bottom': - yTranslation = 0; - break; - } - - var deltaPos = new Vector3(opts.dx || 0, opts.dy || 0, opts.dz || 0); - _this.userData = { - translation: "translate(".concat(xTranslation, "%, ").concat(yTranslation, "%)"), - offset: deltaPos - }; - return _this; - } - - createClass(LabelsGeometry, [{ - key: "setItem", - value: function setItem(itemIdx, itemPos, fieldTxt) { - var opts = this._opts; - var text = this.items[itemIdx] || createLabel(fieldTxt, 'label'); - text.worldPos.copy(itemPos); - text.style.textAlign = opts.horizontalAlign; - text.style.verticalAlign = opts.verticalAlign; - this.items[itemIdx] = text; - } - }, { - key: "setColor", - value: function setColor(itemIdx, fColor, bColor) { - var text = this.items[itemIdx]; - text.opts = { - color: fColor, - background: bColor - }; - } - }, { - key: "startUpdate", - value: function startUpdate() { - return true; - } - }, { - key: "finishUpdate", - value: function finishUpdate() { - this.needsUpdate = true; - this.dispatchEvent({ - type: 'update' - }); - } - }, { - key: "finalize", - value: function finalize() { - this.finishUpdate(); - } // unimplemented functions - - }, { - key: "raycast", - value: function raycast() {} - }, { - key: "setOpacity", - value: function setOpacity() {} - }, { - key: "getSubset", - value: function getSubset() { - return []; - } - }]); - - return LabelsGeometry; -}(EventDispatcher); - -var geometries = { - InstancedSpheresGeometry: InstancedSpheresGeometry, - SimpleSpheresGeometry: SimpleSpheresGeometry, - Simple2CCylindersGeometry: Simple2CCylindersGeometry, - Instanced2CCylindersGeometry: Instanced2CCylindersGeometry, - ExtrudedObjectsGeometry: ExtrudedObjectsGeometry, - ChunkedLinesGeometry: ChunkedLinesGeometry, - TwoColorLinesGeometry: TwoColorLinesGeometry, - CrossGeometry: CrossGeometry, - QuickSurfGeometry: QuickSurfGeometry, - ContactSurfaceGeometry: ContactSurfaceGeometry, - SSIsosurfaceGeometry: SSIsosurfaceGeometry, - LabelsGeometry: LabelsGeometry -}; - -function UberObject (SuperClass) { - var NewObjectType = /*#__PURE__*/function (_SuperClass) { - inherits(NewObjectType, _SuperClass); - - function NewObjectType() { - var _getPrototypeOf2; - - var _this; - - classCallCheck(this, NewObjectType); - - for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) { - rest[_key] = arguments[_key]; - } - - _this = possibleConstructorReturn(this, (_getPrototypeOf2 = getPrototypeOf(NewObjectType)).call.apply(_getPrototypeOf2, [this].concat(rest))); - _this.onBeforeRender = NewObjectType.prototype.onBeforeRender; - return _this; - } - - createClass(NewObjectType, [{ - key: "onBeforeRender", - value: function onBeforeRender(renderer, scene, camera, geometry, material, group) { - this._onBeforeRender(renderer, scene, camera, geometry, material, group); - - this._update(); - } - }, { - key: "_onBeforeRender", - value: function _onBeforeRender() {} - }, { - key: "_update", - value: function _update() { - var material = this.material; - - if (!material) { - return; - } - - if (material instanceof UberMaterial) { - material.updateUniforms(); - } - } - }]); - - return NewObjectType; - }(SuperClass); - - return NewObjectType; -} - -var Mesh = UberObject(Mesh$5); - -var ZSpriteMesh = /*#__PURE__*/function (_Mesh) { - inherits(ZSpriteMesh, _Mesh); - - function ZSpriteMesh() { - classCallCheck(this, ZSpriteMesh); - - return possibleConstructorReturn(this, getPrototypeOf(ZSpriteMesh).apply(this, arguments)); - } - - createClass(ZSpriteMesh, [{ - key: "_onBeforeRender", - value: function _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) { - Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera); - - var material = this.material; - - if (!material) { - return; - } - - if (material.uniforms.invModelViewMatrix) { - // NOTE: update of modelViewMatrix inside threejs is done after onBeforeRender call, - // so we have to do it manually in that place - this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld); // get inverse matrix - - material.uniforms.invModelViewMatrix.value.getInverse(this.modelViewMatrix); - material.uniformsNeedUpdate = true; - } - } - }]); - - return ZSpriteMesh; -}(Mesh); - -var Mesh$1 = UberObject(Mesh$5); - -var ZClippedMesh = /*#__PURE__*/function (_Mesh) { - inherits(ZClippedMesh, _Mesh); - - function ZClippedMesh(geometry, material) { - var _this; - - classCallCheck(this, ZClippedMesh); - - _this = possibleConstructorReturn(this, getPrototypeOf(ZClippedMesh).call(this, geometry, material)); - _this.castShadow = true; - _this.receiveShadow = true; - return _this; - } - - createClass(ZClippedMesh, [{ - key: "_onBeforeRender", - value: function _onBeforeRender(renderer, scene, camera) { - Mesh$1.prototype._onBeforeRender.call(this, renderer, scene, camera); - - var geo = this.geometry; - var material = this.material; - - if (!geo.zClip || !material.uberOptions) { - return; - } - - var zClipCoef = 0.5; - var modelView = ZClippedMesh._modelView; - var mvLength = ZClippedMesh._mvLength; - var center = ZClippedMesh._center; - modelView.multiplyMatrices(this.matrixWorld, camera.matrixWorldInverse); - var s = mvLength.setFromMatrixColumn(modelView, 0).length(); - center.copy(geo.boundingSphere.center); - this.localToWorld(center); - material.uberOptions.zClipValue = camera.position.z - center.z - s * (zClipCoef * geo.boundingSphere.radius); - } - }]); - - return ZClippedMesh; -}(Mesh$1); - -defineProperty(ZClippedMesh, "_mvLength", new Vector3()); - -defineProperty(ZClippedMesh, "_center", new Vector3()); - -defineProperty(ZClippedMesh, "_modelView", new Matrix4()); - -var TextMesh = /*#__PURE__*/function (_THREE$Group) { - inherits(TextMesh, _THREE$Group); - - function TextMesh(geometry, _material) { - var _this; - - classCallCheck(this, TextMesh); - - _this = possibleConstructorReturn(this, getPrototypeOf(TextMesh).call(this)); - _this.geometry = geometry; - - var self = assertThisInitialized(_this); - - self.initialized = false; - - _this.geometry.addEventListener('update', function () { - self.update(); - }); - - return _this; - } - - createClass(TextMesh, [{ - key: "init", - value: function init() { - var children = this.children; - - for (var i = children.length - 1; i >= 0; --i) { - this.remove(children[i]); - } - - var _this$geometry = this.geometry, - items = _this$geometry.items, - userData = _this$geometry.userData; - - for (var _i = 0, n = items.length; _i < n; ++_i) { - var srcItem = items[_i]; - - if (!srcItem) { - continue; - } - - var item = utils.shallowCloneNode(srcItem); - var label = new CSS2DObject(item); - label.userData = _.clone(userData); - var el = label.getElement(); - el.style.visibility = 'visible'; - label.source = srcItem; - this.add(label); - } - - this.initialized = true; - } - }, { - key: "update", - value: function update() { - var geo = this.geometry; - - if (!geo.needsUpdate) { - return; - } - - var children = this.children; - - if (!this.initialized) { - this.init(); - } - - for (var i = 0, n = children.length; i < n; ++i) { - var child = children[i]; - var item = child.source; - child.position.copy(item.worldPos); - child.userData.color = item.opts.color; - child.userData.background = item.opts.background; - } - } - }]); - - return TextMesh; -}(Group); - -var Mesh$2 = UberObject(Mesh$5); - -function SimpleMesh(geometry, material) { - Mesh$2.call(this, geometry, material); - this.castShadow = true; - this.receiveShadow = true; -} - -SimpleMesh.prototype = Object.create(Mesh$2.prototype); -SimpleMesh.prototype.constructor = SimpleMesh; - -var Mesh$3 = UberObject(Mesh$5); - -var _viewport = new Vector2(); - -var ThickLineMesh = /*#__PURE__*/function (_Mesh) { - inherits(ThickLineMesh, _Mesh); - - function ThickLineMesh() { - classCallCheck(this, ThickLineMesh); - - return possibleConstructorReturn(this, getPrototypeOf(ThickLineMesh).apply(this, arguments)); - } - - createClass(ThickLineMesh, [{ - key: "_onBeforeRender", - value: function _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) { - var material = this.material; - - if (!material.uberOptions) { - return; - } - - material.uberOptions.projMatrixInv.getInverse(camera.projectionMatrix, true); - renderer.getSize(_viewport); - material.uberOptions.viewport.set(_viewport.width, _viewport.height); - } - }]); - - return ThickLineMesh; -}(Mesh$3); - -var Mesh$4 = UberObject(Mesh$5); - -var InstancedMesh = /*#__PURE__*/function (_Mesh) { - inherits(InstancedMesh, _Mesh); - - function InstancedMesh() { - var _getPrototypeOf2; - - var _this; - - classCallCheck(this, InstancedMesh); - - for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) { - rest[_key] = arguments[_key]; - } - - _this = possibleConstructorReturn(this, (_getPrototypeOf2 = getPrototypeOf(InstancedMesh)).call.apply(_getPrototypeOf2, [this].concat(rest))); - _this.castShadow = true; - _this.receiveShadow = true; - return _this; - } - - return InstancedMesh; -}(Mesh$4); - -var meshes = { - ZClipped: ZClippedMesh, - ZSprite: ZSpriteMesh, - Text: TextMesh, - Line: UberObject(Line), - LineSegments: UberObject(LineSegments), - Mesh: SimpleMesh, - ThickLineMesh: ThickLineMesh, - Instanced: InstancedMesh -}; - -function setMatParams(params, uniforms) { - return function (material) { - material.setValues(params); - material.setUberOptions(uniforms); - }; -} - -function _createInstancedCylinders(useZSprites, openEnded) { - return { - Geometry: function Geometry(a, b) { - return new geometries.Instanced2CCylindersGeometry(a, b, useZSprites, openEnded); - }, - Object: useZSprites ? meshes.ZSprite : meshes.Instanced, - initMaterial: setMatParams({ - instancedMatrix: true, - attrColor: true, - attrColor2: true, - attrAlphaColor: true, - cylinderSprite: useZSprites - }) - }; -} - -function _createLineSegmentsGeoTriplet(geo, renderParams) { - var thickLines = geo.prototype instanceof ThickLinesGeometry; - var lineWidth = renderParams.lineWidth || 0; - return { - Geometry: geo, - Object: thickLines ? meshes.ThickLineMesh : meshes.LineSegments, - initMaterial: setMatParams({ - lights: false, - attrColor: true, - attrAlphaColor: true, - thickLine: thickLines - }, { - lineWidth: lineWidth - }) - }; -} - -function _createSimpleGeoTriplet(geoClass) { - return { - Geometry: geoClass, - Object: meshes.Mesh, - initMaterial: setMatParams({ - attrColor: true, - attrAlphaColor: true - }) - }; -} - -function _createIsoSurfaceGeoTriplet(geoClass, caps, settings, renderParams) { - var surfaceOpts = { - wireframe: !!renderParams.wireframe, - fakeOpacity: settings.now.isoSurfaceFakeOpacity, - zClip: renderParams.zClip - }; - return { - Geometry: geoClass, - Object: meshes.ZClipped, - initMaterial: setMatParams({ - attrColor: true, - attrAlphaColor: false, - wireframe: surfaceOpts.wireframe, - fakeOpacity: surfaceOpts.fakeOpacity, - zClip: surfaceOpts.zClip - }) - }; -} - -var MeshCreator = /*#__PURE__*/function () { - function MeshCreator() { - classCallCheck(this, MeshCreator); - } - - createClass(MeshCreator, null, [{ - key: "createSpheres", - value: function createSpheres(caps, settings) { - var useZSprites = settings.now.zSprites; - return { - Geometry: function Geometry(a, b) { - return new geometries.InstancedSpheresGeometry(a, b, useZSprites); - }, - Object: useZSprites ? meshes.ZSprite : meshes.Instanced, - initMaterial: setMatParams({ - instancedPos: true, - attrColor: true, - attrAlphaColor: true, - sphereSprite: useZSprites - }) - }; - } - }, { - key: "create2CClosedCylinders", - value: function create2CClosedCylinders(_caps, _settings) { - return _createInstancedCylinders(false, false); - } - }, { - key: "create2CCylinders", - value: function create2CCylinders(caps, settings) { - return _createInstancedCylinders(settings.now.zSprites, true); - } - }, { - key: "create2CLines", - value: function create2CLines(_caps, _settings, renderParams) { - return _createLineSegmentsGeoTriplet(geometries.TwoColorLinesGeometry, renderParams); - } - }, { - key: "createCrosses", - value: function createCrosses(_caps, _settings, renderParams) { - return _createLineSegmentsGeoTriplet(geometries.CrossGeometry, renderParams); - } - }, { - key: "createExtrudedChains", - value: function createExtrudedChains(_caps, _settings) { - return _createSimpleGeoTriplet(geometries.ExtrudedObjectsGeometry); - } - }, { - key: "createChunkedLines", - value: function createChunkedLines(_caps, _settings, renderParams) { - return _createLineSegmentsGeoTriplet(geometries.ChunkedLinesGeometry, renderParams); - } - }, { - key: "createQuickSurface", - value: function createQuickSurface(caps, settings, renderParams) { - return _createIsoSurfaceGeoTriplet(geometries.QuickSurfGeometry, caps, settings, renderParams); - } - }, { - key: "createContactSurface", - value: function createContactSurface(caps, settings, renderParams) { - return _createIsoSurfaceGeoTriplet(geometries.ContactSurfaceGeometry, caps, settings, renderParams); - } - }, { - key: "createSASSES", - value: function createSASSES(caps, settings, renderParams) { - return _createIsoSurfaceGeoTriplet(geometries.SSIsosurfaceGeometry, caps, settings, renderParams); - } - }, { - key: "createLabels", - value: function createLabels(_caps, _settings) { - return { - Geometry: geometries.LabelsGeometry, - Object: meshes.Text, - initMaterial: function initMaterial() {} - }; - } - }]); - - return MeshCreator; -}(); - -var TransformGroup = /*#__PURE__*/function (_THREE$Object3D) { - inherits(TransformGroup, _THREE$Object3D); - - function TransformGroup(geometry, geoParams, material, transforms) { - var _this; - - classCallCheck(this, TransformGroup); - - _this = possibleConstructorReturn(this, getPrototypeOf(TransformGroup).call(this)); - _this._geometry = geometry; - _this._geoParams = geoParams; - var mat = material.createInstance(); - geoParams.initMaterial(mat); - _this._material = mat; - _this._transforms = transforms.length > 0 ? transforms : [new Matrix4()]; - - var meshes = _this._createMeshes(geometry); - - for (var i = 0, n = meshes.length; i < n; ++i) { - _this.add(meshes[i]); - } - - return _this; - } - - createClass(TransformGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - var ray = TransformGroup._ray; - var inverseMatrix = TransformGroup._inverseMatrix; - var children = this.children; - ray.copy(raycaster.ray); - - for (var i = 0, n = children.length; i < n; ++i) { - var child = children[i]; - - if (!gfxutils.belongToSelectLayers(child)) { - continue; - } - - child.updateMatrixWorld(); - var mtx = child.matrixWorld; - inverseMatrix.getInverse(mtx); - raycaster.ray.copy(ray).applyMatrix4(inverseMatrix); - var childIntersects = []; - - this._geometry.raycast(raycaster, childIntersects); - - for (var j = 0, ciCount = childIntersects.length; j < ciCount; ++j) { - var inters = childIntersects[j]; - - if (inters.point) { - inters.point.applyMatrix4(mtx); - inters.distance = ray.origin.distanceTo(inters.point); - } - - inters.object = child; - intersects[intersects.length] = inters; - } - } - - raycaster.ray.copy(ray); - } - }, { - key: "getSubset", - value: function getSubset(chunkIndices) { - var geos = this._geometry.getSubset(chunkIndices); - - var subset = []; - var subIdx = 0; - - for (var i = 0, n = geos.length; i < n; ++i) { - var _meshes = this._createMeshes(geos[i]); - - for (var j = 0, meshCnt = _meshes.length; j < meshCnt; ++j) { - subset[subIdx++] = _meshes[j]; - } - } - - return subset; - } - }, { - key: "_createMeshes", - value: function _createMeshes(geometry) { - var transforms = this._transforms; - var Mesh = this._geoParams.Object; - var material = this._material; - var meshes = []; - - for (var i = 0, n = transforms.length; i < n; ++i) { - var mesh = new Mesh(geometry, material); - mesh.applyMatrix(transforms[i]); - meshes[i] = mesh; - } - - return meshes; - } - }]); - - return TransformGroup; -}(Object3D); - -defineProperty(TransformGroup, "_inverseMatrix", new Matrix4()); - -defineProperty(TransformGroup, "_ray", new Ray()); - -function wrapper(Name, args) { - var params = [Name].concat(args); - return Name.bind.apply(Name, toConsumableArray(params)); -} - -var ChemGroup = /*#__PURE__*/function (_RCGroup) { - inherits(ChemGroup, _RCGroup); - - function ChemGroup(geoParams, selection, colorer, mode, transforms, polyComplexity, material) { - var _this; - - classCallCheck(this, ChemGroup); - - _this = possibleConstructorReturn(this, getPrototypeOf(ChemGroup).call(this)); - - if (_this.constructor === ChemGroup) { - throw new Error('Can not instantiate abstract class!'); - } - - _this._selection = selection; - _this._mode = mode; - _this._colorer = colorer; - _this._chunksIdc = selection.chunks; - _this._polyComplexity = polyComplexity; - _this._geo = new (wrapper(geoParams.Geometry, _this._makeGeoArgs()))(); - _this._mesh = new TransformGroup(_this._geo, geoParams, material, transforms); - - _this.add(_this._mesh); - - _this._build(); - - return _this; - } - - createClass(ChemGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - throw new Error('ChemGroup subclass must override _makeGeoArgs() method'); - } - /** - * Builds subset geometry by ATOMS index list - * - * @param {Number} mask - Representation mask - * @param {Boolean} innerOnly - if true returns inner bonds only - without halves - * @returns {Array} Subset geometry - */ - - }, { - key: "getSubset", - value: function getSubset(mask, innerOnly) { - innerOnly = innerOnly !== undefined ? innerOnly : false; - - var chunksList = this._calcChunksList(mask, innerOnly); - - if (chunksList.length === 0) { - return []; - } - - return this._mesh.getSubset(chunksList); - } - }, { - key: "_changeSubsetOpacity", - value: function _changeSubsetOpacity(mask, value, innerOnly) { - var chunksList = this._calcChunksList(mask, innerOnly); - - if (chunksList.length === 0) { - return; - } - - this._geo.setOpacity(chunksList, value); - } - }, { - key: "enableSubset", - value: function enableSubset(mask, innerOnly) { - innerOnly = innerOnly !== undefined ? innerOnly : true; - - this._changeSubsetOpacity(mask, 1.0, innerOnly); - } - }, { - key: "disableSubset", - value: function disableSubset(mask, innerOnly) { - innerOnly = innerOnly !== undefined ? innerOnly : true; - - this._changeSubsetOpacity(mask, 0.0, innerOnly); - } - }]); - - return ChemGroup; -}(RCGroup); - -var AtomsGroup = /*#__PURE__*/function (_ChemGroup) { - inherits(AtomsGroup, _ChemGroup); - - function AtomsGroup() { - classCallCheck(this, AtomsGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsGroup).apply(this, arguments)); - } - - createClass(AtomsGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - var atoms = this._selection.atoms; - var inters = []; - - this._mesh.raycast(raycaster, inters); - - var atomsIdc = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var atomIdx = atomsIdc[inters[i].chunkIdx]; - - if (atomIdx < atoms.length) { - inters[i].atom = atoms[atomIdx]; - intersects.push(inters[i]); - } - } - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask) { - var chunksList = []; - var atoms = this._selection.atoms; - var atomsIdc = this._chunksIdc; - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - - if ((atom.mask & mask) !== 0) { - chunksList.push(i); - } - } - - return chunksList; - } - }]); - - return AtomsGroup; -}(ChemGroup); - -var AtomsSphereGroup = /*#__PURE__*/function (_AtomsGroup) { - inherits(AtomsSphereGroup, _AtomsGroup); - - function AtomsSphereGroup() { - classCallCheck(this, AtomsSphereGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsSphereGroup).apply(this, arguments)); - } - - createClass(AtomsSphereGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - return [this._selection.chunks.length, this._polyComplexity]; - } - }, { - key: "_build", - value: function _build() { - var atomsIdc = this._selection.chunks; - var _this$_selection = this._selection, - atoms = _this$_selection.atoms, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - geo.setItem(i, atom.position, mode.calcAtomRadius(atom)); - geo.setColor(i, colorer.getAtomColor(atom, parent)); - } - - geo.finalize(); - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var atomsIdc = this._selection.chunks; - var atoms = this._selection.atoms; - var mode = this._mode; - var colorer = this._colorer; - var updateColor = frameData.needsColorUpdate(colorer); - var geo = this._geo; - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), mode.calcAtomRadius(atom)); - - if (updateColor) { - geo.setColor(i, frameData.getAtomColor(colorer, atom)); - } - } - - geo.finalize(); - } - }]); - - return AtomsSphereGroup; -}(AtomsGroup); - -var AtomsSurfaceGroup = /*#__PURE__*/function (_AtomsSphereGroup) { - inherits(AtomsSurfaceGroup, _AtomsSphereGroup); - - function AtomsSurfaceGroup() { - classCallCheck(this, AtomsSurfaceGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsSurfaceGroup).apply(this, arguments)); - } - - createClass(AtomsSurfaceGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var selectedAtoms = []; - var _this$_selection = this._selection, - atoms = _this$_selection.atoms, - chunks = _this$_selection.chunks; - var n = chunks.length; - - for (var i = 0; i < n; ++i) { - selectedAtoms[i] = atoms[chunks[i]]; - } - - var opts = this._mode.getSurfaceOpts(); - - opts.atoms = selectedAtoms; - return [n, opts]; - } - }]); - - return AtomsSurfaceGroup; -}(AtomsSphereGroup); - -var AtomsSASSESGroupStub = /*#__PURE__*/function (_AtomsSphereGroup) { - inherits(AtomsSASSESGroupStub, _AtomsSphereGroup); - - function AtomsSASSESGroupStub() { - classCallCheck(this, AtomsSASSESGroupStub); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsSASSESGroupStub).apply(this, arguments)); - } - - createClass(AtomsSASSESGroupStub, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var selectedAtoms = []; - var _this$_selection = this._selection, - atoms = _this$_selection.atoms, - chunks = _this$_selection.chunks; - var n = chunks.length; - - for (var i = 0; i < n; ++i) { - selectedAtoms[i] = atoms[chunks[i]]; - } - - var opts = this._mode.getSurfaceOpts(); - - opts.atoms = selectedAtoms; - opts.selection = this._selection; - opts.colorMode = this._colorer; - return [n, opts]; - } - }]); - - return AtomsSASSESGroupStub; -}(AtomsSphereGroup); - -function adjustColor(color) { - var r = color >> 16 & 255; - var g = color >> 8 & 255; - var b = color & 255; - - if (0.2126 * r + 0.7152 * g + 0.0722 * b > 127) { - r = r * 3 / 10; - g = g * 3 / 10; - b = b * 3 / 10; - } else { - r = 255 - (255 - r) * 3 / 10; - g = 255 - (255 - g) * 3 / 10; - b = 255 - (255 - b) * 3 / 10; - } - - return r << 16 | g << 8 | b; -} - -function inverseColor(color) { - var r = color >> 16 & 255; - var g = color >> 8 & 255; - var b = color & 255; - return 255 - r << 16 | 255 - g << 8 | 255 - b; -} - -function getAtomText(atom) { - if (atom.name.getNode() !== null) { - return atom.name.getNode(); - } - - return atom.getVisualName(); -} - -var colorMappings = { - none: function none(c) { - return c; - }, - adjust: adjustColor, - inverse: inverseColor -}; - -function propagateColor(color, rule) { - var result; - - if (colorMappings.hasOwnProperty(rule)) { - result = utils.hexColor(colorMappings[rule](color)); - } else { - var val = parseInt(rule, 16); - - if (!Number.isNaN(val) && rule.toLowerCase().startsWith('0x')) { - result = utils.hexColor(val); - } else { - result = '#000000'; - } - } - - return result; -} - -var templateMappings = { - serial: function serial(a) { - return a.serial; - }, - name: function name(a) { - return a.getVisualName(); - }, - elem: function elem(a) { - return a.element.name; - }, - residue: function residue(a) { - return a.residue.getType().getName(); - }, - sequence: function sequence(a) { - return a.residue.getSequence(); - }, - chain: function chain(a) { - return a.residue.getChain().getName(); - }, - hetatm: function hetatm(a) { - return a.isHet(); - }, - water: function water(a) { - return a.residue.getType().getName() === 'HOH' || a.residue.getType().getName() === 'WAT'; - } -}; - -var parseTemplate = function parseTemplate(atom, str) { - return str.replace(/\{\{(\s*\w+\s*)\}\}/g, function (m) { - var key = m.replace(/\s+/g, ''); - key = key.substring(2, key.length - 2).toLowerCase(); - - if (templateMappings.hasOwnProperty(key)) { - return templateMappings[key](atom); - } - - return 'null'; - }); -}; - -var AtomsTextGroup = /*#__PURE__*/function (_AtomsGroup) { - inherits(AtomsTextGroup, _AtomsGroup); - - function AtomsTextGroup() { - classCallCheck(this, AtomsTextGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AtomsTextGroup).apply(this, arguments)); - } - - createClass(AtomsTextGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var opts = this._mode.getLabelOpts(); - - return [this._selection.chunks.length, opts]; - } - }, { - key: "_build", - value: function _build() { - var opts = this._mode.getLabelOpts(); - - var atomsIdc = this._selection.chunks; - var _this$_selection = this._selection, - atoms = _this$_selection.atoms, - parent = _this$_selection.parent; - var colorer = this._colorer; - var geo = this._geo; - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - var text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom); - - if (!text) { - continue; - } - - var color = colorer.getAtomColor(atom, parent); - var fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16); - var bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent'; - geo.setItem(i, atom.position, text); - geo.setColor(i, fgColor, bgColor); - } - - geo.finalize(); - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var opts = this._mode.getLabelOpts(); - - var atomsIdc = this._selection.chunks; - var atoms = this._selection.atoms; - var colorer = this._colorer; - var geo = this._geo; - var updateColor = frameData.needsColorUpdate(colorer); - - for (var i = 0, n = atomsIdc.length; i < n; ++i) { - var atom = atoms[atomsIdc[i]]; - var text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom); - - if (!text) { - continue; - } - - var color = frameData.getAtomColor(colorer, atom); - var fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16); - var bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent'; - geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), text); - - if (updateColor) { - geo.setColor(i, fgColor, bgColor); - } - } - - geo.finalize(); - } - }]); - - return AtomsTextGroup; -}(AtomsGroup); - -function _slerp(omega, v1, v2, t) { - var oSin = Math.sin(omega); - return v1.clone().multiplyScalar(Math.sin((1 - t) * omega) / oSin).addScaledVector(v2, Math.sin(t * omega) / oSin); -} - -var AromaticGroup = /*#__PURE__*/function (_AtomsGroup) { - inherits(AromaticGroup, _AtomsGroup); - - function AromaticGroup() { - classCallCheck(this, AromaticGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AromaticGroup).apply(this, arguments)); - } - - createClass(AromaticGroup, [{ - key: "_buildInner", - value: function _buildInner(radOffset, addChunk) { - var chunksToIdx = this._selection.chunks; - var prevVector = new Vector3(); - var currVector = new Vector3(); - var segmentsHeight = this._segmentsHeight; - var leprStep = 1.0 / segmentsHeight; - var colorer = this._colorer; - var _this$_selection = this._selection, - cycles = _this$_selection.cycles, - parent = _this$_selection.parent; - var chunkIdx = 0; - var currAtomIdx = chunksToIdx[chunkIdx]; - - for (var cIdx = 0, cCount = cycles.length; cIdx < cCount; ++cIdx) { - var cycle = cycles[cIdx]; - var cycAtoms = cycle.atoms; - var chunkPoints = []; - var tmpDir = []; - var center = cycle.center; - var cycleRad = cycle.radius - radOffset; - var n = cycAtoms.length; - var i = 0; - var prevPos = cycAtoms[n - 1].position; - var currPos = cycAtoms[i].position; - prevVector.subVectors(prevPos, center); - currVector.subVectors(currPos, center); - var upDir = currVector.clone().cross(prevVector).normalize(); - - for (; i < n; ++i) { - var omega = prevVector.angleTo(currVector); - tmpDir[i] = _slerp(omega, prevVector, currVector, 0.5).normalize(); - currPos = cycAtoms[(i + 1) % n].position; - prevVector.copy(currVector); - currVector.subVectors(currPos, center); - } - - for (i = 0; i < n; ++i) { - if (cycAtoms[i].index !== currAtomIdx) { - continue; - } - - var start = tmpDir[i]; - var end = tmpDir[(i + 1) % n]; - var color = colorer.getAtomColor(cycAtoms[i], parent); - var currAngle = start.angleTo(end); - - for (var j = 0; j <= segmentsHeight; ++j) { - chunkPoints[j] = _slerp(currAngle, start, end, j * leprStep).multiplyScalar(cycleRad).add(center); - } - - addChunk(chunkIdx++, color, chunkPoints, center, upDir); - currAtomIdx = chunksToIdx[chunkIdx]; - } - } - } - }]); - - return AromaticGroup; -}(AtomsGroup); - -function _createShape(rad, parts) { - var pts = []; - - for (var i = 0; i < parts; ++i) { - var a = -2 * i / parts * Math.PI; - pts.push(new Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0)); - } - - return pts; -} - -var calcChunkMatrix = gfxutils.calcChunkMatrix; - -var AromaticTorusGroup = /*#__PURE__*/function (_AromaticGroup) { - inherits(AromaticTorusGroup, _AromaticGroup); - - function AromaticTorusGroup() { - classCallCheck(this, AromaticTorusGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AromaticTorusGroup).apply(this, arguments)); - } - - createClass(AromaticTorusGroup, [{ - key: "_build", - value: function _build() { - var segmentsHeight = this._segmentsHeight; - - var torusRad = this._mode.getAromRadius(); - - var radiusV = new Vector2(torusRad, torusRad); - var radOffset = this._mode.calcStickRadius() + 2 * torusRad; - var lookAtVector = new Vector3(); - var mtc = []; - var geo = this._geo; - - this._buildInner(radOffset, function (chunkIdx, color, points, center, upDir) { - for (var j = 0; j <= segmentsHeight; ++j) { - var currPoint = points[j]; - var currDir = currPoint.clone().sub(center).cross(upDir); - lookAtVector.addVectors(currPoint, currDir); - mtc[j] = calcChunkMatrix(currPoint, lookAtVector, upDir, radiusV); - } - - geo.setItem(chunkIdx, mtc); - geo.setColor(chunkIdx, color); - }); - - geo.finalize(); - } - }, { - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - this._segmentsHeight = this._polyComplexity; - return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length]; - } - }]); - - return AromaticTorusGroup; -}(AromaticGroup); - -var AromaticLinesGroup = /*#__PURE__*/function (_AromaticGroup) { - inherits(AromaticLinesGroup, _AromaticGroup); - - function AromaticLinesGroup() { - classCallCheck(this, AromaticLinesGroup); - - return possibleConstructorReturn(this, getPrototypeOf(AromaticLinesGroup).apply(this, arguments)); - } - - createClass(AromaticLinesGroup, [{ - key: "_build", - value: function _build() { - var _this = this; - - var geo = this._geo; - - var radOffset = this._mode.getAromaticOffset(); - - this._buildInner(radOffset, function (chunkIdx, color, points) { - var prevPt = points[0]; // do not replace with start - - for (var j = 1; j <= _this._segmentsHeight; ++j) { - var currPoint = points[j]; - geo.setSegment(chunkIdx, j - 1, prevPt, currPoint); - prevPt = currPoint; - } - - geo.setColor(chunkIdx, color); - }); - - geo.finalize(); - } - }, { - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - this._segmentsHeight = this._mode.getAromaticArcChunks(); - return [this._selection.chunks.length, this._segmentsHeight, true]; - } - }]); - - return AromaticLinesGroup; -}(AromaticGroup); - -var ResiduesGroup = /*#__PURE__*/function (_ChemGroup) { - inherits(ResiduesGroup, _ChemGroup); - - function ResiduesGroup() { - classCallCheck(this, ResiduesGroup); - - return possibleConstructorReturn(this, getPrototypeOf(ResiduesGroup).apply(this, arguments)); - } - - createClass(ResiduesGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - var residues = this._selection.residues; - var inters = []; - - this._mesh.raycast(raycaster, inters); - - var chunksIdc = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var resIdx = chunksIdc[inters[i].chunkIdx]; - - if (resIdx < residues.length) { - inters[i].residue = residues[resIdx]; - intersects.push(inters[i]); - } - } - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask) { - var chunksList = []; - var residues = this._selection.residues; - var resIdc = this._chunksIdc; - - for (var i = 0, n = resIdc.length; i < n; ++i) { - var res = residues[resIdc[i]]; - - if ((res._mask & mask) !== 0) { - chunksList.push(i); - } - } - - return chunksList; - } - }]); - - return ResiduesGroup; -}(ChemGroup); - -var NucleicItemGroup = /*#__PURE__*/function (_ResiduesGroup) { - inherits(NucleicItemGroup, _ResiduesGroup); - - function NucleicItemGroup() { - classCallCheck(this, NucleicItemGroup); - - return possibleConstructorReturn(this, getPrototypeOf(NucleicItemGroup).apply(this, arguments)); - } - - createClass(NucleicItemGroup, [{ - key: "raycast", - value: function raycast(raycaster, intersects) { - var residues = this._selection.residues; - var inters = []; - - this._mesh.raycast(raycaster, inters); - - var chunksIdc = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var resIdx = chunksIdc[Math.floor(inters[i].chunkIdx / 2)]; - - if (resIdx < residues.length) { - inters[i].residue = residues[resIdx]; - intersects.push(inters[i]); - } - } - } - }, { - key: "_build", - value: function _build() { - var _this$_selection = this._selection, - residues = _this$_selection.residues, - parent = _this$_selection.parent; - var colorer = this._colorer; - var geo = this._geo; - - var stickRad = this._mode.calcStickRadius(); - - var chunkIdx = 0; - var resIdc = this._selection.chunks; - - for (var i = 0, n = resIdc.length; i < n; ++i) { - var res = residues[resIdc[i]]; - var color = colorer.getResidueColor(res, parent); - - this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color); - } - - geo.finalize(); - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask) { - var chunksList = []; - var chunkIdx = 0; - var residues = this._selection.residues; - var resIdc = this._chunksIdc; - - for (var i = 0, n = resIdc.length; i < n; ++i) { - var res = residues[resIdc[i]]; - - if ((res._mask & mask) !== 0) { - chunksList[chunkIdx++] = 2 * i; - chunksList[chunkIdx++] = 2 * i + 1; - } - } - - return chunksList; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var residues = frameData.getResidues(); - var parent = this._selection.parent; - var colorer = this._colorer; - var geo = this._geo; - - var stickRad = this._mode.calcStickRadius(); - - var chunkIdx = 0; - var resIdc = this._selection.chunks; - - for (var i = 0, n = resIdc.length; i < n; ++i) { - var res = residues[resIdc[i]]; - var color = colorer.getResidueColor(res, parent); - - this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color); - } - - geo.finishUpdate(); - } - }]); - - return NucleicItemGroup; -}(ResiduesGroup); - -var NucleicCylindersGroup = /*#__PURE__*/function (_NucleicItemGroup) { - inherits(NucleicCylindersGroup, _NucleicItemGroup); - - function NucleicCylindersGroup() { - classCallCheck(this, NucleicCylindersGroup); - - return possibleConstructorReturn(this, getPrototypeOf(NucleicCylindersGroup).apply(this, arguments)); - } - - createClass(NucleicCylindersGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - return [this._selection.chunks.length, this._polyComplexity]; - } - }, { - key: "_processItem", - value: function _processItem(chunkIdx, cyl1, cyl2, stickRad, color) { - var geo = this._geo; - geo.setItem(chunkIdx, cyl1, cyl2, stickRad); - geo.setColor(chunkIdx, color, color); - } - }]); - - return NucleicCylindersGroup; -}(NucleicItemGroup); - -var NucleicSpheresGroup = /*#__PURE__*/function (_NucleicItemGroup) { - inherits(NucleicSpheresGroup, _NucleicItemGroup); - - function NucleicSpheresGroup() { - classCallCheck(this, NucleicSpheresGroup); - - return possibleConstructorReturn(this, getPrototypeOf(NucleicSpheresGroup).apply(this, arguments)); - } - - createClass(NucleicSpheresGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - return [this._selection.chunks.length * 2, this._polyComplexity]; - } - }, { - key: "_processItem", - value: function _processItem(chunkIdx, cyl1, cyl2, stickRad, color) { - var geo = this._geo; - var idx = chunkIdx * 2; - geo.setItem(idx, cyl1, stickRad); - geo.setColor(idx, color); - idx++; - geo.setItem(idx, cyl2, stickRad); - geo.setColor(idx, color); - } - }]); - - return NucleicSpheresGroup; -}(NucleicItemGroup); - -var Smooth = createCommonjsModule(function (module, exports) { -/* -Smooth.js version 0.1.7 - -Turn arrays into smooth functions. - -Copyright 2012 Spencer Cohen -Licensed under MIT license (see "Smooth.js MIT license.txt") -*/ - -/*Constants (these are accessible by Smooth.WHATEVER in user space) -*/ - -(function() { - var AbstractInterpolator, CubicInterpolator, Enum, LinearInterpolator, NearestInterpolator, PI, SincFilterInterpolator, Smooth, clipClamp, clipMirror, clipPeriodic, defaultConfig, getColumn, getType, isValidNumber, k, makeLanczosWindow, makeScaledFunction, makeSincKernel, normalizeScaleTo, shallowCopy, sin, sinc, v, validateNumber, validateVector, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - - Enum = { - /*Interpolation methods - */ - METHOD_NEAREST: 'nearest', - METHOD_LINEAR: 'linear', - METHOD_CUBIC: 'cubic', - METHOD_LANCZOS: 'lanczos', - METHOD_SINC: 'sinc', - /*Input clipping modes - */ - CLIP_CLAMP: 'clamp', - CLIP_ZERO: 'zero', - CLIP_PERIODIC: 'periodic', - CLIP_MIRROR: 'mirror', - /* Constants for control over the cubic interpolation tension - */ - CUBIC_TENSION_DEFAULT: 0, - CUBIC_TENSION_CATMULL_ROM: 0 - }; - - defaultConfig = { - method: Enum.METHOD_CUBIC, - cubicTension: Enum.CUBIC_TENSION_DEFAULT, - clip: Enum.CLIP_CLAMP, - scaleTo: 0, - sincFilterSize: 2, - sincWindow: void 0 - }; - - /*Index clipping functions - */ - - clipClamp = function(i, n) { - return Math.max(0, Math.min(i, n - 1)); - }; - - clipPeriodic = function(i, n) { - i = i % n; - if (i < 0) i += n; - return i; - }; - - clipMirror = function(i, n) { - var period; - period = 2 * (n - 1); - i = clipPeriodic(i, period); - if (i > n - 1) i = period - i; - return i; - }; - - /* - Abstract scalar interpolation class which provides common functionality for all interpolators - - Subclasses must override interpolate(). - */ - - AbstractInterpolator = (function() { - - function AbstractInterpolator(array, config) { - this.array = array.slice(0); - this.length = this.array.length; - if (!(this.clipHelper = { - clamp: this.clipHelperClamp, - zero: this.clipHelperZero, - periodic: this.clipHelperPeriodic, - mirror: this.clipHelperMirror - }[config.clip])) { - throw "Invalid clip: " + config.clip; - } - } - - AbstractInterpolator.prototype.getClippedInput = function(i) { - if ((0 <= i && i < this.length)) { - return this.array[i]; - } else { - return this.clipHelper(i); - } - }; - - AbstractInterpolator.prototype.clipHelperClamp = function(i) { - return this.array[clipClamp(i, this.length)]; - }; - - AbstractInterpolator.prototype.clipHelperZero = function(i) { - return 0; - }; - - AbstractInterpolator.prototype.clipHelperPeriodic = function(i) { - return this.array[clipPeriodic(i, this.length)]; - }; - - AbstractInterpolator.prototype.clipHelperMirror = function(i) { - return this.array[clipMirror(i, this.length)]; - }; - - AbstractInterpolator.prototype.interpolate = function(t) { - throw 'Subclasses of AbstractInterpolator must override the interpolate() method.'; - }; - - return AbstractInterpolator; - - })(); - - NearestInterpolator = (function(_super) { - - __extends(NearestInterpolator, _super); - - function NearestInterpolator() { - NearestInterpolator.__super__.constructor.apply(this, arguments); - } - - NearestInterpolator.prototype.interpolate = function(t) { - return this.getClippedInput(Math.round(t)); - }; - - return NearestInterpolator; - - })(AbstractInterpolator); - - LinearInterpolator = (function(_super) { - - __extends(LinearInterpolator, _super); - - function LinearInterpolator() { - LinearInterpolator.__super__.constructor.apply(this, arguments); - } - - LinearInterpolator.prototype.interpolate = function(t) { - var k; - k = Math.floor(t); - t -= k; - return (1 - t) * this.getClippedInput(k) + t * this.getClippedInput(k + 1); - }; - - return LinearInterpolator; - - })(AbstractInterpolator); - - CubicInterpolator = (function(_super) { - - __extends(CubicInterpolator, _super); - - function CubicInterpolator(array, config) { - this.tangentFactor = 1 - Math.max(-1, Math.min(1, config.cubicTension)); - CubicInterpolator.__super__.constructor.apply(this, arguments); - } - - CubicInterpolator.prototype.getTangent = function(k) { - return this.tangentFactor * (this.getClippedInput(k + 1) - this.getClippedInput(k - 1)) / 2; - }; - - CubicInterpolator.prototype.interpolate = function(t) { - var k, m, p, t2, t3; - k = Math.floor(t); - m = [this.getTangent(k), this.getTangent(k + 1)]; - p = [this.getClippedInput(k), this.getClippedInput(k + 1)]; - t -= k; - t2 = t * t; - t3 = t * t2; - return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + (-2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1]; - }; - - return CubicInterpolator; - - })(AbstractInterpolator); - - sin = Math.sin, PI = Math.PI; - - sinc = function(x) { - if (x === 0) { - return 1; - } else { - return sin(PI * x) / (PI * x); - } - }; - - makeLanczosWindow = function(a) { - return function(x) { - return sinc(x / a); - }; - }; - - makeSincKernel = function(window) { - return function(x) { - return sinc(x) * window(x); - }; - }; - - SincFilterInterpolator = (function(_super) { - - __extends(SincFilterInterpolator, _super); - - function SincFilterInterpolator(array, config) { - SincFilterInterpolator.__super__.constructor.apply(this, arguments); - this.a = config.sincFilterSize; - if (!config.sincWindow) throw 'No sincWindow provided'; - this.kernel = makeSincKernel(config.sincWindow); - } - - SincFilterInterpolator.prototype.interpolate = function(t) { - var k, n, sum, _ref, _ref2; - k = Math.floor(t); - sum = 0; - for (n = _ref = k - this.a + 1, _ref2 = k + this.a; _ref <= _ref2 ? n <= _ref2 : n >= _ref2; _ref <= _ref2 ? n++ : n--) { - sum += this.kernel(t - n) * this.getClippedInput(n); - } - return sum; - }; - - return SincFilterInterpolator; - - })(AbstractInterpolator); - - getColumn = function(arr, i) { - var row, _i, _len, _results; - _results = []; - for (_i = 0, _len = arr.length; _i < _len; _i++) { - row = arr[_i]; - _results.push(row[i]); - } - return _results; - }; - - makeScaledFunction = function(f, baseScale, scaleRange) { - var scaleFactor, translation; - if (scaleRange.join === '0,1') { - return f; - } else { - scaleFactor = baseScale / (scaleRange[1] - scaleRange[0]); - translation = scaleRange[0]; - return function(t) { - return f(scaleFactor * (t - translation)); - }; - } - }; - - getType = function(x) { - return Object.prototype.toString.call(x).slice('[object '.length, -1); - }; - - validateNumber = function(n) { - if (isNaN(n)) throw 'NaN in Smooth() input'; - if (getType(n) !== 'Number') throw 'Non-number in Smooth() input'; - if (!isFinite(n)) throw 'Infinity in Smooth() input'; - }; - - validateVector = function(v, dimension) { - var n, _i, _len; - if (getType(v) !== 'Array') throw 'Non-vector in Smooth() input'; - if (v.length !== dimension) throw 'Inconsistent dimension in Smooth() input'; - for (_i = 0, _len = v.length; _i < _len; _i++) { - n = v[_i]; - validateNumber(n); - } - }; - - isValidNumber = function(n) { - return (getType(n) === 'Number') && isFinite(n) && !isNaN(n); - }; - - normalizeScaleTo = function(s) { - var invalidErr; - invalidErr = "scaleTo param must be number or array of two numbers"; - switch (getType(s)) { - case 'Number': - if (!isValidNumber(s)) throw invalidErr; - s = [0, s]; - break; - case 'Array': - if (s.length !== 2) throw invalidErr; - if (!(isValidNumber(s[0]) && isValidNumber(s[1]))) throw invalidErr; - break; - default: - throw invalidErr; - } - return s; - }; - - shallowCopy = function(obj) { - var copy, k, v; - copy = {}; - for (k in obj) { - if (!__hasProp.call(obj, k)) continue; - v = obj[k]; - copy[k] = v; - } - return copy; - }; - - Smooth = function(arr, config) { - var baseDomainEnd, dimension, i, interpolator, interpolatorClass, interpolators, k, n, properties, smoothFunc, v; - if (config == null) config = {}; - properties = {}; - config = shallowCopy(config); - properties.config = shallowCopy(config); - if (config.scaleTo == null) config.scaleTo = config.period; - if (config.sincFilterSize == null) { - config.sincFilterSize = config.lanczosFilterSize; - } - for (k in defaultConfig) { - if (!__hasProp.call(defaultConfig, k)) continue; - v = defaultConfig[k]; - if (config[k] == null) config[k] = v; - } - if (!(interpolatorClass = { - nearest: NearestInterpolator, - linear: LinearInterpolator, - cubic: CubicInterpolator, - lanczos: SincFilterInterpolator, - sinc: SincFilterInterpolator - }[config.method])) { - throw "Invalid method: " + config.method; - } - if (config.method === 'lanczos') { - config.sincWindow = makeLanczosWindow(config.sincFilterSize); - } - if (arr.length < 2) throw 'Array must have at least two elements'; - properties.count = arr.length; - smoothFunc = (function() { - var _i, _j, _len, _len2; - switch (getType(arr[0])) { - case 'Number': - properties.dimension = 'scalar'; - if (Smooth.deepValidation) { - for (_i = 0, _len = arr.length; _i < _len; _i++) { - n = arr[_i]; - validateNumber(n); - } - } - interpolator = new interpolatorClass(arr, config); - return function(t) { - return interpolator.interpolate(t); - }; - case 'Array': - properties.dimension = dimension = arr[0].length; - if (!dimension) throw 'Vectors must be non-empty'; - if (Smooth.deepValidation) { - for (_j = 0, _len2 = arr.length; _j < _len2; _j++) { - v = arr[_j]; - validateVector(v, dimension); - } - } - interpolators = (function() { - var _results; - _results = []; - for (i = 0; 0 <= dimension ? i < dimension : i > dimension; 0 <= dimension ? i++ : i--) { - _results.push(new interpolatorClass(getColumn(arr, i), config)); - } - return _results; - })(); - return function(t) { - var interpolator, _k, _len3, _results; - _results = []; - for (_k = 0, _len3 = interpolators.length; _k < _len3; _k++) { - interpolator = interpolators[_k]; - _results.push(interpolator.interpolate(t)); - } - return _results; - }; - default: - throw "Invalid element type: " + (getType(arr[0])); - } - })(); - if (config.clip === 'periodic') { - baseDomainEnd = arr.length; - } else { - baseDomainEnd = arr.length - 1; - } - config.scaleTo || (config.scaleTo = baseDomainEnd); - properties.domain = normalizeScaleTo(config.scaleTo); - smoothFunc = makeScaledFunction(smoothFunc, baseDomainEnd, properties.domain); - properties.domain.sort(); - /*copy properties - */ - for (k in properties) { - if (!__hasProp.call(properties, k)) continue; - v = properties[k]; - smoothFunc[k] = v; - } - return smoothFunc; - }; - - for (k in Enum) { - if (!__hasProp.call(Enum, k)) continue; - v = Enum[k]; - Smooth[k] = v; - } - - Smooth.deepValidation = true; - - ( exports !== null ? exports : window).Smooth = Smooth; - -}).call(commonjsGlobal); -}); -var Smooth_1 = Smooth.Smooth; - -var ResidueType$1 = chem.ResidueType; -var calcMatrix = gfxutils.calcChunkMatrix; - -function _buildStructureInterpolator(points, tension) { - var path = Smooth_1(points, { - method: Smooth_1.METHOD_CUBIC, - clip: Smooth_1.CLIP_CLAMP, - cubicTension: tension, - scaleTo: 1 - }); - return function (t, argTrans) { - var transformT = argTrans; - - if (transformT === null) { - // map our range to the [second .. last but one] - transformT = function transformT(tt) { - return (tt * (points.length - 1 - 2) + 1) / (points.length - 1); - }; - } - - var newt = transformT(t); - var ans = path(newt); - return new Vector3(ans[0], ans[1], ans[2]); - }; -} - -function _addPoints(centerPoints, topPoints, idx, residue) { - if (!residue._isValid) { - centerPoints[idx] = centerPoints[idx - 1]; - topPoints[idx] = topPoints[idx - 1]; - return; - } - - var cp = residue._controlPoint; - centerPoints[idx] = [cp.x, cp.y, cp.z]; - var tp = cp.clone().add(residue._wingVector); - topPoints[idx] = [tp.x, tp.y, tp.z]; -} - -function _addPointsForLoneResidue(centerPoints, topPoints, idx, residue) { - var nucleic = (residue._type.flags & ResidueType$1.Flags.NUCLEIC) !== 0; - var nameFrom = nucleic ? 'C5\'' : 'N'; - var nameTo = nucleic ? 'C3\'' : 'C'; - var posFrom; - var posTo; - residue.forEachAtom(function (atom) { - var name = atom.getVisualName(); - - if (!posFrom && name === nameFrom) { - posFrom = atom.position; - } else if (!posTo && name === nameTo) { - posTo = atom.position; - } - }); // provide a fallback for unknown residues - - if (!(posFrom && posTo)) { - posFrom = residue._firstAtom.position; - posTo = residue._lastAtom.position; - } - - if (posFrom && posTo) { - var shift = posTo.clone().sub(posFrom); - var wing = residue._wingVector; - var cp = residue._controlPoint; - var tp = cp.clone().add(wing); - var cpPrev = cp.clone().sub(shift); - var tpPrev = cpPrev.clone().add(wing); - centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z]; - topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z]; - ++idx; - centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z]; - topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z]; - ++idx; - centerPoints[idx] = [cp.x, cp.y, cp.z]; - topPoints[idx] = [tp.x, tp.y, tp.z]; - ++idx; - var cpNext = cp.clone().add(shift); - var tpNext = cpNext.clone().add(wing); - centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z]; - topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z]; - ++idx; - centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z]; - topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z]; - } -} - -function _calcPoints(residues, firstIdx, lastIdx, boundaries) { - var left = boundaries.start; - var right = boundaries.end; - - function _prevIdx(idx) { - return idx > left && residues[idx - 1]._isValid ? idx - 1 : idx; - } - - function _nextIdx(idx) { - return idx < right && residues[idx + 1]._isValid ? idx + 1 : idx; - } - - var topPoints = []; - var centerPoints = []; - var arrIdx = 0; - - function _extrapolate2(currIdx, otherIdx) { - var cp = residues[currIdx]._controlPoint.clone().lerp(residues[otherIdx]._controlPoint, -0.25); - - var tp = cp.clone().add(residues[currIdx]._wingVector); - centerPoints[arrIdx] = [cp.x, cp.y, cp.z]; - topPoints[arrIdx++] = [tp.x, tp.y, tp.z]; - centerPoints[arrIdx] = [cp.x, cp.y, cp.z]; - topPoints[arrIdx++] = [tp.x, tp.y, tp.z]; - } // a single disconnected residue - - - var prevIdx = _prevIdx(firstIdx); - - var nextIdx = _nextIdx(lastIdx); - - if (prevIdx === nextIdx) { - _addPointsForLoneResidue(centerPoints, topPoints, arrIdx, residues[firstIdx]); - - return { - centerPoints: centerPoints, - topPoints: topPoints - }; - } // Two points (prev-prev and next-next) are added to support edge conditions for cubic splines, they are ignored - // Another two (prev and next) were added to support the outside of the sub chain - // prev and prev-prev - - - if (firstIdx === prevIdx) { - // do the extrapolation - _extrapolate2(firstIdx, _nextIdx(firstIdx)); - } else { - _addPoints(centerPoints, topPoints, arrIdx++, residues[_prevIdx(prevIdx)]); - - _addPoints(centerPoints, topPoints, arrIdx++, residues[prevIdx]); - } // main loop - - - for (var idx = firstIdx; idx <= lastIdx; ++idx) { - _addPoints(centerPoints, topPoints, arrIdx++, residues[idx]); - } // next and next-next - - - if (nextIdx === _nextIdx(nextIdx)) { - // do the extrapolation - _extrapolate2(lastIdx, _prevIdx(lastIdx)); - } else { - _addPoints(centerPoints, topPoints, arrIdx++, residues[nextIdx]); - - _addPoints(centerPoints, topPoints, arrIdx, residues[_nextIdx(nextIdx)]); - } - - return { - centerPoints: centerPoints, - topPoints: topPoints - }; -} - -var CartoonHelper = /*#__PURE__*/function () { - function CartoonHelper(residues, startIdx, endIdx, segmentsCount, tension, boundaries) { - classCallCheck(this, CartoonHelper); - - var pointsArrays = _calcPoints(residues, startIdx, endIdx, boundaries); - - this._topInterp = _buildStructureInterpolator(pointsArrays.topPoints, tension); - this._centerInterp = _buildStructureInterpolator(pointsArrays.centerPoints, tension); - this._shift = 0.5 / (endIdx - startIdx + 2); - this._valueStep = (1.0 - 2 * this._shift) / (2 * (endIdx - startIdx + 1) * (segmentsCount - 1)); - this._segmentsCount = segmentsCount; - } - - createClass(CartoonHelper, [{ - key: "prepareMatrices", - value: function prepareMatrices(idx, firstRad, secondRad) { - var mtcCount = this._segmentsCount; - var outMtc = new Array(mtcCount); - var currRad = new Vector2(0, 0); - var topInterp = this._topInterp; - var cenInterp = this._centerInterp; - var currentValue = this._shift + this._valueStep * (mtcCount - 1) * idx; - - for (var mtxIdx = 0; mtxIdx < mtcCount; ++mtxIdx) { - var lerpVal = Math.min(1.0, mtxIdx / (mtcCount - 1)); - currRad.lerpVectors(firstRad, secondRad, lerpVal); - var currTop = topInterp(currentValue, null); - var currCenter = cenInterp(currentValue, null); - currentValue += this._valueStep; - var nextCenter = cenInterp(currentValue, null); - outMtc[mtxIdx] = calcMatrix(currCenter.clone(), nextCenter.clone(), currTop.clone().sub(currCenter), currRad); - } - - return outMtc; - } - }]); - - return CartoonHelper; -}(); - -function _createShape$1(rad, parts) { - var pts = []; - - for (var i = 0; i < parts; ++i) { - // starts from pi/2 because it's important that points are lied on the angles of arrows (visual issues if not) - var a = Math.PI / 2.0 - 2 * Math.PI * i / parts; - pts.push(new Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0)); - } - - return pts; -} - -function _loopThrough(subDiv, residues, segmentsHeight, tension, mode, callback) { - for (var subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { - var subs = subDiv[subDivI].arr; - var boundaries = subDiv[subDivI].boundaries; - - for (var i = 0, n = subs.length; i < n; ++i) { - var idc = [subs[i].start, subs[i].end]; - var matrixHelper = new CartoonHelper(residues, idc[0], idc[1], segmentsHeight, tension, boundaries); - var prevLast = null; - var startIdx = subs[i].start * 2; - var endIdx = subs[i].end * 2 + 1; - var prevSecondRad = mode.getResidueRadius(residues[0], 0); - - for (var idx = startIdx; idx <= endIdx; ++idx) { - var resIdx = idx / 2 | 0; - var currRes = residues[resIdx]; - var firstRad = mode.getResidueRadius(currRes, idx % 2); - var secondRad = mode.getResidueRadius(currRes, 1 + idx % 2); - var mtc = matrixHelper.prepareMatrices(idx - idc[0] * 2, firstRad, secondRad); - mtc.unshift(prevLast === null ? mtc[0] : prevLast); // Slope - radius is changed along this residue part - - var hasSlope = firstRad.x !== secondRad.x || firstRad.y !== secondRad.y; // Cut - end radius of previous part not equal to start radius of this part. First section of this part lies in the orthogonal plane - - var hasCut = firstRad.x !== prevSecondRad.x || firstRad.y !== prevSecondRad.y; - callback(currRes, mtc, hasSlope, hasCut); - prevLast = mtc[segmentsHeight]; - prevSecondRad = secondRad; - } - } - } -} - -var ResiduesSubseqGroup = /*#__PURE__*/function (_ResiduesGroup) { - inherits(ResiduesSubseqGroup, _ResiduesGroup); - - function ResiduesSubseqGroup() { - classCallCheck(this, ResiduesSubseqGroup); - - return possibleConstructorReturn(this, getPrototypeOf(ResiduesSubseqGroup).apply(this, arguments)); - } - - createClass(ResiduesSubseqGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var cmpMultiplier = this._mode.getHeightSegmentsRatio(); - - this._segmentsHeight = this._polyComplexity * cmpMultiplier | 0; - return [_createShape$1(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length * 2]; - } - }, { - key: "_build", - value: function _build() { - var _this$_selection = this._selection, - residues = _this$_selection.residues, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var tension = mode.getTension(); - var geo = this._geo; - var chunkIdx = 0; - var chunkIdc = []; - - _loopThrough(this._selection.subdivs, residues, this._segmentsHeight, tension, mode, function (currRes, mtc) { - var hasSlope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var hasCut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var color = colorer.getResidueColor(currRes, parent); - chunkIdc[chunkIdx] = currRes._index; - geo.setItem(chunkIdx, mtc, hasSlope, hasCut); - geo.setColor(chunkIdx++, color); - }); - - this._chunksIdc = chunkIdc; - geo.finalize(); - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var parent = this._selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var tension = mode.getTension(); - var geo = this._geo; - var frameRes = frameData.getResidues(); - var chunkIdx = 0; - var updateColor = frameData.needsColorUpdate(colorer); - - _loopThrough(this._selection.subdivs, frameRes, this._segmentsHeight, tension, mode, function (currRes, mtc) { - geo.setItem(chunkIdx, mtc); - - if (updateColor) { - geo.setColor(chunkIdx, colorer.getResidueColor(currRes, parent)); - } - - chunkIdx++; - }); - - geo.finalize(); - } - }]); - - return ResiduesSubseqGroup; -}(ResiduesGroup); - -var ResiduesTraceGroup = /*#__PURE__*/function (_ChemGroup) { - inherits(ResiduesTraceGroup, _ChemGroup); - - function ResiduesTraceGroup() { - classCallCheck(this, ResiduesTraceGroup); - - return possibleConstructorReturn(this, getPrototypeOf(ResiduesTraceGroup).apply(this, arguments)); - } - - createClass(ResiduesTraceGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var subDiv = this._selection.subdivs; - var chunksCount = 0; - - for (var subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { - var subs = subDiv[subDivI].arr; - - for (var i = 0, n = subs.length; i < n; ++i) { - chunksCount += subs[i].end - subs[i].start; - } - } - - return [chunksCount, this._polyComplexity]; - } - }, { - key: "_build", - value: function _build() { - var _this$_selection = this._selection, - residues = _this$_selection.residues, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var chunkIdx = 0; - var chunkIdc = []; - var subDiv = this._selection.subdivs; - var stickRad = mode.calcStickRadius(); - - for (var subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { - var subs = subDiv[subDivI].arr; - - for (var i = 0, n = subs.length; i < n; ++i) { - var startIdx = subs[i].start; - var endIdx = subs[i].end; - var prevRes = residues[startIdx]; - - for (var idx = startIdx + 1; idx <= endIdx; ++idx) { - var currRes = residues[idx]; - chunkIdc[chunkIdx] = { - first: prevRes._index, - second: currRes._index - }; - geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad); - geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent)); - chunkIdx++; - prevRes = currRes; - } - } - } - - this._chunksIdc = chunkIdc; - geo.finalize(); - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var residues = frameData.getResidues(); - var parent = this._selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var chunkIdx = 0; - var subDiv = this._selection.subdivs; - var stickRad = mode.calcStickRadius(); - var updateColor = frameData.needsColorUpdate(colorer); - - for (var subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { - var subs = subDiv[subDivI].arr; - - for (var i = 0, n = subs.length; i < n; ++i) { - var startIdx = subs[i].start; - var endIdx = subs[i].end; - var prevRes = residues[startIdx]; - - for (var idx = startIdx + 1; idx <= endIdx; ++idx) { - var currRes = residues[idx]; - geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad); - - if (updateColor) { - geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent)); - } - - chunkIdx++; - prevRes = currRes; - } - } - } - - geo.finalize(); - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var inters = []; - var residues = this._selection.residues; - - this._mesh.raycast(raycaster, inters); - - var chunksToIdx = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var chunkIdx = inters[i].chunkIdx; - var chunk = chunksToIdx[Math.floor(chunkIdx / 2)]; - var resIdx = chunkIdx % 2 === 0 ? chunk.first : chunk.second; - - if (resIdx < residues.length) { - inters[i].residue = residues[resIdx]; - intersects.push(inters[i]); - } - } - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask) { - var chunksList = []; - var chunksToIdx = this._chunksIdc; - var residues = this._selection.residues; - - for (var i = 0, n = chunksToIdx.length; i < n; ++i) { - var chunk = chunksToIdx[i]; - - if (residues[chunk.first]._mask & mask) { - chunksList.push(i * 2); - } - - if (residues[chunk.second]._mask & mask) { - chunksList.push(i * 2 + 1); - } - } - - return chunksList; - } - }]); - - return ResiduesTraceGroup; -}(ChemGroup); - -function getCylinderCount(bondOrder) { - return bondOrder < 2 ? 1 : bondOrder; -} - -var BondsGroup = /*#__PURE__*/function (_ChemGroup) { - inherits(BondsGroup, _ChemGroup); - - function BondsGroup() { - classCallCheck(this, BondsGroup); - - return possibleConstructorReturn(this, getPrototypeOf(BondsGroup).apply(this, arguments)); - } - - createClass(BondsGroup, [{ - key: "_makeGeoArgs", - value: function _makeGeoArgs() { - var drawMultiple = this._mode.drawMultiorderBonds(); - - var showAromatic = this._mode.showAromaticLoops(); - - var bondsIdc = this._selection.chunks; - var bonds = this._selection.bonds; - var bondsCount = 0; - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - bondsCount += this.getBondOrder(bonds[bondsIdc[i]], drawMultiple, showAromatic); - } - - return [bondsCount, this._polyComplexity]; - } - }, { - key: "getBondOrder", - value: function getBondOrder(bond, drawMultiple, showAromatic) { - var bondOrder = 1; - - if (drawMultiple && (!showAromatic || bond._type !== Bond.BondType.AROMATIC)) { - bondOrder = getCylinderCount(bond._order); - } - - return bondOrder; - } - }, { - key: "raycast", - value: function raycast(raycaster, intersects) { - var bonds = this._selection.bonds; - var inters = []; - - this._mesh.raycast(raycaster, inters); - - var bondsIdc = this._chunksIdc; // process inters array - arr object references - - for (var i = 0, n = inters.length; i < n; ++i) { - if (!inters[i].hasOwnProperty('chunkIdx')) { - continue; - } - - var chunkIdx = inters[i].chunkIdx; - var bondIdx = bondsIdc[Math.floor(chunkIdx / 2)]; - - if (bondIdx < bonds.length) { - var bond = bonds[bondIdx]; - inters[i].atom = chunkIdx % 2 === 0 ? bond._left : bond._right; - intersects.push(inters[i]); - } - } - } - }, { - key: "_calcChunksList", - value: function _calcChunksList(mask, innerOnly) { - var chunksList = []; - var bonds = this._selection.bonds; - var chunksToIdx = this._chunksIdc; - - for (var i = 0, n = chunksToIdx.length; i < n; ++i) { - var bond = bonds[chunksToIdx[i]]; - - if (bond._left.mask & mask && (!innerOnly || bond._right.mask & mask)) { - chunksList.push(2 * i); - } - - if (bond._right.mask & mask && (!innerOnly || bond._left.mask & mask)) { - chunksList.push(2 * i + 1); - } - } - - return chunksList; - } - }]); - - return BondsGroup; -}(ChemGroup); - -var BondsCylinderGroup = /*#__PURE__*/function (_BondsGroup) { - inherits(BondsCylinderGroup, _BondsGroup); - - function BondsCylinderGroup() { - classCallCheck(this, BondsCylinderGroup); - - return possibleConstructorReturn(this, getPrototypeOf(BondsCylinderGroup).apply(this, arguments)); - } - - createClass(BondsCylinderGroup, [{ - key: "_build", - value: function _build() { - var bondsIdc = this._selection.chunks; - var _this$_selection = this._selection, - bonds = _this$_selection.bonds, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var drawMultiple = mode.drawMultiorderBonds(); - var showAromatic = mode.showAromaticLoops(); - var stickRad = mode.calcStickRadius(); - var emptyOffset = mode.calcSpaceFraction(); - var normDir; - var leftPos = new Vector3(); - var rightPos = new Vector3(); - var currBondIdx = 0; - var chunksToIdx = []; - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - var bond = bonds[bondsIdc[i]]; - var atom1 = bond._left; - var atom2 = bond._right; - var a1Pos = atom1.position; - var a2Pos = atom2.position; - normDir = bond.calcNormalDir(); - var order = this.getBondOrder(bond, drawMultiple, showAromatic); - var minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2)); - var dist = 2 * minRad / order; - var currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad; - - for (var j = 0; j < order; ++j) { - var scale = dist * (order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2))); - chunksToIdx[currBondIdx] = bond._index; - leftPos.copy(a1Pos); - leftPos.addScaledVector(normDir, scale); - rightPos.copy(a2Pos); - rightPos.addScaledVector(normDir, scale); - geo.setItem(currBondIdx, leftPos, rightPos, currStickRad); - geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent)); - } - } - - geo.finalize(); - this._chunksIdc = chunksToIdx; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - var bondsIdc = this._selection.chunks; - var bonds = this._selection.bonds; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var drawMultiple = mode.drawMultiorderBonds(); - var showAromatic = mode.showAromaticLoops(); - var stickRad = mode.calcStickRadius(); - var emptyOffset = mode.calcSpaceFraction(); - var normDir; - var leftPos = new Vector3(); - var rightPos = new Vector3(); - var currBondIdx = 0; - var updateColor = frameData.needsColorUpdate(colorer); - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - var bond = bonds[bondsIdc[i]]; - var atom1 = bond._left; - var atom2 = bond._right; - var a1Pos = frameData.getAtomPos(atom1.index).clone(); - var a2Pos = frameData.getAtomPos(atom2.index); - normDir = bond.calcNormalDir(); - var order = this.getBondOrder(bond, drawMultiple, showAromatic); - var minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2)); - var dist = 2 * minRad / order; - var currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad; - - for (var j = 0; j < order; ++j) { - var scale = dist * (order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2))); - leftPos.copy(a1Pos); - leftPos.addScaledVector(normDir, scale); - rightPos.copy(a2Pos); - rightPos.addScaledVector(normDir, scale); - geo.setItem(currBondIdx, leftPos, rightPos, currStickRad); - - if (updateColor) { - geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2)); - } - - currBondIdx++; - } - } - - geo.finalize(); - } - }]); - - return BondsCylinderGroup; -}(BondsGroup); - -var STEP_SIZE = 0.15; - -var BondsLinesGroup = /*#__PURE__*/function (_BondsGroup) { - inherits(BondsLinesGroup, _BondsGroup); - - function BondsLinesGroup() { - classCallCheck(this, BondsLinesGroup); - - return possibleConstructorReturn(this, getPrototypeOf(BondsLinesGroup).apply(this, arguments)); - } - - createClass(BondsLinesGroup, [{ - key: "_build", - value: function _build() { - var bondsIdc = this._selection.chunks; - var _this$_selection = this._selection, - bonds = _this$_selection.bonds, - parent = _this$_selection.parent; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var drawMultiple = mode.drawMultiorderBonds(); - var showAromatic = mode.showAromaticLoops(); - var bondDir = new Vector3(); - var leftPos = new Vector3(); - var rightPos = new Vector3(); - var currBondIdx = 0; - var chunksToIdx = []; - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - var bond = bonds[bondsIdc[i]]; - var atom1 = bond._left; - var atom2 = bond._right; - var a1Pos = atom1.position; - var a2Pos = atom2.position; - var a1Hangs = atom1.bonds.length === 1; - var a2Hangs = atom2.bonds.length === 1; - bondDir.subVectors(a2Pos, a1Pos); - var len = bondDir.length(); - var normDir = bond.calcNormalDir(); - var order = this.getBondOrder(bond, drawMultiple, showAromatic); - - for (var j = 0; j < order; ++j) { - leftPos.copy(a1Pos); - rightPos.copy(a2Pos); - var scale = order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2)); - chunksToIdx[currBondIdx] = bond._index; - - if (order === 2 && !a1Hangs && !a2Hangs) { - scale -= 0.5; - scale *= -1; - } - - if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) { - leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / len); - rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / len); - } - - scale *= STEP_SIZE; - leftPos.addScaledVector(normDir, scale); - rightPos.addScaledVector(normDir, scale); - geo.setItem(currBondIdx, leftPos, rightPos); - geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent)); - } - } - - geo.finalize(); - this._chunksIdc = chunksToIdx; - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - // This method looks like a copy paste. However, it - // was decided to postpone animation refactoring until GFX is fixed. - var bondsIdc = this._selection.chunks; - var bonds = this._selection.bonds; - var mode = this._mode; - var colorer = this._colorer; - var geo = this._geo; - var drawMultiple = mode.drawMultiorderBonds(); - var showAromatic = mode.showAromaticLoops(); - var bondDir = new Vector3(); - var leftPos = new Vector3(); - var rightPos = new Vector3(); - var currBondIdx = 0; - var updateColor = frameData.needsColorUpdate(colorer); - - for (var i = 0, n = bondsIdc.length; i < n; ++i) { - var bond = bonds[bondsIdc[i]]; - var atom1 = bond._left; - var atom2 = bond._right; - var a1Pos = frameData.getAtomPos(atom1.index).clone(); - var a2Pos = frameData.getAtomPos(atom2.index); - var a1Hangs = atom1.bonds.length === 1; - var a2Hangs = atom2.bonds.length === 1; - bondDir.subVectors(a2Pos, a1Pos); - var len = bondDir.length(); - var normDir = bond.calcNormalDir(); - var order = this.getBondOrder(bond, drawMultiple, showAromatic); - - for (var j = 0; j < order; ++j) { - leftPos.copy(a1Pos); - rightPos.copy(a2Pos); - var scale = order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2)); - - if (order === 2 && !a1Hangs && !a2Hangs) { - scale -= 0.5; - scale *= -1; - } - - if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) { - leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / len); - rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / len); - } - - scale *= STEP_SIZE; - leftPos.addScaledVector(normDir, scale); - rightPos.addScaledVector(normDir, scale); - geo.setItem(currBondIdx, leftPos, rightPos); - - if (updateColor) { - geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2)); - } - - currBondIdx++; - } - } - - geo.finalize(); - } - }]); - - return BondsLinesGroup; -}(BondsGroup); - -var groups = { - AtomsSphereGroup: AtomsSphereGroup, - AtomsSurfaceGroup: AtomsSurfaceGroup, - AtomsSASSESGroupStub: AtomsSASSESGroupStub, - AtomsTextGroup: AtomsTextGroup, - AromaticTorusGroup: AromaticTorusGroup, - AromaticLinesGroup: AromaticLinesGroup, - NucleicCylindersGroup: NucleicCylindersGroup, - NucleicSpheresGroup: NucleicSpheresGroup, - ResiduesSubseqGroup: ResiduesSubseqGroup, - ResiduesTraceGroup: ResiduesTraceGroup, - BondsCylinderGroup: BondsCylinderGroup, - BondsLinesGroup: BondsLinesGroup -}; - -var AtomsProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(AtomsProcessor, _RCGroup); - - function AtomsProcessor(AtomsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, AtomsProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(AtomsProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - _this._mode = mode; - var atoms = complex.getAtoms(); - var transforms = complex.getTransforms(); - complex.forEachComponent(function (component) { - var atomsIdc = []; - var atomCount = 0; - component.forEachAtom(function (atom) { - if (!self._checkAtom(atom, mask)) { - return; - } - - atomsIdc[atomCount++] = atom.index; - }); - - if (atomCount === 0) { - return; - } - - var atomsGroup = new AtomsGroup(geoParams, { - atoms: atoms, - chunks: atomsIdc, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - atomsGroup._component = component; - self.add(atomsGroup); - }); - return _this; - } - - createClass(AtomsProcessor, [{ - key: "_checkAtom", - value: function _checkAtom(atom, mask) { - return atom.mask & mask; - } - }, { - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return AtomsProcessor; -}(RCGroup); - -var OrphanAtomsProcessor = /*#__PURE__*/function (_AtomsProcessor) { - inherits(OrphanAtomsProcessor, _AtomsProcessor); - - function OrphanAtomsProcessor() { - classCallCheck(this, OrphanAtomsProcessor); - - return possibleConstructorReturn(this, getPrototypeOf(OrphanAtomsProcessor).apply(this, arguments)); - } - - createClass(OrphanAtomsProcessor, [{ - key: "_checkAtom", - value: function _checkAtom(atom, mask) { - if (!(atom.mask & mask)) { - return false; - } - - var bonds = atom.bonds; - - for (var i = 0, n = bonds.length; i < n; ++i) { - if (bonds[i]._left.mask & mask && bonds[i]._right.mask & mask) { - return false; - } - } - - return true; - } - }]); - - return OrphanAtomsProcessor; -}(AtomsProcessor); - -var ResiduesProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(ResiduesProcessor, _RCGroup); - - function ResiduesProcessor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, ResiduesProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(ResiduesProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - var residues = complex.getResidues(); - var transforms = complex.getTransforms(); - complex.forEachComponent(function (component) { - var chunksCount = 0; - var resIdc = []; - component.forEachResidue(function (residue) { - if (self._checkResidue(residue, mask)) { - resIdc[chunksCount++] = residue._index; - } - }); - - if (chunksCount === 0) { - return; - } - - var residuesGroup = new ResidueGroup(geoParams, { - residues: residues, - chunks: resIdc, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - residuesGroup._component = component; - self.add(residuesGroup); - }); - return _this; - } - - createClass(ResiduesProcessor, [{ - key: "checkResidue", - value: function checkResidue(residue, mask) { - return residue._mask & mask; - } - }, { - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return ResiduesProcessor; -}(RCGroup); - -var NucleicProcessor = /*#__PURE__*/function (_ResidueProcessor) { - inherits(NucleicProcessor, _ResidueProcessor); - - function NucleicProcessor() { - classCallCheck(this, NucleicProcessor); - - return possibleConstructorReturn(this, getPrototypeOf(NucleicProcessor).apply(this, arguments)); - } - - createClass(NucleicProcessor, [{ - key: "_checkResidue", - value: function _checkResidue(residue, mask) { - return mask & residue._mask && residue._cylinders !== null; - } - }]); - - return NucleicProcessor; -}(ResiduesProcessor); - -var SubseqsProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(SubseqsProcessor, _RCGroup); - - function SubseqsProcessor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, SubseqsProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(SubseqsProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - var residues = complex.getResidues(); - var transforms = complex.getTransforms(); - complex.forEachComponent(function (component) { - var subDivs = component.getMaskedSubdivSequences(mask); - var chunksCount = 0; - var resIdc = []; - - for (var subDivI = 0, subDivN = subDivs.length; subDivI < subDivN; ++subDivI) { - var subs = subDivs[subDivI].arr; - - for (var i = 0, n = subs.length; i < n; ++i) { - for (var j = subs[i].start, jEnd = subs[i].end; j <= jEnd; ++j) { - resIdc[chunksCount++] = residues[j]._index; - } - } - } - - if (chunksCount === 0) { - return; - } - - var residuesGroup = new ResidueGroup(geoParams, { - residues: residues, - chunks: resIdc, - subdivs: subDivs, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - residuesGroup._component = component; - self.add(residuesGroup); - }); - return _this; - } - - createClass(SubseqsProcessor, [{ - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return SubseqsProcessor; -}(RCGroup); - -var BondsProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(BondsProcessor, _RCGroup); - - function BondsProcessor(BondsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, BondsProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(BondsProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - var bonds = complex.getBonds(); - var transforms = complex.getTransforms(); - complex.forEachComponent(function (component) { - var bondsIdc = []; - var bondsCount = 0; - component.forEachBond(function (bond) { - var atom1 = bond._left; - var atom2 = bond._right; - - if (!(atom1.mask & mask) || !(atom2.mask & mask)) { - return; - } - - bondsIdc[bondsCount++] = bond._index; - }); - - if (bondsCount === 0) { - return; - } - - var bondsGroup = new BondsGroup(geoParams, { - bonds: bonds, - chunks: bondsIdc, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - bondsGroup._component = component; - self.add(bondsGroup); - }); - return _this; - } - - createClass(BondsProcessor, [{ - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return BondsProcessor; -}(RCGroup); - -var AromaticProcessor = /*#__PURE__*/function (_RCGroup) { - inherits(AromaticProcessor, _RCGroup); - - function AromaticProcessor(AromaticGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { - var _this; - - classCallCheck(this, AromaticProcessor); - - _this = possibleConstructorReturn(this, getPrototypeOf(AromaticProcessor).call(this)); - - var self = assertThisInitialized(_this); - - _this._complex = complex; - var atoms = complex.getAtoms(); - var transforms = complex.getTransforms(); - - if (!mode.showAromaticLoops()) { - return possibleConstructorReturn(_this); - } - - complex.forEachComponent(function (component) { - var atomsIdc = []; - var chunksCount = 0; - var cycles = []; - var cycleIdx = 0; - component.forEachCycle(function (cycle) { - var cycAtoms = cycle.atoms; - var perCycle = 0; - - for (var i = 0, n = cycAtoms.length; i < n; ++i) { - if ((cycAtoms[i].mask & mask) !== 0) { - ++perCycle; - atomsIdc[chunksCount++] = cycAtoms[i].index; - } - } - - if (perCycle > 0) { - cycles[cycleIdx++] = cycle; - } - }); - var atomsGroup = new AromaticGroup(geoParams, { - cycles: cycles, - atoms: atoms, - chunks: atomsIdc, - parent: complex - }, colorer, mode, transforms, polyComplexity, material); - atomsGroup._component = component; - self.add(atomsGroup); - }); - return _this; - } - - createClass(AromaticProcessor, [{ - key: "getSubset", - value: function getSubset(mask, innerOnly) { - var totalSubset = []; - var children = this.children; - var meshIdx = 0; - - for (var i = 0, n = children.length; i < n; ++i) { - if (children[i].getSubset) { - var chSubset = children[i].getSubset(mask, innerOnly); - - for (var j = 0, m = chSubset.length; j < m; ++j) { - var subsetEl = chSubset[j]; - subsetEl._component = children[i]._component; - totalSubset[meshIdx++] = subsetEl; - } - } - } - - return totalSubset; - } - }]); - - return AromaticProcessor; -}(RCGroup); - -var processors = { - Atoms: AtomsProcessor, - OrphanAtoms: OrphanAtomsProcessor, - Residues: ResiduesProcessor, - Nucleic: NucleicProcessor, - Subseqs: SubseqsProcessor, - Bonds: BondsProcessor, - Aromatic: AromaticProcessor -}; - -function _bakeGroup(triplet, Processor, Group) { - return function (complex, colorer, mode, polyComplexity, mask, material) { - return new Processor(Group, triplet, complex, colorer, mode, polyComplexity, mask, material); - }; -} - -var GroupsFactory = /*#__PURE__*/function () { - function GroupsFactory() { - classCallCheck(this, GroupsFactory); - } - - createClass(GroupsFactory, null, [{ - key: "AtomsSpheres", - value: function AtomsSpheres(caps, settings) { - var gfxTriplet = MeshCreator.createSpheres(caps, settings); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSphereGroup); - } - }, { - key: "OrphanedAtomsCrosses", - value: function OrphanedAtomsCrosses(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createCrosses(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.OrphanAtoms, groups.AtomsSphereGroup); - } - }, { - key: "BondsCylinders", - value: function BondsCylinders(caps, settings) { - var gfxTriplet = MeshCreator.create2CCylinders(caps, settings); - return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsCylinderGroup); - } - }, { - key: "BondsLines", - value: function BondsLines(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.create2CLines(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsLinesGroup); - } - }, { - key: "CartoonChains", - value: function CartoonChains(caps, settings) { - var gfxTriplet = MeshCreator.createExtrudedChains(caps, settings); - return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesSubseqGroup); - } - }, { - key: "TraceChains", - value: function TraceChains(caps, settings) { - var gfxTriplet = MeshCreator.create2CClosedCylinders(caps, settings); - return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesTraceGroup); - } - }, { - key: "NucleicSpheres", - value: function NucleicSpheres(caps, settings) { - var gfxTriplet = MeshCreator.createSpheres(caps, settings); - return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicSpheresGroup); - } - }, { - key: "NucleicCylinders", - value: function NucleicCylinders(caps, settings) { - var gfxTriplet = MeshCreator.create2CCylinders(caps, settings); - return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicCylindersGroup); - } - }, { - key: "ALoopsTorus", - value: function ALoopsTorus(caps, settings) { - var gfxTriplet = MeshCreator.createExtrudedChains(caps, settings); - return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticTorusGroup); - } - }, { - key: "ALoopsLines", - value: function ALoopsLines(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createChunkedLines(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticLinesGroup); - } - }, { - key: "QuickSurfGeo", - value: function QuickSurfGeo(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createQuickSurface(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup); - } - }, { - key: "ContactSurfaceGeo", - value: function ContactSurfaceGeo(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createContactSurface(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup); - } - }, { - key: "SASSESSurfaceGeo", - value: function SASSESSurfaceGeo(caps, settings, renderParams) { - var gfxTriplet = MeshCreator.createSASSES(caps, settings, renderParams); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSASSESGroupStub); - } - }, { - key: "TextLabelsGeo", - value: function TextLabelsGeo(caps, settings) { - var gfxTriplet = MeshCreator.createLabels(caps, settings); - return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsTextGroup); - } - }]); - - return GroupsFactory; -}(); - -/** - * Create new mode. - * - * @param {object=} opts - Options to override defaults with. - * - * These options are copied locally and not kept by reference, so the created instance will not reflect further - * changes to the `opts` object. However, changes in defaults **will** affect the mode after its creation. - * - * @exports Mode - * @this Mode - * @abstract - * @constructor - * @classdesc Basic class for all available modes used for building and displaying molecule geometry. - */ - -var Mode = /*#__PURE__*/function () { - function Mode(opts) { - classCallCheck(this, Mode); - - if (this.constructor === Mode) { - throw new Error('Can not instantiate abstract class!'); - } - /** - * Mode options inherited (prototyped) from defaults. - * @type {object} - */ - - - this.opts = _.merge(utils.deriveDeep(this.settings.now.modes[this.id], true), opts); - } - /** - * Get mode identification, probably with options. - * @returns {string|Array} Mode identifier string ({@link Mode#id}) or two-element array containing both mode - * identifier and options ({@link Mode#opts}). - * Options are returned if they were changed during or after the mode creation. - */ - - - createClass(Mode, [{ - key: "identify", - value: function identify() { - var diff = utils.objectsDiff(this.opts, this.settings.now.modes[this.id]); - - if (!_.isEmpty(diff)) { - return [this.id, diff]; - } - - return this.id; - } - }, { - key: "buildGeometry", - value: function buildGeometry(complex, colorer, mask, material) { - var polyComplexity = this.opts.polyComplexity ? this.opts.polyComplexity[this.settings.now.resolution] : 0; - var groupList = this.depGroups; - var groupCount = groupList.length; - var group = new gfxutils.RCGroup(); - var self = this; - - for (var i = 0; i < groupCount; ++i) { - var currGroup = groupList[i]; - var renderParams = {}; - - if (_.isArray(currGroup)) { - renderParams = currGroup[1].call(this); - var _currGroup = currGroup; - - var _currGroup2 = slicedToArray(_currGroup, 1); - - currGroup = _currGroup2[0]; - } - - var Group = GroupsFactory[currGroup](null, this.settings, renderParams); - var newGroup = new Group(complex, colorer, self, polyComplexity, mask, material); - - if (newGroup.children.length > 0) { - group.add(newGroup); - } - } - - return group; - } - }]); - - return Mode; -}(); - -makeContextDependent(Mode.prototype); -/** -* Mode identifier. -* @type {string} -*/ - -Mode.prototype.id = '__'; -/** - * Mode geo groups. - * @type {Array} - */ - -Mode.prototype.depGroups = []; - -function getRenderParams() { - return { - lineWidth: this.opts.lineWidth - }; -} - -var LinesMode = /*#__PURE__*/function (_Mode) { - inherits(LinesMode, _Mode); - - function LinesMode(opts) { - var _this; - - classCallCheck(this, LinesMode); - - _this = possibleConstructorReturn(this, getPrototypeOf(LinesMode).call(this, opts)); - _this.depGroups = _this.depGroups.slice(0); // clone depGroups to prevent prototype edits - - var groups = _this.depGroups; - - for (var i = 0, n = groups.length; i < n; ++i) { - groups[i] = [groups[i], getRenderParams]; - } - - return _this; - } - - createClass(LinesMode, [{ - key: "drawMultiorderBonds", - value: function drawMultiorderBonds() { - return this.opts.multibond; - } - }, { - key: "calcAtomRadius", - value: function calcAtomRadius() { - return this.opts.atom; - } - }, { - key: "getAromaticOffset", - value: function getAromaticOffset() { - return this.opts.offsarom; - } - }, { - key: "getAromaticArcChunks", - value: function getAromaticArcChunks() { - return this.opts.chunkarom; - } - }, { - key: "showAromaticLoops", - value: function showAromaticLoops() { - return this.opts.showarom; - } - }]); - - return LinesMode; -}(Mode); - -defineProperty(LinesMode, "id", 'LN'); - -LinesMode.prototype.id = 'LN'; -LinesMode.prototype.name = 'Lines'; -LinesMode.prototype.shortName = 'Lines'; -LinesMode.prototype.depGroups = ['ALoopsLines', 'BondsLines', 'OrphanedAtomsCrosses']; - -var LicoriceMode = /*#__PURE__*/function (_Mode) { - inherits(LicoriceMode, _Mode); - - function LicoriceMode() { - classCallCheck(this, LicoriceMode); - - return possibleConstructorReturn(this, getPrototypeOf(LicoriceMode).apply(this, arguments)); - } - - createClass(LicoriceMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(_atom) { - return this.opts.bond; - } - }, { - key: "calcStickRadius", - value: function calcStickRadius() { - return this.opts.bond; - } - }, { - key: "calcSpaceFraction", - value: function calcSpaceFraction() { - return this.opts.space; - } - }, { - key: "getAromRadius", - value: function getAromRadius() { - return this.opts.aromrad; - } - }, { - key: "showAromaticLoops", - value: function showAromaticLoops() { - return this.opts.showarom; - } - }, { - key: "drawMultiorderBonds", - value: function drawMultiorderBonds() { - return this.opts.multibond; - } - }]); - - return LicoriceMode; -}(Mode); - -defineProperty(LicoriceMode, "id", 'LC'); - -LicoriceMode.prototype.id = 'LC'; -LicoriceMode.prototype.name = 'Licorice'; -LicoriceMode.prototype.shortName = 'Licorice'; -LicoriceMode.prototype.depGroups = ['AtomsSpheres', 'BondsCylinders', 'ALoopsTorus']; - -var BallsAndSticksMode = /*#__PURE__*/function (_Mode) { - inherits(BallsAndSticksMode, _Mode); - - function BallsAndSticksMode() { - classCallCheck(this, BallsAndSticksMode); - - return possibleConstructorReturn(this, getPrototypeOf(BallsAndSticksMode).apply(this, arguments)); - } - - createClass(BallsAndSticksMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(atom) { - return atom.element.radius * this.opts.atom; - } - }, { - key: "calcStickRadius", - value: function calcStickRadius() { - return this.opts.bond; - } - }, { - key: "getAromRadius", - value: function getAromRadius() { - return this.opts.aromrad; - } - }, { - key: "showAromaticLoops", - value: function showAromaticLoops() { - return this.opts.showarom; - } - }, { - key: "calcSpaceFraction", - value: function calcSpaceFraction() { - return this.opts.space; - } - }, { - key: "drawMultiorderBonds", - value: function drawMultiorderBonds() { - return this.opts.multibond; - } - }]); - - return BallsAndSticksMode; -}(Mode); - -defineProperty(BallsAndSticksMode, "id", 'BS'); - -BallsAndSticksMode.prototype.id = 'BS'; -BallsAndSticksMode.prototype.name = 'Balls and Sticks'; -BallsAndSticksMode.prototype.shortName = 'Balls'; -BallsAndSticksMode.prototype.depGroups = ['AtomsSpheres', 'BondsCylinders', 'ALoopsTorus']; - -var VanDerWaalsMode = /*#__PURE__*/function (_Mode) { - inherits(VanDerWaalsMode, _Mode); - - function VanDerWaalsMode() { - classCallCheck(this, VanDerWaalsMode); - - return possibleConstructorReturn(this, getPrototypeOf(VanDerWaalsMode).apply(this, arguments)); - } - - createClass(VanDerWaalsMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(atom) { - return atom.element.radius; - } - }]); - - return VanDerWaalsMode; -}(Mode); - -defineProperty(VanDerWaalsMode, "id", 'VW'); - -VanDerWaalsMode.prototype.id = 'VW'; -VanDerWaalsMode.prototype.name = 'Van der Waals'; -VanDerWaalsMode.prototype.shortName = 'VDW'; -VanDerWaalsMode.prototype.depGroups = ['AtomsSpheres']; - -var TraceMode = /*#__PURE__*/function (_Mode) { - inherits(TraceMode, _Mode); - - function TraceMode() { - classCallCheck(this, TraceMode); - - return possibleConstructorReturn(this, getPrototypeOf(TraceMode).apply(this, arguments)); - } - - createClass(TraceMode, [{ - key: "calcStickRadius", - value: function calcStickRadius() { - return this.opts.radius; - } - }]); - - return TraceMode; -}(Mode); - -defineProperty(TraceMode, "id", 'TR'); - -TraceMode.prototype.id = 'TR'; -TraceMode.prototype.name = 'Trace'; -TraceMode.prototype.shortName = 'Trace'; -TraceMode.prototype.depGroups = ['TraceChains']; - -var TubeMode = /*#__PURE__*/function (_Mode) { - inherits(TubeMode, _Mode); - - function TubeMode() { - classCallCheck(this, TubeMode); - - return possibleConstructorReturn(this, getPrototypeOf(TubeMode).apply(this, arguments)); - } - - createClass(TubeMode, [{ - key: "getResidueRadius", - value: function getResidueRadius(_residue) { - return this.TUBE_RADIUS; - } - }, { - key: "getHeightSegmentsRatio", - value: function getHeightSegmentsRatio() { - return this.opts.heightSegmentsRatio; - } - }, { - key: "getTension", - value: function getTension() { - return this.opts.tension; - } - }, { - key: "buildGeometry", - value: function buildGeometry(complex, colorer, mask, material) { - var rad = this.opts.radius; - this.TUBE_RADIUS = new Vector2(rad, rad); - return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material); - } - }]); - - return TubeMode; -}(Mode); - -defineProperty(TubeMode, "id", 'TU'); - -TubeMode.prototype.id = 'TU'; -TubeMode.prototype.name = 'Tube'; -TubeMode.prototype.shortName = 'Tube'; -TubeMode.prototype.depGroups = ['CartoonChains']; - -var CartoonMode = /*#__PURE__*/function (_Mode) { - inherits(CartoonMode, _Mode); - - function CartoonMode(opts) { - var _this; - - classCallCheck(this, CartoonMode); - - _this = possibleConstructorReturn(this, getPrototypeOf(CartoonMode).call(this, opts)); // cache for secondary structure options - - _this.secCache = {}; - return _this; - } - - createClass(CartoonMode, [{ - key: "getResidueStartRadius", - value: function getResidueStartRadius(residue) { - var second = residue.getSecondary(); - - if (!second || !second.generic) { - return this.TUBE_RADIUS; - } - - var secOpts = this.secCache[second.generic]; - - if (!secOpts) { - return this.TUBE_RADIUS; - } - - if (second.term === residue) { - return secOpts.start; - } - - return secOpts.center; - } - }, { - key: "getResidueEndRadius", - value: function getResidueEndRadius(residue) { - var second = residue.getSecondary(); - - if (second === null || !second.generic) { - return this.TUBE_RADIUS; - } - - var secOpts = this.secCache[second.generic]; - - if (!secOpts) { - return this.TUBE_RADIUS; - } - - if (second.term === residue) { - return this.ARROW_END; - } - - return secOpts.center; - } - }, { - key: "getResidueRadius", - value: function getResidueRadius(residue, val) { - var startRad = this.getResidueStartRadius(residue); - - if (val === 0) { - return startRad; - } - - var endRad = this.getResidueEndRadius(residue); - - if (val === 2) { - return endRad; - } - - return startRad.clone().lerp(endRad, val / 2.0); - } - }, { - key: "calcStickRadius", - value: function calcStickRadius(_res) { - return this.opts.radius; - } - }, { - key: "getHeightSegmentsRatio", - value: function getHeightSegmentsRatio() { - return this.opts.heightSegmentsRatio; - } - }, { - key: "getTension", - value: function getTension() { - return this.opts.tension; - } - }, { - key: "buildGeometry", - value: function buildGeometry(complex, colorer, mask, material) { - var tubeRad = this.opts.radius; - var secHeight = this.opts.depth; - this.TUBE_RADIUS = new Vector2(tubeRad, tubeRad); - this.ARROW_END = new Vector2(secHeight, tubeRad); - var secCache = {}; - var secData = this.opts.ss; - /* eslint-disable guard-for-in */ - - for (var prop in secData) { - secCache[prop] = { - center: new Vector2(secHeight, secData[prop].width), - start: new Vector2(secHeight, secData[prop].arrow) - }; - } - - this.secCache = secCache; - /* eslint-enable guard-for-in */ - - return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material); - } - }]); - - return CartoonMode; -}(Mode); - -defineProperty(CartoonMode, "id", 'CA'); - -CartoonMode.prototype.id = 'CA'; -CartoonMode.prototype.name = 'Cartoon'; -CartoonMode.prototype.shortName = 'Cartoon'; -CartoonMode.prototype.depGroups = ['CartoonChains', 'NucleicSpheres', 'NucleicCylinders']; - -var selectors$1 = chem.selectors; - -function getRenderParams$1() { - return { - wireframe: this.opts.wireframe, - zClip: this.opts.zClip - }; -} - -var SurfaceMode = /*#__PURE__*/function (_Mode) { - inherits(SurfaceMode, _Mode); - - function SurfaceMode(opts) { - var _this; - - classCallCheck(this, SurfaceMode); - - _this = possibleConstructorReturn(this, getPrototypeOf(SurfaceMode).call(this, opts)); - _this.depGroups = _this.depGroups.slice(0); // clone depGroups to prevent prototype edits - - var surfaces = _this.surfaceNames; - var groups = _this.depGroups; - - for (var i = 0, n = surfaces.length; i < n; ++i) { - groups[groups.length] = [surfaces[i], getRenderParams$1]; - } - - return _this; - } - - createClass(SurfaceMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(atom) { - return atom.element.radius; - } - }, { - key: "getVisibilitySelector", - value: function getVisibilitySelector() { - var visibilitySelector = null; - - if (this.opts.subset !== '') { - var res = selectors$1.parse(this.opts.subset); - - if (!res.error) { - visibilitySelector = res.selector; - } - } - - return visibilitySelector; - } - }]); - - return SurfaceMode; -}(Mode); - -SurfaceMode.prototype.isSurface = true; -SurfaceMode.prototype.surfaceNames = []; - -var QuickSurfaceMode = /*#__PURE__*/function (_SurfaceMode) { - inherits(QuickSurfaceMode, _SurfaceMode); - - function QuickSurfaceMode() { - classCallCheck(this, QuickSurfaceMode); - - return possibleConstructorReturn(this, getPrototypeOf(QuickSurfaceMode).apply(this, arguments)); - } - - createClass(QuickSurfaceMode, [{ - key: "getSurfaceOpts", - value: function getSurfaceOpts() { - return { - useBeads: false, - isoValue: this.opts.isoValue, - gaussLim: this.opts.gaussLim[this.settings.now.resolution], - radScale: this.opts.scale, - gridSpacing: this.opts.gridSpacing[this.settings.now.resolution], - zClip: this.opts.zClip, - visibilitySelector: this.getVisibilitySelector() - }; - } - }]); - - return QuickSurfaceMode; -}(SurfaceMode); - -defineProperty(QuickSurfaceMode, "id", 'QS'); - -QuickSurfaceMode.prototype.id = 'QS'; -QuickSurfaceMode.prototype.name = 'Quick Surface'; -QuickSurfaceMode.prototype.shortName = 'Quick Surf'; -QuickSurfaceMode.prototype.surfaceNames = ['QuickSurfGeo']; - -var IsoSurfaceMode = /*#__PURE__*/function (_SurfaceMode) { - inherits(IsoSurfaceMode, _SurfaceMode); - - function IsoSurfaceMode(excludeProbe, opts) { - var _this; - - classCallCheck(this, IsoSurfaceMode); - - _this = possibleConstructorReturn(this, getPrototypeOf(IsoSurfaceMode).call(this, opts)); - _this._excludeProbe = excludeProbe; - return _this; - } - - createClass(IsoSurfaceMode, [{ - key: "calcAtomRadius", - value: function calcAtomRadius(atom) { - return atom.element.radius; - } - }, { - key: "getSurfaceOpts", - value: function getSurfaceOpts() { - return { - gridSpacing: this.opts.polyComplexity[this.settings.now.resolution], - radScale: this._radScale, - zClip: this.opts.zClip, - visibilitySelector: this.getVisibilitySelector(), - probeRadius: this.opts.probeRadius, - excludeProbe: this._excludeProbe - }; - } - }]); - - return IsoSurfaceMode; -}(SurfaceMode); - -IsoSurfaceMode.prototype.id = 'SU'; -IsoSurfaceMode.prototype.name = 'Surface'; -IsoSurfaceMode.prototype.shortName = 'Surface'; -IsoSurfaceMode.prototype.surfaceNames = ['SASSESSurfaceGeo']; -IsoSurfaceMode.prototype._radScale = 1; -IsoSurfaceMode.prototype._excludeProbe = false; - -var IsoSurfaceSASMode = /*#__PURE__*/function (_IsoSurfaceMode) { - inherits(IsoSurfaceSASMode, _IsoSurfaceMode); - - function IsoSurfaceSASMode(opts) { - classCallCheck(this, IsoSurfaceSASMode); - - return possibleConstructorReturn(this, getPrototypeOf(IsoSurfaceSASMode).call(this, false, opts)); - } - - return IsoSurfaceSASMode; -}(IsoSurfaceMode); - -defineProperty(IsoSurfaceSASMode, "id", 'SA'); - -IsoSurfaceSASMode.prototype.id = 'SA'; -IsoSurfaceSASMode.prototype.name = 'Solvent Accessible Surface'; -IsoSurfaceSASMode.prototype.shortName = 'SAS'; - -var IsoSurfaceSESMode = /*#__PURE__*/function (_IsoSurfaceMode) { - inherits(IsoSurfaceSESMode, _IsoSurfaceMode); - - function IsoSurfaceSESMode(opts) { - classCallCheck(this, IsoSurfaceSESMode); - - return possibleConstructorReturn(this, getPrototypeOf(IsoSurfaceSESMode).call(this, true, opts)); - } - - return IsoSurfaceSESMode; -}(IsoSurfaceMode); - -defineProperty(IsoSurfaceSESMode, "id", 'SE'); - -IsoSurfaceSESMode.prototype.id = 'SE'; -IsoSurfaceSESMode.prototype.name = 'Solvent Excluded Surface'; -IsoSurfaceSESMode.prototype.shortName = 'SES'; - -var ContactSurfaceMode = /*#__PURE__*/function (_SurfaceMode) { - inherits(ContactSurfaceMode, _SurfaceMode); - - function ContactSurfaceMode() { - classCallCheck(this, ContactSurfaceMode); - - return possibleConstructorReturn(this, getPrototypeOf(ContactSurfaceMode).apply(this, arguments)); - } - - createClass(ContactSurfaceMode, [{ - key: "getSurfaceOpts", - value: function getSurfaceOpts() { - return { - probeRadius: this.opts.probeRadius, - radScale: this.opts.polyComplexity[this.settings.now.resolution], - scaleFactor: this.opts.polyComplexity[this.settings.now.resolution], - gridSpacing: 1.0 / this.opts.polyComplexity[this.settings.now.resolution], - isoValue: this.opts.isoValue, - probePositions: this.opts.probePositions, - zClip: this.opts.zClip, - visibilitySelector: this.getVisibilitySelector() - }; - } - }]); - - return ContactSurfaceMode; -}(SurfaceMode); - -defineProperty(ContactSurfaceMode, "id", 'CS'); - -ContactSurfaceMode.prototype.id = 'CS'; -ContactSurfaceMode.prototype.name = 'Contact Surface'; -ContactSurfaceMode.prototype.shortName = 'Contact Surf'; -ContactSurfaceMode.prototype.isSurface = true; -ContactSurfaceMode.prototype.surfaceNames = ['ContactSurfaceGeo']; - -var TextMode = /*#__PURE__*/function (_Mode) { - inherits(TextMode, _Mode); - - function TextMode() { - classCallCheck(this, TextMode); - - return possibleConstructorReturn(this, getPrototypeOf(TextMode).apply(this, arguments)); - } - - createClass(TextMode, [{ - key: "getTemplateOptions", - value: function getTemplateOptions() { - return this.opts.template; - } - }, { - key: "getLabelOpts", - value: function getLabelOpts() { - return _.merge(this.opts, { - colors: true, - adjustColor: true, - transparent: true - }); - } - }]); - - return TextMode; -}(Mode); - -defineProperty(TextMode, "id", 'TX'); - -TextMode.prototype.id = 'TX'; -TextMode.prototype.name = 'Text mode'; -TextMode.prototype.shortName = 'Text'; -TextMode.prototype.depGroups = ['TextLabelsGeo']; - -var modes = new EntityList([LinesMode, LicoriceMode, BallsAndSticksMode, VanDerWaalsMode, TraceMode, TubeMode, CartoonMode, QuickSurfaceMode, IsoSurfaceSASMode, IsoSurfaceSESMode, ContactSurfaceMode, TextMode]); - -function clamp(x, a, b) { - return x <= b ? x < 0 ? 0 : x : b; -} - -function lerpColor(c1, c2, alpha) { - var beta = 1 - alpha; - var r1 = c1 >> 16 & 0xff; - var g1 = c1 >> 8 & 0xff; - var b1 = c1 & 0xff; - var r2 = c2 >> 16 & 0xff; - var g2 = c2 >> 8 & 0xff; - var b2 = c2 & 0xff; - var r = beta * r1 + alpha * r2; - var g = beta * g1 + alpha * g2; - var b = beta * b1 + alpha * b2; - return r << 16 | g << 8 | b; -} - -var Palette = /*#__PURE__*/function () { - function Palette(name, id) { - classCallCheck(this, Palette); - - this.name = name || 'Custom'; - this.id = id || 'CP'; - } - - createClass(Palette, [{ - key: "getElementColor", - value: function getElementColor(name) { - var asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var color = this.elementColors[name]; - return color === undefined && !asIs ? this.defaultElementColor : color; - } - }, { - key: "getResidueColor", - value: function getResidueColor(name) { - var asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var color = this.residueColors[name]; - return color === undefined && !asIs ? this.defaultResidueColor : color; - } - }, { - key: "getChainColor", - value: function getChainColor(name) { - var chain = name.charCodeAt(0); - chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F) % this.chainColors.length; - return this.chainColors[chain]; - } - }, { - key: "getSecondaryColor", - value: function getSecondaryColor(type) { - var asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var color = this.secondaryColors[type]; - return color === undefined && !asIs ? this.defaultSecondaryColor : color; - } - }, { - key: "getSequentialColor", - value: function getSequentialColor(index) { - var colors = this.colors; - var len = colors.length; - return index < 0 ? colors[index % len + len] : colors[index % len]; - } - }, { - key: "getGradientColor", - value: function getGradientColor(value, gradientName) { - var gradient = this.gradients[gradientName]; - - if (!gradient) { - return this.defaultNamedColor; - } - - var count = gradient.length; - var index = value * (count - 1); - var left = Math.floor(index); - var right = clamp(left + 1, 0, count - 1); - left = clamp(left, 0, count - 1); - return lerpColor(gradient[left], gradient[right], index - left); - } - }, { - key: "getNamedColor", - value: function getNamedColor(name) { - var asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var color = this.namedColors[name]; - return color === undefined && !asIs ? this.defaultNamedColor : color; - } - }]); - - return Palette; -}(); - -_.assign(Palette.prototype, { - colors: [0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0x808080], - minRangeColor: 0x000000, - midRangeColor: 0x7F7F7F, - maxRangeColor: 0xFFFFFF, - defaultElementColor: 0xFFFFFF, - elementColors: {}, - defaultResidueColor: 0xFFFFFF, - residueColors: {}, - chainColors: [0xFFFFFF], - defaultSecondaryColor: 0xFFFFFF, - secondaryColors: {}, - defaultGradientColor: 0x000000, - defaultNamedColor: 0xFFFFFF, - namedColorsArray: [ - /* eslint-disable no-multi-spaces */ - ['indianred', 0xcd5c5c], ['lightcoral', 0xf08080], ['salmon', 0xfa8072], ['darksalmon', 0xe9967a], ['lightsalmon', 0xffa07a], ['crimson', 0xdc143c], ['red', 0xff0000], ['firebrick', 0xb22222], ['darkred', 0x8b0000], ['pink', 0xffc0cb], ['lightpink', 0xffb6c1], ['hotpink', 0xff69b4], ['deeppink', 0xff1493], ['mediumvioletred', 0xc71585], ['palevioletred', 0xdb7093], ['coral', 0xff7f50], ['tomato', 0xff6347], ['orangered', 0xff4500], ['darkorange', 0xff8c00], ['orange', 0xffa500], ['gold', 0xffd700], ['yellow', 0xffff00], ['lightyellow', 0xffffe0], ['lemonchiffon', 0xfffacd], ['lightgoldenrodyellow', 0xfafad2], ['papayawhip', 0xffefd5], ['moccasin', 0xffe4b5], ['peachpuff', 0xffdab9], ['palegoldenrod', 0xeee8aa], ['khaki', 0xf0e68c], ['darkkhaki', 0xbdb76b], ['lavender', 0xe6e6fa], ['thistle', 0xd8bfd8], ['plum', 0xdda0dd], ['violet', 0xee82ee], ['orchid', 0xda70d6], ['fuchsia', 0xff00ff], ['magenta', 0xff00ff], ['mediumorchid', 0xba55d3], ['mediumpurple', 0x9370db], ['rebeccapurple', 0x663399], ['blueviolet', 0x8a2be2], ['darkviolet', 0x9400d3], ['darkorchid', 0x9932cc], ['darkmagenta', 0x8b008b], ['purple', 0x800080], ['indigo', 0x4b0082], ['slateblue', 0x6a5acd], ['mediumslateblue', 0x7b68ee], ['darkslateblue', 0x483d8b], ['greenyellow', 0xadff2f], ['chartreuse', 0x7fff00], ['lawngreen', 0x7cfc00], ['lime', 0x00ff00], ['limegreen', 0x32cd32], ['palegreen', 0x98fb98], ['lightgreen', 0x90ee90], ['mediumspringgreen', 0x00fa9a], ['springgreen', 0x00ff7f], ['mediumseagreen', 0x3cb371], ['seagreen', 0x2e8b57], ['forestgreen', 0x228b22], ['green', 0x008000], ['darkgreen', 0x006400], ['yellowgreen', 0x9acd32], ['olivedrab', 0x6b8e23], ['olive', 0x808000], ['darkolivegreen', 0x556b2f], ['mediumaquamarine', 0x66cdaa], ['darkseagreen', 0x8fbc8f], ['lightseagreen', 0x20b2aa], ['darkcyan', 0x008b8b], ['teal', 0x008080], ['aqua', 0x00ffff], ['cyan', 0x00ffff], ['lightcyan', 0xe0ffff], ['paleturquoise', 0xafeeee], ['aquamarine', 0x7fffd4], ['turquoise', 0x40e0d0], ['mediumturquoise', 0x48d1cc], ['darkturquoise', 0x00ced1], ['cadetblue', 0x5f9ea0], ['steelblue', 0x4682b4], ['lightsteelblue', 0xb0c4de], ['powderblue', 0xb0e0e6], ['lightblue', 0xadd8e6], ['skyblue', 0x87ceeb], ['lightskyblue', 0x87cefa], ['deepskyblue', 0x00bfff], ['dodgerblue', 0x1e90ff], ['cornflowerblue', 0x6495ed], ['royalblue', 0x4169e1], ['blue', 0x0000ff], ['mediumblue', 0x0000cd], ['darkblue', 0x00008b], ['navy', 0x000080], ['midnightblue', 0x191970], ['cornsilk', 0xfff8dc], ['blanchedalmond', 0xffebcd], ['bisque', 0xffe4c4], ['navajowhite', 0xffdead], ['wheat', 0xf5deb3], ['burlywood', 0xdeb887], ['tan', 0xd2b48c], ['rosybrown', 0xbc8f8f], ['sandybrown', 0xf4a460], ['goldenrod', 0xdaa520], ['darkgoldenrod', 0xb8860b], ['peru', 0xcd853f], ['chocolate', 0xd2691e], ['saddlebrown', 0x8b4513], ['sienna', 0xa0522d], ['brown', 0xa52a2a], ['maroon', 0x800000], ['white', 0xffffff], ['snow', 0xfffafa], ['honeydew', 0xf0fff0], ['mintcream', 0xf5fffa], ['azure', 0xf0ffff], ['aliceblue', 0xf0f8ff], ['ghostwhite', 0xf8f8ff], ['whitesmoke', 0xf5f5f5], ['seashell', 0xfff5ee], ['beige', 0xf5f5dc], ['oldlace', 0xfdf5e6], ['floralwhite', 0xfffaf0], ['ivory', 0xfffff0], ['antiquewhite', 0xfaebd7], ['linen', 0xfaf0e6], ['lavenderblush', 0xfff0f5], ['mistyrose', 0xffe4e1], ['gainsboro', 0xdcdcdc], ['lightgray', 0xd3d3d3], ['silver', 0xc0c0c0], ['darkgray', 0xa9a9a9], ['gray', 0x808080], ['dimgray', 0x696969], ['lightslategray', 0x778899], ['slategray', 0x708090], ['darkslategray', 0x2f4f4f], ['black', 0x000000] - /* eslint-enable no-multi-spaces */ - ], - namedColors: {}, - - /* eslint-enable no-magic-numbers */ - gradients: { - rainbow: [0x0000ff, // blue - 0x00ffff, // cyan - 0x00ff00, // green - 0xffff00, // yellow - 0xff0000 // red - ], - temp: [0x0000ff, // blue - 0x007fff, // light-blue - 0xffffff, // white - 0xff7f00, // orange - 0xff0000 // red - ], - hot: [0xffffff, // white - 0xff7f00, // orange - 0xff0000 // red - ], - cold: [0xffffff, // white - 0x007fff, // light-blue - 0x0000ff // blue - ], - 'blue-red': [0x0000ff, // blue - 0xffffff, // white - 0xff0000 // red - ], - reds: [0xffffff, // white - 0xff0000 // red - ], - blues: [0xffffff, // white - 0x0000ff // blue - ] - } -}); - -var _Palette$prototype = Palette.prototype, - namedColorsArray = _Palette$prototype.namedColorsArray, - namedColors = _Palette$prototype.namedColors; - -for (var i = 0, length = namedColorsArray.length; i < length; ++i) { - var _namedColorsArray$i = slicedToArray(namedColorsArray[i], 2), - name = _namedColorsArray$i[0], - value = _namedColorsArray$i[1]; - - namedColors[name] = value; -} - -var palette = new Palette('CPK', 'CP'); // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. - -palette.elementColors = { - /* eslint-disable no-magic-numbers */ - H: 0xFFFFFF, - C: 0x202020, - N: 0x2060FF, - O: 0xEE2010, - F: 0x00FF00, - P: 0x8020FF, - S: 0xFFFF00, - CL: 0x00BB00, - FE: 0xD0D0D0, - CO: 0xD0D0D0, - NI: 0xD0D0D0, - CU: 0xD0D0D0, - BR: 0x008800, - I: 0x005500 - /* eslint-enable no-magic-numbers */ - -}; - -var _palette$secondaryCol; -var palette$1 = new Palette('Jmol', 'JM'); -palette$1.colors = [ -/* eslint-disable no-magic-numbers */ -0x0000FF, // blue -0x0055FF, // -0x00ABFF, // -0x00FFFF, // cyan -0x00FFAB, // -0x00FF55, // -0x00FF00, // green -0x55FF00, // -0xABFF00, // -0xFFFF00, // yellow -0xFFAB00, // -0xFF5500, // -0xFF0000, // red -0xFF0055, // -0xFF00AB, // -0xFF00FF, // magenta -0xAB00FF, // -0x5500FF // - -/* eslint-enable no-magic-numbers */ -]; // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. - -palette$1.elementColors = { - /* eslint-disable no-magic-numbers */ - H: 0xFFFFFF, - D: 0xFFFFC0, - T: 0xFFFFA0, - HE: 0xD9FFFF, - LI: 0xCC80FF, - BE: 0xC2FF00, - B: 0xFFB5B5, - C: 0x909090, - N: 0x3050F8, - O: 0xFF0D0D, - F: 0x90E050, - NE: 0xB3E3F5, - NA: 0xAB5CF2, - MG: 0x8AFF00, - AL: 0xBFA6A6, - SI: 0xF0C8A0, - P: 0xFF8000, - S: 0xFFFF30, - CL: 0x1FF01F, - AR: 0x80D1E3, - K: 0x8F40D4, - CA: 0x3DFF00, - SC: 0xE6E6E6, - TI: 0xBFC2C7, - V: 0xA6A6AB, - CR: 0x8A99C7, - MN: 0x9C7AC7, - FE: 0xE06633, - CO: 0xF090A0, - NI: 0x50D050, - CU: 0xC88033, - ZN: 0x7D80B0, - GA: 0xC28F8F, - GE: 0x668F8F, - AS: 0xBD80E3, - SE: 0xFFA100, - BR: 0xA62929, - KR: 0x5CB8D1, - RB: 0x702EB0, - SR: 0x00FF00, - Y: 0x94FFFF, - ZR: 0x94E0E0, - NB: 0x73C2C9, - MO: 0x54B5B5, - TC: 0x3B9E9E, - RU: 0x248F8F, - RH: 0x0A7D8C, - PD: 0x006985, - AG: 0xC0C0C0, - CD: 0xFFD98F, - IN: 0xA67573, - SN: 0x668080, - SB: 0x9E63B5, - TE: 0xD47A00, - I: 0x940094, - XE: 0x429EB0, - CS: 0x57178F, - BA: 0x00C900, - LA: 0x70D4FF, - CE: 0xFFFFC7, - PR: 0xD9FFC7, - ND: 0xC7FFC7, - PM: 0xA3FFC7, - SM: 0x8FFFC7, - EU: 0x61FFC7, - GD: 0x45FFC7, - TB: 0x30FFC7, - DY: 0x1FFFC7, - HO: 0x00FF9C, - ER: 0x00E675, - TM: 0x00D452, - YB: 0x00BF38, - LU: 0x00AB24, - HF: 0x4DC2FF, - TA: 0x4DA6FF, - W: 0x2194D6, - RE: 0x267DAB, - OS: 0x266696, - IR: 0x175487, - PT: 0xD0D0E0, - AU: 0xFFD123, - HG: 0xB8B8D0, - TL: 0xA6544D, - PB: 0x575961, - BI: 0x9E4FB5, - PO: 0xAB5C00, - AT: 0x754F45, - RN: 0x428296, - FR: 0x420066, - RA: 0x007D00, - AC: 0x70ABFA, - TH: 0x00BAFF, - PA: 0x00A1FF, - U: 0x008FFF, - NP: 0x0080FF, - PU: 0x006BFF, - AM: 0x545CF2, - CM: 0x785CE3, - BK: 0x8A4FE3, - CF: 0xA136D4, - ES: 0xB31FD4, - FM: 0xB31FBA, - MD: 0xB30DA6, - NO: 0xBD0D87, - LR: 0xC70066, - RF: 0xCC0059, - DB: 0xD1004F, - SG: 0xD90045, - BH: 0xE00038, - HS: 0xE6002E, - MT: 0xEB0026 - /* eslint-enable no-magic-numbers */ - -}; -palette$1.defaultResidueColor = 0xBEA06E; // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. - -palette$1.residueColors = { - /* eslint-disable no-magic-numbers */ - ALA: 0xC8C8C8, - ARG: 0x145AFF, - ASN: 0x00DCDC, - ASP: 0xE60A0A, - CYS: 0xE6E600, - GLN: 0x00DCDC, - GLU: 0xE60A0A, - GLY: 0xEBEBEB, - HIS: 0x8282D2, - ILE: 0x0F820F, - LEU: 0x0F820F, - LYS: 0x145AFF, - MET: 0xE6E600, - PHE: 0x3232AA, - PRO: 0xDC9682, - SER: 0xFA9600, - THR: 0xFA9600, - TRP: 0xB45AB4, - TYR: 0x3232AA, - VAL: 0x0F820F, - A: 0xA0A0FF, - C: 0xFF8C4B, - G: 0xFF7070, - I: 0x80FFFF, - T: 0xA0FFA0, - U: 0xFF8080, - DA: 0xA0A0FF, - DC: 0xFF8C4B, - DG: 0xFF7070, - DI: 0x80FFFF, - DT: 0xA0FFA0, - DU: 0xFF8080, - '+A': 0xA0A0FF, - '+C': 0xFF8C4B, - '+G': 0xFF7070, - '+I': 0x80FFFF, - '+T': 0xA0FFA0, - '+U': 0xFF8080 - /* eslint-enable no-magic-numbers */ - -}; -palette$1.chainColors = [// ' '->0 'A'->1, 'B'->2 -0xFFffffff, // ' ' & '0' white -// -0xFFC0D0FF, // skyblue -0xFFB0FFB0, // pastel green -0xFFFFC0C8, // pink -0xFFFFFF80, // pastel yellow -0xFFFFC0FF, // pastel magenta -0xFFB0F0F0, // pastel cyan -0xFFFFD070, // pastel gold -0xFFF08080, // lightcoral -0xFFF5DEB3, // wheat -0xFF00BFFF, // deepskyblue -0xFFCD5C5C, // indianred -0xFF66CDAA, // mediumaquamarine -0xFF9ACD32, // yellowgreen -0xFFEE82EE, // violet -0xFF00CED1, // darkturquoise -0xFF00FF7F, // springgreen -0xFF3CB371, // mediumseagreen -0xFF00008B, // darkblue -0xFFBDB76B, // darkkhaki -0xFF006400, // darkgreen -0xFF800000, // maroon -0xFF808000, // olive -0xFF800080, // purple -0xFF008080, // teal -0xFFB8860B, // darkgoldenrod -0xFFB22222 // firebrick -]; -var StructuralElementType$3 = StructuralElement.Type; -palette$1.secondaryColors = (_palette$secondaryCol = {}, defineProperty(_palette$secondaryCol, StructuralElementType$3.HELIX_ALPHA, 0xFF0080), defineProperty(_palette$secondaryCol, StructuralElementType$3.HELIX_PI, 0x600080), defineProperty(_palette$secondaryCol, StructuralElementType$3.HELIX_310, 0xA00080), defineProperty(_palette$secondaryCol, StructuralElementType$3.STRAND, 0xFFC800), defineProperty(_palette$secondaryCol, StructuralElementType$3.TURN, 0x6080FF), defineProperty(_palette$secondaryCol, "dna", 0xAE00FE), defineProperty(_palette$secondaryCol, "rna", 0xFD0162), _palette$secondaryCol); - -var _palette$secondaryCol$1; -var palette$2 = new Palette('VMD', 'VM'); -palette$2.colors = [ -/* eslint-disable no-magic-numbers */ -0x0000FF, // blue -0xFF0000, // red -0x606060, // gray -0xFF8000, // orange -0xFFFF00, // yellow -0x808033, // tan -0x999999, // silver -0x00FF00, // green -0xFFFFFF, // white -0xFF9999, // pink -0x40C0C0, // cyan -0xA600A6, // purple -0x80E666, // lime -0xE666B3, // mauve -0x804D00, // ochre -0x8080C0 // ice blue - -/* eslint-enable no-magic-numbers */ -]; -palette$2.defaultElementColor = 0x804D00; // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. - -palette$2.elementColors = { - /* eslint-disable no-magic-numbers */ - H: 0xFFFFFF, - C: 0x40BFBF, - N: 0x0000FF, - O: 0xFF0000, - P: 0x808033, - S: 0xFFFF00 - /* eslint-enable no-magic-numbers */ - -}; -palette$2.defaultResidueColor = 0x40C0C0; // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. - -palette$2.residueColors = { - /* eslint-disable no-magic-numbers */ - ALA: 0x0000FF, - ARG: 0xFFFFFF, - ASN: 0x808033, - ASP: 0xFF0000, - CYS: 0xFFFF00, - GLN: 0xFF8000, - GLU: 0xFF9999, - GLY: 0xFFFFFF, - HIS: 0x40C0C0, - ILE: 0x00FF00, - LEU: 0xFF9999, - LYS: 0x40C0C0, - MET: 0xFFFF00, - PHE: 0xA600A6, - PRO: 0x804C00, - SER: 0xFFFF00, - THR: 0xE666B3, - TRP: 0x999999, - TYR: 0x00FF00, - VAL: 0x808033, - A: 0x0000FF, - C: 0xFF8000, - G: 0xFFFF00, - T: 0xA600A6, - U: 0x00FF00, - DA: 0x0000FF, - DC: 0xFF8000, - DG: 0xFFFF00, - DT: 0xA600A6, - DU: 0x00FF00, - '+A': 0x0000FF, - '+C': 0xFF8000, - '+G': 0xFFFF00, - '+T': 0xA600A6, - '+U': 0x00FF00, - WAT: 0x40C0C0, - H2O: 0x40C0C0, - HOH: 0x40C0C0 - /* eslint-enable no-magic-numbers */ - -}; -palette$2.chainColors = [0xFFFFFF].concat(palette$2.colors); -var StructuralElementType$4 = StructuralElement.Type; -palette$2.secondaryColors = (_palette$secondaryCol$1 = {}, defineProperty(_palette$secondaryCol$1, StructuralElementType$4.HELIX_ALPHA, 0xA600A6), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.HELIX_310, 0x0000FF), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.HELIX_PI, 0xFF0000), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.STRAND, 0xFFFF00), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.BRIDGE, 0x808033), defineProperty(_palette$secondaryCol$1, StructuralElementType$4.TURN, 0x40C0C0), _palette$secondaryCol$1); - -var palettes = new EntityList([palette, palette$1, palette$2]); - -/** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. - * - * These options are copied locally and not kept by reference, so the created instance will not reflect further - * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation. - * - * @exports Colorer - * @this Colorer - * @abstract - * @constructor - * @classdesc Basic class for all available coloring algorithms used for building and displaying molecule geometry. - */ - -var Colorer = /*#__PURE__*/function () { - function Colorer(opts) { - classCallCheck(this, Colorer); - - if (this.constructor === Colorer) { - throw new Error('Can not instantiate abstract class!'); - } - /** - * Colorer options inherited (prototyped) from defaults. - * @type {object} - */ - - - this.opts = _.merge(utils.deriveDeep(settings.now.colorers[this.id], true), opts); - /** - * Palette in use. - * @type {Palette} - */ - - this.palette = palettes.first; - } - /** - * Get Colorer identification, probably with options. - * @returns {string|Array} Colorer identifier string ({@link Colorer#id}) or two-element array containing both colorer - * identifier and options ({@link Colorer#opts}). - * Options are returned if they were changed during or after colorer creation. - */ - - - createClass(Colorer, [{ - key: "identify", - value: function identify() { - var diff = utils.objectsDiff(this.opts, settings.now.colorers[this.id]); - - if (!_.isEmpty(diff)) { - return [this.id, diff]; - } - - return this.id; - } - }]); - - return Colorer; -}(); -/** - * Colorer identifier. - * @type {string} - */ - - -Colorer.prototype.id = '__'; - -/** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @see Element - * - * @exports ElementColorer - * @augments Colorer - * @constructor - * @classdesc Coloring algorithm based on chemical element. - */ - -var ElementColorer = /*#__PURE__*/function (_Colorer) { - inherits(ElementColorer, _Colorer); - - function ElementColorer() { - classCallCheck(this, ElementColorer); - - return possibleConstructorReturn(this, getPrototypeOf(ElementColorer).apply(this, arguments)); - } - - createClass(ElementColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - var type = atom.element.name; - - if (type === 'C' && this.opts.carbon >= 0) { - return this.opts.carbon; - } - - return this.palette.getElementColor(type); - } - }, { - key: "getResidueColor", - value: function getResidueColor(_residue, _complex) { - return this.palette.defaultResidueColor; - } - }]); - - return ElementColorer; -}(Colorer); - -defineProperty(ElementColorer, "id", 'EL'); - -ElementColorer.prototype.id = 'EL'; -ElementColorer.prototype.name = 'Element'; -ElementColorer.prototype.shortName = 'Element'; - -/** - * Coloring algorithm based on residue type. - * - * @see ResidueType - * - * @exports ResidueTypeColorer - * @constructor - */ - -var ResidueTypeColorer = /*#__PURE__*/function (_Colorer) { - inherits(ResidueTypeColorer, _Colorer); - - function ResidueTypeColorer() { - classCallCheck(this, ResidueTypeColorer); - - return possibleConstructorReturn(this, getPrototypeOf(ResidueTypeColorer).apply(this, arguments)); - } - - createClass(ResidueTypeColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - return this.palette.getResidueColor(residue._type._name); - } - }]); - - return ResidueTypeColorer; -}(Colorer); - -defineProperty(ResidueTypeColorer, "id", 'RT'); - -ResidueTypeColorer.prototype.id = 'RT'; -ResidueTypeColorer.prototype.name = 'Residue Type'; -ResidueTypeColorer.prototype.shortName = 'Residue'; - -var SequenceColorer = /*#__PURE__*/function (_Colorer) { - inherits(SequenceColorer, _Colorer); - - function SequenceColorer() { - classCallCheck(this, SequenceColorer); - - return possibleConstructorReturn(this, getPrototypeOf(SequenceColorer).apply(this, arguments)); - } - - createClass(SequenceColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var chain = residue._chain; - - if (chain.minSequence === Number.POSITIVE_INFINITY && chain.maxSequence === Number.NEGATIVE_INFINITY) { - return this.palette.defaultNamedColor; - } - - var min = chain.minSequence; - var max = chain.maxSequence > min ? chain.maxSequence : min + 1; - return this.palette.getGradientColor((residue._sequence - min) / (max - min), this.opts.gradient); - } - }]); - - return SequenceColorer; -}(Colorer); - -defineProperty(SequenceColorer, "id", 'SQ'); - -SequenceColorer.prototype.id = 'SQ'; -SequenceColorer.prototype.name = 'Sequence'; -SequenceColorer.prototype.shortName = 'Sequence'; - -var ChainColorer = /*#__PURE__*/function (_Colorer) { - inherits(ChainColorer, _Colorer); - - function ChainColorer() { - classCallCheck(this, ChainColorer); - - return possibleConstructorReturn(this, getPrototypeOf(ChainColorer).apply(this, arguments)); - } - - createClass(ChainColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - return this.palette.getChainColor(residue.getChain()._name); - } - }]); - - return ChainColorer; -}(Colorer); - -defineProperty(ChainColorer, "id", 'CH'); - -ChainColorer.prototype.id = 'CH'; -ChainColorer.prototype.name = 'Chain'; -ChainColorer.prototype.shortName = 'Chain'; - -var SecondaryStructureColorer = /*#__PURE__*/function (_Colorer) { - inherits(SecondaryStructureColorer, _Colorer); - - function SecondaryStructureColorer() { - classCallCheck(this, SecondaryStructureColorer); - - return possibleConstructorReturn(this, getPrototypeOf(SecondaryStructureColorer).apply(this, arguments)); - } - - createClass(SecondaryStructureColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - if (residue._type.flags & ResidueType.Flags.DNA) { - return this.palette.getSecondaryColor('dna'); - } - - if (residue._type.flags & ResidueType.Flags.RNA) { - return this.palette.getSecondaryColor('rna'); - } - - var secondary = residue.getSecondary(); - - if (secondary) { - var color = this.palette.getSecondaryColor(secondary.type, true); - - if (color === undefined) { - color = this.palette.getSecondaryColor(secondary.generic); - } - - return color; - } - - return this.palette.defaultSecondaryColor; - } - }]); - - return SecondaryStructureColorer; -}(Colorer); - -defineProperty(SecondaryStructureColorer, "id", 'SS'); - -SecondaryStructureColorer.prototype.id = 'SS'; -SecondaryStructureColorer.prototype.name = 'Secondary Structure'; -SecondaryStructureColorer.prototype.shortName = 'Structure'; - -var UniformColorer = /*#__PURE__*/function (_Colorer) { - inherits(UniformColorer, _Colorer); - - function UniformColorer() { - classCallCheck(this, UniformColorer); - - return possibleConstructorReturn(this, getPrototypeOf(UniformColorer).apply(this, arguments)); - } - - createClass(UniformColorer, [{ - key: "getAtomColor", - value: function getAtomColor(_atom, _complex) { - return this.opts.color; - } - }, { - key: "getResidueColor", - value: function getResidueColor(_residue, _complex) { - return this.opts.color; - } - }]); - - return UniformColorer; -}(Colorer); - -defineProperty(UniformColorer, "id", 'UN'); - -UniformColorer.prototype.id = 'UN'; -UniformColorer.prototype.name = 'Uniform'; -UniformColorer.prototype.shortName = 'Uniform'; - -/** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @exports ConditionalColorer - * @augments Colorer - * @constructor - * @classdesc Bicolor coloring algorithm based on a selector string used as a condition. - */ - -var ConditionalColorer = /*#__PURE__*/function (_Colorer) { - inherits(ConditionalColorer, _Colorer); - - function ConditionalColorer(opts) { - var _this; - - classCallCheck(this, ConditionalColorer); - - _this = possibleConstructorReturn(this, getPrototypeOf(ConditionalColorer).call(this, opts)); - var parsed = selectors.parse(_this.opts.subset); - _this._subsetCached = parsed.error ? selectors.none() : parsed.selector; - return _this; - } - - createClass(ConditionalColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - return this._subsetCached.includesAtom(atom) ? this.opts.color : this.opts.baseColor; - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var subset = this._subsetCached; - var includes = true; - var atoms = residue._atoms; - - for (var i = 0, n = atoms.length; i < n; ++i) { - includes = includes && subset.includesAtom(atoms[i]); - } - - return includes ? this.opts.color : this.opts.baseColor; - } - }]); - - return ConditionalColorer; -}(Colorer); - -defineProperty(ConditionalColorer, "id", 'CO'); - -ConditionalColorer.prototype.id = 'CO'; -ConditionalColorer.prototype.name = 'Conditional'; -ConditionalColorer.prototype.shortName = 'Conditional'; - -var ConformationColorer = /*#__PURE__*/function (_Colorer) { - inherits(ConformationColorer, _Colorer); - - function ConformationColorer() { - classCallCheck(this, ConformationColorer); - - return possibleConstructorReturn(this, getPrototypeOf(ConformationColorer).apply(this, arguments)); - } - - createClass(ConformationColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - return this.palette.getChainColor(String.fromCharCode(atom.location)); - } - }, { - key: "getResidueColor", - value: function getResidueColor(_residue, _complex) { - return this.palette.defaultResidueColor; - } - }]); - - return ConformationColorer; -}(Colorer); - -defineProperty(ConformationColorer, "id", 'CF'); - -ConformationColorer.prototype.id = 'CF'; -ConformationColorer.prototype.name = 'Conformation'; -ConformationColorer.prototype.shortName = 'Conformation'; - -/** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @see Temperature - * - * @exports TemperatureColorer - * @augments Colorer - * @constructor - * @classdesc Coloring algorithm based on temperature of chemical element. - */ - -var TemperatureColorer = /*#__PURE__*/function (_Colorer) { - inherits(TemperatureColorer, _Colorer); - - function TemperatureColorer() { - classCallCheck(this, TemperatureColorer); - - return possibleConstructorReturn(this, getPrototypeOf(TemperatureColorer).apply(this, arguments)); - } - - createClass(TemperatureColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - var opts = this.opts; - var factor = 1; - - if (atom.temperature && opts) { - if (opts.min === opts.max) { - factor = atom.temperature > opts.max ? 1 : 0; - } else { - factor = (atom.temperature - opts.min) / (opts.max - opts.min); - } - - return this.palette.getGradientColor(factor, opts.gradient); - } - - return this.palette.defaultGradientColor; - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var opts = this.opts; - - if (!opts) { - return this.palette.defaultGradientColor; - } - - if (residue.temperature) { - var factor = 0; - - if (opts.min === opts.max) { - factor = residue.temperature > opts.max ? 1 : 0; - } else { - factor = (residue.temperature - opts.min) / (opts.max - opts.min); - } - - return this.palette.getGradientColor(factor, opts.gradient); - } - - return this.palette.defaultGradientColor; - } - }]); - - return TemperatureColorer; -}(Colorer); - -defineProperty(TemperatureColorer, "id", 'TM'); - -TemperatureColorer.prototype.id = 'TM'; // [T]e[M]perature - -TemperatureColorer.prototype.name = 'Temperature'; -TemperatureColorer.prototype.shortName = 'Temperature'; - -/** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @see Occupancy - * - * @exports OccupancyColorer - * @augments Occupancy - * @constructor - * @classdesc Coloring algorithm based on occupancy of chemical element. - */ - -var OccupancyColorer = /*#__PURE__*/function (_Colorer) { - inherits(OccupancyColorer, _Colorer); - - function OccupancyColorer() { - classCallCheck(this, OccupancyColorer); - - return possibleConstructorReturn(this, getPrototypeOf(OccupancyColorer).apply(this, arguments)); - } - - createClass(OccupancyColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - var opts = this.opts; - - if (atom.occupancy && opts) { - var factor = 1 - atom.occupancy; - return this.palette.getGradientColor(factor, opts.gradient); - } - - return this.palette.defaultGradientColor; - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var opts = this.opts; - - if (!opts) { - return this.palette.defaultGradientColor; - } - - if (residue.occupancy > 0) { - var factor = 1 - residue.occupancy; - return this.palette.getGradientColor(factor, opts.gradient); - } - - return this.palette.defaultGradientColor; - } - }]); - - return OccupancyColorer; -}(Colorer); - -defineProperty(OccupancyColorer, "id", 'OC'); - -OccupancyColorer.prototype.id = 'OC'; // [OC]cupancy - -OccupancyColorer.prototype.name = 'Occupancy'; -OccupancyColorer.prototype.shortName = 'Occupancy'; - -var HydrophobicityColorer = /*#__PURE__*/function (_Colorer) { - inherits(HydrophobicityColorer, _Colorer); - - function HydrophobicityColorer() { - classCallCheck(this, HydrophobicityColorer); - - return possibleConstructorReturn(this, getPrototypeOf(HydrophobicityColorer).apply(this, arguments)); - } - - createClass(HydrophobicityColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var color = this.palette.defaultResidueColor; - - if (residue._type.hydrophobicity) { - // Kyte Doolitle hydro [-4.5,4.5]->[0.1] - var min = -4.5; - var max = 4.5; - color = this.palette.getGradientColor((residue._type.hydrophobicity - min) / (max - min), this.opts.gradient); - } - - return color; - } - }]); - - return HydrophobicityColorer; -}(Colorer); - -defineProperty(HydrophobicityColorer, "id", 'HY'); - -HydrophobicityColorer.prototype.id = 'HY'; -HydrophobicityColorer.prototype.name = 'Hydrophobicity'; -HydrophobicityColorer.prototype.shortName = 'Hydrophobicity'; - -var MoleculeColorer = /*#__PURE__*/function (_Colorer) { - inherits(MoleculeColorer, _Colorer); - - function MoleculeColorer() { - classCallCheck(this, MoleculeColorer); - - return possibleConstructorReturn(this, getPrototypeOf(MoleculeColorer).apply(this, arguments)); - } - - createClass(MoleculeColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, complex) { - return this.getResidueColor(atom.residue, complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(residue, _complex) { - var molecule = residue._molecule; - - var count = _complex.getMoleculeCount(); - - if (count > 1) { - return this.palette.getGradientColor((molecule.index - 1) / (count - 1), this.opts.gradient); - } - - return this.palette.getGradientColor(0, this.opts.gradient); - } - }]); - - return MoleculeColorer; -}(Colorer); - -defineProperty(MoleculeColorer, "id", 'MO'); - -MoleculeColorer.prototype.id = 'MO'; -MoleculeColorer.prototype.name = 'Molecule'; -MoleculeColorer.prototype.shortName = 'Molecule'; - -function scaleColor(c, factor) { - var r1 = c >> 16 & 0xff; - var g1 = c >> 8 & 0xff; - var b1 = c & 0xff; - var r = factor * r1; - var g = factor * g1; - var b = factor * b1; - return r << 16 | g << 8 | b; -} -/** - * Create new colorer. - * - * @param {object=} opts - Options to override defaults with. See {@link Colorer}. - * - * @exports CarbonColorer - * @augments Colorer - * @constructor - * @classdesc Bicolor coloring algorithm based on selection carbon atoms. - */ - - -var CarbonColorer = /*#__PURE__*/function (_Colorer) { - inherits(CarbonColorer, _Colorer); - - function CarbonColorer() { - classCallCheck(this, CarbonColorer); - - return possibleConstructorReturn(this, getPrototypeOf(CarbonColorer).apply(this, arguments)); - } - - createClass(CarbonColorer, [{ - key: "getAtomColor", - value: function getAtomColor(atom, _complex) { - var colorCarbon = this.opts.color; - var colorNotCarbon = scaleColor(colorCarbon, this.opts.factor); - return atom.flags & Atom.Flags.CARBON ? colorCarbon : colorNotCarbon; - } - }, { - key: "getResidueColor", - value: function getResidueColor(_residue, _complex) { - return this.opts.color; - } - }]); - - return CarbonColorer; -}(Colorer); - -defineProperty(CarbonColorer, "id", 'CB'); - -CarbonColorer.prototype.id = 'CB'; -CarbonColorer.prototype.name = 'Carbon'; -CarbonColorer.prototype.shortName = 'Carbon'; - -var colorers = new EntityList([ElementColorer, ResidueTypeColorer, SequenceColorer, ChainColorer, SecondaryStructureColorer, UniformColorer, ConditionalColorer, ConformationColorer, TemperatureColorer, OccupancyColorer, HydrophobicityColorer, MoleculeColorer, CarbonColorer]); - -function neutralColor(intensity) { - return new Color(intensity, intensity, intensity); -} - -var materialList = [{ - id: 'DF', - name: 'Diffuse', - shortName: 'Diffuse', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 1, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: false - } -}, { - id: 'SF', - name: 'Soft Plastic', - shortName: 'Soft', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.1), - shininess: 30, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: false - } -}, { - id: 'PL', - name: 'Glossy Plastic', - shortName: 'Glossy', - uberOptions: { - diffuse: neutralColor(0.56), - specular: neutralColor(0.28), - shininess: 100, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: false - } -}, { - id: 'ME', - name: 'Metal', - shortName: 'Metal', - uberOptions: { - diffuse: neutralColor(0.56), - specular: neutralColor(0.55), - shininess: 30, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: false - } -}, { - id: 'TR', - name: 'Transparent', - shortName: 'Transparent', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 1, - opacity: 0.5 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: true, - toonShading: false - } -}, { - id: 'GL', - name: 'Glass', - shortName: 'Glass', - uberOptions: { - diffuse: neutralColor(0.50), - specular: neutralColor(0.65), - shininess: 100, - opacity: 0.5 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: true, - toonShading: false - } -}, { - id: 'BA', - name: 'Backdrop', - shortName: 'Backdrop', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 1, - opacity: 1.0 - }, - values: { - lights: false, - fog: false, - depthWrite: false, - transparent: false, - toonShading: false - } -}, { - id: 'TN', - name: 'Toon', - shortName: 'Toon', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 1, - opacity: 1.0 - }, - values: { - lights: true, - fog: true, - depthWrite: true, - transparent: false, - toonShading: true - } -}, { - id: 'FL', - name: 'Flat', - shortName: 'Flat', - uberOptions: { - diffuse: neutralColor(1.0), - specular: neutralColor(0.0), - shininess: 0, - opacity: 1.0 - }, - values: { - lights: false, - fog: true, - depthWrite: true, - transparent: false - } -}]; -var materials = new EntityList(materialList); - -var selectors$2 = chem.selectors; - -var Representation = /*#__PURE__*/function () { - function Representation(index, mode, colorer, selector) { - classCallCheck(this, Representation); - - var startMaterialValues = { - clipPlane: settings.now.draft.clipPlane, - fogTransparent: settings.now.bg.transparent, - shadowmap: settings.now.shadow.on, - shadowmapType: settings.now.shadow.type - }; - this.index = index; - this.mode = mode; - this.colorer = colorer; - this.selector = selector; - this.selectorString = ''; - this.count = 0; - this.material = new UberMaterial(); - this.material.setValues(startMaterialValues); - this.material.setUberOptions({ - fogAlpha: settings.now.fogAlpha - }); - this.materialPreset = materials.first; - this.needsRebuild = true; - this.visible = true; // apply mode params & preset - - this.setMode(mode); - } - - createClass(Representation, [{ - key: "markAtoms", - value: function markAtoms(complex) { - this.count = complex.markAtoms(this.selector, 1 << this.index); - this.needsRebuild = true; - return this.count; - } - }, { - key: "unmarkAtoms", - value: function unmarkAtoms(complex) { - complex.clearAtomBits(1 << this.index); - this.count = 0; - } - }, { - key: "setMode", - value: function setMode(mode) { - this.mode = mode; - } - }, { - key: "setMaterialPreset", - value: function setMaterialPreset(preset) { - this.materialPreset = preset; - this.material.setUberOptions(preset.uberOptions); - this.material.setValues(preset.values); - } - }, { - key: "reset", - value: function reset() { - this.geo = null; - this.selectionGeo = null; - } - }, { - key: "buildGeometry", - value: function buildGeometry(complex) { - this.reset(); - this.needsRebuild = false; - - if (settings.now.ao) { - this.material.setValues({ - normalsToGBuffer: settings.now.ao - }); - } - - this.geo = this.mode.buildGeometry(complex, this.colorer, 1 << this.index, this.material); - - if (this.material.uberOptions.opacity < 0.99 && settings.now.transparency === 'prepass') { - gfxutils.processTransparentMaterial(this.geo, this.material); + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 3: + this.$ = yy.miew.reset(false); + yy.ClearContext(); + yy.miew.resetReps("empty"); + break; + case 4: + this.$ = yy.miew.rebuild(); + break; + case 5: + this.$ = yy.miew.rebuildAll(); + yy.miew.rebuild(); + break; + case 6: + this.$ = yy.echo(yy.utils.help().toString()); + break; + case 7: + this.$ = yy.echo(yy.utils.help($$[$0]).toString()); + break; + case 8: + this.$ = yy.miew.motm(); + break; + case 10: + case 11: + this.$ = yy.utils.propagateProp($$[$0]); + yy.echo(yy.miew.get($$[$0]).toString()); + break; + case 12: + case 13: + this.$ = yy.miew.set($$[$0 - 1], yy.utils.propagateProp($$[$0 - 1], $$[$0])); + ; + break; + case 14: + this.$ = yy.miew.saveSettings(); + ; + break; + case 15: + this.$ = yy.miew.restoreSettings(); + ; + break; + case 16: + this.$ = yy.miew.resetSettings(); + ; + break; + case 17: + this.$ = yy.miew.resetReps(); + break; + case 18: + this.$ = yy.miew.applyPreset($$[$0]); + break; + case 21: + this.$ = yy.miew.repRemove($$[$0]); + yy.representations.remove($$[$0]); + break; + case 22: + this.$ = yy.miew.repHide($$[$0]); + break; + case 23: + this.$ = yy.miew.repHide($$[$0], false); + break; + case 24: + this.$ = yy.echo(yy.utils.listRep(yy.miew, yy.representations, $$[$0], '-e')); + break; + case 25: + this.$ = yy.echo(yy.utils.list(yy.miew, yy.representations)); + break; + case 26: + this.$ = yy.echo(yy.utils.list(yy.miew, yy.representations, $$[$0])); + break; + case 27: + this.$ = yy.echo(yy.utils.listSelector(yy.miew, yy.Context)); + break; + case 28: + this.$ = yy.miew.select(yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0], true)); + break; + case 29: + this.$ = yy.Context[$$[$0].toLowerCase()] = yy.utils.checkArg($$[$0 - 3].toLowerCase(), $$[$0 - 2], true); + yy.miew.select(yy.Context[$$[$0].toLowerCase()]); + break; + case 30: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + selector: yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0]) + }); + break; + case 31: + this.$ = yy.Context[$$[$0].toLowerCase()] = yy.miew.within(yy.utils.checkArg("select", $$[$0 - 2], true), Number($$[$0 - 4])); + break; + case 32: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + material: yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0].toUpperCase()) + }); + break; + case 35: + this.$ = yy.echo(yy.miew.view()); + break; + case 36: + case 37: + this.$ = yy.miew.view($$[$0]); + break; + case 38: + this.$ = yy.echo(yy.miew.changeUnit()); + break; + case 39: + this.$ = yy.echo(yy.miew.changeUnit($$[$0])); + break; + case 40: + this.$ = yy.miew.dssp(); + break; + case 41: + this.$ = yy.miew.scale($$[$0]); + break; + case 42: + for (var i = 0, n = $$[$0].length; i < n; i++) { + yy.miew.rotate($$[$0][i]['x'] * Math.PI / 180.0, $$[$0][i]['y'] * Math.PI / 180.0, $$[$0][i]['z'] * Math.PI / 180.0); + } + break; + case 43: + for (var i = 0, n = $$[$0].length; i < n; i++) { + yy.miew.translate($$[$0][i]['x'] || 0, $$[$0][i]['y'] || 0, $$[$0][i]['z'] || 0); + } + break; + case 44: + this.$ = yy.miew.center(); + break; + case 45: + this.$ = yy.miew.center($$[$0]); + break; + case 48: + case 49: + this.$ = yy.miew.addObject({ + type: 'line', + params: [$$[$0 - 1], $$[$0]] + }, true); + break; + case 50: + case 51: + this.$ = yy.miew.addObject({ + type: 'line', + params: [$$[$0 - 2], $$[$0 - 1]], + opts: $$[$0].toJSO(yy.utils, 'objects', 'line') + }, true); + break; + case 52: + this.$ = yy.echo(yy.utils.listObjs(yy.miew)); + break; + case 53: + this.$ = yy.miew.removeObject($$[$0]); + break; + case 54: + this.$ = yy.echo(yy.miew.getURL({ + view: false, + settings: false + })); + break; + case 55: + this.$ = yy.echo(yy.miew.getURL({ + view: false, + settings: true + })); + break; + case 56: + this.$ = yy.echo(yy.miew.getURL({ + view: true, + settings: false + })); + break; + case 57: + case 58: + this.$ = yy.echo(yy.miew.getURL({ + view: true, + settings: true + })); + break; + case 59: + this.$ = yy.miew.screenshotSave(); + break; + case 60: + this.$ = yy.miew.screenshotSave('', Number($$[$0])); + break; + case 61: + this.$ = yy.miew.screenshotSave('', Number($$[$0 - 1]), Number($$[$0])); + break; + case 62: + case 63: + case 64: + this.$ = yy.utils.load(yy.miew, $$[$0]); + yy.representations.clear(); + break; + case 65: + this.$ = yy.echo(yy.representations.add(yy.miew.repAdd())); + break; + case 66: + this.$ = yy.echo(yy.representations.add($$[$0], yy.miew.repAdd())); + break; + case 67: + this.$ = yy.echo(yy.representations.add(yy.miew.repAdd($$[$0]))); + break; + case 68: + this.$ = yy.echo(yy.representations.add($$[$0 - 1], yy.miew.repAdd($$[$0]))); + break; + case 69: + this.$ = yy.miew.rep($$[$0]); + yy.miew.repCurrent($$[$0]); + break; + case 70: + this.$ = yy.miew.rep($$[$0 - 1], $$[$0]); + yy.miew.repCurrent($$[$0 - 1]); + break; + case 71: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + mode: yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0].toUpperCase()) + }); + break; + case 72: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + mode: new Array(yy.utils.checkArg($$[$0 - 2].toLowerCase(), $$[$0 - 1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0 - 2], $$[$0 - 1].toUpperCase())) + }); + break; + case 73: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + colorer: yy.utils.checkArg($$[$0 - 1].toLowerCase(), $$[$0].toUpperCase()) + }); + break; + case 74: + this.$ = yy.miew.rep(yy.miew.repCurrent(), { + colorer: new Array(yy.utils.checkArg($$[$0 - 2].toLowerCase(), $$[$0 - 1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0 - 2], $$[$0 - 1].toUpperCase())) + }); + break; + case 75: + this.$ = Number(yy.representations.get($$[$0])); + break; + case 76: + case 92: + this.$ = Number($$[$0]); + break; + case 77: + this.$ = $$[$0]; + break; + case 78: + this.$ = yy._.assign($$[$0 - 1], $$[$0]); + break; + case 79: + this.$ = yy._.assign($$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 80: + this.$ = yy._.assign($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 81: + case 82: + this.$ = yy.CreateObjectPair($$[$0].key, $$[$0].val); + break; + case 83: + this.$ = yy.CreateObjectPair($$[$0 - 1].key, new Array($$[$0 - 1].val, $$[$0].toJSO(yy.utils, $$[$0 - 1].key, $$[$0 - 1].val))); + break; + case 84: + case 85: + this.$ = Object.create({ + 'key': yy.keyRemap($$[$0 - 2]), + 'val': yy.utils.checkArg($$[$0 - 2], $$[$0]) + }); + break; + case 86: + this.$ = [$$[$0]]; + break; + case 87: + this.$ = $$[$0 - 1].concat($$[$0]); + break; + case 88: + this.$ = yy.CreateObjectPair($$[$0 - 1].toLowerCase(), Number($$[$0])); + break; + case 89: + this.$ = new yy.ArgList($$[$0]); + break; + case 90: + this.$ = $$[$0 - 1].append($$[$0]); + break; + case 91: + this.$ = new yy.Arg($$[$0 - 2], $$[$0]); + break; + case 93: + this.$ = parseInt($$[$0]); + break; + case 94: + this.$ = JSON.parse($$[$0]); + break; + case 95: + case 96: + this.$ = String($$[$0]); + break; + case 157: + case 158: + case 161: + case 162: + case 163: + this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; //cause of could be color word in path; + break; + case 166: + this.$ = $$[$0 - 2] = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + break; } - - this.geo.visible = this.visible; - gfxutils.processObjRenderOrder(this.geo, this.materialPreset.id); - gfxutils.processColFromPosMaterial(this.geo, this.material); - - if (settings.now.shadow.on) { - gfxutils.createShadowmapMaterial(this.geo, this.material); + }, + table: [{ + 3: 1, + 4: 2, + 5: [1, 3], + 6: [1, 4], + 7: [1, 5], + 9: [1, 6], + 11: [1, 7], + 12: 8, + 13: [1, 9], + 15: [1, 10], + 17: [1, 11], + 18: [1, 12], + 19: [1, 13], + 20: [1, 14], + 21: 15, + 22: 16, + 23: [1, 17], + 25: [1, 18], + 26: [1, 19], + 27: [1, 20], + 30: [1, 21], + 33: [1, 22], + 34: [1, 23], + 37: [1, 24], + 39: 25, + 40: 26, + 41: [1, 27], + 43: [1, 28], + 44: [1, 29], + 45: [1, 30], + 46: [1, 31], + 48: [1, 32], + 49: [1, 33], + 50: 34, + 51: 35, + 52: [1, 36], + 54: [1, 37], + 55: [1, 38], + 56: [1, 44], + 58: [1, 45], + 59: [1, 39], + 62: [1, 40], + 64: [1, 41], + 65: [1, 42], + 66: [1, 43] + }, { + 1: [3] + }, { + 5: [1, 46] + }, { + 1: [2, 2] + }, { + 5: [2, 3] + }, { + 5: [2, 4], + 8: [1, 47] + }, { + 5: [2, 6], + 6: $V0, + 7: $V1, + 9: $V2, + 10: 48, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 8] + }, { + 5: [2, 9] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 10: 106, + 13: $V3, + 14: [1, 107], + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 10: 108, + 13: $V3, + 14: [1, 109], + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 14] + }, { + 5: [2, 15] + }, { + 5: [2, 16] + }, { + 5: [2, 17], + 14: $VS, + 16: 110, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 5: [2, 19] + }, { + 5: [2, 20] + }, { + 24: 116, + 35: $VX, + 38: $VY + }, { + 24: 119, + 35: $VX, + 38: $VY + }, { + 24: 120, + 35: $VX, + 38: $VY + }, { + 5: [2, 25], + 24: 121, + 28: [1, 122], + 29: [1, 123], + 35: $VX, + 38: $VY + }, { + 14: [1, 124] + }, { + 14: [1, 125] + }, { + 35: [1, 126] + }, { + 38: [1, 127] + }, { + 5: [2, 33] + }, { + 5: [2, 34] + }, { + 5: [2, 35], + 14: [1, 128], + 42: [1, 129] + }, { + 5: [2, 38], + 35: [1, 130] + }, { + 5: [2, 40] + }, { + 35: [1, 131] + }, { + 47: 132, + 73: 133, + 74: $VZ + }, { + 47: 135, + 73: 133, + 74: $VZ + }, { + 5: [2, 44], + 14: [1, 136] + }, { + 5: [2, 46] + }, { + 5: [2, 47] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 10: 138, + 13: $V3, + 14: [1, 137], + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 52] + }, { + 35: [1, 139] + }, { + 14: [1, 143], + 38: [1, 141], + 60: 140, + 61: [1, 142] + }, { + 5: [2, 65], + 38: [1, 144], + 63: 145, + 67: 146, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, { + 24: 151, + 35: $VX, + 38: $VY + }, { + 38: [1, 152] + }, { + 38: [1, 153] + }, { + 5: [2, 54], + 29: [1, 154], + 57: [1, 155] + }, { + 5: [2, 59], + 35: [1, 156] + }, { + 1: [2, 1] + }, { + 5: [2, 5] + }, { + 5: [2, 7], + 101: $V01 + }, o($V11, [2, 159]), o($V11, [2, 160]), o($V21, [2, 97]), o($V21, [2, 98]), o($V11, [2, 147]), o($V11, [2, 148]), o($V11, [2, 149]), o($V11, [2, 150]), o($V11, [2, 151]), o($V11, [2, 152]), o($V11, [2, 153]), o($V21, [2, 101]), o($V21, [2, 102]), o($V21, [2, 103]), o($V21, [2, 104]), o($V21, [2, 105]), o($V21, [2, 106]), o($V21, [2, 107]), o($V21, [2, 108]), o($V21, [2, 109]), o($V21, [2, 110]), o($V21, [2, 111]), o($V21, [2, 112]), o($V21, [2, 113]), o($V21, [2, 114]), o($V21, [2, 115]), o($V21, [2, 116]), o($V21, [2, 117]), o($V21, [2, 118]), o($V21, [2, 119]), o($V21, [2, 120]), o($V21, [2, 121]), o($V21, [2, 122]), o($V21, [2, 123]), o($V21, [2, 124]), o($V21, [2, 125]), o($V21, [2, 126]), o($V21, [2, 127]), o($V21, [2, 128]), o($V21, [2, 129]), o($V21, [2, 130]), o($V21, [2, 131]), o($V21, [2, 132]), o($V21, [2, 133]), o($V21, [2, 134]), o($V21, [2, 135]), o($V21, [2, 136]), o($V21, [2, 137]), o($V21, [2, 138]), o($V21, [2, 139]), o($V21, [2, 140]), o($V21, [2, 141]), o($V21, [2, 142]), o($V21, [2, 143]), o($V21, [2, 144]), o($V21, [2, 145]), o($V21, [2, 146]), { + 5: [2, 10], + 101: $V01 + }, { + 5: [2, 11] + }, { + 14: $VS, + 16: 158, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW, + 101: $V01 + }, { + 14: $VS, + 16: 159, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 5: [2, 18] + }, o($V31, [2, 92]), o($V31, [2, 93]), o($V31, [2, 94]), o($V31, [2, 95]), o($V31, [2, 96]), { + 5: [2, 21] + }, o($V41, [2, 75]), o($V41, [2, 76]), { + 5: [2, 22] + }, { + 5: [2, 23] + }, { + 5: [2, 24] + }, { + 5: [2, 26] + }, { + 5: [2, 27] + }, { + 5: [2, 28], + 31: [1, 160] + }, { + 5: [2, 30] + }, { + 36: [1, 161] + }, { + 5: [2, 32] + }, { + 5: [2, 36] + }, { + 5: [2, 37] + }, { + 5: [2, 39] + }, { + 5: [2, 41] + }, { + 5: [2, 42], + 73: 162, + 74: $VZ + }, o($V51, [2, 86]), { + 35: [1, 163] + }, { + 5: [2, 43], + 73: 162, + 74: $VZ + }, { + 5: [2, 45] + }, { + 14: [1, 164] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 10: 165, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 49, + 80: 52, + 81: 50, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR, + 101: $V01 + }, { + 5: [2, 53] + }, { + 5: [2, 62] + }, { + 5: [2, 63] + }, { + 5: [2, 64] + }, { + 5: [2, 164] + }, { + 5: [2, 66], + 63: 166, + 67: 146, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, { + 5: [2, 67] + }, { + 5: [2, 77], + 67: 167, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, o($V41, [2, 81]), o($V41, [2, 82], { + 80: 52, + 53: 168, + 75: 169, + 76: 170, + 79: 171, + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }), { + 71: [1, 172] + }, { + 71: [1, 173] + }, { + 5: [2, 69], + 63: 174, + 67: 146, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, { + 5: [2, 71], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 53: 175, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 169, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 73], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 53: 176, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 169, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 55], + 57: [1, 177] + }, { + 5: [2, 56], + 29: [1, 178] + }, { + 5: [2, 60], + 35: [1, 179] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 35: [1, 181], + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 180, + 80: 52, + 81: 182, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 12] + }, { + 5: [2, 13] + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 32: 183, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 184, + 80: 52, + 81: 185, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 14: [1, 186] + }, o($V51, [2, 87]), o($V51, [2, 88]), { + 5: [2, 48], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 53: 187, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 169, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 49], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 53: 188, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 169, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 101: $V01 + }, { + 5: [2, 68] + }, { + 5: [2, 78], + 67: 189, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, o($V41, [2, 83], { + 80: 52, + 76: 170, + 79: 171, + 75: 190, + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }), o($V31, [2, 89]), { + 71: [1, 191], + 101: [1, 192] + }, o($V61, [2, 156]), { + 14: $VS, + 16: 193, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 14: $VS, + 16: 194, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 5: [2, 70] + }, { + 5: [2, 72], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 190, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 74], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 190, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 57] + }, { + 5: [2, 58] + }, { + 5: [2, 61] + }, o($V11, [2, 161]), o($V11, [2, 162]), o($V11, [2, 163]), { + 5: [2, 29] + }, { + 5: [2, 99] + }, { + 5: [2, 100] + }, { + 31: [1, 195] + }, { + 5: [2, 50], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 190, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 51], + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 75: 190, + 76: 170, + 79: 171, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, { + 5: [2, 79], + 67: 196, + 68: 147, + 69: 148, + 70: $V_, + 72: $V$ + }, o($V31, [2, 90]), { + 14: $VS, + 16: 197, + 35: $VT, + 38: $VU, + 77: $VV, + 78: $VW + }, { + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 33: $Ve, + 34: $Vf, + 35: [1, 199], + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 79: 198, + 80: 52, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN + }, o($V41, [2, 84]), o($V31, [2, 85]), { + 6: $V0, + 7: $V1, + 9: $V2, + 13: $V3, + 15: $V4, + 17: $V5, + 18: $V6, + 19: $V7, + 20: $V8, + 23: $V9, + 25: $Va, + 26: $Vb, + 27: $Vc, + 30: $Vd, + 32: 200, + 33: $Ve, + 34: $Vf, + 37: $Vg, + 38: $Vh, + 41: $Vi, + 43: $Vj, + 45: $Vk, + 46: $Vl, + 49: $Vm, + 52: $Vn, + 54: $Vo, + 55: $Vp, + 56: $Vq, + 58: $Vr, + 59: $Vs, + 62: $Vt, + 64: $Vu, + 65: $Vv, + 66: $Vw, + 70: $Vx, + 72: $Vy, + 74: $Vz, + 79: 184, + 80: 52, + 81: 185, + 82: $VA, + 83: $VB, + 84: $VC, + 85: $VD, + 86: $VE, + 87: $VF, + 88: $VG, + 89: $VH, + 90: $VI, + 91: $VJ, + 92: $VK, + 93: $VL, + 94: $VM, + 95: $VN, + 96: $VO, + 97: $VP, + 98: $VQ, + 99: $VR + }, { + 5: [2, 80] + }, o($V31, [2, 91]), o($V61, [2, 157]), o($V61, [2, 158]), { + 5: [2, 31] + }], + defaultActions: { + 3: [2, 2], + 4: [2, 3], + 7: [2, 8], + 8: [2, 9], + 11: [2, 14], + 12: [2, 15], + 13: [2, 16], + 15: [2, 19], + 16: [2, 20], + 25: [2, 33], + 26: [2, 34], + 29: [2, 40], + 34: [2, 46], + 35: [2, 47], + 37: [2, 52], + 46: [2, 1], + 47: [2, 5], + 107: [2, 11], + 110: [2, 18], + 116: [2, 21], + 119: [2, 22], + 120: [2, 23], + 121: [2, 24], + 122: [2, 26], + 123: [2, 27], + 125: [2, 30], + 127: [2, 32], + 128: [2, 36], + 129: [2, 37], + 130: [2, 39], + 131: [2, 41], + 136: [2, 45], + 139: [2, 53], + 140: [2, 62], + 141: [2, 63], + 142: [2, 64], + 143: [2, 164], + 145: [2, 67], + 158: [2, 12], + 159: [2, 13], + 166: [2, 68], + 174: [2, 70], + 177: [2, 57], + 178: [2, 58], + 179: [2, 61], + 183: [2, 29], + 184: [2, 99], + 185: [2, 100], + 196: [2, 80], + 200: [2, 31] + }, + parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; } - - return this.geo; - } - }, { - key: "buildSelectionGeometry", - value: function buildSelectionGeometry(mask) { - var sg = null; - - if (this.geo && 'getSubset' in this.geo) { - var meshes = this.geo.getSubset(mask); - - if (meshes && meshes.length > 0) { - sg = new Group(); - sg.matrixAutoUpdate = false; - sg.matrix = this.geo.matrix; - - for (var j = 0; j < meshes.length; j++) { - var m = meshes[j]; - sg.add(m); - } + }, + parse: function parse(input) { + var self = this, + stack = [0], + tstack = [], + vstack = [null], + lstack = [], + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer = Object.create(this.lexer); + var sharedState = { + yy: {} + }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; } } - - if (sg) { - sg.visible = this.visible; - } - - this.selectionGeo = sg; - return this.selectionGeo; - } - /** - * Create object that represents difference between current and another rep - * anotherRep could be undefined. In this case everything is reported. - */ - - }, { - key: "compare", - value: function compare(repSettings) { - var diff = {}; - var selStr = String(this.selector); - - if (!repSettings || selStr.valueOf() !== String(repSettings.selector).valueOf()) { - diff.selector = selStr; - } - - var modeDiff = this.mode.identify(); - - if (!repSettings || Array.isArray(modeDiff) || modeDiff !== repSettings.mode) { - diff.mode = modeDiff; + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc == 'undefined') { + lexer.yylloc = {}; } - - var colorerDiff = this.colorer.identify(); - - if (!repSettings || Array.isArray(colorerDiff) || colorerDiff !== repSettings.colorer) { - diff.colorer = colorerDiff; + var yyloc = lexer.yylloc; + lstack.push(yyloc); + var ranges = lexer.options && lexer.options.ranges; + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; } - - if (!repSettings || this.materialPreset.id !== repSettings.material) { - diff.material = this.materialPreset.id; + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; } - - return diff; - } - /** - * Change representation. Write fields what was changed into new object, return it. - */ - - }, { - key: "change", - value: function change(repSettings, complex, mode, color) { - var diff = {}; // modify selector - - if (repSettings.selector) { - var newSelectorObject = selectors$2.parse(repSettings.selector).selector; - var newSelector = String(newSelectorObject); - - if (this.selectorString !== newSelector) { - diff.selector = newSelector; - this.selectorString = newSelector; - this.selector = newSelectorObject; - this.markAtoms(complex); - } - } // modify mode - - - if (repSettings.mode) { - var newMode = repSettings.mode; - - if (!_.isEqual(this.mode.identify(), newMode)) { - diff.mode = newMode; - this.setMode(mode); - } - } // modify colorer - - - if (repSettings.colorer) { - var newColorer = repSettings.colorer; - - if (!_.isEqual(this.colorer.identify(), newColorer)) { - diff.colorer = newColorer; - this.colorer = color; - } - } // modify material - - - if (repSettings.material) { - var newMaterial = repSettings.material; - - if (!_.isEqual(this.materialPreset.id, newMaterial)) { - diff.material = newMaterial; - this.setMaterialPreset(materials.get(repSettings.material)); + function lex() { + var token; + token = tstack.pop() || lexer.lex() || EOF; + if (typeof token !== 'number') { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); + } + token = self.symbols_[token] || token; } + return token; } - - return diff; - } - }, { - key: "show", - value: function show(visible) { - this.visible = visible; - - if (this.geo) { - this.geo.visible = visible; - } - - if (this.selectionGeo) { - this.selectionGeo.visible = visible; - } - } - }]); - - return Representation; -}(); - -function _traverseComponentGroups(root, component, callback) { - var children = root.children; - - if (!children) { - return; - } - - for (var i = 0, n = children.length; i < n; ++i) { - var child = children[i]; - - if (child._component === component) { - callback(child); - } - - if (child instanceof gfxutils.RCGroup) { - _traverseComponentGroups(child, component, callback); - } - } -} - -function ComplexEditor() {} - -var ComplexComponentEditor = /*#__PURE__*/function (_ComplexEditor) { - inherits(ComplexComponentEditor, _ComplexEditor); - - function ComplexComponentEditor(complexVisual) { - var _this; - - classCallCheck(this, ComplexComponentEditor); - - _this = possibleConstructorReturn(this, getPrototypeOf(ComplexComponentEditor).call(this)); - _this._complexVisual = complexVisual; - _this._inProgress = false; - return _this; - } - - createClass(ComplexComponentEditor, [{ - key: "begin", - value: function begin() { - var complex = this._complexVisual.getComplex(); // init component matrices - - - this._componentTransforms = []; - - for (var i = 0; i < complex._components.length; ++i) { - var component = complex._components[i]; - this._componentTransforms[component._index] = new Object3D(); - } - - this._inProgress = true; - return true; - } - }, { - key: "apply", - value: function apply() { - if (!this._inProgress) { - return; - } - - var complex = this._complexVisual.getComplex(); - - for (var i = 0; i < complex._components.length; ++i) { - this._bakeComponentTransform(complex._components[i]); - } - - complex.onAtomPositionChanged(); - - this._resetComponentTransform(); - - this._complexVisual.finalizeEdit(); - } - }, { - key: "discard", - value: function discard() { - if (!this._inProgress) { - return; - } - - this._resetComponentTransform(); - - this._complexVisual.finalizeEdit(); - } - }, { - key: "getAltObj", - value: function getAltObj() { - var res = { - objects: [], - pivot: new Vector3(0, 0, 0) - }; - var visual = this._complexVisual; - var component = visual.getSelectedComponent(); - - if (component === null) { - return res; - } - - var selection = this._complexVisual.getSelectionGeo(); - - var selectionMask = 1 << visual.getSelectionBit(); - var i; - var j; - var reprNode; - var geo; // find all geo nodes for this component - - _traverseComponentGroups(visual, component, function (child) { - res.objects.push(child); - }); // find all selection nodes for this component - - - for (i = 0; i < selection.children.length; ++i) { - reprNode = selection.children[i]; - - for (j = 0; j < reprNode.children.length; ++j) { - geo = reprNode.children[j]; - - if (geo.hasOwnProperty('_component') && geo._component === component) { - res.objects.push(geo); + var symbol, + preErrorSymbol, + state, + action, + a, + r, + yyval = {}, + p, + len, + newState, + expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); } + action = table[state] && table[state][symbol]; } - } // add dummy object that stores component transformation - - - res.objects.push(this._componentTransforms[component._index]); - var bbmin = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - var bbmax = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - component.forEachResidue(function (residue) { - var atoms = residue._atoms; - - for (j = 0; j < atoms.length; ++j) { - if (atoms[j].mask & selectionMask) { - bbmin.min(atoms[j].position); - bbmax.max(atoms[j].position); + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); + } + } + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } + this.parseError(errStr, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; } - }); - res.pivot.lerpVectors(bbmin, bbmax, 0.5); - return res; - } - }, { - key: "_bakeComponentTransform", - value: function _bakeComponentTransform(component) { - var t = this._componentTransforms[component._index]; - - if (t && (!(t.position.x === 0 && t.position.y === 0 && t.position.z === 0) || !(t.quaternion.x === 0 && t.quaternion.y === 0 && t.quaternion.z === 0 && t.quaternion.w === 1))) { - t.updateMatrix(); - component.forEachResidue(function (residue) { - var atoms = residue._atoms; - - for (var j = 0; j < atoms.length; ++j) { - atoms[j].position.applyMatrix4(t.matrix); - } - }); } + return true; } - }, { - key: "_resetComponentTransform", - value: function _resetComponentTransform() { - var visual = this._complexVisual; - - var selection = this._complexVisual.getSelectionGeo(); - - var i; - var j; - var reprNode; - var geo; - - for (i = 0; i < this._componentTransforms.length; ++i) { - geo = this._componentTransforms[i]; - geo.position.set(0, 0, 0); - geo.quaternion.set(0, 0, 0, 1); - } // reset all geo nodes - - - for (i = 0; i < visual.children.length; ++i) { - reprNode = visual.children[i]; - - for (j = 0; j < reprNode.children.length; ++j) { - geo = reprNode.children[j]; + }; - if (geo.hasOwnProperty('_component')) { - geo.position.set(0, 0, 0); - geo.quaternion.set(0, 0, 0, 1); - } + /* generated by jison-lex 0.3.4 */ + var lexer = function () { + var lexer = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); } - } // reset all selection nodes - - - for (i = 0; i < selection.children.length; ++i) { - reprNode = selection.children[i]; - - for (j = 0; j < reprNode.children.length; ++j) { - geo = reprNode.children[j]; - - if (geo.hasOwnProperty('_component')) { - geo.position.set(0, 0, 0); - geo.quaternion.set(0, 0, 0, 1); - } + }, + // resets the lexer, sets new input + setInput: function (input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; } - } - } - }]); - - return ComplexComponentEditor; -}(ComplexEditor); - -var ComplexFragmentEditor = /*#__PURE__*/function (_ComplexEditor2) { - inherits(ComplexFragmentEditor, _ComplexEditor2); - - function ComplexFragmentEditor(complexVisual) { - var _this2; - - classCallCheck(this, ComplexFragmentEditor); - - _this2 = possibleConstructorReturn(this, getPrototypeOf(ComplexFragmentEditor).call(this)); - _this2._complexVisual = complexVisual; - _this2._inProgress = false; - return _this2; - } - - createClass(ComplexFragmentEditor, [{ - key: "begin", - value: function begin() { - var visual = this._complexVisual; - - var selection = this._complexVisual.getSelectionGeo(); - - var atoms = this._getSelectionBorderAtoms(); - - if (atoms.length < 1 || atoms.length > 2) { - logger.error('Can only edit fragments with one or two bound atoms.'); - return false; - } - - this._fragmentBoundAtoms = atoms; - var selectionMask = 1 << visual.getSelectionBit(); // hide selected fragment in main model - - visual.disableSubset(selectionMask, true); // hide selection geo in main model - - for (var k = 0; k < selection.children.length; ++k) { - selection.children[k].visible = false; - } // create visible fragment representation to rotate - - - var pivotPos = atoms[0].position.clone(); - - if (atoms.length === 2) { - pivotPos.lerp(atoms[1].position, 0.5); - } - - this._fragmentGeo = new Group(); - visual.add(this._fragmentGeo); - - this._fragmentGeo.position.copy(pivotPos); - - this._fragmentSelectionGeo = new Group(); - selection.add(this._fragmentSelectionGeo); - - this._fragmentSelectionGeo.position.copy(pivotPos); - - var offset = pivotPos.clone(); - offset.negate(); - - for (var i = 0; i < visual.children.length; ++i) { - var g = visual.children[i]; - - if (!('getSubset' in g)) { - continue; + this.offset = 0; + return this; + }, + // consumes and returns one char from the input + input: function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; } - - var vg = new Group(); - - this._fragmentGeo.add(vg); - - var sg = new Group(); - - this._fragmentSelectionGeo.add(sg); - - var meshes = g.getSubset(selectionMask, true); - - for (var j = 0; j < meshes.length; j++) { - var m = meshes[j]; - vg.add(m); - m.position.copy(offset); + if (this.options.ranges) { + this.yylloc.range[1]++; } - - var smeshes = g.getSubset(selectionMask, true); - - for (var h = 0; h < smeshes.length; h++) { - var sm = smeshes[h]; - sg.add(sm); - sm.position.copy(offset); + this._input = this._input.slice(1); + return ch; + }, + // unshifts one char (or a string) into the input + unput: function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; } - } - - gfxutils.applySelectionMaterial(this._fragmentSelectionGeo); - this._inProgress = true; - return true; - } - }, { - key: "apply", - value: function apply() { - if (!this._inProgress) { - return; - } - - var visual = this._complexVisual; - var selectionBit = visual.getSelectionBit(); - var p = this._fragmentGeo.position; - - var m = this._fragmentGeo.matrix.clone(); - - m.multiply(new Matrix4().makeTranslation(-p.x, -p.y, -p.z)); - - this._bakeAtomTransform(m, 1 << selectionBit); // show selected fragment in main model - - - visual.enableSubset(1 << selectionBit, true); - visual.getComplex().onAtomPositionChanged(); - visual.finalizeEdit(); - } - }, { - key: "discard", - value: function discard() { - if (!this._inProgress) { - return; - } - - var visual = this._complexVisual; - - var selection = this._complexVisual.getSelectionGeo(); - - this._fragmentGeo.parent.remove(this._fragmentGeo); // show selected fragment in main model - - - visual.enableSubset(1 << visual.getSelectionBit(), true); // show selection geo in main model (+ remove fragment selection geo) - - for (var i = 0; i < selection.children.length; ++i) { - var node = selection.children[i]; - - if (node.visible) { - selection.remove(node); + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + // When called from action, caches matched text and appends it on next action + more: function () { + this._more = true; + return this; + }, + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; } else { - node.visible = true; + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); } - } - - visual.finalizeEdit(); - } - }, { - key: "isFreeRotationAllowed", - value: function isFreeRotationAllowed() { - return this._fragmentBoundAtoms.length < 2; - } - }, { - key: "getAltObj", - value: function getAltObj() { - var res = { - objects: [], - pivot: new Vector3(0, 0, 0) - }; - res.objects.push(this._fragmentGeo, this._fragmentSelectionGeo); - var boundAtoms = this._fragmentBoundAtoms; - - if (boundAtoms.length === 1) { - if (boundAtoms[0].bonds.length === 1) { - // single external bond allows rotation about bond axis - var bond = boundAtoms[0].bonds[0]; - res.axis = new Vector3().subVectors(bond._right.position, bond._left.position); - res.axis.normalize(); - res.axis.transformDirection(this._complexVisual.matrixWorld); - } - } else if (boundAtoms.length === 2) { - // two bound atoms allow rotation only about axis running through their centers - res.axis = new Vector3().subVectors(boundAtoms[1].position, boundAtoms[0].position); - res.axis.normalize(); - res.axis.transformDirection(this._complexVisual.matrixWorld); - } - - return res; - } - }, { - key: "_getSelectionBorderAtoms", - value: function _getSelectionBorderAtoms() { - var complex = this._complexVisual.getComplex(); - - var selectionMask = 1 << this._complexVisual.getSelectionBit(); - - var atomHash = {}; - complex.forEachBond(function (bond) { - if (bond._left.mask & selectionMask) { - if ((bond._right.mask & selectionMask) === 0) { - atomHash[bond._left.index] = 1; + return this; + }, + // retain first n characters of the match + less: function (n) { + this.unput(this.match.slice(n)); + }, + // displays already matched input, i.e. for error messages + pastInput: function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); + }, + // displays upcoming input, i.e. for error messages + upcomingInput: function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: function (match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); } - } else if (bond._right.mask & selectionMask) { - atomHash[bond._right.index] = 1; } - }); - var atoms = []; - var keys = Object.keys(atomHash); - - for (var i = 0, n = keys.length; i < n; ++i) { - var idx = keys[i]; - atoms.push(complex._atoms[idx]); - } - - return atoms; - } - }, { - key: "_bakeAtomTransform", - value: function _bakeAtomTransform(matrix, mask) { - this._complexVisual.getComplex().forEachAtom(function (atom) { - if (atom.mask & mask) { - atom.position.applyMatrix4(matrix); + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; } - }); - } - }]); - - return ComplexFragmentEditor; -}(ComplexEditor); - -var ComplexVisualEdit = { - ComponentEditor: ComplexComponentEditor, - FragmentEditor: ComplexFragmentEditor -}; - -var selectors$3 = chem.selectors; - -function lookupAndCreate(entityList, specs) { - if (!Array.isArray(specs)) { - specs = [specs]; - } - - var _specs = specs, - _specs2 = slicedToArray(_specs, 2), - id = _specs2[0], - opts = _specs2[1]; - - var Entity = entityList.get(id) || entityList.first; - return new Entity(opts); -} - -var ComplexVisual = /*#__PURE__*/function (_Visual) { - inherits(ComplexVisual, _Visual); - - function ComplexVisual(name, dataSource) { - var _this; - - classCallCheck(this, ComplexVisual); - - _this = possibleConstructorReturn(this, getPrototypeOf(ComplexVisual).call(this, name, dataSource)); - _this._complex = dataSource; - /** @type {Representation[]} */ - - _this._reprList = []; - /** @type {?Representation} */ - - _this._repr = null; - _this._reprListChanged = true; - _this._selectionBit = 0; - _this._reprUsedBits = 0; - _this._selectionCount = 0; - _this._selectionGeometry = new Group(); - return _this; - } - - createClass(ComplexVisual, [{ - key: "getBoundaries", - value: function getBoundaries() { - return this._complex.getBoundaries(); - } - }, { - key: "release", - value: function release() { - if (this._selectionGeometry.parent) { - this._selectionGeometry.remove(this._selectionGeometry); - } - - Visual.prototype.release.call(this); - } - }, { - key: "getComplex", - value: function getComplex() { - return this._complex; - } - }, { - key: "getSelectionCount", - value: function getSelectionCount() { - return this._selectionCount; - } - }, { - key: "getSelectionGeo", - value: function getSelectionGeo() { - return this._selectionGeometry; - } - }, { - key: "getSelectionBit", - value: function getSelectionBit() { - return this._selectionBit; - } - }, { - key: "getEditor", - value: function getEditor() { - return this._editor; - } - }, { - key: "resetReps", - value: function resetReps(reps) { - // Create all necessary representations - if (this._complex) { - this._complex.clearAtomBits(~0); - } - - this._reprListChanged = true; - this._reprUsedBits = 0; - this._reprList.length = reps.length; - - for (var i = 0, n = reps.length; i < n; ++i) { - var rep = reps[i]; - var selector = void 0; - var selectorString = void 0; - - if (typeof rep.selector === 'string') { - selectorString = rep.selector; - - var _selectors$parse = selectors$3.parse(selectorString); - - selector = _selectors$parse.selector; - } else if (typeof rep.selector === 'undefined') { - selectorString = settings.now.presets["default"][0].selector; - - var _selectors$parse2 = selectors$3.parse(selectorString); - - selector = _selectors$parse2.selector; - } else { - selector = rep.selector; - selectorString = selector.toString(); + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; } - - var mode = lookupAndCreate(modes, rep.mode); - var colorer = lookupAndCreate(colorers, rep.colorer); - var material = materials.get(rep.material) || materials.first; - this._reprList[i] = new Representation(i, mode, colorer, selector); - - this._reprList[i].setMaterialPreset(material); - - this._reprList[i].selectorString = selectorString; - - if (this._complex) { - this._complex.markAtoms(selector, 1 << i); + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; } - - this._reprUsedBits |= 1 << i; - } - - this._repr = reps.length > 0 ? this._reprList[0] : null; - this._selectionBit = reps.length; - this._reprUsedBits |= 1 << this._selectionBit; // selection uses one bit - - this._selectionCount = 0; - - if (this._complex) { - this._complex.update(); - } - } - /** - * Get number of representations created so far. - * @returns {number} Number of reps. - */ - - }, { - key: "repCount", - value: function repCount() { - return this._reprList.length; - } - /** - * Get or set the current representation index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. - * @returns {number} The current index. - */ - - }, { - key: "repCurrent", - value: function repCurrent(index) { - if (index >= 0 && index < this._reprList.length) { - this._repr = this._reprList[index]; - } else { - index = this._reprList.indexOf(this._repr); - } - - return index; - } - /** - * Get or set representation by index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. - * @param {object=} rep - Optional representation description. - * @param {string=} rep.selector - Selector string. - * @param {string=} rep.mode - Mode id. - * @param {string=} rep.colorer - Colorer id. - * @param {string=} rep.material - Material id. - * @returns {Object} {desc, index, status} field desc contains rep description, index - index of correspondent rep, - * status - one of three strings: 'created', 'changed', ''. 'created' means new rep was created during this function, - * 'changed' - rep was changed during this function. '' - something else. - */ - - }, { - key: "rep", - value: function rep(index, _rep) { - // if index is missing then it is the current - if (!_rep && (index === undefined || index instanceof Object)) { - _rep = index; - index = this.repCurrent(); - } // fail if out of bounds - - - if (index < 0 || index > this._reprList.length) { - logger.error("Rep ".concat(index, " does not exist!")); - return null; - } // a special case of adding just after the end - - - if (index === this._reprList.length) { - var res = this.repAdd(_rep); - logger.warn("Rep ".concat(index, " does not exist! New representation was created.")); - return { - desc: res.desc, - index: index, - status: 'created' - }; - } // gather description - - - var target = this._reprList[index]; - var desc = { - selector: target.selectorString, - mode: target.mode.identify(), - colorer: target.colorer.identify(), - material: target.materialPreset.id - }; // modification is requested - - if (_rep) { - // modify - var diff = target.change(_rep, this._complex, lookupAndCreate(modes, _rep.mode), lookupAndCreate(colorers, _rep.colorer)); // something was changed - - if (!_.isEmpty(diff)) { - target.needsRebuild = true; - - for (var key in diff) { - if (diff.hasOwnProperty(key)) { - desc[key] = diff[key]; - logger.debug("rep[".concat(index, "].").concat(key, " changed to ").concat(diff[key])); - } - } // safety trick: lower resolution for surface modes - - - if (diff.mode && target.mode.isSurface && (settings.now.resolution === 'ultra' || settings.now.resolution === 'high')) { - logger.report('Surface resolution was changed to "medium" to avoid hang-ups.'); - settings.set('resolution', 'medium'); + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; } - - return { - desc: desc, - index: index, - status: 'changed' - }; + return false; // rule action called reject() implying the next rule should be tested instead. } - } - - return { - desc: desc, - index: index, - status: '' - }; - } - /** - * Get representation (not just description) by index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. - * @returns {?object} Representation. - */ - - }, { - key: "repGet", - value: function repGet(index) { - // if index is missing then it is the current - if (index === undefined || index instanceof Object) { - index = this.repCurrent(); - } // fail if out of bounds - - - if (index < 0 || index >= this._reprList.length) { - return null; - } - - return this._reprList[index]; - } - }, { - key: "_getFreeReprIdx", - value: function _getFreeReprIdx() { - var bits = this._reprUsedBits; - - for (var i = 0; i <= ComplexVisual.NUM_REPRESENTATION_BITS; ++i, bits >>= 1) { - if ((bits & 1) === 0) { - return i; + return false; + }, + // return next match in input + next: function () { + if (this.done) { + return this.EOF; } - } - - return -1; - } - /** - * Add new representation. - * @param {object=} rep - Representation description. - * @returns {Object} {desc, index} field desc contains added rep description, index - index of this rep. - */ - - }, { - key: "repAdd", - value: function repAdd(rep) { - if (this._reprList.length >= ComplexVisual.NUM_REPRESENTATION_BITS) { - return null; - } - - var newSelectionBit = this._getFreeReprIdx(); - - if (newSelectionBit < 0) { - return null; // no more slots for representations - } - - var originalSelection = this.buildSelectorFromMask(1 << this._selectionBit); // Fill in default values - - var def = settings.now.presets["default"][0]; - - var desc = _.merge({ - selector: def.selector, - mode: def.mode, - colorer: def.colorer, - material: def.material - }, rep); - - var selector = typeof desc.selector === 'string' ? selectors$3.parse(desc.selector).selector : desc.selector; - var target = new Representation(this._selectionBit, lookupAndCreate(modes, desc.mode), lookupAndCreate(colorers, desc.colorer), selector); - target.selectorString = selector.toString(); - target.setMaterialPreset(materials.get(desc.material)); - target.markAtoms(this._complex); - - this._reprList.push(target); // change selection bit - - - this._selectionBit = newSelectionBit; - this._reprUsedBits |= 1 << this._selectionBit; // restore selection using new selection bit - - this._complex.markAtoms(originalSelection, 1 << this._selectionBit); - - return { - desc: desc, - index: this._reprList.length - 1 - }; - } - /** - * Remove representation. - * @param {number=} index - Zero-based representation index. - */ - - }, { - key: "repRemove", - value: function repRemove(index) { - if (index === undefined) { - index = this.repCurrent(); - } // catch out of bounds case - - - var count = this._reprList.length; - - if (index < 0 || index >= count || count <= 1) { - // do not allow to remove the single rep - return; - } - - var target = this._reprList[index]; - target.unmarkAtoms(this._complex); - this._reprUsedBits &= ~(1 << target.index); - - this._reprList.splice(index, 1); // update current rep - - - if (target === this._repr) { - --count; - index = index < count ? index : count - 1; - this._repr = this._reprList[index]; - } - - this._reprListChanged = true; - } - /** - * Hide representation. - * @param {number} index - Zero-based representation index. - * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default). - */ - - }, { - key: "repHide", - value: function repHide(index, hide) { - if (hide === undefined) { - hide = true; - } // fail if out of bounds - - - if (index < 0 || index >= this._reprList.length) { - return; - } - - var target = this._reprList[index]; - target.show(!hide); - } - /** - * Select atoms with selector - * @param {Selector} selector - selector - * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection - */ - - }, { - key: "select", - value: function select(selector, append) { - if (append) { - this._selectionCount += this._complex.markAtomsAdditionally(selector, 1 << this._selectionBit); - } else { - this._selectionCount = this._complex.markAtoms(selector, 1 << this._selectionBit); - } - - this._complex.updateStructuresMask(); - - this.rebuildSelectionGeometry(); - } - }, { - key: "resetSelectionMask", - value: function resetSelectionMask() { - if (this._selectionCount !== 0) { - this._selectionCount = 0; - - if (this._complex) { - this._complex.clearAtomBits(1 << this._selectionBit); + if (!this._input) { + this.done = true; } - } - } - }, { - key: "updateSelectionMask", - value: function updateSelectionMask(pickedObj) { - var self = this; - var atom = pickedObj.atom; - var residue = pickedObj.residue, - chain = pickedObj.chain, - molecule = pickedObj.molecule; - var setMask = 1 << this._selectionBit; - var clearMask = ~setMask; - - if (atom) { - residue = atom.residue; - chain = residue._chain; - molecule = residue._molecule; - - if (atom.mask & setMask) { - atom.mask &= clearMask; - residue._mask &= clearMask; - chain._mask &= clearMask; - - if (molecule) { - molecule.mask &= clearMask; - } - - this._selectionCount--; - } else { - atom.mask |= setMask; - this._selectionCount++; // select residue if all atoms in it are selected - - residue.collectMask(); // select chain and molecule if all residues in it are selected - - chain.collectMask(); - - if (molecule) { - molecule.collectMask(); + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } } } - } else if (residue) { - chain = residue._chain; - molecule = residue._molecule; - - if (residue._mask & setMask) { - residue._mask &= clearMask; - chain._mask &= clearMask; - residue.forEachAtom(function (a) { - if (a.mask & setMask) { - a.mask &= clearMask; - self._selectionCount--; - } - }); - } else { - residue._mask |= setMask; - residue.forEachAtom(function (a) { - if (!(a.mask & setMask)) { - a.mask |= setMask; - self._selectionCount++; - } - }); // select chain and molecule if all residues in it are selected - - chain.collectMask(); - - if (molecule) { - molecule.collectMask(); + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; } - } else if (chain || molecule) { - var obj = chain || molecule; - - if (obj._mask & setMask) { - obj._mask &= clearMask; - obj.forEachResidue(function (r) { - if (r._mask & setMask) { - r._mask &= clearMask; - r.forEachAtom(function (a) { - if (a.mask & setMask) { - a.mask &= clearMask; - self._selectionCount--; - } - }); - r._mask &= clearMask; - } - }); + if (this._input === "") { + return this.EOF; } else { - obj._mask |= setMask; - obj.forEachResidue(function (r) { - if (!(r._mask & setMask)) { - r._mask |= setMask; - r.forEachAtom(function (a) { - if (!(a.mask & setMask)) { - a.mask |= setMask; - self._selectionCount++; - } - }); - var otherObj = chain ? r.getMolecule() : r.getChain(); - - if (otherObj) { - otherObj.collectMask(); - } - } + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno }); } - } else { - this.resetSelectionMask(); - } - } - }, { - key: "expandSelection", - value: function expandSelection() { - var self = this; - var selectionMask = 1 << this._selectionBit; - var tmpMask = 1 << 31; // mark atoms to add - - this._complex.forEachBond(function (bond) { - if (bond._left.mask & selectionMask) { - if ((bond._right.mask & selectionMask) === 0) { - bond._right.mask |= tmpMask; - } - } else if (bond._right.mask & selectionMask) { - bond._left.mask |= tmpMask; + }, + // return next match that has a token + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + // pop the previously active lexer condition state off the condition stack + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + // alias for begin(condition) + pushState: function pushState(condition) { + this.begin(condition); + }, + // return the number of states currently on the stack + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: { + "case-insensitive": true + }, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + /* ignore whitespace */ + break; + case 1: + return ''; + break; + case 2: + return ''; + break; + case 3: + return 42; + break; + case 4: + return 35; + break; + case 5: + return 77; + break; + case 6: + return 78; + break; + case 7: + return 78; + break; + case 8: + return 8; + break; + case 9: + return 6; + break; + case 10: + return 82; + break; + case 11: + return 7; + break; + case 12: + return 9; + break; + case 13: + return 59; + break; + case 14: + return 13; + break; + case 15: + return 15; + break; + case 16: + return 17; + break; + case 17: + return 18; + break; + case 18: + return 19; + break; + case 19: + return 20; + break; + case 20: + return 11; + break; + case 21: + return 62; + break; + case 22: + return 64; + break; + case 23: + return 23; + break; + case 24: + return 25; + break; + case 25: + return 26; + break; + case 26: + return 27; + break; + case 27: + return 30; + break; + case 28: + return 34; + break; + case 29: + return 33; + break; + case 30: + return 65; + break; + case 31: + return 66; + break; + case 32: + return 37; + break; + case 33: + return 41; + break; + case 34: + return 43; + break; + case 35: + return 52; + break; + case 36: + return 54; + break; + case 37: + return 55; + break; + case 38: + return 46; + break; + case 39: + return 48; + break; + case 40: + return 45; + break; + case 41: + return 49; + break; + case 42: + return 56; + break; + case 43: + return 58; + break; + case 44: + return 44; + break; + case 45: + return 83; + break; + case 46: + return 84; + break; + case 47: + return 85; + break; + case 48: + return 86; + break; + case 49: + return 87; + break; + case 50: + return 88; + break; + case 51: + return 89; + break; + case 52: + return 90; + break; + case 53: + return 91; + break; + case 54: + return 92; + break; + case 55: + return 93; + break; + case 56: + return 94; + break; + case 57: + return 95; + break; + case 58: + return 70; + break; + case 59: + return 70; + break; + case 60: + return 72; + break; + case 61: + return 72; + break; + case 62: + return 74; + break; + case 63: + return 74; + break; + case 64: + return 74; + break; + case 65: + return 31; + break; + case 66: + return 36; + break; + case 67: + return 96; + break; + case 68: + return 97; + break; + case 69: + return 98; + break; + case 70: + return 99; + break; + case 71: + yy_.yytext = yy.utils.unquoteString(yy_.yytext); + return 14; + break; + case 72: + return 38; + break; + case 73: + return 5; + break; + case 74: + return 101; + break; + case 75: + return 103; + break; + case 76: + return '\\'; + break; + case 77: + return 28; + break; + case 78: + return 61; + break; + case 79: + return 29; + break; + case 80: + return 57; + break; + case 81: + return 71; + break; } - }); // select marked atoms + }, + rules: [/^(?:\s+)/i, /^(?:[#].*)/i, /^(?:\/\/.*)/i, /^(?:([_A-Z0-9\/\+]+==))/i, /^(?:-?[0-9]+(\.[0-9]+)?\b)/i, /^(?:0[xX][0-9A-F]+\b)/i, /^(?:false\b)/i, /^(?:true\b)/i, /^(?:all\b)/i, /^(?:reset\b)/i, /^(?:clear\b)/i, /^(?:build\b)/i, /^(?:help\b)/i, /^(?:load\b)/i, /^(?:get\b)/i, /^(?:set\b)/i, /^(?:set_save\b)/i, /^(?:set_restore\b)/i, /^(?:set_reset\b)/i, /^(?:preset\b)/i, /^(?:motm\b)/i, /^(?:add\b)/i, /^(?:rep\b)/i, /^(?:remove\b)/i, /^(?:hide\b)/i, /^(?:show\b)/i, /^(?:list\b)/i, /^(?:select\b)/i, /^(?:within\b)/i, /^(?:selector\b)/i, /^(?:mode\b)/i, /^(?:color\b)/i, /^(?:material\b)/i, /^(?:view\b)/i, /^(?:unit\b)/i, /^(?:line\b)/i, /^(?:listobj\b)/i, /^(?:removeobj\b)/i, /^(?:rotate\b)/i, /^(?:translate\b)/i, /^(?:scale\b)/i, /^(?:center\b)/i, /^(?:url\b)/i, /^(?:screenshot\b)/i, /^(?:dssp\b)/i, /^(?:file_list\b)/i, /^(?:file_register\b)/i, /^(?:file_delete\b)/i, /^(?:preset_add\b)/i, /^(?:preset_delete\b)/i, /^(?:preset_update\b)/i, /^(?:preset_rename\b)/i, /^(?:preset_open\b)/i, /^(?:create_scenario\b)/i, /^(?:reset_scenario\b)/i, /^(?:delete_scenario\b)/i, /^(?:add_scenario_item\b)/i, /^(?:list_scenario\b)/i, /^(?:s\b)/i, /^(?:mt\b)/i, /^(?:m\b)/i, /^(?:c\b)/i, /^(?:x\b)/i, /^(?:y\b)/i, /^(?:z\b)/i, /^(?:as\b)/i, /^(?:of\b)/i, /^(?:pdb\b)/i, /^(?:delay\b)/i, /^(?:prst\b)/i, /^(?:desc\b)/i, /^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i, /^(?:([_A-Z0-9]+))/i, /^(?:$)/i, /^(?:\.)/i, /^(?:\/)/i, /^(?:\\)/i, /^(?:-e\b)/i, /^(?:-f\b)/i, /^(?:-s\b)/i, /^(?:-v\b)/i, /^(?:=)/i], + conditions: { + "INITIAL": { + "rules": [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, 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, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81], + "inclusive": true + } + } + }; + return lexer; + }(); + parser.lexer = lexer; + function Parser() { + this.yy = {}; + } + Parser.prototype = parser; + parser.Parser = Parser; + return new Parser(); +}(); +module.exports = { + parser: parser +}; +/***/ }), - var deselectionMask = ~tmpMask; +/***/ 99: +/***/ ((module) => { - this._complex.forEachAtom(function (atom) { - if (atom.mask & tmpMask) { - atom.mask = atom.mask & deselectionMask | selectionMask; - ++self._selectionCount; - } - }); +/* eslint-disable */ +// DO NOT EDIT! Automatically generated from .jison +/* parser generated by jison 0.4.18 */ +/* + Returns a Parser object of the following structure: - this._complex.updateStructuresMask(); - } - }, { - key: "shrinkSelection", - value: function shrinkSelection() { - var self = this; - var selectionMask = 1 << this._selectionBit; - var tmpMask = 1 << 31; // mark atoms neighbouring to unselected ones - - this._complex.forEachBond(function (bond) { - if (bond._left.mask & selectionMask) { - if ((bond._right.mask & selectionMask) === 0) { - bond._left.mask |= tmpMask; - } - } else if (bond._right.mask & selectionMask) { - bond._right.mask |= tmpMask; - } - }); // mark hanging atoms + Parser: { + yy: {} + } + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), - this._complex.forEachAtom(function (atom) { - if (atom.mask & selectionMask && atom.bonds.length === 1) { - atom.mask |= tmpMask; - } - }); // deselect marked atoms + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, - var deselectionMask = ~(selectionMask | tmpMask); + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, + } + } - this._complex.forEachAtom(function (atom) { - if (atom.mask & tmpMask) { - atom.mask &= deselectionMask; - --self._selectionCount; - } - }); - this._complex.updateStructuresMask(); - } - }, { - key: "getSelectedComponent", - value: function getSelectedComponent() { - var selectionMask = 1 << this._selectionBit; - var component = null; - var multiple = false; // find which component is selected (exclusively) - - this._complex.forEachAtom(function (atom) { - if (atom.mask & selectionMask) { - if (component === null) { - component = atom.residue._component; - } else if (component !== atom.residue._component) { - multiple = true; - } - } - }); + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + } - return multiple ? null : component; - } - }, { - key: "getSelectionCenter", - value: function getSelectionCenter(center, includesAtom, selRule) { - center.set(0.0, 0.0, 0.0); - var count = 0; - this._complex.forEachAtom(function (atom) { - if (includesAtom(atom, selRule)) { - center.add(atom.position); - count++; - } - }); + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + } +*/ +var parser = function () { + var o = function (k, v, o, l) { + for (o = o || {}, l = k.length; l--; o[k[l]] = v); + return o; + }, + $V0 = [1, 4], + $V1 = [1, 5], + $V2 = [1, 6], + $V3 = [1, 7], + $V4 = [1, 8], + $V5 = [1, 9], + $V6 = [1, 11], + $V7 = [1, 12], + $V8 = [5, 7, 8, 11], + $V9 = [1, 17], + $Va = [1, 22], + $Vb = [1, 20], + $Vc = [1, 21], + $Vd = [5, 7, 8, 11, 19]; + var parser = { + trace: function trace() {}, + yy: {}, + symbols_: { + "error": 2, + "Program": 3, + "Expression": 4, + "EOF": 5, + "Selector": 6, + "OR": 7, + "AND": 8, + "NOT": 9, + "(": 10, + ")": 11, + "SELECTOR": 12, + "NAMED_SELECTOR": 13, + "SELECTOR_RANGED": 14, + "RangeList": 15, + "SELECTOR_NAMED": 16, + "NameList": 17, + "Range": 18, + ",": 19, + "NUMBER": 20, + ":": 21, + "Name": 22, + "IDENTIFIER": 23, + "STRING": 24, + "$accept": 0, + "$end": 1 + }, + terminals_: { + 2: "error", + 5: "EOF", + 7: "OR", + 8: "AND", + 9: "NOT", + 10: "(", + 11: ")", + 12: "SELECTOR", + 13: "NAMED_SELECTOR", + 14: "SELECTOR_RANGED", + 16: "SELECTOR_NAMED", + 19: ",", + 20: "NUMBER", + 21: ":", + 23: "IDENTIFIER", + 24: "STRING" + }, + productions_: [0, [3, 2], [4, 1], [4, 3], [4, 3], [4, 2], [4, 3], [6, 1], [6, 1], [6, 2], [6, 2], [15, 1], [15, 3], [18, 1], [18, 3], [17, 1], [17, 3], [22, 1], [22, 1], [22, 1]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { + /* this == yyval */ - if (count === 0) { - return false; + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 3: + this.$ = yy.keyword('or')($$[$0 - 2], $$[$0]); + break; + case 4: + this.$ = yy.keyword('and')($$[$0 - 2], $$[$0]); + break; + case 5: + this.$ = yy.keyword('not')($$[$0]); + break; + case 6: + this.$ = $$[$0 - 1]; + break; + case 7: + this.$ = yy.keyword($$[$0])(); + break; + case 8: + this.$ = yy.GetSelector($$[$0].toLowerCase().slice(1, $$[$0].length)); + break; + case 9: + case 10: + this.$ = yy.keyword($$[$0 - 1])($$[$0]); + break; + case 11: + this.$ = new yy.RangeList($$[$0]); + break; + case 12: + case 16: + this.$ = $$[$0 - 2].append($$[$0]); + break; + case 13: + this.$ = new yy.Range(Number($$[$0])); + break; + case 14: + this.$ = new yy.Range(Number($$[$0 - 2]), Number($$[$0])); + break; + case 15: + this.$ = new yy.ValueList($$[$0]); + break; } - - center.divideScalar(count); - center.applyMatrix4(this.matrix); - return true; - } - }, { - key: "needsRebuild", - value: function needsRebuild() { - if (this._reprListChanged) { - return true; + }, + table: [{ + 3: 1, + 4: 2, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, { + 1: [3] + }, { + 5: [1, 10], + 7: $V6, + 8: $V7 + }, o($V8, [2, 2]), { + 4: 13, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, { + 4: 14, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, o($V8, [2, 7]), o($V8, [2, 8]), { + 15: 15, + 18: 16, + 20: $V9 + }, { + 17: 18, + 20: $Va, + 22: 19, + 23: $Vb, + 24: $Vc + }, { + 1: [2, 1] + }, { + 4: 23, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, { + 4: 24, + 6: 3, + 9: $V0, + 10: $V1, + 12: $V2, + 13: $V3, + 14: $V4, + 16: $V5 + }, o($V8, [2, 5]), { + 7: $V6, + 8: $V7, + 11: [1, 25] + }, o($V8, [2, 9], { + 19: [1, 26] + }), o($Vd, [2, 11]), o($Vd, [2, 13], { + 21: [1, 27] + }), o($V8, [2, 10], { + 19: [1, 28] + }), o($Vd, [2, 15]), o($Vd, [2, 17]), o($Vd, [2, 18]), o($Vd, [2, 19]), o([5, 7, 11], [2, 3], { + 8: $V7 + }), o($V8, [2, 4]), o($V8, [2, 6]), { + 18: 29, + 20: $V9 + }, { + 20: [1, 30] + }, { + 20: $Va, + 22: 31, + 23: $Vb, + 24: $Vc + }, o($Vd, [2, 12]), o($Vd, [2, 14]), o($Vd, [2, 16])], + defaultActions: { + 10: [2, 1] + }, + parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; } - - var reprList = this._reprList; - - for (var i = 0, n = reprList.length; i < n; ++i) { - var repr = reprList[i]; - - if (repr.needsRebuild) { - return true; + }, + parse: function parse(input) { + var self = this, + stack = [0], + tstack = [], + vstack = [null], + lstack = [], + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer = Object.create(this.lexer); + var sharedState = { + yy: {} + }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; } } - - return false; - } - /** - * Rebuild molecule geometry asynchronously. - */ - - }, { - key: "rebuild", - value: function rebuild() { - var self = this; // Destroy current geometry - - gfxutils.clearTree(this); - return new Promise(function (resolve) { - // Nothing to do? - var complex = self._complex; - - if (!complex) { - resolve(); - return; - } - - var errorOccured = false; - setTimeout(function () { - console.time('build'); - var reprList = self._reprList; - var palette = palettes.get(settings.now.palette) || palettes.first; - var hasGeometry = false; - - for (var i = 0, n = reprList.length; i < n; ++i) { - var repr = reprList[i]; - repr.colorer.palette = palette; - - if (repr.needsRebuild) { - repr.reset(); - - try { - repr.buildGeometry(complex); - } catch (e) { - if (e instanceof utils.OutOfMemoryError) { - repr.needsRebuild = false; - repr.reset(); - logger.error("Not enough memory to build geometry for representation ".concat(repr.index + 1)); - errorOccured = true; - } else { - throw e; - } - } - } - - hasGeometry = errorOccured || hasGeometry || gfxutils.groupHasGeometryToRender(repr.geo); - - if (repr.geo) { - self.add(repr.geo); - } - } - - self._reprListChanged = false; - console.timeEnd('build'); - resolve(); - }, 10); - }); - } - }, { - key: "setNeedsRebuild", - value: function setNeedsRebuild() { - // invalidate all representations - var reprList = this._reprList; - - for (var i = 0, n = reprList.length; i < n; ++i) { - reprList[i].needsRebuild = true; + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc == 'undefined') { + lexer.yylloc = {}; } - } - }, { - key: "rebuildSelectionGeometry", - value: function rebuildSelectionGeometry() { - var mask = 1 << this._selectionBit; - gfxutils.clearTree(this._selectionGeometry); - - for (var i = 0, n = this._reprList.length; i < n; ++i) { - var repr = this._reprList[i]; - var sg = repr.buildSelectionGeometry(mask); - - if (!sg) { - continue; - } - - this._selectionGeometry.add(sg); - - for (var j = 0; j < sg.children.length; j++) { - var m = sg.children[j]; // copy component transform (that's not applied yet) - // TODO make this code obsolete, accessing editor is bad - - if (this._editor && this._editor._componentTransforms) { - var t = this._editor._componentTransforms[m._component._index]; - - if (t) { - m.position.copy(t.position); - m.quaternion.copy(t.quaternion); - } - } - } - - gfxutils.applySelectionMaterial(sg); + var yyloc = lexer.yylloc; + lstack.push(yyloc); + var ranges = lexer.options && lexer.options.ranges; + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; } - } - }, { - key: "_buildSelectorFromSortedLists", - value: function _buildSelectorFromSortedLists(atoms, residues, chains) { - var complex = this._complex; - - function optimizeList(list) { - var result = []; - var k = 0; - var first = NaN; - var last = NaN; - - for (var i = 0, n = list.length; i < n; ++i) { - var value = list[i]; - - if (value === last + 1) { - last = value; - } else { - if (!Number.isNaN(first)) { - result[k++] = new selectors$3.Range(first, last); - } - - first = last = value; + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = tstack.pop() || lexer.lex() || EOF; + if (typeof token !== 'number') { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); } + token = self.symbols_[token] || token; } - - if (!Number.isNaN(first)) { - result[k] = new selectors$3.Range(first, last); - } - - return result; + return token; } - - var expression = null; - - if (chains.length === complex._chains.length) { - expression = selectors$3.all(); - } else { - var selector; - - if (chains.length > 0) { - selector = selectors$3.chain(chains); - expression = expression ? selectors$3.or(expression, selector) : selector; // NOSONAR + var symbol, + preErrorSymbol, + state, + action, + a, + r, + yyval = {}, + p, + len, + newState, + expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); + } + action = table[state] && table[state][symbol]; } - - if (Object.keys(residues).length > 0) { - for (var ch in residues) { - if (residues.hasOwnProperty(ch)) { - selector = selectors$3.and(selectors$3.chain(ch), selectors$3.residx(optimizeList(residues[ch]))); - expression = expression ? selectors$3.or(expression, selector) : selector; + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); } } - } - - if (atoms.length > 0) { - selector = selectors$3.serial(optimizeList(atoms)); - expression = expression ? selectors$3.or(expression, selector) : selector; - } - - if (!expression) { - expression = selectors$3.none(); - } - } - - return expression; - } - }, { - key: "buildSelectorFromMask", - value: function buildSelectorFromMask(mask) { - var complex = this._complex; - var chains = []; - var residues = {}; - var atoms = []; - complex.forEachChain(function (chain) { - if (chain._mask & mask) { - chains.push(chain._name); - } - }); - complex.forEachResidue(function (residue) { - if (residue._mask & mask && !(residue._chain._mask & mask)) { - var c = residue._chain._name; - - if (!(c in residues)) { - residues[c] = [residue._index]; + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { - residues[c].push(residue._index); + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } + this.parseError(errStr, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected + }); } - }); - complex.forEachAtom(function (atom) { - if (atom.mask & mask && !(atom.residue._mask & mask)) { - atoms.push(atom.serial); - } - }); - return this._buildSelectorFromSortedLists(atoms, residues, chains); - } - }, { - key: "forSelectedResidues", - value: function forSelectedResidues(process) { - var selectionMask = 1 << this._selectionBit; - - this._complex.forEachResidue(function (residue) { - if (residue._mask & selectionMask) { - process(residue); + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } - }); - } - }, { - key: "beginComponentEdit", - value: function beginComponentEdit() { - if (this._editor) { - return null; - } - - var editor = new ComplexVisualEdit.ComponentEditor(this); - - if (!editor.begin()) { - return null; - } - - this._editor = editor; - return editor; - } - }, { - key: "beginFragmentEdit", - value: function beginFragmentEdit() { - if (this._editor) { - return null; - } - - var editor = new ComplexVisualEdit.FragmentEditor(this); - - if (!editor.begin()) { - return null; - } - - this._editor = editor; - return editor; - } // should only be called by editors - - }, { - key: "finalizeEdit", - value: function finalizeEdit() { - this._editor = null; - } - }, { - key: "setMaterialValues", - value: function setMaterialValues(values) { - var needTraverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; - - for (var i = 0, n = this._reprList.length; i < n; ++i) { - var rep = this._reprList[i]; - rep.material.setValues(values); - - if (needTraverse) { - rep.geo.traverse(function (object) { - if (object instanceof Mesh$5) { - object.material.setValues(values); - - if (process !== undefined) { - process(object); + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; } - - object.material.needsUpdate = true; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; } - }); - } - } - } - }, { - key: "setUberOptions", - value: function setUberOptions(values) { - for (var i = 0, n = this._reprList.length; i < n; ++i) { - var rep = this._reprList[i]; - rep.material.setUberOptions(values); - } - } - /** - * Build selector that contains all atoms within given distance from group of atoms - * @param {Selector} selector - selector describing source group of atoms - * @param {number} radius - distance - * @returns {Selector} selector describing result group of atoms - */ - - }, { - key: "within", - value: function within(selector, radius) { - var vw = this._complex.getVoxelWorld(); - - if (vw === null) { - return false; - } // mark atoms of the group as selected - - - var selectionMask = 1 << this._selectionBit; - - this._complex.markAtoms(selector, selectionMask); // mark all atoms within distance as selected - - - if (vw) { - vw.forEachAtomWithinDistFromMasked(this._complex, selectionMask, Number(radius), function (atom) { - atom.mask |= selectionMask; - }); - } // update selection count - - - this._selectionCount = this._complex.countAtomsByMask(selectionMask); // update secondary structure mask - - this._complex.updateStructuresMask(); - - return this.buildSelectorFromMask(selectionMask); - } - }]); - - return ComplexVisual; -}(Visual); // 32 bits = 30 bits for reps + 1 for selection + 1 for selection expansion - - -ComplexVisual.NUM_REPRESENTATION_BITS = 30; - -var vertexVolumeFaces = "varying vec3 pos;\r\n\r\nvoid main() {\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n pos = position.xyz + 0.5;\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n}"; - -var fragmentVolumeFaces = "varying vec3 pos;\r\n\r\nvoid main() {\r\n gl_FragColor = vec4(pos, 0.5);\r\n}"; - -var vertexVolume = "varying vec4 screenSpacePos;\r\n\r\nvoid main() {\r\n screenSpacePos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n gl_Position = screenSpacePos;\r\n}"; - -var fragmentVolume = "uniform mat4 projectionMatrix;\r\n\r\n// 3D volume texture\r\nuniform vec3 volumeDim; // volume dimensions, pixels\r\nuniform sampler2D tileTex; // tiled texture containing all Z-slices of a 3D data\r\nuniform vec2 tileTexSize; // size of tiled texture, pixels\r\nuniform vec2 tileStride; // UV stride between slices in tile tex, pixels\r\n\r\nuniform vec3 boxAngles;//value of angles({x: alpha, y:beta, z:gamma}) types 1 - if angle is obtuse, 0 - if acute\r\nuniform vec3 delta; //Projection box delta's from non-orthogonal origin axes; {x: XY, y : XZ, z: YZ}\r\n\r\nuniform vec3 _isoLevel0;\r\nuniform float _flipV;\r\nuniform sampler2D _BFLeft;\r\nuniform sampler2D _BFRight;\r\nuniform sampler2D _FFLeft;\r\nuniform sampler2D _FFRight;\r\nuniform sampler2D _WFFLeft;\r\nuniform sampler2D _WFFRight;\r\n\r\nvarying vec4 screenSpacePos;\r\n\r\n#define NO_COLOR vec4(0., 0., 0., 0.)\r\n\r\nvec4 sample3DTexture(vec3 texCoord) {\r\n // a pair of Z slices is determined by nearest slice border\r\n float zSliceBorder = floor(texCoord.z * volumeDim.z + 0.5);\r\n float zSliceNumber1 = max(zSliceBorder - 1.0, 0.0);\r\n float zSliceNumber2 = min(zSliceBorder, volumeDim.z - 1.0);\r\n\r\n float rowTiles = floor(tileTexSize.x / tileStride.x);\r\n\r\n // calculate coords in tile texture for both slices\r\n vec2 tileOffset = vec2(mod(zSliceNumber1, rowTiles), floor(zSliceNumber1 / rowTiles));\r\n vec2 texCoordSlice1 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n tileOffset = vec2(mod(zSliceNumber2, rowTiles), floor(zSliceNumber2 / rowTiles));\r\n vec2 texCoordSlice2 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n\r\n // bilinear filtering\r\n vec4 colorSlice1 = texture2D(tileTex, texCoordSlice1);\r\n vec4 colorSlice2 = texture2D(tileTex, texCoordSlice2);\r\n float weightSlice2 = texCoord.z * volumeDim.z - (zSliceNumber1 + 0.5);\r\n return mix(colorSlice1, colorSlice2, weightSlice2);\r\n}\r\n\r\nvec4 sample3DTextureInclined(vec3 boxCoord) { // delta:{ x: XY, y : XZ, z: YZ }\r\n vec3 textCoord = boxCoord;\r\n vec2 currDelta = mix(boxCoord.zz, vec2(1., 1.) - boxCoord.zz, boxAngles.yx) * delta.yz;\r\n\r\n textCoord.y = (boxCoord.y - currDelta.y) / (1. - delta.z);\r\n if (textCoord.y < 0.0 || textCoord.y > 1.0)\r\n return NO_COLOR;\r\n\r\n currDelta.x += mix(textCoord.y, 1.0 - textCoord.y, boxAngles.z) * delta.x;\r\n\r\n textCoord.x = (boxCoord.x - currDelta.x) / (1. - delta.x - delta.y);\r\n if (textCoord.x < 0.0 || textCoord.x > 1.0)\r\n return NO_COLOR;\r\n\r\n return sample3DTexture(textCoord);\r\n}\r\n\r\nfloat CalcColor(vec3 iter, vec3 dir) {\r\n float d = 1. / 128.;\r\n vec3 dx = vec3(d, 0.0, 0.0);\r\n vec3 dy = vec3(0.0, d, 0.0);\r\n vec3 dz = vec3(0.0, 0.0, d);\r\n\r\n // #Opt: coordInc.x:(iter + dx).x > 1. ? 0.: sample3DTextureInclined(iter + dx).x,\r\n vec3 coordInc = mix(\r\n vec3(\r\n sample3DTextureInclined(iter + dx).x,\r\n sample3DTextureInclined(iter + dy).x,\r\n sample3DTextureInclined(iter + dz).x\r\n ),\r\n vec3(0. ,0. , 0.),\r\n vec3(floor((iter + dx).x), floor((iter + dy).y), floor((iter + dz).z))\r\n );\r\n\r\n // #Opt: coordDec.x:(iter - dx).x < 0. ? 0.: sample3DTextureInclined(iter - dx).x,\r\n vec3 coordDec = mix(\r\n vec3(0. ,0. , 0.),\r\n vec3(\r\n sample3DTextureInclined(iter - dx).x,\r\n sample3DTextureInclined(iter - dy).x,\r\n sample3DTextureInclined(iter - dz).x\r\n ),\r\n vec3(ceil((iter - dx).x), ceil((iter - dy).y), ceil((iter - dz).z))\r\n );\r\n\r\n vec3 N = normalize(coordInc - coordDec);\r\n float dif = max(0.0, dot(N, dir));\r\n return dif;\r\n}\r\n\r\nvec3 AccuracyIso(vec3 left, vec3 right, float volLeft, float threshold) {\r\n for (int i = 0; i < 5; i++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if ((volLeft - threshold) * (vol - threshold) < 0.)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec3 CorrectIso(vec3 left, vec3 right, float tr) {\r\n for (int j = 0; j < 5; j++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if (vol < tr)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec4 GetIso1(vec3 start, vec3 back, float molDist, vec3 dir, float tr, int count) {\r\n float vol, stepSize = (float(count) + 2.) / float(STEPS_COUNT);\r\n vec3 step = stepSize * dir, iterator = start, left, right;\r\n vec4 acc = NO_COLOR;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n vol = sample3DTextureInclined(iterator).r;\r\n if (length(iterator - back) <= stepSize || (vol > tr))\r\n break;\r\n }\r\n\r\n if (vol > tr)\r\n acc = vec4(CorrectIso(iterator, iterator - step, tr).xyz, 1.);\r\n\r\n return acc;\r\n}\r\n\r\nfloat easeOut(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return 1.0 - (1.0 - t) * (1.0 - t);\r\n}\r\n\r\nfloat easeIn(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return t * t;\r\n}\r\n\r\nvec3 GetColSimple(float vol) {\r\n float t = easeOut(_isoLevel0.x, _isoLevel0.y, vol);\r\n float s = easeIn(_isoLevel0.y, _isoLevel0.z, vol);\r\n return vec3(0.5, 0.6, 0.7) * (1.0 - t) + 2.0 * vec3(s, 0, 0);\r\n}\r\n\r\nvec4 VolRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 acc = NO_COLOR, iso;\r\n vec3 iterator = start, sumColor = vec3(0., 0., 0.);\r\n float stepSize, alpha, sumAlpha = 0.0, vol, curStepSize, molD;\r\n vec3 step, col, colOld, right;\r\n float tr0 = _isoLevel0.x;\r\n float dif, r, kd, finish;\r\n int count = 0, stopMol = 0;\r\n\r\n for (int k = 0; k < 3; k++) {\r\n stepSize = (float(k) + 2.) / float(STEPS_COUNT);\r\n kd = 140. * tr0 * stepSize;\r\n r = 1. - kd;\r\n step = stepSize * dir;\r\n iso = GetIso1(iterator, back, molDist, dir, tr0, k);\r\n if (iso.a < 0.1 || length(iso.xyz - start) > molDist)\r\n break;\r\n iterator = iso.xyz;\r\n dif = 1.;// CalcColor(iterator, dir);\r\n colOld = GetColSimple(tr0);\r\n curStepSize = stepSize;\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n molD = length(iterator - start);\r\n vol = sample3DTextureInclined(iterator).r;\r\n finish = distance(iterator, back) - stepSize;\r\n if (finish < 0.0 || vol < tr0 || (sumAlpha > 0.97) || molD > molDist)\r\n break;\r\n alpha = (1. - r);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4.* colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n colOld = col;\r\n } // for i\r\n\r\n if (finish < 0.0 || sumAlpha > 0.97)\r\n break;\r\n\r\n if (molD > molDist) {\r\n curStepSize = stepSize - (molD - molDist);\r\n right = iterator - (molD - molDist) * dir;\r\n vol = sample3DTextureInclined(right).r;\r\n } else {\r\n vec3 left = iterator - step;\r\n right = CorrectIso(left, iterator, tr0);\r\n curStepSize = distance(left, right);\r\n vol = tr0;\r\n }\r\n\r\n alpha = (1. - r) * curStepSize / stepSize;\r\n dif = 1.;// CalcColor(right, dir);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * curStepSize / stepSize * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4. * colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n\r\n if (molD > molDist)\r\n break;\r\n } // for k\r\n acc.rgb = 1. * sumColor / sumAlpha;\r\n acc.a = sumAlpha;\r\n return acc;\r\n}\r\n\r\nvec4 VolRender1(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n float stepSize = 1.0 / float(STEPS_COUNT);\r\n float len = length(back - start);\r\n vec3 step = stepSize * dir;\r\n vec3 iterator = start;\r\n float acc = 0.0;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n if (float(i) * stepSize > len)\r\n break;\r\n iterator = iterator + step;\r\n if (sample3DTextureInclined(iterator).r > _isoLevel0.x)\r\n acc += 10. * sample3DTextureInclined(iterator).r / float(STEPS_COUNT);\r\n }\r\n\r\n return vec4(1.,1.,1., acc);\r\n}\r\n\r\nvec4 IsoRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 tst = GetIso1(start, back, 2., dir, _isoLevel0.x, 0);\r\n vec4 col = NO_COLOR;\r\n\r\n if (length(tst.xyz - start) < molDist && tst.a > 0.1) {\r\n float dif = CalcColor(tst.xyz, dir);\r\n dif = 0.9 * dif * dif;\r\n col = vec4(dif, dif, dif, 1);\r\n }\r\n return col;\r\n}\r\n\r\nvec4 VolRender2(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n return sample3DTexture(start);\r\n}\r\n\r\nvoid main() {\r\n vec3 tc = screenSpacePos.xyz / screenSpacePos.w * 0.5 + 0.5;\r\n\r\n if (_flipV > 0.0) {\r\n tc.y = 1.0 - tc.y;\r\n }\r\n\r\n vec3 start;\r\n vec3 back;\r\n vec3 molBack;\r\n if (projectionMatrix[0][2] < 0.0) {\r\n start = texture2D(_FFLeft, tc.xy).xyz;\r\n back = texture2D(_BFLeft, tc.xy).xyz;\r\n molBack = texture2D(_WFFLeft, tc.xy).xyz;\r\n } else {\r\n start = texture2D(_FFRight, tc.xy).xyz;\r\n back = texture2D(_BFRight, tc.xy).xyz;\r\n molBack = texture2D(_WFFRight, tc.xy).xyz;\r\n }\r\n\r\n vec3 dir = normalize(back - start);\r\n\r\n float molDist = 2.0;\r\n if (length(molBack) > 0.001) {\r\n molDist = distance(start, molBack);\r\n }\r\n\r\n #ifdef ISO_MODE\r\n gl_FragColor = IsoRender(start, back, molDist, dir);\r\n #else\r\n gl_FragColor = VolRender(start, back, molDist, dir);\r\n #endif\r\n}\r\n"; - -var vertexFarPlane = "varying vec4 volPos;\r\nuniform float aspectRatio;\r\nuniform float farZ;\r\nuniform float tanHalfFOV;\r\nuniform mat4 matWorld2Volume;\r\n\r\nvoid main() {\r\n // rescale plane to fill in the whole far plane area seen from camera\r\n vec3 pos = position.xyz;\r\n pos.x = pos.x * tanHalfFOV * farZ * aspectRatio;\r\n pos.y = pos.y * tanHalfFOV * farZ;\r\n // common transformation\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\r\n // calc pos in volume CS\r\n volPos = matWorld2Volume * modelMatrix * vec4(pos, 1.0);\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n volPos = volPos + 0.5;\r\n volPos.w = 0.5;\r\n}\r\n"; - -var fragmentFarPlane = "varying vec4 volPos;\r\n\r\nvoid main() {\r\n gl_FragColor = volPos;\r\n}"; - -var volumeUniforms = UniformsUtils.merge([{ - volumeDim: { - type: 'v3', - value: new Vector3(512, 512, 512) - }, - tileTex: { - type: 't', - value: null - }, - tileTexSize: { - type: 'v2', - value: new Vector2(512, 512) - }, - tileStride: { - type: 'v2', - value: new Vector2(512, 512) - }, - boxAngles: { - type: 'v3', - value: new Vector3(1, 1, 1) - }, - delta: { - type: 'v3', - value: new Vector3(0, 0, 0) - }, - _isoLevel0: { - type: 'v2', - value: new Vector3(0.5, 0.75, 1.0) - }, - _flipV: { - type: 'f', - value: 0.0 - }, - _BFLeft: { - type: 't', - value: null - }, - _BFRight: { - type: 't', - value: null - }, - _FFLeft: { - type: 't', - value: null - }, - _FFRight: { - type: 't', - value: null - }, - _WFFLeft: { - type: 't', - value: null - }, - _WFFRight: { - type: 't', - value: null - } -}]); - -function overrideUniforms(params, defUniforms) { - var uniforms = UniformsUtils.clone(defUniforms); - - for (var p in params) { - if (uniforms.hasOwnProperty(p)) { - uniforms[p].value = params[p]; + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; } - } - - return uniforms; -} - -function facesPosMaterialParams(params, sideType) { - return { - uniforms: overrideUniforms(params, {}), - vertexShader: vertexVolumeFaces, - fragmentShader: fragmentVolumeFaces, - transparent: false, - depthTest: false, - depthWrite: false, - side: sideType }; -} - -var BackFacePosMaterial = /*#__PURE__*/function (_THREE$ShaderMaterial) { - inherits(BackFacePosMaterial, _THREE$ShaderMaterial); - - function BackFacePosMaterial(params) { - classCallCheck(this, BackFacePosMaterial); - - var backFaceParams = facesPosMaterialParams(params, BackSide); - return possibleConstructorReturn(this, getPrototypeOf(BackFacePosMaterial).call(this, backFaceParams)); - } - - return BackFacePosMaterial; -}(ShaderMaterial); - -var ShaderParams = function ShaderParams(params, uniforms, vertexShader, fragmentShader) { - classCallCheck(this, ShaderParams); - this.uniforms = overrideUniforms(params, uniforms); - this.vertexShader = vertexShader; - this.fragmentShader = fragmentShader; - this.transparent = false; - this.depthTest = false; - this.depthWrite = false; - this.side = FrontSide; -}; - -var BackFacePosMaterialFarPlane = /*#__PURE__*/function (_THREE$ShaderMaterial2) { - inherits(BackFacePosMaterialFarPlane, _THREE$ShaderMaterial2); - - function BackFacePosMaterialFarPlane(params) { - classCallCheck(this, BackFacePosMaterialFarPlane); - - var matUniforms = UniformsUtils.merge([{ - aspectRatio: { - type: 'f', - value: 0.0 + /* generated by jison-lex 0.3.4 */ + var lexer = function () { + var lexer = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } }, - farZ: { - type: 'f', - value: 0.0 + // resets the lexer, sets new input + setInput: function (input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; }, - tanHalfFOV: { - type: 'f', - value: 0.0 + // consumes and returns one char from the input + input: function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; }, - matWorld2Volume: { - type: '4fv', - value: new Matrix4() - } - }]); - var shaderParams = new ShaderParams(params, matUniforms, vertexFarPlane, fragmentFarPlane); - return possibleConstructorReturn(this, getPrototypeOf(BackFacePosMaterialFarPlane).call(this, shaderParams)); - } - - return BackFacePosMaterialFarPlane; -}(ShaderMaterial); - -var FrontFacePosMaterial = /*#__PURE__*/function (_THREE$ShaderMaterial3) { - inherits(FrontFacePosMaterial, _THREE$ShaderMaterial3); - - function FrontFacePosMaterial(params) { - classCallCheck(this, FrontFacePosMaterial); - - var frontFaceParams = facesPosMaterialParams(params, FrontSide); - return possibleConstructorReturn(this, getPrototypeOf(FrontFacePosMaterial).call(this, frontFaceParams)); - } - - return FrontFacePosMaterial; -}(ShaderMaterial); - -var VolumeMaterial = /*#__PURE__*/function (_THREE$ShaderMaterial4) { - inherits(VolumeMaterial, _THREE$ShaderMaterial4); - - function VolumeMaterial(params) { - var _this; - - classCallCheck(this, VolumeMaterial); - - var shaderParams = new ShaderParams(params, volumeUniforms, vertexVolume, fragmentVolume); - shaderParams.transparent = true; - shaderParams.depthTest = true; - _this = possibleConstructorReturn(this, getPrototypeOf(VolumeMaterial).call(this, shaderParams)); - - _this.updateDefines(); - - return _this; - } - - createClass(VolumeMaterial, [{ - key: "updateDefines", - value: function updateDefines() { - this.defines = { - ISO_MODE: settings.now.modes.VD.isoMode, - STEPS_COUNT: settings.now.modes.VD.polyComplexity[settings.now.resolution] * 100 - }; - this.needsUpdate = true; - } - }]); - - return VolumeMaterial; -}(ShaderMaterial); - -var VolumeMaterial$1 = { - BackFacePosMaterial: BackFacePosMaterial, - BackFacePosMaterialFarPlane: BackFacePosMaterialFarPlane, - FrontFacePosMaterial: FrontFacePosMaterial, - VolumeMaterial: VolumeMaterial -}; - -var VolumeMesh = /*#__PURE__*/function (_THREE$Mesh) { - inherits(VolumeMesh, _THREE$Mesh); - - // data for noise filter - function VolumeMesh() { - var _this; - - classCallCheck(this, VolumeMesh); - - var geo = new BufferGeometry(); - _this = possibleConstructorReturn(this, getPrototypeOf(VolumeMesh).call(this, geo)); - - defineProperty(assertThisInitialized(_this), "volumeInfo", {}); - - _this.clipPlane = new Plane(); - var size = new Vector3(0.5, 0.5, 0.5); - _this.size = size; - _this.cullFlag = [true, true, true, true, true, true, true, true, false, false, false, false, false, false]; - _this.faces = [{ - indices: [], - norm: new Vector3(0, 0, -1) - }, { - indices: [], - norm: new Vector3(0, 0, 1) - }, { - indices: [], - norm: new Vector3(0, -1, 0) - }, { - indices: [], - norm: new Vector3(0, 1, 0) - }, { - indices: [], - norm: new Vector3(-1, 0, 0) - }, { - indices: [], - norm: new Vector3(1, 0, 0) - }, { - indices: [], - norm: new Vector3(0, 0, 0) - }]; - _this.vertices = [new Vector3(-size.x, -size.y, -size.z), new Vector3(-size.x, size.y, -size.z), new Vector3(size.x, -size.y, -size.z), new Vector3(size.x, size.y, -size.z), new Vector3(-size.x, -size.y, size.z), new Vector3(-size.x, size.y, size.z), new Vector3(size.x, -size.y, size.z), new Vector3(size.x, size.y, size.z), new Vector3(0.0, 0.0, 0.0), // Placeholder for section - new Vector3(0.0, 0.0, 0.0), new Vector3(0.0, 0.0, 0.0), new Vector3(0.0, 0.0, 0.0), new Vector3(0.0, 0.0, 0.0), new Vector3(0.0, 0.0, 0.0)]; - geo.setAttribute('position', new BufferAttribute(new Float32Array(_this.vertices.length * 3), 3)); - _this.name = 'VolumeMesh'; - return _this; - } - - createClass(VolumeMesh, [{ - key: "_updateVertices", - value: function _updateVertices() { - // Algorithm: - // 1. Get plane parameters - // 2. Compute culling flags for all vertices - // 3. If intersection occurs => compute from 3 to 6 intersection points - var corners = VolumeMesh._corners; - var edges = VolumeMesh._edges; - var edgeIntersections = VolumeMesh._edgeIntersections; - var i; - var norm = this.clipPlane.normal; - var D = this.clipPlane.constant; - var vert = this.vertices; - var size = this.size; - var cornerMark = [0, 0, 0, 0, 0, 0, 0, 0]; - var edgeMark = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; - var curEdge = new Vector3(); - var curEdgeInter = null; - - function CheckX() { - if (norm.x === 0) return 0; - var x = -(norm.dot(curEdge) + D) / norm.x; - - if (-size.x <= x && x <= size.x) { - curEdgeInter.set(x, curEdge.y, curEdge.z); - if (x === size.x) return 2; - if (x === -size.x) return -2; - return 1; + // unshifts one char (or a string) into the input + unput: function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; } - - return 0; - } - - function CheckY() { - if (norm.y === 0) return 0; - var y = -(norm.dot(curEdge) + D) / norm.y; - - if (-size.y <= y && y <= size.y) { - curEdgeInter.set(curEdge.x, y, curEdge.z); - if (y === size.y) return 2; - if (y === -size.y) return -2; - return 1; + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + // When called from action, caches matched text and appends it on next action + more: function () { + this._more = true; + return this; + }, + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, + // retain first n characters of the match + less: function (n) { + this.unput(this.match.slice(n)); + }, + // displays already matched input, i.e. for error messages + pastInput: function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); + }, + // displays upcoming input, i.e. for error messages + upcomingInput: function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: function (match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; } - - return 0; - } - - function CheckZ() { - if (norm.z === 0) return 0; - var z = -(norm.dot(curEdge) + D) / norm.z; - - if (-size.z <= z && z <= size.z) { - curEdgeInter.set(curEdge.x, curEdge.y, z); - if (z === size.z) return 2; - if (z === -size.z) return -2; - return 1; + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; } - - return 0; - } // for each edge - - - for (var curEdgeIdx = 0; curEdgeIdx < 12; ++curEdgeIdx) { - var curEdgeSource = edges[curEdgeIdx]; - curEdgeInter = edgeIntersections[curEdgeIdx]; - curEdge.set(curEdgeSource[2], curEdgeSource[3], curEdgeSource[4]); - curEdge.multiply(size); // calculate intersection point - - var flag = 0; - if (curEdgeSource[2] === 0) flag = CheckX(); - if (curEdgeSource[3] === 0) flag = CheckY(); - if (curEdgeSource[4] === 0) flag = CheckZ(); // mark corresponding corner (if plane cuts through one) - - if (flag === -2) { - cornerMark[curEdgeSource[0]] = 1; - } else if (flag === 2) { - cornerMark[curEdgeSource[1]] = 1; - } else if (flag === 0) { - // edge is not intersected by the plane (doesn't produce a vertex) - edgeMark[curEdgeIdx] = 0; + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. } - } - - var face = { - indices: [], - norm: norm.clone().negate() - }; - var nextVertex = 8; // for each marked corner - - for (i = 0; i < 8; ++i) { - if (cornerMark[i] === 1) { - // add corner as vertex to the face - vert[nextVertex].set(corners[i][0], corners[i][1], corners[i][2]).multiply(size); - face.indices.push(nextVertex++); // skip adjacent edges - - edgeMark[corners[i][3]] = 0; - edgeMark[corners[i][4]] = 0; - edgeMark[corners[i][5]] = 0; + return false; + }, + // return next match in input + next: function () { + if (this.done) { + return this.EOF; } - } // for each edge that has internal intersection - - - for (i = 0; i < 12; ++i) { - if (edgeMark[i] === 1) { - // add intersection point as vertex to the face - vert[nextVertex].copy(edgeIntersections[i]); - face.indices.push(nextVertex++); + if (!this._input) { + this.done = true; } - } - - this.faces[6] = face; - var diff = new Vector3(); - var coplanarPoint = new Vector3(); - this.clipPlane.coplanarPoint(coplanarPoint); - - for (i = 0; i < vert.length; ++i) { - this.cullFlag[i] = false; - - if (i < 8) { - // corners should be culled by clipping plane - diff.subVectors(vert[i], coplanarPoint); - this.cullFlag[i] = norm.dot(diff) >= 0.0; - } else if (i < 8 + face.indices.length) { - // cross section vertices don't get culled - this.cullFlag[i] = true; + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ''; + this.match = ''; } - } // write data to vertex buffer - - - var positions = this.geometry.getAttribute('position'); - var idx = 0; - - for (i = 0; i < vert.length; ++i) { - positions.array[idx++] = vert[i].x; - positions.array[idx++] = vert[i].y; - positions.array[idx++] = vert[i].z; - } - - positions.needsUpdate = true; - } - }, { - key: "_collectVertices", - value: function _collectVertices(face, filter) { - var i; - var vert = this.vertices; - face.indices = []; - - for (i = 0; i < vert.length; ++i) { - if (this.cullFlag[i] && filter(vert[i])) { - face.indices.push(i); + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } } - } - } - }, { - key: "_sortIndices", - value: function _sortIndices(face, right) { - var i; - var j; - var vert = this.vertices; - var angle = []; - var dir = new Vector3(); - - for (i = 1; i < face.indices.length; ++i) { - dir.subVectors(vert[face.indices[i]], vert[face.indices[0]]); - dir.normalize(); - dir.cross(right); - dir.negate(); - angle[i] = face.norm.dot(dir); - } // Exchange sort - - - for (i = 1; i < face.indices.length - 1; ++i) { - for (j = i + 1; j < face.indices.length; ++j) { - if (angle[j] < angle[i]) { - // swap - var t = angle[i]; - angle[i] = angle[j]; - angle[j] = t; - t = face.indices[i]; - face.indices[i] = face.indices[j]; - face.indices[j] = t; + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; } - } - } - }, { - key: "_updateIndices", - value: function _updateIndices() { - // Algorithm: - // 1. Get plane vertices (from 3 to 6 vertices) - // 2. Get "right" vector in plane - // 3. Sort vertices using Graham-like method - // 4. Create indices - var i; - var faceIdx; - var face; - var vert = this.vertices; - var size = this.size; - - this._collectVertices(this.faces[0], function (vertex) { - return vertex.z === -size.z; - }); - - this._collectVertices(this.faces[1], function (vertex) { - return vertex.z === size.z; - }); - - this._collectVertices(this.faces[2], function (vertex) { - return vertex.y === -size.y; - }); - - this._collectVertices(this.faces[3], function (vertex) { - return vertex.y === size.y; - }); - - this._collectVertices(this.faces[4], function (vertex) { - return vertex.x === -size.x; - }); - - this._collectVertices(this.faces[5], function (vertex) { - return vertex.x === size.x; - }); - - var vCenter = new Vector3(); - var vRight = new Vector3(); - var vDir = new Vector3(); - - for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { - face = this.faces[faceIdx]; - if (face.indices.length === 0) continue; - vCenter.set(0, 0, 0); - - for (i = 0; i < face.indices.length; ++i) { - vCenter.add(vert[face.indices[i]]); + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); } - - vCenter.multiplyScalar(1.0 / face.indices.length); - vRight.subVectors(vert[face.indices[0]], vCenter); - vRight.normalize(); - var rightProj = []; - - for (i = 0; i < face.indices.length; ++i) { - vDir.subVectors(vert[face.indices[i]], vCenter); - rightProj[i] = vDir.dot(vRight); + }, + // return next match that has a token + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); } - - for (i = 1; i < face.indices.length; ++i) { - if (rightProj[i] < rightProj[0]) { - // swap - var t = rightProj[0]; - rightProj[0] = rightProj[i]; - rightProj[i] = t; - - var _face$indices = slicedToArray(face.indices, 1); - - t = _face$indices[0]; - face.indices[0] = face.indices[i]; - face.indices[i] = t; - } + }, + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + // pop the previously active lexer condition state off the condition stack + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; } - - this._sortIndices(face, vRight); - } - - var numIndices = 0; - - for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { - face = this.faces[faceIdx]; - - if (face.indices.length >= 3) { - numIndices += 3 * (face.indices.length - 2); + }, + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; } - } - - var offset = 0; - var indices = new Uint16Array(numIndices); - - for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { - face = this.faces[faceIdx]; - - for (i = 0; i < face.indices.length - 2; ++i) { - indices[offset] = face.indices[0]; // eslint-disable-line prefer-destructuring - - indices[offset + 1] = face.indices[i + 1]; - indices[offset + 2] = face.indices[i + 2]; - offset += 3; + }, + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + // alias for begin(condition) + pushState: function pushState(condition) { + this.begin(condition); + }, + // return the number of states currently on the stack + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: { + "case-insensitive": true + }, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + /* skip whitespace */ + break; + case 1: + return 20; + break; + case 2: + return 7; + break; + case 3: + return 8; + break; + case 4: + return 9; + break; + case 5: + return 12; + break; + case 6: + return 16; + break; + case 7: + return 14; + break; + case 8: + return 10; + break; + case 9: + return 11; + break; + case 10: + return 19; + break; + case 11: + return 21; + break; + case 12: + return '<='; + break; + case 13: + return '>='; + break; + case 14: + return '<'; + break; + case 15: + return '>'; + break; + case 16: + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); + return 24; + break; + case 17: + return 13; + break; + case 18: + return 23; + break; + case 19: + return 5; + break; + case 20: + return 'INVALID'; + break; + } + }, + rules: [/^(?:\s+)/i, /^(?:(-?(?:[1-9][0-9]+|[0-9]))\b)/i, /^(?:OR\b)/i, /^(?:AND\b)/i, /^(?:NOT\b)/i, /^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\b)/i, /^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\b)/i, /^(?:((SERIAL|SEQUENCE|RESIDX))\b)/i, /^(?:\()/i, /^(?:\))/i, /^(?:,)/i, /^(?::)/i, /^(?:<=)/i, /^(?:>=)/i, /^(?:<)/i, /^(?:>)/i, /^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i, /^(?:(@[_A-Z0-9]+))/i, /^(?:([_A-Z0-9]+))/i, /^(?:$)/i, /^(?:.)/i], + conditions: { + "INITIAL": { + "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], + "inclusive": true } } - - this.geometry.setIndex(new BufferAttribute(indices, 1)); - } - }, { - key: "setDataSource", - value: function setDataSource(dataSource) { - var vm = new VolumeMaterial$1.VolumeMaterial(); - var dim = dataSource.getDimensions(); - var stride = dataSource.getTiledTextureStride(); - var texture = dataSource.buildTiledTexture(); - var bbox = dataSource.getBox(); - vm.uniforms.volumeDim.value.set(dim[0], dim[1], dim[2]); - vm.uniforms.tileTex.value = texture; - vm.uniforms.tileTexSize.value.set(texture.image.width, texture.image.height); - vm.uniforms.tileStride.value.set(stride[0], stride[1]); - Object.assign(this.volumeInfo, dataSource.getVolumeInfo()); - var volInfo = this.volumeInfo; - vm.uniforms.delta.value.copy(volInfo.delta); - vm.uniforms.boxAngles.value.set(volInfo.obtuseAngle[0], volInfo.obtuseAngle[1], volInfo.obtuseAngle[2]); - this.material = vm; - bbox.getSize(this.scale); - bbox.getCenter(this.position); - } - }, { - key: "_updateIsoLevel", - value: function _updateIsoLevel() { - var _settings$now$modes$V = settings.now.modes.VD, - kSigma = _settings$now$modes$V.kSigma, - kSigmaMed = _settings$now$modes$V.kSigmaMed, - kSigmaMax = _settings$now$modes$V.kSigmaMax; - var volInfo = this.volumeInfo; - var mean = volInfo.dmean - volInfo.dmin; - var span = volInfo.dmax - volInfo.dmin; - - var level = function level(k) { - return (mean + k * volInfo.sd) / span; - }; - - this.material.uniforms._isoLevel0.value.set(level(kSigma), level(kSigmaMed), level(kSigmaMax)); - } - }, { - key: "rebuild", - value: function rebuild(camera) { - var nearClipPlaneOffset = VolumeMesh._nearClipPlaneOffset; - var pos = VolumeMesh._pos; - var norm = VolumeMesh._norm; - var norm4D = VolumeMesh._norm4D; - var matrixWorldToLocal = VolumeMesh._matrixWorldToLocal; - var clipPlane = VolumeMesh._clipPlane; - - this._updateIsoLevel(); // get clip plane in local space - - - camera.getWorldDirection(norm); - camera.getWorldPosition(pos); - pos.addScaledVector(norm, camera.near + nearClipPlaneOffset); // transform pos to local CS - - matrixWorldToLocal.getInverse(this.matrixWorld); - pos.applyMatrix4(matrixWorldToLocal); // transform norm to local CS - - norm4D.set(norm.x, norm.y, norm.z, 0.0); // NOTE: use homogeneous norm for proper transformation - - norm4D.applyMatrix4(matrixWorldToLocal); - norm.copy(norm4D); - norm.normalize(); - clipPlane.setFromNormalAndCoplanarPoint(norm, pos); - - if (!this.clipPlane.equals(clipPlane)) { - this.clipPlane = clipPlane.clone(); - - this._updateVertices(); - - this._updateIndices(); - } - } - }]); - - return VolumeMesh; -}(Mesh$5); - -defineProperty(VolumeMesh, "_corners", [// x, y, z, edge1, edge2, edge3 -[-1, -1, -1, 0, 4, 8], [1, -1, -1, 0, 5, 9], [1, 1, -1, 1, 5, 10], [-1, 1, -1, 1, 4, 11], [-1, -1, 1, 2, 6, 8], [1, -1, 1, 2, 7, 9], [1, 1, 1, 3, 7, 10], [-1, 1, 1, 3, 6, 11]]); - -defineProperty(VolumeMesh, "_edges", [// corner1, corner2, center_x, center_y, center_z -[0, 1, 0, -1, -1], [2, 3, 0, 1, -1], [4, 5, 0, -1, 1], [6, 7, 0, 1, 1], [0, 3, -1, 0, -1], [1, 2, 1, 0, -1], [4, 7, -1, 0, 1], [5, 6, 1, 0, 1], [0, 4, -1, -1, 0], [1, 5, 1, -1, 0], [2, 6, -1, 1, 0], [3, 7, 1, 1, 0]]); - -defineProperty(VolumeMesh, "_edgeIntersections", function () { - var edgeIntersections = []; - - for (var j = 0; j < 12; ++j) { - edgeIntersections.push(new Vector3()); - } - - return edgeIntersections; -}()); - -defineProperty(VolumeMesh, "_nearClipPlaneOffset", 0.2); - -defineProperty(VolumeMesh, "_pos", new Vector3()); - -defineProperty(VolumeMesh, "_norm", new Vector3()); - -defineProperty(VolumeMesh, "_norm4D", new Vector4()); - -defineProperty(VolumeMesh, "_matrixWorldToLocal", new Matrix4()); - -defineProperty(VolumeMesh, "_clipPlane", new Plane()); - -var VolumeBounds = /*#__PURE__*/function () { - function VolumeBounds(bBox, volInfo) { - classCallCheck(this, VolumeBounds); - - var delta = volInfo.delta; // {x: XY, y : XZ, z: YZ} - - var obtuseAngle = volInfo.obtuseAngle; // 1 - obtuse, 0 - acute - - var bSize = new Vector3(); - bBox.getSize(bSize); - bSize.multiplyScalar(0.5); - - var offsetVert = this._getBaseVertices(delta, obtuseAngle); - - var geometry = new Geometry(); - - for (var i = 0; i < 4; i++) { - geometry.vertices.push(offsetVert[i].clone().multiply(bSize)); - geometry.vertices.push(offsetVert[(i + 1) % 4].clone().multiply(bSize)); - } - - var translation = new Vector3(2 * bSize.x * (1 - delta.x - delta.y), 0, 0); - - for (var _i = 0; _i < 8; _i++) { - geometry.vertices.push(geometry.vertices[_i].clone().add(translation)); - } - - for (var _i2 = 0; _i2 < 4; _i2++) { - geometry.vertices.push(geometry.vertices[_i2 * 2].clone()); - geometry.vertices.push(geometry.vertices[_i2 * 2 + 8].clone()); - } - - var center = new Vector3(); - bBox.getCenter(center); - geometry.vertices.forEach(function (vertex) { - return vertex.add(center); - }); // pivot shift - - this._lines = new LineSegments(geometry, new LineBasicMaterial({ - color: 0xFFFFFF - })); - - this._lines.layers.set(gfxutils.LAYERS.VOLUME); - } // Set one edge (4 points) of frame, from which with parallel transfer the rest of the frame points can be obtained - - - createClass(VolumeBounds, [{ - key: "_getBaseVertices", - value: function _getBaseVertices(delta, obtuseAngle) { - var projTable = VolumeBounds._projectionTable; - - var proj = function proj(index, inv) { - // tricky function to take account of projections: their position(related to box) and sign - var currDelta = delta[projTable[index][0]]; - var angleValue = -0.5 * (inv - 1) + inv * obtuseAngle[projTable[index][1]]; // inv = 1: alpha; inv = -1: 1 - alpha - - return angleValue * currDelta; - }; - - var offsetVert = [new Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', 1)), -1 + 2 * proj('YZ', 1), -1), new Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', 1)), -1 + 2 * proj('YZ', -1), 1), new Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', -1)), 1 - 2 * proj('YZ', 1), 1), new Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', -1)), 1 - 2 * proj('YZ', -1), -1)]; - return offsetVert; - } - }, { - key: "getMesh", - value: function getMesh() { - return this._lines; - } - }]); - - return VolumeBounds; -}(); - -defineProperty(VolumeBounds, "_projectionTable", { - // corresponds between (origin axes and angles between them) and between saving vector coordinates - XY: ['x', 2], - XZ: ['y', 1], - YZ: ['z', 0] -}); - -// cube. In cut place of cube there is no correct data in BFTexture and volume rendering integral is calculated -// with errors. -// Far plane cuts the cube in case of large volume scale (zoom), because farplane doesn't change - -var VolumeFarPlane = /*#__PURE__*/function () { - // create plane with unit corners coords (for future rescale in vshader according to camera properties) - function VolumeFarPlane(volume, width, height) { - classCallCheck(this, VolumeFarPlane); - - var planeGeo = this._initPlaneGeo(width, height); - - var mat = new VolumeMaterial$1.BackFacePosMaterialFarPlane(); - this._plane = new meshes.Mesh(planeGeo, mat); - this._plane.frustumCulled = false; - this._plane.doubleSided = true; - var matWorldToVolume = new Matrix4(); - - this._plane._onBeforeRender = function (_renderer, _scene, camera, _geometry, _material, _group) { - var material = this.material; - - if (!volume || !material) { - return; - } // count point in world at farplane place - - - var planeCamPos = new Vector4(0, 0, -(camera.far - 0.1), 1); - planeCamPos.applyMatrix4(camera.matrixWorld); // recalc matrices to make plane be placed as farplane in the World relative to camera - - this.matrix.identity(); - this.matrix.makeTranslation(planeCamPos.x, planeCamPos.y, planeCamPos.z); - this.matrixWorld.copy(this.matrix); - this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld); - this.normalMatrix.getNormalMatrix(this.modelViewMatrix); // build worldToVolume matrix to transform plane into volumeCS (volumeCS coords are written to BackFaceTexture) - - var volumeMatrix = volume.matrixWorld; - matWorldToVolume.getInverse(volumeMatrix); // update material props - - material.uniforms.aspectRatio.value = camera.aspect; - material.uniforms.farZ.value = camera.far; - material.uniforms.tanHalfFOV.value = Math.tan(Math$1.DEG2RAD * 0.5 * camera.fov); - material.uniforms.matWorld2Volume.value = matWorldToVolume; - }; // set it to special layer to draw only into BFTexture - - - this._plane.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE); + }; + return lexer; + }(); + parser.lexer = lexer; + function Parser() { + this.yy = {}; } - - createClass(VolumeFarPlane, [{ - key: "_initPlaneGeo", - value: function _initPlaneGeo(width, height) { - var planeGeo = new Geometry(); - width = width || 1; - height = height || 1; - planeGeo.vertices.push(new Vector3(-0.5 * width, 0.5 * height, 0)); - planeGeo.vertices.push(new Vector3(0.5 * width, 0.5 * height, 0)); - planeGeo.vertices.push(new Vector3(-0.5 * width, -0.5 * height, 0)); - planeGeo.vertices.push(new Vector3(0.5 * width, -0.5 * height, 0)); - planeGeo.faces.push(new Face3(0, 2, 1)); - planeGeo.faces.push(new Face3(2, 3, 1)); - return planeGeo; - } - }, { - key: "getMesh", - value: function getMesh() { - return this._plane; - } - }]); - - return VolumeFarPlane; + Parser.prototype = parser; + parser.Parser = Parser; + return new Parser(); }(); - -function VolumeVisual(name, dataSource) { - Visual.call(this, name, dataSource); - this._mesh = new VolumeMesh(); - - this._mesh.setDataSource(dataSource); - - this.add(this._mesh); - this._frame = new VolumeBounds(this.getBoundaries().boundingBox, this._mesh.volumeInfo); - this.add(this._frame.getMesh()); - this.showFrame(settings.now.modes.VD.frame); - this._farPlane = new VolumeFarPlane(this._mesh, 2, 2); - this.add(this._farPlane.getMesh()); -} - -utils.deriveClass(VolumeVisual, Visual); - -VolumeVisual.prototype.getBoundaries = function () { - var box = this._dataSource.getBox(); - - var sphere = new Sphere(); - box.getBoundingSphere(sphere); - return { - boundingBox: box, - boundingSphere: sphere - }; -}; - -VolumeVisual.prototype.getMesh = function () { - return this._mesh; -}; - -VolumeVisual.prototype.showFrame = function (needShow) { - this._frame.getMesh().material.visible = needShow; +module.exports = { + parser: parser }; -/** - * A list of available loaders. - * @extends EntityList - */ +/***/ }), -var LoaderList = /*#__PURE__*/function (_EntityList) { - inherits(LoaderList, _EntityList); - - /** - * Create a list of loaders. - * The loaders are indexed by supported source types (`.types` property of a Loader - * subclass). - * The loaders can be retrieved later by matching against specs (see {@link LoaderList#find}). - * - * @param {!Array=} someLoaders A list of {@link Loader} subclasses to - * automatically register at creation time. - * @see LoaderList#register - */ - function LoaderList() { - var someLoaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; +/***/ 690: +/***/ (function(__unused_webpack_module, exports) { - classCallCheck(this, LoaderList); +/* +Smooth.js version 0.1.7 - return possibleConstructorReturn(this, getPrototypeOf(LoaderList).call(this, someLoaders, ['types'])); - } - /** - * Find a suitable loader for a source type. - * - * @param {Object} specs Loader specifications. - * @param {string=} specs.type Supported source type. - * @param {*=} specs.source Source to load from. - */ +Turn arrays into smooth functions. +Copyright 2012 Spencer Cohen +Licensed under MIT license (see "Smooth.js MIT license.txt") +*/ - createClass(LoaderList, [{ - key: "find", - value: function find(specs) { - var list = []; +/*Constants (these are accessible by Smooth.WHATEVER in user space) +*/ - if (specs.type) { - list = this._dict.types[specs.type.toLowerCase()] || []; - } else if (specs.source) { - return this._list.filter(function (SomeLoader) { - return SomeLoader.canProbablyLoad && SomeLoader.canProbablyLoad(specs.source); - }); +(function () { + var AbstractInterpolator, + CubicInterpolator, + Enum, + LinearInterpolator, + NearestInterpolator, + PI, + SincFilterInterpolator, + Smooth, + clipClamp, + clipMirror, + clipPeriodic, + defaultConfig, + getColumn, + getType, + isValidNumber, + k, + makeLanczosWindow, + makeScaledFunction, + makeSincKernel, + normalizeScaleTo, + shallowCopy, + sin, + sinc, + v, + validateNumber, + validateVector, + __hasProp = Object.prototype.hasOwnProperty, + __extends = function (child, parent) { + for (var key in parent) { + if (__hasProp.call(parent, key)) child[key] = parent[key]; } + function ctor() { + this.constructor = child; + } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + child.__super__ = parent.prototype; + return child; + }; + Enum = { + /*Interpolation methods + */ + METHOD_NEAREST: 'nearest', + METHOD_LINEAR: 'linear', + METHOD_CUBIC: 'cubic', + METHOD_LANCZOS: 'lanczos', + METHOD_SINC: 'sinc', + /*Input clipping modes + */ + CLIP_CLAMP: 'clamp', + CLIP_ZERO: 'zero', + CLIP_PERIODIC: 'periodic', + CLIP_MIRROR: 'mirror', + /* Constants for control over the cubic interpolation tension + */ + CUBIC_TENSION_DEFAULT: 0, + CUBIC_TENSION_CATMULL_ROM: 0 + }; + defaultConfig = { + method: Enum.METHOD_CUBIC, + cubicTension: Enum.CUBIC_TENSION_DEFAULT, + clip: Enum.CLIP_CLAMP, + scaleTo: 0, + sincFilterSize: 2, + sincWindow: void 0 + }; - return toConsumableArray(list); - } - }]); - - return LoaderList; -}(EntityList); - -var Loader = /*#__PURE__*/function (_EventDispatcher) { - inherits(Loader, _EventDispatcher); - - function Loader(source, options) { - var _this; + /*Index clipping functions + */ - classCallCheck(this, Loader); + clipClamp = function (i, n) { + return Math.max(0, Math.min(i, n - 1)); + }; + clipPeriodic = function (i, n) { + i = i % n; + if (i < 0) i += n; + return i; + }; + clipMirror = function (i, n) { + var period; + period = 2 * (n - 1); + i = clipPeriodic(i, period); + if (i > n - 1) i = period - i; + return i; + }; - _this = possibleConstructorReturn(this, getPrototypeOf(Loader).call(this)); - _this._source = source; - _this._options = options || {}; - _this._abort = false; - _this._agent = null; - return _this; - } + /* + Abstract scalar interpolation class which provides common functionality for all interpolators + + Subclasses must override interpolate(). + */ - createClass(Loader, [{ - key: "load", - value: function load() { - return Promise.reject(new Error('Loading from this source is not implemented')); + AbstractInterpolator = function () { + function AbstractInterpolator(array, config) { + this.array = array.slice(0); + this.length = this.array.length; + if (!(this.clipHelper = { + clamp: this.clipHelperClamp, + zero: this.clipHelperZero, + periodic: this.clipHelperPeriodic, + mirror: this.clipHelperMirror + }[config.clip])) { + throw "Invalid clip: " + config.clip; + } } - }, { - key: "abort", - value: function abort() { - this._abort = true; - - if (this._agent) { - this._agent.abort(); + AbstractInterpolator.prototype.getClippedInput = function (i) { + if (0 <= i && i < this.length) { + return this.array[i]; + } else { + return this.clipHelper(i); } + }; + AbstractInterpolator.prototype.clipHelperClamp = function (i) { + return this.array[clipClamp(i, this.length)]; + }; + AbstractInterpolator.prototype.clipHelperZero = function (i) { + return 0; + }; + AbstractInterpolator.prototype.clipHelperPeriodic = function (i) { + return this.array[clipPeriodic(i, this.length)]; + }; + AbstractInterpolator.prototype.clipHelperMirror = function (i) { + return this.array[clipMirror(i, this.length)]; + }; + AbstractInterpolator.prototype.interpolate = function (t) { + throw 'Subclasses of AbstractInterpolator must override the interpolate() method.'; + }; + return AbstractInterpolator; + }(); + NearestInterpolator = function (_super) { + __extends(NearestInterpolator, _super); + function NearestInterpolator() { + NearestInterpolator.__super__.constructor.apply(this, arguments); + } + NearestInterpolator.prototype.interpolate = function (t) { + return this.getClippedInput(Math.round(t)); + }; + return NearestInterpolator; + }(AbstractInterpolator); + LinearInterpolator = function (_super) { + __extends(LinearInterpolator, _super); + function LinearInterpolator() { + LinearInterpolator.__super__.constructor.apply(this, arguments); + } + LinearInterpolator.prototype.interpolate = function (t) { + var k; + k = Math.floor(t); + t -= k; + return (1 - t) * this.getClippedInput(k) + t * this.getClippedInput(k + 1); + }; + return LinearInterpolator; + }(AbstractInterpolator); + CubicInterpolator = function (_super) { + __extends(CubicInterpolator, _super); + function CubicInterpolator(array, config) { + this.tangentFactor = 1 - Math.max(-1, Math.min(1, config.cubicTension)); + CubicInterpolator.__super__.constructor.apply(this, arguments); } - }], [{ - key: "extractName", - value: function extractName(_source) { - return undefined; + CubicInterpolator.prototype.getTangent = function (k) { + return this.tangentFactor * (this.getClippedInput(k + 1) - this.getClippedInput(k - 1)) / 2; + }; + CubicInterpolator.prototype.interpolate = function (t) { + var k, m, p, t2, t3; + k = Math.floor(t); + m = [this.getTangent(k), this.getTangent(k + 1)]; + p = [this.getClippedInput(k), this.getClippedInput(k + 1)]; + t -= k; + t2 = t * t; + t3 = t * t2; + return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + (-2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1]; + }; + return CubicInterpolator; + }(AbstractInterpolator); + sin = Math.sin, PI = Math.PI; + sinc = function (x) { + if (x === 0) { + return 1; + } else { + return sin(PI * x) / (PI * x); } - }]); - - return Loader; -}(EventDispatcher); -makeContextDependent(Loader.prototype); - -var FileLoader = /*#__PURE__*/function (_Loader) { - inherits(FileLoader, _Loader); - - function FileLoader(source, options) { - var _this; - - classCallCheck(this, FileLoader); - - _this = possibleConstructorReturn(this, getPrototypeOf(FileLoader).call(this, source, options)); - options = _this._options; - _this._binary = options.binary === true; - return _this; - } - - createClass(FileLoader, [{ - key: "load", - value: function load() { - var _this2 = this; - - return new Promise(function (resolve, reject) { - if (_this2._abort) { - throw new Error('Loading aborted'); - } - - var blob = _this2._source; - var reader = _this2._agent = new FileReader(); - reader.addEventListener('load', function () { - resolve(reader.result); - }); - reader.addEventListener('error', function () { - reject(reader.error); - }); - reader.addEventListener('abort', function () { - reject(new Error('Loading aborted')); - }); - reader.addEventListener('progress', function (event) { - _this2.dispatchEvent(event); - }); - - if (_this2._binary) { - reader.readAsArrayBuffer(blob); - } else { - reader.readAsText(blob); - } - }); + }; + makeLanczosWindow = function (a) { + return function (x) { + return sinc(x / a); + }; + }; + makeSincKernel = function (window) { + return function (x) { + return sinc(x) * window(x); + }; + }; + SincFilterInterpolator = function (_super) { + __extends(SincFilterInterpolator, _super); + function SincFilterInterpolator(array, config) { + SincFilterInterpolator.__super__.constructor.apply(this, arguments); + this.a = config.sincFilterSize; + if (!config.sincWindow) throw 'No sincWindow provided'; + this.kernel = makeSincKernel(config.sincWindow); } - }], [{ - key: "canProbablyLoad", - value: function canProbablyLoad(source) { - return File && source instanceof File || Blob && source instanceof Blob; + SincFilterInterpolator.prototype.interpolate = function (t) { + var k, n, sum, _ref, _ref2; + k = Math.floor(t); + sum = 0; + for (n = _ref = k - this.a + 1, _ref2 = k + this.a; _ref <= _ref2 ? n <= _ref2 : n >= _ref2; _ref <= _ref2 ? n++ : n--) { + sum += this.kernel(t - n) * this.getClippedInput(n); + } + return sum; + }; + return SincFilterInterpolator; + }(AbstractInterpolator); + getColumn = function (arr, i) { + var row, _i, _len, _results; + _results = []; + for (_i = 0, _len = arr.length; _i < _len; _i++) { + row = arr[_i]; + _results.push(row[i]); } - }, { - key: "extractName", - value: function extractName(source) { - return source && source.name; + return _results; + }; + makeScaledFunction = function (f, baseScale, scaleRange) { + var scaleFactor, translation; + if (scaleRange.join === '0,1') { + return f; + } else { + scaleFactor = baseScale / (scaleRange[1] - scaleRange[0]); + translation = scaleRange[0]; + return function (t) { + return f(scaleFactor * (t - translation)); + }; } - }]); - - return FileLoader; -}(Loader); -FileLoader.types = ['file', 'blob']; - -var urlStartRegexp = /^(https?|ftp):\/\//i; - -var XHRLoader = /*#__PURE__*/function (_Loader) { - inherits(XHRLoader, _Loader); - - function XHRLoader(source, options) { - var _this; - - classCallCheck(this, XHRLoader); - - _this = possibleConstructorReturn(this, getPrototypeOf(XHRLoader).call(this, source, options)); - options = _this._options; - _this._binary = options.binary === true; - return _this; - } - - createClass(XHRLoader, [{ - key: "load", - value: function load() { - var _this2 = this; - - return new Promise(function (resolve, reject) { - if (_this2._abort) { - throw new Error('Loading aborted'); - } - - var url = _this2._source; - var request = _this2._agent = new XMLHttpRequest(); - request.addEventListener('load', function () { - if (request.status === 200) { - resolve(request.response); - } else { - reject(new Error("HTTP ".concat(request.status, " while fetching ").concat(url))); - } - }); - request.addEventListener('error', function () { - reject(new Error('HTTP request failed')); - }); - request.addEventListener('abort', function () { - reject(new Error('Loading aborted')); - }); - request.addEventListener('progress', function (event) { - _this2.dispatchEvent(event); - }); - request.open('GET', url); - - if (_this2._binary) { - request.responseType = 'arraybuffer'; - } else { - request.responseType = 'text'; - } - - request.send(); - }); + }; + getType = function (x) { + return Object.prototype.toString.call(x).slice('[object '.length, -1); + }; + validateNumber = function (n) { + if (isNaN(n)) throw 'NaN in Smooth() input'; + if (getType(n) !== 'Number') throw 'Non-number in Smooth() input'; + if (!isFinite(n)) throw 'Infinity in Smooth() input'; + }; + validateVector = function (v, dimension) { + var n, _i, _len; + if (getType(v) !== 'Array') throw 'Non-vector in Smooth() input'; + if (v.length !== dimension) throw 'Inconsistent dimension in Smooth() input'; + for (_i = 0, _len = v.length; _i < _len; _i++) { + n = v[_i]; + validateNumber(n); } - }], [{ - key: "canProbablyLoad", - value: function canProbablyLoad(source) { - return _.isString(source) && urlStartRegexp.test(source); + }; + isValidNumber = function (n) { + return getType(n) === 'Number' && isFinite(n) && !isNaN(n); + }; + normalizeScaleTo = function (s) { + var invalidErr; + invalidErr = "scaleTo param must be number or array of two numbers"; + switch (getType(s)) { + case 'Number': + if (!isValidNumber(s)) throw invalidErr; + s = [0, s]; + break; + case 'Array': + if (s.length !== 2) throw invalidErr; + if (!(isValidNumber(s[0]) && isValidNumber(s[1]))) throw invalidErr; + break; + default: + throw invalidErr; } - }, { - key: "extractName", - value: function extractName(source) { - if (source) { - var last = (source.indexOf('?') + 1 || source.lastIndexOf('#') + 1 || source.length + 1) - 1; - return source.slice(source.lastIndexOf('/', last) + 1, last); - } - - return undefined; + return s; + }; + shallowCopy = function (obj) { + var copy, k, v; + copy = {}; + for (k in obj) { + if (!__hasProp.call(obj, k)) continue; + v = obj[k]; + copy[k] = v; } - }]); - - return XHRLoader; -}(Loader); -XHRLoader.types = ['url']; - -var ImmediateLoader = /*#__PURE__*/function (_Loader) { - inherits(ImmediateLoader, _Loader); - - function ImmediateLoader() { - classCallCheck(this, ImmediateLoader); - - return possibleConstructorReturn(this, getPrototypeOf(ImmediateLoader).apply(this, arguments)); - } - - createClass(ImmediateLoader, [{ - key: "load", - value: function load() { - var _this = this; - - return new Promise(function (resolve) { - if (_this._abort) { - throw new Error('Loading aborted'); - } - - resolve(_this._source); - }); + return copy; + }; + Smooth = function (arr, config) { + var baseDomainEnd, dimension, i, interpolator, interpolatorClass, interpolators, k, n, properties, smoothFunc, v; + if (config == null) config = {}; + properties = {}; + config = shallowCopy(config); + properties.config = shallowCopy(config); + if (config.scaleTo == null) config.scaleTo = config.period; + if (config.sincFilterSize == null) { + config.sincFilterSize = config.lanczosFilterSize; } - }], [{ - key: "canProbablyLoad", - value: function canProbablyLoad(_source) { - return false; + for (k in defaultConfig) { + if (!__hasProp.call(defaultConfig, k)) continue; + v = defaultConfig[k]; + if (config[k] == null) config[k] = v; } - }]); - - return ImmediateLoader; -}(Loader); -ImmediateLoader.types = ['immediate']; - -var loaders = new LoaderList([// note: order might be important -FileLoader, XHRLoader, ImmediateLoader]); - -/** - * A list of available parsers. - * @extends EntityList - */ - -var ParserList = /*#__PURE__*/function (_EntityList) { - inherits(ParserList, _EntityList); - - /** - * Create a list of parsers. - * The parsers are indexed by supported data formats and file extensions (`.formats` and - * `.extensions` properties of a Parser subclass). - * The parsers can be retrieved later by matching against specs (see {@link ParsrerList#find}). - * - * @param {!Array=} someParsers A list of {@link Parser} subclasses to - * automatically register at creation time. - * @see ParserList#register - */ - function ParserList() { - var someParsers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - - classCallCheck(this, ParserList); - - return possibleConstructorReturn(this, getPrototypeOf(ParserList).call(this, someParsers, ['formats', 'extensions'])); - } - /** - * Find a suitable parser for data. - * - * @param {Object} specs Parser specifications. - * @param {string=} specs.format Supported data format. - * @param {string=} specs.ext Supported filename extension. - * @param {*=} specs.data Data to parse. - */ - - - createClass(ParserList, [{ - key: "find", - value: function find(specs) { - var list = []; - - if (specs.format) { - list = this._dict.formats[specs.format.toLowerCase()] || []; - } else if (specs.ext) { - list = this._dict.extensions[specs.ext.toLowerCase()] || []; - } // autodetect only if no format is forced - - - if (list.length === 0 && !specs.format && specs.data) { - return this._list.filter(function (SomeParser) { - return SomeParser.canProbablyParse && SomeParser.canProbablyParse(specs.data); - }); - } - - return toConsumableArray(list); + if (!(interpolatorClass = { + nearest: NearestInterpolator, + linear: LinearInterpolator, + cubic: CubicInterpolator, + lanczos: SincFilterInterpolator, + sinc: SincFilterInterpolator + }[config.method])) { + throw "Invalid method: " + config.method; } - }]); - - return ParserList; -}(EntityList); - -var Parser = /*#__PURE__*/function () { - function Parser(data, options) { - classCallCheck(this, Parser); - - this._data = data; - this._options = options || {}; - this._abort = false; - } - - createClass(Parser, [{ - key: "parseSync", - value: function parseSync() { - throw new Error('Parsing this type of data is not implemented'); + if (config.method === 'lanczos') { + config.sincWindow = makeLanczosWindow(config.sincFilterSize); } - }, { - key: "parse", - value: function parse() { - var _this = this; - - return new Promise(function (resolve, reject) { - setTimeout(function () { - try { - if (_this._abort) { - return reject(new Error('Parsing aborted')); + if (arr.length < 2) throw 'Array must have at least two elements'; + properties.count = arr.length; + smoothFunc = function () { + var _i, _j, _len, _len2; + switch (getType(arr[0])) { + case 'Number': + properties.dimension = 'scalar'; + if (Smooth.deepValidation) { + for (_i = 0, _len = arr.length; _i < _len; _i++) { + n = arr[_i]; + validateNumber(n); + } + } + interpolator = new interpolatorClass(arr, config); + return function (t) { + return interpolator.interpolate(t); + }; + case 'Array': + properties.dimension = dimension = arr[0].length; + if (!dimension) throw 'Vectors must be non-empty'; + if (Smooth.deepValidation) { + for (_j = 0, _len2 = arr.length; _j < _len2; _j++) { + v = arr[_j]; + validateVector(v, dimension); + } + } + interpolators = function () { + var _results; + _results = []; + for (i = 0; 0 <= dimension ? i < dimension : i > dimension; 0 <= dimension ? i++ : i--) { + _results.push(new interpolatorClass(getColumn(arr, i), config)); } - - return resolve(_this.parseSync()); - } catch (error) { - return reject(error); - } - }); - }); - } // only for volume Parsers - - }, { - key: "getModel", - value: function getModel() { - this.model._parseHeader(this._data); - - return this.model; + return _results; + }(); + return function (t) { + var interpolator, _k, _len3, _results; + _results = []; + for (_k = 0, _len3 = interpolators.length; _k < _len3; _k++) { + interpolator = interpolators[_k]; + _results.push(interpolator.interpolate(t)); + } + return _results; + }; + default: + throw "Invalid element type: " + getType(arr[0]); + } + }(); + if (config.clip === 'periodic') { + baseDomainEnd = arr.length; + } else { + baseDomainEnd = arr.length - 1; } - }, { - key: "abort", - value: function abort() { - this._abort = true; + config.scaleTo || (config.scaleTo = baseDomainEnd); + properties.domain = normalizeScaleTo(config.scaleTo); + smoothFunc = makeScaledFunction(smoothFunc, baseDomainEnd, properties.domain); + properties.domain.sort(); + /*copy properties + */ + for (k in properties) { + if (!__hasProp.call(properties, k)) continue; + v = properties[k]; + smoothFunc[k] = v; } - }]); - - return Parser; -}(); -makeContextDependent(Parser.prototype); - -/** - * Parser helper for PDB tag "REMARK 290". - * - * @exports Remark290 - * @constructor - */ - -var Remark290 = /*#__PURE__*/function () { - function Remark290() { - classCallCheck(this, Remark290); - - /** @type {THREE.Matrix4[]} */ - this.matrices = []; - /** @type {?THREE.Matrix4} */ - - this._matrix = null; - /** @type {number} */ - - this._matrixIndex = -1; + return smoothFunc; + }; + for (k in Enum) { + if (!__hasProp.call(Enum, k)) continue; + v = Enum[k]; + Smooth[k] = v; } - /** - * Parse a single line of a stream. - * @param {PDBStream} stream - stream to parse - */ - - - createClass(Remark290, [{ - key: "parse", - value: function parse(stream) { - /** @type {?THREE.Matrix4} */ - var matrix = this._matrix; - - if (stream.readString(12, 18) === ' SMTRY') { - var matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2 - - var matrixData = stream.readString(20, 80).trim().split(/\s+/); - var matrixIndex = parseInt(matrixData[0], 10); - - if (this._matrix === null || matrixIndex !== this._matrixIndex) { - // TODO: assert(matrixIndex === this.matrices.length + 1); - this._matrixIndex = matrixIndex; - this._matrix = matrix = new Matrix4(); - this.matrices[this.matrices.length] = matrix; - } - - var _matrix = matrix, - elements = _matrix.elements; - elements[matrixRow] = parseFloat(matrixData[1]); - elements[matrixRow + 4] = parseFloat(matrixData[2]); - elements[matrixRow + 8] = parseFloat(matrixData[3]); - elements[matrixRow + 12] = parseFloat(matrixData[4]); + Smooth.deepValidation = true; + ( true && exports !== null ? exports : window).Smooth = Smooth; +}).call(this); + +/***/ }), + +/***/ 660: +/***/ (function(module, exports) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!function (r, t) { + if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (t), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {} +}(this, function (r) { + "use strict"; + + function t(r, t, n) { + for (var e = (r.byteLength, 0), i = n.length; i > e; e++) { + var o = n.charCodeAt(e); + if (128 > o) r.setUint8(t++, o >>> 0 & 127 | 0);else if (2048 > o) r.setUint8(t++, o >>> 6 & 31 | 192), r.setUint8(t++, o >>> 0 & 63 | 128);else if (65536 > o) r.setUint8(t++, o >>> 12 & 15 | 224), r.setUint8(t++, o >>> 6 & 63 | 128), r.setUint8(t++, o >>> 0 & 63 | 128);else { + if (!(1114112 > o)) throw new Error("bad codepoint " + o); + r.setUint8(t++, o >>> 18 & 7 | 240), r.setUint8(t++, o >>> 12 & 63 | 128), r.setUint8(t++, o >>> 6 & 63 | 128), r.setUint8(t++, o >>> 0 & 63 | 128); + } + } + } + function n(r) { + for (var t = 0, n = 0, e = r.length; e > n; n++) { + var i = r.charCodeAt(n); + if (128 > i) t += 1;else if (2048 > i) t += 2;else if (65536 > i) t += 3;else { + if (!(1114112 > i)) throw new Error("bad codepoint " + i); + t += 4; + } + } + return t; + } + function e(r, i, o) { + var a = typeof r; + if ("string" === a) { + var u = n(r); + if (32 > u) return i.setUint8(o, 160 | u), t(i, o + 1, r), 1 + u; + if (256 > u) return i.setUint8(o, 217), i.setUint8(o + 1, u), t(i, o + 2, r), 2 + u; + if (65536 > u) return i.setUint8(o, 218), i.setUint16(o + 1, u), t(i, o + 3, r), 3 + u; + if (4294967296 > u) return i.setUint8(o, 219), i.setUint32(o + 1, u), t(i, o + 5, r), 5 + u; + } + if (r instanceof Uint8Array) { + var u = r.byteLength, + s = new Uint8Array(i.buffer); + if (256 > u) return i.setUint8(o, 196), i.setUint8(o + 1, u), s.set(r, o + 2), 2 + u; + if (65536 > u) return i.setUint8(o, 197), i.setUint16(o + 1, u), s.set(r, o + 3), 3 + u; + if (4294967296 > u) return i.setUint8(o, 198), i.setUint32(o + 1, u), s.set(r, o + 5), 5 + u; + } + if ("number" === a) { + if (!isFinite(r)) throw new Error("Number not finite: " + r); + if (Math.floor(r) !== r) return i.setUint8(o, 203), i.setFloat64(o + 1, r), 9; + if (r >= 0) { + if (128 > r) return i.setUint8(o, r), 1; + if (256 > r) return i.setUint8(o, 204), i.setUint8(o + 1, r), 2; + if (65536 > r) return i.setUint8(o, 205), i.setUint16(o + 1, r), 3; + if (4294967296 > r) return i.setUint8(o, 206), i.setUint32(o + 1, r), 5; + throw new Error("Number too big 0x" + r.toString(16)); + } + if (r >= -32) return i.setInt8(o, r), 1; + if (r >= -128) return i.setUint8(o, 208), i.setInt8(o + 1, r), 2; + if (r >= -32768) return i.setUint8(o, 209), i.setInt16(o + 1, r), 3; + if (r >= -2147483648) return i.setUint8(o, 210), i.setInt32(o + 1, r), 5; + throw new Error("Number too small -0x" + (-r).toString(16).substr(1)); + } + if (null === r) return i.setUint8(o, 192), 1; + if ("boolean" === a) return i.setUint8(o, r ? 195 : 194), 1; + if ("object" === a) { + var u, + f = 0, + c = Array.isArray(r); + if (c) u = r.length;else { + var d = Object.keys(r); + u = d.length; + } + var f; + if (16 > u ? (i.setUint8(o, u | (c ? 144 : 128)), f = 1) : 65536 > u ? (i.setUint8(o, c ? 220 : 222), i.setUint16(o + 1, u), f = 3) : 4294967296 > u && (i.setUint8(o, c ? 221 : 223), i.setUint32(o + 1, u), f = 5), c) for (var l = 0; u > l; l++) f += e(r[l], i, o + f);else for (var l = 0; u > l; l++) { + var v = d[l]; + f += e(v, i, o + f), f += e(r[v], i, o + f); } + return f; } - }]); - - return Remark290; -}(); - -Remark290.prototype.id = 290; - -var Assembly$1 = chem.Assembly; -/** - * Parser helper for PDB tag "REMARK 350". - * - * @exports Remark350 - * @constructor - */ - -var Remark350 = /*#__PURE__*/function () { - function Remark350(complex) { - classCallCheck(this, Remark350); - - /** @type {Complex} */ - this._complex = complex; - /** @type {Assembly[]} */ - - this.assemblies = []; - /** @type {?Assembly} */ - - this._assembly = null; - /** @type {?THREE.Matrix4} */ - - this._matrix = null; - /** @type {number} */ - - this._matrixIndex = -1; + throw new Error("Unknown type " + a); + } + function i(r) { + var t = typeof r; + if ("string" === t) { + var e = n(r); + if (32 > e) return 1 + e; + if (256 > e) return 2 + e; + if (65536 > e) return 3 + e; + if (4294967296 > e) return 5 + e; + } + if (r instanceof Uint8Array) { + var e = r.byteLength; + if (256 > e) return 2 + e; + if (65536 > e) return 3 + e; + if (4294967296 > e) return 5 + e; + } + if ("number" === t) { + if (Math.floor(r) !== r) return 9; + if (r >= 0) { + if (128 > r) return 1; + if (256 > r) return 2; + if (65536 > r) return 3; + if (4294967296 > r) return 5; + throw new Error("Number too big 0x" + r.toString(16)); + } + if (r >= -32) return 1; + if (r >= -128) return 2; + if (r >= -32768) return 3; + if (r >= -2147483648) return 5; + throw new Error("Number too small -0x" + r.toString(16).substr(1)); + } + if ("boolean" === t || null === r) return 1; + if ("object" === t) { + var e, + o = 0; + if (Array.isArray(r)) { + e = r.length; + for (var a = 0; e > a; a++) o += i(r[a]); + } else { + var u = Object.keys(r); + e = u.length; + for (var a = 0; e > a; a++) { + var s = u[a]; + o += i(s) + i(r[s]); + } + } + if (16 > e) return 1 + o; + if (65536 > e) return 3 + o; + if (4294967296 > e) return 5 + o; + throw new Error("Array or object too long 0x" + e.toString(16)); + } + throw new Error("Unknown type " + t); + } + function o(r) { + var t = new ArrayBuffer(i(r)), + n = new DataView(t); + return e(r, n, 0), new Uint8Array(t); + } + function a(r, t, n) { + return t ? new r(t.buffer, t.byteOffset, t.byteLength / (n || 1)) : void 0; + } + function u(r) { + return a(DataView, r); + } + function s(r) { + return a(Uint8Array, r); + } + function f(r) { + return a(Int8Array, r); + } + function c(r) { + return a(Int32Array, r, 4); + } + function d(r) { + return a(Float32Array, r, 4); + } + function l(r, t) { + var n = r.length / 2; + t || (t = new Int16Array(n)); + for (var e = 0, i = 0; n > e; ++e, i += 2) t[e] = r[i] << 8 ^ r[i + 1] << 0; + return t; + } + function v(r, t) { + var n = r.length; + t || (t = new Uint8Array(2 * n)); + for (var e = u(t), i = 0; n > i; ++i) e.setInt16(2 * i, r[i]); + return s(t); + } + function g(r, t) { + var n = r.length / 4; + t || (t = new Int32Array(n)); + for (var e = 0, i = 0; n > e; ++e, i += 4) t[e] = r[i] << 24 ^ r[i + 1] << 16 ^ r[i + 2] << 8 ^ r[i + 3] << 0; + return t; + } + function L(r, t) { + var n = r.length; + t || (t = new Uint8Array(4 * n)); + for (var e = u(t), i = 0; n > i; ++i) e.setInt32(4 * i, r[i]); + return s(t); + } + function h(r, t) { + var n = r.length; + t || (t = new Float32Array(n / 4)); + for (var e = u(t), i = u(r), o = 0, a = 0, s = n / 4; s > o; ++o, a += 4) e.setFloat32(a, i.getFloat32(a), !0); + return t; + } + function y(r, t, n) { + var e = r.length, + i = 1 / t; + n || (n = new Float32Array(e)); + for (var o = 0; e > o; ++o) n[o] = r[o] * i; + return n; + } + function m(r, t, n) { + var e = r.length; + n || (n = new Int32Array(e)); + for (var i = 0; e > i; ++i) n[i] = Math.round(r[i] * t); + return n; + } + function p(r, t) { + var n, e; + if (!t) { + var i = 0; + for (n = 0, e = r.length; e > n; n += 2) i += r[n + 1]; + t = new r.constructor(i); + } + var o = 0; + for (n = 0, e = r.length; e > n; n += 2) for (var a = r[n], u = r[n + 1], s = 0; u > s; ++s) t[o] = a, ++o; + return t; + } + function U(r) { + if (0 === r.length) return new Int32Array(); + var t, + n, + e = 2; + for (t = 1, n = r.length; n > t; ++t) r[t - 1] !== r[t] && (e += 2); + var i = new Int32Array(e), + o = 0, + a = 1; + for (t = 1, n = r.length; n > t; ++t) r[t - 1] !== r[t] ? (i[o] = r[t - 1], i[o + 1] = a, a = 1, o += 2) : ++a; + return i[o] = r[r.length - 1], i[o + 1] = a, i; + } + function b(r, t) { + var n = r.length; + t || (t = new r.constructor(n)), n && (t[0] = r[0]); + for (var e = 1; n > e; ++e) t[e] = r[e] + t[e - 1]; + return t; + } + function I(r, t) { + var n = r.length; + t || (t = new r.constructor(n)), t[0] = r[0]; + for (var e = 1; n > e; ++e) t[e] = r[e] - r[e - 1]; + return t; + } + function w(r, t) { + var n, + e, + i = r instanceof Int8Array ? 127 : 32767, + o = -i - 1, + a = r.length; + if (!t) { + var u = 0; + for (n = 0; a > n; ++n) r[n] < i && r[n] > o && ++u; + t = new Int32Array(u); + } + for (n = 0, e = 0; a > n;) { + for (var s = 0; r[n] === i || r[n] === o;) s += r[n], ++n; + s += r[n], ++n, t[e] = s, ++e; + } + return t; + } + function C(r, t) { + var n, + e = t ? 127 : 32767, + i = -e - 1, + o = r.length, + a = 0; + for (n = 0; o > n; ++n) { + var u = r[n]; + 0 === u ? ++a : a += u === e || u === i ? 2 : u > 0 ? Math.ceil(u / e) : Math.ceil(u / i); + } + var s = t ? new Int8Array(a) : new Int16Array(a), + f = 0; + for (n = 0; o > n; ++n) { + var u = r[n]; + if (u >= 0) for (; u >= e;) s[f] = e, ++f, u -= e;else for (; i >= u;) s[f] = i, ++f, u -= i; + s[f] = u, ++f; + } + return s; } - /** - * Parse a single line of a stream. - * @param {PDBStream} stream - stream to parse - */ - - - createClass(Remark350, [{ - key: "parse", - value: function parse(stream) { - /** @type {?Assembly} */ - var assembly = this._assembly; - /** @type {?THREE.Matrix4} */ - - var matrix = this._matrix; - - if (assembly && stream.readString(12, 18) === ' BIOMT') { - var matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2 - - var matrixData = stream.readString(20, 80).trim().split(/\s+/); - var matrixIndex = parseInt(matrixData[0], 10); - - if (this._matrix === null || matrixIndex !== this._matrixIndex) { - // TODO: assert(matrixIndex === assembly.matrices.length + 1); - this._matrixIndex = matrixIndex; - this._matrix = matrix = new Matrix4(); - assembly.addMatrix(matrix); + function A(r, t) { + return b(p(r), t); + } + function x(r) { + return U(I(r)); + } + function M(r, t, n) { + return y(p(r, c(n)), t, n); + } + function F(r, t) { + return U(m(r, t)); + } + function S(r, t, n) { + return y(b(r, c(n)), t, n); + } + function E(r, t, n) { + return I(m(r, t), n); + } + function N(r, t, n) { + return y(w(r, c(n)), t, n); + } + function O(r, t, n) { + var e = w(r, c(n)); + return S(e, t, d(e)); + } + function T(r, t, n) { + return C(E(r, t), n); + } + function k(r) { + var t = u(r), + n = t.getInt32(0), + e = t.getInt32(4), + i = r.subarray(8, 12), + r = r.subarray(12); + return [n, r, e, i]; + } + function j(r, t, n, e) { + var i = new ArrayBuffer(12 + e.byteLength), + o = new Uint8Array(i), + a = new DataView(i); + return a.setInt32(0, r), a.setInt32(4, t), n && o.set(n, 8), o.set(e, 12), o; + } + function q(r) { + var t = r.length, + n = s(r); + return j(2, t, void 0, n); + } + function D(r) { + var t = r.length, + n = L(r); + return j(4, t, void 0, n); + } + function P(r, t) { + var n = r.length / t, + e = L([t]), + i = s(r); + return j(5, n, e, i); + } + function z(r) { + var t = r.length, + n = L(U(r)); + return j(6, t, void 0, n); + } + function B(r) { + var t = r.length, + n = L(x(r)); + return j(8, t, void 0, n); + } + function V(r, t) { + var n = r.length, + e = L([t]), + i = L(F(r, t)); + return j(9, n, e, i); + } + function G(r, t) { + var n = r.length, + e = L([t]), + i = v(T(r, t)); + return j(10, n, e, i); + } + function R(r) { + var t = {}; + return rr.forEach(function (n) { + void 0 !== r[n] && (t[n] = r[n]); + }), r.bondAtomList && (t.bondAtomList = D(r.bondAtomList)), r.bondOrderList && (t.bondOrderList = q(r.bondOrderList)), t.xCoordList = G(r.xCoordList, 1e3), t.yCoordList = G(r.yCoordList, 1e3), t.zCoordList = G(r.zCoordList, 1e3), r.bFactorList && (t.bFactorList = G(r.bFactorList, 100)), r.atomIdList && (t.atomIdList = B(r.atomIdList)), r.altLocList && (t.altLocList = z(r.altLocList)), r.occupancyList && (t.occupancyList = V(r.occupancyList, 100)), t.groupIdList = B(r.groupIdList), t.groupTypeList = D(r.groupTypeList), r.secStructList && (t.secStructList = q(r.secStructList, 1)), r.insCodeList && (t.insCodeList = z(r.insCodeList)), r.sequenceIndexList && (t.sequenceIndexList = B(r.sequenceIndexList)), t.chainIdList = P(r.chainIdList, 4), r.chainNameList && (t.chainNameList = P(r.chainNameList, 4)), t; + } + function H(r) { + function t(r) { + for (var t = {}, n = 0; r > n; n++) { + var e = o(); + t[e] = o(); + } + return t; + } + function n(t) { + var n = r.subarray(a, a + t); + return a += t, n; + } + function e(t) { + var n = r.subarray(a, a + t); + a += t; + var e = 65535; + if (t > e) { + for (var i = [], o = 0; o < n.length; o += e) i.push(String.fromCharCode.apply(null, n.subarray(o, o + e))); + return i.join(""); + } + return String.fromCharCode.apply(null, n); + } + function i(r) { + for (var t = new Array(r), n = 0; r > n; n++) t[n] = o(); + return t; + } + function o() { + var o, + s, + f = r[a]; + if (0 === (128 & f)) return a++, f; + if (128 === (240 & f)) return s = 15 & f, a++, t(s); + if (144 === (240 & f)) return s = 15 & f, a++, i(s); + if (160 === (224 & f)) return s = 31 & f, a++, e(s); + if (224 === (224 & f)) return o = u.getInt8(a), a++, o; + switch (f) { + case 192: + return a++, null; + case 194: + return a++, !1; + case 195: + return a++, !0; + case 196: + return s = u.getUint8(a + 1), a += 2, n(s); + case 197: + return s = u.getUint16(a + 1), a += 3, n(s); + case 198: + return s = u.getUint32(a + 1), a += 5, n(s); + case 202: + return o = u.getFloat32(a + 1), a += 5, o; + case 203: + return o = u.getFloat64(a + 1), a += 9, o; + case 204: + return o = r[a + 1], a += 2, o; + case 205: + return o = u.getUint16(a + 1), a += 3, o; + case 206: + return o = u.getUint32(a + 1), a += 5, o; + case 208: + return o = u.getInt8(a + 1), a += 2, o; + case 209: + return o = u.getInt16(a + 1), a += 3, o; + case 210: + return o = u.getInt32(a + 1), a += 5, o; + case 217: + return s = u.getUint8(a + 1), a += 2, e(s); + case 218: + return s = u.getUint16(a + 1), a += 3, e(s); + case 219: + return s = u.getUint32(a + 1), a += 5, e(s); + case 220: + return s = u.getUint16(a + 1), a += 3, i(s); + case 221: + return s = u.getUint32(a + 1), a += 5, i(s); + case 222: + return s = u.getUint16(a + 1), a += 3, t(s); + case 223: + return s = u.getUint32(a + 1), a += 5, t(s); + } + throw new Error("Unknown type 0x" + f.toString(16)); + } + var a = 0, + u = new DataView(r.buffer); + return o(); + } + function W(r, t, n, e) { + switch (r) { + case 1: + return h(t); + case 2: + return f(t); + case 3: + return l(t); + case 4: + return g(t); + case 5: + return s(t); + case 6: + return p(g(t), new Uint8Array(n)); + case 7: + return p(g(t)); + case 8: + return A(g(t)); + case 9: + return M(g(t), g(e)[0]); + case 10: + return O(l(t), g(e)[0]); + case 11: + return y(l(t), g(e)[0]); + case 12: + return N(l(t), g(e)[0]); + case 13: + return N(f(t), g(e)[0]); + case 14: + return w(l(t)); + case 15: + return w(f(t)); + } + } + function X(r, t) { + t = t || {}; + var n = t.ignoreFields, + e = {}; + return nr.forEach(function (t) { + var i = n ? -1 !== n.indexOf(t) : !1, + o = r[t]; + i || void 0 === o || (o instanceof Uint8Array ? e[t] = W.apply(null, k(o)) : e[t] = o); + }), e; + } + function J(r) { + return String.fromCharCode.apply(null, r).replace(/\0/g, ""); + } + function K(r, t, n) { + n = n || {}; + var e, + i, + o, + a, + u, + s, + f = n.firstModelOnly, + c = t.onModel, + d = t.onChain, + l = t.onGroup, + v = t.onAtom, + g = t.onBond, + L = 0, + h = 0, + y = 0, + m = 0, + p = 0, + U = -1, + b = r.chainNameList, + I = r.secStructList, + w = r.insCodeList, + C = r.sequenceIndexList, + A = r.atomIdList, + x = r.bFactorList, + M = r.altLocList, + F = r.occupancyList, + S = r.bondAtomList, + E = r.bondOrderList; + for (e = 0, i = r.chainsPerModel.length; i > e && !(f && L > 0); ++e) { + var N = r.chainsPerModel[L]; + for (c && c({ + chainCount: N, + modelIndex: L + }), o = 0; N > o; ++o) { + var O = r.groupsPerChain[h]; + if (d) { + var T = J(r.chainIdList.subarray(4 * h, 4 * h + 4)), + k = null; + b && (k = J(b.subarray(4 * h, 4 * h + 4))), d({ + groupCount: O, + chainIndex: h, + modelIndex: L, + chainId: T, + chainName: k + }); } - - var _matrix = matrix, - elements = _matrix.elements; - elements[matrixRow] = parseFloat(matrixData[1]); - elements[matrixRow + 4] = parseFloat(matrixData[2]); - elements[matrixRow + 8] = parseFloat(matrixData[3]); - elements[matrixRow + 12] = parseFloat(matrixData[4]); - } else if (assembly && stream.readString(35, 41) === 'CHAINS:') { - var entries = stream.readString(42, 80).split(','); - - for (var i = 0, n = entries.length; i < n; ++i) { - var chain = entries[i].trim(); - - if (chain.length > 0) { - assembly.addChain(chain); + for (a = 0; O > a; ++a) { + var j = r.groupList[r.groupTypeList[y]], + q = j.atomNameList.length; + if (l) { + var D = null; + I && (D = I[y]); + var P = null; + r.insCodeList && (P = String.fromCharCode(w[y])); + var z = null; + C && (z = C[y]), l({ + atomCount: q, + groupIndex: y, + chainIndex: h, + modelIndex: L, + groupId: r.groupIdList[y], + groupType: r.groupTypeList[y], + groupName: j.groupName, + singleLetterCode: j.singleLetterCode, + chemCompType: j.chemCompType, + secStruct: D, + insCode: P, + sequenceIndex: z + }); + } + for (u = 0; q > u; ++u) { + if (v) { + var B = null; + A && (B = A[m]); + var V = null; + x && (V = x[m]); + var G = null; + M && (G = String.fromCharCode(M[m])); + var R = null; + F && (R = F[m]), v({ + atomIndex: m, + groupIndex: y, + chainIndex: h, + modelIndex: L, + atomId: B, + element: j.elementList[u], + atomName: j.atomNameList[u], + formalCharge: j.formalChargeList[u], + xCoord: r.xCoordList[m], + yCoord: r.yCoordList[m], + zCoord: r.zCoordList[m], + bFactor: V, + altLoc: G, + occupancy: R + }); + } + m += 1; + } + if (g) { + var H = j.bondAtomList; + for (u = 0, s = j.bondOrderList.length; s > u; ++u) g({ + atomIndex1: m - q + H[2 * u], + atomIndex2: m - q + H[2 * u + 1], + bondOrder: j.bondOrderList[u] + }); } + y += 1; } - } else if (stream.readString(12, 23) === 'BIOMOLECULE:') { - // assert molIndex === this.assemblies.length + 1 - this._matrix = null; - this._matrixIndex = -1; - this._assembly = assembly = new Assembly$1(this._complex); - this.assemblies.push(assembly); + h += 1; + } + if (p = U + 1, U = m - 1, g && S) for (u = 0, s = S.length; s > u; u += 2) { + var W = S[u], + X = S[u + 1]; + (W >= p && U >= W || X >= p && U >= X) && g({ + atomIndex1: W, + atomIndex2: X, + bondOrder: E ? E[u / 2] : null + }); } + L += 1; } - }]); - - return Remark350; -}(); - -Remark350.prototype.id = 350; - -/** Helper class for stream-like reading input files. */ -var PDBStream = /*#__PURE__*/function () { - /** - * Create a stream - * @param {String} data Input data - */ - function PDBStream(data) { - classCallCheck(this, PDBStream); - - /** @type String */ - this._data = data; // Input file - - /** @type Number */ - - this._start = 0; // Starting position of line - - /** @type Number */ - - this._nextCR = -1; // Position of next CR (0x0D) - - /** @type Number */ - - this._nextLF = -1; // Position of next LF (0x0A) - - /** @type Number */ - - this._next = -1; // End position of line - - /** @type Number */ - - this._end = data.length; // End of data - - this.next(); } - /** - * Reading next line. - * @returns {String} Next line in data (ending with LF or CR) - */ - - - createClass(PDBStream, [{ - key: "readLine", - value: function readLine() { - return this._data.slice(this._start, this._next); - } - /** - * Reading character from position. - * @param {Number} pos - Position in current line. - * @returns {String} Character from position - */ - - }, { - key: "readChar", - value: function readChar(pos) { - pos = this._start + pos - 1; - return pos < this._next ? this._data[pos] : ' '; - } - /** - * Reading character code from position. - * @param {Number} pos - Position in current line. - * @returns {Number} Character code from position - */ - - }, { - key: "readCharCode", - value: function readCharCode(pos) { - pos = this._start + pos - 1; - return pos < this._next ? this._data.charCodeAt(pos) : 32; - } - /** - * Reading string from begin to end points. - * For a reason unknown, numbering assumed not to start from 0, but from 1. - * @param {Number} begin - Begin point in current line. - * @param {Number} end - End point in current line. - * @returns {String} String from begin to end - */ - - }, { - key: "readString", - value: function readString(begin, end) { - var from = this._start + begin - 1; - var to = this._start + end; - return this._data.slice(from, to < this._next ? to : this._next); - } - /** - * Reading integer from begin to end points. - * @param {Number} begin - Begin point in current line. - * @param {Number} end - End point in current line. - * @returns {Number} Integer from begin to end - */ - - }, { - key: "readInt", - value: function readInt(begin, end) { - return parseInt(this.readString(begin, end), 10); - } - /** - * Reading float from begin to end points. - * @param {Number} begin - Begin point in current line. - * @param {Number} end - End point in current line. - * @returns {Number} Float from begin to end - */ - - }, { - key: "readFloat", - value: function readFloat(begin, end) { - return parseFloat(this.readString(begin, end)); - } - /** - * Checking for end of data. - * @returns {boolean} True if data is ended, false otherwise - */ - - }, { - key: "end", - value: function end() { - return this._start >= this._end; - } - /** - * Procedure to re-arrange current pointers in data. - */ - - }, { - key: "next", - value: function next() { - var start = this._next + 1; - this._start = start < this._end ? start : this._end; // support CR, LF, CR+LF line endings - // do not support LF+CR, CR+CR+LF, and other strange combinations - - if (this._start > this._nextCR) { - this._nextCR = (this._data.indexOf('\r', this._start) + 1 || this._end + 1) - 1; - } - - if (this._start > this._nextLF) { - this._nextLF = (this._data.indexOf('\n', this._start) + 1 || this._end + 1) - 1; + function Q(r) { + return o(R(r)); + } + function Y(r, t) { + r instanceof ArrayBuffer && (r = new Uint8Array(r)); + var n; + return n = r instanceof Uint8Array ? H(r) : r, X(n, t); + } + function Z(r, t, n, e) { + function i() { + try { + var r = Y(o.response); + n(r); + } catch (t) { + e(t); } - - this._next = this._nextCR + 1 < this._nextLF ? this._nextCR : this._nextLF; } - }]); - - return PDBStream; -}(); - -var Complex$1 = chem.Complex, - Element$2 = chem.Element, - Helix$1 = chem.Helix, - Sheet$1 = chem.Sheet, - Strand$1 = chem.Strand, - Bond$1 = chem.Bond, - Molecule$1 = chem.Molecule; -var TAG_LENGTH = 6; - -function nameToElement(name) { - // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM - // - // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1 - // - // Atom names start with element symbols right-justified in columns 13-14 - // as permitted by the length of the name. For example, the symbol FE for - // iron appears in columns 13-14, whereas the symbol C for carbon appears - // in column 14 (see Misaligned Atom Names). If an atom name has four - // characters, however, it must start in column 13 even if the element - // symbol is a single character (for example, see Hydrogen Atoms). - var veryLong = name.trim().length === 4; - return name.slice(0, veryLong ? 1 : 2).trim(); -} // the most frequently used beginnings; although HEADER is mandatory, it is often missing in handmade files - - -var pdbStartRegexp = /^(HEADER\s|COMPND\s|REMARK\s|ATOM {2}|HETATM|MODEL )/i; -var remarkParsers = { - // NOTE: please forget the idea to build the method name in runtime, it can be obfuscated. - 290: Remark290, - 350: Remark350 -}; - -var PDBParser = /*#__PURE__*/function (_Parser) { - inherits(PDBParser, _Parser); - - function PDBParser(data, options) { - var _this; - - classCallCheck(this, PDBParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(PDBParser).call(this, data, options)); - _this._complex = null; - _this._chain = null; - _this._residue = null; - _this._sheet = null; - _this._serialAtomMap = null; - _this._modelId = 1; - _this._compaundFound = false; - _this._biomoleculeFound = false; - _this._allowedChainsIDs = null; - _this._lastMolId = -1; - _this._remarks = {}; - _this._remark = null; - _this._molecules = []; - _this._molecule = null; - _this._compndCurrToken = ''; - _this._options.fileType = 'pdb'; - return _this; + var o = new XMLHttpRequest(); + o.addEventListener("load", i, !0), o.addEventListener("error", e, !0), o.responseType = "arraybuffer", o.open("GET", t + r.toUpperCase()), o.send(); } + function $(r, t, n) { + Z(r, or, t, n); + } + function _(r, t, n) { + Z(r, ar, t, n); + } + var rr = ["mmtfVersion", "mmtfProducer", "unitCell", "spaceGroup", "structureId", "title", "depositionDate", "releaseDate", "experimentalMethods", "resolution", "rFree", "rWork", "bioAssemblyList", "ncsOperatorList", "entityList", "groupList", "numBonds", "numAtoms", "numGroups", "numChains", "numModels", "groupsPerChain", "chainsPerModel"], + tr = ["xCoordList", "yCoordList", "zCoordList", "groupIdList", "groupTypeList", "chainIdList", "bFactorList", "atomIdList", "altLocList", "occupancyList", "secStructList", "insCodeList", "sequenceIndexList", "chainNameList", "bondAtomList", "bondOrderList"], + nr = rr.concat(tr), + er = "v1.1.0dev", + ir = "//mmtf.rcsb.org/v1.0/", + or = ir + "full/", + ar = ir + "reduced/"; + r.encode = Q, r.decode = Y, r.traverse = K, r.fetch = $, r.fetchReduced = _, r.version = er, r.fetchUrl = or, r.fetchReducedUrl = ar, r.encodeMsgpack = o, r.encodeMmtf = R, r.decodeMsgpack = H, r.decodeMmtf = X; +}); - createClass(PDBParser, [{ - key: "_finalize", - value: function _finalize() { - this._fixBondsArray(); - - this._fixChains(); // keep crystallographic symmetry transformations - - - var remark290 = this._remarks[290]; - this._complex.symmetry = _.isUndefined(remark290) ? [] : remark290.matrices; // add loaded biological assemblies - - var remark350 = this._remarks[350]; - this._complex.units = this._complex.units.concat(_.isUndefined(remark350) ? [] : remark350.assemblies); // add loaded macromolecules - - this._finalizeMolecules(); // create secondary structure etc. - - - this._complex.finalize({ - needAutoBonding: true, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - } - }, { - key: "_finalizeMolecules", - value: function _finalizeMolecules() { - // get chains from complex - var chainDict = {}; - var i; - var chains = this._complex._chains; - - for (i = 0; i < chains.length; ++i) { - var chainObj = chains[i]; - var chainName = chainObj._name; - chainDict[chainName] = chainObj; - } // aggregate residues from chains - - - for (i = 0; i < this._molecules.length; i++) { - var m = this._molecules[i]; - var residues = []; - - for (var j = 0; j < m._chains.length; j++) { - var name = m._chains[j]; - var chain = chainDict[name]; - residues = residues.concat(chain._residues.slice()); - } +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + A: () => (/* binding */ src) +}); - var molecule = new Molecule$1(this._complex, m._name, i + 1); - molecule.residues = residues; - this._complex._molecules[i] = molecule; +;// CONCATENATED MODULE: external {"module":"lodash","commonjs":"lodash","commonjs2":"lodash","amd":"lodash","root":"_"} +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +const external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject = x({ ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_lodash__["default"]) }); +;// CONCATENATED MODULE: external {"module":"three","commonjs":"three","commonjs2":"three","amd":"three","root":"THREE"} +const external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject = __WEBPACK_EXTERNAL_MODULE_three__; +;// CONCATENATED MODULE: ../../node_modules/spin.js/spin.js +var __assign = undefined && undefined.__assign || function () { + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var defaults = { + lines: 12, + length: 7, + width: 5, + radius: 10, + scale: 1.0, + corners: 1, + color: '#000', + fadeColor: 'transparent', + animation: 'spinner-line-fade-default', + rotate: 0, + direction: 1, + speed: 1, + zIndex: 2e9, + className: 'spinner', + top: '50%', + left: '50%', + shadow: '0 0 1px transparent', + // prevent aliased lines + position: 'absolute' +}; +var Spinner = /** @class */function () { + function Spinner(opts) { + if (opts === void 0) { + opts = {}; + } + this.opts = __assign(__assign({}, defaults), opts); + } + /** + * Adds the spinner to the given target element. If this instance is already + * spinning, it is automatically removed from its previous target by calling + * stop() internally. + */ + Spinner.prototype.spin = function (target) { + this.stop(); + this.el = document.createElement('div'); + this.el.className = this.opts.className; + this.el.setAttribute('role', 'progressbar'); + this.el.style.position = this.opts.position; + this.el.style.width = "0"; + this.el.style.zIndex = this.opts.zIndex.toString(); + this.el.style.left = this.opts.left; + this.el.style.top = this.opts.top; + this.el.style.transform = "scale(".concat(this.opts.scale, ")"); + if (target) { + target.insertBefore(this.el, target.firstChild || null); + } + drawLines(this.el, this.opts); + return this; + }; + /** + * Stops and removes the Spinner. + * Stopped spinners may be reused by calling spin() again. + */ + Spinner.prototype.stop = function () { + if (this.el) { + if (this.el.parentNode) { + this.el.parentNode.removeChild(this.el); } + this.el = undefined; } - }, { - key: "_fixChains", - value: function _fixChains() { - var idChainMap = {}; - var complex = this._complex; // prepare - - for (var i = 0; i < complex._chains.length; i++) { - var chain = complex._chains[i]; - idChainMap[chain._name.charCodeAt(0)] = chain; - } - } // FIXME: This function is redundant, CONECT records always follow ATOM and HETATM. Build the map online. + return this; + }; + return Spinner; +}(); - }, { - key: "_fixBondsArray", - value: function _fixBondsArray() { - var serialAtomMap = this._serialAtomMap = {}; - var complex = this._complex; - var atoms = complex._atoms; +/** + * Returns the line color from the given string or array. + */ +function getColor(color, idx) { + return typeof color == 'string' ? color : color[idx % color.length]; +} +/** + * Internal method that draws the individual lines. + */ +function drawLines(el, opts) { + var borderRadius = Math.round(opts.corners * opts.width * 500) / 1000 + 'px'; + var shadow = 'none'; + if (opts.shadow === true) { + shadow = '0 2px 4px #000'; // default shadow + } else if (typeof opts.shadow === 'string') { + shadow = opts.shadow; + } + var shadows = parseBoxShadow(shadow); + for (var i = 0; i < opts.lines; i++) { + var degrees = ~~(360 / opts.lines * i + opts.rotate); + var backgroundLine = document.createElement('div'); + backgroundLine.style.position = 'absolute'; + backgroundLine.style.top = "".concat(-opts.width / 2, "px"); + backgroundLine.style.width = opts.length + opts.width + 'px'; + backgroundLine.style.height = opts.width + 'px'; + backgroundLine.style.background = getColor(opts.fadeColor, i); + backgroundLine.style.borderRadius = borderRadius; + backgroundLine.style.transformOrigin = 'left'; + backgroundLine.style.transform = "rotate(".concat(degrees, "deg) translateX(").concat(opts.radius, "px)"); + var delay = i * opts.direction / opts.lines / opts.speed; + delay -= 1 / opts.speed; // so initial animation state will include trail + var line = document.createElement('div'); + line.style.width = '100%'; + line.style.height = '100%'; + line.style.background = getColor(opts.color, i); + line.style.borderRadius = borderRadius; + line.style.boxShadow = normalizeShadow(shadows, degrees); + line.style.animation = "".concat(1 / opts.speed, "s linear ").concat(delay, "s infinite ").concat(opts.animation); + backgroundLine.appendChild(line); + el.appendChild(backgroundLine); + } +} +function parseBoxShadow(boxShadow) { + var regex = /^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/; + var shadows = []; + for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) { + var shadow = _a[_i]; + var matches = shadow.match(regex); + if (matches === null) { + continue; // invalid syntax + } + var x = +matches[2]; + var y = +matches[5]; + var xUnits = matches[4]; + var yUnits = matches[7]; + if (x === 0 && !xUnits) { + xUnits = yUnits; + } + if (y === 0 && !yUnits) { + yUnits = xUnits; + } + if (xUnits !== yUnits) { + continue; // units must match to use as coordinates + } + shadows.push({ + prefix: matches[1] || '', + // could have value of 'inset' or undefined + x: x, + y: y, + xUnits: xUnits, + yUnits: yUnits, + end: matches[8] + }); + } + return shadows; +} +/** + * Modify box-shadow x/y offsets to counteract rotation + */ +function normalizeShadow(shadows, degrees) { + var normalized = []; + for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) { + var shadow = shadows_1[_i]; + var xy = convertOffset(shadow.x, shadow.y, degrees); + normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end); + } + return normalized.join(', '); +} +function convertOffset(x, y, degrees) { + var radians = degrees * Math.PI / 180; + var sin = Math.sin(radians); + var cos = Math.cos(radians); + return [Math.round((x * cos + y * sin) * 1000) / 1000, Math.round((-x * sin + y * cos) * 1000) / 1000]; +} +;// CONCATENATED MODULE: ./src/Timer.js +//---------------------------------------------------------------------------- +// Timer - for (var i = 0, ni = atoms.length; i < ni; ++i) { - var atom = atoms[i]; - serialAtomMap[atom.serial] = atom; - } +class Timer { + constructor() { + this.startTime = 0; + this.oldTime = 0; + this.elapsedTime = 0; + this.running = false; + } + start() { + this.startTime = Timer.now(); + this.oldTime = this.startTime; + this.running = true; + } + stop() { + this.getElapsedTime(); + this.running = false; + } + getElapsedTime() { + this.update(); + return this.elapsedTime; + } + update() { + let delta = 0; + if (this.running) { + const newTime = Timer.now(); + delta = 0.001 * (newTime - this.oldTime); + this.oldTime = newTime; + this.elapsedTime += delta; + } + return delta; + } +} +Timer.now = function () { + const p = typeof window !== 'undefined' && window.performance; + return p && p.now ? p.now.bind(p) : Date.now; +}(); +;// CONCATENATED MODULE: ./src/gfx/Stats.js - var bonds = complex._bonds; - var logger = this.logger; +const { + now +} = Timer; +function createElement(tag, id, css) { + const element = document.createElement(tag); + element.id = id; + element.style.cssText = css; + return element; +} +class Stats { + constructor() { + this.domElement = createElement('div', 'stats', 'padding:8px'); + this._text = createElement('p', 'fps', 'margin:0;color:silver;font-size:large'); + this.domElement.appendChild(this._text); + this._startTime = now(); + this._prevTime = this._startTime; + this._deltas = new Array(20); + this._index = 0; + this._total = 0.0; + this._count = 0; + } + end() { + const time = now(); + const delta = time - this._startTime; + if (this._count < this._deltas.length) { + this._count++; + } else { + this._total -= this._deltas[this._index]; + } + this._total += delta; + this._deltas[this._index] = delta; + this._index = (this._index + 1) % this._deltas.length; + this.ms = this._total / this._count; + this.fps = 1000 / this.ms; + if (time > this._prevTime + 1000) { + this._text.textContent = this.fps.toPrecision(2); + this._prevTime = time; + } + return time; + } + update() { + this._startTime = this.end(); + } + show(on) { + if (on === undefined) { + on = true; + } + this.domElement.style.display = on ? 'block' : 'none'; + } +} +/* harmony default export */ const gfx_Stats = (Stats); +;// CONCATENATED MODULE: ./src/utils/EventDispatcher.js +/** + * This class introduces the simplest event system. + */ - for (var j = 0, nj = bonds.length; j < nj; ++j) { - var bond = bonds[j]; - if (bond._right < bond._left) { - logger.debug('_fixBondsArray: Logic error.'); - } +function isUndefOrEqual(param, value) { + return !param || param === value; +} - bond._left = serialAtomMap[bond._left] || null; - bond._right = serialAtomMap[bond._right] || null; - } - } - }, { - key: "_parseATOM", - value: function _parseATOM(stream) { - if (this._modelId !== 1) { - return; - } - /* eslint-disable no-magic-numbers */ - - - var het = stream.readCharCode(1) === 0x48; // field names according to wwPDB Format - // NOTE: Chimera allows (nonstandard) use of columns 6-11 for the integer atom serial number in ATOM records. - - var serial = het ? stream.readInt(7, 11) : stream.readInt(6, 11); - var name = stream.readString(13, 16); - var altLoc = stream.readChar(17); - var resName = stream.readString(18, 20).trim(); - var chainID = stream.readChar(22); - var resSeq = stream.readInt(23, 26); - var iCode = stream.readChar(27); - var x = stream.readFloat(31, 38); - var y = stream.readFloat(39, 46); - var z = stream.readFloat(47, 54); - var occupancy = stream.readFloat(55, 60); - var tempFactor = stream.readFloat(61, 66); - var element = stream.readString(77, 78).trim() || nameToElement(name); - var charge = stream.readInt(79, 80) || 0; - /* eslint-enable no-magic-numbers */ - // skip waters (there may be lots of them) - - if (this.settings.now.nowater) { - if (resName === 'HOH' || resName === 'WAT') { - return; - } - } // PDB uses positional system for atom names. It helps derive element type from the name - // but names may include extra spaces. From this point on we don't need those spaces anymore. +/** + * Creates empty dispatcher. + * + * @exports EventDispatcher + * @constructor + */ +function EventDispatcher() { + this._handlers = {}; +} +/** + * Binds callback on specific event type. Optional `context` parameter + * could be used as 'this' for the `callback`. + * @param {string} type Event name. + * @param {function} callback Callback function. + * @param {Object} [context] 'This' object for the callback. + */ +EventDispatcher.prototype.addEventListener = function (type, callback, context) { + let handlers = this._handlers[type]; + if (!handlers) { + this._handlers[type] = []; + handlers = this._handlers[type]; + } + const params = [callback, context]; + function _checkPar(par) { + return par[0] === params[0] && par[1] === params[1]; + } + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].find(handlers, _checkPar) === undefined) { + handlers.push(params); + } +}; - name = name.trim(); - var type = Element$2.getByName(element); - var role = Element$2.Role[name]; // FIXME: Maybe should use type as additional index (" CA " vs. "CA ") - // NOTE: Residues of a particular chain are not required to be listed next to each other. - // https://github.com/biasmv/pv/commit/7319b898b7473ba380c26699e3b028b2b1a7e1a1 +/** + * Removes a previously-bound callback function from an object. + * If no `context` is specified, all versions of the `callback` with different + * contexts will be removed. + * If no `callback` is specified, all callbacks of the `type` will be removed. + * If no `type` is specified, callbacks for all events will be removed. + * @param {?string} [type] Event type. + * @param {function} [callback] Callback function. + * @param {Object} [context] 'This' object for the callback. + */ +EventDispatcher.prototype.removeEventListener = function (type, callback, context) { + const self = this; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].forEach(self._handlers, (handler, ev) => { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].remove(handler, values => isUndefOrEqual(type, ev) && isUndefOrEqual(callback, values[0]) && isUndefOrEqual(context, values[1] || self)); + }); + this._handlers = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].omitBy(self._handlers, handler => handler.length === 0); +}; - var chain = this._chain; +/** + * Makes all the callbacks for the specific `event` to trigger. + * @param {Object} event Event. + * @param {string} event.type Type of the event. + */ +EventDispatcher.prototype.dispatchEvent = function (event) { + const self = this; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].forEach(this._handlers[event.type], callback => { + const context = callback[1] || self; + callback[0].apply(context, [event]); + }); +}; +/* harmony default export */ const utils_EventDispatcher = (EventDispatcher); +;// CONCATENATED MODULE: ./src/utils/logger.js +/** + * This module contains class for logging. + * Returns an instance of a logger that have already been created. + * Allows users to log messages for five different levels, + * enable console output and catch signal on each message. + */ - if (!chain || chain.getName() !== chainID) { - this._chain = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); - this._residue = null; - } - var residue = this._residue; +const priorities = { + debug: 0, + info: 1, + report: 2, + warn: 3, + error: 4 +}; - if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { - this._residue = residue = chain.addResidue(resName, resSeq, iCode); - } +/** + * Create new Logger. + * + * @exports Logger + * @extends EventDispatcher + * @constructor + */ +function Logger() { + utils_EventDispatcher.call(this); + /** Boolean flag that toggles output to browser console. + * @type {boolean} + */ + this.console = false; + this._priority = priorities.warn; +} +Logger.prototype = Object.create(utils_EventDispatcher.prototype); +Logger.prototype.constructor = Logger; - var xyz = new Vector3(x, y, z); - residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); - } - }, { - key: "_parseENDMDL", - value: function _parseENDMDL() { - this._modelId += 1; - } - }, { - key: "_parseCONECT", - value: function _parseCONECT(stream) { - /* eslint-disable no-magic-numbers */ - var serial0 = stream.readInt(7, 11); - var serial1 = stream.readInt(12, 16); - var serial2 = stream.readInt(17, 21); - var serial3 = stream.readInt(22, 26); - var serial4 = stream.readInt(27, 31); - /* eslint-enable no-magic-numbers */ +/** + * Create new clean instance of the logger. + * @returns {Logger} + */ +Logger.prototype.instantiate = function () { + return new Logger(); +}; +function verify(number) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isNumber(number)) { + throw new Error('Wrong log level specified!'); + } + return number; +} - var complex = this._complex; // Keep bonds ordered by atom serial +/** + * @property {string} current threshold for signals and console output. + * @name Logger#level + */ +Object.defineProperty(Logger.prototype, 'level', { + get() { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].findKey(priorities, value => value === this._priority); + }, + set(level) { + this._priority = verify(priorities[level]); + } +}); - if (serial1 && serial1 > serial0) { - complex.addBond(serial0, serial1, 0, Bond$1.BondType.UNKNOWN, true); - } +/** + * Returns the list of all possible level values. + * @returns {Array} + */ +Logger.prototype.levels = function () { + return Object.keys(priorities); +}; - if (serial2 && serial2 > serial0) { - complex.addBond(serial0, serial2, 0, Bond$1.BondType.UNKNOWN, true); - } +/** + * Add new message with specified level. + * @param {string} level - level of the message, must be one of the + * {'debug' | 'info' | 'report' | 'warn' | 'error'} + * @param {string} message + */ +Logger.prototype.message = function (level, message) { + const priority = verify(priorities[level]); + this._message(priority, message); +}; - if (serial3 && serial3 > serial0) { - complex.addBond(serial0, serial3, 0, Bond$1.BondType.UNKNOWN, true); - } +/** + * Shortcut for message('debug', ...); + * @param message + */ +Logger.prototype.debug = function (message) { + this._message(priorities.debug, message); +}; - if (serial4 && serial4 > serial0) { - complex.addBond(serial0, serial4, 0, Bond$1.BondType.UNKNOWN, true); - } - } - }, { - key: "_parseCOMPND", - value: function _parseCOMPND(stream) { - /* eslint-disable no-magic-numbers */ - var str = stream.readString(11, 80); - var tokenIdx = str.indexOf(':'); - this._compndCurrToken = tokenIdx > 0 ? str.substring(0, tokenIdx).trim() : this._compndCurrToken; - /* eslint-enable no-magic-numbers */ - // start reading new molecule - - if (this._compndCurrToken === 'MOL_ID') { - this._molecule = { - _index: '', - _chains: [] - }; - this._molecule._index = parseInt(str.substring(tokenIdx + 1, str.indexOf(';')), 10); +/** + * Shortcut for message('info', ...); + * @param message + */ +Logger.prototype.info = function (message) { + this._message(priorities.info, message); +}; - this._molecules.push(this._molecule); // parse molecule name +/** + * Shortcut for message('report', ...); + * @param message + */ +Logger.prototype.report = function (message) { + this._message(priorities.report, message); +}; - } else if (this._compndCurrToken === 'MOLECULE' && this._molecule != null) { - this._molecule._name = str.substring(tokenIdx + 1, str.indexOf(';')).trim(); // parse molecule chains - } else if (this._compndCurrToken === 'CHAIN' && this._molecule != null) { - var chainStr = str.substring(tokenIdx + 1, 80).trim(); - var lastChar = chainStr[chainStr.length - 1]; +/** + * Shortcut for message('warn', ...); + * @param message + */ +Logger.prototype.warn = function (message) { + this._message(priorities.warn, message); +}; - if (lastChar === ';' || lastChar === ',') { - chainStr = chainStr.slice(0, -1); - } +/** + * Shortcut for message('error', ...); + * @param message + */ +Logger.prototype.error = function (message) { + this._message(priorities.error, message); +}; - chainStr = chainStr.replace(/\s+/g, ''); - var chains = chainStr.split(','); - this._molecule._chains = this._molecule._chains.concat(chains); - } +/** + * Add new message with specified priority. + * @param {number} priority - priority of the message + * @param {string} message + * @private + */ +Logger.prototype._message = function (priority, message) { + if (priority < this._priority) { + return; + } + const level = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].findKey(priorities, value => value === priority); + message = String(message); + if (this.console) { + const output = `miew:${level}: ${message}`; + if (level === 'error') { + console.error(output); // NOSONAR + } else if (level === 'warn') { + console.warn(output); // NOSONAR + } else { + console.log(output); // NOSONAR } - }, { - key: "_parseREMARK", - value: function _parseREMARK(stream) { - /* eslint-disable no-magic-numbers */ - var remarkNum = stream.readInt(8, 10); - /* eslint-enable no-magic-numbers */ - // create remark parser if needed + } + this.dispatchEvent({ + type: 'message', + level, + message + }); +}; +/* harmony default export */ const logger = (new Logger()); +;// CONCATENATED MODULE: ./src/utils.js + - var remark = this._remarks[remarkNum]; +const browserType = { + DEFAULT: 0, + SAFARI: 1 +}; +//---------------------------------------------------------------------------- +// Query string - if (_.isUndefined(remark)) { - var RemarkParser = remarkParsers[remarkNum]; +/** + * Escape only dangerous chars in a query string component, use a plus instead of a space. + * + * [RFC 3986](https://tools.ietf.org/html/rfc3986) allows the following chars in the query (see 3.4): + * + * A-Z a-z 0-9 - _ . ~ ! $ & ' ( ) * + , ; = : @ / ? + * + * For query string elements we need to escape ampersand, equal sign, and plus, + * but encodeURIComponent() function encodes anything except for the following: + * + * A-Z a-z 0-9 - _ . ~ ! ' ( ) * + * + * @param {string} text - key or value to encode + * @param {string} excludeExp - regexp for symbols to exclude from encoding + * @returns {string} encoded string + */ +function encodeQueryComponent(text, excludeExp) { + const encode = code => String.fromCharCode(parseInt(code.substr(1), 16)); + return encodeURIComponent(text).replace(excludeExp, encode).replace(/%20/g, '+'); +} - if (_.isFunction(RemarkParser)) { - this._remarks[remarkNum] = remark = new RemarkParser(this._complex); - } - } // delegate parsing +/** + * Unescape dangerous chars in a query string component. + * + * @param {string} text - encoded key or value + * @returns {string} decoded string + * @see {@link encodeQueryComponent} + */ +function decodeQueryComponent(text) { + return decodeURIComponent(text.replace(/\+/g, ' ')); +} +/** + * Parse URL and extract an array of parameters. + * @param {string?} url - URL or query string to parse + * @returns {Array} array of (key, value) pairs. + */ +function getUrlParameters(url) { + url = url || window.location.search; + const query = url.substring(url.indexOf('?') + 1); + const search = /([^&=]+)=?([^&]*)/g; + const result = []; + let match; + while ((match = search.exec(query)) !== null) { + // eslint-disable-line no-cond-assign + result.push([decodeQueryComponent(match[1]), decodeQueryComponent(match[2])]); + } + return result; +} - if (!_.isUndefined(remark)) { - remark.parse(stream); +/** + * Parse URL and extract an array of parameters as a hash. + * @param {string?} url - URL or query string to parse + * @returns {Object} + */ +function getUrlParametersAsDict(url) { + const result = {}; + const a = getUrlParameters(url); + for (let i = 0; i < a.length; ++i) { + const [key, value] = a[i]; + result[key] = value; + } + return result; +} +function resolveURL(str) { + if (typeof URL !== 'undefined') { + try { + if (typeof window !== 'undefined') { + return new URL(str, window.location).href; } + return new URL(str).href; + } catch (error) { + // IE 11 has a URL object with no constructor available so just try a different approach instead } - }, { - key: "_parseHELIX", - value: function _parseHELIX(stream) { - var _this2 = this; + } + if (typeof document !== 'undefined') { + const anchor = document.createElement('a'); + anchor.href = str; + return anchor.href; + } + return str; +} - /* eslint-disable no-magic-numbers */ - var fields = [20, 22, 32, 34]; - /* eslint-enable no-magic-numbers */ +/** + * Generates regular expression object that includes all symbols + * listed in the argument + * @param symbolStr {string} - String containing characters list. + * @returns {RegExp} - Regular expression. + */ +function generateRegExp(symbolStr) { + const symbolList = []; + for (let i = 0, n = symbolStr.length; i < n; ++i) { + symbolList[symbolList.length] = symbolStr[i].charCodeAt(0).toString(16); + } + const listStr = symbolList.join('|'); + return new RegExp(`%(?:${listStr})`, 'gi'); +} - this._parseSTRUCTURE(stream, fields, function (obj) { - _this2._complex.addHelix(obj); +//---------------------------------------------------------------------------- +// Create HTML element - _this2._complex.structures.push(obj); - }); +function utils_createElement(tag, attrs, content) { + const element = document.createElement(tag); + let i; + let n; + if (attrs) { + const keys = Object.keys(attrs); + for (i = 0, n = keys.length; i < n; ++i) { + const key = keys[i]; + element.setAttribute(key, attrs[key]); } - }, { - key: "_parseSHEET", - value: function _parseSHEET(stream) { - var _this3 = this; - - /* eslint-disable no-magic-numbers */ - var fields = [22, 23, 33, 34]; - /* eslint-enable no-magic-numbers */ - - this._parseSTRUCTURE(stream, fields, function (obj) { - _this3._complex.addSheet(obj); - }); + } + if (content) { + if (!(content instanceof Array)) { + content = [content]; } - }, { - key: "_parseSTRUCTURE", - value: function _parseSTRUCTURE(stream, pars, adder) { - var startId = 0; - var startIndex = 1; - var endId = 2; - var endIndex = 3; // identify fields: debugging and stuff - - /* eslint-disable no-magic-numbers */ - - var codeOfS = 0x53; - var serialNumber = stream.readInt(8, 10); - var structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim() - - var comment = stream.readString(41, 70).trim(); - var helLength = stream.readInt(72, 76); - var helixClass = stream.readInt(39, 40); - var shWidth = stream.readInt(15, 16); - var shCur = stream.readInt(42, 45); - var shPrev = stream.readInt(57, 60); - /* eslint-enable no-magic-numbers */ - // file fields - - var startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0); - var endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0); - var startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3); - var iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4); - var startICode = 0; - - if (iCodeStr.length > 0) { - startICode = iCodeStr.charCodeAt(0); - } - - var endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3); - iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4); - var endICode = 0; - - if (iCodeStr.length > 0) { - endICode = iCodeStr.charCodeAt(0); + for (i = 0, n = content.length; i < n; ++i) { + const child = content[i]; + if (typeof child === 'string') { + element.appendChild(document.createTextNode(child)); + } else if (child instanceof HTMLElement) { + element.appendChild(child); } + } + } + return element; +} - var obj; - var cs = this._sheet; - - if (stream.readCharCode(1) === codeOfS) { - if (cs !== null && cs.getName() !== structureName) { - cs = null; - this._sheet = null; - } +//---------------------------------------------------------------------------- +// Easy inheritance - if (cs === null) { - this._sheet = obj = new Sheet$1(structureName, shWidth); - adder(obj); - } else { - obj = cs; - } +/** + * Derive the class from the base. + * @param cls {function} - Class (constructor) to derive. + * @param base {function} - Class (constructor) to derive from. + * @param members {object=} - Optional instance members to add. + * @param statics {object=} - Optional static class members to add. + * @returns {function} Original class. + */ +function deriveClass(cls, base, members, statics) { + cls.prototype = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].assign(Object.create(base.prototype), { + constructor: cls + }, members); + if (statics) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].assign(cls, statics); + } + return cls; +} - var strand = new Strand$1(obj, this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode), this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode), helixClass, shCur, shPrev); - obj.addStrand(strand); +//---------------------------------------------------------------------------- +// Deep prototyping - this._complex.structures.push(strand); - } else { - obj = new Helix$1(helixClass, this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode), this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode), serialNumber, structureName, comment, helLength); - adder(obj); - } +function deriveDeep(obj, needZeroOwnProperties) { + let res = obj; + let i; + let n; + if (obj instanceof Array) { + res = new Array(obj.length); + for (i = 0, n = obj.length; i < n; ++i) { + res[i] = deriveDeep(obj[i]); } - }, { - key: "_parseHEADER", - value: function _parseHEADER(stream) { - var metadata = this._complex.metadata; - metadata.classification = stream.readString(11, 50).trim(); - metadata.date = stream.readString(51, 59).trim(); - var id = stream.readString(63, 66).trim(); - metadata.id = id; - - if (id) { - this._complex.name = id; + } else if (obj instanceof Object) { + res = Object.create(obj); + const keys = Object.keys(obj); + for (i = 0, n = keys.length; i < n; ++i) { + const key = keys[i]; + const value = obj[key]; + const copy = deriveDeep(value); + if (copy !== value) { + res[key] = copy; } - - metadata.format = 'pdb'; } - }, { - key: "_parseTITLE", - value: function _parseTITLE(stream) { - var metadata = this._complex.metadata; - metadata.title = metadata.title || []; - var line = stream.readInt(9, 10) || 1; - metadata.title[line - 1] = stream.readString(11, 80).trim(); + if (needZeroOwnProperties && Object.keys(res).length > 0) { + res = Object.create(res); } - }, { - key: "parseSync", - value: function parseSync() { - var stream = new PDBStream(this._data); - var result = this._complex = new Complex$1(); // parse PDB line by line - - while (!stream.end()) { - var tag = stream.readString(1, TAG_LENGTH); - var func = PDBParser.tagParsers[tag]; - - if (_.isFunction(func)) { - func.call(this, stream); - } - - stream.next(); - } // Resolve indices and serials to objects - + } + return res; +} - this._finalize(); // cleanup +//---------------------------------------------------------------------------- +// Colors +function hexColor(color) { + const hex = `0000000${color.toString(16)}`.substr(-6); + return `#${hex}`; +} - this._serialAtomMap = null; - this._sheet = null; - this._residue = null; - this._chain = null; - this._complex = null; +//---------------------------------------------------------------------------- +// Debug tracing - if (result.getAtomCount() === 0) { - throw new Error('The data does not contain valid atoms'); +function DebugTracer(namespace) { + let enabled = false; + this.enable = function (on) { + enabled = on; + }; + let indent = 0; + const methods = Object.keys(namespace); + function wrap(method_, name_) { + return function () { + const spaces = DebugTracer.spaces.substr(0, indent * 2); + if (enabled) { + logger.debug(`${spaces + name_} {`); + } + indent++; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + const result = method_.apply(this, args); // eslint-disable-line no-invalid-this + indent--; + if (enabled) { + logger.debug(`${spaces}} // ${name_}`); } - return result; + }; + } + for (let i = 0, n = methods.length; i < n; ++i) { + const name = methods[i]; + const method = namespace[name]; + if (method instanceof Function && name !== 'constructor') { + namespace[name] = wrap(method, name); } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && pdbStartRegexp.test(data); - } - }]); - - return PDBParser; -}(Parser); - -defineProperty(PDBParser, "tagParsers", { - HEADER: PDBParser.prototype._parseHEADER, - 'TITLE ': PDBParser.prototype._parseTITLE, - 'ATOM ': PDBParser.prototype._parseATOM, - HETATM: PDBParser.prototype._parseATOM, - ENDMDL: PDBParser.prototype._parseENDMDL, - CONECT: PDBParser.prototype._parseCONECT, - COMPND: PDBParser.prototype._parseCOMPND, - REMARK: PDBParser.prototype._parseREMARK, - // 'SOURCE': PDBParser.prototype._parseSOURCE, - 'HELIX ': PDBParser.prototype._parseHELIX, - 'SHEET ': PDBParser.prototype._parseSHEET, - // nonstandard extension to allow range 100,000 - 999,999 - 'ATOM 1': PDBParser.prototype._parseATOM, - 'ATOM 2': PDBParser.prototype._parseATOM, - 'ATOM 3': PDBParser.prototype._parseATOM, - 'ATOM 4': PDBParser.prototype._parseATOM, - 'ATOM 5': PDBParser.prototype._parseATOM, - 'ATOM 6': PDBParser.prototype._parseATOM, - 'ATOM 7': PDBParser.prototype._parseATOM, - 'ATOM 8': PDBParser.prototype._parseATOM, - 'ATOM 9': PDBParser.prototype._parseATOM -}); - -PDBParser.formats = ['pdb']; -PDBParser.extensions = ['.pdb', '.ent']; - -var Complex$2 = chem.Complex, - Element$3 = chem.Element, - SGroup$1 = chem.SGroup, - Bond$2 = chem.Bond; -var cOrderCharCodes = { - A: 0, - S: 1, - D: 2, - T: 3 -}; -var cmlStartRegexp = /\s*<\?xml\b[^?>]*\?>\s*<(?:cml|molecule)\b/i; - -var CMLParser = /*#__PURE__*/function (_Parser) { - inherits(CMLParser, _Parser); - - function CMLParser(data, options) { - var _this; - - classCallCheck(this, CMLParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(CMLParser).call(this, data, options)); - _this._complex = null; - _this._residue = null; - _this._serialAtomMap = null; - _this._modelId = 1; - _this._lastMolId = -1; - _this._readOnlyOneMolecule = false; - _this._options.fileType = 'cml'; - return _this; } - - createClass(CMLParser, [{ - key: "_rebuidBondIndexes", - value: function _rebuidBondIndexes(atoms, bonds) { - var count = atoms.length; - - for (var i = 0; i < count; i++) { - var atomId = atoms[i].id; - var countBonds = bonds.length; - - for (var j = 0; j < countBonds; j++) { - var idxs = bonds[j].atomRefs2.split(' '); - - if (idxs[0] === atomId) { - bonds[j].start = i; - } - - if (idxs[1] === atomId) { - bonds[j].end = i; - } - } - } +} +DebugTracer.spaces = ' '; +class OutOfMemoryError extends Error { + constructor(message) { + super(); + this.name = 'OutOfMemoryError'; + this.message = message; + } +} +function allocateTyped(TypedArrayName, size) { + let result = null; + try { + result = new TypedArrayName(size); + } catch (e) { + if (e instanceof RangeError) { + throw new OutOfMemoryError(e.message); + } else { + throw e; } - }, { - key: "_createSGroup", - value: function _createSGroup(molecule, moleculeArr) { - var newGroup = new SGroup$1(molecule.id, molecule.fieldData, new Vector3(parseFloat(molecule.x), parseFloat(molecule.y), 0), molecule.atomRefs, molecule); + } + return result; +} - if (molecule.placement === 'Relative') { - newGroup._center = new Vector3(0, 0, 0); - } +//---------------------------------------------------------------------------- +// Float array conversion - if (molecule.fieldName === 'MDLBG_FRAGMENT_CHARGE') { - newGroup._charge = parseInt(molecule.fieldData, 10) || 0; - } +function bytesToBase64( /** ArrayBuffer */buffer) { + const bytes = new Uint8Array(buffer); + let binary = ''; + for (let i = 0; i < bytes.byteLength; i++) { + binary += String.fromCharCode(bytes[i]); + } + return window.btoa(binary); +} +function bytesFromBase64( /** string */str) { + const binary = window.atob(str); + const bytes = new Uint8Array(binary.length); + for (let i = 0; i < bytes.length; ++i) { + bytes[i] = binary[i].charCodeAt(0); + } + return bytes.buffer; +} +function arrayToBase64( /** number[] */array, /** function */TypedArrayClass) { + return bytesToBase64(new TypedArrayClass(array).buffer); +} +function arrayFromBase64( /** string */str, /** function */TypedArrayClass) { + return Array.prototype.slice.call(new TypedArrayClass(bytesFromBase64(str))); +} - if (molecule.fieldName === 'MDLBG_FRAGMENT_COEFFICIENT') { - newGroup._repeat = parseInt(molecule.fieldData, 10) || 1; +// NOTE: this is 1-level comparison +function compareOptionsWithDefaults(opts, defOpts) { + const optsStr = []; + if (defOpts && opts) { + const keys = Object.keys(opts); + for (let p = 0; p < keys.length; ++p) { + const key = keys[p]; + const value = opts[key]; + // TODO add processing for tree structure + if (!(value instanceof Object) && typeof defOpts[key] !== 'undefined' && defOpts[key] !== value) { + optsStr.push(`${key}:${value}`); } + } + if (optsStr.length > 0) { + return `!${optsStr.join()}`; + } + } + return ''; +} +function isAlmostPlainObject(o) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isPlainObject(o)) { + return true; + } + const proto = o && Object.getPrototypeOf(o); + return !!proto && !proto.hasOwnProperty('constructor') && isAlmostPlainObject(proto); +} - moleculeArr.push(newGroup); +/** + * Build an object that contains properties (and subproperties) of `src` different from those + * in `dst`. Objects are parsed recursively, other values (including arrays) are compared for + * equality using `_.isEqual()`. + * @param {!object} src - a new object to compare, may contain changed or new properties + * @param {!object} dst - an old reference object + */ +function objectsDiff(src, dst) { + const diff = {}; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].forIn(src, (srcValue, key) => { + const dstValue = dst[key]; + if (isAlmostPlainObject(srcValue) && isAlmostPlainObject(dstValue)) { + const deepDiff = objectsDiff(srcValue, dstValue); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(deepDiff)) { + diff[key] = deepDiff; + } + } else if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEqual(srcValue, dstValue)) { + diff[key] = srcValue; } - }, { - key: "_extractSGroup", - value: function _extractSGroup(molecule, moleculeArr) { - if (!Array.isArray(moleculeArr)) { - moleculeArr = []; + }); + return diff; +} +function forInRecursive(object, callback) { + function iterateThrough(obj, prefix) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].forIn(obj, (value, key) => { + const newPref = prefix + (prefix.length > 0 ? '.' : ''); + if (value instanceof Object) { + iterateThrough(value, newPref + key); + } else if (value !== undefined) { + callback(value, newPref + key); } + }); + } + iterateThrough(object, ''); +} +function enquoteString(value) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(value)) { + return `"${value.replace(/"/g, '\\"')}"`; + } + return value; +} +function unquoteString(value) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(value)) { + return value; + } + if (value[0] === '"' && value[value.length - 1] === '"') { + value = value.slice(1, value.length - 1); + return value.replace(/\\"/g, '"'); + } + if (value[0] === "'" && value[value.length - 1] === "'") { + value = value.slice(1, value.length - 1); + return value.replace(/\\'/g, "'"); + } + throw new SyntaxError('Incorrect string format, can\'t unqute it'); +} +function getFileExtension(fileName) { + return fileName.slice(Math.max(0, fileName.lastIndexOf('.')) || Infinity); +} +function splitFileName(fileName) { + const ext = getFileExtension(fileName); + const name = fileName.slice(0, fileName.length - ext.length); + return [name, ext]; +} +function dataUrlToBlob(url) { + const parts = url.split(/[:;,]/); + const partsCount = parts.length; + if (partsCount >= 3 && parts[partsCount - 2] === 'base64') { + return new Blob([bytesFromBase64(parts[partsCount - 1])]); + } + return null; +} +function getBrowser() { + if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') === -1 && navigator.userAgent.indexOf('FxiOS') === -1) { + return browserType.SAFARI; + } + return browserType.DEFAULT; +} +function shotOpen(url) { + if (typeof window !== 'undefined') { + window.open().document.write(``); + } +} +function shotDownload(dataUrl, filename) { + if (!dataUrl || dataUrl.substr(0, 5) !== 'data:') { + return; + } + if (!filename) { + filename = ['screenshot-', +new Date(), '.png'].join(''); + } + if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) { + window.navigator.msSaveBlob(dataUrlToBlob(dataUrl), filename); + } else if (typeof document !== 'undefined') { + const link = document.createElement('a'); + link.download = filename; + link.innerHTML = 'download'; + link.href = window.URL.createObjectURL(dataUrlToBlob(dataUrl)); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } +} +function download(data, filename, type) { + const blobData = new Blob([data]); + if (!filename) { + filename = ['data', +new Date()].join(''); + } + if (!type) { + filename += blobData.type || '.bin'; + } else { + filename += `.${type}`; + } + if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) { + window.navigator.msSaveBlob(blobData, filename); + } else if (typeof document !== 'undefined') { + const link = document.createElement('a'); + link.download = filename; + link.innerHTML = 'download'; + link.href = window.URL.createObjectURL(blobData); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } +} +function copySubArrays(src, dst, indices, itemSize) { + for (let i = 0, n = indices.length; i < n; ++i) { + for (let j = 0; j < itemSize; ++j) { + dst[i * itemSize + j] = src[indices[i] * itemSize + j]; + } + } +} +function shallowCloneNode(node) { + const newNode = node.cloneNode(true); + newNode.worldPos = node.worldPos; + // .style property is readonly, so "newNode.style = node.style;" won't work (and we don't need it, right?) + return newNode; +} +const unquotedStringRE = /^[a-zA-Z0-9_]*$/; +const enquoteHelper = ['"', '', '"']; - if (molecule) { - if (Array.isArray(molecule)) { - var count = molecule.length; - - for (var i = 0; i < count; i++) { - if (molecule[i].molecule) { - moleculeArr = moleculeArr.concat(this._extractSGroup(molecule[i].molecule)); - } +// verify and correct if needed selctor identifier +function correctSelectorIdentifier(value) { + if (unquotedStringRE.test(value)) { + return value; + } + // quote incorrect identifier + enquoteHelper[1] = value; + return enquoteHelper.join(''); +} - this._createSGroup(molecule[i], moleculeArr); - } - } else { - if (molecule.molecule) { - if (molecule.molecule) { - moleculeArr = moleculeArr.concat(this._extractSGroup(molecule.molecule)); - } - } +/** + * Concatenates two TypedArray. Doesn't check null refs o type equality + * Attention! It must be use very rarely because requires memory reallocation every time. Use MergeTypedArraysUnsafe to + * unite array of subarrays. + * @param{TypedArray} first - destination array + * @param{TypedArray} second - source array + * @returns{TypedArray} resulting concatenated array + */ +function concatTypedArraysUnsafe(first, second) { + const result = new first.constructor(first.length + second.length); + result.set(first); + result.set(second, first.length); + return result; +} - this._createSGroup(molecule, moleculeArr); - } - } +/** + * Merges array of TypedArray into TypedArray. Doesn't check null refs o type equality + * @param{array} array - source array of subarrays + * @returns{TypedArray} resulting merged array + */ +function mergeTypedArraysUnsafe(array) { + if (array.length <= 0) { + return null; + } + // count the size + const size = array.reduce((acc, cur) => acc + cur.length, 0); + // create combined array + const result = new array[0].constructor(size); + for (let i = 0, start = 0; i < array.length; i++) { + const count = array[i].length; + result.set(array[i], start); + start += count; + } + return result; +} - return moleculeArr; - } - }, { - key: "_extractSGroups", - value: function _extractSGroups(molecule, atoms) { - var moleculeArr = this._extractSGroup(molecule); +//---------------------------------------------------------------------------- +// Exports - var count = atoms.length; - var i; - var j; +/* harmony default export */ const utils = ({ + browserType, + encodeQueryComponent, + decodeQueryComponent, + getUrlParameters, + getUrlParametersAsDict, + resolveURL, + generateRegExp, + createElement: utils_createElement, + deriveClass, + deriveDeep, + hexColor, + DebugTracer, + OutOfMemoryError, + allocateTyped, + bytesFromBase64, + bytesToBase64, + arrayFromBase64, + arrayToBase64, + compareOptionsWithDefaults, + objectsDiff, + forInRecursive, + enquoteString, + unquoteString, + getBrowser, + shotOpen, + shotDownload, + copySubArrays, + shallowCloneNode, + correctSelectorIdentifier, + getFileExtension, + splitFileName, + download, + concatTypedArraysUnsafe, + mergeTypedArraysUnsafe +}); +;// CONCATENATED MODULE: ./src/utils/JobHandle.js - for (i = 0; i < count; i++) { - var atomId = atoms[i].id; +class JobHandle extends utils_EventDispatcher { + constructor() { + super(); + this._shouldCancel = false; + } + cancel() { + this._shouldCancel = true; + this.dispatchEvent({ + type: 'cancel' + }); + } + shouldCancel() { + return this._shouldCancel; + } - for (j = 0; j < moleculeArr.length; j++) { - var firstAtomRef = moleculeArr[j]._atoms.split(' ')[0]; + // slaves use this to notify master about their events + // master routes these notifications to a single event slot + notify(event) { + this.dispatchEvent({ + type: 'notification', + slaveEvent: event + }); + } +} +;// CONCATENATED MODULE: ./src/settings.js - if (firstAtomRef === atomId) { - if (!atoms[i].sgroupRef) { - atoms[i].sgroupRef = []; - } - atoms[i].sgroupRef.push(moleculeArr[j]); - } - } - } // build sGroups centers +const VERSION = 0; - var atomMap = {}; // sgrpmap cache +//---------------------------------------------------------------------------- +// DEFAULT SETTINGS +//---------------------------------------------------------------------------- - var mapEntry = null; - var nLimon = 100000000; - var bLow = new Vector3(nLimon, nLimon, nLimon); - var bHight = new Vector3(-nLimon, -nLimon, -nLimon); +/** + * Polygonal complexity settings. + * + * @typedef PolyComplexity + * @property {number} poor + * @property {number} low + * @property {number} medium + * @property {number} high + * @property {number} ultra + */ - function cycleFuncInner(e) { - mapEntry = atomMap[e]; +/** + * @alias SettingsObject + * @namespace + */ +const settings_defaults = { + /** + * Default options for all available modes. + * Use {@link Mode.id} as a dictionary key to access mode options. + * + * Usually you don't need to override these settings. You may specify mode options as a parameter during + * {@link Mode} construction. + * + * @memberof SettingsObject# + * @type {Object.} + * + * @property {LinesModeOptions} LN - Lines mode options. + * @property {LicoriceModeOptions} LC - Licorice mode options. + * @property {BallsAndSticksModeOptions} BS - Balls and Sticks mode options. + * @property {VanDerWaalsModeOptions} VW - Van der Waals mode options. + * @property {TraceModeOptions} TR - Trace mode options. + * @property {TubeModeOptions} TU - Tube mode options. + * @property {CartoonModeOptions} CA - Cartoon mode options. + * @property {QuickSurfaceModeOptions} QS - Contact Surface mode options. + * @property {IsoSurfaceSASModeOptions} SA - Solvent Accessible Surface mode options. + * @property {IsoSurfaceSESModeOptions} SE - Solvent Excluded Surface mode options. + * @property {ContactSurfaceModeOptions} CS - Contact Surface mode options. + * @property {TextModeOptions} TX - Text mode options. + * @property {VolumeDensityModeOptions} VD - Volume Density mode options. + */ + modes: { + //---------------------------------------------------------------------------- + // BALLS AND STICKS + //---------------------------------------------------------------------------- - if (mapEntry) { - moleculeArr[j]._atoms.push(mapEntry.a); - } + /** + * Balls and Sticks mode options. + * + * @typedef BallsAndSticksModeOptions + * + * @property {number} atom - Sphere radius as a fraction of Van der Waals atom radius. + * @property {number} bond - Cylinder radius in angstroms. + * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all + * available space. + * @property {boolean} multibond - Toggles rendering of multiple ordered bonds. + * @property {number} aromrad - Minor radius of a torus for aromatic loops. + * @property {boolean} showarom - Toggles rendering of aromatic loops. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + BS: { + atom: 0.23, + bond: 0.15, + space: 0.5, + multibond: true, + aromrad: 0.1, + showarom: true, + polyComplexity: { + poor: 3, + low: 4, + medium: 6, + high: 12, + ultra: 32 } + }, + //---------------------------------------------------------------------------- + // VAN DER WAALS + //---------------------------------------------------------------------------- - function cycleFunc(e) { - mapEntry = atomMap[e]; - - if (mapEntry) { - bLow.set(Math.min(bLow.x, mapEntry.x), Math.min(bLow.y, mapEntry.y), Math.min(bLow.z, mapEntry.z)); - bHight.set(Math.max(bHight.x, mapEntry.x), Math.max(bHight.y, mapEntry.y), Math.max(bHight.z, mapEntry.z)); - cycleFuncInner(e); - } + /** + * Van der Waals mode options. + * + * @typedef VanDerWaalsModeOptions + * + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + VW: { + polyComplexity: { + poor: 4, + low: 6, + medium: 8, + high: 16, + ultra: 32 } + }, + //---------------------------------------------------------------------------- + // LINES + //---------------------------------------------------------------------------- - for (i = 0; i < atoms.length; i++) { - atomMap[atoms[i].id] = {}; - atomMap[atoms[i].id].x = atoms[i].x2; - - if (atoms[i].x3) { - atomMap[atoms[i].id].x = atoms[i].x3; - } - - atomMap[atoms[i].id].x = parseFloat(atomMap[atoms[i].id].x); - atomMap[atoms[i].id].y = atoms[i].y2; - - if (atoms[i].y3) { - atomMap[atoms[i].id].y = atoms[i].y3; - } - - atomMap[atoms[i].id].y = parseFloat(atomMap[atoms[i].id].y); - atomMap[atoms[i].id].z = '0.0'; - - if (atoms[i].z3) { - atomMap[atoms[i].id].z = atoms[i].z3; - } + /** + * Lines mode options. + * + * @typedef LinesModeOptions + * + * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds. + * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops. + * @property {number} offsarom - Offset between bonds and aromatic cycle. + * @property {number} chunkarom - Number of pieces in a-loop arc, corresponding to atom. + * @property {number} atom - Collision radius for atoms picking. + * @property {number} lineWidth - Line width in pixels (not used in thin lines). + */ + LN: { + multibond: true, + showarom: true, + offsarom: 0.2, + chunkarom: 10, + atom: 0.23, + lineWidth: 2 + }, + //---------------------------------------------------------------------------- + // LICORICE + //---------------------------------------------------------------------------- - atomMap[atoms[i].id].z = parseFloat(atomMap[atoms[i].id].z); - atomMap[atoms[i].id].a = atoms[i]; + /** + * Licorice mode options. + * + * @typedef LicoriceModeOptions + * + * @property {number} bond - Bond cylinder radius. + * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all + * available space. + * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds. + * @property {number} aromrad - Minor radius of a torus for aromatic loops. + * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops. + * @property {PolyComplexity} polyComplexity - Poly complexity values for render modes. + */ + LC: { + bond: 0.20, + space: 0.0, + multibond: true, + aromrad: 0.1, + showarom: true, + polyComplexity: { + poor: 3, + low: 4, + medium: 6, + high: 12, + ultra: 32 } + }, + //---------------------------------------------------------------------------- + // SURFACE SAS + //---------------------------------------------------------------------------- - var atomsRef; - - for (j = 0; j < moleculeArr.length; j++) { - if (moleculeArr[j]._center !== null) { - bLow.set(nLimon, nLimon, nLimon); - bHight.set(-nLimon, -nLimon, -nLimon); - atomsRef = moleculeArr[j]._atoms.split(' '); - moleculeArr[j]._atoms = []; - atomsRef.forEach(cycleFunc); - - moleculeArr[j]._center.addVectors(bLow, bHight); - - moleculeArr[j]._center.multiplyScalar(0.5); - } else { - atomsRef = moleculeArr[j]._atoms.split(' '); - moleculeArr[j]._atoms = []; - atomsRef.forEach(cycleFuncInner); - } + /** + * Solvent Accessible Surface mode options. + * + * @typedef IsoSurfaceSASModeOptions + * + * @property {boolean} zClip - Flag, that toggles z-clipping. + * @property {number} probeRadius - Radius of the probe. + * @property {string} subset - Only parts of surface close to selected atoms will be visible. + * Empty string means whole surface is visible. + * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + SA: { + zClip: false, + probeRadius: 1.5, + subset: '', + wireframe: false, + polyComplexity: { + poor: 6, + low: 8, + medium: 16, + high: 30, + ultra: 60 } + }, + //---------------------------------------------------------------------------- + // SURFACE SES + //---------------------------------------------------------------------------- - atomMap = null; - } - }, { - key: "_traverseData", - value: function _traverseData(dom) { - function isArray(o) { - return Object.prototype.toString.apply(o) === '[object Array]'; + /** + * Solvent Excluded Surface mode options. + * + * @typedef IsoSurfaceSESModeOptions + * + * @property {boolean} zClip - Flag, that toggles z-clipping. + * @property {number} probeRadius - Radius of the probe. + * @property {string} subset - Only parts of surface close to selected atoms will be visible. + * Empty string means whole surface is visible. + * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + SE: { + zClip: false, + probeRadius: 1.5, + subset: '', + wireframe: false, + polyComplexity: { + poor: 6, + low: 8, + medium: 16, + high: 30, + ultra: 60 } + }, + //---------------------------------------------------------------------------- + // QUICK SURFACE + //---------------------------------------------------------------------------- - function parseNode(xmlNode, result) { - if (xmlNode.nodeName === '#text' && xmlNode.nodeValue.trim() === '') { - return; - } - - var jsonNode = {}; - jsonNode.xmlNode = xmlNode; - var existing = result[xmlNode.nodeName]; - - if (existing) { - if (!isArray(existing)) { - result[xmlNode.nodeName] = [existing, jsonNode]; - } else { - result[xmlNode.nodeName].push(jsonNode); - } - } else { - result[xmlNode.nodeName] = jsonNode; - } - - var length; - var i; + /** + * Quick Surface mode options. + * + * @typedef QuickSurfaceModeOptions + * + * @property {number} isoValue - Isovalue of the surface to extract. + * @property {number} scale - Radius scale for the surface being built. + * @property {boolean} zClip - Flag, that toggles z-clipping. + * @property {string} subset - Only parts of surface close to selected atoms will be visible. + * Empty string means whole surface is visible. + * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. + * @property {PolyComplexity} gaussLim - Gauss lim for coloring the bigger the value, the smoother our colors are. + * @property {PolyComplexity} gridSpacing - Poly complexity values for render modes. In this case the value + * corresponds to the grid density. + */ + QS: { + isoValue: 0.5, + gaussLim: { + poor: 1.5, + low: 2.0, + medium: 2.5, + high: 3.0, + ultra: 4.0 + }, + scale: 1.0, + wireframe: false, + gridSpacing: { + poor: 2, + low: 1.5, + medium: 1, + high: 0.5, + ultra: 0.25 + }, + subset: '', + zClip: false + }, + //---------------------------------------------------------------------------- + // CONTACT SURFACE + //---------------------------------------------------------------------------- - if (xmlNode.attributes) { - length = xmlNode.attributes.length; + /** + * Contact Surface mode options. + * + * @typedef ContactSurfaceModeOptions + * + * @property {number} isoValue - Isovalue of the surface to extract. + * @property {number} probeRadius - Probe radius. + * @property {number} probePositions + * @property {boolean} zClip - Flag, that toggles z-clipping. + * @property {string} subset - Only parts of surface close to selected atoms will be visible. + * Empty string means whole surface is visible. + * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode. + * @property {PolyComplexity} polyComplexity - Radius scale for the surface being built. + * Poly complexity values for render modes. In this case the value corresponds to the grid density. + */ + CS: { + probeRadius: 1.4, + isoValue: 1.5, + wireframe: false, + probePositions: 30, + polyComplexity: { + poor: 0.5, + low: 1.0, + medium: 1.5, + high: 1.75, + ultra: 2.0 + }, + subset: '', + zClip: false + }, + //---------------------------------------------------------------------------- + // TRACE + //---------------------------------------------------------------------------- - for (i = 0; i < length; i++) { - var attribute = xmlNode.attributes[i]; - jsonNode[attribute.nodeName] = attribute.nodeValue; - } - } + /** + * Trace mode options. + * + * @typedef TraceModeOptions + * + * @property {number} radius - Cylinder radius. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + TR: { + radius: 0.30, + polyComplexity: { + poor: 12, + low: 16, + medium: 32, + high: 64, + ultra: 64 + } + }, + //---------------------------------------------------------------------------- + // TUBE + //---------------------------------------------------------------------------- - length = xmlNode.childNodes.length; + /** + * Tube mode options. + * + * @typedef TubeModeOptions + * + * @property {number} radius - Cylinder radius. + * @property {number} tension - Tension for interpolation. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments. + */ + TU: { + radius: 0.30, + heightSegmentsRatio: 1.5, + tension: -0.7, + polyComplexity: { + poor: 4, + low: 6, + medium: 10, + high: 18, + ultra: 34 + } + }, + //---------------------------------------------------------------------------- + // CARTOON + //---------------------------------------------------------------------------- - for (i = 0; i < length; i++) { - parseNode(xmlNode.childNodes[i], jsonNode); + /** + * Cartoon mode options. + * + * @typedef CartoonModeOptions + * + * @property {number} radius - Standard tube radius. + * @property {number} depth - Height of the secondary structure ribbon. + * @property {number} tension - Tension for interpolation. + * @proprety {object} ss - Secondary structure parameters. + * @proprety {object} ss.helix - Options for helices render. + * @proprety {number} ss.helix.width - Width of the secondary structure ribbon. + * @proprety {number} ss.helix.arrow - Secondary structure's arrow width. + * @proprety {object} ss.strand - Options for strands render. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + * polyComplexity must be even for producing symmetric arrows. + * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments. + */ + CA: { + radius: 0.30, + depth: 0.25, + ss: { + helix: { + width: 1.0, + arrow: 2.0 + }, + strand: { + width: 1.0, + arrow: 2.0 } + }, + heightSegmentsRatio: 1.5, + tension: -0.7, + polyComplexity: { + poor: 4, + low: 6, + medium: 10, + high: 18, + ultra: 34 } + }, + //---------------------------------------------------------------------------- + // TEXT + //---------------------------------------------------------------------------- - var result = {}; + /** + * Text mode options. + * + * @typedef TextModeOptions + * + * @property {string} template - Format string for building output text. + * @property {string} horizontalAlign - Text alignment ('left', 'right', 'center'). + * @property {string} verticalAlign - Vertical text box alignment ('top', 'bottom', 'middle'). + * @property {number} dx - Text offset x in angstroms. + * @property {number} dy - Text offset y in angstroms. + * @property {number} dz - Text offset z in angstroms. + * @property {string} fg - Color rule for foreground. + * @property {string} bg - Color rule for background. + * @property {boolean} showBg - Flag, that toggles background rendering. + * + */ + TX: { + template: '{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}', + horizontalAlign: 'center', + verticalAlign: 'middle', + dx: 0, + dy: 0, + dz: 1, + fg: 'none', + bg: '0x202020', + showBg: true + }, + //---------------------------------------------------------------------------- + // VOLUME DENSITY + //---------------------------------------------------------------------------- - if (dom.childNodes.length) { - parseNode(dom.childNodes[0], result); + /** + * Volume density mode options. + * + * @typedef VolumeDensityModeOptions + * + * @property {number} kSigma - Noise threshold coefficient. + * @property {boolean} frame - flag, that turns on box frame painting. + * @property {boolean} isoMode - flag, that turns on IsoSurface mode instead of Volume Rendering. + * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions. + */ + VD: { + kSigma: 1.0, + kSigmaMed: 2.0, + kSigmaMax: 4.0, + frame: true, + isoMode: false, + polyComplexity: { + poor: 2, + low: 3, + medium: 4, + high: 8, + ultra: 10 } - - return result; } - }, { - key: "_findSuitableMolecule", - value: function _findSuitableMolecule(data, molSet) { - for (var key in data) { - if (key === 'xmlNode') { - continue; - } else if (key === 'molecule') { - if (data.molecule) { - if (data.molecule.atomArray && data.molecule.atomArray.atom) { - molSet.push(data); - } - - if (Array.isArray(data.molecule)) { - for (var i = 0; i < data.molecule.length; i++) { - if (data.molecule[i].atomArray && data.molecule[i].atomArray.atom) { - molSet.push({ - molecule: data.molecule[i] - }); - } - } - } - } - } else if (data[key] && data[key] !== null && _typeof_1(data[key]) === 'object') { - this._findSuitableMolecule(data[key], molSet); - } - } + }, + /** + * Default options for all available colorers. + * Use {@link Colorer.id} as a dictionary key to access colorer options. + * + * Usually you don't need to override these settings. You may specify colorer options as a parameter during + * {@link Colorer} construction. + * + * Not all colorers have options. + * + * @memberof SettingsObject# + * @type {Object.} + * + * @property {ElementColorerOptions} EL - Element colorer options. + * @property {SequenceColorerOptions} SQ - Sequence colorer options. + * @property {MoleculeColorerOptions} MO - Molecule colorer options. + * @property {UniformColorerOptions} UN - Uniform colorer options. + * @property {ConditionalColorerOptions} CO - Conditional colorer options. + * @property {TemperatureColorerOptions} TM - Temperature colorer options. + * @property {OccupancyColorerOptions} OC - Occupancy colorer options. + * @property {HydrophobicityColorerOptions} HY - Hydrophobicity colorer options. + */ + colorers: { + /** + * Element colorer options. + * + * @typedef ElementColorerOptions + * + * @property {number} carbon - Carbon color or -1 to use default. + */ + EL: { + carbon: -1 + }, + /** + * Uniform colorer options. + * + * @typedef UniformColorerOptions + * + * @property {number} color - Single color to paint with. + */ + UN: { + color: 0xFFFFFF + }, + /** + * Conditional colorer options. + * + * @typedef ConditionalColorerOptions + * + * @property {string} subset - Selector string. + * @property {number} color - Color of selected atoms. + * @property {number} baseColor - Color of other atoms. + */ + CO: { + subset: 'charged', + color: 0xFF0000, + baseColor: 0xFFFFFF + }, + /** + * Carbon colorer options. + * + * @typedef CarbonColorerOptions + * + * @property {number} color - Single color to paint carbons + * @property {number} factor - Color factor for not carbon atoms. + */ + CB: { + color: 0x909090, + factor: 0.6 + }, + /** + * Sequence colorer options. + * + * @typedef SequenceColorerOptions + * + * @property {string} gradient - Name of gradient to use. + */ + SQ: { + gradient: 'rainbow' + }, + /** + * Temperature colorer options. + * + * @typedef TemperatureColorerOptions + * + * @property {string} gradient - Name of gradient to use. + * @property {number} min - Minimal temperature. + * @property {number} max - Maximal temperature. + */ + TM: { + gradient: 'temp', + min: 5, + max: 40 + }, + /** + * Occupancy colorer options. + * + * @typedef OccupancyColorerOptions + * + * @property {string} gradient - Name of gradient to use. + */ + OC: { + gradient: 'reds' + }, + /** + * Hydrophobicity colorer options. + * + * @typedef HydrophobicityColorerOptions + * + * @property {string} gradient - Name of gradient to use. + */ + HY: { + gradient: 'blue-red' + }, + /** + * Molecule colorer options. + * + * @typedef MoleculeColorerOptions + * + * @property {string} gradient - Name of gradient to use. + */ + MO: { + gradient: 'rainbow' } - }, { - key: "_selectComponents", - value: function _selectComponents(text) { - var parser = new DOMParser(); - var doc = parser.parseFromString(text, 'application/xml'); - - var traversedData = this._traverseData(doc); - - var rawData; - var self = this; - - function prepareComponentCompound(data) { - var atoms = []; - - if (data.molecule && data.molecule.atomArray && data.molecule.atomArray.atom) { - if (!Array.isArray(data.molecule.atomArray.atom)) { - atoms.push(data.molecule.atomArray.atom); - } else { - atoms = data.molecule.atomArray.atom; - } - } else if (!data.molecule) { - var ret = {}; - ret.atomLabels = null; - ret.labelsCount = 1; - return ret; - } - - if (data.molecule.molecule) { - self._extractSGroups(data.molecule.molecule, atoms); - } - - var atom; - var count = atoms.length; - - for (var i = 0; i < count; i++) { - atom = atoms[i]; - atom.edges = []; - } - - var localBond = []; - - if (data.molecule.bondArray && data.molecule.bondArray.bond) { - if (!Array.isArray(data.molecule.bondArray.bond)) { - localBond.push(data.molecule.bondArray.bond); - } else { - localBond = data.molecule.bondArray.bond; - } - } - - var bond; - count = localBond.length; - - self._rebuidBondIndexes(atoms, localBond); - - function addCurrBond(index) { - bond = localBond[index]; - atom = atoms[bond.start]; - - if (!atom) { - return false; - } - - atom.edges.push(bond.end); - atom = atoms[bond.end]; - - if (!atom) { - return false; - } - - atom.edges.push(bond.start); - return true; - } - - for (var _i = 0; _i < count; _i++) { - if (!addCurrBond(_i)) { - // ignore invalid bond - continue; - } - - var orderAttr = bond.xmlNode.getAttribute('order'); - var tc = parseInt(orderAttr, 10); // the default bond order is unknown - - localBond[_i].order = 0; - localBond[_i].type = Bond$2.BondType.UNKNOWN; - - if (tc > 1) { - localBond[_i].order = tc; - } else { - // another option - bond order is a string - var order = cOrderCharCodes[orderAttr]; - - if (order !== undefined) { - localBond[_i].order = order; - - if (orderAttr === 'A') { - localBond[_i].type = Bond$2.BondType.AROMATIC; - } - } - } - } - - count = atoms.length; + }, + /* + * Use antialiasing in WebGL. + * @type {boolean} + */ + antialias: true, + /* + * Camera field of view in degrees. + * @type {number} + */ + camFov: 45.0, + /* + * Camera near plane distance. + * @type {number} + */ + camNear: 0.5, + /* + * Camera far plane distance. + * @type {number} + */ + camFar: 100.0, + camDistance: 2.5, + radiusToFit: 1.0, + /** + * @type {number} + * @instance + */ + fogNearFactor: 0.5, + // [0, 1] - for (var _i2 = 0; _i2 < count; _i2++) { - atom = atoms[_i2]; - atom.edges.sort(); - } + /** + * @type {number} + * @instance + */ + fogFarFactor: 1, + // [0, 1] + fogAlpha: 1.0, + fogColor: 0x000000, + fogColorEnable: false, + /** + * Palette used for molecule coloring. + * @type {string} + */ + palette: 'JM', + /* + * Geometry resolution. + * @type {string} + */ + resolution: 'medium', + autoResolution: false /* true */, - var labels = self._breadWidthSearch(atoms, 0); // for now + autoPreset: true, + preset: 'default', + // TODO: remove 'preset' from settings, implement autodetection + presets: { + // Default + default: [{ + mode: 'BS', + colorer: 'EL', + selector: 'all', + material: 'SF' + }], + empty: [], + // Wireframe + wire: [{ + mode: 'LN', + colorer: 'EL', + selector: 'all', + material: 'SF' + }], + // Small molecules + small: [{ + mode: 'BS', + colorer: 'EL', + selector: 'all', + material: 'SF' + }], + // Proteins, nucleic acids etc. + macro: [{ + mode: 'CA', + colorer: 'SS', + selector: 'not hetatm', + material: 'SF' + }, { + mode: 'BS', + colorer: 'EL', + selector: 'hetatm and not water', + material: 'SF' + }] + }, + objects: { + line: { + color: 0xFFFFFFFF, + dashSize: 0.3, + gapSize: 0.05 + } + }, + //---------------------------------------------------------------------------- - var retStruct = {}; - retStruct.atoms = atoms; - retStruct.bonds = localBond; - retStruct.labels = labels.atomLabels; - retStruct.count = Math.min(1, labels.labelsCount); // for now + bg: { + color: 0x202020, + transparent: false + }, + draft: { + clipPlane: false, + clipPlaneFactor: 0.5, + clipPlaneSpeed: 0.00003 + }, + /* + * Separate group for plugins. + * Each plugin handles its field by itself. + */ + plugins: {}, + /** + * @type {boolean} + * @instance + */ + axes: true, + /** + * @type {boolean} + * @instance + */ + fog: true, + /** + * @type {boolean} + * @instance + */ + fps: true, + /** + * Switch using of z-sprites for sphere and cylinder geometry + * @type {boolean} + * @instance + */ + zSprites: true, + isoSurfaceFakeOpacity: true, + /** + * @type {boolean} + * @instance + */ + suspendRender: true, + nowater: false, + /** + * @type {boolean} + * @instance + */ + autobuild: true, + /** + * Anti-aliasing. + * @type {boolean} + * @instance + */ + fxaa: true, + /** + * Outline depths + * @type {boolean} + * @instance + */ + outline: { + on: false, + color: 0x000000, + threshold: 0.1, + thickness: 1 + }, + /** + * Ambient Occlusion special effect. + * @type {boolean} + * @instance + */ + ao: false, + /** + * Shadows options. + * + * @property {boolean} shadowMap - enable/disable. + * @property {string} basic/percentage-closer filtering/non-uniform randomizing pcf. + * @property {number} radius for percentage-closer filtering. + */ + shadow: { + on: false, + type: 'random' /* basic, pcf, random */, + radius: 1.0 + }, + /** + * Auto-rotation with constant speed. + * @type {number} + * @instance + */ + autoRotation: 0.0, + /** + * Set maximum fps for animation. + * @type {number} + * @instance + */ + maxfps: 30, + /** + * Set fbx output precision. + * @type {number} + * @instance + */ + fbxprec: 4, + /** + * Auto-rotation axis. + * + * - true: complex auto-rotation is about vertical axis + * - false: rotation axis is defined by last user rotation + * + * @type {boolean} + * @instance + */ + autoRotationAxisFixed: true, + /** + * Enable zooming with mouse wheel or pinch gesture. + * @type {boolean} + * @instance + */ + zooming: true, + /** + * Enable picking atoms & residues with left mouse button or touch. + * @type {boolean} + * @instance + */ + picking: true, + /** + * Set picking mode ('atom', 'residue', 'chain', 'molecule'). + * @type {string} + * @instance + */ + pick: 'atom', + /** + * Make "component" and "fragment" editing modes available. + * @type {boolean} + * @instance + */ + editing: false, + /** + * Detect aromatic loops. + * @type {boolean} + * @instance + */ + aromatic: false, + /** + * Load only one biological unit from all those described in PDB file. + * @type {boolean} + * @instance + */ + singleUnit: true, + /** + * Set stereo mode ('NONE', 'SIMPLE', 'DISTORTED', 'ANAGLYPH', 'WEBVR'). + * @type {string} + * @instance + */ + stereo: 'NONE', + /** + * Enable smooth transition between views + * @type {boolean} + * @instance + */ + interpolateViews: true, + /** + * Set transparency mode ('standard', 'prepass'). + * @type {string} + * @instance + */ + transparency: 'prepass', + /** + * Mouse translation speed. + * @type {number} + * @instance + */ + translationSpeed: 2, + debug: { + example: 3.5, + text: 'hello!', + good: true, + ssaoKernelRadius: 0.7, + ssaoFactor: 0.7, + stereoBarrel: 0.25 + }, + use: { + multiFile: false + } +}; - retStruct.curr = -1; - retStruct.originalCML = doc; - return retStruct; - } +//---------------------------------------------------------------------------- +// SETTINGS CLASS +//---------------------------------------------------------------------------- - if (traversedData.cml) { - rawData = traversedData.cml; - } else { - rawData = traversedData; +function Settings() { + utils_EventDispatcher.call(this); + this.old = null; + this.now = {}; + this._changed = {}; + this.reset(); +} +utils.deriveClass(Settings, utils_EventDispatcher, { + defaults: settings_defaults, + set(path, value) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(path)) { + const oldValue = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(this.now, path); + if (oldValue !== value) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].set(this.now, path, value); + this._notifyChange(path, value); } - - var retData = []; - var filteredData = []; - - this._findSuitableMolecule(rawData, filteredData); - - if (this._readOnlyOneMolecule && filteredData.length > 1) { - filteredData.splice(1, filteredData.length - 1); + } else { + const diff = utils.objectsDiff(path, this.now); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(diff)) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge(this.now, diff); + this._notifyChanges(diff); } - - filteredData.forEach(function (d) { - var rd = prepareComponentCompound(d); - - if (rd.atoms.length > 0) { - retData.push(rd); - } - }); - return retData; } - }, { - key: "_packLabel", - value: function _packLabel(compId, molId) { - var shift = 16; - return (molId << shift) + compId; + }, + get(path, defaultValue) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(this.now, path, defaultValue); + }, + reset() { + const diff = utils.objectsDiff(settings_defaults, this.now); + this.now = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].cloneDeep(settings_defaults); + this.old = null; + this._notifyChanges(diff); + this._changed = {}; + }, + checkpoint() { + this.old = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].cloneDeep(this.now); + this._changed = {}; + }, + _notifyChange(path, value) { + this._changed[path] = true; + this.dispatchEvent({ + type: `change:${path}`, + value + }); + }, + _notifyChanges(diff) { + utils.forInRecursive(diff, (deepValue, deepPath) => { + this._notifyChange(deepPath, deepValue); + }); + }, + changed() { + if (!this.old) { + return []; } - }, { - key: "_unpackLabel", - value: function _unpackLabel(l) { - var shift = 16; - var mask = (1 << shift) - 1; - return { - molId: l >>> shift, - compId: l & mask - }; + const { + old, + now + } = this; + const keys = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].filter(Object.keys(this._changed), key => external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(old, key) !== external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(now, key)); + return keys; + }, + applyDiffs(diffs) { + if (diffs.hasOwnProperty('VERSION') && diffs.VERSION !== VERSION) { + throw new Error('Settings version does not match!'); } - }, { - key: "_breadWidthSearch", - value: function _breadWidthSearch(atoms, molID) { - var atomLabels = new Array(atoms.length); - var id; - - for (id = 0; id < atomLabels.length; id++) { - atomLabels[id] = this._packLabel(0, molID); - } - - var breadthQueue = []; - var componentID = 0; - var labeledAtoms = atoms.length; - - while (labeledAtoms > 0) { - componentID++; - var startID = -1; - - for (id = 0; id < atomLabels.length; id++) { - if (this._unpackLabel(atomLabels[id]).compId === 0) { - startID = id; - break; - } - } - - if (startID < 0) { - break; - } // Bread first search - - - breadthQueue.push(atoms[startID]); - atomLabels[startID] = this._packLabel(componentID, molID); - labeledAtoms--; - - while (breadthQueue.length > 0) { - var curr = breadthQueue.shift(); - - if (!curr) { - continue; - } - - for (var i = 0; i < curr.edges.length; i++) { - if (atomLabels[curr.edges[i]] !== componentID) { - breadthQueue.push(atoms[curr.edges[i]]); - atomLabels[curr.edges[i]] = componentID; - labeledAtoms--; - } - } - } - } - - var ret = {}; - ret.atomLabels = atomLabels; - ret.labelsCount = componentID; - return ret; + // VERSION shouldn't be presented inside settings structure + delete diffs.VERSION; + this.reset(); + this.set(diffs); + }, + getDiffs(versioned) { + const diffs = utils.objectsDiff(this.now, settings_defaults); + if (versioned) { + diffs.VERSION = VERSION; } - }, { - key: "_parseBond", - value: function _parseBond(eAtom, mainAtom, order, type) { - if (eAtom >= 0) { - var h = [Math.min(eAtom, mainAtom), Math.max(eAtom, mainAtom)]; + return diffs; + }, + setPluginOpts(plugin, opts) { + settings_defaults.plugins[plugin] = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].cloneDeep(opts); + this.now.plugins[plugin] = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].cloneDeep(opts); + } +}); +/* harmony default export */ const settings = (new Settings()); +;// CONCATENATED MODULE: ./src/options.js - this._complex.addBond(h[0], h[1], order, type, true); - } - } - }, { - key: "_fixBondsArray", - value: function _fixBondsArray() { - var serialAtomMap = this._serialAtomMap = {}; - var complex = this._complex; - var atoms = complex._atoms; - for (var i = 0, ni = atoms.length; i < ni; ++i) { - var atom = atoms[i]; - serialAtomMap[atom.serial] = atom; - } - var bonds = complex._bonds; - var logger = this.logger; - for (var j = 0, nj = bonds.length; j < nj; ++j) { - var bond = bonds[j]; +let repIndex = 0; +function asBoolean(value) { + return !(!value || value === '0' || external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(value) && value.toLowerCase() === 'false'); +} +const adapters = { + string: String, + number: Number, + boolean: asBoolean +}; - if (bond._right < bond._left) { - logger.debug('_fixBondsArray: Logic error.'); - } +// Level 1 assignment symbol +const cL1Ass = '='; +const cOptsSep = '!'; +// Level 2 (options) assignment symbol +const cL2Ass = ':'; +// Level 2 (options) separator symbol +const cLSep = ','; +const cCommonIgnoreSymbols = '$;@/?'; +/** + * We may (and should) leave as is for better readability: + * + * $ , ; : @ / ? + */ +/** + * Generate regular expression for symbols excluded for first level encryption + */ +function getLevel1ExcludedExpr() { + const cLevel1Ignores = ':,'; + return utils.generateRegExp(cCommonIgnoreSymbols + cLevel1Ignores); +} - bond._left = serialAtomMap[bond._left] || null; - bond._right = serialAtomMap[bond._right] || null; - } +/** + * Generate regular expression for symbols excluded for first level encryption + * (options, etc, ..) + */ +function getLevel2ExcludedExpr() { + const cLevel2Ignores = ' '; + return utils.generateRegExp(cCommonIgnoreSymbols + cLevel2Ignores); +} +const cL1ExclExpr = getLevel1ExcludedExpr(); +function encodeQueryComponentL1(value) { + return utils.encodeQueryComponent(value, cL1ExclExpr); +} +const cL2ExclExpr = getLevel2ExcludedExpr(); +function encodeQueryComponentL2(value) { + return utils.encodeQueryComponent(value, cL2ExclExpr); +} +function ensureRepList(opts) { + let { + reps + } = opts; + if (!reps) { + const { + presets + } = settings.now; + let preset = opts.preset || settings.now.preset; + reps = presets[preset]; + if (!reps) { + logger.warn(`Unknown preset "${preset}"`); + [preset] = Object.keys(presets); + reps = presets[preset]; // fall back to any preset } - }, { - key: "_parseSet", - value: function _parseSet(varData) { - var complex = this._complex = new Complex$2(); - var data = varData; - var currentLabel = data.curr; - var atoms = data.atoms, - labels = data.labels; - var atom = null; - var i; - var j; - var count = atoms.length; - - function addFunc(a) { - a.xmlNodeRef = atom; - - if (atom.x2) { - atom.x3 = atom.x2; - delete atom.x2; - } - - if (atom.y2) { - atom.y3 = atom.y2; - delete atom.y2; - } - - if (!atom.z3) { - atom.z3 = '0.0'; - } - - atom.complexAtom = a; - } - - var chains = {}; // parse atoms in label order - - var reorder = []; - - for (i = 0; i < count; i++) { - reorder.push(i); - } - - reorder.sort(function (a, b) { - return labels[a] - labels[b]; - }); - - for (i = 0; i < count; i++) { - var atomCharge = 0; - var lLabel = labels[reorder[i]]; - - if (this._unpackLabel(lLabel).molId === this._unpackLabel(currentLabel).molId) { - atom = atoms[reorder[i]]; - var atomFullNameStruct = atom.elementType; - - if (atom.sgroupRef) { - var countRef = atom.sgroupRef.length; - - for (var k = 0; k < countRef; ++k) { - complex._sgroups.push(atom.sgroupRef[k]); - } - } - - if (atom.x3 || atom.x2) { - var currAtomComp = this._unpackLabel(lLabel).compId; // use ' ' by default instead of synthetic creation of chain names - - - var chainID = ' '; //= String.fromCharCode('A'.charCodeAt(0) + currAtomComp); - - var resSeq = currAtomComp; - var iCode = ' '; - var strLabel = currAtomComp.toString(); - - if (strLabel.length === 1) { - strLabel = "0".concat(strLabel); - } - - var resName = "N".concat(strLabel); - var chain = chains[chainID]; - - if (!chain || chain.getName() !== chainID) { - chains[chainID] = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); - this._residue = null; - } - - var residue = this._residue; - - if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { - this._residue = residue = chain.addResidue(resName, resSeq, iCode); - } // _x, _y, _z, mname, mindex, atomNameFull, atomName, chainID, serial, isHet, atlLocInd, atomNameToTypeF - - - var xyz = null; - - if (atom.x3) { - xyz = new Vector3(parseFloat(atom.x3), parseFloat(atom.y3), parseFloat(atom.z3)); - } else if (atom.x2) { - xyz = new Vector3(parseFloat(atom.x2), parseFloat(atom.y2), 0); - } - - var element = Element$3.ByName[atom.elementType.toUpperCase()]; - - if (!element) { - element = JSON.parse(JSON.stringify(Element$3.ByName[Object.keys(Element$3.ByName)[Object.keys(Element$3.ByName).length - 1]])); - element.number += 1; - element.name = atom.elementType.toUpperCase(); - element.fullName = 'Unknown'; - Element$3.ByName[atom.elementType.toUpperCase()] = element; - } - - var atomSerial = parseInt(atom.id.replace(/[^0-9]/, ''), 10); - var added = residue.addAtom(atomFullNameStruct, element, xyz, Element$3.Role.SG, true, atomSerial, ' ', 1.0, 0.0, atomCharge); - - if (atom.hydrogenCount) { - added.hydrogenCount = parseInt(atom.hydrogenCount, 10); - } - - if (atom.mrvValence) { - added.valence = parseInt(atom.mrvValence, 10); - } - - addFunc(added); - } - } - } - - chains = null; // NOSONAR - - for (i = 0; i < data.bonds.length; i++) { - var cb = data.bonds[i]; - - if (this._unpackLabel(labels[cb.start]).molId === this._unpackLabel(currentLabel).molId && this._unpackLabel(labels[cb.end]).molId === this._unpackLabel(currentLabel).molId) { - atom = atoms[cb.start]; - - if (!atom || !atoms[cb.end]) { - continue; // skip invalid + opts.preset = preset; + opts.reps = utils.deriveDeep(reps, true); + } +} +function ensureRepAssign(opts, prop, value) { + ensureRepList(opts); + const rep = opts.reps[repIndex]; + // prop specified twice therefore start new rep by cloning the current + if (rep.hasOwnProperty(prop)) { + repIndex = opts.reps.length; + opts.reps[repIndex] = utils.deriveDeep(rep, true); + } + if (value !== undefined) { + opts.reps[repIndex][prop] = value; + } +} +function addObject(opts, params, options) { + if (opts._objects === undefined) { + opts._objects = []; + } + const [type, newOpts] = options; + const newObj = { + type, + params + }; + if (newOpts !== undefined) { + newObj.opts = newOpts; + } + opts._objects[opts._objects.length] = newObj; +} +function parseParams(str, params) { + const sep = str.indexOf(','); + if (sep >= 0) { + params.push(str.substr(sep + 1).split(',')); + return str.substr(0, sep); + } + // keep this untouched if no params were extracted + return str; +} +function extractArgs(input, defaultsDict, params) { + if (input) { + const bang = input.indexOf(cOptsSep); + const inputVal = parseParams(input.substr(0, bang >= 0 ? bang : undefined), params); + if (bang >= 0) { + const args = input.substr(bang + 1).split(cLSep); + input = inputVal; + if (defaultsDict) { + const defaults = defaultsDict[input]; + const opts = utils.deriveDeep(defaults, true); + args.forEach(arg => { + const pair = arg.split(cL2Ass, 2); + const key = decodeURIComponent(pair[0]); + const value = decodeURIComponent(pair[1]); + const adapter = adapters[typeof external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(defaults, key)]; + if (adapter) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].set(opts, key, adapter(value)); + } else { + logger.warn(`Unknown argument "${key}" for option "${input}"`); } - - this._parseBond(parseInt(atom.id.replace(/[^0-9]/, ''), 10), parseInt(atoms[cb.end].id.replace(/[^0-9]/, ''), 10), cb.order, cb.type); - } - } - - for (i = 0; i < this._complex.getSGroupCount(); i++) { - var sGrp = this._complex.getSGroups()[i]; - - for (j = 0; j < sGrp._atoms.length; j++) { - sGrp._atoms[j] = sGrp._atoms[j].complexAtom; - } - } - - for (i = 0; i < count; i++) { - if (this._unpackLabel(labels[i]).molId === this._unpackLabel(currentLabel).molId) { - atom = atoms[i]; - atom.complexAtom = null; - delete atom.complexAtom; + }); + if (Object.keys(opts).length > 0) { + input = [input, opts]; } } - - this._complex.originalCML = data.originalCML; - - this._fixBondsArray(); - - complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - this._serialAtomMap = null; - this._complex = null; - return complex; + } else { + input = inputVal; } - }, { - key: "parseSync", - value: function parseSync() { - var complexes = []; - var self = this; - - var moleculaSet = this._selectComponents(this._data); - - moleculaSet.forEach(function (molSet) { - molSet.curr = 2; + } + return input; +} +const actions = { + l: 'load', + load: String, + t: 'type', + type: String, + v: 'view', + view: String, + u: 'unit', + unit: Number, + menu: asBoolean, + // Commands - if (molSet.count === 0) { - molSet.count = 1; - } + o: 'object', + object(value, opts) { + const params = []; + let options = extractArgs(value, settings.defaults.objects, params); + if (!Array.isArray(options)) { + options = [options]; + } + addObject(opts, params[0], options); + }, + p: 'preset', + preset(value, opts) { + opts.preset = value; + opts.reps = null; + ensureRepList(opts); + }, + r: 'rep', + rep(value, opts) { + ensureRepList(opts); + repIndex = Number(value); + // clamp the index to one greater than the last + repIndex = repIndex <= opts.reps.length ? repIndex < 0 ? 0 : repIndex : opts.reps.length; + // create a new rep if it is adjacent to the existing ones + if (repIndex === opts.reps.length) { + // if there is no rep to derive from, derive from the first rep of the default + opts.reps[repIndex] = repIndex > 0 ? utils.deriveDeep(opts.reps[repIndex - 1], true) : utils.deriveDeep(settings.defaults.presets.default[0], true); + } + }, + s: 'select', + select(value, opts) { + ensureRepAssign(opts, 'selector', value); + }, + m: 'mode', + mode(value, opts) { + ensureRepAssign(opts, 'mode', extractArgs(value, settings.defaults.modes)); + }, + c: 'color', + color(value, opts) { + ensureRepAssign(opts, 'colorer', extractArgs(value, settings.defaults.colorers)); + }, + mt: 'material', + material(value, opts) { + ensureRepAssign(opts, 'material', extractArgs(value, settings.defaults.materials)); + }, + dup(value, opts) { + ensureRepList(opts); + const { + reps + } = opts; + const rep = reps[repIndex]; + repIndex = reps.length; + reps[repIndex] = utils.deriveDeep(rep, true); + }, + // Settings shortcuts - for (var i = 0; i < molSet.count; i++) { - molSet.curr = i + 1; - complexes.push(self._parseSet(molSet, false)); - } - }); - var totalAtomsParsed = 0; - complexes.forEach(function (c) { - totalAtomsParsed += c.getAtomCount(); - }); + ar: 'autoResolution' +}; +function _fromArray(entries) { + repIndex = 0; + const opts = {}; + for (let i = 0, n = entries.length; i < n; ++i) { + const /** string[] */entry = entries[i]; + let /** string? */key = entry[0]; + const /** string? */value = entry[1]; + let /** function|string? */action = actions[key]; + + // unwind shortcuts and aliases + while (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(action)) { + key = action; + action = actions[key]; + } - if (totalAtomsParsed <= 0) { - throw new Error('The data does not contain valid atoms'); + // either set a property or use specialized parser + if (!action) { + const adapter = adapters[typeof external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(settings.defaults, key)]; + if (adapter) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].set(opts, `settings.${key}`, adapter(value)); + } else { + logger.warn(`Unknown option "${key}"`); } - - if (complexes.length > 1) { - var joinedComplex = new Complex$2(); - joinedComplex.joinComplexes(complexes); - joinedComplex.originalCML = complexes[0].originalCML; - return joinedComplex; + } else if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isFunction(action)) { + const result = action(value, opts); + if (result !== undefined) { + opts[key] = result; } - - if (complexes.length === 1) { - return complexes[0]; + } + } + return opts; +} +function fromAttr(attr) { + return _fromArray(utils.getUrlParameters(`?${attr || ''}`)); +} +function fromURL(url) { + return _fromArray(utils.getUrlParameters(url)); +} +function _processOptsForURL(opts) { + const str = []; + let i = 0; + utils.forInRecursive(opts, (value, key) => { + str[i++] = encodeQueryComponentL2(key) + cL2Ass + encodeQueryComponentL2(value); + }); + return str.join(cLSep); +} +function _processArgsForURL(args) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isArray(args)) { + return args; + } + if (args.length < 2) { + return args[0]; + } + return `${args[0]}${cOptsSep}${_processOptsForURL(args[1])}`; +} +function _processObjForURL(objOpts) { + if (!objOpts || !objOpts.type) { + return undefined; + } + let res = objOpts.type; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isArray(objOpts.params) && objOpts.params.length > 0) { + res += `,${objOpts.params.join(',')}`; + } + if (objOpts.opts) { + res += cOptsSep + _processOptsForURL(objOpts.opts); + } + return res; +} +function toURL(opts) { + const stringList = []; + let idx = 0; + function checkAndAdd(prefix, value) { + if (value !== null && value !== undefined) { + stringList[idx++] = encodeQueryComponentL1(prefix) + cL1Ass + encodeQueryComponentL1(value); + } + } + function addReps(repList) { + if (!repList) { + return; + } + for (let i = 0, n = repList.length; i < n; ++i) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(repList[i])) { + continue; } - - return new Complex$2(); + checkAndAdd('r', i); + checkAndAdd('s', repList[i].selector); + checkAndAdd('m', _processArgsForURL(repList[i].mode)); + checkAndAdd('c', _processArgsForURL(repList[i].colorer)); + checkAndAdd('mt', _processArgsForURL(repList[i].material)); } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && cmlStartRegexp.test(data); + } + function addObjects(objList) { + if (!objList) { + return; } - }]); - - return CMLParser; -}(Parser); - -CMLParser.formats = ['cml']; -CMLParser.extensions = ['.cml']; - -var mmtf = createCommonjsModule(function (module, exports) { -!function(r,t){t(exports);}(commonjsGlobal,function(r){function t(r,t,n){for(var e=(r.byteLength,0),i=n.length;i>e;e++){var o=n.charCodeAt(e);if(128>o)r.setUint8(t++,o>>>0&127|0);else if(2048>o)r.setUint8(t++,o>>>6&31|192),r.setUint8(t++,o>>>0&63|128);else if(65536>o)r.setUint8(t++,o>>>12&15|224),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128);else {if(!(1114112>o))throw new Error("bad codepoint "+o);r.setUint8(t++,o>>>18&7|240),r.setUint8(t++,o>>>12&63|128),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128);}}}function n(r){for(var t=0,n=0,e=r.length;e>n;n++){var i=r.charCodeAt(n);if(128>i)t+=1;else if(2048>i)t+=2;else if(65536>i)t+=3;else {if(!(1114112>i))throw new Error("bad codepoint "+i);t+=4;}}return t}function e(r,i,o){var a=typeof r;if("string"===a){var u=n(r);if(32>u)return i.setUint8(o,160|u),t(i,o+1,r),1+u;if(256>u)return i.setUint8(o,217),i.setUint8(o+1,u),t(i,o+2,r),2+u;if(65536>u)return i.setUint8(o,218),i.setUint16(o+1,u),t(i,o+3,r),3+u;if(4294967296>u)return i.setUint8(o,219),i.setUint32(o+1,u),t(i,o+5,r),5+u}if(r instanceof Uint8Array){var u=r.byteLength,s=new Uint8Array(i.buffer);if(256>u)return i.setUint8(o,196),i.setUint8(o+1,u),s.set(r,o+2),2+u;if(65536>u)return i.setUint8(o,197),i.setUint16(o+1,u),s.set(r,o+3),3+u;if(4294967296>u)return i.setUint8(o,198),i.setUint32(o+1,u),s.set(r,o+5),5+u}if("number"===a){if(!isFinite(r))throw new Error("Number not finite: "+r);if(Math.floor(r)!==r)return i.setUint8(o,203),i.setFloat64(o+1,r),9;if(r>=0){if(128>r)return i.setUint8(o,r),1;if(256>r)return i.setUint8(o,204),i.setUint8(o+1,r),2;if(65536>r)return i.setUint8(o,205),i.setUint16(o+1,r),3;if(4294967296>r)return i.setUint8(o,206),i.setUint32(o+1,r),5;throw new Error("Number too big 0x"+r.toString(16))}if(r>=-32)return i.setInt8(o,r),1;if(r>=-128)return i.setUint8(o,208),i.setInt8(o+1,r),2;if(r>=-32768)return i.setUint8(o,209),i.setInt16(o+1,r),3;if(r>=-2147483648)return i.setUint8(o,210),i.setInt32(o+1,r),5;throw new Error("Number too small -0x"+(-r).toString(16).substr(1))}if(null===r)return i.setUint8(o,192),1;if("boolean"===a)return i.setUint8(o,r?195:194),1;if("object"===a){var u,f=0,c=Array.isArray(r);if(c)u=r.length;else {var d=Object.keys(r);u=d.length;}var f;if(16>u?(i.setUint8(o,u|(c?144:128)),f=1):65536>u?(i.setUint8(o,c?220:222),i.setUint16(o+1,u),f=3):4294967296>u&&(i.setUint8(o,c?221:223),i.setUint32(o+1,u),f=5),c)for(var l=0;u>l;l++)f+=e(r[l],i,o+f);else for(var l=0;u>l;l++){var v=d[l];f+=e(v,i,o+f),f+=e(r[v],i,o+f);}return f}throw new Error("Unknown type "+a)}function i(r){var t=typeof r;if("string"===t){var e=n(r);if(32>e)return 1+e;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(r instanceof Uint8Array){var e=r.byteLength;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if("number"===t){if(Math.floor(r)!==r)return 9;if(r>=0){if(128>r)return 1;if(256>r)return 2;if(65536>r)return 3;if(4294967296>r)return 5;throw new Error("Number too big 0x"+r.toString(16))}if(r>=-32)return 1;if(r>=-128)return 2;if(r>=-32768)return 3;if(r>=-2147483648)return 5;throw new Error("Number too small -0x"+r.toString(16).substr(1))}if("boolean"===t||null===r)return 1;if("object"===t){var e,o=0;if(Array.isArray(r)){e=r.length;for(var a=0;e>a;a++)o+=i(r[a]);}else {var u=Object.keys(r);e=u.length;for(var a=0;e>a;a++){var s=u[a];o+=i(s)+i(r[s]);}}if(16>e)return 1+o;if(65536>e)return 3+o;if(4294967296>e)return 5+o;throw new Error("Array or object too long 0x"+e.toString(16))}throw new Error("Unknown type "+t)}function o(r){var t=new ArrayBuffer(i(r)),n=new DataView(t);return e(r,n,0),new Uint8Array(t)}function a(r,t,n){return t?new r(t.buffer,t.byteOffset,t.byteLength/(n||1)):void 0}function u(r){return a(DataView,r)}function s(r){return a(Uint8Array,r)}function f(r){return a(Int8Array,r)}function c(r){return a(Int32Array,r,4)}function d(r){return a(Float32Array,r,4)}function l(r,t){var n=r.length/2;t||(t=new Int16Array(n));for(var e=0,i=0;n>e;++e,i+=2)t[e]=r[i]<<8^r[i+1]<<0;return t}function v(r,t){var n=r.length;t||(t=new Uint8Array(2*n));for(var e=u(t),i=0;n>i;++i)e.setInt16(2*i,r[i]);return s(t)}function g(r,t){var n=r.length/4;t||(t=new Int32Array(n));for(var e=0,i=0;n>e;++e,i+=4)t[e]=r[i]<<24^r[i+1]<<16^r[i+2]<<8^r[i+3]<<0;return t}function L(r,t){var n=r.length;t||(t=new Uint8Array(4*n));for(var e=u(t),i=0;n>i;++i)e.setInt32(4*i,r[i]);return s(t)}function h(r,t){var n=r.length;t||(t=new Float32Array(n/4));for(var e=u(t),i=u(r),o=0,a=0,s=n/4;s>o;++o,a+=4)e.setFloat32(a,i.getFloat32(a),!0);return t}function y(r,t,n){var e=r.length,i=1/t;n||(n=new Float32Array(e));for(var o=0;e>o;++o)n[o]=r[o]*i;return n}function m(r,t,n){var e=r.length;n||(n=new Int32Array(e));for(var i=0;e>i;++i)n[i]=Math.round(r[i]*t);return n}function p(r,t){var n,e;if(!t){var i=0;for(n=0,e=r.length;e>n;n+=2)i+=r[n+1];t=new r.constructor(i);}var o=0;for(n=0,e=r.length;e>n;n+=2)for(var a=r[n],u=r[n+1],s=0;u>s;++s)t[o]=a,++o;return t}function U(r){if(0===r.length)return new Int32Array;var t,n,e=2;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]&&(e+=2);var i=new Int32Array(e),o=0,a=1;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]?(i[o]=r[t-1],i[o+1]=a,a=1,o+=2):++a;return i[o]=r[r.length-1],i[o+1]=a,i}function b(r,t){var n=r.length;t||(t=new r.constructor(n)),n&&(t[0]=r[0]);for(var e=1;n>e;++e)t[e]=r[e]+t[e-1];return t}function I(r,t){var n=r.length;t||(t=new r.constructor(n)),t[0]=r[0];for(var e=1;n>e;++e)t[e]=r[e]-r[e-1];return t}function w(r,t){var n,e,i=r instanceof Int8Array?127:32767,o=-i-1,a=r.length;if(!t){var u=0;for(n=0;a>n;++n)r[n]o&&++u;t=new Int32Array(u);}for(n=0,e=0;a>n;){for(var s=0;r[n]===i||r[n]===o;)s+=r[n],++n;s+=r[n],++n,t[e]=s,++e;}return t}function C(r,t){var n,e=t?127:32767,i=-e-1,o=r.length,a=0;for(n=0;o>n;++n){var u=r[n];0===u?++a:a+=u===e||u===i?2:u>0?Math.ceil(u/e):Math.ceil(u/i);}var s=t?new Int8Array(a):new Int16Array(a),f=0;for(n=0;o>n;++n){var u=r[n];if(u>=0)for(;u>=e;)s[f]=e,++f,u-=e;else for(;i>=u;)s[f]=i,++f,u-=i;s[f]=u,++f;}return s}function A(r,t){return b(p(r),t)}function x(r){return U(I(r))}function M(r,t,n){return y(p(r,c(n)),t,n)}function F(r,t){return U(m(r,t))}function S(r,t,n){return y(b(r,c(n)),t,n)}function E(r,t,n){return I(m(r,t),n)}function N(r,t,n){return y(w(r,c(n)),t,n)}function O(r,t,n){var e=w(r,c(n));return S(e,t,d(e))}function T(r,t,n){return C(E(r,t),n)}function k(r){var t=u(r),n=t.getInt32(0),e=t.getInt32(4),i=r.subarray(8,12),r=r.subarray(12);return [n,r,e,i]}function j(r,t,n,e){var i=new ArrayBuffer(12+e.byteLength),o=new Uint8Array(i),a=new DataView(i);return a.setInt32(0,r),a.setInt32(4,t),n&&o.set(n,8),o.set(e,12),o}function q(r){var t=r.length,n=s(r);return j(2,t,void 0,n)}function D(r){var t=r.length,n=L(r);return j(4,t,void 0,n)}function P(r,t){var n=r.length/t,e=L([t]),i=s(r);return j(5,n,e,i)}function z(r){var t=r.length,n=L(U(r));return j(6,t,void 0,n)}function B(r){var t=r.length,n=L(x(r));return j(8,t,void 0,n)}function V(r,t){var n=r.length,e=L([t]),i=L(F(r,t));return j(9,n,e,i)}function G(r,t){var n=r.length,e=L([t]),i=v(T(r,t));return j(10,n,e,i)}function R(r){var t={};return rr.forEach(function(n){void 0!==r[n]&&(t[n]=r[n]);}),r.bondAtomList&&(t.bondAtomList=D(r.bondAtomList)),r.bondOrderList&&(t.bondOrderList=q(r.bondOrderList)),t.xCoordList=G(r.xCoordList,1e3),t.yCoordList=G(r.yCoordList,1e3),t.zCoordList=G(r.zCoordList,1e3),r.bFactorList&&(t.bFactorList=G(r.bFactorList,100)),r.atomIdList&&(t.atomIdList=B(r.atomIdList)),r.altLocList&&(t.altLocList=z(r.altLocList)),r.occupancyList&&(t.occupancyList=V(r.occupancyList,100)),t.groupIdList=B(r.groupIdList),t.groupTypeList=D(r.groupTypeList),r.secStructList&&(t.secStructList=q(r.secStructList)),r.insCodeList&&(t.insCodeList=z(r.insCodeList)),r.sequenceIndexList&&(t.sequenceIndexList=B(r.sequenceIndexList)),t.chainIdList=P(r.chainIdList,4),r.chainNameList&&(t.chainNameList=P(r.chainNameList,4)),t}function H(r){function t(r){for(var t={},n=0;r>n;n++){var e=o();t[e]=o();}return t}function n(t){var n=r.subarray(a,a+t);return a+=t,n}function e(t){var n=r.subarray(a,a+t);a+=t;var e=65535;if(t>e){for(var i=[],o=0;on;n++)t[n]=o();return t}function o(){var o,s,f=r[a];if(0===(128&f))return a++,f;if(128===(240&f))return s=15&f,a++,t(s);if(144===(240&f))return s=15&f,a++,i(s);if(160===(224&f))return s=31&f,a++,e(s);if(224===(224&f))return o=u.getInt8(a),a++,o;switch(f){case 192:return a++,null;case 194:return a++,!1;case 195:return a++,!0;case 196:return s=u.getUint8(a+1),a+=2,n(s);case 197:return s=u.getUint16(a+1),a+=3,n(s);case 198:return s=u.getUint32(a+1),a+=5,n(s);case 202:return o=u.getFloat32(a+1),a+=5,o;case 203:return o=u.getFloat64(a+1),a+=9,o;case 204:return o=r[a+1],a+=2,o;case 205:return o=u.getUint16(a+1),a+=3,o;case 206:return o=u.getUint32(a+1),a+=5,o;case 208:return o=u.getInt8(a+1),a+=2,o;case 209:return o=u.getInt16(a+1),a+=3,o;case 210:return o=u.getInt32(a+1),a+=5,o;case 217:return s=u.getUint8(a+1),a+=2,e(s);case 218:return s=u.getUint16(a+1),a+=3,e(s);case 219:return s=u.getUint32(a+1),a+=5,e(s);case 220:return s=u.getUint16(a+1),a+=3,i(s);case 221:return s=u.getUint32(a+1),a+=5,i(s);case 222:return s=u.getUint16(a+1),a+=3,t(s);case 223:return s=u.getUint32(a+1),a+=5,t(s)}throw new Error("Unknown type 0x"+f.toString(16))}var a=0,u=new DataView(r.buffer);return o()}function W(r,t,n,e){switch(r){case 1:return h(t);case 2:return f(t);case 3:return l(t);case 4:return g(t);case 5:return s(t);case 6:return p(g(t),new Uint8Array(n));case 7:return p(g(t));case 8:return A(g(t));case 9:return M(g(t),g(e)[0]);case 10:return O(l(t),g(e)[0]);case 11:return y(l(t),g(e)[0]);case 12:return N(l(t),g(e)[0]);case 13:return N(f(t),g(e)[0]);case 14:return w(l(t));case 15:return w(f(t))}}function X(r,t){t=t||{};var n=t.ignoreFields,e={};return nr.forEach(function(t){var i=n?-1!==n.indexOf(t):!1,o=r[t];i||void 0===o||(o instanceof Uint8Array?e[t]=W.apply(null,k(o)):e[t]=o);}),e}function J(r){return String.fromCharCode.apply(null,r).replace(/\0/g,"")}function K(r,t,n){n=n||{};var e,i,o,a,u,s,f=n.firstModelOnly,c=t.onModel,d=t.onChain,l=t.onGroup,v=t.onAtom,g=t.onBond,L=0,h=0,y=0,m=0,p=0,U=-1,b=r.chainNameList,I=r.secStructList,w=r.insCodeList,C=r.sequenceIndexList,A=r.atomIdList,x=r.bFactorList,M=r.altLocList,F=r.occupancyList,S=r.bondAtomList,E=r.bondOrderList;for(e=0,i=r.chainsPerModel.length;i>e&&!(f&&L>0);++e){var N=r.chainsPerModel[L];for(c&&c({chainCount:N,modelIndex:L}),o=0;N>o;++o){var O=r.groupsPerChain[h];if(d){var T=J(r.chainIdList.subarray(4*h,4*h+4)),k=null;b&&(k=J(b.subarray(4*h,4*h+4))),d({groupCount:O,chainIndex:h,modelIndex:L,chainId:T,chainName:k});}for(a=0;O>a;++a){var j=r.groupList[r.groupTypeList[y]],q=j.atomNameList.length;if(l){var D=null;I&&(D=I[y]);var P=null;r.insCodeList&&(P=String.fromCharCode(w[y]));var z=null;C&&(z=C[y]),l({atomCount:q,groupIndex:y,chainIndex:h,modelIndex:L,groupId:r.groupIdList[y],groupType:r.groupTypeList[y],groupName:j.groupName,singleLetterCode:j.singleLetterCode,chemCompType:j.chemCompType,secStruct:D,insCode:P,sequenceIndex:z});}for(u=0;q>u;++u){if(v){var B=null;A&&(B=A[m]);var V=null;x&&(V=x[m]);var G=null;M&&(G=String.fromCharCode(M[m]));var R=null;F&&(R=F[m]),v({atomIndex:m,groupIndex:y,chainIndex:h,modelIndex:L,atomId:B,element:j.elementList[u],atomName:j.atomNameList[u],formalCharge:j.formalChargeList[u],xCoord:r.xCoordList[m],yCoord:r.yCoordList[m],zCoord:r.zCoordList[m],bFactor:V,altLoc:G,occupancy:R});}m+=1;}if(g){var H=j.bondAtomList;for(u=0,s=j.bondOrderList.length;s>u;++u)g({atomIndex1:m-q+H[2*u],atomIndex2:m-q+H[2*u+1],bondOrder:j.bondOrderList[u]});}y+=1;}h+=1;}if(p=U+1,U=m-1,g&&S)for(u=0,s=S.length;s>u;u+=2){var W=S[u],X=S[u+1];(W>=p&&U>=W||X>=p&&U>=X)&&g({atomIndex1:W,atomIndex2:X,bondOrder:E?E[u/2]:null});}L+=1;}}function Q(r){return o(R(r))}function Y(r,t){r instanceof ArrayBuffer&&(r=new Uint8Array(r));var n;return n=r instanceof Uint8Array?H(r):r,X(n,t)}function Z(r,t,n,e){function i(){try{var r=Y(o.response);n(r);}catch(t){e(t);}}var o=new XMLHttpRequest;o.addEventListener("load",i,!0),o.addEventListener("error",e,!0),o.responseType="arraybuffer",o.open("GET",t+r.toUpperCase()),o.send();}function $(r,t,n){Z(r,or,t,n);}function _(r,t,n){Z(r,ar,t,n);}var rr=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"],tr=["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"],nr=rr.concat(tr),er="v1.1.0dev",ir="//mmtf.rcsb.org/v1.0/",or=ir+"full/",ar=ir+"reduced/";r.encode=Q,r.decode=Y,r.traverse=K,r.fetch=$,r.fetchReduced=_,r.version=er,r.fetchUrl=or,r.fetchReducedUrl=ar,r.encodeMsgpack=o,r.encodeMmtf=R,r.decodeMsgpack=H,r.decodeMmtf=X;}); -}); - -var Complex$3 = chem.Complex, - Chain$1 = chem.Chain, - Atom$1 = chem.Atom, - Element$4 = chem.Element, - Helix$2 = chem.Helix, - Sheet$2 = chem.Sheet, - Strand$2 = chem.Strand, - Bond$3 = chem.Bond, - Assembly$2 = chem.Assembly, - Molecule$2 = chem.Molecule; - -var ArrayComparator = /*#__PURE__*/function () { - function ArrayComparator(original) { - classCallCheck(this, ArrayComparator); - - this._original = Array.from(original); - - this._original.sort(); - - this._sum = 0; - - for (var i = 0; i < this._original.length; ++i) { - this._sum += this._original[i]; + for (let i = 0, n = objList.length; i < n; ++i) { + checkAndAdd('o', _processObjForURL(objList[i])); } } - - createClass(ArrayComparator, [{ - key: "compare", - value: function compare(candidate) { - var len = candidate.length; - - if (len !== this._original.length) { - return false; - } - - var sum = 0; - var i; - - for (i = 0; i < len; ++i) { - sum += candidate[i]; - } - - if (sum !== this._sum) { - return false; - } - - var sorted = Array.from(candidate); - sorted.sort(); - - for (i = 0; i < len; ++i) { - if (sorted[i] !== this._original[i]) { - return false; - } - } - - return true; + checkAndAdd('l', opts.load); + checkAndAdd('u', opts.unit); + checkAndAdd('p', opts.preset); + addReps(opts.reps); + addObjects(opts._objects); + checkAndAdd('v', opts.view); + utils.forInRecursive(opts.settings, (value, key) => { + // I heard these lines in the whispers of the Gods + // Handle preset setting in reps + if (key === 'preset') { + return; } - }]); - - return ArrayComparator; -}(); - -ArrayComparator.prototype.constructor = ArrayComparator; -var StructuralElementType$5 = StructuralElement.Type; // see https://github.com/rcsb/mmtf-javascript/blob/master/src/mmtf-traverse.js - -var secStructToType = [StructuralElementType$5.HELIX_PI, // 0 -StructuralElementType$5.BEND, // 1 -StructuralElementType$5.HELIX_ALPHA, // 2 -StructuralElementType$5.STRAND, // 3 -StructuralElementType$5.HELIX_310, // 4 -StructuralElementType$5.BRIDGE, // 5 -StructuralElementType$5.TURN, // 6 -StructuralElementType$5.COIL // 7 -]; - -function getFirstByte(buf) { - var bytes = new Uint8Array(buf, 0, 1); - return bytes[0]; + checkAndAdd(key, value); + }); + let url = ''; + if (typeof window !== 'undefined') { + const { + location + } = window; + url = `${location.protocol}//${location.host}${location.pathname}`; + } + if (stringList.length > 0) { + url += `?${stringList.join('&')}`; + } + return url; } - -var MMTFParser = /*#__PURE__*/function (_Parser) { - inherits(MMTFParser, _Parser); - - function MMTFParser(data, options) { - var _this; - - classCallCheck(this, MMTFParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(MMTFParser).call(this, data, options)); - _this._options.fileType = 'mmtf'; - return _this; +function _processOptsForScript(opts) { + const str = []; + let i = 0; + utils.forInRecursive(opts, (value, key) => { + str[i++] = `${key}=${utils.enquoteString(value)}`; + }); + return str.join(' '); +} +function _processArgsForScript(args) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isArray(args)) { + return args; + } + if (args.length < 2) { + return args[0]; + } + return `${args[0]} ${_processOptsForScript(args[1])}`; +} +function _processObjForScript(objOpts) { + if (!objOpts || !objOpts.type) { + return undefined; + } + let res = objOpts.type; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isArray(objOpts.params) && objOpts.params.length > 0) { + res += ` ${objOpts.params.map(utils.enquoteString).join(' ')}`; + } + if (objOpts.opts) { + res += ` ${_processOptsForScript(objOpts.opts)}`; + } + return res; +} +function _processRepsForScript(rep, index) { + const repString = []; + let strIdx = 0; + function localAdd(prefix, value) { + if (value !== null && value !== undefined) { + repString[strIdx++] = prefix + value; + } } - - createClass(MMTFParser, [{ - key: "_onModel", - value: function _onModel(_modelData) {} - }, { - key: "_onChain", - value: function _onChain(chainData) { - if (chainData.modelIndex !== 0) { - return; - } - - var chain = new Chain$1(this._complex, chainData.chainName); - this._complex._chains[chainData.chainIndex] = chain; - chain._index = chainData.chainIndex; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(rep)) { + return null; + } + localAdd('', index); + localAdd('s=', utils.enquoteString(rep.selector)); + localAdd('m=', _processArgsForScript(rep.mode)); + localAdd('c=', _processArgsForScript(rep.colorer)); + localAdd('mt=', _processArgsForScript(rep.material)); + return repString.join(' '); +} +function toScript(opts) { + const commandsList = []; + let idx = 0; + function checkAndAdd(command, value, saveQuotes) { + if (value !== null && value !== undefined) { + const quote = typeof value === 'string' && saveQuotes ? '"' : ''; + commandsList[idx++] = `${command} ${quote}${value}${quote}`.trim(); } - }, { - key: "_onGroup", - value: function _onGroup(groupData) { - if (groupData.modelIndex !== 0) { - return; - } - - if (this.settings.now.nowater) { - // skip water - if (groupData.groupName === 'HOH' || groupData.groupName === 'WAT') { - return; - } - } - - var chain = this._complex._chains[groupData.chainIndex]; - var icode = !groupData.insCode.charCodeAt(0) ? '' : groupData.insCode; - var residue = chain.addResidue(groupData.groupName, groupData.groupId, icode); - residue._index = groupData.groupIndex; - - this._updateSecStructure(this._complex, residue, groupData); + } + function addReps(repList) { + if (!repList) { + return; } - }, { - key: "_onAtom", - value: function _onAtom(atomData) { - if (atomData.modelIndex !== 0) { - return; - } - - var altLoc = !atomData.altLoc.charCodeAt(0) ? '' : atomData.altLoc; - var atom = new Atom$1(atomData.groupIndex, // we store residue index here to replace it later with actual reference - atomData.atomName, Element$4.getByName(atomData.element.toUpperCase()), new Vector3(atomData.xCoord, atomData.yCoord, atomData.zCoord), Element$4.Role[atomData.atomName], false, // hetero atoms will be marked later - atomData.atomId, altLoc, atomData.occupancy, atomData.bFactor, atomData.formalCharge); - this._complex._atoms[atomData.atomIndex] = atom; - atom.index = atomData.atomIndex; - this._serialAtomMap[atomData.atomId] = atom; + for (let i = 0, n = repList.length; i < n; ++i) { + checkAndAdd('rep', _processRepsForScript(repList[i], i)); } - }, { - key: "_onBond", - value: function _onBond(bondData) { - var right = Math.max(bondData.atomIndex1, bondData.atomIndex2); - - if (right >= this._complex._atoms.length) { - return; - } - - var left = Math.min(bondData.atomIndex1, bondData.atomIndex2); - - this._complex.addBond(this._complex._atoms[left], this._complex._atoms[right], bondData.bondOrder, Bond$3.BondType.UNKNOWN, true); + } + function addObjects(objList) { + if (!objList) { + return; } - }, { - key: "_updateSecStructure", - value: function _updateSecStructure(complex, residue, groupData) { - var helixClasses = [3, -1, 1, -1, 5]; - - if (!_.isUndefined(groupData) && groupData.secStruct === this._ssType) { - residue._secondary = this._ssStruct; - - if (this._ssStruct) { - this._ssStruct.term = residue; - } - - return; - } - - if (!_.isUndefined(groupData)) { - // start new secondary structure - var type = secStructToType[groupData.secStruct]; - this._ssType = groupData.secStruct; - this._ssStart = residue; - var struct = null; - - switch (this._ssType) { - case -1: // undefined - - case 7: - // coil - break; - - case 0: // pi helix - - case 2: // alpha helix - - case 4: - // 3-10 helix - struct = new Helix$2(helixClasses[this._ssType], residue, residue, 0, '', '', 0); - - complex._helices.push(struct); - - break; - - case 3: - { - // extended - var sheet = new Sheet$2('', 0); - - complex._sheets.push(sheet); - - struct = new Strand$2(sheet, residue, residue, 0, null, null); - break; - } - - default: - if (type !== undefined) { - struct = new StructuralElement(type, residue, residue); - } - - break; - } - - this._ssStruct = struct; - residue._secondary = struct; - - if (struct) { - complex.structures.push(struct); - } - } + for (let i = 0, n = objList.length; i < n; ++i) { + checkAndAdd('', _processObjForScript(objList[i])); } - }, { - key: "_updateMolecules", - value: function _updateMolecules(mmtfData) { - var entities = mmtfData.entityList; - - if (!entities) { - return; - } - - var chainsInModel0 = mmtfData.chainsPerModel[0]; - - for (var i = 0; i < entities.length; i++) { - var entity = entities[i]; - var chains = entity.chainIndexList; - var residues = []; - - for (var j = 0; j < chains.length; j++) { - var chainIndex = chains[j]; // skip chains in models other than the first one - - if (chainIndex >= chainsInModel0) { - continue; - } - - var chain = this._complex._chains[chainIndex]; - residues = residues.concat(chain._residues.slice()); - } - - var molecule = new Molecule$2(this._complex, entity.description, i + 1); - molecule.residues = residues; - this._complex._molecules[i] = molecule; - } - } // populate complex with chains, residues and atoms - - }, { - key: "_traverse", - value: function _traverse(mmtfData) { - var self = this; // get metadata - - var metadata = this._complex.metadata; - metadata.id = mmtfData.structureId; - metadata.title = []; - metadata.title[0] = mmtfData.title; - metadata.date = mmtfData.releaseDate; - metadata.format = 'mmtf'; // create event callback functions - - var eventCallbacks = { - onModel: function onModel(modelData) { - self._onModel(modelData); - }, - onChain: function onChain(chainData) { - self._onChain(chainData); - }, - onGroup: function onGroup(groupData) { - self._onGroup(groupData); - }, - onAtom: function onAtom(atomData) { - self._onAtom(atomData); - }, - onBond: function onBond(bondData) { - self._onBond(bondData); - } - }; // temporary variables used during traversal to track secondary structures - - this._ssType = -1; - this._ssStruct = null; - this._ssStart = null; // traverse the structure and listen to the events - - mmtf.traverse(mmtfData, eventCallbacks); - - this._updateSecStructure(this._complex); - - this._updateMolecules(mmtfData); - } // During traversal atoms and residues don't come sequentially - // so a residue for certain atom can be unavailable. Thus we - // store residue index in atom. - // This function being called after traversal replaces the index - // with actual reference, and also populates atom lists in residues. - - }, { - key: "_linkAtomsToResidues", - value: function _linkAtomsToResidues() { - for (var i = 0; i < this._complex._atoms.length; ++i) { - var atom = this._complex._atoms[i]; - var residue = this._complex._residues[atom.residue]; - atom.residue = residue; - - residue._atoms.push(atom); - } + } + checkAndAdd('set', 'autobuild false'); + checkAndAdd('load', opts.load, true); + checkAndAdd('unit', opts.unit); + checkAndAdd('preset', opts.preset); + addReps(opts.reps); + addObjects(opts._objects); + utils.forInRecursive(opts.settings, (value, key) => { + // I heard these lines in the whispers of the Gods + // Handle preset setting in reps + if (key === 'preset') { + return; } - }, { - key: "_findSynonymousChains", - value: function _findSynonymousChains() { - var named = {}; - - for (var i = 0; i < this._complex._chains.length; ++i) { - var chain = this._complex._chains[i]; - var name = chain.getName(); - - if (!named.hasOwnProperty(name)) { - named[name] = []; - } - - named[name].push(chain._index); - } - - return named; - } // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains. - - }, { - key: "_parseAssemblyInfo", - value: function _parseAssemblyInfo(mmtfData) { - var i; - var j; - var k; - var assemblies = []; - var logger = this.logger; - - for (i = 0; i < mmtfData.bioAssemblyList.length; ++i) { - var baInfo = mmtfData.bioAssemblyList[i]; - - if (baInfo.transformList.length === 0) { - continue; - } - - var chains = baInfo.transformList[0].chainIndexList; - var chainListCheck = new ArrayComparator(chains); // build list of chain names - - var chainNames = {}; - - for (j = 0; j < chains.length; ++j) { - chainNames[this._complex._chains[chains[j]].getName()] = 1; - } // all chains with the same name should belong to assembly if one of them belongs - - - var allChains = []; - var name = void 0; - - for (name in chainNames) { - if (chainNames.hasOwnProperty(name)) { - // just concat arrays -- there should be no duplicates - Array.prototype.push.apply(allChains, this._chainsByName[name]); - } - } - - if (!chainListCheck.compare(allChains)) { - // assembly is missing some of the chains - logger.debug('MMTF: Assembly is missing some of the synonymous chains. Skipping...'); - } - - var a = new Assembly$2(this._complex); // add chains to assembly - - for (name in chainNames) { - if (chainNames.hasOwnProperty(name)) { - a.addChain(name); - } - } // add unique matrices to assembly - - - a.addMatrix(new Matrix4().fromArray(baInfo.transformList[0].matrix).transpose()); - - for (j = 1; j < baInfo.transformList.length; ++j) { - var transform = baInfo.transformList[j]; - - if (!chainListCheck.compare(transform.chainIndexList)) { - // list of chains for this transform doesn't match that for other transforms - // this is illegal in our structure - logger.debug('MMTF: Chain lists differ for different transforms in one assembly. Skipping...'); - continue; - } - - var m = new Matrix4().fromArray(transform.matrix).transpose(); // check if matrix is already in the list - - for (k = 0; k < a.matrices.length; ++k) { - if (a.matrices[k].equals(m)) { - break; - } - } - - if (k === a.matrices.length) { - a.addMatrix(m); - } - } - - a.finalize(); - assemblies.push(a); - } - - return assemblies; - } // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains. - - }, { - key: "_markHeteroAtoms", - value: function _markHeteroAtoms(mmtfData) { - var chainsInModel0 = mmtfData.chainsPerModel[0]; - - for (var i = 0; i < mmtfData.entityList.length; ++i) { - var entity = mmtfData.entityList[i]; - - if (entity.type !== 'polymer') { - for (var j = 0; j < entity.chainIndexList.length; ++j) { - var chainIndex = entity.chainIndexList[j]; // skip chains in models other than the first one - - if (chainIndex >= chainsInModel0) { - continue; - } - - var chain = this._complex._chains[chainIndex]; - - for (var k = 0; k < chain._residues.length; ++k) { - var res = chain._residues[k]; - - for (var m = 0; m < res._atoms.length; ++m) { - res._atoms[m].het = true; - } - } - } - } - } - } // joins chains with the same name into single chain - - }, { - key: "_joinSynonymousChains", - value: function _joinSynonymousChains() { - var i; - var j; - var primaryChainsArray = []; - var primaryChainsHash = {}; // join chains - - for (i = 0; i < this._complex._chains.length; ++i) { - var chain = this._complex._chains[i]; - var name = chain.getName(); - - if (!primaryChainsHash.hasOwnProperty(name)) { - // new name -- this is a primary chain - primaryChainsHash[name] = chain; - chain._index = primaryChainsArray.length; // update index as this array will later replace original chain list - - primaryChainsArray.push(chain); - continue; - } // this chain should be joined with the primary chain of the same name - - - var primary = primaryChainsHash[name]; - - for (j = 0; j < chain._residues.length; ++j) { - var residue = chain._residues[j]; - - primary._residues.push(residue); - - residue._chain = primary; - } - } // replace chains list with one containing only primary chains - // dropping references to all chains but primary + checkAndAdd(`set ${key}`, value, true); + }); + checkAndAdd('view', opts.view); + checkAndAdd('set', 'autobuild true'); + return commandsList.join('\n'); +} +/* harmony default export */ const options = ({ + fromURL, + fromAttr, + adapters, + toURL, + toScript +}); +;// CONCATENATED MODULE: ./src/chem/Atom.js +/** + * Atom measurements. + * + * @param {Residue} residue - (required) Residue containing the atom + * @param {string} name - (required) Name, unique in the residue + * @param {Element} type - (required) Chemical element reference + * @param {THREE.Vector3} position - Registered coordinates + * + * @param {number} role - Role of atom inside monomer: Lead and wing are particularity interesting + * @param {boolean} het - Non-standard residue indicator + * + * @param {number} serial - Serial number, unique in the model + * @param {string} location - Alternative location indicator (usually space or A-Z) + * @param {number} occupancy - Occupancy percentage, from 0 to 1 + * @param {number} temperature - Temperature + * @param {number} charge - Charge + * + * @exports Atom + * @constructor + */ +class Atom { + constructor(residue, name, type, position, role, het, serial, location, occupancy, temperature, charge) { + this.index = -1; + this.residue = residue; + this.name = name; + this.element = type; + this.position = position; + this.role = role; + this.mask = 1 | 0; + this.het = het; + this.serial = serial; + this.location = (location || ' ').charCodeAt(0); + this.occupancy = occupancy || 1; + this.temperature = temperature; + this.charge = charge; + this.hydrogenCount = -1; // explicitly invalid + this.radicalCount = 0; + this.valence = -1; // explicitly invalid - this._complex._chains = primaryChainsArray; + this.bonds = []; + this.flags = 0x0000; + if (type.name === 'H') { + this.flags |= Atom.Flags.HYDROGEN; + } else if (type.name === 'C') { + this.flags |= Atom.Flags.CARBON; } - }, { - key: "parseSync", - value: function parseSync() { - var mmtfData = mmtf.decode(this._data); - this._complex = new Complex$3(); - this._serialAtomMap = {}; // filled during traversal - - this._traverse(mmtfData); - - this._linkAtomsToResidues(); - - this._markHeteroAtoms(mmtfData); - - this._chainsByName = this._findSynonymousChains(); - Array.prototype.push.apply(this._complex.units, this._parseAssemblyInfo(mmtfData)); - - this._joinSynonymousChains(); - - this._complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - - return this._complex; + } + isHet() { + return this.het; + } + isHydrogen() { + return this.element.number === 1; + } + getVisualName() { + const { + name + } = this; + if (name.length > 0) { + return name; } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - // check if it's binary MessagePack format containing a map (dictionary) - // see https://github.com/msgpack/msgpack/blob/master/spec.md - return _.isArrayBuffer(data) && (getFirstByte(data) | 1) === 0xDF; + return this.element.name.trim(); + } + forEachBond(process) { + const { + bonds + } = this; + for (let i = 0, n = bonds.length; i < n; ++i) { + process(bonds[i]); } - }]); - - return MMTFParser; -}(Parser); - -MMTFParser.formats = ['mmtf']; -MMTFParser.extensions = ['.mmtf']; -MMTFParser.binary = true; - -var ParsingError = /*#__PURE__*/function (_Error) { - inherits(ParsingError, _Error); - - function ParsingError(message, line, column) { - var _this; - - classCallCheck(this, ParsingError); - - _this = possibleConstructorReturn(this, getPrototypeOf(ParsingError).call(this, "data:".concat(line, ":").concat(column, ": ").concat(message))); - - if (Error.captureStackTrace) { - Error.captureStackTrace(assertThisInitialized(_this), ParsingError); + } + getFullName() { + let name = ''; + if (this.residue !== null) { + if (this.residue._chain !== null) { + name += `${this.residue._chain.getName()}.`; + } + name += `${this.residue._sequence}.`; } - - _this.name = 'ParsingError'; - _this.parseLine = line; - _this.parseColumn = column; - return _this; + name += this.name; + return name; } - return ParsingError; -}( /*#__PURE__*/wrapNativeSuper(Error)); - -function _isWhitespace(ch) { - return ch === 32 || ch === 10 || ch === 13 || ch === 9; + /** + * Enumeration of atom flag values. + * + * @enum {number} + * @readonly + */ + static Flags = { + CARBON: 0x0001, + // OXYGEN: 0x0002, + // NITROGEN: 0x0004, + HYDROGEN: 0x0008, + /** Non-polar hydrogen (it is also a HYDROGEN) */ + NONPOLARH: 0x1008 + }; } +/* harmony default export */ const chem_Atom = (Atom); +;// CONCATENATED MODULE: ./src/chem/Element.js +class Element { + constructor(number, name, fullName, weight, radius, radiusBonding, hValency) { + this.number = number; + this.name = name; + this.fullName = fullName; + this.weight = weight; + this.radius = radius; + this.radiusBonding = radiusBonding; + this.hydrogenValency = hValency; + } + static Constants = { + /* eslint-disable no-magic-numbers */ + U1: 1, + Lead: 2, + U2: 3, + Wing: 4, + U18: 18 + /* eslint-enable no-magic-numbers */ + }; + static Role = (() => ({ + /* eslint-disable no-magic-numbers */ + N: Element.Constants.U1, + CA: Element.Constants.Lead, + C: Element.Constants.U2, + O: Element.Constants.Wing, + SG: Element.Constants.U18 + /* eslint-enable no-magic-numbers */ + }))(); -function _inlineIndexOf(ch0, str, idx) { - var len = str.length; - var ch = -1; + // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. + static ByAtomicNumber = (() => [/* eslint-disable no-magic-numbers */ + null, new Element(1, 'H', 'Hydrogen', 1.008, 1.2, 0.23, [1]), new Element(2, 'HE', 'Helium', 4.003, 1.4, 0.93, [0]), new Element(3, 'LI', 'Lithium', 6.941, 1.82, 0.68, [1]), new Element(4, 'BE', 'Beryllium', 9.012, 1.7, 0.35, [2]), new Element(5, 'B', 'Boron', 10.81, 2.08, 0.83, [3]), new Element(6, 'C', 'Carbon', 12.011, 1.95, 0.68, [4]), new Element(7, 'N', 'Nitrogen', 14.007, 1.85, 0.68, [3, 5]), new Element(8, 'O', 'Oxygen', 15.999, 1.7, 0.68, [2, 4]), new Element(9, 'F', 'Fluorine', 18.998, 1.73, 0.64, [1]), new Element(10, 'NE', 'Neon', 20.18, 1.54, 1.12, [0]), new Element(11, 'NA', 'Sodium', 22.99, 2.27, 0.97, [1]), new Element(12, 'MG', 'Magnesium', 24.305, 1.73, 1.1, [2]), new Element(13, 'AL', 'Aluminum', 26.981, 2.05, 1.35, [3]), new Element(14, 'SI', 'Silicon', 28.086, 2.1, 1.2, [4]), new Element(15, 'P', 'Phosphorus', 30.974, 2.08, 0.75, [3, 5]), new Element(16, 'S', 'Sulfur', 32.07, 2, 1.02, [2, 4, 6]), new Element(17, 'CL', 'Chlorine', 35.453, 1.97, 0.99, [1, 3, 5, 7]), new Element(18, 'AR', 'Argon', 39.948, 1.88, 1.57, [0]), new Element(19, 'K', 'Potassium', 39.1, 2.75, 1.33, [1]), new Element(20, 'CA', 'Calcium', 40.08, 1.973, 0.99, [2]), new Element(21, 'SC', 'Scandium', 44.956, 1.7, 1.44, [0]), new Element(22, 'TI', 'Titanium', 47.88, 1.7, 1.47, [0]), new Element(23, 'V', 'Vanadium', 50.941, 1.7, 1.33, [0]), new Element(24, 'CR', 'Chromium', 52, 1.7, 1.35, [0]), new Element(25, 'MN', 'Manganese', 54.938, 1.7, 1.35, [0]), new Element(26, 'FE', 'Iron', 55.847, 1.7, 1.34, [0]), new Element(27, 'CO', 'Cobalt', 58.93, 1.7, 1.33, [0]), new Element(28, 'NI', 'Nickel', 58.69, 1.63, 1.5, [0]), new Element(29, 'CU', 'Copper', 63.55, 1.4, 1.52, [0]), new Element(30, 'ZN', 'Zinc', 65.39, 1.39, 1.45, [0]), new Element(31, 'GA', 'Gallium', 69.72, 1.87, 1.22, [3]), new Element(32, 'GE', 'Germanium', 72.61, 1.7, 1.17, [4]), new Element(33, 'AS', 'Arsenic', 74.92, 1.85, 1.21, [3, 5]), new Element(34, 'SE', 'Selenium', 78.96, 1.9, 1.22, [2, 4, 6]), new Element(35, 'BR', 'Bromine', 79.9, 2.1, 1.21, [1, 3, 5, 7]), new Element(36, 'KR', 'Krypton', 83.8, 2.02, 1.91, [0]), new Element(37, 'RB', 'Rubidium', 85.47, 1.7, 1.47, [1]), new Element(38, 'SR', 'Strontium', 87.62, 1.7, 1.12, [2]), new Element(39, 'Y', 'Yttrium', 88.91, 1.7, 1.78, [0]), new Element(40, 'ZR', 'Zirconium', 91.22, 1.7, 1.56, [0]), new Element(41, 'NB', 'Niobium', 92.91, 1.7, 1.48, [0]), new Element(42, 'MO', 'Molybdenum', 95.94, 1.7, 1.47, [0]), new Element(43, 'TC', 'Technetium', 98.91, 1.7, 1.35, [0]), new Element(44, 'RU', 'Ruthenium', 101.07, 1.7, 1.4, [0]), new Element(45, 'RH', 'Rhodium', 102.91, 1.7, 1.45, [0]), new Element(46, 'PD', 'Palladium', 106.42, 1.63, 1.5, [0]), new Element(47, 'AG', 'Silver', 107.87, 1.72, 1.59, [0]), new Element(48, 'CD', 'Cadmium', 112.41, 1.58, 1.69, [0]), new Element(49, 'IN', 'Indium', 114.82, 1.93, 1.63, [3]), new Element(50, 'SN', 'Tin', 118.71, 2.17, 1.46, [2, 4]), new Element(51, 'SB', 'Antimony', 121.75, 2.2, 1.46, [3, 5]), new Element(52, 'TE', 'Tellurium', 127.6, 2.06, 1.47, [2, 4, 6]), new Element(53, 'I', 'Iodine', 126.91, 2.15, 1.4, [1, 3, 5, 7]), new Element(54, 'XE', 'Xenon', 131.29, 2.16, 1.98, [0]), new Element(55, 'CS', 'Cesium', 132.91, 1.7, 1.67, [1]), new Element(56, 'BA', 'Barium', 137.33, 1.7, 1.34, [2]), new Element(57, 'LA', 'Lanthanum', 138.91, 1.7, 1.87, [0]), new Element(58, 'CE', 'Cerium', 140.12, 1.7, 1.83, [0]), new Element(59, 'PR', 'Praseodymium', 140.91, 1.7, 1.82, [0]), new Element(60, 'ND', 'Neodymium', 144.24, 1.7, 1.81, [0]), new Element(61, 'PM', 'Promethium', 144.9, 1.7, 1.8, [0]), new Element(62, 'SM', 'Samarium', 150.36, 1.7, 1.8, [0]), new Element(63, 'EU', 'Europium', 151.96, 1.7, 1.99, [0]), new Element(64, 'GD', 'Gadolinium', 157.25, 1.7, 1.79, [0]), new Element(65, 'TB', 'Terbium', 158.93, 1.7, 1.76, [0]), new Element(66, 'DY', 'Dysprosium', 162.5, 1.7, 1.75, [0]), new Element(67, 'HO', 'Holmium', 164.93, 1.7, 1.74, [0]), new Element(68, 'ER', 'Erbium', 167.26, 1.7, 1.73, [0]), new Element(69, 'TM', 'Thulium', 168.93, 1.7, 1.72, [0]), new Element(70, 'YB', 'Ytterbium', 173.04, 1.7, 1.94, [0]), new Element(71, 'LU', 'Lutetium', 174.97, 1.7, 1.72, [0]), new Element(72, 'HF', 'Hafnium', 178.49, 1.7, 1.57, [0]), new Element(73, 'TA', 'Tantalum', 180.95, 1.7, 1.43, [0]), new Element(74, 'W', 'Tungsten', 183.85, 1.7, 1.37, [0]), new Element(75, 'RE', 'Rhenium', 186.21, 1.7, 1.35, [0]), new Element(76, 'OS', 'Osmium', 190.2, 1.7, 1.37, [0]), new Element(77, 'IR', 'Iridium', 192.22, 1.7, 1.32, [0]), new Element(78, 'PT', 'Platinum', 195.08, 1.72, 1.5, [0]), new Element(79, 'AU', 'Gold', 196.97, 1.66, 1.5, [0]), new Element(80, 'HG', 'Mercury', 200.59, 1.55, 1.7, [0]), new Element(81, 'TL', 'Thallium', 204.38, 1.96, 1.55, [1, 3]), new Element(82, 'PB', 'Lead', 207.2, 2.02, 1.54, [2, 4]), new Element(83, 'BI', 'Bismuth', 208.98, 1.7, 1.54, [3, 5]), new Element(84, 'PO', 'Polonium', 210, 1.7, 1.68, [2, 4, 6]), new Element(85, 'AT', 'Astatine', 210, 1.7, 1.7, [1, 3, 5, 7]), new Element(86, 'RN', 'Radon', 222, 1.7, 2.4, [0]), new Element(87, 'FR', 'Francium', 223, 1.7, 2, [1]), new Element(88, 'RA', 'Radium', 226.03, 1.7, 1.9, [2]), new Element(89, 'AC', 'Actinium', 227.03, 1.7, 1.88, [0]), new Element(90, 'TH', 'Thorium', 232.04, 1.7, 1.79, [0]), new Element(91, 'PA', 'Protactinium', 231.04, 1.7, 1.61, [0]), new Element(92, 'U', 'Uranium', 238.03, 1.86, 1.58, [0]), new Element(93, 'NP', 'Neptunium', 237.05, 1.7, 1.55, [0]), new Element(94, 'PU', 'Plutonium', 239.1, 1.7, 1.53, [0]), new Element(95, 'AM', 'Americium', 243.1, 1.7, 1.51, [0]), new Element(96, 'CM', 'Curium', 247.1, 1.7, 1.5, [0]), new Element(97, 'BK', 'Berkelium', 247.1, 1.7, 1.5, [0]), new Element(98, 'CF', 'Californium', 252.1, 1.7, 1.5, [0]), new Element(99, 'ES', 'Einsteinium', 252.1, 1.7, 1.5, [0]), new Element(100, 'FM', 'Fermium', 257.1, 1.7, 1.5, [0]), new Element(101, 'MD', 'Mendelevium', 256.1, 1.7, 1.5, [0]), new Element(102, 'NO', 'Nobelium', 259.1, 1.7, 1.5, [0]), new Element(103, 'LR', 'Lawrencium', 260.1, 1.7, 1.5, [0]), new Element(104, 'RF', 'Rutherfordium', 261, 1.7, 1.6, [0]), new Element(105, 'DB', 'Dubnium', 262, 1.7, 1.6, [0]), new Element(106, 'SG', 'Seaborgium', 263, 1.7, 1.6, [0]), new Element(107, 'BH', 'Bohrium', 262, 1.7, 1.6, [0]), new Element(108, 'HS', 'Hassium', 265, 1.7, 1.6, [0]), new Element(109, 'MT', 'Meitnerium', 268, 1.7, 1.6, [0]) + /* eslint-enable no-magic-numbers */])(); - while (idx < len) { - ch = str.charCodeAt(idx); + // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. + static ByName = (() => ({ + // Duplicate atomic numbers (isotopes) + /* eslint-disable no-magic-numbers */ + D: new Element(1, 'D', 'Deuterium', 2.014, 1.2, 0.23, [1]), + T: new Element(1, 'T', 'Tritium', 3.016, 1.2, 0.23, [1]) + /* eslint-enable no-magic-numbers */ - if (ch === ch0 || ch === 10) { - break; + // All regular elements will be added later, automatically + }))(); +} +(function () { + const byAtomicNumber = Element.ByAtomicNumber; + const byName = Element.ByName; + for (let i = 0, n = byAtomicNumber.length; i < n; ++i) { + const element = byAtomicNumber[i]; + if (element) { + byName[element.name] = element; } - - ++idx; } +})(); - return ch === ch0 ? idx : -1; +// find atom type by chemical element (or create if missing) +Element.getByName = function (element) { + let type = Element.ByName[element]; + if (!type) { + type = Element.ByName[element] = new Element(0, element, 'Unknown', 0, 1.0, 0.01, [0]); + } + return type; +}; +/* harmony default export */ const chem_Element = (Element); +;// CONCATENATED MODULE: ./src/chem/Bond.js +const cBondTypes = { + /** Was generated manually */ + UNKNOWN: 0, + /** Simple covalent bond */ + COVALENT: 1, + /** Aromatic bond */ + AROMATIC: 2 +}; +function getAtomPos(atom) { + return atom.position; } -function readCIF(source) { - var i = 0; - var j = 0; - var n = source.length; - var code = NaN; - var newline = true; - var line = 1; - var column = 1; - var begin; - var state = 0; // 0 - start, 1 - block, 2 - item, 3 - loop, 4 - values, 5 - value - - var result = {}; - var block = {}; - var keys = []; - var keysCount = 0; - var key = ''; - var values = []; - var valuesCount = 0; - var value; - - function _parseValue() { - var val; - - if ((code === 46 || code === 63) && (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))) { - // '.' or '?' ..... - // it's a missing value - ++column; - ++i; - return undefined; +/** + * Bond between atoms. + * + * @param {Atom} left - The first atom. + * @param {Atom} right - The second atom. + * @param {number} order - Order of current bond. + * @param {number} type - Bond type. + * @param {boolean} fixed - Indicator of a pre-specified connection (in contrast with guessed one). + * + * @exports Bond + * @constructor + */ +class Bond { + constructor(left, right, order, type, fixed) { + this._left = left; + this._right = right; + this._fixed = fixed; + this._index = -1; + if (left > right) { + throw new Error('In a bond atom indices must be in increasing order'); } - - if (newline && code === 59) { - // ';' ...................................................................... - // parse multi-line string - j = i; - var lines = 0; - - do { - j = _inlineIndexOf(10, source, j + 1); // '\n' - - if (j === -1) { - throw new ParsingError('Unterminated text block found', line, column); + this._order = order; + this._type = type; + } + getLeft() { + return this._left; + } + getRight() { + return this._right; + } + getOrder() { + return this._order; + } + calcLength() { + return this._left.position.distanceTo(this._right.position); + } + _forEachNeighbour(currAtom, process) { + const { + bonds + } = currAtom; + for (let i = 0, n = bonds.length; i < n; ++i) { + process(bonds[i]._left !== currAtom ? bonds[i]._left : bonds[i]._right); + } + } + forEachLevelOne(process) { + const left = this._left; + const right = this._right; + this._forEachNeighbour(left, atom => { + if (atom === right) { + return; + } + process(atom); + }); + this._forEachNeighbour(right, atom => { + if (atom === left) { + return; + } + process(atom); + }); + } + forEachLevelTwo(process) { + // TODO refactor this piece of an art? + const left = this._left; + const right = this._right; + const self = this; + self._forEachNeighbour(left, atom => { + if (atom === right) { + return; + } + self._forEachNeighbour(atom, l2Atom => { + if (l2Atom === left) { + return; } - - ++lines; - } while (j + 1 < n && source.charCodeAt(j + 1) !== code || j + 1 >= n); - - val = source.substring(i + 1, j).replace(/\r/g, ''); - i = j + 2; - line += lines; - column = 1; - newline = false; - return val; + process(l2Atom); + }); + }); + self._forEachNeighbour(right, atom => { + if (atom === left) { + return; + } + self._forEachNeighbour(atom, l2Atom => { + if (l2Atom === right) { + return; + } + process(l2Atom); + }); + }); + } + _fixDir(refPoint, currDir, posGetter) { + // count atoms to the right and to the left of the current plane + let rightCount = 0; + let leftCount = 0; + const tmpVec = refPoint.clone(); + function checkDir(atom) { + tmpVec.copy(posGetter(atom)); + tmpVec.sub(refPoint); + const dotProd = currDir.dot(tmpVec); + if (dotProd > 0) { + ++rightCount; + } else { + ++leftCount; + } + } + function checkCarbon(atom) { + if (atom.element.name === 'C') { + checkDir(atom); + } + } + // count all atoms to the left and right of our plane, start from level 1 and carbons + const stages = [[this.forEachLevelOne, checkCarbon], [this.forEachLevelOne, checkDir], [this.forEachLevelTwo, checkCarbon], [this.forEachLevelTwo, checkDir]]; + for (let stageId = 0; stageId < stages.length; ++stageId) { + stages[stageId][0].call(this, stages[stageId][1]); + if (leftCount > rightCount) { + return currDir.multiplyScalar(-1); + } + if (leftCount < rightCount) { + return currDir; + } + } + return currDir; + } + calcNormalDir(posGetter) { + const left = this._left; + const right = this._right; + let first = left; + let second = right; + posGetter = posGetter === undefined ? getAtomPos : posGetter; + if (left.bonds.length > right.bonds.length) { + first = right; + second = left; } + let third = first; + let maxNeibs = 0; + const { + bonds + } = second; + for (let i = 0, n = bonds.length; i < n; ++i) { + let another = bonds[i]._left; + if (bonds[i]._left === second) { + another = bonds[i]._right; + } + if (another.bonds.length > maxNeibs && another !== first) { + third = another; + maxNeibs = another.bonds.length; + } + } + const secondPos = posGetter(second); + const firstV = posGetter(first).clone().sub(secondPos); + const secondV = posGetter(third).clone().sub(secondPos); + secondV.crossVectors(firstV, secondV); + if (secondV.lengthSq() < 0.0001) { + secondV.set(0, 1, 0); + } + firstV.normalize(); + secondV.normalize(); + firstV.crossVectors(secondV, firstV); + if (firstV.lengthSq() < 0.0001) { + firstV.set(0, 1, 0); + } + firstV.normalize(); + return this._fixDir(secondPos, firstV, posGetter); + } + static BondType = (() => cBondTypes)(); +} +Bond.prototype.BondType = cBondTypes; +/* harmony default export */ const chem_Bond = (Bond); +;// CONCATENATED MODULE: ./src/chem/Residue.js - if (code === 39 || code === 34) { - // ''' or '"' ........................................................... - // parse quoted string - j = i; - do { - j = _inlineIndexOf(code, source, j + 1); - if (j === -1) { - throw new ParsingError('Unterminated quoted string found', line, column); - } - } while (j + 1 < n && !_isWhitespace(source.charCodeAt(j + 1))); +const cNucleicControlNames = ['C3\'', 'C3*', 'P', 'H5T', 'H3T']; +const cNucleicWing1Names = ['OP1', 'O1P']; +const cNucleicWing2Names = ['OP2', 'O2P']; +const cCylinderSource = ['C3\'', 'C3*', 'C1', 'C1\'', 'C1*', 'P']; +const cCylinderTarget = [{ + types: ['A', 'DA', 'G', 'DG'], + atoms: ['N1'] +}, { + types: ['C', 'DC'], + atoms: ['N3'] +}, { + types: ['T', 'DT', 'U', 'DU'], + atoms: ['O4'] +}]; - val = source.substring(i + 1, j); - column += j - i + 1; - i = j + 1; - return val; - } // ...................................................................................................... - // parse until the first whitespace +/** + * Residue instance. + * + * @param {Chain} chain - Chain this residue belongs to. + * @param {ResidueType} type - Generic residue instance type. + * @param {number} sequence - Sequence ID. + * @param {string} icode - One character insertion code (usually space or A-Z). + * + * @exports Residue + * @constructor + */ +class Residue { + constructor(chain, type, sequence, icode) { + this._chain = chain; + this._component = null; + this._type = type; + this._sequence = sequence; + this._icode = icode; + this._mask = 1 | 0; + this._index = -1; + this._atoms = []; + this._secondary = null; + this._firstAtom = null; + this._leadAtom = null; + this._wingAtom = null; + this._lastAtom = null; + this._controlPoint = null; + this._midPoint = null; + this._wingVector = null; + this._cylinders = null; + this._isValid = true; + this._het = false; + this._molecule = null; + this.temperature = null; + this.occupancy = null; + } + // Getters and setters + getChain() { + return this._chain; + } + getMolecule() { + return this._molecule; + } + getType() { + return this._type; + } + getSequence() { + return this._sequence; + } + getSecondary() { + return this._secondary; + } + getICode() { + return this._icode; + } - j = i; + // Other methods - while (j < n && !_isWhitespace(source.charCodeAt(j))) { - ++j; + addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge) { + const atom = new chem_Atom(this, name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); + const complex = this._chain.getComplex(); + complex.addAtom(atom); + this._atoms.push(atom); + this._het = this._het || het; + return atom; + } + getAtomCount() { + return this._atoms.length; + } + forEachAtom(process) { + const atoms = this._atoms; + for (let i = 0, n = atoms.length; i < n; ++i) { + if (process(atoms[i])) { + break; + } } - - val = source.substring(i, j); - column += j - i; - i = j; // try to convert to a number - - var num = Number(val); - - if (!Number.isNaN(num)) { - return num; - } // or leave as an unquoted string - - - return val; } - - function _storeKey(tag) { - keys[keysCount++] = tag; + _findAtomByName(name) { + let res = null; + this.forEachAtom(atom => { + if (atom.name === name) { + res = atom; + return true; + } + return false; + }); + return res; + } + _findFirstAtomInList(names) { + let res = null; + for (let i = 0; i < names.length; ++i) { + res = this._findAtomByName(names[i]); + if (res !== null) { + return res; + } + } + return res; + } + collectMask() { + let mask = 0xffffffff; + const atoms = this._atoms; + for (let i = 0, n = atoms.length; i < n; ++i) { + mask &= atoms[i].mask; + } + this._mask = mask; + } + getCylinderTargetList() { + const type = this._type._name; + for (let i = 0, n = cCylinderTarget.length; i < n; ++i) { + for (let j = 0, m = cCylinderTarget[i].types.length; j < m; ++j) { + if (type === cCylinderTarget[i].types[j]) { + return cCylinderTarget[i].atoms; + } + } + } + return null; + } + _detectLeadWing(dst, next, getAtomPosition) { + const leadAtom = this._findFirstAtomInList(cNucleicControlNames); + let wingStart = this._findFirstAtomInList(cNucleicWing1Names); + let wingEnd = this._findFirstAtomInList(cNucleicWing2Names); + if (wingStart === null && next !== null) { + wingStart = next._findFirstAtomInList(cNucleicWing1Names); + } + if (wingEnd === null && next !== null) { + wingEnd = next._findFirstAtomInList(cNucleicWing2Names); + } + if (leadAtom === null || wingStart === null || wingEnd === null) { + return; + } + dst._leadAtom = leadAtom; + dst._controlPoint = getAtomPosition(leadAtom); + dst._wingVector = getAtomPosition(wingEnd).clone().sub(getAtomPosition(wingStart)); + dst._isValid = true; + const cylSource = this._findFirstAtomInList(cCylinderSource); + const targetList = this.getCylinderTargetList(); + const cylTarget = targetList !== null ? this._findFirstAtomInList(targetList) : null; + if (cylSource === null || cylTarget === null) { + return; + } + dst._cylinders = [getAtomPosition(cylSource), getAtomPosition(cylTarget)]; } - - function _storeValue(val) { - var keyIndex = valuesCount % keysCount; - values[keyIndex].push(val); - ++valuesCount; - return val; + calcWing(prevLeadPos, currLeadPos, prevWingPos, prevWing) { + const vectorA = currLeadPos.clone().sub(prevLeadPos); + const vectorB = prevLeadPos.clone().sub(prevWingPos); + vectorB.crossVectors(vectorA, vectorB); + vectorB.crossVectors(vectorA, vectorB).normalize(); + if (prevWing !== null && prevWing.length() > 0.0001) { + const needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2; + if (needToNegate) { + vectorB.negate(); + } + } + return vectorB; } - - while (i <= n) { - code = source.charCodeAt(i); // 'NaN' in place of '' - - if (code === 13) ; else if (code === 10) { - // '\n' ................................................................................ - // take note of new lines - newline = true; - ++line; - column = 1; + _innerFinalize(prevRes, prev, nextRes, dst, chainAsNucleic, getAtomPosition) { + const bFirstInChain = prev === null; + const lp = getAtomPosition(this._leadAtom); + const currLeadPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(lp.x, lp.y, lp.z); + if (chainAsNucleic) { + this._detectLeadWing(dst, nextRes, getAtomPosition); + return; + } + if (bFirstInChain) { + // for first one in chain + dst._midPoint = getAtomPosition(this._firstAtom).clone(); } else { - // process inline characters - if (code === 32 || code === 9) ; else if (code === 35) { - // '#' ............................................................................... - // skip the comment until before the end of the line - i = _inlineIndexOf(10, source, i + 1); // '\n' - - if (i === -1) { - break; - } else { - continue; // don't forget to process the new line + const prevLeadPos = prev._controlPoint; // lead point of previous monomer + dst._midPoint = prevLeadPos.clone().lerp(currLeadPos, 0.5); + dst._wingVector = this.calcWing(prevLeadPos, currLeadPos, getAtomPosition(prevRes._wingAtom), prev._wingVector); + } + dst._controlPoint = currLeadPos; + } + _finalize2(prev, next, asNucleic) { + // Should be called AFTER first finalize + this._innerFinalize(prev, prev, next, this, asNucleic, atom => atom.position); + } + isConnected(anotherResidue) { + if (this._chain !== anotherResidue._chain) { + return false; + } + if (this === anotherResidue) { + return true; + } + let res = false; + this.forEachAtom(atom => { + const { + bonds + } = atom; + for (let i = 0, n = bonds.length; i < n; ++i) { + const bond = bonds[i]; + if (bond._left.residue === anotherResidue || bond._right.residue === anotherResidue) { + res = true; + return true; } - } else if (state === 0) { - // start ============================================================================= - if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { - // 'data_' .......... - j = i + 5; - begin = j; - - while (j < n && !_isWhitespace(source.charCodeAt(j))) { - ++j; - } - - column += j - i; - i = j; - - if (begin < i) { - // add new data block - result[source.substring(begin, i)] = block = {}; - state = 1; // block - - continue; // don't forget to process the whitespace - } else { - throw new ParsingError('Data block name missing', line, column); - } - } else if (Number.isNaN(code)) { - // .................................................................... - break; - } else { - // .................................................................................................. - throw new ParsingError("Unexpected character in state ".concat(state), line, column); + } + return false; + }); + return res; + } + _finalize() { + const self = this; + [this._firstAtom] = this._atoms; + this._lastAtom = this._atoms[this._atoms.length - 1]; + this._leadAtom = null; + this._wingAtom = null; + let tempCount = 0; + let temperature = 0; // average temperature + let occupCount = 0; + let occupancy = 0; // average occupancy + this.forEachAtom(a => { + if (self._leadAtom === null) { + if (a.role === chem_Element.Constants.Lead) { + self._leadAtom = a; } - } else if (state === 1) { - // block ============================================================================= - if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { - // 'data_' .......... - state = 0; // start - - continue; // parse again in a different state - } else if (code === 95) { - // '_' ............................................................................. - j = i + 1; - begin = j; + } + if (self._wingAtom === null) { + if (a.role === chem_Element.Constants.Wing) { + self._wingAtom = a; + } + } + if (a.temperature) { + temperature += a.temperature; + tempCount++; + } + if (a.occupancy) { + occupancy += a.occupancy; + occupCount++; + } + return self._leadAtom !== null && self._wingAtom !== null; + }); + if (tempCount > 0) { + this.temperature = temperature / tempCount; + } + if (occupCount > 0) { + this.occupancy = occupancy / occupCount; + } - while (j < n && !_isWhitespace(source.charCodeAt(j))) { - ++j; - } + // Still try to make monomer look valid + if (this._leadAtom === null || this._wingAtom === null) { + this._isValid = false; + } + if (this._leadAtom === null) { + this._leadAtom = this._firstAtom; + } + if (this._wingAtom === null) { + this._wingAtom = this._lastAtom; + } + } +} +/* harmony default export */ const chem_Residue = (Residue); +;// CONCATENATED MODULE: ./src/chem/ResidueType.js +/** + * Residue type. + * + * Predefined acid or created with HET, HETNAM, etc. + * + * @param {string} name - Short name, either standard (ALA, MET, etc.) or non-standard one. + * @param {string} fullName - Full residue name. + * @param {string} letterCode - 1-letter symbol. + * + * @exports ResidueType + * @constructor + */ +class ResidueType { + constructor(name, fullName, letterCode) { + this._name = name; + this._fullName = fullName; + this.letterCode = letterCode; + this.flags = 0x0000; + } + getName() { + return this._name; + } - column += j - i; - i = j; + // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. + static StandardTypes = (() => ({ + /* eslint-disable no-magic-numbers */ + ALA: new ResidueType('ALA', 'Alanine', 'A'), + ARG: new ResidueType('ARG', 'Arginine', 'R'), + ASN: new ResidueType('ASN', 'Asparagine', 'N'), + ASP: new ResidueType('ASP', 'Aspartic Acid', 'D'), + CYS: new ResidueType('CYS', 'Cysteine', 'C'), + GLN: new ResidueType('GLN', 'Glutamine', 'Q'), + GLU: new ResidueType('GLU', 'Glutamic Acid', 'E'), + GLY: new ResidueType('GLY', 'Glycine', 'G'), + HIS: new ResidueType('HIS', 'Histidine', 'H'), + ILE: new ResidueType('ILE', 'Isoleucine', 'I'), + LEU: new ResidueType('LEU', 'Leucine', 'L'), + LYS: new ResidueType('LYS', 'Lysine', 'K'), + MET: new ResidueType('MET', 'Methionine', 'M'), + PHE: new ResidueType('PHE', 'Phenylalanine', 'F'), + PRO: new ResidueType('PRO', 'Proline', 'P'), + PYL: new ResidueType('PYL', 'Pyrrolysine', 'O'), + SEC: new ResidueType('SEC', 'Selenocysteine', 'U'), + SER: new ResidueType('SER', 'Serine', 'S'), + THR: new ResidueType('THR', 'Threonine', 'T'), + TRP: new ResidueType('TRP', 'Tryptophan', 'W'), + TYR: new ResidueType('TYR', 'Tyrosine', 'Y'), + VAL: new ResidueType('VAL', 'Valine', 'V'), + A: new ResidueType('A', 'Adenine', 'A'), + C: new ResidueType('C', 'Cytosine', 'C'), + G: new ResidueType('G', 'Guanine', 'G'), + I: new ResidueType('I', 'Inosine', 'I'), + T: new ResidueType('T', 'Thymine', 'T'), + U: new ResidueType('U', 'Uracil', 'U'), + DA: new ResidueType('DA', 'Adenine', 'A'), + DC: new ResidueType('DC', 'Cytosine', 'C'), + DG: new ResidueType('DG', 'Guanine', 'G'), + DI: new ResidueType('DI', 'Inosine', 'I'), + DT: new ResidueType('DT', 'Thymine', 'T'), + DU: new ResidueType('DU', 'Uracil', 'U'), + '+A': new ResidueType('+A', 'Adenine', 'A'), + '+C': new ResidueType('+C', 'Cytosine', 'C'), + '+G': new ResidueType('+G', 'Guanine', 'G'), + '+I': new ResidueType('+I', 'Inosine', 'I'), + '+T': new ResidueType('+T', 'Thymine', 'T'), + '+U': new ResidueType('+U', 'Uracil', 'U'), + WAT: new ResidueType('WAT', 'Water', ''), + H2O: new ResidueType('H2O', 'Water', ''), + HOH: new ResidueType('HOH', 'Water', ''), + DOD: new ResidueType('DOD', 'Water', ''), + UNK: new ResidueType('UNK', 'Unknown', ''), + UNL: new ResidueType('UNL', 'Unknown Ligand', '') + /* eslint-enable no-magic-numbers */ + }))(); - if (begin < i) { - // start new item - key = source.substring(begin, i); - state = 2; // item + /** + * Enumeration of residue flag values. + * + * @enum {number} + * @readonly + */ + static Flags = { + // Amino acids + /** Amino acid residue */ + PROTEIN: 0x0001, + /** Basic amino acid residue */ + BASIC: 0x0002, + /** Acidic amino acid residue */ + ACIDIC: 0x0004, + /** Polar uncharged side chain amino acid residue */ + POLAR: 0x0008, + /** Non-polar hydrophobic side chain amino acid residue */ + NONPOLAR: 0x0010, + /** Aromatic amino acid residue */ + AROMATIC: 0x0020, + // Nucleic acids + + /** Nucleic residue */ + NUCLEIC: 0x0100, + /** Purine nucleic residue */ + PURINE: 0x0200, + /** Pyrimidine nucleic residue */ + PYRIMIDINE: 0x0400, + /** DNA */ + DNA: 0x0800, + /** RNA */ + RNA: 0x1000, + /** Water */ + WATER: 0x10000 + }; +} - continue; // don't forget to process the whitespace - } else { - throw new ParsingError('Tag name missing', line, column); - } - } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { - // 'loop_' ... - i += 5; - column += 5; +// Flag combinations +function _addFlag(flag, list) { + for (let i = 0, n = list.length; i < n; ++i) { + const res = ResidueType.StandardTypes[list[i]]; + if (res) { + res.flags |= flag; + } + } +} +const { + Flags +} = ResidueType; +_addFlag(Flags.WATER, ['WAT', 'H2O', 'HOH', 'DOD']); +_addFlag(Flags.PROTEIN, ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLY', 'GLU', 'GLN', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'PYL', 'SEC', 'SER', 'THR', 'TRP', 'TYR', 'VAL']); +_addFlag(Flags.BASIC, ['ARG', 'HIS', 'LYS']); +_addFlag(Flags.ACIDIC, ['ASP', 'GLU']); +_addFlag(Flags.POLAR, ['ASN', 'CYS', 'GLN', 'SER', 'THR', 'TYR']); +_addFlag(Flags.NONPOLAR, ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'VAL', 'GLY']); +_addFlag(Flags.AROMATIC, ['PHE', 'TRP', 'TYR']); +_addFlag(Flags.NUCLEIC, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I', 'C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']); +_addFlag(Flags.PURINE, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I']); +_addFlag(Flags.PYRIMIDINE, ['C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']); +_addFlag(Flags.DNA, ['DA', 'DG', 'DI', 'DC', 'DT', 'DU']); +_addFlag(Flags.RNA, ['A', 'G', 'I', 'C', 'T', 'U']); +// Table of kdHydrophobicity +const hydro = { + ILE: 4.5, + VAL: 4.2, + LEU: 3.8, + PHE: 2.8, + CYS: 2.5, + MET: 1.9, + ALA: 1.8, + GLY: -0.4, + THR: -0.7, + SER: -0.8, + TRP: -0.9, + TYR: -1.3, + PRO: -1.6, + HIS: -3.2, + GLU: -3.5, + GLN: -3.5, + ASP: -3.5, + ASN: -3.5, + LYS: -3.9, + ARG: -4.5 +}; +function _addParam(param, list) { + const keys = Object.keys(list); + for (let i = 0, n = keys.length; i < n; ++i) { + const key = keys[i]; + const value = list[key]; + ResidueType.StandardTypes[key][param] = value; + } +} +_addParam('hydrophobicity', hydro); +/* harmony default export */ const chem_ResidueType = (ResidueType); +;// CONCATENATED MODULE: ./src/chem/Chain.js - if (i < n && !_isWhitespace(source.charCodeAt(i))) { - throw new ParsingError("Unexpected character in state ".concat(state), line, column); - } else { - // start new loop - keys = []; - keysCount = 0; - values = []; - valuesCount = 0; - state = 3; // loop - continue; // don't forget to process the whitespace - } - } else if (Number.isNaN(code)) { - // .................................................................... - break; - } else { - // .................................................................................................. - throw new ParsingError("Unexpected character in state ".concat(state), line, column); - } - } else if (state === 2) { - // item ============================================================================== - if (Number.isNaN(code)) { - break; - } - value = _parseValue(); - _.set(block, key, value); +/** + * Residues in chain are either amino acid either nucleic acid (and water) + * There might be some modified/mutated residues, which type could not be determined by their name (nucleic or amino); In this + * case firstly program definites the chain type (by well-known residues) and then definites modified/mutated residues + */ +const ChainType = { + UNKNOWN: 0, + PROTEIN: 1, + NUCLEIC: 2 +}; - state = 1; // block +/** + * Residue chain. + * + * @param {Complex} complex - Molecular complex this chain belongs to. + * @param {string} name - One character identifier (usually space, A-Z, 0-9, or a-z). + * + * @exports Chain + * @constructor + */ +class Chain { + constructor(complex, name) { + this._complex = complex; + this._name = name; + this._mask = 1 | 0; + this._index = -1; + this._residues = []; + this.minSequence = Number.POSITIVE_INFINITY; + this.maxSequence = Number.NEGATIVE_INFINITY; + } + getComplex() { + return this._complex; + } + getName() { + return this._name; + } + getResidues() { + return this._residues; + } + _determineType() { + const residues = this._residues; + const { + PROTEIN, + NUCLEIC + } = chem_ResidueType.Flags; + this.type = ChainType.UNKNOWN; + for (let i = 0, n = residues.length; i < n; ++i) { + const { + flags + } = residues[i]._type; + if ((flags & NUCLEIC) !== 0) { + this.type = ChainType.NUCLEIC; + break; + } else if ((flags & PROTEIN) !== 0) { + this.type = ChainType.PROTEIN; + break; + } + } + } - continue; - } else if (state === 3) { - // loop ============================================================================== - if (code === 95) { - // '_' .................................................................................... - j = i + 1; - begin = j; + /** + * Finds thre residue with specified sequence number and inserion code + * @param {Number} seqNum sequence number + * @param {string} iCode insertion code + * @returns {*} Residue or null if not found + */ + findResidue(seqNum, iCode) { + const residues = this._residues; + for (let i = 0, n = residues.length; i < n; ++i) { + const res = residues[i]; + if (res._sequence === seqNum && res._icode === iCode) { + return [res, i]; + } + } + return null; + } + _finalize() { + this._determineType(); + const residues = this._residues; + let prev = null; + for (let i = 0, n = residues.length; i < n; ++i) { + const next = i + 1 < n ? residues[i + 1] : null; + const curr = residues[i]; + // TODO: skip invalid residues + if (true /* curr._isValid */) { + // eslint-disable-line no-constant-condition + curr._finalize2(prev, next, this.type === ChainType.NUCLEIC); + prev = curr; + } + } - while (j < n && !_isWhitespace(source.charCodeAt(j))) { - ++j; - } + // fix very first wing + if (residues.length > 1 && residues[1]._wingVector) { + const p = residues[1]._wingVector; + residues[0]._wingVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(p.x, p.y, p.z); + } else if (residues.length > 0) { + residues[0]._wingVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1, 0, 0); + } + } + updateToFrame(frameData) { + const residues = this._residues; + let prev = null; + let prevData = null; + const frameRes = frameData._residues; + const n = residues.length; + function getAtomPos(atom) { + return frameData.getAtomPos(atom.index); + } + for (let i = 0; i < n; ++i) { + const curr = residues[i]; + const currData = frameRes[curr._index]; + const nextRes = i + 1 < n ? residues[i + 1] : null; + curr._innerFinalize(prev, prevData, nextRes, currData, this.type === ChainType.NUCLEIC, getAtomPos); + prev = curr; + prevData = currData; + } + frameRes[residues[0]._index]._wingVector = n > 1 ? frameRes[residues[1]._index]._wingVector : new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1, 0, 0); + } - column += j - i; - i = j; + /** + * Create a new residue. + * + * @param {string} name - Residue name. + * @param {number} sequence - Residue sequence number. + * @param {string} iCode - Insertion code. + * @returns {Residue} - Newly created residue instance. + */ + addResidue(name, sequence, iCode) { + let type = this._complex.getResidueType(name); + if (type === null) { + type = this._complex.addResidueType(name); + } + const residue = new chem_Residue(this, type, sequence, iCode); + this._complex.addResidue(residue); + this._residues.push(residue); + if (type.flags & (chem_ResidueType.Flags.NUCLEIC | chem_ResidueType.Flags.PROTEIN)) { + if (this.maxSequence < sequence) { + this.maxSequence = sequence; + } + if (this.minSequence > sequence) { + this.minSequence = sequence; + } + } + return residue; + } + getResidueCount() { + return this._residues.length; + } + forEachResidue(process) { + const residues = this._residues; + for (let i = 0, n = residues.length; i < n; ++i) { + process(residues[i]); + } + } + collectMask() { + let mask = 0xffffffff; + const residues = this._residues; + for (let i = 0, n = residues.length; i < n; ++i) { + mask &= residues[i]._mask; + } + this._mask = mask; + } +} +/* harmony default export */ const chem_Chain = (Chain); +;// CONCATENATED MODULE: ./src/chem/StructuralElement.js - if (begin < i) { - // add new key - _storeKey(source.substring(begin, i)); - continue; // don't forget to process the whitespace - } else { - throw new ParsingError('Tag name missing', line, column); - } - } else { - // .................................................................................................. - if (keysCount > 0) { - for (var keyIndex = 0; keyIndex < keysCount; ++keyIndex) { - value = []; - values[keyIndex] = value; +/** An element of protein secondary structure. */ +class StructuralElement { + /** + * Create a secondary structural element of the specified type. + * + * @param {StructuralElement.Type} type Secondary structure type. + * @param {Residue} init Initial residue. + * @param {Residue} term Terminal residue. + */ + constructor(type, init, term) { + /** + * Secondary structure type. + * @type {StructuralElement.Type} + */ + this.type = type; + /** + * Generic secondary structure type. + * @type {StructuralElement.Generic} + */ + this.generic = StructuralElement.genericByType[this.type] || 'loop'; + /** + * Initial residue. + * @type Residue + */ + this.init = init; + /** + * Terminal residue. + * @type Residue + */ + this.term = term; + } - _.set(block, keys[keyIndex], value); - } + /** + * An internal method for making a final pass over the complex to set all required references. + * + * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring. + * Just copying it as-is right now and hoping for the best. + * + * @param {object} serialAtomMap A dictionary of atoms + * @param {object} residueHash A dictionary of hashed residues to check. + * @param {Complex} complex The molecular complex this element belongs to. + */ + _finalize(serialAtomMap, residueHash, complex) { + if (this.init instanceof chem_Residue && this.term instanceof chem_Residue) { + return; + } - state = 4; - continue; // parse again in a different state + // Link all intermediate residues to this structural element + const start = complex.splitUnifiedSerial(this.init); + const end = complex.splitUnifiedSerial(this.term); + for (let chainId = start.chain; chainId <= end.chain; chainId++) { + for (let serialId = start.serial; serialId <= end.serial; serialId++) { + for (let { + iCode + } = start; iCode <= end.iCode; iCode++) { + const hashCode = complex.getUnifiedSerial(chainId, serialId, iCode); + if (residueHash[hashCode]) { + residueHash[hashCode]._secondary = this; } - - throw new ParsingError('Data tags are missing inside a loop', line, column); - } - } else if (state === 4) { - // values ============================================================================ - if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { - // 'data_' .......... - state = 0; // start - } else if (code === 95) { - // '_' ............................................................................. - state = 1; // block - } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { - // 'loop_' ... - state = 1; // block - } else if (Number.isNaN(code)) { - // .................................................................... - state = 0; - } else { - // .................................................................................................. - _storeValue(_parseValue()); } - - continue; // parse again in a different state - } else { - // ==================================================================================================== - throw new ParsingError("Unexpected internal state ".concat(state), line, column); } - - newline = false; - ++column; } - ++i; + // Replace unfined serials by objects + this.init = residueHash[this.init]; + this.term = residueHash[this.term]; } +} - if (state === 2) { - // item - throw new ParsingError("Unexpected end of file in state ".concat(state), line, column); - } +/** + * Specific type of a secondary structural element. + * @enum {string} + * @see StructuralElement.Generic + */ +StructuralElement.Type = { + /** A strand of a [beta-sheet](https://en.wikipedia.org/wiki/Beta_sheet). */ + STRAND: 'E', + /** An isolated beta-bridge (too small for a beta-sheet). */ + BRIDGE: 'B', + /** A [3/10 helix](https://en.wikipedia.org/wiki/310_helix) (hydrogen bonding is 3 residues apart). */ + HELIX_310: 'G', + /** An [alpha-helix](https://en.wikipedia.org/wiki/Alpha_helix) (hydrogen bonding is 4 residues apart). */ + HELIX_ALPHA: 'H', + /** A [pi-helix](https://en.wikipedia.org/wiki/Pi_helix) (hydrogen bonding is 5 residues apart). */ + HELIX_PI: 'I', + /** A generic helix of unspecified bonding distance. */ + HELIX: 'X', + /** An isolated 3/10-like helical turn. */ + TURN_310: '3', + /** An isolated alpha-like helical turn. */ + TURN_ALPHA: '4', + /** An isolated pi-like helical turn. */ + TURN_PI: '5', + /** An isolated helical [turn](https://en.wikipedia.org/wiki/Turn_(biochemistry)) of unspecified bonding distance. */ + TURN: 'T', + /** A bend (a region of high curvature). */ + BEND: 'S', + /** Just a protein section with no particular conformation. */ + COIL: 'C' +}; - return result; -} +/** + * Generic type of a secondary structural element. + * @enum {string} + * @see StructuralElement.Type + */ +StructuralElement.Generic = { + /** A strand of a sheet. */ + STRAND: 'strand', + /** A helix. */ + HELIX: 'helix', + /** Just a protein section with no particular conformation. */ + LOOP: 'loop' +}; +const StructuralElementType = StructuralElement.Type; +const StructuralElementGeneric = StructuralElement.Generic; -var Complex$4 = chem.Complex, - Element$5 = chem.Element, - Helix$3 = chem.Helix, - Sheet$3 = chem.Sheet, - Strand$3 = chem.Strand, - Assembly$3 = chem.Assembly, - Molecule$3 = chem.Molecule; -var cRequiredAtomFields = ['auth_seq_id', 'Cartn_x', 'Cartn_y', 'Cartn_z', 'label_atom_id']; -var cSecondaryCoding = { - helx: 'helix', - turn: 'turn', - strn: 'strand' +/** + * A mapping from specific types to generic ones. + * @type {Object} + */ +StructuralElement.genericByType = { + [StructuralElementType.STRAND]: StructuralElementGeneric.STRAND, + [StructuralElementType.HELIX_310]: StructuralElementGeneric.HELIX, + [StructuralElementType.HELIX_ALPHA]: StructuralElementGeneric.HELIX, + [StructuralElementType.HELIX_PI]: StructuralElementGeneric.HELIX, + [StructuralElementType.HELIX]: StructuralElementGeneric.HELIX }; +/* harmony default export */ const chem_StructuralElement = (StructuralElement); +;// CONCATENATED MODULE: ./src/chem/Helix.js -function getTypeFromId(string) { - var typeId = /[A-Za-z]+/.exec(string); +const Helix_StructuralElementType = chem_StructuralElement.Type; +const typeByPDBHelixClass = { + 1: Helix_StructuralElementType.HELIX_ALPHA, + 3: Helix_StructuralElementType.HELIX_PI, + 5: Helix_StructuralElementType.HELIX_310 +}; - if (!typeId) { - return null; - } +/** + * Helical secondary structure of a protein. + * @extends StructuralElement + */ +class Helix extends chem_StructuralElement { + /** + * Create a helix. + * + * @param {number} helixClass A helix class according to the + * [PDB Format](http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX). + * @param {Residue} init Initial residue. + * @param {Residue} term Terminal residue. + * @param {number} serial Serial number of the helix (see PDB Format). + * @param {string} name Helix identifier (see PDB Format). + * @param {string} comment Comment about this helix (see PDB Format). + * @param {number} length Length of this helix, in residues (see PDB Format). + */ + constructor(helixClass, init, term, serial, name, comment, length) { + super(typeByPDBHelixClass[helixClass] || chem_StructuralElement.Type.HELIX, init, term); - return cSecondaryCoding[typeId[0].toLowerCase()]; + /** + * Serial number of the helix (see PDB Format). + * @type {number} + */ + this.serial = serial; + /** + * Helix identifier (see PDB Format). + * @type {string} + */ + this.name = name; + /** + * Comment about this helix (see PDB Format). + * @type {string} + */ + this.comment = comment; + /** + * Length of this helix, in residues (see PDB Format). + * @type {number} + */ + this.length = length; + } } +/* harmony default export */ const chem_Helix = (Helix); +;// CONCATENATED MODULE: ./src/chem/Strand.js + + /** - * Make valid object an array - * @param arrayLikeObject - * @return {array, object} array or object + * A single strand of a sheet in a protein secondary structure. + * @extends StructuralElement */ +class Strand extends chem_StructuralElement { + /** + * Create a strand. + * + * @param {Sheet} sheet Parent sheet this strand belongs to. + * @param {Residue} init Initial residue. + * @param {Residue} term Terminal residue. + * @param {number} sense Sense of strand with respect to previous strand in the sheet. + * - 0 if the first strand, + * - 1 if parallel, and + * - -1 if anti-parallel. + * @param {Atom} atomCur Atom in current strand (see PDB Format). + * @param {Atom} atomPrev Atom in previous strand (see PDB Format). + */ + constructor(sheet, init, term, sense, atomCur, atomPrev) { + super(chem_StructuralElement.Type.STRAND, init, term); + /** + * Parent sheet this strand belongs to. + * @type {Sheet} + */ + this.sheet = sheet; + /** + * Sense of strand with respect to previous strand in the sheet. + * - 0 if the first strand, + * - 1 if parallel, and + * - -1 if anti-parallel. + * @type {number} + */ + this.sense = sense; + /** + * Atom in current strand (see PDB Format). + * @type {Atom} + */ + this.atomCur = atomCur; + /** + * Atom in previous strand (see PDB Format). + * @type {Atom} + */ + this.atomPrev = atomPrev; + } -function arrize(arrayLikeObject) { - if (arrayLikeObject === null || arrayLikeObject === undefined || _.isArray(arrayLikeObject)) { - return arrayLikeObject; + /** + * An internal method for making a final pass over the complex to set all required references. + * + * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring. + * Just copying it as-is right now and hoping for the best. + * + * @param {object} serialAtomMap A dictionary of atoms + * @param {object} residueHash A dictionary of hashed residues to check. + * @param {Complex} complex The molecular complex this element belongs to. + * + * @override + */ + _finalize(serialAtomMap, residueHash, complex) { + super._finalize(serialAtomMap, residueHash, complex); + let as = this.atomCur; + if (as !== null && !Number.isNaN(as)) { + this.atomCur = serialAtomMap[as]; + } + as = this.atomPrev; + if (as !== null && !Number.isNaN(as)) { + this.atomPrev = serialAtomMap[as]; + } } - - return [arrayLikeObject]; -} - -function nameToElement$1(name) { - // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM - // - // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1 - // - // Atom names start with element symbols right-justified in columns 13-14 - // as permitted by the length of the name. For example, the symbol FE for - // iron appears in columns 13-14, whereas the symbol C for carbon appears - // in column 14 (see Misaligned Atom Names). If an atom name has four - // characters, however, it must start in column 13 even if the element - // symbol is a single character (for example, see Hydrogen Atoms). - var veryLong = name.trim().length === 4; - return name.slice(0, veryLong ? 1 : 2).trim(); } +/* harmony default export */ const chem_Strand = (Strand); +;// CONCATENATED MODULE: ./src/chem/Sheet.js -var AtomDataError = /*#__PURE__*/function (_Error) { - inherits(AtomDataError, _Error); - - function AtomDataError(message) { - var _this; - classCallCheck(this, AtomDataError); - - _this = possibleConstructorReturn(this, getPrototypeOf(AtomDataError).call(this)); - _this.name = 'AtomDataError'; - _this.message = message; - return _this; +/** + * Sheet secondary structure of a protein. + * + * @param {string} name - + * @param {number} width - + * + * @exports Sheet + * @constructor + */ +class Sheet { + constructor(name, width) { + this._name = name; + this._width = width; + this._strands = []; } - return AtomDataError; -}( /*#__PURE__*/wrapNativeSuper(Error)); - -function _getOperations(operList) { - if (!operList) { - return null; + // Getters and setters + getName() { + return this._name; } - - var idc = arrize(operList.id); - var matrix = operList.matrix, - vector = operList.vector; - - if (!idc || !matrix || !vector) { - return null; + getWidth() { + return this._width; } - - var ops = []; - - for (var i = 0, n = idc.length; i < n; ++i) { - var mtx = new Matrix4(); - var elements = mtx.elements; - - for (var row = 0; row < 3; ++row) { - var matrixData = matrix[row + 1]; - elements[row] = arrize(matrixData[1])[i]; - elements[row + 4] = arrize(matrixData[2])[i]; - elements[row + 8] = arrize(matrixData[3])[i]; - elements[row + 12] = arrize(vector[row + 1])[i]; + addStrand(strand) { + this._strands.push(strand); + this._width = this._strands.length; + } + addEmptyStrand() { + this._strands.push(new chem_Strand(null, null, null, null, null, null)); + } + _finalize(serialAtomMap, residueHash, complex) { + const s = this._strands; + for (let i = 0, n = s.length; i < n; ++i) { + s[i]._finalize(serialAtomMap, residueHash, complex); + } + if (!this._width) { + this._width = s.length; + } + if (s.length !== this._width) { + throw new Error(`Sheet ${this._name} is inconsistent.`); } - - ops[idc[i]] = mtx; } - - return ops; } +/* harmony default export */ const chem_Sheet = (Sheet); +;// CONCATENATED MODULE: ./src/chem/SGroup.js -function _extractOperations(assemblyGen, opsDict) { - assemblyGen = _.isString(assemblyGen) ? assemblyGen : "".concat(assemblyGen); - var l = assemblyGen.replace(/\)\s*\(/g, '!').replace(/[()']/g, ''); - var groupStr = l.split('!'); - var gps = []; - - for (var grIdx = 0, grCount = groupStr.length; grIdx < grCount; ++grIdx) { - var gr = groupStr[grIdx].split(','); - var gp = []; - var idx = 0; - for (var i = 0, n = gr.length; i < n; ++i) { - var s = gr[i]; - - if (s.includes('-')) { - var es = s.split('-'); - var j = parseInt(es[0], 10); - var m = parseInt(es[1], 10); +/** + * Atom measurements. + * + * @param {string} id - SGroup id + * @param {string} name - Name of the group + * @param {THREE.Vector3} position - Registered coordinates + * @param {array} atoms - Atoms group consists of + * @param {object} saveNode - XML node from file for saving + * + * @exports SGroup + * @constructor + */ +class SGroup { + constructor(id, name, position, atoms, saveNode) { + this._id = id; + this._name = name; + this._position = position || new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._atoms = atoms || []; + this._charge = 0; // default group charge + this._repeat = 1; // how many times group repeated: always > 0 + this._center = null; + this.xmlNodeRef = saveNode || null; + } - for (; j <= m; ++j) { - gp[idx++] = opsDict[j]; - } - } else { - gp[idx++] = opsDict[s]; - } + /** + * Get atom full name. + * @returns {string} Atom full name. + */ + getName() { + return this._name; + } + getPosition() { + return this._position; + } + getCentralPoint() { + return this._center; + } + _rebuildSGroupOnAtomChange() { + const nLimon = 100000000; + if (this._center === null) { + return; // nothing to do if we are not relative } - - gps.push(gp); - } // traverse all groups from the end of array and make all mults - - - var matrices = []; - var cnt = 0; - - function traverse(level, mtx) { - for (var ii = 0, nn = gps[level].length; ii < nn; ++ii) { - var newMtx = mtx ? mtx.clone() : new Matrix4(); - newMtx.multiplyMatrices(gps[level][ii], newMtx); - - if (level === 0) { - matrices[cnt++] = newMtx; - } else { - traverse(level - 1, newMtx); - } + const bLow = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(nLimon, nLimon, nLimon); + const bHight = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-nLimon, -nLimon, -nLimon); + for (let j = 0, n = this._atoms.length; j < n; j++) { + const aPos = this._atoms[j].position; + bLow.set(Math.min(bLow.x, aPos.x), Math.min(bLow.y, aPos.y), Math.min(bLow.z, aPos.z)); + bHight.set(Math.max(bHight.x, aPos.x), Math.max(bHight.y, aPos.y), Math.max(bHight.z, aPos.z)); } + this._center.addVectors(bLow, bHight); + this._center.multiplyScalar(0.5); } - - traverse(gps.length - 1); - return matrices; } +/* harmony default export */ const chem_SGroup = (SGroup); +// EXTERNAL MODULE: ./src/utils/SelectionParser.js +var SelectionParser = __webpack_require__(99); +;// CONCATENATED MODULE: ./src/chem/selectors/selectArgs.js -var CIFParser = /*#__PURE__*/function (_Parser) { - inherits(CIFParser, _Parser); - - function CIFParser(data, options) { - var _this2; - classCallCheck(this, CIFParser); - - _this2 = possibleConstructorReturn(this, getPrototypeOf(CIFParser).call(this, data, options)); - _this2.asymDict = {}; - _this2.molecules = []; - _this2._options.fileType = 'cif'; - return _this2; +//---------------------------------------------------------------------------- +class Range { + constructor(min, max) { + this.min = min; + this.max = typeof max === 'undefined' ? min : max; } + includes(value) { + return this.min <= value && value <= this.max; + } + toString() { + const { + min, + max + } = this; + return min === max ? String(min) : [min, max].join(':'); + } + toJSON() { + return [this.min, this.max]; + } +} - createClass(CIFParser, [{ - key: "parseSync", - value: function parseSync() { - this.logger.info('Parsing CIF file..'); - var data = readCIF(this._data); - return this._toComplex(data); - } - /** - * Convert intermediate structure into our valid Complex object - * @param cifData intermediate CIF object - * @returns {Complex} complex - * @private - */ - - }, { - key: "_toComplex", - value: function _toComplex(cifData) { - var complex = new Complex$4(); - var complexData = cifData[Object.keys(cifData)[0]]; - - this._extractAtoms(complex, complexData); - - this._extractSecondary(complex, complexData); - - this._extractAssemblies(complex, complexData); - - this._extractMolecules(complex, complexData); - - this._extractMetadata(complex, complexData); +// //////////////////////////////////////////////////////////////////////////// - complex.finalize({ - needAutoBonding: true, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing - }); - return complex; +class List { + constructor(arg) { + if (arg instanceof this.constructor) { + // delegate construction to a different class + // eslint-disable-next-line no-constructor-return + return arg; } - /** - * Extract metadata - * @param complex structure to fill - * @param complexData complex data from CIF file - * @private - */ - - }, { - key: "_extractMetadata", - value: function _extractMetadata(complex, complexData) { - var metadata = complex.metadata; - metadata.id = complexData.entry.id; - metadata.classification = complexData.struct_keywords.pdbx_keywords; - var databaserev = complexData.database_PDB_rev; - metadata.date = databaserev && databaserev.date_original ? databaserev.date_original : ''; - metadata.format = 'cif'; - metadata.title = []; - metadata.title[0] = complexData.struct.title; + if (arg instanceof Array) { + this._values = arg.slice(0); + } else if (arg) { + this._values = [arg]; + } else { + this._values = []; } - /** - * Extract molecules information from CIF structure (should be called strictly after _extractAtoms) - * @param complexData complex data from CIF file - * @private - */ - - }, { - key: "_extractMolecules", - value: function _extractMolecules(complex, complexData) { - var molData = complexData.entity; - var names = arrize(molData.pdbx_description); - var count = names.length; - var i; // molecules names from cif - - for (i = 0; i < count; i++) { - this.molecules[i].name = names[i]; - } // reorganize molecules for complex and check chains - - - var molecules = complex.getMolecules(); - - for (i = 0; i < count; i++) { - var molecule = this.molecules[i]; - molecules[i] = new Molecule$3(complex, molecule.name, i + 1); - molecules[i].residues = molecule.residues; - } + } + append(value) { + const values = this._values; + values[values.length] = value; + return this; + } + remove(value) { + const values = this._values; + const index = values.indexOf(value); + if (index >= 0) { + values.splice(index, 1); } - /** - * Extract atom information from CIF structure and fill complex - * @param {Complex} complex - * @param complexData complex data from CIF file - * @private - */ - - }, { - key: "_extractAtoms", - value: function _extractAtoms(complex, complexData) { - var atomData = complexData.atom_site; + return this; + } + toString() { + return this._values.join(','); + } + toJSON() { + const values = this._values; + const result = []; + for (let i = 0, n = values.length; i < n; ++i) { + const value = values[i]; + result[i] = value.toJSON ? value.toJSON() : value; + } + return result; + } +} - if (!atomData) { - throw new AtomDataError('CIF parsing error: atom_site is not specified!'); - } +//---------------------------------------------------------------------------- - for (var f = 0, n = cRequiredAtomFields.length; f < n; ++f) { - if (!atomData[cRequiredAtomFields[f]]) { - throw new AtomDataError("CIF parsing error: requires field ".concat(cRequiredAtomFields[f], " not found!")); - } +class RangeList extends List { + includes(value) { + const list = this._values; + for (let i = 0, n = list.length; i < n; ++i) { + if (list[i].includes(value)) { + return true; } + } + return false; + } +} - var asymDict = this.asymDict; // required fields - - var resIdc = arrize(atomData.auth_seq_id); - var x = arrize(atomData.Cartn_x); - var y = arrize(atomData.Cartn_y); - var z = arrize(atomData.Cartn_z); - var names = arrize(atomData.label_atom_id); - var count = names.length; // optional fields - - var group = arrize(atomData.group_PDB) || []; - var chainIdc = arrize(atomData.auth_asym_id) || []; - var chainLabelIdc = arrize(atomData.label_asym_id) || []; - var serials = arrize(atomData.id) || []; - var iCodes = arrize(atomData.pdbx_PDB_ins_code) || []; - var resNames = arrize(atomData.label_comp_id) || []; - var elements = arrize(atomData.type_symbol) || []; - var tempFactors = arrize(atomData.B_iso_or_equiv) || []; - var occupancies = arrize(atomData.occupancy) || []; - var charges = arrize(atomData.pdbx_formal_charge) || []; - var altLocs = arrize(atomData.label_alt_id) || []; - var models = arrize(atomData.pdbx_PDB_model_num) || []; - var molecules = arrize(atomData.label_entity_id) || []; - var chain = null; - var residue = null; - - for (var i = 0; i < count; ++i) { - var model = models[i] || 1; - - if (model !== 1) { - continue; - } - - var chainID = String(chainIdc[i] || ' '); - - if (!chain || chain.getName() !== chainID) { - chain = complex.getChain(chainID) || complex.addChain(chainID); - } - - asymDict[String(chainLabelIdc[i] || ' ')] = chainID; - var resSeq = resIdc[i]; - var iCode = String(iCodes[i] || ' '); - var resName = String(resNames[i] || ''); - - if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { - residue = chain.addResidue(resName, resSeq, iCode); // store molecule (entity) - - var moleculeIdx = molecules[i] - 1; - var entity = this.molecules[moleculeIdx]; - - if (!entity) { - this.molecules[moleculeIdx] = { - name: '', - residues: [] - }; - entity = this.molecules[moleculeIdx]; - } +//---------------------------------------------------------------------------- - entity.residues.push(residue); +const valuesArray = []; +class ValueList extends List { + constructor(arg, upperOnly) { + const list = super(arg); + if (upperOnly) { + this.upperOnly = true; + const values = list._values; + for (let i = 0, n = values.length; i < n; ++i) { + const value = values[i]; + if (typeof value === 'string') { + values[i] = value.toUpperCase(); } - - var name = names[i]; - var element = elements[i] || nameToElement$1(name); - var type = Element$5.getByName(element); - var role = Element$5.Role[name.trim()]; - var xyz = new Vector3(x[i], y[i], z[i]); - var het = group[i] === 'HETATM' || false; - var serial = serials[i] || i; - var tempFactor = tempFactors[i] || 0.0; - var occupancy = occupancies[i] || 0.0; - var altLoc = String(altLocs[i] || ''); - var charge = charges[i] || 0; - residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); } + } else { + this.upperOnly = false; } - /** - * Extracts secondary structure information from CIF intermediate data - * and adds it into complex - * @param {Complex} complex - complex to fill - * @param complexData - CIF complex data - * @private - */ - - }, { - key: "_extractSecondary", - value: function _extractSecondary(complex, complexData) { - if (complexData.struct_conf) { - this._extractConfs(complex, complexData.struct_conf); - } - - if (complexData.struct_sheet_range) { - this._extractSheets(complex, complexData.struct_sheet_range); - } + // return constructed object + // eslint-disable-next-line no-constructor-return + return list; + } + includes(value) { + // we do not convert to upper case here for perfomance reasons + // if list is upper case only, value must be converted before it is sent up to here + return this._values.indexOf(value) !== -1; + } + toString() { + // Quote values that are not correct identifiers + const values = this._values; + valuesArray.length = 0; + for (let i = 0, n = values.length; i < n; ++i) { + valuesArray[i] = utils.correctSelectorIdentifier(String(values[i])); } - /** - * Extracts sheets information from CIF intermediate data - * and adds it into complex - * @param {Complex} complex - * @param sheetData - * @private - */ - - }, { - key: "_extractSheets", - value: function _extractSheets(complex, sheetData) { - var asymDict = this.asymDict; - - if (!sheetData.sheet_id || !sheetData.id || !sheetData.beg_label_seq_id || !sheetData.end_label_seq_id || !sheetData.beg_label_asym_id) { - return; - } // Strand(sheet, start, end, sense, cur, prev) - - - var sheets = complex._sheets; - - function getSheet(name) { - var n = sheets.length; + return valuesArray.join(','); + } + _validate(value) { + return this.upperOnly && typeof value === 'string' ? value.toUpperCase() : value; + } + append(value) { + super.append(this._validate(value)); + return this; + } + remove(value) { + super.remove(this._validate(value)); + return this; + } +} - for (var i = 0; i < n; ++i) { - if (sheets[i]._name === name) { - return sheets[i]; - } - } +;// CONCATENATED MODULE: ./src/chem/selectors/selectorsBase.js - sheets[n] = new Sheet$3(name, 0); - return sheets[n]; - } - var sheetNames = arrize(sheetData.sheet_id); - var strandNames = arrize(sheetData.id); - var starts = arrize(sheetData.beg_auth_seq_id); - var ends = arrize(sheetData.end_auth_seq_id); - var chains = arrize(sheetData.beg_label_asym_id); - var stICodes = arrize(sheetData.pdbx_beg_PDB_ins_code) || []; - var endICodes = arrize(sheetData.pdbx_end_PDB_ins_code) || []; +/** Base class for atom selectors. */ +class Selector { + toString() { + return this.keyword; + } + toJSON() { + return [this.name]; + } +} +Selector.prototype.name = 'Error'; +Selector.prototype.keyword = 'error'; - for (var i = 0, n = strandNames.length; i < n; ++i) { - var chain = complex.getChain(asymDict[chains[i]]); - var sheet = getSheet(sheetNames[i]); - var startIdx = starts[i]; - var endIdx = ends[i]; - var startICode = stICodes[i] || ' '; - var endICode = endICodes[i] || ' '; - var start = chain.findResidue(startIdx, startICode); - var end = chain.findResidue(endIdx, endICode); // TODO think about last condition +/** Base class for list-based atom selectors. */ +class ListSelector extends Selector { + constructor(list) { + super(); + this.list = list; + } + toString() { + return `${this.keyword} ${this.list}`; + } + toJSON() { + return [this.name, this.list.toJSON()]; + } +} +class RangeListSelector extends ListSelector { + constructor(arg) { + super(new RangeList(arg)); + } +} +class ValueListSelector extends ListSelector { + constructor(arg, caseSensitive) { + super(new ValueList(arg, !caseSensitive)); + } +} +class NoneSelector extends Selector { + includesAtom(_atom) { + return false; + } +} +NoneSelector.prototype.name = 'None'; +NoneSelector.prototype.keyword = 'none'; +class AllSelector extends Selector { + includesAtom(_atom) { + return true; + } +} +AllSelector.prototype.name = 'All'; +AllSelector.prototype.keyword = 'all'; - if (!start || !end) { - continue; - } +;// CONCATENATED MODULE: ./src/chem/selectors/selectOps.js - var strand = new Strand$3(sheet, start[0], end[0], 0, null, null); - var residues = chain.getResidues(); - for (var r = start[1]; r <= end[1]; ++r) { - residues[r]._secondary = strand; - } +//---------------------------------------------------------------------------- +// Operators +//---------------------------------------------------------------------------- +const none = new NoneSelector(); +class PrefixOperator extends Selector { + constructor(rhs) { + super(); + this.rhs = rhs || none; + } + toString() { + const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs; + return `${this.keyword} ${rhs}`; + } + toJSON() { + return [this.name, this.rhs.toJSON()]; + } +} +PrefixOperator.prototype.priority = 1; +class InfixOperator extends Selector { + constructor(lhs, rhs) { + super(); + this.lhs = lhs || none; + this.rhs = rhs || none; + } + toString() { + const lhs = this.lhs.priority && this.lhs.priority > this.priority ? `(${this.lhs})` : this.lhs; + const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs; + return `${lhs} ${this.keyword} ${rhs}`; + } + toJSON() { + return [this.name, this.lhs.toJSON(), this.rhs.toJSON()]; + } +} +InfixOperator.prototype.priority = 1000; - sheet.addStrand(strand); - complex.structures.push(strand); - } - } - /** - * Extracts helix/turn/strand(?) information from CIF intermediate data - * and adds it into complex - * @param {Complex} complex - * @param helicesData - * @private - */ +;// CONCATENATED MODULE: ./src/chem/selectors.js - }, { - key: "_extractConfs", - value: function _extractConfs(complex, helicesData) { - var asymDict = this.asymDict; - if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id || !helicesData.beg_label_asym_id) { - return; - } - var types = arrize(helicesData.conf_type_id); - var starts = arrize(helicesData.beg_auth_seq_id); - var stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || []; - var ends = arrize(helicesData.end_auth_seq_id); - var endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || []; - var comments = arrize(helicesData.details) || []; - var lengths = arrize(helicesData.pdbx_PDB_helix_length) || []; - var helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || []; - var names = arrize(helicesData.id) || []; - var chains = arrize(helicesData.beg_label_asym_id); - for (var i = 0, n = types.length; i < n; ++i) { - var type = getTypeFromId(types[i]); - if (!type) { - continue; - } - var name = names[i] || types[i]; - var chain = complex.getChain(asymDict[chains[i]]); - var startIdx = starts[i]; - var endIdx = ends[i]; - var startICode = stICodes[i] || ' '; - var endICode = endICodes[i] || ' '; - var start = chain.findResidue(startIdx, startICode); - var end = chain.findResidue(endIdx, endICode); // TODO think about last condition +const keywords = {}; - if (!start || !end) { - continue; - } +//---------------------------------------------------------------------------- +// Named selectors +//---------------------------------------------------------------------------- - var comment = comments[i] || ''; - var length = lengths[i] || 0; - var helixClass = helixClasses[i] || ' '; - var struct = void 0; +function defineSelector(name, SelectorClass) { + const keyword = name.toLowerCase(); + SelectorClass.prototype.keyword = keyword; + SelectorClass.prototype.name = name; + const factory = function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + return new SelectorClass(...args); + }; + factory.SelectorClass = SelectorClass; + keywords[keyword] = factory; + return SelectorClass; +} +defineSelector('Serial', class SerialSelector extends RangeListSelector { + includesAtom(atom) { + return this.list.includes(atom.serial); + } +}); +defineSelector('Name', class NameSelector extends ValueListSelector { + includesAtom(atom) { + return this.list.includes(atom.name); + } +}); +defineSelector('AltLoc', class AltLocSelector extends ValueListSelector { + includesAtom(atom) { + return this.list.includes(String.fromCharCode(atom.location)); + } +}); +defineSelector('Elem', class ElemSelector extends ValueListSelector { + includesAtom(atom) { + return this.list.includes(atom.element.name); + } +}); +defineSelector('Residue', class ResidueSelector extends ValueListSelector { + includesAtom(atom) { + return this.list.includes(atom.residue._type._name); + } +}); +defineSelector('Sequence', class SequenceSelector extends RangeListSelector { + includesAtom(atom) { + return this.list.includes(atom.residue._sequence); + } +}); +defineSelector('ICode', class ICodeSelector extends ValueListSelector { + constructor(arg) { + super(arg, true); + } + includesAtom(atom) { + return this.list.includes(atom.residue._icode); + } +}); +defineSelector('ResIdx', class ResIdxSelector extends RangeListSelector { + includesAtom(atom) { + return this.list.includes(atom.residue._index); + } +}); +defineSelector('Chain', class ChainSelector extends ValueListSelector { + constructor(arg) { + super(arg, true); + } + includesAtom(atom) { + return this.list.includes(atom.residue._chain._name); + } +}); +defineSelector('Hetatm', class HetatmSelector extends Selector { + includesAtom(atom) { + return atom.het; + } +}); +defineSelector('PolarH', class PolarHSelector extends Selector { + includesAtom(atom) { + return (atom.flags & chem_Atom.Flags.NONPOLARH) === chem_Atom.Flags.HYDROGEN; + } +}); +defineSelector('NonPolarH', class NonPolarHSelector extends Selector { + includesAtom(atom) { + return (atom.flags & chem_Atom.Flags.NONPOLARH) === chem_Atom.Flags.NONPOLARH; + } +}); +defineSelector('All', AllSelector); +defineSelector('None', NoneSelector); +const NULL_SELECTOR = keywords.none(); - if (type === 'helix') { - var idx = complex._helices.length; - struct = new Helix$3(helixClass, start[0], end[0], idx, name, comment, length); - complex.addHelix(struct); - complex.structures.push(struct); - } else if (type === 'turn') { - struct = new StructuralElement(StructuralElement.Type.TURN, start[0], end[0]); - complex.structures.push(struct); - } else { - struct = null; - } +//---------------------------------------------------------------------------- +// Named operators +//---------------------------------------------------------------------------- - if (!struct) { - continue; - } +function defineOperator(name, priority, OperatorClass) { + OperatorClass.prototype.priority = priority; + return defineSelector(name, OperatorClass); +} +defineOperator('Not', 1, class NotOperator extends PrefixOperator { + includesAtom(atom) { + return !this.rhs.includesAtom(atom); + } +}); +defineOperator('And', 2, class AndOperator extends InfixOperator { + includesAtom(atom) { + return this.lhs.includesAtom(atom) && this.rhs.includesAtom(atom); + } +}); +defineOperator('Or', 3, class OrOperator extends InfixOperator { + includesAtom(atom) { + return this.lhs.includesAtom(atom) || this.rhs.includesAtom(atom); + } +}); - var residues = chain.getResidues(); +//---------------------------------------------------------------------------- +// Flag selectors +//---------------------------------------------------------------------------- - for (var r = start[1]; r <= end[1]; ++r) { - residues[r]._secondary = struct; - } - } +function byResidueTypeFlag(flag, name) { + return defineSelector(name, class extends Selector { + includesAtom(atom) { + return (atom.residue._type.flags & flag) !== 0; } - /** - * Extract biological assemblies information from CIF structure and fill complex - * @param {Complex} complex - * @param complexData complex data from CIF file - * @private - */ - - }, { - key: "_extractAssemblies", - value: function _extractAssemblies(complex, complexData) { - var asymDict = this.asymDict; - var asmGen = complexData.pdbx_struct_assembly_gen; + }); +} +byResidueTypeFlag(chem_ResidueType.Flags.PROTEIN, 'Protein'); +byResidueTypeFlag(chem_ResidueType.Flags.BASIC, 'Basic'); +byResidueTypeFlag(chem_ResidueType.Flags.ACIDIC, 'Acidic'); +byResidueTypeFlag(chem_ResidueType.Flags.BASIC | chem_ResidueType.Flags.ACIDIC, 'Charged'); +byResidueTypeFlag(chem_ResidueType.Flags.POLAR, 'Polar'); +byResidueTypeFlag(chem_ResidueType.Flags.NONPOLAR, 'NonPolar'); +byResidueTypeFlag(chem_ResidueType.Flags.AROMATIC, 'Aromatic'); +byResidueTypeFlag(chem_ResidueType.Flags.NUCLEIC, 'Nucleic'); +byResidueTypeFlag(chem_ResidueType.Flags.PURINE, 'Purine'); +byResidueTypeFlag(chem_ResidueType.Flags.PYRIMIDINE, 'Pyrimidine'); +byResidueTypeFlag(chem_ResidueType.Flags.WATER, 'Water'); - if (!asmGen) { - return; - } +//---------------------------------------------------------------------------- +const selectors = Object.create(keywords); +selectors.Selector = Selector; +selectors.RangeListSelector = RangeListSelector; +selectors.ValueListSelector = ValueListSelector; +selectors.Range = Range; +selectors.RangeList = RangeList; +selectors.ValueList = ValueList; +selectors.PrefixOperator = PrefixOperator; +selectors.InfixOperator = InfixOperator; +selectors.Context = Object.create({}); +selectors.GetSelector = function (key) { + if (!selectors.Context.hasOwnProperty(key)) { + const exc = { + message: `selector ${key} is not registered` + }; + throw exc; + } + return selectors.Context[key] || NULL_SELECTOR; +}; +selectors.ClearContext = function () { + Object.keys(selectors.Context).forEach(k => { + delete selectors.Context[k]; + }); +}; +selectors.keyword = function (key) { + return keywords[key.toLowerCase()] || keywords.none; +}; +selectors.parse = function (str) { + const res = {}; + try { + res.selector = SelectionParser.parser.parse(str); + } catch (e) { + res.selector = NULL_SELECTOR; + res.error = e.message; + } + return res; +}; +SelectionParser.parser.yy = selectors; +SelectionParser.parser.yy.parseError = SelectionParser.parser.parseError; // workaround for incorrect JISON parser generator for AMD module - var asmIdx = arrize(asmGen.assembly_id); - var asmOper = arrize(asmGen.oper_expression); - var asmList = arrize(asmGen.asym_id_list); +/* harmony default export */ const chem_selectors = (selectors); +;// CONCATENATED MODULE: ./src/chem/BiologicalUnit.js - if (!asmIdx || !asmOper || !asmList) { - return; - } - var operList = _getOperations(complexData.pdbx_struct_oper_list); - if (!operList) { - return; +/** + * Basic biological unit class. + * + * @exports BiologicalUnit + * @constructor + */ +class BiologicalUnit { + constructor(complex) { + this._complex = complex; + this._selector = chem_selectors.keyword('All')(); + this._boundaries = { + boundingBox: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(), + boundingSphere: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Sphere() + }; + } + computeBoundaries() { + const atoms = this._complex._atoms; + const n = atoms.length; + const selector = this._selector; + const { + boundingBox + } = this._boundaries; + boundingBox.makeEmpty(); + if (n === 1) { + boundingBox.expandByPoint(atoms[0].position); + const bbc = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + boundingBox.getCenter(bbc); + const s = 2 * atoms[0].element.radius; + boundingBox.setFromCenterAndSize(bbc, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(s, s, s)); + } else { + for (let i = 0; i < n; ++i) { + if (selector.includesAtom(atoms[i])) { + boundingBox.expandByPoint(atoms[i].position); + } } + } - for (var i = 0, n = asmIdx.length; i < n; ++i) { - var asm = new Assembly$3(complex); - - var assemblyOps = _extractOperations(asmOper[i], operList); - - var entries = asmList[i].split(','); - - for (var ii = 0, nn = entries.length; ii < nn; ++ii) { - var chain = entries[ii].trim(); - - if (chain.length > 0) { - asm.addChain(asymDict[chain]); - } + // Build bounding sphere + let radiusSquared = 0.0; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + boundingBox.getCenter(center); + if (n === 1) { + this._boundaries.boundingSphere.set(center, atoms[0].element.radius); + } else { + for (let i = 0; i < n; ++i) { + if (!selector.includesAtom(atoms[i])) { + continue; + } + const pos = atoms[i].position; + const lengthSquared = center.distanceToSquared(pos); + if (radiusSquared < lengthSquared) { + radiusSquared = lengthSquared; } - - asm.matrices = assemblyOps; - complex.units.push(asm); } + this._boundaries.boundingSphere.set(center, Math.sqrt(radiusSquared)); } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && /^\s*data_/i.test(data); - } - }]); - - return CIFParser; -}(Parser); + } + getTransforms() { + return []; + } + getSelector() { + return this._selector; + } + getBoundaries() { + return this._boundaries; + } + finalize() {} +} +/* harmony default export */ const chem_BiologicalUnit = (BiologicalUnit); +;// CONCATENATED MODULE: ./src/chem/Assembly.js -CIFParser.formats = ['cif', 'mmcif']; -CIFParser.extensions = ['.cif', '.mmcif']; -var valueType = { - singular: 0, - vector: 1, - array: 2, - buffer: 3 -}; -var VolumeModel = /*#__PURE__*/function () { - function VolumeModel() { - classCallCheck(this, VolumeModel); - defineProperty(this, "_xyz2crs", []); +/** + * Biological assembly. + * + * @exports Assembly + * @constructor + */ - defineProperty(this, "_origin", new Vector3(0, 0, 0)); +class Assembly extends chem_BiologicalUnit { + constructor(complex) { + super(complex); + this.chains = []; + this.matrices = []; + } + computeBoundaries() { + super.computeBoundaries(); + // fix up the boundaries + const { + matrices + } = this; + const oldCenter = this._boundaries.boundingSphere.center; + const oldRad = this._boundaries.boundingSphere.radius; + const boundingBox = this._boundaries.boundingBox = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(); + boundingBox.makeEmpty(); + for (let i = 0, n = matrices.length; i < n; ++i) { + boundingBox.expandByPoint(oldCenter.clone().applyMatrix4(matrices[i])); + } + const newRad = boundingBox.max.distanceTo(boundingBox.min) / 2 + oldRad; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + boundingBox.getCenter(center); + this._boundaries.boundingSphere = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Sphere().set(center, newRad); + boundingBox.max.addScalar(oldRad); + boundingBox.min.subScalar(oldRad); + } - this._header = {}; - this._boxSize = new Vector3(); - this._boxStart = new Vector3(); - this._header.delta = {}; - this._header.extent = []; - this._header.nstart = []; - this._header.grid = []; - this._header.crs2xyz = []; - this._header.cellDims = new Vector3(); - this._header.angles = []; - this._header.origin = new Vector3(0, 0, 0); - this._header.dmin = 0; - this._header.dmean = 0; - this._header.dmax = 0; + /** + * Mark a chain as belonging to this biological assembly. + * @param {string} chain - chain identifier, usually a single letter + */ + addChain(chain) { + this.chains[this.chains.length] = chain; } - createClass(VolumeModel, [{ - key: "_typedCheck", - value: function _typedCheck() { - if (_.isTypedArray(this._buff)) { - this._buff = this._buff.buffer; - } else if (!_.isArrayBuffer(this._buff)) { - throw new TypeError('Expected ArrayBuffer or TypedArray'); + /** + * Add a transformation matrix. + * @param {THREE.Matrix4} matrix - transformation matrix + */ + addMatrix(matrix) { + this.matrices[this.matrices.length] = matrix; + } + getTransforms() { + return this.matrices; + } + finalize() { + if (this.chains.length > 0) { + this._selector = chem_selectors.keyword('Chain')(this.chains); + } else { + this._selector = chem_selectors.keyword('None')(); + } + } +} +/* harmony default export */ const chem_Assembly = (Assembly); +;// CONCATENATED MODULE: ./src/chem/Component.js +/** + * This class represents connected component as a part of a complex. + * WARNING! The whole component entity is build under the assumption that residues + * are placed in the chains and complex in ascending order of indices + * + * @param {Complex} complex - Molecular complex this chain belongs to. + * + * @exports Component + * @constructor + */ +class Component { + constructor(complex) { + this._complex = complex; + this._index = -1; + this._residueIndices = []; + this._cycles = []; + this._subDivs = []; + this._residueCount = 0; + } + getResidues() { + return this._complex._residues; + } + getResidueCount() { + return this._residueCount; + } + forEachResidue(process) { + const residues = this._complex._residues; + const resIdc = this._residueIndices; + for (let idIdc = 0, idCount = resIdc.length; idIdc < idCount; ++idIdc) { + for (let idx = resIdc[idIdc].start, last = resIdc[idIdc].end; idx <= last; ++idx) { + process(residues[idx]); + } + } + } + setSubDivs(subDivs) { + this._subDivs = subDivs; + let curr = 0; + const resIdc = []; + let resCnt = 0; + for (let i = 0, n = subDivs.length; i < n; ++i) { + if (i === n - 1 || subDivs[i].end + 1 !== subDivs[i + 1].start) { + const { + start + } = subDivs[curr]; + const { + end + } = subDivs[i]; + resIdc[resIdc.length] = { + start, + end + }; + resCnt += end - start + 1; + curr = i + 1; } } - }, { - key: "_fillHeader", - value: function _fillHeader(headerFormat, arrays) { - for (var key in headerFormat) { - if (headerFormat.hasOwnProperty(key)) { - switch (headerFormat[key][0]) { - case valueType.singular: - this._header[key] = arrays[headerFormat[key][1]][headerFormat[key][2]]; - break; - - case valueType.array: - this._parseArray(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]); - - break; - - case valueType.vector: - this._parseVector(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]); - - break; - - case valueType.buffer: - this._header[key] = new Uint8Array(arrays[headerFormat[key][1]], [headerFormat[key][2]] * 4, [headerFormat[key][3]] * 4); + this._residueIndices = resIdc; + this._residueCount = resCnt; + } + getComplex() { + return this._complex; + } + forEachBond(process) { + const bonds = this._complex._bonds; + for (let i = 0, n = bonds.length; i < n; ++i) { + const bond = bonds[i]; + if (bond._left.residue._component === this) { + process(bond); + } + } + } + update() { + this.forEachCycle(cycle => { + cycle.update(); + }); + } + forEachAtom(process) { + this.forEachResidue(residue => { + residue.forEachAtom(process); + }); + } + addCycle(cycle) { + this._cycles.push(cycle); + } + forEachCycle(process) { + const cycles = this._cycles; + for (let i = 0, n = cycles.length; i < n; ++i) { + process(cycles[i]); + } + } + markResidues() { + const self = this; + self.forEachResidue(residue => { + residue._component = self; + }); + } + _forEachSubChain(mask, process) { + const residues = this._complex._residues; + const subs = this._subDivs; + for (let i = 0, n = subs.length; i < n; ++i) { + for (let idx = subs[i].start, last = subs[i].end; idx <= last; ++idx) { + const currRes = residues[idx]; + if (mask & currRes._mask && currRes._isValid) { + let end = idx + 1; + for (; end <= last; ++end) { + const endRes = residues[end]; + if (!(mask & endRes._mask && endRes._isValid)) { break; + } } + process(i, idx, end - 1); + idx = end; } } } - }, { - key: "_parseVector", - value: function _parseVector(vector, arr, pos) { - var _ref = [arr[pos], arr[pos + 1], arr[pos + 2]]; - vector.x = _ref[0]; - vector.y = _ref[1]; - vector.z = _ref[2]; - } - }, { - key: "_parseArray", - value: function _parseArray(vector, arr, pos) { - vector[0] = arr[pos]; - vector[1] = arr[pos + 1]; - vector[2] = arr[pos + 2]; - } - }, { - key: "_parseHeader", - value: function _parseHeader(_buffer) {} - }, { - key: "_setAxisIndices", - value: function _setAxisIndices() {} - }, { - key: "_setOrigins", - value: function _setOrigins() {} - }, { - key: "_getAxis", - value: function _getAxis() { - var header = this._header; - var xScale = header.cellDims.x / header.grid[0]; - var yScale = header.cellDims.y / header.grid[1]; - var zScale = header.cellDims.z / header.grid[2]; - - var _header$angles = slicedToArray(header.angles, 3), - alpha = _header$angles[0], - beta = _header$angles[1], - gamma = _header$angles[2]; - - var z1 = Math.cos(beta); - var z2 = (Math.cos(alpha) - Math.cos(beta) * Math.cos(gamma)) / Math.sin(gamma); - var z3 = Math.sqrt(1.0 - z1 * z1 - z2 * z2); - var xaxis = new Vector3(xScale, 0, 0); - var yaxis = new Vector3(Math.cos(gamma) * yScale, Math.sin(gamma) * yScale, 0); - var zaxis = new Vector3(z1 * zScale, z2 * zScale, z3 * zScale); - return [xaxis, yaxis, zaxis]; - } - }, { - key: "_getXYZdim", - value: function _getXYZdim() { - return [this._header.extent[this._xyz2crs[0]], this._header.extent[this._xyz2crs[1]], this._header.extent[this._xyz2crs[2]]]; + } + getMaskedSequences(mask) { + const subs = []; + let idx = 0; + this._forEachSubChain(mask, (_subIdx, start, end) => { + subs[idx++] = { + start, + end + }; + }); + return subs; + } + getMaskedSubdivSequences(mask) { + const subs = []; + let currIdx = -1; + let lastSubIdx = -1; + const subDivs = this._subDivs; + this._forEachSubChain(mask, (subIdx, start, end) => { + if (lastSubIdx !== subIdx) { + ++currIdx; + subs[currIdx] = { + arr: [], + boundaries: subDivs[subIdx] + }; + lastSubIdx = subIdx; + } + subs[currIdx].arr[subs[currIdx].arr.length] = { + start, + end + }; + }); + return subs; + } +} +/* harmony default export */ const chem_Component = (Component); +;// CONCATENATED MODULE: ./src/chem/AtomPairs.js + +const cMaxPairsForHashCode = 32; +const cHashTableSize = 1024 * 1024; +const cNumbersPerPair = 4; +const cMaxNeighbours = 14; +const cInvalidVal = -1; +// 89237 is a large simple number, can be used for pseudo random hash code create +const cBigPrime = 89237; +class AtomPairs { + constructor(maxPairsEstimate) { + this.numPairs = 0; + this.numMaxPairs = maxPairsEstimate; + this.intBuffer = utils.allocateTyped(Int32Array, maxPairsEstimate * cNumbersPerPair); + for (let i = 0; i < maxPairsEstimate * cNumbersPerPair; i++) { + this.intBuffer[i] = cInvalidVal; } - }, { - key: "_getVolumeInfo", - value: function _getVolumeInfo() { - var volInfo = _.pick(this._header, ['dmean', 'dmin', 'dmax', 'sd', 'delta']); - - volInfo.obtuseAngle = this._header.angles.map(function (angle) { - return Number(angle >= Math.PI / 2); - }); - return volInfo; + this.hashBuffer = utils.allocateTyped(Int32Array, cHashTableSize * cMaxPairsForHashCode); + for (let i = 0; i < cHashTableSize * cMaxPairsForHashCode; i++) { + this.hashBuffer[i] = cInvalidVal; } - }, { - key: "_setBoxParams", - value: function _setBoxParams(xaxis, yaxis, zaxis) { - var _this = this; - - // if axes are not orthogonal, the origins might not match with box coordinates - need to make shift - var shiftX = 0; - var shiftY = 0; - - var _this$_header$angles = slicedToArray(this._header.angles, 3), - alpha = _this$_header$angles[0], - beta = _this$_header$angles[1], - gamma = _this$_header$angles[2]; + } - if (gamma >= Math.PI / 2) { - shiftX += Math.abs(yaxis.x); - } + /** + * Destroy all pairs memory + */ + destroy() { + this.intBuffer = null; + this.hashBuffer = null; + } - if (beta >= Math.PI / 2) { - shiftX += Math.abs(zaxis.x); + /** + * Add pair of atoms to collection + * @param {number} indexA - Index of the 1st vertex. + * @param {number} indexB - Index of the 2nd vertex. + */ + addPair(indexA, indexB) { + const ia = indexA < indexB ? indexA : indexB; + const ib = indexA > indexB ? indexA : indexB; + const codeToAdd = ia + (ib << cMaxNeighbours); + const hashCode = ia + ib * cBigPrime & cHashTableSize - 1; + let j = hashCode * cMaxPairsForHashCode; + let apI = 0; + for (; apI < cMaxPairsForHashCode; apI++) { + const code = this.hashBuffer[j + apI]; + if (code === cInvalidVal) { + break; } - - if (alpha >= Math.PI / 2) { - shiftY += Math.abs(zaxis.y); + if (code === codeToAdd) { + return false; } - - this._boxStart = new Vector3(this._origin.x - shiftX, this._origin.y - shiftY, this._origin.z); - this._boxSize = new Vector3(Math.abs(xaxis.x) + Math.abs(yaxis.x) + Math.abs(zaxis.x), Math.abs(yaxis.y) + Math.abs(zaxis.y), Math.abs(zaxis.z)); - - var delta = function delta(axe, proj) { - return Math.abs(axe[proj]) / _this._boxSize[proj]; - }; - - this._header.delta.x = delta(yaxis, 'x'); - this._header.delta.y = delta(zaxis, 'x'); - this._header.delta.z = delta(zaxis, 'y'); } - }, { - key: "_getXYZbox", - value: function _getXYZbox() { - return new Box3(this._boxStart.clone(), this._boxStart.clone().add(this._boxSize)); + // add this new hash code + if (apI >= cMaxPairsForHashCode) { + throw new Error('addPair: increase cMaxPairsForHashCode'); } - }, { - key: "_toXYZData", - value: function _toXYZData() {} - }, { - key: "parse", - value: function parse(data) { - this._parseHeader(data); + this.hashBuffer[j + apI] = codeToAdd; - this._setOrigins(); - - return new Volume(Float32Array, this._getXYZdim(), this._getXYZbox(), 1, this._toXYZData(), this._getVolumeInfo()); + // actually add + if (this.numPairs >= this.numMaxPairs) { + throw new Error('addPair: increase num pairs'); } - }]); - - return VolumeModel; -}(); - -var CCP4Header = { - extent: [valueType.array, 'u32', 0], - type: [valueType.singular, 'u32', 3], - nstart: [valueType.array, 'i32', 4], - grid: [valueType.array, 'u32', 7], - cellDims: [valueType.vector, 'f32', 10], - angles: [valueType.array, 'f32', 13], - crs2xyz: [valueType.array, 'i32', 16], - dmin: [valueType.singular, 'f32', 19], - dmax: [valueType.singular, 'f32', 20], - dmean: [valueType.singular, 'f32', 21], - ispg: [valueType.singular, 'u32', 22], - nsymbt: [valueType.singular, 'u32', 23], - lksflg: [valueType.singular, 'u32', 24], - customData: [valueType.buffer, 'buffer', 25, 9], - origin: [valueType.vector, 'f32', 34], - map: [valueType.buffer, 'buffer', 52, 1], - machine: [valueType.singular, 'u32', 53], - sd: [valueType.singular, 'f32', 54], - nlabel: [valueType.singular, 'f32', 55], - label: [valueType.buffer, 'buffer', 56, 200] -}; - -var Ccp4Model = /*#__PURE__*/function (_VolumeModel) { - inherits(Ccp4Model, _VolumeModel); - - function Ccp4Model() { - classCallCheck(this, Ccp4Model); - - return possibleConstructorReturn(this, getPrototypeOf(Ccp4Model).apply(this, arguments)); + j = this.numPairs * cNumbersPerPair; + this.intBuffer[j] = ia; + this.intBuffer[j + 1] = ib; + this.intBuffer[j + 2] = codeToAdd; + this.numPairs++; + return true; } +} +/* harmony default export */ const chem_AtomPairs = (AtomPairs); +;// CONCATENATED MODULE: ./src/chem/AutoBond.js - createClass(Ccp4Model, [{ - key: "_parseHeader", - // read header (http://www.ccp4.ac.uk/html/maplib.html) - value: function _parseHeader(_buffer) { - this._buff = _buffer; - this._typedCheck(); +const cProfileBondBuilder = false; +const cEstBondsMultiplier = 4; +const cSpaceCode = 32; +const cBondTolerance = 0.45; +const cVMDTolerance = 0.6; +const cBondRadInJMOL = true; +const cEpsilon = 0.001; - var arrays = {}; - arrays.u32 = new Uint32Array(this._buff, 0, 56); - arrays.i32 = new Int32Array(this._buff, 0, 56); - arrays.f32 = new Float32Array(this._buff, 0, 56); - arrays.buffer = this._buff; - var header = this._header; +/** + * Get radius used for building bonds. + * + * @param {Atom} atom - Atom object. + * @returns {number} special value for bonding radius for this atom + */ +function _getBondingRadius(atom) { + const { + element + } = atom; + if (element) { + return element.radiusBonding; + } + throw new Error('_getBondingRadius: Logic error.'); +} +function _isAtomEligible(atom) { + // build for all non-hetatm and for hetatm without bonds + return !atom.isHet() || atom.bonds && atom.bonds.length === 0; +} - this._fillHeader(CCP4Header, arrays); // calculate non-orthogonal unit cell coordinates +/** + * Bond between atoms. + * + * @param {Complex} complex molecular complex + * @exports AutoBond + * @constructor + */ +class AutoBond { + constructor(complex) { + this._complex = complex; + this._maxRad = 1.8; + const bBox = this._complex.getDefaultBoundaries().boundingBox; + this._vBoxMin = bBox.min.clone(); + this._vBoxMax = bBox.max.clone(); + this._pairCollection = null; + } - header.angles.forEach(function (angle, i, a) { - a[i] *= Math.PI / 180.0; - }); + /** + * Add existing pairs of connectors (from pdb file after its reading) + * @returns {number} 0 + */ + _addExistingPairs() { + const atoms = this._complex.getAtoms(); + const numAtoms = atoms.length; + let aInd = 0; + const collection = this._pairCollection; + for (; aInd < numAtoms; aInd++) { + const { + bonds + } = atoms[aInd]; + const numBondsForAtom = bonds.length; + for (let bInd = 0; bInd < numBondsForAtom; bInd++) { + const bond = bonds[bInd]; + const indTo = bond._left.index; + if (indTo === aInd) { + collection.addPair(aInd, bond._right.index); + } + } // for (b) all bonds in atom + } // for (a) + return 0; + } + _findPairs() { + const vw = this._complex.getVoxelWorld(); + if (vw === null) { + return; } - }, { - key: "_setAxisIndices", - value: function _setAxisIndices() { - var header = this._header; - - if (header.cellDims.x === 0.0 && header.cellDims.y === 0.0 && header.cellDims.z === 0.0) { - header.cellDims.set(1.0, 1.0, 1.0); - } // Apply header conversion - // Mapping between CCP4 column, row, section and VMD x, y, z. - - - var crs2xyz = this._header.crs2xyz; - - if (crs2xyz[0] === 0 && crs2xyz[1] === 0 && crs2xyz[2] === 0) { - crs2xyz[0] = 1; - crs2xyz[1] = 2; - crs2xyz[2] = 3; + const atoms = this._complex._atoms; + const atomsNum = atoms.length; + const self = this; + let rA; + let isHydrogenA; + let posA; + let locationA; + let atomA; + const processAtom = function (atomB) { + if (isHydrogenA && atomB.isHydrogen()) { + return; } - - var xyz2crs = this._xyz2crs; - xyz2crs[crs2xyz[0] - 1] = 0; // column - - xyz2crs[crs2xyz[1] - 1] = 1; // row - - xyz2crs[crs2xyz[2] - 1] = 2; // section - } - }, { - key: "_setOrigins", - value: function _setOrigins() { - var _this$_getAxis = this._getAxis(), - _this$_getAxis2 = slicedToArray(_this$_getAxis, 3), - xaxis = _this$_getAxis2[0], - yaxis = _this$_getAxis2[1], - zaxis = _this$_getAxis2[2]; - - this._setAxisIndices(); - - var header = this._header; - var xyz2crs = this._xyz2crs; // Handle both MRC-2000 and older format maps - - if (header.origin.x === 0.0 && header.origin.y === 0.0 && header.origin.z === 0.0) { - this._origin.addScaledVector(xaxis, header.nstart[xyz2crs[0]]); - - this._origin.addScaledVector(yaxis, header.nstart[xyz2crs[1]]); - - this._origin.addScaledVector(zaxis, header.nstart[xyz2crs[2]]); - } else { - this._origin = header.origin; // Use ORIGIN records rather than old n[xyz]start records - // http://www2.mrc-lmb.cam.ac.uk/image2000.html - // XXX the ORIGIN field is only used by the EM community, and - // has undefined meaning for non-orthogonal maps and/or non-cubic voxels, etc. + const locationB = atomB.location; + if (locationA !== cSpaceCode && locationB !== cSpaceCode && locationA !== locationB) { + return; } - - xaxis.multiplyScalar(header.extent[xyz2crs[0]] - 1); - yaxis.multiplyScalar(header.extent[xyz2crs[1]] - 1); - zaxis.multiplyScalar(header.extent[xyz2crs[2]] - 1); - - if (header.type === 2) { - this._data = new Float32Array(this._buff, 1024 + header.nsymbt, header.extent[0] * header.extent[1] * header.extent[2]); - } else { - throw new Error("CCP4: Unsupported format ".concat(header.type)); + const dist2 = posA.distanceToSquared(atomB.position); + const rB = atomB.element.radiusBonding; + const maxAcceptable = cBondRadInJMOL ? rA + rB + cBondTolerance : cVMDTolerance * (rA + rB); + if (dist2 > maxAcceptable * maxAcceptable) { + return; } - - this._setBoxParams(xaxis, yaxis, zaxis); - } - }, { - key: "_toXYZData", - value: function _toXYZData() { - var header = this._header; - var data = this._data; - var xyz2crs = this._xyz2crs; - var xyzData = new Float32Array(data.length); - - var dim = this._getXYZdim(); - - var xSize = dim[0]; - var ySize = dim[1]; - var crsIdx = 0; - var coord = []; - var x; - var y; - var z; - - for (coord[2] = 0; coord[2] < header.extent[2]; coord[2]++) { - // Site - for (coord[1] = 0; coord[1] < header.extent[1]; coord[1]++) { - // Row - for (coord[0] = 0; coord[0] < header.extent[0]; coord[0]++, crsIdx++) { - // Column - x = coord[xyz2crs[0]]; - y = coord[xyz2crs[1]]; - z = coord[xyz2crs[2]]; - xyzData[x + xSize * (y + ySize * z)] = data[crsIdx]; - } - } + if (dist2 < cEpsilon) { + return; } - - return xyzData; + self._pairCollection.addPair(atomA.index, atomB.index); + }; + for (let i = 0; i < atomsNum; ++i) { + atomA = atoms[i]; + if (!_isAtomEligible(atomA)) { + continue; + } + rA = atomA.element.radiusBonding; + isHydrogenA = atomA.isHydrogen(); + posA = atomA.position; + locationA = atomA.location; + vw.forEachAtomWithinRadius(posA, 2 * this._maxRad + cBondTolerance, processAtom); } - }]); - - return Ccp4Model; -}(VolumeModel); - -var CCP4Parser = /*#__PURE__*/function (_Parser) { - inherits(CCP4Parser, _Parser); - - function CCP4Parser(data, options) { - var _this; - - classCallCheck(this, CCP4Parser); - - _this = possibleConstructorReturn(this, getPrototypeOf(CCP4Parser).call(this, data, options)); - _this._options.fileType = 'ccp4'; - _this.model = new Ccp4Model(); - return _this; } - - createClass(CCP4Parser, [{ - key: "parseSync", - value: function parseSync() { - return this.model.parse(this._data); - } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(_data) { - return false; // Autodetection is not implemented yet + _addPairs() { + const atoms = this._complex._atoms; + for (let i = 0, k = 0; i < this._pairCollection.numPairs; i++, k += 4) { + const iA = this._pairCollection.intBuffer[k]; + const iB = this._pairCollection.intBuffer[k + 1]; + this._addPair(atoms[iA], atoms[iB]); } - }]); - - return CCP4Parser; -}(Parser); - -CCP4Parser.formats = ['ccp4']; -CCP4Parser.extensions = ['.ccp4', '.map', '.mrc']; -CCP4Parser.binary = true; - -var Complex$5 = chem.Complex, - Element$6 = chem.Element, - Molecule$4 = chem.Molecule; - -var XYZParser = /*#__PURE__*/function (_Parser) { - inherits(XYZParser, _Parser); - - function XYZParser(data, options) { - var _this; - - classCallCheck(this, XYZParser); - - _this = possibleConstructorReturn(this, getPrototypeOf(XYZParser).call(this, data, options)); - _this._complex = null; - _this._atomsInf = null; - _this._options.fileType = 'xyz'; - _this._fileName = options.name; - return _this; } - - createClass(XYZParser, [{ - key: "_parseToAtomsInf", - value: function _parseToAtomsInf(source) { - var endnAtoms = source.indexOf('\n'); - var nAtoms = parseInt(source.substring(0, endnAtoms), 10); - var endComment = source.indexOf('\n', endnAtoms + 1); - var comment = source.slice(endnAtoms + 1, endComment).trim(); - - if (comment.length === 0) { - comment = this._fileName; - } - - var startAtomsInf = endComment + source.substring(endComment).search(/\S/); - this._atomsInf = source.substring(startAtomsInf).split(/[\s,]*\n[\s,]*/); - - if (!Number.isNaN(nAtoms) && this._atomsInf.length - 1 !== nAtoms) { - this._complex.error = { - message: 'wrong number of atoms' - }; + _addPair(atomA, atomB) { + const bondsA = atomA.bonds; + const indexA = atomA.index; + const indexB = atomB.index; + for (let j = 0, numBonds = bondsA.length; j < numBonds; ++j) { + const bond = bondsA[j]; + if (bond._left.index === indexB || bond._right.index === indexB) { return; } - - this._complex.metadata.format = 'xyz'; - this._complex.name = comment; } - }, { - key: "_parseAtomsInf", - value: function _parseAtomsInf() { - var het = true; - var altLoc = ' '; - var occupancy = 1; - var tempFactor = 1; - var charge = 0; - - var chain = this._complex.addChain('A'); - - var residue = chain.addResidue('UNK', 1, ' '); - - for (var i = 0; i < this._atomsInf.length - 1; i++) { - var words = this._atomsInf[i].split(/[\s,]+/); - - if (words.length !== 4) { - this._complex.error = { - message: 'missed parameters' - }; - break; - } - - var serial = i + 1; - var name = words[0]; - var xyz = new Vector3(parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3])); - var type = Element$6.getByName(name); - var role = undefined; - residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); - } - - var molecule = new Molecule$4(this._complex, this._complex.name, 1); - molecule.residues = residue; - this._complex._molecules[0] = molecule; + const left = indexA < indexB ? atomA : atomB; + const right = indexA < indexB ? atomB : atomA; + const newBond = this._complex.addBond(left, right, 0, chem_Bond.BondType.UNKNOWN, false); + bondsA.push(newBond); + atomB.bonds.push(newBond); + } + build() { + if (cProfileBondBuilder) { + console.time('Bonds Builder'); } - }, { - key: "parseSync", - value: function parseSync() { - var result = this._complex = new Complex$5(); - - this._parseToAtomsInf(this._data); - - this._parseAtomsInf(); - - this._complex.finalize({ - needAutoBonding: true, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); - - this._complex = null; - this._atomsInf = null; - - if (result.error) { - throw new Error(result.error.message); - } - - return result; + this._buildInner(); + if (cProfileBondBuilder) { + console.timeEnd('Bonds Builder'); } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && /^\s*\d+ *\n[^\n]*\n\s*\w{1,3}\s+-?\d/.test(data); + } + _buildInner() { + const atoms = this._complex._atoms; + if (atoms.length < 2) { + return; } - }]); - - return XYZParser; -}(Parser); - -defineProperty(XYZParser, "formats", ['xyz']); - -defineProperty(XYZParser, "extensions", ['.xyz']); + if (atoms[0].index < 0) { + throw new Error('AutoBond: Atoms in complex were not indexed.'); + } + this._calcBoundingBox(); + this._pairCollection = new chem_AtomPairs(atoms.length * cEstBondsMultiplier); + this._addExistingPairs(); + this._findPairs(); + this._addPairs(); + } + _calcBoundingBox() { + const atoms = this._complex._atoms; + const nAtoms = atoms.length; + let maxRad = _getBondingRadius(atoms[0]); + for (let i = 1; i < nAtoms; ++i) { + maxRad = Math.max(maxRad, _getBondingRadius(atoms[i])); + } + this._vBoxMax.addScalar(maxRad); + this._vBoxMin.addScalar(-maxRad); + this._maxRad = maxRad * 1.2; + } + destroy() { + if (this._pairCollection) { + this._pairCollection.destroy(); + } + } +} +/* harmony default export */ const chem_AutoBond = (AutoBond); +;// CONCATENATED MODULE: ./src/chem/AromaticLoopsMarker.js -var Complex$6 = chem.Complex, - Element$7 = chem.Element; -var PubChemParser = /*#__PURE__*/function (_Parser) { - inherits(PubChemParser, _Parser); - function PubChemParser(data, options) { - var _this; +const cCrossThresh = 0.1; +const cAromaticType = chem_Bond.BondType.AROMATIC; +const cAromaticAtoms = [chem_Element.ByName.C.number, chem_Element.ByName.N.number +// Element.ByName.O.number, +// Element.ByName.S.number, +]; - classCallCheck(this, PubChemParser); +/** Conditions for bonds: + * - Cross product with each subsequent bond to add is collinear and point to the same direction + * - Each pair of a adjacent bonds belong to not more than one cycle + * - If there is more than one candidates we try them in ascending order of angle values + */ - _this = possibleConstructorReturn(this, getPrototypeOf(PubChemParser).call(this, data, options)); - _this._options.fileType = 'pubchem+json'; - return _this; +const _coDirVectors = function () { + const v1Tmp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const v2Tmp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const cp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + return function (v1, v2) { + v1Tmp.copy(v1).normalize(); + v2Tmp.copy(v2).normalize(); + cp.crossVectors(v1Tmp, v2Tmp); + if (cp.length() > cCrossThresh) { + return false; + } + // zero vector in out terms must be collinear to any + return v1Tmp.dot(v2Tmp) >= 0; + }; +}(); +function _insertAscending(arr, val) { + let idx = 0; + while (idx < arr.length && arr[idx] < val) { + ++idx; } - - createClass(PubChemParser, [{ - key: "parseSync", - value: function parseSync() { - this.logger.info('Parsing PubChem JSON file...'); - return this._toComplex(JSON.parse(this._data)); + arr.splice(idx, 0, val); +} +function _anotherAtom(bond, currAtom) { + return bond._left === currAtom ? bond._right : bond._left; +} +function _cosBetween(v1, v2) { + const theta = v1.dot(v2) / Math.sqrt(v1.lengthSq() * v2.lengthSq()); + return external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MathUtils.clamp(theta, -1, 1); +} +function _markAromatic(bond) { + bond._type = cAromaticType; +} +class Cycle { + constructor(atomsList) { + this.atoms = atomsList; + this.update(); + } + update() { + const { + atoms + } = this; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const nA = atoms.length; + for (let j = 0; j < nA; ++j) { + center.add(atoms[j].position); + } + center.multiplyScalar(1.0 / nA); + this.center = center; + this.radius = center.distanceTo(atoms[0].position.clone().lerp(atoms[1].position, 0.5)); + } + forEachBond(process) { + const { + atoms + } = this; + const nA = atoms.length; + let currAtom = atoms[0]; + let nextAtom; + function checkBond(bond) { + if (bond._left === nextAtom || bond._right === nextAtom) { + process(bond); + } + } + for (let i = 0; i < nA; ++i) { + nextAtom = atoms[(i + 1) % nA]; + currAtom.forEachBond(checkBond); + currAtom = nextAtom; } - }, { - key: "_toComplex", - value: function _toComplex(jsonData) { - var complex = new Complex$6(); - var complexData = jsonData.PC_Compounds && jsonData.PC_Compounds[0]; - - if (complexData) { - this._extractAtoms(complex, complexData); - - complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing - }); + } +} +function _isAromatic(bond) { + return bond._type === cAromaticType; +} +function _isPossibleAromatic(bond) { + if (bond.type === cAromaticType) { + return true; + } + const rightIdx = cAromaticAtoms.indexOf(bond._right.element.number); + const leftIdx = cAromaticAtoms.indexOf(bond._left.element.number); + return rightIdx !== -1 && leftIdx !== -1; +} +function _checkCycleSimple(cycle) { + return cycle.length > 3; +} +function _checkCycleComplex(cycle) { + console.assert(cycle.length > 2); + return true; +} +class AromaticLoopsMarker { + constructor(complex) { + this._complex = complex; + const bondsData = new Array(complex._bonds.length); + const bondMarks = new Array(complex._bonds.length); + for (let i = 0, n = bondsData.length; i < n; ++i) { + bondsData[i] = []; + bondMarks[i] = false; + } + this._bondsData = bondsData; + this._bondMarks = bondMarks; + this._resetCycles(); + } + _resetCycles() { + this._cycles = []; + this._currIdx = -1; + } + _haveSameCycle(bondsData, bond1, bond2) { + const arr1 = bondsData[bond1._index]; + const arr2 = bondsData[bond2._index]; + const n1 = arr1.length; + const n2 = arr2.length; + let i1 = 0; + let i2 = 0; + while (i1 < n1 && i2 < n2) { + if (arr1[i1] === arr2[i2]) { + return true; + } + if (arr1[i1] > arr2[i2]) { + ++i2; + } else { + ++i1; } - - return complex; } - }, { - key: "_extractAtoms", - value: function _extractAtoms(complex, complexData) { - var aids = complexData.atoms && complexData.atoms.aid; - var elements = aids && complexData.atoms.element; - - if (!elements || aids.length !== elements.length) { - throw new Error('Unable to parse atom elements'); + return false; + } + _tryBond(prevBond, currRight, currDir) { + const bondsOrder = []; + const bondsData = this._bondsData; + const currLeft = _anotherAtom(prevBond, currRight); + const currVec = currRight.position.clone().sub(currLeft.position); + const startAtomRef = this._currStart; + const self = this; + const bondMarks = this._bondMarks; + let checkAromatic = this._checkBond; + bondMarks[prevBond._index] = true; + checkAromatic = checkAromatic === undefined ? _isAromatic : checkAromatic; + currRight.forEachBond(newBond => { + if (!checkAromatic(newBond) || newBond === prevBond || bondMarks[newBond._index] || self._haveSameCycle(bondsData, prevBond, newBond)) { + return; } - - elements = _.fromPairs(_.zip(aids, elements)); - var atoms = {}; - var coords = complexData.coords && complexData.coords[0]; - var model = coords && coords.conformers && coords.conformers[0]; - var xs = model && model.x; - var ys = model && model.y; - var zs = model && model.z || []; - aids = coords && coords.aid; - - if (!aids || !xs || !ys) { - throw new Error('Coordinates are not found in the file'); + const anotherAtom = _anotherAtom(newBond, currRight); + const anotherVec = anotherAtom.position.clone().sub(currRight.position); + const val = anotherAtom === startAtomRef ? -2.0 : 1 - _cosBetween(currVec, anotherVec); + const newDir = anotherVec.cross(currVec); + if (!_coDirVectors(newDir, currDir)) { + return; } - - var chain = complex.addChain(' '); - var residue = chain.addResidue('UNK', 1, ' '); - - for (var i = 0, n = aids.length; i < n; ++i) { - var aid = aids[i]; - var element = Element$7.ByAtomicNumber[elements[aid]]; - var xyz = new Vector3(xs[i], ys[i], zs[i] || 0.0); - atoms[aid] = residue.addAtom(element.name, element, xyz, undefined, true, aid, ' ', 1.0, 0.0, 0); + let idx = 0; + while (idx < bondsOrder.length && bondsOrder[idx].val < val) { + ++idx; } - - var aids1 = complexData.bonds && complexData.bonds.aid1; - var aids2 = complexData.bonds && complexData.bonds.aid2; - var orders = complexData.bonds && complexData.bonds.order || []; - - if (!aids1 || !aids2 || aids1.length !== aids2.length) { - return; + bondsOrder.splice(idx, 0, { + bond: newBond, + val, + dir: newDir + }); + }); + for (let i = 0, n = bondsOrder.length; i < n; ++i) { + const { + bond + } = bondsOrder[i]; + const newRight = bond._left === currRight ? bond._right : bond._left; + if (newRight === startAtomRef) { + ++this._currIdx; + this._cycles.push([currRight]); + bondMarks[prevBond._index] = false; + return true; } - - for (var j = 0, m = aids1.length; j < m; ++j) { - complex.addBond(atoms[aids1[j]], atoms[aids2[j]], orders[j] || 1, 0, true); + if (this._tryBond(bond, newRight, bondsOrder[i].dir)) { + _insertAscending(bondsData[bond._index], this._currIdx); + this._cycles[this._currIdx].push(currRight); + bondMarks[prevBond._index] = false; + return true; } } - }], [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && data[0] === '{'; - } - }]); - - return PubChemParser; -}(Parser); - -PubChemParser.formats = ['pubchem', 'pubchem+json', 'pc']; -PubChemParser.extensions = ['.json']; - -var SDFStream = /*#__PURE__*/function () { - function SDFStream(data) { - classCallCheck(this, SDFStream); - - this._strings = data.split(/\r?\n|\r/); - this._currentStart = 0; - this._currentStringIndx = 0; + bondMarks[prevBond._index] = false; + return false; } - - createClass(SDFStream, [{ - key: "setStart", - value: function setStart(start) { - if (start >= this._strings.length) { - this._currentStart = this._strings.length - 1; - this._currentStringIndx = this._strings.length - 1; - } else { - this._currentStart = start; - this._currentStringIndx = start; - } - } - }, { - key: "getNextString", - value: function getNextString() { - return this._strings[++this._currentStringIndx]; - } - }, { - key: "getCurrentString", - value: function getCurrentString() { - return this._strings[this._currentStringIndx]; + _startCycle(bond) { + // start from left to right + this._currStart = bond._left; + if (this._tryBond(bond, bond._right, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3())) { + _insertAscending(this._bondsData[bond._index], this._currIdx); + this._cycles[this._currIdx].push(bond._left); } - }, { - key: "getStringFromStart", - value: function getStringFromStart(numb) { - this._currentStringIndx = this._currentStart + numb; - return this._strings[this._currentStart + numb]; - } - }, { - key: "findNextDataItem", - value: function findNextDataItem() { - var curStr = this.getNextString(); - var res = false; - - while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') { - if (curStr.match(/>\s+<(.*)>/)) { - res = true; - break; + } + _findLoops(checkBond, checkCycle) { + this._checkBond = checkBond; + const complex = this._complex; + const self = this; + complex.forEachComponent(component => { + self._resetCycles(); + component.forEachBond(bond => { + if (checkBond(bond)) { + self._startCycle(bond); } - - curStr = this.getNextString(); - } - - return res; - } - }, { - key: "findNextCompoundStart", - value: function findNextCompoundStart() { - var curStr = this.getCurrentString(); - - while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') { - curStr = this.getNextString(); + }); + const cycles = self._cycles; + for (let i = 0, n = cycles.length; i < n; ++i) { + const cycle = cycles[i]; + if (!checkCycle(cycle)) { + continue; + } + const newCycle = new Cycle(cycle); + newCycle.forEachBond(_markAromatic); + component.addCycle(newCycle); } - - this.setStart(++this._currentStringIndx); - return this.probablyHaveDataToParse(); - } - }, { - key: "probablyHaveDataToParse", - value: function probablyHaveDataToParse() { - return this._currentStringIndx < this._strings.length - 2; - } - }]); - - return SDFStream; -}(); - -var Complex$7 = chem.Complex, - Element$8 = chem.Element, - Bond$4 = chem.Bond, - Molecule$5 = chem.Molecule; -var chargeMap = [0, 3, 2, 1, 0, -1, -2, -3]; -var orderMap = [0, 1, 2, 3, 1, 1, 1, 2]; -var typeMap = [Bond$4.BondType.UNKNOWN, // 0 - error -Bond$4.BondType.COVALENT, // 1 - single -Bond$4.BondType.COVALENT, // 2 - double -Bond$4.BondType.COVALENT, // 3 - triple -Bond$4.BondType.AROMATIC, // 4 - aromatic -Bond$4.BondType.UNKNOWN, // 5 - single or double -Bond$4.BondType.AROMATIC, // 6 - single or aromatic -Bond$4.BondType.AROMATIC // 7 - double or aromatic -// 8 - any -// 9 - coordination -// 10 - hydrogen -]; -var sdfAndMolRegexp = /.*(M\s\sEND).*|.*(^$$$$).*|.*>\s+<(.+)>.*/; -var sdfRegExp = /.*($$$$).*|.*>\s+<(.+)>.*/; -var fileFormat = { - SDF: 'sdf', - MOL: 'mol' -}; -var possibleNameTags = ['PUBCHEM_IUPAC_TRADITIONAL_NAME', /PUBCHEM_(.+)_NAME/, /(.+)name/, /(.+)NAME/]; -var possibleIDTags = ['PUBCHEM_COMPOUND_CID', 'id', 'ID', /.*CID/, /.*ID/, /.*id/]; -var possibleTitleTags = ['msg', 'MSG', 'message', 'title', 'description', 'desc']; -var tagsNames = ['name', 'id', 'title']; -var tags = { - name: possibleNameTags, - id: possibleIDTags, - title: possibleTitleTags -}; - -function buildChainID(index) { - if (!index) { - return 'A'; + }); } + markCycles() { + this._findLoops(_isAromatic, _checkCycleSimple); + } + detectCycles() { + this._findLoops(_isPossibleAromatic, _checkCycleComplex); + } +} +/* harmony default export */ const chem_AromaticLoopsMarker = (AromaticLoopsMarker); +;// CONCATENATED MODULE: ./src/chem/VoxelWorld.js - var codes = []; - while (index) { - codes.push(65 + index % 26); - index = Math.trunc(index / 26); - } - if (codes.length > 1) { - codes.reverse(); - codes[0] -= 1; +/** + * Calculate min & max radius of a sphere slice between zMin & zMax + * + * @param {Vector3} center - center of the sphere + * @param {number} radius - sphere radius + * @param {number} zMin - lower bound of the slice + * @param {number} zMax - upper bound of the slice + */ +function _getSphereSliceRadiusRange(center, radius, zMin, zMax) { + const dzMin = zMin - center.z; + const dzMax = zMax - center.z; + const rzMin = Math.sqrt(Math.max(radius * radius - dzMin * dzMin, 0.0)); + const rzMax = Math.sqrt(Math.max(radius * radius - dzMax * dzMax, 0.0)); + const rMin = Math.min(rzMin, rzMax); + let rMax; + if (zMin <= center.z && zMax >= center.z) { + // sphere's main diameter is inside slice + rMax = radius; + } else { + rMax = Math.max(rzMin, rzMax); } + return [rMin, rMax]; +} - return String.fromCharCode.apply(String, codes); +/** + * Calculate min & max radius of a circle slice between yMin & yMax. + * + * To maintain analogy with _getSphereSliceRadiusRange we call radius what in fact is + * half-width (along X axis) of the slice, i.e. 1D-sphere radius. + * + * @param {Vector3} center - center of the circle (z can be ignored) + * @param {number} radius - circle radius + * @param {number} yMin - lower bound of the slice + * @param {number} yMax - upper bound of the slice + * @returns {Array} - array of two numbers (min & max radius, or half-width) + */ +function _getCircleSliceRadiusRange(center, radius, yMin, yMax) { + const dyMin = yMin - center.y; + const dyMax = yMax - center.y; + const ryMin = Math.sqrt(Math.max(radius * radius - dyMin * dyMin, 0.0)); + const ryMax = Math.sqrt(Math.max(radius * radius - dyMax * dyMax, 0.0)); + const rMin = Math.min(ryMin, ryMax); + let rMax; + if (yMin <= center.y && yMax >= center.y) { + // slice's main diameter is inside slice + rMax = radius; + } else { + rMax = Math.max(ryMin, ryMax); + } + return [rMin, rMax]; } -var SDFParser = /*#__PURE__*/function (_Parser) { - inherits(SDFParser, _Parser); +/** + * VoxelWorld constructor + * + * @param {Box3} box - bounding box of the volume to be partitioned + * @param {Vector3} vCellSizeHint - target voxel size (actual voxel size may differ from this) + */ +class VoxelWorld { + constructor(box, vCellSizeHint) { + this._box = box.clone(); + const size = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + box.getSize(size); + this._count = size.clone().divide(vCellSizeHint).floor().max(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1, 1, 1)); + this._last = this._count.clone().subScalar(1); + this._cellSize = size.clone().divide(this._count); + this._cellInnerR = 0.5 * Math.min(Math.min(this._cellSize.x, this._cellSize.y), this._cellSize.z); + this._cellOuterR = 0.5 * Math.sqrt(this._cellSize.dot(this._cellSize)); - function SDFParser(data, options) { - var _this; + // array of voxels, each element contains index of first atom in voxel + const numVoxels = this._count.x * this._count.y * this._count.z; + this._voxels = utils.allocateTyped(Int32Array, numVoxels); + for (let i = 0; i < numVoxels; ++i) { + this._voxels[i] = -1; + } - classCallCheck(this, SDFParser); + // array of atoms that stores multiple single-linked lists + // two elements for each atom: Atom ref, index of next atom (in this array + this._atoms = []; + } - _this = possibleConstructorReturn(this, getPrototypeOf(SDFParser).call(this, data, options)); - _this._format = 'sdf'; - _this._complex = null; - _this._chain = null; - _this._residue = null; - _this._molecules = null; - _this._metadata = {}; - _this._metadata.molecules = []; - _this._currentMolProps = {}; - _this._compoundIndx = -1; - _this._assemblies = []; - _this._atomsParsed = 0; - _this._atomsIndexes = []; - return _this; + /** + * Add all atoms from a complex to voxel world + * + * @param {Complex} complex - complex + */ + addAtoms(complex) { + const self = this; + let idx = this._atoms.length; + + // resize array of atoms + this._atoms.length += 2 * complex.getAtomCount(); + complex.forEachAtom(atom => { + // find which voxel contains this atom + const voxelIdx = self._findVoxel(atom.position); + + // push current atom to the head of voxel's atom list + self._atoms[idx] = atom; + self._atoms[idx + 1] = self._voxels[voxelIdx]; + self._voxels[voxelIdx] = idx; + idx += 2; + }); } - createClass(SDFParser, [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(data) && sdfAndMolRegexp.test(data); - } - }, { - key: "_parseHeader", - value: function _parseHeader(stream) { - var molecule = {}; - molecule.name = stream.getStringFromStart(0); - var date = parseInt(stream.getStringFromStart(1).substr(10, 6).trim(), 10); - molecule.date = date.toString() || ''; - molecule.title = stream.getStringFromStart(2); + /** + * Get voxel that contains specified 3D point (we use clamp at the edges) + * + * @param {Vector3} point - a point in 3D + * @returns {number} - index of voxel + */ + static _zero = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0))(); + static _voxel = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3())(); + _findVoxel(point) { + const zero = VoxelWorld._zero; + const voxel = VoxelWorld._voxel; + voxel.copy(point).sub(this._box.min).divide(this._cellSize).floor().clamp(zero, this._last); + return voxel.x + this._count.x * (voxel.y + this._count.y * voxel.z); + } - this._metadata.molecules.push(molecule); + /** + * Call a function for each atom in voxel + * + * @param {number} voxel - index of voxel + * @param {function(Atom)} process - function to call + */ + _forEachAtomInVoxel(voxel, process) { + for (let i = this._voxels[voxel]; i >= 0; i = this._atoms[i + 1]) { + process(this._atoms[i]); } - }, { - key: "_parseAtoms", - value: function _parseAtoms(stream, atomsNum) { - var curStr; - var serial = this._atomsParsed; // each molecule = chain\residue - - var chainID = buildChainID(this._compoundIndx); - var resName = 'UNK'; - var resSeq = 1; - this._chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); - this._residue = this._chain.addResidue(resName, resSeq, ' '); + } - for (var i = 0; i < atomsNum; i++) { - curStr = stream.getNextString(); - serial++; - var x = parseFloat(curStr.substr(0, 10)); - var y = parseFloat(curStr.substr(10, 10)); - var z = parseFloat(curStr.substr(20, 10)); - var charge = chargeMap[parseInt(curStr.substr(36, 3), 10)]; - var xyz = new Vector3(x, y, z); - var name = curStr.substr(31, 3).trim().toUpperCase(); - var type = Element$8.getByName(name); + /** + * Call a function for each voxel that is touched by given sphere. Callback also takes flag + * isInside specifying whether voxel lies inside the sphere entirely. + * + * @param {Vector3} center - center of the sphere + * @param {number} radius - sphere radius + * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside + */ - if (!this._atomsIndexes[name]) { - this._atomsIndexes[name] = 0; + static _xRange = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2())(); + static _yRange = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2())(); + static _zRange = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2())(); + _forEachVoxelWithinRadius(center, radius, process) { + const xRange = VoxelWorld._xRange; + const yRange = VoxelWorld._yRange; + const zRange = VoxelWorld._zRange; + + // switch to a faster method unless cell size is much smaller than sphere radius + if (radius / this._cellInnerR < 10) { + this._forEachVoxelWithinRadiusSimple(center, radius, process); + return; + } + let rRangeXY; + let rRangeX; + let xVal; + let yVal; + let zVal; + let isInsideX; + let isInsideY; + let isInsideZ; + zRange.set(center.z - radius, center.z + radius); + zRange.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor().clampScalar(0, this._count.z - 1); + for (let z = zRange.x; z <= zRange.y; ++z) { + zVal = [this._box.min.z + z * this._cellSize.z, this._box.min.z + (z + 1) * this._cellSize.z]; + isInsideZ = center.z - radius <= zVal[0] && zVal[1] <= center.z + radius; + rRangeXY = _getSphereSliceRadiusRange(center, radius, zVal[0], zVal[1]); + yRange.set(center.y - rRangeXY[1], center.y + rRangeXY[1]); + yRange.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor().clampScalar(0, this._count.y - 1); + for (let y = yRange.x; y <= yRange.y; ++y) { + yVal = [this._box.min.y + y * this._cellSize.y, this._box.min.y + (y + 1) * this._cellSize.y]; + isInsideY = center.y - rRangeXY[0] <= yVal[0] && yVal[1] <= center.y + rRangeXY[0]; + rRangeX = _getCircleSliceRadiusRange(center, rRangeXY[1], yVal[0], yVal[1]); + xRange.set(center.x - rRangeX[1], center.x + rRangeX[1]); + xRange.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor().clampScalar(0, this._count.x - 1); + for (let { + x + } = xRange; x <= xRange.y; ++x) { + xVal = [this._box.min.x + x * this._cellSize.x, this._box.min.x + (x + 1) * this._cellSize.x]; + isInsideX = center.x - rRangeX[0] <= xVal[0] && xVal[1] <= center.x + rRangeX[0]; + process(x + this._count.x * (y + this._count.y * z), isInsideX && isInsideY && isInsideZ); } - - this._atomsIndexes[name] += 1; - name += this._atomsIndexes[name]; // every atom need to have unique name. - - this._residue.addAtom(name, type, xyz, undefined, true, serial, ' ', 1.0, 0.0, charge); } } - }, { - key: "_parseBonds", - value: function _parseBonds(stream, bondsNum) { - var curStr; - - for (var i = 0; i < bondsNum; i++) { - curStr = stream.getNextString(); - - var atom1 = parseInt(curStr.substr(0, 3), 10) + this._atomsParsed; - - var atom2 = parseInt(curStr.substr(3, 3), 10) + this._atomsParsed; + } - var bondType = parseInt(curStr.substr(6, 3), 10); + /** + * Call a function for each voxel that is touched by given sphere. Callback also takes flag + * isInside specifying whether voxel lies inside the sphere entirely. + * This is a version of method that doesn't try to "calculate" what voxels fall inside radius + * but instead just checks all voxels inside sphere's bounding box. This should be faster + * unless cell size is much smaller than sphere radius. + * + * @param {Vector3} center - center of the sphere + * @param {number} radius - sphere radius + * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside + */ - if (atom1 > atom2) { - var _ref = [atom2, atom1]; - atom1 = _ref[0]; - atom2 = _ref[1]; + static _vCenter = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3())(); + _forEachVoxelWithinRadiusSimple(center, radius, process) { + const xRange = VoxelWorld._xRange; + const yRange = VoxelWorld._yRange; + const zRange = VoxelWorld._zRange; + const vCenter = VoxelWorld._vCenter; + const distTouch2 = (radius + this._cellOuterR) * (radius + this._cellOuterR); + let distInside2 = -1.0; + if (radius > this._cellOuterR) { + distInside2 = (radius - this._cellOuterR) * (radius - this._cellOuterR); + } + + // calculate bounding box for the sphere + xRange.set(center.x - radius, center.x + radius); + xRange.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor(); + xRange.x = Math.min(Math.max(xRange.x, 0), this._count.x - 1); + xRange.y = Math.min(Math.max(xRange.y, 0), this._count.x - 1); + yRange.set(center.y - radius, center.y + radius); + yRange.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor(); + yRange.x = Math.min(Math.max(yRange.x, 0), this._count.y - 1); + yRange.y = Math.min(Math.max(yRange.y, 0), this._count.y - 1); + zRange.set(center.z - radius, center.z + radius); + zRange.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor(); + zRange.x = Math.min(Math.max(zRange.x, 0), this._count.z - 1); + zRange.y = Math.min(Math.max(zRange.y, 0), this._count.z - 1); + for (let z = zRange.x; z <= zRange.y; ++z) { + const zVal = [this._box.min.z + z * this._cellSize.z, this._box.min.z + (z + 1) * this._cellSize.z]; + vCenter.z = 0.5 * (zVal[0] + zVal[1]); + for (let y = yRange.x; y <= yRange.y; ++y) { + const yVal = [this._box.min.y + y * this._cellSize.y, this._box.min.y + (y + 1) * this._cellSize.y]; + vCenter.y = 0.5 * (yVal[0] + yVal[1]); + for (let { + x + } = xRange; x <= xRange.y; ++x) { + const xVal = [this._box.min.x + x * this._cellSize.x, this._box.min.x + (x + 1) * this._cellSize.x]; + vCenter.x = 0.5 * (xVal[0] + xVal[1]); + const d2 = center.distanceToSquared(vCenter); + if (d2 <= distTouch2) { + process(x + this._count.x * (y + this._count.y * z), d2 <= distInside2); + } } - - this._complex.addBond(atom1, atom2, orderMap[bondType] || 1, typeMap[bondType] || Bond$4.BondType.UNKNOWN, true); } } - }, { - key: "_parseMOL", - value: function _parseMOL(stream) { - this._compoundIndx++; + } - this._parseHeader(stream); + /** + * Call a function for each atom within given sphere + * + * @param {Vector3} center - center of the sphere + * @param {number} radius - sphere radius + * @param {function(Atom)} process - function to call + */ + forEachAtomWithinRadius(center, radius, process) { + const self = this; + const r2 = radius * radius; + self._forEachVoxelWithinRadius(center, radius, (voxel, isInside) => { + if (isInside) { + self._forEachAtomInVoxel(voxel, process); + } else { + self._forEachAtomInVoxel(voxel, atom => { + if (center.distanceToSquared(atom.position) <= r2) { + process(atom); + } + }); + } + }); + } - var countsLine = stream.getStringFromStart(3); - var atomsNum = parseInt(countsLine.substr(0, 3), 10); - var bondsNum = parseInt(countsLine.substr(3, 3), 10); + /** + * Call a function for each atom of given complex within given distance from group of atoms defined by mask + * + * @param {Complex} complex - complex + * @param {number} mask - bit mask + * @param {number} dist - distance + * @param {function(Atom)} process - function to call + */ + forEachAtomWithinDistFromMasked(complex, mask, dist, process) { + this._forEachAtomWithinDistFromGroup(atomProc => { + complex.forEachAtom(atom => { + if ((atom.mask & mask) !== 0) { + atomProc(atom); + } + }); + }, dist, process); + } - this._parseAtoms(stream, atomsNum); + /** + * Call a function for each atom of given complex within given distance from group of atoms defined by selector + * + * @param {Complex} complex - complex + * @param {number} selector - selector + * @param {number} dist - distance + * @param {function(Atom)} process - function to call + */ + forEachAtomWithinDistFromSelected(complex, selector, dist, process) { + this._forEachAtomWithinDistFromGroup(atomProc => { + complex.forEachAtom(atom => { + if (selector.includesAtom(atom)) { + atomProc(atom); + } + }); + }, dist, process); + } - this._parseBonds(stream, bondsNum); + /** + * Call a function for each atom of given complex within given distance from group of atoms + * + * @param {function} forEachAtom - enumerator of atoms in the group + * @param {number} dist - distance + * @param {function(Atom)} process - function to call + */ + _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) { + const self = this; + const r2 = dist * dist; + const voxels = []; + const atoms = []; + let idx = 0; + + // build "within radius" atom list for each voxel + forEachAtom(atom => { + self._forEachVoxelWithinRadius(atom.position, dist, (voxel, isInside) => { + if (isInside) { + // this voxel is inside circle -- no check will be required + voxels[voxel] = -1; + } else if (typeof voxels[voxel] === 'undefined') { + // this voxel isn't covered yet -- start building list of atoms + atoms.push(atom); + atoms.push(-1); + voxels[voxel] = idx; + idx += 2; + } else if (voxels[voxel] !== -1) { + // this voxel has a list of atoms required for distance check -- add atom to the list + atoms.push(atom); + atoms.push(voxels[voxel]); + voxels[voxel] = idx; + idx += 2; + } + }); + }); + let voxel; + const processIfWithin = function (atom) { + if (typeof voxels[voxel] === 'undefined') { + return; + } + idx = voxels[voxel]; + if (idx === -1) { + // this voxel is fully covered + process(atom); + return; + } - this._atomsParsed += atomsNum; - this._metadata.molecules[this._compoundIndx]._residues = []; + // check distance to each atom within radius from this voxel + for (; idx >= 0; idx = atoms[idx + 1]) { + if (atom.position.distanceToSquared(atoms[idx].position) < r2) { + process(atom); + break; + } + } + }; - this._metadata.molecules[this._compoundIndx]._residues.push(this._residue); + // for each marked voxel + for (voxel in voxels) { + if (voxels.hasOwnProperty(voxel)) { + self._forEachAtomInVoxel(voxel, processIfWithin); + } } - }, { - key: "_parseDataItem", - value: function _parseDataItem(stream) { - var tag = stream.getCurrentString(); - var data = []; - var curStr = stream.getNextString(); // read data - - while (curStr.trim() !== '') { - data.push(curStr); - curStr = stream.getNextString(); + } +} +/* harmony default export */ const chem_VoxelWorld = (VoxelWorld); +;// CONCATENATED MODULE: ./src/chem/HBondInfo.js + + +const MINIMAL_DISTANCE = 0.5; +const MIN_HBOND_ENERGY = -9.9; +const MAX_HBOND_ENERGY = -0.5; +const COUPLING_CONSTANT = -27.888; // = -332 * 0.42 * 0.2 +const MAX_COUPLING_DISTANCE = 5.0; // how far is the closest atom of a potential partner residue from CA atom +const MAX_RESIDUES_THRESHOLD = 1000; +class HBondInfo { + constructor(complex) { + this._complex = complex; + this._hbonds = []; // array of bond info for each residue + if (this._complex._residues.length > MAX_RESIDUES_THRESHOLD) { + this._buildVW(); // optimized version using voxel grid + } else { + this._build(); // test all pairs of residues + } + } + isBond(from, to) { + if (this._hbonds[from]) { + const [acc0, acc1] = this._hbonds[from].acceptor; + if (acc0 && acc0.residue === to && acc0.energy < MAX_HBOND_ENERGY) { + return true; } - - if (data.length === 1) { - var _data = data; - - var _data2 = slicedToArray(_data, 1); - - data = _data2[0]; + if (acc1 && acc1.residue === to && acc1.energy < MAX_HBOND_ENERGY) { + return true; } - - this._currentMolProps[tag.replace(/[<>]/g, '').trim()] = data; } - }, { - key: "_parseCompound", - value: function _parseCompound(stream) { - this._parseMOL(stream); // parse data items block - - - if (this._format === fileFormat.SDF) { - this._currentMolProps = {}; + return false; + } + _build() { + const self = this; + for (let i = 0; i < this._complex._residues.length - 1; ++i) { + const ri = this._complex._residues[i]; + if ((ri.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + continue; + } - while (stream.findNextDataItem()) { - this._parseDataItem(stream); + // get predecessor in chain + let preri = null; + if (i > 0 && this._complex._residues[i - 1].getType().flags & chem_ResidueType.Flags.PROTEIN && ri._sequence === this._complex._residues[i - 1]._sequence + 1) { + preri = this._complex._residues[i - 1]; + } + for (let j = i + 1; j < this._complex._residues.length; ++j) { + const rj = this._complex._residues[j]; + if ((rj.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + continue; } - if (Object.keys(this._currentMolProps).length !== 0) { - var molecule = this._metadata.molecules[this._compoundIndx]; - molecule.props = this._currentMolProps; - - this._tryToUpdateMoleculeData(molecule); + // get predecessor in chain + let prerj = null; + if (this._complex._residues[j - 1].getType().flags & chem_ResidueType.Flags.PROTEIN && rj._sequence === this._complex._residues[j - 1]._sequence + 1) { + prerj = this._complex._residues[j - 1]; + } + self._calcHBondEnergy(preri, ri, rj); + if (j !== i + 1) { + self._calcHBondEnergy(prerj, rj, ri); } } } - }, { - key: "_fixBondsArray", - value: function _fixBondsArray() { - var serialAtomMap = this._serialAtomMap; - var complex = this._complex; - var bonds = complex._bonds; - - for (var j = 0; j < bonds.length; j++) { - var bond = bonds[j]; - - if (bond._right < bond._left) { - console.log('_fixBondsArray: Logic error.'); - } - - bond._left = serialAtomMap[bond._left] || null; - bond._right = serialAtomMap[bond._right] || null; + } + _buildVW() { + const self = this; + const residues = this._complex._residues; + let ri; + let preri; + const vw = this._complex.getVoxelWorld(); + if (vw === null) { + return; + } + const pairs = new chem_AtomPairs(this._complex._residues.length * this._complex._residues.length / 2); + function processAtom(atom) { + const rj = atom.residue; + if (rj._index === ri._index) { + return; } - } - }, { - key: "_buildAssemblies", - value: function _buildAssemblies() { - var chains = this._complex._chains; - - if (chains.length === 1) { - return this._assemblies; + if ((rj.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + return; } - - for (var i = 0; i < chains.length; i++) { - var assembly = new Assembly(this._complex); - var matrix = new Matrix4(); - assembly.addMatrix(matrix); - assembly.addChain(chains[i]._name); - - this._assemblies.push(assembly); + if (!pairs.addPair(ri._index, rj._index)) { + // we've seen this pair + return; } - return this._assemblies; - } - }, { - key: "_buildMolecules", - value: function _buildMolecules() { - this._complex._molecules = []; - var molecules = this._metadata.molecules; - - for (var i = 0; i < molecules.length; i++) { - var molecule = new Molecule$5(this._complex, molecules[i].name, i + 1); - molecule.residues = molecules[i]._residues; - this._complex._molecules[i] = molecule; + // get predecessor in chain + let prerj = rj._index > 0 ? residues[rj._index - 1] : null; + if (prerj && ((prerj.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0 || rj._sequence !== prerj._sequence + 1)) { + prerj = null; + } + self._calcHBondEnergy(preri, ri, rj); + if (rj._index !== ri._index + 1) { + self._calcHBondEnergy(prerj, rj, ri); } - - return this._complex._molecules; } - }, { - key: "_searchTag", - value: function _searchTag(tag, props) { - for (var i = 0; i < props.length; i++) { - if (tag instanceof RegExp && tag.test(props[i].tag) || tag === props[i].tag) { - return props[i].data; - } + for (let i = 0; i < residues.length - 1; ++i) { + ri = residues[i]; + if ((ri.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + continue; } - return undefined; + // get predecessor in chain + preri = i > 0 ? residues[i - 1] : null; + if (preri && ((preri.getType().flags & chem_ResidueType.Flags.PROTEIN) === 0 || ri._sequence !== preri._sequence + 1)) { + preri = null; + } + vw.forEachAtomWithinRadius(this._residueGetCAlpha(ri), MAX_COUPLING_DISTANCE, processAtom); } - }, { - key: "_tryToFind", - value: function _tryToFind(tagsList, props) { - for (var j = 0; j < tagsList.length; j++) { - var res = this._searchTag(tagsList[j], props); - - if (res) { - return res; - } + } + _residueGetCAlpha(res) { + for (let i = 0; i < res._atoms.length; ++i) { + const { + name + } = res._atoms[i]; + if (name === 'CA' || name === 'C1') { + return res._atoms[i].position; } - - return undefined; } - }, { - key: "_tryToUpdateMoleculeData", - value: function _tryToUpdateMoleculeData(molecule) { - var res = false; - - for (var i = 0; i < tagsNames.length; i++) { - var tagPossibleNames = tags[tagsNames[i]]; - - var data = this._tryToFind(tagPossibleNames, molecule.props); - - if (data) { - molecule[tagsNames[i]] = data; - res = true; - } + return null; + } + _residueGetCO(res) { + let c = null; + let o = null; + res.forEachAtom(a => { + if (a.name === 'C') { + c = a.position; + } else if (a.name === 'O') { + o = a.position; } + }); + return [c, o]; + } - molecule.name = molecule.name || molecule.id; - - if (molecule.name.match(/^\d+$/)) { - molecule.name = "CID: ".concat(molecule.name); + // TODO Support hydrogen defined in complex + _residueGetNH(prev, res) { + const [c, o] = this._residueGetCO(prev); + let n; + res.forEachAtom(a => { + if (a.name === 'N') { + n = a.position; } - - return res; + }); + if (c && o && n) { + // calculate hydrogen position + const h = c.clone(); + h.sub(o); + h.multiplyScalar(1.0 / h.length()); + h.add(n); + return [n, h]; + } + return [null, null]; + } + _calcHBondEnergy(predonor, donor, acceptor) { + let result = 0; + if (predonor === null) { + return result; } - }, { - key: "_finalizeMetadata", - value: function _finalizeMetadata() { - var molecules = this._metadata.molecules; - var metadata = this._complex.metadata; - var complex = this._complex; - - if (molecules.length === 1) { - complex.name = molecules[0].name; - metadata.title = molecules[0].title; - metadata.date = molecules[0].date; - metadata.properties = molecules[0].props; - } else if (molecules.length > 1) { - metadata.molecules = []; - - for (var i = 0; i < molecules.length; i++) { - metadata.molecules.push({ - name: molecules[i].name, - date: molecules[i].date, - title: molecules[i].title, - properties: molecules[i].props - }); - } + if (donor.getType().getName() !== 'PRO') { + const [n, h] = this._residueGetNH(predonor, donor); + const [c, o] = this._residueGetCO(acceptor); + if (n === null || h === null || c === null || o === null) { + return result; } - } - }, { - key: "_finalize", - value: function _finalize() { - var serialAtomMap = this._serialAtomMap = {}; - var atoms = this._complex._atoms; - - for (var i = 0; i < atoms.length; i++) { - var atom = atoms[i]; - serialAtomMap[atom.serial] = atom; + const distanceHO = h.distanceTo(o); + const distanceHC = h.distanceTo(c); + const distanceNC = n.distanceTo(c); + const distanceNO = n.distanceTo(o); + if (distanceHO < MINIMAL_DISTANCE || distanceHC < MINIMAL_DISTANCE || distanceNC < MINIMAL_DISTANCE || distanceNO < MINIMAL_DISTANCE) { + result = MIN_HBOND_ENERGY; + } else { + result = COUPLING_CONSTANT / distanceHO - COUPLING_CONSTANT / distanceHC + COUPLING_CONSTANT / distanceNC - COUPLING_CONSTANT / distanceNO; } - this._complex._finalizeBonds(); - - this._fixBondsArray(); - - this._finalizeMetadata(); - - this._buildAssemblies(); - - this._complex.units = this._complex.units.concat(this._assemblies); - - this._buildMolecules(); + // DSSP compatibility mode: + result = Math.round(result * 1000) / 1000; + if (result < MIN_HBOND_ENERGY) { + result = MIN_HBOND_ENERGY; + } + } - this._complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: false, - enableEditing: false, - serialAtomMap: this._serialAtomMap + // update donor + if (typeof this._hbonds[donor._index] === 'undefined') { + this._hbonds[donor._index] = { + donor: [], + acceptor: [] + }; + } + const donorInfo = this._hbonds[donor._index]; + if (donorInfo.acceptor.length < 2) { + donorInfo.acceptor.push({ + residue: acceptor._index, + energy: result }); } - }, { - key: "defineFormat", - value: function defineFormat(data) { - var format; - - if (sdfRegExp.test(data)) { - format = fileFormat.SDF; - } else { - format = fileFormat.MOL; + if (donorInfo.acceptor.length > 1) { + if (result < donorInfo.acceptor[0].energy) { + donorInfo.acceptor[1].residue = donorInfo.acceptor[0].residue; + donorInfo.acceptor[1].energy = donorInfo.acceptor[0].energy; + donorInfo.acceptor[0].residue = acceptor._index; + donorInfo.acceptor[0].energy = result; + } else if (result < donorInfo.acceptor[1].energy) { + donorInfo.acceptor[1].residue = acceptor._index; + donorInfo.acceptor[1].energy = result; } - - return format; } - }, { - key: "parseSync", - value: function parseSync() { - var result = this._complex = new Complex$7(); - var stream = new SDFStream(this._data); - this._format = this.defineFormat(this._data); - result.metadata.format = this._format; - - do { - this._parseCompound(stream); - } while (stream.findNextCompoundStart()); - - this._finalize(); - return result; + // update acceptor + if (typeof this._hbonds[acceptor._index] === 'undefined') { + this._hbonds[acceptor._index] = { + donor: [], + acceptor: [] + }; } - }]); - - return SDFParser; -}(Parser); -SDFParser.formats = ['mol', 'sdf']; -SDFParser.extensions = ['.mol', '.sdf']; - -var DSN6Header = { - nstart: [valueType.array, 'i16', 0], - extent: [valueType.array, 'i16', 3], - grid: [valueType.array, 'i16', 6], - cellDims: [valueType.vector, 'i16', 9], - angles: [valueType.array, 'i16', 12], - div: [valueType.singular, 'i16', 15], - adder: [valueType.singular, 'i16', 16], - scaleFactor: [valueType.singular, 'i16', 17] -}; - -var DSN6Model = /*#__PURE__*/function (_VolumeModel) { - inherits(DSN6Model, _VolumeModel); - - function DSN6Model() { - classCallCheck(this, DSN6Model); - - return possibleConstructorReturn(this, getPrototypeOf(DSN6Model).apply(this, arguments)); + const accInfo = this._hbonds[acceptor._index]; + if (accInfo.donor.length < 2) { + accInfo.donor.push({ + residue: donor._index, + energy: result + }); + } + if (accInfo.donor.length > 1) { + if (result < accInfo.donor[0].energy) { + accInfo.donor[1].residue = accInfo.donor[0].residue; + accInfo.donor[1].energy = accInfo.donor[0].energy; + accInfo.donor[0].residue = donor._index; + accInfo.donor[0].energy = result; + } else if (result < accInfo.donor[1].energy) { + accInfo.donor[1].residue = donor._index; + accInfo.donor[1].energy = result; + } + } + return result; } +} +;// CONCATENATED MODULE: ./src/chem/SecondaryStructureMap.js - createClass(DSN6Model, [{ - key: "_parseHeader", - value: function _parseHeader(_buffer) { - this._buff = _buffer; - - this._typedCheck(); - - var arrays = {}; - arrays.i16 = new Int16Array(this._buff); // check and reverse if big endian - if (arrays.i16[18] !== 100) { - for (var i = 0, n = arrays.i16.length; i < n; ++i) { - var val = arrays.i16[i]; - arrays.i16[i] = (val & 0xff) << 8 | val >> 8 & 0xff; +const BridgeType = Object.freeze({ + NO_BRIDGE: 0, + PARALLEL: 1, + ANTI_PARALLEL: 2 +}); +const HelixFlag = Object.freeze({ + START: 1, + MIDDLE: 2, + END: 3, + START_AND_END: 4 +}); +const StructureType = Object.freeze({ + STRAND: 'E', + BRIDGE: 'B', + HELIX_310: 'G', + HELIX_ALPHA: 'H', + HELIX_PI: 'I', + TURN: 'T', + BEND: 'S', + LOOP: ' ' +}); +class SecondaryStructureMap { + constructor(complex) { + this._complex = complex; + this._build(); + } + _build() { + const self = this; + this._hbonds = new HBondInfo(this._complex); + this._ss = []; // DSSP map by residue + + // auxilliary data + this._sheet = []; + this._betaPartners = []; + this._bend = []; + for (let i = 0; i < this._complex.getResidues().length; ++i) { + this._betaPartners[i] = []; + } + this._helixFlags = []; + this._helixFlags[3] = []; + this._helixFlags[4] = []; + this._helixFlags[5] = []; + + // calculate peptide chain lengths + this._chainLengths = []; + for (let i = 0; i < this._complex._chains.length; ++i) { + const chain = this._complex._chains[i].getResidues(); + let len = 0; + for (; len < chain.length; ++len) { + if ((chain[len].getType().flags & chem_ResidueType.Flags.PROTEIN) === 0) { + break; } } - - if (arrays.i16[18] !== 100) { - throw new Error('DSN6: Incorrect format '); - } - - var header = this._header; - - this._fillHeader(DSN6Header, arrays); - - header.cellDims.multiplyScalar(1.0 / header.scaleFactor); - header.angles.forEach(function (angle, i, a) { - a[i] *= Math.PI / 180.0 / header.scaleFactor; - }); - header.div /= 100; + this._chainLengths[i] = len; } - }, { - key: "_setAxisIndices", - value: function _setAxisIndices() { - this._xyz2crs[0] = 0; - this._xyz2crs[1] = 1; - this._xyz2crs[2] = 2; + this._buildBetaSheets(); + for (let i = 0; i < this._complex._chains.length; ++i) { + self._buildAlphaHelices(this._complex._chains[i].getResidues(), this._chainLengths[i], false); } - }, { - key: "_setOrigins", - value: function _setOrigins() { - var header = this._header; - - var _this$_getAxis = this._getAxis(), - _this$_getAxis2 = slicedToArray(_this$_getAxis, 3), - xaxis = _this$_getAxis2[0], - yaxis = _this$_getAxis2[1], - zaxis = _this$_getAxis2[2]; - - this._setAxisIndices(); - - this._origin.addScaledVector(xaxis, header.nstart[0]); - - this._origin.addScaledVector(yaxis, header.nstart[1]); - - this._origin.addScaledVector(zaxis, header.nstart[2]); - - xaxis.multiplyScalar(header.extent[0]); - yaxis.multiplyScalar(header.extent[1]); - zaxis.multiplyScalar(header.extent[2]); - - this._setBoxParams(xaxis, yaxis, zaxis); + } + _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) { + // Helix and Turn + for (let stride = 3; stride <= 5; ++stride) { + if (inResidues.length < stride) { + break; + } + for (let i = 0; i + stride < chainLength; ++i) { + if (this._hbonds.isBond(inResidues[i + stride]._index, inResidues[i]._index) + /* && NoChainBreak(res[i], res[i + stride]) */) { + this._helixFlags[stride][inResidues[i + stride]._index] = HelixFlag.END; + for (let j = i + 1; j < i + stride; ++j) { + if (typeof this._helixFlags[stride][inResidues[j]._index] === 'undefined') { + this._helixFlags[stride][inResidues[j]._index] = HelixFlag.MIDDLE; + } + } + if (this._helixFlags[stride][inResidues[i]._index] === HelixFlag.END) { + this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START_AND_END; + } else { + this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START; + } + } + } } - }, { - key: "_pointCalculate", - value: function _pointCalculate(xyzData, byteBuffer, z, y, x, pos, i) { - var header = this._header; - - if (x < header.extent[0] && y < header.extent[1] && z < header.extent[2]) { - var idx = x + header.extent[0] * (y + header.extent[1] * z); - xyzData[idx] = (byteBuffer[pos.counter] - header.adder) / header.div; - ++pos.counter; - } else { - pos.counter += 8 - i; - return false; + for (let i = 2; i < chainLength - 2; ++i) { + const kappa = this._kappa(inResidues[i - 2], inResidues[i], inResidues[i + 2]); + this._bend[inResidues[i]._index] = kappa !== 360 && kappa > 70; + } + for (let i = 1; i + 4 < chainLength; ++i) { + if (this._isHelixStart(inResidues[i]._index, 4) && this._isHelixStart(inResidues[i - 1]._index, 4)) { + for (let j = i; j <= i + 3; ++j) { + this._ss[inResidues[j]._index] = StructureType.HELIX_ALPHA; + } } - - return true; } - }, { - key: "_blockCalculate", - value: function _blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos) { - for (var k = 0; k < 8; ++k) { - var z = 8 * zBlock + k; - - for (var j = 0; j < 8; ++j) { - var y = 8 * yBlock + j; - var inRange = true; - var i = 0; - - while (inRange && i < 8) { - var x = 8 * xBlock + i; - inRange = this._pointCalculate(xyzData, byteBuffer, z, y, x, pos, i); - i++; + for (let i = 1; i + 3 < chainLength; ++i) { + if (this._isHelixStart(inResidues[i]._index, 3) && this._isHelixStart(inResidues[i - 1]._index, 3)) { + let empty = true; + for (let j = i; empty && j <= i + 2; ++j) { + empty = typeof this._ss[inResidues[j]._index] === 'undefined' || this._ss[inResidues[j]._index] === StructureType.HELIX_310; + } + if (empty) { + for (let j = i; j <= i + 2; ++j) { + this._ss[inResidues[j]._index] = StructureType.HELIX_310; } } } } - }, { - key: "_toXYZData", - value: function _toXYZData() { - var header = this._header; - var byteBuffer = new Uint8Array(this._buff); - var xyzData = new Float32Array(header.extent[0] * header.extent[1] * header.extent[2]); - var blocks = new Vector3(header.extent[0] / 8, header.extent[1] / 8, header.extent[2] / 8); - var pos = {}; - pos.counter = 512; - - for (var zBlock = 0; zBlock < blocks.z; ++zBlock) { - for (var yBlock = 0; yBlock < blocks.y; ++yBlock) { - for (var xBlock = 0; xBlock < blocks.x; ++xBlock) { - this._blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos); + for (let i = 1; i + 5 < chainLength; ++i) { + if (this._isHelixStart(inResidues[i]._index, 5) && this._isHelixStart(inResidues[i - 1]._index, 5)) { + let empty = true; + for (let j = i; empty && j <= i + 4; ++j) { + empty = typeof this._ss[inResidues[j]._index] === 'undefined' || this._ss[inResidues[j]._index] === StructureType.HELIX_PI || inPreferPiHelices && this._ss[inResidues[j]._index] === StructureType.HELIX_ALPHA; + } + if (empty) { + for (let j = i; j <= i + 4; ++j) { + this._ss[inResidues[j]._index] = StructureType.HELIX_PI; } } } - - this._calculateInfoParams(xyzData); - - return xyzData; } - }, { - key: "_calculateInfoParams", - value: function _calculateInfoParams(xyzData) { - this._header.dmean /= xyzData.length; - var dispersion = 0; - var minDensity = xyzData[0]; - var maxDensity = xyzData[0]; - - for (var j = 0; j < xyzData.length; j++) { - dispersion += Math.pow(this._header.dmean - xyzData[j], 2); - - if (xyzData[j] < minDensity) { - minDensity = xyzData[j]; + for (let i = 1; i + 1 < chainLength; ++i) { + if (typeof this._ss[inResidues[i]._index] === 'undefined') { + let isTurn = false; + for (let stride = 3; stride <= 5 && !isTurn; ++stride) { + for (let k = 1; k < stride && !isTurn; ++k) { + isTurn = i >= k && this._isHelixStart(inResidues[i - k]._index, stride); + } } - - if (xyzData[j] > maxDensity) { - maxDensity = xyzData[j]; + if (isTurn) { + this._ss[inResidues[i]._index] = StructureType.TURN; + } else if (this._bend[inResidues[i]._index]) { + this._ss[inResidues[i]._index] = StructureType.BEND; } } - - this._header.sd = Math.sqrt(dispersion / xyzData.length); - this._header.dmax = maxDensity; - this._header.dmin = minDensity; } - }]); - - return DSN6Model; -}(VolumeModel); - -var DSN6Parser = /*#__PURE__*/function (_Parser) { - inherits(DSN6Parser, _Parser); - - function DSN6Parser(data, options) { - var _this; - - classCallCheck(this, DSN6Parser); - - _this = possibleConstructorReturn(this, getPrototypeOf(DSN6Parser).call(this, data, options)); - _this._options.fileType = 'dsn6'; - _this.model = new DSN6Model(); - return _this; } - - createClass(DSN6Parser, [{ - key: "parseSync", - value: function parseSync() { - return this.model.parse(this._data); - } - }], [{ - key: "canParse", - value: function canParse(data, options) { - if (!data) { - return false; + _residueGetCAlpha(res) { + for (let i = 0; i < res._atoms.length; ++i) { + const { + name + } = res._atoms[i]; + if (name === 'CA' || name === 'C1') { + return res._atoms[i].position; } - - return data instanceof ArrayBuffer && Parser.checkDataTypeOptions(options, 'dsn6'); - } - }, { - key: "canProbablyParse", - value: function canProbablyParse(_data) { - return false; } - }]); - - return DSN6Parser; -}(Parser); - -DSN6Parser.formats = ['dsn6']; -DSN6Parser.extensions = ['.dsn6', '.omap']; -DSN6Parser.binary = true; - -/** - * Little helper class for GRO Parser usage. - * @extends PDBStream - */ - -var GROReader = /*#__PURE__*/function (_PDBStream) { - inherits(GROReader, _PDBStream); - - function GROReader(data) { - var _this; - - classCallCheck(this, GROReader); - - _this = possibleConstructorReturn(this, getPrototypeOf(GROReader).call(this, data)); - /** @type Number */ - - _this._next = -1; // End position of line - - _this.next(); - - return _this; + return null; } - /** - * Getting end of string. - * @returns {Number} Pointer to end of string - */ + _cosinusAngle(p1, p2, p3, p4) { + const v12 = p1.clone().sub(p2); + const v34 = p3.clone().sub(p4); + let result = 0; + const x = v12.dot(v12) * v34.dot(v34); + if (x > 0) { + result = v12.dot(v34) / Math.sqrt(x); + } + return result; + } + _kappa(prevPrev, res, nextNext) { + const curCA = this._residueGetCAlpha(res); + const ppCA = this._residueGetCAlpha(prevPrev); + const nnCA = this._residueGetCAlpha(nextNext); + if (curCA === null || ppCA === null || nnCA === null) { + return 180; + } + const ckap = this._cosinusAngle(curCA, ppCA, nnCA, curCA); + const skap = Math.sqrt(1 - ckap * ckap); + return Math.atan2(skap, ckap) * 180 / Math.PI; + } + _isHelixStart(res, stride) { + return this._helixFlags[stride][res] === HelixFlag.START || this._helixFlags[stride][res] === HelixFlag.START_AND_END; + } + _buildBetaSheets() { + // find bridges + // check each chain against each other chain, and against itself + const bridges = []; + for (let a = 0; a < this._complex._chains.length; ++a) { + const lenA = this._chainLengths[a]; + if (lenA <= 4) { + continue; + } + const chainA = this._complex._chains[a].getResidues(); + for (let b = a; b < this._complex._chains.length; ++b) { + const lenB = this._chainLengths[b]; + if (lenB <= 4) { + continue; + } + const chainB = this._complex._chains[b].getResidues(); + for (let i = 1; i + 1 < lenA; ++i) { + const ri = chainA[i]; + let j = 1; + if (b === a) { + j = i + 3; // check for self-bridges forward down the chain + } + for (; j + 1 < lenB; ++j) { + const rj = chainB[j]; + const type = this._testBridge(chainA, i, chainB, j); + if (type === BridgeType.NO_BRIDGE) { + continue; + } + // there is a bridge, try to attach it to previously found sequence + let found = false; + for (const bridge of bridges) { + if (type !== bridge.type || ri._index !== bridge.i[bridge.i.length - 1] + 1) { + continue; + } + if (type === BridgeType.PARALLEL && bridge.j[bridge.j.length - 1] + 1 === rj._index) { + bridge.i.push(ri._index); + bridge.j.push(rj._index); + found = true; + break; + } + if (type === BridgeType.ANTI_PARALLEL && bridge.j[0] - 1 === rj._index) { + bridge.i.push(ri._index); + bridge.j.unshift(rj._index); + found = true; + break; + } + } - createClass(GROReader, [{ - key: "getNext", - value: function getNext() { - return this._next; + // this bridge cannot be attached anywhere, start a new sequence + if (!found) { + bridges.push({ + type, + i: [ri._index], + chainI: ri.getChain()._index, + j: [rj._index], + chainJ: rj.getChain()._index + }); + } + } + } + } } - }]); - - return GROReader; -}(PDBStream); - -var Complex$8 = chem.Complex, - Element$9 = chem.Element, - Molecule$6 = chem.Molecule; -/** - * Gromos87 file format parser. - * @extends Parser - */ -var GROParser = /*#__PURE__*/function (_Parser) { - inherits(GROParser, _Parser); + // extend ladders + bridges.sort((a, b) => { + if (a.chainI < b.chainI || a.chainI === b.chainI && a.i[0] < b.i[0]) { + return -1; + } + return 1; + }); + for (let i = 0; i < bridges.length; ++i) { + for (let j = i + 1; j < bridges.length; ++j) { + const ibi = bridges[i].i[0]; + const iei = bridges[i].i[bridges[i].i.length - 1]; + const jbi = bridges[i].j[0]; + const jei = bridges[i].j[bridges[i].j.length - 1]; + const ibj = bridges[j].i[0]; + const iej = bridges[j].i[bridges[j].i.length - 1]; + const jbj = bridges[j].j[0]; + const jej = bridges[j].j[bridges[j].j.length - 1]; + if (bridges[i].type !== bridges[j].type || this._hasChainBreak(Math.min(ibi, ibj), Math.max(iei, iej)) || this._hasChainBreak(Math.min(jbi, jbj), Math.max(jei, jej)) || ibj - iei >= 6 || iei >= ibj && ibi <= iej) { + continue; + } + let bulge = false; + if (bridges[i].type === BridgeType.PARALLEL) { + bulge = jbj - jei < 6 && ibj - iei < 3 || jbj - jei < 3; + } else { + bulge = jbi - jej < 6 && ibj - iei < 3 || jbi - jej < 3; + } + if (bulge) { + bridges[i].i = bridges[i].i.concat(bridges[j].i); + if (bridges[i].type === BridgeType.PARALLEL) { + bridges[i].j = bridges[i].j.concat(bridges[j].j); + } else { + bridges[i].j = bridges[j].j.concat(bridges[i].j); + } + bridges.splice(j--, 1); + } + } + } - /** - * Create parser for .gro file format - * - * @param {String} data Input file - * @param {String} options Input options (optional field) - */ - function GROParser(data, options) { - var _this; + // Sheet + const ladderset = new Set(); + for (let i = 0; i < bridges.length; ++i) { + ladderset.add(bridges[i]); + } + let sheet = 1; + let ladder = 0; + while (ladderset.size > 0) { + let bridge = ladderset.values().next().value; + ladderset.delete(bridge); + const sheetset = new Set(); + sheetset.add(bridge); + let toMove; + do { + toMove = new Set(); + for (const a of sheetset.values()) { + for (const b of ladderset.values()) { + if (this._areBridgesLinked(a, b)) { + toMove.add(b); + } + } + } + for (bridge of toMove.values()) { + sheetset.add(bridge); + ladderset.delete(bridge); + } + } while (toMove.size > 0); + for (bridge of sheetset.values()) { + bridge.ladder = ladder; + bridge.sheet = sheet; + bridge.link = sheetset; + ++ladder; + } + ++sheet; + } + for (let i = 0; i < bridges.length; ++i) { + const bridge = bridges[i]; - classCallCheck(this, GROParser); + // find out if any of the i and j set members already have + // a bridge assigned, if so, we're assigning bridge 2 - _this = possibleConstructorReturn(this, getPrototypeOf(GROParser).call(this, data, options)); - /** @type Date */ + let betai = 0; + let betaj = 0; + for (let l = 0; l < bridge.i.length; ++l) { + if (this._betaPartners[bridge.i[l]][0]) { + betai = 1; + break; + } + } + for (let l = 0; l < bridge.j.length; ++l) { + if (this._betaPartners[bridge.j[l]][0]) { + betaj = 1; + break; + } + } + let ss = StructureType.BRIDGE; + if (bridge.i.length > 1) { + ss = StructureType.STRAND; + } + if (bridge.type === BridgeType.PARALLEL) { + let j = 0; + for (let k = 0; k < bridge.i.length; ++k) { + this._betaPartners[bridge.i[k]][betai] = { + residue: bridge.j[j++], + ladder: bridge.ladder, + parallel: true + }; + } + j = 0; + for (let k = 0; k < bridge.j.length; ++k) { + this._betaPartners[bridge.j[k]][betaj] = { + residue: bridge.i[j++], + ladder: bridge.ladder, + parallel: true + }; + } + } else { + let j = bridge.j.length - 1; + for (let k = 0; k < bridge.i.length; ++k) { + this._betaPartners[bridge.i[k]][betai] = { + residue: bridge.j[j--], + ladder: bridge.ladder, + parallel: false + }; + } + j = bridge.i.length - 1; + for (let k = 0; k < bridge.j.length; ++k) { + this._betaPartners[bridge.j[k]][betaj] = { + residue: bridge.i[j--], + ladder: bridge.ladder, + parallel: false + }; + } + } + for (let k = bridge.i[0]; k <= bridge.i[bridge.i.length - 1]; ++k) { + if (this._ss[k] !== StructureType.STRAND) { + this._ss[k] = ss; + this._sheet[k] = bridge.sheet; + } + } + for (let k = bridge.j[0]; k <= bridge.j[bridge.j.length - 1]; ++k) { + if (this._ss[k] !== StructureType.STRAND) { + this._ss[k] = ss; + this._sheet[k] = bridge.sheet; + } + } + } + } + _testBridge(chainA, from, chainB, to) { + let result = BridgeType.NO_BRIDGE; + const a = chainA[from - 1]._index; + const b = chainA[from]._index; + const c = chainA[from + 1]._index; + const d = chainB[to - 1]._index; + const e = chainB[to]._index; + const f = chainB[to + 1]._index; + const isBond = this._hbonds.isBond.bind(this._hbonds); + if (isBond(c, e) && isBond(e, a) || isBond(f, b) && isBond(b, d)) { + result = BridgeType.PARALLEL; + } else if (isBond(c, d) && isBond(f, a) || isBond(e, b) && isBond(b, e)) { + result = BridgeType.ANTI_PARALLEL; + } + return result; + } - _this._time = null; // Time in ps, optional field for animations + // return true if any of the residues in bridge a is identical to any of the residues in bridge b + _areBridgesLinked(a, b) { + const ai = new Set(a.i); + const aj = new Set(a.j); + for (const i of b.i) { + if (ai.has(i) || aj.has(i)) { + return true; + } + } + for (const i of b.j) { + if (ai.has(i) || aj.has(i)) { + return true; + } + } + return false; + } + _hasChainBreak(from, to) { + for (let i = from + 1; i <= to; ++i) { + if (this._complex._residues[i]._sequence !== this._complex._residues[i - 1]._sequence + 1) { + return true; + } + } + return false; + } +} +SecondaryStructureMap.StructureType = StructureType; +;// CONCATENATED MODULE: ./src/chem/Complex.js - /** @type Number */ - _this._numAtoms = null; // Number of atoms in complex - /** @type Number */ - _this._residueNumber = null; // Number of exact residue - /** @type String */ - _this._residueName = ''; // Scientific name of exact residue - /** @type String */ - _this._atomName = ''; // Scientific name of exact atom - /** @type Number */ - _this._atomNumber = null; // Sorted number of exact atom - /** @type Array */ - _this._atomPosition = []; // Array which contains x, y, z position of exact atom - /** @type Array */ - _this._atomVelocity = []; // Array which contains x, y, z velocity of exact atom (optional) - /** @type Complex */ - _this._complex = null; // Complex structure for unified molecule representation - /** @type Vector3 */ +const VOXEL_SIZE = 5.0; +const { + StructureType: Complex_StructureType +} = SecondaryStructureMap; +const Complex_StructuralElementType = chem_StructuralElement.Type; - _this._molecules = []; // Molecules array +// see http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX +const helixClassMap = { + [Complex_StructureType.HELIX_ALPHA]: 1, + [Complex_StructureType.HELIX_PI]: 3, + [Complex_StructureType.HELIX_310]: 5 +}; +const loopMap = { + [Complex_StructureType.BRIDGE]: Complex_StructuralElementType.BRIDGE, + [Complex_StructureType.TURN]: Complex_StructuralElementType.TURN, + [Complex_StructureType.BEND]: Complex_StructuralElementType.BEND, + [Complex_StructureType.LOOP]: Complex_StructuralElementType.COIL +}; - /** @type Molecule */ +/** + * The entire complex of the molecules under study. + * + * @exports Complex + * @constructor + */ +class Complex { + constructor() { + this._chains = []; + this._components = []; + this._helices = []; + this._sheets = []; + this.structures = []; + this._residueTypes = Object.create(chem_ResidueType.StandardTypes); + this._atoms = []; + this._residues = []; + this._bonds = []; + this._sgroups = []; + this._molecules = []; + this._maskNeedsUpdate = false; + this.metadata = {}; + this.symmetry = []; + this.units = [new chem_BiologicalUnit(this)]; + this._currentUnit = 0; // default biological unit is the asymmetric unit + } + addAtom(atom) { + const index = this._atoms.length; + this._atoms.push(atom); + return index; + } + addSheet(sheet) { + const index = this._sheets.length; + this._sheets.push(sheet); + return index; + } + addHelix(helix) { + const index = this._helices.length; + this._helices.push(helix); + return index; + } + getAtoms() { + return this._atoms; + } + getBonds() { + return this._bonds; + } + getAtomCount() { + return this._atoms.length; + } + addResidue(residue) { + const index = this._residues.length; + this._residues.push(residue); + return index; + } + updateToFrame(frameData) { + this.forEachChain(chain => { + chain.updateToFrame(frameData); + }); + } + addResidueType(resName) { + const rt = this._residueTypes[resName] = new chem_ResidueType(resName, 'Unknown', ''); + return rt; + } + getResidueCount() { + return this._residues.length; + } + getResidues() { + return this._residues; + } + getSGroupCount() { + return this._sgroups.length; + } + getSGroups() { + return this._sgroups; + } - _this._molecule = null; // Single molecule + /* + Extract atom by its fullname: #chainName#.#residueId#.#atomName# + */ + getAtomByFullname(fullName) { + const parts = fullName.split('.'); + if (parts.length !== 3) { + return null; + } + const chainName = parts[0]; + const resId = parseInt(parts[1], 10); + if (Number.isNaN(resId)) { + return null; + } + const atomName = parts[2].toUpperCase(); + let currAtom = null; + this.forEachChain(chain => { + if (currAtom) { + return; + } + if (chain._name.localeCompare(chainName) === 0) { + chain.forEachResidue(residue => { + if (currAtom) { + return; + } + if (residue._sequence === resId) { + residue.forEachAtom(atom => { + if (currAtom) { + return; + } + if (atomName.localeCompare(atom.name) === 0) { + currAtom = atom; + } + }); + } + }); + } + }); + return currAtom; + } - /** @type String */ + /** + * Create a new chain. + * + * @param {string} name - Chain name. + * @returns {Chain} - Newly created chain. + */ + addChain(name) { + const result = new chem_Chain(this, name); + this._chains.push(result); + return result; + } + getChain(name) { + for (let i = 0, n = this._chains.length; i < n; ++i) { + const chain = this._chains[i]; + if (chain.getName() === name) { + return chain; + } + } + return null; + } + getChainCount() { + return this._chains.length; + } + getMolecules() { + return this._molecules; + } + getMoleculeCount() { + return this._molecules.length; + } + forEachAtom(process) { + const atoms = this._atoms; + for (let i = 0, n = atoms.length; i < n; ++i) { + process(atoms[i]); + } + } + forEachBond(process) { + const bonds = this._bonds; + for (let i = 0, n = bonds.length; i < n; ++i) { + process(bonds[i]); + } + } + forEachResidue(process) { + const residues = this._residues; + for (let i = 0, n = residues.length; i < n; ++i) { + process(residues[i]); + } + } + forEachChain(process) { + const chains = this._chains; + for (let i = 0, n = chains.length; i < n; ++i) { + process(chains[i]); + } + } + forEachMolecule(process) { + const molecules = this._molecules; + const n = molecules.length; + for (let i = 0; i < n; ++i) { + process(molecules[i]); + } + } + forEachSGroup(process) { + const groups = this._sgroups; + for (let i = 0, n = groups.length; i < n; ++i) { + process(groups[i]); + } + } + forEachComponent(process) { + const components = this._components; + for (let i = 0, n = components.length; i < n; ++i) { + process(components[i]); + } + } + forEachVisibleComponent(process) { + const components = this._components; + for (let i = 0, n = components.length; i < n; ++i) { + process(components[i]); + } + } + addBond(left, right, order, type, fixed) { + const bond = new chem_Bond(left, right, order, type, fixed); + this._bonds.push(bond); + return bond; + } + getBondCount() { + return this._bonds.length; + } + getResidueType(name) { + return this._residueTypes[name] || null; + } + getUnifiedSerial(chain, serial, iCode) { + /* eslint-disable no-magic-numbers */ + const maxSerial = 65536; + const chainShift = maxSerial * 256; + /* eslint-enable no-magic-numbers */ + return serial + iCode * maxSerial + chain * chainShift; + } + splitUnifiedSerial(uniSerial) { + /* eslint-disable no-magic-numbers */ + const maxSerial = 65536; + const chainShift = maxSerial * 256; + /* eslint-enable no-magic-numbers */ + const chainId = Math.floor(uniSerial / chainShift); + const remnant = uniSerial - chainId * chainShift; + const insCode = Math.floor(remnant / maxSerial); + const ser = remnant - insCode * maxSerial; + return { + chain: chainId, + serial: ser, + iCode: insCode + }; + } + _fillCmpEdit() { + const self = this; + const components = this._components; + function addComp() { + const comp = new chem_Component(self); + comp._index = components.length; + components[comp._index] = comp; + return comp; + } + this.forEachChain(chain => { + const residues = chain._residues; + const resCount = residues.length; + if (resCount < 1) { + return; + } + let comp = addComp(); + let currStart = residues[0]._index; + for (let i = 0; i < resCount; ++i) { + const currRes = residues[i]; + currRes._component = comp; + const nextRes = i === resCount - 1 ? null : residues[i + 1]; + if (!nextRes || !currRes.isConnected(nextRes) || currRes._index !== nextRes._index - 1) { + // the last condition is broken and incorrect + // the refactoring of the Component is required in order to fix this issue + comp.setSubDivs([{ + start: currStart, + end: currRes._index + }]); + if (nextRes) { + currStart = nextRes._index; + comp = addComp(); + } + } + } + }); + } - _this._options.filetype = 'gro'; // Extension of data file. + // This function was added in the moment of despair + // It was the dark times for miew + _fillCmpNoedit() { + const comp = new chem_Component(this); + comp._index = 0; + const residues = this._residues; + const resCount = residues.length; + if (resCount === 0) { + return; + } + const currSubDivs = []; + let currStart = 0; + for (let i = 0; i < resCount; ++i) { + const currRes = residues[i]; + currRes._component = comp; + const nextRes = i === resCount - 1 ? null : residues[i + 1]; + if (!nextRes || !currRes.isConnected(nextRes)) { + // wrap up this interval + currSubDivs[currSubDivs.length] = { + start: currStart, + end: i + }; + if (nextRes) { + currStart = i + 1; + } + } + } + comp.setSubDivs(currSubDivs); + this._components[comp._index] = comp; + } - return _this; + /** + * Fill components information. + * @param {boolean} enableEditing - Restructure Complex to enable per-component editing. + */ + _fillComponents(enableEditing) { + if (enableEditing) { + this._fillCmpEdit(); + } else { + this._fillCmpNoedit(); + } + } + getCurrentUnit() { + return this._currentUnit; + } + getDefaultBoundaries() { + return this.units[0].getBoundaries(); + } + getBoundaries() { + return this.units[this._currentUnit].getBoundaries(); + } + getTransforms() { + return this.units[this._currentUnit].getTransforms(); + } + getSelector() { + return this.units[this._currentUnit].getSelector(); + } + resetCurrentUnit() { + this._currentUnit = 0; + this.setCurrentUnit(1); + } + setCurrentUnit(newUnit) { + if (newUnit !== null && newUnit !== undefined && newUnit !== this._currentUnit && newUnit >= 0 && newUnit < this.units.length) { + this._currentUnit = newUnit; + return true; + } + return false; + } + _computeBounds() { + const { + units + } = this; + for (let i = 0, n = units.length; i < n; ++i) { + units[i].computeBoundaries(); + } + } + onAtomPositionChanged() { + this.forEachChain(a => { + a._finalize(); + }); + this.forEachComponent(c => { + c.update(); + }); + // Update bounding sphere and box + this._computeBounds(); + this._finalizeBonds(); + this.forEachSGroup(s => { + s._rebuildSGroupOnAtomChange(); + }); } + update() { + if (this._maskNeedsUpdate) { + this.updateStructuresMask(); + this._maskNeedsUpdate = false; + } + } + _finalizeBonds() { + const bonds = this.getBonds(); + const n = bonds.length; + for (let i = 0; i < n; ++i) { + bonds[i]._index = i; + } + } + /** - * General check for possibility of parsing. - * @param {String} data - Input file - * @returns {boolean} true if this file is in ascii, false otherwise + * Finalizes complex's inner data(i.e. after parsing). + * @param {objects} opts - Build bonds automatically. + * @param {boolean} opts.needAutoBonding - Build bonds automatically. + * @param {boolean} opts.detectAromaticLoops - Find/mark aromatic loops. + * @param {boolean} opts.enableEditing - Restructure Complex to enable per-component editing. + * @param {Array} [opts.serialAtomMap] - Array of atoms ordered by their serials. */ + finalize(opts) { + opts = opts || {}; + // Put bonds into atoms + const bonds = this._bonds; + let i; + let n; + // remove invalid bonds + for (i = bonds.length - 1; i >= 0; i--) { + const bond = bonds[i]; + if (bond._left === null || bond._right === null) { + bonds.splice(i, 1); + } else { + bond._left.bonds.push(bond); + bond._right.bonds.push(bond); + } + } + const residues = this._residues; + for (i = 0, n = residues.length; i < n; ++i) { + residues[i]._finalize(); + } + this.forEachChain(a => { + a._finalize(); + }); + // WARNING! this MUST be done BEFORE computeBounds is called + const { + units + } = this; + for (i = 0, n = units.length; i < n; ++i) { + units[i].finalize(); + } + // try setting first biomolecule by defaults + this.setCurrentUnit(1); + const residueHash = {}; + for (i = 0, n = residues.length; i < n; ++i) { + const res = residues[i]; + // This code is extremely dangerous for non-PDB formats + residueHash[this.getUnifiedSerial(res.getChain().getName().charCodeAt(0), res.getSequence(), res.getICode().charCodeAt(0))] = res; + } + const { + structures + } = this; + for (i = 0, n = structures.length; i < n; ++i) { + structures[i]._finalize(opts.serialAtomMap, residueHash, this); + } + const helices = this._helices; + for (i = 0, n = helices.length; i < n; ++i) { + helices[i]._finalize(opts.serialAtomMap, residueHash, this); + } + const sheets = this._sheets; + for (i = 0, n = sheets.length; i < n; ++i) { + sheets[i]._finalize(opts.serialAtomMap, residueHash, this); + } + + // Update bounding sphere and box + this._computeBounds(); + const atoms = this._atoms; + for (i = 0, n = atoms.length; i < n; ++i) { + const currAtom = atoms[i]; + currAtom.index = i; + } + if (opts.needAutoBonding) { + const autoConnector = new chem_AutoBond(this); + autoConnector.build(); + autoConnector.destroy(); + } + const chains = this._chains; + for (i = 0, n = chains.length; i < n; ++i) { + chains[i]._index = i; + } + for (i = 0, n = residues.length; i < n; ++i) { + residues[i]._index = i; + } + + // mark non-polar hydrogens + for (i = 0, n = atoms.length; i < n; ++i) { + const atom = atoms[i]; + if (atom.flags & chem_Atom.Flags.HYDROGEN && atom.bonds.length === 1) { + const bond = atom.bonds[0]; + const other = bond._left !== atom && bond._left || bond._right; + if (other.flags & chem_Atom.Flags.CARBON) { + atom.flags |= chem_Atom.Flags.NONPOLARH; + } + } + } + this._finalizeBonds(); + this._fillComponents(opts.enableEditing); + const marker = new chem_AromaticLoopsMarker(this); + marker.markCycles(); + if (opts.detectAromaticLoops) { + // TODO remove this condition clause, it is for debug purposes only! + marker.detectCycles(); // TODO add conditional detection + } + this._finalizeMolecules(); + } + _finalizeMolecules() { + // add reference to molecule into residue + for (let i = 0; i < this._molecules.length; i++) { + const molecule = this._molecules[i]; + const count = molecule.residues.length; + for (let j = 0; j < count; j++) { + const residue = molecule.residues[j]; + residue._molecule = molecule; + } + } + } + updateStructuresMask() { + const updater = structure => structure.collectMask(); + this.forEachResidue(updater); + this.forEachChain(updater); + this.forEachMolecule(updater); + } + countAtomsByMask(mask) { + let count = 0; + this.forEachAtom(atom => { + if ((atom.mask & mask) !== 0) { + count++; + } + }); + return count; + } + getNumAtomsBySelector(selector) { + let count = 0; + this.forEachAtom(atom => { + if (selector.includesAtom(atom)) { + count++; + } + }); + return count; + } + resetAtomMask(mask) { + this.forEachAtom(atom => { + atom.mask = mask; + }); + } + markAtoms(selector, mask) { + const setMask = mask; + const clearMask = ~setMask; + let count = 0; + const totalSelector = chem_selectors.keyword('And')(selector, this.getSelector()); + this.forEachAtom(atom => { + if (totalSelector.includesAtom(atom)) { + atom.mask |= setMask; + count++; + } else { + atom.mask &= clearMask; + } + }); + this._maskNeedsUpdate = true; + return count; + } + markAtomsAdditionally(selector, mask) { + const setMask = mask; + let count = 0; + this.forEachAtom(atom => { + if (selector.includesAtom(atom) && (atom.mask & mask) !== mask) { + atom.mask |= setMask; + count++; + } + }); + return count; + } + clearAtomBits(mask) { + const clearMask = ~mask; + this.forEachAtom(atom => { + atom.mask &= clearMask; + }); + const reseter = a => { + a._mask &= clearMask; + }; + this.forEachAtom(reseter); + this.forEachResidue(reseter); + this.forEachChain(reseter); + this.forEachMolecule(reseter); + } + getAtomNames() { + if (this.hasOwnProperty('_atomNames')) { + return this._atomNames; + } + const dict = {}; + this.forEachAtom(atom => { + dict[atom.name] = 1; + }); + this._atomNames = Object.keys(dict); + return this._atomNames; + } + getElements() { + if (this.hasOwnProperty('_elements')) { + return this._elements; + } + const dict = {}; + this.forEachAtom(atom => { + dict[atom.element.name] = 1; + }); + this._elements = Object.keys(dict); + return this._elements; + } + getResidueNames() { + if (this.hasOwnProperty('_residueNames')) { + return this._residueNames; + } + const dict = {}; + this.forEachResidue(res => { + dict[res._type._name] = 1; + }); + this._residueNames = Object.keys(dict); + return this._residueNames; + } + getChainNames() { + if (this.hasOwnProperty('_chainNames')) { + return this._chainNames; + } + const dict = {}; + this.forEachChain(chain => { + dict[chain._name] = 1; + }); + this._chainNames = Object.keys(dict); + return this._chainNames; + } + getAltLocNames() { + if (this.hasOwnProperty('_altlocNames')) { + return this._altlocNames; + } + const dict = {}; + this.forEachAtom(atom => { + dict[String.fromCharCode(atom.location)] = 1; + }); + this._altlocNames = Object.keys(dict); + return this._altlocNames; + } + getVoxelWorld() { + if (!this.hasOwnProperty('_voxelWorld')) { + try { + this._voxelWorld = new chem_VoxelWorld(this.getDefaultBoundaries().boundingBox, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(VOXEL_SIZE, VOXEL_SIZE, VOXEL_SIZE)); + this._voxelWorld.addAtoms(this); + } catch (e) { + logger.warn('Unable to create voxel world'); + this._voxelWorld = null; + } + } + return this._voxelWorld; + } - createClass(GROParser, [{ - key: "canProbablyParse", - value: function canProbablyParse(data) { - return _.isString(this._data) && /^\s*[^\n]*\n\s*\d+ *\n\s*\d+[^\n\d]{3}\s*\w+\s*\d+\s*-?\d/.test(data); + /** + * Simple function to make unified routine procedure without code duplication. + * @param {Array} srcArray - Source chemical structure array (will be part of resulting chemical structure array). + * @param {Array} dstArray - Resulting chemical structure array. + * @param {number} param - Parameter for processor. + * @param {function} functor - Processor for every element in array. + */ + addElement(srcArray, dstArray, param, functor) { + const { + length + } = srcArray; + for (let i = 0; i < length; ++i) { + const elem = srcArray[i]; + functor(elem, param); + dstArray.push(elem); } - /** - * Parsing title of molecule complex. - * NOTE: that names are ESTIMATES, there is no strict rules in Gromos87 standard for first line in input file. - * @param {GROReader} line - Line containing title and time. - */ + } - }, { - key: "_parseTitle", - value: function _parseTitle(line) { - var metadata = this._complex.metadata; - metadata.id = line.readLine().trim(); - metadata.name = metadata.id.slice(metadata.id.lastIndexOf('\\') + 1, metadata.id.lastIndexOf('.')); - metadata.format = 'gro'; + // this function joins multiple complexes into one (this) + // atom, bond, ... objects are reused -- so input complexes are no longer valid + joinComplexes(complexes) { + // clear target complex + this._chains = []; + this._components = []; + this._helices = []; + this._sheets = []; + this.structures = []; + this._atoms = []; + this._residues = []; + this._bonds = []; + this._sgroups = []; + const self = this; + let atomBias = 0; + let bondBias = 0; + let residueBias = 0; + let chainBias = 0; + let componentBias = 0; + function processAtom(atom, bias) { + atom.serial += bias; + atom.index += bias; + } + function processBond(bond, bias) { + bond._index += bias; } + function processResidue(residue, bias) { + residue._index += bias; + } + function processChain(chain, bias) { + chain._complex = self; + chain._index += bias; + } + function processComponent(component, bias) { + component._complex = self; + component._index += bias; + } + /** - * Parsing line containing number of atoms information. - * @param {GROReader} line - Line containing number of atoms. + * Simple function to do nothing. */ + function doNothing() {} + for (let i = 0; i < complexes.length; ++i) { + const c = complexes[i]; + this.addElement(c._atoms, this._atoms, atomBias, processAtom); + this.addElement(c._bonds, this._bonds, bondBias, processBond); + this.addElement(c._residues, this._residues, residueBias, processResidue); + this.addElement(c._chains, this._chains, chainBias, processChain); + this.addElement(c._sheets, this._sheets, 0, doNothing); + this.addElement(c._helices, this._helices, 0, doNothing); + this.addElement(c._sgroups, this._sgroups, 0, doNothing); + this.addElement(c._components, this._components, componentBias, processComponent); + this.addElement(c.structures, this.structures, 0, doNothing); + // merge residue types + for (const rt in c._residueTypes) { + if (c._residueTypes.hasOwnProperty(rt)) { + this._residueTypes[rt] = c._residueTypes[rt]; + } + } + atomBias += c._atoms.length; + bondBias += c._bonds.length; + residueBias += c._residues.length; + chainBias += c._chains.length; + componentBias += c._components.length; + } + this._computeBounds(); + } - }, { - key: "_parseNumberOfAtoms", - value: function _parseNumberOfAtoms(line) { - this._numAtoms = line.readInt(0, line.getNext()); + /** + * Replace secondary structure with calculated one. + * + * DSSP algorithm implementation is used. + * + * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and + * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211. + */ + dssp() { + const ssMap = new SecondaryStructureMap(this); + const structures = this.structures = []; + const helices = this._helices = []; + const sheets = this._sheets = []; + const getSheet = index => { + let item = sheets[index]; + if (!item) { + item = sheets[index] = new chem_Sheet(String(index), 0); + } + return item; + }; + let lastCode; + let lastSheetIndex; + let lastHelixIndex = 0; + let curStructure = null; + for (let i = 0, n = this._residues.length; i < n; ++i) { + const curCode = ssMap._ss[i]; + const curResidue = this._residues[i]; + const curSheetIndex = ssMap._sheet[i]; + + // expand the last structure + if (curCode === lastCode && curSheetIndex === lastSheetIndex) { + curResidue._secondary = curStructure; + if (curStructure) { + curStructure.term = curResidue; + } + if (curStructure instanceof chem_Helix) { + curStructure.length++; + } + continue; + } - if (Number.isNaN(this._numAtoms)) { - throw new Error('Line 2 is not representing atom number. Consider checking input file'); + // create a new structure + const helixClass = helixClassMap[curCode]; + const loopType = loopMap[curCode]; + if (curCode === Complex_StructureType.STRAND) { + const curSheet = getSheet(curSheetIndex); + curStructure = new chem_Strand(curSheet, curResidue, curResidue, 0, null, null); + curSheet.addStrand(curStructure); + } else if (helixClass !== undefined) { + lastHelixIndex++; + curStructure = new chem_Helix(helixClass, curResidue, curResidue, lastHelixIndex, String(lastHelixIndex), '', 1); + helices.push(curStructure); + } else if (loopType !== undefined) { + curStructure = new chem_StructuralElement(loopType, curResidue, curResidue); + } else { + curStructure = null; } + if (curStructure) { + structures.push(curStructure); + } + curResidue._secondary = curStructure; + lastCode = curCode; + lastSheetIndex = curSheetIndex; } - /** - * Parsing line containing information about residues, atoms etc. Also information about box vectors. - * Format of atoms MUST (by Gromos87 standard) be this: (note that numbering starts not from 0, but from 1!) - * ResidueNumber[1 - 5] ResidueName[6 - 10] AtomName[11 - 15] AtomNumber[16 - 20] Position[21 - 45] Velocity[46 - 69] - * @param {GROReader} line - Line containing information about atom. - */ + this._sheets = sheets.filter(_sheet => true); // squeeze sheets array + } +} +Complex.prototype.id = 'Complex'; +Complex.prototype.name = ''; +/* harmony default export */ const chem_Complex = (Complex); +;// CONCATENATED MODULE: ./src/chem/Volume.js - }, { - key: "_parseAtom", - value: function _parseAtom(line) { - this._residueNumber = line.readInt(1, 5); - this._residueName = line.readString(6, 10).trim(); - this._atomName = line.readString(11, 15).trim(); - this._atomNumber = line.readInt(16, 20); - var positionX = line.readFloat(21, 28) * 10; - var positionY = line.readFloat(29, 36) * 10; - var positionZ = line.readFloat(37, 45) * 10; - - if (Number.isNaN(positionX) || Number.isNaN(positionY) || Number.isNaN(positionZ)) { - this._complex.error = { - message: "Atom position is invalid in \"".concat(line.readLine(), "\"") - }; - return; - } - /* const velocityX = line.readFloat(46, 53); - const velocityY = line.readFloat(54, 61); - const velocityZ = line.readFloat(62, 69); */ - /* Adding residue and atom to complex structure */ +function pow2ceil(v) { + let p = 2; + v = v - 1 >> 1; + while (v) { + p <<= 1; + v >>= 1; + } + return p; +} +/** + * Volume constructor + * + * @param {Object} type - Float32Array, Int8Array, etc... + * @param {Object|Array} dimensions - number of data points on each axis (x, y, z) + * @param {Box3} box - bounding box defining data place in metric space, + * it's corners correspond to extreme data points + * @param {Number} vecSize - dimension of the field data point (1 = scalar, 3 = 3D vector) + * @param {Object} data - typed array of the same type as specified by the 1st parameter, + * layout: point by point along X, + * row by row along Y, + * plane by plane along Z + * @param {Number} volumeInfo - volume info values to define threshold to filter the noise + */ - var type = Element$9.getByName(this._atomName[0]); - /* MAGIC 0. REASONS: This name is something like "CA", where - C - is an element an A is something else. But what about Calcium? */ +class Volume { + constructor(type, dimensions, box, vecSize, data, volumeInfo) { + this._box = box.clone(); + this._dimVec = Math.max(Math.floor(vecSize || 1), 1); + this._volumeInfo = volumeInfo; + if (dimensions instanceof Array) { + [this._dimX, this._dimY, this._dimZ] = dimensions; + } else { + this._dimX = dimensions.x; + this._dimY = dimensions.y; + this._dimZ = dimensions.z; + } + this._dimX = Math.max(Math.floor(this._dimX), 1); + this._dimY = Math.max(Math.floor(this._dimY), 1); + this._dimZ = Math.max(Math.floor(this._dimZ), 1); + this._rowElements = this._dimVec * this._dimX; + this._planeElements = this._rowElements * this._dimY; + this._totalElements = this._planeElements * this._dimZ; + this._data = data || utils.allocateTyped(type, this._totalElements); - if (type.fullName === 'Unknown') { - this._complex.error = { - message: "".concat(this._atomName[0], " hasn't been recognised as an atom name.") + // override getter/setter for vector fields + switch (this._dimVec) { + case 1: + break; + case 2: + this.getValue = function (x, y, z) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + return [this._data[idx], this._data[idx + 1]]; }; - return; - } - - var role = Element$9.Role[this._atomName]; - /* Firstly, create a dummy chain */ - - var chain = this._chain; + this.setValue = function (x, y, z, a, b) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + this._data[idx] = a; + this._data[idx + 1] = b; + }; + this.addValue = function (x, y, z, a, b) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + this._data[idx] += a; + this._data[idx + 1] += b; + }; + break; + case 3: + this.getValue = function (x, y, z) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + return [this._data[idx], this._data[idx + 1], this._data[idx + 2]]; + }; + this.setValue = function (x, y, z, a, b, c) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + this._data[idx] = a; + this._data[idx + 1] = b; + this._data[idx + 2] = c; + }; + this.addValue = function (x, y, z, a, b, c) { + const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements; + this._data[idx] += a; + this._data[idx + 1] += b; + this._data[idx + 2] += c; + }; + break; + default: + throw new Error('Volume: invalid vector dimension'); + } + } - if (!chain) { - this._chain = chain = this._complex.addChain('A'); - } - /* Secondly, add residue to that chain */ + // default getter assumes it's a scalar field + getValue(x, y, z) { + return this._data[x + y * this._rowElements + z * this._planeElements]; + } + // default setter assumes it's a scalar field + setValue(x, y, z, val) { + this._data[x + y * this._rowElements + z * this._planeElements] = val; + } - var residue = this._residue; + // default adder assumes it's a scalar field + addValue(x, y, z, val) { + this._data[x + y * this._rowElements + z * this._planeElements] += val; + } + getDimensions() { + return [this._dimX, this._dimY, this._dimZ]; + } + getBox() { + return this._box; + } + getVolumeInfo() { + return this._volumeInfo; + } + getCellSize() { + const boxSize = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._box.getSize(boxSize); + const res = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + res.x = this._dimX > 1 ? boxSize.x / (this._dimX - 1) : 0; + res.y = this._dimY > 1 ? boxSize.y / (this._dimY - 1) : 0; + res.z = this._dimZ > 1 ? boxSize.z / (this._dimZ - 1) : 0; + return res; + } + computeGradient() { + if (this._dimVec !== 1) { + // gradient can only be computed for scalar fields + return null; + } - if (!residue || residue.getSequence() !== this._residueNumber) { - this._residue = residue = chain.addResidue(this._residueName, this._residueNumber, ' '); - } - /* Lastly, add atom to that residue */ + // create a 3D vector field of gradients + const gradient = new Volume(Float32Array, [this._dimX, this._dimY, this._dimZ], this._box, 3); + // calculate cell side lengths + const vl = this.getCellSize(); - this._atomPosition = new Vector3(positionX, positionY, positionZ); - /* Adding default constants to correct atom addition process */ + // gradient axis scaling values and averaging factors, to correctly + // calculate the gradient for volumes with irregular cell spacing + const vs = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.5 / vl.x, -0.5 / vl.y, -0.5 / vl.z); - var het = true; - var altLoc = ' '; - var occupancy = 1; - var tempFactor = 1; - var charge = 0; - residue.addAtom(this._atomName, type, this._atomPosition, role, het, this._atomNumber, altLoc, occupancy, tempFactor, charge); + // TODO Check for intended bug in VMD (min is zero) + function clamp(val, min, max) { + return Math.min(max, Math.max(min, val)); } - /** - * Some finalizing procedures. In '.gro' file format there is only 1 chain and 1 molecule. - */ - - }, { - key: "_finalize", - value: function _finalize() { - var molecule = new Molecule$6(this._complex, this._complex.metadata.name, 1); // aggregate residues from chain + const xSize = this._dimX; + const ySize = this._dimY; + const zSize = this._dimZ; + const volMap = this._data; + function _voxelValue(x, y, z) { + return volMap[z * xSize * ySize + y * xSize + x]; + } + for (let zi = 0; zi < zSize; ++zi) { + const zm = clamp(zi - 1, 0, zSize - 1); + const zp = clamp(zi + 1, 0, zSize - 1); + for (let yi = 0; yi < ySize; ++yi) { + const ym = clamp(yi - 1, 0, ySize - 1); + const yp = clamp(yi + 1, 0, ySize - 1); + for (let xi = 0; xi < xSize; ++xi) { + const xm = clamp(xi - 1, 0, xSize - 1); + const xp = clamp(xi + 1, 0, xSize - 1); - molecule.residues = this._chain._residues; - molecule._chains = this._chain; - this._complex._molecules[0] = molecule; + // Calculate the volume gradient at each grid cell. + // Gradients are now stored unnormalized, since we need them in pure + // form in order to draw field lines etc. Shading code will now have + // to do renormalization for itself on-the-fly. - this._molecules.push(molecule); + // XXX this gradient is only correct for orthogonal grids, since + // we're using the array index offsets rather to calculate the gradient + // rather than voxel coordinate offsets. This will have to be + // re-worked for non-orthogonal datasets. - this._complex.finalize({ - needAutoBonding: true, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap - }); + gradient.setValue(xi, yi, zi, (_voxelValue(xp, yi, zi) - _voxelValue(xm, yi, zi)) * vs.x, (_voxelValue(xi, yp, zi) - _voxelValue(xi, ym, zi)) * vs.y, (_voxelValue(xi, yi, zp) - _voxelValue(xi, yi, zm)) * vs.z); + } + } } - /** - * Main parsing procedure. - * @returns {Complex} Complex structure for visualizing. - */ - - }, { - key: "parseSync", - value: function parseSync() { - /* Create "Complex" variable */ - var result = this._complex = new Complex$8(); - /* Parse input file line-by-line */ + return gradient; + } + normalize() { + const data = this._data; - var reader = new GROReader(this._data); - var counter = 0; - /* Simple counter regarding to format of .gro file */ + // get min/max + let min = data[0]; + let max = data[0]; + for (let i = 1; i < data.length; ++i) { + min = Math.min(min, data[i]); + max = Math.max(max, data[i]); + } + const d = 1.0 / (max - min); + if (d === 0) { + return; + } - /* First two lines - technical information, other lines - Atoms */ + // normalize + for (let i = 0; i < data.length; ++i) { + data[i] = d * (data[i] - min); + } + } + getTiledTextureStride() { + return [this._dimX + 2, this._dimY + 2]; + } + buildTiledTexture() { + let tilesX = Math.ceil(Math.sqrt(this._dimZ * this._dimY / this._dimX)); + let width = tilesX * (this._dimX + 2) - 1; + width = pow2ceil(width); + tilesX = Math.floor(width / (this._dimX + 2)); + const tilesY = Math.ceil(this._dimZ / tilesX); + let height = tilesY * (this._dimY + 2) - 1; + height = pow2ceil(height); + const data = new Uint8Array(width * height); + let src; + let dst; + for (let tileRow = 0; tileRow < tilesY; ++tileRow) { + // process each pixel row of this tile row + for (let row = 0; row < this._dimY; ++row) { + src = tileRow * tilesX * this._planeElements + row * this._rowElements; + dst = width * (tileRow * (this._dimY + 2) + row); + // copy a series of rows through several XY planes + for (let t = 0; t < tilesX; ++t) { + // copy one row of one XY plane + for (let x = 0; x < this._dimX; ++x) { + data[dst++] = 255.0 * this._data[src++]; + } - this._parseTitle(reader); + // repeat last pixel of previous tile + data[dst++] = 255.0 * this._data[src - 1]; + if (t < tilesX - 1) { + // skip to the same row of next XY plane + src += this._planeElements - this._rowElements; + // repeat first pixel of next tile + data[dst++] = 255.0 * this._data[src]; + } + } + } + } - reader.next(); + // fill pixels between tile rows with copy of edge pixels + for (let tileRow = 0; tileRow < tilesY; ++tileRow) { + // copy last pixel row of this tile row to the following pixel row of the texture + src = width * (tileRow * (this._dimY + 2) + this._dimY - 1); + dst = src + width; + for (let x = 0; x < width; ++x) { + data[dst++] = data[src++]; + } + if (tileRow < tilesY - 1) { + // copy first pixel row of next tile row to the preceding pixel row of the texture + src = width * (tileRow + 1) * (this._dimY + 2); + dst = src - width; + for (let x = 0; x < width; ++x) { + data[dst++] = data[src++]; + } + } + } + const texture = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.DataTexture(data, width, height, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LuminanceFormat, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UnsignedByteType, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UVMapping, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.ClampToEdgeWrapping, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.ClampToEdgeWrapping, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter); + texture.needsUpdate = true; + return texture; + } - this._parseNumberOfAtoms(reader); + /* ******************************************************************************** + * + * Methods that provide direct access to internal array (for better performance) + * + ******************************************************************************** */ - reader.next(); + getData() { + return this._data; + } + getDirectIdx(x, y, z) { + return x * this._dimVec + y * this._rowElements + z * this._planeElements; + } + getStrideX() { + return this._dimVec; + } + getStrideY() { + return this._rowElements; + } + getStrideZ() { + return this._planeElements; + } +} +Volume.prototype.id = 'Volume'; +/* harmony default export */ const chem_Volume = (Volume); +;// CONCATENATED MODULE: ./src/chem/Molecule.js +/** + * Residue Molecule. + * + * @param {Complex} complex - Molecular complex this Molecule belongs to. + * @param {String} name - Molecule's name. + * @param {Integer} index - Molecule's index in file. + * + * @exports Molecule + * @constructor + */ +class Molecule { + constructor(complex, name, index) { + this.complex = complex; + this.name = name || ''; + this.residues = []; + this.mask = 1 | 0; + this.index = index || -1; // start with 1 + } + forEachResidue(process) { + const { + residues + } = this; + for (let i = 0, n = residues.length; i < n; ++i) { + process(residues[i]); + } + } + collectMask() { + let mask = 0xffffffff; + const { + residues + } = this; + for (let i = 0, n = residues.length; i < n; ++i) { + mask &= residues[i]._mask; + } + this.mask = mask; + } +} +/* harmony default export */ const chem_Molecule = (Molecule); +;// CONCATENATED MODULE: ./src/chem.js - for (counter = 0; counter < this._numAtoms; ++counter) { - if (!reader.end()) { - this._parseAtom(reader); - reader.next(); - } else break; - } - /* If number of atoms in second line is less then actual atoms in file */ - if (counter < this._numAtoms) { - this._complex.error = { - message: 'File ended unexpectedly.' - }; - } - /* Catch errors occurred in parsing process */ - if (result.error) { - throw new Error(result.error.message); - } - /* Finalizing data */ - this._finalize(); - /* Cleaning up */ - this._atomPosition = null; - this._complex = null; - this._molecules = null; - this._molecule = null; - /* Return resulting Complex variable */ - return result; - } - }]); - return GROParser; -}(Parser); -GROParser.formats = ['gro']; -GROParser.extensions = ['.gro']; -var Complex$9 = chem.Complex, - Element$a = chem.Element, - Bond$5 = chem.Bond, - Molecule$7 = chem.Molecule; -var orderMap$1 = { - un: 0, - 1: 1, - 2: 2, - 3: 3, - ar: 1, - am: 1, - nc: 0, - du: 1 -}; -var typeMap$1 = { - un: Bond$5.BondType.UNKNOWN, - // unknown (cannot be determined from the parameter tables) - 1: Bond$5.BondType.COVALENT, - // single - 2: Bond$5.BondType.COVALENT, - // double - 3: Bond$5.BondType.COVALENT, - // triple - ar: Bond$5.BondType.AROMATIC, - // aromatic - am: Bond$5.BondType.COVALENT, - // amide - nc: Bond$5.BondType.UNKNOWN, - // not connected - du: Bond$5.BondType.COVALENT // dummy -}; -var resNumberRegex = /\d+$/; -var spacesRegex = /\s+/; -function splitToFields(str) { - return str.trim().split(spacesRegex); -} -/* There is no jsdoc documentation because of eslint corrections: - * not all Parser methods are implemented +/* harmony default export */ const chem = ({ + Atom: chem_Atom, + Element: chem_Element, + Bond: chem_Bond, + Residue: chem_Residue, + ResidueType: chem_ResidueType, + Chain: chem_Chain, + Helix: chem_Helix, + Strand: chem_Strand, + Sheet: chem_Sheet, + SGroup: chem_SGroup, + Assembly: chem_Assembly, + Complex: chem_Complex, + Volume: chem_Volume, + VoxelWorld: chem_VoxelWorld, + selectors: chem_selectors, + Molecule: chem_Molecule +}); +;// CONCATENATED MODULE: ./src/gfx/CSS2DObject.js +/** + * @author mrdoob / http://mrdoob.com/ */ -var MOL2Parser = /*#__PURE__*/function (_Parser) { - inherits(MOL2Parser, _Parser); - - function MOL2Parser(data, options) { - var _this; - - classCallCheck(this, MOL2Parser); - - _this = possibleConstructorReturn(this, getPrototypeOf(MOL2Parser).call(this, data, options)); - _this._complex = null; - _this._chain = null; - _this._residue = null; - _this._compoundIndx = -1; - _this._molecules = []; - _this._molecule = null; - _this._currPosIdx = 0; - _this._currStartIdx = 0; - _this._serialAtomMap = {}; - _this._options.fileType = 'mol2'; - return _this; +class CSS2DObject extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Object3D { + constructor(element) { + super(); + const self = this; + this._element = element; + this._element.style.position = 'absolute'; + this.addEventListener('removed', () => { + if (self._element.parentNode !== null) { + self._element.parentNode.removeChild(self._element); + } + }); + } + getElement() { + return this._element; } - createClass(MOL2Parser, [{ - key: "_parseRawStrings", - value: function _parseRawStrings(data) { - return data.split(/\r?\n|\r/); + /** + * Sets label transparency. + * + * @param {number} transp - in [0; 1] 1 means fully transparent + */ + setTransparency(transp) { + const el = this.getElement(); + if (el === null) { + return; } - }, { - key: "_toStringFromStart", - value: function _toStringFromStart(numb, MOL2Data) { - var newPosIdx = this._currStartIdx + numb; - this._currPosIdx = newPosIdx < MOL2Data.length ? newPosIdx : this._currStartIdx; + if (transp === 1.0) { + el.style.display = 'none'; + return; } - }, { - key: "_toHeaderString", - value: function _toHeaderString(header, MOL2Data) { - this._toStringFromStart(0, MOL2Data); - - while (this._currPosIdx < MOL2Data.length) { - if (MOL2Data[this._currPosIdx].match("@".concat(header))) { - return; - } - - this._currPosIdx++; - } + el.style.display = 'inline'; + const op = 1.0 - transp; + const top = op.toString(); + const op100 = op * 100; + el.style.opacity = top; + el.style.filter = `alpha(opacity=${op100})`; // IE fallback + } + clone() { + const obj = new CSS2DObject(this._element); + obj.copy(this); + return obj; + } +} +/* harmony default export */ const gfx_CSS2DObject = (CSS2DObject); +;// CONCATENATED MODULE: ./src/gfx/RCGroup.js - this._toStringFromStart(0, MOL2Data); +class RCGroup extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group { + raycast(raycaster, intersects) { + if (!this.visible) { + return; } - }, { - key: "_toStringFromHeader", - value: function _toStringFromHeader(header, numb, MOL2Data) { - this._toHeaderString(header, MOL2Data); - - var newPosIdx = this._currPosIdx + numb; - - if (MOL2Data[this._currPosIdx].match("@".concat(header)) && newPosIdx < MOL2Data.length) { - this._currPosIdx = newPosIdx; - } + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + children[i].raycast(raycaster, intersects); } - }, { - key: "_setStart", - value: function _setStart(startPos, MOL2Data) { - if (startPos >= MOL2Data.length) { - this._currStartIdx = this._currPosIdx = MOL2Data.length - 1; - } else { - this._currStartIdx = this._currPosIdx = startPos; + } + enableSubset(mask, innerOnly) { + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].enableSubset) { + children[i].enableSubset(mask, innerOnly); } } - }, { - key: "_probablyHaveDataToParse", - value: function _probablyHaveDataToParse(MOL2Data) { - return this._currPosIdx < MOL2Data.length - 2; + } + disableSubset(mask, innerOnly) { + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].disableSubset) { + children[i].disableSubset(mask, innerOnly); + } } - }, { - key: "_findNextCompoundStart", - value: function _findNextCompoundStart(MOL2Data) { - while (this._currPosIdx < MOL2Data.length && MOL2Data[this._currPosIdx].trim() !== '@MOLECULE>') { - this._currPosIdx++; + } + isEmpty() { + return this.children.length === 0; + } + updateToFrame(frameData) { + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].updateToFrame) { + children[i].updateToFrame(frameData); } - - this._setStart(++this._currPosIdx, MOL2Data); - - return this._probablyHaveDataToParse(MOL2Data); } - }, { - key: "_parseMolecule", - value: function _parseMolecule(MOL2Data) { - this._toHeaderString('MOLECULE', MOL2Data); - - var metadata = this._complex.metadata; - metadata.name = MOL2Data[++this._currPosIdx]; - metadata.format = 'mol2'; - this._molecule = { - _index: '', - _chains: [] - }; - this._molecule._index = this._compoundIndx + 1; - - this._molecules.push(this._molecule); + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + Array.prototype.push.apply(totalSubset, children[i].getSubset(mask, innerOnly)); + } } - /* Atom format description: - * atomId atomName x y z element [resSeq [resName [charge [statusBit]]]] - * statusBits is the internal SYBYL status bits associated with the atom. - * These should never be set by the user. - * Source: http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf - */ - - }, { - key: "_parseAtoms", - value: function _parseAtoms(atomsNum, MOL2Data) { - this._toHeaderString('ATOM', MOL2Data); - - for (var i = 0; i < atomsNum; i++) { - var parsedStr = splitToFields(MOL2Data[++this._currPosIdx]); - - if (parsedStr.length < 6) { - throw new Error('MOL2 parsing error: Not enough information to create atom!'); - } + return totalSubset; + } +} +/* harmony default export */ const gfx_RCGroup = (RCGroup); +;// CONCATENATED MODULE: ./src/gfx/shaders/ScreenQuad.vert +const ScreenQuad_namespaceObject = "uniform mat4 projectionMatrix;\r\nuniform mat4 modelViewMatrix;\r\n\r\nattribute vec2 uv;\r\nattribute vec3 position;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vUv = uv;\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/ScreenQuadFromTex.frag +const ScreenQuadFromTex_namespaceObject = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform float opacity;\r\n\r\nvoid main() {\r\n vec4 color = texture2D(srcTex, vUv);\r\n gl_FragColor = vec4(color.xyz, color.a * opacity);\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/ScreenQuadFromTexWithDistortion.frag +const ScreenQuadFromTexWithDistortion_namespaceObject = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform float coef;\r\n\r\nvoid main() {\r\n vec2 uv = vUv * 2.0 - 1.0;\r\n float r2 = dot(uv, uv);\r\n vec2 tc = uv * (1.0 + coef * r2);\r\n if (!all(lessThan(abs(tc), vec2(1.0))))\r\n discard;\r\n tc = 0.5 * (tc + 1.0);\r\n gl_FragColor = texture2D(srcTex, tc);\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/gfxutils.js +/* eslint-disable no-magic-numbers */ - var atomId = parseInt(parsedStr[0], 10); - var atomName = parsedStr[1]; - var x = parseFloat(parsedStr[2]); - var y = parseFloat(parsedStr[3]); - var z = parseFloat(parsedStr[4]); - var element = parsedStr[5].split('.')[0].toUpperCase(); - var charge = 0; - if (parsedStr.length >= 9) { - charge = parseFloat(parsedStr[8]) || 0.0; - } - var chain = this._chain; - if (!chain) { - // .mol2 may contain information about multiple molecules, but they can't be visualized - // at the same time now. There is no need to create different chain IDs then. - this._chain = chain = this._complex.getChain('A') || this._complex.addChain('A'); - this._residue = null; - } - if (!this._setResidue(parsedStr)) { - continue; - } // These fields are not listed in mol2 format. Set them default. - // Atoms and het atoms doesn't differ in .mol2, - // but het atoms have special residues. It can be used in next updates - var het = false; - var altLoc = ' '; - var occupancy = 1.0; - var tempFactor = 0.0; - var type = Element$a.getByName(element); - var role = Element$a.Role[atomName]; - var xyz = new Vector3(x, y, z); +const LAYERS = { + DEFAULT: 0, + VOLUME: 1, + TRANSPARENT: 2, + PREPASS_TRANSPARENT: 3, + VOLUME_BFPLANE: 4, + COLOR_FROM_POSITION: 5, + SHADOWMAP: 6 +}; +const SELECTION_LAYERS = [ +// These layers, that are used in the selection by ray casting +LAYERS.DEFAULT, LAYERS.TRANSPARENT]; +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Object3D.prototype.resetTransform = function () { + this.position.set(0, 0, 0); + this.quaternion.set(0, 0, 0, 1); + this.scale.set(1, 1, 1); +}; - this._residue.addAtom(atomName, type, xyz, role, het, atomId, altLoc, occupancy, tempFactor, charge); - } +// update world matrix of this object and all its ancestors +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Object3D.prototype.updateMatrixWorldRecursive = function () { + if (this.parent != null) { + this.parent.updateMatrixWorldRecursive(); + } + this.updateMatrixWorld(); +}; +// add object to parent, saving objects' world transform +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Object3D.prototype.addSavingWorldTransform = function () { + const _worldMatrixInverse = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + return function (object) { + if (object instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Object3D) { + _worldMatrixInverse.copy(this.matrixWorld).invert(); + _worldMatrixInverse.multiply(object.matrixWorld); + object.matrix.copy(_worldMatrixInverse); + object.matrix.decompose(object.position, object.quaternion, object.scale); + this.add(object); } - }, { - key: "_setResidue", - value: function _setResidue(parsedStr) { - var resSeq = 1; - var resName = 'UNK'; // The same meaning has '<0>' in some mol2 files - - if (parsedStr.length >= 7) { - resSeq = parseInt(parsedStr[6], 10); - } - - if (parsedStr.length >= 8 && parsedStr[7] !== '<0>') { - resName = parsedStr[7].replace(resNumberRegex, ''); - } + }; +}(); - if (this.settings.now.nowater) { - if (resName === 'HOH' || resName === 'WAT') { - return false; - } +// render a tiny transparent quad in the center of the screen +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderer.prototype.renderDummyQuad = function () { + const _material = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MeshBasicMaterial({ + transparent: true, + opacity: 0.0, + depthWrite: false + }); + const _scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Scene(); + const _quad = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PlaneGeometry(0.01, 0.01), _material); + _scene.add(_quad); + const _camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000); + _camera.position.z = 100; + return function () { + this.render(_scene, _camera); + }; +}(); +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderer.prototype.renderScreenQuad = function () { + const _scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Scene(); + const _quad = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PlaneGeometry(1.0, 1.0)); + _scene.add(_quad); + const _camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000); + _camera.position.z = 100; + return function (material) { + _quad.material = material; + this.render(_scene, _camera); + }; +}(); +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4.prototype.isIdentity = function () { + const identity = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + return function () { + return identity.equals(this); + }; +}(); +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4.prototype.applyToPointsArray = function (array, stride, w) { + if (!array || !stride || stride < 3) { + return array; + } + w = w || 0; // use point as normal by default + const e = this.elements; + for (let i = 0; i < array.length; i += stride) { + const x = array[i]; + const y = array[i + 1]; + const z = array[i + 2]; + const persp = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]); + array[i] = (e[0] * x + e[4] * y + e[8] * z + e[12] * w) * persp; + array[i + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13] * w) * persp; + array[i + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14] * w) * persp; + } + return array; +}; +class ScreenQuadMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RawShaderMaterial { + constructor(params) { + if (params.uniforms === undefined) { + params.uniforms = {}; + } + params.uniforms.srcTex = { + type: 't', + value: null + }; + params.vertexShader = ScreenQuad_namespaceObject; + params.transparent = false; + params.depthTest = false; + params.depthWrite = false; + super(params); + } +} +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderer.prototype.renderScreenQuadFromTex = function () { + const _material = new ScreenQuadMaterial({ + uniforms: { + opacity: { + type: 'f', + value: 1.0 } - - var residue = this._residue; - var chain = this._chain; - - if (!residue || residue.getSequence() !== resSeq) { - this._residue = chain.addResidue(resName, resSeq, 'A'); + }, + fragmentShader: ScreenQuadFromTex_namespaceObject, + transparent: true + }); + return function (srcTex, opacity) { + _material.uniforms.srcTex.value = srcTex; + _material.transparent = opacity < 1.0; + _material.uniforms.opacity.value = opacity; + this.renderScreenQuad(_material); + }; +}(); +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion = function () { + const _material = new ScreenQuadMaterial({ + uniforms: { + coef: { + type: 'f', + value: 1.0 } + }, + fragmentShader: ScreenQuadFromTexWithDistortion_namespaceObject + }); + return function (srcTex, coef) { + _material.uniforms.srcTex.value = srcTex; + _material.uniforms.coef.value = coef; + this.renderScreenQuad(_material); + }; +}(); - return true; - } - /* Bond format description - * bondId originAtomId targetAtomId bondType [statusBits] - */ - - }, { - key: "_parseBonds", - value: function _parseBonds(bondsNum, MOL2Data) { - this._toHeaderString('BOND', MOL2Data); - - for (var i = 0; i < bondsNum; i++) { - var parsedStr = splitToFields(MOL2Data[++this._currPosIdx]); +/** + * @param {number} angle - Field of view in degrees. + */ +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PerspectiveCamera.prototype.setMinimalFov = function (angle) { + if (this.aspect >= 1.0) { + this.fov = angle; + } else { + this.fov = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MathUtils.radToDeg(2 * Math.atan(Math.tan(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MathUtils.degToRad(angle) * 0.5) / this.aspect)); + } +}; - if (parsedStr.length < 3) { - throw new Error('MOL2 parsing error: Missing information about bonds!'); - } +/** + * @param {THREE.PerspectiveCamera} camera - Base camera for this stereo camera. + * @param {number} angle - Field of view in degrees. + */ +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.StereoCamera.prototype.updateHalfSized = function (camera, angle) { + const originalAspect = camera.aspect; + const originalFov = camera.fov; + camera.aspect = originalAspect / 2.0; + camera.setMinimalFov(angle); + camera.updateProjectionMatrix(); + this.update(camera); + camera.aspect = originalAspect; + camera.fov = originalFov; + camera.updateProjectionMatrix(); +}; - var originAtomId = parseInt(parsedStr[1], 10); - var targetAtomId = parseInt(parsedStr[2], 10); - var bondType = parsedStr[3]; +/** + * @param {number} radius - Radius of bounding sphere in angstroms to fit on screen. + * @param {number} angle - Field of view in degrees. + */ +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PerspectiveCamera.prototype.setDistanceToFit = function (radius, angle) { + this.position.z = radius / Math.sin(0.5 * external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MathUtils.degToRad(angle)); +}; - if (originAtomId > targetAtomId) { - var _ref = [targetAtomId, originAtomId]; - originAtomId = _ref[0]; - targetAtomId = _ref[1]; - } +/** + * @param {RCGroup} gfxObj - All objects on scene. + * @param {THREE.PerspectiveCamera} camera - Camera used for rendering. + * @param {number} clipPlane - Distance to clip plane. + * @param {number} fogFarPlane - Distance to fog far plane. + */ +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Raycaster.prototype.intersectVisibleObject = function (gfxObj, camera, clipPlane, fogFarPlane) { + const intersects = this.intersectObject(gfxObj, false); + if (intersects.length === 0) { + return null; + } - this._complex.addBond(originAtomId, targetAtomId, orderMap$1[bondType] || 0, typeMap$1[bondType] || Bond$5.BondType.UNKNOWN, true); - } + // find point closest to camera that doesn't get clipped by camera near plane or clipPlane (if it exists) + const nearPlane = Math.min(camera.near, clipPlane); + let i; + let p = intersects[0]; + const v = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + for (i = 0; i < intersects.length; ++i) { + p = intersects[i]; + v.copy(p.point); + v.applyMatrix4(camera.matrixWorldInverse); + if (v.z <= -nearPlane) { + break; } - }, { - key: "_fixSerialAtoms", - value: function _fixSerialAtoms() { - var atoms = this._complex._atoms; + } + if (i === intersects.length) { + return null; + } - for (var i = 0; i < atoms.length; i++) { - var atom = atoms[i]; - this._serialAtomMap[atom.serial] = atom; - } + // check that selected intersection point is not clipped by camera far plane or occluded by fog (if it exists) + const farPlane = Math.min(camera.far, fogFarPlane); + v.copy(p.point); + v.applyMatrix4(camera.matrixWorldInverse); + if (v.z <= -farPlane) { + return null; + } + return p; +}; +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4.prototype.extractScale = function () { + const _v = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + return function (scale) { + if (scale === undefined) { + logger.debug('extractScale(): new is too expensive operation to do it on-the-fly'); + scale = _v.clone(); } - }, { - key: "_fixBondsArray", - value: function _fixBondsArray() { - var serialAtomMap = this._serialAtomMap; - var complex = this._complex; - - if (Object.keys(serialAtomMap).length === 0) { - throw new Error('MOL2 parsing error: Missing atom information!'); - } + const te = this.elements; + scale.x = _v.set(te[0], te[1], te[2]).length(); + scale.y = _v.set(te[4], te[5], te[6]).length(); + scale.z = _v.set(te[8], te[9], te[10]).length(); - var bonds = complex._bonds; + // if determine is negative, we need to invert one scale + const det = this.determinant(); + if (det < 0) { + scale.x = -scale.x; + } + return scale; + }; +}(); +function _calcCylinderMatrix(posBegin, posEnd, radius) { + const posCenter = posBegin.clone().lerp(posEnd, 0.5); + const matScale = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + matScale.makeScale(radius, posBegin.distanceTo(posEnd), radius); + const matRotHalf = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + matRotHalf.makeRotationX(Math.PI / 2); + const matRotLook = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + const vUp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 1, 0); + matRotLook.lookAt(posCenter, posEnd, vUp); + matRotLook.multiply(matRotHalf); + matRotLook.multiply(matScale); + matRotLook.setPosition(posCenter); + return matRotLook; +} +function _calcChunkMatrix(eye, target, up, rad) { + const matScale = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + matScale.makeScale(rad.x, rad.y, 0); + const matRotLook = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + matRotLook.lookAt(eye, target, up); + matRotLook.multiply(matScale); + matRotLook.setPosition(eye); + return matRotLook; +} +function _groupHasGeometryToRender(group) { + let hasGeoms = false; + group.traverse(node => { + if (node.hasOwnProperty('geometry') || node instanceof gfx_CSS2DObject) { + hasGeoms = true; + } + }); + return hasGeoms; +} +function _buildDistorionMesh(widthSegments, heightSegements, coef) { + // solve equation r_u = r_d * (1 + k * r_d^2) + // for r_d using iterations + // takes: r_u^2 + // returns: r_d / r_u factor that can be used to distort point coords + function calcInverseBarrel(r2) { + const epsilon = 1e-5; + let prevR2 = 0.0; + let curR2 = r2; + let dr = 1.0; + while (Math.abs(curR2 - prevR2) > epsilon) { + dr = 1.0 + coef * curR2; + prevR2 = curR2; + curR2 = r2 / (dr * dr); + } + return 1.0 / dr; + } + const geo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PlaneGeometry(2.0, 2.0, widthSegments, heightSegements); + const pos = geo.getAttribute('position'); + for (let i = 0; i < pos.count; ++i) { + const x = pos.array[3 * i]; + const y = pos.array[3 * i + 1]; + const c = calcInverseBarrel(x * x + y * y); + pos.setXY(i, c * x, c * y); + } + return geo; +} +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute.prototype.copyAtList = function (attribute, indexList) { + console.assert(this.itemSize === attribute.itemSize, 'DEBUG: BufferAttribute.copyAtList buffers have different item size.'); + const { + itemSize + } = this; + for (let i = 0, n = indexList.length; i < n; ++i) { + for (let j = 0; j < itemSize; ++j) { + this.array[i * itemSize + j] = attribute.array[indexList[i] * itemSize + j]; + } + } + return this; +}; +function fillArray(array, value, startIndex, endIndex) { + startIndex = typeof startIndex !== 'undefined' ? startIndex : 0; + endIndex = typeof endIndex !== 'undefined' ? endIndex : array.length; + for (let i = startIndex; i < endIndex; ++i) { + array[i] = value; + } +} - for (var j = 0; j < bonds.length; j++) { - var bond = bonds[j]; - bond._left = serialAtomMap[bond._left] || null; - bond._right = serialAtomMap[bond._right] || null; - } +/** @param {THREE.Object3D} object - Parent object. */ +function removeChildren(object) { + const { + children + } = object; + for (let i = 0, n = children.length; i < n; ++i) { + const child = children[i]; + child.parent = null; + child.dispatchEvent({ + type: 'removed' + }); + } + object.children = []; +} +function clearTree(object) { + object.traverse(obj => { + if (obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh || obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineSegments || obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Line) { + obj.geometry.dispose(); + } + }); + removeChildren(object); +} +function destroyObject(object) { + clearTree(object); + if (object.parent) { + object.parent.remove(object); + } else { + object.dispatchEvent({ + type: 'removed' + }); + } +} +function belongToSelectLayers(object) { + for (let i = 0; i < SELECTION_LAYERS.length; i++) { + if ((object.layers.mask >> SELECTION_LAYERS[i] & 1) === 1) { + return true; } - }, { - key: "_finalizeMolecules", - value: function _finalizeMolecules() { - // Get chain from complex - var chain = this._complex._chains[0]; - this._complex._molecules = []; // Aggregate residues from chains - // (to be precise from the chain 'A') - - for (var i = 0; i < this._molecules.length; i++) { - var currMolecule = this._molecules[i]; - var molResidues = chain._residues; - var molecule = new Molecule$7(this._complex, currMolecule._name, i + 1); - molecule.residues = molResidues; - this._complex._molecules[i] = molecule; - } + } + return false; +} +function processObjRenderOrder(root, idMaterial) { + // set renderOrder to 0 for Backdrop and to 1 in other cases to render Backdrop earlier all other materials + const renderOrder = +(idMaterial !== 'BA'); + root.traverse(object => { + if (object.isGroup) { + object.renderOrder = renderOrder; } - }, { - key: "_finalize", - value: function _finalize() { - this._complex._finalizeBonds(); - - this._fixSerialAtoms(); - - this._fixBondsArray(); - - this._finalizeMolecules(); - - this._complex.finalize({ - needAutoBonding: false, - detectAromaticLoops: this.settings.now.aromatic, - enableEditing: this.settings.now.editing, - serialAtomMap: this._serialAtomMap + }); +} +function applySelectionMaterial(geo) { + geo.traverse(node => { + if ('material' in node) { + node.material = node.material.clone(true); + // using z-offset to magically fix selection rendering artifact (on z-sprites) + node.material.setValues({ + depthFunc: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LessEqualDepth, + overrideColor: true, + fog: false, + lights: false, + shadowmap: false + }); + node.material.setUberOptions({ + fixedColor: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(0xFFFF00), + zOffset: -1e-6 }); } - }, { - key: "_parseCompound", - value: function _parseCompound(MOL2Data) { - this._compoundIndx++; - - this._parseMolecule(MOL2Data); // Ignoring comments and everything before @MOLECULE block - - - this._toStringFromHeader('MOLECULE', 2, MOL2Data); - - var parsedStr = MOL2Data[this._currPosIdx].trim().split(spacesRegex); - - var atomsNum = parsedStr[0]; - var bondsNum = parsedStr[1]; - - this._parseAtoms(atomsNum, MOL2Data); - - this._parseBonds(bondsNum, MOL2Data); - } - }, { - key: "parseSync", - value: function parseSync() { - var result = this._complex = new Complex$9(); - - var MOL2Data = this._parseRawStrings(this._data); + }); +} +function getMiddlePoint(point1, point2, optionalTarget) { + const result = optionalTarget || new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + result.set(0, 0, 0); + result.addScaledVector(point1, 0.5); + result.addScaledVector(point2, 0.5); + return result; +} - do { - this._parseCompound(MOL2Data); - } while (this._findNextCompoundStart(MOL2Data)); +// Monkey-patch for "InstancedBufferGeometry.instanceCount becomes undefined after copy()" +// https://github.com/mrdoob/three.js/issues/22151 +const _oldInstancedBufferGeometryCopy = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferGeometry.prototype.copy; +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferGeometry.prototype.copy = function (source) { + _oldInstancedBufferGeometryCopy.call(this, source); + if (this.instanceCount === undefined) { + this.instanceCount = Infinity; + } +}; +/* harmony default export */ const gfxutils = ({ + calcCylinderMatrix: _calcCylinderMatrix, + calcChunkMatrix: _calcChunkMatrix, + groupHasGeometryToRender: _groupHasGeometryToRender, + buildDistorionMesh: _buildDistorionMesh, + RCGroup: gfx_RCGroup, + fillArray, + clearTree, + destroyObject, + belongToSelectLayers, + processObjRenderOrder, + applySelectionMaterial, + getMiddlePoint, + LAYERS +}); +;// CONCATENATED MODULE: ./src/Visual.js - this._finalize(); - return result; +const _defaultBoundaries = { + boundingBox: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-1, -1, -1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1, 1, 1)), + boundingSphere: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Sphere(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0), 1) +}; +class Visual extends gfxutils.RCGroup { + constructor(name, dataSource) { + super(name, dataSource); + this.name = name; + this._dataSource = dataSource; + } + release() { + if (this.parent) { + this.parent.remove(this); } - }]); - - return MOL2Parser; -}(Parser); - -MOL2Parser.formats = ['mol2']; -MOL2Parser.extensions = ['.mol2', '.ml2', '.sy2']; - -var parsers = new ParserList([// note: order might be important -PDBParser, CIFParser, MMTFParser, XYZParser, CMLParser, PubChemParser, SDFParser, CCP4Parser, DSN6Parser, GROParser, MOL2Parser]); - -/** - * A list of available exporters. - * @extends EntityList - */ - -var ExporterList = /*#__PURE__*/function (_EntityList) { - inherits(ExporterList, _EntityList); + } + getDataSource() { + return this._dataSource; + } + getBoundaries() { + return _defaultBoundaries; + } +} +/* harmony default export */ const src_Visual = (Visual); +;// CONCATENATED MODULE: ./src/utils/EntityList.js +function _ensureArray(x) { + if (x === null || x === undefined || Array.isArray(x)) { + return x; + } + return [x]; +} +/** An indexed list of objects or classes. */ +class EntityList { /** - * Create a list of exporters. - * The exporters are indexed by supported data formats (`.formats` and - * `.extensions` properties of a Exporter subclass). - * The Exporters can be retrieved later by matching against specs (see {@link ExporterList#find}). + * Create a list of objects. + * The objects can be indexed by one or more properties for the later retrieval. * - * @param {!Array=} someExporters A list of {@link Exporter} subclasses to - * automatically register at creation time. - * @see ExporterList#register + * @param {!Array=} entities A list of objects to automatically register at creation time. + * @param {!Array=} indices A list of property names to use for case-insensitive indexing. + * By default, a single `.id` property is used. + * @see EntityList#register */ - function ExporterList() { - var someExporters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - - classCallCheck(this, ExporterList); - - return possibleConstructorReturn(this, getPrototypeOf(ExporterList).call(this, someExporters, ['formats'])); + constructor() { + let entities = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + let indices = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['id']; + this._list = []; + this._dict = {}; + this._indices = [...indices]; + this._indices.forEach(index => { + this._dict[index] = {}; + }); + entities.forEach(entity => this.register(entity)); } + /** - * Find a suitable exporter for data. + * Add a value to the end of a list. + * The list will contain only one copy of the value. * - * @param {Object} specs Exporter specifications. - * @param {string=} specs.format Supported data format. - * @param {*=} specs.data Data to export. + * @param {!Array} list An array. + * @param {*} value A value to add. + * @see EntityList.unregisterFromList + * @see EntityList.registerInDict */ - - - createClass(ExporterList, [{ - key: "find", - value: function find(specs) { - var list = []; - - if (specs.format) { - list = this._dict.formats[specs.format.toLowerCase()] || []; - } - - return toConsumableArray(list); + static registerInList(list, value) { + if (!list.includes(value)) { + list.push(value); } - }]); - - return ExporterList; -}(EntityList); - -var Exporter = /*#__PURE__*/function () { - function Exporter(source, options) { - classCallCheck(this, Exporter); - - this._source = source; - this._options = options || {}; - this._abort = false; } - createClass(Exporter, [{ - key: "exportSync", - value: function exportSync() { - throw new Error('Exporting to this source is not implemented'); - } - }, { - key: "export", - value: function _export() { - var _this = this; - - return new Promise(function (resolve, reject) { - setTimeout(function () { - try { - if (_this._abort) { - return reject(new Error('Export aborted')); - } - - return resolve(_this.exportSync()); - } catch (error) { - return reject(error); - } - }); - }); - } - }, { - key: "abort", - value: function abort() { - this._abort = true; + /** + * Remove a value from a list if it is there. + * + * @param {!Array} list An array. + * @param {*} value A value to remove. + * @see EntityList.registerInList + */ + static unregisterFromList(list, value) { + const pos = list.indexOf(value); + if (pos !== -1) { + list.splice(pos, 1); } - }]); - - return Exporter; -}(); -makeContextDependent(Exporter.prototype); - -var PDBResult = /*#__PURE__*/function () { - function PDBResult() { - classCallCheck(this, PDBResult); - - this._resultArray = []; - this._currentStr = -1; - this._tag = null; - this._fixedNumeration = false; - this._numeration = false; - this._tagStrNum = 0; } - createClass(PDBResult, [{ - key: "getResult", - value: function getResult() { - this.writeString('\n', 81, 81); - return this._resultArray.join(''); - } - }, { - key: "_currentStrLength", - value: function _currentStrLength() { - var curStr = this._resultArray[this._currentStr]; - return curStr ? curStr.length : 0; - } // numeration can be number or boolean - // if numeration is number then just put this number to 8-10 pos in string - // if numeration is boolean then increase number for all new strings - - }, { - key: "newTag", - value: function newTag(tag, numeration) { - if (!tag) { - this._tag = null; - } else { - this._tag = tag; - } - - if (!_.isUndefined(numeration)) { - if (_.isNumber(numeration)) { - this._tagStrNum = numeration; - this._numeration = true; - this._fixedNumeration = true; - } else if (_.isBoolean(numeration)) { - this._tagStrNum = 0; - this._numeration = numeration; - this._fixedNumeration = false; - } - } else { - this._numeration = false; - this._fixedNumeration = false; - this._tagStrNum = 0; - } - } - }, { - key: "newString", - value: function newString(tag) { - this.writeString('\n', 81, 81); - this._currentStr++; - - this._resultArray.push(''); - - if (tag) { - this.writeString(tag, 1, 6); - } else if (this._tag) { - this.writeString(this._tag, 1, 6); - } - - if (this._numeration) { - if (!this._fixedNumeration) { - this._tagStrNum++; - } - - if (this._tagStrNum !== 1) { - this.writeString(this._tagStrNum.toString(), 10, 8); - } - } - } - }, { - key: "writeEntireString", - value: function writeEntireString(string, maxStrPos, concat) { - if (!maxStrPos) { - maxStrPos = 81; + /** + * Add a value to a dictionary. + * The value may be stored under multiple different keys (aliases). + * There might be multiples values stored under the same key. + * + * @param {!Object} dict A dictionary. + * @param {!Array} keys An array of keys. + * @param {*} value A value to add. + * @see EntityList.unregisterFromDict + * @see EntityList.registerInList + */ + static registerInDict(dict, keys, value) { + keys.forEach(key => { + key = key.toLowerCase(); + const list = dict[key] = dict[key] || []; + if (!list.includes(value)) { + list.push(value); } + }); + } - for (var j = 0; j < string.length; j++) { - if (this._currentStrLength() === maxStrPos && j !== string.length - 1) { - this.newString(); - - if (concat) { - // pretty hardcoddy - this.writeString(concat.tag, concat.begin, concat.end); - } + /** + * Remove a value from a dictionary. + * The value may be stored under multiple different keys (aliases). + * There might be multiples values stored under the same key. + * + * @param {!Object} dict A dictionary. + * @param {!Array} keys An array of keys. + * @param {*} value A value to add. + * @see EntityList.registerInDict + */ + static unregisterFromDict(dict, keys, value) { + keys.forEach(key => { + key = key.toLowerCase(); + const list = dict[key]; + if (list) { + const pos = list.indexOf(value); + if (pos !== -1) { + list.splice(pos, 1); } - - if (string[j] === '\n') { - this.newString(); - } else { - this.writeString(string[j]); + if (list.length === 0) { + delete dict[key]; } } - } - }, { - key: "writeString", - value: function writeString(string, begin, end) { - var curStr = this._resultArray[this._currentStr]; - var str; - var curStrLength = curStr ? curStr.length : 0; - - if (_.isUndefined(string)) { - return; - } - - if (!_.isNumber(begin)) { - begin = curStrLength + 1; - } - - if (!_.isNumber(end)) { - end = curStrLength + string.length; - } - - if (!_.isString(string)) { - str = string.toString(); - } else { - str = string; - } - - var finish = begin < end ? end : begin; - var start = begin < end ? begin : end; - - if (str.length > Math.abs(begin - end) + 1) { - str = str.substr(0, Math.abs(begin - end + 1)); - } // spaces before start of new data - - - if (start > curStrLength + 1) { - this._resultArray[this._currentStr] += ' '.repeat(start - curStrLength - 1); - } else if (start <= curStrLength) { - var cStr = this._resultArray[this._currentStr]; - this._resultArray[this._currentStr] = cStr.slice(0, start - 1); - } // if reverse order - // reverse order of end and begin means that user wants to align text right - - - if (end < begin) { - var len = begin - end + 1; - str = ' '.repeat(len - str.length) + str; - } // some hardcode fix for space between string numeration and data - // (see pdb file format description) - + }); + } - if (start === 11 && this._numeration && this._tagStrNum !== 1) { - str = " ".concat(str); - } // append new data to string + /** + * Add an entity to this list. + * + * @param {!Object} entity An object or a class to register. The object must include all + * properties specified as indices on construction. + * @see EntityList#unregister + */ + register(entity) { + EntityList.registerInList(this._list, entity); + this._indices.forEach(index => { + EntityList.registerInDict(this._dict[index], _ensureArray(entity[index]), entity); + }); + } + /** + * Remove an entity from this list. + * + * @param {!Object} entity An object or a class to unregister. The object may be + * missing from the list but it must include all properties specified as indices + * on construction. + * @see EntityList#register + */ + unregister(entity) { + EntityList.unregisterFromList(this._list, entity); + this._indices.forEach(index => { + EntityList.unregisterFromDict(this._dict[index], _ensureArray(entity[index]), entity); + }); + } - this._resultArray[this._currentStr] += str; - curStr = this._resultArray[this._currentStr]; + /** + * An ordered list of all registered entities. + * It is a read-only copy, use {@link EntityList#register} and {@link EntityList#unregister} + * to modify it. + * + * @type {!Array} + */ + get all() { + return [...this._list]; + } - if (finish > curStr.length) { - this._resultArray[this._currentStr] += ' '.repeat(finish - curStr.length); - } - } - }, { - key: "writeBondsArray", - value: function writeBondsArray(bonds, atom) { - var bondsArrays = this._getSubArrays(bonds, 4); + /** + * The first registered entity. + * Use it if you do not care which entity you are referring to. + * + * @type {Object=} + */ + get first() { + return this._list[0]; + } - for (var k = 0; k < bondsArrays.length; k++) { - this.newString(); - this.writeString(atom.serial, 11, 7); + /** + * Retrieve a list of keys for the index. + * + * @param {string=} index One of the indices specified during the list construction. If omitted, + * the first of the indices is used. + * @returns {!Array} An unordered list of keys in the index, i.e. particular property + * values for all registered entities. + */ + keys(index) { + return Object.keys(this._dict[index || this._indices[0]]); + } - for (var j = 0; j < bondsArrays[k].length; j++) { - var serial = bondsArrays[k][j]._left.serial === atom.serial ? bondsArrays[k][j]._right.serial : bondsArrays[k][j]._left.serial; - this.writeString(serial, 16 + 5 * j, 12 + 5 * j); - } - } + /** + * Retrieve an entity by its key. + * + * @param {string} key A case-insensitive property value to look-up. + * @param {string=} index One of the indices specified during the list construction. If omitted, + * the first of the indices is used. + * @returns {Object=} An object registered in the index under the key. If there are multiple + * objects under the same key, the first one is returned. + */ + get(key, index) { + const dict = this._dict[index || this._indices[0]]; + if (dict) { + const values = dict[key && key.toLowerCase()]; + return values && values.length > 0 ? values[0] : undefined; } - }, { - key: "_getSubArrays", - value: function _getSubArrays(arr, subArraySize) { - var subArrays = []; - - for (var i = 0; i < arr.length; i += subArraySize) { - subArrays.push(arr.slice(i, i + subArraySize)); - } - - return subArrays; - } // function for writing matrix in Remark290 and Remark350 tags - // (see pdb file description) - - }, { - key: "writeMatrix", - value: function writeMatrix(matrix, matrixIndx, tag) { - for (var j = 0; j < 3; j++) { - this.newString(); - this.writeString(tag, 14, 18); - this.writeString((j + 1).toString(), 19, 19); - this.writeString(matrixIndx.toString(), 23, 20); + return undefined; + } +} +/* harmony default export */ const utils_EntityList = (EntityList); +;// CONCATENATED MODULE: ./src/utils/makeContextDependent.js - for (var k = 0; k < 3; k++) { - var _numb = parseFloat(matrix.elements[j * 4 + k]).toFixed(6); - this.writeString(_numb.toString(), 33 + k * 10, 24 + k * 10); - } +function makeContextDependent(prototype) { + Object.defineProperties(prototype, { + logger: { + get() { + return this.context && this.context.logger ? this.context.logger : logger; + } + }, + settings: { + get() { + return this.context && this.context.settings ? this.context.settings : settings; + } + } + }); +} +/* harmony default export */ const utils_makeContextDependent = (makeContextDependent); +;// CONCATENATED MODULE: ./src/gfx/geometries/SphereCollisionGeo.js - var numb = parseFloat(matrix.elements[j * 4 + 3]).toFixed(5); - this.writeString(numb.toString(), 68, 55); +class CollisionSphere { + constructor(position, radius) { + this._position = position; + this._radius = radius; + } + static _sphere = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Sphere())(); + raycast(raycaster) { + const sphere = CollisionSphere._sphere; + sphere.set(this._position, this._radius); + const p = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + if (raycaster.ray.intersectSphere(sphere, p)) { + return { + distance: raycaster.ray.origin.distanceTo(p), + point: p + }; + } + return null; + } +} +const SphereCollisionGeo = base => class extends base { + constructor(count) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + super(...args); + this._objects = new Array(count); + this.boundingSphere = null; + this.boundingBox = null; + } + setSphere(idx, position, radius) { + this._objects[idx] = new CollisionSphere(position, radius); + } + raycast(raycaster, intersects) { + // TODO raycast with bounding sphere? How to deal with updates? + for (let i = 0, n = this._objects.length; i < n; ++i) { + const inters = this._objects[i].raycast(raycaster); + if (inters) { + inters.chunkIdx = i; + intersects.push(inters); } } - }, { - key: "writeMatrices", - value: function writeMatrices(matrices, string) { - if (!matrices) { - return; + } + computeBoundingBox() { + const objects = this._objects; + let { + boundingBox + } = this; + if (boundingBox === null) { + this.boundingBox = boundingBox = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(); + } + boundingBox.makeEmpty(); + for (let i = 0, n = objects.length; i < n; ++i) { + boundingBox.expandByPoint(objects[i]._position); + } + } + computeBoundingSphere() { + this.computeBoundingBox(); + const objects = this._objects; + const { + boundingBox + } = this; + // Build bounding sphere + let radiusSquared = 0.0; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + boundingBox.getCenter(center); + for (let i = 0, n = objects.length; i < n; ++i) { + const pos = objects[i]._position; + const lengthSquared = center.distanceToSquared(pos); + if (radiusSquared < lengthSquared) { + radiusSquared = lengthSquared; } + } + if (this.boundingSphere === null) { + this.boundingSphere = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Sphere(); + } + this.boundingSphere.set(center, Math.sqrt(radiusSquared)); + } +}; +/* harmony default export */ const geometries_SphereCollisionGeo = (SphereCollisionGeo); +;// CONCATENATED MODULE: ./src/gfx/geometries/InstancedSpheresGeometry.js - var matrix = new Matrix4(); - for (var j = 0; j < matrices.length; j++) { - matrix.copy(matrices[j]).transpose(); - this.writeMatrix(matrix, j + 1, string); - } - } - }]); - return PDBResult; -}(); -var PDBExporter = /*#__PURE__*/function (_Exporter) { - inherits(PDBExporter, _Exporter); - - function PDBExporter(source, options) { - var _this; - - classCallCheck(this, PDBExporter); - - _this = possibleConstructorReturn(this, getPrototypeOf(PDBExporter).call(this, source, options)); - _this._tags = ['HEADER', 'TITLE', 'COMPND', 'REMARK', 'HELIX', 'SHEET', 'ATOM and HETATM', 'CONECT']; - _this._result = null; - _this._tagExtractors = { - HEADER: _this._extractHEADER, - TITLE: _this._extractTITLE, - 'ATOM and HETATM': _this._extractATOM, - CONECT: _this._extractCONECT, - COMPND: _this._extractCOMPND, - REMARK: _this._extractREMARK, - HELIX: _this._extractHELIX, - SHEET: _this._extractSHEET - }; - _this._stringForRemark350 = 'COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN\n' + 'BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE\n' + 'MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS\n' + 'GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND\n' + 'CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.'; - _this._stringForRemark290 = 'CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS\n' + 'THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM\n' + 'RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY\n' + 'RELATED MOLECULES.'; - return _this; +const tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(); +const OFFSET_SIZE = 4; +const COLOR_SIZE = 3; +const { + copySubArrays: InstancedSpheresGeometry_copySubArrays +} = utils; +function setArrayXYZ(arr, idx, x, y, z) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; +} +function setArrayXYZW(arr, idx, x, y, z, w) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; + arr[idx + 3] = w; +} +class InstancedSpheresGeometry extends geometries_SphereCollisionGeo(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferGeometry) { + constructor(spheresCount, sphereComplexity, useZSprites) { + super(spheresCount); + this._sphGeometry = useZSprites ? new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PlaneGeometry(2, 2, 1, 1) : new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI); + this._init(spheresCount, this._sphGeometry); + } + setItem(itemIdx, itemPos, itemRad) { + setArrayXYZW(this._offsets, itemIdx * OFFSET_SIZE, itemPos.x, itemPos.y, itemPos.z, itemRad); + this.setSphere(itemIdx, itemPos, itemRad); + } + setColor(itemIdx, colorVal) { + tmpColor.set(colorVal); + setArrayXYZ(this._colors, itemIdx * COLOR_SIZE, tmpColor.r, tmpColor.g, tmpColor.b); } + startUpdate() { + return true; + } + finishUpdate() { + this.getAttribute('offset').needsUpdate = true; + this.getAttribute('color').needsUpdate = true; + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + setOpacity(chunkIndices, value) { + const alphaArr = this._alpha; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + alphaArr[chunkIndices[i]] = value; + } + this.getAttribute('alphaColor').needsUpdate = true; + } + getSubset(chunkIndices) { + const instanceCount = chunkIndices.length; + const geom = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferGeometry(); + this._init.call(geom, instanceCount, this._sphGeometry); + InstancedSpheresGeometry_copySubArrays(this._offsets, geom._offsets, chunkIndices, OFFSET_SIZE); + InstancedSpheresGeometry_copySubArrays(this._colors, geom._colors, chunkIndices, COLOR_SIZE); + geom.boundingSphere = this.boundingSphere; + geom.boundingBox = this.boundingBox; + return [geom]; + } + _init(spheresCount, sphereGeo) { + this.copy(sphereGeo); + this._offsets = utils.allocateTyped(Float32Array, spheresCount * OFFSET_SIZE); + this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE); + const alpha = this._alpha = utils.allocateTyped(Float32Array, spheresCount); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].fill(alpha, 1.0); + this.setAttribute('offset', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._offsets, OFFSET_SIZE, false, 1)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._colors, COLOR_SIZE, false, 1)); + this.setAttribute('alphaColor', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(alpha, 1, false, 1)); + } +} +/* harmony default export */ const geometries_InstancedSpheresGeometry = (InstancedSpheresGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/ChunkedObjectsGeometry.js - createClass(PDBExporter, [{ - key: "exportSync", - value: function exportSync() { - var result = new PDBResult(); - if (!this._source) { - return this._result; - } - for (var i = 0; i < this._tags.length; i++) { - var tag = this._tags[i]; - var func = this._tagExtractors[tag]; +const MAX_IDC_16BIT = 65535; +const VEC_SIZE = 3; +const ChunkedObjectsGeometry_tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(); - if (_.isFunction(func)) { - func.call(this, result); - } - } +/** + * This class represents geometry which consists of separate chunks. + * Each chunk has same index and similar geometry with equal points and faces count. + * Each chunk has by default only one color. + * @constructor + */ - this._result = result.getResult(); - return this._result; +class ChunkedObjectsGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry { + constructor(chunkGeo, chunksCount) { + super(); + if (this.constructor === ChunkedObjectsGeometry) { + throw new Error('Can not instantiate abstract class!'); } - }, { - key: "_extractHEADER", - value: function _extractHEADER(result) { - if (!this._source.metadata) { - return; + this._chunkGeo = chunkGeo; + this._init(chunkGeo, chunksCount); + } + startUpdate() { + return true; + } + finishUpdate() { + this.getAttribute('position').needsUpdate = true; + this.getAttribute('normal').needsUpdate = true; + this.getAttribute('color').needsUpdate = true; + } + setColor(chunkIdx, colorVal) { + ChunkedObjectsGeometry_tmpColor.set(colorVal); + const colors = this._colors; + const chunkSize = this._chunkSize; + for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) { + const idx = i * VEC_SIZE; + colors[idx] = ChunkedObjectsGeometry_tmpColor.r; + colors[idx + 1] = ChunkedObjectsGeometry_tmpColor.g; + colors[idx + 2] = ChunkedObjectsGeometry_tmpColor.b; + } + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + setOpacity(chunkIndices, value) { + const alphaArr = this._alpha; + const chunkSize = this._chunkSize; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const left = chunkIndices[i] * chunkSize; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].fill(alphaArr, value, left, left + chunkSize); + } + this.getAttribute('alphaColor').needsUpdate = true; + } + raycast(raycaster, intersects) { + const inters = []; + // use THREE.Mesh raycasting interface for the Geometry. The Mesh is + // created with existed geometry and default material, so it doesn't slowdown. + const mesh = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh(); + mesh.geometry = this; + mesh.raycast(raycaster, inters); + const facesPerChunk = this._chunkGeo.index.count / 3; + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('faceIndex')) { + continue; } + inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk); + intersects.push(inters[i]); + } + } + getSubset(chunkIndices) { + const instanceCount = chunkIndices.length; + const geom = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry(); + this._init.call(geom, this._chunkGeo, instanceCount); + const srcPos = this._positions; + const srcNorm = this._normals; + const srcColor = this._colors; + const dstPos = geom._positions; + const dstNorm = geom._normals; + const dstColor = geom._colors; + const chunkSize = this._chunkSize * VEC_SIZE; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const dstPtOffset = i * chunkSize; + const ptIdxBegin = chunkIndices[i] * chunkSize; + const ptIdxEnd = ptIdxBegin + chunkSize; + dstPos.set(srcPos.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); + dstNorm.set(srcNorm.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); + dstColor.set(srcColor.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset); + } + geom.boundingSphere = this.boundingSphere; + geom.boundingBox = this.boundingBox; + return [geom]; + } + _init(chunkGeo, chunksCount) { + const chunkSize = this._chunkSize = chunkGeo.attributes.position.count; + const chunkIndex = chunkGeo.index.array; + const chunkIndexSize = chunkIndex.length; + const pointsCount = this._chunkSize * chunksCount; + const use32bitIndex = pointsCount > MAX_IDC_16BIT; + const indexSize = chunkIndexSize * chunksCount; + const index = this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, indexSize); + this._positions = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); + this._normals = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); + this._colors = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE); + const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].fill(alpha, 1.0); + for (let i = 0; i < chunksCount; ++i) { + const offset = i * chunkIndexSize; + const posOffset = i * chunkSize; + index.set(chunkIndex, offset); + for (let j = 0; j < chunkIndexSize; ++j) { + index[offset + j] += posOffset; + } + } + this.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._index, 1)); + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._positions, VEC_SIZE)); + this.setAttribute('normal', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._normals, VEC_SIZE)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._colors, VEC_SIZE)); + this.setAttribute('alphaColor', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(alpha, 1)); + } +} +/* harmony default export */ const geometries_ChunkedObjectsGeometry = (ChunkedObjectsGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/SimpleSpheresGeometry.js - var metadata = this._source.metadata; - result.newTag('HEADER'); - result.newString(); - if (metadata.classification) { - result.writeString(metadata.classification, 11, 50); - } - if (metadata.date) { - result.writeString(metadata.date, 51, 59); - } - if (metadata.id) { - result.writeString(metadata.id, 63, 66); - } +const SimpleSpheresGeometry_VEC_SIZE = 3; +class SimpleSpheresGeometry extends geometries_SphereCollisionGeo(geometries_ChunkedObjectsGeometry) { + constructor(spheresCount, sphereComplexity) { + const sphGeometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI); + super(spheresCount, sphGeometry, spheresCount); + const normals = this._normals; + const geoNormals = sphGeometry.attributes.normal.array; + const chunkSize = this._chunkSize; + this._chunkPos = this._chunkGeo.attributes.position.array; + this._tmpPositions = utils.allocateTyped(Float32Array, chunkSize * SimpleSpheresGeometry_VEC_SIZE); + for (let i = 0; i < spheresCount; ++i) { + normals.set(geoNormals, chunkSize * SimpleSpheresGeometry_VEC_SIZE * i); } - }, { - key: "_extractTITLE", - value: function _extractTITLE(result) { - if (!this._source.metadata) { - return; - } + } + setItem(itemIdx, itemPos, itemRad) { + const tmpPos = this._tmpPositions; + const chunkSize = this._chunkSize; + const geoPos = this._chunkPos; + for (let i = 0; i < chunkSize; ++i) { + const idx = i * 3; + tmpPos[idx] = itemPos.x + geoPos[idx] * itemRad; + tmpPos[idx + 1] = itemPos.y + geoPos[idx + 1] * itemRad; + tmpPos[idx + 2] = itemPos.z + geoPos[idx + 2] * itemRad; + } + this._positions.set(tmpPos, chunkSize * itemIdx * SimpleSpheresGeometry_VEC_SIZE); + this.setSphere(itemIdx, itemPos, itemRad); + } +} +/* harmony default export */ const geometries_SimpleSpheresGeometry = (SimpleSpheresGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/Simple2CCylindersGeometry.js + + + + +const Simple2CCylindersGeometry_VEC_SIZE = 3; +const centerPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +const tmpVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +const normMtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix3(); +class Simple2CCylindersGeometry extends geometries_ChunkedObjectsGeometry { + constructor(instanceCount, polyComplexity) { + const cylGeometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true); + super(cylGeometry, 2 * instanceCount); + const chunkSize = this._chunkSize; + this._chunkPos = this._chunkGeo.attributes.position.array; + this._chunkNorms = this._chunkGeo.attributes.normal.array; + this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * Simple2CCylindersGeometry_VEC_SIZE); + } + setItem(itemIdx, botPos, topPos, itemRad) { + const chunkSize = this._chunkSize; + const firstOffset = chunkSize * 2 * itemIdx * Simple2CCylindersGeometry_VEC_SIZE; + const secondOffset = firstOffset + chunkSize * Simple2CCylindersGeometry_VEC_SIZE; + const tmpArray = this._tmpVector; + const geoPos = this._chunkPos; + const geoNorm = this._chunkNorms; + centerPos.lerpVectors(botPos, topPos, 0.5); + const mtx1 = gfxutils.calcCylinderMatrix(botPos, centerPos, itemRad); + normMtx.getNormalMatrix(mtx1); + let idx; + for (let i = 0; i < chunkSize; ++i) { + idx = i * Simple2CCylindersGeometry_VEC_SIZE; + tmpVector.fromArray(geoPos, idx); + tmpVector.applyMatrix4(mtx1); + tmpVector.toArray(tmpArray, idx); + } + this._positions.set(tmpArray, firstOffset); + + // now shift center to get another part of the cylinder + centerPos.sub(botPos); + for (let i = 0; i < chunkSize; ++i) { + idx = i * Simple2CCylindersGeometry_VEC_SIZE; + tmpArray[idx] += centerPos.x; + tmpArray[idx + 1] += centerPos.y; + tmpArray[idx + 2] += centerPos.z; + } + this._positions.set(tmpArray, secondOffset); + for (let i = 0; i < chunkSize; ++i) { + idx = i * Simple2CCylindersGeometry_VEC_SIZE; + tmpVector.fromArray(geoNorm, idx); + tmpVector.applyMatrix3(normMtx); + tmpVector.toArray(tmpArray, idx); + } + this._normals.set(tmpArray, firstOffset); + this._normals.set(tmpArray, secondOffset); + } + setColor(itemIdx, colorVal1, colorVal2) { + const first = 2 * itemIdx; + super.setColor(first, colorVal1); + const second = first + 1; + super.setColor(second, colorVal2); + } +} +/* harmony default export */ const geometries_Simple2CCylindersGeometry = (Simple2CCylindersGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/CylinderBufferGeometry.js + + +const MAX_POINTS_COUNT_16BIT = 65536; +const PTS_PER_TRIANGLE = 3; +class CylinderBufferGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry { + constructor(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded) { + super(); + const thetaStart = 0; + const thetaLength = 2 * Math.PI; + this.type = 'CylinderBufferGeometry'; + this.parameters = { + radiusTop, + radiusBottom, + height, + radialSegments, + heightSegments, + openEnded + }; + const hasTop = openEnded === false && radiusTop > 0; + const hasBottom = openEnded === false && radiusBottom > 0; + const vertexCount = (heightSegments + 1) * radialSegments + hasTop * (radialSegments + 1) + hasBottom * (radialSegments + 1); + const facesCount = (2 * heightSegments + hasTop + hasBottom) * radialSegments; + const heightHalf = height / 2; - var metadata = this._source.metadata; + /* eslint-disable no-magic-numbers */ + const positions = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3); + const normals = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3); + const indices = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Uint16BufferAttribute(utils.allocateTyped(Uint16Array, facesCount * PTS_PER_TRIANGLE), 1); + /* eslint-enable no-magic-numbers */ - if (!metadata.title) { - return; - } + const uvs = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 2), 2); + console.assert(vertexCount < MAX_POINTS_COUNT_16BIT, 'DEBUG: Cylinder Geometry has too many vertices (65536 max).'); + let currVtxIdx = 0; + let currFaceIdx = 0; + const tanTheta = -(radiusBottom - radiusTop) / height; - result.newTag('TITLE', true); + // setup cylinder data + for (let y = 0; y <= heightSegments; y++) { + // faces + if (y !== heightSegments) { + for (let i = 0; i < radialSegments; i++) { + const v1 = currVtxIdx + i; + const v2 = currVtxIdx + radialSegments + i; + const v3 = currVtxIdx + radialSegments + (i + 1) % radialSegments; + const v4 = currVtxIdx + (i + 1) % radialSegments; + indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v1, v4, v2); + currFaceIdx++; + indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v2, v4, v3); + currFaceIdx++; + } + } - for (var i = 0; i < metadata.title.length; i++) { - result.newString(); - result.writeString(metadata.title[i], 11, 80); + // vertices + const v = y / heightSegments; + const radius = v * (radiusBottom - radiusTop) + radiusTop; + for (let x = 0; x < radialSegments; x++) { + const u = x / radialSegments; + const vx = radius * Math.sin(u * thetaLength + thetaStart); + const vy = v * height - heightHalf; + const vz = radius * Math.cos(u * thetaLength + thetaStart); + const normal = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(vx, Math.sqrt(vx * vx + vz * vz) * tanTheta, vz).normalize(); + positions.setXYZ(currVtxIdx, vx, vy, vz); + normals.setXYZ(currVtxIdx, normal.x, normal.y, normal.z); + uvs.setXY(currVtxIdx, u, v); + ++currVtxIdx; } } - }, { - key: "_extractCONECT", - value: function _extractCONECT(result) { - if (!this._source._atoms) { - return; - } - var atoms = this._source._atoms; - result.newTag('CONECT'); - - for (var i = 0; i < atoms.length; i++) { - var fixedBonds = atoms[i].bonds.filter(function (bond) { - return bond._fixed; - }); - - if (fixedBonds.length !== 0) { - result.writeBondsArray(fixedBonds.reverse(), atoms[i]); - } + // top cap + if (hasTop) { + const startTIdx = currVtxIdx; + const lastIdx = currVtxIdx + radialSegments; + for (let fTIdx = 0; fTIdx < radialSegments; ++fTIdx) { + const currSrcIdx = currVtxIdx - radialSegments; + positions.setXYZ(currVtxIdx, positions.getX(currSrcIdx), positions.getY(currSrcIdx), positions.getZ(currSrcIdx)); + normals.setXYZ(currVtxIdx, 0, 1, 0); + uvs.setXY(currVtxIdx, 1, 1); + const nextTVtx = startTIdx + (fTIdx + 1) % radialSegments; + indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, currVtxIdx, nextTVtx, lastIdx); + currFaceIdx++; + currVtxIdx++; } + positions.setXYZ(currVtxIdx, 0, heightHalf, 0); + normals.setXYZ(currVtxIdx, 0, 1, 0); + uvs.setXY(currVtxIdx, 1, 1); + ++currVtxIdx; } - }, { - key: "_extractSHEET", - value: function _extractSHEET(result) { - if (!this._source._sheets) { - return; - } - result.newTag('SHEET'); - var sheets = this._source._sheets; - - for (var i = 0; i < sheets.length; i++) { - if (sheets[i]._strands) { - var strands = sheets[i]._strands; - - for (var j = 0; j < strands.length; j++) { - result.newString(); - result.writeString(j + 1, 10, 8); - result.writeString(sheets[i]._name, 14, 12); - result.writeString(strands.length, 16, 15); - result.writeString(strands[j].init._type._name, 18, 20); - result.writeString(strands[j].init._chain._name, 22, 22); - result.writeString(strands[j].init._sequence, 26, 23); - result.writeString(strands[j].init._icode, 27, 27); - result.writeString(strands[j].term._type._name, 29, 31); - result.writeString(strands[j].init._chain._name, 33, 33); - result.writeString(strands[j].term._sequence, 37, 34); - result.writeString(strands[j].term._icode, 38, 38); - result.writeString(strands[j].sense, 40, 39); - } - } + // bottom cap + if (hasBottom) { + const startBIdx = currVtxIdx; + const lastBIdx = currVtxIdx + radialSegments; + for (let fBIdx = 0; fBIdx < radialSegments; ++fBIdx) { + const currSrcBIdx = fBIdx; + positions.setXYZ(currVtxIdx, positions.getX(currSrcBIdx), positions.getY(currSrcBIdx), positions.getZ(currSrcBIdx)); + normals.setXYZ(currVtxIdx, 0, -1, 0); + uvs.setXY(currVtxIdx, 0, 0); + const nextBVtx = startBIdx + (fBIdx + 1) % radialSegments; + indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, nextBVtx, currVtxIdx, lastBIdx); + currFaceIdx++; + currVtxIdx++; } + positions.setXYZ(currVtxIdx, 0, -heightHalf, 0); + normals.setXYZ(currVtxIdx, 0, -1, 0); + uvs.setXY(currVtxIdx, 0, 0); } - }, { - key: "_extractHELIX", - value: function _extractHELIX(result) { - if (!this._source._helices) { - return; - } - - result.newTag('HELIX'); - var helices = this._source._helices; + this.setIndex(indices); + this.setAttribute('position', positions); + this.setAttribute('normal', normals); + this.setAttribute('uv', uvs); + } + clone() { + const { + parameters + } = this; + return new CylinderBufferGeometry(parameters.radiusTop, parameters.radiusBottom, parameters.height, parameters.radialSegments, parameters.heightSegments, parameters.openEnded); + } +} +/* harmony default export */ const geometries_CylinderBufferGeometry = (CylinderBufferGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/Instanced2CCylindersGeometry.js - for (var i = 0; i < helices.length; i++) { - var helix = helices[i]; - var helixClass = _.invert(typeByPDBHelixClass); - result.newString(); - result.writeString(helix.serial, 10, 8); - result.writeString(helix.name, 14, 12); - result.writeString(helix.init._type._name, 16, 18); - result.writeString(helix.init._chain._name, 20, 20); - result.writeString(helix.init._sequence, 25, 22); - result.writeString(helix.init._icode, 26, 26); - result.writeString(helix.term._type._name, 28, 30); - result.writeString(helix.term._chain._name, 32, 32); - result.writeString(helix.term._sequence, 37, 34); - result.writeString(helix.term._icode, 38, 38); - result.writeString(helixClass[helix.type], 40, 39); - result.writeString(helix.comment, 41, 70); - result.writeString(helix.length, 76, 72); - } - } - }, { - key: "_extractATOM", - value: function _extractATOM(result) { - if (!this._source._atoms) { - return; - } - var atoms = this._source._atoms; - for (var i = 0; i < atoms.length; i++) { - var tag = atoms[i].het ? 'HETATM' : 'ATOM'; - result.newString(tag); - var startIndx = atoms[i].element.name.length > 1 || atoms[i].name.length > 3 ? 13 : 14; - result.writeString(atoms[i].serial, 11, 7); - result.writeString(atoms[i].name, startIndx, 16); - result.writeString(String.fromCharCode(atoms[i].location), 17, 17); - result.writeString(atoms[i].residue._type._name, 20, 18); - result.writeString(atoms[i].residue._chain._name, 22, 22); - result.writeString(atoms[i].residue._sequence, 26, 23); - result.writeString(atoms[i].residue._icode, 27, 27); - result.writeString(atoms[i].position.x.toFixed(3), 38, 31); - result.writeString(atoms[i].position.y.toFixed(3), 46, 39); - result.writeString(atoms[i].position.z.toFixed(3), 54, 47); - result.writeString(atoms[i].occupancy.toFixed(2), 60, 55); - result.writeString(atoms[i].temperature.toFixed(2), 66, 61); - result.writeString(atoms[i].element.name, 78, 77); - if (atoms[i].charge) { - result.writeString(atoms[i].charge, 79, 80); - } +const Instanced2CCylindersGeometry_tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(); +const invMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); +const Instanced2CCylindersGeometry_OFFSET_SIZE = 4; +const Instanced2CCylindersGeometry_COLOR_SIZE = 3; +const { + copySubArrays: Instanced2CCylindersGeometry_copySubArrays +} = utils; +function Instanced2CCylindersGeometry_setArrayXYZ(arr, idx, x, y, z) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; +} +function Instanced2CCylindersGeometry_setArrayXYZW(arr, idx, x, y, z, w) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; + arr[idx + 3] = w; +} +function sortNumber(a, b) { + return a - b; +} +function _prepareCylinderInfo(chunkIndices) { + chunkIndices.sort(sortNumber); + const chunksIdx = []; + const cylinderInfo = []; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const val = chunkIndices[i]; + const even = (val | 0) % 2 === 0; + const newPar = { + first: false, + second: false + }; + if (even) { + newPar.first = true; + newPar.second = i + 1 < n && chunkIndices[i + 1] === chunkIndices[i] + 1; + if (newPar.second) { + ++i; } + } else { + newPar.second = true; } - }, { - key: "_extractCOMPND", - value: function _extractCOMPND(result) { - if (!this._source._molecules) { - return; - } + chunksIdx.push(Math.floor(val / 2)); + cylinderInfo.push(newPar); + } + return { + indices: chunksIdx, + cylinderInfo + }; +} +function _assignOpacity(cylinderInfo, color1, color2) { + for (let i = 0, n = cylinderInfo.length; i < n; ++i) { + const info = cylinderInfo[i]; + if (!info.first) { + color1[Instanced2CCylindersGeometry_COLOR_SIZE * i] = -0.5; + } + if (!info.second) { + color2[Instanced2CCylindersGeometry_COLOR_SIZE * i] = -0.5; + } + } +} +class Instanced2CCylindersGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferGeometry { + constructor(instanceCount, polyComplexity, useZSprites, openEnded) { + super(); + this._useZSprites = useZSprites; + this._cylGeometry = useZSprites ? new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PlaneGeometry(2, 2, 1, 1) : new geometries_CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, openEnded); + this._init(instanceCount, this._cylGeometry, this._useZSprites); + this._collisionGeo = new geometries_Simple2CCylindersGeometry(instanceCount, 3); + } + setItem(itemIdx, botPos, topPos, itemRad) { + const matrix = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad); + let me = matrix.elements; + const mtxOffset = itemIdx * Instanced2CCylindersGeometry_OFFSET_SIZE; + this._collisionGeo.setItem(itemIdx, botPos, topPos, itemRad); + Instanced2CCylindersGeometry_setArrayXYZW(this._matVector1, mtxOffset, me[0], me[4], me[8], me[12]); + Instanced2CCylindersGeometry_setArrayXYZW(this._matVector2, mtxOffset, me[1], me[5], me[9], me[13]); + Instanced2CCylindersGeometry_setArrayXYZW(this._matVector3, mtxOffset, me[2], me[6], me[10], me[14]); + if (this._useZSprites) { + invMatrix.copy(matrix).invert(); + me = invMatrix.elements; + Instanced2CCylindersGeometry_setArrayXYZW(this._invmatVector1, mtxOffset, me[0], me[4], me[8], me[12]); + Instanced2CCylindersGeometry_setArrayXYZW(this._invmatVector2, mtxOffset, me[1], me[5], me[9], me[13]); + Instanced2CCylindersGeometry_setArrayXYZW(this._invmatVector3, mtxOffset, me[2], me[6], me[10], me[14]); + } + } + setColor(itemIdx, colorVal1, colorVal2) { + const colorIdx = itemIdx * Instanced2CCylindersGeometry_COLOR_SIZE; + Instanced2CCylindersGeometry_tmpColor.set(colorVal1); + Instanced2CCylindersGeometry_setArrayXYZ(this._color1, colorIdx, Instanced2CCylindersGeometry_tmpColor.r, Instanced2CCylindersGeometry_tmpColor.g, Instanced2CCylindersGeometry_tmpColor.b); + Instanced2CCylindersGeometry_tmpColor.set(colorVal2); + Instanced2CCylindersGeometry_setArrayXYZ(this._color2, colorIdx, Instanced2CCylindersGeometry_tmpColor.r, Instanced2CCylindersGeometry_tmpColor.g, Instanced2CCylindersGeometry_tmpColor.b); + } + computeBoundingSphere() { + this._collisionGeo.computeBoundingSphere(); + this.boundingSphere = this._collisionGeo.boundingSphere; + } + computeBoundingBox() { + this._collisionGeo.computeBoundingBox(); + this.boundingBox = this._collisionGeo.boundingBox; + } + raycast(raycaster, intersects) { + this._collisionGeo.raycast(raycaster, intersects); + } + startUpdate() { + return true; + } + finishUpdate() { + this.getAttribute('matVector1').needsUpdate = true; + this.getAttribute('matVector2').needsUpdate = true; + this.getAttribute('matVector3').needsUpdate = true; + this.getAttribute('color').needsUpdate = true; + this.getAttribute('color2').needsUpdate = true; + this.getAttribute('alphaColor').needsUpdate = true; + if (this._useZSprites) { + this.getAttribute('invmatVector1').needsUpdate = true; + this.getAttribute('invmatVector2').needsUpdate = true; + this.getAttribute('invmatVector3').needsUpdate = true; + } + this._collisionGeo.finishUpdate(); + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + setOpacity(chunkIndices, value) { + const alphaArr = this._alpha; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + alphaArr[Math.floor(chunkIndices[i] / 2)] = value; + } + this.getAttribute('alphaColor').needsUpdate = true; + } + getSubset(chunkIndices) { + const info = _prepareCylinderInfo(chunkIndices); + const cylinderIndices = info.indices; + const instanceCount = cylinderIndices.length; + const geom = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferGeometry(); + this._init.call(geom, instanceCount, this._cylGeometry, this._useZSprites); + Instanced2CCylindersGeometry_copySubArrays(this._matVector1, geom._matVector1, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._matVector2, geom._matVector2, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._matVector3, geom._matVector3, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + if (this._useZSprites) { + Instanced2CCylindersGeometry_copySubArrays(this._invmatVector1, geom._invmatVector1, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._invmatVector2, geom._invmatVector2, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._invmatVector3, geom._invmatVector3, cylinderIndices, Instanced2CCylindersGeometry_OFFSET_SIZE); + } + Instanced2CCylindersGeometry_copySubArrays(this._color1, geom._color1, cylinderIndices, Instanced2CCylindersGeometry_COLOR_SIZE); + Instanced2CCylindersGeometry_copySubArrays(this._color2, geom._color2, cylinderIndices, Instanced2CCylindersGeometry_COLOR_SIZE); + _assignOpacity(info.cylinderInfo, geom._color1, geom._color2); + geom.boundingSphere = this.boundingSphere; + geom.boundingBox = this.boundingBox; + return [geom]; + } + getGeoParams() { + return this._cylGeometry.parameters; + } + _init(instanceCount, cylinderGeo, useZSprites) { + this.copy(cylinderGeo); + this._matVector1 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._matVector2 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._matVector3 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._color1 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_COLOR_SIZE); + this._color2 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_COLOR_SIZE); + const alpha = this._alpha = utils.allocateTyped(Float32Array, instanceCount); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].fill(alpha, 1.0); + this.setAttribute('matVector1', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._matVector1, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('matVector2', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._matVector2, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('matVector3', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._matVector3, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._color1, Instanced2CCylindersGeometry_COLOR_SIZE, false, 1)); + this.setAttribute('color2', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._color2, Instanced2CCylindersGeometry_COLOR_SIZE, false, 1)); + this.setAttribute('alphaColor', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._alpha, 1, false, 1)); + if (useZSprites) { + this._invmatVector1 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._invmatVector2 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this._invmatVector3 = utils.allocateTyped(Float32Array, instanceCount * Instanced2CCylindersGeometry_OFFSET_SIZE); + this.setAttribute('invmatVector1', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._invmatVector1, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('invmatVector2', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._invmatVector2, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + this.setAttribute('invmatVector3', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute(this._invmatVector3, Instanced2CCylindersGeometry_OFFSET_SIZE, false, 1)); + } + } +} +/* harmony default export */ const geometries_Instanced2CCylindersGeometry = (Instanced2CCylindersGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/ExtrudedObjectsGeometry.js - var molecules = this._source._molecules; - result.newTag('COMPND', true); - for (var i = 0; i < molecules.length; i++) { - var chains = this._getMoleculeChains(molecules[i]); - result.newString(); - result.writeString("MOL_ID: ".concat(molecules[i].index, ";"), 11, 80); - result.newString(); - result.writeString("MOLECULE: ".concat(molecules[i].name, ";"), 11, 80); - result.newString(); - result.writeString('CHAIN: ', 11, 18); - var chainsString = "".concat(chains.join(', '), ";"); - result.writeEntireString(chainsString, 81); +const ExtrudedObjectsGeometry_VEC_SIZE = 3; +const TRI_SIZE = 3; +const tmpPrev = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +const tmpNext = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +const tmpRes = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +const simpleNormal = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1.0, 0.0, 0.0); +const normalOnCut = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +const nearRingPt = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +function _createExtrudedChunkGeometry(shape, ringsCount) { + const geo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry(); + const ptsCount = shape.length; + const totalPts = ptsCount * ringsCount; + const type = totalPts <= 65536 ? Uint16Array : Uint32Array; + const facesPerChunk = (ringsCount - 1) * ptsCount * 2; + const indices = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(utils.allocateTyped(type, facesPerChunk * TRI_SIZE), 1); + let currVtxIdx = 0; + let currFaceIdx = 0; + for (let y = 0; y < ringsCount; y++) { + // faces + if (y !== ringsCount - 1) { + for (let i = 0; i < ptsCount; i++) { + const v1 = currVtxIdx + i; + const v2 = currVtxIdx + ptsCount + i; + const v3 = currVtxIdx + ptsCount + (i + 1) % ptsCount; + const v4 = currVtxIdx + (i + 1) % ptsCount; + indices.setXYZ(currFaceIdx * TRI_SIZE, v1, v4, v2); + currFaceIdx++; + indices.setXYZ(currFaceIdx * TRI_SIZE, v2, v4, v3); + currFaceIdx++; } } - }, { - key: "_extractREMARK", - value: function _extractREMARK(result) { - this._Remark290(result); - - this._Remark350(result); + currVtxIdx += ptsCount; + } + geo.setIndex(indices); + const pos = utils.allocateTyped(Float32Array, totalPts * ExtrudedObjectsGeometry_VEC_SIZE); + geo.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(pos, ExtrudedObjectsGeometry_VEC_SIZE)); + geo._positions = shape; + return geo; +} +class ExtrudedObjectsGeometry extends geometries_ChunkedObjectsGeometry { + constructor(shape, ringsCount, chunksCount) { + const chunkGeo = _createExtrudedChunkGeometry(shape, ringsCount); + super(chunkGeo, chunksCount); + this._ringsCount = ringsCount; + const tmpShape = this._tmpShape = []; + for (let i = 0; i < shape.length; ++i) { + tmpShape[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + } + } + setItem(itemIdx, matrices) { + let hasSlope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + let hasCut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + const ptsCount = this._chunkGeo._positions.length; + const ringsCount = this._ringsCount; + const chunkStartIdx = ptsCount * this._ringsCount * itemIdx * ExtrudedObjectsGeometry_VEC_SIZE; + this._setPoints(matrices, ptsCount, ringsCount, chunkStartIdx); + if (hasSlope) { + this._setSlopeNormals(ptsCount, ringsCount, chunkStartIdx); + } else { + this._setBaseNormals(ptsCount, ringsCount, chunkStartIdx); } - }, { - key: "_Remark290", - value: function _Remark290(result) { - if (!this._source.symmetry) { - return; - } - - if (this._source.symmetry.length !== 0) { - var matrices = this._source.symmetry; - result.newTag('REMARK', 290); - result.newString(); - result.newString(); - result.writeEntireString(this._stringForRemark290); - result.writeMatrices(matrices, 'SMTRY'); - result.newString(); - result.newString(); - result.writeString('REMARK: NULL', 11, 80); + if (hasCut) { + this._addCut(ptsCount, ringsCount, chunkStartIdx); + } + } + _setPoints(matrices, ptsCount, ringsCount, chunkStartIdx) { + const tmpShape = this._tmpShape; + const positions = this._positions; + const shape = this._chunkGeo._positions; + for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i) { + const mtx = matrices[i]; + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + tmpShape[j].copy(shape[j]).applyMatrix4(mtx).toArray(positions, vtxIdx); } } - }, { - key: "_Remark350", - value: function _Remark350(result) { - if (!this._source.units) { - return; + } + _setBaseNormals(ptsCount, ringsCount, chunkStartIdx) { + const nPtsInRing = ptsCount * ExtrudedObjectsGeometry_VEC_SIZE; + for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i, vtxIdx += nPtsInRing) { + this._countNormalsInRing(ptsCount, vtxIdx, false); + } + } + _setSlopeNormals(ptsCount, ringsCount, chunkStartIdx) { + const normals = this._normals; + const nPtsInRing = ptsCount * ExtrudedObjectsGeometry_VEC_SIZE; + let vtxIdx = chunkStartIdx; + // First ring + // In all cases, besides cut, second ring is coincident to first. So values of first ring's normals doesn't + // matter (In the cut case special handler will be applied later and will set them to correct values) + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + simpleNormal.toArray(normals, vtxIdx); + } + // second ring + // If it isn't first Item we take normals' values from the last ring of the previous item (these rings are coincident) + // else we count normals' values based on next ring information + if (vtxIdx - 2 * nPtsInRing > 0) { + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + tmpRes.fromArray(normals, vtxIdx - 2 * nPtsInRing).toArray(normals, vtxIdx); } - - var units = this._source.units; - var biomolIndx = 0; - result.newTag('REMARK', 350); - result.newString(); - result.newString(); - result.writeEntireString(this._stringForRemark350); - var assemblies = units.filter(function (unit) { - return unit instanceof Assembly; - }); - - for (var i = 0; i < assemblies.length; i++) { - result.newString(); - result.newString(); - biomolIndx++; - result.writeString("BIOMOLECULE: ".concat(biomolIndx), 11, 80); - var chains = assemblies[i].chains.join(', '); - result.newString(); - result.writeString('APPLY THE FOLLOWING TO CHAINS: '); - result.writeEntireString(chains, 69, { - tag: 'AND CHAINS: ', - begin: 31, - end: 42 - }); - var matrices = assemblies[i].matrices; - result.writeMatrices(matrices, 'BIOMT'); + } else { + this._countNormalsInRing(ptsCount, vtxIdx, true, +nPtsInRing); + vtxIdx += nPtsInRing; + } + // other rings + // we count normals' values based on previous ring information + for (let i = 2; i < ringsCount; ++i, vtxIdx += nPtsInRing) { + this._countNormalsInRing(ptsCount, vtxIdx, true, -nPtsInRing); + } + } + + // Counting normals: + // - Slope + // Radius changes throught part => normals aren't parallel with the plane contains section points + // normal = vTangentInSectionPlane x vToSuchPointInPrevSection (all vectors are scaled for being 1 in length) + // - No slope + // Radius doesn't change throught part => normals are parallel with the plane contains section points + // normal = vToPrevPointInSection + vToNextPointInSection (all vectors are scaled for being 1 in length) + _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) { + const tmpShape = this._tmpShape; + const normals = this._normals; + tmpShape[0].fromArray(this._positions, vtxIdx); + tmpShape[ptsCount - 1].fromArray(this._positions, vtxIdx + (ptsCount - 1) * ExtrudedObjectsGeometry_VEC_SIZE); + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + if (j < ptsCount - 1) { + tmpShape[j + 1].fromArray(this._positions, vtxIdx + ExtrudedObjectsGeometry_VEC_SIZE); + } + if (isSlope) { + nearRingPt.fromArray(this._positions, vtxIdx + shiftToExtraPt); + tmpPrev.subVectors(tmpShape[(j + ptsCount - 1) % ptsCount], tmpShape[(j + 1) % ptsCount]).normalize(); + tmpNext.subVectors(tmpShape[j], nearRingPt).normalize(); + tmpRes.crossVectors(tmpNext, tmpPrev).normalize().toArray(normals, vtxIdx); + } else { + tmpPrev.subVectors(tmpShape[j], tmpShape[(j + ptsCount - 1) % ptsCount]).normalize(); + tmpNext.subVectors(tmpShape[j], tmpShape[(j + 1) % ptsCount]).normalize(); + tmpRes.addVectors(tmpPrev, tmpNext).normalize().toArray(normals, vtxIdx); } } - }, { - key: "_getMoleculeChains", - value: function _getMoleculeChains(molecule) { - function getChainName(residue) { - return residue._chain._name; - } - - var chainNames = molecule.residues.map(getChainName); - return chainNames.filter(function (item, pos) { - return chainNames.indexOf(item) === pos; - }); + } + _addCut(ptsCount, ringsCount, chunkStartIdx) { + // Nothing to do if item is flat or only line + if (ptsCount < 3 || ringsCount < 2) { + return; } - }]); - - return PDBExporter; -}(Exporter); -PDBExporter.formats = ['pdb']; -PDBExporter.SourceClass = Complex; - -var FBX_POS_SIZE = 3; -var FBX_NORM_SIZE = 3; -var FBX_COL_SIZE = 4; - -function copyFbxPoint3(src, srcIdx, dst, dstIdx) { - dst[dstIdx] = src[srcIdx]; - dst[dstIdx + 1] = src[srcIdx + 1]; - dst[dstIdx + 2] = src[srcIdx + 2]; -} + const positions = this._positions; + const normals = this._normals; + const tmpShape = this._tmpShape; + const nPtsInRing = ptsCount * ExtrudedObjectsGeometry_VEC_SIZE; -function copyFbxPoint4(src, srcIdx, dst, dstIdx, value) { - dst[dstIdx] = src[srcIdx]; - dst[dstIdx + 1] = src[srcIdx + 1]; - dst[dstIdx + 2] = src[srcIdx + 2]; - dst[dstIdx + 3] = value; + // Normal to the cut plane is equal to cross product of two vectors which are lying in it + tmpShape[0].fromArray(positions, chunkStartIdx); + tmpShape[1].fromArray(positions, chunkStartIdx + ExtrudedObjectsGeometry_VEC_SIZE); + tmpShape[2].fromArray(positions, chunkStartIdx + 2 * ExtrudedObjectsGeometry_VEC_SIZE); + tmpPrev.subVectors(tmpShape[1], tmpShape[0]).normalize(); + tmpNext.subVectors(tmpShape[1], tmpShape[2]).normalize(); + normalOnCut.crossVectors(tmpPrev, tmpNext).normalize(); + let vtxIdx = chunkStartIdx; + // First and second rings normals' values are equal to value of normal to the cutting plane + for (let j = 0; j < ptsCount * 2; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + normalOnCut.toArray(normals, vtxIdx); + } + if (ringsCount > 2) { + // Third ring points are coincident to first ring points, but have different normals. It makes sharp angle near cut + for (let j = 0; j < ptsCount; ++j, vtxIdx += ExtrudedObjectsGeometry_VEC_SIZE) { + tmpRes.fromArray(positions, vtxIdx - nPtsInRing).toArray(positions, vtxIdx); + } + } + } } +/* harmony default export */ const geometries_ExtrudedObjectsGeometry = (ExtrudedObjectsGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/ThickLinesGeometry.js -var vector4 = new Vector4(); -function copyTransformedPoint3(src, srcIdx, dst, dstIdx, opts) { - vector4.set(src[srcIdx], src[srcIdx + 1], src[srcIdx + 2], opts.w); - vector4.applyMatrix4(opts.matrix); - dst[dstIdx] = vector4.x; - dst[dstIdx + 1] = vector4.y; - dst[dstIdx + 2] = vector4.z; + +const ThickLinesGeometry_MAX_IDC_16BIT = 65535; +const VERTEX_PER_SEGMENT = 4; +const POS_SIZE = 4; +const DIR_SIZE = 3; +const COL_SIZE = 3; +const ThickLinesGeometry_tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(); +const direction = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +function ThickLinesGeometry_setArrayXYZ(arr, idx, x, y, z) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; +} +function ThickLinesGeometry_setArrayXYZW(arr, idx, x, y, z, w) { + arr[idx] = x; + arr[idx + 1] = y; + arr[idx + 2] = z; + arr[idx + 3] = w; +} +function getSubset(arr, startSegmentIdx, segmentsCount, elemSize) { + const start = startSegmentIdx * VERTEX_PER_SEGMENT; + const end = start + segmentsCount * VERTEX_PER_SEGMENT; + return arr.subarray(start * elemSize, end * elemSize); } -function setSubArray(src, dst, count, copyFunctor, functorOpts) { - if ((dst.array.length - dst.start) / dst.stride < count || (src.array.length - src.start) / src.stride < count) { - return; // we've got no space +/** + * This class represents lines geometry which consists of screen-aligned narrow quad of variable width. + * + * @constructor + * + * @param {number} segmentsCount Number of segments per chunk. + * collision geometry. + */ + +class ThickLinesGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry { + constructor(segmentsCount) { + super(); + this._initVertices(segmentsCount); + } + startUpdate() { + return true; + } + finishUpdate() { + this.getAttribute('position').needsUpdate = true; + this.getAttribute('color').needsUpdate = true; + this.getAttribute('alphaColor').needsUpdate = true; + this.getAttribute('direction').needsUpdate = true; + } + setColor(segmentIdx, colorVal) { + ThickLinesGeometry_tmpColor.set(colorVal); + let idx = segmentIdx * VERTEX_PER_SEGMENT * COL_SIZE; + ThickLinesGeometry_setArrayXYZ(this._colors, idx, ThickLinesGeometry_tmpColor.r, ThickLinesGeometry_tmpColor.g, ThickLinesGeometry_tmpColor.b); + idx += COL_SIZE; + ThickLinesGeometry_setArrayXYZ(this._colors, idx, ThickLinesGeometry_tmpColor.r, ThickLinesGeometry_tmpColor.g, ThickLinesGeometry_tmpColor.b); + idx += COL_SIZE; + ThickLinesGeometry_setArrayXYZ(this._colors, idx, ThickLinesGeometry_tmpColor.r, ThickLinesGeometry_tmpColor.g, ThickLinesGeometry_tmpColor.b); + idx += COL_SIZE; + ThickLinesGeometry_setArrayXYZ(this._colors, idx, ThickLinesGeometry_tmpColor.r, ThickLinesGeometry_tmpColor.g, ThickLinesGeometry_tmpColor.b); + } + setSegment(segmentIdx, pos1, pos2) { + direction.subVectors(pos1, pos2); + direction.normalize(); + const positions = this._positions; + const directions = this._directions; + let idx = segmentIdx * VERTEX_PER_SEGMENT * POS_SIZE; + let dirIdx = segmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE; + ThickLinesGeometry_setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, 0.5); + ThickLinesGeometry_setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z); + idx += POS_SIZE; + dirIdx += DIR_SIZE; + ThickLinesGeometry_setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, -0.5); + ThickLinesGeometry_setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z); + idx += POS_SIZE; + dirIdx += DIR_SIZE; + ThickLinesGeometry_setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, 0.5); + ThickLinesGeometry_setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z); + idx += POS_SIZE; + dirIdx += DIR_SIZE; + ThickLinesGeometry_setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, -0.5); + ThickLinesGeometry_setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z); + } + setOpacity(startSegIdx, endSegIdx, value) { + const start = startSegIdx * VERTEX_PER_SEGMENT; + const end = endSegIdx * VERTEX_PER_SEGMENT; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].fill(this.alpha, value, end, start); + this.getAttribute('alphaColor').needsUpdate = true; + } + getSubsetSegments(startSegmentIdx, segmentsCount) { + return [getSubset(this._positions, startSegmentIdx, segmentsCount, POS_SIZE), getSubset(this._directions, startSegmentIdx, segmentsCount, DIR_SIZE)]; + } + getSubsetColors(startSegmentIdx, segmentsCount) { + return getSubset(this._colors, startSegmentIdx, segmentsCount, COL_SIZE); + } + getSubsetOpacities(startSegmentIdx, segmentsCount) { + return getSubset(this._alpha, startSegmentIdx, segmentsCount, 1); + } + getNumVertexPerSegment() { + return VERTEX_PER_SEGMENT; + } + getPositionSize() { + return POS_SIZE; + } + setSegments(startSegmentIdx, positions) { + const startPos = startSegmentIdx * VERTEX_PER_SEGMENT * POS_SIZE; + if (positions instanceof Array && positions.length === 2) { + this._positions.set(positions[0], startPos); + const startDir = startSegmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE; + this._directions.set(positions[1], startDir); // dirs are geo part of vertex + } else { + this._positions.set(positions, startPos); + } + } + setColors(startSegmentIdx, colors) { + const start = startSegmentIdx * VERTEX_PER_SEGMENT * COL_SIZE; + this._colors.set(colors, start); + } + _initVertices(segmentsCount) { + this._buffersSize = segmentsCount * VERTEX_PER_SEGMENT; + const pointsCount = this._buffersSize; + const use32bitIndex = pointsCount > ThickLinesGeometry_MAX_IDC_16BIT; + this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, segmentsCount * 6); + this._positions = utils.allocateTyped(Float32Array, pointsCount * POS_SIZE); + this._colors = utils.allocateTyped(Float32Array, pointsCount * COL_SIZE); + this._directions = utils.allocateTyped(Float32Array, pointsCount * DIR_SIZE); + const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].fill(alpha, 1.0); + const index = this._index; + let indexOffset = 0; + let pointOffset = 0; + for (let j = 0; j < segmentsCount; j++, indexOffset += 6, pointOffset += VERTEX_PER_SEGMENT) { + index[indexOffset] = pointOffset; + index[indexOffset + 1] = pointOffset + 1; + index[indexOffset + 2] = pointOffset + 3; + index[indexOffset + 3] = pointOffset; + index[indexOffset + 4] = pointOffset + 2; + index[indexOffset + 5] = pointOffset + 3; + } + this.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._index, 1)); + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._positions, POS_SIZE)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._colors, COL_SIZE)); + this.setAttribute('alphaColor', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(alpha, 1)); + this.setAttribute('direction', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._directions, DIR_SIZE)); } +} +/* harmony default export */ const geometries_ThickLinesGeometry = (ThickLinesGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/LinesGeometry.js - if (src.stride === dst.stride) { - // stride is the same - dst.array.set(src.array, dst.start); - } else { - var idx = dst.start; - var arridx = src.start; - for (var i = 0; i < count; ++i, idx += dst.stride, arridx += src.stride) { - copyFunctor(src.array, arridx, dst.array, idx, functorOpts); + +/** + * This class represents geometry which consists lines. This can build bounding volumes + * @constructor + * + * @param {number} segmentsCount Number of segments per chunk. + */ +class LinesGeometry extends geometries_ThickLinesGeometry { + startUpdate() { + return true; + } + computeBoundingSphere() { + const { + boundingBox + } = this; + // Build bounding sphere + let radiusSquared = 0.0; + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + if (boundingBox) { + boundingBox.getCenter(center); } + const positions = this._positions; + const sphere = this.boundingSphere || new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Sphere(); + const size = this._positions.length; + const pos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const posSize = this.getPositionSize(); + for (let i = 0; i < size; i += posSize) { + pos.set(positions[i], positions[i + 1], positions[i + 2]); + const lengthSquared = center.distanceToSquared(pos); + if (radiusSquared < lengthSquared) { + radiusSquared = lengthSquared; + } + } + sphere.set(center, Math.sqrt(radiusSquared)); + this.boundingSphere = sphere; + } + computeBoundingBox() { + const positions = this._positions; + const box = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(); + const size = this._positions.length; + const tmpVec = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const posSize = this.getPositionSize(); + for (let i = 0; i < size; i += posSize) { + tmpVec.set(positions[i], positions[i + 1], positions[i + 2]); + box.expandByPoint(tmpVec); + } + this.boundingBox = box; + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); } } - -var FBXModel = /*#__PURE__*/function () { - function FBXModel() { - classCallCheck(this, FBXModel); - - this.positions = null; - this.normals = null; - this.colors = null; - this.indices = null; - this.lastPos = 0; - this.lastNorm = 0; - this.lastCol = 0; - this.lastIdx = 0; +/* harmony default export */ const geometries_LinesGeometry = (LinesGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/CylinderCollisionGeo.js + + + + +const CylinderCollisionGeo_VEC_SIZE = 3; +const CylinderCollisionGeo_tmpVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +const CylinderCollisionGeo_normMtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix3(); +class CylinderCollisionGeo extends geometries_ChunkedObjectsGeometry { + constructor(instanceCount, polyComplexity) { + const cylGeometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true); + super(cylGeometry, instanceCount); + const chunkSize = this._chunkSize; + this._chunkPos = this._chunkGeo.attributes.position.array; + this._chunkNorms = this._chunkGeo.attributes.normal.array; + this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * CylinderCollisionGeo_VEC_SIZE); + } + setItem(itemIdx, botPos, topPos, itemRad) { + const chunkSize = this._chunkSize; + const itemOffset = chunkSize * itemIdx * CylinderCollisionGeo_VEC_SIZE; + const tmpArray = this._tmpVector; + const geoPos = this._chunkPos; + const geoNorm = this._chunkNorms; + const mtx1 = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad); + CylinderCollisionGeo_normMtx.getNormalMatrix(mtx1); + let idx; + for (let i = 0; i < chunkSize; ++i) { + idx = i * CylinderCollisionGeo_VEC_SIZE; + CylinderCollisionGeo_tmpVector.fromArray(geoPos, idx); + CylinderCollisionGeo_tmpVector.applyMatrix4(mtx1); + CylinderCollisionGeo_tmpVector.toArray(tmpArray, idx); + } + this._positions.set(tmpArray, itemOffset); + for (let i = 0; i < chunkSize; ++i) { + idx = i * CylinderCollisionGeo_VEC_SIZE; + CylinderCollisionGeo_tmpVector.fromArray(geoNorm, idx); + CylinderCollisionGeo_tmpVector.applyMatrix3(CylinderCollisionGeo_normMtx); + CylinderCollisionGeo_tmpVector.toArray(tmpArray, idx); + } + this._normals.set(tmpArray, itemOffset); } +} +/* harmony default export */ const geometries_CylinderCollisionGeo = (CylinderCollisionGeo); +;// CONCATENATED MODULE: ./src/gfx/geometries/ChunkedLinesGeometry.js - createClass(FBXModel, [{ - key: "init", - value: function init(vertsCount, indsCount) { - this.positions = new Float32Array(vertsCount * FBX_POS_SIZE); - this.normals = new Float32Array(vertsCount * FBX_NORM_SIZE); - this.colors = new Float32Array(vertsCount * FBX_COL_SIZE); - this.indices = new Int32Array(indsCount); - } - }, { - key: "setPositions", - value: function setPositions(array, start, count, stride) { - var src = { - array: array, - start: start, - stride: stride - }; - var dst = { - array: this.positions, - start: this.lastPos, - stride: FBX_POS_SIZE - }; - setSubArray(src, dst, count, copyFbxPoint3); - this.lastPos += count * FBX_POS_SIZE; - } - }, { - key: "setTransformedPositions", - value: function setTransformedPositions(array, start, count, stride, matrix) { - var idx = this.lastPos; - var arrIdx = start; - var opts = { - matrix: matrix, - w: 1 - }; - for (var i = 0; i < count; ++i, arrIdx += stride, idx += FBX_POS_SIZE) { - copyTransformedPoint3(array, arrIdx, this.positions, idx, opts); - } +const COLLISION_RAD = 0.1; - this.lastPos += count * FBX_POS_SIZE; +/** + * This class represents geometry which consists of separate chunks. + * Each chunk has same index and similar geometry with equal points and faces count. + * Each chunk has by default only one color. + * @constructor + * + * @param {number} chunksCount Total chunks count. + * @param {number} segmentsCount Number of segments per chunk. + * @param {boolean} enableCollision Enable or disable collision where each segment is + * a collidable cylinder. + * collision geometry. + */ +class ChunkedLinesGeometry extends geometries_LinesGeometry { + constructor(chunksCount, segmentsCount, enableCollision) { + super(chunksCount * segmentsCount); + this._init(segmentsCount); + this._collisionGeo = enableCollision ? new geometries_CylinderCollisionGeo(chunksCount * segmentsCount, 3) : null; + } + startUpdate() { + return true; + } + computeBoundingSphere() { + const collisionGeo = this._collisionGeo; + if (collisionGeo) { + collisionGeo.computeBoundingSphere(); + this.boundingSphere = collisionGeo.boundingSphere; + return; } - }, { - key: "setNormals", - value: function setNormals(array, start, count, stride) { - var src = { - array: array, - start: start, - stride: stride - }; - var dst = { - array: this.normals, - start: this.lastNorm, - stride: FBX_NORM_SIZE - }; - setSubArray(src, dst, count, copyFbxPoint3); - this.lastNorm += count * FBX_NORM_SIZE; + super.computeBoundingSphere(); + } + computeBoundingBox() { + const collisionGeo = this._collisionGeo; + if (collisionGeo) { + collisionGeo.computeBoundingBox(); + this.boundingBox = collisionGeo.boundingBox; + return; } - }, { - key: "setTransformedNormals", - value: function setTransformedNormals(array, start, count, stride, matrix) { - var idx = this.lastNorm; - var arrIdx = start; - var opts = { - matrix: matrix, - w: 0 - }; - - for (var i = 0; i < count; ++i, arrIdx += stride, idx += FBX_NORM_SIZE) { - copyTransformedPoint3(array, arrIdx, this.normals, idx, opts); - } - - this.lastNorm += count * FBX_NORM_SIZE; + super.computeBoundingBox(); + } + raycast(raycaster, intersects) { + const collisionGeo = this._collisionGeo; + if (!collisionGeo) { + return; } - }, { - key: "setColors", - value: function setColors(array, start, count, stride) { - var src = { - array: array, - start: start, - stride: stride - }; - var dst = { - array: this.colors, - start: this.lastCol, - stride: FBX_COL_SIZE - }; - setSubArray(src, dst, count, copyFbxPoint4, 1); - this.lastCol += count * FBX_COL_SIZE; + const segCount = this._chunkSize; + this._collisionGeo.raycast(raycaster, intersects); + for (let i = 0, n = intersects.length; i < n; ++i) { + let { + chunkIdx + } = intersects[i]; + if (chunkIdx === undefined) { + continue; + } + chunkIdx = chunkIdx / segCount | 0; + intersects[i].chunkIdx = chunkIdx; } - }, { - key: "setIndices", - value: function setIndices(array, start, count) { - this.indices.set(array, this.lastIdx); - this.lastIdx += count; + } + setColor(chunkIdx, colorVal) { + const chunkSize = this._chunkSize; + for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) { + super.setColor(i, colorVal); } - }, { - key: "setShiftedIndices", - value: function setShiftedIndices(array, count, shift) { - var shifted = array.map(function (x) { - return x + shift; - }); - this.setIndices(shifted, 0, count); + } + setSegment(chunkIdx, segIdx, pos1, pos2) { + const chunkSize = this._chunkSize; + const idx = chunkIdx * chunkSize + segIdx; + super.setSegment(idx, pos1, pos2); + if (this._collisionGeo) { + this._collisionGeo.setItem(chunkIdx * chunkSize + segIdx, pos1, pos2, COLLISION_RAD); } - }, { - key: "getVerticesNumber", - value: function getVerticesNumber() { - return this.lastPos / FBX_POS_SIZE; + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + setOpacity(chunkIndices, value) { + const chunkSize = this._chunkSize; + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const left = chunkIndices[i] * chunkSize; + super.setOpacity(left, left + chunkSize - 1, value); } - }, { - key: "addInstance", - value: function addInstance(matrix, geo) { - // add indices at first to take old number of vertices for shift - var currentCount = this.getVerticesNumber(); - this.setShiftedIndices(geo.indices, geo.indices.length, currentCount); // simply write vertices at empty space - - var size = geo.itemSize; - this.setTransformedPositions(geo.positions, 0, geo.vertsCount, size.position, matrix); - this.setTransformedNormals(geo.normals, 0, geo.vertsCount, size.normal, matrix); - this.setColors(geo.colors, 0, geo.vertsCount, size.color); + } + getSubset(chunkIndices) { + const instanceCount = chunkIndices.length; + const chunkSize = this._chunkSize; + const subset = new ChunkedLinesGeometry(instanceCount, chunkSize, false); + for (let i = 0, n = chunkIndices.length; i < n; ++i) { + const dstPtOffset = i * chunkSize; + const startSegIdx = chunkIndices[i] * chunkSize; + subset.setSegments(dstPtOffset, this.getSubsetSegments(startSegIdx, chunkSize)); + subset.setColors(dstPtOffset, this.getSubsetColors(startSegIdx, chunkSize)); } - }]); + subset.boundingSphere = this.boundingSphere; + subset.boundingBox = this.boundingBox; + return [subset]; + } + _init(chunkSize) { + this._chunkSize = chunkSize; + } +} +/* harmony default export */ const geometries_ChunkedLinesGeometry = (ChunkedLinesGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/TwoColorLinesGeometry.js - return FBXModel; -}(); -/** Base class for fbx geometry contains simply organized attributes: positions+normals+colors, indices. */ -var FBXGeometry = /*#__PURE__*/function () { - /** - * Create a base geo with necessary members. - */ - function FBXGeometry() { - classCallCheck(this, FBXGeometry); - this.positions = null; - this.normals = null; - this.colors = null; - this.indices = null; - this.vertsCount = 0; - this.itemSize = null; +const TwoColorLinesGeometry_COLLISION_RAD = 0.3; +const TwoColorLinesGeometry_tmpVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +class TwoColorLinesGeometry extends geometries_LinesGeometry { + constructor(segmentsCount) { + super(segmentsCount * 2); + this._init(segmentsCount); + this._collisionGeo = new geometries_Simple2CCylindersGeometry(segmentsCount, 3); } - /** - * Initialize base geo storing items info from attributes. - * @param {Object} geo - THREE.Geometry. - */ + setItem(itemIdx, botPos, topPos) { + this._collisionGeo.setItem(itemIdx, botPos, topPos, TwoColorLinesGeometry_COLLISION_RAD); + const offset = 2 * itemIdx; // there are two points per segment + TwoColorLinesGeometry_tmpVector.lerpVectors(botPos, topPos, 0.5); + super.setSegment(offset, botPos, TwoColorLinesGeometry_tmpVector); + super.setSegment(offset + 1, TwoColorLinesGeometry_tmpVector, topPos); + } + setColor(itemIdx, colorVal1, colorVal2) { + const offset = 2 * itemIdx; // there are two points per segment + super.setColor(offset, colorVal1); + super.setColor(offset + 1, colorVal2); + } + raycast(raycaster, intersects) { + if (this._collisionGeo) { + this._collisionGeo.raycast(raycaster, intersects); + } + } + getSubset(segmentIndices) { + const instanceCount = segmentIndices.length; + const subset = new TwoColorLinesGeometry(instanceCount, false); + for (let i = 0, n = instanceCount; i < n; ++i) { + const startSegIdx = segmentIndices[i]; + subset.setSegments(i, this.getSubsetSegments(startSegIdx, 1)); + subset.setColors(i, this.getSubsetColors(startSegIdx, 1)); + } + subset.boundingSphere = this.boundingSphere; + subset.boundingBox = this.boundingBox; + return [subset]; + } + _init(segmentsCount) { + this._segCounts = segmentsCount * 2; + } +} +// (???)parent = LinesGeometry.prototype; +/* harmony default export */ const geometries_TwoColorLinesGeometry = (TwoColorLinesGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/CrossGeometry.js - createClass(FBXGeometry, [{ - key: "init", - value: function init(geo, _info) { - var attributes = geo.attributes; // save item size - this.itemSize = { - position: attributes.position.itemSize, - normal: attributes.normal.itemSize, - color: attributes.color.itemSize - }; + +const vectors = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1, 0, 0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-1, 0, 0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 1, 0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, -1, 0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, -1)]; +const vecCount = vectors.length; +const tempPos1 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +const tempPos2 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); +class CrossGeometry extends geometries_SphereCollisionGeo(geometries_ChunkedLinesGeometry) { + constructor(chunksCount) { + super(chunksCount, chunksCount, vecCount / 2 | 0, false); + } + setItem(itemIdx, itemPos, itemRad) { + this.setSphere(itemIdx, itemPos, itemRad); + for (let i = 0; i < vecCount / 2; ++i) { + const first = i * 2; + tempPos1.x = itemPos.x + vectors[first].x * itemRad; + tempPos1.y = itemPos.y + vectors[first].y * itemRad; + tempPos1.z = itemPos.z + vectors[first].z * itemRad; + const second = first + 1; + tempPos2.x = itemPos.x + vectors[second].x * itemRad; + tempPos2.y = itemPos.y + vectors[second].y * itemRad; + tempPos2.z = itemPos.z + vectors[second].z * itemRad; + this.setSegment(itemIdx, i, tempPos1, tempPos2); } - }]); + } +} +/* harmony default export */ const geometries_CrossGeometry = (CrossGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurfaceGeometry.js - return FBXGeometry; -}(); + +const POS_RAD_SIZE = 4; +const IsoSurfaceGeometry_COLOR_SIZE = 3; +const IsoSurfaceGeometry_tmpColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(); /** - * Fbx geometry, that copies positions+normals, indexes and creates colors filled with defined value. - * @extends FBXGeometry + * This is a base class for isosurface algorithms. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor */ +class IsoSurfaceGeometry extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry { + constructor(spheresCount, opts) { + super(); + this._opts = opts; + this.zClip = this._opts.zClip; + this._posRad = utils.allocateTyped(Float32Array, spheresCount * POS_RAD_SIZE); + this._colors = utils.allocateTyped(Float32Array, spheresCount * IsoSurfaceGeometry_COLOR_SIZE); + } + setItem(chunkIdx, pos, radius) { + const posRad = this._posRad; + let idx = POS_RAD_SIZE * chunkIdx; + posRad[idx++] = pos.x; + posRad[idx++] = pos.y; + posRad[idx++] = pos.z; + posRad[idx] = radius; + } + setColor(chunkIdx, colorVal) { + IsoSurfaceGeometry_tmpColor.set(colorVal); + const colors = this._colors; + let idx = IsoSurfaceGeometry_COLOR_SIZE * chunkIdx; + colors[idx++] = IsoSurfaceGeometry_tmpColor.r; + colors[idx++] = IsoSurfaceGeometry_tmpColor.g; + colors[idx] = IsoSurfaceGeometry_tmpColor.b; + } + finalize() { + this.finishUpdate(); + this.computeBoundingSphere(); + } + finishUpdate() { + this._build(); + } + setOpacity() { + // not implemented + } + raycast() {} + getSubset() { + return []; + } +} +/* harmony default export */ const geometries_IsoSurfaceGeometry = (IsoSurfaceGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurfaceMarchCube.js -var FBX1CGeometry = /*#__PURE__*/function (_FBXGeometry) { - inherits(FBX1CGeometry, _FBXGeometry); - - function FBX1CGeometry() { - classCallCheck(this, FBX1CGeometry); - return possibleConstructorReturn(this, getPrototypeOf(FBX1CGeometry).apply(this, arguments)); +/** + * Class for marching cube + * Stores 8 points and 8 float values are stored together in linear array + * Int values for has intersection or not - in integer32 linear array + * Int values for bits flags - in integer32 linear array + * + */ +class IsoSurfaceMarchCube { + constructor() { + this.pointsValuesLinear = null; + this.hasIntersection = null; + this.bitsInside = null; + } + create(numCellsPerSide) { + const vx7000000 = 0x7000000; + const n3 = numCellsPerSide * numCellsPerSide * numCellsPerSide; + if (n3 > vx7000000) { + throw new Error('Too large cube dimension: lead to memory huge uasge'); + } + this.pointsValuesLinear = utils.allocateTyped(Float32Array, (2 << 2 + 2) * n3); + this.hasIntersection = utils.allocateTyped(Int32Array, n3); + this.bitsInside = utils.allocateTyped(Int32Array, n3); + return 0; + } + destroy() { + this.bitsInside = null; + this.hasIntersection = null; + this.pointsValuesLinear = null; } +} - createClass(FBX1CGeometry, [{ - key: "init", +/* eslint-disable no-magic-numbers */ +IsoSurfaceMarchCube.prototype.striIndicesMarchCube = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1, 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1, 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1, 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1, 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1, 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1, 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1, 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1, 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1, 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1, 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1, 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1, 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1, 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1, 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1, 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1, 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1, 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1, 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1, 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1, 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1, 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1, 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1, 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1, 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1, 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1, 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1, 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1, 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1, 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1, 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1, 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1, 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1, 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1, 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1, 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1, 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1, 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1, 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1, 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1, 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1, 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1, 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1, 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1, 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1, 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1, 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1, 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1, 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1, 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1, 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1, 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1, 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1, 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1, 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1, 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1, 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1, 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1, 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1, 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1, 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1, 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1, 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1, 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1, 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1, 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1, 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1, 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1, 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1, 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1, 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1, 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1, 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1, 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1, 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1, 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1, 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1, 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1, 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1, 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1, 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1, 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1, 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1, 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1, 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1, 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1, 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1, 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1, 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1, 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1, 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1, 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1, 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1, 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1, 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1, 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1, 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1, 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1, 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1, 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1, 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1, 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1, 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1, 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1, 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1, 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1, 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1, 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1, 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; +/* eslint-enable no-magic-numbers */ - /** - * Initialize geo storing positions, normals, indices and create colors. - * @param {Object} geo - THREE.Geometry. - */ - value: function init(geo, _info) { - get(getPrototypeOf(FBX1CGeometry.prototype), "init", this).call(this, geo, _info); +/* harmony default export */ const geometries_IsoSurfaceMarchCube = (IsoSurfaceMarchCube); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurface.js - var _geo$attributes = geo.attributes, - position = _geo$attributes.position, - normal = _geo$attributes.normal, - index = geo.index; // copy vertices attributes - this.vertsCount = position.count; - this.positions = position.array; - this.normals = normal.array; // create color array - this.colors = new Float32Array(this.vertsCount * this.itemSize.color); // indices +const edgeTable = [0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0]; +function _voxelGradientFast(v, point, grad) { + const g = v.getValue(point.x, point.y, point.z); + grad.set(g[0], g[1], g[2]); +} - this.indices = index.array; +// Helper class GridCell +class GridCell { + constructor() { + this._arrSize = 8; + this.p = new Array(this._arrSize); + this.g = new Array(this._arrSize); + this.val = new Array(this._arrSize); + for (let i = 0; i < this._arrSize; ++i) { + this.p[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this.g[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); } - /** - * Set defined color for all items in color attribute - * @param {Object} color - THREE.Color. - */ - - }, { - key: "setColors", - value: function setColors(color) { - var offset = 0; + this.cubeIndex = 0; + } +} - for (var i = 0, l = this.colors.length, cl = this.itemSize.color; i < l; i += cl) { - this.colors[offset++] = color.r; - this.colors[offset++] = color.g; - this.colors[offset++] = color.b; - } +// Helper class Triangle +class Triangle { + constructor() { + this.a = { + p: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(), + n: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3() + }; + this.b = { + p: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(), + n: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3() + }; + this.c = { + p: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(), + n: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3() + }; + } +} +function createArray(arrSize) { + const arr = new Array(arrSize); + for (let i = 0; i < arrSize; ++i) { + arr[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + } + return arr; +} +class IsoSurface { + constructor() { + this._numTriangles = 0; + this._numVertices = 0; + this._position = []; + this._normals = []; + this._colors = null; + this._indices = []; + this._volumetricData = null; + this._xAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._yAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._zAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._xDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._yDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._zDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + } + _prepareAxesAndDirs() { + const volData = this._volumetricData; + const cellSize = volData.getCellSize(); + + // calculate cell axes + const xAxis = this._xAxis; + const yAxis = this._yAxis; + const zAxis = this._zAxis; + const xDir = this._xDir; + const yDir = this._yDir; + const zDir = this._zDir; + xAxis.set(cellSize.x, 0, 0); + yAxis.set(0, cellSize.y, 0); + zAxis.set(0, 0, cellSize.z); + xDir.set(1, 0, 0); + yDir.set(0, 1, 0); + zDir.set(0, 0, 1); + + // flip normals if coordinate system is in the wrong handedness + const tmp = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + tmp.crossVectors(xDir, yDir); + if (tmp.dot(zDir) < 0) { + xDir.negate(); + yDir.negate(); + zDir.negate(); + } + + // check that the grid is in the all-positive octant of the coordinate system + if (xDir.x < 0 || xDir.y < 0 || xDir.z < 0 || yDir.x < 0 || yDir.y < 0 || yDir.z < 0 || zDir.x < 0 || zDir.y < 0 || zDir.z < 0) { + return false; } - }]); - - return FBX1CGeometry; -}(FBXGeometry); - -/** - * Fbx geometry, that copies positions+normals, indexes from cylinder geometry and creates colors filled with two - * defined values. - * @extends FBXGeometry - */ -var FBX2CCylinder = /*#__PURE__*/function (_FBXGeometry) { - inherits(FBX2CCylinder, _FBXGeometry); - - function FBX2CCylinder() { - var _this; + // check that the grid is axis-aligned + const notZero = axe => Math.abs(axe) > Number.EPSILON; + return !(notZero(xAxis.y) || notZero(xAxis.z) || notZero(yAxis.x) || notZero(yAxis.z) || notZero(zAxis.x) || notZero(zAxis.y)); + } + _vertexInterp(isoLevel, grid, ind1, ind2, vertex, normal) { + const p1 = grid.p[ind1]; + const p2 = grid.p[ind2]; + const n1 = grid.g[ind1]; + const n2 = grid.g[ind2]; + const valP1 = grid.val[ind1]; + const valP2 = grid.val[ind2]; + const isoDiffP1 = isoLevel - valP1; + const diffValP2P1 = valP2 - valP1; + let mu = 0.0; + if (Math.abs(diffValP2P1) > 0.0) { + mu = isoDiffP1 / diffValP2P1; + } + mu = mu > 1.0 ? 1.0 : mu; + vertex.lerpVectors(p1, p2, mu); + normal.lerpVectors(n1, n2, mu); + } + static _triTable = (() => geometries_IsoSurfaceMarchCube.prototype.striIndicesMarchCube)(); + static _arrSize = 12; + static _firstIndices = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3]; + static _secondIndices = [1, 2, 3, 0, 5, 6, 7, 4, 4, 5, 6, 7]; + static _vertexList = (() => createArray(IsoSurface._arrSize))(); + static _normalList = (() => createArray(IsoSurface._arrSize))(); + _polygonize(grid, isoLevel, triangles) { + const { + cubeIndex + } = grid; + let i = 0; + const arrSize = IsoSurface._arrSize; + const firstIndices = IsoSurface._firstIndices; + const secondIndices = IsoSurface._secondIndices; + const vertexList = IsoSurface._vertexList; + const normalList = IsoSurface._normalList; + for (; i < arrSize; ++i) { + if (edgeTable[cubeIndex] & 1 << i) { + this._vertexInterp(isoLevel, grid, firstIndices[i], secondIndices[i], vertexList[i], normalList[i]); + } + } + let triCount = 0; + const triTblIdx = cubeIndex * 16; + const triTable = IsoSurface._triTable; + for (i = 0; triTable[triTblIdx + i] !== -1; i += 3) { + triangles[triCount].a.p.copy(vertexList[triTable[triTblIdx + i]]); + triangles[triCount].a.n.copy(normalList[triTable[triTblIdx + i]]); + triangles[triCount].b.p.copy(vertexList[triTable[triTblIdx + i + 1]]); + triangles[triCount].b.n.copy(normalList[triTable[triTblIdx + i + 1]]); + triangles[triCount].c.p.copy(vertexList[triTable[triTblIdx + i + 2]]); + triangles[triCount].c.n.copy(normalList[triTable[triTblIdx + i + 2]]); + ++triCount; + } + return triCount; + } + _doGridPosNorms(isoValue, step, appendSimple) { + const vol = this._volumetricData; + const volData = this._volumetricData.getData(); + const dim = vol.getDimensions(); + const xSize = dim[0]; + const ySize = dim[1]; + const zSize = dim[2]; + const stepX = step * vol.getStrideX(); + const stepY = step * vol.getStrideY(); + const stepZ = step * vol.getStrideZ(); + const gc = new GridCell(); + const gcVal = gc.val; + const gcValSize = gc.val.length; + const additions = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0), + // 0 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(step, 0, 0), + // 1 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(step, step, 0), + // 2 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, step, 0), + // 3 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, step), + // 4 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(step, 0, step), + // 5 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(step, step, step), + // 6 + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, step, step) // 7 + ]; + const tmpTriCount = 5; + const triangles = new Array(tmpTriCount); + for (let j = 0; j < tmpTriCount; ++j) { + triangles[j] = new Triangle(); + } + let appendVertex; + const self = this; + const positions = this._position; + const normals = this._normals; + if (appendSimple) { + // Special case for axis-aligned grid with positive unit vector normals + appendVertex = function () { + const axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(self._xAxis.x, self._yAxis.y, self._zAxis.z); + return function (triVertex) { + const vertex = triVertex.p.clone(); + vertex.multiply(axis); + positions.push(vertex.add(self._origin)); + normals.push(triVertex.n.clone()); + }; + }(); + } else { + appendVertex = function () { + const posMtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix3(); + posMtx.set(self._xAxis.x, self._yAxis.x, self._zAxis.x, self._xAxis.y, self._yAxis.y, self._zAxis.y, self._xAxis.z, self._yAxis.z, self._zAxis.z); + const normMtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix3(); + normMtx.set(self._xDir.x, self._yDir.x, self._zDir.x, self._xDir.y, self._yDir.y, self._zDir.y, self._xDir.z, self._yDir.z, self._zDir.z); + return function (triVertex) { + positions.push(triVertex.p.clone().applyMatrix3(posMtx).add(self._origin)); + normals.push(triVertex.n.clone().applyMatrix3(normMtx)); + }; + }(); + } + const indices = this._indices; + let globTriCount = 0; + for (let z = 0; z < zSize - step; z += step) { + for (let y = 0; y < ySize - step; y += step) { + let idx = vol.getDirectIdx(0, y, z); + for (let x = 0; x < xSize - step; x += step, idx += stepX) { + /* eslint-disable no-multi-spaces */ + /* eslint-disable computed-property-spacing */ + gcVal[0] = volData[idx]; + gcVal[1] = volData[idx + stepX]; + gcVal[3] = volData[idx + stepY]; + gcVal[2] = volData[idx + stepX + stepY]; + gcVal[4] = volData[idx + stepZ]; + gcVal[5] = volData[idx + stepX + stepZ]; + gcVal[7] = volData[idx + stepY + stepZ]; + gcVal[6] = volData[idx + stepX + stepY + stepZ]; + /* eslint-enable no-multi-spaces */ + /* eslint-enable computed-property-spacing */ + + // Determine the index into the edge table which + // tells us which vertices are inside of the surface + let cubeIndex = 0; + let i = 0; + for (; i < gcValSize; ++i) { + if (gcVal[i] < isoValue) { + cubeIndex |= 1 << i; + } + } + if (edgeTable[cubeIndex] === 0) { + continue; + } + gc.cubeIndex = cubeIndex; + for (i = 0; i < gcValSize; ++i) { + gc.p[i].set(x + additions[i].x, y + additions[i].y, z + additions[i].z); + _voxelGradientFast(this._gradient, gc.p[i], gc.g[i]); + } - classCallCheck(this, FBX2CCylinder); + // calculate vertices and facets for this cube, + // calculate normals by interpolating between the negated + // normalized volume gradients for the 8 reference voxels + const triCount = this._polygonize(gc, isoValue, triangles); + globTriCount += triCount; + + // append triangles using different techniques + for (i = 0; i < triCount; ++i) { + indices.push(this._numTriangles * 3); + indices.push(this._numTriangles * 3 + 1); + indices.push(this._numTriangles * 3 + 2); + ++this._numTriangles; + appendVertex(triangles[i].a); + appendVertex(triangles[i].b); + appendVertex(triangles[i].c); + } + } + } + } + return globTriCount; + } + compute(volData, origin, isoValue, step) { + this._volumetricData = volData; + this._origin = origin; + this._gradient = volData.computeGradient(); + this._doGridPosNorms(isoValue, step, this._prepareAxesAndDirs()); + } + _remapIndices(vertexMap, idcCount) { + const indices = this._indices; + const newIndices = utils.allocateTyped(Uint32Array, idcCount); + for (let i = 0; i < idcCount; ++i) { + indices[i] = vertexMap[indices[i]]; + newIndices[i] = indices[i]; + } + this._indices = newIndices; + } + _remapVertices(vertices, normals, count) { + const newPositions = utils.allocateTyped(Float32Array, count * 3); + const newNormals = utils.allocateTyped(Float32Array, count * 3); + for (let i = 0; i < count; ++i) { + const pos = vertices[i]; + newPositions[i * 3] = pos.x; + newPositions[i * 3 + 1] = pos.y; + newPositions[i * 3 + 2] = pos.z; + const norm = normals[i].normalize(); + newNormals[i * 3] = norm.x; + newNormals[i * 3 + 1] = norm.y; + newNormals[i * 3 + 2] = norm.z; + } + this._position = newPositions; + this._normals = newNormals; + } + vertexFusion(offset, len) { + const faceVer = this._indices.length; + const vertices = this._position; + const normals = this._normals; + const oldVerCount = vertices.length | 0; + if (faceVer === 0 || oldVerCount === 0) { + return; + } + const vMap = utils.allocateTyped(Uint32Array, oldVerCount); + vMap[0] = 0; + let newVer = 1; + let i = 1; + for (; i < oldVerCount; ++i) { + const start = newVer - offset < 0 ? 0 : newVer - offset; + const end = start + len > newVer ? newVer : start + len; + let matchedIndex = -1; + for (let j = start; j < end; ++j) { + if (Math.abs(vertices[i] - vertices[j]) < Number.EPSILON) { + matchedIndex = j; + break; + } + } + if (matchedIndex !== -1) { + vMap[i] = matchedIndex; + } else { + vertices[newVer].copy(vertices[i]); + normals[newVer].copy(normals[i]); + vMap[i] = newVer; + ++newVer; + } + } + this._remapIndices(vMap, faceVer); + this._remapVertices(vertices, normals, newVer); + } + + // Assign per-vertex colors from a volumetric texture map (same dimensions as the original volumetric data). + // Along with color dominating atom is determined for each vertex + // and vertices with atom out of "visible" subset get filtered out. + // XXX only handles orthogonal volumes currently + setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) { + let i; + let idx; + const numVerts = this._position.length / 3; + const vertices = this._position; + const origin = this._origin; + const dim = this._volumetricData.getDimensions(); + const xs = dim[0] - 1; + const ys = dim[1] - 1; + const zs = dim[2] - 1; + const colorData = colorMap.getData(); + const strideX = colorMap.getStrideX(); + const strideY = colorMap.getStrideY(); + const strideZ = colorMap.getStrideZ(); + let atomWeightData; + let atomStrideX; + let atomStrideY; + let atomStrideZ; + if (visibilitySelector !== null) { + atomWeightData = atomWeightMap.getData(); + atomStrideX = atomWeightMap.getStrideX(); + atomStrideY = atomWeightMap.getStrideY(); + atomStrideZ = atomWeightMap.getStrideZ(); + } + const xInv = 1.0 / this._xAxis.x; + const yInv = 1.0 / this._yAxis.y; + const zInv = 1.0 / this._zAxis.z; + let atomLookup = []; + let atomWeights = []; + const colors = utils.allocateTyped(Float32Array, numVerts * 3); + function interp(mu, idx1, idx2, c) { + c[0] = (1 - mu) * colorData[idx1] + mu * colorData[idx2]; + c[1] = (1 - mu) * colorData[idx1 + 1] + mu * colorData[idx2 + 1]; + c[2] = (1 - mu) * colorData[idx1 + 2] + mu * colorData[idx2 + 2]; + } + function collectWeight(ai, coefX, coefY, coefZ) { + const a = atomMap[ai]; // atomWeightMap is a scalar field, so index into atom map should be the same + if (a != null) { + atomLookup[a.index] = a; + const w = coefX * coefY * coefZ * atomWeightData[ai]; + if (typeof atomWeights[a.index] === 'undefined') { + atomWeights[a.index] = w; + } else { + atomWeights[a.index] += w; + } + } + } + const vMap = utils.allocateTyped(Int32Array, numVerts); + let newVerCount = 0; + for (i = 0; i < numVerts; i++) { + const ind = i * 3; + const vx = (vertices[ind] - origin.x) * xInv; + const vy = (vertices[ind + 1] - origin.y) * yInv; + const vz = (vertices[ind + 2] - origin.z) * zInv; + const x = Math.min(Math.max(vx, 0), xs) | 0; + const y = Math.min(Math.max(vy, 0), ys) | 0; + const z = Math.min(Math.max(vz, 0), zs) | 0; + const mux = vx - x; + const muy = vy - y; + const muz = vz - z; + if (visibilitySelector != null) { + // collect atom weights + atomLookup = []; + atomWeights = []; + idx = atomWeightMap.getDirectIdx(x, y, z); + collectWeight(idx, 1 - mux, 1 - muy, 1 - muz); + collectWeight(idx + atomStrideX, mux, 1 - muy, 1 - muz); + collectWeight(idx + atomStrideY, 1 - mux, muy, 1 - muz); + collectWeight(idx + atomStrideX + atomStrideY, mux, muy, 1 - muz); + collectWeight(idx + atomStrideZ, 1 - mux, 1 - muy, muz); + collectWeight(idx + atomStrideX + atomStrideZ, mux, 1 - muy, muz); + collectWeight(idx + atomStrideY + atomStrideZ, 1 - mux, muy, muz); + collectWeight(idx + atomStrideX + atomStrideY + atomStrideZ, mux, muy, muz); + + // find dominant atom + let maxWeight = 0.0; + let dominantIdx = -1; + for (const atomIdx in atomWeights) { + if (atomWeights[atomIdx] > maxWeight) { + dominantIdx = atomIdx; + maxWeight = atomWeights[atomIdx]; + } + } + if (dominantIdx < 0 || !visibilitySelector.includesAtom(atomLookup[dominantIdx])) { + // this vertex doesn't belong to visible subset and will be skipped + vMap[i] = -1; + continue; + } + } + vMap[i] = newVerCount++; + + // color tri-linear interpolation + const dx = x < xs ? strideX : 0; + const dy = y < ys ? strideY : 0; + const dz = z < zs ? strideZ : 0; + const c0 = [0, 0, 0]; + const c1 = [0, 0, 0]; + const c2 = [0, 0, 0]; + const c3 = [0, 0, 0]; + idx = colorMap.getDirectIdx(x, y, z); + interp(mux, idx, idx + dx, c0); + interp(mux, idx + dy, idx + dx + dy, c1); + interp(mux, idx + dz, idx + dx + dz, c2); + interp(mux, idx + dy + dz, idx + dx + dy + dz, c3); + const cz0 = [0, 0, 0]; + cz0[0] = (1 - muy) * c0[0] + muy * c1[0]; + cz0[1] = (1 - muy) * c0[1] + muy * c1[1]; + cz0[2] = (1 - muy) * c0[2] + muy * c1[2]; + const cz1 = [0, 0, 0]; + cz1[0] = (1 - muy) * c2[0] + muy * c3[0]; + cz1[1] = (1 - muy) * c2[1] + muy * c3[1]; + cz1[2] = (1 - muy) * c2[2] + muy * c3[2]; + colors[ind] = (1 - muz) * cz0[0] + muz * cz1[0]; + colors[ind + 1] = (1 - muz) * cz0[1] + muz * cz1[1]; + colors[ind + 2] = (1 - muz) * cz0[2] + muz * cz1[2]; + } + this._colors = colors; + if (visibilitySelector != null) { + // shift visible vertices towards beginning of array + for (i = 0; i < numVerts; ++i) { + const j = vMap[i]; + if (j < 0) { + continue; + } - _this = possibleConstructorReturn(this, getPrototypeOf(FBX2CCylinder).call(this)); - _this._cutRawStart = 0; - _this._cutRawEnd = 0; - _this._facesPerSlice = 0; - return _this; + // assert: j <= i + this._position[j * 3] = this._position[i * 3]; + this._position[j * 3 + 1] = this._position[i * 3 + 1]; + this._position[j * 3 + 2] = this._position[i * 3 + 2]; + this._normals[j * 3] = this._normals[i * 3]; + this._normals[j * 3 + 1] = this._normals[i * 3 + 1]; + this._normals[j * 3 + 2] = this._normals[i * 3 + 2]; + this._colors[j * 3] = this._colors[i * 3]; + this._colors[j * 3 + 1] = this._colors[i * 3 + 1]; + this._colors[j * 3 + 2] = this._colors[i * 3 + 2]; + } + + // rebuild index list + const numTriangles = this._indices.length / 3; + let newTriCount = 0; + for (i = 0; i < numTriangles; ++i) { + const i0 = vMap[this._indices[3 * i]]; + const i1 = vMap[this._indices[3 * i + 1]]; + const i2 = vMap[this._indices[3 * i + 2]]; + if (i0 >= 0 && i1 >= 0 && i2 >= 0) { + this._indices[3 * newTriCount] = i0; + this._indices[3 * newTriCount + 1] = i1; + this._indices[3 * newTriCount + 2] = i2; + ++newTriCount; + } + } + + // shrink arrays to data size + this._position = new Float32Array(this._position.buffer.slice(0, newVerCount * 3 * 4)); + this._normals = new Float32Array(this._normals.buffer.slice(0, newVerCount * 3 * 4)); + this._colors = new Float32Array(this._colors.buffer.slice(0, newVerCount * 3 * 4)); + this._indices = new Uint32Array(this._indices.buffer.slice(0, newTriCount * 3 * 4)); + } + } + toMesh() { + const geo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry(); + geo.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._indices, 1)); + geo.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._position, 3)); + geo.setAttribute('normal', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._normals, 3)); + geo.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(this._colors, 3)); + geo.computeBoundingSphere(); + return geo; } - /** - * Initialize geo by creating new attributes, because we extend number of vertices to make cylinder two-colored. - * Indices remain the same. We process open- end close-ended cylinders and consider cylinders od 2 segments - * in height ONLY. - * NOTE: cylinder consists of 2 height segments and stores parts in the order: tube, topCap, bottomCap - * @param {Object} geo - THREE.Geometry. - * @param {Object} info - information needed for geo extend - */ - - - createClass(FBX2CCylinder, [{ - key: "init", - value: function init(geo, info) { - get(getPrototypeOf(FBX2CCylinder.prototype), "init", this).call(this, geo, info); - - var position = geo.attributes.position, - index = geo.index; // extend vertices arrays - - this.vertsCount = position.count + info.addPerCylinder; - this._facesPerSlice = info.addPerCylinder; - this.positions = new Float32Array(this.vertsCount * position.itemSize); - this.normals = new Float32Array(this.vertsCount * this.itemSize.normal); - this.colors = new Float32Array(this.vertsCount * this.itemSize.color); +} +/* harmony default export */ const geometries_IsoSurface = (IsoSurface); +;// CONCATENATED MODULE: ./src/gfx/geometries/VolumeSurfaceGeometry.js - this._extendVertices(geo, info); // number of indices stays the same - this.indices = new Uint32Array(index.count); - this._extendIndices(geo, info); - } - /** Extend vertex attributes to have one more slice to make sharp middle startColor-endColor line. */ - }, { - key: "_extendVertices", - value: function _extendVertices(geo, info) { - var position = geo.attributes.position; - var normal = geo.attributes.normal; - var geoParams = geo.getGeoParams(); - var cutRaw = 1; // we expect cylinders of 2 segments in height => so half segment = 1 - - this._cutRawStart = cutRaw * geoParams.radialSegments; - this._cutRawEnd = this._cutRawStart + info.addPerCylinder; - { - // write first half of cylinder - var temp = position.array.slice(0, this._cutRawEnd * position.itemSize); - this.positions.set(temp, 0); - temp = normal.array.slice(0, this._cutRawEnd * normal.itemSize); - this.normals.set(temp, 0); - } - { - // write second part of cylinder - var _temp = position.array.slice(this._cutRawStart * position.itemSize, position.array.length); +/** + * This is a base class for volumetric maps based isosurface algorithms. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor + */ - this.positions.set(_temp, this._cutRawEnd * position.itemSize); - _temp = normal.array.slice(this._cutRawStart * normal.itemSize, normal.array.length); - this.normals.set(_temp, this._cutRawEnd * normal.itemSize); +class VolumeSurfaceGeometry extends geometries_IsoSurfaceGeometry { + _build() { + const params = this._opts; + this.numVoxels = [128, 128, 128]; + this.xAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1.0, 0.0, 0.0); + this.yAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 1.0, 0.0); + this.zAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 1.0); + this.origin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0); + this._visibilitySelector = params.visibilitySelector; + this._calcSurface(params); + } + _findMinMax(posRadArray) { + const itemSize = 4; + const itemsCount = posRadArray.length / itemSize; + const maxPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]]; + const minPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]]; + for (let i = 1; i < itemsCount; ++i) { + const ind = i * itemSize; + for (let itemIdx = 0; itemIdx < itemSize; ++itemIdx) { + const tmpVal = posRadArray[ind + itemIdx]; + maxPosRad[itemIdx] = Math.max(tmpVal, maxPosRad[itemIdx]); + minPosRad[itemIdx] = Math.min(tmpVal, minPosRad[itemIdx]); } } - /** Shift values of second part (+caps) indices by newly added vertices count. Number of faces remains the same. */ - - }, { - key: "_extendIndices", - value: function _extendIndices(geo, info) { - var index = geo.index; - var indicesPerQuad = 6; // quad = 2 triangles => 6 indices - - var startToShift = info.addPerCylinder * indicesPerQuad; - var shift = info.addPerCylinder; - var shifted = index.array.slice(startToShift, index.count); - shifted = shifted.map(function (x) { - return x + shift; - }); // shift only the endings - - this.indices.set(index.array, 0); - this.indices.set(shifted, startToShift); + return { + maxPosRad, + minPosRad + }; + } + _findNumVoxels(posRadArray, params) { + const { + numVoxels + } = this; + const minMaxValues = this._findMinMax(posRadArray); + const minCoordRad = minMaxValues.minPosRad; + const maxCoordRad = minMaxValues.maxPosRad; + + // minrad + if (minCoordRad[3] > 4.0) { + params.gridSpacing *= minCoordRad[3]; + } + let gridPadding = params.radScale * maxCoordRad[3] * 1.7; + let padRad = gridPadding; + padRad = 0.65 * Math.sqrt(4.0 / 3.0 * Math.PI * padRad * padRad * padRad); + gridPadding = Math.max(gridPadding, padRad); + let i = 0; + for (; i < 3; ++i) { + minCoordRad[i] -= gridPadding; + maxCoordRad[i] += gridPadding; + } + for (i = 0; i < 3; ++i) { + numVoxels[i] = Math.ceil((maxCoordRad[i] - minCoordRad[i]) / params.gridSpacing); + } + this.xAxis.x = (numVoxels[0] - 1) * params.gridSpacing; + this.yAxis.y = (numVoxels[1] - 1) * params.gridSpacing; + this.zAxis.z = (numVoxels[2] - 1) * params.gridSpacing; + [this.origin.x, this.origin.y, this.origin.z] = minCoordRad; + return { + bbox: minMaxValues, + dim: numVoxels + }; + } + _makeSurface(surface, params) { + const isoSurf = new geometries_IsoSurface(); + isoSurf.compute(surface.volMap, this.origin, params.isoValue, 1); + isoSurf.vertexFusion(9, 9); // normalization is included + + if (isoSurf._numTriangles > 0) { + isoSurf.setColorVolTex(surface.volTexMap, surface.atomMap, surface.atomWeightMap, this._visibilitySelector); + this.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(isoSurf._indices, 1)); + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(isoSurf._position, 3)); + this.setAttribute('normal', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(isoSurf._normals, 3)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(isoSurf._colors, 3)); + } else { + // geometry should have at least empty position attributes to be processed in wireframe mode by three.js + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(utils.allocateTyped(Float32Array, 0), 3)); } - /** - * Set defined colors: (first part + bottom cap), (second part + top cap) - * @param {number} start - start color index - * @param {number} end - start color index - * @param {array} array - array of colors - * @param {array} color - color value components - */ - - }, { - key: "_setColorRange", - value: function _setColorRange(start, end, array, color) { - var colorSize = color.length; - - for (var i = start; i < end; i += colorSize) { - array.set(color, i); - } + } + _calcSurface(params) { + const packedArrays = { + posRad: this._posRad, + colors: this._colors, + atoms: this._opts.atoms + }; + if (packedArrays.posRad.length === 0) { + return; } - /** - * Set defined colors: (first part + bottom cap), (second part + top cap) - * @param {Object} color1 - THREE.Color. - * @param {Object} color2 - THREE.Color. - */ - - }, { - key: "setColors", - value: function setColors(color1, color2) { - var colorSize = this.itemSize.color; - var part1End = this._cutRawEnd * colorSize; - var part2End = part1End * 2; - - this._setColorRange(0, part1End, this.colors, color1.toArray()); - - this._setColorRange(part1End, part2End, this.colors, color2.toArray()); + const boundaries = this._findNumVoxels(packedArrays.posRad, params); + const box = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(this.origin, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(this.xAxis.x, this.yAxis.y, this.zAxis.z).add(this.origin)); + const surface = this._computeSurface(packedArrays, box, boundaries, params); + this._makeSurface(surface, params); + } +} +/* harmony default export */ const geometries_VolumeSurfaceGeometry = (VolumeSurfaceGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/QuickSurfGeometry.js - if (part2End < this.colors.length) { - // cylinder has caps, lets paint them - var capSize = (this._facesPerSlice + 1) * colorSize; - var cap1End = part2End + capSize; - this._setColorRange(part2End, cap1End, this.colors, color2.toArray()); +const { + Volume: QuickSurfGeometry_Volume +} = chem; - var cap2End = cap1End + capSize; // should be equal to this.colors.length; +/** + * This class implements 'quick' isosurface geometry generation algorithm. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor + */ - this._setColorRange(cap1End, cap2End, this.colors, color1.toArray()); +class QuickSurfGeometry extends geometries_VolumeSurfaceGeometry { + _computeSurface(packedArrays, box, boundaries, params) { + // beware of shifting this multiple times! + this._shiftByOrigin(packedArrays.posRad); + const surface = { + volMap: new QuickSurfGeometry_Volume(Float32Array, this.numVoxels, box), + volTexMap: new QuickSurfGeometry_Volume(Float32Array, this.numVoxels, box, 3) + }; + if (this._visibilitySelector != null) { + surface.atomMap = []; + surface.atomWeightMap = new QuickSurfGeometry_Volume(Float32Array, this.numVoxels, box); + } + this.gaussdensity(surface, packedArrays, null, params); + return surface; + } + gaussdensity(surface, packedArrays, atomicNum, params) { + const numAtoms = packedArrays.posRad.length / 4; + const { + posRad, + colors + } = packedArrays; + const { + numVoxels + } = this; + const { + radScale, + gaussLim, + gridSpacing + } = params; + const invIsoValue = 1.0 / params.isoValue; + const invGridSpacing = 1.0 / gridSpacing; + const maxVoxelX = numVoxels[0] - 1; + const maxVoxelY = numVoxels[1] - 1; + const maxVoxelZ = numVoxels[2] - 1; + // TODO is densityMap and volTexMap initialized? + + const { + volMap, + volTexMap + } = surface; + const volData = volMap.getData(); + const strideX = volMap.getStrideX(); + const volTexData = volTexMap.getData(); + const texStrideX = volTexMap.getStrideX(); + let atomWeightData; + if (this._visibilitySelector != null) { + atomWeightData = surface.atomWeightMap.getData(); + } + const { + atomMap + } = surface; + for (let i = 0; i < numAtoms; ++i) { + const ind = i * 4; + const scaledRad = posRad[ind + 3] * radScale; + const atomicNumFactor = atomicNum === null ? 1.0 : atomicNum[i]; + const radInv = 1 / (2 * scaledRad * scaledRad); + let radLim = gaussLim * scaledRad; + const radLim2 = radLim * radLim; + radLim *= invGridSpacing; + let tmp = posRad[ind] * invGridSpacing; + const xMin = Math.max(tmp - radLim | 0, 0); + const xMax = Math.min(tmp + radLim | 0, maxVoxelX); + tmp = posRad[ind + 1] * invGridSpacing; + const yMin = Math.max(tmp - radLim | 0, 0); + const yMax = Math.min(tmp + radLim | 0, maxVoxelY); + tmp = posRad[ind + 2] * invGridSpacing; + const zMin = Math.max(tmp - radLim | 0, 0); + const zMax = Math.min(tmp + radLim | 0, maxVoxelZ); + let dz = zMin * gridSpacing - posRad[ind + 2]; + for (let z = zMin; z <= zMax; ++z, dz += gridSpacing) { + let dy = yMin * gridSpacing - posRad[ind + 1]; + for (let y = yMin; y <= yMax; ++y, dy += gridSpacing) { + const dy2dz2 = dy * dy + dz * dz; + if (dy2dz2 >= radLim2) { + continue; + } + let addr = volMap.getDirectIdx(xMin, y, z); + let texAddr = volTexMap.getDirectIdx(xMin, y, z); + let dx = xMin * gridSpacing - posRad[ind]; + for (let x = xMin; x <= xMax; ++x, dx += gridSpacing, addr += strideX, texAddr += texStrideX) { + const r2 = dx * dx + dy2dz2; + const expVal = -r2 * radInv; + let density = Math.exp(expVal) * atomicNumFactor; + + // store most relevant atom (with highest density) + if (this._visibilitySelector != null && density > atomWeightData[addr]) { + // NOSONAR + atomWeightData[addr] = density; + // we use same index into atom map and atomWeightMap + atomMap[addr] = packedArrays.atoms[i]; + } + volData[addr] += density; + + // TODO check for volTexMap routine? + density *= invIsoValue; + const colInd = i * 3; + volTexData[texAddr] += density * colors[colInd]; + volTexData[texAddr + 1] += density * colors[colInd + 1]; + volTexData[texAddr + 2] += density * colors[colInd + 2]; + } + } } } - }]); + } + _shiftByOrigin(posRadArray) { + const originX = this.origin.x; + const originY = this.origin.y; + const originZ = this.origin.z; + const itemSize = 4; + const itemsCount = posRadArray.length / itemSize; + for (let i = 0; i < itemsCount; ++i) { + const ind = i * itemSize; + posRadArray[ind] -= originX; + posRadArray[ind + 1] -= originY; + posRadArray[ind + 2] -= originZ; + } + } +} +/* harmony default export */ const geometries_QuickSurfGeometry = (QuickSurfGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/ContactSurface.js - return FBX2CCylinder; -}(FBXGeometry); -var FBXInfoExtractor = /*#__PURE__*/function () { - function FBXInfoExtractor() { - classCallCheck(this, FBXInfoExtractor); - this._materials = []; - this._models = []; +/** + * Modifed from SpatialHash + * + * Main differences are: + * - Optimized grid size to ensure we only ever need to look +/-1 cell + * - Aware of atomic radii and will only output atoms within rAtom + rExtra + * (see withinRadii method) + * + * (Uses rounding rather than bitshifting as consequence of arbitrary grid size) + * @class + * @param {Float32Array} posRad - x, y, z coordinates and radiuses + * @param {Float32Array} min - xyz min coordinates + * @param {Float32Array} max - xyz max coordinates + * @param {number} maxDistance - max distance + */ +function AVHash(posRad, min, max, maxDistance) { + const itemSize = 4; + const nAtoms = posRad.length / itemSize; + const minX = min[0]; + const minY = min[1]; + const minZ = min[2]; + const maxX = max[0]; + const maxY = max[1]; + const maxZ = max[2]; + function hashFunc(w, minW) { + return Math.floor((w - minW) / maxDistance); } + const iDim = hashFunc(maxX, minX) + 1; + const jDim = hashFunc(maxY, minY) + 1; + const kDim = hashFunc(maxZ, minZ) + 1; + const nCells = iDim * jDim * kDim; + const jkDim = jDim * kDim; - createClass(FBXInfoExtractor, [{ - key: "process", - value: function process(data) { - this._extractModelsAndMaterials(data); - - var models = this._flattenModels(); + /* Get cellID for cartesian x,y,z */ + const cellID = function (x, y, z) { + return (hashFunc(x, minX) * jDim + hashFunc(y, minY)) * kDim + hashFunc(z, minZ); + }; - return { - name: data.name, - models: models, - materials: this._materials - }; + /* Initial building, could probably be optimized further */ + const preHash = []; + let i; + let cid; + for (i = 0; i < nAtoms; i++) { + const iIdx = itemSize * i; + cid = cellID(posRad[iIdx], posRad[iIdx + 1], posRad[iIdx + 2]); + if (preHash[cid] === undefined) { + preHash[cid] = [i]; + } else { + preHash[cid].push(i); } - /** - * Extract fbx object information from ComplexVisual - * @param {object} data - complexVisual to get geometry info from - */ + } + const cellOffsets = utils.allocateTyped(Uint32Array, nCells); + const cellLengths = utils.allocateTyped(Uint16Array, nCells); + const data = utils.allocateTyped(Uint32Array, nAtoms); + let offset = 0; + let maxCellLength = 0; + let j; + for (i = 0; i < nCells; i++) { + const start = cellOffsets[i] = offset; + const subArray = preHash[i]; + if (subArray !== undefined) { + for (j = 0; j < subArray.length; j++) { + data[offset] = subArray[j]; + offset++; + } + } + const cellLength = offset - start; + cellLengths[i] = cellLength; + if (cellLength > maxCellLength) { + maxCellLength = cellLength; + } + } - }, { - key: "_extractModelsAndMaterials", - value: function _extractModelsAndMaterials(data) { - var _this = this; - - var layersOfInterest = new Layers(); - layersOfInterest.set(gfxutils.LAYERS.DEFAULT); - layersOfInterest.enable(gfxutils.LAYERS.TRANSPARENT); - data.traverse(function (object) { - if (object instanceof Mesh$5 && object.layers.test(layersOfInterest) && _this.checkExportAbility(object)) { - if (object.geometry.type === 'InstancedBufferGeometry') { - _this._collectInstancedGeoInfo(object); - } else { - _this._collectGeoInfo(object); + // Maximum number of neighbours we could ever produce (27 adjacent cells of equal population) + this.neighbourListLength = 27 * maxCellLength + 1; + + /** + * Populate the supplied out array with atom indices that are within rAtom + rExtra + * of x,y,z + * + * -1 in out array indicates the end of the list + * + * @param {number} x - x coordinate + * @param {number} y - y coordinate + * @param {number} z - z coordinate + * @param {number} rExtra - additional radius + * @param {Float32Array} out - pre-allocated output array + * @return {undefined} + */ + this.withinRadii = function (x, y, z, rExtra, out) { + let outIdx = 0; + const nearI = hashFunc(x, minX); + const nearJ = hashFunc(y, minY); + const nearK = hashFunc(z, minZ); + const loI = Math.max(0, nearI - 1); + const loJ = Math.max(0, nearJ - 1); + const loK = Math.max(0, nearK - 1); + const hiI = Math.min(iDim - 1, nearI + 1); + const hiJ = Math.min(jDim - 1, nearJ + 1); + const hiK = Math.min(kDim - 1, nearK + 1); + for (i = loI; i <= hiI; ++i) { + const iOffset = i * jkDim; + for (j = loJ; j <= hiJ; ++j) { + const jOffset = j * kDim; + for (let k = loK; k <= hiK; ++k) { + cid = iOffset + jOffset + k; + const cellStart = cellOffsets[cid]; + const cellEnd = cellStart + cellLengths[cid]; + for (let dataIndex = cellStart; dataIndex < cellEnd; dataIndex++) { + const atomIndex = data[dataIndex]; + const baseIndex = itemSize * atomIndex; + const dx = posRad[baseIndex] - x; + const dy = posRad[baseIndex + 1] - y; + const dz = posRad[baseIndex + 2] - z; + const rSum = posRad[baseIndex + 3] + rExtra; + if (dx * dx + dy * dy + dz * dz <= rSum * rSum) { + out[outIdx++] = data[dataIndex]; + } } } - }); + } } - /** - * Reworking indices buffer, see https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/ - * basically, every triangle in Miew has been represented hat way (e.g.) : 0,1,7, but we must (for FBX) rework that - * into: 0,1,-8. - * @param {array} indices - belongs to [0, maxVertIndex] - */ - - }, { - key: "_reworkIndices", - value: function _reworkIndices(indices) { - var faceSize = 3; + // Add terminator + out[outIdx] = -1; + }; +} +function ContactSurface(packedArrays, boundaries, params, _indexList) { + // Field generation method adapted from AstexViewer (Mike Hartshorn) + // by Fred Ludlow. + // Other parts based heavily on NGL (Alexander Rose) EDT Surface class + // + // Should work as a drop-in alternative to EDTSurface (though some of + // the EDT paramters are not relevant in this method). - for (var i = faceSize - 1; i < indices.length; i += faceSize) { - indices[i] *= -1; - indices[i]--; + const itemSize = 4; + const { + posRad, + colors, + atoms + } = packedArrays; + const nAtoms = posRad.length / itemSize; + const { + bbox + } = boundaries; + const min = bbox.minPosRad; + const max = bbox.maxPosRad; + let r2; // Atom positions, expanded radii (squared) + let maxRadius; + + // Parameters + let probeRadius; + let scaleFactor; + let probePositions; + + // Cache last value for obscured test + let lastClip = -1; + + // Grid params + let dim; + let grid; + let volTex; + let weights; + let weightsMap = null; + let atomMap = null; + let visibilitySelector = null; + + // grid indices -> xyz coords + let gridx; + let gridy; + let gridz; + + // Lookup tables: + let sinTable; + let cosTable; + + // Spatial Hash + let hash; + + // Neighbour array to be filled by hash + let neighbours; + + // Vectors for Torus Projection + const mid = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0); + const n1 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0); + const n2 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0); + let ngTorus; + function uniformArray(TypeName, n, a) { + const array = utils.allocateTyped(TypeName, n); + for (let innI = 0; innI < n; ++innI) { + array[innI] = a; + } + return array; + } + function fillGridDim(a, start, step) { + for (let innI = 0; innI < a.length; innI++) { + a[innI] = start + step * innI; + } + } + function initializeGrid() { + ({ + scaleFactor + } = params); + ({ + dim + } = boundaries); + ngTorus = Math.min(5, 2 + Math.floor(probeRadius * scaleFactor)); + const gridSize = dim[0] * dim[1] * dim[2]; + grid = uniformArray(Float32Array, gridSize, -1001.0); + volTex = utils.allocateTyped(Float32Array, gridSize * 3); + weights = utils.allocateTyped(Float32Array, gridSize); + if (visibilitySelector) { + weightsMap = utils.allocateTyped(Float32Array, gridSize); + atomMap = []; + } + gridx = utils.allocateTyped(Float32Array, dim[0]); + gridy = utils.allocateTyped(Float32Array, dim[1]); + gridz = utils.allocateTyped(Float32Array, dim[2]); + fillGridDim(gridx, min[0], 1 / scaleFactor); + fillGridDim(gridy, min[1], 1 / scaleFactor); + fillGridDim(gridz, min[2], 1 / scaleFactor); + } + function initializeAngleTables() { + let theta = 0.0; + const step = 2 * Math.PI / probePositions; + cosTable = utils.allocateTyped(Float32Array, probePositions); + sinTable = utils.allocateTyped(Float32Array, probePositions); + for (let innI = 0; innI < probePositions; innI++) { + cosTable[innI] = Math.cos(theta); + sinTable[innI] = Math.sin(theta); + theta += step; + } + } + function initializeHash() { + hash = new AVHash(posRad, min, max, 2.01 * maxRadius); + neighbours = new Int32Array(hash.neighbourListLength); + } + function init() { + ({ + probeRadius, + scaleFactor, + probePositions, + visibilitySelector + } = params); + r2 = utils.allocateTyped(Float32Array, nAtoms); + maxRadius = 0; + for (let innI = 0; innI < nAtoms; ++innI) { + const rExt = posRad[innI * itemSize + 3] += probeRadius; + if (rExt > maxRadius) { + maxRadius = rExt; } + r2[innI] = rExt * rExt; } - /** - * Combine geometry from several models having the same material into one Model and finally prepare indices - * @returns {array} models, combined by material id - */ - - }, { - key: "_flattenModels", - value: function _flattenModels() { - var overallVertsCount = 0; + initializeGrid(); + initializeAngleTables(); + initializeHash(); + lastClip = -1; + } + function singleAtomObscures(ai, innX, innY, innZ) { + const innCI = itemSize * ai; + const ra2 = r2[ai]; + const dx = posRad[innCI] - innX; + const dy = posRad[innCI + 1] - innY; + const dz = posRad[innCI + 2] - innZ; + const d2 = dx * dx + dy * dy + dz * dz; + return d2 < ra2; + } + function obscured(innX, innY, innZ, a, b) { + // Is the point at x,y,z obscured by any of the atoms + // specifeid by indices in neighbours. Ignore indices + // a and b (these are the relevant atoms in projectPoints/Torii) - function shift(x) { - return x + overallVertsCount; + // Cache the last clipped atom (as very often the same one in + // subsequent calls) + let ai; + if (lastClip !== -1) { + ai = lastClip; + if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) { + return ai; } + lastClip = -1; + } + let ni = 0; + ai = neighbours[ni]; + while (ai >= 0) { + if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) { + lastClip = ai; + return ai; + } + ai = neighbours[++ni]; + } + lastClip = -1; + return -1; + } + function projectPoints() { + // For each atom: + // Iterate over a subsection of the grid, for each point: + // If current value < 0.0, unvisited, set positive + // + // In any case: Project this point onto surface of the atomic sphere + // If this projected point is not obscured by any other atom + // Calcualte delta distance and set grid value to minimum of + // itself and delta - var combined = []; // flatten models geometry - - for (var i = 0, n = this._models.length; i < n; i++) { - var models = this._models[i]; - var indices = []; - var positions = []; - var normals = []; - var colors = []; // reorganize every attributes as array of arrays - - overallVertsCount = 0; - - for (var j = 0; j < models.length; j++) { - var m = models[j]; - indices.push(m.indices.map(shift)); - overallVertsCount += m.getVerticesNumber(); - positions.push(m.positions); - normals.push(m.normals); - colors.push(m.colors); - } // join all subarrays into one - - - indices = utils.mergeTypedArraysUnsafe(indices); - - this._reworkIndices(indices); - - positions = utils.mergeTypedArraysUnsafe(positions); - normals = utils.mergeTypedArraysUnsafe(normals); - colors = utils.mergeTypedArraysUnsafe(colors); - combined.push({ - indices: indices, - positions: positions, - normals: normals, - colors: colors, - verticesCount: overallVertsCount - }); + // Should we alias frequently accessed closure constiables?? + // Assume JS engine capable of optimizing this + // anyway... + const maxRad = 4.0; + const sigma = maxRad / 3; + const sigma2Inv = 1 / (2 * sigma * sigma); + for (let innI = 0; innI < nAtoms; innI++) { + const innCI = itemSize * innI; + const ax = posRad[innCI]; + const ay = posRad[innCI + 1]; + const az = posRad[innCI + 2]; + const ar = posRad[innCI + 3]; + const ar2 = r2[innI]; + hash.withinRadii(ax, ay, az, ar, neighbours); + + // Number of grid points, round this up... + const ng = Math.ceil(ar * scaleFactor); + + // Center of the atom, mapped to grid points (take floor) + const iax = Math.floor(scaleFactor * (ax - min[0])); + const iay = Math.floor(scaleFactor * (ay - min[1])); + const iaz = Math.floor(scaleFactor * (az - min[2])); + + // Extents of grid to consider for this atom + const minx = Math.max(0, iax - ng); + const miny = Math.max(0, iay - ng); + const minz = Math.max(0, iaz - ng); + + // Add two to these points: + // - iax are floor'd values so this ensures coverage + // - these are loop limits (exclusive) + const maxx = Math.min(dim[0], iax + ng + 2); + const maxy = Math.min(dim[1], iay + ng + 2); + const maxz = Math.min(dim[2], iaz + ng + 2); + const colIdx = innI * 3; + const cr = colors[colIdx]; + const cg = colors[colIdx + 1]; + const cb = colors[colIdx + 2]; + for (let iz = minz; iz < maxz; iz++) { + const dz = gridz[iz] - az; + const zOffset = dim[1] * dim[0] * iz; + for (let iy = miny; iy < maxy; iy++) { + const dy = gridy[iy] - ay; + const dzy2 = dz * dz + dy * dy; + const zyOffset = zOffset + dim[0] * iy; + for (let ix = minx; ix < maxx; ix++) { + const idx = ix + zyOffset; + const dx = gridx[ix] - ax; + const d2 = dzy2 + dx * dx; + if (d2 < ar2) { + const w = Math.exp(-d2 * sigma2Inv); + const cIdx = idx * 3; + volTex[cIdx] += cr * w; + volTex[cIdx + 1] += cg * w; + volTex[cIdx + 2] += cb * w; + weights[idx] += w; + if (visibilitySelector !== null && w > weightsMap[idx]) { + weightsMap[idx] = w; + atomMap[idx] = atoms[innI]; + } + if (grid[idx] < 0.0) { + // Unvisited, make positive + grid[idx] = -grid[idx]; + } + // Project on to the surface of the sphere + // sp is the projected point ( dx, dy, dz ) * ( ra / d ) + const d = Math.sqrt(d2); + const ap = ar / d; + let spx = dx * ap; + let spy = dy * ap; + let spz = dz * ap; + spx += ax; + spy += ay; + spz += az; + if (obscured(spx, spy, spz, innI, -1) === -1) { + const dd = ar - d; + if (dd < grid[idx]) { + grid[idx] = dd; + } + } + } + } + } } - - return combined; } - /** - * Check ability to export the kind of mesh. - * @param {object} mesh - given mesh to check - * @returns {boolean} result of check - */ - - }, { - key: "checkExportAbility", - value: function checkExportAbility(mesh) { - // check mesh on not being empty - if (mesh.geometry.attributes.position.count === 0) { - return false; - } // check type of mesh - // if (mesh.geometry.isInstancedBufferGeometry && settings.now.zSprites) { - - - if (mesh instanceof ZSpriteMesh) { - logger.warn('Currently we cannot export \'sprites\' modes, like BS, WV, LC. Please turn of settings \'zSprites\' and try again'); - return false; - } - - if (mesh instanceof ThickLineMesh) { - logger.warn('Currently we cannot export Lines mode'); - return false; - } - - return true; + } + function normalToLine(out, p) { + out.x = out.y = out.z = 1.0; + if (p.x !== 0) { + out.x = (p.y + p.z) / -p.x; + } else if (p.y !== 0) { + out.y = (p.x + p.z) / -p.y; + } else if (p.z !== 0) { + out.z = (p.x + p.y) / -p.z; } - /** - * Save geometry info from common mesh, like Surface or Cartoon - */ + return out; + } + function projectTorus(a, b) { + const aIdx = itemSize * a; + const bIdx = itemSize * b; + const xa = posRad[aIdx]; + const ya = posRad[aIdx + 1]; + const za = posRad[aIdx + 2]; + const r1 = posRad[aIdx + 3]; + let dx = mid.x = posRad[bIdx] - xa; + let dy = mid.y = posRad[bIdx + 1] - ya; + let dz = mid.z = posRad[bIdx + 2] - za; + const innR2 = posRad[bIdx + 3]; + let d2 = dx * dx + dy * dy + dz * dz; + + // This check now redundant as already done in AVHash.withinRadii + // if( d2 > (( r1 + r2 ) * ( r1 + r2 )) ){ return; } - }, { - key: "_collectGeoInfo", - value: function _collectGeoInfo(mesh) { - var _mesh$geometry = mesh.geometry, - _mesh$geometry$attrib = _mesh$geometry.attributes, - position = _mesh$geometry$attrib.position, - color = _mesh$geometry$attrib.color, - normal = _mesh$geometry$attrib.normal, - index = _mesh$geometry.index, - matrix = mesh.matrix; - var model = new FBXModel(); - var vertCount = position.count; - model.init(vertCount, index.count); - - if (matrix.isIdentity()) { - model.setPositions(position.array, 0, vertCount, position.itemSize); - model.setNormals(normal.array, 0, vertCount, normal.itemSize); - } else { - model.setTransformedPositions(position.array, 0, vertCount, position.itemSize, matrix); - model.setTransformedNormals(normal.array, 0, vertCount, normal.itemSize, matrix); - } + const d = Math.sqrt(d2); - model.setColors(color.array, 0, vertCount, color.itemSize); - model.setIndices(index.array, 0, index.count); + // Find angle between a->b vector and the circle + // of their intersection by cosine rule + const cosA = (r1 * r1 + d * d - innR2 * innR2) / (2.0 * r1 * d); - var material = this._collectMaterialInfo(mesh); + // distance along a->b at intersection + const dmp = r1 * cosA; + mid.normalize(); - this._addToPool(model, material); - } - /** - * Collect instanced spheres geometry and materials. - * @param {object} mesh - mesh with instanced spheres info - */ + // Create normal to line + normalToLine(n1, mid); + n1.normalize(); - }, { - key: "_collectSpheresInfo", - value: function _collectSpheresInfo(mesh) { - var _mesh$geometry2 = mesh.geometry, - _mesh$geometry2$attri = _mesh$geometry2.attributes, - position = _mesh$geometry2$attri.position, - color = _mesh$geometry2$attri.color, - index = _mesh$geometry2.index, - matrix = mesh.matrix; - var model = new FBXModel(); - var instCount = mesh.geometry.maxInstancedCount; - var vertCount = position.count; - var indsCount = index.count; - model.init(instCount * vertCount, instCount * indsCount); - var geo = new FBX1CGeometry(); - geo.init(mesh.geometry); - var instMatrix = new Matrix4(); - var objMatrix = new Matrix4(); - var sphereColor = new Color(); - - for (var instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) { - // update colors in geometry - var colorIdx = instanceIndex * color.itemSize; - sphereColor.fromArray(color.array, colorIdx); - geo.setColors(sphereColor); // add instance to the model - - this._getSphereInstanceMatrix(mesh.geometry, instanceIndex, instMatrix); - - objMatrix.multiplyMatrices(matrix, instMatrix); - model.addInstance(objMatrix, geo); - } - - var material = this._collectMaterialInfo(mesh); - - this._addToPool(model, material); - } - /** - * Getting all instanced cylinders from given mesh. - * Divide cylinder (add additional vertexes) for prettiness therefore algorithm is a bit complicated - * @param {object} mesh - given mesh with instanced cylinders - */ + // Cross together for second normal vector + n2.crossVectors(mid, n1); + n2.normalize(); - }, { - key: "_collectCylindersInfo", - value: function _collectCylindersInfo(mesh) { - var _mesh$geometry3 = mesh.geometry, - _mesh$geometry3$attri = _mesh$geometry3.attributes, - position = _mesh$geometry3$attri.position, - color = _mesh$geometry3$attri.color, - color2 = _mesh$geometry3$attri.color2, - index = _mesh$geometry3.index, - matrix = mesh.matrix; - var model = new FBXModel(); - var instCount = mesh.geometry.maxInstancedCount; - var oneCCylinder = new FBX1CGeometry(); - oneCCylinder.init(mesh.geometry); - - var splittingInfo = this._gatherCylindersColoringInfo(mesh.geometry); - - var twoCCylinder = null; - - if (splittingInfo.needToSplit > 0) { - twoCCylinder = new FBX2CCylinder(); - twoCCylinder.init(mesh.geometry, splittingInfo); - } - - var additionalVertsCount = splittingInfo.addPerCylinder * splittingInfo.needToSplit; - var vertCount = position.count; - var indsCount = index.count; - model.init(instCount * vertCount + additionalVertsCount, instCount * indsCount); - var instMatrix = new Matrix4(); - var objMatrix = new Matrix4(); - var colorStart = new Color(); - var colorEnd = new Color(); - var geo = {}; - - for (var instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) { - // update colors in geometry - var colorIdx = instanceIndex * color.itemSize; - - if (splittingInfo.is2Colored[instanceIndex]) { - // .color2 contains starting color, and .color contains starting color (see uber.frag ATTR_COLOR2) - colorStart.fromArray(color2.array, colorIdx); - colorEnd.fromArray(color.array, colorIdx); - - if (twoCCylinder) { - twoCCylinder.setColors(colorStart, colorEnd); - geo = twoCCylinder; + // r is radius of circle of intersection + const rInt = Math.sqrt(r1 * r1 - dmp * dmp); + n1.multiplyScalar(rInt); + n2.multiplyScalar(rInt); + mid.multiplyScalar(dmp); + mid.x += xa; + mid.y += ya; + mid.z += za; + lastClip = -1; + const ng = ngTorus; + for (let innI = 0; innI < probePositions; innI++) { + const cost = cosTable[innI]; + const sint = sinTable[innI]; + const px = mid.x + cost * n1.x + sint * n2.x; + const py = mid.y + cost * n1.y + sint * n2.y; + const pz = mid.z + cost * n1.z + sint * n2.z; + if (obscured(px, py, pz, a, b) === -1) { + // As above, iterate over our grid... + // px, py, pz in grid coords + const iax = Math.floor(scaleFactor * (px - min[0])); + const iay = Math.floor(scaleFactor * (py - min[1])); + const iaz = Math.floor(scaleFactor * (pz - min[2])); + const minx = Math.max(0, iax - ng); + const miny = Math.max(0, iay - ng); + const minz = Math.max(0, iaz - ng); + const maxx = Math.min(dim[0], iax + ng + 2); + const maxy = Math.min(dim[1], iay + ng + 2); + const maxz = Math.min(dim[2], iaz + ng + 2); + for (let iz = minz; iz < maxz; iz++) { + dz = pz - gridz[iz]; + const zOffset = dim[1] * dim[0] * iz; + for (let iy = miny; iy < maxy; iy++) { + dy = py - gridy[iy]; + const dzy2 = dz * dz + dy * dy; + const zyOffset = zOffset + dim[0] * iy; + for (let ix = minx; ix < maxx; ix++) { + dx = px - gridx[ix]; + d2 = dzy2 + dx * dx; + const idx = ix + zyOffset; + const current = grid[idx]; + if (current > 0.0 && d2 < current * current) { + grid[idx] = Math.sqrt(d2); + } + } } - } else { - // has one color per cylinder - colorStart.fromArray(color.array, colorIdx); - oneCCylinder.setColors(colorStart); - geo = oneCCylinder; - } // add instance to the model - - - this._getCylinderInstanceMatrix(mesh.geometry, instanceIndex, instMatrix); - - objMatrix.multiplyMatrices(matrix, instMatrix); - model.addInstance(objMatrix, geo); + } } - - var material = this._collectMaterialInfo(mesh); - - this._addToPool(model, material); } - /** - * Adding model to pool of models or extend existing ones - * @param {object} model - model to add - * @param {object} material - material to add - */ - - }, { - key: "_addToPool", - value: function _addToPool(model, material) { - var materialIdx = this._checkExistingMaterial(material); - - if (materialIdx < 0) { - // new model-material pair - this._models.push([model]); - - this._materials.push(material); - } else { - // add model to existing model-material pair - var models = this._models[materialIdx]; - models.push(model); + } + function projectTorii() { + for (let innI = 0; innI < nAtoms; innI++) { + const innIdx = itemSize * innI; + hash.withinRadii(posRad[innIdx], posRad[innIdx + 1], posRad[innIdx + 2], posRad[innIdx + 3], neighbours); + let ia = 0; + let ni = neighbours[ia]; + while (ni >= 0) { + if (innI < ni) { + projectTorus(innI, ni); + } + ni = neighbours[++ia]; } } - /** - * Checking if given material already was registered in materials pool (no need to create new one) - * @param {object} material - given material - * @returns {number} number of model-material pair - */ - - }, { - key: "_checkExistingMaterial", - value: function _checkExistingMaterial(material) { - return _.findIndex(this._materials, function (m) { - return _.isEqual(m, material); - }); - } - }, { - key: "_gatherCylindersColoringInfo", - value: function _gatherCylindersColoringInfo(geo) { - var instCount = geo.maxInstancedCount; - var color1 = geo.attributes.color.array; - var color2 = geo.attributes.color2.array; - var stride = geo.attributes.color.itemSize; - var is2Colored = new Array(instCount); // analyze color instance attributes - - var needToSplit = 0; - var colIdx = 0; - - for (var i = 0; i < instCount; i++, colIdx += stride) { - var differs = Math.abs(color1[colIdx] - color2[colIdx]) > 0.0000001 || // compare ending colors - Math.abs(color1[colIdx + 1] - color2[colIdx + 1]) > 0.0000001 || Math.abs(color1[colIdx + 2] - color2[colIdx + 2]) > 0.0000001; - is2Colored[i] = differs; - needToSplit += differs; // count number of 2-colored cylinders - } // calc number of vertices to add into 2-colored - - - var geoParams = geo.getGeoParams(); - var addPerCylinder = geoParams.radialSegments; - return { - is2Colored: is2Colored, - needToSplit: needToSplit, - addPerCylinder: addPerCylinder - }; - } - /** - * Collect instanced models and materials. - * @param {object} mesh - given mesh with instanced something (spheres or cylinders) - */ - - }, { - key: "_collectInstancedGeoInfo", - value: function _collectInstancedGeoInfo(mesh) { - if (mesh.geometry instanceof InstancedSpheresGeometry) { - this._collectSpheresInfo(mesh); - } else if (mesh.geometry instanceof Instanced2CCylindersGeometry) { - this._collectCylindersInfo(mesh); + } + function fixNegatives() { + for (let innI = 0, n = grid.length; innI < n; innI++) { + if (grid[innI] < 0) grid[innI] = 0; + let w = weights[innI]; + if (w > 0) { + w = 1 / w; + const innInnI = innI * 3; + volTex[innInnI] *= w; + volTex[innInnI + 1] *= w; + volTex[innInnI + 2] *= w; } } - /** - * Collect Material info from given mesh. - * @param {object} mesh - given mesh with material info - * @returns {object} material - */ - - }, { - key: "_collectMaterialInfo", - value: function _collectMaterialInfo(mesh) { - var uberOptions = mesh.material.uberOptions; - return { - diffuse: uberOptions.diffuse.toArray(), - opacity: uberOptions.opacity, - shininess: uberOptions.shininess, - specular: uberOptions.specular.toArray() - }; - } - }, { - key: "_getCylinderInstanceMatrix", - value: function _getCylinderInstanceMatrix(geo, instIdx, matrix) { - var matVector1 = geo.attributes.matVector1.array; - var matVector2 = geo.attributes.matVector2.array; - var matVector3 = geo.attributes.matVector3.array; - var idxOffset = instIdx * 4; // used 4 because offset arrays are stored in quads - - matrix.set(matVector1[idxOffset], matVector1[idxOffset + 1], matVector1[idxOffset + 2], matVector1[idxOffset + 3], matVector2[idxOffset], matVector2[idxOffset + 1], matVector2[idxOffset + 2], matVector2[idxOffset + 3], matVector3[idxOffset], matVector3[idxOffset + 1], matVector3[idxOffset + 2], matVector3[idxOffset + 3], 0, 0, 0, 1); - } - }, { - key: "_getSphereInstanceMatrix", - value: function _getSphereInstanceMatrix(geo, instIdx, matrix) { - var offset = geo.attributes.offset; - var idx = instIdx * offset.itemSize; - var x = offset.array[idx]; - var y = offset.array[idx + 1]; - var z = offset.array[idx + 2]; - var scale = offset.array[idx + 3]; - matrix.set(scale, 0, 0, x, 0, scale, 0, y, 0, 0, scale, z, 0, 0, 0, 1); - } - }]); - - return FBXInfoExtractor; -}(); + } + function getVolume() { + // Basic steps are: + // 1) Initialize + // 2) Project points + // 3) Project torii + console.time('ContactSurface.getVolume'); + console.time('ContactSurface.init'); + init(); + console.timeEnd('ContactSurface.init'); + console.time('ContactSurface.projectPoints'); + projectPoints(); + console.timeEnd('ContactSurface.projectPoints'); + console.time('ContactSurface.projectTorii'); + projectTorii(); + console.timeEnd('ContactSurface.projectTorii'); + fixNegatives(); + console.timeEnd('ContactSurface.getVolume'); + } + this.build = function () { + // type and cutoff left in for compatibility with EDTSurface.getSurface + // function signature + getVolume(); + this.volTexMap = volTex; + this.weightsMap = weightsMap; + this.atomMap = atomMap; + this.volMap = grid; + }; +} +/* harmony default export */ const geometries_ContactSurface = (ContactSurface); +;// CONCATENATED MODULE: ./src/gfx/geometries/ContactSurfaceGeometry.js -// Forming default definitions block -var defaultDefinitions = "\nDefinitions: {\n Version: 100\n Count: 3\n ObjectType: \"Model\" {\n Count: 1\n }\n ObjectType: \"Geometry\" {\n Count: 1\n }\n ObjectType: \"Material\" {\n Count: 1\n }\n ObjectType: \"Pose\" {\n Count: 1\n }\n ObjectType: \"GlobalSettings\" {\n Count: 1\n }\n} "; // Default model properties -var defaultProperties = "Properties60: {\n Property: \"QuaternionInterpolate\", \"bool\", \"\",0\n Property: \"Visibility\", \"Visibility\", \"A\",1\n Property: \"Lcl Translation\", \"Lcl Translation\", \"A\",0.000000000000000,0.000000000000000,-1789.238037109375000\n Property: \"Lcl Rotation\", \"Lcl Rotation\", \"A\",0.000009334667643,-0.000000000000000,0.000000000000000\n Property: \"Lcl Scaling\", \"Lcl Scaling\", \"A\",1.000000000000000,1.000000000000000,1.000000000000000\n Property: \"RotationOffset\", \"Vector3D\", \"\",0,0,0\n Property: \"RotationPivot\", \"Vector3D\", \"\",0,0,0\n Property: \"ScalingOffset\", \"Vector3D\", \"\",0,0,0\n Property: \"ScalingPivot\", \"Vector3D\", \"\",0,0,0\n Property: \"TranslationActive\", \"bool\", \"\",0\n Property: \"TranslationMin\", \"Vector3D\", \"\",0,0,0\n Property: \"TranslationMax\", \"Vector3D\", \"\",0,0,0\n Property: \"TranslationMinX\", \"bool\", \"\",0\n Property: \"TranslationMinY\", \"bool\", \"\",0\n Property: \"TranslationMinZ\", \"bool\", \"\",0\n Property: \"TranslationMaxX\", \"bool\", \"\",0\n Property: \"TranslationMaxY\", \"bool\", \"\",0\n Property: \"TranslationMaxZ\", \"bool\", \"\",0\n Property: \"RotationOrder\", \"enum\", \"\",0\n Property: \"RotationSpaceForLimitOnly\", \"bool\", \"\",0\n Property: \"AxisLen\", \"double\", \"\",10\n Property: \"PreRotation\", \"Vector3D\", \"\",0,0,0\n Property: \"PostRotation\", \"Vector3D\", \"\",0,0,0\n Property: \"RotationActive\", \"bool\", \"\",0\n Property: \"RotationMin\", \"Vector3D\", \"\",0,0,0\n Property: \"RotationMax\", \"Vector3D\", \"\",0,0,0\n Property: \"RotationMinX\", \"bool\", \"\",0\n Property: \"RotationMinY\", \"bool\", \"\",0\n Property: \"RotationMinZ\", \"bool\", \"\",0\n Property: \"RotationMaxX\", \"bool\", \"\",0\n Property: \"RotationMaxY\", \"bool\", \"\",0\n Property: \"RotationMaxZ\", \"bool\", \"\",0\n Property: \"RotationStiffnessX\", \"double\", \"\",0\n Property: \"RotationStiffnessY\", \"double\", \"\",0\n Property: \"RotationStiffnessZ\", \"double\", \"\",0\n Property: \"MinDampRangeX\", \"double\", \"\",0\n Property: \"MinDampRangeY\", \"double\", \"\",0\n Property: \"MinDampRangeZ\", \"double\", \"\",0\n Property: \"MaxDampRangeX\", \"double\", \"\",0\n Property: \"MaxDampRangeY\", \"double\", \"\",0\n Property: \"MaxDampRangeZ\", \"double\", \"\",0\n Property: \"MinDampStrengthX\", \"double\", \"\",0\n Property: \"MinDampStrengthY\", \"double\", \"\",0\n Property: \"MinDampStrengthZ\", \"double\", \"\",0\n Property: \"MaxDampStrengthX\", \"double\", \"\",0\n Property: \"MaxDampStrengthY\", \"double\", \"\",0\n Property: \"MaxDampStrengthZ\", \"double\", \"\",0\n Property: \"PreferedAngleX\", \"double\", \"\",0\n Property: \"PreferedAngleY\", \"double\", \"\",0\n Property: \"PreferedAngleZ\", \"double\", \"\",0\n Property: \"InheritType\", \"enum\", \"\",0\n Property: \"ScalingActive\", \"bool\", \"\",0\n Property: \"ScalingMin\", \"Vector3D\", \"\",1,1,1\n Property: \"ScalingMax\", \"Vector3D\", \"\",1,1,1\n Property: \"ScalingMinX\", \"bool\", \"\",0\n Property: \"ScalingMinY\", \"bool\", \"\",0\n Property: \"ScalingMinZ\", \"bool\", \"\",0\n Property: \"ScalingMaxX\", \"bool\", \"\",0\n Property: \"ScalingMaxY\", \"bool\", \"\",0\n Property: \"ScalingMaxZ\", \"bool\", \"\",0\n Property: \"GeometricTranslation\", \"Vector3D\", \"\",0,0,0\n Property: \"GeometricRotation\", \"Vector3D\", \"\",0,0,0\n Property: \"GeometricScaling\", \"Vector3D\", \"\",1,1,1\n Property: \"LookAtProperty\", \"object\", \"\"\n Property: \"UpVectorProperty\", \"object\", \"\"\n Property: \"Show\", \"bool\", \"\",1\n Property: \"NegativePercentShapeSupport\", \"bool\", \"\",1\n Property: \"DefaultAttributeIndex\", \"int\", \"\",0\n Property: \"Color\", \"Color\", \"A+\",0,0,0\n Property: \"Size\", \"double\", \"\",100\n Property: \"Look\", \"enum\", \"\",1\n }"; // Default materials layer -var defaultMaterialLayer = "\n LayerElementMaterial: 0 {\n Version: 101\n Name: \"\"\n MappingInformationType: \"AllSame\"\n ReferenceInformationType: \"Direct\"\n Materials: 0\n }"; // Default layers block +const { + Volume: ContactSurfaceGeometry_Volume +} = chem; -var defaultLayerBlock = "\n Layer: 0 {\n Version: 100\n LayerElement: {\n Type: \"LayerElementNormal\"\n TypedIndex: 0\n }\n LayerElement: {\n Type: \"LayerElementColor\"\n TypedIndex: 0\n }\n LayerElement: {\n Type: \"LayerElementMaterial\"\n TypedIndex: 0\n }\n }"; /** - * globalSettings info in output file. + * This class implements 'contact' isosurface geometry generation algorithm. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor */ -var globalSettings = "GlobalSettings: {\n Version: 1000\n Properties60: {\n Property: \"UpAxis\", \"int\", \"\",1\n Property: \"UpAxisSign\", \"int\", \"\",1\n Property: \"FrontAxis\", \"int\", \"\",2\n Property: \"FrontAxisSign\", \"int\", \"\",1\n Property: \"CoordAxis\", \"int\", \"\",0\n Property: \"CoordAxisSign\", \"int\", \"\",1\n Property: \"UnitScaleFactor\", \"double\", \"\",1\n }\n }"; - -var FBXResult = /*#__PURE__*/function () { - function FBXResult() { - classCallCheck(this, FBXResult); - - this._resultArray = []; - this._info = null; +class ContactSurfaceGeometry extends geometries_VolumeSurfaceGeometry { + _computeSurface(packedArrays, box, boundaries, params) { + const contactSurface = new geometries_ContactSurface(packedArrays, boundaries, params); + contactSurface.build(); + const surface = { + volMap: new ContactSurfaceGeometry_Volume(Float32Array, this.numVoxels, box, 1, contactSurface.volMap), + volTexMap: new ContactSurfaceGeometry_Volume(Float32Array, this.numVoxels, box, 3, contactSurface.volTexMap), + atomMap: contactSurface.atomMap, + atomWeightMap: new ContactSurfaceGeometry_Volume(Float32Array, this.numVoxels, box, 1, contactSurface.weightsMap) + }; + return surface; } +} +/* harmony default export */ const geometries_ContactSurfaceGeometry = (ContactSurfaceGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurfaceAtomColored.js - createClass(FBXResult, [{ - key: "getResult", - value: function getResult(info) { - this._info = info; - - this._resultArray.push(this._writeHeader()); - - this._resultArray.push(this._writeDefinitions()); - - this._resultArray.push(this._writeObjects(info.models, info.materials)); - - this._resultArray.push(this._writeRelations()); - - this._resultArray.push(this._writeConnections()); // connections between models and materials) - - - this._info = null; - return this._resultArray.join(''); - } - /** - * Add FBXHeader info to output file. - * Some fields are really confusing, but it seems that all listed fields are very informative - */ - - }, { - key: "_writeHeader", - value: function _writeHeader() { - var FBXHeaderVersion = 1003; // 1003 is some number which appears to present in many 6.1 ASCII files - - var FBXVersion = 6100; // Mandatory and only supported version - - var date = new Date(); - var timeStampVersion = 1000; - var creator = "Miew FBX Exporter v".concat(this._info.version); // Supposed to be an engine - - return "; FBX 6.1.0 project file\n; Created by ".concat(creator, " Copyright (c) 2015-2020 EPAM Systems, Inc.\n; For support please contact miew@epam.com\n; ----------------------------------------------------\n\nFBXHeaderExtension: {\n FBXHeaderVersion: ").concat(FBXHeaderVersion, "\n FBXVersion: ").concat(FBXVersion, "\n CreationTimeStamp: {\n Version: ").concat(timeStampVersion, "\n Year: ").concat(date.getFullYear(), "\n Month: ").concat(date.getMonth() + 1, " \n Day: ").concat(date.getDate(), "\n Hour: ").concat(date.getHours(), "\n Minute: ").concat(date.getMinutes(), "\n Second: ").concat(date.getSeconds(), "\n Millisecond: ").concat(date.getMilliseconds(), "\n }\n Creator: \"").concat(creator, "\"\n OtherFlags: {\n FlagPLE: 0\n }\n}\nCreationTime: \"").concat(date, "\"\nCreator: \"").concat(creator, "\" \n"); - } - /** - * Add Definitions info to output file. - * Not exactly sure if this section is template section (as it is in 7.4+) or it should every time be like this - */ - - }, { - key: "_writeDefinitions", - value: function _writeDefinitions() { - return "\n; Object definitions\n;------------------------------------------------------------------\n\n".concat(defaultDefinitions, "\n"); - } - /** - * Adding gathered information about Models to resulting string. - * Reminder - there may be more then 1 model in scene, but we must place materials after ALL models. - * @returns {string} string containing all models (vertices, indices, colors, normals etc) - */ - - }, { - key: "_models", - value: function _models() { - var modelVersion = 232; - var allModels = ''; - var models = this._info.models; - - for (var i = 0; i < models.length; ++i) { - var model = models[i]; - var vertCount = model.verticesCount; - allModels += "\n Model: \"Model::".concat(this._info.name, "_").concat(i, "\", \"Mesh\" {\n Version: ").concat(modelVersion, " \n ").concat(defaultProperties, "\n ").concat(this._verticesIndices(model.positions, model.indices), "\n ").concat(this._normalLayer(model.normals), " \n ").concat(this._colorLayer(model.colors, vertCount), " \n ").concat(defaultMaterialLayer, " \n ").concat(defaultLayerBlock, "\n }"); - } - return allModels; - } - /** - * Add Material info to result - */ +/** + * Class for colored atom. Need for atom structure clusterization + * + * @param {Vector3} vCenter Center of atom + * @param {number} radiusAt Radius of atom + */ +class IsoSurfaceAtomColored { + constructor(vCenter, radiusAt) { + this.coord = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this.coord.copy(vCenter); + this.radius = radiusAt; + this.colorX = 0.99999; + this.colorY = 0.0; + this.colorZ = 0.0; + this.atomType = 0; + this.srcAtom = null; + } +} +/* harmony default export */ const geometries_IsoSurfaceAtomColored = (IsoSurfaceAtomColored); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsosurfaceBuildNormals.js - }, { - key: "_materials", - value: function _materials() { - var materialVersion = 102; - var allMaterials = ''; - var materials = this._info.materials; - for (var i = 0; i < materials.length; ++i) { - var material = materials[i]; - allMaterials += "\n Material: \"Material::".concat(this._info.name, "_").concat(i, "_default\", \"\" {\n Version: ").concat(materialVersion, "\n ShadingModel: \"lambert\"\n MultiLayer: 0\n ").concat(this._materialProperties(material), "\n }"); - } - return allMaterials; - } - /** - * Add Objects info to output file. - */ +// suppress some JSHint warnings +/* jshint bitwise: false */ - }, { - key: "_writeObjects", - value: function _writeObjects() { - return "\n; Object properties\n;------------------------------------------------------------------\n\nObjects: {\n ".concat(this._models(), "\n ").concat(this._materials(), "\n ").concat(globalSettings, "\n}\n"); +/** + * Build normals for isosurface, using atoms information + * + * @param {number} numAtoms - Number of atoms in molecule + * @param {Element} atoms - Array of atoms + * @param {Vector3} vBoxMin - Bounding box min + * @param {Vector3} vBoxMax - Bounding box max + * @param {number} probeRadius - Normals for output + * + */ +class IsosurfaceBuildNormals { + constructor(numAtoms, atoms, vBoxMin, vBoxMax, probeRadius) { + this._numAtoms = numAtoms; + this._atoms = atoms; + this._vBoxMin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._vBoxMax = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._vBoxMin.copy(vBoxMin); + this._vBoxMax.copy(vBoxMax); + this._probeRadius = probeRadius; + this._atomsList = null; + this._voxelList = null; + } + createVoxels() { + let numAtomsRefs; + let rad; + const ATOM_VOXEL_REF_SCALE = 4.5; + const numAtoms = this._numAtoms | 0; + const atoms = this._atoms; + const dx = this._vBoxMax.x - this._vBoxMin.x; + const dy = this._vBoxMax.y - this._vBoxMin.y; + const dz = this._vBoxMax.z - this._vBoxMin.z; + let w = dx < dy ? dx : dy; + w = dz < w ? dz : w; + let maxRad = 0.0; + let aveRad = 0.0; + let i; + for (i = 0; i < numAtoms; i++) { + rad = (atoms[i].radius + this._probeRadius) * 2.0; + maxRad = rad > maxRad ? rad : maxRad; + aveRad += rad; + } + let numCells = Math.floor(w / maxRad); + if (numCells < 2) { + numCells = 2; + } + aveRad /= numAtoms; + this._numCells = numCells; + this._aveRad = aveRad; + this._maxRad = maxRad; + const side = numCells; + const side2 = numCells * numCells; + const side3 = numCells * numCells * numCells; + const xScale = this._xScale = 1.0 / (this._vBoxMax.x - this._vBoxMin.x); + const yScale = this._yScale = 1.0 / (this._vBoxMax.y - this._vBoxMin.y); + const zScale = this._zScale = 1.0 / (this._vBoxMax.z - this._vBoxMin.z); + + // estimate number of individual atom refs in each voxel list + let maxAtomsRefs = 0; + const xNumVoxMult = xScale * numCells; + const yNumVoxMult = yScale * numCells; + const zNumVoxMult = zScale * numCells; + for (i = 0; i < numAtoms; i++) { + const radAffect = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE; + const diaAffect = radAffect * 2.0; + let numVoxX = Math.floor(xNumVoxMult * diaAffect + 0.8); + let numVoxY = Math.floor(yNumVoxMult * diaAffect + 0.8); + let numVoxZ = Math.floor(zNumVoxMult * diaAffect + 0.8); + // avoid case numVox? == 0 + // also use loop i <= + numVoxX++; + numVoxY++; + numVoxZ++; + maxAtomsRefs += numVoxX * numVoxY * numVoxZ; + } // for (i) + // maxAtomsRefs = numAtoms * MAX_ATOMS_IN_SINGLE_VOXEL; + + this._voxelList = utils.allocateTyped(Int32Array, side3); + const atomsList = []; + atomsList.length = maxAtomsRefs; + if (this._voxelList === null || atomsList === null) { + return 0 - 1; } - /** - * Add Relations info to output file. - */ - - }, { - key: "_writeRelations", - value: function _writeRelations() { - var modelsList = ''; - - for (var i = 0; i < this._info.models.length; ++i) { - modelsList += "\n Model: \"Model::".concat(this._info.name, "_").concat(i, "\", \"Mesh\" {\n }"); - } + // init voxel list + for (i = 0; i < side3; i++) { + this._voxelList[i] = -1; + } + numAtomsRefs = 0; + + // create voxel lists + for (i = 0; i < numAtoms; i++) { + // use multiplier 4 to locate this atom in different voxels + rad = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE; + let xIndMin = Math.floor((atoms[i].coord.x - this._vBoxMin.x - rad) * numCells * xScale); + let yIndMin = Math.floor((atoms[i].coord.y - this._vBoxMin.y - rad) * numCells * yScale); + let zIndMin = Math.floor((atoms[i].coord.z - this._vBoxMin.z - rad) * numCells * zScale); + let xIndMax = Math.floor((atoms[i].coord.x - this._vBoxMin.x + rad) * numCells * xScale); + let yIndMax = Math.floor((atoms[i].coord.y - this._vBoxMin.y + rad) * numCells * yScale); + let zIndMax = Math.floor((atoms[i].coord.z - this._vBoxMin.z + rad) * numCells * zScale); + xIndMin = xIndMin >= 0 ? xIndMin : 0; + yIndMin = yIndMin >= 0 ? yIndMin : 0; + zIndMin = zIndMin >= 0 ? zIndMin : 0; + xIndMax = xIndMax < numCells ? xIndMax : numCells - 1; + yIndMax = yIndMax < numCells ? yIndMax : numCells - 1; + zIndMax = zIndMax < numCells ? zIndMax : numCells - 1; + for (let z = zIndMin; z <= zIndMax; z++) { + for (let y = yIndMin; y <= yIndMax; y++) { + for (let x = xIndMin; x <= xIndMax; x++) { + // add atom with index "i" to this voxel list + const indVoxel = x + y * side + z * side2; + // assert indVoxel >= 0 + // assert indVoxel < side3 + + // add first + if (this._voxelList[indVoxel] < 0) { + atomsList[numAtomsRefs * 2 + 0] = i; + atomsList[numAtomsRefs * 2 + 1] = 0 - 1; + this._voxelList[indVoxel] = numAtomsRefs; + numAtomsRefs++; + // assert numAtomsRefs < maxAtomsRefs - 1 + continue; + } + // insert into head of list + const indexNext = this._voxelList[indVoxel]; + this._voxelList[indVoxel] = numAtomsRefs; + atomsList[numAtomsRefs * 2 + 0] = i; + atomsList[numAtomsRefs * 2 + 1] = indexNext; + numAtomsRefs++; + } // for (x) + } // for (y) + } // for (z) + } // for (i) - var materialList = ''; + // convert Array to Int32Array + this._atomsList = Int32Array.from(atomsList); + return 0; + } + destroyVoxels() { + this._atomsList = null; + this._voxelList = null; + this._atoms = null; + this._vertices = null; + this._vBoxMin = null; + this._vBoxMax = null; + } - for (var _i = 0; _i < this._info.materials.length; ++_i) { - materialList += "\n Material: \"Material::".concat(this._info.name, "_").concat(_i, "_default\", \"\" {\n }"); - } + /** + * Enumerate all atoms affecting specified point + * + * @param {Vector3} point - point in 3D + * @param {func(atom)} process - function to call for each atom + */ + forEachRelatedAtom(point, process) { + // find corresponding voxel + const xInd = Math.floor((point.x - this._vBoxMin.x) * this._numCells * this._xScale); + const yInd = Math.floor((point.y - this._vBoxMin.y) * this._numCells * this._yScale); + const zInd = Math.floor((point.z - this._vBoxMin.z) * this._numCells * this._zScale); + const indVoxel = xInd + yInd * this._numCells + zInd * this._numCells * this._numCells; - return "\n; Object relations\n;------------------------------------------------------------------\n\nRelations: {\n ".concat(modelsList, "\n Model: \"Model::Producer Perspective\", \"Camera\" {\n }\n Model: \"Model::Producer Top\", \"Camera\" {\n }\n Model: \"Model::Producer Bottom\", \"Camera\" {\n }\n Model: \"Model::Producer Front\", \"Camera\" {\n }\n Model: \"Model::Producer Back\", \"Camera\" {\n }\n Model: \"Model::Producer Right\", \"Camera\" {\n }\n Model: \"Model::Producer Left\", \"Camera\" {\n }\n Model: \"Model::Camera Switcher\", \"CameraSwitcher\" {\n }\n ").concat(materialList, "\n}"); + // run through atoms affecting this voxel + const atoms = this._atoms; + for (let ref = this._voxelList[indVoxel]; ref >= 0; ref = this._atomsList[ref * 2 + 1]) { + const indexAtom = this._atomsList[ref * 2]; + process(atoms[indexAtom]); } - /** - * Add Connections info to output file. - */ - - }, { - key: "_writeConnections", - value: function _writeConnections() { - var modelsList = ''; - var name = this._info.name; + } - for (var i = 0; i < this._info.models.length; ++i) { - modelsList += "\n Connect: \"OO\", \"Model::".concat(name, "_").concat(i, "\", \"Model::Scene\""); + /** + * Get atom closest to specified point + * + * @param {Vector3} point - point in 3D + * + * @returns {IsoSurfaceAtomColored} atom, or null if not found + */ + getClosestAtom(point) { + let closest = null; + let minDist2 = Number.MAX_VALUE; + this.forEachRelatedAtom(point, atom => { + const dist2 = point.distanceToSquared(atom.coord); + if (dist2 < minDist2) { + minDist2 = dist2; + closest = atom; } + }); + return closest; + } - var materialList = ''; - - for (var _i2 = 0; _i2 < this._info.materials.length; ++_i2) { - materialList += "\n Connect: \"OO\", \"Material::".concat(name, "_").concat(_i2, "_default\", \"Model::").concat(name, "_").concat(_i2, "\""); + /** + * Build normals for isosurface, using atoms information + * + * @param {number} numVertices - Number of vertices in final geometry (to render) + * @param {Vector3} vertices - Geometry vertices (3d coordinates array) + * @param {Vector3} normals - Normals for output + * + * @returns {number} 0, if success + */ + buildNormals(numVertices, vertices, normals) { + const self = this; + let numCloseAtoms = 0; + let vx = 0; + let vy = 0; + let vz = 0; + let dist2; + let vNormalX = 0; + let vNormalY = 0; + let vNormalZ = 0; + let koef = 0; + let w = 0; + const r25 = 2.5; + const r01 = 0.1; + const maxRadAffect = this._aveRad * r25; + const maxRadAffect2 = maxRadAffect * maxRadAffect; + const expScale = -this._aveRad * r01; + + // some stats + // numSlowAtoms = 0; + + const gatherNormals = function (atom) { + const dx = vx - atom.coord.x; + const dy = vy - atom.coord.y; + const dz = vz - atom.coord.z; + dist2 = dx * dx + dy * dy + dz * dz; + if (dist2 > maxRadAffect2) { + return; } - return "\n; Object connections\n;------------------------------------------------------------------\n\nConnections: {\n ".concat(modelsList, "\n ").concat(materialList, "\n}"); - } - /** - * Write float array to string with limited precision - * @param {Float32Array} array - array to be fixed - * @returns {String} String with fixed floats - */ - - }, { - key: "_floatArrayToString", - value: function _floatArrayToString(array) { - var str = []; - - for (var i = 0; i < array.length; ++i) { - str[i] = array[i].toFixed(6); + // get weight for gaussian smoothing + const rad = atom.radius + self._probeRadius; + koef = dist2 - rad * rad; + if (koef < 0.0) { + koef = -koef; } + w = Math.exp(expScale * koef); + vNormalX += dx * w; + vNormalY += dy * w; + vNormalZ += dz * w; + numCloseAtoms++; + }; + let maxClosedAtoms = 0; + // process all vertices, one by one + for (let i = 0; i < numVertices; i++) { + vx = vertices[i].x; + vy = vertices[i].y; + vz = vertices[i].z; + numCloseAtoms = 0; + vNormalX = vNormalY = vNormalZ = 0.0; + this.forEachRelatedAtom(vertices[i], gatherNormals); + maxClosedAtoms = numCloseAtoms > maxClosedAtoms ? numCloseAtoms : maxClosedAtoms; + + // normalize vNormal + dist2 = vNormalX * vNormalX + vNormalY * vNormalY + vNormalZ * vNormalZ; + if (numCloseAtoms > 0) { + koef = 1.0 / Math.sqrt(dist2); + vNormalX *= koef; + vNormalY *= koef; + vNormalZ *= koef; + } + normals[i].x = vNormalX; + normals[i].y = vNormalY; + normals[i].z = vNormalZ; + } // for (i) all vertices - return str.join(','); - } - /** - * Adding color layer to resulting file - * @param {Float32Array} colorArray attribute - * @param {number} vertCount - number of vertices in the model - * @returns {string} color layer info - */ + return 0; + } - }, { - key: "_colorLayer", - value: function _colorLayer(colorArray, vertCount) { - var layerElementColorNumber = 0; - var layerElementColorVersion = 101; - var layerElementColorName = ''; + /** + * Build vertex colors for isosurface, using atoms information + * + * @param {number} numVertices - Number of vertices in final geometry (to render) + * @param {Vector3} vertices - Geometry vertices (3d coordinates array) + * @param {Vector3} colors - Colors for output + * @param {number} radiusColorSmoothness - Radius of smoothness sphere + * + * @returns {number} 0, if success + */ + buildColors(numVertices, vertices, colors, radiusColorSmoothness) { + const self = this; + let vx = 0.0; + let vy = 0.0; + let vz = 0.0; + let koef = 0.0; + let w = 0.0; + const KOEF_ADD = 0.8; + const maxRadAffect = radiusColorSmoothness; + const maxRadAffect2 = maxRadAffect * maxRadAffect; + let colorsClose = []; + let weights = []; + let weightsSum = 0; + const gatherColors = function (atom) { + const dx = vx - atom.coord.x; + const dy = vy - atom.coord.y; + const dz = vz - atom.coord.z; + const dist2 = dx * dx + dy * dy + dz * dz; + if (dist2 > maxRadAffect2) { + return; + } - var colorsStr = this._floatArrayToString(colorArray); // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed - // As said [..Array(...)] - fastest and easiest way to produce [0, 1, .....] array + // get weight for gaussian smoothing + const rad = atom.radius + self._probeRadius; + koef = dist2 - rad * rad; + if (koef < 0.0) { + koef = -koef; + } + w = 1.0 / (KOEF_ADD + koef); + colorsClose.push([atom.colorX, atom.colorY, atom.colorZ]); + weights.push(w); // save weights for use + weightsSum += w; // calc sum of weights fo further normalization + }; + // process all vertices, one by one + for (let i = 0; i < numVertices; i++) { + vx = vertices[i].x; + vy = vertices[i].y; + vz = vertices[i].z; + colorsClose = []; + weights = []; + weightsSum = 0; + this.forEachRelatedAtom(vertices[i], gatherColors); + + // normalized weighted sum of colors + for (let j = 0; j < colorsClose.length; ++j) { + const weightNormalized = weights[j] / weightsSum; + colors[i].x += colorsClose[j][0] * weightNormalized; + colors[i].y += colorsClose[j][1] * weightNormalized; + colors[i].z += colorsClose[j][2] * weightNormalized; + } + } // for (i) all vertices + return 0; + } +} +/* harmony default export */ const geometries_IsosurfaceBuildNormals = (IsosurfaceBuildNormals); +;// CONCATENATED MODULE: ./src/gfx/geometries/IsoSurfaceGeo.js - var colorIndices = toConsumableArray(Array(vertCount).keys()); - return "\n LayerElementColor: ".concat(layerElementColorNumber, " {\n Version: ").concat(layerElementColorVersion, "\n Name: \"").concat(layerElementColorName, "\"\n MappingInformationType: \"ByVertice\"\n ReferenceInformationType: \"Direct\"\n Colors: ").concat(colorsStr, "\n ColorIndex: ").concat(colorIndices, "\n }"); +/** + * Class for geometry (triangle mesh) representation + * + * + * @param {number} maxNumVertices Maximum possible number of vertices in mesh + * @param {number} maxNumTriangles Maximum possible number of triangles in mesh + * @param {boolean} needVertexColors Obvious + */ +class IsoSurfaceGeo { + constructor(maxNumVertices, maxNumTriangles, needVertexColors) { + this._maxNumVertices = maxNumVertices; + this._maxNumTriangles = maxNumTriangles; + this._vertices = new Array(maxNumVertices); + this._normals = new Array(maxNumVertices); + this._colors = null; + if (needVertexColors) { + this._colors = new Array(maxNumVertices); } - /** - * Adding normal layer to resulting file - * @param {Float32Array} normalArray attribute - * @returns {string} normal layer info - */ - - }, { - key: "_normalLayer", - value: function _normalLayer(normalArray) { - var layerElementNormalNumber = 0; - var layerElementNormalVersion = 101; - var layerElementNormalName = ''; - - var normalsStr = this._floatArrayToString(normalArray); // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed - - - return "\n LayerElementNormal: ".concat(layerElementNormalNumber, " {\n Version: ").concat(layerElementNormalVersion, "\n Name: \"").concat(layerElementNormalName, "\"\n MappingInformationType: \"ByVertice\"\n ReferenceInformationType: \"Direct\" \n Normals: ").concat(normalsStr, "\n }"); + this._indices = new Array(maxNumTriangles * (1 + 2)); + this._numVertices = 0; + this._numTriangles = 0; + let i; + for (i = 0; i < maxNumVertices; i++) { + this._vertices[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._normals[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); } - /** - * Adding vertices and indices to resulting string - * @return {string} resulting string in FBX notation - */ - - }, { - key: "_verticesIndices", - value: function _verticesIndices(positions, indices) { - var multiLayer = 0; - var multiTake = 1; - var shading = 'Y'; - var culling = 'CullingOff'; - var geometryVersion = 124; + for (i = 0; i < maxNumTriangles * (1 + 2); i++) { + this._indices[i] = -1; + } + if (needVertexColors) { + for (i = 0; i < maxNumVertices; i++) { + this._colors[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + } + } + } + destroy() { + this._vertices = null; + this._normals = null; + this._indices = null; + } +} +/* harmony default export */ const geometries_IsoSurfaceGeo = (IsoSurfaceGeo); +;// CONCATENATED MODULE: ./src/gfx/geometries/SSIsosurfaceGeometry.js - var vertStr = this._floatArrayToString(positions); - /* About _correctArrayNotation: Float32Arrays will contains only Float32 numbers, which implies that it will be floating points with 17 numbers after point. - * We cannot (and it's logically incorrect) save all this information, so we convert this Float32Array into Array-like object with numbers with only 6 numbers after point - * Reminder - this is big memory loss (as we must save at one moment two arrays with similar information) */ - return "MultiLayer: ".concat(multiLayer, "\n MultiTake: ").concat(multiTake, "\n Shading: ").concat(shading, "\n Culling: \"").concat(culling, "\"\n Vertices: ").concat(vertStr, "\n PolygonVertexIndex: ").concat(indices, "\n GeometryVersion: ").concat(geometryVersion); - } - /** - * Forming material properties block. - * @param {Object} material - given material of model - * @returns {String} material properties string - */ - }, { - key: "_materialProperties", - value: function _materialProperties(material) { - return "Properties60: {\n Property: \"ShadingModel\", \"KString\", \"\", \"Lambert\"\n Property: \"MultiLayer\", \"bool\", \"\",0\n Property: \"EmissiveColor\", \"ColorRGB\", \"\",0,0,0\n Property: \"EmissiveFactor\", \"double\", \"\",0.0000\n Property: \"AmbientColor\", \"ColorRGB\", \"\",1,1,1\n Property: \"AmbientFactor\", \"double\", \"\",0.0000\n Property: \"DiffuseColor\", \"ColorRGB\", \"\",".concat(material.diffuse, "\n Property: \"DiffuseFactor\", \"double\", \"\",1.0000\n Property: \"Bump\", \"Vector3D\", \"\",0,0,0\n Property: \"TransparentColor\", \"ColorRGB\", \"\",1,1,1\n Property: \"TransparencyFactor\", \"double\", \"\",0.0000\n Property: \"SpecularColor\", \"ColorRGB\", \"\",").concat(material.specular, "\n Property: \"SpecularFactor\", \"double\", \"\",1.0000\n Property: \"ShininessExponent\", \"double\", \"\",").concat(material.shininess, "\n Property: \"ReflectionColor\", \"ColorRGB\", \"\",0,0,0\n Property: \"ReflectionFactor\", \"double\", \"\",1\n Property: \"Ambient\", \"ColorRGB\", \"\",1,1,1\n Property: \"Diffuse\", \"ColorRGB\", \"\",").concat(material.diffuse, "\n Property: \"Specular\", \"ColorRGB\", \"\",").concat(material.specular, "\n Property: \"Shininess\", \"double\", \"\",").concat(material.shininess, "\n Property: \"Opacity\", \"double\", \"\",").concat(material.opacity, "\n Property: \"Reflectivity\", \"double\", \"\",0\n }"); - } - }]); - return FBXResult; -}(); -var FBXExporter = /*#__PURE__*/function (_Exporter) { - inherits(FBXExporter, _Exporter); - function FBXExporter(source, options) { - var _this; - classCallCheck(this, FBXExporter); +const SSIsosurfaceGeometry_COLOR_SIZE = 3; +const HASH_SIZE = 32768; +const { + Element: SSIsosurfaceGeometry_Element +} = chem; - _this = possibleConstructorReturn(this, getPrototypeOf(FBXExporter).call(this, source, options)); // Data +/** + * This class implements 'quick' isosurface geometry generation algorithm. + * @param spheresCount - number of atoms/spheres + * @param opts - geometry specific options + * @constructor + */ - _this._data = source; - _this._version = options.miewVersion || '0.0-UNSPECIFIED'; - _this._extractor = new FBXInfoExtractor(); - return _this; +class SSIsosurfaceGeometry extends geometries_IsoSurfaceGeometry { + _build() { + // convert geoOut into arrays of positions, indices, normals + this._innerBuild(); + const geoOut = this.getGeo(); + this.destroy(); + this._fromGeo(geoOut); + } + _fromGeo(geoOut) { + let colors = null; + const positions = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); + const normals = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); + if (geoOut._colors !== null) { + colors = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices); + } + const indices = utils.allocateTyped(Uint32Array, (1 + 2) * geoOut._numTriangles); + for (let i = 0, j = 0; i < geoOut._numVertices; i++) { + positions[j + 0] = geoOut._vertices[i].x; + positions[j + 1] = geoOut._vertices[i].y; + positions[j + 2] = geoOut._vertices[i].z; + normals[j + 0] = geoOut._normals[i].x; + normals[j + 1] = geoOut._normals[i].y; + normals[j + 2] = geoOut._normals[i].z; + j += 3; + } + if (colors !== null) { + for (let i = 0, j = 0; i < geoOut._numVertices; i++, j += 3) { + colors[j + 0] = geoOut._colors[i].x; + colors[j + 1] = geoOut._colors[i].y; + colors[j + 2] = geoOut._colors[i].z; + } + } + const numTri3 = geoOut._numTriangles * (1 + 2); + for (let i = 0; i < numTri3; i++) { + indices[i] = geoOut._indices[i]; + } + this.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(indices, 1)); + this.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(positions, 3)); + this.setAttribute('normal', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(normals, 3)); + this.setAttribute('color', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(colors, 3)); + this.computeBoundingBox(); + this.computeBoundingSphere(); + geoOut.destroy(); + } + convertToAtomsColored(packedArrays, atomsColored) { + const { + atoms, + colors + } = packedArrays; + for (let i = 0, numAtoms = atoms.length; i < numAtoms; i++) { + const vCenter = atoms[i].position; + const { + radius + } = atoms[i].element; + atomsColored[i] = new geometries_IsoSurfaceAtomColored(vCenter, radius); + const nm = atoms[i].element.number; + atomsColored[i].atomType = this.getType(nm); + let cIdx = SSIsosurfaceGeometry_COLOR_SIZE * i; + atomsColored[i].colorX = colors[cIdx++]; + atomsColored[i].colorY = colors[cIdx++]; + atomsColored[i].colorZ = colors[cIdx]; + atomsColored[i].srcAtom = atoms[i]; + } + } + getGeo() { + return this.geoOut; + } + destroy() { + this.atoms = null; + this.hashLines = null; + this.hashEntries = null; } + /** - * Entry point to exporter. + * Calculates bounding box for array with spheres (atoms) + * + * @param {Object} atoms Atoms array + * @param {Vector3} vBoxMin Bounding box min point + * @param {Vector3} vBoxMax Bounding box max point */ - - - createClass(FBXExporter, [{ - key: "exportSync", - value: function exportSync() { - // Creating mandatory blocks - var result = new FBXResult(); - - if (!this._source) { - return this._result; + getBoundingBox(atoms, vBoxMin, vBoxMax) { + const bigNum = 10000000.0; + vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum; + vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum; + const probeRadius2 = this.probeRadius * this.atomRadiusScale; + let radMax = 0.0; + for (let i = 0, num = atoms.length; i < num; i++) { + const vCenter = atoms[i].coord; + const rad = atoms[i].radius + probeRadius2; + radMax = rad > radMax ? rad : radMax; + if (vCenter.x - rad < vBoxMin.x) { + vBoxMin.x = vCenter.x - rad; + } + if (vCenter.y - rad < vBoxMin.y) { + vBoxMin.y = vCenter.y - rad; + } + if (vCenter.z - rad < vBoxMin.z) { + vBoxMin.z = vCenter.z - rad; + } + if (vCenter.x + rad > vBoxMax.x) { + vBoxMax.x = vCenter.x + rad; + } + if (vCenter.y + rad > vBoxMax.y) { + vBoxMax.y = vCenter.y + rad; + } + if (vCenter.z + rad > vBoxMax.z) { + vBoxMax.z = vCenter.z + rad; } - - var info = this._extractor.process(this._data); - - info.version = this._version; - this._result = result.getResult(info); - return this._result; } - }]); - - return FBXExporter; -}(Exporter); -FBXExporter.formats = ['fbx']; -FBXExporter.SourceClass = ComplexVisual; - -var exporters = new ExporterList([PDBExporter, FBXExporter]); - -var io = { - loaders: loaders, - parsers: parsers, - exporters: exporters -}; - -var tempColor = new Color(); - -var CSS2DRenderer = /*#__PURE__*/function () { - function CSS2DRenderer() { - classCallCheck(this, CSS2DRenderer); + vBoxMin.x -= radMax; + vBoxMin.y -= radMax; + vBoxMin.z -= radMax; + vBoxMax.x += radMax; + vBoxMax.y += radMax; + vBoxMax.z += radMax; + } - this._width = 0; - this._height = 0; - this._widthHalf = 0; - this._heightHalf = 0; - this._vector = new Vector3(); - this._viewMatrix = new Matrix4(); - this._projectionMatrix = new Matrix4(); - this._domElement = document.createElement('div'); - this._domElement.style.overflow = 'hidden'; - this._domElement.style.position = 'absolute'; - this._domElement.style.top = '0'; - this._domElement.style.zIndex = '0'; // start a new Stacking Context to enclose all z-ordered children + /** + * Calculate (x,y,z) cordinate of the cell corner point + * + * @param {Vector3} vBoxMin Bounding box min point + * @param {Vector3} vBoxMax Bounding box max point + * @param {number} x Cell integer x coordinate + * @param {number} y Cell integer y coordinate + * @param {number} z Cell integer z coordinate + * @param {number} numPoints NUm points in cell on side + * @param {Vector3} vOut Output vector + */ + getCornerCoord(vBoxMin, vBoxMax, x, y, z, numPoints, vOut) { + const invNP = 1.0 / (numPoints - 1.0); + const tx = x * invNP; + const ty = y * invNP; + const tz = z * invNP; + vOut.x = vBoxMin.x * (1.0 - tx) + vBoxMax.x * tx; + vOut.y = vBoxMin.y * (1.0 - ty) + vBoxMax.y * ty; + vOut.z = vBoxMin.z * (1.0 - tz) + vBoxMax.z * tz; + } - this._domElement.style.pointerEvents = 'none'; + /** + * Calculate point of intersection of sphere surface + * and cell edge, given by [indexA, indexB] line + * + * @param {number} indexA Cell vertex index in [0..11] + * @param {number} indexB Cell vertex index in [0..11] + * @param {array} sign Sign array for all 8 vertices + * @param {object} cube Cube + * @param {number} indexPointValue for value placement + * @param {Vector3} vOut Point of intersection + */ + buildEdgePoint(indexA, indexB, sign, cube, indexPointValue, vOut) { + if (sign[indexA] ^ sign[indexB]) { + const cTwentyFour = 24; + const t = (0 - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]) / (cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexB] - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]); + const xa = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 0]; + const ya = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 1]; + const za = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 2]; + const xb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 0]; + const yb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 1]; + const zb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 2]; + vOut.x = xa * (1.0 - t) + xb * t; + vOut.y = ya * (1.0 - t) + yb * t; + vOut.z = za * (1.0 - t) + zb * t; + } } - createClass(CSS2DRenderer, [{ - key: "getElement", - value: function getElement() { - return this._domElement; + /** + * Check if triangle is visible (vertices are close to atoms included in visibility set) + * + * @param {Vector3} v0 Vertex #0 + * @param {Vector3} v1 Vertex #1 + * @param {Vector3} v2 Vertex #2 + * @returns {boolean} true if triangle is visible + */ + isTriangleVisible(v0, v1, v2) { + const a0 = this.voxelWorld.getClosestAtom(v0); + const a1 = this.voxelWorld.getClosestAtom(v1); + const a2 = this.voxelWorld.getClosestAtom(v2); + if (a0 === null || a1 === null || a2 === null || a0.srcAtom === null || a1.srcAtom === null || a2.srcAtom === null) { + return false; } - }, { - key: "reset", - value: function reset() { - var myNode = this.getElement(); + return this.visibilitySelector.includesAtom(a0.srcAtom) && this.visibilitySelector.includesAtom(a1.srcAtom) && this.visibilitySelector.includesAtom(a2.srcAtom); + } - while (myNode.firstChild) { - myNode.removeChild(myNode.firstChild); - } + /** + * Add triangle to result geometry + * + * @param {Vector3} v0 Vertex #0 + * @param {Vector3} v1 Vertex #1 + * @param {Vector3} v2 Vertex #2 + * @returns {boolean} false if no more triangles can be added + */ + addTriangle(v0, v1, v2) { + if (this.visibilitySelector && !this.isTriangleVisible(v0, v1, v2)) { + return true; } - }, { - key: "setSize", - value: function setSize(width, height) { - this._width = width; - this._height = height; - this._widthHalf = this._width / 2; - this._heightHalf = this._height / 2; - this._domElement.style.width = "".concat(width, "px"); - this._domElement.style.height = "".concat(height, "px"); + const geo = this.geoOut; + if (geo._numTriangles >= this.maxNumTriangles) { + return false; } - }, { - key: "_renderObject", - value: function _renderObject(object, camera, scene) { - function lerpColorAsHex(a, b, t) { - tempColor.setHex(a); - tempColor.lerp(b, t); - return "#".concat(tempColor.getHexString()); - } - - function colorAsHex(a) { - tempColor.setHex(a); - return "#".concat(tempColor.getHexString()); - } - - if (object instanceof CSS2DObject) { - this._vector.setFromMatrixPosition(object.matrixWorld); - - if (object.userData !== undefined && object.userData.offset !== undefined) { - var localOffset = new Vector3(object.userData.offset.x, object.userData.offset.y, 0); - - this._vector.add(localOffset.multiplyScalar(object.matrixWorld.getMaxScaleOnAxis())); - } - - this._vector.applyMatrix4(this._viewMatrix); - var visibility = this._vector.z > -camera.near ? 'hidden' : 'visible'; - var zIndex = 10000 * (camera.far - -this._vector.z) / (camera.far - camera.near); - var element = object.getElement(); - - if (typeof scene.fog === 'undefined') { - element.style.color = colorAsHex(object.userData.color); + // Add vertex with optimize + const indInGeo0 = this.addVertexToGeo(geo, v0); + const indInGeo1 = this.addVertexToGeo(geo, v1); + const indInGeo2 = this.addVertexToGeo(geo, v2); + if ((indInGeo0 | indInGeo1 | indInGeo2) < 0) { + return false; + } + const itr = 3 * geo._numTriangles; + geo._indices[itr + 0] = indInGeo0; + geo._indices[itr + 1] = indInGeo1; + geo._indices[itr + 2] = indInGeo2; + geo._numTriangles++; + return true; + } - if (object.userData.background !== 'transparent') { - element.style.background = colorAsHex(object.userData.background); + /** + * Build result geometry (triangle mesh) from marching cube cells + * + * @param {number} meshRes Marchnig cube vertex count on each side + * @param {Vector3} vBoxMin Bounding box point min + * @param {Vector3} vBoxMax Bounding box point max + * @param {number} corners float values array for each cube point + * @param {Vector3} vCellStep vector to next cube cell diagonal point + * @param {object} cube IsoSurfaceMarchCube object + * @returns {number} 0, if success (<0) is error + */ + buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) { + const arrSize = 12; + const cNumVerts = 8; + const numCells = meshRes - 1; + const side = meshRes; + const side2 = meshRes * meshRes; + const vaEdges = new Array(arrSize); + for (let i = 0; i < arrSize; i++) { + vaEdges[i] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + } + const sign = []; + for (let i = 0; i < cNumVerts; i++) { + sign[i] = 1.0; + } + const vCorner = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + let indCell = 0; + let indY = 0; + for (let y = 0; y < numCells; y++, indY += side2) { + let indZ = 0; + for (let z = 0; z < numCells; z++, indZ += side) { + for (let x = 0; x < numCells; x++) { + if (!cube.hasIntersection[indCell]) { + // next cell + indCell++; + continue; } - } else { - var fogFactor = Math$1.smoothstep(-this._vector.z, scene.fog.near, scene.fog.far); - element.style.color = lerpColorAsHex(object.userData.color, scene.fog.color, fogFactor); - - if (object.userData.background !== 'transparent') { - element.style.background = lerpColorAsHex(object.userData.background, scene.fog.color, fogFactor); + const bitsInside = cube.bitsInside[indCell]; + this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, meshRes, vCorner); + const indPointValues = indCell * (2 << 2 + 2); + for (let i = 0, j = 0; i < cNumVerts; i++) { + cube.pointsValuesLinear[indPointValues + j++] = vCorner.x; + cube.pointsValuesLinear[indPointValues + j++] = vCorner.y; + cube.pointsValuesLinear[indPointValues + j++] = vCorner.z; } - } - - this._vector.applyMatrix4(this._projectionMatrix); + cube.pointsValuesLinear[indPointValues + 3] += vCellStep.x; + cube.pointsValuesLinear[indPointValues + 2 * 3] += vCellStep.x; + cube.pointsValuesLinear[indPointValues + 5 * 3] += vCellStep.x; + cube.pointsValuesLinear[indPointValues + 6 * 3] += vCellStep.x; + cube.pointsValuesLinear[indPointValues + 2 * 3 + 2] += vCellStep.z; + cube.pointsValuesLinear[indPointValues + 3 * 3 + 2] += vCellStep.z; + cube.pointsValuesLinear[indPointValues + 6 * 3 + 2] += vCellStep.z; + cube.pointsValuesLinear[indPointValues + 7 * 3 + 2] += vCellStep.z; + cube.pointsValuesLinear[indPointValues + 4 * 3 + 1] += vCellStep.y; + cube.pointsValuesLinear[indPointValues + 5 * 3 + 1] += vCellStep.y; + cube.pointsValuesLinear[indPointValues + 6 * 3 + 1] += vCellStep.y; + cube.pointsValuesLinear[indPointValues + 7 * 3 + 1] += vCellStep.y; + + // now current cell has intersections (from -x to +x) on some cube edges + const indValues = indPointValues + 24; + for (let i = 0; i < cNumVerts; ++i) { + sign[i] = cube.pointsValuesLinear[indValues + i] < 0.0 ? 1 : 0; + } + this.buildEdgePoint(0, 1, sign, cube, indPointValues, vaEdges[0]); + this.buildEdgePoint(1, 2, sign, cube, indPointValues, vaEdges[1]); + this.buildEdgePoint(2, 3, sign, cube, indPointValues, vaEdges[2]); + this.buildEdgePoint(3, 0, sign, cube, indPointValues, vaEdges[3]); + this.buildEdgePoint(4, 5, sign, cube, indPointValues, vaEdges[4]); + this.buildEdgePoint(5, 6, sign, cube, indPointValues, vaEdges[5]); + this.buildEdgePoint(6, 7, sign, cube, indPointValues, vaEdges[6]); + this.buildEdgePoint(7, 4, sign, cube, indPointValues, vaEdges[7]); + this.buildEdgePoint(0, 4, sign, cube, indPointValues, vaEdges[8]); + this.buildEdgePoint(1, 5, sign, cube, indPointValues, vaEdges[9]); + this.buildEdgePoint(2, 6, sign, cube, indPointValues, vaEdges[10]); + this.buildEdgePoint(3, 7, sign, cube, indPointValues, vaEdges[11]); + const offs = bitsInside * (2 << 1 + 2); + for (let numTri = 0, indTri = 0; numTri < 2 + 2 + 2; numTri++, indTri += 3) { + // s_triIndicesMarchCube is external array, defined in mold_ind.js + const i0 = cube.striIndicesMarchCube[offs + indTri]; + if (i0 < 0) { + break; + } + const i1 = cube.striIndicesMarchCube[offs + indTri + 1]; + const i2 = cube.striIndicesMarchCube[offs + indTri + 2]; + if (!this.addTriangle(vaEdges[i0], vaEdges[i1], vaEdges[i2])) { + return 0 - 2; + } + } // for numTri - var style = "".concat(object.userData !== {} ? object.userData.translation : 'translate(-50%, -50%) ', "translate(").concat(this._vector.x * this._widthHalf + this._widthHalf, "px,").concat(-this._vector.y * this._heightHalf + this._heightHalf, "px)"); - element.style.visibility = visibility; - element.style.WebkitTransform = style; - element.style.MozTransform = style; - element.style.oTransform = style; - element.style.transform = style; - element.style.zIndex = Number(zIndex).toFixed(0); + // next cell (cube) + indCell++; + } // for (x) + } // for (z) + } // for (y) + return 0; + } - if (element.parentNode !== this._domElement) { - this._domElement.appendChild(element); - } - } + /** + * Returns number of cell with intersection with at least one sphere. + * Using this number, we can estimate required number of vertices + * and triangles to build result mesh. + * + * @param {number} side Number of points in cube voxels + * @param {number} numCells Number of cells in cube voxels (per direction) + * @param {array} corners Array of float values for cube corner points + * @param {object} cube IsoSurfaceMarchCube object + * @returns {number} numIntersectedCells + */ + getNumIntersectedCells(side, numCells, corners, cube) { + const side2 = side * side; + const cNumVerts = 8; + let numIntersectedCells = 0; + let indCell = 0; + let indY = 0; + for (let y = 0; y < numCells; y++, indY += side2) { + let indZ = 0; + for (let z = 0; z < numCells; z++, indZ += side) { + for (let x = 0; x < numCells; x++) { + const cubeValuesIndex = indCell * (2 << 2 + 2) + 24; + const indCorner = x + indZ + indY; + cube.pointsValuesLinear[cubeValuesIndex] = corners[indCorner]; + cube.pointsValuesLinear[cubeValuesIndex + 1] = corners[indCorner + 1]; + cube.pointsValuesLinear[cubeValuesIndex + 2] = corners[indCorner + side + 1]; + cube.pointsValuesLinear[cubeValuesIndex + 3] = corners[indCorner + side]; + cube.pointsValuesLinear[cubeValuesIndex + 4] = corners[side2 + indCorner]; + cube.pointsValuesLinear[cubeValuesIndex + 5] = corners[side2 + indCorner + 1]; + cube.pointsValuesLinear[cubeValuesIndex + 6] = corners[side2 + indCorner + side + 1]; + cube.pointsValuesLinear[cubeValuesIndex + 7] = corners[side2 + indCorner + side]; + + // check read exception + // assert(side2 + indCorner + side + 1 < side3); + + // get bit flags inside + let bitsInside = 0; + for (let i = 0; i < cNumVerts; ++i) { + if (cube.pointsValuesLinear[cubeValuesIndex + i] < 0.0) { + bitsInside |= 1 << i; + } + } + if (bitsInside === 0 || bitsInside === (1 << cNumVerts) - 1) { + cube.hasIntersection[indCell] = false; + } else { + cube.hasIntersection[indCell] = true; + numIntersectedCells++; + } + cube.bitsInside[indCell] = bitsInside; + // next cell + indCell++; + } // for (x) + } // for (z) + } // for (y) + return numIntersectedCells; + } + getType(letter) { + /* eslint-disable no-magic-numbers */ + const atomT = [0, 0, 1, 1, 2, 6, 3, 6, 4, 6, 5, 6, 6, 0, 7, 3, 8, 2, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 4, 16, 5, 17, 6, 18, 6, 19, 6, 20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6, 32, 6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, 45, 6, 46, 6, 47, 6, 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, 6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6, 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6, 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, 95, 6, 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, 6, 108, 6, 109, 6]; + /* eslint-enable no-magic-numbers */ - for (var i = 0, l = object.children.length; i < l; i++) { - this._renderObject(object.children[i], camera, scene); - } + if (letter < 1 || letter > atomT.length / 2 || Object.keys(SSIsosurfaceGeometry_Element.ByAtomicNumber).length * 2 !== atomT.length) { + throw new Error('atomT.length should be equal Element.ByAtomicNumber.length * 2'); } - }, { - key: "render", - value: function render(scene, camera) { - scene.updateMatrixWorld(); - - if (camera.parent === null) { - camera.updateMatrixWorld(); - } - - camera.matrixWorldInverse.getInverse(camera.matrixWorld); + return atomT[letter * 2]; + } - this._viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld)); + /** + * Calculate values for marching cube grid points + * positive values are outside sphere, negative - is inside + * + * @param {array} corners array of float values + * @param {number} side Number of point in cube in 1 dimennsion + * @param {Vector3} vBoxMin Bounding box min point + * @param {Vector3} vBoxMax Bounding box max point + * @param {array} atoms Array of input atoms + * @param {number} probeRad radius for atom probing + */ + calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) { + const side2 = side * side; + const side3 = side2 * side; + const vCorner = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const vDif = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + /* eslint-disable no-magic-numbers */ + const aLot = +1.0e12; + /* eslint-enable no-magic-numbers */ - this._projectionMatrix.copy(camera.projectionMatrix); + for (let i = 0; i < side3; i++) { + corners[i] = aLot; // to large value + } + const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x); + const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y); + const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z); + for (let s = 0, numAtoms = atoms.length; s < numAtoms; s++) { + const atom = atoms[s]; + const radius = atom.radius + probeRad; + const fx = (atom.coord.x - radius - vBoxMin.x) * xScale; + const fy = (atom.coord.y - radius - vBoxMin.y) * yScale; + const fz = (atom.coord.z - radius - vBoxMin.z) * zScale; + const indXMin = Math.floor(fx); + const indYMin = Math.floor(fy); + const indZMin = Math.floor(fz); + let indXMax = Math.floor((atom.coord.x + radius - vBoxMin.x) * xScale); + let indYMax = Math.floor((atom.coord.y + radius - vBoxMin.y) * yScale); + let indZMax = Math.floor((atom.coord.z + radius - vBoxMin.z) * zScale); + indXMax++; + indYMax++; + indZMax++; + indXMax = indXMax <= side - 1 ? indXMax : side - 1; + indYMax = indYMax <= side - 1 ? indYMax : side - 1; + indZMax = indZMax <= side - 1 ? indZMax : side - 1; + for (let y = indYMin; y <= indYMax; y++) { + const indY = y * side2; + for (let z = indZMin; z <= indZMax; z++) { + const indZ = z * side; + for (let x = indXMin; x <= indXMax; x++) { + const ind = indY + indZ + x; + this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, side, vCorner); + vDif.x = vCorner.x - atom.coord.x; + vDif.y = vCorner.y - atom.coord.y; + vDif.z = vCorner.z - atom.coord.z; + const distToSphere = Math.sqrt(vDif.x * vDif.x + vDif.y * vDif.y + vDif.z * vDif.z); + // val: < 0, if inside sphere + // val: > 0, if outside sphere + const val = distToSphere - radius; + if (val < corners[ind]) { + corners[ind] = val; + } + } // for (x) + } // for (z) + } // for (y) + } // for (s) + } - this._renderObject(scene, camera, scene); + /** + * Create memory pool for vertex hash management + * + * @param {number} maxNumVertices Maximum possible number of vertices (that will be build) + * @param {number} maxNumTriangles Maximum possible number of triangles (that will be build) + * @returns {number} 0, if success. (<0) is non memory + */ + createVertexHash(maxNumVertices, maxNumTriangles) { + this.hashLines = utils.allocateTyped(Int32Array, HASH_SIZE * 2); + if (this.hashLines === null) { + return 0 - 1; } - }]); - - return CSS2DRenderer; -}(); - -var VK_LEFT = 37; -var VK_UP = 38; -var VK_RIGHT = 39; -var VK_DOWN = 40; -var STATE = { - NONE: -1, - ROTATE: 0, - TRANSLATE: 1, - SCALE: 2, - TRANSLATE_PIVOT: 3 -}; // pausing for this amount of time before releasing mouse button prevents inertial rotation (seconds) - -var FULL_STOP_THRESHOLD = 0.1; -var quaternion = new Quaternion(); -var matrix4 = new Matrix4(); // pivot -- local offset of the rotation pivot point + for (let i = 0, j = 0; i < HASH_SIZE; i++) { + this.hashLines[j++] = 0; // num vertices in this hash line + this.hashLines[j++] = 0 - 1; // index of the first entry + } + this.maxNumVertices = maxNumVertices; + this.maxNumTriangles = maxNumTriangles; + this.numHashEtriesAllocated = maxNumVertices; + this.hashEntries = utils.allocateTyped(Int32Array, 2 * this.numHashEtriesAllocated); + if (this.hashEntries === null) { + return 0 - 1; + } + for (let i = 0, j = 0; i < this.numHashEtriesAllocated; i++) { + this.hashEntries[j++] = 0 - 1; // index of vertex + this.hashEntries[j++] = 0 - 1; // next hash entry index + } + this.numHashEntryIndex = 0; + return 0; + } -function ObjectHandler(objects, camera, pivot, options) { - this.objects = objects; + /** + * Allocate and return new hash entry. Just check possible amount. + * + * @returns {number} index of hash entry, that can be used for geometry add vertex functionality + */ + getNewHashEntry() { + if (this.numHashEntryIndex < this.numHashEtriesAllocated) { + const i = this.numHashEntryIndex; + this.numHashEntryIndex++; + return i; + } + return 0 - 1; + } - var _objects = slicedToArray(objects, 1); + /** + * Add vertex to geometry structure + * using vertex hash table to quickly check, is this vertex already exist in geometry + * + * @param {object} geoOut Geometry to build + * @param {Vector3} vAdd Vertex to add + * @returns {number} index of added (or existing) vertex in geometry. + */ + addVertexToGeo(geoOut, vAdd) { + let entry; + const oneHynberes = 0.01; + const n815851 = 815851; + const n37633 = 37633; + const n2453543 = 2453543; + const r106 = 1.0e-6; + const hashResolution = this.marCubeResoultion << 2; + const v = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const ix = Math.floor(hashResolution * (vAdd.x - this.vBoxMin.x) / (this.vBoxMax.x + oneHynberes - this.vBoxMin.x)); + const iy = Math.floor(hashResolution * (vAdd.y - this.vBoxMin.y) / (this.vBoxMax.y + oneHynberes - this.vBoxMin.y)); + const iz = Math.floor(hashResolution * (vAdd.z - this.vBoxMin.z) / (this.vBoxMax.z + oneHynberes - this.vBoxMin.z)); + let iHash = ix * n815851 + iz * n37633 + iy * n2453543; + iHash &= HASH_SIZE - 1; + const hLineIndex = iHash + iHash; + + // search vertex via hash + // search in hash list + if (this.vBoxMin !== null && this.vBoxMax !== null) { + for (entry = this.hashLines[hLineIndex + 1]; entry >= 0; entry = this.hashEntries[entry * 2 + 1]) { + const ind = this.hashEntries[entry * 2 + 0]; // vertex index + v.copy(geoOut._vertices[ind]); + v.x -= vAdd.x; + v.y -= vAdd.y; + v.z -= vAdd.z; + const dot2 = v.x * v.x + v.y * v.y + v.z * v.z; + if (dot2 < r106) { + return ind; + } // if (found) + } // for (entry) + } // search + + // add new vertex to geometry + if (geoOut._numVertices >= this.maxNumVertices) { + return 0 - 1; + } + const iVertAdd = geoOut._numVertices; + geoOut._vertices[iVertAdd].copy(vAdd); - this.object = _objects[0]; - this.camera = camera; - this.pivot = pivot; - this.axis = new Vector3(0, 0, 1); - this.options = options; - this.lastRotation = { - axis: new Vector3(), - angle: 0.0 - }; -} + // add to hash + if (this.vBoxMin !== null && this.vBoxMax !== null) { + entry = this.getNewHashEntry(); + if (entry < 0) { + return 0 - 1; + } + const entryFirst = this.hashLines[hLineIndex + 1]; + this.hashLines[hLineIndex + 1] = entry; + this.hashEntries[entry * 2 + 0] = iVertAdd; + this.hashEntries[entry * 2 + 1] = entryFirst; + this.hashLines[hLineIndex + 0]++; // num vertices in line ++ + } + geoOut._numVertices++; + return iVertAdd; + } -ObjectHandler.prototype._rotate = function () { - var p = new Vector3(); - var q = new Quaternion(); - var s = new Vector3(); - var m = new Matrix4(); - return function (quat) { - var zeroPivot = this.pivot.x === 0.0 && this.pivot.y === 0.0 && this.pivot.z === 0.0; - m.copy(this.object.matrix); + /** + * + * @param {number} side some placeholder description + * @param {number} probeSphereRadius some placeholder description + * @param {object} vBoxMin some placeholder description + * @param {object} vBoxMax some placeholder description + * @param {object} geoOut some placeholder description + * @param {object} corners some placeholder description + * @returns {number} always 0 + */ + modifyExcludedFromGeo(side, probeSphereRadius, vBoxMin, vBoxMax, geoOut, corners) { + let ind; + let distToSphere; + let distToBorder; + const r11 = 1.1; + function innerBlockWorkAround() { + if (distToBorder > 0.0) { + // point is inside probe sphere + if (corners[ind] < 0.0) { + corners[ind] = distToBorder; // was inside surface, now is oustide ( > 0) + } + if (distToBorder > corners[ind]) { + corners[ind] = distToBorder; // find positive maximum + } + } else if (distToBorder > corners[ind]) { + // point is outside sphere + corners[ind] = distToBorder; // find negative maximum + } + } + const side2 = side * side; + const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x); + const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y); + const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z); + const probeSpRad2 = probeSphereRadius * 2 * (probeSphereRadius * 2); + const sideInv = 1.0 / (side - 1); + for (let i = 0; i < geoOut._numVertices; i++) { + const vCenter = geoOut._vertices[i]; + const radEst = probeSphereRadius * r11; + let indXMin = Math.floor((vCenter.x - radEst - vBoxMin.x) * xScale); + let indYMin = Math.floor((vCenter.y - radEst - vBoxMin.y) * yScale); + let indZMin = Math.floor((vCenter.z - radEst - vBoxMin.z) * zScale); + let indXMax = Math.floor((vCenter.x + radEst - vBoxMin.x) * xScale); + let indYMax = Math.floor((vCenter.y + radEst - vBoxMin.y) * yScale); + let indZMax = Math.floor((vCenter.z + radEst - vBoxMin.z) * zScale); + indXMin = indXMin >= 0 ? indXMin : 0; + indYMin = indYMin >= 0 ? indYMin : 0; + indZMin = indZMin >= 0 ? indZMin : 0; + indXMax = indXMax <= side - 1 ? indXMax : side - 1; + indYMax = indYMax <= side - 1 ? indYMax : side - 1; + indZMax = indZMax <= side - 1 ? indZMax : side - 1; + for (let iy = indYMin; iy <= indYMax; iy++) { + const indY = iy * side2; + for (let iz = indZMin; iz <= indZMax; iz++) { + const indZ = iz * side; + for (let ix = indXMin; ix <= indXMax; ix++) { + ind = indY + indZ + ix; + // getCornerCoord(vBoxMin, vBoxMax, ix, iy, iz, side, &vCorner); + let t = ix * sideInv; + const xCorner = vBoxMin.x * (1.0 - t) + vBoxMax.x * t; + t = iy * sideInv; + const yCorner = vBoxMin.y * (1.0 - t) + vBoxMax.y * t; + t = iz * sideInv; + const zCorner = vBoxMin.z * (1.0 - t) + vBoxMax.z * t; + const dx = xCorner - vCenter.x; + const dy = yCorner - vCenter.y; + const dz = zCorner - vCenter.z; + const dist2 = dx * dx + dy * dy + dz * dz; + if (dist2 < probeSpRad2) { + distToSphere = Math.sqrt(dist2); + distToBorder = -(distToSphere - probeSphereRadius); + innerBlockWorkAround(); + } // if (dist from corner point to sphere center more 2 radiuses) + } // for (ix) + } // for (iz) + } // for (iy) + } // for (i) all geo vertices + return 0; + } + _innerBuild() { + let ok; + const expandFactor = 1.2; - if (zeroPivot) { - m.multiply(matrix4.makeRotationFromQuaternion(quat)); - } else { - m.multiply(matrix4.makeTranslation(this.pivot.x, this.pivot.y, this.pivot.z)); - m.multiply(matrix4.makeRotationFromQuaternion(quat)); - m.multiply(matrix4.makeTranslation(-this.pivot.x, -this.pivot.y, -this.pivot.z)); + // performance test + // this.performanceTest(); + + // Create temporary atoms (but colored) + const packedArrays = { + posRad: this._posRad, + colors: this._colors, + atoms: this._opts.atoms + }; + this.complex = this._opts.parent; + this.atoms = packedArrays.atoms; + this.meshResolution = this._opts.gridSpacing; + this.atomRadiusScale = this._opts.radScale; + this.colorMode = this._opts.colorMode; + this.probeRadius = this._opts.probeRadius; + this.useVertexColors = true; + this.excludeProbe = this._opts.excludeProbe; + this.visibilitySelector = this._opts.visibilitySelector; + this.geoOut = null; + this.hashLines = null; + this.hashEntries = null; + this.numHashEtriesAllocated = 0; + this.numHashEntryIndex = 0; + this.maxNumVertices = 0; + this.maxNumTriangles = 0; + const atomsColored = new Array(this.atoms.length); + this.convertToAtomsColored(packedArrays, atomsColored); + + // find bbox for spheres scene + const vBoxMin = this.vBoxMin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const vBoxMax = this.vBoxMax = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this.getBoundingBox(atomsColored, vBoxMin, vBoxMax); + const marCubeResoultion = this.marCubeResoultion = this.meshResolution * (2 + 2); + + // build grid corners for Marching cube algorithm + const side = marCubeResoultion; + const side2 = side * side; + const side3 = side2 * side; + const corners = utils.allocateTyped(Float32Array, side3); + const rProbeRadius = this.probeRadius * this.atomRadiusScale; + this.calculateGridCorners(corners, side, vBoxMin, vBoxMax, atomsColored, rProbeRadius); + const numCells = marCubeResoultion - 1; + const cube = new geometries_IsoSurfaceMarchCube(); + ok = cube.create(numCells); + if (ok < 0) { + return ok; + } + // copy corners to cells + const vCellStep = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + vCellStep.x = (vBoxMax.x - vBoxMin.x) / numCells; + vCellStep.y = (vBoxMax.y - vBoxMin.y) / numCells; + vCellStep.z = (vBoxMax.z - vBoxMin.z) / numCells; + let numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube); + let maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor); + let maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2); + this.geoOut = new geometries_IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors); + ok = this.createVertexHash(maxNumVertices, maxNumTriangles); + if (ok < 0) { + return ok; } - m.decompose(p, q, s); // update objects + // build voxel world (used to check triangle-to-atom tie and to calculate normals and colors) + let probeRadForNormalsColors = rProbeRadius; + if (this.excludeProbe) { + probeRadForNormalsColors = 0.01; + } + this.voxelWorld = new geometries_IsosurfaceBuildNormals(atomsColored.length, atomsColored, vBoxMin, vBoxMax, probeRadForNormalsColors); + this.voxelWorld.createVoxels(); + ok = this.buildGeoFromCorners(marCubeResoultion, vBoxMin, vBoxMax, corners, vCellStep, cube); + if (this.excludeProbe) { + // using 3d mesh (geoOut) as a surface points + // move probe sphere and try to minimuze corners values + this.modifyExcludedFromGeo(side, rProbeRadius, vBoxMin, vBoxMax, this.geoOut, corners); + + // delete old builded geo + this.geoOut._vertices = null; + this.geoOut._colors = null; + this.geoOut._indices = null; + this.geoOut._normals = null; + this.geoOut._numVertices = 0; + this.geoOut._numTriangles = 0; + this.geoOut = null; - if (!zeroPivot) { - for (var i = 0; i < this.objects.length; ++i) { - this.objects[i].position.copy(p); + // estimage geo vertices budget again + numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube); + maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor); + maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2); + + // creates empty new geometry + this.geoOut = new geometries_IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors); + ok = this.createVertexHash(maxNumVertices, maxNumTriangles); + if (ok < 0) { + return ok; } + // build vertices and triangles from corners values + ok = this.buildGeoFromCorners(side, vBoxMin, vBoxMax, corners, vCellStep, cube); } - for (var j = 0; j < this.objects.length; ++j) { - this.objects[j].quaternion.copy(q); - this.objects[j].updateMatrix(); + // build vertex normals + this.voxelWorld.buildNormals(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._normals); + // More value : more smooth color mixing + // value about 0.7: very rough colors borders + let radiusColorSmoothness = 6.5; + if (this.excludeProbe) { + radiusColorSmoothness -= 1.5; } - }; -}(); + if (this.useVertexColors) { + this.voxelWorld.buildColors(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._colors, radiusColorSmoothness); + } + this.voxelWorld.destroyVoxels(); + this.voxelWorld = null; -ObjectHandler.prototype.setObjects = function (objects) { - this.objects = objects; + // remove objects + cube.destroy(); + return ok; + } +} - var _objects2 = slicedToArray(objects, 1); +// All code below must be erased from every device and each developer's memory - this.object = _objects2[0]; -}; +/* harmony default export */ const geometries_SSIsosurfaceGeometry = (SSIsosurfaceGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/LabelsGeometry.js -ObjectHandler.prototype.rotate = function () { - var rot = { - axis: new Vector3(), - angle: 0.0 - }; - return function (quat, mousePrevPos, mouseCurPos, aboutAxis) { - this.mouse2rotation(rot, mousePrevPos, mouseCurPos, aboutAxis); - quat.setFromAxisAngle(rot.axis, rot.angle); - if (rot.angle) { - this._rotate(quat); +function createLabel(fieldTxt, className) { + const text = document.createElement('div'); + text.className = className; + if (typeof fieldTxt === 'string') { + const spanText = document.createElement('span'); + spanText.style.fontSize = '150%'; + const strings = fieldTxt.split('\n'); + for (let i = 0, n = strings.length; i < n; ++i) { + const spanNodeP = document.createElement('span'); + const spanNodeText = document.createTextNode(strings[i]); + spanNodeP.appendChild(spanNodeText); + spanText.appendChild(spanNodeP); + if (i < n - 1) { + spanText.appendChild(document.createElement('br')); + } + } + text.appendChild(spanText); + } else { + text.appendChild(fieldTxt); + } + text.worldPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + return text; +} +class LabelsGeometry extends utils_EventDispatcher { + constructor(instanceCount, opts) { + super(); + this._opts = opts; + this.items = []; + this.needsUpdate = false; + let xTranslation = -50; + let yTranslation = -50; + switch (opts.horizontalAlign) { + case 'left': + xTranslation = 0; + break; + case 'right': + xTranslation = -100; + break; + default: + break; + } + switch (opts.verticalAlign) { + case 'top': + yTranslation = -100; + break; + case 'bottom': + yTranslation = 0; + break; + default: + break; } + const deltaPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(opts.dx || 0, opts.dy || 0, opts.dz || 0); + this.userData = { + translation: `translate(${xTranslation}%, ${yTranslation}%)`, + offset: deltaPos + }; + } + setItem(itemIdx, itemPos, fieldTxt) { + const opts = this._opts; + const text = this.items[itemIdx] || createLabel(fieldTxt, 'label'); + text.worldPos.copy(itemPos); + text.style.textAlign = opts.horizontalAlign; + text.style.verticalAlign = opts.verticalAlign; + this.items[itemIdx] = text; + } + setColor(itemIdx, fColor, bColor) { + const text = this.items[itemIdx]; + text.opts = { + color: fColor, + background: bColor + }; + } + startUpdate() { + return true; + } + finishUpdate() { + this.needsUpdate = true; + this.dispatchEvent({ + type: 'update' + }); + } + finalize() { + this.finishUpdate(); + } - this.lastRotation = rot; - }; -}(); + // unimplemented functions + raycast() {} + setOpacity() {} + getSubset() { + return []; + } +} +/* harmony default export */ const geometries_LabelsGeometry = (LabelsGeometry); +;// CONCATENATED MODULE: ./src/gfx/geometries/geometries.js -ObjectHandler.prototype.translate = function () { - var dir = new Vector3(); - var pivot = new Vector3(); - return function (delta) { - // reverse-project viewport movement to view coords (compensate for screen aspect ratio) - dir.set(delta.x / this.camera.projectionMatrix.elements[0], delta.y / this.camera.projectionMatrix.elements[5], 0); - var dist = dir.length(); - dir.normalize(); // transform movement direction to object local coords - dir.transformDirection(matrix4.getInverse(this.object.matrixWorld)); // visible translate distance shouldn't depend on camera-to-object distance - pivot.copy(this.pivot); - this.object.localToWorld(pivot); - dist *= Math.abs(pivot.z - this.camera.position.z); // visible translate distance shouldn't depend on object scale - dist /= this.object.matrixWorld.getMaxScaleOnAxis(); // all objects are translated similar to principal object - // (we assume they all have identical pivot and scale) - for (var i = 0; i < this.objects.length; ++i) { - this.objects[i].translateOnAxis(dir, dist); - } - }; -}(); -ObjectHandler.prototype.update = function () { - var axis = new Vector3(); - return function (timeSinceLastUpdate, timeSinceMove) { - if (settings.now.autoRotation !== 0.0) { - // auto-rotation with constant speed - // if rotation axis is fixed or hasn't been defined yet - if (settings.now.autoRotationAxisFixed || this.lastRotation.axis.length() === 0.0) { - // use Y-axis (transformed to local object coords) - axis.set(0, 1, 0).transformDirection(matrix4.getInverse(this.object.matrixWorld)); - } else { - // use axis defined by last user rotation - axis.copy(this.lastRotation.axis); - } - this._rotate(quaternion.setFromAxisAngle(axis, settings.now.autoRotation * timeSinceLastUpdate)); - return true; - } - if (this.options.intertia && this.lastRotation.angle) { - // inertial object rotation - var angle = this.lastRotation.angle * Math.pow(1.0 - this.options.dynamicDampingFactor, 40.0 * timeSinceMove); - if (Math.abs(angle) <= this.options.intertiaThreshold) { - this.lastRotation.angle = 0.0; - } else { - this._rotate(quaternion.setFromAxisAngle(this.lastRotation.axis, angle)); - return true; - } - } - return false; - }; -}(); +/* harmony default export */ const geometries = ({ + InstancedSpheresGeometry: geometries_InstancedSpheresGeometry, + SimpleSpheresGeometry: geometries_SimpleSpheresGeometry, + Simple2CCylindersGeometry: geometries_Simple2CCylindersGeometry, + Instanced2CCylindersGeometry: geometries_Instanced2CCylindersGeometry, + ExtrudedObjectsGeometry: geometries_ExtrudedObjectsGeometry, + ChunkedLinesGeometry: geometries_ChunkedLinesGeometry, + TwoColorLinesGeometry: geometries_TwoColorLinesGeometry, + CrossGeometry: geometries_CrossGeometry, + QuickSurfGeometry: geometries_QuickSurfGeometry, + ContactSurfaceGeometry: geometries_ContactSurfaceGeometry, + SSIsosurfaceGeometry: geometries_SSIsosurfaceGeometry, + LabelsGeometry: geometries_LabelsGeometry +}); +;// CONCATENATED MODULE: ./src/gfx/shaders/Uber.vert +const Uber_namespaceObject = "float INSTANCED_SPRITE_OVERSCALE = 1.3;\r\n\r\nattribute vec3 normal;\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n varying vec3 viewNormal;\r\n#endif\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n varying vec3 vNormal;\r\n#endif\r\n\r\n#ifdef THICK_LINE\r\n attribute vec4 position; // W contains vert pos or neg offset\r\n#else\r\n attribute vec3 position;\r\n#endif\r\n\r\nvarying vec3 vWorldPosition;\r\nvarying vec3 vViewPosition;\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n attribute float alphaColor;\r\n varying float alphaCol;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n attribute vec3 color;\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n attribute vec3 color2;\r\n varying vec3 vColor2;\r\n attribute vec2 uv;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_POS\r\n attribute vec4 offset;\r\n #ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n varying vec4 spritePosEye;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n attribute vec4 matVector1;\r\n attribute vec4 matVector2;\r\n attribute vec4 matVector3;\r\n attribute vec4 invmatVector1;\r\n attribute vec4 invmatVector2;\r\n attribute vec4 invmatVector3;\r\n\r\n #ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n varying vec4 spritePosEye;\r\n #endif\r\n#endif\r\n\r\nuniform mat4 modelViewMatrix; // optional\r\nuniform mat4 projectionMatrix; // optional\r\nuniform mat3 normalMatrix; // optional\r\nuniform mat4 modelMatrix; // optional\r\n\r\n#ifdef DASHED_LINE\r\n attribute float lineDistance;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n#ifdef THICK_LINE\r\n attribute vec3 direction;\r\n uniform mat4 projMatrixInv;\r\n uniform vec2 viewport;\r\n uniform float lineWidth;\r\n\r\n vec4 transform(vec4 coord){\r\n return projectionMatrix * modelViewMatrix * coord;\r\n }\r\n\r\n vec2 project(vec4 device){\r\n vec3 device_normal = device.xyz/device.w;\r\n vec2 clip_pos = (device_normal*0.5+0.5).xy;\r\n return clip_pos * viewport;\r\n }\r\n\r\n vec4 unproject(vec2 screen, float z, float w){\r\n vec2 clip_pos = screen/viewport;\r\n vec2 device_normal = clip_pos*2.0-1.0;\r\n return vec4(device_normal*w, z, w);\r\n }\r\n#endif\r\n\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n alphaCol = alphaColor;\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n vec3 objectNormal = vec3(\r\n dot(normal, matVector1.xyz),\r\n dot(normal, matVector2.xyz),\r\n dot(normal, matVector3.xyz));\r\n#else\r\n vec3 objectNormal = vec3( normal );\r\n#endif\r\n\r\nvec3 transformedNormal = normalMatrix * objectNormal;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n vNormal = normalize(transformedNormal);\r\n#endif\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n viewNormal = normalize(mat3(modelViewMatrix)*objectNormal);\r\n#endif\r\n\r\n vec4 localPos = vec4(position.xyz, 1.0);\r\n vec4 worldPos = modelMatrix * localPos;\r\n vec4 mvPosition = modelViewMatrix * localPos;\r\n\r\n// make thick line offset\r\n#ifdef THICK_LINE\r\n // get screen pos\r\n vec4 dPos = transform(vec4(position.xyz, 1.0));\r\n vec2 sPos = project(dPos);\r\n // move pos forward\r\n vec3 position2 = position.xyz + direction.xyz * 0.5;\r\n // get screen offset pos\r\n vec4 dPos2 = transform(vec4(position2.xyz, 1.0));\r\n vec2 sPos2 = project(dPos2);\r\n // screen line direction\r\n vec2 sDir = normalize(sPos2 - sPos);\r\n // vertex offset (orthogonal to line direction)\r\n vec2 offset1 = vec2(-sDir.y, sDir.x);\r\n // move screen vertex\r\n vec2 newPos = sPos + offset1 * position.w * lineWidth;\r\n // get moved pos in view space\r\n vec4 dNewPos = unproject(newPos, dPos.z, dPos.w);\r\n mvPosition.xyz = (projMatrixInv * dNewPos).xyz;\r\n#endif // THICK_LINE\r\n\r\n#ifdef INSTANCED_POS\r\n #ifdef SPHERE_SPRITE\r\n instOffset = offset;\r\n\r\n vec4 posEye = modelViewMatrix * vec4( offset.xyz, 1.0 );\r\n float scale = length(modelViewMatrix[0]);\r\n mvPosition = posEye + vec4( position.xyz * offset.w * scale * INSTANCED_SPRITE_OVERSCALE, 0.0 );\r\n posEye.w = offset.w * scale;\r\n\r\n spritePosEye = posEye;\r\n #else\r\n localPos = vec4( offset.xyz + position.xyz * offset.w, 1.0 );\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n#ifdef INSTANCED_MATRIX\r\n #ifdef CYLINDER_SPRITE\r\n matVec1 = matVector1;\r\n matVec2 = matVector2;\r\n matVec3 = matVector3;\r\n invmatVec1 = invmatVector1;\r\n invmatVec2 = invmatVector2;\r\n invmatVec3 = invmatVector3;\r\n\r\n // calculate eye coords of cylinder endpoints\r\n vec4 v = vec4(0, -0.5, 0, 1);\r\n vec4 p1 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n v.y = 0.5;\r\n vec4 p2 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r\n\r\n // sprite is placed at the center of cylinder\r\n vec4 posEye;\r\n posEye.xyz = mix(p1.xyz, p2.xyz, 0.5);\r\n posEye.w = 1.0;\r\n spritePosEye = posEye;\r\n\r\n // cylinder radius in eye space\r\n float rad = length(modelViewMatrix[0]) * length(vec3(matVector1.x, matVector2.x, matVector3.x));\r\n vec2 spriteSize;\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // In ortho projection we skip z coordinate\r\n // basic sprite size at screen plane (covers only cylinder axis)\r\n vec2 spriteSizeScreen = abs(p2.xy - p1.xy);\r\n\r\n spriteSize = vec2(1.0, 1.0) * INSTANCED_SPRITE_OVERSCALE * (spriteSizeScreen + 2.0 * rad);\r\n #else\r\n // basic sprite size at screen plane (covers only cylinder axis)\r\n vec2 spriteSizeScreen = abs(p2.xy / p2.z - p1.xy / p1.z);\r\n\r\n // full sprite size in eye coords\r\n float minZ = min(abs(p1.z), abs(p2.z));\r\n spriteSize = vec2(1.0, 1.0) * INSTANCED_SPRITE_OVERSCALE * abs(posEye.z) * (spriteSizeScreen + 2.0 * rad / minZ);\r\n #endif\r\n\r\n mvPosition = posEye + vec4( position.xy * 0.5 * spriteSize, 0, 0 );\r\n #else\r\n localPos = vec4(dot(localPos, matVector1), dot(localPos, matVector2), dot(localPos, matVector3), 1.0);\r\n worldPos = modelMatrix * localPos;\r\n mvPosition = modelViewMatrix * localPos;\r\n #endif\r\n#endif\r\n\r\n gl_Position = projectionMatrix * mvPosition;\r\n\r\n vWorldPosition = worldPos.xyz;\r\n vViewPosition = - mvPosition.xyz;\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t vec4 worldPosition;\r\n\t // see THREE.WebGLProgram.unrollLoops\r\n\t #pragma unroll_loop_start\r\n\t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * vec4(vWorldPosition, 1.0);\r\n vDirectionalShadowNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(objectNormal, 0.0))).xyz;\r\n\t }\r\n\t #pragma unroll_loop_end\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n vColor = color.xyz;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n vColor2 = color2;\r\n #ifndef CYLINDER_SPRITE\r\n vUv = uv;\r\n #endif\r\n#endif\r\n\r\n#ifdef DASHED_LINE\r\n vLineDistance = lineDistance;\r\n#endif\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/Uber.frag +const gfx_shaders_Uber_namespaceObject = "#if defined (NORMALS_TO_G_BUFFER)\r\n #define fragColor gl_FragData[0]\r\n#else\r\n #define fragColor gl_FragColor\r\n#endif\r\n\r\n#ifdef ATTR_ALPHA_COLOR\r\n varying float alphaCol;\r\n#endif\r\n\r\n#ifdef COLOR_FROM_POS\r\n uniform mat4 world2colorMatrix;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n\t#if NUM_DIR_LIGHTS > 0\r\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\r\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ]; //only for sprites\r\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r\n\t\tvarying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r\n vec4 vDirLightWorldCoord[ NUM_DIR_LIGHTS ];\r\n vec3 vDirLightWorldNormal[ NUM_DIR_LIGHTS ];\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n // We use 4 instead uniform variable or define because this value is used in for(... i < value; ...) with\r\n // unroll_loop and unroll_loop has pattern:\r\n // /#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g\r\n uniform vec2 samplesKernel[4]; // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n uniform sampler2D noiseTex;\r\n uniform vec2 noiseTexelSize;\r\n uniform vec2 srcTexelSize;\r\n uniform mat4 projectionMatrix;\r\n #endif\r\n\t#endif\r\n#endif\r\n\r\n#ifdef ATTR_COLOR\r\n varying vec3 vColor;\r\n#endif\r\n\r\n#ifdef ATTR_COLOR2\r\n varying vec3 vColor2;\r\n #ifndef CYLINDER_SPRITE\r\n varying vec2 vUv;\r\n #endif\r\n#endif\r\n\r\nuniform vec3 diffuse;\r\nuniform vec3 emissive;\r\nuniform vec3 specular;\r\nuniform float shininess;\r\nuniform vec3 fixedColor;\r\nuniform float opacity;\r\nuniform float zClipValue;\r\nuniform float clipPlaneValue;\r\n\r\n#ifdef NORMALS_TO_G_BUFFER\r\n varying vec3 viewNormal;\r\n#endif\r\n\r\n#define RECIPROCAL_PI 0.31830988618\r\n#define saturate(a) clamp( a, 0.0, 1.0 )\r\n\r\n#ifdef USE_FOG\r\n uniform vec3 fogColor;\r\n uniform float fogAlpha;\r\n uniform float fogNear;\r\n uniform float fogFar;\r\n#endif\r\n\r\nvarying vec3 vWorldPosition; // world position of the pixel (invalid when INSTANCED_SPRITE is defined)\r\nvarying vec3 vViewPosition;\r\n\r\n#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n varying vec3 vNormal;\r\n#endif\r\n\r\n/////////////////////////////////////////// ZSprites ////////////////////////////////////////////////\r\n#if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r\n uniform float nearPlaneValue;\r\n#endif\r\n\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 spritePosEye;\r\n#endif\r\n\r\n#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n uniform float zOffset;\r\n\r\n #if !defined(USE_LIGHTS) || !defined(SHADOWMAP) || !defined(SHADOWMAP_PCF_RAND) || !(NUM_DIR_LIGHTS > 0)\r\n uniform mat4 projectionMatrix;\r\n #endif\r\n\r\n float calcDepthForSprites(vec4 pixelPosEye, float zOffset, mat4 projMatrix) {\r\n vec4 pixelPosScreen = projMatrix * pixelPosEye;\r\n return 0.5 * (pixelPosScreen.z / pixelPosScreen.w + 1.0) + zOffset;\r\n }\r\n#endif\r\n\r\n#ifdef SPHERE_SPRITE\r\n varying vec4 instOffset;\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n\r\n bool intersect_ray_sphere(in vec3 origin, in vec3 ray, out vec3 point, out float frontFaced) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray, ray);\r\n float b = dot(ray, origin);\r\n float c = dot(origin, origin) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return false;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n // choose nearest point inside frustum\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // orthografic camera is used for dirLight sources. So in it for all spheres the point with smaller 't' is visible\r\n // t1 is always smaller than t2 (from calculations)\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n #else\r\n // for perspective camera first intersection can be in front of near plane. If not intersection is p1 else - p2\r\n // t* = 0.0 corresponds to point of intersection near plane by the ray from camera to curPixel\r\n if (t1 >= 0.0) {\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n }\r\n if (t2 >= 0.0) {\r\n point = p2;\r\n frontFaced = -1.0;\r\n return true;\r\n }\r\n #endif\r\n\r\n return false;\r\n }\r\n\r\n bool get_sphere_point(in vec3 pixelPosEye, out vec3 point, out float frontFaced) {\r\n vec3 origin, ray;\r\n\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // transform vector from sprite center to curPixel into sphere local coords\r\n origin = pixelPosEye.xyz - spritePosEye.xyz;\r\n origin = (invModelViewMatrix * vec4(origin, 0.0)).xyz / instOffset.w;\r\n\r\n // transform camera orientation vector into sphere local coords\r\n ray = (invModelViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\r\n #else\r\n // find point of intersection near plane by the ray from camera to curPixel\r\n vec4 v = vec4(-(nearPlaneValue / pixelPosEye.z) * pixelPosEye, 1.0);\r\n\r\n // transform intersection point into sphere local coords\r\n v = invModelViewMatrix * v;\r\n origin = (v.xyz - instOffset.xyz) / instOffset.w;\r\n\r\n // transform vector from camera pos to curPixel into sphere local coords\r\n ray = (invModelViewMatrix * vec4(pixelPosEye, 0.0)).xyz;\r\n #endif\r\n ray = normalize(ray);\r\n\r\n return intersect_ray_sphere(origin, ray, point, frontFaced);\r\n }\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n varying vec4 matVec1;\r\n varying vec4 matVec2;\r\n varying vec4 matVec3;\r\n varying vec4 invmatVec1;\r\n varying vec4 invmatVec2;\r\n varying vec4 invmatVec3;\r\n\r\n uniform mat4 modelMatrix;\r\n uniform mat4 modelViewMatrix;\r\n uniform mat4 invModelViewMatrix;\r\n uniform mat3 normalMatrix;\r\n\r\n varying vec4 spritePosEye;\r\n\r\n bool intersect_ray_cylinder(in vec3 origin, in vec3 ray, out vec3 point, out float frontFaced) {\r\n\r\n // intersect XZ-projected ray with circle\r\n float a = dot(ray.xz, ray.xz);\r\n float b = dot(ray.xz, origin.xz);\r\n float c = dot(origin.xz, origin.xz) - 1.0;\r\n float det = b * b - a * c;\r\n if (det < 0.0) return false;\r\n float t1 = (-b - sqrt(det)) / a;\r\n float t2 = (-b + sqrt(det)) / a;\r\n\r\n // calculate both intersection points\r\n vec3 p1 = origin + ray * t1;\r\n vec3 p2 = origin + ray * t2;\r\n\r\n float halfHeight = 0.5;\r\n\r\n // choose nearest point\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // orthografic camera is used for dirLight sources. So in it for all cylinders the point with smaller 't' is visible\r\n // if it is not outside of cylinnder (t1 is always smaller than t2).\r\n if (p1.y >= -halfHeight && p1.y <= halfHeight) {\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n }\r\n if (p2.y >= -halfHeight && p2.y <= halfHeight) {\r\n point = p2;\r\n frontFaced = -1.0;\r\n return true;\r\n }\r\n #else\r\n // for perspective camera first intersection can be in front of near plane. If not intersection is p1 else - p2\r\n // t* = 0.0 corresponds to point of intersection near plane by the ray from camera to curPixel\r\n if (t1 >= 0.0 && p1.y >= -halfHeight && p1.y <= halfHeight) {\r\n point = p1;\r\n frontFaced = 1.0;\r\n return true;\r\n }\r\n if (t2 >= 0.0 && p2.y >= -halfHeight && p2.y <= halfHeight) {\r\n point = p2;\r\n frontFaced = -1.0;\r\n return true;\r\n }\r\n #endif\r\n\r\n return false;\r\n }\r\n\r\n bool get_cylinder_point(in vec3 pixelPosEye, out vec3 point, out float frontFaced) {\r\n vec3 origin, ray;\r\n vec4 v;\r\n\r\n #ifdef ORTHOGRAPHIC_CAMERA\r\n // transform vector from sprite center to curPixel into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye.xyz - spritePosEye.xyz, 0.0);\r\n origin = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n\r\n // transform camera orientation vector into cylinder local coords\r\n v = invModelViewMatrix * vec4(0.0, 0.0, -1.0, 0.0);\r\n ray = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n #else\r\n // find point of intersection near plane by the ray from camera to curPixel\r\n v = vec4(-(nearPlaneValue / pixelPosEye.z) * pixelPosEye, 1.0);\r\n\r\n // transform intersection point into cylinder local coords\r\n v = invModelViewMatrix * v;\r\n origin = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n\r\n // transform vector from camera pos to curPixel into cylinder local coords\r\n v = invModelViewMatrix * vec4(pixelPosEye, 0.0);\r\n ray = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r\n #endif\r\n ray = normalize(ray);\r\n\r\n return intersect_ray_cylinder(origin, ray, point, frontFaced);\r\n }\r\n#endif\r\n\r\n///////////////////////////////////// Pack and unpack ///////////////////////////////////////////////\r\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\r\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\r\n\r\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\r\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\r\n\r\n\r\nconst float ShiftRight8 = 1. / 256.;\r\n\r\nvec4 packDepthToRGBA( const in float v ) {\r\n vec4 r = vec4( fract( v * PackFactors ), v );\r\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\r\n return r * PackUpscale;\r\n}\r\n\r\nfloat unpackRGBAToDepth( const in vec4 v ) {\r\n return dot( v, UnpackFactors );\r\n}\r\n\r\n////////////////////////////////////////// All Lighting /////////////////////////////////////////////////\r\n#ifdef TOON_SHADING\r\n #define LOW_TOON_BORDER 0.0\r\n #define MEDIUM_TOON_BORDER 0.7\r\n #define HIGH_TOON_BORDER 1.0\r\n\r\n #define MEDIUM_TOON_RANGE 0.5\r\n #define HIGH_TOON_RANGE 0.95\r\n#endif\r\n#if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n struct ReflectedLight {\r\n vec3 directDiffuse;\r\n vec3 directSpecular;\r\n vec3 indirectDiffuse;\r\n };\r\n\r\n struct BlinnPhongMaterial {\r\n vec3 diffuseColor;\r\n vec3 specularColor;\r\n float specularShininess;\r\n };\r\n\r\n struct GeometricContext {\r\n vec3 normal;\r\n vec3 viewDir;\r\n };\r\n\r\n struct DirectionalLight {\r\n vec3 direction;\r\n vec3 color;\r\n };\r\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\r\n\r\n struct DirectionalLightShadow {\r\n vec2 shadowMapSize;\r\n float shadowBias;\r\n float shadowRadius;\r\n };\r\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHTS ];\r\n\r\n uniform vec3 ambientLightColor;\r\n\r\n /////////////////////////////////////////// Shadowmap ////////////////////////////////////////////////\r\n\r\n #if defined(SHADOWMAP)\r\n \tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\r\n \t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\r\n \t}\r\n\r\n float getShadow( sampler2D shadowMap, DirectionalLightShadow dirLight, vec4 shadowCoord, vec3 vViewPosition, vec3 vNormal ) {\r\n \t float shadow = 0.0;\r\n\r\n // When shadows for sprites will appear use here for them normals as it done for G-buffer\r\n shadowCoord.xyz += dirLight.shadowBias * vNormal;\r\n shadowCoord.xyz /= shadowCoord.w;\r\n\r\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\r\n bool inFrustum = all( inFrustumVec );\r\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\r\n bool frustumTest = all( frustumTestVec );\r\n\r\n if ( frustumTest ) {\r\n #ifdef SHADOWMAP_BASIC\r\n \t shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\r\n \t#endif\r\n\r\n \t#ifdef SHADOWMAP_PCF_SHARP\r\n \t vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n float dx0 = - texelSize.x * dirLight.shadowRadius;\r\n float dy0 = - texelSize.y * dirLight.shadowRadius;\r\n float dx1 = + texelSize.x * dirLight.shadowRadius;\r\n float dy1 = + texelSize.y * dirLight.shadowRadius;\r\n\r\n shadow = (\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\r\n \ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\r\n ) * ( 1.0 / 9.0 );\r\n #endif\r\n\r\n #ifdef SHADOWMAP_PCF_RAND\r\n vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r\n\r\n vec4 vUv = ((projectionMatrix * vec4(vViewPosition, 1.0)) + 1.0) / 2.0;\r\n vec2 vUvNoise = vUv.xy / srcTexelSize * noiseTexelSize;\r\n\r\n vec2 noiseVec = normalize(texture2D(noiseTex, vUvNoise).rg);\r\n mat2 mNoise = mat2(noiseVec.x, noiseVec.y, -noiseVec.y, noiseVec.x);\r\n\r\n vec2 offset;\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < 4; i ++ ) { // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n offset = mNoise * ( normalize( samplesKernel[ i ]) * texelSize * dirLight.shadowRadius );\r\n shadow += texture2DCompare( shadowMap, shadowCoord.xy + offset, shadowCoord.z );\r\n }\r\n #pragma unroll_loop_end\r\n shadow /= float( 4 ); // 4 is length of _samplesKernel which is defined in UberMaterial.js\r\n #endif\r\n }\r\n return shadow;//(shadow != 1.0) ? 0.5 : 1.0;//vec4(shadow, shadow, shadow, 1.0);\r\n }\r\n #endif\r\n\r\n /////////////////////////////////////////// Lighting /////////////////////////////////////////////////\r\n\r\n vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\r\n return RECIPROCAL_PI * diffuseColor;\r\n } // validated\r\n\r\n vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\r\n // Original approximation by Christophe Schlick '94\r\n //;float fresnel = pow( 1.0 - dotLH, 5.0 );\r\n // Optimized variant (presented by Epic at SIGGRAPH '13)\r\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\r\n return ( 1.0 - specularColor ) * fresnel + specularColor;\r\n } // validated\r\n\r\n float G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\r\n // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\r\n return 0.25;\r\n }\r\n\r\n float D_BlinnPhong( const in float shininess, const in float dotNH ) {\r\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\r\n }\r\n\r\n vec3 BRDF_Specular_BlinnPhong( const in DirectionalLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\r\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\r\n float dotNH = saturate(dot( geometry.normal, halfDir ));\r\n float dotLH = saturate(dot( incidentLight.direction, halfDir ));\r\n\r\n vec3 F = F_Schlick( specularColor, dotLH );\r\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\r\n float D = D_BlinnPhong( shininess, dotNH );\r\n\r\n return F * ( G * D );\r\n } // validated\r\n\r\n void RE_Direct_BlinnPhong( const in DirectionalLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight, float penumbra ) {\r\n\r\n float dotNL = saturate( dot( geometry.normal, directLight.direction ));\r\n #ifdef TOON_SHADING\r\n if(dotNL < MEDIUM_TOON_RANGE){\r\n dotNL = LOW_TOON_BORDER;\r\n }\r\n else if(dotNL < HIGH_TOON_RANGE){\r\n dotNL = MEDIUM_TOON_BORDER;\r\n }\r\n else{\r\n dotNL = HIGH_TOON_BORDER;\r\n }\r\n #endif\r\n\r\n vec3 irradiance = dotNL * directLight.color;\r\n reflectedLight.directDiffuse += penumbra * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n reflectedLight.directSpecular += penumbra * irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess );\r\n }\r\n\r\n void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\r\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r\n }\r\n\r\n vec3 calcLighting(const in GeometricContext geometry, const in BlinnPhongMaterial material, vec3 vViewPosition) {\r\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\r\n vec3 irradiance = ambientLightColor;\r\n\r\n float shadowMask = 1.0;\r\n // see THREE.WebGLProgram.unrollLoops\r\n \t#pragma unroll_loop_start\r\n \t for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n \t #ifdef SHADOWMAP\r\n \t shadowMask = getShadow( directionalShadowMap[ i ], directionalLightShadows[ i ], vDirLightWorldCoord[ i ], vViewPosition, vDirLightWorldNormal[ i ] );\r\n #endif\r\n\r\n \t\t if ( shadowMask > 0.0 ) RE_Direct_BlinnPhong( directionalLights[ i ], geometry, material, reflectedLight, shadowMask );\r\n \t\t}\r\n \t\t#pragma unroll_loop_end\r\n\r\n RE_IndirectDiffuse_BlinnPhong(irradiance, material, reflectedLight);\r\n\r\n return saturate(reflectedLight.indirectDiffuse + reflectedLight.directDiffuse + reflectedLight.directSpecular);\r\n }\r\n#endif\r\n\r\n/////////////////////////////////////////// Dashed Line ///////////////////////////////////////////////\r\n#ifdef DASHED_LINE\r\n uniform float dashedLineSize;\r\n uniform float dashedLinePeriod;\r\n varying float vLineDistance;\r\n#endif\r\n\r\n/////////////////////////////////////////// Main ///////////////////////////////////////////////\r\nvoid main() {\r\n\r\n#ifdef CLIP_PLANE\r\n if (vViewPosition.z < clipPlaneValue) discard;\r\n#endif\r\n\r\n#ifdef ZCLIP\r\n if (vViewPosition.z < zClipValue) discard;\r\n#endif\r\n\r\n#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n #if NUM_DIR_LIGHTS > 0\r\n // see THREE.WebGLProgram.unrollLoops\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirLightWorldCoord[ i ] = vDirectionalShadowCoord[ i ];\r\n vDirLightWorldNormal[ i ] = vDirectionalShadowNormal[ i ];\r\n }\r\n #pragma unroll_loop_end\r\n #endif\r\n#endif\r\n\r\n vec4 pixelPosWorld = vec4(vWorldPosition, 1.0);\r\n vec4 pixelPosEye;\r\n\r\n#ifdef SPHERE_SPRITE\r\n\r\n vec3 viewNormalSprites;\r\n float frontFaced = 1.0;\r\n vec3 normal;\r\n\r\n/* quick-and-dirty method\r\n normal.xy = ' + INSTANCED_SPRITE_OVERSCALE + ' * (2.0 * vUv - 1.0);\r\n float r2 = dot(normal.xy, normal.xy);\r\n if (r2 > 1.0) discard;\r\n float normalZ = sqrt(1.0 - r2);\r\n normal.z = normalZ;\r\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\r\n pixelPosEye = vec4(spritePosEye.xyz, 1.0);\r\n pixelPosEye.z += spritePosEye.w * normalZ;\r\n*/\r\n\r\n // ray-trace sphere surface\r\n {\r\n vec3 p;\r\n if (!get_sphere_point(-vViewPosition, p, frontFaced)) discard;\r\n vec4 v = vec4(instOffset.xyz + p * instOffset.w, 1.0);\r\n pixelPosWorld = modelMatrix * v;\r\n pixelPosEye = modelViewMatrix * v;\r\n normal = normalize(normalMatrix * p);\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*p);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n #if NUM_DIR_LIGHTS > 0\r\n // see THREE.WebGLProgram.unrollLoops\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirLightWorldCoord[ i ] = directionalShadowMatrix[ i ] * pixelPosWorld;\r\n vDirLightWorldNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(p, 0.0))).xyz;\r\n }\r\n #pragma unroll_loop_end\r\n #endif\r\n #endif\r\n }\r\n#endif\r\n\r\n#ifdef CYLINDER_SPRITE\r\n vec3 normal;\r\n vec3 viewNormalSprites;\r\n float frontFaced = 1.0;\r\n float cylinderY = 0.0;\r\n\r\n // ray-trace cylinder surface\r\n {\r\n vec3 p;\r\n if (!get_cylinder_point(-vViewPosition, p, frontFaced)) discard;\r\n\r\n cylinderY = 0.5 * (p.y + 1.0);\r\n\r\n vec4 v = vec4(p, 1.0);\r\n v = vec4(dot(v, matVec1), dot(v, matVec2), dot(v, matVec3), 1.0);\r\n pixelPosWorld = modelMatrix * v;\r\n pixelPosEye = modelViewMatrix * v;\r\n\r\n vec3 localNormal = normalize(vec3(p.x, 0.0, p.z));\r\n normal = vec3(\r\n dot(localNormal, matVec1.xyz),\r\n dot(localNormal, matVec2.xyz),\r\n dot(localNormal, matVec3.xyz));\r\n #ifdef NORMALS_TO_G_BUFFER\r\n viewNormalSprites = normalize(mat3(modelViewMatrix)*normal);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && defined(SHADOWMAP)\r\n #if NUM_DIR_LIGHTS > 0\r\n // see THREE.WebGLProgram.unrollLoops\r\n #pragma unroll_loop_start\r\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r\n vDirLightWorldCoord[ i ] = directionalShadowMatrix[ i ] * pixelPosWorld;\r\n vDirLightWorldNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(normal, 0.0))).xyz;\r\n }\r\n #pragma unroll_loop_end\r\n #endif\r\n #endif\r\n\r\n normal = normalize(normalMatrix * normal);\r\n }\r\n#endif\r\n\r\n #ifdef ATTR_COLOR\r\n vec3 vertexColor = vColor;\r\n #else\r\n vec3 vertexColor = vec3(1.0, 1.0, 1.0);\r\n #endif\r\n\r\n #ifdef ATTR_COLOR2\r\n #ifdef CYLINDER_SPRITE\r\n float colorCoef = cylinderY; // cylinder parameter is calculated from ray-tracing\r\n #else\r\n float colorCoef = vUv.y; // cylinder parameter is interpolated as tex coord\r\n #endif\r\n // choose either color or color2\r\n vertexColor = mix(vColor2, vColor, step(0.5, colorCoef));\r\n #endif\r\n\r\n // negative red component is a special condition\r\n if (vertexColor.x < 0.0) discard;\r\n\r\n #ifdef DASHED_LINE\r\n if ( mod( vLineDistance, dashedLinePeriod ) > dashedLineSize ) discard;\r\n #endif\r\n\r\n // transparency prepass writes only z, so we don't need to calc the color\r\n #ifdef PREPASS_TRANSP\r\n fragColor = vec4(1.0, 1.0, 1.0, 1.0);\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n return;\r\n #endif\r\n\r\n float totalOpacity = opacity;\r\n\r\n #ifdef ATTR_ALPHA_COLOR\r\n totalOpacity *= alphaCol;\r\n #endif\r\n\r\n // discard fully transparent pixels\r\n if (totalOpacity == 0.0) discard;\r\n\r\n #ifdef FAKE_OPACITY\r\n // discard pixels in checker pattern\r\n vec2 dm_coord = floor(gl_FragCoord.xy);\r\n dm_coord = fract(dm_coord * 0.5);\r\n if (totalOpacity < 1.0 && (dm_coord.x < 0.5 ^^ dm_coord.y < 0.5)) discard;\r\n vec4 diffuseColor = vec4(diffuse, 1.0);\r\n #else\r\n vec4 diffuseColor = vec4(diffuse, totalOpacity);\r\n #endif\r\n\r\n float flipNormal;\r\n #if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r\n flipNormal = 1.0;\r\n #ifdef DOUBLE_SIDED\r\n flipNormal = float( gl_FrontFacing );\r\n #endif\r\n vec3 normal = normalize( vNormal ) * flipNormal;\r\n #endif\r\n\r\n diffuseColor.rgb *= vertexColor;\r\n\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n #endif\r\n\r\n #ifdef NORMALS_TO_G_BUFFER\r\n #if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r\n vec3 viewNormaInColor = viewNormalSprites;\r\n #else\r\n vec3 viewNormaInColor = viewNormal;\r\n float frontFaced = float( gl_FrontFacing );\r\n #endif\r\n // [-1, 1] -> [0, 1]\r\n viewNormaInColor = 0.5 * viewNormaInColor + 0.5;\r\n gl_FragData[1] = vec4(viewNormaInColor, frontFaced);\r\n #endif\r\n\r\n #if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r\n vec3 viewDir;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n viewDir = -pixelPosEye.xyz;\r\n #else\r\n viewDir = vViewPosition;\r\n #endif\r\n GeometricContext geometry = GeometricContext(normal, normalize( viewDir ));\r\n BlinnPhongMaterial material = BlinnPhongMaterial(diffuseColor.rgb, specular, shininess);\r\n vec3 outgoingLight = calcLighting(geometry, material, viewDir);\r\n #else\r\n vec3 outgoingLight = diffuseColor.rgb;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_DEPTH\r\n float depth = 0.0;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r\n depth = gl_FragDepthEXT;\r\n #else\r\n depth = gl_FragCoord.z;\r\n #endif\r\n fragColor = packDepthToRGBA(depth);\r\n return;\r\n #endif\r\n\r\n #ifdef COLOR_FROM_POS\r\n fragColor = world2colorMatrix * pixelPosWorld;\r\n #else\r\n #ifdef OVERRIDE_COLOR\r\n fragColor = vec4(fixedColor, diffuseColor.a);\r\n #else\r\n fragColor = vec4(outgoingLight, diffuseColor.a);//vec4(vNormal, 1.0);\r\n #endif\r\n\r\n #ifdef USE_FOG\r\n float viewDistance;\r\n #if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r\n viewDistance = abs(pixelPosEye.z);\r\n #else\r\n viewDistance = vViewPosition.z;\r\n #endif\r\n float fogFactor = smoothstep( fogNear, fogFar, viewDistance) * fogAlpha;\r\n #ifdef FOG_TRANSPARENT\r\n fragColor.a = fragColor.a * (1.0 - fogFactor);\r\n #else\r\n fragColor.rgb = mix( fragColor.rgb, fogColor, fogFactor );\r\n #endif\r\n #endif\r\n\r\n #endif\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/capabilities.js +/* harmony default export */ const capabilities = ({ + precision: 'mediump', + /** + * + * @param {THREE.WebGLRenderer} renderer + */ + init(renderer) { + this.precision = renderer.capabilities.getMaxPrecision('highp'); + } +}); +;// CONCATENATED MODULE: ./src/gfx/noiseTexture.js + +const noiseWidth = 4; +const noiseHeight = 4; +const _noiseData = new Uint8Array([24, 52, 0, 255, 254, 145, 0, 255, 122, 0, 0, 255, 7, 170, 0, 255, 34, 214, 0, 255, 173, 8, 0, 255, 86, 249, 0, 255, 160, 4, 0, 255, 226, 46, 0, 255, 224, 211, 0, 255, 3, 157, 0, 255, 174, 247, 0, 255, 12, 182, 0, 255, 220, 216, 0, 255, 1, 109, 0, 255, 253, 154, 0, 255]); +const _noiseWrapS = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RepeatWrapping; +const _noiseWrapT = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RepeatWrapping; +const _noiseMinFilter = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.NearestFilter; +const _noiseMagFilter = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.NearestFilter; +const _noiseMapping = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UVMapping; +const noiseTexture = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.DataTexture(_noiseData, noiseWidth, noiseHeight, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UnsignedByteType, _noiseMapping, _noiseWrapS, _noiseWrapT, _noiseMagFilter, _noiseMinFilter, 1); +noiseTexture.needsUpdate = true; +/* harmony default export */ const gfx_noiseTexture = ({ + noiseWidth, + noiseHeight, + noiseTexture +}); +;// CONCATENATED MODULE: ./src/gfx/shaders/UberMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ -ObjectHandler.prototype.stop = function () { - this.lastRotation.angle = 0.0; -}; // calculate (axis, angle) pair from mouse/touch movement -ObjectHandler.prototype.mouse2rotation = function () { - var center = new Vector3(); - var eye = new Vector3(); - var eyeDirection = new Vector3(); - var cameraUpDirection = new Vector3(); - var cameraSidewaysDirection = new Vector3(); - var moveDirection = new Vector3(); - var mouseDelta = new Vector2(); - return function (rot, mousePrev, mouseCur, aboutAxis) { - if (aboutAxis) { - rot.axis.copy(this.axis); - rot.angle = this.options.axisRotateFactor * (mouseCur.y - mousePrev.y); - /* cool method that allows rotation around Z axis to be "tied" to mouse cursor - res.axis.copy(this.axis); - var pivot = this.pivot.clone(); - this.object.localToWorld(pivot); - pivot.project(this.camera); - var v1 = new THREE.Vector3(mousePrev.x, mousePrev.y, this.camera.position.z); - v1.sub(pivot); - var v2 = new THREE.Vector3(mouseCur.x, mouseCur.y, this.camera.position.z); - v2.sub(pivot); - v1.sub(res.axis.clone().multiplyScalar(v1.dot(res.axis))); - v2.sub(res.axis.clone().multiplyScalar(v2.dot(res.axis))); - var abs = v1.length() * v2.length(); - if (abs > 0) { - res.angle = res.axis.dot(v1.cross(v2)) / abs; - } - */ - } else { - mouseDelta.subVectors(mouseCur, mousePrev); - var angle = mouseDelta.length(); - if (angle === 0.0) { - return; - } - center.copy(this.pivot); - this.object.localToWorld(center); - eye.subVectors(this.camera.position, center); - eyeDirection.copy(eye).normalize(); - cameraUpDirection.copy(this.camera.up).normalize(); - cameraSidewaysDirection.crossVectors(cameraUpDirection, eyeDirection).normalize(); - cameraUpDirection.setLength(mouseDelta.y); - cameraSidewaysDirection.setLength(mouseDelta.x); - moveDirection.copy(cameraUpDirection.add(cameraSidewaysDirection)); - rot.axis.crossVectors(moveDirection, eye); - rot.angle = -angle * this.options.rotateFactor; + +// Length of _samplesKernel is used in Uber.frag +// If you want to change length of _samplesKernel, please, remember change it in Uber.frag too. +// You can easy find places for replace using word:_samplesKernel +const _samplesKernel = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(-0.541978, 0.840393), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(0.125533, -0.992089), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(0.374329, 0.927296), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(-0.105475, 0.994422)]; +const defaultUniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UniformsUtils.merge([external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UniformsLib.fog, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UniformsLib.lights, { + // are updated automatically by three.js (see THREE.ShaderLib.common) + diffuse: { + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(0xeeeeee) + }, + opacity: { + value: 1.0 + }, + specular: { + type: 'c', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(0x111111) + }, + shininess: { + type: 'f', + value: 30 + }, + fixedColor: { + type: 'c', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(0xffffff) + }, + zOffset: { + type: 'f', + value: 0.0 + }, + zClipValue: { + type: 'f', + value: 0.0 + }, + clipPlaneValue: { + type: 'f', + value: 0.0 + }, + nearPlaneValue: { + type: 'f', + value: -0.5 + }, + invModelViewMatrix: { + type: '4fv', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4() + }, + world2colorMatrix: { + type: '4fv', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4() + }, + dashedLineSize: { + type: 'f', + value: 0.1 + }, + dashedLinePeriod: { + type: 'f', + value: 0.2 + }, + projMatrixInv: { + type: '4fv', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4() + }, + viewport: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2() + }, + lineWidth: { + type: 'f', + value: 2.0 + }, + // default value must be the same as settings + fogAlpha: { + type: 'f', + value: 1.0 + }, + samplesKernel: { + type: 'v2v', + value: null + }, + noiseTex: { + type: 't', + value: null + }, + noiseTexelSize: { + type: 'v2', + value: null + }, + srcTexelSize: { + type: 'v2', + value: null + } +}]); +const uberOptionNames = ['shininess', 'opacity', 'zOffset', 'diffuse', 'specular', 'fixedColor', 'zClipCoef', 'zClipValue', 'clipPlaneValue', 'world2colorMatrix', 'dashedLineSize', 'dashedLinePeriod', 'projMatrixInv', 'viewport', 'lineWidth', 'fogAlpha', 'samplesKernel', 'noiseTex', 'noiseTexelSize', 'srcTexelSize']; + +// properties that convert to uniforms +const uberOptions = { + diffuse: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(0xffffff), + // used in phong lighting + specular: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(0x111111), + // used in phong lighting + shininess: 30, + // used in phong lighting + opacity: 1, + // set mesh opacity + fixedColor: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(0xffffff), + // color to override (see OVERRIDE_COLOR) + zOffset: 0.0, + // used fo zsprites (see SPHERE_SPRITE CYLINDER_SPRITE) + zClipCoef: 2.0, + // use for Surfs clipping (mesh param, isn't used in shader) FIXME move to representation param + zClipValue: 0.0, + // value to clip Surfs in shader (see ZCLIP) + clipPlaneValue: 0.0, + // value to clip scene globally (see CLIPPLANE) + world2colorMatrix: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(), + dashedLineSize: 0.1, + dashedLinePeriod: 0.3, + projMatrixInv: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(), + viewport: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(800, 600), + lineWidth: 2.0, + fogAlpha: 1.0, + samplesKernel: _samplesKernel, + noiseTex: gfx_noiseTexture.noiseTexture, + noiseTexelSize: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(1.0 / gfx_noiseTexture.noiseWidth, 1.0 / gfx_noiseTexture.noiseHeight), + srcTexelSize: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(1.0 / 800.0, 1.0 / 600.0), + copy(source) { + this.diffuse.copy(source.diffuse); + this.specular.copy(source.specular); + this.shininess = source.shininess; + this.opacity = source.opacity; + this.fixedColor.copy(source.fixedColor); + this.zOffset = source.zOffset; + this.zClipCoef = source.zClipCoef; + this.zClipValue = source.zClipValue; + this.clipPlaneValue = source.clipPlaneValue; + this.world2colorMatrix.copy(source.world2colorMatrix); + this.dashedLineSize = source.dashedLineSize; + this.dashedLinePeriod = source.dashedLinePeriod; + this.projMatrixInv = source.projMatrixInv; + this.viewport = source.viewport; + this.lineWidth = source.lineWidth; // used for thick lines only + this.toonShading = source.toonShading; + this.fogAlpha = source.fogAlpha; + this.samplesKernel = source.samplesKernel; + this.noiseTex = source.noiseTex; + this.noiseTexelSize = source.noiseTexelSize; + this.srcTexelSize = source.srcTexelSize; + } +}; +class UberMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RawShaderMaterial { + constructor(params) { + super(params); + + // add fog + this.fog = true; + // used for instanced geometry + this.instancedPos = false; + this.instancedMatrix = false; + // atoms and links color + this.attrColor = false; + // second link color for cylinders + this.attrColor2 = false; + // + this.attrAlphaColor = false; + // overrides color for all vertices (used in selection) + this.overrideColor = false; + // zsrpites + this.sphereSprite = false; + this.cylinderSprite = false; + // clip Surfs individually + this.zClip = false; + // clip scene with global clip plane + this.clipPlane = false; + // enable fake (chess-like) opacity + this.fakeOpacity = false; + // render only depth, don't take care about the pixel color (used for transparency depth prepass) + this.prepassTransparancy = false; + // used to render pixel positions + this.colorFromPos = false; + // used to render shadowmap + this.shadowmap = false; + // used to describe shadowmap type + this.shadowmapType = 'random'; + // used to render pixel view deph + this.colorFromDepth = false; + // mark that rendering is for orthographic camera + this.orthoCam = false; + // used to render dashed line + this.dashedLine = false; + // mark as transparent + this.transparent = true; + // mark as thick lines + this.thickLine = false; + // makes fog begin transparency (required for transparent background) + this.fogTransparent = false; + // used to render surface normals to G buffer for ssao effect + this.normalsToGBuffer = false; + // used for toon material + this.toonShading = false; + + // uber options of "root" materials are inherited from single uber-options object that resides in prototype + this.uberOptions = Object.create(UberMaterial.prototype.uberOptions); + + // set default values + super.setValues({ + uniforms: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UniformsUtils.clone(defaultUniforms), + vertexShader: this.precisionString() + Uber_namespaceObject, + fragmentShader: this.precisionString() + gfx_shaders_Uber_namespaceObject, + lights: true, + fog: true, + side: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.DoubleSide + }); + this.setValues(params); + } + precisionString() { + const { + precision + } = capabilities; + const str = `precision ${precision} float;\n` + `precision ${precision} int;\n\n`; + return str; + } + copy(source) { + super.copy(source); + this.fragmentShader = source.fragmentShader; + this.vertexShader = source.vertexShader; + this.uniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UniformsUtils.clone(source.uniforms); + this.defines = { + ...source.defines + }; + this.extensions = source.extensions; + this.fog = source.fog; + this.instancedPos = source.instancedPos; + this.instancedMatrix = source.instancedMatrix; + this.attrColor = source.attrColor; + this.attrColor2 = source.attrColor2; + this.attrAlphaColor = source.attrAlphaColor; + this.overrideColor = source.overrideColor; + this.sphereSprite = source.sphereSprite; + this.cylinderSprite = source.cylinderSprite; + this.zClip = source.zClip; + this.clipPlane = source.clipPlane; + this.fakeOpacity = source.fakeOpacity; + this.colorFromPos = source.colorFromPos; + this.shadowmap = source.shadowmap; + this.shadowmapType = source.shadowmapType; + this.colorFromDepth = source.colorFromDepth; + this.orthoCam = source.orthoCam; + this.prepassTransparancy = source.prepassTransparancy; + this.dashedLine = source.dashedLine; + this.thickLine = source.thickLine; + this.fogTransparent = source.fogTransparent; + this.normalsToGBuffer = source.normalsToGBuffer; + this.toonShading = source.toonShading; + this.uberOptions.copy(source.uberOptions); + return this; + } + + // create copy of this material + // its options are prototyped after this material's options + createInstance() { + const inst = new UberMaterial(); + inst.copy(this); + inst.uberOptions = Object.create(this.uberOptions); + return inst; + } + setValues(values) { + if (typeof values === 'undefined') { + return; } - rot.axis.transformDirection(matrix4.getInverse(this.object.matrixWorld)); // make sure angle is always positive (thus 'axis' defines both axis and direction of rotation) - - if (rot.angle < 0.0) { - rot.axis.negate(); - rot.angle = -rot.angle; + // set direct values + super.setValues(values); + const defines = {}; + const extensions = {}; + if (this.fog) { + defines.USE_FOG = 1; } - }; -}(); - -function ObjectControls(object, objectPivot, camera, domElement, getAltObj) { - EventDispatcher.call(this); - var self = this; - this.object = object; - this.objectPivot = objectPivot; - this.camera = camera; - this.domElement = typeof domElement !== 'undefined' ? domElement : document; - this.getAltObj = getAltObj; // API - - this.enabled = true; - this.hotkeysEnabled = true; - this.screen = { - left: 0, - top: 0, - width: 0, - height: 0 - }; - this.options = { - rotateFactor: Math.PI, - // full screen slide (along short side) would roughly mean 180 deg. rotation - axisRotateFactor: 4 * Math.PI, - // full screen slide (along short side) would roughly mean 720 deg. rotation - intertia: true, - dynamicDampingFactor: 0.1, - intertiaThreshold: 1e-3 - }; // internals - - this._state = STATE.NONE; - this._mousePrevPos = new Vector2(); - this._mouseCurPos = new Vector2(); - this._mainObj = new ObjectHandler([this.object], this.camera, new Vector3(0, 0, 0), this.options); - this._altObj = new ObjectHandler([this.object], this.camera, new Vector3(0, 0, 0), this.options); - this._affectedObj = this._mainObj; - this._isAltObjFreeRotationAllowed = true; - this._isTranslationAllowed = true; - this._isKeysTranslatingObj = false; - this._pressedKeys = []; - this._clock = new Timer(); - - this._clock.start(); - - this._lastUpdateTime = this._clock.getElapsedTime(); // events - - this._listeners = [{ - obj: self.domElement, - type: 'mousedown', - handler: function handler(e) { - self.mousedown(e); + if (this.instancedPos) { + defines.INSTANCED_POS = 1; } - }, { - obj: self.domElement, - type: 'mouseup', - handler: function handler(e) { - self.mouseup(e); + if (this.instancedMatrix) { + defines.INSTANCED_MATRIX = 1; } - }, { - obj: self.domElement, - type: 'mousemove', - handler: function handler(e) { - self.mousemove(e); + if (this.attrColor) { + defines.ATTR_COLOR = 1; } - }, { - obj: self.domElement, - type: 'mousewheel', - handler: function handler(e) { - self.mousewheel(e); + if (this.attrColor2) { + defines.ATTR_COLOR2 = 1; } - }, { - obj: self.domElement, - type: 'DOMMouseScroll', - handler: function handler(e) { - self.mousewheel(e); + if (this.attrAlphaColor) { + defines.ATTR_ALPHA_COLOR = 1; } - }, { - obj: self.domElement, - type: 'mouseout', - handler: function handler(e) { - self.mouseup(e); + if (this.overrideColor) { + defines.OVERRIDE_COLOR = 1; } - }, { - obj: self.domElement, - type: 'touchstart', - handler: function handler(e) { - self.touchstartend(e); + if (this.sphereSprite) { + defines.SPHERE_SPRITE = 1; + extensions.fragDepth = true; } - }, { - obj: self.domElement, - type: 'touchend', - handler: function handler(e) { - self.touchstartend(e); + if (this.cylinderSprite) { + defines.CYLINDER_SPRITE = 1; + extensions.fragDepth = true; } - }, { - obj: self.domElement, - type: 'touchmove', - handler: function handler(e) { - self.touchmove(e); + if (this.zClip) { + defines.ZCLIP = 1; } - }, { - obj: self.getKeyBindObject(), - type: 'keydown', - handler: function handler(e) { - self.keydownup(e); + if (this.clipPlane) { + defines.CLIP_PLANE = 1; } - }, { - obj: self.getKeyBindObject(), - type: 'keyup', - handler: function handler(e) { - self.keydownup(e); + if (this.fakeOpacity) { + defines.FAKE_OPACITY = 1; } - }, { - obj: window, - type: 'resize', - handler: function handler() { - self.handleResize(); + if (this.lights) { + defines.USE_LIGHTS = 1; } - }, { - obj: window, - type: 'blur', - handler: function handler() { - self.resetKeys(); + if (this.colorFromPos) { + defines.COLOR_FROM_POS = 1; } - }, { - obj: self.domElement, - type: 'contextmenu', - handler: function handler(e) { - self.contextmenu(e); + if (this.shadowmap) { + defines.SHADOWMAP = 1; + if (this.shadowmapType === 'pcf') { + defines.SHADOWMAP_PCF_SHARP = 1; + } else if (this.shadowmapType === 'random') { + defines.SHADOWMAP_PCF_RAND = 1; + } else { + defines.SHADOWMAP_BASIC = 1; + } } - }]; - - for (var i = 0; i < this._listeners.length; i++) { - var l = this._listeners[i]; - l.obj.addEventListener(l.type, l.handler); + if (this.colorFromDepth) { + defines.COLOR_FROM_DEPTH = 1; + } + if (this.orthoCam) { + defines.ORTHOGRAPHIC_CAMERA = 1; + } + if (this.prepassTransparancy) { + defines.PREPASS_TRANSP = 1; + } + if (this.dashedLine) { + defines.DASHED_LINE = 1; + } + if (this.thickLine) { + defines.THICK_LINE = 1; + } + if (this.fogTransparent) { + defines.FOG_TRANSPARENT = 1; + } + if (this.normalsToGBuffer) { + extensions.drawBuffers = true; + defines.NORMALS_TO_G_BUFFER = 1; + } + if (this.toonShading) { + defines.TOON_SHADING = 1; + } + // set dependent values + this.defines = defines; + this.extensions = extensions; } - - this.handleResize(); - this.resetKeys(); // force an update at start - - this.update(); -} // methods - - -ObjectControls.prototype = Object.create(EventDispatcher.prototype); -ObjectControls.prototype.constructor = ObjectControls; - -ObjectControls.prototype.resetKeys = function () { - this._pressedKeys[VK_LEFT] = false; - this._pressedKeys[VK_UP] = false; - this._pressedKeys[VK_RIGHT] = false; - this._pressedKeys[VK_DOWN] = false; -}; - -ObjectControls.prototype.contextmenu = function (e) { - e.stopPropagation(); - e.preventDefault(); -}; - -ObjectControls.prototype.handleResize = function () { - if (this.domElement === document) { - this.screen.left = 0; - this.screen.top = 0; - this.screen.width = window.innerWidth; - this.screen.height = window.innerHeight; - } else { - var box = this.domElement.getBoundingClientRect(); // adjustments come from similar code in the jquery offset() function - - var d = this.domElement.ownerDocument.documentElement; - this.screen.left = box.left + window.pageXOffset - d.clientLeft; - this.screen.top = box.top + window.pageYOffset - d.clientTop; - this.screen.width = box.width; - this.screen.height = box.height; + setUberOptions(values) { + if (typeof values === 'undefined') { + return; + } + for (const key in values) { + if (!values.hasOwnProperty(key)) { + continue; + } + if (this.uberOptions[key] instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color) { + this.uberOptions[key] = values[key].clone(); + } else { + this.uberOptions[key] = values[key]; + } + } } -}; - -ObjectControls.prototype.enable = function (enable) { - this.enabled = enable; -}; - -ObjectControls.prototype.enableHotkeys = function (enable) { - this.hotkeysEnabled = enable; -}; - -ObjectControls.prototype.allowTranslation = function (allow) { - this._isTranslationAllowed = allow; -}; - -ObjectControls.prototype.allowAltObjFreeRotation = function (allow) { - this._isAltObjFreeRotationAllowed = allow; -}; - -ObjectControls.prototype.keysTranslateObj = function (on) { - this._isKeysTranslatingObj = on; -}; - -ObjectControls.prototype.isEditingAltObj = function () { - return (this._state === STATE.ROTATE || this._state === STATE.TRANSLATE) && this._affectedObj === this._altObj; -}; // convert page coords of mouse/touch to uniform coords with smaller side being [-0.5, 0.5] -// (uniform coords keep direct proportion with screen distance travelled by mouse regardless of screen aspect ratio) - - -ObjectControls.prototype.convertMouseToOnCircle = function (coords, pageX, pageY) { - var screenSize = Math.min(this.screen.width, this.screen.height); - - if (screenSize === 0) { - coords.set(0, 0); - return; + clone(shallow) { + if (!shallow) { + return super.clone(); + } + return this.createInstance(); + } + updateUniforms() { + const self = this; + uberOptionNames.forEach(p => { + if (self.uniforms.hasOwnProperty(p)) { + if (self.uberOptions[p] instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color || self.uberOptions[p] instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4) { + self.uniforms[p].value = self.uberOptions[p].clone(); + } else { + self.uniforms[p].value = self.uberOptions[p]; + } + } + }); + } +} +UberMaterial.prototype.uberOptions = uberOptions; +/* harmony default export */ const shaders_UberMaterial = (UberMaterial); +;// CONCATENATED MODULE: ./src/gfx/meshes/UberObject.js + +/* harmony default export */ function UberObject(SuperClass) { + class NewObjectType extends SuperClass { + constructor() { + super(...arguments); + this.onBeforeRender = NewObjectType.prototype.onBeforeRender; + } + onBeforeRender(renderer, scene, camera, geometry, material, group) { + this._onBeforeRender(renderer, scene, camera, geometry, material, group); + this._update(); + } + _onBeforeRender() {} + _update() { + const { + material + } = this; + if (!material) { + return; + } + if (material instanceof shaders_UberMaterial) { + material.updateUniforms(); + } + } + } + return NewObjectType; +} +;// CONCATENATED MODULE: ./src/gfx/meshes/ZSpriteMesh.js + + +const Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh); +class ZSpriteMesh extends Mesh { + constructor() { + super(...arguments); + this.castShadow = true; + this.receiveShadow = true; + } + _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) { + Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera); + const { + material + } = this; + if (!material) { + return; + } + if (material.uniforms.invModelViewMatrix) { + // NOTE: update of modelViewMatrix inside threejs is done after onBeforeRender call, + // so we have to do it manually in that place + this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld); + // get inverse matrix + material.uniforms.invModelViewMatrix.value.copy(this.modelViewMatrix).invert(); + material.uniforms.nearPlaneValue.value = camera.near; + material.uniformsNeedUpdate = true; + } + } +} +/* harmony default export */ const meshes_ZSpriteMesh = (ZSpriteMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/ZClippedMesh.js + + +const ZClippedMesh_Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh); +class ZClippedMesh extends ZClippedMesh_Mesh { + constructor(geometry, material) { + super(geometry, material); + this.castShadow = true; + this.receiveShadow = true; + } + static _mvLength = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3())(); + static _center = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3())(); + static _modelView = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4())(); + _onBeforeRender(renderer, scene, camera) { + ZClippedMesh_Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera); + const geo = this.geometry; + const { + material + } = this; + if (!geo.zClip || !material.uberOptions) { + return; + } + const zClipCoef = 0.5; + const modelView = ZClippedMesh._modelView; + const mvLength = ZClippedMesh._mvLength; + const center = ZClippedMesh._center; + modelView.multiplyMatrices(this.matrixWorld, camera.matrixWorldInverse); + const s = mvLength.setFromMatrixColumn(modelView, 0).length(); + center.copy(geo.boundingSphere.center); + this.localToWorld(center); + material.uberOptions.zClipValue = camera.position.z - center.z - s * (zClipCoef * geo.boundingSphere.radius); } +} +/* harmony default export */ const meshes_ZClippedMesh = (ZClippedMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/TextMesh.js - coords.set((pageX - this.screen.width * 0.5 - this.screen.left) / screenSize, (0.5 * this.screen.height + this.screen.top - pageY) / screenSize); -}; // convert page coords of mouse/touch to viewport coords with both sides being [-1, 1] -// (those are non-uniform coords affected by screen aspect ratio) -ObjectControls.prototype.convertMouseToViewport = function (coords, pageX, pageY) { - if (this.screen.width === 0 || this.screen.height === 0) { - coords.set(0, 0); - return; - } - coords.set(2.0 * (pageX - this.screen.width * 0.5 - this.screen.left) / this.screen.width, 2.0 * (0.5 * this.screen.height + this.screen.top - pageY) / this.screen.height); -}; +class TextMesh extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group { + constructor(geometry, _material) { + super(); + this.geometry = geometry; + const self = this; + self.initialized = false; + this.geometry.addEventListener('update', () => { + self.update(); + }); + } + init() { + const { + children + } = this; + for (let i = children.length - 1; i >= 0; --i) { + this.remove(children[i]); + } + const { + items, + userData + } = this.geometry; + for (let i = 0, n = items.length; i < n; ++i) { + const srcItem = items[i]; + if (!srcItem) { + continue; + } + const item = utils.shallowCloneNode(srcItem); + const label = new gfx_CSS2DObject(item); + label.userData = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].clone(userData); + const el = label.getElement(); + el.style.visibility = 'visible'; + label.source = srcItem; + this.add(label); + } + this.initialized = true; + } + update() { + const geo = this.geometry; + if (!geo.needsUpdate) { + return; + } + const { + children + } = this; + if (!this.initialized) { + this.init(); + } + for (let i = 0, n = children.length; i < n; ++i) { + const child = children[i]; + const item = child.source; + child.position.copy(item.worldPos); + child.userData.color = item.opts.color; + child.userData.background = item.opts.background; + } + } +} +/* harmony default export */ const meshes_TextMesh = (TextMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/SimpleMesh.js -ObjectControls.prototype.stop = function () { - this._mainObj.stop(); - this._altObj.stop(); -}; // rotate object based on latest mouse/touch movement +const SimpleMesh_Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh); +class SimpleMesh extends SimpleMesh_Mesh { + constructor(geometry, material) { + super(geometry, material); + this.castShadow = true; + this.receiveShadow = true; + } +} +/* harmony default export */ const meshes_SimpleMesh = (SimpleMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/ThickLineMesh.js + + +const ThickLineMesh_Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh); +const _viewport = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(); +class ThickLineMesh extends ThickLineMesh_Mesh { + _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) { + const { + material + } = this; + if (!material.uberOptions) { + return; + } + material.uberOptions.projMatrixInv.copy(camera.projectionMatrix).invert(); + renderer.getSize(_viewport); + material.uberOptions.viewport.set(_viewport.width, _viewport.height); + } +} +/* harmony default export */ const meshes_ThickLineMesh = (ThickLineMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/InstancedMesh.js -ObjectControls.prototype.rotateByMouse = function () { - var quat = new Quaternion(); - return function (aboutZAxis) { - this._affectedObj.rotate(quat, this._mousePrevPos, this._mouseCurPos, aboutZAxis); +const InstancedMesh_Mesh = UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh); +class InstancedMesh extends InstancedMesh_Mesh { + constructor() { + super(...arguments); + this.castShadow = true; + this.receiveShadow = true; + } +} +/* harmony default export */ const meshes_InstancedMesh = (InstancedMesh); +;// CONCATENATED MODULE: ./src/gfx/meshes/meshes.js - this.dispatchEvent({ - type: 'change', - action: 'rotate', - quaternion: quat - }); - }; -}(); // rotate object by specified quaternion -ObjectControls.prototype.rotate = function (quat) { - this.object.quaternion.multiply(quat); - this.dispatchEvent({ - type: 'change', - action: 'rotate', - quaternion: quat - }); -}; // get object's orientation -ObjectControls.prototype.getOrientation = function () { - return this.object.quaternion; -}; // set object's orientation -ObjectControls.prototype.setOrientation = function (quat) { - this.object.quaternion.copy(quat); -}; // translate object based on latest mouse/touch movement +/* harmony default export */ const meshes = ({ + ZClipped: meshes_ZClippedMesh, + ZSprite: meshes_ZSpriteMesh, + Text: meshes_TextMesh, + Line: UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Line), + LineSegments: UberObject(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineSegments), + Mesh: meshes_SimpleMesh, + ThickLineMesh: meshes_ThickLineMesh, + Instanced: meshes_InstancedMesh +}); +;// CONCATENATED MODULE: ./src/gfx/meshes/MeshCreator.js -ObjectControls.prototype.translate = function () { - var delta = new Vector2(); - return function () { - delta.subVectors(this._mouseCurPos, this._mousePrevPos); - this._affectedObj.translate(delta); - this.dispatchEvent({ - type: 'change', - action: 'translate' - }); +function setMatParams(params, uniforms) { + return function (material) { + material.setValues(params); + material.setUberOptions(uniforms); }; -}(); // get object scale - +} +function _createInstancedCylinders(useZSprites, openEnded) { + function Geometry(a, b) { + return new geometries.Instanced2CCylindersGeometry(a, b, useZSprites, openEnded); + } + return { + Geometry, + Object: useZSprites ? meshes.ZSprite : meshes.Instanced, + initMaterial: setMatParams({ + instancedMatrix: true, + attrColor: true, + attrColor2: true, + attrAlphaColor: true, + cylinderSprite: useZSprites + }) + }; +} +function _createLineSegmentsGeoTriplet(geo, renderParams) { + const thickLines = geo.prototype instanceof geometries_ThickLinesGeometry; + const lineWidth = renderParams.lineWidth || 0; + return { + Geometry: geo, + Object: thickLines ? meshes.ThickLineMesh : meshes.LineSegments, + initMaterial: setMatParams({ + lights: false, + attrColor: true, + attrAlphaColor: true, + thickLine: thickLines + }, { + lineWidth + }) + }; +} +function _createSimpleGeoTriplet(geoClass) { + return { + Geometry: geoClass, + Object: meshes.Mesh, + initMaterial: setMatParams({ + attrColor: true, + attrAlphaColor: true + }) + }; +} +function _createIsoSurfaceGeoTriplet(geoClass, caps, settings, renderParams) { + const surfaceOpts = { + wireframe: !!renderParams.wireframe, + fakeOpacity: settings.now.isoSurfaceFakeOpacity, + zClip: renderParams.zClip + }; + return { + Geometry: geoClass, + Object: meshes.ZClipped, + initMaterial: setMatParams({ + attrColor: true, + attrAlphaColor: false, + wireframe: surfaceOpts.wireframe, + fakeOpacity: surfaceOpts.fakeOpacity, + zClip: surfaceOpts.zClip + }) + }; +} +class MeshCreator { + static createSpheres(caps, settings) { + const useZSprites = settings.now.zSprites; + function Geometry(a, b) { + return new geometries.InstancedSpheresGeometry(a, b, useZSprites); + } + return { + Geometry, + Object: useZSprites ? meshes.ZSprite : meshes.Instanced, + initMaterial: setMatParams({ + instancedPos: true, + attrColor: true, + attrAlphaColor: true, + sphereSprite: useZSprites + }) + }; + } + static create2CClosedCylinders(_caps, _settings) { + return _createInstancedCylinders(false, false); + } + static create2CCylinders(caps, settings) { + return _createInstancedCylinders(settings.now.zSprites, true); + } + static create2CLines(_caps, _settings, renderParams) { + return _createLineSegmentsGeoTriplet(geometries.TwoColorLinesGeometry, renderParams); + } + static createCrosses(_caps, _settings, renderParams) { + return _createLineSegmentsGeoTriplet(geometries.CrossGeometry, renderParams); + } + static createExtrudedChains(_caps, _settings) { + return _createSimpleGeoTriplet(geometries.ExtrudedObjectsGeometry); + } + static createChunkedLines(_caps, _settings, renderParams) { + return _createLineSegmentsGeoTriplet(geometries.ChunkedLinesGeometry, renderParams); + } + static createQuickSurface(caps, settings, renderParams) { + return _createIsoSurfaceGeoTriplet(geometries.QuickSurfGeometry, caps, settings, renderParams); + } + static createContactSurface(caps, settings, renderParams) { + return _createIsoSurfaceGeoTriplet(geometries.ContactSurfaceGeometry, caps, settings, renderParams); + } + static createSASSES(caps, settings, renderParams) { + return _createIsoSurfaceGeoTriplet(geometries.SSIsosurfaceGeometry, caps, settings, renderParams); + } + static createLabels(_caps, _settings) { + return { + Geometry: geometries.LabelsGeometry, + Object: meshes.Text, + initMaterial() {} + }; + } +} +/* harmony default export */ const meshes_MeshCreator = (MeshCreator); +;// CONCATENATED MODULE: ./src/gfx/meshes/TransformGroup.js + + +class TransformGroup extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Object3D { + static _inverseMatrix = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4())(); + static _ray = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Ray())(); + constructor(geometry, geoParams, material, transforms) { + super(); + this._geometry = geometry; + this._geoParams = geoParams; + const mat = material.createInstance(); + geoParams.initMaterial(mat); + this._material = mat; + this._transforms = transforms.length > 0 ? transforms : [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4()]; + const meshes = this._createMeshes(geometry); + for (let i = 0, n = meshes.length; i < n; ++i) { + this.add(meshes[i]); + } + } + raycast(raycaster, intersects) { + const ray = TransformGroup._ray; + const inverseMatrix = TransformGroup._inverseMatrix; + const { + children + } = this; + ray.copy(raycaster.ray); + for (let i = 0, n = children.length; i < n; ++i) { + const child = children[i]; + if (!gfxutils.belongToSelectLayers(child)) { + continue; + } + child.updateMatrixWorld(); + const mtx = child.matrixWorld; + inverseMatrix.copy(mtx).invert(); + raycaster.ray.copy(ray).applyMatrix4(inverseMatrix); + const childIntersects = []; + this._geometry.raycast(raycaster, childIntersects); + for (let j = 0, ciCount = childIntersects.length; j < ciCount; ++j) { + const inters = childIntersects[j]; + if (inters.point) { + inters.point.applyMatrix4(mtx); + inters.distance = ray.origin.distanceTo(inters.point); + } + inters.object = child; + intersects[intersects.length] = inters; + } + } + raycaster.ray.copy(ray); + } + getSubset(chunkIndices) { + const geos = this._geometry.getSubset(chunkIndices); + const subset = []; + let subIdx = 0; + for (let i = 0, n = geos.length; i < n; ++i) { + const meshes = this._createMeshes(geos[i]); + for (let j = 0, meshCnt = meshes.length; j < meshCnt; ++j) { + subset[subIdx++] = meshes[j]; + } + } + return subset; + } + _createMeshes(geometry) { + const transforms = this._transforms; + const Mesh = this._geoParams.Object; + const material = this._material; + const meshes = []; + for (let i = 0, n = transforms.length; i < n; ++i) { + const mesh = new Mesh(geometry, material); + mesh.applyMatrix4(transforms[i]); + meshes[i] = mesh; + } + return meshes; + } +} +/* harmony default export */ const meshes_TransformGroup = (TransformGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/ChemGroup.js -ObjectControls.prototype.getScale = function () { - return this.object.scale.x; -}; // set uniform object scale +function wrapper(Name, args) { + const params = [Name].concat(args); + return Name.bind(...params); +} +class ChemGroup extends gfx_RCGroup { + constructor(geoParams, selection, colorer, mode, transforms, polyComplexity, material) { + super(); + if (this.constructor === ChemGroup) { + throw new Error('Can not instantiate abstract class!'); + } + this._selection = selection; + this._mode = mode; + this._colorer = colorer; + this._chunksIdc = selection.chunks; + this._polyComplexity = polyComplexity; + this._geo = new (wrapper(geoParams.Geometry, this._makeGeoArgs()))(); + this._mesh = new meshes_TransformGroup(this._geo, geoParams, material, transforms); + this.add(this._mesh); + this._build(); + } + _makeGeoArgs() { + throw new Error('ChemGroup subclass must override _makeGeoArgs() method'); + } -ObjectControls.prototype.setScale = function (scale) { - this.object.scale.set(scale, scale, scale); -}; // scale object by factor (factor should be greater than zero) + /** + * Builds subset geometry by ATOMS index list + * + * @param {Number} mask - Representation mask + * @param {Boolean} innerOnly - if true returns inner bonds only - without halves + * @returns {Array} Subset geometry + */ + getSubset(mask, innerOnly) { + innerOnly = innerOnly !== undefined ? innerOnly : false; + const chunksList = this._calcChunksList(mask, innerOnly); + if (chunksList.length === 0) { + return []; + } + return this._mesh.getSubset(chunksList); + } + _changeSubsetOpacity(mask, value, innerOnly) { + const chunksList = this._calcChunksList(mask, innerOnly); + if (chunksList.length === 0) { + return; + } + this._geo.setOpacity(chunksList, value); + } + enableSubset(mask, innerOnly) { + innerOnly = innerOnly !== undefined ? innerOnly : true; + this._changeSubsetOpacity(mask, 1.0, innerOnly); + } + disableSubset(mask, innerOnly) { + innerOnly = innerOnly !== undefined ? innerOnly : true; + this._changeSubsetOpacity(mask, 0.0, innerOnly); + } +} +/* harmony default export */ const groups_ChemGroup = (ChemGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsGroup.js + +class AtomsGroup extends groups_ChemGroup { + raycast(raycaster, intersects) { + const { + atoms + } = this._selection; + const inters = []; + this._mesh.raycast(raycaster, inters); + const atomsIdc = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; + } + const atomIdx = atomsIdc[inters[i].chunkIdx]; + if (atomIdx < atoms.length) { + inters[i].atom = atoms[atomIdx]; + intersects.push(inters[i]); + } + } + } + _calcChunksList(mask) { + const chunksList = []; + const { + atoms + } = this._selection; + const atomsIdc = this._chunksIdc; + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + if ((atom.mask & mask) !== 0) { + chunksList.push(i); + } + } + return chunksList; + } +} +/* harmony default export */ const groups_AtomsGroup = (AtomsGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsSphereGroup.js + +class AtomsSphereGroup extends groups_AtomsGroup { + _makeGeoArgs() { + return [this._selection.chunks.length, this._polyComplexity]; + } + _build() { + const atomsIdc = this._selection.chunks; + const { + atoms, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + geo.setItem(i, atom.position, mode.calcAtomRadius(atom)); + geo.setColor(i, colorer.getAtomColor(atom, parent)); + } + geo.finalize(); + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const atomsIdc = this._selection.chunks; + const { + atoms + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const updateColor = frameData.needsColorUpdate(colorer); + const geo = this._geo; + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), mode.calcAtomRadius(atom)); + if (updateColor) { + geo.setColor(i, frameData.getAtomColor(colorer, atom)); + } + } + geo.finalize(); + } +} +/* harmony default export */ const groups_AtomsSphereGroup = (AtomsSphereGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsSurfaceGroup.js + +class AtomsSurfaceGroup extends groups_AtomsSphereGroup { + _makeGeoArgs() { + const selectedAtoms = []; + const { + atoms, + chunks + } = this._selection; + const n = chunks.length; + for (let i = 0; i < n; ++i) { + selectedAtoms[i] = atoms[chunks[i]]; + } + const opts = this._mode.getSurfaceOpts(); + opts.atoms = selectedAtoms; + return [n, opts]; + } +} +/* harmony default export */ const groups_AtomsSurfaceGroup = (AtomsSurfaceGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsSASSESGroupStub.js +/* This is a stub class keep it until SAS/SES is refactored */ + + +class AtomsSASSESGroupStub extends groups_AtomsSphereGroup { + _makeGeoArgs() { + const selectedAtoms = []; + const { + atoms, + chunks + } = this._selection; + const n = chunks.length; + for (let i = 0; i < n; ++i) { + selectedAtoms[i] = atoms[chunks[i]]; + } + const opts = this._mode.getSurfaceOpts(); + opts.atoms = selectedAtoms; + opts.selection = this._selection; + opts.colorMode = this._colorer; + return [n, opts]; + } +} +/* harmony default export */ const groups_AtomsSASSESGroupStub = (AtomsSASSESGroupStub); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AtomsTextGroup.js -ObjectControls.prototype.scale = function (factor) { - if (factor <= 0) { - return; +function adjustColor(color) { + let r = color >> 16 & 255; + let g = color >> 8 & 255; + let b = color & 255; + if (0.2126 * r + 0.7152 * g + 0.0722 * b > 127) { + r = r * 3 / 10; + g = g * 3 / 10; + b = b * 3 / 10; + } else { + r = 255 - (255 - r) * 3 / 10; + g = 255 - (255 - g) * 3 / 10; + b = 255 - (255 - b) * 3 / 10; } - - this.setScale(this.object.scale.x * factor); - this.dispatchEvent({ - type: 'change', - action: 'zoom', - factor: factor + return r << 16 | g << 8 | b; +} +function inverseColor(color) { + const r = color >> 16 & 255; + const g = color >> 8 & 255; + const b = color & 255; + return 255 - r << 16 | 255 - g << 8 | 255 - b; +} +function getAtomText(atom) { + if (atom.name.getNode() !== null) { + return atom.name.getNode(); + } + return atom.getVisualName(); +} +const colorMappings = { + none(c) { + return c; + }, + adjust: adjustColor, + inverse: inverseColor +}; +function propagateColor(color, rule) { + let result; + if (colorMappings.hasOwnProperty(rule)) { + result = utils.hexColor(colorMappings[rule](color)); + } else { + const val = parseInt(rule, 16); + if (!Number.isNaN(val) && rule.toLowerCase().startsWith('0x')) { + result = utils.hexColor(val); + } else { + result = '#000000'; + } + } + return result; +} +const templateMappings = { + serial(a) { + return a.serial; + }, + name(a) { + return a.getVisualName(); + }, + elem(a) { + return a.element.name; + }, + residue(a) { + return a.residue.getType().getName(); + }, + sequence(a) { + return a.residue.getSequence(); + }, + chain(a) { + return a.residue.getChain().getName(); + }, + hetatm(a) { + return a.isHet(); + }, + water(a) { + return a.residue.getType().getName() === 'HOH' || a.residue.getType().getName() === 'WAT'; + } +}; +const parseTemplate = function (atom, str) { + return str.replace(/\{\{(\s*\w+\s*)\}\}/g, m => { + let key = m.replace(/\s+/g, ''); + key = key.substring(2, key.length - 2).toLowerCase(); + if (templateMappings.hasOwnProperty(key)) { + return templateMappings[key](atom); + } + return 'null'; }); }; - -ObjectControls.prototype.update = function () { - var shift = new Vector2(); - return function () { - var curTime = this._clock.getElapsedTime(); - - var timeSinceLastUpdate = curTime - this._lastUpdateTime; // update object handler - - if (this._state === STATE.NONE) { - var timeSinceMove = curTime - this._lastMouseMoveTime; - - if (this._mainObj.update(timeSinceLastUpdate, timeSinceMove) || this._altObj.update(timeSinceLastUpdate, timeSinceMove)) { - this.dispatchEvent({ - type: 'change', - action: 'auto' - }); +class AtomsTextGroup extends groups_AtomsGroup { + _makeGeoArgs() { + const opts = this._mode.getLabelOpts(); + return [this._selection.chunks.length, opts]; + } + _build() { + const opts = this._mode.getLabelOpts(); + const atomsIdc = this._selection.chunks; + const { + atoms, + parent + } = this._selection; + const colorer = this._colorer; + const geo = this._geo; + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom); + if (!text) { + continue; } - } // apply arrow keys - - - if (this._isKeysTranslatingObj) { - var speedX = Number(this._pressedKeys[VK_RIGHT]) - Number(this._pressedKeys[VK_LEFT]); - var speedY = Number(this._pressedKeys[VK_UP]) - Number(this._pressedKeys[VK_DOWN]); - - if (speedX !== 0.0 || speedY !== 0.0) { - var delta = timeSinceLastUpdate; // update object translation - - var altObj = this.getAltObj(); - - if (altObj.objects.length > 0) { - this._altObj.setObjects(altObj.objects); - - this._altObj.pivot = altObj.pivot; - - if ('axis' in altObj) { - this._altObj.axis = altObj.axis.clone(); - } else { - this._altObj.axis.set(0, 0, 1); - } - - shift.set(delta * speedX, delta * speedY); + const color = colorer.getAtomColor(atom, parent); + const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16); + const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent'; + geo.setItem(i, atom.position, text); + geo.setColor(i, fgColor, bgColor); + } + geo.finalize(); + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const opts = this._mode.getLabelOpts(); + const atomsIdc = this._selection.chunks; + const { + atoms + } = this._selection; + const colorer = this._colorer; + const geo = this._geo; + const updateColor = frameData.needsColorUpdate(colorer); + for (let i = 0, n = atomsIdc.length; i < n; ++i) { + const atom = atoms[atomsIdc[i]]; + const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom); + if (!text) { + continue; + } + const color = frameData.getAtomColor(colorer, atom); + const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16); + const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent'; + geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), text); + if (updateColor) { + geo.setColor(i, fgColor, bgColor); + } + } + geo.finalize(); + } +} +/* harmony default export */ const groups_AtomsTextGroup = (AtomsTextGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AromaticGroup.js - this._altObj.translate(shift); - this.dispatchEvent({ - type: 'change', - action: 'translate' - }); +function _slerp(omega, v1, v2, t) { + const oSin = Math.sin(omega); + return v1.clone().multiplyScalar(Math.sin((1 - t) * omega) / oSin).addScaledVector(v2, Math.sin(t * omega) / oSin); +} +class AromaticGroup extends groups_AtomsGroup { + _buildInner(radOffset, addChunk) { + const chunksToIdx = this._selection.chunks; + const prevVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const currVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const segmentsHeight = this._segmentsHeight; + const leprStep = 1.0 / segmentsHeight; + const colorer = this._colorer; + const { + cycles, + parent + } = this._selection; + let chunkIdx = 0; + let currAtomIdx = chunksToIdx[chunkIdx]; + for (let cIdx = 0, cCount = cycles.length; cIdx < cCount; ++cIdx) { + const cycle = cycles[cIdx]; + const cycAtoms = cycle.atoms; + const chunkPoints = []; + const tmpDir = []; + const { + center + } = cycle; + const cycleRad = cycle.radius - radOffset; + const n = cycAtoms.length; + let i = 0; + const prevPos = cycAtoms[n - 1].position; + let currPos = cycAtoms[i].position; + prevVector.subVectors(prevPos, center); + currVector.subVectors(currPos, center); + const upDir = currVector.clone().cross(prevVector).normalize(); + for (; i < n; ++i) { + const omega = prevVector.angleTo(currVector); + tmpDir[i] = _slerp(omega, prevVector, currVector, 0.5).normalize(); + currPos = cycAtoms[(i + 1) % n].position; + prevVector.copy(currVector); + currVector.subVectors(currPos, center); + } + for (i = 0; i < n; ++i) { + if (cycAtoms[i].index !== currAtomIdx) { + continue; + } + const start = tmpDir[i]; + const end = tmpDir[(i + 1) % n]; + const color = colorer.getAtomColor(cycAtoms[i], parent); + const currAngle = start.angleTo(end); + for (let j = 0; j <= segmentsHeight; ++j) { + chunkPoints[j] = _slerp(currAngle, start, end, j * leprStep).multiplyScalar(cycleRad).add(center); } + addChunk(chunkIdx++, color, chunkPoints, center, upDir); + currAtomIdx = chunksToIdx[chunkIdx]; } } - - this._lastUpdateTime = curTime; - }; -}(); - -ObjectControls.prototype.reset = function () { - this._state = STATE.NONE; - this.object.quaternion.copy(quaternion.set(0, 0, 0, 1)); -}; // listeners - - -ObjectControls.prototype.mousedown = function (event) { - if (this.enabled === false || this._state !== STATE.NONE) { - return; } +} +/* harmony default export */ const groups_AromaticGroup = (AromaticGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AromaticTorusGroup.js - event.preventDefault(); - event.stopPropagation(); - - if (this._state === STATE.NONE) { - if (event.button === 0) { - this._affectedObj.stop(); // can edit only one object at a time - - - var workWithAltObj = false; - - if (event.altKey) { - var altObj = this.getAltObj(); - workWithAltObj = altObj.objects.length > 0; - - if (workWithAltObj) { - this._altObj.setObjects(altObj.objects); - this._altObj.pivot = altObj.pivot; - if ('axis' in altObj) { - this._altObj.axis = altObj.axis.clone(); - } else { - this._altObj.axis.set(0, 0, 1); - } - } +function _createShape(rad, parts) { + const pts = []; + for (let i = 0; i < parts; ++i) { + const a = -2 * i / parts * Math.PI; + pts.push(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0)); + } + return pts; +} +const { + calcChunkMatrix +} = gfxutils; +class AromaticTorusGroup extends groups_AromaticGroup { + _build() { + const segmentsHeight = this._segmentsHeight; + const torusRad = this._mode.getAromRadius(); + const radiusV = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(torusRad, torusRad); + const radOffset = this._mode.calcStickRadius() + 2 * torusRad; + const lookAtVector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const mtc = []; + const geo = this._geo; + this._buildInner(radOffset, (chunkIdx, color, points, center, upDir) => { + for (let j = 0; j <= segmentsHeight; ++j) { + const currPoint = points[j]; + const currDir = currPoint.clone().sub(center).cross(upDir); + lookAtVector.addVectors(currPoint, currDir); + mtc[j] = calcChunkMatrix(currPoint, lookAtVector, upDir, radiusV); + } + geo.setItem(chunkIdx, mtc); + geo.setColor(chunkIdx, color); + }); + geo.finalize(); + } + _makeGeoArgs() { + this._segmentsHeight = this._polyComplexity; + return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length]; + } +} +/* harmony default export */ const groups_AromaticTorusGroup = (AromaticTorusGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/AromaticLinesGroup.js + +class AromaticLinesGroup extends groups_AromaticGroup { + _build() { + const geo = this._geo; + const radOffset = this._mode.getAromaticOffset(); + this._buildInner(radOffset, (chunkIdx, color, points) => { + let prevPt = points[0]; // do not replace with start + for (let j = 1; j <= this._segmentsHeight; ++j) { + const currPoint = points[j]; + geo.setSegment(chunkIdx, j - 1, prevPt, currPoint); + prevPt = currPoint; + } + geo.setColor(chunkIdx, color); + }); + geo.finalize(); + } + _makeGeoArgs() { + this._segmentsHeight = this._mode.getAromaticArcChunks(); + return [this._selection.chunks.length, this._segmentsHeight, true]; + } +} +/* harmony default export */ const groups_AromaticLinesGroup = (AromaticLinesGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/ResiduesGroup.js + +class ResiduesGroup extends groups_ChemGroup { + raycast(raycaster, intersects) { + const { + residues + } = this._selection; + const inters = []; + this._mesh.raycast(raycaster, inters); + const chunksIdc = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; + } + const resIdx = chunksIdc[inters[i].chunkIdx]; + if (resIdx < residues.length) { + inters[i].residue = residues[resIdx]; + intersects.push(inters[i]); } - - this._affectedObj = workWithAltObj ? this._altObj : this._mainObj; - this._state = workWithAltObj && event.ctrlKey && this._isTranslationAllowed ? STATE.TRANSLATE : STATE.ROTATE; - } else if (event.button === 2) { - this._state = STATE.TRANSLATE_PIVOT; } } - - if (this._state === STATE.ROTATE) { - this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY); - - this._mousePrevPos.copy(this._mouseCurPos); + _calcChunksList(mask) { + const chunksList = []; + const { + residues + } = this._selection; + const resIdc = this._chunksIdc; + for (let i = 0, n = resIdc.length; i < n; ++i) { + const res = residues[resIdc[i]]; + if ((res._mask & mask) !== 0) { + chunksList.push(i); + } + } + return chunksList; } - - if (this._state === STATE.TRANSLATE || this._state === STATE.TRANSLATE_PIVOT) { - this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); - - this._mousePrevPos.copy(this._mouseCurPos); +} +/* harmony default export */ const groups_ResiduesGroup = (ResiduesGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/NucleicItemGroup.js + +class NucleicItemGroup extends groups_ResiduesGroup { + raycast(raycaster, intersects) { + const { + residues + } = this._selection; + const inters = []; + this._mesh.raycast(raycaster, inters); + const chunksIdc = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; + } + const resIdx = chunksIdc[Math.floor(inters[i].chunkIdx / 2)]; + if (resIdx < residues.length) { + inters[i].residue = residues[resIdx]; + intersects.push(inters[i]); + } + } } -}; - -ObjectControls.prototype.mousemove = function (event) { - if (this.enabled === false || this._state === STATE.NONE) { - return; + _build() { + const { + residues, + parent + } = this._selection; + const colorer = this._colorer; + const geo = this._geo; + const stickRad = this._mode.calcStickRadius(); + let chunkIdx = 0; + const resIdc = this._selection.chunks; + for (let i = 0, n = resIdc.length; i < n; ++i) { + const res = residues[resIdc[i]]; + const color = colorer.getResidueColor(res, parent); + this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color); + } + geo.finalize(); + } + _calcChunksList(mask) { + const chunksList = []; + let chunkIdx = 0; + const { + residues + } = this._selection; + const resIdc = this._chunksIdc; + for (let i = 0, n = resIdc.length; i < n; ++i) { + const res = residues[resIdc[i]]; + if ((res._mask & mask) !== 0) { + chunksList[chunkIdx++] = 2 * i; + chunksList[chunkIdx++] = 2 * i + 1; + } + } + return chunksList; + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const residues = frameData.getResidues(); + const { + parent + } = this._selection; + const colorer = this._colorer; + const geo = this._geo; + const stickRad = this._mode.calcStickRadius(); + let chunkIdx = 0; + const resIdc = this._selection.chunks; + for (let i = 0, n = resIdc.length; i < n; ++i) { + const res = residues[resIdc[i]]; + const color = colorer.getResidueColor(res, parent); + this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color); + } + geo.finishUpdate(); } +} +/* harmony default export */ const groups_NucleicItemGroup = (NucleicItemGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/NucleicCylindersGroup.js - event.preventDefault(); - event.stopPropagation(); - - switch (this._state) { - case STATE.ROTATE: - this._mousePrevPos.copy(this._mouseCurPos); - - this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY); - this.rotateByMouse(event.altKey && !this._isAltObjFreeRotationAllowed || event.shiftKey); - this._lastMouseMoveTime = this._clock.getElapsedTime(); - break; - - case STATE.TRANSLATE: - this._mousePrevPos.copy(this._mouseCurPos); - - this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); - this.translate(); - break; - - case STATE.TRANSLATE_PIVOT: - this._mousePrevPos.copy(this._mouseCurPos); - - this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); - this.translatePivotByMouse(); - break; +class NucleicCylindersGroup extends groups_NucleicItemGroup { + _makeGeoArgs() { + return [this._selection.chunks.length, this._polyComplexity]; } -}; - -ObjectControls.prototype.mousewheel = function (event) { - if (this.enabled === false || !settings.now.zooming || this._state !== STATE.NONE || event.shiftKey) { - return; + _processItem(chunkIdx, cyl1, cyl2, stickRad, color) { + const geo = this._geo; + geo.setItem(chunkIdx, cyl1, cyl2, stickRad); + geo.setColor(chunkIdx, color, color); + } +} +/* harmony default export */ const groups_NucleicCylindersGroup = (NucleicCylindersGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/NucleicSpheresGroup.js + +class NucleicSpheresGroup extends groups_NucleicItemGroup { + _makeGeoArgs() { + return [this._selection.chunks.length * 2, this._polyComplexity]; + } + _processItem(chunkIdx, cyl1, cyl2, stickRad, color) { + const geo = this._geo; + let idx = chunkIdx * 2; + geo.setItem(idx, cyl1, stickRad); + geo.setColor(idx, color); + idx++; + geo.setItem(idx, cyl2, stickRad); + geo.setColor(idx, color); } +} +/* harmony default export */ const groups_NucleicSpheresGroup = (NucleicSpheresGroup); +// EXTERNAL MODULE: ./vendor/js/Smooth.js +var Smooth = __webpack_require__(690); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/CartoonHelper.js - event.preventDefault(); - var delta = 0; - if (event.wheelDelta) { - // WebKit / Opera / Explorer 9 - delta = event.wheelDelta / 40; - } else if (event.detail) { - // Firefox - delta = -event.detail / 3; - } - var factor = 1.0 + delta * 0.05; - factor = Math.max(factor, 0.01); - this.scale(factor); -}; -ObjectControls.prototype.mouseup = function (event) { - if (this.enabled === false || this._state === STATE.NONE) { +const { + ResidueType: CartoonHelper_ResidueType +} = chem; +const calcMatrix = gfxutils.calcChunkMatrix; +function _buildStructureInterpolator(points, tension) { + const path = (0,Smooth.Smooth)(points, { + method: Smooth.Smooth.METHOD_CUBIC, + clip: Smooth.Smooth.CLIP_CLAMP, + cubicTension: tension, + scaleTo: 1 + }); + return function (t, argTrans) { + let transformT = argTrans; + if (transformT === null) { + // map our range to the [second .. last but one] + transformT = function (tt) { + return (tt * (points.length - 1 - 2) + 1) / (points.length - 1); + }; + } + const newt = transformT(t); + const ans = path(newt); + return new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(ans[0], ans[1], ans[2]); + }; +} +function _addPoints(centerPoints, topPoints, idx, residue) { + if (!residue._isValid) { + centerPoints[idx] = centerPoints[idx - 1]; + topPoints[idx] = topPoints[idx - 1]; return; } + const cp = residue._controlPoint; + centerPoints[idx] = [cp.x, cp.y, cp.z]; + const tp = cp.clone().add(residue._wingVector); + topPoints[idx] = [tp.x, tp.y, tp.z]; +} +function _addPointsForLoneResidue(centerPoints, topPoints, idx, residue) { + const nucleic = (residue._type.flags & CartoonHelper_ResidueType.Flags.NUCLEIC) !== 0; + const nameFrom = nucleic ? 'C5\'' : 'N'; + const nameTo = nucleic ? 'C3\'' : 'C'; + let posFrom; + let posTo; + residue.forEachAtom(atom => { + const name = atom.getVisualName(); + if (!posFrom && name === nameFrom) { + posFrom = atom.position; + } else if (!posTo && name === nameTo) { + posTo = atom.position; + } + }); - event.preventDefault(); - event.stopPropagation(); - this._state = STATE.NONE; - - if (this._clock.getElapsedTime() - this._lastMouseMoveTime > FULL_STOP_THRESHOLD) { - this._affectedObj.stop(); + // provide a fallback for unknown residues + if (!(posFrom && posTo)) { + posFrom = residue._firstAtom.position; + posTo = residue._lastAtom.position; + } + if (posFrom && posTo) { + const shift = posTo.clone().sub(posFrom); + const wing = residue._wingVector; + const cp = residue._controlPoint; + const tp = cp.clone().add(wing); + const cpPrev = cp.clone().sub(shift); + const tpPrev = cpPrev.clone().add(wing); + centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z]; + topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z]; + ++idx; + centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z]; + topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z]; + ++idx; + centerPoints[idx] = [cp.x, cp.y, cp.z]; + topPoints[idx] = [tp.x, tp.y, tp.z]; + ++idx; + const cpNext = cp.clone().add(shift); + const tpNext = cpNext.clone().add(wing); + centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z]; + topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z]; + ++idx; + centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z]; + topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z]; + } +} +function _calcPoints(residues, firstIdx, lastIdx, boundaries) { + const left = boundaries.start; + const right = boundaries.end; + function _prevIdx(idx) { + return idx > left && residues[idx - 1]._isValid ? idx - 1 : idx; + } + function _nextIdx(idx) { + return idx < right && residues[idx + 1]._isValid ? idx + 1 : idx; + } + const topPoints = []; + const centerPoints = []; + let arrIdx = 0; + function _extrapolate2(currIdx, otherIdx) { + const cp = residues[currIdx]._controlPoint.clone().lerp(residues[otherIdx]._controlPoint, -0.25); + const tp = cp.clone().add(residues[currIdx]._wingVector); + centerPoints[arrIdx] = [cp.x, cp.y, cp.z]; + topPoints[arrIdx++] = [tp.x, tp.y, tp.z]; + centerPoints[arrIdx] = [cp.x, cp.y, cp.z]; + topPoints[arrIdx++] = [tp.x, tp.y, tp.z]; } -}; -ObjectControls.prototype.touchstartend = function (event) { - if (this.enabled === false) { - return; + // a single disconnected residue + const prevIdx = _prevIdx(firstIdx); + const nextIdx = _nextIdx(lastIdx); + if (prevIdx === nextIdx) { + _addPointsForLoneResidue(centerPoints, topPoints, arrIdx, residues[firstIdx]); + return { + centerPoints, + topPoints + }; } - event.preventDefault(); - event.stopPropagation(); + // Two points (prev-prev and next-next) are added to support edge conditions for cubic splines, they are ignored + // Another two (prev and next) were added to support the outside of the sub chain - switch (event.touches.length) { - case 1: - this._state = STATE.ROTATE; - this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY); + // prev and prev-prev + if (firstIdx === prevIdx) { + // do the extrapolation + _extrapolate2(firstIdx, _nextIdx(firstIdx)); + } else { + _addPoints(centerPoints, topPoints, arrIdx++, residues[_prevIdx(prevIdx)]); + _addPoints(centerPoints, topPoints, arrIdx++, residues[prevIdx]); + } - this._mousePrevPos.copy(this._mouseCurPos); + // main loop + for (let idx = firstIdx; idx <= lastIdx; ++idx) { + _addPoints(centerPoints, topPoints, arrIdx++, residues[idx]); + } - break; + // next and next-next + if (nextIdx === _nextIdx(nextIdx)) { + // do the extrapolation + _extrapolate2(lastIdx, _prevIdx(lastIdx)); + } else { + _addPoints(centerPoints, topPoints, arrIdx++, residues[nextIdx]); + _addPoints(centerPoints, topPoints, arrIdx, residues[_nextIdx(nextIdx)]); + } + return { + centerPoints, + topPoints + }; +} +class CartoonHelper { + constructor(residues, startIdx, endIdx, segmentsCount, tension, boundaries) { + const pointsArrays = _calcPoints(residues, startIdx, endIdx, boundaries); + this._topInterp = _buildStructureInterpolator(pointsArrays.topPoints, tension); + this._centerInterp = _buildStructureInterpolator(pointsArrays.centerPoints, tension); + this._shift = 0.5 / (endIdx - startIdx + 2); + this._valueStep = (1.0 - 2 * this._shift) / (2 * (endIdx - startIdx + 1) * (segmentsCount - 1)); + this._segmentsCount = segmentsCount; + } + prepareMatrices(idx, firstRad, secondRad) { + const mtcCount = this._segmentsCount; + const outMtc = new Array(mtcCount); + const currRad = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(0, 0); + const topInterp = this._topInterp; + const cenInterp = this._centerInterp; + let currentValue = this._shift + this._valueStep * (mtcCount - 1) * idx; + for (let mtxIdx = 0; mtxIdx < mtcCount; ++mtxIdx) { + const lerpVal = Math.min(1.0, mtxIdx / (mtcCount - 1)); + currRad.lerpVectors(firstRad, secondRad, lerpVal); + const currTop = topInterp(currentValue, null); + const currCenter = cenInterp(currentValue, null); + currentValue += this._valueStep; + const nextCenter = cenInterp(currentValue, null); + outMtc[mtxIdx] = calcMatrix(currCenter.clone(), nextCenter.clone(), currTop.clone().sub(currCenter), currRad); + } + return outMtc; + } +} +/* harmony default export */ const groups_CartoonHelper = (CartoonHelper); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/ResiduesSubseqGroup.js - case 2: - { - // prevent inertial rotation - this._mainObj.stop(); - this._altObj.stop(); - this._state = STATE.SCALE; - var dx = event.touches[0].pageX - event.touches[1].pageX; - var dy = event.touches[0].pageY - event.touches[1].pageY; - this._touchDistanceCur = this._touchDistanceStart = Math.sqrt(dx * dx + dy * dy); - this._scaleStart = this.object.scale.x; - break; +function ResiduesSubseqGroup_createShape(rad, parts) { + const pts = []; + for (let i = 0; i < parts; ++i) { + // starts from pi/2 because it's important that points are lied on the angles of arrows (visual issues if not) + const a = Math.PI / 2.0 - 2 * Math.PI * i / parts; + pts.push(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0)); + } + return pts; +} +function _loopThrough(subDiv, residues, segmentsHeight, tension, mode, callback) { + for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { + const subs = subDiv[subDivI].arr; + const { + boundaries + } = subDiv[subDivI]; + for (let i = 0, n = subs.length; i < n; ++i) { + const idc = [subs[i].start, subs[i].end]; + const matrixHelper = new groups_CartoonHelper(residues, idc[0], idc[1], segmentsHeight, tension, boundaries); + let prevLast = null; + const startIdx = subs[i].start * 2; + const endIdx = subs[i].end * 2 + 1; + let prevSecondRad = mode.getResidueRadius(residues[0], 0); + for (let idx = startIdx; idx <= endIdx; ++idx) { + const resIdx = idx / 2 | 0; + const currRes = residues[resIdx]; + const firstRad = mode.getResidueRadius(currRes, idx % 2); + const secondRad = mode.getResidueRadius(currRes, 1 + idx % 2); + const mtc = matrixHelper.prepareMatrices(idx - idc[0] * 2, firstRad, secondRad); + mtc.unshift(prevLast === null ? mtc[0] : prevLast); + + // Slope - radius is changed along this residue part + const hasSlope = firstRad.x !== secondRad.x || firstRad.y !== secondRad.y; + // Cut - end radius of previous part not equal to start radius of this part. First section of this part lies in the orthogonal plane + const hasCut = firstRad.x !== prevSecondRad.x || firstRad.y !== prevSecondRad.y; + callback(currRes, mtc, hasSlope, hasCut); + prevLast = mtc[segmentsHeight]; + prevSecondRad = secondRad; } - - default: - this._state = STATE.NONE; + } } -}; - -ObjectControls.prototype.touchmove = function (event) { - if (this.enabled === false || this._state === STATE.NONE) { - return; +} +class ResiduesSubseqGroup extends groups_ResiduesGroup { + _makeGeoArgs() { + const cmpMultiplier = this._mode.getHeightSegmentsRatio(); + this._segmentsHeight = this._polyComplexity * cmpMultiplier | 0; + return [ResiduesSubseqGroup_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length * 2]; + } + _build() { + const { + residues, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const tension = mode.getTension(); + const geo = this._geo; + let chunkIdx = 0; + const chunkIdc = []; + _loopThrough(this._selection.subdivs, residues, this._segmentsHeight, tension, mode, function (currRes, mtc) { + let hasSlope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + let hasCut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + const color = colorer.getResidueColor(currRes, parent); + chunkIdc[chunkIdx] = currRes._index; + geo.setItem(chunkIdx, mtc, hasSlope, hasCut); + geo.setColor(chunkIdx++, color); + }); + this._chunksIdc = chunkIdc; + geo.finalize(); + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const { + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const tension = mode.getTension(); + const geo = this._geo; + const frameRes = frameData.getResidues(); + let chunkIdx = 0; + const updateColor = frameData.needsColorUpdate(colorer); + _loopThrough(this._selection.subdivs, frameRes, this._segmentsHeight, tension, mode, (currRes, mtc) => { + geo.setItem(chunkIdx, mtc); + if (updateColor) { + geo.setColor(chunkIdx, colorer.getResidueColor(currRes, parent)); + } + chunkIdx++; + }); + geo.finalize(); } +} +/* harmony default export */ const groups_ResiduesSubseqGroup = (ResiduesSubseqGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/ResiduesTraceGroup.js + +class ResiduesTraceGroup extends groups_ChemGroup { + _makeGeoArgs() { + const subDiv = this._selection.subdivs; + let chunksCount = 0; + for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { + const subs = subDiv[subDivI].arr; + for (let i = 0, n = subs.length; i < n; ++i) { + chunksCount += subs[i].end - subs[i].start; + } + } + return [chunksCount, this._polyComplexity]; + } + _build() { + const { + residues, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + let chunkIdx = 0; + const chunkIdc = []; + const subDiv = this._selection.subdivs; + const stickRad = mode.calcStickRadius(); + for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { + const subs = subDiv[subDivI].arr; + for (let i = 0, n = subs.length; i < n; ++i) { + const startIdx = subs[i].start; + const endIdx = subs[i].end; + let prevRes = residues[startIdx]; + for (let idx = startIdx + 1; idx <= endIdx; ++idx) { + const currRes = residues[idx]; + chunkIdc[chunkIdx] = { + first: prevRes._index, + second: currRes._index + }; + geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad); + geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent)); + chunkIdx++; + prevRes = currRes; + } + } + } + this._chunksIdc = chunkIdc; + geo.finalize(); + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + + const residues = frameData.getResidues(); + const { + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + let chunkIdx = 0; + const subDiv = this._selection.subdivs; + const stickRad = mode.calcStickRadius(); + const updateColor = frameData.needsColorUpdate(colorer); + for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) { + const subs = subDiv[subDivI].arr; + for (let i = 0, n = subs.length; i < n; ++i) { + const startIdx = subs[i].start; + const endIdx = subs[i].end; + let prevRes = residues[startIdx]; + for (let idx = startIdx + 1; idx <= endIdx; ++idx) { + const currRes = residues[idx]; + geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad); + if (updateColor) { + geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent)); + } + chunkIdx++; + prevRes = currRes; + } + } + } + geo.finalize(); + } + raycast(raycaster, intersects) { + const inters = []; + const { + residues + } = this._selection; + this._mesh.raycast(raycaster, inters); + const chunksToIdx = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; + } + const { + chunkIdx + } = inters[i]; + const chunk = chunksToIdx[Math.floor(chunkIdx / 2)]; + const resIdx = chunkIdx % 2 === 0 ? chunk.first : chunk.second; + if (resIdx < residues.length) { + inters[i].residue = residues[resIdx]; + intersects.push(inters[i]); + } + } + } + _calcChunksList(mask) { + const chunksList = []; + const chunksToIdx = this._chunksIdc; + const { + residues + } = this._selection; + for (let i = 0, n = chunksToIdx.length; i < n; ++i) { + const chunk = chunksToIdx[i]; + if (residues[chunk.first]._mask & mask) { + chunksList.push(i * 2); + } + if (residues[chunk.second]._mask & mask) { + chunksList.push(i * 2 + 1); + } + } + return chunksList; + } +} +/* harmony default export */ const groups_ResiduesTraceGroup = (ResiduesTraceGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/BondsGroup.js - event.preventDefault(); - event.stopPropagation(); - - switch (this._state) { - case STATE.ROTATE: - this._mousePrevPos.copy(this._mouseCurPos); - - this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY); - this.rotateByMouse(false); - this._lastMouseMoveTime = this._clock.getElapsedTime(); - break; - case STATE.SCALE: - if (settings.now.zooming) { - // update scale - var dx = event.touches[0].pageX - event.touches[1].pageX; - var dy = event.touches[0].pageY - event.touches[1].pageY; - this._touchDistanceCur = Math.sqrt(dx * dx + dy * dy); - var newScale = this._scaleStart * this._touchDistanceCur / this._touchDistanceStart; - var factor = newScale / this.object.scale.x; - this.scale(factor); +function getCylinderCount(bondOrder) { + return bondOrder < 2 ? 1 : bondOrder; +} +class BondsGroup extends groups_ChemGroup { + _makeGeoArgs() { + const drawMultiple = this._mode.drawMultiorderBonds(); + const showAromatic = this._mode.showAromaticLoops(); + const bondsIdc = this._selection.chunks; + const { + bonds + } = this._selection; + let bondsCount = 0; + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + bondsCount += this.getBondOrder(bonds[bondsIdc[i]], drawMultiple, showAromatic); + } + return [bondsCount, this._polyComplexity]; + } + getBondOrder(bond, drawMultiple, showAromatic) { + let bondOrder = 1; + if (drawMultiple && (!showAromatic || bond._type !== chem_Bond.BondType.AROMATIC)) { + bondOrder = getCylinderCount(bond._order); + } + return bondOrder; + } + raycast(raycaster, intersects) { + const { + bonds + } = this._selection; + const inters = []; + this._mesh.raycast(raycaster, inters); + const bondsIdc = this._chunksIdc; + // process inters array - arr object references + for (let i = 0, n = inters.length; i < n; ++i) { + if (!inters[i].hasOwnProperty('chunkIdx')) { + continue; } - - break; + const { + chunkIdx + } = inters[i]; + const bondIdx = bondsIdc[Math.floor(chunkIdx / 2)]; + if (bondIdx < bonds.length) { + const bond = bonds[bondIdx]; + inters[i].atom = chunkIdx % 2 === 0 ? bond._left : bond._right; + intersects.push(inters[i]); + } + } } -}; - -ObjectControls.prototype.keydownup = function (event) { - if (this.enabled === false || this.hotkeysEnabled === false) { - return; + _calcChunksList(mask, innerOnly) { + const chunksList = []; + const { + bonds + } = this._selection; + const chunksToIdx = this._chunksIdc; + for (let i = 0, n = chunksToIdx.length; i < n; ++i) { + const bond = bonds[chunksToIdx[i]]; + if (bond._left.mask & mask && (!innerOnly || bond._right.mask & mask)) { + chunksList.push(2 * i); + } + if (bond._right.mask & mask && (!innerOnly || bond._left.mask & mask)) { + chunksList.push(2 * i + 1); + } + } + return chunksList; } - - switch (event.keyCode) { - case VK_LEFT: - case VK_UP: - case VK_RIGHT: - case VK_DOWN: - this._pressedKeys[event.keyCode] = event.type === 'keydown'; - event.preventDefault(); - event.stopPropagation(); - break; +} +/* harmony default export */ const groups_BondsGroup = (BondsGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/BondsCylinderGroup.js + + +class BondsCylinderGroup extends groups_BondsGroup { + _build() { + const bondsIdc = this._selection.chunks; + const { + bonds, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + const drawMultiple = mode.drawMultiorderBonds(); + const showAromatic = mode.showAromaticLoops(); + const stickRad = mode.calcStickRadius(); + const emptyOffset = mode.calcSpaceFraction(); + let normDir; + const leftPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const rightPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + let currBondIdx = 0; + const chunksToIdx = []; + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + const bond = bonds[bondsIdc[i]]; + const atom1 = bond._left; + const atom2 = bond._right; + const a1Pos = atom1.position; + const a2Pos = atom2.position; + normDir = bond.calcNormalDir(); + const order = this.getBondOrder(bond, drawMultiple, showAromatic); + const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2)); + const dist = 2 * minRad / order; + const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad; + for (let j = 0; j < order; ++j) { + const scale = dist * (order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2))); + chunksToIdx[currBondIdx] = bond._index; + leftPos.copy(a1Pos); + leftPos.addScaledVector(normDir, scale); + rightPos.copy(a2Pos); + rightPos.addScaledVector(normDir, scale); + geo.setItem(currBondIdx, leftPos, rightPos, currStickRad); + geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent)); + } + } + geo.finalize(); + this._chunksIdc = chunksToIdx; + } + updateToFrame(frameData) { + const bondsIdc = this._selection.chunks; + const { + bonds + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + const drawMultiple = mode.drawMultiorderBonds(); + const showAromatic = mode.showAromaticLoops(); + const stickRad = mode.calcStickRadius(); + const emptyOffset = mode.calcSpaceFraction(); + let normDir; + const leftPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const rightPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + let currBondIdx = 0; + const updateColor = frameData.needsColorUpdate(colorer); + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + const bond = bonds[bondsIdc[i]]; + const atom1 = bond._left; + const atom2 = bond._right; + const a1Pos = frameData.getAtomPos(atom1.index).clone(); + const a2Pos = frameData.getAtomPos(atom2.index); + normDir = bond.calcNormalDir(); + const order = this.getBondOrder(bond, drawMultiple, showAromatic); + const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2)); + const dist = 2 * minRad / order; + const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad; + for (let j = 0; j < order; ++j) { + const scale = dist * (order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2))); + leftPos.copy(a1Pos); + leftPos.addScaledVector(normDir, scale); + rightPos.copy(a2Pos); + rightPos.addScaledVector(normDir, scale); + geo.setItem(currBondIdx, leftPos, rightPos, currStickRad); + if (updateColor) { + geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2)); + } + currBondIdx++; + } + } + geo.finalize(); } -}; +} +/* harmony default export */ const groups_BondsCylinderGroup = (BondsCylinderGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/BondsLinesGroup.js + + +const STEP_SIZE = 0.15; +class BondsLinesGroup extends groups_BondsGroup { + _build() { + const bondsIdc = this._selection.chunks; + const { + bonds, + parent + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + const drawMultiple = mode.drawMultiorderBonds(); + const showAromatic = mode.showAromaticLoops(); + const bondDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const leftPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const rightPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + let currBondIdx = 0; + const chunksToIdx = []; + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + const bond = bonds[bondsIdc[i]]; + const atom1 = bond._left; + const atom2 = bond._right; + const a1Pos = atom1.position; + const a2Pos = atom2.position; + const a1Hangs = atom1.bonds.length === 1; + const a2Hangs = atom2.bonds.length === 1; + bondDir.subVectors(a2Pos, a1Pos); + const len = bondDir.length(); + const normDir = bond.calcNormalDir(); + const order = this.getBondOrder(bond, drawMultiple, showAromatic); + for (let j = 0; j < order; ++j) { + leftPos.copy(a1Pos); + rightPos.copy(a2Pos); + let scale = order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2)); + chunksToIdx[currBondIdx] = bond._index; + if (order === 2 && !a1Hangs && !a2Hangs) { + scale -= 0.5; + scale *= -1; + } + if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) { + leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / len); + rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / len); + } + scale *= STEP_SIZE; + leftPos.addScaledVector(normDir, scale); + rightPos.addScaledVector(normDir, scale); + geo.setItem(currBondIdx, leftPos, rightPos); + geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent)); + } + } + geo.finalize(); + this._chunksIdc = chunksToIdx; + } + updateToFrame(frameData) { + // This method looks like a copy paste. However, it + // was decided to postpone animation refactoring until GFX is fixed. + const bondsIdc = this._selection.chunks; + const { + bonds + } = this._selection; + const mode = this._mode; + const colorer = this._colorer; + const geo = this._geo; + const drawMultiple = mode.drawMultiorderBonds(); + const showAromatic = mode.showAromaticLoops(); + const bondDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const leftPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const rightPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + let currBondIdx = 0; + const updateColor = frameData.needsColorUpdate(colorer); + for (let i = 0, n = bondsIdc.length; i < n; ++i) { + const bond = bonds[bondsIdc[i]]; + const atom1 = bond._left; + const atom2 = bond._right; + const a1Pos = frameData.getAtomPos(atom1.index).clone(); + const a2Pos = frameData.getAtomPos(atom2.index); + const a1Hangs = atom1.bonds.length === 1; + const a2Hangs = atom2.bonds.length === 1; + bondDir.subVectors(a2Pos, a1Pos); + const len = bondDir.length(); + const normDir = bond.calcNormalDir(); + const order = this.getBondOrder(bond, drawMultiple, showAromatic); + for (let j = 0; j < order; ++j) { + leftPos.copy(a1Pos); + rightPos.copy(a2Pos); + let scale = order % 2 === 0 ? ((j / 2 | 0) + 0.5) * (1 - 2 * (j % 2)) : ((j + 1) / 2 | 0) * (-1 + 2 * (j % 2)); + if (order === 2 && !a1Hangs && !a2Hangs) { + scale -= 0.5; + scale *= -1; + } + if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) { + leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / len); + rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / len); + } + scale *= STEP_SIZE; + leftPos.addScaledVector(normDir, scale); + rightPos.addScaledVector(normDir, scale); + geo.setItem(currBondIdx, leftPos, rightPos); + if (updateColor) { + geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2)); + } + currBondIdx++; + } + } + geo.finalize(); + } +} +/* harmony default export */ const groups_BondsLinesGroup = (BondsLinesGroup); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/groups.js -ObjectControls.prototype.getKeyBindObject = function () { - return window.top; -}; -ObjectControls.prototype.dispose = function () { - for (var i = 0; i < this._listeners.length; i++) { - var l = this._listeners[i]; - l.obj.removeEventListener(l.type, l.handler); - } -}; -ObjectControls.prototype.translatePivotByMouse = function () { - var delta = new Vector2(); - return function () { - delta.subVectors(this._mouseCurPos, this._mousePrevPos); - this.translatePivotInWorld(settings.now.translationSpeed * delta.x, settings.now.translationSpeed * delta.y, 0); - }; -}(); // Translate in WorldCS, translation is scaled with root scale matrix -ObjectControls.prototype.translatePivotInWorld = function (x, y, z) { - var pos = this.objectPivot.position; - pos.applyMatrix4(this.object.matrixWorld); - pos.setX(pos.x + x); - pos.setY(pos.y + y); - pos.setZ(pos.z + z); - pos.applyMatrix4(matrix4.getInverse(this.object.matrixWorld)); - this.dispatchEvent({ - type: 'change', - action: 'translatePivot' - }); -}; // Translate in ModelCS, x, y, z are Ang -ObjectControls.prototype.translatePivot = function (x, y, z) { - var pos = this.objectPivot.position; - pos.setX(pos.x + x); - pos.setY(pos.y + y); - pos.setZ(pos.z + z); - this.dispatchEvent({ - type: 'change', - action: 'translatePivot' - }); -}; // Set pivot -ObjectControls.prototype.setPivot = function (newPivot) { - this.objectPivot.position.copy(newPivot); - this.dispatchEvent({ - type: 'change', - action: 'translatePivot' - }); -}; -function Picker(gfxObj, camera, domElement) { - EventDispatcher.call(this); - var self = this; - this.gfxObj = gfxObj; - this.camera = camera; - this.domElement = typeof domElement !== 'undefined' ? domElement : document; - this.screen = { - left: 0, - top: 0, - width: 0, - height: 0 - }; - this._lastMousePos = new Vector2(0, 0); - this._mouseTotalDist = 0.0; - this._lastClickBeginTime = -1000.0; - this._lastClickPos = new Vector2(0, 0); - this._clickBeginTime = 0.0; - this._clock = new Timer(); - this._clock.start(); - this._listeners = [{ - obj: self.domElement, - type: 'mousedown', - handler: function handler(e) { - self.mousedown(e); - } - }, { - obj: self.domElement, - type: 'mouseup', - handler: function handler(e) { - self.mouseup(e); - } - }, { - obj: self.domElement, - type: 'mousemove', - handler: function handler(e) { - self.mousemove(e); +/* harmony default export */ const groups = ({ + AtomsSphereGroup: groups_AtomsSphereGroup, + AtomsSurfaceGroup: groups_AtomsSurfaceGroup, + AtomsSASSESGroupStub: groups_AtomsSASSESGroupStub, + AtomsTextGroup: groups_AtomsTextGroup, + AromaticTorusGroup: groups_AromaticTorusGroup, + AromaticLinesGroup: groups_AromaticLinesGroup, + NucleicCylindersGroup: groups_NucleicCylindersGroup, + NucleicSpheresGroup: groups_NucleicSpheresGroup, + ResiduesSubseqGroup: groups_ResiduesSubseqGroup, + ResiduesTraceGroup: groups_ResiduesTraceGroup, + BondsCylinderGroup: groups_BondsCylinderGroup, + BondsLinesGroup: groups_BondsLinesGroup +}); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/AtomsProcessor.js + +class AtomsProcessor extends gfx_RCGroup { + constructor(AtomsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + this._mode = mode; + const atoms = complex.getAtoms(); + const transforms = complex.getTransforms(); + complex.forEachComponent(component => { + const atomsIdc = []; + let atomCount = 0; + component.forEachAtom(atom => { + if (!self._checkAtom(atom, mask)) { + return; + } + atomsIdc[atomCount++] = atom.index; + }); + if (atomCount === 0) { + return; + } + const atomsGroup = new AtomsGroup(geoParams, { + atoms, + chunks: atomsIdc, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + atomsGroup._component = component; + self.add(atomsGroup); + }); + } + _checkAtom(atom, mask) { + return atom.mask & mask; + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } } - }, { - obj: self.domElement, - type: 'touchstart', - handler: function handler(e) { - self.touchstart(e); + return totalSubset; + } +} +/* harmony default export */ const processors_AtomsProcessor = (AtomsProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/OrphanAtomsProcessor.js + +class OrphanAtomsProcessor extends processors_AtomsProcessor { + _checkAtom(atom, mask) { + if (!(atom.mask & mask)) { + return false; } - }, { - obj: self.domElement, - type: 'touchend', - handler: function handler(e) { - self.touchend(e); + const { + bonds + } = atom; + for (let i = 0, n = bonds.length; i < n; ++i) { + if (bonds[i]._left.mask & mask && bonds[i]._right.mask & mask) { + return false; + } } - }, { - obj: window, - type: 'resize', - handler: function handler() { - self.handleResize(); + return true; + } +} +/* harmony default export */ const processors_OrphanAtomsProcessor = (OrphanAtomsProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/ResiduesProcessor.js + +class ResiduesProcessor extends gfx_RCGroup { + constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + const residues = complex.getResidues(); + const transforms = complex.getTransforms(); + complex.forEachComponent(component => { + let chunksCount = 0; + const resIdc = []; + component.forEachResidue(residue => { + if (self._checkResidue(residue, mask)) { + resIdc[chunksCount++] = residue._index; + } + }); + if (chunksCount === 0) { + return; + } + const residuesGroup = new ResidueGroup(geoParams, { + residues, + chunks: resIdc, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + residuesGroup._component = component; + self.add(residuesGroup); + }); + } + checkResidue(residue, mask) { + return residue._mask & mask; + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } } - }]; - - for (var i = 0; i < this._listeners.length; i++) { - var l = this._listeners[i]; - l.obj.addEventListener(l.type, l.handler); + return totalSubset; } - - this.handleResize(); } +/* harmony default export */ const processors_ResiduesProcessor = (ResiduesProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/NucleicProcessor.js -Picker.prototype = Object.create(EventDispatcher.prototype); -Picker.prototype.constructor = Picker; - -Picker.prototype.reset = function () { - this.picked = {}; - this.dispatchEvent({ - type: 'newpick', - obj: {} - }); -}; - -Picker.prototype.handleResize = function () { - if (this.domElement === document) { - this.screen.left = 0; - this.screen.top = 0; - this.screen.width = window.innerWidth; - this.screen.height = window.innerHeight; - } else { - var box = this.domElement.getBoundingClientRect(); // adjustments come from similar code in the jquery offset() function - - var d = this.domElement.ownerDocument.documentElement; - this.screen.left = box.left + window.pageXOffset - d.clientLeft; - this.screen.top = box.top + window.pageYOffset - d.clientTop; - this.screen.width = box.width; - this.screen.height = box.height; +class NucleicProcessor extends processors_ResiduesProcessor { + _checkResidue(residue, mask) { + return mask & residue._mask && residue._cylinders !== null; } -}; +} +/* harmony default export */ const processors_NucleicProcessor = (NucleicProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/SubseqsProcessor.js -Picker.prototype.pickObject = function (screenPos) { - if (!this.gfxObj) { - this.picked = {}; - this.dispatchEvent({ - type: 'newpick', - obj: {} +class SubseqsProcessor extends gfx_RCGroup { + constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + const residues = complex.getResidues(); + const transforms = complex.getTransforms(); + complex.forEachComponent(component => { + const subDivs = component.getMaskedSubdivSequences(mask); + let chunksCount = 0; + const resIdc = []; + for (let subDivI = 0, subDivN = subDivs.length; subDivI < subDivN; ++subDivI) { + const subs = subDivs[subDivI].arr; + for (let i = 0, n = subs.length; i < n; ++i) { + for (let j = subs[i].start, jEnd = subs[i].end; j <= jEnd; ++j) { + resIdc[chunksCount++] = residues[j]._index; + } + } + } + if (chunksCount === 0) { + return; + } + const residuesGroup = new ResidueGroup(geoParams, { + residues, + chunks: resIdc, + subdivs: subDivs, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + residuesGroup._component = component; + self.add(residuesGroup); }); - return; } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } + } + return totalSubset; + } +} +/* harmony default export */ const processors_SubseqsProcessor = (SubseqsProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/BondsProcessor.js - var gfxObj = this.gfxObj; - var rayCaster = new Raycaster(); - rayCaster.ray.origin.setFromMatrixPosition(this.camera.matrixWorld); - rayCaster.ray.direction.set(screenPos.x, screenPos.y, 0.5).unproject(this.camera).sub(rayCaster.ray.origin).normalize(); - var clipPlane = settings.now.draft.clipPlane && this.clipPlaneValue ? this.clipPlaneValue : Infinity; - var fogFarPlane = settings.now.fog && this.fogFarValue ? this.fogFarValue : Infinity; - var point = rayCaster.intersectVisibleObject(gfxObj, this.camera, clipPlane, fogFarPlane); +class BondsProcessor extends gfx_RCGroup { + constructor(BondsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + const bonds = complex.getBonds(); + const transforms = complex.getTransforms(); + complex.forEachComponent(component => { + const bondsIdc = []; + let bondsCount = 0; + component.forEachBond(bond => { + const atom1 = bond._left; + const atom2 = bond._right; + if (!(atom1.mask & mask) || !(atom2.mask & mask)) { + return; + } + bondsIdc[bondsCount++] = bond._index; + }); + if (bondsCount === 0) { + return; + } + const bondsGroup = new BondsGroup(geoParams, { + bonds, + chunks: bondsIdc, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + bondsGroup._component = component; + self.add(bondsGroup); + }); + } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } + } + return totalSubset; + } +} +/* harmony default export */ const processors_BondsProcessor = (BondsProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/AromaticProcessor.js - if (!point) { - this.picked = {}; - this.dispatchEvent({ - type: 'newpick', - obj: {} +class AromaticProcessor extends gfx_RCGroup { + constructor(AromaticGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) { + super(); + const self = this; + this._complex = complex; + const atoms = complex.getAtoms(); + const transforms = complex.getTransforms(); + if (!mode.showAromaticLoops()) { + return; + } + complex.forEachComponent(component => { + const atomsIdc = []; + let chunksCount = 0; + const cycles = []; + let cycleIdx = 0; + component.forEachCycle(cycle => { + const cycAtoms = cycle.atoms; + let perCycle = 0; + for (let i = 0, n = cycAtoms.length; i < n; ++i) { + if ((cycAtoms[i].mask & mask) !== 0) { + ++perCycle; + atomsIdc[chunksCount++] = cycAtoms[i].index; + } + } + if (perCycle > 0) { + cycles[cycleIdx++] = cycle; + } + }); + const atomsGroup = new AromaticGroup(geoParams, { + cycles, + atoms, + chunks: atomsIdc, + parent: complex + }, colorer, mode, transforms, polyComplexity, material); + atomsGroup._component = component; + self.add(atomsGroup); }); - return; } + getSubset(mask, innerOnly) { + const totalSubset = []; + const { + children + } = this; + let meshIdx = 0; + for (let i = 0, n = children.length; i < n; ++i) { + if (children[i].getSubset) { + const chSubset = children[i].getSubset(mask, innerOnly); + for (let j = 0, m = chSubset.length; j < m; ++j) { + const subsetEl = chSubset[j]; + subsetEl._component = children[i]._component; + totalSubset[meshIdx++] = subsetEl; + } + } + } + return totalSubset; + } +} +/* harmony default export */ const processors_AromaticProcessor = (AromaticProcessor); +;// CONCATENATED MODULE: ./src/gfx/modes/processors/processors.js - var picked = {}; - if (point.residue || point.atom) { - var residue = point.residue || point.atom.residue; - if (settings.now.pick === 'chain') { - picked = { - chain: residue.getChain() - }; - } else if (settings.now.pick === 'molecule') { - picked = { - molecule: residue.getMolecule() - }; - } else if (point.residue || settings.now.pick === 'residue') { - picked = { - residue: residue - }; - } else if (point.atom) { - picked = { - atom: point.atom - }; - } - } - this.picked = picked; - this.dispatchEvent({ - type: 'newpick', - obj: picked - }); -}; -Picker.prototype.getMouseInViewport = function (pageX, pageY) { - return new Vector2((pageX - this.screen.left) / this.screen.width * 2 - 1, -(pageY - this.screen.top) / this.screen.height * 2 + 1); -}; -Picker.prototype.mousedown = function (event) { - event.preventDefault(); - event.stopPropagation(); - if (event.button === 0) { - this._lastMousePos = this.getMouseInViewport(event.pageX, event.pageY); - this._mouseTotalDist = 0.0; - this._clickBeginTime = this._clock.getElapsedTime(); - } -}; +/* harmony default export */ const processors = ({ + Atoms: processors_AtomsProcessor, + OrphanAtoms: processors_OrphanAtomsProcessor, + Residues: processors_ResiduesProcessor, + Nucleic: processors_NucleicProcessor, + Subseqs: processors_SubseqsProcessor, + Bonds: processors_BondsProcessor, + Aromatic: processors_AromaticProcessor +}); +;// CONCATENATED MODULE: ./src/gfx/modes/groups/GroupsFactory.js -Picker.prototype.mousemove = function (event) { - event.preventDefault(); - event.stopPropagation(); - var pos = this.getMouseInViewport(event.pageX, event.pageY); - this._mouseTotalDist += pos.sub(this._lastMousePos).length(); -}; -Picker.prototype.mouseup = function (event) { - var self = this; - event.preventDefault(); - event.stopPropagation(); - if (event.button === 0) { - if (this._mouseTotalDist < 0.01) { - var curTime = this._clock.getElapsedTime(); +function _bakeGroup(triplet, Processor, Group) { + return function (complex, colorer, mode, polyComplexity, mask, material) { + return new Processor(Group, triplet, complex, colorer, mode, polyComplexity, mask, material); + }; +} +class GroupsFactory { + static AtomsSpheres(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createSpheres(caps, settings); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSphereGroup); + } + static OrphanedAtomsCrosses(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createCrosses(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.OrphanAtoms, groups.AtomsSphereGroup); + } + static BondsCylinders(caps, settings) { + const gfxTriplet = meshes_MeshCreator.create2CCylinders(caps, settings); + return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsCylinderGroup); + } + static BondsLines(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.create2CLines(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsLinesGroup); + } + static CartoonChains(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createExtrudedChains(caps, settings); + return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesSubseqGroup); + } + static TraceChains(caps, settings) { + const gfxTriplet = meshes_MeshCreator.create2CClosedCylinders(caps, settings); + return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesTraceGroup); + } + static NucleicSpheres(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createSpheres(caps, settings); + return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicSpheresGroup); + } + static NucleicCylinders(caps, settings) { + const gfxTriplet = meshes_MeshCreator.create2CCylinders(caps, settings); + return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicCylindersGroup); + } + static ALoopsTorus(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createExtrudedChains(caps, settings); + return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticTorusGroup); + } + static ALoopsLines(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createChunkedLines(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticLinesGroup); + } + static QuickSurfGeo(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createQuickSurface(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup); + } + static ContactSurfaceGeo(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createContactSurface(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup); + } + static SASSESSurfaceGeo(caps, settings, renderParams) { + const gfxTriplet = meshes_MeshCreator.createSASSES(caps, settings, renderParams); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSASSESGroupStub); + } + static TextLabelsGeo(caps, settings) { + const gfxTriplet = meshes_MeshCreator.createLabels(caps, settings); + return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsTextGroup); + } +} +/* harmony default export */ const groups_GroupsFactory = (GroupsFactory); +;// CONCATENATED MODULE: ./src/gfx/modes/Mode.js - var curPos = this.getMouseInViewport(event.pageX, event.pageY); - var timeSinceLastClickBegin = curTime - this._lastClickBeginTime; - if (timeSinceLastClickBegin < 0.7) { - var clickDist = new Vector2().subVectors(curPos, this._lastClickPos); - if (clickDist.length() < 0.01) { - // it's a double click - this.dispatchEvent({ - type: 'dblclick', - obj: this.picked - }); - this._lastClickPos = curPos; - this._lastClickBeginTime = -1000; // this click cannot serve as first click in double-click - return; - } - } - setTimeout(function () { - self.pickObject(curPos); - }, 0); - this._lastClickPos = curPos; - this._lastClickBeginTime = this._clickBeginTime; + +/** + * Create new mode. + * + * @param {object=} opts - Options to override defaults with. + * + * These options are copied locally and not kept by reference, so the created instance will not reflect further + * changes to the `opts` object. However, changes in defaults **will** affect the mode after its creation. + * + * @exports Mode + * @this Mode + * @abstract + * @constructor + * @classdesc Basic class for all available modes used for building and displaying molecule geometry. + */ +class Mode { + constructor(opts) { + if (this.constructor === Mode) { + throw new Error('Can not instantiate abstract class!'); } + /** + * Mode options inherited (prototyped) from defaults. + * @type {object} + */ + this.opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge(utils.deriveDeep(this.settings.now.modes[this.id], true), opts); } -}; - -Picker.prototype.touchstart = function (event) { - event.preventDefault(); - event.stopPropagation(); - if (event.touches.length === 1) { - this._lastTouchdownPos = this.getMouseInViewport(event.touches[0].pageX, event.touches[0].pageY); + /** + * Get mode identification, probably with options. + * @returns {string|Array} Mode identifier string ({@link Mode#id}) or two-element array containing both mode + * identifier and options ({@link Mode#opts}). + * Options are returned if they were changed during or after the mode creation. + */ + identify() { + const diff = utils.objectsDiff(this.opts, this.settings.now.modes[this.id]); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(diff)) { + return [this.id, diff]; + } + return this.id; + } + buildGeometry(complex, colorer, mask, material) { + const polyComplexity = this.opts.polyComplexity ? this.opts.polyComplexity[this.settings.now.resolution] : 0; + const groupList = this.depGroups; + const groupCount = groupList.length; + const group = new gfxutils.RCGroup(); + const self = this; + for (let i = 0; i < groupCount; ++i) { + let currGroup = groupList[i]; + let renderParams = {}; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isArray(currGroup)) { + renderParams = currGroup[1].call(this); + [currGroup] = currGroup; + } + const Group = groups_GroupsFactory[currGroup](null, this.settings, renderParams); + const newGroup = new Group(complex, colorer, self, polyComplexity, mask, material); + if (newGroup.children.length > 0) { + group.add(newGroup); + } + } + return group; } -}; +} +utils_makeContextDependent(Mode.prototype); -Picker.prototype.touchend = function (event) { - var self = this; - event.preventDefault(); - event.stopPropagation(); +/** +* Mode identifier. +* @type {string} +*/ +Mode.prototype.id = '__'; - if (event.touches.length === 0 && event.changedTouches.length === 1) { - var pos = this.getMouseInViewport(event.changedTouches[0].pageX, event.changedTouches[0].pageY); - var dist = pos.sub(this._lastTouchdownPos).length(); +/** + * Mode geo groups. + * @type {Array} + */ +Mode.prototype.depGroups = []; +/* harmony default export */ const modes_Mode = (Mode); +;// CONCATENATED MODULE: ./src/gfx/modes/LinesMode.js - if (dist < 0.01) { - setTimeout(function () { - self.pickObject(self._lastTouchdownPos); - }, 0); +function getRenderParams() { + return { + lineWidth: this.opts.lineWidth + }; +} +class LinesMode extends modes_Mode { + static id = 'LN'; + constructor(opts) { + super(opts); + this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits + const groups = this.depGroups; + for (let i = 0, n = groups.length; i < n; ++i) { + groups[i] = [groups[i], getRenderParams]; } } -}; + drawMultiorderBonds() { + return this.opts.multibond; + } + calcAtomRadius() { + return this.opts.atom; + } + getAromaticOffset() { + return this.opts.offsarom; + } + getAromaticArcChunks() { + return this.opts.chunkarom; + } + showAromaticLoops() { + return this.opts.showarom; + } +} +LinesMode.prototype.id = 'LN'; +LinesMode.prototype.name = 'Lines'; +LinesMode.prototype.shortName = 'Lines'; +LinesMode.prototype.depGroups = ['ALoopsLines', 'BondsLines', 'OrphanedAtomsCrosses']; +/* harmony default export */ const modes_LinesMode = (LinesMode); +;// CONCATENATED MODULE: ./src/gfx/modes/LicoriceMode.js +/* eslint-disable no-magic-numbers */ -Picker.prototype.dispose = function () { - for (var i = 0; i < this._listeners.length; i++) { - var l = this._listeners[i]; - l.obj.removeEventListener(l.type, l.handler); +class LicoriceMode extends modes_Mode { + static id = 'LC'; + calcAtomRadius(_atom) { + return this.opts.bond; } -}; + calcStickRadius() { + return this.opts.bond; + } + calcSpaceFraction() { + return this.opts.space; + } + getAromRadius() { + return this.opts.aromrad; + } + showAromaticLoops() { + return this.opts.showarom; + } + drawMultiorderBonds() { + return this.opts.multibond; + } +} +LicoriceMode.prototype.id = 'LC'; +LicoriceMode.prototype.name = 'Licorice'; +LicoriceMode.prototype.shortName = 'Licorice'; +LicoriceMode.prototype.depGroups = ['AtomsSpheres', 'BondsCylinders', 'ALoopsTorus']; +/* harmony default export */ const modes_LicoriceMode = (LicoriceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/BallsAndSticksMode.js +/* eslint-disable no-magic-numbers */ -var Axes = /*#__PURE__*/function () { - function Axes(target, targetCamera) { - classCallCheck(this, Axes); +class BallsAndSticksMode extends modes_Mode { + static id = 'BS'; + calcAtomRadius(atom) { + return atom.element.radius * this.opts.atom; + } + calcStickRadius() { + return this.opts.bond; + } + getAromRadius() { + return this.opts.aromrad; + } + showAromaticLoops() { + return this.opts.showarom; + } + calcSpaceFraction() { + return this.opts.space; + } + drawMultiorderBonds() { + return this.opts.multibond; + } +} +BallsAndSticksMode.prototype.id = 'BS'; +BallsAndSticksMode.prototype.name = 'Balls and Sticks'; +BallsAndSticksMode.prototype.shortName = 'Balls'; +BallsAndSticksMode.prototype.depGroups = ['AtomsSpheres', 'BondsCylinders', 'ALoopsTorus']; +/* harmony default export */ const modes_BallsAndSticksMode = (BallsAndSticksMode); +;// CONCATENATED MODULE: ./src/gfx/modes/VanDerWaalsMode.js - this._target = target; - this._targetCamera = targetCamera; - this._camera = new PerspectiveCamera(targetCamera.fov, targetCamera.aspect, 1, 100); - this._object = new AxesHelper(1); - this._scene = new Scene(); +class VanDerWaalsMode extends modes_Mode { + static id = 'VW'; + calcAtomRadius(atom) { + return atom.element.radius; + } +} +VanDerWaalsMode.prototype.id = 'VW'; +VanDerWaalsMode.prototype.name = 'Van der Waals'; +VanDerWaalsMode.prototype.shortName = 'VDW'; +VanDerWaalsMode.prototype.depGroups = ['AtomsSpheres']; +/* harmony default export */ const modes_VanDerWaalsMode = (VanDerWaalsMode); +;// CONCATENATED MODULE: ./src/gfx/modes/TraceMode.js - this._scene.add(this._object); +class TraceMode extends modes_Mode { + static id = 'TR'; + calcStickRadius() { + return this.opts.radius; + } +} +TraceMode.prototype.id = 'TR'; +TraceMode.prototype.name = 'Trace'; +TraceMode.prototype.shortName = 'Trace'; +TraceMode.prototype.depGroups = ['TraceChains']; +/* harmony default export */ const modes_TraceMode = (TraceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/TubeMode.js - this._full = new Vector2(); - this._update(); +class TubeMode extends modes_Mode { + static id = 'TU'; + getResidueRadius(_residue) { + return this.TUBE_RADIUS; } + getHeightSegmentsRatio() { + return this.opts.heightSegmentsRatio; + } + getTension() { + return this.opts.tension; + } + buildGeometry(complex, colorer, mask, material) { + const rad = this.opts.radius; + this.TUBE_RADIUS = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(rad, rad); + return modes_Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material); + } +} +TubeMode.prototype.id = 'TU'; +TubeMode.prototype.name = 'Tube'; +TubeMode.prototype.shortName = 'Tube'; +TubeMode.prototype.depGroups = ['CartoonChains']; +/* harmony default export */ const modes_TubeMode = (TubeMode); +;// CONCATENATED MODULE: ./src/gfx/modes/CartoonMode.js - createClass(Axes, [{ - key: "_update", - value: function _update() { - var fov = this._targetCamera.fov; - var camera = this._camera; - camera.aspect = this._targetCamera.aspect; - camera.setMinimalFov(fov); - camera.setDistanceToFit(1.0, fov); - camera.updateProjectionMatrix(); - this._object.quaternion.copy(this._target.quaternion); +class CartoonMode extends modes_Mode { + static id = 'CA'; + constructor(opts) { + super(opts); + // cache for secondary structure options + this.secCache = {}; + } + getResidueStartRadius(residue) { + const second = residue.getSecondary(); + if (!second || !second.generic) { + return this.TUBE_RADIUS; } - }, { - key: "render", - value: function render(renderer) { - this._update(); - - renderer.getSize(this._full); - var width = this._full.width * 0.25; - var height = this._full.height * 0.25; - var autoClear = renderer.autoClear; - renderer.autoClear = false; - renderer.setViewport(0.0, 0.0, width, height); - renderer.clear(false, true, false); - renderer.render(this._scene, this._camera); - renderer.setViewport(0, 0, this._full.width, this._full.height); - renderer.autoClear = autoClear; + const secOpts = this.secCache[second.generic]; + if (!secOpts) { + return this.TUBE_RADIUS; } - }]); - - return Axes; -}(); - -var cDataOffset = 12; -var cFirstMask = 0x0FFFFF00; -var cFirstShift = 8; -var cSecMask1 = 0x000000FF; -var cSecShift1 = 12; -var cSecMask2 = 0xFFF00000; -var cSecShift2 = 20; -var cThirdMask = 0x000FFFFF; -var cStrMask = 0xF0000000; -var cStrShift = 28; -var c219 = 1 << 19; -var c220 = 1 << 20; -var cHelixIdx = 1; -var cSheetIdx = 2; -var secTypes = ['helix', 'strand']; -var cSecNames = ['fs', 'ps', 'ns', 'us']; - -function _createSecondary(strArray, complex) { - var residues = complex._residues; - var nRes = residues.length; - var resid = new Uint8Array(nRes); - var atoms = complex._atoms; - - for (var i = 0, n = strArray.length; i < n; ++i) { - var atom = atoms[i]; - resid[atom.residue._index] = strArray[i]; + if (second.term === residue) { + return secOpts.start; + } + return secOpts.center; + } + getResidueEndRadius(residue) { + const second = residue.getSecondary(); + if (second === null || !second.generic) { + return this.TUBE_RADIUS; + } + const secOpts = this.secCache[second.generic]; + if (!secOpts) { + return this.TUBE_RADIUS; + } + if (second.term === residue) { + return this.ARROW_END; + } + return secOpts.center; + } + getResidueRadius(residue, val) { + const startRad = this.getResidueStartRadius(residue); + if (val === 0) { + return startRad; + } + const endRad = this.getResidueEndRadius(residue); + if (val === 2) { + return endRad; + } + return startRad.clone().lerp(endRad, val / 2.0); + } + calcStickRadius(_res) { + return this.opts.radius; } + getHeightSegmentsRatio() { + return this.opts.heightSegmentsRatio; + } + getTension() { + return this.opts.tension; + } + buildGeometry(complex, colorer, mask, material) { + const tubeRad = this.opts.radius; + const secHeight = this.opts.depth; + this.TUBE_RADIUS = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(tubeRad, tubeRad); + this.ARROW_END = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(secHeight, tubeRad); + const secCache = {}; + const secData = this.opts.ss; + /* eslint-disable guard-for-in */ + for (const prop in secData) { + secCache[prop] = { + center: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(secHeight, secData[prop].width), + start: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(secHeight, secData[prop].arrow) + }; + } + this.secCache = secCache; + /* eslint-enable guard-for-in */ - var secondary = []; - var rIdx = 0; + return modes_Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material); + } +} +CartoonMode.prototype.id = 'CA'; +CartoonMode.prototype.name = 'Cartoon'; +CartoonMode.prototype.shortName = 'Cartoon'; +CartoonMode.prototype.depGroups = ['CartoonChains', 'NucleicSpheres', 'NucleicCylinders']; +/* harmony default export */ const modes_CartoonMode = (CartoonMode); +;// CONCATENATED MODULE: ./src/gfx/modes/SurfaceMode.js - while (rIdx < nRes) { - if (resid[rIdx] !== 0) { - var start = rIdx; - var val = resid[rIdx]; - while (rIdx < nRes - 1 && resid[rIdx + 1] === val && residues[rIdx].isConnected(residues[rIdx + 1])) { - ++rIdx; +const { + selectors: SurfaceMode_selectors +} = chem; +function SurfaceMode_getRenderParams() { + return { + wireframe: this.opts.wireframe, + zClip: this.opts.zClip + }; +} +class SurfaceMode extends modes_Mode { + constructor(opts) { + super(opts); + this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits + const surfaces = this.surfaceNames; + const groups = this.depGroups; + for (let i = 0, n = surfaces.length; i < n; ++i) { + groups[groups.length] = [surfaces[i], SurfaceMode_getRenderParams]; + } + } + calcAtomRadius(atom) { + return atom.element.radius; + } + getVisibilitySelector() { + let visibilitySelector = null; + if (this.opts.subset !== '') { + const res = SurfaceMode_selectors.parse(this.opts.subset); + if (!res.error) { + visibilitySelector = res.selector; } - - secondary.push({ - start: start, - end: rIdx, - type: secTypes[val - 1] - }); } - - ++rIdx; + return visibilitySelector; } - - return secondary; } +SurfaceMode.prototype.isSurface = true; +SurfaceMode.prototype.surfaceNames = []; +/* harmony default export */ const modes_SurfaceMode = (SurfaceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/QuickSurfaceMode.js -function fromUInt20ToInt20(uint20) { - return uint20 >= c219 ? uint20 - c220 : uint20; +class QuickSurfaceMode extends modes_SurfaceMode { + static id = 'QS'; + getSurfaceOpts() { + return { + useBeads: false, + isoValue: this.opts.isoValue, + gaussLim: this.opts.gaussLim[this.settings.now.resolution], + radScale: this.opts.scale, + gridSpacing: this.opts.gridSpacing[this.settings.now.resolution], + zClip: this.opts.zClip, + visibilitySelector: this.getVisibilitySelector() + }; + } } +QuickSurfaceMode.prototype.id = 'QS'; +QuickSurfaceMode.prototype.name = 'Quick Surface'; +QuickSurfaceMode.prototype.shortName = 'Quick Surf'; +QuickSurfaceMode.prototype.surfaceNames = ['QuickSurfGeo']; +/* harmony default export */ const modes_QuickSurfaceMode = (QuickSurfaceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/IsoSurfaceMode.js -var FrameInfo = /*#__PURE__*/function () { - function FrameInfo(complex, payload, callbacks) { - classCallCheck(this, FrameInfo); - - this._complex = complex; - this._secondary = null; - this.isLoading = false; - this._framesRange = { - start: 0, - end: -1 +class IsoSurfaceMode extends modes_SurfaceMode { + constructor(excludeProbe, opts) { + super(opts); + this._excludeProbe = excludeProbe; + } + calcAtomRadius(atom) { + return atom.element.radius; + } + getSurfaceOpts() { + return { + gridSpacing: this.opts.polyComplexity[this.settings.now.resolution], + radScale: this._radScale, + zClip: this.opts.zClip, + visibilitySelector: this.getVisibilitySelector(), + probeRadius: this.opts.probeRadius, + excludeProbe: this._excludeProbe }; - this.frameIsReady = false; - this._buffer = null; - this._frameRequest = null; - this._callbacks = callbacks; - - if (typeof payload === 'function') { - this._framesRequestLength = 1; - this._downloadDataFn = payload; - } else { - this.parseBinaryData(payload, true); - } - - this.reset(); - this.setFrame(0); } +} +IsoSurfaceMode.prototype.id = 'SU'; +IsoSurfaceMode.prototype.name = 'Surface'; +IsoSurfaceMode.prototype.shortName = 'Surface'; +IsoSurfaceMode.prototype.surfaceNames = ['SASSESSurfaceGeo']; +IsoSurfaceMode.prototype._radScale = 1; +IsoSurfaceMode.prototype._excludeProbe = false; +/* harmony default export */ const modes_IsoSurfaceMode = (IsoSurfaceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/IsoSurfaceSASMode.js - createClass(FrameInfo, [{ - key: "_prepareBuffer", - value: function _prepareBuffer(framesStart, framesEnd) { - if (framesStart === undefined || framesStart === null) { - framesStart = 0; - } - - if (framesEnd === undefined || framesEnd === null) { - framesEnd = framesStart + this._framesRequestLength; - } - - if (this._framesCount !== undefined) { - framesEnd = Math.min(this._framesCount - 1, framesEnd); - } - - if (this._downloadDataFn) { - var self = this; - - var onDone = function onDone(data) { - self.isLoading = false; +class IsoSurfaceSASMode extends modes_IsoSurfaceMode { + static id = 'SA'; + constructor(opts) { + super(false, opts); + } +} +IsoSurfaceSASMode.prototype.id = 'SA'; +IsoSurfaceSASMode.prototype.name = 'Solvent Accessible Surface'; +IsoSurfaceSASMode.prototype.shortName = 'SAS'; +/* harmony default export */ const modes_IsoSurfaceSASMode = (IsoSurfaceSASMode); +;// CONCATENATED MODULE: ./src/gfx/modes/IsoSurfaceSESMode.js - if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') { - self._callbacks.onLoadStatusChanged(); - } +class IsoSurfaceSESMode extends modes_IsoSurfaceMode { + static id = 'SE'; + constructor(opts) { + super(true, opts); + } +} +IsoSurfaceSESMode.prototype.id = 'SE'; +IsoSurfaceSESMode.prototype.name = 'Solvent Excluded Surface'; +IsoSurfaceSESMode.prototype.shortName = 'SES'; +/* harmony default export */ const modes_IsoSurfaceSESMode = (IsoSurfaceSESMode); +;// CONCATENATED MODULE: ./src/gfx/modes/ContactSurfaceMode.js - self._buffer = { - data: data, - state: 'ready', - start: framesStart, - end: framesEnd - }; +class ContactSurfaceMode extends modes_SurfaceMode { + static id = 'CS'; + getSurfaceOpts() { + return { + probeRadius: this.opts.probeRadius, + radScale: this.opts.polyComplexity[this.settings.now.resolution], + scaleFactor: this.opts.polyComplexity[this.settings.now.resolution], + gridSpacing: 1.0 / this.opts.polyComplexity[this.settings.now.resolution], + isoValue: this.opts.isoValue, + probePositions: this.opts.probePositions, + zClip: this.opts.zClip, + visibilitySelector: this.getVisibilitySelector() + }; + } +} +ContactSurfaceMode.prototype.id = 'CS'; +ContactSurfaceMode.prototype.name = 'Contact Surface'; +ContactSurfaceMode.prototype.shortName = 'Contact Surf'; +ContactSurfaceMode.prototype.isSurface = true; +ContactSurfaceMode.prototype.surfaceNames = ['ContactSurfaceGeo']; +/* harmony default export */ const modes_ContactSurfaceMode = (ContactSurfaceMode); +;// CONCATENATED MODULE: ./src/gfx/modes/TextMode.js - if (self._frameRequest !== null) { - var idx = self._frameRequest; - self._frameRequest = null; - self.setFrame(idx); - } - }; - var onFail = function onFail() { - self.isLoading = false; +class TextMode extends modes_Mode { + static id = 'TX'; + getTemplateOptions() { + return this.opts.template; + } + getLabelOpts() { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge(this.opts, { + colors: true, + adjustColor: true, + transparent: true + }); + } +} +TextMode.prototype.id = 'TX'; +TextMode.prototype.name = 'Text mode'; +TextMode.prototype.shortName = 'Text'; +TextMode.prototype.depGroups = ['TextLabelsGeo']; +/* harmony default export */ const modes_TextMode = (TextMode); +;// CONCATENATED MODULE: ./src/gfx/modes.js - if (self._callbacks && typeof self._callbacks.onError === 'function') { - self._callbacks.onError('Streaming failed'); - } - }; - if (!this._buffer) { - this._buffer = {}; - } - this._buffer.state = 'downloading'; - this.isLoading = true; - if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') { - self._callbacks.onLoadStatusChanged(); - } - this._downloadDataFn({ - start: framesStart, - end: framesEnd + 1 - }, onDone, onFail); - } - } - }, { - key: "_parseBuffer", - value: function _parseBuffer() { - if (this._buffer && this._buffer.state === 'ready') { - this._framesRange = { - start: this._buffer.start, - end: this._buffer.end - }; - this.parseBinaryData(this._buffer.data, false); - var _bufferRequestStart = (this._buffer.end + 1) % this._framesCount; - if (_bufferRequestStart >= this._framesCount) { - _bufferRequestStart = 0; - } - this._buffer = { - state: 'none' - }; - this._prepareBuffer(_bufferRequestStart, _bufferRequestStart + this._framesRequestLength); - if (this._frameRequest !== null) { - var idx = this._frameRequest; - this._frameRequest = null; - this.setFrame(idx); - } - } - } - }, { - key: "parseBinaryData", - value: function parseBinaryData(arrayBuffer) { - var dataView = new DataView(arrayBuffer); - var offset = 0; - var atomsCount = dataView.getUint32(offset, true); - offset += 4; - var framesCount = dataView.getUint32(offset, true); - this._framesCount = framesCount; - this._framesRange.end = this._framesRange.end > 0 ? Math.min(this._framesRange.end, framesCount - 1) : framesCount - 1; - offset += 4; - this._atomsCount = atomsCount; - var maxSize = 1024 * 1024; // 1 MB - - this._framesRequestLength = Math.ceil(maxSize / (atomsCount * 8)); - var chunkedFramesCount = this._framesRange.end - this._framesRange.start + 1; - - if (atomsCount !== this._complex._atoms.length || arrayBuffer.byteLength !== cDataOffset + chunkedFramesCount * atomsCount * 8) { - throw new Error(); - } - - var complex = this._complex; - var timeStep = dataView.getUint32(offset, true); - var iName = 0; - - while (timeStep > 1000 && iName < cSecNames.length - 1) { - timeStep /= 1000; - ++iName; - } - - this._timeStep = "".concat(timeStep.toString(), " ").concat(cSecNames[iName]); - offset += 4; - var secondary = []; - var posData = new Float32Array(chunkedFramesCount * atomsCount * 3); - var coordIdx = 0; - var secondaryArr = new Int8Array(atomsCount); - - for (var j = 0; j < chunkedFramesCount; ++j) { - for (var i = 0; i < atomsCount; ++i) { - var hiWord = dataView.getUint32(offset, true); - offset += 4; - var loWord = dataView.getUint32(offset, true); - offset += 4; - var str = (loWord & cStrMask) >>> cStrShift; - var x = fromUInt20ToInt20((loWord & cFirstMask) >>> cFirstShift >> 0); - var y = fromUInt20ToInt20(((loWord & cSecMask1) << cSecShift1 | (hiWord & cSecMask2) >>> cSecShift2) >> 0); - var z = fromUInt20ToInt20((hiWord & cThirdMask) >> 0); - secondaryArr[i] = 0; - - if (str > 0 && str < 4) { - secondaryArr[i] = cHelixIdx; - } else if (str === 4) { - secondaryArr[i] = cSheetIdx; - } - posData[coordIdx++] = x / 100; - posData[coordIdx++] = y / 100; - posData[coordIdx++] = z / 100; - } - secondary.push(_createSecondary(secondaryArr, complex)); - } - this._secondaryData = secondary; - this._data = posData; - } - }, { - key: "nextFrame", - value: function nextFrame() { - this.setFrame((this._currFrame + 1) % this._framesCount); - } - }, { - key: "needsColorUpdate", - value: function needsColorUpdate(colorer) { - return colorer instanceof SecondaryStructureColorer; - } - }, { - key: "getAtomColor", - value: function getAtomColor(colorer, atom) { - return colorer.getResidueColor(this._residues[atom.residue._index], this._complex); - } - }, { - key: "getResidueColor", - value: function getResidueColor(colorer, residue) { - return colorer.getResidueColor(this._residues[residue._index], this._complex); - } - }, { - key: "_updateSecondary", - value: function _updateSecondary() { - var i; - var myResidues = this._residues; - var n = myResidues.length; +const modes = new utils_EntityList([modes_LinesMode, modes_LicoriceMode, modes_BallsAndSticksMode, modes_VanDerWaalsMode, modes_TraceMode, modes_TubeMode, modes_CartoonMode, modes_QuickSurfaceMode, modes_IsoSurfaceSASMode, modes_IsoSurfaceSESMode, modes_ContactSurfaceMode, modes_TextMode]); +/* harmony default export */ const gfx_modes = (modes); +;// CONCATENATED MODULE: ./src/gfx/palettes/Palette.js - for (i = 0; i < n; ++i) { - myResidues[i]._secondary = null; - } +function clamp(x, a, b) { + return x <= b ? x < 0 ? 0 : x : b; +} +function lerpColor(c1, c2, alpha) { + const beta = 1 - alpha; + const r1 = c1 >> 16 & 0xff; + const g1 = c1 >> 8 & 0xff; + const b1 = c1 & 0xff; + const r2 = c2 >> 16 & 0xff; + const g2 = c2 >> 8 & 0xff; + const b2 = c2 & 0xff; + const r = beta * r1 + alpha * r2; + const g = beta * g1 + alpha * g2; + const b = beta * b1 + alpha * b2; + return r << 16 | g << 8 | b; +} +class Palette { + constructor(name, id) { + this.name = name || 'Custom'; + this.id = id || 'CP'; + } + getElementColor(name) { + let asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + const color = this.elementColors[name]; + return color === undefined && !asIs ? this.defaultElementColor : color; + } + getResidueColor(name) { + let asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + const color = this.residueColors[name]; + return color === undefined && !asIs ? this.defaultResidueColor : color; + } + getChainColor(name) { + let chain = name.charCodeAt(0); + chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F) % this.chainColors.length; + return this.chainColors[chain]; + } + getSecondaryColor(type) { + let asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + const color = this.secondaryColors[type]; + return color === undefined && !asIs ? this.defaultSecondaryColor : color; + } + getSequentialColor(index) { + const { + colors + } = this; + const len = colors.length; + return index < 0 ? colors[index % len + len] : colors[index % len]; + } + getGradientColor(value, gradientName) { + const gradient = this.gradients[gradientName]; + if (!gradient) { + return this.defaultNamedColor; + } + const count = gradient.length; + const index = value * (count - 1); + let left = Math.floor(index); + const right = clamp(left + 1, 0, count - 1); + left = clamp(left, 0, count - 1); + return lerpColor(gradient[left], gradient[right], index - left); + } + getNamedColor(name) { + let asIs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + const color = this.namedColors[name]; + return color === undefined && !asIs ? this.defaultNamedColor : color; + } +} +external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].assign(Palette.prototype, { + colors: [0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0x808080], + minRangeColor: 0x000000, + midRangeColor: 0x7F7F7F, + maxRangeColor: 0xFFFFFF, + defaultElementColor: 0xFFFFFF, + elementColors: {}, + defaultResidueColor: 0xFFFFFF, + residueColors: {}, + chainColors: [0xFFFFFF], + defaultSecondaryColor: 0xFFFFFF, + secondaryColors: {}, + defaultGradientColor: 0x000000, + defaultNamedColor: 0xFFFFFF, + namedColorsArray: [/* eslint-disable no-multi-spaces */ + ['indianred', 0xcd5c5c], ['lightcoral', 0xf08080], ['salmon', 0xfa8072], ['darksalmon', 0xe9967a], ['lightsalmon', 0xffa07a], ['crimson', 0xdc143c], ['red', 0xff0000], ['firebrick', 0xb22222], ['darkred', 0x8b0000], ['pink', 0xffc0cb], ['lightpink', 0xffb6c1], ['hotpink', 0xff69b4], ['deeppink', 0xff1493], ['mediumvioletred', 0xc71585], ['palevioletred', 0xdb7093], ['coral', 0xff7f50], ['tomato', 0xff6347], ['orangered', 0xff4500], ['darkorange', 0xff8c00], ['orange', 0xffa500], ['gold', 0xffd700], ['yellow', 0xffff00], ['lightyellow', 0xffffe0], ['lemonchiffon', 0xfffacd], ['lightgoldenrodyellow', 0xfafad2], ['papayawhip', 0xffefd5], ['moccasin', 0xffe4b5], ['peachpuff', 0xffdab9], ['palegoldenrod', 0xeee8aa], ['khaki', 0xf0e68c], ['darkkhaki', 0xbdb76b], ['lavender', 0xe6e6fa], ['thistle', 0xd8bfd8], ['plum', 0xdda0dd], ['violet', 0xee82ee], ['orchid', 0xda70d6], ['fuchsia', 0xff00ff], ['magenta', 0xff00ff], ['mediumorchid', 0xba55d3], ['mediumpurple', 0x9370db], ['rebeccapurple', 0x663399], ['blueviolet', 0x8a2be2], ['darkviolet', 0x9400d3], ['darkorchid', 0x9932cc], ['darkmagenta', 0x8b008b], ['purple', 0x800080], ['indigo', 0x4b0082], ['slateblue', 0x6a5acd], ['mediumslateblue', 0x7b68ee], ['darkslateblue', 0x483d8b], ['greenyellow', 0xadff2f], ['chartreuse', 0x7fff00], ['lawngreen', 0x7cfc00], ['lime', 0x00ff00], ['limegreen', 0x32cd32], ['palegreen', 0x98fb98], ['lightgreen', 0x90ee90], ['mediumspringgreen', 0x00fa9a], ['springgreen', 0x00ff7f], ['mediumseagreen', 0x3cb371], ['seagreen', 0x2e8b57], ['forestgreen', 0x228b22], ['green', 0x008000], ['darkgreen', 0x006400], ['yellowgreen', 0x9acd32], ['olivedrab', 0x6b8e23], ['olive', 0x808000], ['darkolivegreen', 0x556b2f], ['mediumaquamarine', 0x66cdaa], ['darkseagreen', 0x8fbc8f], ['lightseagreen', 0x20b2aa], ['darkcyan', 0x008b8b], ['teal', 0x008080], ['aqua', 0x00ffff], ['cyan', 0x00ffff], ['lightcyan', 0xe0ffff], ['paleturquoise', 0xafeeee], ['aquamarine', 0x7fffd4], ['turquoise', 0x40e0d0], ['mediumturquoise', 0x48d1cc], ['darkturquoise', 0x00ced1], ['cadetblue', 0x5f9ea0], ['steelblue', 0x4682b4], ['lightsteelblue', 0xb0c4de], ['powderblue', 0xb0e0e6], ['lightblue', 0xadd8e6], ['skyblue', 0x87ceeb], ['lightskyblue', 0x87cefa], ['deepskyblue', 0x00bfff], ['dodgerblue', 0x1e90ff], ['cornflowerblue', 0x6495ed], ['royalblue', 0x4169e1], ['blue', 0x0000ff], ['mediumblue', 0x0000cd], ['darkblue', 0x00008b], ['navy', 0x000080], ['midnightblue', 0x191970], ['cornsilk', 0xfff8dc], ['blanchedalmond', 0xffebcd], ['bisque', 0xffe4c4], ['navajowhite', 0xffdead], ['wheat', 0xf5deb3], ['burlywood', 0xdeb887], ['tan', 0xd2b48c], ['rosybrown', 0xbc8f8f], ['sandybrown', 0xf4a460], ['goldenrod', 0xdaa520], ['darkgoldenrod', 0xb8860b], ['peru', 0xcd853f], ['chocolate', 0xd2691e], ['saddlebrown', 0x8b4513], ['sienna', 0xa0522d], ['brown', 0xa52a2a], ['maroon', 0x800000], ['white', 0xffffff], ['snow', 0xfffafa], ['honeydew', 0xf0fff0], ['mintcream', 0xf5fffa], ['azure', 0xf0ffff], ['aliceblue', 0xf0f8ff], ['ghostwhite', 0xf8f8ff], ['whitesmoke', 0xf5f5f5], ['seashell', 0xfff5ee], ['beige', 0xf5f5dc], ['oldlace', 0xfdf5e6], ['floralwhite', 0xfffaf0], ['ivory', 0xfffff0], ['antiquewhite', 0xfaebd7], ['linen', 0xfaf0e6], ['lavenderblush', 0xfff0f5], ['mistyrose', 0xffe4e1], ['gainsboro', 0xdcdcdc], ['lightgray', 0xd3d3d3], ['silver', 0xc0c0c0], ['darkgray', 0xa9a9a9], ['gray', 0x808080], ['dimgray', 0x696969], ['lightslategray', 0x778899], ['slategray', 0x708090], ['darkslategray', 0x2f4f4f], ['black', 0x000000] + /* eslint-enable no-multi-spaces */], + namedColors: {}, + /* eslint-enable no-magic-numbers */ - var sec = this._secondaryData[this._currFrame - this._framesRange.start]; + gradients: { + rainbow: [0x0000ff, + // blue + 0x00ffff, + // cyan + 0x00ff00, + // green + 0xffff00, + // yellow + 0xff0000 // red + ], + temp: [0x0000ff, + // blue + 0x007fff, + // light-blue + 0xffffff, + // white + 0xff7f00, + // orange + 0xff0000 // red + ], + hot: [0xffffff, + // white + 0xff7f00, + // orange + 0xff0000 // red + ], + cold: [0xffffff, + // white + 0x007fff, + // light-blue + 0x0000ff // blue + ], + 'blue-red': [0x0000ff, + // blue + 0xffffff, + // white + 0xff0000 // red + ], + reds: [0xffffff, + // white + 0xff0000 // red + ], + blues: [0xffffff, + // white + 0x0000ff // blue + ] + } +}); +const { + namedColorsArray, + namedColors +} = Palette.prototype; +for (let i = 0, { + length + } = namedColorsArray; i < length; ++i) { + const [name, value] = namedColorsArray[i]; + namedColors[name] = value; +} +/* harmony default export */ const palettes_Palette = (Palette); +;// CONCATENATED MODULE: ./src/gfx/palettes/cpkPalette.js - for (i = 0, n = sec.length; i < n; ++i) { - var oldSec = sec[i]; - var start = oldSec.start, - end = oldSec.end; - var nSec = { - _start: myResidues[start], - _end: myResidues[end], - type: oldSec.type, - generic: oldSec.generic - }; +const palette = new palettes_Palette('CPK', 'CP'); - for (var j = start; j <= end; ++j) { - myResidues[j]._secondary = nSec; - } - } - } - }, { - key: "reset", - value: function reset() { - var compRes = this._complex._residues; - var n = compRes.length; - this._residues = new Array(n); - var myResidues = this._residues; - - var getSec = function getSec() { - return this._secondary; - }; +// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. +palette.elementColors = { + /* eslint-disable no-magic-numbers */ + H: 0xFFFFFF, + C: 0x202020, + N: 0x2060FF, + O: 0xEE2010, + F: 0x00FF00, + P: 0x8020FF, + S: 0xFFFF00, + CL: 0x00BB00, + FE: 0xD0D0D0, + CO: 0xD0D0D0, + NI: 0xD0D0D0, + CU: 0xD0D0D0, + BR: 0x008800, + I: 0x005500 + /* eslint-enable no-magic-numbers */ +}; +/* harmony default export */ const cpkPalette = (palette); +;// CONCATENATED MODULE: ./src/gfx/palettes/jmolPalette.js - for (var i = 0; i < n; ++i) { - myResidues[i] = { - _type: compRes[i]._type, - _isValid: compRes[i]._isValid, - _controlPoint: null, - _wingVector: null, - _secondary: null, - getSecondary: getSec - }; - } - } - }, { - key: "setFrame", - value: function setFrame(frameIdx) { - this.frameIsReady = false; - if (frameIdx >= this._framesRange.start && frameIdx <= this._framesRange.end) { - this._currFrame = frameIdx; - this._cachedResidues = false; +const jmolPalette_palette = new palettes_Palette('Jmol', 'JM'); +jmolPalette_palette.colors = [/* eslint-disable no-magic-numbers */ +0x0000FF, +// blue +0x0055FF, +// +0x00ABFF, +// +0x00FFFF, +// cyan +0x00FFAB, +// +0x00FF55, +// +0x00FF00, +// green +0x55FF00, +// +0xABFF00, +// +0xFFFF00, +// yellow +0xFFAB00, +// +0xFF5500, +// +0xFF0000, +// red +0xFF0055, +// +0xFF00AB, +// +0xFF00FF, +// magenta +0xAB00FF, +// +0x5500FF // +/* eslint-enable no-magic-numbers */]; - this._updateSecondary(); +// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. +jmolPalette_palette.elementColors = { + /* eslint-disable no-magic-numbers */ + H: 0xFFFFFF, + D: 0xFFFFC0, + T: 0xFFFFA0, + HE: 0xD9FFFF, + LI: 0xCC80FF, + BE: 0xC2FF00, + B: 0xFFB5B5, + C: 0x909090, + N: 0x3050F8, + O: 0xFF0D0D, + F: 0x90E050, + NE: 0xB3E3F5, + NA: 0xAB5CF2, + MG: 0x8AFF00, + AL: 0xBFA6A6, + SI: 0xF0C8A0, + P: 0xFF8000, + S: 0xFFFF30, + CL: 0x1FF01F, + AR: 0x80D1E3, + K: 0x8F40D4, + CA: 0x3DFF00, + SC: 0xE6E6E6, + TI: 0xBFC2C7, + V: 0xA6A6AB, + CR: 0x8A99C7, + MN: 0x9C7AC7, + FE: 0xE06633, + CO: 0xF090A0, + NI: 0x50D050, + CU: 0xC88033, + ZN: 0x7D80B0, + GA: 0xC28F8F, + GE: 0x668F8F, + AS: 0xBD80E3, + SE: 0xFFA100, + BR: 0xA62929, + KR: 0x5CB8D1, + RB: 0x702EB0, + SR: 0x00FF00, + Y: 0x94FFFF, + ZR: 0x94E0E0, + NB: 0x73C2C9, + MO: 0x54B5B5, + TC: 0x3B9E9E, + RU: 0x248F8F, + RH: 0x0A7D8C, + PD: 0x006985, + AG: 0xC0C0C0, + CD: 0xFFD98F, + IN: 0xA67573, + SN: 0x668080, + SB: 0x9E63B5, + TE: 0xD47A00, + I: 0x940094, + XE: 0x429EB0, + CS: 0x57178F, + BA: 0x00C900, + LA: 0x70D4FF, + CE: 0xFFFFC7, + PR: 0xD9FFC7, + ND: 0xC7FFC7, + PM: 0xA3FFC7, + SM: 0x8FFFC7, + EU: 0x61FFC7, + GD: 0x45FFC7, + TB: 0x30FFC7, + DY: 0x1FFFC7, + HO: 0x00FF9C, + ER: 0x00E675, + TM: 0x00D452, + YB: 0x00BF38, + LU: 0x00AB24, + HF: 0x4DC2FF, + TA: 0x4DA6FF, + W: 0x2194D6, + RE: 0x267DAB, + OS: 0x266696, + IR: 0x175487, + PT: 0xD0D0E0, + AU: 0xFFD123, + HG: 0xB8B8D0, + TL: 0xA6544D, + PB: 0x575961, + BI: 0x9E4FB5, + PO: 0xAB5C00, + AT: 0x754F45, + RN: 0x428296, + FR: 0x420066, + RA: 0x007D00, + AC: 0x70ABFA, + TH: 0x00BAFF, + PA: 0x00A1FF, + U: 0x008FFF, + NP: 0x0080FF, + PU: 0x006BFF, + AM: 0x545CF2, + CM: 0x785CE3, + BK: 0x8A4FE3, + CF: 0xA136D4, + ES: 0xB31FD4, + FM: 0xB31FBA, + MD: 0xB30DA6, + NO: 0xBD0D87, + LR: 0xC70066, + RF: 0xCC0059, + DB: 0xD1004F, + SG: 0xD90045, + BH: 0xE00038, + HS: 0xE6002E, + MT: 0xEB0026 + /* eslint-enable no-magic-numbers */ +}; +jmolPalette_palette.defaultResidueColor = 0xBEA06E; - this.frameIsReady = true; - } else { - this._frameRequest = frameIdx; +// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. +jmolPalette_palette.residueColors = { + /* eslint-disable no-magic-numbers */ + ALA: 0xC8C8C8, + ARG: 0x145AFF, + ASN: 0x00DCDC, + ASP: 0xE60A0A, + CYS: 0xE6E600, + GLN: 0x00DCDC, + GLU: 0xE60A0A, + GLY: 0xEBEBEB, + HIS: 0x8282D2, + ILE: 0x0F820F, + LEU: 0x0F820F, + LYS: 0x145AFF, + MET: 0xE6E600, + PHE: 0x3232AA, + PRO: 0xDC9682, + SER: 0xFA9600, + THR: 0xFA9600, + TRP: 0xB45AB4, + TYR: 0x3232AA, + VAL: 0x0F820F, + A: 0xA0A0FF, + C: 0xFF8C4B, + G: 0xFF7070, + I: 0x80FFFF, + T: 0xA0FFA0, + U: 0xFF8080, + DA: 0xA0A0FF, + DC: 0xFF8C4B, + DG: 0xFF7070, + DI: 0x80FFFF, + DT: 0xA0FFA0, + DU: 0xFF8080, + '+A': 0xA0A0FF, + '+C': 0xFF8C4B, + '+G': 0xFF7070, + '+I': 0x80FFFF, + '+T': 0xA0FFA0, + '+U': 0xFF8080 + /* eslint-enable no-magic-numbers */ +}; +jmolPalette_palette.chainColors = [ +// ' '->0 'A'->1, 'B'->2 +0xFFffffff, +// ' ' & '0' white +// +0xFFC0D0FF, +// skyblue +0xFFB0FFB0, +// pastel green +0xFFFFC0C8, +// pink +0xFFFFFF80, +// pastel yellow +0xFFFFC0FF, +// pastel magenta +0xFFB0F0F0, +// pastel cyan +0xFFFFD070, +// pastel gold +0xFFF08080, +// lightcoral + +0xFFF5DEB3, +// wheat +0xFF00BFFF, +// deepskyblue +0xFFCD5C5C, +// indianred +0xFF66CDAA, +// mediumaquamarine +0xFF9ACD32, +// yellowgreen +0xFFEE82EE, +// violet +0xFF00CED1, +// darkturquoise +0xFF00FF7F, +// springgreen +0xFF3CB371, +// mediumseagreen + +0xFF00008B, +// darkblue +0xFFBDB76B, +// darkkhaki +0xFF006400, +// darkgreen +0xFF800000, +// maroon +0xFF808000, +// olive +0xFF800080, +// purple +0xFF008080, +// teal +0xFFB8860B, +// darkgoldenrod +0xFFB22222 // firebrick +]; +const jmolPalette_StructuralElementType = chem_StructuralElement.Type; +jmolPalette_palette.secondaryColors = { + [jmolPalette_StructuralElementType.HELIX_ALPHA]: 0xFF0080, + [jmolPalette_StructuralElementType.HELIX_PI]: 0x600080, + [jmolPalette_StructuralElementType.HELIX_310]: 0xA00080, + [jmolPalette_StructuralElementType.STRAND]: 0xFFC800, + [jmolPalette_StructuralElementType.TURN]: 0x6080FF, + dna: 0xAE00FE, + rna: 0xFD0162 +}; +/* harmony default export */ const jmolPalette = (jmolPalette_palette); +;// CONCATENATED MODULE: ./src/gfx/palettes/vmdPalette.js + + +const vmdPalette_palette = new palettes_Palette('VMD', 'VM'); +vmdPalette_palette.colors = [/* eslint-disable no-magic-numbers */ +0x0000FF, +// blue +0xFF0000, +// red +0x606060, +// gray +0xFF8000, +// orange +0xFFFF00, +// yellow +0x808033, +// tan +0x999999, +// silver +0x00FF00, +// green +0xFFFFFF, +// white +0xFF9999, +// pink +0x40C0C0, +// cyan +0xA600A6, +// purple +0x80E666, +// lime +0xE666B3, +// mauve +0x804D00, +// ochre +0x8080C0 // ice blue +/* eslint-enable no-magic-numbers */]; +vmdPalette_palette.defaultElementColor = 0x804D00; - if (!this._buffer) { - this._prepareBuffer(frameIdx); - } else { - var self = this; +// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py. +vmdPalette_palette.elementColors = { + /* eslint-disable no-magic-numbers */ + H: 0xFFFFFF, + C: 0x40BFBF, + N: 0x0000FF, + O: 0xFF0000, + P: 0x808033, + S: 0xFFFF00 + /* eslint-enable no-magic-numbers */ +}; +vmdPalette_palette.defaultResidueColor = 0x40C0C0; - switch (this._buffer.state) { - case 'none': - this._prepareBuffer(frameIdx); +// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py. +vmdPalette_palette.residueColors = { + /* eslint-disable no-magic-numbers */ + ALA: 0x0000FF, + ARG: 0xFFFFFF, + ASN: 0x808033, + ASP: 0xFF0000, + CYS: 0xFFFF00, + GLN: 0xFF8000, + GLU: 0xFF9999, + GLY: 0xFFFFFF, + HIS: 0x40C0C0, + ILE: 0x00FF00, + LEU: 0xFF9999, + LYS: 0x40C0C0, + MET: 0xFFFF00, + PHE: 0xA600A6, + PRO: 0x804C00, + SER: 0xFFFF00, + THR: 0xE666B3, + TRP: 0x999999, + TYR: 0x00FF00, + VAL: 0x808033, + A: 0x0000FF, + C: 0xFF8000, + G: 0xFFFF00, + T: 0xA600A6, + U: 0x00FF00, + DA: 0x0000FF, + DC: 0xFF8000, + DG: 0xFFFF00, + DT: 0xA600A6, + DU: 0x00FF00, + '+A': 0x0000FF, + '+C': 0xFF8000, + '+G': 0xFFFF00, + '+T': 0xA600A6, + '+U': 0x00FF00, + WAT: 0x40C0C0, + H2O: 0x40C0C0, + HOH: 0x40C0C0 + /* eslint-enable no-magic-numbers */ +}; +vmdPalette_palette.chainColors = [0xFFFFFF].concat(vmdPalette_palette.colors); +const vmdPalette_StructuralElementType = chem_StructuralElement.Type; +vmdPalette_palette.secondaryColors = { + [vmdPalette_StructuralElementType.HELIX_ALPHA]: 0xA600A6, + [vmdPalette_StructuralElementType.HELIX_310]: 0x0000FF, + [vmdPalette_StructuralElementType.HELIX_PI]: 0xFF0000, + [vmdPalette_StructuralElementType.STRAND]: 0xFFFF00, + [vmdPalette_StructuralElementType.BRIDGE]: 0x808033, + [vmdPalette_StructuralElementType.TURN]: 0x40C0C0 +}; +/* harmony default export */ const vmdPalette = (vmdPalette_palette); +;// CONCATENATED MODULE: ./src/gfx/palettes.js - break; - case 'ready': - self._parseBuffer(); - break; - } - } - } - } - }, { - key: "disableEvents", - value: function disableEvents() { - this._callbacks = null; - } - /** - * Returns link to atom pos vector, clone it if needed - */ - }, { - key: "getAtomPos", - value: function getAtomPos(atomIdx) { - var vec = FrameInfo._vec; - var self = this; - var data = self._data; - var idx = (self._atomsCount * (self._currFrame - self._framesRange.start) + atomIdx) * 3; - vec.set(data[idx], data[idx + 1], data[idx + 2]); - return vec; - } - }, { - key: "getResidues", - value: function getResidues() { - if (this._cachedResidues) { - return this._residues; - } +const palettes = new utils_EntityList([cpkPalette, jmolPalette, vmdPalette]); +/* harmony default export */ const gfx_palettes = (palettes); +;// CONCATENATED MODULE: ./src/gfx/colorers/Colorer.js - this._complex.updateToFrame(this); - return this._residues; - } - }]); - return FrameInfo; -}(); -defineProperty(FrameInfo, "_vec", new Vector3()); /** - * Create new scene object. + * Create new colorer. * - * @param {array=} params - Object required params. * @param {object=} opts - Options to override defaults with. * * These options are copied locally and not kept by reference, so the created instance will not reflect further * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation. * - * @exports SceneObject - * @this SceneObject + * @exports Colorer + * @this Colorer * @abstract * @constructor - * @classdesc Basic class for all scene objects that are not reps. + * @classdesc Basic class for all available coloring algorithms used for building and displaying molecule geometry. */ - -var SceneObject = /*#__PURE__*/function () { - function SceneObject(params, opts) { - classCallCheck(this, SceneObject); - - if (this.constructor === SceneObject) { +class Colorer { + constructor(opts) { + if (this.constructor === Colorer) { throw new Error('Can not instantiate abstract class!'); } /** - * Object's options inherited (prototyped) from defaults. + * Colorer options inherited (prototyped) from defaults. * @type {object} */ - - - this.params = params; - this.opts = _.merge(utils.deriveDeep(settings.now.objects[this.type], true), opts); - this.needsRebuild = false; - this._mesh = null; - this.id = null; + this.opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge(utils.deriveDeep(settings.now.colorers[this.id], true), opts); + /** + * Palette in use. + * @type {Palette} + */ + this.palette = gfx_palettes.first; } + /** - * Get object identification, probably with options. - * @returns {Object} field type contains type information, params - object's formal parameters, - * opts - changed options - * Options are returned if they were changed during or after object creation. + * Get Colorer identification, probably with options. + * @returns {string|Array} Colorer identifier string ({@link Colorer#id}) or two-element array containing both colorer + * identifier and options ({@link Colorer#opts}). + * Options are returned if they were changed during or after colorer creation. */ + identify() { + const diff = utils.objectsDiff(this.opts, settings.now.colorers[this.id]); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(diff)) { + return [this.id, diff]; + } + return this.id; + } +} +/** + * Colorer identifier. + * @type {string} + */ - createClass(SceneObject, [{ - key: "identify", - value: function identify() { - var result = { - type: this.type, - params: this.params - }; - var diff = utils.objectsDiff(this.opts, settings.now.modes[this.id]); +Colorer.prototype.id = '__'; +/* harmony default export */ const colorers_Colorer = (Colorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ElementColorer.js - if (!_.isEmpty(diff)) { - result.opts = diff; - } - return result; +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @see Element + * + * @exports ElementColorer + * @augments Colorer + * @constructor + * @classdesc Coloring algorithm based on chemical element. + */ +class ElementColorer extends colorers_Colorer { + static id = 'EL'; + getAtomColor(atom, _complex) { + const type = atom.element.name; + if (type === 'C' && this.opts.carbon >= 0) { + return this.opts.carbon; } - }, { - key: "toString", - value: function toString() { - var paramsStr = "o=".concat(this.type, ",").concat(this.params.join(',')); - var optsStr = utils.compareOptionsWithDefaults(this.opts, settings.defaults.objects[this.type]); - return paramsStr + optsStr; + return this.palette.getElementColor(type); + } + getResidueColor(_residue, _complex) { + return this.palette.defaultResidueColor; + } +} +ElementColorer.prototype.id = 'EL'; +ElementColorer.prototype.name = 'Element'; +ElementColorer.prototype.shortName = 'Element'; +/* harmony default export */ const colorers_ElementColorer = (ElementColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ResidueTypeColorer.js + + +/** + * Coloring algorithm based on residue type. + * + * @see ResidueType + * + * @exports ResidueTypeColorer + * @constructor + */ +class ResidueTypeColorer extends colorers_Colorer { + static id = 'RT'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + return this.palette.getResidueColor(residue._type._name); + } +} +ResidueTypeColorer.prototype.id = 'RT'; +ResidueTypeColorer.prototype.name = 'Residue Type'; +ResidueTypeColorer.prototype.shortName = 'Residue'; +/* harmony default export */ const colorers_ResidueTypeColorer = (ResidueTypeColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/SequenceColorer.js + +class SequenceColorer extends colorers_Colorer { + static id = 'SQ'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + const chain = residue._chain; + if (chain.minSequence === Number.POSITIVE_INFINITY && chain.maxSequence === Number.NEGATIVE_INFINITY) { + return this.palette.defaultNamedColor; } - }, { - key: "getGeometry", - value: function getGeometry() { - return this._mesh; + const min = chain.minSequence; + const max = chain.maxSequence > min ? chain.maxSequence : min + 1; + return this.palette.getGradientColor((residue._sequence - min) / (max - min), this.opts.gradient); + } +} +SequenceColorer.prototype.id = 'SQ'; +SequenceColorer.prototype.name = 'Sequence'; +SequenceColorer.prototype.shortName = 'Sequence'; +/* harmony default export */ const colorers_SequenceColorer = (SequenceColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ChainColorer.js + +class ChainColorer extends colorers_Colorer { + static id = 'CH'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + return this.palette.getChainColor(residue.getChain()._name); + } +} +ChainColorer.prototype.id = 'CH'; +ChainColorer.prototype.name = 'Chain'; +ChainColorer.prototype.shortName = 'Chain'; +/* harmony default export */ const colorers_ChainColorer = (ChainColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/SecondaryStructureColorer.js + + +class SecondaryStructureColorer extends colorers_Colorer { + static id = 'SS'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + if (residue._type.flags & chem_ResidueType.Flags.DNA) { + return this.palette.getSecondaryColor('dna'); } - }, { - key: "destroy", - value: function destroy() { - if (this._mesh) { - gfxutils.destroyObject(this._mesh); + if (residue._type.flags & chem_ResidueType.Flags.RNA) { + return this.palette.getSecondaryColor('rna'); + } + const secondary = residue.getSecondary(); + if (secondary) { + let color = this.palette.getSecondaryColor(secondary.type, true); + if (color === undefined) { + color = this.palette.getSecondaryColor(secondary.generic); } + return color; } - }]); + return this.palette.defaultSecondaryColor; + } +} +SecondaryStructureColorer.prototype.id = 'SS'; +SecondaryStructureColorer.prototype.name = 'Secondary Structure'; +SecondaryStructureColorer.prototype.shortName = 'Structure'; +/* harmony default export */ const colorers_SecondaryStructureColorer = (SecondaryStructureColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/UniformColorer.js + +class UniformColorer extends colorers_Colorer { + static id = 'UN'; + getAtomColor(_atom, _complex) { + return this.opts.color; + } + getResidueColor(_residue, _complex) { + return this.opts.color; + } +} +UniformColorer.prototype.id = 'UN'; +UniformColorer.prototype.name = 'Uniform'; +UniformColorer.prototype.shortName = 'Uniform'; +/* harmony default export */ const colorers_UniformColorer = (UniformColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ConditionalColorer.js + + - return SceneObject; -}(); /** - * Scene object identifier. - * @type {string} + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @exports ConditionalColorer + * @augments Colorer + * @constructor + * @classdesc Bicolor coloring algorithm based on a selector string used as a condition. */ +class ConditionalColorer extends colorers_Colorer { + static id = 'CO'; + constructor(opts) { + super(opts); + const parsed = chem_selectors.parse(this.opts.subset); + this._subsetCached = parsed.error ? chem_selectors.none() : parsed.selector; + } + getAtomColor(atom, _complex) { + return this._subsetCached.includesAtom(atom) ? this.opts.color : this.opts.baseColor; + } + getResidueColor(residue, _complex) { + const subset = this._subsetCached; + const atoms = residue._atoms; + for (let i = 0, n = atoms.length; i < n; ++i) { + if (!subset.includesAtom(atoms[i])) { + return this.opts.baseColor; + } + } + return this.opts.color; + } +} +ConditionalColorer.prototype.id = 'CO'; +ConditionalColorer.prototype.name = 'Conditional'; +ConditionalColorer.prototype.shortName = 'Conditional'; +/* harmony default export */ const colorers_ConditionalColorer = (ConditionalColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/ConformationColorer.js +class ConformationColorer extends colorers_Colorer { + static id = 'CF'; + getAtomColor(atom, _complex) { + return this.palette.getChainColor(String.fromCharCode(atom.location)); + } + getResidueColor(_residue, _complex) { + return this.palette.defaultResidueColor; + } +} +ConformationColorer.prototype.id = 'CF'; +ConformationColorer.prototype.name = 'Conformation'; +ConformationColorer.prototype.shortName = 'Conformation'; +/* harmony default export */ const colorers_ConformationColorer = (ConformationColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/TemperatureColorer.js -SceneObject.prototype.type = '__'; - -var LinesObj = /*#__PURE__*/function (_SceneObject) { - inherits(LinesObj, _SceneObject); - function LinesObj(params, opts) { - var _this; +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @see Temperature + * + * @exports TemperatureColorer + * @augments Colorer + * @constructor + * @classdesc Coloring algorithm based on temperature of chemical element. + */ +class TemperatureColorer extends colorers_Colorer { + static id = 'TM'; + getAtomColor(atom, _complex) { + const { + opts + } = this; + let factor = 1; + if (atom.temperature && opts) { + if (opts.min === opts.max) { + factor = atom.temperature > opts.max ? 1 : 0; + } else { + factor = (atom.temperature - opts.min) / (opts.max - opts.min); + } + return this.palette.getGradientColor(factor, opts.gradient); + } + return this.palette.defaultGradientColor; + } + getResidueColor(residue, _complex) { + const { + opts + } = this; + if (!opts) { + return this.palette.defaultGradientColor; + } + if (residue.temperature) { + let factor = 0; + if (opts.min === opts.max) { + factor = residue.temperature > opts.max ? 1 : 0; + } else { + factor = (residue.temperature - opts.min) / (opts.max - opts.min); + } + return this.palette.getGradientColor(factor, opts.gradient); + } + return this.palette.defaultGradientColor; + } +} +TemperatureColorer.prototype.id = 'TM'; // [T]e[M]perature +TemperatureColorer.prototype.name = 'Temperature'; +TemperatureColorer.prototype.shortName = 'Temperature'; +/* harmony default export */ const colorers_TemperatureColorer = (TemperatureColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/OccupancyColorer.js - classCallCheck(this, LinesObj); - _this = possibleConstructorReturn(this, getPrototypeOf(LinesObj).call(this, params, opts)); +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @see Occupancy + * + * @exports OccupancyColorer + * @augments Occupancy + * @constructor + * @classdesc Coloring algorithm based on occupancy of chemical element. + */ +class OccupancyColorer extends colorers_Colorer { + static id = 'OC'; + _getColorByOccupancy(occupancy, opts) { + if (occupancy !== undefined) { + const factor = 1 - occupancy; + return this.palette.getGradientColor(factor, opts.gradient); + } + return this.palette.defaultGradientColor; + } + getAtomColor(atom, _complex) { + const { + opts + } = this; + return this._getColorByOccupancy(atom.occupancy, opts); + } + getResidueColor(residue, _complex) { + const { + opts + } = this; + return this._getColorByOccupancy(residue.occupancy, opts); + } +} +OccupancyColorer.prototype.id = 'OC'; // [OC]cupancy +OccupancyColorer.prototype.name = 'Occupancy'; +OccupancyColorer.prototype.shortName = 'Occupancy'; +/* harmony default export */ const colorers_OccupancyColorer = (OccupancyColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/HydrophobicityColorer.js - if (params.length < 2) { - throw new Error('Wrong number of argumets on line object creation!'); +class HydrophobicityColorer extends colorers_Colorer { + static id = 'HY'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + let color = this.palette.defaultResidueColor; + if (residue._type.hydrophobicity !== undefined) { + // Kyte Doolitle hydro [-4.5,4.5]->[0.1] + const min = -4.5; + const max = 4.5; + color = this.palette.getGradientColor((residue._type.hydrophobicity - min) / (max - min), this.opts.gradient); } + return color; + } +} +HydrophobicityColorer.prototype.id = 'HY'; +HydrophobicityColorer.prototype.name = 'Hydrophobicity'; +HydrophobicityColorer.prototype.shortName = 'Hydrophobicity'; +/* harmony default export */ const colorers_HydrophobicityColorer = (HydrophobicityColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/MoleculeColorer.js - var _params = slicedToArray(params, 2); - - _this._id1 = _params[0]; - _this._id2 = _params[1]; - return _this; +class MoleculeColorer extends colorers_Colorer { + static id = 'MO'; + getAtomColor(atom, complex) { + return this.getResidueColor(atom.residue, complex); + } + getResidueColor(residue, _complex) { + const molecule = residue._molecule; + const count = _complex.getMoleculeCount(); + if (count > 1) { + return this.palette.getGradientColor((molecule.index - 1) / (count - 1), this.opts.gradient); + } + return this.palette.getGradientColor(0, this.opts.gradient); } +} +MoleculeColorer.prototype.id = 'MO'; +MoleculeColorer.prototype.name = 'Molecule'; +MoleculeColorer.prototype.shortName = 'Molecule'; +/* harmony default export */ const colorers_MoleculeColorer = (MoleculeColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers/CarbonColorer.js - createClass(LinesObj, [{ - key: "_getAtomFromName", - value: function _getAtomFromName(complex, atomId) { - var err = ' - Wrong atom format it must be \'#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME\' (e.g. \'A.38.CO1\')'; - var atom1 = complex.getAtomByFullname(atomId); - if (!atom1) { - throw new Error(atomId + err); - } +function scaleColor(c, factor) { + const r1 = c >> 16 & 0xff; + const g1 = c >> 8 & 0xff; + const b1 = c & 0xff; + const r = factor * r1; + const g = factor * g1; + const b = factor * b1; + return r << 16 | g << 8 | b; +} - return atom1; - } - }, { - key: "build", - value: function build(complex) { - var geom = new Geometry(); - this._atom1 = this._getAtomFromName(complex, this._id1); - this._atom2 = this._getAtomFromName(complex, this._id2); - geom.vertices[0] = this._atom1.position.clone(); - geom.vertices[1] = this._atom2.position.clone(); - geom.dynamic = true; - geom.computeBoundingBox(); - this._line = new meshes.Line(geom, new UberMaterial({ - lights: false, - overrideColor: true, - dashedLine: true, - fogTransparent: settings.now.bg.transparent - })); +/** + * Create new colorer. + * + * @param {object=} opts - Options to override defaults with. See {@link Colorer}. + * + * @exports CarbonColorer + * @augments Colorer + * @constructor + * @classdesc Bicolor coloring algorithm based on selection carbon atoms. + */ +class CarbonColorer extends colorers_Colorer { + static id = 'CB'; + getAtomColor(atom, _complex) { + const colorCarbon = this.opts.color; + const colorNotCarbon = scaleColor(colorCarbon, this.opts.factor); + return atom.flags & chem_Atom.Flags.CARBON ? colorCarbon : colorNotCarbon; + } + getResidueColor(_residue, _complex) { + return this.opts.color; + } +} +CarbonColorer.prototype.id = 'CB'; +CarbonColorer.prototype.name = 'Carbon'; +CarbonColorer.prototype.shortName = 'Carbon'; +/* harmony default export */ const colorers_CarbonColorer = (CarbonColorer); +;// CONCATENATED MODULE: ./src/gfx/colorers.js - this._line.computeLineDistances(); - this._line.material.setUberOptions({ - fixedColor: new Color(this.opts.color), - dashedLineSize: this.opts.dashSize, - dashedLinePeriod: this.opts.dashSize + this.opts.gapSize - }); - this._line.material.updateUniforms(); - this._line.raycast = function (_raycaster, _intersects) {}; - this._mesh = this._line; - var transforms = complex.getTransforms(); - if (transforms.length > 0) { - this._mesh = new Group(); - this._mesh.add(this._line); - gfxutils.applyTransformsToMeshes(this._mesh, transforms); - } - } - }, { - key: "updateToFrame", - value: function updateToFrame(frameData) { - if (!this._atom1 || !this._atom2 || !this._line) { - return; - } - var geo = this._line.geometry; - geo.vertices[0].copy(frameData.getAtomPos(this._atom1.index)); - geo.vertices[1].copy(frameData.getAtomPos(this._atom2.index)); - this._line.computeLineDistances(); - geo.computeBoundingSphere(); - geo.verticesNeedUpdate = true; - } - }]); - return LinesObj; -}(SceneObject); -LinesObj.prototype.constructor = LinesObj; -LinesObj.prototype.type = 'line'; -var fragmentShader$1 = "precision highp float;\r\n\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexSize;\r\nuniform vec2 thickness;\r\nvarying vec2 vUv;\r\n\r\n#ifdef DEPTH_OUTLINE\r\n uniform sampler2D srcDepthTex; //depthTexture\r\n uniform vec3 color;\r\n uniform float threshold;\r\n#endif\r\n\r\nvoid main() {\r\n\r\n vec2 pixelSize = thickness / srcTexSize;\r\n\r\n #ifdef DEPTH_OUTLINE\r\n float c00 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,-pixelSize.y)).x;\r\n float c01 = texture2D(srcDepthTex, vUv + vec2(0,-pixelSize.y)).x;\r\n float c02 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,-pixelSize.y)).x;\r\n float c10 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,0)).x;\r\n float c12 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,0)).x;\r\n float c20 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,pixelSize.y)).x;\r\n float c21 = texture2D(srcDepthTex, vUv + vec2(0,pixelSize.y)).x;\r\n float c22 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,pixelSize.y)).x;\r\n\r\n float horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n float vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n float grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n\r\n gl_FragColor = ( grad > threshold ) ? vec4(color.rgb, 1.0) : gl_FragColor = texture2D(srcTex, vUv);\r\n\r\n #else\r\n vec4 c00 = texture2D(srcTex, vUv + vec2(-pixelSize.x,-pixelSize.y));\r\n vec4 c01 = texture2D(srcTex, vUv + vec2(0,-pixelSize.y));\r\n vec4 c02 = texture2D(srcTex, vUv + vec2(pixelSize.x,-pixelSize.y));\r\n vec4 c10 = texture2D(srcTex, vUv + vec2(-pixelSize.x,0));\r\n vec4 c12 = texture2D(srcTex, vUv + vec2(pixelSize.x,0));\r\n vec4 c20 = texture2D(srcTex, vUv + vec2(-pixelSize.x,pixelSize.y));\r\n vec4 c21 = texture2D(srcTex, vUv + vec2(0,pixelSize.y));\r\n vec4 c22 = texture2D(srcTex, vUv + vec2(pixelSize.x,pixelSize.y));\r\n\r\n vec4 horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n vec4 vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n vec4 grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n gl_FragColor = grad;\r\n #endif\r\n}\r\n"; +const colorers = new utils_EntityList([colorers_ElementColorer, colorers_ResidueTypeColorer, colorers_SequenceColorer, colorers_ChainColorer, colorers_SecondaryStructureColorer, colorers_UniformColorer, colorers_ConditionalColorer, colorers_ConformationColorer, colorers_TemperatureColorer, colorers_OccupancyColorer, colorers_HydrophobicityColorer, colorers_MoleculeColorer, colorers_CarbonColorer]); +/* harmony default export */ const gfx_colorers = (colorers); +;// CONCATENATED MODULE: ./src/gfx/materials.js -var OutlineMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(OutlineMaterial, _THREE$RawShaderMater); - function OutlineMaterial(params) { - var _this; +function neutralColor(intensity) { + return new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(intensity, intensity, intensity); +} +const materialList = [{ + id: 'DF', + name: 'Diffuse', + shortName: 'Diffuse', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 1, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: false + } +}, { + id: 'SF', + name: 'Soft Plastic', + shortName: 'Soft', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.1), + shininess: 30, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: false + } +}, { + id: 'PL', + name: 'Glossy Plastic', + shortName: 'Glossy', + uberOptions: { + diffuse: neutralColor(0.56), + specular: neutralColor(0.28), + shininess: 100, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: false + } +}, { + id: 'ME', + name: 'Metal', + shortName: 'Metal', + uberOptions: { + diffuse: neutralColor(0.56), + specular: neutralColor(0.55), + shininess: 30, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: false + } +}, { + id: 'TR', + name: 'Transparent', + shortName: 'Transparent', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 1, + opacity: 0.5 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: true, + toonShading: false + } +}, { + id: 'GL', + name: 'Glass', + shortName: 'Glass', + uberOptions: { + diffuse: neutralColor(0.50), + specular: neutralColor(0.65), + shininess: 100, + opacity: 0.5 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: true, + toonShading: false + } +}, { + id: 'BA', + name: 'Backdrop', + shortName: 'Backdrop', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 1, + opacity: 1.0 + }, + values: { + lights: false, + fog: false, + depthWrite: false, + transparent: false, + toonShading: false + } +}, { + id: 'TN', + name: 'Toon', + shortName: 'Toon', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 1, + opacity: 1.0 + }, + values: { + lights: true, + fog: true, + depthWrite: true, + transparent: false, + toonShading: true + } +}, { + id: 'FL', + name: 'Flat', + shortName: 'Flat', + uberOptions: { + diffuse: neutralColor(1.0), + specular: neutralColor(0.0), + shininess: 0, + opacity: 1.0 + }, + values: { + lights: false, + fog: true, + depthWrite: true, + transparent: false + } +}]; +const materials = new utils_EntityList(materialList); +/* harmony default export */ const gfx_materials = (materials); +;// CONCATENATED MODULE: ./src/gfx/meshutils.js +/** + * Utils functions which is worked with meshes + * + * functions for doing something with all/specified meshes + * functions for traversihg tree and create auxiliary meshes for transparency/shadowmaps... + * functions for calculating data connected with meshes + */ - classCallCheck(this, OutlineMaterial); - // add depth outline - _this = possibleConstructorReturn(this, getPrototypeOf(OutlineMaterial).call(this, params)); - var settings = { - uniforms: { - srcTex: { - type: 't', - value: null - }, - srcDepthTex: { - type: 't', - value: null - }, - srcTexSize: { - type: 'v2', - value: new Vector2(512, 512) - }, - color: { - type: 'v3', - value: null - }, - threshold: { - type: 'f', - value: null - }, - opacity: { - type: 'f', - value: 1.0 - }, - thickness: { - type: 'v2', - value: new Vector2(1, 1) - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$1, - transparent: true, - depthTest: false, - depthWrite: false - }; - _this.setValues(settings); +function _gatherObjects(root, meshTypes) { + const meshes = []; + root.traverse(object => { + for (let i = 0; i < meshTypes.length; i++) { + if (object instanceof meshTypes[i]) { + meshes[meshes.length] = object; + break; + } + } + }); + return meshes; +} - return _this; +// new mesh with the same geometry and specified material values and layer +function createDerivativeMesh(mesh, values, layer) { + const material = mesh.material.createInstance(); + material.setValues(values); + const newMesh = new mesh.constructor(mesh.geometry, material); + newMesh.material.needsUpdate = true; + newMesh.applyMatrix4(mesh.matrix); + newMesh.layers.set(layer); + return newMesh; +} +function traverseMeshes(root, meshTypes, func) { + const meshes = _gatherObjects(root, meshTypes); + for (let i = 0, n = meshes.length; i < n; ++i) { + const mesh = meshes[i]; + if (!mesh.parent) { + continue; + } + func(mesh); + } +} +function applyTransformsToMeshes(root, mtc) { + const mtcCount = mtc.length; + if (mtcCount < 1) { + return; + } + const meshTypes = [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineSegments, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Line]; + traverseMeshes(root, meshTypes, mesh => { + mesh.applyMatrix4(mtc[0]); + for (let j = 1; j < mtcCount; ++j) { + const newMesh = new mesh.constructor(mesh.geometry, mesh.material); + mesh.parent.add(newMesh); + newMesh.applyMatrix4(mtc[j]); + } + }); +} +const processTransparentMaterial = function () { + const matValues = { + prepassTransparancy: true, + fakeOpacity: false, + transparent: false, + colorFromDepth: false, + lights: false, + shadowmap: false, + fog: false + }; + return function (root, material) { + if (!(material instanceof shaders_UberMaterial)) { + return; + } + traverseMeshes(root, [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineSegments], mesh => { + mesh.material.setValues({ + prepassTransparancy: false, + fakeOpacity: false + }); + mesh.material.needsUpdate = true; + mesh.layers.set(gfxutils.LAYERS.TRANSPARENT); + const prepassTranspMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.PREPASS_TRANSPARENT); + mesh.parent.add(prepassTranspMesh); + }); + }; +}(); +const processColFromPosMaterial = function () { + const matValues = { + colorFromPos: true, + transparent: false, + colorFromDepth: false, + lights: false, + shadowmap: false, + fog: false, + overrideColor: false, + fogTransparent: false, + attrColor: false, + attrColor2: false, + attrAlphaColor: false, + fakeOpacity: false + }; + return function (root, material) { + if (!(material instanceof shaders_UberMaterial)) { + return; + } + traverseMeshes(root, [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineSegments], mesh => { + const colFromPosMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.COLOR_FROM_POSITION); + mesh.parent.add(colFromPosMesh); + }); + }; +}(); +const createShadowmapMaterial = function () { + const matValues = { + colorFromDepth: true, + orthoCam: true, + lights: false, + shadowmap: false, + fog: false + }; + return function (root, material) { + if (!(material instanceof shaders_UberMaterial)) { + return; + } + traverseMeshes(root, [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineSegments], mesh => { + if (!mesh.receiveShadow && mesh.material.shadowmap) { + // remove shadow from non-receivers + mesh.material.setValues({ + shadowmap: false + }); + } + if (!mesh.material.lights) { + // skip creating shadowmap meshes for materials without lighting + return; + } + if (!mesh.castShadow) { + // skip creating shadowmap meshes for non-casters + return; + } + if (!gfxutils.belongToSelectLayers(mesh)) { + // skip creating shadowmap meshes for selection layer + return; + } + const shadowmapMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.SHADOWMAP); + shadowmapMesh.isShadowmapMesh = true; + mesh.parent.add(shadowmapMesh); + }); + }; +}(); +function removeShadowmapMaterial(root, material) { + if (!(material instanceof shaders_UberMaterial)) { + return; } - - createClass(OutlineMaterial, [{ - key: "copy", - value: function copy(source) { - get(getPrototypeOf(OutlineMaterial.prototype), "copy", this).call(this, source); - - this.depth = source.depth; + traverseMeshes(root, [external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineSegments], mesh => { + if (mesh.isShadowmapMesh) { + mesh.parent.remove(mesh); } - }, { - key: "setValues", - value: function setValues(values) { - if (typeof values === 'undefined') { - return; - } // set direct values - - - get(getPrototypeOf(OutlineMaterial.prototype), "setValues", this).call(this, values); - - var defines = {}; - - if (this.depth) { - defines.DEPTH_OUTLINE = 1; - } // set dependent values - - - this.defines = defines; + }); +} +function forEachMeshInGroup(group, process) { + function processObj(object) { + if (object instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh) { + process(object); + } + for (let i = 0, l = object.children.length; i < l; i++) { + processObj(object.children[i]); + } + } + processObj(group); +} +function _countMeshTriangles(mesh) { + const geom = mesh.geometry; + if (geom instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferGeometry) { + const attribs = geom.attributes; + for (const property in attribs) { + if (attribs.hasOwnProperty(property) && attribs[property] instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.InstancedBufferAttribute) { + const currAttr = attribs[property]; + const indexSize = geom.index ? geom.index.array.length / 3 : 0; + return indexSize * currAttr.array.length / currAttr.itemSize; + } } - }]); + return 0; + } + if (geom instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry) { + return geom.index ? geom.index.array.length / 3 : 0; + } + return geom.faces ? geom.faces.length : 0; +} +function countTriangles(group) { + let totalCount = 0; + forEachMeshInGroup(group, mesh => { + totalCount += _countMeshTriangles(mesh); + }); + return totalCount; +} +/* harmony default export */ const meshutils = ({ + applyTransformsToMeshes, + processTransparentMaterial, + processColFromPosMaterial, + createShadowmapMaterial, + removeShadowmapMaterial, + forEachMeshInGroup, + countTriangles +}); +;// CONCATENATED MODULE: ./src/gfx/Representation.js - return OutlineMaterial; -}(RawShaderMaterial); -OutlineMaterial.prototype.depth = false; -var fragmentShader$2 = "precision highp float;\r\n\r\n// edge end finding algorithm parameters\r\n#define FXAA_QUALITY_PS 8\r\n#define FXAA_QUALITY_P0 1.0\r\n#define FXAA_QUALITY_P1 1.5\r\n#define FXAA_QUALITY_P2 2.0\r\n#define FXAA_QUALITY_P3 2.0\r\n#define FXAA_QUALITY_P4 2.0\r\n#define FXAA_QUALITY_P5 2.0\r\n#define FXAA_QUALITY_P6 4.0\r\n#define FXAA_QUALITY_P7 12.0\r\n// constants\r\nfloat fxaaQualityEdgeThreshold = 0.125;\r\nfloat fxaaQualityEdgeThresholdMin = 0.0625;\r\nfloat fxaaQualitySubpix = 0.7; //0.65;\r\n// global params\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexelSize;\r\nuniform vec3 bgColor;\r\n// from vs\r\nvarying vec2 vUv;\r\n//=====================================================================//\r\n// calc luminance from rgb\r\n//'float FxaaLuma(vec3 rgb) {return rgb.y * (0.587/0.299) + rgb.x; } // Lotte's idea about game luminance\r\nfloat FxaaLuma(vec3 rgb) {return dot(rgb, vec3(0.299, 0.587, 0.114)); } // real luminance calculation\r\n // for non-real scene rendering\r\n// texture sampling by pixel position(coords) and offset(in pixels)\r\n vec3 FxaaTex(sampler2D tex, vec2 pos, vec2 off, vec2 res ) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos + off * res );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos + off * res ).xyz;\r\n #endif\r\n}\r\nvec3 FxaaTexTop(sampler2D tex, vec2 pos) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos).xyz;\r\n #endif\r\n}\r\nvec4 FxaaTexTopAlpha(sampler2D tex, vec2 pos) {\r\n return texture2D( tex, pos);\r\n}\r\n\r\n//=====================================================================//\r\nvoid main() {\r\n // renaming\r\n vec2 posM = vUv;\r\n // get luminance for neighbours\r\n float lumaS = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, 1.0 ), srcTexelSize));\r\n float lumaE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 0.0 ), srcTexelSize));\r\n float lumaN = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, -1.0 ), srcTexelSize));\r\n float lumaW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 0.0 ), srcTexelSize));\r\n float lumaM = FxaaLuma(FxaaTexTop(srcTex, posM));\r\n // find max and min luminance\r\n float rangeMax = max(max(lumaN, lumaW), max(lumaE, max(lumaS, lumaM)));\r\n float rangeMin = min(min(lumaN, lumaW), min(lumaE, min(lumaS, lumaM)));\r\n // calc maximum non-edge range\r\n float rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\r\n float range = rangeMax - rangeMin;\r\n float rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\r\n // exit when luma contrast is small (is not edge)\r\n if(range < rangeMaxClamped){\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n return;\r\n }\r\n float subpixRcpRange = 1.0/range;\r\n // note: the sampling coordinates can be calculated in vertex shader but the approach doesn't affect performance\r\n // visibly, thus we decided to leave calculation here for better readability.\r\n // calc other neighbours luminance\r\n float lumaNE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, -1.0 ), srcTexelSize));\r\n float lumaSW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 1.0 ), srcTexelSize));\r\n float lumaSE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 1.0 ), srcTexelSize));\r\n float lumaNW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, -1.0 ), srcTexelSize));\r\n/*--------------span calculation and subpix amount calulation-----------------*/\r\n float lumaNS = lumaN + lumaS;\r\n float lumaWE = lumaW + lumaE;\r\n float subpixNSWE = lumaNS + lumaWE;\r\n float edgeHorz1 = (-2.0 * lumaM) + lumaNS;\r\n float edgeVert1 = (-2.0 * lumaM) + lumaWE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNESE = lumaNE + lumaSE;\r\n float lumaNWNE = lumaNW + lumaNE;\r\n float edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\r\n float edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNWSW = lumaNW + lumaSW;\r\n float lumaSWSE = lumaSW + lumaSE;\r\n float edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\r\n float edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\r\n float edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\r\n float edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\r\n float edgeHorz = abs(edgeHorz3) + edgeHorz4;\r\n float edgeVert = abs(edgeVert3) + edgeVert4;\r\n/*--------------------subpix amount calulation------------------------------*/\r\n float subpixNWSWNESE = lumaNWSW + lumaNESE;\r\n float lengthSign = srcTexelSize.x;\r\n bool horzSpan = edgeHorz >= edgeVert;\r\n // debug code edge span visualization\r\n/*' if (horzSpan)\r\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);\r\n else\r\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\r\n return;*/\r\n float subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\r\n/*--------------------------------------------------------------------------*/\r\n if(!horzSpan) lumaN = lumaW;\r\n if(!horzSpan) lumaS = lumaE;\r\n if(horzSpan) lengthSign = srcTexelSize.y;\r\n float subpixB = (subpixA * (1.0/12.0)) - lumaM;\r\n/*--------------------------------------------------------------------------*/\r\n float gradientN = lumaN - lumaM;\r\n float gradientS = lumaS - lumaM;\r\n float lumaNN = lumaN + lumaM;\r\n float lumaSS = lumaS + lumaM;\r\n bool pairN = abs(gradientN) >= abs(gradientS);\r\n float gradient = max(abs(gradientN), abs(gradientS));\r\n if(pairN) lengthSign = -lengthSign;\r\n float subpixC = clamp(abs(subpixB) * subpixRcpRange, 0.0, 1.0);\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posB;\r\n posB = posM;\r\n vec2 offNP;\r\n offNP.x = (!horzSpan) ? 0.0 : srcTexelSize.x;\r\n offNP.y = ( horzSpan) ? 0.0 : srcTexelSize.y;\r\n if(!horzSpan) posB.x += lengthSign * 0.5;\r\n if( horzSpan) posB.y += lengthSign * 0.5;\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posN;\r\n posN = posB - offNP * FXAA_QUALITY_P0;\r\n vec2 posP;\r\n posP = posB + offNP * FXAA_QUALITY_P0;\r\n float subpixD = ((-2.0)*subpixC) + 3.0;\r\n float lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN));\r\n float subpixE = subpixC * subpixC;\r\n float lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP));\r\n/*--------------------------------------------------------------------------*/\r\n if(!pairN) lumaNN = lumaSS;\r\n float gradientScaled = gradient * 1.0/4.0;\r\n float lumaMM = lumaM - lumaNN * 0.5;\r\n float subpixF = subpixD * subpixE;\r\n bool lumaMLTZero = lumaMM < 0.0;\r\n/*---------------------looped edge-end search-------------------------------*/\r\n lumaEndN -= lumaNN * 0.5;\r\n lumaEndP -= lumaNN * 0.5;\r\n bool doneN = abs(lumaEndN) >= gradientScaled;\r\n bool doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P1;\r\n bool doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P1;\r\n/*--------------------------------------------------------------------------*/\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P2;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P2;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 3)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P3;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P3;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 4)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P4;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P4;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 5)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P5;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P5;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 6)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P6;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P6;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 7)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P7;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P7;\r\n/*--------------------------------------------------------------------------*/\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n/*----------------calculate subpix offset due to edge ends-------------------*/\r\n float dstN = posM.x - posN.x;\r\n float dstP = posP.x - posM.x;\r\n if(!horzSpan) dstN = posM.y - posN.y;\r\n if(!horzSpan) dstP = posP.y - posM.y;\r\n/*--------------------------------------------------------------------------*/\r\n bool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\r\n float spanLength = (dstP + dstN);\r\n bool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\r\n float spanLengthRcp = 1.0 / spanLength;\r\n/*--------------------------------------------------------------------------*/\r\n bool directionN = dstN < dstP;\r\n float dst = min(dstN, dstP);\r\n bool goodSpan = directionN ? goodSpanN : goodSpanP;\r\n float subpixG = subpixF * subpixF;\r\n float pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\r\n float subpixH = subpixG * fxaaQualitySubpix;\r\n/*-----------------calc texture offest using subpix-------------------------*/\r\n float pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\r\n float pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\r\n\r\n float offset = pixelOffsetSubpix * lengthSign;\r\n #ifdef BG_TRANSPARENT\r\n // get original texel\r\n vec4 rgbaA = FxaaTexTopAlpha(srcTex, posM);\r\n // calc step to blended texel\r\n vec2 step = sign((!horzSpan) ? vec2 (offset, 0.0) : vec2 (0.0, offset));\r\n // get neighboring texel\r\n vec4 rgbaB = FxaaTexTopAlpha(srcTex, posM + step * srcTexelSize);\r\n // calc blend factor from offset\r\n float f = (!horzSpan) ? offset / srcTexelSize.x : offset / srcTexelSize.y;\r\n f = abs(f);\r\n // calc alpha (special formula to emulate blending with bg)\r\n gl_FragColor.a = 1.0 - mix(1.0 - rgbaA.a, 1.0 - rgbaB.a, f);\r\n // calc color (special formula to emulate blending with bg)\r\n gl_FragColor.rgb = mix(rgbaA.rgb * rgbaA.a, rgbaB.rgb * rgbaB.a, f) / gl_FragColor.a;\r\n #else\r\n if(!horzSpan) {\r\n posM.x += offset;\r\n } else {\r\n posM.y += offset;\r\n }\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n #endif\r\n return;\r\n}\r\n"; -var FXAAMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(FXAAMaterial, _THREE$RawShaderMater); - function FXAAMaterial(params) { - var _this; - classCallCheck(this, FXAAMaterial); - _this = possibleConstructorReturn(this, getPrototypeOf(FXAAMaterial).call(this, params)); // set default values - _this.setValues.call(assertThisInitialized(_this), { - uniforms: { - srcTex: { - type: 't', - value: null - }, - srcTexelSize: { - type: 'v2', - value: new Vector2(1.0 / 512.0, 1.0 / 512.0) - }, - bgColor: { - type: 'c', - value: new Color(0xffffff) - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$2, - transparent: false, - depthTest: false, - depthWrite: false +const { + selectors: Representation_selectors +} = chem; +class Representation { + constructor(index, mode, colorer, selector) { + const startMaterialValues = { + clipPlane: settings.now.draft.clipPlane, + fogTransparent: settings.now.bg.transparent, + shadowmap: settings.now.shadow.on, + shadowmapType: settings.now.shadow.type + }; + this.index = index; + this.mode = mode; + this.colorer = colorer; + this.selector = selector; + this.selectorString = ''; + this.count = 0; + this.material = new shaders_UberMaterial(); + this.material.setValues(startMaterialValues); + this.material.setUberOptions({ + fogAlpha: settings.now.fogAlpha }); + this.materialPreset = gfx_materials.first; + this.needsRebuild = true; + this.visible = true; - _this.setValues(params); - - return _this; + // apply mode params & preset + this.setMode(mode); } - - createClass(FXAAMaterial, [{ - key: "copy", - value: function copy(source) { - get(getPrototypeOf(FXAAMaterial.prototype), "copy", this).call(this, source); - - this.depth = source.depth; + markAtoms(complex) { + this.count = complex.markAtoms(this.selector, 1 << this.index); + this.needsRebuild = true; + return this.count; + } + unmarkAtoms(complex) { + complex.clearAtomBits(1 << this.index); + this.count = 0; + } + setMode(mode) { + this.mode = mode; + } + setMaterialPreset(preset) { + this.materialPreset = preset; + this.material.setUberOptions(preset.uberOptions); + this.material.setValues(preset.values); + } + reset() { + this.geo = null; + this.selectionGeo = null; + } + buildGeometry(complex) { + this.reset(); + this.needsRebuild = false; + if (settings.now.ao) { + this.material.setValues({ + normalsToGBuffer: settings.now.ao + }); } - }, { - key: "setValues", - value: function setValues(values) { - if (typeof values === 'undefined') { - return; - } // set direct values - - - get(getPrototypeOf(FXAAMaterial.prototype), "setValues", this).call(this, values); - - var defines = {}; - - if (this.bgTransparent) { - defines.BG_TRANSPARENT = 1; - } // set dependent values - - - this.defines = defines; + this.geo = this.mode.buildGeometry(complex, this.colorer, 1 << this.index, this.material); + if (this.material.uberOptions.opacity < 0.99 && settings.now.transparency === 'prepass') { + meshutils.processTransparentMaterial(this.geo, this.material); } - }]); - - return FXAAMaterial; -}(RawShaderMaterial); - -FXAAMaterial.prototype.bgTransparent = false; - -var fragmentShader$3 = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 32\r\nuniform vec3 samplesKernel[MAX_SAMPLES_COUNT];\r\nuniform sampler2D noiseTexture;\r\nuniform vec2 noiseTexelSize;\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D depthTexture;\r\nuniform sampler2D normalTexture;\r\nuniform vec2 srcTexelSize;\r\nuniform vec2 camNearFar;\r\nuniform mat4 projMatrix;\r\n\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\nuniform float kernelRadius;\r\nuniform float depthThreshold;\r\nuniform float factor;\r\n\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n // remap coordinates to prevent noise exture rescale\r\n vec2 vUvNoise = vUv / srcTexelSize * noiseTexelSize;\r\n vec4 normalData = texture2D(normalTexture, vUv);\r\n // return for background fragments (their normals are zero vectors)\r\n if (length(normalData.rgb) < EPSILON) {\r\n // 0.0 in alpha component means that it is background fragment\r\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\r\n return;\r\n }\r\n //[0, 1] -> [-1, 1]\r\n vec3 normal = (normalData.rgb * 2.0 - 1.0);\r\n // normalData.a store 1.0 if normal was build for frontfaced surface\r\n // and 0.0 in other case\r\n if (normalData.a < EPSILON) {\r\n normal *= -1.0;\r\n }\r\n // get random vector for sampling sphere rotation\r\n vec3 randN = texture2D(noiseTexture, vUvNoise).rgb * 2.0 - 1.0;\r\n randN = normalize(randN);\r\n // build TBN (randomly rotated around normal)\r\n vec3 tangent = normalize(randN - normal * dot(randN, normal));\r\n vec3 bitangent = cross(tangent, normal);\r\n mat3 TBN = mat3(tangent, bitangent, normal);\r\n // calc AO value\r\n float AO = 0.0;\r\n for (int i = 0 ; i < MAX_SAMPLES_COUNT ; i++) {\r\n // rotate sampling kernel around normal\r\n vec3 reflectedSample = TBN * samplesKernel[i];\r\n // get sample\r\n vec3 samplePos = viewPos + reflectedSample * kernelRadius;\r\n\r\n // project sample to screen to get sample's screen pos\r\n vec4 SampleScrPos = vec4(samplePos, 1.0);\r\n // eye -> clip\r\n SampleScrPos = projMatrix * SampleScrPos;\r\n // normalize\r\n SampleScrPos.xy /= SampleScrPos.w;\r\n //[-1, 1] -> [0, 1]\r\n SampleScrPos.xy = (SampleScrPos.xy + vec2(1.0)) * 0.5;\r\n\r\n // get view z for sample projected to the objct surface\r\n float sampleDepth = CalcViewZ(SampleScrPos.xy);\r\n // calc occlusion made by object surface at the sample\r\n AO += step(samplePos.z, sampleDepth);\r\n }\r\n // calc result AO-map color\r\n AO = 1.0 - max(0.0, AO / float(MAX_SAMPLES_COUNT) * factor);\r\n // write value to AO-map\r\n gl_FragColor = vec4(AO, AO, AO, 1.0);\r\n}\r\n"; - -var _samplesKernel$1 = [// hemisphere samples adopted to sphere -new Vector3(0.295184, 0.077723, 0.068429), new Vector3(-0.271976, -0.365221, 0.838363), new Vector3(0.547713, 0.467576, 0.488515), new Vector3(0.662808, -0.031733, 0.584758), new Vector3(-0.025717, 0.218955, 0.657094), new Vector3(-0.310153, -0.365223, 0.370701), new Vector3(-0.101407, -0.006313, 0.747665), new Vector3(-0.769138, 0.360399, 0.086847), new Vector3(-0.271988, -0.275140, 0.905353), new Vector3(0.096740, -0.566901, 0.700151), new Vector3(0.562872, -0.735136, 0.094647), new Vector3(0.379877, 0.359278, 0.190061), new Vector3(0.519064, -0.023055, 0.405068), new Vector3(-0.301036, 0.114696, 0.088885), new Vector3(-0.282922, 0.598305, 0.487214), new Vector3(-0.181859, 0.251670, 0.679702), new Vector3(-0.191463, -0.635818, 0.512919), new Vector3(-0.293655, 0.427423, 0.078921), new Vector3(-0.267983, 0.680534, 0.132880), new Vector3(0.139611, 0.319637, 0.477439), new Vector3(-0.352086, 0.311040, 0.653913), new Vector3(0.321032, 0.805279, 0.487345), new Vector3(0.073516, 0.820734, 0.414183), new Vector3(-0.155324, 0.589983, 0.411460), new Vector3(0.335976, 0.170782, 0.527627), new Vector3(0.463460, -0.355658, 0.167689), new Vector3(0.222654, 0.596550, 0.769406), new Vector3(0.922138, -0.042070, 0.147555), new Vector3(-0.727050, -0.329192, 0.369826), new Vector3(-0.090731, 0.533820, 0.463767), new Vector3(-0.323457, -0.876559, 0.238524), new Vector3(-0.663277, -0.372384, 0.342856)]; - -var AOMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(AOMaterial, _THREE$RawShaderMater); - - function AOMaterial() { - var _this; - - classCallCheck(this, AOMaterial); - - _this = possibleConstructorReturn(this, getPrototypeOf(AOMaterial).call(this)); // set default values - - _this.setValues.call(assertThisInitialized(_this), { - uniforms: { - noiseTexture: { - type: 't', - value: noise.noiseTexture - }, - noiseTexelSize: { - type: 'v2', - value: new Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight) - }, - diffuseTexture: { - type: 't', - value: null - }, - normalTexture: { - type: 't', - value: null - }, - depthTexture: { - type: 't', - value: null - }, - srcTexelSize: { - type: 'v2', - value: new Vector2(1.0 / 512.0, 1.0 / 512.0) - }, - camNearFar: { - type: 'v2', - value: new Vector2(1.0, 10.0) - }, - projMatrix: { - type: 'mat4', - value: new Matrix4() - }, - aspectRatio: { - type: 'f', - value: 0.0 - }, - tanHalfFOV: { - type: 'f', - value: 0.0 - }, - samplesKernel: { - type: 'v3v', - value: _samplesKernel$1 - }, - kernelRadius: { - type: 'f', - value: 1.0 - }, - depthThreshold: { - type: 'f', - value: 1.0 - }, - factor: { - type: 'f', - value: 1.0 + this.geo.visible = this.visible; + gfxutils.processObjRenderOrder(this.geo, this.materialPreset.id); + meshutils.processColFromPosMaterial(this.geo, this.material); + if (settings.now.shadow.on) { + meshutils.createShadowmapMaterial(this.geo, this.material); + } + return this.geo; + } + buildSelectionGeometry(mask) { + let sg = null; + if (this.geo && 'getSubset' in this.geo) { + const meshes = this.geo.getSubset(mask); + if (meshes && meshes.length > 0) { + sg = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group(); + sg.matrixAutoUpdate = false; + sg.matrix = this.geo.matrix; + for (let j = 0; j < meshes.length; j++) { + const m = meshes[j]; + sg.add(m); } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$3, - transparent: false, - depthTest: false, - depthWrite: false - }); - - return _this; + } + } + if (sg) { + sg.visible = this.visible; + } + this.selectionGeo = sg; + return this.selectionGeo; } - return AOMaterial; -}(RawShaderMaterial); - -var fragmentShader$4 = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = res;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x + samplesOffsets[i] * srcTexelSize.x, y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb = res.rgb / weightSum;\r\n gl_FragColor = res;\r\n}\r\n"; - -var _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0]; - -var AOHorBlurMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(AOHorBlurMaterial, _THREE$RawShaderMater); + /** + * Create object that represents difference between current and another rep + * anotherRep could be undefined. In this case everything is reported. + */ + compare(repSettings) { + const diff = {}; + const selStr = String(this.selector); + if (!repSettings || selStr.valueOf() !== String(repSettings.selector).valueOf()) { + diff.selector = selStr; + } + const modeDiff = this.mode.identify(); + if (!repSettings || Array.isArray(modeDiff) || modeDiff !== repSettings.mode) { + diff.mode = modeDiff; + } + const colorerDiff = this.colorer.identify(); + if (!repSettings || Array.isArray(colorerDiff) || colorerDiff !== repSettings.colorer) { + diff.colorer = colorerDiff; + } + if (!repSettings || this.materialPreset.id !== repSettings.material) { + diff.material = this.materialPreset.id; + } + return diff; + } - function AOHorBlurMaterial() { - var _this; + /** + * Change representation. Write fields what was changed into new object, return it. + */ + change(repSettings, complex, mode, color) { + const diff = {}; - classCallCheck(this, AOHorBlurMaterial); + // modify selector + if (repSettings.selector) { + const newSelectorObject = Representation_selectors.parse(repSettings.selector).selector; + const newSelector = String(newSelectorObject); + if (this.selectorString !== newSelector) { + diff.selector = newSelector; + this.selectorString = newSelector; + this.selector = newSelectorObject; + this.markAtoms(complex); + } + } - _this = possibleConstructorReturn(this, getPrototypeOf(AOHorBlurMaterial).call(this)); // set default values + // modify mode + if (repSettings.mode) { + const newMode = repSettings.mode; + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEqual(this.mode.identify(), newMode)) { + diff.mode = newMode; + this.setMode(mode); + } + } - _this.setValues.call(assertThisInitialized(_this), { - uniforms: { - depthTexture: { - type: 't', - value: null - }, - srcTexelSize: { - type: 'v2', - value: new Vector2(1.0 / 512.0, 1.0 / 512.0) - }, - aoMap: { - type: 't', - value: null - }, - samplesOffsets: { - type: 'fv1', - value: _kernelOffsets - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$4, - transparent: false, - depthTest: false, - depthWrite: false - }); + // modify colorer + if (repSettings.colorer) { + const newColorer = repSettings.colorer; + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEqual(this.colorer.identify(), newColorer)) { + diff.colorer = newColorer; + this.colorer = color; + } + } - return _this; + // modify material + if (repSettings.material) { + const newMaterial = repSettings.material; + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEqual(this.materialPreset.id, newMaterial)) { + diff.material = newMaterial; + this.setMaterialPreset(gfx_materials.get(repSettings.material)); + } + } + return diff; } + show(visible) { + this.visible = visible; + if (this.geo) { + this.geo.visible = visible; + } + if (this.selectionGeo) { + this.selectionGeo.visible = visible; + } + } +} +/* harmony default export */ const gfx_Representation = (Representation); +;// CONCATENATED MODULE: ./src/ComplexVisualEdit.js - return AOHorBlurMaterial; -}(RawShaderMaterial); - -var fragmentShader$5 = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nuniform mat4 projMatrix;\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\n#ifdef USE_FOG\r\n uniform vec2 fogNearFar;\r\n uniform vec4 fogColor;\r\n#endif\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 color = texture2D(diffuseTexture, vec2(x, y));\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x, y + samplesOffsets[i] * srcTexelSize.y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb /= weightSum;\r\n\r\n #if defined(USE_FOG) && !defined(FOG_TRANSPARENT)\r\n // Add fog to the result value\r\n // Proper way to get an image with fog and ao requires formula:\r\n // gl_FragColor = fragColor*AO*(1-fogFactor) + fogColor*fogFactor\r\n // But we have already fogged molecule to add AO too. Let's split the straight formula into our real steps!\r\n // We have: AO, fogFactor, fogColor,\r\n // color = fragColor*(1-fogFactor) + fogColor*fogFactor (it comes from diffuseTexture,\r\n // where molecule has been already drawn with fog)\r\n // Transform:\r\n // fragColor*AO*(1-fogFactor) + fogColor*fogFactor =\r\n // = [fragColor*(1-fogFactor) = color - fogColor*fogFactor] =\r\n // = (color - fogColor*fogFactor)*AO + fogColor*fogFactor =\r\n // = color*AO + fogColor*fogFactor*(1 - AO)\r\n // Result: gl_FragColor = color*AO + fogColor*fogFactor*(1 - AO)\r\n float fogFactor = smoothstep(fogNearFar.x, fogNearFar.y, - viewPos.z) * fogColor.a;\r\n gl_FragColor.rgb = color.rgb * res.rgb + fogColor.rgb * fogFactor *(vec3(1.0, 1.0, 1.0) - res.rgb);\r\n #else\r\n gl_FragColor.rgb = color.rgb * res.rgb;\r\n #endif\r\n gl_FragColor.a = color.a;\r\n}\r\n"; - -var _kernelOffsets$1 = [-2.0, -1.0, 0.0, 1.0, 2.0]; - -var AOVertBlurWithBlendMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(AOVertBlurWithBlendMaterial, _THREE$RawShaderMater); - - function AOVertBlurWithBlendMaterial(params) { - var _this; - classCallCheck(this, AOVertBlurWithBlendMaterial); - _this = possibleConstructorReturn(this, getPrototypeOf(AOVertBlurWithBlendMaterial).call(this, params)); // set default values - _this.setValues.call(assertThisInitialized(_this), { - uniforms: { - diffuseTexture: { - type: 't', - value: null - }, - depthTexture: { - type: 't', - value: null - }, - srcTexelSize: { - type: 'v2', - value: new Vector2(1.0 / 512.0, 1.0 / 512.0) - }, - aoMap: { - type: 't', - value: null - }, - samplesOffsets: { - type: 'fv1', - value: _kernelOffsets$1 - }, - projMatrix: { - type: 'mat4', - value: new Matrix4() - }, - aspectRatio: { - type: 'f', - value: 0.0 - }, - tanHalfFOV: { - type: 'f', - value: 0.0 - }, - fogNearFar: { - type: 'v2', - value: new Vector2(100.0, 100.0) - }, - fogColor: { - type: 'v4', - value: new Vector4(0.0, 0.5, 0.0, 1.0) - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$5, - transparent: false, - depthTest: false, - depthWrite: false +function _traverseComponentGroups(root, component, callback) { + const { + children + } = root; + if (!children) { + return; + } + for (let i = 0, n = children.length; i < n; ++i) { + const child = children[i]; + if (child._component === component) { + callback(child); + } + if (child instanceof gfxutils.RCGroup) { + _traverseComponentGroups(child, component, callback); + } + } +} +function ComplexEditor() {} +class ComplexComponentEditor extends ComplexEditor { + constructor(complexVisual) { + super(); + this._complexVisual = complexVisual; + this._inProgress = false; + } + begin() { + const complex = this._complexVisual.getComplex(); + + // init component matrices + this._componentTransforms = []; + for (let i = 0; i < complex._components.length; ++i) { + const component = complex._components[i]; + this._componentTransforms[component._index] = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Object3D(); + } + this._inProgress = true; + return true; + } + apply() { + if (!this._inProgress) { + return; + } + const complex = this._complexVisual.getComplex(); + for (let i = 0; i < complex._components.length; ++i) { + this._bakeComponentTransform(complex._components[i]); + } + complex.onAtomPositionChanged(); + this._resetComponentTransform(); + this._complexVisual.finalizeEdit(); + } + discard() { + if (!this._inProgress) { + return; + } + this._resetComponentTransform(); + this._complexVisual.finalizeEdit(); + } + getAltObj() { + const res = { + objects: [], + pivot: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0) + }; + const visual = this._complexVisual; + const component = visual.getSelectedComponent(); + if (component === null) { + return res; + } + const selection = this._complexVisual.getSelectionGeo(); + const selectionMask = 1 << visual.getSelectionBit(); + let i; + let j; + let reprNode; + let geo; + + // find all geo nodes for this component + _traverseComponentGroups(visual, component, child => { + res.objects.push(child); }); - _this.setValues(params); + // find all selection nodes for this component + for (i = 0; i < selection.children.length; ++i) { + reprNode = selection.children[i]; + for (j = 0; j < reprNode.children.length; ++j) { + geo = reprNode.children[j]; + if (geo.hasOwnProperty('_component') && geo._component === component) { + res.objects.push(geo); + } + } + } - return _this; + // add dummy object that stores component transformation + res.objects.push(this._componentTransforms[component._index]); + const bbmin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + const bbmax = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + component.forEachResidue(residue => { + const atoms = residue._atoms; + for (j = 0; j < atoms.length; ++j) { + if (atoms[j].mask & selectionMask) { + bbmin.min(atoms[j].position); + bbmax.max(atoms[j].position); + } + } + }); + res.pivot.lerpVectors(bbmin, bbmax, 0.5); + return res; + } + _bakeComponentTransform(component) { + const t = this._componentTransforms[component._index]; + if (t && (!(t.position.x === 0 && t.position.y === 0 && t.position.z === 0) || !(t.quaternion.x === 0 && t.quaternion.y === 0 && t.quaternion.z === 0 && t.quaternion.w === 1))) { + t.updateMatrix(); + component.forEachResidue(residue => { + const atoms = residue._atoms; + for (let j = 0; j < atoms.length; ++j) { + atoms[j].position.applyMatrix4(t.matrix); + } + }); + } } + _resetComponentTransform() { + const visual = this._complexVisual; + const selection = this._complexVisual.getSelectionGeo(); + let i; + let j; + let reprNode; + let geo; + for (i = 0; i < this._componentTransforms.length; ++i) { + geo = this._componentTransforms[i]; + geo.position.set(0, 0, 0); + geo.quaternion.set(0, 0, 0, 1); + } - createClass(AOVertBlurWithBlendMaterial, [{ - key: "setValues", - value: function setValues(values) { - if (typeof values === 'undefined') { - return; - } // set direct values + // reset all geo nodes + for (i = 0; i < visual.children.length; ++i) { + reprNode = visual.children[i]; + for (j = 0; j < reprNode.children.length; ++j) { + geo = reprNode.children[j]; + if (geo.hasOwnProperty('_component')) { + geo.position.set(0, 0, 0); + geo.quaternion.set(0, 0, 0, 1); + } + } + } + // reset all selection nodes + for (i = 0; i < selection.children.length; ++i) { + reprNode = selection.children[i]; + for (j = 0; j < reprNode.children.length; ++j) { + geo = reprNode.children[j]; + if (geo.hasOwnProperty('_component')) { + geo.position.set(0, 0, 0); + geo.quaternion.set(0, 0, 0, 1); + } + } + } + } +} +class ComplexFragmentEditor extends ComplexEditor { + constructor(complexVisual) { + super(); + this._complexVisual = complexVisual; + this._inProgress = false; + } + begin() { + const visual = this._complexVisual; + const selection = this._complexVisual.getSelectionGeo(); + const atoms = this._getSelectionBorderAtoms(); + if (atoms.length < 1 || atoms.length > 2) { + logger.error('Can only edit fragments with one or two bound atoms.'); + return false; + } + this._fragmentBoundAtoms = atoms; + const selectionMask = 1 << visual.getSelectionBit(); + + // hide selected fragment in main model + visual.disableSubset(selectionMask, true); + + // hide selection geo in main model + for (let k = 0; k < selection.children.length; ++k) { + selection.children[k].visible = false; + } + + // create visible fragment representation to rotate + const pivotPos = atoms[0].position.clone(); + if (atoms.length === 2) { + pivotPos.lerp(atoms[1].position, 0.5); + } + this._fragmentGeo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group(); + visual.add(this._fragmentGeo); + this._fragmentGeo.position.copy(pivotPos); + this._fragmentSelectionGeo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group(); + selection.add(this._fragmentSelectionGeo); + this._fragmentSelectionGeo.position.copy(pivotPos); + const offset = pivotPos.clone(); + offset.negate(); + for (let i = 0; i < visual.children.length; ++i) { + const g = visual.children[i]; + if (!('getSubset' in g)) { + continue; + } + const vg = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group(); + this._fragmentGeo.add(vg); + const sg = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group(); + this._fragmentSelectionGeo.add(sg); + const meshes = g.getSubset(selectionMask, true); + for (let j = 0; j < meshes.length; j++) { + const m = meshes[j]; + vg.add(m); + m.position.copy(offset); + } + const smeshes = g.getSubset(selectionMask, true); + for (let h = 0; h < smeshes.length; h++) { + const sm = smeshes[h]; + sg.add(sm); + sm.position.copy(offset); + } + } + gfxutils.applySelectionMaterial(this._fragmentSelectionGeo); + this._inProgress = true; + return true; + } + apply() { + if (!this._inProgress) { + return; + } + const visual = this._complexVisual; + const selectionBit = visual.getSelectionBit(); + const p = this._fragmentGeo.position; + const m = this._fragmentGeo.matrix.clone(); + m.multiply(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4().makeTranslation(-p.x, -p.y, -p.z)); + this._bakeAtomTransform(m, 1 << selectionBit); - get(getPrototypeOf(AOVertBlurWithBlendMaterial.prototype), "setValues", this).call(this, values); + // show selected fragment in main model + visual.enableSubset(1 << selectionBit, true); + visual.getComplex().onAtomPositionChanged(); + visual.finalizeEdit(); + } + discard() { + if (!this._inProgress) { + return; + } + const visual = this._complexVisual; + const selection = this._complexVisual.getSelectionGeo(); + this._fragmentGeo.parent.remove(this._fragmentGeo); - var defines = {}; + // show selected fragment in main model + visual.enableSubset(1 << visual.getSelectionBit(), true); - if (this.useFog) { - defines.USE_FOG = 1; + // show selection geo in main model (+ remove fragment selection geo) + for (let i = 0; i < selection.children.length; ++i) { + const node = selection.children[i]; + if (node.visible) { + selection.remove(node); + } else { + node.visible = true; + } + } + visual.finalizeEdit(); + } + isFreeRotationAllowed() { + return this._fragmentBoundAtoms.length < 2; + } + getAltObj() { + const res = { + objects: [], + pivot: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0) + }; + res.objects.push(this._fragmentGeo, this._fragmentSelectionGeo); + const boundAtoms = this._fragmentBoundAtoms; + if (boundAtoms.length === 1) { + if (boundAtoms[0].bonds.length === 1) { + // single external bond allows rotation about bond axis + const bond = boundAtoms[0].bonds[0]; + res.axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3().subVectors(bond._right.position, bond._left.position); + res.axis.normalize(); + res.axis.transformDirection(this._complexVisual.matrixWorld); } + } else if (boundAtoms.length === 2) { + // two bound atoms allow rotation only about axis running through their centers + res.axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3().subVectors(boundAtoms[1].position, boundAtoms[0].position); + res.axis.normalize(); + res.axis.transformDirection(this._complexVisual.matrixWorld); + } + return res; + } + _getSelectionBorderAtoms() { + const complex = this._complexVisual.getComplex(); + const selectionMask = 1 << this._complexVisual.getSelectionBit(); + const atomHash = {}; + complex.forEachBond(bond => { + if (bond._left.mask & selectionMask) { + if ((bond._right.mask & selectionMask) === 0) { + atomHash[bond._left.index] = 1; + } + } else if (bond._right.mask & selectionMask) { + atomHash[bond._right.index] = 1; + } + }); + const atoms = []; + const keys = Object.keys(atomHash); + for (let i = 0, n = keys.length; i < n; ++i) { + const idx = keys[i]; + atoms.push(complex._atoms[idx]); + } + return atoms; + } + _bakeAtomTransform(matrix, mask) { + this._complexVisual.getComplex().forEachAtom(atom => { + if (atom.mask & mask) { + atom.position.applyMatrix4(matrix); + } + }); + } +} +/* harmony default export */ const ComplexVisualEdit = ({ + ComponentEditor: ComplexComponentEditor, + FragmentEditor: ComplexFragmentEditor +}); +;// CONCATENATED MODULE: ./src/ComplexVisual.js - if (this.fogTransparent) { - defines.FOG_TRANSPARENT = 1; - } // set dependent values - this.defines = defines; - } - }]); - return AOVertBlurWithBlendMaterial; -}(RawShaderMaterial); -AOVertBlurWithBlendMaterial.prototype.useFog = true; -AOVertBlurWithBlendMaterial.prototype.fogTransparent = false; -var fragmentShader$6 = "precision highp float;\r\n\r\nuniform sampler2D srcL;\r\nuniform sampler2D srcR;\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vec4 l = texture2D(srcL, vUv);\r\n vec4 r = texture2D(srcR, vUv);\r\n gl_FragColor = vec4(l.r, r.g, r.b, 1.0);\r\n}\r\n"; -var AnaglyphMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) { - inherits(AnaglyphMaterial, _THREE$RawShaderMater); - function AnaglyphMaterial() { - var _this; - classCallCheck(this, AnaglyphMaterial); - _this = possibleConstructorReturn(this, getPrototypeOf(AnaglyphMaterial).call(this)); - var settings = { - uniforms: { - srcL: { - type: 't', - value: null - }, - srcR: { - type: 't', - value: null - } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentShader$6, - transparent: false, - depthTest: false, - depthWrite: false - }; - _this.setValues(settings); - return _this; - } - return AnaglyphMaterial; -}(RawShaderMaterial); -var View = /*#__PURE__*/function () { - function View() { - classCallCheck(this, View); - this.position = new Vector3(0, 0, 0); - this.scale = 1; - this.orientation = new Quaternion(0, 0, 0, 1); +const { + selectors: ComplexVisual_selectors +} = chem; +function lookupAndCreate(entityList, specs) { + if (!Array.isArray(specs)) { + specs = [specs]; } + const [id, opts] = specs; + const Entity = entityList.get(id) || entityList.first; + return new Entity(opts); +} +class ComplexVisual extends src_Visual { + constructor(name, dataSource) { + super(name, dataSource); + this._complex = dataSource; - createClass(View, [{ - key: "set", - value: function set(position, scale, orientation) { - this.position = position; - this.scale = scale; - this.orientation = orientation; + /** @type {Representation[]} */ + this._reprList = []; + /** @type {?Representation} */ + this._repr = null; + this._reprListChanged = true; + this._selectionBit = 0; + this._reprUsedBits = 0; + this._selectionCount = 0; + this._selectionGeometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group(); + } + getBoundaries() { + return this._complex.getBoundaries(); + } + release() { + if (this._selectionGeometry.parent) { + this._selectionGeometry.remove(this._selectionGeometry); + } + src_Visual.prototype.release.call(this); + } + getComplex() { + return this._complex; + } + getSelectionCount() { + return this._selectionCount; + } + getSelectionGeo() { + return this._selectionGeometry; + } + getSelectionBit() { + return this._selectionBit; + } + getEditor() { + return this._editor; + } + resetReps(reps) { + // Create all necessary representations + if (this._complex) { + this._complex.clearAtomBits(~0); + } + this._reprListChanged = true; + this._reprUsedBits = 0; + this._reprList.length = reps.length; + for (let i = 0, n = reps.length; i < n; ++i) { + const rep = reps[i]; + let selector; + let selectorString; + if (typeof rep.selector === 'string') { + selectorString = rep.selector; + ({ + selector + } = ComplexVisual_selectors.parse(selectorString)); + } else if (typeof rep.selector === 'undefined') { + selectorString = settings.now.presets.default[0].selector; + ({ + selector + } = ComplexVisual_selectors.parse(selectorString)); + } else { + ({ + selector + } = rep); + selectorString = selector.toString(); + } + const mode = lookupAndCreate(gfx_modes, rep.mode); + const colorer = lookupAndCreate(gfx_colorers, rep.colorer); + const material = gfx_materials.get(rep.material) || gfx_materials.first; + this._reprList[i] = new gfx_Representation(i, mode, colorer, selector); + this._reprList[i].setMaterialPreset(material); + this._reprList[i].selectorString = selectorString; + if (this._complex) { + this._complex.markAtoms(selector, 1 << i); + } + this._reprUsedBits |= 1 << i; } - }]); - - return View; -}(); - -var _transitionTime = 1.5; // in seconds + this._repr = reps.length > 0 ? this._reprList[0] : null; + this._selectionBit = reps.length; + this._reprUsedBits |= 1 << this._selectionBit; // selection uses one bit + this._selectionCount = 0; + if (this._complex) { + this._complex.update(); + } + } -var ViewInterpolator = /*#__PURE__*/function () { - function ViewInterpolator() { - classCallCheck(this, ViewInterpolator); + /** + * Get number of representations created so far. + * @returns {number} Number of reps. + */ + repCount() { + return this._reprList.length; } - createClass(ViewInterpolator, [{ - key: "setup", - value: function setup(startView, endView) { - this._startTime = undefined; - this._endTime = undefined; - this._isPaused = false; - this._srcView = startView; - this._dstView = endView; - this._isMoving = false; + /** + * Get or set the current representation index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. + * @returns {number} The current index. + */ + repCurrent(index) { + if (index >= 0 && index < this._reprList.length) { + this._repr = this._reprList[index]; + } else { + index = this._reprList.indexOf(this._repr); } - }, { - key: "isMoving", - value: function isMoving() { - return this._isMoving; + return index; + } + + /** + * Get or set representation by index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. + * @param {object=} rep - Optional representation description. + * @param {string=} rep.selector - Selector string. + * @param {string=} rep.mode - Mode id. + * @param {string=} rep.colorer - Colorer id. + * @param {string=} rep.material - Material id. + * @returns {Object} {desc, index, status} field desc contains rep description, index - index of correspondent rep, + * status - one of three strings: 'created', 'changed', ''. 'created' means new rep was created during this function, + * 'changed' - rep was changed during this function. '' - something else. + */ + rep(index, rep) { + // if index is missing then it is the current + if (!rep && (index === undefined || index instanceof Object)) { + rep = index; + index = this.repCurrent(); } - }, { - key: "wasStarted", - value: function wasStarted() { - return typeof this._startTime !== 'undefined' && typeof this._endTime !== 'undefined'; + + // fail if out of bounds + if (index < 0 || index > this._reprList.length) { + logger.error(`Rep ${index} does not exist!`); + return null; } - }, { - key: "start", - value: function start() { - this._startTime = Date.now(); - var transTime = settings.now.interpolateViews ? _transitionTime * 1000 : 0; - this._endTime = this._startTime + transTime; - this._isMoving = true; + + // a special case of adding just after the end + if (index === this._reprList.length) { + const res = this.repAdd(rep); + logger.warn(`Rep ${index} does not exist! New representation was created.`); + return { + desc: res.desc, + index, + status: 'created' + }; } - }, { - key: "getCurrentView", - value: function getCurrentView() { - if (typeof this._srcView === 'undefined' || typeof this._dstView === 'undefined' || !this._isMoving || !this.wasStarted()) { - return { - success: false - }; - } - var view = this.createView(); - var time = Date.now(); + // gather description + const target = this._reprList[index]; + const desc = { + selector: target.selectorString, + mode: target.mode.identify(), + colorer: target.colorer.identify(), + material: target.materialPreset.id + }; + + // modification is requested + if (rep) { + // modify + const diff = target.change(rep, this._complex, lookupAndCreate(gfx_modes, rep.mode), lookupAndCreate(gfx_colorers, rep.colorer)); + + // something was changed + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(diff)) { + target.needsRebuild = true; + for (const key in diff) { + if (diff.hasOwnProperty(key)) { + desc[key] = diff[key]; + logger.debug(`rep[${index}].${key} changed to ${diff[key]}`); + } + } - if (time > this._endTime) { - view = this._dstView; - this.reset(); + // safety trick: lower resolution for surface modes + if (diff.mode && target.mode.isSurface && (settings.now.resolution === 'ultra' || settings.now.resolution === 'high')) { + logger.report('Surface resolution was changed to "medium" to avoid hang-ups.'); + settings.set('resolution', 'medium'); + } return { - success: true, - view: view + desc, + index, + status: 'changed' }; } + } + return { + desc, + index, + status: '' + }; + } - var factor = (time - this._startTime) / (this._endTime - this._startTime); - view.position.copy(this._srcView.position); - view.position.lerp(this._dstView.position, factor); - view.scale = (1 - factor) * this._srcView.scale + factor * this._dstView.scale; - view.orientation.copy(this._srcView.orientation); - view.orientation.slerp(this._dstView.orientation, factor); - return { - success: true, - view: view - }; + /** + * Get representation (not just description) by index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. + * @returns {?object} Representation. + */ + repGet(index) { + // if index is missing then it is the current + if (index === undefined || index instanceof Object) { + index = this.repCurrent(); } - }, { - key: "reset", - value: function reset() { - this._startTime = this._endTime = 0; - this._isMoving = false; + + // fail if out of bounds + if (index < 0 || index >= this._reprList.length) { + return null; } - }, { - key: "pause", - value: function pause() { - if (!this._isPaused) { - this.setup(this.getCurrentView().view, this._dstView); - this._isPaused = true; + return this._reprList[index]; + } + _getFreeReprIdx() { + let bits = this._reprUsedBits; + for (let i = 0; i <= ComplexVisual.NUM_REPRESENTATION_BITS; ++i, bits >>= 1) { + if ((bits & 1) === 0) { + return i; } } - }, { - key: "resume", - value: function resume() { - this._isPaused = false; - } - }, { - key: "createView", - value: function createView() { - return new View(); - } - }]); - - return ViewInterpolator; -}(); - -var MAX_COOKIE_LEN = 4000; -var COUNT_SUFFIX = 'Cnt'; - -function _chunkString(string, chunkLen) { - var l = string.length; - var chunks = []; - - for (var c = 0, lc = 0; lc < l; c++, lc += chunkLen) { - chunks[c] = string.slice(lc, lc + chunkLen); + return -1; } - return chunks; -} -/** - * Create new context dependent Cookie holder object. - * @param context - * @param {Object} opts - options - * @param {string} opts.path - cookie path - * @constructor - */ - - -function Cookies(context, opts) { - this.context = context; - this._opts = _.merge({ - path: '/' - }, opts); -} - -makeContextDependent(Cookies.prototype); -/** - * Remove cookie by the name. - * @param key - */ - -Cookies.prototype.removeCookie = function (key) { - var cntKey = this._toCount(key); - - var cntVal = this._getSimpleCookie(cntKey); - - if (!cntVal) { - this._removeSimpleCookie(key); - - return; + /** + * Add new representation. + * @param {object=} rep - Representation description. + * @returns {Object} {desc, index} field desc contains added rep description, index - index of this rep. + */ + repAdd(rep) { + if (this._reprList.length >= ComplexVisual.NUM_REPRESENTATION_BITS) { + return null; + } + const newSelectionBit = this._getFreeReprIdx(); + if (newSelectionBit < 0) { + return null; // no more slots for representations + } + const originalSelection = this.buildSelectorFromMask(1 << this._selectionBit); + + // Fill in default values + const def = settings.now.presets.default[0]; + const desc = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge({ + selector: def.selector, + mode: def.mode, + colorer: def.colorer, + material: def.material + }, rep); + const selector = typeof desc.selector === 'string' ? ComplexVisual_selectors.parse(desc.selector).selector : desc.selector; + const target = new gfx_Representation(this._selectionBit, lookupAndCreate(gfx_modes, desc.mode), lookupAndCreate(gfx_colorers, desc.colorer), selector); + target.selectorString = selector.toString(); + target.setMaterialPreset(gfx_materials.get(desc.material)); + target.markAtoms(this._complex); + this._reprList.push(target); + + // change selection bit + this._selectionBit = newSelectionBit; + this._reprUsedBits |= 1 << this._selectionBit; + + // restore selection using new selection bit + this._complex.markAtoms(originalSelection, 1 << this._selectionBit); + return { + desc, + index: this._reprList.length - 1 + }; } - this._removeSimpleCookie(cntKey); + /** + * Remove representation. + * @param {number=} index - Zero-based representation index. + */ + repRemove(index) { + if (index === undefined) { + index = this.repCurrent(); + } - cntVal = parseInt(cntVal, 10); + // catch out of bounds case + let count = this._reprList.length; + if (index < 0 || index >= count || count <= 1) { + // do not allow to remove the single rep + return; + } + const target = this._reprList[index]; + target.unmarkAtoms(this._complex); + this._reprUsedBits &= ~(1 << target.index); + this._reprList.splice(index, 1); - for (var i = 0; i < cntVal; ++i) { - this._removeSimpleCookie(key + i); + // update current rep + if (target === this._repr) { + --count; + index = index < count ? index : count - 1; + this._repr = this._reprList[index]; + } + this._reprListChanged = true; } -}; -/** - * Set new cookie value. Automatically splits - * values that are too large into multiple cookies. - * @param key - * @param value - */ - - -Cookies.prototype.setCookie = function (key, value) { - this.removeCookie(key); - value = encodeURIComponent(value); - var values = _chunkString(value, MAX_COOKIE_LEN - key.length - 1); + /** + * Hide representation. + * @param {number} index - Zero-based representation index. + * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default). + */ + repHide(index, hide) { + if (hide === undefined) { + hide = true; + } - var cntVal = values.length; + // fail if out of bounds + if (index < 0 || index >= this._reprList.length) { + return; + } + const target = this._reprList[index]; + target.show(!hide); + } - if (cntVal === 1) { - this._setSimpleCookie(key, value); + /** + * Select atoms with selector + * @param {Selector} selector - selector + * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection + */ + select(selector, append) { + if (append) { + this._selectionCount += this._complex.markAtomsAdditionally(selector, 1 << this._selectionBit); + } else { + this._selectionCount = this._complex.markAtoms(selector, 1 << this._selectionBit); + } + this._complex.updateStructuresMask(); + this.rebuildSelectionGeometry(); + } + resetSelectionMask() { + if (this._selectionCount !== 0) { + this._selectionCount = 0; + if (this._complex) { + this._complex.clearAtomBits(1 << this._selectionBit); + } + } + } + updateSelectionMask(pickedObj) { + const self = this; + const { + atom + } = pickedObj; + let { + residue, + chain, + molecule + } = pickedObj; + const setMask = 1 << this._selectionBit; + const clearMask = ~setMask; + if (atom) { + residue = atom.residue; + chain = residue._chain; + molecule = residue._molecule; + if (atom.mask & setMask) { + atom.mask &= clearMask; + residue._mask &= clearMask; + chain._mask &= clearMask; + if (molecule) { + molecule.mask &= clearMask; + } + this._selectionCount--; + } else { + atom.mask |= setMask; + this._selectionCount++; + + // select residue if all atoms in it are selected + residue.collectMask(); + // select chain and molecule if all residues in it are selected + chain.collectMask(); + if (molecule) { + molecule.collectMask(); + } + } + } else if (residue) { + chain = residue._chain; + molecule = residue._molecule; + if (residue._mask & setMask) { + residue._mask &= clearMask; + chain._mask &= clearMask; + residue.forEachAtom(a => { + if (a.mask & setMask) { + a.mask &= clearMask; + self._selectionCount--; + } + }); + } else { + residue._mask |= setMask; + residue.forEachAtom(a => { + if (!(a.mask & setMask)) { + a.mask |= setMask; + self._selectionCount++; + } + }); - return; + // select chain and molecule if all residues in it are selected + chain.collectMask(); + if (molecule) { + molecule.collectMask(); + } + } + } else if (chain || molecule) { + const obj = chain || molecule; + if (obj._mask & setMask) { + obj._mask &= clearMask; + obj.forEachResidue(r => { + if (r._mask & setMask) { + r._mask &= clearMask; + r.forEachAtom(a => { + if (a.mask & setMask) { + a.mask &= clearMask; + self._selectionCount--; + } + }); + r._mask &= clearMask; + } + }); + } else { + obj._mask |= setMask; + obj.forEachResidue(r => { + if (!(r._mask & setMask)) { + r._mask |= setMask; + r.forEachAtom(a => { + if (!(a.mask & setMask)) { + a.mask |= setMask; + self._selectionCount++; + } + }); + const otherObj = chain ? r.getMolecule() : r.getChain(); + if (otherObj) { + otherObj.collectMask(); + } + } + }); + } + } else { + this.resetSelectionMask(); + } } + expandSelection() { + const self = this; + const selectionMask = 1 << this._selectionBit; + const tmpMask = 1 << 31; - var cntKey = this._toCount(key); - - this._setSimpleCookie(cntKey, cntVal.toString()); + // mark atoms to add + this._complex.forEachBond(bond => { + if (bond._left.mask & selectionMask) { + if ((bond._right.mask & selectionMask) === 0) { + bond._right.mask |= tmpMask; + } + } else if (bond._right.mask & selectionMask) { + bond._left.mask |= tmpMask; + } + }); - for (var i = 0; i < cntVal; ++i) { - this._setSimpleCookie(key + i, values[i]); + // select marked atoms + const deselectionMask = ~tmpMask; + this._complex.forEachAtom(atom => { + if (atom.mask & tmpMask) { + atom.mask = atom.mask & deselectionMask | selectionMask; + ++self._selectionCount; + } + }); + this._complex.updateStructuresMask(); } -}; -/** - * Obtain the value of a compound cookie. - * @param key - */ - + shrinkSelection() { + const self = this; + const selectionMask = 1 << this._selectionBit; + const tmpMask = 1 << 31; -Cookies.prototype.getCookie = function (key) { - var cntKey = this._toCount(key); + // mark atoms neighbouring to unselected ones + this._complex.forEachBond(bond => { + if (bond._left.mask & selectionMask) { + if ((bond._right.mask & selectionMask) === 0) { + bond._left.mask |= tmpMask; + } + } else if (bond._right.mask & selectionMask) { + bond._right.mask |= tmpMask; + } + }); - var cntVal = this._getSimpleCookie(cntKey); + // mark hanging atoms + this._complex.forEachAtom(atom => { + if (atom.mask & selectionMask && atom.bonds.length === 1) { + atom.mask |= tmpMask; + } + }); - if (!cntVal) { - return this._getSimpleCookie(key); + // deselect marked atoms + const deselectionMask = ~(selectionMask | tmpMask); + this._complex.forEachAtom(atom => { + if (atom.mask & tmpMask) { + atom.mask &= deselectionMask; + --self._selectionCount; + } + }); + this._complex.updateStructuresMask(); } + getSelectedComponent() { + const selectionMask = 1 << this._selectionBit; + let component = null; + let multiple = false; - cntVal = parseInt(cntVal, 10); - var value = []; + // find which component is selected (exclusively) + this._complex.forEachAtom(atom => { + if (atom.mask & selectionMask) { + if (component === null) { + component = atom.residue._component; + } else if (component !== atom.residue._component) { + multiple = true; + } + } + }); + return multiple ? null : component; + } + getSelectionCenter(center, includesAtom, selRule) { + center.set(0.0, 0.0, 0.0); + let count = 0; + this._complex.forEachAtom(atom => { + if (includesAtom(atom, selRule)) { + center.add(atom.position); + count++; + } + }); + if (count === 0) { + return false; + } + center.divideScalar(count); + center.applyMatrix4(this.matrix); + return true; + } + needsRebuild() { + if (this._reprListChanged) { + return true; + } + const reprList = this._reprList; + for (let i = 0, n = reprList.length; i < n; ++i) { + const repr = reprList[i]; + if (repr.needsRebuild) { + return true; + } + } + return false; + } - for (var i = 0; i < cntVal; ++i) { - value[i] = this._getSimpleCookie(key + i); + /** + * Rebuild molecule geometry asynchronously. + */ + rebuild() { + const self = this; + + // Destroy current geometry + gfxutils.clearTree(this); + return new Promise(resolve => { + // Nothing to do? + const complex = self._complex; + if (!complex) { + resolve(); + return; + } + let errorOccured = false; + setTimeout(() => { + console.time('build'); + const reprList = self._reprList; + const palette = gfx_palettes.get(settings.now.palette) || gfx_palettes.first; + let hasGeometry = false; + for (let i = 0, n = reprList.length; i < n; ++i) { + const repr = reprList[i]; + repr.colorer.palette = palette; + if (repr.needsRebuild) { + repr.reset(); + try { + repr.buildGeometry(complex); + } catch (e) { + if (e instanceof utils.OutOfMemoryError) { + repr.needsRebuild = false; + repr.reset(); + logger.error(`Not enough memory to build geometry for representation ${repr.index + 1}`); + errorOccured = true; + } else { + throw e; + } + } + if (false) {} + } + hasGeometry = errorOccured || hasGeometry || gfxutils.groupHasGeometryToRender(repr.geo); + if (repr.geo) { + self.add(repr.geo); + } + } + self._reprListChanged = false; + console.timeEnd('build'); + resolve(); + }, 10); + }); + } + setNeedsRebuild() { + // invalidate all representations + const reprList = this._reprList; + for (let i = 0, n = reprList.length; i < n; ++i) { + reprList[i].needsRebuild = true; + } + } + rebuildSelectionGeometry() { + const mask = 1 << this._selectionBit; + gfxutils.clearTree(this._selectionGeometry); + for (let i = 0, n = this._reprList.length; i < n; ++i) { + const repr = this._reprList[i]; + const sg = repr.buildSelectionGeometry(mask); + if (!sg) { + continue; + } + this._selectionGeometry.add(sg); + for (let j = 0; j < sg.children.length; j++) { + const m = sg.children[j]; + + // copy component transform (that's not applied yet) + // TODO make this code obsolete, accessing editor is bad + if (this._editor && this._editor._componentTransforms) { + const t = this._editor._componentTransforms[m._component._index]; + if (t) { + m.position.copy(t.position); + m.quaternion.copy(t.quaternion); + } + } + } + gfxutils.applySelectionMaterial(sg); + } + } + _buildSelectorFromSortedLists(atoms, residues, chains) { + const complex = this._complex; + function optimizeList(list) { + const result = []; + let k = 0; + let first = NaN; + let last = NaN; + for (let i = 0, n = list.length; i < n; ++i) { + const value = list[i]; + if (value === last + 1) { + last = value; + } else { + if (!Number.isNaN(first)) { + result[k++] = new ComplexVisual_selectors.Range(first, last); + } + first = last = value; + } + } + if (!Number.isNaN(first)) { + result[k] = new ComplexVisual_selectors.Range(first, last); + } + return result; + } + let expression = null; + if (chains.length === complex._chains.length) { + expression = ComplexVisual_selectors.all(); + } else { + let selector; + if (chains.length > 0) { + selector = ComplexVisual_selectors.chain(chains); + expression = expression ? ComplexVisual_selectors.or(expression, selector) : selector; // NOSONAR + } + if (Object.keys(residues).length > 0) { + for (const ch in residues) { + if (residues.hasOwnProperty(ch)) { + selector = ComplexVisual_selectors.and(ComplexVisual_selectors.chain(ch), ComplexVisual_selectors.residx(optimizeList(residues[ch]))); + expression = expression ? ComplexVisual_selectors.or(expression, selector) : selector; + } + } + } + if (atoms.length > 0) { + selector = ComplexVisual_selectors.serial(optimizeList(atoms)); + expression = expression ? ComplexVisual_selectors.or(expression, selector) : selector; + } + if (!expression) { + expression = ComplexVisual_selectors.none(); + } + } + return expression; + } + buildSelectorFromMask(mask) { + const complex = this._complex; + const chains = []; + const residues = {}; + const atoms = []; + complex.forEachChain(chain => { + if (chain._mask & mask) { + chains.push(chain._name); + } + }); + complex.forEachResidue(residue => { + if (residue._mask & mask && !(residue._chain._mask & mask)) { + const c = residue._chain._name; + if (!(c in residues)) { + residues[c] = [residue._index]; + } else { + residues[c].push(residue._index); + } + } + }); + complex.forEachAtom(atom => { + if (atom.mask & mask && !(atom.residue._mask & mask)) { + atoms.push(atom.serial); + } + }); + return this._buildSelectorFromSortedLists(atoms, residues, chains); + } + forSelectedResidues(process) { + const selectionMask = 1 << this._selectionBit; + this._complex.forEachResidue(residue => { + if (residue._mask & selectionMask) { + process(residue); + } + }); + } + beginComponentEdit() { + if (this._editor) { + return null; + } + const editor = new ComplexVisualEdit.ComponentEditor(this); + if (!editor.begin()) { + return null; + } + this._editor = editor; + return editor; + } + beginFragmentEdit() { + if (this._editor) { + return null; + } + const editor = new ComplexVisualEdit.FragmentEditor(this); + if (!editor.begin()) { + return null; + } + this._editor = editor; + return editor; + } + + // should only be called by editors + finalizeEdit() { + this._editor = null; + } + setMaterialValues(values) { + let needTraverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + let process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + for (let i = 0, n = this._reprList.length; i < n; ++i) { + const rep = this._reprList[i]; + rep.material.setValues(values); + if (needTraverse) { + rep.geo.traverse(object => { + if (object instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh) { + object.material.setValues(values); + if (process !== undefined) { + process(object); + } + object.material.needsUpdate = true; + } + }); + } + } + } + setUberOptions(values) { + for (let i = 0, n = this._reprList.length; i < n; ++i) { + const rep = this._reprList[i]; + rep.material.setUberOptions(values); + } } - return value.join(''); -}; + /** + * Build selector that contains all atoms within given distance from group of atoms + * @param {Selector} selector - selector describing source group of atoms + * @param {number} radius - distance + * @returns {Selector} selector describing result group of atoms + */ + within(selector, radius) { + const vw = this._complex.getVoxelWorld(); + if (vw === null) { + return false; + } -Cookies.prototype._toCount = function (key) { - return key + COUNT_SUFFIX; -}; + // mark atoms of the group as selected + const selectionMask = 1 << this._selectionBit; + this._complex.markAtoms(selector, selectionMask); -Cookies.prototype._removeSimpleCookie = function (key) { - document.cookie = "".concat(key, "=; expires=Thu, 01 Jan 1970 00:00:01 GMT;"); -}; + // mark all atoms within distance as selected + if (vw) { + vw.forEachAtomWithinDistFromMasked(this._complex, selectionMask, Number(radius), atom => { + atom.mask |= selectionMask; + }); + } -Cookies.prototype._getExpirationDate = function () { - var today = new Date(); - var EXP_PERIOD_YEARS = 10; - today.setFullYear(today.getFullYear() + EXP_PERIOD_YEARS); - return today; -}; + // update selection count + this._selectionCount = this._complex.countAtomsByMask(selectionMask); -Cookies.prototype._setSimpleCookie = function (key, value) { - document.cookie = "".concat(key, "=").concat(value, ";expires=").concat(this._getExpirationDate().toUTCString(), ";path=").concat(this._opts.path); -}; + // update secondary structure mask + this._complex.updateStructuresMask(); + return this.buildSelectorFromMask(selectionMask); + } +} +// 32 bits = 30 bits for reps + 1 for selection + 1 for selection expansion +ComplexVisual.NUM_REPRESENTATION_BITS = 30; +/* harmony default export */ const src_ComplexVisual = (ComplexVisual); +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeFaces.vert +const VolumeFaces_namespaceObject = "varying vec3 pos;\r\n\r\nvoid main() {\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n pos = position.xyz + 0.5;\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n}"; +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeFaces.frag +const gfx_shaders_VolumeFaces_namespaceObject = "varying vec3 pos;\r\n\r\nvoid main() {\r\n gl_FragColor = vec4(pos, 0.5);\r\n}"; +;// CONCATENATED MODULE: ./src/gfx/shaders/Volume.vert +const shaders_Volume_namespaceObject = "varying vec4 screenSpacePos;\r\n\r\nvoid main() {\r\n screenSpacePos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n gl_Position = screenSpacePos;\r\n}"; +;// CONCATENATED MODULE: ./src/gfx/shaders/Volume.frag +const src_gfx_shaders_Volume_namespaceObject = "uniform mat4 projectionMatrix;\r\n\r\n// 3D volume texture\r\nuniform vec3 volumeDim; // volume dimensions, pixels\r\nuniform sampler2D tileTex; // tiled texture containing all Z-slices of a 3D data\r\nuniform vec2 tileTexSize; // size of tiled texture, pixels\r\nuniform vec2 tileStride; // UV stride between slices in tile tex, pixels\r\n\r\nuniform vec3 boxAngles;//value of angles({x: alpha, y:beta, z:gamma}) types 1 - if angle is obtuse, 0 - if acute\r\nuniform vec3 delta; //Projection box delta's from non-orthogonal origin axes; {x: XY, y : XZ, z: YZ}\r\n\r\nuniform vec3 _isoLevel0;\r\nuniform float _flipV;\r\nuniform sampler2D _BFLeft;\r\nuniform sampler2D _BFRight;\r\nuniform sampler2D _FFLeft;\r\nuniform sampler2D _FFRight;\r\nuniform sampler2D _WFFLeft;\r\nuniform sampler2D _WFFRight;\r\n\r\nvarying vec4 screenSpacePos;\r\n\r\n#define NO_COLOR vec4(0., 0., 0., 0.)\r\n\r\nvec4 sample3DTexture(vec3 texCoord) {\r\n // a pair of Z slices is determined by nearest slice border\r\n float zSliceBorder = floor(texCoord.z * volumeDim.z + 0.5);\r\n float zSliceNumber1 = max(zSliceBorder - 1.0, 0.0);\r\n float zSliceNumber2 = min(zSliceBorder, volumeDim.z - 1.0);\r\n\r\n float rowTiles = floor(tileTexSize.x / tileStride.x);\r\n\r\n // calculate coords in tile texture for both slices\r\n vec2 tileOffset = vec2(mod(zSliceNumber1, rowTiles), floor(zSliceNumber1 / rowTiles));\r\n vec2 texCoordSlice1 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n tileOffset = vec2(mod(zSliceNumber2, rowTiles), floor(zSliceNumber2 / rowTiles));\r\n vec2 texCoordSlice2 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r\n\r\n // bilinear filtering\r\n vec4 colorSlice1 = texture2D(tileTex, texCoordSlice1);\r\n vec4 colorSlice2 = texture2D(tileTex, texCoordSlice2);\r\n float weightSlice2 = texCoord.z * volumeDim.z - (zSliceNumber1 + 0.5);\r\n return mix(colorSlice1, colorSlice2, weightSlice2);\r\n}\r\n\r\nvec4 sample3DTextureInclined(vec3 boxCoord) { // delta:{ x: XY, y : XZ, z: YZ }\r\n vec3 textCoord = boxCoord;\r\n vec2 currDelta = mix(boxCoord.zz, vec2(1., 1.) - boxCoord.zz, boxAngles.yx) * delta.yz;\r\n\r\n textCoord.y = (boxCoord.y - currDelta.y) / (1. - delta.z);\r\n if (textCoord.y < 0.0 || textCoord.y > 1.0)\r\n return NO_COLOR;\r\n\r\n currDelta.x += mix(textCoord.y, 1.0 - textCoord.y, boxAngles.z) * delta.x;\r\n\r\n textCoord.x = (boxCoord.x - currDelta.x) / (1. - delta.x - delta.y);\r\n if (textCoord.x < 0.0 || textCoord.x > 1.0)\r\n return NO_COLOR;\r\n\r\n return sample3DTexture(textCoord);\r\n}\r\n\r\nfloat CalcColor(vec3 iter, vec3 dir) {\r\n float d = 1. / 128.;\r\n vec3 dx = vec3(d, 0.0, 0.0);\r\n vec3 dy = vec3(0.0, d, 0.0);\r\n vec3 dz = vec3(0.0, 0.0, d);\r\n\r\n // #Opt: coordInc.x:(iter + dx).x > 1. ? 0.: sample3DTextureInclined(iter + dx).x,\r\n vec3 coordInc = mix(\r\n vec3(\r\n sample3DTextureInclined(iter + dx).x,\r\n sample3DTextureInclined(iter + dy).x,\r\n sample3DTextureInclined(iter + dz).x\r\n ),\r\n vec3(0. ,0. , 0.),\r\n vec3(floor((iter + dx).x), floor((iter + dy).y), floor((iter + dz).z))\r\n );\r\n\r\n // #Opt: coordDec.x:(iter - dx).x < 0. ? 0.: sample3DTextureInclined(iter - dx).x,\r\n vec3 coordDec = mix(\r\n vec3(0. ,0. , 0.),\r\n vec3(\r\n sample3DTextureInclined(iter - dx).x,\r\n sample3DTextureInclined(iter - dy).x,\r\n sample3DTextureInclined(iter - dz).x\r\n ),\r\n vec3(ceil((iter - dx).x), ceil((iter - dy).y), ceil((iter - dz).z))\r\n );\r\n\r\n vec3 N = normalize(coordInc - coordDec);\r\n float dif = max(0.0, dot(N, dir));\r\n return dif;\r\n}\r\n\r\nvec3 AccuracyIso(vec3 left, vec3 right, float volLeft, float threshold) {\r\n for (int i = 0; i < 5; i++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if ((volLeft - threshold) * (vol - threshold) < 0.)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec3 CorrectIso(vec3 left, vec3 right, float tr) {\r\n for (int j = 0; j < 5; j++) {\r\n vec3 iterator = 0.5 * (left + right);\r\n float vol = sample3DTextureInclined(iterator).r;\r\n if (vol < tr)\r\n right = iterator;\r\n else\r\n left = iterator;\r\n }\r\n return 0.5 * (left + right);\r\n}\r\n\r\nvec4 GetIso1(vec3 start, vec3 back, float molDist, vec3 dir, float tr, int count) {\r\n float vol, stepSize = (float(count) + 2.) / float(STEPS_COUNT);\r\n vec3 step = stepSize * dir, iterator = start, left, right;\r\n vec4 acc = NO_COLOR;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n vol = sample3DTextureInclined(iterator).r;\r\n if (length(iterator - back) <= stepSize || (vol > tr))\r\n break;\r\n }\r\n\r\n if (vol > tr)\r\n acc = vec4(CorrectIso(iterator, iterator - step, tr).xyz, 1.);\r\n\r\n return acc;\r\n}\r\n\r\nfloat easeOut(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return 1.0 - (1.0 - t) * (1.0 - t);\r\n}\r\n\r\nfloat easeIn(float x0, float x1, float x) {\r\n float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r\n return t * t;\r\n}\r\n\r\nvec3 GetColSimple(float vol) {\r\n float t = easeOut(_isoLevel0.x, _isoLevel0.y, vol);\r\n float s = easeIn(_isoLevel0.y, _isoLevel0.z, vol);\r\n return vec3(0.5, 0.6, 0.7) * (1.0 - t) + 2.0 * vec3(s, 0, 0);\r\n}\r\n\r\nvec4 VolRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 acc = NO_COLOR, iso;\r\n vec3 iterator = start, sumColor = vec3(0., 0., 0.);\r\n float stepSize, alpha, sumAlpha = 0.0, vol, curStepSize, molD;\r\n vec3 step, col, colOld, right;\r\n float tr0 = _isoLevel0.x;\r\n float dif, r, kd, finish;\r\n int count = 0, stopMol = 0;\r\n\r\n for (int k = 0; k < 3; k++) {\r\n stepSize = (float(k) + 2.) / float(STEPS_COUNT);\r\n kd = 140. * tr0 * stepSize;\r\n r = 1. - kd;\r\n step = stepSize * dir;\r\n iso = GetIso1(iterator, back, molDist, dir, tr0, k);\r\n if (iso.a < 0.1 || length(iso.xyz - start) > molDist)\r\n break;\r\n iterator = iso.xyz;\r\n dif = 1.;// CalcColor(iterator, dir);\r\n colOld = GetColSimple(tr0);\r\n curStepSize = stepSize;\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n iterator = iterator + step;\r\n molD = length(iterator - start);\r\n vol = sample3DTextureInclined(iterator).r;\r\n finish = distance(iterator, back) - stepSize;\r\n if (finish < 0.0 || vol < tr0 || (sumAlpha > 0.97) || molD > molDist)\r\n break;\r\n alpha = (1. - r);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4.* colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n colOld = col;\r\n } // for i\r\n\r\n if (finish < 0.0 || sumAlpha > 0.97)\r\n break;\r\n\r\n if (molD > molDist) {\r\n curStepSize = stepSize - (molD - molDist);\r\n right = iterator - (molD - molDist) * dir;\r\n vol = sample3DTextureInclined(right).r;\r\n } else {\r\n vec3 left = iterator - step;\r\n right = CorrectIso(left, iterator, tr0);\r\n curStepSize = distance(left, right);\r\n vol = tr0;\r\n }\r\n\r\n alpha = (1. - r) * curStepSize / stepSize;\r\n dif = 1.;// CalcColor(right, dir);\r\n col = GetColSimple(vol);\r\n vol = sample3DTextureInclined(iterator - 0.5 * curStepSize / stepSize * step).r;\r\n vec3 colMid = GetColSimple(vol);\r\n sumColor += (1. - sumAlpha) * (colOld + 4. * colMid + col) * alpha / 6.;\r\n sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r\n\r\n if (molD > molDist)\r\n break;\r\n } // for k\r\n acc.rgb = 1. * sumColor / sumAlpha;\r\n acc.a = sumAlpha;\r\n return acc;\r\n}\r\n\r\nvec4 VolRender1(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n float stepSize = 1.0 / float(STEPS_COUNT);\r\n float len = length(back - start);\r\n vec3 step = stepSize * dir;\r\n vec3 iterator = start;\r\n float acc = 0.0;\r\n\r\n for (int i = 0; i < STEPS_COUNT; i++) {\r\n if (float(i) * stepSize > len)\r\n break;\r\n iterator = iterator + step;\r\n if (sample3DTextureInclined(iterator).r > _isoLevel0.x)\r\n acc += 10. * sample3DTextureInclined(iterator).r / float(STEPS_COUNT);\r\n }\r\n\r\n return vec4(1.,1.,1., acc);\r\n}\r\n\r\nvec4 IsoRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n vec4 tst = GetIso1(start, back, 2., dir, _isoLevel0.x, 0);\r\n vec4 col = NO_COLOR;\r\n\r\n if (length(tst.xyz - start) < molDist && tst.a > 0.1) {\r\n float dif = CalcColor(tst.xyz, dir);\r\n dif = 0.9 * dif * dif;\r\n col = vec4(dif, dif, dif, 1);\r\n }\r\n return col;\r\n}\r\n\r\nvec4 VolRender2(vec3 start, vec3 back, float molDist, vec3 dir) {\r\n return sample3DTexture(start);\r\n}\r\n\r\nvoid main() {\r\n vec3 tc = screenSpacePos.xyz / screenSpacePos.w * 0.5 + 0.5;\r\n\r\n if (_flipV > 0.0) {\r\n tc.y = 1.0 - tc.y;\r\n }\r\n\r\n vec3 start;\r\n vec3 back;\r\n vec3 molBack;\r\n if (projectionMatrix[0][2] < 0.0) {\r\n start = texture2D(_FFLeft, tc.xy).xyz;\r\n back = texture2D(_BFLeft, tc.xy).xyz;\r\n molBack = texture2D(_WFFLeft, tc.xy).xyz;\r\n } else {\r\n start = texture2D(_FFRight, tc.xy).xyz;\r\n back = texture2D(_BFRight, tc.xy).xyz;\r\n molBack = texture2D(_WFFRight, tc.xy).xyz;\r\n }\r\n\r\n vec3 dir = normalize(back - start);\r\n\r\n float molDist = 2.0;\r\n if (length(molBack) > 0.001) {\r\n molDist = distance(start, molBack);\r\n }\r\n\r\n #ifdef ISO_MODE\r\n gl_FragColor = IsoRender(start, back, molDist, dir);\r\n #else\r\n gl_FragColor = VolRender(start, back, molDist, dir);\r\n #endif\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeFarPlane.vert +const VolumeFarPlane_namespaceObject = "varying vec4 volPos;\r\nuniform float aspectRatio;\r\nuniform float farZ;\r\nuniform float tanHalfFOV;\r\nuniform mat4 matWorld2Volume;\r\n\r\nvoid main() {\r\n // rescale plane to fill in the whole far plane area seen from camera\r\n vec3 pos = position.xyz;\r\n pos.x = pos.x * tanHalfFOV * farZ * aspectRatio;\r\n pos.y = pos.y * tanHalfFOV * farZ;\r\n // common transformation\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\r\n // calc pos in volume CS\r\n volPos = matWorld2Volume * modelMatrix * vec4(pos, 1.0);\r\n // we're assuming local position is in [-0.5, 0.5]\r\n // we need to offset it to be represented in RGB\r\n volPos = volPos + 0.5;\r\n volPos.w = 0.5;\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeFarPlane.frag +const gfx_shaders_VolumeFarPlane_namespaceObject = "varying vec4 volPos;\r\n\r\nvoid main() {\r\n gl_FragColor = volPos;\r\n}"; +;// CONCATENATED MODULE: ./src/gfx/shaders/VolumeMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ -Cookies.prototype._getSimpleCookie = function (key) { - var matches = document.cookie.match(new RegExp("(?:^|; )".concat(key, "=([^;]*)"))); - return matches ? decodeURIComponent(matches[1]) : ''; -}; -Cookies.prototype._exists = function (key) { - return document.cookie.match(new RegExp("(?:^|; )".concat(key, "=([^;]*)"))); -}; -/* - * Toggling WebVR is done through button.click because of limitations on calling requestPresent in webVR: - * VRDisplay::requestPresent should be called from user gesture: - * https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestPresent - */ -function createWebVRButton (webVRPoC) { - function showEnterVR(button) { - button.style.display = ''; - button.style.cursor = 'pointer'; - button.style.left = 'calc(50% - 50px)'; - button.style.width = '100px'; - button.textContent = 'ENTER VR'; - var currentSession = null; - function onSessionEnded() - /* event */ - { - currentSession.removeEventListener('end', onSessionEnded); - button.textContent = 'ENTER VR'; - currentSession = null; - } - function onSessionStarted(session) { - session.addEventListener('end', onSessionEnded); - webVRPoC._gfx.renderer.xr.setReferenceSpaceType('local'); - webVRPoC._gfx.renderer.xr.setSession(session); - button.textContent = 'EXIT VR'; - currentSession = session; +const volumeUniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UniformsUtils.merge([{ + volumeDim: { + type: 'v3', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(512, 512, 512) + }, + tileTex: { + type: 't', + value: null + }, + tileTexSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(512, 512) + }, + tileStride: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(512, 512) + }, + boxAngles: { + type: 'v3', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1, 1, 1) + }, + delta: { + type: 'v3', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0) + }, + _isoLevel0: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.5, 0.75, 1.0) + }, + _flipV: { + type: 'f', + value: 0.0 + }, + _BFLeft: { + type: 't', + value: null + }, + _BFRight: { + type: 't', + value: null + }, + _FFLeft: { + type: 't', + value: null + }, + _FFRight: { + type: 't', + value: null + }, + _WFFLeft: { + type: 't', + value: null + }, + _WFFRight: { + type: 't', + value: null + } +}]); +function overrideUniforms(params, defUniforms) { + const uniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UniformsUtils.clone(defUniforms); + for (const p in params) { + if (uniforms.hasOwnProperty(p)) { + uniforms[p].value = params[p]; } - - button.onmouseenter = function () { - button.style.opacity = '1.0'; - }; - - button.onmouseleave = function () { - button.style.opacity = '0.5'; - }; - - button.onclick = function () { - if (currentSession === null) { - // WebXR's requestReferenceSpace only works if the corresponding feature - // was requested at session creation time. For simplicity, just ask for - // the interesting ones as optional features, but be aware that the - // requestReferenceSpace call will fail if it turns out to be unavailable. - // ('local' is always available for immersive sessions and doesn't need to - // be requested separately.) - var sessionInit = { - optionalFeatures: ['local-floor', 'bounded-floor'] - }; - navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted); - webVRPoC.moveSceneBehindHeadset(); - } else { - currentSession.end(); - } - }; } - - function showWebXRNotFound(button) { - button.style.display = ''; - button.style.cursor = 'auto'; - button.style.left = 'calc(50% - 75px)'; - button.style.width = '150px'; - button.textContent = 'VR NOT FOUND'; - button.onmouseenter = null; - button.onmouseleave = null; - button.onclick = null; + return uniforms; +} +function facesPosMaterialParams(params, sideType) { + return { + uniforms: overrideUniforms(params, {}), + vertexShader: VolumeFaces_namespaceObject, + fragmentShader: gfx_shaders_VolumeFaces_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false, + side: sideType + }; +} +class BackFacePosMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.ShaderMaterial { + constructor(params) { + const backFaceParams = facesPosMaterialParams(params, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BackSide); + super(backFaceParams); + } +} +class ShaderParams { + constructor(params, uniforms, vertexShader, fragmentShader) { + this.uniforms = overrideUniforms(params, uniforms); + this.vertexShader = vertexShader; + this.fragmentShader = fragmentShader; + this.transparent = false; + this.depthTest = false; + this.depthWrite = false; + this.side = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.FrontSide; } - - function stylizeElement(element) { - element.style.position = 'absolute'; - element.style.bottom = '20px'; - element.style.padding = '12px 6px'; - element.style.border = '1px solid #fff'; - element.style.borderRadius = '4px'; - element.style.background = 'transparent'; - element.style.color = '#fff'; - element.style.font = 'normal 13px sans-serif'; - element.style.textAlign = 'center'; - element.style.opacity = '0.5'; - element.style.outline = 'none'; - element.style.zIndex = '999'; +} +class BackFacePosMaterialFarPlane extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.ShaderMaterial { + constructor(params) { + const matUniforms = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UniformsUtils.merge([{ + aspectRatio: { + type: 'f', + value: 0.0 + }, + farZ: { + type: 'f', + value: 0.0 + }, + tanHalfFOV: { + type: 'f', + value: 0.0 + }, + matWorld2Volume: { + type: '4fv', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4() + } + }]); + const shaderParams = new ShaderParams(params, matUniforms, VolumeFarPlane_namespaceObject, gfx_shaders_VolumeFarPlane_namespaceObject); + super(shaderParams); } - - if ('xr' in navigator) { - var button = document.createElement('button'); - button.style.display = 'none'; - stylizeElement(button); - navigator.xr.isSessionSupported('immersive-vr').then(function (supported) { - return supported ? showEnterVR(button) : showWebXRNotFound(button); - }); - return button; +} +class FrontFacePosMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.ShaderMaterial { + constructor(params) { + const frontFaceParams = facesPosMaterialParams(params, external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.FrontSide); + super(frontFaceParams); } - - var message = document.createElement('a'); - message.href = 'https://webvr.info'; - message.innerHTML = 'WEBXR NOT SUPPORTED'; - message.style.left = 'calc(50% - 90px)'; - message.style.width = '180px'; - message.style.textDecoration = 'none'; - stylizeElement(message); - return message; } - -var WebVRPoC = /*#__PURE__*/function () { - function WebVRPoC(onToggle) { - classCallCheck(this, WebVRPoC); - - this._mainCamera = new PerspectiveCamera(); - this._button = null; - this._onToggle = onToggle; - this._molContainer = new gfxutils.RCGroup(); - this._user = new gfxutils.RCGroup(); - this._scalingPivot = new Object3D(); - - this._user.add(this._scalingPivot); - - this._controller1 = null; - this._controller2 = null; - this._pressedGripsCounter = 0; - this._distance = 0; - this._gfx = null; +class VolumeMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.ShaderMaterial { + constructor(params) { + const shaderParams = new ShaderParams(params, volumeUniforms, shaders_Volume_namespaceObject, src_gfx_shaders_Volume_namespaceObject); + shaderParams.transparent = true; + shaderParams.depthTest = true; + super(shaderParams); + this.updateDefines(); } + updateDefines() { + this.defines = { + ISO_MODE: settings.now.modes.VD.isoMode, + STEPS_COUNT: settings.now.modes.VD.polyComplexity[settings.now.resolution] * 100 + }; + this.needsUpdate = true; + } +} +/* harmony default export */ const shaders_VolumeMaterial = ({ + BackFacePosMaterial, + BackFacePosMaterialFarPlane, + FrontFacePosMaterial, + VolumeMaterial +}); +;// CONCATENATED MODULE: ./src/gfx/VolumeMesh.js - createClass(WebVRPoC, [{ - key: "startScalingByControllers", - value: function startScalingByControllers() { - // reset scale - this._distance = this._controller1.position.distanceTo(this._controller2.position); - gfxutils.getMiddlePoint(this._controller1.position, this._controller2.position, this._scalingPivot.position); - - this._scalingPivot.scale.set(1, 1, 1); - - this._scalingPivot.updateMatrix(); - - this._scalingPivot.updateMatrixWorld(); // link molecule to pivot - this._scalingPivot.addSavingWorldTransform(this._molContainer); - } - }, { - key: "stopScalingByControllers", - value: function stopScalingByControllers() { - this._gfx.scene.addSavingWorldTransform(this._molContainer); - } - }, { - key: "handleGripsDown", - value: function handleGripsDown(event) { - this._pressedGripsCounter++; +class VolumeMesh extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh { + volumeInfo = {}; // data for noise filter - if (this._pressedGripsCounter === 2) { - this.startScalingByControllers(); - } else if (this._pressedGripsCounter === 1) { - event.target.addSavingWorldTransform(this._molContainer); + constructor() { + const geo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry(); + super(geo); + this.clipPlane = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Plane(); + const size = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.5, 0.5, 0.5); + this.size = size; + this.cullFlag = [true, true, true, true, true, true, true, true, false, false, false, false, false, false]; + this.faces = [{ + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, -1) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 1) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, -1, 0) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 1, 0) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-1, 0, 0) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1, 0, 0) + }, { + indices: [], + norm: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0) + }]; + this.vertices = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-size.x, -size.y, -size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-size.x, size.y, -size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(size.x, -size.y, -size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(size.x, size.y, -size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-size.x, -size.y, size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-size.x, size.y, size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(size.x, -size.y, size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(size.x, size.y, size.z), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0), + // Placeholder for section + new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0)]; + geo.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(new Float32Array(this.vertices.length * 3), 3)); + this.name = 'VolumeMesh'; + } + static _corners = (() => [ + // x, y, z, edge1, edge2, edge3 + [-1, -1, -1, 0, 4, 8], [1, -1, -1, 0, 5, 9], [1, 1, -1, 1, 5, 10], [-1, 1, -1, 1, 4, 11], [-1, -1, 1, 2, 6, 8], [1, -1, 1, 2, 7, 9], [1, 1, 1, 3, 7, 10], [-1, 1, 1, 3, 6, 11]])(); + static _edges = (() => [ + // corner1, corner2, center_x, center_y, center_z + [0, 1, 0, -1, -1], [2, 3, 0, 1, -1], [4, 5, 0, -1, 1], [6, 7, 0, 1, 1], [0, 3, -1, 0, -1], [1, 2, 1, 0, -1], [4, 7, -1, 0, 1], [5, 6, 1, 0, 1], [0, 4, -1, -1, 0], [1, 5, 1, -1, 0], [2, 6, -1, 1, 0], [3, 7, 1, 1, 0]])(); + static _edgeIntersections = function () { + const edgeIntersections = []; + for (let j = 0; j < 12; ++j) { + edgeIntersections.push(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3()); + } + return edgeIntersections; + }(); + _updateVertices() { + // Algorithm: + // 1. Get plane parameters + // 2. Compute culling flags for all vertices + // 3. If intersection occurs => compute from 3 to 6 intersection points + const corners = VolumeMesh._corners; + const edges = VolumeMesh._edges; + const edgeIntersections = VolumeMesh._edgeIntersections; + let i; + const norm = this.clipPlane.normal; + const D = this.clipPlane.constant; + const vert = this.vertices; + const { + size + } = this; + const cornerMark = [0, 0, 0, 0, 0, 0, 0, 0]; + const edgeMark = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; + const curEdge = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + let curEdgeInter = null; + function CheckX() { + if (norm.x === 0) return 0; + const x = -(norm.dot(curEdge) + D) / norm.x; + if (-size.x <= x && x <= size.x) { + curEdgeInter.set(x, curEdge.y, curEdge.z); + if (x === size.x) return 2; + if (x === -size.x) return -2; + return 1; } + return 0; } - }, { - key: "handleGripsUp", - value: function handleGripsUp(event) { - this._pressedGripsCounter--; - - if (this._pressedGripsCounter === 1) { - this.stopScalingByControllers(); // reattach molecule to other controller - - var anotherController = event.target === this._controller1 ? this._controller2 : this._controller1; - anotherController.addSavingWorldTransform(this._molContainer); - } else if (this._pressedGripsCounter === 0) { - this._gfx.scene.addSavingWorldTransform(this._molContainer); + function CheckY() { + if (norm.y === 0) return 0; + const y = -(norm.dot(curEdge) + D) / norm.y; + if (-size.y <= y && y <= size.y) { + curEdgeInter.set(curEdge.x, y, curEdge.z); + if (y === size.y) return 2; + if (y === -size.y) return -2; + return 1; } + return 0; } - }, { - key: "enable", - value: function enable(gfx) { - if (!gfx) { - logger.warn('WebVR couldn\'t be enabled, because gfx is not defined'); - return; - } - - this._gfx = gfx; - var renderer = gfx.renderer, - camera = gfx.camera; - - if (!renderer) { - throw new Error('No renderer is available to toggle WebVR'); + function CheckZ() { + if (norm.z === 0) return 0; + const z = -(norm.dot(curEdge) + D) / norm.z; + if (-size.z <= z && z <= size.z) { + curEdgeInter.set(curEdge.x, curEdge.y, z); + if (z === size.z) return 2; + if (z === -size.z) return -2; + return 1; } + return 0; + } - if (!camera) { - throw new Error('No camera is available to toggle WebVR'); - } // enable xr in renderer - - - renderer.xr.enabled = true; // add button for turning vr mode - - if (!this._button) { - this._button = createWebVRButton(this); - document.body.appendChild(this._button); - } else { - this._button.style.display = 'block'; - } // store fog setting - - - this._mainFog = settings.now.fog; - settings.set('fog', false); - - this._plugVRNodesIntoScene(gfx, renderer); - - this._setControllersListeners(); // make some Miew job + // for each edge + for (let curEdgeIdx = 0; curEdgeIdx < 12; ++curEdgeIdx) { + const curEdgeSource = edges[curEdgeIdx]; + curEdgeInter = edgeIntersections[curEdgeIdx]; + curEdge.set(curEdgeSource[2], curEdgeSource[3], curEdgeSource[4]); + curEdge.multiply(size); + // calculate intersection point + let flag = 0; + if (curEdgeSource[2] === 0) flag = CheckX(); + if (curEdgeSource[3] === 0) flag = CheckY(); + if (curEdgeSource[4] === 0) flag = CheckZ(); - if (this._onToggle) { - this._onToggle(true); + // mark corresponding corner (if plane cuts through one) + if (flag === -2) { + cornerMark[curEdgeSource[0]] = 1; + } else if (flag === 2) { + cornerMark[curEdgeSource[1]] = 1; + } else if (flag === 0) { + // edge is not intersected by the plane (doesn't produce a vertex) + edgeMark[curEdgeIdx] = 0; } } - }, { - key: "_plugVRNodesIntoScene", - value: function _plugVRNodesIntoScene(gfx, renderer) { - // store common scene camera - this._mainCamera.copy(gfx.camera); // add hierarchical structure for webVR into scene - - - gfx.scene.add(this._user); // turn on webvr transformation - - gfx.scene.add(this._molContainer); - - this._molContainer.add(gfx.root); - - this._controller1 = renderer.xr.getController(0); - this._controller2 = renderer.xr.getController(1); - - var mesh = this._createControllerMesh(); - - this._controller1.add(mesh); - - this._controller2.add(mesh.clone()); - - this._user.add(this._controller1); - - this._user.add(this._controller2); + const face = { + indices: [], + norm: norm.clone().negate() + }; + let nextVertex = 8; + + // for each marked corner + for (i = 0; i < 8; ++i) { + if (cornerMark[i] === 1) { + // add corner as vertex to the face + vert[nextVertex].set(corners[i][0], corners[i][1], corners[i][2]).multiply(size); + face.indices.push(nextVertex++); + // skip adjacent edges + edgeMark[corners[i][3]] = 0; + edgeMark[corners[i][4]] = 0; + edgeMark[corners[i][5]] = 0; + } + } + + // for each edge that has internal intersection + for (i = 0; i < 12; ++i) { + if (edgeMark[i] === 1) { + // add intersection point as vertex to the face + vert[nextVertex].copy(edgeIntersections[i]); + face.indices.push(nextVertex++); + } + } + this.faces[6] = face; + const diff = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const coplanarPoint = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this.clipPlane.coplanarPoint(coplanarPoint); + for (i = 0; i < vert.length; ++i) { + this.cullFlag[i] = false; + if (i < 8) { + // corners should be culled by clipping plane + diff.subVectors(vert[i], coplanarPoint); + this.cullFlag[i] = norm.dot(diff) >= 0.0; + } else if (i < 8 + face.indices.length) { + // cross section vertices don't get culled + this.cullFlag[i] = true; + } + } + + // write data to vertex buffer + const positions = this.geometry.getAttribute('position'); + let idx = 0; + for (i = 0; i < vert.length; ++i) { + positions.array[idx++] = vert[i].x; + positions.array[idx++] = vert[i].y; + positions.array[idx++] = vert[i].z; + } + positions.needsUpdate = true; + } + _collectVertices(face, filter) { + let i; + const vert = this.vertices; + face.indices = []; + for (i = 0; i < vert.length; ++i) { + if (this.cullFlag[i] && filter(vert[i])) { + face.indices.push(i); + } + } + } + _sortIndices(face, right) { + let i; + let j; + const vert = this.vertices; + const angle = []; + const dir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + for (i = 1; i < face.indices.length; ++i) { + dir.subVectors(vert[face.indices[i]], vert[face.indices[0]]); + dir.normalize(); + dir.cross(right); + dir.negate(); + angle[i] = face.norm.dot(dir); + } + + // Exchange sort + for (i = 1; i < face.indices.length - 1; ++i) { + for (j = i + 1; j < face.indices.length; ++j) { + if (angle[j] < angle[i]) { + // swap + let t = angle[i]; + angle[i] = angle[j]; + angle[j] = t; + t = face.indices[i]; + face.indices[i] = face.indices[j]; + face.indices[j] = t; + } + } + } + } + _updateIndices() { + // Algorithm: + // 1. Get plane vertices (from 3 to 6 vertices) + // 2. Get "right" vector in plane + // 3. Sort vertices using Graham-like method + // 4. Create indices + + let i; + let faceIdx; + let face; + const vert = this.vertices; + const { + size + } = this; + this._collectVertices(this.faces[0], vertex => vertex.z === -size.z); + this._collectVertices(this.faces[1], vertex => vertex.z === size.z); + this._collectVertices(this.faces[2], vertex => vertex.y === -size.y); + this._collectVertices(this.faces[3], vertex => vertex.y === size.y); + this._collectVertices(this.faces[4], vertex => vertex.x === -size.x); + this._collectVertices(this.faces[5], vertex => vertex.x === size.x); + const vCenter = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const vRight = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const vDir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { + face = this.faces[faceIdx]; + if (face.indices.length === 0) continue; + vCenter.set(0, 0, 0); + for (i = 0; i < face.indices.length; ++i) { + vCenter.add(vert[face.indices[i]]); + } + vCenter.multiplyScalar(1.0 / face.indices.length); + vRight.subVectors(vert[face.indices[0]], vCenter); + vRight.normalize(); + const rightProj = []; + for (i = 0; i < face.indices.length; ++i) { + vDir.subVectors(vert[face.indices[i]], vCenter); + rightProj[i] = vDir.dot(vRight); + } + for (i = 1; i < face.indices.length; ++i) { + if (rightProj[i] < rightProj[0]) { + // swap + let t = rightProj[0]; + rightProj[0] = rightProj[i]; + rightProj[i] = t; + [t] = face.indices; + face.indices[0] = face.indices[i]; + face.indices[i] = t; + } + } + this._sortIndices(face, vRight); + } + let numIndices = 0; + for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { + face = this.faces[faceIdx]; + if (face.indices.length >= 3) { + numIndices += 3 * (face.indices.length - 2); + } + } + let offset = 0; + const indices = new Uint16Array(numIndices); + for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) { + face = this.faces[faceIdx]; + for (i = 0; i < face.indices.length - 2; ++i) { + indices[offset] = face.indices[0]; // eslint-disable-line prefer-destructuring + indices[offset + 1] = face.indices[i + 1]; + indices[offset + 2] = face.indices[i + 2]; + offset += 3; + } + } + this.geometry.setIndex(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(indices, 1)); + } + setDataSource(dataSource) { + const vm = new shaders_VolumeMaterial.VolumeMaterial(); + const dim = dataSource.getDimensions(); + const stride = dataSource.getTiledTextureStride(); + const texture = dataSource.buildTiledTexture(); + const bbox = dataSource.getBox(); + vm.uniforms.volumeDim.value.set(dim[0], dim[1], dim[2]); + vm.uniforms.tileTex.value = texture; + vm.uniforms.tileTexSize.value.set(texture.image.width, texture.image.height); + vm.uniforms.tileStride.value.set(stride[0], stride[1]); + Object.assign(this.volumeInfo, dataSource.getVolumeInfo()); + const volInfo = this.volumeInfo; + vm.uniforms.delta.value.copy(volInfo.delta); + vm.uniforms.boxAngles.value.set(volInfo.obtuseAngle[0], volInfo.obtuseAngle[1], volInfo.obtuseAngle[2]); + this.material = vm; + bbox.getSize(this.scale); + bbox.getCenter(this.position); + } + _updateIsoLevel() { + const { + kSigma, + kSigmaMed, + kSigmaMax + } = settings.now.modes.VD; + const volInfo = this.volumeInfo; + const mean = volInfo.dmean - volInfo.dmin; + const span = volInfo.dmax - volInfo.dmin; + const level = k => (mean + k * volInfo.sd) / span; + this.material.uniforms._isoLevel0.value.set(level(kSigma), level(kSigmaMed), level(kSigmaMax)); + } + static _nearClipPlaneOffset = 0.2; + static _pos = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3())(); + static _norm = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3())(); + static _norm4D = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector4())(); + static _matrixWorldToLocal = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4())(); + static _clipPlane = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Plane())(); + rebuild(camera) { + const nearClipPlaneOffset = VolumeMesh._nearClipPlaneOffset; + const pos = VolumeMesh._pos; + const norm = VolumeMesh._norm; + const norm4D = VolumeMesh._norm4D; + const matrixWorldToLocal = VolumeMesh._matrixWorldToLocal; + const clipPlane = VolumeMesh._clipPlane; + this._updateIsoLevel(); + + // get clip plane in local space + camera.getWorldDirection(norm); + camera.getWorldPosition(pos); + pos.addScaledVector(norm, camera.near + nearClipPlaneOffset); + + // transform pos to local CS + matrixWorldToLocal.copy(this.matrixWorld).invert(); + pos.applyMatrix4(matrixWorldToLocal); + + // transform norm to local CS + norm4D.set(norm.x, norm.y, norm.z, 0.0); // NOTE: use homogeneous norm for proper transformation + norm4D.applyMatrix4(matrixWorldToLocal); + norm.copy(norm4D); + norm.normalize(); + clipPlane.setFromNormalAndCoplanarPoint(norm, pos); + if (!this.clipPlane.equals(clipPlane)) { + this.clipPlane = clipPlane.clone(); + this._updateVertices(); + this._updateIndices(); } - }, { - key: "_setControllersListeners", - value: function _setControllersListeners() { - var _this = this; + } +} +/* harmony default export */ const gfx_VolumeMesh = (VolumeMesh); +;// CONCATENATED MODULE: ./src/gfx/VolumeBounds.js - this._controller1.addEventListener('selectstart', function (event) { - _this.handleGripsDown(event); - }); - this._controller1.addEventListener('selectend', function (event) { - _this.handleGripsUp(event); - }); +function _flattenArray(input) { + const n = input.length; + const output = new Float32Array(n * 3); + for (let i = 0; i < n; ++i) { + const j = 3 * i; + const v = input[i]; + output[j] = v.x; + output[j + 1] = v.y; + output[j + 2] = v.z; + } + return output; +} +class VolumeBounds { + static _projectionTable = { + // corresponds between (origin axes and angles between them) and between saving vector coordinates + XY: ['x', 2], + XZ: ['y', 1], + YZ: ['z', 0] + }; + constructor(bBox, volInfo) { + const { + delta + } = volInfo; // {x: XY, y : XZ, z: YZ} + const { + obtuseAngle + } = volInfo; // 1 - obtuse, 0 - acute + + const bSize = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + bBox.getSize(bSize); + bSize.multiplyScalar(0.5); + const offsetVert = this._getBaseVertices(delta, obtuseAngle); + const geometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry(); + const vertices = []; + for (let i = 0; i < 4; i++) { + vertices.push(offsetVert[i].clone().multiply(bSize)); + vertices.push(offsetVert[(i + 1) % 4].clone().multiply(bSize)); + } + const translation = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(2 * bSize.x * (1 - delta.x - delta.y), 0, 0); + for (let i = 0; i < 8; i++) { + vertices.push(vertices[i].clone().add(translation)); + } + for (let i = 0; i < 4; i++) { + vertices.push(vertices[i * 2].clone()); + vertices.push(vertices[i * 2 + 8].clone()); + } + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + bBox.getCenter(center); + vertices.forEach(vertex => vertex.add(center)); // pivot shift - this._controller2.addEventListener('selectstart', function (event) { - _this.handleGripsDown(event); - }); + const flatVertices = _flattenArray(vertices); + geometry.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(flatVertices, 3)); + this._lines = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineSegments(geometry, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineBasicMaterial({ + color: 0xFFFFFF + })); + this._lines.layers.set(gfxutils.LAYERS.VOLUME); + } - this._controller2.addEventListener('selectend', function (event) { - _this.handleGripsUp(event); - }); + // Set one edge (4 points) of frame, from which with parallel transfer the rest of the frame points can be obtained + _getBaseVertices(delta, obtuseAngle) { + const projTable = VolumeBounds._projectionTable; + const proj = (index, inv) => { + // tricky function to take account of projections: their position(related to box) and sign + const currDelta = delta[projTable[index][0]]; + const angleValue = -0.5 * (inv - 1) + inv * obtuseAngle[projTable[index][1]]; // inv = 1: alpha; inv = -1: 1 - alpha + return angleValue * currDelta; + }; + const offsetVert = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', 1)), -1 + 2 * proj('YZ', 1), -1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', 1)), -1 + 2 * proj('YZ', -1), 1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', -1)), 1 - 2 * proj('YZ', 1), 1), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', -1)), 1 - 2 * proj('YZ', -1), -1)]; + return offsetVert; + } + getMesh() { + return this._lines; + } +} +/* harmony default export */ const gfx_VolumeBounds = (VolumeBounds); +;// CONCATENATED MODULE: ./src/gfx/VolumeFarPlane.js - this._controller1.addEventListener('squeezestart', function (event) { - _this.handleGripsDown(event); - }); - this._controller1.addEventListener('squeezeend', function (event) { - _this.handleGripsUp(event); - }); - this._controller2.addEventListener('squeezestart', function (event) { - _this.handleGripsDown(event); - }); - this._controller2.addEventListener('squeezeend', function (event) { - _this.handleGripsUp(event); - }); - } - }, { - key: "disable", - value: function disable() { - if (!this._gfx) { + +// Thes geometric far plane is required for correct filling in the BFTexture in case, when far plane cuts the volume +// cube. In cut place of cube there is no correct data in BFTexture and volume rendering integral is calculated +// with errors. +// Far plane cuts the cube in case of large volume scale (zoom), because farplane doesn't change +class VolumeFarPlane { + // create plane with unit corners coords (for future rescale in vshader according to camera properties) + constructor(volume, width, height) { + const planeGeo = this._initPlaneGeo(width, height); + const mat = new shaders_VolumeMaterial.BackFacePosMaterialFarPlane(); + this._plane = new meshes.Mesh(planeGeo, mat); + this._plane.frustumCulled = false; + this._plane.doubleSided = true; + const matWorldToVolume = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + this._plane._onBeforeRender = function (_renderer, _scene, camera, _geometry, _material, _group) { + const { + material + } = this; + if (!volume || !material) { return; } - var _this$_gfx = this._gfx, - renderer = _this$_gfx.renderer, - camera = _this$_gfx.camera; - - if (!renderer) { - throw new Error('No renderer is available to toggle WebVR'); - } // nullify webxr callback for animation frame - - - renderer.setAnimationLoop(null); - var session = renderer.xr.getSession(); + // count point in world at farplane place + const planeCamPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector4(0, 0, -(camera.far - 0.1), 1); + planeCamPos.applyMatrix4(camera.matrixWorld); - if (session) { - session.end(); - } + // recalc matrices to make plane be placed as farplane in the World relative to camera + this.matrix.identity(); + this.matrix.makeTranslation(planeCamPos.x, planeCamPos.y, planeCamPos.z); + this.matrixWorld.copy(this.matrix); + this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld); + this.normalMatrix.getNormalMatrix(this.modelViewMatrix); - renderer.xr.enabled = false; // remove button of VR entering + // build worldToVolume matrix to transform plane into volumeCS (volumeCS coords are written to BackFaceTexture) + const volumeMatrix = volume.matrixWorld; + matWorldToVolume.copy(volumeMatrix).invert(); - if (this._button) { - this._button.style.display = 'none'; - } // restore fog param + // update material props + material.uniforms.aspectRatio.value = camera.aspect; + material.uniforms.farZ.value = camera.far; + material.uniforms.tanHalfFOV.value = Math.tan(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MathUtils.DEG2RAD * 0.5 * camera.fov); + material.uniforms.matWorld2Volume.value = matWorldToVolume; + }; + // set it to special layer to draw only into BFTexture + this._plane.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE); + } + _initPlaneGeo(width, height) { + const planeGeo = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry(); + width = width || 1; + height = height || 1; + const vertices = new Float32Array([-0.5 * width, 0.5 * height, 0, 0.5 * width, 0.5 * height, 0, -0.5 * width, -0.5 * height, 0, 0.5 * width, -0.5 * height, 0]); + planeGeo.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(vertices, 3)); + planeGeo.setIndex([0, 2, 1, 2, 3, 1]); + return planeGeo; + } + getMesh() { + return this._plane; + } +} +/* harmony default export */ const gfx_VolumeFarPlane = (VolumeFarPlane); +;// CONCATENATED MODULE: ./src/VolumeVisual.js - settings.set('fog', this._mainFog); - this._unplugVRNodesFromScene(camera); // make some Miew job - if (this._onToggle) { - this._onToggle(false); - } - } - }, { - key: "_unplugVRNodesFromScene", - value: function _unplugVRNodesFromScene(camera) { - // restore common camera - if (this._mainCamera && camera) { - camera.copy(this._mainCamera); - } // turn off webvr transformation - var root = this._molContainer.children[0]; +class VolumeVisual extends src_Visual { + constructor(name, dataSource) { + super(name, dataSource); + this._mesh = new gfx_VolumeMesh(); + this._mesh.setDataSource(dataSource); + this.add(this._mesh); + this._frame = new gfx_VolumeBounds(this.getBoundaries().boundingBox, this._mesh.volumeInfo); + this.add(this._frame.getMesh()); + this.showFrame(settings.now.modes.VD.frame); + this._farPlane = new gfx_VolumeFarPlane(this._mesh, 2, 2); + this.add(this._farPlane.getMesh()); + } + getBoundaries() { + const box = this._dataSource.getBox(); + const sphere = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Sphere(); + box.getBoundingSphere(sphere); + return { + boundingBox: box, + boundingSphere: sphere + }; + } + getMesh() { + return this._mesh; + } + showFrame(needShow) { + this._frame.getMesh().material.visible = needShow; + } +} +/* harmony default export */ const src_VolumeVisual = (VolumeVisual); +;// CONCATENATED MODULE: ./src/io/loaders/LoaderList.js - if (root) { - this._gfx.scene.add(root); - } - this._molContainer.parent.remove(this._molContainer); +/** + * A list of available loaders. + * @extends EntityList + */ +class LoaderList extends utils_EntityList { + /** + * Create a list of loaders. + * The loaders are indexed by supported source types (`.types` property of a Loader + * subclass). + * The loaders can be retrieved later by matching against specs (see {@link LoaderList#find}). + * + * @param {!Array=} someLoaders A list of {@link Loader} subclasses to + * automatically register at creation time. + * @see LoaderList#register + */ + constructor() { + let someLoaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + super(someLoaders, ['types']); + } - if (this._user) { - this._gfx.scene.remove(this._user); - } // free scene nodes + /** + * Find a suitable loader for a source type. + * + * @param {Object} specs Loader specifications. + * @param {string=} specs.type Supported source type. + * @param {*=} specs.source Source to load from. + */ + find(specs) { + let list = []; + if (specs.type) { + list = this._dict.types[specs.type.toLowerCase()] || []; + } else if (specs.source) { + return this._list.filter(SomeLoader => SomeLoader.canProbablyLoad && SomeLoader.canProbablyLoad(specs.source)); + } + return [...list]; + } +} +/* harmony default export */ const loaders_LoaderList = (LoaderList); +;// CONCATENATED MODULE: ./src/io/loaders/Loader.js - this._molContainer = null; - this._user = null; - this._scalingPivot = null; - this._user = null; - this._controller1 = null; - this._controller2 = null; +class Loader extends utils_EventDispatcher { + constructor(source, options) { + super(); + this._source = source; + this._options = options || {}; + this._abort = false; + this._agent = null; + } + load() { + return Promise.reject(new Error('Loading from this source is not implemented')); + } + abort() { + this._abort = true; + if (this._agent) { + this._agent.abort(); } - }, { - key: "_createControllerMesh", - value: function _createControllerMesh() { - // visualize controllers with cylinders - var geometry = new CylinderGeometry(0.04, 0.04, 0.3); - var material = new UberMaterial({ - lights: false, - overrideColor: true + } + static extractName(_source) { + return undefined; + } +} +utils_makeContextDependent(Loader.prototype); +;// CONCATENATED MODULE: ./src/io/loaders/FileLoader.js + +class FileLoader extends Loader { + constructor(source, options) { + super(source, options); + options = this._options; + this._binary = options.binary === true; + } + load() { + return new Promise((resolve, reject) => { + if (this._abort) { + throw new Error('Loading aborted'); + } + const blob = this._source; + const reader = this._agent = new FileReader(); + reader.addEventListener('load', () => { + resolve(reader.result); }); - material.setUberOptions({ - fixedColor: new Color(0x4444ff) + reader.addEventListener('error', () => { + reject(reader.error); }); - material.updateUniforms(); - var cylinder = new Mesh$5(geometry, material); - cylinder.rotateX(-Math.PI / 2); - return cylinder; - } - }, { - key: "updateMoleculeScale", - value: function updateMoleculeScale() { - if (!this._controller1 || !this._controller2) { - return; + reader.addEventListener('abort', () => { + reject(new Error('Loading aborted')); + }); + reader.addEventListener('progress', event => { + this.dispatchEvent(event); + }); + if (this._binary) { + reader.readAsArrayBuffer(blob); + } else { + reader.readAsText(blob); } + }); + } + static canProbablyLoad(source) { + return File && source instanceof File || Blob && source instanceof Blob; + } + static extractName(source) { + return source && source.name; + } +} +FileLoader.types = ['file', 'blob']; +;// CONCATENATED MODULE: ./src/io/loaders/XHRLoader.js - var self = this; // update molecule scaling by controllers - - if (self._pressedGripsCounter === 2) { - // recalc scaling pivot - gfxutils.getMiddlePoint(self._controller1.position, self._controller2.position, self._scalingPivot.position); // recalc scaler - - var dist = self._controller1.position.distanceTo(self._controller2.position); - - var scaler = dist / self._distance; - - self._scalingPivot.scale.multiplyScalar(scaler); // save cur distance for next frame - self._distance = dist; +// we don't need to detect all kinds of URLs, just the evident ones +const urlStartRegexp = /^(https?|ftp):\/\//i; +class XHRLoader extends Loader { + constructor(source, options) { + super(source, options); + options = this._options; + this._binary = options.binary === true; + } + load() { + return new Promise((resolve, reject) => { + if (this._abort) { + throw new Error('Loading aborted'); + } + const url = this._source; + const request = this._agent = new XMLHttpRequest(); + request.addEventListener('load', () => { + if (request.status === 200) { + resolve(request.response); + } else { + reject(new Error(`HTTP ${request.status} while fetching ${url}`)); + } + }); + request.addEventListener('error', () => { + reject(new Error('HTTP request failed')); + }); + request.addEventListener('abort', () => { + reject(new Error('Loading aborted')); + }); + request.addEventListener('progress', event => { + this.dispatchEvent(event); + }); + request.open('GET', url); + if (this._binary) { + request.responseType = 'arraybuffer'; + } else { + request.responseType = 'text'; } + request.send(); + }); + } + static canProbablyLoad(source) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(source) && urlStartRegexp.test(source); + } + static extractName(source) { + if (source) { + const last = (source.indexOf('?') + 1 || source.lastIndexOf('#') + 1 || source.length + 1) - 1; + return source.slice(source.lastIndexOf('/', last) + 1, last); } - /** - * Reposition molecule right before the camera. - * @note The proper way is to initiate headset in the place of common Miew's camera. - * But threejs limitations on setting new XRReferenceSpace enforce the molecule repositioning - * Hope, something will change. - */ - - }, { - key: "moveSceneBehindHeadset", - value: function moveSceneBehindHeadset() { - var gfx = this._gfx; - var camera = gfx.camera; // set container position in camera space - - var container = this._molContainer; - container.matrix.identity(); - container.position.set(0, 0, -4.0); - container.updateMatrix(); // update container world matrix - - container.matrixWorld.multiplyMatrices(camera.matrixWorld, container.matrix); // readd to scene - - gfx.scene.addSavingWorldTransform(container); + return undefined; + } +} +XHRLoader.types = ['url']; +;// CONCATENATED MODULE: ./src/io/loaders/ImmediateLoader.js - if (this._onToggle) { - this._onToggle(true); +class ImmediateLoader extends Loader { + load() { + return new Promise(resolve => { + if (this._abort) { + throw new Error('Loading aborted'); } - } - }, { - key: "getCanvas", - value: function getCanvas() { - var gfx = this._gfx; - return gfx && gfx.renderer ? gfx.renderer.domElement : null; - } - }]); + resolve(this._source); + }); + } + static canProbablyLoad(_source) { + return false; + } +} +ImmediateLoader.types = ['immediate']; +;// CONCATENATED MODULE: ./src/io/loaders.js - return WebVRPoC; -}(); -var fragmentScreenQuadFromDistTex = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform vec3 aberration;\r\n\r\nvoid main() {\r\n vec2 uv = vUv * 2.0 - 1.0;\r\n \r\n gl_FragColor.r = texture2D(srcTex, 0.5 * (uv * aberration[0] + 1.0)).r;\r\n gl_FragColor.g = texture2D(srcTex, 0.5 * (uv * aberration[1] + 1.0)).g;\r\n gl_FragColor.b = texture2D(srcTex, 0.5 * (uv * aberration[2] + 1.0)).b;\r\n gl_FragColor.a = 1.0;\r\n}"; -var selectors$4 = chem.selectors, - Atom$2 = chem.Atom, - Residue$1 = chem.Residue, - Chain$2 = chem.Chain, - Molecule$8 = chem.Molecule; -var EDIT_MODE = { - COMPLEX: 0, - COMPONENT: 1, - FRAGMENT: 2 -}; -var LOADER_NOT_FOUND = 'Could not find suitable loader for this source'; -var PARSER_NOT_FOUND = 'Could not find suitable parser for this source'; -var createElement$2 = utils.createElement; -function updateFogRange(fog, center, radius) { - fog.near = center - radius * settings.now.fogNearFactor; - fog.far = center + radius * settings.now.fogFarFactor; -} +/* harmony default export */ const loaders = (new loaders_LoaderList([ +// note: order might be important +FileLoader, XHRLoader, ImmediateLoader])); +;// CONCATENATED MODULE: ./src/io/parsers/ParserList.js -function removeExtension(fileName) { - var dot = fileName.lastIndexOf('.'); - if (dot >= 0) { - fileName = fileName.substr(0, dot); +/** + * A list of available parsers. + * @extends EntityList + */ +class ParserList extends utils_EntityList { + /** + * Create a list of parsers. + * The parsers are indexed by supported data formats and file extensions (`.formats` and + * `.extensions` properties of a Parser subclass). + * The parsers can be retrieved later by matching against specs (see {@link ParsrerList#find}). + * + * @param {!Array=} someParsers A list of {@link Parser} subclasses to + * automatically register at creation time. + * @see ParserList#register + */ + constructor() { + let someParsers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + super(someParsers, ['formats', 'extensions']); } - return fileName; + /** + * Find a suitable parser for data. + * + * @param {Object} specs Parser specifications. + * @param {string=} specs.format Supported data format. + * @param {string=} specs.ext Supported filename extension. + * @param {*=} specs.data Data to parse. + */ + find(specs) { + let list = []; + if (specs.format) { + list = this._dict.formats[specs.format.toLowerCase()] || []; + } else if (specs.ext) { + list = this._dict.extensions[specs.ext.toLowerCase()] || []; + } + // autodetect only if no format is forced + if (list.length === 0 && !specs.format && specs.data) { + return this._list.filter(SomeParser => SomeParser.canProbablyParse && SomeParser.canProbablyParse(specs.data)); + } + return [...list]; + } } +/* harmony default export */ const parsers_ParserList = (ParserList); +;// CONCATENATED MODULE: ./src/io/parsers/Parser.js -function hasValidResidues(complex) { - var hasValidRes = false; - complex.forEachComponent(function (component) { - component.forEachResidue(function (residue) { - if (residue._isValid) { - hasValidRes = true; - } +class Parser { + constructor(data, options) { + this._data = data; + this._options = options || {}; + this._abort = false; + } + parseSync() { + throw new Error('Parsing this type of data is not implemented'); + } + parse() { + return new Promise((resolve, reject) => { + setTimeout(() => { + try { + if (this._abort) { + return reject(new Error('Parsing aborted')); + } + return resolve(this.parseSync()); + } catch (error) { + return reject(error); + } + }); }); - }); - return hasValidRes; + } + + // only for volume Parsers + getModel() { + this.model._parseHeader(this._data); + return this.model; + } + abort() { + this._abort = true; + } } +utils_makeContextDependent(Parser.prototype); +;// CONCATENATED MODULE: ./src/io/parsers/pdb/Remark290.js -function reportProgress(log, action, percent) { - var TOTAL_PERCENT = 100; - if (percent !== undefined) { - log.debug("".concat(action, "... ").concat(Math.floor(percent * TOTAL_PERCENT), "%")); - } else { - log.debug("".concat(action, "...")); +/** + * Parser helper for PDB tag "REMARK 290". + * + * @exports Remark290 + * @constructor + */ +class Remark290 { + constructor() { + /** @type {THREE.Matrix4[]} */ + this.matrices = []; + + /** @type {?THREE.Matrix4} */ + this._matrix = null; + /** @type {number} */ + this._matrixIndex = -1; + } + + /** + * Parse a single line of a stream. + * @param {PDBStream} stream - stream to parse + */ + + parse(stream) { + /** @type {?THREE.Matrix4} */ + let matrix = this._matrix; + if (stream.readString(12, 18) === ' SMTRY') { + const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2 + const matrixData = stream.readString(20, 80).trim().split(/\s+/); + const matrixIndex = parseInt(matrixData[0], 10); + if (this._matrix === null || matrixIndex !== this._matrixIndex) { + // TODO: assert(matrixIndex === this.matrices.length + 1); + this._matrixIndex = matrixIndex; + this._matrix = matrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + this.matrices[this.matrices.length] = matrix; + } + const { + elements + } = matrix; + elements[matrixRow] = parseFloat(matrixData[1]); + elements[matrixRow + 4] = parseFloat(matrixData[2]); + elements[matrixRow + 8] = parseFloat(matrixData[3]); + elements[matrixRow + 12] = parseFloat(matrixData[4]); + } } } +Remark290.prototype.id = 290; +/* harmony default export */ const pdb_Remark290 = (Remark290); +;// CONCATENATED MODULE: ./src/io/parsers/pdb/Remark350.js -function chooseFogColor() { - return settings.now.fogColorEnable ? settings.now.fogColor : settings.now.bg.color; -} // //////////////////////////////////////////////////////////////////////////// + +const { + Assembly: Remark350_Assembly +} = chem; /** - * Main 3D Molecular Viewer class. - * - * @param {object} opts - Viewer options. - * @param {HTMLElement=} opts.container - DOM element that serves as a viewer container. - * @param {object=} opts.settings - An object with properties to override default settings. - * @param {string=} opts.settingsCookie='settings' - The name of the cookie to save current settings to. - * @param {string=} opts.cookiePath='/' - The path option for cookies. Defaults to root. + * Parser helper for PDB tag "REMARK 350". * - * @exports Miew + * @exports Remark350 * @constructor */ +class Remark350 { + constructor(complex) { + /** @type {Complex} */ + this._complex = complex; + /** @type {Assembly[]} */ + this.assemblies = []; + /** @type {?Assembly} */ + this._assembly = null; + /** @type {?THREE.Matrix4} */ + this._matrix = null; + /** @type {number} */ + this._matrixIndex = -1; + } -function Miew(opts) { - EventDispatcher.call(this); - this._opts = _.merge({ - settingsCookie: 'settings', - cookiePath: '/' - }, opts); - /** @type {?object} */ + /** + * Parse a single line of a stream. + * @param {PDBStream} stream - stream to parse + */ - this._gfx = null; - /** @type {ViewInterpolator} */ + parse(stream) { + /** @type {?Assembly} */ + let assembly = this._assembly; + /** @type {?THREE.Matrix4} */ + let matrix = this._matrix; + if (assembly && stream.readString(12, 18) === ' BIOMT') { + const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2 + const matrixData = stream.readString(20, 80).trim().split(/\s+/); + const matrixIndex = parseInt(matrixData[0], 10); + if (this._matrix === null || matrixIndex !== this._matrixIndex) { + // TODO: assert(matrixIndex === assembly.matrices.length + 1); + this._matrixIndex = matrixIndex; + this._matrix = matrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + assembly.addMatrix(matrix); + } + const { + elements + } = matrix; + elements[matrixRow] = parseFloat(matrixData[1]); + elements[matrixRow + 4] = parseFloat(matrixData[2]); + elements[matrixRow + 8] = parseFloat(matrixData[3]); + elements[matrixRow + 12] = parseFloat(matrixData[4]); + } else if (assembly && stream.readString(35, 41) === 'CHAINS:') { + const entries = stream.readString(42, 80).split(','); + for (let i = 0, n = entries.length; i < n; ++i) { + const chain = entries[i].trim(); + if (chain.length > 0) { + assembly.addChain(chain); + } + } + } else if (stream.readString(12, 23) === 'BIOMOLECULE:') { + // assert molIndex === this.assemblies.length + 1 + this._matrix = null; + this._matrixIndex = -1; + this._assembly = assembly = new Remark350_Assembly(this._complex); + this.assemblies.push(assembly); + } + } +} +Remark350.prototype.id = 350; +/* harmony default export */ const pdb_Remark350 = (Remark350); +;// CONCATENATED MODULE: ./src/io/parsers/PDBStream.js +/** Helper class for stream-like reading input files. */ +class PDBStream { + /** + * Create a stream + * @param {String} data Input data + */ + constructor(data) { + /** @type String */ + this._data = data; // Input file + /** @type Number */ + this._start = 0; // Starting position of line + /** @type Number */ + this._nextCR = -1; // Position of next CR (0x0D) + /** @type Number */ + this._nextLF = -1; // Position of next LF (0x0A) + /** @type Number */ + this._next = -1; // End position of line + /** @type Number */ + this._end = data.length; // End of data - this._interpolator = new ViewInterpolator(); - /** @type {HTMLElement} */ + this.next(); + } - this._container = opts && opts.container || document.getElementById('miew-container') || _.head(document.getElementsByClassName('miew-container')) || document.body; - /** @type {HTMLElement} */ + /** + * Reading next line. + * @returns {String} Next line in data (ending with LF or CR) + */ + readLine() { + return this._data.slice(this._start, this._next); + } - this._containerRoot = this._container; - /** @type {boolean} */ + /** + * Reading character from position. + * @param {Number} pos - Position in current line. + * @returns {String} Character from position + */ + readChar(pos) { + pos = this._start + pos - 1; + return pos < this._next ? this._data[pos] : ' '; + } - this._running = false; - /** @type {boolean} */ + /** + * Reading character code from position. + * @param {Number} pos - Position in current line. + * @returns {Number} Character code from position + */ + readCharCode(pos) { + pos = this._start + pos - 1; + return pos < this._next ? this._data.charCodeAt(pos) : 32; + } - this._halting = false; - /** @type {boolean} */ + /** + * Reading string from begin to end points. + * For a reason unknown, numbering assumed not to start from 0, but from 1. + * @param {Number} begin - Begin point in current line. + * @param {Number} end - End point in current line. + * @returns {String} String from begin to end + */ + readString(begin, end) { + const from = this._start + begin - 1; + const to = this._start + end; + return this._data.slice(from, to < this._next ? to : this._next); + } - this._building = false; - /** @type {boolean} */ + /** + * Reading integer from begin to end points. + * @param {Number} begin - Begin point in current line. + * @param {Number} end - End point in current line. + * @returns {Number} Integer from begin to end + */ + readInt(begin, end) { + return parseInt(this.readString(begin, end), 10); + } - this._needRender = true; - /** @type {boolean} */ + /** + * Reading float from begin to end points. + * @param {Number} begin - Begin point in current line. + * @param {Number} end - End point in current line. + * @returns {Number} Float from begin to end + */ + readFloat(begin, end) { + return parseFloat(this.readString(begin, end)); + } - this._hotKeysEnabled = true; - /** @type {Settings} */ + /** + * Checking for end of data. + * @returns {boolean} True if data is ended, false otherwise + */ + end() { + return this._start >= this._end; + } - this.settings = settings; - var log = logger; - log.console = false; - log.level = 'info'; /** - * @type {Logger} - * @example - * miew.logger.addEventListener('message', function _onLogMessage(evt) { - * console.log(evt.message); - * }); + * Procedure to re-arrange current pointers in data. */ + next() { + const start = this._next + 1; + this._start = start < this._end ? start : this._end; - this.logger = log; - this._cookies = new Cookies(this); - this.restoreSettings(); + // support CR, LF, CR+LF line endings + // do not support LF+CR, CR+CR+LF, and other strange combinations - if (opts && opts.settings) { - this.settings.set(opts.settings); + if (this._start > this._nextCR) { + this._nextCR = (this._data.indexOf('\r', this._start) + 1 || this._end + 1) - 1; + } + if (this._start > this._nextLF) { + this._nextLF = (this._data.indexOf('\n', this._start) + 1 || this._end + 1) - 1; + } + this._next = this._nextCR + 1 < this._nextLF ? this._nextCR : this._nextLF; } - /** @type {?Spinner} */ +} +/* harmony default export */ const parsers_PDBStream = (PDBStream); +;// CONCATENATED MODULE: ./src/io/parsers/PDBParser.js - this._spinner = null; - /** @type {JobHandle[]} */ - this._loading = []; - /** @type {?number} - * @deprecated until Animation system refactoring - */ - this._animInterval = null; - /** @type {object} */ - this._visuals = {}; - /** @type {?string} */ - this._curVisualName = null; - /** @type {array} */ - this._objects = []; - /** @type {object} */ +const { + Complex: PDBParser_Complex, + Element: PDBParser_Element, + Helix: PDBParser_Helix, + Sheet: PDBParser_Sheet, + Strand: PDBParser_Strand, + Bond: PDBParser_Bond, + Molecule: PDBParser_Molecule +} = chem; +const TAG_LENGTH = 6; +function nameToElement(name) { + // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM + // + // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1 + // + // Atom names start with element symbols right-justified in columns 13-14 + // as permitted by the length of the name. For example, the symbol FE for + // iron appears in columns 13-14, whereas the symbol C for carbon appears + // in column 14 (see Misaligned Atom Names). If an atom name has four + // characters, however, it must start in column 13 even if the element + // symbol is a single character (for example, see Hydrogen Atoms). - this._sourceWindow = null; - this.reset(); + const veryLong = name.trim().length === 4; + return name.slice(0, veryLong ? 1 : 2).trim(); +} - if (this._repr) { - log.debug("Selected ".concat(this._repr.mode.name, " mode with ").concat(this._repr.colorer.name, " colorer.")); +// the most frequently used beginnings; although HEADER is mandatory, it is often missing in handmade files +const pdbStartRegexp = /^(HEADER\s|COMPND\s|REMARK\s|ATOM {2}|HETATM|MODEL )/i; +const remarkParsers = { + // NOTE: please forget the idea to build the method name in runtime, it can be obfuscated. + 290: pdb_Remark290, + 350: pdb_Remark350 +}; +class PDBParser extends Parser { + constructor(data, options) { + super(data, options); + this._complex = null; + this._chain = null; + this._residue = null; + this._sheet = null; + this._serialAtomMap = null; + this._modelId = 1; + this._compaundFound = false; + this._biomoleculeFound = false; + this._allowedChainsIDs = null; + this._lastMolId = -1; + this._remarks = {}; + this._remark = null; + this._molecules = []; + this._molecule = null; + this._compndCurrToken = ''; + this._options.fileType = 'pdb'; } + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(data) && pdbStartRegexp.test(data); + } + _finalize() { + this._fixBondsArray(); + this._fixChains(); - var self = this; - Miew.registeredPlugins.forEach(function (plugin) { - plugin.call(self); - }); + // keep crystallographic symmetry transformations + const remark290 = this._remarks[290]; + this._complex.symmetry = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(remark290) ? [] : remark290.matrices; - this._initOnSettingsChanged(); -} + // add loaded biological assemblies + const remark350 = this._remarks[350]; + this._complex.units = this._complex.units.concat(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(remark350) ? [] : remark350.assemblies); -Miew.prototype = Object.create(EventDispatcher.prototype); -Miew.prototype.constructor = Miew; + // add loaded macromolecules + this._finalizeMolecules(); -Miew.prototype.getMaxRepresentationCount = function () { - return ComplexVisual.NUM_REPRESENTATION_BITS; -}; -/** - * Replace viewer container contents with a DOM element. - * @param {HTMLElement} container - parent container. - * @param {HTMLElement} element - DOM element to show. - * @private - */ + // create secondary structure etc. + this._complex.finalize({ + needAutoBonding: true, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap + }); + } + _finalizeMolecules() { + // get chains from complex + const chainDict = {}; + let i; + const chains = this._complex._chains; + for (i = 0; i < chains.length; ++i) { + const chainObj = chains[i]; + const chainName = chainObj._name; + chainDict[chainName] = chainObj; + } + + // aggregate residues from chains + for (i = 0; i < this._molecules.length; i++) { + const m = this._molecules[i]; + let residues = []; + for (let j = 0; j < m._chains.length; j++) { + const name = m._chains[j]; + const chain = chainDict[name]; + residues = residues.concat(chain._residues.slice()); + } + const molecule = new PDBParser_Molecule(this._complex, m._name, i + 1); + molecule.residues = residues; + this._complex._molecules[i] = molecule; + } + } + _fixChains() { + const idChainMap = {}; + const complex = this._complex; + + // prepare + for (let i = 0; i < complex._chains.length; i++) { + const chain = complex._chains[i]; + idChainMap[chain._name.charCodeAt(0)] = chain; + } + } + + // FIXME: This function is redundant, CONECT records always follow ATOM and HETATM. Build the map online. + _fixBondsArray() { + const serialAtomMap = this._serialAtomMap = {}; + const complex = this._complex; + const atoms = complex._atoms; + for (let i = 0, ni = atoms.length; i < ni; ++i) { + const atom = atoms[i]; + serialAtomMap[atom.serial] = atom; + } + const bonds = complex._bonds; + const { + logger + } = this; + for (let j = 0, nj = bonds.length; j < nj; ++j) { + const bond = bonds[j]; + if (bond._right < bond._left) { + logger.debug('_fixBondsArray: Logic error.'); + } + bond._left = serialAtomMap[bond._left] || null; + bond._right = serialAtomMap[bond._right] || null; + } + } + _parseATOM(stream) { + if (this._modelId !== 1) { + return; + } + /* eslint-disable no-magic-numbers */ + const het = stream.readCharCode(1) === 0x48; + + // field names according to wwPDB Format + // NOTE: Chimera allows (nonstandard) use of columns 6-11 for the integer atom serial number in ATOM records. + const serial = het ? stream.readInt(7, 11) : stream.readInt(6, 11); + let name = stream.readString(13, 16); + const altLoc = stream.readChar(17); + const resName = stream.readString(18, 20).trim(); + const chainID = stream.readChar(22); + const resSeq = stream.readInt(23, 26); + const iCode = stream.readChar(27); + const x = stream.readFloat(31, 38); + const y = stream.readFloat(39, 46); + const z = stream.readFloat(47, 54); + const occupancy = stream.readFloat(55, 60); + const tempFactor = stream.readFloat(61, 66); + const element = stream.readString(77, 78).trim() || nameToElement(name); + const charge = stream.readInt(79, 80) || 0; + /* eslint-enable no-magic-numbers */ + // skip waters (there may be lots of them) + if (this.settings.now.nowater) { + if (resName === 'HOH' || resName === 'WAT') { + return; + } + } -function _setContainerContents(container, element) { - var parent = container; + // PDB uses positional system for atom names. It helps derive element type from the name + // but names may include extra spaces. From this point on we don't need those spaces anymore. + name = name.trim(); + const type = PDBParser_Element.getByName(element); + const role = PDBParser_Element.Role[name]; // FIXME: Maybe should use type as additional index (" CA " vs. "CA ") - while (parent.firstChild) { - parent.removeChild(parent.firstChild); + // NOTE: Residues of a particular chain are not required to be listed next to each other. + // https://github.com/biasmv/pv/commit/7319b898b7473ba380c26699e3b028b2b1a7e1a1 + let chain = this._chain; + if (!chain || chain.getName() !== chainID) { + this._chain = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); + this._residue = null; + } + let residue = this._residue; + if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { + this._residue = residue = chain.addResidue(resName, resSeq, iCode); + } + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(x, y, z); + residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); + } + _parseENDMDL() { + this._modelId += 1; } + _parseCONECT(stream) { + /* eslint-disable no-magic-numbers */ + const serial0 = stream.readInt(7, 11); + const serial1 = stream.readInt(12, 16); + const serial2 = stream.readInt(17, 21); + const serial3 = stream.readInt(22, 26); + const serial4 = stream.readInt(27, 31); + /* eslint-enable no-magic-numbers */ - parent.appendChild(element); -} -/** - * Update Shadow Camera target position and frustum. - * @private - */ + const complex = this._complex; + // Keep bonds ordered by atom serial + if (serial1 && serial1 > serial0) { + complex.addBond(serial0, serial1, 0, PDBParser_Bond.BondType.UNKNOWN, true); + } + if (serial2 && serial2 > serial0) { + complex.addBond(serial0, serial2, 0, PDBParser_Bond.BondType.UNKNOWN, true); + } + if (serial3 && serial3 > serial0) { + complex.addBond(serial0, serial3, 0, PDBParser_Bond.BondType.UNKNOWN, true); + } + if (serial4 && serial4 > serial0) { + complex.addBond(serial0, serial4, 0, PDBParser_Bond.BondType.UNKNOWN, true); + } + } + _parseCOMPND(stream) { + /* eslint-disable no-magic-numbers */ + const str = stream.readString(11, 80); + const tokenIdx = str.indexOf(':'); + this._compndCurrToken = tokenIdx > 0 ? str.substring(0, tokenIdx).trim() : this._compndCurrToken; + /* eslint-enable no-magic-numbers */ -Miew.prototype._updateShadowCamera = function () { - var shadowMatrix = new Matrix4(); - var direction = new Vector3(); - var OBB = { - center: new Vector3(), - halfSize: new Vector3() - }; - return function () { - this._gfx.scene.updateMatrixWorld(); + // start reading new molecule + if (this._compndCurrToken === 'MOL_ID') { + this._molecule = { + _index: '', + _chains: [] + }; + this._molecule._index = parseInt(str.substring(tokenIdx + 1, str.indexOf(';')), 10); + this._molecules.push(this._molecule); + // parse molecule name + } else if (this._compndCurrToken === 'MOLECULE' && this._molecule != null) { + this._molecule._name = str.substring(tokenIdx + 1, str.indexOf(';')).trim(); + // parse molecule chains + } else if (this._compndCurrToken === 'CHAIN' && this._molecule != null) { + let chainStr = str.substring(tokenIdx + 1, 80).trim(); + const lastChar = chainStr[chainStr.length - 1]; + if (lastChar === ';' || lastChar === ',') { + chainStr = chainStr.slice(0, -1); + } + chainStr = chainStr.replace(/\s+/g, ''); + const chains = chainStr.split(','); + this._molecule._chains = this._molecule._chains.concat(chains); + } + } + _parseREMARK(stream) { + /* eslint-disable no-magic-numbers */ + const remarkNum = stream.readInt(8, 10); + /* eslint-enable no-magic-numbers */ - for (var i = 0; i < this._gfx.scene.children.length; i++) { - if (this._gfx.scene.children[i].type === 'DirectionalLight') { - var light = this._gfx.scene.children[i]; - shadowMatrix.copy(light.shadow.camera.matrixWorldInverse); - this.getOBB(shadowMatrix, OBB); - direction.subVectors(light.target.position, light.position); - light.position.subVectors(OBB.center, direction); - light.target.position.copy(OBB.center); - light.shadow.bias = 0.09; - light.shadow.camera.bottom = -OBB.halfSize.y; - light.shadow.camera.top = OBB.halfSize.y; - light.shadow.camera.right = OBB.halfSize.x; - light.shadow.camera.left = -OBB.halfSize.x; - light.shadow.camera.near = direction.length() - OBB.halfSize.z; - light.shadow.camera.far = direction.length() + OBB.halfSize.z; - light.shadow.camera.updateProjectionMatrix(); + // create remark parser if needed + let remark = this._remarks[remarkNum]; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(remark)) { + const RemarkParser = remarkParsers[remarkNum]; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isFunction(RemarkParser)) { + this._remarks[remarkNum] = remark = new RemarkParser(this._complex); } } - }; -}(); -/** - * Initialize the viewer. - * @returns {boolean} true on success. - * @throws Forwards exception raised during initialization. - * @see Miew#term - */ - - -Miew.prototype.init = function () { - var container = this._container; - var elem = utils.createElement('div', { - "class": 'miew-canvas' - }); - - _setContainerContents(container, elem); - this._container = elem; - var frag = document.createDocumentFragment(); - frag.appendChild(this._msgMode = createElement$2('div', { - "class": 'mode-message overlay' - }, createElement$2('p', {}, 'COMPONENT EDIT MODE'))); - frag.appendChild(this._msgAtomInfo = createElement$2('div', { - "class": 'atom-info overlay' - }, createElement$2('p', {}, ''))); - container.appendChild(frag); + // delegate parsing + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(remark)) { + remark.parse(stream); + } + } + _parseHELIX(stream) { + /* eslint-disable no-magic-numbers */ + const fields = [20, 22, 32, 34]; + /* eslint-enable no-magic-numbers */ + this._parseSTRUCTURE(stream, fields, obj => { + this._complex.addHelix(obj); + this._complex.structures.push(obj); + }); + } + _parseSHEET(stream) { + /* eslint-disable no-magic-numbers */ + const fields = [22, 23, 33, 34]; + /* eslint-enable no-magic-numbers */ + this._parseSTRUCTURE(stream, fields, obj => { + this._complex.addSheet(obj); + }); + } + _parseSTRUCTURE(stream, pars, adder) { + const startId = 0; + const startIndex = 1; + const endId = 2; + const endIndex = 3; - if (this._gfx !== null) { - // block double init - return true; + // identify fields: debugging and stuff + /* eslint-disable no-magic-numbers */ + const codeOfS = 0x53; + const serialNumber = stream.readInt(8, 10); + const structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim() + const comment = stream.readString(41, 70).trim(); + const helLength = stream.readInt(72, 76); + const helixClass = stream.readInt(39, 40); + const shWidth = stream.readInt(15, 16); + const shCur = stream.readInt(42, 45); + const shPrev = stream.readInt(57, 60); + /* eslint-enable no-magic-numbers */ + // file fields + const startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0); + const endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0); + const startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3); + let iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4); + let startICode = 0; + if (iCodeStr.length > 0) { + startICode = iCodeStr.charCodeAt(0); + } + const endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3); + iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4); + let endICode = 0; + if (iCodeStr.length > 0) { + endICode = iCodeStr.charCodeAt(0); + } + let obj; + let cs = this._sheet; + if (stream.readCharCode(1) === codeOfS) { + if (cs !== null && cs.getName() !== structureName) { + cs = null; + this._sheet = null; + } + if (cs === null) { + this._sheet = obj = new PDBParser_Sheet(structureName, shWidth); + adder(obj); + } else { + obj = cs; + } + const strand = new PDBParser_Strand(obj, this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode), this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode), helixClass, shCur, shPrev); + obj.addStrand(strand); + this._complex.structures.push(strand); + } else { + obj = new PDBParser_Helix(helixClass, this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode), this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode), serialNumber, structureName, comment, helLength); + adder(obj); + } + } + _parseHEADER(stream) { + const { + metadata + } = this._complex; + metadata.classification = stream.readString(11, 50).trim(); + metadata.date = stream.readString(51, 59).trim(); + const id = stream.readString(63, 66).trim(); + metadata.id = id; + if (id) { + this._complex.name = id; + } + metadata.format = 'pdb'; + } + _parseTITLE(stream) { + const { + metadata + } = this._complex; + metadata.title = metadata.title || []; + const line = stream.readInt(9, 10) || 1; + metadata.title[line - 1] = stream.readString(11, 80).trim(); + } + static tagParsers = (() => ({ + HEADER: PDBParser.prototype._parseHEADER, + 'TITLE ': PDBParser.prototype._parseTITLE, + 'ATOM ': PDBParser.prototype._parseATOM, + HETATM: PDBParser.prototype._parseATOM, + ENDMDL: PDBParser.prototype._parseENDMDL, + CONECT: PDBParser.prototype._parseCONECT, + COMPND: PDBParser.prototype._parseCOMPND, + REMARK: PDBParser.prototype._parseREMARK, + // 'SOURCE': PDBParser.prototype._parseSOURCE, + 'HELIX ': PDBParser.prototype._parseHELIX, + 'SHEET ': PDBParser.prototype._parseSHEET, + // nonstandard extension to allow range 100,000 - 999,999 + 'ATOM 1': PDBParser.prototype._parseATOM, + 'ATOM 2': PDBParser.prototype._parseATOM, + 'ATOM 3': PDBParser.prototype._parseATOM, + 'ATOM 4': PDBParser.prototype._parseATOM, + 'ATOM 5': PDBParser.prototype._parseATOM, + 'ATOM 6': PDBParser.prototype._parseATOM, + 'ATOM 7': PDBParser.prototype._parseATOM, + 'ATOM 8': PDBParser.prototype._parseATOM, + 'ATOM 9': PDBParser.prototype._parseATOM + }))(); + parseSync() { + const stream = new parsers_PDBStream(this._data); + const result = this._complex = new PDBParser_Complex(); + + // parse PDB line by line + while (!stream.end()) { + const tag = stream.readString(1, TAG_LENGTH); + const func = PDBParser.tagParsers[tag]; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isFunction(func)) { + func.call(this, stream); + } + stream.next(); + } + + // Resolve indices and serials to objects + this._finalize(); + + // cleanup + this._serialAtomMap = null; + this._sheet = null; + this._residue = null; + this._chain = null; + this._complex = null; + if (result.getAtomCount() === 0) { + throw new Error('The data does not contain valid atoms'); + } + return result; } +} +PDBParser.formats = ['pdb']; +PDBParser.extensions = ['.pdb', '.ent']; +/* harmony default export */ const parsers_PDBParser = (PDBParser); +;// CONCATENATED MODULE: ./src/io/parsers/CMLParser.js - var self = this; - this._showMessage('Viewer is being initialized...'); - try { - this._initGfx(); - this._initListeners(); +const { + Complex: CMLParser_Complex, + Element: CMLParser_Element, + SGroup: CMLParser_SGroup, + Bond: CMLParser_Bond +} = chem; +const cOrderCharCodes = { + A: 0, + S: 1, + D: 2, + T: 3 +}; +const cmlStartRegexp = /\s*<\?xml\b[^?>]*\?>\s*<(?:cml|molecule)\b/i; +class CMLParser extends Parser { + constructor(data, options) { + super(data, options); + this._complex = null; + this._residue = null; + this._serialAtomMap = null; + this._modelId = 1; + this._lastMolId = -1; + this._readOnlyOneMolecule = false; + this._options.fileType = 'cml'; + } + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(data) && cmlStartRegexp.test(data); + } + _rebuidBondIndexes(atoms, bonds) { + const count = atoms.length; + for (let i = 0; i < count; i++) { + const atomId = atoms[i].id; + const countBonds = bonds.length; + for (let j = 0; j < countBonds; j++) { + const idxs = bonds[j].atomRefs2.split(' '); + if (idxs[0] === atomId) { + bonds[j].start = i; + } + if (idxs[1] === atomId) { + bonds[j].end = i; + } + } + } + } + _createSGroup(molecule, moleculeArr) { + const newGroup = new CMLParser_SGroup(molecule.id, molecule.fieldData, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(parseFloat(molecule.x), parseFloat(molecule.y), 0), molecule.atomRefs, molecule); + if (molecule.placement === 'Relative') { + newGroup._center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0); + } + if (molecule.fieldName === 'MDLBG_FRAGMENT_CHARGE') { + newGroup._charge = parseInt(molecule.fieldData, 10) || 0; + } + if (molecule.fieldName === 'MDLBG_FRAGMENT_COEFFICIENT') { + newGroup._repeat = parseInt(molecule.fieldData, 10) || 1; + } + moleculeArr.push(newGroup); + } + _extractSGroup(molecule, moleculeArr) { + if (!Array.isArray(moleculeArr)) { + moleculeArr = []; + } + if (molecule) { + if (Array.isArray(molecule)) { + const count = molecule.length; + for (let i = 0; i < count; i++) { + if (molecule[i].molecule) { + moleculeArr = moleculeArr.concat(this._extractSGroup(molecule[i].molecule)); + } + this._createSGroup(molecule[i], moleculeArr); + } + } else { + if (molecule.molecule) { + if (molecule.molecule) { + moleculeArr = moleculeArr.concat(this._extractSGroup(molecule.molecule)); + } + } + this._createSGroup(molecule, moleculeArr); + } + } + return moleculeArr; + } + _extractSGroups(molecule, atoms) { + const moleculeArr = this._extractSGroup(molecule); + const count = atoms.length; + let i; + let j; + for (i = 0; i < count; i++) { + const atomId = atoms[i].id; + for (j = 0; j < moleculeArr.length; j++) { + const firstAtomRef = moleculeArr[j]._atoms.split(' ')[0]; + if (firstAtomRef === atomId) { + if (!atoms[i].sgroupRef) { + atoms[i].sgroupRef = []; + } + atoms[i].sgroupRef.push(moleculeArr[j]); + } + } + } + // build sGroups centers + let atomMap = {}; // sgrpmap cache + let mapEntry = null; + const nLimon = 100000000; + const bLow = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(nLimon, nLimon, nLimon); + const bHight = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-nLimon, -nLimon, -nLimon); + function cycleFuncInner(e) { + mapEntry = atomMap[e]; + if (mapEntry) { + moleculeArr[j]._atoms.push(mapEntry.a); + } + } + function cycleFunc(e) { + mapEntry = atomMap[e]; + if (mapEntry) { + bLow.set(Math.min(bLow.x, mapEntry.x), Math.min(bLow.y, mapEntry.y), Math.min(bLow.z, mapEntry.z)); + bHight.set(Math.max(bHight.x, mapEntry.x), Math.max(bHight.y, mapEntry.y), Math.max(bHight.z, mapEntry.z)); + cycleFuncInner(e); + } + } + for (i = 0; i < atoms.length; i++) { + atomMap[atoms[i].id] = {}; + atomMap[atoms[i].id].x = atoms[i].x2; + if (atoms[i].x3) { + atomMap[atoms[i].id].x = atoms[i].x3; + } + atomMap[atoms[i].id].x = parseFloat(atomMap[atoms[i].id].x); + atomMap[atoms[i].id].y = atoms[i].y2; + if (atoms[i].y3) { + atomMap[atoms[i].id].y = atoms[i].y3; + } + atomMap[atoms[i].id].y = parseFloat(atomMap[atoms[i].id].y); + atomMap[atoms[i].id].z = '0.0'; + if (atoms[i].z3) { + atomMap[atoms[i].id].z = atoms[i].z3; + } + atomMap[atoms[i].id].z = parseFloat(atomMap[atoms[i].id].z); + atomMap[atoms[i].id].a = atoms[i]; + } + let atomsRef; + for (j = 0; j < moleculeArr.length; j++) { + if (moleculeArr[j]._center !== null) { + bLow.set(nLimon, nLimon, nLimon); + bHight.set(-nLimon, -nLimon, -nLimon); + atomsRef = moleculeArr[j]._atoms.split(' '); + moleculeArr[j]._atoms = []; + atomsRef.forEach(cycleFunc); + moleculeArr[j]._center.addVectors(bLow, bHight); + moleculeArr[j]._center.multiplyScalar(0.5); + } else { + atomsRef = moleculeArr[j]._atoms.split(' '); + moleculeArr[j]._atoms = []; + atomsRef.forEach(cycleFuncInner); + } + } + atomMap = null; + } + _traverseData(dom) { + function isArray(o) { + return Object.prototype.toString.apply(o) === '[object Array]'; + } + function parseNode(xmlNode, result) { + if (xmlNode.nodeName === '#text' && xmlNode.nodeValue.trim() === '') { + return; + } + const jsonNode = {}; + jsonNode.xmlNode = xmlNode; + const existing = result[xmlNode.nodeName]; + if (existing) { + if (!isArray(existing)) { + result[xmlNode.nodeName] = [existing, jsonNode]; + } else { + result[xmlNode.nodeName].push(jsonNode); + } + } else { + result[xmlNode.nodeName] = jsonNode; + } + let length; + let i; + if (xmlNode.attributes) { + ({ + length + } = xmlNode.attributes); + for (i = 0; i < length; i++) { + const attribute = xmlNode.attributes[i]; + jsonNode[attribute.nodeName] = attribute.nodeValue; + } + } + ({ + length + } = xmlNode.childNodes); + for (i = 0; i < length; i++) { + parseNode(xmlNode.childNodes[i], jsonNode); + } + } + const result = {}; + if (dom.childNodes.length) { + parseNode(dom.childNodes[0], result); + } + return result; + } + _findSuitableMolecule(data, molSet) { + for (const key in data) { + if (key === 'xmlNode') { + continue; + } else if (key === 'molecule') { + if (data.molecule) { + if (data.molecule.atomArray && data.molecule.atomArray.atom) { + molSet.push(data); + } + if (Array.isArray(data.molecule)) { + for (let i = 0; i < data.molecule.length; i++) { + if (data.molecule[i].atomArray && data.molecule[i].atomArray.atom) { + molSet.push({ + molecule: data.molecule[i] + }); + } + } + } + } + } else if (data[key] && data[key] !== null && typeof data[key] === 'object') { + this._findSuitableMolecule(data[key], molSet); + } + } + } + _selectComponents(text) { + const parser = new DOMParser(); + const doc = parser.parseFromString(text, 'application/xml'); + const traversedData = this._traverseData(doc); + let rawData; + const self = this; + function prepareComponentCompound(data) { + let atoms = []; + if (data.molecule && data.molecule.atomArray && data.molecule.atomArray.atom) { + if (!Array.isArray(data.molecule.atomArray.atom)) { + atoms.push(data.molecule.atomArray.atom); + } else { + atoms = data.molecule.atomArray.atom; + } + } else if (!data.molecule) { + const ret = {}; + ret.atomLabels = null; + ret.labelsCount = 1; + return ret; + } + if (data.molecule.molecule) { + self._extractSGroups(data.molecule.molecule, atoms); + } + let atom; + let count = atoms.length; + for (let i = 0; i < count; i++) { + atom = atoms[i]; + atom.edges = []; + } + let localBond = []; + if (data.molecule.bondArray && data.molecule.bondArray.bond) { + if (!Array.isArray(data.molecule.bondArray.bond)) { + localBond.push(data.molecule.bondArray.bond); + } else { + localBond = data.molecule.bondArray.bond; + } + } + let bond; + count = localBond.length; + self._rebuidBondIndexes(atoms, localBond); + function addCurrBond(index) { + bond = localBond[index]; + atom = atoms[bond.start]; + if (!atom) { + return false; + } + atom.edges.push(bond.end); + atom = atoms[bond.end]; + if (!atom) { + return false; + } + atom.edges.push(bond.start); + return true; + } + for (let i = 0; i < count; i++) { + if (!addCurrBond(i)) { + // ignore invalid bond + continue; + } + const orderAttr = bond.xmlNode.getAttribute('order'); + const tc = parseInt(orderAttr, 10); + // the default bond order is unknown + localBond[i].order = 0; + localBond[i].type = CMLParser_Bond.BondType.UNKNOWN; + if (tc > 1) { + localBond[i].order = tc; + } else { + // another option - bond order is a string + const order = cOrderCharCodes[orderAttr]; + if (order !== undefined) { + localBond[i].order = order; + if (orderAttr === 'A') { + localBond[i].type = CMLParser_Bond.BondType.AROMATIC; + } + } + } + } + count = atoms.length; + for (let i = 0; i < count; i++) { + atom = atoms[i]; + atom.edges.sort(); + } + const labels = self._breadWidthSearch(atoms, 0); // for now - this._spinner = new Spinner({ - lines: 13, - length: 28, - width: 14, - radius: 42, - color: '#fff', - zIndex: 700 - }); - window.top.addEventListener('keydown', function (event) { - self._onKeyDown(event); - }); - window.top.addEventListener('keyup', function (event) { - self._onKeyUp(event); - }); - this._objectControls = new ObjectControls(this._gfx.root, this._gfx.pivot, this._gfx.camera, this._gfx.renderer.domElement, function () { - return self._getAltObj(); + const retStruct = {}; + retStruct.atoms = atoms; + retStruct.bonds = localBond; + retStruct.labels = labels.atomLabels; + retStruct.count = Math.min(1, labels.labelsCount); // for now + retStruct.curr = -1; + retStruct.originalCML = doc; + return retStruct; + } + if (traversedData.cml) { + rawData = traversedData.cml; + } else { + rawData = traversedData; + } + const retData = []; + const filteredData = []; + this._findSuitableMolecule(rawData, filteredData); + if (this._readOnlyOneMolecule && filteredData.length > 1) { + filteredData.splice(1, filteredData.length - 1); + } + filteredData.forEach(d => { + const rd = prepareComponentCompound(d); + if (rd.atoms.length > 0) { + retData.push(rd); + } }); - - this._objectControls.addEventListener('change', function (e) { - if (settings.now.shadow.on) { - self._updateShadowCamera(); - } // route rotate, zoom, translate and translatePivot events to the external API - - - switch (e.action) { - case 'rotate': - self.dispatchEvent({ - type: 'rotate', - quaternion: e.quaternion - }); - break; - - case 'zoom': - self.dispatchEvent({ - type: 'zoom', - factor: e.factor - }); + return retData; + } + _packLabel(compId, molId) { + const shift = 16; + return (molId << shift) + compId; + } + _unpackLabel(l) { + const shift = 16; + const mask = (1 << shift) - 1; + return { + molId: l >>> shift, + compId: l & mask + }; + } + _breadWidthSearch(atoms, molID) { + const atomLabels = new Array(atoms.length); + let id; + for (id = 0; id < atomLabels.length; id++) { + atomLabels[id] = this._packLabel(0, molID); + } + const breadthQueue = []; + let componentID = 0; + let labeledAtoms = atoms.length; + while (labeledAtoms > 0) { + componentID++; + let startID = -1; + for (id = 0; id < atomLabels.length; id++) { + if (this._unpackLabel(atomLabels[id]).compId === 0) { + startID = id; break; + } + } + if (startID < 0) { + break; + } - default: - self.dispatchEvent({ - type: e.action - }); + // Bread first search + breadthQueue.push(atoms[startID]); + atomLabels[startID] = this._packLabel(componentID, molID); + labeledAtoms--; + while (breadthQueue.length > 0) { + const curr = breadthQueue.shift(); + if (!curr) { + continue; + } + for (let i = 0; i < curr.edges.length; i++) { + if (atomLabels[curr.edges[i]] !== componentID) { + breadthQueue.push(atoms[curr.edges[i]]); + atomLabels[curr.edges[i]] = componentID; + labeledAtoms--; + } + } } + } + const ret = {}; + ret.atomLabels = atomLabels; + ret.labelsCount = componentID; + return ret; + } + _parseBond(eAtom, mainAtom, order, type) { + if (eAtom >= 0) { + const h = [Math.min(eAtom, mainAtom), Math.max(eAtom, mainAtom)]; + this._complex.addBond(h[0], h[1], order, type, true); + } + } + _fixBondsArray() { + const serialAtomMap = this._serialAtomMap = {}; + const complex = this._complex; + const atoms = complex._atoms; + for (let i = 0, ni = atoms.length; i < ni; ++i) { + const atom = atoms[i]; + serialAtomMap[atom.serial] = atom; + } + const bonds = complex._bonds; + const { + logger + } = this; + for (let j = 0, nj = bonds.length; j < nj; ++j) { + const bond = bonds[j]; + if (bond._right < bond._left) { + logger.debug('_fixBondsArray: Logic error.'); + } + bond._left = serialAtomMap[bond._left] || null; + bond._right = serialAtomMap[bond._right] || null; + } + } + _parseSet(varData) { + const complex = this._complex = new CMLParser_Complex(); + const data = varData; + const currentLabel = data.curr; + const { + atoms, + labels + } = data; + let atom = null; + let i; + let j; + const count = atoms.length; + function addFunc(a) { + a.xmlNodeRef = atom; + if (atom.x2) { + atom.x3 = atom.x2; + delete atom.x2; + } + if (atom.y2) { + atom.y3 = atom.y2; + delete atom.y2; + } + if (!atom.z3) { + atom.z3 = '0.0'; + } + atom.complexAtom = a; + } + let chains = {}; + // parse atoms in label order + const reorder = []; + for (i = 0; i < count; i++) { + reorder.push(i); + } + reorder.sort((a, b) => labels[a] - labels[b]); + for (i = 0; i < count; i++) { + const atomCharge = 0; + const lLabel = labels[reorder[i]]; + if (this._unpackLabel(lLabel).molId === this._unpackLabel(currentLabel).molId) { + atom = atoms[reorder[i]]; + const atomFullNameStruct = atom.elementType; + if (atom.sgroupRef) { + const countRef = atom.sgroupRef.length; + for (let k = 0; k < countRef; ++k) { + complex._sgroups.push(atom.sgroupRef[k]); + } + } + if (atom.x3 || atom.x2) { + const currAtomComp = this._unpackLabel(lLabel).compId; + // use ' ' by default instead of synthetic creation of chain names + const chainID = ' '; //= String.fromCharCode('A'.charCodeAt(0) + currAtomComp); + const resSeq = currAtomComp; + const iCode = ' '; + let strLabel = currAtomComp.toString(); + if (strLabel.length === 1) { + strLabel = `0${strLabel}`; + } + const resName = `N${strLabel}`; + let chain = chains[chainID]; + if (!chain || chain.getName() !== chainID) { + chains[chainID] = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); + this._residue = null; + } + let residue = this._residue; + if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { + this._residue = residue = chain.addResidue(resName, resSeq, iCode); + } - self.dispatchEvent({ - type: 'transform' - }); - self._needRender = true; + // _x, _y, _z, mname, mindex, atomNameFull, atomName, chainID, serial, isHet, atlLocInd, atomNameToTypeF + let xyz = null; + if (atom.x3) { + xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(parseFloat(atom.x3), parseFloat(atom.y3), parseFloat(atom.z3)); + } else if (atom.x2) { + xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(parseFloat(atom.x2), parseFloat(atom.y2), 0); + } + let element = CMLParser_Element.ByName[atom.elementType.toUpperCase()]; + if (!element) { + element = JSON.parse(JSON.stringify(CMLParser_Element.ByName[Object.keys(CMLParser_Element.ByName)[Object.keys(CMLParser_Element.ByName).length - 1]])); + element.number += 1; + element.name = atom.elementType.toUpperCase(); + element.fullName = 'Unknown'; + CMLParser_Element.ByName[atom.elementType.toUpperCase()] = element; + } + const atomSerial = parseInt(atom.id.replace(/[^0-9]/, ''), 10); + const added = residue.addAtom(atomFullNameStruct, element, xyz, CMLParser_Element.Role.SG, true, atomSerial, ' ', 1.0, 0.0, atomCharge); + if (atom.hydrogenCount) { + added.hydrogenCount = parseInt(atom.hydrogenCount, 10); + } + if (atom.mrvValence) { + added.valence = parseInt(atom.mrvValence, 10); + } + addFunc(added); + } + } + } + chains = null; // NOSONAR + for (i = 0; i < data.bonds.length; i++) { + const cb = data.bonds[i]; + if (this._unpackLabel(labels[cb.start]).molId === this._unpackLabel(currentLabel).molId && this._unpackLabel(labels[cb.end]).molId === this._unpackLabel(currentLabel).molId) { + atom = atoms[cb.start]; + if (!atom || !atoms[cb.end]) { + continue; // skip invalid + } + this._parseBond(parseInt(atom.id.replace(/[^0-9]/, ''), 10), parseInt(atoms[cb.end].id.replace(/[^0-9]/, ''), 10), cb.order, cb.type); + } + } + for (i = 0; i < this._complex.getSGroupCount(); i++) { + const sGrp = this._complex.getSGroups()[i]; + for (j = 0; j < sGrp._atoms.length; j++) { + sGrp._atoms[j] = sGrp._atoms[j].complexAtom; + } + } + for (i = 0; i < count; i++) { + if (this._unpackLabel(labels[i]).molId === this._unpackLabel(currentLabel).molId) { + atom = atoms[i]; + atom.complexAtom = null; + delete atom.complexAtom; + } + } + this._complex.originalCML = data.originalCML; + this._fixBondsArray(); + complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap }); - - var gfx = this._gfx; - this._picker = new Picker(gfx.root, gfx.camera, gfx.renderer.domElement); - - this._picker.addEventListener('newpick', function (event) { - self._onPick(event); + this._serialAtomMap = null; + this._complex = null; + return complex; + } + parseSync() { + const complexes = []; + const self = this; + const moleculaSet = this._selectComponents(this._data); + moleculaSet.forEach(molSet => { + molSet.curr = 2; + if (molSet.count === 0) { + molSet.count = 1; + } + for (let i = 0; i < molSet.count; i++) { + molSet.curr = i + 1; + complexes.push(self._parseSet(molSet, false)); + } }); - - this._picker.addEventListener('dblclick', function (event) { - self.center(event); + let totalAtomsParsed = 0; + complexes.forEach(c => { + totalAtomsParsed += c.getAtomCount(); }); - } catch (error) { - if (error.name === 'TypeError' && error.message === 'Cannot read property \'getExtension\' of null') { - this._showMessage('Could not create WebGL context.'); - } else if (error.message.search(/webgl/i) > 1) { - this._showMessage(error.message); - } else { - this._showMessage('Viewer initialization failed.'); - - throw error; + if (totalAtomsParsed <= 0) { + throw new Error('The data does not contain valid atoms'); } - - return false; - } // automatically load default file - - - var file = this._opts && this._opts.load; - - if (file) { - var type = this._opts && this._opts.type; - this.load(file, { - fileType: type, - keepRepsInfo: true - }); + if (complexes.length > 1) { + const joinedComplex = new CMLParser_Complex(); + joinedComplex.joinComplexes(complexes); + joinedComplex.originalCML = complexes[0].originalCML; + return joinedComplex; + } + if (complexes.length === 1) { + return complexes[0]; + } + return new CMLParser_Complex(); } +} +CMLParser.formats = ['cml']; +CMLParser.extensions = ['.cml']; +/* harmony default export */ const parsers_CMLParser = (CMLParser); +// EXTERNAL MODULE: ./vendor/js/mmtf.js +var mmtf = __webpack_require__(660); +var mmtf_default = /*#__PURE__*/__webpack_require__.n(mmtf); +;// CONCATENATED MODULE: ./src/io/parsers/MMTFParser.js - return true; -}; -/** - * Terminate the viewer completely. - * @see Miew#init - */ - - -Miew.prototype.term = function () { - this._showMessage('Viewer has been terminated.'); - - this._loading.forEach(function (job) { - job.cancel(); - }); - - this._loading.length = 0; - this.halt(); - this._gfx = null; -}; -/** - * Display message inside the viewer container, hiding WebGL canvas. - * @param {string} msg - Message to show. - * @private - */ - - -Miew.prototype._showMessage = function (msg) { - var element = document.createElement('div'); - element.setAttribute('class', 'miew-message'); - element.appendChild(document.createElement('p')).appendChild(document.createTextNode(msg)); - - _setContainerContents(this._container, element); -}; -/** - * Display WebGL canvas inside the viewer container, hiding any message shown. - * @private - */ -Miew.prototype._showCanvas = function () { - _setContainerContents(this._container, this._gfx.renderer.domElement); -}; -Miew.prototype._requestAnimationFrame = function (callback) { - var xr = this._gfx.renderer.xr; - if (xr && xr.enabled) { - this._gfx.renderer.setAnimationLoop(callback); - return; +const { + Complex: MMTFParser_Complex, + Chain: MMTFParser_Chain, + Atom: MMTFParser_Atom, + Element: MMTFParser_Element, + Helix: MMTFParser_Helix, + Sheet: MMTFParser_Sheet, + Strand: MMTFParser_Strand, + Bond: MMTFParser_Bond, + Assembly: MMTFParser_Assembly, + Molecule: MMTFParser_Molecule +} = chem; +class ArrayComparator { + constructor(original) { + this._original = Array.from(original); + this._original.sort(); + this._sum = 0; + for (let i = 0; i < this._original.length; ++i) { + this._sum += this._original[i]; + } + } + compare(candidate) { + const len = candidate.length; + if (len !== this._original.length) { + return false; + } + let sum = 0; + let i; + for (i = 0; i < len; ++i) { + sum += candidate[i]; + } + if (sum !== this._sum) { + return false; + } + const sorted = Array.from(candidate); + sorted.sort(); + for (i = 0; i < len; ++i) { + if (sorted[i] !== this._original[i]) { + return false; + } + } + return true; + } +} +ArrayComparator.prototype.constructor = ArrayComparator; +const MMTFParser_StructuralElementType = chem_StructuralElement.Type; + +// see https://github.com/rcsb/mmtf-javascript/blob/master/src/mmtf-traverse.js +const secStructToType = [MMTFParser_StructuralElementType.HELIX_PI, +// 0 +MMTFParser_StructuralElementType.BEND, +// 1 +MMTFParser_StructuralElementType.HELIX_ALPHA, +// 2 +MMTFParser_StructuralElementType.STRAND, +// 3 +MMTFParser_StructuralElementType.HELIX_310, +// 4 +MMTFParser_StructuralElementType.BRIDGE, +// 5 +MMTFParser_StructuralElementType.TURN, +// 6 +MMTFParser_StructuralElementType.COIL // 7 +]; +function getFirstByte(buf) { + const bytes = new Uint8Array(buf, 0, 1); + return bytes[0]; +} +class MMTFParser extends Parser { + constructor(data, options) { + super(data, options); + this._options.fileType = 'mmtf'; + } + static canProbablyParse(data) { + // check if it's binary MessagePack format containing a map (dictionary) + // see https://github.com/msgpack/msgpack/blob/master/spec.md + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isArrayBuffer(data) && (getFirstByte(data) | 1) === 0xDF; + } + _onModel(_modelData) {} + _onChain(chainData) { + if (chainData.modelIndex !== 0) { + return; + } + const chain = new MMTFParser_Chain(this._complex, chainData.chainName); + this._complex._chains[chainData.chainIndex] = chain; + chain._index = chainData.chainIndex; + } + _onGroup(groupData) { + if (groupData.modelIndex !== 0) { + return; + } + if (this.settings.now.nowater) { + // skip water + if (groupData.groupName === 'HOH' || groupData.groupName === 'WAT') { + return; + } + } + const chain = this._complex._chains[groupData.chainIndex]; + const icode = !groupData.insCode.charCodeAt(0) ? '' : groupData.insCode; + const residue = chain.addResidue(groupData.groupName, groupData.groupId, icode); + residue._index = groupData.groupIndex; + this._updateSecStructure(this._complex, residue, groupData); + } + _onAtom(atomData) { + if (atomData.modelIndex !== 0) { + return; + } + const altLoc = !atomData.altLoc.charCodeAt(0) ? '' : atomData.altLoc; + const atom = new MMTFParser_Atom(atomData.groupIndex, + // we store residue index here to replace it later with actual reference + atomData.atomName, MMTFParser_Element.getByName(atomData.element.toUpperCase()), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(atomData.xCoord, atomData.yCoord, atomData.zCoord), MMTFParser_Element.Role[atomData.atomName], false, + // hetero atoms will be marked later + atomData.atomId, altLoc, atomData.occupancy, atomData.bFactor, atomData.formalCharge); + this._complex._atoms[atomData.atomIndex] = atom; + atom.index = atomData.atomIndex; + this._serialAtomMap[atomData.atomId] = atom; + } + _onBond(bondData) { + const right = Math.max(bondData.atomIndex1, bondData.atomIndex2); + if (right >= this._complex._atoms.length) { + return; + } + const left = Math.min(bondData.atomIndex1, bondData.atomIndex2); + this._complex.addBond(this._complex._atoms[left], this._complex._atoms[right], bondData.bondOrder, MMTFParser_Bond.BondType.UNKNOWN, true); + } + _updateSecStructure(complex, residue, groupData) { + const helixClasses = [3, -1, 1, -1, 5]; + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(groupData) && groupData.secStruct === this._ssType) { + residue._secondary = this._ssStruct; + if (this._ssStruct) { + this._ssStruct.term = residue; + } + return; + } + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(groupData)) { + // start new secondary structure + const type = secStructToType[groupData.secStruct]; + this._ssType = groupData.secStruct; + this._ssStart = residue; + let struct = null; + switch (this._ssType) { + case -1: // undefined + case 7: + // coil + break; + case 0: // pi helix + case 2: // alpha helix + case 4: + // 3-10 helix + struct = new MMTFParser_Helix(helixClasses[this._ssType], residue, residue, 0, '', '', 0); + complex._helices.push(struct); + break; + case 3: + { + // extended + const sheet = new MMTFParser_Sheet('', 0); + complex._sheets.push(sheet); + struct = new MMTFParser_Strand(sheet, residue, residue, 0, null, null); + break; + } + default: + if (type !== undefined) { + struct = new chem_StructuralElement(type, residue, residue); + } + break; + } + this._ssStruct = struct; + residue._secondary = struct; + if (struct) { + complex.structures.push(struct); + } + } + } + _updateMolecules(mmtfData) { + const entities = mmtfData.entityList; + if (!entities) { + return; + } + const chainsInModel0 = mmtfData.chainsPerModel[0]; + for (let i = 0; i < entities.length; i++) { + const entity = entities[i]; + const chains = entity.chainIndexList; + let residues = []; + for (let j = 0; j < chains.length; j++) { + const chainIndex = chains[j]; + // skip chains in models other than the first one + if (chainIndex >= chainsInModel0) { + continue; + } + const chain = this._complex._chains[chainIndex]; + residues = residues.concat(chain._residues.slice()); + } + const molecule = new MMTFParser_Molecule(this._complex, entity.description, i + 1); + molecule.residues = residues; + this._complex._molecules[i] = molecule; + } } - requestAnimationFrame(callback); -}; + // populate complex with chains, residues and atoms + _traverse(mmtfData) { + const self = this; -function arezSpritesSupported(context) { - return context.getExtension('EXT_frag_depth'); -} + // get metadata + const { + metadata + } = this._complex; + metadata.id = mmtfData.structureId; + metadata.title = []; + metadata.title[0] = mmtfData.title; + metadata.date = mmtfData.releaseDate; + metadata.format = 'mmtf'; -function isAOSupported(context) { - return context.getExtension('WEBGL_depth_texture') && context.getExtension('WEBGL_draw_buffers'); -} -/** - * Initialize WebGL and set 3D scene up. - * @private - */ + // create event callback functions + const eventCallbacks = { + onModel(modelData) { + self._onModel(modelData); + }, + onChain(chainData) { + self._onChain(chainData); + }, + onGroup(groupData) { + self._onGroup(groupData); + }, + onAtom(atomData) { + self._onAtom(atomData); + }, + onBond(bondData) { + self._onBond(bondData); + } + }; + // temporary variables used during traversal to track secondary structures + this._ssType = -1; + this._ssStruct = null; + this._ssStart = null; + + // traverse the structure and listen to the events + mmtf_default().traverse(mmtfData, eventCallbacks); + this._updateSecStructure(this._complex); + this._updateMolecules(mmtfData); + } + + // During traversal atoms and residues don't come sequentially + // so a residue for certain atom can be unavailable. Thus we + // store residue index in atom. + // This function being called after traversal replaces the index + // with actual reference, and also populates atom lists in residues. + _linkAtomsToResidues() { + for (let i = 0; i < this._complex._atoms.length; ++i) { + const atom = this._complex._atoms[i]; + const residue = this._complex._residues[atom.residue]; + atom.residue = residue; + residue._atoms.push(atom); + } + } + _findSynonymousChains() { + const named = {}; + for (let i = 0; i < this._complex._chains.length; ++i) { + const chain = this._complex._chains[i]; + const name = chain.getName(); + if (!named.hasOwnProperty(name)) { + named[name] = []; + } + named[name].push(chain._index); + } + return named; + } + + // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains. + _parseAssemblyInfo(mmtfData) { + let i; + let j; + let k; + const assemblies = []; + const { + logger + } = this; + for (i = 0; i < mmtfData.bioAssemblyList.length; ++i) { + const baInfo = mmtfData.bioAssemblyList[i]; + if (baInfo.transformList.length === 0) { + continue; + } + const chains = baInfo.transformList[0].chainIndexList; + const chainListCheck = new ArrayComparator(chains); -Miew.prototype._initGfx = function () { - var gfx = { - width: this._container.clientWidth, - height: this._container.clientHeight - }; - var webGLOptions = { - preserveDrawingBuffer: true, - alpha: true, - premultipliedAlpha: false - }; + // build list of chain names + const chainNames = {}; + for (j = 0; j < chains.length; ++j) { + chainNames[this._complex._chains[chains[j]].getName()] = 1; + } - if (settings.now.antialias) { - webGLOptions.antialias = true; - } + // all chains with the same name should belong to assembly if one of them belongs + const allChains = []; + let name; + for (name in chainNames) { + if (chainNames.hasOwnProperty(name)) { + // just concat arrays -- there should be no duplicates + Array.prototype.push.apply(allChains, this._chainsByName[name]); + } + } + if (!chainListCheck.compare(allChains)) { + // assembly is missing some of the chains + logger.debug('MMTF: Assembly is missing some of the synonymous chains. Skipping...'); + } + const a = new MMTFParser_Assembly(this._complex); - gfx.renderer2d = new CSS2DRenderer(); - gfx.renderer = new WebGLRenderer(webGLOptions); - gfx.renderer.shadowMap.enabled = settings.now.shadow.on; - gfx.renderer.shadowMap.autoUpdate = false; - gfx.renderer.shadowMap.type = PCFShadowMap; - capabilities.init(gfx.renderer); // z-sprites and ambient occlusion possibility + // add chains to assembly + for (name in chainNames) { + if (chainNames.hasOwnProperty(name)) { + a.addChain(name); + } + } - if (!arezSpritesSupported(gfx.renderer.getContext())) { - settings.set('zSprites', false); - } + // add unique matrices to assembly + a.addMatrix(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4().fromArray(baInfo.transformList[0].matrix).transpose()); + for (j = 1; j < baInfo.transformList.length; ++j) { + const transform = baInfo.transformList[j]; + if (!chainListCheck.compare(transform.chainIndexList)) { + // list of chains for this transform doesn't match that for other transforms + // this is illegal in our structure + logger.debug('MMTF: Chain lists differ for different transforms in one assembly. Skipping...'); + continue; + } + const m = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4().fromArray(transform.matrix).transpose(); - if (!isAOSupported(gfx.renderer.getContext())) { - settings.set('ao', false); + // check if matrix is already in the list + for (k = 0; k < a.matrices.length; ++k) { + if (a.matrices[k].equals(m)) { + break; + } + } + if (k === a.matrices.length) { + a.addMatrix(m); + } + } + a.finalize(); + assemblies.push(a); + } + return assemblies; } - gfx.renderer.autoClear = false; - gfx.renderer.setPixelRatio(window.devicePixelRatio); - gfx.renderer.setSize(gfx.width, gfx.height); - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - gfx.renderer.clearColor(); - gfx.renderer2d.setSize(gfx.width, gfx.height); - gfx.camera = new PerspectiveCamera(settings.now.camFov, gfx.width / gfx.height, settings.now.camNear, settings.now.camFar); - gfx.camera.setMinimalFov(settings.now.camFov); - gfx.camera.position.z = settings.now.camDistance; - gfx.camera.updateProjectionMatrix(); - gfx.camera.layers.set(gfxutils.LAYERS.DEFAULT); - gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME); - gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME_BFPLANE); - gfx.stereoCam = new StereoCamera(); - gfx.scene = new Scene(); - var color = chooseFogColor(); - gfx.scene.fog = new Fog(color, settings.now.camNear, settings.now.camFar); - gfx.root = new gfxutils.RCGroup(); - gfx.scene.add(gfx.root); - gfx.pivot = new gfxutils.RCGroup(); - gfx.root.add(gfx.pivot); - gfx.selectionScene = new Scene(); - gfx.selectionRoot = new Group(); - gfx.selectionRoot.matrixAutoUpdate = false; - gfx.selectionScene.add(gfx.selectionRoot); - gfx.selectionPivot = new Group(); - gfx.selectionPivot.matrixAutoUpdate = false; - gfx.selectionRoot.add(gfx.selectionPivot); - var light12 = new DirectionalLight(0xffffff, 0.45); - light12.position.set(0, 0.414, 1); - light12.layers.enable(gfxutils.LAYERS.TRANSPARENT); - light12.castShadow = true; - light12.shadow = new DirectionalLightShadow(); - light12.shadow.bias = 0.09; - light12.shadow.radius = settings.now.shadow.radius; - light12.shadow.camera.layers.set(gfxutils.LAYERS.SHADOWMAP); - var pixelRatio = gfx.renderer.getPixelRatio(); - var shadowMapSize = Math.max(gfx.width, gfx.height) * pixelRatio; - light12.shadow.mapSize.width = shadowMapSize; - light12.shadow.mapSize.height = shadowMapSize; - light12.target.position.set(0.0, 0.0, 0.0); - gfx.scene.add(light12); - gfx.scene.add(light12.target); - var light3 = new AmbientLight(0x666666); - light3.layers.enable(gfxutils.LAYERS.TRANSPARENT); - gfx.scene.add(light3); // add axes - - gfx.axes = new Axes(gfx.root, gfx.camera); - var deviceWidth = gfx.width * pixelRatio; - var deviceHeight = gfx.height * pixelRatio; - gfx.offscreenBuf = new WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: LinearFilter, - magFilter: NearestFilter, - format: RGBAFormat, - depthBuffer: true - }); - - if (gfx.renderer.getContext().getExtension('WEBGL_depth_texture')) { - gfx.offscreenBuf.depthTexture = new DepthTexture(); - gfx.offscreenBuf.depthTexture.type = UnsignedShortType; + // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains. + _markHeteroAtoms(mmtfData) { + const chainsInModel0 = mmtfData.chainsPerModel[0]; + for (let i = 0; i < mmtfData.entityList.length; ++i) { + const entity = mmtfData.entityList[i]; + if (entity.type !== 'polymer') { + for (let j = 0; j < entity.chainIndexList.length; ++j) { + const chainIndex = entity.chainIndexList[j]; + // skip chains in models other than the first one + if (chainIndex >= chainsInModel0) { + continue; + } + const chain = this._complex._chains[chainIndex]; + for (let k = 0; k < chain._residues.length; ++k) { + const res = chain._residues[k]; + for (let m = 0; m < res._atoms.length; ++m) { + res._atoms[m].het = true; + } + } + } + } + } } - gfx.offscreenBuf2 = new WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: LinearFilter, - magFilter: LinearFilter, - format: RGBAFormat, - depthBuffer: false - }); - gfx.offscreenBuf3 = new WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: LinearFilter, - magFilter: LinearFilter, - format: RGBAFormat, - depthBuffer: false - }); - gfx.offscreenBuf4 = new WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: LinearFilter, - magFilter: LinearFilter, - format: RGBAFormat, - depthBuffer: false - }); - gfx.volBFTex = gfx.offscreenBuf3; - gfx.volFFTex = gfx.offscreenBuf4; - gfx.volWFFTex = gfx.offscreenBuf; // use float textures for volume rendering if possible + // joins chains with the same name into single chain + _joinSynonymousChains() { + let i; + let j; + const primaryChainsArray = []; + const primaryChainsHash = {}; + + // join chains + for (i = 0; i < this._complex._chains.length; ++i) { + const chain = this._complex._chains[i]; + const name = chain.getName(); + if (!primaryChainsHash.hasOwnProperty(name)) { + // new name -- this is a primary chain + primaryChainsHash[name] = chain; + chain._index = primaryChainsArray.length; // update index as this array will later replace original chain list + primaryChainsArray.push(chain); + continue; + } - if (gfx.renderer.getContext().getExtension('OES_texture_float')) { - gfx.offscreenBuf5 = new WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: LinearFilter, - magFilter: LinearFilter, - format: RGBAFormat, - type: FloatType, - depthBuffer: false - }); - gfx.offscreenBuf6 = new WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: LinearFilter, - magFilter: LinearFilter, - format: RGBAFormat, - type: FloatType, - depthBuffer: false - }); - gfx.offscreenBuf7 = new WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: LinearFilter, - magFilter: LinearFilter, - format: RGBAFormat, - type: FloatType, - depthBuffer: true + // this chain should be joined with the primary chain of the same name + const primary = primaryChainsHash[name]; + for (j = 0; j < chain._residues.length; ++j) { + const residue = chain._residues[j]; + primary._residues.push(residue); + residue._chain = primary; + } + } + + // replace chains list with one containing only primary chains + // dropping references to all chains but primary + this._complex._chains = primaryChainsArray; + } + parseSync() { + const mmtfData = mmtf_default().decode(this._data); + this._complex = new MMTFParser_Complex(); + this._serialAtomMap = {}; // filled during traversal + + this._traverse(mmtfData); + this._linkAtomsToResidues(); + this._markHeteroAtoms(mmtfData); + this._chainsByName = this._findSynonymousChains(); + Array.prototype.push.apply(this._complex.units, this._parseAssemblyInfo(mmtfData)); + this._joinSynonymousChains(); + this._complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap }); - gfx.volBFTex = gfx.offscreenBuf5; - gfx.volFFTex = gfx.offscreenBuf6; - gfx.volWFFTex = gfx.offscreenBuf7; - } else { - this.logger.warn('Device doesn\'t support OES_texture_float extension'); + return this._complex; + } +} +MMTFParser.formats = ['mmtf']; +MMTFParser.extensions = ['.mmtf']; +MMTFParser.binary = true; +/* harmony default export */ const parsers_MMTFParser = (MMTFParser); +;// CONCATENATED MODULE: ./src/io/parsers/ParsingError.js +class ParsingError extends Error { + constructor(message, line, column) { + super(`data:${line}:${column}: ${message}`); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, ParsingError); + } + this.name = 'ParsingError'; + this.parseLine = line; + this.parseColumn = column; } +} +/* harmony default export */ const parsers_ParsingError = (ParsingError); +;// CONCATENATED MODULE: ./src/io/parsers/readCIF.js - gfx.stereoBufL = new WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: LinearFilter, - magFilter: LinearFilter, - format: RGBAFormat, - depthBuffer: false - }); - gfx.stereoBufR = new WebGLRenderTarget(deviceWidth, deviceHeight, { - minFilter: LinearFilter, - magFilter: LinearFilter, - format: RGBAFormat, - depthBuffer: false - }); - this._gfx = gfx; - this._showCanvas(); - this._embedWebXR(settings.now.stereo === 'WEBVR'); +// Implemented and being tested against: https://www.iucr.org/resources/cif/spec/version1.1/cifsyntax + +function _isWhitespace(ch) { + return ch === 32 || ch === 10 || ch === 13 || ch === 9; +} +function _inlineIndexOf(ch0, str, idx) { + const len = str.length; + let ch = -1; + while (idx < len) { + ch = str.charCodeAt(idx); + if (ch === ch0 || ch === 10) { + break; + } + ++idx; + } + return ch === ch0 ? idx : -1; +} +function readCIF(source) { + let i = 0; + let j = 0; + const n = source.length; + let code = NaN; + let newline = true; + let line = 1; + let column = 1; + let begin; + let state = 0; // 0 - start, 1 - block, 2 - item, 3 - loop, 4 - values, 5 - value + const result = {}; + let block = {}; + let keys = []; + let keysCount = 0; + let key = ''; + let values = []; + let valuesCount = 0; + let value; + function _parseValue() { + let val; + if ((code === 46 || code === 63) && (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))) { + // '.' or '?' ..... + // it's a missing value + ++column; + ++i; + return undefined; + } + if (newline && code === 59) { + // ';' ...................................................................... + // parse multi-line string + j = i; + let lines = 0; + do { + j = _inlineIndexOf(10, source, j + 1); // '\n' + if (j === -1) { + throw new parsers_ParsingError('Unterminated text block found', line, column); + } + ++lines; + } while (j + 1 < n && source.charCodeAt(j + 1) !== code || j + 1 >= n); + val = source.substring(i + 1, j).replace(/\r/g, ''); + i = j + 2; + line += lines; + column = 1; + newline = false; + return val; + } + if (code === 39 || code === 34) { + // ''' or '"' ........................................................... + // parse quoted string + j = i; + do { + j = _inlineIndexOf(code, source, j + 1); + if (j === -1) { + throw new parsers_ParsingError('Unterminated quoted string found', line, column); + } + } while (j + 1 < n && !_isWhitespace(source.charCodeAt(j + 1))); + val = source.substring(i + 1, j); + column += j - i + 1; + i = j + 1; + return val; + } // ...................................................................................................... + // parse until the first whitespace + j = i; + while (j < n && !_isWhitespace(source.charCodeAt(j))) { + ++j; + } + val = source.substring(i, j); + column += j - i; + i = j; + // try to convert to a number + const num = Number(val); + if (!Number.isNaN(num)) { + return num; + } + // or leave as an unquoted string + return val; + } + function _storeKey(tag) { + keys[keysCount++] = tag; + } + function _storeValue(val) { + const keyIndex = valuesCount % keysCount; + values[keyIndex].push(val); + ++valuesCount; + return val; + } + while (i <= n) { + code = source.charCodeAt(i); // 'NaN' in place of '' + if (code === 13) {// '\r' ....................................................................................... + // just ignore + } else if (code === 10) { + // '\n' ................................................................................ + // take note of new lines + newline = true; + ++line; + column = 1; + } else { + // process inline characters + if (code === 32 || code === 9) {// ' ' or '\t' ................................................................ + // just ignore + } else if (code === 35) { + // '#' ............................................................................... + // skip the comment until before the end of the line + i = _inlineIndexOf(10, source, i + 1); // '\n' + if (i === -1) { + break; + } else { + continue; // don't forget to process the new line + } + } else if (state === 0) { + // start ============================================================================= + if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { + // 'data_' .......... + j = i + 5; + begin = j; + while (j < n && !_isWhitespace(source.charCodeAt(j))) { + ++j; + } + column += j - i; + i = j; + if (begin < i) { + // add new data block + result[source.substring(begin, i)] = block = {}; + state = 1; // block + continue; // don't forget to process the whitespace + } else { + throw new parsers_ParsingError('Data block name missing', line, column); + } + } else if (Number.isNaN(code)) { + // .................................................................... + break; + } else { + // .................................................................................................. + throw new parsers_ParsingError(`Unexpected character in state ${state}`, line, column); + } + } else if (state === 1) { + // block ============================================================================= + if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { + // 'data_' .......... + state = 0; // start + continue; // parse again in a different state + } else if (code === 95) { + // '_' ............................................................................. + j = i + 1; + begin = j; + while (j < n && !_isWhitespace(source.charCodeAt(j))) { + ++j; + } + column += j - i; + i = j; + if (begin < i) { + // start new item + key = source.substring(begin, i); + state = 2; // item + continue; // don't forget to process the whitespace + } else { + throw new parsers_ParsingError('Tag name missing', line, column); + } + } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { + // 'loop_' ... + i += 5; + column += 5; + if (i < n && !_isWhitespace(source.charCodeAt(i))) { + throw new parsers_ParsingError(`Unexpected character in state ${state}`, line, column); + } else { + // start new loop + keys = []; + keysCount = 0; + values = []; + valuesCount = 0; + state = 3; // loop + continue; // don't forget to process the whitespace + } + } else if (Number.isNaN(code)) { + // .................................................................... + break; + } else { + // .................................................................................................. + throw new parsers_ParsingError(`Unexpected character in state ${state}`, line, column); + } + } else if (state === 2) { + // item ============================================================================== + if (Number.isNaN(code)) { + break; + } + value = _parseValue(); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].set(block, key, value); + state = 1; // block + continue; + } else if (state === 3) { + // loop ============================================================================== + if (code === 95) { + // '_' .................................................................................... + j = i + 1; + begin = j; + while (j < n && !_isWhitespace(source.charCodeAt(j))) { + ++j; + } + column += j - i; + i = j; + if (begin < i) { + // add new key + _storeKey(source.substring(begin, i)); + continue; // don't forget to process the whitespace + } else { + throw new parsers_ParsingError('Tag name missing', line, column); + } + } else { + // .................................................................................................. + if (keysCount > 0) { + for (let keyIndex = 0; keyIndex < keysCount; ++keyIndex) { + value = []; + values[keyIndex] = value; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].set(block, keys[keyIndex], value); + } + state = 4; + continue; // parse again in a different state + } + throw new parsers_ParsingError('Data tags are missing inside a loop', line, column); + } + } else if (state === 4) { + // values ============================================================================ + if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { + // 'data_' .......... + state = 0; // start + } else if (code === 95) { + // '_' ............................................................................. + state = 1; // block + } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { + // 'loop_' ... + state = 1; // block + } else if (Number.isNaN(code)) { + // .................................................................... + state = 0; + } else { + // .................................................................................................. + _storeValue(_parseValue()); + } + continue; // parse again in a different state + } else { + // ==================================================================================================== + throw new parsers_ParsingError(`Unexpected internal state ${state}`, line, column); + } + newline = false; + ++column; + } + ++i; + } + if (state === 2) { + // item + throw new parsers_ParsingError(`Unexpected end of file in state ${state}`, line, column); + } + return result; +} +;// CONCATENATED MODULE: ./src/io/parsers/CIFParser.js - this._container.appendChild(gfx.renderer2d.getElement()); // add FPS counter - var stats = new Stats(); - stats.domElement.style.position = 'absolute'; - stats.domElement.style.right = '0'; - stats.domElement.style.bottom = '0'; - this._container.appendChild(stats.domElement); - this._fps = stats; - this._fps.show(settings.now.fps); +const { + Complex: CIFParser_Complex, + Element: CIFParser_Element, + Helix: CIFParser_Helix, + Sheet: CIFParser_Sheet, + Strand: CIFParser_Strand, + Assembly: CIFParser_Assembly, + Molecule: CIFParser_Molecule +} = chem; +const cRequiredAtomFields = ['auth_seq_id', 'Cartn_x', 'Cartn_y', 'Cartn_z', 'label_atom_id']; +const cSecondaryCoding = { + helx: 'helix', + turn: 'turn', + strn: 'strand' }; +function getTypeFromId(string) { + const typeId = /[A-Za-z]+/.exec(string); + if (!typeId) { + return null; + } + return cSecondaryCoding[typeId[0].toLowerCase()]; +} + /** - * Setup event listeners. - * @private + * Make valid object an array + * @param arrayLikeObject + * @return {array, object} array or object */ +function arrize(arrayLikeObject) { + if (arrayLikeObject === null || arrayLikeObject === undefined || external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isArray(arrayLikeObject)) { + return arrayLikeObject; + } + return [arrayLikeObject]; +} +function CIFParser_nameToElement(name) { + // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM + // + // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1 + // + // Atom names start with element symbols right-justified in columns 13-14 + // as permitted by the length of the name. For example, the symbol FE for + // iron appears in columns 13-14, whereas the symbol C for carbon appears + // in column 14 (see Misaligned Atom Names). If an atom name has four + // characters, however, it must start in column 13 even if the element + // symbol is a single character (for example, see Hydrogen Atoms). + + const veryLong = name.trim().length === 4; + return name.slice(0, veryLong ? 1 : 2).trim(); +} +class AtomDataError extends Error { + constructor(message) { + super(); + this.name = 'AtomDataError'; + this.message = message; + } +} +function _getOperations(operList) { + if (!operList) { + return null; + } + const idc = arrize(operList.id); + const { + matrix, + vector + } = operList; + if (!idc || !matrix || !vector) { + return null; + } + const ops = []; + for (let i = 0, n = idc.length; i < n; ++i) { + const mtx = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + const { + elements + } = mtx; + for (let row = 0; row < 3; ++row) { + const matrixData = matrix[row + 1]; + elements[row] = arrize(matrixData[1])[i]; + elements[row + 4] = arrize(matrixData[2])[i]; + elements[row + 8] = arrize(matrixData[3])[i]; + elements[row + 12] = arrize(vector[row + 1])[i]; + } + ops[idc[i]] = mtx; + } + return ops; +} +function _extractOperations(assemblyGen, opsDict) { + assemblyGen = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(assemblyGen) ? assemblyGen : `${assemblyGen}`; + const l = assemblyGen.replace(/\)\s*\(/g, '!').replace(/[()']/g, ''); + const groupStr = l.split('!'); + const gps = []; + for (let grIdx = 0, grCount = groupStr.length; grIdx < grCount; ++grIdx) { + const gr = groupStr[grIdx].split(','); + const gp = []; + let idx = 0; + for (let i = 0, n = gr.length; i < n; ++i) { + const s = gr[i]; + if (s.includes('-')) { + const es = s.split('-'); + let j = parseInt(es[0], 10); + const m = parseInt(es[1], 10); + for (; j <= m; ++j) { + gp[idx++] = opsDict[j]; + } + } else { + gp[idx++] = opsDict[s]; + } + } + gps.push(gp); + } + // traverse all groups from the end of array and make all mults + const matrices = []; + let cnt = 0; + function traverse(level, mtx) { + for (let ii = 0, nn = gps[level].length; ii < nn; ++ii) { + const newMtx = mtx ? mtx.clone() : new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + newMtx.multiplyMatrices(gps[level][ii], newMtx); + if (level === 0) { + matrices[cnt++] = newMtx; + } else { + traverse(level - 1, newMtx); + } + } + } + traverse(gps.length - 1); + return matrices; +} +class CIFParser extends Parser { + constructor(data, options) { + super(data, options); + this.asymDict = {}; + this.molecules = []; + this._options.fileType = 'cif'; + } + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(data) && /^\s*data_/i.test(data); + } + parseSync() { + this.logger.info('Parsing CIF file..'); + const data = readCIF(this._data); + return this._toComplex(data); + } -Miew.prototype._initListeners = function () { - var self = this; - window.addEventListener('resize', function () { - self._onResize(); - }); -}; -/** - * Try to add numbers to the base name to make it unique among visuals - * @private - */ + /** + * Convert intermediate structure into our valid Complex object + * @param cifData intermediate CIF object + * @returns {Complex} complex + * @private + */ + _toComplex(cifData) { + const complex = new CIFParser_Complex(); + const complexData = cifData[Object.keys(cifData)[0]]; + this._extractAtoms(complex, complexData); + this._extractSecondary(complex, complexData); + this._extractAssemblies(complex, complexData); + this._extractMolecules(complex, complexData); + this._extractMetadata(complex, complexData); + complex.finalize({ + needAutoBonding: true, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing + }); + return complex; + } + /** + * Extract metadata + * @param complex structure to fill + * @param complexData complex data from CIF file + * @private + */ -Miew.prototype._makeUniqueVisualName = function (baseName) { - if (!baseName) { - return Math.random().toString(); + _extractMetadata(complex, complexData) { + const { + metadata + } = complex; + metadata.id = complexData.entry.id; + metadata.classification = complexData.struct_keywords.pdbx_keywords; + const databaserev = complexData.database_PDB_rev; + metadata.date = databaserev && databaserev.date_original ? databaserev.date_original : ''; + metadata.format = 'cif'; + metadata.title = []; + metadata.title[0] = complexData.struct.title; } - var name = baseName; - var suffix = 1; + /** + * Extract molecules information from CIF structure (should be called strictly after _extractAtoms) + * @param complexData complex data from CIF file + * @private + */ + _extractMolecules(complex, complexData) { + const molData = complexData.entity; + const names = arrize(molData.pdbx_description); + const count = names.length; + let i; + + // molecules names from cif + for (i = 0; i < count; i++) { + if (this.molecules[i]) { + // molecule was created during atoms processing + this.molecules[i].name = names[i]; + } else { + // molecule wasn't created, because there is no atom which is contained + this.molecules[i] = { + name: names[i], + residues: [] + }; + } + } - while (this._visuals.hasOwnProperty(name)) { - name = "".concat(baseName, " (").concat(suffix.toString(), ")"); - suffix++; + // reorganize molecules for complex and check chains + const molecules = complex.getMolecules(); + for (i = 0; i < count; i++) { + const molecule = this.molecules[i]; + molecules[i] = new CIFParser_Molecule(complex, molecule.name, i + 1); + molecules[i].residues = molecule.residues; + } } - return name; -}; -/** - * Add visual to the viewer - * @private - */ + /** + * Extract atom information from CIF structure and fill complex + * @param {Complex} complex + * @param complexData complex data from CIF file + * @private + */ + _extractAtoms(complex, complexData) { + const atomData = complexData.atom_site; + if (!atomData) { + throw new AtomDataError('CIF parsing error: atom_site is not specified!'); + } + for (let f = 0, n = cRequiredAtomFields.length; f < n; ++f) { + if (!atomData[cRequiredAtomFields[f]]) { + throw new AtomDataError(`CIF parsing error: requires field ${cRequiredAtomFields[f]} not found!`); + } + } + const { + asymDict + } = this; + // required fields + const resIdc = arrize(atomData.auth_seq_id); + const x = arrize(atomData.Cartn_x); + const y = arrize(atomData.Cartn_y); + const z = arrize(atomData.Cartn_z); + const names = arrize(atomData.label_atom_id); + const count = names.length; + // optional fields + const group = arrize(atomData.group_PDB) || []; + const chainIdc = arrize(atomData.auth_asym_id) || []; + const chainLabelIdc = arrize(atomData.label_asym_id) || []; + const serials = arrize(atomData.id) || []; + const iCodes = arrize(atomData.pdbx_PDB_ins_code) || []; + const resNames = arrize(atomData.label_comp_id) || []; + const elements = arrize(atomData.type_symbol) || []; + const tempFactors = arrize(atomData.B_iso_or_equiv) || []; + const occupancies = arrize(atomData.occupancy) || []; + const charges = arrize(atomData.pdbx_formal_charge) || []; + const altLocs = arrize(atomData.label_alt_id) || []; + const models = arrize(atomData.pdbx_PDB_model_num) || []; + const molecules = arrize(atomData.label_entity_id) || []; + let chain = null; + let residue = null; + for (let i = 0; i < count; ++i) { + const model = models[i] || 1; + if (model !== 1) { + continue; + } + const chainID = String(chainIdc[i] || ' '); + if (!chain || chain.getName() !== chainID) { + chain = complex.getChain(chainID) || complex.addChain(chainID); + } + asymDict[String(chainLabelIdc[i] || ' ')] = chainID; + const resSeq = resIdc[i]; + const iCode = String(iCodes[i] || ' '); + const resName = String(resNames[i] || ''); + if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) { + residue = chain.addResidue(resName, resSeq, iCode); + + // store residue in appropriate molecule + const moleculeIdx = molecules[i] - 1; + let entity = this.molecules[moleculeIdx]; + if (!entity) { + // create new molecule if it hasn't been created + this.molecules[moleculeIdx] = { + name: '', + residues: [] + }; + entity = this.molecules[moleculeIdx]; + } + entity.residues.push(residue); + } + const name = names[i]; + const element = elements[i] || CIFParser_nameToElement(name); + const type = CIFParser_Element.getByName(element); + const role = CIFParser_Element.Role[name.trim()]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(x[i], y[i], z[i]); + const het = group[i] === 'HETATM' || false; + const serial = serials[i] || i; + const tempFactor = tempFactors[i] || 0.0; + const occupancy = occupancies[i] || 0.0; + const altLoc = String(altLocs[i] || ''); + const charge = charges[i] || 0; + residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); + } + } + + /** + * Extracts secondary structure information from CIF intermediate data + * and adds it into complex + * @param {Complex} complex - complex to fill + * @param complexData - CIF complex data + * @private + */ + _extractSecondary(complex, complexData) { + if (complexData.struct_conf) { + this._extractConfs(complex, complexData.struct_conf); + } + if (complexData.struct_sheet_range) { + this._extractSheets(complex, complexData.struct_sheet_range); + } + } + /** + * Extracts sheets information from CIF intermediate data + * and adds it into complex + * @param {Complex} complex + * @param sheetData + * @private + */ + _extractSheets(complex, sheetData) { + const { + asymDict + } = this; + if (!sheetData.sheet_id || !sheetData.id || !sheetData.beg_label_seq_id || !sheetData.end_label_seq_id || !sheetData.beg_label_asym_id) { + return; + } + // Strand(sheet, start, end, sense, cur, prev) + const sheets = complex._sheets; + function getSheet(name) { + const n = sheets.length; + for (let i = 0; i < n; ++i) { + if (sheets[i]._name === name) { + return sheets[i]; + } + } + sheets[n] = new CIFParser_Sheet(name, 0); + return sheets[n]; + } + const sheetNames = arrize(sheetData.sheet_id); + const strandNames = arrize(sheetData.id); + const starts = arrize(sheetData.beg_auth_seq_id); + const ends = arrize(sheetData.end_auth_seq_id); + const chains = arrize(sheetData.beg_label_asym_id); + const stICodes = arrize(sheetData.pdbx_beg_PDB_ins_code) || []; + const endICodes = arrize(sheetData.pdbx_end_PDB_ins_code) || []; + for (let i = 0, n = strandNames.length; i < n; ++i) { + const chain = complex.getChain(asymDict[chains[i]]); + const sheet = getSheet(sheetNames[i]); + const startIdx = starts[i]; + const endIdx = ends[i]; + const startICode = stICodes[i] || ' '; + const endICode = endICodes[i] || ' '; + const start = chain.findResidue(startIdx, startICode); + const end = chain.findResidue(endIdx, endICode); + + // TODO think about last condition + if (!start || !end) { + continue; + } + const strand = new CIFParser_Strand(sheet, start[0], end[0], 0, null, null); + const residues = chain.getResidues(); + for (let r = start[1]; r <= end[1]; ++r) { + residues[r]._secondary = strand; + } + sheet.addStrand(strand); + complex.structures.push(strand); + } + } -Miew.prototype._addVisual = function (visual) { - if (!visual) { - return null; - } // change visual name in order to make it unique + /** + * Extracts helix/turn/strand(?) information from CIF intermediate data + * and adds it into complex + * @param {Complex} complex + * @param helicesData + * @private + */ + _extractConfs(complex, helicesData) { + const { + asymDict + } = this; + if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id || !helicesData.beg_label_asym_id) { + return; + } + const types = arrize(helicesData.conf_type_id); + const starts = arrize(helicesData.beg_auth_seq_id); + const stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || []; + const ends = arrize(helicesData.end_auth_seq_id); + const endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || []; + const comments = arrize(helicesData.details) || []; + const lengths = arrize(helicesData.pdbx_PDB_helix_length) || []; + const helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || []; + const names = arrize(helicesData.id) || []; + const chains = arrize(helicesData.beg_label_asym_id); + for (let i = 0, n = types.length; i < n; ++i) { + const type = getTypeFromId(types[i]); + if (!type) { + continue; + } + const name = names[i] || types[i]; + const chain = complex.getChain(asymDict[chains[i]]); + const startIdx = starts[i]; + const endIdx = ends[i]; + const startICode = stICodes[i] || ' '; + const endICode = endICodes[i] || ' '; + const start = chain.findResidue(startIdx, startICode); + const end = chain.findResidue(endIdx, endICode); + + // TODO think about last condition + if (!start || !end) { + continue; + } + const comment = comments[i] || ''; + const length = lengths[i] || 0; + const helixClass = helixClasses[i] || ' '; + let struct; + if (type === 'helix') { + const idx = complex._helices.length; + struct = new CIFParser_Helix(helixClass, start[0], end[0], idx, name, comment, length); + complex.addHelix(struct); + complex.structures.push(struct); + } else if (type === 'turn') { + struct = new chem_StructuralElement(chem_StructuralElement.Type.TURN, start[0], end[0]); + complex.structures.push(struct); + } else { + struct = null; + } + if (!struct) { + continue; + } + const residues = chain.getResidues(); + for (let r = start[1]; r <= end[1]; ++r) { + residues[r]._secondary = struct; + } + } + } + /** + * Extract biological assemblies information from CIF structure and fill complex + * @param {Complex} complex + * @param complexData complex data from CIF file + * @private + */ + _extractAssemblies(complex, complexData) { + const { + asymDict + } = this; + const asmGen = complexData.pdbx_struct_assembly_gen; + if (!asmGen) { + return; + } + const asmIdx = arrize(asmGen.assembly_id); + const asmOper = arrize(asmGen.oper_expression); + const asmList = arrize(asmGen.asym_id_list); + if (!asmIdx || !asmOper || !asmList) { + return; + } + const operList = _getOperations(complexData.pdbx_struct_oper_list); + if (!operList) { + return; + } + for (let i = 0, n = asmIdx.length; i < n; ++i) { + const asm = new CIFParser_Assembly(complex); + const assemblyOps = _extractOperations(asmOper[i], operList); + const entries = asmList[i].split(','); + for (let ii = 0, nn = entries.length; ii < nn; ++ii) { + const chain = entries[ii].trim(); + if (chain.length > 0) { + asm.addChain(asymDict[chain]); + } + } + asm.matrices = assemblyOps; + complex.units.push(asm); + } + } +} +CIFParser.formats = ['cif', 'mmcif']; +CIFParser.extensions = ['.cif', '.mmcif']; +/* harmony default export */ const parsers_CIFParser = (CIFParser); +;// CONCATENATED MODULE: ./src/io/parsers/VolumeModel.js - var name = this._makeUniqueVisualName(visual.name); - visual.name = name; - this._visuals[name] = visual; - this._gfx.pivot.add(visual); +const valueType = { + singular: 0, + vector: 1, + array: 2, + buffer: 3 +}; +class VolumeModel { + _xyz2crs = []; + _origin = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0))(); + constructor() { + this._header = {}; + this._boxSize = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._boxStart = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._header.delta = {}; + this._header.extent = []; + this._header.nstart = []; + this._header.grid = []; + this._header.crs2xyz = []; + this._header.cellDims = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._header.angles = []; + this._header.origin = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0); + this._header.dmin = 0; + this._header.dmean = 0; + this._header.dmax = 0; + } + _typedCheck() { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isTypedArray(this._buff)) { + this._buff = this._buff.buffer; + } else if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isArrayBuffer(this._buff)) { + throw new TypeError('Expected ArrayBuffer or TypedArray'); + } + } + _fillHeader(headerFormat, arrays) { + for (const key in headerFormat) { + if (headerFormat.hasOwnProperty(key)) { + switch (headerFormat[key][0]) { + case valueType.singular: + this._header[key] = arrays[headerFormat[key][1]][headerFormat[key][2]]; + break; + case valueType.array: + this._parseArray(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]); + break; + case valueType.vector: + this._parseVector(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]); + break; + case valueType.buffer: + this._header[key] = new Uint8Array(arrays[headerFormat[key][1]], [headerFormat[key][2]] * 4, [headerFormat[key][3]] * 4); + break; + default: + break; + } + } + } + } + _parseVector(vector, arr, pos) { + [vector.x, vector.y, vector.z] = [arr[pos], arr[pos + 1], arr[pos + 2]]; + } + _parseArray(vector, arr, pos) { + vector[0] = arr[pos]; + vector[1] = arr[pos + 1]; + vector[2] = arr[pos + 2]; + } + _parseHeader(_buffer) {} + _setAxisIndices() {} + _setOrigins() {} + _getAxis() { + const header = this._header; + const xScale = header.cellDims.x / header.grid[0]; + const yScale = header.cellDims.y / header.grid[1]; + const zScale = header.cellDims.z / header.grid[2]; + const [alpha, beta, gamma] = header.angles; + const z1 = Math.cos(beta); + const z2 = (Math.cos(alpha) - Math.cos(beta) * Math.cos(gamma)) / Math.sin(gamma); + const z3 = Math.sqrt(1.0 - z1 * z1 - z2 * z2); + const xaxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(xScale, 0, 0); + const yaxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(Math.cos(gamma) * yScale, Math.sin(gamma) * yScale, 0); + const zaxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(z1 * zScale, z2 * zScale, z3 * zScale); + return [xaxis, yaxis, zaxis]; + } + _getXYZdim() { + return [this._header.extent[this._xyz2crs[0]], this._header.extent[this._xyz2crs[1]], this._header.extent[this._xyz2crs[2]]]; + } + _getVolumeInfo() { + const volInfo = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].pick(this._header, ['dmean', 'dmin', 'dmax', 'sd', 'delta']); + volInfo.obtuseAngle = this._header.angles.map(angle => Number(angle >= Math.PI / 2)); + return volInfo; + } + _setBoxParams(xaxis, yaxis, zaxis) { + // if axes are not orthogonal, the origins might not match with box coordinates - need to make shift + let shiftX = 0; + let shiftY = 0; + const [alpha, beta, gamma] = this._header.angles; + if (gamma >= Math.PI / 2) { + shiftX += Math.abs(yaxis.x); + } + if (beta >= Math.PI / 2) { + shiftX += Math.abs(zaxis.x); + } + if (alpha >= Math.PI / 2) { + shiftY += Math.abs(zaxis.y); + } + this._boxStart = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(this._origin.x - shiftX, this._origin.y - shiftY, this._origin.z); + this._boxSize = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(Math.abs(xaxis.x) + Math.abs(yaxis.x) + Math.abs(zaxis.x), Math.abs(yaxis.y) + Math.abs(zaxis.y), Math.abs(zaxis.z)); + const delta = (axe, proj) => Math.abs(axe[proj]) / this._boxSize[proj]; + this._header.delta.x = delta(yaxis, 'x'); + this._header.delta.y = delta(zaxis, 'x'); + this._header.delta.z = delta(zaxis, 'y'); + } + _getXYZbox() { + return new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(this._boxStart.clone(), this._boxStart.clone().add(this._boxSize)); + } + _toXYZData() {} + parse(data) { + this._parseHeader(data); + this._setOrigins(); + return new chem_Volume(Float32Array, this._getXYZdim(), this._getXYZbox(), 1, this._toXYZData(), this._getVolumeInfo()); + } +} +/* harmony default export */ const parsers_VolumeModel = (VolumeModel); +;// CONCATENATED MODULE: ./src/io/parsers/CCP4Parser.js - if (visual.getSelectionGeo) { - this._gfx.selectionPivot.add(visual.getSelectionGeo()); + +const CCP4Header = { + extent: [valueType.array, 'u32', 0], + type: [valueType.singular, 'u32', 3], + nstart: [valueType.array, 'i32', 4], + grid: [valueType.array, 'u32', 7], + cellDims: [valueType.vector, 'f32', 10], + angles: [valueType.array, 'f32', 13], + crs2xyz: [valueType.array, 'i32', 16], + dmin: [valueType.singular, 'f32', 19], + dmax: [valueType.singular, 'f32', 20], + dmean: [valueType.singular, 'f32', 21], + ispg: [valueType.singular, 'u32', 22], + nsymbt: [valueType.singular, 'u32', 23], + lksflg: [valueType.singular, 'u32', 24], + customData: [valueType.buffer, 'buffer', 25, 9], + origin: [valueType.vector, 'f32', 34], + map: [valueType.buffer, 'buffer', 52, 1], + machine: [valueType.singular, 'u32', 53], + sd: [valueType.singular, 'f32', 54], + nlabel: [valueType.singular, 'f32', 55], + label: [valueType.buffer, 'buffer', 56, 200] +}; +class Ccp4Model extends parsers_VolumeModel { + // read header (http://www.ccp4.ac.uk/html/maplib.html) + _parseHeader(_buffer) { + this._buff = _buffer; + this._typedCheck(); + const arrays = {}; + arrays.u32 = new Uint32Array(this._buff, 0, 56); + arrays.i32 = new Int32Array(this._buff, 0, 56); + arrays.f32 = new Float32Array(this._buff, 0, 56); + arrays.buffer = this._buff; + const header = this._header; + this._fillHeader(CCP4Header, arrays); + + // calculate non-orthogonal unit cell coordinates + header.angles.forEach((angle, i, a) => { + a[i] *= Math.PI / 180.0; + }); + } + _setAxisIndices() { + const header = this._header; + if (header.cellDims.x === 0.0 && header.cellDims.y === 0.0 && header.cellDims.z === 0.0) { + header.cellDims.set(1.0, 1.0, 1.0); + } + // Apply header conversion + // Mapping between CCP4 column, row, section and VMD x, y, z. + const { + crs2xyz + } = this._header; + if (crs2xyz[0] === 0 && crs2xyz[1] === 0 && crs2xyz[2] === 0) { + crs2xyz[0] = 1; + crs2xyz[1] = 2; + crs2xyz[2] = 3; + } + const xyz2crs = this._xyz2crs; + xyz2crs[crs2xyz[0] - 1] = 0; // column + xyz2crs[crs2xyz[1] - 1] = 1; // row + xyz2crs[crs2xyz[2] - 1] = 2; // section + } + _setOrigins() { + const [xaxis, yaxis, zaxis] = this._getAxis(); + this._setAxisIndices(); + const header = this._header; + const xyz2crs = this._xyz2crs; + // Handle both MRC-2000 and older format maps + if (header.origin.x === 0.0 && header.origin.y === 0.0 && header.origin.z === 0.0) { + this._origin.addScaledVector(xaxis, header.nstart[xyz2crs[0]]); + this._origin.addScaledVector(yaxis, header.nstart[xyz2crs[1]]); + this._origin.addScaledVector(zaxis, header.nstart[xyz2crs[2]]); + } else { + this._origin = header.origin; + // Use ORIGIN records rather than old n[xyz]start records + // http://www2.mrc-lmb.cam.ac.uk/image2000.html + // XXX the ORIGIN field is only used by the EM community, and + // has undefined meaning for non-orthogonal maps and/or non-cubic voxels, etc. + } + xaxis.multiplyScalar(header.extent[xyz2crs[0]] - 1); + yaxis.multiplyScalar(header.extent[xyz2crs[1]] - 1); + zaxis.multiplyScalar(header.extent[xyz2crs[2]] - 1); + if (header.type === 2) { + this._data = new Float32Array(this._buff, 1024 + header.nsymbt, header.extent[0] * header.extent[1] * header.extent[2]); + } else { + throw new Error(`CCP4: Unsupported format ${header.type}`); + } + this._setBoxParams(xaxis, yaxis, zaxis); + } + _toXYZData() { + const header = this._header; + const data = this._data; + const xyz2crs = this._xyz2crs; + const xyzData = new Float32Array(data.length); + const dim = this._getXYZdim(); + const xSize = dim[0]; + const ySize = dim[1]; + let crsIdx = 0; + const coord = []; + let x; + let y; + let z; + for (coord[2] = 0; coord[2] < header.extent[2]; coord[2]++) { + // Site + for (coord[1] = 0; coord[1] < header.extent[1]; coord[1]++) { + // Row + for (coord[0] = 0; coord[0] < header.extent[0]; coord[0]++, crsIdx++) { + // Column + x = coord[xyz2crs[0]]; + y = coord[xyz2crs[1]]; + z = coord[xyz2crs[2]]; + xyzData[x + xSize * (y + ySize * z)] = data[crsIdx]; + } + } + } + return xyzData; + } +} +class CCP4Parser extends Parser { + constructor(data, options) { + super(data, options); + this._options.fileType = 'ccp4'; + this.model = new Ccp4Model(); + } + static canProbablyParse(_data) { + return false; // Autodetection is not implemented yet + } + parseSync() { + return this.model.parse(this._data); + } +} +CCP4Parser.formats = ['ccp4']; +CCP4Parser.extensions = ['.ccp4', '.map', '.mrc']; +CCP4Parser.binary = true; +/* harmony default export */ const parsers_CCP4Parser = (CCP4Parser); +;// CONCATENATED MODULE: ./src/io/parsers/XYZParser.js + + + + +const { + Complex: XYZParser_Complex, + Element: XYZParser_Element, + Molecule: XYZParser_Molecule +} = chem; +class XYZParser extends Parser { + constructor(data, options) { + super(data, options); + this._complex = null; + this._atomsInf = null; + this._options.fileType = 'xyz'; + this._fileName = options.name; + } + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(data) && /^\s*\d+ *\n[^\n]*\n\s*\w{1,3}\s+-?\d/.test(data); + } + _parseToAtomsInf(source) { + const endnAtoms = source.indexOf('\n'); + const nAtoms = parseInt(source.substring(0, endnAtoms), 10); + const endComment = source.indexOf('\n', endnAtoms + 1); + let comment = source.slice(endnAtoms + 1, endComment).trim(); + if (comment.length === 0) { + comment = this._fileName; + } + const startAtomsInf = endComment + source.substring(endComment).search(/\S/); + this._atomsInf = source.substring(startAtomsInf).split(/[\s,]*\n[\s,]*/); + if (!Number.isNaN(nAtoms) && this._atomsInf.length - 1 !== nAtoms) { + this._complex.error = { + message: 'wrong number of atoms' + }; + return; + } + this._complex.metadata.format = 'xyz'; + this._complex.name = comment; + } + _parseAtomsInf() { + const het = true; + const altLoc = ' '; + const occupancy = 1; + const tempFactor = 1; + const charge = 0; + const chain = this._complex.addChain('A'); + const residue = chain.addResidue('UNK', 1, ' '); + for (let i = 0; i < this._atomsInf.length - 1; i++) { + const words = this._atomsInf[i].split(/[\s,]+/); + if (words.length !== 4) { + this._complex.error = { + message: 'missed parameters' + }; + break; + } + const serial = i + 1; + const name = words[0]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3])); + const type = XYZParser_Element.getByName(name); + const role = undefined; + residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge); + } + const molecule = new XYZParser_Molecule(this._complex, this._complex.name, 1); + molecule.residues = residue; + this._complex._molecules[0] = molecule; + } + parseSync() { + const result = this._complex = new XYZParser_Complex(); + this._parseToAtomsInf(this._data); + this._parseAtomsInf(); + this._complex.finalize({ + needAutoBonding: true, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap + }); + this._complex = null; + this._atomsInf = null; + if (result.error) { + throw new Error(result.error.message); + } + return result; } + static formats = ['xyz']; + static extensions = ['.xyz']; +} +/* harmony default export */ const parsers_XYZParser = (XYZParser); +;// CONCATENATED MODULE: ./src/io/parsers/PubChemParser.js - return name; -}; -/** - * Remove visual from the viewer - * @private - */ -Miew.prototype._removeVisual = function (visual) { - var name = ''; - var obj = null; - if (visual instanceof Visual) { - name = visual.name; - obj = visual; - } else if (typeof visual === 'string') { - name = visual; - obj = this._visuals[name]; +const { + Complex: PubChemParser_Complex, + Element: PubChemParser_Element +} = chem; +class PubChemParser extends Parser { + constructor(data, options) { + super(data, options); + this._options.fileType = 'pubchem+json'; } - - if (!obj || !this._visuals.hasOwnProperty(name) || this._visuals[name] !== obj) { - return; + static canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(data) && data[0] === '{'; } - - if (name === this._curVisualName) { - this._curVisualName = undefined; + parseSync() { + this.logger.info('Parsing PubChem JSON file...'); + return this._toComplex(JSON.parse(this._data)); } - - delete this._visuals[name]; - obj.release(); // removes nodes from scene - - this._needRender = true; -}; -/** - * Call specified function for each Visual - * @private - */ - - -Miew.prototype._forEachVisual = function (callback) { - for (var name in this._visuals) { - if (this._visuals.hasOwnProperty(name)) { - callback(this._visuals[name]); + _toComplex(jsonData) { + const complex = new PubChemParser_Complex(); + const complexData = jsonData.PC_Compounds && jsonData.PC_Compounds[0]; + if (complexData) { + this._extractAtoms(complex, complexData); + complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing + }); + } + return complex; + } + _extractAtoms(complex, complexData) { + let aids = complexData.atoms && complexData.atoms.aid; + let elements = aids && complexData.atoms.element; + if (!elements || aids.length !== elements.length) { + throw new Error('Unable to parse atom elements'); + } + elements = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].fromPairs(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].zip(aids, elements)); + const atoms = {}; + const coords = complexData.coords && complexData.coords[0]; + const model = coords && coords.conformers && coords.conformers[0]; + const xs = model && model.x; + const ys = model && model.y; + const zs = model && model.z || []; + aids = coords && coords.aid; + if (!aids || !xs || !ys) { + throw new Error('Coordinates are not found in the file'); + } + const chain = complex.addChain(' '); + const residue = chain.addResidue('UNK', 1, ' '); + for (let i = 0, n = aids.length; i < n; ++i) { + const aid = aids[i]; + const element = PubChemParser_Element.ByAtomicNumber[elements[aid]]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(xs[i], ys[i], zs[i] || 0.0); + atoms[aid] = residue.addAtom(element.name, element, xyz, undefined, true, aid, ' ', 1.0, 0.0, 0); + } + const aids1 = complexData.bonds && complexData.bonds.aid1; + const aids2 = complexData.bonds && complexData.bonds.aid2; + const orders = complexData.bonds && complexData.bonds.order || []; + if (!aids1 || !aids2 || aids1.length !== aids2.length) { + return; + } + for (let j = 0, m = aids1.length; j < m; ++j) { + complex.addBond(atoms[aids1[j]], atoms[aids2[j]], orders[j] || 1, 0, true); } } -}; -/** - * Release (destroy) all visuals in the scene - * @private - */ - +} +PubChemParser.formats = ['pubchem', 'pubchem+json', 'pc']; +PubChemParser.extensions = ['.json']; +/* harmony default export */ const parsers_PubChemParser = (PubChemParser); +;// CONCATENATED MODULE: ./src/io/parsers/SDFStream.js -Miew.prototype._releaseAllVisuals = function () { - if (!this._gfx || !this._gfx.pivot) { - return; +class SDFStream { + constructor(data) { + this._strings = data.split(/\r?\n|\r/); + this._currentStart = 0; + this._currentStringIndx = 0; } - - for (var name in this._visuals) { - if (this._visuals.hasOwnProperty(name)) { - this._visuals[name].release(); + setStart(start) { + if (start >= this._strings.length) { + this._currentStart = this._strings.length - 1; + this._currentStringIndx = this._strings.length - 1; + } else { + this._currentStart = start; + this._currentStringIndx = start; } } - - this._visuals = {}; -}; -/** - * Call specified function for each ComplexVisual - * @private - */ - - -Miew.prototype._forEachComplexVisual = function (callback) { - if (!this._gfx || !this._gfx.pivot) { - return; + getNextString() { + return this._strings[++this._currentStringIndx]; } - - for (var name in this._visuals) { - if (this._visuals.hasOwnProperty(name) && this._visuals[name] instanceof ComplexVisual) { - callback(this._visuals[name]); + getCurrentString() { + return this._strings[this._currentStringIndx]; + } + getStringFromStart(numb) { + this._currentStringIndx = this._currentStart + numb; + return this._strings[this._currentStart + numb]; + } + findNextDataItem() { + let curStr = this.getNextString(); + let res = false; + while (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(curStr) && curStr.trim() !== '$$$$') { + if (curStr.match(/>\s+<(.*)>/)) { + res = true; + break; + } + curStr = this.getNextString(); } + return res; } -}; -/** - * Returns ComplexVisual with specified name, or current (if not found), or any, or null - * @private - */ - - -Miew.prototype._getComplexVisual = function (name) { - name = name || this._curVisualName; - var any = null; - var named = null; - - this._forEachComplexVisual(function (visual) { - any = visual; - - if (visual.name === name) { - named = visual; + findNextCompoundStart() { + let curStr = this.getCurrentString(); + while (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(curStr) && curStr.trim() !== '$$$$') { + curStr = this.getNextString(); } - }); - - return named || any; + this.setStart(++this._currentStringIndx); + return this.probablyHaveDataToParse(); + } + probablyHaveDataToParse() { + return this._currentStringIndx < this._strings.length - 2; + } +} +;// CONCATENATED MODULE: ./src/io/parsers/SDFParser.js + + + + + + +const { + Complex: SDFParser_Complex, + Element: SDFParser_Element, + Bond: SDFParser_Bond, + Molecule: SDFParser_Molecule +} = chem; +const chargeMap = [0, 3, 2, 1, 0, -1, -2, -3]; +const orderMap = [0, 1, 2, 3, 1, 1, 1, 2]; +const typeMap = [SDFParser_Bond.BondType.UNKNOWN, +// 0 - error +SDFParser_Bond.BondType.COVALENT, +// 1 - single +SDFParser_Bond.BondType.COVALENT, +// 2 - double +SDFParser_Bond.BondType.COVALENT, +// 3 - triple +SDFParser_Bond.BondType.AROMATIC, +// 4 - aromatic +SDFParser_Bond.BondType.UNKNOWN, +// 5 - single or double +SDFParser_Bond.BondType.AROMATIC, +// 6 - single or aromatic +SDFParser_Bond.BondType.AROMATIC // 7 - double or aromatic +// 8 - any +// 9 - coordination +// 10 - hydrogen +]; +const sdfAndMolRegexp = /.*(M\s\sEND).*|.*(^$$$$).*|.*>\s+<(.+)>.*/; +const sdfRegExp = /.*($$$$).*|.*>\s+<(.+)>.*/; +const fileFormat = { + SDF: 'sdf', + MOL: 'mol' }; -/** - * Returns first found VolumeVisual (no more than one should be present actually) - * @private - */ +const possibleNameTags = ['PUBCHEM_IUPAC_TRADITIONAL_NAME', /PUBCHEM_(.+)_NAME/, /(.+)name/, /(.+)NAME/]; +const possibleIDTags = ['PUBCHEM_COMPOUND_CID', 'id', 'ID', /.*CID/, /.*ID/, /.*id/]; +const possibleTitleTags = ['msg', 'MSG', 'message', 'title', 'description', 'desc']; +const tagsNames = ['name', 'id', 'title']; +const tags = { + name: possibleNameTags, + id: possibleIDTags, + title: possibleTitleTags +}; +function buildChainID(index) { + if (!index) { + return 'A'; + } + const codes = []; + while (index) { + codes.push(65 + index % 26); + index = Math.trunc(index / 26); + } + if (codes.length > 1) { + codes.reverse(); + codes[0] -= 1; + } + return String.fromCharCode(...codes); +} +class SDFParser extends Parser { + constructor(data, options) { + super(data, options); + this._format = 'sdf'; + this._complex = null; + this._chain = null; + this._residue = null; + this._molecules = null; + this._metadata = {}; + this._metadata.molecules = []; + this._currentMolProps = {}; + this._compoundIndx = -1; + this._assemblies = []; + this._atomsParsed = 0; + this._atomsIndexes = []; + } + canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(data) && sdfAndMolRegexp.test(data); + } + _parseHeader(stream) { + const molecule = {}; + molecule.name = stream.getStringFromStart(0); + const date = parseInt(stream.getStringFromStart(1).substr(10, 6).trim(), 10); + molecule.date = date.toString() || ''; + molecule.title = stream.getStringFromStart(2); + this._metadata.molecules.push(molecule); + } + _parseAtoms(stream, atomsNum) { + let curStr; + let serial = this._atomsParsed; + + // each molecule = chain\residue + const chainID = buildChainID(this._compoundIndx); + const resName = 'UNK'; + const resSeq = 1; + this._chain = this._complex.getChain(chainID) || this._complex.addChain(chainID); + this._residue = this._chain.addResidue(resName, resSeq, ' '); + for (let i = 0; i < atomsNum; i++) { + curStr = stream.getNextString(); + serial++; + const x = parseFloat(curStr.substr(0, 10)); + const y = parseFloat(curStr.substr(10, 10)); + const z = parseFloat(curStr.substr(20, 10)); + const charge = chargeMap[parseInt(curStr.substr(36, 3), 10)]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(x, y, z); + let name = curStr.substr(31, 3).trim().toUpperCase(); + const type = SDFParser_Element.getByName(name); + if (!this._atomsIndexes[name]) { + this._atomsIndexes[name] = 0; + } + this._atomsIndexes[name] += 1; + name += this._atomsIndexes[name]; // every atom need to have unique name. + + this._residue.addAtom(name, type, xyz, undefined, true, serial, ' ', 1.0, 0.0, charge); + } + } + _parseBonds(stream, bondsNum) { + let curStr; + for (let i = 0; i < bondsNum; i++) { + curStr = stream.getNextString(); + let atom1 = parseInt(curStr.substr(0, 3), 10) + this._atomsParsed; + let atom2 = parseInt(curStr.substr(3, 3), 10) + this._atomsParsed; + const bondType = parseInt(curStr.substr(6, 3), 10); + if (atom1 > atom2) { + [atom1, atom2] = [atom2, atom1]; + } + this._complex.addBond(atom1, atom2, orderMap[bondType] || 1, typeMap[bondType] || SDFParser_Bond.BondType.UNKNOWN, true); + } + } + _parseMOL(stream) { + this._compoundIndx++; + this._parseHeader(stream); + const countsLine = stream.getStringFromStart(3); + const atomsNum = parseInt(countsLine.substr(0, 3), 10); + const bondsNum = parseInt(countsLine.substr(3, 3), 10); + this._parseAtoms(stream, atomsNum); + this._parseBonds(stream, bondsNum); + this._atomsParsed += atomsNum; + this._metadata.molecules[this._compoundIndx]._residues = []; + this._metadata.molecules[this._compoundIndx]._residues.push(this._residue); + } + _parseDataItem(stream) { + const tag = stream.getCurrentString(); + let data = []; + let curStr = stream.getNextString(); + + // read data + while (curStr.trim() !== '') { + data.push(curStr); + curStr = stream.getNextString(); + } + if (data.length === 1) { + [data] = data; + } + this._currentMolProps[tag.replace(/[<>]/g, '').trim()] = data; + } + _parseCompound(stream) { + this._parseMOL(stream); + + // parse data items block + if (this._format === fileFormat.SDF) { + this._currentMolProps = {}; + while (stream.findNextDataItem()) { + this._parseDataItem(stream); + } + if (Object.keys(this._currentMolProps).length !== 0) { + const molecule = this._metadata.molecules[this._compoundIndx]; + molecule.props = this._currentMolProps; + this._tryToUpdateMoleculeData(molecule); + } + } + } + _fixBondsArray() { + const serialAtomMap = this._serialAtomMap; + const complex = this._complex; + const bonds = complex._bonds; + for (let j = 0; j < bonds.length; j++) { + const bond = bonds[j]; + if (bond._right < bond._left) { + console.log('_fixBondsArray: Logic error.'); + } + bond._left = serialAtomMap[bond._left] || null; + bond._right = serialAtomMap[bond._right] || null; + } + } + _buildAssemblies() { + const chains = this._complex._chains; + if (chains.length === 1) { + return this._assemblies; + } + for (let i = 0; i < chains.length; i++) { + const assembly = new chem_Assembly(this._complex); + const matrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + assembly.addMatrix(matrix); + assembly.addChain(chains[i]._name); + this._assemblies.push(assembly); + } + return this._assemblies; + } + _buildMolecules() { + this._complex._molecules = []; + const { + molecules + } = this._metadata; + for (let i = 0; i < molecules.length; i++) { + const molecule = new SDFParser_Molecule(this._complex, molecules[i].name, i + 1); + molecule.residues = molecules[i]._residues; + this._complex._molecules[i] = molecule; + } + return this._complex._molecules; + } + _searchTag(tag, props) { + for (let i = 0; i < props.length; i++) { + if (tag instanceof RegExp && tag.test(props[i].tag) || tag === props[i].tag) { + return props[i].data; + } + } + return undefined; + } + _tryToFind(tagsList, props) { + for (let j = 0; j < tagsList.length; j++) { + const res = this._searchTag(tagsList[j], props); + if (res) { + return res; + } + } + return undefined; + } + _tryToUpdateMoleculeData(molecule) { + let res = false; + for (let i = 0; i < tagsNames.length; i++) { + const tagPossibleNames = tags[tagsNames[i]]; + const data = this._tryToFind(tagPossibleNames, molecule.props); + if (data) { + molecule[tagsNames[i]] = data; + res = true; + } + } + molecule.name = molecule.name || molecule.id; + if (molecule.name.match(/^\d+$/)) { + molecule.name = `CID: ${molecule.name}`; + } + return res; + } + _finalizeMetadata() { + const { + molecules + } = this._metadata; + const { + metadata + } = this._complex; + const complex = this._complex; + if (molecules.length === 1) { + complex.name = molecules[0].name; + metadata.title = molecules[0].title; + metadata.date = molecules[0].date; + metadata.properties = molecules[0].props; + } else if (molecules.length > 1) { + metadata.molecules = []; + for (let i = 0; i < molecules.length; i++) { + metadata.molecules.push({ + name: molecules[i].name, + date: molecules[i].date, + title: molecules[i].title, + properties: molecules[i].props + }); + } + } + } + _finalize() { + const serialAtomMap = this._serialAtomMap = {}; + const atoms = this._complex._atoms; + for (let i = 0; i < atoms.length; i++) { + const atom = atoms[i]; + serialAtomMap[atom.serial] = atom; + } + this._complex._finalizeBonds(); + this._fixBondsArray(); + this._finalizeMetadata(); + this._buildAssemblies(); + this._complex.units = this._complex.units.concat(this._assemblies); + this._buildMolecules(); + this._complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: false, + enableEditing: false, + serialAtomMap: this._serialAtomMap + }); + } + defineFormat(data) { + let format; + if (sdfRegExp.test(data)) { + format = fileFormat.SDF; + } else { + format = fileFormat.MOL; + } + return format; + } + parseSync() { + const result = this._complex = new SDFParser_Complex(); + const stream = new SDFStream(this._data); + this._format = this.defineFormat(this._data); + result.metadata.format = this._format; + do { + this._parseCompound(stream); + } while (stream.findNextCompoundStart()); + this._finalize(); + return result; + } +} +SDFParser.formats = ['mol', 'sdf']; +SDFParser.extensions = ['.mol', '.sdf']; +;// CONCATENATED MODULE: ./src/io/parsers/DSN6Parser.js -Miew.prototype._getVolumeVisual = function () { - var any = null; - this._forEachVisual(function (visual) { - if (visual instanceof VolumeVisual) { - any = visual; - } - }); - return any; +// http://www.uoxray.uoregon.edu/tnt/manual/node104.html +const DSN6Header = { + nstart: [valueType.array, 'i16', 0], + extent: [valueType.array, 'i16', 3], + grid: [valueType.array, 'i16', 6], + cellDims: [valueType.vector, 'i16', 9], + angles: [valueType.array, 'i16', 12], + div: [valueType.singular, 'i16', 15], + adder: [valueType.singular, 'i16', 16], + scaleFactor: [valueType.singular, 'i16', 17] }; -/** - * Returns ComplexVisual corresponding to specified complex - * @private - */ - +class DSN6Model extends parsers_VolumeModel { + _parseHeader(_buffer) { + this._buff = _buffer; + this._typedCheck(); + const arrays = {}; + arrays.i16 = new Int16Array(this._buff); -Miew.prototype._getVisualForComplex = function (complex) { - if (!complex) { - return null; + // check and reverse if big endian + if (arrays.i16[18] !== 100) { + for (let i = 0, n = arrays.i16.length; i < n; ++i) { + const val = arrays.i16[i]; + arrays.i16[i] = (val & 0xff) << 8 | val >> 8 & 0xff; + } + } + if (arrays.i16[18] !== 100) { + throw new Error('DSN6: Incorrect format '); + } + const header = this._header; + this._fillHeader(DSN6Header, arrays); + header.cellDims.multiplyScalar(1.0 / header.scaleFactor); + header.angles.forEach((angle, i, a) => { + a[i] *= Math.PI / 180.0 / header.scaleFactor; + }); + header.div /= 100; + } + _setAxisIndices() { + this._xyz2crs[0] = 0; + this._xyz2crs[1] = 1; + this._xyz2crs[2] = 2; + } + _setOrigins() { + const header = this._header; + const [xaxis, yaxis, zaxis] = this._getAxis(); + this._setAxisIndices(); + this._origin.addScaledVector(xaxis, header.nstart[0]); + this._origin.addScaledVector(yaxis, header.nstart[1]); + this._origin.addScaledVector(zaxis, header.nstart[2]); + xaxis.multiplyScalar(header.extent[0]); + yaxis.multiplyScalar(header.extent[1]); + zaxis.multiplyScalar(header.extent[2]); + this._setBoxParams(xaxis, yaxis, zaxis); + } + _pointCalculate(xyzData, byteBuffer, z, y, x, pos, i) { + const header = this._header; + if (x < header.extent[0] && y < header.extent[1] && z < header.extent[2]) { + const idx = x + header.extent[0] * (y + header.extent[1] * z); + xyzData[idx] = (byteBuffer[pos.counter] - header.adder) / header.div; + ++pos.counter; + } else { + pos.counter += 8 - i; + return false; + } + return true; } - - var found = null; - - this._forEachComplexVisual(function (visual) { - if (visual.getComplex() === complex) { - found = visual; + _blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos) { + for (let k = 0; k < 8; ++k) { + const z = 8 * zBlock + k; + for (let j = 0; j < 8; ++j) { + const y = 8 * yBlock + j; + let inRange = true; + let i = 0; + while (inRange && i < 8) { + const x = 8 * xBlock + i; + inRange = this._pointCalculate(xyzData, byteBuffer, z, y, x, pos, i); + i++; + } + } } - }); + } + _toXYZData() { + const header = this._header; + const byteBuffer = new Uint8Array(this._buff); + const xyzData = new Float32Array(header.extent[0] * header.extent[1] * header.extent[2]); + const blocks = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(header.extent[0] / 8, header.extent[1] / 8, header.extent[2] / 8); + const pos = {}; + pos.counter = 512; + for (let zBlock = 0; zBlock < blocks.z; ++zBlock) { + for (let yBlock = 0; yBlock < blocks.y; ++yBlock) { + for (let xBlock = 0; xBlock < blocks.x; ++xBlock) { + this._blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos); + } + } + } + this._calculateInfoParams(xyzData); + return xyzData; + } + _calculateInfoParams(xyzData) { + this._header.dmean /= xyzData.length; + let dispersion = 0; + let minDensity = xyzData[0]; + let maxDensity = xyzData[0]; + for (let j = 0; j < xyzData.length; j++) { + dispersion += (this._header.dmean - xyzData[j]) ** 2; + if (xyzData[j] < minDensity) { + minDensity = xyzData[j]; + } + if (xyzData[j] > maxDensity) { + maxDensity = xyzData[j]; + } + } + this._header.sd = Math.sqrt(dispersion / xyzData.length); + this._header.dmax = maxDensity; + this._header.dmin = minDensity; + } +} +class DSN6Parser extends Parser { + constructor(data, options) { + super(data, options); + this._options.fileType = 'dsn6'; + this.model = new DSN6Model(); + } + static canParse(data, options) { + if (!data) { + return false; + } + return data instanceof ArrayBuffer && Parser.checkDataTypeOptions(options, 'dsn6'); + } + static canProbablyParse(_data) { + return false; + } + parseSync() { + return this.model.parse(this._data); + } +} +DSN6Parser.formats = ['dsn6']; +DSN6Parser.extensions = ['.dsn6', '.omap']; +DSN6Parser.binary = true; +/* harmony default export */ const parsers_DSN6Parser = (DSN6Parser); +;// CONCATENATED MODULE: ./src/io/parsers/GROReader.js - return found; -}; -/* - * Get a list of names of visuals currently shown by the viewer - */ +/** + * Little helper class for GRO Parser usage. + * @extends PDBStream + */ +class GROReader extends parsers_PDBStream { + constructor(data) { + super(data); + /** @type Number */ + this._next = -1; // End position of line + this.next(); + } -Miew.prototype.getVisuals = function () { - return Object.keys(this._visuals); -}; -/* - * Get complex visuals count + /** + * Getting end of string. + * @returns {Number} Pointer to end of string */ + getNext() { + return this._next; + } +} +/* harmony default export */ const parsers_GROReader = (GROReader); +;// CONCATENATED MODULE: ./src/io/parsers/GROParser.js -Miew.prototype.getComplexVisualsCount = function () { - var count = 0; - - this._forEachComplexVisual(function () { - return count++; - }); - - return count; -}; -/* - * Get current visual - */ - -Miew.prototype.getCurrentVisual = function () { - return this._curVisualName; -}; -/* - * Set current visual. - * All further operations will be performed on this visual (complex) if not stated otherwise. - */ -Miew.prototype.setCurrentVisual = function (name) { - if (!this._visuals[name]) { - return; - } +const { + Complex: GROParser_Complex, + Element: GROParser_Element, + Molecule: GROParser_Molecule +} = chem; - this._curVisualName = name; -}; /** - * Run the viewer, start processing update/render frames periodically. - * Has no effect if already running. - * @see Miew#halt + * Gromos87 file format parser. + * @extends Parser */ +class GROParser extends Parser { + /** + * Create parser for .gro file format + * + * @param {String} data Input file + * @param {String} options Input options (optional field) + */ + constructor(data, options) { + super(data, options); + /** @type Date */ + this._time = null; // Time in ps, optional field for animations + /** @type Number */ + this._numAtoms = null; // Number of atoms in complex + /** @type Number */ + this._residueNumber = null; // Number of exact residue + /** @type String */ + this._residueName = ''; // Scientific name of exact residue + /** @type String */ + this._atomName = ''; // Scientific name of exact atom + /** @type Number */ + this._atomNumber = null; // Sorted number of exact atom + /** @type Array */ + this._atomPosition = []; // Array which contains x, y, z position of exact atom + /** @type Array */ + this._atomVelocity = []; // Array which contains x, y, z velocity of exact atom (optional) + /** @type Complex */ + this._complex = null; // Complex structure for unified molecule representation + /** @type Vector3 */ + this._molecules = []; // Molecules array + /** @type Molecule */ + this._molecule = null; // Single molecule + /** @type String */ + this._options.filetype = 'gro'; // Extension of data file. + } + /** + * General check for possibility of parsing. + * @param {String} data - Input file + * @returns {boolean} true if this file is in ascii, false otherwise + */ + canProbablyParse(data) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(this._data) && /^\s*[^\n]*\n\s*\d+ *\n\s*\d+[^\n\d]{3}\s*\w+\s*\d+\s*-?\d/.test(data); + } -Miew.prototype.run = function () { - var _this = this; + /** + * Parsing title of molecule complex. + * NOTE: that names are ESTIMATES, there is no strict rules in Gromos87 standard for first line in input file. + * @param {GROReader} line - Line containing title and time. + */ + _parseTitle(line) { + const { + metadata + } = this._complex; + metadata.id = line.readLine().trim(); + metadata.name = metadata.id.slice(metadata.id.lastIndexOf('\\') + 1, metadata.id.lastIndexOf('.')); + metadata.format = 'gro'; + } - if (!this._running) { - this._running = true; + /** + * Parsing line containing number of atoms information. + * @param {GROReader} line - Line containing number of atoms. + */ + _parseNumberOfAtoms(line) { + this._numAtoms = line.readInt(0, line.getNext()); + if (Number.isNaN(this._numAtoms)) { + throw new Error('Line 2 is not representing atom number. Consider checking input file'); + } + } - if (this._halting) { - this._halting = false; + /** + * Parsing line containing information about residues, atoms etc. Also information about box vectors. + * Format of atoms MUST (by Gromos87 standard) be this: (note that numbering starts not from 0, but from 1!) + * ResidueNumber[1 - 5] ResidueName[6 - 10] AtomName[11 - 15] AtomNumber[16 - 20] Position[21 - 45] Velocity[46 - 69] + * @param {GROReader} line - Line containing information about atom. + */ + _parseAtom(line) { + this._residueNumber = line.readInt(1, 5); + this._residueName = line.readString(6, 10).trim(); + this._atomName = line.readString(11, 15).trim(); + this._atomNumber = line.readInt(16, 20); + const positionX = line.readFloat(21, 28) * 10; + const positionY = line.readFloat(29, 36) * 10; + const positionZ = line.readFloat(37, 45) * 10; + if (Number.isNaN(positionX) || Number.isNaN(positionY) || Number.isNaN(positionZ)) { + this._complex.error = { + message: `Atom position is invalid in "${line.readLine()}"` + }; return; } + /* const velocityX = line.readFloat(46, 53); + const velocityY = line.readFloat(54, 61); + const velocityZ = line.readFloat(62, 69); */ + /* Adding residue and atom to complex structure */ + const type = GROParser_Element.getByName(this._atomName[0]); /* MAGIC 0. REASONS: This name is something like "CA", where + C - is an element an A is something else. But what about Calcium? */ + if (type.fullName === 'Unknown') { + this._complex.error = { + message: `${this._atomName[0]} hasn't been recognised as an atom name.` + }; + return; + } + const role = GROParser_Element.Role[this._atomName]; + /* Firstly, create a dummy chain */ + let chain = this._chain; + if (!chain) { + this._chain = chain = this._complex.addChain('A'); + } + /* Secondly, add residue to that chain */ + let residue = this._residue; + if (!residue || residue.getSequence() !== this._residueNumber) { + this._residue = residue = chain.addResidue(this._residueName, this._residueNumber, ' '); + } + /* Lastly, add atom to that residue */ + this._atomPosition = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(positionX, positionY, positionZ); + /* Adding default constants to correct atom addition process */ + const het = true; + const altLoc = ' '; + const occupancy = 1; + const tempFactor = 1; + const charge = 0; + residue.addAtom(this._atomName, type, this._atomPosition, role, het, this._atomNumber, altLoc, occupancy, tempFactor, charge); + } - this._objectControls.enable(true); - - this._interpolator.resume(); - - this._requestAnimationFrame(function () { - return _this._onTick(); + /** + * Some finalizing procedures. In '.gro' file format there is only 1 chain and 1 molecule. + */ + _finalize() { + const molecule = new GROParser_Molecule(this._complex, this._complex.metadata.name, 1); + // aggregate residues from chain + molecule.residues = this._chain._residues; + molecule._chains = this._chain; + this._complex._molecules[0] = molecule; + this._molecules.push(molecule); + this._complex.finalize({ + needAutoBonding: true, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap }); } -}; -/** - * Request the viewer to stop. - * Will be processed during the next frame. - * @see Miew#run - */ - - -Miew.prototype.halt = function () { - if (this._running) { - this._discardComponentEdit(); - this._discardFragmentEdit(); + /** + * Main parsing procedure. + * @returns {Complex} Complex structure for visualizing. + */ + parseSync() { + /* Create "Complex" variable */ + const result = this._complex = new GROParser_Complex(); + /* Parse input file line-by-line */ + const reader = new parsers_GROReader(this._data); + let counter = 0; /* Simple counter regarding to format of .gro file */ + /* First two lines - technical information, other lines - Atoms */ + this._parseTitle(reader); + reader.next(); + this._parseNumberOfAtoms(reader); + reader.next(); + for (counter = 0; counter < this._numAtoms; ++counter) { + if (!reader.end()) { + this._parseAtom(reader); + reader.next(); + } else break; + } + /* If number of atoms in second line is less then actual atoms in file */ + if (counter < this._numAtoms) { + this._complex.error = { + message: 'File ended unexpectedly.' + }; + } + /* Catch errors occurred in parsing process */ + if (result.error) { + throw new Error(result.error.message); + } - this._objectControls.enable(false); + /* Finalizing data */ + this._finalize(); - this._interpolator.pause(); + /* Cleaning up */ + this._atomPosition = null; + this._complex = null; + this._molecules = null; + this._molecule = null; - this._halting = true; + /* Return resulting Complex variable */ + return result; } -}; -/** - * Request the viewer to start / stop responsing - * on hot keys. - * @param enabled - start (true) or stop (false) response on hot keys. - */ +} +GROParser.formats = ['gro']; +GROParser.extensions = ['.gro']; +/* harmony default export */ const parsers_GROParser = (GROParser); +;// CONCATENATED MODULE: ./src/io/parsers/MOL2Parser.js -Miew.prototype.enableHotKeys = function (enabled) { - this._hotKeysEnabled = enabled; - this._objectControls.enableHotkeys(enabled); +const { + Complex: MOL2Parser_Complex, + Element: MOL2Parser_Element, + Bond: MOL2Parser_Bond, + Molecule: MOL2Parser_Molecule +} = chem; +const MOL2Parser_orderMap = { + un: 0, + 1: 1, + 2: 2, + 3: 3, + ar: 1, + am: 1, + nc: 0, + du: 1 }; -/** - * Callback which processes window resize. - * @private - */ - - -Miew.prototype._onResize = function () { - this._needRender = true; - var gfx = this._gfx; - gfx.width = this._container.clientWidth; - gfx.height = this._container.clientHeight; - gfx.camera.aspect = gfx.width / gfx.height; - gfx.camera.setMinimalFov(settings.now.camFov); - gfx.camera.updateProjectionMatrix(); - gfx.renderer.setSize(gfx.width, gfx.height); - gfx.renderer2d.setSize(gfx.width, gfx.height); - this.dispatchEvent({ - type: 'resize' - }); +const MOL2Parser_typeMap = { + un: MOL2Parser_Bond.BondType.UNKNOWN, + // unknown (cannot be determined from the parameter tables) + 1: MOL2Parser_Bond.BondType.COVALENT, + // single + 2: MOL2Parser_Bond.BondType.COVALENT, + // double + 3: MOL2Parser_Bond.BondType.COVALENT, + // triple + ar: MOL2Parser_Bond.BondType.AROMATIC, + // aromatic + am: MOL2Parser_Bond.BondType.COVALENT, + // amide + nc: MOL2Parser_Bond.BondType.UNKNOWN, + // not connected + du: MOL2Parser_Bond.BondType.COVALENT // dummy }; +const resNumberRegex = /\d+$/; +const spacesRegex = /\s+/; +function splitToFields(str) { + return str.trim().split(spacesRegex); +} +/* There is no jsdoc documentation because of eslint corrections: + * not all Parser methods are implemented + */ -Miew.prototype._resizeOffscreenBuffers = function (width, height, stereo) { - var gfx = this._gfx; - stereo = stereo || 'NONE'; - var isAnaglyph = stereo === 'NONE' || stereo === 'ANAGLYPH'; - var multi = isAnaglyph ? 1 : 0.5; - gfx.offscreenBuf.setSize(multi * width, height); - gfx.offscreenBuf2.setSize(multi * width, height); - gfx.offscreenBuf3.setSize(multi * width, height); - gfx.offscreenBuf4.setSize(multi * width, height); - - if (gfx.offscreenBuf5) { - gfx.offscreenBuf5.setSize(multi * width, height); +class MOL2Parser extends Parser { + constructor(data, options) { + super(data, options); + this._complex = null; + this._chain = null; + this._residue = null; + this._compoundIndx = -1; + this._molecules = []; + this._molecule = null; + this._currPosIdx = 0; + this._currStartIdx = 0; + this._serialAtomMap = {}; + this._options.fileType = 'mol2'; + } + _parseRawStrings(data) { + return data.split(/\r?\n|\r/); + } + _toStringFromStart(numb, MOL2Data) { + const newPosIdx = this._currStartIdx + numb; + this._currPosIdx = newPosIdx < MOL2Data.length ? newPosIdx : this._currStartIdx; + } + _toHeaderString(header, MOL2Data) { + this._toStringFromStart(0, MOL2Data); + while (this._currPosIdx < MOL2Data.length) { + if (MOL2Data[this._currPosIdx].match(`@${header}`)) { + return; + } + this._currPosIdx++; + } + this._toStringFromStart(0, MOL2Data); } - - if (gfx.offscreenBuf6) { - gfx.offscreenBuf6.setSize(multi * width, height); + _toStringFromHeader(header, numb, MOL2Data) { + this._toHeaderString(header, MOL2Data); + const newPosIdx = this._currPosIdx + numb; + if (MOL2Data[this._currPosIdx].match(`@${header}`) && newPosIdx < MOL2Data.length) { + this._currPosIdx = newPosIdx; + } } - - if (gfx.offscreenBuf7) { - gfx.offscreenBuf7.setSize(multi * width, height); + _setStart(startPos, MOL2Data) { + if (startPos >= MOL2Data.length) { + this._currStartIdx = this._currPosIdx = MOL2Data.length - 1; + } else { + this._currStartIdx = this._currPosIdx = startPos; + } } - - if (isAnaglyph) { - gfx.stereoBufL.setSize(width, height); - gfx.stereoBufR.setSize(width, height); + _probablyHaveDataToParse(MOL2Data) { + return this._currPosIdx < MOL2Data.length - 2; + } + _findNextCompoundStart(MOL2Data) { + while (this._currPosIdx < MOL2Data.length && MOL2Data[this._currPosIdx].trim() !== '@MOLECULE>') { + this._currPosIdx++; + } + this._setStart(++this._currPosIdx, MOL2Data); + return this._probablyHaveDataToParse(MOL2Data); + } + _parseMolecule(MOL2Data) { + this._toHeaderString('MOLECULE', MOL2Data); + const { + metadata + } = this._complex; + metadata.name = MOL2Data[++this._currPosIdx]; + metadata.format = 'mol2'; + this._molecule = { + _index: '', + _chains: [] + }; + this._molecule._index = this._compoundIndx + 1; + this._molecules.push(this._molecule); } -}; -/** - * Callback which processes update/render frames. - * @private - */ - -Miew.prototype._onTick = function () { - var _this2 = this; + /* Atom format description: + * atomId atomName x y z element [resSeq [resName [charge [statusBit]]]] + * statusBits is the internal SYBYL status bits associated with the atom. + * These should never be set by the user. + * Source: http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf + */ + _parseAtoms(atomsNum, MOL2Data) { + this._toHeaderString('ATOM', MOL2Data); + for (let i = 0; i < atomsNum; i++) { + const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]); + if (parsedStr.length < 6) { + throw new Error('MOL2 parsing error: Not enough information to create atom!'); + } + const atomId = parseInt(parsedStr[0], 10); + const atomName = parsedStr[1]; + const x = parseFloat(parsedStr[2]); + const y = parseFloat(parsedStr[3]); + const z = parseFloat(parsedStr[4]); + const element = parsedStr[5].split('.')[0].toUpperCase(); + let charge = 0; + if (parsedStr.length >= 9) { + charge = parseFloat(parsedStr[8]) || 0.0; + } + let chain = this._chain; + if (!chain) { + // .mol2 may contain information about multiple molecules, but they can't be visualized + // at the same time now. There is no need to create different chain IDs then. + this._chain = chain = this._complex.getChain('A') || this._complex.addChain('A'); + this._residue = null; + } + if (!this._setResidue(parsedStr)) { + continue; + } - if (this._halting) { - this._running = false; - this._halting = false; - return; + // These fields are not listed in mol2 format. Set them default. + // Atoms and het atoms doesn't differ in .mol2, + // but het atoms have special residues. It can be used in next updates + const het = false; + const altLoc = ' '; + const occupancy = 1.0; + const tempFactor = 0.0; + const type = MOL2Parser_Element.getByName(element); + const role = MOL2Parser_Element.Role[atomName]; + const xyz = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(x, y, z); + this._residue.addAtom(atomName, type, xyz, role, het, atomId, altLoc, occupancy, tempFactor, charge); + } } + _setResidue(parsedStr) { + let resSeq = 1; + let resName = 'UNK'; // The same meaning has '<0>' in some mol2 files - this._fps.update(); + if (parsedStr.length >= 7) { + resSeq = parseInt(parsedStr[6], 10); + } + if (parsedStr.length >= 8 && parsedStr[7] !== '<0>') { + resName = parsedStr[7].replace(resNumberRegex, ''); + } + if (this.settings.now.nowater) { + if (resName === 'HOH' || resName === 'WAT') { + return false; + } + } + const residue = this._residue; + const chain = this._chain; + if (!residue || residue.getSequence() !== resSeq) { + this._residue = chain.addResidue(resName, resSeq, 'A'); + } + return true; + } - this._requestAnimationFrame(function () { - return _this2._onTick(); - }); + /* Bond format description + * bondId originAtomId targetAtomId bondType [statusBits] + */ + _parseBonds(bondsNum, MOL2Data) { + this._toHeaderString('BOND', MOL2Data); + for (let i = 0; i < bondsNum; i++) { + const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]); + if (parsedStr.length < 3) { + throw new Error('MOL2 parsing error: Missing information about bonds!'); + } + let originAtomId = parseInt(parsedStr[1], 10); + let targetAtomId = parseInt(parsedStr[2], 10); + const bondType = parsedStr[3]; + if (originAtomId > targetAtomId) { + [originAtomId, targetAtomId] = [targetAtomId, originAtomId]; + } + this._complex.addBond(originAtomId, targetAtomId, MOL2Parser_orderMap[bondType] || 0, MOL2Parser_typeMap[bondType] || MOL2Parser_Bond.BondType.UNKNOWN, true); + } + } + _fixSerialAtoms() { + const atoms = this._complex._atoms; + for (let i = 0; i < atoms.length; i++) { + const atom = atoms[i]; + this._serialAtomMap[atom.serial] = atom; + } + } + _fixBondsArray() { + const serialAtomMap = this._serialAtomMap; + const complex = this._complex; + if (Object.keys(serialAtomMap).length === 0) { + throw new Error('MOL2 parsing error: Missing atom information!'); + } + const bonds = complex._bonds; + for (let j = 0; j < bonds.length; j++) { + const bond = bonds[j]; + bond._left = serialAtomMap[bond._left] || null; + bond._right = serialAtomMap[bond._right] || null; + } + } + _finalizeMolecules() { + // Get chain from complex + const chain = this._complex._chains[0]; + this._complex._molecules = []; + + // Aggregate residues from chains + // (to be precise from the chain 'A') + for (let i = 0; i < this._molecules.length; i++) { + const currMolecule = this._molecules[i]; + const molResidues = chain._residues; + const molecule = new MOL2Parser_Molecule(this._complex, currMolecule._name, i + 1); + molecule.residues = molResidues; + this._complex._molecules[i] = molecule; + } + } + _finalize() { + this._complex._finalizeBonds(); + this._fixSerialAtoms(); + this._fixBondsArray(); + this._finalizeMolecules(); + this._complex.finalize({ + needAutoBonding: false, + detectAromaticLoops: this.settings.now.aromatic, + enableEditing: this.settings.now.editing, + serialAtomMap: this._serialAtomMap + }); + } + _parseCompound(MOL2Data) { + this._compoundIndx++; + this._parseMolecule(MOL2Data); + + // Ignoring comments and everything before @MOLECULE block + this._toStringFromHeader('MOLECULE', 2, MOL2Data); + const parsedStr = MOL2Data[this._currPosIdx].trim().split(spacesRegex); + const atomsNum = parsedStr[0]; + const bondsNum = parsedStr[1]; + this._parseAtoms(atomsNum, MOL2Data); + this._parseBonds(bondsNum, MOL2Data); + } + parseSync() { + const result = this._complex = new MOL2Parser_Complex(); + const MOL2Data = this._parseRawStrings(this._data); + do { + this._parseCompound(MOL2Data); + } while (this._findNextCompoundStart(MOL2Data)); + this._finalize(); + return result; + } +} +MOL2Parser.formats = ['mol2']; +MOL2Parser.extensions = ['.mol2', '.ml2', '.sy2']; +/* harmony default export */ const parsers_MOL2Parser = (MOL2Parser); +;// CONCATENATED MODULE: ./src/io/parsers.js - this._onUpdate(); - if (this._needRender) { - this._onRender(); - this._needRender = !settings.now.suspendRender || settings.now.stereo === 'WEBVR'; - } -}; -Miew.prototype._getBSphereRadius = function () { - // calculate radius that would include all visuals - var radius = 0; - this._forEachVisual(function (visual) { - radius = Math.max(radius, visual.getBoundaries().boundingSphere.radius); - }); - return radius * this._objectControls.getScale(); -}; -/** - * Calculate bounding box that would include all visuals and being axis aligned in world defined by - * transformation matrix: matrix - * @param {Matrix4} matrix - transformation matrix. - * @param {object} OBB - calculating bounding box. - * @param {Vector3} OBB.center - OBB center. - * @param {Vector3} OBB.halfSize - half magnitude of OBB sizes. - */ -Miew.prototype.getOBB = function () { - var _bSphereForOneVisual = new Sphere(); - var _bBoxForOneVisual = new Box3(); - var _bBox = new Box3(); - var _invMatrix = new Matrix4(); - var _points = [new Vector3(), new Vector3(), new Vector3(), new Vector3()]; - return function (matrix, OBB) { - _bBox.makeEmpty(); +/* harmony default export */ const parsers = (new parsers_ParserList([ +// note: order might be important +parsers_PDBParser, parsers_CIFParser, parsers_MMTFParser, parsers_XYZParser, parsers_CMLParser, parsers_PubChemParser, SDFParser, parsers_CCP4Parser, parsers_DSN6Parser, parsers_GROParser, parsers_MOL2Parser])); +;// CONCATENATED MODULE: ./src/io/exporters/ExporterList.js - this._forEachVisual(function (visual) { - _bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere); - _bSphereForOneVisual.applyMatrix4(visual.matrixWorld).applyMatrix4(matrix); +/** + * A list of available exporters. + * @extends EntityList + */ +class ExporterList extends utils_EntityList { + /** + * Create a list of exporters. + * The exporters are indexed by supported data formats (`.formats` and + * `.extensions` properties of a Exporter subclass). + * The Exporters can be retrieved later by matching against specs (see {@link ExporterList#find}). + * + * @param {!Array=} someExporters A list of {@link Exporter} subclasses to + * automatically register at creation time. + * @see ExporterList#register + */ + constructor() { + let someExporters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + super(someExporters, ['formats']); + } - _bSphereForOneVisual.getBoundingBox(_bBoxForOneVisual); + /** + * Find a suitable exporter for data. + * + * @param {Object} specs Exporter specifications. + * @param {string=} specs.format Supported data format. + * @param {*=} specs.data Data to export. + */ + find(specs) { + let list = []; + if (specs.format) { + list = this._dict.formats[specs.format.toLowerCase()] || []; + } + return [...list]; + } +} +/* harmony default export */ const exporters_ExporterList = (ExporterList); +;// CONCATENATED MODULE: ./src/io/exporters/Exporter.js - _bBox.union(_bBoxForOneVisual); +class Exporter { + constructor(source, options) { + this._source = source; + this._options = options || {}; + this._abort = false; + } + exportSync() { + throw new Error('Exporting to this source is not implemented'); + } + export() { + return new Promise((resolve, reject) => { + setTimeout(() => { + try { + if (this._abort) { + return reject(new Error('Export aborted')); + } + return resolve(this.exportSync()); + } catch (error) { + return reject(error); + } + }); }); + } + abort() { + this._abort = true; + } +} +utils_makeContextDependent(Exporter.prototype); +;// CONCATENATED MODULE: ./src/io/exporters/PDBResult.js - _bBox.getCenter(OBB.center); - - _invMatrix.getInverse(matrix); - - OBB.center.applyMatrix4(_invMatrix); - var min = _bBox.min; - var max = _bBox.max; - _points[0].set(min.x, min.y, min.z); // 000 +class PDBResult { + constructor() { + this._resultArray = []; + this._currentStr = -1; + this._tag = null; + this._fixedNumeration = false; + this._numeration = false; + this._tagStrNum = 0; + } + getResult() { + this.writeString('\n', 81, 81); + return this._resultArray.join(''); + } + _currentStrLength() { + const curStr = this._resultArray[this._currentStr]; + return curStr ? curStr.length : 0; + } + // numeration can be number or boolean + // if numeration is number then just put this number to 8-10 pos in string + // if numeration is boolean then increase number for all new strings + newTag(tag, numeration) { + if (!tag) { + this._tag = null; + } else { + this._tag = tag; + } + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(numeration)) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isNumber(numeration)) { + this._tagStrNum = numeration; + this._numeration = true; + this._fixedNumeration = true; + } else if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isBoolean(numeration)) { + this._tagStrNum = 0; + this._numeration = numeration; + this._fixedNumeration = false; + } + } else { + this._numeration = false; + this._fixedNumeration = false; + this._tagStrNum = 0; + } + } + newString(tag) { + this.writeString('\n', 81, 81); + this._currentStr++; + this._resultArray.push(''); + if (tag) { + this.writeString(tag, 1, 6); + } else if (this._tag) { + this.writeString(this._tag, 1, 6); + } + if (this._numeration) { + if (!this._fixedNumeration) { + this._tagStrNum++; + } + if (this._tagStrNum !== 1) { + this.writeString(this._tagStrNum.toString(), 10, 8); + } + } + } + writeEntireString(string, maxStrPos, concat) { + if (!maxStrPos) { + maxStrPos = 81; + } + for (let j = 0; j < string.length; j++) { + if (this._currentStrLength() === maxStrPos && j !== string.length - 1) { + this.newString(); + if (concat) { + // pretty hardcoddy + this.writeString(concat.tag, concat.begin, concat.end); + } + } + if (string[j] === '\n') { + this.newString(); + } else { + this.writeString(string[j]); + } + } + } + writeString(string, begin, end) { + let curStr = this._resultArray[this._currentStr]; + let str; + const curStrLength = curStr ? curStr.length : 0; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(string)) { + return; + } + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isNumber(begin)) { + begin = curStrLength + 1; + } + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isNumber(end)) { + end = curStrLength + string.length; + } + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(string)) { + str = string.toString(); + } else { + str = string; + } + const finish = begin < end ? end : begin; + const start = begin < end ? begin : end; + if (str.length > Math.abs(begin - end) + 1) { + str = str.substr(0, Math.abs(begin - end + 1)); + } - _points[1].set(max.x, min.y, min.z); // 100 + // spaces before start of new data + if (start > curStrLength + 1) { + this._resultArray[this._currentStr] += ' '.repeat(start - curStrLength - 1); + } else if (start <= curStrLength) { + const cStr = this._resultArray[this._currentStr]; + this._resultArray[this._currentStr] = cStr.slice(0, start - 1); + } + // if reverse order + // reverse order of end and begin means that user wants to align text right + if (end < begin) { + const len = begin - end + 1; + str = ' '.repeat(len - str.length) + str; + } - _points[2].set(min.x, max.y, min.z); // 010 + // some hardcode fix for space between string numeration and data + // (see pdb file format description) + if (start === 11 && this._numeration && this._tagStrNum !== 1) { + str = ` ${str}`; + } + // append new data to string + this._resultArray[this._currentStr] += str; + curStr = this._resultArray[this._currentStr]; + if (finish > curStr.length) { + this._resultArray[this._currentStr] += ' '.repeat(finish - curStr.length); + } + } + writeBondsArray(bonds, atom) { + const bondsArrays = this._getSubArrays(bonds, 4); + for (let k = 0; k < bondsArrays.length; k++) { + this.newString(); + this.writeString(atom.serial, 11, 7); + for (let j = 0; j < bondsArrays[k].length; j++) { + const serial = bondsArrays[k][j]._left.serial === atom.serial ? bondsArrays[k][j]._right.serial : bondsArrays[k][j]._left.serial; + this.writeString(serial, 16 + 5 * j, 12 + 5 * j); + } + } + } + _getSubArrays(arr, subArraySize) { + const subArrays = []; + for (let i = 0; i < arr.length; i += subArraySize) { + subArrays.push(arr.slice(i, i + subArraySize)); + } + return subArrays; + } - _points[3].set(min.x, min.y, max.z); // 001 + // function for writing matrix in Remark290 and Remark350 tags + // (see pdb file description) + writeMatrix(matrix, matrixIndx, tag) { + for (let j = 0; j < 3; j++) { + this.newString(); + this.writeString(tag, 14, 18); + this.writeString((j + 1).toString(), 19, 19); + this.writeString(matrixIndx.toString(), 23, 20); + for (let k = 0; k < 3; k++) { + const numb = parseFloat(matrix.elements[j * 4 + k]).toFixed(6); + this.writeString(numb.toString(), 33 + k * 10, 24 + k * 10); + } + const numb = parseFloat(matrix.elements[j * 4 + 3]).toFixed(5); + this.writeString(numb.toString(), 68, 55); + } + } + writeMatrices(matrices, string) { + if (!matrices) { + return; + } + const matrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + for (let j = 0; j < matrices.length; j++) { + matrix.copy(matrices[j]).transpose(); + this.writeMatrix(matrix, j + 1, string); + } + } +} +;// CONCATENATED MODULE: ./src/io/exporters/PDBExporter.js - for (var i = 0, l = _points.length; i < l; i++) { - _points[i].applyMatrix4(_invMatrix); - } - OBB.halfSize.set(Math.abs(_points[0].x - _points[1].x), Math.abs(_points[0].y - _points[2].y), Math.abs(_points[0].z - _points[3].z)).multiplyScalar(0.5); - }; -}(); -Miew.prototype._updateFog = function () { - var gfx = this._gfx; - if (settings.now.fog) { - if (typeof gfx.scene.fog === 'undefined' || gfx.scene.fog === null) { - var color = chooseFogColor(); - gfx.scene.fog = new Fog(color); - this._setUberMaterialValues({ - fog: settings.now.fog +class PDBExporter extends Exporter { + constructor(source, options) { + super(source, options); + this._tags = ['HEADER', 'TITLE', 'COMPND', 'REMARK', 'HELIX', 'SHEET', 'ATOM and HETATM', 'CONECT']; + this._result = null; + this._tagExtractors = { + HEADER: this._extractHEADER, + TITLE: this._extractTITLE, + 'ATOM and HETATM': this._extractATOM, + CONECT: this._extractCONECT, + COMPND: this._extractCOMPND, + REMARK: this._extractREMARK, + HELIX: this._extractHELIX, + SHEET: this._extractSHEET + }; + this._stringForRemark350 = 'COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN\n' + 'BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE\n' + 'MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS\n' + 'GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND\n' + 'CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.'; + this._stringForRemark290 = 'CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS\n' + 'THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM\n' + 'RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY\n' + 'RELATED MOLECULES.'; + } + exportSync() { + const result = new PDBResult(); + if (!this._source) { + return this._result; + } + for (let i = 0; i < this._tags.length; i++) { + const tag = this._tags[i]; + const func = this._tagExtractors[tag]; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isFunction(func)) { + func.call(this, result); + } + } + this._result = result.getResult(); + return this._result; + } + _extractHEADER(result) { + if (!this._source.metadata) { + return; + } + const { + metadata + } = this._source; + result.newTag('HEADER'); + result.newString(); + if (metadata.classification) { + result.writeString(metadata.classification, 11, 50); + } + if (metadata.date) { + result.writeString(metadata.date, 51, 59); + } + if (metadata.id) { + result.writeString(metadata.id, 63, 66); + } + } + _extractTITLE(result) { + if (!this._source.metadata) { + return; + } + const { + metadata + } = this._source; + if (!metadata.title) { + return; + } + result.newTag('TITLE', true); + for (let i = 0; i < metadata.title.length; i++) { + result.newString(); + result.writeString(metadata.title[i], 11, 80); + } + } + _extractCONECT(result) { + if (!this._source._atoms) { + return; + } + const atoms = this._source._atoms; + result.newTag('CONECT'); + for (let i = 0; i < atoms.length; i++) { + const fixedBonds = atoms[i].bonds.filter(bond => bond._fixed); + if (fixedBonds.length !== 0) { + result.writeBondsArray(fixedBonds.reverse(), atoms[i]); + } + } + } + _extractSHEET(result) { + if (!this._source._sheets) { + return; + } + result.newTag('SHEET'); + const sheets = this._source._sheets; + for (let i = 0; i < sheets.length; i++) { + if (sheets[i]._strands) { + const strands = sheets[i]._strands; + for (let j = 0; j < strands.length; j++) { + result.newString(); + result.writeString(j + 1, 10, 8); + result.writeString(sheets[i]._name, 14, 12); + result.writeString(strands.length, 16, 15); + result.writeString(strands[j].init._type._name, 18, 20); + result.writeString(strands[j].init._chain._name, 22, 22); + result.writeString(strands[j].init._sequence, 26, 23); + result.writeString(strands[j].init._icode, 27, 27); + result.writeString(strands[j].term._type._name, 29, 31); + result.writeString(strands[j].init._chain._name, 33, 33); + result.writeString(strands[j].term._sequence, 37, 34); + result.writeString(strands[j].term._icode, 38, 38); + result.writeString(strands[j].sense, 40, 39); + } + } + } + } + _extractHELIX(result) { + if (!this._source._helices) { + return; + } + result.newTag('HELIX'); + const helices = this._source._helices; + for (let i = 0; i < helices.length; i++) { + const helix = helices[i]; + const helixClass = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].invert(typeByPDBHelixClass); + result.newString(); + result.writeString(helix.serial, 10, 8); + result.writeString(helix.name, 14, 12); + result.writeString(helix.init._type._name, 16, 18); + result.writeString(helix.init._chain._name, 20, 20); + result.writeString(helix.init._sequence, 25, 22); + result.writeString(helix.init._icode, 26, 26); + result.writeString(helix.term._type._name, 28, 30); + result.writeString(helix.term._chain._name, 32, 32); + result.writeString(helix.term._sequence, 37, 34); + result.writeString(helix.term._icode, 38, 38); + result.writeString(helixClass[helix.type], 40, 39); + result.writeString(helix.comment, 41, 70); + result.writeString(helix.length, 76, 72); + } + } + _extractATOM(result) { + if (!this._source._atoms) { + return; + } + const atoms = this._source._atoms; + for (let i = 0; i < atoms.length; i++) { + const tag = atoms[i].het ? 'HETATM' : 'ATOM'; + result.newString(tag); + const startIndx = atoms[i].element.name.length > 1 || atoms[i].name.length > 3 ? 13 : 14; + result.writeString(atoms[i].serial, 11, 7); + result.writeString(atoms[i].name, startIndx, 16); + result.writeString(String.fromCharCode(atoms[i].location), 17, 17); + result.writeString(atoms[i].residue._type._name, 20, 18); + result.writeString(atoms[i].residue._chain._name, 22, 22); + result.writeString(atoms[i].residue._sequence, 26, 23); + result.writeString(atoms[i].residue._icode, 27, 27); + result.writeString(atoms[i].position.x.toFixed(3), 38, 31); + result.writeString(atoms[i].position.y.toFixed(3), 46, 39); + result.writeString(atoms[i].position.z.toFixed(3), 54, 47); + result.writeString(atoms[i].occupancy.toFixed(2), 60, 55); + result.writeString(atoms[i].temperature.toFixed(2), 66, 61); + result.writeString(atoms[i].element.name, 78, 77); + if (atoms[i].charge) { + result.writeString(atoms[i].charge, 79, 80); + } + } + } + _extractCOMPND(result) { + if (!this._source._molecules) { + return; + } + const molecules = this._source._molecules; + result.newTag('COMPND', true); + for (let i = 0; i < molecules.length; i++) { + const chains = this._getMoleculeChains(molecules[i]); + result.newString(); + result.writeString(`MOL_ID: ${molecules[i].index};`, 11, 80); + result.newString(); + result.writeString(`MOLECULE: ${molecules[i].name};`, 11, 80); + result.newString(); + result.writeString('CHAIN: ', 11, 18); + const chainsString = `${chains.join(', ')};`; + result.writeEntireString(chainsString, 81); + } + } + _extractREMARK(result) { + this._Remark290(result); + this._Remark350(result); + } + _Remark290(result) { + if (!this._source.symmetry) { + return; + } + if (this._source.symmetry.length !== 0) { + const matrices = this._source.symmetry; + result.newTag('REMARK', 290); + result.newString(); + result.newString(); + result.writeEntireString(this._stringForRemark290); + result.writeMatrices(matrices, 'SMTRY'); + result.newString(); + result.newString(); + result.writeString('REMARK: NULL', 11, 80); + } + } + _Remark350(result) { + if (!this._source.units) { + return; + } + const { + units + } = this._source; + let biomolIndx = 0; + result.newTag('REMARK', 350); + result.newString(); + result.newString(); + result.writeEntireString(this._stringForRemark350); + const assemblies = units.filter(unit => unit instanceof chem_Assembly); + for (let i = 0; i < assemblies.length; i++) { + result.newString(); + result.newString(); + biomolIndx++; + result.writeString(`BIOMOLECULE: ${biomolIndx}`, 11, 80); + const chains = assemblies[i].chains.join(', '); + result.newString(); + result.writeString('APPLY THE FOLLOWING TO CHAINS: '); + result.writeEntireString(chains, 69, { + tag: 'AND CHAINS: ', + begin: 31, + end: 42 }); + const { + matrices + } = assemblies[i]; + result.writeMatrices(matrices, 'BIOMT'); } - - updateFogRange(gfx.scene.fog, gfx.camera.position.z, this._getBSphereRadius()); - } else if (gfx.scene.fog) { - gfx.scene.fog = undefined; - - this._setUberMaterialValues({ - fog: settings.now.fog - }); } -}; - -Miew.prototype._onUpdate = function () { - if (this.isScriptingCommandAvailable !== undefined && this.isScriptingCommandAvailable() && !this._building) { - this.callNextCmd(); + _getMoleculeChains(molecule) { + function getChainName(residue) { + return residue._chain._name; + } + const chainNames = molecule.residues.map(getChainName); + return chainNames.filter((item, pos) => chainNames.indexOf(item) === pos); } +} +PDBExporter.formats = ['pdb']; +PDBExporter.SourceClass = chem_Complex; +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBXModel.js - this._objectControls.update(); - - this._forEachComplexVisual(function (visual) { - visual.getComplex().update(); - }); - - if (settings.now.autobuild && !this._loading.length && !this._building && this._needRebuild()) { - this.rebuild(); +const FBX_POS_SIZE = 3; +const FBX_NORM_SIZE = 3; +const FBX_COL_SIZE = 4; +function copyFbxPoint3(src, srcIdx, dst, dstIdx) { + dst[dstIdx] = src[srcIdx]; + dst[dstIdx + 1] = src[srcIdx + 1]; + dst[dstIdx + 2] = src[srcIdx + 2]; +} +function copyFbxPoint4(src, srcIdx, dst, dstIdx, value) { + dst[dstIdx] = src[srcIdx]; + dst[dstIdx + 1] = src[srcIdx + 1]; + dst[dstIdx + 2] = src[srcIdx + 2]; + dst[dstIdx + 3] = value; +} +const vector4 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector4(); +function copyTransformedPoint3(src, srcIdx, dst, dstIdx, opts) { + vector4.set(src[srcIdx], src[srcIdx + 1], src[srcIdx + 2], opts.w); + vector4.applyMatrix4(opts.matrix); + dst[dstIdx] = vector4.x; + dst[dstIdx + 1] = vector4.y; + dst[dstIdx + 2] = vector4.z; +} +function setSubArray(src, dst, count, copyFunctor, functorOpts) { + if ((dst.array.length - dst.start) / dst.stride < count || (src.array.length - src.start) / src.stride < count) { + return; // we've got no space } - - if (!this._loading.length && !this._building && !this._needRebuild()) { - this._updateView(); + if (src.stride === dst.stride) { + // stride is the same + dst.array.set(src.array, dst.start); + } else { + let idx = dst.start; + let arridx = src.start; + for (let i = 0; i < count; ++i, idx += dst.stride, arridx += src.stride) { + copyFunctor(src.array, arridx, dst.array, idx, functorOpts); + } } - - this._updateFog(); - - if (this._gfx.renderer.xr.enabled) { - this.webVR.updateMoleculeScale(); +} +class FBXModel { + constructor() { + this.positions = null; + this.normals = null; + this.colors = null; + this.indices = null; + this.lastPos = 0; + this.lastNorm = 0; + this.lastCol = 0; + this.lastIdx = 0; + } + init(vertsCount, indsCount) { + this.positions = new Float32Array(vertsCount * FBX_POS_SIZE); + this.normals = new Float32Array(vertsCount * FBX_NORM_SIZE); + this.colors = new Float32Array(vertsCount * FBX_COL_SIZE); + this.indices = new Int32Array(indsCount); + } + setPositions(array, start, count, stride) { + const src = { + array, + start, + stride + }; + const dst = { + array: this.positions, + start: this.lastPos, + stride: FBX_POS_SIZE + }; + setSubArray(src, dst, count, copyFbxPoint3); + this.lastPos += count * FBX_POS_SIZE; + } + setTransformedPositions(array, start, count, stride, matrix) { + let idx = this.lastPos; + let arrIdx = start; + const opts = { + matrix, + w: 1 + }; + for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_POS_SIZE) { + copyTransformedPoint3(array, arrIdx, this.positions, idx, opts); + } + this.lastPos += count * FBX_POS_SIZE; + } + setNormals(array, start, count, stride) { + const src = { + array, + start, + stride + }; + const dst = { + array: this.normals, + start: this.lastNorm, + stride: FBX_NORM_SIZE + }; + setSubArray(src, dst, count, copyFbxPoint3); + this.lastNorm += count * FBX_NORM_SIZE; + } + setTransformedNormals(array, start, count, stride, matrix) { + let idx = this.lastNorm; + let arrIdx = start; + const opts = { + matrix, + w: 0 + }; + for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_NORM_SIZE) { + copyTransformedPoint3(array, arrIdx, this.normals, idx, opts); + } + this.lastNorm += count * FBX_NORM_SIZE; + } + setColors(array, start, count, stride) { + const src = { + array, + start, + stride + }; + const dst = { + array: this.colors, + start: this.lastCol, + stride: FBX_COL_SIZE + }; + setSubArray(src, dst, count, copyFbxPoint4, 1); + this.lastCol += count * FBX_COL_SIZE; + } + setIndices(array, start, count) { + this.indices.set(array, this.lastIdx); + this.lastIdx += count; + } + setShiftedIndices(array, count, shift) { + const shifted = array.map(x => x + shift); + this.setIndices(shifted, 0, count); + } + getVerticesNumber() { + return this.lastPos / FBX_POS_SIZE; + } + addInstance(matrix, geo) { + // add indices at first to take old number of vertices for shift + const currentCount = this.getVerticesNumber(); + this.setShiftedIndices(geo.indices, geo.indices.length, currentCount); + // simply write vertices at empty space + const size = geo.itemSize; + this.setTransformedPositions(geo.positions, 0, geo.vertsCount, size.position, matrix); + this.setTransformedNormals(geo.normals, 0, geo.vertsCount, size.normal, matrix); + this.setColors(geo.colors, 0, geo.vertsCount, size.color); + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBXGeometry.js +/** Base class for fbx geometry contains simply organized attributes: positions+normals+colors, indices. */ +class FBXGeometry { + /** + * Create a base geo with necessary members. + */ + constructor() { + this.positions = null; + this.normals = null; + this.colors = null; + this.indices = null; + this.vertsCount = 0; + this.itemSize = null; } -}; - -Miew.prototype._onRender = function () { - var gfx = this._gfx; // update all matrices - - gfx.scene.updateMatrixWorld(); - gfx.camera.updateMatrixWorld(); - this._clipPlaneUpdateValue(this._getBSphereRadius()); + /** + * Initialize base geo storing items info from attributes. + * @param {Object} geo - THREE.BufferGeometry. + */ + init(geo, _info) { + const { + attributes + } = geo; + // save item size + this.itemSize = { + position: attributes.position.itemSize, + normal: attributes.normal.itemSize, + color: attributes.color.itemSize + }; + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBX1CGeometry.js - this._fogFarUpdateValue(); - gfx.renderer.setRenderTarget(null); - gfx.renderer.clear(); +/** + * Fbx geometry, that copies positions+normals, indexes and creates colors filled with defined value. + * @extends FBXGeometry + */ +class FBX1CGeometry extends FBXGeometry { + /** + * Initialize geo storing positions, normals, indices and create colors. + * @param {Object} geo - THREE.BufferGeometry. + */ + init(geo, _info) { + super.init(geo, _info); + const { + attributes: { + position, + normal + }, + index + } = geo; + // copy vertices attributes + this.vertsCount = position.count; + this.positions = position.array; + this.normals = normal.array; + // create color array + this.colors = new Float32Array(this.vertsCount * this.itemSize.color); + // indices + this.indices = index.array; + } - this._renderFrame(settings.now.stereo); -}; + /** + * Set defined color for all items in color attribute + * @param {Object} color - THREE.Color. + */ + setColors(color) { + let offset = 0; + for (let i = 0, l = this.colors.length, cl = this.itemSize.color; i < l; i += cl) { + this.colors[offset++] = color.r; + this.colors[offset++] = color.g; + this.colors[offset++] = color.b; + } + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBX2CCylinder.js -Miew.prototype._renderFrame = function () { - var _anaglyphMat = new AnaglyphMaterial(); - var _size = new Vector2(); +/** + * Fbx geometry, that copies positions+normals, indexes from cylinder geometry and creates colors filled with two + * defined values. + * @extends FBXGeometry + */ +class FBX2CCylinder extends FBXGeometry { + constructor() { + super(); + this._cutRawStart = 0; + this._cutRawEnd = 0; + this._facesPerSlice = 0; + } - return function (stereo) { - var gfx = this._gfx; - var renderer = gfx.renderer; - renderer.getSize(_size); + /** + * Initialize geo by creating new attributes, because we extend number of vertices to make cylinder two-colored. + * Indices remain the same. We process open- end close-ended cylinders and consider cylinders od 2 segments + * in height ONLY. + * NOTE: cylinder consists of 2 height segments and stores parts in the order: tube, topCap, bottomCap + * @param {Object} geo - THREE.BufferGeometry. + * @param {Object} info - information needed for geo extend + */ + init(geo, info) { + super.init(geo, info); + const { + attributes: { + position + }, + index + } = geo; + // extend vertices arrays + this.vertsCount = position.count + info.addPerCylinder; + this._facesPerSlice = info.addPerCylinder; + this.positions = new Float32Array(this.vertsCount * position.itemSize); + this.normals = new Float32Array(this.vertsCount * this.itemSize.normal); + this.colors = new Float32Array(this.vertsCount * this.itemSize.color); + this._extendVertices(geo, info); + // number of indices stays the same + this.indices = new Uint32Array(index.count); + this._extendIndices(geo, info); + } + + /** Extend vertex attributes to have one more slice to make sharp middle startColor-endColor line. */ + _extendVertices(geo, info) { + const { + position + } = geo.attributes; + const { + normal + } = geo.attributes; + const geoParams = geo.getGeoParams(); + const cutRaw = 1; // we expect cylinders of 2 segments in height => so half segment = 1 + this._cutRawStart = cutRaw * geoParams.radialSegments; + this._cutRawEnd = this._cutRawStart + info.addPerCylinder; + { + // write first half of cylinder + let temp = position.array.slice(0, this._cutRawEnd * position.itemSize); + this.positions.set(temp, 0); + temp = normal.array.slice(0, this._cutRawEnd * normal.itemSize); + this.normals.set(temp, 0); + } + { + // write second part of cylinder + let temp = position.array.slice(this._cutRawStart * position.itemSize, position.array.length); + this.positions.set(temp, this._cutRawEnd * position.itemSize); + temp = normal.array.slice(this._cutRawStart * normal.itemSize, normal.array.length); + this.normals.set(temp, this._cutRawEnd * normal.itemSize); + } + } - if (stereo !== 'NONE') { - gfx.camera.focus = gfx.camera.position.z; // set focus to the center of the object + /** Shift values of second part (+caps) indices by newly added vertices count. Number of faces remains the same. */ + _extendIndices(geo, info) { + const { + index + } = geo; + const indicesPerQuad = 6; // quad = 2 triangles => 6 indices + const startToShift = info.addPerCylinder * indicesPerQuad; + const shift = info.addPerCylinder; + let shifted = index.array.slice(startToShift, index.count); + shifted = shifted.map(x => x + shift); // shift only the endings + this.indices.set(index.array, 0); + this.indices.set(shifted, startToShift); + } - gfx.stereoCam.aspect = 1.0; // in anaglyph mode we render full-size image for each eye - // while in other stereo modes only half-size (two images on the screen) + /** + * Set defined colors: (first part + bottom cap), (second part + top cap) + * @param {number} start - start color index + * @param {number} end - start color index + * @param {array} array - array of colors + * @param {array} color - color value components + */ + _setColorRange(start, end, array, color) { + const colorSize = color.length; + for (let i = start; i < end; i += colorSize) { + array.set(color, i); + } + } - if (stereo === 'ANAGLYPH') { - gfx.stereoCam.update(gfx.camera); - } else { - gfx.stereoCam.updateHalfSized(gfx.camera, settings.now.camFov); - } - } // resize offscreen buffers to match the target + /** + * Set defined colors: (first part + bottom cap), (second part + top cap) + * @param {Object} color1 - THREE.Color. + * @param {Object} color2 - THREE.Color. + */ + setColors(color1, color2) { + const colorSize = this.itemSize.color; + const part1End = this._cutRawEnd * colorSize; + const part2End = part1End * 2; + this._setColorRange(0, part1End, this.colors, color1.toArray()); + this._setColorRange(part1End, part2End, this.colors, color2.toArray()); + if (part2End < this.colors.length) { + // cylinder has caps, lets paint them + const capSize = (this._facesPerSlice + 1) * colorSize; + const cap1End = part2End + capSize; + this._setColorRange(part2End, cap1End, this.colors, color2.toArray()); + const cap2End = cap1End + capSize; // should be equal to this.colors.length; + this._setColorRange(cap1End, cap2End, this.colors, color1.toArray()); + } + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBXInfoExtractor.js - var pixelRatio = gfx.renderer.getPixelRatio(); - this._resizeOffscreenBuffers(_size.width * pixelRatio, _size.height * pixelRatio, stereo); - this._renderShadowMap(); - switch (stereo) { - case 'WEBVR': - case 'NONE': - this._renderScene(gfx.camera, false); - break; - case 'SIMPLE': - case 'DISTORTED': - renderer.setScissorTest(true); - renderer.setScissor(0, 0, _size.width / 2, _size.height); - renderer.setViewport(0, 0, _size.width / 2, _size.height); - this._renderScene(this._gfx.stereoCam.cameraL, stereo === 'DISTORTED'); - renderer.setScissor(_size.width / 2, 0, _size.width / 2, _size.height); - renderer.setViewport(_size.width / 2, 0, _size.width / 2, _size.height); - this._renderScene(this._gfx.stereoCam.cameraR, stereo === 'DISTORTED'); - renderer.setScissorTest(false); - break; - case 'ANAGLYPH': - this._renderScene(this._gfx.stereoCam.cameraL, false, gfx.stereoBufL); +class FBXInfoExtractor { + constructor() { + this._materials = []; + this._models = []; + } + process(data) { + this._extractModelsAndMaterials(data); + const models = this._flattenModels(); + return { + name: data.name, + models, + materials: this._materials + }; + } - this._renderScene(this._gfx.stereoCam.cameraR, false, gfx.stereoBufR); + /** + * Extract fbx object information from ComplexVisual + * @param {object} data - complexVisual to get geometry info from + */ + _extractModelsAndMaterials(data) { + const layersOfInterest = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Layers(); + layersOfInterest.set(gfxutils.LAYERS.DEFAULT); + layersOfInterest.enable(gfxutils.LAYERS.TRANSPARENT); + data.traverse(object => { + if (object instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh && object.layers.test(layersOfInterest) && this.checkExportAbility(object)) { + if (object.geometry.type === 'InstancedBufferGeometry') { + this._collectInstancedGeoInfo(object); + } else { + this._collectGeoInfo(object); + } + } + }); + } - renderer.setRenderTarget(null); - _anaglyphMat.uniforms.srcL.value = gfx.stereoBufL.texture; - _anaglyphMat.uniforms.srcR.value = gfx.stereoBufR.texture; - gfx.renderer.renderScreenQuad(_anaglyphMat); - break; + /** + * Reworking indices buffer, see https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/ + * basically, every triangle in Miew has been represented hat way (e.g.) : 0,1,7, but we must (for FBX) rework that + * into: 0,1,-8. + * @param {array} indices - belongs to [0, maxVertIndex] + */ + _reworkIndices(indices) { + const faceSize = 3; + for (let i = faceSize - 1; i < indices.length; i += faceSize) { + indices[i] *= -1; + indices[i]--; } + } - gfx.renderer2d.render(gfx.scene, gfx.camera); - - if (settings.now.axes && gfx.axes && !gfx.renderer.xr.enabled) { - gfx.axes.render(renderer); + /** + * Combine geometry from several models having the same material into one Model and finally prepare indices + * @returns {array} models, combined by material id + */ + _flattenModels() { + let overallVertsCount = 0; + function shift(x) { + return x + overallVertsCount; + } + const combined = []; + // flatten models geometry + for (let i = 0, n = this._models.length; i < n; i++) { + const models = this._models[i]; + let indices = []; + let positions = []; + let normals = []; + let colors = []; + // reorganize every attributes as array of arrays + overallVertsCount = 0; + for (let j = 0; j < models.length; j++) { + const m = models[j]; + indices.push(m.indices.map(shift)); + overallVertsCount += m.getVerticesNumber(); + positions.push(m.positions); + normals.push(m.normals); + colors.push(m.colors); + } + // join all subarrays into one + indices = utils.mergeTypedArraysUnsafe(indices); + this._reworkIndices(indices); + positions = utils.mergeTypedArraysUnsafe(positions); + normals = utils.mergeTypedArraysUnsafe(normals); + colors = utils.mergeTypedArraysUnsafe(colors); + combined.push({ + indices, + positions, + normals, + colors, + verticesCount: overallVertsCount + }); } - }; -}(); - -Miew.prototype._onBgColorChanged = function () { - var gfx = this._gfx; - var color = chooseFogColor(); + return combined; + } - if (gfx) { - if (gfx.scene.fog) { - gfx.scene.fog.color.set(color); + /** + * Check ability to export the kind of mesh. + * @param {object} mesh - given mesh to check + * @returns {boolean} result of check + */ + checkExportAbility(mesh) { + // check mesh on not being empty + if (mesh.geometry.attributes.position.count === 0) { + return false; } - - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + // check type of mesh + // if (mesh.geometry.isInstancedBufferGeometry && settings.now.zSprites) { + if (mesh instanceof meshes_ZSpriteMesh) { + logger.warn('Currently we cannot export \'sprites\' modes, like BS, WV, LC. Please turn of settings \'zSprites\' and try again'); + return false; + } + if (mesh instanceof meshes_ThickLineMesh) { + logger.warn('Currently we cannot export Lines mode'); + return false; + } + return true; } - this._needRender = true; -}; - -Miew.prototype._onFogColorChanged = function () { - var gfx = this._gfx; - var color = chooseFogColor(); - - if (gfx && gfx.scene.fog) { - gfx.scene.fog.color.set(color); + /** + * Save geometry info from common mesh, like Surface or Cartoon + */ + _collectGeoInfo(mesh) { + const { + geometry: { + attributes: { + position, + color, + normal + }, + index + }, + matrix + } = mesh; + const model = new FBXModel(); + const vertCount = position.count; + model.init(vertCount, index.count); + if (matrix.isIdentity()) { + model.setPositions(position.array, 0, vertCount, position.itemSize); + model.setNormals(normal.array, 0, vertCount, normal.itemSize); + } else { + model.setTransformedPositions(position.array, 0, vertCount, position.itemSize, matrix); + model.setTransformedNormals(normal.array, 0, vertCount, normal.itemSize, matrix); + } + model.setColors(color.array, 0, vertCount, color.itemSize); + model.setIndices(index.array, 0, index.count); + const material = this._collectMaterialInfo(mesh); + this._addToPool(model, material); } - this._needRender = true; -}; + /** + * Collect instanced spheres geometry and materials. + * @param {object} mesh - mesh with instanced spheres info + */ + _collectSpheresInfo(mesh) { + const { + geometry: { + attributes: { + position, + color + }, + index + }, + matrix + } = mesh; + const model = new FBXModel(); + const instCount = mesh.geometry.instanceCount; + const vertCount = position.count; + const indsCount = index.count; + model.init(instCount * vertCount, instCount * indsCount); + const geo = new FBX1CGeometry(); + geo.init(mesh.geometry); + const instMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + const objMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + const sphereColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(); + for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) { + // update colors in geometry + const colorIdx = instanceIndex * color.itemSize; + sphereColor.fromArray(color.array, colorIdx); + geo.setColors(sphereColor); + // add instance to the model + this._getSphereInstanceMatrix(mesh.geometry, instanceIndex, instMatrix); + objMatrix.multiplyMatrices(matrix, instMatrix); + model.addInstance(objMatrix, geo); + } + const material = this._collectMaterialInfo(mesh); + this._addToPool(model, material); + } -Miew.prototype._setUberMaterialValues = function (values) { - this._gfx.root.traverse(function (obj) { - if ((obj instanceof Mesh$5 || obj instanceof LineSegments || obj instanceof Line) && obj.material instanceof UberMaterial) { - obj.material.setValues(values); - obj.material.needsUpdate = true; + /** + * Getting all instanced cylinders from given mesh. + * Divide cylinder (add additional vertexes) for prettiness therefore algorithm is a bit complicated + * @param {object} mesh - given mesh with instanced cylinders + */ + _collectCylindersInfo(mesh) { + const { + geometry: { + attributes: { + position, + color, + color2 + }, + index + }, + matrix + } = mesh; + const model = new FBXModel(); + const instCount = mesh.geometry.instanceCount; + const oneCCylinder = new FBX1CGeometry(); + oneCCylinder.init(mesh.geometry); + const splittingInfo = this._gatherCylindersColoringInfo(mesh.geometry); + let twoCCylinder = null; + if (splittingInfo.needToSplit > 0) { + twoCCylinder = new FBX2CCylinder(); + twoCCylinder.init(mesh.geometry, splittingInfo); + } + const additionalVertsCount = splittingInfo.addPerCylinder * splittingInfo.needToSplit; + const vertCount = position.count; + const indsCount = index.count; + model.init(instCount * vertCount + additionalVertsCount, instCount * indsCount); + const instMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + const objMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + const colorStart = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(); + const colorEnd = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(); + let geo = {}; + for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) { + // update colors in geometry + const colorIdx = instanceIndex * color.itemSize; + if (splittingInfo.is2Colored[instanceIndex]) { + // .color2 contains starting color, and .color contains starting color (see uber.frag ATTR_COLOR2) + colorStart.fromArray(color2.array, colorIdx); + colorEnd.fromArray(color.array, colorIdx); + if (twoCCylinder) { + twoCCylinder.setColors(colorStart, colorEnd); + geo = twoCCylinder; + } + } else { + // has one color per cylinder + colorStart.fromArray(color.array, colorIdx); + oneCCylinder.setColors(colorStart); + geo = oneCCylinder; + } + // add instance to the model + this._getCylinderInstanceMatrix(mesh.geometry, instanceIndex, instMatrix); + objMatrix.multiplyMatrices(matrix, instMatrix); + model.addInstance(objMatrix, geo); } - }); -}; - -Miew.prototype._enableMRT = function (on, renderBuffer, textureBuffer) { - var gfx = this._gfx; - var gl = gfx.renderer.getContext(); - var ext = gl.getExtension('WEBGL_draw_buffers'); - var properties = gfx.renderer.properties; - - if (!on) { - ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, null]); - return; - } // take extra texture from Texture Buffer - - - gfx.renderer.setRenderTarget(textureBuffer); - - var tx8 = properties.get(textureBuffer.texture).__webglTexture; - - gl.bindTexture(gl.TEXTURE_2D, tx8); // take texture and framebuffer from renderbuffer - - gfx.renderer.setRenderTarget(renderBuffer); - - var fb = properties.get(renderBuffer).__webglFramebuffer; + const material = this._collectMaterialInfo(mesh); + this._addToPool(model, material); + } - var tx = properties.get(renderBuffer.texture).__webglTexture; // set framebuffer + /** + * Adding model to pool of models or extend existing ones + * @param {object} model - model to add + * @param {object} material - material to add + */ + _addToPool(model, material) { + const materialIdx = this._checkExistingMaterial(material); + if (materialIdx < 0) { + // new model-material pair + this._models.push([model]); + this._materials.push(material); + } else { + // add model to existing model-material pair + const models = this._models[materialIdx]; + models.push(model); + } + } + /** + * Checking if given material already was registered in materials pool (no need to create new one) + * @param {object} material - given material + * @returns {number} number of model-material pair + */ + _checkExistingMaterial(material) { + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].findIndex(this._materials, m => external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEqual(m, material)); + } + _gatherCylindersColoringInfo(geo) { + const instCount = geo.instanceCount; + const color1 = geo.attributes.color.array; + const color2 = geo.attributes.color2.array; + const stride = geo.attributes.color.itemSize; + const is2Colored = new Array(instCount); + // analyze color instance attributes + let needToSplit = 0; + let colIdx = 0; + for (let i = 0; i < instCount; i++, colIdx += stride) { + const differs = Math.abs(color1[colIdx] - color2[colIdx]) > 0.0000001 // compare ending colors + || Math.abs(color1[colIdx + 1] - color2[colIdx + 1]) > 0.0000001 || Math.abs(color1[colIdx + 2] - color2[colIdx + 2]) > 0.0000001; + is2Colored[i] = differs; + needToSplit += differs; // count number of 2-colored cylinders + } + // calc number of vertices to add into 2-colored + const geoParams = geo.getGeoParams(); + const addPerCylinder = geoParams.radialSegments; + return { + is2Colored, + needToSplit, + addPerCylinder + }; + } - gl.bindFramebuffer(gl.FRAMEBUFFER, fb); - fb.width = renderBuffer.width; - fb.height = renderBuffer.height; - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tx, 0); - gl.framebufferTexture2D(gl.FRAMEBUFFER, ext.COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, tx8, 0); // mapping textures + /** + * Collect instanced models and materials. + * @param {object} mesh - given mesh with instanced something (spheres or cylinders) + */ + _collectInstancedGeoInfo(mesh) { + if (mesh.geometry instanceof geometries_InstancedSpheresGeometry) { + this._collectSpheresInfo(mesh); + } else if (mesh.geometry instanceof geometries_Instanced2CCylindersGeometry) { + this._collectCylindersInfo(mesh); + } + } - ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, ext.COLOR_ATTACHMENT1_WEBGL]); -}; + /** + * Collect Material info from given mesh. + * @param {object} mesh - given mesh with material info + * @returns {object} material + */ + _collectMaterialInfo(mesh) { + const { + uberOptions + } = mesh.material; + return { + diffuse: uberOptions.diffuse.toArray(), + opacity: uberOptions.opacity, + shininess: uberOptions.shininess, + specular: uberOptions.specular.toArray() + }; + } + _getCylinderInstanceMatrix(geo, instIdx, matrix) { + const matVector1 = geo.attributes.matVector1.array; + const matVector2 = geo.attributes.matVector2.array; + const matVector3 = geo.attributes.matVector3.array; + const idxOffset = instIdx * 4; // used 4 because offset arrays are stored in quads + matrix.set(matVector1[idxOffset], matVector1[idxOffset + 1], matVector1[idxOffset + 2], matVector1[idxOffset + 3], matVector2[idxOffset], matVector2[idxOffset + 1], matVector2[idxOffset + 2], matVector2[idxOffset + 3], matVector3[idxOffset], matVector3[idxOffset + 1], matVector3[idxOffset + 2], matVector3[idxOffset + 3], 0, 0, 0, 1); + } + _getSphereInstanceMatrix(geo, instIdx, matrix) { + const { + offset + } = geo.attributes; + const idx = instIdx * offset.itemSize; + const x = offset.array[idx]; + const y = offset.array[idx + 1]; + const z = offset.array[idx + 2]; + const scale = offset.array[idx + 3]; + matrix.set(scale, 0, 0, x, 0, scale, 0, y, 0, 0, scale, z, 0, 0, 0, 1); + } +} +;// CONCATENATED MODULE: ./src/io/exporters/fbx/FBXResult.js +// Forming default definitions block +const defaultDefinitions = ` +Definitions: { + Version: 100 + Count: 3 + ObjectType: "Model" { + Count: 1 + } + ObjectType: "Geometry" { + Count: 1 + } + ObjectType: "Material" { + Count: 1 + } + ObjectType: "Pose" { + Count: 1 + } + ObjectType: "GlobalSettings" { + Count: 1 + } +} `; + +// Default model properties +const defaultProperties = `Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A",1 + Property: "Lcl Translation", "Lcl Translation", "A",0.000000000000000,0.000000000000000,-1789.238037109375000 + Property: "Lcl Rotation", "Lcl Rotation", "A",0.000009334667643,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A+",0,0,0 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + }`; + +// Default materials layer +const defaultMaterialLayer = ` + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "AllSame" + ReferenceInformationType: "Direct" + Materials: 0 + }`; + +// Default layers block +const defaultLayerBlock = ` + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementColor" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + }`; -Miew.prototype._renderScene = function () { - return function (camera, distortion, target) { - distortion = distortion || false; - target = target || null; - var gfx = this._gfx; // render to offscreen buffer +/** + * globalSettings info in output file. + */ +const globalSettings = `GlobalSettings: { + Version: 1000 + Properties60: { + Property: "UpAxis", "int", "",1 + Property: "UpAxisSign", "int", "",1 + Property: "FrontAxis", "int", "",2 + Property: "FrontAxisSign", "int", "",1 + Property: "CoordAxis", "int", "",0 + Property: "CoordAxisSign", "int", "",1 + Property: "UnitScaleFactor", "double", "",1 + } + }`; +class FBXResult { + constructor() { + this._resultArray = []; + this._info = null; + } + getResult(info) { + this._info = info; + this._resultArray.push(this._writeHeader()); + this._resultArray.push(this._writeDefinitions()); + this._resultArray.push(this._writeObjects(info.models, info.materials)); + this._resultArray.push(this._writeRelations()); + this._resultArray.push(this._writeConnections()); // connections between models and materials) + this._info = null; + return this._resultArray.join(''); + } - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - gfx.renderer.setRenderTarget(target); - gfx.renderer.clear(); + /** + * Add FBXHeader info to output file. + * Some fields are really confusing, but it seems that all listed fields are very informative + */ + _writeHeader() { + const FBXHeaderVersion = 1003; // 1003 is some number which appears to present in many 6.1 ASCII files + const FBXVersion = 6100; // Mandatory and only supported version + const date = new Date(); + const timeStampVersion = 1000; + const creator = `Miew FBX Exporter v${this._info.version}`; // Supposed to be an engine + + return `; FBX 6.1.0 project file +; Created by ${creator} Copyright (c) 2015-2024 EPAM Systems, Inc. +; For support please contact miew@epam.com +; ---------------------------------------------------- + +FBXHeaderExtension: { + FBXHeaderVersion: ${FBXHeaderVersion} + FBXVersion: ${FBXVersion} + CreationTimeStamp: { + Version: ${timeStampVersion} + Year: ${date.getFullYear()} + Month: ${date.getMonth() + 1} + Day: ${date.getDate()} + Hour: ${date.getHours()} + Minute: ${date.getMinutes()} + Second: ${date.getSeconds()} + Millisecond: ${date.getMilliseconds()} + } + Creator: "${creator}" + OtherFlags: { + FlagPLE: 0 + } +} +CreationTime: "${date}" +Creator: "${creator}" +`; + } - if (gfx.renderer.xr.enabled) { - gfx.renderer.render(gfx.scene, camera); - return; - } // clean buffer for normals texture + /** + * Add Definitions info to output file. + * Not exactly sure if this section is template section (as it is in 7.4+) or it should every time be like this + */ + _writeDefinitions() { + return ` +; Object definitions +;------------------------------------------------------------------ +${defaultDefinitions} +`; + } - gfx.renderer.setClearColor(0x000000, 0.0); - gfx.renderer.setRenderTarget(gfx.offscreenBuf4); - gfx.renderer.clearColor(); - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - gfx.renderer.setRenderTarget(gfx.offscreenBuf); - gfx.renderer.clear(); - var bHaveComplexes = this._getComplexVisual() !== null; + /** + * Adding gathered information about Models to resulting string. + * Reminder - there may be more then 1 model in scene, but we must place materials after ALL models. + * @returns {string} string containing all models (vertices, indices, colors, normals etc) + */ + _models() { + const modelVersion = 232; + let allModels = ''; + const { + models + } = this._info; + for (let i = 0; i < models.length; ++i) { + const model = models[i]; + const vertCount = model.verticesCount; + allModels += ` + Model: "Model::${this._info.name}_${i}", "Mesh" { + Version: ${modelVersion} + ${defaultProperties} + ${this._verticesIndices(model.positions, model.indices)} + ${this._normalLayer(model.normals)} + ${this._colorLayer(model.colors, vertCount)} + ${defaultMaterialLayer} + ${defaultLayerBlock} + }`; + } + return allModels; + } - var volumeVisual = this._getVolumeVisual(); + /** + * Add Material info to result + */ + _materials() { + const materialVersion = 102; + let allMaterials = ''; + const { + materials + } = this._info; + for (let i = 0; i < materials.length; ++i) { + const material = materials[i]; + allMaterials += ` + Material: "Material::${this._info.name}_${i}_default", "" { + Version: ${materialVersion} + ShadingModel: "lambert" + MultiLayer: 0 + ${this._materialProperties(material)} + }`; + } + return allMaterials; + } - var ssao = bHaveComplexes && settings.now.ao; + /** + * Add Objects info to output file. + */ + _writeObjects() { + return ` +; Object properties +;------------------------------------------------------------------ + +Objects: { + ${this._models()} + ${this._materials()} + ${globalSettings} +} +`; + } - if (ssao) { - this._enableMRT(true, gfx.offscreenBuf, gfx.offscreenBuf4); + /** + * Add Relations info to output file. + */ + _writeRelations() { + let modelsList = ''; + for (let i = 0; i < this._info.models.length; ++i) { + modelsList += ` + Model: "Model::${this._info.name}_${i}", "Mesh" { + }`; } - - if (settings.now.transparency === 'prepass') { - this._renderWithPrepassTransparency(camera, gfx.offscreenBuf); - } else if (settings.now.transparency === 'standard') { - gfx.renderer.setRenderTarget(gfx.offscreenBuf); - gfx.renderer.render(gfx.scene, camera); + let materialList = ''; + for (let i = 0; i < this._info.materials.length; ++i) { + materialList += ` + Material: "Material::${this._info.name}_${i}_default", "" { + }`; } + return ` +; Object relations +;------------------------------------------------------------------ - if (ssao) { - this._enableMRT(false, null, null); - } // when fxaa we should get resulting image in temp off-screen buff2 for further postprocessing with fxaa filter - // otherwise we render to canvas - - - var outline = bHaveComplexes && settings.now.outline.on; - var fxaa = bHaveComplexes && settings.now.fxaa; - var volume = volumeVisual !== null && volumeVisual.getMesh().material != null; - var dstBuffer = ssao || outline || volume || fxaa || distortion ? gfx.offscreenBuf2 : target; - var srcBuffer = gfx.offscreenBuf; +Relations: { + ${modelsList} + Model: "Model::Producer Perspective", "Camera" { + } + Model: "Model::Producer Top", "Camera" { + } + Model: "Model::Producer Bottom", "Camera" { + } + Model: "Model::Producer Front", "Camera" { + } + Model: "Model::Producer Back", "Camera" { + } + Model: "Model::Producer Right", "Camera" { + } + Model: "Model::Producer Left", "Camera" { + } + Model: "Model::Camera Switcher", "CameraSwitcher" { + } + ${materialList} +}`; + } - if (ssao) { - this._performAO(srcBuffer, gfx.offscreenBuf4, gfx.offscreenBuf.depthTexture, dstBuffer, gfx.offscreenBuf3, gfx.offscreenBuf2); + /** + * Add Connections info to output file. + */ + _writeConnections() { + let modelsList = ''; + const { + name + } = this._info; + for (let i = 0; i < this._info.models.length; ++i) { + modelsList += ` + Connect: "OO", "Model::${name}_${i}", "Model::Scene"`; + } + let materialList = ''; + for (let i = 0; i < this._info.materials.length; ++i) { + materialList += ` + Connect: "OO", "Material::${name}_${i}_default", "Model::${name}_${i}"`; + } + return ` +; Object connections +;------------------------------------------------------------------ + +Connections: { + ${modelsList} + ${materialList} +}`; + } - if (!fxaa && !distortion && !volume && !outline) { - srcBuffer = dstBuffer; - dstBuffer = target; - gfx.renderer.setRenderTarget(dstBuffer); - gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0); - } - } else { - // just copy color buffer to dst buffer - gfx.renderer.setRenderTarget(dstBuffer); - gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0); - } // outline + /** + * Write float array to string with limited precision + * @param {Float32Array} array - array to be fixed + * @returns {String} String with fixed floats + */ + _floatArrayToString(array) { + const str = []; + for (let i = 0; i < array.length; ++i) { + str[i] = array[i].toFixed(6); + } + return str.join(','); + } + /** + * Adding color layer to resulting file + * @param {Float32Array} colorArray attribute + * @param {number} vertCount - number of vertices in the model + * @returns {string} color layer info + */ + _colorLayer(colorArray, vertCount) { + const layerElementColorNumber = 0; + const layerElementColorVersion = 101; + const layerElementColorName = ''; + const colorsStr = this._floatArrayToString(colorArray); + // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed + // As said [..Array(...)] - fastest and easiest way to produce [0, 1, .....] array + const colorIndices = [...Array(vertCount).keys()]; + return ` + LayerElementColor: ${layerElementColorNumber} { + Version: ${layerElementColorVersion} + Name: "${layerElementColorName}" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Colors: ${colorsStr} + ColorIndex: ${colorIndices} + }`; + } - if (outline) { - srcBuffer = dstBuffer; - dstBuffer = volume || fxaa || distortion ? gfx.offscreenBuf3 : target; + /** + * Adding normal layer to resulting file + * @param {Float32Array} normalArray attribute + * @returns {string} normal layer info + */ + _normalLayer(normalArray) { + const layerElementNormalNumber = 0; + const layerElementNormalVersion = 101; + const layerElementNormalName = ''; + const normalsStr = this._floatArrayToString(normalArray); + // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed + return ` + LayerElementNormal: ${layerElementNormalNumber} { + Version: ${layerElementNormalVersion} + Name: "${layerElementNormalName}" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: ${normalsStr} + }`; + } - if (srcBuffer != null) { - this._renderOutline(camera, gfx.offscreenBuf, srcBuffer, dstBuffer); - } - } // render selected part with outline material + /** + * Adding vertices and indices to resulting string + * @return {string} resulting string in FBX notation + */ + _verticesIndices(positions, indices) { + const multiLayer = 0; + const multiTake = 1; + const shading = 'Y'; + const culling = 'CullingOff'; + const geometryVersion = 124; + const vertStr = this._floatArrayToString(positions); + /* About _correctArrayNotation: Float32Arrays will contains only Float32 numbers, which implies that it will be floating points with 17 numbers after point. + * We cannot (and it's logically incorrect) save all this information, so we convert this Float32Array into Array-like object with numbers with only 6 numbers after point + * Reminder - this is big memory loss (as we must save at one moment two arrays with similar information) */ + return `MultiLayer: ${multiLayer} + MultiTake: ${multiTake} + Shading: ${shading} + Culling: "${culling}" + Vertices: ${vertStr} + PolygonVertexIndex: ${indices} + GeometryVersion: ${geometryVersion}`; + } + /** + * Forming material properties block. + * @param {Object} material - given material of model + * @returns {String} material properties string + */ + _materialProperties(material) { + return `Properties60: { + Property: "ShadingModel", "KString", "", "Lambert" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0,0,0 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",1,1,1 + Property: "AmbientFactor", "double", "",0.0000 + Property: "DiffuseColor", "ColorRGB", "",${material.diffuse} + Property: "DiffuseFactor", "double", "",1.0000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",${material.specular} + Property: "SpecularFactor", "double", "",1.0000 + Property: "ShininessExponent", "double", "",${material.shininess} + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Ambient", "ColorRGB", "",1,1,1 + Property: "Diffuse", "ColorRGB", "",${material.diffuse} + Property: "Specular", "ColorRGB", "",${material.specular} + Property: "Shininess", "double", "",${material.shininess} + Property: "Opacity", "double", "",${material.opacity} + Property: "Reflectivity", "double", "",0 + }`; + } +} +;// CONCATENATED MODULE: ./src/io/exporters/FBXExporter.js - this._renderSelection(camera, gfx.offscreenBuf, dstBuffer); - if (volume) { - // copy current picture to the buffer that retains depth-data of the original molecule render - // so that volume renderer could use depth-test - gfx.renderer.setRenderTarget(gfx.offscreenBuf); - gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0); - dstBuffer = gfx.offscreenBuf; - this._renderVolume(volumeVisual, camera, dstBuffer, gfx.volBFTex, gfx.volFFTex, gfx.volWFFTex); // if this is the last stage -- copy image to target +class FBXExporter extends Exporter { + constructor(source, options) { + super(source, options); + // Data + this._data = source; + this._version = options.miewVersion || '0.0-UNSPECIFIED'; + this._extractor = new FBXInfoExtractor(); + } - if (!fxaa && !distortion) { - gfx.renderer.setRenderTarget(target); - gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0); - } + /** + * Entry point to exporter. + */ + exportSync() { + // Creating mandatory blocks + const result = new FBXResult(); + if (!this._source) { + return this._result; } + const info = this._extractor.process(this._data); + info.version = this._version; + this._result = result.getResult(info); + return this._result; + } +} +FBXExporter.formats = ['fbx']; +FBXExporter.SourceClass = src_ComplexVisual; +;// CONCATENATED MODULE: ./src/io/exporters.js - srcBuffer = dstBuffer; - if (fxaa) { - dstBuffer = distortion ? gfx.offscreenBuf4 : target; - this._performFXAA(srcBuffer, dstBuffer); +/* harmony default export */ const exporters = (new exporters_ExporterList([PDBExporter, FBXExporter])); +;// CONCATENATED MODULE: ./src/io/io.js - srcBuffer = dstBuffer; - } - if (distortion) { - dstBuffer = target; - this._performDistortion(srcBuffer, dstBuffer, true); - } - }; -}(); +/* harmony default export */ const io = ({ + loaders: loaders, + parsers: parsers, + exporters: exporters +}); +;// CONCATENATED MODULE: ./src/gfx/CSS2DRenderer.js +/** + * @author mrdoob / http://mrdoob.com/ + */ -Miew.prototype._performDistortion = function () { - var _scene = new Scene(); - var _camera = new OrthographicCamera(-1.0, 1.0, 1.0, -1.0, -500, 1000); - var _material = new RawShaderMaterial({ - uniforms: { - srcTex: { - type: 't', - value: null - }, - aberration: { - type: 'fv3', - value: new Vector3(1.0) +const tempColor = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(); +class CSS2DRenderer { + constructor() { + this._width = 0; + this._height = 0; + this._widthHalf = 0; + this._heightHalf = 0; + this._vector = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + this._viewMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + this._projectionMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + this._domElement = document.createElement('div'); + this._domElement.style.overflow = 'hidden'; + this._domElement.style.position = 'absolute'; + this._domElement.style.top = '0'; + this._domElement.style.zIndex = '0'; // start a new Stacking Context to enclose all z-ordered children + this._domElement.style.pointerEvents = 'none'; + } + getElement() { + return this._domElement; + } + reset() { + const myNode = this.getElement(); + while (myNode.firstChild) { + myNode.removeChild(myNode.firstChild); + } + } + setSize(width, height) { + this._width = width; + this._height = height; + this._widthHalf = this._width / 2; + this._heightHalf = this._height / 2; + this._domElement.style.width = `${width}px`; + this._domElement.style.height = `${height}px`; + } + _renderObject(object, camera, scene) { + function lerpColorAsHex(a, b, t) { + tempColor.setHex(a); + tempColor.lerp(b, t); + return `#${tempColor.getHexString()}`; + } + function colorAsHex(a) { + tempColor.setHex(a); + return `#${tempColor.getHexString()}`; + } + if (object instanceof gfx_CSS2DObject) { + this._vector.setFromMatrixPosition(object.matrixWorld); + if (object.userData !== undefined && object.userData.offset !== undefined) { + const localOffset = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(object.userData.offset.x, object.userData.offset.y, 0); + this._vector.add(localOffset.multiplyScalar(object.matrixWorld.getMaxScaleOnAxis())); + } + this._vector.applyMatrix4(this._viewMatrix); + const visibility = this._vector.z > -camera.near ? 'hidden' : 'visible'; + const zIndex = 10000 * (camera.far - -this._vector.z) / (camera.far - camera.near); + const element = object.getElement(); + if (typeof scene.fog === 'undefined') { + element.style.color = colorAsHex(object.userData.color); + if (object.userData.background !== 'transparent') { + element.style.background = colorAsHex(object.userData.background); + } + } else { + const fogFactor = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MathUtils.smoothstep(-this._vector.z, scene.fog.near, scene.fog.far); + element.style.color = lerpColorAsHex(object.userData.color, scene.fog.color, fogFactor); + if (object.userData.background !== 'transparent') { + element.style.background = lerpColorAsHex(object.userData.background, scene.fog.color, fogFactor); + } } - }, - vertexShader: vertexScreenQuadShader, - fragmentShader: fragmentScreenQuadFromDistTex, - transparent: false, - depthTest: false, - depthWrite: false - }); + this._vector.applyMatrix4(this._projectionMatrix); + const style = `${object.userData !== {} ? object.userData.translation : 'translate(-50%, -50%) '}translate(${this._vector.x * this._widthHalf + this._widthHalf}px,${-this._vector.y * this._heightHalf + this._heightHalf}px)`; + element.style.visibility = visibility; + element.style.WebkitTransform = style; + element.style.MozTransform = style; + element.style.oTransform = style; + element.style.transform = style; + element.style.zIndex = Number(zIndex).toFixed(0); + if (element.parentNode !== this._domElement) { + this._domElement.appendChild(element); + } + } + for (let i = 0, l = object.children.length; i < l; i++) { + this._renderObject(object.children[i], camera, scene); + } + } + render(scene, camera) { + scene.updateMatrixWorld(); + if (camera.parent === null) { + camera.updateMatrixWorld(); + } + camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); + this._viewMatrix.copy(camera.matrixWorldInverse); + this._projectionMatrix.copy(camera.projectionMatrix); + this._renderObject(scene, camera, scene); + } +} +/* harmony default export */ const gfx_CSS2DRenderer = (CSS2DRenderer); +;// CONCATENATED MODULE: ./src/utils/getTopWindow.js +function getTopWindow() { + // intercept the exception if we have cross-origin iframe + try { + if (window.top.location.href !== undefined) { + return window.top; + } + } catch (e) { + // provide fallback + } + return window; +} +;// CONCATENATED MODULE: ./src/ui/ObjectControls.js - var _geo = gfxutils.buildDistorionMesh(10, 10, settings.now.debug.stereoBarrel); - _scene.add(new meshes.Mesh(_geo, _material)); - return function (srcBuffer, targetBuffer, mesh) { - this._gfx.renderer.setRenderTarget(targetBuffer); - this._gfx.renderer.clear(); - if (mesh) { - _material.uniforms.srcTex.value = srcBuffer.texture; +const VK_LEFT = 37; +const VK_UP = 38; +const VK_RIGHT = 39; +const VK_DOWN = 40; +const STATE = { + NONE: -1, + ROTATE: 0, + TRANSLATE: 1, + SCALE: 2, + TRANSLATE_PIVOT: 3 +}; - _material.uniforms.aberration.value.set(0.995, 1.0, 1.01); +// pausing for this amount of time before releasing mouse button prevents inertial rotation (seconds) +const FULL_STOP_THRESHOLD = 0.1; +const quaternion = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Quaternion(); +const matrix4 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); - this._gfx.renderer.render(_scene, _camera); +// pivot -- local offset of the rotation pivot point +function ObjectHandler(objects, camera, pivot, options) { + this.objects = objects; + [this.object] = objects; + this.camera = camera; + this.pivot = pivot; + this.axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 1); + this.options = options; + this.lastRotation = { + axis: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(), + angle: 0.0 + }; +} +ObjectHandler.prototype._rotate = function () { + const p = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const q = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Quaternion(); + const s = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const m = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + return function (quat) { + const zeroPivot = this.pivot.x === 0.0 && this.pivot.y === 0.0 && this.pivot.z === 0.0; + m.copy(this.object.matrix); + if (zeroPivot) { + m.multiply(matrix4.makeRotationFromQuaternion(quat)); } else { - this._gfx.renderer.renderScreenQuadFromTexWithDistortion(srcBuffer, settings.now.debug.stereoBarrel); + m.multiply(matrix4.makeTranslation(this.pivot.x, this.pivot.y, this.pivot.z)); + m.multiply(matrix4.makeRotationFromQuaternion(quat)); + m.multiply(matrix4.makeTranslation(-this.pivot.x, -this.pivot.y, -this.pivot.z)); } - }; -}(); - -Miew.prototype._renderOutline = function () { - var _outlineMaterial = new OutlineMaterial({ - depth: true - }); - - return function (camera, srcDepthBuffer, srcColorBuffer, targetBuffer) { - var self = this; - var gfx = self._gfx; // apply Sobel filter -- draw outline - - _outlineMaterial.uniforms.srcTex.value = srcColorBuffer.texture; - _outlineMaterial.uniforms.srcDepthTex.value = srcDepthBuffer.depthTexture; + m.decompose(p, q, s); - _outlineMaterial.uniforms.srcTexSize.value.set(srcDepthBuffer.width, srcDepthBuffer.height); - - _outlineMaterial.uniforms.color.value = new Color(settings.now.outline.color); - _outlineMaterial.uniforms.threshold.value = settings.now.outline.threshold; - _outlineMaterial.uniforms.thickness.value = new Vector2(settings.now.outline.thickness, settings.now.outline.thickness); - gfx.renderer.setRenderTarget(targetBuffer); - gfx.renderer.renderScreenQuad(_outlineMaterial); + // update objects + if (!zeroPivot) { + for (let i = 0; i < this.objects.length; ++i) { + this.objects[i].position.copy(p); + } + } + for (let j = 0; j < this.objects.length; ++j) { + this.objects[j].quaternion.copy(q); + this.objects[j].updateMatrix(); + } }; }(); - -Miew.prototype._renderShadowMap = function () { - var pars = { - minFilter: NearestFilter, - magFilter: NearestFilter, - format: RGBAFormat +ObjectHandler.prototype.setObjects = function (objects) { + this.objects = objects; + [this.object] = objects; +}; +ObjectHandler.prototype.rotate = function () { + const rot = { + axis: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(), + angle: 0.0 }; - return function () { - if (!settings.now.shadow.on) { - return; + return function (quat, mousePrevPos, mouseCurPos, aboutAxis) { + this.mouse2rotation(rot, mousePrevPos, mouseCurPos, aboutAxis); + quat.setFromAxisAngle(rot.axis, rot.angle); + if (rot.angle) { + this._rotate(quat); } + this.lastRotation = rot; + }; +}(); +ObjectHandler.prototype.translate = function () { + const dir = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const pivot = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + return function (delta) { + // reverse-project viewport movement to view coords (compensate for screen aspect ratio) + dir.set(delta.x / this.camera.projectionMatrix.elements[0], delta.y / this.camera.projectionMatrix.elements[5], 0); + let dist = dir.length(); + dir.normalize(); - var gfx = this._gfx; - var currentRenderTarget = gfx.renderer.getRenderTarget(); - var activeCubeFace = gfx.renderer.getActiveCubeFace(); - var activeMipmapLevel = gfx.renderer.getActiveMipmapLevel(); - var _state = gfx.renderer.state; // Set GL state for depth map. - - _state.setBlending(NoBlending); + // transform movement direction to object local coords + dir.transformDirection(matrix4.copy(this.object.matrixWorld).invert()); - _state.buffers.color.setClear(1, 1, 1, 1); + // visible translate distance shouldn't depend on camera-to-object distance + pivot.copy(this.pivot); + this.object.localToWorld(pivot); + dist *= Math.abs(pivot.z - this.camera.position.z); - _state.buffers.depth.setTest(true); + // visible translate distance shouldn't depend on object scale + dist /= this.object.matrixWorld.getMaxScaleOnAxis(); - _state.setScissorTest(false); + // all objects are translated similar to principal object + // (we assume they all have identical pivot and scale) + for (let i = 0; i < this.objects.length; ++i) { + this.objects[i].translateOnAxis(dir, dist); + } + }; +}(); +ObjectHandler.prototype.update = function () { + const axis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + return function (timeSinceLastUpdate, timeSinceMove) { + if (settings.now.autoRotation !== 0.0) { + // auto-rotation with constant speed - for (var i = 0; i < gfx.scene.children.length; i++) { - if (gfx.scene.children[i].type === 'DirectionalLight') { - var light = gfx.scene.children[i]; + // if rotation axis is fixed or hasn't been defined yet + if (settings.now.autoRotationAxisFixed || this.lastRotation.axis.length() === 0.0) { + // use Y-axis (transformed to local object coords) + axis.set(0, 1, 0).transformDirection(matrix4.copy(this.object.matrixWorld).invert()); + } else { + // use axis defined by last user rotation + axis.copy(this.lastRotation.axis); + } + this._rotate(quaternion.setFromAxisAngle(axis, settings.now.autoRotation * timeSinceLastUpdate)); + return true; + } + if (this.options.intertia && this.lastRotation.angle) { + // inertial object rotation + const angle = this.lastRotation.angle * (1.0 - this.options.dynamicDampingFactor) ** (40.0 * timeSinceMove); + if (Math.abs(angle) <= this.options.intertiaThreshold) { + this.lastRotation.angle = 0.0; + } else { + this._rotate(quaternion.setFromAxisAngle(this.lastRotation.axis, angle)); + return true; + } + } + return false; + }; +}(); +ObjectHandler.prototype.stop = function () { + this.lastRotation.angle = 0.0; +}; - if (light.shadow.map == null) { - light.shadow.map = new WebGLRenderTarget(light.shadow.mapSize.width, light.shadow.mapSize.height, pars); - light.shadow.camera.updateProjectionMatrix(); - } +// calculate (axis, angle) pair from mouse/touch movement +ObjectHandler.prototype.mouse2rotation = function () { + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const eye = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const eyeDirection = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const cameraUpDirection = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const cameraSidewaysDirection = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const moveDirection = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const mouseDelta = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(); + return function (rot, mousePrev, mouseCur, aboutAxis) { + if (aboutAxis) { + rot.axis.copy(this.axis); + rot.angle = this.options.axisRotateFactor * (mouseCur.y - mousePrev.y); - light.shadow.updateMatrices(light); - gfx.renderer.setRenderTarget(light.shadow.map); - gfx.renderer.clear(); - gfx.renderer.render(gfx.scene, light.shadow.camera); + /* cool method that allows rotation around Z axis to be "tied" to mouse cursor + res.axis.copy(this.axis); + var pivot = this.pivot.clone(); + this.object.localToWorld(pivot); + pivot.project(this.camera); + var v1 = new THREE.Vector3(mousePrev.x, mousePrev.y, this.camera.position.z); + v1.sub(pivot); + var v2 = new THREE.Vector3(mouseCur.x, mouseCur.y, this.camera.position.z); + v2.sub(pivot); + v1.sub(res.axis.clone().multiplyScalar(v1.dot(res.axis))); + v2.sub(res.axis.clone().multiplyScalar(v2.dot(res.axis))); + var abs = v1.length() * v2.length(); + if (abs > 0) { + res.angle = res.axis.dot(v1.cross(v2)) / abs; + } + */ + } else { + mouseDelta.subVectors(mouseCur, mousePrev); + const angle = mouseDelta.length(); + if (angle === 0.0) { + return; } + center.copy(this.pivot); + this.object.localToWorld(center); + eye.subVectors(this.camera.position, center); + eyeDirection.copy(eye).normalize(); + cameraUpDirection.copy(this.camera.up).normalize(); + cameraSidewaysDirection.crossVectors(cameraUpDirection, eyeDirection).normalize(); + cameraUpDirection.setLength(mouseDelta.y); + cameraSidewaysDirection.setLength(mouseDelta.x); + moveDirection.copy(cameraUpDirection.add(cameraSidewaysDirection)); + rot.axis.crossVectors(moveDirection, eye); + rot.angle = -angle * this.options.rotateFactor; } + rot.axis.transformDirection(matrix4.copy(this.object.matrixWorld).invert()); - gfx.renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel); + // make sure angle is always positive (thus 'axis' defines both axis and direction of rotation) + if (rot.angle < 0.0) { + rot.axis.negate(); + rot.angle = -rot.angle; + } }; }(); -/** - * Check if there is selection which must be rendered or not. - * @private - * @returns {boolean} true on existing selection to render - */ +function ObjectControls(object, objectPivot, camera, domElement, getAltObj) { + utils_EventDispatcher.call(this); + const self = this; + this.object = object; + this.objectPivot = objectPivot; + this.camera = camera; + this.domElement = typeof domElement !== 'undefined' ? domElement : document; + this.getAltObj = getAltObj; + // API -Miew.prototype._hasSelectionToRender = function () { - var selPivot = this._gfx.selectionPivot; + this.enabled = true; + this.hotkeysEnabled = true; + this.screen = { + left: 0, + top: 0, + width: 0, + height: 0 + }; + this.options = { + rotateFactor: Math.PI, + // full screen slide (along short side) would roughly mean 180 deg. rotation + axisRotateFactor: 4 * Math.PI, + // full screen slide (along short side) would roughly mean 720 deg. rotation + intertia: true, + dynamicDampingFactor: 0.1, + intertiaThreshold: 1e-3 + }; - for (var i = 0; i < selPivot.children.length; i++) { - var selPivotChild = selPivot.children[i]; + // internals - if (selPivotChild.children.length > 0) { - return true; + this._state = STATE.NONE; + this._mousePrevPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(); + this._mouseCurPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(); + this._mainObj = new ObjectHandler([this.object], this.camera, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0), this.options); + this._altObj = new ObjectHandler([this.object], this.camera, new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0), this.options); + this._affectedObj = this._mainObj; + this._isAltObjFreeRotationAllowed = true; + this._isTranslationAllowed = true; + this._isKeysTranslatingObj = false; + this._pressedKeys = []; + this._clock = new Timer(); + this._clock.start(); + this._lastUpdateTime = this._clock.getElapsedTime(); + + // events + this._listeners = [{ + obj: self.domElement, + type: 'mousedown', + handler(e) { + self.mousedown(e); + } + }, { + obj: self.domElement, + type: 'mouseup', + handler(e) { + self.mouseup(e); + } + }, { + obj: self.domElement, + type: 'mousemove', + handler(e) { + self.mousemove(e); + } + }, { + obj: self.domElement, + type: 'mousewheel', + handler(e) { + self.mousewheel(e); + } + }, { + obj: self.domElement, + type: 'DOMMouseScroll', + handler(e) { + self.mousewheel(e); + } + }, { + obj: self.domElement, + type: 'mouseout', + handler(e) { + self.mouseup(e); + } + }, { + obj: self.domElement, + type: 'touchstart', + handler(e) { + self.touchstartend(e); + } + }, { + obj: self.domElement, + type: 'touchend', + handler(e) { + self.touchstartend(e); + } + }, { + obj: self.domElement, + type: 'touchmove', + handler(e) { + self.touchmove(e); + } + }, { + obj: self.getKeyBindObject(), + type: 'keydown', + handler(e) { + self.keydownup(e); + } + }, { + obj: self.getKeyBindObject(), + type: 'keyup', + handler(e) { + self.keydownup(e); + } + }, { + obj: window, + type: 'resize', + handler() { + self.handleResize(); + } + }, { + obj: window, + type: 'blur', + handler() { + self.resetKeys(); + } + }, { + obj: self.domElement, + type: 'contextmenu', + handler(e) { + self.contextmenu(e); } + }]; + for (let i = 0; i < this._listeners.length; i++) { + const l = this._listeners[i]; + l.obj.addEventListener(l.type, l.handler); } + this.handleResize(); + this.resetKeys(); - return false; -}; - -Miew.prototype._renderSelection = function () { - var _outlineMaterial = new OutlineMaterial(); - - return function (camera, srcBuffer, targetBuffer) { - var self = this; - var gfx = self._gfx; // clear offscreen buffer (leave z-buffer intact) - - gfx.renderer.setClearColor('black', 0); // render selection to offscreen buffer - - gfx.renderer.setRenderTarget(srcBuffer); - gfx.renderer.clear(true, false, false); - - if (self._hasSelectionToRender()) { - gfx.selectionRoot.matrix = gfx.root.matrix; - gfx.selectionPivot.matrix = gfx.pivot.matrix; - gfx.renderer.render(gfx.selectionScene, camera); - } else { - // just render something to force "target clear" operation to finish - gfx.renderer.renderDummyQuad(); - } // overlay to screen + // force an update at start + this.update(); +} +// methods - gfx.renderer.setRenderTarget(targetBuffer); - gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 0.6); // apply Sobel filter -- draw outline +ObjectControls.prototype = Object.create(utils_EventDispatcher.prototype); +ObjectControls.prototype.constructor = ObjectControls; +ObjectControls.prototype.resetKeys = function () { + this._pressedKeys[VK_LEFT] = false; + this._pressedKeys[VK_UP] = false; + this._pressedKeys[VK_RIGHT] = false; + this._pressedKeys[VK_DOWN] = false; +}; +ObjectControls.prototype.contextmenu = function (e) { + e.stopPropagation(); + e.preventDefault(); +}; +ObjectControls.prototype.handleResize = function () { + if (this.domElement === document) { + this.screen.left = 0; + this.screen.top = 0; + this.screen.width = window.innerWidth; + this.screen.height = window.innerHeight; + } else { + const box = this.domElement.getBoundingClientRect(); + // adjustments come from similar code in the jquery offset() function + const d = this.domElement.ownerDocument.documentElement; + this.screen.left = box.left + window.pageXOffset - d.clientLeft; + this.screen.top = box.top + window.pageYOffset - d.clientTop; + this.screen.width = box.width; + this.screen.height = box.height; + } +}; +ObjectControls.prototype.enable = function (enable) { + this.enabled = enable; +}; +ObjectControls.prototype.enableHotkeys = function (enable) { + this.hotkeysEnabled = enable; +}; +ObjectControls.prototype.allowTranslation = function (allow) { + this._isTranslationAllowed = allow; +}; +ObjectControls.prototype.allowAltObjFreeRotation = function (allow) { + this._isAltObjFreeRotationAllowed = allow; +}; +ObjectControls.prototype.keysTranslateObj = function (on) { + this._isKeysTranslatingObj = on; +}; +ObjectControls.prototype.isEditingAltObj = function () { + return (this._state === STATE.ROTATE || this._state === STATE.TRANSLATE) && this._affectedObj === this._altObj; +}; - _outlineMaterial.uniforms.srcTex.value = srcBuffer.texture; +// convert page coords of mouse/touch to uniform coords with smaller side being [-0.5, 0.5] +// (uniform coords keep direct proportion with screen distance travelled by mouse regardless of screen aspect ratio) +ObjectControls.prototype.convertMouseToOnCircle = function (coords, pageX, pageY) { + const screenSize = Math.min(this.screen.width, this.screen.height); + if (screenSize === 0) { + coords.set(0, 0); + return; + } + coords.set((pageX - this.screen.width * 0.5 - this.screen.left) / screenSize, (0.5 * this.screen.height + this.screen.top - pageY) / screenSize); +}; - _outlineMaterial.uniforms.srcTexSize.value.set(srcBuffer.width, srcBuffer.height); +// convert page coords of mouse/touch to viewport coords with both sides being [-1, 1] +// (those are non-uniform coords affected by screen aspect ratio) +ObjectControls.prototype.convertMouseToViewport = function (coords, pageX, pageY) { + if (this.screen.width === 0 || this.screen.height === 0) { + coords.set(0, 0); + return; + } + coords.set(2.0 * (pageX - this.screen.width * 0.5 - this.screen.left) / this.screen.width, 2.0 * (0.5 * this.screen.height + this.screen.top - pageY) / this.screen.height); +}; +ObjectControls.prototype.stop = function () { + this._mainObj.stop(); + this._altObj.stop(); +}; - gfx.renderer.renderScreenQuad(_outlineMaterial); +// rotate object based on latest mouse/touch movement +ObjectControls.prototype.rotateByMouse = function () { + const quat = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Quaternion(); + return function (aboutZAxis) { + this._affectedObj.rotate(quat, this._mousePrevPos, this._mouseCurPos, aboutZAxis); + this.dispatchEvent({ + type: 'change', + action: 'rotate', + quaternion: quat + }); }; }(); -Miew.prototype._checkVolumeRenderingSupport = function (renderTarget) { - if (!renderTarget) { - return false; - } +// rotate object by specified quaternion +ObjectControls.prototype.rotate = function (quat) { + this.object.quaternion.multiply(quat); + this.dispatchEvent({ + type: 'change', + action: 'rotate', + quaternion: quat + }); +}; - var gfx = this._gfx; - var oldRT = gfx.renderer.getRenderTarget(); - gfx.renderer.setRenderTarget(renderTarget); - var context = gfx.renderer.getContext(); - var result = context.checkFramebufferStatus(context.FRAMEBUFFER); - gfx.renderer.setRenderTarget(oldRT); +// get object's orientation +ObjectControls.prototype.getOrientation = function () { + return this.object.quaternion; +}; - if (result !== context.FRAMEBUFFER_COMPLETE) { - // floatFrameBufferWarning = ; - this.logger.warn('Device doesn\'t support electron density rendering'); - return false; - } +// set object's orientation +ObjectControls.prototype.setOrientation = function (quat) { + this.object.quaternion.copy(quat); +}; + +// translate object based on latest mouse/touch movement +ObjectControls.prototype.translate = function () { + const delta = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(); + return function () { + delta.subVectors(this._mouseCurPos, this._mousePrevPos); + this._affectedObj.translate(delta); + this.dispatchEvent({ + type: 'change', + action: 'translate' + }); + }; +}(); - return true; +// get object scale +ObjectControls.prototype.getScale = function () { + return this.object.scale.x; }; -Miew.prototype._renderVolume = function () { - var volumeBFMat = new VolumeMaterial$1.BackFacePosMaterial(); - var volumeFFMat = new VolumeMaterial$1.FrontFacePosMaterial(); - var cubeOffsetMat = new Matrix4().makeTranslation(0.5, 0.5, 0.5); - var world2colorMat = new Matrix4(); - var volumeRenderingSupported; - return function (volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) { - var gfx = this._gfx; +// set uniform object scale +ObjectControls.prototype.setScale = function (scale) { + this.object.scale.set(scale, scale, scale); +}; - if (typeof volumeRenderingSupported === 'undefined') { - volumeRenderingSupported = this._checkVolumeRenderingSupport(tmpBuf1); - } +// scale object by factor (factor should be greater than zero) +ObjectControls.prototype.scale = function (factor) { + if (factor <= 0) { + return; + } + this.setScale(this.object.scale.x * factor); + this.dispatchEvent({ + type: 'change', + action: 'zoom', + factor + }); +}; +ObjectControls.prototype.update = function () { + const shift = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(); + return function () { + const curTime = this._clock.getElapsedTime(); + const timeSinceLastUpdate = curTime - this._lastUpdateTime; - if (!volumeRenderingSupported) { - return; + // update object handler + if (this._state === STATE.NONE) { + const timeSinceMove = curTime - this._lastMouseMoveTime; + if (this._mainObj.update(timeSinceLastUpdate, timeSinceMove) || this._altObj.update(timeSinceLastUpdate, timeSinceMove)) { + this.dispatchEvent({ + type: 'change', + action: 'auto' + }); + } } - var mesh = volumeVisual.getMesh(); - mesh.rebuild(gfx.camera); // use main camera to prepare special textures to be used by volumetric rendering - // these textures have the size of the window and are stored in offscreen buffers + // apply arrow keys + if (this._isKeysTranslatingObj) { + const speedX = Number(this._pressedKeys[VK_RIGHT]) - Number(this._pressedKeys[VK_LEFT]); + const speedY = Number(this._pressedKeys[VK_UP]) - Number(this._pressedKeys[VK_DOWN]); + if (speedX !== 0.0 || speedY !== 0.0) { + const delta = timeSinceLastUpdate; - gfx.renderer.setClearColor('black', 0); - gfx.renderer.setRenderTarget(tmpBuf1); - gfx.renderer.clear(); - gfx.renderer.setRenderTarget(tmpBuf2); - gfx.renderer.clear(); - gfx.renderer.setRenderTarget(tmpBuf3); - gfx.renderer.clear(); - gfx.renderer.setRenderTarget(tmpBuf1); // draw plane with its own material, because it differs slightly from volumeBFMat + // update object translation + const altObj = this.getAltObj(); + if (altObj.objects.length > 0) { + this._altObj.setObjects(altObj.objects); + this._altObj.pivot = altObj.pivot; + if ('axis' in altObj) { + this._altObj.axis = altObj.axis.clone(); + } else { + this._altObj.axis.set(0, 0, 1); + } + shift.set(delta * speedX, delta * speedY); + this._altObj.translate(shift); + this.dispatchEvent({ + type: 'change', + action: 'translate' + }); + } + } + } + this._lastUpdateTime = curTime; + }; +}(); +ObjectControls.prototype.reset = function () { + this._state = STATE.NONE; + this.object.quaternion.copy(quaternion.set(0, 0, 0, 1)); +}; - camera.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE); - gfx.renderer.render(gfx.scene, camera); - camera.layers.set(gfxutils.LAYERS.VOLUME); - gfx.scene.overrideMaterial = volumeBFMat; - gfx.renderer.render(gfx.scene, camera); - gfx.renderer.setRenderTarget(tmpBuf2); - camera.layers.set(gfxutils.LAYERS.VOLUME); - gfx.scene.overrideMaterial = volumeFFMat; - gfx.renderer.render(gfx.scene, camera); - gfx.scene.overrideMaterial = null; - camera.layers.set(gfxutils.LAYERS.DEFAULT); // prepare texture that contains molecule positions +// listeners - world2colorMat.getInverse(mesh.matrixWorld); - UberMaterial.prototype.uberOptions.world2colorMatrix.multiplyMatrices(cubeOffsetMat, world2colorMat); - camera.layers.set(gfxutils.LAYERS.COLOR_FROM_POSITION); - gfx.renderer.setRenderTarget(tmpBuf3); - gfx.renderer.render(gfx.scene, camera); // render volume +ObjectControls.prototype.mousedown = function (event) { + if (this.enabled === false || this._state !== STATE.NONE) { + return; + } + event.preventDefault(); + event.stopPropagation(); + if (this._state === STATE.NONE) { + if (event.button === 0) { + this._affectedObj.stop(); // can edit only one object at a time - var vm = mesh.material; - vm.uniforms._BFRight.value = tmpBuf1.texture; - vm.uniforms._FFRight.value = tmpBuf2.texture; - vm.uniforms._WFFRight.value = tmpBuf3.texture; - camera.layers.set(gfxutils.LAYERS.VOLUME); - gfx.renderer.setRenderTarget(dstBuf); - gfx.renderer.render(gfx.scene, camera); - camera.layers.set(gfxutils.LAYERS.DEFAULT); + let workWithAltObj = false; + if (event.altKey) { + const altObj = this.getAltObj(); + workWithAltObj = altObj.objects.length > 0; + if (workWithAltObj) { + this._altObj.setObjects(altObj.objects); + this._altObj.pivot = altObj.pivot; + if ('axis' in altObj) { + this._altObj.axis = altObj.axis.clone(); + } else { + this._altObj.axis.set(0, 0, 1); + } + } + } + this._affectedObj = workWithAltObj ? this._altObj : this._mainObj; + this._state = workWithAltObj && event.ctrlKey && this._isTranslationAllowed ? STATE.TRANSLATE : STATE.ROTATE; + } else if (event.button === 2) { + this._state = STATE.TRANSLATE_PIVOT; + } + } + if (this._state === STATE.ROTATE) { + this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY); + this._mousePrevPos.copy(this._mouseCurPos); + } + if (this._state === STATE.TRANSLATE || this._state === STATE.TRANSLATE_PIVOT) { + this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); + this._mousePrevPos.copy(this._mouseCurPos); + } +}; +ObjectControls.prototype.mousemove = function (event) { + if (this.enabled === false || this._state === STATE.NONE) { + return; + } + event.preventDefault(); + event.stopPropagation(); + switch (this._state) { + case STATE.ROTATE: + this._mousePrevPos.copy(this._mouseCurPos); + this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY); + this.rotateByMouse(event.altKey && !this._isAltObjFreeRotationAllowed || event.shiftKey); + this._lastMouseMoveTime = this._clock.getElapsedTime(); + break; + case STATE.TRANSLATE: + this._mousePrevPos.copy(this._mouseCurPos); + this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); + this.translate(); + break; + case STATE.TRANSLATE_PIVOT: + this._mousePrevPos.copy(this._mouseCurPos); + this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY); + this.translatePivotByMouse(); + break; + default: + break; + } +}; +ObjectControls.prototype.mousewheel = function (event) { + if (this.enabled === false || !settings.now.zooming || this._state !== STATE.NONE || event.shiftKey) { + return; + } + event.preventDefault(); + let delta = 0; + if (event.wheelDelta) { + // WebKit / Opera / Explorer 9 + delta = event.wheelDelta / 40; + } else if (event.detail) { + // Firefox + delta = -event.detail / 3; + } + let factor = 1.0 + delta * 0.05; + factor = Math.max(factor, 0.01); + this.scale(factor); +}; +ObjectControls.prototype.mouseup = function (event) { + if (this.enabled === false || this._state === STATE.NONE) { + return; + } + event.preventDefault(); + event.stopPropagation(); + this._state = STATE.NONE; + if (this._clock.getElapsedTime() - this._lastMouseMoveTime > FULL_STOP_THRESHOLD) { + this._affectedObj.stop(); + } +}; +ObjectControls.prototype.touchstartend = function (event) { + if (this.enabled === false) { + return; + } + event.preventDefault(); + event.stopPropagation(); + switch (event.touches.length) { + case 1: + this._state = STATE.ROTATE; + this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY); + this._mousePrevPos.copy(this._mouseCurPos); + break; + case 2: + { + // prevent inertial rotation + this._mainObj.stop(); + this._altObj.stop(); + this._state = STATE.SCALE; + const dx = event.touches[0].pageX - event.touches[1].pageX; + const dy = event.touches[0].pageY - event.touches[1].pageY; + this._touchDistanceCur = this._touchDistanceStart = Math.sqrt(dx * dx + dy * dy); + this._scaleStart = this.object.scale.x; + break; + } + default: + this._state = STATE.NONE; + } +}; +ObjectControls.prototype.touchmove = function (event) { + if (this.enabled === false || this._state === STATE.NONE) { + return; + } + event.preventDefault(); + event.stopPropagation(); + switch (this._state) { + case STATE.ROTATE: + this._mousePrevPos.copy(this._mouseCurPos); + this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY); + this.rotateByMouse(false); + this._lastMouseMoveTime = this._clock.getElapsedTime(); + break; + case STATE.SCALE: + if (settings.now.zooming) { + // update scale + const dx = event.touches[0].pageX - event.touches[1].pageX; + const dy = event.touches[0].pageY - event.touches[1].pageY; + this._touchDistanceCur = Math.sqrt(dx * dx + dy * dy); + const newScale = this._scaleStart * this._touchDistanceCur / this._touchDistanceStart; + const factor = newScale / this.object.scale.x; + this.scale(factor); + } + break; + default: + } +}; +ObjectControls.prototype.keydownup = function (event) { + if (this.enabled === false || this.hotkeysEnabled === false) { + return; + } + switch (event.keyCode) { + case VK_LEFT: + case VK_UP: + case VK_RIGHT: + case VK_DOWN: + this._pressedKeys[event.keyCode] = event.type === 'keydown'; + event.preventDefault(); + event.stopPropagation(); + break; + default: + } +}; +ObjectControls.prototype.getKeyBindObject = function () { + return getTopWindow(); +}; +ObjectControls.prototype.dispose = function () { + for (let i = 0; i < this._listeners.length; i++) { + const l = this._listeners[i]; + l.obj.removeEventListener(l.type, l.handler); + } +}; +ObjectControls.prototype.translatePivotByMouse = function () { + const delta = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(); + return function () { + delta.subVectors(this._mouseCurPos, this._mousePrevPos); + this.translatePivotInWorld(settings.now.translationSpeed * delta.x, settings.now.translationSpeed * delta.y, 0); }; }(); -/* Render scene with 'ZPrepass transparency Effect' - * Idea: transparent objects are rendered in two passes. The first one writes result only into depth buffer. - * The second pass reads depth buffer and writes only to color buffer. The method results in - * correct image of front part of the semi-transparent objects, but we can see only front transparent objects - * and opaque objects inside, there is no transparent objects inside. - * Notes: 1. Opaque objects should be rendered strictly before semi-transparent ones. - * 2. Realization doesn't use camera layers because scene traversing is used for material changes and - * we can use it to select needed meshes and don't complicate meshes builders with layers - */ +// Translate in WorldCS, translation is scaled with root scale matrix +ObjectControls.prototype.translatePivotInWorld = function (x, y, z) { + const pos = this.objectPivot.position; + pos.applyMatrix4(this.object.matrixWorld); + pos.setX(pos.x + x); + pos.setY(pos.y + y); + pos.setZ(pos.z + z); + pos.applyMatrix4(matrix4.copy(this.object.matrixWorld).invert()); + this.dispatchEvent({ + type: 'change', + action: 'translatePivot' + }); +}; -Miew.prototype._renderWithPrepassTransparency = function () { - return function (camera, targetBuffer) { - var gfx = this._gfx; - gfx.renderer.setRenderTarget(targetBuffer); // opaque objects +// Translate in ModelCS, x, y, z are Ang +ObjectControls.prototype.translatePivot = function (x, y, z) { + const pos = this.objectPivot.position; + pos.setX(pos.x + x); + pos.setY(pos.y + y); + pos.setZ(pos.z + z); + this.dispatchEvent({ + type: 'change', + action: 'translatePivot' + }); +}; - camera.layers.set(gfxutils.LAYERS.DEFAULT); - gfx.renderer.render(gfx.scene, camera); // transparent objects z prepass +// Set pivot +ObjectControls.prototype.setPivot = function (newPivot) { + this.objectPivot.position.copy(newPivot); + this.dispatchEvent({ + type: 'change', + action: 'translatePivot' + }); +}; +/* harmony default export */ const ui_ObjectControls = (ObjectControls); +;// CONCATENATED MODULE: ./src/ui/Picker.js - camera.layers.set(gfxutils.LAYERS.PREPASS_TRANSPARENT); - gfx.renderer.getContext().colorMask(false, false, false, false); // don't update color buffer - gfx.renderer.render(gfx.scene, camera); - gfx.renderer.getContext().colorMask(true, true, true, true); // update color buffer - // transparent objects color pass - camera.layers.set(gfxutils.LAYERS.TRANSPARENT); - gfx.renderer.render(gfx.scene, camera); // restore default layer - camera.layers.set(gfxutils.LAYERS.DEFAULT); +function Picker(gfxObj, camera, domElement) { + utils_EventDispatcher.call(this); + const self = this; + this.gfxObj = gfxObj; + this.camera = camera; + this.domElement = typeof domElement !== 'undefined' ? domElement : document; + this.screen = { + left: 0, + top: 0, + width: 0, + height: 0 }; -}(); - -Miew.prototype._performFXAA = function () { - var _fxaaMaterial = new FXAAMaterial(); - - return function (srcBuffer, targetBuffer) { - if (typeof srcBuffer === 'undefined' || typeof targetBuffer === 'undefined') { - return; + this._lastMousePos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(0, 0); + this._mouseTotalDist = 0.0; + this._lastClickBeginTime = -1000.0; + this._lastClickPos = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(0, 0); + this._clickBeginTime = 0.0; + this._clock = new Timer(); + this._clock.start(); + this._listeners = [{ + obj: self.domElement, + type: 'mousedown', + handler(e) { + self.mousedown(e); } - - var gfx = this._gfx; // clear canvas - - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - gfx.renderer.setRenderTarget(targetBuffer); - gfx.renderer.clear(); // do fxaa processing of offscreen buff2 - - _fxaaMaterial.uniforms.srcTex.value = srcBuffer.texture; - - _fxaaMaterial.uniforms.srcTexelSize.value.set(1.0 / srcBuffer.width, 1.0 / srcBuffer.height); - - _fxaaMaterial.uniforms.bgColor.value.set(settings.now.bg.color); - - if (_fxaaMaterial.bgTransparent !== settings.now.bg.transparent) { - _fxaaMaterial.setValues({ - bgTransparent: settings.now.bg.transparent - }); - - _fxaaMaterial.needsUpdate = true; + }, { + obj: self.domElement, + type: 'mouseup', + handler(e) { + self.mouseup(e); } - - gfx.renderer.renderScreenQuad(_fxaaMaterial); - }; -}(); - -Miew.prototype._performAO = function () { - var _aoMaterial = new AOMaterial(); - - var _horBlurMaterial = new AOHorBlurMaterial(); - - var _vertBlurMaterial = new AOVertBlurWithBlendMaterial(); - - var _scale = new Vector3(); - - return function (srcColorBuffer, normalBuffer, srcDepthTexture, targetBuffer, tempBuffer, tempBuffer1) { - if (!srcColorBuffer || !normalBuffer || !srcDepthTexture || !targetBuffer || !tempBuffer || !tempBuffer1) { - return; + }, { + obj: self.domElement, + type: 'mousemove', + handler(e) { + self.mousemove(e); } - - var gfx = this._gfx; - var tanHalfFOV = Math.tan(Math$1.DEG2RAD * 0.5 * gfx.camera.fov); - _aoMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture; - _aoMaterial.uniforms.depthTexture.value = srcDepthTexture; - _aoMaterial.uniforms.normalTexture.value = normalBuffer.texture; - - _aoMaterial.uniforms.srcTexelSize.value.set(1.0 / srcColorBuffer.width, 1.0 / srcColorBuffer.height); - - _aoMaterial.uniforms.camNearFar.value.set(gfx.camera.near, gfx.camera.far); - - _aoMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix; - _aoMaterial.uniforms.aspectRatio.value = gfx.camera.aspect; - _aoMaterial.uniforms.tanHalfFOV.value = tanHalfFOV; - gfx.root.matrix.extractScale(_scale); - _aoMaterial.uniforms.kernelRadius.value = settings.now.debug.ssaoKernelRadius * _scale.x; - _aoMaterial.uniforms.depthThreshold.value = 2.0 * this._getBSphereRadius(); // diameter - - _aoMaterial.uniforms.factor.value = settings.now.debug.ssaoFactor; // N: should be tempBuffer1 for proper use of buffers (see buffers using outside the function) - - gfx.renderer.setRenderTarget(tempBuffer1); - gfx.renderer.renderScreenQuad(_aoMaterial); - _horBlurMaterial.uniforms.aoMap.value = tempBuffer1.texture; - - _horBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer1.width, 1.0 / tempBuffer1.height); - - _horBlurMaterial.uniforms.depthTexture.value = srcDepthTexture; - gfx.renderer.setRenderTarget(tempBuffer); - gfx.renderer.renderScreenQuad(_horBlurMaterial); - _vertBlurMaterial.uniforms.aoMap.value = tempBuffer.texture; - _vertBlurMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture; - - _vertBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer.width, 1.0 / tempBuffer.height); - - _vertBlurMaterial.uniforms.depthTexture.value = srcDepthTexture; - _vertBlurMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix; - _vertBlurMaterial.uniforms.aspectRatio.value = gfx.camera.aspect; - _vertBlurMaterial.uniforms.tanHalfFOV.value = tanHalfFOV; - var fog = gfx.scene.fog; - - if (fog) { - _vertBlurMaterial.uniforms.fogNearFar.value.set(fog.near, fog.far); - - _vertBlurMaterial.uniforms.fogColor.value.set(fog.color.r, fog.color.g, fog.color.b, settings.now.fogAlpha); + }, { + obj: self.domElement, + type: 'touchstart', + handler(e) { + self.touchstart(e); } - - if (_vertBlurMaterial.useFog !== settings.now.fog || _vertBlurMaterial.fogTransparent !== settings.now.bg.transparent) { - _vertBlurMaterial.setValues({ - useFog: settings.now.fog, - fogTransparent: settings.now.bg.transparent - }); - - _vertBlurMaterial.needsUpdate = true; + }, { + obj: self.domElement, + type: 'touchend', + handler(e) { + self.touchend(e); } - - gfx.renderer.setRenderTarget(targetBuffer); - gfx.renderer.renderScreenQuad(_vertBlurMaterial); - }; -}(); -/** - * Reset the viewer, unload molecules. - * @param {boolean=} keepReps - Keep representations while resetting viewer state. - */ - - -Miew.prototype.reset = function () -/* keepReps */ -{ - if (this._picker) { - this._picker.reset(); + }, { + obj: window, + type: 'resize', + handler() { + self.handleResize(); + } + }]; + for (let i = 0; i < this._listeners.length; i++) { + const l = this._listeners[i]; + l.obj.addEventListener(l.type, l.handler); } - - this._lastPick = null; - - this._releaseAllVisuals(); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this._resetObjects(); - - if (this._gfx) { - gfxutils.clearTree(this._gfx.pivot); - - this._gfx.renderer2d.reset(); + this.handleResize(); +} +Picker.prototype = Object.create(utils_EventDispatcher.prototype); +Picker.prototype.constructor = Picker; +Picker.prototype.reset = function () { + this.picked = {}; + this.dispatchEvent({ + type: 'newpick', + obj: {} + }); +}; +Picker.prototype.handleResize = function () { + if (this.domElement === document) { + this.screen.left = 0; + this.screen.top = 0; + this.screen.width = window.innerWidth; + this.screen.height = window.innerHeight; + } else { + const box = this.domElement.getBoundingClientRect(); + // adjustments come from similar code in the jquery offset() function + const d = this.domElement.ownerDocument.documentElement; + this.screen.left = box.left + window.pageXOffset - d.clientLeft; + this.screen.top = box.top + window.pageYOffset - d.clientTop; + this.screen.width = box.width; + this.screen.height = box.height; + } +}; +Picker.prototype.pickObject = function (screenPos) { + if (!this.gfxObj) { + this.picked = {}; + this.dispatchEvent({ + type: 'newpick', + obj: {} + }); + return; + } + const { + gfxObj + } = this; + const rayCaster = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Raycaster(); + rayCaster.ray.origin.setFromMatrixPosition(this.camera.matrixWorld); + rayCaster.ray.direction.set(screenPos.x, screenPos.y, 0.5).unproject(this.camera).sub(rayCaster.ray.origin).normalize(); + const clipPlane = settings.now.draft.clipPlane && this.clipPlaneValue ? this.clipPlaneValue : Infinity; + const fogFarPlane = settings.now.fog && this.fogFarValue ? this.fogFarValue : Infinity; + const point = rayCaster.intersectVisibleObject(gfxObj, this.camera, clipPlane, fogFarPlane); + if (!point) { + this.picked = {}; + this.dispatchEvent({ + type: 'newpick', + obj: {} + }); + return; + } + let picked = {}; + if (point.residue || point.atom) { + const residue = point.residue || point.atom.residue; + if (settings.now.pick === 'chain') { + picked = { + chain: residue.getChain() + }; + } else if (settings.now.pick === 'molecule') { + picked = { + molecule: residue.getMolecule() + }; + } else if (point.residue || settings.now.pick === 'residue') { + picked = { + residue + }; + } else if (point.atom) { + picked = { + atom: point.atom + }; + } } - - this.setNeedRender(); + this.picked = picked; + this.dispatchEvent({ + type: 'newpick', + obj: picked + }); }; - -Miew.prototype._resetScene = function () { - this._objectControls.reset(); - - this._objectControls.allowTranslation(true); - - this._objectControls.allowAltObjFreeRotation(true); - - this.resetReps(); - this.resetPivot(); - this.rebuildAll(); +Picker.prototype.getMouseInViewport = function (pageX, pageY) { + return new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2((pageX - this.screen.left) / this.screen.width * 2 - 1, -(pageY - this.screen.top) / this.screen.height * 2 + 1); }; - -Miew.prototype.resetView = function () { - // reset controls - if (this._picker) { - this._picker.reset(); +Picker.prototype.mousedown = function (event) { + event.preventDefault(); + event.stopPropagation(); + if (event.button === 0) { + this._lastMousePos = this.getMouseInViewport(event.pageX, event.pageY); + this._mouseTotalDist = 0.0; + this._clickBeginTime = this._clock.getElapsedTime(); } - - this._setEditMode(EDIT_MODE.COMPLEX); - - this._resetScene(); // reset selection - - - this._forEachComplexVisual(function (visual) { - visual.updateSelectionMask({}); - visual.rebuildSelectionGeometry(); - }); }; - -Miew.prototype._export = function (format) { - var TheExporter = _.head(io.exporters.find({ - format: format - })); - - if (!TheExporter) { - this.logger.error('Could not find suitable exporter for this source'); - return Promise.reject(new Error('Could not find suitable exporter for this source')); - } - - this.dispatchEvent({ - type: 'exporting' - }); - - if (this._visuals[this._curVisualName] instanceof ComplexVisual) { - var dataSource = null; - - if (TheExporter.SourceClass === ComplexVisual) { - dataSource = this._visuals[this._curVisualName]; - } else if (TheExporter.SourceClass === Complex) { - dataSource = this._visuals[this._curVisualName]._complex; +Picker.prototype.mousemove = function (event) { + event.preventDefault(); + event.stopPropagation(); + const pos = this.getMouseInViewport(event.pageX, event.pageY); + this._mouseTotalDist += pos.sub(this._lastMousePos).length(); +}; +Picker.prototype.mouseup = function (event) { + const self = this; + event.preventDefault(); + event.stopPropagation(); + if (event.button === 0) { + if (this._mouseTotalDist < 0.01) { + const curTime = this._clock.getElapsedTime(); + const curPos = this.getMouseInViewport(event.pageX, event.pageY); + const timeSinceLastClickBegin = curTime - this._lastClickBeginTime; + if (timeSinceLastClickBegin < 0.7) { + const clickDist = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2().subVectors(curPos, this._lastClickPos); + if (clickDist.length() < 0.01) { + // it's a double click + this.dispatchEvent({ + type: 'dblclick', + obj: this.picked + }); + this._lastClickPos = curPos; + this._lastClickBeginTime = -1000; // this click cannot serve as first click in double-click + return; + } + } + setTimeout(() => { + self.pickObject(curPos); + }, 0); + this._lastClickPos = curPos; + this._lastClickBeginTime = this._clickBeginTime; } - - var exporter = new TheExporter(dataSource, { - miewVersion: Miew.VERSION - }); - return exporter["export"]().then(function (data) { - return data; - }); } - - if (this._visuals[this._curVisualName] instanceof VolumeVisual) { - return Promise.reject(new Error('Sorry, exporter for volume data not implemented yet')); +}; +Picker.prototype.touchstart = function (event) { + event.preventDefault(); + event.stopPropagation(); + if (event.touches.length === 1) { + this._lastTouchdownPos = this.getMouseInViewport(event.touches[0].pageX, event.touches[0].pageY); } - - return Promise.reject(new Error('Unexpected format of data')); }; - -var rePdbId = /^(?:(pdb|cif|mmtf|ccp4|dsn6):\s*)?(\d[a-z\d]{3})$/i; -var rePubchem = /^(?:pc|pubchem):\s*([a-z]+)$/i; -var reUrlScheme = /^([a-z][a-z\d\-+.]*):/i; - -function resolveSourceShortcut(source, opts) { - if (!_.isString(source)) { - return source; - } // e.g. "mmtf:1CRN" - - - var matchesPdbId = rePdbId.exec(source); - - if (matchesPdbId) { - var _matchesPdbId = slicedToArray(matchesPdbId, 3), - _matchesPdbId$ = _matchesPdbId[1], - format = _matchesPdbId$ === void 0 ? 'pdb' : _matchesPdbId$, - id = _matchesPdbId[2]; - - format = format.toLowerCase(); - id = id.toUpperCase(); - - switch (format) { - case 'pdb': - source = "https://files.rcsb.org/download/".concat(id, ".pdb"); - break; - - case 'cif': - source = "https://files.rcsb.org/download/".concat(id, ".cif"); - break; - - case 'mmtf': - source = "https://mmtf.rcsb.org/v1.0/full/".concat(id); - break; - - case 'ccp4': - source = "https://www.ebi.ac.uk/pdbe/coordinates/files/".concat(id.toLowerCase(), ".ccp4"); - break; - - case 'dsn6': - source = "https://edmaps.rcsb.org/maps/".concat(id.toLowerCase(), "_2fofc.dsn6"); - break; - - default: - throw new Error('Unexpected data format shortcut'); - } - - opts.fileType = format; - opts.fileName = "".concat(id, ".").concat(format); - opts.sourceType = 'url'; - return source; - } // e.g. "pc:aspirin" - - - var matchesPubchem = rePubchem.exec(source); - - if (matchesPubchem) { - var compound = matchesPubchem[1].toLowerCase(); - source = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/".concat(compound, "/JSON?record_type=3d"); - opts.fileType = 'pubchem'; - opts.fileName = "".concat(compound, ".json"); - opts.sourceType = 'url'; - return source; - } // otherwise is should be an URL - - - if (opts.sourceType === 'url' || opts.sourceType === undefined) { - opts.sourceType = 'url'; // e.g. "./data/1CRN.pdb" - - if (!reUrlScheme.test(source)) { - source = utils.resolveURL(source); +Picker.prototype.touchend = function (event) { + const self = this; + event.preventDefault(); + event.stopPropagation(); + if (event.touches.length === 0 && event.changedTouches.length === 1) { + const pos = this.getMouseInViewport(event.changedTouches[0].pageX, event.changedTouches[0].pageY); + const dist = pos.sub(this._lastTouchdownPos).length(); + if (dist < 0.01) { + setTimeout(() => { + self.pickObject(self._lastTouchdownPos); + }, 0); } } +}; +Picker.prototype.dispose = function () { + for (let i = 0; i < this._listeners.length; i++) { + const l = this._listeners[i]; + l.obj.removeEventListener(l.type, l.handler); + } +}; +/* harmony default export */ const ui_Picker = (Picker); +;// CONCATENATED MODULE: ./src/gfx/Axes.js - return source; +class Axes { + constructor(target, targetCamera) { + this._target = target; + this._targetCamera = targetCamera; + this._camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PerspectiveCamera(targetCamera.fov, targetCamera.aspect, 1, 100); + this._object = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.AxesHelper(1); + this._scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Scene(); + this._scene.add(this._object); + this._full = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(); + this._update(); + } + _update() { + const { + fov + } = this._targetCamera; + const camera = this._camera; + camera.aspect = this._targetCamera.aspect; + camera.setMinimalFov(fov); + camera.setDistanceToFit(1.0, fov); + camera.updateProjectionMatrix(); + this._object.quaternion.copy(this._target.quaternion); + } + render(renderer) { + this._update(); + renderer.getSize(this._full); + const width = this._full.width * 0.25; + const height = this._full.height * 0.25; + const { + autoClear + } = renderer; + renderer.autoClear = false; + renderer.setViewport(0.0, 0.0, width, height); + renderer.clear(false, true, false); + renderer.render(this._scene, this._camera); + renderer.setViewport(0, 0, this._full.width, this._full.height); + renderer.autoClear = autoClear; + } } - -function updateBinaryMode(opts) { - var binary = opts.binary; // detect by format - - if (opts.fileType !== undefined) { - var TheParser = _.head(io.parsers.find({ - format: opts.fileType - })); - - if (TheParser) { - binary = TheParser.binary || false; - } else { - throw new Error('Could not find suitable parser for this format'); - } - } // detect by file extension - - - if (binary === undefined && opts.fileExt !== undefined) { - var _TheParser = _.head(io.parsers.find({ - ext: opts.fileExt - })); - - if (_TheParser) { - binary = _TheParser.binary || false; - } - } // temporary workaround for animation - - - if (opts.fileExt !== undefined && opts.fileExt.toLowerCase() === '.man') { - opts.binary = true; - opts.animation = true; // who cares? - } // update if detected - - - if (binary !== undefined) { - if (opts.binary !== undefined && opts.binary !== binary) { - opts.context.logger.warn('Overriding incorrect binary mode'); +/* harmony default export */ const gfx_Axes = (Axes); +;// CONCATENATED MODULE: ./src/gfx/FrameInfo.js + + +const cDataOffset = 12; +const cFirstMask = 0x0FFFFF00; +const cFirstShift = 8; +const cSecMask1 = 0x000000FF; +const cSecShift1 = 12; +const cSecMask2 = 0xFFF00000; +const cSecShift2 = 20; +const cThirdMask = 0x000FFFFF; +const cStrMask = 0xF0000000; +const cStrShift = 28; +const c219 = 1 << 19; +const c220 = 1 << 20; +const cHelixIdx = 1; +const cSheetIdx = 2; +const secTypes = ['helix', 'strand']; +const cSecNames = ['fs', 'ps', 'ns', 'us']; +function _createSecondary(strArray, complex) { + const residues = complex._residues; + const nRes = residues.length; + const resid = new Uint8Array(nRes); + const atoms = complex._atoms; + for (let i = 0, n = strArray.length; i < n; ++i) { + const atom = atoms[i]; + resid[atom.residue._index] = strArray[i]; + } + const secondary = []; + let rIdx = 0; + while (rIdx < nRes) { + if (resid[rIdx] !== 0) { + const start = rIdx; + const val = resid[rIdx]; + while (rIdx < nRes - 1 && resid[rIdx + 1] === val && residues[rIdx].isConnected(residues[rIdx + 1])) { + ++rIdx; + } + secondary.push({ + start, + end: rIdx, + type: secTypes[val - 1] + }); } + ++rIdx; } - - opts.binary = binary || false; + return secondary; } - -function _fetchData(source, opts, job) { - return new Promise(function (resolve) { - if (job.shouldCancel()) { - throw new Error('Operation cancelled'); - } - - job.notify({ - type: 'fetching' - }); // allow for source shortcuts - - source = resolveSourceShortcut(source, opts); // detect a proper loader - - var TheLoader = _.head(io.loaders.find({ - type: opts.sourceType, - source: source - })); - - if (!TheLoader) { - throw new Error(LOADER_NOT_FOUND); - } // split file name - - - var fileName = opts.fileName || TheLoader.extractName(source); - - if (fileName) { - var _utils$splitFileName = utils.splitFileName(fileName), - _utils$splitFileName2 = slicedToArray(_utils$splitFileName, 2), - name = _utils$splitFileName2[0], - fileExt = _utils$splitFileName2[1]; - - _.defaults(opts, { - name: name, - fileExt: fileExt, - fileName: fileName - }); - } // should it be text or binary? - - - updateBinaryMode(opts); // FIXME: All new settings retrieved from server are applied after the loading is complete. However, we need some - // flags to alter the loading process itself. Here we apply them in advance. Dirty hack. Kill the server, remove - // all hacks and everybody's happy. - - var newOptions = _.get(opts, 'preset.expression'); - - if (!_.isUndefined(newOptions)) { - newOptions = JSON.parse(newOptions); - - if (newOptions && newOptions.settings) { - var keys = ['singleUnit']; - - for (var keyIndex = 0, keyCount = keys.length; keyIndex < keyCount; ++keyIndex) { - var key = keys[keyIndex]; - - var value = _.get(newOptions.settings, key); - - if (!_.isUndefined(value)) { - settings.set(key, value); - } +function fromUInt20ToInt20(uint20) { + return uint20 >= c219 ? uint20 - c220 : uint20; +} +class FrameInfo { + constructor(complex, payload, callbacks) { + this._complex = complex; + this._secondary = null; + this.isLoading = false; + this._framesRange = { + start: 0, + end: -1 + }; + this.frameIsReady = false; + this._buffer = null; + this._frameRequest = null; + this._callbacks = callbacks; + if (typeof payload === 'function') { + this._framesRequestLength = 1; + this._downloadDataFn = payload; + } else { + this.parseBinaryData(payload, true); + } + this.reset(); + this.setFrame(0); + } + _prepareBuffer(framesStart, framesEnd) { + if (framesStart === undefined || framesStart === null) { + framesStart = 0; + } + if (framesEnd === undefined || framesEnd === null) { + framesEnd = framesStart + this._framesRequestLength; + } + if (this._framesCount !== undefined) { + framesEnd = Math.min(this._framesCount - 1, framesEnd); + } + if (this._downloadDataFn) { + const self = this; + const onDone = function (data) { + self.isLoading = false; + if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') { + self._callbacks.onLoadStatusChanged(); + } + self._buffer = { + data, + state: 'ready', + start: framesStart, + end: framesEnd + }; + if (self._frameRequest !== null) { + const idx = self._frameRequest; + self._frameRequest = null; + self.setFrame(idx); + } + }; + const onFail = function () { + self.isLoading = false; + if (self._callbacks && typeof self._callbacks.onError === 'function') { + self._callbacks.onError('Streaming failed'); } + }; + if (!this._buffer) { + this._buffer = {}; } - } // create a loader - - - var loader = new TheLoader(source, opts); - loader.context = opts.context; - job.addEventListener('cancel', function () { - return loader.abort(); - }); - loader.addEventListener('progress', function (event) { - if (event.lengthComputable && event.total > 0) { - reportProgress(loader.logger, 'Fetching', event.loaded / event.total); - } else { - reportProgress(loader.logger, 'Fetching'); + this._buffer.state = 'downloading'; + this.isLoading = true; + if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') { + self._callbacks.onLoadStatusChanged(); } - }); - console.time('fetch'); - var promise = loader.load().then(function (data) { - console.timeEnd('fetch'); - opts.context.logger.info('Fetching finished'); - job.notify({ - type: 'fetchingDone', - data: data - }); - return data; - })["catch"](function (error) { - console.timeEnd('fetch'); - opts.context.logger.debug(error.message); - - if (error.stack) { - opts.context.logger.debug(error.stack); + this._downloadDataFn({ + start: framesStart, + end: framesEnd + 1 + }, onDone, onFail); + } + } + _parseBuffer() { + if (this._buffer && this._buffer.state === 'ready') { + this._framesRange = { + start: this._buffer.start, + end: this._buffer.end + }; + this.parseBinaryData(this._buffer.data, false); + let _bufferRequestStart = (this._buffer.end + 1) % this._framesCount; + if (_bufferRequestStart >= this._framesCount) { + _bufferRequestStart = 0; } - - opts.context.logger.error('Fetching failed'); - job.notify({ - type: 'fetchingDone', - error: error - }); - throw error; - }); - resolve(promise); - }); -} - -function _parseData(data, opts, job) { - if (job.shouldCancel()) { - return Promise.reject(new Error('Operation cancelled')); + this._buffer = { + state: 'none' + }; + this._prepareBuffer(_bufferRequestStart, _bufferRequestStart + this._framesRequestLength); + if (this._frameRequest !== null) { + const idx = this._frameRequest; + this._frameRequest = null; + this.setFrame(idx); + } + } + } + parseBinaryData(arrayBuffer) { + const dataView = new DataView(arrayBuffer); + let offset = 0; + const atomsCount = dataView.getUint32(offset, true); + offset += 4; + const framesCount = dataView.getUint32(offset, true); + this._framesCount = framesCount; + this._framesRange.end = this._framesRange.end > 0 ? Math.min(this._framesRange.end, framesCount - 1) : framesCount - 1; + offset += 4; + this._atomsCount = atomsCount; + const maxSize = 1024 * 1024; // 1 MB + this._framesRequestLength = Math.ceil(maxSize / (atomsCount * 8)); + const chunkedFramesCount = this._framesRange.end - this._framesRange.start + 1; + if (atomsCount !== this._complex._atoms.length || arrayBuffer.byteLength !== cDataOffset + chunkedFramesCount * atomsCount * 8) { + throw new Error(); + } + const complex = this._complex; + let timeStep = dataView.getUint32(offset, true); + let iName = 0; + while (timeStep > 1000 && iName < cSecNames.length - 1) { + timeStep /= 1000; + ++iName; + } + this._timeStep = `${timeStep.toString()} ${cSecNames[iName]}`; + offset += 4; + const secondary = []; + const posData = new Float32Array(chunkedFramesCount * atomsCount * 3); + let coordIdx = 0; + const secondaryArr = new Int8Array(atomsCount); + for (let j = 0; j < chunkedFramesCount; ++j) { + for (let i = 0; i < atomsCount; ++i) { + const hiWord = dataView.getUint32(offset, true); + offset += 4; + const loWord = dataView.getUint32(offset, true); + offset += 4; + const str = (loWord & cStrMask) >>> cStrShift; + const x = fromUInt20ToInt20((loWord & cFirstMask) >>> cFirstShift >> 0); + const y = fromUInt20ToInt20(((loWord & cSecMask1) << cSecShift1 | (hiWord & cSecMask2) >>> cSecShift2) >> 0); + const z = fromUInt20ToInt20((hiWord & cThirdMask) >> 0); + secondaryArr[i] = 0; + if (str > 0 && str < 4) { + secondaryArr[i] = cHelixIdx; + } else if (str === 4) { + secondaryArr[i] = cSheetIdx; + } + posData[coordIdx++] = x / 100; + posData[coordIdx++] = y / 100; + posData[coordIdx++] = z / 100; + } + secondary.push(_createSecondary(secondaryArr, complex)); + } + this._secondaryData = secondary; + this._data = posData; + } + nextFrame() { + this.setFrame((this._currFrame + 1) % this._framesCount); + } + needsColorUpdate(colorer) { + return colorer instanceof colorers_SecondaryStructureColorer; + } + getAtomColor(colorer, atom) { + return colorer.getResidueColor(this._residues[atom.residue._index], this._complex); + } + getResidueColor(colorer, residue) { + return colorer.getResidueColor(this._residues[residue._index], this._complex); + } + _updateSecondary() { + let i; + const myResidues = this._residues; + let n = myResidues.length; + for (i = 0; i < n; ++i) { + myResidues[i]._secondary = null; + } + const sec = this._secondaryData[this._currFrame - this._framesRange.start]; + for (i = 0, n = sec.length; i < n; ++i) { + const oldSec = sec[i]; + const { + start, + end + } = oldSec; + const nSec = { + _start: myResidues[start], + _end: myResidues[end], + type: oldSec.type, + generic: oldSec.generic + }; + for (let j = start; j <= end; ++j) { + myResidues[j]._secondary = nSec; + } + } } - - job.notify({ - type: 'parsing' - }); - - var TheParser = _.head(io.parsers.find({ - format: opts.fileType, - ext: opts.fileExt, - data: data - })); - - if (!TheParser) { - return Promise.reject(new Error('Could not find suitable parser')); + reset() { + const compRes = this._complex._residues; + const n = compRes.length; + this._residues = new Array(n); + const myResidues = this._residues; + const getSec = function () { + return this._secondary; + }; + for (let i = 0; i < n; ++i) { + myResidues[i] = { + _type: compRes[i]._type, + _isValid: compRes[i]._isValid, + _controlPoint: null, + _wingVector: null, + _secondary: null, + getSecondary: getSec + }; + } + } + setFrame(frameIdx) { + this.frameIsReady = false; + if (frameIdx >= this._framesRange.start && frameIdx <= this._framesRange.end) { + this._currFrame = frameIdx; + this._cachedResidues = false; + this._updateSecondary(); + this.frameIsReady = true; + } else { + this._frameRequest = frameIdx; + if (!this._buffer) { + this._prepareBuffer(frameIdx); + } else { + const self = this; + switch (this._buffer.state) { + case 'none': + this._prepareBuffer(frameIdx); + break; + case 'ready': + self._parseBuffer(); + break; + default: + break; + } + } + } + } + disableEvents() { + this._callbacks = null; } - var parser = new TheParser(data, opts); - parser.context = opts.context; - job.addEventListener('cancel', function () { - return parser.abort(); - }); - console.time('parse'); - return parser.parse().then(function (dataSet) { - console.timeEnd('parse'); - job.notify({ - type: 'parsingDone', - data: dataSet - }); - return dataSet; - })["catch"](function (error) { - console.timeEnd('parse'); - opts.error = error; - opts.context.logger.debug(error.message); + /** + * Returns link to atom pos vector, clone it if needed + */ - if (error.stack) { - opts.context.logger.debug(error.stack); + static _vec = (() => new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3())(); + getAtomPos(atomIdx) { + const vec = FrameInfo._vec; + const self = this; + const data = self._data; + const idx = (self._atomsCount * (self._currFrame - self._framesRange.start) + atomIdx) * 3; + vec.set(data[idx], data[idx + 1], data[idx + 2]); + return vec; + } + getResidues() { + if (this._cachedResidues) { + return this._residues; } - - opts.context.logger.error('Parsing failed'); - job.notify({ - type: 'parsingDone', - error: error - }); - throw error; - }); + this._complex.updateToFrame(this); + return this._residues; + } } -/** - * Load molecule asynchronously. - * @param {string|File} source - Molecule source to load (e.g. PDB ID, URL or File object). - * @param {object=} opts - Options. - * @param {string=} opts.sourceType - Data source type (e.g. 'url', 'file'). - * @param {string=} opts.fileType - Data contents type (e.g. 'pdb', 'cml'). - * @param {string=} opts.mdFile - .nc file path. - * @param {boolean=} opts.keepRepsInfo - prevent reset of object and reps information. - * @returns {Promise} name of the visual that was added to the viewer - */ - +/* harmony default export */ const gfx_FrameInfo = (FrameInfo); +;// CONCATENATED MODULE: ./src/gfx/objects/SceneObject.js -Miew.prototype.load = function (source, opts) { - var _this3 = this; - opts = _.merge({}, opts, { - context: this - }); // for a single-file scenario - if (!this.settings.now.use.multiFile) { - // abort all loaders in progress - if (this._loading.length) { - this._loading.forEach(function (job) { - job.cancel(); - }); - this._loading.length = 0; - } // reset +/** + * Create new scene object. + * + * @param {array=} params - Object required params. + * @param {object=} opts - Options to override defaults with. + * + * These options are copied locally and not kept by reference, so the created instance will not reflect further + * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation. + * + * @exports SceneObject + * @this SceneObject + * @abstract + * @constructor + * @classdesc Basic class for all scene objects that are not reps. + */ +class SceneObject { + constructor(params, opts) { + if (this.constructor === SceneObject) { + throw new Error('Can not instantiate abstract class!'); + } + /** + * Object's options inherited (prototyped) from defaults. + * @type {object} + */ + this.params = params; + this.opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge(utils.deriveDeep(settings.now.objects[this.type], true), opts); + this.needsRebuild = false; + this._mesh = null; + this.id = null; + } - if (!opts.animation) { - // FIXME: sometimes it is set AFTERWARDS! - this.reset(true); + /** + * Get object identification, probably with options. + * @returns {Object} field type contains type information, params - object's formal parameters, + * opts - changed options + * Options are returned if they were changed during or after object creation. + */ + identify() { + const result = { + type: this.type, + params: this.params + }; + const diff = utils.objectsDiff(this.opts, settings.now.modes[this.id]); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(diff)) { + result.opts = diff; + } + return result; + } + toString() { + const paramsStr = `o=${this.type},${this.params.join(',')}`; + const optsStr = utils.compareOptionsWithDefaults(this.opts, settings.defaults.objects[this.type]); + return paramsStr + optsStr; + } + getGeometry() { + return this._mesh; + } + destroy() { + if (this._mesh) { + gfxutils.destroyObject(this._mesh); } } +} - this._interpolator.reset(); +/** + * Scene object identifier. + * @type {string} + */ +SceneObject.prototype.type = '__'; +/* harmony default export */ const objects_SceneObject = (SceneObject); +;// CONCATENATED MODULE: ./src/gfx/objects/LinesObj.js - this.dispatchEvent({ - type: 'loading', - options: opts, - source: source - }); - var job = new JobHandle(); - this._loading.push(job); - job.addEventListener('notification', function (e) { - _this3.dispatchEvent(e.slaveEvent); - }); - this._spinner.spin(this._container); - var onLoadEnd = function onLoadEnd(anything) { - var jobIndex = _this3._loading.indexOf(job); - if (jobIndex !== -1) { - _this3._loading.splice(jobIndex, 1); +class LinesObj extends objects_SceneObject { + constructor(params, opts) { + super(params, opts); + if (params.length < 2) { + throw new Error('Wrong number of argumets on line object creation!'); } - - _this3._spinner.stop(); - - _this3._refreshTitle(); - - job.notify({ - type: 'loadingDone', - anything: anything + [this._id1, this._id2] = params; + } + _getAtomFromName(complex, atomId) { + const err = ' - Wrong atom format it must be \'#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME\' (e.g. \'A.38.CO1\')'; + const atom1 = complex.getAtomByFullname(atomId); + if (!atom1) { + throw new Error(atomId + err); + } + return atom1; + } + build(complex) { + const geom = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferGeometry(); + this._atom1 = this._getAtomFromName(complex, this._id1); + this._atom2 = this._getAtomFromName(complex, this._id2); + const p1 = this._atom1.position; + const p2 = this._atom2.position; + const vertices = new Float32Array([p1.x, p1.y, p1.z, p2.x, p2.y, p2.z]); + geom.setAttribute('position', new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.BufferAttribute(vertices, 3)); + geom.computeBoundingBox(); + this._line = new meshes.Line(geom, new shaders_UberMaterial({ + lights: false, + overrideColor: true, + dashedLine: true, + fogTransparent: settings.now.bg.transparent + })); + this._line.computeLineDistances(); + this._line.material.setUberOptions({ + fixedColor: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(this.opts.color), + dashedLineSize: this.opts.dashSize, + dashedLinePeriod: this.opts.dashSize + this.opts.gapSize }); - return anything; - }; - - return _fetchData(source, opts, job).then(function (data) { - return _parseData(data, opts, job); - }).then(function (object) { - var name = _this3._onLoad(object, opts); - - return onLoadEnd(name); - })["catch"](function (err) { - _this3.logger.error('Could not load data'); - - _this3.logger.debug(err); - - throw onLoadEnd(err); - }); -}; -/** - * Unload molecule (delete corresponding visual). - * @param {string=} name - name of the visual - */ - + this._line.material.updateUniforms(); + this._line.raycast = function (_raycaster, _intersects) {}; + this._mesh = this._line; + const transforms = complex.getTransforms(); + if (transforms.length > 0) { + this._mesh = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group(); + this._mesh.add(this._line); + meshutils.applyTransformsToMeshes(this._mesh, transforms); + } + } + updateToFrame(frameData) { + if (!this._atom1 || !this._atom2 || !this._line) { + return; + } + const geo = this._line.geometry; + geo.vertices[0].copy(frameData.getAtomPos(this._atom1.index)); + geo.vertices[1].copy(frameData.getAtomPos(this._atom2.index)); + this._line.computeLineDistances(); + geo.computeBoundingSphere(); + geo.verticesNeedUpdate = true; + } +} +LinesObj.prototype.constructor = LinesObj; +LinesObj.prototype.type = 'line'; +/* harmony default export */ const objects_LinesObj = (LinesObj); +;// CONCATENATED MODULE: ./src/gfx/shaders/Outline.frag +const Outline_namespaceObject = "precision highp float;\r\n\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexSize;\r\nuniform vec2 thickness;\r\nvarying vec2 vUv;\r\n\r\n#ifdef DEPTH_OUTLINE\r\n uniform sampler2D srcDepthTex; //depthTexture\r\n uniform vec3 color;\r\n uniform float threshold;\r\n#endif\r\n\r\nvoid main() {\r\n\r\n vec2 pixelSize = thickness / srcTexSize;\r\n\r\n #ifdef DEPTH_OUTLINE\r\n float c00 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,-pixelSize.y)).x;\r\n float c01 = texture2D(srcDepthTex, vUv + vec2(0,-pixelSize.y)).x;\r\n float c02 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,-pixelSize.y)).x;\r\n float c10 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,0)).x;\r\n float c12 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,0)).x;\r\n float c20 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,pixelSize.y)).x;\r\n float c21 = texture2D(srcDepthTex, vUv + vec2(0,pixelSize.y)).x;\r\n float c22 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,pixelSize.y)).x;\r\n\r\n float horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n float vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n float grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n\r\n gl_FragColor = ( grad > threshold ) ? vec4(color.rgb, 1.0) : gl_FragColor = texture2D(srcTex, vUv);\r\n\r\n #else\r\n vec4 c00 = texture2D(srcTex, vUv + vec2(-pixelSize.x,-pixelSize.y));\r\n vec4 c01 = texture2D(srcTex, vUv + vec2(0,-pixelSize.y));\r\n vec4 c02 = texture2D(srcTex, vUv + vec2(pixelSize.x,-pixelSize.y));\r\n vec4 c10 = texture2D(srcTex, vUv + vec2(-pixelSize.x,0));\r\n vec4 c12 = texture2D(srcTex, vUv + vec2(pixelSize.x,0));\r\n vec4 c20 = texture2D(srcTex, vUv + vec2(-pixelSize.x,pixelSize.y));\r\n vec4 c21 = texture2D(srcTex, vUv + vec2(0,pixelSize.y));\r\n vec4 c22 = texture2D(srcTex, vUv + vec2(pixelSize.x,pixelSize.y));\r\n\r\n vec4 horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r\n vec4 vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r\n\r\n vec4 grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r\n gl_FragColor = grad;\r\n #endif\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/OutlineMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ -Miew.prototype.unload = function (name) { - this._removeVisual(name || this.getCurrentVisual()); - this.resetPivot(); - if (settings.now.shadow.on) { - this._updateShadowCamera(); +class OutlineMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RawShaderMaterial { + constructor(params) { + // add depth outline + super(params); + const settings = { + uniforms: { + srcTex: { + type: 't', + value: null + }, + srcDepthTex: { + type: 't', + value: null + }, + srcTexSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(512, 512) + }, + color: { + type: 'v3', + value: null + }, + threshold: { + type: 'f', + value: null + }, + opacity: { + type: 'f', + value: 1.0 + }, + thickness: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(1, 1) + } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: Outline_namespaceObject, + transparent: true, + depthTest: false, + depthWrite: false + }; + this.setValues(settings); } -}; -/** - * Start new animation. Now is broken. - * @param fileData - new data to animate - * @private - * @deprecated until animation system refactoring. - */ + copy(source) { + super.copy(source); + this.depth = source.depth; + } + setValues(values) { + if (typeof values === 'undefined') { + return; + } + // set direct values + super.setValues(values); + const defines = {}; + if (this.depth) { + defines.DEPTH_OUTLINE = 1; + } -Miew.prototype._startAnimation = function (fileData) { - this._stopAnimation(); + // set dependent values + this.defines = defines; + } +} +OutlineMaterial.prototype.depth = false; +/* harmony default export */ const shaders_OutlineMaterial = (OutlineMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/FXAA.frag +const FXAA_namespaceObject = "precision highp float;\r\n\r\n// edge end finding algorithm parameters\r\n#define FXAA_QUALITY_PS 8\r\n#define FXAA_QUALITY_P0 1.0\r\n#define FXAA_QUALITY_P1 1.5\r\n#define FXAA_QUALITY_P2 2.0\r\n#define FXAA_QUALITY_P3 2.0\r\n#define FXAA_QUALITY_P4 2.0\r\n#define FXAA_QUALITY_P5 2.0\r\n#define FXAA_QUALITY_P6 4.0\r\n#define FXAA_QUALITY_P7 12.0\r\n// constants\r\nfloat fxaaQualityEdgeThreshold = 0.125;\r\nfloat fxaaQualityEdgeThresholdMin = 0.0625;\r\nfloat fxaaQualitySubpix = 0.7; //0.65;\r\n// global params\r\nuniform sampler2D srcTex;\r\nuniform vec2 srcTexelSize;\r\nuniform vec3 bgColor;\r\n// from vs\r\nvarying vec2 vUv;\r\n//=====================================================================//\r\n// calc luminance from rgb\r\n//'float FxaaLuma(vec3 rgb) {return rgb.y * (0.587/0.299) + rgb.x; } // Lotte's idea about game luminance\r\nfloat FxaaLuma(vec3 rgb) {return dot(rgb, vec3(0.299, 0.587, 0.114)); } // real luminance calculation\r\n // for non-real scene rendering\r\n// texture sampling by pixel position(coords) and offset(in pixels)\r\n vec3 FxaaTex(sampler2D tex, vec2 pos, vec2 off, vec2 res ) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos + off * res );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos + off * res ).xyz;\r\n #endif\r\n}\r\nvec3 FxaaTexTop(sampler2D tex, vec2 pos) {\r\n #ifdef BG_TRANSPARENT\r\n vec4 color = texture2D( tex, pos );\r\n return mix(color.rgb, bgColor, 1.0 - color.a);\r\n #else\r\n return texture2D( tex, pos).xyz;\r\n #endif\r\n}\r\nvec4 FxaaTexTopAlpha(sampler2D tex, vec2 pos) {\r\n return texture2D( tex, pos);\r\n}\r\n\r\n//=====================================================================//\r\nvoid main() {\r\n // renaming\r\n vec2 posM = vUv;\r\n // get luminance for neighbours\r\n float lumaS = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, 1.0 ), srcTexelSize));\r\n float lumaE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 0.0 ), srcTexelSize));\r\n float lumaN = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, -1.0 ), srcTexelSize));\r\n float lumaW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 0.0 ), srcTexelSize));\r\n float lumaM = FxaaLuma(FxaaTexTop(srcTex, posM));\r\n // find max and min luminance\r\n float rangeMax = max(max(lumaN, lumaW), max(lumaE, max(lumaS, lumaM)));\r\n float rangeMin = min(min(lumaN, lumaW), min(lumaE, min(lumaS, lumaM)));\r\n // calc maximum non-edge range\r\n float rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\r\n float range = rangeMax - rangeMin;\r\n float rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\r\n // exit when luma contrast is small (is not edge)\r\n if(range < rangeMaxClamped){\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n return;\r\n }\r\n float subpixRcpRange = 1.0/range;\r\n // note: the sampling coordinates can be calculated in vertex shader but the approach doesn't affect performance\r\n // visibly, thus we decided to leave calculation here for better readability.\r\n // calc other neighbours luminance\r\n float lumaNE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, -1.0 ), srcTexelSize));\r\n float lumaSW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 1.0 ), srcTexelSize));\r\n float lumaSE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 1.0 ), srcTexelSize));\r\n float lumaNW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, -1.0 ), srcTexelSize));\r\n/*--------------span calculation and subpix amount calulation-----------------*/\r\n float lumaNS = lumaN + lumaS;\r\n float lumaWE = lumaW + lumaE;\r\n float subpixNSWE = lumaNS + lumaWE;\r\n float edgeHorz1 = (-2.0 * lumaM) + lumaNS;\r\n float edgeVert1 = (-2.0 * lumaM) + lumaWE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNESE = lumaNE + lumaSE;\r\n float lumaNWNE = lumaNW + lumaNE;\r\n float edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\r\n float edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\r\n/*--------------------------------------------------------------------------*/\r\n float lumaNWSW = lumaNW + lumaSW;\r\n float lumaSWSE = lumaSW + lumaSE;\r\n float edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\r\n float edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\r\n float edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\r\n float edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\r\n float edgeHorz = abs(edgeHorz3) + edgeHorz4;\r\n float edgeVert = abs(edgeVert3) + edgeVert4;\r\n/*--------------------subpix amount calulation------------------------------*/\r\n float subpixNWSWNESE = lumaNWSW + lumaNESE;\r\n float lengthSign = srcTexelSize.x;\r\n bool horzSpan = edgeHorz >= edgeVert;\r\n // debug code edge span visualization\r\n/*' if (horzSpan)\r\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);\r\n else\r\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\r\n return;*/\r\n float subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\r\n/*--------------------------------------------------------------------------*/\r\n if(!horzSpan) lumaN = lumaW;\r\n if(!horzSpan) lumaS = lumaE;\r\n if(horzSpan) lengthSign = srcTexelSize.y;\r\n float subpixB = (subpixA * (1.0/12.0)) - lumaM;\r\n/*--------------------------------------------------------------------------*/\r\n float gradientN = lumaN - lumaM;\r\n float gradientS = lumaS - lumaM;\r\n float lumaNN = lumaN + lumaM;\r\n float lumaSS = lumaS + lumaM;\r\n bool pairN = abs(gradientN) >= abs(gradientS);\r\n float gradient = max(abs(gradientN), abs(gradientS));\r\n if(pairN) lengthSign = -lengthSign;\r\n float subpixC = clamp(abs(subpixB) * subpixRcpRange, 0.0, 1.0);\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posB;\r\n posB = posM;\r\n vec2 offNP;\r\n offNP.x = (!horzSpan) ? 0.0 : srcTexelSize.x;\r\n offNP.y = ( horzSpan) ? 0.0 : srcTexelSize.y;\r\n if(!horzSpan) posB.x += lengthSign * 0.5;\r\n if( horzSpan) posB.y += lengthSign * 0.5;\r\n/*--------------------------------------------------------------------------*/\r\n vec2 posN;\r\n posN = posB - offNP * FXAA_QUALITY_P0;\r\n vec2 posP;\r\n posP = posB + offNP * FXAA_QUALITY_P0;\r\n float subpixD = ((-2.0)*subpixC) + 3.0;\r\n float lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN));\r\n float subpixE = subpixC * subpixC;\r\n float lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP));\r\n/*--------------------------------------------------------------------------*/\r\n if(!pairN) lumaNN = lumaSS;\r\n float gradientScaled = gradient * 1.0/4.0;\r\n float lumaMM = lumaM - lumaNN * 0.5;\r\n float subpixF = subpixD * subpixE;\r\n bool lumaMLTZero = lumaMM < 0.0;\r\n/*---------------------looped edge-end search-------------------------------*/\r\n lumaEndN -= lumaNN * 0.5;\r\n lumaEndP -= lumaNN * 0.5;\r\n bool doneN = abs(lumaEndN) >= gradientScaled;\r\n bool doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P1;\r\n bool doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P1;\r\n/*--------------------------------------------------------------------------*/\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P2;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P2;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 3)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P3;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P3;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 4)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P4;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P4;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 5)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P5;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P5;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 6)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P6;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P6;\r\n/*--------------------------------------------------------------------------*/\r\n #if (FXAA_QUALITY_PS > 7)\r\n if(doneNP) {\r\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r\n doneN = abs(lumaEndN) >= gradientScaled;\r\n doneP = abs(lumaEndP) >= gradientScaled;\r\n if(!doneN) posN -= offNP * FXAA_QUALITY_P7;\r\n doneNP = (!doneN) || (!doneP);\r\n if(!doneP) posP += offNP * FXAA_QUALITY_P7;\r\n/*--------------------------------------------------------------------------*/\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n #endif\r\n }\r\n/*----------------calculate subpix offset due to edge ends-------------------*/\r\n float dstN = posM.x - posN.x;\r\n float dstP = posP.x - posM.x;\r\n if(!horzSpan) dstN = posM.y - posN.y;\r\n if(!horzSpan) dstP = posP.y - posM.y;\r\n/*--------------------------------------------------------------------------*/\r\n bool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\r\n float spanLength = (dstP + dstN);\r\n bool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\r\n float spanLengthRcp = 1.0 / spanLength;\r\n/*--------------------------------------------------------------------------*/\r\n bool directionN = dstN < dstP;\r\n float dst = min(dstN, dstP);\r\n bool goodSpan = directionN ? goodSpanN : goodSpanP;\r\n float subpixG = subpixF * subpixF;\r\n float pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\r\n float subpixH = subpixG * fxaaQualitySubpix;\r\n/*-----------------calc texture offest using subpix-------------------------*/\r\n float pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\r\n float pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\r\n\r\n float offset = pixelOffsetSubpix * lengthSign;\r\n #ifdef BG_TRANSPARENT\r\n // get original texel\r\n vec4 rgbaA = FxaaTexTopAlpha(srcTex, posM);\r\n // calc step to blended texel\r\n vec2 step = sign((!horzSpan) ? vec2 (offset, 0.0) : vec2 (0.0, offset));\r\n // get neighboring texel\r\n vec4 rgbaB = FxaaTexTopAlpha(srcTex, posM + step * srcTexelSize);\r\n // calc blend factor from offset\r\n float f = (!horzSpan) ? offset / srcTexelSize.x : offset / srcTexelSize.y;\r\n f = abs(f);\r\n // calc alpha (special formula to emulate blending with bg)\r\n gl_FragColor.a = 1.0 - mix(1.0 - rgbaA.a, 1.0 - rgbaB.a, f);\r\n // calc color (special formula to emulate blending with bg)\r\n gl_FragColor.rgb = mix(rgbaA.rgb * rgbaA.a, rgbaB.rgb * rgbaB.a, f) / gl_FragColor.a;\r\n #else\r\n if(!horzSpan) {\r\n posM.x += offset;\r\n } else {\r\n posM.y += offset;\r\n }\r\n gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r\n #endif\r\n return;\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/FXAAMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ - var self = this; - var visual = this._getComplexVisual(); - if (visual === null) { - this.logger.error('Unable to start animation - no molecule is loaded.'); - return; - } +class FXAAMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RawShaderMaterial { + constructor(params) { + super(params); - try { - this._frameInfo = new FrameInfo(visual.getComplex(), fileData, { - onLoadStatusChanged: function onLoadStatusChanged() { - self.dispatchEvent({ - type: 'mdPlayerStateChanged', - state: { - isPlaying: self._isAnimating, - isLoading: self._frameInfo ? self._frameInfo.isLoading : true - } - }); + // set default values + this.setValues.call(this, { + uniforms: { + srcTex: { + type: 't', + value: null + }, + srcTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(1.0 / 512.0, 1.0 / 512.0) + }, + bgColor: { + type: 'c', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(0xffffff) + } }, - onError: function onError(message) { - self._stopAnimation(); - - self.logger.error(message); - } + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: FXAA_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false }); - } catch (e) { - this.logger.error('Animation file does not fit to current complex!'); - return; + this.setValues(params); } - - this._continueAnimation(); -}; -/** - * Pause current animation. Now is broken. - * @private - * @deprecated until animation system refactoring. - */ - - -Miew.prototype._pauseAnimation = function () { - if (this._animInterval === null) { - return; + copy(source) { + super.copy(source); + this.depth = source.depth; } + setValues(values) { + if (typeof values === 'undefined') { + return; + } - this._isAnimating = false; - clearInterval(this._animInterval); - this._animInterval = null; - - if (this._frameInfo) { - this.dispatchEvent({ - type: 'mdPlayerStateChanged', - state: { - isPlaying: this._isAnimating, - isLoading: this._frameInfo.isLoading - } - }); + // set direct values + super.setValues(values); + const defines = {}; + if (this.bgTransparent) { + defines.BG_TRANSPARENT = 1; + } + // set dependent values + this.defines = defines; } -}; -/** - * Continue current animation after pausing. Now is broken. - * @private - * @deprecated until animation system refactoring. - */ +} +FXAAMaterial.prototype.bgTransparent = false; +/* harmony default export */ const shaders_FXAAMaterial = (FXAAMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/AO.frag +const AO_namespaceObject = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 32\r\nuniform vec3 samplesKernel[MAX_SAMPLES_COUNT];\r\nuniform sampler2D noiseTexture;\r\nuniform vec2 noiseTexelSize;\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D depthTexture;\r\nuniform sampler2D normalTexture;\r\nuniform vec2 srcTexelSize;\r\nuniform vec2 camNearFar;\r\nuniform mat4 projMatrix;\r\n\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\nuniform float kernelRadius;\r\nuniform float depthThreshold;\r\nuniform float factor;\r\n\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n // remap coordinates to prevent noise exture rescale\r\n vec2 vUvNoise = vUv / srcTexelSize * noiseTexelSize;\r\n vec4 normalData = texture2D(normalTexture, vUv);\r\n // return for background fragments (their normals are zero vectors)\r\n if (length(normalData.rgb) < EPSILON) {\r\n // 0.0 in alpha component means that it is background fragment\r\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\r\n return;\r\n }\r\n //[0, 1] -> [-1, 1]\r\n vec3 normal = (normalData.rgb * 2.0 - 1.0);\r\n // normalData.a store 1.0 if normal was build for frontfaced surface\r\n // and 0.0 in other case\r\n if (normalData.a < EPSILON) {\r\n normal *= -1.0;\r\n }\r\n // get random vector for sampling sphere rotation\r\n vec3 randN = texture2D(noiseTexture, vUvNoise).rgb * 2.0 - 1.0;\r\n randN = normalize(randN);\r\n // build TBN (randomly rotated around normal)\r\n vec3 tangent = normalize(randN - normal * dot(randN, normal));\r\n vec3 bitangent = cross(tangent, normal);\r\n mat3 TBN = mat3(tangent, bitangent, normal);\r\n // calc AO value\r\n float AO = 0.0;\r\n for (int i = 0 ; i < MAX_SAMPLES_COUNT ; i++) {\r\n // rotate sampling kernel around normal\r\n vec3 reflectedSample = TBN * samplesKernel[i];\r\n // get sample\r\n vec3 samplePos = viewPos + reflectedSample * kernelRadius;\r\n\r\n // project sample to screen to get sample's screen pos\r\n vec4 SampleScrPos = vec4(samplePos, 1.0);\r\n // eye -> clip\r\n SampleScrPos = projMatrix * SampleScrPos;\r\n // normalize\r\n SampleScrPos.xy /= SampleScrPos.w;\r\n //[-1, 1] -> [0, 1]\r\n SampleScrPos.xy = (SampleScrPos.xy + vec2(1.0)) * 0.5;\r\n\r\n // get view z for sample projected to the objct surface\r\n float sampleDepth = CalcViewZ(SampleScrPos.xy);\r\n // calc occlusion made by object surface at the sample\r\n AO += step(samplePos.z, sampleDepth);\r\n }\r\n // calc result AO-map color\r\n AO = 1.0 - max(0.0, AO / float(MAX_SAMPLES_COUNT) * factor);\r\n // write value to AO-map\r\n gl_FragColor = vec4(AO, AO, AO, 1.0);\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/AOMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ -Miew.prototype._continueAnimation = function () { - this._isAnimating = true; - var minFrameTime = 1000 / settings.now.maxfps; - minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime; - var self = this; - var pivot = self._gfx.pivot; - var visual = this._getComplexVisual(); - if (visual) { - visual.resetSelectionMask(); - visual.rebuildSelectionGeometry(); - this._msgAtomInfo.style.opacity = 0.0; - } +const AOMaterial_samplesKernel = [ +// hemisphere samples adopted to sphere +new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.295184, 0.077723, 0.068429), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.271976, -0.365221, 0.838363), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.547713, 0.467576, 0.488515), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.662808, -0.031733, 0.584758), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.025717, 0.218955, 0.657094), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.310153, -0.365223, 0.370701), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.101407, -0.006313, 0.747665), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.769138, 0.360399, 0.086847), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.271988, -0.275140, 0.905353), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.096740, -0.566901, 0.700151), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.562872, -0.735136, 0.094647), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.379877, 0.359278, 0.190061), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.519064, -0.023055, 0.405068), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.301036, 0.114696, 0.088885), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.282922, 0.598305, 0.487214), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.181859, 0.251670, 0.679702), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.191463, -0.635818, 0.512919), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.293655, 0.427423, 0.078921), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.267983, 0.680534, 0.132880), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.139611, 0.319637, 0.477439), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.352086, 0.311040, 0.653913), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.321032, 0.805279, 0.487345), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.073516, 0.820734, 0.414183), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.155324, 0.589983, 0.411460), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.335976, 0.170782, 0.527627), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.463460, -0.355658, 0.167689), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.222654, 0.596550, 0.769406), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.922138, -0.042070, 0.147555), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.727050, -0.329192, 0.369826), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.090731, 0.533820, 0.463767), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.323457, -0.876559, 0.238524), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(-0.663277, -0.372384, 0.342856)]; +class AOMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RawShaderMaterial { + constructor() { + super(); - this._animInterval = setInterval(function () { - self.dispatchEvent({ - type: 'mdPlayerStateChanged', - state: { - isPlaying: self._isAnimating, - isLoading: self._frameInfo.isLoading - } + // set default values + this.setValues.call(this, { + uniforms: { + noiseTexture: { + type: 't', + value: gfx_noiseTexture.noiseTexture + }, + noiseTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(1.0 / gfx_noiseTexture.noiseWidth, 1.0 / gfx_noiseTexture.noiseHeight) + }, + diffuseTexture: { + type: 't', + value: null + }, + normalTexture: { + type: 't', + value: null + }, + depthTexture: { + type: 't', + value: null + }, + srcTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(1.0 / 512.0, 1.0 / 512.0) + }, + camNearFar: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(1.0, 10.0) + }, + projMatrix: { + type: 'mat4', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4() + }, + aspectRatio: { + type: 'f', + value: 0.0 + }, + tanHalfFOV: { + type: 'f', + value: 0.0 + }, + samplesKernel: { + type: 'v3v', + value: AOMaterial_samplesKernel + }, + kernelRadius: { + type: 'f', + value: 1.0 + }, + depthThreshold: { + type: 'f', + value: 1.0 + }, + factor: { + type: 'f', + value: 1.0 + } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: AO_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false }); + } +} +/* harmony default export */ const shaders_AOMaterial = (AOMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/AOHorBlur.frag +const AOHorBlur_namespaceObject = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = res;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x + samplesOffsets[i] * srcTexelSize.x, y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb = res.rgb / weightSum;\r\n gl_FragColor = res;\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/AOHorBlurMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ - if (self._frameInfo.frameIsReady) { - pivot.updateToFrame(self._frameInfo); - - self._updateObjsToFrame(self._frameInfo); - - self._refreshTitle(" Frame ".concat(self._frameInfo._currFrame, " of ").concat(self._frameInfo._framesCount, " time interval - ").concat(self._frameInfo._timeStep)); - - try { - self._frameInfo.nextFrame(); - } catch (e) { - self.logger.error('Error during animation'); - - self._stopAnimation(); - - return; - } - self._needRender = true; - } - }, minFrameTime); -}; -/** - * Stop current animation. Now is broken. - * @private - * @deprecated until animation system refactoring. - */ +const _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0]; +class AOHorBlurMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RawShaderMaterial { + constructor() { + super(); -Miew.prototype._stopAnimation = function () { - if (this._animInterval === null) { - return; + // set default values + this.setValues.call(this, { + uniforms: { + depthTexture: { + type: 't', + value: null + }, + srcTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(1.0 / 512.0, 1.0 / 512.0) + }, + aoMap: { + type: 't', + value: null + }, + samplesOffsets: { + type: 'fv1', + value: _kernelOffsets + } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: AOHorBlur_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false + }); } +} +/* harmony default export */ const shaders_AOHorBlurMaterial = (AOHorBlurMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/AOVertBlurWithBlend.frag +const AOVertBlurWithBlend_namespaceObject = "precision highp float;\r\n#define EPSILON 0.0000001\r\n\r\n#define MAX_SAMPLES_COUNT 5\r\nuniform float samplesOffsets[MAX_SAMPLES_COUNT];\r\nuniform sampler2D diffuseTexture;\r\nuniform sampler2D aoMap;\r\nuniform sampler2D depthTexture;\r\nuniform vec2 srcTexelSize;\r\n\r\nuniform mat4 projMatrix;\r\nuniform float aspectRatio;\r\nuniform float tanHalfFOV;\r\n\r\n#ifdef USE_FOG\r\n uniform vec2 fogNearFar;\r\n uniform vec4 fogColor;\r\n#endif\r\nvarying vec2 vUv;\r\n\r\nfloat CalcViewZ(vec2 screenPos)\r\n{\r\n float depth = texture2D(depthTexture, screenPos).x;\r\n // [0, 1]->[-1, 1]\r\n float clipedZ = 2.0 * depth - 1.0;\r\n // see THREE.js camera.makeFrustum for projection details\r\n return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r\n}\r\n\r\nvec3 ViewPosFromDepth(vec2 screenPos)\r\n{\r\n vec3 viewPos;\r\n viewPos.z = CalcViewZ(screenPos);\r\n //[0, 1]->[-1, 1]\r\n vec2 projPos = 2.0 * screenPos - 1.0;\r\n // reconstruct viewposition in right-handed sc with z to viewer\r\n viewPos.xy = vec2(\r\n projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r\n projPos.y * tanHalfFOV * abs(viewPos.z)\r\n );\r\n return viewPos;\r\n}\r\n\r\nvoid main() {\r\n vec3 viewPos = ViewPosFromDepth(vUv);\r\n float x = vUv.x;\r\n float y = vUv.y;\r\n vec4 color = texture2D(diffuseTexture, vec2(x, y));\r\n vec4 res = vec4(0.0);\r\n res.a = texture2D(aoMap, vec2(x, y )).a;\r\n // return for background fragments (0.0 in alpha component means that it is background fragment)\r\n if (res.a < EPSILON) {\r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r\n float weightSum = 0.0;\r\n for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r\n if (texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).a < EPSILON) {\r\n continue;\r\n }\r\n vec2 samplePos = vec2(x, y + samplesOffsets[i] * srcTexelSize.y);\r\n float depth = texture2D(depthTexture, samplePos).x;\r\n float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r\n res.rgb += texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).rgb * weight;\r\n weightSum += weight;\r\n }\r\n res.rgb /= weightSum;\r\n\r\n #if defined(USE_FOG) && !defined(FOG_TRANSPARENT)\r\n // Add fog to the result value\r\n // Proper way to get an image with fog and ao requires formula:\r\n // gl_FragColor = fragColor*AO*(1-fogFactor) + fogColor*fogFactor\r\n // But we have already fogged molecule to add AO too. Let's split the straight formula into our real steps!\r\n // We have: AO, fogFactor, fogColor,\r\n // color = fragColor*(1-fogFactor) + fogColor*fogFactor (it comes from diffuseTexture,\r\n // where molecule has been already drawn with fog)\r\n // Transform:\r\n // fragColor*AO*(1-fogFactor) + fogColor*fogFactor =\r\n // = [fragColor*(1-fogFactor) = color - fogColor*fogFactor] =\r\n // = (color - fogColor*fogFactor)*AO + fogColor*fogFactor =\r\n // = color*AO + fogColor*fogFactor*(1 - AO)\r\n // Result: gl_FragColor = color*AO + fogColor*fogFactor*(1 - AO)\r\n float fogFactor = smoothstep(fogNearFar.x, fogNearFar.y, - viewPos.z) * fogColor.a;\r\n gl_FragColor.rgb = color.rgb * res.rgb + fogColor.rgb * fogFactor *(vec3(1.0, 1.0, 1.0) - res.rgb);\r\n #else\r\n gl_FragColor.rgb = color.rgb * res.rgb;\r\n #endif\r\n gl_FragColor.a = color.a;\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/AOVertBlurWithBlendMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ - clearInterval(this._animInterval); - this._frameInfo.disableEvents(); - this._frameInfo = null; - this._animInterval = null; - this.dispatchEvent({ - type: 'mdPlayerStateChanged', - state: null - }); -}; -/** - * Invoked upon successful loading of some data source - * @param {DataSource} dataSource - Data source for visualization (molecular complex or other) - * @param {object} opts - Options. - * @private - */ +const AOVertBlurWithBlendMaterial_kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0]; +class AOVertBlurWithBlendMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RawShaderMaterial { + constructor(params) { + super(params); + // set default values + this.setValues.call(this, { + uniforms: { + diffuseTexture: { + type: 't', + value: null + }, + depthTexture: { + type: 't', + value: null + }, + srcTexelSize: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(1.0 / 512.0, 1.0 / 512.0) + }, + aoMap: { + type: 't', + value: null + }, + samplesOffsets: { + type: 'fv1', + value: AOVertBlurWithBlendMaterial_kernelOffsets + }, + projMatrix: { + type: 'mat4', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4() + }, + aspectRatio: { + type: 'f', + value: 0.0 + }, + tanHalfFOV: { + type: 'f', + value: 0.0 + }, + fogNearFar: { + type: 'v2', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(100.0, 100.0) + }, + fogColor: { + type: 'v4', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector4(0.0, 0.5, 0.0, 1.0) + } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: AOVertBlurWithBlend_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false + }); + this.setValues(params); + } + setValues(values) { + if (typeof values === 'undefined') { + return; + } -Miew.prototype._onLoad = function (dataSource, opts) { - var gfx = this._gfx; - var visualName = null; + // set direct values + super.setValues(values); + const defines = {}; + if (this.useFog) { + defines.USE_FOG = 1; + } + if (this.fogTransparent) { + defines.FOG_TRANSPARENT = 1; + } + // set dependent values + this.defines = defines; + } +} +AOVertBlurWithBlendMaterial.prototype.useFog = true; +AOVertBlurWithBlendMaterial.prototype.fogTransparent = false; +/* harmony default export */ const shaders_AOVertBlurWithBlendMaterial = (AOVertBlurWithBlendMaterial); +;// CONCATENATED MODULE: ./src/gfx/shaders/Anaglyph.frag +const Anaglyph_namespaceObject = "precision highp float;\r\n\r\nuniform sampler2D srcL;\r\nuniform sampler2D srcR;\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n vec4 l = texture2D(srcL, vUv);\r\n vec4 r = texture2D(srcR, vUv);\r\n gl_FragColor = vec4(l.r, r.g, r.b, 1.0);\r\n}\r\n"; +;// CONCATENATED MODULE: ./src/gfx/shaders/AnaglyphMaterial.js +/* eslint-disable no-magic-numbers */ +/* eslint-disable guard-for-in */ - if (opts.animation) { - this._refreshTitle(); - this._startAnimation(dataSource); - return null; +class AnaglyphMaterial extends external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RawShaderMaterial { + constructor() { + super(); + const settings = { + uniforms: { + srcL: { + type: 't', + value: null + }, + srcR: { + type: 't', + value: null + } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: Anaglyph_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false + }; + this.setValues(settings); } +} +/* harmony default export */ const shaders_AnaglyphMaterial = (AnaglyphMaterial); +;// CONCATENATED MODULE: ./src/gfx/ViewInterpolator.js - this._stopAnimation(); - if (!opts || !opts.keepRepsInfo) { - this._opts.reps = null; - this._opts._objects = null; +class View { + constructor() { + this.position = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0); + this.scale = 1; + this.orientation = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Quaternion(0, 0, 0, 1); } - - if (dataSource.id === 'Complex') { - var complex = dataSource; // update title - - if (opts.fileName) { - complex.name = complex.name || removeExtension(opts.fileName).toUpperCase(); - } else if (opts.amberFileName) { - complex.name = complex.name || removeExtension(opts.amberFileName).toUpperCase(); - } else { - complex.name = "Dynamic ".concat(opts.fileType, " molecule"); + set(position, scale, orientation) { + this.position = position; + this.scale = scale; + this.orientation = orientation; + } +} +const _transitionTime = 1.5; // in seconds + +class ViewInterpolator { + setup(startView, endView) { + this._startTime = undefined; + this._endTime = undefined; + this._isPaused = false; + this._srcView = startView; + this._dstView = endView; + this._isMoving = false; + } + isMoving() { + return this._isMoving; + } + wasStarted() { + return typeof this._startTime !== 'undefined' && typeof this._endTime !== 'undefined'; + } + start() { + this._startTime = Date.now(); + const transTime = settings.now.interpolateViews ? _transitionTime * 1000 : 0; + this._endTime = this._startTime + transTime; + this._isMoving = true; + } + getCurrentView() { + if (typeof this._srcView === 'undefined' || typeof this._dstView === 'undefined' || !this._isMoving || !this.wasStarted()) { + return { + success: false + }; } - - visualName = this._addVisual(new ComplexVisual(complex.name, complex)); - this._curVisualName = visualName; - var desc = this.info(); - this.logger.info("Parsed ".concat(opts.fileName, " (").concat(desc.atoms, " atoms, ").concat(desc.bonds, " bonds, ").concat(desc.residues, " residues, ").concat(desc.chains, " chains).")); - - if (_.isNumber(this._opts.unit)) { - complex.setCurrentUnit(this._opts.unit); + let view = this.createView(); + const time = Date.now(); + if (time > this._endTime) { + view = this._dstView; + this.reset(); + return { + success: true, + view + }; } - - if (opts.preset) ; else if (settings.now.autoPreset) { - switch (opts.fileType) { - case 'cml': - this.resetReps('small'); - break; - - case 'pdb': - case 'mmtf': - case 'cif': - if (hasValidResidues(complex)) { - this.resetReps('macro'); - } else { - this.resetReps('small'); - } - - break; - - default: - this.resetReps('default'); - break; - } - } else { - this.resetReps('default'); + const factor = (time - this._startTime) / (this._endTime - this._startTime); + view.position.copy(this._srcView.position); + view.position.lerp(this._dstView.position, factor); + view.scale = (1 - factor) * this._srcView.scale + factor * this._dstView.scale; + view.orientation.copy(this._srcView.orientation); + view.orientation.slerp(this._dstView.orientation, factor); + return { + success: true, + view + }; + } + reset() { + this._startTime = this._endTime = 0; + this._isMoving = false; + } + pause() { + if (!this._isPaused) { + this.setup(this.getCurrentView().view, this._dstView); + this._isPaused = true; } - } else if (dataSource.id === 'Volume') { - this.resetEd(); - visualName = this._onLoadEd(dataSource); } - - gfx.camera.updateProjectionMatrix(); - - this._updateFog(); // reset global transform - - - gfx.root.resetTransform(); - this.resetPivot(); // set scale to fit everything on the screen - - this._objectControls.setScale(settings.now.radiusToFit / this._getBSphereRadius()); - - this._resetObjects(); - - if (settings.now.autoResolution) { - this._tweakResolution(); + resume() { + this._isPaused = false; } - - if (settings.now.shadow.on) { - this._updateShadowCamera(); + createView() { + return new View(); } +} +;// CONCATENATED MODULE: ./src/utils/Cookies.js - if (this._opts.view) { - this.view(this._opts.view); - delete this._opts.view; + +const MAX_COOKIE_LEN = 4000; +const COUNT_SUFFIX = 'Cnt'; +function _chunkString(string, chunkLen) { + const l = string.length; + const chunks = []; + for (let c = 0, lc = 0; lc < l; c++, lc += chunkLen) { + chunks[c] = string.slice(lc, lc + chunkLen); } + return chunks; +} - this._refreshTitle(); +/** + * Create new context dependent Cookie holder object. + * @param context + * @param {Object} opts - options + * @param {string} opts.path - cookie path + * @constructor + */ +function Cookies(context, opts) { + this.context = context; + this._opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge({ + path: '/' + }, opts); +} +utils_makeContextDependent(Cookies.prototype); - return visualName; +/** + * Remove cookie by the name. + * @param key + */ +Cookies.prototype.removeCookie = function (key) { + const cntKey = this._toCount(key); + let cntVal = this._getSimpleCookie(cntKey); + if (!cntVal) { + this._removeSimpleCookie(key); + return; + } + this._removeSimpleCookie(cntKey); + cntVal = parseInt(cntVal, 10); + for (let i = 0; i < cntVal; ++i) { + this._removeSimpleCookie(key + i); + } }; -Miew.prototype.resetEd = function () { - if (this._edLoader) { - this._edLoader.abort(); - - this._edLoader = null; - } // free all resources - - - this._removeVisual(this._getVolumeVisual()); - - this._needRender = true; +/** + * Set new cookie value. Automatically splits + * values that are too large into multiple cookies. + * @param key + * @param value + */ +Cookies.prototype.setCookie = function (key, value) { + this.removeCookie(key); + value = encodeURIComponent(value); + const values = _chunkString(value, MAX_COOKIE_LEN - key.length - 1); + const cntVal = values.length; + if (cntVal === 1) { + this._setSimpleCookie(key, value); + return; + } + const cntKey = this._toCount(key); + this._setSimpleCookie(cntKey, cntVal.toString()); + for (let i = 0; i < cntVal; ++i) { + this._setSimpleCookie(key + i, values[i]); + } }; -Miew.prototype.loadEd = function (source) { - var _this4 = this; - - this.resetEd(); - - var TheLoader = _.head(io.loaders.find({ - source: source - })); - - if (!TheLoader) { - this.logger.error(LOADER_NOT_FOUND); - return Promise.reject(new Error(LOADER_NOT_FOUND)); +/** + * Obtain the value of a compound cookie. + * @param key + */ +Cookies.prototype.getCookie = function (key) { + const cntKey = this._toCount(key); + let cntVal = this._getSimpleCookie(cntKey); + if (!cntVal) { + return this._getSimpleCookie(key); } - - var loader = this._edLoader = new TheLoader(source, { - binary: true - }); - loader.context = this; - return loader.load().then(function (data) { - var TheParser = _.head(io.parsers.find({ - format: 'ccp4' - })); - - if (!TheParser) { - throw new Error(PARSER_NOT_FOUND); - } - - var parser = new TheParser(data); - parser.context = _this4; - return parser.parse().then(function (dataSource) { - _this4._onLoadEd(dataSource); - }); - })["catch"](function (error) { - _this4.logger.error('Could not load ED data'); - - _this4.logger.debug(error); - }); + cntVal = parseInt(cntVal, 10); + const value = []; + for (let i = 0; i < cntVal; ++i) { + value[i] = this._getSimpleCookie(key + i); + } + return value.join(''); }; - -Miew.prototype._onLoadEd = function (dataSource) { - dataSource.normalize(); - var volumeVisual = new VolumeVisual('volume', dataSource); - volumeVisual.getMesh().layers.set(gfxutils.LAYERS.VOLUME); // volume mesh is not visible to common render - - var visualName = this._addVisual(volumeVisual); - - this._needRender = true; - return visualName; +Cookies.prototype._toCount = function (key) { + return key + COUNT_SUFFIX; }; - -Miew.prototype._needRebuild = function () { - var needsRebuild = false; - - this._forEachComplexVisual(function (visual) { - needsRebuild = needsRebuild || visual.needsRebuild(); - }); - - return needsRebuild; +Cookies.prototype._removeSimpleCookie = function (key) { + document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`; }; - -Miew.prototype._rebuildObjects = function () { - var self = this; - var gfx = this._gfx; - var i; - var n; // remove old object geometry - - var toRemove = []; - - for (i = 0; i < gfx.pivot.children.length; ++i) { - var child = gfx.pivot.children[i]; - - if (!(child instanceof Visual)) { - toRemove.push(child); +Cookies.prototype._getExpirationDate = function () { + const today = new Date(); + const EXP_PERIOD_YEARS = 10; + today.setFullYear(today.getFullYear() + EXP_PERIOD_YEARS); + return today; +}; +Cookies.prototype._setSimpleCookie = function (key, value) { + document.cookie = `${key}=${value};expires=${this._getExpirationDate().toUTCString()};path=${this._opts.path}`; +}; +Cookies.prototype._getSimpleCookie = function (key) { + const matches = document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`)); + return matches ? decodeURIComponent(matches[1]) : ''; +}; +Cookies.prototype._exists = function (key) { + return document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`)); +}; +/* harmony default export */ const utils_Cookies = (Cookies); +;// CONCATENATED MODULE: ./src/gfx/vr/createWebVRButton.js +/* + * Toggling WebVR is done through button.click because of limitations on calling requestPresent in webVR: + * VRDisplay::requestPresent should be called from user gesture: + * https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestPresent + */ +/* harmony default export */ function createWebVRButton(webVRPoC) { + function showEnterVR(button) { + button.style.display = ''; + button.style.cursor = 'pointer'; + button.style.left = 'calc(50% - 50px)'; + button.style.width = '100px'; + button.textContent = 'ENTER VR'; + let currentSession = null; + function onSessionEnded( /* event */ + ) { + currentSession.removeEventListener('end', onSessionEnded); + button.textContent = 'ENTER VR'; + currentSession = null; } - } - - for (i = 0; i < toRemove.length; ++i) { - toRemove[i].parent.remove(toRemove[i]); - } - - setTimeout(function () { - var objList = self._objects; - - for (i = 0, n = objList.length; i < n; ++i) { - var obj = objList[i]; - - if (obj.needsRebuild) { - obj.build(); - } - - if (obj.getGeometry()) { - gfx.pivot.add(obj.getGeometry()); - } + function onSessionStarted(session) { + session.addEventListener('end', onSessionEnded); + webVRPoC._gfx.renderer.xr.setReferenceSpaceType('local'); + webVRPoC._gfx.renderer.xr.setSession(session); + button.textContent = 'EXIT VR'; + currentSession = session; } - }, 10); -}; - -Miew.prototype.changeUnit = function (unitIdx, name) { - var visual = this._getComplexVisual(name); + button.onmouseenter = function () { + button.style.opacity = '1.0'; + }; + button.onmouseleave = function () { + button.style.opacity = '0.5'; + }; + button.onclick = function () { + if (currentSession === null) { + // WebXR's requestReferenceSpace only works if the corresponding feature + // was requested at session creation time. For simplicity, just ask for + // the interesting ones as optional features, but be aware that the + // requestReferenceSpace call will fail if it turns out to be unavailable. + // ('local' is always available for immersive sessions and doesn't need to + // be requested separately.) - if (!visual) { - throw new Error('There is no complex to change!'); + const sessionInit = { + optionalFeatures: ['local-floor', 'bounded-floor'] + }; + navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted); + webVRPoC.moveSceneBehindHeadset(); + } else { + currentSession.end(); + } + }; } - - function currentUnitInfo() { - var unit = visual ? visual.getComplex().getCurrentUnit() : 0; - var type = unit > 0 ? "Bio molecule ".concat(unit) : 'Asymmetric unit'; - return "Current unit: ".concat(unit, " (").concat(type, ")"); + function showWebXRNotFound(button) { + button.style.display = ''; + button.style.cursor = 'auto'; + button.style.left = 'calc(50% - 75px)'; + button.style.width = '150px'; + button.textContent = 'VR NOT FOUND'; + button.onmouseenter = null; + button.onmouseleave = null; + button.onclick = null; } - - if (unitIdx === undefined) { - return currentUnitInfo(); + function stylizeElement(element) { + element.style.position = 'absolute'; + element.style.bottom = '20px'; + element.style.padding = '12px 6px'; + element.style.border = '1px solid #fff'; + element.style.borderRadius = '4px'; + element.style.background = 'transparent'; + element.style.color = '#fff'; + element.style.font = 'normal 13px sans-serif'; + element.style.textAlign = 'center'; + element.style.opacity = '0.5'; + element.style.outline = 'none'; + element.style.zIndex = '999'; } - - if (_.isString(unitIdx)) { - unitIdx = Math.max(parseInt(unitIdx, 10), 0); + if ('xr' in navigator) { + const button = document.createElement('button'); + button.style.display = 'none'; + stylizeElement(button); + navigator.xr.isSessionSupported('immersive-vr').then(supported => supported ? showEnterVR(button) : showWebXRNotFound(button)); + return button; } + const message = document.createElement('a'); + message.href = 'https://webvr.info'; + message.innerHTML = 'WEBXR NOT SUPPORTED'; + message.style.left = 'calc(50% - 90px)'; + message.style.width = '180px'; + message.style.textDecoration = 'none'; + stylizeElement(message); + return message; +} +;// CONCATENATED MODULE: ./src/gfx/vr/WebVRPoC.js - if (visual.getComplex().setCurrentUnit(unitIdx)) { - this._resetScene(); - this._updateInfoPanel(); - } - return currentUnitInfo(); -}; -/** - * Start to rebuild geometry asynchronously. - */ -Miew.prototype.rebuild = function () { - var _this5 = this; - if (this._building) { - this.logger.warn('Miew.rebuild(): already building!'); - return; +class WebVRPoC { + constructor(onToggle) { + this._mainCamera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PerspectiveCamera(); + this._button = null; + this._onToggle = onToggle; + this._molContainer = new gfxutils.RCGroup(); + this._user = new gfxutils.RCGroup(); + this._scalingPivot = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Object3D(); + this._user.add(this._scalingPivot); + this._controller1 = null; + this._controller2 = null; + this._pressedGripsCounter = 0; + this._distance = 0; + this._gfx = null; } - - this._building = true; - this.dispatchEvent({ - type: 'rebuilding' - }); - - this._rebuildObjects(); - - this._gfx.renderer2d.reset(); - - var rebuildActions = []; - - this._forEachComplexVisual(function (visual) { - if (visual.needsRebuild()) { - rebuildActions.push(visual.rebuild().then(function () { - return new Promise(function (resolve) { - visual.rebuildSelectionGeometry(); - resolve(); - }); - })); + startScalingByControllers() { + // reset scale + this._distance = this._controller1.position.distanceTo(this._controller2.position); + gfxutils.getMiddlePoint(this._controller1.position, this._controller2.position, this._scalingPivot.position); + this._scalingPivot.scale.set(1, 1, 1); + this._scalingPivot.updateMatrix(); + this._scalingPivot.updateMatrixWorld(); + // link molecule to pivot + this._scalingPivot.addSavingWorldTransform(this._molContainer); + } + stopScalingByControllers() { + this._gfx.scene.addSavingWorldTransform(this._molContainer); + } + handleGripsDown(event) { + this._pressedGripsCounter++; + if (this._pressedGripsCounter === 2) { + this.startScalingByControllers(); + } else if (this._pressedGripsCounter === 1) { + event.target.addSavingWorldTransform(this._molContainer); + } + } + handleGripsUp(event) { + this._pressedGripsCounter--; + if (this._pressedGripsCounter === 1) { + this.stopScalingByControllers(); + // reattach molecule to other controller + const anotherController = event.target === this._controller1 ? this._controller2 : this._controller1; + anotherController.addSavingWorldTransform(this._molContainer); + } else if (this._pressedGripsCounter === 0) { + this._gfx.scene.addSavingWorldTransform(this._molContainer); + } + } + enable(gfx) { + if (!gfx) { + logger.warn('WebVR couldn\'t be enabled, because gfx is not defined'); + return; + } + this._gfx = gfx; + const { + renderer, + camera + } = gfx; + if (!renderer) { + throw new Error('No renderer is available to toggle WebVR'); + } + if (!camera) { + throw new Error('No camera is available to toggle WebVR'); } - }); // Start asynchronous rebuild - - - var self = this; - - this._spinner.spin(this._container); - Promise.all(rebuildActions).then(function () { - self._spinner.stop(); + // enable xr in renderer + renderer.xr.enabled = true; + // add button for turning vr mode + if (!this._button) { + this._button = createWebVRButton(this); + document.body.appendChild(this._button); + } else { + this._button.style.display = 'block'; + } + // store fog setting + this._mainFog = settings.now.fog; + settings.set('fog', false); + this._plugVRNodesIntoScene(gfx, renderer); + this._setControllersListeners(); + + // make some Miew job + if (this._onToggle) { + this._onToggle(true); + } + } + _plugVRNodesIntoScene(gfx, renderer) { + // store common scene camera + this._mainCamera.copy(gfx.camera); + // add hierarchical structure for webVR into scene + gfx.scene.add(this._user); + // turn on webvr transformation + gfx.scene.add(this._molContainer); + this._molContainer.add(gfx.root); + this._controller1 = renderer.xr.getController(0); + this._controller2 = renderer.xr.getController(1); + const mesh = this._createControllerMesh(); + this._controller1.add(mesh); + this._controller2.add(mesh.clone()); + this._user.add(this._controller1); + this._user.add(this._controller2); + } + _setControllersListeners() { + this._controller1.addEventListener('selectstart', event => { + this.handleGripsDown(event); + }); + this._controller1.addEventListener('selectend', event => { + this.handleGripsUp(event); + }); + this._controller2.addEventListener('selectstart', event => { + this.handleGripsDown(event); + }); + this._controller2.addEventListener('selectend', event => { + this.handleGripsUp(event); + }); + this._controller1.addEventListener('squeezestart', event => { + this.handleGripsDown(event); + }); + this._controller1.addEventListener('squeezeend', event => { + this.handleGripsUp(event); + }); + this._controller2.addEventListener('squeezestart', event => { + this.handleGripsDown(event); + }); + this._controller2.addEventListener('squeezeend', event => { + this.handleGripsUp(event); + }); + } + disable() { + if (!this._gfx) { + return; + } + const { + renderer, + camera + } = this._gfx; + if (!renderer) { + throw new Error('No renderer is available to toggle WebVR'); + } + + // nullify webxr callback for animation frame + renderer.setAnimationLoop(null); + const session = renderer.xr.getSession(); + if (session) { + session.end(); + } + renderer.xr.enabled = false; + // remove button of VR entering + if (this._button) { + this._button.style.display = 'none'; + } + // restore fog param + settings.set('fog', this._mainFog); + this._unplugVRNodesFromScene(camera); + + // make some Miew job + if (this._onToggle) { + this._onToggle(false); + } + } + _unplugVRNodesFromScene(camera) { + // restore common camera + if (this._mainCamera && camera) { + camera.copy(this._mainCamera); + } + // turn off webvr transformation + const root = this._molContainer.children[0]; + if (root) { + this._gfx.scene.add(root); + } + this._molContainer.parent.remove(this._molContainer); + if (this._user) { + this._gfx.scene.remove(this._user); + } + // free scene nodes + this._molContainer = null; + this._user = null; + this._scalingPivot = null; + this._user = null; + this._controller1 = null; + this._controller2 = null; + } + _createControllerMesh() { + // visualize controllers with cylinders + const geometry = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.CylinderGeometry(0.04, 0.04, 0.3); + const material = new shaders_UberMaterial({ + lights: false, + overrideColor: true + }); + material.setUberOptions({ + fixedColor: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(0x4444ff) + }); + material.updateUniforms(); + const cylinder = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh(geometry, material); + cylinder.rotateX(-Math.PI / 2); + return cylinder; + } + updateMoleculeScale() { + if (!this._controller1 || !this._controller2) { + return; + } + const self = this; + // update molecule scaling by controllers + if (self._pressedGripsCounter === 2) { + // recalc scaling pivot + gfxutils.getMiddlePoint(self._controller1.position, self._controller2.position, self._scalingPivot.position); + // recalc scaler + const dist = self._controller1.position.distanceTo(self._controller2.position); + const scaler = dist / self._distance; + self._scalingPivot.scale.multiplyScalar(scaler); + // save cur distance for next frame + self._distance = dist; + } + } - self._needRender = true; + /** + * Reposition molecule right before the camera. + * @note The proper way is to initiate headset in the place of common Miew's camera. + * But threejs limitations on setting new XRReferenceSpace enforce the molecule repositioning + * Hope, something will change. + */ + moveSceneBehindHeadset() { + const gfx = this._gfx; + const { + camera + } = gfx; + + // set container position in camera space + const container = this._molContainer; + container.matrix.identity(); + container.position.set(0, 0, -4.0); + container.updateMatrix(); + + // update container world matrix + container.matrixWorld.multiplyMatrices(camera.matrixWorld, container.matrix); + // readd to scene + gfx.scene.addSavingWorldTransform(container); + if (this._onToggle) { + this._onToggle(true); + } + } + getCanvas() { + const gfx = this._gfx; + return gfx && gfx.renderer ? gfx.renderer.domElement : null; + } +} +;// CONCATENATED MODULE: ./src/gfx/shaders/ScreenQuadFromDistortionTex.frag +const ScreenQuadFromDistortionTex_namespaceObject = "precision highp float;\r\n\r\nvarying vec2 vUv;\r\nuniform sampler2D srcTex;\r\nuniform vec3 aberration;\r\n\r\nvoid main() {\r\n vec2 uv = vUv * 2.0 - 1.0;\r\n \r\n gl_FragColor.r = texture2D(srcTex, 0.5 * (uv * aberration[0] + 1.0)).r;\r\n gl_FragColor.g = texture2D(srcTex, 0.5 * (uv * aberration[1] + 1.0)).g;\r\n gl_FragColor.b = texture2D(srcTex, 0.5 * (uv * aberration[2] + 1.0)).b;\r\n gl_FragColor.a = 1.0;\r\n}"; +;// CONCATENATED MODULE: ./src/Miew.js +/* global PACKAGE_VERSION:false */ - self._refreshTitle(); - _this5.dispatchEvent({ - type: 'buildingDone' - }); - self._building = false; - }); -}; -/** Mark all representations for rebuilding */ -Miew.prototype.rebuildAll = function () { - this._forEachComplexVisual(function (visual) { - visual.setNeedsRebuild(); - }); -}; -Miew.prototype._refreshTitle = function (appendix) { - var title; - appendix = appendix === undefined ? '' : appendix; - var visual = this._getComplexVisual(); - if (visual) { - title = visual.getComplex().name; - var rep = visual.repGet(visual.repCurrent()); - title += rep ? " \u2013 ".concat(rep.mode.name, " Mode") : ''; - } else { - title = Object.keys(this._visuals).length > 0 ? 'Unknown' : 'No Data'; - } - title += appendix; - this.dispatchEvent({ - type: 'titleChanged', - data: title - }); -}; -Miew.prototype.setNeedRender = function () { - this._needRender = true; -}; -Miew.prototype._extractRepresentation = function () { - var _this6 = this; - var changed = []; - this._forEachComplexVisual(function (visual) { - if (visual.getSelectionCount() === 0) { - return; - } - var selector = visual.buildSelectorFromMask(1 << visual.getSelectionBit()); - var defPreset = settings.now.presets["default"]; - var res = visual.repAdd({ - selector: selector, - mode: defPreset[0].mode.id, - colorer: defPreset[0].colorer.id, - material: defPreset[0].material.id - }); - if (!res) { - if (visual.repCount() === ComplexVisual.NUM_REPRESENTATION_BITS) { - _this6.logger.warn("Number of representations is limited to ".concat(ComplexVisual.NUM_REPRESENTATION_BITS)); - } - return; - } - _this6.dispatchEvent({ - type: 'repAdded', - index: res.index, - name: visual.name - }); - visual.repCurrent(res.index); - changed.push(visual.name); - }); - if (changed.length > 0) { - this.logger.report("New representation from selection for complexes: ".concat(changed.join(', '))); - } -}; -/** - * Change current representation list. - * @param {array} reps - Representation list. - */ -Miew.prototype._setReps = function (reps) { - reps = reps || this._opts && this._opts.reps || []; - this._forEachComplexVisual(function (visual) { - return visual.resetReps(reps); - }); -}; -/** - * Apply existing preset to current scene. - * @param preset - */ -Miew.prototype.applyPreset = function (preset) { - var presets = settings.now.presets; - var presList = [preset || settings.defaults.preset, settings.defaults.preset, Object.keys(presets)[0]]; - var reps = null; - for (var i = 0; !reps && i < presList.length; ++i) { - settings.set('preset', presList[i]); - reps = presets[settings.now.preset]; - if (!reps) { - this.logger.warn("Unknown preset \"".concat(settings.now.preset, "\"")); - } - } - this._setReps(reps); -}; -/** - * Reset current representation list to initial values. - * @param {string} [preset] - The source preset in case of uninitialized representation list. - */ -Miew.prototype.resetReps = function (preset) { - var reps = this._opts && this._opts.reps; - if (reps) { - this._setReps(reps); - } else { - this.applyPreset(preset); - } -}; -/** - * Get number of representations created so far. - * @returns {number} Number of reps. - */ -Miew.prototype.repCount = function (name) { - var visual = this._getComplexVisual(name); - return visual ? visual.repCount() : 0; -}; -/** - * Get or set the current representation index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. - * @param {string=} [name] - Complex name. Defaults to the current one. - * @returns {number} The current index. - */ -Miew.prototype.repCurrent = function (index, name) { - var visual = this._getComplexVisual(name); - var newIdx = visual ? visual.repCurrent(index) : -1; - if (index && newIdx !== index) { - this.logger.warn("Representation ".concat(index, " was not found. Current rep remains unchanged.")); - } - return newIdx; -}; -/** - * Get or set representation by index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one. - * @param {object=} rep - Optional representation description. - * @param {string=} rep.selector - Selector string. - * @param {string=} rep.mode - Mode id. - * @param {string=} rep.colorer - Colorer id. - * @param {string=} rep.material - Material id. - * @returns {?object} Representation description. - */ -Miew.prototype.rep = function (index, rep) { - var visual = this._getComplexVisual(''); - if (!visual) { - return null; - } - var res = visual.rep(index, rep); - if (res.status === 'created') { - this.dispatchEvent({ - type: 'repAdded', - index: res.index, - name: visual.name - }); - } else if (res.status === 'changed') { - this.dispatchEvent({ - type: 'repChanged', - index: res.index, - name: visual.name + + +const { + selectors: Miew_selectors, + Atom: Miew_Atom, + Residue: Miew_Residue, + Chain: Miew_Chain, + Molecule: Miew_Molecule +} = chem; +const EDIT_MODE = { + COMPLEX: 0, + COMPONENT: 1, + FRAGMENT: 2 +}; +const LOADER_NOT_FOUND = 'Could not find suitable loader for this source'; +const PARSER_NOT_FOUND = 'Could not find suitable parser for this source'; + +// Color management changed a lot in threejs 152+ version. +// To keep miew colors we disable the new color management system +external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.ColorManagement.enabled = false; +const { + createElement: Miew_createElement +} = utils; +function updateFogRange(fog, center, radius) { + fog.near = center - radius * settings.now.fogNearFactor; + fog.far = center + radius * settings.now.fogFarFactor; +} +function removeExtension(fileName) { + const dot = fileName.lastIndexOf('.'); + if (dot >= 0) { + fileName = fileName.substr(0, dot); + } + return fileName; +} +function hasValidResidues(complex) { + let hasValidRes = false; + complex.forEachComponent(component => { + component.forEachResidue(residue => { + if (residue._isValid) { + hasValidRes = true; + } }); + }); + return hasValidRes; +} +function reportProgress(log, action, percent) { + const TOTAL_PERCENT = 100; + if (percent !== undefined) { + log.debug(`${action}... ${Math.floor(percent * TOTAL_PERCENT)}%`); + } else { + log.debug(`${action}...`); } +} +function chooseFogColor() { + return settings.now.fogColorEnable ? settings.now.fogColor : settings.now.bg.color; +} + +// //////////////////////////////////////////////////////////////////////////// - return res.desc; -}; /** - * Get representation (not just description) by index. - * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one. - * @returns {?object} Representation. + * Main 3D Molecular Viewer class. + * + * @param {object} opts - Viewer options. + * @param {HTMLElement=} opts.container - DOM element that serves as a viewer container. + * @param {object=} opts.settings - An object with properties to override default settings. + * @param {string=} opts.settingsCookie='settings' - The name of the cookie to save current settings to. + * @param {string=} opts.cookiePath='/' - The path option for cookies. Defaults to root. + * + * @exports Miew + * @constructor */ +function Miew(opts) { + utils_EventDispatcher.call(this); + this._opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge({ + settingsCookie: 'settings', + cookiePath: '/' + }, opts); + /** @type {?object} */ + this._gfx = null; + /** @type {ViewInterpolator} */ + this._interpolator = new ViewInterpolator(); + /** @type {HTMLElement} */ + this._container = opts && opts.container || document.getElementById('miew-container') || external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].head(document.getElementsByClassName('miew-container')) || document.body; + /** @type {HTMLElement} */ + this._containerRoot = this._container; + /** @type {boolean} */ + this._running = false; + /** @type {boolean} */ + this._halting = false; + /** @type {boolean} */ + this._building = false; + /** @type {boolean} */ + this._needRender = true; + /** @type {boolean} */ + this._hotKeysEnabled = true; -Miew.prototype.repGet = function (index, name) { - var visual = this._getComplexVisual(name); + /** @type {Settings} */ + this.settings = settings; + const log = logger; + log.console = false; + log.level = false ? 0 : 'info'; + /** + * @type {Logger} + * @example + * miew.logger.addEventListener('message', function _onLogMessage(evt) { + * console.log(evt.message); + * }); + */ + this.logger = log; + this._cookies = new utils_Cookies(this); + this.restoreSettings(); + if (opts && opts.settings) { + this.settings.set(opts.settings); + } - return visual ? visual.repGet(index) : null; + /** @type {?Spinner} */ + this._spinner = null; + /** @type {JobHandle[]} */ + this._loading = []; + /** @type {?number} + * @deprecated until Animation system refactoring + */ + this._animInterval = null; + + /** @type {object} */ + this._visuals = {}; + /** @type {?string} */ + this._curVisualName = null; + + /** @type {array} */ + this._objects = []; + + /** @type {object} */ + this._sourceWindow = null; + this.reset(); + if (this._repr) { + log.debug(`Selected ${this._repr.mode.name} mode with ${this._repr.colorer.name} colorer.`); + } + const self = this; + Miew.registeredPlugins.forEach(plugin => { + plugin.call(self); + }); + this._initOnSettingsChanged(); +} +Miew.prototype = Object.create(utils_EventDispatcher.prototype); +Miew.prototype.constructor = Miew; +Miew.prototype.getMaxRepresentationCount = function () { + return src_ComplexVisual.NUM_REPRESENTATION_BITS; }; + /** - * Add new representation. - * @param {object=} rep - Representation description. - * @returns {number} Index of the new representation. + * Replace viewer container contents with a DOM element. + * @param {HTMLElement} container - parent container. + * @param {HTMLElement} element - DOM element to show. + * @private */ +function _setContainerContents(container, element) { + const parent = container; + while (parent.firstChild) { + parent.removeChild(parent.firstChild); + } + parent.appendChild(element); +} +/** + * Update Shadow Camera target position and frustum. + * @private + */ +Miew.prototype._updateShadowCamera = function () { + const shadowMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + const direction = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const OBB = { + center: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(), + halfSize: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3() + }; + return function () { + this._gfx.scene.updateMatrixWorld(); + for (let i = 0; i < this._gfx.scene.children.length; i++) { + if (this._gfx.scene.children[i].type === 'DirectionalLight') { + const light = this._gfx.scene.children[i]; + shadowMatrix.copy(light.shadow.camera.matrixWorldInverse); + this.getOBB(shadowMatrix, OBB); + direction.subVectors(light.target.position, light.position); + light.position.subVectors(OBB.center, direction); + light.target.position.copy(OBB.center); + light.shadow.bias = 0.09; + light.shadow.camera.bottom = -OBB.halfSize.y; + light.shadow.camera.top = OBB.halfSize.y; + light.shadow.camera.right = OBB.halfSize.x; + light.shadow.camera.left = -OBB.halfSize.x; + light.shadow.camera.near = direction.length() - OBB.halfSize.z; + light.shadow.camera.far = direction.length() + OBB.halfSize.z; + light.shadow.camera.updateProjectionMatrix(); + } + } + }; +}(); -Miew.prototype.repAdd = function (rep, name) { - var visual = this._getComplexVisual(name); - - if (!visual) { - return -1; +/** + * Initialize the viewer. + * @returns {boolean} true on success. + * @throws Forwards exception raised during initialization. + * @see Miew#term + */ +Miew.prototype.init = function () { + const container = this._container; + const elem = utils.createElement('div', { + class: 'miew-canvas' + }); + _setContainerContents(container, elem); + this._container = elem; + const frag = document.createDocumentFragment(); + frag.appendChild(this._msgMode = Miew_createElement('div', { + class: 'mode-message overlay' + }, Miew_createElement('p', {}, 'COMPONENT EDIT MODE'))); + frag.appendChild(this._msgAtomInfo = Miew_createElement('div', { + class: 'atom-info overlay' + }, Miew_createElement('p', {}, ''))); + container.appendChild(frag); + if (this._gfx !== null) { + // block double init + return true; + } + const self = this; + this._showMessage('Viewer is being initialized...'); + try { + this._initGfx(); + this._initListeners(); + this._spinner = new Spinner({ + lines: 13, + length: 28, + width: 14, + radius: 42, + color: '#fff', + zIndex: 700 + }); + const target = getTopWindow(); + target.addEventListener('keydown', event => { + self._onKeyDown(event); + }); + target.addEventListener('keyup', event => { + self._onKeyUp(event); + }); + this._objectControls = new ui_ObjectControls(this._gfx.root, this._gfx.pivot, this._gfx.camera, this._gfx.renderer.domElement, () => self._getAltObj()); + this._objectControls.addEventListener('change', e => { + if (settings.now.shadow.on) { + self._updateShadowCamera(); + } + // route rotate, zoom, translate and translatePivot events to the external API + switch (e.action) { + case 'rotate': + self.dispatchEvent({ + type: 'rotate', + quaternion: e.quaternion + }); + break; + case 'zoom': + self.dispatchEvent({ + type: 'zoom', + factor: e.factor + }); + break; + default: + self.dispatchEvent({ + type: e.action + }); + } + self.dispatchEvent({ + type: 'transform' + }); + self._needRender = true; + }); + const gfx = this._gfx; + this._picker = new ui_Picker(gfx.root, gfx.camera, gfx.renderer.domElement); + this._picker.addEventListener('newpick', event => { + self._onPick(event); + }); + this._picker.addEventListener('dblclick', event => { + self.center(event); + }); + } catch (error) { + if (error.name === 'TypeError' && error.message === 'Cannot read property \'getExtension\' of null') { + this._showMessage('Could not create WebGL context.'); + } else if (error.message.search(/webgl/i) > 1) { + this._showMessage(error.message); + } else { + this._showMessage('Viewer initialization failed.'); + throw error; + } + return false; } - var res = visual.repAdd(rep); - - if (res) { - this.dispatchEvent({ - type: 'repAdded', - index: res.index, - name: name + // automatically load default file + const file = this._opts && this._opts.load; + if (file) { + const type = this._opts && this._opts.type; + this.load(file, { + fileType: type, + keepRepsInfo: true }); - return res.index; } - - return -1; + return true; }; + /** - * Remove representation. - * @param {number=} index - Zero-based representation index. + * Terminate the viewer completely. + * @see Miew#init */ - - -Miew.prototype.repRemove = function (index, name) { - var visual = this._getComplexVisual(name); - - if (!visual) { - return; - } - - visual.repRemove(index); - this.dispatchEvent({ - type: 'repRemoved', - index: index, - name: name +Miew.prototype.term = function () { + this._showMessage('Viewer has been terminated.'); + this._loading.forEach(job => { + job.cancel(); }); + this._loading.length = 0; + this.halt(); + this._gfx = null; }; + /** - * Hide representation. - * @param {number} index - Zero-based representation index. - * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default). + * Display message inside the viewer container, hiding WebGL canvas. + * @param {string} msg - Message to show. + * @private */ - - -Miew.prototype.repHide = function (index, hide, name) { - this._needRender = true; - - var visual = this._getComplexVisual(name); - - return visual ? visual.repHide(index, hide) : null; -}; - -Miew.prototype._setEditMode = function (mode) { - this._editMode = mode; - var elem = this._msgMode; - - if (elem) { - elem.style.opacity = mode === EDIT_MODE.COMPLEX ? 0.0 : 1.0; - - if (mode !== EDIT_MODE.COMPLEX) { - var t = elem.getElementsByTagName('p')[0]; - t.innerHTML = mode === EDIT_MODE.COMPONENT ? 'COMPONENT EDIT MODE' : 'FRAGMENT EDIT MODE'; - } - } - - this.dispatchEvent({ - type: 'editModeChanged', - data: mode === EDIT_MODE.COMPLEX - }); +Miew.prototype._showMessage = function (msg) { + const element = document.createElement('div'); + element.setAttribute('class', 'miew-message'); + element.appendChild(document.createElement('p')).appendChild(document.createTextNode(msg)); + _setContainerContents(this._container, element); }; -Miew.prototype._enterComponentEditMode = function () { - if (this._editMode !== EDIT_MODE.COMPLEX) { - return; - } - - var editors = []; - - this._forEachComplexVisual(function (visual) { - var editor = visual.beginComponentEdit(); - - if (editor) { - editors.push(editor); - } - }); - - if (editors === []) { - return; - } - - this._editors = editors; - this.logger.info('COMPONENT EDIT MODE -- ON'); - - this._setEditMode(EDIT_MODE.COMPONENT); - - this._objectControls.keysTranslateObj(true); +/** + * Display WebGL canvas inside the viewer container, hiding any message shown. + * @private + */ +Miew.prototype._showCanvas = function () { + _setContainerContents(this._container, this._gfx.renderer.domElement); }; - -Miew.prototype._applyComponentEdit = function () { - if (this._editMode !== EDIT_MODE.COMPONENT) { +Miew.prototype._requestAnimationFrame = function (callback) { + const { + xr + } = this._gfx.renderer; + if (xr && xr.enabled) { + this._gfx.renderer.setAnimationLoop(callback); return; } - - this._objectControls.stop(); - - this._objectControls.keysTranslateObj(false); - - for (var i = 0; i < this._editors.length; ++i) { - this._editors[i].apply(); - } - - this._editors = []; - this.logger.info('COMPONENT EDIT MODE -- OFF (applied)'); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this.rebuildAll(); + requestAnimationFrame(callback); }; +function arezSpritesSupported(context) { + return context.getExtension('EXT_frag_depth'); +} +function isAOSupported(context) { + return context.getExtension('WEBGL_depth_texture') && context.getExtension('WEBGL_draw_buffers'); +} -Miew.prototype._discardComponentEdit = function () { - if (this._editMode !== EDIT_MODE.COMPONENT) { - return; +/** + * Initialize WebGL and set 3D scene up. + * @private + */ +Miew.prototype._initGfx = function () { + const gfx = { + width: this._container.clientWidth, + height: this._container.clientHeight + }; + const webGLOptions = { + preserveDrawingBuffer: true, + alpha: true, + premultipliedAlpha: false + }; + if (settings.now.antialias) { + webGLOptions.antialias = true; } + gfx.renderer2d = new gfx_CSS2DRenderer(); + gfx.renderer = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGL1Renderer(webGLOptions); + gfx.renderer.shadowMap.enabled = settings.now.shadow.on; + gfx.renderer.shadowMap.autoUpdate = false; + gfx.renderer.shadowMap.type = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PCFShadowMap; + capabilities.init(gfx.renderer); - this._objectControls.stop(); - - this._objectControls.keysTranslateObj(false); - - for (var i = 0; i < this._editors.length; ++i) { - this._editors[i].discard(); + // z-sprites and ambient occlusion possibility + if (!arezSpritesSupported(gfx.renderer.getContext())) { + settings.set('zSprites', false); } - - this._editors = []; - this.logger.info('COMPONENT EDIT MODE -- OFF (discarded)'); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this._needRender = true; - this.rebuildAll(); -}; - -Miew.prototype._enterFragmentEditMode = function () { - if (this._editMode !== EDIT_MODE.COMPLEX) { - return; + if (!isAOSupported(gfx.renderer.getContext())) { + settings.set('ao', false); } - - var selectedVisuals = []; - - this._forEachComplexVisual(function (visual) { - if (visual instanceof ComplexVisual && visual.getSelectionCount() > 0) { - selectedVisuals.push(visual); - } + gfx.renderer.autoClear = false; + gfx.renderer.setPixelRatio(window.devicePixelRatio); + gfx.renderer.setSize(gfx.width, gfx.height); + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + gfx.renderer.clearColor(); + gfx.renderer2d.setSize(gfx.width, gfx.height); + gfx.camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.PerspectiveCamera(settings.now.camFov, gfx.width / gfx.height, settings.now.camNear, settings.now.camFar); + gfx.camera.setMinimalFov(settings.now.camFov); + gfx.camera.position.z = settings.now.camDistance; + gfx.camera.updateProjectionMatrix(); + gfx.camera.layers.set(gfxutils.LAYERS.DEFAULT); + gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME); + gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME_BFPLANE); + gfx.stereoCam = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.StereoCamera(); + gfx.scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Scene(); + const color = chooseFogColor(); + gfx.scene.fog = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Fog(color, settings.now.camNear, settings.now.camFar); + gfx.root = new gfxutils.RCGroup(); + gfx.scene.add(gfx.root); + gfx.pivot = new gfxutils.RCGroup(); + gfx.root.add(gfx.pivot); + gfx.selectionScene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Scene(); + gfx.selectionRoot = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group(); + gfx.selectionRoot.matrixAutoUpdate = false; + gfx.selectionScene.add(gfx.selectionRoot); + gfx.selectionPivot = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Group(); + gfx.selectionPivot.matrixAutoUpdate = false; + gfx.selectionRoot.add(gfx.selectionPivot); + const light12 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.DirectionalLight(0xffffff, 0.45); + light12.position.set(0, 0.414, 1); + light12.layers.enable(gfxutils.LAYERS.TRANSPARENT); + light12.castShadow = true; + light12.shadow.bias = 0.09; + light12.shadow.radius = settings.now.shadow.radius; + light12.shadow.camera.layers.set(gfxutils.LAYERS.SHADOWMAP); + const pixelRatio = gfx.renderer.getPixelRatio(); + const shadowMapSize = Math.max(gfx.width, gfx.height) * pixelRatio; + light12.shadow.mapSize.width = shadowMapSize; + light12.shadow.mapSize.height = shadowMapSize; + light12.target.position.set(0.0, 0.0, 0.0); + gfx.scene.add(light12); + gfx.scene.add(light12.target); + const light3 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.AmbientLight(0x666666); + light3.layers.enable(gfxutils.LAYERS.TRANSPARENT); + gfx.scene.add(light3); + + // add axes + gfx.axes = new gfx_Axes(gfx.root, gfx.camera); + const deviceWidth = gfx.width * pixelRatio; + const deviceHeight = gfx.height * pixelRatio; + gfx.offscreenBuf = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.NearestFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, + depthBuffer: true }); - - if (selectedVisuals.length !== 1) { - // either we have no selection or - // we have selected atoms in two or more visuals -- not supported - return; + if (gfx.renderer.getContext().getExtension('WEBGL_depth_texture')) { + gfx.offscreenBuf.depthTexture = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.DepthTexture(); + gfx.offscreenBuf.depthTexture.type = external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.UnsignedShortType; } + gfx.offscreenBuf2 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, + depthBuffer: false + }); + gfx.offscreenBuf3 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, + depthBuffer: false + }); + gfx.offscreenBuf4 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, + depthBuffer: false + }); + gfx.volBFTex = gfx.offscreenBuf3; + gfx.volFFTex = gfx.offscreenBuf4; + gfx.volWFFTex = gfx.offscreenBuf; - var editor = selectedVisuals[0].beginFragmentEdit(); - - if (!editor) { - return; + // use float textures for volume rendering if possible + if (gfx.renderer.getContext().getExtension('OES_texture_float')) { + gfx.offscreenBuf5 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, + type: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.FloatType, + depthBuffer: false + }); + gfx.offscreenBuf6 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, + type: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.FloatType, + depthBuffer: false + }); + gfx.offscreenBuf7 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, + type: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.FloatType, + depthBuffer: true + }); + gfx.volBFTex = gfx.offscreenBuf5; + gfx.volFFTex = gfx.offscreenBuf6; + gfx.volWFFTex = gfx.offscreenBuf7; + } else { + this.logger.warn('Device doesn\'t support OES_texture_float extension'); } + gfx.stereoBufL = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, + depthBuffer: false + }); + gfx.stereoBufR = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(deviceWidth, deviceHeight, { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LinearFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat, + depthBuffer: false + }); + this._gfx = gfx; + this._showCanvas(); + this._embedWebXR(settings.now.stereo === 'WEBVR'); + this._container.appendChild(gfx.renderer2d.getElement()); - this._editors = [editor]; - this.logger.info('FRAGMENT EDIT MODE -- ON (single bond)'); - - this._setEditMode(EDIT_MODE.FRAGMENT); - - this._objectControls.allowTranslation(false); - - this._objectControls.allowAltObjFreeRotation(editor.isFreeRotationAllowed()); + // add FPS counter + const stats = new gfx_Stats(); + stats.domElement.style.position = 'absolute'; + stats.domElement.style.right = '0'; + stats.domElement.style.bottom = '0'; + this._container.appendChild(stats.domElement); + this._fps = stats; + this._fps.show(settings.now.fps); +}; - this._needRender = true; +/** + * Setup event listeners. + * @private + */ +Miew.prototype._initListeners = function () { + const self = this; + window.addEventListener('resize', () => { + self._onResize(); + }); }; -Miew.prototype._applyFragmentEdit = function () { - if (this._editMode !== EDIT_MODE.FRAGMENT) { - return; +/** + * Try to add numbers to the base name to make it unique among visuals + * @private + */ +Miew.prototype._makeUniqueVisualName = function (baseName) { + if (!baseName) { + return Math.random().toString(); } - - this._objectControls.stop(); - - for (var i = 0; i < this._editors.length; ++i) { - this._editors[i].apply(); + let name = baseName; + let suffix = 1; + while (this._visuals.hasOwnProperty(name)) { + name = `${baseName} (${suffix.toString()})`; + suffix++; } + return name; +}; - this._editors = []; - this.logger.info('FRAGMENT EDIT MODE -- OFF (applied)'); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this._objectControls.allowTranslation(true); - - this._objectControls.allowAltObjFreeRotation(true); +/** + * Add visual to the viewer + * @private + */ +Miew.prototype._addVisual = function (visual) { + if (!visual) { + return null; + } - this.rebuildAll(); + // change visual name in order to make it unique + const name = this._makeUniqueVisualName(visual.name); + visual.name = name; + this._visuals[name] = visual; + this._gfx.pivot.add(visual); + if (visual.getSelectionGeo) { + this._gfx.selectionPivot.add(visual.getSelectionGeo()); + } + return name; }; -Miew.prototype._discardFragmentEdit = function () { - if (this._editMode !== EDIT_MODE.FRAGMENT) { +/** + * Remove visual from the viewer + * @private + */ +Miew.prototype._removeVisual = function (visual) { + let name = ''; + let obj = null; + if (visual instanceof src_Visual) { + ({ + name + } = visual); + obj = visual; + } else if (typeof visual === 'string') { + name = visual; + obj = this._visuals[name]; + } + if (!obj || !this._visuals.hasOwnProperty(name) || this._visuals[name] !== obj) { return; } - - this._objectControls.stop(); - - for (var i = 0; i < this._editors.length; ++i) { - this._editors[i].discard(); + if (name === this._curVisualName) { + this._curVisualName = undefined; } - - this._editors = []; - this.logger.info('FRAGMENT EDIT MODE -- OFF (discarded)'); - - this._setEditMode(EDIT_MODE.COMPLEX); - - this._objectControls.allowTranslation(true); - - this._objectControls.allowAltObjFreeRotation(true); + delete this._visuals[name]; + obj.release(); // removes nodes from scene this._needRender = true; }; -Miew.prototype._onPick = function (event) { - if (!settings.now.picking) { - // picking is disabled - return; +/** + * Call specified function for each Visual + * @private + */ +Miew.prototype._forEachVisual = function (callback) { + for (const name in this._visuals) { + if (this._visuals.hasOwnProperty(name)) { + callback(this._visuals[name]); + } } +}; - if (this._animInterval !== null) { - // animation playback is on +/** + * Release (destroy) all visuals in the scene + * @private + */ +Miew.prototype._releaseAllVisuals = function () { + if (!this._gfx || !this._gfx.pivot) { return; } - - if (this._editMode === EDIT_MODE.FRAGMENT) { - // prevent picking in fragment edit mode - return; + for (const name in this._visuals) { + if (this._visuals.hasOwnProperty(name)) { + this._visuals[name].release(); + } } + this._visuals = {}; +}; - if (this._objectControls.isEditingAltObj()) { - // prevent picking during component rotation +/** + * Call specified function for each ComplexVisual + * @private + */ +Miew.prototype._forEachComplexVisual = function (callback) { + if (!this._gfx || !this._gfx.pivot) { return; - } // update last pick & find complex - - - var complex = null; - - if (event.obj.atom) { - complex = event.obj.atom.residue.getChain().getComplex(); - this._lastPick = event.obj.atom; - } else if (event.obj.residue) { - complex = event.obj.residue.getChain().getComplex(); - this._lastPick = event.obj.residue; - } else if (event.obj.chain) { - complex = event.obj.chain.getComplex(); - this._lastPick = event.obj.chain; - } else if (event.obj.molecule) { - complex = event.obj.molecule.complex; - this._lastPick = event.obj.molecule; - } else { - this._lastPick = null; } - - function _updateSelection(visual) { - visual.updateSelectionMask(event.obj); - visual.rebuildSelectionGeometry(); - } // update visual - - - if (complex) { - var visual = this._getVisualForComplex(complex); - - if (visual) { - _updateSelection(visual); - - this._needRender = true; + for (const name in this._visuals) { + if (this._visuals.hasOwnProperty(name) && this._visuals[name] instanceof src_ComplexVisual) { + callback(this._visuals[name]); } - } else { - this._forEachComplexVisual(_updateSelection); - - this._needRender = true; } +}; - this._updateInfoPanel(); +/** + * Returns ComplexVisual with specified name, or current (if not found), or any, or null + * @private + */ +Miew.prototype._getComplexVisual = function (name) { + name = name || this._curVisualName; + let any = null; + let named = null; + this._forEachComplexVisual(visual => { + any = visual; + if (visual.name === name) { + named = visual; + } + }); + return named || any; +}; - this.dispatchEvent(event); +/** + * Returns first found VolumeVisual (no more than one should be present actually) + * @private + */ +Miew.prototype._getVolumeVisual = function () { + let any = null; + this._forEachVisual(visual => { + if (visual instanceof src_VolumeVisual) { + any = visual; + } + }); + return any; }; -Miew.prototype._onKeyDown = function (event) { - if (!this._running || !this._hotKeysEnabled) { - return; +/** + * Returns ComplexVisual corresponding to specified complex + * @private + */ +Miew.prototype._getVisualForComplex = function (complex) { + if (!complex) { + return null; } + let found = null; + this._forEachComplexVisual(visual => { + if (visual.getComplex() === complex) { + found = visual; + } + }); + return found; +}; - switch (event.keyCode) { - case 'C'.charCodeAt(0): - if (settings.now.editing) { - this._enterComponentEditMode(); - } - - break; - - case 'F'.charCodeAt(0): - if (settings.now.editing) { - this._enterFragmentEditMode(); - } - - break; - - case 'A'.charCodeAt(0): - switch (this._editMode) { - case EDIT_MODE.COMPONENT: - this._applyComponentEdit(); - - break; - - case EDIT_MODE.FRAGMENT: - this._applyFragmentEdit(); - - break; - } - - break; - - case 'D'.charCodeAt(0): - switch (this._editMode) { - case EDIT_MODE.COMPONENT: - this._discardComponentEdit(); - - break; - - case EDIT_MODE.FRAGMENT: - this._discardFragmentEdit(); - - break; - } - - break; - - case 'S'.charCodeAt(0): - event.preventDefault(); - event.stopPropagation(); - settings.set('ao', !settings.now.ao); - this._needRender = true; - break; - - case 107: - event.preventDefault(); - event.stopPropagation(); +/* + * Get a list of names of visuals currently shown by the viewer + */ +Miew.prototype.getVisuals = function () { + return Object.keys(this._visuals); +}; - this._forEachComplexVisual(function (visual) { - visual.expandSelection(); - visual.rebuildSelectionGeometry(); - }); +/* + * Get complex visuals count + */ +Miew.prototype.getComplexVisualsCount = function () { + let count = 0; + this._forEachComplexVisual(() => count++); + return count; +}; - this._updateInfoPanel(); +/* + * Get current visual + */ +Miew.prototype.getCurrentVisual = function () { + return this._curVisualName; +}; - this._needRender = true; - break; +/* + * Set current visual. + * All further operations will be performed on this visual (complex) if not stated otherwise. + */ +Miew.prototype.setCurrentVisual = function (name) { + if (!this._visuals[name]) { + return; + } + this._curVisualName = name; +}; - case 109: - event.preventDefault(); - event.stopPropagation(); +/** + * Run the viewer, start processing update/render frames periodically. + * Has no effect if already running. + * @see Miew#halt + */ +Miew.prototype.run = function () { + if (!this._running) { + this._running = true; + if (this._halting) { + this._halting = false; + return; + } + this._objectControls.enable(true); + this._interpolator.resume(); + this._requestAnimationFrame(() => this._onTick()); + } +}; - this._forEachComplexVisual(function (visual) { - visual.shrinkSelection(); - visual.rebuildSelectionGeometry(); - }); +/** + * Request the viewer to stop. + * Will be processed during the next frame. + * @see Miew#run + */ +Miew.prototype.halt = function () { + if (this._running) { + this._discardComponentEdit(); + this._discardFragmentEdit(); + this._objectControls.enable(false); + this._interpolator.pause(); + this._halting = true; + } +}; - this._updateInfoPanel(); +/** + * Request the viewer to start / stop responsing + * on hot keys. + * @param enabled - start (true) or stop (false) response on hot keys. + */ +Miew.prototype.enableHotKeys = function (enabled) { + this._hotKeysEnabled = enabled; + this._objectControls.enableHotkeys(enabled); +}; - this._needRender = true; - break; +/** + * Callback which processes window resize. + * @private + */ +Miew.prototype._onResize = function () { + const gfx = this._gfx; + if (!gfx) { + return; + } + this._needRender = true; + gfx.width = this._container.clientWidth; + gfx.height = this._container.clientHeight; + gfx.camera.aspect = gfx.width / gfx.height; + gfx.camera.setMinimalFov(settings.now.camFov); + gfx.camera.updateProjectionMatrix(); + gfx.renderer.setSize(gfx.width, gfx.height); + gfx.renderer2d.setSize(gfx.width, gfx.height); + this.dispatchEvent({ + type: 'resize' + }); +}; +Miew.prototype._resizeOffscreenBuffers = function (width, height, stereo) { + const gfx = this._gfx; + stereo = stereo || 'NONE'; + const isAnaglyph = stereo === 'NONE' || stereo === 'ANAGLYPH'; + const multi = isAnaglyph ? 1 : 0.5; + gfx.offscreenBuf.setSize(multi * width, height); + gfx.offscreenBuf2.setSize(multi * width, height); + gfx.offscreenBuf3.setSize(multi * width, height); + gfx.offscreenBuf4.setSize(multi * width, height); + if (gfx.offscreenBuf5) { + gfx.offscreenBuf5.setSize(multi * width, height); + } + if (gfx.offscreenBuf6) { + gfx.offscreenBuf6.setSize(multi * width, height); + } + if (gfx.offscreenBuf7) { + gfx.offscreenBuf7.setSize(multi * width, height); + } + if (isAnaglyph) { + gfx.stereoBufL.setSize(width, height); + gfx.stereoBufR.setSize(width, height); } }; -Miew.prototype._onKeyUp = function (event) { - if (!this._running || !this._hotKeysEnabled) { +/** + * Callback which processes update/render frames. + * @private + */ +Miew.prototype._onTick = function () { + if (this._halting) { + this._running = false; + this._halting = false; return; } - - if (event.keyCode === 'X'.charCodeAt(0)) { - this._extractRepresentation(); + this._fps.update(); + this._requestAnimationFrame(() => this._onTick()); + this._onUpdate(); + if (this._needRender) { + this._onRender(); + this._needRender = !settings.now.suspendRender || settings.now.stereo === 'WEBVR'; } }; +Miew.prototype._getBSphereRadius = function () { + // calculate radius that would include all visuals + let radius = 0; + this._forEachVisual(visual => { + radius = Math.max(radius, visual.getBoundaries().boundingSphere.radius); + }); + return radius * this._objectControls.getScale(); +}; -Miew.prototype._updateInfoPanel = function () { - var info = this._msgAtomInfo.getElementsByTagName('p')[0]; +/** + * Calculate bounding box that would include all visuals and being axis aligned in world defined by + * transformation matrix: matrix + * @param {Matrix4} matrix - transformation matrix. + * @param {object} OBB - calculating bounding box. + * @param {Vector3} OBB.center - OBB center. + * @param {Vector3} OBB.halfSize - half magnitude of OBB sizes. + */ +Miew.prototype.getOBB = function () { + const _bSphereForOneVisual = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Sphere(); + const _bBoxForOneVisual = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(); + const _bBox = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(); + const _invMatrix = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + const _points = [new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(), new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3()]; + return function (matrix, OBB) { + _bBox.makeEmpty(); + this._forEachVisual(visual => { + _bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere); + _bSphereForOneVisual.applyMatrix4(visual.matrixWorld).applyMatrix4(matrix); + _bSphereForOneVisual.getBoundingBox(_bBoxForOneVisual); + _bBox.union(_bBoxForOneVisual); + }); + _bBox.getCenter(OBB.center); + _invMatrix.copy(matrix).invert(); + OBB.center.applyMatrix4(_invMatrix); + const { + min + } = _bBox; + const { + max + } = _bBox; + _points[0].set(min.x, min.y, min.z); // 000 + _points[1].set(max.x, min.y, min.z); // 100 + _points[2].set(min.x, max.y, min.z); // 010 + _points[3].set(min.x, min.y, max.z); // 001 + for (let i = 0, l = _points.length; i < l; i++) { + _points[i].applyMatrix4(_invMatrix); + } + OBB.halfSize.set(Math.abs(_points[0].x - _points[1].x), Math.abs(_points[0].y - _points[2].y), Math.abs(_points[0].z - _points[3].z)).multiplyScalar(0.5); + }; +}(); +Miew.prototype._updateFog = function () { + const gfx = this._gfx; + if (settings.now.fog) { + if (typeof gfx.scene.fog === 'undefined' || gfx.scene.fog === null) { + const color = chooseFogColor(); + gfx.scene.fog = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Fog(color); + this._setUberMaterialValues({ + fog: settings.now.fog + }); + } + updateFogRange(gfx.scene.fog, gfx.camera.position.z, this._getBSphereRadius()); + } else if (gfx.scene.fog) { + gfx.scene.fog = undefined; + this._setUberMaterialValues({ + fog: settings.now.fog + }); + } +}; +Miew.prototype._onUpdate = function () { + if (this.isScriptingCommandAvailable !== undefined && this.isScriptingCommandAvailable() && !this._building) { + this.callNextCmd(); + } + this._objectControls.update(); + this._forEachComplexVisual(visual => { + visual.getComplex().update(); + }); + if (settings.now.autobuild && !this._loading.length && !this._building && this._needRebuild()) { + this.rebuild(); + } + if (!this._loading.length && !this._building && !this._needRebuild()) { + this._updateView(); + } + this._updateFog(); + if (this._gfx.renderer.xr.enabled) { + this.webVR.updateMoleculeScale(); + } +}; +Miew.prototype._onRender = function () { + const gfx = this._gfx; - var atom; - var residue; - var count = 0; + // update all matrices + gfx.scene.updateMatrixWorld(); + gfx.camera.updateMatrixWorld(); + this._clipPlaneUpdateValue(this._getBSphereRadius()); + this._fogFarUpdateValue(); + gfx.renderer.setRenderTarget(null); + gfx.renderer.clear(); + this._renderFrame(settings.now.stereo); +}; +Miew.prototype._renderFrame = function () { + const _anaglyphMat = new shaders_AnaglyphMaterial(); + const _size = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(); + return function (stereo) { + const gfx = this._gfx; + const { + renderer + } = gfx; + renderer.getSize(_size); + if (stereo !== 'NONE') { + gfx.camera.focus = gfx.camera.position.z; // set focus to the center of the object + gfx.stereoCam.aspect = 1.0; - this._forEachComplexVisual(function (visual) { - count += visual.getSelectionCount(); - }); + // in anaglyph mode we render full-size image for each eye + // while in other stereo modes only half-size (two images on the screen) + if (stereo === 'ANAGLYPH') { + gfx.stereoCam.update(gfx.camera); + } else { + gfx.stereoCam.updateHalfSized(gfx.camera, settings.now.camFov); + } + } - while (info.firstChild) { - info.removeChild(info.firstChild); + // resize offscreen buffers to match the target + const pixelRatio = gfx.renderer.getPixelRatio(); + this._resizeOffscreenBuffers(_size.width * pixelRatio, _size.height * pixelRatio, stereo); + this._renderShadowMap(); + switch (stereo) { + case 'WEBVR': + case 'NONE': + this._renderScene(gfx.camera, false); + break; + case 'SIMPLE': + case 'DISTORTED': + renderer.setScissorTest(true); + renderer.setScissor(0, 0, _size.width / 2, _size.height); + renderer.setViewport(0, 0, _size.width / 2, _size.height); + this._renderScene(this._gfx.stereoCam.cameraL, stereo === 'DISTORTED'); + renderer.setScissor(_size.width / 2, 0, _size.width / 2, _size.height); + renderer.setViewport(_size.width / 2, 0, _size.width / 2, _size.height); + this._renderScene(this._gfx.stereoCam.cameraR, stereo === 'DISTORTED'); + renderer.setScissorTest(false); + break; + case 'ANAGLYPH': + this._renderScene(this._gfx.stereoCam.cameraL, false, gfx.stereoBufL); + this._renderScene(this._gfx.stereoCam.cameraR, false, gfx.stereoBufR); + renderer.setRenderTarget(null); + _anaglyphMat.uniforms.srcL.value = gfx.stereoBufL.texture; + _anaglyphMat.uniforms.srcR.value = gfx.stereoBufR.texture; + gfx.renderer.renderScreenQuad(_anaglyphMat); + break; + default: + } + gfx.renderer2d.render(gfx.scene, gfx.camera); + if (settings.now.axes && gfx.axes && !gfx.renderer.xr.enabled) { + gfx.axes.render(renderer); + } + }; +}(); +Miew.prototype._onBgColorChanged = function () { + const gfx = this._gfx; + const color = chooseFogColor(); + if (gfx) { + if (gfx.scene.fog) { + gfx.scene.fog.color.set(color); + } + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); } - - if (count === 0) { - this._msgAtomInfo.style.opacity = 0.0; + this._needRender = true; +}; +Miew.prototype._onFogColorChanged = function () { + const gfx = this._gfx; + const color = chooseFogColor(); + if (gfx && gfx.scene.fog) { + gfx.scene.fog.color.set(color); + } + this._needRender = true; +}; +Miew.prototype._setUberMaterialValues = function (values) { + this._gfx.root.traverse(obj => { + if ((obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Mesh || obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.LineSegments || obj instanceof external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Line) && obj.material instanceof shaders_UberMaterial) { + obj.material.setValues(values); + obj.material.needsUpdate = true; + } + }); +}; +Miew.prototype._enableMRT = function (on, renderBuffer, textureBuffer) { + const gfx = this._gfx; + const gl = gfx.renderer.getContext(); + const ext = gl.getExtension('WEBGL_draw_buffers'); + const { + properties + } = gfx.renderer; + if (!on) { + ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, null]); return; } - var firstLine = "".concat(String(count), " atom").concat(count !== 1 ? 's' : '', " selected"); + // take extra texture from Texture Buffer + gfx.renderer.setRenderTarget(textureBuffer); + const tx8 = properties.get(textureBuffer.texture).__webglTexture; + gl.bindTexture(gl.TEXTURE_2D, tx8); - if (this._lastPick !== null) { - firstLine += ', the last pick:'; - } + // take texture and framebuffer from renderbuffer + gfx.renderer.setRenderTarget(renderBuffer); + const fb = properties.get(renderBuffer).__webglFramebuffer; + const tx = properties.get(renderBuffer.texture).__webglTexture; - var secondLine = ''; - var aName = ''; - var coordLine = ''; + // set framebuffer + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + fb.width = renderBuffer.width; + fb.height = renderBuffer.height; + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tx, 0); + gl.framebufferTexture2D(gl.FRAMEBUFFER, ext.COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, tx8, 0); - if (this._lastPick instanceof Atom$2) { - atom = this._lastPick; - residue = atom.residue; - aName = atom.name; - var location = atom.location !== 32 ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space + // mapping textures + ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, ext.COLOR_ATTACHMENT1_WEBGL]); +}; +Miew.prototype._renderScene = function () { + return function (camera, distortion, target) { + distortion = distortion || false; + target = target || null; + const gfx = this._gfx; - secondLine = "".concat(atom.element.fullName, " #").concat(atom.serial).concat(location, ": ").concat(residue._chain._name, ".").concat(residue._type._name).concat(residue._sequence).concat(residue._icode.trim(), "."); - secondLine += aName; - coordLine = "Coord: (".concat(atom.position.x.toFixed(2).toString(), ", ").concat(atom.position.y.toFixed(2).toString(), ", ").concat(atom.position.z.toFixed(2).toString(), ")"); - } else if (this._lastPick instanceof Residue$1) { - residue = this._lastPick; - secondLine = "".concat(residue._type._fullName, ": ").concat(residue._chain._name, ".").concat(residue._type._name).concat(residue._sequence).concat(residue._icode.trim()); - } else if (this._lastPick instanceof Chain$2) { - secondLine = "chain ".concat(this._lastPick._name); - } else if (this._lastPick instanceof Molecule$8) { - secondLine = "molecule ".concat(this._lastPick._name); - } + // render to offscreen buffer + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + gfx.renderer.setRenderTarget(target); + gfx.renderer.clear(); + if (gfx.renderer.xr.enabled) { + gfx.renderer.render(gfx.scene, camera); + return; + } - info.appendChild(document.createTextNode(firstLine)); + // clean buffer for normals texture + gfx.renderer.setClearColor(0x000000, 0.0); + gfx.renderer.setRenderTarget(gfx.offscreenBuf4); + gfx.renderer.clearColor(); + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + gfx.renderer.setRenderTarget(gfx.offscreenBuf); + gfx.renderer.clear(); + const bHaveComplexes = this._getComplexVisual() !== null; + const volumeVisual = this._getVolumeVisual(); + const ssao = bHaveComplexes && settings.now.ao; + if (ssao) { + this._enableMRT(true, gfx.offscreenBuf, gfx.offscreenBuf4); + } + if (settings.now.transparency === 'prepass') { + this._renderWithPrepassTransparency(camera, gfx.offscreenBuf); + } else if (settings.now.transparency === 'standard') { + gfx.renderer.setRenderTarget(gfx.offscreenBuf); + gfx.renderer.render(gfx.scene, camera); + } + if (ssao) { + this._enableMRT(false, null, null); + } - if (secondLine !== '') { - info.appendChild(document.createElement('br')); - info.appendChild(document.createTextNode(secondLine)); - } + // when fxaa we should get resulting image in temp off-screen buff2 for further postprocessing with fxaa filter + // otherwise we render to canvas + const outline = bHaveComplexes && settings.now.outline.on; + const fxaa = bHaveComplexes && settings.now.fxaa; + const volume = volumeVisual !== null && volumeVisual.getMesh().material != null; + let dstBuffer = ssao || outline || volume || fxaa || distortion ? gfx.offscreenBuf2 : target; + let srcBuffer = gfx.offscreenBuf; + if (ssao) { + this._performAO(srcBuffer, gfx.offscreenBuf4, gfx.offscreenBuf.depthTexture, dstBuffer, gfx.offscreenBuf3, gfx.offscreenBuf2); + if (!fxaa && !distortion && !volume && !outline) { + srcBuffer = dstBuffer; + dstBuffer = target; + gfx.renderer.setRenderTarget(dstBuffer); + gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0); + } + } else { + // just copy color buffer to dst buffer + gfx.renderer.setRenderTarget(dstBuffer); + gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0); + } - if (coordLine !== '') { - info.appendChild(document.createElement('br')); - info.appendChild(document.createTextNode(coordLine)); - } + // outline + if (outline) { + srcBuffer = dstBuffer; + dstBuffer = volume || fxaa || distortion ? gfx.offscreenBuf3 : target; + if (srcBuffer != null) { + this._renderOutline(camera, gfx.offscreenBuf, srcBuffer, dstBuffer); + } + } - this._msgAtomInfo.style.opacity = 1.0; -}; + // render selected part with outline material + this._renderSelection(camera, gfx.offscreenBuf, dstBuffer); + if (volume) { + // copy current picture to the buffer that retains depth-data of the original molecule render + // so that volume renderer could use depth-test + gfx.renderer.setRenderTarget(gfx.offscreenBuf); + gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0); + dstBuffer = gfx.offscreenBuf; + this._renderVolume(volumeVisual, camera, dstBuffer, gfx.volBFTex, gfx.volFFTex, gfx.volWFFTex); -Miew.prototype._getAltObj = function () { - if (this._editors) { - var altObj = null; + // if this is the last stage -- copy image to target + if (!fxaa && !distortion) { + gfx.renderer.setRenderTarget(target); + gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0); + } + } + srcBuffer = dstBuffer; + if (fxaa) { + dstBuffer = distortion ? gfx.offscreenBuf4 : target; + this._performFXAA(srcBuffer, dstBuffer); + srcBuffer = dstBuffer; + } + if (distortion) { + dstBuffer = target; + this._performDistortion(srcBuffer, dstBuffer, true); + } + }; +}(); +Miew.prototype._performDistortion = function () { + const _scene = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Scene(); + const _camera = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, -500, 1000); + const _material = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RawShaderMaterial({ + uniforms: { + srcTex: { + type: 't', + value: null + }, + aberration: { + type: 'fv3', + value: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(1.0) + } + }, + vertexShader: ScreenQuad_namespaceObject, + fragmentShader: ScreenQuadFromDistortionTex_namespaceObject, + transparent: false, + depthTest: false, + depthWrite: false + }); + const _geo = gfxutils.buildDistorionMesh(10, 10, settings.now.debug.stereoBarrel); + _scene.add(new meshes.Mesh(_geo, _material)); + return function (srcBuffer, targetBuffer, mesh) { + this._gfx.renderer.setRenderTarget(targetBuffer); + this._gfx.renderer.clear(); + if (mesh) { + _material.uniforms.srcTex.value = srcBuffer.texture; + _material.uniforms.aberration.value.set(0.995, 1.0, 1.01); + this._gfx.renderer.render(_scene, _camera); + } else { + this._gfx.renderer.renderScreenQuadFromTexWithDistortion(srcBuffer, settings.now.debug.stereoBarrel); + } + }; +}(); +Miew.prototype._renderOutline = function () { + const _outlineMaterial = new shaders_OutlineMaterial({ + depth: true + }); + return function (camera, srcDepthBuffer, srcColorBuffer, targetBuffer) { + const self = this; + const gfx = self._gfx; - for (var i = 0; i < this._editors.length; ++i) { - var nextAltObj = this._editors[i].getAltObj(); + // apply Sobel filter -- draw outline + _outlineMaterial.uniforms.srcTex.value = srcColorBuffer.texture; + _outlineMaterial.uniforms.srcDepthTex.value = srcDepthBuffer.depthTexture; + _outlineMaterial.uniforms.srcTexSize.value.set(srcDepthBuffer.width, srcDepthBuffer.height); + _outlineMaterial.uniforms.color.value = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Color(settings.now.outline.color); + _outlineMaterial.uniforms.threshold.value = settings.now.outline.threshold; + _outlineMaterial.uniforms.thickness.value = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector2(settings.now.outline.thickness, settings.now.outline.thickness); + gfx.renderer.setRenderTarget(targetBuffer); + gfx.renderer.renderScreenQuad(_outlineMaterial); + }; +}(); +Miew.prototype._renderShadowMap = function () { + const pars = { + minFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.NearestFilter, + magFilter: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.NearestFilter, + format: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.RGBAFormat + }; + return function () { + if (!settings.now.shadow.on) { + return; + } + const gfx = this._gfx; + const currentRenderTarget = gfx.renderer.getRenderTarget(); + const activeCubeFace = gfx.renderer.getActiveCubeFace(); + const activeMipmapLevel = gfx.renderer.getActiveMipmapLevel(); + const _state = gfx.renderer.state; - if (nextAltObj.objects.length > 0) { - if (altObj) { - // we have selected atoms in two or more visuals -- not supported - altObj = null; - break; + // Set GL state for depth map. + _state.setBlending(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.NoBlending); + _state.buffers.color.setClear(1, 1, 1, 1); + _state.buffers.depth.setTest(true); + _state.setScissorTest(false); + for (let i = 0; i < gfx.scene.children.length; i++) { + if (gfx.scene.children[i].type === 'DirectionalLight') { + const light = gfx.scene.children[i]; + if (light.shadow.map == null) { + light.shadow.map = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.WebGLRenderTarget(light.shadow.mapSize.width, light.shadow.mapSize.height, pars); + light.shadow.camera.updateProjectionMatrix(); } - - altObj = nextAltObj; + light.shadow.updateMatrices(light); + gfx.renderer.setRenderTarget(light.shadow.map); + gfx.renderer.clear(); + gfx.renderer.render(gfx.scene, light.shadow.camera); } } + gfx.renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel); + }; +}(); - if (altObj) { - return altObj; +/** + * Check if there is selection which must be rendered or not. + * @private + * @returns {boolean} true on existing selection to render + */ +Miew.prototype._hasSelectionToRender = function () { + const selPivot = this._gfx.selectionPivot; + for (let i = 0; i < selPivot.children.length; i++) { + const selPivotChild = selPivot.children[i]; + if (selPivotChild.children.length > 0) { + return true; } } - - return { - objects: [], - pivot: new Vector3(0, 0, 0) - }; + return false; }; +Miew.prototype._renderSelection = function () { + const _outlineMaterial = new shaders_OutlineMaterial(); + return function (camera, srcBuffer, targetBuffer) { + const self = this; + const gfx = self._gfx; -Miew.prototype.resetPivot = function () { - var boundingBox = new Box3(); - var center = new Vector3(); - return function () { - boundingBox.makeEmpty(); - - this._forEachVisual(function (visual) { - boundingBox.union(visual.getBoundaries().boundingBox); - }); + // clear offscreen buffer (leave z-buffer intact) + gfx.renderer.setClearColor('black', 0); - boundingBox.getCenter(center); + // render selection to offscreen buffer + gfx.renderer.setRenderTarget(srcBuffer); + gfx.renderer.clear(true, false, false); + if (self._hasSelectionToRender()) { + gfx.selectionRoot.matrix = gfx.root.matrix; + gfx.selectionPivot.matrix = gfx.pivot.matrix; + gfx.renderer.render(gfx.selectionScene, camera); + } else { + // just render something to force "target clear" operation to finish + gfx.renderer.renderDummyQuad(); + } - this._objectControls.setPivot(center.negate()); + // overlay to screen + gfx.renderer.setRenderTarget(targetBuffer); + gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 0.6); - this.dispatchEvent({ - type: 'transform' - }); + // apply Sobel filter -- draw outline + _outlineMaterial.uniforms.srcTex.value = srcBuffer.texture; + _outlineMaterial.uniforms.srcTexSize.value.set(srcBuffer.width, srcBuffer.height); + gfx.renderer.renderScreenQuad(_outlineMaterial); }; }(); - -Miew.prototype.setPivotResidue = function () { - var center = new Vector3(); - return function (residue) { - var visual = this._getVisualForComplex(residue.getChain().getComplex()); - - if (!visual) { - return; +Miew.prototype._checkVolumeRenderingSupport = function (renderTarget) { + if (!renderTarget) { + return false; + } + const gfx = this._gfx; + const oldRT = gfx.renderer.getRenderTarget(); + gfx.renderer.setRenderTarget(renderTarget); + const context = gfx.renderer.getContext(); + const result = context.checkFramebufferStatus(context.FRAMEBUFFER); + gfx.renderer.setRenderTarget(oldRT); + if (result !== context.FRAMEBUFFER_COMPLETE) { + // floatFrameBufferWarning = ; + this.logger.warn('Device doesn\'t support electron density rendering'); + return false; + } + return true; +}; +Miew.prototype._renderVolume = function () { + const volumeBFMat = new shaders_VolumeMaterial.BackFacePosMaterial(); + const volumeFFMat = new shaders_VolumeMaterial.FrontFacePosMaterial(); + const cubeOffsetMat = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4().makeTranslation(0.5, 0.5, 0.5); + const world2colorMat = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + let volumeRenderingSupported; + return function (volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) { + const gfx = this._gfx; + if (typeof volumeRenderingSupported === 'undefined') { + volumeRenderingSupported = this._checkVolumeRenderingSupport(tmpBuf1); } - - if (residue._controlPoint) { - center.copy(residue._controlPoint); - } else { - var x = 0; - var y = 0; - var z = 0; - var amount = residue._atoms.length; - - for (var i = 0; i < amount; ++i) { - var p = residue._atoms[i].position; - x += p.x / amount; - y += p.y / amount; - z += p.z / amount; - } - - center.set(x, y, z); + if (!volumeRenderingSupported) { + return; } + const mesh = volumeVisual.getMesh(); + mesh.rebuild(gfx.camera); - center.applyMatrix4(visual.matrix).negate(); + // use main camera to prepare special textures to be used by volumetric rendering + // these textures have the size of the window and are stored in offscreen buffers + gfx.renderer.setClearColor('black', 0); + gfx.renderer.setRenderTarget(tmpBuf1); + gfx.renderer.clear(); + gfx.renderer.setRenderTarget(tmpBuf2); + gfx.renderer.clear(); + gfx.renderer.setRenderTarget(tmpBuf3); + gfx.renderer.clear(); + gfx.renderer.setRenderTarget(tmpBuf1); + // draw plane with its own material, because it differs slightly from volumeBFMat + camera.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE); + gfx.renderer.render(gfx.scene, camera); + camera.layers.set(gfxutils.LAYERS.VOLUME); + gfx.scene.overrideMaterial = volumeBFMat; + gfx.renderer.render(gfx.scene, camera); + gfx.renderer.setRenderTarget(tmpBuf2); + camera.layers.set(gfxutils.LAYERS.VOLUME); + gfx.scene.overrideMaterial = volumeFFMat; + gfx.renderer.render(gfx.scene, camera); + gfx.scene.overrideMaterial = null; + camera.layers.set(gfxutils.LAYERS.DEFAULT); - this._objectControls.setPivot(center); + // prepare texture that contains molecule positions + world2colorMat.copy(mesh.matrixWorld).invert(); + shaders_UberMaterial.prototype.uberOptions.world2colorMatrix.multiplyMatrices(cubeOffsetMat, world2colorMat); + camera.layers.set(gfxutils.LAYERS.COLOR_FROM_POSITION); + gfx.renderer.setRenderTarget(tmpBuf3); + gfx.renderer.render(gfx.scene, camera); - this.dispatchEvent({ - type: 'transform' - }); + // render volume + const vm = mesh.material; + vm.uniforms._BFRight.value = tmpBuf1.texture; + vm.uniforms._FFRight.value = tmpBuf2.texture; + vm.uniforms._WFFRight.value = tmpBuf3.texture; + camera.layers.set(gfxutils.LAYERS.VOLUME); + gfx.renderer.setRenderTarget(dstBuf); + gfx.renderer.render(gfx.scene, camera); + camera.layers.set(gfxutils.LAYERS.DEFAULT); }; }(); -Miew.prototype.setPivotAtom = function () { - var center = new Vector3(); - return function (atom) { - var visual = this._getVisualForComplex(atom.residue.getChain().getComplex()); +/* Render scene with 'ZPrepass transparency Effect' + * Idea: transparent objects are rendered in two passes. The first one writes result only into depth buffer. + * The second pass reads depth buffer and writes only to color buffer. The method results in + * correct image of front part of the semi-transparent objects, but we can see only front transparent objects + * and opaque objects inside, there is no transparent objects inside. + * Notes: 1. Opaque objects should be rendered strictly before semi-transparent ones. + * 2. Realization doesn't use camera layers because scene traversing is used for material changes and + * we can use it to select needed meshes and don't complicate meshes builders with layers + */ +Miew.prototype._renderWithPrepassTransparency = function () { + return function (camera, targetBuffer) { + const gfx = this._gfx; + gfx.renderer.setRenderTarget(targetBuffer); - if (!visual) { - return; - } + // opaque objects + camera.layers.set(gfxutils.LAYERS.DEFAULT); + gfx.renderer.render(gfx.scene, camera); - center.copy(atom.position); - center.applyMatrix4(visual.matrix).negate(); + // transparent objects z prepass + camera.layers.set(gfxutils.LAYERS.PREPASS_TRANSPARENT); + gfx.renderer.getContext().colorMask(false, false, false, false); // don't update color buffer + gfx.renderer.render(gfx.scene, camera); + gfx.renderer.getContext().colorMask(true, true, true, true); // update color buffer - this._objectControls.setPivot(center); + // transparent objects color pass + camera.layers.set(gfxutils.LAYERS.TRANSPARENT); + gfx.renderer.render(gfx.scene, camera); - this.dispatchEvent({ - type: 'transform' - }); + // restore default layer + camera.layers.set(gfxutils.LAYERS.DEFAULT); }; }(); +Miew.prototype._performFXAA = function () { + const _fxaaMaterial = new shaders_FXAAMaterial(); + return function (srcBuffer, targetBuffer) { + if (typeof srcBuffer === 'undefined' || typeof targetBuffer === 'undefined') { + return; + } + const gfx = this._gfx; -Miew.prototype.getSelectionCenter = function () { - var _centerInVisual = new Vector3(0.0, 0.0, 0.0); - - return function (center, includesAtom, selector) { - center.set(0.0, 0.0, 0.0); - var count = 0; - - this._forEachComplexVisual(function (visual) { - if (visual.getSelectionCenter(_centerInVisual, includesAtom, selector || visual.getSelectionBit())) { - center.add(_centerInVisual); - count++; - } - }); + // clear canvas + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); + gfx.renderer.setRenderTarget(targetBuffer); + gfx.renderer.clear(); - if (count === 0) { - return false; + // do fxaa processing of offscreen buff2 + _fxaaMaterial.uniforms.srcTex.value = srcBuffer.texture; + _fxaaMaterial.uniforms.srcTexelSize.value.set(1.0 / srcBuffer.width, 1.0 / srcBuffer.height); + _fxaaMaterial.uniforms.bgColor.value.set(settings.now.bg.color); + if (_fxaaMaterial.bgTransparent !== settings.now.bg.transparent) { + _fxaaMaterial.setValues({ + bgTransparent: settings.now.bg.transparent + }); + _fxaaMaterial.needsUpdate = true; } - - center.divideScalar(count); - center.negate(); - return true; + gfx.renderer.renderScreenQuad(_fxaaMaterial); }; }(); - -Miew.prototype.setPivotSubset = function () { - var _center = new Vector3(0.0, 0.0, 0.0); - - function _includesInCurSelection(atom, selectionBit) { - return atom.mask & 1 << selectionBit; - } - - function _includesInSelector(atom, selector) { - return selector.selector.includesAtom(atom); - } - - return function (selector) { - var includesAtom = selector ? _includesInSelector : _includesInCurSelection; - - if (this.getSelectionCenter(_center, includesAtom, selector)) { - this._objectControls.setPivot(_center); - - this.dispatchEvent({ - type: 'transform' +Miew.prototype._performAO = function () { + const _aoMaterial = new shaders_AOMaterial(); + const _horBlurMaterial = new shaders_AOHorBlurMaterial(); + const _vertBlurMaterial = new shaders_AOVertBlurWithBlendMaterial(); + const _scale = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + return function (srcColorBuffer, normalBuffer, srcDepthTexture, targetBuffer, tempBuffer, tempBuffer1) { + if (!srcColorBuffer || !normalBuffer || !srcDepthTexture || !targetBuffer || !tempBuffer || !tempBuffer1) { + return; + } + const gfx = this._gfx; + const tanHalfFOV = Math.tan(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MathUtils.DEG2RAD * 0.5 * gfx.camera.fov); + _aoMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture; + _aoMaterial.uniforms.depthTexture.value = srcDepthTexture; + _aoMaterial.uniforms.normalTexture.value = normalBuffer.texture; + _aoMaterial.uniforms.srcTexelSize.value.set(1.0 / srcColorBuffer.width, 1.0 / srcColorBuffer.height); + _aoMaterial.uniforms.camNearFar.value.set(gfx.camera.near, gfx.camera.far); + _aoMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix; + _aoMaterial.uniforms.aspectRatio.value = gfx.camera.aspect; + _aoMaterial.uniforms.tanHalfFOV.value = tanHalfFOV; + gfx.root.matrix.extractScale(_scale); + _aoMaterial.uniforms.kernelRadius.value = settings.now.debug.ssaoKernelRadius * _scale.x; + _aoMaterial.uniforms.depthThreshold.value = 2.0 * this._getBSphereRadius(); // diameter + _aoMaterial.uniforms.factor.value = settings.now.debug.ssaoFactor; + // N: should be tempBuffer1 for proper use of buffers (see buffers using outside the function) + gfx.renderer.setRenderTarget(tempBuffer1); + gfx.renderer.renderScreenQuad(_aoMaterial); + _horBlurMaterial.uniforms.aoMap.value = tempBuffer1.texture; + _horBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer1.width, 1.0 / tempBuffer1.height); + _horBlurMaterial.uniforms.depthTexture.value = srcDepthTexture; + gfx.renderer.setRenderTarget(tempBuffer); + gfx.renderer.renderScreenQuad(_horBlurMaterial); + _vertBlurMaterial.uniforms.aoMap.value = tempBuffer.texture; + _vertBlurMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture; + _vertBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer.width, 1.0 / tempBuffer.height); + _vertBlurMaterial.uniforms.depthTexture.value = srcDepthTexture; + _vertBlurMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix; + _vertBlurMaterial.uniforms.aspectRatio.value = gfx.camera.aspect; + _vertBlurMaterial.uniforms.tanHalfFOV.value = tanHalfFOV; + const { + fog + } = gfx.scene; + if (fog) { + _vertBlurMaterial.uniforms.fogNearFar.value.set(fog.near, fog.far); + _vertBlurMaterial.uniforms.fogColor.value.set(fog.color.r, fog.color.g, fog.color.b, settings.now.fogAlpha); + } + if (_vertBlurMaterial.useFog !== settings.now.fog || _vertBlurMaterial.fogTransparent !== settings.now.bg.transparent) { + _vertBlurMaterial.setValues({ + useFog: settings.now.fog, + fogTransparent: settings.now.bg.transparent }); - } else { - this.logger.warn('selection is empty. Center operation not performed'); + _vertBlurMaterial.needsUpdate = true; } + gfx.renderer.setRenderTarget(targetBuffer); + gfx.renderer.renderScreenQuad(_vertBlurMaterial); }; }(); + /** - * Makes a screenshot. - * @param {number} [width] - Width of an image. Defaults to the canvas width. - * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height, - * if width is omitted too. - * @returns {string} Data URL representing the image contents. + * Reset the viewer, unload molecules. + * @param {boolean=} keepReps - Keep representations while resetting viewer state. */ - - -Miew.prototype.screenshot = function (width, height) { - var gfx = this._gfx; - var deviceWidth = gfx.renderer.domElement.width; - var deviceHeight = gfx.renderer.domElement.height; - - function fov2Tan(fov) { - return Math.tan(Math$1.degToRad(0.5 * fov)); - } - - function tan2Fov(tan) { - return Math$1.radToDeg(Math.atan(tan)) * 2.0; - } - - function getDataURL() { - var dataURL; - var currBrowser = utils.getBrowser(); - - if (currBrowser === utils.browserType.SAFARI) { - var canvas = document.createElement('canvas'); - var canvasContext = canvas.getContext('2d'); - canvas.width = width === undefined ? deviceWidth : width; - canvas.height = height === undefined ? deviceHeight : height; - canvasContext.drawImage(gfx.renderer.domElement, 0, 0, canvas.width, canvas.height); - dataURL = canvas.toDataURL('image/png'); - } else { - // Copy current canvas to screenshot - dataURL = gfx.renderer.domElement.toDataURL('image/png'); - } - - return dataURL; +Miew.prototype.reset = function /* keepReps */ +() { + if (this._picker) { + this._picker.reset(); } - - height = height || width; - var screenshotURI; - - if (width === undefined && height === undefined || width === deviceWidth && height === deviceHeight) { - // renderer.domElement.toDataURL('image/png') returns flipped image in Safari - // It hasn't been resolved yet, but getScreenshotSafari() - // fixes it using an extra canvas. - screenshotURI = getDataURL(); - } else { - var originalAspect = gfx.camera.aspect; - var originalFov = gfx.camera.fov; - var originalTanFov2 = fov2Tan(gfx.camera.fov); // screenshot should contain the principal area of interest (a centered square touching screen sides) - - var areaOfInterestSize = Math.min(gfx.width, gfx.height); - var areaOfInterestTanFov2 = originalTanFov2 * areaOfInterestSize / gfx.height; // set appropriate camera aspect & FOV - - var shotAspect = width / height; - gfx.renderer.setPixelRatio(1); - gfx.camera.aspect = shotAspect; - gfx.camera.fov = tan2Fov(areaOfInterestTanFov2 / Math.min(shotAspect, 1.0)); - gfx.camera.updateProjectionMatrix(); // resize canvas to the required size of screenshot - - gfx.renderer.setDrawingBufferSize(width, height, 1); // make screenshot - - this._renderFrame(settings.now.stereo); - - screenshotURI = getDataURL(); // restore original camera & canvas proportions - - gfx.renderer.setPixelRatio(window.devicePixelRatio); - gfx.camera.aspect = originalAspect; - gfx.camera.fov = originalFov; - gfx.camera.updateProjectionMatrix(); - gfx.renderer.setDrawingBufferSize(gfx.width, gfx.height, window.devicePixelRatio); - this._needRender = true; + this._lastPick = null; + this._releaseAllVisuals(); + this._setEditMode(EDIT_MODE.COMPLEX); + this._resetObjects(); + if (this._gfx) { + gfxutils.clearTree(this._gfx.pivot); + this._gfx.renderer2d.reset(); } - - return screenshotURI; -}; -/** - * Makes screenshot and initiates a download. - * @param {string} [filename] - Name of a file. Default to a 'screenshot-XXXXX.png', where XXXXX is a current - * date/time in seconds. - * @param {number} [width] - Width of an image. Defaults to the canvas width. - * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height, - * if width is omitted too. - */ - - -Miew.prototype.screenshotSave = function (filename, width, height) { - var uri = this.screenshot(width, height); - utils.shotDownload(uri, filename); + this.setNeedRender(); }; +Miew.prototype._resetScene = function () { + this._objectControls.reset(); + this._objectControls.allowTranslation(true); + this._objectControls.allowAltObjFreeRotation(true); + this.resetReps(); + this.resetPivot(); + this.rebuildAll(); +}; +Miew.prototype.resetView = function () { + // reset controls + if (this._picker) { + this._picker.reset(); + } + this._setEditMode(EDIT_MODE.COMPLEX); + this._resetScene(); -Miew.prototype.save = function (opts) { - var _this7 = this; - - this._export(opts.fileType).then(function (dataString) { - var filename = _this7._visuals[_this7._curVisualName]._complex.name; - utils.download(dataString, filename, opts.fileType); - - _this7._refreshTitle(); - - _this7.dispatchEvent({ - type: 'exportingDone' - }); - })["catch"](function (error) { - _this7.logger.error('Could not export data'); - - _this7.logger.debug(error); - - _this7._refreshTitle(); - - _this7.dispatchEvent({ - type: 'exportingDone', - error: error - }); + // reset selection + this._forEachComplexVisual(visual => { + visual.updateSelectionMask({}); + visual.rebuildSelectionGeometry(); }); }; - -Miew.prototype._tweakResolution = function () { - var maxPerf = [['poor', 100], ['low', 500], ['medium', 1000], ['high', 5000], ['ultra', Number.MAX_VALUE]]; - var atomCount = 0; - - this._forEachComplexVisual(function (visual) { - atomCount += visual.getComplex().getAtomCount(); +Miew.prototype._export = function (format) { + const TheExporter = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].head(io.exporters.find({ + format + })); + if (!TheExporter) { + this.logger.error('Could not find suitable exporter for this source'); + return Promise.reject(new Error('Could not find suitable exporter for this source')); + } + this.dispatchEvent({ + type: 'exporting' }); - - if (atomCount > 0) { - var performance = this._gfxScore * 10e5 / atomCount; // set resolution based on estimated performance - - for (var i = 0; i < maxPerf.length; ++i) { - if (performance < maxPerf[i][1]) { - this._autoChangeResolution(maxPerf[i][0]); - - break; - } + if (this._visuals[this._curVisualName] instanceof src_ComplexVisual) { + let dataSource = null; + if (TheExporter.SourceClass === src_ComplexVisual) { + dataSource = this._visuals[this._curVisualName]; + } else if (TheExporter.SourceClass === chem_Complex) { + dataSource = this._visuals[this._curVisualName]._complex; } + const exporter = new TheExporter(dataSource, { + miewVersion: Miew.VERSION + }); + return exporter.export().then(data => data); } -}; - -Miew.prototype._autoChangeResolution = function (resolution) { - if (resolution !== settings.now.resolution) { - this.logger.report("Your rendering resolution was changed to \"".concat(resolution, "\" for best performance.")); + if (this._visuals[this._curVisualName] instanceof src_VolumeVisual) { + return Promise.reject(new Error('Sorry, exporter for volume data not implemented yet')); } - - settings.now.resolution = resolution; -}; -/** - * Save current settings to cookies. - */ - - -Miew.prototype.saveSettings = function () { - this._cookies.setCookie(this._opts.settingsCookie, JSON.stringify(this.settings.getDiffs(true))); + return Promise.reject(new Error('Unexpected format of data')); }; -/** - * Load settings from cookies. - */ - - -Miew.prototype.restoreSettings = function () { - try { - var cookie = this._cookies.getCookie(this._opts.settingsCookie); +const rePdbId = /^(?:(pdb|cif|ccp4|dsn6):\s*)?(\d[a-z\d]{3})$/i; +const rePubchem = /^(?:pc|pubchem):\s*([a-z]+)$/i; +const reUrlScheme = /^([a-z][a-z\d\-+.]*):/i; +function resolveSourceShortcut(source, opts) { + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(source)) { + return source; + } - var diffs = cookie ? JSON.parse(cookie) : {}; - this.settings.applyDiffs(diffs, true); - } catch (e) { - this.logger.error("Cookies parse error: ".concat(e.message)); + // e.g. "cif:1CRN" + const matchesPdbId = rePdbId.exec(source); + if (matchesPdbId) { + let [, format = 'pdb', id] = matchesPdbId; + format = format.toLowerCase(); + id = id.toUpperCase(); + switch (format) { + case 'pdb': + source = `https://files.rcsb.org/download/${id}.pdb`; + break; + case 'cif': + source = `https://files.rcsb.org/download/${id}.cif`; + break; + case 'ccp4': + source = `https://www.ebi.ac.uk/pdbe/coordinates/files/${id.toLowerCase()}.ccp4`; + break; + case 'dsn6': + source = `https://edmaps.rcsb.org/maps/${id.toLowerCase()}_2fofc.dsn6`; + break; + default: + throw new Error('Unexpected data format shortcut'); + } + opts.fileType = format; + opts.fileName = `${id}.${format}`; + opts.sourceType = 'url'; + return source; } -}; -/** - * Reset current settings to the defaults. - */ + // e.g. "pc:aspirin" + const matchesPubchem = rePubchem.exec(source); + if (matchesPubchem) { + const compound = matchesPubchem[1].toLowerCase(); + source = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${compound}/JSON?record_type=3d`; + opts.fileType = 'pubchem'; + opts.fileName = `${compound}.json`; + opts.sourceType = 'url'; + return source; + } -Miew.prototype.resetSettings = function () { - this.settings.reset(); -}; -/* - * DANGEROUS and TEMPORARY. The method should change or disappear in future versions. - * @param {string|object} opts - See {@link Miew} constructor. - * @see {@link Miew#set}, {@link Miew#repAdd}, {@link Miew#rep}. - */ + // otherwise is should be an URL + if (opts.sourceType === 'url' || opts.sourceType === undefined) { + opts.sourceType = 'url'; + // e.g. "./data/1CRN.pdb" + if (!reUrlScheme.test(source)) { + source = utils.resolveURL(source); + } + } + return source; +} +function updateBinaryMode(opts) { + let { + binary + } = opts; -Miew.prototype.setOptions = function (opts) { - if (typeof opts === 'string') { - opts = Miew.options.fromAttr(opts); + // detect by format + if (opts.fileType !== undefined) { + const TheParser = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].head(io.parsers.find({ + format: opts.fileType + })); + if (TheParser) { + binary = TheParser.binary || false; + } else { + throw new Error('Could not find suitable parser for this format'); + } } - if (opts.reps) { - this._opts.reps = null; + // detect by file extension + if (binary === undefined && opts.fileExt !== undefined) { + const TheParser = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].head(io.parsers.find({ + ext: opts.fileExt + })); + if (TheParser) { + binary = TheParser.binary || false; + } } - _.merge(this._opts, opts); + // temporary workaround for animation + if (opts.fileExt !== undefined && opts.fileExt.toLowerCase() === '.man') { + opts.binary = true; + opts.animation = true; // who cares? + } - if (opts.settings) { - this.set(opts.settings); + // update if detected + if (binary !== undefined) { + if (opts.binary !== undefined && opts.binary !== binary) { + opts.context.logger.warn('Overriding incorrect binary mode'); + } } + opts.binary = binary || false; +} +function _fetchData(source, opts, job) { + return new Promise(resolve => { + if (job.shouldCancel()) { + throw new Error('Operation cancelled'); + } + job.notify({ + type: 'fetching' + }); - this._opts._objects = opts._objects; + // allow for source shortcuts + source = resolveSourceShortcut(source, opts); - this._resetObjects(); + // detect a proper loader + const TheLoader = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].head(io.loaders.find({ + type: opts.sourceType, + source + })); + if (!TheLoader) { + throw new Error(LOADER_NOT_FOUND); + } - if (opts.load) { - this.load(opts.load, { - fileType: opts.type - }); - } + // split file name + const fileName = opts.fileName || TheLoader.extractName(source); + if (fileName) { + const [name, fileExt] = utils.splitFileName(fileName); + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].defaults(opts, { + name, + fileExt, + fileName + }); + } - if (opts.preset) { - settings.now.preset = opts.preset; - } + // should it be text or binary? + updateBinaryMode(opts); - if (opts.reps) { - this.resetReps(opts.preset); - } + // FIXME: All new settings retrieved from server are applied after the loading is complete. However, we need some + // flags to alter the loading process itself. Here we apply them in advance. Dirty hack. Kill the server, remove + // all hacks and everybody's happy. + let newOptions = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(opts, 'preset.expression'); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(newOptions)) { + newOptions = JSON.parse(newOptions); + if (newOptions && newOptions.settings) { + const keys = ['singleUnit']; + for (let keyIndex = 0, keyCount = keys.length; keyIndex < keyCount; ++keyIndex) { + const key = keys[keyIndex]; + const value = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(newOptions.settings, key); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(value)) { + settings.set(key, value); + } + } + } + } - if (this._opts.view) { - this.view(this._opts.view); - delete this._opts.view; + // create a loader + const loader = new TheLoader(source, opts); + loader.context = opts.context; + job.addEventListener('cancel', () => loader.abort()); + loader.addEventListener('progress', event => { + if (event.lengthComputable && event.total > 0) { + reportProgress(loader.logger, 'Fetching', event.loaded / event.total); + } else { + reportProgress(loader.logger, 'Fetching'); + } + }); + console.time('fetch'); + const promise = loader.load().then(data => { + console.timeEnd('fetch'); + opts.context.logger.info('Fetching finished'); + job.notify({ + type: 'fetchingDone', + data + }); + return data; + }).catch(error => { + console.timeEnd('fetch'); + opts.context.logger.debug(error.message); + if (error.stack) { + opts.context.logger.debug(error.stack); + } + opts.context.logger.error('Fetching failed'); + job.notify({ + type: 'fetchingDone', + error + }); + throw error; + }); + resolve(promise); + }); +} +function _parseData(data, opts, job) { + if (job.shouldCancel()) { + return Promise.reject(new Error('Operation cancelled')); } + job.notify({ + type: 'parsing' + }); + const TheParser = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].head(io.parsers.find({ + format: opts.fileType, + ext: opts.fileExt, + data + })); + if (!TheParser) { + return Promise.reject(new Error('Could not find suitable parser')); + } + const parser = new TheParser(data, opts); + parser.context = opts.context; + job.addEventListener('cancel', () => parser.abort()); + console.time('parse'); + return parser.parse().then(dataSet => { + console.timeEnd('parse'); + job.notify({ + type: 'parsingDone', + data: dataSet + }); + return dataSet; + }).catch(error => { + console.timeEnd('parse'); + opts.error = error; + opts.context.logger.debug(error.message); + if (error.stack) { + opts.context.logger.debug(error.stack); + } + opts.context.logger.error('Parsing failed'); + job.notify({ + type: 'parsingDone', + error + }); + throw error; + }); +} - var visual = this._getComplexVisual(); - - if (visual) { - visual.getComplex().resetCurrentUnit(); +/** + * Load molecule asynchronously. + * @param {string|File} source - Molecule source to load (e.g. PDB ID, URL or File object). + * @param {object=} opts - Options. + * @param {string=} opts.sourceType - Data source type (e.g. 'url', 'file'). + * @param {string=} opts.fileType - Data contents type (e.g. 'pdb', 'cml'). + * @param {string=} opts.mdFile - .nc file path. + * @param {boolean=} opts.keepRepsInfo - prevent reset of object and reps information. + * @returns {Promise} name of the visual that was added to the viewer + */ +Miew.prototype.load = function (source, opts) { + opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge({}, opts, { + context: this + }); - if (_.isNumber(opts.unit)) { - visual.getComplex().setCurrentUnit(opts.unit); + // for a single-file scenario + if (!this.settings.now.use.multiFile) { + // abort all loaders in progress + if (this._loading.length) { + this._loading.forEach(job => { + job.cancel(); + }); + this._loading.length = 0; } - this.resetView(); - this.rebuildAll(); - } -}; - -Miew.prototype.info = function (name) { - var visual = this._getComplexVisual(name); - - if (!visual) { - return {}; + // reset + if (!opts.animation) { + // FIXME: sometimes it is set AFTERWARDS! + this.reset(true); + } } - - var complex = visual.getComplex(); - var metadata = complex.metadata; - return { - id: metadata.id || complex.name || 'UNKNOWN', - title: metadata.title && metadata.title.join(' ') || 'UNKNOWN DATA', - atoms: complex.getAtomCount(), - bonds: complex.getBondCount(), - residues: complex.getResidueCount(), - chains: complex.getChainCount() + this._interpolator.reset(); + this.dispatchEvent({ + type: 'loading', + options: opts, + source + }); + const job = new JobHandle(); + this._loading.push(job); + job.addEventListener('notification', e => { + this.dispatchEvent(e.slaveEvent); + }); + this._spinner.spin(this._container); + const onLoadEnd = anything => { + const jobIndex = this._loading.indexOf(job); + if (jobIndex !== -1) { + this._loading.splice(jobIndex, 1); + } + this._spinner.stop(); + this._refreshTitle(); + job.notify({ + type: 'loadingDone', + anything + }); + return anything; }; + return _fetchData(source, opts, job).then(data => _parseData(data, opts, job)).then(object => { + const name = this._onLoad(object, opts); + return onLoadEnd(name); + }).catch(err => { + this.logger.error('Could not load data'); + this.logger.debug(err); + throw onLoadEnd(err); + }); }; -/* - * OBJECTS SEGMENT - */ - - -Miew.prototype.addObject = function (objData, bThrow) { - var Ctor = null; - if (objData.type === LinesObj.prototype.type) { - Ctor = LinesObj; +/** + * Unload molecule (delete corresponding visual). + * @param {string=} name - name of the visual + */ +Miew.prototype.unload = function (name) { + this._removeVisual(name || this.getCurrentVisual()); + this.resetPivot(); + if (settings.now.shadow.on) { + this._updateShadowCamera(); } +}; - if (Ctor === null) { - throw new Error("Unknown scene object type - ".concat(objData.type)); +/** + * Start new animation. Now is broken. + * @param fileData - new data to animate + * @private + * @deprecated until animation system refactoring. + */ +Miew.prototype._startAnimation = function (fileData) { + this._stopAnimation(); + const self = this; + const visual = this._getComplexVisual(); + if (visual === null) { + this.logger.error('Unable to start animation - no molecule is loaded.'); + return; } - try { - var newObj = new Ctor(objData.params, objData.opts); - - this._addSceneObject(newObj); - } catch (error) { - if (!bThrow) { - this.logger.debug("Error during scene object creation: ".concat(error.message)); - } else { - throw error; - } + this._frameInfo = new gfx_FrameInfo(visual.getComplex(), fileData, { + onLoadStatusChanged() { + self.dispatchEvent({ + type: 'mdPlayerStateChanged', + state: { + isPlaying: self._isAnimating, + isLoading: self._frameInfo ? self._frameInfo.isLoading : true + } + }); + }, + onError(message) { + self._stopAnimation(); + self.logger.error(message); + } + }); + } catch (e) { + this.logger.error('Animation file does not fit to current complex!'); + return; } - - this._needRender = true; + this._continueAnimation(); }; -Miew.prototype._addSceneObject = function (sceneObject) { - var visual = this._getComplexVisual(); - - if (sceneObject.build && visual) { - sceneObject.build(visual.getComplex()); - - this._gfx.pivot.add(sceneObject.getGeometry()); +/** + * Pause current animation. Now is broken. + * @private + * @deprecated until animation system refactoring. + */ +Miew.prototype._pauseAnimation = function () { + if (this._animInterval === null) { + return; } - - var objects = this._objects; - objects[objects.length] = sceneObject; -}; - -Miew.prototype._updateObjsToFrame = function (frameData) { - var objs = this._objects; - - for (var i = 0, n = objs.length; i < n; ++i) { - if (objs[i].updateToFrame) { - objs[i].updateToFrame(frameData); - } + this._isAnimating = false; + clearInterval(this._animInterval); + this._animInterval = null; + if (this._frameInfo) { + this.dispatchEvent({ + type: 'mdPlayerStateChanged', + state: { + isPlaying: this._isAnimating, + isLoading: this._frameInfo.isLoading + } + }); } }; -Miew.prototype._resetObjects = function () { - var objs = this._opts._objects; - this._objects = []; - - if (objs) { - for (var i = 0, n = objs.length; i < n; ++i) { - this.addObject(objs[i], false); - } +/** + * Continue current animation after pausing. Now is broken. + * @private + * @deprecated until animation system refactoring. + */ +Miew.prototype._continueAnimation = function () { + this._isAnimating = true; + let minFrameTime = 1000 / settings.now.maxfps; + minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime; + const self = this; + const { + pivot + } = self._gfx; + const visual = this._getComplexVisual(); + if (visual) { + visual.resetSelectionMask(); + visual.rebuildSelectionGeometry(); + this._msgAtomInfo.style.opacity = 0.0; } + this._animInterval = setInterval(() => { + self.dispatchEvent({ + type: 'mdPlayerStateChanged', + state: { + isPlaying: self._isAnimating, + isLoading: self._frameInfo.isLoading + } + }); + if (self._frameInfo.frameIsReady) { + pivot.updateToFrame(self._frameInfo); + self._updateObjsToFrame(self._frameInfo); + self._refreshTitle(` Frame ${self._frameInfo._currFrame} of ${self._frameInfo._framesCount} time interval - ${self._frameInfo._timeStep}`); + try { + self._frameInfo.nextFrame(); + } catch (e) { + self.logger.error('Error during animation'); + self._stopAnimation(); + return; + } + self._needRender = true; + } + }, minFrameTime); }; -Miew.prototype.removeObject = function (index) { - var obj = this._objects[index]; - - if (!obj) { - throw new Error("Scene object with index ".concat(index, " does not exist")); - } - - obj.destroy(); - - this._objects.splice(index, 1); - - this._needRender = true; -}; /** - * Get a string with a URL to reproduce the current scene. - * - * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full - * preset information regardless of the differences with settings - * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included - * @param {boolean} [opts.view=false] - when this flag is true, a view information is included - * @returns {string} URL + * Stop current animation. Now is broken. + * @private + * @deprecated until animation system refactoring. */ - - -Miew.prototype.getURL = function (opts) { - return options.toURL(this.getState(_.defaults(opts, { - compact: true, - settings: false, - view: false - }))); +Miew.prototype._stopAnimation = function () { + if (this._animInterval === null) { + return; + } + clearInterval(this._animInterval); + this._frameInfo.disableEvents(); + this._frameInfo = null; + this._animInterval = null; + this.dispatchEvent({ + type: 'mdPlayerStateChanged', + state: null + }); }; + /** - * Get a string with a script to reproduce the current scene. - * - * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full - * preset information regardless of the differences with settings - * @param {boolean} [opts.settings=true] - when this flag is true, changes in settings are included - * @param {boolean} [opts.view=true] - when this flag is true, a view information is included - * @returns {string} script + * Invoked upon successful loading of some data source + * @param {DataSource} dataSource - Data source for visualization (molecular complex or other) + * @param {object} opts - Options. + * @private */ - - -Miew.prototype.getScript = function (opts) { - return options.toScript(this.getState(_.defaults(opts, { - compact: true, - settings: true, - view: true - }))); -}; -/* - * Generates object that represents the current state of representations list - * @param {boolean} compareWithDefaults - when this flag is true, reps list is compared (if possible) - * to preset's defaults and only diffs are generated - */ - - -Miew.prototype._compareReps = function (complexVisual, compareWithDefaults) { - var ans = {}; - var repCount = 0; - - if (complexVisual) { - repCount = complexVisual.repCount(); +Miew.prototype._onLoad = function (dataSource, opts) { + const gfx = this._gfx; + let visualName = null; + if (opts.animation) { + this._refreshTitle(); + this._startAnimation(dataSource); + return null; + } + this._stopAnimation(); + if (!opts || !opts.keepRepsInfo) { + this._opts.reps = null; + this._opts._objects = null; } + if (dataSource.id === 'Complex') { + const complex = dataSource; - var currPreset = settings.defaults.presets[settings.now.preset]; - var compare = compareWithDefaults; - - if (currPreset === undefined || currPreset.length > repCount) { - compare = false; - ans.preset = 'empty'; - } else if (settings.now.preset !== settings.defaults.preset) { - ans.preset = settings.now.preset; + // update title + if (opts.fileName) { + complex.name = complex.name || removeExtension(opts.fileName).toUpperCase(); + } else if (opts.amberFileName) { + complex.name = complex.name || removeExtension(opts.amberFileName).toUpperCase(); + } else { + complex.name = `Dynamic ${opts.fileType} molecule`; + } + visualName = this._addVisual(new src_ComplexVisual(complex.name, complex)); + this._curVisualName = visualName; + const desc = this.info(); + this.logger.info(`Parsed ${opts.fileName} (${desc.atoms} atoms, ${desc.bonds} bonds, ${desc.residues} residues, ${desc.chains} chains).`); + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isNumber(this._opts.unit)) { + complex.setCurrentUnit(this._opts.unit); + } + if (opts.preset) { + // ...removed server access... + } else if (settings.now.autoPreset) { + switch (opts.fileType) { + case 'cml': + this.resetReps('small'); + break; + case 'pdb': + case 'mmtf': + case 'cif': + if (hasValidResidues(complex)) { + this.resetReps('macro'); + } else { + this.resetReps('small'); + } + break; + default: + this.resetReps('default'); + break; + } + } else { + this.resetReps('default'); + } + } else if (dataSource.id === 'Volume') { + this.resetEd(); + visualName = this._onLoadEd(dataSource); } + gfx.camera.updateProjectionMatrix(); + this._updateFog(); - var repsDiff = []; - var emptyReps = true; - - for (var i = 0, n = repCount; i < n; ++i) { - repsDiff[i] = complexVisual.repGet(i).compare(compare ? currPreset[i] : null); + // reset global transform + gfx.root.resetTransform(); + this.resetPivot(); - if (!_.isEmpty(repsDiff[i])) { - emptyReps = false; - } + // set scale to fit everything on the screen + this._objectControls.setScale(settings.now.radiusToFit / this._getBSphereRadius()); + this._resetObjects(); + if (settings.now.autoResolution) { + this._tweakResolution(); } - - if (!emptyReps) { - ans.reps = repsDiff; + if (settings.now.shadow.on) { + this._updateShadowCamera(); } - - return ans; + if (this._opts.view) { + this.view(this._opts.view); + delete this._opts.view; + } + this._refreshTitle(); + return visualName; }; -/* - * Obtain object that represents current state of miew (might be used as options in constructor). - * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full - * preset information regardless of the differences with settings - * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included - * @param {boolean} [opts.view=false] - when this flag is true, a view information is included - * @returns {Object} State object. - */ - - -Miew.prototype.getState = function (opts) { - var state = {}; - opts = _.defaults(opts, { - compact: true, - settings: false, - view: false - }); // load - - var visual = this._getComplexVisual(); - - if (visual !== null) { - var complex = visual.getComplex(); - var metadata = complex.metadata; +Miew.prototype.resetEd = function () { + if (this._edLoader) { + this._edLoader.abort(); + this._edLoader = null; + } - if (metadata.id) { - var format = metadata.format ? "".concat(metadata.format, ":") : ''; - state.load = format + metadata.id; + // free all resources + this._removeVisual(this._getVolumeVisual()); + this._needRender = true; +}; +Miew.prototype.loadEd = function (source) { + this.resetEd(); + const TheLoader = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].head(io.loaders.find({ + source + })); + if (!TheLoader) { + this.logger.error(LOADER_NOT_FOUND); + return Promise.reject(new Error(LOADER_NOT_FOUND)); + } + const loader = this._edLoader = new TheLoader(source, { + binary: true + }); + loader.context = this; + return loader.load().then(data => { + const TheParser = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].head(io.parsers.find({ + format: 'ccp4' + })); + if (!TheParser) { + throw new Error(PARSER_NOT_FOUND); } + const parser = new TheParser(data); + parser.context = this; + return parser.parse().then(dataSource => { + this._onLoadEd(dataSource); + }); + }).catch(error => { + this.logger.error('Could not load ED data'); + this.logger.debug(error); + }); +}; +Miew.prototype._onLoadEd = function (dataSource) { + dataSource.normalize(); + const volumeVisual = new src_VolumeVisual('volume', dataSource); + volumeVisual.getMesh().layers.set(gfxutils.LAYERS.VOLUME); // volume mesh is not visible to common render + const visualName = this._addVisual(volumeVisual); + this._needRender = true; + return visualName; +}; +Miew.prototype._needRebuild = function () { + let needsRebuild = false; + this._forEachComplexVisual(visual => { + needsRebuild = needsRebuild || visual.needsRebuild(); + }); + return needsRebuild; +}; +Miew.prototype._rebuildObjects = function () { + const self = this; + const gfx = this._gfx; + let i; + let n; - var unit = complex.getCurrentUnit(); - - if (unit !== 1) { - state.unit = unit; + // remove old object geometry + const toRemove = []; + for (i = 0; i < gfx.pivot.children.length; ++i) { + const child = gfx.pivot.children[i]; + if (!(child instanceof src_Visual)) { + toRemove.push(child); } - } // representations - - - var repsInfo = this._compareReps(visual, opts.compact); - - if (repsInfo.preset) { - state.preset = repsInfo.preset; } - - if (repsInfo.reps) { - state.reps = repsInfo.reps; - } // objects - - - var objects = this._objects; - var objectsState = []; - - for (var i = 0, n = objects.length; i < n; ++i) { - objectsState[i] = objects[i].identify(); + for (i = 0; i < toRemove.length; ++i) { + toRemove[i].parent.remove(toRemove[i]); } - - if (objects.length > 0) { - state._objects = objectsState; - } // view - - - if (opts.view) { - state.view = this.view(); - } // settings - - - if (opts.settings) { - var diff = this.settings.getDiffs(false); - - if (!_.isEmpty(diff)) { - state.settings = diff; + setTimeout(() => { + const objList = self._objects; + for (i = 0, n = objList.length; i < n; ++i) { + const obj = objList[i]; + if (obj.needsRebuild) { + obj.build(); + } + if (obj.getGeometry()) { + gfx.pivot.add(obj.getGeometry()); + } } + }, 10); +}; +Miew.prototype.changeUnit = function (unitIdx, name) { + const visual = this._getComplexVisual(name); + if (!visual) { + throw new Error('There is no complex to change!'); } - - return state; + function currentUnitInfo() { + const unit = visual ? visual.getComplex().getCurrentUnit() : 0; + const type = unit > 0 ? `Bio molecule ${unit}` : 'Asymmetric unit'; + return `Current unit: ${unit} (${type})`; + } + if (unitIdx === undefined) { + return currentUnitInfo(); + } + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(unitIdx)) { + unitIdx = Math.max(parseInt(unitIdx, 10), 0); + } + if (visual.getComplex().setCurrentUnit(unitIdx)) { + this._resetScene(); + this._updateInfoPanel(); + } + return currentUnitInfo(); }; + /** - * Get parameter value. - * @param {string} param - Parameter name or path (e.g. 'modes.BS.atom'). - * @param {*=} value - Default value. - * @returns {*} Parameter value. + * Start to rebuild geometry asynchronously. */ +Miew.prototype.rebuild = function () { + if (this._building) { + this.logger.warn('Miew.rebuild(): already building!'); + return; + } + this._building = true; + this.dispatchEvent({ + type: 'rebuilding' + }); + this._rebuildObjects(); + this._gfx.renderer2d.reset(); + const rebuildActions = []; + this._forEachComplexVisual(visual => { + if (visual.needsRebuild()) { + rebuildActions.push(visual.rebuild().then(() => new Promise(resolve => { + visual.rebuildSelectionGeometry(); + resolve(); + }))); + } + }); - -Miew.prototype.get = function (param, value) { - return settings.get(param, value); + // Start asynchronous rebuild + const self = this; + this._spinner.spin(this._container); + Promise.all(rebuildActions).then(() => { + self._spinner.stop(); + self._needRender = true; + self._refreshTitle(); + this.dispatchEvent({ + type: 'buildingDone' + }); + self._building = false; + }); }; -Miew.prototype._clipPlaneUpdateValue = function (radius) { - var clipPlaneValue = Math.max(this._gfx.camera.position.z - radius * settings.now.draft.clipPlaneFactor, settings.now.camNear); - var opts = { - clipPlaneValue: clipPlaneValue - }; - - this._forEachComplexVisual(function (visual) { - visual.setUberOptions(opts); +/** Mark all representations for rebuilding */ +Miew.prototype.rebuildAll = function () { + this._forEachComplexVisual(visual => { + visual.setNeedsRebuild(); }); - - for (var i = 0, n = this._objects.length; i < n; ++i) { - var obj = this._objects[i]; - - if (obj._line) { - obj._line.material.setUberOptions(opts); +}; +Miew.prototype._refreshTitle = function (appendix) { + let title; + appendix = appendix === undefined ? '' : appendix; + const visual = this._getComplexVisual(); + if (visual) { + title = visual.getComplex().name; + const rep = visual.repGet(visual.repCurrent()); + title += rep ? ` – ${rep.mode.name} Mode` : ''; + } else { + title = Object.keys(this._visuals).length > 0 ? 'Unknown' : 'No Data'; + } + title += appendix; + this.dispatchEvent({ + type: 'titleChanged', + data: title + }); +}; +Miew.prototype.setNeedRender = function () { + this._needRender = true; +}; +Miew.prototype._extractRepresentation = function () { + const changed = []; + this._forEachComplexVisual(visual => { + if (visual.getSelectionCount() === 0) { + return; + } + const selector = visual.buildSelectorFromMask(1 << visual.getSelectionBit()); + const defPreset = settings.now.presets.default; + const res = visual.repAdd({ + selector, + mode: defPreset[0].mode.id, + colorer: defPreset[0].colorer.id, + material: defPreset[0].material.id + }); + if (!res) { + if (visual.repCount() === src_ComplexVisual.NUM_REPRESENTATION_BITS) { + this.logger.warn(`Number of representations is limited to ${src_ComplexVisual.NUM_REPRESENTATION_BITS}`); + } + return; } + this.dispatchEvent({ + type: 'repAdded', + index: res.index, + name: visual.name + }); + visual.repCurrent(res.index); + changed.push(visual.name); + }); + if (changed.length > 0) { + this.logger.report(`New representation from selection for complexes: ${changed.join(', ')}`); } +}; - if (this._picker !== null) { - this._picker.clipPlaneValue = clipPlaneValue; - } +/** + * Change current representation list. + * @param {array} reps - Representation list. + */ +Miew.prototype._setReps = function (reps) { + reps = reps || this._opts && this._opts.reps || []; + this._forEachComplexVisual(visual => visual.resetReps(reps)); }; -Miew.prototype._fogFarUpdateValue = function () { - if (this._picker !== null) { - if (this._gfx.scene.fog) { - this._picker.fogFarValue = this._gfx.scene.fog.far; - } else { - this._picker.fogFarValue = undefined; +/** + * Apply existing preset to current scene. + * @param preset + */ +Miew.prototype.applyPreset = function (preset) { + const { + presets + } = settings.now; + const presList = [preset || settings.defaults.preset, settings.defaults.preset, Object.keys(presets)[0]]; + let reps = null; + for (let i = 0; !reps && i < presList.length; ++i) { + settings.set('preset', presList[i]); + reps = presets[settings.now.preset]; + if (!reps) { + this.logger.warn(`Unknown preset "${settings.now.preset}"`); } } + this._setReps(reps); }; -Miew.prototype._updateShadowmapMeshes = function (process) { - this._forEachComplexVisual(function (visual) { - var reprList = visual._reprList; - - for (var i = 0, n = reprList.length; i < n; ++i) { - var repr = reprList[i]; - process(repr.geo, repr.material); - } - }); +/** + * Reset current representation list to initial values. + * @param {string} [preset] - The source preset in case of uninitialized representation list. + */ +Miew.prototype.resetReps = function (preset) { + const reps = this._opts && this._opts.reps; + if (reps) { + this._setReps(reps); + } else { + this.applyPreset(preset); + } }; -Miew.prototype._updateMaterials = function (values) { - var needTraverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; - - this._forEachComplexVisual(function (visual) { - return visual.setMaterialValues(values, needTraverse, process); - }); - - for (var i = 0, n = this._objects.length; i < n; ++i) { - var obj = this._objects[i]; - - if (obj._line) { - obj._line.material.setValues(values); +/** + * Get number of representations created so far. + * @returns {number} Number of reps. + */ +Miew.prototype.repCount = function (name) { + const visual = this._getComplexVisual(name); + return visual ? visual.repCount() : 0; +}; - obj._line.material.needsUpdate = true; - } +/** + * Get or set the current representation index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one. + * @param {string=} [name] - Complex name. Defaults to the current one. + * @returns {number} The current index. + */ +Miew.prototype.repCurrent = function (index, name) { + const visual = this._getComplexVisual(name); + const newIdx = visual ? visual.repCurrent(index) : -1; + if (index && newIdx !== index) { + this.logger.warn(`Representation ${index} was not found. Current rep remains unchanged.`); } + return newIdx; }; -Miew.prototype._fogAlphaChanged = function () { - this._forEachComplexVisual(function (visual) { - visual.setUberOptions({ - fogAlpha: settings.now.fogAlpha +/** + * Get or set representation by index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one. + * @param {object=} rep - Optional representation description. + * @param {string=} rep.selector - Selector string. + * @param {string=} rep.mode - Mode id. + * @param {string=} rep.colorer - Colorer id. + * @param {string=} rep.material - Material id. + * @returns {?object} Representation description. + */ +Miew.prototype.rep = function (index, rep) { + const visual = this._getComplexVisual(''); + if (!visual) { + return null; + } + const res = visual.rep(index, rep); + if (res.status === 'created') { + this.dispatchEvent({ + type: 'repAdded', + index: res.index, + name: visual.name }); - }); -}; - -Miew.prototype._embedWebXR = function () { - var _this8 = this; - - // switch off - if (settings.now.stereo !== 'WEBVR') { - if (this.webVR) { - this.webVR.disable(); - } - - this.webVR = null; - return; - } // switch on - - - if (!this.webVR) { - this.webVR = new WebVRPoC(function () { - _this8._requestAnimationFrame(function () { - return _this8._onTick(); - }); - - _this8._needRender = true; - - _this8._onResize(); + } else if (res.status === 'changed') { + this.dispatchEvent({ + type: 'repChanged', + index: res.index, + name: visual.name }); } - - this.webVR.enable(this._gfx); + return res.desc; }; -Miew.prototype._initOnSettingsChanged = function () { - var _this9 = this; - - var on = function on(props, func) { - props = _.isArray(props) ? props : [props]; - props.forEach(function (prop) { - _this9.settings.addEventListener("change:".concat(prop), func); - }); - }; - - on('modes.VD.frame', function () { - var volume = _this9._getVolumeVisual(); - - if (volume === null) return; - volume.showFrame(settings.now.modes.VD.frame); - _this9._needRender = true; - }); - on('modes.VD.isoMode', function () { - var volume = _this9._getVolumeVisual(); - - if (volume === null) return; - volume.getMesh().material.updateDefines(); - _this9._needRender = true; - }); - on('bg.color', function () { - _this9._onBgColorChanged(); - }); - on('ao', function () { - if (settings.now.ao && !isAOSupported(_this9._gfx.renderer.getContext())) { - _this9.logger.warn('Your device or browser does not support ao'); - - settings.set('ao', false); - } else { - var values = { - normalsToGBuffer: settings.now.ao - }; - - _this9._setUberMaterialValues(values); - } - }); - on('zSprites', function () { - if (settings.now.zSprites && !arezSpritesSupported(_this9._gfx.renderer.getContext())) { - _this9.logger.warn('Your device or browser does not support zSprites'); - - settings.set('zSprites', false); - } - }); - on('fogColor', function () { - _this9._onFogColorChanged(); - }); - on('fogColorEnable', function () { - _this9._onFogColorChanged(); - }); - on('bg.transparent', function (evt) { - var gfx = _this9._gfx; - - if (gfx) { - gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); - } // update materials - - - _this9._updateMaterials({ - fogTransparent: evt.value - }); +/** + * Get representation (not just description) by index. + * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one. + * @returns {?object} Representation. + */ +Miew.prototype.repGet = function (index, name) { + const visual = this._getComplexVisual(name); + return visual ? visual.repGet(index) : null; +}; - _this9.rebuildAll(); - }); - on('draft.clipPlane', function (evt) { - // update materials - _this9._updateMaterials({ - clipPlane: evt.value +/** + * Add new representation. + * @param {object=} rep - Representation description. + * @returns {number} Index of the new representation. + */ +Miew.prototype.repAdd = function (rep, name) { + const visual = this._getComplexVisual(name); + if (!visual) { + return -1; + } + const res = visual.repAdd(rep); + if (res) { + this.dispatchEvent({ + type: 'repAdded', + index: res.index, + name }); + return res.index; + } + return -1; +}; - _this9.rebuildAll(); - }); - on('shadow.on', function (evt) { - // update materials - var values = { - shadowmap: evt.value, - shadowmapType: settings.now.shadow.type - }; - var gfx = _this9._gfx; - - if (gfx) { - gfx.renderer.shadowMap.enabled = Boolean(values.shadowmap); - } - - _this9._updateMaterials(values, true); - - if (values.shadowmap) { - _this9._updateShadowCamera(); - - _this9._updateShadowmapMeshes(gfxutils.createShadowmapMaterial); - } else { - _this9._updateShadowmapMeshes(gfxutils.removeShadowmapMaterial); - } - - _this9._needRender = true; - }); - on('shadow.type', function (evt) { - // update materials if shadowmap is enable - if (settings.now.shadow.on) { - _this9._updateMaterials({ - shadowmapType: evt.value - }, true); - - _this9._needRender = true; - } - }); - on('shadow.radius', function (evt) { - for (var i = 0; i < _this9._gfx.scene.children.length; i++) { - if (_this9._gfx.scene.children[i].shadow !== undefined) { - var light = _this9._gfx.scene.children[i]; - light.shadow.radius = evt.value; - _this9._needRender = true; - } - } - }); - on('fps', function () { - _this9._fps.show(settings.now.fps); - }); - on(['fog', 'fogNearFactor', 'fogFarFactor'], function () { - _this9._updateFog(); - - _this9._needRender = true; +/** + * Remove representation. + * @param {number=} index - Zero-based representation index. + */ +Miew.prototype.repRemove = function (index, name) { + const visual = this._getComplexVisual(name); + if (!visual) { + return; + } + visual.repRemove(index); + this.dispatchEvent({ + type: 'repRemoved', + index, + name }); - on('fogAlpha', function () { - var fogAlpha = settings.now.fogAlpha; - - if (fogAlpha < 0 || fogAlpha > 1) { - _this9.logger.warn('fogAlpha must belong range [0,1]'); - } - - _this9._fogAlphaChanged(); +}; - _this9._needRender = true; - }); - on('autoResolution', function (evt) { - if (evt.value && !_this9._gfxScore) { - _this9.logger.warn('Benchmarks are missed, autoresolution will not work! ' + 'Autoresolution should be set during miew startup.'); +/** + * Hide representation. + * @param {number} index - Zero-based representation index. + * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default). + */ +Miew.prototype.repHide = function (index, hide, name) { + this._needRender = true; + const visual = this._getComplexVisual(name); + return visual ? visual.repHide(index, hide) : null; +}; +Miew.prototype._setEditMode = function (mode) { + this._editMode = mode; + const elem = this._msgMode; + if (elem) { + elem.style.opacity = mode === EDIT_MODE.COMPLEX ? 0.0 : 1.0; + if (mode !== EDIT_MODE.COMPLEX) { + const t = elem.getElementsByTagName('p')[0]; + t.innerHTML = mode === EDIT_MODE.COMPONENT ? 'COMPONENT EDIT MODE' : 'FRAGMENT EDIT MODE'; } - }); - on('stereo', function () { - _this9._embedWebXR(settings.now.stereo === 'WEBVR'); - - _this9._needRender = true; - }); - on(['transparency', 'palette'], function () { - _this9.rebuildAll(); - }); - on('resolution', function () { - // update complex visuals - _this9.rebuildAll(); // update volume visual - - - var volume = _this9._getVolumeVisual(); - - if (volume) { - volume.getMesh().material.updateDefines(); - _this9._needRender = true; + } + this.dispatchEvent({ + type: 'editModeChanged', + data: mode === EDIT_MODE.COMPLEX + }); +}; +Miew.prototype._enterComponentEditMode = function () { + if (this._editMode !== EDIT_MODE.COMPLEX) { + return; + } + const editors = []; + this._forEachComplexVisual(visual => { + const editor = visual.beginComponentEdit(); + if (editor) { + editors.push(editor); } }); - on(['axes', 'fxaa', 'ao', 'outline.on', 'outline.color', 'outline.threshold', 'outline.thickness'], function () { - _this9._needRender = true; + if (editors === []) { + return; + } + this._editors = editors; + this.logger.info('COMPONENT EDIT MODE -- ON'); + this._setEditMode(EDIT_MODE.COMPONENT); + this._objectControls.keysTranslateObj(true); +}; +Miew.prototype._applyComponentEdit = function () { + if (this._editMode !== EDIT_MODE.COMPONENT) { + return; + } + this._objectControls.stop(); + this._objectControls.keysTranslateObj(false); + for (let i = 0; i < this._editors.length; ++i) { + this._editors[i].apply(); + } + this._editors = []; + this.logger.info('COMPONENT EDIT MODE -- OFF (applied)'); + this._setEditMode(EDIT_MODE.COMPLEX); + this.rebuildAll(); +}; +Miew.prototype._discardComponentEdit = function () { + if (this._editMode !== EDIT_MODE.COMPONENT) { + return; + } + this._objectControls.stop(); + this._objectControls.keysTranslateObj(false); + for (let i = 0; i < this._editors.length; ++i) { + this._editors[i].discard(); + } + this._editors = []; + this.logger.info('COMPONENT EDIT MODE -- OFF (discarded)'); + this._setEditMode(EDIT_MODE.COMPLEX); + this._needRender = true; + this.rebuildAll(); +}; +Miew.prototype._enterFragmentEditMode = function () { + if (this._editMode !== EDIT_MODE.COMPLEX) { + return; + } + const selectedVisuals = []; + this._forEachComplexVisual(visual => { + if (visual instanceof src_ComplexVisual && visual.getSelectionCount() > 0) { + selectedVisuals.push(visual); + } }); + if (selectedVisuals.length !== 1) { + // either we have no selection or + // we have selected atoms in two or more visuals -- not supported + return; + } + const editor = selectedVisuals[0].beginFragmentEdit(); + if (!editor) { + return; + } + this._editors = [editor]; + this.logger.info('FRAGMENT EDIT MODE -- ON (single bond)'); + this._setEditMode(EDIT_MODE.FRAGMENT); + this._objectControls.allowTranslation(false); + this._objectControls.allowAltObjFreeRotation(editor.isFreeRotationAllowed()); + this._needRender = true; }; -/** - * Set parameter value. - * @param {string|object} params - Parameter name or path (e.g. 'modes.BS.atom') or even settings object. - * @param {*=} value - Value. - */ - - -Miew.prototype.set = function (params, value) { - settings.set(params, value); +Miew.prototype._applyFragmentEdit = function () { + if (this._editMode !== EDIT_MODE.FRAGMENT) { + return; + } + this._objectControls.stop(); + for (let i = 0; i < this._editors.length; ++i) { + this._editors[i].apply(); + } + this._editors = []; + this.logger.info('FRAGMENT EDIT MODE -- OFF (applied)'); + this._setEditMode(EDIT_MODE.COMPLEX); + this._objectControls.allowTranslation(true); + this._objectControls.allowAltObjFreeRotation(true); + this.rebuildAll(); }; -/** - * Select atoms with selection string. - * @param {string} expression - string expression of selection - * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection - */ - - -Miew.prototype.select = function (expression, append) { - var visual = this._getComplexVisual(); - - if (!visual) { +Miew.prototype._discardFragmentEdit = function () { + if (this._editMode !== EDIT_MODE.FRAGMENT) { return; } - - var sel = expression; - - if (_.isString(expression)) { - sel = selectors$4.parse(expression).selector; + this._objectControls.stop(); + for (let i = 0; i < this._editors.length; ++i) { + this._editors[i].discard(); } - - visual.select(sel, append); - this._lastPick = null; - - this._updateInfoPanel(); - + this._editors = []; + this.logger.info('FRAGMENT EDIT MODE -- OFF (discarded)'); + this._setEditMode(EDIT_MODE.COMPLEX); + this._objectControls.allowTranslation(true); + this._objectControls.allowAltObjFreeRotation(true); this._needRender = true; }; +Miew.prototype._onPick = function (event) { + if (!settings.now.picking) { + // picking is disabled + return; + } + if (this._animInterval !== null) { + // animation playback is on + return; + } + if (this._editMode === EDIT_MODE.FRAGMENT) { + // prevent picking in fragment edit mode + return; + } + if (this._objectControls.isEditingAltObj()) { + // prevent picking during component rotation + return; + } -var VIEW_VERSION = '1'; -/** - * Get or set view info packed into string. - * - * **Note:** view is stored for *left-handed* cs, euler angles are stored in radians and *ZXY-order*, - * - * @param {string=} expression - Optional string encoded the view - */ - -Miew.prototype.view = function (expression) { - var self = this; - var pivot = this._gfx.pivot; - var transform = []; - var eulerOrder = 'ZXY'; - - function encode() { - var pos = pivot.position; - var scale = self._objectControls.getScale() / settings.now.radiusToFit; - var euler = new Euler(); - euler.setFromQuaternion(self._objectControls.getOrientation(), eulerOrder); - transform = [pos.x, pos.y, pos.z, scale, euler.x, euler.y, euler.z]; - return VIEW_VERSION + utils.arrayToBase64(transform, Float32Array); + // update last pick & find complex + let complex = null; + if (event.obj.atom) { + complex = event.obj.atom.residue.getChain().getComplex(); + this._lastPick = event.obj.atom; + } else if (event.obj.residue) { + complex = event.obj.residue.getChain().getComplex(); + this._lastPick = event.obj.residue; + } else if (event.obj.chain) { + complex = event.obj.chain.getComplex(); + this._lastPick = event.obj.chain; + } else if (event.obj.molecule) { + complex = event.obj.molecule.complex; + this._lastPick = event.obj.molecule; + } else { + this._lastPick = null; + } + function _updateSelection(visual) { + visual.updateSelectionMask(event.obj); + visual.rebuildSelectionGeometry(); } - function decode() { - // backwards compatible: old non-versioned view is the 0th version - if (expression.length === 40) { - expression = "0".concat(expression); + // update visual + if (complex) { + const visual = this._getVisualForComplex(complex); + if (visual) { + _updateSelection(visual); + this._needRender = true; } + } else { + this._forEachComplexVisual(_updateSelection); + this._needRender = true; + } + this._updateInfoPanel(); + this.dispatchEvent(event); +}; +Miew.prototype._onKeyDown = function (event) { + if (!this._running || !this._hotKeysEnabled) { + return; + } - var version = expression[0]; - transform = utils.arrayFromBase64(expression.substr(1), Float32Array); // apply adapter for old versions + // editing keys + if (settings.now.editing) { + switch (event.code) { + case 'KeyC': + this._enterComponentEditMode(); + break; + case 'KeyF': + this._enterFragmentEditMode(); + break; + case 'KeyA': + switch (this._editMode) { + case EDIT_MODE.COMPONENT: + this._applyComponentEdit(); + break; + case EDIT_MODE.FRAGMENT: + this._applyFragmentEdit(); + break; + default: + break; + } + break; + case 'KeyD': + switch (this._editMode) { + case EDIT_MODE.COMPONENT: + this._discardComponentEdit(); + break; + case EDIT_MODE.FRAGMENT: + this._discardFragmentEdit(); + break; + default: + break; + } + break; + default: + } + } - if (version !== VIEW_VERSION) { - if (version === '0') { - // cancel radiusToFit included in old views - transform[3] /= 8.0; - } else { - // do nothing - self.logger.warn("Encoded view version mismatch, stored as ".concat(version, " vs ").concat(VIEW_VERSION, " expected")); - return; + // other keys + switch (event.code) { + case 'NumpadAdd': + if (event.altKey) { + event.preventDefault(); + event.stopPropagation(); + this._forEachComplexVisual(visual => { + visual.expandSelection(); + visual.rebuildSelectionGeometry(); + }); + this._updateInfoPanel(); + this._needRender = true; + } + break; + case 'NumpadSubtract': + if (event.altKey) { + event.preventDefault(); + event.stopPropagation(); + this._forEachComplexVisual(visual => { + visual.shrinkSelection(); + visual.rebuildSelectionGeometry(); + }); + this._updateInfoPanel(); + this._needRender = true; + } + break; + default: + } +}; +Miew.prototype._onKeyUp = function (event) { + if (!this._running || !this._hotKeysEnabled) { + return; + } + if (event.code === 'KeyX') { + this._extractRepresentation(); + } +}; +Miew.prototype._updateInfoPanel = function () { + const info = this._msgAtomInfo.getElementsByTagName('p')[0]; + let atom; + let residue; + let count = 0; + this._forEachComplexVisual(visual => { + count += visual.getSelectionCount(); + }); + while (info.firstChild) { + info.removeChild(info.firstChild); + } + if (count === 0) { + this._msgAtomInfo.style.opacity = 0.0; + return; + } + let firstLine = `${String(count)} atom${count !== 1 ? 's' : ''} selected`; + if (this._lastPick !== null) { + firstLine += ', the last pick:'; + } + let secondLine = ''; + let aName = ''; + let coordLine = ''; + if (this._lastPick instanceof Miew_Atom) { + atom = this._lastPick; + residue = atom.residue; + aName = atom.name; + const location = atom.location !== 32 ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space + secondLine = `${atom.element.fullName} #${atom.serial}${location}: \ + ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}.`; + secondLine += aName; + coordLine = `Coord: (${atom.position.x.toFixed(2).toString()},\ + ${atom.position.y.toFixed(2).toString()},\ + ${atom.position.z.toFixed(2).toString()})`; + } else if (this._lastPick instanceof Miew_Residue) { + residue = this._lastPick; + secondLine = `${residue._type._fullName}: \ + ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}`; + } else if (this._lastPick instanceof Miew_Chain) { + secondLine = `chain ${this._lastPick._name}`; + } else if (this._lastPick instanceof Miew_Molecule) { + secondLine = `molecule ${this._lastPick._name}`; + } + info.appendChild(document.createTextNode(firstLine)); + if (secondLine !== '') { + info.appendChild(document.createElement('br')); + info.appendChild(document.createTextNode(secondLine)); + } + if (coordLine !== '') { + info.appendChild(document.createElement('br')); + info.appendChild(document.createTextNode(coordLine)); + } + this._msgAtomInfo.style.opacity = 1.0; +}; +Miew.prototype._getAltObj = function () { + if (this._editors) { + let altObj = null; + for (let i = 0; i < this._editors.length; ++i) { + const nextAltObj = this._editors[i].getAltObj(); + if (nextAltObj.objects.length > 0) { + if (altObj) { + // we have selected atoms in two or more visuals -- not supported + altObj = null; + break; + } + altObj = nextAltObj; } } - - var interpolator = self._interpolator; - var srcView = interpolator.createView(); - srcView.position.copy(pivot.position); - srcView.scale = self._objectControls.getScale(); - srcView.orientation.copy(self._objectControls.getOrientation()); - var dstView = interpolator.createView(); - dstView.position.set(transform[0], transform[1], transform[2]); // hack to make preset views work after we moved centering offset to visual nodes - // FIXME should only store main pivot offset in preset - - if (self._getComplexVisual()) { - dstView.position.sub(self._getComplexVisual().position); + if (altObj) { + return altObj; } - - dstView.scale = transform[3]; // eslint-disable-line prefer-destructuring - - dstView.orientation.setFromEuler(new Euler(transform[4], transform[5], transform[6], eulerOrder)); - interpolator.setup(srcView, dstView); - } - - if (typeof expression === 'undefined') { - return encode(); } - - decode(); - return expression; + return { + objects: [], + pivot: new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0, 0, 0) + }; }; -/* - * Update current view due to viewinterpolator state - */ - - -Miew.prototype._updateView = function () { - var self = this; - var pivot = this._gfx.pivot; - var interpolator = this._interpolator; - - if (!interpolator.wasStarted()) { - interpolator.start(); - } - - if (!interpolator.isMoving()) { - return; - } - - var res = interpolator.getCurrentView(); - - if (res.success) { - var curr = res.view; - pivot.position.copy(curr.position); - - self._objectControls.setScale(curr.scale * settings.now.radiusToFit); - - self._objectControls.setOrientation(curr.orientation); - +Miew.prototype.resetPivot = function () { + const boundingBox = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Box3(); + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + return function () { + boundingBox.makeEmpty(); + this._forEachVisual(visual => { + boundingBox.union(visual.getBoundaries().boundingBox); + }); + boundingBox.getCenter(center); + this._objectControls.setPivot(center.negate()); this.dispatchEvent({ type: 'transform' }); - self._needRender = true; + }; +}(); +Miew.prototype.setPivotResidue = function () { + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + return function (residue) { + const visual = this._getVisualForComplex(residue.getChain().getComplex()); + if (!visual) { + return; + } + if (residue._controlPoint) { + center.copy(residue._controlPoint); + } else { + let x = 0; + let y = 0; + let z = 0; + const amount = residue._atoms.length; + for (let i = 0; i < amount; ++i) { + const p = residue._atoms[i].position; + x += p.x / amount; + y += p.y / amount; + z += p.z / amount; + } + center.set(x, y, z); + } + center.applyMatrix4(visual.matrix).negate(); + this._objectControls.setPivot(center); + this.dispatchEvent({ + type: 'transform' + }); + }; +}(); +Miew.prototype.setPivotAtom = function () { + const center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + return function (atom) { + const visual = this._getVisualForComplex(atom.residue.getChain().getComplex()); + if (!visual) { + return; + } + center.copy(atom.position); + center.applyMatrix4(visual.matrix).negate(); + this._objectControls.setPivot(center); + this.dispatchEvent({ + type: 'transform' + }); + }; +}(); +Miew.prototype.getSelectionCenter = function () { + const _centerInVisual = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0); + return function (center, includesAtom, selector) { + center.set(0.0, 0.0, 0.0); + let count = 0; + this._forEachComplexVisual(visual => { + if (visual.getSelectionCenter(_centerInVisual, includesAtom, selector || visual.getSelectionBit())) { + center.add(_centerInVisual); + count++; + } + }); + if (count === 0) { + return false; + } + center.divideScalar(count); + center.negate(); + return true; + }; +}(); +Miew.prototype.setPivotSubset = function () { + const _center = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(0.0, 0.0, 0.0); + function _includesInCurSelection(atom, selectionBit) { + return atom.mask & 1 << selectionBit; } -}; -/** - * Translate object by vector - * @param {number} x - translation value (Ang) along model's X axis - * @param {number} y - translation value (Ang) along model's Y axis - * @param {number} z - translation value (Ang) along model's Z axis - */ - - -Miew.prototype.translate = function (x, y, z) { - this._objectControls.translatePivot(x, y, z); + function _includesInSelector(atom, selector) { + return selector.selector.includesAtom(atom); + } + return function (selector) { + const includesAtom = selector ? _includesInSelector : _includesInCurSelection; + if (this.getSelectionCenter(_center, includesAtom, selector)) { + this._objectControls.setPivot(_center); + this.dispatchEvent({ + type: 'transform' + }); + } else { + this.logger.warn('selection is empty. Center operation not performed'); + } + }; +}(); - this.dispatchEvent({ - type: 'transform' - }); - this._needRender = true; -}; /** - * Rotate object by Euler angles - * @param {number} x - rotation angle around X axis in radians - * @param {number} y - rotation angle around Y axis in radians - * @param {number} z - rotation angle around Z axis in radians + * Makes a screenshot. + * @param {number} [width] - Width of an image. Defaults to the canvas width. + * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height, + * if width is omitted too. + * @returns {string} Data URL representing the image contents. */ +Miew.prototype.screenshot = function (width, height) { + const gfx = this._gfx; + const deviceWidth = gfx.renderer.domElement.width; + const deviceHeight = gfx.renderer.domElement.height; + function fov2Tan(fov) { + return Math.tan(external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MathUtils.degToRad(0.5 * fov)); + } + function tan2Fov(tan) { + return external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.MathUtils.radToDeg(Math.atan(tan)) * 2.0; + } + function getDataURL() { + let dataURL; + const currBrowser = utils.getBrowser(); + if (currBrowser === utils.browserType.SAFARI) { + const canvas = document.createElement('canvas'); + const canvasContext = canvas.getContext('2d'); + canvas.width = width === undefined ? deviceWidth : width; + canvas.height = height === undefined ? deviceHeight : height; + canvasContext.drawImage(gfx.renderer.domElement, 0, 0, canvas.width, canvas.height); + dataURL = canvas.toDataURL('image/png'); + } else { + // Copy current canvas to screenshot + dataURL = gfx.renderer.domElement.toDataURL('image/png'); + } + return dataURL; + } + height = height || width; + let screenshotURI; + if (width === undefined && height === undefined || width === deviceWidth && height === deviceHeight) { + // renderer.domElement.toDataURL('image/png') returns flipped image in Safari + // It hasn't been resolved yet, but getScreenshotSafari() + // fixes it using an extra canvas. + screenshotURI = getDataURL(); + } else { + const originalAspect = gfx.camera.aspect; + const originalFov = gfx.camera.fov; + const originalTanFov2 = fov2Tan(gfx.camera.fov); + // screenshot should contain the principal area of interest (a centered square touching screen sides) + const areaOfInterestSize = Math.min(gfx.width, gfx.height); + const areaOfInterestTanFov2 = originalTanFov2 * areaOfInterestSize / gfx.height; -Miew.prototype.rotate = function (x, y, z) { - this._objectControls.rotate(new Quaternion().setFromEuler(new Euler(x, y, z, 'XYZ'))); + // set appropriate camera aspect & FOV + const shotAspect = width / height; + gfx.renderer.setPixelRatio(1); + gfx.camera.aspect = shotAspect; + gfx.camera.fov = tan2Fov(areaOfInterestTanFov2 / Math.min(shotAspect, 1.0)); + gfx.camera.updateProjectionMatrix(); - this.dispatchEvent({ - type: 'transform' - }); - this._needRender = true; -}; -/** - * Scale object by factor - * @param {number} factor - scale multiplier, should greater than zero - */ + // resize canvas to the required size of screenshot + gfx.renderer.setDrawingBufferSize(width, height, 1); + // make screenshot + this._renderFrame(settings.now.stereo); + screenshotURI = getDataURL(); -Miew.prototype.scale = function (factor) { - if (factor <= 0) { - throw new RangeError('Scale should be greater than zero'); + // restore original camera & canvas proportions + gfx.renderer.setPixelRatio(window.devicePixelRatio); + gfx.camera.aspect = originalAspect; + gfx.camera.fov = originalFov; + gfx.camera.updateProjectionMatrix(); + gfx.renderer.setDrawingBufferSize(gfx.width, gfx.height, window.devicePixelRatio); + this._needRender = true; } - - this._objectControls.scale(factor); - - this.dispatchEvent({ - type: 'transform' - }); - this._needRender = true; + return screenshotURI; }; + /** - * Center view on selection - * @param {empty | subset | string} selector - defines part of molecule which must be centered ( - * empty - center on current selection; - * subset - center on picked atom/residue/molecule; - * string - center on atoms correspond to selection string) + * Makes screenshot and initiates a download. + * @param {string} [filename] - Name of a file. Default to a 'screenshot-XXXXX.png', where XXXXX is a current + * date/time in seconds. + * @param {number} [width] - Width of an image. Defaults to the canvas width. + * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height, + * if width is omitted too. */ - - -Miew.prototype.center = function (selector) { - // no arguments - center on current selection; - if (selector === undefined) { - this.setPivotSubset(); - this._needRender = true; - return; - } // subset with atom or residue - center on picked atom/residue; - - - if (selector.obj !== undefined && ('atom' in selector.obj || 'residue' in selector.obj)) { - // from event with selection - if ('atom' in selector.obj) { - this.setPivotAtom(selector.obj.atom); - } else { - this.setPivotResidue(selector.obj.residue); - } - - this._needRender = true; - return; - } // string - center on atoms correspond to selection string - - - if (selector.obj === undefined && selector !== '') { - var sel = selectors$4.parse(selector); - - if (sel.error === undefined) { - this.setPivotSubset(sel); - this._needRender = true; - return; +Miew.prototype.screenshotSave = function (filename, width, height) { + const uri = this.screenshot(width, height); + utils.shotDownload(uri, filename); +}; +Miew.prototype.save = function (opts) { + this._export(opts.fileType).then(dataString => { + const filename = this._visuals[this._curVisualName]._complex.name; + utils.download(dataString, filename, opts.fileType); + this._refreshTitle(); + this.dispatchEvent({ + type: 'exportingDone' + }); + }).catch(error => { + this.logger.error('Could not export data'); + this.logger.debug(error); + this._refreshTitle(); + this.dispatchEvent({ + type: 'exportingDone', + error + }); + }); +}; +Miew.prototype._tweakResolution = function () { + const maxPerf = [['poor', 100], ['low', 500], ['medium', 1000], ['high', 5000], ['ultra', Number.MAX_VALUE]]; + let atomCount = 0; + this._forEachComplexVisual(visual => { + atomCount += visual.getComplex().getAtomCount(); + }); + if (atomCount > 0) { + const performance = this._gfxScore * 10e5 / atomCount; + // set resolution based on estimated performance + for (let i = 0; i < maxPerf.length; ++i) { + if (performance < maxPerf[i][1]) { + this._autoChangeResolution(maxPerf[i][0]); + break; + } } - } // empty subset or incorrect/empty string - center on all molecule; - - - this.resetPivot(); - this._needRender = true; + } +}; +Miew.prototype._autoChangeResolution = function (resolution) { + if (resolution !== settings.now.resolution) { + this.logger.report(`Your rendering resolution was changed to "${resolution}" for best performance.`); + } + settings.now.resolution = resolution; }; + /** - * Build selector that contains all atoms within given distance from group of atoms - * @param {Selector} selector - selector describing source group of atoms - * @param {number} radius - distance - * @returns {Selector} selector describing result group of atoms + * Save current settings to cookies. */ +Miew.prototype.saveSettings = function () { + this._cookies.setCookie(this._opts.settingsCookie, JSON.stringify(this.settings.getDiffs(true))); +}; +/** + * Load settings from cookies. + */ +Miew.prototype.restoreSettings = function () { + try { + const cookie = this._cookies.getCookie(this._opts.settingsCookie); + const diffs = cookie ? JSON.parse(cookie) : {}; + this.settings.applyDiffs(diffs, true); + } catch (e) { + this.logger.error(`Cookies parse error: ${e.message}`); + } +}; -Miew.prototype.within = function (selector, radius) { - var visual = this._getComplexVisual(); +/** + * Reset current settings to the defaults. + */ +Miew.prototype.resetSettings = function () { + this.settings.reset(); +}; - if (!visual) { - return selectors$4.None(); +/* + * DANGEROUS and TEMPORARY. The method should change or disappear in future versions. + * @param {string|object} opts - See {@link Miew} constructor. + * @see {@link Miew#set}, {@link Miew#repAdd}, {@link Miew#rep}. + */ +Miew.prototype.setOptions = function (opts) { + if (typeof opts === 'string') { + opts = Miew.options.fromAttr(opts); } - - if (selector instanceof String) { - selector = selectors$4.parse(selector); + if (opts.reps) { + this._opts.reps = null; } - - var res = visual.within(selector, radius); - - if (res) { - visual.rebuildSelectionGeometry(); - this._needRender = true; + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].merge(this._opts, opts); + if (opts.settings) { + this.set(opts.settings); + } + this._opts._objects = opts._objects; + this._resetObjects(); + if (opts.load) { + this.load(opts.load, { + fileType: opts.type + }); + } + if (opts.preset) { + settings.now.preset = opts.preset; + } + if (opts.reps) { + this.resetReps(opts.preset); + } + if (this._opts.view) { + this.view(this._opts.view); + delete this._opts.view; + } + const visual = this._getComplexVisual(); + if (visual) { + visual.getComplex().resetCurrentUnit(); + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isNumber(opts.unit)) { + visual.getComplex().setCurrentUnit(opts.unit); + } + this.resetView(); + this.rebuildAll(); } - - return res; }; -/** - * Get atom position in 2D canvas coords - * @param {string} fullAtomName - full atom name, like A.38.CG - * @returns {Object} {x, y} or false if atom not found - */ - - -Miew.prototype.projected = function (fullAtomName, complexName) { - var visual = this._getComplexVisual(complexName); - +Miew.prototype.info = function (name) { + const visual = this._getComplexVisual(name); if (!visual) { - return false; - } - - var atom = visual.getComplex().getAtomByFullname(fullAtomName); - - if (atom === null) { - return false; + return {}; } - - var pos = atom.position.clone(); // we consider atom position to be affected only by common complex transform - // ignoring any transformations that may add during editing - - this._gfx.pivot.updateMatrixWorldRecursive(); - - this._gfx.camera.updateMatrixWorldRecursive(); - - this._gfx.pivot.localToWorld(pos); - - pos.project(this._gfx.camera); + const complex = visual.getComplex(); + const { + metadata + } = complex; return { - x: (pos.x + 1.0) * 0.5 * this._gfx.width, - y: (1.0 - pos.y) * 0.5 * this._gfx.height + id: metadata.id || complex.name || 'UNKNOWN', + title: metadata.title && metadata.title.join(' ') || 'UNKNOWN DATA', + atoms: complex.getAtomCount(), + bonds: complex.getBondCount(), + residues: complex.getResidueCount(), + chains: complex.getChainCount() }; }; -/** - * Replace secondary structure with calculated one. - * - * DSSP algorithm implementation is used. - * - * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and - * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211. - * - * @param {string=} complexName - complex name - */ - -Miew.prototype.dssp = function (complexName) { - var visual = this._getComplexVisual(complexName); +/* + * OBJECTS SEGMENT + */ - if (!visual) { - return; +Miew.prototype.addObject = function (objData, bThrow) { + let Ctor = null; + if (objData.type === objects_LinesObj.prototype.type) { + Ctor = objects_LinesObj; } - - visual.getComplex().dssp(); // rebuild dependent representations (cartoon or ss-colored) - - visual._reprList.forEach(function (rep) { - if (rep.mode.id === 'CA' || rep.colorer.id === 'SS') { - rep.needsRebuild = true; + if (Ctor === null) { + throw new Error(`Unknown scene object type - ${objData.type}`); + } + try { + const newObj = new Ctor(objData.params, objData.opts); + this._addSceneObject(newObj); + } catch (error) { + if (!bThrow) { + this.logger.debug(`Error during scene object creation: ${error.message}`); + } else { + throw error; } - }); + } + this._needRender = true; }; - -Miew.prototype.exportCML = function () { - var self = this; - - function extractRotation(m) { - var xAxis = new Vector3(); - var yAxis = new Vector3(); - var zAxis = new Vector3(); - m.extractBasis(xAxis, yAxis, zAxis); - xAxis.normalize(); - yAxis.normalize(); - zAxis.normalize(); - var retMat = new Matrix4(); - retMat.identity(); - retMat.makeBasis(xAxis, yAxis, zAxis); - return retMat; +Miew.prototype._addSceneObject = function (sceneObject) { + const visual = this._getComplexVisual(); + if (sceneObject.build && visual) { + sceneObject.build(visual.getComplex()); + this._gfx.pivot.add(sceneObject.getGeometry()); } - - function updateCMLData(complex) { - var root = self._gfx.root; - var mat = extractRotation(root.matrixWorld); - var v4 = new Vector4(0, 0, 0, 0); - var vCenter = new Vector4(0, 0, 0, 0); - var xml = null; - var ap = null; // update atoms in cml - - complex.forEachAtom(function (atom) { - if (atom.xmlNodeRef && atom.xmlNodeRef.xmlNode) { - xml = atom.xmlNodeRef.xmlNode; - ap = atom.position; - v4.set(ap.x, ap.y, ap.z, 1.0); - v4.applyMatrix4(mat); - xml.setAttribute('x3', v4.x.toString()); - xml.setAttribute('y3', v4.y.toString()); - xml.setAttribute('z3', v4.z.toString()); - xml.removeAttribute('x2'); - xml.removeAttribute('y2'); - } - }); // update stereo groups in cml - - complex.forEachSGroup(function (sGroup) { - if (sGroup.xmlNodeRef && sGroup.xmlNodeRef.xmlNode) { - xml = sGroup.xmlNodeRef.xmlNode; - ap = sGroup.getPosition(); - v4.set(ap.x, ap.y, ap.z, 1.0); - var cp = sGroup.getCentralPoint(); - - if (cp === null) { - v4.applyMatrix4(mat); - } else { - vCenter.set(cp.x, cp.y, cp.z, 0.0); - v4.add(vCenter); - v4.applyMatrix4(mat); // pos in global space - - vCenter.set(cp.x, cp.y, cp.z, 1.0); - vCenter.applyMatrix4(mat); - v4.sub(vCenter); - } - - xml.setAttribute('x', v4.x.toString()); - xml.setAttribute('y', v4.y.toString()); - xml.setAttribute('z', v4.z.toString()); - } - }); + const objects = this._objects; + objects[objects.length] = sceneObject; +}; +Miew.prototype._updateObjsToFrame = function (frameData) { + const objs = this._objects; + for (let i = 0, n = objs.length; i < n; ++i) { + if (objs[i].updateToFrame) { + objs[i].updateToFrame(frameData); + } } - - var visual = self._getComplexVisual(); - - var complex = visual ? visual.getComplex() : null; - - if (complex && complex.originalCML) { - updateCMLData(complex); // serialize xml structure to string - - var oSerializer = new XMLSerializer(); - return oSerializer.serializeToString(complex.originalCML); +}; +Miew.prototype._resetObjects = function () { + const objs = this._opts._objects; + this._objects = []; + if (objs) { + for (let i = 0, n = objs.length; i < n; ++i) { + this.addObject(objs[i], false); + } + } +}; +Miew.prototype.removeObject = function (index) { + const obj = this._objects[index]; + if (!obj) { + throw new Error(`Scene object with index ${index} does not exist`); } + obj.destroy(); + this._objects.splice(index, 1); + this._needRender = true; +}; - return null; +/** + * Get a string with a URL to reproduce the current scene. + * + * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full + * preset information regardless of the differences with settings + * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included + * @param {boolean} [opts.view=false] - when this flag is true, a view information is included + * @returns {string} URL + */ +Miew.prototype.getURL = function (opts) { + return options.toURL(this.getState(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].defaults(opts, { + compact: true, + settings: false, + view: false + }))); }; + /** - * Reproduce the RCSB PDB Molecule of the Month style by David S. Goodsell + * Get a string with a script to reproduce the current scene. * - * @see http://pdb101.rcsb.org/motm/motm-about + * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full + * preset information regardless of the differences with settings + * @param {boolean} [opts.settings=true] - when this flag is true, changes in settings are included + * @param {boolean} [opts.view=true] - when this flag is true, a view information is included + * @returns {string} script */ - - -Miew.prototype.motm = function () { - settings.set({ - fogColorEnable: true, - fogColor: 0x000000, - outline: { - on: true, - threshold: 0.01 - }, - bg: { - color: 0xffffff - } - }); - - this._forEachComplexVisual(function (visual) { - var rep = []; - var complex = visual.getComplex(); - var palette = palettes.get(settings.now.palette); - - for (var i = 0; i < complex.getChainCount(); i++) { - var curChainName = complex._chains[i]._name; - var curChainColor = palette.getChainColor(curChainName); - rep[i] = { - selector: "chain ".concat(curChainName), - mode: 'VW', - colorer: ['CB', { - color: curChainColor, - factor: 0.9 - }], - material: 'FL' - }; - } - - visual.resetReps(rep); - }); +Miew.prototype.getScript = function (opts) { + return options.toScript(this.getState(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].defaults(opts, { + compact: true, + settings: true, + view: true + }))); }; -Miew.prototype.VERSION = "0.9.0" ; // Uncomment this to get debug trace: -// Miew.prototype.debugTracer = new utils.DebugTracer(Miew.prototype); - -_.assign(Miew, -/** @lends Miew */ -{ - VERSION: Miew.prototype.VERSION, - registeredPlugins: [], - // export namespaces // TODO: WIP: refactoring external interface - chem: chem, - io: io, - modes: modes, - colorers: colorers, - materials: materials, - palettes: palettes, - options: options, - settings: settings, - utils: utils, - gfx: { - Representation: Representation - }, - - /** - * Third-party libraries packaged together with Miew. - * - * @property {object} lodash - [Lodash](https://lodash.com/), a modern JavaScript utility library delivering - * modularity, performance & extras. - * @property {object} three - [three.js](https://threejs.org/), JavaScript 3D library. - * - * @example - * var _ = Miew.thirdParty.lodash; - * var opts = _.merge({ ... }, Miew.options.fromURL(window.location.search)); - * var miew = new Miew(opts); +/* + * Generates object that represents the current state of representations list + * @param {boolean} compareWithDefaults - when this flag is true, reps list is compared (if possible) + * to preset's defaults and only diffs are generated */ - thirdParty: { - lodash: _, - three: THREE +Miew.prototype._compareReps = function (complexVisual, compareWithDefaults) { + const ans = {}; + let repCount = 0; + if (complexVisual) { + repCount = complexVisual.repCount(); } -}); + const currPreset = settings.defaults.presets[settings.now.preset]; + let compare = compareWithDefaults; + if (currPreset === undefined || currPreset.length > repCount) { + compare = false; + ans.preset = 'empty'; + } else if (settings.now.preset !== settings.defaults.preset) { + ans.preset = settings.now.preset; + } + const repsDiff = []; + let emptyReps = true; + for (let i = 0, n = repCount; i < n; ++i) { + repsDiff[i] = complexVisual.repGet(i).compare(compare ? currPreset[i] : null); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(repsDiff[i])) { + emptyReps = false; + } + } + if (!emptyReps) { + ans.reps = repsDiff; + } + return ans; +}; -/* eslint-disable */ -// DO NOT EDIT! Automatically generated from .jison -/* parser generated by jison 0.4.18 */ /* - Returns a Parser object of the following structure: + * Obtain object that represents current state of miew (might be used as options in constructor). + * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full + * preset information regardless of the differences with settings + * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included + * @param {boolean} [opts.view=false] - when this flag is true, a view information is included + * @returns {Object} State object. + */ +Miew.prototype.getState = function (opts) { + const state = {}; + opts = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].defaults(opts, { + compact: true, + settings: false, + view: false + }); - Parser: { - yy: {} + // load + const visual = this._getComplexVisual(); + if (visual !== null) { + const complex = visual.getComplex(); + const { + metadata + } = complex; + if (metadata.id) { + const format = metadata.format ? `${metadata.format}:` : ''; + state.load = format + metadata.id; + } + const unit = complex.getCurrentUnit(); + if (unit !== 1) { + state.unit = unit; + } } - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), + // representations + const repsInfo = this._compareReps(visual, opts.compact); + if (repsInfo.preset) { + state.preset = repsInfo.preset; + } + if (repsInfo.reps) { + state.reps = repsInfo.reps; + } - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), + // objects + const objects = this._objects; + const objectsState = []; + for (let i = 0, n = objects.length; i < n; ++i) { + objectsState[i] = objects[i].identify(); + } + if (objects.length > 0) { + state._objects = objectsState; + } - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, + // view + if (opts.view) { + state.view = this.view(); + } - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, + // settings + if (opts.settings) { + const diff = this.settings.getDiffs(false); + if (!external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isEmpty(diff)) { + state.settings = diff; } } + return state; +}; - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) +/** + * Get parameter value. + * @param {string} param - Parameter name or path (e.g. 'modes.BS.atom'). + * @param {*=} value - Default value. + * @returns {*} Parameter value. + */ +Miew.prototype.get = function (param, value) { + return settings.get(param, value); +}; +Miew.prototype._clipPlaneUpdateValue = function (radius) { + const clipPlaneValue = Math.max(this._gfx.camera.position.z - radius * settings.now.draft.clipPlaneFactor, settings.now.camNear); + const opts = { + clipPlaneValue + }; + this._forEachComplexVisual(visual => { + visual.setUberOptions(opts); + }); + for (let i = 0, n = this._objects.length; i < n; ++i) { + const obj = this._objects[i]; + if (obj._line) { + obj._line.material.setUberOptions(opts); + } } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) + if (this._picker !== null) { + this._picker.clipPlaneValue = clipPlaneValue; } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) +}; +Miew.prototype._fogFarUpdateValue = function () { + if (this._picker !== null) { + if (this._gfx.scene.fog) { + this._picker.fogFarValue = this._gfx.scene.fog.far; + } else { + this._picker.fogFarValue = undefined; + } } -*/ -var parser$1 = (function(){ -var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,60],$V1=[1,62],$V2=[1,63],$V3=[1,65],$V4=[1,66],$V5=[1,67],$V6=[1,68],$V7=[1,69],$V8=[1,80],$V9=[1,72],$Va=[1,73],$Vb=[1,74],$Vc=[1,75],$Vd=[1,99],$Ve=[1,76],$Vf=[1,100],$Vg=[1,79],$Vh=[1,51],$Vi=[1,81],$Vj=[1,82],$Vk=[1,84],$Vl=[1,83],$Vm=[1,85],$Vn=[1,96],$Vo=[1,97],$Vp=[1,98],$Vq=[1,86],$Vr=[1,87],$Vs=[1,64],$Vt=[1,70],$Vu=[1,71],$Vv=[1,77],$Vw=[1,78],$Vx=[1,53],$Vy=[1,54],$Vz=[1,55],$VA=[1,61],$VB=[1,88],$VC=[1,89],$VD=[1,90],$VE=[1,91],$VF=[1,92],$VG=[1,93],$VH=[1,94],$VI=[1,95],$VJ=[1,101],$VK=[1,102],$VL=[1,103],$VM=[1,104],$VN=[1,105],$VO=[1,56],$VP=[1,57],$VQ=[1,58],$VR=[1,59],$VS=[1,115],$VT=[1,111],$VU=[1,114],$VV=[1,112],$VW=[1,113],$VX=[1,118],$VY=[1,117],$VZ=[1,134],$V_=[1,149],$V$=[1,150],$V01=[1,157],$V11=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V21=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,71,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V31=[5,6,7,9,13,15,17,18,19,20,23,25,26,27,30,33,34,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95],$V41=[5,70,72],$V51=[5,74],$V61=[71,101]; -var parser = {trace: function trace () { }, -yy: {}, -symbols_: {"error":2,"Program":3,"Command":4,"EOF":5,"RESET":6,"BUILD":7,"ALL":8,"HELP":9,"Path":10,"MOTM":11,"OneArgCommand":12,"GET":13,"STRING":14,"SET":15,"Value":16,"SET_SAVE":17,"SET_RESTORE":18,"SET_RESET":19,"PRESET":20,"AddRepresentation":21,"EditRepresentation":22,"REMOVE":23,"RepresentationReference":24,"HIDE":25,"SHOW":26,"LIST":27,"EXPAND_KEY":28,"SELECTOR_KEY":29,"SELECT":30,"AS":31,"WordAll":32,"SELECTOR":33,"WITHIN":34,"NUMBER":35,"OF":36,"MATERIAL":37,"IDENTIFIER":38,"ModeCMD":39,"ColorCMD":40,"VIEW":41,"BASE_64":42,"UNIT":43,"DSSP":44,"SCALE":45,"ROTATE":46,"AxesList":47,"TRANSLATE":48,"CENTER":49,"GetURLBranch":50,"Screenshot":51,"LINE":52,"ArgList":53,"LISTOBJ":54,"REMOVEOBJ":55,"URL":56,"VIEW_KEY":57,"SCREENSHOT":58,"LOAD":59,"Url":60,"FILE_KEY":61,"ADD":62,"Description":63,"REP":64,"MODE":65,"COLOR":66,"Descriptor":67,"RepresentationOwnProperty":68,"RepresentationOwnPropertyOpts":69,"DESC_KEY":70,"=":71,"DESC_KEY_OPTS":72,"AxesArg":73,"DESC_KEY_AXES":74,"Arg":75,"PathWoDescKey":76,"HEX":77,"BOOL":78,"Word":79,"CommandSetWoDESC_KEY":80,"DescKeys":81,"CLEAR":82,"FILE_LIST":83,"FILE_REGISTER":84,"FILE_DELETE":85,"PRESET_ADD":86,"PRESET_DELETE":87,"PRESET_UPDATE":88,"PRESET_RENAME":89,"PRESET_OPEN":90,"CREATE_SCENARIO":91,"RESET_SCENARIO":92,"DELETE_SCENARIO":93,"ADD_SCENARIO_ITEM":94,"LIST_SCENARIO":95,"PDB_KEY":96,"DELAY_KEY":97,"PRST_KEY":98,"DESCRIPTION_KEY":99,"CommandSet":100,".":101,"PresetPath":102,"/":103,"HexOrNumber":104,"$accept":0,"$end":1}, -terminals_: {2:"error",5:"EOF",6:"RESET",7:"BUILD",8:"ALL",9:"HELP",11:"MOTM",13:"GET",14:"STRING",15:"SET",17:"SET_SAVE",18:"SET_RESTORE",19:"SET_RESET",20:"PRESET",23:"REMOVE",25:"HIDE",26:"SHOW",27:"LIST",28:"EXPAND_KEY",29:"SELECTOR_KEY",30:"SELECT",31:"AS",33:"SELECTOR",34:"WITHIN",35:"NUMBER",36:"OF",37:"MATERIAL",38:"IDENTIFIER",41:"VIEW",42:"BASE_64",43:"UNIT",44:"DSSP",45:"SCALE",46:"ROTATE",48:"TRANSLATE",49:"CENTER",52:"LINE",54:"LISTOBJ",55:"REMOVEOBJ",56:"URL",57:"VIEW_KEY",58:"SCREENSHOT",59:"LOAD",61:"FILE_KEY",62:"ADD",64:"REP",65:"MODE",66:"COLOR",70:"DESC_KEY",71:"=",72:"DESC_KEY_OPTS",74:"DESC_KEY_AXES",77:"HEX",78:"BOOL",82:"CLEAR",83:"FILE_LIST",84:"FILE_REGISTER",85:"FILE_DELETE",86:"PRESET_ADD",87:"PRESET_DELETE",88:"PRESET_UPDATE",89:"PRESET_RENAME",90:"PRESET_OPEN",91:"CREATE_SCENARIO",92:"RESET_SCENARIO",93:"DELETE_SCENARIO",94:"ADD_SCENARIO_ITEM",95:"LIST_SCENARIO",96:"PDB_KEY",97:"DELAY_KEY",98:"PRST_KEY",99:"DESCRIPTION_KEY",101:".",103:"/"}, -productions_: [0,[3,2],[3,1],[4,1],[4,1],[4,2],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,3],[4,3],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[4,2],[4,1],[4,2],[4,2],[4,2],[4,4],[4,2],[4,6],[4,2],[4,1],[4,1],[4,1],[4,2],[4,2],[4,1],[4,2],[4,1],[4,2],[4,2],[4,2],[4,1],[4,2],[4,1],[4,1],[4,3],[4,3],[4,4],[4,4],[4,1],[4,2],[50,1],[50,2],[50,2],[50,3],[50,3],[51,1],[51,2],[51,3],[12,2],[12,2],[12,2],[21,1],[21,2],[21,2],[21,3],[22,2],[22,3],[39,2],[39,3],[40,2],[40,3],[24,1],[24,1],[63,1],[63,2],[63,3],[63,4],[67,1],[67,1],[67,2],[68,3],[69,3],[47,1],[47,2],[73,2],[53,1],[53,2],[75,3],[16,1],[16,1],[16,1],[16,1],[16,1],[79,1],[79,1],[32,1],[32,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[100,1],[100,1],[76,1],[76,3],[76,3],[10,1],[10,1],[10,3],[10,3],[10,3],[60,1],[102,1],[102,3],[104,1],[104,1]], -performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { -/* this == yyval */ - -var $0 = $$.length - 1; -switch (yystate) { -case 1: - return $$[$0-1]; -case 3: -this.$ = yy.miew.reset(false); yy.ClearContext(); yy.miew.resetReps("empty"); -break; -case 4: -this.$ = yy.miew.rebuild(); -break; -case 5: -this.$ = yy.miew.rebuildAll(); yy.miew.rebuild(); -break; -case 6: -this.$ = yy.echo(yy.utils.help().toString()); -break; -case 7: -this.$ = yy.echo(yy.utils.help($$[$0]).toString()); -break; -case 8: -this.$ = yy.miew.motm(); -break; -case 10: case 11: -this.$ = yy.utils.propagateProp($$[$0]); yy.echo(yy.miew.get($$[$0]).toString()); -break; -case 12: case 13: -this.$ = yy.miew.set($$[$0-1], yy.utils.propagateProp($$[$0-1], $$[$0]));break; -case 14: -this.$ = yy.miew.saveSettings();break; -case 15: -this.$ = yy.miew.restoreSettings();break; -case 16: -this.$ = yy.miew.resetSettings();break; -case 17: -this.$ = yy.miew.resetReps(); -break; -case 18: -this.$ = yy.miew.applyPreset($$[$0]); -break; -case 21: -this.$ = yy.miew.repRemove($$[$0]); yy.representations.remove($$[$0]); -break; -case 22: -this.$ = yy.miew.repHide($$[$0]); -break; -case 23: -this.$ = yy.miew.repHide($$[$0], false); -break; -case 24: -this.$ = yy.echo(yy.utils.listRep(yy.miew, yy.representations, $$[$0], '-e')); -break; -case 25: -this.$ = yy.echo(yy.utils.list(yy.miew, yy.representations)); -break; -case 26: -this.$ = yy.echo(yy.utils.list(yy.miew, yy.representations, $$[$0])); -break; -case 27: -this.$ = yy.echo(yy.utils.listSelector(yy.miew, yy.Context)); -break; -case 28: -this.$ = yy.miew.select(yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0], true)); -break; -case 29: -this.$ = yy.Context[$$[$0].toLowerCase()] = yy.utils.checkArg($$[$0-3].toLowerCase(), $$[$0-2], true); yy.miew.select(yy.Context[$$[$0].toLowerCase()]); -break; -case 30: -this.$ = yy.miew.rep(yy.miew.repCurrent(), {selector : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0])}); -break; -case 31: -this.$ = yy.Context[$$[$0].toLowerCase()] = yy.miew.within(yy.utils.checkArg("select", $$[$0-2], true), Number($$[$0-4])); -break; -case 32: -this.$ = yy.miew.rep(yy.miew.repCurrent(), {material : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())}); -break; -case 35: -this.$ = yy.echo(yy.miew.view()); -break; -case 36: case 37: -this.$ = yy.miew.view($$[$0]); -break; -case 38: -this.$ = yy.echo(yy.miew.changeUnit()); -break; -case 39: -this.$ = yy.echo(yy.miew.changeUnit($$[$0])); -break; -case 40: -this.$ = yy.miew.dssp(); -break; -case 41: -this.$ = yy.miew.scale($$[$0]); -break; -case 42: - for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.rotate($$[$0][i]['x'] * Math.PI / 180.0, $$[$0][i]['y'] * Math.PI / 180.0, $$[$0][i]['z'] * Math.PI / 180.0);} -break; -case 43: - for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.translate($$[$0][i]['x'] || 0, $$[$0][i]['y'] || 0, $$[$0][i]['z'] || 0);} -break; -case 44: -this.$ = yy.miew.center(); -break; -case 45: -this.$ = yy.miew.center($$[$0]); -break; -case 48: case 49: -this.$ = yy.miew.addObject({type: 'line', params: [$$[$0-1], $$[$0]]}, true); -break; -case 50: case 51: -this.$ = yy.miew.addObject({type: 'line', params: [$$[$0-2], $$[$0-1]], opts:$$[$0].toJSO(yy.utils, 'objects', 'line')}, true); -break; -case 52: -this.$ = yy.echo(yy.utils.listObjs(yy.miew)); -break; -case 53: -this.$ = yy.miew.removeObject($$[$0]); -break; -case 54: -this.$ = yy.echo(yy.miew.getURL({view: false, settings: false})); -break; -case 55: -this.$ = yy.echo(yy.miew.getURL({view: false, settings: true})); -break; -case 56: -this.$ = yy.echo(yy.miew.getURL({view: true, settings: false})); -break; -case 57: case 58: -this.$ = yy.echo(yy.miew.getURL({view: true, settings: true})); -break; -case 59: -this.$ = yy.miew.screenshotSave(); -break; -case 60: -this.$ = yy.miew.screenshotSave('', Number($$[$0])); -break; -case 61: -this.$ = yy.miew.screenshotSave('', Number($$[$0-1]), Number($$[$0])); -break; -case 62: case 63: case 64: -this.$ = yy.utils.load(yy.miew, $$[$0]); yy.representations.clear(); -break; -case 65: -this.$ = yy.echo(yy.representations.add(yy.miew.repAdd())); -break; -case 66: -this.$ = yy.echo(yy.representations.add($$[$0], yy.miew.repAdd())); -break; -case 67: -this.$ = yy.echo(yy.representations.add(yy.miew.repAdd($$[$0]))); -break; -case 68: -this.$ = yy.echo(yy.representations.add($$[$0-1], yy.miew.repAdd($$[$0]))); -break; -case 69: -this.$ = yy.miew.rep($$[$0]); yy.miew.repCurrent($$[$0]); -break; -case 70: -this.$ = yy.miew.rep($$[$0-1], $$[$0]); yy.miew.repCurrent($$[$0-1]); -break; -case 71: -this.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())}); -break; -case 72: -this.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))}); -break; -case 73: -this.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())}); -break; -case 74: -this.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))}); -break; -case 75: -this.$ = Number(yy.representations.get($$[$0])); -break; -case 76: case 92: -this.$ = Number($$[$0]); -break; -case 77: -this.$ = $$[$0]; -break; -case 78: -this.$ = yy._.assign($$[$0-1], $$[$0]); -break; -case 79: -this.$ = yy._.assign($$[$0-2], $$[$0-1], $$[$0]); -break; -case 80: -this.$ = yy._.assign($$[$0-3], $$[$0-2], $$[$0-1], $$[$0]); -break; -case 81: case 82: -this.$ = yy.CreateObjectPair($$[$0].key, $$[$0].val); -break; -case 83: -this.$ = yy.CreateObjectPair($$[$0-1].key, new Array($$[$0-1].val, $$[$0].toJSO(yy.utils, $$[$0-1].key, $$[$0-1].val))); -break; -case 84: case 85: -this.$ = Object.create({'key': yy.keyRemap($$[$0-2]), 'val': yy.utils.checkArg($$[$0-2], $$[$0])}); -break; -case 86: -this.$ = [$$[$0]]; -break; -case 87: -this.$ = $$[$0-1].concat($$[$0]); -break; -case 88: -this.$ = yy.CreateObjectPair($$[$0-1].toLowerCase(), Number($$[$0])); -break; -case 89: -this.$ = new yy.ArgList($$[$0]); -break; -case 90: -this.$ = $$[$0-1].append($$[$0]); -break; -case 91: -this.$ = new yy.Arg($$[$0-2], $$[$0]); -break; -case 93: -this.$ = parseInt($$[$0]); -break; -case 94: -this.$ = JSON.parse($$[$0]); -break; -case 95: case 96: -this.$ = String($$[$0]); -break; -case 157: case 158: case 161: case 162: case 163: -this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; //cause of could be color word in path; -break; -case 166: -this.$ = $$[$0-2] = $$[$0-2] + $$[$0-1] + $$[$0]; -break; -} -}, -table: [{3:1,4:2,5:[1,3],6:[1,4],7:[1,5],9:[1,6],11:[1,7],12:8,13:[1,9],15:[1,10],17:[1,11],18:[1,12],19:[1,13],20:[1,14],21:15,22:16,23:[1,17],25:[1,18],26:[1,19],27:[1,20],30:[1,21],33:[1,22],34:[1,23],37:[1,24],39:25,40:26,41:[1,27],43:[1,28],44:[1,29],45:[1,30],46:[1,31],48:[1,32],49:[1,33],50:34,51:35,52:[1,36],54:[1,37],55:[1,38],56:[1,44],58:[1,45],59:[1,39],62:[1,40],64:[1,41],65:[1,42],66:[1,43]},{1:[3]},{5:[1,46]},{1:[2,2]},{5:[2,3]},{5:[2,4],8:[1,47]},{5:[2,6],6:$V0,7:$V1,9:$V2,10:48,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,8]},{5:[2,9]},{6:$V0,7:$V1,9:$V2,10:106,13:$V3,14:[1,107],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{6:$V0,7:$V1,9:$V2,10:108,13:$V3,14:[1,109],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,14]},{5:[2,15]},{5:[2,16]},{5:[2,17],14:$VS,16:110,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,19]},{5:[2,20]},{24:116,35:$VX,38:$VY},{24:119,35:$VX,38:$VY},{24:120,35:$VX,38:$VY},{5:[2,25],24:121,28:[1,122],29:[1,123],35:$VX,38:$VY},{14:[1,124]},{14:[1,125]},{35:[1,126]},{38:[1,127]},{5:[2,33]},{5:[2,34]},{5:[2,35],14:[1,128],42:[1,129]},{5:[2,38],35:[1,130]},{5:[2,40]},{35:[1,131]},{47:132,73:133,74:$VZ},{47:135,73:133,74:$VZ},{5:[2,44],14:[1,136]},{5:[2,46]},{5:[2,47]},{6:$V0,7:$V1,9:$V2,10:138,13:$V3,14:[1,137],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,52]},{35:[1,139]},{14:[1,143],38:[1,141],60:140,61:[1,142]},{5:[2,65],38:[1,144],63:145,67:146,68:147,69:148,70:$V_,72:$V$},{24:151,35:$VX,38:$VY},{38:[1,152]},{38:[1,153]},{5:[2,54],29:[1,154],57:[1,155]},{5:[2,59],35:[1,156]},{1:[2,1]},{5:[2,5]},{5:[2,7],101:$V01},o($V11,[2,159]),o($V11,[2,160]),o($V21,[2,97]),o($V21,[2,98]),o($V11,[2,147]),o($V11,[2,148]),o($V11,[2,149]),o($V11,[2,150]),o($V11,[2,151]),o($V11,[2,152]),o($V11,[2,153]),o($V21,[2,101]),o($V21,[2,102]),o($V21,[2,103]),o($V21,[2,104]),o($V21,[2,105]),o($V21,[2,106]),o($V21,[2,107]),o($V21,[2,108]),o($V21,[2,109]),o($V21,[2,110]),o($V21,[2,111]),o($V21,[2,112]),o($V21,[2,113]),o($V21,[2,114]),o($V21,[2,115]),o($V21,[2,116]),o($V21,[2,117]),o($V21,[2,118]),o($V21,[2,119]),o($V21,[2,120]),o($V21,[2,121]),o($V21,[2,122]),o($V21,[2,123]),o($V21,[2,124]),o($V21,[2,125]),o($V21,[2,126]),o($V21,[2,127]),o($V21,[2,128]),o($V21,[2,129]),o($V21,[2,130]),o($V21,[2,131]),o($V21,[2,132]),o($V21,[2,133]),o($V21,[2,134]),o($V21,[2,135]),o($V21,[2,136]),o($V21,[2,137]),o($V21,[2,138]),o($V21,[2,139]),o($V21,[2,140]),o($V21,[2,141]),o($V21,[2,142]),o($V21,[2,143]),o($V21,[2,144]),o($V21,[2,145]),o($V21,[2,146]),{5:[2,10],101:$V01},{5:[2,11]},{14:$VS,16:158,35:$VT,38:$VU,77:$VV,78:$VW,101:$V01},{14:$VS,16:159,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,18]},o($V31,[2,92]),o($V31,[2,93]),o($V31,[2,94]),o($V31,[2,95]),o($V31,[2,96]),{5:[2,21]},o($V41,[2,75]),o($V41,[2,76]),{5:[2,22]},{5:[2,23]},{5:[2,24]},{5:[2,26]},{5:[2,27]},{5:[2,28],31:[1,160]},{5:[2,30]},{36:[1,161]},{5:[2,32]},{5:[2,36]},{5:[2,37]},{5:[2,39]},{5:[2,41]},{5:[2,42],73:162,74:$VZ},o($V51,[2,86]),{35:[1,163]},{5:[2,43],73:162,74:$VZ},{5:[2,45]},{14:[1,164]},{6:$V0,7:$V1,9:$V2,10:165,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR,101:$V01},{5:[2,53]},{5:[2,62]},{5:[2,63]},{5:[2,64]},{5:[2,164]},{5:[2,66],63:166,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,67]},{5:[2,77],67:167,68:147,69:148,70:$V_,72:$V$},o($V41,[2,81]),o($V41,[2,82],{80:52,53:168,75:169,76:170,79:171,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),{71:[1,172]},{71:[1,173]},{5:[2,69],63:174,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,71],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:175,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,73],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:176,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,55],57:[1,177]},{5:[2,56],29:[1,178]},{5:[2,60],35:[1,179]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,181],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:180,80:52,81:182,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,12]},{5:[2,13]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:183,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{14:[1,186]},o($V51,[2,87]),o($V51,[2,88]),{5:[2,48],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:187,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,49],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:188,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,101:$V01},{5:[2,68]},{5:[2,78],67:189,68:147,69:148,70:$V_,72:$V$},o($V41,[2,83],{80:52,76:170,79:171,75:190,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),o($V31,[2,89]),{71:[1,191],101:[1,192]},o($V61,[2,156]),{14:$VS,16:193,35:$VT,38:$VU,77:$VV,78:$VW},{14:$VS,16:194,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,70]},{5:[2,72],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,74],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,57]},{5:[2,58]},{5:[2,61]},o($V11,[2,161]),o($V11,[2,162]),o($V11,[2,163]),{5:[2,29]},{5:[2,99]},{5:[2,100]},{31:[1,195]},{5:[2,50],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,51],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,79],67:196,68:147,69:148,70:$V_,72:$V$},o($V31,[2,90]),{14:$VS,16:197,35:$VT,38:$VU,77:$VV,78:$VW},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,199],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,79:198,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},o($V41,[2,84]),o($V31,[2,85]),{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:200,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,80]},o($V31,[2,91]),o($V61,[2,157]),o($V61,[2,158]),{5:[2,31]}], -defaultActions: {3:[2,2],4:[2,3],7:[2,8],8:[2,9],11:[2,14],12:[2,15],13:[2,16],15:[2,19],16:[2,20],25:[2,33],26:[2,34],29:[2,40],34:[2,46],35:[2,47],37:[2,52],46:[2,1],47:[2,5],107:[2,11],110:[2,18],116:[2,21],119:[2,22],120:[2,23],121:[2,24],122:[2,26],123:[2,27],125:[2,30],127:[2,32],128:[2,36],129:[2,37],130:[2,39],131:[2,41],136:[2,45],139:[2,53],140:[2,62],141:[2,63],142:[2,64],143:[2,164],145:[2,67],158:[2,12],159:[2,13],166:[2,68],174:[2,70],177:[2,57],178:[2,58],179:[2,61],183:[2,29],184:[2,99],185:[2,100],196:[2,80],200:[2,31]}, -parseError: function parseError (str, hash) { - if (hash.recoverable) { - this.trace(str); +}; +Miew.prototype._updateShadowmapMeshes = function (process) { + this._forEachComplexVisual(visual => { + const reprList = visual._reprList; + for (let i = 0, n = reprList.length; i < n; ++i) { + const repr = reprList[i]; + process(repr.geo, repr.material); + } + }); +}; +Miew.prototype._updateMaterials = function (values) { + let needTraverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + let process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + this._forEachComplexVisual(visual => visual.setMaterialValues(values, needTraverse, process)); + for (let i = 0, n = this._objects.length; i < n; ++i) { + const obj = this._objects[i]; + if (obj._line) { + obj._line.material.setValues(values); + obj._line.material.needsUpdate = true; + } + } +}; +Miew.prototype._fogAlphaChanged = function () { + this._forEachComplexVisual(visual => { + visual.setUberOptions({ + fogAlpha: settings.now.fogAlpha + }); + }); +}; +Miew.prototype._embedWebXR = function () { + // switch off + if (settings.now.stereo !== 'WEBVR') { + if (this.webVR) { + this.webVR.disable(); + } + this.webVR = null; + return; + } + // switch on + if (!this.webVR) { + this.webVR = new WebVRPoC(() => { + this._requestAnimationFrame(() => this._onTick()); + this._needRender = true; + this._onResize(); + }); + } + this.webVR.enable(this._gfx); +}; +Miew.prototype._initOnSettingsChanged = function () { + const on = (props, func) => { + props = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isArray(props) ? props : [props]; + props.forEach(prop => { + this.settings.addEventListener(`change:${prop}`, func); + }); + }; + on('modes.VD.frame', () => { + const volume = this._getVolumeVisual(); + if (volume === null) return; + volume.showFrame(settings.now.modes.VD.frame); + this._needRender = true; + }); + on('modes.VD.isoMode', () => { + const volume = this._getVolumeVisual(); + if (volume === null) return; + volume.getMesh().material.updateDefines(); + this._needRender = true; + }); + on('bg.color', () => { + this._onBgColorChanged(); + }); + on('ao', () => { + if (settings.now.ao && !isAOSupported(this._gfx.renderer.getContext())) { + this.logger.warn('Your device or browser does not support ao'); + settings.set('ao', false); } else { - var error = new Error(str); - error.hash = hash; - throw error; + const values = { + normalsToGBuffer: settings.now.ao + }; + this._setUberMaterialValues(values); } -}, -parse: function parse(input) { - var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; - var args = lstack.slice.call(arguments, 1); - var lexer = Object.create(this.lexer); - var sharedState = { yy: {} }; - for (var k in this.yy) { - if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState.yy[k] = this.yy[k]; - } + }); + on('zSprites', () => { + if (settings.now.zSprites && !arezSpritesSupported(this._gfx.renderer.getContext())) { + this.logger.warn('Your device or browser does not support zSprites'); + settings.set('zSprites', false); } - lexer.setInput(input, sharedState.yy); - sharedState.yy.lexer = lexer; - sharedState.yy.parser = this; - if (typeof lexer.yylloc == 'undefined') { - lexer.yylloc = {}; + this.rebuildAll(); + }); + on('fogColor', () => { + this._onFogColorChanged(); + }); + on('fogColorEnable', () => { + this._onFogColorChanged(); + }); + on('bg.transparent', evt => { + const gfx = this._gfx; + if (gfx) { + gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent)); } - var yyloc = lexer.yylloc; - lstack.push(yyloc); - var ranges = lexer.options && lexer.options.ranges; - if (typeof sharedState.yy.parseError === 'function') { - this.parseError = sharedState.yy.parseError; + // update materials + this._updateMaterials({ + fogTransparent: evt.value + }); + this.rebuildAll(); + }); + on('draft.clipPlane', evt => { + // update materials + this._updateMaterials({ + clipPlane: evt.value + }); + this.rebuildAll(); + }); + on('shadow.on', evt => { + // update materials + const values = { + shadowmap: evt.value, + shadowmapType: settings.now.shadow.type + }; + const gfx = this._gfx; + if (gfx) { + gfx.renderer.shadowMap.enabled = Boolean(values.shadowmap); + } + this._updateMaterials(values, true); + if (values.shadowmap) { + this._updateShadowCamera(); + this._updateShadowmapMeshes(meshutils.createShadowmapMaterial); } else { - this.parseError = Object.getPrototypeOf(this).parseError; + this._updateShadowmapMeshes(meshutils.removeShadowmapMaterial); } - function lex() { - var token; - token = tstack.pop() || lexer.lex() || EOF; - if (typeof token !== 'number') { - if (token instanceof Array) { - tstack = token; - token = tstack.pop(); - } - token = self.symbols_[token] || token; - } - return token; - } - var symbol, state, action, r, yyval = {}, p, len, newState, expected; - while (true) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); - } - action = table[state] && table[state][symbol]; - } - if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr = ''; - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push('\'' + this.terminals_[p] + '\''); - } - } - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); - } - this.parseError(errStr, { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected - }); - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(lexer.yytext); - lstack.push(lexer.yylloc); - stack.push(action[1]); - symbol = null; - { - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - if (ranges) { - yyval._$.range = [ - lstack[lstack.length - (len || 1)].range[0], - lstack[lstack.length - 1].range[1] - ]; - } - r = this.performAction.apply(yyval, [ - yytext, - yyleng, - yylineno, - sharedState.yy, - action[1], - vstack, - lstack - ].concat(args)); - if (typeof r !== 'undefined') { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; - } + this._needRender = true; + }); + on('shadow.type', evt => { + // update materials if shadowmap is enable + if (settings.now.shadow.on) { + this._updateMaterials({ + shadowmapType: evt.value + }, true); + this._needRender = true; } - return true; -}}; - - -/* generated by jison-lex 0.3.4 */ -var lexer = (function(){ -var lexer = ({ - -EOF:1, - -parseError:function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, - -// resets the lexer, sets new input -setInput:function (input, yy) { - this.yy = yy || this.yy || {}; - this._input = input; - this._more = this._backtrack = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - if (this.options.ranges) { - this.yylloc.range = [0,0]; - } - this.offset = 0; - return this; - }, - -// consumes and returns one char from the input -input:function () { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) { - this.yylloc.range[1]++; - } - - this._input = this._input.slice(1); - return ch; - }, - -// unshifts one char (or a string) into the input -unput:function (ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - var r = this.yylloc.range; - - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - this.yyleng = this.yytext.length; - return this; - }, + }); + on('shadow.radius', evt => { + for (let i = 0; i < this._gfx.scene.children.length; i++) { + if (this._gfx.scene.children[i].shadow !== undefined) { + const light = this._gfx.scene.children[i]; + light.shadow.radius = evt.value; + this._needRender = true; + } + } + }); + on('fps', () => { + this._fps.show(settings.now.fps); + }); + on(['fog', 'fogNearFactor', 'fogFarFactor'], () => { + this._updateFog(); + this._needRender = true; + }); + on('fogAlpha', () => { + const { + fogAlpha + } = settings.now; + if (fogAlpha < 0 || fogAlpha > 1) { + this.logger.warn('fogAlpha must belong range [0,1]'); + } + this._fogAlphaChanged(); + this._needRender = true; + }); + on('autoResolution', evt => { + if (evt.value && !this._gfxScore) { + this.logger.warn('Benchmarks are missed, autoresolution will not work! ' + 'Autoresolution should be set during miew startup.'); + } + }); + on('stereo', () => { + this._embedWebXR(settings.now.stereo === 'WEBVR'); + this._needRender = true; + }); + on(['transparency', 'palette'], () => { + this.rebuildAll(); + }); + on('resolution', () => { + // update complex visuals + this.rebuildAll(); -// When called from action, caches matched text and appends it on next action -more:function () { - this._more = true; - return this; - }, + // update volume visual + const volume = this._getVolumeVisual(); + if (volume) { + volume.getMesh().material.updateDefines(); + this._needRender = true; + } + }); + on(['axes', 'fxaa', 'ao', 'outline.on', 'outline.color', 'outline.threshold', 'outline.thickness'], () => { + this._needRender = true; + }); +}; -// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. -reject:function () { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); +/** + * Set parameter value. + * @param {string|object} params - Parameter name or path (e.g. 'modes.BS.atom') or even settings object. + * @param {*=} value - Value. + */ +Miew.prototype.set = function (params, value) { + settings.set(params, value); +}; - } - return this; - }, +/** + * Select atoms with selection string. + * @param {string} expression - string expression of selection + * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection + */ +Miew.prototype.select = function (expression, append) { + const visual = this._getComplexVisual(); + if (!visual) { + return; + } + let sel = expression; + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isString(expression)) { + sel = Miew_selectors.parse(expression).selector; + } + visual.select(sel, append); + this._lastPick = null; + this._updateInfoPanel(); + this._needRender = true; +}; +const VIEW_VERSION = '1'; -// retain first n characters of the match -less:function (n) { - this.unput(this.match.slice(n)); - }, +/** + * Get or set view info packed into string. + * + * **Note:** view is stored for *left-handed* cs, euler angles are stored in radians and *ZXY-order*, + * + * @param {string=} expression - Optional string encoded the view + */ +Miew.prototype.view = function (expression) { + const self = this; + const { + pivot + } = this._gfx; + let transform = []; + const eulerOrder = 'ZXY'; + function encode() { + const pos = pivot.position; + const scale = self._objectControls.getScale() / settings.now.radiusToFit; + const euler = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Euler(); + euler.setFromQuaternion(self._objectControls.getOrientation(), eulerOrder); + transform = [pos.x, pos.y, pos.z, scale, euler.x, euler.y, euler.z]; + return VIEW_VERSION + utils.arrayToBase64(transform, Float32Array); + } + function decode() { + // backwards compatible: old non-versioned view is the 0th version + if (expression.length === 40) { + expression = `0${expression}`; + } + const version = expression[0]; + transform = utils.arrayFromBase64(expression.substr(1), Float32Array); -// displays already matched input, i.e. for error messages -pastInput:function () { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); - }, + // apply adapter for old versions + if (version !== VIEW_VERSION) { + if (version === '0') { + // cancel radiusToFit included in old views + transform[3] /= 8.0; + } else { + // do nothing + self.logger.warn(`Encoded view version mismatch, stored as ${version} vs ${VIEW_VERSION} expected`); + return; + } + } + const interpolator = self._interpolator; + const srcView = interpolator.createView(); + srcView.position.copy(pivot.position); + srcView.scale = self._objectControls.getScale(); + srcView.orientation.copy(self._objectControls.getOrientation()); + const dstView = interpolator.createView(); + dstView.position.set(transform[0], transform[1], transform[2]); -// displays upcoming input, i.e. for error messages -upcomingInput:function () { - var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20-next.length); - } - return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); - }, + // hack to make preset views work after we moved centering offset to visual nodes + // FIXME should only store main pivot offset in preset + if (self._getComplexVisual()) { + dstView.position.sub(self._getComplexVisual().position); + } + dstView.scale = transform[3]; // eslint-disable-line prefer-destructuring + dstView.orientation.setFromEuler(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Euler(transform[4], transform[5], transform[6], eulerOrder)); + interpolator.setup(srcView, dstView); + } + if (typeof expression === 'undefined') { + return encode(); + } + decode(); + return expression; +}; -// displays the character position where the lexing error occurred, i.e. for error messages -showPosition:function () { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; - }, +/* + * Update current view due to viewinterpolator state + */ +Miew.prototype._updateView = function () { + const self = this; + const { + pivot + } = this._gfx; + const interpolator = this._interpolator; + if (!interpolator.wasStarted()) { + interpolator.start(); + } + if (!interpolator.isMoving()) { + return; + } + const res = interpolator.getCurrentView(); + if (res.success) { + const curr = res.view; + pivot.position.copy(curr.position); + self._objectControls.setScale(curr.scale * settings.now.radiusToFit); + self._objectControls.setOrientation(curr.orientation); + this.dispatchEvent({ + type: 'transform' + }); + self._needRender = true; + } +}; -// test the lexed token: return FALSE when not a match, otherwise return token -test_match:function(match, indexed_rule) { - var token, - lines, - backup; +/** + * Translate object by vector + * @param {number} x - translation value (Ang) along model's X axis + * @param {number} y - translation value (Ang) along model's Y axis + * @param {number} z - translation value (Ang) along model's Z axis + */ +Miew.prototype.translate = function (x, y, z) { + this._objectControls.translatePivot(x, y, z); + this.dispatchEvent({ + type: 'transform' + }); + this._needRender = true; +}; - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } +/** + * Rotate object by Euler angles + * @param {number} x - rotation angle around X axis in radians + * @param {number} y - rotation angle around Y axis in radians + * @param {number} z - rotation angle around Z axis in radians + */ +Miew.prototype.rotate = function (x, y, z) { + this._objectControls.rotate(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Quaternion().setFromEuler(new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Euler(x, y, z, 'XYZ'))); + this.dispatchEvent({ + type: 'transform' + }); + this._needRender = true; +}; - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; - } - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : - this.yylloc.last_column + match[0].length - }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); - if (this.done && this._input) { - this.done = false; - } - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - return false; // rule action called reject() implying the next rule should be tested instead. - } - return false; - }, +/** + * Scale object by factor + * @param {number} factor - scale multiplier, should greater than zero + */ +Miew.prototype.scale = function (factor) { + if (factor <= 0) { + throw new RangeError('Scale should be greater than zero'); + } + this._objectControls.scale(factor); + this.dispatchEvent({ + type: 'transform' + }); + this._needRender = true; +}; -// return next match in input -next:function () { - if (this.done) { - return this.EOF; - } - if (!this._input) { - this.done = true; - } +/** + * Center view on selection + * @param {empty | subset | string} selector - defines part of molecule which must be centered ( + * empty - center on current selection; + * subset - center on picked atom/residue/molecule; + * string - center on atoms correspond to selection string) + */ +Miew.prototype.center = function (selector) { + // no arguments - center on current selection; + if (selector === undefined) { + this.setPivotSubset(); + this._needRender = true; + return; + } + // subset with atom or residue - center on picked atom/residue; + if (selector.obj !== undefined && ('atom' in selector.obj || 'residue' in selector.obj)) { + // from event with selection + if ('atom' in selector.obj) { + this.setPivotAtom(selector.obj.atom); + } else { + this.setPivotResidue(selector.obj.residue); + } + this._needRender = true; + return; + } + // string - center on atoms correspond to selection string + if (selector.obj === undefined && selector !== '') { + const sel = Miew_selectors.parse(selector); + if (sel.error === undefined) { + this.setPivotSubset(sel); + this._needRender = true; + return; + } + } + // empty subset or incorrect/empty string - center on all molecule; + this.resetPivot(); + this._needRender = true; +}; - var token, - match, - tempMatch, - index; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); - if (token !== false) { - return token; - } else if (this._backtrack) { - match = false; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - if (match) { - token = this.test_match(match, rules[index]); - if (token !== false) { - return token; - } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - if (this._input === "") { - return this.EOF; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - } - }, +/** + * Build selector that contains all atoms within given distance from group of atoms + * @param {Selector} selector - selector describing source group of atoms + * @param {number} radius - distance + * @returns {Selector} selector describing result group of atoms + */ +Miew.prototype.within = function (selector, radius) { + const visual = this._getComplexVisual(); + if (!visual) { + return Miew_selectors.None(); + } + if (selector instanceof String) { + selector = Miew_selectors.parse(selector); + } + const res = visual.within(selector, radius); + if (res) { + visual.rebuildSelectionGeometry(); + this._needRender = true; + } + return res; +}; -// return next match that has a token -lex:function lex () { - var r = this.next(); - if (r) { - return r; - } else { - return this.lex(); - } - }, +/** + * Get atom position in 2D canvas coords + * @param {string} fullAtomName - full atom name, like A.38.CG + * @returns {Object} {x, y} or false if atom not found + */ +Miew.prototype.projected = function (fullAtomName, complexName) { + const visual = this._getComplexVisual(complexName); + if (!visual) { + return false; + } + const atom = visual.getComplex().getAtomByFullname(fullAtomName); + if (atom === null) { + return false; + } + const pos = atom.position.clone(); + // we consider atom position to be affected only by common complex transform + // ignoring any transformations that may add during editing + this._gfx.pivot.updateMatrixWorldRecursive(); + this._gfx.camera.updateMatrixWorldRecursive(); + this._gfx.pivot.localToWorld(pos); + pos.project(this._gfx.camera); + return { + x: (pos.x + 1.0) * 0.5 * this._gfx.width, + y: (1.0 - pos.y) * 0.5 * this._gfx.height + }; +}; -// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) -begin:function begin (condition) { - this.conditionStack.push(condition); - }, +/** + * Replace secondary structure with calculated one. + * + * DSSP algorithm implementation is used. + * + * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and + * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211. + * + * @param {string=} complexName - complex name + */ +Miew.prototype.dssp = function (complexName) { + const visual = this._getComplexVisual(complexName); + if (!visual) { + return; + } + visual.getComplex().dssp(); -// pop the previously active lexer condition state off the condition stack -popState:function popState () { - var n = this.conditionStack.length - 1; - if (n > 0) { - return this.conditionStack.pop(); + // rebuild dependent representations (cartoon or ss-colored) + visual._reprList.forEach(rep => { + if (rep.mode.id === 'CA' || rep.colorer.id === 'SS') { + rep.needsRebuild = true; + } + }); +}; +Miew.prototype.exportCML = function () { + const self = this; + function extractRotation(m) { + const xAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const yAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + const zAxis = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector3(); + m.extractBasis(xAxis, yAxis, zAxis); + xAxis.normalize(); + yAxis.normalize(); + zAxis.normalize(); + const retMat = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Matrix4(); + retMat.identity(); + retMat.makeBasis(xAxis, yAxis, zAxis); + return retMat; + } + function updateCMLData(complex) { + const { + root + } = self._gfx; + const mat = extractRotation(root.matrixWorld); + const v4 = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector4(0, 0, 0, 0); + const vCenter = new external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject.Vector4(0, 0, 0, 0); + let xml = null; + let ap = null; + + // update atoms in cml + complex.forEachAtom(atom => { + if (atom.xmlNodeRef && atom.xmlNodeRef.xmlNode) { + xml = atom.xmlNodeRef.xmlNode; + ap = atom.position; + v4.set(ap.x, ap.y, ap.z, 1.0); + v4.applyMatrix4(mat); + xml.setAttribute('x3', v4.x.toString()); + xml.setAttribute('y3', v4.y.toString()); + xml.setAttribute('z3', v4.z.toString()); + xml.removeAttribute('x2'); + xml.removeAttribute('y2'); + } + }); + // update stereo groups in cml + complex.forEachSGroup(sGroup => { + if (sGroup.xmlNodeRef && sGroup.xmlNodeRef.xmlNode) { + xml = sGroup.xmlNodeRef.xmlNode; + ap = sGroup.getPosition(); + v4.set(ap.x, ap.y, ap.z, 1.0); + const cp = sGroup.getCentralPoint(); + if (cp === null) { + v4.applyMatrix4(mat); } else { - return this.conditionStack[0]; + vCenter.set(cp.x, cp.y, cp.z, 0.0); + v4.add(vCenter); + v4.applyMatrix4(mat); // pos in global space + vCenter.set(cp.x, cp.y, cp.z, 1.0); + vCenter.applyMatrix4(mat); + v4.sub(vCenter); } - }, + xml.setAttribute('x', v4.x.toString()); + xml.setAttribute('y', v4.y.toString()); + xml.setAttribute('z', v4.z.toString()); + } + }); + } + const visual = self._getComplexVisual(); + const complex = visual ? visual.getComplex() : null; + if (complex && complex.originalCML) { + updateCMLData(complex); -// produce the lexer rule set which is active for the currently active lexer condition state -_currentRules:function _currentRules () { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions["INITIAL"].rules; - } - }, + // serialize xml structure to string + const oSerializer = new XMLSerializer(); + return oSerializer.serializeToString(complex.originalCML); + } + return null; +}; -// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available -topState:function topState (n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { - return this.conditionStack[n]; - } else { - return "INITIAL"; - } +/** + * Reproduce the RCSB PDB Molecule of the Month style by David S. Goodsell + * + * @see http://pdb101.rcsb.org/motm/motm-about + */ +Miew.prototype.motm = function () { + settings.set({ + fogColorEnable: true, + fogColor: 0x000000, + outline: { + on: true, + threshold: 0.01 }, + bg: { + color: 0xffffff + } + }); + this._forEachComplexVisual(visual => { + const rep = []; + const complex = visual.getComplex(); + const palette = gfx_palettes.get(settings.now.palette); + for (let i = 0; i < complex.getChainCount(); i++) { + const curChainName = complex._chains[i]._name; + const curChainColor = palette.getChainColor(curChainName); + rep[i] = { + selector: `chain ${curChainName}`, + mode: 'VW', + colorer: ['CB', { + color: curChainColor, + factor: 0.9 + }], + material: 'FL' + }; + } + visual.resetReps(rep); + }); +}; +Miew.prototype.VERSION = true && "0.11.0-0" || 0; -// alias for begin(condition) -pushState:function pushState (condition) { - this.begin(condition); - }, +// Uncomment this to get debug trace: +// Miew.prototype.debugTracer = new utils.DebugTracer(Miew.prototype); -// return the number of states currently on the stack -stateStackSize:function stateStackSize() { - return this.conditionStack.length; - }, -options: {"case-insensitive":true}, -performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { -switch($avoiding_name_collisions) { -case 0:/* ignore whitespace */ -break; -case 1:return ''; -case 2:return ''; -case 3:return 42; -case 4:return 35; -case 5:return 77; -case 6:return 78; -case 7:return 78; -case 8:return 8; -case 9:return 6; -case 10:return 82; -case 11:return 7; -case 12:return 9; -case 13:return 59; -case 14:return 13 -case 15:return 15 -case 16:return 17 -case 17:return 18 -case 18:return 19 -case 19:return 20 -case 20:return 11 -case 21:return 62 -case 22:return 64 -case 23:return 23 -case 24:return 25 -case 25:return 26 -case 26:return 27 -case 27:return 30 -case 28:return 34 -case 29:return 33 -case 30:return 65 -case 31:return 66 -case 32:return 37 -case 33:return 41 -case 34:return 43 -case 35:return 52 -case 36:return 54 -case 37:return 55 -case 38:return 46 -case 39:return 48 -case 40:return 45 -case 41:return 49 -case 42:return 56 -case 43:return 58; -case 44:return 44 -case 45:return 83 -case 46:return 84 -case 47:return 85 -case 48:return 86 -case 49:return 87 -case 50:return 88 -case 51:return 89 -case 52:return 90 -case 53:return 91 -case 54:return 92 -case 55:return 93 -case 56:return 94 -case 57:return 95 -case 58:return 70 -case 59:return 70 -case 60:return 72 -case 61:return 72 -case 62:return 74 -case 63:return 74 -case 64:return 74 -case 65:return 31 -case 66:return 36 -case 67:return 96 -case 68:return 97 -case 69:return 98 -case 70:return 99 -case 71:yy_.yytext = yy.utils.unquoteString(yy_.yytext); return 14; -case 72:return 38; -case 73:return 5; -case 74:return 101; -case 75:return 103; -case 76:return '\\'; -case 77:return 28 -case 78:return 61 -case 79:return 29 -case 80:return 57 -case 81:return 71 -} -}, -rules: [/^(?:\s+)/i,/^(?:[#].*)/i,/^(?:\/\/.*)/i,/^(?:([_A-Z0-9\/\+]+==))/i,/^(?:-?[0-9]+(\.[0-9]+)?\b)/i,/^(?:0[xX][0-9A-F]+\b)/i,/^(?:false\b)/i,/^(?:true\b)/i,/^(?:all\b)/i,/^(?:reset\b)/i,/^(?:clear\b)/i,/^(?:build\b)/i,/^(?:help\b)/i,/^(?:load\b)/i,/^(?:get\b)/i,/^(?:set\b)/i,/^(?:set_save\b)/i,/^(?:set_restore\b)/i,/^(?:set_reset\b)/i,/^(?:preset\b)/i,/^(?:motm\b)/i,/^(?:add\b)/i,/^(?:rep\b)/i,/^(?:remove\b)/i,/^(?:hide\b)/i,/^(?:show\b)/i,/^(?:list\b)/i,/^(?:select\b)/i,/^(?:within\b)/i,/^(?:selector\b)/i,/^(?:mode\b)/i,/^(?:color\b)/i,/^(?:material\b)/i,/^(?:view\b)/i,/^(?:unit\b)/i,/^(?:line\b)/i,/^(?:listobj\b)/i,/^(?:removeobj\b)/i,/^(?:rotate\b)/i,/^(?:translate\b)/i,/^(?:scale\b)/i,/^(?:center\b)/i,/^(?:url\b)/i,/^(?:screenshot\b)/i,/^(?:dssp\b)/i,/^(?:file_list\b)/i,/^(?:file_register\b)/i,/^(?:file_delete\b)/i,/^(?:preset_add\b)/i,/^(?:preset_delete\b)/i,/^(?:preset_update\b)/i,/^(?:preset_rename\b)/i,/^(?:preset_open\b)/i,/^(?:create_scenario\b)/i,/^(?:reset_scenario\b)/i,/^(?:delete_scenario\b)/i,/^(?:add_scenario_item\b)/i,/^(?:list_scenario\b)/i,/^(?:s\b)/i,/^(?:mt\b)/i,/^(?:m\b)/i,/^(?:c\b)/i,/^(?:x\b)/i,/^(?:y\b)/i,/^(?:z\b)/i,/^(?:as\b)/i,/^(?:of\b)/i,/^(?:pdb\b)/i,/^(?:delay\b)/i,/^(?:prst\b)/i,/^(?:desc\b)/i,/^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:\.)/i,/^(?:\/)/i,/^(?:\\)/i,/^(?:-e\b)/i,/^(?:-f\b)/i,/^(?:-s\b)/i,/^(?:-v\b)/i,/^(?:=)/i], -conditions: {"INITIAL":{"rules":[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,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],"inclusive":true}} +external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].assign(Miew, /** @lends Miew */{ + VERSION: Miew.prototype.VERSION, + registeredPlugins: [], + // export namespaces // TODO: WIP: refactoring external interface + chem: chem, + io: io, + modes: gfx_modes, + colorers: gfx_colorers, + materials: gfx_materials, + palettes: gfx_palettes, + options: options, + settings: settings, + utils: utils, + gfx: { + Representation: gfx_Representation + }, + /** + * Third-party libraries packaged together with Miew. + * + * @property {object} lodash - [Lodash](https://lodash.com/), a modern JavaScript utility library delivering + * modularity, performance & extras. + * @property {object} three - [three.js](https://threejs.org/), JavaScript 3D library. + * + * @example + * var _ = Miew.thirdParty.lodash; + * var opts = _.merge({ ... }, Miew.options.fromURL(window.location.search)); + * var miew = new Miew(opts); + */ + thirdParty: { + lodash: external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"], + three: external_module_three_commonjs_three_commonjs2_three_amd_three_root_THREE_namespaceObject + } }); -return lexer; -})(); -parser.lexer = lexer; -function Parser () { - this.yy = {}; -} -Parser.prototype = parser;parser.Parser = Parser; -return new Parser; -})(); +/* harmony default export */ const src_Miew = (Miew); +// EXTERNAL MODULE: ./src/utils/MiewCLIParser.js +var MiewCLIParser = __webpack_require__(89); +;// CONCATENATED MODULE: ./src/utils/MiewCLIHelp.js -var MiewCLIParser = {parser: parser$1}; -var MiewCLIParser_1 = MiewCLIParser.parser; -var modeIdDesc = { +const modeIdDesc = { $help: ['Rendering mode shortcut', ' BS - balls and sticks mode', ' LN - lines mode', ' LC - licorice mode', ' VW - van der waals mode', ' TR - trace mode', ' TU - tube mode', ' CA - cartoon mode', ' SA - isosurface mode', ' QS - quick surface mode', ' SE - solvent excluded mode', ' TX - text mode'], BS: { $help: [' Balls and sticks', ' aromrad = #aromatic radius', ' atom = #atom radius', ' bond = #bond radius', ' multibond = #use multibond', ' showarom = #show aromatic', ' space = #space value\n'] @@ -40071,19 +35454,19 @@ var modeIdDesc = { $help: [' Text mode', ' template = string that can include "{{ id }}"', ' it will be replaced by value, id can be one of next:', ' serial, name, type, sequence, residue, chain, hetatm, water\n', ' horizontalAlign = {"left", "right", "center"}', ' verticalAlign = {"top", "bottom", "middle"}', ' dx = #offset along x', ' dy = #offset along y', ' dz = #offset along z', ' fg = #text color modificator', ' could be keyword, named color or hex', ' fg = #back color modificator', ' could be keyword, named color or hex', ' showBg = #if set show background', ' plate under text'] } }; -var colorDesc = { +const colorDesc = { $help: ['Coloring mode shortcut', ' EL - color by element', ' CH - color by chain', ' SQ - color by sequence', ' RT - color by residue type', ' SS - color by secondary structure', ' UN - uniform'], UN: { $help: ['Parameters of coloring modes customization', ' Uniform', ' color = #RGB->HEX->dec\n'], color: { - $help: Object.keys(palettes.get(settings.now.palette).namedColors).sort().join('\n') + $help: Object.keys(gfx_palettes.get(settings.now.palette).namedColors).sort().join('\n') } } }; -var materialDesc = { +const materialDesc = { $help: ['Material shortcut', ' DF - diffuse', ' TR - transparent', ' SF - soft plastic', ' PL - glossy plastic', ' ME - metal', ' GL - glass'] }; -var addRepDesc = { +const addRepDesc = { $help: ['Short (packed) representation description as a set of variables', ' s=', ' selector property', ' m=[!:[,...]]', ' render mode property', ' c=[!:[,...]]', ' color mode property', ' mt=', ' material property'], s: { $help: 'Selection expression string as it is in menu->representations->selection' @@ -40092,12 +35475,12 @@ var addRepDesc = { c: colorDesc, mt: materialDesc }; -var setGetParameterDesc = { +const setGetParameterDesc = { $help: ['Parameters of rendering modes customization: modes', 'Parameters of colorer customization: colorers', 'Autobuild: autobuild = (|)'], modes: modeIdDesc, colorers: colorDesc }; -var help = { +const help = { $help: ['help (| )', 'You can get detailed information about command options', ' using "help cmd.opt.opt.[...]"\n', ' you can use one line comments', ' everything started from (#|//) will be skipped', ' Example: >build //some comment\n', 'List of available commands:'], reset: { $help: ['Reload current object, delete all representations', ' Nothing will work until load new object'] @@ -40165,7 +35548,7 @@ var help = { $help: 'build help str', add: { $help: 'build.add', - "new": { + new: { $help: ['add.new', 'add.new new line 1', 'add.new new line 2', 'add.new new line 3'] } }, @@ -40242,92 +35625,79 @@ var help = { $help: ['listobj', 'Display the list of all existing scene objects'] } }; +/* harmony default export */ const MiewCLIHelp = (help); +;// CONCATENATED MODULE: ./src/Miew-cli.js + + + -var selectors$5 = Miew.chem.selectors, - modes$1 = Miew.modes, - colorers$1 = Miew.colorers, - materials$1 = Miew.materials, - palettes$1 = Miew.palettes, - options$1 = Miew.options, - settings$1 = Miew.settings; -function None() {} -var NULL = function () { - var obj = new None(); +const { + chem: { + selectors: Miew_cli_selectors + }, + modes: Miew_cli_modes, + colorers: Miew_cli_colorers, + materials: Miew_cli_materials, + palettes: Miew_cli_palettes, + options: Miew_cli_options, + settings: Miew_cli_settings +} = src_Miew; +function None() {} +const NULL = function () { + const obj = new None(); return function () { return obj; }; }(); - -var RepresentationMap = /*#__PURE__*/function () { - function RepresentationMap() { - classCallCheck(this, RepresentationMap); - +class RepresentationMap { + constructor() { this.representationMap = {}; this.representationID = {}; } - - createClass(RepresentationMap, [{ - key: "get", - value: function get(strId) { - return this.representationMap[strId] || this.representationID[strId] || ''; + get(strId) { + return this.representationMap[strId] || this.representationID[strId] || ''; + } + add(strId, index) { + if (strId === -1) { + return 'Can not create representation: there is no data'; } - }, { - key: "add", - value: function add(strId, index) { - if (strId === -1) { - return 'Can not create representation: there is no data'; - } - - if (index !== undefined) { - if (!this.representationMap.hasOwnProperty(strId)) { - this.representationMap[strId.toString()] = index; - this.representationID[index] = strId.toString(); - } else { - return 'This name has already existed, registered without name'; - } + if (index !== undefined) { + if (!this.representationMap.hasOwnProperty(strId)) { + this.representationMap[strId.toString()] = index; + this.representationID[index] = strId.toString(); + } else { + return 'This name has already existed, registered without name'; } - - return "Representation ".concat(strId, " successfully added"); } - }, { - key: "remove", - value: function remove(index) { - if (index && this.representationID.hasOwnProperty(index)) { - delete this.representationMap[this.representationID[index]]; - delete this.representationID[index]; - } - - var sortedKeys = Object.keys(this.representationID).sort(); - - for (var i in sortedKeys) { - if (sortedKeys.hasOwnProperty(i)) { - var id = sortedKeys[i]; - - if (id > index) { - this.representationID[id - 1] = this.representationID[id]; - this.representationMap[this.representationID[id]] -= 1; - delete this.representationID[id]; - } + return `Representation ${strId} successfully added`; + } + remove(index) { + if (index && this.representationID.hasOwnProperty(index)) { + delete this.representationMap[this.representationID[index]]; + delete this.representationID[index]; + } + const sortedKeys = Object.keys(this.representationID).sort(); + for (const i in sortedKeys) { + if (sortedKeys.hasOwnProperty(i)) { + const id = sortedKeys[i]; + if (id > index) { + this.representationID[id - 1] = this.representationID[id]; + this.representationMap[this.representationID[id]] -= 1; + delete this.representationID[id]; } } } - }, { - key: "clear", - value: function clear() { - this.representationMap = {}; - this.representationID = {}; - } - }]); - - return RepresentationMap; -}(); - -var representationsStorage = new RepresentationMap(); - + } + clear() { + this.representationMap = {}; + this.representationID = {}; + } +} +const representationsStorage = new RepresentationMap(); function keyRemap(key) { - var keys = { + const keys = { s: 'selector', m: 'mode', c: 'colorer', @@ -40339,240 +35709,174 @@ function keyRemap(key) { material: 'materials', selector: 'selector' }; - var ans = keys[key]; + const ans = keys[key]; return ans === undefined ? key : ans; } - -var CLIUtils = /*#__PURE__*/function () { - function CLIUtils() { - classCallCheck(this, CLIUtils); - } - - createClass(CLIUtils, [{ - key: "list", - value: function list(miew, repMap, key) { - var ret = ''; - - if (miew && repMap !== undefined) { - if (key === undefined || key === '-e') { - var count = miew.repCount(); - - for (var i = 0; i < count; i++) { - ret += this.listRep(miew, repMap, i, key); - } +class CLIUtils { + list(miew, repMap, key) { + let ret = ''; + if (miew && repMap !== undefined) { + if (key === undefined || key === '-e') { + const count = miew.repCount(); + for (let i = 0; i < count; i++) { + ret += this.listRep(miew, repMap, i, key); } } - - return ret; } - }, { - key: "listRep", - value: function listRep(miew, repMap, repIndex, key) { - var ret = ''; - var rep = miew.repGet(repIndex); - - if (!rep) { - logger.warn("Rep ".concat(repIndex, " does not exist!")); - return ret; - } - - var index = repIndex; - var repName = repMap.get(index); - var mode = rep.mode, - colorer = rep.colorer; - var selectionStr = rep.selectorString; - var material = rep.materialPreset; - ret += "#".concat(index, " : ").concat(mode.name).concat(repName === '' ? '' : ", ".concat(repName), "\n"); - - if (key !== undefined) { - ret += " selection : \"".concat(selectionStr, "\"\n"); - ret += " mode : (".concat(mode.id, "), ").concat(mode.name, "\n"); - ret += " colorer : (".concat(colorer.id, "), ").concat(colorer.name, "\n"); - ret += " material : (".concat(material.id, "), ").concat(material.name, "\n"); - } - + return ret; + } + listRep(miew, repMap, repIndex, key) { + let ret = ''; + const rep = miew.repGet(repIndex); + if (!rep) { + logger.warn(`Rep ${repIndex} does not exist!`); return ret; } - }, { - key: "listSelector", - value: function listSelector(miew, context) { - var ret = ''; - - for (var k in context) { - if (context.hasOwnProperty(k)) { - ret += "".concat(k, " : \"").concat(context[k], "\"\n"); - } - } - - return ret; + const index = repIndex; + const repName = repMap.get(index); + const { + mode, + colorer + } = rep; + const selectionStr = rep.selectorString; + const material = rep.materialPreset; + ret += `#${index} : ${mode.name}${repName === '' ? '' : `, ${repName}`}\n`; + if (key !== undefined) { + ret += ` selection : "${selectionStr}"\n`; + ret += ` mode : (${mode.id}), ${mode.name}\n`; + ret += ` colorer : (${colorer.id}), ${colorer.name}\n`; + ret += ` material : (${material.id}), ${material.name}\n`; } - }, { - key: "listObjs", - value: function listObjs(miew) { - var objs = miew._objects; - - if (!objs || !Array.isArray(objs) || objs.length === 0) { - return 'There are no objects on the scene'; - } - - var strList = []; - - for (var i = 0, n = objs.length; i < n; ++i) { - strList[i] = "".concat(i, ": ").concat(objs[i].toString()); + return ret; + } + listSelector(miew, context) { + let ret = ''; + for (const k in context) { + if (context.hasOwnProperty(k)) { + ret += `${k} : "${context[k]}"\n`; } - - return strList.join('\n'); } - }, { - key: "joinHelpStr", - value: function joinHelpStr(helpData) { - if (helpData instanceof Array) { - return helpData.join('\n'); - } - - return helpData; + return ret; + } + listObjs(miew) { + const objs = miew._objects; + if (!objs || !Array.isArray(objs) || objs.length === 0) { + return 'There are no objects on the scene'; } - }, { - key: "help", - value: function help$1(path) { - if (_.isUndefined(path)) { - return "".concat(this.joinHelpStr(help.$help), "\n").concat(_.slice(_.sortBy(_.keys(help)), 1).join(', '), "\n"); - } - - var helpItem = _.get(help, path); - - return _.isUndefined(helpItem) ? this.help() : "".concat(this.joinHelpStr(helpItem.$help), "\n"); + const strList = []; + for (let i = 0, n = objs.length; i < n; ++i) { + strList[i] = `${i}: ${objs[i].toString()}`; } - }, { - key: "load", - value: function load(miew, arg) { - if (miew === undefined || arg === undefined || arg === '-f') { - return; - } - - miew.awaitWhileCMDisInProcess(); - - var finish = function finish() { - return miew.finishAwaitingCMDInProcess(); - }; - - miew.load(arg).then(finish, finish); + return strList.join('\n'); + } + joinHelpStr(helpData) { + if (helpData instanceof Array) { + return helpData.join('\n'); } - }, { - key: "checkArg", - value: function checkArg(key, arg, modificate) { - if (key !== undefined && arg !== undefined) { - if (keyRemap(key) === 'selector') { - var res = selectors$5.parse(arg); - - if (res.error !== undefined) { - var selExc = { - message: res.error - }; - throw selExc; - } - - if (modificate !== undefined && modificate) { - return res.selector; - } - - return arg; - } - - var modificators = { - colorers: colorers$1, - modes: modes$1, - materials: materials$1 - }; - var modificator = key; - var temp; - - while (modificator !== temp) { - temp = modificator; - modificator = keyRemap(temp); - } - - if (modificators[modificator].get(arg) === undefined) { - var exc = { - message: "".concat(arg, " is not existed in ").concat(modificator) + return helpData; + } + help(path) { + if (external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(path)) { + return `${this.joinHelpStr(MiewCLIHelp.$help)}\n${external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].slice(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].sortBy(external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].keys(MiewCLIHelp)), 1).join(', ')}\n`; + } + const helpItem = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(MiewCLIHelp, path); + return external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].isUndefined(helpItem) ? this.help() : `${this.joinHelpStr(helpItem.$help)}\n`; + } + load(miew, arg) { + if (miew === undefined || arg === undefined || arg === '-f') { + return; + } + miew.awaitWhileCMDisInProcess(); + const finish = () => miew.finishAwaitingCMDInProcess(); + miew.load(arg).then(finish, finish); + } + checkArg(key, arg, modificate) { + if (key !== undefined && arg !== undefined) { + if (keyRemap(key) === 'selector') { + const res = Miew_cli_selectors.parse(arg); + if (res.error !== undefined) { + const selExc = { + message: res.error }; - throw exc; + throw selExc; + } + if (modificate !== undefined && modificate) { + return res.selector; } - return arg; } - - return NULL; + const modificators = { + colorers: Miew_cli_colorers, + modes: Miew_cli_modes, + materials: Miew_cli_materials + }; + let modificator = key; + let temp; + while (modificator !== temp) { + temp = modificator; + modificator = keyRemap(temp); + } + if (modificators[modificator].get(arg) === undefined) { + const exc = { + message: `${arg} is not existed in ${modificator}` + }; + throw exc; + } + return arg; } - }, { - key: "propagateProp", - value: function propagateProp(path, arg) { - if (path !== undefined) { - var argExc = {}; - - var adapter = options$1.adapters[_typeof_1(_.get(settings$1.defaults, path))]; - - if (adapter === undefined) { - var pathExc = { - message: "".concat(path, " is not existed") - }; - throw pathExc; - } - - if ((path.endsWith('.color') || path.endsWith('.baseColor') || path.endsWith('.EL.carbon')) && typeof arg !== 'number') { - arg = palettes$1.get(settings$1.now.palette).getNamedColor(arg); - } - - if (path.endsWith('.fg') || path.endsWith('.bg')) { - if (typeof arg !== 'number') { - var val = palettes$1.get(settings$1.now.palette).getNamedColor(arg, true); - - if (val !== undefined) { - arg = "0x".concat(val.toString(16)); - } - } else { - arg = "0x".concat(arg.toString(16)); + return NULL; + } + propagateProp(path, arg) { + if (path !== undefined) { + let argExc = {}; + const adapter = Miew_cli_options.adapters[typeof external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(Miew_cli_settings.defaults, path)]; + if (adapter === undefined) { + const pathExc = { + message: `${path} is not existed` + }; + throw pathExc; + } + if ((path.endsWith('.color') || path.endsWith('.baseColor') || path.endsWith('.EL.carbon')) && typeof arg !== 'number') { + arg = Miew_cli_palettes.get(Miew_cli_settings.now.palette).getNamedColor(arg); + } + if (path.endsWith('.fg') || path.endsWith('.bg')) { + if (typeof arg !== 'number') { + const val = Miew_cli_palettes.get(Miew_cli_settings.now.palette).getNamedColor(arg, true); + if (val !== undefined) { + arg = `0x${val.toString(16)}`; } - } - - if (path.endsWith('.template')) { - arg = arg.replace(/\\n/g, '\n'); // NOSONAR - } - - if (arg !== undefined && adapter(arg) !== arg && adapter(arg) !== arg > 0) { - argExc = { - message: "".concat(path, " must be a \"").concat(_typeof_1(_.get(settings$1.defaults, path)), "\"") - }; - throw argExc; + } else { + arg = `0x${arg.toString(16)}`; } } - - return arg; - } - }, { - key: "unquoteString", - value: function unquoteString(value) { - return utils.unquoteString(value); + if (path.endsWith('.template')) { + arg = arg.replace(/\\n/g, '\n'); // NOSONAR + } + if (arg !== undefined && adapter(arg) !== arg && adapter(arg) !== arg > 0) { + argExc = { + message: `${path} must be a "${typeof external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].get(Miew_cli_settings.defaults, path)}"` + }; + throw argExc; + } } - }]); - - return CLIUtils; -}(); // repIndexOrRepMap could be RepresentationMap or index - - -var utilFunctions = new CLIUtils(); + return arg; + } + unquoteString(value) { + return utils.unquoteString(value); + } +} +// repIndexOrRepMap could be RepresentationMap or index +const utilFunctions = new CLIUtils(); function CreateObjectPair(a, b) { - var obj = {}; + const obj = {}; obj[a] = b; return obj; } - function ArgList(arg) { if (arg instanceof this.constructor) { return arg; } - if (arg instanceof Array) { this._values = arg.slice(0); } else if (arg) { @@ -40581,110 +35885,93 @@ function ArgList(arg) { this._values = []; } } - ArgList.prototype.append = function (value) { - var values = this._values; + const values = this._values; values[values.length] = value; return this; }; - ArgList.prototype.remove = function (value) { - var values = this._values; - var index = values.indexOf(value); - + const values = this._values; + const index = values.indexOf(value); if (index >= 0) { values.splice(index, 1); } - return this; }; - ArgList.prototype.toJSO = function (cliUtils, cmd, arg) { - var res = {}; - var list = this._values; - - for (var i = 0, n = list.length; i < n; ++i) { - _.set(res, list[i].id, cliUtils.propagateProp("".concat(keyRemap(cmd), ".").concat(arg, ".").concat(list[i].id), list[i].val)); + const res = {}; + const list = this._values; + for (let i = 0, n = list.length; i < n; ++i) { + external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"].set(res, list[i].id, cliUtils.propagateProp(`${keyRemap(cmd)}.${arg}.${list[i].id}`, list[i].val)); } - return res; }; - function Arg(_id, _val) { this.id = _id; this.val = _val; } - -var cliutils = Object.create({}); +const cliutils = Object.create({}); cliutils.Arg = Arg; cliutils.ArgList = ArgList; cliutils.miew = null; cliutils.echo = null; cliutils.representations = representationsStorage; cliutils.utils = utilFunctions; -cliutils._ = _; +cliutils._ = external_module_lodash_commonjs_lodash_commonjs2_lodash_amd_lodash_root_namespaceObject["default"]; cliutils.CreateObjectPair = CreateObjectPair; cliutils.keyRemap = keyRemap; -cliutils.Context = selectors$5.Context; -cliutils.ClearContext = selectors$5.ClearContext; +cliutils.Context = Miew_cli_selectors.Context; +cliutils.ClearContext = Miew_cli_selectors.ClearContext; cliutils.NULL = NULL; - cliutils.notimplemented = function () { return this.NULL; }; - -Miew.prototype.script = function (script, _printCallback, _errorCallback) { - MiewCLIParser_1.yy.miew = this; - MiewCLIParser_1.yy.echo = _printCallback; - MiewCLIParser_1.yy.error = _errorCallback; - +src_Miew.prototype.script = function (script, _printCallback, _errorCallback) { + MiewCLIParser.parser.yy.miew = this; + MiewCLIParser.parser.yy.echo = _printCallback; + MiewCLIParser.parser.yy.error = _errorCallback; if (this.cmdQueue === undefined) { this.cmdQueue = []; } - if (this.commandInAction === undefined) { this.commandInAction = false; } - this.cmdQueue = this.cmdQueue.concat(script.split('\n')); }; - -Miew.prototype.awaitWhileCMDisInProcess = function () { +src_Miew.prototype.awaitWhileCMDisInProcess = function () { this.commandInAction = true; }; - -Miew.prototype.finishAwaitingCMDInProcess = function () { +src_Miew.prototype.finishAwaitingCMDInProcess = function () { this.commandInAction = false; }; - -Miew.prototype.isScriptingCommandAvailable = function () { +src_Miew.prototype.isScriptingCommandAvailable = function () { return this.commandInAction !== undefined && !this.commandInAction && this.cmdQueue !== undefined && this.cmdQueue.length > 0; }; - -Miew.prototype.callNextCmd = function () { +src_Miew.prototype.callNextCmd = function () { if (this.isScriptingCommandAvailable()) { - var cmd = this.cmdQueue.shift(); - var res = {}; + const cmd = this.cmdQueue.shift(); + const res = {}; res.success = false; - try { - MiewCLIParser_1.parse(cmd); + MiewCLIParser.parser.parse(cmd); res.success = true; } catch (e) { res.error = e.message; - MiewCLIParser_1.yy.error(res.error); + MiewCLIParser.parser.yy.error(res.error); this.finishAwaitingCMDInProcess(); } - return res; } - return ''; }; +MiewCLIParser.parser.yy = cliutils; +// workaround for incorrect JISON parser generator for AMD module +MiewCLIParser.parser.yy.parseError = MiewCLIParser.parser.parseError; +;// CONCATENATED MODULE: ./src/index.js -MiewCLIParser_1.yy = cliutils; // workaround for incorrect JISON parser generator for AMD module -MiewCLIParser_1.yy.parseError = MiewCLIParser_1.parseError; +/* harmony default export */ const src = (src_Miew); +var __webpack_exports__default = __webpack_exports__.A; +export { __webpack_exports__default as default }; -export default Miew; -//# sourceMappingURL=Miew.module.js.map +//# sourceMappingURL=Miew.module.js.map \ No newline at end of file diff --git a/packages/miew/dist/Miew.module.js.map b/packages/miew/dist/Miew.module.js.map index 2e6a8e408..321c0c4a0 100644 --- a/packages/miew/dist/Miew.module.js.map +++ b/packages/miew/dist/Miew.module.js.map @@ -1 +1 @@ -{"version":3,"file":"Miew.module.js","sources":["../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../node_modules/spin.js/spin.js","../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../src/Timer.js","../../src/gfx/Stats.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../src/utils/EventDispatcher.js","../../src/utils/logger.js","../../src/utils.js","../../src/utils/JobHandle.js","../../src/settings.js","../../src/options.js","../../node_modules/@babel/runtime/helpers/defineProperty.js","../../src/chem/Atom.js","../../src/chem/Element.js","../../src/chem/Bond.js","../../src/chem/Residue.js","../../src/chem/ResidueType.js","../../src/chem/Chain.js","../../src/chem/StructuralElement.js","../../src/chem/Helix.js","../../node_modules/@babel/runtime/helpers/superPropBase.js","../../node_modules/@babel/runtime/helpers/get.js","../../src/chem/Strand.js","../../src/chem/Sheet.js","../../src/chem/SGroup.js","../../src/utils/SelectionParser.js","../../src/chem/selectors/selectArgs.js","../../src/chem/selectors/selectorsBase.js","../../src/chem/selectors/selectOps.js","../../src/chem/selectors.js","../../src/chem/BiologicalUnit.js","../../src/chem/Assembly.js","../../src/chem/Component.js","../../src/chem/AtomPairs.js","../../src/chem/AutoBond.js","../../src/chem/AromaticLoopsMarker.js","../../src/chem/VoxelWorld.js","../../src/chem/HBondInfo.js","../../src/chem/SecondaryStructureMap.js","../../src/chem/Complex.js","../../src/chem/Volume.js","../../src/chem/Molecule.js","../../src/chem.js","../../src/gfx/CSS2DObject.js","../../src/gfx/RCGroup.js","../../src/gfx/capabilities.js","../../src/gfx/noiseTexture.js","../../src/gfx/shaders/UberMaterial.js","../../src/gfx/gfxutils.js","../../src/Visual.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../src/utils/EntityList.js","../../src/utils/makeContextDependent.js","../../src/gfx/geometries/SphereCollisionGeo.js","../../src/gfx/geometries/InstancedSpheresGeometry.js","../../src/gfx/geometries/RaycastableBufferGeometry.js","../../src/gfx/geometries/ChunkedObjectsGeometry.js","../../src/gfx/geometries/SimpleSpheresGeometry.js","../../src/gfx/geometries/Simple2CCylindersGeometry.js","../../src/gfx/geometries/CylinderBufferGeometry.js","../../src/gfx/geometries/Instanced2CCylindersGeometry.js","../../src/gfx/geometries/ExtrudedObjectsGeometry.js","../../src/gfx/geometries/ThickLinesGeometry.js","../../src/gfx/geometries/LinesGeometry.js","../../src/gfx/geometries/CylinderCollisionGeo.js","../../src/gfx/geometries/ChunkedLinesGeometry.js","../../src/gfx/geometries/TwoColorLinesGeometry.js","../../src/gfx/geometries/CrossGeometry.js","../../src/gfx/geometries/IsoSurfaceGeometry.js","../../src/gfx/geometries/IsoSurfaceMarchCube.js","../../src/gfx/geometries/IsoSurface.js","../../src/gfx/geometries/VolumeSurfaceGeometry.js","../../src/gfx/geometries/QuickSurfGeometry.js","../../src/gfx/geometries/ContactSurface.js","../../src/gfx/geometries/ContactSurfaceGeometry.js","../../src/gfx/geometries/IsoSurfaceAtomColored.js","../../src/gfx/geometries/IsosurfaceBuildNormals.js","../../src/gfx/geometries/IsoSurfaceGeo.js","../../src/gfx/geometries/SSIsosurfaceGeometry.js","../../src/gfx/geometries/LabelsGeometry.js","../../src/gfx/geometries/geometries.js","../../src/gfx/meshes/UberObject.js","../../src/gfx/meshes/ZSpriteMesh.js","../../src/gfx/meshes/ZClippedMesh.js","../../src/gfx/meshes/TextMesh.js","../../src/gfx/meshes/SimpleMesh.js","../../src/gfx/meshes/ThickLineMesh.js","../../src/gfx/meshes/InstancedMesh.js","../../src/gfx/meshes/meshes.js","../../src/gfx/meshes/MeshCreator.js","../../src/gfx/meshes/TransformGroup.js","../../src/gfx/modes/groups/ChemGroup.js","../../src/gfx/modes/groups/AtomsGroup.js","../../src/gfx/modes/groups/AtomsSphereGroup.js","../../src/gfx/modes/groups/AtomsSurfaceGroup.js","../../src/gfx/modes/groups/AtomsSASSESGroupStub.js","../../src/gfx/modes/groups/AtomsTextGroup.js","../../src/gfx/modes/groups/AromaticGroup.js","../../src/gfx/modes/groups/AromaticTorusGroup.js","../../src/gfx/modes/groups/AromaticLinesGroup.js","../../src/gfx/modes/groups/ResiduesGroup.js","../../src/gfx/modes/groups/NucleicItemGroup.js","../../src/gfx/modes/groups/NucleicCylindersGroup.js","../../src/gfx/modes/groups/NucleicSpheresGroup.js","../../vendor/js/Smooth.js","../../src/gfx/modes/groups/CartoonHelper.js","../../src/gfx/modes/groups/ResiduesSubseqGroup.js","../../src/gfx/modes/groups/ResiduesTraceGroup.js","../../src/gfx/modes/groups/BondsGroup.js","../../src/gfx/modes/groups/BondsCylinderGroup.js","../../src/gfx/modes/groups/BondsLinesGroup.js","../../src/gfx/modes/groups/groups.js","../../src/gfx/modes/processors/AtomsProcessor.js","../../src/gfx/modes/processors/OrphanAtomsProcessor.js","../../src/gfx/modes/processors/ResiduesProcessor.js","../../src/gfx/modes/processors/NucleicProcessor.js","../../src/gfx/modes/processors/SubseqsProcessor.js","../../src/gfx/modes/processors/BondsProcessor.js","../../src/gfx/modes/processors/AromaticProcessor.js","../../src/gfx/modes/processors/processors.js","../../src/gfx/modes/groups/GroupsFactory.js","../../src/gfx/modes/Mode.js","../../src/gfx/modes/LinesMode.js","../../src/gfx/modes/LicoriceMode.js","../../src/gfx/modes/BallsAndSticksMode.js","../../src/gfx/modes/VanDerWaalsMode.js","../../src/gfx/modes/TraceMode.js","../../src/gfx/modes/TubeMode.js","../../src/gfx/modes/CartoonMode.js","../../src/gfx/modes/SurfaceMode.js","../../src/gfx/modes/QuickSurfaceMode.js","../../src/gfx/modes/IsoSurfaceMode.js","../../src/gfx/modes/IsoSurfaceSASMode.js","../../src/gfx/modes/IsoSurfaceSESMode.js","../../src/gfx/modes/ContactSurfaceMode.js","../../src/gfx/modes/TextMode.js","../../src/gfx/modes.js","../../src/gfx/palettes/Palette.js","../../src/gfx/palettes/cpkPalette.js","../../src/gfx/palettes/jmolPalette.js","../../src/gfx/palettes/vmdPalette.js","../../src/gfx/palettes.js","../../src/gfx/colorers/Colorer.js","../../src/gfx/colorers/ElementColorer.js","../../src/gfx/colorers/ResidueTypeColorer.js","../../src/gfx/colorers/SequenceColorer.js","../../src/gfx/colorers/ChainColorer.js","../../src/gfx/colorers/SecondaryStructureColorer.js","../../src/gfx/colorers/UniformColorer.js","../../src/gfx/colorers/ConditionalColorer.js","../../src/gfx/colorers/ConformationColorer.js","../../src/gfx/colorers/TemperatureColorer.js","../../src/gfx/colorers/OccupancyColorer.js","../../src/gfx/colorers/HydrophobicityColorer.js","../../src/gfx/colorers/MoleculeColorer.js","../../src/gfx/colorers/CarbonColorer.js","../../src/gfx/colorers.js","../../src/gfx/materials.js","../../src/gfx/Representation.js","../../src/ComplexVisualEdit.js","../../src/ComplexVisual.js","../../src/gfx/shaders/VolumeMaterial.js","../../src/gfx/VolumeMesh.js","../../src/gfx/VolumeBounds.js","../../src/gfx/VolumeFarPlane.js","../../src/VolumeVisual.js","../../src/io/loaders/LoaderList.js","../../src/io/loaders/Loader.js","../../src/io/loaders/FileLoader.js","../../src/io/loaders/XHRLoader.js","../../src/io/loaders/ImmediateLoader.js","../../src/io/loaders.js","../../src/io/parsers/ParserList.js","../../src/io/parsers/Parser.js","../../src/io/parsers/pdb/Remark290.js","../../src/io/parsers/pdb/Remark350.js","../../src/io/parsers/PDBStream.js","../../src/io/parsers/PDBParser.js","../../src/io/parsers/CMLParser.js","../../vendor/js/mmtf.js","../../src/io/parsers/MMTFParser.js","../../src/io/parsers/ParsingError.js","../../src/io/parsers/readCIF.js","../../src/io/parsers/CIFParser.js","../../src/io/parsers/VolumeModel.js","../../src/io/parsers/CCP4Parser.js","../../src/io/parsers/XYZParser.js","../../src/io/parsers/PubChemParser.js","../../src/io/parsers/SDFStream.js","../../src/io/parsers/SDFParser.js","../../src/io/parsers/DSN6Parser.js","../../src/io/parsers/GROReader.js","../../src/io/parsers/GROParser.js","../../src/io/parsers/MOL2Parser.js","../../src/io/parsers.js","../../src/io/exporters/ExporterList.js","../../src/io/exporters/Exporter.js","../../src/io/exporters/PDBResult.js","../../src/io/exporters/PDBExporter.js","../../src/io/exporters/fbx/FBXModel.js","../../src/io/exporters/fbx/FBXGeometry.js","../../src/io/exporters/fbx/FBX1CGeometry.js","../../src/io/exporters/fbx/FBX2CCylinder.js","../../src/io/exporters/fbx/FBXInfoExtractor.js","../../src/io/exporters/fbx/FBXResult.js","../../src/io/exporters/FBXExporter.js","../../src/io/exporters.js","../../src/io/io.js","../../src/gfx/CSS2DRenderer.js","../../src/ui/ObjectControls.js","../../src/ui/Picker.js","../../src/gfx/Axes.js","../../src/gfx/FrameInfo.js","../../src/gfx/objects/SceneObject.js","../../src/gfx/objects/LinesObj.js","../../src/gfx/shaders/OutlineMaterial.js","../../src/gfx/shaders/FXAAMaterial.js","../../src/gfx/shaders/AOMaterial.js","../../src/gfx/shaders/AOHorBlurMaterial.js","../../src/gfx/shaders/AOVertBlurWithBlendMaterial.js","../../src/gfx/shaders/AnaglyphMaterial.js","../../src/gfx/ViewInterpolator.js","../../src/utils/Cookies.js","../../src/gfx/vr/createWebVRButton.js","../../src/gfx/vr/WebVRPoC.js","../../src/Miew.js","../../src/utils/MiewCLIParser.js","../../src/utils/MiewCLIHelp.js","../../src/Miew-cli.js"],"sourcesContent":["function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) {\n return;\n }\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","var __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar defaults = {\r\n lines: 12,\r\n length: 7,\r\n width: 5,\r\n radius: 10,\r\n scale: 1.0,\r\n corners: 1,\r\n color: '#000',\r\n fadeColor: 'transparent',\r\n animation: 'spinner-line-fade-default',\r\n rotate: 0,\r\n direction: 1,\r\n speed: 1,\r\n zIndex: 2e9,\r\n className: 'spinner',\r\n top: '50%',\r\n left: '50%',\r\n shadow: '0 0 1px transparent',\r\n position: 'absolute',\r\n};\r\nvar Spinner = /** @class */ (function () {\r\n function Spinner(opts) {\r\n if (opts === void 0) { opts = {}; }\r\n this.opts = __assign(__assign({}, defaults), opts);\r\n }\r\n /**\r\n * Adds the spinner to the given target element. If this instance is already\r\n * spinning, it is automatically removed from its previous target by calling\r\n * stop() internally.\r\n */\r\n Spinner.prototype.spin = function (target) {\r\n this.stop();\r\n this.el = document.createElement('div');\r\n this.el.className = this.opts.className;\r\n this.el.setAttribute('role', 'progressbar');\r\n css(this.el, {\r\n position: this.opts.position,\r\n width: 0,\r\n zIndex: this.opts.zIndex,\r\n left: this.opts.left,\r\n top: this.opts.top,\r\n transform: \"scale(\" + this.opts.scale + \")\",\r\n });\r\n if (target) {\r\n target.insertBefore(this.el, target.firstChild || null);\r\n }\r\n drawLines(this.el, this.opts);\r\n return this;\r\n };\r\n /**\r\n * Stops and removes the Spinner.\r\n * Stopped spinners may be reused by calling spin() again.\r\n */\r\n Spinner.prototype.stop = function () {\r\n if (this.el) {\r\n if (typeof requestAnimationFrame !== 'undefined') {\r\n cancelAnimationFrame(this.animateId);\r\n }\r\n else {\r\n clearTimeout(this.animateId);\r\n }\r\n if (this.el.parentNode) {\r\n this.el.parentNode.removeChild(this.el);\r\n }\r\n this.el = undefined;\r\n }\r\n return this;\r\n };\r\n return Spinner;\r\n}());\r\nexport { Spinner };\r\n/**\r\n * Sets multiple style properties at once.\r\n */\r\nfunction css(el, props) {\r\n for (var prop in props) {\r\n el.style[prop] = props[prop];\r\n }\r\n return el;\r\n}\r\n/**\r\n * Returns the line color from the given string or array.\r\n */\r\nfunction getColor(color, idx) {\r\n return typeof color == 'string' ? color : color[idx % color.length];\r\n}\r\n/**\r\n * Internal method that draws the individual lines.\r\n */\r\nfunction drawLines(el, opts) {\r\n var borderRadius = (Math.round(opts.corners * opts.width * 500) / 1000) + 'px';\r\n var shadow = 'none';\r\n if (opts.shadow === true) {\r\n shadow = '0 2px 4px #000'; // default shadow\r\n }\r\n else if (typeof opts.shadow === 'string') {\r\n shadow = opts.shadow;\r\n }\r\n var shadows = parseBoxShadow(shadow);\r\n for (var i = 0; i < opts.lines; i++) {\r\n var degrees = ~~(360 / opts.lines * i + opts.rotate);\r\n var backgroundLine = css(document.createElement('div'), {\r\n position: 'absolute',\r\n top: -opts.width / 2 + \"px\",\r\n width: (opts.length + opts.width) + 'px',\r\n height: opts.width + 'px',\r\n background: getColor(opts.fadeColor, i),\r\n borderRadius: borderRadius,\r\n transformOrigin: 'left',\r\n transform: \"rotate(\" + degrees + \"deg) translateX(\" + opts.radius + \"px)\",\r\n });\r\n var delay = i * opts.direction / opts.lines / opts.speed;\r\n delay -= 1 / opts.speed; // so initial animation state will include trail\r\n var line = css(document.createElement('div'), {\r\n width: '100%',\r\n height: '100%',\r\n background: getColor(opts.color, i),\r\n borderRadius: borderRadius,\r\n boxShadow: normalizeShadow(shadows, degrees),\r\n animation: 1 / opts.speed + \"s linear \" + delay + \"s infinite \" + opts.animation,\r\n });\r\n backgroundLine.appendChild(line);\r\n el.appendChild(backgroundLine);\r\n }\r\n}\r\nfunction parseBoxShadow(boxShadow) {\r\n var regex = /^\\s*([a-zA-Z]+\\s+)?(-?\\d+(\\.\\d+)?)([a-zA-Z]*)\\s+(-?\\d+(\\.\\d+)?)([a-zA-Z]*)(.*)$/;\r\n var shadows = [];\r\n for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) {\r\n var shadow = _a[_i];\r\n var matches = shadow.match(regex);\r\n if (matches === null) {\r\n continue; // invalid syntax\r\n }\r\n var x = +matches[2];\r\n var y = +matches[5];\r\n var xUnits = matches[4];\r\n var yUnits = matches[7];\r\n if (x === 0 && !xUnits) {\r\n xUnits = yUnits;\r\n }\r\n if (y === 0 && !yUnits) {\r\n yUnits = xUnits;\r\n }\r\n if (xUnits !== yUnits) {\r\n continue; // units must match to use as coordinates\r\n }\r\n shadows.push({\r\n prefix: matches[1] || '',\r\n x: x,\r\n y: y,\r\n xUnits: xUnits,\r\n yUnits: yUnits,\r\n end: matches[8],\r\n });\r\n }\r\n return shadows;\r\n}\r\n/**\r\n * Modify box-shadow x/y offsets to counteract rotation\r\n */\r\nfunction normalizeShadow(shadows, degrees) {\r\n var normalized = [];\r\n for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) {\r\n var shadow = shadows_1[_i];\r\n var xy = convertOffset(shadow.x, shadow.y, degrees);\r\n normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end);\r\n }\r\n return normalized.join(', ');\r\n}\r\nfunction convertOffset(x, y, degrees) {\r\n var radians = degrees * Math.PI / 180;\r\n var sin = Math.sin(radians);\r\n var cos = Math.cos(radians);\r\n return [\r\n Math.round((x * cos + y * sin) * 1000) / 1000,\r\n Math.round((-x * sin + y * cos) * 1000) / 1000,\r\n ];\r\n}\r\n","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","//----------------------------------------------------------------------------\r\n// Timer\r\n\r\nclass Timer {\r\n constructor() {\r\n this.startTime = 0;\r\n this.oldTime = 0;\r\n this.elapsedTime = 0;\r\n this.running = false;\r\n }\r\n\r\n start() {\r\n this.startTime = Timer.now();\r\n this.oldTime = this.startTime;\r\n this.running = true;\r\n }\r\n\r\n stop() {\r\n this.getElapsedTime();\r\n this.running = false;\r\n }\r\n\r\n getElapsedTime() {\r\n this.update();\r\n return this.elapsedTime;\r\n }\r\n\r\n update() {\r\n let delta = 0;\r\n if (this.running) {\r\n const newTime = Timer.now();\r\n delta = 0.001 * (newTime - this.oldTime);\r\n this.oldTime = newTime;\r\n this.elapsedTime += delta;\r\n }\r\n\r\n return delta;\r\n }\r\n}\r\n\r\nTimer.now = (function () {\r\n const p = typeof window !== 'undefined' && window.performance;\r\n return (p && p.now) ? p.now.bind(p) : Date.now;\r\n}());\r\n\r\nexport default Timer;\r\n","import Timer from '../Timer';\r\n\r\nconst { now } = Timer;\r\n\r\nfunction createElement(tag, id, css) {\r\n const element = document.createElement(tag);\r\n element.id = id;\r\n element.style.cssText = css;\r\n return element;\r\n}\r\n\r\nclass Stats {\r\n constructor() {\r\n this.domElement = createElement('div', 'stats', 'padding:8px');\r\n this._text = createElement('p', 'fps', 'margin:0;color:silver;font-size:large');\r\n this.domElement.appendChild(this._text);\r\n\r\n this._startTime = now();\r\n this._prevTime = this._startTime;\r\n\r\n this._deltas = new Array(20);\r\n this._index = 0;\r\n this._total = 0.0;\r\n this._count = 0;\r\n }\r\n\r\n end() {\r\n const time = now();\r\n const delta = time - this._startTime;\r\n\r\n if (this._count < this._deltas.length) {\r\n this._count++;\r\n } else {\r\n this._total -= this._deltas[this._index];\r\n }\r\n this._total += delta;\r\n this._deltas[this._index] = delta;\r\n this._index = (this._index + 1) % this._deltas.length;\r\n\r\n this.ms = this._total / this._count;\r\n this.fps = 1000 / this.ms;\r\n\r\n if (time > this._prevTime + 1000) {\r\n this._text.textContent = this.fps.toPrecision(2);\r\n this._prevTime = time;\r\n }\r\n\r\n return time;\r\n }\r\n\r\n update() {\r\n this._startTime = this.end();\r\n }\r\n\r\n show(on) {\r\n if (on === undefined) {\r\n on = true;\r\n }\r\n this.domElement.style.display = on ? 'block' : 'none';\r\n }\r\n}\r\n\r\nexport default Stats;\r\n","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}\n\nmodule.exports = _isNativeFunction;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nvar setPrototypeOf = require(\"./setPrototypeOf\");\n\nvar isNativeFunction = require(\"./isNativeFunction\");\n\nvar construct = require(\"./construct\");\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nmodule.exports = _wrapNativeSuper;","/**\r\n * This class introduces the simplest event system.\r\n */\r\n\r\nimport _ from 'lodash';\r\n\r\nfunction isUndefOrEqual(param, value) {\r\n return !param || param === value;\r\n}\r\n\r\n/**\r\n * Creates empty dispatcher.\r\n *\r\n * @exports EventDispatcher\r\n * @constructor\r\n */\r\nfunction EventDispatcher() {\r\n this._handlers = {};\r\n}\r\n\r\n/**\r\n * Binds callback on specific event type. Optional `context` parameter\r\n * could be used as 'this' for the `callback`.\r\n * @param {string} type Event name.\r\n * @param {function} callback Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.addEventListener = function (type, callback, context) {\r\n let handlers = this._handlers[type];\r\n\r\n if (!handlers) {\r\n this._handlers[type] = [];\r\n handlers = this._handlers[type];\r\n }\r\n\r\n const params = [callback, context];\r\n function _checkPar(par) {\r\n return par[0] === params[0] && par[1] === params[1];\r\n }\r\n\r\n if (_.find(handlers, _checkPar) === undefined) {\r\n handlers.push(params);\r\n }\r\n};\r\n\r\n/**\r\n * Removes a previously-bound callback function from an object.\r\n * If no `context` is specified, all versions of the `callback` with different\r\n * contexts will be removed.\r\n * If no `callback` is specified, all callbacks of the `type` will be removed.\r\n * If no `type` is specified, callbacks for all events will be removed.\r\n * @param {?string} [type] Event type.\r\n * @param {function} [callback] Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.removeEventListener = function (type, callback, context) {\r\n const self = this;\r\n _.forEach(self._handlers, (handler, ev) => {\r\n _.remove(handler, (values) => isUndefOrEqual(type, ev)\r\n && isUndefOrEqual(callback, values[0])\r\n && isUndefOrEqual(context, values[1] || self));\r\n });\r\n\r\n this._handlers = _.omitBy(self._handlers, (handler) => handler.length === 0);\r\n};\r\n\r\n/**\r\n * Makes all the callbacks for the specific `event` to trigger.\r\n * @param {Object} event Event.\r\n * @param {string} event.type Type of the event.\r\n */\r\nEventDispatcher.prototype.dispatchEvent = function (event) {\r\n const self = this;\r\n\r\n _.forEach(this._handlers[event.type], (callback) => {\r\n const context = callback[1] || self;\r\n callback[0].apply(context, [event]);\r\n });\r\n};\r\n\r\nexport default EventDispatcher;\r\n","/**\r\n * This module contains class for logging.\r\n * Returns an instance of a logger that have already been created.\r\n * Allows users to log messages for five different levels,\r\n * enable console output and catch signal on each message.\r\n */\r\nimport _ from 'lodash';\r\nimport EventDispatcher from './EventDispatcher';\r\n\r\nconst priorities = {\r\n debug: 0,\r\n info: 1,\r\n report: 2,\r\n warn: 3,\r\n error: 4,\r\n};\r\n\r\n/**\r\n * Create new Logger.\r\n *\r\n * @exports Logger\r\n * @extends EventDispatcher\r\n * @constructor\r\n */\r\nfunction Logger() {\r\n EventDispatcher.call(this);\r\n /** Boolean flag that toggles output to browser console.\r\n * @type {boolean}\r\n */\r\n this.console = false;\r\n this._priority = priorities.warn;\r\n}\r\n\r\nLogger.prototype = Object.create(EventDispatcher.prototype);\r\nLogger.prototype.constructor = Logger;\r\n\r\n/**\r\n * Create new clean instance of the logger.\r\n * @returns {Logger}\r\n */\r\nLogger.prototype.instantiate = function () {\r\n return new Logger();\r\n};\r\n\r\nfunction verify(number) {\r\n if (!_.isNumber(number)) {\r\n throw new Error('Wrong log level specified!');\r\n }\r\n return number;\r\n}\r\n\r\n/**\r\n * @property {string} current threshold for signals and console output.\r\n * @name Logger#level\r\n */\r\nObject.defineProperty(Logger.prototype, 'level', {\r\n get() {\r\n return _.findKey(priorities, (value) => value === this._priority);\r\n },\r\n set(level) {\r\n this._priority = verify(priorities[level]);\r\n },\r\n});\r\n\r\n/**\r\n * Returns the list of all possible level values.\r\n * @returns {Array}\r\n */\r\nLogger.prototype.levels = function () {\r\n return Object.keys(priorities);\r\n};\r\n\r\n/**\r\n * Add new message with specified level.\r\n * @param {string} level - level of the message, must be one of the\r\n * {'debug' | 'info' | 'report' | 'warn' | 'error'}\r\n * @param {string} message\r\n */\r\nLogger.prototype.message = function (level, message) {\r\n const priority = verify(priorities[level]);\r\n this._message(priority, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('debug', ...);\r\n * @param message\r\n */\r\nLogger.prototype.debug = function (message) {\r\n this._message(priorities.debug, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('info', ...);\r\n * @param message\r\n */\r\nLogger.prototype.info = function (message) {\r\n this._message(priorities.info, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('report', ...);\r\n * @param message\r\n */\r\nLogger.prototype.report = function (message) {\r\n this._message(priorities.report, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('warn', ...);\r\n * @param message\r\n */\r\nLogger.prototype.warn = function (message) {\r\n this._message(priorities.warn, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('error', ...);\r\n * @param message\r\n */\r\nLogger.prototype.error = function (message) {\r\n this._message(priorities.error, message);\r\n};\r\n\r\n/**\r\n * Add new message with specified priority.\r\n * @param {number} priority - priority of the message\r\n * @param {string} message\r\n * @private\r\n */\r\nLogger.prototype._message = function (priority, message) {\r\n if (priority < this._priority) {\r\n return;\r\n }\r\n const level = _.findKey(priorities, (value) => value === priority);\r\n message = String(message);\r\n if (this.console) {\r\n const output = `miew:${level}: ${message}`;\r\n if (level === 'error') {\r\n console.error(output); // NOSONAR\r\n } else if (level === 'warn') {\r\n console.warn(output); // NOSONAR\r\n } else {\r\n console.log(output); // NOSONAR\r\n }\r\n }\r\n this.dispatchEvent({ type: 'message', level, message });\r\n};\r\n\r\nexport default new Logger();\r\n","import _ from 'lodash';\r\nimport logger from './utils/logger';\r\n\r\n\r\nconst browserType = {\r\n DEFAULT: 0,\r\n SAFARI: 1,\r\n};\r\n//----------------------------------------------------------------------------\r\n// Query string\r\n\r\n/**\r\n * Escape only dangerous chars in a query string component, use a plus instead of a space.\r\n *\r\n * [RFC 3986](https://tools.ietf.org/html/rfc3986) allows the following chars in the query (see 3.4):\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! $ & ' ( ) * + , ; = : @ / ?\r\n *\r\n * For query string elements we need to escape ampersand, equal sign, and plus,\r\n * but encodeURIComponent() function encodes anything except for the following:\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! ' ( ) *\r\n *\r\n * @param {string} text - key or value to encode\r\n * @param {string} excludeExp - regexp for symbols to exclude from encoding\r\n * @returns {string} encoded string\r\n */\r\nfunction encodeQueryComponent(text, excludeExp) {\r\n const encode = (code) => String.fromCharCode(parseInt(code.substr(1), 16));\r\n return encodeURIComponent(text).replace(excludeExp, encode).replace(/%20/g, '+');\r\n}\r\n\r\n/**\r\n * Unescape dangerous chars in a query string component.\r\n *\r\n * @param {string} text - encoded key or value\r\n * @returns {string} decoded string\r\n * @see {@link encodeQueryComponent}\r\n */\r\nfunction decodeQueryComponent(text) {\r\n return decodeURIComponent(text.replace(/\\+/g, ' '));\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Array} array of (key, value) pairs.\r\n */\r\nfunction getUrlParameters(url) {\r\n url = url || window.location.search;\r\n\r\n const query = url.substring(url.indexOf('?') + 1);\r\n const search = /([^&=]+)=?([^&]*)/g;\r\n const result = [];\r\n let match;\r\n\r\n while ((match = search.exec(query)) !== null) { // eslint-disable-line no-cond-assign\r\n result.push([decodeQueryComponent(match[1]), decodeQueryComponent(match[2])]);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters as a hash.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Object}\r\n */\r\nfunction getUrlParametersAsDict(url) {\r\n const result = {};\r\n const a = getUrlParameters(url);\r\n for (let i = 0; i < a.length; ++i) {\r\n const [key, value] = a[i];\r\n result[key] = value;\r\n }\r\n return result;\r\n}\r\n\r\nfunction resolveURL(str) {\r\n if (typeof URL !== 'undefined') {\r\n try {\r\n if (typeof window !== 'undefined') {\r\n return new URL(str, window.location).href;\r\n }\r\n return new URL(str).href;\r\n } catch (error) {\r\n // IE 11 has a URL object with no constructor available so just try a different approach instead\r\n }\r\n }\r\n if (typeof document !== 'undefined') {\r\n const anchor = document.createElement('a');\r\n anchor.href = str;\r\n return anchor.href;\r\n }\r\n return str;\r\n}\r\n\r\n/**\r\n * Generates regular expression object that includes all symbols\r\n * listed in the argument\r\n * @param symbolStr {string} - String containing characters list.\r\n * @returns {RegExp} - Regular expression.\r\n */\r\nfunction generateRegExp(symbolStr) {\r\n const symbolList = [];\r\n\r\n for (let i = 0, n = symbolStr.length; i < n; ++i) {\r\n symbolList[symbolList.length] = symbolStr[i].charCodeAt(0).toString(16);\r\n }\r\n\r\n const listStr = symbolList.join('|');\r\n\r\n return new RegExp(`%(?:${listStr})`, 'gi');\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Create HTML element\r\n\r\nfunction createElement(tag, attrs, content) {\r\n const element = document.createElement(tag);\r\n let i;\r\n let n;\r\n if (attrs) {\r\n const keys = Object.keys(attrs);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n element.setAttribute(key, attrs[key]);\r\n }\r\n }\r\n if (content) {\r\n if (!(content instanceof Array)) {\r\n content = [content];\r\n }\r\n for (i = 0, n = content.length; i < n; ++i) {\r\n const child = content[i];\r\n if (typeof child === 'string') {\r\n element.appendChild(document.createTextNode(child));\r\n } else if (child instanceof HTMLElement) {\r\n element.appendChild(child);\r\n }\r\n }\r\n }\r\n return element;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Easy inheritance\r\n\r\n/**\r\n * Derive the class from the base.\r\n * @param cls {function} - Class (constructor) to derive.\r\n * @param base {function} - Class (constructor) to derive from.\r\n * @param members {object=} - Optional instance members to add.\r\n * @param statics {object=} - Optional static class members to add.\r\n * @returns {function} Original class.\r\n */\r\nfunction deriveClass(cls, base, members, statics) {\r\n cls.prototype = _.assign(Object.create(base.prototype), { constructor: cls }, members);\r\n if (statics) {\r\n _.assign(cls, statics);\r\n }\r\n return cls;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Deep prototyping\r\n\r\nfunction deriveDeep(obj, needZeroOwnProperties) {\r\n let res = obj;\r\n let i;\r\n let n;\r\n if (obj instanceof Array) {\r\n res = new Array(obj.length);\r\n for (i = 0, n = obj.length; i < n; ++i) {\r\n res[i] = deriveDeep(obj[i]);\r\n }\r\n } else if (obj instanceof Object) {\r\n res = Object.create(obj);\r\n const keys = Object.keys(obj);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = obj[key];\r\n const copy = deriveDeep(value);\r\n if (copy !== value) {\r\n res[key] = copy;\r\n }\r\n }\r\n if (needZeroOwnProperties && Object.keys(res).length > 0) {\r\n res = Object.create(res);\r\n }\r\n }\r\n return res;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Colors\r\n\r\nfunction hexColor(color) {\r\n const hex = (`0000000${color.toString(16)}`).substr(-6);\r\n return `#${hex}`;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Debug tracing\r\n\r\nfunction DebugTracer(namespace) {\r\n let enabled = false;\r\n\r\n this.enable = function (on) {\r\n enabled = on;\r\n };\r\n\r\n let indent = 0;\r\n const methods = Object.keys(namespace);\r\n\r\n function wrap(method_, name_) {\r\n return function (...args) {\r\n const spaces = DebugTracer.spaces.substr(0, indent * 2);\r\n if (enabled) {\r\n logger.debug(`${spaces + name_} {`);\r\n }\r\n indent++;\r\n const result = method_.apply(this, args); // eslint-disable-line no-invalid-this\r\n indent--;\r\n if (enabled) {\r\n logger.debug(`${spaces}} // ${name_}`);\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n for (let i = 0, n = methods.length; i < n; ++i) {\r\n const name = methods[i];\r\n const method = namespace[name];\r\n if (method instanceof Function && name !== 'constructor') {\r\n namespace[name] = wrap(method, name);\r\n }\r\n }\r\n}\r\n\r\nDebugTracer.spaces = ' ';\r\n\r\nclass OutOfMemoryError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'OutOfMemoryError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction allocateTyped(TypedArrayName, size) {\r\n let result = null;\r\n try {\r\n result = new TypedArrayName(size);\r\n } catch (e) {\r\n if (e instanceof RangeError) {\r\n throw new OutOfMemoryError(e.message);\r\n } else {\r\n throw e;\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Float array conversion\r\n\r\nfunction bytesToBase64(/** ArrayBuffer */ buffer) {\r\n const bytes = new Uint8Array(buffer);\r\n let binary = '';\r\n for (let i = 0; i < bytes.byteLength; i++) {\r\n binary += String.fromCharCode(bytes[i]);\r\n }\r\n return window.btoa(binary);\r\n}\r\n\r\nfunction bytesFromBase64(/** string */ str) {\r\n const binary = window.atob(str);\r\n const bytes = new Uint8Array(binary.length);\r\n for (let i = 0; i < bytes.length; ++i) {\r\n bytes[i] = binary[i].charCodeAt(0);\r\n }\r\n return bytes.buffer;\r\n}\r\n\r\nfunction arrayToBase64(/** number[] */ array, /** function */ TypedArrayClass) {\r\n return bytesToBase64(new TypedArrayClass(array).buffer);\r\n}\r\n\r\nfunction arrayFromBase64(/** string */ str, /** function */ TypedArrayClass) {\r\n return Array.prototype.slice.call(new TypedArrayClass(bytesFromBase64(str)));\r\n}\r\n\r\n// NOTE: this is 1-level comparison\r\nfunction compareOptionsWithDefaults(opts, defOpts) {\r\n const optsStr = [];\r\n if (defOpts && opts) {\r\n const keys = Object.keys(opts);\r\n for (let p = 0; p < keys.length; ++p) {\r\n const key = keys[p];\r\n const value = opts[key];\r\n // TODO add processing for tree structure\r\n if (!(value instanceof Object) && typeof defOpts[key] !== 'undefined' && defOpts[key] !== value) {\r\n optsStr.push(`${key}:${value}`);\r\n }\r\n }\r\n if (optsStr.length > 0) {\r\n return `!${optsStr.join()}`;\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nfunction isAlmostPlainObject(o) {\r\n if (_.isPlainObject(o)) {\r\n return true;\r\n }\r\n const proto = o && Object.getPrototypeOf(o);\r\n return !!proto && !proto.hasOwnProperty('constructor') && isAlmostPlainObject(proto);\r\n}\r\n\r\n/**\r\n * Build an object that contains properties (and subproperties) of `src` different from those\r\n * in `dst`. Objects are parsed recursively, other values (including arrays) are compared for\r\n * equality using `_.isEqual()`.\r\n * @param {!object} src - a new object to compare, may contain changed or new properties\r\n * @param {!object} dst - an old reference object\r\n */\r\nfunction objectsDiff(src, dst) {\r\n const diff = {};\r\n _.forIn(src, (srcValue, key) => {\r\n const dstValue = dst[key];\r\n if (isAlmostPlainObject(srcValue) && isAlmostPlainObject(dstValue)) {\r\n const deepDiff = objectsDiff(srcValue, dstValue);\r\n if (!_.isEmpty(deepDiff)) {\r\n diff[key] = deepDiff;\r\n }\r\n } else if (!_.isEqual(srcValue, dstValue)) {\r\n diff[key] = srcValue;\r\n }\r\n });\r\n return diff;\r\n}\r\n\r\nfunction forInRecursive(object, callback) {\r\n function iterateThrough(obj, prefix) {\r\n _.forIn(obj, (value, key) => {\r\n const newPref = prefix + (prefix.length > 0 ? '.' : '');\r\n if (value instanceof Object) {\r\n iterateThrough(value, newPref + key);\r\n } else if (value !== undefined) {\r\n callback(value, newPref + key);\r\n }\r\n });\r\n }\r\n iterateThrough(object, '');\r\n}\r\n\r\nfunction enquoteString(value) {\r\n if (_.isString(value)) {\r\n return `\"${value.replace(/\"/g, '\\\\\"')}\"`;\r\n }\r\n return value;\r\n}\r\n\r\nfunction unquoteString(value) {\r\n if (!_.isString(value)) {\r\n return value;\r\n }\r\n if (value[0] === '\"' && value[value.length - 1] === '\"') {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\\"/g, '\"');\r\n }\r\n if (value[0] === \"'\" && value[value.length - 1] === \"'\") {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\'/g, \"'\");\r\n }\r\n throw new SyntaxError('Incorrect string format, can\\'t unqute it');\r\n}\r\n\r\nfunction getFileExtension(fileName) {\r\n return fileName.slice((Math.max(0, fileName.lastIndexOf('.')) || Infinity));\r\n}\r\n\r\nfunction splitFileName(fileName) {\r\n const ext = getFileExtension(fileName);\r\n const name = fileName.slice(0, fileName.length - ext.length);\r\n return [name, ext];\r\n}\r\n\r\nfunction dataUrlToBlob(url) {\r\n const parts = url.split(/[:;,]/);\r\n const partsCount = parts.length;\r\n if (partsCount >= 3 && parts[partsCount - 2] === 'base64') {\r\n return new Blob([bytesFromBase64(parts[partsCount - 1])]);\r\n }\r\n return null;\r\n}\r\n\r\nfunction getBrowser() {\r\n if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1\r\n && navigator.userAgent\r\n && navigator.userAgent.indexOf('CriOS') === -1\r\n && navigator.userAgent.indexOf('FxiOS') === -1) {\r\n return browserType.SAFARI;\r\n }\r\n return browserType.DEFAULT;\r\n}\r\n\r\nfunction shotOpen(url) {\r\n if (typeof window !== 'undefined') {\r\n window.open().document.write(``);\r\n }\r\n}\r\n\r\nfunction shotDownload(dataUrl, filename) {\r\n if (!dataUrl || dataUrl.substr(0, 5) !== 'data:') {\r\n return;\r\n }\r\n if (!filename) {\r\n filename = ['screenshot-', +new Date(), '.png'].join('');\r\n }\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(dataUrlToBlob(dataUrl), filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(dataUrlToBlob(dataUrl));\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction download(data, filename, type) {\r\n const blobData = new Blob([data]);\r\n\r\n if (!filename) {\r\n filename = ['data', +new Date()].join('');\r\n }\r\n\r\n if (!type) {\r\n filename += blobData.type || '.bin';\r\n } else {\r\n filename += `.${type}`;\r\n }\r\n\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(blobData, filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(blobData);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction copySubArrays(src, dst, indices, itemSize) {\r\n for (let i = 0, n = indices.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n dst[i * itemSize + j] = src[indices[i] * itemSize + j];\r\n }\r\n }\r\n}\r\n\r\nfunction shallowCloneNode(node) {\r\n const newNode = node.cloneNode(true);\r\n newNode.worldPos = node.worldPos;\r\n // .style property is readonly, so \"newNode.style = node.style;\" won't work (and we don't need it, right?)\r\n return newNode;\r\n}\r\n\r\nconst unquotedStringRE = /^[a-zA-Z0-9_]*$/;\r\nconst enquoteHelper = ['\"', '', '\"'];\r\n\r\n// verify and correct if needed selctor identifier\r\nfunction correctSelectorIdentifier(value) {\r\n if (unquotedStringRE.test(value)) {\r\n return value;\r\n }\r\n // quote incorrect identifier\r\n enquoteHelper[1] = value;\r\n return enquoteHelper.join('');\r\n}\r\n\r\n/**\r\n * Concatenates two TypedArray. Doesn't check null refs o type equality\r\n * Attention! It must be use very rarely because requires memory reallocation every time. Use MergeTypedArraysUnsafe to\r\n * unite array of subarrays.\r\n * @param{TypedArray} first - destination array\r\n * @param{TypedArray} second - source array\r\n * @returns{TypedArray} resulting concatenated array\r\n */\r\nfunction concatTypedArraysUnsafe(first, second) {\r\n const result = new first.constructor(first.length + second.length);\r\n result.set(first);\r\n result.set(second, first.length);\r\n return result;\r\n}\r\n\r\n/**\r\n * Merges array of TypedArray into TypedArray. Doesn't check null refs o type equality\r\n * @param{array} array - source array of subarrays\r\n * @returns{TypedArray} resulting merged array\r\n */\r\nfunction mergeTypedArraysUnsafe(array) {\r\n if (array.length <= 0) {\r\n return null;\r\n }\r\n // count the size\r\n const size = array.reduce((acc, cur) => acc + cur.length, 0);\r\n // create combined array\r\n const result = new array[0].constructor(size);\r\n for (let i = 0, start = 0; i < array.length; i++) {\r\n const count = array[i].length;\r\n result.set(array[i], start);\r\n start += count;\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Exports\r\n\r\nexport default {\r\n browserType,\r\n encodeQueryComponent,\r\n decodeQueryComponent,\r\n getUrlParameters,\r\n getUrlParametersAsDict,\r\n resolveURL,\r\n generateRegExp,\r\n createElement,\r\n deriveClass,\r\n deriveDeep,\r\n hexColor,\r\n DebugTracer,\r\n OutOfMemoryError,\r\n allocateTyped,\r\n bytesFromBase64,\r\n bytesToBase64,\r\n arrayFromBase64,\r\n arrayToBase64,\r\n compareOptionsWithDefaults,\r\n objectsDiff,\r\n forInRecursive,\r\n enquoteString,\r\n unquoteString,\r\n getBrowser,\r\n shotOpen,\r\n shotDownload,\r\n copySubArrays,\r\n shallowCloneNode,\r\n correctSelectorIdentifier,\r\n getFileExtension,\r\n splitFileName,\r\n download,\r\n concatTypedArraysUnsafe,\r\n mergeTypedArraysUnsafe,\r\n};\r\n","import EventDispatcher from './EventDispatcher';\r\n\r\nexport default class JobHandle extends EventDispatcher {\r\n constructor() {\r\n super();\r\n this._shouldCancel = false;\r\n }\r\n\r\n cancel() {\r\n this._shouldCancel = true;\r\n this.dispatchEvent({ type: 'cancel' });\r\n }\r\n\r\n shouldCancel() {\r\n return this._shouldCancel;\r\n }\r\n\r\n // slaves use this to notify master about their events\r\n // master routes these notifications to a single event slot\r\n notify(event) {\r\n this.dispatchEvent({ type: 'notification', slaveEvent: event });\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport utils from './utils';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\n\r\nconst VERSION = 0;\r\n\r\n//----------------------------------------------------------------------------\r\n// DEFAULT SETTINGS\r\n//----------------------------------------------------------------------------\r\n\r\n/**\r\n * Polygonal complexity settings.\r\n *\r\n * @typedef PolyComplexity\r\n * @property {number} poor\r\n * @property {number} low\r\n * @property {number} medium\r\n * @property {number} high\r\n * @property {number} ultra\r\n */\r\n\r\n/**\r\n * @alias SettingsObject\r\n * @namespace\r\n */\r\nconst defaults = {\r\n /**\r\n * Default options for all available modes.\r\n * Use {@link Mode.id} as a dictionary key to access mode options.\r\n *\r\n * Usually you don't need to override these settings. You may specify mode options as a parameter during\r\n * {@link Mode} construction.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {LinesModeOptions} LN - Lines mode options.\r\n * @property {LicoriceModeOptions} LC - Licorice mode options.\r\n * @property {BallsAndSticksModeOptions} BS - Balls and Sticks mode options.\r\n * @property {VanDerWaalsModeOptions} VW - Van der Waals mode options.\r\n * @property {TraceModeOptions} TR - Trace mode options.\r\n * @property {TubeModeOptions} TU - Tube mode options.\r\n * @property {CartoonModeOptions} CA - Cartoon mode options.\r\n * @property {QuickSurfaceModeOptions} QS - Contact Surface mode options.\r\n * @property {IsoSurfaceSASModeOptions} SA - Solvent Accessible Surface mode options.\r\n * @property {IsoSurfaceSESModeOptions} SE - Solvent Excluded Surface mode options.\r\n * @property {ContactSurfaceModeOptions} CS - Contact Surface mode options.\r\n * @property {TextModeOptions} TX - Text mode options.\r\n * @property {VolumeDensityModeOptions} VD - Volume Density mode options.\r\n */\r\n modes: {\r\n //----------------------------------------------------------------------------\r\n // BALLS AND STICKS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Balls and Sticks mode options.\r\n *\r\n * @typedef BallsAndSticksModeOptions\r\n *\r\n * @property {number} atom - Sphere radius as a fraction of Van der Waals atom radius.\r\n * @property {number} bond - Cylinder radius in angstroms.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n BS: {\r\n atom: 0.23,\r\n bond: 0.15,\r\n space: 0.5,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VAN DER WAALS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Van der Waals mode options.\r\n *\r\n * @typedef VanDerWaalsModeOptions\r\n *\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VW: {\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 8,\r\n high: 16,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LINES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Lines mode options.\r\n *\r\n * @typedef LinesModeOptions\r\n *\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {number} offsarom - Offset between bonds and aromatic cycle.\r\n * @property {number} chunkarom - Number of pieces in a-loop arc, corresponding to atom.\r\n * @property {number} atom - Collision radius for atoms picking.\r\n * @property {number} lineWidth - Line width in pixels (not used in thin lines).\r\n */\r\n LN: {\r\n multibond: true,\r\n showarom: true,\r\n offsarom: 0.2,\r\n chunkarom: 10,\r\n atom: 0.23,\r\n lineWidth: 2,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LICORICE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Licorice mode options.\r\n *\r\n * @typedef LicoriceModeOptions\r\n *\r\n * @property {number} bond - Bond cylinder radius.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Poly complexity values for render modes.\r\n */\r\n LC: {\r\n bond: 0.20,\r\n space: 0.0,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SAS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Accessible Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSASModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SA: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Excluded Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSESModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SE: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // QUICK SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Quick Surface mode options.\r\n *\r\n * @typedef QuickSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} scale - Radius scale for the surface being built.\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} gaussLim - Gauss lim for coloring the bigger the value, the smoother our colors are.\r\n * @property {PolyComplexity} gridSpacing - Poly complexity values for render modes. In this case the value\r\n * corresponds to the grid density.\r\n */\r\n QS: {\r\n isoValue: 0.5,\r\n gaussLim: {\r\n poor: 1.5,\r\n low: 2.0,\r\n medium: 2.5,\r\n high: 3.0,\r\n ultra: 4.0,\r\n },\r\n scale: 1.0,\r\n wireframe: false,\r\n gridSpacing: {\r\n poor: 2,\r\n low: 1.5,\r\n medium: 1,\r\n high: 0.5,\r\n ultra: 0.25,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CONTACT SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Contact Surface mode options.\r\n *\r\n * @typedef ContactSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} probeRadius - Probe radius.\r\n * @property {number} probePositions\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Radius scale for the surface being built.\r\n * Poly complexity values for render modes. In this case the value corresponds to the grid density.\r\n */\r\n CS: {\r\n probeRadius: 1.4,\r\n isoValue: 1.5,\r\n wireframe: false,\r\n probePositions: 30,\r\n polyComplexity: {\r\n poor: 0.5,\r\n low: 1.0,\r\n medium: 1.5,\r\n high: 1.75,\r\n ultra: 2.0,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TRACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Trace mode options.\r\n *\r\n * @typedef TraceModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n TR: {\r\n radius: 0.30,\r\n polyComplexity: {\r\n poor: 12,\r\n low: 16,\r\n medium: 32,\r\n high: 64,\r\n ultra: 64,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TUBE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Tube mode options.\r\n *\r\n * @typedef TubeModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {number} tension - Tension for interpolation.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n TU: {\r\n radius: 0.30,\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CARTOON\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Cartoon mode options.\r\n *\r\n * @typedef CartoonModeOptions\r\n *\r\n * @property {number} radius - Standard tube radius.\r\n * @property {number} depth - Height of the secondary structure ribbon.\r\n * @property {number} tension - Tension for interpolation.\r\n * @proprety {object} ss - Secondary structure parameters.\r\n * @proprety {object} ss.helix - Options for helices render.\r\n * @proprety {number} ss.helix.width - Width of the secondary structure ribbon.\r\n * @proprety {number} ss.helix.arrow - Secondary structure's arrow width.\r\n * @proprety {object} ss.strand - Options for strands render.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * polyComplexity must be even for producing symmetric arrows.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n CA: {\r\n radius: 0.30,\r\n depth: 0.25,\r\n ss: {\r\n helix: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n strand: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n },\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TEXT\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Text mode options.\r\n *\r\n * @typedef TextModeOptions\r\n *\r\n * @property {string} template - Format string for building output text.\r\n * @property {string} horizontalAlign - Text alignment ('left', 'right', 'center').\r\n * @property {string} verticalAlign - Vertical text box alignment ('top', 'bottom', 'middle').\r\n * @property {number} dx - Text offset x in angstroms.\r\n * @property {number} dy - Text offset y in angstroms.\r\n * @property {number} dz - Text offset z in angstroms.\r\n * @property {string} fg - Color rule for foreground.\r\n * @property {string} bg - Color rule for background.\r\n * @property {boolean} showBg - Flag, that toggles background rendering.\r\n *\r\n */\r\n TX: {\r\n template: '{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}',\r\n horizontalAlign: 'center',\r\n verticalAlign: 'middle',\r\n dx: 0,\r\n dy: 0,\r\n dz: 1,\r\n fg: 'none',\r\n bg: '0x202020',\r\n showBg: true,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VOLUME DENSITY\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Volume density mode options.\r\n *\r\n * @typedef VolumeDensityModeOptions\r\n *\r\n * @property {number} kSigma - Noise threshold coefficient.\r\n * @property {boolean} frame - flag, that turns on box frame painting.\r\n * @property {boolean} isoMode - flag, that turns on IsoSurface mode instead of Volume Rendering.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VD: {\r\n kSigma: 1.0,\r\n kSigmaMed: 2.0,\r\n kSigmaMax: 4.0,\r\n frame: true,\r\n isoMode: false,\r\n polyComplexity: {\r\n poor: 2,\r\n low: 3,\r\n medium: 4,\r\n high: 8,\r\n ultra: 10,\r\n },\r\n },\r\n },\r\n\r\n /**\r\n * Default options for all available colorers.\r\n * Use {@link Colorer.id} as a dictionary key to access colorer options.\r\n *\r\n * Usually you don't need to override these settings. You may specify colorer options as a parameter during\r\n * {@link Colorer} construction.\r\n *\r\n * Not all colorers have options.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {ElementColorerOptions} EL - Element colorer options.\r\n * @property {SequenceColorerOptions} SQ - Sequence colorer options.\r\n * @property {MoleculeColorerOptions} MO - Molecule colorer options.\r\n * @property {UniformColorerOptions} UN - Uniform colorer options.\r\n * @property {ConditionalColorerOptions} CO - Conditional colorer options.\r\n * @property {TemperatureColorerOptions} TM - Temperature colorer options.\r\n * @property {OccupancyColorerOptions} OC - Occupancy colorer options.\r\n * @property {HydrophobicityColorerOptions} HY - Hydrophobicity colorer options.\r\n */\r\n colorers: {\r\n /**\r\n * Element colorer options.\r\n *\r\n * @typedef ElementColorerOptions\r\n *\r\n * @property {number} carbon - Carbon color or -1 to use default.\r\n */\r\n EL: {\r\n carbon: -1,\r\n },\r\n\r\n /**\r\n * Uniform colorer options.\r\n *\r\n * @typedef UniformColorerOptions\r\n *\r\n * @property {number} color - Single color to paint with.\r\n */\r\n UN: {\r\n color: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Conditional colorer options.\r\n *\r\n * @typedef ConditionalColorerOptions\r\n *\r\n * @property {string} subset - Selector string.\r\n * @property {number} color - Color of selected atoms.\r\n * @property {number} baseColor - Color of other atoms.\r\n */\r\n CO: {\r\n subset: 'charged',\r\n color: 0xFF0000,\r\n baseColor: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Carbon colorer options.\r\n *\r\n * @typedef CarbonColorerOptions\r\n *\r\n * @property {number} color - Single color to paint carbons\r\n * @property {number} factor - Color factor for not carbon atoms.\r\n */\r\n CB: {\r\n color: 0x909090,\r\n factor: 0.6,\r\n },\r\n\r\n /**\r\n * Sequence colorer options.\r\n *\r\n * @typedef SequenceColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n SQ: {\r\n gradient: 'rainbow',\r\n },\r\n\r\n /**\r\n * Temperature colorer options.\r\n *\r\n * @typedef TemperatureColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n * @property {number} min - Minimal temperature.\r\n * @property {number} max - Maximal temperature.\r\n */\r\n TM: {\r\n gradient: 'temp',\r\n min: 5,\r\n max: 40,\r\n },\r\n\r\n /**\r\n * Occupancy colorer options.\r\n *\r\n * @typedef OccupancyColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n OC: {\r\n gradient: 'reds',\r\n },\r\n\r\n /**\r\n * Hydrophobicity colorer options.\r\n *\r\n * @typedef HydrophobicityColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n HY: {\r\n gradient: 'blue-red',\r\n },\r\n\r\n /**\r\n * Molecule colorer options.\r\n *\r\n * @typedef MoleculeColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n MO: {\r\n gradient: 'rainbow',\r\n },\r\n },\r\n\r\n /*\r\n * Use antialiasing in WebGL.\r\n * @type {boolean}\r\n */\r\n antialias: true,\r\n\r\n /*\r\n * Camera field of view in degrees.\r\n * @type {number}\r\n */\r\n camFov: 45.0,\r\n\r\n /*\r\n * Camera near plane distance.\r\n * @type {number}\r\n */\r\n camNear: 0.5,\r\n\r\n /*\r\n * Camera far plane distance.\r\n * @type {number}\r\n */\r\n camFar: 100.0,\r\n\r\n camDistance: 2.5,\r\n\r\n radiusToFit: 1.0,\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogNearFactor: 0.5, // [0, 1]\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogFarFactor: 1, // [0, 1]\r\n fogAlpha: 1.0,\r\n fogColor: 0x000000,\r\n fogColorEnable: false,\r\n\r\n /**\r\n * Palette used for molecule coloring.\r\n * @type {string}\r\n */\r\n palette: 'JM',\r\n\r\n /*\r\n * Geometry resolution.\r\n * @type {string}\r\n */\r\n resolution: 'medium',\r\n\r\n autoResolution: false/* true */,\r\n\r\n autoPreset: true,\r\n\r\n preset: 'default', // TODO: remove 'preset' from settings, implement autodetection\r\n\r\n presets: {\r\n // Default\r\n default: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n empty: [],\r\n\r\n // Wireframe\r\n wire: [{\r\n mode: 'LN',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Small molecules\r\n small: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Proteins, nucleic acids etc.\r\n macro: [{\r\n mode: 'CA',\r\n colorer: 'SS',\r\n selector: 'not hetatm',\r\n material: 'SF',\r\n }, {\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'hetatm and not water',\r\n material: 'SF',\r\n }],\r\n },\r\n\r\n objects: {\r\n line: {\r\n color: 0xFFFFFFFF,\r\n dashSize: 0.3,\r\n gapSize: 0.05,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n\r\n bg: {\r\n color: 0x202020,\r\n transparent: false,\r\n },\r\n\r\n draft: {\r\n clipPlane: false,\r\n clipPlaneFactor: 0.5,\r\n clipPlaneSpeed: 0.00003,\r\n },\r\n\r\n /*\r\n * Separate group for plugins.\r\n * Each plugin handles its field by itself.\r\n */\r\n plugins: {\r\n\r\n },\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n axes: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fog: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fps: true,\r\n\r\n /**\r\n * Switch using of z-sprites for sphere and cylinder geometry\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zSprites: true,\r\n\r\n isoSurfaceFakeOpacity: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n suspendRender: true,\r\n\r\n nowater: false,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autobuild: true,\r\n\r\n /**\r\n * Anti-aliasing.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fxaa: true,\r\n /**\r\n * Outline depths\r\n * @type {boolean}\r\n * @instance\r\n */\r\n outline: {\r\n on: false,\r\n color: 0x000000,\r\n threshold: 0.1,\r\n thickness: 1,\r\n },\r\n\r\n /**\r\n * Ambient Occlusion special effect.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n ao: false,\r\n\r\n /**\r\n * Shadows options.\r\n *\r\n * @property {boolean} shadowMap - enable/disable.\r\n * @property {string} basic/percentage-closer filtering/non-uniform randomizing pcf.\r\n * @property {number} radius for percentage-closer filtering.\r\n */\r\n shadow: {\r\n on: false,\r\n type: 'random'/* basic, pcf, random */,\r\n radius: 1.0,\r\n },\r\n\r\n /**\r\n * Auto-rotation with constant speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n autoRotation: 0.0,\r\n\r\n /**\r\n * Set maximum fps for animation.\r\n * @type {number}\r\n * @instance\r\n */\r\n maxfps: 30,\r\n\r\n /**\r\n * Set fbx output precision.\r\n * @type {number}\r\n * @instance\r\n */\r\n fbxprec: 4,\r\n\r\n /**\r\n * Auto-rotation axis.\r\n *\r\n * - true: complex auto-rotation is about vertical axis\r\n * - false: rotation axis is defined by last user rotation\r\n *\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autoRotationAxisFixed: true,\r\n\r\n /**\r\n * Enable zooming with mouse wheel or pinch gesture.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zooming: true,\r\n\r\n /**\r\n * Enable picking atoms & residues with left mouse button or touch.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n picking: true,\r\n\r\n /**\r\n * Set picking mode ('atom', 'residue', 'chain', 'molecule').\r\n * @type {string}\r\n * @instance\r\n */\r\n pick: 'atom',\r\n\r\n /**\r\n * Make \"component\" and \"fragment\" editing modes available.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n editing: false,\r\n\r\n /**\r\n * Detect aromatic loops.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n aromatic: false,\r\n\r\n /**\r\n * Load only one biological unit from all those described in PDB file.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n singleUnit: true,\r\n\r\n /**\r\n * Set stereo mode ('NONE', 'SIMPLE', 'DISTORTED', 'ANAGLYPH', 'WEBVR').\r\n * @type {string}\r\n * @instance\r\n */\r\n stereo: 'NONE',\r\n\r\n /**\r\n * Enable smooth transition between views\r\n * @type {boolean}\r\n * @instance\r\n */\r\n interpolateViews: true,\r\n\r\n /**\r\n * Set transparency mode ('standard', 'prepass').\r\n * @type {string}\r\n * @instance\r\n */\r\n transparency: 'prepass',\r\n\r\n /**\r\n * Mouse translation speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n translationSpeed: 2,\r\n\r\n debug: {\r\n example: 3.5,\r\n text: 'hello!',\r\n good: true,\r\n ssaoKernelRadius: 0.7,\r\n ssaoFactor: 0.7,\r\n stereoBarrel: 0.25,\r\n },\r\n use: {\r\n multiFile: false,\r\n },\r\n};\r\n\r\n//----------------------------------------------------------------------------\r\n// SETTINGS CLASS\r\n//----------------------------------------------------------------------------\r\n\r\nfunction Settings() {\r\n EventDispatcher.call(this);\r\n\r\n this.old = null;\r\n this.now = {};\r\n this._changed = {};\r\n\r\n this.reset();\r\n}\r\n\r\nutils.deriveClass(Settings, EventDispatcher, {\r\n defaults,\r\n\r\n set(path, value) {\r\n if (_.isString(path)) {\r\n const oldValue = _.get(this.now, path);\r\n if (oldValue !== value) {\r\n _.set(this.now, path, value);\r\n this._notifyChange(path, value);\r\n }\r\n } else {\r\n const diff = utils.objectsDiff(path, this.now);\r\n if (!_.isEmpty(diff)) {\r\n _.merge(this.now, diff);\r\n this._notifyChanges(diff);\r\n }\r\n }\r\n },\r\n\r\n get(path, defaultValue) {\r\n return _.get(this.now, path, defaultValue);\r\n },\r\n\r\n reset() {\r\n const diff = utils.objectsDiff(defaults, this.now);\r\n this.now = _.cloneDeep(defaults);\r\n this.old = null;\r\n this._notifyChanges(diff);\r\n this._changed = {};\r\n },\r\n\r\n checkpoint() {\r\n this.old = _.cloneDeep(this.now);\r\n this._changed = {};\r\n },\r\n\r\n _notifyChange(path, value) {\r\n this._changed[path] = true;\r\n this.dispatchEvent({ type: `change:${path}`, value });\r\n },\r\n\r\n _notifyChanges(diff) {\r\n utils.forInRecursive(diff, (deepValue, deepPath) => {\r\n this._notifyChange(deepPath, deepValue);\r\n });\r\n },\r\n\r\n changed() {\r\n if (!this.old) {\r\n return [];\r\n }\r\n const { old, now } = this;\r\n const keys = _.filter(Object.keys(this._changed), (key) => _.get(old, key) !== _.get(now, key));\r\n return keys;\r\n },\r\n\r\n applyDiffs(diffs) {\r\n if (diffs.hasOwnProperty('VERSION') && diffs.VERSION !== VERSION) {\r\n throw new Error('Settings version does not match!');\r\n }\r\n // VERSION shouldn't be presented inside settings structure\r\n delete diffs.VERSION;\r\n this.reset();\r\n this.set(diffs);\r\n },\r\n\r\n getDiffs(versioned) {\r\n const diffs = utils.objectsDiff(this.now, defaults);\r\n if (versioned) {\r\n diffs.VERSION = VERSION;\r\n }\r\n return diffs;\r\n },\r\n\r\n setPluginOpts(plugin, opts) {\r\n defaults.plugins[plugin] = _.cloneDeep(opts);\r\n this.now.plugins[plugin] = _.cloneDeep(opts);\r\n },\r\n});\r\n\r\n\r\nexport default new Settings();\r\n","import _ from 'lodash';\r\nimport settings from './settings';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\n\r\nlet repIndex = 0;\r\n\r\nfunction asBoolean(value) {\r\n return !(!value || value === '0' || (_.isString(value) && value.toLowerCase() === 'false'));\r\n}\r\n\r\nconst adapters = {\r\n string: String,\r\n number: Number,\r\n boolean: asBoolean,\r\n};\r\n\r\n// Level 1 assignment symbol\r\nconst cL1Ass = '=';\r\n\r\nconst cOptsSep = '!';\r\n// Level 2 (options) assignment symbol\r\nconst cL2Ass = ':';\r\n// Level 2 (options) separator symbol\r\nconst cLSep = ',';\r\n\r\nconst cCommonIgnoreSymbols = '$;@/?';\r\n/**\r\n * We may (and should) leave as is for better readability:\r\n *\r\n * $ , ; : @ / ?\r\n */\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n */\r\nfunction getLevel1ExcludedExpr() {\r\n const cLevel1Ignores = ':,';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel1Ignores);\r\n}\r\n\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n * (options, etc, ..)\r\n */\r\nfunction getLevel2ExcludedExpr() {\r\n const cLevel2Ignores = ' ';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel2Ignores);\r\n}\r\n\r\nconst cL1ExclExpr = getLevel1ExcludedExpr();\r\nfunction encodeQueryComponentL1(value) {\r\n return utils.encodeQueryComponent(value, cL1ExclExpr);\r\n}\r\n\r\nconst cL2ExclExpr = getLevel2ExcludedExpr();\r\nfunction encodeQueryComponentL2(value) {\r\n return utils.encodeQueryComponent(value, cL2ExclExpr);\r\n}\r\n\r\nfunction ensureRepList(opts) {\r\n let { reps } = opts;\r\n if (!reps) {\r\n const { presets } = settings.now;\r\n let preset = opts.preset || settings.now.preset;\r\n reps = presets[preset];\r\n if (!reps) {\r\n logger.warn(`Unknown preset \"${preset}\"`);\r\n [preset] = Object.keys(presets);\r\n reps = presets[preset]; // fall back to any preset\r\n }\r\n opts.preset = preset;\r\n opts.reps = utils.deriveDeep(reps, true);\r\n }\r\n}\r\n\r\nfunction ensureRepAssign(opts, prop, value) {\r\n ensureRepList(opts);\r\n const rep = opts.reps[repIndex];\r\n // prop specified twice therefore start new rep by cloning the current\r\n if (rep.hasOwnProperty(prop)) {\r\n repIndex = opts.reps.length;\r\n opts.reps[repIndex] = utils.deriveDeep(rep, true);\r\n }\r\n if (value !== undefined) {\r\n opts.reps[repIndex][prop] = value;\r\n }\r\n}\r\n\r\nfunction addObject(opts, params, options) {\r\n if (opts._objects === undefined) {\r\n opts._objects = [];\r\n }\r\n\r\n const [type, newOpts] = options;\r\n const newObj = {\r\n type,\r\n params,\r\n };\r\n\r\n if (newOpts !== undefined) {\r\n newObj.opts = newOpts;\r\n }\r\n\r\n opts._objects[opts._objects.length] = newObj;\r\n}\r\n\r\nfunction parseParams(str, params) {\r\n const sep = str.indexOf(',');\r\n if (sep >= 0) {\r\n params.push(str.substr(sep + 1).split(','));\r\n return str.substr(0, sep);\r\n }\r\n // keep this untouched if no params were extracted\r\n return str;\r\n}\r\n\r\nfunction extractArgs(input, defaultsDict, params) {\r\n if (input) {\r\n const bang = input.indexOf(cOptsSep);\r\n const inputVal = parseParams(input.substr(0, bang >= 0 ? bang : undefined), params);\r\n if (bang >= 0) {\r\n const args = input.substr(bang + 1).split(cLSep);\r\n input = inputVal;\r\n if (defaultsDict) {\r\n const defaults = defaultsDict[input];\r\n const opts = utils.deriveDeep(defaults, true);\r\n args.forEach((arg) => {\r\n const pair = arg.split(cL2Ass, 2);\r\n const key = decodeURIComponent(pair[0]);\r\n const value = decodeURIComponent(pair[1]);\r\n const adapter = adapters[typeof _.get(defaults, key)];\r\n if (adapter) {\r\n _.set(opts, key, adapter(value));\r\n } else {\r\n logger.warn(`Unknown argument \"${key}\" for option \"${input}\"`);\r\n }\r\n });\r\n if (Object.keys(opts).length > 0) {\r\n input = [input, opts];\r\n }\r\n }\r\n } else {\r\n input = inputVal;\r\n }\r\n }\r\n return input;\r\n}\r\n\r\nconst actions = {\r\n\r\n l: 'load',\r\n load: String,\r\n t: 'type',\r\n type: String,\r\n v: 'view',\r\n view: String,\r\n u: 'unit',\r\n unit: Number,\r\n menu: asBoolean,\r\n\r\n // Commands\r\n\r\n o: 'object',\r\n object(value, opts) {\r\n const params = [];\r\n let options = extractArgs(value, settings.defaults.objects, params);\r\n if (!Array.isArray(options)) {\r\n options = [options];\r\n }\r\n addObject(opts, params[0], options);\r\n },\r\n\r\n p: 'preset',\r\n preset(value, opts) {\r\n opts.preset = value;\r\n opts.reps = null;\r\n ensureRepList(opts);\r\n },\r\n\r\n r: 'rep',\r\n rep(value, opts) {\r\n ensureRepList(opts);\r\n repIndex = Number(value);\r\n // clamp the index to one greater than the last\r\n repIndex = repIndex <= opts.reps.length ? (repIndex < 0 ? 0 : repIndex) : opts.reps.length;\r\n // create a new rep if it is adjacent to the existing ones\r\n if (repIndex === opts.reps.length) {\r\n // if there is no rep to derive from, derive from the first rep of the default\r\n opts.reps[repIndex] = repIndex > 0 ? utils.deriveDeep(opts.reps[repIndex - 1], true)\r\n : utils.deriveDeep(settings.defaults.presets.default[0], true);\r\n }\r\n },\r\n\r\n s: 'select',\r\n select(value, opts) {\r\n ensureRepAssign(opts, 'selector', value);\r\n },\r\n\r\n m: 'mode',\r\n mode(value, opts) {\r\n ensureRepAssign(opts, 'mode', extractArgs(value, settings.defaults.modes));\r\n },\r\n\r\n c: 'color',\r\n color(value, opts) {\r\n ensureRepAssign(opts, 'colorer', extractArgs(value, settings.defaults.colorers));\r\n },\r\n\r\n mt: 'material',\r\n material(value, opts) {\r\n ensureRepAssign(opts, 'material', extractArgs(value, settings.defaults.materials));\r\n },\r\n\r\n dup(value, opts) {\r\n ensureRepList(opts);\r\n const { reps } = opts;\r\n const rep = reps[repIndex];\r\n repIndex = reps.length;\r\n reps[repIndex] = utils.deriveDeep(rep, true);\r\n },\r\n\r\n // Settings shortcuts\r\n\r\n ar: 'autoResolution',\r\n};\r\n\r\nfunction _fromArray(entries) {\r\n repIndex = 0;\r\n\r\n const opts = {};\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const /** string[] */ entry = entries[i];\r\n let /** string? */ key = entry[0];\r\n const /** string? */ value = entry[1];\r\n let /** function|string? */ action = actions[key];\r\n\r\n // unwind shortcuts and aliases\r\n while (_.isString(action)) {\r\n key = action;\r\n action = actions[key];\r\n }\r\n\r\n // either set a property or use specialized parser\r\n if (!action) {\r\n const adapter = adapters[typeof _.get(settings.defaults, key)];\r\n if (adapter) {\r\n _.set(opts, `settings.${key}`, adapter(value));\r\n } else {\r\n logger.warn(`Unknown option \"${key}\"`);\r\n }\r\n } else if (_.isFunction(action)) {\r\n const result = action(value, opts);\r\n if (result !== undefined) {\r\n opts[key] = result;\r\n }\r\n }\r\n }\r\n\r\n return opts;\r\n}\r\n\r\nfunction fromAttr(attr) {\r\n return _fromArray(utils.getUrlParameters(`?${attr || ''}`));\r\n}\r\n\r\nfunction fromURL(url) {\r\n return _fromArray(utils.getUrlParameters(url));\r\n}\r\n\r\nfunction _processOptsForURL(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = encodeQueryComponentL2(key) + cL2Ass + encodeQueryComponentL2(value);\r\n });\r\n return str.join(cLSep);\r\n}\r\n\r\nfunction _processArgsForURL(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]}${cOptsSep}${_processOptsForURL(args[1])}`;\r\n}\r\n\r\nfunction _processObjForURL(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += `,${objOpts.params.join(',')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += cOptsSep + _processOptsForURL(objOpts.opts);\r\n }\r\n return res;\r\n}\r\n\r\nfunction toURL(opts) {\r\n const stringList = [];\r\n let idx = 0;\r\n\r\n function checkAndAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n stringList[idx++] = encodeQueryComponentL1(prefix)\r\n + cL1Ass + encodeQueryComponentL1(value);\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n if (_.isEmpty(repList[i])) {\r\n continue;\r\n }\r\n checkAndAdd('r', i);\r\n checkAndAdd('s', repList[i].selector);\r\n checkAndAdd('m', _processArgsForURL(repList[i].mode));\r\n checkAndAdd('c', _processArgsForURL(repList[i].colorer));\r\n checkAndAdd('mt', _processArgsForURL(repList[i].material));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('o', _processObjForURL(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('l', opts.load);\r\n checkAndAdd('u', opts.unit);\r\n checkAndAdd('p', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n checkAndAdd('v', opts.view);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(key, value);\r\n });\r\n\r\n let url = '';\r\n if (typeof window !== 'undefined') {\r\n const { location } = window;\r\n url = `${location.protocol}//${location.host}${location.pathname}`;\r\n }\r\n if (stringList.length > 0) {\r\n url += `?${stringList.join('&')}`;\r\n }\r\n\r\n return url;\r\n}\r\n\r\nfunction _processOptsForScript(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = `${key}=${utils.enquoteString(value)}`;\r\n });\r\n return str.join(' ');\r\n}\r\n\r\nfunction _processArgsForScript(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]} ${_processOptsForScript(args[1])}`;\r\n}\r\n\r\nfunction _processObjForScript(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += ` ${objOpts.params.map(utils.enquoteString).join(' ')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += ` ${_processOptsForScript(objOpts.opts)}`;\r\n }\r\n return res;\r\n}\r\n\r\nfunction _processRepsForScript(rep, index) {\r\n const repString = [];\r\n let strIdx = 0;\r\n function localAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n repString[strIdx++] = prefix + value;\r\n }\r\n }\r\n if (_.isEmpty(rep)) {\r\n return null;\r\n }\r\n localAdd('', index);\r\n localAdd('s=', utils.enquoteString(rep.selector));\r\n localAdd('m=', _processArgsForScript(rep.mode));\r\n localAdd('c=', _processArgsForScript(rep.colorer));\r\n localAdd('mt=', _processArgsForScript(rep.material));\r\n return repString.join(' ');\r\n}\r\n\r\nfunction toScript(opts) {\r\n const commandsList = [];\r\n let idx = 0;\r\n function checkAndAdd(command, value, saveQuotes) {\r\n if (value !== null && value !== undefined) {\r\n const quote = (typeof value === 'string' && saveQuotes) ? '\"' : '';\r\n commandsList[idx++] = `${command} ${quote}${value}${quote}`.trim();\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n checkAndAdd('rep', _processRepsForScript(repList[i], i));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('', _processObjForScript(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('set', 'autobuild false');\r\n checkAndAdd('load', opts.load, true);\r\n checkAndAdd('unit', opts.unit);\r\n checkAndAdd('preset', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(`set ${key}`, value, true);\r\n });\r\n checkAndAdd('view', opts.view);\r\n checkAndAdd('set', 'autobuild true');\r\n return commandsList.join('\\n');\r\n}\r\n\r\nexport default {\r\n fromURL,\r\n fromAttr,\r\n adapters,\r\n toURL,\r\n toScript,\r\n};\r\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","/**\r\n * Atom measurements.\r\n *\r\n * @param {Residue} residue - (required) Residue containing the atom\r\n * @param {string} name - (required) Name, unique in the residue\r\n * @param {Element} type - (required) Chemical element reference\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n *\r\n * @param {number} role - Role of atom inside monomer: Lead and wing are particularity interesting\r\n * @param {boolean} het - Non-standard residue indicator\r\n *\r\n * @param {number} serial - Serial number, unique in the model\r\n * @param {string} location - Alternative location indicator (usually space or A-Z)\r\n * @param {number} occupancy - Occupancy percentage, from 0 to 1\r\n * @param {number} temperature - Temperature\r\n * @param {number} charge - Charge\r\n *\r\n * @exports Atom\r\n * @constructor\r\n */\r\n\r\nclass Atom {\r\n constructor(residue, name, type, position, role, het, serial, location, occupancy, temperature, charge) {\r\n this.index = -1;\r\n this.residue = residue;\r\n this.name = name;\r\n this.element = type;\r\n this.position = position;\r\n this.role = role;\r\n this.mask = 1 | 0;\r\n\r\n this.het = het;\r\n\r\n this.serial = serial;\r\n this.location = (location || ' ').charCodeAt(0);\r\n this.occupancy = occupancy || 1;\r\n this.temperature = temperature;\r\n this.charge = charge;\r\n this.hydrogenCount = -1; // explicitly invalid\r\n this.radicalCount = 0;\r\n this.valence = -1; // explicitly invalid\r\n\r\n this.bonds = [];\r\n\r\n this.flags = 0x0000;\r\n if (type.name === 'H') {\r\n this.flags |= Atom.Flags.HYDROGEN;\r\n } else if (type.name === 'C') {\r\n this.flags |= Atom.Flags.CARBON;\r\n }\r\n }\r\n\r\n isHet() {\r\n return this.het;\r\n }\r\n\r\n isHydrogen() {\r\n return this.element.number === 1;\r\n }\r\n\r\n getVisualName() {\r\n const { name } = this;\r\n if (name.length > 0) {\r\n return name;\r\n }\r\n return this.element.name.trim();\r\n }\r\n\r\n forEachBond(process) {\r\n const { bonds } = this;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n getFullName() {\r\n let name = '';\r\n if (this.residue !== null) {\r\n if (this.residue._chain !== null) {\r\n name += `${this.residue._chain.getName()}.`;\r\n }\r\n name += `${this.residue._sequence}.`;\r\n }\r\n name += this.name;\r\n return name;\r\n }\r\n\r\n /**\r\n * Enumeration of atom flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n CARBON: 0x0001,\r\n // OXYGEN: 0x0002,\r\n // NITROGEN: 0x0004,\r\n HYDROGEN: 0x0008,\r\n /** Non-polar hydrogen (it is also a HYDROGEN) */\r\n NONPOLARH: 0x1008,\r\n };\r\n}\r\n\r\nexport default Atom;\r\n","class Element {\r\n constructor(number, name, fullName, weight, radius, radiusBonding, hValency) {\r\n this.number = number;\r\n this.name = name;\r\n this.fullName = fullName;\r\n this.weight = weight;\r\n this.radius = radius;\r\n this.radiusBonding = radiusBonding;\r\n this.hydrogenValency = hValency;\r\n }\r\n\r\n static Constants = {\r\n /* eslint-disable no-magic-numbers */\r\n U1: 1,\r\n Lead: 2,\r\n U2: 3,\r\n Wing: 4,\r\n U18: 18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n static Role = {\r\n /* eslint-disable no-magic-numbers */\r\n N: Element.Constants.U1,\r\n CA: Element.Constants.Lead,\r\n C: Element.Constants.U2,\r\n O: Element.Constants.Wing,\r\n SG: Element.Constants.U18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByAtomicNumber = [\r\n /* eslint-disable no-magic-numbers */\r\n null,\r\n new Element(1, 'H', 'Hydrogen', 1.008, 1.2, 0.23, [1]),\r\n new Element(2, 'HE', 'Helium', 4.003, 1.4, 0.93, [0]),\r\n new Element(3, 'LI', 'Lithium', 6.941, 1.82, 0.68, [1]),\r\n new Element(4, 'BE', 'Beryllium', 9.012, 1.7, 0.35, [2]),\r\n new Element(5, 'B', 'Boron', 10.81, 2.08, 0.83, [3]),\r\n new Element(6, 'C', 'Carbon', 12.011, 1.95, 0.68, [4]),\r\n new Element(7, 'N', 'Nitrogen', 14.007, 1.85, 0.68, [3, 5]),\r\n new Element(8, 'O', 'Oxygen', 15.999, 1.7, 0.68, [2, 4]),\r\n new Element(9, 'F', 'Fluorine', 18.998, 1.73, 0.64, [1]),\r\n new Element(10, 'NE', 'Neon', 20.18, 1.54, 1.12, [0]),\r\n new Element(11, 'NA', 'Sodium', 22.99, 2.27, 0.97, [1]),\r\n new Element(12, 'MG', 'Magnesium', 24.305, 1.73, 1.1, [2]),\r\n new Element(13, 'AL', 'Aluminum', 26.981, 2.05, 1.35, [3]),\r\n new Element(14, 'SI', 'Silicon', 28.086, 2.1, 1.2, [4]),\r\n new Element(15, 'P', 'Phosphorus', 30.974, 2.08, 0.75, [3, 5]),\r\n new Element(16, 'S', 'Sulfur', 32.07, 2, 1.02, [2, 4, 6]),\r\n new Element(17, 'CL', 'Chlorine', 35.453, 1.97, 0.99, [1, 3, 5, 7]),\r\n new Element(18, 'AR', 'Argon', 39.948, 1.88, 1.57, [0]),\r\n new Element(19, 'K', 'Potassium', 39.1, 2.75, 1.33, [1]),\r\n new Element(20, 'CA', 'Calcium', 40.08, 1.973, 0.99, [2]),\r\n new Element(21, 'SC', 'Scandium', 44.956, 1.7, 1.44, [0]),\r\n new Element(22, 'TI', 'Titanium', 47.88, 1.7, 1.47, [0]),\r\n new Element(23, 'V', 'Vanadium', 50.941, 1.7, 1.33, [0]),\r\n new Element(24, 'CR', 'Chromium', 52, 1.7, 1.35, [0]),\r\n new Element(25, 'MN', 'Manganese', 54.938, 1.7, 1.35, [0]),\r\n new Element(26, 'FE', 'Iron', 55.847, 1.7, 1.34, [0]),\r\n new Element(27, 'CO', 'Cobalt', 58.93, 1.7, 1.33, [0]),\r\n new Element(28, 'NI', 'Nickel', 58.69, 1.63, 1.5, [0]),\r\n new Element(29, 'CU', 'Copper', 63.55, 1.4, 1.52, [0]),\r\n new Element(30, 'ZN', 'Zinc', 65.39, 1.39, 1.45, [0]),\r\n new Element(31, 'GA', 'Gallium', 69.72, 1.87, 1.22, [3]),\r\n new Element(32, 'GE', 'Germanium', 72.61, 1.7, 1.17, [4]),\r\n new Element(33, 'AS', 'Arsenic', 74.92, 1.85, 1.21, [3, 5]),\r\n new Element(34, 'SE', 'Selenium', 78.96, 1.9, 1.22, [2, 4, 6]),\r\n new Element(35, 'BR', 'Bromine', 79.9, 2.1, 1.21, [1, 3, 5, 7]),\r\n new Element(36, 'KR', 'Krypton', 83.8, 2.02, 1.91, [0]),\r\n new Element(37, 'RB', 'Rubidium', 85.47, 1.7, 1.47, [1]),\r\n new Element(38, 'SR', 'Strontium', 87.62, 1.7, 1.12, [2]),\r\n new Element(39, 'Y', 'Yttrium', 88.91, 1.7, 1.78, [0]),\r\n new Element(40, 'ZR', 'Zirconium', 91.22, 1.7, 1.56, [0]),\r\n new Element(41, 'NB', 'Niobium', 92.91, 1.7, 1.48, [0]),\r\n new Element(42, 'MO', 'Molybdenum', 95.94, 1.7, 1.47, [0]),\r\n new Element(43, 'TC', 'Technetium', 98.91, 1.7, 1.35, [0]),\r\n new Element(44, 'RU', 'Ruthenium', 101.07, 1.7, 1.4, [0]),\r\n new Element(45, 'RH', 'Rhodium', 102.91, 1.7, 1.45, [0]),\r\n new Element(46, 'PD', 'Palladium', 106.42, 1.63, 1.5, [0]),\r\n new Element(47, 'AG', 'Silver', 107.87, 1.72, 1.59, [0]),\r\n new Element(48, 'CD', 'Cadmium', 112.41, 1.58, 1.69, [0]),\r\n new Element(49, 'IN', 'Indium', 114.82, 1.93, 1.63, [3]),\r\n new Element(50, 'SN', 'Tin', 118.71, 2.17, 1.46, [2, 4]),\r\n new Element(51, 'SB', 'Antimony', 121.75, 2.2, 1.46, [3, 5]),\r\n new Element(52, 'TE', 'Tellurium', 127.6, 2.06, 1.47, [2, 4, 6]),\r\n new Element(53, 'I', 'Iodine', 126.91, 2.15, 1.4, [1, 3, 5, 7]),\r\n new Element(54, 'XE', 'Xenon', 131.29, 2.16, 1.98, [0]),\r\n new Element(55, 'CS', 'Cesium', 132.91, 1.7, 1.67, [1]),\r\n new Element(56, 'BA', 'Barium', 137.33, 1.7, 1.34, [2]),\r\n new Element(57, 'LA', 'Lanthanum', 138.91, 1.7, 1.87, [0]),\r\n new Element(58, 'CE', 'Cerium', 140.12, 1.7, 1.83, [0]),\r\n new Element(59, 'PR', 'Praseodymium', 140.91, 1.7, 1.82, [0]),\r\n new Element(60, 'ND', 'Neodymium', 144.24, 1.7, 1.81, [0]),\r\n new Element(61, 'PM', 'Promethium', 144.9, 1.7, 1.8, [0]),\r\n new Element(62, 'SM', 'Samarium', 150.36, 1.7, 1.8, [0]),\r\n new Element(63, 'EU', 'Europium', 151.96, 1.7, 1.99, [0]),\r\n new Element(64, 'GD', 'Gadolinium', 157.25, 1.7, 1.79, [0]),\r\n new Element(65, 'TB', 'Terbium', 158.93, 1.7, 1.76, [0]),\r\n new Element(66, 'DY', 'Dysprosium', 162.5, 1.7, 1.75, [0]),\r\n new Element(67, 'HO', 'Holmium', 164.93, 1.7, 1.74, [0]),\r\n new Element(68, 'ER', 'Erbium', 167.26, 1.7, 1.73, [0]),\r\n new Element(69, 'TM', 'Thulium', 168.93, 1.7, 1.72, [0]),\r\n new Element(70, 'YB', 'Ytterbium', 173.04, 1.7, 1.94, [0]),\r\n new Element(71, 'LU', 'Lutetium', 174.97, 1.7, 1.72, [0]),\r\n new Element(72, 'HF', 'Hafnium', 178.49, 1.7, 1.57, [0]),\r\n new Element(73, 'TA', 'Tantalum', 180.95, 1.7, 1.43, [0]),\r\n new Element(74, 'W', 'Tungsten', 183.85, 1.7, 1.37, [0]),\r\n new Element(75, 'RE', 'Rhenium', 186.21, 1.7, 1.35, [0]),\r\n new Element(76, 'OS', 'Osmium', 190.2, 1.7, 1.37, [0]),\r\n new Element(77, 'IR', 'Iridium', 192.22, 1.7, 1.32, [0]),\r\n new Element(78, 'PT', 'Platinum', 195.08, 1.72, 1.5, [0]),\r\n new Element(79, 'AU', 'Gold', 196.97, 1.66, 1.5, [0]),\r\n new Element(80, 'HG', 'Mercury', 200.59, 1.55, 1.7, [0]),\r\n new Element(81, 'TL', 'Thallium', 204.38, 1.96, 1.55, [1, 3]),\r\n new Element(82, 'PB', 'Lead', 207.2, 2.02, 1.54, [2, 4]),\r\n new Element(83, 'BI', 'Bismuth', 208.98, 1.7, 1.54, [3, 5]),\r\n new Element(84, 'PO', 'Polonium', 210, 1.7, 1.68, [2, 4, 6]),\r\n new Element(85, 'AT', 'Astatine', 210, 1.7, 1.7, [1, 3, 5, 7]),\r\n new Element(86, 'RN', 'Radon', 222, 1.7, 2.4, [0]),\r\n new Element(87, 'FR', 'Francium', 223, 1.7, 2, [1]),\r\n new Element(88, 'RA', 'Radium', 226.03, 1.7, 1.9, [2]),\r\n new Element(89, 'AC', 'Actinium', 227.03, 1.7, 1.88, [0]),\r\n new Element(90, 'TH', 'Thorium', 232.04, 1.7, 1.79, [0]),\r\n new Element(91, 'PA', 'Protactinium', 231.04, 1.7, 1.61, [0]),\r\n new Element(92, 'U', 'Uranium', 238.03, 1.86, 1.58, [0]),\r\n new Element(93, 'NP', 'Neptunium', 237.05, 1.7, 1.55, [0]),\r\n new Element(94, 'PU', 'Plutonium', 239.1, 1.7, 1.53, [0]),\r\n new Element(95, 'AM', 'Americium', 243.1, 1.7, 1.51, [0]),\r\n new Element(96, 'CM', 'Curium', 247.1, 1.7, 1.5, [0]),\r\n new Element(97, 'BK', 'Berkelium', 247.1, 1.7, 1.5, [0]),\r\n new Element(98, 'CF', 'Californium', 252.1, 1.7, 1.5, [0]),\r\n new Element(99, 'ES', 'Einsteinium', 252.1, 1.7, 1.5, [0]),\r\n new Element(100, 'FM', 'Fermium', 257.1, 1.7, 1.5, [0]),\r\n new Element(101, 'MD', 'Mendelevium', 256.1, 1.7, 1.5, [0]),\r\n new Element(102, 'NO', 'Nobelium', 259.1, 1.7, 1.5, [0]),\r\n new Element(103, 'LR', 'Lawrencium', 260.1, 1.7, 1.5, [0]),\r\n new Element(104, 'RF', 'Rutherfordium', 261, 1.7, 1.6, [0]),\r\n new Element(105, 'DB', 'Dubnium', 262, 1.7, 1.6, [0]),\r\n new Element(106, 'SG', 'Seaborgium', 263, 1.7, 1.6, [0]),\r\n new Element(107, 'BH', 'Bohrium', 262, 1.7, 1.6, [0]),\r\n new Element(108, 'HS', 'Hassium', 265, 1.7, 1.6, [0]),\r\n new Element(109, 'MT', 'Meitnerium', 268, 1.7, 1.6, [0]),\r\n /* eslint-enable no-magic-numbers */\r\n ];\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByName = {\r\n // Duplicate atomic numbers (isotopes)\r\n /* eslint-disable no-magic-numbers */\r\n D: new Element(1, 'D', 'Deuterium', 2.014, 1.2, 0.23, [1]),\r\n T: new Element(1, 'T', 'Tritium', 3.016, 1.2, 0.23, [1]),\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // All regular elements will be added later, automatically\r\n };\r\n}\r\n\r\n(function () {\r\n const byAtomicNumber = Element.ByAtomicNumber;\r\n const byName = Element.ByName;\r\n for (let i = 0, n = byAtomicNumber.length; i < n; ++i) {\r\n const element = byAtomicNumber[i];\r\n if (element) {\r\n byName[element.name] = element;\r\n }\r\n }\r\n}());\r\n\r\n// find atom type by chemical element (or create if missing)\r\nElement.getByName = function (element) {\r\n let type = Element.ByName[element];\r\n if (!type) {\r\n type = Element.ByName[element] = new Element(0, element, 'Unknown', 0, 1.0, 0.01, [0]);\r\n }\r\n return type;\r\n};\r\n\r\nexport default Element;\r\n","const cBondTypes = {\r\n /** Was generated manually */\r\n UNKNOWN: 0,\r\n /** Simple covalent bond */\r\n COVALENT: 1,\r\n /** Aromatic bond */\r\n AROMATIC: 2,\r\n};\r\n\r\nfunction getAtomPos(atom) {\r\n return atom.position;\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Atom} left - The first atom.\r\n * @param {Atom} right - The second atom.\r\n * @param {number} order - Order of current bond.\r\n * @param {number} type - Bond type.\r\n * @param {boolean} fixed - Indicator of a pre-specified connection (in contrast with guessed one).\r\n *\r\n * @exports Bond\r\n * @constructor\r\n */\r\nclass Bond {\r\n constructor(left, right, order, type, fixed) {\r\n this._left = left;\r\n this._right = right;\r\n this._fixed = fixed;\r\n this._index = -1;\r\n if (left > right) {\r\n throw new Error('In a bond atom indices must be in increasing order');\r\n }\r\n this._order = order;\r\n this._type = type;\r\n }\r\n\r\n getLeft() {\r\n return this._left;\r\n }\r\n\r\n getRight() {\r\n return this._right;\r\n }\r\n\r\n getOrder() {\r\n return this._order;\r\n }\r\n\r\n calcLength() {\r\n return this._left.position.distanceTo(this._right.position);\r\n }\r\n\r\n _forEachNeighbour(currAtom, process) {\r\n const { bonds } = currAtom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]._left !== currAtom ? bonds[i]._left : bonds[i]._right);\r\n }\r\n }\r\n\r\n forEachLevelOne(process) {\r\n const left = this._left;\r\n const right = this._right;\r\n this._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n this._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n }\r\n\r\n forEachLevelTwo(process) {\r\n // TODO refactor this piece of an art?\r\n const left = this._left;\r\n const right = this._right;\r\n const self = this;\r\n self._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === left) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n self._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === right) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n }\r\n\r\n _fixDir(refPoint, currDir, posGetter) {\r\n // count atoms to the right and to the left of the current plane\r\n let rightCount = 0;\r\n let leftCount = 0;\r\n const tmpVec = refPoint.clone();\r\n function checkDir(atom) {\r\n tmpVec.copy(posGetter(atom));\r\n tmpVec.sub(refPoint);\r\n const dotProd = currDir.dot(tmpVec);\r\n if (dotProd > 0) {\r\n ++rightCount;\r\n } else {\r\n ++leftCount;\r\n }\r\n }\r\n function checkCarbon(atom) {\r\n if (atom.element.name === 'C') {\r\n checkDir(atom);\r\n }\r\n }\r\n // count all atoms to the left and right of our plane, start from level 1 and carbons\r\n const stages = [\r\n [this.forEachLevelOne, checkCarbon],\r\n [this.forEachLevelOne, checkDir],\r\n [this.forEachLevelTwo, checkCarbon],\r\n [this.forEachLevelTwo, checkDir],\r\n ];\r\n\r\n for (let stageId = 0; stageId < stages.length; ++stageId) {\r\n stages[stageId][0].call(this, stages[stageId][1]);\r\n if (leftCount > rightCount) {\r\n return currDir.multiplyScalar(-1);\r\n }\r\n if (leftCount < rightCount) {\r\n return currDir;\r\n }\r\n }\r\n return currDir;\r\n }\r\n\r\n calcNormalDir(posGetter) {\r\n const left = this._left;\r\n const right = this._right;\r\n let first = left;\r\n let second = right;\r\n posGetter = posGetter === undefined ? getAtomPos : posGetter;\r\n if (left.bonds.length > right.bonds.length) {\r\n first = right;\r\n second = left;\r\n }\r\n let third = first;\r\n let maxNeibs = 0;\r\n const { bonds } = second;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n let another = bonds[i]._left;\r\n if (bonds[i]._left === second) {\r\n another = bonds[i]._right;\r\n }\r\n if (another.bonds.length > maxNeibs && another !== first) {\r\n third = another;\r\n maxNeibs = another.bonds.length;\r\n }\r\n }\r\n const secondPos = posGetter(second);\r\n const firstV = posGetter(first).clone().sub(secondPos);\r\n const secondV = posGetter(third).clone().sub(secondPos);\r\n secondV.crossVectors(firstV, secondV);\r\n if (secondV.lengthSq() < 0.0001) {\r\n secondV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n secondV.normalize();\r\n firstV.crossVectors(secondV, firstV);\r\n if (firstV.lengthSq() < 0.0001) {\r\n firstV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n return this._fixDir(secondPos, firstV, posGetter);\r\n }\r\n\r\n static BondType = cBondTypes;\r\n}\r\n\r\nBond.prototype.BondType = cBondTypes;\r\n\r\nexport default Bond;\r\n","import * as THREE from 'three';\r\nimport Atom from './Atom';\r\nimport Element from './Element';\r\n\r\nconst cNucleicControlNames = ['C3\\'', 'C3*', 'P', 'H5T', 'H3T'];\r\nconst cNucleicWing1Names = ['OP1', 'O1P'];\r\nconst cNucleicWing2Names = ['OP2', 'O2P'];\r\n\r\nconst cCylinderSource = ['C3\\'', 'C3*', 'C1', 'C1\\'', 'C1*', 'P'];\r\nconst cCylinderTarget = [{\r\n types: ['A', 'DA', 'G', 'DG'],\r\n atoms: ['N1'],\r\n}, {\r\n types: ['C', 'DC'],\r\n atoms: ['N3'],\r\n}, {\r\n types: ['T', 'DT', 'U', 'DU'],\r\n atoms: ['O4'],\r\n}];\r\n\r\n/**\r\n * Residue instance.\r\n *\r\n * @param {Chain} chain - Chain this residue belongs to.\r\n * @param {ResidueType} type - Generic residue instance type.\r\n * @param {number} sequence - Sequence ID.\r\n * @param {string} icode - One character insertion code (usually space or A-Z).\r\n *\r\n * @exports Residue\r\n * @constructor\r\n */\r\nclass Residue {\r\n constructor(chain, type, sequence, icode) {\r\n this._chain = chain;\r\n this._component = null;\r\n this._type = type;\r\n this._sequence = sequence;\r\n this._icode = icode;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n\r\n this._atoms = [];\r\n this._secondary = null;\r\n this._firstAtom = null;\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n this._lastAtom = null;\r\n this._controlPoint = null;\r\n this._midPoint = null;\r\n this._wingVector = null;\r\n this._cylinders = null;\r\n this._isValid = true;\r\n this._het = false;\r\n this._molecule = null;\r\n this.temperature = null;\r\n this.occupancy = null;\r\n }\r\n\r\n // Getters and setters\r\n getChain() {\r\n return this._chain;\r\n }\r\n\r\n getMolecule() {\r\n return this._molecule;\r\n }\r\n\r\n getType() {\r\n return this._type;\r\n }\r\n\r\n getSequence() {\r\n return this._sequence;\r\n }\r\n\r\n getSecondary() {\r\n return this._secondary;\r\n }\r\n\r\n getICode() {\r\n return this._icode;\r\n }\r\n\r\n // Other methods\r\n\r\n addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge) {\r\n const atom = new Atom(this, name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n const complex = this._chain.getComplex();\r\n complex.addAtom(atom);\r\n this._atoms.push(atom);\r\n this._het = this._het || het;\r\n return atom;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n if (process(atoms[i])) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n _findAtomByName(name) {\r\n let res = null;\r\n this.forEachAtom((atom) => {\r\n if (atom.name === name) {\r\n res = atom;\r\n return true;\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _findFirstAtomInList(names) {\r\n let res = null;\r\n for (let i = 0; i < names.length; ++i) {\r\n res = this._findAtomByName(names[i]);\r\n if (res !== null) {\r\n return res;\r\n }\r\n }\r\n return res;\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n mask &= atoms[i].mask;\r\n }\r\n this._mask = mask;\r\n }\r\n\r\n getCylinderTargetList() {\r\n const type = this._type._name;\r\n for (let i = 0, n = cCylinderTarget.length; i < n; ++i) {\r\n for (let j = 0, m = cCylinderTarget[i].types.length; j < m; ++j) {\r\n if (type === cCylinderTarget[i].types[j]) {\r\n return cCylinderTarget[i].atoms;\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n _detectLeadWing(dst, next, getAtomPosition) {\r\n const leadAtom = this._findFirstAtomInList(cNucleicControlNames);\r\n let wingStart = this._findFirstAtomInList(cNucleicWing1Names);\r\n let wingEnd = this._findFirstAtomInList(cNucleicWing2Names);\r\n\r\n if (wingStart === null && next !== null) {\r\n wingStart = next._findFirstAtomInList(cNucleicWing1Names);\r\n }\r\n\r\n if (wingEnd === null && next !== null) {\r\n wingEnd = next._findFirstAtomInList(cNucleicWing2Names);\r\n }\r\n\r\n if (leadAtom === null || wingStart === null || wingEnd === null) {\r\n return;\r\n }\r\n\r\n dst._leadAtom = leadAtom;\r\n dst._controlPoint = getAtomPosition(leadAtom);\r\n dst._wingVector = getAtomPosition(wingEnd).clone().sub(getAtomPosition(wingStart));\r\n dst._isValid = true;\r\n\r\n const cylSource = this._findFirstAtomInList(cCylinderSource);\r\n const targetList = this.getCylinderTargetList();\r\n const cylTarget = targetList !== null ? this._findFirstAtomInList(targetList) : null;\r\n if (cylSource === null || cylTarget === null) {\r\n return;\r\n }\r\n dst._cylinders = [getAtomPosition(cylSource), getAtomPosition(cylTarget)];\r\n }\r\n\r\n calcWing(prevLeadPos, currLeadPos, prevWingPos, prevWing) {\r\n const vectorA = currLeadPos.clone().sub(prevLeadPos);\r\n const vectorB = prevLeadPos.clone().sub(prevWingPos);\r\n vectorB.crossVectors(vectorA, vectorB);\r\n vectorB.crossVectors(vectorA, vectorB).normalize();\r\n if (prevWing !== null && prevWing.length() > 0.0001) {\r\n const needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2;\r\n if (needToNegate) {\r\n vectorB.negate();\r\n }\r\n }\r\n return vectorB;\r\n }\r\n\r\n _innerFinalize(prevRes, prev, nextRes, dst, chainAsNucleic, getAtomPosition) {\r\n const bFirstInChain = prev === null;\r\n\r\n const lp = getAtomPosition(this._leadAtom);\r\n const currLeadPos = new THREE.Vector3(lp.x, lp.y, lp.z);\r\n if (chainAsNucleic) {\r\n this._detectLeadWing(dst, nextRes, getAtomPosition);\r\n return;\r\n }\r\n\r\n if (bFirstInChain) { // for first one in chain\r\n dst._midPoint = getAtomPosition(this._firstAtom).clone();\r\n } else {\r\n const prevLeadPos = prev._controlPoint; // lead point of previous monomer\r\n dst._midPoint = prevLeadPos.clone().lerp(currLeadPos, 0.5);\r\n dst._wingVector = this.calcWing(prevLeadPos, currLeadPos, getAtomPosition(prevRes._wingAtom), prev._wingVector);\r\n }\r\n dst._controlPoint = currLeadPos;\r\n }\r\n\r\n _finalize2(prev, next, asNucleic) {\r\n // Should be called AFTER first finalize\r\n this._innerFinalize(prev, prev, next, this, asNucleic, (atom) => atom.position);\r\n }\r\n\r\n isConnected(anotherResidue) {\r\n if (this._chain !== anotherResidue._chain) {\r\n return false;\r\n }\r\n if (this === anotherResidue) {\r\n return true;\r\n }\r\n let res = false;\r\n this.forEachAtom((atom) => {\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue === anotherResidue || bond._right.residue === anotherResidue) {\r\n res = true;\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _finalize() {\r\n const self = this;\r\n [this._firstAtom] = this._atoms;\r\n this._lastAtom = this._atoms[this._atoms.length - 1];\r\n\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n\r\n let tempCount = 0;\r\n let temperature = 0; // average temperature\r\n let occupCount = 0;\r\n let occupancy = 0; // average occupancy\r\n this.forEachAtom((a) => {\r\n if (self._leadAtom === null) {\r\n if (a.role === Element.Constants.Lead) {\r\n self._leadAtom = a;\r\n }\r\n }\r\n if (self._wingAtom === null) {\r\n if (a.role === Element.Constants.Wing) {\r\n self._wingAtom = a;\r\n }\r\n }\r\n if (a.temperature) {\r\n temperature += a.temperature;\r\n tempCount++;\r\n }\r\n if (a.occupancy) {\r\n occupancy += a.occupancy;\r\n occupCount++;\r\n }\r\n return (self._leadAtom !== null && self._wingAtom !== null);\r\n });\r\n\r\n if (tempCount > 0) {\r\n this.temperature = temperature / tempCount;\r\n }\r\n if (occupCount > 0) {\r\n this.occupancy = occupancy / occupCount;\r\n }\r\n\r\n // Still try to make monomer look valid\r\n if (this._leadAtom === null || this._wingAtom === null) {\r\n this._isValid = false;\r\n }\r\n if (this._leadAtom === null) {\r\n this._leadAtom = this._firstAtom;\r\n }\r\n if (this._wingAtom === null) {\r\n this._wingAtom = this._lastAtom;\r\n }\r\n }\r\n}\r\n\r\nexport default Residue;\r\n","/**\r\n * Residue type.\r\n *\r\n * Predefined acid or created with HET, HETNAM, etc.\r\n *\r\n * @param {string} name - Short name, either standard (ALA, MET, etc.) or non-standard one.\r\n * @param {string} fullName - Full residue name.\r\n * @param {string} letterCode - 1-letter symbol.\r\n *\r\n * @exports ResidueType\r\n * @constructor\r\n */\r\nclass ResidueType {\r\n constructor(name, fullName, letterCode) {\r\n this._name = name;\r\n this._fullName = fullName;\r\n this.letterCode = letterCode;\r\n this.flags = 0x0000;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\n static StandardTypes = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: new ResidueType('ALA', 'Alanine', 'A'),\r\n ARG: new ResidueType('ARG', 'Arginine', 'R'),\r\n ASN: new ResidueType('ASN', 'Asparagine', 'N'),\r\n ASP: new ResidueType('ASP', 'Aspartic Acid', 'D'),\r\n CYS: new ResidueType('CYS', 'Cysteine', 'C'),\r\n GLN: new ResidueType('GLN', 'Glutamine', 'Q'),\r\n GLU: new ResidueType('GLU', 'Glutamic Acid', 'E'),\r\n GLY: new ResidueType('GLY', 'Glycine', 'G'),\r\n HIS: new ResidueType('HIS', 'Histidine', 'H'),\r\n ILE: new ResidueType('ILE', 'Isoleucine', 'I'),\r\n LEU: new ResidueType('LEU', 'Leucine', 'L'),\r\n LYS: new ResidueType('LYS', 'Lysine', 'K'),\r\n MET: new ResidueType('MET', 'Methionine', 'M'),\r\n PHE: new ResidueType('PHE', 'Phenylalanine', 'F'),\r\n PRO: new ResidueType('PRO', 'Proline', 'P'),\r\n PYL: new ResidueType('PYL', 'Pyrrolysine', 'O'),\r\n SEC: new ResidueType('SEC', 'Selenocysteine', 'U'),\r\n SER: new ResidueType('SER', 'Serine', 'S'),\r\n THR: new ResidueType('THR', 'Threonine', 'T'),\r\n TRP: new ResidueType('TRP', 'Tryptophan', 'W'),\r\n TYR: new ResidueType('TYR', 'Tyrosine', 'Y'),\r\n VAL: new ResidueType('VAL', 'Valine', 'V'),\r\n A: new ResidueType('A', 'Adenine', 'A'),\r\n C: new ResidueType('C', 'Cytosine', 'C'),\r\n G: new ResidueType('G', 'Guanine', 'G'),\r\n I: new ResidueType('I', 'Inosine', 'I'),\r\n T: new ResidueType('T', 'Thymine', 'T'),\r\n U: new ResidueType('U', 'Uracil', 'U'),\r\n DA: new ResidueType('DA', 'Adenine', 'A'),\r\n DC: new ResidueType('DC', 'Cytosine', 'C'),\r\n DG: new ResidueType('DG', 'Guanine', 'G'),\r\n DI: new ResidueType('DI', 'Inosine', 'I'),\r\n DT: new ResidueType('DT', 'Thymine', 'T'),\r\n DU: new ResidueType('DU', 'Uracil', 'U'),\r\n '+A': new ResidueType('+A', 'Adenine', 'A'),\r\n '+C': new ResidueType('+C', 'Cytosine', 'C'),\r\n '+G': new ResidueType('+G', 'Guanine', 'G'),\r\n '+I': new ResidueType('+I', 'Inosine', 'I'),\r\n '+T': new ResidueType('+T', 'Thymine', 'T'),\r\n '+U': new ResidueType('+U', 'Uracil', 'U'),\r\n WAT: new ResidueType('WAT', 'Water', ''),\r\n H2O: new ResidueType('H2O', 'Water', ''),\r\n HOH: new ResidueType('HOH', 'Water', ''),\r\n DOD: new ResidueType('DOD', 'Water', ''),\r\n UNK: new ResidueType('UNK', 'Unknown', ''),\r\n UNL: new ResidueType('UNL', 'Unknown Ligand', ''),\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n /**\r\n * Enumeration of residue flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n // Amino acids\r\n /** Amino acid residue */\r\n PROTEIN: 0x0001,\r\n /** Basic amino acid residue */\r\n BASIC: 0x0002,\r\n /** Acidic amino acid residue */\r\n ACIDIC: 0x0004,\r\n /** Polar uncharged side chain amino acid residue */\r\n POLAR: 0x0008,\r\n /** Non-polar hydrophobic side chain amino acid residue */\r\n NONPOLAR: 0x0010,\r\n /** Aromatic amino acid residue */\r\n AROMATIC: 0x0020,\r\n\r\n // Nucleic acids\r\n\r\n /** Nucleic residue */\r\n NUCLEIC: 0x0100,\r\n /** Purine nucleic residue */\r\n PURINE: 0x0200,\r\n /** Pyrimidine nucleic residue */\r\n PYRIMIDINE: 0x0400,\r\n /** DNA */\r\n DNA: 0x0800,\r\n /** RNA */\r\n RNA: 0x1000,\r\n\r\n /** Water */\r\n WATER: 0x10000,\r\n };\r\n}\r\n\r\n// Flag combinations\r\nfunction _addFlag(flag, list) {\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const res = ResidueType.StandardTypes[list[i]];\r\n if (res) {\r\n res.flags |= flag;\r\n }\r\n }\r\n}\r\n\r\nconst { Flags } = ResidueType;\r\n_addFlag(Flags.WATER, ['WAT', 'H2O', 'HOH', 'DOD']);\r\n\r\n_addFlag(Flags.PROTEIN, [\r\n 'ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLY', 'GLU', 'GLN', 'HIS', 'ILE',\r\n 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'PYL', 'SEC', 'SER', 'THR', 'TRP',\r\n 'TYR', 'VAL',\r\n]);\r\n_addFlag(Flags.BASIC, ['ARG', 'HIS', 'LYS']);\r\n_addFlag(Flags.ACIDIC, ['ASP', 'GLU']);\r\n_addFlag(Flags.POLAR, ['ASN', 'CYS', 'GLN', 'SER', 'THR', 'TYR']);\r\n_addFlag(Flags.NONPOLAR, ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'VAL', 'GLY']);\r\n_addFlag(Flags.AROMATIC, ['PHE', 'TRP', 'TYR']);\r\n\r\n_addFlag(Flags.NUCLEIC, [\r\n 'A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I',\r\n 'C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U',\r\n]);\r\n_addFlag(Flags.PURINE, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I']);\r\n_addFlag(Flags.PYRIMIDINE, ['C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']);\r\n_addFlag(Flags.DNA, ['DA', 'DG', 'DI', 'DC', 'DT', 'DU']);\r\n_addFlag(Flags.RNA, ['A', 'G', 'I', 'C', 'T', 'U']);\r\n// Table of kdHydrophobicity\r\nconst hydro = {\r\n ILE: 4.5,\r\n VAL: 4.2,\r\n LEU: 3.8,\r\n PHE: 2.8,\r\n CYS: 2.5,\r\n MET: 1.9,\r\n ALA: 1.8,\r\n GLY: -0.4,\r\n THR: -0.7,\r\n SER: -0.8,\r\n TRP: -0.9,\r\n TYR: -1.3,\r\n PRO: -1.6,\r\n HIS: -3.2,\r\n GLU: -3.5,\r\n GLN: -3.5,\r\n ASP: -3.5,\r\n ASN: -3.5,\r\n LYS: -3.9,\r\n ARG: -4.5,\r\n};\r\n\r\nfunction _addParam(param, list) {\r\n const keys = Object.keys(list);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = list[key];\r\n ResidueType.StandardTypes[key][param] = value;\r\n }\r\n}\r\n\r\n_addParam('hydrophobicity', hydro);\r\n\r\nexport default ResidueType;\r\n","import * as THREE from 'three';\r\nimport Residue from './Residue';\r\nimport ResidueType from './ResidueType';\r\n\r\n/**\r\n * Residues in chain are either amino acid either nucleic acid (and water)\r\n * There might be some modified/mutated residues, which type could not be determined by their name (nucleic or amino); In this\r\n * case firstly program definites the chain type (by well-known residues) and then definites modified/mutated residues\r\n */\r\nconst ChainType = {\r\n UNKNOWN: 0,\r\n PROTEIN: 1,\r\n NUCLEIC: 2,\r\n};\r\n\r\n/**\r\n * Residue chain.\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n * @param {string} name - One character identifier (usually space, A-Z, 0-9, or a-z).\r\n *\r\n * @exports Chain\r\n * @constructor\r\n */\r\nclass Chain {\r\n constructor(complex, name) {\r\n this._complex = complex;\r\n this._name = name;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n this._residues = [];\r\n\r\n this.minSequence = Number.POSITIVE_INFINITY;\r\n this.maxSequence = Number.NEGATIVE_INFINITY;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n _determineType() {\r\n const residues = this._residues;\r\n\r\n const { PROTEIN, NUCLEIC } = ResidueType.Flags;\r\n\r\n this.type = ChainType.UNKNOWN;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const { flags } = residues[i]._type;\r\n\r\n if ((flags & NUCLEIC) !== 0) {\r\n this.type = ChainType.NUCLEIC;\r\n break;\r\n } else if ((flags & PROTEIN) !== 0) {\r\n this.type = ChainType.PROTEIN;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Finds thre residue with specified sequence number and inserion code\r\n * @param {Number} seqNum sequence number\r\n * @param {string} iCode insertion code\r\n * @returns {*} Residue or null if not found\r\n */\r\n findResidue(seqNum, iCode) {\r\n const residues = this._residues;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n if (res._sequence === seqNum && res._icode === iCode) {\r\n return [res, i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _finalize() {\r\n this._determineType();\r\n\r\n const residues = this._residues;\r\n\r\n let prev = null;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const next = (i + 1 < n) ? residues[i + 1] : null;\r\n const curr = residues[i];\r\n // TODO: skip invalid residues\r\n if (1 /* curr._isValid */) { // eslint-disable-line no-constant-condition\r\n curr._finalize2(prev, next, this.type === ChainType.NUCLEIC);\r\n prev = curr;\r\n }\r\n }\r\n\r\n // fix very first wing\r\n if (residues.length > 1 && residues[1]._wingVector) {\r\n const p = residues[1]._wingVector;\r\n residues[0]._wingVector = new THREE.Vector3(p.x, p.y, p.z);\r\n } else if (residues.length > 0) {\r\n residues[0]._wingVector = new THREE.Vector3(1, 0, 0);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const residues = this._residues;\r\n let prev = null;\r\n let prevData = null;\r\n const frameRes = frameData._residues;\r\n const n = residues.length;\r\n function getAtomPos(atom) {\r\n return frameData.getAtomPos(atom.index);\r\n }\r\n\r\n for (let i = 0; i < n; ++i) {\r\n const curr = residues[i];\r\n const currData = frameRes[curr._index];\r\n const nextRes = (i + 1 < n) ? residues[i + 1] : null;\r\n curr._innerFinalize(prev, prevData, nextRes, currData, this.type === ChainType.NUCLEIC, getAtomPos);\r\n prev = curr;\r\n prevData = currData;\r\n }\r\n\r\n frameRes[residues[0]._index]._wingVector = n > 1\r\n ? frameRes[residues[1]._index]._wingVector\r\n : new THREE.Vector3(1, 0, 0);\r\n }\r\n\r\n /**\r\n * Create a new residue.\r\n *\r\n * @param {string} name - Residue name.\r\n * @param {number} sequence - Residue sequence number.\r\n * @param {string} iCode - Insertion code.\r\n * @returns {Residue} - Newly created residue instance.\r\n */\r\n addResidue(name, sequence, iCode) {\r\n let type = this._complex.getResidueType(name);\r\n if (type === null) {\r\n type = this._complex.addResidueType(name);\r\n }\r\n const residue = new Residue(this, type, sequence, iCode);\r\n this._complex.addResidue(residue);\r\n this._residues.push(residue);\r\n\r\n if (type.flags & (ResidueType.Flags.NUCLEIC | ResidueType.Flags.PROTEIN)) {\r\n if (this.maxSequence < sequence) {\r\n this.maxSequence = sequence;\r\n }\r\n if (this.minSequence > sequence) {\r\n this.minSequence = sequence;\r\n }\r\n }\r\n\r\n return residue;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this._mask = mask;\r\n }\r\n}\r\n\r\nexport default Chain;\r\n","import Residue from './Residue';\r\n\r\n/** An element of protein secondary structure. */\r\nclass StructuralElement {\r\n /**\r\n * Create a secondary structural element of the specified type.\r\n *\r\n * @param {StructuralElement.Type} type Secondary structure type.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n */\r\n constructor(type, init, term) {\r\n /**\r\n * Secondary structure type.\r\n * @type {StructuralElement.Type}\r\n */\r\n this.type = type;\r\n /**\r\n * Generic secondary structure type.\r\n * @type {StructuralElement.Generic}\r\n */\r\n this.generic = StructuralElement.genericByType[this.type] || 'loop';\r\n /**\r\n * Initial residue.\r\n * @type Residue\r\n */\r\n this.init = init;\r\n /**\r\n * Terminal residue.\r\n * @type Residue\r\n */\r\n this.term = term;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n if (this.init instanceof Residue && this.term instanceof Residue) {\r\n return;\r\n }\r\n\r\n // Link all intermediate residues to this structural element\r\n const start = complex.splitUnifiedSerial(this.init);\r\n const end = complex.splitUnifiedSerial(this.term);\r\n for (let chainId = start.chain; chainId <= end.chain; chainId++) {\r\n for (let serialId = start.serial; serialId <= end.serial; serialId++) {\r\n for (let { iCode } = start; iCode <= end.iCode; iCode++) {\r\n const hashCode = complex.getUnifiedSerial(chainId, serialId, iCode);\r\n if (residueHash[hashCode]) {\r\n residueHash[hashCode]._secondary = this;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Replace unfined serials by objects\r\n this.init = residueHash[this.init];\r\n this.term = residueHash[this.term];\r\n }\r\n}\r\n\r\n/**\r\n * Specific type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Generic\r\n */\r\nStructuralElement.Type = {\r\n /** A strand of a [beta-sheet](https://en.wikipedia.org/wiki/Beta_sheet). */\r\n STRAND: 'E',\r\n /** An isolated beta-bridge (too small for a beta-sheet). */\r\n BRIDGE: 'B',\r\n\r\n /** A [3/10 helix](https://en.wikipedia.org/wiki/310_helix) (hydrogen bonding is 3 residues apart). */\r\n HELIX_310: 'G',\r\n /** An [alpha-helix](https://en.wikipedia.org/wiki/Alpha_helix) (hydrogen bonding is 4 residues apart). */\r\n HELIX_ALPHA: 'H',\r\n /** A [pi-helix](https://en.wikipedia.org/wiki/Pi_helix) (hydrogen bonding is 5 residues apart). */\r\n HELIX_PI: 'I',\r\n /** A generic helix of unspecified bonding distance. */\r\n HELIX: 'X',\r\n\r\n /** An isolated 3/10-like helical turn. */\r\n TURN_310: '3',\r\n /** An isolated alpha-like helical turn. */\r\n TURN_ALPHA: '4',\r\n /** An isolated pi-like helical turn. */\r\n TURN_PI: '5',\r\n /** An isolated helical [turn](https://en.wikipedia.org/wiki/Turn_(biochemistry)) of unspecified bonding distance. */\r\n TURN: 'T',\r\n\r\n /** A bend (a region of high curvature). */\r\n BEND: 'S',\r\n /** Just a protein section with no particular conformation. */\r\n COIL: 'C',\r\n};\r\n\r\n/**\r\n * Generic type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Type\r\n */\r\nStructuralElement.Generic = {\r\n /** A strand of a sheet. */\r\n STRAND: 'strand',\r\n /** A helix. */\r\n HELIX: 'helix',\r\n /** Just a protein section with no particular conformation. */\r\n LOOP: 'loop',\r\n};\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\nconst StructuralElementGeneric = StructuralElement.Generic;\r\n\r\n/**\r\n * A mapping from specific types to generic ones.\r\n * @type {Object}\r\n */\r\nStructuralElement.genericByType = {\r\n [StructuralElementType.STRAND]: StructuralElementGeneric.STRAND,\r\n [StructuralElementType.HELIX_310]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_ALPHA]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_PI]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX]: StructuralElementGeneric.HELIX,\r\n};\r\n\r\nexport default StructuralElement;\r\n","import StructuralElement from './StructuralElement';\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\nexport const typeByPDBHelixClass = {\r\n 1: StructuralElementType.HELIX_ALPHA,\r\n 3: StructuralElementType.HELIX_PI,\r\n 5: StructuralElementType.HELIX_310,\r\n};\r\n\r\n/**\r\n * Helical secondary structure of a protein.\r\n * @extends StructuralElement\r\n */\r\nclass Helix extends StructuralElement {\r\n /**\r\n * Create a helix.\r\n *\r\n * @param {number} helixClass A helix class according to the\r\n * [PDB Format](http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX).\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} serial Serial number of the helix (see PDB Format).\r\n * @param {string} name Helix identifier (see PDB Format).\r\n * @param {string} comment Comment about this helix (see PDB Format).\r\n * @param {number} length Length of this helix, in residues (see PDB Format).\r\n */\r\n constructor(helixClass, init, term, serial, name, comment, length) {\r\n super(typeByPDBHelixClass[helixClass] || StructuralElement.Type.HELIX, init, term);\r\n\r\n /**\r\n * Serial number of the helix (see PDB Format).\r\n * @type {number}\r\n */\r\n this.serial = serial;\r\n /**\r\n * Helix identifier (see PDB Format).\r\n * @type {string}\r\n */\r\n this.name = name;\r\n /**\r\n * Comment about this helix (see PDB Format).\r\n * @type {string}\r\n */\r\n this.comment = comment;\r\n /**\r\n * Length of this helix, in residues (see PDB Format).\r\n * @type {number}\r\n */\r\n this.length = length;\r\n }\r\n}\r\n\r\nexport default Helix;\r\n","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","import StructuralElement from './StructuralElement';\r\n\r\n/**\r\n * A single strand of a sheet in a protein secondary structure.\r\n * @extends StructuralElement\r\n */\r\nclass Strand extends StructuralElement {\r\n /**\r\n * Create a strand.\r\n *\r\n * @param {Sheet} sheet Parent sheet this strand belongs to.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} sense Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @param {Atom} atomCur Atom in current strand (see PDB Format).\r\n * @param {Atom} atomPrev Atom in previous strand (see PDB Format).\r\n */\r\n constructor(sheet, init, term, sense, atomCur, atomPrev) {\r\n super(StructuralElement.Type.STRAND, init, term);\r\n\r\n /**\r\n * Parent sheet this strand belongs to.\r\n * @type {Sheet}\r\n */\r\n this.sheet = sheet;\r\n /**\r\n * Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @type {number}\r\n */\r\n this.sense = sense;\r\n /**\r\n * Atom in current strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomCur = atomCur;\r\n /**\r\n * Atom in previous strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomPrev = atomPrev;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n *\r\n * @override\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n super._finalize(serialAtomMap, residueHash, complex);\r\n\r\n let as = this.atomCur;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomCur = serialAtomMap[as];\r\n }\r\n as = this.atomPrev;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomPrev = serialAtomMap[as];\r\n }\r\n }\r\n}\r\n\r\nexport default Strand;\r\n","import Strand from './Strand';\r\n\r\n/**\r\n * Sheet secondary structure of a protein.\r\n *\r\n * @param {string} name -\r\n * @param {number} width -\r\n *\r\n * @exports Sheet\r\n * @constructor\r\n */\r\nclass Sheet {\r\n constructor(name, width) {\r\n this._name = name;\r\n this._width = width;\r\n\r\n this._strands = [];\r\n }\r\n\r\n // Getters and setters\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getWidth() {\r\n return this._width;\r\n }\r\n\r\n addStrand(strand) {\r\n this._strands.push(strand);\r\n this._width = this._strands.length;\r\n }\r\n\r\n addEmptyStrand() {\r\n this._strands.push(new Strand(null, null, null, null, null, null));\r\n }\r\n\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n const s = this._strands;\r\n for (let i = 0, n = s.length; i < n; ++i) {\r\n s[i]._finalize(serialAtomMap, residueHash, complex);\r\n }\r\n if (!this._width) {\r\n this._width = s.length;\r\n }\r\n if (s.length !== this._width) {\r\n throw new Error(`Sheet ${this._name} is inconsistent.`);\r\n }\r\n }\r\n}\r\n\r\nexport default Sheet;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Atom measurements.\r\n *\r\n * @param {string} id - SGroup id\r\n * @param {string} name - Name of the group\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n * @param {array} atoms - Atoms group consists of\r\n * @param {object} saveNode - XML node from file for saving\r\n *\r\n * @exports SGroup\r\n * @constructor\r\n */\r\nclass SGroup {\r\n constructor(id, name, position, atoms, saveNode) {\r\n this._id = id;\r\n this._name = name;\r\n this._position = position || new THREE.Vector3();\r\n this._atoms = atoms || [];\r\n this._charge = 0; // default group charge\r\n this._repeat = 1; // how many times group repeated: always > 0\r\n this._center = null;\r\n this.xmlNodeRef = saveNode || null;\r\n }\r\n\r\n /**\r\n * Get atom full name.\r\n * @returns {string} Atom full name.\r\n */\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getPosition() {\r\n return this._position;\r\n }\r\n\r\n getCentralPoint() {\r\n return this._center;\r\n }\r\n\r\n _rebuildSGroupOnAtomChange() {\r\n const nLimon = 100000000;\r\n if (this._center === null) {\r\n return; // nothing to do if we are not relative\r\n }\r\n\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n for (let j = 0, n = this._atoms.length; j < n; j++) {\r\n const aPos = this._atoms[j].position;\r\n bLow.set(Math.min(bLow.x, aPos.x), Math.min(bLow.y, aPos.y), Math.min(bLow.z, aPos.z));\r\n bHight.set(Math.max(bHight.x, aPos.x), Math.max(bHight.y, aPos.y), Math.max(bHight.z, aPos.z));\r\n }\r\n this._center.addVectors(bLow, bHight);\r\n this._center.multiplyScalar(0.5);\r\n }\r\n}\r\n\r\nexport default SGroup;\r\n","/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,8],$V5=[1,9],$V6=[1,11],$V7=[1,12],$V8=[5,7,8,11],$V9=[1,17],$Va=[1,22],$Vb=[1,20],$Vc=[1,21],$Vd=[5,7,8,11,19];\r\nvar parser = {trace: function trace() { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Expression\":4,\"EOF\":5,\"Selector\":6,\"OR\":7,\"AND\":8,\"NOT\":9,\"(\":10,\")\":11,\"SELECTOR\":12,\"NAMED_SELECTOR\":13,\"SELECTOR_RANGED\":14,\"RangeList\":15,\"SELECTOR_NAMED\":16,\"NameList\":17,\"Range\":18,\",\":19,\"NUMBER\":20,\":\":21,\"Name\":22,\"IDENTIFIER\":23,\"STRING\":24,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",7:\"OR\",8:\"AND\",9:\"NOT\",10:\"(\",11:\")\",12:\"SELECTOR\",13:\"NAMED_SELECTOR\",14:\"SELECTOR_RANGED\",16:\"SELECTOR_NAMED\",19:\",\",20:\"NUMBER\",21:\":\",23:\"IDENTIFIER\",24:\"STRING\"},\r\nproductions_: [0,[3,2],[4,1],[4,3],[4,3],[4,2],[4,3],[6,1],[6,1],[6,2],[6,2],[15,1],[15,3],[18,1],[18,3],[17,1],[17,3],[22,1],[22,1],[22,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.keyword('or')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.keyword('and')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.keyword('not')($$[$0]);\r\nbreak;\r\ncase 6:\r\nthis.$ = $$[$0-1];\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.keyword($$[$0])();\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.GetSelector($$[$0].toLowerCase().slice(1, $$[$0].length));\r\nbreak;\r\ncase 9: case 10:\r\nthis.$ = yy.keyword($$[$0-1])($$[$0]);\r\nbreak;\r\ncase 11:\r\nthis.$ = new yy.RangeList($$[$0]);\r\nbreak;\r\ncase 12: case 16:\r\nthis.$ = $$[$0-2].append($$[$0]);\r\nbreak;\r\ncase 13:\r\nthis.$ = new yy.Range(Number($$[$0]));\r\nbreak;\r\ncase 14:\r\nthis.$ = new yy.Range(Number($$[$0-2]), Number($$[$0]));\r\nbreak;\r\ncase 15:\r\nthis.$ = new yy.ValueList($$[$0]);\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{1:[3]},{5:[1,10],7:$V6,8:$V7},o($V8,[2,2]),{4:13,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:14,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,7]),o($V8,[2,8]),{15:15,18:16,20:$V9},{17:18,20:$Va,22:19,23:$Vb,24:$Vc},{1:[2,1]},{4:23,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:24,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,5]),{7:$V6,8:$V7,11:[1,25]},o($V8,[2,9],{19:[1,26]}),o($Vd,[2,11]),o($Vd,[2,13],{21:[1,27]}),o($V8,[2,10],{19:[1,28]}),o($Vd,[2,15]),o($Vd,[2,17]),o($Vd,[2,18]),o($Vd,[2,19]),o([5,7,11],[2,3],{8:$V7}),o($V8,[2,4]),o($V8,[2,6]),{18:29,20:$V9},{20:[1,30]},{20:$Va,22:31,23:$Vb,24:$Vc},o($Vd,[2,12]),o($Vd,[2,14]),o($Vd,[2,16])],\r\ndefaultActions: {10:[2,1]},\r\nparseError: function parseError(str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function (match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex() {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin(condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState() {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules() {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState(n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState(condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* skip whitespace */\r\nbreak;\r\ncase 1:return 20;\r\nbreak;\r\ncase 2:return 7;\r\nbreak;\r\ncase 3:return 8;\r\nbreak;\r\ncase 4:return 9;\r\nbreak;\r\ncase 5:return 12;\r\nbreak;\r\ncase 6:return 16;\r\nbreak;\r\ncase 7:return 14;\r\nbreak;\r\ncase 8:return 10;\r\nbreak;\r\ncase 9:return 11;\r\nbreak;\r\ncase 10:return 19;\r\nbreak;\r\ncase 11:return 21;\r\nbreak;\r\ncase 12:return '<=';\r\nbreak;\r\ncase 13:return '>=';\r\nbreak;\r\ncase 14:return '<';\r\nbreak;\r\ncase 15:return '>';\r\nbreak;\r\ncase 16:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 24;\r\nbreak;\r\ncase 17:return 13;\r\nbreak;\r\ncase 18:return 23;\r\nbreak;\r\ncase 19:return 5;\r\nbreak;\r\ncase 20:return 'INVALID';\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:(-?(?:[1-9][0-9]+|[0-9]))\\b)/i,/^(?:OR\\b)/i,/^(?:AND\\b)/i,/^(?:NOT\\b)/i,/^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\\b)/i,/^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\\b)/i,/^(?:((SERIAL|SEQUENCE|RESIDX))\\b)/i,/^(?:\\()/i,/^(?:\\))/i,/^(?:,)/i,/^(?::)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:(@[_A-Z0-9]+))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:.)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","import utils from '../../utils';\r\n\r\n//----------------------------------------------------------------------------\r\nclass Range {\r\n constructor(min, max) {\r\n this.min = min;\r\n this.max = typeof max === 'undefined' ? min : max;\r\n }\r\n\r\n includes(value) {\r\n return this.min <= value && value <= this.max;\r\n }\r\n\r\n toString() {\r\n const { min, max } = this;\r\n return min === max ? String(min) : [min, max].join(':');\r\n }\r\n\r\n toJSON() {\r\n return [this.min, this.max];\r\n }\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\nclass List {\r\n constructor(arg) {\r\n if (arg instanceof this.constructor) {\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n }\r\n\r\n append(value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n }\r\n\r\n toString() {\r\n return this._values.join(',');\r\n }\r\n\r\n toJSON() {\r\n const values = this._values;\r\n const result = [];\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n result[i] = value.toJSON ? value.toJSON() : value;\r\n }\r\n return result;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nclass RangeList extends List {\r\n includes(value) {\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n if (list[i].includes(value)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nconst valuesArray = [];\r\n\r\nclass ValueList extends List {\r\n constructor(arg, upperOnly) {\r\n const list = super(arg);\r\n if (upperOnly) {\r\n this.upperOnly = true;\r\n const values = list._values;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n if (typeof value === 'string') {\r\n values[i] = value.toUpperCase();\r\n }\r\n }\r\n } else {\r\n this.upperOnly = false;\r\n }\r\n return list;\r\n }\r\n\r\n includes(value) {\r\n // we do not convert to upper case here for perfomance reasons\r\n // if list is upper case only, value must be converted before it is sent up to here\r\n return this._values.indexOf(value) !== -1;\r\n }\r\n\r\n toString() {\r\n // Quote values that are not correct identifiers\r\n const values = this._values;\r\n valuesArray.length = 0;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n valuesArray[i] = utils.correctSelectorIdentifier(String(values[i]));\r\n }\r\n return valuesArray.join(',');\r\n }\r\n\r\n _validate(value) {\r\n return (this.upperOnly && typeof value === 'string') ? value.toUpperCase() : value;\r\n }\r\n\r\n append(value) {\r\n super.append(this._validate(value));\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n super.remove(this._validate(value));\r\n return this;\r\n }\r\n}\r\n\r\nexport {\r\n Range,\r\n List,\r\n RangeList,\r\n ValueList,\r\n};\r\n","import { RangeList, ValueList } from './selectArgs';\r\n\r\n/** Base class for atom selectors. */\r\nclass Selector {\r\n toString() {\r\n return this.keyword;\r\n }\r\n\r\n toJSON() {\r\n return [this.name];\r\n }\r\n}\r\n\r\nSelector.prototype.name = 'Error';\r\nSelector.prototype.keyword = 'error';\r\n\r\n/** Base class for list-based atom selectors. */\r\nclass ListSelector extends Selector {\r\n constructor(list) {\r\n super();\r\n this.list = list;\r\n }\r\n\r\n toString() {\r\n return `${this.keyword} ${this.list}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.list.toJSON()];\r\n }\r\n}\r\n\r\nclass RangeListSelector extends ListSelector {\r\n constructor(arg) {\r\n super(new RangeList(arg));\r\n }\r\n}\r\n\r\nclass ValueListSelector extends ListSelector {\r\n constructor(arg, caseSensitive) {\r\n super(new ValueList(arg, !caseSensitive));\r\n }\r\n}\r\n\r\nclass NoneSelector extends Selector {\r\n includesAtom(_atom) {\r\n return false;\r\n }\r\n}\r\n\r\nNoneSelector.prototype.name = 'None';\r\nNoneSelector.prototype.keyword = 'none';\r\n\r\nclass AllSelector extends Selector {\r\n includesAtom(_atom) {\r\n return true;\r\n }\r\n}\r\n\r\nAllSelector.prototype.name = 'All';\r\nAllSelector.prototype.keyword = 'all';\r\n\r\nexport {\r\n Selector,\r\n ListSelector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n};\r\n","import { Selector, NoneSelector } from './selectorsBase';\r\n\r\n//----------------------------------------------------------------------------\r\n// Operators\r\n//----------------------------------------------------------------------------\r\nconst none = new NoneSelector();\r\n\r\nclass PrefixOperator extends Selector {\r\n constructor(rhs) {\r\n super();\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nPrefixOperator.prototype.priority = 1;\r\n\r\nclass InfixOperator extends Selector {\r\n constructor(lhs, rhs) {\r\n super();\r\n this.lhs = lhs || none;\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const lhs = this.lhs.priority && this.lhs.priority > this.priority ? `(${this.lhs})` : this.lhs;\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${lhs} ${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.lhs.toJSON(), this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nInfixOperator.prototype.priority = 1000;\r\n\r\nexport { PrefixOperator, InfixOperator };\r\n","import Atom from './Atom';\r\nimport ResidueType from './ResidueType';\r\nimport { parser } from '../utils/SelectionParser';\r\nimport { Range, RangeList, ValueList } from './selectors/selectArgs';\r\nimport { PrefixOperator, InfixOperator } from './selectors/selectOps';\r\nimport {\r\n Selector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n} from './selectors/selectorsBase';\r\n\r\nconst keywords = {};\r\n\r\n//----------------------------------------------------------------------------\r\n// Named selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineSelector(name, SelectorClass) {\r\n const keyword = name.toLowerCase();\r\n SelectorClass.prototype.keyword = keyword;\r\n SelectorClass.prototype.name = name;\r\n\r\n const factory = ((...args) => new SelectorClass(...args));\r\n factory.SelectorClass = SelectorClass;\r\n keywords[keyword] = factory;\r\n\r\n return SelectorClass;\r\n}\r\n\r\ndefineSelector('Serial', class SerialSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.serial);\r\n }\r\n});\r\n\r\ndefineSelector('Name', class NameSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.name);\r\n }\r\n});\r\n\r\ndefineSelector('AltLoc', class AltLocSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(String.fromCharCode(atom.location));\r\n }\r\n});\r\n\r\ndefineSelector('Elem', class ElemSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.element.name);\r\n }\r\n});\r\n\r\ndefineSelector('Residue', class ResidueSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._type._name);\r\n }\r\n});\r\n\r\ndefineSelector('Sequence', class SequenceSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._sequence);\r\n }\r\n});\r\n\r\ndefineSelector('ICode', class ICodeSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._icode);\r\n }\r\n});\r\n\r\ndefineSelector('ResIdx', class ResIdxSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._index);\r\n }\r\n});\r\n\r\ndefineSelector('Chain', class ChainSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._chain._name);\r\n }\r\n});\r\n\r\ndefineSelector('Hetatm', class HetatmSelector extends Selector {\r\n includesAtom(atom) {\r\n return atom.het;\r\n }\r\n});\r\n\r\ndefineSelector('PolarH', class PolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.HYDROGEN;\r\n }\r\n});\r\n\r\ndefineSelector('NonPolarH', class NonPolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.NONPOLARH;\r\n }\r\n});\r\n\r\ndefineSelector('All', AllSelector);\r\n\r\ndefineSelector('None', NoneSelector);\r\n\r\nconst NULL_SELECTOR = keywords.none();\r\n\r\n//----------------------------------------------------------------------------\r\n// Named operators\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineOperator(name, priority, OperatorClass) {\r\n OperatorClass.prototype.priority = priority;\r\n return defineSelector(name, OperatorClass);\r\n}\r\ndefineOperator('Not', 1, class NotOperator extends PrefixOperator {\r\n includesAtom(atom) {\r\n return !this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('And', 2, class AndOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) && this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('Or', 3, class OrOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) || this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\n//----------------------------------------------------------------------------\r\n// Flag selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction byResidueTypeFlag(flag, name) {\r\n return defineSelector(name, class extends Selector {\r\n includesAtom(atom) {\r\n return (atom.residue._type.flags & flag) !== 0;\r\n }\r\n });\r\n}\r\n\r\nbyResidueTypeFlag(ResidueType.Flags.PROTEIN, 'Protein');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC, 'Basic');\r\nbyResidueTypeFlag(ResidueType.Flags.ACIDIC, 'Acidic');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC | ResidueType.Flags.ACIDIC, 'Charged');\r\nbyResidueTypeFlag(ResidueType.Flags.POLAR, 'Polar');\r\nbyResidueTypeFlag(ResidueType.Flags.NONPOLAR, 'NonPolar');\r\nbyResidueTypeFlag(ResidueType.Flags.AROMATIC, 'Aromatic');\r\nbyResidueTypeFlag(ResidueType.Flags.NUCLEIC, 'Nucleic');\r\nbyResidueTypeFlag(ResidueType.Flags.PURINE, 'Purine');\r\nbyResidueTypeFlag(ResidueType.Flags.PYRIMIDINE, 'Pyrimidine');\r\nbyResidueTypeFlag(ResidueType.Flags.WATER, 'Water');\r\n\r\n//----------------------------------------------------------------------------\r\nconst selectors = Object.create(keywords);\r\n\r\nselectors.Selector = Selector;\r\nselectors.RangeListSelector = RangeListSelector;\r\nselectors.ValueListSelector = ValueListSelector;\r\nselectors.Range = Range;\r\nselectors.RangeList = RangeList;\r\nselectors.ValueList = ValueList;\r\nselectors.PrefixOperator = PrefixOperator;\r\nselectors.InfixOperator = InfixOperator;\r\nselectors.Context = Object.create({});\r\n\r\nselectors.GetSelector = function (key) {\r\n if (!selectors.Context.hasOwnProperty(key)) {\r\n const exc = { message: `selector ${key} is not registered` };\r\n throw exc;\r\n }\r\n return selectors.Context[key] || NULL_SELECTOR;\r\n};\r\n\r\nselectors.ClearContext = function () {\r\n Object.keys(selectors.Context).forEach((k) => { delete selectors.Context[k]; });\r\n};\r\n\r\nselectors.keyword = function (key) {\r\n return keywords[key.toLowerCase()] || keywords.none;\r\n};\r\n\r\nselectors.parse = function (str) {\r\n const res = {};\r\n try {\r\n res.selector = parser.parse(str);\r\n } catch (e) {\r\n res.selector = NULL_SELECTOR;\r\n res.error = e.message;\r\n }\r\n return res;\r\n};\r\n\r\nparser.yy = selectors;\r\nparser.yy.parseError = parser.parseError; // workaround for incorrect JISON parser generator for AMD module\r\n\r\nexport default selectors;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\n\r\n/**\r\n * Basic biological unit class.\r\n *\r\n * @exports BiologicalUnit\r\n * @constructor\r\n */\r\nclass BiologicalUnit {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._selector = selectors.keyword('All')();\r\n this._boundaries = {\r\n boundingBox: new THREE.Box3(),\r\n boundingSphere: new THREE.Sphere(),\r\n };\r\n }\r\n\r\n computeBoundaries() {\r\n const atoms = this._complex._atoms;\r\n const n = atoms.length;\r\n const selector = this._selector;\r\n\r\n const { boundingBox } = this._boundaries;\r\n boundingBox.makeEmpty();\r\n if (n === 1) {\r\n boundingBox.expandByPoint(atoms[0].position);\r\n const bbc = new THREE.Vector3();\r\n boundingBox.getCenter(bbc);\r\n const s = 2 * atoms[0].element.radius;\r\n boundingBox.setFromCenterAndSize(bbc, new THREE.Vector3(s, s, s));\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (selector.includesAtom(atoms[i])) {\r\n boundingBox.expandByPoint(atoms[i].position);\r\n }\r\n }\r\n }\r\n\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n if (n === 1) {\r\n this._boundaries.boundingSphere.set(center, atoms[0].element.radius);\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (!selector.includesAtom(atoms[i])) {\r\n continue;\r\n }\r\n const pos = atoms[i].position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n this._boundaries.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n }\r\n\r\n getTransforms() {\r\n return [];\r\n }\r\n\r\n getSelector() {\r\n return this._selector;\r\n }\r\n\r\n getBoundaries() {\r\n return this._boundaries;\r\n }\r\n\r\n finalize() {\r\n }\r\n}\r\n\r\nexport default BiologicalUnit;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\nimport BiologicalUnit from './BiologicalUnit';\r\n\r\n/**\r\n * Biological assembly.\r\n *\r\n * @exports Assembly\r\n * @constructor\r\n */\r\n\r\nclass Assembly extends BiologicalUnit {\r\n constructor(complex) {\r\n super(complex);\r\n this.chains = [];\r\n this.matrices = [];\r\n }\r\n\r\n computeBoundaries() {\r\n super.computeBoundaries();\r\n // fix up the boundaries\r\n const { matrices } = this;\r\n const oldCenter = this._boundaries.boundingSphere.center;\r\n const oldRad = this._boundaries.boundingSphere.radius;\r\n const boundingBox = this._boundaries.boundingBox = new THREE.Box3();\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = matrices.length; i < n; ++i) {\r\n boundingBox.expandByPoint(oldCenter.clone().applyMatrix4(matrices[i]));\r\n }\r\n\r\n const newRad = boundingBox.max.distanceTo(boundingBox.min) / 2 + oldRad;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n this._boundaries.boundingSphere = new THREE.Sphere().set(center, newRad);\r\n boundingBox.max.addScalar(oldRad);\r\n boundingBox.min.subScalar(oldRad);\r\n }\r\n\r\n /**\r\n * Mark a chain as belonging to this biological assembly.\r\n * @param {string} chain - chain identifier, usually a single letter\r\n */\r\n addChain(chain) {\r\n this.chains[this.chains.length] = chain;\r\n }\r\n\r\n /**\r\n * Add a transformation matrix.\r\n * @param {THREE.Matrix4} matrix - transformation matrix\r\n */\r\n addMatrix(matrix) {\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n getTransforms() {\r\n return this.matrices;\r\n }\r\n\r\n finalize() {\r\n if (this.chains.length > 0) {\r\n this._selector = selectors.keyword('Chain')(this.chains);\r\n } else {\r\n this._selector = selectors.keyword('None')();\r\n }\r\n }\r\n}\r\n\r\nexport default Assembly;\r\n","/**\r\n * This class represents connected component as a part of a complex.\r\n * WARNING! The whole component entity is build under the assumption that residues\r\n * are placed in the chains and complex in ascending order of indices\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n *\r\n * @exports Component\r\n * @constructor\r\n */\r\nclass Component {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._index = -1;\r\n this._residueIndices = [];\r\n this._cycles = [];\r\n this._subDivs = [];\r\n this._residueCount = 0;\r\n }\r\n\r\n getResidues() {\r\n return this._complex._residues;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residueCount;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._complex._residues;\r\n const resIdc = this._residueIndices;\r\n for (let idIdc = 0, idCount = resIdc.length; idIdc < idCount; ++idIdc) {\r\n for (let idx = resIdc[idIdc].start, last = resIdc[idIdc].end; idx <= last; ++idx) {\r\n process(residues[idx]);\r\n }\r\n }\r\n }\r\n\r\n setSubDivs(subDivs) {\r\n this._subDivs = subDivs;\r\n let curr = 0;\r\n const resIdc = [];\r\n let resCnt = 0;\r\n for (let i = 0, n = subDivs.length; i < n; ++i) {\r\n if (i === n - 1 || subDivs[i].end + 1 !== subDivs[i + 1].start) {\r\n const { start } = subDivs[curr];\r\n const { end } = subDivs[i];\r\n resIdc[resIdc.length] = {\r\n start,\r\n end,\r\n };\r\n resCnt += end - start + 1;\r\n curr = i + 1;\r\n }\r\n }\r\n\r\n this._residueIndices = resIdc;\r\n this._residueCount = resCnt;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._complex._bonds;\r\n\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue._component === this) {\r\n process(bond);\r\n }\r\n }\r\n }\r\n\r\n update() {\r\n this.forEachCycle((cycle) => {\r\n cycle.update();\r\n });\r\n }\r\n\r\n forEachAtom(process) {\r\n this.forEachResidue((residue) => {\r\n residue.forEachAtom(process);\r\n });\r\n }\r\n\r\n addCycle(cycle) {\r\n this._cycles.push(cycle);\r\n }\r\n\r\n forEachCycle(process) {\r\n const cycles = this._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n process(cycles[i]);\r\n }\r\n }\r\n\r\n markResidues() {\r\n const self = this;\r\n self.forEachResidue((residue) => {\r\n residue._component = self;\r\n });\r\n }\r\n\r\n _forEachSubChain(mask, process) {\r\n const residues = this._complex._residues;\r\n const subs = this._subDivs;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let idx = subs[i].start, last = subs[i].end; idx <= last; ++idx) {\r\n const currRes = residues[idx];\r\n if (mask & currRes._mask && currRes._isValid) {\r\n let end = idx + 1;\r\n for (; end <= last; ++end) {\r\n const endRes = residues[end];\r\n if (!(mask & endRes._mask && endRes._isValid)) {\r\n break;\r\n }\r\n }\r\n process(i, idx, end - 1);\r\n idx = end;\r\n }\r\n }\r\n }\r\n }\r\n\r\n getMaskedSequences(mask) {\r\n const subs = [];\r\n let idx = 0;\r\n this._forEachSubChain(mask, (_subIdx, start, end) => {\r\n subs[idx++] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n\r\n getMaskedSubdivSequences(mask) {\r\n const subs = [];\r\n let currIdx = -1;\r\n let lastSubIdx = -1;\r\n const subDivs = this._subDivs;\r\n\r\n this._forEachSubChain(mask, (subIdx, start, end) => {\r\n if (lastSubIdx !== subIdx) {\r\n ++currIdx;\r\n subs[currIdx] = {\r\n arr: [],\r\n boundaries: subDivs[subIdx],\r\n };\r\n lastSubIdx = subIdx;\r\n }\r\n subs[currIdx].arr[subs[currIdx].arr.length] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n}\r\n\r\nexport default Component;\r\n","import utils from '../utils';\r\n\r\nconst cMaxPairsForHashCode = 32;\r\nconst cHashTableSize = 1024 * 1024;\r\nconst cNumbersPerPair = 4;\r\nconst cMaxNeighbours = 14;\r\nconst cInvalidVal = -1;\r\n// 89237 is a large simple number, can be used for pseudo random hash code create\r\nconst cBigPrime = 89237;\r\n\r\nclass AtomPairs {\r\n constructor(maxPairsEstimate) {\r\n this.numPairs = 0;\r\n this.numMaxPairs = maxPairsEstimate;\r\n this.intBuffer = utils.allocateTyped(Int32Array, maxPairsEstimate * cNumbersPerPair);\r\n for (let i = 0; i < maxPairsEstimate * cNumbersPerPair; i++) {\r\n this.intBuffer[i] = cInvalidVal;\r\n }\r\n this.hashBuffer = utils.allocateTyped(Int32Array, cHashTableSize * cMaxPairsForHashCode);\r\n for (let i = 0; i < cHashTableSize * cMaxPairsForHashCode; i++) {\r\n this.hashBuffer[i] = cInvalidVal;\r\n }\r\n }\r\n\r\n /**\r\n * Destroy all pairs memory\r\n */\r\n destroy() {\r\n this.intBuffer = null;\r\n this.hashBuffer = null;\r\n }\r\n\r\n /**\r\n * Add pair of atoms to collection\r\n * @param {number} indexA - Index of the 1st vertex.\r\n * @param {number} indexB - Index of the 2nd vertex.\r\n */\r\n addPair(indexA, indexB) {\r\n const ia = (indexA < indexB) ? indexA : indexB;\r\n const ib = (indexA > indexB) ? indexA : indexB;\r\n const codeToAdd = ia + (ib << cMaxNeighbours);\r\n\r\n const hashCode = (ia + (ib * cBigPrime)) & (cHashTableSize - 1);\r\n let j = hashCode * cMaxPairsForHashCode;\r\n let apI = 0;\r\n for (; apI < cMaxPairsForHashCode; apI++) {\r\n const code = this.hashBuffer[j + apI];\r\n if (code === cInvalidVal) {\r\n break;\r\n }\r\n if (code === codeToAdd) {\r\n return false;\r\n }\r\n }\r\n // add this new hash code\r\n if (apI >= cMaxPairsForHashCode) {\r\n throw new Error('addPair: increase cMaxPairsForHashCode');\r\n }\r\n this.hashBuffer[j + apI] = codeToAdd;\r\n\r\n // actually add\r\n if (this.numPairs >= this.numMaxPairs) {\r\n throw new Error('addPair: increase num pairs');\r\n }\r\n j = this.numPairs * cNumbersPerPair;\r\n this.intBuffer[j] = ia;\r\n this.intBuffer[j + 1] = ib;\r\n this.intBuffer[j + 2] = codeToAdd;\r\n this.numPairs++;\r\n return true;\r\n }\r\n}\r\n\r\nexport default AtomPairs;\r\n","import AtomPairs from './AtomPairs';\r\nimport Bond from './Bond';\r\n\r\nconst cProfileBondBuilder = false;\r\nconst cEstBondsMultiplier = 4;\r\nconst cSpaceCode = 32;\r\nconst cBondTolerance = 0.45;\r\nconst cVMDTolerance = 0.6;\r\nconst cBondRadInJMOL = true;\r\nconst cEpsilon = 0.001;\r\n\r\n/**\r\n * Get radius used for building bonds.\r\n *\r\n * @param {Atom} atom - Atom object.\r\n * @returns {number} special value for bonding radius for this atom\r\n */\r\nfunction _getBondingRadius(atom) {\r\n const { element } = atom;\r\n if (element) {\r\n return element.radiusBonding;\r\n }\r\n throw new Error('_getBondingRadius: Logic error.');\r\n}\r\n\r\nfunction _isAtomEligible(atom) {\r\n // build for all non-hetatm and for hetatm without bonds\r\n return !atom.isHet() || (atom.bonds && atom.bonds.length === 0);\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Complex} complex molecular complex\r\n\r\n * @exports AutoBond\r\n * @constructor\r\n */\r\nclass AutoBond {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._maxRad = 1.8;\r\n const bBox = this._complex.getDefaultBoundaries().boundingBox;\r\n this._vBoxMin = bBox.min.clone();\r\n this._vBoxMax = bBox.max.clone();\r\n\r\n this._pairCollection = null;\r\n }\r\n\r\n /**\r\n * Add existing pairs of connectors (from pdb file after its reading)\r\n * @returns {number} 0\r\n */\r\n _addExistingPairs() {\r\n const atoms = this._complex.getAtoms();\r\n const numAtoms = atoms.length;\r\n let aInd = 0;\r\n const collection = this._pairCollection;\r\n\r\n for (; aInd < numAtoms; aInd++) {\r\n const { bonds } = atoms[aInd];\r\n const numBondsForAtom = bonds.length;\r\n for (let bInd = 0; bInd < numBondsForAtom; bInd++) {\r\n const bond = bonds[bInd];\r\n const indTo = bond._left.index;\r\n if (indTo === aInd) {\r\n collection.addPair(aInd, bond._right.index);\r\n }\r\n } // for (b) all bonds in atom\r\n } // for (a)\r\n return 0;\r\n }\r\n\r\n _findPairs() {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const atoms = this._complex._atoms;\r\n const atomsNum = atoms.length;\r\n const self = this;\r\n\r\n let rA;\r\n let isHydrogenA;\r\n let posA;\r\n let locationA;\r\n let atomA;\r\n\r\n const processAtom = function (atomB) {\r\n if (isHydrogenA && atomB.isHydrogen()) {\r\n return;\r\n }\r\n\r\n const locationB = atomB.location;\r\n if ((locationA !== cSpaceCode)\r\n && (locationB !== cSpaceCode)\r\n && (locationA !== locationB)) {\r\n return;\r\n }\r\n\r\n const dist2 = posA.distanceToSquared(atomB.position);\r\n const rB = atomB.element.radiusBonding;\r\n const maxAcceptable = cBondRadInJMOL ? rA + rB + cBondTolerance : cVMDTolerance * (rA + rB);\r\n\r\n if (dist2 > (maxAcceptable * maxAcceptable)) {\r\n return;\r\n }\r\n\r\n if (dist2 < cEpsilon) {\r\n return;\r\n }\r\n\r\n self._pairCollection.addPair(atomA.index, atomB.index);\r\n };\r\n\r\n for (let i = 0; i < atomsNum; ++i) {\r\n atomA = atoms[i];\r\n if (!_isAtomEligible(atomA)) {\r\n continue;\r\n }\r\n\r\n rA = atomA.element.radiusBonding;\r\n isHydrogenA = atomA.isHydrogen();\r\n posA = atomA.position;\r\n locationA = atomA.location;\r\n\r\n vw.forEachAtomWithinRadius(posA, 2 * this._maxRad + cBondTolerance, processAtom);\r\n }\r\n }\r\n\r\n _addPairs() {\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0, k = 0; i < this._pairCollection.numPairs; i++, k += 4) {\r\n const iA = this._pairCollection.intBuffer[k];\r\n const iB = this._pairCollection.intBuffer[k + 1];\r\n this._addPair(atoms[iA], atoms[iB]);\r\n }\r\n }\r\n\r\n _addPair(atomA, atomB) {\r\n const bondsA = atomA.bonds;\r\n const indexA = atomA.index;\r\n const indexB = atomB.index;\r\n for (let j = 0, numBonds = bondsA.length; j < numBonds; ++j) {\r\n const bond = bondsA[j];\r\n if (bond._left.index === indexB || bond._right.index === indexB) {\r\n return;\r\n }\r\n }\r\n const left = indexA < indexB ? atomA : atomB;\r\n const right = indexA < indexB ? atomB : atomA;\r\n const newBond = this._complex.addBond(left, right, 0, Bond.BondType.UNKNOWN, false);\r\n bondsA.push(newBond);\r\n atomB.bonds.push(newBond);\r\n }\r\n\r\n build() {\r\n if (cProfileBondBuilder) {\r\n console.time('Bonds Builder');\r\n }\r\n this._buildInner();\r\n\r\n if (cProfileBondBuilder) {\r\n console.timeEnd('Bonds Builder');\r\n }\r\n }\r\n\r\n _buildInner() {\r\n const atoms = this._complex._atoms;\r\n if (atoms.length < 2) {\r\n return;\r\n }\r\n if (atoms[0].index < 0) {\r\n throw new Error('AutoBond: Atoms in complex were not indexed.');\r\n }\r\n\r\n this._calcBoundingBox();\r\n this._pairCollection = new AtomPairs(atoms.length * cEstBondsMultiplier);\r\n this._addExistingPairs();\r\n this._findPairs();\r\n this._addPairs();\r\n }\r\n\r\n _calcBoundingBox() {\r\n const atoms = this._complex._atoms;\r\n const nAtoms = atoms.length;\r\n let maxRad = _getBondingRadius(atoms[0]);\r\n for (let i = 1; i < nAtoms; ++i) {\r\n maxRad = Math.max(maxRad, _getBondingRadius(atoms[i]));\r\n }\r\n this._vBoxMax.addScalar(maxRad);\r\n this._vBoxMin.addScalar(-maxRad);\r\n this._maxRad = maxRad * 1.2;\r\n }\r\n\r\n destroy() {\r\n if (this._pairCollection) {\r\n this._pairCollection.destroy();\r\n }\r\n }\r\n}\r\n\r\nexport default AutoBond;\r\n","import * as THREE from 'three';\r\nimport Bond from './Bond';\r\nimport Element from './Element';\r\n\r\nconst cCrossThresh = 0.1;\r\nconst cAromaticType = Bond.BondType.AROMATIC;\r\nconst cAromaticAtoms = [\r\n Element.ByName.C.number,\r\n Element.ByName.N.number,\r\n // Element.ByName.O.number,\r\n // Element.ByName.S.number,\r\n];\r\n\r\n\r\n/** Conditions for bonds:\r\n * - Cross product with each subsequent bond to add is collinear and point to the same direction\r\n * - Each pair of a adjacent bonds belong to not more than one cycle\r\n * - If there is more than one candidates we try them in ascending order of angle values\r\n */\r\n\r\nconst _coDirVectors = (function () {\r\n const v1Tmp = new THREE.Vector3();\r\n const v2Tmp = new THREE.Vector3();\r\n const cp = new THREE.Vector3();\r\n return function (v1, v2) {\r\n v1Tmp.copy(v1).normalize();\r\n v2Tmp.copy(v2).normalize();\r\n cp.crossVectors(v1Tmp, v2Tmp);\r\n if (cp.length() > cCrossThresh) {\r\n return false;\r\n }\r\n // zero vector in out terms must be collinear to any\r\n return v1Tmp.dot(v2Tmp) >= 0;\r\n };\r\n}());\r\n\r\nfunction _insertAscending(arr, val) {\r\n let idx = 0;\r\n while (idx < arr.length && arr[idx] < val) {\r\n ++idx;\r\n }\r\n arr.splice(idx, 0, val);\r\n}\r\n\r\nfunction _anotherAtom(bond, currAtom) {\r\n return bond._left === currAtom ? bond._right : bond._left;\r\n}\r\n\r\nfunction _cosBetween(v1, v2) {\r\n const theta = v1.dot(v2) / (Math.sqrt(v1.lengthSq() * v2.lengthSq()));\r\n return THREE.Math.clamp(theta, -1, 1);\r\n}\r\n\r\nfunction _markAromatic(bond) {\r\n bond._type = cAromaticType;\r\n}\r\n\r\nclass Cycle {\r\n constructor(atomsList) {\r\n this.atoms = atomsList;\r\n this.update();\r\n }\r\n\r\n update() {\r\n const { atoms } = this;\r\n const center = new THREE.Vector3();\r\n const nA = atoms.length;\r\n for (let j = 0; j < nA; ++j) {\r\n center.add(atoms[j].position);\r\n }\r\n center.multiplyScalar(1.0 / nA);\r\n this.center = center;\r\n this.radius = center.distanceTo(atoms[0].position.clone().lerp(atoms[1].position, 0.5));\r\n }\r\n\r\n forEachBond(process) {\r\n const { atoms } = this;\r\n const nA = atoms.length;\r\n let currAtom = atoms[0];\r\n let nextAtom;\r\n\r\n function checkBond(bond) {\r\n if (bond._left === nextAtom || bond._right === nextAtom) {\r\n process(bond);\r\n }\r\n }\r\n\r\n for (let i = 0; i < nA; ++i) {\r\n nextAtom = atoms[(i + 1) % nA];\r\n currAtom.forEachBond(checkBond);\r\n currAtom = nextAtom;\r\n }\r\n }\r\n}\r\n\r\nfunction _isAromatic(bond) {\r\n return bond._type === cAromaticType;\r\n}\r\n\r\nfunction _isPossibleAromatic(bond) {\r\n if (bond.type === cAromaticType) {\r\n return true;\r\n }\r\n const rightIdx = cAromaticAtoms.indexOf(bond._right.element.number);\r\n const leftIdx = cAromaticAtoms.indexOf(bond._left.element.number);\r\n return rightIdx !== -1 && leftIdx !== -1;\r\n}\r\n\r\nfunction _checkCycleSimple(cycle) {\r\n return cycle.length > 3;\r\n}\r\n\r\nfunction _checkCycleComplex(cycle) {\r\n console.assert(cycle.length > 2);\r\n return true;\r\n}\r\n\r\nclass AromaticLoopsMarker {\r\n constructor(complex) {\r\n this._complex = complex;\r\n const bondsData = new Array(complex._bonds.length);\r\n const bondMarks = new Array(complex._bonds.length);\r\n for (let i = 0, n = bondsData.length; i < n; ++i) {\r\n bondsData[i] = [];\r\n bondMarks[i] = false;\r\n }\r\n this._bondsData = bondsData;\r\n this._bondMarks = bondMarks;\r\n this._resetCycles();\r\n }\r\n\r\n _resetCycles() {\r\n this._cycles = [];\r\n this._currIdx = -1;\r\n }\r\n\r\n _haveSameCycle(bondsData, bond1, bond2) {\r\n const arr1 = bondsData[bond1._index];\r\n const arr2 = bondsData[bond2._index];\r\n const n1 = arr1.length;\r\n const n2 = arr2.length;\r\n let i1 = 0;\r\n let i2 = 0;\r\n while (i1 < n1 && i2 < n2) {\r\n if (arr1[i1] === arr2[i2]) {\r\n return true;\r\n }\r\n if (arr1[i1] > arr2[i2]) {\r\n ++i2;\r\n } else {\r\n ++i1;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _tryBond(prevBond, currRight, currDir) {\r\n const bondsOrder = [];\r\n const bondsData = this._bondsData;\r\n const currLeft = _anotherAtom(prevBond, currRight);\r\n const currVec = currRight.position.clone().sub(currLeft.position);\r\n const startAtomRef = this._currStart;\r\n const self = this;\r\n const bondMarks = this._bondMarks;\r\n let checkAromatic = this._checkBond;\r\n bondMarks[prevBond._index] = true;\r\n checkAromatic = checkAromatic === undefined ? _isAromatic : checkAromatic;\r\n currRight.forEachBond((newBond) => {\r\n if (!checkAromatic(newBond)\r\n || newBond === prevBond\r\n || bondMarks[newBond._index]\r\n || self._haveSameCycle(bondsData, prevBond, newBond)) {\r\n return;\r\n }\r\n const anotherAtom = _anotherAtom(newBond, currRight);\r\n const anotherVec = anotherAtom.position.clone().sub(currRight.position);\r\n const val = anotherAtom === startAtomRef ? -2.0 : 1 - _cosBetween(currVec, anotherVec);\r\n const newDir = anotherVec.cross(currVec);\r\n if (!_coDirVectors(newDir, currDir)) {\r\n return;\r\n }\r\n let idx = 0;\r\n while (idx < bondsOrder.length && bondsOrder[idx].val < val) {\r\n ++idx;\r\n }\r\n bondsOrder.splice(idx, 0, { bond: newBond, val, dir: newDir });\r\n });\r\n\r\n for (let i = 0, n = bondsOrder.length; i < n; ++i) {\r\n const { bond } = bondsOrder[i];\r\n const newRight = bond._left === currRight ? bond._right : bond._left;\r\n if (newRight === startAtomRef) {\r\n ++this._currIdx;\r\n this._cycles.push([currRight]);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n if (this._tryBond(bond, newRight, bondsOrder[i].dir)) {\r\n _insertAscending(bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(currRight);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n }\r\n bondMarks[prevBond._index] = false;\r\n return false;\r\n }\r\n\r\n _startCycle(bond) {\r\n // start from left to right\r\n this._currStart = bond._left;\r\n if (this._tryBond(bond, bond._right, new THREE.Vector3())) {\r\n _insertAscending(this._bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(bond._left);\r\n }\r\n }\r\n\r\n _findLoops(checkBond, checkCycle) {\r\n this._checkBond = checkBond;\r\n const complex = this._complex;\r\n const self = this;\r\n\r\n complex.forEachComponent((component) => {\r\n self._resetCycles();\r\n component.forEachBond((bond) => {\r\n if (checkBond(bond)) {\r\n self._startCycle(bond);\r\n }\r\n });\r\n const cycles = self._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n const cycle = cycles[i];\r\n if (!checkCycle(cycle)) {\r\n continue;\r\n }\r\n const newCycle = new Cycle(cycle);\r\n newCycle.forEachBond(_markAromatic);\r\n component.addCycle(newCycle);\r\n }\r\n });\r\n }\r\n\r\n markCycles() {\r\n this._findLoops(_isAromatic, _checkCycleSimple);\r\n }\r\n\r\n detectCycles() {\r\n this._findLoops(_isPossibleAromatic, _checkCycleComplex);\r\n }\r\n}\r\n\r\nexport default AromaticLoopsMarker;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\n/**\r\n * Calculate min & max radius of a sphere slice between zMin & zMax\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {number} zMin - lower bound of the slice\r\n * @param {number} zMax - upper bound of the slice\r\n */\r\nfunction _getSphereSliceRadiusRange(center, radius, zMin, zMax) {\r\n const dzMin = zMin - center.z;\r\n const dzMax = zMax - center.z;\r\n const rzMin = Math.sqrt(Math.max(radius * radius - dzMin * dzMin, 0.0));\r\n const rzMax = Math.sqrt(Math.max(radius * radius - dzMax * dzMax, 0.0));\r\n\r\n const rMin = Math.min(rzMin, rzMax);\r\n let rMax;\r\n\r\n if (zMin <= center.z && zMax >= center.z) {\r\n // sphere's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(rzMin, rzMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * Calculate min & max radius of a circle slice between yMin & yMax.\r\n *\r\n * To maintain analogy with _getSphereSliceRadiusRange we call radius what in fact is\r\n * half-width (along X axis) of the slice, i.e. 1D-sphere radius.\r\n *\r\n * @param {Vector3} center - center of the circle (z can be ignored)\r\n * @param {number} radius - circle radius\r\n * @param {number} yMin - lower bound of the slice\r\n * @param {number} yMax - upper bound of the slice\r\n * @returns {Array} - array of two numbers (min & max radius, or half-width)\r\n */\r\nfunction _getCircleSliceRadiusRange(center, radius, yMin, yMax) {\r\n const dyMin = yMin - center.y;\r\n const dyMax = yMax - center.y;\r\n const ryMin = Math.sqrt(Math.max(radius * radius - dyMin * dyMin, 0.0));\r\n const ryMax = Math.sqrt(Math.max(radius * radius - dyMax * dyMax, 0.0));\r\n\r\n const rMin = Math.min(ryMin, ryMax);\r\n let rMax;\r\n\r\n if (yMin <= center.y && yMax >= center.y) {\r\n // slice's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(ryMin, ryMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * VoxelWorld constructor\r\n *\r\n * @param {Box3} box - bounding box of the volume to be partitioned\r\n * @param {Vector3} vCellSizeHint - target voxel size (actual voxel size may differ from this)\r\n */\r\nclass VoxelWorld {\r\n constructor(box, vCellSizeHint) {\r\n this._box = box.clone();\r\n const size = new THREE.Vector3();\r\n box.getSize(size);\r\n this._count = size.clone().divide(vCellSizeHint).floor().max(new THREE.Vector3(1, 1, 1));\r\n this._last = this._count.clone().subScalar(1);\r\n this._cellSize = size.clone().divide(this._count);\r\n this._cellInnerR = 0.5 * Math.min(Math.min(this._cellSize.x, this._cellSize.y), this._cellSize.z);\r\n this._cellOuterR = 0.5 * Math.sqrt(this._cellSize.dot(this._cellSize));\r\n\r\n // array of voxels, each element contains index of first atom in voxel\r\n const numVoxels = this._count.x * this._count.y * this._count.z;\r\n this._voxels = utils.allocateTyped(Int32Array, numVoxels);\r\n for (let i = 0; i < numVoxels; ++i) {\r\n this._voxels[i] = -1;\r\n }\r\n\r\n // array of atoms that stores multiple single-linked lists\r\n // two elements for each atom: Atom ref, index of next atom (in this array\r\n this._atoms = [];\r\n }\r\n\r\n /**\r\n * Add all atoms from a complex to voxel world\r\n *\r\n * @param {Complex} complex - complex\r\n */\r\n addAtoms(complex) {\r\n const self = this;\r\n\r\n let idx = this._atoms.length;\r\n\r\n // resize array of atoms\r\n this._atoms.length += 2 * complex.getAtomCount();\r\n\r\n complex.forEachAtom((atom) => {\r\n // find which voxel contains this atom\r\n const voxelIdx = self._findVoxel(atom.position);\r\n\r\n // push current atom to the head of voxel's atom list\r\n self._atoms[idx] = atom;\r\n self._atoms[idx + 1] = self._voxels[voxelIdx];\r\n self._voxels[voxelIdx] = idx;\r\n\r\n idx += 2;\r\n });\r\n }\r\n\r\n /**\r\n * Get voxel that contains specified 3D point (we use clamp at the edges)\r\n *\r\n * @param {Vector3} point - a point in 3D\r\n * @returns {number} - index of voxel\r\n */\r\n static _zero = new THREE.Vector3(0, 0, 0);\r\n\r\n static _voxel = new THREE.Vector3();\r\n\r\n _findVoxel(point) {\r\n const zero = VoxelWorld._zero;\r\n const voxel = VoxelWorld._voxel;\r\n voxel.copy(point)\r\n .sub(this._box.min)\r\n .divide(this._cellSize)\r\n .floor()\r\n .clamp(zero, this._last);\r\n return voxel.x + this._count.x * (voxel.y + this._count.y * voxel.z);\r\n }\r\n\r\n /**\r\n * Call a function for each atom in voxel\r\n *\r\n * @param {number} voxel - index of voxel\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomInVoxel(voxel, process) {\r\n for (let i = this._voxels[voxel]; i >= 0; i = this._atoms[i + 1]) {\r\n process(this._atoms[i]);\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _xRange = new THREE.Vector2();\r\n\r\n static _yRange = new THREE.Vector2();\r\n\r\n static _zRange = new THREE.Vector2();\r\n\r\n _forEachVoxelWithinRadius(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n\r\n // switch to a faster method unless cell size is much smaller than sphere radius\r\n if (radius / this._cellInnerR < 10) {\r\n this._forEachVoxelWithinRadiusSimple(center, radius, process);\r\n return;\r\n }\r\n\r\n let rRangeXY;\r\n let rRangeX;\r\n let xVal;\r\n let yVal;\r\n let zVal;\r\n let isInsideX;\r\n let isInsideY;\r\n let isInsideZ;\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor()\r\n .clampScalar(0, this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n\r\n isInsideZ = (center.z - radius <= zVal[0]) && (zVal[1] <= center.z + radius);\r\n\r\n rRangeXY = _getSphereSliceRadiusRange(center, radius, zVal[0], zVal[1]);\r\n\r\n yRange.set(center.y - rRangeXY[1], center.y + rRangeXY[1]);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor()\r\n .clampScalar(0, this._count.y - 1);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n\r\n isInsideY = (center.y - rRangeXY[0] <= yVal[0]) && (yVal[1] <= center.y + rRangeXY[0]);\r\n\r\n rRangeX = _getCircleSliceRadiusRange(center, rRangeXY[1], yVal[0], yVal[1]);\r\n\r\n xRange.set(center.x - rRangeX[1], center.x + rRangeX[1]);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor()\r\n .clampScalar(0, this._count.x - 1);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n isInsideX = (center.x - rRangeX[0] <= xVal[0]) && (xVal[1] <= center.x + rRangeX[0]);\r\n\r\n process(x + this._count.x * (y + this._count.y * z), isInsideX && isInsideY && isInsideZ);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n * This is a version of method that doesn't try to \"calculate\" what voxels fall inside radius\r\n * but instead just checks all voxels inside sphere's bounding box. This should be faster\r\n * unless cell size is much smaller than sphere radius.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _vCenter = new THREE.Vector3();\r\n\r\n _forEachVoxelWithinRadiusSimple(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n const vCenter = VoxelWorld._vCenter;\r\n\r\n const distTouch2 = (radius + this._cellOuterR) * (radius + this._cellOuterR);\r\n let distInside2 = -1.0;\r\n if (radius > this._cellOuterR) {\r\n distInside2 = (radius - this._cellOuterR) * (radius - this._cellOuterR);\r\n }\r\n\r\n // calculate bounding box for the sphere\r\n xRange.set(center.x - radius, center.x + radius);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor();\r\n xRange.x = Math.min(Math.max(xRange.x, 0), this._count.x - 1);\r\n xRange.y = Math.min(Math.max(xRange.y, 0), this._count.x - 1);\r\n\r\n yRange.set(center.y - radius, center.y + radius);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor();\r\n yRange.x = Math.min(Math.max(yRange.x, 0), this._count.y - 1);\r\n yRange.y = Math.min(Math.max(yRange.y, 0), this._count.y - 1);\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor();\r\n zRange.x = Math.min(Math.max(zRange.x, 0), this._count.z - 1);\r\n zRange.y = Math.min(Math.max(zRange.y, 0), this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n const zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n vCenter.z = 0.5 * (zVal[0] + zVal[1]);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n const yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n vCenter.y = 0.5 * (yVal[0] + yVal[1]);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n const xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n vCenter.x = 0.5 * (xVal[0] + xVal[1]);\r\n\r\n const d2 = center.distanceToSquared(vCenter);\r\n if (d2 <= distTouch2) {\r\n process(x + this._count.x * (y + this._count.y * z), d2 <= distInside2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each atom within given sphere\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinRadius(center, radius, process) {\r\n const self = this;\r\n const r2 = radius * radius;\r\n\r\n self._forEachVoxelWithinRadius(center, radius, (voxel, isInside) => {\r\n if (isInside) {\r\n self._forEachAtomInVoxel(voxel, process);\r\n } else {\r\n self._forEachAtomInVoxel(voxel, (atom) => {\r\n if (center.distanceToSquared(atom.position) <= r2) {\r\n process(atom);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by mask\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} mask - bit mask\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromMasked(complex, mask, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by selector\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} selector - selector\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromSelected(complex, selector, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms\r\n *\r\n * @param {function} forEachAtom - enumerator of atoms in the group\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) {\r\n const self = this;\r\n const r2 = dist * dist;\r\n\r\n const voxels = [];\r\n const atoms = [];\r\n let idx = 0;\r\n\r\n // build \"within radius\" atom list for each voxel\r\n forEachAtom((atom) => {\r\n self._forEachVoxelWithinRadius(atom.position, dist, (voxel, isInside) => {\r\n if (isInside) {\r\n // this voxel is inside circle -- no check will be required\r\n voxels[voxel] = -1;\r\n } else if (typeof voxels[voxel] === 'undefined') {\r\n // this voxel isn't covered yet -- start building list of atoms\r\n atoms.push(atom);\r\n atoms.push(-1);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n } else if (voxels[voxel] !== -1) {\r\n // this voxel has a list of atoms required for distance check -- add atom to the list\r\n atoms.push(atom);\r\n atoms.push(voxels[voxel]);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n }\r\n });\r\n });\r\n\r\n let voxel;\r\n\r\n const processIfWithin = function (atom) {\r\n if (typeof voxels[voxel] === 'undefined') {\r\n return;\r\n }\r\n\r\n idx = voxels[voxel];\r\n if (idx === -1) {\r\n // this voxel is fully covered\r\n process(atom);\r\n return;\r\n }\r\n\r\n // check distance to each atom within radius from this voxel\r\n for (; idx >= 0; idx = atoms[idx + 1]) {\r\n if (atom.position.distanceToSquared(atoms[idx].position) < r2) {\r\n process(atom);\r\n break;\r\n }\r\n }\r\n };\r\n\r\n // for each marked voxel\r\n for (voxel in voxels) {\r\n if (voxels.hasOwnProperty(voxel)) {\r\n self._forEachAtomInVoxel(voxel, processIfWithin);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default VoxelWorld;\r\n","import ResidueType from './ResidueType';\r\nimport PairCollection from './AtomPairs';\r\n\r\nconst MINIMAL_DISTANCE = 0.5;\r\nconst MIN_HBOND_ENERGY = -9.9;\r\nconst MAX_HBOND_ENERGY = -0.5;\r\nconst COUPLING_CONSTANT = -27.888; // = -332 * 0.42 * 0.2\r\nconst MAX_COUPLING_DISTANCE = 5.0; // how far is the closest atom of a potential partner residue from CA atom\r\nconst MAX_RESIDUES_THRESHOLD = 1000;\r\n\r\nexport default class HBondInfo {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._hbonds = []; // array of bond info for each residue\r\n if (this._complex._residues.length > MAX_RESIDUES_THRESHOLD) {\r\n this._buildVW(); // optimized version using voxel grid\r\n } else {\r\n this._build(); // test all pairs of residues\r\n }\r\n }\r\n\r\n isBond(from, to) {\r\n if (this._hbonds[from]) {\r\n const [acc0, acc1] = this._hbonds[from].acceptor;\r\n if (acc0 && acc0.residue === to && acc0.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n if (acc1 && acc1.residue === to && acc1.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n\r\n for (let i = 0; i < this._complex._residues.length - 1; ++i) {\r\n const ri = this._complex._residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let preri = null;\r\n if (i > 0 && (this._complex._residues[i - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && ri._sequence === this._complex._residues[i - 1]._sequence + 1) {\r\n preri = this._complex._residues[i - 1];\r\n }\r\n\r\n for (let j = i + 1; j < this._complex._residues.length; ++j) {\r\n const rj = this._complex._residues[j];\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = null;\r\n if ((this._complex._residues[j - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && rj._sequence === this._complex._residues[j - 1]._sequence + 1) {\r\n prerj = this._complex._residues[j - 1];\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (j !== i + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _buildVW() {\r\n const self = this;\r\n const residues = this._complex._residues;\r\n let ri;\r\n let preri;\r\n\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const pairs = new PairCollection(this._complex._residues.length * this._complex._residues.length / 2);\r\n\r\n function processAtom(atom) {\r\n const rj = atom.residue;\r\n\r\n if (rj._index === ri._index) {\r\n return;\r\n }\r\n\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n return;\r\n }\r\n\r\n if (!pairs.addPair(ri._index, rj._index)) {\r\n // we've seen this pair\r\n return;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = rj._index > 0 ? residues[rj._index - 1] : null;\r\n if (prerj\r\n && ((prerj.getType().flags & ResidueType.Flags.PROTEIN) === 0 || rj._sequence !== prerj._sequence + 1)) {\r\n prerj = null;\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (rj._index !== ri._index + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n\r\n for (let i = 0; i < residues.length - 1; ++i) {\r\n ri = residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n preri = i > 0 ? residues[i - 1] : null;\r\n if (preri\r\n && ((preri.getType().flags & ResidueType.Flags.PROTEIN) === 0 || ri._sequence !== preri._sequence + 1)) {\r\n preri = null;\r\n }\r\n\r\n vw.forEachAtomWithinRadius(this._residueGetCAlpha(ri), MAX_COUPLING_DISTANCE, processAtom);\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _residueGetCO(res) {\r\n let c = null;\r\n let o = null;\r\n\r\n res.forEachAtom((a) => {\r\n if (a.name === 'C') {\r\n c = a.position;\r\n } else if (a.name === 'O') {\r\n o = a.position;\r\n }\r\n });\r\n\r\n return [c, o];\r\n }\r\n\r\n // TODO Support hydrogen defined in complex\r\n _residueGetNH(prev, res) {\r\n const [c, o] = this._residueGetCO(prev);\r\n\r\n let n;\r\n res.forEachAtom((a) => {\r\n if (a.name === 'N') {\r\n n = a.position;\r\n }\r\n });\r\n\r\n if (c && o && n) {\r\n // calculate hydrogen position\r\n const h = c.clone();\r\n h.sub(o);\r\n h.multiplyScalar(1.0 / h.length());\r\n h.add(n);\r\n\r\n return [n, h];\r\n }\r\n\r\n return [null, null];\r\n }\r\n\r\n _calcHBondEnergy(predonor, donor, acceptor) {\r\n let result = 0;\r\n\r\n if (predonor === null) {\r\n return result;\r\n }\r\n\r\n if (donor.getType().getName() !== 'PRO') {\r\n const [n, h] = this._residueGetNH(predonor, donor);\r\n const [c, o] = this._residueGetCO(acceptor);\r\n\r\n if (n === null || h === null || c === null || o === null) {\r\n return result;\r\n }\r\n\r\n const distanceHO = h.distanceTo(o);\r\n const distanceHC = h.distanceTo(c);\r\n const distanceNC = n.distanceTo(c);\r\n const distanceNO = n.distanceTo(o);\r\n\r\n if (distanceHO < MINIMAL_DISTANCE || distanceHC < MINIMAL_DISTANCE\r\n || distanceNC < MINIMAL_DISTANCE || distanceNO < MINIMAL_DISTANCE) {\r\n result = MIN_HBOND_ENERGY;\r\n } else {\r\n result = COUPLING_CONSTANT / distanceHO - COUPLING_CONSTANT / distanceHC\r\n + COUPLING_CONSTANT / distanceNC - COUPLING_CONSTANT / distanceNO;\r\n }\r\n\r\n // DSSP compatibility mode:\r\n result = Math.round(result * 1000) / 1000;\r\n\r\n if (result < MIN_HBOND_ENERGY) {\r\n result = MIN_HBOND_ENERGY;\r\n }\r\n }\r\n\r\n // update donor\r\n if (typeof this._hbonds[donor._index] === 'undefined') {\r\n this._hbonds[donor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const donorInfo = this._hbonds[donor._index];\r\n\r\n if (donorInfo.acceptor.length < 2) {\r\n donorInfo.acceptor.push({\r\n residue: acceptor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (donorInfo.acceptor.length > 1) {\r\n if (result < donorInfo.acceptor[0].energy) {\r\n donorInfo.acceptor[1].residue = donorInfo.acceptor[0].residue;\r\n donorInfo.acceptor[1].energy = donorInfo.acceptor[0].energy;\r\n donorInfo.acceptor[0].residue = acceptor._index;\r\n donorInfo.acceptor[0].energy = result;\r\n } else if (result < donorInfo.acceptor[1].energy) {\r\n donorInfo.acceptor[1].residue = acceptor._index;\r\n donorInfo.acceptor[1].energy = result;\r\n }\r\n }\r\n\r\n // update acceptor\r\n if (typeof this._hbonds[acceptor._index] === 'undefined') {\r\n this._hbonds[acceptor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const accInfo = this._hbonds[acceptor._index];\r\n\r\n if (accInfo.donor.length < 2) {\r\n accInfo.donor.push({\r\n residue: donor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (accInfo.donor.length > 1) {\r\n if (result < accInfo.donor[0].energy) {\r\n accInfo.donor[1].residue = accInfo.donor[0].residue;\r\n accInfo.donor[1].energy = accInfo.donor[0].energy;\r\n accInfo.donor[0].residue = donor._index;\r\n accInfo.donor[0].energy = result;\r\n } else if (result < accInfo.donor[1].energy) {\r\n accInfo.donor[1].residue = donor._index;\r\n accInfo.donor[1].energy = result;\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n","import HBondInfo from './HBondInfo';\r\nimport ResidueType from './ResidueType';\r\n\r\nconst BridgeType = Object.freeze({\r\n NO_BRIDGE: 0,\r\n PARALLEL: 1,\r\n ANTI_PARALLEL: 2,\r\n});\r\n\r\nconst HelixFlag = Object.freeze({\r\n START: 1,\r\n MIDDLE: 2,\r\n END: 3,\r\n START_AND_END: 4,\r\n});\r\n\r\nconst StructureType = Object.freeze({\r\n STRAND: 'E',\r\n BRIDGE: 'B',\r\n HELIX_310: 'G',\r\n HELIX_ALPHA: 'H',\r\n HELIX_PI: 'I',\r\n TURN: 'T',\r\n BEND: 'S',\r\n LOOP: ' ',\r\n});\r\n\r\nexport default class SecondaryStructureMap {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._build();\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n this._hbonds = new HBondInfo(this._complex);\r\n this._ss = []; // DSSP map by residue\r\n\r\n // auxilliary data\r\n this._sheet = [];\r\n this._betaPartners = [];\r\n this._bend = [];\r\n for (let i = 0; i < this._complex.getResidues().length; ++i) {\r\n this._betaPartners[i] = [];\r\n }\r\n this._helixFlags = [];\r\n this._helixFlags[3] = [];\r\n this._helixFlags[4] = [];\r\n this._helixFlags[5] = [];\r\n\r\n // calculate peptide chain lengths\r\n this._chainLengths = [];\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i].getResidues();\r\n let len = 0;\r\n for (; len < chain.length; ++len) {\r\n if ((chain[len].getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n break;\r\n }\r\n }\r\n this._chainLengths[i] = len;\r\n }\r\n\r\n this._buildBetaSheets();\r\n\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n self._buildAlphaHelices(this._complex._chains[i].getResidues(), this._chainLengths[i], false);\r\n }\r\n }\r\n\r\n _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) {\r\n // Helix and Turn\r\n for (let stride = 3; stride <= 5; ++stride) {\r\n if (inResidues.length < stride) {\r\n break;\r\n }\r\n\r\n for (let i = 0; i + stride < chainLength; ++i) {\r\n if (this._hbonds.isBond(inResidues[i + stride]._index, inResidues[i]._index)\r\n /* && NoChainBreak(res[i], res[i + stride]) */) {\r\n this._helixFlags[stride][inResidues[i + stride]._index] = HelixFlag.END;\r\n for (let j = i + 1; j < i + stride; ++j) {\r\n if (typeof this._helixFlags[stride][inResidues[j]._index] === 'undefined') {\r\n this._helixFlags[stride][inResidues[j]._index] = HelixFlag.MIDDLE;\r\n }\r\n }\r\n\r\n if (this._helixFlags[stride][inResidues[i]._index] === HelixFlag.END) {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START_AND_END;\r\n } else {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 2; i < chainLength - 2; ++i) {\r\n const kappa = this._kappa(inResidues[i - 2], inResidues[i], inResidues[i + 2]);\r\n this._bend[inResidues[i]._index] = (kappa !== 360 && kappa > 70);\r\n }\r\n\r\n for (let i = 1; i + 4 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 4) && this._isHelixStart(inResidues[i - 1]._index, 4)) {\r\n for (let j = i; j <= i + 3; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_ALPHA;\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 3 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 3) && this._isHelixStart(inResidues[i - 1]._index, 3)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 2; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_310;\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 2; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_310;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 5 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 5) && this._isHelixStart(inResidues[i - 1]._index, 5)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 4; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_PI\r\n || (inPreferPiHelices && this._ss[inResidues[j]._index] === StructureType.HELIX_ALPHA);\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 4; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_PI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 1 < chainLength; ++i) {\r\n if (typeof this._ss[inResidues[i]._index] === 'undefined') {\r\n let isTurn = false;\r\n for (let stride = 3; stride <= 5 && !isTurn; ++stride) {\r\n for (let k = 1; k < stride && !isTurn; ++k) {\r\n isTurn = (i >= k) && this._isHelixStart(inResidues[i - k]._index, stride);\r\n }\r\n }\r\n\r\n if (isTurn) {\r\n this._ss[inResidues[i]._index] = StructureType.TURN;\r\n } else if (this._bend[inResidues[i]._index]) {\r\n this._ss[inResidues[i]._index] = StructureType.BEND;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _cosinusAngle(p1, p2, p3, p4) {\r\n const v12 = p1.clone().sub(p2);\r\n const v34 = p3.clone().sub(p4);\r\n\r\n let result = 0;\r\n\r\n const x = v12.dot(v12) * v34.dot(v34);\r\n if (x > 0) {\r\n result = v12.dot(v34) / Math.sqrt(x);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _kappa(prevPrev, res, nextNext) {\r\n const curCA = this._residueGetCAlpha(res);\r\n const ppCA = this._residueGetCAlpha(prevPrev);\r\n const nnCA = this._residueGetCAlpha(nextNext);\r\n if (curCA === null || ppCA === null || nnCA === null) {\r\n return 180;\r\n }\r\n\r\n const ckap = this._cosinusAngle(curCA, ppCA, nnCA, curCA);\r\n const skap = Math.sqrt(1 - ckap * ckap);\r\n return Math.atan2(skap, ckap) * 180 / Math.PI;\r\n }\r\n\r\n _isHelixStart(res, stride) {\r\n return (this._helixFlags[stride][res] === HelixFlag.START\r\n || this._helixFlags[stride][res] === HelixFlag.START_AND_END);\r\n }\r\n\r\n _buildBetaSheets() {\r\n // find bridges\r\n // check each chain against each other chain, and against itself\r\n const bridges = [];\r\n for (let a = 0; a < this._complex._chains.length; ++a) {\r\n const lenA = this._chainLengths[a];\r\n if (lenA <= 4) {\r\n continue;\r\n }\r\n\r\n const chainA = this._complex._chains[a].getResidues();\r\n\r\n for (let b = a; b < this._complex._chains.length; ++b) {\r\n const lenB = this._chainLengths[b];\r\n if (lenB <= 4) {\r\n continue;\r\n }\r\n\r\n const chainB = this._complex._chains[b].getResidues();\r\n\r\n for (let i = 1; i + 1 < lenA; ++i) {\r\n const ri = chainA[i];\r\n\r\n let j = 1;\r\n if (b === a) {\r\n j = i + 3; // check for self-bridges forward down the chain\r\n }\r\n\r\n for (; j + 1 < lenB; ++j) {\r\n const rj = chainB[j];\r\n\r\n const type = this._testBridge(chainA, i, chainB, j);\r\n if (type === BridgeType.NO_BRIDGE) {\r\n continue;\r\n }\r\n\r\n // there is a bridge, try to attach it to previously found sequence\r\n let found = false;\r\n for (const bridge of bridges) {\r\n if (type !== bridge.type || ri._index !== bridge.i[bridge.i.length - 1] + 1) {\r\n continue;\r\n }\r\n\r\n if (type === BridgeType.PARALLEL && bridge.j[bridge.j.length - 1] + 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.push(rj._index);\r\n found = true;\r\n break;\r\n }\r\n\r\n if (type === BridgeType.ANTI_PARALLEL && bridge.j[0] - 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.unshift(rj._index);\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n // this bridge cannot be attached anywhere, start a new sequence\r\n if (!found) {\r\n bridges.push({\r\n type,\r\n i: [ri._index],\r\n chainI: ri.getChain()._index,\r\n j: [rj._index],\r\n chainJ: rj.getChain()._index,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // extend ladders\r\n bridges.sort((a, b) => {\r\n if (a.chainI < b.chainI || (a.chainI === b.chainI && a.i[0] < b.i[0])) {\r\n return -1;\r\n }\r\n return 1;\r\n });\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n for (let j = i + 1; j < bridges.length; ++j) {\r\n const ibi = bridges[i].i[0];\r\n const iei = bridges[i].i[bridges[i].i.length - 1];\r\n const jbi = bridges[i].j[0];\r\n const jei = bridges[i].j[bridges[i].j.length - 1];\r\n const ibj = bridges[j].i[0];\r\n const iej = bridges[j].i[bridges[j].i.length - 1];\r\n const jbj = bridges[j].j[0];\r\n const jej = bridges[j].j[bridges[j].j.length - 1];\r\n\r\n if (bridges[i].type !== bridges[j].type\r\n || this._hasChainBreak(Math.min(ibi, ibj), Math.max(iei, iej))\r\n || this._hasChainBreak(Math.min(jbi, jbj), Math.max(jei, jej))\r\n || ibj - iei >= 6 || (iei >= ibj && ibi <= iej)) {\r\n continue;\r\n }\r\n\r\n let bulge = false;\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bulge = ((jbj - jei < 6 && ibj - iei < 3) || (jbj - jei < 3));\r\n } else {\r\n bulge = ((jbi - jej < 6 && ibj - iei < 3) || (jbi - jej < 3));\r\n }\r\n\r\n if (bulge) {\r\n bridges[i].i = bridges[i].i.concat(bridges[j].i);\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bridges[i].j = bridges[i].j.concat(bridges[j].j);\r\n } else {\r\n bridges[i].j = bridges[j].j.concat(bridges[i].j);\r\n }\r\n bridges.splice(j--, 1);\r\n }\r\n }\r\n }\r\n\r\n // Sheet\r\n const ladderset = new Set();\r\n for (let i = 0; i < bridges.length; ++i) {\r\n ladderset.add(bridges[i]);\r\n }\r\n\r\n let sheet = 1;\r\n let ladder = 0;\r\n while (ladderset.size > 0) {\r\n let bridge = ladderset.values().next().value;\r\n ladderset.delete(bridge);\r\n\r\n const sheetset = new Set();\r\n sheetset.add(bridge);\r\n\r\n let toMove;\r\n do {\r\n toMove = new Set();\r\n for (const a of sheetset.values()) {\r\n for (const b of ladderset.values()) {\r\n if (this._areBridgesLinked(a, b)) {\r\n toMove.add(b);\r\n }\r\n }\r\n }\r\n for (bridge of toMove.values()) {\r\n sheetset.add(bridge);\r\n ladderset.delete(bridge);\r\n }\r\n } while (toMove.size > 0);\r\n\r\n for (bridge of sheetset.values()) {\r\n bridge.ladder = ladder;\r\n bridge.sheet = sheet;\r\n bridge.link = sheetset;\r\n ++ladder;\r\n }\r\n\r\n ++sheet;\r\n }\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n const bridge = bridges[i];\r\n\r\n // find out if any of the i and j set members already have\r\n // a bridge assigned, if so, we're assigning bridge 2\r\n\r\n let betai = 0;\r\n let betaj = 0;\r\n\r\n for (let l = 0; l < bridge.i.length; ++l) {\r\n if (this._betaPartners[bridge.i[l]][0]) {\r\n betai = 1;\r\n break;\r\n }\r\n }\r\n\r\n for (let l = 0; l < bridge.j.length; ++l) {\r\n if (this._betaPartners[bridge.j[l]][0]) {\r\n betaj = 1;\r\n break;\r\n }\r\n }\r\n\r\n let ss = StructureType.BRIDGE;\r\n if (bridge.i.length > 1) {\r\n ss = StructureType.STRAND;\r\n }\r\n\r\n if (bridge.type === BridgeType.PARALLEL) {\r\n let j = 0;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n\r\n j = 0;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n } else {\r\n let j = bridge.j.length - 1;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n\r\n j = bridge.i.length - 1;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n }\r\n\r\n for (let k = bridge.i[0]; k <= bridge.i[bridge.i.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n\r\n for (let k = bridge.j[0]; k <= bridge.j[bridge.j.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _testBridge(chainA, from, chainB, to) {\r\n let result = BridgeType.NO_BRIDGE;\r\n\r\n const a = chainA[from - 1]._index;\r\n const b = chainA[from]._index;\r\n const c = chainA[from + 1]._index;\r\n const d = chainB[to - 1]._index;\r\n const e = chainB[to]._index;\r\n const f = chainB[to + 1]._index;\r\n\r\n const isBond = this._hbonds.isBond.bind(this._hbonds);\r\n if ((isBond(c, e) && isBond(e, a)) || (isBond(f, b) && isBond(b, d))) {\r\n result = BridgeType.PARALLEL;\r\n } else if ((isBond(c, d) && isBond(f, a)) || (isBond(e, b) && isBond(b, e))) {\r\n result = BridgeType.ANTI_PARALLEL;\r\n }\r\n return result;\r\n }\r\n\r\n // return true if any of the residues in bridge a is identical to any of the residues in bridge b\r\n _areBridgesLinked(a, b) {\r\n const ai = new Set(a.i);\r\n const aj = new Set(a.j);\r\n\r\n for (const i of b.i) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n for (const i of b.j) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n _hasChainBreak(from, to) {\r\n for (let i = from + 1; i <= to; ++i) {\r\n if (this._complex._residues[i]._sequence !== this._complex._residues[i - 1]._sequence + 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\nSecondaryStructureMap.StructureType = StructureType;\r\n","import * as THREE from 'three';\r\nimport logger from '../utils/logger';\r\nimport Atom from './Atom';\r\nimport Chain from './Chain';\r\nimport Helix from './Helix';\r\nimport Strand from './Strand';\r\nimport Sheet from './Sheet';\r\nimport Component from './Component';\r\nimport ResidueType from './ResidueType';\r\nimport Bond from './Bond';\r\nimport AutoBond from './AutoBond';\r\nimport AromaticLoopsMarker from './AromaticLoopsMarker';\r\nimport BiologicalUnit from './BiologicalUnit';\r\nimport selectors from './selectors';\r\nimport VoxelWorld from './VoxelWorld';\r\nimport SecondaryStructureMap from './SecondaryStructureMap';\r\nimport StructuralElement from './StructuralElement';\r\n\r\nconst VOXEL_SIZE = 5.0;\r\n\r\nconst { StructureType } = SecondaryStructureMap;\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX\r\nconst helixClassMap = {\r\n [StructureType.HELIX_ALPHA]: 1,\r\n [StructureType.HELIX_PI]: 3,\r\n [StructureType.HELIX_310]: 5,\r\n};\r\n\r\nconst loopMap = {\r\n [StructureType.BRIDGE]: StructuralElementType.BRIDGE,\r\n [StructureType.TURN]: StructuralElementType.TURN,\r\n [StructureType.BEND]: StructuralElementType.BEND,\r\n [StructureType.LOOP]: StructuralElementType.COIL,\r\n};\r\n\r\n/**\r\n * The entire complex of the molecules under study.\r\n *\r\n * @exports Complex\r\n * @constructor\r\n */\r\nclass Complex {\r\n constructor() {\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n\r\n this._residueTypes = Object.create(ResidueType.StandardTypes);\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n this._molecules = [];\r\n this._maskNeedsUpdate = false;\r\n\r\n this.metadata = {};\r\n\r\n this.symmetry = [];\r\n this.units = [new BiologicalUnit(this)];\r\n this._currentUnit = 0; // default biological unit is the asymmetric unit\r\n }\r\n\r\n addAtom(atom) {\r\n const index = this._atoms.length;\r\n this._atoms.push(atom);\r\n return index;\r\n }\r\n\r\n addSheet(sheet) {\r\n const index = this._sheets.length;\r\n this._sheets.push(sheet);\r\n return index;\r\n }\r\n\r\n addHelix(helix) {\r\n const index = this._helices.length;\r\n this._helices.push(helix);\r\n return index;\r\n }\r\n\r\n getAtoms() {\r\n return this._atoms;\r\n }\r\n\r\n getBonds() {\r\n return this._bonds;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n addResidue(residue) {\r\n const index = this._residues.length;\r\n this._residues.push(residue);\r\n return index;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n this.forEachChain((chain) => {\r\n chain.updateToFrame(frameData);\r\n });\r\n }\r\n\r\n addResidueType(resName) {\r\n const rt = this._residueTypes[resName] = new ResidueType(resName, 'Unknown', '');\r\n return rt;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n getSGroupCount() {\r\n return this._sgroups.length;\r\n }\r\n\r\n getSGroups() {\r\n return this._sgroups;\r\n }\r\n\r\n /*\r\n Extract atom by its fullname: #chainName#.#residueId#.#atomName#\r\n */\r\n getAtomByFullname(fullName) {\r\n const parts = fullName.split('.');\r\n if (parts.length !== 3) {\r\n return null;\r\n }\r\n\r\n const chainName = parts[0];\r\n const resId = parseInt(parts[1], 10);\r\n if (Number.isNaN(resId)) {\r\n return null;\r\n }\r\n const atomName = parts[2].toUpperCase();\r\n\r\n let currAtom = null;\r\n this.forEachChain((chain) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (chain._name.localeCompare(chainName) === 0) {\r\n chain.forEachResidue((residue) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (residue._sequence === resId) {\r\n residue.forEachAtom((atom) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (atomName.localeCompare(atom.name) === 0) {\r\n currAtom = atom;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n });\r\n\r\n return currAtom;\r\n }\r\n\r\n /**\r\n * Create a new chain.\r\n *\r\n * @param {string} name - Chain name.\r\n * @returns {Chain} - Newly created chain.\r\n */\r\n addChain(name) {\r\n const result = new Chain(this, name);\r\n this._chains.push(result);\r\n return result;\r\n }\r\n\r\n getChain(name) {\r\n for (let i = 0, n = this._chains.length; i < n; ++i) {\r\n const chain = this._chains[i];\r\n if (chain.getName() === name) {\r\n return chain;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n getChainCount() {\r\n return this._chains.length;\r\n }\r\n\r\n getMolecules() {\r\n return this._molecules;\r\n }\r\n\r\n getMoleculeCount() {\r\n return this._molecules.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n process(atoms[i]);\r\n }\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._bonds;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n forEachChain(process) {\r\n const chains = this._chains;\r\n for (let i = 0, n = chains.length; i < n; ++i) {\r\n process(chains[i]);\r\n }\r\n }\r\n\r\n forEachMolecule(process) {\r\n const molecules = this._molecules;\r\n const n = molecules.length;\r\n for (let i = 0; i < n; ++i) {\r\n process(molecules[i]);\r\n }\r\n }\r\n\r\n forEachSGroup(process) {\r\n const groups = this._sgroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n process(groups[i]);\r\n }\r\n }\r\n\r\n forEachComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n forEachVisibleComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n addBond(left, right, order, type, fixed) {\r\n const bond = new Bond(left, right, order, type, fixed);\r\n this._bonds.push(bond);\r\n return bond;\r\n }\r\n\r\n getBondCount() {\r\n return this._bonds.length;\r\n }\r\n\r\n getResidueType(name) {\r\n return this._residueTypes[name] || null;\r\n }\r\n\r\n getUnifiedSerial(chain, serial, iCode) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n return serial + iCode * maxSerial + chain * chainShift;\r\n }\r\n\r\n splitUnifiedSerial(uniSerial) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n const chainId = Math.floor(uniSerial / chainShift);\r\n const remnant = uniSerial - chainId * chainShift;\r\n const insCode = Math.floor(remnant / maxSerial);\r\n const ser = remnant - insCode * maxSerial;\r\n return { chain: chainId, serial: ser, iCode: insCode };\r\n }\r\n\r\n _fillCmpEdit() {\r\n const self = this;\r\n const components = this._components;\r\n\r\n function addComp() {\r\n const comp = new Component(self);\r\n comp._index = components.length;\r\n components[comp._index] = comp;\r\n return comp;\r\n }\r\n\r\n this.forEachChain((chain) => {\r\n const residues = chain._residues;\r\n const resCount = residues.length;\r\n if (resCount < 1) {\r\n return;\r\n }\r\n let comp = addComp();\r\n let currStart = residues[0]._index;\r\n\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)\r\n || currRes._index !== nextRes._index - 1) {\r\n // the last condition is broken and incorrect\r\n // the refactoring of the Component is required in order to fix this issue\r\n comp.setSubDivs([{\r\n start: currStart,\r\n end: currRes._index,\r\n }]);\r\n if (nextRes) {\r\n currStart = nextRes._index;\r\n comp = addComp();\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n // This function was added in the moment of despair\r\n // It was the dark times for miew\r\n _fillCmpNoedit() {\r\n const comp = new Component(this);\r\n comp._index = 0;\r\n\r\n const residues = this._residues;\r\n const resCount = residues.length;\r\n if (resCount === 0) {\r\n return;\r\n }\r\n\r\n const currSubDivs = [];\r\n let currStart = 0;\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)) {\r\n // wrap up this interval\r\n currSubDivs[currSubDivs.length] = {\r\n start: currStart,\r\n end: i,\r\n };\r\n if (nextRes) {\r\n currStart = i + 1;\r\n }\r\n }\r\n }\r\n\r\n comp.setSubDivs(currSubDivs);\r\n this._components[comp._index] = comp;\r\n }\r\n\r\n /**\r\n * Fill components information.\r\n * @param {boolean} enableEditing - Restructure Complex to enable per-component editing.\r\n */\r\n _fillComponents(enableEditing) {\r\n if (enableEditing) {\r\n this._fillCmpEdit();\r\n } else {\r\n this._fillCmpNoedit();\r\n }\r\n }\r\n\r\n getCurrentUnit() {\r\n return this._currentUnit;\r\n }\r\n\r\n getDefaultBoundaries() {\r\n return this.units[0].getBoundaries();\r\n }\r\n\r\n getBoundaries() {\r\n return this.units[this._currentUnit].getBoundaries();\r\n }\r\n\r\n getTransforms() {\r\n return this.units[this._currentUnit].getTransforms();\r\n }\r\n\r\n getSelector() {\r\n return this.units[this._currentUnit].getSelector();\r\n }\r\n\r\n resetCurrentUnit() {\r\n this._currentUnit = 0;\r\n this.setCurrentUnit(1);\r\n }\r\n\r\n setCurrentUnit(newUnit) {\r\n if (newUnit !== null && newUnit !== undefined\r\n && newUnit !== this._currentUnit\r\n && newUnit >= 0\r\n && newUnit < this.units.length) {\r\n this._currentUnit = newUnit;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n _computeBounds() {\r\n const { units } = this;\r\n for (let i = 0, n = units.length; i < n; ++i) {\r\n units[i].computeBoundaries();\r\n }\r\n }\r\n\r\n onAtomPositionChanged() {\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n this.forEachComponent((c) => {\r\n c.update();\r\n });\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n this._finalizeBonds();\r\n this.forEachSGroup((s) => {\r\n s._rebuildSGroupOnAtomChange();\r\n });\r\n }\r\n\r\n update() {\r\n if (this._maskNeedsUpdate) {\r\n this.updateStructuresMask();\r\n this._maskNeedsUpdate = false;\r\n }\r\n }\r\n\r\n _finalizeBonds() {\r\n const bonds = this.getBonds();\r\n const n = bonds.length;\r\n for (let i = 0; i < n; ++i) {\r\n bonds[i]._index = i;\r\n }\r\n }\r\n\r\n /**\r\n * Finalizes complex's inner data(i.e. after parsing).\r\n * @param {objects} opts - Build bonds automatically.\r\n * @param {boolean} opts.needAutoBonding - Build bonds automatically.\r\n * @param {boolean} opts.detectAromaticLoops - Find/mark aromatic loops.\r\n * @param {boolean} opts.enableEditing - Restructure Complex to enable per-component editing.\r\n * @param {Array} [opts.serialAtomMap] - Array of atoms ordered by their serials.\r\n */\r\n finalize(opts) {\r\n opts = opts || {};\r\n // Put bonds into atoms\r\n const bonds = this._bonds;\r\n let i;\r\n let n;\r\n // remove invalid bonds\r\n for (i = bonds.length - 1; i >= 0; i--) {\r\n const bond = bonds[i];\r\n if (bond._left === null || bond._right === null) {\r\n bonds.splice(i, 1);\r\n } else {\r\n bond._left.bonds.push(bond);\r\n bond._right.bonds.push(bond);\r\n }\r\n }\r\n\r\n const residues = this._residues;\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._finalize();\r\n }\r\n\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n\r\n // WARNING! this MUST be done BEFORE computeBounds is called\r\n const { units } = this;\r\n for (i = 0, n = units.length; i < n; ++i) {\r\n units[i].finalize();\r\n }\r\n // try setting first biomolecule by defaults\r\n this.setCurrentUnit(1);\r\n\r\n const residueHash = {};\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n // This code is extremely dangerous for non-PDB formats\r\n residueHash[this.getUnifiedSerial(\r\n res.getChain().getName().charCodeAt(0),\r\n res.getSequence(), res.getICode().charCodeAt(0),\r\n )] = res;\r\n }\r\n\r\n const { structures } = this;\r\n for (i = 0, n = structures.length; i < n; ++i) {\r\n structures[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const helices = this._helices;\r\n for (i = 0, n = helices.length; i < n; ++i) {\r\n helices[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const sheets = this._sheets;\r\n for (i = 0, n = sheets.length; i < n; ++i) {\r\n sheets[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n\r\n const atoms = this._atoms;\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const currAtom = atoms[i];\r\n currAtom.index = i;\r\n }\r\n\r\n if (opts.needAutoBonding) {\r\n const autoConnector = new AutoBond(this);\r\n autoConnector.build();\r\n autoConnector.destroy();\r\n }\r\n\r\n const chains = this._chains;\r\n for (i = 0, n = chains.length; i < n; ++i) {\r\n chains[i]._index = i;\r\n }\r\n\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._index = i;\r\n }\r\n\r\n // mark non-polar hydrogens\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n if (atom.flags & Atom.Flags.HYDROGEN && atom.bonds.length === 1) {\r\n const bond = atom.bonds[0];\r\n const other = (bond._left !== atom && bond._left) || bond._right;\r\n if (other.flags & Atom.Flags.CARBON) {\r\n atom.flags |= Atom.Flags.NONPOLARH;\r\n }\r\n }\r\n }\r\n\r\n this._finalizeBonds();\r\n this._fillComponents(opts.enableEditing);\r\n\r\n const marker = new AromaticLoopsMarker(this);\r\n marker.markCycles();\r\n if (opts.detectAromaticLoops) { // TODO remove this condition clause, it is for debug purposes only!\r\n marker.detectCycles(); // TODO add conditional detection\r\n }\r\n\r\n this._finalizeMolecules();\r\n }\r\n\r\n _finalizeMolecules() {\r\n // add reference to molecule into residue\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const molecule = this._molecules[i];\r\n const count = molecule.residues.length;\r\n for (let j = 0; j < count; j++) {\r\n const residue = molecule.residues[j];\r\n residue._molecule = molecule;\r\n }\r\n }\r\n }\r\n\r\n updateStructuresMask() {\r\n const updater = (structure) => structure.collectMask();\r\n this.forEachResidue(updater);\r\n this.forEachChain(updater);\r\n this.forEachMolecule(updater);\r\n }\r\n\r\n countAtomsByMask(mask) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n getNumAtomsBySelector(selector) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n resetAtomMask(mask) {\r\n this.forEachAtom((atom) => {\r\n atom.mask = mask;\r\n });\r\n }\r\n\r\n markAtoms(selector, mask) {\r\n const setMask = mask;\r\n const clearMask = ~setMask;\r\n let count = 0;\r\n const totalSelector = selectors.keyword('And')(selector, this.getSelector());\r\n\r\n this.forEachAtom((atom) => {\r\n if (totalSelector.includesAtom(atom)) {\r\n atom.mask |= setMask;\r\n count++;\r\n } else {\r\n atom.mask &= clearMask;\r\n }\r\n });\r\n this._maskNeedsUpdate = true;\r\n\r\n return count;\r\n }\r\n\r\n markAtomsAdditionally(selector, mask) {\r\n const setMask = mask;\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom) && (atom.mask & mask) !== mask) {\r\n atom.mask |= setMask;\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n clearAtomBits(mask) {\r\n const clearMask = ~mask;\r\n this.forEachAtom((atom) => {\r\n atom.mask &= clearMask;\r\n });\r\n const reseter = (a) => {\r\n a._mask &= clearMask;\r\n };\r\n this.forEachAtom(reseter);\r\n this.forEachResidue(reseter);\r\n this.forEachChain(reseter);\r\n this.forEachMolecule(reseter);\r\n }\r\n\r\n getAtomNames() {\r\n if (this.hasOwnProperty('_atomNames')) {\r\n return this._atomNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.name] = 1;\r\n });\r\n this._atomNames = Object.keys(dict);\r\n\r\n return this._atomNames;\r\n }\r\n\r\n getElements() {\r\n if (this.hasOwnProperty('_elements')) {\r\n return this._elements;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.element.name] = 1;\r\n });\r\n this._elements = Object.keys(dict);\r\n\r\n return this._elements;\r\n }\r\n\r\n getResidueNames() {\r\n if (this.hasOwnProperty('_residueNames')) {\r\n return this._residueNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachResidue((res) => {\r\n dict[res._type._name] = 1;\r\n });\r\n this._residueNames = Object.keys(dict);\r\n\r\n return this._residueNames;\r\n }\r\n\r\n getChainNames() {\r\n if (this.hasOwnProperty('_chainNames')) {\r\n return this._chainNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachChain((chain) => {\r\n dict[chain._name] = 1;\r\n });\r\n this._chainNames = Object.keys(dict);\r\n\r\n return this._chainNames;\r\n }\r\n\r\n getAltLocNames() {\r\n if (this.hasOwnProperty('_altlocNames')) {\r\n return this._altlocNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[String.fromCharCode(atom.location)] = 1;\r\n });\r\n this._altlocNames = Object.keys(dict);\r\n\r\n return this._altlocNames;\r\n }\r\n\r\n getVoxelWorld() {\r\n if (!this.hasOwnProperty('_voxelWorld')) {\r\n try {\r\n this._voxelWorld = new VoxelWorld(\r\n this.getDefaultBoundaries().boundingBox,\r\n new THREE.Vector3(VOXEL_SIZE, VOXEL_SIZE, VOXEL_SIZE),\r\n );\r\n this._voxelWorld.addAtoms(this);\r\n } catch (e) {\r\n logger.warn('Unable to create voxel world');\r\n this._voxelWorld = null;\r\n }\r\n }\r\n\r\n return this._voxelWorld;\r\n }\r\n\r\n /**\r\n * Simple function to make unified routine procedure without code duplication.\r\n * @param {Array} srcArray - Source chemical structure array (will be part of resulting chemical structure array).\r\n * @param {Array} dstArray - Resulting chemical structure array.\r\n * @param {number} param - Parameter for processor.\r\n * @param {function} functor - Processor for every element in array.\r\n */\r\n addElement(srcArray, dstArray, param, functor) {\r\n const { length } = srcArray;\r\n for (let i = 0; i < length; ++i) {\r\n const elem = srcArray[i];\r\n functor(elem, param);\r\n dstArray.push(elem);\r\n }\r\n }\r\n\r\n // this function joins multiple complexes into one (this)\r\n // atom, bond, ... objects are reused -- so input complexes are no longer valid\r\n joinComplexes(complexes) {\r\n // clear target complex\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n\r\n const self = this;\r\n let atomBias = 0;\r\n let bondBias = 0;\r\n let residueBias = 0;\r\n let chainBias = 0;\r\n let componentBias = 0;\r\n\r\n function processAtom(atom, bias) {\r\n atom.serial += bias;\r\n atom.index += bias;\r\n }\r\n\r\n function processBond(bond, bias) {\r\n bond._index += bias;\r\n }\r\n\r\n function processResidue(residue, bias) {\r\n residue._index += bias;\r\n }\r\n\r\n function processChain(chain, bias) {\r\n chain._complex = self;\r\n chain._index += bias;\r\n }\r\n\r\n function processComponent(component, bias) {\r\n component._complex = self;\r\n component._index += bias;\r\n }\r\n\r\n /**\r\n * Simple function to do nothing.\r\n */\r\n function doNothing() {\r\n }\r\n\r\n for (let i = 0; i < complexes.length; ++i) {\r\n const c = complexes[i];\r\n this.addElement(c._atoms, this._atoms, atomBias, processAtom);\r\n this.addElement(c._bonds, this._bonds, bondBias, processBond);\r\n this.addElement(c._residues, this._residues, residueBias, processResidue);\r\n this.addElement(c._chains, this._chains, chainBias, processChain);\r\n this.addElement(c._sheets, this._sheets, 0, doNothing);\r\n this.addElement(c._helices, this._helices, 0, doNothing);\r\n this.addElement(c._sgroups, this._sgroups, 0, doNothing);\r\n this.addElement(c._components, this._components, componentBias, processComponent);\r\n this.addElement(c.structures, this.structures, 0, doNothing);\r\n // merge residue types\r\n for (const rt in c._residueTypes) {\r\n if (c._residueTypes.hasOwnProperty(rt)) {\r\n this._residueTypes[rt] = c._residueTypes[rt];\r\n }\r\n }\r\n\r\n atomBias += c._atoms.length;\r\n bondBias += c._bonds.length;\r\n residueBias += c._residues.length;\r\n chainBias += c._chains.length;\r\n componentBias += c._components.length;\r\n }\r\n\r\n this._computeBounds();\r\n }\r\n\r\n /**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n */\r\n dssp() {\r\n const ssMap = new SecondaryStructureMap(this);\r\n\r\n const structures = this.structures = [];\r\n const helices = this._helices = [];\r\n const sheets = this._sheets = [];\r\n\r\n const getSheet = (index) => {\r\n let item = sheets[index];\r\n if (!item) {\r\n item = sheets[index] = new Sheet(String(index), 0);\r\n }\r\n return item;\r\n };\r\n\r\n let lastCode;\r\n let lastSheetIndex;\r\n let lastHelixIndex = 0;\r\n let curStructure = null;\r\n for (let i = 0, n = this._residues.length; i < n; ++i) {\r\n const curCode = ssMap._ss[i];\r\n const curResidue = this._residues[i];\r\n const curSheetIndex = ssMap._sheet[i];\r\n\r\n // expand the last structure\r\n if (curCode === lastCode && curSheetIndex === lastSheetIndex) {\r\n curResidue._secondary = curStructure;\r\n if (curStructure) {\r\n curStructure.term = curResidue;\r\n }\r\n if (curStructure instanceof Helix) {\r\n curStructure.length++;\r\n }\r\n continue;\r\n }\r\n\r\n // create a new structure\r\n const helixClass = helixClassMap[curCode];\r\n const loopType = loopMap[curCode];\r\n if (curCode === StructureType.STRAND) {\r\n const curSheet = getSheet(curSheetIndex);\r\n curStructure = new Strand(curSheet, curResidue, curResidue, 0, null, null);\r\n curSheet.addStrand(curStructure);\r\n } else if (helixClass !== undefined) {\r\n lastHelixIndex++;\r\n curStructure = new Helix(helixClass, curResidue, curResidue, lastHelixIndex, String(lastHelixIndex), '', 1);\r\n helices.push(curStructure);\r\n } else if (loopType !== undefined) {\r\n curStructure = new StructuralElement(loopType, curResidue, curResidue);\r\n } else {\r\n curStructure = null;\r\n }\r\n\r\n if (curStructure) {\r\n structures.push(curStructure);\r\n }\r\n\r\n curResidue._secondary = curStructure;\r\n\r\n lastCode = curCode;\r\n lastSheetIndex = curSheetIndex;\r\n }\r\n\r\n this._sheets = sheets.filter((_sheet) => true); // squeeze sheets array\r\n }\r\n}\r\n\r\nComplex.prototype.id = 'Complex';\r\nComplex.prototype.name = '';\r\n\r\nexport default Complex;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\nfunction pow2ceil(v) {\r\n let p = 2;\r\n v = (v - 1) >> 1;\r\n while (v) {\r\n p <<= 1;\r\n v >>= 1;\r\n }\r\n return p;\r\n}\r\n\r\n/**\r\n * Volume constructor\r\n *\r\n * @param {Object} type - Float32Array, Int8Array, etc...\r\n * @param {Object|Array} dimensions - number of data points on each axis (x, y, z)\r\n * @param {Box3} box - bounding box defining data place in metric space,\r\n * it's corners correspond to extreme data points\r\n * @param {Number} vecSize - dimension of the field data point (1 = scalar, 3 = 3D vector)\r\n * @param {Object} data - typed array of the same type as specified by the 1st parameter,\r\n * layout: point by point along X,\r\n * row by row along Y,\r\n * plane by plane along Z\r\n * @param {Number} volumeInfo - volume info values to define threshold to filter the noise\r\n */\r\n\r\nclass Volume {\r\n constructor(type, dimensions, box, vecSize, data, volumeInfo) {\r\n this._box = box.clone();\r\n this._dimVec = Math.max(Math.floor(vecSize || 1), 1);\r\n this._volumeInfo = volumeInfo;\r\n\r\n if (dimensions instanceof Array) {\r\n [this._dimX, this._dimY, this._dimZ] = dimensions;\r\n } else {\r\n this._dimX = dimensions.x;\r\n this._dimY = dimensions.y;\r\n this._dimZ = dimensions.z;\r\n }\r\n this._dimX = Math.max(Math.floor(this._dimX), 1);\r\n this._dimY = Math.max(Math.floor(this._dimY), 1);\r\n this._dimZ = Math.max(Math.floor(this._dimZ), 1);\r\n\r\n this._rowElements = this._dimVec * this._dimX;\r\n this._planeElements = this._rowElements * this._dimY;\r\n this._totalElements = this._planeElements * this._dimZ;\r\n\r\n this._data = data || utils.allocateTyped(type, this._totalElements);\r\n\r\n // override getter/setter for vector fields\r\n switch (this._dimVec) {\r\n case 1:\r\n break;\r\n\r\n case 2:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n };\r\n break;\r\n\r\n case 3:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1], this._data[idx + 2]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n this._data[idx + 2] = c;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n this._data[idx + 2] += c;\r\n };\r\n break;\r\n\r\n default:\r\n throw new Error('Volume: invalid vector dimension');\r\n }\r\n }\r\n\r\n // default getter assumes it's a scalar field\r\n getValue(x, y, z) {\r\n return this._data[x + y * this._rowElements + z * this._planeElements];\r\n }\r\n\r\n // default setter assumes it's a scalar field\r\n setValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] = val;\r\n }\r\n\r\n // default adder assumes it's a scalar field\r\n addValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] += val;\r\n }\r\n\r\n getDimensions() {\r\n return [this._dimX, this._dimY, this._dimZ];\r\n }\r\n\r\n getBox() {\r\n return this._box;\r\n }\r\n\r\n getVolumeInfo() {\r\n return this._volumeInfo;\r\n }\r\n\r\n getCellSize() {\r\n const boxSize = new THREE.Vector3();\r\n this._box.getSize(boxSize);\r\n const res = new THREE.Vector3();\r\n res.x = this._dimX > 1 ? boxSize.x / (this._dimX - 1) : 0;\r\n res.y = this._dimY > 1 ? boxSize.y / (this._dimY - 1) : 0;\r\n res.z = this._dimZ > 1 ? boxSize.z / (this._dimZ - 1) : 0;\r\n return res;\r\n }\r\n\r\n computeGradient() {\r\n if (this._dimVec !== 1) {\r\n // gradient can only be computed for scalar fields\r\n return null;\r\n }\r\n\r\n // create a 3D vector field of gradients\r\n const gradient = new Volume(Float32Array, [this._dimX, this._dimY, this._dimZ], this._box, 3);\r\n\r\n // calculate cell side lengths\r\n const vl = this.getCellSize();\r\n\r\n // gradient axis scaling values and averaging factors, to correctly\r\n // calculate the gradient for volumes with irregular cell spacing\r\n const vs = new THREE.Vector3(-0.5 / vl.x, -0.5 / vl.y, -0.5 / vl.z);\r\n\r\n // TODO Check for intended bug in VMD (min is zero)\r\n function clamp(val, min, max) {\r\n return Math.min(max, Math.max(min, val));\r\n }\r\n\r\n const xSize = this._dimX;\r\n const ySize = this._dimY;\r\n const zSize = this._dimZ;\r\n const volMap = this._data;\r\n\r\n function _voxelValue(x, y, z) {\r\n return volMap[z * xSize * ySize + y * xSize + x];\r\n }\r\n\r\n for (let zi = 0; zi < zSize; ++zi) {\r\n const zm = clamp(zi - 1, 0, zSize - 1);\r\n const zp = clamp(zi + 1, 0, zSize - 1);\r\n\r\n for (let yi = 0; yi < ySize; ++yi) {\r\n const ym = clamp(yi - 1, 0, ySize - 1);\r\n const yp = clamp(yi + 1, 0, ySize - 1);\r\n\r\n for (let xi = 0; xi < xSize; ++xi) {\r\n const xm = clamp(xi - 1, 0, xSize - 1);\r\n const xp = clamp(xi + 1, 0, xSize - 1);\r\n\r\n // Calculate the volume gradient at each grid cell.\r\n // Gradients are now stored unnormalized, since we need them in pure\r\n // form in order to draw field lines etc. Shading code will now have\r\n // to do renormalization for itself on-the-fly.\r\n\r\n // XXX this gradient is only correct for orthogonal grids, since\r\n // we're using the array index offsets rather to calculate the gradient\r\n // rather than voxel coordinate offsets. This will have to be\r\n // re-worked for non-orthogonal datasets.\r\n\r\n gradient.setValue(\r\n xi, yi, zi,\r\n (_voxelValue(xp, yi, zi) - _voxelValue(xm, yi, zi)) * vs.x,\r\n (_voxelValue(xi, yp, zi) - _voxelValue(xi, ym, zi)) * vs.y,\r\n (_voxelValue(xi, yi, zp) - _voxelValue(xi, yi, zm)) * vs.z,\r\n );\r\n }\r\n }\r\n }\r\n\r\n return gradient;\r\n }\r\n\r\n normalize() {\r\n const data = this._data;\r\n\r\n // get min/max\r\n let min = data[0];\r\n let max = data[0];\r\n for (let i = 1; i < data.length; ++i) {\r\n min = Math.min(min, data[i]);\r\n max = Math.max(max, data[i]);\r\n }\r\n\r\n const d = 1.0 / (max - min);\r\n if (d === 0) {\r\n return;\r\n }\r\n\r\n // normalize\r\n for (let i = 0; i < data.length; ++i) {\r\n data[i] = d * (data[i] - min);\r\n }\r\n }\r\n\r\n getTiledTextureStride() {\r\n return [this._dimX + 2, this._dimY + 2];\r\n }\r\n\r\n buildTiledTexture() {\r\n let tilesX = Math.ceil(Math.sqrt(this._dimZ * this._dimY / this._dimX));\r\n\r\n let width = tilesX * (this._dimX + 2) - 1;\r\n width = pow2ceil(width);\r\n tilesX = Math.floor(width / (this._dimX + 2));\r\n\r\n const tilesY = Math.ceil(this._dimZ / tilesX);\r\n let height = tilesY * (this._dimY + 2) - 1;\r\n height = pow2ceil(height);\r\n\r\n const data = new Uint8Array(width * height);\r\n\r\n let src;\r\n let dst;\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // process each pixel row of this tile row\r\n for (let row = 0; row < this._dimY; ++row) {\r\n src = tileRow * tilesX * this._planeElements + row * this._rowElements;\r\n dst = width * (tileRow * (this._dimY + 2) + row);\r\n // copy a series of rows through several XY planes\r\n for (let t = 0; t < tilesX; ++t) {\r\n // copy one row of one XY plane\r\n for (let x = 0; x < this._dimX; ++x) {\r\n data[dst++] = 255.0 * this._data[src++];\r\n }\r\n\r\n // repeat last pixel of previous tile\r\n data[dst++] = 255.0 * this._data[src - 1];\r\n\r\n if (t < tilesX - 1) {\r\n // skip to the same row of next XY plane\r\n src += this._planeElements - this._rowElements;\r\n // repeat first pixel of next tile\r\n data[dst++] = 255.0 * this._data[src];\r\n }\r\n }\r\n }\r\n }\r\n\r\n // fill pixels between tile rows with copy of edge pixels\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // copy last pixel row of this tile row to the following pixel row of the texture\r\n src = width * (tileRow * (this._dimY + 2) + this._dimY - 1);\r\n dst = src + width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n if (tileRow < tilesY - 1) {\r\n // copy first pixel row of next tile row to the preceding pixel row of the texture\r\n src = width * (tileRow + 1) * (this._dimY + 2);\r\n dst = src - width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n }\r\n }\r\n\r\n const texture = new THREE.DataTexture(\r\n data, width, height, THREE.LuminanceFormat, THREE.UnsignedByteType,\r\n THREE.UVMapping, THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping, THREE.LinearFilter, THREE.LinearFilter,\r\n );\r\n texture.needsUpdate = true;\r\n return texture;\r\n }\r\n\r\n /* ********************************************************************************\r\n *\r\n * Methods that provide direct access to internal array (for better performance)\r\n *\r\n ******************************************************************************** */\r\n\r\n getData() {\r\n return this._data;\r\n }\r\n\r\n getDirectIdx(x, y, z) {\r\n return x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n }\r\n\r\n getStrideX() {\r\n return this._dimVec;\r\n }\r\n\r\n getStrideY() {\r\n return this._rowElements;\r\n }\r\n\r\n getStrideZ() {\r\n return this._planeElements;\r\n }\r\n}\r\n\r\nVolume.prototype.id = 'Volume';\r\n\r\nexport default Volume;\r\n","/**\r\n * Residue Molecule.\r\n *\r\n * @param {Complex} complex - Molecular complex this Molecule belongs to.\r\n * @param {String} name - Molecule's name.\r\n * @param {Integer} index - Molecule's index in file.\r\n *\r\n * @exports Molecule\r\n * @constructor\r\n */\r\nclass Molecule {\r\n constructor(complex, name, index) {\r\n this.complex = complex;\r\n this.name = name || '';\r\n this.residues = [];\r\n this.mask = 1 | 0;\r\n this.index = index || -1; // start with 1\r\n }\r\n\r\n forEachResidue(process) {\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this.mask = mask;\r\n }\r\n}\r\n\r\nexport default Molecule;\r\n","import Atom from './chem/Atom';\r\nimport Element from './chem/Element';\r\nimport Bond from './chem/Bond';\r\nimport Residue from './chem/Residue';\r\nimport ResidueType from './chem/ResidueType';\r\nimport Chain from './chem/Chain';\r\nimport Helix from './chem/Helix';\r\nimport Strand from './chem/Strand';\r\nimport Sheet from './chem/Sheet';\r\nimport SGroup from './chem/SGroup';\r\nimport Assembly from './chem/Assembly';\r\nimport Complex from './chem/Complex';\r\nimport Volume from './chem/Volume';\r\nimport VoxelWorld from './chem/VoxelWorld';\r\nimport selectors from './chem/selectors';\r\nimport Molecule from './chem/Molecule';\r\n\r\nexport default {\r\n Atom,\r\n Element,\r\n Bond,\r\n Residue,\r\n ResidueType,\r\n Chain,\r\n Helix,\r\n Strand,\r\n Sheet,\r\n SGroup,\r\n Assembly,\r\n Complex,\r\n Volume,\r\n VoxelWorld,\r\n selectors,\r\n Molecule,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\n\r\nclass CSS2DObject extends THREE.Object3D {\r\n constructor(element) {\r\n super();\r\n const self = this;\r\n this._element = element;\r\n this._element.style.position = 'absolute';\r\n this.addEventListener('removed', () => {\r\n if (self._element.parentNode !== null) {\r\n self._element.parentNode.removeChild(self._element);\r\n }\r\n });\r\n }\r\n\r\n getElement() {\r\n return this._element;\r\n }\r\n\r\n /**\r\n * Sets label transparency.\r\n *\r\n * @param {number} transp - in [0; 1] 1 means fully transparent\r\n */\r\n setTransparency(transp) {\r\n const el = this.getElement();\r\n if (el === null) {\r\n return;\r\n }\r\n if (transp === 1.0) {\r\n el.style.display = 'none';\r\n return;\r\n }\r\n el.style.display = 'inline';\r\n const op = 1.0 - transp;\r\n const top = op.toString();\r\n const op100 = op * 100;\r\n el.style.opacity = top;\r\n el.style.filter = `alpha(opacity=${op100})`; // IE fallback\r\n }\r\n\r\n clone() {\r\n const obj = new CSS2DObject(this._element);\r\n obj.copy(this);\r\n return obj;\r\n }\r\n}\r\n\r\n\r\nexport default CSS2DObject;\r\n","import * as THREE from 'three';\r\n\r\nclass RCGroup extends THREE.Group {\r\n raycast(raycaster, intersects) {\r\n if (!this.visible) {\r\n return;\r\n }\r\n\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n children[i].raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].enableSubset) {\r\n children[i].enableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].disableSubset) {\r\n children[i].disableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n isEmpty() {\r\n return this.children.length === 0;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].updateToFrame) {\r\n children[i].updateToFrame(frameData);\r\n }\r\n }\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n Array.prototype.push.apply(totalSubset, children[i].getSubset(mask, innerOnly));\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default RCGroup;\r\n","export default {\r\n\r\n precision: 'mediump',\r\n\r\n /**\r\n *\r\n * @param {THREE.WebGLRenderer} renderer\r\n */\r\n init(renderer) {\r\n this.precision = renderer.capabilities.getMaxPrecision('highp');\r\n },\r\n};\r\n","import * as THREE from 'three';\r\n\r\nconst noiseWidth = 4;\r\nconst noiseHeight = 4;\r\nconst _noiseData = new Uint8Array([\r\n 24, 52, 0, 254, 145, 0, 122, 0, 0, 7, 170, 0,\r\n 34, 214, 0, 173, 8, 0, 86, 249, 0, 160, 4, 0,\r\n 226, 46, 0, 224, 211, 0, 3, 157, 0, 174, 247, 0,\r\n 12, 182, 0, 220, 216, 0, 1, 109, 0, 253, 154, 0,\r\n]);\r\nconst _noiseWrapS = THREE.RepeatWrapping;\r\nconst _noiseWrapT = THREE.RepeatWrapping;\r\nconst _noiseMinFilter = THREE.NearestFilter;\r\nconst _noiseMagFilter = THREE.NearestFilter;\r\nconst _noiseMapping = THREE.UVMapping;\r\nconst noiseTexture = new THREE.DataTexture(\r\n _noiseData, noiseWidth, noiseHeight, THREE.RGBFormat,\r\n THREE.UnsignedByteType, _noiseMapping, _noiseWrapS, _noiseWrapT, _noiseMagFilter, _noiseMinFilter, 1,\r\n);\r\nnoiseTexture.needsUpdate = true;\r\n\r\nexport default {\r\n noiseWidth,\r\n noiseHeight,\r\n noiseTexture,\r\n};\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './Uber.vert';\r\nimport fragmentShader from './Uber.frag';\r\nimport capabilities from '../capabilities';\r\nimport noise from '../noiseTexture';\r\n\r\n// Length of _samplesKernel is used in Uber.frag\r\n// If you want to change length of _samplesKernel, please, remember change it in Uber.frag too.\r\n// You can easy find places for replace using word:_samplesKernel\r\nconst _samplesKernel = [\r\n new THREE.Vector2(-0.541978, 0.840393),\r\n new THREE.Vector2(0.125533, -0.992089),\r\n new THREE.Vector2(0.374329, 0.927296),\r\n new THREE.Vector2(-0.105475, 0.994422),\r\n];\r\n\r\nconst defaultUniforms = THREE.UniformsUtils.merge([\r\n\r\n THREE.UniformsLib.fog,\r\n THREE.UniformsLib.lights,\r\n\r\n {\r\n // are updated automatically by three.js (see THREE.ShaderLib.common)\r\n diffuse: { value: new THREE.Color(0xeeeeee) },\r\n opacity: { value: 1.0 },\r\n\r\n specular: { type: 'c', value: new THREE.Color(0x111111) },\r\n shininess: { type: 'f', value: 30 },\r\n fixedColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n zOffset: { type: 'f', value: 0.0 },\r\n zClipValue: { type: 'f', value: 0.0 },\r\n clipPlaneValue: { type: 'f', value: 0.0 },\r\n invModelViewMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n world2colorMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n dashedLineSize: { type: 'f', value: 0.1 },\r\n dashedLinePeriod: { type: 'f', value: 0.2 },\r\n projMatrixInv: { type: '4fv', value: new THREE.Matrix4() },\r\n viewport: { type: 'v2', value: new THREE.Vector2() },\r\n lineWidth: { type: 'f', value: 2.0 },\r\n // default value must be the same as settings\r\n fogAlpha: { type: 'f', value: 1.0 },\r\n samplesKernel: { type: 'v2v', value: null },\r\n noiseTex: { type: 't', value: null },\r\n noiseTexelSize: { type: 'v2', value: null },\r\n srcTexelSize: { type: 'v2', value: null },\r\n },\r\n\r\n]);\r\n\r\nconst uberOptionNames = [\r\n 'shininess',\r\n 'opacity',\r\n 'zOffset',\r\n 'diffuse',\r\n 'specular',\r\n 'fixedColor',\r\n 'zClipCoef',\r\n 'zClipValue',\r\n 'clipPlaneValue',\r\n 'world2colorMatrix',\r\n 'dashedLineSize',\r\n 'dashedLinePeriod',\r\n 'projMatrixInv',\r\n 'viewport',\r\n 'lineWidth',\r\n 'fogAlpha',\r\n 'samplesKernel',\r\n 'noiseTex',\r\n 'noiseTexelSize',\r\n 'srcTexelSize',\r\n];\r\n\r\nfunction UberMaterial(params) {\r\n THREE.RawShaderMaterial.call(this);\r\n\r\n // add fog\r\n this.fog = true;\r\n // used for instanced geometry\r\n this.instancedPos = false;\r\n this.instancedMatrix = false;\r\n // atoms and links color\r\n this.attrColor = false;\r\n // second link color for cylinders\r\n this.attrColor2 = false;\r\n //\r\n this.attrAlphaColor = false;\r\n // overrides color for all vertices (used in selection)\r\n this.overrideColor = false;\r\n // zsrpites\r\n this.sphereSprite = false;\r\n this.cylinderSprite = false;\r\n // clip Surfs individually\r\n this.zClip = false;\r\n // clip scene with global clip plane\r\n this.clipPlane = false;\r\n // enable fake (chess-like) opacity\r\n this.fakeOpacity = false;\r\n // render only depth, don't take care about the pixel color (used for transparency depth prepass)\r\n this.prepassTransparancy = false;\r\n // used to render pixel positions\r\n this.colorFromPos = false;\r\n // used to render shadowmap\r\n this.shadowmap = false;\r\n // used to describe shadowmap type\r\n this.shadowmapType = 'random';\r\n // used to render pixel view deph\r\n this.colorFromDepth = false;\r\n // used to render dashed line\r\n this.dashedLine = false;\r\n // mark as transparent\r\n this.transparent = true;\r\n // mark as thick lines\r\n this.thickLine = false;\r\n // makes fog begin transparency (required for transparent background)\r\n this.fogTransparent = false;\r\n // used to render surface normals to G buffer for ssao effect\r\n this.normalsToGBuffer = false;\r\n // used for toon material\r\n this.toonShading = false;\r\n\r\n // uber options of \"root\" materials are inherited from single uber-options object that resides in prototype\r\n this.uberOptions = Object.create(UberMaterial.prototype.uberOptions);\r\n\r\n // set default values\r\n THREE.RawShaderMaterial.prototype.setValues.call(this, {\r\n uniforms: THREE.UniformsUtils.clone(defaultUniforms),\r\n vertexShader: this.precisionString() + vertexShader,\r\n fragmentShader: this.precisionString() + fragmentShader,\r\n lights: true,\r\n fog: true,\r\n side: THREE.DoubleSide,\r\n });\r\n\r\n this.setValues(params);\r\n}\r\n\r\nUberMaterial.prototype = Object.create(THREE.RawShaderMaterial.prototype);\r\nUberMaterial.prototype.constructor = UberMaterial;\r\n\r\nUberMaterial.prototype.precisionString = function () {\r\n const { precision } = capabilities;\r\n const str = `precision ${precision} float;\\n`\r\n + `precision ${precision} int;\\n\\n`;\r\n return str;\r\n};\r\n\r\n// properties that convert to uniforms\r\nUberMaterial.prototype.uberOptions = {\r\n diffuse: new THREE.Color(0xffffff), // used in phong lighting\r\n specular: new THREE.Color(0x111111), // used in phong lighting\r\n shininess: 30, // used in phong lighting\r\n opacity: 1, // set mesh opacity\r\n fixedColor: new THREE.Color(0xffffff), // color to override (see OVERRIDE_COLOR)\r\n zOffset: 0.0, // used fo zsprites (see SPHERE_SPRITE CYLINDER_SPRITE)\r\n zClipCoef: 2.0, // use for Surfs clipping (mesh param, isn't used in shader) FIXME move to representation param\r\n zClipValue: 0.0, // value to clip Surfs in shader (see ZCLIP)\r\n clipPlaneValue: 0.0, // value to clip scene globally (see CLIPPLANE)\r\n world2colorMatrix: new THREE.Matrix4(),\r\n dashedLineSize: 0.1,\r\n dashedLinePeriod: 0.3,\r\n projMatrixInv: new THREE.Matrix4(),\r\n viewport: new THREE.Vector2(800, 600),\r\n lineWidth: 2.0,\r\n fogAlpha: 1.0,\r\n samplesKernel: _samplesKernel,\r\n noiseTex: noise.noiseTexture,\r\n noiseTexelSize: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight),\r\n srcTexelSize: new THREE.Vector2(1.0 / 800.0, 1.0 / 600.0),\r\n\r\n copy(source) {\r\n this.diffuse.copy(source.diffuse);\r\n this.specular.copy(source.specular);\r\n this.shininess = source.shininess;\r\n this.opacity = source.opacity;\r\n this.fixedColor.copy(source.fixedColor);\r\n this.zOffset = source.zOffset;\r\n this.zClipCoef = source.zClipCoef;\r\n this.zClipValue = source.zClipValue;\r\n this.clipPlaneValue = source.clipPlaneValue;\r\n this.world2colorMatrix.copy(source.world2colorMatrix);\r\n this.dashedLineSize = source.dashedLineSize;\r\n this.dashedLinePeriod = source.dashedLinePeriod;\r\n this.projMatrixInv = source.projMatrixInv;\r\n this.viewport = source.viewport;\r\n this.lineWidth = source.lineWidth; // used for thick lines only\r\n this.toonShading = source.toonShading;\r\n this.fogAlpha = source.fogAlpha;\r\n this.samplesKernel = source.samplesKernel;\r\n this.noiseTex = source.noiseTex;\r\n this.noiseTexelSize = source.noiseTexelSize;\r\n this.srcTexelSize = source.srcTexelSize;\r\n },\r\n};\r\n\r\nUberMaterial.prototype.copy = function (source) {\r\n THREE.RawShaderMaterial.prototype.copy.call(this, source);\r\n\r\n this.fragmentShader = source.fragmentShader;\r\n this.vertexShader = source.vertexShader;\r\n\r\n this.uniforms = THREE.UniformsUtils.clone(source.uniforms);\r\n this.defines = { ...source.defines };\r\n this.extensions = source.extensions;\r\n\r\n this.fog = source.fog;\r\n this.instancedPos = source.instancedPos;\r\n this.instancedMatrix = source.instancedMatrix;\r\n this.attrColor = source.attrColor;\r\n this.attrColor2 = source.attrColor2;\r\n this.attrAlphaColor = source.attrAlphaColor;\r\n this.overrideColor = source.overrideColor;\r\n this.sphereSprite = source.sphereSprite;\r\n this.cylinderSprite = source.cylinderSprite;\r\n this.zClip = source.zClip;\r\n this.clipPlane = source.clipPlane;\r\n this.fakeOpacity = source.fakeOpacity;\r\n this.colorFromPos = source.colorFromPos;\r\n this.shadowmap = source.shadowmap;\r\n this.shadowmapType = source.shadowmapType;\r\n this.colorFromDepth = source.colorFromDepth;\r\n this.prepassTransparancy = source.prepassTransparancy;\r\n this.dashedLine = source.dashedLine;\r\n this.thickLine = source.thickLine;\r\n this.fogTransparent = source.fogTransparent;\r\n this.normalsToGBuffer = source.normalsToGBuffer;\r\n this.toonShading = source.toonShading;\r\n\r\n this.uberOptions.copy(source.uberOptions);\r\n\r\n return this;\r\n};\r\n\r\n// create copy of this material\r\n// its options are prototyped after this material's options\r\nUberMaterial.prototype.createInstance = function () {\r\n const inst = new UberMaterial();\r\n inst.copy(this);\r\n inst.uberOptions = Object.create(this.uberOptions);\r\n return inst;\r\n};\r\n\r\nUberMaterial.prototype.setValues = function (values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n THREE.RawShaderMaterial.prototype.setValues.call(this, values);\r\n\r\n const defines = {};\r\n const extensions = {};\r\n\r\n if (this.fog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.instancedPos) {\r\n defines.INSTANCED_POS = 1;\r\n }\r\n if (this.instancedMatrix) {\r\n defines.INSTANCED_MATRIX = 1;\r\n }\r\n if (this.attrColor) {\r\n defines.ATTR_COLOR = 1;\r\n }\r\n if (this.attrColor2) {\r\n defines.ATTR_COLOR2 = 1;\r\n }\r\n if (this.attrAlphaColor) {\r\n defines.ATTR_ALPHA_COLOR = 1;\r\n }\r\n if (this.overrideColor) {\r\n defines.OVERRIDE_COLOR = 1;\r\n }\r\n if (this.sphereSprite) {\r\n defines.SPHERE_SPRITE = 1;\r\n extensions.fragDepth = 1;\r\n }\r\n if (this.cylinderSprite) {\r\n defines.CYLINDER_SPRITE = 1;\r\n extensions.fragDepth = 1;\r\n }\r\n if (this.zClip) {\r\n defines.ZCLIP = 1;\r\n }\r\n if (this.clipPlane) {\r\n defines.CLIP_PLANE = 1;\r\n }\r\n if (this.fakeOpacity) {\r\n defines.FAKE_OPACITY = 1;\r\n }\r\n if (this.lights) {\r\n defines.USE_LIGHTS = 1;\r\n }\r\n if (this.colorFromPos) {\r\n defines.COLOR_FROM_POS = 1;\r\n }\r\n if (this.shadowmap) {\r\n defines.SHADOWMAP = 1;\r\n if (this.shadowmapType === 'pcf') {\r\n defines.SHADOWMAP_PCF_SHARP = 1;\r\n } else if (this.shadowmapType === 'random') {\r\n defines.SHADOWMAP_PCF_RAND = 1;\r\n } else {\r\n defines.SHADOWMAP_BASIC = 1;\r\n }\r\n }\r\n if (this.colorFromDepth) {\r\n defines.COLOR_FROM_DEPTH = 1;\r\n }\r\n if (this.prepassTransparancy) {\r\n defines.PREPASS_TRANSP = 1;\r\n }\r\n if (this.dashedLine) {\r\n defines.DASHED_LINE = 1;\r\n }\r\n if (this.thickLine) {\r\n defines.THICK_LINE = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n if (this.normalsToGBuffer) {\r\n extensions.drawBuffers = 1;\r\n defines.NORMALS_TO_G_BUFFER = 1;\r\n }\r\n if (this.toonShading) {\r\n defines.TOON_SHADING = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n this.extensions = extensions;\r\n};\r\n\r\nUberMaterial.prototype.setUberOptions = function (values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n for (const key in values) {\r\n if (!values.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n\r\n if (this.uberOptions[key] instanceof THREE.Color) {\r\n this.uberOptions[key] = values[key].clone();\r\n } else {\r\n this.uberOptions[key] = values[key];\r\n }\r\n }\r\n};\r\n\r\nUberMaterial.prototype.clone = function (shallow) {\r\n if (!shallow) {\r\n return THREE.Material.prototype.clone.call(this);\r\n }\r\n return this.createInstance();\r\n};\r\n\r\nUberMaterial.prototype.updateUniforms = function () {\r\n const self = this;\r\n\r\n uberOptionNames.forEach((p) => {\r\n if (self.uniforms.hasOwnProperty(p)) {\r\n if (self.uberOptions[p] instanceof THREE.Color\r\n || self.uberOptions[p] instanceof THREE.Matrix4) {\r\n self.uniforms[p].value = self.uberOptions[p].clone();\r\n } else {\r\n self.uniforms[p].value = self.uberOptions[p];\r\n }\r\n }\r\n });\r\n};\r\n\r\nexport default UberMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\nimport * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport logger from '../utils/logger';\r\nimport CSS2DObject from './CSS2DObject';\r\nimport RCGroup from './RCGroup';\r\nimport vertexScreenQuadShader from './shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromTex from './shaders/ScreenQuadFromTex.frag';\r\nimport fragmentScreenQuadFromTexWithDistortion from './shaders/ScreenQuadFromTexWithDistortion.frag';\r\nimport UberMaterial from './shaders/UberMaterial';\r\n\r\nconst LAYERS = {\r\n DEFAULT: 0, VOLUME: 1, TRANSPARENT: 2, PREPASS_TRANSPARENT: 3, VOLUME_BFPLANE: 4, COLOR_FROM_POSITION: 5, SHADOWMAP: 6,\r\n};\r\n\r\nconst SELECTION_LAYERS = [ // These layers, that are used in the selection by ray casting\r\n LAYERS.DEFAULT, LAYERS.TRANSPARENT,\r\n];\r\n\r\nTHREE.Object3D.prototype.resetTransform = function () {\r\n this.position.set(0, 0, 0);\r\n this.quaternion.set(0, 0, 0, 1);\r\n this.scale.set(1, 1, 1);\r\n};\r\n\r\n// update world matrix of this object and all its ancestors\r\nTHREE.Object3D.prototype.updateMatrixWorldRecursive = function () {\r\n if (this.parent != null) {\r\n this.parent.updateMatrixWorldRecursive();\r\n }\r\n this.updateMatrixWorld();\r\n};\r\n// add object to parent, saving objects' world transform\r\nTHREE.Object3D.prototype.addSavingWorldTransform = (function () {\r\n const _worldMatrixInverse = new THREE.Matrix4();\r\n\r\n return function (object) {\r\n if (object instanceof THREE.Object3D) {\r\n _worldMatrixInverse.getInverse(this.matrixWorld);\r\n _worldMatrixInverse.multiply(object.matrixWorld);\r\n object.matrix.copy(_worldMatrixInverse);\r\n object.matrix.decompose(object.position, object.quaternion, object.scale);\r\n this.add(object);\r\n }\r\n };\r\n}());\r\n\r\n// render a tiny transparent quad in the center of the screen\r\nTHREE.WebGLRenderer.prototype.renderDummyQuad = (function () {\r\n const _material = new THREE.MeshBasicMaterial({ transparent: true, opacity: 0.0, depthWrite: false });\r\n\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneBufferGeometry(0.01, 0.01), _material);\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n return function () {\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuad = (function () {\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneBufferGeometry(1.0, 1.0));\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n\r\n return function (material) {\r\n _quad.material = material;\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.isIdentity = (function () {\r\n const identity = new THREE.Matrix4();\r\n return function () {\r\n return identity.equals(this);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.applyToPointsArray = function (array, stride, w) {\r\n if (!array || !stride || stride < 3) {\r\n return array;\r\n }\r\n w = w || 0; // use point as normal by default\r\n const e = this.elements;\r\n for (let i = 0; i < array.length; i += stride) {\r\n const x = array[i];\r\n const y = array[i + 1];\r\n const z = array[i + 2];\r\n\r\n const persp = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\r\n\r\n array[i] = (e[0] * x + e[4] * y + e[8] * z + e[12] * w) * persp;\r\n array[i + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13] * w) * persp;\r\n array[i + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14] * w) * persp;\r\n }\r\n return array;\r\n};\r\n\r\nclass ScreenQuadMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n if (params.uniforms === undefined) {\r\n params.uniforms = {};\r\n }\r\n params.uniforms.srcTex = { type: 't', value: null };\r\n params.vertexShader = vertexScreenQuadShader;\r\n params.transparent = false;\r\n params.depthTest = false;\r\n params.depthWrite = false;\r\n super(params);\r\n }\r\n}\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTex = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { opacity: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTex,\r\n transparent: true,\r\n });\r\n\r\n\r\n return function (srcTex, opacity) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.transparent = (opacity < 1.0);\r\n _material.uniforms.opacity.value = opacity;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { coef: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTexWithDistortion,\r\n });\r\n\r\n\r\n return function (srcTex, coef) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.uniforms.coef.value = coef;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\n/**\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setMinimalFov = function (angle) {\r\n if (this.aspect >= 1.0) {\r\n this.fov = angle;\r\n } else {\r\n this.fov = THREE.Math.radToDeg(2 * Math.atan(Math.tan(THREE.Math.degToRad(angle) * 0.5) / this.aspect));\r\n }\r\n};\r\n\r\n/**\r\n * @param {THREE.PerspectiveCamera} camera - Base camera for this stereo camera.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.StereoCamera.prototype.updateHalfSized = function (camera, angle) {\r\n const originalAspect = camera.aspect;\r\n const originalFov = camera.fov;\r\n\r\n camera.aspect = originalAspect / 2.0;\r\n camera.setMinimalFov(angle);\r\n camera.updateProjectionMatrix();\r\n\r\n this.update(camera);\r\n\r\n camera.aspect = originalAspect;\r\n camera.fov = originalFov;\r\n camera.updateProjectionMatrix();\r\n};\r\n\r\n/**\r\n * @param {number} radius - Radius of bounding sphere in angstroms to fit on screen.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setDistanceToFit = function (radius, angle) {\r\n this.position.z = radius / Math.sin(0.5 * THREE.Math.degToRad(angle));\r\n};\r\n\r\n/**\r\n * @param {RCGroup} gfxObj - All objects on scene.\r\n * @param {THREE.PerspectiveCamera} camera - Camera used for rendering.\r\n * @param {number} clipPlane - Distance to clip plane.\r\n * @param {number} fogFarPlane - Distance to fog far plane.\r\n */\r\nTHREE.Raycaster.prototype.intersectVisibleObject = function (gfxObj, camera, clipPlane, fogFarPlane) {\r\n const intersects = this.intersectObject(gfxObj, false);\r\n if (intersects.length === 0) {\r\n return null;\r\n }\r\n\r\n // find point closest to camera that doesn't get clipped by camera near plane or clipPlane (if it exists)\r\n const nearPlane = Math.min(camera.near, clipPlane);\r\n let i;\r\n let p = intersects[0];\r\n const v = new THREE.Vector3();\r\n for (i = 0; i < intersects.length; ++i) {\r\n p = intersects[i];\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -nearPlane) {\r\n break;\r\n }\r\n }\r\n if (i === intersects.length) {\r\n return null;\r\n }\r\n\r\n // check that selected intersection point is not clipped by camera far plane or occluded by fog (if it exists)\r\n const farPlane = Math.min(camera.far, fogFarPlane);\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -farPlane) {\r\n return null;\r\n }\r\n return p;\r\n};\r\n\r\nTHREE.Matrix4.prototype.extractScale = (function () {\r\n const _v = new THREE.Vector3();\r\n\r\n return function (scale) {\r\n if (scale === undefined) {\r\n logger.debug('extractScale(): new is too expensive operation to do it on-the-fly');\r\n scale = _v.clone();\r\n }\r\n\r\n const te = this.elements;\r\n scale.x = _v.set(te[0], te[1], te[2]).length();\r\n scale.y = _v.set(te[4], te[5], te[6]).length();\r\n scale.z = _v.set(te[8], te[9], te[10]).length();\r\n\r\n // if determine is negative, we need to invert one scale\r\n const det = this.determinant();\r\n if (det < 0) {\r\n scale.x = -scale.x;\r\n }\r\n return scale;\r\n };\r\n}());\r\n\r\nfunction _calcCylinderMatrix(posBegin, posEnd, radius) {\r\n const posCenter = posBegin.clone().lerp(posEnd, 0.5);\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(radius, posBegin.distanceTo(posEnd), radius);\r\n\r\n const matRotHalf = new THREE.Matrix4();\r\n matRotHalf.makeRotationX(Math.PI / 2);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n const vUp = new THREE.Vector3(0, 1, 0);\r\n matRotLook.lookAt(posCenter, posEnd, vUp);\r\n\r\n matRotLook.multiply(matRotHalf);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(posCenter);\r\n return matRotLook;\r\n}\r\n\r\nfunction _calcChunkMatrix(eye, target, up, rad) {\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(rad.x, rad.y, 0);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n matRotLook.lookAt(eye, target, up);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(eye);\r\n\r\n return matRotLook;\r\n}\r\n\r\nfunction _forEachMeshInGroup(group, process) {\r\n function processObj(object) {\r\n if (object instanceof THREE.Mesh) {\r\n process(object);\r\n }\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n processObj(object.children[i]);\r\n }\r\n }\r\n processObj(group);\r\n}\r\n\r\nfunction _countMeshTriangles(mesh) {\r\n const geom = mesh.geometry;\r\n if (geom instanceof THREE.InstancedBufferGeometry) {\r\n const attribs = geom.attributes;\r\n for (const property in attribs) {\r\n if (attribs.hasOwnProperty(property) && attribs[property] instanceof THREE.InstancedBufferAttribute) {\r\n const currAttr = attribs[property];\r\n const indexSize = geom.index ? geom.index.array.length / 3 : 0;\r\n return indexSize * currAttr.array.length / currAttr.itemSize;\r\n }\r\n }\r\n return 0;\r\n }\r\n if (geom instanceof THREE.BufferGeometry) {\r\n return geom.index ? geom.index.array.length / 3 : 0;\r\n }\r\n return geom.faces ? geom.faces.length : 0;\r\n}\r\n\r\nfunction _countTriangles(group) {\r\n let totalCount = 0;\r\n _forEachMeshInGroup(group, (mesh) => {\r\n totalCount += _countMeshTriangles(mesh);\r\n });\r\n return totalCount;\r\n}\r\n\r\nfunction _groupHasGeometryToRender(group) {\r\n let hasGeoms = false;\r\n group.traverse((node) => {\r\n if (node.hasOwnProperty('geometry') || node instanceof CSS2DObject) {\r\n hasGeoms = true;\r\n }\r\n });\r\n return hasGeoms;\r\n}\r\n\r\nfunction _buildDistorionMesh(widthSegments, heightSegements, coef) {\r\n // solve equation r_u = r_d * (1 + k * r_d^2)\r\n // for r_d using iterations\r\n // takes: r_u^2\r\n // returns: r_d / r_u factor that can be used to distort point coords\r\n function calcInverseBarrel(r2) {\r\n const epsilon = 1e-5;\r\n let prevR2 = 0.0;\r\n let curR2 = r2;\r\n let dr = 1.0;\r\n while (Math.abs(curR2 - prevR2) > epsilon) {\r\n dr = 1.0 + coef * curR2;\r\n prevR2 = curR2;\r\n curR2 = r2 / (dr * dr);\r\n }\r\n\r\n return 1.0 / dr;\r\n }\r\n\r\n const geo = new THREE.PlaneBufferGeometry(2.0, 2.0, widthSegments, heightSegements);\r\n\r\n const pos = geo.getAttribute('position');\r\n for (let i = 0; i < pos.count; ++i) {\r\n const x = pos.array[3 * i];\r\n const y = pos.array[3 * i + 1];\r\n const c = calcInverseBarrel(x * x + y * y);\r\n pos.setXY(i, c * x, c * y);\r\n }\r\n\r\n return geo;\r\n}\r\n\r\nTHREE.BufferAttribute.prototype.copyAtList = function (attribute, indexList) {\r\n console.assert(\r\n this.itemSize === attribute.itemSize,\r\n 'DEBUG: BufferAttribute.copyAtList buffers have different item size.',\r\n );\r\n const { itemSize } = this;\r\n for (let i = 0, n = indexList.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n this.array[i * itemSize + j] = attribute.array[indexList[i] * itemSize + j];\r\n }\r\n }\r\n return this;\r\n};\r\n\r\nfunction fillArray(array, value, startIndex, endIndex) {\r\n startIndex = (typeof startIndex !== 'undefined') ? startIndex : 0;\r\n endIndex = (typeof endIndex !== 'undefined') ? endIndex : array.length;\r\n for (let i = startIndex; i < endIndex; ++i) {\r\n array[i] = value;\r\n }\r\n}\r\n\r\n/** @param {THREE.Object3D} object - Parent object. */\r\nfunction removeChildren(object) {\r\n const { children } = object;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n child.parent = null;\r\n child.dispatchEvent({ type: 'removed' });\r\n }\r\n object.children = [];\r\n}\r\n\r\nfunction clearTree(object) {\r\n object.traverse((obj) => {\r\n if (obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line) {\r\n obj.geometry.dispose();\r\n }\r\n });\r\n removeChildren(object);\r\n}\r\n\r\nfunction destroyObject(object) {\r\n clearTree(object);\r\n if (object.parent) {\r\n object.parent.remove(object);\r\n } else {\r\n object.dispatchEvent({ type: 'removed' });\r\n }\r\n}\r\n\r\nfunction belongToSelectLayers(object) {\r\n for (let i = 0; i < SELECTION_LAYERS.length; i++) {\r\n if (((object.layers.mask >> SELECTION_LAYERS[i]) & 1) === 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction _getMeshesArr(root, meshTypes) {\r\n const meshes = [];\r\n root.traverse((object) => {\r\n for (let i = 0; i < meshTypes.length; i++) {\r\n if (object instanceof meshTypes[i]) {\r\n meshes[meshes.length] = object;\r\n break;\r\n }\r\n }\r\n });\r\n return meshes;\r\n}\r\n\r\nfunction applyTransformsToMeshes(root, mtc) {\r\n const mtcCount = mtc.length;\r\n if (mtcCount < 1) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments, THREE.Line]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n const { parent } = mesh;\r\n if (!parent) {\r\n continue;\r\n }\r\n mesh.applyMatrix(mtc[0]);\r\n for (let j = 1; j < mtcCount; ++j) {\r\n const newMesh = new mesh.constructor(mesh.geometry, mesh.material);\r\n parent.add(newMesh);\r\n newMesh.applyMatrix(mtc[j]);\r\n }\r\n }\r\n}\r\n\r\nfunction processTransparentMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n const { parent } = mesh;\r\n if (!parent) {\r\n continue;\r\n }\r\n mesh.material.setValues({ prepassTransparancy: false, fakeOpacity: false });\r\n mesh.material.needsUpdate = true;\r\n mesh.layers.set(LAYERS.TRANSPARENT);\r\n\r\n // copy of geometry with prepass material\r\n const prepassMat = mesh.material.createInstance();\r\n prepassMat.setValues({ prepassTransparancy: true, fakeOpacity: false });\r\n const prepassMesh = new mesh.constructor(mesh.geometry, prepassMat);\r\n _.forEach(['transparent', 'colorFromDepth', 'lights', 'shadowmap', 'fog'],\r\n (value) => {\r\n prepassMesh.material[value] = false;\r\n });\r\n prepassMesh.material.needsUpdate = true;\r\n prepassMesh.applyMatrix(mesh.matrix);\r\n prepassMesh.layers.set(LAYERS.PREPASS_TRANSPARENT);\r\n parent.add(prepassMesh);\r\n }\r\n}\r\n\r\nfunction processColFromPosMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n const { parent } = mesh;\r\n if (!parent) {\r\n continue;\r\n }\r\n\r\n // copy of geometry with colFromPosMat material\r\n const colFromPosMat = mesh.material.createInstance();\r\n colFromPosMat.setValues({ colorFromPos: true });\r\n const colFromPosMesh = new mesh.constructor(mesh.geometry, colFromPosMat);\r\n _.forEach(['transparent', 'colorFromDepth', 'lights', 'shadowmap', 'fog', 'overrideColor', 'fogTransparent',\r\n 'attrColor', 'attrColor2', 'attrAlphaColor', 'fakeOpacity'],\r\n (value) => {\r\n colFromPosMesh.material[value] = false;\r\n });\r\n\r\n colFromPosMesh.material.needsUpdate = true;\r\n colFromPosMesh.applyMatrix(mesh.matrix);\r\n colFromPosMesh.layers.set(LAYERS.COLOR_FROM_POSITION);\r\n parent.add(colFromPosMesh);\r\n }\r\n}\r\n\r\nfunction createShadowmapMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n if (!mesh.receiveShadow && mesh.material.shadowmap) { // remove shadow from non-receivers\r\n mesh.material.setValues({ shadowmap: false });\r\n }\r\n if (!mesh.castShadow) { // skip creating shadowmap meshes for non-casters\r\n continue;\r\n }\r\n\r\n // create special mesh for shadowmap\r\n const { parent } = mesh;\r\n if (!parent) {\r\n continue;\r\n }\r\n\r\n // copy of geometry with shadowmap material\r\n const shadowmapMat = mesh.material.createInstance();\r\n shadowmapMat.setValues({ colorFromDepth: true });\r\n const shadowmapMesh = new mesh.constructor(mesh.geometry, shadowmapMat);\r\n _.forEach(['lights', 'shadowmap', 'fog'],\r\n (value) => {\r\n shadowmapMesh.material[value] = false;\r\n });\r\n shadowmapMesh.isShadowmapMesh = true;\r\n shadowmapMesh.material.needsUpdate = true;\r\n shadowmapMesh.applyMatrix(mesh.matrix);\r\n shadowmapMesh.layers.set(LAYERS.SHADOWMAP);\r\n parent.add(shadowmapMesh);\r\n }\r\n}\r\n\r\nfunction removeShadowmapMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n const meshes = _getMeshesArr(root, [THREE.Mesh, THREE.LineSegments]);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n if (mesh.isShadowmapMesh && mesh.parent) {\r\n mesh.parent.remove(mesh);\r\n }\r\n }\r\n}\r\n\r\nfunction processObjRenderOrder(root, idMaterial) {\r\n // set renderOrder to 0 for Backdrop and to 1 in other cases to render Backdrop earlier all other materials\r\n const renderOrder = +(idMaterial !== 'BA');\r\n root.traverse((object) => {\r\n if (object.isGroup) {\r\n object.renderOrder = renderOrder;\r\n }\r\n });\r\n}\r\n\r\n/** Traverse tree and make visible only needed meshes */\r\nfunction makeVisibleMeshes(object, checker) {\r\n if (object && object.traverse) {\r\n object.traverse((obj) => {\r\n if (obj instanceof THREE.Mesh) {\r\n obj.visible = checker(obj);\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction applySelectionMaterial(geo) {\r\n geo.traverse((node) => {\r\n if ('material' in node) {\r\n node.material = node.material.clone(true);\r\n // using z-offset to magically fix selection rendering artifact (on z-sprites)\r\n node.material.setValues({ depthFunc: THREE.LessEqualDepth, overrideColor: true, fog: false });\r\n node.material.setUberOptions({ fixedColor: new THREE.Color(0xFFFF00), zOffset: -1e-6 });\r\n }\r\n });\r\n}\r\n\r\nfunction getMiddlePoint(point1, point2, optionalTarget) {\r\n const result = optionalTarget || new THREE.Vector3();\r\n\r\n result.set(0, 0, 0);\r\n result.addScaledVector(point1, 0.5);\r\n result.addScaledVector(point2, 0.5);\r\n\r\n return result;\r\n}\r\n\r\n\r\nexport default {\r\n calcCylinderMatrix: _calcCylinderMatrix,\r\n calcChunkMatrix: _calcChunkMatrix,\r\n forEachMeshInGroup: _forEachMeshInGroup,\r\n countTriangles: _countTriangles,\r\n groupHasGeometryToRender: _groupHasGeometryToRender,\r\n buildDistorionMesh: _buildDistorionMesh,\r\n RCGroup,\r\n fillArray,\r\n clearTree,\r\n destroyObject,\r\n belongToSelectLayers,\r\n applyTransformsToMeshes,\r\n processTransparentMaterial,\r\n processColFromPosMaterial,\r\n createShadowmapMaterial,\r\n removeShadowmapMaterial,\r\n processObjRenderOrder,\r\n makeVisibleMeshes,\r\n applySelectionMaterial,\r\n getMiddlePoint,\r\n LAYERS,\r\n};\r\n","import * as THREE from 'three';\r\nimport utils from './utils';\r\nimport gfxutils from './gfx/gfxutils';\r\n\r\nconst _defaultBoundaries = {\r\n boundingBox: new THREE.Box3(new THREE.Vector3(-1, -1, -1), new THREE.Vector3(1, 1, 1)),\r\n boundingSphere: new THREE.Sphere(new THREE.Vector3(0, 0, 0), 1),\r\n};\r\n\r\nfunction Visual(name, dataSource) {\r\n gfxutils.RCGroup.call(this);\r\n\r\n this.name = name;\r\n\r\n this._dataSource = dataSource;\r\n}\r\n\r\nutils.deriveClass(Visual, gfxutils.RCGroup);\r\n\r\nVisual.prototype.release = function () {\r\n if (this.parent) {\r\n this.parent.remove(this);\r\n }\r\n};\r\n\r\nVisual.prototype.getDataSource = function () {\r\n return this._dataSource;\r\n};\r\n\r\nVisual.prototype.getBoundaries = function () {\r\n return _defaultBoundaries;\r\n};\r\n\r\nexport default Visual;\r\n","function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nmodule.exports = _nonIterableSpread;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _ensureArray(x) {\r\n if (x === null || x === undefined || Array.isArray(x)) {\r\n return x;\r\n }\r\n return [x];\r\n}\r\n\r\n/** An indexed list of objects or classes. */\r\nclass EntityList {\r\n /**\r\n * Create a list of objects.\r\n * The objects can be indexed by one or more properties for the later retrieval.\r\n *\r\n * @param {!Array=} entities A list of objects to automatically register at creation time.\r\n * @param {!Array=} indices A list of property names to use for case-insensitive indexing.\r\n * By default, a single `.id` property is used.\r\n * @see EntityList#register\r\n */\r\n constructor(entities = [], indices = ['id']) {\r\n this._list = [];\r\n this._dict = {};\r\n this._indices = [...indices];\r\n this._indices.forEach((index) => {\r\n this._dict[index] = {};\r\n });\r\n\r\n entities.forEach((entity) => this.register(entity));\r\n }\r\n\r\n /**\r\n * Add a value to the end of a list.\r\n * The list will contain only one copy of the value.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromList\r\n * @see EntityList.registerInDict\r\n */\r\n static registerInList(list, value) {\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a value from a list if it is there.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to remove.\r\n * @see EntityList.registerInList\r\n */\r\n static unregisterFromList(list, value) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Add a value to a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromDict\r\n * @see EntityList.registerInList\r\n */\r\n static registerInDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key] = dict[key] || [];\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Remove a value from a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.registerInDict\r\n */\r\n static unregisterFromDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key];\r\n if (list) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n if (list.length === 0) {\r\n delete dict[key];\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Add an entity to this list.\r\n *\r\n * @param {!Object} entity An object or a class to register. The object must include all\r\n * properties specified as indices on construction.\r\n * @see EntityList#unregister\r\n */\r\n register(entity) {\r\n EntityList.registerInList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.registerInDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * Remove an entity from this list.\r\n *\r\n * @param {!Object} entity An object or a class to unregister. The object may be\r\n * missing from the list but it must include all properties specified as indices\r\n * on construction.\r\n * @see EntityList#register\r\n */\r\n unregister(entity) {\r\n EntityList.unregisterFromList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.unregisterFromDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * An ordered list of all registered entities.\r\n * It is a read-only copy, use {@link EntityList#register} and {@link EntityList#unregister}\r\n * to modify it.\r\n *\r\n * @type {!Array}\r\n */\r\n get all() {\r\n return [...this._list];\r\n }\r\n\r\n /**\r\n * The first registered entity.\r\n * Use it if you do not care which entity you are referring to.\r\n *\r\n * @type {Object=}\r\n */\r\n get first() {\r\n return this._list[0];\r\n }\r\n\r\n /**\r\n * Retrieve a list of keys for the index.\r\n *\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {!Array} An unordered list of keys in the index, i.e. particular property\r\n * values for all registered entities.\r\n */\r\n keys(index) {\r\n return Object.keys(this._dict[index || this._indices[0]]);\r\n }\r\n\r\n /**\r\n * Retrieve an entity by its key.\r\n *\r\n * @param {string} key A case-insensitive property value to look-up.\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {Object=} An object registered in the index under the key. If there are multiple\r\n * objects under the same key, the first one is returned.\r\n */\r\n get(key, index) {\r\n const dict = this._dict[index || this._indices[0]];\r\n if (dict) {\r\n const values = dict[key && key.toLowerCase()];\r\n return values && values.length > 0 ? values[0] : undefined;\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nexport default EntityList;\r\n","import settings from '../settings';\r\nimport logger from './logger';\r\n\r\nfunction makeContextDependent(prototype) {\r\n Object.defineProperties(prototype, {\r\n logger: {\r\n get() {\r\n return this.context && this.context.logger ? this.context.logger : logger;\r\n },\r\n },\r\n settings: {\r\n get() {\r\n return this.context && this.context.settings ? this.context.settings : settings;\r\n },\r\n },\r\n });\r\n}\r\n\r\nexport default makeContextDependent;\r\n","import * as THREE from 'three';\r\n\r\nclass CollisionSphere {\r\n constructor(position, radius) {\r\n this._position = position;\r\n this._radius = radius;\r\n }\r\n\r\n static _sphere = new THREE.Sphere();\r\n\r\n raycast(raycaster) {\r\n const sphere = CollisionSphere._sphere;\r\n sphere.set(this._position, this._radius);\r\n\r\n const p = new THREE.Vector3();\r\n if (raycaster.ray.intersectSphere(sphere, p)) {\r\n return {\r\n distance: raycaster.ray.origin.distanceTo(p),\r\n point: p,\r\n };\r\n }\r\n return null;\r\n }\r\n}\r\n\r\nconst SphereCollisionGeo = (base) => class extends base {\r\n constructor(count, ...args) {\r\n super(...args);\r\n this._objects = new Array(count);\r\n this.boundingSphere = null;\r\n this.boundingBox = null;\r\n }\r\n\r\n setSphere(idx, position, radius) {\r\n this._objects[idx] = new CollisionSphere(position, radius);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n // TODO raycast with bounding sphere? How to deal with updates?\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const inters = this._objects[i].raycast(raycaster);\r\n if (inters) {\r\n inters.chunkIdx = i;\r\n intersects.push(inters);\r\n }\r\n }\r\n }\r\n\r\n computeBoundingBox() {\r\n const objects = this._objects;\r\n let { boundingBox } = this;\r\n if (boundingBox === null) {\r\n this.boundingBox = boundingBox = new THREE.Box3();\r\n }\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n boundingBox.expandByPoint(objects[i]._position);\r\n }\r\n }\r\n\r\n computeBoundingSphere() {\r\n this.computeBoundingBox();\r\n const objects = this._objects;\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n const pos = objects[i]._position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n if (this.boundingSphere === null) {\r\n this.boundingSphere = new THREE.Sphere();\r\n }\r\n this.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n};\r\nexport default SphereCollisionGeo;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst tmpColor = new THREE.Color();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\nclass InstancedSpheresGeometry extends SphereCollisionGeo(THREE.InstancedBufferGeometry) {\r\n constructor(spheresCount, sphereComplexity, useZSprites) {\r\n super(spheresCount);\r\n this._sphGeometry = useZSprites ? new THREE.PlaneBufferGeometry(2, 2, 1, 1)\r\n : new THREE.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI);\r\n this._init(spheresCount, this._sphGeometry);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n setArrayXYZW(this._offsets, itemIdx * OFFSET_SIZE, itemPos.x, itemPos.y, itemPos.z, itemRad);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n\r\n setColor(itemIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n setArrayXYZ(this._colors, itemIdx * COLOR_SIZE, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('offset').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[chunkIndices[i]] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._sphGeometry);\r\n\r\n copySubArrays(this._offsets, geom._offsets, chunkIndices, OFFSET_SIZE);\r\n copySubArrays(this._colors, geom._colors, chunkIndices, COLOR_SIZE);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(spheresCount, sphereGeo) {\r\n this.copy(sphereGeo);\r\n\r\n this._offsets = utils.allocateTyped(Float32Array, spheresCount * OFFSET_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, spheresCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('offset', new THREE.InstancedBufferAttribute(this._offsets, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._colors, COLOR_SIZE, false, 1));\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(alpha, 1, false, 1));\r\n }\r\n}\r\nexport default InstancedSpheresGeometry;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * This class adds raycasting interface to indexed\r\n * THREE.BufferGeometry.\r\n * @constructor\r\n */\r\n\r\nclass RaycastableBufferGeometry extends THREE.BufferGeometry {\r\n // This method was copied from three.js\r\n\r\n static _vA = new THREE.Vector3();\r\n\r\n static _vB = new THREE.Vector3();\r\n\r\n static _vC = new THREE.Vector3();\r\n\r\n\r\n static _uvA = new THREE.Vector2();\r\n\r\n static _uvB = new THREE.Vector2();\r\n\r\n static _uvC = new THREE.Vector2();\r\n\r\n\r\n static _barycoord = new THREE.Vector3();\r\n\r\n\r\n static _intersectionPoint = new THREE.Vector3();\r\n\r\n uvIntersection(point, p1, p2, p3, uv1, uv2, uv3) {\r\n const barycoord = RaycastableBufferGeometry._barycoord;\r\n THREE.Triangle.barycoordFromPoint(point, p1, p2, p3, barycoord);\r\n\r\n uv1.multiplyScalar(barycoord.x);\r\n uv2.multiplyScalar(barycoord.y);\r\n uv3.multiplyScalar(barycoord.z);\r\n\r\n uv1.add(uv2).add(uv3);\r\n return uv1.clone();\r\n }\r\n\r\n checkIntersection(object, raycaster, ray, pA, pB, pC, point) {\r\n const intersect = ray.intersectTriangle(pA, pB, pC, false, point);\r\n\r\n if (intersect === null) {\r\n return null;\r\n }\r\n\r\n return {\r\n point: point.clone(),\r\n };\r\n }\r\n\r\n checkBufferGeometryIntersection(object, raycaster, ray, position, uv, a, b, c) {\r\n const vA = RaycastableBufferGeometry._vA;\r\n const vB = RaycastableBufferGeometry._vB;\r\n const vC = RaycastableBufferGeometry._vC;\r\n const intersectionPoint = RaycastableBufferGeometry._intersectionPoint;\r\n\r\n vA.fromBufferAttribute(position, a);\r\n vB.fromBufferAttribute(position, b);\r\n vC.fromBufferAttribute(position, c);\r\n\r\n const intersection = this.checkIntersection(\r\n object, raycaster, ray, vA, vB, vC, intersectionPoint,\r\n );\r\n if (intersection) {\r\n if (uv) {\r\n const uvA = RaycastableBufferGeometry._uvA;\r\n const uvB = RaycastableBufferGeometry._uvB;\r\n const uvC = RaycastableBufferGeometry._uvC;\r\n\r\n uvA.fromBufferAttribute(uv, a);\r\n uvB.fromBufferAttribute(uv, b);\r\n uvC.fromBufferAttribute(uv, c);\r\n intersection.uv = this.uvIntersection(\r\n intersectionPoint, vA, vB, vC, uvA, uvB, uvC,\r\n );\r\n }\r\n const normal = new THREE.Vector3();\r\n THREE.Triangle.getNormal(vA, vB, vC, normal);\r\n intersection.face = new THREE.Face3(a, b, c, normal);\r\n intersection.faceIndex = a;\r\n }\r\n\r\n return intersection;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const { ray } = raycaster;\r\n if (this.boundingSphere === null) {\r\n this.computeBoundingSphere();\r\n }\r\n\r\n if (raycaster.ray.intersectsSphere(this.boundingSphere) === false) {\r\n return;\r\n }\r\n\r\n if (this.boundingBox !== null) {\r\n if (ray.intersectsBox(this.boundingBox) === false) {\r\n return;\r\n }\r\n }\r\n\r\n let a;\r\n let b;\r\n let c;\r\n const {\r\n index,\r\n attributes: { position, uv },\r\n } = this;\r\n\r\n if (index === null) {\r\n return;\r\n }\r\n // indexed buffer geometry\r\n for (let i = 0, l = index.count; i < l; i += 3) {\r\n a = index.getX(i);\r\n b = index.getX(i + 1);\r\n c = index.getX(i + 2);\r\n\r\n const intersection = this.checkBufferGeometryIntersection(this, raycaster, ray, position, uv, a, b, c);\r\n\r\n if (intersection) {\r\n intersection.faceIndex = Math.floor(i / 3); // triangle number in indices buffer semantics\r\n intersects.push(intersection);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default RaycastableBufferGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport RaycastableBufferGeometry from './RaycastableBufferGeometry';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VEC_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n */\r\n\r\nclass ChunkedObjectsGeometry extends RaycastableBufferGeometry {\r\n constructor(chunkGeo, chunksCount) {\r\n super();\r\n\r\n if (this.constructor === ChunkedObjectsGeometry) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n\r\n this._chunkGeo = chunkGeo;\r\n\r\n this._init(chunkGeo, chunksCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('normal').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n const idx = i * VEC_SIZE;\r\n colors[idx] = tmpColor.r;\r\n colors[idx + 1] = tmpColor.g;\r\n colors[idx + 2] = tmpColor.b;\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n _.fill(alphaArr, value, left, left + chunkSize);\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n super.raycast(raycaster, inters);\r\n const facesPerChunk = this._chunkGeo.index.count / 3;\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('faceIndex')) {\r\n continue;\r\n }\r\n inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk);\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.BufferGeometry();\r\n this._init.call(geom, this._chunkGeo, instanceCount);\r\n\r\n const srcPos = this._positions;\r\n const srcNorm = this._normals;\r\n const srcColor = this._colors;\r\n\r\n const dstPos = geom._positions;\r\n const dstNorm = geom._normals;\r\n const dstColor = geom._colors;\r\n\r\n const chunkSize = this._chunkSize * VEC_SIZE;\r\n\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const ptIdxBegin = chunkIndices[i] * chunkSize;\r\n const ptIdxEnd = ptIdxBegin + chunkSize;\r\n dstPos.set(srcPos.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstNorm.set(srcNorm.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstColor.set(srcColor.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n }\r\n\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(chunkGeo, chunksCount) {\r\n const chunkSize = this._chunkSize = chunkGeo.attributes.position.count;\r\n const chunkIndex = chunkGeo.index.array;\r\n const chunkIndexSize = chunkIndex.length;\r\n const pointsCount = this._chunkSize * chunksCount;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n const indexSize = chunkIndexSize * chunksCount;\r\n const index = this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, indexSize);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._normals = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n for (let i = 0; i < chunksCount; ++i) {\r\n const offset = i * chunkIndexSize;\r\n const posOffset = i * chunkSize;\r\n index.set(chunkIndex, offset);\r\n for (let j = 0; j < chunkIndexSize; ++j) {\r\n index[offset + j] += posOffset;\r\n }\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, VEC_SIZE));\r\n this.setAttribute('normal', new THREE.BufferAttribute(this._normals, VEC_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, VEC_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n }\r\n}\r\nexport default ChunkedObjectsGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst VEC_SIZE = 3;\r\n\r\nclass SimpleSpheresGeometry extends SphereCollisionGeo(ChunkedObjectsGeometry) {\r\n constructor(spheresCount, sphereComplexity) {\r\n const sphGeometry = new THREE.SphereBufferGeometry(\r\n 1, sphereComplexity * 2, sphereComplexity,\r\n 0, Math.PI * 2, 0, Math.PI,\r\n );\r\n super(spheresCount, sphGeometry, spheresCount);\r\n\r\n const normals = this._normals;\r\n const geoNormals = sphGeometry.attributes.normal.array;\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._tmpPositions = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n for (let i = 0; i < spheresCount; ++i) {\r\n normals.set(geoNormals, chunkSize * VEC_SIZE * i);\r\n }\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n const tmpPos = this._tmpPositions;\r\n const chunkSize = this._chunkSize;\r\n const geoPos = this._chunkPos;\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n const idx = i * 3;\r\n tmpPos[idx] = itemPos.x + geoPos[idx] * itemRad;\r\n tmpPos[idx + 1] = itemPos.y + geoPos[idx + 1] * itemRad;\r\n tmpPos[idx + 2] = itemPos.z + geoPos[idx + 2] * itemRad;\r\n }\r\n\r\n this._positions.set(tmpPos, chunkSize * itemIdx * VEC_SIZE);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n}\r\nexport default SimpleSpheresGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst centerPos = new THREE.Vector3();\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\n\r\nclass Simple2CCylindersGeometry extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, 2 * instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const firstOffset = chunkSize * 2 * itemIdx * VEC_SIZE;\r\n const secondOffset = firstOffset + chunkSize * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n centerPos.lerpVectors(botPos, topPos, 0.5);\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, centerPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, firstOffset);\r\n\r\n // now shift center to get another part of the cylinder\r\n centerPos.sub(botPos);\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpArray[idx] += centerPos.x;\r\n tmpArray[idx + 1] += centerPos.y;\r\n tmpArray[idx + 2] += centerPos.z;\r\n }\r\n this._positions.set(tmpArray, secondOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, firstOffset);\r\n this._normals.set(tmpArray, secondOffset);\r\n }\r\n\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const first = 2 * itemIdx;\r\n super.setColor(first, colorVal1);\r\n\r\n const second = first + 1;\r\n super.setColor(second, colorVal2);\r\n }\r\n}\r\n\r\nexport default Simple2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_POINTS_COUNT_16BIT = 65536;\r\nconst PTS_PER_TRIANGLE = 3;\r\n\r\nclass CylinderBufferGeometry extends THREE.BufferGeometry {\r\n constructor(\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n ) {\r\n super();\r\n\r\n const thetaStart = 0;\r\n const thetaLength = 2 * Math.PI;\r\n\r\n\r\n this.type = 'CylinderBufferGeometry';\r\n\r\n this.parameters = {\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n };\r\n\r\n const hasTop = openEnded === false && radiusTop > 0;\r\n const hasBottom = openEnded === false && radiusBottom > 0;\r\n const vertexCount = (heightSegments + 1) * radialSegments\r\n + hasTop * (radialSegments + 1)\r\n + hasBottom * (radialSegments + 1);\r\n const facesCount = (2 * heightSegments + hasTop + hasBottom) * radialSegments;\r\n\r\n const heightHalf = height / 2;\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const positions = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const normals = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const indices = new THREE.Uint16BufferAttribute(utils.allocateTyped(Uint16Array, facesCount * PTS_PER_TRIANGLE), 1);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const uvs = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 2), 2);\r\n console.assert(vertexCount < MAX_POINTS_COUNT_16BIT, 'DEBUG: Cylinder Geometry has too many vertices (65536 max).');\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n const tanTheta = -(radiusBottom - radiusTop) / height;\r\n\r\n // setup cylinder data\r\n for (let y = 0; y <= heightSegments; y++) {\r\n // faces\r\n if (y !== heightSegments) {\r\n for (let i = 0; i < radialSegments; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + radialSegments + i;\r\n const v3 = currVtxIdx + radialSegments + ((i + 1) % radialSegments);\r\n const v4 = currVtxIdx + ((i + 1) % radialSegments);\r\n\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n // vertices\r\n const v = y / heightSegments;\r\n const radius = v * (radiusBottom - radiusTop) + radiusTop;\r\n\r\n for (let x = 0; x < radialSegments; x++) {\r\n const u = x / radialSegments;\r\n\r\n const vx = radius * Math.sin(u * thetaLength + thetaStart);\r\n const vy = v * height - heightHalf;\r\n const vz = radius * Math.cos(u * thetaLength + thetaStart);\r\n\r\n const normal = new THREE.Vector3(\r\n vx,\r\n Math.sqrt(vx * vx + vz * vz) * tanTheta,\r\n vz,\r\n ).normalize();\r\n\r\n positions.setXYZ(currVtxIdx, vx, vy, vz);\r\n normals.setXYZ(currVtxIdx, normal.x, normal.y, normal.z);\r\n uvs.setXY(currVtxIdx, u, v);\r\n ++currVtxIdx;\r\n }\r\n }\r\n\r\n // top cap\r\n if (hasTop) {\r\n const startTIdx = currVtxIdx;\r\n const lastIdx = currVtxIdx + radialSegments;\r\n for (let fTIdx = 0; fTIdx < radialSegments; ++fTIdx) {\r\n const currSrcIdx = currVtxIdx - radialSegments;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcIdx),\r\n positions.getY(currSrcIdx),\r\n positions.getZ(currSrcIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n\r\n\r\n const nextTVtx = startTIdx + ((fTIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, currVtxIdx, nextTVtx, lastIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n ++currVtxIdx;\r\n }\r\n\r\n // bottom cap\r\n if (hasBottom) {\r\n const startBIdx = currVtxIdx;\r\n const lastBIdx = currVtxIdx + radialSegments;\r\n for (let fBIdx = 0; fBIdx < radialSegments; ++fBIdx) {\r\n const currSrcBIdx = fBIdx;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcBIdx), positions.getY(currSrcBIdx), positions.getZ(currSrcBIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n\r\n\r\n const nextBVtx = startBIdx + ((fBIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, nextBVtx, currVtxIdx, lastBIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, -heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n }\r\n\r\n this.setIndex(indices);\r\n this.setAttribute('position', positions);\r\n this.setAttribute('normal', normals);\r\n this.setAttribute('uv', uvs);\r\n }\r\n\r\n clone() {\r\n const { parameters } = this;\r\n\r\n return new CylinderBufferGeometry(\r\n parameters.radiusTop,\r\n parameters.radiusBottom,\r\n parameters.height,\r\n parameters.radialSegments,\r\n parameters.heightSegments,\r\n parameters.openEnded,\r\n );\r\n }\r\n}\r\n\r\nexport default CylinderBufferGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport CylinderBufferGeometry from './CylinderBufferGeometry';\r\n\r\nconst tmpColor = new THREE.Color();\r\nconst invMatrix = new THREE.Matrix4();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction sortNumber(a, b) {\r\n return a - b;\r\n}\r\n\r\nfunction _prepareCylinderInfo(chunkIndices) {\r\n chunkIndices.sort(sortNumber);\r\n const chunksIdx = [];\r\n const cylinderInfo = [];\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const val = chunkIndices[i];\r\n const even = (val | 0) % 2 === 0;\r\n const newPar = {\r\n first: false,\r\n second: false,\r\n };\r\n if (even) {\r\n newPar.first = true;\r\n newPar.second = i + 1 < n && chunkIndices[i + 1] === chunkIndices[i] + 1;\r\n if (newPar.second) {\r\n ++i;\r\n }\r\n } else {\r\n newPar.second = true;\r\n }\r\n chunksIdx.push(Math.floor(val / 2));\r\n cylinderInfo.push(newPar);\r\n }\r\n return { indices: chunksIdx, cylinderInfo };\r\n}\r\n\r\nfunction _assignOpacity(cylinderInfo, color1, color2) {\r\n for (let i = 0, n = cylinderInfo.length; i < n; ++i) {\r\n const info = cylinderInfo[i];\r\n if (!info.first) {\r\n color1[COLOR_SIZE * i] = -0.5;\r\n }\r\n if (!info.second) {\r\n color2[COLOR_SIZE * i] = -0.5;\r\n }\r\n }\r\n}\r\nclass Instanced2CCylindersGeometry extends THREE.InstancedBufferGeometry {\r\n constructor(instanceCount, polyComplexity, useZSprites, openEnded) {\r\n super();\r\n this._useZSprites = useZSprites;\r\n this._cylGeometry = useZSprites ? new THREE.PlaneBufferGeometry(2, 2, 1, 1)\r\n : new CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, openEnded);\r\n this._init(instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n this._collisionGeo = new Simple2CCylindersGeometry(instanceCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const matrix = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n let me = matrix.elements;\r\n const mtxOffset = itemIdx * OFFSET_SIZE;\r\n\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, itemRad);\r\n setArrayXYZW(this._matVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._matVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._matVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n\r\n if (this._useZSprites) {\r\n invMatrix.getInverse(matrix);\r\n me = invMatrix.elements;\r\n setArrayXYZW(this._invmatVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._invmatVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._invmatVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n }\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const colorIdx = itemIdx * COLOR_SIZE;\r\n tmpColor.set(colorVal1);\r\n setArrayXYZ(this._color1, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n tmpColor.set(colorVal2);\r\n setArrayXYZ(this._color2, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n computeBoundingSphere() {\r\n this._collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = this._collisionGeo.boundingSphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n this._collisionGeo.computeBoundingBox();\r\n this.boundingBox = this._collisionGeo.boundingBox;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('matVector1').needsUpdate = true;\r\n this.getAttribute('matVector2').needsUpdate = true;\r\n this.getAttribute('matVector3').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('color2').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n if (this._useZSprites) {\r\n this.getAttribute('invmatVector1').needsUpdate = true;\r\n this.getAttribute('invmatVector2').needsUpdate = true;\r\n this.getAttribute('invmatVector3').needsUpdate = true;\r\n }\r\n\r\n this._collisionGeo.finishUpdate();\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[Math.floor(chunkIndices[i] / 2)] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const info = _prepareCylinderInfo(chunkIndices);\r\n const cylinderIndices = info.indices;\r\n const instanceCount = cylinderIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n copySubArrays(this._matVector1, geom._matVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector2, geom._matVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector3, geom._matVector3, cylinderIndices, OFFSET_SIZE);\r\n\r\n if (this._useZSprites) {\r\n copySubArrays(this._invmatVector1, geom._invmatVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector2, geom._invmatVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector3, geom._invmatVector3, cylinderIndices, OFFSET_SIZE);\r\n }\r\n\r\n copySubArrays(this._color1, geom._color1, cylinderIndices, COLOR_SIZE);\r\n copySubArrays(this._color2, geom._color2, cylinderIndices, COLOR_SIZE);\r\n _assignOpacity(info.cylinderInfo, geom._color1, geom._color2);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n getGeoParams() {\r\n return this._cylGeometry.parameters;\r\n }\r\n\r\n _init(instanceCount, cylinderGeo, useZSprites) {\r\n this.copy(cylinderGeo);\r\n this._matVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._color1 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n this._color2 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, instanceCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('matVector1', new THREE.InstancedBufferAttribute(this._matVector1, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector2', new THREE.InstancedBufferAttribute(this._matVector2, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector3', new THREE.InstancedBufferAttribute(this._matVector3, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._color1, COLOR_SIZE, false, 1));\r\n this.setAttribute('color2', new THREE.InstancedBufferAttribute(this._color2, COLOR_SIZE, false, 1));\r\n\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(this._alpha, 1, false, 1));\r\n\r\n if (useZSprites) {\r\n this._invmatVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n\r\n this.setAttribute(\r\n 'invmatVector1',\r\n new THREE.InstancedBufferAttribute(this._invmatVector1, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector2',\r\n new THREE.InstancedBufferAttribute(this._invmatVector2, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector3',\r\n new THREE.InstancedBufferAttribute(this._invmatVector3, OFFSET_SIZE, false, 1),\r\n );\r\n }\r\n }\r\n}\r\n\r\nexport default Instanced2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst TRI_SIZE = 3;\r\nconst tmpPrev = new THREE.Vector3();\r\nconst tmpNext = new THREE.Vector3();\r\nconst tmpRes = new THREE.Vector3();\r\nconst simpleNormal = new THREE.Vector3(1.0, 0.0, 0.0);\r\nconst normalOnCut = new THREE.Vector3();\r\nconst nearRingPt = new THREE.Vector3();\r\n\r\nfunction _createExtrudedChunkGeometry(shape, ringsCount) {\r\n const geo = new THREE.BufferGeometry();\r\n const ptsCount = shape.length;\r\n const totalPts = ptsCount * ringsCount;\r\n const type = totalPts <= 65536 ? Uint16Array : Uint32Array;\r\n const facesPerChunk = (ringsCount - 1) * ptsCount * 2;\r\n const indices = new THREE.BufferAttribute(utils.allocateTyped(type, facesPerChunk * TRI_SIZE), 1);\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n for (let y = 0; y < ringsCount; y++) {\r\n // faces\r\n if (y !== ringsCount - 1) {\r\n for (let i = 0; i < ptsCount; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + ptsCount + i;\r\n const v3 = currVtxIdx + ptsCount + ((i + 1) % ptsCount);\r\n const v4 = currVtxIdx + ((i + 1) % ptsCount);\r\n\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n currVtxIdx += ptsCount;\r\n }\r\n\r\n geo.setIndex(indices);\r\n const pos = utils.allocateTyped(Float32Array, totalPts * VEC_SIZE);\r\n geo.setAttribute('position', new THREE.BufferAttribute(pos, VEC_SIZE));\r\n\r\n geo._positions = shape;\r\n\r\n return geo;\r\n}\r\n\r\nclass ExtrudedObjectsGeometry extends ChunkedObjectsGeometry {\r\n constructor(shape, ringsCount, chunksCount) {\r\n const chunkGeo = _createExtrudedChunkGeometry(shape, ringsCount);\r\n super(chunkGeo, chunksCount);\r\n this._ringsCount = ringsCount;\r\n\r\n const tmpShape = this._tmpShape = [];\r\n for (let i = 0; i < shape.length; ++i) {\r\n tmpShape[i] = new THREE.Vector3();\r\n }\r\n }\r\n\r\n setItem(itemIdx, matrices, hasSlope = false, hasCut = false) {\r\n const ptsCount = this._chunkGeo._positions.length;\r\n const ringsCount = this._ringsCount;\r\n const chunkStartIdx = ptsCount * this._ringsCount * itemIdx * VEC_SIZE;\r\n\r\n this._setPoints(matrices, ptsCount, ringsCount, chunkStartIdx);\r\n\r\n if (hasSlope) {\r\n this._setSlopeNormals(ptsCount, ringsCount, chunkStartIdx);\r\n } else {\r\n this._setBaseNormals(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n\r\n if (hasCut) {\r\n this._addCut(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n }\r\n\r\n _setPoints(matrices, ptsCount, ringsCount, chunkStartIdx) {\r\n const tmpShape = this._tmpShape;\r\n const positions = this._positions;\r\n const shape = this._chunkGeo._positions;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i) {\r\n const mtx = matrices[i];\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpShape[j].copy(shape[j]).applyMatrix4(mtx).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _setBaseNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, false);\r\n }\r\n }\r\n\r\n _setSlopeNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const normals = this._normals;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First ring\r\n // In all cases, besides cut, second ring is coincident to first. So values of first ring's normals doesn't\r\n // matter (In the cut case special handler will be applied later and will set them to correct values)\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n simpleNormal.toArray(normals, vtxIdx);\r\n }\r\n // second ring\r\n // If it isn't first Item we take normals' values from the last ring of the previous item (these rings are coincident)\r\n // else we count normals' values based on next ring information\r\n if (vtxIdx - 2 * nPtsInRing > 0) {\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(normals, vtxIdx - 2 * nPtsInRing).toArray(normals, vtxIdx);\r\n }\r\n } else {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, +nPtsInRing);\r\n vtxIdx += nPtsInRing;\r\n }\r\n // other rings\r\n // we count normals' values based on previous ring information\r\n for (let i = 2; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, -nPtsInRing);\r\n }\r\n }\r\n\r\n // Counting normals:\r\n // - Slope\r\n // Radius changes throught part => normals aren't parallel with the plane contains section points\r\n // normal = vTangentInSectionPlane x vToSuchPointInPrevSection (all vectors are scaled for being 1 in length)\r\n // - No slope\r\n // Radius doesn't change throught part => normals are parallel with the plane contains section points\r\n // normal = vToPrevPointInSection + vToNextPointInSection (all vectors are scaled for being 1 in length)\r\n _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) {\r\n const tmpShape = this._tmpShape;\r\n const normals = this._normals;\r\n\r\n tmpShape[0].fromArray(this._positions, vtxIdx);\r\n tmpShape[ptsCount - 1].fromArray(this._positions, vtxIdx + (ptsCount - 1) * VEC_SIZE);\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n if (j < ptsCount - 1) {\r\n tmpShape[j + 1].fromArray(this._positions, vtxIdx + VEC_SIZE);\r\n }\r\n\r\n if (isSlope) {\r\n nearRingPt.fromArray(this._positions, vtxIdx + shiftToExtraPt);\r\n\r\n tmpPrev.subVectors(tmpShape[(j + ptsCount - 1) % ptsCount], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], nearRingPt).normalize();\r\n tmpRes.crossVectors(tmpNext, tmpPrev).normalize().toArray(normals, vtxIdx);\r\n } else {\r\n tmpPrev.subVectors(tmpShape[j], tmpShape[(j + ptsCount - 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpRes.addVectors(tmpPrev, tmpNext).normalize().toArray(normals, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _addCut(ptsCount, ringsCount, chunkStartIdx) {\r\n // Nothing to do if item is flat or only line\r\n if (ptsCount < 3 || ringsCount < 2) {\r\n return;\r\n }\r\n const positions = this._positions;\r\n const normals = this._normals;\r\n const tmpShape = this._tmpShape;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n // Normal to the cut plane is equal to cross product of two vectors which are lying in it\r\n tmpShape[0].fromArray(positions, chunkStartIdx);\r\n tmpShape[1].fromArray(positions, chunkStartIdx + VEC_SIZE);\r\n tmpShape[2].fromArray(positions, chunkStartIdx + 2 * VEC_SIZE);\r\n\r\n tmpPrev.subVectors(tmpShape[1], tmpShape[0]).normalize();\r\n tmpNext.subVectors(tmpShape[1], tmpShape[2]).normalize();\r\n normalOnCut.crossVectors(tmpPrev, tmpNext).normalize();\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First and second rings normals' values are equal to value of normal to the cutting plane\r\n for (let j = 0; j < ptsCount * 2; ++j, vtxIdx += VEC_SIZE) {\r\n normalOnCut.toArray(normals, vtxIdx);\r\n }\r\n if (ringsCount > 2) {\r\n // Third ring points are coincident to first ring points, but have different normals. It makes sharp angle near cut\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(positions, vtxIdx - nPtsInRing).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default ExtrudedObjectsGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VERTEX_PER_SEGMENT = 4;\r\nconst POS_SIZE = 4;\r\nconst DIR_SIZE = 3;\r\nconst COL_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\nconst direction = new THREE.Vector3();\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction getSubset(arr, startSegmentIdx, segmentsCount, elemSize) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT;\r\n const end = start + segmentsCount * VERTEX_PER_SEGMENT;\r\n return arr.subarray(start * elemSize, end * elemSize);\r\n}\r\n\r\n/**\r\n * This class represents lines geometry which consists of screen-aligned narrow quad of variable width.\r\n *\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * collision geometry.\r\n */\r\n\r\nclass ThickLinesGeometry extends THREE.BufferGeometry {\r\n constructor(segmentsCount) {\r\n super();\r\n this._initVertices(segmentsCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n this.getAttribute('direction').needsUpdate = true;\r\n }\r\n\r\n setColor(segmentIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n setSegment(segmentIdx, pos1, pos2) {\r\n direction.subVectors(pos1, pos2);\r\n direction.normalize();\r\n const positions = this._positions;\r\n const directions = this._directions;\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n let dirIdx = segmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n }\r\n\r\n setOpacity(startSegIdx, endSegIdx, value) {\r\n const start = startSegIdx * VERTEX_PER_SEGMENT;\r\n const end = endSegIdx * VERTEX_PER_SEGMENT;\r\n _.fill(this.alpha, value, end, start);\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubsetSegments(startSegmentIdx, segmentsCount) {\r\n return [\r\n getSubset(this._positions, startSegmentIdx, segmentsCount, POS_SIZE),\r\n getSubset(this._directions, startSegmentIdx, segmentsCount, DIR_SIZE),\r\n ];\r\n }\r\n\r\n getSubsetColors(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._colors, startSegmentIdx, segmentsCount, COL_SIZE);\r\n }\r\n\r\n getSubsetOpacities(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._alpha, startSegmentIdx, segmentsCount, 1);\r\n }\r\n\r\n getNumVertexPerSegment() {\r\n return VERTEX_PER_SEGMENT;\r\n }\r\n\r\n getPositionSize() {\r\n return POS_SIZE;\r\n }\r\n\r\n setSegments(startSegmentIdx, positions) {\r\n const startPos = startSegmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n if (positions instanceof Array && positions.length === 2) {\r\n this._positions.set(positions[0], startPos);\r\n const startDir = startSegmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n this._directions.set(positions[1], startDir); // dirs are geo part of vertex\r\n } else {\r\n this._positions.set(positions, startPos);\r\n }\r\n }\r\n\r\n setColors(startSegmentIdx, colors) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n this._colors.set(colors, start);\r\n }\r\n\r\n _initVertices(segmentsCount) {\r\n this._buffersSize = segmentsCount * VERTEX_PER_SEGMENT;\r\n const pointsCount = this._buffersSize;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, segmentsCount * 6);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * POS_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * COL_SIZE);\r\n this._directions = utils.allocateTyped(Float32Array, pointsCount * DIR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n const index = this._index;\r\n let indexOffset = 0;\r\n let pointOffset = 0;\r\n for (let j = 0; j < segmentsCount; j++, indexOffset += 6, pointOffset += VERTEX_PER_SEGMENT) {\r\n index[indexOffset] = pointOffset;\r\n index[indexOffset + 1] = pointOffset + 1;\r\n index[indexOffset + 2] = pointOffset + 3;\r\n index[indexOffset + 3] = pointOffset;\r\n index[indexOffset + 4] = pointOffset + 2;\r\n index[indexOffset + 5] = pointOffset + 3;\r\n }\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, POS_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, COL_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n this.setAttribute('direction', new THREE.BufferAttribute(this._directions, DIR_SIZE));\r\n }\r\n}\r\n\r\n\r\nexport default ThickLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport BaseLinesGeometry from './ThickLinesGeometry';\r\n\r\n/**\r\n * This class represents geometry which consists lines. This can build bounding volumes\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n */\r\nclass LinesGeometry extends BaseLinesGeometry {\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n if (boundingBox) {\r\n boundingBox.getCenter(center);\r\n }\r\n const positions = this._positions;\r\n const sphere = this.boundingSphere || new THREE.Sphere();\r\n const size = this._positions.length;\r\n const pos = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n pos.set(positions[i], positions[i + 1], positions[i + 2]);\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n sphere.set(center, Math.sqrt(radiusSquared));\r\n this.boundingSphere = sphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n const positions = this._positions;\r\n const box = new THREE.Box3();\r\n const size = this._positions.length;\r\n const tmpVec = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n tmpVec.set(positions[i], positions[i + 1], positions[i + 2]);\r\n box.expandByPoint(tmpVec);\r\n }\r\n this.boundingBox = box;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n}\r\n\r\nexport default LinesGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\nclass CylinderCollisionGeo extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const itemOffset = chunkSize * itemIdx * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, itemOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, itemOffset);\r\n }\r\n}\r\nexport default CylinderCollisionGeo;\r\n","import LinesGeometry from './LinesGeometry';\r\nimport CylinderCollisionGeo from './CylinderCollisionGeo';\r\n\r\nconst COLLISION_RAD = 0.1;\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n *\r\n * @param {number} chunksCount Total chunks count.\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * @param {boolean} enableCollision Enable or disable collision where each segment is\r\n * a collidable cylinder.\r\n * collision geometry.\r\n */\r\nclass ChunkedLinesGeometry extends LinesGeometry {\r\n constructor(chunksCount, segmentsCount, enableCollision) {\r\n super(chunksCount * segmentsCount);\r\n this._init(segmentsCount);\r\n this._collisionGeo = enableCollision ? new CylinderCollisionGeo(chunksCount * segmentsCount, 3) : null;\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = collisionGeo.boundingSphere;\r\n return;\r\n }\r\n super.computeBoundingSphere();\r\n }\r\n\r\n computeBoundingBox() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingBox();\r\n this.boundingBox = collisionGeo.boundingBox;\r\n return;\r\n }\r\n super.computeBoundingBox();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const collisionGeo = this._collisionGeo;\r\n if (!collisionGeo) {\r\n return;\r\n }\r\n const segCount = this._chunkSize;\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n for (let i = 0, n = intersects.length; i < n; ++i) {\r\n let { chunkIdx } = intersects[i];\r\n if (chunkIdx === undefined) {\r\n continue;\r\n }\r\n chunkIdx = (chunkIdx / segCount) | 0;\r\n intersects[i].chunkIdx = chunkIdx;\r\n }\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n super.setColor(i, colorVal);\r\n }\r\n }\r\n\r\n setSegment(chunkIdx, segIdx, pos1, pos2) {\r\n const chunkSize = this._chunkSize;\r\n const idx = chunkIdx * chunkSize + segIdx;\r\n super.setSegment(idx, pos1, pos2);\r\n if (this._collisionGeo) {\r\n this._collisionGeo.setItem(chunkIdx * chunkSize + segIdx, pos1, pos2, COLLISION_RAD);\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n super.setOpacity(left, left + chunkSize - 1, value);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const chunkSize = this._chunkSize;\r\n const subset = new ChunkedLinesGeometry(instanceCount, chunkSize, false);\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const startSegIdx = chunkIndices[i] * chunkSize;\r\n subset.setSegments(dstPtOffset, this.getSubsetSegments(startSegIdx, chunkSize));\r\n subset.setColors(dstPtOffset, this.getSubsetColors(startSegIdx, chunkSize));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(chunkSize) {\r\n this._chunkSize = chunkSize;\r\n }\r\n}\r\n\r\nexport default ChunkedLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport LinesGeometry from './LinesGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\n\r\nconst COLLISION_RAD = 0.3;\r\nconst tmpVector = new THREE.Vector3();\r\n\r\n\r\nclass TwoColorLinesGeometry extends LinesGeometry {\r\n constructor(segmentsCount) {\r\n super(segmentsCount * 2);\r\n this._init(segmentsCount);\r\n this._collisionGeo = new Simple2CCylindersGeometry(segmentsCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos) {\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, COLLISION_RAD);\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n tmpVector.lerpVectors(botPos, topPos, 0.5);\r\n super.setSegment(offset, botPos, tmpVector);\r\n super.setSegment(offset + 1, tmpVector, topPos);\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n super.setColor(offset, colorVal1);\r\n super.setColor(offset + 1, colorVal2);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n if (this._collisionGeo) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n getSubset(segmentIndices) {\r\n const instanceCount = segmentIndices.length;\r\n const subset = new TwoColorLinesGeometry(instanceCount, false);\r\n for (let i = 0, n = instanceCount; i < n; ++i) {\r\n const startSegIdx = segmentIndices[i];\r\n subset.setSegments(i, this.getSubsetSegments(startSegIdx, 1));\r\n subset.setColors(i, this.getSubsetColors(startSegIdx, 1));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(segmentsCount) {\r\n this._segCounts = segmentsCount * 2;\r\n }\r\n}\r\n// (???)parent = LinesGeometry.prototype;\r\n\r\nexport default TwoColorLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst vectors = [\r\n new THREE.Vector3(1, 0, 0),\r\n new THREE.Vector3(-1, 0, 0),\r\n new THREE.Vector3(0, 1, 0),\r\n new THREE.Vector3(0, -1, 0),\r\n new THREE.Vector3(0, 0, 1),\r\n new THREE.Vector3(0, 0, -1),\r\n];\r\nconst vecCount = vectors.length;\r\nconst tempPos1 = new THREE.Vector3();\r\nconst tempPos2 = new THREE.Vector3();\r\n\r\nclass CrossGeometry extends SphereCollisionGeo(ChunkedLinesGeometry) {\r\n constructor(chunksCount) {\r\n super(chunksCount, chunksCount, (vecCount / 2) | 0, false);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n\r\n for (let i = 0; i < vecCount / 2; ++i) {\r\n const first = i * 2;\r\n tempPos1.x = itemPos.x + vectors[first].x * itemRad;\r\n tempPos1.y = itemPos.y + vectors[first].y * itemRad;\r\n tempPos1.z = itemPos.z + vectors[first].z * itemRad;\r\n const second = first + 1;\r\n tempPos2.x = itemPos.x + vectors[second].x * itemRad;\r\n tempPos2.y = itemPos.y + vectors[second].y * itemRad;\r\n tempPos2.z = itemPos.z + vectors[second].z * itemRad;\r\n this.setSegment(itemIdx, i, tempPos1, tempPos2);\r\n }\r\n }\r\n}\r\nexport default CrossGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport RaycastableBufferGeometry from './RaycastableBufferGeometry';\r\n\r\nconst POS_RAD_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This is a base class for isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\nclass IsoSurfaceGeometry extends RaycastableBufferGeometry {\r\n constructor(spheresCount, opts) {\r\n super();\r\n\r\n this._opts = opts;\r\n this.zClip = this._opts.zClip;\r\n this._posRad = utils.allocateTyped(Float32Array, spheresCount * POS_RAD_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n }\r\n\r\n setItem(chunkIdx, pos, radius) {\r\n const posRad = this._posRad;\r\n let idx = POS_RAD_SIZE * chunkIdx;\r\n posRad[idx++] = pos.x;\r\n posRad[idx++] = pos.y;\r\n posRad[idx++] = pos.z;\r\n posRad[idx] = radius;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n let idx = COLOR_SIZE * chunkIdx;\r\n colors[idx++] = tmpColor.r;\r\n colors[idx++] = tmpColor.g;\r\n colors[idx] = tmpColor.b;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n finishUpdate() {\r\n this._build();\r\n }\r\n\r\n setOpacity() {\r\n // not implemented\r\n }\r\n\r\n raycast() {\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\nexport default IsoSurfaceGeometry;\r\n","import utils from '../../utils';\r\n\r\n/**\r\n * Class for marching cube\r\n * Stores 8 points and 8 float values are stored together in linear array\r\n * Int values for has intersection or not - in integer32 linear array\r\n * Int values for bits flags - in integer32 linear array\r\n *\r\n */\r\nclass IsoSurfaceMarchCube {\r\n constructor() {\r\n this.pointsValuesLinear = null;\r\n this.hasIntersection = null;\r\n this.bitsInside = null;\r\n }\r\n\r\n create(numCellsPerSide) {\r\n const vx7000000 = 0x7000000;\r\n const n3 = numCellsPerSide * numCellsPerSide * numCellsPerSide;\r\n if (n3 > vx7000000) {\r\n throw new Error('Too large cube dimension: lead to memory huge uasge');\r\n }\r\n this.pointsValuesLinear = utils.allocateTyped(Float32Array, (2 << (2 + 2)) * n3);\r\n this.hasIntersection = utils.allocateTyped(Int32Array, n3);\r\n this.bitsInside = utils.allocateTyped(Int32Array, n3);\r\n return 0;\r\n }\r\n\r\n destroy() {\r\n this.bitsInside = null;\r\n this.hasIntersection = null;\r\n this.pointsValuesLinear = null;\r\n }\r\n}\r\n\r\n/* eslint-disable no-magic-numbers */\r\nIsoSurfaceMarchCube.prototype.striIndicesMarchCube = [\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1,\r\n 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1,\r\n 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1,\r\n 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1,\r\n 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1,\r\n 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1,\r\n 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1,\r\n 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1,\r\n 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1,\r\n 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1,\r\n 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1,\r\n 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1,\r\n 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1,\r\n 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1,\r\n 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1,\r\n 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1,\r\n 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1,\r\n 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1,\r\n 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1,\r\n 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1,\r\n 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1,\r\n 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1,\r\n 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1,\r\n 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1,\r\n 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1,\r\n 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1,\r\n 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1,\r\n 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1,\r\n 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1,\r\n 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1,\r\n 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1,\r\n 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1,\r\n 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1,\r\n 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1,\r\n 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1,\r\n 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1,\r\n 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1,\r\n 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1,\r\n 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1,\r\n 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1,\r\n 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1,\r\n 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1,\r\n 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1,\r\n 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1,\r\n 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1,\r\n 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1,\r\n 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1,\r\n 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1,\r\n 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1,\r\n 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1,\r\n 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1,\r\n 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1,\r\n 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1,\r\n 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1,\r\n 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1,\r\n 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1,\r\n 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1,\r\n 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1,\r\n 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1,\r\n 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1,\r\n 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1,\r\n 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1,\r\n 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1,\r\n 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1,\r\n 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1,\r\n 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1,\r\n 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1,\r\n 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1,\r\n 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1,\r\n 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1,\r\n 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1,\r\n 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1,\r\n 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1,\r\n 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1,\r\n 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1,\r\n 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1,\r\n 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1,\r\n 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1,\r\n 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1,\r\n 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1,\r\n 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1,\r\n 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1,\r\n 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1,\r\n 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1,\r\n 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1,\r\n 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1,\r\n 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1,\r\n 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1,\r\n 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1,\r\n 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1,\r\n 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1,\r\n 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1,\r\n 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n];\r\n/* eslint-enable no-magic-numbers */\r\n\r\nexport default IsoSurfaceMarchCube;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport utils from '../../utils';\r\n\r\nconst edgeTable = [\r\n 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,\r\n 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,\r\n 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,\r\n 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,\r\n 0x230, 0x339, 0x33,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265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460,\r\n 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,\r\n 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,\r\n 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,\r\n 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,\r\n 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,\r\n 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,\r\n 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,\r\n 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0];\r\n\r\nfunction _voxelGradientFast(v, point, grad) {\r\n const g = v.getValue(point.x, point.y, point.z);\r\n grad.set(g[0], g[1], g[2]);\r\n}\r\n\r\n// Helper class GridCell\r\nclass GridCell {\r\n constructor() {\r\n this._arrSize = 8;\r\n this.p = new Array(this._arrSize);\r\n this.g = new Array(this._arrSize);\r\n this.val = new Array(this._arrSize);\r\n for (let i = 0; i < this._arrSize; ++i) {\r\n this.p[i] = new THREE.Vector3();\r\n this.g[i] = new THREE.Vector3();\r\n }\r\n this.cubeIndex = 0;\r\n }\r\n}\r\n\r\n// Helper class Triangle\r\nclass Triangle {\r\n constructor() {\r\n this.a = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.b = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.c = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n }\r\n}\r\n\r\nfunction createArray(arrSize) {\r\n const arr = new Array(arrSize);\r\n for (let i = 0; i < arrSize; ++i) {\r\n arr[i] = new THREE.Vector3();\r\n }\r\n\r\n return arr;\r\n}\r\n\r\nclass IsoSurface {\r\n constructor() {\r\n this._numTriangles = 0;\r\n this._numVertices = 0;\r\n this._position = [];\r\n this._normals = [];\r\n this._colors = null;\r\n this._indices = [];\r\n this._volumetricData = null;\r\n this._xAxis = new THREE.Vector3();\r\n this._yAxis = new THREE.Vector3();\r\n this._zAxis = new THREE.Vector3();\r\n this._xDir = new THREE.Vector3();\r\n this._yDir = new THREE.Vector3();\r\n this._zDir = new THREE.Vector3();\r\n }\r\n\r\n _prepareAxesAndDirs() {\r\n const volData = this._volumetricData;\r\n\r\n const cellSize = volData.getCellSize();\r\n\r\n // calculate cell axes\r\n const xAxis = this._xAxis;\r\n const yAxis = this._yAxis;\r\n const zAxis = this._zAxis;\r\n const xDir = this._xDir;\r\n const yDir = this._yDir;\r\n const zDir = this._zDir;\r\n\r\n xAxis.set(cellSize.x, 0, 0);\r\n yAxis.set(0, cellSize.y, 0);\r\n zAxis.set(0, 0, cellSize.z);\r\n\r\n xDir.set(1, 0, 0);\r\n yDir.set(0, 1, 0);\r\n zDir.set(0, 0, 1);\r\n\r\n // flip normals if coordinate system is in the wrong handedness\r\n const tmp = new THREE.Vector3();\r\n tmp.crossVectors(xDir, yDir);\r\n if (tmp.dot(zDir) < 0) {\r\n xDir.negate();\r\n yDir.negate();\r\n zDir.negate();\r\n }\r\n\r\n // check that the grid is in the all-positive octant of the coordinate system\r\n if (xDir.x < 0 || xDir.y < 0 || xDir.z < 0\r\n || yDir.x < 0 || yDir.y < 0 || yDir.z < 0\r\n || zDir.x < 0 || zDir.y < 0 || zDir.z < 0) {\r\n return false;\r\n }\r\n\r\n // check that the grid is axis-aligned\r\n const notZero = (axe) => Math.abs(axe) > Number.EPSILON;\r\n return !(notZero(xAxis.y) || notZero(xAxis.z)\r\n || notZero(yAxis.x) || notZero(yAxis.z)\r\n || notZero(zAxis.x) || notZero(zAxis.y));\r\n }\r\n\r\n _vertexInterp(isoLevel, grid, ind1, ind2, vertex, normal) {\r\n const p1 = grid.p[ind1];\r\n const p2 = grid.p[ind2];\r\n const n1 = grid.g[ind1];\r\n const n2 = grid.g[ind2];\r\n const valP1 = grid.val[ind1];\r\n const valP2 = grid.val[ind2];\r\n const isoDiffP1 = isoLevel - valP1;\r\n const diffValP2P1 = valP2 - valP1;\r\n\r\n let mu = 0.0;\r\n\r\n if (Math.abs(diffValP2P1) > 0.0) {\r\n mu = isoDiffP1 / diffValP2P1;\r\n }\r\n mu = mu > 1.0 ? 1.0 : mu;\r\n vertex.lerpVectors(p1, p2, mu);\r\n normal.lerpVectors(n1, n2, mu);\r\n }\r\n\r\n static _triTable = IsoSurfaceMarchCube.prototype.striIndicesMarchCube;\r\n\r\n static _arrSize = 12;\r\n\r\n static _firstIndices = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3];\r\n\r\n static _secondIndices = [1, 2, 3, 0, 5, 6, 7, 4, 4, 5, 6, 7];\r\n\r\n static _vertexList = createArray(IsoSurface._arrSize);\r\n\r\n static _normalList = createArray(IsoSurface._arrSize);\r\n\r\n _polygonize(grid, isoLevel, triangles) {\r\n const { cubeIndex } = grid;\r\n let i = 0;\r\n const arrSize = IsoSurface._arrSize;\r\n const firstIndices = IsoSurface._firstIndices;\r\n const secondIndices = IsoSurface._secondIndices;\r\n const vertexList = IsoSurface._vertexList;\r\n const normalList = IsoSurface._normalList;\r\n\r\n for (; i < arrSize; ++i) {\r\n if (edgeTable[cubeIndex] & (1 << i)) {\r\n this._vertexInterp(\r\n isoLevel, grid,\r\n firstIndices[i],\r\n secondIndices[i],\r\n vertexList[i],\r\n normalList[i],\r\n );\r\n }\r\n }\r\n\r\n let triCount = 0;\r\n const triTblIdx = cubeIndex * 16;\r\n const triTable = IsoSurface._triTable;\r\n\r\n for (i = 0; triTable[triTblIdx + i] !== -1; i += 3) {\r\n triangles[triCount].a.p.copy(vertexList[triTable[triTblIdx + i]]);\r\n triangles[triCount].a.n.copy(normalList[triTable[triTblIdx + i]]);\r\n\r\n triangles[triCount].b.p.copy(vertexList[triTable[triTblIdx + i + 1]]);\r\n triangles[triCount].b.n.copy(normalList[triTable[triTblIdx + i + 1]]);\r\n\r\n triangles[triCount].c.p.copy(vertexList[triTable[triTblIdx + i + 2]]);\r\n triangles[triCount].c.n.copy(normalList[triTable[triTblIdx + i + 2]]);\r\n ++triCount;\r\n }\r\n\r\n return triCount;\r\n }\r\n\r\n _doGridPosNorms(isoValue, step, appendSimple) {\r\n const vol = this._volumetricData;\r\n const volData = this._volumetricData.getData();\r\n const dim = vol.getDimensions();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n const zSize = dim[2];\r\n const stepX = step * vol.getStrideX();\r\n const stepY = step * vol.getStrideY();\r\n const stepZ = step * vol.getStrideZ();\r\n\r\n const gc = new GridCell();\r\n const gcVal = gc.val;\r\n const gcValSize = gc.val.length;\r\n const additions = [\r\n new THREE.Vector3(0, 0, 0), // 0\r\n new THREE.Vector3(step, 0, 0), // 1\r\n new THREE.Vector3(step, step, 0), // 2\r\n new THREE.Vector3(0, step, 0), // 3\r\n new THREE.Vector3(0, 0, step), // 4\r\n new THREE.Vector3(step, 0, step), // 5\r\n new THREE.Vector3(step, step, step), // 6\r\n new THREE.Vector3(0, step, step), // 7\r\n ];\r\n\r\n const tmpTriCount = 5;\r\n const triangles = new Array(tmpTriCount);\r\n for (let j = 0; j < tmpTriCount; ++j) {\r\n triangles[j] = new Triangle();\r\n }\r\n\r\n\r\n let appendVertex;\r\n const self = this;\r\n const positions = this._position;\r\n const normals = this._normals;\r\n if (appendSimple) {\r\n // Special case for axis-aligned grid with positive unit vector normals\r\n appendVertex = (function () {\r\n const axis = new THREE.Vector3(self._xAxis.x, self._yAxis.y, self._zAxis.z);\r\n return function (triVertex) {\r\n const vertex = triVertex.p.clone();\r\n vertex.multiply(axis);\r\n positions.push(vertex.add(self._origin));\r\n normals.push(triVertex.n.clone());\r\n };\r\n }());\r\n } else {\r\n appendVertex = (function () {\r\n const posMtx = new THREE.Matrix3();\r\n posMtx.set(\r\n self._xAxis.x, self._yAxis.x, self._zAxis.x,\r\n self._xAxis.y, self._yAxis.y, self._zAxis.y,\r\n self._xAxis.z, self._yAxis.z, self._zAxis.z,\r\n );\r\n const normMtx = new THREE.Matrix3();\r\n normMtx.set(\r\n self._xDir.x, self._yDir.x, self._zDir.x,\r\n self._xDir.y, self._yDir.y, self._zDir.y,\r\n self._xDir.z, self._yDir.z, self._zDir.z,\r\n );\r\n\r\n return function (triVertex) {\r\n positions.push(triVertex.p.clone().applyMatrix3(posMtx).add(self._origin));\r\n normals.push(triVertex.n.clone().applyMatrix3(normMtx));\r\n };\r\n }());\r\n }\r\n const indices = this._indices;\r\n\r\n let globTriCount = 0;\r\n\r\n for (let z = 0; z < (zSize - step); z += step) {\r\n for (let y = 0; y < (ySize - step); y += step) {\r\n let idx = vol.getDirectIdx(0, y, z);\r\n for (let x = 0; x < (xSize - step); x += step, idx += stepX) {\r\n /* eslint-disable no-multi-spaces */\r\n /* eslint-disable computed-property-spacing */\r\n gcVal[0] = volData[idx];\r\n gcVal[1] = volData[idx + stepX];\r\n gcVal[3] = volData[idx + stepY];\r\n gcVal[2] = volData[idx + stepX + stepY];\r\n gcVal[4] = volData[idx + stepZ];\r\n gcVal[5] = volData[idx + stepX + stepZ];\r\n gcVal[7] = volData[idx + stepY + stepZ];\r\n gcVal[6] = volData[idx + stepX + stepY + stepZ];\r\n /* eslint-enable no-multi-spaces */\r\n /* eslint-enable computed-property-spacing */\r\n\r\n // Determine the index into the edge table which\r\n // tells us which vertices are inside of the surface\r\n let cubeIndex = 0;\r\n let i = 0;\r\n for (; i < gcValSize; ++i) {\r\n if (gcVal[i] < isoValue) {\r\n cubeIndex |= (1 << i);\r\n }\r\n }\r\n\r\n if (edgeTable[cubeIndex] === 0) {\r\n continue;\r\n }\r\n\r\n gc.cubeIndex = cubeIndex;\r\n for (i = 0; i < gcValSize; ++i) {\r\n gc.p[i].set(x + additions[i].x, y + additions[i].y, z + additions[i].z);\r\n _voxelGradientFast(this._gradient, gc.p[i], gc.g[i]);\r\n }\r\n\r\n // calculate vertices and facets for this cube,\r\n // calculate normals by interpolating between the negated\r\n // normalized volume gradients for the 8 reference voxels\r\n const triCount = this._polygonize(gc, isoValue, triangles);\r\n globTriCount += triCount;\r\n\r\n // append triangles using different techniques\r\n for (i = 0; i < triCount; ++i) {\r\n indices.push(this._numTriangles * 3);\r\n indices.push(this._numTriangles * 3 + 1);\r\n indices.push(this._numTriangles * 3 + 2);\r\n ++this._numTriangles;\r\n\r\n appendVertex(triangles[i].a);\r\n appendVertex(triangles[i].b);\r\n appendVertex(triangles[i].c);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return globTriCount;\r\n }\r\n\r\n compute(volData, origin, isoValue, step) {\r\n this._volumetricData = volData;\r\n this._origin = origin;\r\n\r\n this._gradient = volData.computeGradient();\r\n\r\n this._doGridPosNorms(isoValue, step, this._prepareAxesAndDirs());\r\n }\r\n\r\n _remapIndices(vertexMap, idcCount) {\r\n const indices = this._indices;\r\n const newIndices = utils.allocateTyped(Uint32Array, idcCount);\r\n for (let i = 0; i < idcCount; ++i) {\r\n indices[i] = vertexMap[indices[i]];\r\n newIndices[i] = indices[i];\r\n }\r\n this._indices = newIndices;\r\n }\r\n\r\n _remapVertices(vertices, normals, count) {\r\n const newPositions = utils.allocateTyped(Float32Array, count * 3);\r\n const newNormals = utils.allocateTyped(Float32Array, count * 3);\r\n for (let i = 0; i < count; ++i) {\r\n const pos = vertices[i];\r\n newPositions[i * 3] = pos.x;\r\n newPositions[i * 3 + 1] = pos.y;\r\n newPositions[i * 3 + 2] = pos.z;\r\n const norm = normals[i].normalize();\r\n newNormals[i * 3] = norm.x;\r\n newNormals[i * 3 + 1] = norm.y;\r\n newNormals[i * 3 + 2] = norm.z;\r\n }\r\n this._position = newPositions;\r\n this._normals = newNormals;\r\n }\r\n\r\n vertexFusion(offset, len) {\r\n const faceVer = this._indices.length;\r\n const vertices = this._position;\r\n const normals = this._normals;\r\n const oldVerCount = vertices.length | 0;\r\n if (faceVer === 0 || oldVerCount === 0) {\r\n return;\r\n }\r\n const vMap = utils.allocateTyped(Uint32Array, oldVerCount);\r\n vMap[0] = 0;\r\n let newVer = 1;\r\n\r\n let i = 1;\r\n for (; i < oldVerCount; ++i) {\r\n const start = newVer - offset < 0 ? 0 : newVer - offset;\r\n const end = start + len > newVer ? newVer : start + len;\r\n let matchedIndex = -1;\r\n\r\n for (let j = start; j < end; ++j) {\r\n if (Math.abs(vertices[i] - vertices[j]) < Number.EPSILON) {\r\n matchedIndex = j;\r\n break;\r\n }\r\n }\r\n\r\n if (matchedIndex !== -1) {\r\n vMap[i] = matchedIndex;\r\n } else {\r\n vertices[newVer].copy(vertices[i]);\r\n normals[newVer].copy(normals[i]);\r\n vMap[i] = newVer;\r\n ++newVer;\r\n }\r\n }\r\n\r\n this._remapIndices(vMap, faceVer);\r\n this._remapVertices(vertices, normals, newVer);\r\n }\r\n\r\n // Assign per-vertex colors from a volumetric texture map (same dimensions as the original volumetric data).\r\n // Along with color dominating atom is determined for each vertex\r\n // and vertices with atom out of \"visible\" subset get filtered out.\r\n // XXX only handles orthogonal volumes currently\r\n setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) {\r\n let i;\r\n let idx;\r\n const numVerts = this._position.length / 3;\r\n const vertices = this._position;\r\n const origin = this._origin;\r\n const dim = this._volumetricData.getDimensions();\r\n const xs = dim[0] - 1;\r\n const ys = dim[1] - 1;\r\n const zs = dim[2] - 1;\r\n\r\n const colorData = colorMap.getData();\r\n const strideX = colorMap.getStrideX();\r\n const strideY = colorMap.getStrideY();\r\n const strideZ = colorMap.getStrideZ();\r\n\r\n let atomWeightData;\r\n let atomStrideX;\r\n let atomStrideY;\r\n let atomStrideZ;\r\n\r\n if (visibilitySelector !== null) {\r\n atomWeightData = atomWeightMap.getData();\r\n atomStrideX = atomWeightMap.getStrideX();\r\n atomStrideY = atomWeightMap.getStrideY();\r\n atomStrideZ = atomWeightMap.getStrideZ();\r\n }\r\n\r\n const xInv = 1.0 / this._xAxis.x;\r\n const yInv = 1.0 / this._yAxis.y;\r\n const zInv = 1.0 / this._zAxis.z;\r\n\r\n let atomLookup = [];\r\n let atomWeights = [];\r\n const colors = utils.allocateTyped(Float32Array, numVerts * 3);\r\n\r\n function interp(mu, idx1, idx2, c) {\r\n c[0] = (1 - mu) * colorData[idx1] + mu * colorData[idx2];\r\n c[1] = (1 - mu) * colorData[idx1 + 1] + mu * colorData[idx2 + 1];\r\n c[2] = (1 - mu) * colorData[idx1 + 2] + mu * colorData[idx2 + 2];\r\n }\r\n\r\n function collectWeight(ai, coefX, coefY, coefZ) {\r\n const a = atomMap[ai]; // atomWeightMap is a scalar field, so index into atom map should be the same\r\n if (a != null) {\r\n atomLookup[a.index] = a;\r\n const w = coefX * coefY * coefZ * atomWeightData[ai];\r\n if (typeof atomWeights[a.index] === 'undefined') {\r\n atomWeights[a.index] = w;\r\n } else {\r\n atomWeights[a.index] += w;\r\n }\r\n }\r\n }\r\n\r\n const vMap = utils.allocateTyped(Int32Array, numVerts);\r\n let newVerCount = 0;\r\n\r\n for (i = 0; i < numVerts; i++) {\r\n const ind = i * 3;\r\n const vx = (vertices[ind] - origin.x) * xInv;\r\n const vy = (vertices[ind + 1] - origin.y) * yInv;\r\n const vz = (vertices[ind + 2] - origin.z) * zInv;\r\n const x = Math.min(Math.max(vx, 0), xs) | 0;\r\n const y = Math.min(Math.max(vy, 0), ys) | 0;\r\n const z = Math.min(Math.max(vz, 0), zs) | 0;\r\n\r\n const mux = (vx - x);\r\n const muy = (vy - y);\r\n const muz = (vz - z);\r\n\r\n if (visibilitySelector != null) {\r\n // collect atom weights\r\n atomLookup = [];\r\n atomWeights = [];\r\n idx = atomWeightMap.getDirectIdx(x, y, z);\r\n collectWeight(idx, 1 - mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideX, mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideY, 1 - mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideX + atomStrideY, mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideZ, 1 - mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideZ, mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideY + atomStrideZ, 1 - mux, muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideY + atomStrideZ, mux, muy, muz);\r\n\r\n // find dominant atom\r\n let maxWeight = 0.0;\r\n let dominantIdx = -1;\r\n for (const atomIdx in atomWeights) {\r\n if (atomWeights[atomIdx] > maxWeight) {\r\n dominantIdx = atomIdx;\r\n maxWeight = atomWeights[atomIdx];\r\n }\r\n }\r\n\r\n if (dominantIdx < 0 || !visibilitySelector.includesAtom(atomLookup[dominantIdx])) {\r\n // this vertex doesn't belong to visible subset and will be skipped\r\n vMap[i] = -1;\r\n continue;\r\n }\r\n }\r\n\r\n vMap[i] = newVerCount++;\r\n\r\n // color tri-linear interpolation\r\n const dx = (x < xs) ? strideX : 0;\r\n const dy = (y < ys) ? strideY : 0;\r\n const dz = (z < zs) ? strideZ : 0;\r\n\r\n const c0 = [0, 0, 0];\r\n const c1 = [0, 0, 0];\r\n const c2 = [0, 0, 0];\r\n const c3 = [0, 0, 0];\r\n\r\n idx = colorMap.getDirectIdx(x, y, z);\r\n interp(mux, idx, idx + dx, c0);\r\n interp(mux, idx + dy, idx + dx + dy, c1);\r\n interp(mux, idx + dz, idx + dx + dz, c2);\r\n interp(mux, idx + dy + dz, idx + dx + dy + dz, c3);\r\n\r\n const cz0 = [0, 0, 0];\r\n cz0[0] = (1 - muy) * c0[0] + muy * c1[0];\r\n cz0[1] = (1 - muy) * c0[1] + muy * c1[1];\r\n cz0[2] = (1 - muy) * c0[2] + muy * c1[2];\r\n\r\n const cz1 = [0, 0, 0];\r\n cz1[0] = (1 - muy) * c2[0] + muy * c3[0];\r\n cz1[1] = (1 - muy) * c2[1] + muy * c3[1];\r\n cz1[2] = (1 - muy) * c2[2] + muy * c3[2];\r\n\r\n colors[ind] = (1 - muz) * cz0[0] + muz * cz1[0];\r\n colors[ind + 1] = (1 - muz) * cz0[1] + muz * cz1[1];\r\n colors[ind + 2] = (1 - muz) * cz0[2] + muz * cz1[2];\r\n }\r\n this._colors = colors;\r\n\r\n if (visibilitySelector != null) {\r\n // shift visible vertices towards beginning of array\r\n for (i = 0; i < numVerts; ++i) {\r\n const j = vMap[i];\r\n if (j < 0) {\r\n continue;\r\n }\r\n\r\n // assert: j <= i\r\n this._position[j * 3] = this._position[i * 3];\r\n this._position[j * 3 + 1] = this._position[i * 3 + 1];\r\n this._position[j * 3 + 2] = this._position[i * 3 + 2];\r\n this._normals[j * 3] = this._normals[i * 3];\r\n this._normals[j * 3 + 1] = this._normals[i * 3 + 1];\r\n this._normals[j * 3 + 2] = this._normals[i * 3 + 2];\r\n this._colors[j * 3] = this._colors[i * 3];\r\n this._colors[j * 3 + 1] = this._colors[i * 3 + 1];\r\n this._colors[j * 3 + 2] = this._colors[i * 3 + 2];\r\n }\r\n\r\n // rebuild index list\r\n const numTriangles = this._indices.length / 3;\r\n let newTriCount = 0;\r\n for (i = 0; i < numTriangles; ++i) {\r\n const i0 = vMap[this._indices[3 * i]];\r\n const i1 = vMap[this._indices[3 * i + 1]];\r\n const i2 = vMap[this._indices[3 * i + 2]];\r\n if (i0 >= 0 && i1 >= 0 && i2 >= 0) {\r\n this._indices[3 * newTriCount] = i0;\r\n this._indices[3 * newTriCount + 1] = i1;\r\n this._indices[3 * newTriCount + 2] = i2;\r\n ++newTriCount;\r\n }\r\n }\r\n\r\n // shrink arrays to data size\r\n this._position = new Float32Array(this._position.buffer.slice(0, newVerCount * 3 * 4));\r\n this._normals = new Float32Array(this._normals.buffer.slice(0, newVerCount * 3 * 4));\r\n this._colors = new Float32Array(this._colors.buffer.slice(0, newVerCount * 3 * 4));\r\n this._indices = new Uint32Array(this._indices.buffer.slice(0, newTriCount * 3 * 4));\r\n }\r\n }\r\n\r\n toMesh() {\r\n const geo = new THREE.BufferGeometry();\r\n geo.setIndex(new THREE.BufferAttribute(this._indices, 1));\r\n geo.setAttribute('position', new THREE.BufferAttribute(this._position, 3));\r\n geo.setAttribute('normal', new THREE.BufferAttribute(this._normals, 3));\r\n geo.setAttribute('color', new THREE.BufferAttribute(this._colors, 3));\r\n geo.computeBoundingSphere();\r\n return geo;\r\n }\r\n}\r\nexport default IsoSurface;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurface from './IsoSurface';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * This is a base class for volumetric maps based isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass VolumeSurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n const params = this._opts;\r\n this.numVoxels = [128, 128, 128];\r\n this.xAxis = new THREE.Vector3(1.0, 0.0, 0.0);\r\n this.yAxis = new THREE.Vector3(0.0, 1.0, 0.0);\r\n this.zAxis = new THREE.Vector3(0.0, 0.0, 1.0);\r\n\r\n this.origin = new THREE.Vector3(0.0, 0.0, 0.0);\r\n this._visibilitySelector = params.visibilitySelector;\r\n\r\n this._calcSurface(params);\r\n }\r\n\r\n _findMinMax(posRadArray) {\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n const maxPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n const minPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n for (let i = 1; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n for (let itemIdx = 0; itemIdx < itemSize; ++itemIdx) {\r\n const tmpVal = posRadArray[ind + itemIdx];\r\n maxPosRad[itemIdx] = Math.max(tmpVal, maxPosRad[itemIdx]);\r\n minPosRad[itemIdx] = Math.min(tmpVal, minPosRad[itemIdx]);\r\n }\r\n }\r\n return { maxPosRad, minPosRad };\r\n }\r\n\r\n _findNumVoxels(posRadArray, params) {\r\n const { numVoxels } = this;\r\n const minMaxValues = this._findMinMax(posRadArray);\r\n const minCoordRad = minMaxValues.minPosRad;\r\n const maxCoordRad = minMaxValues.maxPosRad;\r\n\r\n // minrad\r\n if (minCoordRad[3] > 4.0) {\r\n params.gridSpacing *= minCoordRad[3];\r\n }\r\n\r\n let gridPadding = params.radScale * maxCoordRad[3] * 1.7;\r\n let padRad = gridPadding;\r\n padRad = 0.65 * Math.sqrt(4.0 / 3.0 * Math.PI * padRad * padRad * padRad);\r\n gridPadding = Math.max(gridPadding, padRad);\r\n\r\n let i = 0;\r\n for (; i < 3; ++i) {\r\n minCoordRad[i] -= gridPadding;\r\n maxCoordRad[i] += gridPadding;\r\n }\r\n\r\n for (i = 0; i < 3; ++i) {\r\n numVoxels[i] = Math.ceil((maxCoordRad[i] - minCoordRad[i]) / params.gridSpacing);\r\n }\r\n this.xAxis.x = (numVoxels[0] - 1) * params.gridSpacing;\r\n this.yAxis.y = (numVoxels[1] - 1) * params.gridSpacing;\r\n this.zAxis.z = (numVoxels[2] - 1) * params.gridSpacing;\r\n\r\n [this.origin.x, this.origin.y, this.origin.z] = minCoordRad;\r\n\r\n return { bbox: minMaxValues, dim: numVoxels };\r\n }\r\n\r\n _makeSurface(surface, params) {\r\n const isoSurf = new IsoSurface();\r\n isoSurf.compute(surface.volMap, this.origin, params.isoValue, 1);\r\n isoSurf.vertexFusion(9, 9);// normalization is included\r\n\r\n if (isoSurf._numTriangles > 0) {\r\n isoSurf.setColorVolTex(surface.volTexMap, surface.atomMap, surface.atomWeightMap, this._visibilitySelector);\r\n this.setIndex(new THREE.BufferAttribute(isoSurf._indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(isoSurf._position, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(isoSurf._normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(isoSurf._colors, 3));\r\n } else { // geometry should have at least empty position attributes to be processed in wireframe mode by three.js\r\n this.setAttribute('position', new THREE.BufferAttribute(utils.allocateTyped(Float32Array, 0), 3));\r\n }\r\n }\r\n\r\n _calcSurface(params) {\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n\r\n if (packedArrays.posRad.length === 0) {\r\n return;\r\n }\r\n const boundaries = this._findNumVoxels(packedArrays.posRad, params);\r\n\r\n const box = new THREE.Box3(\r\n this.origin,\r\n new THREE.Vector3(this.xAxis.x, this.yAxis.y, this.zAxis.z).add(this.origin),\r\n );\r\n const surface = this._computeSurface(packedArrays, box, boundaries, params);\r\n\r\n this._makeSurface(surface, params);\r\n }\r\n}\r\n\r\nexport default VolumeSurfaceGeometry;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass QuickSurfGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n // beware of shifting this multiple times!\r\n this._shiftByOrigin(packedArrays.posRad);\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3),\r\n };\r\n\r\n if (this._visibilitySelector != null) {\r\n surface.atomMap = [];\r\n surface.atomWeightMap = new Volume(Float32Array, this.numVoxels, box);\r\n }\r\n\r\n this.gaussdensity(surface, packedArrays, null, params);\r\n return surface;\r\n }\r\n\r\n gaussdensity(surface, packedArrays, atomicNum, params) {\r\n const numAtoms = packedArrays.posRad.length / 4;\r\n const { posRad, colors } = packedArrays;\r\n const { numVoxels } = this;\r\n const { radScale, gaussLim, gridSpacing } = params;\r\n const invIsoValue = 1.0 / params.isoValue;\r\n const invGridSpacing = 1.0 / gridSpacing;\r\n const maxVoxelX = numVoxels[0] - 1;\r\n const maxVoxelY = numVoxels[1] - 1;\r\n const maxVoxelZ = numVoxels[2] - 1;\r\n // TODO is densityMap and volTexMap initialized?\r\n\r\n const { volMap, volTexMap } = surface;\r\n const volData = volMap.getData();\r\n const strideX = volMap.getStrideX();\r\n\r\n const volTexData = volTexMap.getData();\r\n const texStrideX = volTexMap.getStrideX();\r\n\r\n let atomWeightData;\r\n if (this._visibilitySelector != null) {\r\n atomWeightData = surface.atomWeightMap.getData();\r\n }\r\n\r\n const { atomMap } = surface;\r\n\r\n for (let i = 0; i < numAtoms; ++i) {\r\n const ind = i * 4;\r\n const scaledRad = posRad[ind + 3] * radScale;\r\n const atomicNumFactor = atomicNum === null ? 1.0 : atomicNum[i];\r\n const radInv = 1 / (2 * scaledRad * scaledRad);\r\n let radLim = gaussLim * scaledRad;\r\n const radLim2 = radLim * radLim;\r\n radLim *= invGridSpacing;\r\n\r\n let tmp = posRad[ind] * invGridSpacing;\r\n const xMin = Math.max((tmp - radLim) | 0, 0);\r\n const xMax = Math.min((tmp + radLim) | 0, maxVoxelX);\r\n tmp = posRad[ind + 1] * invGridSpacing;\r\n const yMin = Math.max((tmp - radLim) | 0, 0);\r\n const yMax = Math.min((tmp + radLim) | 0, maxVoxelY);\r\n tmp = posRad[ind + 2] * invGridSpacing;\r\n const zMin = Math.max((tmp - radLim) | 0, 0);\r\n const zMax = Math.min((tmp + radLim) | 0, maxVoxelZ);\r\n\r\n let dz = zMin * gridSpacing - posRad[ind + 2];\r\n for (let z = zMin; z <= zMax; ++z, dz += gridSpacing) {\r\n let dy = yMin * gridSpacing - posRad[ind + 1];\r\n for (let y = yMin; y <= yMax; ++y, dy += gridSpacing) {\r\n const dy2dz2 = dy * dy + dz * dz;\r\n\r\n if (dy2dz2 >= radLim2) {\r\n continue;\r\n }\r\n\r\n let addr = volMap.getDirectIdx(xMin, y, z);\r\n let texAddr = volTexMap.getDirectIdx(xMin, y, z);\r\n let dx = xMin * gridSpacing - posRad[ind];\r\n for (let x = xMin; x <= xMax; ++x, dx += gridSpacing, addr += strideX, texAddr += texStrideX) {\r\n const r2 = dx * dx + dy2dz2;\r\n const expVal = -r2 * radInv;\r\n\r\n let density = Math.exp(expVal) * atomicNumFactor;\r\n\r\n // store most relevant atom (with highest density)\r\n if (this._visibilitySelector != null\r\n && density > atomWeightData[addr]) { // NOSONAR\r\n atomWeightData[addr] = density;\r\n // we use same index into atom map and atomWeightMap\r\n atomMap[addr] = packedArrays.atoms[i];\r\n }\r\n\r\n volData[addr] += density;\r\n\r\n // TODO check for volTexMap routine?\r\n density *= invIsoValue;\r\n const colInd = i * 3;\r\n volTexData[texAddr] += density * colors[colInd];\r\n volTexData[texAddr + 1] += density * colors[colInd + 1];\r\n volTexData[texAddr + 2] += density * colors[colInd + 2];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n _shiftByOrigin(posRadArray) {\r\n const originX = this.origin.x;\r\n const originY = this.origin.y;\r\n const originZ = this.origin.z;\r\n\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n for (let i = 0; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n posRadArray[ind] -= originX;\r\n posRadArray[ind + 1] -= originY;\r\n posRadArray[ind + 2] -= originZ;\r\n }\r\n }\r\n}\r\n\r\nexport default QuickSurfGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * Modifed from SpatialHash\r\n *\r\n * Main differences are:\r\n * - Optimized grid size to ensure we only ever need to look +/-1 cell\r\n * - Aware of atomic radii and will only output atoms within rAtom + rExtra\r\n * (see withinRadii method)\r\n *\r\n * (Uses rounding rather than bitshifting as consequence of arbitrary grid size)\r\n * @class\r\n * @param {Float32Array} posRad - x, y, z coordinates and radiuses\r\n * @param {Float32Array} min - xyz min coordinates\r\n * @param {Float32Array} max - xyz max coordinates\r\n * @param {number} maxDistance - max distance\r\n */\r\nfunction AVHash(posRad, min, max, maxDistance) {\r\n const itemSize = 4;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const minX = min[0];\r\n const minY = min[1];\r\n const minZ = min[2];\r\n\r\n const maxX = max[0];\r\n const maxY = max[1];\r\n const maxZ = max[2];\r\n\r\n function hashFunc(w, minW) {\r\n return Math.floor((w - minW) / maxDistance);\r\n }\r\n\r\n const iDim = hashFunc(maxX, minX) + 1;\r\n const jDim = hashFunc(maxY, minY) + 1;\r\n const kDim = hashFunc(maxZ, minZ) + 1;\r\n\r\n const nCells = iDim * jDim * kDim;\r\n\r\n const jkDim = jDim * kDim;\r\n\r\n\r\n /* Get cellID for cartesian x,y,z */\r\n const cellID = function (x, y, z) {\r\n return (((hashFunc(x, minX) * jDim) + hashFunc(y, minY)) * kDim) + hashFunc(z, minZ);\r\n };\r\n\r\n\r\n /* Initial building, could probably be optimized further */\r\n const preHash = [];\r\n let i;\r\n let cid;\r\n for (i = 0; i < nAtoms; i++) {\r\n const iIdx = itemSize * i;\r\n cid = cellID(posRad[iIdx], posRad[iIdx + 1], posRad[iIdx + 2]);\r\n\r\n if (preHash[cid] === undefined) {\r\n preHash[cid] = [i];\r\n } else {\r\n preHash[cid].push(i);\r\n }\r\n }\r\n\r\n const cellOffsets = utils.allocateTyped(Uint32Array, nCells);\r\n const cellLengths = utils.allocateTyped(Uint16Array, nCells);\r\n const data = utils.allocateTyped(Uint32Array, nAtoms);\r\n\r\n let offset = 0;\r\n let maxCellLength = 0;\r\n let j;\r\n for (i = 0; i < nCells; i++) {\r\n const start = cellOffsets[i] = offset;\r\n\r\n const subArray = preHash[i];\r\n\r\n if (subArray !== undefined) {\r\n for (j = 0; j < subArray.length; j++) {\r\n data[offset] = subArray[j];\r\n offset++;\r\n }\r\n }\r\n\r\n const cellLength = offset - start;\r\n cellLengths[i] = cellLength;\r\n\r\n if (cellLength > maxCellLength) {\r\n maxCellLength = cellLength;\r\n }\r\n }\r\n\r\n // Maximum number of neighbours we could ever produce (27 adjacent cells of equal population)\r\n this.neighbourListLength = (27 * maxCellLength) + 1;\r\n\r\n /**\r\n * Populate the supplied out array with atom indices that are within rAtom + rExtra\r\n * of x,y,z\r\n *\r\n * -1 in out array indicates the end of the list\r\n *\r\n * @param {number} x - x coordinate\r\n * @param {number} y - y coordinate\r\n * @param {number} z - z coordinate\r\n * @param {number} rExtra - additional radius\r\n * @param {Float32Array} out - pre-allocated output array\r\n * @return {undefined}\r\n */\r\n this.withinRadii = function (x, y, z, rExtra, out) {\r\n let outIdx = 0;\r\n\r\n const nearI = hashFunc(x, minX);\r\n const nearJ = hashFunc(y, minY);\r\n const nearK = hashFunc(z, minZ);\r\n\r\n const loI = Math.max(0, nearI - 1);\r\n const loJ = Math.max(0, nearJ - 1);\r\n const loK = Math.max(0, nearK - 1);\r\n\r\n const hiI = Math.min(iDim - 1, nearI + 1);\r\n const hiJ = Math.min(jDim - 1, nearJ + 1);\r\n const hiK = Math.min(kDim - 1, nearK + 1);\r\n\r\n for (i = loI; i <= hiI; ++i) {\r\n const iOffset = i * jkDim;\r\n\r\n for (j = loJ; j <= hiJ; ++j) {\r\n const jOffset = j * kDim;\r\n\r\n for (let k = loK; k <= hiK; ++k) {\r\n cid = iOffset + jOffset + k;\r\n\r\n const cellStart = cellOffsets[cid];\r\n const cellEnd = cellStart + cellLengths[cid];\r\n\r\n for (let dataIndex = cellStart; dataIndex < cellEnd; dataIndex++) {\r\n const atomIndex = data[dataIndex];\r\n const baseIndex = itemSize * atomIndex;\r\n const dx = posRad[baseIndex] - x;\r\n const dy = posRad[baseIndex + 1] - y;\r\n const dz = posRad[baseIndex + 2] - z;\r\n const rSum = posRad[baseIndex + 3] + rExtra;\r\n\r\n if ((dx * dx + dy * dy + dz * dz) <= (rSum * rSum)) {\r\n out[outIdx++] = data[dataIndex];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Add terminator\r\n out[outIdx] = -1;\r\n };\r\n}\r\nfunction ContactSurface(packedArrays, boundaries, params, _indexList) {\r\n // Field generation method adapted from AstexViewer (Mike Hartshorn)\r\n // by Fred Ludlow.\r\n // Other parts based heavily on NGL (Alexander Rose) EDT Surface class\r\n //\r\n // Should work as a drop-in alternative to EDTSurface (though some of\r\n // the EDT paramters are not relevant in this method).\r\n\r\n const itemSize = 4;\r\n const { posRad, colors, atoms } = packedArrays;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const { bbox } = boundaries;\r\n\r\n const min = bbox.minPosRad;\r\n const max = bbox.maxPosRad;\r\n\r\n let r2; // Atom positions, expanded radii (squared)\r\n let maxRadius;\r\n\r\n // Parameters\r\n let probeRadius;\r\n let scaleFactor;\r\n let probePositions;\r\n\r\n // Cache last value for obscured test\r\n let lastClip = -1;\r\n\r\n // Grid params\r\n let dim;\r\n let grid;\r\n let volTex;\r\n let weights;\r\n let weightsMap = null;\r\n let atomMap = null;\r\n let visibilitySelector = null;\r\n\r\n\r\n // grid indices -> xyz coords\r\n let gridx;\r\n let gridy;\r\n let gridz;\r\n\r\n // Lookup tables:\r\n let sinTable;\r\n let cosTable;\r\n\r\n // Spatial Hash\r\n let hash;\r\n\r\n // Neighbour array to be filled by hash\r\n let neighbours;\r\n\r\n // Vectors for Torus Projection\r\n const mid = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n1 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n2 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n let ngTorus;\r\n\r\n function uniformArray(TypeName, n, a) {\r\n const array = utils.allocateTyped(TypeName, n);\r\n for (let innI = 0; innI < n; ++innI) {\r\n array[innI] = a;\r\n }\r\n\r\n return array;\r\n }\r\n\r\n function fillGridDim(a, start, step) {\r\n for (let innI = 0; innI < a.length; innI++) {\r\n a[innI] = start + (step * innI);\r\n }\r\n }\r\n\r\n function initializeGrid() {\r\n ({ scaleFactor } = params);\r\n ({ dim } = boundaries);\r\n\r\n ngTorus = Math.min(5, 2 + Math.floor(probeRadius * scaleFactor));\r\n\r\n const gridSize = dim[0] * dim[1] * dim[2];\r\n grid = uniformArray(Float32Array, gridSize, -1001.0);\r\n volTex = utils.allocateTyped(Float32Array, gridSize * 3);\r\n weights = utils.allocateTyped(Float32Array, gridSize);\r\n if (visibilitySelector) {\r\n weightsMap = utils.allocateTyped(Float32Array, gridSize);\r\n atomMap = [];\r\n }\r\n\r\n\r\n gridx = utils.allocateTyped(Float32Array, dim[0]);\r\n gridy = utils.allocateTyped(Float32Array, dim[1]);\r\n gridz = utils.allocateTyped(Float32Array, dim[2]);\r\n\r\n fillGridDim(gridx, min[0], 1 / scaleFactor);\r\n fillGridDim(gridy, min[1], 1 / scaleFactor);\r\n fillGridDim(gridz, min[2], 1 / scaleFactor);\r\n }\r\n\r\n function initializeAngleTables() {\r\n let theta = 0.0;\r\n const step = 2 * Math.PI / probePositions;\r\n\r\n cosTable = utils.allocateTyped(Float32Array, probePositions);\r\n sinTable = utils.allocateTyped(Float32Array, probePositions);\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n cosTable[innI] = Math.cos(theta);\r\n sinTable[innI] = Math.sin(theta);\r\n theta += step;\r\n }\r\n }\r\n\r\n function initializeHash() {\r\n hash = new AVHash(posRad, min, max, 2.01 * maxRadius);\r\n neighbours = new Int32Array(hash.neighbourListLength);\r\n }\r\n\r\n function init() {\r\n ({\r\n probeRadius,\r\n scaleFactor,\r\n probePositions,\r\n visibilitySelector,\r\n } = params);\r\n r2 = utils.allocateTyped(Float32Array, nAtoms);\r\n maxRadius = 0;\r\n for (let innI = 0; innI < nAtoms; ++innI) {\r\n const rExt = posRad[innI * itemSize + 3] += probeRadius;\r\n if (rExt > maxRadius) {\r\n maxRadius = rExt;\r\n }\r\n r2[innI] = rExt * rExt;\r\n }\r\n\r\n initializeGrid();\r\n initializeAngleTables();\r\n initializeHash();\r\n\r\n lastClip = -1;\r\n }\r\n\r\n function singleAtomObscures(ai, innX, innY, innZ) {\r\n const innCI = itemSize * ai;\r\n const ra2 = r2[ai];\r\n const dx = posRad[innCI] - innX;\r\n const dy = posRad[innCI + 1] - innY;\r\n const dz = posRad[innCI + 2] - innZ;\r\n const d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n return d2 < ra2;\r\n }\r\n\r\n function obscured(innX, innY, innZ, a, b) {\r\n // Is the point at x,y,z obscured by any of the atoms\r\n // specifeid by indices in neighbours. Ignore indices\r\n // a and b (these are the relevant atoms in projectPoints/Torii)\r\n\r\n // Cache the last clipped atom (as very often the same one in\r\n // subsequent calls)\r\n let ai;\r\n\r\n if (lastClip !== -1) {\r\n ai = lastClip;\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n return ai;\r\n }\r\n lastClip = -1;\r\n }\r\n\r\n let ni = 0;\r\n ai = neighbours[ni];\r\n while (ai >= 0) {\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n lastClip = ai;\r\n return ai;\r\n }\r\n ai = neighbours[++ni];\r\n }\r\n\r\n lastClip = -1;\r\n\r\n return -1;\r\n }\r\n\r\n function projectPoints() {\r\n // For each atom:\r\n // Iterate over a subsection of the grid, for each point:\r\n // If current value < 0.0, unvisited, set positive\r\n //\r\n // In any case: Project this point onto surface of the atomic sphere\r\n // If this projected point is not obscured by any other atom\r\n // Calcualte delta distance and set grid value to minimum of\r\n // itself and delta\r\n\r\n // Should we alias frequently accessed closure constiables??\r\n // Assume JS engine capable of optimizing this\r\n // anyway...\r\n const maxRad = 4.0;\r\n const sigma = (maxRad) / 3;\r\n const sigma2Inv = 1 / (2 * sigma * sigma);\r\n\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innCI = itemSize * innI;\r\n const ax = posRad[innCI];\r\n const ay = posRad[innCI + 1];\r\n const az = posRad[innCI + 2];\r\n const ar = posRad[innCI + 3];\r\n const ar2 = r2[innI];\r\n\r\n hash.withinRadii(ax, ay, az, ar, neighbours);\r\n\r\n // Number of grid points, round this up...\r\n const ng = Math.ceil(ar * scaleFactor);\r\n\r\n // Center of the atom, mapped to grid points (take floor)\r\n const iax = Math.floor(scaleFactor * (ax - min[0]));\r\n const iay = Math.floor(scaleFactor * (ay - min[1]));\r\n const iaz = Math.floor(scaleFactor * (az - min[2]));\r\n\r\n // Extents of grid to consider for this atom\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n // Add two to these points:\r\n // - iax are floor'd values so this ensures coverage\r\n // - these are loop limits (exclusive)\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n const colIdx = innI * 3;\r\n const cr = colors[colIdx];\r\n const cg = colors[colIdx + 1];\r\n const cb = colors[colIdx + 2];\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n const dz = gridz[iz] - az;\r\n const zOffset = dim[1] * dim[0] * iz;\r\n\r\n for (let iy = miny; iy < maxy; iy++) {\r\n const dy = gridy[iy] - ay;\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n\r\n for (let ix = minx; ix < maxx; ix++) {\r\n const idx = ix + zyOffset;\r\n const dx = gridx[ix] - ax;\r\n const d2 = dzy2 + dx * dx;\r\n\r\n\r\n if (d2 < ar2) {\r\n const w = Math.exp(-d2 * sigma2Inv);\r\n const cIdx = idx * 3;\r\n volTex[cIdx] += cr * w;\r\n volTex[cIdx + 1] += cg * w;\r\n volTex[cIdx + 2] += cb * w;\r\n weights[idx] += w;\r\n if (visibilitySelector !== null && w > weightsMap[idx]) {\r\n weightsMap[idx] = w;\r\n atomMap[idx] = atoms[innI];\r\n }\r\n\r\n if (grid[idx] < 0.0) {\r\n // Unvisited, make positive\r\n grid[idx] = -grid[idx];\r\n }\r\n // Project on to the surface of the sphere\r\n // sp is the projected point ( dx, dy, dz ) * ( ra / d )\r\n const d = Math.sqrt(d2);\r\n const ap = ar / d;\r\n let spx = dx * ap;\r\n let spy = dy * ap;\r\n let spz = dz * ap;\r\n\r\n spx += ax;\r\n spy += ay;\r\n spz += az;\r\n\r\n if (obscured(spx, spy, spz, innI, -1) === -1) {\r\n const dd = ar - d;\r\n if (dd < grid[idx]) {\r\n grid[idx] = dd;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function normalToLine(out, p) {\r\n out.x = out.y = out.z = 1.0;\r\n if (p.x !== 0) {\r\n out.x = (p.y + p.z) / -p.x;\r\n } else if (p.y !== 0) {\r\n out.y = (p.x + p.z) / -p.y;\r\n } else if (p.z !== 0) {\r\n out.z = (p.x + p.y) / -p.z;\r\n }\r\n return out;\r\n }\r\n\r\n function projectTorus(a, b) {\r\n const aIdx = itemSize * a;\r\n const bIdx = itemSize * b;\r\n const xa = posRad[aIdx];\r\n const ya = posRad[aIdx + 1];\r\n const za = posRad[aIdx + 2];\r\n const r1 = posRad[aIdx + 3];\r\n let dx = mid.x = posRad[bIdx] - xa;\r\n let dy = mid.y = posRad[bIdx + 1] - ya;\r\n let dz = mid.z = posRad[bIdx + 2] - za;\r\n const innR2 = posRad[bIdx + 3];\r\n let d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n // This check now redundant as already done in AVHash.withinRadii\r\n // if( d2 > (( r1 + r2 ) * ( r1 + r2 )) ){ return; }\r\n\r\n const d = Math.sqrt(d2);\r\n\r\n // Find angle between a->b vector and the circle\r\n // of their intersection by cosine rule\r\n const cosA = (r1 * r1 + d * d - innR2 * innR2) / (2.0 * r1 * d);\r\n\r\n // distance along a->b at intersection\r\n const dmp = r1 * cosA;\r\n\r\n mid.normalize();\r\n\r\n // Create normal to line\r\n normalToLine(n1, mid);\r\n n1.normalize();\r\n\r\n // Cross together for second normal vector\r\n n2.crossVectors(mid, n1);\r\n n2.normalize();\r\n\r\n // r is radius of circle of intersection\r\n const rInt = Math.sqrt(r1 * r1 - dmp * dmp);\r\n\r\n n1.multiplyScalar(rInt);\r\n n2.multiplyScalar(rInt);\r\n mid.multiplyScalar(dmp);\r\n\r\n mid.x += xa;\r\n mid.y += ya;\r\n mid.z += za;\r\n\r\n lastClip = -1;\r\n\r\n const ng = ngTorus;\r\n\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n const cost = cosTable[innI];\r\n const sint = sinTable[innI];\r\n\r\n const px = mid.x + cost * n1.x + sint * n2.x;\r\n const py = mid.y + cost * n1.y + sint * n2.y;\r\n const pz = mid.z + cost * n1.z + sint * n2.z;\r\n\r\n if (obscured(px, py, pz, a, b) === -1) {\r\n // As above, iterate over our grid...\r\n // px, py, pz in grid coords\r\n const iax = Math.floor(scaleFactor * (px - min[0]));\r\n const iay = Math.floor(scaleFactor * (py - min[1]));\r\n const iaz = Math.floor(scaleFactor * (pz - min[2]));\r\n\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n dz = pz - gridz[iz];\r\n const zOffset = dim[1] * dim[0] * iz;\r\n for (let iy = miny; iy < maxy; iy++) {\r\n dy = py - gridy[iy];\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n for (let ix = minx; ix < maxx; ix++) {\r\n dx = px - gridx[ix];\r\n d2 = dzy2 + dx * dx;\r\n const idx = ix + zyOffset;\r\n const current = grid[idx];\r\n\r\n if (current > 0.0 && d2 < (current * current)) {\r\n grid[idx] = Math.sqrt(d2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function projectTorii() {\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innIdx = itemSize * innI;\r\n hash.withinRadii(\r\n posRad[innIdx], posRad[innIdx + 1], posRad[innIdx + 2],\r\n posRad[innIdx + 3], neighbours,\r\n );\r\n let ia = 0;\r\n let ni = neighbours[ia];\r\n while (ni >= 0) {\r\n if (innI < ni) {\r\n projectTorus(innI, ni);\r\n }\r\n ni = neighbours[++ia];\r\n }\r\n }\r\n }\r\n\r\n function fixNegatives() {\r\n for (let innI = 0, n = grid.length; innI < n; innI++) {\r\n if (grid[innI] < 0) grid[innI] = 0;\r\n let w = weights[innI];\r\n if (w > 0) {\r\n w = 1 / w;\r\n const innInnI = innI * 3;\r\n volTex[innInnI] *= w;\r\n volTex[innInnI + 1] *= w;\r\n volTex[innInnI + 2] *= w;\r\n }\r\n }\r\n }\r\n\r\n function getVolume() {\r\n // Basic steps are:\r\n // 1) Initialize\r\n // 2) Project points\r\n // 3) Project torii\r\n console.time('ContactSurface.getVolume');\r\n\r\n console.time('ContactSurface.init');\r\n init();\r\n console.timeEnd('ContactSurface.init');\r\n\r\n console.time('ContactSurface.projectPoints');\r\n projectPoints();\r\n console.timeEnd('ContactSurface.projectPoints');\r\n\r\n console.time('ContactSurface.projectTorii');\r\n projectTorii();\r\n console.timeEnd('ContactSurface.projectTorii');\r\n fixNegatives();\r\n console.timeEnd('ContactSurface.getVolume');\r\n }\r\n\r\n this.build = function () {\r\n // type and cutoff left in for compatibility with EDTSurface.getSurface\r\n // function signature\r\n getVolume();\r\n this.volTexMap = volTex;\r\n this.weightsMap = weightsMap;\r\n this.atomMap = atomMap;\r\n this.volMap = grid;\r\n };\r\n}\r\nexport default ContactSurface;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport ContactSurface from './ContactSurface';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'contact' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass ContactSurfaceGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n const contactSurface = new ContactSurface(packedArrays, boundaries, params);\r\n contactSurface.build();\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.volMap),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3, contactSurface.volTexMap),\r\n atomMap: contactSurface.atomMap,\r\n atomWeightMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.weightsMap),\r\n };\r\n return surface;\r\n }\r\n}\r\n\r\nexport default ContactSurfaceGeometry;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for colored atom. Need for atom structure clusterization\r\n *\r\n * @param {Vector3} vCenter Center of atom\r\n * @param {number} radiusAt Radius of atom\r\n */\r\nclass IsoSurfaceAtomColored {\r\n constructor(vCenter, radiusAt) {\r\n this.coord = new THREE.Vector3();\r\n this.coord.copy(vCenter);\r\n this.radius = radiusAt;\r\n this.colorX = 0.99999;\r\n this.colorY = 0.0;\r\n this.colorZ = 0.0;\r\n this.atomType = 0;\r\n this.srcAtom = null;\r\n }\r\n}\r\nexport default IsoSurfaceAtomColored;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n// suppress some JSHint warnings\r\n/* jshint bitwise: false */\r\n\r\n/**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numAtoms - Number of atoms in molecule\r\n * @param {Element} atoms - Array of atoms\r\n * @param {Vector3} vBoxMin - Bounding box min\r\n * @param {Vector3} vBoxMax - Bounding box max\r\n * @param {number} probeRadius - Normals for output\r\n *\r\n */\r\nclass IsosurfaceBuildNormals {\r\n constructor(numAtoms, atoms, vBoxMin, vBoxMax, probeRadius) {\r\n this._numAtoms = numAtoms;\r\n this._atoms = atoms;\r\n this._vBoxMin = new THREE.Vector3();\r\n this._vBoxMax = new THREE.Vector3();\r\n this._vBoxMin.copy(vBoxMin);\r\n this._vBoxMax.copy(vBoxMax);\r\n this._probeRadius = probeRadius;\r\n\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n }\r\n\r\n createVoxels() {\r\n let numAtomsRefs;\r\n let rad;\r\n const ATOM_VOXEL_REF_SCALE = 4.5;\r\n\r\n const numAtoms = this._numAtoms | 0;\r\n const atoms = this._atoms;\r\n const dx = this._vBoxMax.x - this._vBoxMin.x;\r\n const dy = this._vBoxMax.y - this._vBoxMin.y;\r\n const dz = this._vBoxMax.z - this._vBoxMin.z;\r\n let w = (dx < dy) ? dx : dy;\r\n w = (dz < w) ? dz : w;\r\n let maxRad = 0.0;\r\n let aveRad = 0.0;\r\n\r\n let i;\r\n for (i = 0; i < numAtoms; i++) {\r\n rad = (atoms[i].radius + this._probeRadius) * 2.0;\r\n maxRad = (rad > maxRad) ? rad : maxRad;\r\n aveRad += rad;\r\n }\r\n let numCells = Math.floor(w / maxRad);\r\n if (numCells < 2) {\r\n numCells = 2;\r\n }\r\n aveRad /= numAtoms;\r\n\r\n this._numCells = numCells;\r\n this._aveRad = aveRad;\r\n this._maxRad = maxRad;\r\n\r\n const side = numCells;\r\n const side2 = numCells * numCells;\r\n const side3 = numCells * numCells * numCells;\r\n\r\n const xScale = this._xScale = 1.0 / (this._vBoxMax.x - this._vBoxMin.x);\r\n const yScale = this._yScale = 1.0 / (this._vBoxMax.y - this._vBoxMin.y);\r\n const zScale = this._zScale = 1.0 / (this._vBoxMax.z - this._vBoxMin.z);\r\n\r\n // estimate number of individual atom refs in each voxel list\r\n let maxAtomsRefs = 0;\r\n\r\n const xNumVoxMult = xScale * numCells;\r\n const yNumVoxMult = yScale * numCells;\r\n const zNumVoxMult = zScale * numCells;\r\n\r\n for (i = 0; i < numAtoms; i++) {\r\n const radAffect = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n const diaAffect = radAffect * 2.0;\r\n let numVoxX = Math.floor(xNumVoxMult * diaAffect + 0.8);\r\n let numVoxY = Math.floor(yNumVoxMult * diaAffect + 0.8);\r\n let numVoxZ = Math.floor(zNumVoxMult * diaAffect + 0.8);\r\n // avoid case numVox? == 0\r\n // also use loop i <=\r\n numVoxX++;\r\n numVoxY++;\r\n numVoxZ++;\r\n maxAtomsRefs += numVoxX * numVoxY * numVoxZ;\r\n } // for (i)\r\n // maxAtomsRefs = numAtoms * MAX_ATOMS_IN_SINGLE_VOXEL;\r\n\r\n\r\n this._voxelList = utils.allocateTyped(Int32Array, side3);\r\n const atomsList = [];\r\n atomsList.length = maxAtomsRefs;\r\n if ((this._voxelList === null) || (atomsList === null)) {\r\n return 0 - 1;\r\n }\r\n // init voxel list\r\n for (i = 0; i < side3; i++) {\r\n this._voxelList[i] = -1;\r\n }\r\n numAtomsRefs = 0;\r\n\r\n // create voxel lists\r\n for (i = 0; i < numAtoms; i++) {\r\n // use multiplier 4 to locate this atom in different voxels\r\n rad = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n let xIndMin = Math.floor((atoms[i].coord.x - this._vBoxMin.x - rad) * numCells * xScale);\r\n let yIndMin = Math.floor((atoms[i].coord.y - this._vBoxMin.y - rad) * numCells * yScale);\r\n let zIndMin = Math.floor((atoms[i].coord.z - this._vBoxMin.z - rad) * numCells * zScale);\r\n let xIndMax = Math.floor((atoms[i].coord.x - this._vBoxMin.x + rad) * numCells * xScale);\r\n let yIndMax = Math.floor((atoms[i].coord.y - this._vBoxMin.y + rad) * numCells * yScale);\r\n let zIndMax = Math.floor((atoms[i].coord.z - this._vBoxMin.z + rad) * numCells * zScale);\r\n\r\n xIndMin = (xIndMin >= 0) ? xIndMin : 0;\r\n yIndMin = (yIndMin >= 0) ? yIndMin : 0;\r\n zIndMin = (zIndMin >= 0) ? zIndMin : 0;\r\n\r\n xIndMax = (xIndMax < numCells) ? xIndMax : (numCells - 1);\r\n yIndMax = (yIndMax < numCells) ? yIndMax : (numCells - 1);\r\n zIndMax = (zIndMax < numCells) ? zIndMax : (numCells - 1);\r\n\r\n for (let z = zIndMin; z <= zIndMax; z++) {\r\n for (let y = yIndMin; y <= yIndMax; y++) {\r\n for (let x = xIndMin; x <= xIndMax; x++) {\r\n // add atom with index \"i\" to this voxel list\r\n const indVoxel = x + y * side + z * side2;\r\n // assert indVoxel >= 0\r\n // assert indVoxel < side3\r\n\r\n // add first\r\n if (this._voxelList[indVoxel] < 0) {\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = 0 - 1;\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n numAtomsRefs++;\r\n // assert numAtomsRefs < maxAtomsRefs - 1\r\n continue;\r\n }\r\n // insert into head of list\r\n const indexNext = this._voxelList[indVoxel];\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = indexNext;\r\n numAtomsRefs++;\r\n } // for (x)\r\n } // for (y)\r\n } // for (z)\r\n } // for (i)\r\n\r\n // convert Array to Int32Array\r\n this._atomsList = Int32Array.from(atomsList);\r\n\r\n return 0;\r\n }\r\n\r\n destroyVoxels() {\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n\r\n this._atoms = null;\r\n this._vertices = null;\r\n this._vBoxMin = null;\r\n this._vBoxMax = null;\r\n }\r\n\r\n /**\r\n * Enumerate all atoms affecting specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n * @param {func(atom)} process - function to call for each atom\r\n */\r\n forEachRelatedAtom(point, process) {\r\n // find corresponding voxel\r\n const xInd = Math.floor((point.x - this._vBoxMin.x) * this._numCells * this._xScale);\r\n const yInd = Math.floor((point.y - this._vBoxMin.y) * this._numCells * this._yScale);\r\n const zInd = Math.floor((point.z - this._vBoxMin.z) * this._numCells * this._zScale);\r\n const indVoxel = xInd + yInd * this._numCells + zInd * this._numCells * this._numCells;\r\n\r\n // run through atoms affecting this voxel\r\n const atoms = this._atoms;\r\n for (let ref = this._voxelList[indVoxel]; ref >= 0; ref = this._atomsList[ref * 2 + 1]) {\r\n const indexAtom = this._atomsList[ref * 2];\r\n process(atoms[indexAtom]);\r\n }\r\n }\r\n\r\n /**\r\n * Get atom closest to specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n *\r\n * @returns {IsoSurfaceAtomColored} atom, or null if not found\r\n */\r\n getClosestAtom(point) {\r\n let closest = null;\r\n let minDist2 = Number.MAX_VALUE;\r\n\r\n this.forEachRelatedAtom(point, (atom) => {\r\n const dist2 = point.distanceToSquared(atom.coord);\r\n if (dist2 < minDist2) {\r\n minDist2 = dist2;\r\n closest = atom;\r\n }\r\n });\r\n\r\n return closest;\r\n }\r\n\r\n /**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} normals - Normals for output\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildNormals(numVertices, vertices, normals) {\r\n const self = this;\r\n let numCloseAtoms = 0;\r\n let vx = 0;\r\n let vy = 0;\r\n let vz = 0;\r\n let dist2;\r\n let vNormalX = 0;\r\n let vNormalY = 0;\r\n let vNormalZ = 0;\r\n let koef = 0;\r\n let w = 0;\r\n const r25 = 2.5;\r\n const r01 = 0.1;\r\n\r\n const maxRadAffect = this._aveRad * r25;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n const expScale = -this._aveRad * r01;\r\n\r\n // some stats\r\n // numSlowAtoms = 0;\r\n\r\n const gatherNormals = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = Math.exp(expScale * koef);\r\n\r\n vNormalX += dx * w;\r\n vNormalY += dy * w;\r\n vNormalZ += dz * w;\r\n numCloseAtoms++;\r\n };\r\n\r\n let maxClosedAtoms = 0;\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n numCloseAtoms = 0;\r\n vNormalX = vNormalY = vNormalZ = 0.0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherNormals);\r\n\r\n maxClosedAtoms = (numCloseAtoms > maxClosedAtoms) ? numCloseAtoms : maxClosedAtoms;\r\n\r\n // normalize vNormal\r\n dist2 = vNormalX * vNormalX + vNormalY * vNormalY + vNormalZ * vNormalZ;\r\n if (numCloseAtoms > 0) {\r\n koef = 1.0 / Math.sqrt(dist2);\r\n vNormalX *= koef;\r\n vNormalY *= koef;\r\n vNormalZ *= koef;\r\n }\r\n normals[i].x = vNormalX;\r\n normals[i].y = vNormalY;\r\n normals[i].z = vNormalZ;\r\n } // for (i) all vertices\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Build vertex colors for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} colors - Colors for output\r\n * @param {number} radiusColorSmoothness - Radius of smoothness sphere\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildColors(numVertices, vertices, colors, radiusColorSmoothness) {\r\n const self = this;\r\n let vx = 0.0;\r\n let vy = 0.0;\r\n let vz = 0.0;\r\n let koef = 0.0;\r\n let w = 0.0;\r\n const KOEF_ADD = 0.8;\r\n\r\n const maxRadAffect = radiusColorSmoothness;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n\r\n let colorsClose = [];\r\n let weights = [];\r\n let weightsSum = 0;\r\n\r\n const gatherColors = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = 1.0 / (KOEF_ADD + koef);\r\n\r\n colorsClose.push([atom.colorX, atom.colorY, atom.colorZ]);\r\n weights.push(w); // save weights for use\r\n weightsSum += w; // calc sum of weights fo further normalization\r\n };\r\n\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n colorsClose = [];\r\n weights = [];\r\n weightsSum = 0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherColors);\r\n\r\n // normalized weighted sum of colors\r\n for (let j = 0; j < colorsClose.length; ++j) {\r\n const weightNormalized = weights[j] / weightsSum;\r\n colors[i].x += colorsClose[j][0] * weightNormalized;\r\n colors[i].y += colorsClose[j][1] * weightNormalized;\r\n colors[i].z += colorsClose[j][2] * weightNormalized;\r\n }\r\n } // for (i) all vertices\r\n return 0;\r\n }\r\n}\r\nexport default IsosurfaceBuildNormals;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for geometry (triangle mesh) representation\r\n *\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices in mesh\r\n * @param {number} maxNumTriangles Maximum possible number of triangles in mesh\r\n * @param {boolean} needVertexColors Obvious\r\n */\r\nclass IsoSurfaceGeo {\r\n constructor(maxNumVertices, maxNumTriangles, needVertexColors) {\r\n this._maxNumVertices = maxNumVertices;\r\n this._maxNumTriangles = maxNumTriangles;\r\n this._vertices = new Array(maxNumVertices);\r\n this._normals = new Array(maxNumVertices);\r\n this._colors = null;\r\n if (needVertexColors) {\r\n this._colors = new Array(maxNumVertices);\r\n }\r\n this._indices = new Array(maxNumTriangles * (1 + 2));\r\n this._numVertices = 0;\r\n this._numTriangles = 0;\r\n\r\n let i;\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._vertices[i] = new THREE.Vector3();\r\n this._normals[i] = new THREE.Vector3();\r\n }\r\n for (i = 0; i < maxNumTriangles * (1 + 2); i++) {\r\n this._indices[i] = -1;\r\n }\r\n if (needVertexColors) {\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._colors[i] = new THREE.Vector3();\r\n }\r\n }\r\n }\r\n\r\n destroy() {\r\n this._vertices = null;\r\n this._normals = null;\r\n this._indices = null;\r\n }\r\n}\r\nexport default IsoSurfaceGeo;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurfaceAtomColored from './IsoSurfaceAtomColored';\r\nimport IsosurfaceBuildNormals from './IsosurfaceBuildNormals';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport IsoSurfaceGeo from './IsoSurfaceGeo';\r\nimport chem from '../../chem';\r\nimport utils from '../../utils';\r\n\r\nconst COLOR_SIZE = 3;\r\nconst HASH_SIZE = 32768;\r\nconst { Element } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass SSIsosurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n // convert geoOut into arrays of positions, indices, normals\r\n this._innerBuild();\r\n const geoOut = this.getGeo();\r\n this.destroy();\r\n this._fromGeo(geoOut);\r\n }\r\n\r\n _fromGeo(geoOut) {\r\n let colors = null;\r\n const positions = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n const normals = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n if (geoOut._colors !== null) {\r\n colors = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n }\r\n const indices = utils.allocateTyped(Uint32Array, (1 + 2) * geoOut._numTriangles);\r\n\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++) {\r\n positions[j + 0] = (geoOut._vertices[i].x);\r\n positions[j + 1] = (geoOut._vertices[i].y);\r\n positions[j + 2] = (geoOut._vertices[i].z);\r\n normals[j + 0] = geoOut._normals[i].x;\r\n normals[j + 1] = geoOut._normals[i].y;\r\n normals[j + 2] = geoOut._normals[i].z;\r\n j += 3;\r\n }\r\n if (colors !== null) {\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++, j += 3) {\r\n colors[j + 0] = geoOut._colors[i].x;\r\n colors[j + 1] = geoOut._colors[i].y;\r\n colors[j + 2] = geoOut._colors[i].z;\r\n }\r\n }\r\n\r\n const numTri3 = geoOut._numTriangles * (1 + 2);\r\n for (let i = 0; i < numTri3; i++) {\r\n indices[i] = geoOut._indices[i];\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(positions, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(colors, 3));\r\n this.computeBoundingBox();\r\n this.computeBoundingSphere();\r\n\r\n geoOut.destroy();\r\n }\r\n\r\n convertToAtomsColored(packedArrays, atomsColored) {\r\n const { atoms, colors } = packedArrays;\r\n for (let i = 0, numAtoms = atoms.length; i < numAtoms; i++) {\r\n const vCenter = atoms[i].position;\r\n const { radius } = atoms[i].element;\r\n atomsColored[i] = new IsoSurfaceAtomColored(vCenter, radius);\r\n const nm = atoms[i].element.number;\r\n atomsColored[i].atomType = this.getType(nm);\r\n let cIdx = COLOR_SIZE * i;\r\n atomsColored[i].colorX = colors[cIdx++];\r\n atomsColored[i].colorY = colors[cIdx++];\r\n atomsColored[i].colorZ = colors[cIdx];\r\n atomsColored[i].srcAtom = atoms[i];\r\n }\r\n }\r\n\r\n getGeo() {\r\n return this.geoOut;\r\n }\r\n\r\n destroy() {\r\n this.atoms = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n }\r\n\r\n /**\r\n * Calculates bounding box for array with spheres (atoms)\r\n *\r\n * @param {Object} atoms Atoms array\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n */\r\n getBoundingBox(atoms, vBoxMin, vBoxMax) {\r\n const bigNum = 10000000.0;\r\n\r\n vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum;\r\n vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum;\r\n\r\n const probeRadius2 = this.probeRadius * this.atomRadiusScale;\r\n let radMax = 0.0;\r\n for (let i = 0, num = atoms.length; i < num; i++) {\r\n const vCenter = atoms[i].coord;\r\n const rad = atoms[i].radius + probeRadius2;\r\n radMax = (rad > radMax) ? rad : radMax;\r\n if (vCenter.x - rad < vBoxMin.x) {\r\n vBoxMin.x = vCenter.x - rad;\r\n }\r\n if (vCenter.y - rad < vBoxMin.y) {\r\n vBoxMin.y = vCenter.y - rad;\r\n }\r\n if (vCenter.z - rad < vBoxMin.z) {\r\n vBoxMin.z = vCenter.z - rad;\r\n }\r\n if (vCenter.x + rad > vBoxMax.x) {\r\n vBoxMax.x = vCenter.x + rad;\r\n }\r\n if (vCenter.y + rad > vBoxMax.y) {\r\n vBoxMax.y = vCenter.y + rad;\r\n }\r\n if (vCenter.z + rad > vBoxMax.z) {\r\n vBoxMax.z = vCenter.z + rad;\r\n }\r\n }\r\n vBoxMin.x -= radMax;\r\n vBoxMin.y -= radMax;\r\n vBoxMin.z -= radMax;\r\n vBoxMax.x += radMax;\r\n vBoxMax.y += radMax;\r\n vBoxMax.z += radMax;\r\n }\r\n\r\n /**\r\n * Calculate (x,y,z) cordinate of the cell corner point\r\n *\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {number} x Cell integer x coordinate\r\n * @param {number} y Cell integer y coordinate\r\n * @param {number} z Cell integer z coordinate\r\n * @param {number} numPoints NUm points in cell on side\r\n * @param {Vector3} vOut Output vector\r\n */\r\n getCornerCoord(vBoxMin, vBoxMax, x, y, z, numPoints, vOut) {\r\n const invNP = 1.0 / (numPoints - 1.0);\r\n const tx = x * invNP;\r\n const ty = y * invNP;\r\n const tz = z * invNP;\r\n\r\n vOut.x = vBoxMin.x * (1.0 - tx) + vBoxMax.x * tx;\r\n vOut.y = vBoxMin.y * (1.0 - ty) + vBoxMax.y * ty;\r\n vOut.z = vBoxMin.z * (1.0 - tz) + vBoxMax.z * tz;\r\n }\r\n\r\n /**\r\n * Calculate point of intersection of sphere surface\r\n * and cell edge, given by [indexA, indexB] line\r\n *\r\n * @param {number} indexA Cell vertex index in [0..11]\r\n * @param {number} indexB Cell vertex index in [0..11]\r\n * @param {array} sign Sign array for all 8 vertices\r\n * @param {object} cube Cube\r\n * @param {number} indexPointValue for value placement\r\n * @param {Vector3} vOut Point of intersection\r\n */\r\n buildEdgePoint(indexA, indexB, sign, cube, indexPointValue, vOut) {\r\n if (sign[indexA] ^ sign[indexB]) {\r\n const cTwentyFour = 24;\r\n const t = (0 - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA])\r\n / (cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexB]\r\n - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]);\r\n const xa = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 0];\r\n const ya = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 1];\r\n const za = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 2];\r\n const xb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 0];\r\n const yb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 1];\r\n const zb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 2];\r\n\r\n vOut.x = xa * (1.0 - t) + xb * t;\r\n vOut.y = ya * (1.0 - t) + yb * t;\r\n vOut.z = za * (1.0 - t) + zb * t;\r\n }\r\n }\r\n\r\n /**\r\n * Check if triangle is visible (vertices are close to atoms included in visibility set)\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} true if triangle is visible\r\n */\r\n isTriangleVisible(v0, v1, v2) {\r\n const a0 = this.voxelWorld.getClosestAtom(v0);\r\n const a1 = this.voxelWorld.getClosestAtom(v1);\r\n const a2 = this.voxelWorld.getClosestAtom(v2);\r\n if (a0 === null || a1 === null || a2 === null\r\n || a0.srcAtom === null || a1.srcAtom === null || a2.srcAtom === null) {\r\n return false;\r\n }\r\n\r\n return this.visibilitySelector.includesAtom(a0.srcAtom)\r\n && this.visibilitySelector.includesAtom(a1.srcAtom)\r\n && this.visibilitySelector.includesAtom(a2.srcAtom);\r\n }\r\n\r\n /**\r\n * Add triangle to result geometry\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} false if no more triangles can be added\r\n */\r\n addTriangle(v0, v1, v2) {\r\n if (this.visibilitySelector && !this.isTriangleVisible(v0, v1, v2)) {\r\n return true;\r\n }\r\n\r\n const geo = this.geoOut;\r\n\r\n if (geo._numTriangles >= this.maxNumTriangles) {\r\n return false;\r\n }\r\n\r\n // Add vertex with optimize\r\n const indInGeo0 = this.addVertexToGeo(geo, v0);\r\n const indInGeo1 = this.addVertexToGeo(geo, v1);\r\n const indInGeo2 = this.addVertexToGeo(geo, v2);\r\n if ((indInGeo0 | indInGeo1 | indInGeo2) < 0) {\r\n return false;\r\n }\r\n\r\n const itr = 3 * geo._numTriangles;\r\n geo._indices[itr + 0] = indInGeo0;\r\n geo._indices[itr + 1] = indInGeo1;\r\n geo._indices[itr + 2] = indInGeo2;\r\n geo._numTriangles++;\r\n return true;\r\n }\r\n\r\n /**\r\n * Build result geometry (triangle mesh) from marching cube cells\r\n *\r\n * @param {number} meshRes Marchnig cube vertex count on each side\r\n * @param {Vector3} vBoxMin Bounding box point min\r\n * @param {Vector3} vBoxMax Bounding box point max\r\n * @param {number} corners float values array for each cube point\r\n * @param {Vector3} vCellStep vector to next cube cell diagonal point\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} 0, if success (<0) is error\r\n */\r\n buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) {\r\n const arrSize = 12;\r\n const cNumVerts = 8;\r\n const numCells = meshRes - 1;\r\n const side = meshRes;\r\n const side2 = meshRes * meshRes;\r\n\r\n const vaEdges = new Array(arrSize);\r\n for (let i = 0; i < arrSize; i++) {\r\n vaEdges[i] = new THREE.Vector3();\r\n }\r\n const sign = [];\r\n for (let i = 0; i < cNumVerts; i++) {\r\n sign[i] = 1.0;\r\n }\r\n const vCorner = new THREE.Vector3();\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n if (!cube.hasIntersection[indCell]) {\r\n // next cell\r\n indCell++;\r\n continue;\r\n }\r\n const bitsInside = cube.bitsInside[indCell];\r\n\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, meshRes, vCorner);\r\n\r\n const indPointValues = indCell * (2 << (2 + 2));\r\n for (let i = 0, j = 0; i < cNumVerts; i++) {\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.x;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.y;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.z;\r\n }\r\n\r\n cube.pointsValuesLinear[indPointValues + 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 2 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3] += vCellStep.x;\r\n\r\n cube.pointsValuesLinear[indPointValues + 2 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 3 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 2] += vCellStep.z;\r\n\r\n cube.pointsValuesLinear[indPointValues + 4 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 1] += vCellStep.y;\r\n\r\n\r\n // now current cell has intersections (from -x to +x) on some cube edges\r\n const indValues = indPointValues + 24;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n sign[i] = (cube.pointsValuesLinear[indValues + i] < 0.0) ? 1 : 0;\r\n }\r\n\r\n this.buildEdgePoint(0, 1, sign, cube, indPointValues, vaEdges[0]);\r\n this.buildEdgePoint(1, 2, sign, cube, indPointValues, vaEdges[1]);\r\n this.buildEdgePoint(2, 3, sign, cube, indPointValues, vaEdges[2]);\r\n this.buildEdgePoint(3, 0, sign, cube, indPointValues, vaEdges[3]);\r\n\r\n this.buildEdgePoint(4, 5, sign, cube, indPointValues, vaEdges[4]);\r\n this.buildEdgePoint(5, 6, sign, cube, indPointValues, vaEdges[5]);\r\n this.buildEdgePoint(6, 7, sign, cube, indPointValues, vaEdges[6]);\r\n this.buildEdgePoint(7, 4, sign, cube, indPointValues, vaEdges[7]);\r\n\r\n this.buildEdgePoint(0, 4, sign, cube, indPointValues, vaEdges[8]);\r\n this.buildEdgePoint(1, 5, sign, cube, indPointValues, vaEdges[9]);\r\n this.buildEdgePoint(2, 6, sign, cube, indPointValues, vaEdges[10]);\r\n this.buildEdgePoint(3, 7, sign, cube, indPointValues, vaEdges[11]);\r\n\r\n const offs = bitsInside * (2 << (1 + 2));\r\n for (let numTri = 0, indTri = 0; numTri < (2 + 2 + 2); numTri++, indTri += 3) {\r\n // s_triIndicesMarchCube is external array, defined in mold_ind.js\r\n const i0 = cube.striIndicesMarchCube[offs + indTri];\r\n if (i0 < 0) {\r\n break;\r\n }\r\n const i1 = cube.striIndicesMarchCube[offs + indTri + 1];\r\n const i2 = cube.striIndicesMarchCube[offs + indTri + 2];\r\n\r\n if (!this.addTriangle(vaEdges[i0], vaEdges[i1], vaEdges[i2])) {\r\n return 0 - 2;\r\n }\r\n } // for numTri\r\n\r\n // next cell (cube)\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return 0;\r\n }\r\n\r\n /**\r\n * Returns number of cell with intersection with at least one sphere.\r\n * Using this number, we can estimate required number of vertices\r\n * and triangles to build result mesh.\r\n *\r\n * @param {number} side Number of points in cube voxels\r\n * @param {number} numCells Number of cells in cube voxels (per direction)\r\n * @param {array} corners Array of float values for cube corner points\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} numIntersectedCells\r\n */\r\n getNumIntersectedCells(side, numCells, corners, cube) {\r\n const side2 = side * side;\r\n const cNumVerts = 8;\r\n let numIntersectedCells = 0;\r\n\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n const cubeValuesIndex = indCell * (2 << (2 + 2)) + 24;\r\n const indCorner = x + indZ + indY;\r\n\r\n cube.pointsValuesLinear[cubeValuesIndex] = corners[indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 1] = corners[indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 2] = corners[indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 3] = corners[indCorner + side];\r\n cube.pointsValuesLinear[cubeValuesIndex + 4] = corners[side2 + indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 5] = corners[side2 + indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 6] = corners[side2 + indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 7] = corners[side2 + indCorner + side];\r\n\r\n // check read exception\r\n // assert(side2 + indCorner + side + 1 < side3);\r\n\r\n // get bit flags inside\r\n let bitsInside = 0;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n if (cube.pointsValuesLinear[cubeValuesIndex + i] < 0.0) {\r\n bitsInside |= (1 << i);\r\n }\r\n }\r\n\r\n if ((bitsInside === 0) || (bitsInside === ((1 << cNumVerts) - 1))) {\r\n cube.hasIntersection[indCell] = false;\r\n } else {\r\n cube.hasIntersection[indCell] = true;\r\n numIntersectedCells++;\r\n }\r\n cube.bitsInside[indCell] = bitsInside;\r\n // next cell\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return numIntersectedCells;\r\n }\r\n\r\n getType(letter) {\r\n /* eslint-disable no-magic-numbers */\r\n const atomT = [0, 0, 1, 1, 2, 6, 3, 6, 4, 6, 5, 6, 6, 0, 7, 3, 8, 2, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 4,\r\n 16, 5, 17, 6, 18, 6, 19, 6, 20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6,\r\n 32, 6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, 45, 6, 46, 6, 47, 6,\r\n 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, 6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6,\r\n 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6,\r\n 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, 95, 6,\r\n 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, 6, 108, 6, 109, 6];\r\n /* eslint-enable no-magic-numbers */\r\n\r\n if (letter < 1 || letter > atomT.length / 2\r\n || (Object.keys(Element.ByAtomicNumber).length * 2) !== atomT.length) {\r\n throw new Error('atomT.length should be equal Element.ByAtomicNumber.length * 2');\r\n }\r\n return atomT[letter * 2];\r\n }\r\n\r\n\r\n /**\r\n * Calculate values for marching cube grid points\r\n * positive values are outside sphere, negative - is inside\r\n *\r\n * @param {array} corners array of float values\r\n * @param {number} side Number of point in cube in 1 dimennsion\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {array} atoms Array of input atoms\r\n * @param {number} probeRad radius for atom probing\r\n */\r\n calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) {\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const vCorner = new THREE.Vector3();\r\n const vDif = new THREE.Vector3();\r\n /* eslint-disable no-magic-numbers */\r\n const aLot = +1.0e12;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n for (let i = 0; i < side3; i++) {\r\n corners[i] = aLot; // to large value\r\n }\r\n\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n for (let s = 0, numAtoms = atoms.length; s < numAtoms; s++) {\r\n const atom = atoms[s];\r\n const radius = atom.radius + probeRad;\r\n\r\n const fx = ((atom.coord.x - radius) - vBoxMin.x) * xScale;\r\n const fy = ((atom.coord.y - radius) - vBoxMin.y) * yScale;\r\n const fz = ((atom.coord.z - radius) - vBoxMin.z) * zScale;\r\n\r\n const indXMin = Math.floor(fx);\r\n const indYMin = Math.floor(fy);\r\n const indZMin = Math.floor(fz);\r\n\r\n let indXMax = Math.floor(((atom.coord.x + radius) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((atom.coord.y + radius) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((atom.coord.z + radius) - vBoxMin.z) * zScale);\r\n\r\n indXMax++;\r\n indYMax++;\r\n indZMax++;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let y = indYMin; y <= indYMax; y++) {\r\n const indY = y * side2;\r\n for (let z = indZMin; z <= indZMax; z++) {\r\n const indZ = z * side;\r\n for (let x = indXMin; x <= indXMax; x++) {\r\n const ind = indY + indZ + x;\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, side, vCorner);\r\n vDif.x = vCorner.x - atom.coord.x;\r\n vDif.y = vCorner.y - atom.coord.y;\r\n vDif.z = vCorner.z - atom.coord.z;\r\n const distToSphere = Math.sqrt(vDif.x * vDif.x + vDif.y * vDif.y + vDif.z * vDif.z);\r\n // val: < 0, if inside sphere\r\n // val: > 0, if outside sphere\r\n const val = distToSphere - radius;\r\n if (val < corners[ind]) {\r\n corners[ind] = val;\r\n }\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n } // for (s)\r\n }\r\n\r\n /**\r\n * Create memory pool for vertex hash management\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices (that will be build)\r\n * @param {number} maxNumTriangles Maximum possible number of triangles (that will be build)\r\n * @returns {number} 0, if success. (<0) is non memory\r\n */\r\n createVertexHash(maxNumVertices, maxNumTriangles) {\r\n this.hashLines = utils.allocateTyped(Int32Array, HASH_SIZE * 2);\r\n if (this.hashLines === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < HASH_SIZE; i++) {\r\n this.hashLines[j++] = 0; // num vertices in this hash line\r\n this.hashLines[j++] = 0 - 1; // index of the first entry\r\n }\r\n\r\n this.maxNumVertices = maxNumVertices;\r\n this.maxNumTriangles = maxNumTriangles;\r\n\r\n this.numHashEtriesAllocated = maxNumVertices;\r\n this.hashEntries = utils.allocateTyped(Int32Array, 2 * this.numHashEtriesAllocated);\r\n if (this.hashEntries === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < this.numHashEtriesAllocated; i++) {\r\n this.hashEntries[j++] = 0 - 1; // index of vertex\r\n this.hashEntries[j++] = 0 - 1; // next hash entry index\r\n }\r\n this.numHashEntryIndex = 0;\r\n return 0;\r\n }\r\n\r\n /**\r\n * Allocate and return new hash entry. Just check possible amount.\r\n *\r\n * @returns {number} index of hash entry, that can be used for geometry add vertex functionality\r\n */\r\n getNewHashEntry() {\r\n if (this.numHashEntryIndex < this.numHashEtriesAllocated) {\r\n const i = this.numHashEntryIndex;\r\n this.numHashEntryIndex++;\r\n return i;\r\n }\r\n return 0 - 1;\r\n }\r\n\r\n /**\r\n * Add vertex to geometry structure\r\n * using vertex hash table to quickly check, is this vertex already exist in geometry\r\n *\r\n * @param {object} geoOut Geometry to build\r\n * @param {Vector3} vAdd Vertex to add\r\n * @returns {number} index of added (or existing) vertex in geometry.\r\n */\r\n addVertexToGeo(geoOut, vAdd) {\r\n let entry;\r\n const oneHynberes = 0.01;\r\n const n815851 = 815851;\r\n const n37633 = 37633;\r\n const n2453543 = 2453543;\r\n const r106 = 1.0e-6;\r\n\r\n const hashResolution = this.marCubeResoultion << 2;\r\n const v = new THREE.Vector3();\r\n const ix = Math.floor(hashResolution * (vAdd.x - this.vBoxMin.x) / (this.vBoxMax.x + oneHynberes - this.vBoxMin.x));\r\n const iy = Math.floor(hashResolution * (vAdd.y - this.vBoxMin.y) / (this.vBoxMax.y + oneHynberes - this.vBoxMin.y));\r\n const iz = Math.floor(hashResolution * (vAdd.z - this.vBoxMin.z) / (this.vBoxMax.z + oneHynberes - this.vBoxMin.z));\r\n let iHash = ix * n815851 + iz * n37633 + iy * n2453543;\r\n iHash &= (HASH_SIZE - 1);\r\n const hLineIndex = iHash + iHash;\r\n\r\n // search vertex via hash\r\n // search in hash list\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n for (entry = this.hashLines[hLineIndex + 1]; entry >= 0; entry = this.hashEntries[entry * 2 + 1]) {\r\n const ind = this.hashEntries[entry * 2 + 0]; // vertex index\r\n v.copy(geoOut._vertices[ind]);\r\n v.x -= vAdd.x;\r\n v.y -= vAdd.y;\r\n v.z -= vAdd.z;\r\n const dot2 = v.x * v.x + v.y * v.y + v.z * v.z;\r\n if (dot2 < r106) {\r\n return ind;\r\n } // if (found)\r\n } // for (entry)\r\n } // search\r\n\r\n // add new vertex to geometry\r\n if (geoOut._numVertices >= this.maxNumVertices) {\r\n return 0 - 1;\r\n }\r\n\r\n const iVertAdd = geoOut._numVertices;\r\n geoOut._vertices[iVertAdd].copy(vAdd);\r\n\r\n // add to hash\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n entry = this.getNewHashEntry();\r\n if (entry < 0) {\r\n return 0 - 1;\r\n }\r\n const entryFirst = this.hashLines[hLineIndex + 1];\r\n this.hashLines[hLineIndex + 1] = entry;\r\n this.hashEntries[entry * 2 + 0] = iVertAdd;\r\n this.hashEntries[entry * 2 + 1] = entryFirst;\r\n\r\n this.hashLines[hLineIndex + 0]++; // num vertices in line ++\r\n }\r\n geoOut._numVertices++;\r\n return iVertAdd;\r\n }\r\n\r\n /**\r\n *\r\n * @param {number} side some placeholder description\r\n * @param {number} probeSphereRadius some placeholder description\r\n * @param {object} vBoxMin some placeholder description\r\n * @param {object} vBoxMax some placeholder description\r\n * @param {object} geoOut some placeholder description\r\n * @param {object} corners some placeholder description\r\n * @returns {number} always 0\r\n */\r\n modifyExcludedFromGeo(\r\n side, probeSphereRadius,\r\n vBoxMin, vBoxMax,\r\n geoOut, corners,\r\n ) {\r\n let ind;\r\n let distToSphere;\r\n let distToBorder;\r\n const r11 = 1.1;\r\n\r\n function innerBlockWorkAround() {\r\n if (distToBorder > 0.0) {\r\n // point is inside probe sphere\r\n if (corners[ind] < 0.0) {\r\n corners[ind] = distToBorder; // was inside surface, now is oustide ( > 0)\r\n }\r\n if (distToBorder > corners[ind]) {\r\n corners[ind] = distToBorder; // find positive maximum\r\n }\r\n } else if (distToBorder > corners[ind]) { // point is outside sphere\r\n corners[ind] = distToBorder; // find negative maximum\r\n }\r\n }\r\n\r\n const side2 = side * side;\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n const probeSpRad2 = (probeSphereRadius * 2) * (probeSphereRadius * 2);\r\n const sideInv = 1.0 / (side - 1);\r\n\r\n for (let i = 0; i < geoOut._numVertices; i++) {\r\n const vCenter = geoOut._vertices[i];\r\n\r\n const radEst = probeSphereRadius * r11;\r\n\r\n let indXMin = Math.floor(((vCenter.x - radEst) - vBoxMin.x) * xScale);\r\n let indYMin = Math.floor(((vCenter.y - radEst) - vBoxMin.y) * yScale);\r\n let indZMin = Math.floor(((vCenter.z - radEst) - vBoxMin.z) * zScale);\r\n\r\n let indXMax = Math.floor(((vCenter.x + radEst) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((vCenter.y + radEst) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((vCenter.z + radEst) - vBoxMin.z) * zScale);\r\n\r\n indXMin = (indXMin >= 0) ? indXMin : 0;\r\n indYMin = (indYMin >= 0) ? indYMin : 0;\r\n indZMin = (indZMin >= 0) ? indZMin : 0;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let iy = indYMin; iy <= indYMax; iy++) {\r\n const indY = iy * side2;\r\n for (let iz = indZMin; iz <= indZMax; iz++) {\r\n const indZ = iz * side;\r\n for (let ix = indXMin; ix <= indXMax; ix++) {\r\n ind = indY + indZ + ix;\r\n // getCornerCoord(vBoxMin, vBoxMax, ix, iy, iz, side, &vCorner);\r\n let t = ix * sideInv;\r\n const xCorner = vBoxMin.x * (1.0 - t) + vBoxMax.x * t;\r\n t = iy * sideInv;\r\n const yCorner = vBoxMin.y * (1.0 - t) + vBoxMax.y * t;\r\n t = iz * sideInv;\r\n const zCorner = vBoxMin.z * (1.0 - t) + vBoxMax.z * t;\r\n\r\n const dx = xCorner - vCenter.x;\r\n const dy = yCorner - vCenter.y;\r\n const dz = zCorner - vCenter.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 < probeSpRad2) {\r\n distToSphere = Math.sqrt(dist2);\r\n distToBorder = -(distToSphere - probeSphereRadius);\r\n innerBlockWorkAround();\r\n } // if (dist from corner point to sphere center more 2 radiuses)\r\n } // for (ix)\r\n } // for (iz)\r\n } // for (iy)\r\n } // for (i) all geo vertices\r\n return 0;\r\n }\r\n\r\n _innerBuild() {\r\n let ok;\r\n const expandFactor = 1.2;\r\n\r\n // performance test\r\n // this.performanceTest();\r\n\r\n // Create temporary atoms (but colored)\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n this.complex = this._opts.parent;\r\n this.atoms = packedArrays.atoms;\r\n this.meshResolution = this._opts.gridSpacing;\r\n this.atomRadiusScale = this._opts.radScale;\r\n this.colorMode = this._opts.colorMode;\r\n this.probeRadius = this._opts.probeRadius;\r\n this.useVertexColors = true;\r\n this.excludeProbe = this._opts.excludeProbe;\r\n this.visibilitySelector = this._opts.visibilitySelector;\r\n\r\n this.geoOut = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n this.numHashEtriesAllocated = 0;\r\n this.numHashEntryIndex = 0;\r\n this.maxNumVertices = 0;\r\n this.maxNumTriangles = 0;\r\n\r\n const atomsColored = new Array(this.atoms.length);\r\n this.convertToAtomsColored(packedArrays, atomsColored);\r\n\r\n // find bbox for spheres scene\r\n const vBoxMin = this.vBoxMin = new THREE.Vector3();\r\n const vBoxMax = this.vBoxMax = new THREE.Vector3();\r\n this.getBoundingBox(atomsColored, vBoxMin, vBoxMax);\r\n\r\n const marCubeResoultion = this.marCubeResoultion = this.meshResolution * (2 + 2);\r\n\r\n // build grid corners for Marching cube algorithm\r\n const side = marCubeResoultion;\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const corners = utils.allocateTyped(Float32Array, side3);\r\n const rProbeRadius = this.probeRadius * this.atomRadiusScale;\r\n\r\n this.calculateGridCorners(corners, side, vBoxMin, vBoxMax, atomsColored, rProbeRadius);\r\n\r\n const numCells = marCubeResoultion - 1;\r\n const cube = new IsoSurfaceMarchCube();\r\n ok = cube.create(numCells);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // copy corners to cells\r\n const vCellStep = new THREE.Vector3();\r\n vCellStep.x = (vBoxMax.x - vBoxMin.x) / numCells;\r\n vCellStep.y = (vBoxMax.y - vBoxMin.y) / numCells;\r\n vCellStep.z = (vBoxMax.z - vBoxMin.z) / numCells;\r\n\r\n let numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n let maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n let maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n\r\n // build voxel world (used to check triangle-to-atom tie and to calculate normals and colors)\r\n let probeRadForNormalsColors = rProbeRadius;\r\n if (this.excludeProbe) {\r\n probeRadForNormalsColors = 0.01;\r\n }\r\n this.voxelWorld = new IsosurfaceBuildNormals(\r\n atomsColored.length, atomsColored,\r\n vBoxMin, vBoxMax, probeRadForNormalsColors,\r\n );\r\n this.voxelWorld.createVoxels();\r\n\r\n ok = this.buildGeoFromCorners(marCubeResoultion, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n if (this.excludeProbe) {\r\n // using 3d mesh (geoOut) as a surface points\r\n // move probe sphere and try to minimuze corners values\r\n this.modifyExcludedFromGeo(side, rProbeRadius, vBoxMin, vBoxMax, this.geoOut, corners);\r\n\r\n // delete old builded geo\r\n this.geoOut._vertices = null;\r\n this.geoOut._colors = null;\r\n this.geoOut._indices = null;\r\n this.geoOut._normals = null;\r\n this.geoOut._numVertices = 0;\r\n this.geoOut._numTriangles = 0;\r\n this.geoOut = null;\r\n\r\n // estimage geo vertices budget again\r\n numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n // creates empty new geometry\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // build vertices and triangles from corners values\r\n ok = this.buildGeoFromCorners(side, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n }\r\n\r\n // build vertex normals\r\n this.voxelWorld.buildNormals(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._normals);\r\n // More value : more smooth color mixing\r\n // value about 0.7: very rough colors borders\r\n let radiusColorSmoothness = 6.5;\r\n if (this.excludeProbe) {\r\n radiusColorSmoothness -= 1.5;\r\n }\r\n if (this.useVertexColors) {\r\n this.voxelWorld.buildColors(\r\n this.geoOut._vertices.length, this.geoOut._vertices,\r\n this.geoOut._colors, radiusColorSmoothness,\r\n );\r\n }\r\n this.voxelWorld.destroyVoxels();\r\n this.voxelWorld = null;\r\n\r\n // remove objects\r\n cube.destroy();\r\n\r\n return ok;\r\n }\r\n}\r\n\r\n// All code below must be erased from every device and each developer's memory\r\n\r\nexport default SSIsosurfaceGeometry;\r\n","import * as THREE from 'three';\r\nimport EventDispatcher from '../../utils/EventDispatcher';\r\n\r\nfunction createLabel(fieldTxt, className) {\r\n const text = document.createElement('div');\r\n text.className = className;\r\n\r\n if (typeof fieldTxt === 'string') {\r\n const spanText = document.createElement('span');\r\n spanText.style.fontSize = '150%';\r\n const strings = fieldTxt.split('\\n');\r\n\r\n for (let i = 0, n = strings.length; i < n; ++i) {\r\n const spanNodeP = document.createElement('span');\r\n const spanNodeText = document.createTextNode(strings[i]);\r\n spanNodeP.appendChild(spanNodeText);\r\n spanText.appendChild(spanNodeP);\r\n if (i < n - 1) {\r\n spanText.appendChild(document.createElement('br'));\r\n }\r\n }\r\n\r\n text.appendChild(spanText);\r\n } else {\r\n text.appendChild(fieldTxt);\r\n }\r\n text.worldPos = new THREE.Vector3();\r\n return text;\r\n}\r\nclass LabelsGeometry extends EventDispatcher {\r\n constructor(instanceCount, opts) {\r\n super();\r\n this._opts = opts;\r\n this.items = [];\r\n this.needsUpdate = false;\r\n\r\n let xTranslation = -50;\r\n let yTranslation = -50;\r\n switch (opts.horizontalAlign) {\r\n case 'left':\r\n xTranslation = 0;\r\n break;\r\n case 'right':\r\n xTranslation = -100;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n switch (opts.verticalAlign) {\r\n case 'top':\r\n yTranslation = -100;\r\n break;\r\n case 'bottom':\r\n yTranslation = 0;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n const deltaPos = new THREE.Vector3(opts.dx || 0, opts.dy || 0, opts.dz || 0);\r\n this.userData = {\r\n translation: `translate(${xTranslation}%, ${yTranslation}%)`,\r\n offset: deltaPos,\r\n };\r\n }\r\n\r\n setItem(itemIdx, itemPos, fieldTxt) {\r\n const opts = this._opts;\r\n const text = this.items[itemIdx] || createLabel(fieldTxt, 'label');\r\n\r\n text.worldPos.copy(itemPos);\r\n text.style.textAlign = opts.horizontalAlign;\r\n text.style.verticalAlign = opts.verticalAlign;\r\n this.items[itemIdx] = text;\r\n }\r\n\r\n setColor(itemIdx, fColor, bColor) {\r\n const text = this.items[itemIdx];\r\n text.opts = {\r\n color: fColor,\r\n background: bColor,\r\n };\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.needsUpdate = true;\r\n this.dispatchEvent({ type: 'update' });\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n }\r\n\r\n // unimplemented functions\r\n raycast() {\r\n }\r\n\r\n setOpacity() {\r\n\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\n\r\nexport default LabelsGeometry;\r\n","import InstancedSpheresGeometry from './InstancedSpheresGeometry';\r\nimport SimpleSpheresGeometry from './SimpleSpheresGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport Instanced2CCylindersGeometry from './Instanced2CCylindersGeometry';\r\nimport ExtrudedObjectsGeometry from './ExtrudedObjectsGeometry';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport TwoColorLinesGeometry from './TwoColorLinesGeometry';\r\nimport CrossGeometry from './CrossGeometry';\r\nimport QuickSurfGeometry from './QuickSurfGeometry';\r\nimport ContactSurfaceGeometry from './ContactSurfaceGeometry';\r\nimport SSIsosurfaceGeometry from './SSIsosurfaceGeometry';\r\nimport LabelsGeometry from './LabelsGeometry';\r\n\r\nexport default {\r\n InstancedSpheresGeometry,\r\n SimpleSpheresGeometry,\r\n Simple2CCylindersGeometry,\r\n Instanced2CCylindersGeometry,\r\n ExtrudedObjectsGeometry,\r\n ChunkedLinesGeometry,\r\n TwoColorLinesGeometry,\r\n CrossGeometry,\r\n QuickSurfGeometry,\r\n ContactSurfaceGeometry,\r\n SSIsosurfaceGeometry,\r\n LabelsGeometry,\r\n};\r\n","import UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default function (SuperClass) {\r\n class NewObjectType extends SuperClass {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.onBeforeRender = NewObjectType.prototype.onBeforeRender;\r\n }\r\n\r\n onBeforeRender(renderer, scene, camera, geometry, material, group) {\r\n this._onBeforeRender(renderer, scene, camera, geometry, material, group);\r\n this._update();\r\n }\r\n\r\n _onBeforeRender() {\r\n }\r\n\r\n _update() {\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material instanceof UberMaterial) {\r\n material.updateUniforms();\r\n }\r\n }\r\n }\r\n\r\n return NewObjectType;\r\n}\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZSpriteMesh extends Mesh {\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material.uniforms.invModelViewMatrix) {\r\n // NOTE: update of modelViewMatrix inside threejs is done after onBeforeRender call,\r\n // so we have to do it manually in that place\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n // get inverse matrix\r\n material.uniforms.invModelViewMatrix.value.getInverse(this.modelViewMatrix);\r\n material.uniformsNeedUpdate = true;\r\n }\r\n }\r\n}\r\n\r\nexport default ZSpriteMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZClippedMesh extends Mesh {\r\n constructor(geometry, material) {\r\n super(geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n\r\n static _mvLength = new THREE.Vector3();\r\n\r\n static _center = new THREE.Vector3();\r\n\r\n static _modelView = new THREE.Matrix4();\r\n\r\n _onBeforeRender(renderer, scene, camera) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n\r\n const geo = this.geometry;\r\n const { material } = this;\r\n if (!geo.zClip || !material.uberOptions) {\r\n return;\r\n }\r\n\r\n const zClipCoef = 0.5;\r\n\r\n const modelView = ZClippedMesh._modelView;\r\n const mvLength = ZClippedMesh._mvLength;\r\n const center = ZClippedMesh._center;\r\n\r\n modelView.multiplyMatrices(this.matrixWorld, camera.matrixWorldInverse);\r\n const s = mvLength.setFromMatrixColumn(modelView, 0).length();\r\n center.copy(geo.boundingSphere.center);\r\n\r\n this.localToWorld(center);\r\n material.uberOptions.zClipValue = camera.position.z - center.z\r\n - s * (zClipCoef * geo.boundingSphere.radius);\r\n }\r\n}\r\n\r\nexport default ZClippedMesh;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from '../CSS2DObject';\r\nimport utils from '../../utils';\r\n\r\nclass TextMesh extends THREE.Group {\r\n constructor(geometry, _material) {\r\n super();\r\n this.geometry = geometry;\r\n\r\n const self = this;\r\n self.initialized = false;\r\n this.geometry.addEventListener('update', () => {\r\n self.update();\r\n });\r\n }\r\n\r\n init() {\r\n const { children } = this;\r\n for (let i = children.length - 1; i >= 0; --i) {\r\n this.remove(children[i]);\r\n }\r\n\r\n const { items, userData } = this.geometry;\r\n for (let i = 0, n = items.length; i < n; ++i) {\r\n const srcItem = items[i];\r\n if (!srcItem) {\r\n continue;\r\n }\r\n const item = utils.shallowCloneNode(srcItem);\r\n const label = new CSS2DObject(item);\r\n label.userData = _.clone(userData);\r\n const el = label.getElement();\r\n el.style.visibility = 'visible';\r\n label.source = srcItem;\r\n this.add(label);\r\n }\r\n this.initialized = true;\r\n }\r\n\r\n update() {\r\n const geo = this.geometry;\r\n if (!geo.needsUpdate) {\r\n return;\r\n }\r\n const { children } = this;\r\n if (!this.initialized) {\r\n this.init();\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n const item = child.source;\r\n child.position.copy(item.worldPos);\r\n child.userData.color = item.opts.color;\r\n child.userData.background = item.opts.background;\r\n }\r\n }\r\n}\r\n\r\nexport default TextMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nfunction SimpleMesh(geometry, material) {\r\n Mesh.call(this, geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n}\r\n\r\nSimpleMesh.prototype = Object.create(Mesh.prototype);\r\nSimpleMesh.prototype.constructor = SimpleMesh;\r\n\r\nexport default SimpleMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\nconst _viewport = new THREE.Vector2();\r\n\r\nclass ThickLineMesh extends Mesh {\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!material.uberOptions) {\r\n return;\r\n }\r\n\r\n material.uberOptions.projMatrixInv.getInverse(camera.projectionMatrix, true);\r\n renderer.getSize(_viewport);\r\n material.uberOptions.viewport.set(_viewport.width, _viewport.height);\r\n }\r\n}\r\n\r\nexport default ThickLineMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass InstancedMesh extends Mesh {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n}\r\n\r\nexport default InstancedMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\nimport ZSpriteMesh from './ZSpriteMesh';\r\nimport ZClippedMesh from './ZClippedMesh';\r\nimport TextMesh from './TextMesh';\r\nimport SimpleMesh from './SimpleMesh';\r\nimport ThickLineMesh from './ThickLineMesh';\r\nimport InstancedMesh from './InstancedMesh';\r\n\r\nexport default {\r\n ZClipped: ZClippedMesh,\r\n ZSprite: ZSpriteMesh,\r\n Text: TextMesh,\r\n Line: UberObject(THREE.Line),\r\n LineSegments: UberObject(THREE.LineSegments),\r\n Mesh: SimpleMesh,\r\n ThickLineMesh,\r\n Instanced: InstancedMesh,\r\n};\r\n","import geometries from '../geometries/geometries';\r\nimport meshes from './meshes';\r\nimport ThickLinesGeometry from '../geometries/ThickLinesGeometry';\r\n\r\nfunction setMatParams(params, uniforms) {\r\n return function (material) {\r\n material.setValues(params);\r\n material.setUberOptions(uniforms);\r\n };\r\n}\r\n\r\nfunction _createInstancedCylinders(useZSprites, openEnded) {\r\n return {\r\n Geometry(a, b) {\r\n return new geometries.Instanced2CCylindersGeometry(a, b, useZSprites, openEnded);\r\n },\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedMatrix: true,\r\n attrColor: true,\r\n attrColor2: true,\r\n attrAlphaColor: true,\r\n cylinderSprite: useZSprites,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createLineSegmentsGeoTriplet(geo, renderParams) {\r\n const thickLines = geo.prototype instanceof ThickLinesGeometry;\r\n const lineWidth = renderParams.lineWidth || 0;\r\n return {\r\n Geometry: geo,\r\n Object: thickLines ? meshes.ThickLineMesh : meshes.LineSegments,\r\n initMaterial: setMatParams({\r\n lights: false,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n thickLine: thickLines,\r\n }, {\r\n lineWidth,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createSimpleGeoTriplet(geoClass) {\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.Mesh,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createIsoSurfaceGeoTriplet(geoClass, caps, settings, renderParams) {\r\n const surfaceOpts = {\r\n wireframe: !!renderParams.wireframe,\r\n fakeOpacity: settings.now.isoSurfaceFakeOpacity,\r\n zClip: renderParams.zClip,\r\n };\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.ZClipped,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: false,\r\n wireframe: surfaceOpts.wireframe,\r\n fakeOpacity: surfaceOpts.fakeOpacity,\r\n zClip: surfaceOpts.zClip,\r\n }),\r\n };\r\n}\r\n\r\nclass MeshCreator {\r\n static createSpheres(caps, settings) {\r\n const useZSprites = settings.now.zSprites;\r\n return {\r\n Geometry(a, b) {\r\n return new geometries.InstancedSpheresGeometry(a, b, useZSprites);\r\n },\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedPos: true,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n sphereSprite: useZSprites,\r\n }),\r\n };\r\n }\r\n\r\n static create2CClosedCylinders(_caps, _settings) {\r\n return _createInstancedCylinders(false, false);\r\n }\r\n\r\n static create2CCylinders(caps, settings) {\r\n return _createInstancedCylinders(settings.now.zSprites, true);\r\n }\r\n\r\n static create2CLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.TwoColorLinesGeometry, renderParams);\r\n }\r\n\r\n static createCrosses(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.CrossGeometry, renderParams);\r\n }\r\n\r\n static createExtrudedChains(_caps, _settings) {\r\n return _createSimpleGeoTriplet(geometries.ExtrudedObjectsGeometry);\r\n }\r\n\r\n static createChunkedLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.ChunkedLinesGeometry, renderParams);\r\n }\r\n\r\n static createQuickSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.QuickSurfGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createContactSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.ContactSurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createSASSES(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.SSIsosurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createLabels(_caps, _settings) {\r\n return {\r\n Geometry: geometries.LabelsGeometry,\r\n Object: meshes.Text,\r\n initMaterial() {\r\n },\r\n };\r\n }\r\n}\r\n\r\nexport default MeshCreator;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../gfxutils';\r\n\r\nclass TransformGroup extends THREE.Object3D {\r\n static _inverseMatrix = new THREE.Matrix4();\r\n\r\n static _ray = new THREE.Ray();\r\n\r\n constructor(geometry, geoParams, material, transforms) {\r\n super();\r\n this._geometry = geometry;\r\n this._geoParams = geoParams;\r\n const mat = material.createInstance();\r\n geoParams.initMaterial(mat);\r\n this._material = mat;\r\n this._transforms = transforms.length > 0 ? transforms : [new THREE.Matrix4()];\r\n const meshes = this._createMeshes(geometry);\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n this.add(meshes[i]);\r\n }\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const ray = TransformGroup._ray;\r\n const inverseMatrix = TransformGroup._inverseMatrix;\r\n const { children } = this;\r\n ray.copy(raycaster.ray);\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n\r\n if (!gfxutils.belongToSelectLayers(child)) {\r\n continue;\r\n }\r\n\r\n child.updateMatrixWorld();\r\n const mtx = child.matrixWorld;\r\n inverseMatrix.getInverse(mtx);\r\n raycaster.ray.copy(ray).applyMatrix4(inverseMatrix);\r\n const childIntersects = [];\r\n this._geometry.raycast(raycaster, childIntersects);\r\n\r\n for (let j = 0, ciCount = childIntersects.length; j < ciCount; ++j) {\r\n const inters = childIntersects[j];\r\n if (inters.point) {\r\n inters.point.applyMatrix4(mtx);\r\n inters.distance = ray.origin.distanceTo(inters.point);\r\n }\r\n inters.object = child;\r\n intersects[intersects.length] = inters;\r\n }\r\n }\r\n raycaster.ray.copy(ray);\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const geos = this._geometry.getSubset(chunkIndices);\r\n const subset = [];\r\n let subIdx = 0;\r\n\r\n for (let i = 0, n = geos.length; i < n; ++i) {\r\n const meshes = this._createMeshes(geos[i]);\r\n for (let j = 0, meshCnt = meshes.length; j < meshCnt; ++j) {\r\n subset[subIdx++] = meshes[j];\r\n }\r\n }\r\n\r\n return subset;\r\n }\r\n\r\n _createMeshes(geometry) {\r\n const transforms = this._transforms;\r\n const Mesh = this._geoParams.Object;\r\n const material = this._material;\r\n const meshes = [];\r\n for (let i = 0, n = transforms.length; i < n; ++i) {\r\n const mesh = new Mesh(geometry, material);\r\n mesh.applyMatrix(transforms[i]);\r\n\r\n meshes[i] = mesh;\r\n }\r\n\r\n return meshes;\r\n }\r\n}\r\n\r\nexport default TransformGroup;\r\n","import RCGroup from '../../RCGroup';\r\nimport TransformGroup from '../../meshes/TransformGroup';\r\n\r\nfunction wrapper(Name, args) {\r\n const params = [Name].concat(args);\r\n return Name.bind(...params);\r\n}\r\n\r\nclass ChemGroup extends RCGroup {\r\n constructor(geoParams, selection, colorer, mode, transforms, polyComplexity, material) {\r\n super();\r\n if (this.constructor === ChemGroup) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n this._selection = selection;\r\n this._mode = mode;\r\n this._colorer = colorer;\r\n this._chunksIdc = selection.chunks;\r\n this._polyComplexity = polyComplexity;\r\n this._geo = new (wrapper(geoParams.Geometry, this._makeGeoArgs()))();\r\n this._mesh = new TransformGroup(this._geo, geoParams, material, transforms);\r\n this.add(this._mesh);\r\n this._build();\r\n }\r\n\r\n _makeGeoArgs() {\r\n throw new Error('ChemGroup subclass must override _makeGeoArgs() method');\r\n }\r\n\r\n /**\r\n * Builds subset geometry by ATOMS index list\r\n *\r\n * @param {Number} mask - Representation mask\r\n * @param {Boolean} innerOnly - if true returns inner bonds only - without halves\r\n * @returns {Array} Subset geometry\r\n */\r\n getSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : false;\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return [];\r\n }\r\n return this._mesh.getSubset(chunksList);\r\n }\r\n\r\n _changeSubsetOpacity(mask, value, innerOnly) {\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return;\r\n }\r\n this._geo.setOpacity(chunksList, value);\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 1.0, innerOnly);\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 0.0, innerOnly);\r\n }\r\n}\r\n\r\nexport default ChemGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass AtomsGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { atoms } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const atomsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const atomIdx = atomsIdc[inters[i].chunkIdx];\r\n if (atomIdx < atoms.length) {\r\n inters[i].atom = atoms[atomIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { atoms } = this._selection;\r\n const atomsIdc = this._chunksIdc;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n if ((atom.mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default AtomsGroup;\r\n","import AtomsGroup from './AtomsGroup';\r\n\r\nclass AtomsSphereGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, atom.position, mode.calcAtomRadius(atom));\r\n geo.setColor(i, colorer.getAtomColor(atom, parent));\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), mode.calcAtomRadius(atom));\r\n if (updateColor) {\r\n geo.setColor(i, frameData.getAtomColor(colorer, atom));\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsSphereGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSurfaceGroup extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n return [n, opts];\r\n }\r\n}\r\nexport default AtomsSurfaceGroup;\r\n","/* This is a stub class keep it until SAS/SES is refactored */\r\n\r\nimport AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSASSESGroupStub extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n opts.selection = this._selection;\r\n opts.colorMode = this._colorer;\r\n return [n, opts];\r\n }\r\n}\r\n\r\nexport default AtomsSASSESGroupStub;\r\n","import AtomsGroup from './AtomsGroup';\r\nimport utils from '../../../utils';\r\n\r\nfunction adjustColor(color) {\r\n let r = (color >> 16) & 255;\r\n let g = (color >> 8) & 255;\r\n let b = color & 255;\r\n\r\n if (0.2126 * r + 0.7152 * g + 0.0722 * b > 127) {\r\n r = r * 3 / 10;\r\n g = g * 3 / 10;\r\n b = b * 3 / 10;\r\n } else {\r\n r = 255 - ((255 - r) * 3 / 10);\r\n g = 255 - ((255 - g) * 3 / 10);\r\n b = 255 - ((255 - b) * 3 / 10);\r\n }\r\n\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\nfunction inverseColor(color) {\r\n const r = (color >> 16) & 255;\r\n const g = (color >> 8) & 255;\r\n const b = color & 255;\r\n\r\n return ((255 - r) << 16) | ((255 - g) << 8) | (255 - b);\r\n}\r\n\r\nfunction getAtomText(atom) {\r\n if (atom.name.getNode() !== null) {\r\n return atom.name.getNode();\r\n }\r\n\r\n return atom.getVisualName();\r\n}\r\n\r\nconst colorMappings = {\r\n none(c) {\r\n return c;\r\n },\r\n adjust: adjustColor,\r\n inverse: inverseColor,\r\n};\r\n\r\nfunction propagateColor(color, rule) {\r\n let result;\r\n if (colorMappings.hasOwnProperty(rule)) {\r\n result = utils.hexColor(colorMappings[rule](color));\r\n } else {\r\n const val = parseInt(rule, 16);\r\n if (!Number.isNaN(val) && rule.toLowerCase().startsWith('0x')) {\r\n result = utils.hexColor(val);\r\n } else {\r\n result = '#000000';\r\n }\r\n }\r\n return result;\r\n}\r\n\r\nconst templateMappings = {\r\n serial(a) {\r\n return a.serial;\r\n },\r\n name(a) {\r\n return a.getVisualName();\r\n },\r\n elem(a) {\r\n return a.element.name;\r\n },\r\n residue(a) {\r\n return a.residue.getType().getName();\r\n },\r\n sequence(a) {\r\n return a.residue.getSequence();\r\n },\r\n chain(a) {\r\n return a.residue.getChain().getName();\r\n },\r\n hetatm(a) {\r\n return a.isHet();\r\n },\r\n water(a) {\r\n return a.residue.getType().getName() === 'HOH' || a.residue.getType().getName() === 'WAT';\r\n },\r\n};\r\n\r\nconst parseTemplate = function (atom, str) {\r\n return str.replace(/\\{\\{(\\s*\\w+\\s*)\\}\\}/g, (m) => {\r\n let key = m.replace(/\\s+/g, '');\r\n key = key.substring(2, key.length - 2).toLowerCase();\r\n\r\n if (templateMappings.hasOwnProperty(key)) {\r\n return templateMappings[key](atom);\r\n }\r\n return 'null';\r\n });\r\n};\r\n\r\nclass AtomsTextGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n const opts = this._mode.getLabelOpts();\r\n return [this._selection.chunks.length, opts];\r\n }\r\n\r\n _build() {\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = colorer.getAtomColor(atom, parent);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, atom.position, text);\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = frameData.getAtomColor(colorer, atom);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), text);\r\n if (updateColor) {\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsTextGroup;\r\n","import * as THREE from 'three';\r\nimport AtomsGroup from './AtomsGroup';\r\n\r\nfunction _slerp(omega, v1, v2, t) {\r\n const oSin = Math.sin(omega);\r\n return v1.clone().multiplyScalar(Math.sin((1 - t) * omega) / oSin).addScaledVector(v2, Math.sin(t * omega) / oSin);\r\n}\r\n\r\nclass AromaticGroup extends AtomsGroup {\r\n _buildInner(radOffset, addChunk) {\r\n const chunksToIdx = this._selection.chunks;\r\n\r\n const prevVector = new THREE.Vector3();\r\n const currVector = new THREE.Vector3();\r\n const segmentsHeight = this._segmentsHeight;\r\n const leprStep = 1.0 / segmentsHeight;\r\n const colorer = this._colorer;\r\n\r\n const { cycles, parent } = this._selection;\r\n let chunkIdx = 0;\r\n let currAtomIdx = chunksToIdx[chunkIdx];\r\n\r\n for (let cIdx = 0, cCount = cycles.length; cIdx < cCount; ++cIdx) {\r\n const cycle = cycles[cIdx];\r\n const cycAtoms = cycle.atoms;\r\n const chunkPoints = [];\r\n const tmpDir = [];\r\n const { center } = cycle;\r\n const cycleRad = cycle.radius - radOffset;\r\n const n = cycAtoms.length;\r\n let i = 0;\r\n const prevPos = cycAtoms[n - 1].position;\r\n let currPos = cycAtoms[i].position;\r\n prevVector.subVectors(prevPos, center);\r\n currVector.subVectors(currPos, center);\r\n const upDir = currVector.clone().cross(prevVector).normalize();\r\n\r\n\r\n for (; i < n; ++i) {\r\n const omega = prevVector.angleTo(currVector);\r\n tmpDir[i] = _slerp(omega, prevVector, currVector, 0.5).normalize();\r\n currPos = cycAtoms[(i + 1) % n].position;\r\n prevVector.copy(currVector);\r\n currVector.subVectors(currPos, center);\r\n }\r\n\r\n for (i = 0; i < n; ++i) {\r\n if (cycAtoms[i].index !== currAtomIdx) {\r\n continue;\r\n }\r\n const start = tmpDir[i];\r\n const end = tmpDir[(i + 1) % n];\r\n const color = colorer.getAtomColor(cycAtoms[i], parent);\r\n const currAngle = start.angleTo(end);\r\n\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n chunkPoints[j] = _slerp(currAngle, start, end, j * leprStep).multiplyScalar(cycleRad).add(center);\r\n }\r\n\r\n addChunk(chunkIdx++, color, chunkPoints, center, upDir);\r\n currAtomIdx = chunksToIdx[chunkIdx];\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default AromaticGroup;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../../gfxutils';\r\nimport AromaticGroup from './AromaticGroup';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n for (let i = 0; i < parts; ++i) {\r\n const a = -2 * i / parts * Math.PI;\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\nconst { calcChunkMatrix } = gfxutils;\r\n\r\nclass AromaticTorusGroup extends AromaticGroup {\r\n _build() {\r\n const segmentsHeight = this._segmentsHeight;\r\n const torusRad = this._mode.getAromRadius();\r\n const radiusV = new THREE.Vector2(torusRad, torusRad);\r\n const radOffset = this._mode.calcStickRadius() + 2 * torusRad;\r\n const lookAtVector = new THREE.Vector3();\r\n const mtc = [];\r\n const geo = this._geo;\r\n this._buildInner(radOffset, (chunkIdx, color, points, center, upDir) => {\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n const currDir = currPoint.clone().sub(center).cross(upDir);\r\n lookAtVector.addVectors(currPoint, currDir);\r\n mtc[j] = calcChunkMatrix(currPoint, lookAtVector, upDir, radiusV);\r\n }\r\n geo.setItem(chunkIdx, mtc);\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._polyComplexity;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length];\r\n }\r\n}\r\n\r\nexport default AromaticTorusGroup;\r\n","import AromaticGroup from './AromaticGroup';\r\n\r\nclass AromaticLinesGroup extends AromaticGroup {\r\n _build() {\r\n const geo = this._geo;\r\n const radOffset = this._mode.getAromaticOffset();\r\n this._buildInner(radOffset, (chunkIdx, color, points) => {\r\n let prevPt = points[0];// do not replace with start\r\n for (let j = 1; j <= this._segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n geo.setSegment(chunkIdx, j - 1, prevPt, currPoint);\r\n prevPt = currPoint;\r\n }\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._mode.getAromaticArcChunks();\r\n return [this._selection.chunks.length, this._segmentsHeight, true];\r\n }\r\n}\r\n\r\nexport default AromaticLinesGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[inters[i].chunkIdx];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesGroup;\r\n","import ResiduesGroup from './ResiduesGroup';\r\n\r\nclass NucleicItemGroup extends ResiduesGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[Math.floor(inters[i].chunkIdx / 2)];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n let chunkIdx = 0;\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList[chunkIdx++] = 2 * i;\r\n chunksList[chunkIdx++] = 2 * i + 1;\r\n }\r\n }\r\n return chunksList;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finishUpdate();\r\n }\r\n}\r\n\r\nexport default NucleicItemGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicCylindersGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n geo.setItem(chunkIdx, cyl1, cyl2, stickRad);\r\n geo.setColor(chunkIdx, color, color);\r\n }\r\n}\r\n\r\nexport default NucleicCylindersGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicSpheresGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length * 2, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n let idx = chunkIdx * 2;\r\n geo.setItem(idx, cyl1, stickRad);\r\n geo.setColor(idx, color);\r\n idx++;\r\n geo.setItem(idx, cyl2, stickRad);\r\n geo.setColor(idx, color);\r\n }\r\n}\r\n\r\nexport default NucleicSpheresGroup;\r\n","\r\n/*\r\nSmooth.js version 0.1.7\r\n\r\nTurn arrays into smooth functions.\r\n\r\nCopyright 2012 Spencer Cohen\r\nLicensed under MIT license (see \"Smooth.js MIT license.txt\")\r\n*/\r\n\r\n/*Constants (these are accessible by Smooth.WHATEVER in user space)\r\n*/\r\n\r\n(function() {\r\n var AbstractInterpolator, CubicInterpolator, Enum, LinearInterpolator, NearestInterpolator, PI, SincFilterInterpolator, Smooth, clipClamp, clipMirror, clipPeriodic, defaultConfig, getColumn, getType, isValidNumber, k, makeLanczosWindow, makeScaledFunction, makeSincKernel, normalizeScaleTo, shallowCopy, sin, sinc, v, validateNumber, validateVector,\r\n __hasProp = Object.prototype.hasOwnProperty,\r\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };\r\n\r\n Enum = {\r\n /*Interpolation methods\r\n */\r\n METHOD_NEAREST: 'nearest',\r\n METHOD_LINEAR: 'linear',\r\n METHOD_CUBIC: 'cubic',\r\n METHOD_LANCZOS: 'lanczos',\r\n METHOD_SINC: 'sinc',\r\n /*Input clipping modes\r\n */\r\n CLIP_CLAMP: 'clamp',\r\n CLIP_ZERO: 'zero',\r\n CLIP_PERIODIC: 'periodic',\r\n CLIP_MIRROR: 'mirror',\r\n /* Constants for control over the cubic interpolation tension\r\n */\r\n CUBIC_TENSION_DEFAULT: 0,\r\n CUBIC_TENSION_CATMULL_ROM: 0\r\n };\r\n\r\n defaultConfig = {\r\n method: Enum.METHOD_CUBIC,\r\n cubicTension: Enum.CUBIC_TENSION_DEFAULT,\r\n clip: Enum.CLIP_CLAMP,\r\n scaleTo: 0,\r\n sincFilterSize: 2,\r\n sincWindow: void 0\r\n };\r\n\r\n /*Index clipping functions\r\n */\r\n\r\n clipClamp = function(i, n) {\r\n return Math.max(0, Math.min(i, n - 1));\r\n };\r\n\r\n clipPeriodic = function(i, n) {\r\n i = i % n;\r\n if (i < 0) i += n;\r\n return i;\r\n };\r\n\r\n clipMirror = function(i, n) {\r\n var period;\r\n period = 2 * (n - 1);\r\n i = clipPeriodic(i, period);\r\n if (i > n - 1) i = period - i;\r\n return i;\r\n };\r\n\r\n /*\r\n Abstract scalar interpolation class which provides common functionality for all interpolators\r\n \r\n Subclasses must override interpolate().\r\n */\r\n\r\n AbstractInterpolator = (function() {\r\n\r\n function AbstractInterpolator(array, config) {\r\n this.array = array.slice(0);\r\n this.length = this.array.length;\r\n if (!(this.clipHelper = {\r\n clamp: this.clipHelperClamp,\r\n zero: this.clipHelperZero,\r\n periodic: this.clipHelperPeriodic,\r\n mirror: this.clipHelperMirror\r\n }[config.clip])) {\r\n throw \"Invalid clip: \" + config.clip;\r\n }\r\n }\r\n\r\n AbstractInterpolator.prototype.getClippedInput = function(i) {\r\n if ((0 <= i && i < this.length)) {\r\n return this.array[i];\r\n } else {\r\n return this.clipHelper(i);\r\n }\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperClamp = function(i) {\r\n return this.array[clipClamp(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperZero = function(i) {\r\n return 0;\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperPeriodic = function(i) {\r\n return this.array[clipPeriodic(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperMirror = function(i) {\r\n return this.array[clipMirror(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.interpolate = function(t) {\r\n throw 'Subclasses of AbstractInterpolator must override the interpolate() method.';\r\n };\r\n\r\n return AbstractInterpolator;\r\n\r\n })();\r\n\r\n NearestInterpolator = (function(_super) {\r\n\r\n __extends(NearestInterpolator, _super);\r\n\r\n function NearestInterpolator() {\r\n NearestInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n NearestInterpolator.prototype.interpolate = function(t) {\r\n return this.getClippedInput(Math.round(t));\r\n };\r\n\r\n return NearestInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n LinearInterpolator = (function(_super) {\r\n\r\n __extends(LinearInterpolator, _super);\r\n\r\n function LinearInterpolator() {\r\n LinearInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n LinearInterpolator.prototype.interpolate = function(t) {\r\n var k;\r\n k = Math.floor(t);\r\n t -= k;\r\n return (1 - t) * this.getClippedInput(k) + t * this.getClippedInput(k + 1);\r\n };\r\n\r\n return LinearInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n CubicInterpolator = (function(_super) {\r\n\r\n __extends(CubicInterpolator, _super);\r\n\r\n function CubicInterpolator(array, config) {\r\n this.tangentFactor = 1 - Math.max(-1, Math.min(1, config.cubicTension));\r\n CubicInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n CubicInterpolator.prototype.getTangent = function(k) {\r\n return this.tangentFactor * (this.getClippedInput(k + 1) - this.getClippedInput(k - 1)) / 2;\r\n };\r\n\r\n CubicInterpolator.prototype.interpolate = function(t) {\r\n var k, m, p, t2, t3;\r\n k = Math.floor(t);\r\n m = [this.getTangent(k), this.getTangent(k + 1)];\r\n p = [this.getClippedInput(k), this.getClippedInput(k + 1)];\r\n t -= k;\r\n t2 = t * t;\r\n t3 = t * t2;\r\n return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + (-2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1];\r\n };\r\n\r\n return CubicInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n sin = Math.sin, PI = Math.PI;\r\n\r\n sinc = function(x) {\r\n if (x === 0) {\r\n return 1;\r\n } else {\r\n return sin(PI * x) / (PI * x);\r\n }\r\n };\r\n\r\n makeLanczosWindow = function(a) {\r\n return function(x) {\r\n return sinc(x / a);\r\n };\r\n };\r\n\r\n makeSincKernel = function(window) {\r\n return function(x) {\r\n return sinc(x) * window(x);\r\n };\r\n };\r\n\r\n SincFilterInterpolator = (function(_super) {\r\n\r\n __extends(SincFilterInterpolator, _super);\r\n\r\n function SincFilterInterpolator(array, config) {\r\n SincFilterInterpolator.__super__.constructor.apply(this, arguments);\r\n this.a = config.sincFilterSize;\r\n if (!config.sincWindow) throw 'No sincWindow provided';\r\n this.kernel = makeSincKernel(config.sincWindow);\r\n }\r\n\r\n SincFilterInterpolator.prototype.interpolate = function(t) {\r\n var k, n, sum, _ref, _ref2;\r\n k = Math.floor(t);\r\n sum = 0;\r\n for (n = _ref = k - this.a + 1, _ref2 = k + this.a; _ref <= _ref2 ? n <= _ref2 : n >= _ref2; _ref <= _ref2 ? n++ : n--) {\r\n sum += this.kernel(t - n) * this.getClippedInput(n);\r\n }\r\n return sum;\r\n };\r\n\r\n return SincFilterInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n getColumn = function(arr, i) {\r\n var row, _i, _len, _results;\r\n _results = [];\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n row = arr[_i];\r\n _results.push(row[i]);\r\n }\r\n return _results;\r\n };\r\n\r\n makeScaledFunction = function(f, baseScale, scaleRange) {\r\n var scaleFactor, translation;\r\n if (scaleRange.join === '0,1') {\r\n return f;\r\n } else {\r\n scaleFactor = baseScale / (scaleRange[1] - scaleRange[0]);\r\n translation = scaleRange[0];\r\n return function(t) {\r\n return f(scaleFactor * (t - translation));\r\n };\r\n }\r\n };\r\n\r\n getType = function(x) {\r\n return Object.prototype.toString.call(x).slice('[object '.length, -1);\r\n };\r\n\r\n validateNumber = function(n) {\r\n if (isNaN(n)) throw 'NaN in Smooth() input';\r\n if (getType(n) !== 'Number') throw 'Non-number in Smooth() input';\r\n if (!isFinite(n)) throw 'Infinity in Smooth() input';\r\n };\r\n\r\n validateVector = function(v, dimension) {\r\n var n, _i, _len;\r\n if (getType(v) !== 'Array') throw 'Non-vector in Smooth() input';\r\n if (v.length !== dimension) throw 'Inconsistent dimension in Smooth() input';\r\n for (_i = 0, _len = v.length; _i < _len; _i++) {\r\n n = v[_i];\r\n validateNumber(n);\r\n }\r\n };\r\n\r\n isValidNumber = function(n) {\r\n return (getType(n) === 'Number') && isFinite(n) && !isNaN(n);\r\n };\r\n\r\n normalizeScaleTo = function(s) {\r\n var invalidErr;\r\n invalidErr = \"scaleTo param must be number or array of two numbers\";\r\n switch (getType(s)) {\r\n case 'Number':\r\n if (!isValidNumber(s)) throw invalidErr;\r\n s = [0, s];\r\n break;\r\n case 'Array':\r\n if (s.length !== 2) throw invalidErr;\r\n if (!(isValidNumber(s[0]) && isValidNumber(s[1]))) throw invalidErr;\r\n break;\r\n default:\r\n throw invalidErr;\r\n }\r\n return s;\r\n };\r\n\r\n shallowCopy = function(obj) {\r\n var copy, k, v;\r\n copy = {};\r\n for (k in obj) {\r\n if (!__hasProp.call(obj, k)) continue;\r\n v = obj[k];\r\n copy[k] = v;\r\n }\r\n return copy;\r\n };\r\n\r\n Smooth = function(arr, config) {\r\n var baseDomainEnd, dimension, i, interpolator, interpolatorClass, interpolators, k, n, properties, smoothFunc, v;\r\n if (config == null) config = {};\r\n properties = {};\r\n config = shallowCopy(config);\r\n properties.config = shallowCopy(config);\r\n if (config.scaleTo == null) config.scaleTo = config.period;\r\n if (config.sincFilterSize == null) {\r\n config.sincFilterSize = config.lanczosFilterSize;\r\n }\r\n for (k in defaultConfig) {\r\n if (!__hasProp.call(defaultConfig, k)) continue;\r\n v = defaultConfig[k];\r\n if (config[k] == null) config[k] = v;\r\n }\r\n if (!(interpolatorClass = {\r\n nearest: NearestInterpolator,\r\n linear: LinearInterpolator,\r\n cubic: CubicInterpolator,\r\n lanczos: SincFilterInterpolator,\r\n sinc: SincFilterInterpolator\r\n }[config.method])) {\r\n throw \"Invalid method: \" + config.method;\r\n }\r\n if (config.method === 'lanczos') {\r\n config.sincWindow = makeLanczosWindow(config.sincFilterSize);\r\n }\r\n if (arr.length < 2) throw 'Array must have at least two elements';\r\n properties.count = arr.length;\r\n smoothFunc = (function() {\r\n var _i, _j, _len, _len2;\r\n switch (getType(arr[0])) {\r\n case 'Number':\r\n properties.dimension = 'scalar';\r\n if (Smooth.deepValidation) {\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n n = arr[_i];\r\n validateNumber(n);\r\n }\r\n }\r\n interpolator = new interpolatorClass(arr, config);\r\n return function(t) {\r\n return interpolator.interpolate(t);\r\n };\r\n case 'Array':\r\n properties.dimension = dimension = arr[0].length;\r\n if (!dimension) throw 'Vectors must be non-empty';\r\n if (Smooth.deepValidation) {\r\n for (_j = 0, _len2 = arr.length; _j < _len2; _j++) {\r\n v = arr[_j];\r\n validateVector(v, dimension);\r\n }\r\n }\r\n interpolators = (function() {\r\n var _results;\r\n _results = [];\r\n for (i = 0; 0 <= dimension ? i < dimension : i > dimension; 0 <= dimension ? i++ : i--) {\r\n _results.push(new interpolatorClass(getColumn(arr, i), config));\r\n }\r\n return _results;\r\n })();\r\n return function(t) {\r\n var interpolator, _k, _len3, _results;\r\n _results = [];\r\n for (_k = 0, _len3 = interpolators.length; _k < _len3; _k++) {\r\n interpolator = interpolators[_k];\r\n _results.push(interpolator.interpolate(t));\r\n }\r\n return _results;\r\n };\r\n default:\r\n throw \"Invalid element type: \" + (getType(arr[0]));\r\n }\r\n })();\r\n if (config.clip === 'periodic') {\r\n baseDomainEnd = arr.length;\r\n } else {\r\n baseDomainEnd = arr.length - 1;\r\n }\r\n config.scaleTo || (config.scaleTo = baseDomainEnd);\r\n properties.domain = normalizeScaleTo(config.scaleTo);\r\n smoothFunc = makeScaledFunction(smoothFunc, baseDomainEnd, properties.domain);\r\n properties.domain.sort();\r\n /*copy properties\r\n */\r\n for (k in properties) {\r\n if (!__hasProp.call(properties, k)) continue;\r\n v = properties[k];\r\n smoothFunc[k] = v;\r\n }\r\n return smoothFunc;\r\n };\r\n\r\n for (k in Enum) {\r\n if (!__hasProp.call(Enum, k)) continue;\r\n v = Enum[k];\r\n Smooth[k] = v;\r\n }\r\n\r\n Smooth.deepValidation = true;\r\n\r\n (typeof exports !== \"undefined\" && exports !== null ? exports : window).Smooth = Smooth;\r\n\r\n}).call(this);\r\n","import * as THREE from 'three';\r\nimport { Smooth } from '../../../../vendor/js/Smooth';\r\nimport gfxutils from '../../gfxutils';\r\nimport chem from '../../../chem';\r\n\r\nconst { ResidueType } = chem;\r\n\r\nconst calcMatrix = gfxutils.calcChunkMatrix;\r\n\r\nfunction _buildStructureInterpolator(points, tension) {\r\n const path = Smooth(points, {\r\n method: Smooth.METHOD_CUBIC,\r\n clip: Smooth.CLIP_CLAMP,\r\n cubicTension: tension,\r\n scaleTo: 1,\r\n });\r\n\r\n return function (t, argTrans) {\r\n let transformT = argTrans;\r\n if (transformT === null) {\r\n // map our range to the [second .. last but one]\r\n transformT = function (tt) {\r\n return (tt * ((points.length - 1) - 2) + 1) / (points.length - 1);\r\n };\r\n }\r\n const newt = transformT(t);\r\n const ans = path(newt);\r\n return new THREE.Vector3(ans[0], ans[1], ans[2]);\r\n };\r\n}\r\n\r\nfunction _addPoints(centerPoints, topPoints, idx, residue) {\r\n if (!residue._isValid) {\r\n centerPoints[idx] = centerPoints[idx - 1];\r\n topPoints[idx] = topPoints[idx - 1];\r\n return;\r\n }\r\n const cp = residue._controlPoint;\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n const tp = cp.clone().add(residue._wingVector);\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n}\r\n\r\nfunction _addPointsForLoneResidue(centerPoints, topPoints, idx, residue) {\r\n const nucleic = (residue._type.flags & ResidueType.Flags.NUCLEIC) !== 0;\r\n const nameFrom = nucleic ? 'C5\\'' : 'N';\r\n const nameTo = nucleic ? 'C3\\'' : 'C';\r\n\r\n let posFrom;\r\n let posTo;\r\n residue.forEachAtom((atom) => {\r\n const name = atom.getVisualName();\r\n if (!posFrom && name === nameFrom) {\r\n posFrom = atom.position;\r\n } else if (!posTo && name === nameTo) {\r\n posTo = atom.position;\r\n }\r\n });\r\n\r\n // provide a fallback for unknown residues\r\n if (!(posFrom && posTo)) {\r\n posFrom = residue._firstAtom.position;\r\n posTo = residue._lastAtom.position;\r\n }\r\n\r\n if (posFrom && posTo) {\r\n const shift = posTo.clone().sub(posFrom);\r\n\r\n const wing = residue._wingVector;\r\n const cp = residue._controlPoint;\r\n const tp = cp.clone().add(wing);\r\n\r\n const cpPrev = cp.clone().sub(shift);\r\n const tpPrev = cpPrev.clone().add(wing);\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n ++idx;\r\n\r\n const cpNext = cp.clone().add(shift);\r\n const tpNext = cpNext.clone().add(wing);\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n ++idx;\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n }\r\n}\r\n\r\nfunction _calcPoints(residues, firstIdx, lastIdx, boundaries) {\r\n const left = boundaries.start;\r\n const right = boundaries.end;\r\n function _prevIdx(idx) {\r\n return idx > left && residues[idx - 1]._isValid ? idx - 1 : idx;\r\n }\r\n function _nextIdx(idx) {\r\n return idx < right && residues[idx + 1]._isValid ? idx + 1 : idx;\r\n }\r\n\r\n const topPoints = [];\r\n const centerPoints = [];\r\n let arrIdx = 0;\r\n function _extrapolate2(currIdx, otherIdx) {\r\n const cp = residues[currIdx]._controlPoint.clone().lerp(residues[otherIdx]._controlPoint, -0.25);\r\n const tp = cp.clone().add(residues[currIdx]._wingVector);\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n }\r\n\r\n // a single disconnected residue\r\n const prevIdx = _prevIdx(firstIdx);\r\n const nextIdx = _nextIdx(lastIdx);\r\n if (prevIdx === nextIdx) {\r\n _addPointsForLoneResidue(centerPoints, topPoints, arrIdx, residues[firstIdx]);\r\n return { centerPoints, topPoints };\r\n }\r\n\r\n // Two points (prev-prev and next-next) are added to support edge conditions for cubic splines, they are ignored\r\n // Another two (prev and next) were added to support the outside of the sub chain\r\n\r\n // prev and prev-prev\r\n if (firstIdx === prevIdx) {\r\n // do the extrapolation\r\n _extrapolate2(firstIdx, _nextIdx(firstIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[_prevIdx(prevIdx)]);\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[prevIdx]);\r\n }\r\n\r\n // main loop\r\n for (let idx = firstIdx; idx <= lastIdx; ++idx) {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[idx]);\r\n }\r\n\r\n // next and next-next\r\n if (nextIdx === _nextIdx(nextIdx)) {\r\n // do the extrapolation\r\n _extrapolate2(lastIdx, _prevIdx(lastIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[nextIdx]);\r\n _addPoints(centerPoints, topPoints, arrIdx, residues[_nextIdx(nextIdx)]);\r\n }\r\n return { centerPoints, topPoints };\r\n}\r\n\r\nclass CartoonHelper {\r\n constructor(residues, startIdx, endIdx, segmentsCount, tension, boundaries) {\r\n const pointsArrays = _calcPoints(residues, startIdx, endIdx, boundaries);\r\n this._topInterp = _buildStructureInterpolator(pointsArrays.topPoints, tension);\r\n this._centerInterp = _buildStructureInterpolator(pointsArrays.centerPoints, tension);\r\n\r\n this._shift = 0.5 / (endIdx - startIdx + 2);\r\n this._valueStep = (1.0 - 2 * this._shift) / (2 * (endIdx - startIdx + 1) * (segmentsCount - 1));\r\n this._segmentsCount = segmentsCount;\r\n }\r\n\r\n prepareMatrices(idx, firstRad, secondRad) {\r\n const mtcCount = this._segmentsCount;\r\n const outMtc = new Array(mtcCount);\r\n const currRad = new THREE.Vector2(0, 0);\r\n\r\n const topInterp = this._topInterp;\r\n const cenInterp = this._centerInterp;\r\n\r\n let currentValue = this._shift + this._valueStep * (mtcCount - 1) * idx;\r\n\r\n for (let mtxIdx = 0; mtxIdx < mtcCount; ++mtxIdx) {\r\n const lerpVal = Math.min(1.0, mtxIdx / (mtcCount - 1));\r\n currRad.lerpVectors(firstRad, secondRad, lerpVal);\r\n\r\n const currTop = topInterp(currentValue, null);\r\n const currCenter = cenInterp(currentValue, null);\r\n currentValue += this._valueStep;\r\n const nextCenter = cenInterp(currentValue, null);\r\n\r\n outMtc[mtxIdx] = calcMatrix(currCenter.clone(), nextCenter.clone(), currTop.clone().sub(currCenter), currRad);\r\n }\r\n\r\n return outMtc;\r\n }\r\n}\r\n\r\nexport default CartoonHelper;\r\n","import * as THREE from 'three';\r\nimport ResiduesGroup from './ResiduesGroup';\r\nimport CartoonHelper from './CartoonHelper';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n\r\n for (let i = 0; i < parts; ++i) {\r\n // starts from pi/2 because it's important that points are lied on the angles of arrows (visual issues if not)\r\n const a = Math.PI / 2.0 - 2 * Math.PI * i / parts;\r\n\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\n\r\nfunction _loopThrough(subDiv, residues, segmentsHeight, tension, mode, callback) {\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n const { boundaries } = subDiv[subDivI];\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const idc = [subs[i].start, subs[i].end];\r\n const matrixHelper = new CartoonHelper(residues, idc[0], idc[1], segmentsHeight, tension, boundaries);\r\n let prevLast = null;\r\n const startIdx = subs[i].start * 2;\r\n const endIdx = subs[i].end * 2 + 1;\r\n let prevSecondRad = mode.getResidueRadius(residues[0], 0);\r\n for (let idx = startIdx; idx <= endIdx; ++idx) {\r\n const resIdx = (idx / 2 | 0);\r\n const currRes = residues[resIdx];\r\n const firstRad = mode.getResidueRadius(currRes, idx % 2);\r\n const secondRad = mode.getResidueRadius(currRes, 1 + (idx % 2));\r\n\r\n const mtc = matrixHelper.prepareMatrices(idx - idc[0] * 2, firstRad, secondRad);\r\n mtc.unshift(prevLast === null ? mtc[0] : prevLast);\r\n\r\n // Slope - radius is changed along this residue part\r\n const hasSlope = (firstRad.x !== secondRad.x) || (firstRad.y !== secondRad.y);\r\n // Cut - end radius of previous part not equal to start radius of this part. First section of this part lies in the orthogonal plane\r\n const hasCut = (firstRad.x !== prevSecondRad.x) || (firstRad.y !== prevSecondRad.y);\r\n\r\n callback(currRes, mtc, hasSlope, hasCut);\r\n\r\n prevLast = mtc[segmentsHeight];\r\n prevSecondRad = secondRad;\r\n }\r\n }\r\n }\r\n}\r\n\r\nclass ResiduesSubseqGroup extends ResiduesGroup {\r\n _makeGeoArgs() {\r\n const cmpMultiplier = this._mode.getHeightSegmentsRatio();\r\n this._segmentsHeight = this._polyComplexity * cmpMultiplier | 0;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length * 2];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n _loopThrough(this._selection.subdivs, residues, this._segmentsHeight, tension, mode, (currRes, mtc, hasSlope = false, hasCut = false) => {\r\n const color = colorer.getResidueColor(currRes, parent);\r\n chunkIdc[chunkIdx] = currRes._index;\r\n geo.setItem(chunkIdx, mtc, hasSlope, hasCut);\r\n geo.setColor(chunkIdx++, color);\r\n });\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n const frameRes = frameData.getResidues();\r\n let chunkIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n _loopThrough(this._selection.subdivs, frameRes, this._segmentsHeight, tension, mode, (currRes, mtc) => {\r\n geo.setItem(chunkIdx, mtc);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n });\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default ResiduesSubseqGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesTraceGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const subDiv = this._selection.subdivs;\r\n let chunksCount = 0;\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n chunksCount += subs[i].end - subs[i].start;\r\n }\r\n }\r\n return [chunksCount, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n chunkIdc[chunkIdx] = { first: prevRes._index, second: currRes._index };\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n geo.finalize();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n const { residues } = this._selection;\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksToIdx = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const chunk = chunksToIdx[Math.floor(chunkIdx / 2)];\r\n const resIdx = chunkIdx % 2 === 0 ? chunk.first : chunk.second;\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const chunksToIdx = this._chunksIdc;\r\n const { residues } = this._selection;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const chunk = chunksToIdx[i];\r\n if (residues[chunk.first]._mask & mask) {\r\n chunksList.push(i * 2);\r\n }\r\n if (residues[chunk.second]._mask & mask) {\r\n chunksList.push(i * 2 + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesTraceGroup;\r\n","import ChemGroup from './ChemGroup';\r\nimport Bond from '../../../chem/Bond';\r\n\r\nfunction getCylinderCount(bondOrder) {\r\n return bondOrder < 2 ? 1 : bondOrder;\r\n}\r\n\r\nclass BondsGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const drawMultiple = this._mode.drawMultiorderBonds();\r\n const showAromatic = this._mode.showAromaticLoops();\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n let bondsCount = 0;\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n bondsCount += this.getBondOrder(bonds[bondsIdc[i]], drawMultiple, showAromatic);\r\n }\r\n return [bondsCount, this._polyComplexity];\r\n }\r\n\r\n getBondOrder(bond, drawMultiple, showAromatic) {\r\n let bondOrder = 1;\r\n if (drawMultiple && (!showAromatic || bond._type !== Bond.BondType.AROMATIC)) {\r\n bondOrder = getCylinderCount(bond._order);\r\n }\r\n return bondOrder;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const { bonds } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const bondsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const bondIdx = bondsIdc[Math.floor(chunkIdx / 2)];\r\n if (bondIdx < bonds.length) {\r\n const bond = bonds[bondIdx];\r\n inters[i].atom = chunkIdx % 2 === 0 ? bond._left : bond._right;\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask, innerOnly) {\r\n const chunksList = [];\r\n const { bonds } = this._selection;\r\n const chunksToIdx = this._chunksIdc;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const bond = bonds[chunksToIdx[i]];\r\n if ((bond._left.mask & mask) && (!innerOnly || (bond._right.mask & mask))) {\r\n chunksList.push(2 * i);\r\n }\r\n if ((bond._right.mask & mask) && (!innerOnly || (bond._left.mask & mask))) {\r\n chunksList.push(2 * i + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default BondsGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nclass BondsCylinderGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsCylinderGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nconst STEP_SIZE = 0.15;\r\n\r\nclass BondsLinesGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsLinesGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\nimport AtomsSurfaceGroup from './AtomsSurfaceGroup';\r\nimport AtomsSASSESGroupStub from './AtomsSASSESGroupStub';\r\nimport AtomsTextGroup from './AtomsTextGroup';\r\nimport AromaticTorusGroup from './AromaticTorusGroup';\r\nimport AromaticLinesGroup from './AromaticLinesGroup';\r\nimport NucleicCylindersGroup from './NucleicCylindersGroup';\r\nimport NucleicSpheresGroup from './NucleicSpheresGroup';\r\nimport ResiduesSubseqGroup from './ResiduesSubseqGroup';\r\nimport ResiduesTraceGroup from './ResiduesTraceGroup';\r\nimport BondsCylinderGroup from './BondsCylinderGroup';\r\nimport BondsLinesGroup from './BondsLinesGroup';\r\n\r\nexport default {\r\n AtomsSphereGroup,\r\n AtomsSurfaceGroup,\r\n AtomsSASSESGroupStub,\r\n AtomsTextGroup,\r\n AromaticTorusGroup,\r\n AromaticLinesGroup,\r\n NucleicCylindersGroup,\r\n NucleicSpheresGroup,\r\n ResiduesSubseqGroup,\r\n ResiduesTraceGroup,\r\n BondsCylinderGroup,\r\n BondsLinesGroup,\r\n};\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AtomsProcessor extends RCGroup {\r\n constructor(AtomsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n this._mode = mode;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let atomCount = 0;\r\n component.forEachAtom((atom) => {\r\n if (!self._checkAtom(atom, mask)) {\r\n return;\r\n }\r\n atomsIdc[atomCount++] = atom.index;\r\n });\r\n if (atomCount === 0) {\r\n return;\r\n }\r\n const atomsGroup = new AtomsGroup(geoParams, {\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n _checkAtom(atom, mask) {\r\n return atom.mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AtomsProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\n\r\nclass OrphanAtomsProcessor extends AtomsProcessor {\r\n _checkAtom(atom, mask) {\r\n if (!(atom.mask & mask)) {\r\n return false;\r\n }\r\n\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n if ((bonds[i]._left.mask & mask) && (bonds[i]._right.mask & mask)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n\r\nexport default OrphanAtomsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass ResiduesProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n component.forEachResidue((residue) => {\r\n if (self._checkResidue(residue, mask)) {\r\n resIdc[chunksCount++] = residue._index;\r\n }\r\n });\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n checkResidue(residue, mask) {\r\n return residue._mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default ResiduesProcessor;\r\n","import ResidueProcessor from './ResiduesProcessor';\r\n\r\nclass NucleicProcessor extends ResidueProcessor {\r\n _checkResidue(residue, mask) {\r\n return mask & residue._mask && residue._cylinders !== null;\r\n }\r\n}\r\nexport default NucleicProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass SubseqsProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const subDivs = component.getMaskedSubdivSequences(mask);\r\n\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n for (let subDivI = 0, subDivN = subDivs.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDivs[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let j = subs[i].start, jEnd = subs[i].end; j <= jEnd; ++j) {\r\n resIdc[chunksCount++] = residues[j]._index;\r\n }\r\n }\r\n }\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n subdivs: subDivs,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default SubseqsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass BondsProcessor extends RCGroup {\r\n constructor(BondsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const bonds = complex.getBonds();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const bondsIdc = [];\r\n let bondsCount = 0;\r\n component.forEachBond((bond) => {\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n if (!(atom1.mask & mask) || !(atom2.mask & mask)) {\r\n return;\r\n }\r\n bondsIdc[bondsCount++] = bond._index;\r\n });\r\n if (bondsCount === 0) {\r\n return;\r\n }\r\n const bondsGroup = new BondsGroup(geoParams, {\r\n bonds,\r\n chunks: bondsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n bondsGroup._component = component;\r\n self.add(bondsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default BondsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AromaticProcessor extends RCGroup {\r\n constructor(AromaticGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n if (!mode.showAromaticLoops()) {\r\n return;\r\n }\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let chunksCount = 0;\r\n const cycles = [];\r\n let cycleIdx = 0;\r\n component.forEachCycle((cycle) => {\r\n const cycAtoms = cycle.atoms;\r\n let perCycle = 0;\r\n for (let i = 0, n = cycAtoms.length; i < n; ++i) {\r\n if ((cycAtoms[i].mask & mask) !== 0) {\r\n ++perCycle;\r\n atomsIdc[chunksCount++] = cycAtoms[i].index;\r\n }\r\n }\r\n if (perCycle > 0) {\r\n cycles[cycleIdx++] = cycle;\r\n }\r\n });\r\n\r\n const atomsGroup = new AromaticGroup(geoParams, {\r\n cycles,\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AromaticProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\nimport OrphanAtomsProcessor from './OrphanAtomsProcessor';\r\nimport ResiduesProcessor from './ResiduesProcessor';\r\nimport NucleicProcessor from './NucleicProcessor';\r\nimport SubseqsProcessor from './SubseqsProcessor';\r\nimport BondsProcessor from './BondsProcessor';\r\nimport AromaticProcessor from './AromaticProcessor';\r\n\r\nexport default {\r\n Atoms: AtomsProcessor,\r\n OrphanAtoms: OrphanAtomsProcessor,\r\n Residues: ResiduesProcessor,\r\n Nucleic: NucleicProcessor,\r\n Subseqs: SubseqsProcessor,\r\n Bonds: BondsProcessor,\r\n Aromatic: AromaticProcessor,\r\n};\r\n","import MeshCreator from '../../meshes/MeshCreator';\r\nimport groups from './groups';\r\nimport processors from '../processors/processors';\r\n\r\nfunction _bakeGroup(triplet, Processor, Group) {\r\n return function (complex, colorer, mode, polyComplexity, mask, material) {\r\n return new Processor(Group, triplet, complex, colorer, mode, polyComplexity, mask, material);\r\n };\r\n}\r\n\r\nclass GroupsFactory {\r\n static AtomsSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static OrphanedAtomsCrosses(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createCrosses(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.OrphanAtoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static BondsCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsCylinderGroup);\r\n }\r\n\r\n static BondsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.create2CLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsLinesGroup);\r\n }\r\n\r\n static CartoonChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesSubseqGroup);\r\n }\r\n\r\n static TraceChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CClosedCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesTraceGroup);\r\n }\r\n\r\n static NucleicSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicSpheresGroup);\r\n }\r\n\r\n static NucleicCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicCylindersGroup);\r\n }\r\n\r\n static ALoopsTorus(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticTorusGroup);\r\n }\r\n\r\n static ALoopsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createChunkedLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticLinesGroup);\r\n }\r\n\r\n static QuickSurfGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createQuickSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static ContactSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createContactSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static SASSESSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createSASSES(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSASSESGroupStub);\r\n }\r\n\r\n static TextLabelsGeo(caps, settings) {\r\n const gfxTriplet = MeshCreator.createLabels(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsTextGroup);\r\n }\r\n}\r\n\r\nexport default GroupsFactory;\r\n","import _ from 'lodash';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport factory from './groups/GroupsFactory';\r\n\r\n/**\r\n * Create new mode.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the mode after its creation.\r\n *\r\n * @exports Mode\r\n * @this Mode\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available modes used for building and displaying molecule geometry.\r\n */\r\nclass Mode {\r\n constructor(opts) {\r\n if (this.constructor === Mode) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Mode options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(this.settings.now.modes[this.id], true), opts);\r\n }\r\n\r\n\r\n /**\r\n * Get mode identification, probably with options.\r\n * @returns {string|Array} Mode identifier string ({@link Mode#id}) or two-element array containing both mode\r\n * identifier and options ({@link Mode#opts}).\r\n * Options are returned if they were changed during or after the mode creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, this.settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const polyComplexity = this.opts.polyComplexity ? this.opts.polyComplexity[this.settings.now.resolution] : 0;\r\n const groupList = this.depGroups;\r\n const groupCount = groupList.length;\r\n const group = new gfxutils.RCGroup();\r\n const self = this;\r\n for (let i = 0; i < groupCount; ++i) {\r\n let currGroup = groupList[i];\r\n let renderParams = {};\r\n if (_.isArray(currGroup)) {\r\n renderParams = currGroup[1].call(this);\r\n [currGroup] = currGroup;\r\n }\r\n const Group = factory[currGroup](null, this.settings, renderParams);\r\n const newGroup = new Group(complex, colorer, self, polyComplexity, mask, material);\r\n if (newGroup.children.length > 0) {\r\n group.add(newGroup);\r\n }\r\n }\r\n return group;\r\n }\r\n}\r\n\r\nmakeContextDependent(Mode.prototype);\r\n\r\n/**\r\n* Mode identifier.\r\n* @type {string}\r\n*/\r\nMode.prototype.id = '__';\r\n\r\n/**\r\n * Mode geo groups.\r\n * @type {Array}\r\n */\r\nMode.prototype.depGroups = [];\r\n\r\nexport default Mode;\r\n","import Mode from './Mode';\r\n\r\nfunction getRenderParams() {\r\n return {\r\n lineWidth: this.opts.lineWidth,\r\n };\r\n}\r\n\r\nclass LinesMode extends Mode {\r\n static id = 'LN';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const groups = this.depGroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n groups[i] = [groups[i], getRenderParams];\r\n }\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n\r\n calcAtomRadius() {\r\n return this.opts.atom;\r\n }\r\n\r\n getAromaticOffset() {\r\n return this.opts.offsarom;\r\n }\r\n\r\n getAromaticArcChunks() {\r\n return this.opts.chunkarom;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n}\r\n\r\nLinesMode.prototype.id = 'LN';\r\nLinesMode.prototype.name = 'Lines';\r\nLinesMode.prototype.shortName = 'Lines';\r\nLinesMode.prototype.depGroups = [\r\n 'ALoopsLines',\r\n 'BondsLines',\r\n 'OrphanedAtomsCrosses',\r\n];\r\n\r\nexport default LinesMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass LicoriceMode extends Mode {\r\n static id = 'LC';\r\n\r\n calcAtomRadius(_atom) {\r\n return this.opts.bond;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nLicoriceMode.prototype.id = 'LC';\r\nLicoriceMode.prototype.name = 'Licorice';\r\nLicoriceMode.prototype.shortName = 'Licorice';\r\nLicoriceMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default LicoriceMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass BallsAndSticksMode extends Mode {\r\n static id = 'BS';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius * this.opts.atom;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nBallsAndSticksMode.prototype.id = 'BS';\r\nBallsAndSticksMode.prototype.name = 'Balls and Sticks';\r\nBallsAndSticksMode.prototype.shortName = 'Balls';\r\nBallsAndSticksMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default BallsAndSticksMode;\r\n","import Mode from './Mode';\r\n\r\nclass VanDerWaalsMode extends Mode {\r\n static id = 'VW';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n}\r\n\r\nVanDerWaalsMode.prototype.id = 'VW';\r\nVanDerWaalsMode.prototype.name = 'Van der Waals';\r\nVanDerWaalsMode.prototype.shortName = 'VDW';\r\nVanDerWaalsMode.prototype.depGroups = ['AtomsSpheres'];\r\n\r\nexport default VanDerWaalsMode;\r\n","import Mode from './Mode';\r\n\r\nclass TraceMode extends Mode {\r\n static id = 'TR';\r\n\r\n calcStickRadius() {\r\n return this.opts.radius;\r\n }\r\n}\r\n\r\nTraceMode.prototype.id = 'TR';\r\nTraceMode.prototype.name = 'Trace';\r\nTraceMode.prototype.shortName = 'Trace';\r\nTraceMode.prototype.depGroups = ['TraceChains'];\r\n\r\nexport default TraceMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass TubeMode extends Mode {\r\n static id = 'TU';\r\n\r\n getResidueRadius(_residue) {\r\n return this.TUBE_RADIUS;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const rad = this.opts.radius;\r\n this.TUBE_RADIUS = new THREE.Vector2(rad, rad);\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nTubeMode.prototype.id = 'TU';\r\nTubeMode.prototype.name = 'Tube';\r\nTubeMode.prototype.shortName = 'Tube';\r\nTubeMode.prototype.depGroups = ['CartoonChains'];\r\n\r\nexport default TubeMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass CartoonMode extends Mode {\r\n static id = 'CA';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n // cache for secondary structure options\r\n this.secCache = {};\r\n }\r\n\r\n getResidueStartRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (!second || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return secOpts.start;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueEndRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (second === null || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return this.ARROW_END;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueRadius(residue, val) {\r\n const startRad = this.getResidueStartRadius(residue);\r\n if (val === 0) {\r\n return startRad;\r\n }\r\n\r\n const endRad = this.getResidueEndRadius(residue);\r\n if (val === 2) {\r\n return endRad;\r\n }\r\n\r\n return startRad.clone().lerp(endRad, val / 2.0);\r\n }\r\n\r\n calcStickRadius(_res) {\r\n return this.opts.radius;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const tubeRad = this.opts.radius;\r\n const secHeight = this.opts.depth;\r\n\r\n this.TUBE_RADIUS = new THREE.Vector2(tubeRad, tubeRad);\r\n this.ARROW_END = new THREE.Vector2(secHeight, tubeRad);\r\n const secCache = {};\r\n const secData = this.opts.ss;\r\n /* eslint-disable guard-for-in */\r\n for (const prop in secData) {\r\n secCache[prop] = {\r\n center: new THREE.Vector2(secHeight, secData[prop].width),\r\n start: new THREE.Vector2(secHeight, secData[prop].arrow),\r\n };\r\n }\r\n this.secCache = secCache;\r\n /* eslint-enable guard-for-in */\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nCartoonMode.prototype.id = 'CA';\r\nCartoonMode.prototype.name = 'Cartoon';\r\nCartoonMode.prototype.shortName = 'Cartoon';\r\nCartoonMode.prototype.depGroups = [\r\n 'CartoonChains',\r\n 'NucleicSpheres',\r\n 'NucleicCylinders',\r\n];\r\n\r\nexport default CartoonMode;\r\n","import chem from '../../chem';\r\nimport Mode from './Mode';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction getRenderParams() {\r\n return {\r\n wireframe: this.opts.wireframe,\r\n zClip: this.opts.zClip,\r\n };\r\n}\r\n\r\nclass SurfaceMode extends Mode {\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const surfaces = this.surfaceNames;\r\n const groups = this.depGroups;\r\n for (let i = 0, n = surfaces.length; i < n; ++i) {\r\n groups[groups.length] = [surfaces[i], getRenderParams];\r\n }\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getVisibilitySelector() {\r\n let visibilitySelector = null;\r\n if (this.opts.subset !== '') {\r\n const res = selectors.parse(this.opts.subset);\r\n if (!res.error) {\r\n visibilitySelector = res.selector;\r\n }\r\n }\r\n return visibilitySelector;\r\n }\r\n}\r\n\r\nSurfaceMode.prototype.isSurface = true;\r\nSurfaceMode.prototype.surfaceNames = [];\r\n\r\nexport default SurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass QuickSurfaceMode extends SurfaceMode {\r\n static id = 'QS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n useBeads: false,\r\n isoValue: this.opts.isoValue,\r\n gaussLim: this.opts.gaussLim[this.settings.now.resolution],\r\n radScale: this.opts.scale,\r\n gridSpacing: this.opts.gridSpacing[this.settings.now.resolution],\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nQuickSurfaceMode.prototype.id = 'QS';\r\nQuickSurfaceMode.prototype.name = 'Quick Surface';\r\nQuickSurfaceMode.prototype.shortName = 'Quick Surf';\r\nQuickSurfaceMode.prototype.surfaceNames = ['QuickSurfGeo'];\r\n\r\nexport default QuickSurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass IsoSurfaceMode extends SurfaceMode {\r\n constructor(excludeProbe, opts) {\r\n super(opts);\r\n this._excludeProbe = excludeProbe;\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getSurfaceOpts() {\r\n return {\r\n gridSpacing: this.opts.polyComplexity[this.settings.now.resolution],\r\n radScale: this._radScale,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n probeRadius: this.opts.probeRadius,\r\n excludeProbe: this._excludeProbe,\r\n };\r\n }\r\n}\r\n\r\nIsoSurfaceMode.prototype.id = 'SU';\r\nIsoSurfaceMode.prototype.name = 'Surface';\r\nIsoSurfaceMode.prototype.shortName = 'Surface';\r\nIsoSurfaceMode.prototype.surfaceNames = ['SASSESSurfaceGeo'];\r\n\r\nIsoSurfaceMode.prototype._radScale = 1;\r\nIsoSurfaceMode.prototype._excludeProbe = false;\r\n\r\nexport default IsoSurfaceMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSASMode extends IsoSurfaceMode {\r\n static id = 'SA';\r\n\r\n constructor(opts) {\r\n super(false, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSASMode.prototype.id = 'SA';\r\nIsoSurfaceSASMode.prototype.name = 'Solvent Accessible Surface';\r\nIsoSurfaceSASMode.prototype.shortName = 'SAS';\r\n\r\nexport default IsoSurfaceSASMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSESMode extends IsoSurfaceMode {\r\n static id = 'SE';\r\n\r\n constructor(opts) {\r\n super(true, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSESMode.prototype.id = 'SE';\r\nIsoSurfaceSESMode.prototype.name = 'Solvent Excluded Surface';\r\nIsoSurfaceSESMode.prototype.shortName = 'SES';\r\n\r\nexport default IsoSurfaceSESMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass ContactSurfaceMode extends SurfaceMode {\r\n static id = 'CS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n probeRadius: this.opts.probeRadius,\r\n radScale: this.opts.polyComplexity[this.settings.now.resolution],\r\n scaleFactor: this.opts.polyComplexity[this.settings.now.resolution],\r\n gridSpacing: 1.0 / this.opts.polyComplexity[this.settings.now.resolution],\r\n isoValue: this.opts.isoValue,\r\n probePositions: this.opts.probePositions,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nContactSurfaceMode.prototype.id = 'CS';\r\nContactSurfaceMode.prototype.name = 'Contact Surface';\r\nContactSurfaceMode.prototype.shortName = 'Contact Surf';\r\nContactSurfaceMode.prototype.isSurface = true;\r\nContactSurfaceMode.prototype.surfaceNames = ['ContactSurfaceGeo'];\r\n\r\nexport default ContactSurfaceMode;\r\n","import _ from 'lodash';\r\nimport Mode from './Mode';\r\n\r\nclass TextMode extends Mode {\r\n static id = 'TX';\r\n\r\n getTemplateOptions() {\r\n return this.opts.template;\r\n }\r\n\r\n getLabelOpts() {\r\n return _.merge(this.opts, {\r\n colors: true,\r\n adjustColor: true,\r\n transparent: true,\r\n });\r\n }\r\n}\r\n\r\nTextMode.prototype.id = 'TX';\r\nTextMode.prototype.name = 'Text mode';\r\nTextMode.prototype.shortName = 'Text';\r\nTextMode.prototype.depGroups = ['TextLabelsGeo'];\r\n\r\nexport default TextMode;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport LinesMode from './modes/LinesMode';\r\nimport LicoriceMode from './modes/LicoriceMode';\r\nimport BallsAndSticksMode from './modes/BallsAndSticksMode';\r\nimport VanDerWaalsMode from './modes/VanDerWaalsMode';\r\nimport TraceMode from './modes/TraceMode';\r\nimport TubeMode from './modes/TubeMode';\r\nimport CartoonMode from './modes/CartoonMode';\r\nimport QuickSurfaceMode from './modes/QuickSurfaceMode';\r\nimport IsoSurfaceSASMode from './modes/IsoSurfaceSASMode';\r\nimport IsoSurfaceSESMode from './modes/IsoSurfaceSESMode';\r\nimport ContactSurfaceMode from './modes/ContactSurfaceMode';\r\nimport TextMode from './modes/TextMode';\r\n\r\nconst modes = new EntityList([\r\n LinesMode,\r\n LicoriceMode,\r\n BallsAndSticksMode,\r\n VanDerWaalsMode,\r\n TraceMode,\r\n TubeMode,\r\n CartoonMode,\r\n QuickSurfaceMode,\r\n IsoSurfaceSASMode,\r\n IsoSurfaceSESMode,\r\n ContactSurfaceMode,\r\n TextMode,\r\n]);\r\n\r\nexport default modes;\r\n","import _ from 'lodash';\r\n\r\nfunction clamp(x, a, b) {\r\n return x <= b ? x < 0 ? 0 : x : b;\r\n}\r\n\r\nfunction lerpColor(c1, c2, alpha) {\r\n const beta = 1 - alpha;\r\n const r1 = (c1 >> 16) & 0xff;\r\n const g1 = (c1 >> 8) & 0xff;\r\n const b1 = c1 & 0xff;\r\n const r2 = (c2 >> 16) & 0xff;\r\n const g2 = (c2 >> 8) & 0xff;\r\n const b2 = c2 & 0xff;\r\n const r = beta * r1 + alpha * r2;\r\n const g = beta * g1 + alpha * g2;\r\n const b = beta * b1 + alpha * b2;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\n\r\nclass Palette {\r\n constructor(name, id) {\r\n this.name = name || 'Custom';\r\n this.id = id || 'CP';\r\n }\r\n\r\n getElementColor(name, asIs = false) {\r\n const color = this.elementColors[name];\r\n return color === undefined && !asIs ? this.defaultElementColor : color;\r\n }\r\n\r\n getResidueColor(name, asIs = false) {\r\n const color = this.residueColors[name];\r\n return color === undefined && !asIs ? this.defaultResidueColor : color;\r\n }\r\n\r\n getChainColor(name) {\r\n let chain = name.charCodeAt(0);\r\n chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F)\r\n % this.chainColors.length;\r\n return this.chainColors[chain];\r\n }\r\n\r\n getSecondaryColor(type, asIs = false) {\r\n const color = this.secondaryColors[type];\r\n return color === undefined && !asIs ? this.defaultSecondaryColor : color;\r\n }\r\n\r\n getSequentialColor(index) {\r\n const { colors } = this;\r\n const len = colors.length;\r\n return index < 0 ? colors[(index % len) + len] : colors[index % len];\r\n }\r\n\r\n getGradientColor(value, gradientName) {\r\n const gradient = this.gradients[gradientName];\r\n if (!gradient) {\r\n return this.defaultNamedColor;\r\n }\r\n const count = gradient.length;\r\n const index = value * (count - 1);\r\n let left = Math.floor(index);\r\n const right = clamp(left + 1, 0, count - 1);\r\n left = clamp(left, 0, count - 1);\r\n return lerpColor(gradient[left], gradient[right], index - left);\r\n }\r\n\r\n getNamedColor(name, asIs = false) {\r\n const color = this.namedColors[name];\r\n return color === undefined && !asIs ? this.defaultNamedColor : color;\r\n }\r\n}\r\n\r\n_.assign(Palette.prototype, {\r\n colors: [0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0x808080],\r\n\r\n minRangeColor: 0x000000,\r\n midRangeColor: 0x7F7F7F,\r\n maxRangeColor: 0xFFFFFF,\r\n\r\n defaultElementColor: 0xFFFFFF,\r\n elementColors: {},\r\n\r\n defaultResidueColor: 0xFFFFFF,\r\n residueColors: {},\r\n\r\n chainColors: [0xFFFFFF],\r\n\r\n defaultSecondaryColor: 0xFFFFFF,\r\n secondaryColors: {},\r\n\r\n defaultGradientColor: 0x000000,\r\n\r\n defaultNamedColor: 0xFFFFFF,\r\n namedColorsArray: [\r\n /* eslint-disable no-multi-spaces */\r\n ['indianred', 0xcd5c5c],\r\n ['lightcoral', 0xf08080],\r\n ['salmon', 0xfa8072],\r\n ['darksalmon', 0xe9967a],\r\n ['lightsalmon', 0xffa07a],\r\n ['crimson', 0xdc143c],\r\n ['red', 0xff0000],\r\n ['firebrick', 0xb22222],\r\n ['darkred', 0x8b0000],\r\n ['pink', 0xffc0cb],\r\n ['lightpink', 0xffb6c1],\r\n ['hotpink', 0xff69b4],\r\n ['deeppink', 0xff1493],\r\n ['mediumvioletred', 0xc71585],\r\n ['palevioletred', 0xdb7093],\r\n ['coral', 0xff7f50],\r\n ['tomato', 0xff6347],\r\n ['orangered', 0xff4500],\r\n ['darkorange', 0xff8c00],\r\n ['orange', 0xffa500],\r\n ['gold', 0xffd700],\r\n ['yellow', 0xffff00],\r\n ['lightyellow', 0xffffe0],\r\n ['lemonchiffon', 0xfffacd],\r\n ['lightgoldenrodyellow', 0xfafad2],\r\n ['papayawhip', 0xffefd5],\r\n ['moccasin', 0xffe4b5],\r\n ['peachpuff', 0xffdab9],\r\n ['palegoldenrod', 0xeee8aa],\r\n ['khaki', 0xf0e68c],\r\n ['darkkhaki', 0xbdb76b],\r\n ['lavender', 0xe6e6fa],\r\n ['thistle', 0xd8bfd8],\r\n ['plum', 0xdda0dd],\r\n ['violet', 0xee82ee],\r\n ['orchid', 0xda70d6],\r\n ['fuchsia', 0xff00ff],\r\n ['magenta', 0xff00ff],\r\n ['mediumorchid', 0xba55d3],\r\n ['mediumpurple', 0x9370db],\r\n ['rebeccapurple', 0x663399],\r\n ['blueviolet', 0x8a2be2],\r\n ['darkviolet', 0x9400d3],\r\n ['darkorchid', 0x9932cc],\r\n ['darkmagenta', 0x8b008b],\r\n ['purple', 0x800080],\r\n ['indigo', 0x4b0082],\r\n ['slateblue', 0x6a5acd],\r\n ['mediumslateblue', 0x7b68ee],\r\n ['darkslateblue', 0x483d8b],\r\n ['greenyellow', 0xadff2f],\r\n ['chartreuse', 0x7fff00],\r\n ['lawngreen', 0x7cfc00],\r\n ['lime', 0x00ff00],\r\n ['limegreen', 0x32cd32],\r\n ['palegreen', 0x98fb98],\r\n ['lightgreen', 0x90ee90],\r\n ['mediumspringgreen', 0x00fa9a],\r\n ['springgreen', 0x00ff7f],\r\n ['mediumseagreen', 0x3cb371],\r\n ['seagreen', 0x2e8b57],\r\n ['forestgreen', 0x228b22],\r\n ['green', 0x008000],\r\n ['darkgreen', 0x006400],\r\n ['yellowgreen', 0x9acd32],\r\n ['olivedrab', 0x6b8e23],\r\n ['olive', 0x808000],\r\n ['darkolivegreen', 0x556b2f],\r\n ['mediumaquamarine', 0x66cdaa],\r\n ['darkseagreen', 0x8fbc8f],\r\n ['lightseagreen', 0x20b2aa],\r\n ['darkcyan', 0x008b8b],\r\n ['teal', 0x008080],\r\n ['aqua', 0x00ffff],\r\n ['cyan', 0x00ffff],\r\n ['lightcyan', 0xe0ffff],\r\n ['paleturquoise', 0xafeeee],\r\n ['aquamarine', 0x7fffd4],\r\n ['turquoise', 0x40e0d0],\r\n ['mediumturquoise', 0x48d1cc],\r\n ['darkturquoise', 0x00ced1],\r\n ['cadetblue', 0x5f9ea0],\r\n ['steelblue', 0x4682b4],\r\n ['lightsteelblue', 0xb0c4de],\r\n ['powderblue', 0xb0e0e6],\r\n ['lightblue', 0xadd8e6],\r\n ['skyblue', 0x87ceeb],\r\n ['lightskyblue', 0x87cefa],\r\n ['deepskyblue', 0x00bfff],\r\n ['dodgerblue', 0x1e90ff],\r\n ['cornflowerblue', 0x6495ed],\r\n ['royalblue', 0x4169e1],\r\n ['blue', 0x0000ff],\r\n ['mediumblue', 0x0000cd],\r\n ['darkblue', 0x00008b],\r\n ['navy', 0x000080],\r\n ['midnightblue', 0x191970],\r\n ['cornsilk', 0xfff8dc],\r\n ['blanchedalmond', 0xffebcd],\r\n ['bisque', 0xffe4c4],\r\n ['navajowhite', 0xffdead],\r\n ['wheat', 0xf5deb3],\r\n ['burlywood', 0xdeb887],\r\n ['tan', 0xd2b48c],\r\n ['rosybrown', 0xbc8f8f],\r\n ['sandybrown', 0xf4a460],\r\n ['goldenrod', 0xdaa520],\r\n ['darkgoldenrod', 0xb8860b],\r\n ['peru', 0xcd853f],\r\n ['chocolate', 0xd2691e],\r\n ['saddlebrown', 0x8b4513],\r\n ['sienna', 0xa0522d],\r\n ['brown', 0xa52a2a],\r\n ['maroon', 0x800000],\r\n ['white', 0xffffff],\r\n ['snow', 0xfffafa],\r\n ['honeydew', 0xf0fff0],\r\n ['mintcream', 0xf5fffa],\r\n ['azure', 0xf0ffff],\r\n ['aliceblue', 0xf0f8ff],\r\n ['ghostwhite', 0xf8f8ff],\r\n ['whitesmoke', 0xf5f5f5],\r\n ['seashell', 0xfff5ee],\r\n ['beige', 0xf5f5dc],\r\n ['oldlace', 0xfdf5e6],\r\n ['floralwhite', 0xfffaf0],\r\n ['ivory', 0xfffff0],\r\n ['antiquewhite', 0xfaebd7],\r\n ['linen', 0xfaf0e6],\r\n ['lavenderblush', 0xfff0f5],\r\n ['mistyrose', 0xffe4e1],\r\n ['gainsboro', 0xdcdcdc],\r\n ['lightgray', 0xd3d3d3],\r\n ['silver', 0xc0c0c0],\r\n ['darkgray', 0xa9a9a9],\r\n ['gray', 0x808080],\r\n ['dimgray', 0x696969],\r\n ['lightslategray', 0x778899],\r\n ['slategray', 0x708090],\r\n ['darkslategray', 0x2f4f4f],\r\n ['black', 0x000000],\r\n /* eslint-enable no-multi-spaces */\r\n ],\r\n\r\n namedColors: {},\r\n /* eslint-enable no-magic-numbers */\r\n\r\n gradients: {\r\n rainbow: [\r\n 0x0000ff, // blue\r\n 0x00ffff, // cyan\r\n 0x00ff00, // green\r\n 0xffff00, // yellow\r\n 0xff0000, // red\r\n ],\r\n temp: [\r\n 0x0000ff, // blue\r\n 0x007fff, // light-blue\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n hot: [\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n cold: [\r\n 0xffffff, // white\r\n 0x007fff, // light-blue\r\n 0x0000ff, // blue\r\n ],\r\n 'blue-red': [\r\n 0x0000ff, // blue\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n reds: [\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n blues: [\r\n 0xffffff, // white\r\n 0x0000ff, // blue\r\n ],\r\n },\r\n});\r\n\r\n\r\nconst { namedColorsArray, namedColors } = Palette.prototype;\r\n\r\nfor (let i = 0, { length } = namedColorsArray; i < length; ++i) {\r\n const [name, value] = namedColorsArray[i];\r\n namedColors[name] = value;\r\n}\r\n\r\nexport default Palette;\r\n","import Palette from './Palette';\r\n\r\nconst palette = new Palette('CPK', 'CP');\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x202020,\r\n N: 0x2060FF,\r\n O: 0xEE2010,\r\n F: 0x00FF00,\r\n P: 0x8020FF,\r\n S: 0xFFFF00,\r\n CL: 0x00BB00,\r\n FE: 0xD0D0D0,\r\n CO: 0xD0D0D0,\r\n NI: 0xD0D0D0,\r\n CU: 0xD0D0D0,\r\n BR: 0x008800,\r\n I: 0x005500,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('Jmol', 'JM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0x0055FF, //\r\n 0x00ABFF, //\r\n 0x00FFFF, // cyan\r\n 0x00FFAB, //\r\n 0x00FF55, //\r\n 0x00FF00, // green\r\n 0x55FF00, //\r\n 0xABFF00, //\r\n 0xFFFF00, // yellow\r\n 0xFFAB00, //\r\n 0xFF5500, //\r\n 0xFF0000, // red\r\n 0xFF0055, //\r\n 0xFF00AB, //\r\n 0xFF00FF, // magenta\r\n 0xAB00FF, //\r\n 0x5500FF, //\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n D: 0xFFFFC0,\r\n T: 0xFFFFA0,\r\n HE: 0xD9FFFF,\r\n LI: 0xCC80FF,\r\n BE: 0xC2FF00,\r\n B: 0xFFB5B5,\r\n C: 0x909090,\r\n N: 0x3050F8,\r\n O: 0xFF0D0D,\r\n F: 0x90E050,\r\n NE: 0xB3E3F5,\r\n NA: 0xAB5CF2,\r\n MG: 0x8AFF00,\r\n AL: 0xBFA6A6,\r\n SI: 0xF0C8A0,\r\n P: 0xFF8000,\r\n S: 0xFFFF30,\r\n CL: 0x1FF01F,\r\n AR: 0x80D1E3,\r\n K: 0x8F40D4,\r\n CA: 0x3DFF00,\r\n SC: 0xE6E6E6,\r\n TI: 0xBFC2C7,\r\n V: 0xA6A6AB,\r\n CR: 0x8A99C7,\r\n MN: 0x9C7AC7,\r\n FE: 0xE06633,\r\n CO: 0xF090A0,\r\n NI: 0x50D050,\r\n CU: 0xC88033,\r\n ZN: 0x7D80B0,\r\n GA: 0xC28F8F,\r\n GE: 0x668F8F,\r\n AS: 0xBD80E3,\r\n SE: 0xFFA100,\r\n BR: 0xA62929,\r\n KR: 0x5CB8D1,\r\n RB: 0x702EB0,\r\n SR: 0x00FF00,\r\n Y: 0x94FFFF,\r\n ZR: 0x94E0E0,\r\n NB: 0x73C2C9,\r\n MO: 0x54B5B5,\r\n TC: 0x3B9E9E,\r\n RU: 0x248F8F,\r\n RH: 0x0A7D8C,\r\n PD: 0x006985,\r\n AG: 0xC0C0C0,\r\n CD: 0xFFD98F,\r\n IN: 0xA67573,\r\n SN: 0x668080,\r\n SB: 0x9E63B5,\r\n TE: 0xD47A00,\r\n I: 0x940094,\r\n XE: 0x429EB0,\r\n CS: 0x57178F,\r\n BA: 0x00C900,\r\n LA: 0x70D4FF,\r\n CE: 0xFFFFC7,\r\n PR: 0xD9FFC7,\r\n ND: 0xC7FFC7,\r\n PM: 0xA3FFC7,\r\n SM: 0x8FFFC7,\r\n EU: 0x61FFC7,\r\n GD: 0x45FFC7,\r\n TB: 0x30FFC7,\r\n DY: 0x1FFFC7,\r\n HO: 0x00FF9C,\r\n ER: 0x00E675,\r\n TM: 0x00D452,\r\n YB: 0x00BF38,\r\n LU: 0x00AB24,\r\n HF: 0x4DC2FF,\r\n TA: 0x4DA6FF,\r\n W: 0x2194D6,\r\n RE: 0x267DAB,\r\n OS: 0x266696,\r\n IR: 0x175487,\r\n PT: 0xD0D0E0,\r\n AU: 0xFFD123,\r\n HG: 0xB8B8D0,\r\n TL: 0xA6544D,\r\n PB: 0x575961,\r\n BI: 0x9E4FB5,\r\n PO: 0xAB5C00,\r\n AT: 0x754F45,\r\n RN: 0x428296,\r\n FR: 0x420066,\r\n RA: 0x007D00,\r\n AC: 0x70ABFA,\r\n TH: 0x00BAFF,\r\n PA: 0x00A1FF,\r\n U: 0x008FFF,\r\n NP: 0x0080FF,\r\n PU: 0x006BFF,\r\n AM: 0x545CF2,\r\n CM: 0x785CE3,\r\n BK: 0x8A4FE3,\r\n CF: 0xA136D4,\r\n ES: 0xB31FD4,\r\n FM: 0xB31FBA,\r\n MD: 0xB30DA6,\r\n NO: 0xBD0D87,\r\n LR: 0xC70066,\r\n RF: 0xCC0059,\r\n DB: 0xD1004F,\r\n SG: 0xD90045,\r\n BH: 0xE00038,\r\n HS: 0xE6002E,\r\n MT: 0xEB0026,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0xBEA06E;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0xC8C8C8,\r\n ARG: 0x145AFF,\r\n ASN: 0x00DCDC,\r\n ASP: 0xE60A0A,\r\n CYS: 0xE6E600,\r\n GLN: 0x00DCDC,\r\n GLU: 0xE60A0A,\r\n GLY: 0xEBEBEB,\r\n HIS: 0x8282D2,\r\n ILE: 0x0F820F,\r\n LEU: 0x0F820F,\r\n LYS: 0x145AFF,\r\n MET: 0xE6E600,\r\n PHE: 0x3232AA,\r\n PRO: 0xDC9682,\r\n SER: 0xFA9600,\r\n THR: 0xFA9600,\r\n TRP: 0xB45AB4,\r\n TYR: 0x3232AA,\r\n VAL: 0x0F820F,\r\n A: 0xA0A0FF,\r\n C: 0xFF8C4B,\r\n G: 0xFF7070,\r\n I: 0x80FFFF,\r\n T: 0xA0FFA0,\r\n U: 0xFF8080,\r\n DA: 0xA0A0FF,\r\n DC: 0xFF8C4B,\r\n DG: 0xFF7070,\r\n DI: 0x80FFFF,\r\n DT: 0xA0FFA0,\r\n DU: 0xFF8080,\r\n '+A': 0xA0A0FF,\r\n '+C': 0xFF8C4B,\r\n '+G': 0xFF7070,\r\n '+I': 0x80FFFF,\r\n '+T': 0xA0FFA0,\r\n '+U': 0xFF8080,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [\r\n // ' '->0 'A'->1, 'B'->2\r\n 0xFFffffff, // ' ' & '0' white\r\n //\r\n 0xFFC0D0FF, // skyblue\r\n 0xFFB0FFB0, // pastel green\r\n 0xFFFFC0C8, // pink\r\n 0xFFFFFF80, // pastel yellow\r\n 0xFFFFC0FF, // pastel magenta\r\n 0xFFB0F0F0, // pastel cyan\r\n 0xFFFFD070, // pastel gold\r\n 0xFFF08080, // lightcoral\r\n\r\n 0xFFF5DEB3, // wheat\r\n 0xFF00BFFF, // deepskyblue\r\n 0xFFCD5C5C, // indianred\r\n 0xFF66CDAA, // mediumaquamarine\r\n 0xFF9ACD32, // yellowgreen\r\n 0xFFEE82EE, // violet\r\n 0xFF00CED1, // darkturquoise\r\n 0xFF00FF7F, // springgreen\r\n 0xFF3CB371, // mediumseagreen\r\n\r\n 0xFF00008B, // darkblue\r\n 0xFFBDB76B, // darkkhaki\r\n 0xFF006400, // darkgreen\r\n 0xFF800000, // maroon\r\n 0xFF808000, // olive\r\n 0xFF800080, // purple\r\n 0xFF008080, // teal\r\n 0xFFB8860B, // darkgoldenrod\r\n 0xFFB22222, // firebrick\r\n];\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xFF0080,\r\n [StructuralElementType.HELIX_PI]: 0x600080,\r\n [StructuralElementType.HELIX_310]: 0xA00080,\r\n [StructuralElementType.STRAND]: 0xFFC800,\r\n [StructuralElementType.TURN]: 0x6080FF,\r\n dna: 0xAE00FE,\r\n rna: 0xFD0162,\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('VMD', 'VM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0xFF0000, // red\r\n 0x606060, // gray\r\n 0xFF8000, // orange\r\n 0xFFFF00, // yellow\r\n 0x808033, // tan\r\n 0x999999, // silver\r\n 0x00FF00, // green\r\n 0xFFFFFF, // white\r\n 0xFF9999, // pink\r\n 0x40C0C0, // cyan\r\n 0xA600A6, // purple\r\n 0x80E666, // lime\r\n 0xE666B3, // mauve\r\n 0x804D00, // ochre\r\n 0x8080C0, // ice blue\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\npalette.defaultElementColor = 0x804D00;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x40BFBF,\r\n N: 0x0000FF,\r\n O: 0xFF0000,\r\n P: 0x808033,\r\n S: 0xFFFF00,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0x40C0C0;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0x0000FF,\r\n ARG: 0xFFFFFF,\r\n ASN: 0x808033,\r\n ASP: 0xFF0000,\r\n CYS: 0xFFFF00,\r\n GLN: 0xFF8000,\r\n GLU: 0xFF9999,\r\n GLY: 0xFFFFFF,\r\n HIS: 0x40C0C0,\r\n ILE: 0x00FF00,\r\n LEU: 0xFF9999,\r\n LYS: 0x40C0C0,\r\n MET: 0xFFFF00,\r\n PHE: 0xA600A6,\r\n PRO: 0x804C00,\r\n SER: 0xFFFF00,\r\n THR: 0xE666B3,\r\n TRP: 0x999999,\r\n TYR: 0x00FF00,\r\n VAL: 0x808033,\r\n A: 0x0000FF,\r\n C: 0xFF8000,\r\n G: 0xFFFF00,\r\n T: 0xA600A6,\r\n U: 0x00FF00,\r\n DA: 0x0000FF,\r\n DC: 0xFF8000,\r\n DG: 0xFFFF00,\r\n DT: 0xA600A6,\r\n DU: 0x00FF00,\r\n '+A': 0x0000FF,\r\n '+C': 0xFF8000,\r\n '+G': 0xFFFF00,\r\n '+T': 0xA600A6,\r\n '+U': 0x00FF00,\r\n WAT: 0x40C0C0,\r\n H2O: 0x40C0C0,\r\n HOH: 0x40C0C0,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [0xFFFFFF].concat(palette.colors);\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xA600A6,\r\n [StructuralElementType.HELIX_310]: 0x0000FF,\r\n [StructuralElementType.HELIX_PI]: 0xFF0000,\r\n [StructuralElementType.STRAND]: 0xFFFF00,\r\n [StructuralElementType.BRIDGE]: 0x808033,\r\n [StructuralElementType.TURN]: 0x40C0C0,\r\n};\r\n\r\nexport default palette;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport cpkPalette from './palettes/cpkPalette';\r\nimport jmolPalette from './palettes/jmolPalette';\r\nimport vmdPalette from './palettes/vmdPalette';\r\n\r\nconst palettes = new EntityList([\r\n cpkPalette,\r\n jmolPalette,\r\n vmdPalette,\r\n]);\r\n\r\nexport default palettes;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport palettes from '../palettes';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports Colorer\r\n * @this Colorer\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available coloring algorithms used for building and displaying molecule geometry.\r\n */\r\nclass Colorer {\r\n constructor(opts) {\r\n if (this.constructor === Colorer) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Colorer options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(settings.now.colorers[this.id], true), opts);\r\n /**\r\n * Palette in use.\r\n * @type {Palette}\r\n */\r\n this.palette = palettes.first;\r\n }\r\n\r\n /**\r\n * Get Colorer identification, probably with options.\r\n * @returns {string|Array} Colorer identifier string ({@link Colorer#id}) or two-element array containing both colorer\r\n * identifier and options ({@link Colorer#opts}).\r\n * Options are returned if they were changed during or after colorer creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, settings.now.colorers[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n}\r\n\r\n/**\r\n * Colorer identifier.\r\n * @type {string}\r\n */\r\n\r\nColorer.prototype.id = '__';\r\n\r\nexport default Colorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Element\r\n *\r\n * @exports ElementColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on chemical element.\r\n */\r\nclass ElementColorer extends Colorer {\r\n static id = 'EL';\r\n\r\n getAtomColor(atom, _complex) {\r\n const type = atom.element.name;\r\n if (type === 'C' && this.opts.carbon >= 0) {\r\n return this.opts.carbon;\r\n }\r\n return this.palette.getElementColor(type);\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nElementColorer.prototype.id = 'EL';\r\nElementColorer.prototype.name = 'Element';\r\nElementColorer.prototype.shortName = 'Element';\r\n\r\nexport default ElementColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Coloring algorithm based on residue type.\r\n *\r\n * @see ResidueType\r\n *\r\n * @exports ResidueTypeColorer\r\n * @constructor\r\n */\r\nclass ResidueTypeColorer extends Colorer {\r\n static id = 'RT';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getResidueColor(residue._type._name);\r\n }\r\n}\r\n\r\nResidueTypeColorer.prototype.id = 'RT';\r\nResidueTypeColorer.prototype.name = 'Residue Type';\r\nResidueTypeColorer.prototype.shortName = 'Residue';\r\n\r\nexport default ResidueTypeColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass SequenceColorer extends Colorer {\r\n static id = 'SQ';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const chain = residue._chain;\r\n if (chain.minSequence === Number.POSITIVE_INFINITY && chain.maxSequence === Number.NEGATIVE_INFINITY) {\r\n return this.palette.defaultNamedColor;\r\n }\r\n const min = chain.minSequence;\r\n const max = chain.maxSequence > min ? chain.maxSequence : min + 1;\r\n return this.palette.getGradientColor((residue._sequence - min) / (max - min), this.opts.gradient);\r\n }\r\n}\r\n\r\nSequenceColorer.prototype.id = 'SQ';\r\nSequenceColorer.prototype.name = 'Sequence';\r\nSequenceColorer.prototype.shortName = 'Sequence';\r\n\r\nexport default SequenceColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ChainColorer extends Colorer {\r\n static id = 'CH';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getChainColor(residue.getChain()._name);\r\n }\r\n}\r\n\r\nChainColorer.prototype.id = 'CH';\r\nChainColorer.prototype.name = 'Chain';\r\nChainColorer.prototype.shortName = 'Chain';\r\n\r\nexport default ChainColorer;\r\n","import Colorer from './Colorer';\r\nimport ResidueType from '../../chem/ResidueType';\r\n\r\nclass SecondaryStructureColorer extends Colorer {\r\n static id = 'SS';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n if (residue._type.flags & ResidueType.Flags.DNA) {\r\n return this.palette.getSecondaryColor('dna');\r\n }\r\n if (residue._type.flags & ResidueType.Flags.RNA) {\r\n return this.palette.getSecondaryColor('rna');\r\n }\r\n const secondary = residue.getSecondary();\r\n if (secondary) {\r\n let color = this.palette.getSecondaryColor(secondary.type, true);\r\n if (color === undefined) {\r\n color = this.palette.getSecondaryColor(secondary.generic);\r\n }\r\n return color;\r\n }\r\n return this.palette.defaultSecondaryColor;\r\n }\r\n}\r\n\r\nSecondaryStructureColorer.prototype.id = 'SS';\r\nSecondaryStructureColorer.prototype.name = 'Secondary Structure';\r\nSecondaryStructureColorer.prototype.shortName = 'Structure';\r\n\r\nexport default SecondaryStructureColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass UniformColorer extends Colorer {\r\n static id = 'UN';\r\n\r\n getAtomColor(_atom, _complex) {\r\n return this.opts.color;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nUniformColorer.prototype.id = 'UN';\r\nUniformColorer.prototype.name = 'Uniform';\r\nUniformColorer.prototype.shortName = 'Uniform';\r\n\r\nexport default UniformColorer;\r\n","import Colorer from './Colorer';\r\nimport selectors from '../../chem/selectors';\r\n\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports ConditionalColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on a selector string used as a condition.\r\n */\r\nclass ConditionalColorer extends Colorer {\r\n static id = 'CO';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n const parsed = selectors.parse(this.opts.subset);\r\n this._subsetCached = parsed.error ? selectors.none() : parsed.selector;\r\n }\r\n\r\n getAtomColor(atom, _complex) {\r\n return this._subsetCached.includesAtom(atom) ? this.opts.color : this.opts.baseColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const subset = this._subsetCached;\r\n let includes = true;\r\n const atoms = residue._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n includes = includes && subset.includesAtom(atoms[i]);\r\n }\r\n return includes ? this.opts.color : this.opts.baseColor;\r\n }\r\n}\r\n\r\nConditionalColorer.prototype.id = 'CO';\r\nConditionalColorer.prototype.name = 'Conditional';\r\nConditionalColorer.prototype.shortName = 'Conditional';\r\n\r\nexport default ConditionalColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ConformationColorer extends Colorer {\r\n static id = 'CF';\r\n\r\n getAtomColor(atom, _complex) {\r\n return this.palette.getChainColor(String.fromCharCode(atom.location));\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nConformationColorer.prototype.id = 'CF';\r\nConformationColorer.prototype.name = 'Conformation';\r\nConformationColorer.prototype.shortName = 'Conformation';\r\n\r\nexport default ConformationColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Temperature\r\n *\r\n * @exports TemperatureColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on temperature of chemical element.\r\n */\r\nclass TemperatureColorer extends Colorer {\r\n static id = 'TM';\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n let factor = 1;\r\n if (atom.temperature && opts) {\r\n if (opts.min === opts.max) {\r\n factor = atom.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (atom.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n if (!opts) {\r\n return this.palette.defaultGradientColor;\r\n }\r\n if (residue.temperature) {\r\n let factor = 0;\r\n if (opts.min === opts.max) {\r\n factor = residue.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (residue.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n}\r\n\r\nTemperatureColorer.prototype.id = 'TM'; // [T]e[M]perature\r\nTemperatureColorer.prototype.name = 'Temperature';\r\nTemperatureColorer.prototype.shortName = 'Temperature';\r\n\r\nexport default TemperatureColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Occupancy\r\n *\r\n * @exports OccupancyColorer\r\n * @augments Occupancy\r\n * @constructor\r\n * @classdesc Coloring algorithm based on occupancy of chemical element.\r\n */\r\nclass OccupancyColorer extends Colorer {\r\n static id = 'OC';\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n if (atom.occupancy && opts) {\r\n const factor = 1 - atom.occupancy;\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n if (!opts) {\r\n return this.palette.defaultGradientColor;\r\n }\r\n if (residue.occupancy > 0) {\r\n const factor = 1 - residue.occupancy;\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n}\r\n\r\nOccupancyColorer.prototype.id = 'OC'; // [OC]cupancy\r\nOccupancyColorer.prototype.name = 'Occupancy';\r\nOccupancyColorer.prototype.shortName = 'Occupancy';\r\n\r\nexport default OccupancyColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass HydrophobicityColorer extends Colorer {\r\n static id = 'HY';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n let color = this.palette.defaultResidueColor;\r\n if (residue._type.hydrophobicity) {\r\n // Kyte Doolitle hydro [-4.5,4.5]->[0.1]\r\n const min = -4.5;\r\n const max = 4.5;\r\n color = this.palette.getGradientColor((residue._type.hydrophobicity - min) / (max - min), this.opts.gradient);\r\n }\r\n return color;\r\n }\r\n}\r\n\r\nHydrophobicityColorer.prototype.id = 'HY';\r\nHydrophobicityColorer.prototype.name = 'Hydrophobicity';\r\nHydrophobicityColorer.prototype.shortName = 'Hydrophobicity';\r\n\r\nexport default HydrophobicityColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass MoleculeColorer extends Colorer {\r\n static id = 'MO';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const molecule = residue._molecule;\r\n const count = _complex.getMoleculeCount();\r\n if (count > 1) {\r\n return this.palette.getGradientColor((molecule.index - 1) / (count - 1), this.opts.gradient);\r\n }\r\n return this.palette.getGradientColor(0, this.opts.gradient);\r\n }\r\n}\r\n\r\nMoleculeColorer.prototype.id = 'MO';\r\nMoleculeColorer.prototype.name = 'Molecule';\r\nMoleculeColorer.prototype.shortName = 'Molecule';\r\n\r\nexport default MoleculeColorer;\r\n","import Colorer from './Colorer';\r\nimport Atom from '../../chem/Atom';\r\n\r\nfunction scaleColor(c, factor) {\r\n const r1 = (c >> 16) & 0xff;\r\n const g1 = (c >> 8) & 0xff;\r\n const b1 = c & 0xff;\r\n const r = factor * r1;\r\n const g = factor * g1;\r\n const b = factor * b1;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports CarbonColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on selection carbon atoms.\r\n */\r\nclass CarbonColorer extends Colorer {\r\n static id = 'CB';\r\n\r\n getAtomColor(atom, _complex) {\r\n const colorCarbon = this.opts.color;\r\n const colorNotCarbon = scaleColor(colorCarbon, this.opts.factor);\r\n return (atom.flags & Atom.Flags.CARBON) ? colorCarbon : colorNotCarbon;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nCarbonColorer.prototype.id = 'CB';\r\nCarbonColorer.prototype.name = 'Carbon';\r\nCarbonColorer.prototype.shortName = 'Carbon';\r\n\r\nexport default CarbonColorer;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport ElementColorer from './colorers/ElementColorer';\r\nimport ResidueTypeColorer from './colorers/ResidueTypeColorer';\r\nimport SequenceColorer from './colorers/SequenceColorer';\r\nimport ChainColorer from './colorers/ChainColorer';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\nimport UniformColorer from './colorers/UniformColorer';\r\nimport ConditionalColorer from './colorers/ConditionalColorer';\r\nimport ConformationColorer from './colorers/ConformationColorer';\r\nimport TemperatureColorer from './colorers/TemperatureColorer';\r\nimport OccupancyColorer from './colorers/OccupancyColorer';\r\nimport HydrophobicityColorer from './colorers/HydrophobicityColorer';\r\nimport MoleculeColorer from './colorers/MoleculeColorer';\r\nimport CarbonColorer from './colorers/CarbonColorer';\r\n\r\nconst colorers = new EntityList([\r\n ElementColorer,\r\n ResidueTypeColorer,\r\n SequenceColorer,\r\n ChainColorer,\r\n SecondaryStructureColorer,\r\n UniformColorer,\r\n ConditionalColorer,\r\n ConformationColorer,\r\n TemperatureColorer,\r\n OccupancyColorer,\r\n HydrophobicityColorer,\r\n MoleculeColorer,\r\n CarbonColorer,\r\n]);\r\n\r\nexport default colorers;\r\n","import * as THREE from 'three';\r\nimport EntityList from '../utils/EntityList';\r\n\r\nfunction neutralColor(intensity) {\r\n return new THREE.Color(intensity, intensity, intensity);\r\n}\r\n\r\nconst materialList = [\r\n {\r\n id: 'DF',\r\n name: 'Diffuse',\r\n shortName: 'Diffuse',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'SF',\r\n name: 'Soft Plastic',\r\n shortName: 'Soft',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.1),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'PL',\r\n name: 'Glossy Plastic',\r\n shortName: 'Glossy',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.28),\r\n shininess: 100,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'ME',\r\n name: 'Metal',\r\n shortName: 'Metal',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.55),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TR',\r\n name: 'Transparent',\r\n shortName: 'Transparent',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'GL',\r\n name: 'Glass',\r\n shortName: 'Glass',\r\n uberOptions: {\r\n diffuse: neutralColor(0.50),\r\n specular: neutralColor(0.65),\r\n shininess: 100,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'BA',\r\n name: 'Backdrop',\r\n shortName: 'Backdrop',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: false,\r\n depthWrite: false,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TN',\r\n name: 'Toon',\r\n shortName: 'Toon',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: true,\r\n },\r\n }, {\r\n id: 'FL',\r\n name: 'Flat',\r\n shortName: 'Flat',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 0,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n },\r\n },\r\n];\r\n\r\nconst materials = new EntityList(materialList);\r\n\r\nexport default materials;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport UberMaterial from './shaders/UberMaterial';\r\nimport gfxutils from './gfxutils';\r\nimport settings from '../settings';\r\nimport materials from './materials';\r\nimport chem from '../chem';\r\n\r\nconst { selectors } = chem;\r\n\r\nclass Representation {\r\n constructor(index, mode, colorer, selector) {\r\n const startMaterialValues = {\r\n clipPlane: settings.now.draft.clipPlane,\r\n fogTransparent: settings.now.bg.transparent,\r\n shadowmap: settings.now.shadow.on,\r\n shadowmapType: settings.now.shadow.type,\r\n };\r\n this.index = index;\r\n this.mode = mode;\r\n this.colorer = colorer;\r\n this.selector = selector;\r\n this.selectorString = '';\r\n this.count = 0;\r\n this.material = new UberMaterial();\r\n this.material.setValues(startMaterialValues);\r\n this.material.setUberOptions({ fogAlpha: settings.now.fogAlpha });\r\n this.materialPreset = materials.first;\r\n this.needsRebuild = true;\r\n this.visible = true;\r\n\r\n // apply mode params & preset\r\n this.setMode(mode);\r\n }\r\n\r\n\r\n markAtoms(complex) {\r\n this.count = complex.markAtoms(this.selector, 1 << this.index);\r\n this.needsRebuild = true;\r\n return this.count;\r\n }\r\n\r\n unmarkAtoms(complex) {\r\n complex.clearAtomBits(1 << this.index);\r\n this.count = 0;\r\n }\r\n\r\n setMode(mode) {\r\n this.mode = mode;\r\n }\r\n\r\n setMaterialPreset(preset) {\r\n this.materialPreset = preset;\r\n this.material.setUberOptions(preset.uberOptions);\r\n this.material.setValues(preset.values);\r\n }\r\n\r\n reset() {\r\n this.geo = null;\r\n this.selectionGeo = null;\r\n }\r\n\r\n buildGeometry(complex) {\r\n this.reset();\r\n this.needsRebuild = false;\r\n\r\n if (settings.now.ao) {\r\n this.material.setValues({ normalsToGBuffer: settings.now.ao });\r\n }\r\n\r\n this.geo = this.mode.buildGeometry(complex, this.colorer, 1 << this.index, this.material);\r\n\r\n if (this.material.uberOptions.opacity < 0.99 && settings.now.transparency === 'prepass') {\r\n gfxutils.processTransparentMaterial(this.geo, this.material);\r\n }\r\n this.geo.visible = this.visible;\r\n\r\n gfxutils.processObjRenderOrder(this.geo, this.materialPreset.id);\r\n gfxutils.processColFromPosMaterial(this.geo, this.material);\r\n\r\n if (settings.now.shadow.on) {\r\n gfxutils.createShadowmapMaterial(this.geo, this.material);\r\n }\r\n\r\n return this.geo;\r\n }\r\n\r\n buildSelectionGeometry(mask) {\r\n let sg = null;\r\n\r\n if (this.geo && ('getSubset' in this.geo)) {\r\n const meshes = this.geo.getSubset(mask);\r\n if (meshes && meshes.length > 0) {\r\n sg = new THREE.Group();\r\n sg.matrixAutoUpdate = false;\r\n sg.matrix = this.geo.matrix;\r\n\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n sg.add(m);\r\n }\r\n }\r\n }\r\n\r\n if (sg) {\r\n sg.visible = this.visible;\r\n }\r\n\r\n this.selectionGeo = sg;\r\n return this.selectionGeo;\r\n }\r\n\r\n /**\r\n * Create object that represents difference between current and another rep\r\n * anotherRep could be undefined. In this case everything is reported.\r\n */\r\n compare(repSettings) {\r\n const diff = {};\r\n\r\n const selStr = String(this.selector);\r\n if (!repSettings || selStr.valueOf() !== String(repSettings.selector).valueOf()) {\r\n diff.selector = selStr;\r\n }\r\n\r\n const modeDiff = this.mode.identify();\r\n if (!repSettings || Array.isArray(modeDiff) || modeDiff !== repSettings.mode) {\r\n diff.mode = modeDiff;\r\n }\r\n\r\n const colorerDiff = this.colorer.identify();\r\n if (!repSettings || Array.isArray(colorerDiff) || colorerDiff !== repSettings.colorer) {\r\n diff.colorer = colorerDiff;\r\n }\r\n\r\n if (!repSettings || this.materialPreset.id !== repSettings.material) {\r\n diff.material = this.materialPreset.id;\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n /**\r\n * Change representation. Write fields what was changed into new object, return it.\r\n */\r\n change(repSettings, complex, mode, color) {\r\n const diff = {};\r\n\r\n // modify selector\r\n if (repSettings.selector) {\r\n const newSelectorObject = selectors.parse(repSettings.selector).selector;\r\n const newSelector = String(newSelectorObject);\r\n if (this.selectorString !== newSelector) {\r\n diff.selector = newSelector;\r\n this.selectorString = newSelector;\r\n this.selector = newSelectorObject;\r\n this.markAtoms(complex);\r\n }\r\n }\r\n\r\n // modify mode\r\n if (repSettings.mode) {\r\n const newMode = repSettings.mode;\r\n if (!_.isEqual(this.mode.identify(), newMode)) {\r\n diff.mode = newMode;\r\n this.setMode(mode);\r\n }\r\n }\r\n\r\n // modify colorer\r\n if (repSettings.colorer) {\r\n const newColorer = repSettings.colorer;\r\n if (!_.isEqual(this.colorer.identify(), newColorer)) {\r\n diff.colorer = newColorer;\r\n this.colorer = color;\r\n }\r\n }\r\n\r\n // modify material\r\n if (repSettings.material) {\r\n const newMaterial = repSettings.material;\r\n if (!_.isEqual(this.materialPreset.id, newMaterial)) {\r\n diff.material = newMaterial;\r\n this.setMaterialPreset(materials.get(repSettings.material));\r\n }\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n show(visible) {\r\n this.visible = visible;\r\n if (this.geo) {\r\n this.geo.visible = visible;\r\n }\r\n if (this.selectionGeo) {\r\n this.selectionGeo.visible = visible;\r\n }\r\n }\r\n}\r\n\r\nexport default Representation;\r\n","import * as THREE from 'three';\r\nimport logger from './utils/logger';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport './gfx/modes';\r\n\r\nfunction _traverseComponentGroups(root, component, callback) {\r\n const { children } = root;\r\n if (!children) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n if (child._component === component) {\r\n callback(child);\r\n }\r\n if (child instanceof gfxutils.RCGroup) {\r\n _traverseComponentGroups(child, component, callback);\r\n }\r\n }\r\n}\r\n\r\nfunction ComplexEditor() {\r\n}\r\n\r\nclass ComplexComponentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n // init component matrices\r\n this._componentTransforms = [];\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n const component = complex._components[i];\r\n this._componentTransforms[component._index] = new THREE.Object3D();\r\n }\r\n\r\n this._inProgress = true;\r\n\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const complex = this._complexVisual.getComplex();\r\n\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n this._bakeComponentTransform(complex._components[i]);\r\n }\r\n\r\n complex.onAtomPositionChanged();\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n const visual = this._complexVisual;\r\n const component = visual.getSelectedComponent();\r\n\r\n if (component === null) {\r\n return res;\r\n }\r\n\r\n const selection = this._complexVisual.getSelectionGeo();\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n // find all geo nodes for this component\r\n _traverseComponentGroups(visual, component, (child) => {\r\n res.objects.push(child);\r\n });\r\n\r\n // find all selection nodes for this component\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component') && geo._component === component) {\r\n res.objects.push(geo);\r\n }\r\n }\r\n }\r\n\r\n // add dummy object that stores component transformation\r\n res.objects.push(this._componentTransforms[component._index]);\r\n\r\n const bbmin = new THREE.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n const bbmax = new THREE.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (j = 0; j < atoms.length; ++j) {\r\n if (atoms[j].mask & selectionMask) {\r\n bbmin.min(atoms[j].position);\r\n bbmax.max(atoms[j].position);\r\n }\r\n }\r\n });\r\n\r\n res.pivot.lerpVectors(bbmin, bbmax, 0.5);\r\n return res;\r\n }\r\n\r\n _bakeComponentTransform(component) {\r\n const t = this._componentTransforms[component._index];\r\n if (t && (!(t.position.x === 0 && t.position.y === 0 && t.position.z === 0)\r\n || !(t.quaternion.x === 0 && t.quaternion.y === 0 && t.quaternion.z === 0 && t.quaternion.w === 1))) {\r\n t.updateMatrix();\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (let j = 0; j < atoms.length; ++j) {\r\n atoms[j].position.applyMatrix4(t.matrix);\r\n }\r\n });\r\n }\r\n }\r\n\r\n _resetComponentTransform() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n for (i = 0; i < this._componentTransforms.length; ++i) {\r\n geo = this._componentTransforms[i];\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n\r\n // reset all geo nodes\r\n for (i = 0; i < visual.children.length; ++i) {\r\n reprNode = visual.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n // reset all selection nodes\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\nclass ComplexFragmentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n const atoms = this._getSelectionBorderAtoms();\r\n if (atoms.length < 1 || atoms.length > 2) {\r\n logger.error('Can only edit fragments with one or two bound atoms.');\r\n return false;\r\n }\r\n\r\n this._fragmentBoundAtoms = atoms;\r\n\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n\r\n // hide selected fragment in main model\r\n visual.disableSubset(selectionMask, true);\r\n\r\n // hide selection geo in main model\r\n for (let k = 0; k < selection.children.length; ++k) {\r\n selection.children[k].visible = false;\r\n }\r\n\r\n // create visible fragment representation to rotate\r\n const pivotPos = atoms[0].position.clone();\r\n\r\n if (atoms.length === 2) {\r\n pivotPos.lerp(atoms[1].position, 0.5);\r\n }\r\n\r\n this._fragmentGeo = new THREE.Group();\r\n visual.add(this._fragmentGeo);\r\n this._fragmentGeo.position.copy(pivotPos);\r\n\r\n this._fragmentSelectionGeo = new THREE.Group();\r\n selection.add(this._fragmentSelectionGeo);\r\n this._fragmentSelectionGeo.position.copy(pivotPos);\r\n\r\n const offset = pivotPos.clone();\r\n offset.negate();\r\n\r\n for (let i = 0; i < visual.children.length; ++i) {\r\n const g = visual.children[i];\r\n if (!('getSubset' in g)) {\r\n continue;\r\n }\r\n\r\n const vg = new THREE.Group();\r\n this._fragmentGeo.add(vg);\r\n\r\n const sg = new THREE.Group();\r\n this._fragmentSelectionGeo.add(sg);\r\n\r\n const meshes = g.getSubset(selectionMask, true);\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n vg.add(m);\r\n m.position.copy(offset);\r\n }\r\n\r\n const smeshes = g.getSubset(selectionMask, true);\r\n for (let h = 0; h < smeshes.length; h++) {\r\n const sm = smeshes[h];\r\n sg.add(sm);\r\n sm.position.copy(offset);\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(this._fragmentSelectionGeo);\r\n\r\n this._inProgress = true;\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selectionBit = visual.getSelectionBit();\r\n\r\n const p = this._fragmentGeo.position;\r\n const m = this._fragmentGeo.matrix.clone();\r\n m.multiply(new THREE.Matrix4().makeTranslation(-p.x, -p.y, -p.z));\r\n\r\n this._bakeAtomTransform(m, 1 << selectionBit);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << selectionBit, true);\r\n\r\n visual.getComplex().onAtomPositionChanged();\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n this._fragmentGeo.parent.remove(this._fragmentGeo);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << visual.getSelectionBit(), true);\r\n\r\n // show selection geo in main model (+ remove fragment selection geo)\r\n for (let i = 0; i < selection.children.length; ++i) {\r\n const node = selection.children[i];\r\n if (node.visible) {\r\n selection.remove(node);\r\n } else {\r\n node.visible = true;\r\n }\r\n }\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n isFreeRotationAllowed() {\r\n return (this._fragmentBoundAtoms.length < 2);\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n res.objects.push(this._fragmentGeo, this._fragmentSelectionGeo);\r\n\r\n const boundAtoms = this._fragmentBoundAtoms;\r\n if (boundAtoms.length === 1) {\r\n if (boundAtoms[0].bonds.length === 1) {\r\n // single external bond allows rotation about bond axis\r\n const bond = boundAtoms[0].bonds[0];\r\n res.axis = new THREE.Vector3().subVectors(bond._right.position, bond._left.position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n } else if (boundAtoms.length === 2) {\r\n // two bound atoms allow rotation only about axis running through their centers\r\n res.axis = new THREE.Vector3().subVectors(boundAtoms[1].position, boundAtoms[0].position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _getSelectionBorderAtoms() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n const selectionMask = 1 << this._complexVisual.getSelectionBit();\r\n const atomHash = {};\r\n\r\n complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n atomHash[bond._left.index] = 1;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n atomHash[bond._right.index] = 1;\r\n }\r\n });\r\n\r\n const atoms = [];\r\n const keys = Object.keys(atomHash);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const idx = keys[i];\r\n atoms.push(complex._atoms[idx]);\r\n }\r\n\r\n return atoms;\r\n }\r\n\r\n _bakeAtomTransform(matrix, mask) {\r\n this._complexVisual.getComplex().forEachAtom((atom) => {\r\n if (atom.mask & mask) {\r\n atom.position.applyMatrix4(matrix);\r\n }\r\n });\r\n }\r\n}\r\n\r\n\r\nexport default {\r\n ComponentEditor: ComplexComponentEditor,\r\n FragmentEditor: ComplexFragmentEditor,\r\n};\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\nimport chem from './chem';\r\nimport settings from './settings';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport Visual from './Visual';\r\nimport ComplexVisualEdit from './ComplexVisualEdit';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction lookupAndCreate(entityList, specs) {\r\n if (!Array.isArray(specs)) {\r\n specs = [specs];\r\n }\r\n const [id, opts] = specs;\r\n const Entity = entityList.get(id) || entityList.first;\r\n return new Entity(opts);\r\n}\r\n\r\nclass ComplexVisual extends Visual {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this._complex = dataSource;\r\n\r\n /** @type {Representation[]} */\r\n this._reprList = [];\r\n /** @type {?Representation} */\r\n this._repr = null;\r\n this._reprListChanged = true;\r\n\r\n this._selectionBit = 0;\r\n this._reprUsedBits = 0;\r\n this._selectionCount = 0;\r\n\r\n this._selectionGeometry = new THREE.Group();\r\n }\r\n\r\n getBoundaries() {\r\n return this._complex.getBoundaries();\r\n }\r\n\r\n release() {\r\n if (this._selectionGeometry.parent) {\r\n this._selectionGeometry.remove(this._selectionGeometry);\r\n }\r\n Visual.prototype.release.call(this);\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getSelectionCount() {\r\n return this._selectionCount;\r\n }\r\n\r\n getSelectionGeo() {\r\n return this._selectionGeometry;\r\n }\r\n\r\n getSelectionBit() {\r\n return this._selectionBit;\r\n }\r\n\r\n getEditor() {\r\n return this._editor;\r\n }\r\n\r\n resetReps(reps) {\r\n // Create all necessary representations\r\n if (this._complex) {\r\n this._complex.clearAtomBits(~0);\r\n }\r\n this._reprListChanged = true;\r\n this._reprUsedBits = 0;\r\n this._reprList.length = reps.length;\r\n for (let i = 0, n = reps.length; i < n; ++i) {\r\n const rep = reps[i];\r\n\r\n let selector;\r\n let selectorString;\r\n if (typeof rep.selector === 'string') {\r\n selectorString = rep.selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else if (typeof rep.selector === 'undefined') {\r\n selectorString = settings.now.presets.default[0].selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else {\r\n ({ selector } = rep);\r\n selectorString = selector.toString();\r\n }\r\n const mode = lookupAndCreate(modes, rep.mode);\r\n const colorer = lookupAndCreate(colorers, rep.colorer);\r\n const material = materials.get(rep.material) || materials.first;\r\n\r\n this._reprList[i] = new Representation(i, mode, colorer, selector);\r\n this._reprList[i].setMaterialPreset(material);\r\n this._reprList[i].selectorString = selectorString;\r\n\r\n if (this._complex) {\r\n this._complex.markAtoms(selector, 1 << i);\r\n }\r\n\r\n this._reprUsedBits |= 1 << i;\r\n }\r\n this._repr = reps.length > 0 ? this._reprList[0] : null;\r\n\r\n this._selectionBit = reps.length;\r\n this._reprUsedBits |= 1 << this._selectionBit; // selection uses one bit\r\n this._selectionCount = 0;\r\n\r\n if (this._complex) {\r\n this._complex.update();\r\n }\r\n }\r\n\r\n /**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\n repCount() {\r\n return this._reprList.length;\r\n }\r\n\r\n /**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\n repCurrent(index) {\r\n if (index >= 0 && index < this._reprList.length) {\r\n this._repr = this._reprList[index];\r\n } else {\r\n index = this._reprList.indexOf(this._repr);\r\n }\r\n return index;\r\n }\r\n\r\n /**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {Object} {desc, index, status} field desc contains rep description, index - index of correspondent rep,\r\n * status - one of three strings: 'created', 'changed', ''. 'created' means new rep was created during this function,\r\n * 'changed' - rep was changed during this function. '' - something else.\r\n */\r\n rep(index, rep) {\r\n // if index is missing then it is the current\r\n if (!rep && (index === undefined || index instanceof Object)) {\r\n rep = index;\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index > this._reprList.length) {\r\n logger.error(`Rep ${index} does not exist!`);\r\n return null;\r\n }\r\n\r\n // a special case of adding just after the end\r\n if (index === this._reprList.length) {\r\n const res = this.repAdd(rep);\r\n logger.warn(`Rep ${index} does not exist! New representation was created.`);\r\n return { desc: res.desc, index, status: 'created' };\r\n }\r\n\r\n // gather description\r\n const target = this._reprList[index];\r\n const desc = {\r\n selector: target.selectorString,\r\n mode: target.mode.identify(),\r\n colorer: target.colorer.identify(),\r\n material: target.materialPreset.id,\r\n };\r\n\r\n // modification is requested\r\n if (rep) {\r\n // modify\r\n const diff = target.change(rep, this._complex,\r\n lookupAndCreate(modes, rep.mode),\r\n lookupAndCreate(colorers, rep.colorer));\r\n\r\n // something was changed\r\n if (!_.isEmpty(diff)) {\r\n target.needsRebuild = true;\r\n for (const key in diff) {\r\n if (diff.hasOwnProperty(key)) {\r\n desc[key] = diff[key];\r\n logger.debug(`rep[${index}].${key} changed to ${diff[key]}`);\r\n }\r\n }\r\n\r\n // safety trick: lower resolution for surface modes\r\n if (diff.mode && target.mode.isSurface\r\n && (settings.now.resolution === 'ultra' || settings.now.resolution === 'high')) {\r\n logger.report('Surface resolution was changed to \"medium\" to avoid hang-ups.');\r\n settings.set('resolution', 'medium');\r\n }\r\n return { desc, index, status: 'changed' };\r\n }\r\n }\r\n return { desc, index, status: '' };\r\n }\r\n\r\n\r\n /**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\n repGet(index) {\r\n // if index is missing then it is the current\r\n if (index === undefined || index instanceof Object) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return null;\r\n }\r\n\r\n return this._reprList[index];\r\n }\r\n\r\n _getFreeReprIdx() {\r\n let bits = this._reprUsedBits;\r\n for (let i = 0; i <= ComplexVisual.NUM_REPRESENTATION_BITS; ++i, bits >>= 1) {\r\n if ((bits & 1) === 0) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {Object} {desc, index} field desc contains added rep description, index - index of this rep.\r\n */\r\n repAdd(rep) {\r\n if (this._reprList.length >= ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n return null;\r\n }\r\n\r\n const newSelectionBit = this._getFreeReprIdx();\r\n if (newSelectionBit < 0) {\r\n return null; // no more slots for representations\r\n }\r\n\r\n const originalSelection = this.buildSelectorFromMask(1 << this._selectionBit);\r\n\r\n // Fill in default values\r\n const def = settings.now.presets.default[0];\r\n const desc = _.merge({\r\n selector: def.selector,\r\n mode: def.mode,\r\n colorer: def.colorer,\r\n material: def.material,\r\n }, rep);\r\n\r\n const selector = (typeof desc.selector === 'string') ? selectors.parse(desc.selector).selector : desc.selector;\r\n const target = new Representation(\r\n this._selectionBit,\r\n lookupAndCreate(modes, desc.mode),\r\n lookupAndCreate(colorers, desc.colorer),\r\n selector,\r\n );\r\n target.selectorString = selector.toString();\r\n target.setMaterialPreset(materials.get(desc.material));\r\n target.markAtoms(this._complex);\r\n this._reprList.push(target);\r\n\r\n // change selection bit\r\n this._selectionBit = newSelectionBit;\r\n this._reprUsedBits |= 1 << this._selectionBit;\r\n\r\n // restore selection using new selection bit\r\n this._complex.markAtoms(originalSelection, 1 << this._selectionBit);\r\n\r\n return { desc, index: this._reprList.length - 1 };\r\n }\r\n\r\n /**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\n repRemove(index) {\r\n if (index === undefined) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // catch out of bounds case\r\n let count = this._reprList.length;\r\n if (index < 0 || index >= count || count <= 1) { // do not allow to remove the single rep\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.unmarkAtoms(this._complex);\r\n this._reprUsedBits &= ~(1 << target.index);\r\n\r\n this._reprList.splice(index, 1);\r\n\r\n // update current rep\r\n if (target === this._repr) {\r\n --count;\r\n index = index < count ? index : count - 1;\r\n this._repr = this._reprList[index];\r\n }\r\n this._reprListChanged = true;\r\n }\r\n\r\n /**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\n repHide(index, hide) {\r\n if (hide === undefined) {\r\n hide = true;\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.show(!hide);\r\n }\r\n\r\n /**\r\n * Select atoms with selector\r\n * @param {Selector} selector - selector\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\n select(selector, append) {\r\n if (append) {\r\n this._selectionCount += this._complex.markAtomsAdditionally(selector, 1 << this._selectionBit);\r\n } else {\r\n this._selectionCount = this._complex.markAtoms(selector, 1 << this._selectionBit);\r\n }\r\n this._complex.updateStructuresMask();\r\n this.rebuildSelectionGeometry();\r\n }\r\n\r\n resetSelectionMask() {\r\n if (this._selectionCount !== 0) {\r\n this._selectionCount = 0;\r\n if (this._complex) {\r\n this._complex.clearAtomBits(1 << this._selectionBit);\r\n }\r\n }\r\n }\r\n\r\n updateSelectionMask(pickedObj) {\r\n const self = this;\r\n const { atom } = pickedObj;\r\n let { residue, chain, molecule } = pickedObj;\r\n const setMask = 1 << this._selectionBit;\r\n const clearMask = ~setMask;\r\n\r\n if (atom) {\r\n residue = atom.residue;\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (atom.mask & setMask) {\r\n atom.mask &= clearMask;\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n if (molecule) {\r\n molecule.mask &= clearMask;\r\n }\r\n this._selectionCount--;\r\n } else {\r\n atom.mask |= setMask;\r\n this._selectionCount++;\r\n\r\n // select residue if all atoms in it are selected\r\n residue.collectMask();\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (residue) {\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (residue._mask & setMask) {\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n residue.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n } else {\r\n residue._mask |= setMask;\r\n residue.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (chain || molecule) {\r\n const obj = chain || molecule;\r\n if (obj._mask & setMask) {\r\n obj._mask &= clearMask;\r\n obj.forEachResidue((r) => {\r\n if (r._mask & setMask) {\r\n r._mask &= clearMask;\r\n r.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n r._mask &= clearMask;\r\n }\r\n });\r\n } else {\r\n obj._mask |= setMask;\r\n obj.forEachResidue((r) => {\r\n if (!(r._mask & setMask)) {\r\n r._mask |= setMask;\r\n r.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n const otherObj = chain ? r.getMolecule() : r.getChain();\r\n if (otherObj) {\r\n otherObj.collectMask();\r\n }\r\n }\r\n });\r\n }\r\n } else {\r\n this.resetSelectionMask();\r\n }\r\n }\r\n\r\n expandSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms to add\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // select marked atoms\r\n const deselectionMask = ~tmpMask;\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask = (atom.mask & deselectionMask) | selectionMask;\r\n ++self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n shrinkSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms neighbouring to unselected ones\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // mark hanging atoms\r\n this._complex.forEachAtom((atom) => {\r\n if ((atom.mask & selectionMask) && (atom.bonds.length === 1)) {\r\n atom.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // deselect marked atoms\r\n const deselectionMask = ~(selectionMask | tmpMask);\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask &= deselectionMask;\r\n --self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n getSelectedComponent() {\r\n const selectionMask = 1 << this._selectionBit;\r\n\r\n let component = null;\r\n let multiple = false;\r\n\r\n // find which component is selected (exclusively)\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & selectionMask) {\r\n if (component === null) {\r\n component = atom.residue._component;\r\n } else if (component !== atom.residue._component) {\r\n multiple = true;\r\n }\r\n }\r\n });\r\n\r\n return multiple ? null : component;\r\n }\r\n\r\n getSelectionCenter(center, includesAtom, selRule) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._complex.forEachAtom((atom) => {\r\n if (includesAtom(atom, selRule)) {\r\n center.add(atom.position);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.applyMatrix4(this.matrix);\r\n return true;\r\n }\r\n\r\n needsRebuild() {\r\n if (this._reprListChanged) {\r\n return true;\r\n }\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n if (repr.needsRebuild) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Rebuild molecule geometry asynchronously.\r\n */\r\n rebuild() {\r\n const self = this;\r\n\r\n // Destroy current geometry\r\n gfxutils.clearTree(this);\r\n\r\n return new Promise(((resolve) => {\r\n // Nothing to do?\r\n const complex = self._complex;\r\n if (!complex) {\r\n resolve();\r\n return;\r\n }\r\n\r\n let errorOccured = false;\r\n setTimeout(() => {\r\n console.time('build');\r\n const reprList = self._reprList;\r\n const palette = palettes.get(settings.now.palette) || palettes.first;\r\n let hasGeometry = false;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n repr.colorer.palette = palette;\r\n\r\n if (repr.needsRebuild) {\r\n repr.reset();\r\n\r\n try {\r\n repr.buildGeometry(complex);\r\n } catch (e) {\r\n if (e instanceof utils.OutOfMemoryError) {\r\n repr.needsRebuild = false;\r\n repr.reset();\r\n logger.error(`Not enough memory to build geometry for representation ${repr.index + 1}`);\r\n errorOccured = true;\r\n } else {\r\n throw e;\r\n }\r\n }\r\n\r\n if (DEBUG && !errorOccured) {\r\n logger.debug(`Triangles count: ${gfxutils.countTriangles(repr.geo)}`);\r\n }\r\n }\r\n\r\n hasGeometry = errorOccured || hasGeometry || gfxutils.groupHasGeometryToRender(repr.geo);\r\n\r\n if (repr.geo) {\r\n self.add(repr.geo);\r\n }\r\n }\r\n\r\n self._reprListChanged = false;\r\n\r\n console.timeEnd('build');\r\n resolve();\r\n }, 10);\r\n }));\r\n }\r\n\r\n setNeedsRebuild() {\r\n // invalidate all representations\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n reprList[i].needsRebuild = true;\r\n }\r\n }\r\n\r\n rebuildSelectionGeometry() {\r\n const mask = 1 << this._selectionBit;\r\n\r\n gfxutils.clearTree(this._selectionGeometry);\r\n\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const repr = this._reprList[i];\r\n const sg = repr.buildSelectionGeometry(mask);\r\n if (!sg) {\r\n continue;\r\n }\r\n\r\n this._selectionGeometry.add(sg);\r\n for (let j = 0; j < sg.children.length; j++) {\r\n const m = sg.children[j];\r\n\r\n // copy component transform (that's not applied yet)\r\n // TODO make this code obsolete, accessing editor is bad\r\n if (this._editor && this._editor._componentTransforms) {\r\n const t = this._editor._componentTransforms[m._component._index];\r\n if (t) {\r\n m.position.copy(t.position);\r\n m.quaternion.copy(t.quaternion);\r\n }\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(sg);\r\n }\r\n }\r\n\r\n _buildSelectorFromSortedLists(atoms, residues, chains) {\r\n const complex = this._complex;\r\n\r\n function optimizeList(list) {\r\n const result = [];\r\n let k = 0;\r\n let first = NaN;\r\n let last = NaN;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const value = list[i];\r\n if (value === last + 1) {\r\n last = value;\r\n } else {\r\n if (!Number.isNaN(first)) {\r\n result[k++] = new selectors.Range(first, last);\r\n }\r\n first = last = value;\r\n }\r\n }\r\n if (!Number.isNaN(first)) {\r\n result[k] = new selectors.Range(first, last);\r\n }\r\n return result;\r\n }\r\n\r\n let expression = null;\r\n if (chains.length === complex._chains.length) {\r\n expression = selectors.all();\r\n } else {\r\n let selector;\r\n if (chains.length > 0) {\r\n selector = selectors.chain(chains);\r\n expression = expression ? selectors.or(expression, selector) : selector;// NOSONAR\r\n }\r\n if (Object.keys(residues).length > 0) {\r\n for (const ch in residues) {\r\n if (residues.hasOwnProperty(ch)) {\r\n selector = selectors.and(\r\n selectors.chain(ch),\r\n selectors.residx(optimizeList(residues[ch])),\r\n );\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n }\r\n }\r\n if (atoms.length > 0) {\r\n selector = selectors.serial(optimizeList(atoms));\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n\r\n if (!expression) {\r\n expression = selectors.none();\r\n }\r\n }\r\n\r\n return expression;\r\n }\r\n\r\n buildSelectorFromMask(mask) {\r\n const complex = this._complex;\r\n const chains = [];\r\n const residues = {};\r\n const atoms = [];\r\n\r\n complex.forEachChain((chain) => {\r\n if (chain._mask & mask) {\r\n chains.push(chain._name);\r\n }\r\n });\r\n\r\n complex.forEachResidue((residue) => {\r\n if (residue._mask & mask && !(residue._chain._mask & mask)) {\r\n const c = residue._chain._name;\r\n if (!(c in residues)) {\r\n residues[c] = [residue._index];\r\n } else {\r\n residues[c].push(residue._index);\r\n }\r\n }\r\n });\r\n\r\n complex.forEachAtom((atom) => {\r\n if (atom.mask & mask && !(atom.residue._mask & mask)) {\r\n atoms.push(atom.serial);\r\n }\r\n });\r\n\r\n return this._buildSelectorFromSortedLists(atoms, residues, chains);\r\n }\r\n\r\n forSelectedResidues(process) {\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.forEachResidue((residue) => {\r\n if (residue._mask & selectionMask) {\r\n process(residue);\r\n }\r\n });\r\n }\r\n\r\n beginComponentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.ComponentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n beginFragmentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.FragmentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n // should only be called by editors\r\n finalizeEdit() {\r\n this._editor = null;\r\n }\r\n\r\n setMaterialValues(values, needTraverse = false, process = undefined) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setValues(values);\r\n if (needTraverse) {\r\n rep.geo.traverse((object) => {\r\n if (object instanceof THREE.Mesh) {\r\n object.material.setValues(values);\r\n\r\n if (process !== undefined) {\r\n process(object);\r\n }\r\n\r\n object.material.needsUpdate = true;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n setUberOptions(values) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setUberOptions(values);\r\n }\r\n }\r\n\r\n /**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\n within(selector, radius) {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return false;\r\n }\r\n\r\n // mark atoms of the group as selected\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.markAtoms(selector, selectionMask);\r\n\r\n // mark all atoms within distance as selected\r\n if (vw) {\r\n vw.forEachAtomWithinDistFromMasked(this._complex, selectionMask, Number(radius), (atom) => {\r\n atom.mask |= selectionMask;\r\n });\r\n }\r\n\r\n // update selection count\r\n this._selectionCount = this._complex.countAtomsByMask(selectionMask);\r\n\r\n // update secondary structure mask\r\n this._complex.updateStructuresMask();\r\n\r\n return this.buildSelectorFromMask(selectionMask);\r\n }\r\n}\r\n// 32 bits = 30 bits for reps + 1 for selection + 1 for selection expansion\r\nComplexVisual.NUM_REPRESENTATION_BITS = 30;\r\n\r\nexport default ComplexVisual;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexVolumeFaces from './VolumeFaces.vert';\r\nimport fragmentVolumeFaces from './VolumeFaces.frag';\r\nimport vertexVolume from './Volume.vert';\r\nimport fragmentVolume from './Volume.frag';\r\nimport vertexFarPlane from './VolumeFarPlane.vert';\r\nimport fragmentFarPlane from './VolumeFarPlane.frag';\r\nimport settings from '../../settings';\r\n\r\nconst volumeUniforms = THREE.UniformsUtils.merge([\r\n {\r\n volumeDim: { type: 'v3', value: new THREE.Vector3(512, 512, 512) },\r\n tileTex: { type: 't', value: null },\r\n tileTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n tileStride: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n\r\n boxAngles: { type: 'v3', value: new THREE.Vector3(1, 1, 1) },\r\n delta: { type: 'v3', value: new THREE.Vector3(0, 0, 0) },\r\n\r\n _isoLevel0: { type: 'v2', value: new THREE.Vector3(0.5, 0.75, 1.0) },\r\n _flipV: { type: 'f', value: 0.0 },\r\n _BFLeft: { type: 't', value: null },\r\n _BFRight: { type: 't', value: null },\r\n _FFLeft: { type: 't', value: null },\r\n _FFRight: { type: 't', value: null },\r\n _WFFLeft: { type: 't', value: null },\r\n _WFFRight: { type: 't', value: null },\r\n },\r\n]);\r\n\r\nfunction overrideUniforms(params, defUniforms) {\r\n const uniforms = THREE.UniformsUtils.clone(defUniforms);\r\n for (const p in params) {\r\n if (uniforms.hasOwnProperty(p)) {\r\n uniforms[p].value = params[p];\r\n }\r\n }\r\n return uniforms;\r\n}\r\n\r\nfunction facesPosMaterialParams(params, sideType) {\r\n return {\r\n uniforms: overrideUniforms(params, {}),\r\n vertexShader: vertexVolumeFaces,\r\n fragmentShader: fragmentVolumeFaces,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n side: sideType,\r\n };\r\n}\r\n\r\nclass BackFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const backFaceParams = facesPosMaterialParams(params, THREE.BackSide);\r\n super(backFaceParams);\r\n }\r\n}\r\n\r\nclass ShaderParams {\r\n constructor(params, uniforms, vertexShader, fragmentShader) {\r\n this.uniforms = overrideUniforms(params, uniforms);\r\n this.vertexShader = vertexShader;\r\n this.fragmentShader = fragmentShader;\r\n this.transparent = false;\r\n this.depthTest = false;\r\n this.depthWrite = false;\r\n this.side = THREE.FrontSide;\r\n }\r\n}\r\n\r\nclass BackFacePosMaterialFarPlane extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const matUniforms = THREE.UniformsUtils.merge([\r\n {\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n farZ: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n matWorld2Volume: { type: '4fv', value: new THREE.Matrix4() },\r\n },\r\n ]);\r\n\r\n const shaderParams = new ShaderParams(params, matUniforms, vertexFarPlane, fragmentFarPlane);\r\n super(shaderParams);\r\n }\r\n}\r\n\r\nclass FrontFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const frontFaceParams = facesPosMaterialParams(params, THREE.FrontSide);\r\n super(frontFaceParams);\r\n }\r\n}\r\n\r\nclass VolumeMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const shaderParams = new ShaderParams(params, volumeUniforms, vertexVolume, fragmentVolume);\r\n shaderParams.transparent = true;\r\n shaderParams.depthTest = true;\r\n\r\n super(shaderParams);\r\n this.updateDefines();\r\n }\r\n\r\n updateDefines() {\r\n this.defines = {\r\n ISO_MODE: settings.now.modes.VD.isoMode,\r\n STEPS_COUNT: settings.now.modes.VD.polyComplexity[settings.now.resolution] * 100,\r\n };\r\n this.needsUpdate = true;\r\n }\r\n}\r\n\r\nexport default {\r\n BackFacePosMaterial,\r\n BackFacePosMaterialFarPlane,\r\n FrontFacePosMaterial,\r\n VolumeMaterial,\r\n};\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport settings from '../settings';\r\n\r\nclass VolumeMesh extends THREE.Mesh {\r\n volumeInfo = {}; // data for noise filter\r\n\r\n constructor() {\r\n const geo = new THREE.BufferGeometry();\r\n super(geo);\r\n this.clipPlane = new THREE.Plane();\r\n const size = new THREE.Vector3(0.5, 0.5, 0.5);\r\n this.size = size;\r\n\r\n this.cullFlag = [\r\n true, true, true, true,\r\n true, true, true, true,\r\n false, false, false, false, false, false,\r\n ];\r\n\r\n this.faces = [\r\n { indices: [], norm: new THREE.Vector3(0, 0, -1) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 1) },\r\n { indices: [], norm: new THREE.Vector3(0, -1, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 1, 0) },\r\n { indices: [], norm: new THREE.Vector3(-1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 0) },\r\n ];\r\n\r\n this.vertices = [\r\n new THREE.Vector3(-size.x, -size.y, -size.z),\r\n new THREE.Vector3(-size.x, size.y, -size.z),\r\n new THREE.Vector3(size.x, -size.y, -size.z),\r\n new THREE.Vector3(size.x, size.y, -size.z),\r\n new THREE.Vector3(-size.x, -size.y, size.z),\r\n new THREE.Vector3(-size.x, size.y, size.z),\r\n new THREE.Vector3(size.x, -size.y, size.z),\r\n new THREE.Vector3(size.x, size.y, size.z),\r\n new THREE.Vector3(0.0, 0.0, 0.0), // Placeholder for section\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n ];\r\n\r\n geo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(this.vertices.length * 3), 3));\r\n\r\n this.name = 'VolumeMesh';\r\n }\r\n\r\n static _corners = [\r\n // x, y, z, edge1, edge2, edge3\r\n [-1, -1, -1, 0, 4, 8],\r\n [1, -1, -1, 0, 5, 9],\r\n [1, 1, -1, 1, 5, 10],\r\n [-1, 1, -1, 1, 4, 11],\r\n [-1, -1, 1, 2, 6, 8],\r\n [1, -1, 1, 2, 7, 9],\r\n [1, 1, 1, 3, 7, 10],\r\n [-1, 1, 1, 3, 6, 11],\r\n ];\r\n\r\n static _edges = [\r\n // corner1, corner2, center_x, center_y, center_z\r\n [0, 1, 0, -1, -1],\r\n [2, 3, 0, 1, -1],\r\n [4, 5, 0, -1, 1],\r\n [6, 7, 0, 1, 1],\r\n [0, 3, -1, 0, -1],\r\n [1, 2, 1, 0, -1],\r\n [4, 7, -1, 0, 1],\r\n [5, 6, 1, 0, 1],\r\n [0, 4, -1, -1, 0],\r\n [1, 5, 1, -1, 0],\r\n [2, 6, -1, 1, 0],\r\n [3, 7, 1, 1, 0],\r\n ];\r\n\r\n static _edgeIntersections = (function () {\r\n const edgeIntersections = [];\r\n for (let j = 0; j < 12; ++j) {\r\n edgeIntersections.push(new THREE.Vector3());\r\n }\r\n return edgeIntersections;\r\n }());\r\n\r\n _updateVertices() {\r\n // Algorithm:\r\n // 1. Get plane parameters\r\n // 2. Compute culling flags for all vertices\r\n // 3. If intersection occurs => compute from 3 to 6 intersection points\r\n const corners = VolumeMesh._corners;\r\n const edges = VolumeMesh._edges;\r\n const edgeIntersections = VolumeMesh._edgeIntersections;\r\n\r\n let i;\r\n\r\n const norm = this.clipPlane.normal;\r\n const D = this.clipPlane.constant;\r\n\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n const cornerMark = [0, 0, 0, 0, 0, 0, 0, 0];\r\n const edgeMark = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];\r\n\r\n const curEdge = new THREE.Vector3();\r\n let curEdgeInter = null;\r\n\r\n function CheckX() {\r\n if (norm.x === 0) return 0;\r\n const x = -(norm.dot(curEdge) + D) / norm.x;\r\n if (-size.x <= x && x <= size.x) {\r\n curEdgeInter.set(x, curEdge.y, curEdge.z);\r\n if (x === size.x) return 2;\r\n if (x === -size.x) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckY() {\r\n if (norm.y === 0) return 0;\r\n const y = -(norm.dot(curEdge) + D) / norm.y;\r\n if (-size.y <= y && y <= size.y) {\r\n curEdgeInter.set(curEdge.x, y, curEdge.z);\r\n if (y === size.y) return 2;\r\n if (y === -size.y) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckZ() {\r\n if (norm.z === 0) return 0;\r\n const z = -(norm.dot(curEdge) + D) / norm.z;\r\n if (-size.z <= z && z <= size.z) {\r\n curEdgeInter.set(curEdge.x, curEdge.y, z);\r\n if (z === size.z) return 2;\r\n if (z === -size.z) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n // for each edge\r\n for (let curEdgeIdx = 0; curEdgeIdx < 12; ++curEdgeIdx) {\r\n const curEdgeSource = edges[curEdgeIdx];\r\n curEdgeInter = edgeIntersections[curEdgeIdx];\r\n\r\n curEdge.set(curEdgeSource[2], curEdgeSource[3], curEdgeSource[4]);\r\n curEdge.multiply(size);\r\n\r\n // calculate intersection point\r\n let flag = 0;\r\n if (curEdgeSource[2] === 0) flag = CheckX();\r\n if (curEdgeSource[3] === 0) flag = CheckY();\r\n if (curEdgeSource[4] === 0) flag = CheckZ();\r\n\r\n // mark corresponding corner (if plane cuts through one)\r\n if (flag === -2) {\r\n cornerMark[curEdgeSource[0]] = 1;\r\n } else if (flag === 2) {\r\n cornerMark[curEdgeSource[1]] = 1;\r\n } else if (flag === 0) {\r\n // edge is not intersected by the plane (doesn't produce a vertex)\r\n edgeMark[curEdgeIdx] = 0;\r\n }\r\n }\r\n\r\n const face = {\r\n indices: [],\r\n norm: norm.clone().negate(),\r\n };\r\n\r\n let nextVertex = 8;\r\n\r\n // for each marked corner\r\n for (i = 0; i < 8; ++i) {\r\n if (cornerMark[i] === 1) {\r\n // add corner as vertex to the face\r\n vert[nextVertex].set(corners[i][0], corners[i][1], corners[i][2]).multiply(size);\r\n face.indices.push(nextVertex++);\r\n // skip adjacent edges\r\n edgeMark[corners[i][3]] = 0;\r\n edgeMark[corners[i][4]] = 0;\r\n edgeMark[corners[i][5]] = 0;\r\n }\r\n }\r\n\r\n // for each edge that has internal intersection\r\n for (i = 0; i < 12; ++i) {\r\n if (edgeMark[i] === 1) {\r\n // add intersection point as vertex to the face\r\n vert[nextVertex].copy(edgeIntersections[i]);\r\n face.indices.push(nextVertex++);\r\n }\r\n }\r\n\r\n this.faces[6] = face;\r\n\r\n const diff = new THREE.Vector3();\r\n const coplanarPoint = new THREE.Vector3();\r\n this.clipPlane.coplanarPoint(coplanarPoint);\r\n for (i = 0; i < vert.length; ++i) {\r\n this.cullFlag[i] = false;\r\n if (i < 8) {\r\n // corners should be culled by clipping plane\r\n diff.subVectors(vert[i], coplanarPoint);\r\n this.cullFlag[i] = (norm.dot(diff) >= 0.0);\r\n } else if (i < 8 + face.indices.length) {\r\n // cross section vertices don't get culled\r\n this.cullFlag[i] = true;\r\n }\r\n }\r\n\r\n // write data to vertex buffer\r\n const positions = this.geometry.getAttribute('position');\r\n let idx = 0;\r\n for (i = 0; i < vert.length; ++i) {\r\n positions.array[idx++] = vert[i].x;\r\n positions.array[idx++] = vert[i].y;\r\n positions.array[idx++] = vert[i].z;\r\n }\r\n positions.needsUpdate = true;\r\n }\r\n\r\n _collectVertices(face, filter) {\r\n let i;\r\n const vert = this.vertices;\r\n face.indices = [];\r\n for (i = 0; i < vert.length; ++i) {\r\n if (this.cullFlag[i] && filter(vert[i])) {\r\n face.indices.push(i);\r\n }\r\n }\r\n }\r\n\r\n _sortIndices(face, right) {\r\n let i;\r\n let j;\r\n const vert = this.vertices;\r\n const angle = [];\r\n\r\n const dir = new THREE.Vector3();\r\n for (i = 1; i < face.indices.length; ++i) {\r\n dir.subVectors(vert[face.indices[i]], vert[face.indices[0]]);\r\n dir.normalize();\r\n dir.cross(right);\r\n dir.negate();\r\n angle[i] = face.norm.dot(dir);\r\n }\r\n\r\n // Exchange sort\r\n for (i = 1; i < face.indices.length - 1; ++i) {\r\n for (j = i + 1; j < face.indices.length; ++j) {\r\n if (angle[j] < angle[i]) {\r\n // swap\r\n let t = angle[i];\r\n angle[i] = angle[j];\r\n angle[j] = t;\r\n\r\n t = face.indices[i];\r\n face.indices[i] = face.indices[j];\r\n face.indices[j] = t;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _updateIndices() {\r\n // Algorithm:\r\n // 1. Get plane vertices (from 3 to 6 vertices)\r\n // 2. Get \"right\" vector in plane\r\n // 3. Sort vertices using Graham-like method\r\n // 4. Create indices\r\n\r\n let i;\r\n let faceIdx;\r\n let face;\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n this._collectVertices(this.faces[0], (vertex) => vertex.z === -size.z);\r\n this._collectVertices(this.faces[1], (vertex) => vertex.z === size.z);\r\n this._collectVertices(this.faces[2], (vertex) => vertex.y === -size.y);\r\n this._collectVertices(this.faces[3], (vertex) => vertex.y === size.y);\r\n this._collectVertices(this.faces[4], (vertex) => vertex.x === -size.x);\r\n this._collectVertices(this.faces[5], (vertex) => vertex.x === size.x);\r\n\r\n const vCenter = new THREE.Vector3();\r\n const vRight = new THREE.Vector3();\r\n const vDir = new THREE.Vector3();\r\n\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n\r\n if (face.indices.length === 0) continue;\r\n\r\n vCenter.set(0, 0, 0);\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vCenter.add(vert[face.indices[i]]);\r\n }\r\n vCenter.multiplyScalar(1.0 / face.indices.length);\r\n vRight.subVectors(vert[face.indices[0]], vCenter);\r\n vRight.normalize();\r\n\r\n const rightProj = [];\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vDir.subVectors(vert[face.indices[i]], vCenter);\r\n rightProj[i] = vDir.dot(vRight);\r\n }\r\n for (i = 1; i < face.indices.length; ++i) {\r\n if (rightProj[i] < rightProj[0]) {\r\n // swap\r\n let t = rightProj[0];\r\n rightProj[0] = rightProj[i];\r\n rightProj[i] = t;\r\n\r\n [t] = face.indices;\r\n face.indices[0] = face.indices[i];\r\n face.indices[i] = t;\r\n }\r\n }\r\n\r\n this._sortIndices(face, vRight);\r\n }\r\n\r\n let numIndices = 0;\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n if (face.indices.length >= 3) {\r\n numIndices += 3 * (face.indices.length - 2);\r\n }\r\n }\r\n let offset = 0;\r\n const indices = new Uint16Array(numIndices);\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n for (i = 0; i < face.indices.length - 2; ++i) {\r\n indices[offset] = face.indices[0]; // eslint-disable-line prefer-destructuring\r\n indices[offset + 1] = face.indices[i + 1];\r\n indices[offset + 2] = face.indices[i + 2];\r\n offset += 3;\r\n }\r\n }\r\n\r\n this.geometry.setIndex(new THREE.BufferAttribute(indices, 1));\r\n }\r\n\r\n setDataSource(dataSource) {\r\n const vm = new VolumeMaterial.VolumeMaterial();\r\n const dim = dataSource.getDimensions();\r\n const stride = dataSource.getTiledTextureStride();\r\n const texture = dataSource.buildTiledTexture();\r\n const bbox = dataSource.getBox();\r\n vm.uniforms.volumeDim.value.set(dim[0], dim[1], dim[2]);\r\n vm.uniforms.tileTex.value = texture;\r\n vm.uniforms.tileTexSize.value.set(texture.image.width, texture.image.height);\r\n vm.uniforms.tileStride.value.set(stride[0], stride[1]);\r\n Object.assign(this.volumeInfo, dataSource.getVolumeInfo());\r\n\r\n const volInfo = this.volumeInfo;\r\n vm.uniforms.delta.value.copy(volInfo.delta);\r\n vm.uniforms.boxAngles.value.set(volInfo.obtuseAngle[0], volInfo.obtuseAngle[1], volInfo.obtuseAngle[2]);\r\n\r\n this.material = vm;\r\n\r\n bbox.getSize(this.scale);\r\n bbox.getCenter(this.position);\r\n }\r\n\r\n _updateIsoLevel() {\r\n const { kSigma, kSigmaMed, kSigmaMax } = settings.now.modes.VD;\r\n const volInfo = this.volumeInfo;\r\n const mean = volInfo.dmean - volInfo.dmin;\r\n const span = volInfo.dmax - volInfo.dmin;\r\n const level = (k) => (mean + k * volInfo.sd) / span;\r\n this.material.uniforms._isoLevel0.value.set(level(kSigma), level(kSigmaMed), level(kSigmaMax));\r\n }\r\n\r\n static _nearClipPlaneOffset = 0.2;\r\n\r\n static _pos = new THREE.Vector3();\r\n\r\n static _norm = new THREE.Vector3();\r\n\r\n static _norm4D = new THREE.Vector4();\r\n\r\n static _matrixWorldToLocal = new THREE.Matrix4();\r\n\r\n static _clipPlane = new THREE.Plane();\r\n\r\n rebuild(camera) {\r\n const nearClipPlaneOffset = VolumeMesh._nearClipPlaneOffset;\r\n const pos = VolumeMesh._pos;\r\n const norm = VolumeMesh._norm;\r\n const norm4D = VolumeMesh._norm4D;\r\n const matrixWorldToLocal = VolumeMesh._matrixWorldToLocal;\r\n const clipPlane = VolumeMesh._clipPlane;\r\n\r\n\r\n this._updateIsoLevel();\r\n\r\n // get clip plane in local space\r\n camera.getWorldDirection(norm);\r\n camera.getWorldPosition(pos);\r\n pos.addScaledVector(norm, camera.near + nearClipPlaneOffset);\r\n\r\n // transform pos to local CS\r\n matrixWorldToLocal.getInverse(this.matrixWorld);\r\n pos.applyMatrix4(matrixWorldToLocal);\r\n\r\n // transform norm to local CS\r\n norm4D.set(norm.x, norm.y, norm.z, 0.0); // NOTE: use homogeneous norm for proper transformation\r\n norm4D.applyMatrix4(matrixWorldToLocal);\r\n norm.copy(norm4D);\r\n norm.normalize();\r\n\r\n clipPlane.setFromNormalAndCoplanarPoint(norm, pos);\r\n\r\n if (!this.clipPlane.equals(clipPlane)) {\r\n this.clipPlane = clipPlane.clone();\r\n this._updateVertices();\r\n this._updateIndices();\r\n }\r\n }\r\n}\r\n\r\n\r\nexport default VolumeMesh;\r\n","import * as THREE from 'three';\r\nimport gfxutils from './gfxutils';\r\n\r\nclass VolumeBounds {\r\n static _projectionTable = { // corresponds between (origin axes and angles between them) and between saving vector coordinates\r\n XY: ['x', 2],\r\n XZ: ['y', 1],\r\n YZ: ['z', 0],\r\n };\r\n\r\n constructor(bBox, volInfo) {\r\n const { delta } = volInfo; // {x: XY, y : XZ, z: YZ}\r\n const { obtuseAngle } = volInfo; // 1 - obtuse, 0 - acute\r\n\r\n const bSize = new THREE.Vector3();\r\n bBox.getSize(bSize);\r\n bSize.multiplyScalar(0.5);\r\n\r\n const offsetVert = this._getBaseVertices(delta, obtuseAngle);\r\n\r\n const geometry = new THREE.Geometry();\r\n\r\n for (let i = 0; i < 4; i++) {\r\n geometry.vertices.push(offsetVert[i].clone().multiply(bSize));\r\n geometry.vertices.push(offsetVert[(i + 1) % 4].clone().multiply(bSize));\r\n }\r\n const translation = new THREE.Vector3(2 * bSize.x * (1 - delta.x - delta.y), 0, 0);\r\n for (let i = 0; i < 8; i++) {\r\n geometry.vertices.push(geometry.vertices[i].clone().add(translation));\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n geometry.vertices.push(geometry.vertices[i * 2].clone());\r\n geometry.vertices.push(geometry.vertices[i * 2 + 8].clone());\r\n }\r\n const center = new THREE.Vector3();\r\n bBox.getCenter(center);\r\n geometry.vertices.forEach((vertex) => vertex.add(center)); // pivot shift\r\n\r\n this._lines = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ color: 0xFFFFFF }));\r\n this._lines.layers.set(gfxutils.LAYERS.VOLUME);\r\n }\r\n\r\n // Set one edge (4 points) of frame, from which with parallel transfer the rest of the frame points can be obtained\r\n _getBaseVertices(delta, obtuseAngle) {\r\n const projTable = VolumeBounds._projectionTable;\r\n\r\n const proj = ((index, inv) => { // tricky function to take account of projections: their position(related to box) and sign\r\n const currDelta = delta[projTable[index][0]];\r\n const angleValue = -0.5 * (inv - 1) + inv * obtuseAngle[projTable[index][1]];// inv = 1: alpha; inv = -1: 1 - alpha\r\n return angleValue * currDelta;\r\n });\r\n\r\n const offsetVert = [\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', 1)), -1 + 2 * proj('YZ', 1), -1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', 1)), -1 + 2 * proj('YZ', -1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', -1)), 1 - 2 * proj('YZ', 1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', -1)), 1 - 2 * proj('YZ', -1), -1),\r\n ];\r\n\r\n return offsetVert;\r\n }\r\n\r\n getMesh() {\r\n return this._lines;\r\n }\r\n}\r\n\r\nexport default VolumeBounds;\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport meshes from './meshes/meshes';\r\nimport gfxutils from './gfxutils';\r\n\r\n// Thes geometric far plane is required for correct filling in the BFTexture in case, when far plane cuts the volume\r\n// cube. In cut place of cube there is no correct data in BFTexture and volume rendering integral is calculated\r\n// with errors.\r\n// Far plane cuts the cube in case of large volume scale (zoom), because farplane doesn't change\r\nclass VolumeFarPlane {\r\n // create plane with unit corners coords (for future rescale in vshader according to camera properties)\r\n constructor(volume, width, height) {\r\n const planeGeo = this._initPlaneGeo(width, height);\r\n\r\n const mat = new VolumeMaterial.BackFacePosMaterialFarPlane();\r\n this._plane = new meshes.Mesh(planeGeo, mat);\r\n this._plane.frustumCulled = false;\r\n this._plane.doubleSided = true;\r\n const matWorldToVolume = new THREE.Matrix4();\r\n\r\n this._plane._onBeforeRender = function (_renderer, _scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!volume || !material) {\r\n return;\r\n }\r\n\r\n // count point in world at farplane place\r\n const planeCamPos = new THREE.Vector4(0, 0, -(camera.far - 0.1), 1);\r\n planeCamPos.applyMatrix4(camera.matrixWorld);\r\n\r\n // recalc matrices to make plane be placed as farplane in the World relative to camera\r\n this.matrix.identity();\r\n this.matrix.makeTranslation(planeCamPos.x, planeCamPos.y, planeCamPos.z);\r\n this.matrixWorld.copy(this.matrix);\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n this.normalMatrix.getNormalMatrix(this.modelViewMatrix);\r\n\r\n // build worldToVolume matrix to transform plane into volumeCS (volumeCS coords are written to BackFaceTexture)\r\n const volumeMatrix = volume.matrixWorld;\r\n matWorldToVolume.getInverse(volumeMatrix);\r\n\r\n // update material props\r\n material.uniforms.aspectRatio.value = camera.aspect;\r\n material.uniforms.farZ.value = camera.far;\r\n material.uniforms.tanHalfFOV.value = Math.tan(THREE.Math.DEG2RAD * 0.5 * camera.fov);\r\n material.uniforms.matWorld2Volume.value = matWorldToVolume;\r\n };\r\n\r\n // set it to special layer to draw only into BFTexture\r\n this._plane.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n }\r\n\r\n _initPlaneGeo(width, height) {\r\n const planeGeo = new THREE.Geometry();\r\n\r\n width = width || 1;\r\n height = height || 1;\r\n\r\n planeGeo.vertices.push(new THREE.Vector3(-0.5 * width, 0.5 * height, 0));\r\n planeGeo.vertices.push(new THREE.Vector3(0.5 * width, 0.5 * height, 0));\r\n planeGeo.vertices.push(new THREE.Vector3(-0.5 * width, -0.5 * height, 0));\r\n planeGeo.vertices.push(new THREE.Vector3(0.5 * width, -0.5 * height, 0));\r\n\r\n planeGeo.faces.push(new THREE.Face3(0, 2, 1));\r\n planeGeo.faces.push(new THREE.Face3(2, 3, 1));\r\n\r\n return planeGeo;\r\n }\r\n\r\n getMesh() {\r\n return this._plane;\r\n }\r\n}\r\n\r\nexport default VolumeFarPlane;\r\n","import * as THREE from 'three';\r\nimport utils from './utils';\r\nimport VolumeMesh from './gfx/VolumeMesh';\r\nimport VolumeBounds from './gfx/VolumeBounds';\r\nimport VolumeFarPlane from './gfx/VolumeFarPlane';\r\nimport Visual from './Visual';\r\nimport settings from './settings';\r\n\r\nfunction VolumeVisual(name, dataSource) {\r\n Visual.call(this, name, dataSource);\r\n\r\n this._mesh = new VolumeMesh();\r\n this._mesh.setDataSource(dataSource);\r\n this.add(this._mesh);\r\n\r\n this._frame = new VolumeBounds(this.getBoundaries().boundingBox, this._mesh.volumeInfo);\r\n this.add(this._frame.getMesh());\r\n this.showFrame(settings.now.modes.VD.frame);\r\n\r\n this._farPlane = new VolumeFarPlane(this._mesh, 2, 2);\r\n this.add(this._farPlane.getMesh());\r\n}\r\n\r\nutils.deriveClass(VolumeVisual, Visual);\r\n\r\nVolumeVisual.prototype.getBoundaries = function () {\r\n const box = this._dataSource.getBox();\r\n const sphere = new THREE.Sphere();\r\n box.getBoundingSphere(sphere);\r\n\r\n return {\r\n boundingBox: box,\r\n boundingSphere: sphere,\r\n };\r\n};\r\n\r\nVolumeVisual.prototype.getMesh = function () {\r\n return this._mesh;\r\n};\r\n\r\nVolumeVisual.prototype.showFrame = function (needShow) {\r\n this._frame.getMesh().material.visible = needShow;\r\n};\r\n\r\nexport default VolumeVisual;\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available loaders.\r\n * @extends EntityList\r\n */\r\nclass LoaderList extends EntityList {\r\n /**\r\n * Create a list of loaders.\r\n * The loaders are indexed by supported source types (`.types` property of a Loader\r\n * subclass).\r\n * The loaders can be retrieved later by matching against specs (see {@link LoaderList#find}).\r\n *\r\n * @param {!Array=} someLoaders A list of {@link Loader} subclasses to\r\n * automatically register at creation time.\r\n * @see LoaderList#register\r\n */\r\n constructor(someLoaders = []) {\r\n super(someLoaders, ['types']);\r\n }\r\n\r\n /**\r\n * Find a suitable loader for a source type.\r\n *\r\n * @param {Object} specs Loader specifications.\r\n * @param {string=} specs.type Supported source type.\r\n * @param {*=} specs.source Source to load from.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.type) {\r\n list = this._dict.types[specs.type.toLowerCase()] || [];\r\n } else if (specs.source) {\r\n return this._list.filter((SomeLoader) => SomeLoader.canProbablyLoad && SomeLoader.canProbablyLoad(specs.source));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default LoaderList;\r\n","import EventDispatcher from '../../utils/EventDispatcher';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Loader extends EventDispatcher {\r\n constructor(source, options) {\r\n super();\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n this._agent = null;\r\n }\r\n\r\n load() {\r\n return Promise.reject(new Error('Loading from this source is not implemented'));\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n if (this._agent) {\r\n this._agent.abort();\r\n }\r\n }\r\n\r\n static extractName(_source) {\r\n return undefined;\r\n }\r\n}\r\n\r\nmakeContextDependent(Loader.prototype);\r\n","import Loader from './Loader';\r\n\r\nexport default class FileLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = options.binary === true;\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const blob = this._source;\r\n const reader = this._agent = new FileReader();\r\n\r\n reader.addEventListener('load', () => {\r\n resolve(reader.result);\r\n });\r\n reader.addEventListener('error', () => {\r\n reject(reader.error);\r\n });\r\n reader.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n reader.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n if (this._binary) {\r\n reader.readAsArrayBuffer(blob);\r\n } else {\r\n reader.readAsText(blob);\r\n }\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return (File && source instanceof File) || (Blob && source instanceof Blob);\r\n }\r\n\r\n static extractName(source) {\r\n return source && source.name;\r\n }\r\n}\r\n\r\nFileLoader.types = ['file', 'blob'];\r\n","import _ from 'lodash';\r\nimport Loader from './Loader';\r\n\r\n// we don't need to detect all kinds of URLs, just the evident ones\r\nconst urlStartRegexp = /^(https?|ftp):\\/\\//i;\r\n\r\nexport default class XHRLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = (options.binary === true);\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const url = this._source;\r\n const request = this._agent = new XMLHttpRequest();\r\n\r\n request.addEventListener('load', () => {\r\n if (request.status === 200) {\r\n resolve(request.response);\r\n } else {\r\n reject(new Error(`HTTP ${request.status} while fetching ${url}`));\r\n }\r\n });\r\n request.addEventListener('error', () => {\r\n reject(new Error('HTTP request failed'));\r\n });\r\n request.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n request.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n request.open('GET', url);\r\n if (this._binary) {\r\n request.responseType = 'arraybuffer';\r\n } else {\r\n request.responseType = 'text';\r\n }\r\n request.send();\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return _.isString(source) && urlStartRegexp.test(source);\r\n }\r\n\r\n static extractName(source) {\r\n if (source) {\r\n const last = (source.indexOf('?') + 1 || source.lastIndexOf('#') + 1 || source.length + 1) - 1;\r\n return source.slice(source.lastIndexOf('/', last) + 1, last);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nXHRLoader.types = ['url'];\r\n","import Loader from './Loader';\r\n\r\nexport default class ImmediateLoader extends Loader {\r\n load() {\r\n return new Promise((resolve) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n resolve(this._source);\r\n });\r\n }\r\n\r\n static canProbablyLoad(_source) {\r\n return false;\r\n }\r\n}\r\n\r\nImmediateLoader.types = ['immediate'];\r\n","import LoaderList from './loaders/LoaderList';\r\n\r\nimport FileLoader from './loaders/FileLoader';\r\nimport XHRLoader from './loaders/XHRLoader';\r\nimport ImmediateLoader from './loaders/ImmediateLoader';\r\n\r\nexport default new LoaderList([\r\n // note: order might be important\r\n FileLoader,\r\n XHRLoader,\r\n ImmediateLoader,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available parsers.\r\n * @extends EntityList\r\n */\r\nclass ParserList extends EntityList {\r\n /**\r\n * Create a list of parsers.\r\n * The parsers are indexed by supported data formats and file extensions (`.formats` and\r\n * `.extensions` properties of a Parser subclass).\r\n * The parsers can be retrieved later by matching against specs (see {@link ParsrerList#find}).\r\n *\r\n * @param {!Array=} someParsers A list of {@link Parser} subclasses to\r\n * automatically register at creation time.\r\n * @see ParserList#register\r\n */\r\n constructor(someParsers = []) {\r\n super(someParsers, ['formats', 'extensions']);\r\n }\r\n\r\n /**\r\n * Find a suitable parser for data.\r\n *\r\n * @param {Object} specs Parser specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {string=} specs.ext Supported filename extension.\r\n * @param {*=} specs.data Data to parse.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n } else if (specs.ext) {\r\n list = this._dict.extensions[specs.ext.toLowerCase()] || [];\r\n }\r\n // autodetect only if no format is forced\r\n if (list.length === 0 && !specs.format && specs.data) {\r\n return this._list.filter((SomeParser) => SomeParser.canProbablyParse && SomeParser.canProbablyParse(specs.data));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ParserList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Parser {\r\n constructor(data, options) {\r\n this._data = data;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n parseSync() {\r\n throw new Error('Parsing this type of data is not implemented');\r\n }\r\n\r\n parse() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Parsing aborted'));\r\n }\r\n return resolve(this.parseSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n // only for volume Parsers\r\n getModel() {\r\n this.model._parseHeader(this._data);\r\n return this.model;\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Parser.prototype);\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 290\".\r\n *\r\n * @exports Remark290\r\n * @constructor\r\n */\r\nclass Remark290 {\r\n constructor() {\r\n /** @type {THREE.Matrix4[]} */\r\n this.matrices = [];\r\n\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (stream.readString(12, 18) === ' SMTRY') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === this.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n }\r\n }\r\n}\r\n\r\nRemark290.prototype.id = 290;\r\n\r\nexport default Remark290;\r\n","import * as THREE from 'three';\r\nimport chem from '../../../chem';\r\n\r\nconst { Assembly } = chem;\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 350\".\r\n *\r\n * @exports Remark350\r\n * @constructor\r\n */\r\nclass Remark350 {\r\n constructor(complex) {\r\n /** @type {Complex} */\r\n this._complex = complex;\r\n /** @type {Assembly[]} */\r\n this.assemblies = [];\r\n\r\n /** @type {?Assembly} */\r\n this._assembly = null;\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?Assembly} */\r\n let assembly = this._assembly;\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (assembly && stream.readString(12, 18) === ' BIOMT') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === assembly.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n } else if (assembly && stream.readString(35, 41) === 'CHAINS:') {\r\n const entries = stream.readString(42, 80).split(',');\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const chain = entries[i].trim();\r\n if (chain.length > 0) {\r\n assembly.addChain(chain);\r\n }\r\n }\r\n } else if (stream.readString(12, 23) === 'BIOMOLECULE:') {\r\n // assert molIndex === this.assemblies.length + 1\r\n this._matrix = null;\r\n this._matrixIndex = -1;\r\n this._assembly = assembly = new Assembly(this._complex);\r\n this.assemblies.push(assembly);\r\n }\r\n }\r\n}\r\n\r\nRemark350.prototype.id = 350;\r\n\r\nexport default Remark350;\r\n","/** Helper class for stream-like reading input files. */\r\nclass PDBStream {\r\n /**\r\n * Create a stream\r\n * @param {String} data Input data\r\n */\r\n constructor(data) {\r\n /** @type String */\r\n this._data = data; // Input file\r\n /** @type Number */\r\n this._start = 0; // Starting position of line\r\n /** @type Number */\r\n this._nextCR = -1; // Position of next CR (0x0D)\r\n /** @type Number */\r\n this._nextLF = -1; // Position of next LF (0x0A)\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n /** @type Number */\r\n this._end = data.length; // End of data\r\n\r\n this.next();\r\n }\r\n\r\n /**\r\n * Reading next line.\r\n * @returns {String} Next line in data (ending with LF or CR)\r\n */\r\n readLine() {\r\n return this._data.slice(this._start, this._next);\r\n }\r\n\r\n /**\r\n * Reading character from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {String} Character from position\r\n */\r\n readChar(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data[pos] : ' ';\r\n }\r\n\r\n /**\r\n * Reading character code from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {Number} Character code from position\r\n */\r\n readCharCode(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data.charCodeAt(pos) : 32;\r\n }\r\n\r\n /**\r\n * Reading string from begin to end points.\r\n * For a reason unknown, numbering assumed not to start from 0, but from 1.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {String} String from begin to end\r\n */\r\n readString(begin, end) {\r\n const from = this._start + begin - 1;\r\n const to = this._start + end;\r\n return this._data.slice(from, to < this._next ? to : this._next);\r\n }\r\n\r\n /**\r\n * Reading integer from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Integer from begin to end\r\n */\r\n readInt(begin, end) {\r\n return parseInt(this.readString(begin, end), 10);\r\n }\r\n\r\n /**\r\n * Reading float from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Float from begin to end\r\n */\r\n readFloat(begin, end) {\r\n return parseFloat(this.readString(begin, end));\r\n }\r\n\r\n /**\r\n * Checking for end of data.\r\n * @returns {boolean} True if data is ended, false otherwise\r\n */\r\n end() {\r\n return this._start >= this._end;\r\n }\r\n\r\n /**\r\n * Procedure to re-arrange current pointers in data.\r\n */\r\n next() {\r\n const start = this._next + 1;\r\n this._start = start < this._end ? start : this._end;\r\n\r\n // support CR, LF, CR+LF line endings\r\n // do not support LF+CR, CR+CR+LF, and other strange combinations\r\n\r\n if (this._start > this._nextCR) {\r\n this._nextCR = (this._data.indexOf('\\r', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n if (this._start > this._nextLF) {\r\n this._nextLF = (this._data.indexOf('\\n', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n this._next = this._nextCR + 1 < this._nextLF ? this._nextCR : this._nextLF;\r\n }\r\n}\r\n\r\nexport default PDBStream;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport Remark290 from './pdb/Remark290';\r\nimport Remark350 from './pdb/Remark350';\r\nimport PDBStream from './PDBStream';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst TAG_LENGTH = 6;\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\n// the most frequently used beginnings; although HEADER is mandatory, it is often missing in handmade files\r\nconst pdbStartRegexp = /^(HEADER\\s|COMPND\\s|REMARK\\s|ATOM {2}|HETATM|MODEL )/i;\r\n\r\nconst remarkParsers = {\r\n // NOTE: please forget the idea to build the method name in runtime, it can be obfuscated.\r\n 290: Remark290,\r\n 350: Remark350,\r\n};\r\n\r\nclass PDBParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._sheet = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._compaundFound = false;\r\n this._biomoleculeFound = false;\r\n this._allowedChainsIDs = null;\r\n this._lastMolId = -1;\r\n\r\n this._remarks = {};\r\n this._remark = null;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n this._compndCurrToken = '';\r\n\r\n this._options.fileType = 'pdb';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && pdbStartRegexp.test(data);\r\n }\r\n\r\n _finalize() {\r\n this._fixBondsArray();\r\n this._fixChains();\r\n\r\n // keep crystallographic symmetry transformations\r\n const remark290 = this._remarks[290];\r\n this._complex.symmetry = _.isUndefined(remark290) ? [] : remark290.matrices;\r\n\r\n // add loaded biological assemblies\r\n const remark350 = this._remarks[350];\r\n this._complex.units = this._complex.units.concat(_.isUndefined(remark350) ? [] : remark350.assemblies);\r\n\r\n // add loaded macromolecules\r\n this._finalizeMolecules();\r\n\r\n // create secondary structure etc.\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _finalizeMolecules() {\r\n // get chains from complex\r\n const chainDict = {};\r\n let i;\r\n const chains = this._complex._chains;\r\n for (i = 0; i < chains.length; ++i) {\r\n const chainObj = chains[i];\r\n const chainName = chainObj._name;\r\n chainDict[chainName] = chainObj;\r\n }\r\n\r\n // aggregate residues from chains\r\n for (i = 0; i < this._molecules.length; i++) {\r\n const m = this._molecules[i];\r\n let residues = [];\r\n for (let j = 0; j < m._chains.length; j++) {\r\n const name = m._chains[j];\r\n const chain = chainDict[name];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, m._name, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _fixChains() {\r\n const idChainMap = {};\r\n const complex = this._complex;\r\n\r\n // prepare\r\n for (let i = 0; i < complex._chains.length; i++) {\r\n const chain = complex._chains[i];\r\n idChainMap[chain._name.charCodeAt(0)] = chain;\r\n }\r\n }\r\n\r\n // FIXME: This function is redundant, CONECT records always follow ATOM and HETATM. Build the map online.\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseATOM(stream) {\r\n if (this._modelId !== 1) {\r\n return;\r\n }\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const het = stream.readCharCode(1) === 0x48;\r\n\r\n // field names according to wwPDB Format\r\n // NOTE: Chimera allows (nonstandard) use of columns 6-11 for the integer atom serial number in ATOM records.\r\n const serial = het ? stream.readInt(7, 11) : stream.readInt(6, 11);\r\n let name = stream.readString(13, 16);\r\n const altLoc = stream.readChar(17);\r\n const resName = stream.readString(18, 20).trim();\r\n const chainID = stream.readChar(22);\r\n const resSeq = stream.readInt(23, 26);\r\n const iCode = stream.readChar(27);\r\n const x = stream.readFloat(31, 38);\r\n const y = stream.readFloat(39, 46);\r\n const z = stream.readFloat(47, 54);\r\n const occupancy = stream.readFloat(55, 60);\r\n const tempFactor = stream.readFloat(61, 66);\r\n const element = stream.readString(77, 78).trim() || nameToElement(name);\r\n const charge = stream.readInt(79, 80) || 0;\r\n /* eslint-enable no-magic-numbers */\r\n // skip waters (there may be lots of them)\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n // PDB uses positional system for atom names. It helps derive element type from the name\r\n // but names may include extra spaces. From this point on we don't need those spaces anymore.\r\n name = name.trim();\r\n\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name]; // FIXME: Maybe should use type as additional index (\" CA \" vs. \"CA \")\r\n\r\n // NOTE: Residues of a particular chain are not required to be listed next to each other.\r\n // https://github.com/biasmv/pv/commit/7319b898b7473ba380c26699e3b028b2b1a7e1a1\r\n let chain = this._chain;\r\n if (!chain || chain.getName() !== chainID) {\r\n this._chain = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n _parseENDMDL() {\r\n this._modelId += 1;\r\n }\r\n\r\n _parseCONECT(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const serial0 = stream.readInt(7, 11);\r\n const serial1 = stream.readInt(12, 16);\r\n const serial2 = stream.readInt(17, 21);\r\n const serial3 = stream.readInt(22, 26);\r\n const serial4 = stream.readInt(27, 31);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const complex = this._complex;\r\n\r\n // Keep bonds ordered by atom serial\r\n if (serial1 && serial1 > serial0) {\r\n complex.addBond(serial0, serial1, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial2 && serial2 > serial0) {\r\n complex.addBond(serial0, serial2, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial3 && serial3 > serial0) {\r\n complex.addBond(serial0, serial3, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial4 && serial4 > serial0) {\r\n complex.addBond(serial0, serial4, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n }\r\n\r\n _parseCOMPND(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const str = stream.readString(11, 80);\r\n const tokenIdx = str.indexOf(':');\r\n this._compndCurrToken = tokenIdx > 0 ? str.substring(0, tokenIdx).trim() : this._compndCurrToken;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // start reading new molecule\r\n if (this._compndCurrToken === 'MOL_ID') {\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = parseInt(str.substring(tokenIdx + 1, str.indexOf(';')), 10);\r\n this._molecules.push(this._molecule);\r\n // parse molecule name\r\n } else if (this._compndCurrToken === 'MOLECULE' && this._molecule != null) {\r\n this._molecule._name = str.substring(tokenIdx + 1, str.indexOf(';')).trim();\r\n // parse molecule chains\r\n } else if (this._compndCurrToken === 'CHAIN' && this._molecule != null) {\r\n let chainStr = str.substring(tokenIdx + 1, 80).trim();\r\n const lastChar = chainStr[chainStr.length - 1];\r\n if (lastChar === ';' || lastChar === ',') {\r\n chainStr = chainStr.slice(0, -1);\r\n }\r\n chainStr = chainStr.replace(/\\s+/g, '');\r\n const chains = chainStr.split(',');\r\n this._molecule._chains = this._molecule._chains.concat(chains);\r\n }\r\n }\r\n\r\n _parseREMARK(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const remarkNum = stream.readInt(8, 10);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // create remark parser if needed\r\n let remark = this._remarks[remarkNum];\r\n if (_.isUndefined(remark)) {\r\n const RemarkParser = remarkParsers[remarkNum];\r\n if (_.isFunction(RemarkParser)) {\r\n this._remarks[remarkNum] = remark = new RemarkParser(this._complex);\r\n }\r\n }\r\n\r\n // delegate parsing\r\n if (!_.isUndefined(remark)) {\r\n remark.parse(stream);\r\n }\r\n }\r\n\r\n _parseHELIX(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [20, 22, 32, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addHelix(obj);\r\n this._complex.structures.push(obj);\r\n });\r\n }\r\n\r\n _parseSHEET(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [22, 23, 33, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addSheet(obj);\r\n });\r\n }\r\n\r\n _parseSTRUCTURE(stream, pars, adder) {\r\n const startId = 0;\r\n const startIndex = 1;\r\n const endId = 2;\r\n const endIndex = 3;\r\n\r\n // identify fields: debugging and stuff\r\n /* eslint-disable no-magic-numbers */\r\n const codeOfS = 0x53;\r\n const serialNumber = stream.readInt(8, 10);\r\n const structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim()\r\n const comment = stream.readString(41, 70).trim();\r\n const helLength = stream.readInt(72, 76);\r\n const helixClass = stream.readInt(39, 40);\r\n const shWidth = stream.readInt(15, 16);\r\n const shCur = stream.readInt(42, 45);\r\n const shPrev = stream.readInt(57, 60);\r\n /* eslint-enable no-magic-numbers */\r\n // file fields\r\n const startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0);\r\n const endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0);\r\n const startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3);\r\n let iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4);\r\n let startICode = 0;\r\n\r\n if (iCodeStr.length > 0) {\r\n startICode = iCodeStr.charCodeAt(0);\r\n }\r\n const endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3);\r\n iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4);\r\n let endICode = 0;\r\n if (iCodeStr.length > 0) {\r\n endICode = iCodeStr.charCodeAt(0);\r\n }\r\n\r\n let obj;\r\n let cs = this._sheet;\r\n if (stream.readCharCode(1) === codeOfS) {\r\n if (cs !== null && cs.getName() !== structureName) {\r\n cs = null;\r\n this._sheet = null;\r\n }\r\n if (cs === null) {\r\n this._sheet = obj = new Sheet(structureName, shWidth);\r\n adder(obj);\r\n } else {\r\n obj = cs;\r\n }\r\n const strand = new Strand(\r\n obj,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n helixClass, shCur, shPrev,\r\n );\r\n obj.addStrand(strand);\r\n this._complex.structures.push(strand);\r\n } else {\r\n obj = new Helix(\r\n helixClass,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n serialNumber, structureName, comment, helLength,\r\n );\r\n adder(obj);\r\n }\r\n }\r\n\r\n _parseHEADER(stream) {\r\n const { metadata } = this._complex;\r\n metadata.classification = stream.readString(11, 50).trim();\r\n metadata.date = stream.readString(51, 59).trim();\r\n\r\n const id = stream.readString(63, 66).trim();\r\n metadata.id = id;\r\n if (id) {\r\n this._complex.name = id;\r\n }\r\n metadata.format = 'pdb';\r\n }\r\n\r\n _parseTITLE(stream) {\r\n const { metadata } = this._complex;\r\n metadata.title = metadata.title || [];\r\n\r\n const line = stream.readInt(9, 10) || 1;\r\n metadata.title[line - 1] = stream.readString(11, 80).trim();\r\n }\r\n\r\n static tagParsers = {\r\n HEADER: PDBParser.prototype._parseHEADER,\r\n 'TITLE ': PDBParser.prototype._parseTITLE,\r\n 'ATOM ': PDBParser.prototype._parseATOM,\r\n HETATM: PDBParser.prototype._parseATOM,\r\n ENDMDL: PDBParser.prototype._parseENDMDL,\r\n CONECT: PDBParser.prototype._parseCONECT,\r\n COMPND: PDBParser.prototype._parseCOMPND,\r\n REMARK: PDBParser.prototype._parseREMARK,\r\n // 'SOURCE': PDBParser.prototype._parseSOURCE,\r\n 'HELIX ': PDBParser.prototype._parseHELIX,\r\n 'SHEET ': PDBParser.prototype._parseSHEET,\r\n\r\n // nonstandard extension to allow range 100,000 - 999,999\r\n 'ATOM 1': PDBParser.prototype._parseATOM,\r\n 'ATOM 2': PDBParser.prototype._parseATOM,\r\n 'ATOM 3': PDBParser.prototype._parseATOM,\r\n 'ATOM 4': PDBParser.prototype._parseATOM,\r\n 'ATOM 5': PDBParser.prototype._parseATOM,\r\n 'ATOM 6': PDBParser.prototype._parseATOM,\r\n 'ATOM 7': PDBParser.prototype._parseATOM,\r\n 'ATOM 8': PDBParser.prototype._parseATOM,\r\n 'ATOM 9': PDBParser.prototype._parseATOM,\r\n };\r\n\r\n parseSync() {\r\n const stream = new PDBStream(this._data);\r\n const result = this._complex = new Complex();\r\n\r\n // parse PDB line by line\r\n while (!stream.end()) {\r\n const tag = stream.readString(1, TAG_LENGTH);\r\n const func = PDBParser.tagParsers[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, stream);\r\n }\r\n stream.next();\r\n }\r\n\r\n // Resolve indices and serials to objects\r\n this._finalize();\r\n\r\n // cleanup\r\n this._serialAtomMap = null;\r\n this._sheet = null;\r\n this._residue = null;\r\n this._chain = null;\r\n this._complex = null;\r\n\r\n if (result.getAtomCount() === 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\nPDBParser.formats = ['pdb'];\r\nPDBParser.extensions = ['.pdb', '.ent'];\r\n\r\nexport default PDBParser;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n SGroup,\r\n Bond,\r\n} = chem;\r\n\r\nconst cOrderCharCodes = {\r\n A: 0,\r\n S: 1,\r\n D: 2,\r\n T: 3,\r\n};\r\n\r\nconst cmlStartRegexp = /\\s*<\\?xml\\b[^?>]*\\?>\\s*<(?:cml|molecule)\\b/i;\r\n\r\nclass CMLParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._complex = null;\r\n this._residue = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._lastMolId = -1;\r\n this._readOnlyOneMolecule = false;\r\n this._options.fileType = 'cml';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && cmlStartRegexp.test(data);\r\n }\r\n\r\n _rebuidBondIndexes(atoms, bonds) {\r\n const count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n\r\n const countBonds = bonds.length;\r\n for (let j = 0; j < countBonds; j++) {\r\n const idxs = bonds[j].atomRefs2.split(' ');\r\n if (idxs[0] === atomId) {\r\n bonds[j].start = i;\r\n }\r\n\r\n if (idxs[1] === atomId) {\r\n bonds[j].end = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _createSGroup(molecule, moleculeArr) {\r\n const newGroup = new SGroup(\r\n molecule.id, molecule.fieldData,\r\n new THREE.Vector3(parseFloat(molecule.x), parseFloat(molecule.y), 0), molecule.atomRefs, molecule,\r\n );\r\n if (molecule.placement === 'Relative') {\r\n newGroup._center = new THREE.Vector3(0, 0, 0);\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_CHARGE') {\r\n newGroup._charge = parseInt(molecule.fieldData, 10) || 0;\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_COEFFICIENT') {\r\n newGroup._repeat = parseInt(molecule.fieldData, 10) || 1;\r\n }\r\n moleculeArr.push(newGroup);\r\n }\r\n\r\n _extractSGroup(molecule, moleculeArr) {\r\n if (!Array.isArray(moleculeArr)) {\r\n moleculeArr = [];\r\n }\r\n\r\n if (molecule) {\r\n if (Array.isArray(molecule)) {\r\n const count = molecule.length;\r\n for (let i = 0; i < count; i++) {\r\n if (molecule[i].molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule[i].molecule));\r\n }\r\n this._createSGroup(molecule[i], moleculeArr);\r\n }\r\n } else {\r\n if (molecule.molecule) {\r\n if (molecule.molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule.molecule));\r\n }\r\n }\r\n this._createSGroup(molecule, moleculeArr);\r\n }\r\n }\r\n\r\n return moleculeArr;\r\n }\r\n\r\n\r\n _extractSGroups(molecule, atoms) {\r\n const moleculeArr = this._extractSGroup(molecule);\r\n\r\n\r\n const count = atoms.length;\r\n let i;\r\n let j;\r\n\r\n for (i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n const firstAtomRef = moleculeArr[j]._atoms.split(' ')[0];\r\n if (firstAtomRef === atomId) {\r\n if (!atoms[i].sgroupRef) {\r\n atoms[i].sgroupRef = [];\r\n }\r\n atoms[i].sgroupRef.push(moleculeArr[j]);\r\n }\r\n }\r\n }\r\n // build sGroups centers\r\n let atomMap = {}; // sgrpmap cache\r\n let mapEntry = null;\r\n const nLimon = 100000000;\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n\r\n function cycleFuncInner(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n moleculeArr[j]._atoms.push(mapEntry.a);\r\n }\r\n }\r\n\r\n function cycleFunc(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n bLow.set(Math.min(bLow.x, mapEntry.x), Math.min(bLow.y, mapEntry.y), Math.min(bLow.z, mapEntry.z));\r\n bHight.set(Math.max(bHight.x, mapEntry.x), Math.max(bHight.y, mapEntry.y), Math.max(bHight.z, mapEntry.z));\r\n cycleFuncInner(e);\r\n }\r\n }\r\n\r\n for (i = 0; i < atoms.length; i++) {\r\n atomMap[atoms[i].id] = {};\r\n atomMap[atoms[i].id].x = atoms[i].x2;\r\n if (atoms[i].x3) {\r\n atomMap[atoms[i].id].x = atoms[i].x3;\r\n }\r\n atomMap[atoms[i].id].x = parseFloat(atomMap[atoms[i].id].x);\r\n atomMap[atoms[i].id].y = atoms[i].y2;\r\n if (atoms[i].y3) {\r\n atomMap[atoms[i].id].y = atoms[i].y3;\r\n }\r\n atomMap[atoms[i].id].y = parseFloat(atomMap[atoms[i].id].y);\r\n atomMap[atoms[i].id].z = '0.0';\r\n if (atoms[i].z3) {\r\n atomMap[atoms[i].id].z = atoms[i].z3;\r\n }\r\n atomMap[atoms[i].id].z = parseFloat(atomMap[atoms[i].id].z);\r\n atomMap[atoms[i].id].a = atoms[i];\r\n }\r\n\r\n let atomsRef;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n if (moleculeArr[j]._center !== null) {\r\n bLow.set(nLimon, nLimon, nLimon);\r\n bHight.set(-nLimon, -nLimon, -nLimon);\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFunc);\r\n\r\n moleculeArr[j]._center.addVectors(bLow, bHight);\r\n moleculeArr[j]._center.multiplyScalar(0.5);\r\n } else {\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFuncInner);\r\n }\r\n }\r\n atomMap = null;\r\n }\r\n\r\n\r\n _traverseData(dom) {\r\n function isArray(o) {\r\n return Object.prototype.toString.apply(o) === '[object Array]';\r\n }\r\n\r\n function parseNode(xmlNode, result) {\r\n if (xmlNode.nodeName === '#text' && xmlNode.nodeValue.trim() === '') {\r\n return;\r\n }\r\n\r\n const jsonNode = {};\r\n jsonNode.xmlNode = xmlNode;\r\n const existing = result[xmlNode.nodeName];\r\n if (existing) {\r\n if (!isArray(existing)) {\r\n result[xmlNode.nodeName] = [existing, jsonNode];\r\n } else {\r\n result[xmlNode.nodeName].push(jsonNode);\r\n }\r\n } else {\r\n result[xmlNode.nodeName] = jsonNode;\r\n }\r\n\r\n let length;\r\n let i;\r\n if (xmlNode.attributes) {\r\n ({ length } = xmlNode.attributes);\r\n for (i = 0; i < length; i++) {\r\n const attribute = xmlNode.attributes[i];\r\n jsonNode[attribute.nodeName] = attribute.nodeValue;\r\n }\r\n }\r\n\r\n ({ length } = xmlNode.childNodes);\r\n for (i = 0; i < length; i++) {\r\n parseNode(xmlNode.childNodes[i], jsonNode);\r\n }\r\n }\r\n\r\n const result = {};\r\n if (dom.childNodes.length) {\r\n parseNode(dom.childNodes[0], result);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _findSuitableMolecule(data, molSet) {\r\n for (const key in data) {\r\n if (key === 'xmlNode') {\r\n continue;\r\n } else if (key === 'molecule') {\r\n if (data.molecule) {\r\n if (data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n molSet.push(data);\r\n }\r\n if (Array.isArray(data.molecule)) {\r\n for (let i = 0; i < data.molecule.length; i++) {\r\n if (data.molecule[i].atomArray && data.molecule[i].atomArray.atom) {\r\n molSet.push({ molecule: data.molecule[i] });\r\n }\r\n }\r\n }\r\n }\r\n } else if (data[key] && data[key] !== null && typeof (data[key]) === 'object') {\r\n this._findSuitableMolecule(data[key], molSet);\r\n }\r\n }\r\n }\r\n\r\n _selectComponents(text) {\r\n const parser = new DOMParser();\r\n const doc = parser.parseFromString(text, 'application/xml');\r\n const traversedData = this._traverseData(doc);\r\n let rawData;\r\n const self = this;\r\n\r\n function prepareComponentCompound(data) {\r\n let atoms = [];\r\n if (data.molecule && data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n if (!Array.isArray(data.molecule.atomArray.atom)) {\r\n atoms.push(data.molecule.atomArray.atom);\r\n } else {\r\n atoms = data.molecule.atomArray.atom;\r\n }\r\n } else if (!data.molecule) {\r\n const ret = {};\r\n ret.atomLabels = null;\r\n ret.labelsCount = 1;\r\n return ret;\r\n }\r\n\r\n if (data.molecule.molecule) {\r\n self._extractSGroups(data.molecule.molecule, atoms);\r\n }\r\n\r\n let atom;\r\n let count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges = [];\r\n }\r\n\r\n let localBond = [];\r\n if (data.molecule.bondArray && data.molecule.bondArray.bond) {\r\n if (!Array.isArray(data.molecule.bondArray.bond)) {\r\n localBond.push(data.molecule.bondArray.bond);\r\n } else {\r\n localBond = data.molecule.bondArray.bond;\r\n }\r\n }\r\n let bond;\r\n count = localBond.length;\r\n self._rebuidBondIndexes(atoms, localBond);\r\n\r\n function addCurrBond(index) {\r\n bond = localBond[index];\r\n atom = atoms[bond.start];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.end);\r\n atom = atoms[bond.end];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.start);\r\n return true;\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n if (!addCurrBond(i)) {\r\n // ignore invalid bond\r\n continue;\r\n }\r\n const orderAttr = bond.xmlNode.getAttribute('order');\r\n const tc = parseInt(orderAttr, 10);\r\n // the default bond order is unknown\r\n localBond[i].order = 0;\r\n localBond[i].type = Bond.BondType.UNKNOWN;\r\n if (tc > 1) {\r\n localBond[i].order = tc;\r\n } else {\r\n // another option - bond order is a string\r\n const order = cOrderCharCodes[orderAttr];\r\n if (order !== undefined) {\r\n localBond[i].order = order;\r\n if (orderAttr === 'A') {\r\n localBond[i].type = Bond.BondType.AROMATIC;\r\n }\r\n }\r\n }\r\n }\r\n\r\n count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges.sort();\r\n }\r\n\r\n const labels = self._breadWidthSearch(atoms, 0); // for now\r\n\r\n const retStruct = {};\r\n retStruct.atoms = atoms;\r\n retStruct.bonds = localBond;\r\n retStruct.labels = labels.atomLabels;\r\n retStruct.count = Math.min(1, labels.labelsCount); // for now\r\n retStruct.curr = -1;\r\n retStruct.originalCML = doc;\r\n\r\n return retStruct;\r\n }\r\n\r\n if (traversedData.cml) {\r\n rawData = traversedData.cml;\r\n } else {\r\n rawData = traversedData;\r\n }\r\n const retData = [];\r\n const filteredData = [];\r\n this._findSuitableMolecule(rawData, filteredData);\r\n if (this._readOnlyOneMolecule && filteredData.length > 1) {\r\n filteredData.splice(1, filteredData.length - 1);\r\n }\r\n filteredData.forEach((d) => {\r\n const rd = prepareComponentCompound(d);\r\n if (rd.atoms.length > 0) {\r\n retData.push(rd);\r\n }\r\n });\r\n return retData;\r\n }\r\n\r\n _packLabel(compId, molId) {\r\n const shift = 16;\r\n return (molId << shift) + compId;\r\n }\r\n\r\n _unpackLabel(l) {\r\n const shift = 16;\r\n const mask = (1 << shift) - 1;\r\n return { molId: l >>> shift, compId: l & mask };\r\n }\r\n\r\n _breadWidthSearch(atoms, molID) {\r\n const atomLabels = new Array(atoms.length);\r\n\r\n let id;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n atomLabels[id] = this._packLabel(0, molID);\r\n }\r\n\r\n const breadthQueue = [];\r\n let componentID = 0;\r\n let labeledAtoms = atoms.length;\r\n\r\n while (labeledAtoms > 0) {\r\n componentID++;\r\n\r\n let startID = -1;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n if (this._unpackLabel(atomLabels[id]).compId === 0) {\r\n startID = id;\r\n break;\r\n }\r\n }\r\n\r\n if (startID < 0) {\r\n break;\r\n }\r\n\r\n // Bread first search\r\n breadthQueue.push(atoms[startID]);\r\n atomLabels[startID] = this._packLabel(componentID, molID);\r\n labeledAtoms--;\r\n\r\n while (breadthQueue.length > 0) {\r\n const curr = breadthQueue.shift();\r\n if (!curr) {\r\n continue;\r\n }\r\n\r\n for (let i = 0; i < curr.edges.length; i++) {\r\n if (atomLabels[curr.edges[i]] !== componentID) {\r\n breadthQueue.push(atoms[curr.edges[i]]);\r\n atomLabels[curr.edges[i]] = componentID;\r\n labeledAtoms--;\r\n }\r\n }\r\n }\r\n }\r\n const ret = {};\r\n ret.atomLabels = atomLabels;\r\n ret.labelsCount = componentID;\r\n return ret;\r\n }\r\n\r\n _parseBond(eAtom, mainAtom, order, type) {\r\n if (eAtom >= 0) {\r\n const h = [Math.min(eAtom, mainAtom), Math.max(eAtom, mainAtom)];\r\n this._complex.addBond(h[0], h[1], order, type, true);\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseSet(varData) {\r\n const complex = this._complex = new Complex();\r\n const data = varData;\r\n const currentLabel = data.curr;\r\n const { atoms, labels } = data;\r\n let atom = null;\r\n let i;\r\n let j;\r\n const count = atoms.length;\r\n\r\n function addFunc(a) {\r\n a.xmlNodeRef = atom;\r\n if (atom.x2) {\r\n atom.x3 = atom.x2;\r\n delete atom.x2;\r\n }\r\n if (atom.y2) {\r\n atom.y3 = atom.y2;\r\n delete atom.y2;\r\n }\r\n if (!(atom.z3)) {\r\n atom.z3 = '0.0';\r\n }\r\n atom.complexAtom = a;\r\n }\r\n\r\n let chains = {};\r\n // parse atoms in label order\r\n const reorder = [];\r\n for (i = 0; i < count; i++) {\r\n reorder.push(i);\r\n }\r\n reorder.sort((a, b) => labels[a] - labels[b]);\r\n for (i = 0; i < count; i++) {\r\n const atomCharge = 0;\r\n const lLabel = labels[reorder[i]];\r\n if (this._unpackLabel(lLabel).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[reorder[i]];\r\n const atomFullNameStruct = atom.elementType;\r\n\r\n if (atom.sgroupRef) {\r\n const countRef = atom.sgroupRef.length;\r\n for (let k = 0; k < countRef; ++k) {\r\n complex._sgroups.push(atom.sgroupRef[k]);\r\n }\r\n }\r\n\r\n if (atom.x3 || atom.x2) {\r\n const currAtomComp = this._unpackLabel(lLabel).compId;\r\n // use ' ' by default instead of synthetic creation of chain names\r\n const chainID = ' '; //= String.fromCharCode('A'.charCodeAt(0) + currAtomComp);\r\n const resSeq = currAtomComp;\r\n const iCode = ' ';\r\n let strLabel = currAtomComp.toString();\r\n if (strLabel.length === 1) {\r\n strLabel = `0${strLabel}`;\r\n }\r\n const resName = `N${strLabel}`;\r\n let chain = chains[chainID];\r\n if (!chain || chain.getName() !== chainID) {\r\n chains[chainID] = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n // _x, _y, _z, mname, mindex, atomNameFull, atomName, chainID, serial, isHet, atlLocInd, atomNameToTypeF\r\n let xyz = null;\r\n if (atom.x3) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x3), parseFloat(atom.y3), parseFloat(atom.z3));\r\n } else if (atom.x2) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x2), parseFloat(atom.y2), 0);\r\n }\r\n let element = Element.ByName[atom.elementType.toUpperCase()];\r\n if (!element) {\r\n element = (JSON.parse(JSON.stringify(Element.ByName[\r\n Object.keys(Element.ByName)[Object.keys(Element.ByName).length - 1]])));\r\n element.number += 1;\r\n element.name = atom.elementType.toUpperCase();\r\n element.fullName = 'Unknown';\r\n Element.ByName[atom.elementType.toUpperCase()] = element;\r\n }\r\n const atomSerial = parseInt(atom.id.replace(/[^0-9]/, ''), 10);\r\n const added = residue.addAtom(\r\n atomFullNameStruct, element, xyz, Element.Role.SG,\r\n true, atomSerial, ' ', 1.0, 0.0, atomCharge,\r\n );\r\n if (atom.hydrogenCount) {\r\n added.hydrogenCount = parseInt(atom.hydrogenCount, 10);\r\n }\r\n if (atom.mrvValence) {\r\n added.valence = parseInt(atom.mrvValence, 10);\r\n }\r\n addFunc(added);\r\n }\r\n }\r\n }\r\n chains = null;// NOSONAR\r\n for (i = 0; i < data.bonds.length; i++) {\r\n const cb = data.bonds[i];\r\n if (this._unpackLabel(labels[cb.start]).molId === this._unpackLabel(currentLabel).molId\r\n && this._unpackLabel(labels[cb.end]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[cb.start];\r\n if (!atom || !(atoms[cb.end])) {\r\n continue; // skip invalid\r\n }\r\n this._parseBond(\r\n parseInt(atom.id.replace(/[^0-9]/, ''), 10),\r\n parseInt(atoms[cb.end].id.replace(/[^0-9]/, ''), 10), cb.order, cb.type,\r\n );\r\n }\r\n }\r\n\r\n for (i = 0; i < this._complex.getSGroupCount(); i++) {\r\n const sGrp = this._complex.getSGroups()[i];\r\n for (j = 0; j < sGrp._atoms.length; j++) {\r\n sGrp._atoms[j] = sGrp._atoms[j].complexAtom;\r\n }\r\n }\r\n for (i = 0; i < count; i++) {\r\n if (this._unpackLabel(labels[i]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[i];\r\n atom.complexAtom = null;\r\n delete atom.complexAtom;\r\n }\r\n }\r\n this._complex.originalCML = data.originalCML;\r\n this._fixBondsArray();\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n this._serialAtomMap = null;\r\n this._complex = null;\r\n return complex;\r\n }\r\n\r\n parseSync() {\r\n const complexes = [];\r\n const self = this;\r\n const moleculaSet = this._selectComponents(this._data);\r\n moleculaSet.forEach((molSet) => {\r\n molSet.curr = 2;\r\n if (molSet.count === 0) {\r\n molSet.count = 1;\r\n }\r\n for (let i = 0; i < molSet.count; i++) {\r\n molSet.curr = (i + 1);\r\n complexes.push(self._parseSet(molSet, false));\r\n }\r\n });\r\n\r\n let totalAtomsParsed = 0;\r\n complexes.forEach((c) => {\r\n totalAtomsParsed += c.getAtomCount();\r\n });\r\n if (totalAtomsParsed <= 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n if (complexes.length > 1) {\r\n const joinedComplex = new Complex();\r\n joinedComplex.joinComplexes(complexes);\r\n joinedComplex.originalCML = complexes[0].originalCML;\r\n return joinedComplex;\r\n }\r\n if (complexes.length === 1) {\r\n return complexes[0];\r\n }\r\n return new Complex();\r\n }\r\n}\r\n\r\n\r\nCMLParser.formats = ['cml'];\r\nCMLParser.extensions = ['.cml'];\r\n\r\nexport default CMLParser;\r\n","!function(r,t){if(\"function\"==typeof define&&define.amd)define([\"exports\"],t);else if(\"object\"==typeof exports&&\"undefined\"!=typeof module)t(exports);else t(r.MMTF=r.MMTF||{})}(this,function(r){\"use strict\";function t(r,t,n){for(var e=(r.byteLength,0),i=n.length;i>e;e++){var o=n.charCodeAt(e);if(128>o)r.setUint8(t++,o>>>0&127|0);else if(2048>o)r.setUint8(t++,o>>>6&31|192),r.setUint8(t++,o>>>0&63|128);else if(65536>o)r.setUint8(t++,o>>>12&15|224),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128);else{if(!(1114112>o))throw new Error(\"bad codepoint \"+o);r.setUint8(t++,o>>>18&7|240),r.setUint8(t++,o>>>12&63|128),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128)}}}function n(r){for(var t=0,n=0,e=r.length;e>n;n++){var i=r.charCodeAt(n);if(128>i)t+=1;else if(2048>i)t+=2;else if(65536>i)t+=3;else{if(!(1114112>i))throw new Error(\"bad codepoint \"+i);t+=4}}return t}function e(r,i,o){var a=typeof r;if(\"string\"===a){var u=n(r);if(32>u)return i.setUint8(o,160|u),t(i,o+1,r),1+u;if(256>u)return i.setUint8(o,217),i.setUint8(o+1,u),t(i,o+2,r),2+u;if(65536>u)return i.setUint8(o,218),i.setUint16(o+1,u),t(i,o+3,r),3+u;if(4294967296>u)return i.setUint8(o,219),i.setUint32(o+1,u),t(i,o+5,r),5+u}if(r instanceof Uint8Array){var u=r.byteLength,s=new Uint8Array(i.buffer);if(256>u)return i.setUint8(o,196),i.setUint8(o+1,u),s.set(r,o+2),2+u;if(65536>u)return i.setUint8(o,197),i.setUint16(o+1,u),s.set(r,o+3),3+u;if(4294967296>u)return i.setUint8(o,198),i.setUint32(o+1,u),s.set(r,o+5),5+u}if(\"number\"===a){if(!isFinite(r))throw new Error(\"Number not finite: \"+r);if(Math.floor(r)!==r)return i.setUint8(o,203),i.setFloat64(o+1,r),9;if(r>=0){if(128>r)return i.setUint8(o,r),1;if(256>r)return i.setUint8(o,204),i.setUint8(o+1,r),2;if(65536>r)return i.setUint8(o,205),i.setUint16(o+1,r),3;if(4294967296>r)return i.setUint8(o,206),i.setUint32(o+1,r),5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return i.setInt8(o,r),1;if(r>=-128)return i.setUint8(o,208),i.setInt8(o+1,r),2;if(r>=-32768)return i.setUint8(o,209),i.setInt16(o+1,r),3;if(r>=-2147483648)return i.setUint8(o,210),i.setInt32(o+1,r),5;throw new Error(\"Number too small -0x\"+(-r).toString(16).substr(1))}if(null===r)return i.setUint8(o,192),1;if(\"boolean\"===a)return i.setUint8(o,r?195:194),1;if(\"object\"===a){var u,f=0,c=Array.isArray(r);if(c)u=r.length;else{var d=Object.keys(r);u=d.length}var f;if(16>u?(i.setUint8(o,u|(c?144:128)),f=1):65536>u?(i.setUint8(o,c?220:222),i.setUint16(o+1,u),f=3):4294967296>u&&(i.setUint8(o,c?221:223),i.setUint32(o+1,u),f=5),c)for(var l=0;u>l;l++)f+=e(r[l],i,o+f);else for(var l=0;u>l;l++){var v=d[l];f+=e(v,i,o+f),f+=e(r[v],i,o+f)}return f}throw new Error(\"Unknown type \"+a)}function i(r){var t=typeof r;if(\"string\"===t){var e=n(r);if(32>e)return 1+e;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(r instanceof Uint8Array){var e=r.byteLength;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(\"number\"===t){if(Math.floor(r)!==r)return 9;if(r>=0){if(128>r)return 1;if(256>r)return 2;if(65536>r)return 3;if(4294967296>r)return 5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return 1;if(r>=-128)return 2;if(r>=-32768)return 3;if(r>=-2147483648)return 5;throw new Error(\"Number too small -0x\"+r.toString(16).substr(1))}if(\"boolean\"===t||null===r)return 1;if(\"object\"===t){var e,o=0;if(Array.isArray(r)){e=r.length;for(var a=0;e>a;a++)o+=i(r[a])}else{var u=Object.keys(r);e=u.length;for(var a=0;e>a;a++){var s=u[a];o+=i(s)+i(r[s])}}if(16>e)return 1+o;if(65536>e)return 3+o;if(4294967296>e)return 5+o;throw new Error(\"Array or object too long 0x\"+e.toString(16))}throw new Error(\"Unknown type \"+t)}function o(r){var t=new ArrayBuffer(i(r)),n=new DataView(t);return e(r,n,0),new Uint8Array(t)}function a(r,t,n){return t?new r(t.buffer,t.byteOffset,t.byteLength/(n||1)):void 0}function u(r){return a(DataView,r)}function s(r){return a(Uint8Array,r)}function f(r){return a(Int8Array,r)}function c(r){return a(Int32Array,r,4)}function d(r){return a(Float32Array,r,4)}function l(r,t){var n=r.length/2;t||(t=new Int16Array(n));for(var e=0,i=0;n>e;++e,i+=2)t[e]=r[i]<<8^r[i+1]<<0;return t}function v(r,t){var n=r.length;t||(t=new Uint8Array(2*n));for(var e=u(t),i=0;n>i;++i)e.setInt16(2*i,r[i]);return s(t)}function g(r,t){var n=r.length/4;t||(t=new Int32Array(n));for(var e=0,i=0;n>e;++e,i+=4)t[e]=r[i]<<24^r[i+1]<<16^r[i+2]<<8^r[i+3]<<0;return t}function L(r,t){var n=r.length;t||(t=new Uint8Array(4*n));for(var e=u(t),i=0;n>i;++i)e.setInt32(4*i,r[i]);return s(t)}function h(r,t){var n=r.length;t||(t=new Float32Array(n/4));for(var e=u(t),i=u(r),o=0,a=0,s=n/4;s>o;++o,a+=4)e.setFloat32(a,i.getFloat32(a),!0);return t}function y(r,t,n){var e=r.length,i=1/t;n||(n=new Float32Array(e));for(var o=0;e>o;++o)n[o]=r[o]*i;return n}function m(r,t,n){var e=r.length;n||(n=new Int32Array(e));for(var i=0;e>i;++i)n[i]=Math.round(r[i]*t);return n}function p(r,t){var n,e;if(!t){var i=0;for(n=0,e=r.length;e>n;n+=2)i+=r[n+1];t=new r.constructor(i)}var o=0;for(n=0,e=r.length;e>n;n+=2)for(var a=r[n],u=r[n+1],s=0;u>s;++s)t[o]=a,++o;return t}function U(r){if(0===r.length)return new Int32Array;var t,n,e=2;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]&&(e+=2);var i=new Int32Array(e),o=0,a=1;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]?(i[o]=r[t-1],i[o+1]=a,a=1,o+=2):++a;return i[o]=r[r.length-1],i[o+1]=a,i}function b(r,t){var n=r.length;t||(t=new r.constructor(n)),n&&(t[0]=r[0]);for(var e=1;n>e;++e)t[e]=r[e]+t[e-1];return t}function I(r,t){var n=r.length;t||(t=new r.constructor(n)),t[0]=r[0];for(var e=1;n>e;++e)t[e]=r[e]-r[e-1];return t}function w(r,t){var n,e,i=r instanceof Int8Array?127:32767,o=-i-1,a=r.length;if(!t){var u=0;for(n=0;a>n;++n)r[n]o&&++u;t=new Int32Array(u)}for(n=0,e=0;a>n;){for(var s=0;r[n]===i||r[n]===o;)s+=r[n],++n;s+=r[n],++n,t[e]=s,++e}return t}function C(r,t){var n,e=t?127:32767,i=-e-1,o=r.length,a=0;for(n=0;o>n;++n){var u=r[n];0===u?++a:a+=u===e||u===i?2:u>0?Math.ceil(u/e):Math.ceil(u/i)}var s=t?new Int8Array(a):new Int16Array(a),f=0;for(n=0;o>n;++n){var u=r[n];if(u>=0)for(;u>=e;)s[f]=e,++f,u-=e;else for(;i>=u;)s[f]=i,++f,u-=i;s[f]=u,++f}return s}function A(r,t){return b(p(r),t)}function x(r){return U(I(r))}function M(r,t,n){return y(p(r,c(n)),t,n)}function F(r,t){return U(m(r,t))}function S(r,t,n){return y(b(r,c(n)),t,n)}function E(r,t,n){return I(m(r,t),n)}function N(r,t,n){return y(w(r,c(n)),t,n)}function O(r,t,n){var e=w(r,c(n));return S(e,t,d(e))}function T(r,t,n){return C(E(r,t),n)}function k(r){var t=u(r),n=t.getInt32(0),e=t.getInt32(4),i=r.subarray(8,12),r=r.subarray(12);return[n,r,e,i]}function j(r,t,n,e){var i=new ArrayBuffer(12+e.byteLength),o=new Uint8Array(i),a=new DataView(i);return a.setInt32(0,r),a.setInt32(4,t),n&&o.set(n,8),o.set(e,12),o}function q(r){var t=r.length,n=s(r);return j(2,t,void 0,n)}function D(r){var t=r.length,n=L(r);return j(4,t,void 0,n)}function P(r,t){var n=r.length/t,e=L([t]),i=s(r);return j(5,n,e,i)}function z(r){var t=r.length,n=L(U(r));return j(6,t,void 0,n)}function B(r){var t=r.length,n=L(x(r));return j(8,t,void 0,n)}function V(r,t){var n=r.length,e=L([t]),i=L(F(r,t));return j(9,n,e,i)}function G(r,t){var n=r.length,e=L([t]),i=v(T(r,t));return j(10,n,e,i)}function R(r){var t={};return rr.forEach(function(n){void 0!==r[n]&&(t[n]=r[n])}),r.bondAtomList&&(t.bondAtomList=D(r.bondAtomList)),r.bondOrderList&&(t.bondOrderList=q(r.bondOrderList)),t.xCoordList=G(r.xCoordList,1e3),t.yCoordList=G(r.yCoordList,1e3),t.zCoordList=G(r.zCoordList,1e3),r.bFactorList&&(t.bFactorList=G(r.bFactorList,100)),r.atomIdList&&(t.atomIdList=B(r.atomIdList)),r.altLocList&&(t.altLocList=z(r.altLocList)),r.occupancyList&&(t.occupancyList=V(r.occupancyList,100)),t.groupIdList=B(r.groupIdList),t.groupTypeList=D(r.groupTypeList),r.secStructList&&(t.secStructList=q(r.secStructList,1)),r.insCodeList&&(t.insCodeList=z(r.insCodeList)),r.sequenceIndexList&&(t.sequenceIndexList=B(r.sequenceIndexList)),t.chainIdList=P(r.chainIdList,4),r.chainNameList&&(t.chainNameList=P(r.chainNameList,4)),t}function H(r){function t(r){for(var t={},n=0;r>n;n++){var e=o();t[e]=o()}return t}function n(t){var n=r.subarray(a,a+t);return a+=t,n}function e(t){var n=r.subarray(a,a+t);a+=t;var e=65535;if(t>e){for(var i=[],o=0;on;n++)t[n]=o();return t}function o(){var o,s,f=r[a];if(0===(128&f))return a++,f;if(128===(240&f))return s=15&f,a++,t(s);if(144===(240&f))return s=15&f,a++,i(s);if(160===(224&f))return s=31&f,a++,e(s);if(224===(224&f))return o=u.getInt8(a),a++,o;switch(f){case 192:return a++,null;case 194:return a++,!1;case 195:return a++,!0;case 196:return s=u.getUint8(a+1),a+=2,n(s);case 197:return s=u.getUint16(a+1),a+=3,n(s);case 198:return s=u.getUint32(a+1),a+=5,n(s);case 202:return o=u.getFloat32(a+1),a+=5,o;case 203:return o=u.getFloat64(a+1),a+=9,o;case 204:return o=r[a+1],a+=2,o;case 205:return o=u.getUint16(a+1),a+=3,o;case 206:return o=u.getUint32(a+1),a+=5,o;case 208:return o=u.getInt8(a+1),a+=2,o;case 209:return o=u.getInt16(a+1),a+=3,o;case 210:return o=u.getInt32(a+1),a+=5,o;case 217:return s=u.getUint8(a+1),a+=2,e(s);case 218:return s=u.getUint16(a+1),a+=3,e(s);case 219:return s=u.getUint32(a+1),a+=5,e(s);case 220:return s=u.getUint16(a+1),a+=3,i(s);case 221:return s=u.getUint32(a+1),a+=5,i(s);case 222:return s=u.getUint16(a+1),a+=3,t(s);case 223:return s=u.getUint32(a+1),a+=5,t(s)}throw new Error(\"Unknown type 0x\"+f.toString(16))}var a=0,u=new DataView(r.buffer);return o()}function W(r,t,n,e){switch(r){case 1:return h(t);case 2:return f(t);case 3:return l(t);case 4:return g(t);case 5:return s(t);case 6:return p(g(t),new Uint8Array(n));case 7:return p(g(t));case 8:return A(g(t));case 9:return M(g(t),g(e)[0]);case 10:return O(l(t),g(e)[0]);case 11:return y(l(t),g(e)[0]);case 12:return N(l(t),g(e)[0]);case 13:return N(f(t),g(e)[0]);case 14:return w(l(t));case 15:return w(f(t))}}function X(r,t){t=t||{};var n=t.ignoreFields,e={};return nr.forEach(function(t){var i=n?-1!==n.indexOf(t):!1,o=r[t];i||void 0===o||(o instanceof Uint8Array?e[t]=W.apply(null,k(o)):e[t]=o)}),e}function J(r){return String.fromCharCode.apply(null,r).replace(/\\0/g,\"\")}function K(r,t,n){n=n||{};var e,i,o,a,u,s,f=n.firstModelOnly,c=t.onModel,d=t.onChain,l=t.onGroup,v=t.onAtom,g=t.onBond,L=0,h=0,y=0,m=0,p=0,U=-1,b=r.chainNameList,I=r.secStructList,w=r.insCodeList,C=r.sequenceIndexList,A=r.atomIdList,x=r.bFactorList,M=r.altLocList,F=r.occupancyList,S=r.bondAtomList,E=r.bondOrderList;for(e=0,i=r.chainsPerModel.length;i>e&&!(f&&L>0);++e){var N=r.chainsPerModel[L];for(c&&c({chainCount:N,modelIndex:L}),o=0;N>o;++o){var O=r.groupsPerChain[h];if(d){var T=J(r.chainIdList.subarray(4*h,4*h+4)),k=null;b&&(k=J(b.subarray(4*h,4*h+4))),d({groupCount:O,chainIndex:h,modelIndex:L,chainId:T,chainName:k})}for(a=0;O>a;++a){var j=r.groupList[r.groupTypeList[y]],q=j.atomNameList.length;if(l){var D=null;I&&(D=I[y]);var P=null;r.insCodeList&&(P=String.fromCharCode(w[y]));var z=null;C&&(z=C[y]),l({atomCount:q,groupIndex:y,chainIndex:h,modelIndex:L,groupId:r.groupIdList[y],groupType:r.groupTypeList[y],groupName:j.groupName,singleLetterCode:j.singleLetterCode,chemCompType:j.chemCompType,secStruct:D,insCode:P,sequenceIndex:z})}for(u=0;q>u;++u){if(v){var B=null;A&&(B=A[m]);var V=null;x&&(V=x[m]);var G=null;M&&(G=String.fromCharCode(M[m]));var R=null;F&&(R=F[m]),v({atomIndex:m,groupIndex:y,chainIndex:h,modelIndex:L,atomId:B,element:j.elementList[u],atomName:j.atomNameList[u],formalCharge:j.formalChargeList[u],xCoord:r.xCoordList[m],yCoord:r.yCoordList[m],zCoord:r.zCoordList[m],bFactor:V,altLoc:G,occupancy:R})}m+=1}if(g){var H=j.bondAtomList;for(u=0,s=j.bondOrderList.length;s>u;++u)g({atomIndex1:m-q+H[2*u],atomIndex2:m-q+H[2*u+1],bondOrder:j.bondOrderList[u]})}y+=1}h+=1}if(p=U+1,U=m-1,g&&S)for(u=0,s=S.length;s>u;u+=2){var W=S[u],X=S[u+1];(W>=p&&U>=W||X>=p&&U>=X)&&g({atomIndex1:W,atomIndex2:X,bondOrder:E?E[u/2]:null})}L+=1}}function Q(r){return o(R(r))}function Y(r,t){r instanceof ArrayBuffer&&(r=new Uint8Array(r));var n;return n=r instanceof Uint8Array?H(r):r,X(n,t)}function Z(r,t,n,e){function i(){try{var r=Y(o.response);n(r)}catch(t){e(t)}}var o=new XMLHttpRequest;o.addEventListener(\"load\",i,!0),o.addEventListener(\"error\",e,!0),o.responseType=\"arraybuffer\",o.open(\"GET\",t+r.toUpperCase()),o.send()}function $(r,t,n){Z(r,or,t,n)}function _(r,t,n){Z(r,ar,t,n)}var rr=[\"mmtfVersion\",\"mmtfProducer\",\"unitCell\",\"spaceGroup\",\"structureId\",\"title\",\"depositionDate\",\"releaseDate\",\"experimentalMethods\",\"resolution\",\"rFree\",\"rWork\",\"bioAssemblyList\",\"ncsOperatorList\",\"entityList\",\"groupList\",\"numBonds\",\"numAtoms\",\"numGroups\",\"numChains\",\"numModels\",\"groupsPerChain\",\"chainsPerModel\"],tr=[\"xCoordList\",\"yCoordList\",\"zCoordList\",\"groupIdList\",\"groupTypeList\",\"chainIdList\",\"bFactorList\",\"atomIdList\",\"altLocList\",\"occupancyList\",\"secStructList\",\"insCodeList\",\"sequenceIndexList\",\"chainNameList\",\"bondAtomList\",\"bondOrderList\"],nr=rr.concat(tr),er=\"v1.1.0dev\",ir=\"//mmtf.rcsb.org/v1.0/\",or=ir+\"full/\",ar=ir+\"reduced/\";r.encode=Q,r.decode=Y,r.traverse=K,r.fetch=$,r.fetchReduced=_,r.version=er,r.fetchUrl=or,r.fetchReducedUrl=ar,r.encodeMsgpack=o,r.encodeMmtf=R,r.decodeMsgpack=H,r.decodeMmtf=X});","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport MMTF from '../../../vendor/js/mmtf';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst {\r\n Complex,\r\n Chain,\r\n Atom,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nclass ArrayComparator {\r\n constructor(original) {\r\n this._original = Array.from(original);\r\n this._original.sort();\r\n\r\n this._sum = 0;\r\n for (let i = 0; i < this._original.length; ++i) {\r\n this._sum += this._original[i];\r\n }\r\n }\r\n\r\n compare(candidate) {\r\n const len = candidate.length;\r\n if (len !== this._original.length) {\r\n return false;\r\n }\r\n\r\n let sum = 0;\r\n let i;\r\n for (i = 0; i < len; ++i) {\r\n sum += candidate[i];\r\n }\r\n\r\n if (sum !== this._sum) {\r\n return false;\r\n }\r\n\r\n const sorted = Array.from(candidate);\r\n sorted.sort();\r\n\r\n for (i = 0; i < len; ++i) {\r\n if (sorted[i] !== this._original[i]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\nArrayComparator.prototype.constructor = ArrayComparator;\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see https://github.com/rcsb/mmtf-javascript/blob/master/src/mmtf-traverse.js\r\nconst secStructToType = [\r\n StructuralElementType.HELIX_PI, // 0\r\n StructuralElementType.BEND, // 1\r\n StructuralElementType.HELIX_ALPHA, // 2\r\n StructuralElementType.STRAND, // 3\r\n StructuralElementType.HELIX_310, // 4\r\n StructuralElementType.BRIDGE, // 5\r\n StructuralElementType.TURN, // 6\r\n StructuralElementType.COIL, // 7\r\n];\r\n\r\nfunction getFirstByte(buf) {\r\n const bytes = new Uint8Array(buf, 0, 1);\r\n return bytes[0];\r\n}\r\n\r\nclass MMTFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'mmtf';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n // check if it's binary MessagePack format containing a map (dictionary)\r\n // see https://github.com/msgpack/msgpack/blob/master/spec.md\r\n return _.isArrayBuffer(data) && ((getFirstByte(data) | 1) === 0xDF);\r\n }\r\n\r\n _onModel(_modelData) {\r\n }\r\n\r\n _onChain(chainData) {\r\n if (chainData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const chain = new Chain(this._complex, chainData.chainName);\r\n this._complex._chains[chainData.chainIndex] = chain;\r\n chain._index = chainData.chainIndex;\r\n }\r\n\r\n _onGroup(groupData) {\r\n if (groupData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n if (this.settings.now.nowater) {\r\n // skip water\r\n if (groupData.groupName === 'HOH' || groupData.groupName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n const chain = this._complex._chains[groupData.chainIndex];\r\n const icode = !groupData.insCode.charCodeAt(0) ? '' : groupData.insCode;\r\n const residue = chain.addResidue(groupData.groupName, groupData.groupId, icode);\r\n residue._index = groupData.groupIndex;\r\n\r\n this._updateSecStructure(this._complex, residue, groupData);\r\n }\r\n\r\n _onAtom(atomData) {\r\n if (atomData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const altLoc = !atomData.altLoc.charCodeAt(0) ? '' : atomData.altLoc;\r\n const atom = new Atom(\r\n atomData.groupIndex, // we store residue index here to replace it later with actual reference\r\n atomData.atomName,\r\n Element.getByName(atomData.element.toUpperCase()),\r\n new THREE.Vector3(atomData.xCoord, atomData.yCoord, atomData.zCoord),\r\n Element.Role[atomData.atomName],\r\n false, // hetero atoms will be marked later\r\n atomData.atomId,\r\n altLoc,\r\n atomData.occupancy,\r\n atomData.bFactor,\r\n atomData.formalCharge,\r\n );\r\n\r\n this._complex._atoms[atomData.atomIndex] = atom;\r\n atom.index = atomData.atomIndex;\r\n\r\n this._serialAtomMap[atomData.atomId] = atom;\r\n }\r\n\r\n _onBond(bondData) {\r\n const right = Math.max(bondData.atomIndex1, bondData.atomIndex2);\r\n if (right >= this._complex._atoms.length) {\r\n return;\r\n }\r\n const left = Math.min(bondData.atomIndex1, bondData.atomIndex2);\r\n this._complex.addBond(\r\n this._complex._atoms[left], this._complex._atoms[right],\r\n bondData.bondOrder, Bond.BondType.UNKNOWN, true,\r\n );\r\n }\r\n\r\n _updateSecStructure(complex, residue, groupData) {\r\n const helixClasses = [3, -1, 1, -1, 5];\r\n\r\n if (!_.isUndefined(groupData) && groupData.secStruct === this._ssType) {\r\n residue._secondary = this._ssStruct;\r\n if (this._ssStruct) {\r\n this._ssStruct.term = residue;\r\n }\r\n return;\r\n }\r\n\r\n if (!_.isUndefined(groupData)) {\r\n // start new secondary structure\r\n const type = secStructToType[groupData.secStruct];\r\n this._ssType = groupData.secStruct;\r\n this._ssStart = residue;\r\n\r\n let struct = null;\r\n switch (this._ssType) {\r\n case -1: // undefined\r\n case 7: // coil\r\n break;\r\n case 0: // pi helix\r\n case 2: // alpha helix\r\n case 4: // 3-10 helix\r\n struct = new Helix(helixClasses[this._ssType], residue, residue, 0, '', '', 0);\r\n complex._helices.push(struct);\r\n break;\r\n case 3: { // extended\r\n const sheet = new Sheet('', 0);\r\n complex._sheets.push(sheet);\r\n struct = new Strand(sheet, residue, residue, 0, null, null);\r\n break;\r\n }\r\n default:\r\n if (type !== undefined) {\r\n struct = new StructuralElement(type, residue, residue);\r\n }\r\n break;\r\n }\r\n\r\n this._ssStruct = struct;\r\n residue._secondary = struct;\r\n if (struct) {\r\n complex.structures.push(struct);\r\n }\r\n }\r\n }\r\n\r\n _updateMolecules(mmtfData) {\r\n const entities = mmtfData.entityList;\r\n if (!entities) {\r\n return;\r\n }\r\n\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < entities.length; i++) {\r\n const entity = entities[i];\r\n const chains = entity.chainIndexList;\r\n let residues = [];\r\n for (let j = 0; j < chains.length; j++) {\r\n const chainIndex = chains[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, entity.description, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n // populate complex with chains, residues and atoms\r\n _traverse(mmtfData) {\r\n const self = this;\r\n\r\n // get metadata\r\n const { metadata } = this._complex;\r\n metadata.id = mmtfData.structureId;\r\n metadata.title = [];\r\n metadata.title[0] = mmtfData.title;\r\n metadata.date = mmtfData.releaseDate;\r\n metadata.format = 'mmtf';\r\n\r\n // create event callback functions\r\n const eventCallbacks = {\r\n onModel(modelData) {\r\n self._onModel(modelData);\r\n },\r\n onChain(chainData) {\r\n self._onChain(chainData);\r\n },\r\n onGroup(groupData) {\r\n self._onGroup(groupData);\r\n },\r\n onAtom(atomData) {\r\n self._onAtom(atomData);\r\n },\r\n onBond(bondData) {\r\n self._onBond(bondData);\r\n },\r\n };\r\n\r\n // temporary variables used during traversal to track secondary structures\r\n this._ssType = -1;\r\n this._ssStruct = null;\r\n this._ssStart = null;\r\n\r\n // traverse the structure and listen to the events\r\n MMTF.traverse(mmtfData, eventCallbacks);\r\n\r\n this._updateSecStructure(this._complex);\r\n this._updateMolecules(mmtfData);\r\n }\r\n\r\n // During traversal atoms and residues don't come sequentially\r\n // so a residue for certain atom can be unavailable. Thus we\r\n // store residue index in atom.\r\n // This function being called after traversal replaces the index\r\n // with actual reference, and also populates atom lists in residues.\r\n _linkAtomsToResidues() {\r\n for (let i = 0; i < this._complex._atoms.length; ++i) {\r\n const atom = this._complex._atoms[i];\r\n const residue = this._complex._residues[atom.residue];\r\n atom.residue = residue;\r\n residue._atoms.push(atom);\r\n }\r\n }\r\n\r\n _findSynonymousChains() {\r\n const named = {};\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!named.hasOwnProperty(name)) {\r\n named[name] = [];\r\n }\r\n\r\n named[name].push(chain._index);\r\n }\r\n\r\n return named;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _parseAssemblyInfo(mmtfData) {\r\n let i;\r\n let j;\r\n let k;\r\n const assemblies = [];\r\n const { logger } = this;\r\n\r\n for (i = 0; i < mmtfData.bioAssemblyList.length; ++i) {\r\n const baInfo = mmtfData.bioAssemblyList[i];\r\n if (baInfo.transformList.length === 0) {\r\n continue;\r\n }\r\n\r\n const chains = baInfo.transformList[0].chainIndexList;\r\n const chainListCheck = new ArrayComparator(chains);\r\n\r\n // build list of chain names\r\n const chainNames = {};\r\n for (j = 0; j < chains.length; ++j) {\r\n chainNames[this._complex._chains[chains[j]].getName()] = 1;\r\n }\r\n\r\n // all chains with the same name should belong to assembly if one of them belongs\r\n const allChains = [];\r\n let name;\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n // just concat arrays -- there should be no duplicates\r\n Array.prototype.push.apply(allChains, this._chainsByName[name]);\r\n }\r\n }\r\n if (!chainListCheck.compare(allChains)) {\r\n // assembly is missing some of the chains\r\n logger.debug('MMTF: Assembly is missing some of the synonymous chains. Skipping...');\r\n }\r\n\r\n const a = new Assembly(this._complex);\r\n\r\n // add chains to assembly\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n a.addChain(name);\r\n }\r\n }\r\n\r\n // add unique matrices to assembly\r\n a.addMatrix(new THREE.Matrix4().fromArray(baInfo.transformList[0].matrix).transpose());\r\n for (j = 1; j < baInfo.transformList.length; ++j) {\r\n const transform = baInfo.transformList[j];\r\n\r\n if (!chainListCheck.compare(transform.chainIndexList)) {\r\n // list of chains for this transform doesn't match that for other transforms\r\n // this is illegal in our structure\r\n logger.debug('MMTF: Chain lists differ for different transforms in one assembly. Skipping...');\r\n continue;\r\n }\r\n\r\n const m = new THREE.Matrix4().fromArray(transform.matrix).transpose();\r\n\r\n // check if matrix is already in the list\r\n for (k = 0; k < a.matrices.length; ++k) {\r\n if (a.matrices[k].equals(m)) {\r\n break;\r\n }\r\n }\r\n\r\n if (k === a.matrices.length) {\r\n a.addMatrix(m);\r\n }\r\n }\r\n\r\n a.finalize();\r\n assemblies.push(a);\r\n }\r\n\r\n return assemblies;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _markHeteroAtoms(mmtfData) {\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < mmtfData.entityList.length; ++i) {\r\n const entity = mmtfData.entityList[i];\r\n if (entity.type !== 'polymer') {\r\n for (let j = 0; j < entity.chainIndexList.length; ++j) {\r\n const chainIndex = entity.chainIndexList[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n for (let k = 0; k < chain._residues.length; ++k) {\r\n const res = chain._residues[k];\r\n for (let m = 0; m < res._atoms.length; ++m) {\r\n res._atoms[m].het = true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // joins chains with the same name into single chain\r\n _joinSynonymousChains() {\r\n let i;\r\n let j;\r\n\r\n const primaryChainsArray = [];\r\n const primaryChainsHash = {};\r\n\r\n // join chains\r\n for (i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!primaryChainsHash.hasOwnProperty(name)) {\r\n // new name -- this is a primary chain\r\n primaryChainsHash[name] = chain;\r\n chain._index = primaryChainsArray.length; // update index as this array will later replace original chain list\r\n primaryChainsArray.push(chain);\r\n continue;\r\n }\r\n\r\n // this chain should be joined with the primary chain of the same name\r\n const primary = primaryChainsHash[name];\r\n for (j = 0; j < chain._residues.length; ++j) {\r\n const residue = chain._residues[j];\r\n primary._residues.push(residue);\r\n residue._chain = primary;\r\n }\r\n }\r\n\r\n // replace chains list with one containing only primary chains\r\n // dropping references to all chains but primary\r\n this._complex._chains = primaryChainsArray;\r\n }\r\n\r\n parseSync() {\r\n const mmtfData = MMTF.decode(this._data);\r\n\r\n this._complex = new Complex();\r\n this._serialAtomMap = {}; // filled during traversal\r\n\r\n this._traverse(mmtfData);\r\n this._linkAtomsToResidues();\r\n this._markHeteroAtoms(mmtfData);\r\n this._chainsByName = this._findSynonymousChains();\r\n Array.prototype.push.apply(this._complex.units, this._parseAssemblyInfo(mmtfData));\r\n this._joinSynonymousChains();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n return this._complex;\r\n }\r\n}\r\n\r\nMMTFParser.formats = ['mmtf'];\r\nMMTFParser.extensions = ['.mmtf'];\r\nMMTFParser.binary = true;\r\n\r\nexport default MMTFParser;\r\n","class ParsingError extends Error {\r\n constructor(message, line, column) {\r\n super(`data:${line}:${column}: ${message}`);\r\n\r\n if (Error.captureStackTrace) {\r\n Error.captureStackTrace(this, ParsingError);\r\n }\r\n\r\n this.name = 'ParsingError';\r\n this.parseLine = line;\r\n this.parseColumn = column;\r\n }\r\n}\r\n\r\nexport default ParsingError;\r\n","import _ from 'lodash';\r\nimport ParsingError from './ParsingError';\r\n\r\n// Implemented and being tested against: https://www.iucr.org/resources/cif/spec/version1.1/cifsyntax\r\n\r\nfunction _isWhitespace(ch) {\r\n return ch === 32 || ch === 10 || ch === 13 || ch === 9;\r\n}\r\n\r\nfunction _inlineIndexOf(ch0, str, idx) {\r\n const len = str.length;\r\n let ch = -1;\r\n while (idx < len) {\r\n ch = str.charCodeAt(idx);\r\n if (ch === ch0 || ch === 10) {\r\n break;\r\n }\r\n ++idx;\r\n }\r\n return ch === ch0 ? idx : -1;\r\n}\r\n\r\nexport default function readCIF(source) {\r\n let i = 0;\r\n let j = 0;\r\n const n = source.length;\r\n let code = NaN;\r\n let newline = true;\r\n let line = 1;\r\n let column = 1;\r\n let begin;\r\n let state = 0; // 0 - start, 1 - block, 2 - item, 3 - loop, 4 - values, 5 - value\r\n const result = {};\r\n let block = {};\r\n let keys = [];\r\n let keysCount = 0;\r\n let key = '';\r\n let values = [];\r\n let valuesCount = 0;\r\n let value;\r\n\r\n function _parseValue() {\r\n let val;\r\n if ((code === 46 || code === 63) && (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))) { // '.' or '?' .....\r\n // it's a missing value\r\n ++column;\r\n ++i;\r\n return undefined;\r\n }\r\n if (newline && code === 59) { // ';' ......................................................................\r\n // parse multi-line string\r\n j = i;\r\n let lines = 0;\r\n do {\r\n j = _inlineIndexOf(10, source, j + 1); // '\\n'\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated text block found', line, column);\r\n }\r\n ++lines;\r\n } while ((j + 1 < n && source.charCodeAt(j + 1) !== code) || j + 1 >= n);\r\n val = source.substring(i + 1, j).replace(/\\r/g, '');\r\n i = j + 2;\r\n line += lines;\r\n column = 1;\r\n newline = false;\r\n return val;\r\n }\r\n if (code === 39 || code === 34) { // ''' or '\"' ...........................................................\r\n // parse quoted string\r\n j = i;\r\n do {\r\n j = _inlineIndexOf(code, source, j + 1);\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated quoted string found', line, column);\r\n }\r\n } while (j + 1 < n && !_isWhitespace(source.charCodeAt(j + 1)));\r\n val = source.substring(i + 1, j);\r\n column += j - i + 1;\r\n i = j + 1;\r\n return val;\r\n } // ......................................................................................................\r\n // parse until the first whitespace\r\n j = i;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n val = source.substring(i, j);\r\n column += j - i;\r\n i = j;\r\n // try to convert to a number\r\n const num = Number(val);\r\n if (!Number.isNaN(num)) {\r\n return num;\r\n }\r\n // or leave as an unquoted string\r\n return val;\r\n }\r\n\r\n function _storeKey(tag) {\r\n keys[keysCount++] = tag;\r\n }\r\n\r\n function _storeValue(val) {\r\n const keyIndex = valuesCount % keysCount;\r\n values[keyIndex].push(val);\r\n ++valuesCount;\r\n return val;\r\n }\r\n\r\n while (i <= n) {\r\n code = source.charCodeAt(i); // 'NaN' in place of ''\r\n if (code === 13) { // '\\r' .......................................................................................\r\n // just ignore\r\n } else if (code === 10) { // '\\n' ................................................................................\r\n // take note of new lines\r\n newline = true;\r\n ++line;\r\n column = 1;\r\n } else {\r\n // process inline characters\r\n if (code === 32 || code === 9) { // ' ' or '\\t' ................................................................\r\n // just ignore\r\n } else if (code === 35) { // '#' ...............................................................................\r\n // skip the comment until before the end of the line\r\n i = _inlineIndexOf(10, source, i + 1); // '\\n'\r\n if (i === -1) {\r\n break;\r\n } else {\r\n continue; // don't forget to process the new line\r\n }\r\n } else if (state === 0) { // start =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n j = i + 5;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new data block\r\n result[source.substring(begin, i)] = block = {};\r\n state = 1; // block\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Data block name missing', line, column);\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 1) { // block =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n continue; // parse again in a different state\r\n } else if (code === 95) { // '_' .............................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // start new item\r\n key = source.substring(begin, i);\r\n state = 2; // item\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n i += 5;\r\n column += 5;\r\n if (i < n && !_isWhitespace(source.charCodeAt(i))) {\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n } else {\r\n // start new loop\r\n keys = [];\r\n keysCount = 0;\r\n values = [];\r\n valuesCount = 0;\r\n state = 3; // loop\r\n continue; // don't forget to process the whitespace\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 2) { // item ==============================================================================\r\n if (Number.isNaN(code)) {\r\n break;\r\n }\r\n value = _parseValue();\r\n _.set(block, key, value);\r\n state = 1; // block\r\n continue;\r\n } else if (state === 3) { // loop ==============================================================================\r\n if (code === 95) { // '_' ....................................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new key\r\n _storeKey(source.substring(begin, i));\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else { // ..................................................................................................\r\n if (keysCount > 0) {\r\n for (let keyIndex = 0; keyIndex < keysCount; ++keyIndex) {\r\n value = [];\r\n values[keyIndex] = value;\r\n _.set(block, keys[keyIndex], value);\r\n }\r\n state = 4;\r\n continue; // parse again in a different state\r\n }\r\n throw new ParsingError('Data tags are missing inside a loop', line, column);\r\n }\r\n } else if (state === 4) { // values ============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n } else if (code === 95) { // '_' .............................................................................\r\n state = 1; // block\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n state = 1; // block\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n state = 0;\r\n } else { // ..................................................................................................\r\n _storeValue(_parseValue());\r\n }\r\n continue; // parse again in a different state\r\n } else { // ====================================================================================================\r\n throw new ParsingError(`Unexpected internal state ${state}`, line, column);\r\n }\r\n\r\n newline = false;\r\n ++column;\r\n }\r\n ++i;\r\n }\r\n\r\n if (state === 2) { // item\r\n throw new ParsingError(`Unexpected end of file in state ${state}`, line, column);\r\n }\r\n\r\n return result;\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\nimport readCIF from './readCIF';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nconst cRequiredAtomFields = [\r\n 'auth_seq_id',\r\n 'Cartn_x',\r\n 'Cartn_y',\r\n 'Cartn_z',\r\n 'label_atom_id',\r\n];\r\n\r\nconst cSecondaryCoding = {\r\n helx: 'helix',\r\n turn: 'turn',\r\n strn: 'strand',\r\n};\r\n\r\nfunction getTypeFromId(string) {\r\n const typeId = /[A-Za-z]+/.exec(string);\r\n if (!typeId) {\r\n return null;\r\n }\r\n\r\n return cSecondaryCoding[typeId[0].toLowerCase()];\r\n}\r\n\r\n/**\r\n * Make valid object an array\r\n * @param arrayLikeObject\r\n * @return {array, object} array or object\r\n */\r\nfunction arrize(arrayLikeObject) {\r\n if (arrayLikeObject === null || arrayLikeObject === undefined || _.isArray(arrayLikeObject)) {\r\n return arrayLikeObject;\r\n }\r\n return [arrayLikeObject];\r\n}\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\nclass AtomDataError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'AtomDataError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction _getOperations(operList) {\r\n if (!operList) {\r\n return null;\r\n }\r\n const idc = arrize(operList.id);\r\n const { matrix, vector } = operList;\r\n if (!idc || !matrix || !vector) {\r\n return null;\r\n }\r\n\r\n const ops = [];\r\n for (let i = 0, n = idc.length; i < n; ++i) {\r\n const mtx = new THREE.Matrix4();\r\n const { elements } = mtx;\r\n\r\n for (let row = 0; row < 3; ++row) {\r\n const matrixData = matrix[row + 1];\r\n elements[row] = arrize(matrixData[1])[i];\r\n elements[row + 4] = arrize(matrixData[2])[i];\r\n elements[row + 8] = arrize(matrixData[3])[i];\r\n elements[row + 12] = arrize(vector[row + 1])[i];\r\n }\r\n ops[idc[i]] = mtx;\r\n }\r\n return ops;\r\n}\r\n\r\nfunction _extractOperations(assemblyGen, opsDict) {\r\n assemblyGen = _.isString(assemblyGen) ? assemblyGen : `${assemblyGen}`;\r\n const l = assemblyGen.replace(/\\)\\s*\\(/g, '!').replace(/[()']/g, '');\r\n const groupStr = l.split('!');\r\n const gps = [];\r\n\r\n for (let grIdx = 0, grCount = groupStr.length; grIdx < grCount; ++grIdx) {\r\n const gr = groupStr[grIdx].split(',');\r\n const gp = [];\r\n let idx = 0;\r\n for (let i = 0, n = gr.length; i < n; ++i) {\r\n const s = gr[i];\r\n if (s.includes('-')) {\r\n const es = s.split('-');\r\n let j = parseInt(es[0], 10);\r\n const m = parseInt(es[1], 10);\r\n for (; j <= m; ++j) {\r\n gp[idx++] = opsDict[j];\r\n }\r\n } else {\r\n gp[idx++] = opsDict[s];\r\n }\r\n }\r\n gps.push(gp);\r\n }\r\n\r\n // traverse all groups from the end of array and make all mults\r\n const matrices = [];\r\n let cnt = 0;\r\n function traverse(level, mtx) {\r\n for (let ii = 0, nn = gps[level].length; ii < nn; ++ii) {\r\n const newMtx = mtx ? mtx.clone() : new THREE.Matrix4();\r\n newMtx.multiplyMatrices(gps[level][ii], newMtx);\r\n if (level === 0) {\r\n matrices[cnt++] = newMtx;\r\n } else {\r\n traverse(level - 1, newMtx);\r\n }\r\n }\r\n }\r\n traverse(gps.length - 1);\r\n return matrices;\r\n}\r\n\r\nclass CIFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this.asymDict = {};\r\n this.molecules = [];\r\n this._options.fileType = 'cif';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*data_/i.test(data);\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing CIF file..');\r\n const data = readCIF(this._data);\r\n return this._toComplex(data);\r\n }\r\n\r\n /**\r\n * Convert intermediate structure into our valid Complex object\r\n * @param cifData intermediate CIF object\r\n * @returns {Complex} complex\r\n * @private\r\n */\r\n _toComplex(cifData) {\r\n const complex = new Complex();\r\n const complexData = cifData[Object.keys(cifData)[0]];\r\n this._extractAtoms(complex, complexData);\r\n this._extractSecondary(complex, complexData);\r\n this._extractAssemblies(complex, complexData);\r\n this._extractMolecules(complex, complexData);\r\n this._extractMetadata(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n\r\n return complex;\r\n }\r\n\r\n\r\n /**\r\n * Extract metadata\r\n * @param complex structure to fill\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n\r\n _extractMetadata(complex, complexData) {\r\n const { metadata } = complex;\r\n metadata.id = complexData.entry.id;\r\n metadata.classification = complexData.struct_keywords.pdbx_keywords;\r\n const databaserev = complexData.database_PDB_rev;\r\n metadata.date = (databaserev && databaserev.date_original) ? databaserev.date_original : '';\r\n metadata.format = 'cif';\r\n metadata.title = [];\r\n metadata.title[0] = complexData.struct.title;\r\n }\r\n\r\n /**\r\n * Extract molecules information from CIF structure (should be called strictly after _extractAtoms)\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractMolecules(complex, complexData) {\r\n const molData = complexData.entity;\r\n const names = arrize(molData.pdbx_description);\r\n const count = names.length;\r\n let i;\r\n\r\n // molecules names from cif\r\n for (i = 0; i < count; i++) {\r\n this.molecules[i].name = names[i];\r\n }\r\n\r\n // reorganize molecules for complex and check chains\r\n const molecules = complex.getMolecules();\r\n for (i = 0; i < count; i++) {\r\n const molecule = this.molecules[i];\r\n molecules[i] = new Molecule(complex, molecule.name, i + 1);\r\n molecules[i].residues = molecule.residues;\r\n }\r\n }\r\n\r\n /**\r\n * Extract atom information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAtoms(complex, complexData) {\r\n const atomData = complexData.atom_site;\r\n if (!atomData) {\r\n throw new AtomDataError('CIF parsing error: atom_site is not specified!');\r\n }\r\n\r\n for (let f = 0, n = cRequiredAtomFields.length; f < n; ++f) {\r\n if (!atomData[cRequiredAtomFields[f]]) {\r\n throw new AtomDataError(`CIF parsing error: requires field ${cRequiredAtomFields[f]} not found!`);\r\n }\r\n }\r\n\r\n const { asymDict } = this;\r\n // required fields\r\n const resIdc = arrize(atomData.auth_seq_id);\r\n const x = arrize(atomData.Cartn_x);\r\n const y = arrize(atomData.Cartn_y);\r\n const z = arrize(atomData.Cartn_z);\r\n const names = arrize(atomData.label_atom_id);\r\n const count = names.length;\r\n // optional fields\r\n const group = arrize(atomData.group_PDB) || [];\r\n const chainIdc = arrize(atomData.auth_asym_id) || [];\r\n const chainLabelIdc = arrize(atomData.label_asym_id) || [];\r\n const serials = arrize(atomData.id) || [];\r\n const iCodes = arrize(atomData.pdbx_PDB_ins_code) || [];\r\n const resNames = arrize(atomData.label_comp_id) || [];\r\n const elements = arrize(atomData.type_symbol) || [];\r\n const tempFactors = arrize(atomData.B_iso_or_equiv) || [];\r\n const occupancies = arrize(atomData.occupancy) || [];\r\n const charges = arrize(atomData.pdbx_formal_charge) || [];\r\n const altLocs = arrize(atomData.label_alt_id) || [];\r\n const models = arrize(atomData.pdbx_PDB_model_num) || [];\r\n const molecules = arrize(atomData.label_entity_id) || [];\r\n\r\n let chain = null;\r\n let residue = null;\r\n for (let i = 0; i < count; ++i) {\r\n const model = models[i] || 1;\r\n if (model !== 1) {\r\n continue;\r\n }\r\n const chainID = String(chainIdc[i] || ' ');\r\n\r\n if (!chain || chain.getName() !== chainID) {\r\n chain = complex.getChain(chainID) || complex.addChain(chainID);\r\n }\r\n asymDict[String(chainLabelIdc[i] || ' ')] = chainID;\r\n const resSeq = resIdc[i];\r\n const iCode = String(iCodes[i] || ' ');\r\n const resName = String(resNames[i] || '');\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n residue = chain.addResidue(resName, resSeq, iCode);\r\n\r\n // store molecule (entity)\r\n const moleculeIdx = molecules[i] - 1;\r\n let entity = this.molecules[moleculeIdx];\r\n if (!entity) {\r\n this.molecules[moleculeIdx] = { name: '', residues: [] };\r\n entity = this.molecules[moleculeIdx];\r\n }\r\n entity.residues.push(residue);\r\n }\r\n\r\n const name = names[i];\r\n const element = elements[i] || nameToElement(name);\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name.trim()];\r\n const xyz = new THREE.Vector3(x[i], y[i], z[i]);\r\n const het = group[i] === 'HETATM' || false;\r\n const serial = serials[i] || i;\r\n const tempFactor = tempFactors[i] || 0.0;\r\n const occupancy = occupancies[i] || 0.0;\r\n const altLoc = String(altLocs[i] || '');\r\n const charge = charges[i] || 0;\r\n\r\n residue.addAtom(\r\n name, type, xyz,\r\n role, het, serial, altLoc, occupancy, tempFactor, charge,\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Extracts secondary structure information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex - complex to fill\r\n * @param complexData - CIF complex data\r\n * @private\r\n */\r\n _extractSecondary(complex, complexData) {\r\n if (complexData.struct_conf) {\r\n this._extractConfs(complex, complexData.struct_conf);\r\n }\r\n if (complexData.struct_sheet_range) {\r\n this._extractSheets(complex, complexData.struct_sheet_range);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts sheets information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param sheetData\r\n * @private\r\n */\r\n _extractSheets(complex, sheetData) {\r\n const { asymDict } = this;\r\n if (!sheetData.sheet_id || !sheetData.id || !sheetData.beg_label_seq_id || !sheetData.end_label_seq_id\r\n || !sheetData.beg_label_asym_id) {\r\n return;\r\n }\r\n // Strand(sheet, start, end, sense, cur, prev)\r\n const sheets = complex._sheets;\r\n\r\n function getSheet(name) {\r\n const n = sheets.length;\r\n for (let i = 0; i < n; ++i) {\r\n if (sheets[i]._name === name) {\r\n return sheets[i];\r\n }\r\n }\r\n sheets[n] = new Sheet(name, 0);\r\n return sheets[n];\r\n }\r\n\r\n const sheetNames = arrize(sheetData.sheet_id);\r\n const strandNames = arrize(sheetData.id);\r\n const starts = arrize(sheetData.beg_auth_seq_id);\r\n const ends = arrize(sheetData.end_auth_seq_id);\r\n const chains = arrize(sheetData.beg_label_asym_id);\r\n const stICodes = arrize(sheetData.pdbx_beg_PDB_ins_code) || [];\r\n const endICodes = arrize(sheetData.pdbx_end_PDB_ins_code) || [];\r\n\r\n for (let i = 0, n = strandNames.length; i < n; ++i) {\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n const sheet = getSheet(sheetNames[i]);\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n\r\n const strand = new Strand(sheet, start[0], end[0], 0, null, null);\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = strand;\r\n }\r\n sheet.addStrand(strand);\r\n complex.structures.push(strand);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts helix/turn/strand(?) information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param helicesData\r\n * @private\r\n */\r\n _extractConfs(complex, helicesData) {\r\n const { asymDict } = this;\r\n if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id\r\n || !helicesData.beg_label_asym_id) {\r\n return;\r\n }\r\n\r\n const types = arrize(helicesData.conf_type_id);\r\n const starts = arrize(helicesData.beg_auth_seq_id);\r\n const stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || [];\r\n const ends = arrize(helicesData.end_auth_seq_id);\r\n const endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || [];\r\n const comments = arrize(helicesData.details) || [];\r\n const lengths = arrize(helicesData.pdbx_PDB_helix_length) || [];\r\n const helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || [];\r\n const names = arrize(helicesData.id) || [];\r\n const chains = arrize(helicesData.beg_label_asym_id);\r\n\r\n for (let i = 0, n = types.length; i < n; ++i) {\r\n const type = getTypeFromId(types[i]);\r\n if (!type) {\r\n continue;\r\n }\r\n const name = names[i] || types[i];\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n const comment = comments[i] || '';\r\n const length = lengths[i] || 0;\r\n const helixClass = helixClasses[i] || ' ';\r\n let struct;\r\n if (type === 'helix') {\r\n const idx = complex._helices.length;\r\n struct = new Helix(helixClass, start[0], end[0], idx, name, comment, length);\r\n complex.addHelix(struct);\r\n complex.structures.push(struct);\r\n } else if (type === 'turn') {\r\n struct = new StructuralElement(StructuralElement.Type.TURN, start[0], end[0]);\r\n complex.structures.push(struct);\r\n } else {\r\n struct = null;\r\n }\r\n if (!struct) {\r\n continue;\r\n }\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = struct;\r\n }\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Extract biological assemblies information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAssemblies(complex, complexData) {\r\n const { asymDict } = this;\r\n const asmGen = complexData.pdbx_struct_assembly_gen;\r\n if (!asmGen) {\r\n return;\r\n }\r\n\r\n const asmIdx = arrize(asmGen.assembly_id);\r\n const asmOper = arrize(asmGen.oper_expression);\r\n const asmList = arrize(asmGen.asym_id_list);\r\n if (!asmIdx || !asmOper || !asmList) {\r\n return;\r\n }\r\n\r\n const operList = _getOperations(complexData.pdbx_struct_oper_list);\r\n if (!operList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = asmIdx.length; i < n; ++i) {\r\n const asm = new Assembly(complex);\r\n const assemblyOps = _extractOperations(asmOper[i], operList);\r\n const entries = asmList[i].split(',');\r\n for (let ii = 0, nn = entries.length; ii < nn; ++ii) {\r\n const chain = entries[ii].trim();\r\n if (chain.length > 0) {\r\n asm.addChain(asymDict[chain]);\r\n }\r\n }\r\n asm.matrices = assemblyOps;\r\n complex.units.push(asm);\r\n }\r\n }\r\n}\r\n\r\nCIFParser.formats = ['cif', 'mmcif'];\r\nCIFParser.extensions = ['.cif', '.mmcif'];\r\n\r\nexport default CIFParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Volume from '../../chem/Volume';\r\n\r\nexport const valueType = {\r\n singular: 0,\r\n vector: 1,\r\n array: 2,\r\n buffer: 3,\r\n};\r\n\r\nclass VolumeModel {\r\n _xyz2crs = [];\r\n\r\n _origin = new THREE.Vector3(0, 0, 0);\r\n\r\n constructor() {\r\n this._header = {};\r\n this._boxSize = new THREE.Vector3();\r\n this._boxStart = new THREE.Vector3();\r\n this._header.delta = {};\r\n this._header.extent = [];\r\n this._header.nstart = [];\r\n this._header.grid = [];\r\n this._header.crs2xyz = [];\r\n this._header.cellDims = new THREE.Vector3();\r\n this._header.angles = [];\r\n this._header.origin = new THREE.Vector3(0, 0, 0);\r\n this._header.dmin = 0;\r\n this._header.dmean = 0;\r\n this._header.dmax = 0;\r\n }\r\n\r\n _typedCheck() {\r\n if (_.isTypedArray(this._buff)) {\r\n this._buff = this._buff.buffer;\r\n } else if (!_.isArrayBuffer(this._buff)) {\r\n throw new TypeError('Expected ArrayBuffer or TypedArray');\r\n }\r\n }\r\n\r\n _fillHeader(headerFormat, arrays) {\r\n for (const key in headerFormat) {\r\n if (headerFormat.hasOwnProperty(key)) {\r\n switch (headerFormat[key][0]) {\r\n case valueType.singular:\r\n this._header[key] = arrays[headerFormat[key][1]][headerFormat[key][2]];\r\n break;\r\n\r\n case valueType.array:\r\n this._parseArray(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.vector:\r\n this._parseVector(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.buffer:\r\n this._header[key] = new Uint8Array(\r\n arrays[headerFormat[key][1]],\r\n [headerFormat[key][2]] * 4,\r\n [headerFormat[key][3]] * 4,\r\n );\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _parseVector(vector, arr, pos) {\r\n [vector.x, vector.y, vector.z] = [arr[pos], arr[pos + 1], arr[pos + 2]];\r\n }\r\n\r\n _parseArray(vector, arr, pos) {\r\n vector[0] = arr[pos];\r\n vector[1] = arr[pos + 1];\r\n vector[2] = arr[pos + 2];\r\n }\r\n\r\n _parseHeader(_buffer) {}\r\n\r\n _setAxisIndices() {}\r\n\r\n _setOrigins() {}\r\n\r\n _getAxis() {\r\n const header = this._header;\r\n\r\n const xScale = header.cellDims.x / header.grid[0];\r\n const yScale = header.cellDims.y / header.grid[1];\r\n const zScale = header.cellDims.z / header.grid[2];\r\n\r\n const [alpha, beta, gamma] = header.angles;\r\n\r\n const z1 = Math.cos(beta);\r\n const z2 = (Math.cos(alpha) - Math.cos(beta)\r\n * Math.cos(gamma)) / Math.sin(gamma);\r\n const z3 = Math.sqrt(1.0 - z1 * z1 - z2 * z2);\r\n\r\n const xaxis = new THREE.Vector3(xScale, 0, 0);\r\n const yaxis = new THREE.Vector3(Math.cos(gamma) * yScale, Math.sin(gamma) * yScale, 0);\r\n const zaxis = new THREE.Vector3(z1 * zScale, z2 * zScale, z3 * zScale);\r\n\r\n return [xaxis, yaxis, zaxis];\r\n }\r\n\r\n _getXYZdim() {\r\n return [this._header.extent[this._xyz2crs[0]],\r\n this._header.extent[this._xyz2crs[1]],\r\n this._header.extent[this._xyz2crs[2]]];\r\n }\r\n\r\n _getVolumeInfo() {\r\n const volInfo = _.pick(this._header, ['dmean', 'dmin', 'dmax', 'sd', 'delta']);\r\n volInfo.obtuseAngle = this._header.angles.map((angle) => Number(angle >= (Math.PI / 2)));\r\n return volInfo;\r\n }\r\n\r\n _setBoxParams(xaxis, yaxis, zaxis) {\r\n // if axes are not orthogonal, the origins might not match with box coordinates - need to make shift\r\n let shiftX = 0;\r\n let shiftY = 0;\r\n const [alpha, beta, gamma] = this._header.angles;\r\n\r\n if (gamma >= Math.PI / 2) {\r\n shiftX += Math.abs(yaxis.x);\r\n }\r\n if (beta >= Math.PI / 2) {\r\n shiftX += Math.abs(zaxis.x);\r\n }\r\n if (alpha >= Math.PI / 2) {\r\n shiftY += Math.abs(zaxis.y);\r\n }\r\n\r\n this._boxStart = new THREE.Vector3(this._origin.x - shiftX, this._origin.y - shiftY, this._origin.z);\r\n this._boxSize = new THREE.Vector3(\r\n Math.abs(xaxis.x) + Math.abs(yaxis.x) + Math.abs(zaxis.x),\r\n Math.abs(yaxis.y) + Math.abs(zaxis.y),\r\n Math.abs(zaxis.z),\r\n );\r\n\r\n const delta = (axe, proj) => (Math.abs(axe[proj]) / this._boxSize[proj]);\r\n this._header.delta.x = delta(yaxis, 'x');\r\n this._header.delta.y = delta(zaxis, 'x');\r\n this._header.delta.z = delta(zaxis, 'y');\r\n }\r\n\r\n _getXYZbox() {\r\n return new THREE.Box3(this._boxStart.clone(), this._boxStart.clone().add(this._boxSize));\r\n }\r\n\r\n _toXYZData() {}\r\n\r\n parse(data) {\r\n this._parseHeader(data);\r\n this._setOrigins();\r\n return new Volume(Float32Array, this._getXYZdim(), this._getXYZbox(), 1, this._toXYZData(), this._getVolumeInfo());\r\n }\r\n}\r\n\r\nexport default VolumeModel;\r\n","import Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\nconst CCP4Header = {\r\n extent: [valueType.array, 'u32', 0],\r\n type: [valueType.singular, 'u32', 3],\r\n nstart: [valueType.array, 'i32', 4],\r\n grid: [valueType.array, 'u32', 7],\r\n cellDims: [valueType.vector, 'f32', 10],\r\n angles: [valueType.array, 'f32', 13],\r\n crs2xyz: [valueType.array, 'i32', 16],\r\n dmin: [valueType.singular, 'f32', 19],\r\n dmax: [valueType.singular, 'f32', 20],\r\n dmean: [valueType.singular, 'f32', 21],\r\n ispg: [valueType.singular, 'u32', 22],\r\n nsymbt: [valueType.singular, 'u32', 23],\r\n lksflg: [valueType.singular, 'u32', 24],\r\n customData: [valueType.buffer, 'buffer', 25, 9],\r\n origin: [valueType.vector, 'f32', 34],\r\n map: [valueType.buffer, 'buffer', 52, 1],\r\n machine: [valueType.singular, 'u32', 53],\r\n sd: [valueType.singular, 'f32', 54],\r\n nlabel: [valueType.singular, 'f32', 55],\r\n label: [valueType.buffer, 'buffer', 56, 200],\r\n};\r\n\r\nclass Ccp4Model extends VolumeModel {\r\n // read header (http://www.ccp4.ac.uk/html/maplib.html)\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n const arrays = {};\r\n arrays.u32 = new Uint32Array(this._buff, 0, 56);\r\n arrays.i32 = new Int32Array(this._buff, 0, 56);\r\n arrays.f32 = new Float32Array(this._buff, 0, 56);\r\n arrays.buffer = this._buff;\r\n const header = this._header;\r\n\r\n this._fillHeader(CCP4Header, arrays);\r\n\r\n // calculate non-orthogonal unit cell coordinates\r\n header.angles.forEach((angle, i, a) => { a[i] *= Math.PI / 180.0; });\r\n }\r\n\r\n _setAxisIndices() {\r\n const header = this._header;\r\n\r\n if (header.cellDims.x === 0.0 && header.cellDims.y === 0.0 && header.cellDims.z === 0.0) {\r\n header.cellDims.set(1.0, 1.0, 1.0);\r\n }\r\n // Apply header conversion\r\n // Mapping between CCP4 column, row, section and VMD x, y, z.\r\n const { crs2xyz } = this._header;\r\n if (crs2xyz[0] === 0 && crs2xyz[1] === 0 && crs2xyz[2] === 0) {\r\n crs2xyz[0] = 1;\r\n crs2xyz[1] = 2;\r\n crs2xyz[2] = 3;\r\n }\r\n\r\n const xyz2crs = this._xyz2crs;\r\n xyz2crs[crs2xyz[0] - 1] = 0; // column\r\n xyz2crs[crs2xyz[1] - 1] = 1; // row\r\n xyz2crs[crs2xyz[2] - 1] = 2; // section\r\n }\r\n\r\n\r\n _setOrigins() {\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n const header = this._header;\r\n const xyz2crs = this._xyz2crs;\r\n // Handle both MRC-2000 and older format maps\r\n if (header.origin.x === 0.0 && header.origin.y === 0.0 && header.origin.z === 0.0) {\r\n this._origin.addScaledVector(xaxis, header.nstart[xyz2crs[0]]);\r\n this._origin.addScaledVector(yaxis, header.nstart[xyz2crs[1]]);\r\n this._origin.addScaledVector(zaxis, header.nstart[xyz2crs[2]]);\r\n } else {\r\n this._origin = header.origin;\r\n // Use ORIGIN records rather than old n[xyz]start records\r\n // http://www2.mrc-lmb.cam.ac.uk/image2000.html\r\n // XXX the ORIGIN field is only used by the EM community, and\r\n // has undefined meaning for non-orthogonal maps and/or non-cubic voxels, etc.\r\n }\r\n xaxis.multiplyScalar(header.extent[xyz2crs[0]] - 1);\r\n yaxis.multiplyScalar(header.extent[xyz2crs[1]] - 1);\r\n zaxis.multiplyScalar(header.extent[xyz2crs[2]] - 1);\r\n\r\n if (header.type === 2) {\r\n this._data = new Float32Array(\r\n this._buff,\r\n 1024 + header.nsymbt,\r\n header.extent[0] * header.extent[1] * header.extent[2],\r\n );\r\n } else {\r\n throw new Error(`CCP4: Unsupported format ${header.type}`);\r\n }\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const data = this._data;\r\n const xyz2crs = this._xyz2crs;\r\n const xyzData = new Float32Array(data.length);\r\n\r\n const dim = this._getXYZdim();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n\r\n let crsIdx = 0;\r\n const coord = [];\r\n let x;\r\n let y;\r\n let z;\r\n for (coord[2] = 0; coord[2] < header.extent[2]; coord[2]++) { // Site\r\n for (coord[1] = 0; coord[1] < header.extent[1]; coord[1]++) { // Row\r\n for (coord[0] = 0; coord[0] < header.extent[0]; coord[0]++, crsIdx++) { // Column\r\n x = coord[xyz2crs[0]];\r\n y = coord[xyz2crs[1]];\r\n z = coord[xyz2crs[2]];\r\n xyzData[x + xSize * (y + ySize * z)] = data[crsIdx];\r\n }\r\n }\r\n }\r\n\r\n return xyzData;\r\n }\r\n}\r\n\r\nclass CCP4Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'ccp4';\r\n this.model = new Ccp4Model();\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false; // Autodetection is not implemented yet\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nCCP4Parser.formats = ['ccp4'];\r\nCCP4Parser.extensions = ['.ccp4', '.map', '.mrc'];\r\nCCP4Parser.binary = true;\r\n\r\nexport default CCP4Parser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element, Molecule } = chem;\r\n\r\nclass XYZParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n this._options.fileType = 'xyz';\r\n this._fileName = options.name;\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*\\d+ *\\n[^\\n]*\\n\\s*\\w{1,3}\\s+-?\\d/.test(data);\r\n }\r\n\r\n _parseToAtomsInf(source) {\r\n const endnAtoms = source.indexOf('\\n');\r\n const nAtoms = parseInt(source.substring(0, endnAtoms), 10);\r\n const endComment = source.indexOf('\\n', endnAtoms + 1);\r\n let comment = source.slice(endnAtoms + 1, endComment).trim();\r\n if (comment.length === 0) {\r\n comment = this._fileName;\r\n }\r\n\r\n const startAtomsInf = endComment + source.substring(endComment).search(/\\S/);\r\n this._atomsInf = source.substring(startAtomsInf).split(/[\\s,]*\\n[\\s,]*/);\r\n if (!Number.isNaN(nAtoms) && (this._atomsInf.length - 1 !== nAtoms)) {\r\n this._complex.error = {\r\n message: 'wrong number of atoms',\r\n };\r\n return;\r\n }\r\n\r\n this._complex.metadata.format = 'xyz';\r\n this._complex.name = comment;\r\n }\r\n\r\n _parseAtomsInf() {\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n\r\n const chain = this._complex.addChain('A');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0; i < this._atomsInf.length - 1; i++) {\r\n const words = this._atomsInf[i].split(/[\\s,]+/);\r\n\r\n if (words.length !== 4) {\r\n this._complex.error = {\r\n message: 'missed parameters',\r\n };\r\n break;\r\n }\r\n\r\n const serial = i + 1;\r\n const name = words[0];\r\n const xyz = new THREE.Vector3(parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3]));\r\n const type = Element.getByName(name);\r\n const role = undefined;\r\n\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n const molecule = new Molecule(this._complex, this._complex.name, 1);\r\n molecule.residues = residue;\r\n this._complex._molecules[0] = molecule;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n\r\n this._parseToAtomsInf(this._data);\r\n this._parseAtomsInf();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n return result;\r\n }\r\n\r\n static formats = ['xyz'];\r\n\r\n static extensions = ['.xyz'];\r\n}\r\n\r\nexport default XYZParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element } = chem;\r\n\r\nclass PubChemParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'pubchem+json';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && data[0] === '{';\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing PubChem JSON file...');\r\n return this._toComplex(JSON.parse(this._data));\r\n }\r\n\r\n _toComplex(jsonData) {\r\n const complex = new Complex();\r\n const complexData = jsonData.PC_Compounds && jsonData.PC_Compounds[0];\r\n if (complexData) {\r\n this._extractAtoms(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n }\r\n return complex;\r\n }\r\n\r\n _extractAtoms(complex, complexData) {\r\n let aids = complexData.atoms && complexData.atoms.aid;\r\n let elements = aids && complexData.atoms.element;\r\n if (!elements || aids.length !== elements.length) {\r\n throw new Error('Unable to parse atom elements');\r\n }\r\n elements = _.fromPairs(_.zip(aids, elements));\r\n const atoms = {};\r\n\r\n const coords = complexData.coords && complexData.coords[0];\r\n const model = coords && coords.conformers && coords.conformers[0];\r\n const xs = model && model.x;\r\n const ys = model && model.y;\r\n const zs = (model && model.z) || [];\r\n aids = coords && coords.aid;\r\n if (!aids || !xs || !ys) {\r\n throw new Error('Coordinates are not found in the file');\r\n }\r\n\r\n const chain = complex.addChain(' ');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0, n = aids.length; i < n; ++i) {\r\n const aid = aids[i];\r\n const element = Element.ByAtomicNumber[elements[aid]];\r\n const xyz = new THREE.Vector3(xs[i], ys[i], zs[i] || 0.0);\r\n atoms[aid] = residue.addAtom(element.name, element, xyz, undefined, true, aid, ' ', 1.0, 0.0, 0);\r\n }\r\n\r\n const aids1 = complexData.bonds && complexData.bonds.aid1;\r\n const aids2 = complexData.bonds && complexData.bonds.aid2;\r\n const orders = (complexData.bonds && complexData.bonds.order) || [];\r\n if (!aids1 || !aids2 || aids1.length !== aids2.length) {\r\n return;\r\n }\r\n\r\n for (let j = 0, m = aids1.length; j < m; ++j) {\r\n complex.addBond(atoms[aids1[j]], atoms[aids2[j]], orders[j] || 1, 0, true);\r\n }\r\n }\r\n}\r\n\r\n\r\nPubChemParser.formats = ['pubchem', 'pubchem+json', 'pc'];\r\nPubChemParser.extensions = ['.json'];\r\n\r\nexport default PubChemParser;\r\n","import _ from 'lodash';\r\n\r\nexport default class SDFStream {\r\n constructor(data) {\r\n this._strings = data.split(/\\r?\\n|\\r/);\r\n this._currentStart = 0;\r\n this._currentStringIndx = 0;\r\n }\r\n\r\n setStart(start) {\r\n if (start >= this._strings.length) {\r\n this._currentStart = this._strings.length - 1;\r\n this._currentStringIndx = this._strings.length - 1;\r\n } else {\r\n this._currentStart = start;\r\n this._currentStringIndx = start;\r\n }\r\n }\r\n\r\n getNextString() {\r\n return this._strings[++this._currentStringIndx];\r\n }\r\n\r\n getCurrentString() {\r\n return this._strings[this._currentStringIndx];\r\n }\r\n\r\n getStringFromStart(numb) {\r\n this._currentStringIndx = this._currentStart + numb;\r\n return this._strings[this._currentStart + numb];\r\n }\r\n\r\n findNextDataItem() {\r\n let curStr = this.getNextString();\r\n let res = false;\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n if (curStr.match(/>\\s+<(.*)>/)) {\r\n res = true;\r\n break;\r\n }\r\n curStr = this.getNextString();\r\n }\r\n\r\n return res;\r\n }\r\n\r\n findNextCompoundStart() {\r\n let curStr = this.getCurrentString();\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n curStr = this.getNextString();\r\n }\r\n this.setStart(++this._currentStringIndx);\r\n return this.probablyHaveDataToParse();\r\n }\r\n\r\n probablyHaveDataToParse() {\r\n return this._currentStringIndx < this._strings.length - 2;\r\n }\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport SDFStream from './SDFStream';\r\nimport Assembly from '../../chem/Assembly';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst chargeMap = [0, 3, 2, 1, 0, -1, -2, -3];\r\nconst orderMap = [0, 1, 2, 3, 1, 1, 1, 2];\r\nconst typeMap = [\r\n Bond.BondType.UNKNOWN, // 0 - error\r\n Bond.BondType.COVALENT, // 1 - single\r\n Bond.BondType.COVALENT, // 2 - double\r\n Bond.BondType.COVALENT, // 3 - triple\r\n Bond.BondType.AROMATIC, // 4 - aromatic\r\n Bond.BondType.UNKNOWN, // 5 - single or double\r\n Bond.BondType.AROMATIC, // 6 - single or aromatic\r\n Bond.BondType.AROMATIC, // 7 - double or aromatic\r\n // 8 - any\r\n // 9 - coordination\r\n // 10 - hydrogen\r\n];\r\n\r\nconst sdfAndMolRegexp = /.*(M\\s\\sEND).*|.*(^$$$$).*|.*>\\s+<(.+)>.*/;\r\nconst sdfRegExp = /.*($$$$).*|.*>\\s+<(.+)>.*/;\r\n\r\nconst fileFormat = { SDF: 'sdf', MOL: 'mol' };\r\n\r\nconst possibleNameTags = ['PUBCHEM_IUPAC_TRADITIONAL_NAME', /PUBCHEM_(.+)_NAME/, /(.+)name/, /(.+)NAME/];\r\nconst possibleIDTags = ['PUBCHEM_COMPOUND_CID', 'id', 'ID', /.*CID/, /.*ID/, /.*id/];\r\nconst possibleTitleTags = ['msg', 'MSG', 'message', 'title', 'description', 'desc'];\r\nconst tagsNames = ['name', 'id', 'title'];\r\nconst tags = { name: possibleNameTags, id: possibleIDTags, title: possibleTitleTags };\r\n\r\nfunction buildChainID(index) {\r\n if (!index) {\r\n return 'A';\r\n }\r\n\r\n const codes = [];\r\n while (index) {\r\n codes.push(65 + (index % 26));\r\n index = Math.trunc(index / 26);\r\n }\r\n if (codes.length > 1) {\r\n codes.reverse();\r\n codes[0] -= 1;\r\n }\r\n\r\n return String.fromCharCode(...codes);\r\n}\r\n\r\nexport default class SDFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._format = 'sdf';\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._molecules = null;\r\n this._metadata = {};\r\n this._metadata.molecules = [];\r\n this._currentMolProps = {};\r\n this._compoundIndx = -1;\r\n this._assemblies = [];\r\n this._atomsParsed = 0;\r\n this._atomsIndexes = [];\r\n }\r\n\r\n canProbablyParse(data) {\r\n return _.isString(data) && sdfAndMolRegexp.test(data);\r\n }\r\n\r\n _parseHeader(stream) {\r\n const molecule = {};\r\n molecule.name = stream.getStringFromStart(0);\r\n const date = parseInt(stream.getStringFromStart(1).substr(10, 6).trim(), 10);\r\n molecule.date = date.toString() || '';\r\n molecule.title = stream.getStringFromStart(2);\r\n this._metadata.molecules.push(molecule);\r\n }\r\n\r\n _parseAtoms(stream, atomsNum) {\r\n let curStr;\r\n let serial = this._atomsParsed;\r\n\r\n // each molecule = chain\\residue\r\n const chainID = buildChainID(this._compoundIndx);\r\n const resName = 'UNK';\r\n const resSeq = 1;\r\n\r\n this._chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = this._chain.addResidue(resName, resSeq, ' ');\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n curStr = stream.getNextString();\r\n serial++;\r\n const x = parseFloat(curStr.substr(0, 10));\r\n const y = parseFloat(curStr.substr(10, 10));\r\n const z = parseFloat(curStr.substr(20, 10));\r\n const charge = chargeMap[parseInt(curStr.substr(36, 3), 10)];\r\n const xyz = new THREE.Vector3(x, y, z);\r\n let name = curStr.substr(31, 3).trim().toUpperCase();\r\n const type = Element.getByName(name);\r\n if (!this._atomsIndexes[name]) {\r\n this._atomsIndexes[name] = 0;\r\n }\r\n this._atomsIndexes[name] += 1;\r\n name += this._atomsIndexes[name]; // every atom need to have unique name.\r\n\r\n this._residue.addAtom(name, type, xyz, undefined, true, serial, ' ', 1.0, 0.0, charge);\r\n }\r\n }\r\n\r\n _parseBonds(stream, bondsNum) {\r\n let curStr;\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n curStr = stream.getNextString();\r\n let atom1 = parseInt(curStr.substr(0, 3), 10) + this._atomsParsed;\r\n let atom2 = parseInt(curStr.substr(3, 3), 10) + this._atomsParsed;\r\n const bondType = parseInt(curStr.substr(6, 3), 10);\r\n\r\n if (atom1 > atom2) {\r\n [atom1, atom2] = [atom2, atom1];\r\n }\r\n this._complex.addBond(atom1, atom2,\r\n orderMap[bondType] || 1,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true);\r\n }\r\n }\r\n\r\n _parseMOL(stream) {\r\n this._compoundIndx++;\r\n\r\n this._parseHeader(stream);\r\n const countsLine = stream.getStringFromStart(3);\r\n const atomsNum = parseInt(countsLine.substr(0, 3), 10);\r\n const bondsNum = parseInt(countsLine.substr(3, 3), 10);\r\n this._parseAtoms(stream, atomsNum);\r\n this._parseBonds(stream, bondsNum);\r\n\r\n this._atomsParsed += atomsNum;\r\n\r\n this._metadata.molecules[this._compoundIndx]._residues = [];\r\n this._metadata.molecules[this._compoundIndx]._residues.push(this._residue);\r\n }\r\n\r\n _parseDataItem(stream) {\r\n const tag = stream.getCurrentString();\r\n\r\n let data = [];\r\n let curStr = stream.getNextString();\r\n\r\n // read data\r\n while (curStr.trim() !== '') {\r\n data.push(curStr);\r\n curStr = stream.getNextString();\r\n }\r\n if (data.length === 1) {\r\n [data] = data;\r\n }\r\n this._currentMolProps[tag.replace(/[<>]/g, '').trim()] = data;\r\n }\r\n\r\n _parseCompound(stream) {\r\n this._parseMOL(stream);\r\n\r\n // parse data items block\r\n if (this._format === fileFormat.SDF) {\r\n this._currentMolProps = {};\r\n while (stream.findNextDataItem()) {\r\n this._parseDataItem(stream);\r\n }\r\n if (Object.keys(this._currentMolProps).length !== 0) {\r\n const molecule = this._metadata.molecules[this._compoundIndx];\r\n molecule.props = this._currentMolProps;\r\n this._tryToUpdateMoleculeData(molecule);\r\n }\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n console.log('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _buildAssemblies() {\r\n const chains = this._complex._chains;\r\n\r\n if (chains.length === 1) {\r\n return this._assemblies;\r\n }\r\n\r\n for (let i = 0; i < chains.length; i++) {\r\n const assembly = new Assembly(this._complex);\r\n const matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n assembly.addChain(chains[i]._name);\r\n this._assemblies.push(assembly);\r\n }\r\n\r\n return this._assemblies;\r\n }\r\n\r\n _buildMolecules() {\r\n this._complex._molecules = [];\r\n const { molecules } = this._metadata;\r\n for (let i = 0; i < molecules.length; i++) {\r\n const molecule = new Molecule(this._complex, molecules[i].name, i + 1);\r\n molecule.residues = molecules[i]._residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n\r\n return this._complex._molecules;\r\n }\r\n\r\n _searchTag(tag, props) {\r\n for (let i = 0; i < props.length; i++) {\r\n if ((tag instanceof RegExp && tag.test(props[i].tag)) || tag === props[i].tag) {\r\n return props[i].data;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToFind(tagsList, props) {\r\n for (let j = 0; j < tagsList.length; j++) {\r\n const res = this._searchTag(tagsList[j], props);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToUpdateMoleculeData(molecule) {\r\n let res = false;\r\n for (let i = 0; i < tagsNames.length; i++) {\r\n const tagPossibleNames = tags[tagsNames[i]];\r\n const data = this._tryToFind(tagPossibleNames, molecule.props);\r\n if (data) {\r\n molecule[tagsNames[i]] = data;\r\n res = true;\r\n }\r\n }\r\n\r\n molecule.name = molecule.name || molecule.id;\r\n if (molecule.name.match(/^\\d+$/)) {\r\n molecule.name = `CID: ${molecule.name}`;\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _finalizeMetadata() {\r\n const { molecules } = this._metadata;\r\n const { metadata } = this._complex;\r\n const complex = this._complex;\r\n\r\n if (molecules.length === 1) {\r\n complex.name = molecules[0].name;\r\n metadata.title = molecules[0].title;\r\n metadata.date = molecules[0].date;\r\n metadata.properties = molecules[0].props;\r\n } else if (molecules.length > 1) {\r\n metadata.molecules = [];\r\n for (let i = 0; i < molecules.length; i++) {\r\n metadata.molecules.push({\r\n name: molecules[i].name, date: molecules[i].date, title: molecules[i].title, properties: molecules[i].props,\r\n });\r\n }\r\n }\r\n }\r\n\r\n _finalize() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n this._complex._finalizeBonds();\r\n this._fixBondsArray();\r\n this._finalizeMetadata();\r\n this._buildAssemblies();\r\n this._complex.units = this._complex.units.concat(this._assemblies);\r\n this._buildMolecules();\r\n this._complex.finalize({\r\n needAutoBonding: false, detectAromaticLoops: false, enableEditing: false, serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n defineFormat(data) {\r\n let format;\r\n if (sdfRegExp.test(data)) {\r\n format = fileFormat.SDF;\r\n } else {\r\n format = fileFormat.MOL;\r\n }\r\n\r\n return format;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const stream = new SDFStream(this._data);\r\n\r\n this._format = this.defineFormat(this._data);\r\n result.metadata.format = this._format;\r\n\r\n do {\r\n this._parseCompound(stream);\r\n } while (stream.findNextCompoundStart());\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nSDFParser.formats = ['mol', 'sdf'];\r\nSDFParser.extensions = ['.mol', '.sdf'];\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\n// http://www.uoxray.uoregon.edu/tnt/manual/node104.html\r\nconst DSN6Header = {\r\n nstart: [valueType.array, 'i16', 0],\r\n extent: [valueType.array, 'i16', 3],\r\n grid: [valueType.array, 'i16', 6],\r\n cellDims: [valueType.vector, 'i16', 9],\r\n angles: [valueType.array, 'i16', 12],\r\n div: [valueType.singular, 'i16', 15],\r\n adder: [valueType.singular, 'i16', 16],\r\n scaleFactor: [valueType.singular, 'i16', 17],\r\n};\r\n\r\nclass DSN6Model extends VolumeModel {\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n\r\n const arrays = {};\r\n arrays.i16 = new Int16Array(this._buff);\r\n\r\n // check and reverse if big endian\r\n if (arrays.i16[18] !== 100) {\r\n for (let i = 0, n = arrays.i16.length; i < n; ++i) {\r\n const val = arrays.i16[i];\r\n arrays.i16[i] = ((val & 0xff) << 8) | ((val >> 8) & 0xff);\r\n }\r\n }\r\n if (arrays.i16[18] !== 100) {\r\n throw new Error('DSN6: Incorrect format ');\r\n }\r\n\r\n const header = this._header;\r\n\r\n this._fillHeader(DSN6Header, arrays);\r\n header.cellDims.multiplyScalar(1.0 / header.scaleFactor);\r\n header.angles.forEach((angle, i, a) => { a[i] *= (Math.PI / 180.0) / header.scaleFactor; });\r\n header.div /= 100;\r\n }\r\n\r\n _setAxisIndices() {\r\n this._xyz2crs[0] = 0;\r\n this._xyz2crs[1] = 1;\r\n this._xyz2crs[2] = 2;\r\n }\r\n\r\n _setOrigins() {\r\n const header = this._header;\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n this._origin.addScaledVector(xaxis, header.nstart[0]);\r\n this._origin.addScaledVector(yaxis, header.nstart[1]);\r\n this._origin.addScaledVector(zaxis, header.nstart[2]);\r\n\r\n xaxis.multiplyScalar(header.extent[0]);\r\n yaxis.multiplyScalar(header.extent[1]);\r\n zaxis.multiplyScalar(header.extent[2]);\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _pointCalculate(xyzData, byteBuffer, z, y, x, pos, i) {\r\n const header = this._header;\r\n\r\n if (x < header.extent[0] && y < header.extent[1] && z < header.extent[2]) {\r\n const idx = x + header.extent[0] * (y + header.extent[1] * z);\r\n xyzData[idx] = (byteBuffer[pos.counter] - header.adder) / header.div;\r\n ++pos.counter;\r\n } else {\r\n pos.counter += 8 - i;\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n _blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos) {\r\n for (let k = 0; k < 8; ++k) {\r\n const z = 8 * zBlock + k;\r\n for (let j = 0; j < 8; ++j) {\r\n const y = 8 * yBlock + j;\r\n let inRange = true;\r\n let i = 0;\r\n while (inRange && i < 8) {\r\n const x = 8 * xBlock + i;\r\n inRange = this._pointCalculate(xyzData, byteBuffer, z, y, x, pos, i);\r\n i++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const byteBuffer = new Uint8Array(this._buff);\r\n const xyzData = new Float32Array(header.extent[0] * header.extent[1] * header.extent[2]);\r\n\r\n const blocks = new THREE.Vector3(header.extent[0] / 8, header.extent[1] / 8, header.extent[2] / 8);\r\n\r\n const pos = {};\r\n pos.counter = 512;\r\n\r\n for (let zBlock = 0; zBlock < blocks.z; ++zBlock) {\r\n for (let yBlock = 0; yBlock < blocks.y; ++yBlock) {\r\n for (let xBlock = 0; xBlock < blocks.x; ++xBlock) {\r\n this._blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos);\r\n }\r\n }\r\n }\r\n this._calculateInfoParams(xyzData);\r\n return xyzData;\r\n }\r\n\r\n _calculateInfoParams(xyzData) {\r\n this._header.dmean /= xyzData.length;\r\n let dispersion = 0;\r\n let minDensity = xyzData[0];\r\n let maxDensity = xyzData[0];\r\n for (let j = 0; j < xyzData.length; j++) {\r\n dispersion += (this._header.dmean - xyzData[j]) ** 2;\r\n\r\n if (xyzData[j] < minDensity) {\r\n minDensity = xyzData[j];\r\n }\r\n if (xyzData[j] > maxDensity) {\r\n maxDensity = xyzData[j];\r\n }\r\n }\r\n this._header.sd = Math.sqrt(dispersion / xyzData.length);\r\n this._header.dmax = maxDensity;\r\n this._header.dmin = minDensity;\r\n }\r\n}\r\n\r\nclass DSN6Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'dsn6';\r\n this.model = new DSN6Model();\r\n }\r\n\r\n static canParse(data, options) {\r\n if (!data) {\r\n return false;\r\n }\r\n return data instanceof ArrayBuffer && Parser.checkDataTypeOptions(options, 'dsn6');\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false;\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nDSN6Parser.formats = ['dsn6'];\r\nDSN6Parser.extensions = ['.dsn6', '.omap'];\r\nDSN6Parser.binary = true;\r\n\r\nexport default DSN6Parser;\r\n","import PDBStream from './PDBStream';\r\n\r\n/**\r\n * Little helper class for GRO Parser usage.\r\n * @extends PDBStream\r\n */\r\nclass GROReader extends PDBStream {\r\n constructor(data) {\r\n super(data);\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n this.next();\r\n }\r\n\r\n /**\r\n * Getting end of string.\r\n * @returns {Number} Pointer to end of string\r\n */\r\n getNext() {\r\n return this._next;\r\n }\r\n}\r\n\r\nexport default GROReader;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport GROReader from './GROReader';\r\n\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Molecule,\r\n} = chem;\r\n\r\n/**\r\n * Gromos87 file format parser.\r\n * @extends Parser\r\n */\r\nclass GROParser extends Parser {\r\n /**\r\n * Create parser for .gro file format\r\n *\r\n * @param {String} data Input file\r\n * @param {String} options Input options (optional field)\r\n */\r\n constructor(data, options) {\r\n super(data, options);\r\n /** @type Date */\r\n this._time = null; // Time in ps, optional field for animations\r\n /** @type Number */\r\n this._numAtoms = null; // Number of atoms in complex\r\n /** @type Number */\r\n this._residueNumber = null; // Number of exact residue\r\n /** @type String */\r\n this._residueName = ''; // Scientific name of exact residue\r\n /** @type String */\r\n this._atomName = ''; // Scientific name of exact atom\r\n /** @type Number */\r\n this._atomNumber = null; // Sorted number of exact atom\r\n /** @type Array */\r\n this._atomPosition = []; // Array which contains x, y, z position of exact atom\r\n /** @type Array */\r\n this._atomVelocity = []; // Array which contains x, y, z velocity of exact atom (optional)\r\n /** @type Complex */\r\n this._complex = null; // Complex structure for unified molecule representation\r\n /** @type Vector3 */\r\n this._molecules = []; // Molecules array\r\n /** @type Molecule */\r\n this._molecule = null; // Single molecule\r\n /** @type String */\r\n this._options.filetype = 'gro'; // Extension of data file.\r\n }\r\n\r\n /**\r\n * General check for possibility of parsing.\r\n * @param {String} data - Input file\r\n * @returns {boolean} true if this file is in ascii, false otherwise\r\n */\r\n canProbablyParse(data) {\r\n return _.isString(this._data) && /^\\s*[^\\n]*\\n\\s*\\d+ *\\n\\s*\\d+[^\\n\\d]{3}\\s*\\w+\\s*\\d+\\s*-?\\d/.test(data);\r\n }\r\n\r\n /**\r\n * Parsing title of molecule complex.\r\n * NOTE: that names are ESTIMATES, there is no strict rules in Gromos87 standard for first line in input file.\r\n * @param {GROReader} line - Line containing title and time.\r\n */\r\n _parseTitle(line) {\r\n const { metadata } = this._complex;\r\n metadata.id = line.readLine().trim();\r\n metadata.name = metadata.id.slice(metadata.id.lastIndexOf('\\\\') + 1, metadata.id.lastIndexOf('.'));\r\n metadata.format = 'gro';\r\n }\r\n\r\n /**\r\n * Parsing line containing number of atoms information.\r\n * @param {GROReader} line - Line containing number of atoms.\r\n */\r\n _parseNumberOfAtoms(line) {\r\n this._numAtoms = line.readInt(0, line.getNext());\r\n if (Number.isNaN(this._numAtoms)) {\r\n throw new Error('Line 2 is not representing atom number. Consider checking input file');\r\n }\r\n }\r\n\r\n /**\r\n * Parsing line containing information about residues, atoms etc. Also information about box vectors.\r\n * Format of atoms MUST (by Gromos87 standard) be this: (note that numbering starts not from 0, but from 1!)\r\n * ResidueNumber[1 - 5] ResidueName[6 - 10] AtomName[11 - 15] AtomNumber[16 - 20] Position[21 - 45] Velocity[46 - 69]\r\n * @param {GROReader} line - Line containing information about atom.\r\n */\r\n _parseAtom(line) {\r\n this._residueNumber = line.readInt(1, 5);\r\n this._residueName = line.readString(6, 10).trim();\r\n this._atomName = line.readString(11, 15).trim();\r\n this._atomNumber = line.readInt(16, 20);\r\n const positionX = line.readFloat(21, 28) * 10;\r\n const positionY = line.readFloat(29, 36) * 10;\r\n const positionZ = line.readFloat(37, 45) * 10;\r\n if (Number.isNaN(positionX) || Number.isNaN(positionY) || Number.isNaN(positionZ)) {\r\n this._complex.error = {\r\n message: `Atom position is invalid in \"${line.readLine()}\"`,\r\n };\r\n return;\r\n }\r\n /* const velocityX = line.readFloat(46, 53);\r\n const velocityY = line.readFloat(54, 61);\r\n const velocityZ = line.readFloat(62, 69); */\r\n /* Adding residue and atom to complex structure */\r\n const type = Element.getByName(this._atomName[0]); /* MAGIC 0. REASONS: This name is something like \"CA\", where\r\n C - is an element an A is something else. But what about Calcium? */\r\n if (type.fullName === 'Unknown') {\r\n this._complex.error = {\r\n message: `${this._atomName[0]} hasn't been recognised as an atom name.`,\r\n };\r\n return;\r\n }\r\n const role = Element.Role[this._atomName];\r\n /* Firstly, create a dummy chain */\r\n let chain = this._chain;\r\n if (!chain) {\r\n this._chain = chain = this._complex.addChain('A');\r\n }\r\n /* Secondly, add residue to that chain */\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== this._residueNumber) {\r\n this._residue = residue = chain.addResidue(this._residueName, this._residueNumber, ' ');\r\n }\r\n /* Lastly, add atom to that residue */\r\n this._atomPosition = new THREE.Vector3(positionX, positionY, positionZ);\r\n /* Adding default constants to correct atom addition process */\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n residue.addAtom(this._atomName, type, this._atomPosition, role, het, this._atomNumber, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n /**\r\n * Some finalizing procedures. In '.gro' file format there is only 1 chain and 1 molecule.\r\n */\r\n _finalize() {\r\n const molecule = new Molecule(this._complex, this._complex.metadata.name, 1);\r\n // aggregate residues from chain\r\n molecule.residues = this._chain._residues;\r\n molecule._chains = this._chain;\r\n this._complex._molecules[0] = molecule;\r\n this._molecules.push(molecule);\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n /**\r\n * Main parsing procedure.\r\n * @returns {Complex} Complex structure for visualizing.\r\n */\r\n parseSync() {\r\n /* Create \"Complex\" variable */\r\n const result = this._complex = new Complex();\r\n /* Parse input file line-by-line */\r\n const reader = new GROReader(this._data);\r\n let counter = 0; /* Simple counter regarding to format of .gro file */\r\n /* First two lines - technical information, other lines - Atoms */\r\n this._parseTitle(reader);\r\n reader.next();\r\n this._parseNumberOfAtoms(reader);\r\n reader.next();\r\n for (counter = 0; counter < this._numAtoms; ++counter) {\r\n if (!reader.end()) {\r\n this._parseAtom(reader);\r\n reader.next();\r\n } else break;\r\n }\r\n /* If number of atoms in second line is less then actual atoms in file */\r\n if (counter < this._numAtoms) {\r\n this._complex.error = {\r\n message: 'File ended unexpectedly.',\r\n };\r\n }\r\n /* Catch errors occurred in parsing process */\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n\r\n /* Finalizing data */\r\n this._finalize();\r\n\r\n /* Cleaning up */\r\n this._atomPosition = null;\r\n this._complex = null;\r\n this._molecules = null;\r\n this._molecule = null;\r\n\r\n /* Return resulting Complex variable */\r\n return result;\r\n }\r\n}\r\n\r\nGROParser.formats = ['gro'];\r\nGROParser.extensions = ['.gro'];\r\n\r\nexport default GROParser;\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst orderMap = {\r\n un: 0,\r\n 1: 1,\r\n 2: 2,\r\n 3: 3,\r\n ar: 1,\r\n am: 1,\r\n nc: 0,\r\n du: 1,\r\n};\r\nconst typeMap = {\r\n un: Bond.BondType.UNKNOWN, // unknown (cannot be determined from the parameter tables)\r\n 1: Bond.BondType.COVALENT, // single\r\n 2: Bond.BondType.COVALENT, // double\r\n 3: Bond.BondType.COVALENT, // triple\r\n ar: Bond.BondType.AROMATIC, // aromatic\r\n am: Bond.BondType.COVALENT, // amide\r\n nc: Bond.BondType.UNKNOWN, // not connected\r\n du: Bond.BondType.COVALENT, // dummy\r\n};\r\n\r\nconst resNumberRegex = /\\d+$/;\r\nconst spacesRegex = /\\s+/;\r\n\r\nfunction splitToFields(str) {\r\n return str.trim().split(spacesRegex);\r\n}\r\n/* There is no jsdoc documentation because of eslint corrections:\r\n * not all Parser methods are implemented\r\n */\r\n\r\nclass MOL2Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._compoundIndx = -1;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n\r\n this._currPosIdx = 0;\r\n this._currStartIdx = 0;\r\n\r\n this._serialAtomMap = {};\r\n\r\n this._options.fileType = 'mol2';\r\n }\r\n\r\n _parseRawStrings(data) {\r\n return data.split(/\\r?\\n|\\r/);\r\n }\r\n\r\n _toStringFromStart(numb, MOL2Data) {\r\n const newPosIdx = this._currStartIdx + numb;\r\n this._currPosIdx = (newPosIdx < MOL2Data.length) ? newPosIdx : this._currStartIdx;\r\n }\r\n\r\n _toHeaderString(header, MOL2Data) {\r\n this._toStringFromStart(0, MOL2Data);\r\n while (this._currPosIdx < MOL2Data.length) {\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`)) {\r\n return;\r\n }\r\n this._currPosIdx++;\r\n }\r\n this._toStringFromStart(0, MOL2Data);\r\n }\r\n\r\n _toStringFromHeader(header, numb, MOL2Data) {\r\n this._toHeaderString(header, MOL2Data);\r\n const newPosIdx = this._currPosIdx + numb;\r\n\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`) && newPosIdx < MOL2Data.length) {\r\n this._currPosIdx = newPosIdx;\r\n }\r\n }\r\n\r\n _setStart(startPos, MOL2Data) {\r\n if (startPos >= MOL2Data.length) {\r\n this._currStartIdx = this._currPosIdx = MOL2Data.length - 1;\r\n } else {\r\n this._currStartIdx = this._currPosIdx = startPos;\r\n }\r\n }\r\n\r\n _probablyHaveDataToParse(MOL2Data) {\r\n return this._currPosIdx < MOL2Data.length - 2;\r\n }\r\n\r\n _findNextCompoundStart(MOL2Data) {\r\n while (this._currPosIdx < MOL2Data.length && MOL2Data[this._currPosIdx].trim() !== '@MOLECULE>') {\r\n this._currPosIdx++;\r\n }\r\n this._setStart(++this._currPosIdx, MOL2Data);\r\n return this._probablyHaveDataToParse(MOL2Data);\r\n }\r\n\r\n _parseMolecule(MOL2Data) {\r\n this._toHeaderString('MOLECULE', MOL2Data);\r\n\r\n const { metadata } = this._complex;\r\n metadata.name = MOL2Data[++this._currPosIdx];\r\n metadata.format = 'mol2';\r\n\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = this._compoundIndx + 1;\r\n this._molecules.push(this._molecule);\r\n }\r\n\r\n /* Atom format description:\r\n * atomId atomName x y z element [resSeq [resName [charge [statusBit]]]]\r\n * statusBits is the internal SYBYL status bits associated with the atom.\r\n * These should never be set by the user.\r\n * Source: http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf\r\n */\r\n _parseAtoms(atomsNum, MOL2Data) {\r\n this._toHeaderString('ATOM', MOL2Data);\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 6) {\r\n throw new Error('MOL2 parsing error: Not enough information to create atom!');\r\n }\r\n const atomId = parseInt(parsedStr[0], 10);\r\n const atomName = parsedStr[1];\r\n\r\n const x = parseFloat(parsedStr[2]);\r\n const y = parseFloat(parsedStr[3]);\r\n const z = parseFloat(parsedStr[4]);\r\n\r\n const element = parsedStr[5].split('.')[0].toUpperCase();\r\n\r\n let charge = 0;\r\n if (parsedStr.length >= 9) {\r\n charge = parseFloat(parsedStr[8]) || 0.0;\r\n }\r\n\r\n let chain = this._chain;\r\n if (!chain) {\r\n // .mol2 may contain information about multiple molecules, but they can't be visualized\r\n // at the same time now. There is no need to create different chain IDs then.\r\n this._chain = chain = this._complex.getChain('A') || this._complex.addChain('A');\r\n this._residue = null;\r\n }\r\n if (!this._setResidue(parsedStr)) {\r\n continue;\r\n }\r\n\r\n // These fields are not listed in mol2 format. Set them default.\r\n // Atoms and het atoms doesn't differ in .mol2,\r\n // but het atoms have special residues. It can be used in next updates\r\n const het = false;\r\n const altLoc = ' ';\r\n const occupancy = 1.0;\r\n const tempFactor = 0.0;\r\n const type = Element.getByName(element);\r\n const role = Element.Role[atomName];\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n this._residue.addAtom(atomName, type, xyz, role, het, atomId, altLoc, occupancy, tempFactor, charge);\r\n }\r\n }\r\n\r\n _setResidue(parsedStr) {\r\n let resSeq = 1;\r\n let resName = 'UNK'; // The same meaning has '<0>' in some mol2 files\r\n\r\n if (parsedStr.length >= 7) {\r\n resSeq = parseInt(parsedStr[6], 10);\r\n }\r\n if (parsedStr.length >= 8 && parsedStr[7] !== '<0>') {\r\n resName = parsedStr[7].replace(resNumberRegex, '');\r\n }\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return false;\r\n }\r\n }\r\n const residue = this._residue;\r\n const chain = this._chain;\r\n if (!residue || residue.getSequence() !== resSeq) {\r\n this._residue = chain.addResidue(resName, resSeq, 'A');\r\n }\r\n return true;\r\n }\r\n\r\n /* Bond format description\r\n * bondId originAtomId targetAtomId bondType [statusBits]\r\n */\r\n _parseBonds(bondsNum, MOL2Data) {\r\n this._toHeaderString('BOND', MOL2Data);\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 3) {\r\n throw new Error('MOL2 parsing error: Missing information about bonds!');\r\n }\r\n\r\n let originAtomId = parseInt(parsedStr[1], 10);\r\n let targetAtomId = parseInt(parsedStr[2], 10);\r\n const bondType = parsedStr[3];\r\n\r\n if (originAtomId > targetAtomId) {\r\n [originAtomId, targetAtomId] = [targetAtomId, originAtomId];\r\n }\r\n this._complex.addBond(originAtomId, targetAtomId,\r\n orderMap[bondType] || 0,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true);\r\n }\r\n }\r\n\r\n _fixSerialAtoms() {\r\n const atoms = this._complex._atoms;\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n this._serialAtomMap[atom.serial] = atom;\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n if (Object.keys(serialAtomMap).length === 0) {\r\n throw new Error('MOL2 parsing error: Missing atom information!');\r\n }\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _finalizeMolecules() {\r\n // Get chain from complex\r\n const chain = this._complex._chains[0];\r\n this._complex._molecules = [];\r\n\r\n // Aggregate residues from chains\r\n // (to be precise from the chain 'A')\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const currMolecule = this._molecules[i];\r\n const molResidues = chain._residues;\r\n const molecule = new Molecule(this._complex, currMolecule._name, i + 1);\r\n molecule.residues = molResidues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _finalize() {\r\n this._complex._finalizeBonds();\r\n this._fixSerialAtoms();\r\n this._fixBondsArray();\r\n this._finalizeMolecules();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _parseCompound(MOL2Data) {\r\n this._compoundIndx++;\r\n this._parseMolecule(MOL2Data);\r\n\r\n // Ignoring comments and everything before @MOLECULE block\r\n this._toStringFromHeader('MOLECULE', 2, MOL2Data);\r\n\r\n const parsedStr = MOL2Data[this._currPosIdx].trim().split(spacesRegex);\r\n const atomsNum = parsedStr[0];\r\n const bondsNum = parsedStr[1];\r\n\r\n this._parseAtoms(atomsNum, MOL2Data);\r\n this._parseBonds(bondsNum, MOL2Data);\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const MOL2Data = this._parseRawStrings(this._data);\r\n do {\r\n this._parseCompound(MOL2Data);\r\n } while (this._findNextCompoundStart(MOL2Data));\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nMOL2Parser.formats = ['mol2'];\r\nMOL2Parser.extensions = ['.mol2', '.ml2', '.sy2'];\r\n\r\nexport default MOL2Parser;\r\n","import ParserList from './parsers/ParserList';\r\n\r\nimport PDBParser from './parsers/PDBParser';\r\nimport CMLParser from './parsers/CMLParser';\r\nimport MMTFParser from './parsers/MMTFParser';\r\nimport CIFParser from './parsers/CIFParser';\r\nimport CCP4Parser from './parsers/CCP4Parser';\r\nimport XYZParser from './parsers/XYZParser';\r\nimport PubChemParser from './parsers/PubChemParser';\r\nimport SDFParser from './parsers/SDFParser';\r\nimport DSN6Parser from './parsers/DSN6Parser';\r\nimport GROParser from './parsers/GROParser';\r\nimport MOL2Parser from './parsers/MOL2Parser';\r\n\r\nexport default new ParserList([\r\n // note: order might be important\r\n PDBParser,\r\n CIFParser,\r\n MMTFParser,\r\n XYZParser,\r\n CMLParser,\r\n PubChemParser,\r\n SDFParser,\r\n CCP4Parser,\r\n DSN6Parser,\r\n GROParser,\r\n MOL2Parser,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available exporters.\r\n * @extends EntityList\r\n */\r\nclass ExporterList extends EntityList {\r\n /**\r\n * Create a list of exporters.\r\n * The exporters are indexed by supported data formats (`.formats` and\r\n * `.extensions` properties of a Exporter subclass).\r\n * The Exporters can be retrieved later by matching against specs (see {@link ExporterList#find}).\r\n *\r\n * @param {!Array=} someExporters A list of {@link Exporter} subclasses to\r\n * automatically register at creation time.\r\n * @see ExporterList#register\r\n */\r\n constructor(someExporters = []) {\r\n super(someExporters, ['formats']);\r\n }\r\n\r\n /**\r\n * Find a suitable exporter for data.\r\n *\r\n * @param {Object} specs Exporter specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {*=} specs.data Data to export.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ExporterList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Exporter {\r\n constructor(source, options) {\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n exportSync() {\r\n throw new Error('Exporting to this source is not implemented');\r\n }\r\n\r\n export() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Export aborted'));\r\n }\r\n return resolve(this.exportSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Exporter.prototype);\r\n","import _ from 'lodash';\r\nimport { Matrix4 } from 'three';\r\n\r\nexport default class PDBResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._currentStr = -1;\r\n this._tag = null;\r\n this._fixedNumeration = false;\r\n this._numeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n\r\n getResult() {\r\n this.writeString('\\n', 81, 81);\r\n return this._resultArray.join('');\r\n }\r\n\r\n _currentStrLength() {\r\n const curStr = this._resultArray[this._currentStr];\r\n return curStr ? curStr.length : 0;\r\n }\r\n\r\n // numeration can be number or boolean\r\n // if numeration is number then just put this number to 8-10 pos in string\r\n // if numeration is boolean then increase number for all new strings\r\n newTag(tag, numeration) {\r\n if (!tag) {\r\n this._tag = null;\r\n } else {\r\n this._tag = tag;\r\n }\r\n if (!_.isUndefined(numeration)) {\r\n if (_.isNumber(numeration)) {\r\n this._tagStrNum = numeration;\r\n this._numeration = true;\r\n this._fixedNumeration = true;\r\n } else if (_.isBoolean(numeration)) {\r\n this._tagStrNum = 0;\r\n this._numeration = numeration;\r\n this._fixedNumeration = false;\r\n }\r\n } else {\r\n this._numeration = false;\r\n this._fixedNumeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n }\r\n\r\n newString(tag) {\r\n this.writeString('\\n', 81, 81);\r\n this._currentStr++;\r\n this._resultArray.push('');\r\n\r\n if (tag) {\r\n this.writeString(tag, 1, 6);\r\n } else if (this._tag) {\r\n this.writeString(this._tag, 1, 6);\r\n }\r\n\r\n if (this._numeration) {\r\n if (!this._fixedNumeration) {\r\n this._tagStrNum++;\r\n }\r\n if (this._tagStrNum !== 1) {\r\n this.writeString(this._tagStrNum.toString(), 10, 8);\r\n }\r\n }\r\n }\r\n\r\n writeEntireString(string, maxStrPos, concat) {\r\n if (!maxStrPos) {\r\n maxStrPos = 81;\r\n }\r\n for (let j = 0; j < string.length; j++) {\r\n if (this._currentStrLength() === maxStrPos && j !== string.length - 1) {\r\n this.newString();\r\n if (concat) { // pretty hardcoddy\r\n this.writeString(concat.tag, concat.begin, concat.end);\r\n }\r\n }\r\n if (string[j] === '\\n') {\r\n this.newString();\r\n } else {\r\n this.writeString(string[j]);\r\n }\r\n }\r\n }\r\n\r\n writeString(string, begin, end) {\r\n let curStr = this._resultArray[this._currentStr];\r\n let str;\r\n\r\n const curStrLength = curStr ? curStr.length : 0;\r\n\r\n if (_.isUndefined(string)) {\r\n return;\r\n }\r\n\r\n if (!_.isNumber(begin)) {\r\n begin = curStrLength + 1;\r\n }\r\n\r\n if (!_.isNumber(end)) {\r\n end = curStrLength + string.length;\r\n }\r\n\r\n if (!_.isString(string)) {\r\n str = string.toString();\r\n } else {\r\n str = string;\r\n }\r\n\r\n const finish = begin < end ? end : begin;\r\n const start = begin < end ? begin : end;\r\n\r\n if (str.length > Math.abs(begin - end) + 1) {\r\n str = str.substr(0, Math.abs(begin - end + 1));\r\n }\r\n\r\n // spaces before start of new data\r\n if (start > curStrLength + 1) {\r\n this._resultArray[this._currentStr] += ' '.repeat(start - curStrLength - 1);\r\n } else if (start <= curStrLength) {\r\n const cStr = this._resultArray[this._currentStr];\r\n this._resultArray[this._currentStr] = cStr.slice(0, start - 1);\r\n }\r\n\r\n // if reverse order\r\n // reverse order of end and begin means that user wants to align text right\r\n if (end < begin) {\r\n const len = begin - end + 1;\r\n str = ' '.repeat(len - str.length) + str;\r\n }\r\n\r\n // some hardcode fix for space between string numeration and data\r\n // (see pdb file format description)\r\n if (start === 11 && this._numeration && this._tagStrNum !== 1) {\r\n str = ` ${str}`;\r\n }\r\n\r\n // append new data to string\r\n this._resultArray[this._currentStr] += str;\r\n curStr = this._resultArray[this._currentStr];\r\n\r\n if (finish > curStr.length) {\r\n this._resultArray[this._currentStr] += ' '.repeat(finish - curStr.length);\r\n }\r\n }\r\n\r\n writeBondsArray(bonds, atom) {\r\n const bondsArrays = this._getSubArrays(bonds, 4);\r\n\r\n for (let k = 0; k < bondsArrays.length; k++) {\r\n this.newString();\r\n this.writeString(atom.serial, 11, 7);\r\n\r\n for (let j = 0; j < bondsArrays[k].length; j++) {\r\n const serial = (bondsArrays[k][j]._left.serial === atom.serial)\r\n ? bondsArrays[k][j]._right.serial : bondsArrays[k][j]._left.serial;\r\n\r\n this.writeString(serial, 16 + 5 * j, 12 + 5 * j);\r\n }\r\n }\r\n }\r\n\r\n _getSubArrays(arr, subArraySize) {\r\n const subArrays = [];\r\n for (let i = 0; i < arr.length; i += subArraySize) {\r\n subArrays.push(arr.slice(i, i + subArraySize));\r\n }\r\n return subArrays;\r\n }\r\n\r\n // function for writing matrix in Remark290 and Remark350 tags\r\n // (see pdb file description)\r\n writeMatrix(matrix, matrixIndx, tag) {\r\n for (let j = 0; j < 3; j++) {\r\n this.newString();\r\n this.writeString(tag, 14, 18);\r\n this.writeString((j + 1).toString(), 19, 19);\r\n this.writeString(matrixIndx.toString(), 23, 20);\r\n for (let k = 0; k < 3; k++) {\r\n const numb = parseFloat(matrix.elements[j * 4 + k]).toFixed(6);\r\n this.writeString(numb.toString(), 33 + k * 10, 24 + k * 10);\r\n }\r\n\r\n const numb = parseFloat(matrix.elements[j * 4 + 3]).toFixed(5);\r\n this.writeString(numb.toString(), 68, 55);\r\n }\r\n }\r\n\r\n writeMatrices(matrices, string) {\r\n if (!matrices) {\r\n return;\r\n }\r\n const matrix = new Matrix4();\r\n for (let j = 0; j < matrices.length; j++) {\r\n matrix.copy(matrices[j]).transpose();\r\n this.writeMatrix(matrix, j + 1, string);\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport Complex from '../../chem/Complex';\r\nimport Exporter from './Exporter';\r\nimport PDBResult from './PDBResult';\r\nimport Assembly from '../../chem/Assembly';\r\nimport { typeByPDBHelixClass } from '../../chem/Helix';\r\n\r\nexport default class PDBExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n this._tags = ['HEADER', 'TITLE', 'COMPND', 'REMARK', 'HELIX', 'SHEET', 'ATOM and HETATM', 'CONECT'];\r\n this._result = null;\r\n this._tagExtractors = {\r\n HEADER: this._extractHEADER,\r\n TITLE: this._extractTITLE,\r\n 'ATOM and HETATM': this._extractATOM,\r\n CONECT: this._extractCONECT,\r\n COMPND: this._extractCOMPND,\r\n REMARK: this._extractREMARK,\r\n HELIX: this._extractHELIX,\r\n SHEET: this._extractSHEET,\r\n };\r\n this._stringForRemark350 = 'COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN\\n'\r\n + 'BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE\\n'\r\n + 'MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS\\n'\r\n + 'GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND\\n'\r\n + 'CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.';\r\n\r\n this._stringForRemark290 = 'CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS\\n'\r\n + 'THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM\\n'\r\n + 'RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY\\n'\r\n + 'RELATED MOLECULES.';\r\n }\r\n\r\n exportSync() {\r\n const result = new PDBResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n for (let i = 0; i < this._tags.length; i++) {\r\n const tag = this._tags[i];\r\n const func = this._tagExtractors[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, result);\r\n }\r\n }\r\n\r\n this._result = result.getResult();\r\n\r\n return this._result;\r\n }\r\n\r\n _extractHEADER(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n result.newTag('HEADER');\r\n result.newString();\r\n if (metadata.classification) {\r\n result.writeString(metadata.classification, 11, 50);\r\n }\r\n if (metadata.date) {\r\n result.writeString(metadata.date, 51, 59);\r\n }\r\n if (metadata.id) {\r\n result.writeString(metadata.id, 63, 66);\r\n }\r\n }\r\n\r\n _extractTITLE(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n if (!metadata.title) {\r\n return;\r\n }\r\n result.newTag('TITLE', true);\r\n for (let i = 0; i < metadata.title.length; i++) {\r\n result.newString();\r\n result.writeString(metadata.title[i], 11, 80);\r\n }\r\n }\r\n\r\n _extractCONECT(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n\r\n const atoms = this._source._atoms;\r\n result.newTag('CONECT');\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const fixedBonds = atoms[i].bonds.filter((bond) => bond._fixed);\r\n if (fixedBonds.length !== 0) {\r\n result.writeBondsArray(fixedBonds.reverse(), atoms[i]);\r\n }\r\n }\r\n }\r\n\r\n _extractSHEET(result) {\r\n if (!this._source._sheets) {\r\n return;\r\n }\r\n\r\n result.newTag('SHEET');\r\n\r\n const sheets = this._source._sheets;\r\n for (let i = 0; i < sheets.length; i++) {\r\n if (sheets[i]._strands) {\r\n const strands = sheets[i]._strands;\r\n for (let j = 0; j < strands.length; j++) {\r\n result.newString();\r\n result.writeString(j + 1, 10, 8);\r\n result.writeString(sheets[i]._name, 14, 12);\r\n result.writeString(strands.length, 16, 15);\r\n result.writeString(strands[j].init._type._name, 18, 20);\r\n result.writeString(strands[j].init._chain._name, 22, 22);\r\n result.writeString(strands[j].init._sequence, 26, 23);\r\n result.writeString(strands[j].init._icode, 27, 27);\r\n result.writeString(strands[j].term._type._name, 29, 31);\r\n result.writeString(strands[j].init._chain._name, 33, 33);\r\n result.writeString(strands[j].term._sequence, 37, 34);\r\n result.writeString(strands[j].term._icode, 38, 38);\r\n result.writeString(strands[j].sense, 40, 39);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _extractHELIX(result) {\r\n if (!this._source._helices) {\r\n return;\r\n }\r\n\r\n result.newTag('HELIX');\r\n const helices = this._source._helices;\r\n for (let i = 0; i < helices.length; i++) {\r\n const helix = helices[i];\r\n const helixClass = _.invert(typeByPDBHelixClass);\r\n result.newString();\r\n result.writeString(helix.serial, 10, 8);\r\n result.writeString(helix.name, 14, 12);\r\n result.writeString(helix.init._type._name, 16, 18);\r\n result.writeString(helix.init._chain._name, 20, 20);\r\n result.writeString(helix.init._sequence, 25, 22);\r\n result.writeString(helix.init._icode, 26, 26);\r\n result.writeString(helix.term._type._name, 28, 30);\r\n result.writeString(helix.term._chain._name, 32, 32);\r\n result.writeString(helix.term._sequence, 37, 34);\r\n result.writeString(helix.term._icode, 38, 38);\r\n result.writeString(helixClass[helix.type], 40, 39);\r\n result.writeString(helix.comment, 41, 70);\r\n result.writeString(helix.length, 76, 72);\r\n }\r\n }\r\n\r\n _extractATOM(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n const atoms = this._source._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const tag = atoms[i].het ? 'HETATM' : 'ATOM';\r\n result.newString(tag);\r\n const startIndx = (atoms[i].element.name.length > 1 || atoms[i].name.length > 3) ? 13 : 14;\r\n result.writeString(atoms[i].serial, 11, 7);\r\n result.writeString(atoms[i].name, startIndx, 16);\r\n result.writeString(String.fromCharCode(atoms[i].location), 17, 17);\r\n result.writeString(atoms[i].residue._type._name, 20, 18);\r\n result.writeString(atoms[i].residue._chain._name, 22, 22);\r\n result.writeString(atoms[i].residue._sequence, 26, 23);\r\n result.writeString(atoms[i].residue._icode, 27, 27);\r\n result.writeString(atoms[i].position.x.toFixed(3), 38, 31);\r\n result.writeString(atoms[i].position.y.toFixed(3), 46, 39);\r\n result.writeString(atoms[i].position.z.toFixed(3), 54, 47);\r\n result.writeString(atoms[i].occupancy.toFixed(2), 60, 55);\r\n result.writeString(atoms[i].temperature.toFixed(2), 66, 61);\r\n result.writeString(atoms[i].element.name, 78, 77);\r\n if (atoms[i].charge) {\r\n result.writeString(atoms[i].charge, 79, 80);\r\n }\r\n }\r\n }\r\n\r\n _extractCOMPND(result) {\r\n if (!this._source._molecules) {\r\n return;\r\n }\r\n const molecules = this._source._molecules;\r\n result.newTag('COMPND', true);\r\n\r\n for (let i = 0; i < molecules.length; i++) {\r\n const chains = this._getMoleculeChains(molecules[i]);\r\n result.newString();\r\n result.writeString(`MOL_ID: ${molecules[i].index};`, 11, 80);\r\n result.newString();\r\n result.writeString(`MOLECULE: ${molecules[i].name};`, 11, 80);\r\n result.newString();\r\n result.writeString('CHAIN: ', 11, 18);\r\n const chainsString = `${chains.join(', ')};`;\r\n result.writeEntireString(chainsString, 81);\r\n }\r\n }\r\n\r\n _extractREMARK(result) {\r\n this._Remark290(result);\r\n this._Remark350(result);\r\n }\r\n\r\n _Remark290(result) {\r\n if (!this._source.symmetry) {\r\n return;\r\n }\r\n\r\n if (this._source.symmetry.length !== 0) {\r\n const matrices = this._source.symmetry;\r\n result.newTag('REMARK', 290);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark290);\r\n result.writeMatrices(matrices, 'SMTRY');\r\n result.newString();\r\n result.newString();\r\n result.writeString('REMARK: NULL', 11, 80);\r\n }\r\n }\r\n\r\n _Remark350(result) {\r\n if (!this._source.units) {\r\n return;\r\n }\r\n const { units } = this._source;\r\n let biomolIndx = 0;\r\n\r\n result.newTag('REMARK', 350);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark350);\r\n\r\n const assemblies = units.filter((unit) => unit instanceof Assembly);\r\n\r\n for (let i = 0; i < assemblies.length; i++) {\r\n result.newString();\r\n result.newString();\r\n biomolIndx++;\r\n result.writeString(`BIOMOLECULE: ${biomolIndx}`, 11, 80);\r\n const chains = assemblies[i].chains.join(', ');\r\n result.newString();\r\n result.writeString('APPLY THE FOLLOWING TO CHAINS: ');\r\n result.writeEntireString(chains, 69, { tag: 'AND CHAINS: ', begin: 31, end: 42 });\r\n\r\n const { matrices } = assemblies[i];\r\n result.writeMatrices(matrices, 'BIOMT');\r\n }\r\n }\r\n\r\n _getMoleculeChains(molecule) {\r\n function getChainName(residue) {\r\n return residue._chain._name;\r\n }\r\n const chainNames = molecule.residues.map(getChainName);\r\n return chainNames.filter((item, pos) => chainNames.indexOf(item) === pos);\r\n }\r\n}\r\n\r\nPDBExporter.formats = ['pdb'];\r\nPDBExporter.SourceClass = Complex;\r\n","import * as THREE from 'three';\r\n\r\nconst FBX_POS_SIZE = 3;\r\nconst FBX_NORM_SIZE = 3;\r\nconst FBX_COL_SIZE = 4;\r\n\r\nfunction copyFbxPoint3(src, srcIdx, dst, dstIdx) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n}\r\n\r\nfunction copyFbxPoint4(src, srcIdx, dst, dstIdx, value) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n dst[dstIdx + 3] = value;\r\n}\r\n\r\nconst vector4 = new THREE.Vector4();\r\nfunction copyTransformedPoint3(src, srcIdx, dst, dstIdx, opts) {\r\n vector4.set(src[srcIdx], src[srcIdx + 1], src[srcIdx + 2], opts.w);\r\n vector4.applyMatrix4(opts.matrix);\r\n dst[dstIdx] = vector4.x;\r\n dst[dstIdx + 1] = vector4.y;\r\n dst[dstIdx + 2] = vector4.z;\r\n}\r\n\r\nfunction setSubArray(src, dst, count, copyFunctor, functorOpts) {\r\n if ((dst.array.length - dst.start) / dst.stride < count\r\n || (src.array.length - src.start) / src.stride < count) {\r\n return; // we've got no space\r\n }\r\n if (src.stride === dst.stride) { // stride is the same\r\n dst.array.set(src.array, dst.start);\r\n } else {\r\n let idx = dst.start;\r\n let arridx = src.start;\r\n for (let i = 0; i < count; ++i, idx += dst.stride, arridx += src.stride) {\r\n copyFunctor(src.array, arridx, dst.array, idx, functorOpts);\r\n }\r\n }\r\n}\r\n\r\nexport default class FBXModel {\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.lastPos = 0;\r\n this.lastNorm = 0;\r\n this.lastCol = 0;\r\n this.lastIdx = 0;\r\n }\r\n\r\n init(vertsCount, indsCount) {\r\n this.positions = new Float32Array(vertsCount * FBX_POS_SIZE);\r\n this.normals = new Float32Array(vertsCount * FBX_NORM_SIZE);\r\n this.colors = new Float32Array(vertsCount * FBX_COL_SIZE);\r\n this.indices = new Int32Array(indsCount);\r\n }\r\n\r\n setPositions(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.positions,\r\n start: this.lastPos,\r\n stride: FBX_POS_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setTransformedPositions(array, start, count, stride, matrix) {\r\n let idx = this.lastPos;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 1 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_POS_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.positions, idx, opts);\r\n }\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setNormals(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.normals,\r\n start: this.lastNorm,\r\n stride: FBX_NORM_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setTransformedNormals(array, start, count, stride, matrix) {\r\n let idx = this.lastNorm;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 0 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_NORM_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.normals, idx, opts);\r\n }\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setColors(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.colors,\r\n start: this.lastCol,\r\n stride: FBX_COL_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint4, 1);\r\n this.lastCol += count * FBX_COL_SIZE;\r\n }\r\n\r\n setIndices(array, start, count) {\r\n this.indices.set(array, this.lastIdx);\r\n this.lastIdx += count;\r\n }\r\n\r\n setShiftedIndices(array, count, shift) {\r\n const shifted = array.map((x) => x + shift);\r\n this.setIndices(shifted, 0, count);\r\n }\r\n\r\n getVerticesNumber() {\r\n return this.lastPos / FBX_POS_SIZE;\r\n }\r\n\r\n addInstance(matrix, geo) {\r\n // add indices at first to take old number of vertices for shift\r\n const currentCount = this.getVerticesNumber();\r\n this.setShiftedIndices(geo.indices, geo.indices.length, currentCount);\r\n // simply write vertices at empty space\r\n const size = geo.itemSize;\r\n this.setTransformedPositions(geo.positions, 0, geo.vertsCount, size.position, matrix);\r\n this.setTransformedNormals(geo.normals, 0, geo.vertsCount, size.normal, matrix);\r\n this.setColors(geo.colors, 0, geo.vertsCount, size.color);\r\n }\r\n}\r\n","/** Base class for fbx geometry contains simply organized attributes: positions+normals+colors, indices. */\r\nexport default class FBXGeometry {\r\n /**\r\n * Create a base geo with necessary members.\r\n */\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.vertsCount = 0;\r\n this.itemSize = null;\r\n }\r\n\r\n /**\r\n * Initialize base geo storing items info from attributes.\r\n * @param {Object} geo - THREE.Geometry.\r\n */\r\n init(geo, _info) {\r\n const { attributes } = geo;\r\n // save item size\r\n this.itemSize = {\r\n position: attributes.position.itemSize,\r\n normal: attributes.normal.itemSize,\r\n color: attributes.color.itemSize,\r\n };\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes and creates colors filled with defined value.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX1CGeometry extends FBXGeometry {\r\n /**\r\n * Initialize geo storing positions, normals, indices and create colors.\r\n * @param {Object} geo - THREE.Geometry.\r\n */\r\n init(geo, _info) {\r\n super.init(geo, _info);\r\n const {\r\n attributes: {\r\n position,\r\n normal,\r\n },\r\n index,\r\n } = geo;\r\n // copy vertices attributes\r\n this.vertsCount = position.count;\r\n this.positions = position.array;\r\n this.normals = normal.array;\r\n // create color array\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n // indices\r\n this.indices = index.array;\r\n }\r\n\r\n /**\r\n * Set defined color for all items in color attribute\r\n * @param {Object} color - THREE.Color.\r\n */\r\n setColors(color) {\r\n let offset = 0;\r\n for (let i = 0, l = this.colors.length, cl = this.itemSize.color; i < l; i += cl) {\r\n this.colors[offset++] = color.r;\r\n this.colors[offset++] = color.g;\r\n this.colors[offset++] = color.b;\r\n }\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes from cylinder geometry and creates colors filled with two\r\n * defined values.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX2CCylinder extends FBXGeometry {\r\n constructor() {\r\n super();\r\n this._cutRawStart = 0;\r\n this._cutRawEnd = 0;\r\n this._facesPerSlice = 0;\r\n }\r\n\r\n /**\r\n * Initialize geo by creating new attributes, because we extend number of vertices to make cylinder two-colored.\r\n * Indices remain the same. We process open- end close-ended cylinders and consider cylinders od 2 segments\r\n * in height ONLY.\r\n * NOTE: cylinder consists of 2 height segments and stores parts in the order: tube, topCap, bottomCap\r\n * @param {Object} geo - THREE.Geometry.\r\n * @param {Object} info - information needed for geo extend\r\n */\r\n init(geo, info) {\r\n super.init(geo, info);\r\n const {\r\n attributes: {\r\n position,\r\n },\r\n index,\r\n } = geo;\r\n // extend vertices arrays\r\n this.vertsCount = position.count + info.addPerCylinder;\r\n this._facesPerSlice = info.addPerCylinder;\r\n this.positions = new Float32Array(this.vertsCount * position.itemSize);\r\n this.normals = new Float32Array(this.vertsCount * this.itemSize.normal);\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n this._extendVertices(geo, info);\r\n // number of indices stays the same\r\n this.indices = new Uint32Array(index.count);\r\n this._extendIndices(geo, info);\r\n }\r\n\r\n /** Extend vertex attributes to have one more slice to make sharp middle startColor-endColor line. */\r\n _extendVertices(geo, info) {\r\n const { position } = geo.attributes;\r\n const { normal } = geo.attributes;\r\n const geoParams = geo.getGeoParams();\r\n const cutRaw = 1; // we expect cylinders of 2 segments in height => so half segment = 1\r\n this._cutRawStart = cutRaw * geoParams.radialSegments;\r\n this._cutRawEnd = this._cutRawStart + info.addPerCylinder;\r\n { // write first half of cylinder\r\n let temp = position.array.slice(0, this._cutRawEnd * position.itemSize);\r\n this.positions.set(temp, 0);\r\n temp = normal.array.slice(0, this._cutRawEnd * normal.itemSize);\r\n this.normals.set(temp, 0);\r\n }\r\n { // write second part of cylinder\r\n let temp = position.array.slice(this._cutRawStart * position.itemSize, position.array.length);\r\n this.positions.set(temp, this._cutRawEnd * position.itemSize);\r\n temp = normal.array.slice(this._cutRawStart * normal.itemSize, normal.array.length);\r\n this.normals.set(temp, this._cutRawEnd * normal.itemSize);\r\n }\r\n }\r\n\r\n /** Shift values of second part (+caps) indices by newly added vertices count. Number of faces remains the same. */\r\n _extendIndices(geo, info) {\r\n const { index } = geo;\r\n const indicesPerQuad = 6; // quad = 2 triangles => 6 indices\r\n const startToShift = info.addPerCylinder * indicesPerQuad;\r\n const shift = info.addPerCylinder;\r\n let shifted = index.array.slice(startToShift, index.count);\r\n shifted = shifted.map((x) => x + shift); // shift only the endings\r\n this.indices.set(index.array, 0);\r\n this.indices.set(shifted, startToShift);\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {number} start - start color index\r\n * @param {number} end - start color index\r\n * @param {array} array - array of colors\r\n * @param {array} color - color value components\r\n */\r\n _setColorRange(start, end, array, color) {\r\n const colorSize = color.length;\r\n for (let i = start; i < end; i += colorSize) {\r\n array.set(color, i);\r\n }\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {Object} color1 - THREE.Color.\r\n * @param {Object} color2 - THREE.Color.\r\n */\r\n setColors(color1, color2) {\r\n const colorSize = this.itemSize.color;\r\n const part1End = this._cutRawEnd * colorSize;\r\n const part2End = part1End * 2;\r\n this._setColorRange(0, part1End, this.colors, color1.toArray());\r\n this._setColorRange(part1End, part2End, this.colors, color2.toArray());\r\n if (part2End < this.colors.length) { // cylinder has caps, lets paint them\r\n const capSize = (this._facesPerSlice + 1) * colorSize;\r\n const cap1End = part2End + capSize;\r\n this._setColorRange(part2End, cap1End, this.colors, color2.toArray());\r\n const cap2End = cap1End + capSize; // should be equal to this.colors.length;\r\n this._setColorRange(cap1End, cap2End, this.colors, color1.toArray());\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\n\r\nimport utils from '../../../utils';\r\nimport gfxutils from '../../../gfx/gfxutils';\r\nimport logger from '../../../utils/logger';\r\n\r\nimport FBXModel from './FBXModel';\r\nimport ThickLineMesh from '../../../gfx/meshes/ThickLineMesh';\r\nimport ZSpriteMesh from '../../../gfx/meshes/ZSpriteMesh';\r\nimport InstancedSpheresGeometry from '../../../gfx/geometries/InstancedSpheresGeometry';\r\nimport Instanced2CCylindersGeometry from '../../../gfx/geometries/Instanced2CCylindersGeometry';\r\nimport FBX1CGeometry from './FBX1CGeometry';\r\nimport FBX2CCylinder from './FBX2CCylinder';\r\n\r\nexport default class FBXInfoExtractor {\r\n constructor() {\r\n this._materials = [];\r\n this._models = [];\r\n }\r\n\r\n process(data) {\r\n this._extractModelsAndMaterials(data);\r\n\r\n\r\n const models = this._flattenModels();\r\n\r\n return {\r\n name: data.name,\r\n models,\r\n materials: this._materials,\r\n };\r\n }\r\n\r\n /**\r\n * Extract fbx object information from ComplexVisual\r\n * @param {object} data - complexVisual to get geometry info from\r\n */\r\n _extractModelsAndMaterials(data) {\r\n const layersOfInterest = new THREE.Layers();\r\n layersOfInterest.set(gfxutils.LAYERS.DEFAULT);\r\n layersOfInterest.enable(gfxutils.LAYERS.TRANSPARENT);\r\n data.traverse((object) => {\r\n if (object instanceof THREE.Mesh && object.layers.test(layersOfInterest) && this.checkExportAbility(object)) {\r\n if (object.geometry.type === 'InstancedBufferGeometry') {\r\n this._collectInstancedGeoInfo(object);\r\n } else {\r\n this._collectGeoInfo(object);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Reworking indices buffer, see https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/\r\n * basically, every triangle in Miew has been represented hat way (e.g.) : 0,1,7, but we must (for FBX) rework that\r\n * into: 0,1,-8.\r\n * @param {array} indices - belongs to [0, maxVertIndex]\r\n */\r\n _reworkIndices(indices) {\r\n const faceSize = 3;\r\n for (let i = faceSize - 1; i < indices.length; i += faceSize) {\r\n indices[i] *= -1;\r\n indices[i]--;\r\n }\r\n }\r\n\r\n /**\r\n * Combine geometry from several models having the same material into one Model and finally prepare indices\r\n * @returns {array} models, combined by material id\r\n */\r\n _flattenModels() {\r\n let overallVertsCount = 0;\r\n function shift(x) {\r\n return x + overallVertsCount;\r\n }\r\n const combined = [];\r\n // flatten models geometry\r\n for (let i = 0, n = this._models.length; i < n; i++) {\r\n const models = this._models[i];\r\n let indices = [];\r\n let positions = [];\r\n let normals = [];\r\n let colors = [];\r\n // reorganize every attributes as array of arrays\r\n overallVertsCount = 0;\r\n for (let j = 0; j < models.length; j++) {\r\n const m = models[j];\r\n indices.push(m.indices.map(shift));\r\n overallVertsCount += m.getVerticesNumber();\r\n positions.push(m.positions);\r\n normals.push(m.normals);\r\n colors.push(m.colors);\r\n }\r\n // join all subarrays into one\r\n indices = utils.mergeTypedArraysUnsafe(indices);\r\n this._reworkIndices(indices);\r\n positions = utils.mergeTypedArraysUnsafe(positions);\r\n normals = utils.mergeTypedArraysUnsafe(normals);\r\n colors = utils.mergeTypedArraysUnsafe(colors);\r\n combined.push({\r\n indices,\r\n positions,\r\n normals,\r\n colors,\r\n verticesCount: overallVertsCount,\r\n });\r\n }\r\n return combined;\r\n }\r\n\r\n /**\r\n * Check ability to export the kind of mesh.\r\n * @param {object} mesh - given mesh to check\r\n * @returns {boolean} result of check\r\n */\r\n checkExportAbility(mesh) {\r\n // check mesh on not being empty\r\n if (mesh.geometry.attributes.position.count === 0) {\r\n return false;\r\n }\r\n // check type of mesh\r\n // if (mesh.geometry.isInstancedBufferGeometry && settings.now.zSprites) {\r\n if (mesh instanceof ZSpriteMesh) {\r\n logger.warn('Currently we cannot export \\'sprites\\' modes, like BS, WV, LC. Please turn of settings \\'zSprites\\' and try again');\r\n return false;\r\n }\r\n if (mesh instanceof ThickLineMesh) {\r\n logger.warn('Currently we cannot export Lines mode');\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Save geometry info from common mesh, like Surface or Cartoon\r\n */\r\n _collectGeoInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n normal,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const vertCount = position.count;\r\n model.init(vertCount, index.count);\r\n if (matrix.isIdentity()) {\r\n model.setPositions(position.array, 0, vertCount, position.itemSize);\r\n model.setNormals(normal.array, 0, vertCount, normal.itemSize);\r\n } else {\r\n model.setTransformedPositions(position.array, 0, vertCount, position.itemSize, matrix);\r\n model.setTransformedNormals(normal.array, 0, vertCount, normal.itemSize, matrix);\r\n }\r\n model.setColors(color.array, 0, vertCount, color.itemSize);\r\n model.setIndices(index.array, 0, index.count);\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Collect instanced spheres geometry and materials.\r\n * @param {object} mesh - mesh with instanced spheres info\r\n */\r\n _collectSpheresInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.maxInstancedCount;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount, instCount * indsCount);\r\n const geo = new FBX1CGeometry();\r\n geo.init(mesh.geometry);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const sphereColor = new THREE.Color();\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n sphereColor.fromArray(color.array, colorIdx);\r\n geo.setColors(sphereColor);\r\n // add instance to the model\r\n this._getSphereInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Getting all instanced cylinders from given mesh.\r\n * Divide cylinder (add additional vertexes) for prettiness therefore algorithm is a bit complicated\r\n * @param {object} mesh - given mesh with instanced cylinders\r\n */\r\n _collectCylindersInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n color2,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.maxInstancedCount;\r\n const oneCCylinder = new FBX1CGeometry();\r\n oneCCylinder.init(mesh.geometry);\r\n const splittingInfo = this._gatherCylindersColoringInfo(mesh.geometry);\r\n let twoCCylinder = null;\r\n if (splittingInfo.needToSplit > 0) {\r\n twoCCylinder = new FBX2CCylinder();\r\n twoCCylinder.init(mesh.geometry, splittingInfo);\r\n }\r\n const additionalVertsCount = splittingInfo.addPerCylinder * splittingInfo.needToSplit;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount + additionalVertsCount, instCount * indsCount);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const colorStart = new THREE.Color();\r\n const colorEnd = new THREE.Color();\r\n let geo = {};\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n if (splittingInfo.is2Colored[instanceIndex]) {\r\n // .color2 contains starting color, and .color contains starting color (see uber.frag ATTR_COLOR2)\r\n colorStart.fromArray(color2.array, colorIdx);\r\n colorEnd.fromArray(color.array, colorIdx);\r\n if (twoCCylinder) {\r\n twoCCylinder.setColors(colorStart, colorEnd);\r\n geo = twoCCylinder;\r\n }\r\n } else {\r\n // has one color per cylinder\r\n colorStart.fromArray(color.array, colorIdx);\r\n oneCCylinder.setColors(colorStart);\r\n geo = oneCCylinder;\r\n }\r\n // add instance to the model\r\n this._getCylinderInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Adding model to pool of models or extend existing ones\r\n * @param {object} model - model to add\r\n * @param {object} material - material to add\r\n */\r\n _addToPool(model, material) {\r\n const materialIdx = this._checkExistingMaterial(material);\r\n if (materialIdx < 0) { // new model-material pair\r\n this._models.push([model]);\r\n this._materials.push(material);\r\n } else { // add model to existing model-material pair\r\n const models = this._models[materialIdx];\r\n models.push(model);\r\n }\r\n }\r\n\r\n /**\r\n * Checking if given material already was registered in materials pool (no need to create new one)\r\n * @param {object} material - given material\r\n * @returns {number} number of model-material pair\r\n */\r\n _checkExistingMaterial(material) {\r\n return _.findIndex(this._materials, (m) => _.isEqual(m, material));\r\n }\r\n\r\n _gatherCylindersColoringInfo(geo) {\r\n const instCount = geo.maxInstancedCount;\r\n const color1 = geo.attributes.color.array;\r\n const color2 = geo.attributes.color2.array;\r\n const stride = geo.attributes.color.itemSize;\r\n const is2Colored = new Array(instCount);\r\n // analyze color instance attributes\r\n let needToSplit = 0;\r\n let colIdx = 0;\r\n for (let i = 0; i < instCount; i++, colIdx += stride) {\r\n const differs = (Math.abs(color1[colIdx] - color2[colIdx]) > 0.0000001) // compare ending colors\r\n || (Math.abs(color1[colIdx + 1] - color2[colIdx + 1]) > 0.0000001)\r\n || (Math.abs(color1[colIdx + 2] - color2[colIdx + 2]) > 0.0000001);\r\n is2Colored[i] = differs;\r\n needToSplit += differs; // count number of 2-colored cylinders\r\n }\r\n // calc number of vertices to add into 2-colored\r\n const geoParams = geo.getGeoParams();\r\n const addPerCylinder = geoParams.radialSegments;\r\n return { is2Colored, needToSplit, addPerCylinder };\r\n }\r\n\r\n /**\r\n * Collect instanced models and materials.\r\n * @param {object} mesh - given mesh with instanced something (spheres or cylinders)\r\n */\r\n _collectInstancedGeoInfo(mesh) {\r\n if (mesh.geometry instanceof InstancedSpheresGeometry) {\r\n this._collectSpheresInfo(mesh);\r\n } else if (mesh.geometry instanceof Instanced2CCylindersGeometry) {\r\n this._collectCylindersInfo(mesh);\r\n }\r\n }\r\n\r\n /**\r\n * Collect Material info from given mesh.\r\n * @param {object} mesh - given mesh with material info\r\n * @returns {object} material\r\n */\r\n _collectMaterialInfo(mesh) {\r\n const { uberOptions } = mesh.material;\r\n return ({\r\n diffuse: uberOptions.diffuse.toArray(),\r\n opacity: uberOptions.opacity,\r\n shininess: uberOptions.shininess,\r\n specular: uberOptions.specular.toArray(),\r\n });\r\n }\r\n\r\n _getCylinderInstanceMatrix(geo, instIdx, matrix) {\r\n const matVector1 = geo.attributes.matVector1.array;\r\n const matVector2 = geo.attributes.matVector2.array;\r\n const matVector3 = geo.attributes.matVector3.array;\r\n const idxOffset = instIdx * 4; // used 4 because offset arrays are stored in quads\r\n matrix.set(matVector1[idxOffset], matVector1[idxOffset + 1], matVector1[idxOffset + 2], matVector1[idxOffset + 3],\r\n matVector2[idxOffset], matVector2[idxOffset + 1], matVector2[idxOffset + 2], matVector2[idxOffset + 3],\r\n matVector3[idxOffset], matVector3[idxOffset + 1], matVector3[idxOffset + 2], matVector3[idxOffset + 3],\r\n 0, 0, 0, 1);\r\n }\r\n\r\n _getSphereInstanceMatrix(geo, instIdx, matrix) {\r\n const { offset } = geo.attributes;\r\n const idx = instIdx * offset.itemSize;\r\n const x = offset.array[idx];\r\n const y = offset.array[idx + 1];\r\n const z = offset.array[idx + 2];\r\n const scale = offset.array[idx + 3];\r\n matrix.set(\r\n scale, 0, 0, x,\r\n 0, scale, 0, y,\r\n 0, 0, scale, z,\r\n 0, 0, 0, 1,\r\n );\r\n }\r\n}\r\n","// Forming default definitions block\r\nconst defaultDefinitions = `\r\nDefinitions: {\r\n Version: 100\r\n Count: 3\r\n ObjectType: \"Model\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Geometry\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Material\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Pose\" {\r\n Count: 1\r\n }\r\n ObjectType: \"GlobalSettings\" {\r\n Count: 1\r\n }\r\n} `;\r\n\r\n// Default model properties\r\nconst defaultProperties = `Properties60: {\r\n Property: \"QuaternionInterpolate\", \"bool\", \"\",0\r\n Property: \"Visibility\", \"Visibility\", \"A\",1\r\n Property: \"Lcl Translation\", \"Lcl Translation\", \"A\",0.000000000000000,0.000000000000000,-1789.238037109375000\r\n Property: \"Lcl Rotation\", \"Lcl Rotation\", \"A\",0.000009334667643,-0.000000000000000,0.000000000000000\r\n Property: \"Lcl Scaling\", \"Lcl Scaling\", \"A\",1.000000000000000,1.000000000000000,1.000000000000000\r\n Property: \"RotationOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationActive\", \"bool\", \"\",0\r\n Property: \"TranslationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMinX\", \"bool\", \"\",0\r\n Property: \"TranslationMinY\", \"bool\", \"\",0\r\n Property: \"TranslationMinZ\", \"bool\", \"\",0\r\n Property: \"TranslationMaxX\", \"bool\", \"\",0\r\n Property: \"TranslationMaxY\", \"bool\", \"\",0\r\n Property: \"TranslationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationOrder\", \"enum\", \"\",0\r\n Property: \"RotationSpaceForLimitOnly\", \"bool\", \"\",0\r\n Property: \"AxisLen\", \"double\", \"\",10\r\n Property: \"PreRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"PostRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationActive\", \"bool\", \"\",0\r\n Property: \"RotationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMinX\", \"bool\", \"\",0\r\n Property: \"RotationMinY\", \"bool\", \"\",0\r\n Property: \"RotationMinZ\", \"bool\", \"\",0\r\n Property: \"RotationMaxX\", \"bool\", \"\",0\r\n Property: \"RotationMaxY\", \"bool\", \"\",0\r\n Property: \"RotationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationStiffnessX\", \"double\", \"\",0\r\n Property: \"RotationStiffnessY\", \"double\", \"\",0\r\n Property: \"RotationStiffnessZ\", \"double\", \"\",0\r\n Property: \"MinDampRangeX\", \"double\", \"\",0\r\n Property: \"MinDampRangeY\", \"double\", \"\",0\r\n Property: \"MinDampRangeZ\", \"double\", \"\",0\r\n Property: \"MaxDampRangeX\", \"double\", \"\",0\r\n Property: \"MaxDampRangeY\", \"double\", \"\",0\r\n Property: \"MaxDampRangeZ\", \"double\", \"\",0\r\n Property: \"MinDampStrengthX\", \"double\", \"\",0\r\n Property: \"MinDampStrengthY\", \"double\", \"\",0\r\n Property: \"MinDampStrengthZ\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthX\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthY\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthZ\", \"double\", \"\",0\r\n Property: \"PreferedAngleX\", \"double\", \"\",0\r\n Property: \"PreferedAngleY\", \"double\", \"\",0\r\n Property: \"PreferedAngleZ\", \"double\", \"\",0\r\n Property: \"InheritType\", \"enum\", \"\",0\r\n Property: \"ScalingActive\", \"bool\", \"\",0\r\n Property: \"ScalingMin\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMax\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMinX\", \"bool\", \"\",0\r\n Property: \"ScalingMinY\", \"bool\", \"\",0\r\n Property: \"ScalingMinZ\", \"bool\", \"\",0\r\n Property: \"ScalingMaxX\", \"bool\", \"\",0\r\n Property: \"ScalingMaxY\", \"bool\", \"\",0\r\n Property: \"ScalingMaxZ\", \"bool\", \"\",0\r\n Property: \"GeometricTranslation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricScaling\", \"Vector3D\", \"\",1,1,1\r\n Property: \"LookAtProperty\", \"object\", \"\"\r\n Property: \"UpVectorProperty\", \"object\", \"\"\r\n Property: \"Show\", \"bool\", \"\",1\r\n Property: \"NegativePercentShapeSupport\", \"bool\", \"\",1\r\n Property: \"DefaultAttributeIndex\", \"int\", \"\",0\r\n Property: \"Color\", \"Color\", \"A+\",0,0,0\r\n Property: \"Size\", \"double\", \"\",100\r\n Property: \"Look\", \"enum\", \"\",1\r\n }`;\r\n\r\n// Default materials layer\r\nconst defaultMaterialLayer = `\r\n LayerElementMaterial: 0 {\r\n Version: 101\r\n Name: \"\"\r\n MappingInformationType: \"AllSame\"\r\n ReferenceInformationType: \"Direct\"\r\n Materials: 0\r\n }`;\r\n\r\n// Default layers block\r\nconst defaultLayerBlock = `\r\n Layer: 0 {\r\n Version: 100\r\n LayerElement: {\r\n Type: \"LayerElementNormal\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementColor\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementMaterial\"\r\n TypedIndex: 0\r\n }\r\n }`;\r\n\r\n/**\r\n * globalSettings info in output file.\r\n */\r\nconst globalSettings = `GlobalSettings: {\r\n Version: 1000\r\n Properties60: {\r\n Property: \"UpAxis\", \"int\", \"\",1\r\n Property: \"UpAxisSign\", \"int\", \"\",1\r\n Property: \"FrontAxis\", \"int\", \"\",2\r\n Property: \"FrontAxisSign\", \"int\", \"\",1\r\n Property: \"CoordAxis\", \"int\", \"\",0\r\n Property: \"CoordAxisSign\", \"int\", \"\",1\r\n Property: \"UnitScaleFactor\", \"double\", \"\",1\r\n }\r\n }`;\r\n\r\nexport default class FBXResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._info = null;\r\n }\r\n\r\n getResult(info) {\r\n this._info = info;\r\n this._resultArray.push(this._writeHeader());\r\n this._resultArray.push(this._writeDefinitions());\r\n this._resultArray.push(this._writeObjects(info.models, info.materials));\r\n this._resultArray.push(this._writeRelations());\r\n this._resultArray.push(this._writeConnections()); // connections between models and materials)\r\n this._info = null;\r\n return this._resultArray.join('');\r\n }\r\n\r\n /**\r\n * Add FBXHeader info to output file.\r\n * Some fields are really confusing, but it seems that all listed fields are very informative\r\n */\r\n _writeHeader() {\r\n const FBXHeaderVersion = 1003; // 1003 is some number which appears to present in many 6.1 ASCII files\r\n const FBXVersion = 6100; // Mandatory and only supported version\r\n const date = new Date();\r\n const timeStampVersion = 1000;\r\n const creator = `Miew FBX Exporter v${this._info.version}`; // Supposed to be an engine\r\n\r\n return `; FBX 6.1.0 project file\r\n; Created by ${creator} Copyright (c) 2015-2020 EPAM Systems, Inc.\r\n; For support please contact miew@epam.com\r\n; ----------------------------------------------------\r\n\r\nFBXHeaderExtension: {\r\n FBXHeaderVersion: ${FBXHeaderVersion}\r\n FBXVersion: ${FBXVersion}\r\n CreationTimeStamp: {\r\n Version: ${timeStampVersion}\r\n Year: ${date.getFullYear()}\r\n Month: ${date.getMonth() + 1} \r\n Day: ${date.getDate()}\r\n Hour: ${date.getHours()}\r\n Minute: ${date.getMinutes()}\r\n Second: ${date.getSeconds()}\r\n Millisecond: ${date.getMilliseconds()}\r\n }\r\n Creator: \"${creator}\"\r\n OtherFlags: {\r\n FlagPLE: 0\r\n }\r\n}\r\nCreationTime: \"${date}\"\r\nCreator: \"${creator}\" \r\n`;\r\n }\r\n\r\n /**\r\n * Add Definitions info to output file.\r\n * Not exactly sure if this section is template section (as it is in 7.4+) or it should every time be like this\r\n */\r\n _writeDefinitions() {\r\n return `\r\n; Object definitions\r\n;------------------------------------------------------------------\r\n\r\n${defaultDefinitions}\r\n`;\r\n }\r\n\r\n /**\r\n * Adding gathered information about Models to resulting string.\r\n * Reminder - there may be more then 1 model in scene, but we must place materials after ALL models.\r\n * @returns {string} string containing all models (vertices, indices, colors, normals etc)\r\n */\r\n _models() {\r\n const modelVersion = 232;\r\n let allModels = '';\r\n const { models } = this._info;\r\n for (let i = 0; i < models.length; ++i) {\r\n const model = models[i];\r\n const vertCount = model.verticesCount;\r\n allModels += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n Version: ${modelVersion} \r\n ${defaultProperties}\r\n ${this._verticesIndices(model.positions, model.indices)}\r\n ${this._normalLayer(model.normals)} \r\n ${this._colorLayer(model.colors, vertCount)} \r\n ${defaultMaterialLayer} \r\n ${defaultLayerBlock}\r\n }`;\r\n }\r\n return allModels;\r\n }\r\n\r\n /**\r\n * Add Material info to result\r\n */\r\n _materials() {\r\n const materialVersion = 102;\r\n let allMaterials = '';\r\n const { materials } = this._info;\r\n for (let i = 0; i < materials.length; ++i) {\r\n const material = materials[i];\r\n allMaterials += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n Version: ${materialVersion}\r\n ShadingModel: \"lambert\"\r\n MultiLayer: 0\r\n ${this._materialProperties(material)}\r\n }`;\r\n }\r\n return allMaterials;\r\n }\r\n\r\n /**\r\n * Add Objects info to output file.\r\n */\r\n _writeObjects() {\r\n return `\r\n; Object properties\r\n;------------------------------------------------------------------\r\n\r\nObjects: {\r\n ${this._models()}\r\n ${this._materials()}\r\n ${globalSettings}\r\n}\r\n`;\r\n }\r\n\r\n /**\r\n * Add Relations info to output file.\r\n */\r\n _writeRelations() {\r\n let modelsList = '';\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n }`;\r\n }\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n }`;\r\n }\r\n\r\n return `\r\n; Object relations\r\n;------------------------------------------------------------------\r\n\r\nRelations: {\r\n ${modelsList}\r\n Model: \"Model::Producer Perspective\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Top\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Bottom\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Front\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Back\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Right\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Left\", \"Camera\" {\r\n }\r\n Model: \"Model::Camera Switcher\", \"CameraSwitcher\" {\r\n }\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Add Connections info to output file.\r\n */\r\n _writeConnections() {\r\n let modelsList = '';\r\n const { name } = this._info;\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Connect: \"OO\", \"Model::${name}_${i}\", \"Model::Scene\"`;\r\n }\r\n\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Connect: \"OO\", \"Material::${name}_${i}_default\", \"Model::${name}_${i}\"`;\r\n }\r\n\r\n return `\r\n; Object connections\r\n;------------------------------------------------------------------\r\n\r\nConnections: {\r\n ${modelsList}\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Write float array to string with limited precision\r\n * @param {Float32Array} array - array to be fixed\r\n * @returns {String} String with fixed floats\r\n */\r\n _floatArrayToString(array) {\r\n const str = [];\r\n for (let i = 0; i < array.length; ++i) {\r\n str[i] = array[i].toFixed(6);\r\n }\r\n return str.join(',');\r\n }\r\n\r\n /**\r\n * Adding color layer to resulting file\r\n * @param {Float32Array} colorArray attribute\r\n * @param {number} vertCount - number of vertices in the model\r\n * @returns {string} color layer info\r\n */\r\n _colorLayer(colorArray, vertCount) {\r\n const layerElementColorNumber = 0;\r\n const layerElementColorVersion = 101;\r\n const layerElementColorName = '';\r\n const colorsStr = this._floatArrayToString(colorArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n // As said [..Array(...)] - fastest and easiest way to produce [0, 1, .....] array\r\n const colorIndices = [...Array(vertCount).keys()];\r\n return `\r\n LayerElementColor: ${layerElementColorNumber} {\r\n Version: ${layerElementColorVersion}\r\n Name: \"${layerElementColorName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\"\r\n Colors: ${colorsStr}\r\n ColorIndex: ${colorIndices}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding normal layer to resulting file\r\n * @param {Float32Array} normalArray attribute\r\n * @returns {string} normal layer info\r\n */\r\n _normalLayer(normalArray) {\r\n const layerElementNormalNumber = 0;\r\n const layerElementNormalVersion = 101;\r\n const layerElementNormalName = '';\r\n const normalsStr = this._floatArrayToString(normalArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n return `\r\n LayerElementNormal: ${layerElementNormalNumber} {\r\n Version: ${layerElementNormalVersion}\r\n Name: \"${layerElementNormalName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\" \r\n Normals: ${normalsStr}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding vertices and indices to resulting string\r\n * @return {string} resulting string in FBX notation\r\n */\r\n _verticesIndices(positions, indices) {\r\n const multiLayer = 0;\r\n const multiTake = 1;\r\n const shading = 'Y';\r\n const culling = 'CullingOff';\r\n const geometryVersion = 124;\r\n const vertStr = this._floatArrayToString(positions);\r\n /* About _correctArrayNotation: Float32Arrays will contains only Float32 numbers, which implies that it will be floating points with 17 numbers after point.\r\n * We cannot (and it's logically incorrect) save all this information, so we convert this Float32Array into Array-like object with numbers with only 6 numbers after point\r\n * Reminder - this is big memory loss (as we must save at one moment two arrays with similar information) */\r\n return `MultiLayer: ${multiLayer}\r\n MultiTake: ${multiTake}\r\n Shading: ${shading}\r\n Culling: \"${culling}\"\r\n Vertices: ${vertStr}\r\n PolygonVertexIndex: ${indices}\r\n GeometryVersion: ${geometryVersion}`;\r\n }\r\n\r\n /**\r\n * Forming material properties block.\r\n * @param {Object} material - given material of model\r\n * @returns {String} material properties string\r\n */\r\n _materialProperties(material) {\r\n return `Properties60: {\r\n Property: \"ShadingModel\", \"KString\", \"\", \"Lambert\"\r\n Property: \"MultiLayer\", \"bool\", \"\",0\r\n Property: \"EmissiveColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"EmissiveFactor\", \"double\", \"\",0.0000\r\n Property: \"AmbientColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"AmbientFactor\", \"double\", \"\",0.0000\r\n Property: \"DiffuseColor\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"DiffuseFactor\", \"double\", \"\",1.0000\r\n Property: \"Bump\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TransparentColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"TransparencyFactor\", \"double\", \"\",0.0000\r\n Property: \"SpecularColor\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"SpecularFactor\", \"double\", \"\",1.0000\r\n Property: \"ShininessExponent\", \"double\", \"\",${material.shininess}\r\n Property: \"ReflectionColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"ReflectionFactor\", \"double\", \"\",1\r\n Property: \"Ambient\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"Diffuse\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"Specular\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"Shininess\", \"double\", \"\",${material.shininess}\r\n Property: \"Opacity\", \"double\", \"\",${material.opacity}\r\n Property: \"Reflectivity\", \"double\", \"\",0\r\n }`;\r\n }\r\n}\r\n","import Exporter from './Exporter';\r\nimport FBXInfoExtractor from './fbx/FBXInfoExtractor';\r\nimport FBXResult from './fbx/FBXResult';\r\nimport ComplexVisual from '../../ComplexVisual';\r\n\r\nexport default class FBXExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n // Data\r\n this._data = source;\r\n this._version = options.miewVersion || '0.0-UNSPECIFIED';\r\n this._extractor = new FBXInfoExtractor();\r\n }\r\n\r\n /**\r\n * Entry point to exporter.\r\n */\r\n exportSync() {\r\n // Creating mandatory blocks\r\n const result = new FBXResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n const info = this._extractor.process(this._data);\r\n info.version = this._version;\r\n this._result = result.getResult(info);\r\n return this._result;\r\n }\r\n}\r\n\r\nFBXExporter.formats = ['fbx'];\r\nFBXExporter.SourceClass = ComplexVisual;\r\n","import ExporterList from './exporters/ExporterList';\r\n\r\nimport PDBExporter from './exporters/PDBExporter';\r\nimport FBXExporter from './exporters/FBXExporter';\r\n\r\nexport default new ExporterList([\r\n PDBExporter,\r\n FBXExporter,\r\n]);\r\n","import loaders from './loaders';\r\nimport parsers from './parsers';\r\nimport exporters from './exporters';\r\n\r\nexport default {\r\n loaders,\r\n parsers,\r\n exporters,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from './CSS2DObject';\r\n\r\nconst tempColor = new THREE.Color();\r\n\r\nclass CSS2DRenderer {\r\n constructor() {\r\n this._width = 0;\r\n this._height = 0;\r\n this._widthHalf = 0;\r\n this._heightHalf = 0;\r\n\r\n this._vector = new THREE.Vector3();\r\n this._viewMatrix = new THREE.Matrix4();\r\n this._projectionMatrix = new THREE.Matrix4();\r\n\r\n this._domElement = document.createElement('div');\r\n this._domElement.style.overflow = 'hidden';\r\n this._domElement.style.position = 'absolute';\r\n this._domElement.style.top = '0';\r\n this._domElement.style.zIndex = '0'; // start a new Stacking Context to enclose all z-ordered children\r\n this._domElement.style.pointerEvents = 'none';\r\n }\r\n\r\n getElement() {\r\n return this._domElement;\r\n }\r\n\r\n reset() {\r\n const myNode = this.getElement();\r\n while (myNode.firstChild) {\r\n myNode.removeChild(myNode.firstChild);\r\n }\r\n }\r\n\r\n setSize(width, height) {\r\n this._width = width;\r\n this._height = height;\r\n\r\n this._widthHalf = this._width / 2;\r\n this._heightHalf = this._height / 2;\r\n\r\n this._domElement.style.width = `${width}px`;\r\n this._domElement.style.height = `${height}px`;\r\n }\r\n\r\n _renderObject(object, camera, scene) {\r\n function lerpColorAsHex(a, b, t) {\r\n tempColor.setHex(a);\r\n tempColor.lerp(b, t);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n function colorAsHex(a) {\r\n tempColor.setHex(a);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n if (object instanceof CSS2DObject) {\r\n this._vector.setFromMatrixPosition(object.matrixWorld);\r\n\r\n if (object.userData !== undefined && object.userData.offset !== undefined) {\r\n const localOffset = new THREE.Vector3(object.userData.offset.x, object.userData.offset.y, 0);\r\n this._vector.add(localOffset.multiplyScalar(object.matrixWorld.getMaxScaleOnAxis()));\r\n }\r\n\r\n this._vector.applyMatrix4(this._viewMatrix);\r\n\r\n const visibility = this._vector.z > -camera.near ? 'hidden' : 'visible';\r\n const zIndex = 10000 * (camera.far - (-this._vector.z)) / (camera.far - camera.near);\r\n\r\n const element = object.getElement();\r\n if (typeof scene.fog === 'undefined') {\r\n element.style.color = colorAsHex(object.userData.color);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = colorAsHex(object.userData.background);\r\n }\r\n } else {\r\n const fogFactor = THREE.Math.smoothstep(-this._vector.z, scene.fog.near, scene.fog.far);\r\n element.style.color = lerpColorAsHex(object.userData.color, scene.fog.color, fogFactor);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = lerpColorAsHex(object.userData.background, scene.fog.color, fogFactor);\r\n }\r\n }\r\n\r\n this._vector.applyMatrix4(this._projectionMatrix);\r\n\r\n const style = `${object.userData !== {} ? object.userData.translation : 'translate(-50%, -50%) '\r\n }translate(${this._vector.x * this._widthHalf + this._widthHalf}px,${\r\n -this._vector.y * this._heightHalf + this._heightHalf}px)`;\r\n element.style.visibility = visibility;\r\n element.style.WebkitTransform = style;\r\n element.style.MozTransform = style;\r\n element.style.oTransform = style;\r\n element.style.transform = style;\r\n element.style.zIndex = Number(zIndex).toFixed(0);\r\n\r\n if (element.parentNode !== this._domElement) {\r\n this._domElement.appendChild(element);\r\n }\r\n }\r\n\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n this._renderObject(object.children[i], camera, scene);\r\n }\r\n }\r\n\r\n render(scene, camera) {\r\n scene.updateMatrixWorld();\r\n\r\n if (camera.parent === null) {\r\n camera.updateMatrixWorld();\r\n }\r\n\r\n camera.matrixWorldInverse.getInverse(camera.matrixWorld);\r\n\r\n this._viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));\r\n this._projectionMatrix.copy(camera.projectionMatrix);\r\n\r\n this._renderObject(scene, camera, scene);\r\n }\r\n}\r\nexport default CSS2DRenderer;\r\n","import * as THREE from 'three';\r\nimport Timer from '../Timer';\r\nimport settings from '../settings';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\n\r\nconst VK_LEFT = 37;\r\nconst VK_UP = 38;\r\nconst VK_RIGHT = 39;\r\nconst VK_DOWN = 40;\r\n\r\nconst STATE = {\r\n NONE: -1, ROTATE: 0, TRANSLATE: 1, SCALE: 2, TRANSLATE_PIVOT: 3,\r\n};\r\n\r\n// pausing for this amount of time before releasing mouse button prevents inertial rotation (seconds)\r\nconst FULL_STOP_THRESHOLD = 0.1;\r\n\r\nconst quaternion = new THREE.Quaternion();\r\nconst matrix4 = new THREE.Matrix4();\r\n\r\n// pivot -- local offset of the rotation pivot point\r\nfunction ObjectHandler(objects, camera, pivot, options) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n this.camera = camera;\r\n this.pivot = pivot;\r\n this.axis = new THREE.Vector3(0, 0, 1);\r\n this.options = options;\r\n\r\n this.lastRotation = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n}\r\n\r\nObjectHandler.prototype._rotate = (function () {\r\n const p = new THREE.Vector3();\r\n const q = new THREE.Quaternion();\r\n const s = new THREE.Vector3();\r\n\r\n const m = new THREE.Matrix4();\r\n\r\n return function (quat) {\r\n const zeroPivot = (this.pivot.x === 0.0 && this.pivot.y === 0.0 && this.pivot.z === 0.0);\r\n\r\n m.copy(this.object.matrix);\r\n\r\n if (zeroPivot) {\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n } else {\r\n m.multiply(matrix4.makeTranslation(this.pivot.x, this.pivot.y, this.pivot.z));\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n m.multiply(matrix4.makeTranslation(-this.pivot.x, -this.pivot.y, -this.pivot.z));\r\n }\r\n\r\n m.decompose(p, q, s);\r\n\r\n // update objects\r\n if (!zeroPivot) {\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].position.copy(p);\r\n }\r\n }\r\n\r\n for (let j = 0; j < this.objects.length; ++j) {\r\n this.objects[j].quaternion.copy(q);\r\n this.objects[j].updateMatrix();\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.setObjects = function (objects) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n};\r\n\r\nObjectHandler.prototype.rotate = (function () {\r\n const rot = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n\r\n return function (quat, mousePrevPos, mouseCurPos, aboutAxis) {\r\n this.mouse2rotation(rot, mousePrevPos, mouseCurPos, aboutAxis);\r\n quat.setFromAxisAngle(rot.axis, rot.angle);\r\n\r\n if (rot.angle) {\r\n this._rotate(quat);\r\n }\r\n\r\n this.lastRotation = rot;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.translate = (function () {\r\n const dir = new THREE.Vector3();\r\n const pivot = new THREE.Vector3();\r\n\r\n return function (delta) {\r\n // reverse-project viewport movement to view coords (compensate for screen aspect ratio)\r\n dir.set(\r\n delta.x / this.camera.projectionMatrix.elements[0],\r\n delta.y / this.camera.projectionMatrix.elements[5], 0,\r\n );\r\n let dist = dir.length();\r\n dir.normalize();\r\n\r\n // transform movement direction to object local coords\r\n dir.transformDirection(matrix4.getInverse(this.object.matrixWorld));\r\n\r\n // visible translate distance shouldn't depend on camera-to-object distance\r\n pivot.copy(this.pivot);\r\n this.object.localToWorld(pivot);\r\n dist *= Math.abs(pivot.z - this.camera.position.z);\r\n\r\n // visible translate distance shouldn't depend on object scale\r\n dist /= this.object.matrixWorld.getMaxScaleOnAxis();\r\n\r\n // all objects are translated similar to principal object\r\n // (we assume they all have identical pivot and scale)\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].translateOnAxis(dir, dist);\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.update = (function () {\r\n const axis = new THREE.Vector3();\r\n\r\n return function (timeSinceLastUpdate, timeSinceMove) {\r\n if (settings.now.autoRotation !== 0.0) {\r\n // auto-rotation with constant speed\r\n\r\n // if rotation axis is fixed or hasn't been defined yet\r\n if (settings.now.autoRotationAxisFixed || this.lastRotation.axis.length() === 0.0) {\r\n // use Y-axis (transformed to local object coords)\r\n axis.set(0, 1, 0).transformDirection(matrix4.getInverse(this.object.matrixWorld));\r\n } else {\r\n // use axis defined by last user rotation\r\n axis.copy(this.lastRotation.axis);\r\n }\r\n\r\n this._rotate(quaternion.setFromAxisAngle(axis, settings.now.autoRotation * timeSinceLastUpdate));\r\n return true;\r\n }\r\n\r\n if (this.options.intertia && this.lastRotation.angle) {\r\n // inertial object rotation\r\n const angle = this.lastRotation.angle * ((1.0 - this.options.dynamicDampingFactor) ** (40.0 * timeSinceMove));\r\n\r\n if (Math.abs(angle) <= this.options.intertiaThreshold) {\r\n this.lastRotation.angle = 0.0;\r\n } else {\r\n this._rotate(quaternion.setFromAxisAngle(this.lastRotation.axis, angle));\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.stop = function () {\r\n this.lastRotation.angle = 0.0;\r\n};\r\n\r\n// calculate (axis, angle) pair from mouse/touch movement\r\nObjectHandler.prototype.mouse2rotation = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n const eye = new THREE.Vector3();\r\n const eyeDirection = new THREE.Vector3();\r\n\r\n const cameraUpDirection = new THREE.Vector3();\r\n const cameraSidewaysDirection = new THREE.Vector3();\r\n\r\n const moveDirection = new THREE.Vector3();\r\n\r\n const mouseDelta = new THREE.Vector2();\r\n\r\n return function (rot, mousePrev, mouseCur, aboutAxis) {\r\n if (aboutAxis) {\r\n rot.axis.copy(this.axis);\r\n rot.angle = this.options.axisRotateFactor * (mouseCur.y - mousePrev.y);\r\n\r\n /* cool method that allows rotation around Z axis to be \"tied\" to mouse cursor\r\n\r\n res.axis.copy(this.axis);\r\n\r\n var pivot = this.pivot.clone();\r\n this.object.localToWorld(pivot);\r\n pivot.project(this.camera);\r\n\r\n var v1 = new THREE.Vector3(mousePrev.x, mousePrev.y, this.camera.position.z);\r\n v1.sub(pivot);\r\n var v2 = new THREE.Vector3(mouseCur.x, mouseCur.y, this.camera.position.z);\r\n v2.sub(pivot);\r\n\r\n v1.sub(res.axis.clone().multiplyScalar(v1.dot(res.axis)));\r\n v2.sub(res.axis.clone().multiplyScalar(v2.dot(res.axis)));\r\n\r\n var abs = v1.length() * v2.length();\r\n if (abs > 0) {\r\n res.angle = res.axis.dot(v1.cross(v2)) / abs;\r\n }\r\n */\r\n } else {\r\n mouseDelta.subVectors(mouseCur, mousePrev);\r\n const angle = mouseDelta.length();\r\n if (angle === 0.0) {\r\n return;\r\n }\r\n\r\n center.copy(this.pivot);\r\n this.object.localToWorld(center);\r\n eye.subVectors(this.camera.position, center);\r\n eyeDirection.copy(eye).normalize();\r\n\r\n cameraUpDirection.copy(this.camera.up).normalize();\r\n cameraSidewaysDirection.crossVectors(cameraUpDirection, eyeDirection).normalize();\r\n\r\n cameraUpDirection.setLength(mouseDelta.y);\r\n cameraSidewaysDirection.setLength(mouseDelta.x);\r\n\r\n moveDirection.copy(cameraUpDirection.add(cameraSidewaysDirection));\r\n\r\n rot.axis.crossVectors(moveDirection, eye);\r\n\r\n rot.angle = -angle * this.options.rotateFactor;\r\n }\r\n\r\n rot.axis.transformDirection(matrix4.getInverse(this.object.matrixWorld));\r\n\r\n // make sure angle is always positive (thus 'axis' defines both axis and direction of rotation)\r\n if (rot.angle < 0.0) {\r\n rot.axis.negate();\r\n rot.angle = -rot.angle;\r\n }\r\n };\r\n}());\r\n\r\nfunction ObjectControls(object, objectPivot, camera, domElement, getAltObj) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.object = object;\r\n this.objectPivot = objectPivot;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.getAltObj = getAltObj;\r\n\r\n // API\r\n\r\n this.enabled = true;\r\n this.hotkeysEnabled = true;\r\n\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n\r\n this.options = {\r\n rotateFactor: Math.PI, // full screen slide (along short side) would roughly mean 180 deg. rotation\r\n axisRotateFactor: 4 * Math.PI, // full screen slide (along short side) would roughly mean 720 deg. rotation\r\n intertia: true,\r\n dynamicDampingFactor: 0.1,\r\n intertiaThreshold: 1e-3,\r\n };\r\n\r\n // internals\r\n\r\n this._state = STATE.NONE;\r\n\r\n this._mousePrevPos = new THREE.Vector2();\r\n this._mouseCurPos = new THREE.Vector2();\r\n\r\n this._mainObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._altObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._affectedObj = this._mainObj;\r\n this._isAltObjFreeRotationAllowed = true;\r\n this._isTranslationAllowed = true;\r\n this._isKeysTranslatingObj = false;\r\n\r\n this._pressedKeys = [];\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n this._lastUpdateTime = this._clock.getElapsedTime();\r\n\r\n // events\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousewheel',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'DOMMouseScroll',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseout',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchmove',\r\n handler(e) {\r\n self.touchmove(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keydown',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keyup',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'blur',\r\n handler() {\r\n self.resetKeys();\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'contextmenu',\r\n handler(e) {\r\n self.contextmenu(e);\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n\r\n this.resetKeys();\r\n\r\n // force an update at start\r\n this.update();\r\n}\r\n\r\n// methods\r\n\r\nObjectControls.prototype = Object.create(EventDispatcher.prototype);\r\nObjectControls.prototype.constructor = ObjectControls;\r\n\r\nObjectControls.prototype.resetKeys = function () {\r\n this._pressedKeys[VK_LEFT] = false;\r\n this._pressedKeys[VK_UP] = false;\r\n this._pressedKeys[VK_RIGHT] = false;\r\n this._pressedKeys[VK_DOWN] = false;\r\n};\r\n\r\nObjectControls.prototype.contextmenu = function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n};\r\n\r\nObjectControls.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nObjectControls.prototype.enable = function (enable) {\r\n this.enabled = enable;\r\n};\r\n\r\nObjectControls.prototype.enableHotkeys = function (enable) {\r\n this.hotkeysEnabled = enable;\r\n};\r\n\r\nObjectControls.prototype.allowTranslation = function (allow) {\r\n this._isTranslationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.allowAltObjFreeRotation = function (allow) {\r\n this._isAltObjFreeRotationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.keysTranslateObj = function (on) {\r\n this._isKeysTranslatingObj = on;\r\n};\r\n\r\nObjectControls.prototype.isEditingAltObj = function () {\r\n return ((this._state === STATE.ROTATE) || (this._state === STATE.TRANSLATE))\r\n && (this._affectedObj === this._altObj);\r\n};\r\n\r\n// convert page coords of mouse/touch to uniform coords with smaller side being [-0.5, 0.5]\r\n// (uniform coords keep direct proportion with screen distance travelled by mouse regardless of screen aspect ratio)\r\nObjectControls.prototype.convertMouseToOnCircle = function (coords, pageX, pageY) {\r\n const screenSize = Math.min(this.screen.width, this.screen.height);\r\n\r\n if (screenSize === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n ((pageX - this.screen.width * 0.5 - this.screen.left) / screenSize),\r\n ((0.5 * this.screen.height + this.screen.top - pageY) / screenSize),\r\n );\r\n};\r\n\r\n// convert page coords of mouse/touch to viewport coords with both sides being [-1, 1]\r\n// (those are non-uniform coords affected by screen aspect ratio)\r\nObjectControls.prototype.convertMouseToViewport = function (coords, pageX, pageY) {\r\n if (this.screen.width === 0 || this.screen.height === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n (2.0 * (pageX - this.screen.width * 0.5 - this.screen.left) / this.screen.width),\r\n (2.0 * (0.5 * this.screen.height + this.screen.top - pageY) / this.screen.height),\r\n );\r\n};\r\n\r\nObjectControls.prototype.stop = function () {\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n};\r\n\r\n// rotate object based on latest mouse/touch movement\r\nObjectControls.prototype.rotateByMouse = (function () {\r\n const quat = new THREE.Quaternion();\r\n\r\n return function (aboutZAxis) {\r\n this._affectedObj.rotate(quat, this._mousePrevPos, this._mouseCurPos, aboutZAxis);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n };\r\n}());\r\n\r\n// rotate object by specified quaternion\r\nObjectControls.prototype.rotate = function (quat) {\r\n this.object.quaternion.multiply(quat);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n};\r\n\r\n// get object's orientation\r\nObjectControls.prototype.getOrientation = function () {\r\n return this.object.quaternion;\r\n};\r\n\r\n// set object's orientation\r\nObjectControls.prototype.setOrientation = function (quat) {\r\n this.object.quaternion.copy(quat);\r\n};\r\n\r\n// translate object based on latest mouse/touch movement\r\nObjectControls.prototype.translate = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this._affectedObj.translate(delta);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n };\r\n}());\r\n\r\n// get object scale\r\nObjectControls.prototype.getScale = function () {\r\n return this.object.scale.x;\r\n};\r\n\r\n// set uniform object scale\r\nObjectControls.prototype.setScale = function (scale) {\r\n this.object.scale.set(scale, scale, scale);\r\n};\r\n\r\n// scale object by factor (factor should be greater than zero)\r\nObjectControls.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n return;\r\n }\r\n this.setScale(this.object.scale.x * factor);\r\n this.dispatchEvent({ type: 'change', action: 'zoom', factor });\r\n};\r\n\r\nObjectControls.prototype.update = (function () {\r\n const shift = new THREE.Vector2();\r\n\r\n return function () {\r\n const curTime = this._clock.getElapsedTime();\r\n const timeSinceLastUpdate = curTime - this._lastUpdateTime;\r\n\r\n // update object handler\r\n if (this._state === STATE.NONE) {\r\n const timeSinceMove = curTime - this._lastMouseMoveTime;\r\n if (this._mainObj.update(timeSinceLastUpdate, timeSinceMove)\r\n || this._altObj.update(timeSinceLastUpdate, timeSinceMove)) {\r\n this.dispatchEvent({ type: 'change', action: 'auto' });\r\n }\r\n }\r\n\r\n // apply arrow keys\r\n if (this._isKeysTranslatingObj) {\r\n const speedX = Number(this._pressedKeys[VK_RIGHT]) - Number(this._pressedKeys[VK_LEFT]);\r\n const speedY = Number(this._pressedKeys[VK_UP]) - Number(this._pressedKeys[VK_DOWN]);\r\n if (speedX !== 0.0 || speedY !== 0.0) {\r\n const delta = timeSinceLastUpdate;\r\n\r\n // update object translation\r\n const altObj = this.getAltObj();\r\n if (altObj.objects.length > 0) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n\r\n shift.set(delta * speedX, delta * speedY);\r\n this._altObj.translate(shift);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n }\r\n }\r\n }\r\n\r\n this._lastUpdateTime = curTime;\r\n };\r\n}());\r\n\r\nObjectControls.prototype.reset = function () {\r\n this._state = STATE.NONE;\r\n\r\n this.object.quaternion.copy(quaternion.set(0, 0, 0, 1));\r\n};\r\n\r\n// listeners\r\n\r\nObjectControls.prototype.mousedown = function (event) {\r\n if (this.enabled === false || this._state !== STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (this._state === STATE.NONE) {\r\n if (event.button === 0) {\r\n this._affectedObj.stop(); // can edit only one object at a time\r\n\r\n let workWithAltObj = false;\r\n\r\n if (event.altKey) {\r\n const altObj = this.getAltObj();\r\n workWithAltObj = (altObj.objects.length > 0);\r\n if (workWithAltObj) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n this._affectedObj = workWithAltObj ? this._altObj : this._mainObj;\r\n\r\n this._state = (workWithAltObj && event.ctrlKey && this._isTranslationAllowed) ? STATE.TRANSLATE : STATE.ROTATE;\r\n } else if (event.button === 2) {\r\n this._state = STATE.TRANSLATE_PIVOT;\r\n }\r\n }\r\n\r\n if (this._state === STATE.ROTATE) {\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n\r\n if (this._state === STATE.TRANSLATE || this._state === STATE.TRANSLATE_PIVOT) {\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousemove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this.rotateByMouse((event.altKey && !this._isAltObjFreeRotationAllowed) || event.shiftKey);\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.TRANSLATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translate();\r\n break;\r\n\r\n case STATE.TRANSLATE_PIVOT:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translatePivotByMouse();\r\n break;\r\n\r\n default: break;\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousewheel = function (event) {\r\n if (this.enabled === false || !settings.now.zooming || this._state !== STATE.NONE || event.shiftKey) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n let delta = 0;\r\n\r\n if (event.wheelDelta) {\r\n // WebKit / Opera / Explorer 9\r\n delta = event.wheelDelta / 40;\r\n } else if (event.detail) {\r\n // Firefox\r\n delta = -event.detail / 3;\r\n }\r\n\r\n let factor = 1.0 + delta * 0.05;\r\n factor = Math.max(factor, 0.01);\r\n this.scale(factor);\r\n};\r\n\r\nObjectControls.prototype.mouseup = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n this._state = STATE.NONE;\r\n\r\n if (this._clock.getElapsedTime() - this._lastMouseMoveTime > FULL_STOP_THRESHOLD) {\r\n this._affectedObj.stop();\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchstartend = function (event) {\r\n if (this.enabled === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (event.touches.length) {\r\n case 1:\r\n this._state = STATE.ROTATE;\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n break;\r\n\r\n case 2: {\r\n // prevent inertial rotation\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n\r\n this._state = STATE.SCALE;\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = this._touchDistanceStart = Math.sqrt(dx * dx + dy * dy);\r\n this._scaleStart = this.object.scale.x;\r\n break;\r\n }\r\n\r\n default:\r\n this._state = STATE.NONE;\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchmove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this.rotateByMouse(false);\r\n\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.SCALE:\r\n if (settings.now.zooming) {\r\n // update scale\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = Math.sqrt(dx * dx + dy * dy);\r\n const newScale = this._scaleStart * this._touchDistanceCur / this._touchDistanceStart;\r\n const factor = newScale / this.object.scale.x;\r\n this.scale(factor);\r\n }\r\n break;\r\n\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.keydownup = function (event) {\r\n if (this.enabled === false || this.hotkeysEnabled === false) {\r\n return;\r\n }\r\n\r\n switch (event.keyCode) {\r\n case VK_LEFT:\r\n case VK_UP:\r\n case VK_RIGHT:\r\n case VK_DOWN:\r\n this._pressedKeys[event.keyCode] = (event.type === 'keydown');\r\n event.preventDefault();\r\n event.stopPropagation();\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.getKeyBindObject = function () {\r\n return window.top;\r\n};\r\n\r\n\r\nObjectControls.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nObjectControls.prototype.translatePivotByMouse = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this.translatePivotInWorld(settings.now.translationSpeed * delta.x, settings.now.translationSpeed * delta.y, 0);\r\n };\r\n}());\r\n\r\n// Translate in WorldCS, translation is scaled with root scale matrix\r\nObjectControls.prototype.translatePivotInWorld = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.applyMatrix4(this.object.matrixWorld);\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n pos.applyMatrix4(matrix4.getInverse(this.object.matrixWorld));\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Translate in ModelCS, x, y, z are Ang\r\nObjectControls.prototype.translatePivot = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Set pivot\r\nObjectControls.prototype.setPivot = function (newPivot) {\r\n this.objectPivot.position.copy(newPivot);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\nexport default ObjectControls;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\nimport Timer from '../Timer';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\n\r\nfunction Picker(gfxObj, camera, domElement) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.gfxObj = gfxObj;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n this._lastMousePos = new THREE.Vector2(0, 0);\r\n this._mouseTotalDist = 0.0;\r\n this._lastClickBeginTime = -1000.0;\r\n this._lastClickPos = new THREE.Vector2(0, 0);\r\n this._clickBeginTime = 0.0;\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstart(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchend(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n}\r\n\r\nPicker.prototype = Object.create(EventDispatcher.prototype);\r\nPicker.prototype.constructor = Picker;\r\n\r\nPicker.prototype.reset = function () {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n};\r\n\r\nPicker.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nPicker.prototype.pickObject = function (screenPos) {\r\n if (!this.gfxObj) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n const { gfxObj } = this;\r\n const rayCaster = new THREE.Raycaster();\r\n rayCaster.ray.origin.setFromMatrixPosition(this.camera.matrixWorld);\r\n rayCaster.ray.direction.set(screenPos.x, screenPos.y, 0.5).unproject(this.camera).sub(rayCaster.ray.origin).normalize();\r\n\r\n const clipPlane = (settings.now.draft.clipPlane && this.clipPlaneValue) ? this.clipPlaneValue : Infinity;\r\n const fogFarPlane = (settings.now.fog && this.fogFarValue) ? this.fogFarValue : Infinity;\r\n const point = rayCaster.intersectVisibleObject(gfxObj, this.camera, clipPlane, fogFarPlane);\r\n if (!point) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n let picked = {};\r\n if (point.residue || point.atom) {\r\n const residue = point.residue || point.atom.residue;\r\n if (settings.now.pick === 'chain') {\r\n picked = { chain: residue.getChain() };\r\n } else if (settings.now.pick === 'molecule') {\r\n picked = { molecule: residue.getMolecule() };\r\n } else if (point.residue || settings.now.pick === 'residue') {\r\n picked = { residue };\r\n } else if (point.atom) {\r\n picked = { atom: point.atom };\r\n }\r\n }\r\n this.picked = picked;\r\n this.dispatchEvent({ type: 'newpick', obj: picked });\r\n};\r\n\r\nPicker.prototype.getMouseInViewport = function (pageX, pageY) {\r\n return new THREE.Vector2(\r\n (pageX - this.screen.left) / this.screen.width * 2 - 1,\r\n -(pageY - this.screen.top) / this.screen.height * 2 + 1,\r\n );\r\n};\r\n\r\nPicker.prototype.mousedown = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n this._lastMousePos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist = 0.0;\r\n this._clickBeginTime = this._clock.getElapsedTime();\r\n }\r\n};\r\n\r\nPicker.prototype.mousemove = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n const pos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist += pos.sub(this._lastMousePos).length();\r\n};\r\n\r\nPicker.prototype.mouseup = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n if (this._mouseTotalDist < 0.01) {\r\n const curTime = this._clock.getElapsedTime();\r\n const curPos = this.getMouseInViewport(event.pageX, event.pageY);\r\n\r\n const timeSinceLastClickBegin = curTime - this._lastClickBeginTime;\r\n if (timeSinceLastClickBegin < 0.7) {\r\n const clickDist = new THREE.Vector2().subVectors(curPos, this._lastClickPos);\r\n if (clickDist.length() < 0.01) {\r\n // it's a double click\r\n this.dispatchEvent({ type: 'dblclick', obj: this.picked });\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = -1000; // this click cannot serve as first click in double-click\r\n return;\r\n }\r\n }\r\n\r\n setTimeout(() => {\r\n self.pickObject(curPos);\r\n }, 0);\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = this._clickBeginTime;\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.touchstart = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 1) {\r\n this._lastTouchdownPos = this.getMouseInViewport(event.touches[0].pageX, event.touches[0].pageY);\r\n }\r\n};\r\n\r\nPicker.prototype.touchend = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 0\r\n && event.changedTouches.length === 1) {\r\n const pos = this.getMouseInViewport(event.changedTouches[0].pageX, event.changedTouches[0].pageY);\r\n const dist = pos.sub(this._lastTouchdownPos).length();\r\n if (dist < 0.01) {\r\n setTimeout(() => {\r\n self.pickObject(self._lastTouchdownPos);\r\n }, 0);\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nexport default Picker;\r\n","import * as THREE from 'three';\r\n\r\nclass Axes {\r\n constructor(target, targetCamera) {\r\n this._target = target;\r\n this._targetCamera = targetCamera;\r\n this._camera = new THREE.PerspectiveCamera(targetCamera.fov, targetCamera.aspect, 1, 100);\r\n this._object = new THREE.AxesHelper(1);\r\n this._scene = new THREE.Scene();\r\n this._scene.add(this._object);\r\n this._full = new THREE.Vector2();\r\n\r\n this._update();\r\n }\r\n\r\n _update() {\r\n const { fov } = this._targetCamera;\r\n const camera = this._camera;\r\n camera.aspect = this._targetCamera.aspect;\r\n camera.setMinimalFov(fov);\r\n camera.setDistanceToFit(1.0, fov);\r\n camera.updateProjectionMatrix();\r\n\r\n this._object.quaternion.copy(this._target.quaternion);\r\n }\r\n\r\n render(renderer) {\r\n this._update();\r\n\r\n renderer.getSize(this._full);\r\n const width = this._full.width * 0.25;\r\n const height = this._full.height * 0.25;\r\n\r\n const { autoClear } = renderer;\r\n renderer.autoClear = false;\r\n renderer.setViewport(0.0, 0.0, width, height);\r\n renderer.clear(false, true, false);\r\n renderer.render(this._scene, this._camera);\r\n renderer.setViewport(0, 0, this._full.width, this._full.height);\r\n renderer.autoClear = autoClear;\r\n }\r\n}\r\nexport default Axes;\r\n","import * as THREE from 'three';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\n\r\nconst cDataOffset = 12;\r\nconst cFirstMask = 0x0FFFFF00;\r\nconst cFirstShift = 8;\r\nconst cSecMask1 = 0x000000FF;\r\nconst cSecShift1 = 12;\r\nconst cSecMask2 = 0xFFF00000;\r\nconst cSecShift2 = 20;\r\nconst cThirdMask = 0x000FFFFF;\r\nconst cStrMask = 0xF0000000;\r\nconst cStrShift = 28;\r\nconst c219 = 1 << 19;\r\nconst c220 = 1 << 20;\r\n\r\nconst cHelixIdx = 1;\r\nconst cSheetIdx = 2;\r\nconst secTypes = ['helix', 'strand'];\r\nconst cSecNames = ['fs', 'ps', 'ns', 'us'];\r\n\r\nfunction _createSecondary(strArray, complex) {\r\n const residues = complex._residues;\r\n const nRes = residues.length;\r\n const resid = new Uint8Array(nRes);\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, n = strArray.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n resid[atom.residue._index] = strArray[i];\r\n }\r\n\r\n const secondary = [];\r\n let rIdx = 0;\r\n while (rIdx < nRes) {\r\n if (resid[rIdx] !== 0) {\r\n const start = rIdx;\r\n const val = resid[rIdx];\r\n while (rIdx < nRes - 1 && resid[rIdx + 1] === val\r\n && residues[rIdx].isConnected(residues[rIdx + 1])) {\r\n ++rIdx;\r\n }\r\n secondary.push({ start, end: rIdx, type: secTypes[val - 1] });\r\n }\r\n ++rIdx;\r\n }\r\n return secondary;\r\n}\r\n\r\nfunction fromUInt20ToInt20(uint20) {\r\n return uint20 >= c219 ? uint20 - c220 : uint20;\r\n}\r\n\r\nclass FrameInfo {\r\n constructor(complex, payload, callbacks) {\r\n this._complex = complex;\r\n this._secondary = null;\r\n this.isLoading = false;\r\n this._framesRange = {\r\n start: 0,\r\n end: -1,\r\n };\r\n this.frameIsReady = false;\r\n this._buffer = null;\r\n this._frameRequest = null;\r\n this._callbacks = callbacks;\r\n if (typeof payload === 'function') {\r\n this._framesRequestLength = 1;\r\n this._downloadDataFn = payload;\r\n } else {\r\n this.parseBinaryData(payload, true);\r\n }\r\n this.reset();\r\n this.setFrame(0);\r\n }\r\n\r\n _prepareBuffer(framesStart, framesEnd) {\r\n if (framesStart === undefined || framesStart === null) {\r\n framesStart = 0;\r\n }\r\n if (framesEnd === undefined || framesEnd === null) {\r\n framesEnd = framesStart + this._framesRequestLength;\r\n }\r\n if (this._framesCount !== undefined) {\r\n framesEnd = Math.min(this._framesCount - 1, framesEnd);\r\n }\r\n if (this._downloadDataFn) {\r\n const self = this;\r\n const onDone = function (data) {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n self._buffer = {\r\n data,\r\n state: 'ready',\r\n start: framesStart,\r\n end: framesEnd,\r\n };\r\n if (self._frameRequest !== null) {\r\n const idx = self._frameRequest;\r\n self._frameRequest = null;\r\n self.setFrame(idx);\r\n }\r\n };\r\n const onFail = function () {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onError === 'function') {\r\n self._callbacks.onError('Streaming failed');\r\n }\r\n };\r\n if (!this._buffer) {\r\n this._buffer = {};\r\n }\r\n this._buffer.state = 'downloading';\r\n this.isLoading = true;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n this._downloadDataFn({ start: framesStart, end: framesEnd + 1 }, onDone, onFail);\r\n }\r\n }\r\n\r\n _parseBuffer() {\r\n if (this._buffer && this._buffer.state === 'ready') {\r\n this._framesRange = {\r\n start: this._buffer.start,\r\n end: this._buffer.end,\r\n };\r\n this.parseBinaryData(this._buffer.data, false);\r\n let _bufferRequestStart = (this._buffer.end + 1) % this._framesCount;\r\n if (_bufferRequestStart >= this._framesCount) {\r\n _bufferRequestStart = 0;\r\n }\r\n this._buffer = {\r\n state: 'none',\r\n };\r\n this._prepareBuffer(_bufferRequestStart, _bufferRequestStart + this._framesRequestLength);\r\n if (this._frameRequest !== null) {\r\n const idx = this._frameRequest;\r\n this._frameRequest = null;\r\n this.setFrame(idx);\r\n }\r\n }\r\n }\r\n\r\n parseBinaryData(arrayBuffer) {\r\n const dataView = new DataView(arrayBuffer);\r\n let offset = 0;\r\n const atomsCount = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const framesCount = dataView.getUint32(offset, true);\r\n this._framesCount = framesCount;\r\n this._framesRange.end = this._framesRange.end > 0\r\n ? Math.min(this._framesRange.end, framesCount - 1) : framesCount - 1;\r\n offset += 4;\r\n this._atomsCount = atomsCount;\r\n const maxSize = 1024 * 1024; // 1 MB\r\n this._framesRequestLength = Math.ceil(maxSize / (atomsCount * 8));\r\n const chunkedFramesCount = this._framesRange.end - this._framesRange.start + 1;\r\n if (atomsCount !== this._complex._atoms.length\r\n || arrayBuffer.byteLength !== cDataOffset + chunkedFramesCount * atomsCount * 8) {\r\n throw new Error();\r\n }\r\n const complex = this._complex;\r\n let timeStep = dataView.getUint32(offset, true);\r\n let iName = 0;\r\n while (timeStep > 1000 && iName < cSecNames.length - 1) {\r\n timeStep /= 1000;\r\n ++iName;\r\n }\r\n\r\n this._timeStep = `${timeStep.toString()} ${cSecNames[iName]}`;\r\n offset += 4;\r\n const secondary = [];\r\n const posData = new Float32Array(chunkedFramesCount * atomsCount * 3);\r\n let coordIdx = 0;\r\n const secondaryArr = new Int8Array(atomsCount);\r\n for (let j = 0; j < chunkedFramesCount; ++j) {\r\n for (let i = 0; i < atomsCount; ++i) {\r\n const hiWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const loWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const str = (loWord & cStrMask) >>> cStrShift;\r\n const x = fromUInt20ToInt20(((loWord & cFirstMask) >>> cFirstShift) >> 0);\r\n const y = fromUInt20ToInt20((((loWord & cSecMask1) << cSecShift1)\r\n | ((hiWord & cSecMask2) >>> cSecShift2)) >> 0);\r\n const z = fromUInt20ToInt20((hiWord & cThirdMask) >> 0);\r\n secondaryArr[i] = 0;\r\n if (str > 0 && str < 4) {\r\n secondaryArr[i] = cHelixIdx;\r\n } else if (str === 4) {\r\n secondaryArr[i] = cSheetIdx;\r\n }\r\n posData[coordIdx++] = x / 100;\r\n posData[coordIdx++] = y / 100;\r\n posData[coordIdx++] = z / 100;\r\n }\r\n secondary.push(_createSecondary(secondaryArr, complex));\r\n }\r\n this._secondaryData = secondary;\r\n this._data = posData;\r\n }\r\n\r\n nextFrame() {\r\n this.setFrame((this._currFrame + 1) % this._framesCount);\r\n }\r\n\r\n needsColorUpdate(colorer) {\r\n return colorer instanceof SecondaryStructureColorer;\r\n }\r\n\r\n getAtomColor(colorer, atom) {\r\n return colorer.getResidueColor(this._residues[atom.residue._index], this._complex);\r\n }\r\n\r\n getResidueColor(colorer, residue) {\r\n return colorer.getResidueColor(this._residues[residue._index], this._complex);\r\n }\r\n\r\n _updateSecondary() {\r\n let i;\r\n const myResidues = this._residues;\r\n let n = myResidues.length;\r\n for (i = 0; i < n; ++i) {\r\n myResidues[i]._secondary = null;\r\n }\r\n const sec = this._secondaryData[this._currFrame - this._framesRange.start];\r\n for (i = 0, n = sec.length; i < n; ++i) {\r\n const oldSec = sec[i];\r\n const { start, end } = oldSec;\r\n const nSec = {\r\n _start: myResidues[start],\r\n _end: myResidues[end],\r\n type: oldSec.type,\r\n generic: oldSec.generic,\r\n };\r\n for (let j = start; j <= end; ++j) {\r\n myResidues[j]._secondary = nSec;\r\n }\r\n }\r\n }\r\n\r\n reset() {\r\n const compRes = this._complex._residues;\r\n const n = compRes.length;\r\n this._residues = new Array(n);\r\n const myResidues = this._residues;\r\n const getSec = function () {\r\n return this._secondary;\r\n };\r\n for (let i = 0; i < n; ++i) {\r\n myResidues[i] = {\r\n _type: compRes[i]._type,\r\n _isValid: compRes[i]._isValid,\r\n _controlPoint: null,\r\n _wingVector: null,\r\n _secondary: null,\r\n getSecondary: getSec,\r\n };\r\n }\r\n }\r\n\r\n setFrame(frameIdx) {\r\n this.frameIsReady = false;\r\n if (frameIdx >= this._framesRange.start && frameIdx <= this._framesRange.end) {\r\n this._currFrame = frameIdx;\r\n this._cachedResidues = false;\r\n this._updateSecondary();\r\n this.frameIsReady = true;\r\n } else {\r\n this._frameRequest = frameIdx;\r\n if (!this._buffer) {\r\n this._prepareBuffer(frameIdx);\r\n } else {\r\n const self = this;\r\n switch (this._buffer.state) {\r\n case 'none':\r\n this._prepareBuffer(frameIdx);\r\n break;\r\n case 'ready':\r\n self._parseBuffer();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n disableEvents() {\r\n this._callbacks = null;\r\n }\r\n\r\n /**\r\n * Returns link to atom pos vector, clone it if needed\r\n */\r\n\r\n static _vec = new THREE.Vector3();\r\n\r\n getAtomPos(atomIdx) {\r\n const vec = FrameInfo._vec;\r\n const self = this;\r\n const data = self._data;\r\n const idx = (self._atomsCount * (self._currFrame - self._framesRange.start) + atomIdx) * 3;\r\n vec.set(data[idx], data[idx + 1], data[idx + 2]);\r\n return vec;\r\n }\r\n\r\n\r\n getResidues() {\r\n if (this._cachedResidues) {\r\n return this._residues;\r\n }\r\n this._complex.updateToFrame(this);\r\n return this._residues;\r\n }\r\n}\r\nexport default FrameInfo;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\n\r\n/**\r\n * Create new scene object.\r\n *\r\n * @param {array=} params - Object required params.\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports SceneObject\r\n * @this SceneObject\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all scene objects that are not reps.\r\n */\r\nclass SceneObject {\r\n constructor(params, opts) {\r\n if (this.constructor === SceneObject) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Object's options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.params = params;\r\n this.opts = _.merge(utils.deriveDeep(settings.now.objects[this.type], true), opts);\r\n this.needsRebuild = false;\r\n this._mesh = null;\r\n this.id = null;\r\n }\r\n\r\n /**\r\n * Get object identification, probably with options.\r\n * @returns {Object} field type contains type information, params - object's formal parameters,\r\n * opts - changed options\r\n * Options are returned if they were changed during or after object creation.\r\n */\r\n identify() {\r\n const result = {\r\n type: this.type,\r\n params: this.params,\r\n };\r\n const diff = utils.objectsDiff(this.opts, settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n result.opts = diff;\r\n }\r\n return result;\r\n }\r\n\r\n toString() {\r\n const paramsStr = `o=${this.type},${this.params.join(',')}`;\r\n const optsStr = utils.compareOptionsWithDefaults(this.opts, settings.defaults.objects[this.type]);\r\n return paramsStr + optsStr;\r\n }\r\n\r\n getGeometry() {\r\n return this._mesh;\r\n }\r\n\r\n destroy() {\r\n if (this._mesh) {\r\n gfxutils.destroyObject(this._mesh);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Scene object identifier.\r\n * @type {string}\r\n */\r\nSceneObject.prototype.type = '__';\r\n\r\nexport default SceneObject;\r\n","import * as THREE from 'three';\r\nimport SceneObject from './SceneObject';\r\nimport gfxutils from '../gfxutils';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\nimport meshes from '../meshes/meshes';\r\nimport settings from '../../settings';\r\n\r\nclass LinesObj extends SceneObject {\r\n constructor(params, opts) {\r\n super(params, opts);\r\n if (params.length < 2) {\r\n throw new Error('Wrong number of argumets on line object creation!');\r\n }\r\n [this._id1, this._id2] = params;\r\n }\r\n\r\n _getAtomFromName(complex, atomId) {\r\n const err = ' - Wrong atom format it must be \\'#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME\\' (e.g. \\'A.38.CO1\\')';\r\n const atom1 = complex.getAtomByFullname(atomId);\r\n if (!atom1) {\r\n throw new Error(atomId + err);\r\n }\r\n return atom1;\r\n }\r\n\r\n build(complex) {\r\n const geom = new THREE.Geometry();\r\n this._atom1 = this._getAtomFromName(complex, this._id1);\r\n this._atom2 = this._getAtomFromName(complex, this._id2);\r\n\r\n geom.vertices[0] = this._atom1.position.clone();\r\n geom.vertices[1] = this._atom2.position.clone();\r\n geom.dynamic = true;\r\n geom.computeBoundingBox();\r\n\r\n this._line = new meshes.Line(geom, new UberMaterial({\r\n lights: false,\r\n overrideColor: true,\r\n dashedLine: true,\r\n fogTransparent: settings.now.bg.transparent,\r\n }));\r\n this._line.computeLineDistances();\r\n this._line.material.setUberOptions({\r\n fixedColor: new THREE.Color(this.opts.color),\r\n dashedLineSize: this.opts.dashSize,\r\n dashedLinePeriod: this.opts.dashSize + this.opts.gapSize,\r\n });\r\n this._line.material.updateUniforms();\r\n\r\n this._line.raycast = function (_raycaster, _intersects) {};\r\n this._mesh = this._line;\r\n const transforms = complex.getTransforms();\r\n if (transforms.length > 0) {\r\n this._mesh = new THREE.Group();\r\n this._mesh.add(this._line);\r\n gfxutils.applyTransformsToMeshes(this._mesh, transforms);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n if (!this._atom1 || !this._atom2 || !this._line) {\r\n return;\r\n }\r\n\r\n const geo = this._line.geometry;\r\n geo.vertices[0].copy(frameData.getAtomPos(this._atom1.index));\r\n geo.vertices[1].copy(frameData.getAtomPos(this._atom2.index));\r\n this._line.computeLineDistances();\r\n geo.computeBoundingSphere();\r\n\r\n geo.verticesNeedUpdate = true;\r\n }\r\n}\r\n\r\nLinesObj.prototype.constructor = LinesObj;\r\nLinesObj.prototype.type = 'line';\r\n\r\nexport default LinesObj;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Outline.frag';\r\n\r\nclass OutlineMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n // add depth outline\r\n super(params);\r\n\r\n const settings = {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcDepthTex: { type: 't', value: null },\r\n srcTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n color: { type: 'v3', value: null },\r\n threshold: { type: 'f', value: null },\r\n opacity: { type: 'f', value: 1.0 },\r\n thickness: { type: 'v2', value: new THREE.Vector2(1, 1) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: true,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n\r\n this.setValues(settings);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n const defines = {};\r\n\r\n if (this.depth) {\r\n defines.DEPTH_OUTLINE = 1;\r\n }\r\n\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nOutlineMaterial.prototype.depth = false;\r\n\r\nexport default OutlineMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './FXAA.frag';\r\n\r\nclass FXAAMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n bgColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.bgTransparent) {\r\n defines.BG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nFXAAMaterial.prototype.bgTransparent = false;\r\n\r\nexport default FXAAMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AO.frag';\r\nimport noise from '../noiseTexture';\r\n\r\nconst _samplesKernel = [\r\n // hemisphere samples adopted to sphere\r\n new THREE.Vector3(0.295184, 0.077723, 0.068429),\r\n new THREE.Vector3(-0.271976, -0.365221, 0.838363),\r\n new THREE.Vector3(0.547713, 0.467576, 0.488515),\r\n new THREE.Vector3(0.662808, -0.031733, 0.584758),\r\n new THREE.Vector3(-0.025717, 0.218955, 0.657094),\r\n new THREE.Vector3(-0.310153, -0.365223, 0.370701),\r\n new THREE.Vector3(-0.101407, -0.006313, 0.747665),\r\n new THREE.Vector3(-0.769138, 0.360399, 0.086847),\r\n new THREE.Vector3(-0.271988, -0.275140, 0.905353),\r\n new THREE.Vector3(0.096740, -0.566901, 0.700151),\r\n new THREE.Vector3(0.562872, -0.735136, 0.094647),\r\n new THREE.Vector3(0.379877, 0.359278, 0.190061),\r\n new THREE.Vector3(0.519064, -0.023055, 0.405068),\r\n new THREE.Vector3(-0.301036, 0.114696, 0.088885),\r\n new THREE.Vector3(-0.282922, 0.598305, 0.487214),\r\n new THREE.Vector3(-0.181859, 0.251670, 0.679702),\r\n new THREE.Vector3(-0.191463, -0.635818, 0.512919),\r\n new THREE.Vector3(-0.293655, 0.427423, 0.078921),\r\n new THREE.Vector3(-0.267983, 0.680534, 0.132880),\r\n new THREE.Vector3(0.139611, 0.319637, 0.477439),\r\n new THREE.Vector3(-0.352086, 0.311040, 0.653913),\r\n new THREE.Vector3(0.321032, 0.805279, 0.487345),\r\n new THREE.Vector3(0.073516, 0.820734, 0.414183),\r\n new THREE.Vector3(-0.155324, 0.589983, 0.411460),\r\n new THREE.Vector3(0.335976, 0.170782, 0.527627),\r\n new THREE.Vector3(0.463460, -0.355658, 0.167689),\r\n new THREE.Vector3(0.222654, 0.596550, 0.769406),\r\n new THREE.Vector3(0.922138, -0.042070, 0.147555),\r\n new THREE.Vector3(-0.727050, -0.329192, 0.369826),\r\n new THREE.Vector3(-0.090731, 0.533820, 0.463767),\r\n new THREE.Vector3(-0.323457, -0.876559, 0.238524),\r\n new THREE.Vector3(-0.663277, -0.372384, 0.342856),\r\n];\r\n\r\nclass AOMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n noiseTexture: { type: 't', value: noise.noiseTexture },\r\n noiseTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight) },\r\n diffuseTexture: { type: 't', value: null },\r\n normalTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n camNearFar: { type: 'v2', value: new THREE.Vector2(1.0, 10.0) },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n samplesKernel: { type: 'v3v', value: _samplesKernel },\r\n kernelRadius: { type: 'f', value: 1.0 },\r\n depthThreshold: { type: 'f', value: 1.0 },\r\n factor: { type: 'f', value: 1.0 },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOHorBlur.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOHorBlurMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOHorBlurMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOVertBlurWithBlend.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOVertBlurWithBlendMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n diffuseTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n fogNearFar: { type: 'v2', value: new THREE.Vector2(100.0, 100.0) },\r\n fogColor: { type: 'v4', value: new THREE.Vector4(0.0, 0.5, 0.0, 1.0) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.useFog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nAOVertBlurWithBlendMaterial.prototype.useFog = true;\r\nAOVertBlurWithBlendMaterial.prototype.fogTransparent = false;\r\n\r\nexport default AOVertBlurWithBlendMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Anaglyph.frag';\r\n\r\nclass AnaglyphMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n const settings = {\r\n uniforms: {\r\n srcL: { type: 't', value: null },\r\n srcR: { type: 't', value: null },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n this.setValues(settings);\r\n }\r\n}\r\n\r\nexport default AnaglyphMaterial;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\n\r\nclass View {\r\n constructor() {\r\n this.position = new THREE.Vector3(0, 0, 0);\r\n this.scale = 1;\r\n this.orientation = new THREE.Quaternion(0, 0, 0, 1);\r\n }\r\n\r\n set(position, scale, orientation) {\r\n this.position = position;\r\n this.scale = scale;\r\n this.orientation = orientation;\r\n }\r\n}\r\n\r\nconst _transitionTime = 1.5; // in seconds\r\n\r\nexport default class ViewInterpolator {\r\n setup(startView, endView) {\r\n this._startTime = undefined;\r\n this._endTime = undefined;\r\n this._isPaused = false;\r\n\r\n this._srcView = startView;\r\n this._dstView = endView;\r\n this._isMoving = false;\r\n }\r\n\r\n isMoving() {\r\n return this._isMoving;\r\n }\r\n\r\n wasStarted() {\r\n return typeof this._startTime !== 'undefined' && typeof this._endTime !== 'undefined';\r\n }\r\n\r\n start() {\r\n this._startTime = Date.now();\r\n const transTime = settings.now.interpolateViews ? _transitionTime * 1000 : 0;\r\n this._endTime = this._startTime + transTime;\r\n this._isMoving = true;\r\n }\r\n\r\n getCurrentView() {\r\n if (typeof this._srcView === 'undefined' || typeof this._dstView === 'undefined'\r\n || !this._isMoving || !this.wasStarted()) {\r\n return { success: false };\r\n }\r\n\r\n let view = this.createView();\r\n const time = Date.now();\r\n if (time > this._endTime) {\r\n view = this._dstView;\r\n this.reset();\r\n return { success: true, view };\r\n }\r\n\r\n const factor = (time - this._startTime) / (this._endTime - this._startTime);\r\n view.position.copy(this._srcView.position);\r\n view.position.lerp(this._dstView.position, factor);\r\n view.scale = (1 - factor) * this._srcView.scale + factor * this._dstView.scale;\r\n view.orientation.copy(this._srcView.orientation);\r\n view.orientation.slerp(this._dstView.orientation, factor);\r\n return { success: true, view };\r\n }\r\n\r\n reset() {\r\n this._startTime = this._endTime = 0;\r\n this._isMoving = false;\r\n }\r\n\r\n pause() {\r\n if (!this._isPaused) {\r\n this.setup(this.getCurrentView().view, this._dstView);\r\n this._isPaused = true;\r\n }\r\n }\r\n\r\n resume() {\r\n this._isPaused = false;\r\n }\r\n\r\n createView() {\r\n return new View();\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport makeContextDependent from './makeContextDependent';\r\n\r\nconst MAX_COOKIE_LEN = 4000;\r\nconst COUNT_SUFFIX = 'Cnt';\r\n\r\nfunction _chunkString(string, chunkLen) {\r\n const l = string.length;\r\n const chunks = [];\r\n for (let c = 0, lc = 0; lc < l; c++, lc += chunkLen) {\r\n chunks[c] = string.slice(lc, lc + chunkLen);\r\n }\r\n return chunks;\r\n}\r\n\r\n/**\r\n * Create new context dependent Cookie holder object.\r\n * @param context\r\n * @param {Object} opts - options\r\n * @param {string} opts.path - cookie path\r\n * @constructor\r\n */\r\nfunction Cookies(context, opts) {\r\n this.context = context;\r\n this._opts = _.merge({\r\n path: '/',\r\n }, opts);\r\n}\r\n\r\nmakeContextDependent(Cookies.prototype);\r\n\r\n/**\r\n * Remove cookie by the name.\r\n * @param key\r\n */\r\nCookies.prototype.removeCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n this._removeSimpleCookie(key);\r\n return;\r\n }\r\n this._removeSimpleCookie(cntKey);\r\n cntVal = parseInt(cntVal, 10);\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._removeSimpleCookie(key + i);\r\n }\r\n};\r\n\r\n/**\r\n * Set new cookie value. Automatically splits\r\n * values that are too large into multiple cookies.\r\n * @param key\r\n * @param value\r\n */\r\nCookies.prototype.setCookie = function (key, value) {\r\n this.removeCookie(key);\r\n value = encodeURIComponent(value);\r\n const values = _chunkString(value, MAX_COOKIE_LEN - key.length - 1);\r\n const cntVal = values.length;\r\n if (cntVal === 1) {\r\n this._setSimpleCookie(key, value);\r\n return;\r\n }\r\n const cntKey = this._toCount(key);\r\n this._setSimpleCookie(cntKey, cntVal.toString());\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._setSimpleCookie(key + i, values[i]);\r\n }\r\n};\r\n\r\n/**\r\n * Obtain the value of a compound cookie.\r\n * @param key\r\n */\r\nCookies.prototype.getCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n return this._getSimpleCookie(key);\r\n }\r\n cntVal = parseInt(cntVal, 10);\r\n const value = [];\r\n for (let i = 0; i < cntVal; ++i) {\r\n value[i] = this._getSimpleCookie(key + i);\r\n }\r\n return value.join('');\r\n};\r\n\r\nCookies.prototype._toCount = function (key) {\r\n return key + COUNT_SUFFIX;\r\n};\r\n\r\nCookies.prototype._removeSimpleCookie = function (key) {\r\n document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\r\n};\r\n\r\nCookies.prototype._getExpirationDate = function () {\r\n const today = new Date();\r\n const EXP_PERIOD_YEARS = 10;\r\n today.setFullYear(today.getFullYear() + EXP_PERIOD_YEARS);\r\n return today;\r\n};\r\n\r\nCookies.prototype._setSimpleCookie = function (key, value) {\r\n document.cookie = `${key}=${value\r\n };expires=${this._getExpirationDate().toUTCString()\r\n };path=${this._opts.path}`;\r\n};\r\n\r\nCookies.prototype._getSimpleCookie = function (key) {\r\n const matches = document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n return matches ? decodeURIComponent(matches[1]) : '';\r\n};\r\n\r\nCookies.prototype._exists = function (key) {\r\n return document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n};\r\n\r\nexport default Cookies;\r\n","/*\r\n * Toggling WebVR is done through button.click because of limitations on calling requestPresent in webVR:\r\n * VRDisplay::requestPresent should be called from user gesture:\r\n * https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestPresent\r\n */\r\nexport default function (webVRPoC) {\r\n function showEnterVR(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'pointer';\r\n button.style.left = 'calc(50% - 50px)';\r\n button.style.width = '100px';\r\n\r\n button.textContent = 'ENTER VR';\r\n\r\n let currentSession = null;\r\n\r\n function onSessionEnded(/* event */) {\r\n currentSession.removeEventListener('end', onSessionEnded);\r\n button.textContent = 'ENTER VR';\r\n currentSession = null;\r\n }\r\n\r\n function onSessionStarted(session) {\r\n session.addEventListener('end', onSessionEnded);\r\n webVRPoC._gfx.renderer.xr.setReferenceSpaceType('local');\r\n webVRPoC._gfx.renderer.xr.setSession(session);\r\n button.textContent = 'EXIT VR';\r\n currentSession = session;\r\n }\r\n\r\n button.onmouseenter = function () { button.style.opacity = '1.0'; };\r\n button.onmouseleave = function () { button.style.opacity = '0.5'; };\r\n\r\n button.onclick = function () {\r\n if (currentSession === null) {\r\n // WebXR's requestReferenceSpace only works if the corresponding feature\r\n // was requested at session creation time. For simplicity, just ask for\r\n // the interesting ones as optional features, but be aware that the\r\n // requestReferenceSpace call will fail if it turns out to be unavailable.\r\n // ('local' is always available for immersive sessions and doesn't need to\r\n // be requested separately.)\r\n\r\n const sessionInit = { optionalFeatures: ['local-floor', 'bounded-floor'] };\r\n navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted);\r\n webVRPoC.moveSceneBehindHeadset();\r\n } else {\r\n currentSession.end();\r\n }\r\n };\r\n }\r\n\r\n function showWebXRNotFound(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'auto';\r\n button.style.left = 'calc(50% - 75px)';\r\n button.style.width = '150px';\r\n button.textContent = 'VR NOT FOUND';\r\n button.onmouseenter = null;\r\n button.onmouseleave = null;\r\n button.onclick = null;\r\n }\r\n\r\n function stylizeElement(element) {\r\n element.style.position = 'absolute';\r\n element.style.bottom = '20px';\r\n element.style.padding = '12px 6px';\r\n element.style.border = '1px solid #fff';\r\n element.style.borderRadius = '4px';\r\n element.style.background = 'transparent';\r\n element.style.color = '#fff';\r\n element.style.font = 'normal 13px sans-serif';\r\n element.style.textAlign = 'center';\r\n element.style.opacity = '0.5';\r\n element.style.outline = 'none';\r\n element.style.zIndex = '999';\r\n }\r\n\r\n if ('xr' in navigator) {\r\n const button = document.createElement('button');\r\n button.style.display = 'none';\r\n stylizeElement(button);\r\n navigator.xr.isSessionSupported('immersive-vr').then((supported) => (\r\n supported ? showEnterVR(button) : showWebXRNotFound(button)\r\n ));\r\n return button;\r\n }\r\n const message = document.createElement('a');\r\n message.href = 'https://webvr.info';\r\n message.innerHTML = 'WEBXR NOT SUPPORTED';\r\n message.style.left = 'calc(50% - 90px)';\r\n message.style.width = '180px';\r\n message.style.textDecoration = 'none';\r\n stylizeElement(message);\r\n return message;\r\n}\r\n","import * as THREE from 'three';\r\nimport createWebVRButton from './createWebVRButton';\r\nimport gfxutils from '../gfxutils';\r\nimport logger from '../../utils/logger';\r\nimport settings from '../../settings';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default class WebVRPoC {\r\n constructor(onToggle) {\r\n this._mainCamera = new THREE.PerspectiveCamera();\r\n this._button = null;\r\n this._onToggle = onToggle;\r\n\r\n this._molContainer = new gfxutils.RCGroup();\r\n this._user = new gfxutils.RCGroup();\r\n this._scalingPivot = new THREE.Object3D();\r\n this._user.add(this._scalingPivot);\r\n\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n this._pressedGripsCounter = 0;\r\n this._distance = 0;\r\n\r\n this._gfx = null;\r\n }\r\n\r\n startScalingByControllers() {\r\n // reset scale\r\n this._distance = this._controller1.position.distanceTo(this._controller2.position);\r\n gfxutils.getMiddlePoint(this._controller1.position, this._controller2.position, this._scalingPivot.position);\r\n this._scalingPivot.scale.set(1, 1, 1);\r\n this._scalingPivot.updateMatrix();\r\n this._scalingPivot.updateMatrixWorld();\r\n // link molecule to pivot\r\n this._scalingPivot.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n stopScalingByControllers() {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n handleGripsDown(event) {\r\n this._pressedGripsCounter++;\r\n if (this._pressedGripsCounter === 2) {\r\n this.startScalingByControllers();\r\n } else if (this._pressedGripsCounter === 1) {\r\n event.target.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n handleGripsUp(event) {\r\n this._pressedGripsCounter--;\r\n if (this._pressedGripsCounter === 1) {\r\n this.stopScalingByControllers();\r\n // reattach molecule to other controller\r\n const anotherController = event.target === this._controller1 ? this._controller2 : this._controller1;\r\n anotherController.addSavingWorldTransform(this._molContainer);\r\n } else if (this._pressedGripsCounter === 0) {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n enable(gfx) {\r\n if (!gfx) {\r\n logger.warn('WebVR couldn\\'t be enabled, because gfx is not defined');\r\n return;\r\n }\r\n this._gfx = gfx;\r\n const { renderer, camera } = gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n if (!camera) {\r\n throw new Error('No camera is available to toggle WebVR');\r\n }\r\n\r\n // enable xr in renderer\r\n renderer.xr.enabled = true;\r\n // add button for turning vr mode\r\n if (!this._button) {\r\n this._button = createWebVRButton(this);\r\n document.body.appendChild(this._button);\r\n } else {\r\n this._button.style.display = 'block';\r\n }\r\n // store fog setting\r\n this._mainFog = settings.now.fog;\r\n settings.set('fog', false);\r\n\r\n this._plugVRNodesIntoScene(gfx, renderer);\r\n this._setControllersListeners();\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n _plugVRNodesIntoScene(gfx, renderer) {\r\n // store common scene camera\r\n this._mainCamera.copy(gfx.camera);\r\n // add hierarchical structure for webVR into scene\r\n gfx.scene.add(this._user);\r\n // turn on webvr transformation\r\n gfx.scene.add(this._molContainer);\r\n this._molContainer.add(gfx.root);\r\n\r\n this._controller1 = renderer.xr.getController(0);\r\n this._controller2 = renderer.xr.getController(1);\r\n const mesh = this._createControllerMesh();\r\n this._controller1.add(mesh);\r\n this._controller2.add(mesh.clone());\r\n this._user.add(this._controller1);\r\n this._user.add(this._controller2);\r\n }\r\n\r\n _setControllersListeners() {\r\n this._controller1.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n\r\n this._controller1.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n }\r\n\r\n disable() {\r\n if (!this._gfx) {\r\n return;\r\n }\r\n const { renderer, camera } = this._gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n\r\n // nullify webxr callback for animation frame\r\n renderer.setAnimationLoop(null);\r\n const session = renderer.xr.getSession();\r\n if (session) {\r\n session.end();\r\n }\r\n renderer.xr.enabled = false;\r\n // remove button of VR entering\r\n if (this._button) {\r\n this._button.style.display = 'none';\r\n }\r\n // restore fog param\r\n settings.set('fog', this._mainFog);\r\n\r\n this._unplugVRNodesFromScene(camera);\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(false);\r\n }\r\n }\r\n\r\n _unplugVRNodesFromScene(camera) {\r\n // restore common camera\r\n if (this._mainCamera && camera) {\r\n camera.copy(this._mainCamera);\r\n }\r\n // turn off webvr transformation\r\n const root = this._molContainer.children[0];\r\n if (root) {\r\n this._gfx.scene.add(root);\r\n }\r\n this._molContainer.parent.remove(this._molContainer);\r\n if (this._user) {\r\n this._gfx.scene.remove(this._user);\r\n }\r\n // free scene nodes\r\n this._molContainer = null;\r\n this._user = null;\r\n this._scalingPivot = null;\r\n this._user = null;\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n }\r\n\r\n _createControllerMesh() {\r\n // visualize controllers with cylinders\r\n const geometry = new THREE.CylinderGeometry(0.04, 0.04, 0.3);\r\n const material = new UberMaterial({ lights: false, overrideColor: true });\r\n material.setUberOptions({ fixedColor: new THREE.Color(0x4444ff) });\r\n material.updateUniforms();\r\n const cylinder = new THREE.Mesh(geometry, material);\r\n cylinder.rotateX(-Math.PI / 2);\r\n return cylinder;\r\n }\r\n\r\n updateMoleculeScale() {\r\n if (!this._controller1 || !this._controller2) {\r\n return;\r\n }\r\n\r\n const self = this;\r\n // update molecule scaling by controllers\r\n if (self._pressedGripsCounter === 2) {\r\n // recalc scaling pivot\r\n gfxutils.getMiddlePoint(self._controller1.position, self._controller2.position, self._scalingPivot.position);\r\n // recalc scaler\r\n const dist = self._controller1.position.distanceTo(self._controller2.position);\r\n const scaler = dist / self._distance;\r\n self._scalingPivot.scale.multiplyScalar(scaler);\r\n // save cur distance for next frame\r\n self._distance = dist;\r\n }\r\n }\r\n\r\n /**\r\n * Reposition molecule right before the camera.\r\n * @note The proper way is to initiate headset in the place of common Miew's camera.\r\n * But threejs limitations on setting new XRReferenceSpace enforce the molecule repositioning\r\n * Hope, something will change.\r\n */\r\n moveSceneBehindHeadset() {\r\n const gfx = this._gfx;\r\n const { camera } = gfx;\r\n\r\n // set container position in camera space\r\n const container = this._molContainer;\r\n container.matrix.identity();\r\n container.position.set(0, 0, -4.0);\r\n container.updateMatrix();\r\n\r\n // update container world matrix\r\n container.matrixWorld.multiplyMatrices(camera.matrixWorld, container.matrix);\r\n // readd to scene\r\n gfx.scene.addSavingWorldTransform(container);\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n getCanvas() {\r\n const gfx = this._gfx;\r\n return (gfx && gfx.renderer) ? gfx.renderer.domElement : null;\r\n }\r\n}\r\n","/* global PACKAGE_VERSION:false */\r\nimport _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport { Spinner } from 'spin.js';\r\nimport Stats from './gfx/Stats';\r\nimport utils from './utils';\r\nimport JobHandle from './utils/JobHandle';\r\nimport options from './options';\r\nimport settings from './settings';\r\nimport chem from './chem';\r\nimport Visual from './Visual';\r\nimport ComplexVisual from './ComplexVisual';\r\nimport Complex from './chem/Complex';\r\nimport VolumeVisual from './VolumeVisual';\r\nimport io from './io/io';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport CSS2DRenderer from './gfx/CSS2DRenderer';\r\nimport ObjectControls from './ui/ObjectControls';\r\nimport Picker from './ui/Picker';\r\nimport Axes from './gfx/Axes';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport FrameInfo from './gfx/FrameInfo';\r\nimport meshes from './gfx/meshes/meshes';\r\nimport LinesObject from './gfx/objects/LinesObj';\r\nimport UberMaterial from './gfx/shaders/UberMaterial';\r\nimport OutlineMaterial from './gfx/shaders/OutlineMaterial';\r\nimport FXAAMaterial from './gfx/shaders/FXAAMaterial';\r\nimport AOMaterial from './gfx/shaders/AOMaterial';\r\nimport AOHorBlurMaterial from './gfx/shaders/AOHorBlurMaterial';\r\nimport AOVertBlurWithBlendMaterial from './gfx/shaders/AOVertBlurWithBlendMaterial';\r\nimport AnaglyphMaterial from './gfx/shaders/AnaglyphMaterial';\r\nimport VolumeMaterial from './gfx/shaders/VolumeMaterial';\r\nimport ViewInterpolator from './gfx/ViewInterpolator';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\nimport logger from './utils/logger';\r\nimport Cookies from './utils/Cookies';\r\nimport capabilities from './gfx/capabilities';\r\nimport WebVRPoC from './gfx/vr/WebVRPoC';\r\nimport vertexScreenQuadShader from './gfx/shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromDistTex from './gfx/shaders/ScreenQuadFromDistortionTex.frag';\r\n\r\nconst {\r\n selectors,\r\n Atom,\r\n Residue,\r\n Chain,\r\n Molecule,\r\n} = chem;\r\n\r\nconst EDIT_MODE = { COMPLEX: 0, COMPONENT: 1, FRAGMENT: 2 };\r\n\r\nconst LOADER_NOT_FOUND = 'Could not find suitable loader for this source';\r\nconst PARSER_NOT_FOUND = 'Could not find suitable parser for this source';\r\n\r\nconst { createElement } = utils;\r\n\r\nfunction updateFogRange(fog, center, radius) {\r\n fog.near = center - radius * settings.now.fogNearFactor;\r\n fog.far = center + radius * settings.now.fogFarFactor;\r\n}\r\n\r\nfunction removeExtension(fileName) {\r\n const dot = fileName.lastIndexOf('.');\r\n if (dot >= 0) {\r\n fileName = fileName.substr(0, dot);\r\n }\r\n return fileName;\r\n}\r\n\r\nfunction hasValidResidues(complex) {\r\n let hasValidRes = false;\r\n complex.forEachComponent((component) => {\r\n component.forEachResidue((residue) => {\r\n if (residue._isValid) {\r\n hasValidRes = true;\r\n }\r\n });\r\n });\r\n return hasValidRes;\r\n}\r\n\r\nfunction reportProgress(log, action, percent) {\r\n const TOTAL_PERCENT = 100;\r\n if (percent !== undefined) {\r\n log.debug(`${action}... ${Math.floor(percent * TOTAL_PERCENT)}%`);\r\n } else {\r\n log.debug(`${action}...`);\r\n }\r\n}\r\n\r\nfunction chooseFogColor() {\r\n return settings.now.fogColorEnable ? settings.now.fogColor : settings.now.bg.color;\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\n/**\r\n * Main 3D Molecular Viewer class.\r\n *\r\n * @param {object} opts - Viewer options.\r\n * @param {HTMLElement=} opts.container - DOM element that serves as a viewer container.\r\n * @param {object=} opts.settings - An object with properties to override default settings.\r\n * @param {string=} opts.settingsCookie='settings' - The name of the cookie to save current settings to.\r\n * @param {string=} opts.cookiePath='/' - The path option for cookies. Defaults to root.\r\n *\r\n * @exports Miew\r\n * @constructor\r\n */\r\nfunction Miew(opts) {\r\n EventDispatcher.call(this);\r\n this._opts = _.merge({\r\n settingsCookie: 'settings',\r\n cookiePath: '/',\r\n }, opts);\r\n /** @type {?object} */\r\n this._gfx = null;\r\n /** @type {ViewInterpolator} */\r\n this._interpolator = new ViewInterpolator();\r\n /** @type {HTMLElement} */\r\n this._container = (opts && opts.container)\r\n || document.getElementById('miew-container')\r\n || _.head(document.getElementsByClassName('miew-container'))\r\n || document.body;\r\n /** @type {HTMLElement} */\r\n this._containerRoot = this._container;\r\n\r\n /** @type {boolean} */\r\n this._running = false;\r\n /** @type {boolean} */\r\n this._halting = false;\r\n /** @type {boolean} */\r\n this._building = false;\r\n /** @type {boolean} */\r\n this._needRender = true;\r\n /** @type {boolean} */\r\n this._hotKeysEnabled = true;\r\n\r\n /** @type {Settings} */\r\n this.settings = settings;\r\n const log = logger;\r\n log.console = DEBUG;\r\n log.level = DEBUG ? 'debug' : 'info';\r\n /**\r\n * @type {Logger}\r\n * @example\r\n * miew.logger.addEventListener('message', function _onLogMessage(evt) {\r\n * console.log(evt.message);\r\n * });\r\n */\r\n this.logger = log;\r\n\r\n this._cookies = new Cookies(this);\r\n this.restoreSettings();\r\n if (opts && opts.settings) {\r\n this.settings.set(opts.settings);\r\n }\r\n\r\n /** @type {?Spinner} */\r\n this._spinner = null;\r\n /** @type {JobHandle[]} */\r\n this._loading = [];\r\n /** @type {?number}\r\n * @deprecated until Animation system refactoring\r\n */\r\n this._animInterval = null;\r\n\r\n /** @type {object} */\r\n this._visuals = {};\r\n /** @type {?string} */\r\n this._curVisualName = null;\r\n\r\n /** @type {array} */\r\n this._objects = [];\r\n\r\n /** @type {object} */\r\n this._sourceWindow = null;\r\n\r\n this.reset();\r\n\r\n if (this._repr) {\r\n log.debug(`Selected ${this._repr.mode.name} mode with ${this._repr.colorer.name} colorer.`);\r\n }\r\n\r\n const self = this;\r\n Miew.registeredPlugins.forEach((plugin) => {\r\n plugin.call(self);\r\n });\r\n\r\n this._initOnSettingsChanged();\r\n}\r\n\r\nMiew.prototype = Object.create(EventDispatcher.prototype);\r\nMiew.prototype.constructor = Miew;\r\n\r\nMiew.prototype.getMaxRepresentationCount = function () {\r\n return ComplexVisual.NUM_REPRESENTATION_BITS;\r\n};\r\n\r\n/**\r\n * Replace viewer container contents with a DOM element.\r\n * @param {HTMLElement} container - parent container.\r\n * @param {HTMLElement} element - DOM element to show.\r\n * @private\r\n */\r\nfunction _setContainerContents(container, element) {\r\n const parent = container;\r\n while (parent.firstChild) {\r\n parent.removeChild(parent.firstChild);\r\n }\r\n parent.appendChild(element);\r\n}\r\n\r\n/**\r\n * Update Shadow Camera target position and frustum.\r\n * @private\r\n */\r\nMiew.prototype._updateShadowCamera = (function () {\r\n const shadowMatrix = new THREE.Matrix4();\r\n const direction = new THREE.Vector3();\r\n const OBB = { center: new THREE.Vector3(), halfSize: new THREE.Vector3() };\r\n\r\n return function () {\r\n this._gfx.scene.updateMatrixWorld();\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = this._gfx.scene.children[i];\r\n shadowMatrix.copy(light.shadow.camera.matrixWorldInverse);\r\n this.getOBB(shadowMatrix, OBB);\r\n\r\n direction.subVectors(light.target.position, light.position);\r\n light.position.subVectors(OBB.center, direction);\r\n light.target.position.copy(OBB.center);\r\n\r\n light.shadow.bias = 0.09;\r\n light.shadow.camera.bottom = -OBB.halfSize.y;\r\n light.shadow.camera.top = OBB.halfSize.y;\r\n light.shadow.camera.right = OBB.halfSize.x;\r\n light.shadow.camera.left = -OBB.halfSize.x;\r\n light.shadow.camera.near = direction.length() - OBB.halfSize.z;\r\n light.shadow.camera.far = direction.length() + OBB.halfSize.z;\r\n\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Initialize the viewer.\r\n * @returns {boolean} true on success.\r\n * @throws Forwards exception raised during initialization.\r\n * @see Miew#term\r\n */\r\nMiew.prototype.init = function () {\r\n const container = this._container;\r\n const elem = utils.createElement('div', { class: 'miew-canvas' });\r\n _setContainerContents(container, elem);\r\n this._container = elem;\r\n\r\n const frag = document.createDocumentFragment();\r\n frag.appendChild(this._msgMode = createElement(\r\n 'div', { class: 'mode-message overlay' },\r\n createElement('p', {}, 'COMPONENT EDIT MODE'),\r\n ));\r\n frag.appendChild(this._msgAtomInfo = createElement(\r\n 'div', { class: 'atom-info overlay' },\r\n createElement('p', {}, ''),\r\n ));\r\n container.appendChild(frag);\r\n\r\n if (this._gfx !== null) { // block double init\r\n return true;\r\n }\r\n\r\n const self = this;\r\n this._showMessage('Viewer is being initialized...');\r\n try {\r\n this._initGfx();\r\n\r\n this._initListeners();\r\n this._spinner = new Spinner({\r\n lines: 13,\r\n length: 28,\r\n width: 14,\r\n radius: 42,\r\n color: '#fff',\r\n zIndex: 700,\r\n });\r\n\r\n window.top.addEventListener('keydown', (event) => {\r\n self._onKeyDown(event);\r\n });\r\n\r\n window.top.addEventListener('keyup', (event) => {\r\n self._onKeyUp(event);\r\n });\r\n\r\n this._objectControls = new ObjectControls(\r\n this._gfx.root, this._gfx.pivot,\r\n this._gfx.camera, this._gfx.renderer.domElement, (() => self._getAltObj()),\r\n );\r\n this._objectControls.addEventListener('change', (e) => {\r\n if (settings.now.shadow.on) {\r\n self._updateShadowCamera();\r\n }\r\n // route rotate, zoom, translate and translatePivot events to the external API\r\n switch (e.action) {\r\n case 'rotate':\r\n self.dispatchEvent({ type: 'rotate', quaternion: e.quaternion });\r\n break;\r\n case 'zoom':\r\n self.dispatchEvent({ type: 'zoom', factor: e.factor });\r\n break;\r\n default:\r\n self.dispatchEvent({ type: e.action });\r\n }\r\n self.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n });\r\n\r\n const gfx = this._gfx;\r\n this._picker = new Picker(gfx.root, gfx.camera, gfx.renderer.domElement);\r\n this._picker.addEventListener('newpick', (event) => {\r\n self._onPick(event);\r\n });\r\n this._picker.addEventListener('dblclick', (event) => {\r\n self.center(event);\r\n });\r\n } catch (error) {\r\n if (error.name === 'TypeError' && error.message === 'Cannot read property \\'getExtension\\' of null') {\r\n this._showMessage('Could not create WebGL context.');\r\n } else if (error.message.search(/webgl/i) > 1) {\r\n this._showMessage(error.message);\r\n } else {\r\n this._showMessage('Viewer initialization failed.');\r\n throw error;\r\n }\r\n return false;\r\n }\r\n\r\n // automatically load default file\r\n const file = this._opts && this._opts.load;\r\n if (file) {\r\n const type = this._opts && this._opts.type;\r\n this.load(file, { fileType: type, keepRepsInfo: true });\r\n }\r\n\r\n return true;\r\n};\r\n\r\n/**\r\n * Terminate the viewer completely.\r\n * @see Miew#init\r\n */\r\nMiew.prototype.term = function () {\r\n this._showMessage('Viewer has been terminated.');\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n this.halt();\r\n this._gfx = null;\r\n};\r\n\r\n/**\r\n * Display message inside the viewer container, hiding WebGL canvas.\r\n * @param {string} msg - Message to show.\r\n * @private\r\n */\r\nMiew.prototype._showMessage = function (msg) {\r\n const element = document.createElement('div');\r\n element.setAttribute('class', 'miew-message');\r\n element.appendChild(document.createElement('p')).appendChild(document.createTextNode(msg));\r\n _setContainerContents(this._container, element);\r\n};\r\n\r\n/**\r\n * Display WebGL canvas inside the viewer container, hiding any message shown.\r\n * @private\r\n */\r\nMiew.prototype._showCanvas = function () {\r\n _setContainerContents(this._container, this._gfx.renderer.domElement);\r\n};\r\n\r\nMiew.prototype._requestAnimationFrame = function (callback) {\r\n const { xr } = this._gfx.renderer;\r\n if (xr && xr.enabled) {\r\n this._gfx.renderer.setAnimationLoop(callback);\r\n return;\r\n }\r\n requestAnimationFrame(callback);\r\n};\r\n\r\nfunction arezSpritesSupported(context) {\r\n return context.getExtension('EXT_frag_depth');\r\n}\r\n\r\nfunction isAOSupported(context) {\r\n return (context.getExtension('WEBGL_depth_texture')\r\n && context.getExtension('WEBGL_draw_buffers'));\r\n}\r\n\r\n/**\r\n * Initialize WebGL and set 3D scene up.\r\n * @private\r\n */\r\nMiew.prototype._initGfx = function () {\r\n const gfx = {\r\n width: this._container.clientWidth,\r\n height: this._container.clientHeight,\r\n };\r\n\r\n const webGLOptions = { preserveDrawingBuffer: true, alpha: true, premultipliedAlpha: false };\r\n if (settings.now.antialias) {\r\n webGLOptions.antialias = true;\r\n }\r\n\r\n gfx.renderer2d = new CSS2DRenderer();\r\n\r\n gfx.renderer = new THREE.WebGLRenderer(webGLOptions);\r\n gfx.renderer.shadowMap.enabled = settings.now.shadow.on;\r\n gfx.renderer.shadowMap.autoUpdate = false;\r\n gfx.renderer.shadowMap.type = THREE.PCFShadowMap;\r\n capabilities.init(gfx.renderer);\r\n\r\n // z-sprites and ambient occlusion possibility\r\n if (!arezSpritesSupported(gfx.renderer.getContext())) {\r\n settings.set('zSprites', false);\r\n }\r\n if (!isAOSupported(gfx.renderer.getContext())) {\r\n settings.set('ao', false);\r\n }\r\n\r\n gfx.renderer.autoClear = false;\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n gfx.camera = new THREE.PerspectiveCamera(\r\n settings.now.camFov, gfx.width / gfx.height,\r\n settings.now.camNear, settings.now.camFar,\r\n );\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.position.z = settings.now.camDistance;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n\r\n gfx.stereoCam = new THREE.StereoCamera();\r\n\r\n gfx.scene = new THREE.Scene();\r\n\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color, settings.now.camNear, settings.now.camFar);\r\n\r\n gfx.root = new gfxutils.RCGroup();\r\n gfx.scene.add(gfx.root);\r\n\r\n gfx.pivot = new gfxutils.RCGroup();\r\n gfx.root.add(gfx.pivot);\r\n\r\n gfx.selectionScene = new THREE.Scene();\r\n gfx.selectionRoot = new THREE.Group();\r\n gfx.selectionRoot.matrixAutoUpdate = false;\r\n gfx.selectionScene.add(gfx.selectionRoot);\r\n\r\n gfx.selectionPivot = new THREE.Group();\r\n gfx.selectionPivot.matrixAutoUpdate = false;\r\n gfx.selectionRoot.add(gfx.selectionPivot);\r\n\r\n const light12 = new THREE.DirectionalLight(0xffffff, 0.45);\r\n light12.position.set(0, 0.414, 1);\r\n light12.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n light12.castShadow = true;\r\n light12.shadow = new THREE.DirectionalLightShadow();\r\n light12.shadow.bias = 0.09;\r\n light12.shadow.radius = settings.now.shadow.radius;\r\n light12.shadow.camera.layers.set(gfxutils.LAYERS.SHADOWMAP);\r\n\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n const shadowMapSize = Math.max(gfx.width, gfx.height) * pixelRatio;\r\n light12.shadow.mapSize.width = shadowMapSize;\r\n light12.shadow.mapSize.height = shadowMapSize;\r\n light12.target.position.set(0.0, 0.0, 0.0);\r\n gfx.scene.add(light12);\r\n gfx.scene.add(light12.target);\r\n\r\n const light3 = new THREE.AmbientLight(0x666666);\r\n light3.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.scene.add(light3);\r\n\r\n // add axes\r\n gfx.axes = new Axes(gfx.root, gfx.camera);\r\n const deviceWidth = gfx.width * pixelRatio;\r\n const deviceHeight = gfx.height * pixelRatio;\r\n\r\n gfx.offscreenBuf = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat, depthBuffer: true,\r\n },\r\n );\r\n\r\n if (gfx.renderer.getContext().getExtension('WEBGL_depth_texture')) {\r\n gfx.offscreenBuf.depthTexture = new THREE.DepthTexture();\r\n gfx.offscreenBuf.depthTexture.type = THREE.UnsignedShortType;\r\n }\r\n\r\n gfx.offscreenBuf2 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf3 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf4 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf3;\r\n gfx.volFFTex = gfx.offscreenBuf4;\r\n gfx.volWFFTex = gfx.offscreenBuf;\r\n\r\n // use float textures for volume rendering if possible\r\n if (gfx.renderer.getContext().getExtension('OES_texture_float')) {\r\n gfx.offscreenBuf5 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf6 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf7 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: true,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf5;\r\n gfx.volFFTex = gfx.offscreenBuf6;\r\n gfx.volWFFTex = gfx.offscreenBuf7;\r\n } else {\r\n this.logger.warn('Device doesn\\'t support OES_texture_float extension');\r\n }\r\n\r\n gfx.stereoBufL = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.stereoBufR = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n this._gfx = gfx;\r\n this._showCanvas();\r\n\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n\r\n this._container.appendChild(gfx.renderer2d.getElement());\r\n\r\n // add FPS counter\r\n const stats = new Stats();\r\n stats.domElement.style.position = 'absolute';\r\n stats.domElement.style.right = '0';\r\n stats.domElement.style.bottom = '0';\r\n this._container.appendChild(stats.domElement);\r\n this._fps = stats;\r\n this._fps.show(settings.now.fps);\r\n};\r\n\r\n/**\r\n * Setup event listeners.\r\n * @private\r\n */\r\nMiew.prototype._initListeners = function () {\r\n const self = this;\r\n window.addEventListener('resize', () => {\r\n self._onResize();\r\n });\r\n};\r\n\r\n/**\r\n * Try to add numbers to the base name to make it unique among visuals\r\n * @private\r\n */\r\nMiew.prototype._makeUniqueVisualName = function (baseName) {\r\n if (!baseName) {\r\n return Math.random().toString();\r\n }\r\n\r\n let name = baseName;\r\n let suffix = 1;\r\n while (this._visuals.hasOwnProperty(name)) {\r\n name = `${baseName} (${suffix.toString()})`;\r\n suffix++;\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Add visual to the viewer\r\n * @private\r\n */\r\nMiew.prototype._addVisual = function (visual) {\r\n if (!visual) {\r\n return null;\r\n }\r\n\r\n // change visual name in order to make it unique\r\n const name = this._makeUniqueVisualName(visual.name);\r\n visual.name = name;\r\n\r\n this._visuals[name] = visual;\r\n this._gfx.pivot.add(visual);\r\n if (visual.getSelectionGeo) {\r\n this._gfx.selectionPivot.add(visual.getSelectionGeo());\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Remove visual from the viewer\r\n * @private\r\n */\r\nMiew.prototype._removeVisual = function (visual) {\r\n let name = '';\r\n let obj = null;\r\n if (visual instanceof Visual) {\r\n ({ name } = visual);\r\n obj = visual;\r\n } else if (typeof visual === 'string') {\r\n name = visual;\r\n obj = this._visuals[name];\r\n }\r\n\r\n if (!obj || !this._visuals.hasOwnProperty(name) || this._visuals[name] !== obj) {\r\n return;\r\n }\r\n\r\n if (name === this._curVisualName) {\r\n this._curVisualName = undefined;\r\n }\r\n\r\n delete this._visuals[name];\r\n obj.release(); // removes nodes from scene\r\n\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Call specified function for each Visual\r\n * @private\r\n */\r\nMiew.prototype._forEachVisual = function (callback) {\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Release (destroy) all visuals in the scene\r\n * @private\r\n */\r\nMiew.prototype._releaseAllVisuals = function () {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n this._visuals[name].release();\r\n }\r\n }\r\n\r\n this._visuals = {};\r\n};\r\n\r\n/**\r\n * Call specified function for each ComplexVisual\r\n * @private\r\n */\r\nMiew.prototype._forEachComplexVisual = function (callback) {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)\r\n && this._visuals[name] instanceof ComplexVisual) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual with specified name, or current (if not found), or any, or null\r\n * @private\r\n */\r\nMiew.prototype._getComplexVisual = function (name) {\r\n name = name || this._curVisualName;\r\n let any = null;\r\n let named = null;\r\n this._forEachComplexVisual((visual) => {\r\n any = visual;\r\n if (visual.name === name) {\r\n named = visual;\r\n }\r\n });\r\n return named || any;\r\n};\r\n\r\n/**\r\n * Returns first found VolumeVisual (no more than one should be present actually)\r\n * @private\r\n */\r\nMiew.prototype._getVolumeVisual = function () {\r\n let any = null;\r\n this._forEachVisual((visual) => {\r\n if (visual instanceof VolumeVisual) {\r\n any = visual;\r\n }\r\n });\r\n return any;\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual corresponding to specified complex\r\n * @private\r\n */\r\nMiew.prototype._getVisualForComplex = function (complex) {\r\n if (!complex) {\r\n return null;\r\n }\r\n\r\n let found = null;\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getComplex() === complex) {\r\n found = visual;\r\n }\r\n });\r\n return found;\r\n};\r\n\r\n/*\r\n * Get a list of names of visuals currently shown by the viewer\r\n */\r\nMiew.prototype.getVisuals = function () {\r\n return Object.keys(this._visuals);\r\n};\r\n\r\n/*\r\n * Get complex visuals count\r\n */\r\nMiew.prototype.getComplexVisualsCount = function () {\r\n let count = 0;\r\n this._forEachComplexVisual(() => count++);\r\n return count;\r\n};\r\n\r\n/*\r\n * Get current visual\r\n */\r\nMiew.prototype.getCurrentVisual = function () {\r\n return this._curVisualName;\r\n};\r\n\r\n/*\r\n * Set current visual.\r\n * All further operations will be performed on this visual (complex) if not stated otherwise.\r\n */\r\nMiew.prototype.setCurrentVisual = function (name) {\r\n if (!this._visuals[name]) {\r\n return;\r\n }\r\n\r\n this._curVisualName = name;\r\n};\r\n\r\n/**\r\n * Run the viewer, start processing update/render frames periodically.\r\n * Has no effect if already running.\r\n * @see Miew#halt\r\n */\r\nMiew.prototype.run = function () {\r\n if (!this._running) {\r\n this._running = true;\r\n if (this._halting) {\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._objectControls.enable(true);\r\n this._interpolator.resume();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to stop.\r\n * Will be processed during the next frame.\r\n * @see Miew#run\r\n */\r\nMiew.prototype.halt = function () {\r\n if (this._running) {\r\n this._discardComponentEdit();\r\n this._discardFragmentEdit();\r\n this._objectControls.enable(false);\r\n this._interpolator.pause();\r\n this._halting = true;\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to start / stop responsing\r\n * on hot keys.\r\n * @param enabled - start (true) or stop (false) response on hot keys.\r\n */\r\nMiew.prototype.enableHotKeys = function (enabled) {\r\n this._hotKeysEnabled = enabled;\r\n this._objectControls.enableHotkeys(enabled);\r\n};\r\n\r\n/**\r\n * Callback which processes window resize.\r\n * @private\r\n */\r\nMiew.prototype._onResize = function () {\r\n this._needRender = true;\r\n\r\n const gfx = this._gfx;\r\n gfx.width = this._container.clientWidth;\r\n gfx.height = this._container.clientHeight;\r\n\r\n gfx.camera.aspect = gfx.width / gfx.height;\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n this.dispatchEvent({ type: 'resize' });\r\n};\r\n\r\nMiew.prototype._resizeOffscreenBuffers = function (width, height, stereo) {\r\n const gfx = this._gfx;\r\n stereo = stereo || 'NONE';\r\n const isAnaglyph = (stereo === 'NONE' || stereo === 'ANAGLYPH');\r\n const multi = isAnaglyph ? 1 : 0.5;\r\n gfx.offscreenBuf.setSize(multi * width, height);\r\n gfx.offscreenBuf2.setSize(multi * width, height);\r\n gfx.offscreenBuf3.setSize(multi * width, height);\r\n gfx.offscreenBuf4.setSize(multi * width, height);\r\n if (gfx.offscreenBuf5) {\r\n gfx.offscreenBuf5.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf6) {\r\n gfx.offscreenBuf6.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf7) {\r\n gfx.offscreenBuf7.setSize(multi * width, height);\r\n }\r\n if (isAnaglyph) {\r\n gfx.stereoBufL.setSize(width, height);\r\n gfx.stereoBufR.setSize(width, height);\r\n }\r\n};\r\n\r\n/**\r\n * Callback which processes update/render frames.\r\n * @private\r\n */\r\nMiew.prototype._onTick = function () {\r\n if (this._halting) {\r\n this._running = false;\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._fps.update();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n\r\n this._onUpdate();\r\n if (this._needRender) {\r\n this._onRender();\r\n this._needRender = !settings.now.suspendRender || settings.now.stereo === 'WEBVR';\r\n }\r\n};\r\n\r\nMiew.prototype._getBSphereRadius = function () {\r\n // calculate radius that would include all visuals\r\n let radius = 0;\r\n this._forEachVisual((visual) => {\r\n radius = Math.max(radius, visual.getBoundaries().boundingSphere.radius);\r\n });\r\n return radius * this._objectControls.getScale();\r\n};\r\n\r\n/**\r\n * Calculate bounding box that would include all visuals and being axis aligned in world defined by\r\n * transformation matrix: matrix\r\n * @param {Matrix4} matrix - transformation matrix.\r\n * @param {object} OBB - calculating bounding box.\r\n * @param {Vector3} OBB.center - OBB center.\r\n * @param {Vector3} OBB.halfSize - half magnitude of OBB sizes.\r\n */\r\nMiew.prototype.getOBB = (function () {\r\n const _bSphereForOneVisual = new THREE.Sphere();\r\n const _bBoxForOneVisual = new THREE.Box3();\r\n const _bBox = new THREE.Box3();\r\n\r\n const _invMatrix = new THREE.Matrix4();\r\n\r\n const _points = [\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n ];\r\n\r\n return function (matrix, OBB) {\r\n _bBox.makeEmpty();\r\n\r\n this._forEachVisual((visual) => {\r\n _bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere);\r\n _bSphereForOneVisual.applyMatrix4(visual.matrixWorld).applyMatrix4(matrix);\r\n _bSphereForOneVisual.getBoundingBox(_bBoxForOneVisual);\r\n _bBox.union(_bBoxForOneVisual);\r\n });\r\n _bBox.getCenter(OBB.center);\r\n\r\n _invMatrix.getInverse(matrix);\r\n OBB.center.applyMatrix4(_invMatrix);\r\n\r\n const { min } = _bBox;\r\n const { max } = _bBox;\r\n _points[0].set(min.x, min.y, min.z); // 000\r\n _points[1].set(max.x, min.y, min.z); // 100\r\n _points[2].set(min.x, max.y, min.z); // 010\r\n _points[3].set(min.x, min.y, max.z); // 001\r\n for (let i = 0, l = _points.length; i < l; i++) {\r\n _points[i].applyMatrix4(_invMatrix);\r\n }\r\n\r\n OBB.halfSize.set(\r\n Math.abs(_points[0].x - _points[1].x),\r\n Math.abs(_points[0].y - _points[2].y),\r\n Math.abs(_points[0].z - _points[3].z),\r\n ).multiplyScalar(0.5);\r\n };\r\n}());\r\n\r\nMiew.prototype._updateFog = function () {\r\n const gfx = this._gfx;\r\n\r\n if (settings.now.fog) {\r\n if (typeof gfx.scene.fog === 'undefined' || gfx.scene.fog === null) {\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color);\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n updateFogRange(gfx.scene.fog, gfx.camera.position.z, this._getBSphereRadius());\r\n } else if (gfx.scene.fog) {\r\n gfx.scene.fog = undefined;\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n};\r\n\r\nMiew.prototype._onUpdate = function () {\r\n if (this.isScriptingCommandAvailable !== undefined && this.isScriptingCommandAvailable() && !this._building) {\r\n this.callNextCmd();\r\n }\r\n\r\n this._objectControls.update();\r\n\r\n this._forEachComplexVisual((visual) => {\r\n visual.getComplex().update();\r\n });\r\n\r\n if (settings.now.autobuild && !this._loading.length && !this._building && this._needRebuild()) {\r\n this.rebuild();\r\n }\r\n\r\n if (!this._loading.length && !this._building && !this._needRebuild()) {\r\n this._updateView();\r\n }\r\n\r\n this._updateFog();\r\n\r\n if (this._gfx.renderer.xr.enabled) {\r\n this.webVR.updateMoleculeScale();\r\n }\r\n};\r\n\r\nMiew.prototype._onRender = function () {\r\n const gfx = this._gfx;\r\n\r\n // update all matrices\r\n gfx.scene.updateMatrixWorld();\r\n gfx.camera.updateMatrixWorld();\r\n\r\n this._clipPlaneUpdateValue(this._getBSphereRadius());\r\n this._fogFarUpdateValue();\r\n\r\n gfx.renderer.setRenderTarget(null);\r\n gfx.renderer.clear();\r\n\r\n this._renderFrame(settings.now.stereo);\r\n};\r\n\r\nMiew.prototype._renderFrame = (function () {\r\n const _anaglyphMat = new AnaglyphMaterial();\r\n const _size = new THREE.Vector2();\r\n\r\n return function (stereo) {\r\n const gfx = this._gfx;\r\n const { renderer } = gfx;\r\n\r\n renderer.getSize(_size);\r\n\r\n if (stereo !== 'NONE') {\r\n gfx.camera.focus = gfx.camera.position.z; // set focus to the center of the object\r\n gfx.stereoCam.aspect = 1.0;\r\n\r\n // in anaglyph mode we render full-size image for each eye\r\n // while in other stereo modes only half-size (two images on the screen)\r\n if (stereo === 'ANAGLYPH') {\r\n gfx.stereoCam.update(gfx.camera);\r\n } else {\r\n gfx.stereoCam.updateHalfSized(gfx.camera, settings.now.camFov);\r\n }\r\n }\r\n\r\n // resize offscreen buffers to match the target\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n this._resizeOffscreenBuffers(_size.width * pixelRatio, _size.height * pixelRatio, stereo);\r\n\r\n this._renderShadowMap();\r\n\r\n switch (stereo) {\r\n case 'WEBVR':\r\n case 'NONE':\r\n this._renderScene(gfx.camera, false);\r\n break;\r\n case 'SIMPLE':\r\n case 'DISTORTED':\r\n renderer.setScissorTest(true);\r\n\r\n renderer.setScissor(0, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(0, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraL, stereo === 'DISTORTED');\r\n\r\n renderer.setScissor(_size.width / 2, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(_size.width / 2, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraR, stereo === 'DISTORTED');\r\n\r\n renderer.setScissorTest(false);\r\n break;\r\n case 'ANAGLYPH':\r\n this._renderScene(this._gfx.stereoCam.cameraL, false, gfx.stereoBufL);\r\n this._renderScene(this._gfx.stereoCam.cameraR, false, gfx.stereoBufR);\r\n renderer.setRenderTarget(null);\r\n _anaglyphMat.uniforms.srcL.value = gfx.stereoBufL.texture;\r\n _anaglyphMat.uniforms.srcR.value = gfx.stereoBufR.texture;\r\n gfx.renderer.renderScreenQuad(_anaglyphMat);\r\n break;\r\n default:\r\n }\r\n\r\n gfx.renderer2d.render(gfx.scene, gfx.camera);\r\n\r\n if (settings.now.axes && gfx.axes && !gfx.renderer.xr.enabled) {\r\n gfx.axes.render(renderer);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._onBgColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx) {\r\n if (gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onFogColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx && gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._setUberMaterialValues = function (values) {\r\n this._gfx.root.traverse((obj) => {\r\n if ((obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line)\r\n && obj.material instanceof UberMaterial) {\r\n obj.material.setValues(values);\r\n obj.material.needsUpdate = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._enableMRT = function (on, renderBuffer, textureBuffer) {\r\n const gfx = this._gfx;\r\n const gl = gfx.renderer.getContext();\r\n const ext = gl.getExtension('WEBGL_draw_buffers');\r\n const { properties } = gfx.renderer;\r\n\r\n if (!on) {\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, null]);\r\n return;\r\n }\r\n\r\n // take extra texture from Texture Buffer\r\n gfx.renderer.setRenderTarget(textureBuffer);\r\n const tx8 = properties.get(textureBuffer.texture).__webglTexture;\r\n gl.bindTexture(gl.TEXTURE_2D, tx8);\r\n\r\n // take texture and framebuffer from renderbuffer\r\n gfx.renderer.setRenderTarget(renderBuffer);\r\n const fb = properties.get(renderBuffer).__webglFramebuffer;\r\n const tx = properties.get(renderBuffer.texture).__webglTexture;\r\n\r\n // set framebuffer\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n fb.width = renderBuffer.width;\r\n fb.height = renderBuffer.height;\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tx, 0);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, ext.COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, tx8, 0);\r\n\r\n // mapping textures\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, ext.COLOR_ATTACHMENT1_WEBGL]);\r\n};\r\n\r\nMiew.prototype._renderScene = (function () {\r\n return function (camera, distortion, target) {\r\n distortion = distortion || false;\r\n target = target || null;\r\n\r\n const gfx = this._gfx;\r\n\r\n // render to offscreen buffer\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.clear();\r\n if (gfx.renderer.xr.enabled) {\r\n gfx.renderer.render(gfx.scene, camera);\r\n return;\r\n }\r\n\r\n // clean buffer for normals texture\r\n gfx.renderer.setClearColor(0x000000, 0.0);\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf4);\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.clear();\r\n\r\n const bHaveComplexes = (this._getComplexVisual() !== null);\r\n const volumeVisual = this._getVolumeVisual();\r\n const ssao = bHaveComplexes && settings.now.ao;\r\n\r\n if (ssao) {\r\n this._enableMRT(true, gfx.offscreenBuf, gfx.offscreenBuf4);\r\n }\r\n\r\n if (settings.now.transparency === 'prepass') {\r\n this._renderWithPrepassTransparency(camera, gfx.offscreenBuf);\r\n } else if (settings.now.transparency === 'standard') {\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n }\r\n\r\n if (ssao) {\r\n this._enableMRT(false, null, null);\r\n }\r\n\r\n // when fxaa we should get resulting image in temp off-screen buff2 for further postprocessing with fxaa filter\r\n // otherwise we render to canvas\r\n const outline = bHaveComplexes && settings.now.outline.on;\r\n const fxaa = bHaveComplexes && settings.now.fxaa;\r\n const volume = (volumeVisual !== null) && (volumeVisual.getMesh().material != null);\r\n let dstBuffer = (ssao || outline || volume || fxaa || distortion) ? gfx.offscreenBuf2 : target;\r\n let srcBuffer = gfx.offscreenBuf;\r\n\r\n if (ssao) {\r\n this._performAO(\r\n srcBuffer,\r\n gfx.offscreenBuf4,\r\n gfx.offscreenBuf.depthTexture,\r\n dstBuffer,\r\n gfx.offscreenBuf3,\r\n gfx.offscreenBuf2,\r\n );\r\n if (!fxaa && !distortion && !volume && !outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = target;\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n } else {\r\n // just copy color buffer to dst buffer\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n\r\n // outline\r\n if (outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = (volume || fxaa || distortion) ? gfx.offscreenBuf3 : target;\r\n if (srcBuffer != null) {\r\n this._renderOutline(camera, gfx.offscreenBuf, srcBuffer, dstBuffer);\r\n }\r\n }\r\n\r\n // render selected part with outline material\r\n this._renderSelection(camera, gfx.offscreenBuf, dstBuffer);\r\n\r\n if (volume) {\r\n // copy current picture to the buffer that retains depth-data of the original molecule render\r\n // so that volume renderer could use depth-test\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n dstBuffer = gfx.offscreenBuf;\r\n this._renderVolume(volumeVisual, camera, dstBuffer, gfx.volBFTex, gfx.volFFTex, gfx.volWFFTex);\r\n\r\n // if this is the last stage -- copy image to target\r\n if (!fxaa && !distortion) {\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n }\r\n }\r\n\r\n srcBuffer = dstBuffer;\r\n\r\n if (fxaa) {\r\n dstBuffer = distortion ? gfx.offscreenBuf4 : target;\r\n this._performFXAA(srcBuffer, dstBuffer);\r\n srcBuffer = dstBuffer;\r\n }\r\n\r\n if (distortion) {\r\n dstBuffer = target;\r\n this._performDistortion(srcBuffer, dstBuffer, true);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._performDistortion = (function () {\r\n const _scene = new THREE.Scene();\r\n const _camera = new THREE.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, -500, 1000);\r\n\r\n const _material = new THREE.RawShaderMaterial({\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n aberration: { type: 'fv3', value: new THREE.Vector3(1.0) },\r\n },\r\n vertexShader: vertexScreenQuadShader,\r\n fragmentShader: fragmentScreenQuadFromDistTex,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n const _geo = gfxutils.buildDistorionMesh(10, 10, settings.now.debug.stereoBarrel);\r\n _scene.add(new meshes.Mesh(_geo, _material));\r\n\r\n return function (srcBuffer, targetBuffer, mesh) {\r\n this._gfx.renderer.setRenderTarget(targetBuffer);\r\n this._gfx.renderer.clear();\r\n\r\n if (mesh) {\r\n _material.uniforms.srcTex.value = srcBuffer.texture;\r\n _material.uniforms.aberration.value.set(0.995, 1.0, 1.01);\r\n this._gfx.renderer.render(_scene, _camera);\r\n } else {\r\n this._gfx.renderer.renderScreenQuadFromTexWithDistortion(srcBuffer, settings.now.debug.stereoBarrel);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._renderOutline = (function () {\r\n const _outlineMaterial = new OutlineMaterial({ depth: true });\r\n\r\n return function (camera, srcDepthBuffer, srcColorBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcColorBuffer.texture;\r\n _outlineMaterial.uniforms.srcDepthTex.value = srcDepthBuffer.depthTexture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcDepthBuffer.width, srcDepthBuffer.height);\r\n _outlineMaterial.uniforms.color.value = new THREE.Color(settings.now.outline.color);\r\n _outlineMaterial.uniforms.threshold.value = settings.now.outline.threshold;\r\n _outlineMaterial.uniforms.thickness.value = new THREE.Vector2(\r\n settings.now.outline.thickness,\r\n settings.now.outline.thickness,\r\n );\r\n\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._renderShadowMap = (function () {\r\n const pars = { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };\r\n\r\n return function () {\r\n if (!settings.now.shadow.on) {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n const currentRenderTarget = gfx.renderer.getRenderTarget();\r\n const activeCubeFace = gfx.renderer.getActiveCubeFace();\r\n const activeMipmapLevel = gfx.renderer.getActiveMipmapLevel();\r\n\r\n const _state = gfx.renderer.state;\r\n\r\n // Set GL state for depth map.\r\n _state.setBlending(THREE.NoBlending);\r\n _state.buffers.color.setClear(1, 1, 1, 1);\r\n _state.buffers.depth.setTest(true);\r\n _state.setScissorTest(false);\r\n\r\n for (let i = 0; i < gfx.scene.children.length; i++) {\r\n if (gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = gfx.scene.children[i];\r\n\r\n if (light.shadow.map == null) {\r\n light.shadow.map = new THREE.WebGLRenderTarget(light.shadow.mapSize.width, light.shadow.mapSize.height, pars);\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n light.shadow.updateMatrices(light);\r\n\r\n gfx.renderer.setRenderTarget(light.shadow.map);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.render(gfx.scene, light.shadow.camera);\r\n }\r\n }\r\n gfx.renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);\r\n };\r\n}());\r\n\r\n/**\r\n * Check if there is selection which must be rendered or not.\r\n * @private\r\n * @returns {boolean} true on existing selection to render\r\n */\r\nMiew.prototype._hasSelectionToRender = function () {\r\n const selPivot = this._gfx.selectionPivot;\r\n\r\n for (let i = 0; i < selPivot.children.length; i++) {\r\n const selPivotChild = selPivot.children[i];\r\n if (selPivotChild.children.length > 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n\r\nMiew.prototype._renderSelection = (function () {\r\n const _outlineMaterial = new OutlineMaterial();\r\n\r\n return function (camera, srcBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // clear offscreen buffer (leave z-buffer intact)\r\n gfx.renderer.setClearColor('black', 0);\r\n\r\n // render selection to offscreen buffer\r\n gfx.renderer.setRenderTarget(srcBuffer);\r\n gfx.renderer.clear(true, false, false);\r\n if (self._hasSelectionToRender()) {\r\n gfx.selectionRoot.matrix = gfx.root.matrix;\r\n gfx.selectionPivot.matrix = gfx.pivot.matrix;\r\n gfx.renderer.render(gfx.selectionScene, camera);\r\n } else {\r\n // just render something to force \"target clear\" operation to finish\r\n gfx.renderer.renderDummyQuad();\r\n }\r\n\r\n // overlay to screen\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 0.6);\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcBuffer.width, srcBuffer.height);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._checkVolumeRenderingSupport = function (renderTarget) {\r\n if (!renderTarget) {\r\n return false;\r\n }\r\n const gfx = this._gfx;\r\n const oldRT = gfx.renderer.getRenderTarget();\r\n\r\n gfx.renderer.setRenderTarget(renderTarget);\r\n const context = gfx.renderer.getContext();\r\n const result = context.checkFramebufferStatus(context.FRAMEBUFFER);\r\n gfx.renderer.setRenderTarget(oldRT);\r\n if (result !== context.FRAMEBUFFER_COMPLETE) {\r\n // floatFrameBufferWarning = ;\r\n this.logger.warn('Device doesn\\'t support electron density rendering');\r\n return false;\r\n }\r\n return true;\r\n};\r\n\r\nMiew.prototype._renderVolume = (function () {\r\n const volumeBFMat = new VolumeMaterial.BackFacePosMaterial();\r\n const volumeFFMat = new VolumeMaterial.FrontFacePosMaterial();\r\n const cubeOffsetMat = new THREE.Matrix4().makeTranslation(0.5, 0.5, 0.5);\r\n const world2colorMat = new THREE.Matrix4();\r\n\r\n let volumeRenderingSupported;\r\n\r\n return function (volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) {\r\n const gfx = this._gfx;\r\n\r\n if (typeof volumeRenderingSupported === 'undefined') {\r\n volumeRenderingSupported = this._checkVolumeRenderingSupport(tmpBuf1);\r\n }\r\n\r\n if (!volumeRenderingSupported) {\r\n return;\r\n }\r\n\r\n const mesh = volumeVisual.getMesh();\r\n\r\n mesh.rebuild(gfx.camera);\r\n\r\n // use main camera to prepare special textures to be used by volumetric rendering\r\n // these textures have the size of the window and are stored in offscreen buffers\r\n gfx.renderer.setClearColor('black', 0);\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n // draw plane with its own material, because it differs slightly from volumeBFMat\r\n camera.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeBFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeFFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.scene.overrideMaterial = null;\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n\r\n // prepare texture that contains molecule positions\r\n world2colorMat.getInverse(mesh.matrixWorld);\r\n UberMaterial.prototype.uberOptions.world2colorMatrix.multiplyMatrices(cubeOffsetMat, world2colorMat);\r\n camera.layers.set(gfxutils.LAYERS.COLOR_FROM_POSITION);\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // render volume\r\n const vm = mesh.material;\r\n vm.uniforms._BFRight.value = tmpBuf1.texture;\r\n vm.uniforms._FFRight.value = tmpBuf2.texture;\r\n vm.uniforms._WFFRight.value = tmpBuf3.texture;\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.renderer.setRenderTarget(dstBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\n/* Render scene with 'ZPrepass transparency Effect'\r\n * Idea: transparent objects are rendered in two passes. The first one writes result only into depth buffer.\r\n * The second pass reads depth buffer and writes only to color buffer. The method results in\r\n * correct image of front part of the semi-transparent objects, but we can see only front transparent objects\r\n * and opaque objects inside, there is no transparent objects inside.\r\n * Notes: 1. Opaque objects should be rendered strictly before semi-transparent ones.\r\n * 2. Realization doesn't use camera layers because scene traversing is used for material changes and\r\n * we can use it to select needed meshes and don't complicate meshes builders with layers\r\n */\r\nMiew.prototype._renderWithPrepassTransparency = (function () {\r\n return function (camera, targetBuffer) {\r\n const gfx = this._gfx;\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n\r\n // opaque objects\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // transparent objects z prepass\r\n camera.layers.set(gfxutils.LAYERS.PREPASS_TRANSPARENT);\r\n gfx.renderer.getContext().colorMask(false, false, false, false); // don't update color buffer\r\n gfx.renderer.render(gfx.scene, camera);\r\n gfx.renderer.getContext().colorMask(true, true, true, true); // update color buffer\r\n\r\n // transparent objects color pass\r\n camera.layers.set(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // restore default layer\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\nMiew.prototype._performFXAA = (function () {\r\n const _fxaaMaterial = new FXAAMaterial();\r\n\r\n return function (srcBuffer, targetBuffer) {\r\n if (typeof srcBuffer === 'undefined' || typeof targetBuffer === 'undefined') {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n\r\n // clear canvas\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.clear();\r\n\r\n // do fxaa processing of offscreen buff2\r\n _fxaaMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _fxaaMaterial.uniforms.srcTexelSize.value.set(1.0 / srcBuffer.width, 1.0 / srcBuffer.height);\r\n _fxaaMaterial.uniforms.bgColor.value.set(settings.now.bg.color);\r\n\r\n if (_fxaaMaterial.bgTransparent !== settings.now.bg.transparent) {\r\n _fxaaMaterial.setValues({ bgTransparent: settings.now.bg.transparent });\r\n _fxaaMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.renderScreenQuad(_fxaaMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._performAO = (function () {\r\n const _aoMaterial = new AOMaterial();\r\n const _horBlurMaterial = new AOHorBlurMaterial();\r\n const _vertBlurMaterial = new AOVertBlurWithBlendMaterial();\r\n\r\n const _scale = new THREE.Vector3();\r\n return function (srcColorBuffer, normalBuffer, srcDepthTexture, targetBuffer, tempBuffer, tempBuffer1) {\r\n if (!srcColorBuffer || !normalBuffer || !srcDepthTexture || !targetBuffer || !tempBuffer || !tempBuffer1) {\r\n return;\r\n }\r\n const gfx = this._gfx;\r\n const tanHalfFOV = Math.tan(THREE.Math.DEG2RAD * 0.5 * gfx.camera.fov);\r\n\r\n _aoMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _aoMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _aoMaterial.uniforms.normalTexture.value = normalBuffer.texture;\r\n _aoMaterial.uniforms.srcTexelSize.value.set(1.0 / srcColorBuffer.width, 1.0 / srcColorBuffer.height);\r\n _aoMaterial.uniforms.camNearFar.value.set(gfx.camera.near, gfx.camera.far);\r\n _aoMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _aoMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _aoMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n gfx.root.matrix.extractScale(_scale);\r\n _aoMaterial.uniforms.kernelRadius.value = settings.now.debug.ssaoKernelRadius * _scale.x;\r\n _aoMaterial.uniforms.depthThreshold.value = 2.0 * this._getBSphereRadius(); // diameter\r\n _aoMaterial.uniforms.factor.value = settings.now.debug.ssaoFactor;\r\n // N: should be tempBuffer1 for proper use of buffers (see buffers using outside the function)\r\n gfx.renderer.setRenderTarget(tempBuffer1);\r\n gfx.renderer.renderScreenQuad(_aoMaterial);\r\n\r\n _horBlurMaterial.uniforms.aoMap.value = tempBuffer1.texture;\r\n _horBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer1.width, 1.0 / tempBuffer1.height);\r\n _horBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n gfx.renderer.setRenderTarget(tempBuffer);\r\n gfx.renderer.renderScreenQuad(_horBlurMaterial);\r\n\r\n _vertBlurMaterial.uniforms.aoMap.value = tempBuffer.texture;\r\n _vertBlurMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _vertBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer.width, 1.0 / tempBuffer.height);\r\n _vertBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _vertBlurMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _vertBlurMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _vertBlurMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n const { fog } = gfx.scene;\r\n if (fog) {\r\n _vertBlurMaterial.uniforms.fogNearFar.value.set(fog.near, fog.far);\r\n _vertBlurMaterial.uniforms.fogColor.value.set(fog.color.r, fog.color.g, fog.color.b, settings.now.fogAlpha);\r\n }\r\n if ((_vertBlurMaterial.useFog !== settings.now.fog)\r\n || (_vertBlurMaterial.fogTransparent !== settings.now.bg.transparent)) {\r\n _vertBlurMaterial.setValues({ useFog: settings.now.fog, fogTransparent: settings.now.bg.transparent });\r\n _vertBlurMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_vertBlurMaterial);\r\n };\r\n}());\r\n\r\n/**\r\n * Reset the viewer, unload molecules.\r\n * @param {boolean=} keepReps - Keep representations while resetting viewer state.\r\n */\r\nMiew.prototype.reset = function (/* keepReps */) {\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._lastPick = null;\r\n\r\n this._releaseAllVisuals();\r\n\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._resetObjects();\r\n\r\n if (this._gfx) {\r\n gfxutils.clearTree(this._gfx.pivot);\r\n this._gfx.renderer2d.reset();\r\n }\r\n\r\n this.setNeedRender();\r\n};\r\n\r\nMiew.prototype._resetScene = function () {\r\n this._objectControls.reset();\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n this.resetReps();\r\n this.resetPivot();\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype.resetView = function () {\r\n // reset controls\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._resetScene();\r\n\r\n // reset selection\r\n this._forEachComplexVisual((visual) => {\r\n visual.updateSelectionMask({});\r\n visual.rebuildSelectionGeometry();\r\n });\r\n};\r\n\r\nMiew.prototype._export = function (format) {\r\n const TheExporter = _.head(io.exporters.find({ format }));\r\n if (!TheExporter) {\r\n this.logger.error('Could not find suitable exporter for this source');\r\n return Promise.reject(new Error('Could not find suitable exporter for this source'));\r\n }\r\n this.dispatchEvent({ type: 'exporting' });\r\n\r\n if (this._visuals[this._curVisualName] instanceof ComplexVisual) {\r\n let dataSource = null;\r\n if (TheExporter.SourceClass === ComplexVisual) {\r\n dataSource = this._visuals[this._curVisualName];\r\n } else if (TheExporter.SourceClass === Complex) {\r\n dataSource = this._visuals[this._curVisualName]._complex;\r\n }\r\n const exporter = new TheExporter(dataSource, { miewVersion: Miew.VERSION });\r\n return exporter.export().then((data) => data);\r\n }\r\n if (this._visuals[this._curVisualName] instanceof VolumeVisual) {\r\n return Promise.reject(new Error('Sorry, exporter for volume data not implemented yet'));\r\n }\r\n return Promise.reject(new Error('Unexpected format of data'));\r\n};\r\n\r\nconst rePdbId = /^(?:(pdb|cif|mmtf|ccp4|dsn6):\\s*)?(\\d[a-z\\d]{3})$/i;\r\nconst rePubchem = /^(?:pc|pubchem):\\s*([a-z]+)$/i;\r\nconst reUrlScheme = /^([a-z][a-z\\d\\-+.]*):/i;\r\n\r\nfunction resolveSourceShortcut(source, opts) {\r\n if (!_.isString(source)) {\r\n return source;\r\n }\r\n\r\n // e.g. \"mmtf:1CRN\"\r\n const matchesPdbId = rePdbId.exec(source);\r\n if (matchesPdbId) {\r\n let [, format = 'pdb', id] = matchesPdbId;\r\n\r\n format = format.toLowerCase();\r\n id = id.toUpperCase();\r\n\r\n switch (format) {\r\n case 'pdb':\r\n source = `https://files.rcsb.org/download/${id}.pdb`;\r\n break;\r\n case 'cif':\r\n source = `https://files.rcsb.org/download/${id}.cif`;\r\n break;\r\n case 'mmtf':\r\n source = `https://mmtf.rcsb.org/v1.0/full/${id}`;\r\n break;\r\n case 'ccp4':\r\n source = `https://www.ebi.ac.uk/pdbe/coordinates/files/${id.toLowerCase()}.ccp4`;\r\n break;\r\n case 'dsn6':\r\n source = `https://edmaps.rcsb.org/maps/${id.toLowerCase()}_2fofc.dsn6`;\r\n break;\r\n default:\r\n throw new Error('Unexpected data format shortcut');\r\n }\r\n\r\n opts.fileType = format;\r\n opts.fileName = `${id}.${format}`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // e.g. \"pc:aspirin\"\r\n const matchesPubchem = rePubchem.exec(source);\r\n if (matchesPubchem) {\r\n const compound = matchesPubchem[1].toLowerCase();\r\n source = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${compound}/JSON?record_type=3d`;\r\n opts.fileType = 'pubchem';\r\n opts.fileName = `${compound}.json`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // otherwise is should be an URL\r\n if (opts.sourceType === 'url' || opts.sourceType === undefined) {\r\n opts.sourceType = 'url';\r\n\r\n // e.g. \"./data/1CRN.pdb\"\r\n if (!reUrlScheme.test(source)) {\r\n source = utils.resolveURL(source);\r\n }\r\n }\r\n\r\n return source;\r\n}\r\n\r\nfunction updateBinaryMode(opts) {\r\n let { binary } = opts;\r\n\r\n // detect by format\r\n if (opts.fileType !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n } else {\r\n throw new Error('Could not find suitable parser for this format');\r\n }\r\n }\r\n\r\n // detect by file extension\r\n if (binary === undefined && opts.fileExt !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ ext: opts.fileExt }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n }\r\n }\r\n\r\n // temporary workaround for animation\r\n if (opts.fileExt !== undefined && opts.fileExt.toLowerCase() === '.man') {\r\n opts.binary = true;\r\n opts.animation = true; // who cares?\r\n }\r\n\r\n // update if detected\r\n if (binary !== undefined) {\r\n if (opts.binary !== undefined && opts.binary !== binary) {\r\n opts.context.logger.warn('Overriding incorrect binary mode');\r\n }\r\n }\r\n\r\n opts.binary = binary || false;\r\n}\r\n\r\nfunction _fetchData(source, opts, job) {\r\n return new Promise(((resolve) => {\r\n if (job.shouldCancel()) {\r\n throw new Error('Operation cancelled');\r\n }\r\n job.notify({ type: 'fetching' });\r\n\r\n // allow for source shortcuts\r\n source = resolveSourceShortcut(source, opts);\r\n\r\n // detect a proper loader\r\n const TheLoader = _.head(io.loaders.find({ type: opts.sourceType, source }));\r\n if (!TheLoader) {\r\n throw new Error(LOADER_NOT_FOUND);\r\n }\r\n\r\n // split file name\r\n const fileName = opts.fileName || TheLoader.extractName(source);\r\n if (fileName) {\r\n const [name, fileExt] = utils.splitFileName(fileName);\r\n _.defaults(opts, { name, fileExt, fileName });\r\n }\r\n\r\n // should it be text or binary?\r\n updateBinaryMode(opts);\r\n\r\n // FIXME: All new settings retrieved from server are applied after the loading is complete. However, we need some\r\n // flags to alter the loading process itself. Here we apply them in advance. Dirty hack. Kill the server, remove\r\n // all hacks and everybody's happy.\r\n let newOptions = _.get(opts, 'preset.expression');\r\n if (!_.isUndefined(newOptions)) {\r\n newOptions = JSON.parse(newOptions);\r\n if (newOptions && newOptions.settings) {\r\n const keys = ['singleUnit'];\r\n for (let keyIndex = 0, keyCount = keys.length; keyIndex < keyCount; ++keyIndex) {\r\n const key = keys[keyIndex];\r\n const value = _.get(newOptions.settings, key);\r\n if (!_.isUndefined(value)) {\r\n settings.set(key, value);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // create a loader\r\n const loader = new TheLoader(source, opts);\r\n loader.context = opts.context;\r\n job.addEventListener('cancel', () => loader.abort());\r\n\r\n loader.addEventListener('progress', (event) => {\r\n if (event.lengthComputable && event.total > 0) {\r\n reportProgress(loader.logger, 'Fetching', event.loaded / event.total);\r\n } else {\r\n reportProgress(loader.logger, 'Fetching');\r\n }\r\n });\r\n\r\n console.time('fetch');\r\n const promise = loader.load()\r\n .then((data) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.info('Fetching finished');\r\n job.notify({ type: 'fetchingDone', data });\r\n return data;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Fetching failed');\r\n job.notify({ type: 'fetchingDone', error });\r\n throw error;\r\n });\r\n resolve(promise);\r\n }));\r\n}\r\n\r\nfunction _parseData(data, opts, job) {\r\n if (job.shouldCancel()) {\r\n return Promise.reject(new Error('Operation cancelled'));\r\n }\r\n\r\n job.notify({ type: 'parsing' });\r\n\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType, ext: opts.fileExt, data }));\r\n if (!TheParser) {\r\n return Promise.reject(new Error('Could not find suitable parser'));\r\n }\r\n\r\n const parser = new TheParser(data, opts);\r\n parser.context = opts.context;\r\n job.addEventListener('cancel', () => parser.abort());\r\n\r\n console.time('parse');\r\n return parser.parse()\r\n .then((dataSet) => {\r\n console.timeEnd('parse');\r\n job.notify({ type: 'parsingDone', data: dataSet });\r\n return dataSet;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('parse');\r\n opts.error = error;\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Parsing failed');\r\n job.notify({ type: 'parsingDone', error });\r\n throw error;\r\n });\r\n}\r\n\r\n/**\r\n * Load molecule asynchronously.\r\n * @param {string|File} source - Molecule source to load (e.g. PDB ID, URL or File object).\r\n * @param {object=} opts - Options.\r\n * @param {string=} opts.sourceType - Data source type (e.g. 'url', 'file').\r\n * @param {string=} opts.fileType - Data contents type (e.g. 'pdb', 'cml').\r\n * @param {string=} opts.mdFile - .nc file path.\r\n * @param {boolean=} opts.keepRepsInfo - prevent reset of object and reps information.\r\n * @returns {Promise} name of the visual that was added to the viewer\r\n */\r\nMiew.prototype.load = function (source, opts) {\r\n opts = _.merge({}, opts, {\r\n context: this,\r\n });\r\n\r\n // for a single-file scenario\r\n if (!this.settings.now.use.multiFile) {\r\n // abort all loaders in progress\r\n if (this._loading.length) {\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n }\r\n\r\n // reset\r\n if (!opts.animation) { // FIXME: sometimes it is set AFTERWARDS!\r\n this.reset(true);\r\n }\r\n }\r\n\r\n this._interpolator.reset();\r\n\r\n this.dispatchEvent({ type: 'loading', options: opts, source });\r\n\r\n const job = new JobHandle();\r\n this._loading.push(job);\r\n job.addEventListener('notification', (e) => {\r\n this.dispatchEvent(e.slaveEvent);\r\n });\r\n\r\n this._spinner.spin(this._container);\r\n\r\n const onLoadEnd = (anything) => {\r\n const jobIndex = this._loading.indexOf(job);\r\n if (jobIndex !== -1) {\r\n this._loading.splice(jobIndex, 1);\r\n }\r\n this._spinner.stop();\r\n this._refreshTitle();\r\n job.notify({ type: 'loadingDone', anything });\r\n return anything;\r\n };\r\n\r\n return _fetchData(source, opts, job)\r\n .then((data) => _parseData(data, opts, job))\r\n .then((object) => {\r\n const name = this._onLoad(object, opts);\r\n return onLoadEnd(name);\r\n })\r\n .catch((err) => {\r\n this.logger.error('Could not load data');\r\n this.logger.debug(err);\r\n throw onLoadEnd(err);\r\n });\r\n};\r\n\r\n/**\r\n * Unload molecule (delete corresponding visual).\r\n * @param {string=} name - name of the visual\r\n */\r\nMiew.prototype.unload = function (name) {\r\n this._removeVisual(name || this.getCurrentVisual());\r\n this.resetPivot();\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n};\r\n\r\n/**\r\n * Start new animation. Now is broken.\r\n * @param fileData - new data to animate\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._startAnimation = function (fileData) {\r\n this._stopAnimation();\r\n const self = this;\r\n const visual = this._getComplexVisual();\r\n if (visual === null) {\r\n this.logger.error('Unable to start animation - no molecule is loaded.');\r\n return;\r\n }\r\n try {\r\n this._frameInfo = new FrameInfo(\r\n visual.getComplex(), fileData,\r\n {\r\n onLoadStatusChanged() {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo ? self._frameInfo.isLoading : true,\r\n },\r\n });\r\n },\r\n onError(message) {\r\n self._stopAnimation();\r\n self.logger.error(message);\r\n },\r\n },\r\n );\r\n } catch (e) {\r\n this.logger.error('Animation file does not fit to current complex!');\r\n return;\r\n }\r\n this._continueAnimation();\r\n};\r\n\r\n/**\r\n * Pause current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._pauseAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n this._isAnimating = false;\r\n clearInterval(this._animInterval);\r\n this._animInterval = null;\r\n if (this._frameInfo) {\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: this._isAnimating,\r\n isLoading: this._frameInfo.isLoading,\r\n },\r\n });\r\n }\r\n};\r\n\r\n/**\r\n * Continue current animation after pausing. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._continueAnimation = function () {\r\n this._isAnimating = true;\r\n let minFrameTime = 1000 / settings.now.maxfps;\r\n minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime;\r\n const self = this;\r\n const { pivot } = self._gfx;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.resetSelectionMask();\r\n visual.rebuildSelectionGeometry();\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n }\r\n this._animInterval = setInterval(() => {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo.isLoading,\r\n },\r\n });\r\n if (self._frameInfo.frameIsReady) {\r\n pivot.updateToFrame(self._frameInfo);\r\n self._updateObjsToFrame(self._frameInfo);\r\n self._refreshTitle(` Frame ${self._frameInfo._currFrame} of ${self._frameInfo._framesCount\r\n } time interval - ${self._frameInfo._timeStep}`);\r\n try {\r\n self._frameInfo.nextFrame();\r\n } catch (e) {\r\n self.logger.error('Error during animation');\r\n self._stopAnimation();\r\n return;\r\n }\r\n self._needRender = true;\r\n }\r\n }, minFrameTime);\r\n};\r\n\r\n/**\r\n * Stop current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._stopAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n clearInterval(this._animInterval);\r\n this._frameInfo.disableEvents();\r\n this._frameInfo = null;\r\n this._animInterval = null;\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: null,\r\n });\r\n};\r\n\r\n/**\r\n * Invoked upon successful loading of some data source\r\n * @param {DataSource} dataSource - Data source for visualization (molecular complex or other)\r\n * @param {object} opts - Options.\r\n * @private\r\n */\r\nMiew.prototype._onLoad = function (dataSource, opts) {\r\n const gfx = this._gfx;\r\n let visualName = null;\r\n\r\n if (opts.animation) {\r\n this._refreshTitle();\r\n this._startAnimation(dataSource);\r\n return null;\r\n }\r\n this._stopAnimation();\r\n if (!opts || !opts.keepRepsInfo) {\r\n this._opts.reps = null;\r\n this._opts._objects = null;\r\n }\r\n\r\n\r\n if (dataSource.id === 'Complex') {\r\n const complex = dataSource;\r\n\r\n // update title\r\n if (opts.fileName) {\r\n complex.name = complex.name || removeExtension(opts.fileName).toUpperCase();\r\n } else if (opts.amberFileName) {\r\n complex.name = complex.name || removeExtension(opts.amberFileName).toUpperCase();\r\n } else {\r\n complex.name = `Dynamic ${opts.fileType} molecule`;\r\n }\r\n\r\n visualName = this._addVisual(new ComplexVisual(complex.name, complex));\r\n this._curVisualName = visualName;\r\n\r\n const desc = this.info();\r\n this.logger.info(`Parsed ${opts.fileName} (${\r\n desc.atoms} atoms, ${\r\n desc.bonds} bonds, ${\r\n desc.residues} residues, ${\r\n desc.chains} chains).`);\r\n\r\n if (_.isNumber(this._opts.unit)) {\r\n complex.setCurrentUnit(this._opts.unit);\r\n }\r\n\r\n if (opts.preset) {\r\n // ...removed server access...\r\n } else if (settings.now.autoPreset) {\r\n switch (opts.fileType) {\r\n case 'cml':\r\n this.resetReps('small');\r\n break;\r\n case 'pdb':\r\n case 'mmtf':\r\n case 'cif':\r\n if (hasValidResidues(complex)) {\r\n this.resetReps('macro');\r\n } else {\r\n this.resetReps('small');\r\n }\r\n break;\r\n default:\r\n this.resetReps('default');\r\n break;\r\n }\r\n } else {\r\n this.resetReps('default');\r\n }\r\n } else if (dataSource.id === 'Volume') {\r\n this.resetEd();\r\n visualName = this._onLoadEd(dataSource);\r\n }\r\n\r\n gfx.camera.updateProjectionMatrix();\r\n this._updateFog();\r\n\r\n // reset global transform\r\n gfx.root.resetTransform();\r\n this.resetPivot();\r\n\r\n // set scale to fit everything on the screen\r\n this._objectControls.setScale(settings.now.radiusToFit / this._getBSphereRadius());\r\n\r\n this._resetObjects();\r\n\r\n if (settings.now.autoResolution) {\r\n this._tweakResolution();\r\n }\r\n\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n this._refreshTitle();\r\n\r\n return visualName;\r\n};\r\n\r\nMiew.prototype.resetEd = function () {\r\n if (this._edLoader) {\r\n this._edLoader.abort();\r\n this._edLoader = null;\r\n }\r\n\r\n // free all resources\r\n this._removeVisual(this._getVolumeVisual());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype.loadEd = function (source) {\r\n this.resetEd();\r\n\r\n const TheLoader = _.head(io.loaders.find({ source }));\r\n if (!TheLoader) {\r\n this.logger.error(LOADER_NOT_FOUND);\r\n return Promise.reject(new Error(LOADER_NOT_FOUND));\r\n }\r\n\r\n const loader = this._edLoader = new TheLoader(source, { binary: true });\r\n loader.context = this;\r\n return loader.load().then((data) => {\r\n const TheParser = _.head(io.parsers.find({ format: 'ccp4' }));\r\n if (!TheParser) {\r\n throw new Error(PARSER_NOT_FOUND);\r\n }\r\n const parser = new TheParser(data);\r\n parser.context = this;\r\n return parser.parse().then((dataSource) => {\r\n this._onLoadEd(dataSource);\r\n });\r\n }).catch((error) => {\r\n this.logger.error('Could not load ED data');\r\n this.logger.debug(error);\r\n });\r\n};\r\n\r\nMiew.prototype._onLoadEd = function (dataSource) {\r\n dataSource.normalize();\r\n\r\n const volumeVisual = new VolumeVisual('volume', dataSource);\r\n volumeVisual.getMesh().layers.set(gfxutils.LAYERS.VOLUME); // volume mesh is not visible to common render\r\n const visualName = this._addVisual(volumeVisual);\r\n\r\n this._needRender = true;\r\n return visualName;\r\n};\r\n\r\nMiew.prototype._needRebuild = function () {\r\n let needsRebuild = false;\r\n this._forEachComplexVisual((visual) => {\r\n needsRebuild = needsRebuild || visual.needsRebuild();\r\n });\r\n return needsRebuild;\r\n};\r\n\r\nMiew.prototype._rebuildObjects = function () {\r\n const self = this;\r\n const gfx = this._gfx;\r\n let i;\r\n let n;\r\n\r\n // remove old object geometry\r\n const toRemove = [];\r\n for (i = 0; i < gfx.pivot.children.length; ++i) {\r\n const child = gfx.pivot.children[i];\r\n if (!(child instanceof Visual)) {\r\n toRemove.push(child);\r\n }\r\n }\r\n for (i = 0; i < toRemove.length; ++i) {\r\n toRemove[i].parent.remove(toRemove[i]);\r\n }\r\n\r\n setTimeout(() => {\r\n const objList = self._objects;\r\n for (i = 0, n = objList.length; i < n; ++i) {\r\n const obj = objList[i];\r\n if (obj.needsRebuild) {\r\n obj.build();\r\n }\r\n if (obj.getGeometry()) {\r\n gfx.pivot.add(obj.getGeometry());\r\n }\r\n }\r\n }, 10);\r\n};\r\n\r\nMiew.prototype.changeUnit = function (unitIdx, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n throw new Error('There is no complex to change!');\r\n }\r\n\r\n function currentUnitInfo() {\r\n const unit = visual ? visual.getComplex().getCurrentUnit() : 0;\r\n const type = unit > 0 ? (`Bio molecule ${unit}`) : 'Asymmetric unit';\r\n return `Current unit: ${unit} (${type})`;\r\n }\r\n\r\n if (unitIdx === undefined) {\r\n return currentUnitInfo();\r\n }\r\n if (_.isString(unitIdx)) {\r\n unitIdx = Math.max(parseInt(unitIdx, 10), 0);\r\n }\r\n if (visual.getComplex().setCurrentUnit(unitIdx)) {\r\n this._resetScene();\r\n this._updateInfoPanel();\r\n }\r\n return currentUnitInfo();\r\n};\r\n\r\n/**\r\n * Start to rebuild geometry asynchronously.\r\n */\r\nMiew.prototype.rebuild = function () {\r\n if (this._building) {\r\n this.logger.warn('Miew.rebuild(): already building!');\r\n return;\r\n }\r\n this._building = true;\r\n\r\n this.dispatchEvent({ type: 'rebuilding' });\r\n\r\n this._rebuildObjects();\r\n\r\n this._gfx.renderer2d.reset();\r\n\r\n const rebuildActions = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.needsRebuild()) {\r\n rebuildActions.push(visual.rebuild().then(() => new Promise(((resolve) => {\r\n visual.rebuildSelectionGeometry();\r\n resolve();\r\n }))));\r\n }\r\n });\r\n\r\n // Start asynchronous rebuild\r\n const self = this;\r\n this._spinner.spin(this._container);\r\n Promise.all(rebuildActions).then(() => {\r\n self._spinner.stop();\r\n\r\n\r\n self._needRender = true;\r\n\r\n self._refreshTitle();\r\n this.dispatchEvent({ type: 'buildingDone' });\r\n self._building = false;\r\n });\r\n};\r\n\r\n/** Mark all representations for rebuilding */\r\nMiew.prototype.rebuildAll = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setNeedsRebuild();\r\n });\r\n};\r\n\r\nMiew.prototype._refreshTitle = function (appendix) {\r\n let title;\r\n appendix = appendix === undefined ? '' : appendix;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n title = visual.getComplex().name;\r\n const rep = visual.repGet(visual.repCurrent());\r\n title += (rep ? ` – ${rep.mode.name} Mode` : '');\r\n } else {\r\n title = Object.keys(this._visuals).length > 0 ? 'Unknown' : 'No Data';\r\n }\r\n title += appendix;\r\n\r\n this.dispatchEvent({ type: 'titleChanged', data: title });\r\n};\r\n\r\nMiew.prototype.setNeedRender = function () {\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._extractRepresentation = function () {\r\n const changed = [];\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCount() === 0) {\r\n return;\r\n }\r\n\r\n const selector = visual.buildSelectorFromMask(1 << visual.getSelectionBit());\r\n const defPreset = settings.now.presets.default;\r\n const res = visual.repAdd({\r\n selector,\r\n mode: defPreset[0].mode.id,\r\n colorer: defPreset[0].colorer.id,\r\n material: defPreset[0].material.id,\r\n });\r\n if (!res) {\r\n if (visual.repCount() === ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n this.logger.warn(`Number of representations is limited to ${ComplexVisual.NUM_REPRESENTATION_BITS}`);\r\n }\r\n return;\r\n }\r\n\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n visual.repCurrent(res.index);\r\n\r\n changed.push(visual.name);\r\n });\r\n\r\n if (changed.length > 0) {\r\n this.logger.report(`New representation from selection for complexes: ${changed.join(', ')}`);\r\n }\r\n};\r\n\r\n/**\r\n * Change current representation list.\r\n * @param {array} reps - Representation list.\r\n */\r\nMiew.prototype._setReps = function (reps) {\r\n reps = reps || (this._opts && this._opts.reps) || [];\r\n this._forEachComplexVisual((visual) => visual.resetReps(reps));\r\n};\r\n\r\n/**\r\n * Apply existing preset to current scene.\r\n * @param preset\r\n */\r\nMiew.prototype.applyPreset = function (preset) {\r\n const { presets } = settings.now;\r\n const presList = [\r\n preset || settings.defaults.preset,\r\n settings.defaults.preset,\r\n Object.keys(presets)[0],\r\n ];\r\n let reps = null;\r\n for (let i = 0; !reps && i < presList.length; ++i) {\r\n settings.set('preset', presList[i]);\r\n reps = presets[settings.now.preset];\r\n if (!reps) {\r\n this.logger.warn(`Unknown preset \"${settings.now.preset}\"`);\r\n }\r\n }\r\n this._setReps(reps);\r\n};\r\n\r\n/**\r\n * Reset current representation list to initial values.\r\n * @param {string} [preset] - The source preset in case of uninitialized representation list.\r\n */\r\nMiew.prototype.resetReps = function (preset) {\r\n const reps = this._opts && this._opts.reps;\r\n if (reps) {\r\n this._setReps(reps);\r\n } else {\r\n this.applyPreset(preset);\r\n }\r\n};\r\n\r\n/**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\nMiew.prototype.repCount = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repCount() : 0;\r\n};\r\n\r\n/**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {string=} [name] - Complex name. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\nMiew.prototype.repCurrent = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n const newIdx = visual ? visual.repCurrent(index) : -1;\r\n if (index && newIdx !== index) {\r\n this.logger.warn(`Representation ${index} was not found. Current rep remains unchanged.`);\r\n }\r\n return newIdx;\r\n};\r\n\r\n/**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {?object} Representation description.\r\n */\r\nMiew.prototype.rep = function (index, rep) {\r\n const visual = this._getComplexVisual('');\r\n if (!visual) {\r\n return null;\r\n }\r\n const res = visual.rep(index, rep);\r\n if (res.status === 'created') {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n } else if (res.status === 'changed') {\r\n this.dispatchEvent({ type: 'repChanged', index: res.index, name: visual.name });\r\n }\r\n return res.desc;\r\n};\r\n\r\n/**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\nMiew.prototype.repGet = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repGet(index) : null;\r\n};\r\n\r\n/**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {number} Index of the new representation.\r\n */\r\nMiew.prototype.repAdd = function (rep, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return -1;\r\n }\r\n\r\n const res = visual.repAdd(rep);\r\n if (res) {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name });\r\n return res.index;\r\n }\r\n return -1;\r\n};\r\n\r\n/**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\nMiew.prototype.repRemove = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n visual.repRemove(index);\r\n this.dispatchEvent({ type: 'repRemoved', index, name });\r\n};\r\n\r\n/**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\nMiew.prototype.repHide = function (index, hide, name) {\r\n this._needRender = true;\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repHide(index, hide) : null;\r\n};\r\n\r\nMiew.prototype._setEditMode = function (mode) {\r\n this._editMode = mode;\r\n\r\n const elem = this._msgMode;\r\n if (elem) {\r\n elem.style.opacity = (mode === EDIT_MODE.COMPLEX) ? 0.0 : 1.0;\r\n\r\n if (mode !== EDIT_MODE.COMPLEX) {\r\n const t = elem.getElementsByTagName('p')[0];\r\n t.innerHTML = (mode === EDIT_MODE.COMPONENT) ? 'COMPONENT EDIT MODE' : 'FRAGMENT EDIT MODE';\r\n }\r\n }\r\n\r\n this.dispatchEvent({ type: 'editModeChanged', data: mode === EDIT_MODE.COMPLEX });\r\n};\r\n\r\nMiew.prototype._enterComponentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const editors = [];\r\n this._forEachComplexVisual((visual) => {\r\n const editor = visual.beginComponentEdit();\r\n if (editor) {\r\n editors.push(editor);\r\n }\r\n });\r\n\r\n if (editors === []) {\r\n return;\r\n }\r\n\r\n this._editors = editors;\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- ON');\r\n this._setEditMode(EDIT_MODE.COMPONENT);\r\n this._objectControls.keysTranslateObj(true);\r\n};\r\n\r\nMiew.prototype._applyComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._needRender = true;\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._enterFragmentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const selectedVisuals = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual instanceof ComplexVisual\r\n && visual.getSelectionCount() > 0) {\r\n selectedVisuals.push(visual);\r\n }\r\n });\r\n\r\n if (selectedVisuals.length !== 1) {\r\n // either we have no selection or\r\n // we have selected atoms in two or more visuals -- not supported\r\n return;\r\n }\r\n\r\n const editor = selectedVisuals[0].beginFragmentEdit();\r\n if (!editor) {\r\n return;\r\n }\r\n this._editors = [editor];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- ON (single bond)');\r\n this._setEditMode(EDIT_MODE.FRAGMENT);\r\n this._objectControls.allowTranslation(false);\r\n this._objectControls.allowAltObjFreeRotation(editor.isFreeRotationAllowed());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._applyFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onPick = function (event) {\r\n if (!settings.now.picking) {\r\n // picking is disabled\r\n return;\r\n }\r\n\r\n if (this._animInterval !== null) {\r\n // animation playback is on\r\n return;\r\n }\r\n\r\n if (this._editMode === EDIT_MODE.FRAGMENT) {\r\n // prevent picking in fragment edit mode\r\n return;\r\n }\r\n\r\n if (this._objectControls.isEditingAltObj()) {\r\n // prevent picking during component rotation\r\n return;\r\n }\r\n\r\n // update last pick & find complex\r\n let complex = null;\r\n if (event.obj.atom) {\r\n complex = event.obj.atom.residue.getChain().getComplex();\r\n this._lastPick = event.obj.atom;\r\n } else if (event.obj.residue) {\r\n complex = event.obj.residue.getChain().getComplex();\r\n this._lastPick = event.obj.residue;\r\n } else if (event.obj.chain) {\r\n complex = event.obj.chain.getComplex();\r\n this._lastPick = event.obj.chain;\r\n } else if (event.obj.molecule) {\r\n complex = event.obj.molecule.complex;\r\n this._lastPick = event.obj.molecule;\r\n } else {\r\n this._lastPick = null;\r\n }\r\n\r\n function _updateSelection(visual) {\r\n visual.updateSelectionMask(event.obj);\r\n visual.rebuildSelectionGeometry();\r\n }\r\n\r\n // update visual\r\n if (complex) {\r\n const visual = this._getVisualForComplex(complex);\r\n if (visual) {\r\n _updateSelection(visual);\r\n this._needRender = true;\r\n }\r\n } else {\r\n this._forEachComplexVisual(_updateSelection);\r\n this._needRender = true;\r\n }\r\n\r\n this._updateInfoPanel();\r\n this.dispatchEvent(event);\r\n};\r\n\r\nMiew.prototype._onKeyDown = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n switch (event.keyCode) {\r\n case 'C'.charCodeAt(0):\r\n if (settings.now.editing) {\r\n this._enterComponentEditMode();\r\n }\r\n break;\r\n case 'F'.charCodeAt(0):\r\n if (settings.now.editing) {\r\n this._enterFragmentEditMode();\r\n }\r\n break;\r\n case 'A'.charCodeAt(0):\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._applyComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._applyFragmentEdit();\r\n break;\r\n default: break;\r\n }\r\n break;\r\n case 'D'.charCodeAt(0):\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._discardComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._discardFragmentEdit();\r\n break;\r\n default: break;\r\n }\r\n break;\r\n case 'S'.charCodeAt(0):\r\n event.preventDefault();\r\n event.stopPropagation();\r\n settings.set('ao', !settings.now.ao);\r\n this._needRender = true;\r\n break;\r\n case 107:\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.expandSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n break;\r\n case 109:\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.shrinkSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nMiew.prototype._onKeyUp = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n if (event.keyCode === 'X'.charCodeAt(0)) {\r\n this._extractRepresentation();\r\n }\r\n};\r\n\r\nMiew.prototype._updateInfoPanel = function () {\r\n const info = this._msgAtomInfo.getElementsByTagName('p')[0];\r\n let atom;\r\n let residue;\r\n\r\n let count = 0;\r\n this._forEachComplexVisual((visual) => {\r\n count += visual.getSelectionCount();\r\n });\r\n\r\n while (info.firstChild) {\r\n info.removeChild(info.firstChild);\r\n }\r\n\r\n if (count === 0) {\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n return;\r\n }\r\n\r\n let firstLine = `${String(count)} atom${count !== 1 ? 's' : ''} selected`;\r\n if (this._lastPick !== null) {\r\n firstLine += ', the last pick:';\r\n }\r\n let secondLine = '';\r\n let aName = '';\r\n let coordLine = '';\r\n\r\n if (this._lastPick instanceof Atom) {\r\n atom = this._lastPick;\r\n residue = atom.residue;\r\n\r\n aName = atom.name;\r\n const location = (atom.location !== 32) ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space\r\n secondLine = `${atom.element.fullName} #${atom.serial}${location}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}.`;\r\n secondLine += aName;\r\n\r\n coordLine = `Coord: (${atom.position.x.toFixed(2).toString()},\\\r\n ${atom.position.y.toFixed(2).toString()},\\\r\n ${atom.position.z.toFixed(2).toString()})`;\r\n } else if (this._lastPick instanceof Residue) {\r\n residue = this._lastPick;\r\n\r\n secondLine = `${residue._type._fullName}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}`;\r\n } else if (this._lastPick instanceof Chain) {\r\n secondLine = `chain ${this._lastPick._name}`;\r\n } else if (this._lastPick instanceof Molecule) {\r\n secondLine = `molecule ${this._lastPick._name}`;\r\n }\r\n\r\n info.appendChild(document.createTextNode(firstLine));\r\n\r\n if (secondLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(secondLine));\r\n }\r\n\r\n if (coordLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(coordLine));\r\n }\r\n\r\n this._msgAtomInfo.style.opacity = 1.0;\r\n};\r\n\r\nMiew.prototype._getAltObj = function () {\r\n if (this._editors) {\r\n let altObj = null;\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n const nextAltObj = this._editors[i].getAltObj();\r\n if (nextAltObj.objects.length > 0) {\r\n if (altObj) {\r\n // we have selected atoms in two or more visuals -- not supported\r\n altObj = null;\r\n break;\r\n }\r\n altObj = nextAltObj;\r\n }\r\n }\r\n if (altObj) {\r\n return altObj;\r\n }\r\n }\r\n\r\n return {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n};\r\n\r\nMiew.prototype.resetPivot = (function () {\r\n const boundingBox = new THREE.Box3();\r\n const center = new THREE.Vector3();\r\n\r\n return function () {\r\n boundingBox.makeEmpty();\r\n this._forEachVisual((visual) => {\r\n boundingBox.union(visual.getBoundaries().boundingBox);\r\n });\r\n\r\n boundingBox.getCenter(center);\r\n this._objectControls.setPivot(center.negate());\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotResidue = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (residue) {\r\n const visual = this._getVisualForComplex(residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n if (residue._controlPoint) {\r\n center.copy(residue._controlPoint);\r\n } else {\r\n let x = 0;\r\n let y = 0;\r\n let z = 0;\r\n const amount = residue._atoms.length;\r\n for (let i = 0; i < amount; ++i) {\r\n const p = residue._atoms[i].position;\r\n x += p.x / amount;\r\n y += p.y / amount;\r\n z += p.z / amount;\r\n }\r\n center.set(x, y, z);\r\n }\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotAtom = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (atom) {\r\n const visual = this._getVisualForComplex(atom.residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n center.copy(atom.position);\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.getSelectionCenter = (function () {\r\n const _centerInVisual = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n return function (center, includesAtom, selector) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCenter(_centerInVisual, includesAtom, selector || visual.getSelectionBit())) {\r\n center.add(_centerInVisual);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.negate();\r\n return true;\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotSubset = (function () {\r\n const _center = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n function _includesInCurSelection(atom, selectionBit) {\r\n return atom.mask & (1 << selectionBit);\r\n }\r\n\r\n function _includesInSelector(atom, selector) {\r\n return selector.selector.includesAtom(atom);\r\n }\r\n\r\n return function (selector) {\r\n const includesAtom = (selector) ? _includesInSelector : _includesInCurSelection;\r\n\r\n if (this.getSelectionCenter(_center, includesAtom, selector)) {\r\n this._objectControls.setPivot(_center);\r\n this.dispatchEvent({ type: 'transform' });\r\n } else {\r\n this.logger.warn('selection is empty. Center operation not performed');\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Makes a screenshot.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n * @returns {string} Data URL representing the image contents.\r\n */\r\nMiew.prototype.screenshot = function (width, height) {\r\n const gfx = this._gfx;\r\n const deviceWidth = gfx.renderer.domElement.width;\r\n const deviceHeight = gfx.renderer.domElement.height;\r\n\r\n function fov2Tan(fov) {\r\n return Math.tan(THREE.Math.degToRad(0.5 * fov));\r\n }\r\n\r\n function tan2Fov(tan) {\r\n return THREE.Math.radToDeg(Math.atan(tan)) * 2.0;\r\n }\r\n\r\n function getDataURL() {\r\n let dataURL;\r\n const currBrowser = utils.getBrowser();\r\n\r\n if (currBrowser === utils.browserType.SAFARI) {\r\n const canvas = document.createElement('canvas');\r\n const canvasContext = canvas.getContext('2d');\r\n\r\n canvas.width = width === undefined ? deviceWidth : width;\r\n canvas.height = height === undefined ? deviceHeight : height;\r\n\r\n canvasContext.drawImage(gfx.renderer.domElement, 0, 0, canvas.width, canvas.height);\r\n dataURL = canvas.toDataURL('image/png');\r\n } else {\r\n // Copy current canvas to screenshot\r\n dataURL = gfx.renderer.domElement.toDataURL('image/png');\r\n }\r\n return dataURL;\r\n }\r\n height = height || width;\r\n\r\n let screenshotURI;\r\n if ((width === undefined && height === undefined)\r\n || (width === deviceWidth && height === deviceHeight)) {\r\n // renderer.domElement.toDataURL('image/png') returns flipped image in Safari\r\n // It hasn't been resolved yet, but getScreenshotSafari()\r\n // fixes it using an extra canvas.\r\n screenshotURI = getDataURL();\r\n } else {\r\n const originalAspect = gfx.camera.aspect;\r\n const originalFov = gfx.camera.fov;\r\n const originalTanFov2 = fov2Tan(gfx.camera.fov);\r\n\r\n // screenshot should contain the principal area of interest (a centered square touching screen sides)\r\n const areaOfInterestSize = Math.min(gfx.width, gfx.height);\r\n const areaOfInterestTanFov2 = originalTanFov2 * areaOfInterestSize / gfx.height;\r\n\r\n // set appropriate camera aspect & FOV\r\n const shotAspect = width / height;\r\n gfx.renderer.setPixelRatio(1);\r\n gfx.camera.aspect = shotAspect;\r\n gfx.camera.fov = tan2Fov(areaOfInterestTanFov2 / Math.min(shotAspect, 1.0));\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n // resize canvas to the required size of screenshot\r\n gfx.renderer.setDrawingBufferSize(width, height, 1);\r\n\r\n // make screenshot\r\n this._renderFrame(settings.now.stereo);\r\n screenshotURI = getDataURL();\r\n\r\n // restore original camera & canvas proportions\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.camera.aspect = originalAspect;\r\n gfx.camera.fov = originalFov;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.renderer.setDrawingBufferSize(gfx.width, gfx.height, window.devicePixelRatio);\r\n this._needRender = true;\r\n }\r\n\r\n return screenshotURI;\r\n};\r\n\r\n/**\r\n * Makes screenshot and initiates a download.\r\n * @param {string} [filename] - Name of a file. Default to a 'screenshot-XXXXX.png', where XXXXX is a current\r\n * date/time in seconds.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n */\r\nMiew.prototype.screenshotSave = function (filename, width, height) {\r\n const uri = this.screenshot(width, height);\r\n utils.shotDownload(uri, filename);\r\n};\r\n\r\nMiew.prototype.save = function (opts) {\r\n this._export(opts.fileType).then((dataString) => {\r\n const filename = this._visuals[this._curVisualName]._complex.name;\r\n utils.download(dataString, filename, opts.fileType);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone' });\r\n }).catch((error) => {\r\n this.logger.error('Could not export data');\r\n this.logger.debug(error);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone', error });\r\n });\r\n};\r\n\r\nMiew.prototype._tweakResolution = function () {\r\n const maxPerf = [\r\n ['poor', 100],\r\n ['low', 500],\r\n ['medium', 1000],\r\n ['high', 5000],\r\n ['ultra', Number.MAX_VALUE],\r\n ];\r\n\r\n let atomCount = 0;\r\n this._forEachComplexVisual((visual) => {\r\n atomCount += visual.getComplex().getAtomCount();\r\n });\r\n\r\n if (atomCount > 0) {\r\n const performance = this._gfxScore * 10e5 / atomCount;\r\n // set resolution based on estimated performance\r\n for (let i = 0; i < maxPerf.length; ++i) {\r\n if (performance < maxPerf[i][1]) {\r\n this._autoChangeResolution(maxPerf[i][0]);\r\n break;\r\n }\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._autoChangeResolution = function (resolution) {\r\n if (resolution !== settings.now.resolution) {\r\n this.logger.report(`Your rendering resolution was changed to \"${resolution}\" for best performance.`);\r\n }\r\n settings.now.resolution = resolution;\r\n};\r\n\r\n/**\r\n * Save current settings to cookies.\r\n */\r\nMiew.prototype.saveSettings = function () {\r\n this._cookies.setCookie(this._opts.settingsCookie, JSON.stringify(this.settings.getDiffs(true)));\r\n};\r\n\r\n/**\r\n * Load settings from cookies.\r\n */\r\nMiew.prototype.restoreSettings = function () {\r\n try {\r\n const cookie = this._cookies.getCookie(this._opts.settingsCookie);\r\n const diffs = cookie ? JSON.parse(cookie) : {};\r\n this.settings.applyDiffs(diffs, true);\r\n } catch (e) {\r\n this.logger.error(`Cookies parse error: ${e.message}`);\r\n }\r\n};\r\n\r\n/**\r\n * Reset current settings to the defaults.\r\n */\r\nMiew.prototype.resetSettings = function () {\r\n this.settings.reset();\r\n};\r\n\r\n/*\r\n * DANGEROUS and TEMPORARY. The method should change or disappear in future versions.\r\n * @param {string|object} opts - See {@link Miew} constructor.\r\n * @see {@link Miew#set}, {@link Miew#repAdd}, {@link Miew#rep}.\r\n */\r\nMiew.prototype.setOptions = function (opts) {\r\n if (typeof opts === 'string') {\r\n opts = Miew.options.fromAttr(opts);\r\n }\r\n if (opts.reps) {\r\n this._opts.reps = null;\r\n }\r\n _.merge(this._opts, opts);\r\n if (opts.settings) {\r\n this.set(opts.settings);\r\n }\r\n\r\n this._opts._objects = opts._objects;\r\n this._resetObjects();\r\n\r\n if (opts.load) {\r\n this.load(opts.load, { fileType: opts.type });\r\n }\r\n\r\n if (opts.preset) {\r\n settings.now.preset = opts.preset;\r\n }\r\n\r\n if (opts.reps) {\r\n this.resetReps(opts.preset);\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.getComplex().resetCurrentUnit();\r\n if (_.isNumber(opts.unit)) {\r\n visual.getComplex().setCurrentUnit(opts.unit);\r\n }\r\n this.resetView();\r\n this.rebuildAll();\r\n }\r\n};\r\n\r\nMiew.prototype.info = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return {};\r\n }\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n return {\r\n id: metadata.id || complex.name || 'UNKNOWN',\r\n title: (metadata.title && metadata.title.join(' ')) || 'UNKNOWN DATA',\r\n atoms: complex.getAtomCount(),\r\n bonds: complex.getBondCount(),\r\n residues: complex.getResidueCount(),\r\n chains: complex.getChainCount(),\r\n };\r\n};\r\n\r\n/*\r\n * OBJECTS SEGMENT\r\n */\r\n\r\nMiew.prototype.addObject = function (objData, bThrow) {\r\n let Ctor = null;\r\n\r\n if (objData.type === LinesObject.prototype.type) {\r\n Ctor = LinesObject;\r\n }\r\n\r\n if (Ctor === null) {\r\n throw new Error(`Unknown scene object type - ${objData.type}`);\r\n }\r\n\r\n try {\r\n const newObj = new Ctor(objData.params, objData.opts);\r\n this._addSceneObject(newObj);\r\n } catch (error) {\r\n if (!bThrow) {\r\n this.logger.debug(`Error during scene object creation: ${error.message}`);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._addSceneObject = function (sceneObject) {\r\n const visual = this._getComplexVisual();\r\n if (sceneObject.build && visual) {\r\n sceneObject.build(visual.getComplex());\r\n this._gfx.pivot.add(sceneObject.getGeometry());\r\n }\r\n const objects = this._objects;\r\n objects[objects.length] = sceneObject;\r\n};\r\n\r\nMiew.prototype._updateObjsToFrame = function (frameData) {\r\n const objs = this._objects;\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n if (objs[i].updateToFrame) {\r\n objs[i].updateToFrame(frameData);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._resetObjects = function () {\r\n const objs = this._opts._objects;\r\n\r\n this._objects = [];\r\n if (objs) {\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n this.addObject(objs[i], false);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype.removeObject = function (index) {\r\n const obj = this._objects[index];\r\n if (!obj) {\r\n throw new Error(`Scene object with index ${index} does not exist`);\r\n }\r\n obj.destroy();\r\n this._objects.splice(index, 1);\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Get a string with a URL to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {string} URL\r\n */\r\nMiew.prototype.getURL = function (opts) {\r\n return options.toURL(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n })));\r\n};\r\n\r\n/**\r\n * Get a string with a script to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=true] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=true] - when this flag is true, a view information is included\r\n * @returns {string} script\r\n */\r\nMiew.prototype.getScript = function (opts) {\r\n return options.toScript(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: true,\r\n view: true,\r\n })));\r\n};\r\n\r\n/*\r\n * Generates object that represents the current state of representations list\r\n * @param {boolean} compareWithDefaults - when this flag is true, reps list is compared (if possible)\r\n * to preset's defaults and only diffs are generated\r\n */\r\nMiew.prototype._compareReps = function (complexVisual, compareWithDefaults) {\r\n const ans = {};\r\n let repCount = 0;\r\n\r\n if (complexVisual) {\r\n repCount = complexVisual.repCount();\r\n }\r\n\r\n const currPreset = settings.defaults.presets[settings.now.preset];\r\n let compare = compareWithDefaults;\r\n if (currPreset === undefined || currPreset.length > repCount) {\r\n compare = false;\r\n ans.preset = 'empty';\r\n } else if (settings.now.preset !== settings.defaults.preset) {\r\n ans.preset = settings.now.preset;\r\n }\r\n\r\n const repsDiff = [];\r\n let emptyReps = true;\r\n for (let i = 0, n = repCount; i < n; ++i) {\r\n repsDiff[i] = complexVisual.repGet(i).compare(compare ? currPreset[i] : null);\r\n if (!_.isEmpty(repsDiff[i])) {\r\n emptyReps = false;\r\n }\r\n }\r\n if (!emptyReps) {\r\n ans.reps = repsDiff;\r\n }\r\n return ans;\r\n};\r\n\r\n/*\r\n * Obtain object that represents current state of miew (might be used as options in constructor).\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {Object} State object.\r\n */\r\nMiew.prototype.getState = function (opts) {\r\n const state = {};\r\n\r\n opts = _.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n });\r\n\r\n // load\r\n const visual = this._getComplexVisual();\r\n if (visual !== null) {\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n if (metadata.id) {\r\n const format = metadata.format ? `${metadata.format}:` : '';\r\n state.load = format + metadata.id;\r\n }\r\n const unit = complex.getCurrentUnit();\r\n if (unit !== 1) {\r\n state.unit = unit;\r\n }\r\n }\r\n\r\n // representations\r\n const repsInfo = this._compareReps(visual, opts.compact);\r\n if (repsInfo.preset) {\r\n state.preset = repsInfo.preset;\r\n }\r\n\r\n if (repsInfo.reps) {\r\n state.reps = repsInfo.reps;\r\n }\r\n\r\n // objects\r\n const objects = this._objects;\r\n const objectsState = [];\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n objectsState[i] = objects[i].identify();\r\n }\r\n if (objects.length > 0) {\r\n state._objects = objectsState;\r\n }\r\n\r\n // view\r\n if (opts.view) {\r\n state.view = this.view();\r\n }\r\n\r\n // settings\r\n if (opts.settings) {\r\n const diff = this.settings.getDiffs(false);\r\n if (!_.isEmpty(diff)) {\r\n state.settings = diff;\r\n }\r\n }\r\n\r\n return state;\r\n};\r\n\r\n/**\r\n * Get parameter value.\r\n * @param {string} param - Parameter name or path (e.g. 'modes.BS.atom').\r\n * @param {*=} value - Default value.\r\n * @returns {*} Parameter value.\r\n */\r\nMiew.prototype.get = function (param, value) {\r\n return settings.get(param, value);\r\n};\r\n\r\nMiew.prototype._clipPlaneUpdateValue = function (radius) {\r\n const clipPlaneValue = Math.max(\r\n this._gfx.camera.position.z - radius * settings.now.draft.clipPlaneFactor,\r\n settings.now.camNear,\r\n );\r\n\r\n const opts = { clipPlaneValue };\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions(opts);\r\n });\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setUberOptions(opts);\r\n }\r\n }\r\n if (this._picker !== null) {\r\n this._picker.clipPlaneValue = clipPlaneValue;\r\n }\r\n};\r\n\r\nMiew.prototype._fogFarUpdateValue = function () {\r\n if (this._picker !== null) {\r\n if (this._gfx.scene.fog) {\r\n this._picker.fogFarValue = this._gfx.scene.fog.far;\r\n } else {\r\n this._picker.fogFarValue = undefined;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._updateShadowmapMeshes = function (process) {\r\n this._forEachComplexVisual((visual) => {\r\n const reprList = visual._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n process(repr.geo, repr.material);\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._updateMaterials = function (values, needTraverse = false, process = undefined) {\r\n this._forEachComplexVisual((visual) => visual.setMaterialValues(values, needTraverse, process));\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setValues(values);\r\n obj._line.material.needsUpdate = true;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._fogAlphaChanged = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions({\r\n fogAlpha: settings.now.fogAlpha,\r\n });\r\n });\r\n};\r\n\r\nMiew.prototype._embedWebXR = function () {\r\n // switch off\r\n if (settings.now.stereo !== 'WEBVR') {\r\n if (this.webVR) {\r\n this.webVR.disable();\r\n }\r\n this.webVR = null;\r\n return;\r\n }\r\n // switch on\r\n if (!this.webVR) {\r\n this.webVR = new WebVRPoC(() => {\r\n this._requestAnimationFrame(() => this._onTick());\r\n this._needRender = true;\r\n this._onResize();\r\n });\r\n }\r\n this.webVR.enable(this._gfx);\r\n};\r\n\r\nMiew.prototype._initOnSettingsChanged = function () {\r\n const on = (props, func) => {\r\n props = _.isArray(props) ? props : [props];\r\n props.forEach((prop) => {\r\n this.settings.addEventListener(`change:${prop}`, func);\r\n });\r\n };\r\n\r\n on('modes.VD.frame', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.showFrame(settings.now.modes.VD.frame);\r\n this._needRender = true;\r\n });\r\n\r\n on('modes.VD.isoMode', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n });\r\n\r\n on('bg.color', () => {\r\n this._onBgColorChanged();\r\n });\r\n\r\n on('ao', () => {\r\n if (settings.now.ao && !isAOSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support ao');\r\n settings.set('ao', false);\r\n } else {\r\n const values = { normalsToGBuffer: settings.now.ao };\r\n this._setUberMaterialValues(values);\r\n }\r\n });\r\n\r\n on('zSprites', () => {\r\n if (settings.now.zSprites && !arezSpritesSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support zSprites');\r\n settings.set('zSprites', false);\r\n }\r\n });\r\n\r\n on('fogColor', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('fogColorEnable', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('bg.transparent', (evt) => {\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n // update materials\r\n this._updateMaterials({ fogTransparent: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('draft.clipPlane', (evt) => {\r\n // update materials\r\n this._updateMaterials({ clipPlane: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('shadow.on', (evt) => {\r\n // update materials\r\n const values = { shadowmap: evt.value, shadowmapType: settings.now.shadow.type };\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.shadowMap.enabled = Boolean(values.shadowmap);\r\n }\r\n this._updateMaterials(values, true);\r\n if (values.shadowmap) {\r\n this._updateShadowCamera();\r\n this._updateShadowmapMeshes(gfxutils.createShadowmapMaterial);\r\n } else {\r\n this._updateShadowmapMeshes(gfxutils.removeShadowmapMaterial);\r\n }\r\n this._needRender = true;\r\n });\r\n\r\n on('shadow.type', (evt) => {\r\n // update materials if shadowmap is enable\r\n if (settings.now.shadow.on) {\r\n this._updateMaterials({ shadowmapType: evt.value }, true);\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on('shadow.radius', (evt) => {\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].shadow !== undefined) {\r\n const light = this._gfx.scene.children[i];\r\n light.shadow.radius = evt.value;\r\n this._needRender = true;\r\n }\r\n }\r\n });\r\n\r\n on('fps', () => {\r\n this._fps.show(settings.now.fps);\r\n });\r\n\r\n on(['fog', 'fogNearFactor', 'fogFarFactor'], () => {\r\n this._updateFog();\r\n this._needRender = true;\r\n });\r\n\r\n on('fogAlpha', () => {\r\n const { fogAlpha } = settings.now;\r\n if (fogAlpha < 0 || fogAlpha > 1) {\r\n this.logger.warn('fogAlpha must belong range [0,1]');\r\n }\r\n this._fogAlphaChanged();\r\n this._needRender = true;\r\n });\r\n\r\n on('autoResolution', (evt) => {\r\n if (evt.value && !this._gfxScore) {\r\n this.logger.warn('Benchmarks are missed, autoresolution will not work! '\r\n + 'Autoresolution should be set during miew startup.');\r\n }\r\n });\r\n\r\n on('stereo', () => {\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n this._needRender = true;\r\n });\r\n\r\n on(['transparency', 'palette'], () => {\r\n this.rebuildAll();\r\n });\r\n\r\n on('resolution', () => {\r\n // update complex visuals\r\n this.rebuildAll();\r\n\r\n // update volume visual\r\n const volume = this._getVolumeVisual();\r\n if (volume) {\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on(['axes', 'fxaa', 'ao',\r\n 'outline.on', 'outline.color', 'outline.threshold', 'outline.thickness'], () => {\r\n this._needRender = true;\r\n });\r\n};\r\n\r\n/**\r\n * Set parameter value.\r\n * @param {string|object} params - Parameter name or path (e.g. 'modes.BS.atom') or even settings object.\r\n * @param {*=} value - Value.\r\n */\r\nMiew.prototype.set = function (params, value) {\r\n settings.set(params, value);\r\n};\r\n\r\n/**\r\n * Select atoms with selection string.\r\n * @param {string} expression - string expression of selection\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\nMiew.prototype.select = function (expression, append) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n let sel = expression;\r\n if (_.isString(expression)) {\r\n sel = selectors.parse(expression).selector;\r\n }\r\n\r\n visual.select(sel, append);\r\n this._lastPick = null;\r\n\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n};\r\n\r\nconst VIEW_VERSION = '1';\r\n\r\n/**\r\n * Get or set view info packed into string.\r\n *\r\n * **Note:** view is stored for *left-handed* cs, euler angles are stored in radians and *ZXY-order*,\r\n *\r\n * @param {string=} expression - Optional string encoded the view\r\n */\r\nMiew.prototype.view = function (expression) {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n let transform = [];\r\n const eulerOrder = 'ZXY';\r\n\r\n function encode() {\r\n const pos = pivot.position;\r\n const scale = self._objectControls.getScale() / settings.now.radiusToFit;\r\n const euler = new THREE.Euler();\r\n euler.setFromQuaternion(self._objectControls.getOrientation(), eulerOrder);\r\n transform = [\r\n pos.x, pos.y, pos.z,\r\n scale,\r\n euler.x, euler.y, euler.z,\r\n ];\r\n return VIEW_VERSION + utils.arrayToBase64(transform, Float32Array);\r\n }\r\n\r\n function decode() {\r\n // backwards compatible: old non-versioned view is the 0th version\r\n if (expression.length === 40) {\r\n expression = `0${expression}`;\r\n }\r\n\r\n const version = expression[0];\r\n transform = utils.arrayFromBase64(expression.substr(1), Float32Array);\r\n\r\n // apply adapter for old versions\r\n if (version !== VIEW_VERSION) {\r\n if (version === '0') {\r\n // cancel radiusToFit included in old views\r\n transform[3] /= 8.0;\r\n } else {\r\n // do nothing\r\n self.logger.warn(`Encoded view version mismatch, stored as ${version} vs ${VIEW_VERSION} expected`);\r\n return;\r\n }\r\n }\r\n\r\n const interpolator = self._interpolator;\r\n const srcView = interpolator.createView();\r\n srcView.position.copy(pivot.position);\r\n srcView.scale = self._objectControls.getScale();\r\n srcView.orientation.copy(self._objectControls.getOrientation());\r\n\r\n const dstView = interpolator.createView();\r\n dstView.position.set(transform[0], transform[1], transform[2]);\r\n\r\n // hack to make preset views work after we moved centering offset to visual nodes\r\n // FIXME should only store main pivot offset in preset\r\n if (self._getComplexVisual()) {\r\n dstView.position.sub(self._getComplexVisual().position);\r\n }\r\n\r\n dstView.scale = transform[3]; // eslint-disable-line prefer-destructuring\r\n dstView.orientation.setFromEuler(new THREE.Euler(transform[4], transform[5], transform[6], eulerOrder));\r\n\r\n interpolator.setup(srcView, dstView);\r\n }\r\n\r\n if (typeof expression === 'undefined') {\r\n return encode();\r\n }\r\n decode();\r\n\r\n return expression;\r\n};\r\n\r\n/*\r\n * Update current view due to viewinterpolator state\r\n */\r\nMiew.prototype._updateView = function () {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n\r\n const interpolator = this._interpolator;\r\n if (!interpolator.wasStarted()) {\r\n interpolator.start();\r\n }\r\n\r\n if (!interpolator.isMoving()) {\r\n return;\r\n }\r\n\r\n const res = interpolator.getCurrentView();\r\n if (res.success) {\r\n const curr = res.view;\r\n pivot.position.copy(curr.position);\r\n self._objectControls.setScale(curr.scale * settings.now.radiusToFit);\r\n self._objectControls.setOrientation(curr.orientation);\r\n this.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n }\r\n};\r\n\r\n/**\r\n * Translate object by vector\r\n * @param {number} x - translation value (Ang) along model's X axis\r\n * @param {number} y - translation value (Ang) along model's Y axis\r\n * @param {number} z - translation value (Ang) along model's Z axis\r\n */\r\nMiew.prototype.translate = function (x, y, z) {\r\n this._objectControls.translatePivot(x, y, z);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Rotate object by Euler angles\r\n * @param {number} x - rotation angle around X axis in radians\r\n * @param {number} y - rotation angle around Y axis in radians\r\n * @param {number} z - rotation angle around Z axis in radians\r\n */\r\nMiew.prototype.rotate = function (x, y, z) {\r\n this._objectControls.rotate(new THREE.Quaternion().setFromEuler(new THREE.Euler(x, y, z, 'XYZ')));\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Scale object by factor\r\n * @param {number} factor - scale multiplier, should greater than zero\r\n */\r\nMiew.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n throw new RangeError('Scale should be greater than zero');\r\n }\r\n this._objectControls.scale(factor);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Center view on selection\r\n * @param {empty | subset | string} selector - defines part of molecule which must be centered (\r\n * empty - center on current selection;\r\n * subset - center on picked atom/residue/molecule;\r\n * string - center on atoms correspond to selection string)\r\n */\r\nMiew.prototype.center = function (selector) {\r\n // no arguments - center on current selection;\r\n if (selector === undefined) {\r\n this.setPivotSubset();\r\n this._needRender = true;\r\n return;\r\n }\r\n // subset with atom or residue - center on picked atom/residue;\r\n if (selector.obj !== undefined && ('atom' in selector.obj || 'residue' in selector.obj)) { // from event with selection\r\n if ('atom' in selector.obj) {\r\n this.setPivotAtom(selector.obj.atom);\r\n } else {\r\n this.setPivotResidue(selector.obj.residue);\r\n }\r\n this._needRender = true;\r\n return;\r\n }\r\n // string - center on atoms correspond to selection string\r\n if (selector.obj === undefined && selector !== '') {\r\n const sel = selectors.parse(selector);\r\n if (sel.error === undefined) {\r\n this.setPivotSubset(sel);\r\n this._needRender = true;\r\n return;\r\n }\r\n }\r\n // empty subset or incorrect/empty string - center on all molecule;\r\n this.resetPivot();\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\nMiew.prototype.within = function (selector, radius) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return selectors.None();\r\n }\r\n\r\n if (selector instanceof String) {\r\n selector = selectors.parse(selector);\r\n }\r\n\r\n const res = visual.within(selector, radius);\r\n if (res) {\r\n visual.rebuildSelectionGeometry();\r\n this._needRender = true;\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Get atom position in 2D canvas coords\r\n * @param {string} fullAtomName - full atom name, like A.38.CG\r\n * @returns {Object} {x, y} or false if atom not found\r\n */\r\nMiew.prototype.projected = function (fullAtomName, complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return false;\r\n }\r\n\r\n const atom = visual.getComplex().getAtomByFullname(fullAtomName);\r\n if (atom === null) {\r\n return false;\r\n }\r\n\r\n const pos = atom.position.clone();\r\n // we consider atom position to be affected only by common complex transform\r\n // ignoring any transformations that may add during editing\r\n this._gfx.pivot.updateMatrixWorldRecursive();\r\n this._gfx.camera.updateMatrixWorldRecursive();\r\n this._gfx.pivot.localToWorld(pos);\r\n pos.project(this._gfx.camera);\r\n\r\n return {\r\n x: (pos.x + 1.0) * 0.5 * this._gfx.width,\r\n y: (1.0 - pos.y) * 0.5 * this._gfx.height,\r\n };\r\n};\r\n\r\n/**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n *\r\n * @param {string=} complexName - complex name\r\n */\r\nMiew.prototype.dssp = function (complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return;\r\n }\r\n visual.getComplex().dssp();\r\n\r\n // rebuild dependent representations (cartoon or ss-colored)\r\n visual._reprList.forEach((rep) => {\r\n if (rep.mode.id === 'CA' || rep.colorer.id === 'SS') {\r\n rep.needsRebuild = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype.exportCML = function () {\r\n const self = this;\r\n\r\n function extractRotation(m) {\r\n const xAxis = new THREE.Vector3();\r\n const yAxis = new THREE.Vector3();\r\n const zAxis = new THREE.Vector3();\r\n m.extractBasis(xAxis, yAxis, zAxis);\r\n xAxis.normalize();\r\n yAxis.normalize();\r\n zAxis.normalize();\r\n const retMat = new THREE.Matrix4();\r\n retMat.identity();\r\n retMat.makeBasis(xAxis, yAxis, zAxis);\r\n return retMat;\r\n }\r\n\r\n function updateCMLData(complex) {\r\n const { root } = self._gfx;\r\n const mat = extractRotation(root.matrixWorld);\r\n const v4 = new THREE.Vector4(0, 0, 0, 0);\r\n const vCenter = new THREE.Vector4(0, 0, 0, 0);\r\n let xml = null;\r\n let ap = null;\r\n\r\n // update atoms in cml\r\n complex.forEachAtom((atom) => {\r\n if (atom.xmlNodeRef && atom.xmlNodeRef.xmlNode) {\r\n xml = atom.xmlNodeRef.xmlNode;\r\n ap = atom.position;\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n v4.applyMatrix4(mat);\r\n xml.setAttribute('x3', v4.x.toString());\r\n xml.setAttribute('y3', v4.y.toString());\r\n xml.setAttribute('z3', v4.z.toString());\r\n xml.removeAttribute('x2');\r\n xml.removeAttribute('y2');\r\n }\r\n });\r\n // update stereo groups in cml\r\n complex.forEachSGroup((sGroup) => {\r\n if (sGroup.xmlNodeRef && sGroup.xmlNodeRef.xmlNode) {\r\n xml = sGroup.xmlNodeRef.xmlNode;\r\n ap = sGroup.getPosition();\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n const cp = sGroup.getCentralPoint();\r\n if (cp === null) {\r\n v4.applyMatrix4(mat);\r\n } else {\r\n vCenter.set(cp.x, cp.y, cp.z, 0.0);\r\n v4.add(vCenter);\r\n v4.applyMatrix4(mat); // pos in global space\r\n vCenter.set(cp.x, cp.y, cp.z, 1.0);\r\n vCenter.applyMatrix4(mat);\r\n v4.sub(vCenter);\r\n }\r\n xml.setAttribute('x', v4.x.toString());\r\n xml.setAttribute('y', v4.y.toString());\r\n xml.setAttribute('z', v4.z.toString());\r\n }\r\n });\r\n }\r\n\r\n const visual = self._getComplexVisual();\r\n const complex = visual ? visual.getComplex() : null;\r\n if (complex && complex.originalCML) {\r\n updateCMLData(complex);\r\n\r\n // serialize xml structure to string\r\n const oSerializer = new XMLSerializer();\r\n return oSerializer.serializeToString(complex.originalCML);\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Reproduce the RCSB PDB Molecule of the Month style by David S. Goodsell\r\n *\r\n * @see http://pdb101.rcsb.org/motm/motm-about\r\n */\r\nMiew.prototype.motm = function () {\r\n settings.set({\r\n fogColorEnable: true,\r\n fogColor: 0x000000,\r\n outline: { on: true, threshold: 0.01 },\r\n bg: { color: 0xffffff },\r\n });\r\n\r\n this._forEachComplexVisual((visual) => {\r\n const rep = [];\r\n const complex = visual.getComplex();\r\n const palette = palettes.get(settings.now.palette);\r\n for (let i = 0; i < complex.getChainCount(); i++) {\r\n const curChainName = complex._chains[i]._name;\r\n const curChainColor = palette.getChainColor(curChainName);\r\n rep[i] = {\r\n selector: `chain ${curChainName}`,\r\n mode: 'VW',\r\n colorer: ['CB', { color: curChainColor, factor: 0.9 }],\r\n material: 'FL',\r\n };\r\n }\r\n visual.resetReps(rep);\r\n });\r\n};\r\n\r\nMiew.prototype.VERSION = (typeof PACKAGE_VERSION !== 'undefined' && PACKAGE_VERSION) || '0.0.0-dev';\r\n\r\n// Uncomment this to get debug trace:\r\n// Miew.prototype.debugTracer = new utils.DebugTracer(Miew.prototype);\r\n\r\n_.assign(Miew, /** @lends Miew */ {\r\n VERSION: Miew.prototype.VERSION,\r\n\r\n registeredPlugins: [],\r\n\r\n // export namespaces // TODO: WIP: refactoring external interface\r\n chem,\r\n io,\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n utils,\r\n gfx: {\r\n Representation,\r\n },\r\n\r\n /**\r\n * Third-party libraries packaged together with Miew.\r\n *\r\n * @property {object} lodash - [Lodash](https://lodash.com/), a modern JavaScript utility library delivering\r\n * modularity, performance & extras.\r\n * @property {object} three - [three.js](https://threejs.org/), JavaScript 3D library.\r\n *\r\n * @example\r\n * var _ = Miew.thirdParty.lodash;\r\n * var opts = _.merge({ ... }, Miew.options.fromURL(window.location.search));\r\n * var miew = new Miew(opts);\r\n */\r\n thirdParty: {\r\n lodash: _,\r\n three: THREE,\r\n },\r\n});\r\n\r\nexport default Miew;\r\n","/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,60],$V1=[1,62],$V2=[1,63],$V3=[1,65],$V4=[1,66],$V5=[1,67],$V6=[1,68],$V7=[1,69],$V8=[1,80],$V9=[1,72],$Va=[1,73],$Vb=[1,74],$Vc=[1,75],$Vd=[1,99],$Ve=[1,76],$Vf=[1,100],$Vg=[1,79],$Vh=[1,51],$Vi=[1,81],$Vj=[1,82],$Vk=[1,84],$Vl=[1,83],$Vm=[1,85],$Vn=[1,96],$Vo=[1,97],$Vp=[1,98],$Vq=[1,86],$Vr=[1,87],$Vs=[1,64],$Vt=[1,70],$Vu=[1,71],$Vv=[1,77],$Vw=[1,78],$Vx=[1,53],$Vy=[1,54],$Vz=[1,55],$VA=[1,61],$VB=[1,88],$VC=[1,89],$VD=[1,90],$VE=[1,91],$VF=[1,92],$VG=[1,93],$VH=[1,94],$VI=[1,95],$VJ=[1,101],$VK=[1,102],$VL=[1,103],$VM=[1,104],$VN=[1,105],$VO=[1,56],$VP=[1,57],$VQ=[1,58],$VR=[1,59],$VS=[1,115],$VT=[1,111],$VU=[1,114],$VV=[1,112],$VW=[1,113],$VX=[1,118],$VY=[1,117],$VZ=[1,134],$V_=[1,149],$V$=[1,150],$V01=[1,157],$V11=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V21=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,71,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V31=[5,6,7,9,13,15,17,18,19,20,23,25,26,27,30,33,34,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95],$V41=[5,70,72],$V51=[5,74],$V61=[71,101];\r\nvar parser = {trace: function trace () { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Command\":4,\"EOF\":5,\"RESET\":6,\"BUILD\":7,\"ALL\":8,\"HELP\":9,\"Path\":10,\"MOTM\":11,\"OneArgCommand\":12,\"GET\":13,\"STRING\":14,\"SET\":15,\"Value\":16,\"SET_SAVE\":17,\"SET_RESTORE\":18,\"SET_RESET\":19,\"PRESET\":20,\"AddRepresentation\":21,\"EditRepresentation\":22,\"REMOVE\":23,\"RepresentationReference\":24,\"HIDE\":25,\"SHOW\":26,\"LIST\":27,\"EXPAND_KEY\":28,\"SELECTOR_KEY\":29,\"SELECT\":30,\"AS\":31,\"WordAll\":32,\"SELECTOR\":33,\"WITHIN\":34,\"NUMBER\":35,\"OF\":36,\"MATERIAL\":37,\"IDENTIFIER\":38,\"ModeCMD\":39,\"ColorCMD\":40,\"VIEW\":41,\"BASE_64\":42,\"UNIT\":43,\"DSSP\":44,\"SCALE\":45,\"ROTATE\":46,\"AxesList\":47,\"TRANSLATE\":48,\"CENTER\":49,\"GetURLBranch\":50,\"Screenshot\":51,\"LINE\":52,\"ArgList\":53,\"LISTOBJ\":54,\"REMOVEOBJ\":55,\"URL\":56,\"VIEW_KEY\":57,\"SCREENSHOT\":58,\"LOAD\":59,\"Url\":60,\"FILE_KEY\":61,\"ADD\":62,\"Description\":63,\"REP\":64,\"MODE\":65,\"COLOR\":66,\"Descriptor\":67,\"RepresentationOwnProperty\":68,\"RepresentationOwnPropertyOpts\":69,\"DESC_KEY\":70,\"=\":71,\"DESC_KEY_OPTS\":72,\"AxesArg\":73,\"DESC_KEY_AXES\":74,\"Arg\":75,\"PathWoDescKey\":76,\"HEX\":77,\"BOOL\":78,\"Word\":79,\"CommandSetWoDESC_KEY\":80,\"DescKeys\":81,\"CLEAR\":82,\"FILE_LIST\":83,\"FILE_REGISTER\":84,\"FILE_DELETE\":85,\"PRESET_ADD\":86,\"PRESET_DELETE\":87,\"PRESET_UPDATE\":88,\"PRESET_RENAME\":89,\"PRESET_OPEN\":90,\"CREATE_SCENARIO\":91,\"RESET_SCENARIO\":92,\"DELETE_SCENARIO\":93,\"ADD_SCENARIO_ITEM\":94,\"LIST_SCENARIO\":95,\"PDB_KEY\":96,\"DELAY_KEY\":97,\"PRST_KEY\":98,\"DESCRIPTION_KEY\":99,\"CommandSet\":100,\".\":101,\"PresetPath\":102,\"/\":103,\"HexOrNumber\":104,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",6:\"RESET\",7:\"BUILD\",8:\"ALL\",9:\"HELP\",11:\"MOTM\",13:\"GET\",14:\"STRING\",15:\"SET\",17:\"SET_SAVE\",18:\"SET_RESTORE\",19:\"SET_RESET\",20:\"PRESET\",23:\"REMOVE\",25:\"HIDE\",26:\"SHOW\",27:\"LIST\",28:\"EXPAND_KEY\",29:\"SELECTOR_KEY\",30:\"SELECT\",31:\"AS\",33:\"SELECTOR\",34:\"WITHIN\",35:\"NUMBER\",36:\"OF\",37:\"MATERIAL\",38:\"IDENTIFIER\",41:\"VIEW\",42:\"BASE_64\",43:\"UNIT\",44:\"DSSP\",45:\"SCALE\",46:\"ROTATE\",48:\"TRANSLATE\",49:\"CENTER\",52:\"LINE\",54:\"LISTOBJ\",55:\"REMOVEOBJ\",56:\"URL\",57:\"VIEW_KEY\",58:\"SCREENSHOT\",59:\"LOAD\",61:\"FILE_KEY\",62:\"ADD\",64:\"REP\",65:\"MODE\",66:\"COLOR\",70:\"DESC_KEY\",71:\"=\",72:\"DESC_KEY_OPTS\",74:\"DESC_KEY_AXES\",77:\"HEX\",78:\"BOOL\",82:\"CLEAR\",83:\"FILE_LIST\",84:\"FILE_REGISTER\",85:\"FILE_DELETE\",86:\"PRESET_ADD\",87:\"PRESET_DELETE\",88:\"PRESET_UPDATE\",89:\"PRESET_RENAME\",90:\"PRESET_OPEN\",91:\"CREATE_SCENARIO\",92:\"RESET_SCENARIO\",93:\"DELETE_SCENARIO\",94:\"ADD_SCENARIO_ITEM\",95:\"LIST_SCENARIO\",96:\"PDB_KEY\",97:\"DELAY_KEY\",98:\"PRST_KEY\",99:\"DESCRIPTION_KEY\",101:\".\",103:\"/\"},\r\nproductions_: [0,[3,2],[3,1],[4,1],[4,1],[4,2],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,3],[4,3],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[4,2],[4,1],[4,2],[4,2],[4,2],[4,4],[4,2],[4,6],[4,2],[4,1],[4,1],[4,1],[4,2],[4,2],[4,1],[4,2],[4,1],[4,2],[4,2],[4,2],[4,1],[4,2],[4,1],[4,1],[4,3],[4,3],[4,4],[4,4],[4,1],[4,2],[50,1],[50,2],[50,2],[50,3],[50,3],[51,1],[51,2],[51,3],[12,2],[12,2],[12,2],[21,1],[21,2],[21,2],[21,3],[22,2],[22,3],[39,2],[39,3],[40,2],[40,3],[24,1],[24,1],[63,1],[63,2],[63,3],[63,4],[67,1],[67,1],[67,2],[68,3],[69,3],[47,1],[47,2],[73,2],[53,1],[53,2],[75,3],[16,1],[16,1],[16,1],[16,1],[16,1],[79,1],[79,1],[32,1],[32,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[100,1],[100,1],[76,1],[76,3],[76,3],[10,1],[10,1],[10,3],[10,3],[10,3],[60,1],[102,1],[102,3],[104,1],[104,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.miew.reset(false); yy.ClearContext(); yy.miew.resetReps(\"empty\");\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.miew.rebuild();\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.miew.rebuildAll(); yy.miew.rebuild();\r\nbreak;\r\ncase 6:\r\nthis.$ = yy.echo(yy.utils.help().toString());\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.echo(yy.utils.help($$[$0]).toString());\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.miew.motm();\r\nbreak;\r\ncase 10: case 11:\r\nthis.$ = yy.utils.propagateProp($$[$0]); yy.echo(yy.miew.get($$[$0]).toString());\r\nbreak;\r\ncase 12: case 13:\r\nthis.$ = yy.miew.set($$[$0-1], yy.utils.propagateProp($$[$0-1], $$[$0]));;\r\nbreak;\r\ncase 14:\r\nthis.$ = yy.miew.saveSettings();;\r\nbreak;\r\ncase 15:\r\nthis.$ = yy.miew.restoreSettings();;\r\nbreak;\r\ncase 16:\r\nthis.$ = yy.miew.resetSettings();;\r\nbreak;\r\ncase 17:\r\nthis.$ = yy.miew.resetReps();\r\nbreak;\r\ncase 18:\r\nthis.$ = yy.miew.applyPreset($$[$0]);\r\nbreak;\r\ncase 21:\r\nthis.$ = yy.miew.repRemove($$[$0]); yy.representations.remove($$[$0]);\r\nbreak;\r\ncase 22:\r\nthis.$ = yy.miew.repHide($$[$0]);\r\nbreak;\r\ncase 23:\r\nthis.$ = yy.miew.repHide($$[$0], false);\r\nbreak;\r\ncase 24:\r\nthis.$ = yy.echo(yy.utils.listRep(yy.miew, yy.representations, $$[$0], '-e'));\r\nbreak;\r\ncase 25:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations));\r\nbreak;\r\ncase 26:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations, $$[$0]));\r\nbreak;\r\ncase 27:\r\nthis.$ = yy.echo(yy.utils.listSelector(yy.miew, yy.Context));\r\nbreak;\r\ncase 28:\r\nthis.$ = yy.miew.select(yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0], true));\r\nbreak;\r\ncase 29:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.utils.checkArg($$[$0-3].toLowerCase(), $$[$0-2], true); yy.miew.select(yy.Context[$$[$0].toLowerCase()]);\r\nbreak;\r\ncase 30:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {selector : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0])});\r\nbreak;\r\ncase 31:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.miew.within(yy.utils.checkArg(\"select\", $$[$0-2], true), Number($$[$0-4]));\r\nbreak;\r\ncase 32:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {material : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 35:\r\nthis.$ = yy.echo(yy.miew.view());\r\nbreak;\r\ncase 36: case 37:\r\nthis.$ = yy.miew.view($$[$0]);\r\nbreak;\r\ncase 38:\r\nthis.$ = yy.echo(yy.miew.changeUnit());\r\nbreak;\r\ncase 39:\r\nthis.$ = yy.echo(yy.miew.changeUnit($$[$0]));\r\nbreak;\r\ncase 40:\r\nthis.$ = yy.miew.dssp();\r\nbreak;\r\ncase 41:\r\nthis.$ = yy.miew.scale($$[$0]);\r\nbreak;\r\ncase 42:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.rotate($$[$0][i]['x'] * Math.PI / 180.0, $$[$0][i]['y'] * Math.PI / 180.0, $$[$0][i]['z'] * Math.PI / 180.0)} \r\nbreak;\r\ncase 43:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.translate($$[$0][i]['x'] || 0, $$[$0][i]['y'] || 0, $$[$0][i]['z'] || 0)} \r\nbreak;\r\ncase 44:\r\nthis.$ = yy.miew.center();\r\nbreak;\r\ncase 45:\r\nthis.$ = yy.miew.center($$[$0]);\r\nbreak;\r\ncase 48: case 49:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-1], $$[$0]]}, true);\r\nbreak;\r\ncase 50: case 51:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-2], $$[$0-1]], opts:$$[$0].toJSO(yy.utils, 'objects', 'line')}, true);\r\nbreak;\r\ncase 52:\r\nthis.$ = yy.echo(yy.utils.listObjs(yy.miew));\r\nbreak;\r\ncase 53:\r\nthis.$ = yy.miew.removeObject($$[$0]);\r\nbreak;\r\ncase 54:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: false}));\r\nbreak;\r\ncase 55:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: true}));\r\nbreak;\r\ncase 56:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: false}));\r\nbreak;\r\ncase 57: case 58:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: true}));\r\nbreak;\r\ncase 59:\r\nthis.$ = yy.miew.screenshotSave();\r\nbreak;\r\ncase 60:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0]));\r\nbreak;\r\ncase 61:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0-1]), Number($$[$0]));\r\nbreak;\r\ncase 62: case 63: case 64:\r\nthis.$ = yy.utils.load(yy.miew, $$[$0]); yy.representations.clear();\r\nbreak;\r\ncase 65:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd()));\r\nbreak;\r\ncase 66:\r\nthis.$ = yy.echo(yy.representations.add($$[$0], yy.miew.repAdd()));\r\nbreak;\r\ncase 67:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 68:\r\nthis.$ = yy.echo(yy.representations.add($$[$0-1], yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 69:\r\nthis.$ = yy.miew.rep($$[$0]); yy.miew.repCurrent($$[$0]);\r\nbreak;\r\ncase 70:\r\nthis.$ = yy.miew.rep($$[$0-1], $$[$0]); yy.miew.repCurrent($$[$0-1]);\r\nbreak;\r\ncase 71:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 72:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 73:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 74:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 75:\r\nthis.$ = Number(yy.representations.get($$[$0]));\r\nbreak;\r\ncase 76: case 92:\r\nthis.$ = Number($$[$0]);\r\nbreak;\r\ncase 77:\r\nthis.$ = $$[$0];\r\nbreak;\r\ncase 78:\r\nthis.$ = yy._.assign($$[$0-1], $$[$0]);\r\nbreak;\r\ncase 79:\r\nthis.$ = yy._.assign($$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 80:\r\nthis.$ = yy._.assign($$[$0-3], $$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 81: case 82:\r\nthis.$ = yy.CreateObjectPair($$[$0].key, $$[$0].val);\r\nbreak;\r\ncase 83:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].key, new Array($$[$0-1].val, $$[$0].toJSO(yy.utils, $$[$0-1].key, $$[$0-1].val)));\r\nbreak;\r\ncase 84: case 85:\r\nthis.$ = Object.create({'key': yy.keyRemap($$[$0-2]), 'val': yy.utils.checkArg($$[$0-2], $$[$0])});\r\nbreak;\r\ncase 86:\r\nthis.$ = [$$[$0]];\r\nbreak;\r\ncase 87:\r\nthis.$ = $$[$0-1].concat($$[$0]);\r\nbreak;\r\ncase 88:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].toLowerCase(), Number($$[$0]));\r\nbreak;\r\ncase 89:\r\nthis.$ = new yy.ArgList($$[$0]);\r\nbreak;\r\ncase 90:\r\nthis.$ = $$[$0-1].append($$[$0]);\r\nbreak;\r\ncase 91:\r\nthis.$ = new yy.Arg($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 93:\r\nthis.$ = parseInt($$[$0]);\r\nbreak;\r\ncase 94:\r\nthis.$ = JSON.parse($$[$0]);\r\nbreak;\r\ncase 95: case 96:\r\nthis.$ = String($$[$0]);\r\nbreak;\r\ncase 157: case 158: case 161: case 162: case 163:\r\nthis.$ = $$[$0-2] + $$[$0-1] + $$[$0] //cause of could be color word in path;\r\nbreak;\r\ncase 166:\r\nthis.$ = $$[$0-2] = $$[$0-2] + $$[$0-1] + $$[$0];\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,5:[1,3],6:[1,4],7:[1,5],9:[1,6],11:[1,7],12:8,13:[1,9],15:[1,10],17:[1,11],18:[1,12],19:[1,13],20:[1,14],21:15,22:16,23:[1,17],25:[1,18],26:[1,19],27:[1,20],30:[1,21],33:[1,22],34:[1,23],37:[1,24],39:25,40:26,41:[1,27],43:[1,28],44:[1,29],45:[1,30],46:[1,31],48:[1,32],49:[1,33],50:34,51:35,52:[1,36],54:[1,37],55:[1,38],56:[1,44],58:[1,45],59:[1,39],62:[1,40],64:[1,41],65:[1,42],66:[1,43]},{1:[3]},{5:[1,46]},{1:[2,2]},{5:[2,3]},{5:[2,4],8:[1,47]},{5:[2,6],6:$V0,7:$V1,9:$V2,10:48,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,8]},{5:[2,9]},{6:$V0,7:$V1,9:$V2,10:106,13:$V3,14:[1,107],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{6:$V0,7:$V1,9:$V2,10:108,13:$V3,14:[1,109],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,14]},{5:[2,15]},{5:[2,16]},{5:[2,17],14:$VS,16:110,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,19]},{5:[2,20]},{24:116,35:$VX,38:$VY},{24:119,35:$VX,38:$VY},{24:120,35:$VX,38:$VY},{5:[2,25],24:121,28:[1,122],29:[1,123],35:$VX,38:$VY},{14:[1,124]},{14:[1,125]},{35:[1,126]},{38:[1,127]},{5:[2,33]},{5:[2,34]},{5:[2,35],14:[1,128],42:[1,129]},{5:[2,38],35:[1,130]},{5:[2,40]},{35:[1,131]},{47:132,73:133,74:$VZ},{47:135,73:133,74:$VZ},{5:[2,44],14:[1,136]},{5:[2,46]},{5:[2,47]},{6:$V0,7:$V1,9:$V2,10:138,13:$V3,14:[1,137],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,52]},{35:[1,139]},{14:[1,143],38:[1,141],60:140,61:[1,142]},{5:[2,65],38:[1,144],63:145,67:146,68:147,69:148,70:$V_,72:$V$},{24:151,35:$VX,38:$VY},{38:[1,152]},{38:[1,153]},{5:[2,54],29:[1,154],57:[1,155]},{5:[2,59],35:[1,156]},{1:[2,1]},{5:[2,5]},{5:[2,7],101:$V01},o($V11,[2,159]),o($V11,[2,160]),o($V21,[2,97]),o($V21,[2,98]),o($V11,[2,147]),o($V11,[2,148]),o($V11,[2,149]),o($V11,[2,150]),o($V11,[2,151]),o($V11,[2,152]),o($V11,[2,153]),o($V21,[2,101]),o($V21,[2,102]),o($V21,[2,103]),o($V21,[2,104]),o($V21,[2,105]),o($V21,[2,106]),o($V21,[2,107]),o($V21,[2,108]),o($V21,[2,109]),o($V21,[2,110]),o($V21,[2,111]),o($V21,[2,112]),o($V21,[2,113]),o($V21,[2,114]),o($V21,[2,115]),o($V21,[2,116]),o($V21,[2,117]),o($V21,[2,118]),o($V21,[2,119]),o($V21,[2,120]),o($V21,[2,121]),o($V21,[2,122]),o($V21,[2,123]),o($V21,[2,124]),o($V21,[2,125]),o($V21,[2,126]),o($V21,[2,127]),o($V21,[2,128]),o($V21,[2,129]),o($V21,[2,130]),o($V21,[2,131]),o($V21,[2,132]),o($V21,[2,133]),o($V21,[2,134]),o($V21,[2,135]),o($V21,[2,136]),o($V21,[2,137]),o($V21,[2,138]),o($V21,[2,139]),o($V21,[2,140]),o($V21,[2,141]),o($V21,[2,142]),o($V21,[2,143]),o($V21,[2,144]),o($V21,[2,145]),o($V21,[2,146]),{5:[2,10],101:$V01},{5:[2,11]},{14:$VS,16:158,35:$VT,38:$VU,77:$VV,78:$VW,101:$V01},{14:$VS,16:159,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,18]},o($V31,[2,92]),o($V31,[2,93]),o($V31,[2,94]),o($V31,[2,95]),o($V31,[2,96]),{5:[2,21]},o($V41,[2,75]),o($V41,[2,76]),{5:[2,22]},{5:[2,23]},{5:[2,24]},{5:[2,26]},{5:[2,27]},{5:[2,28],31:[1,160]},{5:[2,30]},{36:[1,161]},{5:[2,32]},{5:[2,36]},{5:[2,37]},{5:[2,39]},{5:[2,41]},{5:[2,42],73:162,74:$VZ},o($V51,[2,86]),{35:[1,163]},{5:[2,43],73:162,74:$VZ},{5:[2,45]},{14:[1,164]},{6:$V0,7:$V1,9:$V2,10:165,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR,101:$V01},{5:[2,53]},{5:[2,62]},{5:[2,63]},{5:[2,64]},{5:[2,164]},{5:[2,66],63:166,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,67]},{5:[2,77],67:167,68:147,69:148,70:$V_,72:$V$},o($V41,[2,81]),o($V41,[2,82],{80:52,53:168,75:169,76:170,79:171,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),{71:[1,172]},{71:[1,173]},{5:[2,69],63:174,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,71],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:175,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,73],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:176,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,55],57:[1,177]},{5:[2,56],29:[1,178]},{5:[2,60],35:[1,179]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,181],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:180,80:52,81:182,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,12]},{5:[2,13]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:183,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{14:[1,186]},o($V51,[2,87]),o($V51,[2,88]),{5:[2,48],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:187,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,49],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:188,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,101:$V01},{5:[2,68]},{5:[2,78],67:189,68:147,69:148,70:$V_,72:$V$},o($V41,[2,83],{80:52,76:170,79:171,75:190,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),o($V31,[2,89]),{71:[1,191],101:[1,192]},o($V61,[2,156]),{14:$VS,16:193,35:$VT,38:$VU,77:$VV,78:$VW},{14:$VS,16:194,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,70]},{5:[2,72],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,74],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,57]},{5:[2,58]},{5:[2,61]},o($V11,[2,161]),o($V11,[2,162]),o($V11,[2,163]),{5:[2,29]},{5:[2,99]},{5:[2,100]},{31:[1,195]},{5:[2,50],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,51],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,79],67:196,68:147,69:148,70:$V_,72:$V$},o($V31,[2,90]),{14:$VS,16:197,35:$VT,38:$VU,77:$VV,78:$VW},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,199],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,79:198,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},o($V41,[2,84]),o($V31,[2,85]),{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:200,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,80]},o($V31,[2,91]),o($V61,[2,157]),o($V61,[2,158]),{5:[2,31]}],\r\ndefaultActions: {3:[2,2],4:[2,3],7:[2,8],8:[2,9],11:[2,14],12:[2,15],13:[2,16],15:[2,19],16:[2,20],25:[2,33],26:[2,34],29:[2,40],34:[2,46],35:[2,47],37:[2,52],46:[2,1],47:[2,5],107:[2,11],110:[2,18],116:[2,21],119:[2,22],120:[2,23],121:[2,24],122:[2,26],123:[2,27],125:[2,30],127:[2,32],128:[2,36],129:[2,37],130:[2,39],131:[2,41],136:[2,45],139:[2,53],140:[2,62],141:[2,63],142:[2,64],143:[2,164],145:[2,67],158:[2,12],159:[2,13],166:[2,68],174:[2,70],177:[2,57],178:[2,58],179:[2,61],183:[2,29],184:[2,99],185:[2,100],196:[2,80],200:[2,31]},\r\nparseError: function parseError (str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function(match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex () {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin (condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState () {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules () {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState (n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState (condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* ignore whitespace */\r\nbreak;\r\ncase 1:return '';\r\nbreak;\r\ncase 2:return '';\r\nbreak;\r\ncase 3:return 42;\r\nbreak;\r\ncase 4:return 35;\r\nbreak;\r\ncase 5:return 77;\r\nbreak;\r\ncase 6:return 78;\r\nbreak;\r\ncase 7:return 78;\r\nbreak;\r\ncase 8:return 8;\r\nbreak;\r\ncase 9:return 6;\r\nbreak;\r\ncase 10:return 82;\r\nbreak;\r\ncase 11:return 7;\r\nbreak;\r\ncase 12:return 9;\r\nbreak;\r\ncase 13:return 59;\r\nbreak;\r\ncase 14:return 13\r\nbreak;\r\ncase 15:return 15\r\nbreak;\r\ncase 16:return 17\r\nbreak;\r\ncase 17:return 18\r\nbreak;\r\ncase 18:return 19\r\nbreak;\r\ncase 19:return 20\r\nbreak;\r\ncase 20:return 11\r\nbreak;\r\ncase 21:return 62\r\nbreak;\r\ncase 22:return 64\r\nbreak;\r\ncase 23:return 23\r\nbreak;\r\ncase 24:return 25\r\nbreak;\r\ncase 25:return 26\r\nbreak;\r\ncase 26:return 27\r\nbreak;\r\ncase 27:return 30\r\nbreak;\r\ncase 28:return 34\r\nbreak;\r\ncase 29:return 33\r\nbreak;\r\ncase 30:return 65\r\nbreak;\r\ncase 31:return 66\r\nbreak;\r\ncase 32:return 37\r\nbreak;\r\ncase 33:return 41\r\nbreak;\r\ncase 34:return 43\r\nbreak;\r\ncase 35:return 52\r\nbreak;\r\ncase 36:return 54\r\nbreak;\r\ncase 37:return 55\r\nbreak;\r\ncase 38:return 46\r\nbreak;\r\ncase 39:return 48\r\nbreak;\r\ncase 40:return 45\r\nbreak;\r\ncase 41:return 49\r\nbreak;\r\ncase 42:return 56\r\nbreak;\r\ncase 43:return 58;\r\nbreak;\r\ncase 44:return 44\r\nbreak;\r\ncase 45:return 83\r\nbreak;\r\ncase 46:return 84\r\nbreak;\r\ncase 47:return 85\r\nbreak;\r\ncase 48:return 86\r\nbreak;\r\ncase 49:return 87\r\nbreak;\r\ncase 50:return 88\r\nbreak;\r\ncase 51:return 89\r\nbreak;\r\ncase 52:return 90\r\nbreak;\r\ncase 53:return 91\r\nbreak;\r\ncase 54:return 92\r\nbreak;\r\ncase 55:return 93\r\nbreak;\r\ncase 56:return 94\r\nbreak;\r\ncase 57:return 95\r\nbreak;\r\ncase 58:return 70\r\nbreak;\r\ncase 59:return 70\r\nbreak;\r\ncase 60:return 72\r\nbreak;\r\ncase 61:return 72\r\nbreak;\r\ncase 62:return 74\r\nbreak;\r\ncase 63:return 74\r\nbreak;\r\ncase 64:return 74\r\nbreak;\r\ncase 65:return 31\r\nbreak;\r\ncase 66:return 36\r\nbreak;\r\ncase 67:return 96\r\nbreak;\r\ncase 68:return 97\r\nbreak;\r\ncase 69:return 98\r\nbreak;\r\ncase 70:return 99\r\nbreak;\r\ncase 71:yy_.yytext = yy.utils.unquoteString(yy_.yytext); return 14;\r\nbreak;\r\ncase 72:return 38;\r\nbreak;\r\ncase 73:return 5;\r\nbreak;\r\ncase 74:return 101;\r\nbreak;\r\ncase 75:return 103;\r\nbreak;\r\ncase 76:return '\\\\';\r\nbreak;\r\ncase 77:return 28\r\nbreak;\r\ncase 78:return 61\r\nbreak;\r\ncase 79:return 29\r\nbreak;\r\ncase 80:return 57\r\nbreak;\r\ncase 81:return 71\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:[#].*)/i,/^(?:\\/\\/.*)/i,/^(?:([_A-Z0-9\\/\\+]+==))/i,/^(?:-?[0-9]+(\\.[0-9]+)?\\b)/i,/^(?:0[xX][0-9A-F]+\\b)/i,/^(?:false\\b)/i,/^(?:true\\b)/i,/^(?:all\\b)/i,/^(?:reset\\b)/i,/^(?:clear\\b)/i,/^(?:build\\b)/i,/^(?:help\\b)/i,/^(?:load\\b)/i,/^(?:get\\b)/i,/^(?:set\\b)/i,/^(?:set_save\\b)/i,/^(?:set_restore\\b)/i,/^(?:set_reset\\b)/i,/^(?:preset\\b)/i,/^(?:motm\\b)/i,/^(?:add\\b)/i,/^(?:rep\\b)/i,/^(?:remove\\b)/i,/^(?:hide\\b)/i,/^(?:show\\b)/i,/^(?:list\\b)/i,/^(?:select\\b)/i,/^(?:within\\b)/i,/^(?:selector\\b)/i,/^(?:mode\\b)/i,/^(?:color\\b)/i,/^(?:material\\b)/i,/^(?:view\\b)/i,/^(?:unit\\b)/i,/^(?:line\\b)/i,/^(?:listobj\\b)/i,/^(?:removeobj\\b)/i,/^(?:rotate\\b)/i,/^(?:translate\\b)/i,/^(?:scale\\b)/i,/^(?:center\\b)/i,/^(?:url\\b)/i,/^(?:screenshot\\b)/i,/^(?:dssp\\b)/i,/^(?:file_list\\b)/i,/^(?:file_register\\b)/i,/^(?:file_delete\\b)/i,/^(?:preset_add\\b)/i,/^(?:preset_delete\\b)/i,/^(?:preset_update\\b)/i,/^(?:preset_rename\\b)/i,/^(?:preset_open\\b)/i,/^(?:create_scenario\\b)/i,/^(?:reset_scenario\\b)/i,/^(?:delete_scenario\\b)/i,/^(?:add_scenario_item\\b)/i,/^(?:list_scenario\\b)/i,/^(?:s\\b)/i,/^(?:mt\\b)/i,/^(?:m\\b)/i,/^(?:c\\b)/i,/^(?:x\\b)/i,/^(?:y\\b)/i,/^(?:z\\b)/i,/^(?:as\\b)/i,/^(?:of\\b)/i,/^(?:pdb\\b)/i,/^(?:delay\\b)/i,/^(?:prst\\b)/i,/^(?:desc\\b)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:\\.)/i,/^(?:\\/)/i,/^(?:\\\\)/i,/^(?:-e\\b)/i,/^(?:-f\\b)/i,/^(?:-s\\b)/i,/^(?:-v\\b)/i,/^(?:=)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[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,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","import palettes from '../gfx/palettes';\r\nimport settings from '../settings';\r\n\r\nconst modeIdDesc = {\r\n $help: [\r\n 'Rendering mode shortcut',\r\n ' BS - balls and sticks mode',\r\n ' LN - lines mode',\r\n ' LC - licorice mode',\r\n ' VW - van der waals mode',\r\n ' TR - trace mode',\r\n ' TU - tube mode',\r\n ' CA - cartoon mode',\r\n ' SA - isosurface mode',\r\n ' QS - quick surface mode',\r\n ' SE - solvent excluded mode',\r\n ' TX - text mode',\r\n ],\r\n BS: {\r\n $help: [\r\n ' Balls and sticks',\r\n ' aromrad = #aromatic radius',\r\n ' atom = #atom radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n CA: {\r\n $help: [\r\n ' Cartoon',\r\n ' arrow = #arrow size',\r\n ' depth = #depth of surface',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = #',\r\n ' width = #secondary width\\n',\r\n ],\r\n },\r\n LN: {\r\n $help: [\r\n ' Lines',\r\n ' atom = #atom radius',\r\n ' chunkarom = ',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' offsarom = \\n',\r\n ],\r\n },\r\n LC: {\r\n $help: [\r\n ' Licorice',\r\n ' aromrad = #aromatic radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n VW: {\r\n $help: [\r\n ' Van der Waals',\r\n ' nothing\\n',\r\n ],\r\n },\r\n TR: {\r\n $help: [\r\n ' Trace',\r\n ' radius = #tube radius\\n',\r\n ],\r\n },\r\n TU: {\r\n $help: [\r\n ' Tube',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = \\n',\r\n ],\r\n },\r\n SA: {\r\n $help: [\r\n ' Surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n QS: {\r\n $help: [\r\n ' Quick surface',\r\n ' isoValue = ',\r\n ' scale = ',\r\n ' wireframe = ',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n SE: {\r\n $help: [\r\n ' Solvent excluded surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n TX: {\r\n $help: [\r\n ' Text mode',\r\n ' template = string that can include \"{{ id }}\"',\r\n ' it will be replaced by value, id can be one of next:',\r\n ' serial, name, type, sequence, residue, chain, hetatm, water\\n',\r\n ' horizontalAlign = {\"left\", \"right\", \"center\"}',\r\n ' verticalAlign = {\"top\", \"bottom\", \"middle\"}',\r\n ' dx = #offset along x',\r\n ' dy = #offset along y',\r\n ' dz = #offset along z',\r\n ' fg = #text color modificator',\r\n ' could be keyword, named color or hex',\r\n ' fg = #back color modificator',\r\n ' could be keyword, named color or hex',\r\n ' showBg = #if set show background',\r\n ' plate under text',\r\n ],\r\n },\r\n};\r\n\r\nconst colorDesc = {\r\n $help: [\r\n 'Coloring mode shortcut',\r\n ' EL - color by element',\r\n ' CH - color by chain',\r\n ' SQ - color by sequence',\r\n ' RT - color by residue type',\r\n ' SS - color by secondary structure',\r\n ' UN - uniform',\r\n ],\r\n UN: {\r\n $help: [\r\n 'Parameters of coloring modes customization',\r\n ' Uniform',\r\n ' color = #RGB->HEX->dec\\n',\r\n ],\r\n color: {\r\n $help: Object.keys(palettes.get(settings.now.palette).namedColors).sort().join('\\n'),\r\n },\r\n },\r\n};\r\n\r\nconst materialDesc = {\r\n $help: [\r\n 'Material shortcut',\r\n ' DF - diffuse',\r\n ' TR - transparent',\r\n ' SF - soft plastic',\r\n ' PL - glossy plastic',\r\n ' ME - metal',\r\n ' GL - glass',\r\n ],\r\n};\r\n\r\nconst addRepDesc = {\r\n $help: [\r\n 'Short (packed) representation description as a set of variables',\r\n ' s=',\r\n ' selector property',\r\n ' m=[!:[,...]]',\r\n ' render mode property',\r\n ' c=[!:[,...]]',\r\n ' color mode property',\r\n ' mt=',\r\n ' material property',\r\n ],\r\n s: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n m: modeIdDesc,\r\n c: colorDesc,\r\n mt: materialDesc,\r\n};\r\n\r\nconst setGetParameterDesc = {\r\n $help: [\r\n 'Parameters of rendering modes customization: modes',\r\n 'Parameters of colorer customization: colorers',\r\n 'Autobuild: autobuild = (|)',\r\n ],\r\n modes: modeIdDesc,\r\n colorers: colorDesc,\r\n};\r\n\r\nconst help = {\r\n $help: [\r\n 'help (| )',\r\n 'You can get detailed information about command options',\r\n ' using \"help cmd.opt.opt.[...]\"\\n',\r\n ' you can use one line comments',\r\n ' everything started from (#|//) will be skipped',\r\n ' Example: >build //some comment\\n',\r\n 'List of available commands:',\r\n ],\r\n reset: {\r\n $help: [\r\n 'Reload current object, delete all representations',\r\n ' Nothing will work until load new object',\r\n ],\r\n },\r\n load: {\r\n $help: [\r\n 'load (||-f [<*.NC FILE URL STRING>])',\r\n ' Load new pdb object from selected source',\r\n ],\r\n PDBID: {\r\n $help: 'pdb id in remote molecule database',\r\n },\r\n URL: {\r\n $help: 'url to source file',\r\n },\r\n f: {\r\n $help: [\r\n 'open file system dialog to fetch local file',\r\n 'optionally you can determine trajectory file',\r\n 'via URL for *.top model',\r\n ],\r\n },\r\n },\r\n clear: {\r\n $help: 'No args. Clear terminal',\r\n },\r\n add: {\r\n $help: [\r\n 'add [] []',\r\n ' Add new item to representation set with',\r\n ' default or params',\r\n ],\r\n REP_NAME: {\r\n $help: 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n rep: {\r\n $help: [\r\n 'rep [|] []',\r\n ' set current representation by name or index',\r\n ' edit current representation by ',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n remove: {\r\n $help: [\r\n 'remove (|)',\r\n 'Remove representation by name or index',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n },\r\n selector: {\r\n $help: [\r\n 'selector ',\r\n ' set selector from EXPRESSION to current representation',\r\n ],\r\n EXPRESSION: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n },\r\n mode: {\r\n $help: [\r\n 'mode [=...]',\r\n ' set rendering mode and apply parameters to current representation',\r\n ],\r\n MODE_ID: modeIdDesc,\r\n },\r\n color: {\r\n $help: [\r\n 'color [=...]',\r\n ' set colorer and apply parameters to current representation',\r\n ],\r\n COLORER_ID: colorDesc,\r\n },\r\n material: {\r\n $help: [\r\n 'material ',\r\n ' set material to current representation',\r\n ],\r\n MATERIAL_ID: materialDesc,\r\n },\r\n build: {\r\n $help: 'build help str',\r\n add: {\r\n $help: 'build.add',\r\n new: {\r\n $help: [\r\n 'add.new',\r\n 'add.new new line 1',\r\n 'add.new new line 2',\r\n 'add.new new line 3',\r\n ],\r\n },\r\n },\r\n del: {\r\n $help: 'build.del',\r\n },\r\n },\r\n list: {\r\n $help: [\r\n 'list [-e|-s||]',\r\n 'Print representations if no args print list of representations',\r\n ' -e expand list and show all representations',\r\n ' -s show all user-registered selectors',\r\n ' | show only current representation',\r\n ],\r\n },\r\n hide: {\r\n $help: [\r\n 'hide (|)',\r\n 'Hide representation referenced in args',\r\n ],\r\n },\r\n show: {\r\n $help: [\r\n 'show (|)',\r\n 'Show representation referenced in args',\r\n ],\r\n },\r\n get: {\r\n $help: [\r\n 'get ',\r\n 'Print value',\r\n ' - path to option use get.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set: {\r\n $help: [\r\n 'set ',\r\n 'Set with ',\r\n ' - path to option use set.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set_save: {\r\n $help: [\r\n 'set_save',\r\n 'Save current settings to cookie',\r\n ],\r\n },\r\n set_restore: {\r\n $help: [\r\n 'set_restore',\r\n 'Load and apply settings from cookie',\r\n ],\r\n },\r\n set_reset: {\r\n $help: [\r\n 'set_reset',\r\n 'Reset current settings to the defaults',\r\n ],\r\n },\r\n preset: {\r\n $help: [\r\n 'preset []',\r\n 'Reset current representation or set preset to ',\r\n ],\r\n PRESET: {\r\n $help: [\r\n 'default',\r\n 'wire',\r\n 'small',\r\n 'macro',\r\n ],\r\n },\r\n },\r\n unit: {\r\n $help: [\r\n 'unit []',\r\n 'Change current biological structure view. Zero value means asymmetric unit,',\r\n 'positive values set an assembly with corresponding number.',\r\n 'Being called with no parameters command prints current unit information.',\r\n ],\r\n },\r\n view: {\r\n $help: [\r\n 'view []',\r\n 'Get current encoded view or set if ENCODED_VIEW placed as argument',\r\n ],\r\n ENCODED_VIEW: {\r\n $help: [\r\n 'encoded view matrix string (binary code)',\r\n ],\r\n },\r\n },\r\n rotate: {\r\n $help: [\r\n 'rotate (x|y|z) [] [(x|y|z) []]...',\r\n 'Rotate scene',\r\n ],\r\n },\r\n scale: {\r\n $help: [\r\n 'scale ',\r\n 'Scale scene',\r\n ],\r\n },\r\n select: {\r\n $help: [\r\n 'select [as ]',\r\n 'Select atoms using selector defined in SELECTOR_STRING',\r\n ' and if SELECTOR_NAME is defined register it in viewer',\r\n ' you can use it later as a complex selector',\r\n ],\r\n },\r\n within: {\r\n $help: [\r\n 'within of as ',\r\n 'Build within named selector',\r\n ' DISTANCE ',\r\n ' SELECTOR_STRING ',\r\n ' SELECTOR_NAME ',\r\n ],\r\n },\r\n url: {\r\n $help: [\r\n 'url [-s] [-v]',\r\n 'Report URL encoded scene',\r\n ' if -s set that include settings in the URL',\r\n ' if -v set that include view in the URL',\r\n ],\r\n },\r\n screenshot: {\r\n $help: [\r\n 'screenshot [ []]',\r\n 'Make a screenshot of the scene',\r\n ' WIDTH in pixels',\r\n ' HEIGHT in pixels, equal to WIDTH by default',\r\n ],\r\n },\r\n line: {\r\n $help: [\r\n 'line [=]',\r\n 'Draw dashed line between two specified atoms',\r\n ],\r\n },\r\n removeobj: {\r\n $help: [\r\n 'removeobj ',\r\n 'Remove scene object by its index. Indices could be obtained by command',\r\n ],\r\n },\r\n listobj: {\r\n $help: [\r\n 'listobj',\r\n 'Display the list of all existing scene objects',\r\n ],\r\n },\r\n};\r\n\r\nexport default help;\r\n","import _ from 'lodash';\r\nimport Miew from './Miew';\r\nimport { parser as parsercli } from './utils/MiewCLIParser';\r\nimport clihelp from './utils/MiewCLIHelp';\r\nimport logger from './utils/logger';\r\nimport utils from './utils';\r\n\r\nconst {\r\n chem: { selectors },\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n} = Miew;\r\n\r\nfunction None() {\r\n}\r\n\r\nconst NULL = (function () {\r\n const obj = new None();\r\n return function () {\r\n return obj;\r\n };\r\n}());\r\n\r\nclass RepresentationMap {\r\n constructor() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n\r\n get(strId) {\r\n return this.representationMap[strId] || this.representationID[strId] || '';\r\n }\r\n\r\n add(strId, index) {\r\n if (strId === -1) {\r\n return 'Can not create representation: there is no data';\r\n }\r\n\r\n if (index !== undefined) {\r\n if (!this.representationMap.hasOwnProperty(strId)) {\r\n this.representationMap[strId.toString()] = index;\r\n this.representationID[index] = strId.toString();\r\n } else {\r\n return 'This name has already existed, registered without name';\r\n }\r\n }\r\n return `Representation ${strId} successfully added`;\r\n }\r\n\r\n remove(index) {\r\n if (index && this.representationID.hasOwnProperty(index)) {\r\n delete this.representationMap[this.representationID[index]];\r\n delete this.representationID[index];\r\n }\r\n\r\n const sortedKeys = Object.keys(this.representationID).sort();\r\n for (const i in sortedKeys) {\r\n if (sortedKeys.hasOwnProperty(i)) {\r\n const id = sortedKeys[i];\r\n if (id > index) {\r\n this.representationID[id - 1] = this.representationID[id];\r\n this.representationMap[this.representationID[id]] -= 1;\r\n delete this.representationID[id];\r\n }\r\n }\r\n }\r\n }\r\n\r\n clear() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n}\r\n\r\n\r\nconst representationsStorage = new RepresentationMap();\r\n\r\nfunction keyRemap(key) {\r\n const keys = {\r\n s: 'selector',\r\n m: 'mode',\r\n c: 'colorer',\r\n mt: 'material',\r\n mode: 'modes',\r\n color: 'colorers',\r\n colorer: 'colorers',\r\n select: 'selector',\r\n material: 'materials',\r\n selector: 'selector',\r\n };\r\n const ans = keys[key];\r\n return ans === undefined ? key : ans;\r\n}\r\n\r\nclass CLIUtils {\r\n list(miew, repMap, key) {\r\n let ret = '';\r\n if (miew && repMap !== undefined) {\r\n if (key === undefined || key === '-e') {\r\n const count = miew.repCount();\r\n\r\n for (let i = 0; i < count; i++) {\r\n ret += this.listRep(miew, repMap, i, key);\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n\r\n listRep(miew, repMap, repIndex, key) {\r\n let ret = '';\r\n const rep = miew.repGet(repIndex);\r\n if (!rep) {\r\n logger.warn(`Rep ${repIndex} does not exist!`);\r\n return ret;\r\n }\r\n const index = repIndex;\r\n const repName = repMap.get(index);\r\n\r\n const { mode, colorer } = rep;\r\n const selectionStr = rep.selectorString;\r\n const material = rep.materialPreset;\r\n\r\n ret += `#${index} : ${mode.name}${repName === '' ? '' : `, ${repName}`}\\n`;\r\n\r\n if (key !== undefined) {\r\n ret += ` selection : \"${selectionStr}\"\\n`;\r\n ret += ` mode : (${mode.id}), ${mode.name}\\n`;\r\n ret += ` colorer : (${colorer.id}), ${colorer.name}\\n`;\r\n ret += ` material : (${material.id}), ${material.name}\\n`;\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listSelector(miew, context) {\r\n let ret = '';\r\n\r\n for (const k in context) {\r\n if (context.hasOwnProperty(k)) {\r\n ret += `${k} : \"${context[k]}\"\\n`;\r\n }\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listObjs(miew) {\r\n const objs = miew._objects;\r\n\r\n if (!objs || !Array.isArray(objs) || objs.length === 0) {\r\n return 'There are no objects on the scene';\r\n }\r\n\r\n const strList = [];\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n strList[i] = `${i}: ${objs[i].toString()}`;\r\n }\r\n\r\n return strList.join('\\n');\r\n }\r\n\r\n joinHelpStr(helpData) {\r\n if (helpData instanceof Array) {\r\n return helpData.join('\\n');\r\n }\r\n return helpData;\r\n }\r\n\r\n help(path) {\r\n if (_.isUndefined(path)) {\r\n return `${this.joinHelpStr(clihelp.$help)}\\n${_.slice(_.sortBy(_.keys(clihelp)), 1).join(', ')}\\n`;\r\n }\r\n\r\n const helpItem = _.get(clihelp, path);\r\n return _.isUndefined(helpItem) ? this.help() : `${this.joinHelpStr(helpItem.$help)}\\n`;\r\n }\r\n\r\n load(miew, arg) {\r\n if (miew === undefined || arg === undefined || arg === '-f') {\r\n return;\r\n }\r\n miew.awaitWhileCMDisInProcess();\r\n const finish = () => miew.finishAwaitingCMDInProcess();\r\n miew.load(arg).then(finish, finish);\r\n }\r\n\r\n checkArg(key, arg, modificate) {\r\n if (key !== undefined && arg !== undefined) {\r\n if (keyRemap(key) === 'selector') {\r\n const res = selectors.parse(arg);\r\n\r\n if (res.error !== undefined) {\r\n const selExc = { message: res.error };\r\n throw selExc;\r\n }\r\n\r\n if (modificate !== undefined && modificate) {\r\n return res.selector;\r\n }\r\n return arg;\r\n }\r\n\r\n const modificators = {\r\n colorers,\r\n modes,\r\n materials,\r\n };\r\n\r\n let modificator = key;\r\n let temp;\r\n while (modificator !== temp) {\r\n temp = modificator;\r\n modificator = keyRemap(temp);\r\n }\r\n\r\n if (modificators[modificator].get(arg) === undefined) {\r\n const exc = { message: `${arg} is not existed in ${modificator}` };\r\n throw exc;\r\n }\r\n return arg;\r\n }\r\n return NULL;\r\n }\r\n\r\n propagateProp(path, arg) {\r\n if (path !== undefined) {\r\n let argExc = {};\r\n const adapter = options.adapters[typeof _.get(settings.defaults, path)];\r\n if (adapter === undefined) {\r\n const pathExc = { message: `${path} is not existed` };\r\n throw pathExc;\r\n }\r\n\r\n if ((path.endsWith('.color') || path.endsWith('.baseColor')\r\n || path.endsWith('.EL.carbon')) && typeof arg !== 'number') {\r\n arg = palettes.get(settings.now.palette).getNamedColor(arg);\r\n }\r\n\r\n if (path.endsWith('.fg') || path.endsWith('.bg')) {\r\n if (typeof arg !== 'number') {\r\n const val = palettes.get(settings.now.palette).getNamedColor(arg, true);\r\n if (val !== undefined) {\r\n arg = `0x${val.toString(16)}`;\r\n }\r\n } else {\r\n arg = `0x${arg.toString(16)}`;\r\n }\r\n }\r\n\r\n if (path.endsWith('.template')) {\r\n arg = arg.replace(/\\\\n/g, '\\n');// NOSONAR\r\n }\r\n\r\n if (arg !== undefined && adapter(arg) !== arg && adapter(arg) !== (arg > 0)) {\r\n argExc = { message: `${path} must be a \"${typeof _.get(settings.defaults, path)}\"` };\r\n throw argExc;\r\n }\r\n }\r\n return arg;\r\n }\r\n\r\n unquoteString(value) {\r\n return utils.unquoteString(value);\r\n }\r\n}\r\n// repIndexOrRepMap could be RepresentationMap or index\r\n\r\n\r\nconst utilFunctions = new CLIUtils();\r\n\r\nfunction CreateObjectPair(a, b) {\r\n const obj = {};\r\n obj[a] = b;\r\n return obj;\r\n}\r\n\r\nfunction ArgList(arg) {\r\n if (arg instanceof this.constructor) {\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n}\r\n\r\nArgList.prototype.append = function (value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n};\r\n\r\nArgList.prototype.remove = function (value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n};\r\n\r\nArgList.prototype.toJSO = function (cliUtils, cmd, arg) {\r\n const res = {};\r\n\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n _.set(res, list[i].id, cliUtils.propagateProp(`${keyRemap(cmd)}.${arg}.${list[i].id}`, list[i].val));\r\n }\r\n\r\n return res;\r\n};\r\n\r\nfunction Arg(_id, _val) {\r\n this.id = _id;\r\n this.val = _val;\r\n}\r\n\r\nconst cliutils = Object.create({});\r\n\r\ncliutils.Arg = Arg;\r\ncliutils.ArgList = ArgList;\r\n\r\ncliutils.miew = null;\r\ncliutils.echo = null;\r\ncliutils.representations = representationsStorage;\r\ncliutils.utils = utilFunctions;\r\n\r\ncliutils._ = _;\r\ncliutils.CreateObjectPair = CreateObjectPair;\r\ncliutils.keyRemap = keyRemap;\r\ncliutils.Context = selectors.Context;\r\ncliutils.ClearContext = selectors.ClearContext;\r\n\r\ncliutils.NULL = NULL;\r\n\r\ncliutils.notimplemented = function () {\r\n return this.NULL;\r\n};\r\n\r\nMiew.prototype.script = function (script, _printCallback, _errorCallback) {\r\n parsercli.yy.miew = this;\r\n parsercli.yy.echo = _printCallback;\r\n parsercli.yy.error = _errorCallback;\r\n if (this.cmdQueue === undefined) {\r\n this.cmdQueue = [];\r\n }\r\n\r\n if (this.commandInAction === undefined) {\r\n this.commandInAction = false;\r\n }\r\n\r\n this.cmdQueue = this.cmdQueue.concat(script.split('\\n'));\r\n};\r\n\r\nMiew.prototype.awaitWhileCMDisInProcess = function () {\r\n this.commandInAction = true;\r\n};\r\n\r\nMiew.prototype.finishAwaitingCMDInProcess = function () {\r\n this.commandInAction = false;\r\n};\r\n\r\nMiew.prototype.isScriptingCommandAvailable = function () {\r\n return this.commandInAction !== undefined\r\n && !this.commandInAction\r\n && this.cmdQueue !== undefined\r\n && this.cmdQueue.length > 0;\r\n};\r\n\r\nMiew.prototype.callNextCmd = function () {\r\n if (this.isScriptingCommandAvailable()) {\r\n const cmd = this.cmdQueue.shift();\r\n\r\n const res = {};\r\n res.success = false;\r\n try {\r\n parsercli.parse(cmd);\r\n res.success = true;\r\n } catch (e) {\r\n res.error = e.message;\r\n parsercli.yy.error(res.error);\r\n this.finishAwaitingCMDInProcess();\r\n }\r\n return res;\r\n }\r\n return '';\r\n};\r\n\r\nparsercli.yy = cliutils;\r\n// workaround for incorrect JISON parser generator for AMD module\r\nparsercli.yy.parseError = parsercli.parseError;\r\n"],"names":["this","Timer","startTime","oldTime","elapsedTime","running","now","getElapsedTime","update","delta","newTime","p","window","performance","bind","Date","createElement","tag","id","css","element","document","style","cssText","Stats","domElement","_text","appendChild","_startTime","_prevTime","_deltas","Array","_index","_total","_count","time","length","ms","fps","textContent","toPrecision","end","on","undefined","display","_typeof","isUndefOrEqual","param","value","EventDispatcher","_handlers","prototype","addEventListener","type","callback","context","handlers","params","_checkPar","par","_","find","push","removeEventListener","self","forEach","handler","ev","remove","values","omitBy","dispatchEvent","event","apply","priorities","debug","info","report","warn","error","Logger","call","console","_priority","Object","create","constructor","instantiate","verify","number","isNumber","Error","defineProperty","get","findKey","set","level","levels","keys","message","priority","_message","String","output","log","browserType","DEFAULT","SAFARI","encodeQueryComponent","text","excludeExp","encode","code","fromCharCode","parseInt","substr","encodeURIComponent","replace","decodeQueryComponent","decodeURIComponent","getUrlParameters","url","location","search","query","substring","indexOf","result","match","exec","getUrlParametersAsDict","a","i","key","resolveURL","str","URL","href","anchor","generateRegExp","symbolStr","symbolList","n","charCodeAt","toString","listStr","join","RegExp","attrs","content","setAttribute","child","createTextNode","HTMLElement","deriveClass","cls","base","members","statics","assign","deriveDeep","obj","needZeroOwnProperties","res","copy","hexColor","color","hex","DebugTracer","namespace","enabled","enable","indent","methods","wrap","method_","name_","spaces","logger","args","name","method","Function","OutOfMemoryError","allocateTyped","TypedArrayName","size","e","RangeError","bytesToBase64","buffer","bytes","Uint8Array","binary","byteLength","btoa","bytesFromBase64","atob","arrayToBase64","array","TypedArrayClass","arrayFromBase64","slice","compareOptionsWithDefaults","opts","defOpts","optsStr","isAlmostPlainObject","o","isPlainObject","proto","getPrototypeOf","hasOwnProperty","objectsDiff","src","dst","diff","forIn","srcValue","dstValue","deepDiff","isEmpty","isEqual","forInRecursive","object","iterateThrough","prefix","newPref","enquoteString","isString","unquoteString","SyntaxError","getFileExtension","fileName","Math","max","lastIndexOf","Infinity","splitFileName","ext","dataUrlToBlob","parts","split","partsCount","Blob","getBrowser","navigator","vendor","userAgent","shotOpen","open","write","shotDownload","dataUrl","filename","msSaveBlob","link","download","innerHTML","createObjectURL","body","click","removeChild","data","blobData","copySubArrays","indices","itemSize","j","shallowCloneNode","node","newNode","cloneNode","worldPos","unquotedStringRE","enquoteHelper","correctSelectorIdentifier","test","concatTypedArraysUnsafe","first","second","mergeTypedArraysUnsafe","reduce","acc","cur","start","count","JobHandle","_shouldCancel","slaveEvent","VERSION","defaults","modes","BS","atom","bond","space","multibond","aromrad","showarom","polyComplexity","poor","low","medium","high","ultra","VW","LN","offsarom","chunkarom","lineWidth","LC","SA","zClip","probeRadius","subset","wireframe","SE","QS","isoValue","gaussLim","scale","gridSpacing","CS","probePositions","TR","radius","TU","heightSegmentsRatio","tension","CA","depth","ss","helix","width","arrow","strand","TX","template","horizontalAlign","verticalAlign","dx","dy","dz","fg","bg","showBg","VD","kSigma","kSigmaMed","kSigmaMax","frame","isoMode","colorers","EL","carbon","UN","CO","baseColor","CB","factor","SQ","gradient","TM","min","OC","HY","MO","antialias","camFov","camNear","camFar","camDistance","radiusToFit","fogNearFactor","fogFarFactor","fogAlpha","fogColor","fogColorEnable","palette","resolution","autoResolution","autoPreset","preset","presets","mode","colorer","selector","material","empty","wire","small","macro","objects","line","dashSize","gapSize","transparent","draft","clipPlane","clipPlaneFactor","clipPlaneSpeed","plugins","axes","fog","zSprites","isoSurfaceFakeOpacity","suspendRender","nowater","autobuild","fxaa","outline","threshold","thickness","ao","shadow","autoRotation","maxfps","fbxprec","autoRotationAxisFixed","zooming","picking","pick","editing","aromatic","singleUnit","stereo","interpolateViews","transparency","translationSpeed","example","good","ssaoKernelRadius","ssaoFactor","stereoBarrel","use","multiFile","Settings","old","_changed","reset","utils","path","oldValue","_notifyChange","merge","_notifyChanges","defaultValue","cloneDeep","checkpoint","deepValue","deepPath","changed","filter","applyDiffs","diffs","getDiffs","versioned","setPluginOpts","plugin","repIndex","asBoolean","toLowerCase","adapters","string","Number","cL1Ass","cOptsSep","cL2Ass","cLSep","cCommonIgnoreSymbols","getLevel1ExcludedExpr","cLevel1Ignores","getLevel2ExcludedExpr","cLevel2Ignores","cL1ExclExpr","encodeQueryComponentL1","cL2ExclExpr","encodeQueryComponentL2","ensureRepList","reps","settings","ensureRepAssign","prop","rep","addObject","options","_objects","newOpts","newObj","parseParams","sep","extractArgs","input","defaultsDict","bang","inputVal","arg","pair","adapter","actions","l","load","t","v","view","u","unit","menu","isArray","r","s","select","m","c","mt","materials","dup","ar","_fromArray","entries","entry","action","isFunction","fromAttr","attr","fromURL","_processOptsForURL","_processArgsForURL","_processObjForURL","objOpts","toURL","stringList","idx","checkAndAdd","addReps","repList","addObjects","objList","protocol","host","pathname","_processOptsForScript","_processArgsForScript","_processObjForScript","map","_processRepsForScript","index","repString","strIdx","localAdd","toScript","commandsList","command","saveQuotes","quote","trim","Atom","residue","position","role","het","serial","occupancy","temperature","charge","mask","hydrogenCount","radicalCount","valence","bonds","flags","Flags","HYDROGEN","CARBON","process","_chain","getName","_sequence","NONPOLARH","Element","fullName","weight","radiusBonding","hValency","hydrogenValency","U1","Lead","U2","Wing","U18","N","Constants","C","O","SG","D","T","byAtomicNumber","ByAtomicNumber","byName","ByName","getByName","cBondTypes","UNKNOWN","COVALENT","AROMATIC","getAtomPos","Bond","left","right","order","fixed","_left","_right","_fixed","_order","_type","distanceTo","currAtom","_forEachNeighbour","l2Atom","refPoint","currDir","posGetter","rightCount","leftCount","tmpVec","clone","checkDir","sub","dotProd","dot","checkCarbon","stages","forEachLevelOne","forEachLevelTwo","stageId","multiplyScalar","third","maxNeibs","another","secondPos","firstV","secondV","crossVectors","lengthSq","normalize","_fixDir","BondType","cNucleicControlNames","cNucleicWing1Names","cNucleicWing2Names","cCylinderSource","cCylinderTarget","types","atoms","Residue","chain","sequence","icode","_component","_icode","_mask","_atoms","_secondary","_firstAtom","_leadAtom","_wingAtom","_lastAtom","_controlPoint","_midPoint","_wingVector","_cylinders","_isValid","_het","_molecule","xyz","altLoc","tempFactor","complex","getComplex","addAtom","forEachAtom","names","_findAtomByName","_name","next","getAtomPosition","leadAtom","_findFirstAtomInList","wingStart","wingEnd","cylSource","targetList","getCylinderTargetList","cylTarget","prevLeadPos","currLeadPos","prevWingPos","prevWing","vectorA","vectorB","needToNegate","abs","angleTo","PI","negate","prevRes","prev","nextRes","chainAsNucleic","bFirstInChain","lp","THREE","x","y","z","_detectLeadWing","lerp","calcWing","asNucleic","_innerFinalize","anotherResidue","tempCount","occupCount","ResidueType","letterCode","_fullName","ALA","ARG","ASN","ASP","CYS","GLN","GLU","GLY","HIS","ILE","LEU","LYS","MET","PHE","PRO","PYL","SEC","SER","THR","TRP","TYR","VAL","A","G","I","U","DA","DC","DG","DI","DT","DU","WAT","H2O","HOH","DOD","UNK","UNL","PROTEIN","BASIC","ACIDIC","POLAR","NONPOLAR","NUCLEIC","PURINE","PYRIMIDINE","DNA","RNA","WATER","_addFlag","flag","list","StandardTypes","hydro","_addParam","ChainType","Chain","_complex","_residues","minSequence","POSITIVE_INFINITY","maxSequence","NEGATIVE_INFINITY","residues","seqNum","iCode","_determineType","curr","_finalize2","frameData","prevData","frameRes","currData","getResidueType","addResidueType","addResidue","StructuralElement","init","term","generic","genericByType","serialAtomMap","residueHash","splitUnifiedSerial","chainId","serialId","hashCode","getUnifiedSerial","Type","STRAND","BRIDGE","HELIX_310","HELIX_ALPHA","HELIX_PI","HELIX","TURN_310","TURN_ALPHA","TURN_PI","TURN","BEND","COIL","Generic","LOOP","StructuralElementType","StructuralElementGeneric","typeByPDBHelixClass","Helix","helixClass","comment","Strand","sheet","sense","atomCur","atomPrev","as","isNaN","Sheet","_width","_strands","_finalize","SGroup","saveNode","_id","_position","_charge","_repeat","_center","xmlNodeRef","nLimon","bLow","bHight","aPos","addVectors","parser","k","$V0","$V1","$V2","$V3","$V4","$V5","$V6","$V7","$V8","$V9","$Va","$Vb","$Vc","$Vd","trace","yy","symbols_","terminals_","productions_","performAction","anonymous","yytext","yyleng","yylineno","yystate","$$","_$","$0","$","keyword","GetSelector","RangeList","append","Range","ValueList","table","defaultActions","parseError","hash","recoverable","parse","stack","tstack","vstack","lstack","TERROR","EOF","arguments","lexer","sharedState","setInput","yylloc","yyloc","ranges","lex","token","pop","symbol","state","yyval","len","newState","expected","errStr","showPosition","loc","first_line","last_line","first_column","last_column","range","concat","_input","_more","_backtrack","done","matched","conditionStack","offset","ch","lines","unput","oldLines","more","reject","backtrack_lexer","less","pastInput","past","upcomingInput","pre","test_match","indexed_rule","backup","matches","tempMatch","rules","_currentRules","flex","begin","condition","popState","conditions","topState","pushState","stateStackSize","yy_","$avoiding_name_collisions","YY_START","Parser","List","_values","splice","toJSON","includes","valuesArray","upperOnly","toUpperCase","_validate","Selector","ListSelector","RangeListSelector","ValueListSelector","caseSensitive","NoneSelector","_atom","AllSelector","none","PrefixOperator","rhs","InfixOperator","lhs","keywords","defineSelector","SelectorClass","factory","NULL_SELECTOR","defineOperator","OperatorClass","includesAtom","byResidueTypeFlag","selectors","Context","exc","ClearContext","BiologicalUnit","_selector","_boundaries","boundingBox","boundingSphere","makeEmpty","expandByPoint","bbc","getCenter","setFromCenterAndSize","radiusSquared","center","pos","lengthSquared","distanceToSquared","sqrt","Assembly","chains","matrices","oldCenter","oldRad","applyMatrix4","newRad","addScalar","subScalar","matrix","Component","_residueIndices","_cycles","_subDivs","_residueCount","resIdc","idIdc","idCount","last","subDivs","resCnt","_bonds","forEachCycle","cycle","forEachResidue","cycles","subs","currRes","endRes","_forEachSubChain","_subIdx","currIdx","lastSubIdx","subIdx","arr","boundaries","cMaxPairsForHashCode","cHashTableSize","cNumbersPerPair","cMaxNeighbours","cInvalidVal","cBigPrime","AtomPairs","maxPairsEstimate","numPairs","numMaxPairs","intBuffer","Int32Array","hashBuffer","indexA","indexB","ia","ib","codeToAdd","apI","cEstBondsMultiplier","cSpaceCode","cBondTolerance","cEpsilon","_getBondingRadius","_isAtomEligible","isHet","AutoBond","_maxRad","bBox","getDefaultBoundaries","_vBoxMin","_vBoxMax","_pairCollection","getAtoms","numAtoms","aInd","collection","numBondsForAtom","bInd","indTo","addPair","vw","getVoxelWorld","atomsNum","rA","isHydrogenA","posA","locationA","atomA","processAtom","atomB","isHydrogen","locationB","dist2","rB","maxAcceptable","forEachAtomWithinRadius","iA","iB","_addPair","bondsA","numBonds","newBond","addBond","_buildInner","_calcBoundingBox","_addExistingPairs","_findPairs","_addPairs","nAtoms","maxRad","destroy","cCrossThresh","cAromaticType","cAromaticAtoms","_coDirVectors","v1Tmp","v2Tmp","cp","v1","v2","_insertAscending","val","_anotherAtom","_cosBetween","theta","clamp","_markAromatic","Cycle","atomsList","nA","add","nextAtom","checkBond","forEachBond","_isAromatic","_isPossibleAromatic","rightIdx","leftIdx","_checkCycleSimple","_checkCycleComplex","assert","AromaticLoopsMarker","bondsData","bondMarks","_bondsData","_bondMarks","_resetCycles","_currIdx","bond1","bond2","arr1","arr2","n1","n2","i1","i2","prevBond","currRight","bondsOrder","currLeft","currVec","startAtomRef","_currStart","checkAromatic","_checkBond","_haveSameCycle","anotherAtom","anotherVec","newDir","cross","dir","newRight","_tryBond","checkCycle","forEachComponent","component","_startCycle","newCycle","addCycle","_findLoops","_getSphereSliceRadiusRange","zMin","zMax","dzMin","dzMax","rzMin","rzMax","rMin","rMax","_getCircleSliceRadiusRange","yMin","yMax","dyMin","dyMax","ryMin","ryMax","VoxelWorld","box","vCellSizeHint","_box","getSize","divide","floor","_last","_cellSize","_cellInnerR","_cellOuterR","numVoxels","_voxels","getAtomCount","voxelIdx","_findVoxel","point","zero","_zero","voxel","_voxel","xRange","_xRange","yRange","_yRange","zRange","_zRange","_forEachVoxelWithinRadiusSimple","rRangeXY","rRangeX","xVal","yVal","zVal","isInsideX","isInsideY","isInsideZ","divideScalar","clampScalar","vCenter","_vCenter","distTouch2","distInside2","d2","r2","_forEachVoxelWithinRadius","isInside","_forEachAtomInVoxel","dist","_forEachAtomWithinDistFromGroup","atomProc","voxels","processIfWithin","MINIMAL_DISTANCE","MIN_HBOND_ENERGY","MAX_HBOND_ENERGY","COUPLING_CONSTANT","MAX_COUPLING_DISTANCE","MAX_RESIDUES_THRESHOLD","HBondInfo","_hbonds","_buildVW","_build","from","to","acceptor","acc0","acc1","energy","ri","getType","preri","rj","prerj","_calcHBondEnergy","pairs","PairCollection","_residueGetCAlpha","_residueGetCO","h","predonor","donor","_residueGetNH","distanceHO","distanceHC","distanceNC","distanceNO","round","donorInfo","accInfo","BridgeType","freeze","NO_BRIDGE","PARALLEL","ANTI_PARALLEL","HelixFlag","START","MIDDLE","END","START_AND_END","StructureType","SecondaryStructureMap","_ss","_sheet","_betaPartners","_bend","getResidues","_helixFlags","_chainLengths","_chains","_buildBetaSheets","_buildAlphaHelices","inResidues","chainLength","inPreferPiHelices","stride","isBond","kappa","_kappa","_isHelixStart","isTurn","p1","p2","p3","p4","v12","v34","prevPrev","nextNext","curCA","ppCA","nnCA","ckap","_cosinusAngle","skap","atan2","bridges","lenA","chainA","b","lenB","chainB","_testBridge","found","bridge","unshift","chainI","getChain","chainJ","sort","ibi","iei","jbi","jei","ibj","iej","jbj","jej","_hasChainBreak","bulge","ladderset","Set","ladder","sheetset","toMove","_areBridgesLinked","betai","betaj","parallel","d","f","ai","aj","has","VOXEL_SIZE","helixClassMap","loopMap","Complex","_components","_helices","_sheets","structures","_residueTypes","_sgroups","_molecules","_maskNeedsUpdate","metadata","symmetry","units","_currentUnit","forEachChain","updateToFrame","resName","rt","chainName","resId","atomName","localeCompare","molecules","groups","components","maxSerial","chainShift","uniSerial","remnant","insCode","ser","addComp","comp","resCount","currStart","isConnected","setSubDivs","currSubDivs","enableEditing","_fillCmpEdit","_fillCmpNoedit","getBoundaries","getTransforms","getSelector","setCurrentUnit","newUnit","computeBoundaries","_computeBounds","_finalizeBonds","forEachSGroup","_rebuildSGroupOnAtomChange","updateStructuresMask","getBonds","finalize","getSequence","getICode","helices","sheets","needAutoBonding","autoConnector","build","other","_fillComponents","marker","markCycles","detectAromaticLoops","detectCycles","_finalizeMolecules","molecule","updater","structure","collectMask","forEachMolecule","setMask","clearMask","totalSelector","reseter","_atomNames","dict","_elements","_residueNames","_chainNames","_altlocNames","_voxelWorld","addAtoms","srcArray","dstArray","functor","elem","complexes","atomBias","bondBias","residueBias","chainBias","componentBias","bias","processBond","processResidue","processChain","processComponent","doNothing","addElement","ssMap","getSheet","item","lastCode","lastSheetIndex","lastHelixIndex","curStructure","curCode","curResidue","curSheetIndex","loopType","curSheet","addStrand","pow2ceil","Volume","dimensions","vecSize","volumeInfo","_dimVec","_volumeInfo","_dimX","_dimY","_dimZ","_rowElements","_planeElements","_totalElements","_data","getValue","setValue","addValue","boxSize","Float32Array","vl","getCellSize","vs","xSize","ySize","zSize","volMap","_voxelValue","zi","zm","zp","yi","ym","yp","xi","xm","xp","tilesX","ceil","tilesY","height","tileRow","row","texture","needsUpdate","Molecule","CSS2DObject","_element","parentNode","transp","el","getElement","op","top","op100","opacity","RCGroup","raycaster","intersects","visible","children","raycast","innerOnly","enableSubset","disableSubset","totalSubset","getSubset","precision","renderer","capabilities","getMaxPrecision","noiseWidth","noiseHeight","_noiseData","_noiseWrapS","_noiseWrapT","_noiseMinFilter","_noiseMagFilter","_noiseMapping","noiseTexture","_samplesKernel","defaultUniforms","lights","diffuse","specular","shininess","fixedColor","zOffset","zClipValue","clipPlaneValue","invModelViewMatrix","world2colorMatrix","dashedLineSize","dashedLinePeriod","projMatrixInv","viewport","samplesKernel","noiseTex","noiseTexelSize","srcTexelSize","uberOptionNames","UberMaterial","instancedPos","instancedMatrix","attrColor","attrColor2","attrAlphaColor","overrideColor","sphereSprite","cylinderSprite","fakeOpacity","prepassTransparancy","colorFromPos","shadowmap","shadowmapType","colorFromDepth","dashedLine","thickLine","fogTransparent","normalsToGBuffer","toonShading","uberOptions","setValues","uniforms","vertexShader","precisionString","fragmentShader","side","zClipCoef","noise","source","defines","extensions","createInstance","inst","USE_FOG","INSTANCED_POS","INSTANCED_MATRIX","ATTR_COLOR","ATTR_COLOR2","ATTR_ALPHA_COLOR","OVERRIDE_COLOR","SPHERE_SPRITE","fragDepth","CYLINDER_SPRITE","ZCLIP","CLIP_PLANE","FAKE_OPACITY","USE_LIGHTS","COLOR_FROM_POS","SHADOWMAP","SHADOWMAP_PCF_SHARP","SHADOWMAP_PCF_RAND","SHADOWMAP_BASIC","COLOR_FROM_DEPTH","PREPASS_TRANSP","DASHED_LINE","THICK_LINE","FOG_TRANSPARENT","drawBuffers","NORMALS_TO_G_BUFFER","TOON_SHADING","setUberOptions","shallow","updateUniforms","LAYERS","VOLUME","TRANSPARENT","PREPASS_TRANSPARENT","VOLUME_BFPLANE","COLOR_FROM_POSITION","SELECTION_LAYERS","resetTransform","quaternion","updateMatrixWorldRecursive","parent","updateMatrixWorld","addSavingWorldTransform","_worldMatrixInverse","getInverse","matrixWorld","multiply","decompose","renderDummyQuad","_material","depthWrite","_scene","_quad","_camera","render","renderScreenQuad","isIdentity","identity","equals","applyToPointsArray","w","elements","persp","ScreenQuadMaterial","srcTex","vertexScreenQuadShader","depthTest","renderScreenQuadFromTex","fragmentScreenQuadFromTex","renderScreenQuadFromTexWithDistortion","coef","fragmentScreenQuadFromTexWithDistortion","setMinimalFov","angle","aspect","fov","radToDeg","atan","tan","degToRad","updateHalfSized","camera","originalAspect","originalFov","updateProjectionMatrix","setDistanceToFit","sin","intersectVisibleObject","gfxObj","fogFarPlane","intersectObject","nearPlane","near","matrixWorldInverse","farPlane","far","extractScale","_v","te","det","determinant","_calcCylinderMatrix","posBegin","posEnd","posCenter","matScale","makeScale","matRotHalf","makeRotationX","matRotLook","vUp","lookAt","setPosition","_calcChunkMatrix","eye","target","up","rad","_forEachMeshInGroup","group","processObj","_countMeshTriangles","mesh","geom","geometry","attribs","attributes","property","currAttr","indexSize","faces","_countTriangles","totalCount","_groupHasGeometryToRender","hasGeoms","traverse","_buildDistorionMesh","widthSegments","heightSegements","calcInverseBarrel","epsilon","prevR2","curR2","dr","geo","getAttribute","setXY","copyAtList","attribute","indexList","fillArray","startIndex","endIndex","removeChildren","clearTree","dispose","destroyObject","belongToSelectLayers","layers","_getMeshesArr","root","meshTypes","meshes","applyTransformsToMeshes","mtc","mtcCount","applyMatrix","newMesh","processTransparentMaterial","prepassMat","prepassMesh","processColFromPosMaterial","colFromPosMat","colFromPosMesh","createShadowmapMaterial","receiveShadow","castShadow","shadowmapMat","shadowmapMesh","isShadowmapMesh","removeShadowmapMaterial","processObjRenderOrder","idMaterial","renderOrder","isGroup","makeVisibleMeshes","checker","applySelectionMaterial","depthFunc","getMiddlePoint","point1","point2","optionalTarget","addScaledVector","calcCylinderMatrix","calcChunkMatrix","forEachMeshInGroup","countTriangles","groupHasGeometryToRender","buildDistorionMesh","_defaultBoundaries","Visual","dataSource","gfxutils","_dataSource","release","getDataSource","_ensureArray","EntityList","entities","_list","_dict","_indices","entity","register","registerInList","registerInDict","unregisterFromList","unregisterFromDict","makeContextDependent","defineProperties","CollisionSphere","_radius","sphere","_sphere","ray","intersectSphere","distance","origin","SphereCollisionGeo","inters","chunkIdx","computeBoundingBox","tmpColor","OFFSET_SIZE","COLOR_SIZE","setArrayXYZ","setArrayXYZW","InstancedSpheresGeometry","spheresCount","sphereComplexity","useZSprites","_sphGeometry","_init","itemIdx","itemPos","itemRad","_offsets","setSphere","colorVal","_colors","g","finishUpdate","computeBoundingSphere","chunkIndices","alphaArr","_alpha","instanceCount","sphereGeo","alpha","fill","RaycastableBufferGeometry","uv1","uv2","uv3","barycoord","_barycoord","barycoordFromPoint","pA","pB","pC","intersect","intersectTriangle","uv","vA","_vA","vB","_vB","vC","_vC","intersectionPoint","_intersectionPoint","fromBufferAttribute","intersection","checkIntersection","uvA","_uvA","uvB","_uvB","uvC","_uvC","uvIntersection","normal","getNormal","face","faceIndex","intersectsSphere","intersectsBox","getX","checkBufferGeometryIntersection","MAX_IDC_16BIT","VEC_SIZE","ChunkedObjectsGeometry","chunkGeo","chunksCount","_chunkGeo","colors","chunkSize","_chunkSize","facesPerChunk","srcPos","_positions","srcNorm","_normals","srcColor","dstPos","dstNorm","dstColor","dstPtOffset","ptIdxBegin","ptIdxEnd","subarray","chunkIndex","chunkIndexSize","pointsCount","use32bitIndex","Uint32Array","Uint16Array","posOffset","setIndex","SimpleSpheresGeometry","sphGeometry","normals","geoNormals","_chunkPos","_tmpPositions","tmpPos","geoPos","centerPos","tmpVector","normMtx","Simple2CCylindersGeometry","cylGeometry","_chunkNorms","_tmpVector","botPos","topPos","firstOffset","secondOffset","tmpArray","geoNorm","lerpVectors","mtx1","getNormalMatrix","fromArray","toArray","applyMatrix3","colorVal1","colorVal2","MAX_POINTS_COUNT_16BIT","PTS_PER_TRIANGLE","CylinderBufferGeometry","radiusTop","radiusBottom","radialSegments","heightSegments","openEnded","thetaStart","thetaLength","parameters","hasTop","hasBottom","vertexCount","facesCount","heightHalf","positions","uvs","currVtxIdx","currFaceIdx","tanTheta","v3","v4","setXYZ","vx","vy","vz","cos","startTIdx","lastIdx","fTIdx","currSrcIdx","getY","getZ","nextTVtx","startBIdx","lastBIdx","fBIdx","currSrcBIdx","nextBVtx","invMatrix","sortNumber","_prepareCylinderInfo","chunksIdx","cylinderInfo","even","newPar","_assignOpacity","color1","color2","Instanced2CCylindersGeometry","_useZSprites","_cylGeometry","_collisionGeo","me","mtxOffset","setItem","_matVector1","_matVector2","_matVector3","_invmatVector1","_invmatVector2","_invmatVector3","colorIdx","_color1","_color2","cylinderIndices","cylinderGeo","TRI_SIZE","tmpPrev","tmpNext","tmpRes","simpleNormal","normalOnCut","nearRingPt","_createExtrudedChunkGeometry","shape","ringsCount","ptsCount","totalPts","ExtrudedObjectsGeometry","_ringsCount","tmpShape","_tmpShape","hasSlope","hasCut","chunkStartIdx","_setPoints","_setSlopeNormals","_setBaseNormals","_addCut","vtxIdx","mtx","nPtsInRing","_countNormalsInRing","isSlope","shiftToExtraPt","subVectors","VERTEX_PER_SEGMENT","POS_SIZE","DIR_SIZE","COL_SIZE","direction","startSegmentIdx","segmentsCount","elemSize","ThickLinesGeometry","_initVertices","segmentIdx","pos1","pos2","directions","_directions","dirIdx","startSegIdx","endSegIdx","startPos","startDir","_buffersSize","indexOffset","pointOffset","LinesGeometry","posSize","getPositionSize","BaseLinesGeometry","CylinderCollisionGeo","itemOffset","COLLISION_RAD","ChunkedLinesGeometry","enableCollision","collisionGeo","segCount","segIdx","setSegments","getSubsetSegments","setColors","getSubsetColors","TwoColorLinesGeometry","segmentIndices","_segCounts","vectors","vecCount","tempPos1","tempPos2","CrossGeometry","setSegment","POS_RAD_SIZE","IsoSurfaceGeometry","_opts","_posRad","posRad","IsoSurfaceMarchCube","pointsValuesLinear","hasIntersection","bitsInside","numCellsPerSide","vx7000000","n3","striIndicesMarchCube","edgeTable","_voxelGradientFast","grad","GridCell","_arrSize","cubeIndex","Triangle","createArray","arrSize","IsoSurface","_numTriangles","_numVertices","_volumetricData","_xAxis","_yAxis","_zAxis","_xDir","_yDir","_zDir","volData","cellSize","xAxis","yAxis","zAxis","xDir","yDir","zDir","tmp","notZero","axe","EPSILON","isoLevel","grid","ind1","ind2","vertex","valP1","valP2","isoDiffP1","diffValP2P1","mu","triangles","firstIndices","_firstIndices","secondIndices","_secondIndices","vertexList","_vertexList","normalList","_normalList","_vertexInterp","triCount","triTblIdx","triTable","_triTable","step","appendSimple","vol","getData","dim","getDimensions","stepX","getStrideX","stepY","getStrideY","stepZ","getStrideZ","gc","gcVal","gcValSize","additions","tmpTriCount","appendVertex","axis","triVertex","_origin","posMtx","globTriCount","getDirectIdx","_gradient","_polygonize","computeGradient","_doGridPosNorms","_prepareAxesAndDirs","vertexMap","idcCount","newIndices","vertices","newPositions","newNormals","norm","faceVer","oldVerCount","vMap","newVer","matchedIndex","_remapIndices","_remapVertices","colorMap","atomMap","atomWeightMap","visibilitySelector","numVerts","xs","ys","zs","colorData","strideX","strideY","strideZ","atomWeightData","atomStrideX","atomStrideY","atomStrideZ","xInv","yInv","zInv","atomLookup","atomWeights","interp","idx1","idx2","collectWeight","coefX","coefY","coefZ","newVerCount","ind","mux","muy","muz","maxWeight","dominantIdx","atomIdx","c0","c1","c2","c3","cz0","cz1","numTriangles","newTriCount","i0","VolumeSurfaceGeometry","_visibilitySelector","_calcSurface","posRadArray","itemsCount","maxPosRad","minPosRad","tmpVal","minMaxValues","_findMinMax","minCoordRad","maxCoordRad","gridPadding","radScale","padRad","bbox","surface","isoSurf","compute","vertexFusion","setColorVolTex","volTexMap","packedArrays","_findNumVoxels","_computeSurface","_makeSurface","chem","QuickSurfGeometry","_shiftByOrigin","gaussdensity","atomicNum","invIsoValue","invGridSpacing","maxVoxelX","maxVoxelY","maxVoxelZ","volTexData","texStrideX","scaledRad","atomicNumFactor","radInv","radLim","radLim2","xMin","xMax","dy2dz2","addr","texAddr","expVal","density","exp","colInd","originX","originY","originZ","AVHash","maxDistance","minX","minY","minZ","maxX","maxY","maxZ","hashFunc","minW","iDim","jDim","kDim","nCells","jkDim","cellID","preHash","cid","iIdx","cellOffsets","cellLengths","maxCellLength","subArray","cellLength","neighbourListLength","withinRadii","rExtra","out","outIdx","nearI","nearJ","nearK","loI","loJ","loK","hiI","hiJ","hiK","iOffset","jOffset","cellStart","cellEnd","dataIndex","atomIndex","baseIndex","rSum","ContactSurface","_indexList","maxRadius","scaleFactor","lastClip","volTex","weights","weightsMap","gridx","gridy","gridz","sinTable","cosTable","neighbours","mid","ngTorus","uniformArray","TypeName","innI","fillGridDim","initializeGrid","gridSize","initializeAngleTables","initializeHash","rExt","singleAtomObscures","innX","innY","innZ","innCI","ra2","obscured","ni","projectPoints","sigma","sigma2Inv","ax","ay","az","ar2","ng","iax","iay","iaz","minx","miny","minz","maxx","maxy","maxz","colIdx","cr","cg","cb","iz","iy","dzy2","zyOffset","ix","cIdx","ap","spx","spy","spz","dd","normalToLine","projectTorus","aIdx","bIdx","xa","ya","za","r1","innR2","cosA","dmp","rInt","cost","sint","px","py","pz","current","projectTorii","innIdx","fixNegatives","innInnI","getVolume","timeEnd","ContactSurfaceGeometry","contactSurface","IsoSurfaceAtomColored","radiusAt","coord","colorX","colorY","colorZ","atomType","srcAtom","IsosurfaceBuildNormals","vBoxMin","vBoxMax","_numAtoms","_probeRadius","_atomsList","_voxelList","numAtomsRefs","ATOM_VOXEL_REF_SCALE","aveRad","numCells","_numCells","_aveRad","side2","side3","xScale","_xScale","yScale","_yScale","zScale","_zScale","maxAtomsRefs","xNumVoxMult","yNumVoxMult","zNumVoxMult","radAffect","diaAffect","numVoxX","numVoxY","numVoxZ","xIndMin","yIndMin","zIndMin","xIndMax","yIndMax","zIndMax","indVoxel","indexNext","_vertices","xInd","yInd","zInd","ref","indexAtom","closest","minDist2","MAX_VALUE","forEachRelatedAtom","numVertices","numCloseAtoms","vNormalX","vNormalY","vNormalZ","koef","r25","r01","maxRadAffect","maxRadAffect2","expScale","gatherNormals","radiusColorSmoothness","KOEF_ADD","colorsClose","weightsSum","gatherColors","weightNormalized","IsoSurfaceGeo","maxNumVertices","maxNumTriangles","needVertexColors","_maxNumVertices","_maxNumTriangles","HASH_SIZE","SSIsosurfaceGeometry","_innerBuild","geoOut","getGeo","_fromGeo","numTri3","atomsColored","nm","hashLines","hashEntries","bigNum","probeRadius2","atomRadiusScale","radMax","num","numPoints","vOut","invNP","tx","ty","tz","sign","cube","indexPointValue","cTwentyFour","xb","yb","zb","v0","a0","voxelWorld","getClosestAtom","a1","a2","isTriangleVisible","indInGeo0","addVertexToGeo","indInGeo1","indInGeo2","itr","meshRes","corners","vCellStep","cNumVerts","vaEdges","vCorner","indCell","indY","indZ","getCornerCoord","indPointValues","indValues","buildEdgePoint","offs","numTri","indTri","addTriangle","numIntersectedCells","cubeValuesIndex","indCorner","letter","atomT","probeRad","vDif","aLot","fx","fy","fz","indXMin","indYMin","indZMin","indXMax","indYMax","indZMax","distToSphere","numHashEtriesAllocated","numHashEntryIndex","vAdd","oneHynberes","n815851","n37633","n2453543","r106","hashResolution","marCubeResoultion","iHash","hLineIndex","dot2","iVertAdd","getNewHashEntry","entryFirst","probeSphereRadius","distToBorder","r11","innerBlockWorkAround","probeSpRad2","sideInv","radEst","xCorner","yCorner","zCorner","ok","expandFactor","meshResolution","colorMode","useVertexColors","excludeProbe","convertToAtomsColored","getBoundingBox","rProbeRadius","calculateGridCorners","numIntersectedCellsEstim","getNumIntersectedCells","createVertexHash","probeRadForNormalsColors","createVoxels","buildGeoFromCorners","modifyExcludedFromGeo","buildNormals","buildColors","destroyVoxels","createLabel","fieldTxt","className","spanText","fontSize","strings","spanNodeP","spanNodeText","LabelsGeometry","items","xTranslation","yTranslation","deltaPos","userData","translation","textAlign","fColor","bColor","background","SuperClass","NewObjectType","rest","onBeforeRender","scene","_onBeforeRender","_update","Mesh","UberObject","ZSpriteMesh","_geometry","_group","modelViewMatrix","multiplyMatrices","uniformsNeedUpdate","ZClippedMesh","modelView","_modelView","mvLength","_mvLength","setFromMatrixColumn","localToWorld","TextMesh","initialized","srcItem","label","visibility","SimpleMesh","_viewport","ThickLineMesh","projectionMatrix","InstancedMesh","ZClipped","ZSprite","Text","Line","LineSegments","Instanced","setMatParams","_createInstancedCylinders","Geometry","geometries","initMaterial","_createLineSegmentsGeoTriplet","renderParams","thickLines","_createSimpleGeoTriplet","geoClass","_createIsoSurfaceGeoTriplet","caps","surfaceOpts","MeshCreator","_caps","_settings","TransformGroup","geoParams","transforms","_geoParams","mat","_transforms","_createMeshes","_ray","inverseMatrix","_inverseMatrix","childIntersects","ciCount","geos","meshCnt","wrapper","Name","ChemGroup","selection","_selection","_mode","_colorer","_chunksIdc","chunks","_polyComplexity","_geo","_makeGeoArgs","_mesh","chunksList","_calcChunksList","setOpacity","_changeSubsetOpacity","AtomsGroup","atomsIdc","AtomsSphereGroup","calcAtomRadius","setColor","getAtomColor","updateColor","needsColorUpdate","AtomsSurfaceGroup","selectedAtoms","getSurfaceOpts","AtomsSASSESGroupStub","adjustColor","inverseColor","getAtomText","getNode","getVisualName","colorMappings","adjust","inverse","propagateColor","rule","startsWith","templateMappings","hetatm","water","parseTemplate","AtomsTextGroup","getLabelOpts","fgColor","bgColor","_slerp","omega","oSin","AromaticGroup","radOffset","addChunk","chunksToIdx","prevVector","currVector","segmentsHeight","_segmentsHeight","leprStep","currAtomIdx","cCount","cycAtoms","chunkPoints","tmpDir","cycleRad","prevPos","currPos","upDir","currAngle","_createShape","pts","AromaticTorusGroup","torusRad","getAromRadius","radiusV","calcStickRadius","lookAtVector","points","currPoint","AromaticLinesGroup","getAromaticOffset","prevPt","getAromaticArcChunks","ResiduesGroup","chunksIdc","resIdx","NucleicItemGroup","stickRad","getResidueColor","_processItem","NucleicCylindersGroup","cyl1","cyl2","NucleicSpheresGroup","calcMatrix","_buildStructureInterpolator","Smooth","METHOD_CUBIC","clip","CLIP_CLAMP","cubicTension","scaleTo","argTrans","transformT","tt","newt","ans","_addPoints","centerPoints","topPoints","tp","_addPointsForLoneResidue","nucleic","nameFrom","nameTo","posFrom","posTo","shift","wing","cpPrev","tpPrev","cpNext","tpNext","_calcPoints","firstIdx","_prevIdx","_nextIdx","arrIdx","_extrapolate2","otherIdx","prevIdx","nextIdx","CartoonHelper","startIdx","endIdx","pointsArrays","_topInterp","_centerInterp","_shift","_valueStep","_segmentsCount","firstRad","secondRad","outMtc","currRad","topInterp","cenInterp","currentValue","mtxIdx","lerpVal","currTop","currCenter","nextCenter","_loopThrough","subDiv","subDivI","subDivN","idc","matrixHelper","prevLast","prevSecondRad","getResidueRadius","prepareMatrices","ResiduesSubseqGroup","cmpMultiplier","getHeightSegmentsRatio","getTension","chunkIdc","subdivs","ResiduesTraceGroup","chunk","getCylinderCount","bondOrder","BondsGroup","drawMultiple","drawMultiorderBonds","showAromatic","showAromaticLoops","bondsIdc","bondsCount","getBondOrder","bondIdx","BondsCylinderGroup","emptyOffset","calcSpaceFraction","normDir","leftPos","rightPos","currBondIdx","atom1","atom2","a1Pos","a2Pos","calcNormalDir","minRad","currStickRad","STEP_SIZE","BondsLinesGroup","bondDir","a1Hangs","a2Hangs","AtomsProcessor","atomCount","_checkAtom","atomsGroup","meshIdx","chSubset","subsetEl","OrphanAtomsProcessor","ResiduesProcessor","ResidueGroup","_checkResidue","residuesGroup","NucleicProcessor","ResidueProcessor","SubseqsProcessor","getMaskedSubdivSequences","jEnd","BondsProcessor","bondsGroup","AromaticProcessor","cycleIdx","perCycle","Atoms","OrphanAtoms","Residues","Nucleic","Subseqs","Bonds","Aromatic","_bakeGroup","triplet","Processor","Group","GroupsFactory","gfxTriplet","createSpheres","processors","createCrosses","create2CCylinders","create2CLines","createExtrudedChains","create2CClosedCylinders","createChunkedLines","createQuickSurface","createContactSurface","createSASSES","createLabels","Mode","groupList","depGroups","groupCount","currGroup","newGroup","getRenderParams","LinesMode","shortName","LicoriceMode","BallsAndSticksMode","VanDerWaalsMode","TraceMode","TubeMode","_residue","TUBE_RADIUS","buildGeometry","CartoonMode","secCache","getSecondary","secOpts","ARROW_END","startRad","getResidueStartRadius","endRad","getResidueEndRadius","_res","tubeRad","secHeight","secData","SurfaceMode","surfaces","surfaceNames","isSurface","QuickSurfaceMode","useBeads","getVisibilitySelector","IsoSurfaceMode","_excludeProbe","_radScale","IsoSurfaceSASMode","IsoSurfaceSESMode","ContactSurfaceMode","TextMode","lerpColor","beta","g1","b1","g2","b2","Palette","asIs","elementColors","defaultElementColor","residueColors","defaultResidueColor","chainColors","secondaryColors","defaultSecondaryColor","gradientName","gradients","defaultNamedColor","namedColors","minRangeColor","midRangeColor","maxRangeColor","defaultGradientColor","namedColorsArray","rainbow","temp","hot","cold","reds","blues","H","F","P","S","CL","FE","NI","CU","BR","HE","LI","BE","B","NE","NA","MG","AL","SI","AR","K","SC","TI","V","CR","MN","ZN","GA","GE","AS","KR","RB","SR","Y","ZR","NB","TC","RU","RH","PD","AG","CD","IN","SN","SB","TE","XE","BA","LA","CE","PR","ND","PM","SM","EU","GD","TB","DY","HO","ER","YB","LU","HF","TA","W","RE","OS","IR","PT","AU","HG","TL","PB","BI","PO","AT","RN","FR","RA","AC","TH","PA","NP","PU","AM","CM","BK","CF","ES","FM","MD","NO","LR","RF","DB","BH","HS","MT","palettes","cpkPalette","jmolPalette","vmdPalette","Colorer","ElementColorer","getElementColor","ResidueTypeColorer","SequenceColorer","getGradientColor","ChainColorer","getChainColor","SecondaryStructureColorer","getSecondaryColor","secondary","UniformColorer","ConditionalColorer","parsed","_subsetCached","ConformationColorer","TemperatureColorer","OccupancyColorer","HydrophobicityColorer","hydrophobicity","MoleculeColorer","getMoleculeCount","scaleColor","CarbonColorer","colorCarbon","colorNotCarbon","neutralColor","intensity","materialList","Representation","startMaterialValues","selectorString","materialPreset","needsRebuild","setMode","markAtoms","clearAtomBits","selectionGeo","sg","matrixAutoUpdate","repSettings","selStr","valueOf","modeDiff","identify","colorerDiff","newSelectorObject","newSelector","newMode","newColorer","newMaterial","setMaterialPreset","_traverseComponentGroups","ComplexEditor","ComplexComponentEditor","complexVisual","_complexVisual","_inProgress","_componentTransforms","_bakeComponentTransform","onAtomPositionChanged","_resetComponentTransform","finalizeEdit","pivot","visual","getSelectedComponent","getSelectionGeo","selectionMask","getSelectionBit","reprNode","bbmin","bbmax","updateMatrix","ComplexFragmentEditor","_getSelectionBorderAtoms","_fragmentBoundAtoms","pivotPos","_fragmentGeo","_fragmentSelectionGeo","vg","smeshes","sm","selectionBit","makeTranslation","_bakeAtomTransform","boundAtoms","transformDirection","atomHash","ComponentEditor","FragmentEditor","lookupAndCreate","entityList","specs","Entity","ComplexVisual","_reprList","_repr","_reprListChanged","_selectionBit","_reprUsedBits","_selectionCount","_selectionGeometry","_editor","repCurrent","repAdd","desc","status","change","bits","NUM_REPRESENTATION_BITS","newSelectionBit","_getFreeReprIdx","originalSelection","buildSelectorFromMask","def","unmarkAtoms","hide","show","markAtomsAdditionally","rebuildSelectionGeometry","pickedObj","otherObj","getMolecule","resetSelectionMask","tmpMask","deselectionMask","multiple","selRule","reprList","repr","Promise","resolve","errorOccured","setTimeout","hasGeometry","buildSelectionGeometry","optimizeList","NaN","expression","all","or","and","residx","_buildSelectorFromSortedLists","editor","ComplexVisualEdit","needTraverse","forEachAtomWithinDistFromMasked","countAtomsByMask","volumeUniforms","volumeDim","tileTex","tileTexSize","tileStride","boxAngles","_isoLevel0","_flipV","_BFLeft","_BFRight","_FFLeft","_FFRight","_WFFLeft","_WFFRight","overrideUniforms","defUniforms","facesPosMaterialParams","sideType","vertexVolumeFaces","fragmentVolumeFaces","BackFacePosMaterial","backFaceParams","ShaderParams","BackFacePosMaterialFarPlane","matUniforms","aspectRatio","farZ","tanHalfFOV","matWorld2Volume","shaderParams","vertexFarPlane","fragmentFarPlane","FrontFacePosMaterial","frontFaceParams","VolumeMaterial","vertexVolume","fragmentVolume","updateDefines","ISO_MODE","STEPS_COUNT","VolumeMesh","cullFlag","_corners","edges","_edges","edgeIntersections","_edgeIntersections","constant","vert","cornerMark","edgeMark","curEdge","curEdgeInter","CheckX","CheckY","CheckZ","curEdgeIdx","curEdgeSource","nextVertex","coplanarPoint","faceIdx","_collectVertices","vRight","vDir","rightProj","_sortIndices","numIndices","vm","getTiledTextureStride","buildTiledTexture","getBox","image","getVolumeInfo","volInfo","obtuseAngle","mean","dmean","dmin","span","dmax","sd","nearClipPlaneOffset","_nearClipPlaneOffset","_pos","_norm","norm4D","_norm4D","matrixWorldToLocal","_matrixWorldToLocal","_clipPlane","_updateIsoLevel","getWorldDirection","getWorldPosition","setFromNormalAndCoplanarPoint","_updateVertices","_updateIndices","VolumeBounds","bSize","offsetVert","_getBaseVertices","_lines","projTable","_projectionTable","proj","inv","currDelta","angleValue","XY","XZ","YZ","VolumeFarPlane","volume","planeGeo","_initPlaneGeo","_plane","frustumCulled","doubleSided","matWorldToVolume","_renderer","planeCamPos","normalMatrix","volumeMatrix","DEG2RAD","VolumeVisual","setDataSource","_frame","getMesh","showFrame","_farPlane","getBoundingSphere","needShow","LoaderList","someLoaders","SomeLoader","canProbablyLoad","Loader","_source","_options","_abort","_agent","abort","FileLoader","_binary","blob","reader","FileReader","readAsArrayBuffer","readAsText","File","urlStartRegexp","XHRLoader","request","XMLHttpRequest","response","responseType","send","ImmediateLoader","ParserList","someParsers","format","formats","SomeParser","canProbablyParse","parseSync","model","_parseHeader","Remark290","_matrix","_matrixIndex","stream","readString","matrixRow","readCharCode","matrixData","matrixIndex","parseFloat","Remark350","assemblies","_assembly","assembly","addMatrix","addChain","PDBStream","_start","_nextCR","_nextLF","_next","_end","TAG_LENGTH","nameToElement","veryLong","pdbStartRegexp","remarkParsers","PDBParser","_serialAtomMap","_modelId","_compaundFound","_biomoleculeFound","_allowedChainsIDs","_lastMolId","_remarks","_remark","_compndCurrToken","fileType","_fixBondsArray","_fixChains","remark290","isUndefined","remark350","chainDict","chainObj","idChainMap","nj","readInt","readChar","chainID","resSeq","readFloat","Role","serial0","serial1","serial2","serial3","serial4","tokenIdx","chainStr","lastChar","remarkNum","remark","RemarkParser","fields","_parseSTRUCTURE","addHelix","addSheet","pars","adder","startId","endId","codeOfS","serialNumber","structureName","helLength","shWidth","shCur","shPrev","startChainID","endChainID","startSequenceNumber","iCodeStr","startICode","endSequenceNumber","endICode","cs","classification","date","title","func","tagParsers","HEADER","_parseHEADER","_parseTITLE","_parseATOM","HETATM","ENDMDL","_parseENDMDL","CONECT","_parseCONECT","COMPND","_parseCOMPND","REMARK","_parseREMARK","_parseHELIX","_parseSHEET","cOrderCharCodes","cmlStartRegexp","CMLParser","_readOnlyOneMolecule","atomId","countBonds","idxs","atomRefs2","moleculeArr","fieldData","atomRefs","placement","fieldName","_extractSGroup","_createSGroup","firstAtomRef","sgroupRef","mapEntry","cycleFuncInner","cycleFunc","x2","x3","y2","y3","z3","atomsRef","dom","parseNode","xmlNode","nodeName","nodeValue","jsonNode","existing","childNodes","molSet","atomArray","_findSuitableMolecule","DOMParser","doc","parseFromString","traversedData","_traverseData","rawData","prepareComponentCompound","ret","atomLabels","labelsCount","_extractSGroups","localBond","bondArray","_rebuidBondIndexes","addCurrBond","orderAttr","tc","labels","_breadWidthSearch","retStruct","originalCML","cml","retData","filteredData","rd","compId","molId","molID","_packLabel","breadthQueue","componentID","labeledAtoms","startID","_unpackLabel","eAtom","mainAtom","varData","currentLabel","addFunc","complexAtom","reorder","atomCharge","lLabel","atomFullNameStruct","elementType","countRef","currAtomComp","strLabel","JSON","stringify","atomSerial","added","mrvValence","_parseBond","getSGroupCount","sGrp","getSGroups","moleculaSet","_selectComponents","_parseSet","totalAtomsParsed","joinedComplex","joinComplexes","ArrayComparator","original","_original","_sum","candidate","sum","sorted","secStructToType","getFirstByte","buf","MMTFParser","_modelData","chainData","modelIndex","chainIndex","groupData","groupName","groupId","groupIndex","_updateSecStructure","atomData","xCoord","yCoord","zCoord","bFactor","formalCharge","bondData","atomIndex1","atomIndex2","helixClasses","secStruct","_ssType","_ssStruct","_ssStart","struct","mmtfData","chainsInModel0","chainsPerModel","chainIndexList","description","structureId","releaseDate","eventCallbacks","onModel","modelData","_onModel","onChain","_onChain","onGroup","_onGroup","onAtom","_onAtom","onBond","_onBond","MMTF","_updateMolecules","named","bioAssemblyList","baInfo","transformList","chainListCheck","chainNames","allChains","_chainsByName","compare","transpose","transform","primaryChainsArray","primaryChainsHash","primary","decode","_traverse","_linkAtomsToResidues","_markHeteroAtoms","_findSynonymousChains","_parseAssemblyInfo","_joinSynonymousChains","isArrayBuffer","ParsingError","column","captureStackTrace","parseLine","parseColumn","_isWhitespace","_inlineIndexOf","ch0","readCIF","newline","block","keysCount","valuesCount","_parseValue","_storeKey","_storeValue","keyIndex","cRequiredAtomFields","cSecondaryCoding","helx","turn","strn","getTypeFromId","typeId","arrize","arrayLikeObject","AtomDataError","_getOperations","operList","vector","ops","_extractOperations","assemblyGen","opsDict","groupStr","gps","grIdx","grCount","gr","gp","es","cnt","ii","nn","newMtx","CIFParser","asymDict","_toComplex","cifData","complexData","_extractAtoms","_extractSecondary","_extractAssemblies","_extractMolecules","_extractMetadata","struct_keywords","pdbx_keywords","databaserev","database_PDB_rev","date_original","molData","pdbx_description","getMolecules","atom_site","auth_seq_id","Cartn_x","Cartn_y","Cartn_z","label_atom_id","group_PDB","chainIdc","auth_asym_id","chainLabelIdc","label_asym_id","serials","iCodes","pdbx_PDB_ins_code","resNames","label_comp_id","type_symbol","tempFactors","B_iso_or_equiv","occupancies","charges","pdbx_formal_charge","altLocs","label_alt_id","models","pdbx_PDB_model_num","label_entity_id","moleculeIdx","struct_conf","_extractConfs","struct_sheet_range","_extractSheets","sheetData","sheet_id","beg_label_seq_id","end_label_seq_id","beg_label_asym_id","sheetNames","strandNames","starts","beg_auth_seq_id","ends","end_auth_seq_id","stICodes","pdbx_beg_PDB_ins_code","endICodes","pdbx_end_PDB_ins_code","findResidue","helicesData","conf_type_id","comments","details","lengths","pdbx_PDB_helix_length","pdbx_PDB_helix_class","asmGen","pdbx_struct_assembly_gen","asmIdx","assembly_id","asmOper","oper_expression","asmList","asym_id_list","pdbx_struct_oper_list","asm","assemblyOps","valueType","singular","VolumeModel","_header","_boxSize","_boxStart","extent","nstart","crs2xyz","cellDims","angles","isTypedArray","_buff","TypeError","headerFormat","arrays","_parseArray","_parseVector","_buffer","header","gamma","z1","z2","xaxis","yaxis","zaxis","_xyz2crs","shiftX","shiftY","_setOrigins","_getXYZdim","_getXYZbox","_toXYZData","_getVolumeInfo","CCP4Header","ispg","nsymbt","lksflg","customData","machine","nlabel","Ccp4Model","_typedCheck","u32","i32","f32","_fillHeader","xyz2crs","_getAxis","_setAxisIndices","_setBoxParams","xyzData","crsIdx","CCP4Parser","XYZParser","_atomsInf","_fileName","endnAtoms","endComment","startAtomsInf","words","_parseToAtomsInf","_parseAtomsInf","PubChemParser","jsonData","PC_Compounds","aids","aid","fromPairs","zip","coords","conformers","aids1","aid1","aids2","aid2","orders","SDFStream","_strings","_currentStart","_currentStringIndx","numb","curStr","getNextString","getCurrentString","setStart","probablyHaveDataToParse","chargeMap","orderMap","typeMap","sdfAndMolRegexp","sdfRegExp","fileFormat","SDF","MOL","possibleNameTags","possibleIDTags","possibleTitleTags","tagsNames","tags","buildChainID","codes","trunc","reverse","SDFParser","_format","_metadata","_currentMolProps","_compoundIndx","_assemblies","_atomsParsed","_atomsIndexes","getStringFromStart","bondsNum","bondType","countsLine","_parseAtoms","_parseBonds","_parseMOL","findNextDataItem","_parseDataItem","props","_tryToUpdateMoleculeData","tagsList","_searchTag","tagPossibleNames","_tryToFind","properties","_finalizeMetadata","_buildAssemblies","_buildMolecules","defineFormat","_parseCompound","findNextCompoundStart","DSN6Header","div","DSN6Model","i16","Int16Array","byteBuffer","counter","zBlock","yBlock","xBlock","inRange","_pointCalculate","blocks","_blockCalculate","_calculateInfoParams","dispersion","minDensity","maxDensity","DSN6Parser","ArrayBuffer","checkDataTypeOptions","GROReader","GROParser","_time","_residueNumber","_residueName","_atomName","_atomNumber","_atomPosition","_atomVelocity","filetype","readLine","getNext","positionX","positionY","positionZ","_parseTitle","_parseNumberOfAtoms","_parseAtom","un","am","nc","du","resNumberRegex","spacesRegex","splitToFields","MOL2Parser","_currPosIdx","_currStartIdx","MOL2Data","newPosIdx","_toStringFromStart","_toHeaderString","_setStart","_probablyHaveDataToParse","parsedStr","_setResidue","originAtomId","targetAtomId","currMolecule","molResidues","_fixSerialAtoms","_parseMolecule","_toStringFromHeader","_parseRawStrings","_findNextCompoundStart","ExporterList","someExporters","Exporter","exportSync","PDBResult","_resultArray","_currentStr","_tag","_fixedNumeration","_numeration","_tagStrNum","writeString","numeration","isBoolean","maxStrPos","_currentStrLength","newString","curStrLength","finish","repeat","cStr","bondsArrays","_getSubArrays","subArraySize","subArrays","matrixIndx","toFixed","Matrix4","writeMatrix","PDBExporter","_tags","_result","_tagExtractors","_extractHEADER","TITLE","_extractTITLE","_extractATOM","_extractCONECT","_extractCOMPND","_extractREMARK","_extractHELIX","SHEET","_extractSHEET","_stringForRemark350","_stringForRemark290","getResult","newTag","fixedBonds","writeBondsArray","strands","invert","startIndx","_getMoleculeChains","chainsString","writeEntireString","_Remark290","_Remark350","writeMatrices","biomolIndx","getChainName","SourceClass","FBX_POS_SIZE","FBX_NORM_SIZE","FBX_COL_SIZE","copyFbxPoint3","srcIdx","dstIdx","copyFbxPoint4","vector4","copyTransformedPoint3","setSubArray","copyFunctor","functorOpts","arridx","FBXModel","lastPos","lastNorm","lastCol","vertsCount","indsCount","shifted","setIndices","currentCount","getVerticesNumber","setShiftedIndices","setTransformedPositions","setTransformedNormals","FBXGeometry","_info","FBX1CGeometry","cl","FBX2CCylinder","_cutRawStart","_cutRawEnd","_facesPerSlice","addPerCylinder","_extendVertices","_extendIndices","getGeoParams","cutRaw","indicesPerQuad","startToShift","colorSize","part1End","part2End","_setColorRange","capSize","cap1End","cap2End","FBXInfoExtractor","_materials","_models","_extractModelsAndMaterials","_flattenModels","layersOfInterest","checkExportAbility","_collectInstancedGeoInfo","_collectGeoInfo","faceSize","overallVertsCount","combined","_reworkIndices","verticesCount","vertCount","setPositions","setNormals","_collectMaterialInfo","_addToPool","instCount","maxInstancedCount","instMatrix","objMatrix","sphereColor","instanceIndex","_getSphereInstanceMatrix","addInstance","oneCCylinder","splittingInfo","_gatherCylindersColoringInfo","twoCCylinder","needToSplit","additionalVertsCount","colorStart","colorEnd","is2Colored","_getCylinderInstanceMatrix","materialIdx","_checkExistingMaterial","findIndex","differs","_collectSpheresInfo","_collectCylindersInfo","instIdx","matVector1","matVector2","matVector3","idxOffset","defaultDefinitions","defaultProperties","defaultMaterialLayer","defaultLayerBlock","globalSettings","FBXResult","_writeHeader","_writeDefinitions","_writeObjects","_writeRelations","_writeConnections","FBXHeaderVersion","FBXVersion","timeStampVersion","creator","version","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","modelVersion","allModels","_verticesIndices","_normalLayer","_colorLayer","materialVersion","allMaterials","_materialProperties","modelsList","colorArray","layerElementColorNumber","layerElementColorVersion","layerElementColorName","colorsStr","_floatArrayToString","colorIndices","normalArray","layerElementNormalNumber","layerElementNormalVersion","layerElementNormalName","normalsStr","multiLayer","multiTake","shading","culling","geometryVersion","vertStr","FBXExporter","_version","miewVersion","_extractor","loaders","parsers","exporters","tempColor","CSS2DRenderer","_height","_widthHalf","_heightHalf","_vector","_viewMatrix","_projectionMatrix","_domElement","overflow","zIndex","pointerEvents","myNode","firstChild","lerpColorAsHex","setHex","getHexString","colorAsHex","setFromMatrixPosition","localOffset","getMaxScaleOnAxis","fogFactor","smoothstep","WebkitTransform","MozTransform","oTransform","_renderObject","VK_LEFT","VK_UP","VK_RIGHT","VK_DOWN","STATE","NONE","ROTATE","TRANSLATE","SCALE","TRANSLATE_PIVOT","FULL_STOP_THRESHOLD","matrix4","ObjectHandler","lastRotation","_rotate","q","quat","zeroPivot","makeRotationFromQuaternion","setObjects","rotate","rot","mousePrevPos","mouseCurPos","aboutAxis","mouse2rotation","setFromAxisAngle","translate","translateOnAxis","timeSinceLastUpdate","timeSinceMove","intertia","dynamicDampingFactor","intertiaThreshold","stop","eyeDirection","cameraUpDirection","cameraSidewaysDirection","moveDirection","mouseDelta","mousePrev","mouseCur","axisRotateFactor","setLength","rotateFactor","ObjectControls","objectPivot","getAltObj","hotkeysEnabled","screen","_state","_mousePrevPos","_mouseCurPos","_mainObj","_altObj","_affectedObj","_isAltObjFreeRotationAllowed","_isTranslationAllowed","_isKeysTranslatingObj","_pressedKeys","_clock","_lastUpdateTime","_listeners","mousedown","mouseup","mousemove","mousewheel","touchstartend","touchmove","getKeyBindObject","keydownup","handleResize","resetKeys","contextmenu","stopPropagation","preventDefault","innerWidth","innerHeight","getBoundingClientRect","ownerDocument","documentElement","pageXOffset","clientLeft","pageYOffset","clientTop","enableHotkeys","allowTranslation","allow","allowAltObjFreeRotation","keysTranslateObj","isEditingAltObj","convertMouseToOnCircle","pageX","pageY","screenSize","convertMouseToViewport","rotateByMouse","aboutZAxis","getOrientation","setOrientation","getScale","setScale","curTime","_lastMouseMoveTime","speedX","speedY","altObj","button","workWithAltObj","altKey","ctrlKey","shiftKey","translatePivotByMouse","wheelDelta","detail","touches","_touchDistanceCur","_touchDistanceStart","_scaleStart","newScale","keyCode","translatePivotInWorld","setX","setY","setZ","translatePivot","setPivot","newPivot","Picker","_lastMousePos","_mouseTotalDist","_lastClickBeginTime","_lastClickPos","_clickBeginTime","touchstart","touchend","picked","pickObject","screenPos","rayCaster","unproject","fogFarValue","getMouseInViewport","curPos","timeSinceLastClickBegin","clickDist","_lastTouchdownPos","changedTouches","Axes","targetCamera","_target","_targetCamera","_object","_full","autoClear","setViewport","clear","cDataOffset","cFirstMask","cFirstShift","cSecMask1","cSecShift1","cSecMask2","cSecShift2","cThirdMask","cStrMask","cStrShift","c219","c220","cHelixIdx","cSheetIdx","secTypes","cSecNames","_createSecondary","strArray","nRes","resid","rIdx","fromUInt20ToInt20","uint20","FrameInfo","payload","callbacks","isLoading","_framesRange","frameIsReady","_frameRequest","_callbacks","_framesRequestLength","_downloadDataFn","parseBinaryData","setFrame","framesStart","framesEnd","_framesCount","onDone","onLoadStatusChanged","onFail","onError","_bufferRequestStart","_prepareBuffer","arrayBuffer","dataView","DataView","atomsCount","getUint32","framesCount","_atomsCount","maxSize","chunkedFramesCount","timeStep","iName","_timeStep","posData","coordIdx","secondaryArr","Int8Array","hiWord","loWord","_secondaryData","_currFrame","myResidues","sec","oldSec","nSec","compRes","getSec","frameIdx","_cachedResidues","_updateSecondary","_parseBuffer","vec","_vec","SceneObject","paramsStr","LinesObj","_id1","_id2","err","getAtomByFullname","_atom1","_getAtomFromName","_atom2","dynamic","_line","computeLineDistances","_raycaster","_intersects","verticesNeedUpdate","OutlineMaterial","srcDepthTex","srcTexSize","DEPTH_OUTLINE","FXAAMaterial","bgTransparent","BG_TRANSPARENT","AOMaterial","diffuseTexture","normalTexture","depthTexture","camNearFar","projMatrix","kernelRadius","depthThreshold","_kernelOffsets","AOHorBlurMaterial","aoMap","samplesOffsets","AOVertBlurWithBlendMaterial","fogNearFar","useFog","AnaglyphMaterial","srcL","srcR","View","orientation","_transitionTime","ViewInterpolator","startView","endView","_endTime","_isPaused","_srcView","_dstView","_isMoving","transTime","wasStarted","success","createView","slerp","setup","getCurrentView","MAX_COOKIE_LEN","COUNT_SUFFIX","_chunkString","chunkLen","lc","Cookies","removeCookie","cntKey","_toCount","cntVal","_getSimpleCookie","_removeSimpleCookie","setCookie","_setSimpleCookie","getCookie","cookie","_getExpirationDate","today","EXP_PERIOD_YEARS","setFullYear","toUTCString","_exists","webVRPoC","showEnterVR","cursor","currentSession","onSessionEnded","onSessionStarted","session","_gfx","xr","setReferenceSpaceType","setSession","onmouseenter","onmouseleave","onclick","sessionInit","optionalFeatures","requestSession","then","moveSceneBehindHeadset","showWebXRNotFound","stylizeElement","bottom","padding","border","borderRadius","font","isSessionSupported","supported","textDecoration","WebVRPoC","onToggle","_mainCamera","_button","_onToggle","_molContainer","_user","_scalingPivot","_controller1","_controller2","_pressedGripsCounter","_distance","startScalingByControllers","stopScalingByControllers","anotherController","gfx","createWebVRButton","_mainFog","_plugVRNodesIntoScene","_setControllersListeners","getController","_createControllerMesh","handleGripsDown","handleGripsUp","setAnimationLoop","getSession","_unplugVRNodesFromScene","cylinder","rotateX","scaler","container","EDIT_MODE","COMPLEX","COMPONENT","FRAGMENT","LOADER_NOT_FOUND","PARSER_NOT_FOUND","updateFogRange","removeExtension","hasValidResidues","hasValidRes","reportProgress","percent","TOTAL_PERCENT","chooseFogColor","Miew","settingsCookie","cookiePath","_interpolator","_container","getElementById","head","getElementsByClassName","_containerRoot","_running","_halting","_building","_needRender","_hotKeysEnabled","_cookies","restoreSettings","_spinner","_loading","_animInterval","_visuals","_curVisualName","_sourceWindow","registeredPlugins","_initOnSettingsChanged","getMaxRepresentationCount","_setContainerContents","_updateShadowCamera","shadowMatrix","OBB","halfSize","light","getOBB","frag","createDocumentFragment","_msgMode","_msgAtomInfo","_showMessage","_initGfx","_initListeners","Spinner","_onKeyDown","_onKeyUp","_objectControls","_getAltObj","_picker","_onPick","file","keepRepsInfo","job","cancel","halt","msg","_showCanvas","_requestAnimationFrame","requestAnimationFrame","arezSpritesSupported","getExtension","isAOSupported","clientWidth","clientHeight","webGLOptions","preserveDrawingBuffer","premultipliedAlpha","renderer2d","shadowMap","autoUpdate","getContext","setPixelRatio","devicePixelRatio","setSize","setClearColor","clearColor","stereoCam","selectionScene","selectionRoot","selectionPivot","light12","pixelRatio","getPixelRatio","shadowMapSize","mapSize","light3","deviceWidth","deviceHeight","offscreenBuf","minFilter","magFilter","depthBuffer","offscreenBuf2","offscreenBuf3","offscreenBuf4","volBFTex","volFFTex","volWFFTex","offscreenBuf5","offscreenBuf6","offscreenBuf7","stereoBufL","stereoBufR","_embedWebXR","stats","_fps","_onResize","_makeUniqueVisualName","baseName","random","suffix","_addVisual","_removeVisual","_forEachVisual","_releaseAllVisuals","_forEachComplexVisual","_getComplexVisual","any","_getVolumeVisual","_getVisualForComplex","getVisuals","getComplexVisualsCount","getCurrentVisual","setCurrentVisual","run","resume","_onTick","_discardComponentEdit","_discardFragmentEdit","pause","enableHotKeys","_resizeOffscreenBuffers","isAnaglyph","multi","_onUpdate","_onRender","_getBSphereRadius","_bSphereForOneVisual","_bBoxForOneVisual","_bBox","_invMatrix","_points","union","_updateFog","_setUberMaterialValues","isScriptingCommandAvailable","callNextCmd","_needRebuild","rebuild","_updateView","webVR","updateMoleculeScale","_clipPlaneUpdateValue","_fogFarUpdateValue","setRenderTarget","_renderFrame","_anaglyphMat","_size","focus","_renderShadowMap","_renderScene","setScissorTest","setScissor","cameraL","cameraR","_onBgColorChanged","_onFogColorChanged","_enableMRT","renderBuffer","textureBuffer","gl","drawBuffersWEBGL","COLOR_ATTACHMENT0","tx8","__webglTexture","bindTexture","TEXTURE_2D","fb","__webglFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT1_WEBGL","distortion","bHaveComplexes","volumeVisual","ssao","_renderWithPrepassTransparency","dstBuffer","srcBuffer","_performAO","_renderOutline","_renderSelection","_renderVolume","_performFXAA","_performDistortion","aberration","fragmentScreenQuadFromDistTex","targetBuffer","_outlineMaterial","srcDepthBuffer","srcColorBuffer","currentRenderTarget","getRenderTarget","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","setBlending","buffers","setClear","setTest","updateMatrices","_hasSelectionToRender","selPivot","selPivotChild","_checkVolumeRenderingSupport","renderTarget","oldRT","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","volumeBFMat","volumeFFMat","cubeOffsetMat","world2colorMat","volumeRenderingSupported","dstBuf","tmpBuf1","tmpBuf2","tmpBuf3","overrideMaterial","colorMask","_fxaaMaterial","_aoMaterial","_horBlurMaterial","_vertBlurMaterial","_scale","normalBuffer","srcDepthTexture","tempBuffer","tempBuffer1","_lastPick","_setEditMode","_resetObjects","setNeedRender","_resetScene","resetReps","resetPivot","rebuildAll","resetView","updateSelectionMask","_export","TheExporter","io","exporter","rePdbId","rePubchem","reUrlScheme","resolveSourceShortcut","matchesPdbId","sourceType","matchesPubchem","compound","updateBinaryMode","TheParser","fileExt","animation","_fetchData","shouldCancel","notify","TheLoader","extractName","newOptions","keyCount","loader","lengthComputable","total","loaded","promise","_parseData","dataSet","spin","onLoadEnd","anything","jobIndex","_refreshTitle","_onLoad","unload","_startAnimation","fileData","_stopAnimation","_frameInfo","isPlaying","_isAnimating","_continueAnimation","_pauseAnimation","clearInterval","minFrameTime","setInterval","_updateObjsToFrame","nextFrame","disableEvents","visualName","amberFileName","resetEd","_onLoadEd","_tweakResolution","_edLoader","loadEd","_rebuildObjects","toRemove","getGeometry","changeUnit","unitIdx","currentUnitInfo","getCurrentUnit","_updateInfoPanel","rebuildActions","setNeedsRebuild","appendix","repGet","_extractRepresentation","getSelectionCount","defPreset","repCount","_setReps","applyPreset","presList","newIdx","repRemove","repHide","_editMode","getElementsByTagName","_enterComponentEditMode","editors","beginComponentEdit","_editors","_applyComponentEdit","discard","_enterFragmentEditMode","selectedVisuals","beginFragmentEdit","isFreeRotationAllowed","_applyFragmentEdit","_updateSelection","expandSelection","shrinkSelection","firstLine","secondLine","aName","coordLine","nextAltObj","setPivotResidue","amount","setPivotAtom","getSelectionCenter","_centerInVisual","setPivotSubset","_includesInCurSelection","_includesInSelector","screenshot","fov2Tan","tan2Fov","getDataURL","dataURL","currBrowser","canvas","canvasContext","drawImage","toDataURL","screenshotURI","originalTanFov2","areaOfInterestSize","areaOfInterestTanFov2","shotAspect","setDrawingBufferSize","screenshotSave","uri","save","dataString","maxPerf","_gfxScore","_autoChangeResolution","saveSettings","resetSettings","setOptions","resetCurrentUnit","getBondCount","getResidueCount","getChainCount","objData","bThrow","Ctor","LinesObject","_addSceneObject","sceneObject","objs","removeObject","getURL","getState","compact","getScript","_compareReps","compareWithDefaults","currPreset","repsDiff","emptyReps","repsInfo","objectsState","_updateShadowmapMeshes","_updateMaterials","setMaterialValues","_fogAlphaChanged","disable","evt","Boolean","sel","VIEW_VERSION","eulerOrder","euler","setFromQuaternion","interpolator","srcView","dstView","setFromEuler","isMoving","within","None","projected","fullAtomName","complexName","project","dssp","exportCML","extractRotation","extractBasis","retMat","makeBasis","updateCMLData","xml","removeAttribute","sGroup","getPosition","getCentralPoint","oSerializer","XMLSerializer","serializeToString","motm","curChainName","curChainColor","thirdParty","lodash","three","modeIdDesc","$help","colorDesc","materialDesc","addRepDesc","setGetParameterDesc","help","PDBID","REP_NAME","DESCRIPTION","REP_INDEX","EXPRESSION","MODE_ID","COLORER_ID","MATERIAL_ID","del","PARAMETER","set_save","set_restore","set_reset","PRESET","ENCODED_VIEW","removeobj","listobj","NULL","RepresentationMap","representationMap","representationID","strId","sortedKeys","representationsStorage","keyRemap","CLIUtils","miew","repMap","listRep","repName","selectionStr","strList","helpData","joinHelpStr","clihelp","sortBy","helpItem","awaitWhileCMDisInProcess","finishAwaitingCMDInProcess","modificate","selExc","modificators","modificator","argExc","pathExc","endsWith","getNamedColor","utilFunctions","CreateObjectPair","ArgList","toJSO","cliUtils","cmd","propagateProp","Arg","_val","cliutils","echo","representations","notimplemented","script","_printCallback","_errorCallback","parsercli","cmdQueue","commandInAction"],"mappings":";;;;;;AAAA,SAAS,eAAe,CAAC,GAAG,EAAE;AAC9B,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC;AACrC,CAAC;AACD;AACA,kBAAc,GAAG,eAAe;;ACJhC,SAAS,qBAAqB,CAAC,GAAG,EAAE,CAAC,EAAE;AACvC,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,C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AM+W,GAAG,GAAG,KAAKY,QAAL,CAAch1E,KAAd,EAAZ;AAEA,QAAMnrF,GAAG,GAAG,EAAZ;AACAA,IAAAA,GAAG,CAACs5I,OAAJ,GAAc,KAAd;;AACA,QAAI;AACF4mB,MAAAA,eAAS,CAAC7xI,KAAV,CAAgBkxI,GAAhB;AACAv/J,MAAAA,GAAG,CAACs5I,OAAJ,GAAc,IAAd;AACD,KAHD,CAGE,OAAO93I,CAAP,EAAU;AACVxB,MAAAA,GAAG,CAACpF,KAAJ,GAAY4G,CAAC,CAACxF,OAAd;AACAkkK,MAAAA,eAAS,CAACtzI,EAAV,CAAahyB,KAAb,CAAmBoF,GAAG,CAACpF,KAAvB;AACA,WAAK6jK,0BAAL;AACD;;AACD,WAAOz+J,GAAP;AACD;;AACD,SAAO,EAAP;AACD,CAjBD;;AAmBAkgK,eAAS,CAACtzI,EAAV,GAAe+yI,QAAf;;AAEAO,eAAS,CAACtzI,EAAV,CAAasB,UAAb,GAA0BgyI,eAAS,CAAChyI,UAApC;;;;"} \ No newline at end of file +{"version":3,"file":"dist/Miew.module.js","mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,MAAM,GAAI,YAAU;EACxB,IAAIC,CAAC,GAAC,SAAAA,CAASC,CAAC,EAACC,CAAC,EAACF,CAAC,EAACG,CAAC,EAAC;MAAC,KAAIH,CAAC,GAACA,CAAC,IAAE,CAAC,CAAC,EAACG,CAA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AO3E,KAAK;EACZ,CAAC,CAAE,CAAC;EACJjM,MAAM,CAACiM,KAAK,GAAGA,KAAK;EACpB,SAASqF,MAAMA,CAAA,EAAI;IACjB,IAAI,CAACxM,EAAE,GAAG,CAAC,CAAC;EACd;EACAwM,MAAM,CAACnF,SAAS,GAAGnM,MAAM;EAACA,MAAM,CAACsR,MAAM,GAAGA,MAAM;EAChD,OAAO,IAAIA,MAAM,CAAD,CAAC;AACjB,CAAC,CAAE,CAAC;AAEJC,MAAM,CAACC,OAAO,GAAG;EAACxR,MAAM,EAAEA;AAAM,CAAC;;;;;;;ACv9BjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,MAAM,GAAI,YAAU;EACxB,IAAIC,CAAC,GAAC,SAAAA,CAASC,CAAC,EAACC,CAAC,EAACF,CAAC,EAACG,CAAC,EAAC;MAAC,KAAIH,CAAC,GAACA,CAAC,IAAE,CAAC,CAAC,EAACG,CAAC,GAACF,CAAC,CAACG,MAAM,EAACD,CAAC,EAAE,EAACH,CAAC,CAACC,CAAC,CAACE,CAAC,CAAC,CAAC,GAACD,CAAC,CAAC;MAAC,OAAOF,CAAC;IAAA,CAAC;IAACK,GAAG,GAAC,CAAC,CAAC,EAAC,CAAC,CAAC;IAACC,GAAG,GAAC,CAAC,CAAC,EAAC,CAAC,CAAC;IAACC,GAAG,GAAC,CAAC,CAAC,EAAC,CAAC,CAAC;IAACC,GAAG,GAAC,CAAC,CAAC,EAAC,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EAAE,IAAI;EACV;AACF;AACA;AACA;AACA;EACEC,OAAO,EAAE;IACP1S,EAAE,EAAE,KAAK;IACTtF,KAAK,EAAE,QAAQ;IACfiY,SAAS,EAAE,GAAG;IACdC,SAAS,EAAE;EACb,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,EAAE,EAAE,KAAK;EAET;AACF;AACA;AACA;AACA;AACA;AACA;EACE1X,MAAM,EAAE;IACN6E,EAAE,EAAE,KAAK;IACT7f,IAAI,EAAE,QAAQ;IACdqa,MAAM,EAAE;EACV,CAAC;EAED;AACF;AACA;AACA;AACA;EACEsY,YAAY,EAAE,GAAG;EAEjB;AACF;AACA;AACA;AACA;EACEC,MAAM,EAAE,EAAE;EAEV;AACF;AACA;AACA;AACA;EACEC,OAAO,EAAE,CAAC;EAEV;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,qBAAqB,EAAE,IAAI;EAE3B;AACF;AACA;AACA;AACA;EACEC,OAAO,EAAE,IAAI;EAEb;AACF;AACA;AACA;AACA;EACEC,OAAO,EAAE,IAAI;EAEb;AACF;AACA;AACA;AACA;EACEC,IAAI,EAAE,MAAM;EAEZ;AACF;AACA;AACA;AACA;EACEC,OAAO,EAAE,KAAK;EAEd;AACF;AACA;AACA;AACA;EACEC,QAAQ,EAAE,KAAK;EAEf;AACF;AACA;AACA;AACA;EACEC,UAAU,EAAE,IAAI;EAEhB;AACF;AACA;AACA;AACA;EACEC,MAAM,EAAE,MAAM;EAEd;AACF;AACA;AACA;AACA;EACEC,gBAAgB,EAAE,IAAI;EAEtB;AACF;AACA;AACA;AACA;EACEC,YAAY,EAAE,SAAS;EAEvB;AACF;AACA;AACA;AACA;EACEC,gBAAgB,EAAE,CAAC;EAEnBtS,KAAK,EAAE;IACLuS,OAAO,EAAE,GAAG;IACZvuB,IAAI,EAAE,QAAQ;IACdwuB,IAAI,EAAE,IAAI;IACVC,gBAAgB,EAAE,GAAG;IACrBC,UAAU,EAAE,GAAG;IACfC,YAAY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G,CAAC;MACpBlxJ,GAAG,CAAC2tI,OAAO,GAAG,IAAI;IACpB,CAAC,CAAC,OAAOjiJ,CAAC,EAAE;MACVsU,GAAG,CAACviB,KAAK,GAAGiO,CAAC,CAAC0R,OAAO;MACrBiyJ,oBAAS,CAACh4K,EAAE,CAACoG,KAAK,CAACuiB,GAAG,CAACviB,KAAK,CAAC;MAC7B,IAAI,CAAC+yK,0BAA0B,CAAC,CAAC;IACnC;IACA,OAAOxwJ,GAAG;EACZ;EACA,OAAO,EAAE;AACX,CAAC;AAEDqvJ,oBAAS,CAACh4K,EAAE,GAAG+5K,QAAQ;AACvB;AACA/B,oBAAS,CAACh4K,EAAE,CAACgG,UAAU,GAAGgyK,oBAAS,CAAChyK,UAAU;;AC5YpB;AACN;AAEpB,0CAAei3J,QAAI","sources":["webpack://miew/./src/utils/MiewCLIParser.js","webpack://miew/./src/utils/SelectionParser.js","webpack://miew/./vendor/js/Smooth.js","webpack://miew/./vendor/js/mmtf.js","webpack://miew/webpack/bootstrap","webpack://miew/webpack/runtime/compat get default export","webpack://miew/webpack/runtime/define property getters","webpack://miew/webpack/runtime/hasOwnProperty shorthand","webpack://miew/external module {\"module\":\"lodash\",\"commonjs\":\"lodash\",\"commonjs2\":\"lodash\",\"amd\":\"lodash\",\"root\":\"_\"}","webpack://miew/external module {\"module\":\"three\",\"commonjs\":\"three\",\"commonjs2\":\"three\",\"amd\":\"three\",\"root\":\"THREE\"}","webpack://miew/../../node_modules/spin.js/spin.js","webpack://miew/./src/Timer.js","webpack://miew/./src/gfx/Stats.js","webpack://miew/./src/utils/EventDispatcher.js","webpack://miew/./src/utils/logger.js","webpack://miew/./src/utils.js","webpack://miew/./src/utils/JobHandle.js","webpack://miew/./src/settings.js","webpack://miew/./src/options.js","webpack://miew/./src/chem/Atom.js","webpack://miew/./src/chem/Element.js","webpack://miew/./src/chem/Bond.js","webpack://miew/./src/chem/Residue.js","webpack://miew/./src/chem/ResidueType.js","webpack://miew/./src/chem/Chain.js","webpack://miew/./src/chem/StructuralElement.js","webpack://miew/./src/chem/Helix.js","webpack://miew/./src/chem/Strand.js","webpack://miew/./src/chem/Sheet.js","webpack://miew/./src/chem/SGroup.js","webpack://miew/./src/chem/selectors/selectArgs.js","webpack://miew/./src/chem/selectors/selectorsBase.js","webpack://miew/./src/chem/selectors/selectOps.js","webpack://miew/./src/chem/selectors.js","webpack://miew/./src/chem/BiologicalUnit.js","webpack://miew/./src/chem/Assembly.js","webpack://miew/./src/chem/Component.js","webpack://miew/./src/chem/AtomPairs.js","webpack://miew/./src/chem/AutoBond.js","webpack://miew/./src/chem/AromaticLoopsMarker.js","webpack://miew/./src/chem/VoxelWorld.js","webpack://miew/./src/chem/HBondInfo.js","webpack://miew/./src/chem/SecondaryStructureMap.js","webpack://miew/./src/chem/Complex.js","webpack://miew/./src/chem/Volume.js","webpack://miew/./src/chem/Molecule.js","webpack://miew/./src/chem.js","webpack://miew/./src/gfx/CSS2DObject.js","webpack://miew/./src/gfx/RCGroup.js","webpack://miew/./src/gfx/gfxutils.js","webpack://miew/./src/Visual.js","webpack://miew/./src/utils/EntityList.js","webpack://miew/./src/utils/makeContextDependent.js","webpack://miew/./src/gfx/geometries/SphereCollisionGeo.js","webpack://miew/./src/gfx/geometries/InstancedSpheresGeometry.js","webpack://miew/./src/gfx/geometries/ChunkedObjectsGeometry.js","webpack://miew/./src/gfx/geometries/SimpleSpheresGeometry.js","webpack://miew/./src/gfx/geometries/Simple2CCylindersGeometry.js","webpack://miew/./src/gfx/geometries/CylinderBufferGeometry.js","webpack://miew/./src/gfx/geometries/Instanced2CCylindersGeometry.js","webpack://miew/./src/gfx/geometries/ExtrudedObjectsGeometry.js","webpack://miew/./src/gfx/geometries/ThickLinesGeometry.js","webpack://miew/./src/gfx/geometries/LinesGeometry.js","webpack://miew/./src/gfx/geometries/CylinderCollisionGeo.js","webpack://miew/./src/gfx/geometries/ChunkedLinesGeometry.js","webpack://miew/./src/gfx/geometries/TwoColorLinesGeometry.js","webpack://miew/./src/gfx/geometries/CrossGeometry.js","webpack://miew/./src/gfx/geometries/IsoSurfaceGeometry.js","webpack://miew/./src/gfx/geometries/IsoSurfaceMarchCube.js","webpack://miew/./src/gfx/geometries/IsoSurface.js","webpack://miew/./src/gfx/geometries/VolumeSurfaceGeometry.js","webpack://miew/./src/gfx/geometries/QuickSurfGeometry.js","webpack://miew/./src/gfx/geometries/ContactSurface.js","webpack://miew/./src/gfx/geometries/ContactSurfaceGeometry.js","webpack://miew/./src/gfx/geometries/IsoSurfaceAtomColored.js","webpack://miew/./src/gfx/geometries/IsosurfaceBuildNormals.js","webpack://miew/./src/gfx/geometries/IsoSurfaceGeo.js","webpack://miew/./src/gfx/geometries/SSIsosurfaceGeometry.js","webpack://miew/./src/gfx/geometries/LabelsGeometry.js","webpack://miew/./src/gfx/geometries/geometries.js","webpack://miew/./src/gfx/capabilities.js","webpack://miew/./src/gfx/noiseTexture.js","webpack://miew/./src/gfx/shaders/UberMaterial.js","webpack://miew/./src/gfx/meshes/UberObject.js","webpack://miew/./src/gfx/meshes/ZSpriteMesh.js","webpack://miew/./src/gfx/meshes/ZClippedMesh.js","webpack://miew/./src/gfx/meshes/TextMesh.js","webpack://miew/./src/gfx/meshes/SimpleMesh.js","webpack://miew/./src/gfx/meshes/ThickLineMesh.js","webpack://miew/./src/gfx/meshes/InstancedMesh.js","webpack://miew/./src/gfx/meshes/meshes.js","webpack://miew/./src/gfx/meshes/MeshCreator.js","webpack://miew/./src/gfx/meshes/TransformGroup.js","webpack://miew/./src/gfx/modes/groups/ChemGroup.js","webpack://miew/./src/gfx/modes/groups/AtomsGroup.js","webpack://miew/./src/gfx/modes/groups/AtomsSphereGroup.js","webpack://miew/./src/gfx/modes/groups/AtomsSurfaceGroup.js","webpack://miew/./src/gfx/modes/groups/AtomsSASSESGroupStub.js","webpack://miew/./src/gfx/modes/groups/AtomsTextGroup.js","webpack://miew/./src/gfx/modes/groups/AromaticGroup.js","webpack://miew/./src/gfx/modes/groups/AromaticTorusGroup.js","webpack://miew/./src/gfx/modes/groups/AromaticLinesGroup.js","webpack://miew/./src/gfx/modes/groups/ResiduesGroup.js","webpack://miew/./src/gfx/modes/groups/NucleicItemGroup.js","webpack://miew/./src/gfx/modes/groups/NucleicCylindersGroup.js","webpack://miew/./src/gfx/modes/groups/NucleicSpheresGroup.js","webpack://miew/./src/gfx/modes/groups/CartoonHelper.js","webpack://miew/./src/gfx/modes/groups/ResiduesSubseqGroup.js","webpack://miew/./src/gfx/modes/groups/ResiduesTraceGroup.js","webpack://miew/./src/gfx/modes/groups/BondsGroup.js","webpack://miew/./src/gfx/modes/groups/BondsCylinderGroup.js","webpack://miew/./src/gfx/modes/groups/BondsLinesGroup.js","webpack://miew/./src/gfx/modes/groups/groups.js","webpack://miew/./src/gfx/modes/processors/AtomsProcessor.js","webpack://miew/./src/gfx/modes/processors/OrphanAtomsProcessor.js","webpack://miew/./src/gfx/modes/processors/ResiduesProcessor.js","webpack://miew/./src/gfx/modes/processors/NucleicProcessor.js","webpack://miew/./src/gfx/modes/processors/SubseqsProcessor.js","webpack://miew/./src/gfx/modes/processors/BondsProcessor.js","webpack://miew/./src/gfx/modes/processors/AromaticProcessor.js","webpack://miew/./src/gfx/modes/processors/processors.js","webpack://miew/./src/gfx/modes/groups/GroupsFactory.js","webpack://miew/./src/gfx/modes/Mode.js","webpack://miew/./src/gfx/modes/LinesMode.js","webpack://miew/./src/gfx/modes/LicoriceMode.js","webpack://miew/./src/gfx/modes/BallsAndSticksMode.js","webpack://miew/./src/gfx/modes/VanDerWaalsMode.js","webpack://miew/./src/gfx/modes/TraceMode.js","webpack://miew/./src/gfx/modes/TubeMode.js","webpack://miew/./src/gfx/modes/CartoonMode.js","webpack://miew/./src/gfx/modes/SurfaceMode.js","webpack://miew/./src/gfx/modes/QuickSurfaceMode.js","webpack://miew/./src/gfx/modes/IsoSurfaceMode.js","webpack://miew/./src/gfx/modes/IsoSurfaceSASMode.js","webpack://miew/./src/gfx/modes/IsoSurfaceSESMode.js","webpack://miew/./src/gfx/modes/ContactSurfaceMode.js","webpack://miew/./src/gfx/modes/TextMode.js","webpack://miew/./src/gfx/modes.js","webpack://miew/./src/gfx/palettes/Palette.js","webpack://miew/./src/gfx/palettes/cpkPalette.js","webpack://miew/./src/gfx/palettes/jmolPalette.js","webpack://miew/./src/gfx/palettes/vmdPalette.js","webpack://miew/./src/gfx/palettes.js","webpack://miew/./src/gfx/colorers/Colorer.js","webpack://miew/./src/gfx/colorers/ElementColorer.js","webpack://miew/./src/gfx/colorers/ResidueTypeColorer.js","webpack://miew/./src/gfx/colorers/SequenceColorer.js","webpack://miew/./src/gfx/colorers/ChainColorer.js","webpack://miew/./src/gfx/colorers/SecondaryStructureColorer.js","webpack://miew/./src/gfx/colorers/UniformColorer.js","webpack://miew/./src/gfx/colorers/ConditionalColorer.js","webpack://miew/./src/gfx/colorers/ConformationColorer.js","webpack://miew/./src/gfx/colorers/TemperatureColorer.js","webpack://miew/./src/gfx/colorers/OccupancyColorer.js","webpack://miew/./src/gfx/colorers/HydrophobicityColorer.js","webpack://miew/./src/gfx/colorers/MoleculeColorer.js","webpack://miew/./src/gfx/colorers/CarbonColorer.js","webpack://miew/./src/gfx/colorers.js","webpack://miew/./src/gfx/materials.js","webpack://miew/./src/gfx/meshutils.js","webpack://miew/./src/gfx/Representation.js","webpack://miew/./src/ComplexVisualEdit.js","webpack://miew/./src/ComplexVisual.js","webpack://miew/./src/gfx/shaders/VolumeMaterial.js","webpack://miew/./src/gfx/VolumeMesh.js","webpack://miew/./src/gfx/VolumeBounds.js","webpack://miew/./src/gfx/VolumeFarPlane.js","webpack://miew/./src/VolumeVisual.js","webpack://miew/./src/io/loaders/LoaderList.js","webpack://miew/./src/io/loaders/Loader.js","webpack://miew/./src/io/loaders/FileLoader.js","webpack://miew/./src/io/loaders/XHRLoader.js","webpack://miew/./src/io/loaders/ImmediateLoader.js","webpack://miew/./src/io/loaders.js","webpack://miew/./src/io/parsers/ParserList.js","webpack://miew/./src/io/parsers/Parser.js","webpack://miew/./src/io/parsers/pdb/Remark290.js","webpack://miew/./src/io/parsers/pdb/Remark350.js","webpack://miew/./src/io/parsers/PDBStream.js","webpack://miew/./src/io/parsers/PDBParser.js","webpack://miew/./src/io/parsers/CMLParser.js","webpack://miew/./src/io/parsers/MMTFParser.js","webpack://miew/./src/io/parsers/ParsingError.js","webpack://miew/./src/io/parsers/readCIF.js","webpack://miew/./src/io/parsers/CIFParser.js","webpack://miew/./src/io/parsers/VolumeModel.js","webpack://miew/./src/io/parsers/CCP4Parser.js","webpack://miew/./src/io/parsers/XYZParser.js","webpack://miew/./src/io/parsers/PubChemParser.js","webpack://miew/./src/io/parsers/SDFStream.js","webpack://miew/./src/io/parsers/SDFParser.js","webpack://miew/./src/io/parsers/DSN6Parser.js","webpack://miew/./src/io/parsers/GROReader.js","webpack://miew/./src/io/parsers/GROParser.js","webpack://miew/./src/io/parsers/MOL2Parser.js","webpack://miew/./src/io/parsers.js","webpack://miew/./src/io/exporters/ExporterList.js","webpack://miew/./src/io/exporters/Exporter.js","webpack://miew/./src/io/exporters/PDBResult.js","webpack://miew/./src/io/exporters/PDBExporter.js","webpack://miew/./src/io/exporters/fbx/FBXModel.js","webpack://miew/./src/io/exporters/fbx/FBXGeometry.js","webpack://miew/./src/io/exporters/fbx/FBX1CGeometry.js","webpack://miew/./src/io/exporters/fbx/FBX2CCylinder.js","webpack://miew/./src/io/exporters/fbx/FBXInfoExtractor.js","webpack://miew/./src/io/exporters/fbx/FBXResult.js","webpack://miew/./src/io/exporters/FBXExporter.js","webpack://miew/./src/io/exporters.js","webpack://miew/./src/io/io.js","webpack://miew/./src/gfx/CSS2DRenderer.js","webpack://miew/./src/utils/getTopWindow.js","webpack://miew/./src/ui/ObjectControls.js","webpack://miew/./src/ui/Picker.js","webpack://miew/./src/gfx/Axes.js","webpack://miew/./src/gfx/FrameInfo.js","webpack://miew/./src/gfx/objects/SceneObject.js","webpack://miew/./src/gfx/objects/LinesObj.js","webpack://miew/./src/gfx/shaders/OutlineMaterial.js","webpack://miew/./src/gfx/shaders/FXAAMaterial.js","webpack://miew/./src/gfx/shaders/AOMaterial.js","webpack://miew/./src/gfx/shaders/AOHorBlurMaterial.js","webpack://miew/./src/gfx/shaders/AOVertBlurWithBlendMaterial.js","webpack://miew/./src/gfx/shaders/AnaglyphMaterial.js","webpack://miew/./src/gfx/ViewInterpolator.js","webpack://miew/./src/utils/Cookies.js","webpack://miew/./src/gfx/vr/createWebVRButton.js","webpack://miew/./src/gfx/vr/WebVRPoC.js","webpack://miew/./src/Miew.js","webpack://miew/./src/utils/MiewCLIHelp.js","webpack://miew/./src/Miew-cli.js","webpack://miew/./src/index.js"],"sourcesContent":["/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,60],$V1=[1,62],$V2=[1,63],$V3=[1,65],$V4=[1,66],$V5=[1,67],$V6=[1,68],$V7=[1,69],$V8=[1,80],$V9=[1,72],$Va=[1,73],$Vb=[1,74],$Vc=[1,75],$Vd=[1,99],$Ve=[1,76],$Vf=[1,100],$Vg=[1,79],$Vh=[1,51],$Vi=[1,81],$Vj=[1,82],$Vk=[1,84],$Vl=[1,83],$Vm=[1,85],$Vn=[1,96],$Vo=[1,97],$Vp=[1,98],$Vq=[1,86],$Vr=[1,87],$Vs=[1,64],$Vt=[1,70],$Vu=[1,71],$Vv=[1,77],$Vw=[1,78],$Vx=[1,53],$Vy=[1,54],$Vz=[1,55],$VA=[1,61],$VB=[1,88],$VC=[1,89],$VD=[1,90],$VE=[1,91],$VF=[1,92],$VG=[1,93],$VH=[1,94],$VI=[1,95],$VJ=[1,101],$VK=[1,102],$VL=[1,103],$VM=[1,104],$VN=[1,105],$VO=[1,56],$VP=[1,57],$VQ=[1,58],$VR=[1,59],$VS=[1,115],$VT=[1,111],$VU=[1,114],$VV=[1,112],$VW=[1,113],$VX=[1,118],$VY=[1,117],$VZ=[1,134],$V_=[1,149],$V$=[1,150],$V01=[1,157],$V11=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V21=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,71,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],$V31=[5,6,7,9,13,15,17,18,19,20,23,25,26,27,30,33,34,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95],$V41=[5,70,72],$V51=[5,74],$V61=[71,101];\r\nvar parser = {trace: function trace () { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Command\":4,\"EOF\":5,\"RESET\":6,\"BUILD\":7,\"ALL\":8,\"HELP\":9,\"Path\":10,\"MOTM\":11,\"OneArgCommand\":12,\"GET\":13,\"STRING\":14,\"SET\":15,\"Value\":16,\"SET_SAVE\":17,\"SET_RESTORE\":18,\"SET_RESET\":19,\"PRESET\":20,\"AddRepresentation\":21,\"EditRepresentation\":22,\"REMOVE\":23,\"RepresentationReference\":24,\"HIDE\":25,\"SHOW\":26,\"LIST\":27,\"EXPAND_KEY\":28,\"SELECTOR_KEY\":29,\"SELECT\":30,\"AS\":31,\"WordAll\":32,\"SELECTOR\":33,\"WITHIN\":34,\"NUMBER\":35,\"OF\":36,\"MATERIAL\":37,\"IDENTIFIER\":38,\"ModeCMD\":39,\"ColorCMD\":40,\"VIEW\":41,\"BASE_64\":42,\"UNIT\":43,\"DSSP\":44,\"SCALE\":45,\"ROTATE\":46,\"AxesList\":47,\"TRANSLATE\":48,\"CENTER\":49,\"GetURLBranch\":50,\"Screenshot\":51,\"LINE\":52,\"ArgList\":53,\"LISTOBJ\":54,\"REMOVEOBJ\":55,\"URL\":56,\"VIEW_KEY\":57,\"SCREENSHOT\":58,\"LOAD\":59,\"Url\":60,\"FILE_KEY\":61,\"ADD\":62,\"Description\":63,\"REP\":64,\"MODE\":65,\"COLOR\":66,\"Descriptor\":67,\"RepresentationOwnProperty\":68,\"RepresentationOwnPropertyOpts\":69,\"DESC_KEY\":70,\"=\":71,\"DESC_KEY_OPTS\":72,\"AxesArg\":73,\"DESC_KEY_AXES\":74,\"Arg\":75,\"PathWoDescKey\":76,\"HEX\":77,\"BOOL\":78,\"Word\":79,\"CommandSetWoDESC_KEY\":80,\"DescKeys\":81,\"CLEAR\":82,\"FILE_LIST\":83,\"FILE_REGISTER\":84,\"FILE_DELETE\":85,\"PRESET_ADD\":86,\"PRESET_DELETE\":87,\"PRESET_UPDATE\":88,\"PRESET_RENAME\":89,\"PRESET_OPEN\":90,\"CREATE_SCENARIO\":91,\"RESET_SCENARIO\":92,\"DELETE_SCENARIO\":93,\"ADD_SCENARIO_ITEM\":94,\"LIST_SCENARIO\":95,\"PDB_KEY\":96,\"DELAY_KEY\":97,\"PRST_KEY\":98,\"DESCRIPTION_KEY\":99,\"CommandSet\":100,\".\":101,\"PresetPath\":102,\"/\":103,\"HexOrNumber\":104,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",6:\"RESET\",7:\"BUILD\",8:\"ALL\",9:\"HELP\",11:\"MOTM\",13:\"GET\",14:\"STRING\",15:\"SET\",17:\"SET_SAVE\",18:\"SET_RESTORE\",19:\"SET_RESET\",20:\"PRESET\",23:\"REMOVE\",25:\"HIDE\",26:\"SHOW\",27:\"LIST\",28:\"EXPAND_KEY\",29:\"SELECTOR_KEY\",30:\"SELECT\",31:\"AS\",33:\"SELECTOR\",34:\"WITHIN\",35:\"NUMBER\",36:\"OF\",37:\"MATERIAL\",38:\"IDENTIFIER\",41:\"VIEW\",42:\"BASE_64\",43:\"UNIT\",44:\"DSSP\",45:\"SCALE\",46:\"ROTATE\",48:\"TRANSLATE\",49:\"CENTER\",52:\"LINE\",54:\"LISTOBJ\",55:\"REMOVEOBJ\",56:\"URL\",57:\"VIEW_KEY\",58:\"SCREENSHOT\",59:\"LOAD\",61:\"FILE_KEY\",62:\"ADD\",64:\"REP\",65:\"MODE\",66:\"COLOR\",70:\"DESC_KEY\",71:\"=\",72:\"DESC_KEY_OPTS\",74:\"DESC_KEY_AXES\",77:\"HEX\",78:\"BOOL\",82:\"CLEAR\",83:\"FILE_LIST\",84:\"FILE_REGISTER\",85:\"FILE_DELETE\",86:\"PRESET_ADD\",87:\"PRESET_DELETE\",88:\"PRESET_UPDATE\",89:\"PRESET_RENAME\",90:\"PRESET_OPEN\",91:\"CREATE_SCENARIO\",92:\"RESET_SCENARIO\",93:\"DELETE_SCENARIO\",94:\"ADD_SCENARIO_ITEM\",95:\"LIST_SCENARIO\",96:\"PDB_KEY\",97:\"DELAY_KEY\",98:\"PRST_KEY\",99:\"DESCRIPTION_KEY\",101:\".\",103:\"/\"},\r\nproductions_: [0,[3,2],[3,1],[4,1],[4,1],[4,2],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,3],[4,3],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[4,2],[4,1],[4,2],[4,2],[4,2],[4,4],[4,2],[4,6],[4,2],[4,1],[4,1],[4,1],[4,2],[4,2],[4,1],[4,2],[4,1],[4,2],[4,2],[4,2],[4,1],[4,2],[4,1],[4,1],[4,3],[4,3],[4,4],[4,4],[4,1],[4,2],[50,1],[50,2],[50,2],[50,3],[50,3],[51,1],[51,2],[51,3],[12,2],[12,2],[12,2],[21,1],[21,2],[21,2],[21,3],[22,2],[22,3],[39,2],[39,3],[40,2],[40,3],[24,1],[24,1],[63,1],[63,2],[63,3],[63,4],[67,1],[67,1],[67,2],[68,3],[69,3],[47,1],[47,2],[73,2],[53,1],[53,2],[75,3],[16,1],[16,1],[16,1],[16,1],[16,1],[79,1],[79,1],[32,1],[32,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[100,1],[100,1],[76,1],[76,3],[76,3],[10,1],[10,1],[10,3],[10,3],[10,3],[60,1],[102,1],[102,3],[104,1],[104,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.miew.reset(false); yy.ClearContext(); yy.miew.resetReps(\"empty\");\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.miew.rebuild();\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.miew.rebuildAll(); yy.miew.rebuild();\r\nbreak;\r\ncase 6:\r\nthis.$ = yy.echo(yy.utils.help().toString());\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.echo(yy.utils.help($$[$0]).toString());\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.miew.motm();\r\nbreak;\r\ncase 10: case 11:\r\nthis.$ = yy.utils.propagateProp($$[$0]); yy.echo(yy.miew.get($$[$0]).toString());\r\nbreak;\r\ncase 12: case 13:\r\nthis.$ = yy.miew.set($$[$0-1], yy.utils.propagateProp($$[$0-1], $$[$0]));;\r\nbreak;\r\ncase 14:\r\nthis.$ = yy.miew.saveSettings();;\r\nbreak;\r\ncase 15:\r\nthis.$ = yy.miew.restoreSettings();;\r\nbreak;\r\ncase 16:\r\nthis.$ = yy.miew.resetSettings();;\r\nbreak;\r\ncase 17:\r\nthis.$ = yy.miew.resetReps();\r\nbreak;\r\ncase 18:\r\nthis.$ = yy.miew.applyPreset($$[$0]);\r\nbreak;\r\ncase 21:\r\nthis.$ = yy.miew.repRemove($$[$0]); yy.representations.remove($$[$0]);\r\nbreak;\r\ncase 22:\r\nthis.$ = yy.miew.repHide($$[$0]);\r\nbreak;\r\ncase 23:\r\nthis.$ = yy.miew.repHide($$[$0], false);\r\nbreak;\r\ncase 24:\r\nthis.$ = yy.echo(yy.utils.listRep(yy.miew, yy.representations, $$[$0], '-e'));\r\nbreak;\r\ncase 25:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations));\r\nbreak;\r\ncase 26:\r\nthis.$ = yy.echo(yy.utils.list(yy.miew, yy.representations, $$[$0]));\r\nbreak;\r\ncase 27:\r\nthis.$ = yy.echo(yy.utils.listSelector(yy.miew, yy.Context));\r\nbreak;\r\ncase 28:\r\nthis.$ = yy.miew.select(yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0], true));\r\nbreak;\r\ncase 29:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.utils.checkArg($$[$0-3].toLowerCase(), $$[$0-2], true); yy.miew.select(yy.Context[$$[$0].toLowerCase()]);\r\nbreak;\r\ncase 30:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {selector : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0])});\r\nbreak;\r\ncase 31:\r\nthis.$ = yy.Context[$$[$0].toLowerCase()] = yy.miew.within(yy.utils.checkArg(\"select\", $$[$0-2], true), Number($$[$0-4]));\r\nbreak;\r\ncase 32:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {material : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 35:\r\nthis.$ = yy.echo(yy.miew.view());\r\nbreak;\r\ncase 36: case 37:\r\nthis.$ = yy.miew.view($$[$0]);\r\nbreak;\r\ncase 38:\r\nthis.$ = yy.echo(yy.miew.changeUnit());\r\nbreak;\r\ncase 39:\r\nthis.$ = yy.echo(yy.miew.changeUnit($$[$0]));\r\nbreak;\r\ncase 40:\r\nthis.$ = yy.miew.dssp();\r\nbreak;\r\ncase 41:\r\nthis.$ = yy.miew.scale($$[$0]);\r\nbreak;\r\ncase 42:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.rotate($$[$0][i]['x'] * Math.PI / 180.0, $$[$0][i]['y'] * Math.PI / 180.0, $$[$0][i]['z'] * Math.PI / 180.0)} \r\nbreak;\r\ncase 43:\r\n for (var i = 0, n = $$[$0].length; i < n; i++) {yy.miew.translate($$[$0][i]['x'] || 0, $$[$0][i]['y'] || 0, $$[$0][i]['z'] || 0)} \r\nbreak;\r\ncase 44:\r\nthis.$ = yy.miew.center();\r\nbreak;\r\ncase 45:\r\nthis.$ = yy.miew.center($$[$0]);\r\nbreak;\r\ncase 48: case 49:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-1], $$[$0]]}, true);\r\nbreak;\r\ncase 50: case 51:\r\nthis.$ = yy.miew.addObject({type: 'line', params: [$$[$0-2], $$[$0-1]], opts:$$[$0].toJSO(yy.utils, 'objects', 'line')}, true);\r\nbreak;\r\ncase 52:\r\nthis.$ = yy.echo(yy.utils.listObjs(yy.miew));\r\nbreak;\r\ncase 53:\r\nthis.$ = yy.miew.removeObject($$[$0]);\r\nbreak;\r\ncase 54:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: false}));\r\nbreak;\r\ncase 55:\r\nthis.$ = yy.echo(yy.miew.getURL({view: false, settings: true}));\r\nbreak;\r\ncase 56:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: false}));\r\nbreak;\r\ncase 57: case 58:\r\nthis.$ = yy.echo(yy.miew.getURL({view: true, settings: true}));\r\nbreak;\r\ncase 59:\r\nthis.$ = yy.miew.screenshotSave();\r\nbreak;\r\ncase 60:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0]));\r\nbreak;\r\ncase 61:\r\nthis.$ = yy.miew.screenshotSave('', Number($$[$0-1]), Number($$[$0]));\r\nbreak;\r\ncase 62: case 63: case 64:\r\nthis.$ = yy.utils.load(yy.miew, $$[$0]); yy.representations.clear();\r\nbreak;\r\ncase 65:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd()));\r\nbreak;\r\ncase 66:\r\nthis.$ = yy.echo(yy.representations.add($$[$0], yy.miew.repAdd()));\r\nbreak;\r\ncase 67:\r\nthis.$ = yy.echo(yy.representations.add(yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 68:\r\nthis.$ = yy.echo(yy.representations.add($$[$0-1], yy.miew.repAdd($$[$0])));\r\nbreak;\r\ncase 69:\r\nthis.$ = yy.miew.rep($$[$0]); yy.miew.repCurrent($$[$0]);\r\nbreak;\r\ncase 70:\r\nthis.$ = yy.miew.rep($$[$0-1], $$[$0]); yy.miew.repCurrent($$[$0-1]);\r\nbreak;\r\ncase 71:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 72:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {mode : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 73:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : yy.utils.checkArg($$[$0-1].toLowerCase(), $$[$0].toUpperCase())});\r\nbreak;\r\ncase 74:\r\nthis.$ = yy.miew.rep(yy.miew.repCurrent(), {colorer : new Array(yy.utils.checkArg($$[$0-2].toLowerCase(), $$[$0-1].toUpperCase()), $$[$0].toJSO(yy.utils, $$[$0-2], $$[$0-1].toUpperCase()))});\r\nbreak;\r\ncase 75:\r\nthis.$ = Number(yy.representations.get($$[$0]));\r\nbreak;\r\ncase 76: case 92:\r\nthis.$ = Number($$[$0]);\r\nbreak;\r\ncase 77:\r\nthis.$ = $$[$0];\r\nbreak;\r\ncase 78:\r\nthis.$ = yy._.assign($$[$0-1], $$[$0]);\r\nbreak;\r\ncase 79:\r\nthis.$ = yy._.assign($$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 80:\r\nthis.$ = yy._.assign($$[$0-3], $$[$0-2], $$[$0-1], $$[$0]);\r\nbreak;\r\ncase 81: case 82:\r\nthis.$ = yy.CreateObjectPair($$[$0].key, $$[$0].val);\r\nbreak;\r\ncase 83:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].key, new Array($$[$0-1].val, $$[$0].toJSO(yy.utils, $$[$0-1].key, $$[$0-1].val)));\r\nbreak;\r\ncase 84: case 85:\r\nthis.$ = Object.create({'key': yy.keyRemap($$[$0-2]), 'val': yy.utils.checkArg($$[$0-2], $$[$0])});\r\nbreak;\r\ncase 86:\r\nthis.$ = [$$[$0]];\r\nbreak;\r\ncase 87:\r\nthis.$ = $$[$0-1].concat($$[$0]);\r\nbreak;\r\ncase 88:\r\nthis.$ = yy.CreateObjectPair($$[$0-1].toLowerCase(), Number($$[$0]));\r\nbreak;\r\ncase 89:\r\nthis.$ = new yy.ArgList($$[$0]);\r\nbreak;\r\ncase 90:\r\nthis.$ = $$[$0-1].append($$[$0]);\r\nbreak;\r\ncase 91:\r\nthis.$ = new yy.Arg($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 93:\r\nthis.$ = parseInt($$[$0]);\r\nbreak;\r\ncase 94:\r\nthis.$ = JSON.parse($$[$0]);\r\nbreak;\r\ncase 95: case 96:\r\nthis.$ = String($$[$0]);\r\nbreak;\r\ncase 157: case 158: case 161: case 162: case 163:\r\nthis.$ = $$[$0-2] + $$[$0-1] + $$[$0] //cause of could be color word in path;\r\nbreak;\r\ncase 166:\r\nthis.$ = $$[$0-2] = $$[$0-2] + $$[$0-1] + $$[$0];\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,5:[1,3],6:[1,4],7:[1,5],9:[1,6],11:[1,7],12:8,13:[1,9],15:[1,10],17:[1,11],18:[1,12],19:[1,13],20:[1,14],21:15,22:16,23:[1,17],25:[1,18],26:[1,19],27:[1,20],30:[1,21],33:[1,22],34:[1,23],37:[1,24],39:25,40:26,41:[1,27],43:[1,28],44:[1,29],45:[1,30],46:[1,31],48:[1,32],49:[1,33],50:34,51:35,52:[1,36],54:[1,37],55:[1,38],56:[1,44],58:[1,45],59:[1,39],62:[1,40],64:[1,41],65:[1,42],66:[1,43]},{1:[3]},{5:[1,46]},{1:[2,2]},{5:[2,3]},{5:[2,4],8:[1,47]},{5:[2,6],6:$V0,7:$V1,9:$V2,10:48,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,8]},{5:[2,9]},{6:$V0,7:$V1,9:$V2,10:106,13:$V3,14:[1,107],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{6:$V0,7:$V1,9:$V2,10:108,13:$V3,14:[1,109],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,14]},{5:[2,15]},{5:[2,16]},{5:[2,17],14:$VS,16:110,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,19]},{5:[2,20]},{24:116,35:$VX,38:$VY},{24:119,35:$VX,38:$VY},{24:120,35:$VX,38:$VY},{5:[2,25],24:121,28:[1,122],29:[1,123],35:$VX,38:$VY},{14:[1,124]},{14:[1,125]},{35:[1,126]},{38:[1,127]},{5:[2,33]},{5:[2,34]},{5:[2,35],14:[1,128],42:[1,129]},{5:[2,38],35:[1,130]},{5:[2,40]},{35:[1,131]},{47:132,73:133,74:$VZ},{47:135,73:133,74:$VZ},{5:[2,44],14:[1,136]},{5:[2,46]},{5:[2,47]},{6:$V0,7:$V1,9:$V2,10:138,13:$V3,14:[1,137],15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,52]},{35:[1,139]},{14:[1,143],38:[1,141],60:140,61:[1,142]},{5:[2,65],38:[1,144],63:145,67:146,68:147,69:148,70:$V_,72:$V$},{24:151,35:$VX,38:$VY},{38:[1,152]},{38:[1,153]},{5:[2,54],29:[1,154],57:[1,155]},{5:[2,59],35:[1,156]},{1:[2,1]},{5:[2,5]},{5:[2,7],101:$V01},o($V11,[2,159]),o($V11,[2,160]),o($V21,[2,97]),o($V21,[2,98]),o($V11,[2,147]),o($V11,[2,148]),o($V11,[2,149]),o($V11,[2,150]),o($V11,[2,151]),o($V11,[2,152]),o($V11,[2,153]),o($V21,[2,101]),o($V21,[2,102]),o($V21,[2,103]),o($V21,[2,104]),o($V21,[2,105]),o($V21,[2,106]),o($V21,[2,107]),o($V21,[2,108]),o($V21,[2,109]),o($V21,[2,110]),o($V21,[2,111]),o($V21,[2,112]),o($V21,[2,113]),o($V21,[2,114]),o($V21,[2,115]),o($V21,[2,116]),o($V21,[2,117]),o($V21,[2,118]),o($V21,[2,119]),o($V21,[2,120]),o($V21,[2,121]),o($V21,[2,122]),o($V21,[2,123]),o($V21,[2,124]),o($V21,[2,125]),o($V21,[2,126]),o($V21,[2,127]),o($V21,[2,128]),o($V21,[2,129]),o($V21,[2,130]),o($V21,[2,131]),o($V21,[2,132]),o($V21,[2,133]),o($V21,[2,134]),o($V21,[2,135]),o($V21,[2,136]),o($V21,[2,137]),o($V21,[2,138]),o($V21,[2,139]),o($V21,[2,140]),o($V21,[2,141]),o($V21,[2,142]),o($V21,[2,143]),o($V21,[2,144]),o($V21,[2,145]),o($V21,[2,146]),{5:[2,10],101:$V01},{5:[2,11]},{14:$VS,16:158,35:$VT,38:$VU,77:$VV,78:$VW,101:$V01},{14:$VS,16:159,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,18]},o($V31,[2,92]),o($V31,[2,93]),o($V31,[2,94]),o($V31,[2,95]),o($V31,[2,96]),{5:[2,21]},o($V41,[2,75]),o($V41,[2,76]),{5:[2,22]},{5:[2,23]},{5:[2,24]},{5:[2,26]},{5:[2,27]},{5:[2,28],31:[1,160]},{5:[2,30]},{36:[1,161]},{5:[2,32]},{5:[2,36]},{5:[2,37]},{5:[2,39]},{5:[2,41]},{5:[2,42],73:162,74:$VZ},o($V51,[2,86]),{35:[1,163]},{5:[2,43],73:162,74:$VZ},{5:[2,45]},{14:[1,164]},{6:$V0,7:$V1,9:$V2,10:165,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:49,80:52,81:50,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR,101:$V01},{5:[2,53]},{5:[2,62]},{5:[2,63]},{5:[2,64]},{5:[2,164]},{5:[2,66],63:166,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,67]},{5:[2,77],67:167,68:147,69:148,70:$V_,72:$V$},o($V41,[2,81]),o($V41,[2,82],{80:52,53:168,75:169,76:170,79:171,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),{71:[1,172]},{71:[1,173]},{5:[2,69],63:174,67:146,68:147,69:148,70:$V_,72:$V$},{5:[2,71],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:175,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,73],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:176,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,55],57:[1,177]},{5:[2,56],29:[1,178]},{5:[2,60],35:[1,179]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,181],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:180,80:52,81:182,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,12]},{5:[2,13]},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:183,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{14:[1,186]},o($V51,[2,87]),o($V51,[2,88]),{5:[2,48],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:187,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,49],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,53:188,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:169,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,101:$V01},{5:[2,68]},{5:[2,78],67:189,68:147,69:148,70:$V_,72:$V$},o($V41,[2,83],{80:52,76:170,79:171,75:190,6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN}),o($V31,[2,89]),{71:[1,191],101:[1,192]},o($V61,[2,156]),{14:$VS,16:193,35:$VT,38:$VU,77:$VV,78:$VW},{14:$VS,16:194,35:$VT,38:$VU,77:$VV,78:$VW},{5:[2,70]},{5:[2,72],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,74],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,57]},{5:[2,58]},{5:[2,61]},o($V11,[2,161]),o($V11,[2,162]),o($V11,[2,163]),{5:[2,29]},{5:[2,99]},{5:[2,100]},{31:[1,195]},{5:[2,50],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,51],6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,75:190,76:170,79:171,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},{5:[2,79],67:196,68:147,69:148,70:$V_,72:$V$},o($V31,[2,90]),{14:$VS,16:197,35:$VT,38:$VU,77:$VV,78:$VW},{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,33:$Ve,34:$Vf,35:[1,199],37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,79:198,80:52,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN},o($V41,[2,84]),o($V31,[2,85]),{6:$V0,7:$V1,9:$V2,13:$V3,15:$V4,17:$V5,18:$V6,19:$V7,20:$V8,23:$V9,25:$Va,26:$Vb,27:$Vc,30:$Vd,32:200,33:$Ve,34:$Vf,37:$Vg,38:$Vh,41:$Vi,43:$Vj,45:$Vk,46:$Vl,49:$Vm,52:$Vn,54:$Vo,55:$Vp,56:$Vq,58:$Vr,59:$Vs,62:$Vt,64:$Vu,65:$Vv,66:$Vw,70:$Vx,72:$Vy,74:$Vz,79:184,80:52,81:185,82:$VA,83:$VB,84:$VC,85:$VD,86:$VE,87:$VF,88:$VG,89:$VH,90:$VI,91:$VJ,92:$VK,93:$VL,94:$VM,95:$VN,96:$VO,97:$VP,98:$VQ,99:$VR},{5:[2,80]},o($V31,[2,91]),o($V61,[2,157]),o($V61,[2,158]),{5:[2,31]}],\r\ndefaultActions: {3:[2,2],4:[2,3],7:[2,8],8:[2,9],11:[2,14],12:[2,15],13:[2,16],15:[2,19],16:[2,20],25:[2,33],26:[2,34],29:[2,40],34:[2,46],35:[2,47],37:[2,52],46:[2,1],47:[2,5],107:[2,11],110:[2,18],116:[2,21],119:[2,22],120:[2,23],121:[2,24],122:[2,26],123:[2,27],125:[2,30],127:[2,32],128:[2,36],129:[2,37],130:[2,39],131:[2,41],136:[2,45],139:[2,53],140:[2,62],141:[2,63],142:[2,64],143:[2,164],145:[2,67],158:[2,12],159:[2,13],166:[2,68],174:[2,70],177:[2,57],178:[2,58],179:[2,61],183:[2,29],184:[2,99],185:[2,100],196:[2,80],200:[2,31]},\r\nparseError: function parseError (str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function(match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex () {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin (condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState () {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules () {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState (n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState (condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* ignore whitespace */\r\nbreak;\r\ncase 1:return '';\r\nbreak;\r\ncase 2:return '';\r\nbreak;\r\ncase 3:return 42;\r\nbreak;\r\ncase 4:return 35;\r\nbreak;\r\ncase 5:return 77;\r\nbreak;\r\ncase 6:return 78;\r\nbreak;\r\ncase 7:return 78;\r\nbreak;\r\ncase 8:return 8;\r\nbreak;\r\ncase 9:return 6;\r\nbreak;\r\ncase 10:return 82;\r\nbreak;\r\ncase 11:return 7;\r\nbreak;\r\ncase 12:return 9;\r\nbreak;\r\ncase 13:return 59;\r\nbreak;\r\ncase 14:return 13\r\nbreak;\r\ncase 15:return 15\r\nbreak;\r\ncase 16:return 17\r\nbreak;\r\ncase 17:return 18\r\nbreak;\r\ncase 18:return 19\r\nbreak;\r\ncase 19:return 20\r\nbreak;\r\ncase 20:return 11\r\nbreak;\r\ncase 21:return 62\r\nbreak;\r\ncase 22:return 64\r\nbreak;\r\ncase 23:return 23\r\nbreak;\r\ncase 24:return 25\r\nbreak;\r\ncase 25:return 26\r\nbreak;\r\ncase 26:return 27\r\nbreak;\r\ncase 27:return 30\r\nbreak;\r\ncase 28:return 34\r\nbreak;\r\ncase 29:return 33\r\nbreak;\r\ncase 30:return 65\r\nbreak;\r\ncase 31:return 66\r\nbreak;\r\ncase 32:return 37\r\nbreak;\r\ncase 33:return 41\r\nbreak;\r\ncase 34:return 43\r\nbreak;\r\ncase 35:return 52\r\nbreak;\r\ncase 36:return 54\r\nbreak;\r\ncase 37:return 55\r\nbreak;\r\ncase 38:return 46\r\nbreak;\r\ncase 39:return 48\r\nbreak;\r\ncase 40:return 45\r\nbreak;\r\ncase 41:return 49\r\nbreak;\r\ncase 42:return 56\r\nbreak;\r\ncase 43:return 58;\r\nbreak;\r\ncase 44:return 44\r\nbreak;\r\ncase 45:return 83\r\nbreak;\r\ncase 46:return 84\r\nbreak;\r\ncase 47:return 85\r\nbreak;\r\ncase 48:return 86\r\nbreak;\r\ncase 49:return 87\r\nbreak;\r\ncase 50:return 88\r\nbreak;\r\ncase 51:return 89\r\nbreak;\r\ncase 52:return 90\r\nbreak;\r\ncase 53:return 91\r\nbreak;\r\ncase 54:return 92\r\nbreak;\r\ncase 55:return 93\r\nbreak;\r\ncase 56:return 94\r\nbreak;\r\ncase 57:return 95\r\nbreak;\r\ncase 58:return 70\r\nbreak;\r\ncase 59:return 70\r\nbreak;\r\ncase 60:return 72\r\nbreak;\r\ncase 61:return 72\r\nbreak;\r\ncase 62:return 74\r\nbreak;\r\ncase 63:return 74\r\nbreak;\r\ncase 64:return 74\r\nbreak;\r\ncase 65:return 31\r\nbreak;\r\ncase 66:return 36\r\nbreak;\r\ncase 67:return 96\r\nbreak;\r\ncase 68:return 97\r\nbreak;\r\ncase 69:return 98\r\nbreak;\r\ncase 70:return 99\r\nbreak;\r\ncase 71:yy_.yytext = yy.utils.unquoteString(yy_.yytext); return 14;\r\nbreak;\r\ncase 72:return 38;\r\nbreak;\r\ncase 73:return 5;\r\nbreak;\r\ncase 74:return 101;\r\nbreak;\r\ncase 75:return 103;\r\nbreak;\r\ncase 76:return '\\\\';\r\nbreak;\r\ncase 77:return 28\r\nbreak;\r\ncase 78:return 61\r\nbreak;\r\ncase 79:return 29\r\nbreak;\r\ncase 80:return 57\r\nbreak;\r\ncase 81:return 71\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:[#].*)/i,/^(?:\\/\\/.*)/i,/^(?:([_A-Z0-9\\/\\+]+==))/i,/^(?:-?[0-9]+(\\.[0-9]+)?\\b)/i,/^(?:0[xX][0-9A-F]+\\b)/i,/^(?:false\\b)/i,/^(?:true\\b)/i,/^(?:all\\b)/i,/^(?:reset\\b)/i,/^(?:clear\\b)/i,/^(?:build\\b)/i,/^(?:help\\b)/i,/^(?:load\\b)/i,/^(?:get\\b)/i,/^(?:set\\b)/i,/^(?:set_save\\b)/i,/^(?:set_restore\\b)/i,/^(?:set_reset\\b)/i,/^(?:preset\\b)/i,/^(?:motm\\b)/i,/^(?:add\\b)/i,/^(?:rep\\b)/i,/^(?:remove\\b)/i,/^(?:hide\\b)/i,/^(?:show\\b)/i,/^(?:list\\b)/i,/^(?:select\\b)/i,/^(?:within\\b)/i,/^(?:selector\\b)/i,/^(?:mode\\b)/i,/^(?:color\\b)/i,/^(?:material\\b)/i,/^(?:view\\b)/i,/^(?:unit\\b)/i,/^(?:line\\b)/i,/^(?:listobj\\b)/i,/^(?:removeobj\\b)/i,/^(?:rotate\\b)/i,/^(?:translate\\b)/i,/^(?:scale\\b)/i,/^(?:center\\b)/i,/^(?:url\\b)/i,/^(?:screenshot\\b)/i,/^(?:dssp\\b)/i,/^(?:file_list\\b)/i,/^(?:file_register\\b)/i,/^(?:file_delete\\b)/i,/^(?:preset_add\\b)/i,/^(?:preset_delete\\b)/i,/^(?:preset_update\\b)/i,/^(?:preset_rename\\b)/i,/^(?:preset_open\\b)/i,/^(?:create_scenario\\b)/i,/^(?:reset_scenario\\b)/i,/^(?:delete_scenario\\b)/i,/^(?:add_scenario_item\\b)/i,/^(?:list_scenario\\b)/i,/^(?:s\\b)/i,/^(?:mt\\b)/i,/^(?:m\\b)/i,/^(?:c\\b)/i,/^(?:x\\b)/i,/^(?:y\\b)/i,/^(?:z\\b)/i,/^(?:as\\b)/i,/^(?:of\\b)/i,/^(?:pdb\\b)/i,/^(?:delay\\b)/i,/^(?:prst\\b)/i,/^(?:desc\\b)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:\\.)/i,/^(?:\\/)/i,/^(?:\\\\)/i,/^(?:-e\\b)/i,/^(?:-f\\b)/i,/^(?:-s\\b)/i,/^(?:-v\\b)/i,/^(?:=)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[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,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","/* eslint-disable */\r\n// DO NOT EDIT! Automatically generated from .jison\r\n/* parser generated by jison 0.4.18 */\r\n/*\r\n Returns a Parser object of the following structure:\r\n\r\n Parser: {\r\n yy: {}\r\n }\r\n\r\n Parser.prototype: {\r\n yy: {},\r\n trace: function(),\r\n symbols_: {associative list: name ==> number},\r\n terminals_: {associative list: number ==> name},\r\n productions_: [...],\r\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\r\n table: [...],\r\n defaultActions: {...},\r\n parseError: function(str, hash),\r\n parse: function(input),\r\n\r\n lexer: {\r\n EOF: 1,\r\n parseError: function(str, hash),\r\n setInput: function(input),\r\n input: function(),\r\n unput: function(str),\r\n more: function(),\r\n less: function(n),\r\n pastInput: function(),\r\n upcomingInput: function(),\r\n showPosition: function(),\r\n test_match: function(regex_match_array, rule_index),\r\n next: function(),\r\n lex: function(),\r\n begin: function(condition),\r\n popState: function(),\r\n _currentRules: function(),\r\n topState: function(),\r\n pushState: function(condition),\r\n\r\n options: {\r\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\r\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\r\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\r\n },\r\n\r\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\r\n rules: [...],\r\n conditions: {associative list: name ==> set},\r\n }\r\n }\r\n\r\n\r\n token location info (@$, _$, etc.): {\r\n first_line: n,\r\n last_line: n,\r\n first_column: n,\r\n last_column: n,\r\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\r\n }\r\n\r\n\r\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\r\n text: (matched text)\r\n token: (the produced terminal token, if any)\r\n line: (yylineno)\r\n }\r\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\r\n loc: (yylloc)\r\n expected: (string describing the set of expected tokens)\r\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\r\n }\r\n*/\r\nvar parser = (function(){\r\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,8],$V5=[1,9],$V6=[1,11],$V7=[1,12],$V8=[5,7,8,11],$V9=[1,17],$Va=[1,22],$Vb=[1,20],$Vc=[1,21],$Vd=[5,7,8,11,19];\r\nvar parser = {trace: function trace() { },\r\nyy: {},\r\nsymbols_: {\"error\":2,\"Program\":3,\"Expression\":4,\"EOF\":5,\"Selector\":6,\"OR\":7,\"AND\":8,\"NOT\":9,\"(\":10,\")\":11,\"SELECTOR\":12,\"NAMED_SELECTOR\":13,\"SELECTOR_RANGED\":14,\"RangeList\":15,\"SELECTOR_NAMED\":16,\"NameList\":17,\"Range\":18,\",\":19,\"NUMBER\":20,\":\":21,\"Name\":22,\"IDENTIFIER\":23,\"STRING\":24,\"$accept\":0,\"$end\":1},\r\nterminals_: {2:\"error\",5:\"EOF\",7:\"OR\",8:\"AND\",9:\"NOT\",10:\"(\",11:\")\",12:\"SELECTOR\",13:\"NAMED_SELECTOR\",14:\"SELECTOR_RANGED\",16:\"SELECTOR_NAMED\",19:\",\",20:\"NUMBER\",21:\":\",23:\"IDENTIFIER\",24:\"STRING\"},\r\nproductions_: [0,[3,2],[4,1],[4,3],[4,3],[4,2],[4,3],[6,1],[6,1],[6,2],[6,2],[15,1],[15,3],[18,1],[18,3],[17,1],[17,3],[22,1],[22,1],[22,1]],\r\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\r\n/* this == yyval */\r\n\r\nvar $0 = $$.length - 1;\r\nswitch (yystate) {\r\ncase 1:\r\n return $$[$0-1]; \r\nbreak;\r\ncase 3:\r\nthis.$ = yy.keyword('or')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 4:\r\nthis.$ = yy.keyword('and')($$[$0-2], $$[$0]);\r\nbreak;\r\ncase 5:\r\nthis.$ = yy.keyword('not')($$[$0]);\r\nbreak;\r\ncase 6:\r\nthis.$ = $$[$0-1];\r\nbreak;\r\ncase 7:\r\nthis.$ = yy.keyword($$[$0])();\r\nbreak;\r\ncase 8:\r\nthis.$ = yy.GetSelector($$[$0].toLowerCase().slice(1, $$[$0].length));\r\nbreak;\r\ncase 9: case 10:\r\nthis.$ = yy.keyword($$[$0-1])($$[$0]);\r\nbreak;\r\ncase 11:\r\nthis.$ = new yy.RangeList($$[$0]);\r\nbreak;\r\ncase 12: case 16:\r\nthis.$ = $$[$0-2].append($$[$0]);\r\nbreak;\r\ncase 13:\r\nthis.$ = new yy.Range(Number($$[$0]));\r\nbreak;\r\ncase 14:\r\nthis.$ = new yy.Range(Number($$[$0-2]), Number($$[$0]));\r\nbreak;\r\ncase 15:\r\nthis.$ = new yy.ValueList($$[$0]);\r\nbreak;\r\n}\r\n},\r\ntable: [{3:1,4:2,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{1:[3]},{5:[1,10],7:$V6,8:$V7},o($V8,[2,2]),{4:13,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:14,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,7]),o($V8,[2,8]),{15:15,18:16,20:$V9},{17:18,20:$Va,22:19,23:$Vb,24:$Vc},{1:[2,1]},{4:23,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},{4:24,6:3,9:$V0,10:$V1,12:$V2,13:$V3,14:$V4,16:$V5},o($V8,[2,5]),{7:$V6,8:$V7,11:[1,25]},o($V8,[2,9],{19:[1,26]}),o($Vd,[2,11]),o($Vd,[2,13],{21:[1,27]}),o($V8,[2,10],{19:[1,28]}),o($Vd,[2,15]),o($Vd,[2,17]),o($Vd,[2,18]),o($Vd,[2,19]),o([5,7,11],[2,3],{8:$V7}),o($V8,[2,4]),o($V8,[2,6]),{18:29,20:$V9},{20:[1,30]},{20:$Va,22:31,23:$Vb,24:$Vc},o($Vd,[2,12]),o($Vd,[2,14]),o($Vd,[2,16])],\r\ndefaultActions: {10:[2,1]},\r\nparseError: function parseError(str, hash) {\r\n if (hash.recoverable) {\r\n this.trace(str);\r\n } else {\r\n var error = new Error(str);\r\n error.hash = hash;\r\n throw error;\r\n }\r\n},\r\nparse: function parse(input) {\r\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\r\n var args = lstack.slice.call(arguments, 1);\r\n var lexer = Object.create(this.lexer);\r\n var sharedState = { yy: {} };\r\n for (var k in this.yy) {\r\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\r\n sharedState.yy[k] = this.yy[k];\r\n }\r\n }\r\n lexer.setInput(input, sharedState.yy);\r\n sharedState.yy.lexer = lexer;\r\n sharedState.yy.parser = this;\r\n if (typeof lexer.yylloc == 'undefined') {\r\n lexer.yylloc = {};\r\n }\r\n var yyloc = lexer.yylloc;\r\n lstack.push(yyloc);\r\n var ranges = lexer.options && lexer.options.ranges;\r\n if (typeof sharedState.yy.parseError === 'function') {\r\n this.parseError = sharedState.yy.parseError;\r\n } else {\r\n this.parseError = Object.getPrototypeOf(this).parseError;\r\n }\r\n function popStack(n) {\r\n stack.length = stack.length - 2 * n;\r\n vstack.length = vstack.length - n;\r\n lstack.length = lstack.length - n;\r\n }\r\n function lex() {\r\n var token;\r\n token = tstack.pop() || lexer.lex() || EOF;\r\n if (typeof token !== 'number') {\r\n if (token instanceof Array) {\r\n tstack = token;\r\n token = tstack.pop();\r\n }\r\n token = self.symbols_[token] || token;\r\n }\r\n return token;\r\n }\r\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\r\n while (true) {\r\n state = stack[stack.length - 1];\r\n if (this.defaultActions[state]) {\r\n action = this.defaultActions[state];\r\n } else {\r\n if (symbol === null || typeof symbol == 'undefined') {\r\n symbol = lex();\r\n }\r\n action = table[state] && table[state][symbol];\r\n }\r\n if (typeof action === 'undefined' || !action.length || !action[0]) {\r\n var errStr = '';\r\n expected = [];\r\n for (p in table[state]) {\r\n if (this.terminals_[p] && p > TERROR) {\r\n expected.push('\\'' + this.terminals_[p] + '\\'');\r\n }\r\n }\r\n if (lexer.showPosition) {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\r\n } else {\r\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\r\n }\r\n this.parseError(errStr, {\r\n text: lexer.match,\r\n token: this.terminals_[symbol] || symbol,\r\n line: lexer.yylineno,\r\n loc: yyloc,\r\n expected: expected\r\n });\r\n }\r\n if (action[0] instanceof Array && action.length > 1) {\r\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\r\n }\r\n switch (action[0]) {\r\n case 1:\r\n stack.push(symbol);\r\n vstack.push(lexer.yytext);\r\n lstack.push(lexer.yylloc);\r\n stack.push(action[1]);\r\n symbol = null;\r\n if (!preErrorSymbol) {\r\n yyleng = lexer.yyleng;\r\n yytext = lexer.yytext;\r\n yylineno = lexer.yylineno;\r\n yyloc = lexer.yylloc;\r\n if (recovering > 0) {\r\n recovering--;\r\n }\r\n } else {\r\n symbol = preErrorSymbol;\r\n preErrorSymbol = null;\r\n }\r\n break;\r\n case 2:\r\n len = this.productions_[action[1]][1];\r\n yyval.$ = vstack[vstack.length - len];\r\n yyval._$ = {\r\n first_line: lstack[lstack.length - (len || 1)].first_line,\r\n last_line: lstack[lstack.length - 1].last_line,\r\n first_column: lstack[lstack.length - (len || 1)].first_column,\r\n last_column: lstack[lstack.length - 1].last_column\r\n };\r\n if (ranges) {\r\n yyval._$.range = [\r\n lstack[lstack.length - (len || 1)].range[0],\r\n lstack[lstack.length - 1].range[1]\r\n ];\r\n }\r\n r = this.performAction.apply(yyval, [\r\n yytext,\r\n yyleng,\r\n yylineno,\r\n sharedState.yy,\r\n action[1],\r\n vstack,\r\n lstack\r\n ].concat(args));\r\n if (typeof r !== 'undefined') {\r\n return r;\r\n }\r\n if (len) {\r\n stack = stack.slice(0, -1 * len * 2);\r\n vstack = vstack.slice(0, -1 * len);\r\n lstack = lstack.slice(0, -1 * len);\r\n }\r\n stack.push(this.productions_[action[1]][0]);\r\n vstack.push(yyval.$);\r\n lstack.push(yyval._$);\r\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\r\n stack.push(newState);\r\n break;\r\n case 3:\r\n return true;\r\n }\r\n }\r\n return true;\r\n}};\r\n\r\n\r\n/* generated by jison-lex 0.3.4 */\r\nvar lexer = (function(){\r\nvar lexer = ({\r\n\r\nEOF:1,\r\n\r\nparseError:function parseError(str, hash) {\r\n if (this.yy.parser) {\r\n this.yy.parser.parseError(str, hash);\r\n } else {\r\n throw new Error(str);\r\n }\r\n },\r\n\r\n// resets the lexer, sets new input\r\nsetInput:function (input, yy) {\r\n this.yy = yy || this.yy || {};\r\n this._input = input;\r\n this._more = this._backtrack = this.done = false;\r\n this.yylineno = this.yyleng = 0;\r\n this.yytext = this.matched = this.match = '';\r\n this.conditionStack = ['INITIAL'];\r\n this.yylloc = {\r\n first_line: 1,\r\n first_column: 0,\r\n last_line: 1,\r\n last_column: 0\r\n };\r\n if (this.options.ranges) {\r\n this.yylloc.range = [0,0];\r\n }\r\n this.offset = 0;\r\n return this;\r\n },\r\n\r\n// consumes and returns one char from the input\r\ninput:function () {\r\n var ch = this._input[0];\r\n this.yytext += ch;\r\n this.yyleng++;\r\n this.offset++;\r\n this.match += ch;\r\n this.matched += ch;\r\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno++;\r\n this.yylloc.last_line++;\r\n } else {\r\n this.yylloc.last_column++;\r\n }\r\n if (this.options.ranges) {\r\n this.yylloc.range[1]++;\r\n }\r\n\r\n this._input = this._input.slice(1);\r\n return ch;\r\n },\r\n\r\n// unshifts one char (or a string) into the input\r\nunput:function (ch) {\r\n var len = ch.length;\r\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\r\n\r\n this._input = ch + this._input;\r\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\r\n //this.yyleng -= len;\r\n this.offset -= len;\r\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\r\n this.match = this.match.substr(0, this.match.length - 1);\r\n this.matched = this.matched.substr(0, this.matched.length - 1);\r\n\r\n if (lines.length - 1) {\r\n this.yylineno -= lines.length - 1;\r\n }\r\n var r = this.yylloc.range;\r\n\r\n this.yylloc = {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.first_column,\r\n last_column: lines ?\r\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\r\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\r\n this.yylloc.first_column - len\r\n };\r\n\r\n if (this.options.ranges) {\r\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\r\n }\r\n this.yyleng = this.yytext.length;\r\n return this;\r\n },\r\n\r\n// When called from action, caches matched text and appends it on next action\r\nmore:function () {\r\n this._more = true;\r\n return this;\r\n },\r\n\r\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\r\nreject:function () {\r\n if (this.options.backtrack_lexer) {\r\n this._backtrack = true;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n\r\n }\r\n return this;\r\n },\r\n\r\n// retain first n characters of the match\r\nless:function (n) {\r\n this.unput(this.match.slice(n));\r\n },\r\n\r\n// displays already matched input, i.e. for error messages\r\npastInput:function () {\r\n var past = this.matched.substr(0, this.matched.length - this.match.length);\r\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays upcoming input, i.e. for error messages\r\nupcomingInput:function () {\r\n var next = this.match;\r\n if (next.length < 20) {\r\n next += this._input.substr(0, 20-next.length);\r\n }\r\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\r\n },\r\n\r\n// displays the character position where the lexing error occurred, i.e. for error messages\r\nshowPosition:function () {\r\n var pre = this.pastInput();\r\n var c = new Array(pre.length + 1).join(\"-\");\r\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\r\n },\r\n\r\n// test the lexed token: return FALSE when not a match, otherwise return token\r\ntest_match:function (match, indexed_rule) {\r\n var token,\r\n lines,\r\n backup;\r\n\r\n if (this.options.backtrack_lexer) {\r\n // save context\r\n backup = {\r\n yylineno: this.yylineno,\r\n yylloc: {\r\n first_line: this.yylloc.first_line,\r\n last_line: this.last_line,\r\n first_column: this.yylloc.first_column,\r\n last_column: this.yylloc.last_column\r\n },\r\n yytext: this.yytext,\r\n match: this.match,\r\n matches: this.matches,\r\n matched: this.matched,\r\n yyleng: this.yyleng,\r\n offset: this.offset,\r\n _more: this._more,\r\n _input: this._input,\r\n yy: this.yy,\r\n conditionStack: this.conditionStack.slice(0),\r\n done: this.done\r\n };\r\n if (this.options.ranges) {\r\n backup.yylloc.range = this.yylloc.range.slice(0);\r\n }\r\n }\r\n\r\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\r\n if (lines) {\r\n this.yylineno += lines.length;\r\n }\r\n this.yylloc = {\r\n first_line: this.yylloc.last_line,\r\n last_line: this.yylineno + 1,\r\n first_column: this.yylloc.last_column,\r\n last_column: lines ?\r\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\r\n this.yylloc.last_column + match[0].length\r\n };\r\n this.yytext += match[0];\r\n this.match += match[0];\r\n this.matches = match;\r\n this.yyleng = this.yytext.length;\r\n if (this.options.ranges) {\r\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\r\n }\r\n this._more = false;\r\n this._backtrack = false;\r\n this._input = this._input.slice(match[0].length);\r\n this.matched += match[0];\r\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\r\n if (this.done && this._input) {\r\n this.done = false;\r\n }\r\n if (token) {\r\n return token;\r\n } else if (this._backtrack) {\r\n // recover context\r\n for (var k in backup) {\r\n this[k] = backup[k];\r\n }\r\n return false; // rule action called reject() implying the next rule should be tested instead.\r\n }\r\n return false;\r\n },\r\n\r\n// return next match in input\r\nnext:function () {\r\n if (this.done) {\r\n return this.EOF;\r\n }\r\n if (!this._input) {\r\n this.done = true;\r\n }\r\n\r\n var token,\r\n match,\r\n tempMatch,\r\n index;\r\n if (!this._more) {\r\n this.yytext = '';\r\n this.match = '';\r\n }\r\n var rules = this._currentRules();\r\n for (var i = 0; i < rules.length; i++) {\r\n tempMatch = this._input.match(this.rules[rules[i]]);\r\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\r\n match = tempMatch;\r\n index = i;\r\n if (this.options.backtrack_lexer) {\r\n token = this.test_match(tempMatch, rules[i]);\r\n if (token !== false) {\r\n return token;\r\n } else if (this._backtrack) {\r\n match = false;\r\n continue; // rule action called reject() implying a rule MISmatch.\r\n } else {\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n } else if (!this.options.flex) {\r\n break;\r\n }\r\n }\r\n }\r\n if (match) {\r\n token = this.test_match(match, rules[index]);\r\n if (token !== false) {\r\n return token;\r\n }\r\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\r\n return false;\r\n }\r\n if (this._input === \"\") {\r\n return this.EOF;\r\n } else {\r\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\r\n text: \"\",\r\n token: null,\r\n line: this.yylineno\r\n });\r\n }\r\n },\r\n\r\n// return next match that has a token\r\nlex:function lex() {\r\n var r = this.next();\r\n if (r) {\r\n return r;\r\n } else {\r\n return this.lex();\r\n }\r\n },\r\n\r\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\r\nbegin:function begin(condition) {\r\n this.conditionStack.push(condition);\r\n },\r\n\r\n// pop the previously active lexer condition state off the condition stack\r\npopState:function popState() {\r\n var n = this.conditionStack.length - 1;\r\n if (n > 0) {\r\n return this.conditionStack.pop();\r\n } else {\r\n return this.conditionStack[0];\r\n }\r\n },\r\n\r\n// produce the lexer rule set which is active for the currently active lexer condition state\r\n_currentRules:function _currentRules() {\r\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\r\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\r\n } else {\r\n return this.conditions[\"INITIAL\"].rules;\r\n }\r\n },\r\n\r\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\r\ntopState:function topState(n) {\r\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\r\n if (n >= 0) {\r\n return this.conditionStack[n];\r\n } else {\r\n return \"INITIAL\";\r\n }\r\n },\r\n\r\n// alias for begin(condition)\r\npushState:function pushState(condition) {\r\n this.begin(condition);\r\n },\r\n\r\n// return the number of states currently on the stack\r\nstateStackSize:function stateStackSize() {\r\n return this.conditionStack.length;\r\n },\r\noptions: {\"case-insensitive\":true},\r\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\r\nvar YYSTATE=YY_START;\r\nswitch($avoiding_name_collisions) {\r\ncase 0:/* skip whitespace */\r\nbreak;\r\ncase 1:return 20;\r\nbreak;\r\ncase 2:return 7;\r\nbreak;\r\ncase 3:return 8;\r\nbreak;\r\ncase 4:return 9;\r\nbreak;\r\ncase 5:return 12;\r\nbreak;\r\ncase 6:return 16;\r\nbreak;\r\ncase 7:return 14;\r\nbreak;\r\ncase 8:return 10;\r\nbreak;\r\ncase 9:return 11;\r\nbreak;\r\ncase 10:return 19;\r\nbreak;\r\ncase 11:return 21;\r\nbreak;\r\ncase 12:return '<=';\r\nbreak;\r\ncase 13:return '>=';\r\nbreak;\r\ncase 14:return '<';\r\nbreak;\r\ncase 15:return '>';\r\nbreak;\r\ncase 16:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 24;\r\nbreak;\r\ncase 17:return 13;\r\nbreak;\r\ncase 18:return 23;\r\nbreak;\r\ncase 19:return 5;\r\nbreak;\r\ncase 20:return 'INVALID';\r\nbreak;\r\n}\r\n},\r\nrules: [/^(?:\\s+)/i,/^(?:(-?(?:[1-9][0-9]+|[0-9]))\\b)/i,/^(?:OR\\b)/i,/^(?:AND\\b)/i,/^(?:NOT\\b)/i,/^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\\b)/i,/^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\\b)/i,/^(?:((SERIAL|SEQUENCE|RESIDX))\\b)/i,/^(?:\\()/i,/^(?:\\))/i,/^(?:,)/i,/^(?::)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:((?:\"(?:\\\\.|[^\\\\\"])*\"|'(?:\\\\.|[^\\\\'])*')))/i,/^(?:(@[_A-Z0-9]+))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:.)/i],\r\nconditions: {\"INITIAL\":{\"rules\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],\"inclusive\":true}}\r\n});\r\nreturn lexer;\r\n})();\r\nparser.lexer = lexer;\r\nfunction Parser () {\r\n this.yy = {};\r\n}\r\nParser.prototype = parser;parser.Parser = Parser;\r\nreturn new Parser;\r\n})();\r\n\r\nmodule.exports = {parser: parser};\r\n","\r\n/*\r\nSmooth.js version 0.1.7\r\n\r\nTurn arrays into smooth functions.\r\n\r\nCopyright 2012 Spencer Cohen\r\nLicensed under MIT license (see \"Smooth.js MIT license.txt\")\r\n*/\r\n\r\n/*Constants (these are accessible by Smooth.WHATEVER in user space)\r\n*/\r\n\r\n(function() {\r\n var AbstractInterpolator, CubicInterpolator, Enum, LinearInterpolator, NearestInterpolator, PI, SincFilterInterpolator, Smooth, clipClamp, clipMirror, clipPeriodic, defaultConfig, getColumn, getType, isValidNumber, k, makeLanczosWindow, makeScaledFunction, makeSincKernel, normalizeScaleTo, shallowCopy, sin, sinc, v, validateNumber, validateVector,\r\n __hasProp = Object.prototype.hasOwnProperty,\r\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };\r\n\r\n Enum = {\r\n /*Interpolation methods\r\n */\r\n METHOD_NEAREST: 'nearest',\r\n METHOD_LINEAR: 'linear',\r\n METHOD_CUBIC: 'cubic',\r\n METHOD_LANCZOS: 'lanczos',\r\n METHOD_SINC: 'sinc',\r\n /*Input clipping modes\r\n */\r\n CLIP_CLAMP: 'clamp',\r\n CLIP_ZERO: 'zero',\r\n CLIP_PERIODIC: 'periodic',\r\n CLIP_MIRROR: 'mirror',\r\n /* Constants for control over the cubic interpolation tension\r\n */\r\n CUBIC_TENSION_DEFAULT: 0,\r\n CUBIC_TENSION_CATMULL_ROM: 0\r\n };\r\n\r\n defaultConfig = {\r\n method: Enum.METHOD_CUBIC,\r\n cubicTension: Enum.CUBIC_TENSION_DEFAULT,\r\n clip: Enum.CLIP_CLAMP,\r\n scaleTo: 0,\r\n sincFilterSize: 2,\r\n sincWindow: void 0\r\n };\r\n\r\n /*Index clipping functions\r\n */\r\n\r\n clipClamp = function(i, n) {\r\n return Math.max(0, Math.min(i, n - 1));\r\n };\r\n\r\n clipPeriodic = function(i, n) {\r\n i = i % n;\r\n if (i < 0) i += n;\r\n return i;\r\n };\r\n\r\n clipMirror = function(i, n) {\r\n var period;\r\n period = 2 * (n - 1);\r\n i = clipPeriodic(i, period);\r\n if (i > n - 1) i = period - i;\r\n return i;\r\n };\r\n\r\n /*\r\n Abstract scalar interpolation class which provides common functionality for all interpolators\r\n \r\n Subclasses must override interpolate().\r\n */\r\n\r\n AbstractInterpolator = (function() {\r\n\r\n function AbstractInterpolator(array, config) {\r\n this.array = array.slice(0);\r\n this.length = this.array.length;\r\n if (!(this.clipHelper = {\r\n clamp: this.clipHelperClamp,\r\n zero: this.clipHelperZero,\r\n periodic: this.clipHelperPeriodic,\r\n mirror: this.clipHelperMirror\r\n }[config.clip])) {\r\n throw \"Invalid clip: \" + config.clip;\r\n }\r\n }\r\n\r\n AbstractInterpolator.prototype.getClippedInput = function(i) {\r\n if ((0 <= i && i < this.length)) {\r\n return this.array[i];\r\n } else {\r\n return this.clipHelper(i);\r\n }\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperClamp = function(i) {\r\n return this.array[clipClamp(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperZero = function(i) {\r\n return 0;\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperPeriodic = function(i) {\r\n return this.array[clipPeriodic(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.clipHelperMirror = function(i) {\r\n return this.array[clipMirror(i, this.length)];\r\n };\r\n\r\n AbstractInterpolator.prototype.interpolate = function(t) {\r\n throw 'Subclasses of AbstractInterpolator must override the interpolate() method.';\r\n };\r\n\r\n return AbstractInterpolator;\r\n\r\n })();\r\n\r\n NearestInterpolator = (function(_super) {\r\n\r\n __extends(NearestInterpolator, _super);\r\n\r\n function NearestInterpolator() {\r\n NearestInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n NearestInterpolator.prototype.interpolate = function(t) {\r\n return this.getClippedInput(Math.round(t));\r\n };\r\n\r\n return NearestInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n LinearInterpolator = (function(_super) {\r\n\r\n __extends(LinearInterpolator, _super);\r\n\r\n function LinearInterpolator() {\r\n LinearInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n LinearInterpolator.prototype.interpolate = function(t) {\r\n var k;\r\n k = Math.floor(t);\r\n t -= k;\r\n return (1 - t) * this.getClippedInput(k) + t * this.getClippedInput(k + 1);\r\n };\r\n\r\n return LinearInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n CubicInterpolator = (function(_super) {\r\n\r\n __extends(CubicInterpolator, _super);\r\n\r\n function CubicInterpolator(array, config) {\r\n this.tangentFactor = 1 - Math.max(-1, Math.min(1, config.cubicTension));\r\n CubicInterpolator.__super__.constructor.apply(this, arguments);\r\n }\r\n\r\n CubicInterpolator.prototype.getTangent = function(k) {\r\n return this.tangentFactor * (this.getClippedInput(k + 1) - this.getClippedInput(k - 1)) / 2;\r\n };\r\n\r\n CubicInterpolator.prototype.interpolate = function(t) {\r\n var k, m, p, t2, t3;\r\n k = Math.floor(t);\r\n m = [this.getTangent(k), this.getTangent(k + 1)];\r\n p = [this.getClippedInput(k), this.getClippedInput(k + 1)];\r\n t -= k;\r\n t2 = t * t;\r\n t3 = t * t2;\r\n return (2 * t3 - 3 * t2 + 1) * p[0] + (t3 - 2 * t2 + t) * m[0] + (-2 * t3 + 3 * t2) * p[1] + (t3 - t2) * m[1];\r\n };\r\n\r\n return CubicInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n sin = Math.sin, PI = Math.PI;\r\n\r\n sinc = function(x) {\r\n if (x === 0) {\r\n return 1;\r\n } else {\r\n return sin(PI * x) / (PI * x);\r\n }\r\n };\r\n\r\n makeLanczosWindow = function(a) {\r\n return function(x) {\r\n return sinc(x / a);\r\n };\r\n };\r\n\r\n makeSincKernel = function(window) {\r\n return function(x) {\r\n return sinc(x) * window(x);\r\n };\r\n };\r\n\r\n SincFilterInterpolator = (function(_super) {\r\n\r\n __extends(SincFilterInterpolator, _super);\r\n\r\n function SincFilterInterpolator(array, config) {\r\n SincFilterInterpolator.__super__.constructor.apply(this, arguments);\r\n this.a = config.sincFilterSize;\r\n if (!config.sincWindow) throw 'No sincWindow provided';\r\n this.kernel = makeSincKernel(config.sincWindow);\r\n }\r\n\r\n SincFilterInterpolator.prototype.interpolate = function(t) {\r\n var k, n, sum, _ref, _ref2;\r\n k = Math.floor(t);\r\n sum = 0;\r\n for (n = _ref = k - this.a + 1, _ref2 = k + this.a; _ref <= _ref2 ? n <= _ref2 : n >= _ref2; _ref <= _ref2 ? n++ : n--) {\r\n sum += this.kernel(t - n) * this.getClippedInput(n);\r\n }\r\n return sum;\r\n };\r\n\r\n return SincFilterInterpolator;\r\n\r\n })(AbstractInterpolator);\r\n\r\n getColumn = function(arr, i) {\r\n var row, _i, _len, _results;\r\n _results = [];\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n row = arr[_i];\r\n _results.push(row[i]);\r\n }\r\n return _results;\r\n };\r\n\r\n makeScaledFunction = function(f, baseScale, scaleRange) {\r\n var scaleFactor, translation;\r\n if (scaleRange.join === '0,1') {\r\n return f;\r\n } else {\r\n scaleFactor = baseScale / (scaleRange[1] - scaleRange[0]);\r\n translation = scaleRange[0];\r\n return function(t) {\r\n return f(scaleFactor * (t - translation));\r\n };\r\n }\r\n };\r\n\r\n getType = function(x) {\r\n return Object.prototype.toString.call(x).slice('[object '.length, -1);\r\n };\r\n\r\n validateNumber = function(n) {\r\n if (isNaN(n)) throw 'NaN in Smooth() input';\r\n if (getType(n) !== 'Number') throw 'Non-number in Smooth() input';\r\n if (!isFinite(n)) throw 'Infinity in Smooth() input';\r\n };\r\n\r\n validateVector = function(v, dimension) {\r\n var n, _i, _len;\r\n if (getType(v) !== 'Array') throw 'Non-vector in Smooth() input';\r\n if (v.length !== dimension) throw 'Inconsistent dimension in Smooth() input';\r\n for (_i = 0, _len = v.length; _i < _len; _i++) {\r\n n = v[_i];\r\n validateNumber(n);\r\n }\r\n };\r\n\r\n isValidNumber = function(n) {\r\n return (getType(n) === 'Number') && isFinite(n) && !isNaN(n);\r\n };\r\n\r\n normalizeScaleTo = function(s) {\r\n var invalidErr;\r\n invalidErr = \"scaleTo param must be number or array of two numbers\";\r\n switch (getType(s)) {\r\n case 'Number':\r\n if (!isValidNumber(s)) throw invalidErr;\r\n s = [0, s];\r\n break;\r\n case 'Array':\r\n if (s.length !== 2) throw invalidErr;\r\n if (!(isValidNumber(s[0]) && isValidNumber(s[1]))) throw invalidErr;\r\n break;\r\n default:\r\n throw invalidErr;\r\n }\r\n return s;\r\n };\r\n\r\n shallowCopy = function(obj) {\r\n var copy, k, v;\r\n copy = {};\r\n for (k in obj) {\r\n if (!__hasProp.call(obj, k)) continue;\r\n v = obj[k];\r\n copy[k] = v;\r\n }\r\n return copy;\r\n };\r\n\r\n Smooth = function(arr, config) {\r\n var baseDomainEnd, dimension, i, interpolator, interpolatorClass, interpolators, k, n, properties, smoothFunc, v;\r\n if (config == null) config = {};\r\n properties = {};\r\n config = shallowCopy(config);\r\n properties.config = shallowCopy(config);\r\n if (config.scaleTo == null) config.scaleTo = config.period;\r\n if (config.sincFilterSize == null) {\r\n config.sincFilterSize = config.lanczosFilterSize;\r\n }\r\n for (k in defaultConfig) {\r\n if (!__hasProp.call(defaultConfig, k)) continue;\r\n v = defaultConfig[k];\r\n if (config[k] == null) config[k] = v;\r\n }\r\n if (!(interpolatorClass = {\r\n nearest: NearestInterpolator,\r\n linear: LinearInterpolator,\r\n cubic: CubicInterpolator,\r\n lanczos: SincFilterInterpolator,\r\n sinc: SincFilterInterpolator\r\n }[config.method])) {\r\n throw \"Invalid method: \" + config.method;\r\n }\r\n if (config.method === 'lanczos') {\r\n config.sincWindow = makeLanczosWindow(config.sincFilterSize);\r\n }\r\n if (arr.length < 2) throw 'Array must have at least two elements';\r\n properties.count = arr.length;\r\n smoothFunc = (function() {\r\n var _i, _j, _len, _len2;\r\n switch (getType(arr[0])) {\r\n case 'Number':\r\n properties.dimension = 'scalar';\r\n if (Smooth.deepValidation) {\r\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\r\n n = arr[_i];\r\n validateNumber(n);\r\n }\r\n }\r\n interpolator = new interpolatorClass(arr, config);\r\n return function(t) {\r\n return interpolator.interpolate(t);\r\n };\r\n case 'Array':\r\n properties.dimension = dimension = arr[0].length;\r\n if (!dimension) throw 'Vectors must be non-empty';\r\n if (Smooth.deepValidation) {\r\n for (_j = 0, _len2 = arr.length; _j < _len2; _j++) {\r\n v = arr[_j];\r\n validateVector(v, dimension);\r\n }\r\n }\r\n interpolators = (function() {\r\n var _results;\r\n _results = [];\r\n for (i = 0; 0 <= dimension ? i < dimension : i > dimension; 0 <= dimension ? i++ : i--) {\r\n _results.push(new interpolatorClass(getColumn(arr, i), config));\r\n }\r\n return _results;\r\n })();\r\n return function(t) {\r\n var interpolator, _k, _len3, _results;\r\n _results = [];\r\n for (_k = 0, _len3 = interpolators.length; _k < _len3; _k++) {\r\n interpolator = interpolators[_k];\r\n _results.push(interpolator.interpolate(t));\r\n }\r\n return _results;\r\n };\r\n default:\r\n throw \"Invalid element type: \" + (getType(arr[0]));\r\n }\r\n })();\r\n if (config.clip === 'periodic') {\r\n baseDomainEnd = arr.length;\r\n } else {\r\n baseDomainEnd = arr.length - 1;\r\n }\r\n config.scaleTo || (config.scaleTo = baseDomainEnd);\r\n properties.domain = normalizeScaleTo(config.scaleTo);\r\n smoothFunc = makeScaledFunction(smoothFunc, baseDomainEnd, properties.domain);\r\n properties.domain.sort();\r\n /*copy properties\r\n */\r\n for (k in properties) {\r\n if (!__hasProp.call(properties, k)) continue;\r\n v = properties[k];\r\n smoothFunc[k] = v;\r\n }\r\n return smoothFunc;\r\n };\r\n\r\n for (k in Enum) {\r\n if (!__hasProp.call(Enum, k)) continue;\r\n v = Enum[k];\r\n Smooth[k] = v;\r\n }\r\n\r\n Smooth.deepValidation = true;\r\n\r\n (typeof exports !== \"undefined\" && exports !== null ? exports : window).Smooth = Smooth;\r\n\r\n}).call(this);\r\n","!function(r,t){if(\"function\"==typeof define&&define.amd)define([\"exports\"],t);else if(\"object\"==typeof exports&&\"undefined\"!=typeof module)t(exports);else t(r.MMTF=r.MMTF||{})}(this,function(r){\"use strict\";function t(r,t,n){for(var e=(r.byteLength,0),i=n.length;i>e;e++){var o=n.charCodeAt(e);if(128>o)r.setUint8(t++,o>>>0&127|0);else if(2048>o)r.setUint8(t++,o>>>6&31|192),r.setUint8(t++,o>>>0&63|128);else if(65536>o)r.setUint8(t++,o>>>12&15|224),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128);else{if(!(1114112>o))throw new Error(\"bad codepoint \"+o);r.setUint8(t++,o>>>18&7|240),r.setUint8(t++,o>>>12&63|128),r.setUint8(t++,o>>>6&63|128),r.setUint8(t++,o>>>0&63|128)}}}function n(r){for(var t=0,n=0,e=r.length;e>n;n++){var i=r.charCodeAt(n);if(128>i)t+=1;else if(2048>i)t+=2;else if(65536>i)t+=3;else{if(!(1114112>i))throw new Error(\"bad codepoint \"+i);t+=4}}return t}function e(r,i,o){var a=typeof r;if(\"string\"===a){var u=n(r);if(32>u)return i.setUint8(o,160|u),t(i,o+1,r),1+u;if(256>u)return i.setUint8(o,217),i.setUint8(o+1,u),t(i,o+2,r),2+u;if(65536>u)return i.setUint8(o,218),i.setUint16(o+1,u),t(i,o+3,r),3+u;if(4294967296>u)return i.setUint8(o,219),i.setUint32(o+1,u),t(i,o+5,r),5+u}if(r instanceof Uint8Array){var u=r.byteLength,s=new Uint8Array(i.buffer);if(256>u)return i.setUint8(o,196),i.setUint8(o+1,u),s.set(r,o+2),2+u;if(65536>u)return i.setUint8(o,197),i.setUint16(o+1,u),s.set(r,o+3),3+u;if(4294967296>u)return i.setUint8(o,198),i.setUint32(o+1,u),s.set(r,o+5),5+u}if(\"number\"===a){if(!isFinite(r))throw new Error(\"Number not finite: \"+r);if(Math.floor(r)!==r)return i.setUint8(o,203),i.setFloat64(o+1,r),9;if(r>=0){if(128>r)return i.setUint8(o,r),1;if(256>r)return i.setUint8(o,204),i.setUint8(o+1,r),2;if(65536>r)return i.setUint8(o,205),i.setUint16(o+1,r),3;if(4294967296>r)return i.setUint8(o,206),i.setUint32(o+1,r),5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return i.setInt8(o,r),1;if(r>=-128)return i.setUint8(o,208),i.setInt8(o+1,r),2;if(r>=-32768)return i.setUint8(o,209),i.setInt16(o+1,r),3;if(r>=-2147483648)return i.setUint8(o,210),i.setInt32(o+1,r),5;throw new Error(\"Number too small -0x\"+(-r).toString(16).substr(1))}if(null===r)return i.setUint8(o,192),1;if(\"boolean\"===a)return i.setUint8(o,r?195:194),1;if(\"object\"===a){var u,f=0,c=Array.isArray(r);if(c)u=r.length;else{var d=Object.keys(r);u=d.length}var f;if(16>u?(i.setUint8(o,u|(c?144:128)),f=1):65536>u?(i.setUint8(o,c?220:222),i.setUint16(o+1,u),f=3):4294967296>u&&(i.setUint8(o,c?221:223),i.setUint32(o+1,u),f=5),c)for(var l=0;u>l;l++)f+=e(r[l],i,o+f);else for(var l=0;u>l;l++){var v=d[l];f+=e(v,i,o+f),f+=e(r[v],i,o+f)}return f}throw new Error(\"Unknown type \"+a)}function i(r){var t=typeof r;if(\"string\"===t){var e=n(r);if(32>e)return 1+e;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(r instanceof Uint8Array){var e=r.byteLength;if(256>e)return 2+e;if(65536>e)return 3+e;if(4294967296>e)return 5+e}if(\"number\"===t){if(Math.floor(r)!==r)return 9;if(r>=0){if(128>r)return 1;if(256>r)return 2;if(65536>r)return 3;if(4294967296>r)return 5;throw new Error(\"Number too big 0x\"+r.toString(16))}if(r>=-32)return 1;if(r>=-128)return 2;if(r>=-32768)return 3;if(r>=-2147483648)return 5;throw new Error(\"Number too small -0x\"+r.toString(16).substr(1))}if(\"boolean\"===t||null===r)return 1;if(\"object\"===t){var e,o=0;if(Array.isArray(r)){e=r.length;for(var a=0;e>a;a++)o+=i(r[a])}else{var u=Object.keys(r);e=u.length;for(var a=0;e>a;a++){var s=u[a];o+=i(s)+i(r[s])}}if(16>e)return 1+o;if(65536>e)return 3+o;if(4294967296>e)return 5+o;throw new Error(\"Array or object too long 0x\"+e.toString(16))}throw new Error(\"Unknown type \"+t)}function o(r){var t=new ArrayBuffer(i(r)),n=new DataView(t);return e(r,n,0),new Uint8Array(t)}function a(r,t,n){return t?new r(t.buffer,t.byteOffset,t.byteLength/(n||1)):void 0}function u(r){return a(DataView,r)}function s(r){return a(Uint8Array,r)}function f(r){return a(Int8Array,r)}function c(r){return a(Int32Array,r,4)}function d(r){return a(Float32Array,r,4)}function l(r,t){var n=r.length/2;t||(t=new Int16Array(n));for(var e=0,i=0;n>e;++e,i+=2)t[e]=r[i]<<8^r[i+1]<<0;return t}function v(r,t){var n=r.length;t||(t=new Uint8Array(2*n));for(var e=u(t),i=0;n>i;++i)e.setInt16(2*i,r[i]);return s(t)}function g(r,t){var n=r.length/4;t||(t=new Int32Array(n));for(var e=0,i=0;n>e;++e,i+=4)t[e]=r[i]<<24^r[i+1]<<16^r[i+2]<<8^r[i+3]<<0;return t}function L(r,t){var n=r.length;t||(t=new Uint8Array(4*n));for(var e=u(t),i=0;n>i;++i)e.setInt32(4*i,r[i]);return s(t)}function h(r,t){var n=r.length;t||(t=new Float32Array(n/4));for(var e=u(t),i=u(r),o=0,a=0,s=n/4;s>o;++o,a+=4)e.setFloat32(a,i.getFloat32(a),!0);return t}function y(r,t,n){var e=r.length,i=1/t;n||(n=new Float32Array(e));for(var o=0;e>o;++o)n[o]=r[o]*i;return n}function m(r,t,n){var e=r.length;n||(n=new Int32Array(e));for(var i=0;e>i;++i)n[i]=Math.round(r[i]*t);return n}function p(r,t){var n,e;if(!t){var i=0;for(n=0,e=r.length;e>n;n+=2)i+=r[n+1];t=new r.constructor(i)}var o=0;for(n=0,e=r.length;e>n;n+=2)for(var a=r[n],u=r[n+1],s=0;u>s;++s)t[o]=a,++o;return t}function U(r){if(0===r.length)return new Int32Array;var t,n,e=2;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]&&(e+=2);var i=new Int32Array(e),o=0,a=1;for(t=1,n=r.length;n>t;++t)r[t-1]!==r[t]?(i[o]=r[t-1],i[o+1]=a,a=1,o+=2):++a;return i[o]=r[r.length-1],i[o+1]=a,i}function b(r,t){var n=r.length;t||(t=new r.constructor(n)),n&&(t[0]=r[0]);for(var e=1;n>e;++e)t[e]=r[e]+t[e-1];return t}function I(r,t){var n=r.length;t||(t=new r.constructor(n)),t[0]=r[0];for(var e=1;n>e;++e)t[e]=r[e]-r[e-1];return t}function w(r,t){var n,e,i=r instanceof Int8Array?127:32767,o=-i-1,a=r.length;if(!t){var u=0;for(n=0;a>n;++n)r[n]o&&++u;t=new Int32Array(u)}for(n=0,e=0;a>n;){for(var s=0;r[n]===i||r[n]===o;)s+=r[n],++n;s+=r[n],++n,t[e]=s,++e}return t}function C(r,t){var n,e=t?127:32767,i=-e-1,o=r.length,a=0;for(n=0;o>n;++n){var u=r[n];0===u?++a:a+=u===e||u===i?2:u>0?Math.ceil(u/e):Math.ceil(u/i)}var s=t?new Int8Array(a):new Int16Array(a),f=0;for(n=0;o>n;++n){var u=r[n];if(u>=0)for(;u>=e;)s[f]=e,++f,u-=e;else for(;i>=u;)s[f]=i,++f,u-=i;s[f]=u,++f}return s}function A(r,t){return b(p(r),t)}function x(r){return U(I(r))}function M(r,t,n){return y(p(r,c(n)),t,n)}function F(r,t){return U(m(r,t))}function S(r,t,n){return y(b(r,c(n)),t,n)}function E(r,t,n){return I(m(r,t),n)}function N(r,t,n){return y(w(r,c(n)),t,n)}function O(r,t,n){var e=w(r,c(n));return S(e,t,d(e))}function T(r,t,n){return C(E(r,t),n)}function k(r){var t=u(r),n=t.getInt32(0),e=t.getInt32(4),i=r.subarray(8,12),r=r.subarray(12);return[n,r,e,i]}function j(r,t,n,e){var i=new ArrayBuffer(12+e.byteLength),o=new Uint8Array(i),a=new DataView(i);return a.setInt32(0,r),a.setInt32(4,t),n&&o.set(n,8),o.set(e,12),o}function q(r){var t=r.length,n=s(r);return j(2,t,void 0,n)}function D(r){var t=r.length,n=L(r);return j(4,t,void 0,n)}function P(r,t){var n=r.length/t,e=L([t]),i=s(r);return j(5,n,e,i)}function z(r){var t=r.length,n=L(U(r));return j(6,t,void 0,n)}function B(r){var t=r.length,n=L(x(r));return j(8,t,void 0,n)}function V(r,t){var n=r.length,e=L([t]),i=L(F(r,t));return j(9,n,e,i)}function G(r,t){var n=r.length,e=L([t]),i=v(T(r,t));return j(10,n,e,i)}function R(r){var t={};return rr.forEach(function(n){void 0!==r[n]&&(t[n]=r[n])}),r.bondAtomList&&(t.bondAtomList=D(r.bondAtomList)),r.bondOrderList&&(t.bondOrderList=q(r.bondOrderList)),t.xCoordList=G(r.xCoordList,1e3),t.yCoordList=G(r.yCoordList,1e3),t.zCoordList=G(r.zCoordList,1e3),r.bFactorList&&(t.bFactorList=G(r.bFactorList,100)),r.atomIdList&&(t.atomIdList=B(r.atomIdList)),r.altLocList&&(t.altLocList=z(r.altLocList)),r.occupancyList&&(t.occupancyList=V(r.occupancyList,100)),t.groupIdList=B(r.groupIdList),t.groupTypeList=D(r.groupTypeList),r.secStructList&&(t.secStructList=q(r.secStructList,1)),r.insCodeList&&(t.insCodeList=z(r.insCodeList)),r.sequenceIndexList&&(t.sequenceIndexList=B(r.sequenceIndexList)),t.chainIdList=P(r.chainIdList,4),r.chainNameList&&(t.chainNameList=P(r.chainNameList,4)),t}function H(r){function t(r){for(var t={},n=0;r>n;n++){var e=o();t[e]=o()}return t}function n(t){var n=r.subarray(a,a+t);return a+=t,n}function e(t){var n=r.subarray(a,a+t);a+=t;var e=65535;if(t>e){for(var i=[],o=0;on;n++)t[n]=o();return t}function o(){var o,s,f=r[a];if(0===(128&f))return a++,f;if(128===(240&f))return s=15&f,a++,t(s);if(144===(240&f))return s=15&f,a++,i(s);if(160===(224&f))return s=31&f,a++,e(s);if(224===(224&f))return o=u.getInt8(a),a++,o;switch(f){case 192:return a++,null;case 194:return a++,!1;case 195:return a++,!0;case 196:return s=u.getUint8(a+1),a+=2,n(s);case 197:return s=u.getUint16(a+1),a+=3,n(s);case 198:return s=u.getUint32(a+1),a+=5,n(s);case 202:return o=u.getFloat32(a+1),a+=5,o;case 203:return o=u.getFloat64(a+1),a+=9,o;case 204:return o=r[a+1],a+=2,o;case 205:return o=u.getUint16(a+1),a+=3,o;case 206:return o=u.getUint32(a+1),a+=5,o;case 208:return o=u.getInt8(a+1),a+=2,o;case 209:return o=u.getInt16(a+1),a+=3,o;case 210:return o=u.getInt32(a+1),a+=5,o;case 217:return s=u.getUint8(a+1),a+=2,e(s);case 218:return s=u.getUint16(a+1),a+=3,e(s);case 219:return s=u.getUint32(a+1),a+=5,e(s);case 220:return s=u.getUint16(a+1),a+=3,i(s);case 221:return s=u.getUint32(a+1),a+=5,i(s);case 222:return s=u.getUint16(a+1),a+=3,t(s);case 223:return s=u.getUint32(a+1),a+=5,t(s)}throw new Error(\"Unknown type 0x\"+f.toString(16))}var a=0,u=new DataView(r.buffer);return o()}function W(r,t,n,e){switch(r){case 1:return h(t);case 2:return f(t);case 3:return l(t);case 4:return g(t);case 5:return s(t);case 6:return p(g(t),new Uint8Array(n));case 7:return p(g(t));case 8:return A(g(t));case 9:return M(g(t),g(e)[0]);case 10:return O(l(t),g(e)[0]);case 11:return y(l(t),g(e)[0]);case 12:return N(l(t),g(e)[0]);case 13:return N(f(t),g(e)[0]);case 14:return w(l(t));case 15:return w(f(t))}}function X(r,t){t=t||{};var n=t.ignoreFields,e={};return nr.forEach(function(t){var i=n?-1!==n.indexOf(t):!1,o=r[t];i||void 0===o||(o instanceof Uint8Array?e[t]=W.apply(null,k(o)):e[t]=o)}),e}function J(r){return String.fromCharCode.apply(null,r).replace(/\\0/g,\"\")}function K(r,t,n){n=n||{};var e,i,o,a,u,s,f=n.firstModelOnly,c=t.onModel,d=t.onChain,l=t.onGroup,v=t.onAtom,g=t.onBond,L=0,h=0,y=0,m=0,p=0,U=-1,b=r.chainNameList,I=r.secStructList,w=r.insCodeList,C=r.sequenceIndexList,A=r.atomIdList,x=r.bFactorList,M=r.altLocList,F=r.occupancyList,S=r.bondAtomList,E=r.bondOrderList;for(e=0,i=r.chainsPerModel.length;i>e&&!(f&&L>0);++e){var N=r.chainsPerModel[L];for(c&&c({chainCount:N,modelIndex:L}),o=0;N>o;++o){var O=r.groupsPerChain[h];if(d){var T=J(r.chainIdList.subarray(4*h,4*h+4)),k=null;b&&(k=J(b.subarray(4*h,4*h+4))),d({groupCount:O,chainIndex:h,modelIndex:L,chainId:T,chainName:k})}for(a=0;O>a;++a){var j=r.groupList[r.groupTypeList[y]],q=j.atomNameList.length;if(l){var D=null;I&&(D=I[y]);var P=null;r.insCodeList&&(P=String.fromCharCode(w[y]));var z=null;C&&(z=C[y]),l({atomCount:q,groupIndex:y,chainIndex:h,modelIndex:L,groupId:r.groupIdList[y],groupType:r.groupTypeList[y],groupName:j.groupName,singleLetterCode:j.singleLetterCode,chemCompType:j.chemCompType,secStruct:D,insCode:P,sequenceIndex:z})}for(u=0;q>u;++u){if(v){var B=null;A&&(B=A[m]);var V=null;x&&(V=x[m]);var G=null;M&&(G=String.fromCharCode(M[m]));var R=null;F&&(R=F[m]),v({atomIndex:m,groupIndex:y,chainIndex:h,modelIndex:L,atomId:B,element:j.elementList[u],atomName:j.atomNameList[u],formalCharge:j.formalChargeList[u],xCoord:r.xCoordList[m],yCoord:r.yCoordList[m],zCoord:r.zCoordList[m],bFactor:V,altLoc:G,occupancy:R})}m+=1}if(g){var H=j.bondAtomList;for(u=0,s=j.bondOrderList.length;s>u;++u)g({atomIndex1:m-q+H[2*u],atomIndex2:m-q+H[2*u+1],bondOrder:j.bondOrderList[u]})}y+=1}h+=1}if(p=U+1,U=m-1,g&&S)for(u=0,s=S.length;s>u;u+=2){var W=S[u],X=S[u+1];(W>=p&&U>=W||X>=p&&U>=X)&&g({atomIndex1:W,atomIndex2:X,bondOrder:E?E[u/2]:null})}L+=1}}function Q(r){return o(R(r))}function Y(r,t){r instanceof ArrayBuffer&&(r=new Uint8Array(r));var n;return n=r instanceof Uint8Array?H(r):r,X(n,t)}function Z(r,t,n,e){function i(){try{var r=Y(o.response);n(r)}catch(t){e(t)}}var o=new XMLHttpRequest;o.addEventListener(\"load\",i,!0),o.addEventListener(\"error\",e,!0),o.responseType=\"arraybuffer\",o.open(\"GET\",t+r.toUpperCase()),o.send()}function $(r,t,n){Z(r,or,t,n)}function _(r,t,n){Z(r,ar,t,n)}var rr=[\"mmtfVersion\",\"mmtfProducer\",\"unitCell\",\"spaceGroup\",\"structureId\",\"title\",\"depositionDate\",\"releaseDate\",\"experimentalMethods\",\"resolution\",\"rFree\",\"rWork\",\"bioAssemblyList\",\"ncsOperatorList\",\"entityList\",\"groupList\",\"numBonds\",\"numAtoms\",\"numGroups\",\"numChains\",\"numModels\",\"groupsPerChain\",\"chainsPerModel\"],tr=[\"xCoordList\",\"yCoordList\",\"zCoordList\",\"groupIdList\",\"groupTypeList\",\"chainIdList\",\"bFactorList\",\"atomIdList\",\"altLocList\",\"occupancyList\",\"secStructList\",\"insCodeList\",\"sequenceIndexList\",\"chainNameList\",\"bondAtomList\",\"bondOrderList\"],nr=rr.concat(tr),er=\"v1.1.0dev\",ir=\"//mmtf.rcsb.org/v1.0/\",or=ir+\"full/\",ar=ir+\"reduced/\";r.encode=Q,r.decode=Y,r.traverse=K,r.fetch=$,r.fetchReduced=_,r.version=er,r.fetchUrl=or,r.fetchReducedUrl=ar,r.encodeMsgpack=o,r.encodeMmtf=R,r.decodeMsgpack=H,r.decodeMmtf=X});","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var x = (y) => {\n\tvar x = {}; __webpack_require__.d(x, y); return x\n} \nvar y = (x) => (() => (x))\nconst __WEBPACK_NAMESPACE_OBJECT__ = x({ [\"default\"]: () => (__WEBPACK_EXTERNAL_MODULE_lodash__[\"default\"]) });","const __WEBPACK_NAMESPACE_OBJECT__ = __WEBPACK_EXTERNAL_MODULE_three__;","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar defaults = {\n lines: 12,\n length: 7,\n width: 5,\n radius: 10,\n scale: 1.0,\n corners: 1,\n color: '#000',\n fadeColor: 'transparent',\n animation: 'spinner-line-fade-default',\n rotate: 0,\n direction: 1,\n speed: 1,\n zIndex: 2e9,\n className: 'spinner',\n top: '50%',\n left: '50%',\n shadow: '0 0 1px transparent', // prevent aliased lines\n position: 'absolute',\n};\nvar Spinner = /** @class */ (function () {\n function Spinner(opts) {\n if (opts === void 0) { opts = {}; }\n this.opts = __assign(__assign({}, defaults), opts);\n }\n /**\n * Adds the spinner to the given target element. If this instance is already\n * spinning, it is automatically removed from its previous target by calling\n * stop() internally.\n */\n Spinner.prototype.spin = function (target) {\n this.stop();\n this.el = document.createElement('div');\n this.el.className = this.opts.className;\n this.el.setAttribute('role', 'progressbar');\n this.el.style.position = this.opts.position;\n this.el.style.width = \"0\";\n this.el.style.zIndex = this.opts.zIndex.toString();\n this.el.style.left = this.opts.left;\n this.el.style.top = this.opts.top;\n this.el.style.transform = \"scale(\".concat(this.opts.scale, \")\");\n if (target) {\n target.insertBefore(this.el, target.firstChild || null);\n }\n drawLines(this.el, this.opts);\n return this;\n };\n /**\n * Stops and removes the Spinner.\n * Stopped spinners may be reused by calling spin() again.\n */\n Spinner.prototype.stop = function () {\n if (this.el) {\n if (this.el.parentNode) {\n this.el.parentNode.removeChild(this.el);\n }\n this.el = undefined;\n }\n return this;\n };\n return Spinner;\n}());\nexport { Spinner };\n/**\n * Returns the line color from the given string or array.\n */\nfunction getColor(color, idx) {\n return typeof color == 'string' ? color : color[idx % color.length];\n}\n/**\n * Internal method that draws the individual lines.\n */\nfunction drawLines(el, opts) {\n var borderRadius = (Math.round(opts.corners * opts.width * 500) / 1000) + 'px';\n var shadow = 'none';\n if (opts.shadow === true) {\n shadow = '0 2px 4px #000'; // default shadow\n }\n else if (typeof opts.shadow === 'string') {\n shadow = opts.shadow;\n }\n var shadows = parseBoxShadow(shadow);\n for (var i = 0; i < opts.lines; i++) {\n var degrees = ~~(360 / opts.lines * i + opts.rotate);\n var backgroundLine = document.createElement('div');\n backgroundLine.style.position = 'absolute';\n backgroundLine.style.top = \"\".concat(-opts.width / 2, \"px\");\n backgroundLine.style.width = (opts.length + opts.width) + 'px';\n backgroundLine.style.height = opts.width + 'px';\n backgroundLine.style.background = getColor(opts.fadeColor, i);\n backgroundLine.style.borderRadius = borderRadius;\n backgroundLine.style.transformOrigin = 'left';\n backgroundLine.style.transform = \"rotate(\".concat(degrees, \"deg) translateX(\").concat(opts.radius, \"px)\");\n var delay = i * opts.direction / opts.lines / opts.speed;\n delay -= 1 / opts.speed; // so initial animation state will include trail\n var line = document.createElement('div');\n line.style.width = '100%';\n line.style.height = '100%';\n line.style.background = getColor(opts.color, i);\n line.style.borderRadius = borderRadius;\n line.style.boxShadow = normalizeShadow(shadows, degrees);\n line.style.animation = \"\".concat(1 / opts.speed, \"s linear \").concat(delay, \"s infinite \").concat(opts.animation);\n backgroundLine.appendChild(line);\n el.appendChild(backgroundLine);\n }\n}\nfunction parseBoxShadow(boxShadow) {\n var regex = /^\\s*([a-zA-Z]+\\s+)?(-?\\d+(\\.\\d+)?)([a-zA-Z]*)\\s+(-?\\d+(\\.\\d+)?)([a-zA-Z]*)(.*)$/;\n var shadows = [];\n for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) {\n var shadow = _a[_i];\n var matches = shadow.match(regex);\n if (matches === null) {\n continue; // invalid syntax\n }\n var x = +matches[2];\n var y = +matches[5];\n var xUnits = matches[4];\n var yUnits = matches[7];\n if (x === 0 && !xUnits) {\n xUnits = yUnits;\n }\n if (y === 0 && !yUnits) {\n yUnits = xUnits;\n }\n if (xUnits !== yUnits) {\n continue; // units must match to use as coordinates\n }\n shadows.push({\n prefix: matches[1] || '', // could have value of 'inset' or undefined\n x: x,\n y: y,\n xUnits: xUnits,\n yUnits: yUnits,\n end: matches[8],\n });\n }\n return shadows;\n}\n/**\n * Modify box-shadow x/y offsets to counteract rotation\n */\nfunction normalizeShadow(shadows, degrees) {\n var normalized = [];\n for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) {\n var shadow = shadows_1[_i];\n var xy = convertOffset(shadow.x, shadow.y, degrees);\n normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end);\n }\n return normalized.join(', ');\n}\nfunction convertOffset(x, y, degrees) {\n var radians = degrees * Math.PI / 180;\n var sin = Math.sin(radians);\n var cos = Math.cos(radians);\n return [\n Math.round((x * cos + y * sin) * 1000) / 1000,\n Math.round((-x * sin + y * cos) * 1000) / 1000,\n ];\n}\n","//----------------------------------------------------------------------------\r\n// Timer\r\n\r\nexport default class Timer {\r\n constructor() {\r\n this.startTime = 0;\r\n this.oldTime = 0;\r\n this.elapsedTime = 0;\r\n this.running = false;\r\n }\r\n\r\n start() {\r\n this.startTime = Timer.now();\r\n this.oldTime = this.startTime;\r\n this.running = true;\r\n }\r\n\r\n stop() {\r\n this.getElapsedTime();\r\n this.running = false;\r\n }\r\n\r\n getElapsedTime() {\r\n this.update();\r\n return this.elapsedTime;\r\n }\r\n\r\n update() {\r\n let delta = 0;\r\n if (this.running) {\r\n const newTime = Timer.now();\r\n delta = 0.001 * (newTime - this.oldTime);\r\n this.oldTime = newTime;\r\n this.elapsedTime += delta;\r\n }\r\n\r\n return delta;\r\n }\r\n}\r\n\r\nTimer.now = (function () {\r\n const p = typeof window !== 'undefined' && window.performance;\r\n return (p && p.now) ? p.now.bind(p) : Date.now;\r\n}());\r\n","import Timer from '../Timer';\r\n\r\nconst { now } = Timer;\r\n\r\nfunction createElement(tag, id, css) {\r\n const element = document.createElement(tag);\r\n element.id = id;\r\n element.style.cssText = css;\r\n return element;\r\n}\r\n\r\nclass Stats {\r\n constructor() {\r\n this.domElement = createElement('div', 'stats', 'padding:8px');\r\n this._text = createElement('p', 'fps', 'margin:0;color:silver;font-size:large');\r\n this.domElement.appendChild(this._text);\r\n\r\n this._startTime = now();\r\n this._prevTime = this._startTime;\r\n\r\n this._deltas = new Array(20);\r\n this._index = 0;\r\n this._total = 0.0;\r\n this._count = 0;\r\n }\r\n\r\n end() {\r\n const time = now();\r\n const delta = time - this._startTime;\r\n\r\n if (this._count < this._deltas.length) {\r\n this._count++;\r\n } else {\r\n this._total -= this._deltas[this._index];\r\n }\r\n this._total += delta;\r\n this._deltas[this._index] = delta;\r\n this._index = (this._index + 1) % this._deltas.length;\r\n\r\n this.ms = this._total / this._count;\r\n this.fps = 1000 / this.ms;\r\n\r\n if (time > this._prevTime + 1000) {\r\n this._text.textContent = this.fps.toPrecision(2);\r\n this._prevTime = time;\r\n }\r\n\r\n return time;\r\n }\r\n\r\n update() {\r\n this._startTime = this.end();\r\n }\r\n\r\n show(on) {\r\n if (on === undefined) {\r\n on = true;\r\n }\r\n this.domElement.style.display = on ? 'block' : 'none';\r\n }\r\n}\r\n\r\nexport default Stats;\r\n","/**\r\n * This class introduces the simplest event system.\r\n */\r\n\r\nimport _ from 'lodash';\r\n\r\nfunction isUndefOrEqual(param, value) {\r\n return !param || param === value;\r\n}\r\n\r\n/**\r\n * Creates empty dispatcher.\r\n *\r\n * @exports EventDispatcher\r\n * @constructor\r\n */\r\nfunction EventDispatcher() {\r\n this._handlers = {};\r\n}\r\n\r\n/**\r\n * Binds callback on specific event type. Optional `context` parameter\r\n * could be used as 'this' for the `callback`.\r\n * @param {string} type Event name.\r\n * @param {function} callback Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.addEventListener = function (type, callback, context) {\r\n let handlers = this._handlers[type];\r\n\r\n if (!handlers) {\r\n this._handlers[type] = [];\r\n handlers = this._handlers[type];\r\n }\r\n\r\n const params = [callback, context];\r\n function _checkPar(par) {\r\n return par[0] === params[0] && par[1] === params[1];\r\n }\r\n\r\n if (_.find(handlers, _checkPar) === undefined) {\r\n handlers.push(params);\r\n }\r\n};\r\n\r\n/**\r\n * Removes a previously-bound callback function from an object.\r\n * If no `context` is specified, all versions of the `callback` with different\r\n * contexts will be removed.\r\n * If no `callback` is specified, all callbacks of the `type` will be removed.\r\n * If no `type` is specified, callbacks for all events will be removed.\r\n * @param {?string} [type] Event type.\r\n * @param {function} [callback] Callback function.\r\n * @param {Object} [context] 'This' object for the callback.\r\n */\r\nEventDispatcher.prototype.removeEventListener = function (type, callback, context) {\r\n const self = this;\r\n _.forEach(self._handlers, (handler, ev) => {\r\n _.remove(handler, (values) => isUndefOrEqual(type, ev)\r\n && isUndefOrEqual(callback, values[0])\r\n && isUndefOrEqual(context, values[1] || self));\r\n });\r\n\r\n this._handlers = _.omitBy(self._handlers, (handler) => handler.length === 0);\r\n};\r\n\r\n/**\r\n * Makes all the callbacks for the specific `event` to trigger.\r\n * @param {Object} event Event.\r\n * @param {string} event.type Type of the event.\r\n */\r\nEventDispatcher.prototype.dispatchEvent = function (event) {\r\n const self = this;\r\n\r\n _.forEach(this._handlers[event.type], (callback) => {\r\n const context = callback[1] || self;\r\n callback[0].apply(context, [event]);\r\n });\r\n};\r\n\r\nexport default EventDispatcher;\r\n","/**\r\n * This module contains class for logging.\r\n * Returns an instance of a logger that have already been created.\r\n * Allows users to log messages for five different levels,\r\n * enable console output and catch signal on each message.\r\n */\r\nimport _ from 'lodash';\r\nimport EventDispatcher from './EventDispatcher';\r\n\r\nconst priorities = {\r\n debug: 0,\r\n info: 1,\r\n report: 2,\r\n warn: 3,\r\n error: 4,\r\n};\r\n\r\n/**\r\n * Create new Logger.\r\n *\r\n * @exports Logger\r\n * @extends EventDispatcher\r\n * @constructor\r\n */\r\nfunction Logger() {\r\n EventDispatcher.call(this);\r\n /** Boolean flag that toggles output to browser console.\r\n * @type {boolean}\r\n */\r\n this.console = false;\r\n this._priority = priorities.warn;\r\n}\r\n\r\nLogger.prototype = Object.create(EventDispatcher.prototype);\r\nLogger.prototype.constructor = Logger;\r\n\r\n/**\r\n * Create new clean instance of the logger.\r\n * @returns {Logger}\r\n */\r\nLogger.prototype.instantiate = function () {\r\n return new Logger();\r\n};\r\n\r\nfunction verify(number) {\r\n if (!_.isNumber(number)) {\r\n throw new Error('Wrong log level specified!');\r\n }\r\n return number;\r\n}\r\n\r\n/**\r\n * @property {string} current threshold for signals and console output.\r\n * @name Logger#level\r\n */\r\nObject.defineProperty(Logger.prototype, 'level', {\r\n get() {\r\n return _.findKey(priorities, (value) => value === this._priority);\r\n },\r\n set(level) {\r\n this._priority = verify(priorities[level]);\r\n },\r\n});\r\n\r\n/**\r\n * Returns the list of all possible level values.\r\n * @returns {Array}\r\n */\r\nLogger.prototype.levels = function () {\r\n return Object.keys(priorities);\r\n};\r\n\r\n/**\r\n * Add new message with specified level.\r\n * @param {string} level - level of the message, must be one of the\r\n * {'debug' | 'info' | 'report' | 'warn' | 'error'}\r\n * @param {string} message\r\n */\r\nLogger.prototype.message = function (level, message) {\r\n const priority = verify(priorities[level]);\r\n this._message(priority, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('debug', ...);\r\n * @param message\r\n */\r\nLogger.prototype.debug = function (message) {\r\n this._message(priorities.debug, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('info', ...);\r\n * @param message\r\n */\r\nLogger.prototype.info = function (message) {\r\n this._message(priorities.info, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('report', ...);\r\n * @param message\r\n */\r\nLogger.prototype.report = function (message) {\r\n this._message(priorities.report, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('warn', ...);\r\n * @param message\r\n */\r\nLogger.prototype.warn = function (message) {\r\n this._message(priorities.warn, message);\r\n};\r\n\r\n/**\r\n * Shortcut for message('error', ...);\r\n * @param message\r\n */\r\nLogger.prototype.error = function (message) {\r\n this._message(priorities.error, message);\r\n};\r\n\r\n/**\r\n * Add new message with specified priority.\r\n * @param {number} priority - priority of the message\r\n * @param {string} message\r\n * @private\r\n */\r\nLogger.prototype._message = function (priority, message) {\r\n if (priority < this._priority) {\r\n return;\r\n }\r\n const level = _.findKey(priorities, (value) => value === priority);\r\n message = String(message);\r\n if (this.console) {\r\n const output = `miew:${level}: ${message}`;\r\n if (level === 'error') {\r\n console.error(output); // NOSONAR\r\n } else if (level === 'warn') {\r\n console.warn(output); // NOSONAR\r\n } else {\r\n console.log(output); // NOSONAR\r\n }\r\n }\r\n this.dispatchEvent({ type: 'message', level, message });\r\n};\r\n\r\nexport default new Logger();\r\n","import _ from 'lodash';\r\nimport logger from './utils/logger';\r\n\r\nconst browserType = {\r\n DEFAULT: 0,\r\n SAFARI: 1,\r\n};\r\n//----------------------------------------------------------------------------\r\n// Query string\r\n\r\n/**\r\n * Escape only dangerous chars in a query string component, use a plus instead of a space.\r\n *\r\n * [RFC 3986](https://tools.ietf.org/html/rfc3986) allows the following chars in the query (see 3.4):\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! $ & ' ( ) * + , ; = : @ / ?\r\n *\r\n * For query string elements we need to escape ampersand, equal sign, and plus,\r\n * but encodeURIComponent() function encodes anything except for the following:\r\n *\r\n * A-Z a-z 0-9 - _ . ~ ! ' ( ) *\r\n *\r\n * @param {string} text - key or value to encode\r\n * @param {string} excludeExp - regexp for symbols to exclude from encoding\r\n * @returns {string} encoded string\r\n */\r\nfunction encodeQueryComponent(text, excludeExp) {\r\n const encode = (code) => String.fromCharCode(parseInt(code.substr(1), 16));\r\n return encodeURIComponent(text).replace(excludeExp, encode).replace(/%20/g, '+');\r\n}\r\n\r\n/**\r\n * Unescape dangerous chars in a query string component.\r\n *\r\n * @param {string} text - encoded key or value\r\n * @returns {string} decoded string\r\n * @see {@link encodeQueryComponent}\r\n */\r\nfunction decodeQueryComponent(text) {\r\n return decodeURIComponent(text.replace(/\\+/g, ' '));\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Array} array of (key, value) pairs.\r\n */\r\nfunction getUrlParameters(url) {\r\n url = url || window.location.search;\r\n\r\n const query = url.substring(url.indexOf('?') + 1);\r\n const search = /([^&=]+)=?([^&]*)/g;\r\n const result = [];\r\n let match;\r\n\r\n while ((match = search.exec(query)) !== null) { // eslint-disable-line no-cond-assign\r\n result.push([decodeQueryComponent(match[1]), decodeQueryComponent(match[2])]);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Parse URL and extract an array of parameters as a hash.\r\n * @param {string?} url - URL or query string to parse\r\n * @returns {Object}\r\n */\r\nfunction getUrlParametersAsDict(url) {\r\n const result = {};\r\n const a = getUrlParameters(url);\r\n for (let i = 0; i < a.length; ++i) {\r\n const [key, value] = a[i];\r\n result[key] = value;\r\n }\r\n return result;\r\n}\r\n\r\nfunction resolveURL(str) {\r\n if (typeof URL !== 'undefined') {\r\n try {\r\n if (typeof window !== 'undefined') {\r\n return new URL(str, window.location).href;\r\n }\r\n return new URL(str).href;\r\n } catch (error) {\r\n // IE 11 has a URL object with no constructor available so just try a different approach instead\r\n }\r\n }\r\n if (typeof document !== 'undefined') {\r\n const anchor = document.createElement('a');\r\n anchor.href = str;\r\n return anchor.href;\r\n }\r\n return str;\r\n}\r\n\r\n/**\r\n * Generates regular expression object that includes all symbols\r\n * listed in the argument\r\n * @param symbolStr {string} - String containing characters list.\r\n * @returns {RegExp} - Regular expression.\r\n */\r\nfunction generateRegExp(symbolStr) {\r\n const symbolList = [];\r\n\r\n for (let i = 0, n = symbolStr.length; i < n; ++i) {\r\n symbolList[symbolList.length] = symbolStr[i].charCodeAt(0).toString(16);\r\n }\r\n\r\n const listStr = symbolList.join('|');\r\n\r\n return new RegExp(`%(?:${listStr})`, 'gi');\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Create HTML element\r\n\r\nfunction createElement(tag, attrs, content) {\r\n const element = document.createElement(tag);\r\n let i;\r\n let n;\r\n if (attrs) {\r\n const keys = Object.keys(attrs);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n element.setAttribute(key, attrs[key]);\r\n }\r\n }\r\n if (content) {\r\n if (!(content instanceof Array)) {\r\n content = [content];\r\n }\r\n for (i = 0, n = content.length; i < n; ++i) {\r\n const child = content[i];\r\n if (typeof child === 'string') {\r\n element.appendChild(document.createTextNode(child));\r\n } else if (child instanceof HTMLElement) {\r\n element.appendChild(child);\r\n }\r\n }\r\n }\r\n return element;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Easy inheritance\r\n\r\n/**\r\n * Derive the class from the base.\r\n * @param cls {function} - Class (constructor) to derive.\r\n * @param base {function} - Class (constructor) to derive from.\r\n * @param members {object=} - Optional instance members to add.\r\n * @param statics {object=} - Optional static class members to add.\r\n * @returns {function} Original class.\r\n */\r\nfunction deriveClass(cls, base, members, statics) {\r\n cls.prototype = _.assign(Object.create(base.prototype), { constructor: cls }, members);\r\n if (statics) {\r\n _.assign(cls, statics);\r\n }\r\n return cls;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Deep prototyping\r\n\r\nfunction deriveDeep(obj, needZeroOwnProperties) {\r\n let res = obj;\r\n let i;\r\n let n;\r\n if (obj instanceof Array) {\r\n res = new Array(obj.length);\r\n for (i = 0, n = obj.length; i < n; ++i) {\r\n res[i] = deriveDeep(obj[i]);\r\n }\r\n } else if (obj instanceof Object) {\r\n res = Object.create(obj);\r\n const keys = Object.keys(obj);\r\n for (i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = obj[key];\r\n const copy = deriveDeep(value);\r\n if (copy !== value) {\r\n res[key] = copy;\r\n }\r\n }\r\n if (needZeroOwnProperties && Object.keys(res).length > 0) {\r\n res = Object.create(res);\r\n }\r\n }\r\n return res;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Colors\r\n\r\nfunction hexColor(color) {\r\n const hex = (`0000000${color.toString(16)}`).substr(-6);\r\n return `#${hex}`;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Debug tracing\r\n\r\nfunction DebugTracer(namespace) {\r\n let enabled = false;\r\n\r\n this.enable = function (on) {\r\n enabled = on;\r\n };\r\n\r\n let indent = 0;\r\n const methods = Object.keys(namespace);\r\n\r\n function wrap(method_, name_) {\r\n return function (...args) {\r\n const spaces = DebugTracer.spaces.substr(0, indent * 2);\r\n if (enabled) {\r\n logger.debug(`${spaces + name_} {`);\r\n }\r\n indent++;\r\n const result = method_.apply(this, args); // eslint-disable-line no-invalid-this\r\n indent--;\r\n if (enabled) {\r\n logger.debug(`${spaces}} // ${name_}`);\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n for (let i = 0, n = methods.length; i < n; ++i) {\r\n const name = methods[i];\r\n const method = namespace[name];\r\n if (method instanceof Function && name !== 'constructor') {\r\n namespace[name] = wrap(method, name);\r\n }\r\n }\r\n}\r\n\r\nDebugTracer.spaces = ' ';\r\n\r\nclass OutOfMemoryError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'OutOfMemoryError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction allocateTyped(TypedArrayName, size) {\r\n let result = null;\r\n try {\r\n result = new TypedArrayName(size);\r\n } catch (e) {\r\n if (e instanceof RangeError) {\r\n throw new OutOfMemoryError(e.message);\r\n } else {\r\n throw e;\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Float array conversion\r\n\r\nfunction bytesToBase64(/** ArrayBuffer */ buffer) {\r\n const bytes = new Uint8Array(buffer);\r\n let binary = '';\r\n for (let i = 0; i < bytes.byteLength; i++) {\r\n binary += String.fromCharCode(bytes[i]);\r\n }\r\n return window.btoa(binary);\r\n}\r\n\r\nfunction bytesFromBase64(/** string */ str) {\r\n const binary = window.atob(str);\r\n const bytes = new Uint8Array(binary.length);\r\n for (let i = 0; i < bytes.length; ++i) {\r\n bytes[i] = binary[i].charCodeAt(0);\r\n }\r\n return bytes.buffer;\r\n}\r\n\r\nfunction arrayToBase64(/** number[] */ array, /** function */ TypedArrayClass) {\r\n return bytesToBase64(new TypedArrayClass(array).buffer);\r\n}\r\n\r\nfunction arrayFromBase64(/** string */ str, /** function */ TypedArrayClass) {\r\n return Array.prototype.slice.call(new TypedArrayClass(bytesFromBase64(str)));\r\n}\r\n\r\n// NOTE: this is 1-level comparison\r\nfunction compareOptionsWithDefaults(opts, defOpts) {\r\n const optsStr = [];\r\n if (defOpts && opts) {\r\n const keys = Object.keys(opts);\r\n for (let p = 0; p < keys.length; ++p) {\r\n const key = keys[p];\r\n const value = opts[key];\r\n // TODO add processing for tree structure\r\n if (!(value instanceof Object) && typeof defOpts[key] !== 'undefined' && defOpts[key] !== value) {\r\n optsStr.push(`${key}:${value}`);\r\n }\r\n }\r\n if (optsStr.length > 0) {\r\n return `!${optsStr.join()}`;\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nfunction isAlmostPlainObject(o) {\r\n if (_.isPlainObject(o)) {\r\n return true;\r\n }\r\n const proto = o && Object.getPrototypeOf(o);\r\n return !!proto && !proto.hasOwnProperty('constructor') && isAlmostPlainObject(proto);\r\n}\r\n\r\n/**\r\n * Build an object that contains properties (and subproperties) of `src` different from those\r\n * in `dst`. Objects are parsed recursively, other values (including arrays) are compared for\r\n * equality using `_.isEqual()`.\r\n * @param {!object} src - a new object to compare, may contain changed or new properties\r\n * @param {!object} dst - an old reference object\r\n */\r\nfunction objectsDiff(src, dst) {\r\n const diff = {};\r\n _.forIn(src, (srcValue, key) => {\r\n const dstValue = dst[key];\r\n if (isAlmostPlainObject(srcValue) && isAlmostPlainObject(dstValue)) {\r\n const deepDiff = objectsDiff(srcValue, dstValue);\r\n if (!_.isEmpty(deepDiff)) {\r\n diff[key] = deepDiff;\r\n }\r\n } else if (!_.isEqual(srcValue, dstValue)) {\r\n diff[key] = srcValue;\r\n }\r\n });\r\n return diff;\r\n}\r\n\r\nfunction forInRecursive(object, callback) {\r\n function iterateThrough(obj, prefix) {\r\n _.forIn(obj, (value, key) => {\r\n const newPref = prefix + (prefix.length > 0 ? '.' : '');\r\n if (value instanceof Object) {\r\n iterateThrough(value, newPref + key);\r\n } else if (value !== undefined) {\r\n callback(value, newPref + key);\r\n }\r\n });\r\n }\r\n iterateThrough(object, '');\r\n}\r\n\r\nfunction enquoteString(value) {\r\n if (_.isString(value)) {\r\n return `\"${value.replace(/\"/g, '\\\\\"')}\"`;\r\n }\r\n return value;\r\n}\r\n\r\nfunction unquoteString(value) {\r\n if (!_.isString(value)) {\r\n return value;\r\n }\r\n if (value[0] === '\"' && value[value.length - 1] === '\"') {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\\"/g, '\"');\r\n }\r\n if (value[0] === \"'\" && value[value.length - 1] === \"'\") {\r\n value = value.slice(1, value.length - 1);\r\n return value.replace(/\\\\'/g, \"'\");\r\n }\r\n throw new SyntaxError('Incorrect string format, can\\'t unqute it');\r\n}\r\n\r\nfunction getFileExtension(fileName) {\r\n return fileName.slice((Math.max(0, fileName.lastIndexOf('.')) || Infinity));\r\n}\r\n\r\nfunction splitFileName(fileName) {\r\n const ext = getFileExtension(fileName);\r\n const name = fileName.slice(0, fileName.length - ext.length);\r\n return [name, ext];\r\n}\r\n\r\nfunction dataUrlToBlob(url) {\r\n const parts = url.split(/[:;,]/);\r\n const partsCount = parts.length;\r\n if (partsCount >= 3 && parts[partsCount - 2] === 'base64') {\r\n return new Blob([bytesFromBase64(parts[partsCount - 1])]);\r\n }\r\n return null;\r\n}\r\n\r\nfunction getBrowser() {\r\n if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1\r\n && navigator.userAgent\r\n && navigator.userAgent.indexOf('CriOS') === -1\r\n && navigator.userAgent.indexOf('FxiOS') === -1) {\r\n return browserType.SAFARI;\r\n }\r\n return browserType.DEFAULT;\r\n}\r\n\r\nfunction shotOpen(url) {\r\n if (typeof window !== 'undefined') {\r\n window.open().document.write(``);\r\n }\r\n}\r\n\r\nfunction shotDownload(dataUrl, filename) {\r\n if (!dataUrl || dataUrl.substr(0, 5) !== 'data:') {\r\n return;\r\n }\r\n if (!filename) {\r\n filename = ['screenshot-', +new Date(), '.png'].join('');\r\n }\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(dataUrlToBlob(dataUrl), filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(dataUrlToBlob(dataUrl));\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction download(data, filename, type) {\r\n const blobData = new Blob([data]);\r\n\r\n if (!filename) {\r\n filename = ['data', +new Date()].join('');\r\n }\r\n\r\n if (!type) {\r\n filename += blobData.type || '.bin';\r\n } else {\r\n filename += `.${type}`;\r\n }\r\n\r\n if (typeof window !== 'undefined' && window.navigator && window.navigator.msSaveBlob) {\r\n window.navigator.msSaveBlob(blobData, filename);\r\n } else if (typeof document !== 'undefined') {\r\n const link = document.createElement('a');\r\n link.download = filename;\r\n link.innerHTML = 'download';\r\n link.href = window.URL.createObjectURL(blobData);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n}\r\n\r\nfunction copySubArrays(src, dst, indices, itemSize) {\r\n for (let i = 0, n = indices.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n dst[i * itemSize + j] = src[indices[i] * itemSize + j];\r\n }\r\n }\r\n}\r\n\r\nfunction shallowCloneNode(node) {\r\n const newNode = node.cloneNode(true);\r\n newNode.worldPos = node.worldPos;\r\n // .style property is readonly, so \"newNode.style = node.style;\" won't work (and we don't need it, right?)\r\n return newNode;\r\n}\r\n\r\nconst unquotedStringRE = /^[a-zA-Z0-9_]*$/;\r\nconst enquoteHelper = ['\"', '', '\"'];\r\n\r\n// verify and correct if needed selctor identifier\r\nfunction correctSelectorIdentifier(value) {\r\n if (unquotedStringRE.test(value)) {\r\n return value;\r\n }\r\n // quote incorrect identifier\r\n enquoteHelper[1] = value;\r\n return enquoteHelper.join('');\r\n}\r\n\r\n/**\r\n * Concatenates two TypedArray. Doesn't check null refs o type equality\r\n * Attention! It must be use very rarely because requires memory reallocation every time. Use MergeTypedArraysUnsafe to\r\n * unite array of subarrays.\r\n * @param{TypedArray} first - destination array\r\n * @param{TypedArray} second - source array\r\n * @returns{TypedArray} resulting concatenated array\r\n */\r\nfunction concatTypedArraysUnsafe(first, second) {\r\n const result = new first.constructor(first.length + second.length);\r\n result.set(first);\r\n result.set(second, first.length);\r\n return result;\r\n}\r\n\r\n/**\r\n * Merges array of TypedArray into TypedArray. Doesn't check null refs o type equality\r\n * @param{array} array - source array of subarrays\r\n * @returns{TypedArray} resulting merged array\r\n */\r\nfunction mergeTypedArraysUnsafe(array) {\r\n if (array.length <= 0) {\r\n return null;\r\n }\r\n // count the size\r\n const size = array.reduce((acc, cur) => acc + cur.length, 0);\r\n // create combined array\r\n const result = new array[0].constructor(size);\r\n for (let i = 0, start = 0; i < array.length; i++) {\r\n const count = array[i].length;\r\n result.set(array[i], start);\r\n start += count;\r\n }\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n// Exports\r\n\r\nexport default {\r\n browserType,\r\n encodeQueryComponent,\r\n decodeQueryComponent,\r\n getUrlParameters,\r\n getUrlParametersAsDict,\r\n resolveURL,\r\n generateRegExp,\r\n createElement,\r\n deriveClass,\r\n deriveDeep,\r\n hexColor,\r\n DebugTracer,\r\n OutOfMemoryError,\r\n allocateTyped,\r\n bytesFromBase64,\r\n bytesToBase64,\r\n arrayFromBase64,\r\n arrayToBase64,\r\n compareOptionsWithDefaults,\r\n objectsDiff,\r\n forInRecursive,\r\n enquoteString,\r\n unquoteString,\r\n getBrowser,\r\n shotOpen,\r\n shotDownload,\r\n copySubArrays,\r\n shallowCloneNode,\r\n correctSelectorIdentifier,\r\n getFileExtension,\r\n splitFileName,\r\n download,\r\n concatTypedArraysUnsafe,\r\n mergeTypedArraysUnsafe,\r\n};\r\n","import EventDispatcher from './EventDispatcher';\r\n\r\nexport default class JobHandle extends EventDispatcher {\r\n constructor() {\r\n super();\r\n this._shouldCancel = false;\r\n }\r\n\r\n cancel() {\r\n this._shouldCancel = true;\r\n this.dispatchEvent({ type: 'cancel' });\r\n }\r\n\r\n shouldCancel() {\r\n return this._shouldCancel;\r\n }\r\n\r\n // slaves use this to notify master about their events\r\n // master routes these notifications to a single event slot\r\n notify(event) {\r\n this.dispatchEvent({ type: 'notification', slaveEvent: event });\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport utils from './utils';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\n\r\nconst VERSION = 0;\r\n\r\n//----------------------------------------------------------------------------\r\n// DEFAULT SETTINGS\r\n//----------------------------------------------------------------------------\r\n\r\n/**\r\n * Polygonal complexity settings.\r\n *\r\n * @typedef PolyComplexity\r\n * @property {number} poor\r\n * @property {number} low\r\n * @property {number} medium\r\n * @property {number} high\r\n * @property {number} ultra\r\n */\r\n\r\n/**\r\n * @alias SettingsObject\r\n * @namespace\r\n */\r\nconst defaults = {\r\n /**\r\n * Default options for all available modes.\r\n * Use {@link Mode.id} as a dictionary key to access mode options.\r\n *\r\n * Usually you don't need to override these settings. You may specify mode options as a parameter during\r\n * {@link Mode} construction.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {LinesModeOptions} LN - Lines mode options.\r\n * @property {LicoriceModeOptions} LC - Licorice mode options.\r\n * @property {BallsAndSticksModeOptions} BS - Balls and Sticks mode options.\r\n * @property {VanDerWaalsModeOptions} VW - Van der Waals mode options.\r\n * @property {TraceModeOptions} TR - Trace mode options.\r\n * @property {TubeModeOptions} TU - Tube mode options.\r\n * @property {CartoonModeOptions} CA - Cartoon mode options.\r\n * @property {QuickSurfaceModeOptions} QS - Contact Surface mode options.\r\n * @property {IsoSurfaceSASModeOptions} SA - Solvent Accessible Surface mode options.\r\n * @property {IsoSurfaceSESModeOptions} SE - Solvent Excluded Surface mode options.\r\n * @property {ContactSurfaceModeOptions} CS - Contact Surface mode options.\r\n * @property {TextModeOptions} TX - Text mode options.\r\n * @property {VolumeDensityModeOptions} VD - Volume Density mode options.\r\n */\r\n modes: {\r\n //----------------------------------------------------------------------------\r\n // BALLS AND STICKS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Balls and Sticks mode options.\r\n *\r\n * @typedef BallsAndSticksModeOptions\r\n *\r\n * @property {number} atom - Sphere radius as a fraction of Van der Waals atom radius.\r\n * @property {number} bond - Cylinder radius in angstroms.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n BS: {\r\n atom: 0.23,\r\n bond: 0.15,\r\n space: 0.5,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VAN DER WAALS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Van der Waals mode options.\r\n *\r\n * @typedef VanDerWaalsModeOptions\r\n *\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VW: {\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 8,\r\n high: 16,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LINES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Lines mode options.\r\n *\r\n * @typedef LinesModeOptions\r\n *\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {number} offsarom - Offset between bonds and aromatic cycle.\r\n * @property {number} chunkarom - Number of pieces in a-loop arc, corresponding to atom.\r\n * @property {number} atom - Collision radius for atoms picking.\r\n * @property {number} lineWidth - Line width in pixels (not used in thin lines).\r\n */\r\n LN: {\r\n multibond: true,\r\n showarom: true,\r\n offsarom: 0.2,\r\n chunkarom: 10,\r\n atom: 0.23,\r\n lineWidth: 2,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // LICORICE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Licorice mode options.\r\n *\r\n * @typedef LicoriceModeOptions\r\n *\r\n * @property {number} bond - Bond cylinder radius.\r\n * @property {number} space - Fraction of the space around one cylinder. Zero means that cylinder fills all\r\n * available space.\r\n * @property {boolean} multibond - Flag, that toggles rendering of multiple ordered bonds.\r\n * @property {number} aromrad - Minor radius of a torus for aromatic loops.\r\n * @property {boolean} showarom - Flag, that toggles rendering of aromatic loops.\r\n * @property {PolyComplexity} polyComplexity - Poly complexity values for render modes.\r\n */\r\n LC: {\r\n bond: 0.20,\r\n space: 0.0,\r\n multibond: true,\r\n aromrad: 0.1,\r\n showarom: true,\r\n polyComplexity: {\r\n poor: 3,\r\n low: 4,\r\n medium: 6,\r\n high: 12,\r\n ultra: 32,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SAS\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Accessible Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSASModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SA: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // SURFACE SES\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Solvent Excluded Surface mode options.\r\n *\r\n * @typedef IsoSurfaceSESModeOptions\r\n *\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {number} probeRadius - Radius of the probe.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n SE: {\r\n zClip: false,\r\n probeRadius: 1.5,\r\n subset: '',\r\n wireframe: false,\r\n polyComplexity: {\r\n poor: 6,\r\n low: 8,\r\n medium: 16,\r\n high: 30,\r\n ultra: 60,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // QUICK SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Quick Surface mode options.\r\n *\r\n * @typedef QuickSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} scale - Radius scale for the surface being built.\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} gaussLim - Gauss lim for coloring the bigger the value, the smoother our colors are.\r\n * @property {PolyComplexity} gridSpacing - Poly complexity values for render modes. In this case the value\r\n * corresponds to the grid density.\r\n */\r\n QS: {\r\n isoValue: 0.5,\r\n gaussLim: {\r\n poor: 1.5,\r\n low: 2.0,\r\n medium: 2.5,\r\n high: 3.0,\r\n ultra: 4.0,\r\n },\r\n scale: 1.0,\r\n wireframe: false,\r\n gridSpacing: {\r\n poor: 2,\r\n low: 1.5,\r\n medium: 1,\r\n high: 0.5,\r\n ultra: 0.25,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CONTACT SURFACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Contact Surface mode options.\r\n *\r\n * @typedef ContactSurfaceModeOptions\r\n *\r\n * @property {number} isoValue - Isovalue of the surface to extract.\r\n * @property {number} probeRadius - Probe radius.\r\n * @property {number} probePositions\r\n * @property {boolean} zClip - Flag, that toggles z-clipping.\r\n * @property {string} subset - Only parts of surface close to selected atoms will be visible.\r\n * Empty string means whole surface is visible.\r\n * @property {boolean} wireframe - Flag that specifies whether or not surface rendered in wireframe mode.\r\n * @property {PolyComplexity} polyComplexity - Radius scale for the surface being built.\r\n * Poly complexity values for render modes. In this case the value corresponds to the grid density.\r\n */\r\n CS: {\r\n probeRadius: 1.4,\r\n isoValue: 1.5,\r\n wireframe: false,\r\n probePositions: 30,\r\n polyComplexity: {\r\n poor: 0.5,\r\n low: 1.0,\r\n medium: 1.5,\r\n high: 1.75,\r\n ultra: 2.0,\r\n },\r\n subset: '',\r\n zClip: false,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TRACE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Trace mode options.\r\n *\r\n * @typedef TraceModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n TR: {\r\n radius: 0.30,\r\n polyComplexity: {\r\n poor: 12,\r\n low: 16,\r\n medium: 32,\r\n high: 64,\r\n ultra: 64,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TUBE\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Tube mode options.\r\n *\r\n * @typedef TubeModeOptions\r\n *\r\n * @property {number} radius - Cylinder radius.\r\n * @property {number} tension - Tension for interpolation.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n TU: {\r\n radius: 0.30,\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // CARTOON\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Cartoon mode options.\r\n *\r\n * @typedef CartoonModeOptions\r\n *\r\n * @property {number} radius - Standard tube radius.\r\n * @property {number} depth - Height of the secondary structure ribbon.\r\n * @property {number} tension - Tension for interpolation.\r\n * @proprety {object} ss - Secondary structure parameters.\r\n * @proprety {object} ss.helix - Options for helices render.\r\n * @proprety {number} ss.helix.width - Width of the secondary structure ribbon.\r\n * @proprety {number} ss.helix.arrow - Secondary structure's arrow width.\r\n * @proprety {object} ss.strand - Options for strands render.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n * polyComplexity must be even for producing symmetric arrows.\r\n * @property {number} heightSegmentsRatio - Poly complexity multiplier for height segments.\r\n */\r\n CA: {\r\n radius: 0.30,\r\n depth: 0.25,\r\n ss: {\r\n helix: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n strand: {\r\n width: 1.0,\r\n arrow: 2.0,\r\n },\r\n },\r\n heightSegmentsRatio: 1.5,\r\n tension: -0.7,\r\n polyComplexity: {\r\n poor: 4,\r\n low: 6,\r\n medium: 10,\r\n high: 18,\r\n ultra: 34,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // TEXT\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Text mode options.\r\n *\r\n * @typedef TextModeOptions\r\n *\r\n * @property {string} template - Format string for building output text.\r\n * @property {string} horizontalAlign - Text alignment ('left', 'right', 'center').\r\n * @property {string} verticalAlign - Vertical text box alignment ('top', 'bottom', 'middle').\r\n * @property {number} dx - Text offset x in angstroms.\r\n * @property {number} dy - Text offset y in angstroms.\r\n * @property {number} dz - Text offset z in angstroms.\r\n * @property {string} fg - Color rule for foreground.\r\n * @property {string} bg - Color rule for background.\r\n * @property {boolean} showBg - Flag, that toggles background rendering.\r\n *\r\n */\r\n TX: {\r\n template: '{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}',\r\n horizontalAlign: 'center',\r\n verticalAlign: 'middle',\r\n dx: 0,\r\n dy: 0,\r\n dz: 1,\r\n fg: 'none',\r\n bg: '0x202020',\r\n showBg: true,\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n // VOLUME DENSITY\r\n //----------------------------------------------------------------------------\r\n\r\n /**\r\n * Volume density mode options.\r\n *\r\n * @typedef VolumeDensityModeOptions\r\n *\r\n * @property {number} kSigma - Noise threshold coefficient.\r\n * @property {boolean} frame - flag, that turns on box frame painting.\r\n * @property {boolean} isoMode - flag, that turns on IsoSurface mode instead of Volume Rendering.\r\n * @property {PolyComplexity} polyComplexity - Polygonal complexity settings for different resolutions.\r\n */\r\n VD: {\r\n kSigma: 1.0,\r\n kSigmaMed: 2.0,\r\n kSigmaMax: 4.0,\r\n frame: true,\r\n isoMode: false,\r\n polyComplexity: {\r\n poor: 2,\r\n low: 3,\r\n medium: 4,\r\n high: 8,\r\n ultra: 10,\r\n },\r\n },\r\n },\r\n\r\n /**\r\n * Default options for all available colorers.\r\n * Use {@link Colorer.id} as a dictionary key to access colorer options.\r\n *\r\n * Usually you don't need to override these settings. You may specify colorer options as a parameter during\r\n * {@link Colorer} construction.\r\n *\r\n * Not all colorers have options.\r\n *\r\n * @memberof SettingsObject#\r\n * @type {Object.}\r\n *\r\n * @property {ElementColorerOptions} EL - Element colorer options.\r\n * @property {SequenceColorerOptions} SQ - Sequence colorer options.\r\n * @property {MoleculeColorerOptions} MO - Molecule colorer options.\r\n * @property {UniformColorerOptions} UN - Uniform colorer options.\r\n * @property {ConditionalColorerOptions} CO - Conditional colorer options.\r\n * @property {TemperatureColorerOptions} TM - Temperature colorer options.\r\n * @property {OccupancyColorerOptions} OC - Occupancy colorer options.\r\n * @property {HydrophobicityColorerOptions} HY - Hydrophobicity colorer options.\r\n */\r\n colorers: {\r\n /**\r\n * Element colorer options.\r\n *\r\n * @typedef ElementColorerOptions\r\n *\r\n * @property {number} carbon - Carbon color or -1 to use default.\r\n */\r\n EL: {\r\n carbon: -1,\r\n },\r\n\r\n /**\r\n * Uniform colorer options.\r\n *\r\n * @typedef UniformColorerOptions\r\n *\r\n * @property {number} color - Single color to paint with.\r\n */\r\n UN: {\r\n color: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Conditional colorer options.\r\n *\r\n * @typedef ConditionalColorerOptions\r\n *\r\n * @property {string} subset - Selector string.\r\n * @property {number} color - Color of selected atoms.\r\n * @property {number} baseColor - Color of other atoms.\r\n */\r\n CO: {\r\n subset: 'charged',\r\n color: 0xFF0000,\r\n baseColor: 0xFFFFFF,\r\n },\r\n\r\n /**\r\n * Carbon colorer options.\r\n *\r\n * @typedef CarbonColorerOptions\r\n *\r\n * @property {number} color - Single color to paint carbons\r\n * @property {number} factor - Color factor for not carbon atoms.\r\n */\r\n CB: {\r\n color: 0x909090,\r\n factor: 0.6,\r\n },\r\n\r\n /**\r\n * Sequence colorer options.\r\n *\r\n * @typedef SequenceColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n SQ: {\r\n gradient: 'rainbow',\r\n },\r\n\r\n /**\r\n * Temperature colorer options.\r\n *\r\n * @typedef TemperatureColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n * @property {number} min - Minimal temperature.\r\n * @property {number} max - Maximal temperature.\r\n */\r\n TM: {\r\n gradient: 'temp',\r\n min: 5,\r\n max: 40,\r\n },\r\n\r\n /**\r\n * Occupancy colorer options.\r\n *\r\n * @typedef OccupancyColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n OC: {\r\n gradient: 'reds',\r\n },\r\n\r\n /**\r\n * Hydrophobicity colorer options.\r\n *\r\n * @typedef HydrophobicityColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n HY: {\r\n gradient: 'blue-red',\r\n },\r\n\r\n /**\r\n * Molecule colorer options.\r\n *\r\n * @typedef MoleculeColorerOptions\r\n *\r\n * @property {string} gradient - Name of gradient to use.\r\n */\r\n MO: {\r\n gradient: 'rainbow',\r\n },\r\n },\r\n\r\n /*\r\n * Use antialiasing in WebGL.\r\n * @type {boolean}\r\n */\r\n antialias: true,\r\n\r\n /*\r\n * Camera field of view in degrees.\r\n * @type {number}\r\n */\r\n camFov: 45.0,\r\n\r\n /*\r\n * Camera near plane distance.\r\n * @type {number}\r\n */\r\n camNear: 0.5,\r\n\r\n /*\r\n * Camera far plane distance.\r\n * @type {number}\r\n */\r\n camFar: 100.0,\r\n\r\n camDistance: 2.5,\r\n\r\n radiusToFit: 1.0,\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogNearFactor: 0.5, // [0, 1]\r\n\r\n /**\r\n * @type {number}\r\n * @instance\r\n */\r\n fogFarFactor: 1, // [0, 1]\r\n fogAlpha: 1.0,\r\n fogColor: 0x000000,\r\n fogColorEnable: false,\r\n\r\n /**\r\n * Palette used for molecule coloring.\r\n * @type {string}\r\n */\r\n palette: 'JM',\r\n\r\n /*\r\n * Geometry resolution.\r\n * @type {string}\r\n */\r\n resolution: 'medium',\r\n\r\n autoResolution: false/* true */,\r\n\r\n autoPreset: true,\r\n\r\n preset: 'default', // TODO: remove 'preset' from settings, implement autodetection\r\n\r\n presets: {\r\n // Default\r\n default: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n empty: [],\r\n\r\n // Wireframe\r\n wire: [{\r\n mode: 'LN',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Small molecules\r\n small: [{\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'all',\r\n material: 'SF',\r\n }],\r\n\r\n // Proteins, nucleic acids etc.\r\n macro: [{\r\n mode: 'CA',\r\n colorer: 'SS',\r\n selector: 'not hetatm',\r\n material: 'SF',\r\n }, {\r\n mode: 'BS',\r\n colorer: 'EL',\r\n selector: 'hetatm and not water',\r\n material: 'SF',\r\n }],\r\n },\r\n\r\n objects: {\r\n line: {\r\n color: 0xFFFFFFFF,\r\n dashSize: 0.3,\r\n gapSize: 0.05,\r\n },\r\n },\r\n\r\n //----------------------------------------------------------------------------\r\n\r\n bg: {\r\n color: 0x202020,\r\n transparent: false,\r\n },\r\n\r\n draft: {\r\n clipPlane: false,\r\n clipPlaneFactor: 0.5,\r\n clipPlaneSpeed: 0.00003,\r\n },\r\n\r\n /*\r\n * Separate group for plugins.\r\n * Each plugin handles its field by itself.\r\n */\r\n plugins: {\r\n\r\n },\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n axes: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fog: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fps: true,\r\n\r\n /**\r\n * Switch using of z-sprites for sphere and cylinder geometry\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zSprites: true,\r\n\r\n isoSurfaceFakeOpacity: true,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n suspendRender: true,\r\n\r\n nowater: false,\r\n\r\n /**\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autobuild: true,\r\n\r\n /**\r\n * Anti-aliasing.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n fxaa: true,\r\n /**\r\n * Outline depths\r\n * @type {boolean}\r\n * @instance\r\n */\r\n outline: {\r\n on: false,\r\n color: 0x000000,\r\n threshold: 0.1,\r\n thickness: 1,\r\n },\r\n\r\n /**\r\n * Ambient Occlusion special effect.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n ao: false,\r\n\r\n /**\r\n * Shadows options.\r\n *\r\n * @property {boolean} shadowMap - enable/disable.\r\n * @property {string} basic/percentage-closer filtering/non-uniform randomizing pcf.\r\n * @property {number} radius for percentage-closer filtering.\r\n */\r\n shadow: {\r\n on: false,\r\n type: 'random'/* basic, pcf, random */,\r\n radius: 1.0,\r\n },\r\n\r\n /**\r\n * Auto-rotation with constant speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n autoRotation: 0.0,\r\n\r\n /**\r\n * Set maximum fps for animation.\r\n * @type {number}\r\n * @instance\r\n */\r\n maxfps: 30,\r\n\r\n /**\r\n * Set fbx output precision.\r\n * @type {number}\r\n * @instance\r\n */\r\n fbxprec: 4,\r\n\r\n /**\r\n * Auto-rotation axis.\r\n *\r\n * - true: complex auto-rotation is about vertical axis\r\n * - false: rotation axis is defined by last user rotation\r\n *\r\n * @type {boolean}\r\n * @instance\r\n */\r\n autoRotationAxisFixed: true,\r\n\r\n /**\r\n * Enable zooming with mouse wheel or pinch gesture.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n zooming: true,\r\n\r\n /**\r\n * Enable picking atoms & residues with left mouse button or touch.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n picking: true,\r\n\r\n /**\r\n * Set picking mode ('atom', 'residue', 'chain', 'molecule').\r\n * @type {string}\r\n * @instance\r\n */\r\n pick: 'atom',\r\n\r\n /**\r\n * Make \"component\" and \"fragment\" editing modes available.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n editing: false,\r\n\r\n /**\r\n * Detect aromatic loops.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n aromatic: false,\r\n\r\n /**\r\n * Load only one biological unit from all those described in PDB file.\r\n * @type {boolean}\r\n * @instance\r\n */\r\n singleUnit: true,\r\n\r\n /**\r\n * Set stereo mode ('NONE', 'SIMPLE', 'DISTORTED', 'ANAGLYPH', 'WEBVR').\r\n * @type {string}\r\n * @instance\r\n */\r\n stereo: 'NONE',\r\n\r\n /**\r\n * Enable smooth transition between views\r\n * @type {boolean}\r\n * @instance\r\n */\r\n interpolateViews: true,\r\n\r\n /**\r\n * Set transparency mode ('standard', 'prepass').\r\n * @type {string}\r\n * @instance\r\n */\r\n transparency: 'prepass',\r\n\r\n /**\r\n * Mouse translation speed.\r\n * @type {number}\r\n * @instance\r\n */\r\n translationSpeed: 2,\r\n\r\n debug: {\r\n example: 3.5,\r\n text: 'hello!',\r\n good: true,\r\n ssaoKernelRadius: 0.7,\r\n ssaoFactor: 0.7,\r\n stereoBarrel: 0.25,\r\n },\r\n use: {\r\n multiFile: false,\r\n },\r\n};\r\n\r\n//----------------------------------------------------------------------------\r\n// SETTINGS CLASS\r\n//----------------------------------------------------------------------------\r\n\r\nfunction Settings() {\r\n EventDispatcher.call(this);\r\n\r\n this.old = null;\r\n this.now = {};\r\n this._changed = {};\r\n\r\n this.reset();\r\n}\r\n\r\nutils.deriveClass(Settings, EventDispatcher, {\r\n defaults,\r\n\r\n set(path, value) {\r\n if (_.isString(path)) {\r\n const oldValue = _.get(this.now, path);\r\n if (oldValue !== value) {\r\n _.set(this.now, path, value);\r\n this._notifyChange(path, value);\r\n }\r\n } else {\r\n const diff = utils.objectsDiff(path, this.now);\r\n if (!_.isEmpty(diff)) {\r\n _.merge(this.now, diff);\r\n this._notifyChanges(diff);\r\n }\r\n }\r\n },\r\n\r\n get(path, defaultValue) {\r\n return _.get(this.now, path, defaultValue);\r\n },\r\n\r\n reset() {\r\n const diff = utils.objectsDiff(defaults, this.now);\r\n this.now = _.cloneDeep(defaults);\r\n this.old = null;\r\n this._notifyChanges(diff);\r\n this._changed = {};\r\n },\r\n\r\n checkpoint() {\r\n this.old = _.cloneDeep(this.now);\r\n this._changed = {};\r\n },\r\n\r\n _notifyChange(path, value) {\r\n this._changed[path] = true;\r\n this.dispatchEvent({ type: `change:${path}`, value });\r\n },\r\n\r\n _notifyChanges(diff) {\r\n utils.forInRecursive(diff, (deepValue, deepPath) => {\r\n this._notifyChange(deepPath, deepValue);\r\n });\r\n },\r\n\r\n changed() {\r\n if (!this.old) {\r\n return [];\r\n }\r\n const { old, now } = this;\r\n const keys = _.filter(Object.keys(this._changed), (key) => _.get(old, key) !== _.get(now, key));\r\n return keys;\r\n },\r\n\r\n applyDiffs(diffs) {\r\n if (diffs.hasOwnProperty('VERSION') && diffs.VERSION !== VERSION) {\r\n throw new Error('Settings version does not match!');\r\n }\r\n // VERSION shouldn't be presented inside settings structure\r\n delete diffs.VERSION;\r\n this.reset();\r\n this.set(diffs);\r\n },\r\n\r\n getDiffs(versioned) {\r\n const diffs = utils.objectsDiff(this.now, defaults);\r\n if (versioned) {\r\n diffs.VERSION = VERSION;\r\n }\r\n return diffs;\r\n },\r\n\r\n setPluginOpts(plugin, opts) {\r\n defaults.plugins[plugin] = _.cloneDeep(opts);\r\n this.now.plugins[plugin] = _.cloneDeep(opts);\r\n },\r\n});\r\n\r\nexport default new Settings();\r\n","import _ from 'lodash';\r\nimport settings from './settings';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\n\r\nlet repIndex = 0;\r\n\r\nfunction asBoolean(value) {\r\n return !(!value || value === '0' || (_.isString(value) && value.toLowerCase() === 'false'));\r\n}\r\n\r\nconst adapters = {\r\n string: String,\r\n number: Number,\r\n boolean: asBoolean,\r\n};\r\n\r\n// Level 1 assignment symbol\r\nconst cL1Ass = '=';\r\n\r\nconst cOptsSep = '!';\r\n// Level 2 (options) assignment symbol\r\nconst cL2Ass = ':';\r\n// Level 2 (options) separator symbol\r\nconst cLSep = ',';\r\n\r\nconst cCommonIgnoreSymbols = '$;@/?';\r\n/**\r\n * We may (and should) leave as is for better readability:\r\n *\r\n * $ , ; : @ / ?\r\n */\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n */\r\nfunction getLevel1ExcludedExpr() {\r\n const cLevel1Ignores = ':,';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel1Ignores);\r\n}\r\n\r\n/**\r\n * Generate regular expression for symbols excluded for first level encryption\r\n * (options, etc, ..)\r\n */\r\nfunction getLevel2ExcludedExpr() {\r\n const cLevel2Ignores = ' ';\r\n return utils.generateRegExp(cCommonIgnoreSymbols + cLevel2Ignores);\r\n}\r\n\r\nconst cL1ExclExpr = getLevel1ExcludedExpr();\r\nfunction encodeQueryComponentL1(value) {\r\n return utils.encodeQueryComponent(value, cL1ExclExpr);\r\n}\r\n\r\nconst cL2ExclExpr = getLevel2ExcludedExpr();\r\nfunction encodeQueryComponentL2(value) {\r\n return utils.encodeQueryComponent(value, cL2ExclExpr);\r\n}\r\n\r\nfunction ensureRepList(opts) {\r\n let { reps } = opts;\r\n if (!reps) {\r\n const { presets } = settings.now;\r\n let preset = opts.preset || settings.now.preset;\r\n reps = presets[preset];\r\n if (!reps) {\r\n logger.warn(`Unknown preset \"${preset}\"`);\r\n [preset] = Object.keys(presets);\r\n reps = presets[preset]; // fall back to any preset\r\n }\r\n opts.preset = preset;\r\n opts.reps = utils.deriveDeep(reps, true);\r\n }\r\n}\r\n\r\nfunction ensureRepAssign(opts, prop, value) {\r\n ensureRepList(opts);\r\n const rep = opts.reps[repIndex];\r\n // prop specified twice therefore start new rep by cloning the current\r\n if (rep.hasOwnProperty(prop)) {\r\n repIndex = opts.reps.length;\r\n opts.reps[repIndex] = utils.deriveDeep(rep, true);\r\n }\r\n if (value !== undefined) {\r\n opts.reps[repIndex][prop] = value;\r\n }\r\n}\r\n\r\nfunction addObject(opts, params, options) {\r\n if (opts._objects === undefined) {\r\n opts._objects = [];\r\n }\r\n\r\n const [type, newOpts] = options;\r\n const newObj = {\r\n type,\r\n params,\r\n };\r\n\r\n if (newOpts !== undefined) {\r\n newObj.opts = newOpts;\r\n }\r\n\r\n opts._objects[opts._objects.length] = newObj;\r\n}\r\n\r\nfunction parseParams(str, params) {\r\n const sep = str.indexOf(',');\r\n if (sep >= 0) {\r\n params.push(str.substr(sep + 1).split(','));\r\n return str.substr(0, sep);\r\n }\r\n // keep this untouched if no params were extracted\r\n return str;\r\n}\r\n\r\nfunction extractArgs(input, defaultsDict, params) {\r\n if (input) {\r\n const bang = input.indexOf(cOptsSep);\r\n const inputVal = parseParams(input.substr(0, bang >= 0 ? bang : undefined), params);\r\n if (bang >= 0) {\r\n const args = input.substr(bang + 1).split(cLSep);\r\n input = inputVal;\r\n if (defaultsDict) {\r\n const defaults = defaultsDict[input];\r\n const opts = utils.deriveDeep(defaults, true);\r\n args.forEach((arg) => {\r\n const pair = arg.split(cL2Ass, 2);\r\n const key = decodeURIComponent(pair[0]);\r\n const value = decodeURIComponent(pair[1]);\r\n const adapter = adapters[typeof _.get(defaults, key)];\r\n if (adapter) {\r\n _.set(opts, key, adapter(value));\r\n } else {\r\n logger.warn(`Unknown argument \"${key}\" for option \"${input}\"`);\r\n }\r\n });\r\n if (Object.keys(opts).length > 0) {\r\n input = [input, opts];\r\n }\r\n }\r\n } else {\r\n input = inputVal;\r\n }\r\n }\r\n return input;\r\n}\r\n\r\nconst actions = {\r\n\r\n l: 'load',\r\n load: String,\r\n t: 'type',\r\n type: String,\r\n v: 'view',\r\n view: String,\r\n u: 'unit',\r\n unit: Number,\r\n menu: asBoolean,\r\n\r\n // Commands\r\n\r\n o: 'object',\r\n object(value, opts) {\r\n const params = [];\r\n let options = extractArgs(value, settings.defaults.objects, params);\r\n if (!Array.isArray(options)) {\r\n options = [options];\r\n }\r\n addObject(opts, params[0], options);\r\n },\r\n\r\n p: 'preset',\r\n preset(value, opts) {\r\n opts.preset = value;\r\n opts.reps = null;\r\n ensureRepList(opts);\r\n },\r\n\r\n r: 'rep',\r\n rep(value, opts) {\r\n ensureRepList(opts);\r\n repIndex = Number(value);\r\n // clamp the index to one greater than the last\r\n repIndex = repIndex <= opts.reps.length ? (repIndex < 0 ? 0 : repIndex) : opts.reps.length;\r\n // create a new rep if it is adjacent to the existing ones\r\n if (repIndex === opts.reps.length) {\r\n // if there is no rep to derive from, derive from the first rep of the default\r\n opts.reps[repIndex] = repIndex > 0 ? utils.deriveDeep(opts.reps[repIndex - 1], true)\r\n : utils.deriveDeep(settings.defaults.presets.default[0], true);\r\n }\r\n },\r\n\r\n s: 'select',\r\n select(value, opts) {\r\n ensureRepAssign(opts, 'selector', value);\r\n },\r\n\r\n m: 'mode',\r\n mode(value, opts) {\r\n ensureRepAssign(opts, 'mode', extractArgs(value, settings.defaults.modes));\r\n },\r\n\r\n c: 'color',\r\n color(value, opts) {\r\n ensureRepAssign(opts, 'colorer', extractArgs(value, settings.defaults.colorers));\r\n },\r\n\r\n mt: 'material',\r\n material(value, opts) {\r\n ensureRepAssign(opts, 'material', extractArgs(value, settings.defaults.materials));\r\n },\r\n\r\n dup(value, opts) {\r\n ensureRepList(opts);\r\n const { reps } = opts;\r\n const rep = reps[repIndex];\r\n repIndex = reps.length;\r\n reps[repIndex] = utils.deriveDeep(rep, true);\r\n },\r\n\r\n // Settings shortcuts\r\n\r\n ar: 'autoResolution',\r\n};\r\n\r\nfunction _fromArray(entries) {\r\n repIndex = 0;\r\n\r\n const opts = {};\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const /** string[] */ entry = entries[i];\r\n let /** string? */ key = entry[0];\r\n const /** string? */ value = entry[1];\r\n let /** function|string? */ action = actions[key];\r\n\r\n // unwind shortcuts and aliases\r\n while (_.isString(action)) {\r\n key = action;\r\n action = actions[key];\r\n }\r\n\r\n // either set a property or use specialized parser\r\n if (!action) {\r\n const adapter = adapters[typeof _.get(settings.defaults, key)];\r\n if (adapter) {\r\n _.set(opts, `settings.${key}`, adapter(value));\r\n } else {\r\n logger.warn(`Unknown option \"${key}\"`);\r\n }\r\n } else if (_.isFunction(action)) {\r\n const result = action(value, opts);\r\n if (result !== undefined) {\r\n opts[key] = result;\r\n }\r\n }\r\n }\r\n\r\n return opts;\r\n}\r\n\r\nfunction fromAttr(attr) {\r\n return _fromArray(utils.getUrlParameters(`?${attr || ''}`));\r\n}\r\n\r\nfunction fromURL(url) {\r\n return _fromArray(utils.getUrlParameters(url));\r\n}\r\n\r\nfunction _processOptsForURL(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = encodeQueryComponentL2(key) + cL2Ass + encodeQueryComponentL2(value);\r\n });\r\n return str.join(cLSep);\r\n}\r\n\r\nfunction _processArgsForURL(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]}${cOptsSep}${_processOptsForURL(args[1])}`;\r\n}\r\n\r\nfunction _processObjForURL(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += `,${objOpts.params.join(',')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += cOptsSep + _processOptsForURL(objOpts.opts);\r\n }\r\n return res;\r\n}\r\n\r\nfunction toURL(opts) {\r\n const stringList = [];\r\n let idx = 0;\r\n\r\n function checkAndAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n stringList[idx++] = encodeQueryComponentL1(prefix)\r\n + cL1Ass + encodeQueryComponentL1(value);\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n if (_.isEmpty(repList[i])) {\r\n continue;\r\n }\r\n checkAndAdd('r', i);\r\n checkAndAdd('s', repList[i].selector);\r\n checkAndAdd('m', _processArgsForURL(repList[i].mode));\r\n checkAndAdd('c', _processArgsForURL(repList[i].colorer));\r\n checkAndAdd('mt', _processArgsForURL(repList[i].material));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('o', _processObjForURL(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('l', opts.load);\r\n checkAndAdd('u', opts.unit);\r\n checkAndAdd('p', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n checkAndAdd('v', opts.view);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(key, value);\r\n });\r\n\r\n let url = '';\r\n if (typeof window !== 'undefined') {\r\n const { location } = window;\r\n url = `${location.protocol}//${location.host}${location.pathname}`;\r\n }\r\n if (stringList.length > 0) {\r\n url += `?${stringList.join('&')}`;\r\n }\r\n\r\n return url;\r\n}\r\n\r\nfunction _processOptsForScript(opts) {\r\n const str = [];\r\n let i = 0;\r\n utils.forInRecursive(opts, (value, key) => {\r\n str[i++] = `${key}=${utils.enquoteString(value)}`;\r\n });\r\n return str.join(' ');\r\n}\r\n\r\nfunction _processArgsForScript(args) {\r\n if (!_.isArray(args)) {\r\n return args;\r\n }\r\n if (args.length < 2) {\r\n return args[0];\r\n }\r\n return `${args[0]} ${_processOptsForScript(args[1])}`;\r\n}\r\n\r\nfunction _processObjForScript(objOpts) {\r\n if (!objOpts || !objOpts.type) {\r\n return undefined;\r\n }\r\n let res = objOpts.type;\r\n if (_.isArray(objOpts.params) && objOpts.params.length > 0) {\r\n res += ` ${objOpts.params.map(utils.enquoteString).join(' ')}`;\r\n }\r\n if (objOpts.opts) {\r\n res += ` ${_processOptsForScript(objOpts.opts)}`;\r\n }\r\n return res;\r\n}\r\n\r\nfunction _processRepsForScript(rep, index) {\r\n const repString = [];\r\n let strIdx = 0;\r\n function localAdd(prefix, value) {\r\n if (value !== null && value !== undefined) {\r\n repString[strIdx++] = prefix + value;\r\n }\r\n }\r\n if (_.isEmpty(rep)) {\r\n return null;\r\n }\r\n localAdd('', index);\r\n localAdd('s=', utils.enquoteString(rep.selector));\r\n localAdd('m=', _processArgsForScript(rep.mode));\r\n localAdd('c=', _processArgsForScript(rep.colorer));\r\n localAdd('mt=', _processArgsForScript(rep.material));\r\n return repString.join(' ');\r\n}\r\n\r\nfunction toScript(opts) {\r\n const commandsList = [];\r\n let idx = 0;\r\n function checkAndAdd(command, value, saveQuotes) {\r\n if (value !== null && value !== undefined) {\r\n const quote = (typeof value === 'string' && saveQuotes) ? '\"' : '';\r\n commandsList[idx++] = `${command} ${quote}${value}${quote}`.trim();\r\n }\r\n }\r\n\r\n function addReps(repList) {\r\n if (!repList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = repList.length; i < n; ++i) {\r\n checkAndAdd('rep', _processRepsForScript(repList[i], i));\r\n }\r\n }\r\n\r\n function addObjects(objList) {\r\n if (!objList) {\r\n return;\r\n }\r\n for (let i = 0, n = objList.length; i < n; ++i) {\r\n checkAndAdd('', _processObjForScript(objList[i]));\r\n }\r\n }\r\n\r\n checkAndAdd('set', 'autobuild false');\r\n checkAndAdd('load', opts.load, true);\r\n checkAndAdd('unit', opts.unit);\r\n checkAndAdd('preset', opts.preset);\r\n addReps(opts.reps);\r\n addObjects(opts._objects);\r\n\r\n utils.forInRecursive(opts.settings, (value, key) => {\r\n // I heard these lines in the whispers of the Gods\r\n // Handle preset setting in reps\r\n if (key === 'preset') {\r\n return;\r\n }\r\n checkAndAdd(`set ${key}`, value, true);\r\n });\r\n checkAndAdd('view', opts.view);\r\n checkAndAdd('set', 'autobuild true');\r\n return commandsList.join('\\n');\r\n}\r\n\r\nexport default {\r\n fromURL,\r\n fromAttr,\r\n adapters,\r\n toURL,\r\n toScript,\r\n};\r\n","/**\r\n * Atom measurements.\r\n *\r\n * @param {Residue} residue - (required) Residue containing the atom\r\n * @param {string} name - (required) Name, unique in the residue\r\n * @param {Element} type - (required) Chemical element reference\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n *\r\n * @param {number} role - Role of atom inside monomer: Lead and wing are particularity interesting\r\n * @param {boolean} het - Non-standard residue indicator\r\n *\r\n * @param {number} serial - Serial number, unique in the model\r\n * @param {string} location - Alternative location indicator (usually space or A-Z)\r\n * @param {number} occupancy - Occupancy percentage, from 0 to 1\r\n * @param {number} temperature - Temperature\r\n * @param {number} charge - Charge\r\n *\r\n * @exports Atom\r\n * @constructor\r\n */\r\n\r\nclass Atom {\r\n constructor(residue, name, type, position, role, het, serial, location, occupancy, temperature, charge) {\r\n this.index = -1;\r\n this.residue = residue;\r\n this.name = name;\r\n this.element = type;\r\n this.position = position;\r\n this.role = role;\r\n this.mask = 1 | 0;\r\n\r\n this.het = het;\r\n\r\n this.serial = serial;\r\n this.location = (location || ' ').charCodeAt(0);\r\n this.occupancy = occupancy || 1;\r\n this.temperature = temperature;\r\n this.charge = charge;\r\n this.hydrogenCount = -1; // explicitly invalid\r\n this.radicalCount = 0;\r\n this.valence = -1; // explicitly invalid\r\n\r\n this.bonds = [];\r\n\r\n this.flags = 0x0000;\r\n if (type.name === 'H') {\r\n this.flags |= Atom.Flags.HYDROGEN;\r\n } else if (type.name === 'C') {\r\n this.flags |= Atom.Flags.CARBON;\r\n }\r\n }\r\n\r\n isHet() {\r\n return this.het;\r\n }\r\n\r\n isHydrogen() {\r\n return this.element.number === 1;\r\n }\r\n\r\n getVisualName() {\r\n const { name } = this;\r\n if (name.length > 0) {\r\n return name;\r\n }\r\n return this.element.name.trim();\r\n }\r\n\r\n forEachBond(process) {\r\n const { bonds } = this;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n getFullName() {\r\n let name = '';\r\n if (this.residue !== null) {\r\n if (this.residue._chain !== null) {\r\n name += `${this.residue._chain.getName()}.`;\r\n }\r\n name += `${this.residue._sequence}.`;\r\n }\r\n name += this.name;\r\n return name;\r\n }\r\n\r\n /**\r\n * Enumeration of atom flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n CARBON: 0x0001,\r\n // OXYGEN: 0x0002,\r\n // NITROGEN: 0x0004,\r\n HYDROGEN: 0x0008,\r\n /** Non-polar hydrogen (it is also a HYDROGEN) */\r\n NONPOLARH: 0x1008,\r\n };\r\n}\r\n\r\nexport default Atom;\r\n","class Element {\r\n constructor(number, name, fullName, weight, radius, radiusBonding, hValency) {\r\n this.number = number;\r\n this.name = name;\r\n this.fullName = fullName;\r\n this.weight = weight;\r\n this.radius = radius;\r\n this.radiusBonding = radiusBonding;\r\n this.hydrogenValency = hValency;\r\n }\r\n\r\n static Constants = {\r\n /* eslint-disable no-magic-numbers */\r\n U1: 1,\r\n Lead: 2,\r\n U2: 3,\r\n Wing: 4,\r\n U18: 18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n static Role = {\r\n /* eslint-disable no-magic-numbers */\r\n N: Element.Constants.U1,\r\n CA: Element.Constants.Lead,\r\n C: Element.Constants.U2,\r\n O: Element.Constants.Wing,\r\n SG: Element.Constants.U18,\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByAtomicNumber = [\r\n /* eslint-disable no-magic-numbers */\r\n null,\r\n new Element(1, 'H', 'Hydrogen', 1.008, 1.2, 0.23, [1]),\r\n new Element(2, 'HE', 'Helium', 4.003, 1.4, 0.93, [0]),\r\n new Element(3, 'LI', 'Lithium', 6.941, 1.82, 0.68, [1]),\r\n new Element(4, 'BE', 'Beryllium', 9.012, 1.7, 0.35, [2]),\r\n new Element(5, 'B', 'Boron', 10.81, 2.08, 0.83, [3]),\r\n new Element(6, 'C', 'Carbon', 12.011, 1.95, 0.68, [4]),\r\n new Element(7, 'N', 'Nitrogen', 14.007, 1.85, 0.68, [3, 5]),\r\n new Element(8, 'O', 'Oxygen', 15.999, 1.7, 0.68, [2, 4]),\r\n new Element(9, 'F', 'Fluorine', 18.998, 1.73, 0.64, [1]),\r\n new Element(10, 'NE', 'Neon', 20.18, 1.54, 1.12, [0]),\r\n new Element(11, 'NA', 'Sodium', 22.99, 2.27, 0.97, [1]),\r\n new Element(12, 'MG', 'Magnesium', 24.305, 1.73, 1.1, [2]),\r\n new Element(13, 'AL', 'Aluminum', 26.981, 2.05, 1.35, [3]),\r\n new Element(14, 'SI', 'Silicon', 28.086, 2.1, 1.2, [4]),\r\n new Element(15, 'P', 'Phosphorus', 30.974, 2.08, 0.75, [3, 5]),\r\n new Element(16, 'S', 'Sulfur', 32.07, 2, 1.02, [2, 4, 6]),\r\n new Element(17, 'CL', 'Chlorine', 35.453, 1.97, 0.99, [1, 3, 5, 7]),\r\n new Element(18, 'AR', 'Argon', 39.948, 1.88, 1.57, [0]),\r\n new Element(19, 'K', 'Potassium', 39.1, 2.75, 1.33, [1]),\r\n new Element(20, 'CA', 'Calcium', 40.08, 1.973, 0.99, [2]),\r\n new Element(21, 'SC', 'Scandium', 44.956, 1.7, 1.44, [0]),\r\n new Element(22, 'TI', 'Titanium', 47.88, 1.7, 1.47, [0]),\r\n new Element(23, 'V', 'Vanadium', 50.941, 1.7, 1.33, [0]),\r\n new Element(24, 'CR', 'Chromium', 52, 1.7, 1.35, [0]),\r\n new Element(25, 'MN', 'Manganese', 54.938, 1.7, 1.35, [0]),\r\n new Element(26, 'FE', 'Iron', 55.847, 1.7, 1.34, [0]),\r\n new Element(27, 'CO', 'Cobalt', 58.93, 1.7, 1.33, [0]),\r\n new Element(28, 'NI', 'Nickel', 58.69, 1.63, 1.5, [0]),\r\n new Element(29, 'CU', 'Copper', 63.55, 1.4, 1.52, [0]),\r\n new Element(30, 'ZN', 'Zinc', 65.39, 1.39, 1.45, [0]),\r\n new Element(31, 'GA', 'Gallium', 69.72, 1.87, 1.22, [3]),\r\n new Element(32, 'GE', 'Germanium', 72.61, 1.7, 1.17, [4]),\r\n new Element(33, 'AS', 'Arsenic', 74.92, 1.85, 1.21, [3, 5]),\r\n new Element(34, 'SE', 'Selenium', 78.96, 1.9, 1.22, [2, 4, 6]),\r\n new Element(35, 'BR', 'Bromine', 79.9, 2.1, 1.21, [1, 3, 5, 7]),\r\n new Element(36, 'KR', 'Krypton', 83.8, 2.02, 1.91, [0]),\r\n new Element(37, 'RB', 'Rubidium', 85.47, 1.7, 1.47, [1]),\r\n new Element(38, 'SR', 'Strontium', 87.62, 1.7, 1.12, [2]),\r\n new Element(39, 'Y', 'Yttrium', 88.91, 1.7, 1.78, [0]),\r\n new Element(40, 'ZR', 'Zirconium', 91.22, 1.7, 1.56, [0]),\r\n new Element(41, 'NB', 'Niobium', 92.91, 1.7, 1.48, [0]),\r\n new Element(42, 'MO', 'Molybdenum', 95.94, 1.7, 1.47, [0]),\r\n new Element(43, 'TC', 'Technetium', 98.91, 1.7, 1.35, [0]),\r\n new Element(44, 'RU', 'Ruthenium', 101.07, 1.7, 1.4, [0]),\r\n new Element(45, 'RH', 'Rhodium', 102.91, 1.7, 1.45, [0]),\r\n new Element(46, 'PD', 'Palladium', 106.42, 1.63, 1.5, [0]),\r\n new Element(47, 'AG', 'Silver', 107.87, 1.72, 1.59, [0]),\r\n new Element(48, 'CD', 'Cadmium', 112.41, 1.58, 1.69, [0]),\r\n new Element(49, 'IN', 'Indium', 114.82, 1.93, 1.63, [3]),\r\n new Element(50, 'SN', 'Tin', 118.71, 2.17, 1.46, [2, 4]),\r\n new Element(51, 'SB', 'Antimony', 121.75, 2.2, 1.46, [3, 5]),\r\n new Element(52, 'TE', 'Tellurium', 127.6, 2.06, 1.47, [2, 4, 6]),\r\n new Element(53, 'I', 'Iodine', 126.91, 2.15, 1.4, [1, 3, 5, 7]),\r\n new Element(54, 'XE', 'Xenon', 131.29, 2.16, 1.98, [0]),\r\n new Element(55, 'CS', 'Cesium', 132.91, 1.7, 1.67, [1]),\r\n new Element(56, 'BA', 'Barium', 137.33, 1.7, 1.34, [2]),\r\n new Element(57, 'LA', 'Lanthanum', 138.91, 1.7, 1.87, [0]),\r\n new Element(58, 'CE', 'Cerium', 140.12, 1.7, 1.83, [0]),\r\n new Element(59, 'PR', 'Praseodymium', 140.91, 1.7, 1.82, [0]),\r\n new Element(60, 'ND', 'Neodymium', 144.24, 1.7, 1.81, [0]),\r\n new Element(61, 'PM', 'Promethium', 144.9, 1.7, 1.8, [0]),\r\n new Element(62, 'SM', 'Samarium', 150.36, 1.7, 1.8, [0]),\r\n new Element(63, 'EU', 'Europium', 151.96, 1.7, 1.99, [0]),\r\n new Element(64, 'GD', 'Gadolinium', 157.25, 1.7, 1.79, [0]),\r\n new Element(65, 'TB', 'Terbium', 158.93, 1.7, 1.76, [0]),\r\n new Element(66, 'DY', 'Dysprosium', 162.5, 1.7, 1.75, [0]),\r\n new Element(67, 'HO', 'Holmium', 164.93, 1.7, 1.74, [0]),\r\n new Element(68, 'ER', 'Erbium', 167.26, 1.7, 1.73, [0]),\r\n new Element(69, 'TM', 'Thulium', 168.93, 1.7, 1.72, [0]),\r\n new Element(70, 'YB', 'Ytterbium', 173.04, 1.7, 1.94, [0]),\r\n new Element(71, 'LU', 'Lutetium', 174.97, 1.7, 1.72, [0]),\r\n new Element(72, 'HF', 'Hafnium', 178.49, 1.7, 1.57, [0]),\r\n new Element(73, 'TA', 'Tantalum', 180.95, 1.7, 1.43, [0]),\r\n new Element(74, 'W', 'Tungsten', 183.85, 1.7, 1.37, [0]),\r\n new Element(75, 'RE', 'Rhenium', 186.21, 1.7, 1.35, [0]),\r\n new Element(76, 'OS', 'Osmium', 190.2, 1.7, 1.37, [0]),\r\n new Element(77, 'IR', 'Iridium', 192.22, 1.7, 1.32, [0]),\r\n new Element(78, 'PT', 'Platinum', 195.08, 1.72, 1.5, [0]),\r\n new Element(79, 'AU', 'Gold', 196.97, 1.66, 1.5, [0]),\r\n new Element(80, 'HG', 'Mercury', 200.59, 1.55, 1.7, [0]),\r\n new Element(81, 'TL', 'Thallium', 204.38, 1.96, 1.55, [1, 3]),\r\n new Element(82, 'PB', 'Lead', 207.2, 2.02, 1.54, [2, 4]),\r\n new Element(83, 'BI', 'Bismuth', 208.98, 1.7, 1.54, [3, 5]),\r\n new Element(84, 'PO', 'Polonium', 210, 1.7, 1.68, [2, 4, 6]),\r\n new Element(85, 'AT', 'Astatine', 210, 1.7, 1.7, [1, 3, 5, 7]),\r\n new Element(86, 'RN', 'Radon', 222, 1.7, 2.4, [0]),\r\n new Element(87, 'FR', 'Francium', 223, 1.7, 2, [1]),\r\n new Element(88, 'RA', 'Radium', 226.03, 1.7, 1.9, [2]),\r\n new Element(89, 'AC', 'Actinium', 227.03, 1.7, 1.88, [0]),\r\n new Element(90, 'TH', 'Thorium', 232.04, 1.7, 1.79, [0]),\r\n new Element(91, 'PA', 'Protactinium', 231.04, 1.7, 1.61, [0]),\r\n new Element(92, 'U', 'Uranium', 238.03, 1.86, 1.58, [0]),\r\n new Element(93, 'NP', 'Neptunium', 237.05, 1.7, 1.55, [0]),\r\n new Element(94, 'PU', 'Plutonium', 239.1, 1.7, 1.53, [0]),\r\n new Element(95, 'AM', 'Americium', 243.1, 1.7, 1.51, [0]),\r\n new Element(96, 'CM', 'Curium', 247.1, 1.7, 1.5, [0]),\r\n new Element(97, 'BK', 'Berkelium', 247.1, 1.7, 1.5, [0]),\r\n new Element(98, 'CF', 'Californium', 252.1, 1.7, 1.5, [0]),\r\n new Element(99, 'ES', 'Einsteinium', 252.1, 1.7, 1.5, [0]),\r\n new Element(100, 'FM', 'Fermium', 257.1, 1.7, 1.5, [0]),\r\n new Element(101, 'MD', 'Mendelevium', 256.1, 1.7, 1.5, [0]),\r\n new Element(102, 'NO', 'Nobelium', 259.1, 1.7, 1.5, [0]),\r\n new Element(103, 'LR', 'Lawrencium', 260.1, 1.7, 1.5, [0]),\r\n new Element(104, 'RF', 'Rutherfordium', 261, 1.7, 1.6, [0]),\r\n new Element(105, 'DB', 'Dubnium', 262, 1.7, 1.6, [0]),\r\n new Element(106, 'SG', 'Seaborgium', 263, 1.7, 1.6, [0]),\r\n new Element(107, 'BH', 'Bohrium', 262, 1.7, 1.6, [0]),\r\n new Element(108, 'HS', 'Hassium', 265, 1.7, 1.6, [0]),\r\n new Element(109, 'MT', 'Meitnerium', 268, 1.7, 1.6, [0]),\r\n /* eslint-enable no-magic-numbers */\r\n ];\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\n static ByName = {\r\n // Duplicate atomic numbers (isotopes)\r\n /* eslint-disable no-magic-numbers */\r\n D: new Element(1, 'D', 'Deuterium', 2.014, 1.2, 0.23, [1]),\r\n T: new Element(1, 'T', 'Tritium', 3.016, 1.2, 0.23, [1]),\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // All regular elements will be added later, automatically\r\n };\r\n}\r\n\r\n(function () {\r\n const byAtomicNumber = Element.ByAtomicNumber;\r\n const byName = Element.ByName;\r\n for (let i = 0, n = byAtomicNumber.length; i < n; ++i) {\r\n const element = byAtomicNumber[i];\r\n if (element) {\r\n byName[element.name] = element;\r\n }\r\n }\r\n}());\r\n\r\n// find atom type by chemical element (or create if missing)\r\nElement.getByName = function (element) {\r\n let type = Element.ByName[element];\r\n if (!type) {\r\n type = Element.ByName[element] = new Element(0, element, 'Unknown', 0, 1.0, 0.01, [0]);\r\n }\r\n return type;\r\n};\r\n\r\nexport default Element;\r\n","const cBondTypes = {\r\n /** Was generated manually */\r\n UNKNOWN: 0,\r\n /** Simple covalent bond */\r\n COVALENT: 1,\r\n /** Aromatic bond */\r\n AROMATIC: 2,\r\n};\r\n\r\nfunction getAtomPos(atom) {\r\n return atom.position;\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Atom} left - The first atom.\r\n * @param {Atom} right - The second atom.\r\n * @param {number} order - Order of current bond.\r\n * @param {number} type - Bond type.\r\n * @param {boolean} fixed - Indicator of a pre-specified connection (in contrast with guessed one).\r\n *\r\n * @exports Bond\r\n * @constructor\r\n */\r\nclass Bond {\r\n constructor(left, right, order, type, fixed) {\r\n this._left = left;\r\n this._right = right;\r\n this._fixed = fixed;\r\n this._index = -1;\r\n if (left > right) {\r\n throw new Error('In a bond atom indices must be in increasing order');\r\n }\r\n this._order = order;\r\n this._type = type;\r\n }\r\n\r\n getLeft() {\r\n return this._left;\r\n }\r\n\r\n getRight() {\r\n return this._right;\r\n }\r\n\r\n getOrder() {\r\n return this._order;\r\n }\r\n\r\n calcLength() {\r\n return this._left.position.distanceTo(this._right.position);\r\n }\r\n\r\n _forEachNeighbour(currAtom, process) {\r\n const { bonds } = currAtom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]._left !== currAtom ? bonds[i]._left : bonds[i]._right);\r\n }\r\n }\r\n\r\n forEachLevelOne(process) {\r\n const left = this._left;\r\n const right = this._right;\r\n this._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n this._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n process(atom);\r\n });\r\n }\r\n\r\n forEachLevelTwo(process) {\r\n // TODO refactor this piece of an art?\r\n const left = this._left;\r\n const right = this._right;\r\n const self = this;\r\n self._forEachNeighbour(left, (atom) => {\r\n if (atom === right) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === left) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n self._forEachNeighbour(right, (atom) => {\r\n if (atom === left) {\r\n return;\r\n }\r\n self._forEachNeighbour(atom, (l2Atom) => {\r\n if (l2Atom === right) {\r\n return;\r\n }\r\n process(l2Atom);\r\n });\r\n });\r\n }\r\n\r\n _fixDir(refPoint, currDir, posGetter) {\r\n // count atoms to the right and to the left of the current plane\r\n let rightCount = 0;\r\n let leftCount = 0;\r\n const tmpVec = refPoint.clone();\r\n function checkDir(atom) {\r\n tmpVec.copy(posGetter(atom));\r\n tmpVec.sub(refPoint);\r\n const dotProd = currDir.dot(tmpVec);\r\n if (dotProd > 0) {\r\n ++rightCount;\r\n } else {\r\n ++leftCount;\r\n }\r\n }\r\n function checkCarbon(atom) {\r\n if (atom.element.name === 'C') {\r\n checkDir(atom);\r\n }\r\n }\r\n // count all atoms to the left and right of our plane, start from level 1 and carbons\r\n const stages = [\r\n [this.forEachLevelOne, checkCarbon],\r\n [this.forEachLevelOne, checkDir],\r\n [this.forEachLevelTwo, checkCarbon],\r\n [this.forEachLevelTwo, checkDir],\r\n ];\r\n\r\n for (let stageId = 0; stageId < stages.length; ++stageId) {\r\n stages[stageId][0].call(this, stages[stageId][1]);\r\n if (leftCount > rightCount) {\r\n return currDir.multiplyScalar(-1);\r\n }\r\n if (leftCount < rightCount) {\r\n return currDir;\r\n }\r\n }\r\n return currDir;\r\n }\r\n\r\n calcNormalDir(posGetter) {\r\n const left = this._left;\r\n const right = this._right;\r\n let first = left;\r\n let second = right;\r\n posGetter = posGetter === undefined ? getAtomPos : posGetter;\r\n if (left.bonds.length > right.bonds.length) {\r\n first = right;\r\n second = left;\r\n }\r\n let third = first;\r\n let maxNeibs = 0;\r\n const { bonds } = second;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n let another = bonds[i]._left;\r\n if (bonds[i]._left === second) {\r\n another = bonds[i]._right;\r\n }\r\n if (another.bonds.length > maxNeibs && another !== first) {\r\n third = another;\r\n maxNeibs = another.bonds.length;\r\n }\r\n }\r\n const secondPos = posGetter(second);\r\n const firstV = posGetter(first).clone().sub(secondPos);\r\n const secondV = posGetter(third).clone().sub(secondPos);\r\n secondV.crossVectors(firstV, secondV);\r\n if (secondV.lengthSq() < 0.0001) {\r\n secondV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n secondV.normalize();\r\n firstV.crossVectors(secondV, firstV);\r\n if (firstV.lengthSq() < 0.0001) {\r\n firstV.set(0, 1, 0);\r\n }\r\n firstV.normalize();\r\n return this._fixDir(secondPos, firstV, posGetter);\r\n }\r\n\r\n static BondType = cBondTypes;\r\n}\r\n\r\nBond.prototype.BondType = cBondTypes;\r\n\r\nexport default Bond;\r\n","import * as THREE from 'three';\r\nimport Atom from './Atom';\r\nimport Element from './Element';\r\n\r\nconst cNucleicControlNames = ['C3\\'', 'C3*', 'P', 'H5T', 'H3T'];\r\nconst cNucleicWing1Names = ['OP1', 'O1P'];\r\nconst cNucleicWing2Names = ['OP2', 'O2P'];\r\n\r\nconst cCylinderSource = ['C3\\'', 'C3*', 'C1', 'C1\\'', 'C1*', 'P'];\r\nconst cCylinderTarget = [{\r\n types: ['A', 'DA', 'G', 'DG'],\r\n atoms: ['N1'],\r\n}, {\r\n types: ['C', 'DC'],\r\n atoms: ['N3'],\r\n}, {\r\n types: ['T', 'DT', 'U', 'DU'],\r\n atoms: ['O4'],\r\n}];\r\n\r\n/**\r\n * Residue instance.\r\n *\r\n * @param {Chain} chain - Chain this residue belongs to.\r\n * @param {ResidueType} type - Generic residue instance type.\r\n * @param {number} sequence - Sequence ID.\r\n * @param {string} icode - One character insertion code (usually space or A-Z).\r\n *\r\n * @exports Residue\r\n * @constructor\r\n */\r\nclass Residue {\r\n constructor(chain, type, sequence, icode) {\r\n this._chain = chain;\r\n this._component = null;\r\n this._type = type;\r\n this._sequence = sequence;\r\n this._icode = icode;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n\r\n this._atoms = [];\r\n this._secondary = null;\r\n this._firstAtom = null;\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n this._lastAtom = null;\r\n this._controlPoint = null;\r\n this._midPoint = null;\r\n this._wingVector = null;\r\n this._cylinders = null;\r\n this._isValid = true;\r\n this._het = false;\r\n this._molecule = null;\r\n this.temperature = null;\r\n this.occupancy = null;\r\n }\r\n\r\n // Getters and setters\r\n getChain() {\r\n return this._chain;\r\n }\r\n\r\n getMolecule() {\r\n return this._molecule;\r\n }\r\n\r\n getType() {\r\n return this._type;\r\n }\r\n\r\n getSequence() {\r\n return this._sequence;\r\n }\r\n\r\n getSecondary() {\r\n return this._secondary;\r\n }\r\n\r\n getICode() {\r\n return this._icode;\r\n }\r\n\r\n // Other methods\r\n\r\n addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge) {\r\n const atom = new Atom(this, name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n const complex = this._chain.getComplex();\r\n complex.addAtom(atom);\r\n this._atoms.push(atom);\r\n this._het = this._het || het;\r\n return atom;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n if (process(atoms[i])) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n _findAtomByName(name) {\r\n let res = null;\r\n this.forEachAtom((atom) => {\r\n if (atom.name === name) {\r\n res = atom;\r\n return true;\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _findFirstAtomInList(names) {\r\n let res = null;\r\n for (let i = 0; i < names.length; ++i) {\r\n res = this._findAtomByName(names[i]);\r\n if (res !== null) {\r\n return res;\r\n }\r\n }\r\n return res;\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n mask &= atoms[i].mask;\r\n }\r\n this._mask = mask;\r\n }\r\n\r\n getCylinderTargetList() {\r\n const type = this._type._name;\r\n for (let i = 0, n = cCylinderTarget.length; i < n; ++i) {\r\n for (let j = 0, m = cCylinderTarget[i].types.length; j < m; ++j) {\r\n if (type === cCylinderTarget[i].types[j]) {\r\n return cCylinderTarget[i].atoms;\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n _detectLeadWing(dst, next, getAtomPosition) {\r\n const leadAtom = this._findFirstAtomInList(cNucleicControlNames);\r\n let wingStart = this._findFirstAtomInList(cNucleicWing1Names);\r\n let wingEnd = this._findFirstAtomInList(cNucleicWing2Names);\r\n\r\n if (wingStart === null && next !== null) {\r\n wingStart = next._findFirstAtomInList(cNucleicWing1Names);\r\n }\r\n\r\n if (wingEnd === null && next !== null) {\r\n wingEnd = next._findFirstAtomInList(cNucleicWing2Names);\r\n }\r\n\r\n if (leadAtom === null || wingStart === null || wingEnd === null) {\r\n return;\r\n }\r\n\r\n dst._leadAtom = leadAtom;\r\n dst._controlPoint = getAtomPosition(leadAtom);\r\n dst._wingVector = getAtomPosition(wingEnd).clone().sub(getAtomPosition(wingStart));\r\n dst._isValid = true;\r\n\r\n const cylSource = this._findFirstAtomInList(cCylinderSource);\r\n const targetList = this.getCylinderTargetList();\r\n const cylTarget = targetList !== null ? this._findFirstAtomInList(targetList) : null;\r\n if (cylSource === null || cylTarget === null) {\r\n return;\r\n }\r\n dst._cylinders = [getAtomPosition(cylSource), getAtomPosition(cylTarget)];\r\n }\r\n\r\n calcWing(prevLeadPos, currLeadPos, prevWingPos, prevWing) {\r\n const vectorA = currLeadPos.clone().sub(prevLeadPos);\r\n const vectorB = prevLeadPos.clone().sub(prevWingPos);\r\n vectorB.crossVectors(vectorA, vectorB);\r\n vectorB.crossVectors(vectorA, vectorB).normalize();\r\n if (prevWing !== null && prevWing.length() > 0.0001) {\r\n const needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2;\r\n if (needToNegate) {\r\n vectorB.negate();\r\n }\r\n }\r\n return vectorB;\r\n }\r\n\r\n _innerFinalize(prevRes, prev, nextRes, dst, chainAsNucleic, getAtomPosition) {\r\n const bFirstInChain = prev === null;\r\n\r\n const lp = getAtomPosition(this._leadAtom);\r\n const currLeadPos = new THREE.Vector3(lp.x, lp.y, lp.z);\r\n if (chainAsNucleic) {\r\n this._detectLeadWing(dst, nextRes, getAtomPosition);\r\n return;\r\n }\r\n\r\n if (bFirstInChain) { // for first one in chain\r\n dst._midPoint = getAtomPosition(this._firstAtom).clone();\r\n } else {\r\n const prevLeadPos = prev._controlPoint; // lead point of previous monomer\r\n dst._midPoint = prevLeadPos.clone().lerp(currLeadPos, 0.5);\r\n dst._wingVector = this.calcWing(prevLeadPos, currLeadPos, getAtomPosition(prevRes._wingAtom), prev._wingVector);\r\n }\r\n dst._controlPoint = currLeadPos;\r\n }\r\n\r\n _finalize2(prev, next, asNucleic) {\r\n // Should be called AFTER first finalize\r\n this._innerFinalize(prev, prev, next, this, asNucleic, (atom) => atom.position);\r\n }\r\n\r\n isConnected(anotherResidue) {\r\n if (this._chain !== anotherResidue._chain) {\r\n return false;\r\n }\r\n if (this === anotherResidue) {\r\n return true;\r\n }\r\n let res = false;\r\n this.forEachAtom((atom) => {\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue === anotherResidue || bond._right.residue === anotherResidue) {\r\n res = true;\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n return res;\r\n }\r\n\r\n _finalize() {\r\n const self = this;\r\n [this._firstAtom] = this._atoms;\r\n this._lastAtom = this._atoms[this._atoms.length - 1];\r\n\r\n this._leadAtom = null;\r\n this._wingAtom = null;\r\n\r\n let tempCount = 0;\r\n let temperature = 0; // average temperature\r\n let occupCount = 0;\r\n let occupancy = 0; // average occupancy\r\n this.forEachAtom((a) => {\r\n if (self._leadAtom === null) {\r\n if (a.role === Element.Constants.Lead) {\r\n self._leadAtom = a;\r\n }\r\n }\r\n if (self._wingAtom === null) {\r\n if (a.role === Element.Constants.Wing) {\r\n self._wingAtom = a;\r\n }\r\n }\r\n if (a.temperature) {\r\n temperature += a.temperature;\r\n tempCount++;\r\n }\r\n if (a.occupancy) {\r\n occupancy += a.occupancy;\r\n occupCount++;\r\n }\r\n return (self._leadAtom !== null && self._wingAtom !== null);\r\n });\r\n\r\n if (tempCount > 0) {\r\n this.temperature = temperature / tempCount;\r\n }\r\n if (occupCount > 0) {\r\n this.occupancy = occupancy / occupCount;\r\n }\r\n\r\n // Still try to make monomer look valid\r\n if (this._leadAtom === null || this._wingAtom === null) {\r\n this._isValid = false;\r\n }\r\n if (this._leadAtom === null) {\r\n this._leadAtom = this._firstAtom;\r\n }\r\n if (this._wingAtom === null) {\r\n this._wingAtom = this._lastAtom;\r\n }\r\n }\r\n}\r\n\r\nexport default Residue;\r\n","/**\r\n * Residue type.\r\n *\r\n * Predefined acid or created with HET, HETNAM, etc.\r\n *\r\n * @param {string} name - Short name, either standard (ALA, MET, etc.) or non-standard one.\r\n * @param {string} fullName - Full residue name.\r\n * @param {string} letterCode - 1-letter symbol.\r\n *\r\n * @exports ResidueType\r\n * @constructor\r\n */\r\nclass ResidueType {\r\n constructor(name, fullName, letterCode) {\r\n this._name = name;\r\n this._fullName = fullName;\r\n this.letterCode = letterCode;\r\n this.flags = 0x0000;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n // DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\n static StandardTypes = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: new ResidueType('ALA', 'Alanine', 'A'),\r\n ARG: new ResidueType('ARG', 'Arginine', 'R'),\r\n ASN: new ResidueType('ASN', 'Asparagine', 'N'),\r\n ASP: new ResidueType('ASP', 'Aspartic Acid', 'D'),\r\n CYS: new ResidueType('CYS', 'Cysteine', 'C'),\r\n GLN: new ResidueType('GLN', 'Glutamine', 'Q'),\r\n GLU: new ResidueType('GLU', 'Glutamic Acid', 'E'),\r\n GLY: new ResidueType('GLY', 'Glycine', 'G'),\r\n HIS: new ResidueType('HIS', 'Histidine', 'H'),\r\n ILE: new ResidueType('ILE', 'Isoleucine', 'I'),\r\n LEU: new ResidueType('LEU', 'Leucine', 'L'),\r\n LYS: new ResidueType('LYS', 'Lysine', 'K'),\r\n MET: new ResidueType('MET', 'Methionine', 'M'),\r\n PHE: new ResidueType('PHE', 'Phenylalanine', 'F'),\r\n PRO: new ResidueType('PRO', 'Proline', 'P'),\r\n PYL: new ResidueType('PYL', 'Pyrrolysine', 'O'),\r\n SEC: new ResidueType('SEC', 'Selenocysteine', 'U'),\r\n SER: new ResidueType('SER', 'Serine', 'S'),\r\n THR: new ResidueType('THR', 'Threonine', 'T'),\r\n TRP: new ResidueType('TRP', 'Tryptophan', 'W'),\r\n TYR: new ResidueType('TYR', 'Tyrosine', 'Y'),\r\n VAL: new ResidueType('VAL', 'Valine', 'V'),\r\n A: new ResidueType('A', 'Adenine', 'A'),\r\n C: new ResidueType('C', 'Cytosine', 'C'),\r\n G: new ResidueType('G', 'Guanine', 'G'),\r\n I: new ResidueType('I', 'Inosine', 'I'),\r\n T: new ResidueType('T', 'Thymine', 'T'),\r\n U: new ResidueType('U', 'Uracil', 'U'),\r\n DA: new ResidueType('DA', 'Adenine', 'A'),\r\n DC: new ResidueType('DC', 'Cytosine', 'C'),\r\n DG: new ResidueType('DG', 'Guanine', 'G'),\r\n DI: new ResidueType('DI', 'Inosine', 'I'),\r\n DT: new ResidueType('DT', 'Thymine', 'T'),\r\n DU: new ResidueType('DU', 'Uracil', 'U'),\r\n '+A': new ResidueType('+A', 'Adenine', 'A'),\r\n '+C': new ResidueType('+C', 'Cytosine', 'C'),\r\n '+G': new ResidueType('+G', 'Guanine', 'G'),\r\n '+I': new ResidueType('+I', 'Inosine', 'I'),\r\n '+T': new ResidueType('+T', 'Thymine', 'T'),\r\n '+U': new ResidueType('+U', 'Uracil', 'U'),\r\n WAT: new ResidueType('WAT', 'Water', ''),\r\n H2O: new ResidueType('H2O', 'Water', ''),\r\n HOH: new ResidueType('HOH', 'Water', ''),\r\n DOD: new ResidueType('DOD', 'Water', ''),\r\n UNK: new ResidueType('UNK', 'Unknown', ''),\r\n UNL: new ResidueType('UNL', 'Unknown Ligand', ''),\r\n /* eslint-enable no-magic-numbers */\r\n };\r\n\r\n /**\r\n * Enumeration of residue flag values.\r\n *\r\n * @enum {number}\r\n * @readonly\r\n */\r\n static Flags = {\r\n // Amino acids\r\n /** Amino acid residue */\r\n PROTEIN: 0x0001,\r\n /** Basic amino acid residue */\r\n BASIC: 0x0002,\r\n /** Acidic amino acid residue */\r\n ACIDIC: 0x0004,\r\n /** Polar uncharged side chain amino acid residue */\r\n POLAR: 0x0008,\r\n /** Non-polar hydrophobic side chain amino acid residue */\r\n NONPOLAR: 0x0010,\r\n /** Aromatic amino acid residue */\r\n AROMATIC: 0x0020,\r\n\r\n // Nucleic acids\r\n\r\n /** Nucleic residue */\r\n NUCLEIC: 0x0100,\r\n /** Purine nucleic residue */\r\n PURINE: 0x0200,\r\n /** Pyrimidine nucleic residue */\r\n PYRIMIDINE: 0x0400,\r\n /** DNA */\r\n DNA: 0x0800,\r\n /** RNA */\r\n RNA: 0x1000,\r\n\r\n /** Water */\r\n WATER: 0x10000,\r\n };\r\n}\r\n\r\n// Flag combinations\r\nfunction _addFlag(flag, list) {\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const res = ResidueType.StandardTypes[list[i]];\r\n if (res) {\r\n res.flags |= flag;\r\n }\r\n }\r\n}\r\n\r\nconst { Flags } = ResidueType;\r\n_addFlag(Flags.WATER, ['WAT', 'H2O', 'HOH', 'DOD']);\r\n\r\n_addFlag(Flags.PROTEIN, [\r\n 'ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLY', 'GLU', 'GLN', 'HIS', 'ILE',\r\n 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'PYL', 'SEC', 'SER', 'THR', 'TRP',\r\n 'TYR', 'VAL',\r\n]);\r\n_addFlag(Flags.BASIC, ['ARG', 'HIS', 'LYS']);\r\n_addFlag(Flags.ACIDIC, ['ASP', 'GLU']);\r\n_addFlag(Flags.POLAR, ['ASN', 'CYS', 'GLN', 'SER', 'THR', 'TYR']);\r\n_addFlag(Flags.NONPOLAR, ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'VAL', 'GLY']);\r\n_addFlag(Flags.AROMATIC, ['PHE', 'TRP', 'TYR']);\r\n\r\n_addFlag(Flags.NUCLEIC, [\r\n 'A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I',\r\n 'C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U',\r\n]);\r\n_addFlag(Flags.PURINE, ['A', 'G', 'I', 'DA', 'DG', 'DI', '+A', '+G', '+I']);\r\n_addFlag(Flags.PYRIMIDINE, ['C', 'T', 'U', 'DC', 'DT', 'DU', '+C', '+T', '+U']);\r\n_addFlag(Flags.DNA, ['DA', 'DG', 'DI', 'DC', 'DT', 'DU']);\r\n_addFlag(Flags.RNA, ['A', 'G', 'I', 'C', 'T', 'U']);\r\n// Table of kdHydrophobicity\r\nconst hydro = {\r\n ILE: 4.5,\r\n VAL: 4.2,\r\n LEU: 3.8,\r\n PHE: 2.8,\r\n CYS: 2.5,\r\n MET: 1.9,\r\n ALA: 1.8,\r\n GLY: -0.4,\r\n THR: -0.7,\r\n SER: -0.8,\r\n TRP: -0.9,\r\n TYR: -1.3,\r\n PRO: -1.6,\r\n HIS: -3.2,\r\n GLU: -3.5,\r\n GLN: -3.5,\r\n ASP: -3.5,\r\n ASN: -3.5,\r\n LYS: -3.9,\r\n ARG: -4.5,\r\n};\r\n\r\nfunction _addParam(param, list) {\r\n const keys = Object.keys(list);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const key = keys[i];\r\n const value = list[key];\r\n ResidueType.StandardTypes[key][param] = value;\r\n }\r\n}\r\n\r\n_addParam('hydrophobicity', hydro);\r\n\r\nexport default ResidueType;\r\n","import * as THREE from 'three';\r\nimport Residue from './Residue';\r\nimport ResidueType from './ResidueType';\r\n\r\n/**\r\n * Residues in chain are either amino acid either nucleic acid (and water)\r\n * There might be some modified/mutated residues, which type could not be determined by their name (nucleic or amino); In this\r\n * case firstly program definites the chain type (by well-known residues) and then definites modified/mutated residues\r\n */\r\nconst ChainType = {\r\n UNKNOWN: 0,\r\n PROTEIN: 1,\r\n NUCLEIC: 2,\r\n};\r\n\r\n/**\r\n * Residue chain.\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n * @param {string} name - One character identifier (usually space, A-Z, 0-9, or a-z).\r\n *\r\n * @exports Chain\r\n * @constructor\r\n */\r\nclass Chain {\r\n constructor(complex, name) {\r\n this._complex = complex;\r\n this._name = name;\r\n this._mask = 1 | 0;\r\n this._index = -1;\r\n this._residues = [];\r\n\r\n this.minSequence = Number.POSITIVE_INFINITY;\r\n this.maxSequence = Number.NEGATIVE_INFINITY;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n _determineType() {\r\n const residues = this._residues;\r\n\r\n const { PROTEIN, NUCLEIC } = ResidueType.Flags;\r\n\r\n this.type = ChainType.UNKNOWN;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const { flags } = residues[i]._type;\r\n\r\n if ((flags & NUCLEIC) !== 0) {\r\n this.type = ChainType.NUCLEIC;\r\n break;\r\n } else if ((flags & PROTEIN) !== 0) {\r\n this.type = ChainType.PROTEIN;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Finds thre residue with specified sequence number and inserion code\r\n * @param {Number} seqNum sequence number\r\n * @param {string} iCode insertion code\r\n * @returns {*} Residue or null if not found\r\n */\r\n findResidue(seqNum, iCode) {\r\n const residues = this._residues;\r\n\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n if (res._sequence === seqNum && res._icode === iCode) {\r\n return [res, i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _finalize() {\r\n this._determineType();\r\n\r\n const residues = this._residues;\r\n\r\n let prev = null;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n const next = (i + 1 < n) ? residues[i + 1] : null;\r\n const curr = residues[i];\r\n // TODO: skip invalid residues\r\n if (1 /* curr._isValid */) { // eslint-disable-line no-constant-condition\r\n curr._finalize2(prev, next, this.type === ChainType.NUCLEIC);\r\n prev = curr;\r\n }\r\n }\r\n\r\n // fix very first wing\r\n if (residues.length > 1 && residues[1]._wingVector) {\r\n const p = residues[1]._wingVector;\r\n residues[0]._wingVector = new THREE.Vector3(p.x, p.y, p.z);\r\n } else if (residues.length > 0) {\r\n residues[0]._wingVector = new THREE.Vector3(1, 0, 0);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const residues = this._residues;\r\n let prev = null;\r\n let prevData = null;\r\n const frameRes = frameData._residues;\r\n const n = residues.length;\r\n function getAtomPos(atom) {\r\n return frameData.getAtomPos(atom.index);\r\n }\r\n\r\n for (let i = 0; i < n; ++i) {\r\n const curr = residues[i];\r\n const currData = frameRes[curr._index];\r\n const nextRes = (i + 1 < n) ? residues[i + 1] : null;\r\n curr._innerFinalize(prev, prevData, nextRes, currData, this.type === ChainType.NUCLEIC, getAtomPos);\r\n prev = curr;\r\n prevData = currData;\r\n }\r\n\r\n frameRes[residues[0]._index]._wingVector = n > 1\r\n ? frameRes[residues[1]._index]._wingVector\r\n : new THREE.Vector3(1, 0, 0);\r\n }\r\n\r\n /**\r\n * Create a new residue.\r\n *\r\n * @param {string} name - Residue name.\r\n * @param {number} sequence - Residue sequence number.\r\n * @param {string} iCode - Insertion code.\r\n * @returns {Residue} - Newly created residue instance.\r\n */\r\n addResidue(name, sequence, iCode) {\r\n let type = this._complex.getResidueType(name);\r\n if (type === null) {\r\n type = this._complex.addResidueType(name);\r\n }\r\n const residue = new Residue(this, type, sequence, iCode);\r\n this._complex.addResidue(residue);\r\n this._residues.push(residue);\r\n\r\n if (type.flags & (ResidueType.Flags.NUCLEIC | ResidueType.Flags.PROTEIN)) {\r\n if (this.maxSequence < sequence) {\r\n this.maxSequence = sequence;\r\n }\r\n if (this.minSequence > sequence) {\r\n this.minSequence = sequence;\r\n }\r\n }\r\n\r\n return residue;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this._mask = mask;\r\n }\r\n}\r\n\r\nexport default Chain;\r\n","import Residue from './Residue';\r\n\r\n/** An element of protein secondary structure. */\r\nclass StructuralElement {\r\n /**\r\n * Create a secondary structural element of the specified type.\r\n *\r\n * @param {StructuralElement.Type} type Secondary structure type.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n */\r\n constructor(type, init, term) {\r\n /**\r\n * Secondary structure type.\r\n * @type {StructuralElement.Type}\r\n */\r\n this.type = type;\r\n /**\r\n * Generic secondary structure type.\r\n * @type {StructuralElement.Generic}\r\n */\r\n this.generic = StructuralElement.genericByType[this.type] || 'loop';\r\n /**\r\n * Initial residue.\r\n * @type Residue\r\n */\r\n this.init = init;\r\n /**\r\n * Terminal residue.\r\n * @type Residue\r\n */\r\n this.term = term;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n if (this.init instanceof Residue && this.term instanceof Residue) {\r\n return;\r\n }\r\n\r\n // Link all intermediate residues to this structural element\r\n const start = complex.splitUnifiedSerial(this.init);\r\n const end = complex.splitUnifiedSerial(this.term);\r\n for (let chainId = start.chain; chainId <= end.chain; chainId++) {\r\n for (let serialId = start.serial; serialId <= end.serial; serialId++) {\r\n for (let { iCode } = start; iCode <= end.iCode; iCode++) {\r\n const hashCode = complex.getUnifiedSerial(chainId, serialId, iCode);\r\n if (residueHash[hashCode]) {\r\n residueHash[hashCode]._secondary = this;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Replace unfined serials by objects\r\n this.init = residueHash[this.init];\r\n this.term = residueHash[this.term];\r\n }\r\n}\r\n\r\n/**\r\n * Specific type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Generic\r\n */\r\nStructuralElement.Type = {\r\n /** A strand of a [beta-sheet](https://en.wikipedia.org/wiki/Beta_sheet). */\r\n STRAND: 'E',\r\n /** An isolated beta-bridge (too small for a beta-sheet). */\r\n BRIDGE: 'B',\r\n\r\n /** A [3/10 helix](https://en.wikipedia.org/wiki/310_helix) (hydrogen bonding is 3 residues apart). */\r\n HELIX_310: 'G',\r\n /** An [alpha-helix](https://en.wikipedia.org/wiki/Alpha_helix) (hydrogen bonding is 4 residues apart). */\r\n HELIX_ALPHA: 'H',\r\n /** A [pi-helix](https://en.wikipedia.org/wiki/Pi_helix) (hydrogen bonding is 5 residues apart). */\r\n HELIX_PI: 'I',\r\n /** A generic helix of unspecified bonding distance. */\r\n HELIX: 'X',\r\n\r\n /** An isolated 3/10-like helical turn. */\r\n TURN_310: '3',\r\n /** An isolated alpha-like helical turn. */\r\n TURN_ALPHA: '4',\r\n /** An isolated pi-like helical turn. */\r\n TURN_PI: '5',\r\n /** An isolated helical [turn](https://en.wikipedia.org/wiki/Turn_(biochemistry)) of unspecified bonding distance. */\r\n TURN: 'T',\r\n\r\n /** A bend (a region of high curvature). */\r\n BEND: 'S',\r\n /** Just a protein section with no particular conformation. */\r\n COIL: 'C',\r\n};\r\n\r\n/**\r\n * Generic type of a secondary structural element.\r\n * @enum {string}\r\n * @see StructuralElement.Type\r\n */\r\nStructuralElement.Generic = {\r\n /** A strand of a sheet. */\r\n STRAND: 'strand',\r\n /** A helix. */\r\n HELIX: 'helix',\r\n /** Just a protein section with no particular conformation. */\r\n LOOP: 'loop',\r\n};\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\nconst StructuralElementGeneric = StructuralElement.Generic;\r\n\r\n/**\r\n * A mapping from specific types to generic ones.\r\n * @type {Object}\r\n */\r\nStructuralElement.genericByType = {\r\n [StructuralElementType.STRAND]: StructuralElementGeneric.STRAND,\r\n [StructuralElementType.HELIX_310]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_ALPHA]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX_PI]: StructuralElementGeneric.HELIX,\r\n [StructuralElementType.HELIX]: StructuralElementGeneric.HELIX,\r\n};\r\n\r\nexport default StructuralElement;\r\n","import StructuralElement from './StructuralElement';\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\nexport const typeByPDBHelixClass = {\r\n 1: StructuralElementType.HELIX_ALPHA,\r\n 3: StructuralElementType.HELIX_PI,\r\n 5: StructuralElementType.HELIX_310,\r\n};\r\n\r\n/**\r\n * Helical secondary structure of a protein.\r\n * @extends StructuralElement\r\n */\r\nclass Helix extends StructuralElement {\r\n /**\r\n * Create a helix.\r\n *\r\n * @param {number} helixClass A helix class according to the\r\n * [PDB Format](http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX).\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} serial Serial number of the helix (see PDB Format).\r\n * @param {string} name Helix identifier (see PDB Format).\r\n * @param {string} comment Comment about this helix (see PDB Format).\r\n * @param {number} length Length of this helix, in residues (see PDB Format).\r\n */\r\n constructor(helixClass, init, term, serial, name, comment, length) {\r\n super(typeByPDBHelixClass[helixClass] || StructuralElement.Type.HELIX, init, term);\r\n\r\n /**\r\n * Serial number of the helix (see PDB Format).\r\n * @type {number}\r\n */\r\n this.serial = serial;\r\n /**\r\n * Helix identifier (see PDB Format).\r\n * @type {string}\r\n */\r\n this.name = name;\r\n /**\r\n * Comment about this helix (see PDB Format).\r\n * @type {string}\r\n */\r\n this.comment = comment;\r\n /**\r\n * Length of this helix, in residues (see PDB Format).\r\n * @type {number}\r\n */\r\n this.length = length;\r\n }\r\n}\r\n\r\nexport default Helix;\r\n","import StructuralElement from './StructuralElement';\r\n\r\n/**\r\n * A single strand of a sheet in a protein secondary structure.\r\n * @extends StructuralElement\r\n */\r\nclass Strand extends StructuralElement {\r\n /**\r\n * Create a strand.\r\n *\r\n * @param {Sheet} sheet Parent sheet this strand belongs to.\r\n * @param {Residue} init Initial residue.\r\n * @param {Residue} term Terminal residue.\r\n * @param {number} sense Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @param {Atom} atomCur Atom in current strand (see PDB Format).\r\n * @param {Atom} atomPrev Atom in previous strand (see PDB Format).\r\n */\r\n constructor(sheet, init, term, sense, atomCur, atomPrev) {\r\n super(StructuralElement.Type.STRAND, init, term);\r\n\r\n /**\r\n * Parent sheet this strand belongs to.\r\n * @type {Sheet}\r\n */\r\n this.sheet = sheet;\r\n /**\r\n * Sense of strand with respect to previous strand in the sheet.\r\n * - 0 if the first strand,\r\n * - 1 if parallel, and\r\n * - -1 if anti-parallel.\r\n * @type {number}\r\n */\r\n this.sense = sense;\r\n /**\r\n * Atom in current strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomCur = atomCur;\r\n /**\r\n * Atom in previous strand (see PDB Format).\r\n * @type {Atom}\r\n */\r\n this.atomPrev = atomPrev;\r\n }\r\n\r\n /**\r\n * An internal method for making a final pass over the complex to set all required references.\r\n *\r\n * **NOTE:** I'm sorry. It's a legacy code waiting for refactoring.\r\n * Just copying it as-is right now and hoping for the best.\r\n *\r\n * @param {object} serialAtomMap A dictionary of atoms\r\n * @param {object} residueHash A dictionary of hashed residues to check.\r\n * @param {Complex} complex The molecular complex this element belongs to.\r\n *\r\n * @override\r\n */\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n super._finalize(serialAtomMap, residueHash, complex);\r\n\r\n let as = this.atomCur;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomCur = serialAtomMap[as];\r\n }\r\n as = this.atomPrev;\r\n if (as !== null && !Number.isNaN(as)) {\r\n this.atomPrev = serialAtomMap[as];\r\n }\r\n }\r\n}\r\n\r\nexport default Strand;\r\n","import Strand from './Strand';\r\n\r\n/**\r\n * Sheet secondary structure of a protein.\r\n *\r\n * @param {string} name -\r\n * @param {number} width -\r\n *\r\n * @exports Sheet\r\n * @constructor\r\n */\r\nclass Sheet {\r\n constructor(name, width) {\r\n this._name = name;\r\n this._width = width;\r\n\r\n this._strands = [];\r\n }\r\n\r\n // Getters and setters\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getWidth() {\r\n return this._width;\r\n }\r\n\r\n addStrand(strand) {\r\n this._strands.push(strand);\r\n this._width = this._strands.length;\r\n }\r\n\r\n addEmptyStrand() {\r\n this._strands.push(new Strand(null, null, null, null, null, null));\r\n }\r\n\r\n _finalize(serialAtomMap, residueHash, complex) {\r\n const s = this._strands;\r\n for (let i = 0, n = s.length; i < n; ++i) {\r\n s[i]._finalize(serialAtomMap, residueHash, complex);\r\n }\r\n if (!this._width) {\r\n this._width = s.length;\r\n }\r\n if (s.length !== this._width) {\r\n throw new Error(`Sheet ${this._name} is inconsistent.`);\r\n }\r\n }\r\n}\r\n\r\nexport default Sheet;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Atom measurements.\r\n *\r\n * @param {string} id - SGroup id\r\n * @param {string} name - Name of the group\r\n * @param {THREE.Vector3} position - Registered coordinates\r\n * @param {array} atoms - Atoms group consists of\r\n * @param {object} saveNode - XML node from file for saving\r\n *\r\n * @exports SGroup\r\n * @constructor\r\n */\r\nclass SGroup {\r\n constructor(id, name, position, atoms, saveNode) {\r\n this._id = id;\r\n this._name = name;\r\n this._position = position || new THREE.Vector3();\r\n this._atoms = atoms || [];\r\n this._charge = 0; // default group charge\r\n this._repeat = 1; // how many times group repeated: always > 0\r\n this._center = null;\r\n this.xmlNodeRef = saveNode || null;\r\n }\r\n\r\n /**\r\n * Get atom full name.\r\n * @returns {string} Atom full name.\r\n */\r\n getName() {\r\n return this._name;\r\n }\r\n\r\n getPosition() {\r\n return this._position;\r\n }\r\n\r\n getCentralPoint() {\r\n return this._center;\r\n }\r\n\r\n _rebuildSGroupOnAtomChange() {\r\n const nLimon = 100000000;\r\n if (this._center === null) {\r\n return; // nothing to do if we are not relative\r\n }\r\n\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n for (let j = 0, n = this._atoms.length; j < n; j++) {\r\n const aPos = this._atoms[j].position;\r\n bLow.set(Math.min(bLow.x, aPos.x), Math.min(bLow.y, aPos.y), Math.min(bLow.z, aPos.z));\r\n bHight.set(Math.max(bHight.x, aPos.x), Math.max(bHight.y, aPos.y), Math.max(bHight.z, aPos.z));\r\n }\r\n this._center.addVectors(bLow, bHight);\r\n this._center.multiplyScalar(0.5);\r\n }\r\n}\r\n\r\nexport default SGroup;\r\n","import utils from '../../utils';\r\n\r\n//----------------------------------------------------------------------------\r\nclass Range {\r\n constructor(min, max) {\r\n this.min = min;\r\n this.max = typeof max === 'undefined' ? min : max;\r\n }\r\n\r\n includes(value) {\r\n return this.min <= value && value <= this.max;\r\n }\r\n\r\n toString() {\r\n const { min, max } = this;\r\n return min === max ? String(min) : [min, max].join(':');\r\n }\r\n\r\n toJSON() {\r\n return [this.min, this.max];\r\n }\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\nclass List {\r\n constructor(arg) {\r\n if (arg instanceof this.constructor) {\r\n // delegate construction to a different class\r\n // eslint-disable-next-line no-constructor-return\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n }\r\n\r\n append(value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n }\r\n\r\n toString() {\r\n return this._values.join(',');\r\n }\r\n\r\n toJSON() {\r\n const values = this._values;\r\n const result = [];\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n result[i] = value.toJSON ? value.toJSON() : value;\r\n }\r\n return result;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nclass RangeList extends List {\r\n includes(value) {\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n if (list[i].includes(value)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n//----------------------------------------------------------------------------\r\n\r\nconst valuesArray = [];\r\n\r\nclass ValueList extends List {\r\n constructor(arg, upperOnly) {\r\n const list = super(arg);\r\n if (upperOnly) {\r\n this.upperOnly = true;\r\n const values = list._values;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n const value = values[i];\r\n if (typeof value === 'string') {\r\n values[i] = value.toUpperCase();\r\n }\r\n }\r\n } else {\r\n this.upperOnly = false;\r\n }\r\n // return constructed object\r\n // eslint-disable-next-line no-constructor-return\r\n return list;\r\n }\r\n\r\n includes(value) {\r\n // we do not convert to upper case here for perfomance reasons\r\n // if list is upper case only, value must be converted before it is sent up to here\r\n return this._values.indexOf(value) !== -1;\r\n }\r\n\r\n toString() {\r\n // Quote values that are not correct identifiers\r\n const values = this._values;\r\n valuesArray.length = 0;\r\n for (let i = 0, n = values.length; i < n; ++i) {\r\n valuesArray[i] = utils.correctSelectorIdentifier(String(values[i]));\r\n }\r\n return valuesArray.join(',');\r\n }\r\n\r\n _validate(value) {\r\n return (this.upperOnly && typeof value === 'string') ? value.toUpperCase() : value;\r\n }\r\n\r\n append(value) {\r\n super.append(this._validate(value));\r\n return this;\r\n }\r\n\r\n remove(value) {\r\n super.remove(this._validate(value));\r\n return this;\r\n }\r\n}\r\n\r\nexport {\r\n Range,\r\n List,\r\n RangeList,\r\n ValueList,\r\n};\r\n","import { RangeList, ValueList } from './selectArgs';\r\n\r\n/** Base class for atom selectors. */\r\nclass Selector {\r\n toString() {\r\n return this.keyword;\r\n }\r\n\r\n toJSON() {\r\n return [this.name];\r\n }\r\n}\r\n\r\nSelector.prototype.name = 'Error';\r\nSelector.prototype.keyword = 'error';\r\n\r\n/** Base class for list-based atom selectors. */\r\nclass ListSelector extends Selector {\r\n constructor(list) {\r\n super();\r\n this.list = list;\r\n }\r\n\r\n toString() {\r\n return `${this.keyword} ${this.list}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.list.toJSON()];\r\n }\r\n}\r\n\r\nclass RangeListSelector extends ListSelector {\r\n constructor(arg) {\r\n super(new RangeList(arg));\r\n }\r\n}\r\n\r\nclass ValueListSelector extends ListSelector {\r\n constructor(arg, caseSensitive) {\r\n super(new ValueList(arg, !caseSensitive));\r\n }\r\n}\r\n\r\nclass NoneSelector extends Selector {\r\n includesAtom(_atom) {\r\n return false;\r\n }\r\n}\r\n\r\nNoneSelector.prototype.name = 'None';\r\nNoneSelector.prototype.keyword = 'none';\r\n\r\nclass AllSelector extends Selector {\r\n includesAtom(_atom) {\r\n return true;\r\n }\r\n}\r\n\r\nAllSelector.prototype.name = 'All';\r\nAllSelector.prototype.keyword = 'all';\r\n\r\nexport {\r\n Selector,\r\n ListSelector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n};\r\n","import { Selector, NoneSelector } from './selectorsBase';\r\n\r\n//----------------------------------------------------------------------------\r\n// Operators\r\n//----------------------------------------------------------------------------\r\nconst none = new NoneSelector();\r\n\r\nclass PrefixOperator extends Selector {\r\n constructor(rhs) {\r\n super();\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nPrefixOperator.prototype.priority = 1;\r\n\r\nclass InfixOperator extends Selector {\r\n constructor(lhs, rhs) {\r\n super();\r\n this.lhs = lhs || none;\r\n this.rhs = rhs || none;\r\n }\r\n\r\n toString() {\r\n const lhs = this.lhs.priority && this.lhs.priority > this.priority ? `(${this.lhs})` : this.lhs;\r\n const rhs = this.rhs.priority && this.rhs.priority > this.priority ? `(${this.rhs})` : this.rhs;\r\n return `${lhs} ${this.keyword} ${rhs}`;\r\n }\r\n\r\n toJSON() {\r\n return [this.name, this.lhs.toJSON(), this.rhs.toJSON()];\r\n }\r\n}\r\n\r\nInfixOperator.prototype.priority = 1000;\r\n\r\nexport { PrefixOperator, InfixOperator };\r\n","import Atom from './Atom';\r\nimport ResidueType from './ResidueType';\r\nimport { parser } from '../utils/SelectionParser';\r\nimport { Range, RangeList, ValueList } from './selectors/selectArgs';\r\nimport { PrefixOperator, InfixOperator } from './selectors/selectOps';\r\nimport {\r\n Selector,\r\n RangeListSelector,\r\n ValueListSelector,\r\n NoneSelector,\r\n AllSelector,\r\n} from './selectors/selectorsBase';\r\n\r\nconst keywords = {};\r\n\r\n//----------------------------------------------------------------------------\r\n// Named selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineSelector(name, SelectorClass) {\r\n const keyword = name.toLowerCase();\r\n SelectorClass.prototype.keyword = keyword;\r\n SelectorClass.prototype.name = name;\r\n\r\n const factory = ((...args) => new SelectorClass(...args));\r\n factory.SelectorClass = SelectorClass;\r\n keywords[keyword] = factory;\r\n\r\n return SelectorClass;\r\n}\r\n\r\ndefineSelector('Serial', class SerialSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.serial);\r\n }\r\n});\r\n\r\ndefineSelector('Name', class NameSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.name);\r\n }\r\n});\r\n\r\ndefineSelector('AltLoc', class AltLocSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(String.fromCharCode(atom.location));\r\n }\r\n});\r\n\r\ndefineSelector('Elem', class ElemSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.element.name);\r\n }\r\n});\r\n\r\ndefineSelector('Residue', class ResidueSelector extends ValueListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._type._name);\r\n }\r\n});\r\n\r\ndefineSelector('Sequence', class SequenceSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._sequence);\r\n }\r\n});\r\n\r\ndefineSelector('ICode', class ICodeSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._icode);\r\n }\r\n});\r\n\r\ndefineSelector('ResIdx', class ResIdxSelector extends RangeListSelector {\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._index);\r\n }\r\n});\r\n\r\ndefineSelector('Chain', class ChainSelector extends ValueListSelector {\r\n constructor(arg) {\r\n super(arg, true);\r\n }\r\n\r\n includesAtom(atom) {\r\n return this.list.includes(atom.residue._chain._name);\r\n }\r\n});\r\n\r\ndefineSelector('Hetatm', class HetatmSelector extends Selector {\r\n includesAtom(atom) {\r\n return atom.het;\r\n }\r\n});\r\n\r\ndefineSelector('PolarH', class PolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.HYDROGEN;\r\n }\r\n});\r\n\r\ndefineSelector('NonPolarH', class NonPolarHSelector extends Selector {\r\n includesAtom(atom) {\r\n return (atom.flags & Atom.Flags.NONPOLARH) === Atom.Flags.NONPOLARH;\r\n }\r\n});\r\n\r\ndefineSelector('All', AllSelector);\r\n\r\ndefineSelector('None', NoneSelector);\r\n\r\nconst NULL_SELECTOR = keywords.none();\r\n\r\n//----------------------------------------------------------------------------\r\n// Named operators\r\n//----------------------------------------------------------------------------\r\n\r\nfunction defineOperator(name, priority, OperatorClass) {\r\n OperatorClass.prototype.priority = priority;\r\n return defineSelector(name, OperatorClass);\r\n}\r\ndefineOperator('Not', 1, class NotOperator extends PrefixOperator {\r\n includesAtom(atom) {\r\n return !this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('And', 2, class AndOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) && this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\ndefineOperator('Or', 3, class OrOperator extends InfixOperator {\r\n includesAtom(atom) {\r\n return this.lhs.includesAtom(atom) || this.rhs.includesAtom(atom);\r\n }\r\n});\r\n\r\n//----------------------------------------------------------------------------\r\n// Flag selectors\r\n//----------------------------------------------------------------------------\r\n\r\nfunction byResidueTypeFlag(flag, name) {\r\n return defineSelector(name, class extends Selector {\r\n includesAtom(atom) {\r\n return (atom.residue._type.flags & flag) !== 0;\r\n }\r\n });\r\n}\r\n\r\nbyResidueTypeFlag(ResidueType.Flags.PROTEIN, 'Protein');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC, 'Basic');\r\nbyResidueTypeFlag(ResidueType.Flags.ACIDIC, 'Acidic');\r\nbyResidueTypeFlag(ResidueType.Flags.BASIC | ResidueType.Flags.ACIDIC, 'Charged');\r\nbyResidueTypeFlag(ResidueType.Flags.POLAR, 'Polar');\r\nbyResidueTypeFlag(ResidueType.Flags.NONPOLAR, 'NonPolar');\r\nbyResidueTypeFlag(ResidueType.Flags.AROMATIC, 'Aromatic');\r\nbyResidueTypeFlag(ResidueType.Flags.NUCLEIC, 'Nucleic');\r\nbyResidueTypeFlag(ResidueType.Flags.PURINE, 'Purine');\r\nbyResidueTypeFlag(ResidueType.Flags.PYRIMIDINE, 'Pyrimidine');\r\nbyResidueTypeFlag(ResidueType.Flags.WATER, 'Water');\r\n\r\n//----------------------------------------------------------------------------\r\nconst selectors = Object.create(keywords);\r\n\r\nselectors.Selector = Selector;\r\nselectors.RangeListSelector = RangeListSelector;\r\nselectors.ValueListSelector = ValueListSelector;\r\nselectors.Range = Range;\r\nselectors.RangeList = RangeList;\r\nselectors.ValueList = ValueList;\r\nselectors.PrefixOperator = PrefixOperator;\r\nselectors.InfixOperator = InfixOperator;\r\nselectors.Context = Object.create({});\r\n\r\nselectors.GetSelector = function (key) {\r\n if (!selectors.Context.hasOwnProperty(key)) {\r\n const exc = { message: `selector ${key} is not registered` };\r\n throw exc;\r\n }\r\n return selectors.Context[key] || NULL_SELECTOR;\r\n};\r\n\r\nselectors.ClearContext = function () {\r\n Object.keys(selectors.Context).forEach((k) => { delete selectors.Context[k]; });\r\n};\r\n\r\nselectors.keyword = function (key) {\r\n return keywords[key.toLowerCase()] || keywords.none;\r\n};\r\n\r\nselectors.parse = function (str) {\r\n const res = {};\r\n try {\r\n res.selector = parser.parse(str);\r\n } catch (e) {\r\n res.selector = NULL_SELECTOR;\r\n res.error = e.message;\r\n }\r\n return res;\r\n};\r\n\r\nparser.yy = selectors;\r\nparser.yy.parseError = parser.parseError; // workaround for incorrect JISON parser generator for AMD module\r\n\r\nexport default selectors;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\n\r\n/**\r\n * Basic biological unit class.\r\n *\r\n * @exports BiologicalUnit\r\n * @constructor\r\n */\r\nclass BiologicalUnit {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._selector = selectors.keyword('All')();\r\n this._boundaries = {\r\n boundingBox: new THREE.Box3(),\r\n boundingSphere: new THREE.Sphere(),\r\n };\r\n }\r\n\r\n computeBoundaries() {\r\n const atoms = this._complex._atoms;\r\n const n = atoms.length;\r\n const selector = this._selector;\r\n\r\n const { boundingBox } = this._boundaries;\r\n boundingBox.makeEmpty();\r\n if (n === 1) {\r\n boundingBox.expandByPoint(atoms[0].position);\r\n const bbc = new THREE.Vector3();\r\n boundingBox.getCenter(bbc);\r\n const s = 2 * atoms[0].element.radius;\r\n boundingBox.setFromCenterAndSize(bbc, new THREE.Vector3(s, s, s));\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (selector.includesAtom(atoms[i])) {\r\n boundingBox.expandByPoint(atoms[i].position);\r\n }\r\n }\r\n }\r\n\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n if (n === 1) {\r\n this._boundaries.boundingSphere.set(center, atoms[0].element.radius);\r\n } else {\r\n for (let i = 0; i < n; ++i) {\r\n if (!selector.includesAtom(atoms[i])) {\r\n continue;\r\n }\r\n const pos = atoms[i].position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n this._boundaries.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n }\r\n\r\n getTransforms() {\r\n return [];\r\n }\r\n\r\n getSelector() {\r\n return this._selector;\r\n }\r\n\r\n getBoundaries() {\r\n return this._boundaries;\r\n }\r\n\r\n finalize() {\r\n }\r\n}\r\n\r\nexport default BiologicalUnit;\r\n","import * as THREE from 'three';\r\nimport selectors from './selectors';\r\nimport BiologicalUnit from './BiologicalUnit';\r\n\r\n/**\r\n * Biological assembly.\r\n *\r\n * @exports Assembly\r\n * @constructor\r\n */\r\n\r\nclass Assembly extends BiologicalUnit {\r\n constructor(complex) {\r\n super(complex);\r\n this.chains = [];\r\n this.matrices = [];\r\n }\r\n\r\n computeBoundaries() {\r\n super.computeBoundaries();\r\n // fix up the boundaries\r\n const { matrices } = this;\r\n const oldCenter = this._boundaries.boundingSphere.center;\r\n const oldRad = this._boundaries.boundingSphere.radius;\r\n const boundingBox = this._boundaries.boundingBox = new THREE.Box3();\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = matrices.length; i < n; ++i) {\r\n boundingBox.expandByPoint(oldCenter.clone().applyMatrix4(matrices[i]));\r\n }\r\n\r\n const newRad = boundingBox.max.distanceTo(boundingBox.min) / 2 + oldRad;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n this._boundaries.boundingSphere = new THREE.Sphere().set(center, newRad);\r\n boundingBox.max.addScalar(oldRad);\r\n boundingBox.min.subScalar(oldRad);\r\n }\r\n\r\n /**\r\n * Mark a chain as belonging to this biological assembly.\r\n * @param {string} chain - chain identifier, usually a single letter\r\n */\r\n addChain(chain) {\r\n this.chains[this.chains.length] = chain;\r\n }\r\n\r\n /**\r\n * Add a transformation matrix.\r\n * @param {THREE.Matrix4} matrix - transformation matrix\r\n */\r\n addMatrix(matrix) {\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n getTransforms() {\r\n return this.matrices;\r\n }\r\n\r\n finalize() {\r\n if (this.chains.length > 0) {\r\n this._selector = selectors.keyword('Chain')(this.chains);\r\n } else {\r\n this._selector = selectors.keyword('None')();\r\n }\r\n }\r\n}\r\n\r\nexport default Assembly;\r\n","/**\r\n * This class represents connected component as a part of a complex.\r\n * WARNING! The whole component entity is build under the assumption that residues\r\n * are placed in the chains and complex in ascending order of indices\r\n *\r\n * @param {Complex} complex - Molecular complex this chain belongs to.\r\n *\r\n * @exports Component\r\n * @constructor\r\n */\r\nclass Component {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._index = -1;\r\n this._residueIndices = [];\r\n this._cycles = [];\r\n this._subDivs = [];\r\n this._residueCount = 0;\r\n }\r\n\r\n getResidues() {\r\n return this._complex._residues;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residueCount;\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._complex._residues;\r\n const resIdc = this._residueIndices;\r\n for (let idIdc = 0, idCount = resIdc.length; idIdc < idCount; ++idIdc) {\r\n for (let idx = resIdc[idIdc].start, last = resIdc[idIdc].end; idx <= last; ++idx) {\r\n process(residues[idx]);\r\n }\r\n }\r\n }\r\n\r\n setSubDivs(subDivs) {\r\n this._subDivs = subDivs;\r\n let curr = 0;\r\n const resIdc = [];\r\n let resCnt = 0;\r\n for (let i = 0, n = subDivs.length; i < n; ++i) {\r\n if (i === n - 1 || subDivs[i].end + 1 !== subDivs[i + 1].start) {\r\n const { start } = subDivs[curr];\r\n const { end } = subDivs[i];\r\n resIdc[resIdc.length] = {\r\n start,\r\n end,\r\n };\r\n resCnt += end - start + 1;\r\n curr = i + 1;\r\n }\r\n }\r\n\r\n this._residueIndices = resIdc;\r\n this._residueCount = resCnt;\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._complex._bonds;\r\n\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n const bond = bonds[i];\r\n if (bond._left.residue._component === this) {\r\n process(bond);\r\n }\r\n }\r\n }\r\n\r\n update() {\r\n this.forEachCycle((cycle) => {\r\n cycle.update();\r\n });\r\n }\r\n\r\n forEachAtom(process) {\r\n this.forEachResidue((residue) => {\r\n residue.forEachAtom(process);\r\n });\r\n }\r\n\r\n addCycle(cycle) {\r\n this._cycles.push(cycle);\r\n }\r\n\r\n forEachCycle(process) {\r\n const cycles = this._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n process(cycles[i]);\r\n }\r\n }\r\n\r\n markResidues() {\r\n const self = this;\r\n self.forEachResidue((residue) => {\r\n residue._component = self;\r\n });\r\n }\r\n\r\n _forEachSubChain(mask, process) {\r\n const residues = this._complex._residues;\r\n const subs = this._subDivs;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let idx = subs[i].start, last = subs[i].end; idx <= last; ++idx) {\r\n const currRes = residues[idx];\r\n if (mask & currRes._mask && currRes._isValid) {\r\n let end = idx + 1;\r\n for (; end <= last; ++end) {\r\n const endRes = residues[end];\r\n if (!(mask & endRes._mask && endRes._isValid)) {\r\n break;\r\n }\r\n }\r\n process(i, idx, end - 1);\r\n idx = end;\r\n }\r\n }\r\n }\r\n }\r\n\r\n getMaskedSequences(mask) {\r\n const subs = [];\r\n let idx = 0;\r\n this._forEachSubChain(mask, (_subIdx, start, end) => {\r\n subs[idx++] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n\r\n getMaskedSubdivSequences(mask) {\r\n const subs = [];\r\n let currIdx = -1;\r\n let lastSubIdx = -1;\r\n const subDivs = this._subDivs;\r\n\r\n this._forEachSubChain(mask, (subIdx, start, end) => {\r\n if (lastSubIdx !== subIdx) {\r\n ++currIdx;\r\n subs[currIdx] = {\r\n arr: [],\r\n boundaries: subDivs[subIdx],\r\n };\r\n lastSubIdx = subIdx;\r\n }\r\n subs[currIdx].arr[subs[currIdx].arr.length] = { start, end };\r\n });\r\n\r\n return subs;\r\n }\r\n}\r\n\r\nexport default Component;\r\n","import utils from '../utils';\r\n\r\nconst cMaxPairsForHashCode = 32;\r\nconst cHashTableSize = 1024 * 1024;\r\nconst cNumbersPerPair = 4;\r\nconst cMaxNeighbours = 14;\r\nconst cInvalidVal = -1;\r\n// 89237 is a large simple number, can be used for pseudo random hash code create\r\nconst cBigPrime = 89237;\r\n\r\nclass AtomPairs {\r\n constructor(maxPairsEstimate) {\r\n this.numPairs = 0;\r\n this.numMaxPairs = maxPairsEstimate;\r\n this.intBuffer = utils.allocateTyped(Int32Array, maxPairsEstimate * cNumbersPerPair);\r\n for (let i = 0; i < maxPairsEstimate * cNumbersPerPair; i++) {\r\n this.intBuffer[i] = cInvalidVal;\r\n }\r\n this.hashBuffer = utils.allocateTyped(Int32Array, cHashTableSize * cMaxPairsForHashCode);\r\n for (let i = 0; i < cHashTableSize * cMaxPairsForHashCode; i++) {\r\n this.hashBuffer[i] = cInvalidVal;\r\n }\r\n }\r\n\r\n /**\r\n * Destroy all pairs memory\r\n */\r\n destroy() {\r\n this.intBuffer = null;\r\n this.hashBuffer = null;\r\n }\r\n\r\n /**\r\n * Add pair of atoms to collection\r\n * @param {number} indexA - Index of the 1st vertex.\r\n * @param {number} indexB - Index of the 2nd vertex.\r\n */\r\n addPair(indexA, indexB) {\r\n const ia = (indexA < indexB) ? indexA : indexB;\r\n const ib = (indexA > indexB) ? indexA : indexB;\r\n const codeToAdd = ia + (ib << cMaxNeighbours);\r\n\r\n const hashCode = (ia + (ib * cBigPrime)) & (cHashTableSize - 1);\r\n let j = hashCode * cMaxPairsForHashCode;\r\n let apI = 0;\r\n for (; apI < cMaxPairsForHashCode; apI++) {\r\n const code = this.hashBuffer[j + apI];\r\n if (code === cInvalidVal) {\r\n break;\r\n }\r\n if (code === codeToAdd) {\r\n return false;\r\n }\r\n }\r\n // add this new hash code\r\n if (apI >= cMaxPairsForHashCode) {\r\n throw new Error('addPair: increase cMaxPairsForHashCode');\r\n }\r\n this.hashBuffer[j + apI] = codeToAdd;\r\n\r\n // actually add\r\n if (this.numPairs >= this.numMaxPairs) {\r\n throw new Error('addPair: increase num pairs');\r\n }\r\n j = this.numPairs * cNumbersPerPair;\r\n this.intBuffer[j] = ia;\r\n this.intBuffer[j + 1] = ib;\r\n this.intBuffer[j + 2] = codeToAdd;\r\n this.numPairs++;\r\n return true;\r\n }\r\n}\r\n\r\nexport default AtomPairs;\r\n","import AtomPairs from './AtomPairs';\r\nimport Bond from './Bond';\r\n\r\nconst cProfileBondBuilder = false;\r\nconst cEstBondsMultiplier = 4;\r\nconst cSpaceCode = 32;\r\nconst cBondTolerance = 0.45;\r\nconst cVMDTolerance = 0.6;\r\nconst cBondRadInJMOL = true;\r\nconst cEpsilon = 0.001;\r\n\r\n/**\r\n * Get radius used for building bonds.\r\n *\r\n * @param {Atom} atom - Atom object.\r\n * @returns {number} special value for bonding radius for this atom\r\n */\r\nfunction _getBondingRadius(atom) {\r\n const { element } = atom;\r\n if (element) {\r\n return element.radiusBonding;\r\n }\r\n throw new Error('_getBondingRadius: Logic error.');\r\n}\r\n\r\nfunction _isAtomEligible(atom) {\r\n // build for all non-hetatm and for hetatm without bonds\r\n return !atom.isHet() || (atom.bonds && atom.bonds.length === 0);\r\n}\r\n\r\n/**\r\n * Bond between atoms.\r\n *\r\n * @param {Complex} complex molecular complex\r\n\r\n * @exports AutoBond\r\n * @constructor\r\n */\r\nclass AutoBond {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._maxRad = 1.8;\r\n const bBox = this._complex.getDefaultBoundaries().boundingBox;\r\n this._vBoxMin = bBox.min.clone();\r\n this._vBoxMax = bBox.max.clone();\r\n\r\n this._pairCollection = null;\r\n }\r\n\r\n /**\r\n * Add existing pairs of connectors (from pdb file after its reading)\r\n * @returns {number} 0\r\n */\r\n _addExistingPairs() {\r\n const atoms = this._complex.getAtoms();\r\n const numAtoms = atoms.length;\r\n let aInd = 0;\r\n const collection = this._pairCollection;\r\n\r\n for (; aInd < numAtoms; aInd++) {\r\n const { bonds } = atoms[aInd];\r\n const numBondsForAtom = bonds.length;\r\n for (let bInd = 0; bInd < numBondsForAtom; bInd++) {\r\n const bond = bonds[bInd];\r\n const indTo = bond._left.index;\r\n if (indTo === aInd) {\r\n collection.addPair(aInd, bond._right.index);\r\n }\r\n } // for (b) all bonds in atom\r\n } // for (a)\r\n return 0;\r\n }\r\n\r\n _findPairs() {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const atoms = this._complex._atoms;\r\n const atomsNum = atoms.length;\r\n const self = this;\r\n\r\n let rA;\r\n let isHydrogenA;\r\n let posA;\r\n let locationA;\r\n let atomA;\r\n\r\n const processAtom = function (atomB) {\r\n if (isHydrogenA && atomB.isHydrogen()) {\r\n return;\r\n }\r\n\r\n const locationB = atomB.location;\r\n if ((locationA !== cSpaceCode)\r\n && (locationB !== cSpaceCode)\r\n && (locationA !== locationB)) {\r\n return;\r\n }\r\n\r\n const dist2 = posA.distanceToSquared(atomB.position);\r\n const rB = atomB.element.radiusBonding;\r\n const maxAcceptable = cBondRadInJMOL ? rA + rB + cBondTolerance : cVMDTolerance * (rA + rB);\r\n\r\n if (dist2 > (maxAcceptable * maxAcceptable)) {\r\n return;\r\n }\r\n\r\n if (dist2 < cEpsilon) {\r\n return;\r\n }\r\n\r\n self._pairCollection.addPair(atomA.index, atomB.index);\r\n };\r\n\r\n for (let i = 0; i < atomsNum; ++i) {\r\n atomA = atoms[i];\r\n if (!_isAtomEligible(atomA)) {\r\n continue;\r\n }\r\n\r\n rA = atomA.element.radiusBonding;\r\n isHydrogenA = atomA.isHydrogen();\r\n posA = atomA.position;\r\n locationA = atomA.location;\r\n\r\n vw.forEachAtomWithinRadius(posA, 2 * this._maxRad + cBondTolerance, processAtom);\r\n }\r\n }\r\n\r\n _addPairs() {\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0, k = 0; i < this._pairCollection.numPairs; i++, k += 4) {\r\n const iA = this._pairCollection.intBuffer[k];\r\n const iB = this._pairCollection.intBuffer[k + 1];\r\n this._addPair(atoms[iA], atoms[iB]);\r\n }\r\n }\r\n\r\n _addPair(atomA, atomB) {\r\n const bondsA = atomA.bonds;\r\n const indexA = atomA.index;\r\n const indexB = atomB.index;\r\n for (let j = 0, numBonds = bondsA.length; j < numBonds; ++j) {\r\n const bond = bondsA[j];\r\n if (bond._left.index === indexB || bond._right.index === indexB) {\r\n return;\r\n }\r\n }\r\n const left = indexA < indexB ? atomA : atomB;\r\n const right = indexA < indexB ? atomB : atomA;\r\n const newBond = this._complex.addBond(left, right, 0, Bond.BondType.UNKNOWN, false);\r\n bondsA.push(newBond);\r\n atomB.bonds.push(newBond);\r\n }\r\n\r\n build() {\r\n if (cProfileBondBuilder) {\r\n console.time('Bonds Builder');\r\n }\r\n this._buildInner();\r\n\r\n if (cProfileBondBuilder) {\r\n console.timeEnd('Bonds Builder');\r\n }\r\n }\r\n\r\n _buildInner() {\r\n const atoms = this._complex._atoms;\r\n if (atoms.length < 2) {\r\n return;\r\n }\r\n if (atoms[0].index < 0) {\r\n throw new Error('AutoBond: Atoms in complex were not indexed.');\r\n }\r\n\r\n this._calcBoundingBox();\r\n this._pairCollection = new AtomPairs(atoms.length * cEstBondsMultiplier);\r\n this._addExistingPairs();\r\n this._findPairs();\r\n this._addPairs();\r\n }\r\n\r\n _calcBoundingBox() {\r\n const atoms = this._complex._atoms;\r\n const nAtoms = atoms.length;\r\n let maxRad = _getBondingRadius(atoms[0]);\r\n for (let i = 1; i < nAtoms; ++i) {\r\n maxRad = Math.max(maxRad, _getBondingRadius(atoms[i]));\r\n }\r\n this._vBoxMax.addScalar(maxRad);\r\n this._vBoxMin.addScalar(-maxRad);\r\n this._maxRad = maxRad * 1.2;\r\n }\r\n\r\n destroy() {\r\n if (this._pairCollection) {\r\n this._pairCollection.destroy();\r\n }\r\n }\r\n}\r\n\r\nexport default AutoBond;\r\n","import * as THREE from 'three';\r\nimport Bond from './Bond';\r\nimport Element from './Element';\r\n\r\nconst cCrossThresh = 0.1;\r\nconst cAromaticType = Bond.BondType.AROMATIC;\r\nconst cAromaticAtoms = [\r\n Element.ByName.C.number,\r\n Element.ByName.N.number,\r\n // Element.ByName.O.number,\r\n // Element.ByName.S.number,\r\n];\r\n\r\n/** Conditions for bonds:\r\n * - Cross product with each subsequent bond to add is collinear and point to the same direction\r\n * - Each pair of a adjacent bonds belong to not more than one cycle\r\n * - If there is more than one candidates we try them in ascending order of angle values\r\n */\r\n\r\nconst _coDirVectors = (function () {\r\n const v1Tmp = new THREE.Vector3();\r\n const v2Tmp = new THREE.Vector3();\r\n const cp = new THREE.Vector3();\r\n return function (v1, v2) {\r\n v1Tmp.copy(v1).normalize();\r\n v2Tmp.copy(v2).normalize();\r\n cp.crossVectors(v1Tmp, v2Tmp);\r\n if (cp.length() > cCrossThresh) {\r\n return false;\r\n }\r\n // zero vector in out terms must be collinear to any\r\n return v1Tmp.dot(v2Tmp) >= 0;\r\n };\r\n}());\r\n\r\nfunction _insertAscending(arr, val) {\r\n let idx = 0;\r\n while (idx < arr.length && arr[idx] < val) {\r\n ++idx;\r\n }\r\n arr.splice(idx, 0, val);\r\n}\r\n\r\nfunction _anotherAtom(bond, currAtom) {\r\n return bond._left === currAtom ? bond._right : bond._left;\r\n}\r\n\r\nfunction _cosBetween(v1, v2) {\r\n const theta = v1.dot(v2) / (Math.sqrt(v1.lengthSq() * v2.lengthSq()));\r\n return THREE.MathUtils.clamp(theta, -1, 1);\r\n}\r\n\r\nfunction _markAromatic(bond) {\r\n bond._type = cAromaticType;\r\n}\r\n\r\nclass Cycle {\r\n constructor(atomsList) {\r\n this.atoms = atomsList;\r\n this.update();\r\n }\r\n\r\n update() {\r\n const { atoms } = this;\r\n const center = new THREE.Vector3();\r\n const nA = atoms.length;\r\n for (let j = 0; j < nA; ++j) {\r\n center.add(atoms[j].position);\r\n }\r\n center.multiplyScalar(1.0 / nA);\r\n this.center = center;\r\n this.radius = center.distanceTo(atoms[0].position.clone().lerp(atoms[1].position, 0.5));\r\n }\r\n\r\n forEachBond(process) {\r\n const { atoms } = this;\r\n const nA = atoms.length;\r\n let currAtom = atoms[0];\r\n let nextAtom;\r\n\r\n function checkBond(bond) {\r\n if (bond._left === nextAtom || bond._right === nextAtom) {\r\n process(bond);\r\n }\r\n }\r\n\r\n for (let i = 0; i < nA; ++i) {\r\n nextAtom = atoms[(i + 1) % nA];\r\n currAtom.forEachBond(checkBond);\r\n currAtom = nextAtom;\r\n }\r\n }\r\n}\r\n\r\nfunction _isAromatic(bond) {\r\n return bond._type === cAromaticType;\r\n}\r\n\r\nfunction _isPossibleAromatic(bond) {\r\n if (bond.type === cAromaticType) {\r\n return true;\r\n }\r\n const rightIdx = cAromaticAtoms.indexOf(bond._right.element.number);\r\n const leftIdx = cAromaticAtoms.indexOf(bond._left.element.number);\r\n return rightIdx !== -1 && leftIdx !== -1;\r\n}\r\n\r\nfunction _checkCycleSimple(cycle) {\r\n return cycle.length > 3;\r\n}\r\n\r\nfunction _checkCycleComplex(cycle) {\r\n console.assert(cycle.length > 2);\r\n return true;\r\n}\r\n\r\nclass AromaticLoopsMarker {\r\n constructor(complex) {\r\n this._complex = complex;\r\n const bondsData = new Array(complex._bonds.length);\r\n const bondMarks = new Array(complex._bonds.length);\r\n for (let i = 0, n = bondsData.length; i < n; ++i) {\r\n bondsData[i] = [];\r\n bondMarks[i] = false;\r\n }\r\n this._bondsData = bondsData;\r\n this._bondMarks = bondMarks;\r\n this._resetCycles();\r\n }\r\n\r\n _resetCycles() {\r\n this._cycles = [];\r\n this._currIdx = -1;\r\n }\r\n\r\n _haveSameCycle(bondsData, bond1, bond2) {\r\n const arr1 = bondsData[bond1._index];\r\n const arr2 = bondsData[bond2._index];\r\n const n1 = arr1.length;\r\n const n2 = arr2.length;\r\n let i1 = 0;\r\n let i2 = 0;\r\n while (i1 < n1 && i2 < n2) {\r\n if (arr1[i1] === arr2[i2]) {\r\n return true;\r\n }\r\n if (arr1[i1] > arr2[i2]) {\r\n ++i2;\r\n } else {\r\n ++i1;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _tryBond(prevBond, currRight, currDir) {\r\n const bondsOrder = [];\r\n const bondsData = this._bondsData;\r\n const currLeft = _anotherAtom(prevBond, currRight);\r\n const currVec = currRight.position.clone().sub(currLeft.position);\r\n const startAtomRef = this._currStart;\r\n const self = this;\r\n const bondMarks = this._bondMarks;\r\n let checkAromatic = this._checkBond;\r\n bondMarks[prevBond._index] = true;\r\n checkAromatic = checkAromatic === undefined ? _isAromatic : checkAromatic;\r\n currRight.forEachBond((newBond) => {\r\n if (!checkAromatic(newBond)\r\n || newBond === prevBond\r\n || bondMarks[newBond._index]\r\n || self._haveSameCycle(bondsData, prevBond, newBond)) {\r\n return;\r\n }\r\n const anotherAtom = _anotherAtom(newBond, currRight);\r\n const anotherVec = anotherAtom.position.clone().sub(currRight.position);\r\n const val = anotherAtom === startAtomRef ? -2.0 : 1 - _cosBetween(currVec, anotherVec);\r\n const newDir = anotherVec.cross(currVec);\r\n if (!_coDirVectors(newDir, currDir)) {\r\n return;\r\n }\r\n let idx = 0;\r\n while (idx < bondsOrder.length && bondsOrder[idx].val < val) {\r\n ++idx;\r\n }\r\n bondsOrder.splice(idx, 0, { bond: newBond, val, dir: newDir });\r\n });\r\n\r\n for (let i = 0, n = bondsOrder.length; i < n; ++i) {\r\n const { bond } = bondsOrder[i];\r\n const newRight = bond._left === currRight ? bond._right : bond._left;\r\n if (newRight === startAtomRef) {\r\n ++this._currIdx;\r\n this._cycles.push([currRight]);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n if (this._tryBond(bond, newRight, bondsOrder[i].dir)) {\r\n _insertAscending(bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(currRight);\r\n bondMarks[prevBond._index] = false;\r\n return true;\r\n }\r\n }\r\n bondMarks[prevBond._index] = false;\r\n return false;\r\n }\r\n\r\n _startCycle(bond) {\r\n // start from left to right\r\n this._currStart = bond._left;\r\n if (this._tryBond(bond, bond._right, new THREE.Vector3())) {\r\n _insertAscending(this._bondsData[bond._index], this._currIdx);\r\n this._cycles[this._currIdx].push(bond._left);\r\n }\r\n }\r\n\r\n _findLoops(checkBond, checkCycle) {\r\n this._checkBond = checkBond;\r\n const complex = this._complex;\r\n const self = this;\r\n\r\n complex.forEachComponent((component) => {\r\n self._resetCycles();\r\n component.forEachBond((bond) => {\r\n if (checkBond(bond)) {\r\n self._startCycle(bond);\r\n }\r\n });\r\n const cycles = self._cycles;\r\n for (let i = 0, n = cycles.length; i < n; ++i) {\r\n const cycle = cycles[i];\r\n if (!checkCycle(cycle)) {\r\n continue;\r\n }\r\n const newCycle = new Cycle(cycle);\r\n newCycle.forEachBond(_markAromatic);\r\n component.addCycle(newCycle);\r\n }\r\n });\r\n }\r\n\r\n markCycles() {\r\n this._findLoops(_isAromatic, _checkCycleSimple);\r\n }\r\n\r\n detectCycles() {\r\n this._findLoops(_isPossibleAromatic, _checkCycleComplex);\r\n }\r\n}\r\n\r\nexport default AromaticLoopsMarker;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\n/**\r\n * Calculate min & max radius of a sphere slice between zMin & zMax\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {number} zMin - lower bound of the slice\r\n * @param {number} zMax - upper bound of the slice\r\n */\r\nfunction _getSphereSliceRadiusRange(center, radius, zMin, zMax) {\r\n const dzMin = zMin - center.z;\r\n const dzMax = zMax - center.z;\r\n const rzMin = Math.sqrt(Math.max(radius * radius - dzMin * dzMin, 0.0));\r\n const rzMax = Math.sqrt(Math.max(radius * radius - dzMax * dzMax, 0.0));\r\n\r\n const rMin = Math.min(rzMin, rzMax);\r\n let rMax;\r\n\r\n if (zMin <= center.z && zMax >= center.z) {\r\n // sphere's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(rzMin, rzMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * Calculate min & max radius of a circle slice between yMin & yMax.\r\n *\r\n * To maintain analogy with _getSphereSliceRadiusRange we call radius what in fact is\r\n * half-width (along X axis) of the slice, i.e. 1D-sphere radius.\r\n *\r\n * @param {Vector3} center - center of the circle (z can be ignored)\r\n * @param {number} radius - circle radius\r\n * @param {number} yMin - lower bound of the slice\r\n * @param {number} yMax - upper bound of the slice\r\n * @returns {Array} - array of two numbers (min & max radius, or half-width)\r\n */\r\nfunction _getCircleSliceRadiusRange(center, radius, yMin, yMax) {\r\n const dyMin = yMin - center.y;\r\n const dyMax = yMax - center.y;\r\n const ryMin = Math.sqrt(Math.max(radius * radius - dyMin * dyMin, 0.0));\r\n const ryMax = Math.sqrt(Math.max(radius * radius - dyMax * dyMax, 0.0));\r\n\r\n const rMin = Math.min(ryMin, ryMax);\r\n let rMax;\r\n\r\n if (yMin <= center.y && yMax >= center.y) {\r\n // slice's main diameter is inside slice\r\n rMax = radius;\r\n } else {\r\n rMax = Math.max(ryMin, ryMax);\r\n }\r\n\r\n return [rMin, rMax];\r\n}\r\n\r\n/**\r\n * VoxelWorld constructor\r\n *\r\n * @param {Box3} box - bounding box of the volume to be partitioned\r\n * @param {Vector3} vCellSizeHint - target voxel size (actual voxel size may differ from this)\r\n */\r\nclass VoxelWorld {\r\n constructor(box, vCellSizeHint) {\r\n this._box = box.clone();\r\n const size = new THREE.Vector3();\r\n box.getSize(size);\r\n this._count = size.clone().divide(vCellSizeHint).floor().max(new THREE.Vector3(1, 1, 1));\r\n this._last = this._count.clone().subScalar(1);\r\n this._cellSize = size.clone().divide(this._count);\r\n this._cellInnerR = 0.5 * Math.min(Math.min(this._cellSize.x, this._cellSize.y), this._cellSize.z);\r\n this._cellOuterR = 0.5 * Math.sqrt(this._cellSize.dot(this._cellSize));\r\n\r\n // array of voxels, each element contains index of first atom in voxel\r\n const numVoxels = this._count.x * this._count.y * this._count.z;\r\n this._voxels = utils.allocateTyped(Int32Array, numVoxels);\r\n for (let i = 0; i < numVoxels; ++i) {\r\n this._voxels[i] = -1;\r\n }\r\n\r\n // array of atoms that stores multiple single-linked lists\r\n // two elements for each atom: Atom ref, index of next atom (in this array\r\n this._atoms = [];\r\n }\r\n\r\n /**\r\n * Add all atoms from a complex to voxel world\r\n *\r\n * @param {Complex} complex - complex\r\n */\r\n addAtoms(complex) {\r\n const self = this;\r\n\r\n let idx = this._atoms.length;\r\n\r\n // resize array of atoms\r\n this._atoms.length += 2 * complex.getAtomCount();\r\n\r\n complex.forEachAtom((atom) => {\r\n // find which voxel contains this atom\r\n const voxelIdx = self._findVoxel(atom.position);\r\n\r\n // push current atom to the head of voxel's atom list\r\n self._atoms[idx] = atom;\r\n self._atoms[idx + 1] = self._voxels[voxelIdx];\r\n self._voxels[voxelIdx] = idx;\r\n\r\n idx += 2;\r\n });\r\n }\r\n\r\n /**\r\n * Get voxel that contains specified 3D point (we use clamp at the edges)\r\n *\r\n * @param {Vector3} point - a point in 3D\r\n * @returns {number} - index of voxel\r\n */\r\n static _zero = new THREE.Vector3(0, 0, 0);\r\n\r\n static _voxel = new THREE.Vector3();\r\n\r\n _findVoxel(point) {\r\n const zero = VoxelWorld._zero;\r\n const voxel = VoxelWorld._voxel;\r\n voxel.copy(point)\r\n .sub(this._box.min)\r\n .divide(this._cellSize)\r\n .floor()\r\n .clamp(zero, this._last);\r\n return voxel.x + this._count.x * (voxel.y + this._count.y * voxel.z);\r\n }\r\n\r\n /**\r\n * Call a function for each atom in voxel\r\n *\r\n * @param {number} voxel - index of voxel\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomInVoxel(voxel, process) {\r\n for (let i = this._voxels[voxel]; i >= 0; i = this._atoms[i + 1]) {\r\n process(this._atoms[i]);\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _xRange = new THREE.Vector2();\r\n\r\n static _yRange = new THREE.Vector2();\r\n\r\n static _zRange = new THREE.Vector2();\r\n\r\n _forEachVoxelWithinRadius(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n\r\n // switch to a faster method unless cell size is much smaller than sphere radius\r\n if (radius / this._cellInnerR < 10) {\r\n this._forEachVoxelWithinRadiusSimple(center, radius, process);\r\n return;\r\n }\r\n\r\n let rRangeXY;\r\n let rRangeX;\r\n let xVal;\r\n let yVal;\r\n let zVal;\r\n let isInsideX;\r\n let isInsideY;\r\n let isInsideZ;\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor()\r\n .clampScalar(0, this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n\r\n isInsideZ = (center.z - radius <= zVal[0]) && (zVal[1] <= center.z + radius);\r\n\r\n rRangeXY = _getSphereSliceRadiusRange(center, radius, zVal[0], zVal[1]);\r\n\r\n yRange.set(center.y - rRangeXY[1], center.y + rRangeXY[1]);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor()\r\n .clampScalar(0, this._count.y - 1);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n\r\n isInsideY = (center.y - rRangeXY[0] <= yVal[0]) && (yVal[1] <= center.y + rRangeXY[0]);\r\n\r\n rRangeX = _getCircleSliceRadiusRange(center, rRangeXY[1], yVal[0], yVal[1]);\r\n\r\n xRange.set(center.x - rRangeX[1], center.x + rRangeX[1]);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor()\r\n .clampScalar(0, this._count.x - 1);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n isInsideX = (center.x - rRangeX[0] <= xVal[0]) && (xVal[1] <= center.x + rRangeX[0]);\r\n\r\n process(x + this._count.x * (y + this._count.y * z), isInsideX && isInsideY && isInsideZ);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each voxel that is touched by given sphere. Callback also takes flag\r\n * isInside specifying whether voxel lies inside the sphere entirely.\r\n * This is a version of method that doesn't try to \"calculate\" what voxels fall inside radius\r\n * but instead just checks all voxels inside sphere's bounding box. This should be faster\r\n * unless cell size is much smaller than sphere radius.\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(number,bool)} process - function to call that takes voxel index and boolean isInside\r\n */\r\n\r\n static _vCenter = new THREE.Vector3();\r\n\r\n _forEachVoxelWithinRadiusSimple(center, radius, process) {\r\n const xRange = VoxelWorld._xRange;\r\n const yRange = VoxelWorld._yRange;\r\n const zRange = VoxelWorld._zRange;\r\n const vCenter = VoxelWorld._vCenter;\r\n\r\n const distTouch2 = (radius + this._cellOuterR) * (radius + this._cellOuterR);\r\n let distInside2 = -1.0;\r\n if (radius > this._cellOuterR) {\r\n distInside2 = (radius - this._cellOuterR) * (radius - this._cellOuterR);\r\n }\r\n\r\n // calculate bounding box for the sphere\r\n xRange.set(center.x - radius, center.x + radius);\r\n xRange.subScalar(this._box.min.x)\r\n .divideScalar(this._cellSize.x)\r\n .floor();\r\n xRange.x = Math.min(Math.max(xRange.x, 0), this._count.x - 1);\r\n xRange.y = Math.min(Math.max(xRange.y, 0), this._count.x - 1);\r\n\r\n yRange.set(center.y - radius, center.y + radius);\r\n yRange.subScalar(this._box.min.y)\r\n .divideScalar(this._cellSize.y)\r\n .floor();\r\n yRange.x = Math.min(Math.max(yRange.x, 0), this._count.y - 1);\r\n yRange.y = Math.min(Math.max(yRange.y, 0), this._count.y - 1);\r\n\r\n zRange.set(center.z - radius, center.z + radius);\r\n zRange.subScalar(this._box.min.z)\r\n .divideScalar(this._cellSize.z)\r\n .floor();\r\n zRange.x = Math.min(Math.max(zRange.x, 0), this._count.z - 1);\r\n zRange.y = Math.min(Math.max(zRange.y, 0), this._count.z - 1);\r\n\r\n for (let z = zRange.x; z <= zRange.y; ++z) {\r\n const zVal = [this._box.min.z + z * this._cellSize.z,\r\n this._box.min.z + (z + 1) * this._cellSize.z];\r\n vCenter.z = 0.5 * (zVal[0] + zVal[1]);\r\n\r\n for (let y = yRange.x; y <= yRange.y; ++y) {\r\n const yVal = [this._box.min.y + y * this._cellSize.y,\r\n this._box.min.y + (y + 1) * this._cellSize.y];\r\n vCenter.y = 0.5 * (yVal[0] + yVal[1]);\r\n\r\n for (let { x } = xRange; x <= xRange.y; ++x) {\r\n const xVal = [this._box.min.x + x * this._cellSize.x,\r\n this._box.min.x + (x + 1) * this._cellSize.x];\r\n vCenter.x = 0.5 * (xVal[0] + xVal[1]);\r\n\r\n const d2 = center.distanceToSquared(vCenter);\r\n if (d2 <= distTouch2) {\r\n process(x + this._count.x * (y + this._count.y * z), d2 <= distInside2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call a function for each atom within given sphere\r\n *\r\n * @param {Vector3} center - center of the sphere\r\n * @param {number} radius - sphere radius\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinRadius(center, radius, process) {\r\n const self = this;\r\n const r2 = radius * radius;\r\n\r\n self._forEachVoxelWithinRadius(center, radius, (voxel, isInside) => {\r\n if (isInside) {\r\n self._forEachAtomInVoxel(voxel, process);\r\n } else {\r\n self._forEachAtomInVoxel(voxel, (atom) => {\r\n if (center.distanceToSquared(atom.position) <= r2) {\r\n process(atom);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by mask\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} mask - bit mask\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromMasked(complex, mask, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms defined by selector\r\n *\r\n * @param {Complex} complex - complex\r\n * @param {number} selector - selector\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n forEachAtomWithinDistFromSelected(complex, selector, dist, process) {\r\n this._forEachAtomWithinDistFromGroup((atomProc) => {\r\n complex.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n atomProc(atom);\r\n }\r\n });\r\n }, dist, process);\r\n }\r\n\r\n /**\r\n * Call a function for each atom of given complex within given distance from group of atoms\r\n *\r\n * @param {function} forEachAtom - enumerator of atoms in the group\r\n * @param {number} dist - distance\r\n * @param {function(Atom)} process - function to call\r\n */\r\n _forEachAtomWithinDistFromGroup(forEachAtom, dist, process) {\r\n const self = this;\r\n const r2 = dist * dist;\r\n\r\n const voxels = [];\r\n const atoms = [];\r\n let idx = 0;\r\n\r\n // build \"within radius\" atom list for each voxel\r\n forEachAtom((atom) => {\r\n self._forEachVoxelWithinRadius(atom.position, dist, (voxel, isInside) => {\r\n if (isInside) {\r\n // this voxel is inside circle -- no check will be required\r\n voxels[voxel] = -1;\r\n } else if (typeof voxels[voxel] === 'undefined') {\r\n // this voxel isn't covered yet -- start building list of atoms\r\n atoms.push(atom);\r\n atoms.push(-1);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n } else if (voxels[voxel] !== -1) {\r\n // this voxel has a list of atoms required for distance check -- add atom to the list\r\n atoms.push(atom);\r\n atoms.push(voxels[voxel]);\r\n voxels[voxel] = idx;\r\n idx += 2;\r\n }\r\n });\r\n });\r\n\r\n let voxel;\r\n\r\n const processIfWithin = function (atom) {\r\n if (typeof voxels[voxel] === 'undefined') {\r\n return;\r\n }\r\n\r\n idx = voxels[voxel];\r\n if (idx === -1) {\r\n // this voxel is fully covered\r\n process(atom);\r\n return;\r\n }\r\n\r\n // check distance to each atom within radius from this voxel\r\n for (; idx >= 0; idx = atoms[idx + 1]) {\r\n if (atom.position.distanceToSquared(atoms[idx].position) < r2) {\r\n process(atom);\r\n break;\r\n }\r\n }\r\n };\r\n\r\n // for each marked voxel\r\n for (voxel in voxels) {\r\n if (voxels.hasOwnProperty(voxel)) {\r\n self._forEachAtomInVoxel(voxel, processIfWithin);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default VoxelWorld;\r\n","import ResidueType from './ResidueType';\r\nimport PairCollection from './AtomPairs';\r\n\r\nconst MINIMAL_DISTANCE = 0.5;\r\nconst MIN_HBOND_ENERGY = -9.9;\r\nconst MAX_HBOND_ENERGY = -0.5;\r\nconst COUPLING_CONSTANT = -27.888; // = -332 * 0.42 * 0.2\r\nconst MAX_COUPLING_DISTANCE = 5.0; // how far is the closest atom of a potential partner residue from CA atom\r\nconst MAX_RESIDUES_THRESHOLD = 1000;\r\n\r\nexport default class HBondInfo {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._hbonds = []; // array of bond info for each residue\r\n if (this._complex._residues.length > MAX_RESIDUES_THRESHOLD) {\r\n this._buildVW(); // optimized version using voxel grid\r\n } else {\r\n this._build(); // test all pairs of residues\r\n }\r\n }\r\n\r\n isBond(from, to) {\r\n if (this._hbonds[from]) {\r\n const [acc0, acc1] = this._hbonds[from].acceptor;\r\n if (acc0 && acc0.residue === to && acc0.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n if (acc1 && acc1.residue === to && acc1.energy < MAX_HBOND_ENERGY) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n\r\n for (let i = 0; i < this._complex._residues.length - 1; ++i) {\r\n const ri = this._complex._residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let preri = null;\r\n if (i > 0 && (this._complex._residues[i - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && ri._sequence === this._complex._residues[i - 1]._sequence + 1) {\r\n preri = this._complex._residues[i - 1];\r\n }\r\n\r\n for (let j = i + 1; j < this._complex._residues.length; ++j) {\r\n const rj = this._complex._residues[j];\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = null;\r\n if ((this._complex._residues[j - 1].getType().flags & ResidueType.Flags.PROTEIN)\r\n && rj._sequence === this._complex._residues[j - 1]._sequence + 1) {\r\n prerj = this._complex._residues[j - 1];\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (j !== i + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _buildVW() {\r\n const self = this;\r\n const residues = this._complex._residues;\r\n let ri;\r\n let preri;\r\n\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return;\r\n }\r\n\r\n const pairs = new PairCollection(this._complex._residues.length * this._complex._residues.length / 2);\r\n\r\n function processAtom(atom) {\r\n const rj = atom.residue;\r\n\r\n if (rj._index === ri._index) {\r\n return;\r\n }\r\n\r\n if ((rj.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n return;\r\n }\r\n\r\n if (!pairs.addPair(ri._index, rj._index)) {\r\n // we've seen this pair\r\n return;\r\n }\r\n\r\n // get predecessor in chain\r\n let prerj = rj._index > 0 ? residues[rj._index - 1] : null;\r\n if (prerj\r\n && ((prerj.getType().flags & ResidueType.Flags.PROTEIN) === 0 || rj._sequence !== prerj._sequence + 1)) {\r\n prerj = null;\r\n }\r\n\r\n self._calcHBondEnergy(preri, ri, rj);\r\n if (rj._index !== ri._index + 1) {\r\n self._calcHBondEnergy(prerj, rj, ri);\r\n }\r\n }\r\n\r\n for (let i = 0; i < residues.length - 1; ++i) {\r\n ri = residues[i];\r\n if ((ri.getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n continue;\r\n }\r\n\r\n // get predecessor in chain\r\n preri = i > 0 ? residues[i - 1] : null;\r\n if (preri\r\n && ((preri.getType().flags & ResidueType.Flags.PROTEIN) === 0 || ri._sequence !== preri._sequence + 1)) {\r\n preri = null;\r\n }\r\n\r\n vw.forEachAtomWithinRadius(this._residueGetCAlpha(ri), MAX_COUPLING_DISTANCE, processAtom);\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _residueGetCO(res) {\r\n let c = null;\r\n let o = null;\r\n\r\n res.forEachAtom((a) => {\r\n if (a.name === 'C') {\r\n c = a.position;\r\n } else if (a.name === 'O') {\r\n o = a.position;\r\n }\r\n });\r\n\r\n return [c, o];\r\n }\r\n\r\n // TODO Support hydrogen defined in complex\r\n _residueGetNH(prev, res) {\r\n const [c, o] = this._residueGetCO(prev);\r\n\r\n let n;\r\n res.forEachAtom((a) => {\r\n if (a.name === 'N') {\r\n n = a.position;\r\n }\r\n });\r\n\r\n if (c && o && n) {\r\n // calculate hydrogen position\r\n const h = c.clone();\r\n h.sub(o);\r\n h.multiplyScalar(1.0 / h.length());\r\n h.add(n);\r\n\r\n return [n, h];\r\n }\r\n\r\n return [null, null];\r\n }\r\n\r\n _calcHBondEnergy(predonor, donor, acceptor) {\r\n let result = 0;\r\n\r\n if (predonor === null) {\r\n return result;\r\n }\r\n\r\n if (donor.getType().getName() !== 'PRO') {\r\n const [n, h] = this._residueGetNH(predonor, donor);\r\n const [c, o] = this._residueGetCO(acceptor);\r\n\r\n if (n === null || h === null || c === null || o === null) {\r\n return result;\r\n }\r\n\r\n const distanceHO = h.distanceTo(o);\r\n const distanceHC = h.distanceTo(c);\r\n const distanceNC = n.distanceTo(c);\r\n const distanceNO = n.distanceTo(o);\r\n\r\n if (distanceHO < MINIMAL_DISTANCE || distanceHC < MINIMAL_DISTANCE\r\n || distanceNC < MINIMAL_DISTANCE || distanceNO < MINIMAL_DISTANCE) {\r\n result = MIN_HBOND_ENERGY;\r\n } else {\r\n result = COUPLING_CONSTANT / distanceHO - COUPLING_CONSTANT / distanceHC\r\n + COUPLING_CONSTANT / distanceNC - COUPLING_CONSTANT / distanceNO;\r\n }\r\n\r\n // DSSP compatibility mode:\r\n result = Math.round(result * 1000) / 1000;\r\n\r\n if (result < MIN_HBOND_ENERGY) {\r\n result = MIN_HBOND_ENERGY;\r\n }\r\n }\r\n\r\n // update donor\r\n if (typeof this._hbonds[donor._index] === 'undefined') {\r\n this._hbonds[donor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const donorInfo = this._hbonds[donor._index];\r\n\r\n if (donorInfo.acceptor.length < 2) {\r\n donorInfo.acceptor.push({\r\n residue: acceptor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (donorInfo.acceptor.length > 1) {\r\n if (result < donorInfo.acceptor[0].energy) {\r\n donorInfo.acceptor[1].residue = donorInfo.acceptor[0].residue;\r\n donorInfo.acceptor[1].energy = donorInfo.acceptor[0].energy;\r\n donorInfo.acceptor[0].residue = acceptor._index;\r\n donorInfo.acceptor[0].energy = result;\r\n } else if (result < donorInfo.acceptor[1].energy) {\r\n donorInfo.acceptor[1].residue = acceptor._index;\r\n donorInfo.acceptor[1].energy = result;\r\n }\r\n }\r\n\r\n // update acceptor\r\n if (typeof this._hbonds[acceptor._index] === 'undefined') {\r\n this._hbonds[acceptor._index] = {\r\n donor: [],\r\n acceptor: [],\r\n };\r\n }\r\n const accInfo = this._hbonds[acceptor._index];\r\n\r\n if (accInfo.donor.length < 2) {\r\n accInfo.donor.push({\r\n residue: donor._index,\r\n energy: result,\r\n });\r\n }\r\n\r\n if (accInfo.donor.length > 1) {\r\n if (result < accInfo.donor[0].energy) {\r\n accInfo.donor[1].residue = accInfo.donor[0].residue;\r\n accInfo.donor[1].energy = accInfo.donor[0].energy;\r\n accInfo.donor[0].residue = donor._index;\r\n accInfo.donor[0].energy = result;\r\n } else if (result < accInfo.donor[1].energy) {\r\n accInfo.donor[1].residue = donor._index;\r\n accInfo.donor[1].energy = result;\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n","import HBondInfo from './HBondInfo';\r\nimport ResidueType from './ResidueType';\r\n\r\nconst BridgeType = Object.freeze({\r\n NO_BRIDGE: 0,\r\n PARALLEL: 1,\r\n ANTI_PARALLEL: 2,\r\n});\r\n\r\nconst HelixFlag = Object.freeze({\r\n START: 1,\r\n MIDDLE: 2,\r\n END: 3,\r\n START_AND_END: 4,\r\n});\r\n\r\nconst StructureType = Object.freeze({\r\n STRAND: 'E',\r\n BRIDGE: 'B',\r\n HELIX_310: 'G',\r\n HELIX_ALPHA: 'H',\r\n HELIX_PI: 'I',\r\n TURN: 'T',\r\n BEND: 'S',\r\n LOOP: ' ',\r\n});\r\n\r\nexport default class SecondaryStructureMap {\r\n constructor(complex) {\r\n this._complex = complex;\r\n this._build();\r\n }\r\n\r\n _build() {\r\n const self = this;\r\n this._hbonds = new HBondInfo(this._complex);\r\n this._ss = []; // DSSP map by residue\r\n\r\n // auxilliary data\r\n this._sheet = [];\r\n this._betaPartners = [];\r\n this._bend = [];\r\n for (let i = 0; i < this._complex.getResidues().length; ++i) {\r\n this._betaPartners[i] = [];\r\n }\r\n this._helixFlags = [];\r\n this._helixFlags[3] = [];\r\n this._helixFlags[4] = [];\r\n this._helixFlags[5] = [];\r\n\r\n // calculate peptide chain lengths\r\n this._chainLengths = [];\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i].getResidues();\r\n let len = 0;\r\n for (; len < chain.length; ++len) {\r\n if ((chain[len].getType().flags & ResidueType.Flags.PROTEIN) === 0) {\r\n break;\r\n }\r\n }\r\n this._chainLengths[i] = len;\r\n }\r\n\r\n this._buildBetaSheets();\r\n\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n self._buildAlphaHelices(this._complex._chains[i].getResidues(), this._chainLengths[i], false);\r\n }\r\n }\r\n\r\n _buildAlphaHelices(inResidues, chainLength, inPreferPiHelices) {\r\n // Helix and Turn\r\n for (let stride = 3; stride <= 5; ++stride) {\r\n if (inResidues.length < stride) {\r\n break;\r\n }\r\n\r\n for (let i = 0; i + stride < chainLength; ++i) {\r\n if (this._hbonds.isBond(inResidues[i + stride]._index, inResidues[i]._index)\r\n /* && NoChainBreak(res[i], res[i + stride]) */) {\r\n this._helixFlags[stride][inResidues[i + stride]._index] = HelixFlag.END;\r\n for (let j = i + 1; j < i + stride; ++j) {\r\n if (typeof this._helixFlags[stride][inResidues[j]._index] === 'undefined') {\r\n this._helixFlags[stride][inResidues[j]._index] = HelixFlag.MIDDLE;\r\n }\r\n }\r\n\r\n if (this._helixFlags[stride][inResidues[i]._index] === HelixFlag.END) {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START_AND_END;\r\n } else {\r\n this._helixFlags[stride][inResidues[i]._index] = HelixFlag.START;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 2; i < chainLength - 2; ++i) {\r\n const kappa = this._kappa(inResidues[i - 2], inResidues[i], inResidues[i + 2]);\r\n this._bend[inResidues[i]._index] = (kappa !== 360 && kappa > 70);\r\n }\r\n\r\n for (let i = 1; i + 4 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 4) && this._isHelixStart(inResidues[i - 1]._index, 4)) {\r\n for (let j = i; j <= i + 3; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_ALPHA;\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 3 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 3) && this._isHelixStart(inResidues[i - 1]._index, 3)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 2; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_310;\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 2; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_310;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 5 < chainLength; ++i) {\r\n if (this._isHelixStart(inResidues[i]._index, 5) && this._isHelixStart(inResidues[i - 1]._index, 5)) {\r\n let empty = true;\r\n for (let j = i; empty && j <= i + 4; ++j) {\r\n empty = typeof this._ss[inResidues[j]._index] === 'undefined'\r\n || this._ss[inResidues[j]._index] === StructureType.HELIX_PI\r\n || (inPreferPiHelices && this._ss[inResidues[j]._index] === StructureType.HELIX_ALPHA);\r\n }\r\n if (empty) {\r\n for (let j = i; j <= i + 4; ++j) {\r\n this._ss[inResidues[j]._index] = StructureType.HELIX_PI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 1; i + 1 < chainLength; ++i) {\r\n if (typeof this._ss[inResidues[i]._index] === 'undefined') {\r\n let isTurn = false;\r\n for (let stride = 3; stride <= 5 && !isTurn; ++stride) {\r\n for (let k = 1; k < stride && !isTurn; ++k) {\r\n isTurn = (i >= k) && this._isHelixStart(inResidues[i - k]._index, stride);\r\n }\r\n }\r\n\r\n if (isTurn) {\r\n this._ss[inResidues[i]._index] = StructureType.TURN;\r\n } else if (this._bend[inResidues[i]._index]) {\r\n this._ss[inResidues[i]._index] = StructureType.BEND;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _residueGetCAlpha(res) {\r\n for (let i = 0; i < res._atoms.length; ++i) {\r\n const { name } = res._atoms[i];\r\n if (name === 'CA'\r\n || name === 'C1') {\r\n return res._atoms[i].position;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _cosinusAngle(p1, p2, p3, p4) {\r\n const v12 = p1.clone().sub(p2);\r\n const v34 = p3.clone().sub(p4);\r\n\r\n let result = 0;\r\n\r\n const x = v12.dot(v12) * v34.dot(v34);\r\n if (x > 0) {\r\n result = v12.dot(v34) / Math.sqrt(x);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _kappa(prevPrev, res, nextNext) {\r\n const curCA = this._residueGetCAlpha(res);\r\n const ppCA = this._residueGetCAlpha(prevPrev);\r\n const nnCA = this._residueGetCAlpha(nextNext);\r\n if (curCA === null || ppCA === null || nnCA === null) {\r\n return 180;\r\n }\r\n\r\n const ckap = this._cosinusAngle(curCA, ppCA, nnCA, curCA);\r\n const skap = Math.sqrt(1 - ckap * ckap);\r\n return Math.atan2(skap, ckap) * 180 / Math.PI;\r\n }\r\n\r\n _isHelixStart(res, stride) {\r\n return (this._helixFlags[stride][res] === HelixFlag.START\r\n || this._helixFlags[stride][res] === HelixFlag.START_AND_END);\r\n }\r\n\r\n _buildBetaSheets() {\r\n // find bridges\r\n // check each chain against each other chain, and against itself\r\n const bridges = [];\r\n for (let a = 0; a < this._complex._chains.length; ++a) {\r\n const lenA = this._chainLengths[a];\r\n if (lenA <= 4) {\r\n continue;\r\n }\r\n\r\n const chainA = this._complex._chains[a].getResidues();\r\n\r\n for (let b = a; b < this._complex._chains.length; ++b) {\r\n const lenB = this._chainLengths[b];\r\n if (lenB <= 4) {\r\n continue;\r\n }\r\n\r\n const chainB = this._complex._chains[b].getResidues();\r\n\r\n for (let i = 1; i + 1 < lenA; ++i) {\r\n const ri = chainA[i];\r\n\r\n let j = 1;\r\n if (b === a) {\r\n j = i + 3; // check for self-bridges forward down the chain\r\n }\r\n\r\n for (; j + 1 < lenB; ++j) {\r\n const rj = chainB[j];\r\n\r\n const type = this._testBridge(chainA, i, chainB, j);\r\n if (type === BridgeType.NO_BRIDGE) {\r\n continue;\r\n }\r\n\r\n // there is a bridge, try to attach it to previously found sequence\r\n let found = false;\r\n for (const bridge of bridges) {\r\n if (type !== bridge.type || ri._index !== bridge.i[bridge.i.length - 1] + 1) {\r\n continue;\r\n }\r\n\r\n if (type === BridgeType.PARALLEL && bridge.j[bridge.j.length - 1] + 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.push(rj._index);\r\n found = true;\r\n break;\r\n }\r\n\r\n if (type === BridgeType.ANTI_PARALLEL && bridge.j[0] - 1 === rj._index) {\r\n bridge.i.push(ri._index);\r\n bridge.j.unshift(rj._index);\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n // this bridge cannot be attached anywhere, start a new sequence\r\n if (!found) {\r\n bridges.push({\r\n type,\r\n i: [ri._index],\r\n chainI: ri.getChain()._index,\r\n j: [rj._index],\r\n chainJ: rj.getChain()._index,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // extend ladders\r\n bridges.sort((a, b) => {\r\n if (a.chainI < b.chainI || (a.chainI === b.chainI && a.i[0] < b.i[0])) {\r\n return -1;\r\n }\r\n return 1;\r\n });\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n for (let j = i + 1; j < bridges.length; ++j) {\r\n const ibi = bridges[i].i[0];\r\n const iei = bridges[i].i[bridges[i].i.length - 1];\r\n const jbi = bridges[i].j[0];\r\n const jei = bridges[i].j[bridges[i].j.length - 1];\r\n const ibj = bridges[j].i[0];\r\n const iej = bridges[j].i[bridges[j].i.length - 1];\r\n const jbj = bridges[j].j[0];\r\n const jej = bridges[j].j[bridges[j].j.length - 1];\r\n\r\n if (bridges[i].type !== bridges[j].type\r\n || this._hasChainBreak(Math.min(ibi, ibj), Math.max(iei, iej))\r\n || this._hasChainBreak(Math.min(jbi, jbj), Math.max(jei, jej))\r\n || ibj - iei >= 6 || (iei >= ibj && ibi <= iej)) {\r\n continue;\r\n }\r\n\r\n let bulge = false;\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bulge = ((jbj - jei < 6 && ibj - iei < 3) || (jbj - jei < 3));\r\n } else {\r\n bulge = ((jbi - jej < 6 && ibj - iei < 3) || (jbi - jej < 3));\r\n }\r\n\r\n if (bulge) {\r\n bridges[i].i = bridges[i].i.concat(bridges[j].i);\r\n if (bridges[i].type === BridgeType.PARALLEL) {\r\n bridges[i].j = bridges[i].j.concat(bridges[j].j);\r\n } else {\r\n bridges[i].j = bridges[j].j.concat(bridges[i].j);\r\n }\r\n bridges.splice(j--, 1);\r\n }\r\n }\r\n }\r\n\r\n // Sheet\r\n const ladderset = new Set();\r\n for (let i = 0; i < bridges.length; ++i) {\r\n ladderset.add(bridges[i]);\r\n }\r\n\r\n let sheet = 1;\r\n let ladder = 0;\r\n while (ladderset.size > 0) {\r\n let bridge = ladderset.values().next().value;\r\n ladderset.delete(bridge);\r\n\r\n const sheetset = new Set();\r\n sheetset.add(bridge);\r\n\r\n let toMove;\r\n do {\r\n toMove = new Set();\r\n for (const a of sheetset.values()) {\r\n for (const b of ladderset.values()) {\r\n if (this._areBridgesLinked(a, b)) {\r\n toMove.add(b);\r\n }\r\n }\r\n }\r\n for (bridge of toMove.values()) {\r\n sheetset.add(bridge);\r\n ladderset.delete(bridge);\r\n }\r\n } while (toMove.size > 0);\r\n\r\n for (bridge of sheetset.values()) {\r\n bridge.ladder = ladder;\r\n bridge.sheet = sheet;\r\n bridge.link = sheetset;\r\n ++ladder;\r\n }\r\n\r\n ++sheet;\r\n }\r\n\r\n for (let i = 0; i < bridges.length; ++i) {\r\n const bridge = bridges[i];\r\n\r\n // find out if any of the i and j set members already have\r\n // a bridge assigned, if so, we're assigning bridge 2\r\n\r\n let betai = 0;\r\n let betaj = 0;\r\n\r\n for (let l = 0; l < bridge.i.length; ++l) {\r\n if (this._betaPartners[bridge.i[l]][0]) {\r\n betai = 1;\r\n break;\r\n }\r\n }\r\n\r\n for (let l = 0; l < bridge.j.length; ++l) {\r\n if (this._betaPartners[bridge.j[l]][0]) {\r\n betaj = 1;\r\n break;\r\n }\r\n }\r\n\r\n let ss = StructureType.BRIDGE;\r\n if (bridge.i.length > 1) {\r\n ss = StructureType.STRAND;\r\n }\r\n\r\n if (bridge.type === BridgeType.PARALLEL) {\r\n let j = 0;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n\r\n j = 0;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j++],\r\n ladder: bridge.ladder,\r\n parallel: true,\r\n };\r\n }\r\n } else {\r\n let j = bridge.j.length - 1;\r\n for (let k = 0; k < bridge.i.length; ++k) {\r\n this._betaPartners[bridge.i[k]][betai] = {\r\n residue: bridge.j[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n\r\n j = bridge.i.length - 1;\r\n for (let k = 0; k < bridge.j.length; ++k) {\r\n this._betaPartners[bridge.j[k]][betaj] = {\r\n residue: bridge.i[j--],\r\n ladder: bridge.ladder,\r\n parallel: false,\r\n };\r\n }\r\n }\r\n\r\n for (let k = bridge.i[0]; k <= bridge.i[bridge.i.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n\r\n for (let k = bridge.j[0]; k <= bridge.j[bridge.j.length - 1]; ++k) {\r\n if (this._ss[k] !== StructureType.STRAND) {\r\n this._ss[k] = ss;\r\n this._sheet[k] = bridge.sheet;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _testBridge(chainA, from, chainB, to) {\r\n let result = BridgeType.NO_BRIDGE;\r\n\r\n const a = chainA[from - 1]._index;\r\n const b = chainA[from]._index;\r\n const c = chainA[from + 1]._index;\r\n const d = chainB[to - 1]._index;\r\n const e = chainB[to]._index;\r\n const f = chainB[to + 1]._index;\r\n\r\n const isBond = this._hbonds.isBond.bind(this._hbonds);\r\n if ((isBond(c, e) && isBond(e, a)) || (isBond(f, b) && isBond(b, d))) {\r\n result = BridgeType.PARALLEL;\r\n } else if ((isBond(c, d) && isBond(f, a)) || (isBond(e, b) && isBond(b, e))) {\r\n result = BridgeType.ANTI_PARALLEL;\r\n }\r\n return result;\r\n }\r\n\r\n // return true if any of the residues in bridge a is identical to any of the residues in bridge b\r\n _areBridgesLinked(a, b) {\r\n const ai = new Set(a.i);\r\n const aj = new Set(a.j);\r\n\r\n for (const i of b.i) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n for (const i of b.j) {\r\n if (ai.has(i) || aj.has(i)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n _hasChainBreak(from, to) {\r\n for (let i = from + 1; i <= to; ++i) {\r\n if (this._complex._residues[i]._sequence !== this._complex._residues[i - 1]._sequence + 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\nSecondaryStructureMap.StructureType = StructureType;\r\n","import * as THREE from 'three';\r\nimport logger from '../utils/logger';\r\nimport Atom from './Atom';\r\nimport Chain from './Chain';\r\nimport Helix from './Helix';\r\nimport Strand from './Strand';\r\nimport Sheet from './Sheet';\r\nimport Component from './Component';\r\nimport ResidueType from './ResidueType';\r\nimport Bond from './Bond';\r\nimport AutoBond from './AutoBond';\r\nimport AromaticLoopsMarker from './AromaticLoopsMarker';\r\nimport BiologicalUnit from './BiologicalUnit';\r\nimport selectors from './selectors';\r\nimport VoxelWorld from './VoxelWorld';\r\nimport SecondaryStructureMap from './SecondaryStructureMap';\r\nimport StructuralElement from './StructuralElement';\r\n\r\nconst VOXEL_SIZE = 5.0;\r\n\r\nconst { StructureType } = SecondaryStructureMap;\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see http://www.wwpdb.org/documentation/file-format-content/format33/sect5.html#HELIX\r\nconst helixClassMap = {\r\n [StructureType.HELIX_ALPHA]: 1,\r\n [StructureType.HELIX_PI]: 3,\r\n [StructureType.HELIX_310]: 5,\r\n};\r\n\r\nconst loopMap = {\r\n [StructureType.BRIDGE]: StructuralElementType.BRIDGE,\r\n [StructureType.TURN]: StructuralElementType.TURN,\r\n [StructureType.BEND]: StructuralElementType.BEND,\r\n [StructureType.LOOP]: StructuralElementType.COIL,\r\n};\r\n\r\n/**\r\n * The entire complex of the molecules under study.\r\n *\r\n * @exports Complex\r\n * @constructor\r\n */\r\nclass Complex {\r\n constructor() {\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n\r\n this._residueTypes = Object.create(ResidueType.StandardTypes);\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n this._molecules = [];\r\n this._maskNeedsUpdate = false;\r\n\r\n this.metadata = {};\r\n\r\n this.symmetry = [];\r\n this.units = [new BiologicalUnit(this)];\r\n this._currentUnit = 0; // default biological unit is the asymmetric unit\r\n }\r\n\r\n addAtom(atom) {\r\n const index = this._atoms.length;\r\n this._atoms.push(atom);\r\n return index;\r\n }\r\n\r\n addSheet(sheet) {\r\n const index = this._sheets.length;\r\n this._sheets.push(sheet);\r\n return index;\r\n }\r\n\r\n addHelix(helix) {\r\n const index = this._helices.length;\r\n this._helices.push(helix);\r\n return index;\r\n }\r\n\r\n getAtoms() {\r\n return this._atoms;\r\n }\r\n\r\n getBonds() {\r\n return this._bonds;\r\n }\r\n\r\n getAtomCount() {\r\n return this._atoms.length;\r\n }\r\n\r\n addResidue(residue) {\r\n const index = this._residues.length;\r\n this._residues.push(residue);\r\n return index;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n this.forEachChain((chain) => {\r\n chain.updateToFrame(frameData);\r\n });\r\n }\r\n\r\n addResidueType(resName) {\r\n const rt = this._residueTypes[resName] = new ResidueType(resName, 'Unknown', '');\r\n return rt;\r\n }\r\n\r\n getResidueCount() {\r\n return this._residues.length;\r\n }\r\n\r\n getResidues() {\r\n return this._residues;\r\n }\r\n\r\n getSGroupCount() {\r\n return this._sgroups.length;\r\n }\r\n\r\n getSGroups() {\r\n return this._sgroups;\r\n }\r\n\r\n /*\r\n Extract atom by its fullname: #chainName#.#residueId#.#atomName#\r\n */\r\n getAtomByFullname(fullName) {\r\n const parts = fullName.split('.');\r\n if (parts.length !== 3) {\r\n return null;\r\n }\r\n\r\n const chainName = parts[0];\r\n const resId = parseInt(parts[1], 10);\r\n if (Number.isNaN(resId)) {\r\n return null;\r\n }\r\n const atomName = parts[2].toUpperCase();\r\n\r\n let currAtom = null;\r\n this.forEachChain((chain) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (chain._name.localeCompare(chainName) === 0) {\r\n chain.forEachResidue((residue) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (residue._sequence === resId) {\r\n residue.forEachAtom((atom) => {\r\n if (currAtom) {\r\n return;\r\n }\r\n if (atomName.localeCompare(atom.name) === 0) {\r\n currAtom = atom;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n });\r\n\r\n return currAtom;\r\n }\r\n\r\n /**\r\n * Create a new chain.\r\n *\r\n * @param {string} name - Chain name.\r\n * @returns {Chain} - Newly created chain.\r\n */\r\n addChain(name) {\r\n const result = new Chain(this, name);\r\n this._chains.push(result);\r\n return result;\r\n }\r\n\r\n getChain(name) {\r\n for (let i = 0, n = this._chains.length; i < n; ++i) {\r\n const chain = this._chains[i];\r\n if (chain.getName() === name) {\r\n return chain;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n getChainCount() {\r\n return this._chains.length;\r\n }\r\n\r\n getMolecules() {\r\n return this._molecules;\r\n }\r\n\r\n getMoleculeCount() {\r\n return this._molecules.length;\r\n }\r\n\r\n forEachAtom(process) {\r\n const atoms = this._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n process(atoms[i]);\r\n }\r\n }\r\n\r\n forEachBond(process) {\r\n const bonds = this._bonds;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n process(bonds[i]);\r\n }\r\n }\r\n\r\n forEachResidue(process) {\r\n const residues = this._residues;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n forEachChain(process) {\r\n const chains = this._chains;\r\n for (let i = 0, n = chains.length; i < n; ++i) {\r\n process(chains[i]);\r\n }\r\n }\r\n\r\n forEachMolecule(process) {\r\n const molecules = this._molecules;\r\n const n = molecules.length;\r\n for (let i = 0; i < n; ++i) {\r\n process(molecules[i]);\r\n }\r\n }\r\n\r\n forEachSGroup(process) {\r\n const groups = this._sgroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n process(groups[i]);\r\n }\r\n }\r\n\r\n forEachComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n forEachVisibleComponent(process) {\r\n const components = this._components;\r\n for (let i = 0, n = components.length; i < n; ++i) {\r\n process(components[i]);\r\n }\r\n }\r\n\r\n addBond(left, right, order, type, fixed) {\r\n const bond = new Bond(left, right, order, type, fixed);\r\n this._bonds.push(bond);\r\n return bond;\r\n }\r\n\r\n getBondCount() {\r\n return this._bonds.length;\r\n }\r\n\r\n getResidueType(name) {\r\n return this._residueTypes[name] || null;\r\n }\r\n\r\n getUnifiedSerial(chain, serial, iCode) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n return serial + iCode * maxSerial + chain * chainShift;\r\n }\r\n\r\n splitUnifiedSerial(uniSerial) {\r\n /* eslint-disable no-magic-numbers */\r\n const maxSerial = 65536;\r\n const chainShift = maxSerial * 256;\r\n /* eslint-enable no-magic-numbers */\r\n const chainId = Math.floor(uniSerial / chainShift);\r\n const remnant = uniSerial - chainId * chainShift;\r\n const insCode = Math.floor(remnant / maxSerial);\r\n const ser = remnant - insCode * maxSerial;\r\n return { chain: chainId, serial: ser, iCode: insCode };\r\n }\r\n\r\n _fillCmpEdit() {\r\n const self = this;\r\n const components = this._components;\r\n\r\n function addComp() {\r\n const comp = new Component(self);\r\n comp._index = components.length;\r\n components[comp._index] = comp;\r\n return comp;\r\n }\r\n\r\n this.forEachChain((chain) => {\r\n const residues = chain._residues;\r\n const resCount = residues.length;\r\n if (resCount < 1) {\r\n return;\r\n }\r\n let comp = addComp();\r\n let currStart = residues[0]._index;\r\n\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)\r\n || currRes._index !== nextRes._index - 1) {\r\n // the last condition is broken and incorrect\r\n // the refactoring of the Component is required in order to fix this issue\r\n comp.setSubDivs([{\r\n start: currStart,\r\n end: currRes._index,\r\n }]);\r\n if (nextRes) {\r\n currStart = nextRes._index;\r\n comp = addComp();\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n // This function was added in the moment of despair\r\n // It was the dark times for miew\r\n _fillCmpNoedit() {\r\n const comp = new Component(this);\r\n comp._index = 0;\r\n\r\n const residues = this._residues;\r\n const resCount = residues.length;\r\n if (resCount === 0) {\r\n return;\r\n }\r\n\r\n const currSubDivs = [];\r\n let currStart = 0;\r\n for (let i = 0; i < resCount; ++i) {\r\n const currRes = residues[i];\r\n currRes._component = comp;\r\n\r\n const nextRes = i === resCount - 1 ? null : residues[i + 1];\r\n if (!nextRes\r\n || !currRes.isConnected(nextRes)) {\r\n // wrap up this interval\r\n currSubDivs[currSubDivs.length] = {\r\n start: currStart,\r\n end: i,\r\n };\r\n if (nextRes) {\r\n currStart = i + 1;\r\n }\r\n }\r\n }\r\n\r\n comp.setSubDivs(currSubDivs);\r\n this._components[comp._index] = comp;\r\n }\r\n\r\n /**\r\n * Fill components information.\r\n * @param {boolean} enableEditing - Restructure Complex to enable per-component editing.\r\n */\r\n _fillComponents(enableEditing) {\r\n if (enableEditing) {\r\n this._fillCmpEdit();\r\n } else {\r\n this._fillCmpNoedit();\r\n }\r\n }\r\n\r\n getCurrentUnit() {\r\n return this._currentUnit;\r\n }\r\n\r\n getDefaultBoundaries() {\r\n return this.units[0].getBoundaries();\r\n }\r\n\r\n getBoundaries() {\r\n return this.units[this._currentUnit].getBoundaries();\r\n }\r\n\r\n getTransforms() {\r\n return this.units[this._currentUnit].getTransforms();\r\n }\r\n\r\n getSelector() {\r\n return this.units[this._currentUnit].getSelector();\r\n }\r\n\r\n resetCurrentUnit() {\r\n this._currentUnit = 0;\r\n this.setCurrentUnit(1);\r\n }\r\n\r\n setCurrentUnit(newUnit) {\r\n if (newUnit !== null && newUnit !== undefined\r\n && newUnit !== this._currentUnit\r\n && newUnit >= 0\r\n && newUnit < this.units.length) {\r\n this._currentUnit = newUnit;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n _computeBounds() {\r\n const { units } = this;\r\n for (let i = 0, n = units.length; i < n; ++i) {\r\n units[i].computeBoundaries();\r\n }\r\n }\r\n\r\n onAtomPositionChanged() {\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n this.forEachComponent((c) => {\r\n c.update();\r\n });\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n this._finalizeBonds();\r\n this.forEachSGroup((s) => {\r\n s._rebuildSGroupOnAtomChange();\r\n });\r\n }\r\n\r\n update() {\r\n if (this._maskNeedsUpdate) {\r\n this.updateStructuresMask();\r\n this._maskNeedsUpdate = false;\r\n }\r\n }\r\n\r\n _finalizeBonds() {\r\n const bonds = this.getBonds();\r\n const n = bonds.length;\r\n for (let i = 0; i < n; ++i) {\r\n bonds[i]._index = i;\r\n }\r\n }\r\n\r\n /**\r\n * Finalizes complex's inner data(i.e. after parsing).\r\n * @param {objects} opts - Build bonds automatically.\r\n * @param {boolean} opts.needAutoBonding - Build bonds automatically.\r\n * @param {boolean} opts.detectAromaticLoops - Find/mark aromatic loops.\r\n * @param {boolean} opts.enableEditing - Restructure Complex to enable per-component editing.\r\n * @param {Array} [opts.serialAtomMap] - Array of atoms ordered by their serials.\r\n */\r\n finalize(opts) {\r\n opts = opts || {};\r\n // Put bonds into atoms\r\n const bonds = this._bonds;\r\n let i;\r\n let n;\r\n // remove invalid bonds\r\n for (i = bonds.length - 1; i >= 0; i--) {\r\n const bond = bonds[i];\r\n if (bond._left === null || bond._right === null) {\r\n bonds.splice(i, 1);\r\n } else {\r\n bond._left.bonds.push(bond);\r\n bond._right.bonds.push(bond);\r\n }\r\n }\r\n\r\n const residues = this._residues;\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._finalize();\r\n }\r\n\r\n this.forEachChain((a) => {\r\n a._finalize();\r\n });\r\n\r\n // WARNING! this MUST be done BEFORE computeBounds is called\r\n const { units } = this;\r\n for (i = 0, n = units.length; i < n; ++i) {\r\n units[i].finalize();\r\n }\r\n // try setting first biomolecule by defaults\r\n this.setCurrentUnit(1);\r\n\r\n const residueHash = {};\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n const res = residues[i];\r\n // This code is extremely dangerous for non-PDB formats\r\n residueHash[this.getUnifiedSerial(\r\n res.getChain().getName().charCodeAt(0),\r\n res.getSequence(),\r\n res.getICode().charCodeAt(0),\r\n )] = res;\r\n }\r\n\r\n const { structures } = this;\r\n for (i = 0, n = structures.length; i < n; ++i) {\r\n structures[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const helices = this._helices;\r\n for (i = 0, n = helices.length; i < n; ++i) {\r\n helices[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n const sheets = this._sheets;\r\n for (i = 0, n = sheets.length; i < n; ++i) {\r\n sheets[i]._finalize(opts.serialAtomMap, residueHash, this);\r\n }\r\n\r\n // Update bounding sphere and box\r\n this._computeBounds();\r\n\r\n const atoms = this._atoms;\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const currAtom = atoms[i];\r\n currAtom.index = i;\r\n }\r\n\r\n if (opts.needAutoBonding) {\r\n const autoConnector = new AutoBond(this);\r\n autoConnector.build();\r\n autoConnector.destroy();\r\n }\r\n\r\n const chains = this._chains;\r\n for (i = 0, n = chains.length; i < n; ++i) {\r\n chains[i]._index = i;\r\n }\r\n\r\n for (i = 0, n = residues.length; i < n; ++i) {\r\n residues[i]._index = i;\r\n }\r\n\r\n // mark non-polar hydrogens\r\n for (i = 0, n = atoms.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n if (atom.flags & Atom.Flags.HYDROGEN && atom.bonds.length === 1) {\r\n const bond = atom.bonds[0];\r\n const other = (bond._left !== atom && bond._left) || bond._right;\r\n if (other.flags & Atom.Flags.CARBON) {\r\n atom.flags |= Atom.Flags.NONPOLARH;\r\n }\r\n }\r\n }\r\n\r\n this._finalizeBonds();\r\n this._fillComponents(opts.enableEditing);\r\n\r\n const marker = new AromaticLoopsMarker(this);\r\n marker.markCycles();\r\n if (opts.detectAromaticLoops) { // TODO remove this condition clause, it is for debug purposes only!\r\n marker.detectCycles(); // TODO add conditional detection\r\n }\r\n\r\n this._finalizeMolecules();\r\n }\r\n\r\n _finalizeMolecules() {\r\n // add reference to molecule into residue\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const molecule = this._molecules[i];\r\n const count = molecule.residues.length;\r\n for (let j = 0; j < count; j++) {\r\n const residue = molecule.residues[j];\r\n residue._molecule = molecule;\r\n }\r\n }\r\n }\r\n\r\n updateStructuresMask() {\r\n const updater = (structure) => structure.collectMask();\r\n this.forEachResidue(updater);\r\n this.forEachChain(updater);\r\n this.forEachMolecule(updater);\r\n }\r\n\r\n countAtomsByMask(mask) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if ((atom.mask & mask) !== 0) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n getNumAtomsBySelector(selector) {\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom)) {\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n resetAtomMask(mask) {\r\n this.forEachAtom((atom) => {\r\n atom.mask = mask;\r\n });\r\n }\r\n\r\n markAtoms(selector, mask) {\r\n const setMask = mask;\r\n const clearMask = ~setMask;\r\n let count = 0;\r\n const totalSelector = selectors.keyword('And')(selector, this.getSelector());\r\n\r\n this.forEachAtom((atom) => {\r\n if (totalSelector.includesAtom(atom)) {\r\n atom.mask |= setMask;\r\n count++;\r\n } else {\r\n atom.mask &= clearMask;\r\n }\r\n });\r\n this._maskNeedsUpdate = true;\r\n\r\n return count;\r\n }\r\n\r\n markAtomsAdditionally(selector, mask) {\r\n const setMask = mask;\r\n let count = 0;\r\n\r\n this.forEachAtom((atom) => {\r\n if (selector.includesAtom(atom) && (atom.mask & mask) !== mask) {\r\n atom.mask |= setMask;\r\n count++;\r\n }\r\n });\r\n\r\n return count;\r\n }\r\n\r\n clearAtomBits(mask) {\r\n const clearMask = ~mask;\r\n this.forEachAtom((atom) => {\r\n atom.mask &= clearMask;\r\n });\r\n const reseter = (a) => {\r\n a._mask &= clearMask;\r\n };\r\n this.forEachAtom(reseter);\r\n this.forEachResidue(reseter);\r\n this.forEachChain(reseter);\r\n this.forEachMolecule(reseter);\r\n }\r\n\r\n getAtomNames() {\r\n if (this.hasOwnProperty('_atomNames')) {\r\n return this._atomNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.name] = 1;\r\n });\r\n this._atomNames = Object.keys(dict);\r\n\r\n return this._atomNames;\r\n }\r\n\r\n getElements() {\r\n if (this.hasOwnProperty('_elements')) {\r\n return this._elements;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[atom.element.name] = 1;\r\n });\r\n this._elements = Object.keys(dict);\r\n\r\n return this._elements;\r\n }\r\n\r\n getResidueNames() {\r\n if (this.hasOwnProperty('_residueNames')) {\r\n return this._residueNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachResidue((res) => {\r\n dict[res._type._name] = 1;\r\n });\r\n this._residueNames = Object.keys(dict);\r\n\r\n return this._residueNames;\r\n }\r\n\r\n getChainNames() {\r\n if (this.hasOwnProperty('_chainNames')) {\r\n return this._chainNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachChain((chain) => {\r\n dict[chain._name] = 1;\r\n });\r\n this._chainNames = Object.keys(dict);\r\n\r\n return this._chainNames;\r\n }\r\n\r\n getAltLocNames() {\r\n if (this.hasOwnProperty('_altlocNames')) {\r\n return this._altlocNames;\r\n }\r\n\r\n const dict = {};\r\n this.forEachAtom((atom) => {\r\n dict[String.fromCharCode(atom.location)] = 1;\r\n });\r\n this._altlocNames = Object.keys(dict);\r\n\r\n return this._altlocNames;\r\n }\r\n\r\n getVoxelWorld() {\r\n if (!this.hasOwnProperty('_voxelWorld')) {\r\n try {\r\n this._voxelWorld = new VoxelWorld(\r\n this.getDefaultBoundaries().boundingBox,\r\n new THREE.Vector3(VOXEL_SIZE, VOXEL_SIZE, VOXEL_SIZE),\r\n );\r\n this._voxelWorld.addAtoms(this);\r\n } catch (e) {\r\n logger.warn('Unable to create voxel world');\r\n this._voxelWorld = null;\r\n }\r\n }\r\n\r\n return this._voxelWorld;\r\n }\r\n\r\n /**\r\n * Simple function to make unified routine procedure without code duplication.\r\n * @param {Array} srcArray - Source chemical structure array (will be part of resulting chemical structure array).\r\n * @param {Array} dstArray - Resulting chemical structure array.\r\n * @param {number} param - Parameter for processor.\r\n * @param {function} functor - Processor for every element in array.\r\n */\r\n addElement(srcArray, dstArray, param, functor) {\r\n const { length } = srcArray;\r\n for (let i = 0; i < length; ++i) {\r\n const elem = srcArray[i];\r\n functor(elem, param);\r\n dstArray.push(elem);\r\n }\r\n }\r\n\r\n // this function joins multiple complexes into one (this)\r\n // atom, bond, ... objects are reused -- so input complexes are no longer valid\r\n joinComplexes(complexes) {\r\n // clear target complex\r\n this._chains = [];\r\n this._components = [];\r\n this._helices = [];\r\n this._sheets = [];\r\n this.structures = [];\r\n this._atoms = [];\r\n this._residues = [];\r\n this._bonds = [];\r\n this._sgroups = [];\r\n\r\n const self = this;\r\n let atomBias = 0;\r\n let bondBias = 0;\r\n let residueBias = 0;\r\n let chainBias = 0;\r\n let componentBias = 0;\r\n\r\n function processAtom(atom, bias) {\r\n atom.serial += bias;\r\n atom.index += bias;\r\n }\r\n\r\n function processBond(bond, bias) {\r\n bond._index += bias;\r\n }\r\n\r\n function processResidue(residue, bias) {\r\n residue._index += bias;\r\n }\r\n\r\n function processChain(chain, bias) {\r\n chain._complex = self;\r\n chain._index += bias;\r\n }\r\n\r\n function processComponent(component, bias) {\r\n component._complex = self;\r\n component._index += bias;\r\n }\r\n\r\n /**\r\n * Simple function to do nothing.\r\n */\r\n function doNothing() {\r\n }\r\n\r\n for (let i = 0; i < complexes.length; ++i) {\r\n const c = complexes[i];\r\n this.addElement(c._atoms, this._atoms, atomBias, processAtom);\r\n this.addElement(c._bonds, this._bonds, bondBias, processBond);\r\n this.addElement(c._residues, this._residues, residueBias, processResidue);\r\n this.addElement(c._chains, this._chains, chainBias, processChain);\r\n this.addElement(c._sheets, this._sheets, 0, doNothing);\r\n this.addElement(c._helices, this._helices, 0, doNothing);\r\n this.addElement(c._sgroups, this._sgroups, 0, doNothing);\r\n this.addElement(c._components, this._components, componentBias, processComponent);\r\n this.addElement(c.structures, this.structures, 0, doNothing);\r\n // merge residue types\r\n for (const rt in c._residueTypes) {\r\n if (c._residueTypes.hasOwnProperty(rt)) {\r\n this._residueTypes[rt] = c._residueTypes[rt];\r\n }\r\n }\r\n\r\n atomBias += c._atoms.length;\r\n bondBias += c._bonds.length;\r\n residueBias += c._residues.length;\r\n chainBias += c._chains.length;\r\n componentBias += c._components.length;\r\n }\r\n\r\n this._computeBounds();\r\n }\r\n\r\n /**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n */\r\n dssp() {\r\n const ssMap = new SecondaryStructureMap(this);\r\n\r\n const structures = this.structures = [];\r\n const helices = this._helices = [];\r\n const sheets = this._sheets = [];\r\n\r\n const getSheet = (index) => {\r\n let item = sheets[index];\r\n if (!item) {\r\n item = sheets[index] = new Sheet(String(index), 0);\r\n }\r\n return item;\r\n };\r\n\r\n let lastCode;\r\n let lastSheetIndex;\r\n let lastHelixIndex = 0;\r\n let curStructure = null;\r\n for (let i = 0, n = this._residues.length; i < n; ++i) {\r\n const curCode = ssMap._ss[i];\r\n const curResidue = this._residues[i];\r\n const curSheetIndex = ssMap._sheet[i];\r\n\r\n // expand the last structure\r\n if (curCode === lastCode && curSheetIndex === lastSheetIndex) {\r\n curResidue._secondary = curStructure;\r\n if (curStructure) {\r\n curStructure.term = curResidue;\r\n }\r\n if (curStructure instanceof Helix) {\r\n curStructure.length++;\r\n }\r\n continue;\r\n }\r\n\r\n // create a new structure\r\n const helixClass = helixClassMap[curCode];\r\n const loopType = loopMap[curCode];\r\n if (curCode === StructureType.STRAND) {\r\n const curSheet = getSheet(curSheetIndex);\r\n curStructure = new Strand(curSheet, curResidue, curResidue, 0, null, null);\r\n curSheet.addStrand(curStructure);\r\n } else if (helixClass !== undefined) {\r\n lastHelixIndex++;\r\n curStructure = new Helix(helixClass, curResidue, curResidue, lastHelixIndex, String(lastHelixIndex), '', 1);\r\n helices.push(curStructure);\r\n } else if (loopType !== undefined) {\r\n curStructure = new StructuralElement(loopType, curResidue, curResidue);\r\n } else {\r\n curStructure = null;\r\n }\r\n\r\n if (curStructure) {\r\n structures.push(curStructure);\r\n }\r\n\r\n curResidue._secondary = curStructure;\r\n\r\n lastCode = curCode;\r\n lastSheetIndex = curSheetIndex;\r\n }\r\n\r\n this._sheets = sheets.filter((_sheet) => true); // squeeze sheets array\r\n }\r\n}\r\n\r\nComplex.prototype.id = 'Complex';\r\nComplex.prototype.name = '';\r\n\r\nexport default Complex;\r\n","import * as THREE from 'three';\r\nimport utils from '../utils';\r\n\r\nfunction pow2ceil(v) {\r\n let p = 2;\r\n v = (v - 1) >> 1;\r\n while (v) {\r\n p <<= 1;\r\n v >>= 1;\r\n }\r\n return p;\r\n}\r\n\r\n/**\r\n * Volume constructor\r\n *\r\n * @param {Object} type - Float32Array, Int8Array, etc...\r\n * @param {Object|Array} dimensions - number of data points on each axis (x, y, z)\r\n * @param {Box3} box - bounding box defining data place in metric space,\r\n * it's corners correspond to extreme data points\r\n * @param {Number} vecSize - dimension of the field data point (1 = scalar, 3 = 3D vector)\r\n * @param {Object} data - typed array of the same type as specified by the 1st parameter,\r\n * layout: point by point along X,\r\n * row by row along Y,\r\n * plane by plane along Z\r\n * @param {Number} volumeInfo - volume info values to define threshold to filter the noise\r\n */\r\n\r\nclass Volume {\r\n constructor(type, dimensions, box, vecSize, data, volumeInfo) {\r\n this._box = box.clone();\r\n this._dimVec = Math.max(Math.floor(vecSize || 1), 1);\r\n this._volumeInfo = volumeInfo;\r\n\r\n if (dimensions instanceof Array) {\r\n [this._dimX, this._dimY, this._dimZ] = dimensions;\r\n } else {\r\n this._dimX = dimensions.x;\r\n this._dimY = dimensions.y;\r\n this._dimZ = dimensions.z;\r\n }\r\n this._dimX = Math.max(Math.floor(this._dimX), 1);\r\n this._dimY = Math.max(Math.floor(this._dimY), 1);\r\n this._dimZ = Math.max(Math.floor(this._dimZ), 1);\r\n\r\n this._rowElements = this._dimVec * this._dimX;\r\n this._planeElements = this._rowElements * this._dimY;\r\n this._totalElements = this._planeElements * this._dimZ;\r\n\r\n this._data = data || utils.allocateTyped(type, this._totalElements);\r\n\r\n // override getter/setter for vector fields\r\n switch (this._dimVec) {\r\n case 1:\r\n break;\r\n\r\n case 2:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n };\r\n break;\r\n\r\n case 3:\r\n this.getValue = function (x, y, z) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n return [this._data[idx], this._data[idx + 1], this._data[idx + 2]];\r\n };\r\n\r\n this.setValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] = a;\r\n this._data[idx + 1] = b;\r\n this._data[idx + 2] = c;\r\n };\r\n\r\n this.addValue = function (x, y, z, a, b, c) {\r\n const idx = x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n this._data[idx] += a;\r\n this._data[idx + 1] += b;\r\n this._data[idx + 2] += c;\r\n };\r\n break;\r\n\r\n default:\r\n throw new Error('Volume: invalid vector dimension');\r\n }\r\n }\r\n\r\n // default getter assumes it's a scalar field\r\n getValue(x, y, z) {\r\n return this._data[x + y * this._rowElements + z * this._planeElements];\r\n }\r\n\r\n // default setter assumes it's a scalar field\r\n setValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] = val;\r\n }\r\n\r\n // default adder assumes it's a scalar field\r\n addValue(x, y, z, val) {\r\n this._data[x + y * this._rowElements + z * this._planeElements] += val;\r\n }\r\n\r\n getDimensions() {\r\n return [this._dimX, this._dimY, this._dimZ];\r\n }\r\n\r\n getBox() {\r\n return this._box;\r\n }\r\n\r\n getVolumeInfo() {\r\n return this._volumeInfo;\r\n }\r\n\r\n getCellSize() {\r\n const boxSize = new THREE.Vector3();\r\n this._box.getSize(boxSize);\r\n const res = new THREE.Vector3();\r\n res.x = this._dimX > 1 ? boxSize.x / (this._dimX - 1) : 0;\r\n res.y = this._dimY > 1 ? boxSize.y / (this._dimY - 1) : 0;\r\n res.z = this._dimZ > 1 ? boxSize.z / (this._dimZ - 1) : 0;\r\n return res;\r\n }\r\n\r\n computeGradient() {\r\n if (this._dimVec !== 1) {\r\n // gradient can only be computed for scalar fields\r\n return null;\r\n }\r\n\r\n // create a 3D vector field of gradients\r\n const gradient = new Volume(Float32Array, [this._dimX, this._dimY, this._dimZ], this._box, 3);\r\n\r\n // calculate cell side lengths\r\n const vl = this.getCellSize();\r\n\r\n // gradient axis scaling values and averaging factors, to correctly\r\n // calculate the gradient for volumes with irregular cell spacing\r\n const vs = new THREE.Vector3(-0.5 / vl.x, -0.5 / vl.y, -0.5 / vl.z);\r\n\r\n // TODO Check for intended bug in VMD (min is zero)\r\n function clamp(val, min, max) {\r\n return Math.min(max, Math.max(min, val));\r\n }\r\n\r\n const xSize = this._dimX;\r\n const ySize = this._dimY;\r\n const zSize = this._dimZ;\r\n const volMap = this._data;\r\n\r\n function _voxelValue(x, y, z) {\r\n return volMap[z * xSize * ySize + y * xSize + x];\r\n }\r\n\r\n for (let zi = 0; zi < zSize; ++zi) {\r\n const zm = clamp(zi - 1, 0, zSize - 1);\r\n const zp = clamp(zi + 1, 0, zSize - 1);\r\n\r\n for (let yi = 0; yi < ySize; ++yi) {\r\n const ym = clamp(yi - 1, 0, ySize - 1);\r\n const yp = clamp(yi + 1, 0, ySize - 1);\r\n\r\n for (let xi = 0; xi < xSize; ++xi) {\r\n const xm = clamp(xi - 1, 0, xSize - 1);\r\n const xp = clamp(xi + 1, 0, xSize - 1);\r\n\r\n // Calculate the volume gradient at each grid cell.\r\n // Gradients are now stored unnormalized, since we need them in pure\r\n // form in order to draw field lines etc. Shading code will now have\r\n // to do renormalization for itself on-the-fly.\r\n\r\n // XXX this gradient is only correct for orthogonal grids, since\r\n // we're using the array index offsets rather to calculate the gradient\r\n // rather than voxel coordinate offsets. This will have to be\r\n // re-worked for non-orthogonal datasets.\r\n\r\n gradient.setValue(\r\n xi,\r\n yi,\r\n zi,\r\n (_voxelValue(xp, yi, zi) - _voxelValue(xm, yi, zi)) * vs.x,\r\n (_voxelValue(xi, yp, zi) - _voxelValue(xi, ym, zi)) * vs.y,\r\n (_voxelValue(xi, yi, zp) - _voxelValue(xi, yi, zm)) * vs.z,\r\n );\r\n }\r\n }\r\n }\r\n\r\n return gradient;\r\n }\r\n\r\n normalize() {\r\n const data = this._data;\r\n\r\n // get min/max\r\n let min = data[0];\r\n let max = data[0];\r\n for (let i = 1; i < data.length; ++i) {\r\n min = Math.min(min, data[i]);\r\n max = Math.max(max, data[i]);\r\n }\r\n\r\n const d = 1.0 / (max - min);\r\n if (d === 0) {\r\n return;\r\n }\r\n\r\n // normalize\r\n for (let i = 0; i < data.length; ++i) {\r\n data[i] = d * (data[i] - min);\r\n }\r\n }\r\n\r\n getTiledTextureStride() {\r\n return [this._dimX + 2, this._dimY + 2];\r\n }\r\n\r\n buildTiledTexture() {\r\n let tilesX = Math.ceil(Math.sqrt(this._dimZ * this._dimY / this._dimX));\r\n\r\n let width = tilesX * (this._dimX + 2) - 1;\r\n width = pow2ceil(width);\r\n tilesX = Math.floor(width / (this._dimX + 2));\r\n\r\n const tilesY = Math.ceil(this._dimZ / tilesX);\r\n let height = tilesY * (this._dimY + 2) - 1;\r\n height = pow2ceil(height);\r\n\r\n const data = new Uint8Array(width * height);\r\n\r\n let src;\r\n let dst;\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // process each pixel row of this tile row\r\n for (let row = 0; row < this._dimY; ++row) {\r\n src = tileRow * tilesX * this._planeElements + row * this._rowElements;\r\n dst = width * (tileRow * (this._dimY + 2) + row);\r\n // copy a series of rows through several XY planes\r\n for (let t = 0; t < tilesX; ++t) {\r\n // copy one row of one XY plane\r\n for (let x = 0; x < this._dimX; ++x) {\r\n data[dst++] = 255.0 * this._data[src++];\r\n }\r\n\r\n // repeat last pixel of previous tile\r\n data[dst++] = 255.0 * this._data[src - 1];\r\n\r\n if (t < tilesX - 1) {\r\n // skip to the same row of next XY plane\r\n src += this._planeElements - this._rowElements;\r\n // repeat first pixel of next tile\r\n data[dst++] = 255.0 * this._data[src];\r\n }\r\n }\r\n }\r\n }\r\n\r\n // fill pixels between tile rows with copy of edge pixels\r\n for (let tileRow = 0; tileRow < tilesY; ++tileRow) {\r\n // copy last pixel row of this tile row to the following pixel row of the texture\r\n src = width * (tileRow * (this._dimY + 2) + this._dimY - 1);\r\n dst = src + width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n if (tileRow < tilesY - 1) {\r\n // copy first pixel row of next tile row to the preceding pixel row of the texture\r\n src = width * (tileRow + 1) * (this._dimY + 2);\r\n dst = src - width;\r\n for (let x = 0; x < width; ++x) {\r\n data[dst++] = data[src++];\r\n }\r\n }\r\n }\r\n\r\n const texture = new THREE.DataTexture(\r\n data,\r\n width,\r\n height,\r\n THREE.LuminanceFormat,\r\n THREE.UnsignedByteType,\r\n THREE.UVMapping,\r\n THREE.ClampToEdgeWrapping,\r\n THREE.ClampToEdgeWrapping,\r\n THREE.LinearFilter,\r\n THREE.LinearFilter,\r\n );\r\n texture.needsUpdate = true;\r\n return texture;\r\n }\r\n\r\n /* ********************************************************************************\r\n *\r\n * Methods that provide direct access to internal array (for better performance)\r\n *\r\n ******************************************************************************** */\r\n\r\n getData() {\r\n return this._data;\r\n }\r\n\r\n getDirectIdx(x, y, z) {\r\n return x * this._dimVec + y * this._rowElements + z * this._planeElements;\r\n }\r\n\r\n getStrideX() {\r\n return this._dimVec;\r\n }\r\n\r\n getStrideY() {\r\n return this._rowElements;\r\n }\r\n\r\n getStrideZ() {\r\n return this._planeElements;\r\n }\r\n}\r\n\r\nVolume.prototype.id = 'Volume';\r\n\r\nexport default Volume;\r\n","/**\r\n * Residue Molecule.\r\n *\r\n * @param {Complex} complex - Molecular complex this Molecule belongs to.\r\n * @param {String} name - Molecule's name.\r\n * @param {Integer} index - Molecule's index in file.\r\n *\r\n * @exports Molecule\r\n * @constructor\r\n */\r\nclass Molecule {\r\n constructor(complex, name, index) {\r\n this.complex = complex;\r\n this.name = name || '';\r\n this.residues = [];\r\n this.mask = 1 | 0;\r\n this.index = index || -1; // start with 1\r\n }\r\n\r\n forEachResidue(process) {\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n process(residues[i]);\r\n }\r\n }\r\n\r\n collectMask() {\r\n let mask = 0xffffffff;\r\n const { residues } = this;\r\n for (let i = 0, n = residues.length; i < n; ++i) {\r\n mask &= residues[i]._mask;\r\n }\r\n this.mask = mask;\r\n }\r\n}\r\n\r\nexport default Molecule;\r\n","import Atom from './chem/Atom';\r\nimport Element from './chem/Element';\r\nimport Bond from './chem/Bond';\r\nimport Residue from './chem/Residue';\r\nimport ResidueType from './chem/ResidueType';\r\nimport Chain from './chem/Chain';\r\nimport Helix from './chem/Helix';\r\nimport Strand from './chem/Strand';\r\nimport Sheet from './chem/Sheet';\r\nimport SGroup from './chem/SGroup';\r\nimport Assembly from './chem/Assembly';\r\nimport Complex from './chem/Complex';\r\nimport Volume from './chem/Volume';\r\nimport VoxelWorld from './chem/VoxelWorld';\r\nimport selectors from './chem/selectors';\r\nimport Molecule from './chem/Molecule';\r\n\r\nexport default {\r\n Atom,\r\n Element,\r\n Bond,\r\n Residue,\r\n ResidueType,\r\n Chain,\r\n Helix,\r\n Strand,\r\n Sheet,\r\n SGroup,\r\n Assembly,\r\n Complex,\r\n Volume,\r\n VoxelWorld,\r\n selectors,\r\n Molecule,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\n\r\nclass CSS2DObject extends THREE.Object3D {\r\n constructor(element) {\r\n super();\r\n const self = this;\r\n this._element = element;\r\n this._element.style.position = 'absolute';\r\n this.addEventListener('removed', () => {\r\n if (self._element.parentNode !== null) {\r\n self._element.parentNode.removeChild(self._element);\r\n }\r\n });\r\n }\r\n\r\n getElement() {\r\n return this._element;\r\n }\r\n\r\n /**\r\n * Sets label transparency.\r\n *\r\n * @param {number} transp - in [0; 1] 1 means fully transparent\r\n */\r\n setTransparency(transp) {\r\n const el = this.getElement();\r\n if (el === null) {\r\n return;\r\n }\r\n if (transp === 1.0) {\r\n el.style.display = 'none';\r\n return;\r\n }\r\n el.style.display = 'inline';\r\n const op = 1.0 - transp;\r\n const top = op.toString();\r\n const op100 = op * 100;\r\n el.style.opacity = top;\r\n el.style.filter = `alpha(opacity=${op100})`; // IE fallback\r\n }\r\n\r\n clone() {\r\n const obj = new CSS2DObject(this._element);\r\n obj.copy(this);\r\n return obj;\r\n }\r\n}\r\n\r\nexport default CSS2DObject;\r\n","import * as THREE from 'three';\r\n\r\nclass RCGroup extends THREE.Group {\r\n raycast(raycaster, intersects) {\r\n if (!this.visible) {\r\n return;\r\n }\r\n\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n children[i].raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].enableSubset) {\r\n children[i].enableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].disableSubset) {\r\n children[i].disableSubset(mask, innerOnly);\r\n }\r\n }\r\n }\r\n\r\n isEmpty() {\r\n return this.children.length === 0;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].updateToFrame) {\r\n children[i].updateToFrame(frameData);\r\n }\r\n }\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n Array.prototype.push.apply(totalSubset, children[i].getSubset(mask, innerOnly));\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default RCGroup;\r\n","/* eslint-disable no-magic-numbers */\r\nimport * as THREE from 'three';\r\nimport logger from '../utils/logger';\r\nimport CSS2DObject from './CSS2DObject';\r\nimport RCGroup from './RCGroup';\r\nimport vertexScreenQuadShader from './shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromTex from './shaders/ScreenQuadFromTex.frag';\r\nimport fragmentScreenQuadFromTexWithDistortion from './shaders/ScreenQuadFromTexWithDistortion.frag';\r\n\r\nconst LAYERS = {\r\n DEFAULT: 0, VOLUME: 1, TRANSPARENT: 2, PREPASS_TRANSPARENT: 3, VOLUME_BFPLANE: 4, COLOR_FROM_POSITION: 5, SHADOWMAP: 6,\r\n};\r\n\r\nconst SELECTION_LAYERS = [ // These layers, that are used in the selection by ray casting\r\n LAYERS.DEFAULT, LAYERS.TRANSPARENT,\r\n];\r\n\r\nTHREE.Object3D.prototype.resetTransform = function () {\r\n this.position.set(0, 0, 0);\r\n this.quaternion.set(0, 0, 0, 1);\r\n this.scale.set(1, 1, 1);\r\n};\r\n\r\n// update world matrix of this object and all its ancestors\r\nTHREE.Object3D.prototype.updateMatrixWorldRecursive = function () {\r\n if (this.parent != null) {\r\n this.parent.updateMatrixWorldRecursive();\r\n }\r\n this.updateMatrixWorld();\r\n};\r\n// add object to parent, saving objects' world transform\r\nTHREE.Object3D.prototype.addSavingWorldTransform = (function () {\r\n const _worldMatrixInverse = new THREE.Matrix4();\r\n\r\n return function (object) {\r\n if (object instanceof THREE.Object3D) {\r\n _worldMatrixInverse.copy(this.matrixWorld).invert();\r\n _worldMatrixInverse.multiply(object.matrixWorld);\r\n object.matrix.copy(_worldMatrixInverse);\r\n object.matrix.decompose(object.position, object.quaternion, object.scale);\r\n this.add(object);\r\n }\r\n };\r\n}());\r\n\r\n// render a tiny transparent quad in the center of the screen\r\nTHREE.WebGLRenderer.prototype.renderDummyQuad = (function () {\r\n const _material = new THREE.MeshBasicMaterial({ transparent: true, opacity: 0.0, depthWrite: false });\r\n\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneGeometry(0.01, 0.01), _material);\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n return function () {\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuad = (function () {\r\n const _scene = new THREE.Scene();\r\n const _quad = new THREE.Mesh(new THREE.PlaneGeometry(1.0, 1.0));\r\n _scene.add(_quad);\r\n\r\n const _camera = new THREE.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, -10000, 10000);\r\n _camera.position.z = 100;\r\n\r\n return function (material) {\r\n _quad.material = material;\r\n this.render(_scene, _camera);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.isIdentity = (function () {\r\n const identity = new THREE.Matrix4();\r\n return function () {\r\n return identity.equals(this);\r\n };\r\n}());\r\n\r\nTHREE.Matrix4.prototype.applyToPointsArray = function (array, stride, w) {\r\n if (!array || !stride || stride < 3) {\r\n return array;\r\n }\r\n w = w || 0; // use point as normal by default\r\n const e = this.elements;\r\n for (let i = 0; i < array.length; i += stride) {\r\n const x = array[i];\r\n const y = array[i + 1];\r\n const z = array[i + 2];\r\n\r\n const persp = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\r\n\r\n array[i] = (e[0] * x + e[4] * y + e[8] * z + e[12] * w) * persp;\r\n array[i + 1] = (e[1] * x + e[5] * y + e[9] * z + e[13] * w) * persp;\r\n array[i + 2] = (e[2] * x + e[6] * y + e[10] * z + e[14] * w) * persp;\r\n }\r\n return array;\r\n};\r\n\r\nclass ScreenQuadMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n if (params.uniforms === undefined) {\r\n params.uniforms = {};\r\n }\r\n params.uniforms.srcTex = { type: 't', value: null };\r\n params.vertexShader = vertexScreenQuadShader;\r\n params.transparent = false;\r\n params.depthTest = false;\r\n params.depthWrite = false;\r\n super(params);\r\n }\r\n}\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTex = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { opacity: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTex,\r\n transparent: true,\r\n });\r\n\r\n return function (srcTex, opacity) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.transparent = (opacity < 1.0);\r\n _material.uniforms.opacity.value = opacity;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\nTHREE.WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion = (function () {\r\n const _material = new ScreenQuadMaterial({\r\n uniforms: { coef: { type: 'f', value: 1.0 } },\r\n fragmentShader: fragmentScreenQuadFromTexWithDistortion,\r\n });\r\n\r\n return function (srcTex, coef) {\r\n _material.uniforms.srcTex.value = srcTex;\r\n _material.uniforms.coef.value = coef;\r\n this.renderScreenQuad(_material);\r\n };\r\n}());\r\n\r\n/**\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setMinimalFov = function (angle) {\r\n if (this.aspect >= 1.0) {\r\n this.fov = angle;\r\n } else {\r\n this.fov = THREE.MathUtils.radToDeg(2 * Math.atan(Math.tan(THREE.MathUtils.degToRad(angle) * 0.5) / this.aspect));\r\n }\r\n};\r\n\r\n/**\r\n * @param {THREE.PerspectiveCamera} camera - Base camera for this stereo camera.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.StereoCamera.prototype.updateHalfSized = function (camera, angle) {\r\n const originalAspect = camera.aspect;\r\n const originalFov = camera.fov;\r\n\r\n camera.aspect = originalAspect / 2.0;\r\n camera.setMinimalFov(angle);\r\n camera.updateProjectionMatrix();\r\n\r\n this.update(camera);\r\n\r\n camera.aspect = originalAspect;\r\n camera.fov = originalFov;\r\n camera.updateProjectionMatrix();\r\n};\r\n\r\n/**\r\n * @param {number} radius - Radius of bounding sphere in angstroms to fit on screen.\r\n * @param {number} angle - Field of view in degrees.\r\n */\r\nTHREE.PerspectiveCamera.prototype.setDistanceToFit = function (radius, angle) {\r\n this.position.z = radius / Math.sin(0.5 * THREE.MathUtils.degToRad(angle));\r\n};\r\n\r\n/**\r\n * @param {RCGroup} gfxObj - All objects on scene.\r\n * @param {THREE.PerspectiveCamera} camera - Camera used for rendering.\r\n * @param {number} clipPlane - Distance to clip plane.\r\n * @param {number} fogFarPlane - Distance to fog far plane.\r\n */\r\nTHREE.Raycaster.prototype.intersectVisibleObject = function (gfxObj, camera, clipPlane, fogFarPlane) {\r\n const intersects = this.intersectObject(gfxObj, false);\r\n if (intersects.length === 0) {\r\n return null;\r\n }\r\n\r\n // find point closest to camera that doesn't get clipped by camera near plane or clipPlane (if it exists)\r\n const nearPlane = Math.min(camera.near, clipPlane);\r\n let i;\r\n let p = intersects[0];\r\n const v = new THREE.Vector3();\r\n for (i = 0; i < intersects.length; ++i) {\r\n p = intersects[i];\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -nearPlane) {\r\n break;\r\n }\r\n }\r\n if (i === intersects.length) {\r\n return null;\r\n }\r\n\r\n // check that selected intersection point is not clipped by camera far plane or occluded by fog (if it exists)\r\n const farPlane = Math.min(camera.far, fogFarPlane);\r\n v.copy(p.point);\r\n v.applyMatrix4(camera.matrixWorldInverse);\r\n if (v.z <= -farPlane) {\r\n return null;\r\n }\r\n return p;\r\n};\r\n\r\nTHREE.Matrix4.prototype.extractScale = (function () {\r\n const _v = new THREE.Vector3();\r\n\r\n return function (scale) {\r\n if (scale === undefined) {\r\n logger.debug('extractScale(): new is too expensive operation to do it on-the-fly');\r\n scale = _v.clone();\r\n }\r\n\r\n const te = this.elements;\r\n scale.x = _v.set(te[0], te[1], te[2]).length();\r\n scale.y = _v.set(te[4], te[5], te[6]).length();\r\n scale.z = _v.set(te[8], te[9], te[10]).length();\r\n\r\n // if determine is negative, we need to invert one scale\r\n const det = this.determinant();\r\n if (det < 0) {\r\n scale.x = -scale.x;\r\n }\r\n return scale;\r\n };\r\n}());\r\n\r\nfunction _calcCylinderMatrix(posBegin, posEnd, radius) {\r\n const posCenter = posBegin.clone().lerp(posEnd, 0.5);\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(radius, posBegin.distanceTo(posEnd), radius);\r\n\r\n const matRotHalf = new THREE.Matrix4();\r\n matRotHalf.makeRotationX(Math.PI / 2);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n const vUp = new THREE.Vector3(0, 1, 0);\r\n matRotLook.lookAt(posCenter, posEnd, vUp);\r\n\r\n matRotLook.multiply(matRotHalf);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(posCenter);\r\n return matRotLook;\r\n}\r\n\r\nfunction _calcChunkMatrix(eye, target, up, rad) {\r\n const matScale = new THREE.Matrix4();\r\n matScale.makeScale(rad.x, rad.y, 0);\r\n\r\n const matRotLook = new THREE.Matrix4();\r\n matRotLook.lookAt(eye, target, up);\r\n matRotLook.multiply(matScale);\r\n matRotLook.setPosition(eye);\r\n\r\n return matRotLook;\r\n}\r\n\r\nfunction _groupHasGeometryToRender(group) {\r\n let hasGeoms = false;\r\n group.traverse((node) => {\r\n if (node.hasOwnProperty('geometry') || node instanceof CSS2DObject) {\r\n hasGeoms = true;\r\n }\r\n });\r\n return hasGeoms;\r\n}\r\n\r\nfunction _buildDistorionMesh(widthSegments, heightSegements, coef) {\r\n // solve equation r_u = r_d * (1 + k * r_d^2)\r\n // for r_d using iterations\r\n // takes: r_u^2\r\n // returns: r_d / r_u factor that can be used to distort point coords\r\n function calcInverseBarrel(r2) {\r\n const epsilon = 1e-5;\r\n let prevR2 = 0.0;\r\n let curR2 = r2;\r\n let dr = 1.0;\r\n while (Math.abs(curR2 - prevR2) > epsilon) {\r\n dr = 1.0 + coef * curR2;\r\n prevR2 = curR2;\r\n curR2 = r2 / (dr * dr);\r\n }\r\n\r\n return 1.0 / dr;\r\n }\r\n\r\n const geo = new THREE.PlaneGeometry(2.0, 2.0, widthSegments, heightSegements);\r\n\r\n const pos = geo.getAttribute('position');\r\n for (let i = 0; i < pos.count; ++i) {\r\n const x = pos.array[3 * i];\r\n const y = pos.array[3 * i + 1];\r\n const c = calcInverseBarrel(x * x + y * y);\r\n pos.setXY(i, c * x, c * y);\r\n }\r\n\r\n return geo;\r\n}\r\n\r\nTHREE.BufferAttribute.prototype.copyAtList = function (attribute, indexList) {\r\n console.assert(\r\n this.itemSize === attribute.itemSize,\r\n 'DEBUG: BufferAttribute.copyAtList buffers have different item size.',\r\n );\r\n const { itemSize } = this;\r\n for (let i = 0, n = indexList.length; i < n; ++i) {\r\n for (let j = 0; j < itemSize; ++j) {\r\n this.array[i * itemSize + j] = attribute.array[indexList[i] * itemSize + j];\r\n }\r\n }\r\n return this;\r\n};\r\n\r\nfunction fillArray(array, value, startIndex, endIndex) {\r\n startIndex = (typeof startIndex !== 'undefined') ? startIndex : 0;\r\n endIndex = (typeof endIndex !== 'undefined') ? endIndex : array.length;\r\n for (let i = startIndex; i < endIndex; ++i) {\r\n array[i] = value;\r\n }\r\n}\r\n\r\n/** @param {THREE.Object3D} object - Parent object. */\r\nfunction removeChildren(object) {\r\n const { children } = object;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n child.parent = null;\r\n child.dispatchEvent({ type: 'removed' });\r\n }\r\n object.children = [];\r\n}\r\n\r\nfunction clearTree(object) {\r\n object.traverse((obj) => {\r\n if (obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line) {\r\n obj.geometry.dispose();\r\n }\r\n });\r\n removeChildren(object);\r\n}\r\n\r\nfunction destroyObject(object) {\r\n clearTree(object);\r\n if (object.parent) {\r\n object.parent.remove(object);\r\n } else {\r\n object.dispatchEvent({ type: 'removed' });\r\n }\r\n}\r\n\r\nfunction belongToSelectLayers(object) {\r\n for (let i = 0; i < SELECTION_LAYERS.length; i++) {\r\n if (((object.layers.mask >> SELECTION_LAYERS[i]) & 1) === 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction processObjRenderOrder(root, idMaterial) {\r\n // set renderOrder to 0 for Backdrop and to 1 in other cases to render Backdrop earlier all other materials\r\n const renderOrder = +(idMaterial !== 'BA');\r\n root.traverse((object) => {\r\n if (object.isGroup) {\r\n object.renderOrder = renderOrder;\r\n }\r\n });\r\n}\r\n\r\nfunction applySelectionMaterial(geo) {\r\n geo.traverse((node) => {\r\n if ('material' in node) {\r\n node.material = node.material.clone(true);\r\n // using z-offset to magically fix selection rendering artifact (on z-sprites)\r\n node.material.setValues({\r\n depthFunc: THREE.LessEqualDepth,\r\n overrideColor: true,\r\n fog: false,\r\n lights: false,\r\n shadowmap: false,\r\n });\r\n node.material.setUberOptions({ fixedColor: new THREE.Color(0xFFFF00), zOffset: -1e-6 });\r\n }\r\n });\r\n}\r\n\r\nfunction getMiddlePoint(point1, point2, optionalTarget) {\r\n const result = optionalTarget || new THREE.Vector3();\r\n\r\n result.set(0, 0, 0);\r\n result.addScaledVector(point1, 0.5);\r\n result.addScaledVector(point2, 0.5);\r\n\r\n return result;\r\n}\r\n\r\n// Monkey-patch for \"InstancedBufferGeometry.instanceCount becomes undefined after copy()\"\r\n// https://github.com/mrdoob/three.js/issues/22151\r\nconst _oldInstancedBufferGeometryCopy = THREE.InstancedBufferGeometry.prototype.copy;\r\n\r\nTHREE.InstancedBufferGeometry.prototype.copy = function (source) {\r\n _oldInstancedBufferGeometryCopy.call(this, source);\r\n if (this.instanceCount === undefined) {\r\n this.instanceCount = Infinity;\r\n }\r\n};\r\n\r\nexport default {\r\n calcCylinderMatrix: _calcCylinderMatrix,\r\n calcChunkMatrix: _calcChunkMatrix,\r\n groupHasGeometryToRender: _groupHasGeometryToRender,\r\n buildDistorionMesh: _buildDistorionMesh,\r\n RCGroup,\r\n fillArray,\r\n clearTree,\r\n destroyObject,\r\n belongToSelectLayers,\r\n processObjRenderOrder,\r\n applySelectionMaterial,\r\n getMiddlePoint,\r\n LAYERS,\r\n};\r\n","import * as THREE from 'three';\r\nimport gfxutils from './gfx/gfxutils';\r\n\r\nconst _defaultBoundaries = {\r\n boundingBox: new THREE.Box3(new THREE.Vector3(-1, -1, -1), new THREE.Vector3(1, 1, 1)),\r\n boundingSphere: new THREE.Sphere(new THREE.Vector3(0, 0, 0), 1),\r\n};\r\n\r\nclass Visual extends gfxutils.RCGroup {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this.name = name;\r\n this._dataSource = dataSource;\r\n }\r\n\r\n release() {\r\n if (this.parent) {\r\n this.parent.remove(this);\r\n }\r\n }\r\n\r\n getDataSource() {\r\n return this._dataSource;\r\n }\r\n\r\n getBoundaries() {\r\n return _defaultBoundaries;\r\n }\r\n}\r\n\r\nexport default Visual;\r\n","function _ensureArray(x) {\r\n if (x === null || x === undefined || Array.isArray(x)) {\r\n return x;\r\n }\r\n return [x];\r\n}\r\n\r\n/** An indexed list of objects or classes. */\r\nclass EntityList {\r\n /**\r\n * Create a list of objects.\r\n * The objects can be indexed by one or more properties for the later retrieval.\r\n *\r\n * @param {!Array=} entities A list of objects to automatically register at creation time.\r\n * @param {!Array=} indices A list of property names to use for case-insensitive indexing.\r\n * By default, a single `.id` property is used.\r\n * @see EntityList#register\r\n */\r\n constructor(entities = [], indices = ['id']) {\r\n this._list = [];\r\n this._dict = {};\r\n this._indices = [...indices];\r\n this._indices.forEach((index) => {\r\n this._dict[index] = {};\r\n });\r\n\r\n entities.forEach((entity) => this.register(entity));\r\n }\r\n\r\n /**\r\n * Add a value to the end of a list.\r\n * The list will contain only one copy of the value.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromList\r\n * @see EntityList.registerInDict\r\n */\r\n static registerInList(list, value) {\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a value from a list if it is there.\r\n *\r\n * @param {!Array} list An array.\r\n * @param {*} value A value to remove.\r\n * @see EntityList.registerInList\r\n */\r\n static unregisterFromList(list, value) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Add a value to a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.unregisterFromDict\r\n * @see EntityList.registerInList\r\n */\r\n static registerInDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key] = dict[key] || [];\r\n if (!list.includes(value)) {\r\n list.push(value);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Remove a value from a dictionary.\r\n * The value may be stored under multiple different keys (aliases).\r\n * There might be multiples values stored under the same key.\r\n *\r\n * @param {!Object} dict A dictionary.\r\n * @param {!Array} keys An array of keys.\r\n * @param {*} value A value to add.\r\n * @see EntityList.registerInDict\r\n */\r\n static unregisterFromDict(dict, keys, value) {\r\n keys.forEach((key) => {\r\n key = key.toLowerCase();\r\n const list = dict[key];\r\n if (list) {\r\n const pos = list.indexOf(value);\r\n if (pos !== -1) {\r\n list.splice(pos, 1);\r\n }\r\n if (list.length === 0) {\r\n delete dict[key];\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Add an entity to this list.\r\n *\r\n * @param {!Object} entity An object or a class to register. The object must include all\r\n * properties specified as indices on construction.\r\n * @see EntityList#unregister\r\n */\r\n register(entity) {\r\n EntityList.registerInList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.registerInDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * Remove an entity from this list.\r\n *\r\n * @param {!Object} entity An object or a class to unregister. The object may be\r\n * missing from the list but it must include all properties specified as indices\r\n * on construction.\r\n * @see EntityList#register\r\n */\r\n unregister(entity) {\r\n EntityList.unregisterFromList(this._list, entity);\r\n this._indices.forEach((index) => {\r\n EntityList.unregisterFromDict(this._dict[index], _ensureArray(entity[index]), entity);\r\n });\r\n }\r\n\r\n /**\r\n * An ordered list of all registered entities.\r\n * It is a read-only copy, use {@link EntityList#register} and {@link EntityList#unregister}\r\n * to modify it.\r\n *\r\n * @type {!Array}\r\n */\r\n get all() {\r\n return [...this._list];\r\n }\r\n\r\n /**\r\n * The first registered entity.\r\n * Use it if you do not care which entity you are referring to.\r\n *\r\n * @type {Object=}\r\n */\r\n get first() {\r\n return this._list[0];\r\n }\r\n\r\n /**\r\n * Retrieve a list of keys for the index.\r\n *\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {!Array} An unordered list of keys in the index, i.e. particular property\r\n * values for all registered entities.\r\n */\r\n keys(index) {\r\n return Object.keys(this._dict[index || this._indices[0]]);\r\n }\r\n\r\n /**\r\n * Retrieve an entity by its key.\r\n *\r\n * @param {string} key A case-insensitive property value to look-up.\r\n * @param {string=} index One of the indices specified during the list construction. If omitted,\r\n * the first of the indices is used.\r\n * @returns {Object=} An object registered in the index under the key. If there are multiple\r\n * objects under the same key, the first one is returned.\r\n */\r\n get(key, index) {\r\n const dict = this._dict[index || this._indices[0]];\r\n if (dict) {\r\n const values = dict[key && key.toLowerCase()];\r\n return values && values.length > 0 ? values[0] : undefined;\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nexport default EntityList;\r\n","import settings from '../settings';\r\nimport logger from './logger';\r\n\r\nfunction makeContextDependent(prototype) {\r\n Object.defineProperties(prototype, {\r\n logger: {\r\n get() {\r\n return this.context && this.context.logger ? this.context.logger : logger;\r\n },\r\n },\r\n settings: {\r\n get() {\r\n return this.context && this.context.settings ? this.context.settings : settings;\r\n },\r\n },\r\n });\r\n}\r\n\r\nexport default makeContextDependent;\r\n","import * as THREE from 'three';\r\n\r\nclass CollisionSphere {\r\n constructor(position, radius) {\r\n this._position = position;\r\n this._radius = radius;\r\n }\r\n\r\n static _sphere = new THREE.Sphere();\r\n\r\n raycast(raycaster) {\r\n const sphere = CollisionSphere._sphere;\r\n sphere.set(this._position, this._radius);\r\n\r\n const p = new THREE.Vector3();\r\n if (raycaster.ray.intersectSphere(sphere, p)) {\r\n return {\r\n distance: raycaster.ray.origin.distanceTo(p),\r\n point: p,\r\n };\r\n }\r\n return null;\r\n }\r\n}\r\n\r\nconst SphereCollisionGeo = (base) => class extends base {\r\n constructor(count, ...args) {\r\n super(...args);\r\n this._objects = new Array(count);\r\n this.boundingSphere = null;\r\n this.boundingBox = null;\r\n }\r\n\r\n setSphere(idx, position, radius) {\r\n this._objects[idx] = new CollisionSphere(position, radius);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n // TODO raycast with bounding sphere? How to deal with updates?\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const inters = this._objects[i].raycast(raycaster);\r\n if (inters) {\r\n inters.chunkIdx = i;\r\n intersects.push(inters);\r\n }\r\n }\r\n }\r\n\r\n computeBoundingBox() {\r\n const objects = this._objects;\r\n let { boundingBox } = this;\r\n if (boundingBox === null) {\r\n this.boundingBox = boundingBox = new THREE.Box3();\r\n }\r\n boundingBox.makeEmpty();\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n boundingBox.expandByPoint(objects[i]._position);\r\n }\r\n }\r\n\r\n computeBoundingSphere() {\r\n this.computeBoundingBox();\r\n const objects = this._objects;\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n boundingBox.getCenter(center);\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n const pos = objects[i]._position;\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n if (this.boundingSphere === null) {\r\n this.boundingSphere = new THREE.Sphere();\r\n }\r\n this.boundingSphere.set(center, Math.sqrt(radiusSquared));\r\n }\r\n};\r\nexport default SphereCollisionGeo;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst tmpColor = new THREE.Color();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\nclass InstancedSpheresGeometry extends SphereCollisionGeo(THREE.InstancedBufferGeometry) {\r\n constructor(spheresCount, sphereComplexity, useZSprites) {\r\n super(spheresCount);\r\n this._sphGeometry = useZSprites ? new THREE.PlaneGeometry(2, 2, 1, 1)\r\n : new THREE.SphereBufferGeometry(1, sphereComplexity * 2, sphereComplexity, 0, Math.PI * 2, 0, Math.PI);\r\n this._init(spheresCount, this._sphGeometry);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n setArrayXYZW(this._offsets, itemIdx * OFFSET_SIZE, itemPos.x, itemPos.y, itemPos.z, itemRad);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n\r\n setColor(itemIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n setArrayXYZ(this._colors, itemIdx * COLOR_SIZE, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('offset').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[chunkIndices[i]] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._sphGeometry);\r\n\r\n copySubArrays(this._offsets, geom._offsets, chunkIndices, OFFSET_SIZE);\r\n copySubArrays(this._colors, geom._colors, chunkIndices, COLOR_SIZE);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(spheresCount, sphereGeo) {\r\n this.copy(sphereGeo);\r\n\r\n this._offsets = utils.allocateTyped(Float32Array, spheresCount * OFFSET_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, spheresCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('offset', new THREE.InstancedBufferAttribute(this._offsets, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._colors, COLOR_SIZE, false, 1));\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(alpha, 1, false, 1));\r\n }\r\n}\r\nexport default InstancedSpheresGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VEC_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n */\r\n\r\nclass ChunkedObjectsGeometry extends THREE.BufferGeometry {\r\n constructor(chunkGeo, chunksCount) {\r\n super();\r\n\r\n if (this.constructor === ChunkedObjectsGeometry) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n\r\n this._chunkGeo = chunkGeo;\r\n\r\n this._init(chunkGeo, chunksCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('normal').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n const idx = i * VEC_SIZE;\r\n colors[idx] = tmpColor.r;\r\n colors[idx + 1] = tmpColor.g;\r\n colors[idx + 2] = tmpColor.b;\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n _.fill(alphaArr, value, left, left + chunkSize);\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n // use THREE.Mesh raycasting interface for the Geometry. The Mesh is\r\n // created with existed geometry and default material, so it doesn't slowdown.\r\n const mesh = new THREE.Mesh();\r\n mesh.geometry = this;\r\n mesh.raycast(raycaster, inters);\r\n\r\n const facesPerChunk = this._chunkGeo.index.count / 3;\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('faceIndex')) {\r\n continue;\r\n }\r\n inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk);\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const geom = new THREE.BufferGeometry();\r\n this._init.call(geom, this._chunkGeo, instanceCount);\r\n\r\n const srcPos = this._positions;\r\n const srcNorm = this._normals;\r\n const srcColor = this._colors;\r\n\r\n const dstPos = geom._positions;\r\n const dstNorm = geom._normals;\r\n const dstColor = geom._colors;\r\n\r\n const chunkSize = this._chunkSize * VEC_SIZE;\r\n\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const ptIdxBegin = chunkIndices[i] * chunkSize;\r\n const ptIdxEnd = ptIdxBegin + chunkSize;\r\n dstPos.set(srcPos.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstNorm.set(srcNorm.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n dstColor.set(srcColor.subarray(ptIdxBegin, ptIdxEnd), dstPtOffset);\r\n }\r\n\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n _init(chunkGeo, chunksCount) {\r\n const chunkSize = this._chunkSize = chunkGeo.attributes.position.count;\r\n const chunkIndex = chunkGeo.index.array;\r\n const chunkIndexSize = chunkIndex.length;\r\n const pointsCount = this._chunkSize * chunksCount;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n const indexSize = chunkIndexSize * chunksCount;\r\n const index = this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, indexSize);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._normals = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * VEC_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n for (let i = 0; i < chunksCount; ++i) {\r\n const offset = i * chunkIndexSize;\r\n const posOffset = i * chunkSize;\r\n index.set(chunkIndex, offset);\r\n for (let j = 0; j < chunkIndexSize; ++j) {\r\n index[offset + j] += posOffset;\r\n }\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, VEC_SIZE));\r\n this.setAttribute('normal', new THREE.BufferAttribute(this._normals, VEC_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, VEC_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n }\r\n}\r\nexport default ChunkedObjectsGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst VEC_SIZE = 3;\r\n\r\nclass SimpleSpheresGeometry extends SphereCollisionGeo(ChunkedObjectsGeometry) {\r\n constructor(spheresCount, sphereComplexity) {\r\n const sphGeometry = new THREE.SphereBufferGeometry(\r\n 1,\r\n sphereComplexity * 2,\r\n sphereComplexity,\r\n 0,\r\n Math.PI * 2,\r\n 0,\r\n Math.PI,\r\n );\r\n super(spheresCount, sphGeometry, spheresCount);\r\n\r\n const normals = this._normals;\r\n const geoNormals = sphGeometry.attributes.normal.array;\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._tmpPositions = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n for (let i = 0; i < spheresCount; ++i) {\r\n normals.set(geoNormals, chunkSize * VEC_SIZE * i);\r\n }\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n const tmpPos = this._tmpPositions;\r\n const chunkSize = this._chunkSize;\r\n const geoPos = this._chunkPos;\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n const idx = i * 3;\r\n tmpPos[idx] = itemPos.x + geoPos[idx] * itemRad;\r\n tmpPos[idx + 1] = itemPos.y + geoPos[idx + 1] * itemRad;\r\n tmpPos[idx + 2] = itemPos.z + geoPos[idx + 2] * itemRad;\r\n }\r\n\r\n this._positions.set(tmpPos, chunkSize * itemIdx * VEC_SIZE);\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n }\r\n}\r\nexport default SimpleSpheresGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst centerPos = new THREE.Vector3();\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\nclass Simple2CCylindersGeometry extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, 2 * instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const firstOffset = chunkSize * 2 * itemIdx * VEC_SIZE;\r\n const secondOffset = firstOffset + chunkSize * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n centerPos.lerpVectors(botPos, topPos, 0.5);\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, centerPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, firstOffset);\r\n\r\n // now shift center to get another part of the cylinder\r\n centerPos.sub(botPos);\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpArray[idx] += centerPos.x;\r\n tmpArray[idx + 1] += centerPos.y;\r\n tmpArray[idx + 2] += centerPos.z;\r\n }\r\n this._positions.set(tmpArray, secondOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, firstOffset);\r\n this._normals.set(tmpArray, secondOffset);\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const first = 2 * itemIdx;\r\n super.setColor(first, colorVal1);\r\n\r\n const second = first + 1;\r\n super.setColor(second, colorVal2);\r\n }\r\n}\r\n\r\nexport default Simple2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_POINTS_COUNT_16BIT = 65536;\r\nconst PTS_PER_TRIANGLE = 3;\r\n\r\nclass CylinderBufferGeometry extends THREE.BufferGeometry {\r\n constructor(\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n ) {\r\n super();\r\n\r\n const thetaStart = 0;\r\n const thetaLength = 2 * Math.PI;\r\n\r\n this.type = 'CylinderBufferGeometry';\r\n\r\n this.parameters = {\r\n radiusTop,\r\n radiusBottom,\r\n height,\r\n radialSegments,\r\n heightSegments,\r\n openEnded,\r\n };\r\n\r\n const hasTop = openEnded === false && radiusTop > 0;\r\n const hasBottom = openEnded === false && radiusBottom > 0;\r\n const vertexCount = (heightSegments + 1) * radialSegments\r\n + hasTop * (radialSegments + 1)\r\n + hasBottom * (radialSegments + 1);\r\n const facesCount = (2 * heightSegments + hasTop + hasBottom) * radialSegments;\r\n\r\n const heightHalf = height / 2;\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const positions = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const normals = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 3), 3);\r\n const indices = new THREE.Uint16BufferAttribute(utils.allocateTyped(Uint16Array, facesCount * PTS_PER_TRIANGLE), 1);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const uvs = new THREE.BufferAttribute(utils.allocateTyped(Float32Array, vertexCount * 2), 2);\r\n console.assert(vertexCount < MAX_POINTS_COUNT_16BIT, 'DEBUG: Cylinder Geometry has too many vertices (65536 max).');\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n const tanTheta = -(radiusBottom - radiusTop) / height;\r\n\r\n // setup cylinder data\r\n for (let y = 0; y <= heightSegments; y++) {\r\n // faces\r\n if (y !== heightSegments) {\r\n for (let i = 0; i < radialSegments; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + radialSegments + i;\r\n const v3 = currVtxIdx + radialSegments + ((i + 1) % radialSegments);\r\n const v4 = currVtxIdx + ((i + 1) % radialSegments);\r\n\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n // vertices\r\n const v = y / heightSegments;\r\n const radius = v * (radiusBottom - radiusTop) + radiusTop;\r\n\r\n for (let x = 0; x < radialSegments; x++) {\r\n const u = x / radialSegments;\r\n\r\n const vx = radius * Math.sin(u * thetaLength + thetaStart);\r\n const vy = v * height - heightHalf;\r\n const vz = radius * Math.cos(u * thetaLength + thetaStart);\r\n\r\n const normal = new THREE.Vector3(\r\n vx,\r\n Math.sqrt(vx * vx + vz * vz) * tanTheta,\r\n vz,\r\n ).normalize();\r\n\r\n positions.setXYZ(currVtxIdx, vx, vy, vz);\r\n normals.setXYZ(currVtxIdx, normal.x, normal.y, normal.z);\r\n uvs.setXY(currVtxIdx, u, v);\r\n ++currVtxIdx;\r\n }\r\n }\r\n\r\n // top cap\r\n if (hasTop) {\r\n const startTIdx = currVtxIdx;\r\n const lastIdx = currVtxIdx + radialSegments;\r\n for (let fTIdx = 0; fTIdx < radialSegments; ++fTIdx) {\r\n const currSrcIdx = currVtxIdx - radialSegments;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcIdx),\r\n positions.getY(currSrcIdx),\r\n positions.getZ(currSrcIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n\r\n const nextTVtx = startTIdx + ((fTIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, currVtxIdx, nextTVtx, lastIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, 1, 0);\r\n uvs.setXY(currVtxIdx, 1, 1);\r\n ++currVtxIdx;\r\n }\r\n\r\n // bottom cap\r\n if (hasBottom) {\r\n const startBIdx = currVtxIdx;\r\n const lastBIdx = currVtxIdx + radialSegments;\r\n for (let fBIdx = 0; fBIdx < radialSegments; ++fBIdx) {\r\n const currSrcBIdx = fBIdx;\r\n positions.setXYZ(\r\n currVtxIdx,\r\n positions.getX(currSrcBIdx),\r\n positions.getY(currSrcBIdx),\r\n positions.getZ(currSrcBIdx),\r\n );\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n\r\n const nextBVtx = startBIdx + ((fBIdx + 1) % radialSegments);\r\n indices.setXYZ(currFaceIdx * PTS_PER_TRIANGLE, nextBVtx, currVtxIdx, lastBIdx);\r\n currFaceIdx++;\r\n currVtxIdx++;\r\n }\r\n\r\n positions.setXYZ(currVtxIdx, 0, -heightHalf, 0);\r\n normals.setXYZ(currVtxIdx, 0, -1, 0);\r\n uvs.setXY(currVtxIdx, 0, 0);\r\n }\r\n\r\n this.setIndex(indices);\r\n this.setAttribute('position', positions);\r\n this.setAttribute('normal', normals);\r\n this.setAttribute('uv', uvs);\r\n }\r\n\r\n clone() {\r\n const { parameters } = this;\r\n\r\n return new CylinderBufferGeometry(\r\n parameters.radiusTop,\r\n parameters.radiusBottom,\r\n parameters.height,\r\n parameters.radialSegments,\r\n parameters.heightSegments,\r\n parameters.openEnded,\r\n );\r\n }\r\n}\r\n\r\nexport default CylinderBufferGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport CylinderBufferGeometry from './CylinderBufferGeometry';\r\n\r\nconst tmpColor = new THREE.Color();\r\nconst invMatrix = new THREE.Matrix4();\r\n\r\nconst OFFSET_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst { copySubArrays } = utils;\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction sortNumber(a, b) {\r\n return a - b;\r\n}\r\n\r\nfunction _prepareCylinderInfo(chunkIndices) {\r\n chunkIndices.sort(sortNumber);\r\n const chunksIdx = [];\r\n const cylinderInfo = [];\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const val = chunkIndices[i];\r\n const even = (val | 0) % 2 === 0;\r\n const newPar = {\r\n first: false,\r\n second: false,\r\n };\r\n if (even) {\r\n newPar.first = true;\r\n newPar.second = i + 1 < n && chunkIndices[i + 1] === chunkIndices[i] + 1;\r\n if (newPar.second) {\r\n ++i;\r\n }\r\n } else {\r\n newPar.second = true;\r\n }\r\n chunksIdx.push(Math.floor(val / 2));\r\n cylinderInfo.push(newPar);\r\n }\r\n return { indices: chunksIdx, cylinderInfo };\r\n}\r\n\r\nfunction _assignOpacity(cylinderInfo, color1, color2) {\r\n for (let i = 0, n = cylinderInfo.length; i < n; ++i) {\r\n const info = cylinderInfo[i];\r\n if (!info.first) {\r\n color1[COLOR_SIZE * i] = -0.5;\r\n }\r\n if (!info.second) {\r\n color2[COLOR_SIZE * i] = -0.5;\r\n }\r\n }\r\n}\r\nclass Instanced2CCylindersGeometry extends THREE.InstancedBufferGeometry {\r\n constructor(instanceCount, polyComplexity, useZSprites, openEnded) {\r\n super();\r\n this._useZSprites = useZSprites;\r\n this._cylGeometry = useZSprites ? new THREE.PlaneGeometry(2, 2, 1, 1)\r\n : new CylinderBufferGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, openEnded);\r\n this._init(instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n this._collisionGeo = new Simple2CCylindersGeometry(instanceCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const matrix = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n let me = matrix.elements;\r\n const mtxOffset = itemIdx * OFFSET_SIZE;\r\n\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, itemRad);\r\n setArrayXYZW(this._matVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._matVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._matVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n\r\n if (this._useZSprites) {\r\n invMatrix.copy(matrix).invert();\r\n me = invMatrix.elements;\r\n setArrayXYZW(this._invmatVector1, mtxOffset, me[0], me[4], me[8], me[12]);\r\n setArrayXYZW(this._invmatVector2, mtxOffset, me[1], me[5], me[9], me[13]);\r\n setArrayXYZW(this._invmatVector3, mtxOffset, me[2], me[6], me[10], me[14]);\r\n }\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const colorIdx = itemIdx * COLOR_SIZE;\r\n tmpColor.set(colorVal1);\r\n setArrayXYZ(this._color1, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n tmpColor.set(colorVal2);\r\n setArrayXYZ(this._color2, colorIdx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n computeBoundingSphere() {\r\n this._collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = this._collisionGeo.boundingSphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n this._collisionGeo.computeBoundingBox();\r\n this.boundingBox = this._collisionGeo.boundingBox;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('matVector1').needsUpdate = true;\r\n this.getAttribute('matVector2').needsUpdate = true;\r\n this.getAttribute('matVector3').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('color2').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n if (this._useZSprites) {\r\n this.getAttribute('invmatVector1').needsUpdate = true;\r\n this.getAttribute('invmatVector2').needsUpdate = true;\r\n this.getAttribute('invmatVector3').needsUpdate = true;\r\n }\r\n\r\n this._collisionGeo.finishUpdate();\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const alphaArr = this._alpha;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n alphaArr[Math.floor(chunkIndices[i] / 2)] = value;\r\n }\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const info = _prepareCylinderInfo(chunkIndices);\r\n const cylinderIndices = info.indices;\r\n const instanceCount = cylinderIndices.length;\r\n const geom = new THREE.InstancedBufferGeometry();\r\n this._init.call(geom, instanceCount, this._cylGeometry, this._useZSprites);\r\n\r\n copySubArrays(this._matVector1, geom._matVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector2, geom._matVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._matVector3, geom._matVector3, cylinderIndices, OFFSET_SIZE);\r\n\r\n if (this._useZSprites) {\r\n copySubArrays(this._invmatVector1, geom._invmatVector1, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector2, geom._invmatVector2, cylinderIndices, OFFSET_SIZE);\r\n copySubArrays(this._invmatVector3, geom._invmatVector3, cylinderIndices, OFFSET_SIZE);\r\n }\r\n\r\n copySubArrays(this._color1, geom._color1, cylinderIndices, COLOR_SIZE);\r\n copySubArrays(this._color2, geom._color2, cylinderIndices, COLOR_SIZE);\r\n _assignOpacity(info.cylinderInfo, geom._color1, geom._color2);\r\n geom.boundingSphere = this.boundingSphere;\r\n geom.boundingBox = this.boundingBox;\r\n return [geom];\r\n }\r\n\r\n getGeoParams() {\r\n return this._cylGeometry.parameters;\r\n }\r\n\r\n _init(instanceCount, cylinderGeo, useZSprites) {\r\n this.copy(cylinderGeo);\r\n this._matVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._matVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._color1 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n this._color2 = utils.allocateTyped(Float32Array, instanceCount * COLOR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, instanceCount);\r\n _.fill(alpha, 1.0);\r\n\r\n this.setAttribute('matVector1', new THREE.InstancedBufferAttribute(this._matVector1, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector2', new THREE.InstancedBufferAttribute(this._matVector2, OFFSET_SIZE, false, 1));\r\n this.setAttribute('matVector3', new THREE.InstancedBufferAttribute(this._matVector3, OFFSET_SIZE, false, 1));\r\n this.setAttribute('color', new THREE.InstancedBufferAttribute(this._color1, COLOR_SIZE, false, 1));\r\n this.setAttribute('color2', new THREE.InstancedBufferAttribute(this._color2, COLOR_SIZE, false, 1));\r\n\r\n this.setAttribute('alphaColor', new THREE.InstancedBufferAttribute(this._alpha, 1, false, 1));\r\n\r\n if (useZSprites) {\r\n this._invmatVector1 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector2 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n this._invmatVector3 = utils.allocateTyped(Float32Array, instanceCount * OFFSET_SIZE);\r\n\r\n this.setAttribute(\r\n 'invmatVector1',\r\n new THREE.InstancedBufferAttribute(this._invmatVector1, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector2',\r\n new THREE.InstancedBufferAttribute(this._invmatVector2, OFFSET_SIZE, false, 1),\r\n );\r\n this.setAttribute(\r\n 'invmatVector3',\r\n new THREE.InstancedBufferAttribute(this._invmatVector3, OFFSET_SIZE, false, 1),\r\n );\r\n }\r\n }\r\n}\r\n\r\nexport default Instanced2CCylindersGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst TRI_SIZE = 3;\r\nconst tmpPrev = new THREE.Vector3();\r\nconst tmpNext = new THREE.Vector3();\r\nconst tmpRes = new THREE.Vector3();\r\nconst simpleNormal = new THREE.Vector3(1.0, 0.0, 0.0);\r\nconst normalOnCut = new THREE.Vector3();\r\nconst nearRingPt = new THREE.Vector3();\r\n\r\nfunction _createExtrudedChunkGeometry(shape, ringsCount) {\r\n const geo = new THREE.BufferGeometry();\r\n const ptsCount = shape.length;\r\n const totalPts = ptsCount * ringsCount;\r\n const type = totalPts <= 65536 ? Uint16Array : Uint32Array;\r\n const facesPerChunk = (ringsCount - 1) * ptsCount * 2;\r\n const indices = new THREE.BufferAttribute(utils.allocateTyped(type, facesPerChunk * TRI_SIZE), 1);\r\n\r\n let currVtxIdx = 0;\r\n let currFaceIdx = 0;\r\n for (let y = 0; y < ringsCount; y++) {\r\n // faces\r\n if (y !== ringsCount - 1) {\r\n for (let i = 0; i < ptsCount; i++) {\r\n const v1 = currVtxIdx + i;\r\n const v2 = currVtxIdx + ptsCount + i;\r\n const v3 = currVtxIdx + ptsCount + ((i + 1) % ptsCount);\r\n const v4 = currVtxIdx + ((i + 1) % ptsCount);\r\n\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v1, v4, v2);\r\n currFaceIdx++;\r\n indices.setXYZ(currFaceIdx * TRI_SIZE, v2, v4, v3);\r\n currFaceIdx++;\r\n }\r\n }\r\n\r\n currVtxIdx += ptsCount;\r\n }\r\n\r\n geo.setIndex(indices);\r\n const pos = utils.allocateTyped(Float32Array, totalPts * VEC_SIZE);\r\n geo.setAttribute('position', new THREE.BufferAttribute(pos, VEC_SIZE));\r\n\r\n geo._positions = shape;\r\n\r\n return geo;\r\n}\r\n\r\nclass ExtrudedObjectsGeometry extends ChunkedObjectsGeometry {\r\n constructor(shape, ringsCount, chunksCount) {\r\n const chunkGeo = _createExtrudedChunkGeometry(shape, ringsCount);\r\n super(chunkGeo, chunksCount);\r\n this._ringsCount = ringsCount;\r\n\r\n const tmpShape = this._tmpShape = [];\r\n for (let i = 0; i < shape.length; ++i) {\r\n tmpShape[i] = new THREE.Vector3();\r\n }\r\n }\r\n\r\n setItem(itemIdx, matrices, hasSlope = false, hasCut = false) {\r\n const ptsCount = this._chunkGeo._positions.length;\r\n const ringsCount = this._ringsCount;\r\n const chunkStartIdx = ptsCount * this._ringsCount * itemIdx * VEC_SIZE;\r\n\r\n this._setPoints(matrices, ptsCount, ringsCount, chunkStartIdx);\r\n\r\n if (hasSlope) {\r\n this._setSlopeNormals(ptsCount, ringsCount, chunkStartIdx);\r\n } else {\r\n this._setBaseNormals(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n\r\n if (hasCut) {\r\n this._addCut(ptsCount, ringsCount, chunkStartIdx);\r\n }\r\n }\r\n\r\n _setPoints(matrices, ptsCount, ringsCount, chunkStartIdx) {\r\n const tmpShape = this._tmpShape;\r\n const positions = this._positions;\r\n const shape = this._chunkGeo._positions;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i) {\r\n const mtx = matrices[i];\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpShape[j].copy(shape[j]).applyMatrix4(mtx).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _setBaseNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n for (let i = 0, vtxIdx = chunkStartIdx; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, false);\r\n }\r\n }\r\n\r\n _setSlopeNormals(ptsCount, ringsCount, chunkStartIdx) {\r\n const normals = this._normals;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First ring\r\n // In all cases, besides cut, second ring is coincident to first. So values of first ring's normals doesn't\r\n // matter (In the cut case special handler will be applied later and will set them to correct values)\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n simpleNormal.toArray(normals, vtxIdx);\r\n }\r\n // second ring\r\n // If it isn't first Item we take normals' values from the last ring of the previous item (these rings are coincident)\r\n // else we count normals' values based on next ring information\r\n if (vtxIdx - 2 * nPtsInRing > 0) {\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(normals, vtxIdx - 2 * nPtsInRing).toArray(normals, vtxIdx);\r\n }\r\n } else {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, +nPtsInRing);\r\n vtxIdx += nPtsInRing;\r\n }\r\n // other rings\r\n // we count normals' values based on previous ring information\r\n for (let i = 2; i < ringsCount; ++i, vtxIdx += nPtsInRing) {\r\n this._countNormalsInRing(ptsCount, vtxIdx, true, -nPtsInRing);\r\n }\r\n }\r\n\r\n // Counting normals:\r\n // - Slope\r\n // Radius changes throught part => normals aren't parallel with the plane contains section points\r\n // normal = vTangentInSectionPlane x vToSuchPointInPrevSection (all vectors are scaled for being 1 in length)\r\n // - No slope\r\n // Radius doesn't change throught part => normals are parallel with the plane contains section points\r\n // normal = vToPrevPointInSection + vToNextPointInSection (all vectors are scaled for being 1 in length)\r\n _countNormalsInRing(ptsCount, vtxIdx, isSlope, shiftToExtraPt) {\r\n const tmpShape = this._tmpShape;\r\n const normals = this._normals;\r\n\r\n tmpShape[0].fromArray(this._positions, vtxIdx);\r\n tmpShape[ptsCount - 1].fromArray(this._positions, vtxIdx + (ptsCount - 1) * VEC_SIZE);\r\n\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n if (j < ptsCount - 1) {\r\n tmpShape[j + 1].fromArray(this._positions, vtxIdx + VEC_SIZE);\r\n }\r\n\r\n if (isSlope) {\r\n nearRingPt.fromArray(this._positions, vtxIdx + shiftToExtraPt);\r\n\r\n tmpPrev.subVectors(tmpShape[(j + ptsCount - 1) % ptsCount], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], nearRingPt).normalize();\r\n tmpRes.crossVectors(tmpNext, tmpPrev).normalize().toArray(normals, vtxIdx);\r\n } else {\r\n tmpPrev.subVectors(tmpShape[j], tmpShape[(j + ptsCount - 1) % ptsCount]).normalize();\r\n tmpNext.subVectors(tmpShape[j], tmpShape[(j + 1) % ptsCount]).normalize();\r\n tmpRes.addVectors(tmpPrev, tmpNext).normalize().toArray(normals, vtxIdx);\r\n }\r\n }\r\n }\r\n\r\n _addCut(ptsCount, ringsCount, chunkStartIdx) {\r\n // Nothing to do if item is flat or only line\r\n if (ptsCount < 3 || ringsCount < 2) {\r\n return;\r\n }\r\n const positions = this._positions;\r\n const normals = this._normals;\r\n const tmpShape = this._tmpShape;\r\n const nPtsInRing = ptsCount * VEC_SIZE;\r\n\r\n // Normal to the cut plane is equal to cross product of two vectors which are lying in it\r\n tmpShape[0].fromArray(positions, chunkStartIdx);\r\n tmpShape[1].fromArray(positions, chunkStartIdx + VEC_SIZE);\r\n tmpShape[2].fromArray(positions, chunkStartIdx + 2 * VEC_SIZE);\r\n\r\n tmpPrev.subVectors(tmpShape[1], tmpShape[0]).normalize();\r\n tmpNext.subVectors(tmpShape[1], tmpShape[2]).normalize();\r\n normalOnCut.crossVectors(tmpPrev, tmpNext).normalize();\r\n\r\n let vtxIdx = chunkStartIdx;\r\n // First and second rings normals' values are equal to value of normal to the cutting plane\r\n for (let j = 0; j < ptsCount * 2; ++j, vtxIdx += VEC_SIZE) {\r\n normalOnCut.toArray(normals, vtxIdx);\r\n }\r\n if (ringsCount > 2) {\r\n // Third ring points are coincident to first ring points, but have different normals. It makes sharp angle near cut\r\n for (let j = 0; j < ptsCount; ++j, vtxIdx += VEC_SIZE) {\r\n tmpRes.fromArray(positions, vtxIdx - nPtsInRing).toArray(positions, vtxIdx);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default ExtrudedObjectsGeometry;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst MAX_IDC_16BIT = 65535;\r\nconst VERTEX_PER_SEGMENT = 4;\r\nconst POS_SIZE = 4;\r\nconst DIR_SIZE = 3;\r\nconst COL_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\nconst direction = new THREE.Vector3();\r\n\r\nfunction setArrayXYZ(arr, idx, x, y, z) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n}\r\n\r\nfunction setArrayXYZW(arr, idx, x, y, z, w) {\r\n arr[idx] = x;\r\n arr[idx + 1] = y;\r\n arr[idx + 2] = z;\r\n arr[idx + 3] = w;\r\n}\r\n\r\nfunction getSubset(arr, startSegmentIdx, segmentsCount, elemSize) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT;\r\n const end = start + segmentsCount * VERTEX_PER_SEGMENT;\r\n return arr.subarray(start * elemSize, end * elemSize);\r\n}\r\n\r\n/**\r\n * This class represents lines geometry which consists of screen-aligned narrow quad of variable width.\r\n *\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * collision geometry.\r\n */\r\n\r\nclass ThickLinesGeometry extends THREE.BufferGeometry {\r\n constructor(segmentsCount) {\r\n super();\r\n this._initVertices(segmentsCount);\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.getAttribute('position').needsUpdate = true;\r\n this.getAttribute('color').needsUpdate = true;\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n this.getAttribute('direction').needsUpdate = true;\r\n }\r\n\r\n setColor(segmentIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n idx += COL_SIZE;\r\n setArrayXYZ(this._colors, idx, tmpColor.r, tmpColor.g, tmpColor.b);\r\n }\r\n\r\n setSegment(segmentIdx, pos1, pos2) {\r\n direction.subVectors(pos1, pos2);\r\n direction.normalize();\r\n const positions = this._positions;\r\n const directions = this._directions;\r\n let idx = segmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n let dirIdx = segmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos1.x, pos1.y, pos1.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, 0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n idx += POS_SIZE;\r\n dirIdx += DIR_SIZE;\r\n setArrayXYZW(positions, idx, pos2.x, pos2.y, pos2.z, -0.5);\r\n setArrayXYZ(directions, dirIdx, direction.x, direction.y, direction.z);\r\n }\r\n\r\n setOpacity(startSegIdx, endSegIdx, value) {\r\n const start = startSegIdx * VERTEX_PER_SEGMENT;\r\n const end = endSegIdx * VERTEX_PER_SEGMENT;\r\n _.fill(this.alpha, value, end, start);\r\n this.getAttribute('alphaColor').needsUpdate = true;\r\n }\r\n\r\n getSubsetSegments(startSegmentIdx, segmentsCount) {\r\n return [\r\n getSubset(this._positions, startSegmentIdx, segmentsCount, POS_SIZE),\r\n getSubset(this._directions, startSegmentIdx, segmentsCount, DIR_SIZE),\r\n ];\r\n }\r\n\r\n getSubsetColors(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._colors, startSegmentIdx, segmentsCount, COL_SIZE);\r\n }\r\n\r\n getSubsetOpacities(startSegmentIdx, segmentsCount) {\r\n return getSubset(this._alpha, startSegmentIdx, segmentsCount, 1);\r\n }\r\n\r\n getNumVertexPerSegment() {\r\n return VERTEX_PER_SEGMENT;\r\n }\r\n\r\n getPositionSize() {\r\n return POS_SIZE;\r\n }\r\n\r\n setSegments(startSegmentIdx, positions) {\r\n const startPos = startSegmentIdx * VERTEX_PER_SEGMENT * POS_SIZE;\r\n if (positions instanceof Array && positions.length === 2) {\r\n this._positions.set(positions[0], startPos);\r\n const startDir = startSegmentIdx * VERTEX_PER_SEGMENT * DIR_SIZE;\r\n this._directions.set(positions[1], startDir); // dirs are geo part of vertex\r\n } else {\r\n this._positions.set(positions, startPos);\r\n }\r\n }\r\n\r\n setColors(startSegmentIdx, colors) {\r\n const start = startSegmentIdx * VERTEX_PER_SEGMENT * COL_SIZE;\r\n this._colors.set(colors, start);\r\n }\r\n\r\n _initVertices(segmentsCount) {\r\n this._buffersSize = segmentsCount * VERTEX_PER_SEGMENT;\r\n const pointsCount = this._buffersSize;\r\n const use32bitIndex = pointsCount > MAX_IDC_16BIT;\r\n this._index = utils.allocateTyped(use32bitIndex ? Uint32Array : Uint16Array, segmentsCount * 6);\r\n this._positions = utils.allocateTyped(Float32Array, pointsCount * POS_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, pointsCount * COL_SIZE);\r\n this._directions = utils.allocateTyped(Float32Array, pointsCount * DIR_SIZE);\r\n const alpha = this._alpha = utils.allocateTyped(Float32Array, pointsCount);\r\n _.fill(alpha, 1.0);\r\n\r\n const index = this._index;\r\n let indexOffset = 0;\r\n let pointOffset = 0;\r\n for (let j = 0; j < segmentsCount; j++, indexOffset += 6, pointOffset += VERTEX_PER_SEGMENT) {\r\n index[indexOffset] = pointOffset;\r\n index[indexOffset + 1] = pointOffset + 1;\r\n index[indexOffset + 2] = pointOffset + 3;\r\n index[indexOffset + 3] = pointOffset;\r\n index[indexOffset + 4] = pointOffset + 2;\r\n index[indexOffset + 5] = pointOffset + 3;\r\n }\r\n this.setIndex(new THREE.BufferAttribute(this._index, 1));\r\n\r\n this.setAttribute('position', new THREE.BufferAttribute(this._positions, POS_SIZE));\r\n this.setAttribute('color', new THREE.BufferAttribute(this._colors, COL_SIZE));\r\n this.setAttribute('alphaColor', new THREE.BufferAttribute(alpha, 1));\r\n this.setAttribute('direction', new THREE.BufferAttribute(this._directions, DIR_SIZE));\r\n }\r\n}\r\n\r\nexport default ThickLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport BaseLinesGeometry from './ThickLinesGeometry';\r\n\r\n/**\r\n * This class represents geometry which consists lines. This can build bounding volumes\r\n * @constructor\r\n *\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n */\r\nclass LinesGeometry extends BaseLinesGeometry {\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const { boundingBox } = this;\r\n // Build bounding sphere\r\n let radiusSquared = 0.0;\r\n const center = new THREE.Vector3();\r\n if (boundingBox) {\r\n boundingBox.getCenter(center);\r\n }\r\n const positions = this._positions;\r\n const sphere = this.boundingSphere || new THREE.Sphere();\r\n const size = this._positions.length;\r\n const pos = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n pos.set(positions[i], positions[i + 1], positions[i + 2]);\r\n const lengthSquared = center.distanceToSquared(pos);\r\n if (radiusSquared < lengthSquared) {\r\n radiusSquared = lengthSquared;\r\n }\r\n }\r\n sphere.set(center, Math.sqrt(radiusSquared));\r\n this.boundingSphere = sphere;\r\n }\r\n\r\n computeBoundingBox() {\r\n const positions = this._positions;\r\n const box = new THREE.Box3();\r\n const size = this._positions.length;\r\n const tmpVec = new THREE.Vector3();\r\n const posSize = this.getPositionSize();\r\n for (let i = 0; i < size; i += posSize) {\r\n tmpVec.set(positions[i], positions[i + 1], positions[i + 2]);\r\n box.expandByPoint(tmpVec);\r\n }\r\n this.boundingBox = box;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n}\r\n\r\nexport default LinesGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport ChunkedObjectsGeometry from './ChunkedObjectsGeometry';\r\n\r\nconst VEC_SIZE = 3;\r\nconst tmpVector = new THREE.Vector3();\r\nconst normMtx = new THREE.Matrix3();\r\n\r\nclass CylinderCollisionGeo extends ChunkedObjectsGeometry {\r\n constructor(instanceCount, polyComplexity) {\r\n const cylGeometry = new THREE.CylinderGeometry(1, 1, 1.0, Math.max(3, polyComplexity), 2, true);\r\n super(cylGeometry, instanceCount);\r\n\r\n const chunkSize = this._chunkSize;\r\n this._chunkPos = this._chunkGeo.attributes.position.array;\r\n this._chunkNorms = this._chunkGeo.attributes.normal.array;\r\n this._tmpVector = utils.allocateTyped(Float32Array, chunkSize * VEC_SIZE);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos, itemRad) {\r\n const chunkSize = this._chunkSize;\r\n const itemOffset = chunkSize * itemIdx * VEC_SIZE;\r\n\r\n const tmpArray = this._tmpVector;\r\n const geoPos = this._chunkPos;\r\n const geoNorm = this._chunkNorms;\r\n\r\n const mtx1 = gfxutils.calcCylinderMatrix(botPos, topPos, itemRad);\r\n normMtx.getNormalMatrix(mtx1);\r\n let idx;\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoPos, idx);\r\n tmpVector.applyMatrix4(mtx1);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._positions.set(tmpArray, itemOffset);\r\n\r\n for (let i = 0; i < chunkSize; ++i) {\r\n idx = i * VEC_SIZE;\r\n tmpVector.fromArray(geoNorm, idx);\r\n tmpVector.applyMatrix3(normMtx);\r\n tmpVector.toArray(tmpArray, idx);\r\n }\r\n this._normals.set(tmpArray, itemOffset);\r\n }\r\n}\r\nexport default CylinderCollisionGeo;\r\n","import LinesGeometry from './LinesGeometry';\r\nimport CylinderCollisionGeo from './CylinderCollisionGeo';\r\n\r\nconst COLLISION_RAD = 0.1;\r\n\r\n/**\r\n * This class represents geometry which consists of separate chunks.\r\n * Each chunk has same index and similar geometry with equal points and faces count.\r\n * Each chunk has by default only one color.\r\n * @constructor\r\n *\r\n * @param {number} chunksCount Total chunks count.\r\n * @param {number} segmentsCount Number of segments per chunk.\r\n * @param {boolean} enableCollision Enable or disable collision where each segment is\r\n * a collidable cylinder.\r\n * collision geometry.\r\n */\r\nclass ChunkedLinesGeometry extends LinesGeometry {\r\n constructor(chunksCount, segmentsCount, enableCollision) {\r\n super(chunksCount * segmentsCount);\r\n this._init(segmentsCount);\r\n this._collisionGeo = enableCollision ? new CylinderCollisionGeo(chunksCount * segmentsCount, 3) : null;\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n computeBoundingSphere() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingSphere();\r\n this.boundingSphere = collisionGeo.boundingSphere;\r\n return;\r\n }\r\n super.computeBoundingSphere();\r\n }\r\n\r\n computeBoundingBox() {\r\n const collisionGeo = this._collisionGeo;\r\n if (collisionGeo) {\r\n collisionGeo.computeBoundingBox();\r\n this.boundingBox = collisionGeo.boundingBox;\r\n return;\r\n }\r\n super.computeBoundingBox();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const collisionGeo = this._collisionGeo;\r\n if (!collisionGeo) {\r\n return;\r\n }\r\n const segCount = this._chunkSize;\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n for (let i = 0, n = intersects.length; i < n; ++i) {\r\n let { chunkIdx } = intersects[i];\r\n if (chunkIdx === undefined) {\r\n continue;\r\n }\r\n chunkIdx = (chunkIdx / segCount) | 0;\r\n intersects[i].chunkIdx = chunkIdx;\r\n }\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = chunkIdx * chunkSize, end = i + chunkSize; i < end; ++i) {\r\n super.setColor(i, colorVal);\r\n }\r\n }\r\n\r\n setSegment(chunkIdx, segIdx, pos1, pos2) {\r\n const chunkSize = this._chunkSize;\r\n const idx = chunkIdx * chunkSize + segIdx;\r\n super.setSegment(idx, pos1, pos2);\r\n if (this._collisionGeo) {\r\n this._collisionGeo.setItem(chunkIdx * chunkSize + segIdx, pos1, pos2, COLLISION_RAD);\r\n }\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n setOpacity(chunkIndices, value) {\r\n const chunkSize = this._chunkSize;\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const left = chunkIndices[i] * chunkSize;\r\n super.setOpacity(left, left + chunkSize - 1, value);\r\n }\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const instanceCount = chunkIndices.length;\r\n const chunkSize = this._chunkSize;\r\n const subset = new ChunkedLinesGeometry(instanceCount, chunkSize, false);\r\n for (let i = 0, n = chunkIndices.length; i < n; ++i) {\r\n const dstPtOffset = i * chunkSize;\r\n const startSegIdx = chunkIndices[i] * chunkSize;\r\n subset.setSegments(dstPtOffset, this.getSubsetSegments(startSegIdx, chunkSize));\r\n subset.setColors(dstPtOffset, this.getSubsetColors(startSegIdx, chunkSize));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(chunkSize) {\r\n this._chunkSize = chunkSize;\r\n }\r\n}\r\n\r\nexport default ChunkedLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport LinesGeometry from './LinesGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\n\r\nconst COLLISION_RAD = 0.3;\r\nconst tmpVector = new THREE.Vector3();\r\n\r\nclass TwoColorLinesGeometry extends LinesGeometry {\r\n constructor(segmentsCount) {\r\n super(segmentsCount * 2);\r\n this._init(segmentsCount);\r\n this._collisionGeo = new Simple2CCylindersGeometry(segmentsCount, 3);\r\n }\r\n\r\n setItem(itemIdx, botPos, topPos) {\r\n this._collisionGeo.setItem(itemIdx, botPos, topPos, COLLISION_RAD);\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n tmpVector.lerpVectors(botPos, topPos, 0.5);\r\n super.setSegment(offset, botPos, tmpVector);\r\n super.setSegment(offset + 1, tmpVector, topPos);\r\n }\r\n\r\n setColor(itemIdx, colorVal1, colorVal2) {\r\n const offset = 2 * itemIdx;// there are two points per segment\r\n super.setColor(offset, colorVal1);\r\n super.setColor(offset + 1, colorVal2);\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n if (this._collisionGeo) {\r\n this._collisionGeo.raycast(raycaster, intersects);\r\n }\r\n }\r\n\r\n getSubset(segmentIndices) {\r\n const instanceCount = segmentIndices.length;\r\n const subset = new TwoColorLinesGeometry(instanceCount, false);\r\n for (let i = 0, n = instanceCount; i < n; ++i) {\r\n const startSegIdx = segmentIndices[i];\r\n subset.setSegments(i, this.getSubsetSegments(startSegIdx, 1));\r\n subset.setColors(i, this.getSubsetColors(startSegIdx, 1));\r\n }\r\n\r\n subset.boundingSphere = this.boundingSphere;\r\n subset.boundingBox = this.boundingBox;\r\n return [subset];\r\n }\r\n\r\n _init(segmentsCount) {\r\n this._segCounts = segmentsCount * 2;\r\n }\r\n}\r\n// (???)parent = LinesGeometry.prototype;\r\n\r\nexport default TwoColorLinesGeometry;\r\n","import * as THREE from 'three';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport SphereCollisionGeo from './SphereCollisionGeo';\r\n\r\nconst vectors = [\r\n new THREE.Vector3(1, 0, 0),\r\n new THREE.Vector3(-1, 0, 0),\r\n new THREE.Vector3(0, 1, 0),\r\n new THREE.Vector3(0, -1, 0),\r\n new THREE.Vector3(0, 0, 1),\r\n new THREE.Vector3(0, 0, -1),\r\n];\r\nconst vecCount = vectors.length;\r\nconst tempPos1 = new THREE.Vector3();\r\nconst tempPos2 = new THREE.Vector3();\r\n\r\nclass CrossGeometry extends SphereCollisionGeo(ChunkedLinesGeometry) {\r\n constructor(chunksCount) {\r\n super(chunksCount, chunksCount, (vecCount / 2) | 0, false);\r\n }\r\n\r\n setItem(itemIdx, itemPos, itemRad) {\r\n this.setSphere(itemIdx, itemPos, itemRad);\r\n\r\n for (let i = 0; i < vecCount / 2; ++i) {\r\n const first = i * 2;\r\n tempPos1.x = itemPos.x + vectors[first].x * itemRad;\r\n tempPos1.y = itemPos.y + vectors[first].y * itemRad;\r\n tempPos1.z = itemPos.z + vectors[first].z * itemRad;\r\n const second = first + 1;\r\n tempPos2.x = itemPos.x + vectors[second].x * itemRad;\r\n tempPos2.y = itemPos.y + vectors[second].y * itemRad;\r\n tempPos2.z = itemPos.z + vectors[second].z * itemRad;\r\n this.setSegment(itemIdx, i, tempPos1, tempPos2);\r\n }\r\n }\r\n}\r\nexport default CrossGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\nconst POS_RAD_SIZE = 4;\r\nconst COLOR_SIZE = 3;\r\nconst tmpColor = new THREE.Color();\r\n\r\n/**\r\n * This is a base class for isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\nclass IsoSurfaceGeometry extends THREE.BufferGeometry {\r\n constructor(spheresCount, opts) {\r\n super();\r\n\r\n this._opts = opts;\r\n this.zClip = this._opts.zClip;\r\n this._posRad = utils.allocateTyped(Float32Array, spheresCount * POS_RAD_SIZE);\r\n this._colors = utils.allocateTyped(Float32Array, spheresCount * COLOR_SIZE);\r\n }\r\n\r\n setItem(chunkIdx, pos, radius) {\r\n const posRad = this._posRad;\r\n let idx = POS_RAD_SIZE * chunkIdx;\r\n posRad[idx++] = pos.x;\r\n posRad[idx++] = pos.y;\r\n posRad[idx++] = pos.z;\r\n posRad[idx] = radius;\r\n }\r\n\r\n setColor(chunkIdx, colorVal) {\r\n tmpColor.set(colorVal);\r\n const colors = this._colors;\r\n let idx = COLOR_SIZE * chunkIdx;\r\n colors[idx++] = tmpColor.r;\r\n colors[idx++] = tmpColor.g;\r\n colors[idx] = tmpColor.b;\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n this.computeBoundingSphere();\r\n }\r\n\r\n finishUpdate() {\r\n this._build();\r\n }\r\n\r\n setOpacity() {\r\n // not implemented\r\n }\r\n\r\n raycast() {\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\nexport default IsoSurfaceGeometry;\r\n","import utils from '../../utils';\r\n\r\n/**\r\n * Class for marching cube\r\n * Stores 8 points and 8 float values are stored together in linear array\r\n * Int values for has intersection or not - in integer32 linear array\r\n * Int values for bits flags - in integer32 linear array\r\n *\r\n */\r\nclass IsoSurfaceMarchCube {\r\n constructor() {\r\n this.pointsValuesLinear = null;\r\n this.hasIntersection = null;\r\n this.bitsInside = null;\r\n }\r\n\r\n create(numCellsPerSide) {\r\n const vx7000000 = 0x7000000;\r\n const n3 = numCellsPerSide * numCellsPerSide * numCellsPerSide;\r\n if (n3 > vx7000000) {\r\n throw new Error('Too large cube dimension: lead to memory huge uasge');\r\n }\r\n this.pointsValuesLinear = utils.allocateTyped(Float32Array, (2 << (2 + 2)) * n3);\r\n this.hasIntersection = utils.allocateTyped(Int32Array, n3);\r\n this.bitsInside = utils.allocateTyped(Int32Array, n3);\r\n return 0;\r\n }\r\n\r\n destroy() {\r\n this.bitsInside = null;\r\n this.hasIntersection = null;\r\n this.pointsValuesLinear = null;\r\n }\r\n}\r\n\r\n/* eslint-disable no-magic-numbers */\r\nIsoSurfaceMarchCube.prototype.striIndicesMarchCube = [\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1,\r\n 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1,\r\n 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1,\r\n 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1,\r\n 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1,\r\n 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1,\r\n 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1,\r\n 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1,\r\n 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1,\r\n 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1,\r\n 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1,\r\n 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1,\r\n 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1,\r\n 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1,\r\n 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1,\r\n 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1,\r\n 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1,\r\n 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1,\r\n 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1,\r\n 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1,\r\n 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1,\r\n 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1,\r\n 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1,\r\n 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1,\r\n 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1,\r\n 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1,\r\n 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1,\r\n 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1,\r\n 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1,\r\n 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1,\r\n 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1,\r\n 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1,\r\n 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1,\r\n 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1,\r\n 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1,\r\n 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1,\r\n 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1,\r\n 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1,\r\n 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1,\r\n 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1,\r\n 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1,\r\n 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1,\r\n 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1,\r\n 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1,\r\n 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1,\r\n 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1,\r\n 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1,\r\n 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1,\r\n 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1,\r\n 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1,\r\n 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1,\r\n 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1,\r\n 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1,\r\n 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1,\r\n 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1,\r\n 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1,\r\n 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1,\r\n 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1,\r\n 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1,\r\n 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1,\r\n 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1,\r\n 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1,\r\n 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1,\r\n 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1,\r\n 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1,\r\n 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1,\r\n 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1,\r\n 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1,\r\n 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1,\r\n 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1,\r\n 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1,\r\n 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1,\r\n 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1,\r\n 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1,\r\n 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1,\r\n 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1,\r\n 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1,\r\n 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1,\r\n 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1,\r\n 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1,\r\n 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1,\r\n 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1,\r\n 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1,\r\n 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1,\r\n 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1,\r\n 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1,\r\n 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1,\r\n 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1,\r\n 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1,\r\n 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1,\r\n 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1,\r\n 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1,\r\n 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1,\r\n 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1,\r\n 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1,\r\n 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1,\r\n 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1,\r\n 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1,\r\n 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1,\r\n 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1,\r\n 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1,\r\n 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1,\r\n 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r\n];\r\n/* eslint-enable no-magic-numbers */\r\n\r\nexport default IsoSurfaceMarchCube;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport utils from '../../utils';\r\n\r\nconst edgeTable = [\r\n 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,\r\n 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,\r\n 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,\r\n 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,\r\n 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,\r\n 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,\r\n 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac,\r\n 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,\r\n 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c,\r\n 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,\r\n 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc,\r\n 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,\r\n 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c,\r\n 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,\r\n 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc,\r\n 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,\r\n 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,\r\n 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,\r\n 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,\r\n 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,\r\n 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,\r\n 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,\r\n 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,\r\n 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460,\r\n 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,\r\n 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,\r\n 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,\r\n 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,\r\n 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,\r\n 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,\r\n 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,\r\n 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0];\r\n\r\nfunction _voxelGradientFast(v, point, grad) {\r\n const g = v.getValue(point.x, point.y, point.z);\r\n grad.set(g[0], g[1], g[2]);\r\n}\r\n\r\n// Helper class GridCell\r\nclass GridCell {\r\n constructor() {\r\n this._arrSize = 8;\r\n this.p = new Array(this._arrSize);\r\n this.g = new Array(this._arrSize);\r\n this.val = new Array(this._arrSize);\r\n for (let i = 0; i < this._arrSize; ++i) {\r\n this.p[i] = new THREE.Vector3();\r\n this.g[i] = new THREE.Vector3();\r\n }\r\n this.cubeIndex = 0;\r\n }\r\n}\r\n\r\n// Helper class Triangle\r\nclass Triangle {\r\n constructor() {\r\n this.a = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.b = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n\r\n this.c = {\r\n p: new THREE.Vector3(),\r\n n: new THREE.Vector3(),\r\n };\r\n }\r\n}\r\n\r\nfunction createArray(arrSize) {\r\n const arr = new Array(arrSize);\r\n for (let i = 0; i < arrSize; ++i) {\r\n arr[i] = new THREE.Vector3();\r\n }\r\n\r\n return arr;\r\n}\r\n\r\nclass IsoSurface {\r\n constructor() {\r\n this._numTriangles = 0;\r\n this._numVertices = 0;\r\n this._position = [];\r\n this._normals = [];\r\n this._colors = null;\r\n this._indices = [];\r\n this._volumetricData = null;\r\n this._xAxis = new THREE.Vector3();\r\n this._yAxis = new THREE.Vector3();\r\n this._zAxis = new THREE.Vector3();\r\n this._xDir = new THREE.Vector3();\r\n this._yDir = new THREE.Vector3();\r\n this._zDir = new THREE.Vector3();\r\n }\r\n\r\n _prepareAxesAndDirs() {\r\n const volData = this._volumetricData;\r\n\r\n const cellSize = volData.getCellSize();\r\n\r\n // calculate cell axes\r\n const xAxis = this._xAxis;\r\n const yAxis = this._yAxis;\r\n const zAxis = this._zAxis;\r\n const xDir = this._xDir;\r\n const yDir = this._yDir;\r\n const zDir = this._zDir;\r\n\r\n xAxis.set(cellSize.x, 0, 0);\r\n yAxis.set(0, cellSize.y, 0);\r\n zAxis.set(0, 0, cellSize.z);\r\n\r\n xDir.set(1, 0, 0);\r\n yDir.set(0, 1, 0);\r\n zDir.set(0, 0, 1);\r\n\r\n // flip normals if coordinate system is in the wrong handedness\r\n const tmp = new THREE.Vector3();\r\n tmp.crossVectors(xDir, yDir);\r\n if (tmp.dot(zDir) < 0) {\r\n xDir.negate();\r\n yDir.negate();\r\n zDir.negate();\r\n }\r\n\r\n // check that the grid is in the all-positive octant of the coordinate system\r\n if (xDir.x < 0 || xDir.y < 0 || xDir.z < 0\r\n || yDir.x < 0 || yDir.y < 0 || yDir.z < 0\r\n || zDir.x < 0 || zDir.y < 0 || zDir.z < 0) {\r\n return false;\r\n }\r\n\r\n // check that the grid is axis-aligned\r\n const notZero = (axe) => Math.abs(axe) > Number.EPSILON;\r\n return !(notZero(xAxis.y) || notZero(xAxis.z)\r\n || notZero(yAxis.x) || notZero(yAxis.z)\r\n || notZero(zAxis.x) || notZero(zAxis.y));\r\n }\r\n\r\n _vertexInterp(isoLevel, grid, ind1, ind2, vertex, normal) {\r\n const p1 = grid.p[ind1];\r\n const p2 = grid.p[ind2];\r\n const n1 = grid.g[ind1];\r\n const n2 = grid.g[ind2];\r\n const valP1 = grid.val[ind1];\r\n const valP2 = grid.val[ind2];\r\n const isoDiffP1 = isoLevel - valP1;\r\n const diffValP2P1 = valP2 - valP1;\r\n\r\n let mu = 0.0;\r\n\r\n if (Math.abs(diffValP2P1) > 0.0) {\r\n mu = isoDiffP1 / diffValP2P1;\r\n }\r\n mu = mu > 1.0 ? 1.0 : mu;\r\n vertex.lerpVectors(p1, p2, mu);\r\n normal.lerpVectors(n1, n2, mu);\r\n }\r\n\r\n static _triTable = IsoSurfaceMarchCube.prototype.striIndicesMarchCube;\r\n\r\n static _arrSize = 12;\r\n\r\n static _firstIndices = [0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3];\r\n\r\n static _secondIndices = [1, 2, 3, 0, 5, 6, 7, 4, 4, 5, 6, 7];\r\n\r\n static _vertexList = createArray(IsoSurface._arrSize);\r\n\r\n static _normalList = createArray(IsoSurface._arrSize);\r\n\r\n _polygonize(grid, isoLevel, triangles) {\r\n const { cubeIndex } = grid;\r\n let i = 0;\r\n const arrSize = IsoSurface._arrSize;\r\n const firstIndices = IsoSurface._firstIndices;\r\n const secondIndices = IsoSurface._secondIndices;\r\n const vertexList = IsoSurface._vertexList;\r\n const normalList = IsoSurface._normalList;\r\n\r\n for (; i < arrSize; ++i) {\r\n if (edgeTable[cubeIndex] & (1 << i)) {\r\n this._vertexInterp(\r\n isoLevel,\r\n grid,\r\n firstIndices[i],\r\n secondIndices[i],\r\n vertexList[i],\r\n normalList[i],\r\n );\r\n }\r\n }\r\n\r\n let triCount = 0;\r\n const triTblIdx = cubeIndex * 16;\r\n const triTable = IsoSurface._triTable;\r\n\r\n for (i = 0; triTable[triTblIdx + i] !== -1; i += 3) {\r\n triangles[triCount].a.p.copy(vertexList[triTable[triTblIdx + i]]);\r\n triangles[triCount].a.n.copy(normalList[triTable[triTblIdx + i]]);\r\n\r\n triangles[triCount].b.p.copy(vertexList[triTable[triTblIdx + i + 1]]);\r\n triangles[triCount].b.n.copy(normalList[triTable[triTblIdx + i + 1]]);\r\n\r\n triangles[triCount].c.p.copy(vertexList[triTable[triTblIdx + i + 2]]);\r\n triangles[triCount].c.n.copy(normalList[triTable[triTblIdx + i + 2]]);\r\n ++triCount;\r\n }\r\n\r\n return triCount;\r\n }\r\n\r\n _doGridPosNorms(isoValue, step, appendSimple) {\r\n const vol = this._volumetricData;\r\n const volData = this._volumetricData.getData();\r\n const dim = vol.getDimensions();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n const zSize = dim[2];\r\n const stepX = step * vol.getStrideX();\r\n const stepY = step * vol.getStrideY();\r\n const stepZ = step * vol.getStrideZ();\r\n\r\n const gc = new GridCell();\r\n const gcVal = gc.val;\r\n const gcValSize = gc.val.length;\r\n const additions = [\r\n new THREE.Vector3(0, 0, 0), // 0\r\n new THREE.Vector3(step, 0, 0), // 1\r\n new THREE.Vector3(step, step, 0), // 2\r\n new THREE.Vector3(0, step, 0), // 3\r\n new THREE.Vector3(0, 0, step), // 4\r\n new THREE.Vector3(step, 0, step), // 5\r\n new THREE.Vector3(step, step, step), // 6\r\n new THREE.Vector3(0, step, step), // 7\r\n ];\r\n\r\n const tmpTriCount = 5;\r\n const triangles = new Array(tmpTriCount);\r\n for (let j = 0; j < tmpTriCount; ++j) {\r\n triangles[j] = new Triangle();\r\n }\r\n\r\n let appendVertex;\r\n const self = this;\r\n const positions = this._position;\r\n const normals = this._normals;\r\n if (appendSimple) {\r\n // Special case for axis-aligned grid with positive unit vector normals\r\n appendVertex = (function () {\r\n const axis = new THREE.Vector3(self._xAxis.x, self._yAxis.y, self._zAxis.z);\r\n return function (triVertex) {\r\n const vertex = triVertex.p.clone();\r\n vertex.multiply(axis);\r\n positions.push(vertex.add(self._origin));\r\n normals.push(triVertex.n.clone());\r\n };\r\n }());\r\n } else {\r\n appendVertex = (function () {\r\n const posMtx = new THREE.Matrix3();\r\n posMtx.set(\r\n self._xAxis.x,\r\n self._yAxis.x,\r\n self._zAxis.x,\r\n self._xAxis.y,\r\n self._yAxis.y,\r\n self._zAxis.y,\r\n self._xAxis.z,\r\n self._yAxis.z,\r\n self._zAxis.z,\r\n );\r\n const normMtx = new THREE.Matrix3();\r\n normMtx.set(\r\n self._xDir.x,\r\n self._yDir.x,\r\n self._zDir.x,\r\n self._xDir.y,\r\n self._yDir.y,\r\n self._zDir.y,\r\n self._xDir.z,\r\n self._yDir.z,\r\n self._zDir.z,\r\n );\r\n\r\n return function (triVertex) {\r\n positions.push(triVertex.p.clone().applyMatrix3(posMtx).add(self._origin));\r\n normals.push(triVertex.n.clone().applyMatrix3(normMtx));\r\n };\r\n }());\r\n }\r\n const indices = this._indices;\r\n\r\n let globTriCount = 0;\r\n\r\n for (let z = 0; z < (zSize - step); z += step) {\r\n for (let y = 0; y < (ySize - step); y += step) {\r\n let idx = vol.getDirectIdx(0, y, z);\r\n for (let x = 0; x < (xSize - step); x += step, idx += stepX) {\r\n /* eslint-disable no-multi-spaces */\r\n /* eslint-disable computed-property-spacing */\r\n gcVal[0] = volData[idx];\r\n gcVal[1] = volData[idx + stepX];\r\n gcVal[3] = volData[idx + stepY];\r\n gcVal[2] = volData[idx + stepX + stepY];\r\n gcVal[4] = volData[idx + stepZ];\r\n gcVal[5] = volData[idx + stepX + stepZ];\r\n gcVal[7] = volData[idx + stepY + stepZ];\r\n gcVal[6] = volData[idx + stepX + stepY + stepZ];\r\n /* eslint-enable no-multi-spaces */\r\n /* eslint-enable computed-property-spacing */\r\n\r\n // Determine the index into the edge table which\r\n // tells us which vertices are inside of the surface\r\n let cubeIndex = 0;\r\n let i = 0;\r\n for (; i < gcValSize; ++i) {\r\n if (gcVal[i] < isoValue) {\r\n cubeIndex |= (1 << i);\r\n }\r\n }\r\n\r\n if (edgeTable[cubeIndex] === 0) {\r\n continue;\r\n }\r\n\r\n gc.cubeIndex = cubeIndex;\r\n for (i = 0; i < gcValSize; ++i) {\r\n gc.p[i].set(x + additions[i].x, y + additions[i].y, z + additions[i].z);\r\n _voxelGradientFast(this._gradient, gc.p[i], gc.g[i]);\r\n }\r\n\r\n // calculate vertices and facets for this cube,\r\n // calculate normals by interpolating between the negated\r\n // normalized volume gradients for the 8 reference voxels\r\n const triCount = this._polygonize(gc, isoValue, triangles);\r\n globTriCount += triCount;\r\n\r\n // append triangles using different techniques\r\n for (i = 0; i < triCount; ++i) {\r\n indices.push(this._numTriangles * 3);\r\n indices.push(this._numTriangles * 3 + 1);\r\n indices.push(this._numTriangles * 3 + 2);\r\n ++this._numTriangles;\r\n\r\n appendVertex(triangles[i].a);\r\n appendVertex(triangles[i].b);\r\n appendVertex(triangles[i].c);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return globTriCount;\r\n }\r\n\r\n compute(volData, origin, isoValue, step) {\r\n this._volumetricData = volData;\r\n this._origin = origin;\r\n\r\n this._gradient = volData.computeGradient();\r\n\r\n this._doGridPosNorms(isoValue, step, this._prepareAxesAndDirs());\r\n }\r\n\r\n _remapIndices(vertexMap, idcCount) {\r\n const indices = this._indices;\r\n const newIndices = utils.allocateTyped(Uint32Array, idcCount);\r\n for (let i = 0; i < idcCount; ++i) {\r\n indices[i] = vertexMap[indices[i]];\r\n newIndices[i] = indices[i];\r\n }\r\n this._indices = newIndices;\r\n }\r\n\r\n _remapVertices(vertices, normals, count) {\r\n const newPositions = utils.allocateTyped(Float32Array, count * 3);\r\n const newNormals = utils.allocateTyped(Float32Array, count * 3);\r\n for (let i = 0; i < count; ++i) {\r\n const pos = vertices[i];\r\n newPositions[i * 3] = pos.x;\r\n newPositions[i * 3 + 1] = pos.y;\r\n newPositions[i * 3 + 2] = pos.z;\r\n const norm = normals[i].normalize();\r\n newNormals[i * 3] = norm.x;\r\n newNormals[i * 3 + 1] = norm.y;\r\n newNormals[i * 3 + 2] = norm.z;\r\n }\r\n this._position = newPositions;\r\n this._normals = newNormals;\r\n }\r\n\r\n vertexFusion(offset, len) {\r\n const faceVer = this._indices.length;\r\n const vertices = this._position;\r\n const normals = this._normals;\r\n const oldVerCount = vertices.length | 0;\r\n if (faceVer === 0 || oldVerCount === 0) {\r\n return;\r\n }\r\n const vMap = utils.allocateTyped(Uint32Array, oldVerCount);\r\n vMap[0] = 0;\r\n let newVer = 1;\r\n\r\n let i = 1;\r\n for (; i < oldVerCount; ++i) {\r\n const start = newVer - offset < 0 ? 0 : newVer - offset;\r\n const end = start + len > newVer ? newVer : start + len;\r\n let matchedIndex = -1;\r\n\r\n for (let j = start; j < end; ++j) {\r\n if (Math.abs(vertices[i] - vertices[j]) < Number.EPSILON) {\r\n matchedIndex = j;\r\n break;\r\n }\r\n }\r\n\r\n if (matchedIndex !== -1) {\r\n vMap[i] = matchedIndex;\r\n } else {\r\n vertices[newVer].copy(vertices[i]);\r\n normals[newVer].copy(normals[i]);\r\n vMap[i] = newVer;\r\n ++newVer;\r\n }\r\n }\r\n\r\n this._remapIndices(vMap, faceVer);\r\n this._remapVertices(vertices, normals, newVer);\r\n }\r\n\r\n // Assign per-vertex colors from a volumetric texture map (same dimensions as the original volumetric data).\r\n // Along with color dominating atom is determined for each vertex\r\n // and vertices with atom out of \"visible\" subset get filtered out.\r\n // XXX only handles orthogonal volumes currently\r\n setColorVolTex(colorMap, atomMap, atomWeightMap, visibilitySelector) {\r\n let i;\r\n let idx;\r\n const numVerts = this._position.length / 3;\r\n const vertices = this._position;\r\n const origin = this._origin;\r\n const dim = this._volumetricData.getDimensions();\r\n const xs = dim[0] - 1;\r\n const ys = dim[1] - 1;\r\n const zs = dim[2] - 1;\r\n\r\n const colorData = colorMap.getData();\r\n const strideX = colorMap.getStrideX();\r\n const strideY = colorMap.getStrideY();\r\n const strideZ = colorMap.getStrideZ();\r\n\r\n let atomWeightData;\r\n let atomStrideX;\r\n let atomStrideY;\r\n let atomStrideZ;\r\n\r\n if (visibilitySelector !== null) {\r\n atomWeightData = atomWeightMap.getData();\r\n atomStrideX = atomWeightMap.getStrideX();\r\n atomStrideY = atomWeightMap.getStrideY();\r\n atomStrideZ = atomWeightMap.getStrideZ();\r\n }\r\n\r\n const xInv = 1.0 / this._xAxis.x;\r\n const yInv = 1.0 / this._yAxis.y;\r\n const zInv = 1.0 / this._zAxis.z;\r\n\r\n let atomLookup = [];\r\n let atomWeights = [];\r\n const colors = utils.allocateTyped(Float32Array, numVerts * 3);\r\n\r\n function interp(mu, idx1, idx2, c) {\r\n c[0] = (1 - mu) * colorData[idx1] + mu * colorData[idx2];\r\n c[1] = (1 - mu) * colorData[idx1 + 1] + mu * colorData[idx2 + 1];\r\n c[2] = (1 - mu) * colorData[idx1 + 2] + mu * colorData[idx2 + 2];\r\n }\r\n\r\n function collectWeight(ai, coefX, coefY, coefZ) {\r\n const a = atomMap[ai]; // atomWeightMap is a scalar field, so index into atom map should be the same\r\n if (a != null) {\r\n atomLookup[a.index] = a;\r\n const w = coefX * coefY * coefZ * atomWeightData[ai];\r\n if (typeof atomWeights[a.index] === 'undefined') {\r\n atomWeights[a.index] = w;\r\n } else {\r\n atomWeights[a.index] += w;\r\n }\r\n }\r\n }\r\n\r\n const vMap = utils.allocateTyped(Int32Array, numVerts);\r\n let newVerCount = 0;\r\n\r\n for (i = 0; i < numVerts; i++) {\r\n const ind = i * 3;\r\n const vx = (vertices[ind] - origin.x) * xInv;\r\n const vy = (vertices[ind + 1] - origin.y) * yInv;\r\n const vz = (vertices[ind + 2] - origin.z) * zInv;\r\n const x = Math.min(Math.max(vx, 0), xs) | 0;\r\n const y = Math.min(Math.max(vy, 0), ys) | 0;\r\n const z = Math.min(Math.max(vz, 0), zs) | 0;\r\n\r\n const mux = (vx - x);\r\n const muy = (vy - y);\r\n const muz = (vz - z);\r\n\r\n if (visibilitySelector != null) {\r\n // collect atom weights\r\n atomLookup = [];\r\n atomWeights = [];\r\n idx = atomWeightMap.getDirectIdx(x, y, z);\r\n collectWeight(idx, 1 - mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideX, mux, 1 - muy, 1 - muz);\r\n collectWeight(idx + atomStrideY, 1 - mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideX + atomStrideY, mux, muy, 1 - muz);\r\n collectWeight(idx + atomStrideZ, 1 - mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideZ, mux, 1 - muy, muz);\r\n collectWeight(idx + atomStrideY + atomStrideZ, 1 - mux, muy, muz);\r\n collectWeight(idx + atomStrideX + atomStrideY + atomStrideZ, mux, muy, muz);\r\n\r\n // find dominant atom\r\n let maxWeight = 0.0;\r\n let dominantIdx = -1;\r\n for (const atomIdx in atomWeights) {\r\n if (atomWeights[atomIdx] > maxWeight) {\r\n dominantIdx = atomIdx;\r\n maxWeight = atomWeights[atomIdx];\r\n }\r\n }\r\n\r\n if (dominantIdx < 0 || !visibilitySelector.includesAtom(atomLookup[dominantIdx])) {\r\n // this vertex doesn't belong to visible subset and will be skipped\r\n vMap[i] = -1;\r\n continue;\r\n }\r\n }\r\n\r\n vMap[i] = newVerCount++;\r\n\r\n // color tri-linear interpolation\r\n const dx = (x < xs) ? strideX : 0;\r\n const dy = (y < ys) ? strideY : 0;\r\n const dz = (z < zs) ? strideZ : 0;\r\n\r\n const c0 = [0, 0, 0];\r\n const c1 = [0, 0, 0];\r\n const c2 = [0, 0, 0];\r\n const c3 = [0, 0, 0];\r\n\r\n idx = colorMap.getDirectIdx(x, y, z);\r\n interp(mux, idx, idx + dx, c0);\r\n interp(mux, idx + dy, idx + dx + dy, c1);\r\n interp(mux, idx + dz, idx + dx + dz, c2);\r\n interp(mux, idx + dy + dz, idx + dx + dy + dz, c3);\r\n\r\n const cz0 = [0, 0, 0];\r\n cz0[0] = (1 - muy) * c0[0] + muy * c1[0];\r\n cz0[1] = (1 - muy) * c0[1] + muy * c1[1];\r\n cz0[2] = (1 - muy) * c0[2] + muy * c1[2];\r\n\r\n const cz1 = [0, 0, 0];\r\n cz1[0] = (1 - muy) * c2[0] + muy * c3[0];\r\n cz1[1] = (1 - muy) * c2[1] + muy * c3[1];\r\n cz1[2] = (1 - muy) * c2[2] + muy * c3[2];\r\n\r\n colors[ind] = (1 - muz) * cz0[0] + muz * cz1[0];\r\n colors[ind + 1] = (1 - muz) * cz0[1] + muz * cz1[1];\r\n colors[ind + 2] = (1 - muz) * cz0[2] + muz * cz1[2];\r\n }\r\n this._colors = colors;\r\n\r\n if (visibilitySelector != null) {\r\n // shift visible vertices towards beginning of array\r\n for (i = 0; i < numVerts; ++i) {\r\n const j = vMap[i];\r\n if (j < 0) {\r\n continue;\r\n }\r\n\r\n // assert: j <= i\r\n this._position[j * 3] = this._position[i * 3];\r\n this._position[j * 3 + 1] = this._position[i * 3 + 1];\r\n this._position[j * 3 + 2] = this._position[i * 3 + 2];\r\n this._normals[j * 3] = this._normals[i * 3];\r\n this._normals[j * 3 + 1] = this._normals[i * 3 + 1];\r\n this._normals[j * 3 + 2] = this._normals[i * 3 + 2];\r\n this._colors[j * 3] = this._colors[i * 3];\r\n this._colors[j * 3 + 1] = this._colors[i * 3 + 1];\r\n this._colors[j * 3 + 2] = this._colors[i * 3 + 2];\r\n }\r\n\r\n // rebuild index list\r\n const numTriangles = this._indices.length / 3;\r\n let newTriCount = 0;\r\n for (i = 0; i < numTriangles; ++i) {\r\n const i0 = vMap[this._indices[3 * i]];\r\n const i1 = vMap[this._indices[3 * i + 1]];\r\n const i2 = vMap[this._indices[3 * i + 2]];\r\n if (i0 >= 0 && i1 >= 0 && i2 >= 0) {\r\n this._indices[3 * newTriCount] = i0;\r\n this._indices[3 * newTriCount + 1] = i1;\r\n this._indices[3 * newTriCount + 2] = i2;\r\n ++newTriCount;\r\n }\r\n }\r\n\r\n // shrink arrays to data size\r\n this._position = new Float32Array(this._position.buffer.slice(0, newVerCount * 3 * 4));\r\n this._normals = new Float32Array(this._normals.buffer.slice(0, newVerCount * 3 * 4));\r\n this._colors = new Float32Array(this._colors.buffer.slice(0, newVerCount * 3 * 4));\r\n this._indices = new Uint32Array(this._indices.buffer.slice(0, newTriCount * 3 * 4));\r\n }\r\n }\r\n\r\n toMesh() {\r\n const geo = new THREE.BufferGeometry();\r\n geo.setIndex(new THREE.BufferAttribute(this._indices, 1));\r\n geo.setAttribute('position', new THREE.BufferAttribute(this._position, 3));\r\n geo.setAttribute('normal', new THREE.BufferAttribute(this._normals, 3));\r\n geo.setAttribute('color', new THREE.BufferAttribute(this._colors, 3));\r\n geo.computeBoundingSphere();\r\n return geo;\r\n }\r\n}\r\nexport default IsoSurface;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurface from './IsoSurface';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * This is a base class for volumetric maps based isosurface algorithms.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass VolumeSurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n const params = this._opts;\r\n this.numVoxels = [128, 128, 128];\r\n this.xAxis = new THREE.Vector3(1.0, 0.0, 0.0);\r\n this.yAxis = new THREE.Vector3(0.0, 1.0, 0.0);\r\n this.zAxis = new THREE.Vector3(0.0, 0.0, 1.0);\r\n\r\n this.origin = new THREE.Vector3(0.0, 0.0, 0.0);\r\n this._visibilitySelector = params.visibilitySelector;\r\n\r\n this._calcSurface(params);\r\n }\r\n\r\n _findMinMax(posRadArray) {\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n const maxPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n const minPosRad = [posRadArray[0], posRadArray[1], posRadArray[2], posRadArray[3]];\r\n for (let i = 1; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n for (let itemIdx = 0; itemIdx < itemSize; ++itemIdx) {\r\n const tmpVal = posRadArray[ind + itemIdx];\r\n maxPosRad[itemIdx] = Math.max(tmpVal, maxPosRad[itemIdx]);\r\n minPosRad[itemIdx] = Math.min(tmpVal, minPosRad[itemIdx]);\r\n }\r\n }\r\n return { maxPosRad, minPosRad };\r\n }\r\n\r\n _findNumVoxels(posRadArray, params) {\r\n const { numVoxels } = this;\r\n const minMaxValues = this._findMinMax(posRadArray);\r\n const minCoordRad = minMaxValues.minPosRad;\r\n const maxCoordRad = minMaxValues.maxPosRad;\r\n\r\n // minrad\r\n if (minCoordRad[3] > 4.0) {\r\n params.gridSpacing *= minCoordRad[3];\r\n }\r\n\r\n let gridPadding = params.radScale * maxCoordRad[3] * 1.7;\r\n let padRad = gridPadding;\r\n padRad = 0.65 * Math.sqrt(4.0 / 3.0 * Math.PI * padRad * padRad * padRad);\r\n gridPadding = Math.max(gridPadding, padRad);\r\n\r\n let i = 0;\r\n for (; i < 3; ++i) {\r\n minCoordRad[i] -= gridPadding;\r\n maxCoordRad[i] += gridPadding;\r\n }\r\n\r\n for (i = 0; i < 3; ++i) {\r\n numVoxels[i] = Math.ceil((maxCoordRad[i] - minCoordRad[i]) / params.gridSpacing);\r\n }\r\n this.xAxis.x = (numVoxels[0] - 1) * params.gridSpacing;\r\n this.yAxis.y = (numVoxels[1] - 1) * params.gridSpacing;\r\n this.zAxis.z = (numVoxels[2] - 1) * params.gridSpacing;\r\n\r\n [this.origin.x, this.origin.y, this.origin.z] = minCoordRad;\r\n\r\n return { bbox: minMaxValues, dim: numVoxels };\r\n }\r\n\r\n _makeSurface(surface, params) {\r\n const isoSurf = new IsoSurface();\r\n isoSurf.compute(surface.volMap, this.origin, params.isoValue, 1);\r\n isoSurf.vertexFusion(9, 9);// normalization is included\r\n\r\n if (isoSurf._numTriangles > 0) {\r\n isoSurf.setColorVolTex(surface.volTexMap, surface.atomMap, surface.atomWeightMap, this._visibilitySelector);\r\n this.setIndex(new THREE.BufferAttribute(isoSurf._indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(isoSurf._position, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(isoSurf._normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(isoSurf._colors, 3));\r\n } else { // geometry should have at least empty position attributes to be processed in wireframe mode by three.js\r\n this.setAttribute('position', new THREE.BufferAttribute(utils.allocateTyped(Float32Array, 0), 3));\r\n }\r\n }\r\n\r\n _calcSurface(params) {\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n\r\n if (packedArrays.posRad.length === 0) {\r\n return;\r\n }\r\n const boundaries = this._findNumVoxels(packedArrays.posRad, params);\r\n\r\n const box = new THREE.Box3(\r\n this.origin,\r\n new THREE.Vector3(this.xAxis.x, this.yAxis.y, this.zAxis.z).add(this.origin),\r\n );\r\n const surface = this._computeSurface(packedArrays, box, boundaries, params);\r\n\r\n this._makeSurface(surface, params);\r\n }\r\n}\r\n\r\nexport default VolumeSurfaceGeometry;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass QuickSurfGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n // beware of shifting this multiple times!\r\n this._shiftByOrigin(packedArrays.posRad);\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3),\r\n };\r\n\r\n if (this._visibilitySelector != null) {\r\n surface.atomMap = [];\r\n surface.atomWeightMap = new Volume(Float32Array, this.numVoxels, box);\r\n }\r\n\r\n this.gaussdensity(surface, packedArrays, null, params);\r\n return surface;\r\n }\r\n\r\n gaussdensity(surface, packedArrays, atomicNum, params) {\r\n const numAtoms = packedArrays.posRad.length / 4;\r\n const { posRad, colors } = packedArrays;\r\n const { numVoxels } = this;\r\n const { radScale, gaussLim, gridSpacing } = params;\r\n const invIsoValue = 1.0 / params.isoValue;\r\n const invGridSpacing = 1.0 / gridSpacing;\r\n const maxVoxelX = numVoxels[0] - 1;\r\n const maxVoxelY = numVoxels[1] - 1;\r\n const maxVoxelZ = numVoxels[2] - 1;\r\n // TODO is densityMap and volTexMap initialized?\r\n\r\n const { volMap, volTexMap } = surface;\r\n const volData = volMap.getData();\r\n const strideX = volMap.getStrideX();\r\n\r\n const volTexData = volTexMap.getData();\r\n const texStrideX = volTexMap.getStrideX();\r\n\r\n let atomWeightData;\r\n if (this._visibilitySelector != null) {\r\n atomWeightData = surface.atomWeightMap.getData();\r\n }\r\n\r\n const { atomMap } = surface;\r\n\r\n for (let i = 0; i < numAtoms; ++i) {\r\n const ind = i * 4;\r\n const scaledRad = posRad[ind + 3] * radScale;\r\n const atomicNumFactor = atomicNum === null ? 1.0 : atomicNum[i];\r\n const radInv = 1 / (2 * scaledRad * scaledRad);\r\n let radLim = gaussLim * scaledRad;\r\n const radLim2 = radLim * radLim;\r\n radLim *= invGridSpacing;\r\n\r\n let tmp = posRad[ind] * invGridSpacing;\r\n const xMin = Math.max((tmp - radLim) | 0, 0);\r\n const xMax = Math.min((tmp + radLim) | 0, maxVoxelX);\r\n tmp = posRad[ind + 1] * invGridSpacing;\r\n const yMin = Math.max((tmp - radLim) | 0, 0);\r\n const yMax = Math.min((tmp + radLim) | 0, maxVoxelY);\r\n tmp = posRad[ind + 2] * invGridSpacing;\r\n const zMin = Math.max((tmp - radLim) | 0, 0);\r\n const zMax = Math.min((tmp + radLim) | 0, maxVoxelZ);\r\n\r\n let dz = zMin * gridSpacing - posRad[ind + 2];\r\n for (let z = zMin; z <= zMax; ++z, dz += gridSpacing) {\r\n let dy = yMin * gridSpacing - posRad[ind + 1];\r\n for (let y = yMin; y <= yMax; ++y, dy += gridSpacing) {\r\n const dy2dz2 = dy * dy + dz * dz;\r\n\r\n if (dy2dz2 >= radLim2) {\r\n continue;\r\n }\r\n\r\n let addr = volMap.getDirectIdx(xMin, y, z);\r\n let texAddr = volTexMap.getDirectIdx(xMin, y, z);\r\n let dx = xMin * gridSpacing - posRad[ind];\r\n for (let x = xMin; x <= xMax; ++x, dx += gridSpacing, addr += strideX, texAddr += texStrideX) {\r\n const r2 = dx * dx + dy2dz2;\r\n const expVal = -r2 * radInv;\r\n\r\n let density = Math.exp(expVal) * atomicNumFactor;\r\n\r\n // store most relevant atom (with highest density)\r\n if (this._visibilitySelector != null\r\n && density > atomWeightData[addr]) { // NOSONAR\r\n atomWeightData[addr] = density;\r\n // we use same index into atom map and atomWeightMap\r\n atomMap[addr] = packedArrays.atoms[i];\r\n }\r\n\r\n volData[addr] += density;\r\n\r\n // TODO check for volTexMap routine?\r\n density *= invIsoValue;\r\n const colInd = i * 3;\r\n volTexData[texAddr] += density * colors[colInd];\r\n volTexData[texAddr + 1] += density * colors[colInd + 1];\r\n volTexData[texAddr + 2] += density * colors[colInd + 2];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n _shiftByOrigin(posRadArray) {\r\n const originX = this.origin.x;\r\n const originY = this.origin.y;\r\n const originZ = this.origin.z;\r\n\r\n const itemSize = 4;\r\n const itemsCount = posRadArray.length / itemSize;\r\n for (let i = 0; i < itemsCount; ++i) {\r\n const ind = i * itemSize;\r\n\r\n posRadArray[ind] -= originX;\r\n posRadArray[ind + 1] -= originY;\r\n posRadArray[ind + 2] -= originZ;\r\n }\r\n }\r\n}\r\n\r\nexport default QuickSurfGeometry;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n/**\r\n * Modifed from SpatialHash\r\n *\r\n * Main differences are:\r\n * - Optimized grid size to ensure we only ever need to look +/-1 cell\r\n * - Aware of atomic radii and will only output atoms within rAtom + rExtra\r\n * (see withinRadii method)\r\n *\r\n * (Uses rounding rather than bitshifting as consequence of arbitrary grid size)\r\n * @class\r\n * @param {Float32Array} posRad - x, y, z coordinates and radiuses\r\n * @param {Float32Array} min - xyz min coordinates\r\n * @param {Float32Array} max - xyz max coordinates\r\n * @param {number} maxDistance - max distance\r\n */\r\nfunction AVHash(posRad, min, max, maxDistance) {\r\n const itemSize = 4;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const minX = min[0];\r\n const minY = min[1];\r\n const minZ = min[2];\r\n\r\n const maxX = max[0];\r\n const maxY = max[1];\r\n const maxZ = max[2];\r\n\r\n function hashFunc(w, minW) {\r\n return Math.floor((w - minW) / maxDistance);\r\n }\r\n\r\n const iDim = hashFunc(maxX, minX) + 1;\r\n const jDim = hashFunc(maxY, minY) + 1;\r\n const kDim = hashFunc(maxZ, minZ) + 1;\r\n\r\n const nCells = iDim * jDim * kDim;\r\n\r\n const jkDim = jDim * kDim;\r\n\r\n /* Get cellID for cartesian x,y,z */\r\n const cellID = function (x, y, z) {\r\n return (((hashFunc(x, minX) * jDim) + hashFunc(y, minY)) * kDim) + hashFunc(z, minZ);\r\n };\r\n\r\n /* Initial building, could probably be optimized further */\r\n const preHash = [];\r\n let i;\r\n let cid;\r\n for (i = 0; i < nAtoms; i++) {\r\n const iIdx = itemSize * i;\r\n cid = cellID(posRad[iIdx], posRad[iIdx + 1], posRad[iIdx + 2]);\r\n\r\n if (preHash[cid] === undefined) {\r\n preHash[cid] = [i];\r\n } else {\r\n preHash[cid].push(i);\r\n }\r\n }\r\n\r\n const cellOffsets = utils.allocateTyped(Uint32Array, nCells);\r\n const cellLengths = utils.allocateTyped(Uint16Array, nCells);\r\n const data = utils.allocateTyped(Uint32Array, nAtoms);\r\n\r\n let offset = 0;\r\n let maxCellLength = 0;\r\n let j;\r\n for (i = 0; i < nCells; i++) {\r\n const start = cellOffsets[i] = offset;\r\n\r\n const subArray = preHash[i];\r\n\r\n if (subArray !== undefined) {\r\n for (j = 0; j < subArray.length; j++) {\r\n data[offset] = subArray[j];\r\n offset++;\r\n }\r\n }\r\n\r\n const cellLength = offset - start;\r\n cellLengths[i] = cellLength;\r\n\r\n if (cellLength > maxCellLength) {\r\n maxCellLength = cellLength;\r\n }\r\n }\r\n\r\n // Maximum number of neighbours we could ever produce (27 adjacent cells of equal population)\r\n this.neighbourListLength = (27 * maxCellLength) + 1;\r\n\r\n /**\r\n * Populate the supplied out array with atom indices that are within rAtom + rExtra\r\n * of x,y,z\r\n *\r\n * -1 in out array indicates the end of the list\r\n *\r\n * @param {number} x - x coordinate\r\n * @param {number} y - y coordinate\r\n * @param {number} z - z coordinate\r\n * @param {number} rExtra - additional radius\r\n * @param {Float32Array} out - pre-allocated output array\r\n * @return {undefined}\r\n */\r\n this.withinRadii = function (x, y, z, rExtra, out) {\r\n let outIdx = 0;\r\n\r\n const nearI = hashFunc(x, minX);\r\n const nearJ = hashFunc(y, minY);\r\n const nearK = hashFunc(z, minZ);\r\n\r\n const loI = Math.max(0, nearI - 1);\r\n const loJ = Math.max(0, nearJ - 1);\r\n const loK = Math.max(0, nearK - 1);\r\n\r\n const hiI = Math.min(iDim - 1, nearI + 1);\r\n const hiJ = Math.min(jDim - 1, nearJ + 1);\r\n const hiK = Math.min(kDim - 1, nearK + 1);\r\n\r\n for (i = loI; i <= hiI; ++i) {\r\n const iOffset = i * jkDim;\r\n\r\n for (j = loJ; j <= hiJ; ++j) {\r\n const jOffset = j * kDim;\r\n\r\n for (let k = loK; k <= hiK; ++k) {\r\n cid = iOffset + jOffset + k;\r\n\r\n const cellStart = cellOffsets[cid];\r\n const cellEnd = cellStart + cellLengths[cid];\r\n\r\n for (let dataIndex = cellStart; dataIndex < cellEnd; dataIndex++) {\r\n const atomIndex = data[dataIndex];\r\n const baseIndex = itemSize * atomIndex;\r\n const dx = posRad[baseIndex] - x;\r\n const dy = posRad[baseIndex + 1] - y;\r\n const dz = posRad[baseIndex + 2] - z;\r\n const rSum = posRad[baseIndex + 3] + rExtra;\r\n\r\n if ((dx * dx + dy * dy + dz * dz) <= (rSum * rSum)) {\r\n out[outIdx++] = data[dataIndex];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Add terminator\r\n out[outIdx] = -1;\r\n };\r\n}\r\nfunction ContactSurface(packedArrays, boundaries, params, _indexList) {\r\n // Field generation method adapted from AstexViewer (Mike Hartshorn)\r\n // by Fred Ludlow.\r\n // Other parts based heavily on NGL (Alexander Rose) EDT Surface class\r\n //\r\n // Should work as a drop-in alternative to EDTSurface (though some of\r\n // the EDT paramters are not relevant in this method).\r\n\r\n const itemSize = 4;\r\n const { posRad, colors, atoms } = packedArrays;\r\n const nAtoms = posRad.length / itemSize;\r\n\r\n const { bbox } = boundaries;\r\n\r\n const min = bbox.minPosRad;\r\n const max = bbox.maxPosRad;\r\n\r\n let r2; // Atom positions, expanded radii (squared)\r\n let maxRadius;\r\n\r\n // Parameters\r\n let probeRadius;\r\n let scaleFactor;\r\n let probePositions;\r\n\r\n // Cache last value for obscured test\r\n let lastClip = -1;\r\n\r\n // Grid params\r\n let dim;\r\n let grid;\r\n let volTex;\r\n let weights;\r\n let weightsMap = null;\r\n let atomMap = null;\r\n let visibilitySelector = null;\r\n\r\n // grid indices -> xyz coords\r\n let gridx;\r\n let gridy;\r\n let gridz;\r\n\r\n // Lookup tables:\r\n let sinTable;\r\n let cosTable;\r\n\r\n // Spatial Hash\r\n let hash;\r\n\r\n // Neighbour array to be filled by hash\r\n let neighbours;\r\n\r\n // Vectors for Torus Projection\r\n const mid = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n1 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n const n2 = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n let ngTorus;\r\n\r\n function uniformArray(TypeName, n, a) {\r\n const array = utils.allocateTyped(TypeName, n);\r\n for (let innI = 0; innI < n; ++innI) {\r\n array[innI] = a;\r\n }\r\n\r\n return array;\r\n }\r\n\r\n function fillGridDim(a, start, step) {\r\n for (let innI = 0; innI < a.length; innI++) {\r\n a[innI] = start + (step * innI);\r\n }\r\n }\r\n\r\n function initializeGrid() {\r\n ({ scaleFactor } = params);\r\n ({ dim } = boundaries);\r\n\r\n ngTorus = Math.min(5, 2 + Math.floor(probeRadius * scaleFactor));\r\n\r\n const gridSize = dim[0] * dim[1] * dim[2];\r\n grid = uniformArray(Float32Array, gridSize, -1001.0);\r\n volTex = utils.allocateTyped(Float32Array, gridSize * 3);\r\n weights = utils.allocateTyped(Float32Array, gridSize);\r\n if (visibilitySelector) {\r\n weightsMap = utils.allocateTyped(Float32Array, gridSize);\r\n atomMap = [];\r\n }\r\n\r\n gridx = utils.allocateTyped(Float32Array, dim[0]);\r\n gridy = utils.allocateTyped(Float32Array, dim[1]);\r\n gridz = utils.allocateTyped(Float32Array, dim[2]);\r\n\r\n fillGridDim(gridx, min[0], 1 / scaleFactor);\r\n fillGridDim(gridy, min[1], 1 / scaleFactor);\r\n fillGridDim(gridz, min[2], 1 / scaleFactor);\r\n }\r\n\r\n function initializeAngleTables() {\r\n let theta = 0.0;\r\n const step = 2 * Math.PI / probePositions;\r\n\r\n cosTable = utils.allocateTyped(Float32Array, probePositions);\r\n sinTable = utils.allocateTyped(Float32Array, probePositions);\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n cosTable[innI] = Math.cos(theta);\r\n sinTable[innI] = Math.sin(theta);\r\n theta += step;\r\n }\r\n }\r\n\r\n function initializeHash() {\r\n hash = new AVHash(posRad, min, max, 2.01 * maxRadius);\r\n neighbours = new Int32Array(hash.neighbourListLength);\r\n }\r\n\r\n function init() {\r\n ({\r\n probeRadius,\r\n scaleFactor,\r\n probePositions,\r\n visibilitySelector,\r\n } = params);\r\n r2 = utils.allocateTyped(Float32Array, nAtoms);\r\n maxRadius = 0;\r\n for (let innI = 0; innI < nAtoms; ++innI) {\r\n const rExt = posRad[innI * itemSize + 3] += probeRadius;\r\n if (rExt > maxRadius) {\r\n maxRadius = rExt;\r\n }\r\n r2[innI] = rExt * rExt;\r\n }\r\n\r\n initializeGrid();\r\n initializeAngleTables();\r\n initializeHash();\r\n\r\n lastClip = -1;\r\n }\r\n\r\n function singleAtomObscures(ai, innX, innY, innZ) {\r\n const innCI = itemSize * ai;\r\n const ra2 = r2[ai];\r\n const dx = posRad[innCI] - innX;\r\n const dy = posRad[innCI + 1] - innY;\r\n const dz = posRad[innCI + 2] - innZ;\r\n const d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n return d2 < ra2;\r\n }\r\n\r\n function obscured(innX, innY, innZ, a, b) {\r\n // Is the point at x,y,z obscured by any of the atoms\r\n // specifeid by indices in neighbours. Ignore indices\r\n // a and b (these are the relevant atoms in projectPoints/Torii)\r\n\r\n // Cache the last clipped atom (as very often the same one in\r\n // subsequent calls)\r\n let ai;\r\n\r\n if (lastClip !== -1) {\r\n ai = lastClip;\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n return ai;\r\n }\r\n lastClip = -1;\r\n }\r\n\r\n let ni = 0;\r\n ai = neighbours[ni];\r\n while (ai >= 0) {\r\n if (ai !== a && ai !== b && singleAtomObscures(ai, innX, innY, innZ)) {\r\n lastClip = ai;\r\n return ai;\r\n }\r\n ai = neighbours[++ni];\r\n }\r\n\r\n lastClip = -1;\r\n\r\n return -1;\r\n }\r\n\r\n function projectPoints() {\r\n // For each atom:\r\n // Iterate over a subsection of the grid, for each point:\r\n // If current value < 0.0, unvisited, set positive\r\n //\r\n // In any case: Project this point onto surface of the atomic sphere\r\n // If this projected point is not obscured by any other atom\r\n // Calcualte delta distance and set grid value to minimum of\r\n // itself and delta\r\n\r\n // Should we alias frequently accessed closure constiables??\r\n // Assume JS engine capable of optimizing this\r\n // anyway...\r\n const maxRad = 4.0;\r\n const sigma = (maxRad) / 3;\r\n const sigma2Inv = 1 / (2 * sigma * sigma);\r\n\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innCI = itemSize * innI;\r\n const ax = posRad[innCI];\r\n const ay = posRad[innCI + 1];\r\n const az = posRad[innCI + 2];\r\n const ar = posRad[innCI + 3];\r\n const ar2 = r2[innI];\r\n\r\n hash.withinRadii(ax, ay, az, ar, neighbours);\r\n\r\n // Number of grid points, round this up...\r\n const ng = Math.ceil(ar * scaleFactor);\r\n\r\n // Center of the atom, mapped to grid points (take floor)\r\n const iax = Math.floor(scaleFactor * (ax - min[0]));\r\n const iay = Math.floor(scaleFactor * (ay - min[1]));\r\n const iaz = Math.floor(scaleFactor * (az - min[2]));\r\n\r\n // Extents of grid to consider for this atom\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n // Add two to these points:\r\n // - iax are floor'd values so this ensures coverage\r\n // - these are loop limits (exclusive)\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n const colIdx = innI * 3;\r\n const cr = colors[colIdx];\r\n const cg = colors[colIdx + 1];\r\n const cb = colors[colIdx + 2];\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n const dz = gridz[iz] - az;\r\n const zOffset = dim[1] * dim[0] * iz;\r\n\r\n for (let iy = miny; iy < maxy; iy++) {\r\n const dy = gridy[iy] - ay;\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n\r\n for (let ix = minx; ix < maxx; ix++) {\r\n const idx = ix + zyOffset;\r\n const dx = gridx[ix] - ax;\r\n const d2 = dzy2 + dx * dx;\r\n\r\n if (d2 < ar2) {\r\n const w = Math.exp(-d2 * sigma2Inv);\r\n const cIdx = idx * 3;\r\n volTex[cIdx] += cr * w;\r\n volTex[cIdx + 1] += cg * w;\r\n volTex[cIdx + 2] += cb * w;\r\n weights[idx] += w;\r\n if (visibilitySelector !== null && w > weightsMap[idx]) {\r\n weightsMap[idx] = w;\r\n atomMap[idx] = atoms[innI];\r\n }\r\n\r\n if (grid[idx] < 0.0) {\r\n // Unvisited, make positive\r\n grid[idx] = -grid[idx];\r\n }\r\n // Project on to the surface of the sphere\r\n // sp is the projected point ( dx, dy, dz ) * ( ra / d )\r\n const d = Math.sqrt(d2);\r\n const ap = ar / d;\r\n let spx = dx * ap;\r\n let spy = dy * ap;\r\n let spz = dz * ap;\r\n\r\n spx += ax;\r\n spy += ay;\r\n spz += az;\r\n\r\n if (obscured(spx, spy, spz, innI, -1) === -1) {\r\n const dd = ar - d;\r\n if (dd < grid[idx]) {\r\n grid[idx] = dd;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function normalToLine(out, p) {\r\n out.x = out.y = out.z = 1.0;\r\n if (p.x !== 0) {\r\n out.x = (p.y + p.z) / -p.x;\r\n } else if (p.y !== 0) {\r\n out.y = (p.x + p.z) / -p.y;\r\n } else if (p.z !== 0) {\r\n out.z = (p.x + p.y) / -p.z;\r\n }\r\n return out;\r\n }\r\n\r\n function projectTorus(a, b) {\r\n const aIdx = itemSize * a;\r\n const bIdx = itemSize * b;\r\n const xa = posRad[aIdx];\r\n const ya = posRad[aIdx + 1];\r\n const za = posRad[aIdx + 2];\r\n const r1 = posRad[aIdx + 3];\r\n let dx = mid.x = posRad[bIdx] - xa;\r\n let dy = mid.y = posRad[bIdx + 1] - ya;\r\n let dz = mid.z = posRad[bIdx + 2] - za;\r\n const innR2 = posRad[bIdx + 3];\r\n let d2 = dx * dx + dy * dy + dz * dz;\r\n\r\n // This check now redundant as already done in AVHash.withinRadii\r\n // if( d2 > (( r1 + r2 ) * ( r1 + r2 )) ){ return; }\r\n\r\n const d = Math.sqrt(d2);\r\n\r\n // Find angle between a->b vector and the circle\r\n // of their intersection by cosine rule\r\n const cosA = (r1 * r1 + d * d - innR2 * innR2) / (2.0 * r1 * d);\r\n\r\n // distance along a->b at intersection\r\n const dmp = r1 * cosA;\r\n\r\n mid.normalize();\r\n\r\n // Create normal to line\r\n normalToLine(n1, mid);\r\n n1.normalize();\r\n\r\n // Cross together for second normal vector\r\n n2.crossVectors(mid, n1);\r\n n2.normalize();\r\n\r\n // r is radius of circle of intersection\r\n const rInt = Math.sqrt(r1 * r1 - dmp * dmp);\r\n\r\n n1.multiplyScalar(rInt);\r\n n2.multiplyScalar(rInt);\r\n mid.multiplyScalar(dmp);\r\n\r\n mid.x += xa;\r\n mid.y += ya;\r\n mid.z += za;\r\n\r\n lastClip = -1;\r\n\r\n const ng = ngTorus;\r\n\r\n for (let innI = 0; innI < probePositions; innI++) {\r\n const cost = cosTable[innI];\r\n const sint = sinTable[innI];\r\n\r\n const px = mid.x + cost * n1.x + sint * n2.x;\r\n const py = mid.y + cost * n1.y + sint * n2.y;\r\n const pz = mid.z + cost * n1.z + sint * n2.z;\r\n\r\n if (obscured(px, py, pz, a, b) === -1) {\r\n // As above, iterate over our grid...\r\n // px, py, pz in grid coords\r\n const iax = Math.floor(scaleFactor * (px - min[0]));\r\n const iay = Math.floor(scaleFactor * (py - min[1]));\r\n const iaz = Math.floor(scaleFactor * (pz - min[2]));\r\n\r\n const minx = Math.max(0, iax - ng);\r\n const miny = Math.max(0, iay - ng);\r\n const minz = Math.max(0, iaz - ng);\r\n\r\n const maxx = Math.min(dim[0], iax + ng + 2);\r\n const maxy = Math.min(dim[1], iay + ng + 2);\r\n const maxz = Math.min(dim[2], iaz + ng + 2);\r\n\r\n for (let iz = minz; iz < maxz; iz++) {\r\n dz = pz - gridz[iz];\r\n const zOffset = dim[1] * dim[0] * iz;\r\n for (let iy = miny; iy < maxy; iy++) {\r\n dy = py - gridy[iy];\r\n const dzy2 = dz * dz + dy * dy;\r\n const zyOffset = zOffset + dim[0] * iy;\r\n for (let ix = minx; ix < maxx; ix++) {\r\n dx = px - gridx[ix];\r\n d2 = dzy2 + dx * dx;\r\n const idx = ix + zyOffset;\r\n const current = grid[idx];\r\n\r\n if (current > 0.0 && d2 < (current * current)) {\r\n grid[idx] = Math.sqrt(d2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function projectTorii() {\r\n for (let innI = 0; innI < nAtoms; innI++) {\r\n const innIdx = itemSize * innI;\r\n hash.withinRadii(\r\n posRad[innIdx],\r\n posRad[innIdx + 1],\r\n posRad[innIdx + 2],\r\n posRad[innIdx + 3],\r\n neighbours,\r\n );\r\n let ia = 0;\r\n let ni = neighbours[ia];\r\n while (ni >= 0) {\r\n if (innI < ni) {\r\n projectTorus(innI, ni);\r\n }\r\n ni = neighbours[++ia];\r\n }\r\n }\r\n }\r\n\r\n function fixNegatives() {\r\n for (let innI = 0, n = grid.length; innI < n; innI++) {\r\n if (grid[innI] < 0) grid[innI] = 0;\r\n let w = weights[innI];\r\n if (w > 0) {\r\n w = 1 / w;\r\n const innInnI = innI * 3;\r\n volTex[innInnI] *= w;\r\n volTex[innInnI + 1] *= w;\r\n volTex[innInnI + 2] *= w;\r\n }\r\n }\r\n }\r\n\r\n function getVolume() {\r\n // Basic steps are:\r\n // 1) Initialize\r\n // 2) Project points\r\n // 3) Project torii\r\n console.time('ContactSurface.getVolume');\r\n\r\n console.time('ContactSurface.init');\r\n init();\r\n console.timeEnd('ContactSurface.init');\r\n\r\n console.time('ContactSurface.projectPoints');\r\n projectPoints();\r\n console.timeEnd('ContactSurface.projectPoints');\r\n\r\n console.time('ContactSurface.projectTorii');\r\n projectTorii();\r\n console.timeEnd('ContactSurface.projectTorii');\r\n fixNegatives();\r\n console.timeEnd('ContactSurface.getVolume');\r\n }\r\n\r\n this.build = function () {\r\n // type and cutoff left in for compatibility with EDTSurface.getSurface\r\n // function signature\r\n getVolume();\r\n this.volTexMap = volTex;\r\n this.weightsMap = weightsMap;\r\n this.atomMap = atomMap;\r\n this.volMap = grid;\r\n };\r\n}\r\nexport default ContactSurface;\r\n","import VolumeSurfaceGeometry from './VolumeSurfaceGeometry';\r\nimport ContactSurface from './ContactSurface';\r\nimport chem from '../../chem';\r\n\r\nconst { Volume } = chem;\r\n\r\n/**\r\n * This class implements 'contact' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass ContactSurfaceGeometry extends VolumeSurfaceGeometry {\r\n _computeSurface(packedArrays, box, boundaries, params) {\r\n const contactSurface = new ContactSurface(packedArrays, boundaries, params);\r\n contactSurface.build();\r\n\r\n const surface = {\r\n volMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.volMap),\r\n volTexMap: new Volume(Float32Array, this.numVoxels, box, 3, contactSurface.volTexMap),\r\n atomMap: contactSurface.atomMap,\r\n atomWeightMap: new Volume(Float32Array, this.numVoxels, box, 1, contactSurface.weightsMap),\r\n };\r\n return surface;\r\n }\r\n}\r\n\r\nexport default ContactSurfaceGeometry;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for colored atom. Need for atom structure clusterization\r\n *\r\n * @param {Vector3} vCenter Center of atom\r\n * @param {number} radiusAt Radius of atom\r\n */\r\nclass IsoSurfaceAtomColored {\r\n constructor(vCenter, radiusAt) {\r\n this.coord = new THREE.Vector3();\r\n this.coord.copy(vCenter);\r\n this.radius = radiusAt;\r\n this.colorX = 0.99999;\r\n this.colorY = 0.0;\r\n this.colorZ = 0.0;\r\n this.atomType = 0;\r\n this.srcAtom = null;\r\n }\r\n}\r\nexport default IsoSurfaceAtomColored;\r\n","import * as THREE from 'three';\r\nimport utils from '../../utils';\r\n\r\n// suppress some JSHint warnings\r\n/* jshint bitwise: false */\r\n\r\n/**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numAtoms - Number of atoms in molecule\r\n * @param {Element} atoms - Array of atoms\r\n * @param {Vector3} vBoxMin - Bounding box min\r\n * @param {Vector3} vBoxMax - Bounding box max\r\n * @param {number} probeRadius - Normals for output\r\n *\r\n */\r\nclass IsosurfaceBuildNormals {\r\n constructor(numAtoms, atoms, vBoxMin, vBoxMax, probeRadius) {\r\n this._numAtoms = numAtoms;\r\n this._atoms = atoms;\r\n this._vBoxMin = new THREE.Vector3();\r\n this._vBoxMax = new THREE.Vector3();\r\n this._vBoxMin.copy(vBoxMin);\r\n this._vBoxMax.copy(vBoxMax);\r\n this._probeRadius = probeRadius;\r\n\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n }\r\n\r\n createVoxels() {\r\n let numAtomsRefs;\r\n let rad;\r\n const ATOM_VOXEL_REF_SCALE = 4.5;\r\n\r\n const numAtoms = this._numAtoms | 0;\r\n const atoms = this._atoms;\r\n const dx = this._vBoxMax.x - this._vBoxMin.x;\r\n const dy = this._vBoxMax.y - this._vBoxMin.y;\r\n const dz = this._vBoxMax.z - this._vBoxMin.z;\r\n let w = (dx < dy) ? dx : dy;\r\n w = (dz < w) ? dz : w;\r\n let maxRad = 0.0;\r\n let aveRad = 0.0;\r\n\r\n let i;\r\n for (i = 0; i < numAtoms; i++) {\r\n rad = (atoms[i].radius + this._probeRadius) * 2.0;\r\n maxRad = (rad > maxRad) ? rad : maxRad;\r\n aveRad += rad;\r\n }\r\n let numCells = Math.floor(w / maxRad);\r\n if (numCells < 2) {\r\n numCells = 2;\r\n }\r\n aveRad /= numAtoms;\r\n\r\n this._numCells = numCells;\r\n this._aveRad = aveRad;\r\n this._maxRad = maxRad;\r\n\r\n const side = numCells;\r\n const side2 = numCells * numCells;\r\n const side3 = numCells * numCells * numCells;\r\n\r\n const xScale = this._xScale = 1.0 / (this._vBoxMax.x - this._vBoxMin.x);\r\n const yScale = this._yScale = 1.0 / (this._vBoxMax.y - this._vBoxMin.y);\r\n const zScale = this._zScale = 1.0 / (this._vBoxMax.z - this._vBoxMin.z);\r\n\r\n // estimate number of individual atom refs in each voxel list\r\n let maxAtomsRefs = 0;\r\n\r\n const xNumVoxMult = xScale * numCells;\r\n const yNumVoxMult = yScale * numCells;\r\n const zNumVoxMult = zScale * numCells;\r\n\r\n for (i = 0; i < numAtoms; i++) {\r\n const radAffect = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n const diaAffect = radAffect * 2.0;\r\n let numVoxX = Math.floor(xNumVoxMult * diaAffect + 0.8);\r\n let numVoxY = Math.floor(yNumVoxMult * diaAffect + 0.8);\r\n let numVoxZ = Math.floor(zNumVoxMult * diaAffect + 0.8);\r\n // avoid case numVox? == 0\r\n // also use loop i <=\r\n numVoxX++;\r\n numVoxY++;\r\n numVoxZ++;\r\n maxAtomsRefs += numVoxX * numVoxY * numVoxZ;\r\n } // for (i)\r\n // maxAtomsRefs = numAtoms * MAX_ATOMS_IN_SINGLE_VOXEL;\r\n\r\n this._voxelList = utils.allocateTyped(Int32Array, side3);\r\n const atomsList = [];\r\n atomsList.length = maxAtomsRefs;\r\n if ((this._voxelList === null) || (atomsList === null)) {\r\n return 0 - 1;\r\n }\r\n // init voxel list\r\n for (i = 0; i < side3; i++) {\r\n this._voxelList[i] = -1;\r\n }\r\n numAtomsRefs = 0;\r\n\r\n // create voxel lists\r\n for (i = 0; i < numAtoms; i++) {\r\n // use multiplier 4 to locate this atom in different voxels\r\n rad = (atoms[i].radius + this._probeRadius) * ATOM_VOXEL_REF_SCALE;\r\n let xIndMin = Math.floor((atoms[i].coord.x - this._vBoxMin.x - rad) * numCells * xScale);\r\n let yIndMin = Math.floor((atoms[i].coord.y - this._vBoxMin.y - rad) * numCells * yScale);\r\n let zIndMin = Math.floor((atoms[i].coord.z - this._vBoxMin.z - rad) * numCells * zScale);\r\n let xIndMax = Math.floor((atoms[i].coord.x - this._vBoxMin.x + rad) * numCells * xScale);\r\n let yIndMax = Math.floor((atoms[i].coord.y - this._vBoxMin.y + rad) * numCells * yScale);\r\n let zIndMax = Math.floor((atoms[i].coord.z - this._vBoxMin.z + rad) * numCells * zScale);\r\n\r\n xIndMin = (xIndMin >= 0) ? xIndMin : 0;\r\n yIndMin = (yIndMin >= 0) ? yIndMin : 0;\r\n zIndMin = (zIndMin >= 0) ? zIndMin : 0;\r\n\r\n xIndMax = (xIndMax < numCells) ? xIndMax : (numCells - 1);\r\n yIndMax = (yIndMax < numCells) ? yIndMax : (numCells - 1);\r\n zIndMax = (zIndMax < numCells) ? zIndMax : (numCells - 1);\r\n\r\n for (let z = zIndMin; z <= zIndMax; z++) {\r\n for (let y = yIndMin; y <= yIndMax; y++) {\r\n for (let x = xIndMin; x <= xIndMax; x++) {\r\n // add atom with index \"i\" to this voxel list\r\n const indVoxel = x + y * side + z * side2;\r\n // assert indVoxel >= 0\r\n // assert indVoxel < side3\r\n\r\n // add first\r\n if (this._voxelList[indVoxel] < 0) {\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = 0 - 1;\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n numAtomsRefs++;\r\n // assert numAtomsRefs < maxAtomsRefs - 1\r\n continue;\r\n }\r\n // insert into head of list\r\n const indexNext = this._voxelList[indVoxel];\r\n this._voxelList[indVoxel] = numAtomsRefs;\r\n atomsList[numAtomsRefs * 2 + 0] = i;\r\n atomsList[numAtomsRefs * 2 + 1] = indexNext;\r\n numAtomsRefs++;\r\n } // for (x)\r\n } // for (y)\r\n } // for (z)\r\n } // for (i)\r\n\r\n // convert Array to Int32Array\r\n this._atomsList = Int32Array.from(atomsList);\r\n\r\n return 0;\r\n }\r\n\r\n destroyVoxels() {\r\n this._atomsList = null;\r\n this._voxelList = null;\r\n\r\n this._atoms = null;\r\n this._vertices = null;\r\n this._vBoxMin = null;\r\n this._vBoxMax = null;\r\n }\r\n\r\n /**\r\n * Enumerate all atoms affecting specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n * @param {func(atom)} process - function to call for each atom\r\n */\r\n forEachRelatedAtom(point, process) {\r\n // find corresponding voxel\r\n const xInd = Math.floor((point.x - this._vBoxMin.x) * this._numCells * this._xScale);\r\n const yInd = Math.floor((point.y - this._vBoxMin.y) * this._numCells * this._yScale);\r\n const zInd = Math.floor((point.z - this._vBoxMin.z) * this._numCells * this._zScale);\r\n const indVoxel = xInd + yInd * this._numCells + zInd * this._numCells * this._numCells;\r\n\r\n // run through atoms affecting this voxel\r\n const atoms = this._atoms;\r\n for (let ref = this._voxelList[indVoxel]; ref >= 0; ref = this._atomsList[ref * 2 + 1]) {\r\n const indexAtom = this._atomsList[ref * 2];\r\n process(atoms[indexAtom]);\r\n }\r\n }\r\n\r\n /**\r\n * Get atom closest to specified point\r\n *\r\n * @param {Vector3} point - point in 3D\r\n *\r\n * @returns {IsoSurfaceAtomColored} atom, or null if not found\r\n */\r\n getClosestAtom(point) {\r\n let closest = null;\r\n let minDist2 = Number.MAX_VALUE;\r\n\r\n this.forEachRelatedAtom(point, (atom) => {\r\n const dist2 = point.distanceToSquared(atom.coord);\r\n if (dist2 < minDist2) {\r\n minDist2 = dist2;\r\n closest = atom;\r\n }\r\n });\r\n\r\n return closest;\r\n }\r\n\r\n /**\r\n * Build normals for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} normals - Normals for output\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildNormals(numVertices, vertices, normals) {\r\n const self = this;\r\n let numCloseAtoms = 0;\r\n let vx = 0;\r\n let vy = 0;\r\n let vz = 0;\r\n let dist2;\r\n let vNormalX = 0;\r\n let vNormalY = 0;\r\n let vNormalZ = 0;\r\n let koef = 0;\r\n let w = 0;\r\n const r25 = 2.5;\r\n const r01 = 0.1;\r\n\r\n const maxRadAffect = this._aveRad * r25;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n const expScale = -this._aveRad * r01;\r\n\r\n // some stats\r\n // numSlowAtoms = 0;\r\n\r\n const gatherNormals = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = Math.exp(expScale * koef);\r\n\r\n vNormalX += dx * w;\r\n vNormalY += dy * w;\r\n vNormalZ += dz * w;\r\n numCloseAtoms++;\r\n };\r\n\r\n let maxClosedAtoms = 0;\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n numCloseAtoms = 0;\r\n vNormalX = vNormalY = vNormalZ = 0.0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherNormals);\r\n\r\n maxClosedAtoms = (numCloseAtoms > maxClosedAtoms) ? numCloseAtoms : maxClosedAtoms;\r\n\r\n // normalize vNormal\r\n dist2 = vNormalX * vNormalX + vNormalY * vNormalY + vNormalZ * vNormalZ;\r\n if (numCloseAtoms > 0) {\r\n koef = 1.0 / Math.sqrt(dist2);\r\n vNormalX *= koef;\r\n vNormalY *= koef;\r\n vNormalZ *= koef;\r\n }\r\n normals[i].x = vNormalX;\r\n normals[i].y = vNormalY;\r\n normals[i].z = vNormalZ;\r\n } // for (i) all vertices\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Build vertex colors for isosurface, using atoms information\r\n *\r\n * @param {number} numVertices - Number of vertices in final geometry (to render)\r\n * @param {Vector3} vertices - Geometry vertices (3d coordinates array)\r\n * @param {Vector3} colors - Colors for output\r\n * @param {number} radiusColorSmoothness - Radius of smoothness sphere\r\n *\r\n * @returns {number} 0, if success\r\n */\r\n buildColors(numVertices, vertices, colors, radiusColorSmoothness) {\r\n const self = this;\r\n let vx = 0.0;\r\n let vy = 0.0;\r\n let vz = 0.0;\r\n let koef = 0.0;\r\n let w = 0.0;\r\n const KOEF_ADD = 0.8;\r\n\r\n const maxRadAffect = radiusColorSmoothness;\r\n const maxRadAffect2 = maxRadAffect * maxRadAffect;\r\n\r\n let colorsClose = [];\r\n let weights = [];\r\n let weightsSum = 0;\r\n\r\n const gatherColors = function (atom) {\r\n const dx = vx - atom.coord.x;\r\n const dy = vy - atom.coord.y;\r\n const dz = vz - atom.coord.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 > maxRadAffect2) {\r\n return;\r\n }\r\n\r\n // get weight for gaussian smoothing\r\n const rad = atom.radius + self._probeRadius;\r\n koef = dist2 - (rad * rad);\r\n if (koef < 0.0) {\r\n koef = -koef;\r\n }\r\n w = 1.0 / (KOEF_ADD + koef);\r\n\r\n colorsClose.push([atom.colorX, atom.colorY, atom.colorZ]);\r\n weights.push(w); // save weights for use\r\n weightsSum += w; // calc sum of weights fo further normalization\r\n };\r\n\r\n // process all vertices, one by one\r\n for (let i = 0; i < numVertices; i++) {\r\n vx = vertices[i].x;\r\n vy = vertices[i].y;\r\n vz = vertices[i].z;\r\n\r\n colorsClose = [];\r\n weights = [];\r\n weightsSum = 0;\r\n\r\n this.forEachRelatedAtom(vertices[i], gatherColors);\r\n\r\n // normalized weighted sum of colors\r\n for (let j = 0; j < colorsClose.length; ++j) {\r\n const weightNormalized = weights[j] / weightsSum;\r\n colors[i].x += colorsClose[j][0] * weightNormalized;\r\n colors[i].y += colorsClose[j][1] * weightNormalized;\r\n colors[i].z += colorsClose[j][2] * weightNormalized;\r\n }\r\n } // for (i) all vertices\r\n return 0;\r\n }\r\n}\r\nexport default IsosurfaceBuildNormals;\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Class for geometry (triangle mesh) representation\r\n *\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices in mesh\r\n * @param {number} maxNumTriangles Maximum possible number of triangles in mesh\r\n * @param {boolean} needVertexColors Obvious\r\n */\r\nclass IsoSurfaceGeo {\r\n constructor(maxNumVertices, maxNumTriangles, needVertexColors) {\r\n this._maxNumVertices = maxNumVertices;\r\n this._maxNumTriangles = maxNumTriangles;\r\n this._vertices = new Array(maxNumVertices);\r\n this._normals = new Array(maxNumVertices);\r\n this._colors = null;\r\n if (needVertexColors) {\r\n this._colors = new Array(maxNumVertices);\r\n }\r\n this._indices = new Array(maxNumTriangles * (1 + 2));\r\n this._numVertices = 0;\r\n this._numTriangles = 0;\r\n\r\n let i;\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._vertices[i] = new THREE.Vector3();\r\n this._normals[i] = new THREE.Vector3();\r\n }\r\n for (i = 0; i < maxNumTriangles * (1 + 2); i++) {\r\n this._indices[i] = -1;\r\n }\r\n if (needVertexColors) {\r\n for (i = 0; i < maxNumVertices; i++) {\r\n this._colors[i] = new THREE.Vector3();\r\n }\r\n }\r\n }\r\n\r\n destroy() {\r\n this._vertices = null;\r\n this._normals = null;\r\n this._indices = null;\r\n }\r\n}\r\nexport default IsoSurfaceGeo;\r\n","import * as THREE from 'three';\r\nimport IsoSurfaceGeometry from './IsoSurfaceGeometry';\r\nimport IsoSurfaceAtomColored from './IsoSurfaceAtomColored';\r\nimport IsosurfaceBuildNormals from './IsosurfaceBuildNormals';\r\nimport IsoSurfaceMarchCube from './IsoSurfaceMarchCube';\r\nimport IsoSurfaceGeo from './IsoSurfaceGeo';\r\nimport chem from '../../chem';\r\nimport utils from '../../utils';\r\n\r\nconst COLOR_SIZE = 3;\r\nconst HASH_SIZE = 32768;\r\nconst { Element } = chem;\r\n\r\n/**\r\n * This class implements 'quick' isosurface geometry generation algorithm.\r\n * @param spheresCount - number of atoms/spheres\r\n * @param opts - geometry specific options\r\n * @constructor\r\n */\r\n\r\nclass SSIsosurfaceGeometry extends IsoSurfaceGeometry {\r\n _build() {\r\n // convert geoOut into arrays of positions, indices, normals\r\n this._innerBuild();\r\n const geoOut = this.getGeo();\r\n this.destroy();\r\n this._fromGeo(geoOut);\r\n }\r\n\r\n _fromGeo(geoOut) {\r\n let colors = null;\r\n const positions = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n const normals = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n if (geoOut._colors !== null) {\r\n colors = utils.allocateTyped(Float32Array, (1 + 2) * geoOut._numVertices);\r\n }\r\n const indices = utils.allocateTyped(Uint32Array, (1 + 2) * geoOut._numTriangles);\r\n\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++) {\r\n positions[j + 0] = (geoOut._vertices[i].x);\r\n positions[j + 1] = (geoOut._vertices[i].y);\r\n positions[j + 2] = (geoOut._vertices[i].z);\r\n normals[j + 0] = geoOut._normals[i].x;\r\n normals[j + 1] = geoOut._normals[i].y;\r\n normals[j + 2] = geoOut._normals[i].z;\r\n j += 3;\r\n }\r\n if (colors !== null) {\r\n for (let i = 0, j = 0; i < geoOut._numVertices; i++, j += 3) {\r\n colors[j + 0] = geoOut._colors[i].x;\r\n colors[j + 1] = geoOut._colors[i].y;\r\n colors[j + 2] = geoOut._colors[i].z;\r\n }\r\n }\r\n\r\n const numTri3 = geoOut._numTriangles * (1 + 2);\r\n for (let i = 0; i < numTri3; i++) {\r\n indices[i] = geoOut._indices[i];\r\n }\r\n\r\n this.setIndex(new THREE.BufferAttribute(indices, 1));\r\n this.setAttribute('position', new THREE.BufferAttribute(positions, 3));\r\n this.setAttribute('normal', new THREE.BufferAttribute(normals, 3));\r\n this.setAttribute('color', new THREE.BufferAttribute(colors, 3));\r\n this.computeBoundingBox();\r\n this.computeBoundingSphere();\r\n\r\n geoOut.destroy();\r\n }\r\n\r\n convertToAtomsColored(packedArrays, atomsColored) {\r\n const { atoms, colors } = packedArrays;\r\n for (let i = 0, numAtoms = atoms.length; i < numAtoms; i++) {\r\n const vCenter = atoms[i].position;\r\n const { radius } = atoms[i].element;\r\n atomsColored[i] = new IsoSurfaceAtomColored(vCenter, radius);\r\n const nm = atoms[i].element.number;\r\n atomsColored[i].atomType = this.getType(nm);\r\n let cIdx = COLOR_SIZE * i;\r\n atomsColored[i].colorX = colors[cIdx++];\r\n atomsColored[i].colorY = colors[cIdx++];\r\n atomsColored[i].colorZ = colors[cIdx];\r\n atomsColored[i].srcAtom = atoms[i];\r\n }\r\n }\r\n\r\n getGeo() {\r\n return this.geoOut;\r\n }\r\n\r\n destroy() {\r\n this.atoms = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n }\r\n\r\n /**\r\n * Calculates bounding box for array with spheres (atoms)\r\n *\r\n * @param {Object} atoms Atoms array\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n */\r\n getBoundingBox(atoms, vBoxMin, vBoxMax) {\r\n const bigNum = 10000000.0;\r\n\r\n vBoxMin.x = vBoxMin.y = vBoxMin.z = bigNum;\r\n vBoxMax.x = vBoxMax.y = vBoxMax.z = 0 - bigNum;\r\n\r\n const probeRadius2 = this.probeRadius * this.atomRadiusScale;\r\n let radMax = 0.0;\r\n for (let i = 0, num = atoms.length; i < num; i++) {\r\n const vCenter = atoms[i].coord;\r\n const rad = atoms[i].radius + probeRadius2;\r\n radMax = (rad > radMax) ? rad : radMax;\r\n if (vCenter.x - rad < vBoxMin.x) {\r\n vBoxMin.x = vCenter.x - rad;\r\n }\r\n if (vCenter.y - rad < vBoxMin.y) {\r\n vBoxMin.y = vCenter.y - rad;\r\n }\r\n if (vCenter.z - rad < vBoxMin.z) {\r\n vBoxMin.z = vCenter.z - rad;\r\n }\r\n if (vCenter.x + rad > vBoxMax.x) {\r\n vBoxMax.x = vCenter.x + rad;\r\n }\r\n if (vCenter.y + rad > vBoxMax.y) {\r\n vBoxMax.y = vCenter.y + rad;\r\n }\r\n if (vCenter.z + rad > vBoxMax.z) {\r\n vBoxMax.z = vCenter.z + rad;\r\n }\r\n }\r\n vBoxMin.x -= radMax;\r\n vBoxMin.y -= radMax;\r\n vBoxMin.z -= radMax;\r\n vBoxMax.x += radMax;\r\n vBoxMax.y += radMax;\r\n vBoxMax.z += radMax;\r\n }\r\n\r\n /**\r\n * Calculate (x,y,z) cordinate of the cell corner point\r\n *\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {number} x Cell integer x coordinate\r\n * @param {number} y Cell integer y coordinate\r\n * @param {number} z Cell integer z coordinate\r\n * @param {number} numPoints NUm points in cell on side\r\n * @param {Vector3} vOut Output vector\r\n */\r\n getCornerCoord(vBoxMin, vBoxMax, x, y, z, numPoints, vOut) {\r\n const invNP = 1.0 / (numPoints - 1.0);\r\n const tx = x * invNP;\r\n const ty = y * invNP;\r\n const tz = z * invNP;\r\n\r\n vOut.x = vBoxMin.x * (1.0 - tx) + vBoxMax.x * tx;\r\n vOut.y = vBoxMin.y * (1.0 - ty) + vBoxMax.y * ty;\r\n vOut.z = vBoxMin.z * (1.0 - tz) + vBoxMax.z * tz;\r\n }\r\n\r\n /**\r\n * Calculate point of intersection of sphere surface\r\n * and cell edge, given by [indexA, indexB] line\r\n *\r\n * @param {number} indexA Cell vertex index in [0..11]\r\n * @param {number} indexB Cell vertex index in [0..11]\r\n * @param {array} sign Sign array for all 8 vertices\r\n * @param {object} cube Cube\r\n * @param {number} indexPointValue for value placement\r\n * @param {Vector3} vOut Point of intersection\r\n */\r\n buildEdgePoint(indexA, indexB, sign, cube, indexPointValue, vOut) {\r\n if (sign[indexA] ^ sign[indexB]) {\r\n const cTwentyFour = 24;\r\n const t = (0 - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA])\r\n / (cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexB]\r\n - cube.pointsValuesLinear[indexPointValue + cTwentyFour + indexA]);\r\n const xa = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 0];\r\n const ya = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 1];\r\n const za = cube.pointsValuesLinear[indexPointValue + indexA * (2 + 1) + 2];\r\n const xb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 0];\r\n const yb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 1];\r\n const zb = cube.pointsValuesLinear[indexPointValue + indexB * (2 + 1) + 2];\r\n\r\n vOut.x = xa * (1.0 - t) + xb * t;\r\n vOut.y = ya * (1.0 - t) + yb * t;\r\n vOut.z = za * (1.0 - t) + zb * t;\r\n }\r\n }\r\n\r\n /**\r\n * Check if triangle is visible (vertices are close to atoms included in visibility set)\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} true if triangle is visible\r\n */\r\n isTriangleVisible(v0, v1, v2) {\r\n const a0 = this.voxelWorld.getClosestAtom(v0);\r\n const a1 = this.voxelWorld.getClosestAtom(v1);\r\n const a2 = this.voxelWorld.getClosestAtom(v2);\r\n if (a0 === null || a1 === null || a2 === null\r\n || a0.srcAtom === null || a1.srcAtom === null || a2.srcAtom === null) {\r\n return false;\r\n }\r\n\r\n return this.visibilitySelector.includesAtom(a0.srcAtom)\r\n && this.visibilitySelector.includesAtom(a1.srcAtom)\r\n && this.visibilitySelector.includesAtom(a2.srcAtom);\r\n }\r\n\r\n /**\r\n * Add triangle to result geometry\r\n *\r\n * @param {Vector3} v0 Vertex #0\r\n * @param {Vector3} v1 Vertex #1\r\n * @param {Vector3} v2 Vertex #2\r\n * @returns {boolean} false if no more triangles can be added\r\n */\r\n addTriangle(v0, v1, v2) {\r\n if (this.visibilitySelector && !this.isTriangleVisible(v0, v1, v2)) {\r\n return true;\r\n }\r\n\r\n const geo = this.geoOut;\r\n\r\n if (geo._numTriangles >= this.maxNumTriangles) {\r\n return false;\r\n }\r\n\r\n // Add vertex with optimize\r\n const indInGeo0 = this.addVertexToGeo(geo, v0);\r\n const indInGeo1 = this.addVertexToGeo(geo, v1);\r\n const indInGeo2 = this.addVertexToGeo(geo, v2);\r\n if ((indInGeo0 | indInGeo1 | indInGeo2) < 0) {\r\n return false;\r\n }\r\n\r\n const itr = 3 * geo._numTriangles;\r\n geo._indices[itr + 0] = indInGeo0;\r\n geo._indices[itr + 1] = indInGeo1;\r\n geo._indices[itr + 2] = indInGeo2;\r\n geo._numTriangles++;\r\n return true;\r\n }\r\n\r\n /**\r\n * Build result geometry (triangle mesh) from marching cube cells\r\n *\r\n * @param {number} meshRes Marchnig cube vertex count on each side\r\n * @param {Vector3} vBoxMin Bounding box point min\r\n * @param {Vector3} vBoxMax Bounding box point max\r\n * @param {number} corners float values array for each cube point\r\n * @param {Vector3} vCellStep vector to next cube cell diagonal point\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} 0, if success (<0) is error\r\n */\r\n buildGeoFromCorners(meshRes, vBoxMin, vBoxMax, corners, vCellStep, cube) {\r\n const arrSize = 12;\r\n const cNumVerts = 8;\r\n const numCells = meshRes - 1;\r\n const side = meshRes;\r\n const side2 = meshRes * meshRes;\r\n\r\n const vaEdges = new Array(arrSize);\r\n for (let i = 0; i < arrSize; i++) {\r\n vaEdges[i] = new THREE.Vector3();\r\n }\r\n const sign = [];\r\n for (let i = 0; i < cNumVerts; i++) {\r\n sign[i] = 1.0;\r\n }\r\n const vCorner = new THREE.Vector3();\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n if (!cube.hasIntersection[indCell]) {\r\n // next cell\r\n indCell++;\r\n continue;\r\n }\r\n const bitsInside = cube.bitsInside[indCell];\r\n\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, meshRes, vCorner);\r\n\r\n const indPointValues = indCell * (2 << (2 + 2));\r\n for (let i = 0, j = 0; i < cNumVerts; i++) {\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.x;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.y;\r\n cube.pointsValuesLinear[indPointValues + j++] = vCorner.z;\r\n }\r\n\r\n cube.pointsValuesLinear[indPointValues + 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 2 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3] += vCellStep.x;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3] += vCellStep.x;\r\n\r\n cube.pointsValuesLinear[indPointValues + 2 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 3 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 2] += vCellStep.z;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 2] += vCellStep.z;\r\n\r\n cube.pointsValuesLinear[indPointValues + 4 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 5 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 6 * 3 + 1] += vCellStep.y;\r\n cube.pointsValuesLinear[indPointValues + 7 * 3 + 1] += vCellStep.y;\r\n\r\n // now current cell has intersections (from -x to +x) on some cube edges\r\n const indValues = indPointValues + 24;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n sign[i] = (cube.pointsValuesLinear[indValues + i] < 0.0) ? 1 : 0;\r\n }\r\n\r\n this.buildEdgePoint(0, 1, sign, cube, indPointValues, vaEdges[0]);\r\n this.buildEdgePoint(1, 2, sign, cube, indPointValues, vaEdges[1]);\r\n this.buildEdgePoint(2, 3, sign, cube, indPointValues, vaEdges[2]);\r\n this.buildEdgePoint(3, 0, sign, cube, indPointValues, vaEdges[3]);\r\n\r\n this.buildEdgePoint(4, 5, sign, cube, indPointValues, vaEdges[4]);\r\n this.buildEdgePoint(5, 6, sign, cube, indPointValues, vaEdges[5]);\r\n this.buildEdgePoint(6, 7, sign, cube, indPointValues, vaEdges[6]);\r\n this.buildEdgePoint(7, 4, sign, cube, indPointValues, vaEdges[7]);\r\n\r\n this.buildEdgePoint(0, 4, sign, cube, indPointValues, vaEdges[8]);\r\n this.buildEdgePoint(1, 5, sign, cube, indPointValues, vaEdges[9]);\r\n this.buildEdgePoint(2, 6, sign, cube, indPointValues, vaEdges[10]);\r\n this.buildEdgePoint(3, 7, sign, cube, indPointValues, vaEdges[11]);\r\n\r\n const offs = bitsInside * (2 << (1 + 2));\r\n for (let numTri = 0, indTri = 0; numTri < (2 + 2 + 2); numTri++, indTri += 3) {\r\n // s_triIndicesMarchCube is external array, defined in mold_ind.js\r\n const i0 = cube.striIndicesMarchCube[offs + indTri];\r\n if (i0 < 0) {\r\n break;\r\n }\r\n const i1 = cube.striIndicesMarchCube[offs + indTri + 1];\r\n const i2 = cube.striIndicesMarchCube[offs + indTri + 2];\r\n\r\n if (!this.addTriangle(vaEdges[i0], vaEdges[i1], vaEdges[i2])) {\r\n return 0 - 2;\r\n }\r\n } // for numTri\r\n\r\n // next cell (cube)\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return 0;\r\n }\r\n\r\n /**\r\n * Returns number of cell with intersection with at least one sphere.\r\n * Using this number, we can estimate required number of vertices\r\n * and triangles to build result mesh.\r\n *\r\n * @param {number} side Number of points in cube voxels\r\n * @param {number} numCells Number of cells in cube voxels (per direction)\r\n * @param {array} corners Array of float values for cube corner points\r\n * @param {object} cube IsoSurfaceMarchCube object\r\n * @returns {number} numIntersectedCells\r\n */\r\n getNumIntersectedCells(side, numCells, corners, cube) {\r\n const side2 = side * side;\r\n const cNumVerts = 8;\r\n let numIntersectedCells = 0;\r\n\r\n let indCell = 0;\r\n let indY = 0;\r\n for (let y = 0; y < numCells; y++, indY += side2) {\r\n let indZ = 0;\r\n for (let z = 0; z < numCells; z++, indZ += side) {\r\n for (let x = 0; x < numCells; x++) {\r\n const cubeValuesIndex = indCell * (2 << (2 + 2)) + 24;\r\n const indCorner = x + indZ + indY;\r\n\r\n cube.pointsValuesLinear[cubeValuesIndex] = corners[indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 1] = corners[indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 2] = corners[indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 3] = corners[indCorner + side];\r\n cube.pointsValuesLinear[cubeValuesIndex + 4] = corners[side2 + indCorner];\r\n cube.pointsValuesLinear[cubeValuesIndex + 5] = corners[side2 + indCorner + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 6] = corners[side2 + indCorner + side + 1];\r\n cube.pointsValuesLinear[cubeValuesIndex + 7] = corners[side2 + indCorner + side];\r\n\r\n // check read exception\r\n // assert(side2 + indCorner + side + 1 < side3);\r\n\r\n // get bit flags inside\r\n let bitsInside = 0;\r\n for (let i = 0; i < cNumVerts; ++i) {\r\n if (cube.pointsValuesLinear[cubeValuesIndex + i] < 0.0) {\r\n bitsInside |= (1 << i);\r\n }\r\n }\r\n\r\n if ((bitsInside === 0) || (bitsInside === ((1 << cNumVerts) - 1))) {\r\n cube.hasIntersection[indCell] = false;\r\n } else {\r\n cube.hasIntersection[indCell] = true;\r\n numIntersectedCells++;\r\n }\r\n cube.bitsInside[indCell] = bitsInside;\r\n // next cell\r\n indCell++;\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n return numIntersectedCells;\r\n }\r\n\r\n getType(letter) {\r\n /* eslint-disable no-magic-numbers */\r\n const atomT = [0, 0, 1, 1, 2, 6, 3, 6, 4, 6, 5, 6, 6, 0, 7, 3, 8, 2, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 4,\r\n 16, 5, 17, 6, 18, 6, 19, 6, 20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6,\r\n 32, 6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, 45, 6, 46, 6, 47, 6,\r\n 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, 6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6,\r\n 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6,\r\n 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, 95, 6,\r\n 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, 6, 108, 6, 109, 6];\r\n /* eslint-enable no-magic-numbers */\r\n\r\n if (letter < 1 || letter > atomT.length / 2\r\n || (Object.keys(Element.ByAtomicNumber).length * 2) !== atomT.length) {\r\n throw new Error('atomT.length should be equal Element.ByAtomicNumber.length * 2');\r\n }\r\n return atomT[letter * 2];\r\n }\r\n\r\n /**\r\n * Calculate values for marching cube grid points\r\n * positive values are outside sphere, negative - is inside\r\n *\r\n * @param {array} corners array of float values\r\n * @param {number} side Number of point in cube in 1 dimennsion\r\n * @param {Vector3} vBoxMin Bounding box min point\r\n * @param {Vector3} vBoxMax Bounding box max point\r\n * @param {array} atoms Array of input atoms\r\n * @param {number} probeRad radius for atom probing\r\n */\r\n calculateGridCorners(corners, side, vBoxMin, vBoxMax, atoms, probeRad) {\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const vCorner = new THREE.Vector3();\r\n const vDif = new THREE.Vector3();\r\n /* eslint-disable no-magic-numbers */\r\n const aLot = +1.0e12;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n for (let i = 0; i < side3; i++) {\r\n corners[i] = aLot; // to large value\r\n }\r\n\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n for (let s = 0, numAtoms = atoms.length; s < numAtoms; s++) {\r\n const atom = atoms[s];\r\n const radius = atom.radius + probeRad;\r\n\r\n const fx = ((atom.coord.x - radius) - vBoxMin.x) * xScale;\r\n const fy = ((atom.coord.y - radius) - vBoxMin.y) * yScale;\r\n const fz = ((atom.coord.z - radius) - vBoxMin.z) * zScale;\r\n\r\n const indXMin = Math.floor(fx);\r\n const indYMin = Math.floor(fy);\r\n const indZMin = Math.floor(fz);\r\n\r\n let indXMax = Math.floor(((atom.coord.x + radius) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((atom.coord.y + radius) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((atom.coord.z + radius) - vBoxMin.z) * zScale);\r\n\r\n indXMax++;\r\n indYMax++;\r\n indZMax++;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let y = indYMin; y <= indYMax; y++) {\r\n const indY = y * side2;\r\n for (let z = indZMin; z <= indZMax; z++) {\r\n const indZ = z * side;\r\n for (let x = indXMin; x <= indXMax; x++) {\r\n const ind = indY + indZ + x;\r\n this.getCornerCoord(vBoxMin, vBoxMax, x, y, z, side, vCorner);\r\n vDif.x = vCorner.x - atom.coord.x;\r\n vDif.y = vCorner.y - atom.coord.y;\r\n vDif.z = vCorner.z - atom.coord.z;\r\n const distToSphere = Math.sqrt(vDif.x * vDif.x + vDif.y * vDif.y + vDif.z * vDif.z);\r\n // val: < 0, if inside sphere\r\n // val: > 0, if outside sphere\r\n const val = distToSphere - radius;\r\n if (val < corners[ind]) {\r\n corners[ind] = val;\r\n }\r\n } // for (x)\r\n } // for (z)\r\n } // for (y)\r\n } // for (s)\r\n }\r\n\r\n /**\r\n * Create memory pool for vertex hash management\r\n *\r\n * @param {number} maxNumVertices Maximum possible number of vertices (that will be build)\r\n * @param {number} maxNumTriangles Maximum possible number of triangles (that will be build)\r\n * @returns {number} 0, if success. (<0) is non memory\r\n */\r\n createVertexHash(maxNumVertices, maxNumTriangles) {\r\n this.hashLines = utils.allocateTyped(Int32Array, HASH_SIZE * 2);\r\n if (this.hashLines === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < HASH_SIZE; i++) {\r\n this.hashLines[j++] = 0; // num vertices in this hash line\r\n this.hashLines[j++] = 0 - 1; // index of the first entry\r\n }\r\n\r\n this.maxNumVertices = maxNumVertices;\r\n this.maxNumTriangles = maxNumTriangles;\r\n\r\n this.numHashEtriesAllocated = maxNumVertices;\r\n this.hashEntries = utils.allocateTyped(Int32Array, 2 * this.numHashEtriesAllocated);\r\n if (this.hashEntries === null) {\r\n return 0 - 1;\r\n }\r\n for (let i = 0, j = 0; i < this.numHashEtriesAllocated; i++) {\r\n this.hashEntries[j++] = 0 - 1; // index of vertex\r\n this.hashEntries[j++] = 0 - 1; // next hash entry index\r\n }\r\n this.numHashEntryIndex = 0;\r\n return 0;\r\n }\r\n\r\n /**\r\n * Allocate and return new hash entry. Just check possible amount.\r\n *\r\n * @returns {number} index of hash entry, that can be used for geometry add vertex functionality\r\n */\r\n getNewHashEntry() {\r\n if (this.numHashEntryIndex < this.numHashEtriesAllocated) {\r\n const i = this.numHashEntryIndex;\r\n this.numHashEntryIndex++;\r\n return i;\r\n }\r\n return 0 - 1;\r\n }\r\n\r\n /**\r\n * Add vertex to geometry structure\r\n * using vertex hash table to quickly check, is this vertex already exist in geometry\r\n *\r\n * @param {object} geoOut Geometry to build\r\n * @param {Vector3} vAdd Vertex to add\r\n * @returns {number} index of added (or existing) vertex in geometry.\r\n */\r\n addVertexToGeo(geoOut, vAdd) {\r\n let entry;\r\n const oneHynberes = 0.01;\r\n const n815851 = 815851;\r\n const n37633 = 37633;\r\n const n2453543 = 2453543;\r\n const r106 = 1.0e-6;\r\n\r\n const hashResolution = this.marCubeResoultion << 2;\r\n const v = new THREE.Vector3();\r\n const ix = Math.floor(hashResolution * (vAdd.x - this.vBoxMin.x) / (this.vBoxMax.x + oneHynberes - this.vBoxMin.x));\r\n const iy = Math.floor(hashResolution * (vAdd.y - this.vBoxMin.y) / (this.vBoxMax.y + oneHynberes - this.vBoxMin.y));\r\n const iz = Math.floor(hashResolution * (vAdd.z - this.vBoxMin.z) / (this.vBoxMax.z + oneHynberes - this.vBoxMin.z));\r\n let iHash = ix * n815851 + iz * n37633 + iy * n2453543;\r\n iHash &= (HASH_SIZE - 1);\r\n const hLineIndex = iHash + iHash;\r\n\r\n // search vertex via hash\r\n // search in hash list\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n for (entry = this.hashLines[hLineIndex + 1]; entry >= 0; entry = this.hashEntries[entry * 2 + 1]) {\r\n const ind = this.hashEntries[entry * 2 + 0]; // vertex index\r\n v.copy(geoOut._vertices[ind]);\r\n v.x -= vAdd.x;\r\n v.y -= vAdd.y;\r\n v.z -= vAdd.z;\r\n const dot2 = v.x * v.x + v.y * v.y + v.z * v.z;\r\n if (dot2 < r106) {\r\n return ind;\r\n } // if (found)\r\n } // for (entry)\r\n } // search\r\n\r\n // add new vertex to geometry\r\n if (geoOut._numVertices >= this.maxNumVertices) {\r\n return 0 - 1;\r\n }\r\n\r\n const iVertAdd = geoOut._numVertices;\r\n geoOut._vertices[iVertAdd].copy(vAdd);\r\n\r\n // add to hash\r\n if (this.vBoxMin !== null && this.vBoxMax !== null) {\r\n entry = this.getNewHashEntry();\r\n if (entry < 0) {\r\n return 0 - 1;\r\n }\r\n const entryFirst = this.hashLines[hLineIndex + 1];\r\n this.hashLines[hLineIndex + 1] = entry;\r\n this.hashEntries[entry * 2 + 0] = iVertAdd;\r\n this.hashEntries[entry * 2 + 1] = entryFirst;\r\n\r\n this.hashLines[hLineIndex + 0]++; // num vertices in line ++\r\n }\r\n geoOut._numVertices++;\r\n return iVertAdd;\r\n }\r\n\r\n /**\r\n *\r\n * @param {number} side some placeholder description\r\n * @param {number} probeSphereRadius some placeholder description\r\n * @param {object} vBoxMin some placeholder description\r\n * @param {object} vBoxMax some placeholder description\r\n * @param {object} geoOut some placeholder description\r\n * @param {object} corners some placeholder description\r\n * @returns {number} always 0\r\n */\r\n modifyExcludedFromGeo(\r\n side,\r\n probeSphereRadius,\r\n vBoxMin,\r\n vBoxMax,\r\n geoOut,\r\n corners,\r\n ) {\r\n let ind;\r\n let distToSphere;\r\n let distToBorder;\r\n const r11 = 1.1;\r\n\r\n function innerBlockWorkAround() {\r\n if (distToBorder > 0.0) {\r\n // point is inside probe sphere\r\n if (corners[ind] < 0.0) {\r\n corners[ind] = distToBorder; // was inside surface, now is oustide ( > 0)\r\n }\r\n if (distToBorder > corners[ind]) {\r\n corners[ind] = distToBorder; // find positive maximum\r\n }\r\n } else if (distToBorder > corners[ind]) { // point is outside sphere\r\n corners[ind] = distToBorder; // find negative maximum\r\n }\r\n }\r\n\r\n const side2 = side * side;\r\n const xScale = (side - 1) / (vBoxMax.x - vBoxMin.x);\r\n const yScale = (side - 1) / (vBoxMax.y - vBoxMin.y);\r\n const zScale = (side - 1) / (vBoxMax.z - vBoxMin.z);\r\n\r\n const probeSpRad2 = (probeSphereRadius * 2) * (probeSphereRadius * 2);\r\n const sideInv = 1.0 / (side - 1);\r\n\r\n for (let i = 0; i < geoOut._numVertices; i++) {\r\n const vCenter = geoOut._vertices[i];\r\n\r\n const radEst = probeSphereRadius * r11;\r\n\r\n let indXMin = Math.floor(((vCenter.x - radEst) - vBoxMin.x) * xScale);\r\n let indYMin = Math.floor(((vCenter.y - radEst) - vBoxMin.y) * yScale);\r\n let indZMin = Math.floor(((vCenter.z - radEst) - vBoxMin.z) * zScale);\r\n\r\n let indXMax = Math.floor(((vCenter.x + radEst) - vBoxMin.x) * xScale);\r\n let indYMax = Math.floor(((vCenter.y + radEst) - vBoxMin.y) * yScale);\r\n let indZMax = Math.floor(((vCenter.z + radEst) - vBoxMin.z) * zScale);\r\n\r\n indXMin = (indXMin >= 0) ? indXMin : 0;\r\n indYMin = (indYMin >= 0) ? indYMin : 0;\r\n indZMin = (indZMin >= 0) ? indZMin : 0;\r\n indXMax = (indXMax <= (side - 1)) ? indXMax : (side - 1);\r\n indYMax = (indYMax <= (side - 1)) ? indYMax : (side - 1);\r\n indZMax = (indZMax <= (side - 1)) ? indZMax : (side - 1);\r\n\r\n for (let iy = indYMin; iy <= indYMax; iy++) {\r\n const indY = iy * side2;\r\n for (let iz = indZMin; iz <= indZMax; iz++) {\r\n const indZ = iz * side;\r\n for (let ix = indXMin; ix <= indXMax; ix++) {\r\n ind = indY + indZ + ix;\r\n // getCornerCoord(vBoxMin, vBoxMax, ix, iy, iz, side, &vCorner);\r\n let t = ix * sideInv;\r\n const xCorner = vBoxMin.x * (1.0 - t) + vBoxMax.x * t;\r\n t = iy * sideInv;\r\n const yCorner = vBoxMin.y * (1.0 - t) + vBoxMax.y * t;\r\n t = iz * sideInv;\r\n const zCorner = vBoxMin.z * (1.0 - t) + vBoxMax.z * t;\r\n\r\n const dx = xCorner - vCenter.x;\r\n const dy = yCorner - vCenter.y;\r\n const dz = zCorner - vCenter.z;\r\n const dist2 = dx * dx + dy * dy + dz * dz;\r\n if (dist2 < probeSpRad2) {\r\n distToSphere = Math.sqrt(dist2);\r\n distToBorder = -(distToSphere - probeSphereRadius);\r\n innerBlockWorkAround();\r\n } // if (dist from corner point to sphere center more 2 radiuses)\r\n } // for (ix)\r\n } // for (iz)\r\n } // for (iy)\r\n } // for (i) all geo vertices\r\n return 0;\r\n }\r\n\r\n _innerBuild() {\r\n let ok;\r\n const expandFactor = 1.2;\r\n\r\n // performance test\r\n // this.performanceTest();\r\n\r\n // Create temporary atoms (but colored)\r\n const packedArrays = {\r\n posRad: this._posRad,\r\n colors: this._colors,\r\n atoms: this._opts.atoms,\r\n };\r\n this.complex = this._opts.parent;\r\n this.atoms = packedArrays.atoms;\r\n this.meshResolution = this._opts.gridSpacing;\r\n this.atomRadiusScale = this._opts.radScale;\r\n this.colorMode = this._opts.colorMode;\r\n this.probeRadius = this._opts.probeRadius;\r\n this.useVertexColors = true;\r\n this.excludeProbe = this._opts.excludeProbe;\r\n this.visibilitySelector = this._opts.visibilitySelector;\r\n\r\n this.geoOut = null;\r\n\r\n this.hashLines = null;\r\n this.hashEntries = null;\r\n this.numHashEtriesAllocated = 0;\r\n this.numHashEntryIndex = 0;\r\n this.maxNumVertices = 0;\r\n this.maxNumTriangles = 0;\r\n\r\n const atomsColored = new Array(this.atoms.length);\r\n this.convertToAtomsColored(packedArrays, atomsColored);\r\n\r\n // find bbox for spheres scene\r\n const vBoxMin = this.vBoxMin = new THREE.Vector3();\r\n const vBoxMax = this.vBoxMax = new THREE.Vector3();\r\n this.getBoundingBox(atomsColored, vBoxMin, vBoxMax);\r\n\r\n const marCubeResoultion = this.marCubeResoultion = this.meshResolution * (2 + 2);\r\n\r\n // build grid corners for Marching cube algorithm\r\n const side = marCubeResoultion;\r\n const side2 = side * side;\r\n const side3 = side2 * side;\r\n const corners = utils.allocateTyped(Float32Array, side3);\r\n const rProbeRadius = this.probeRadius * this.atomRadiusScale;\r\n\r\n this.calculateGridCorners(corners, side, vBoxMin, vBoxMax, atomsColored, rProbeRadius);\r\n\r\n const numCells = marCubeResoultion - 1;\r\n const cube = new IsoSurfaceMarchCube();\r\n ok = cube.create(numCells);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // copy corners to cells\r\n const vCellStep = new THREE.Vector3();\r\n vCellStep.x = (vBoxMax.x - vBoxMin.x) / numCells;\r\n vCellStep.y = (vBoxMax.y - vBoxMin.y) / numCells;\r\n vCellStep.z = (vBoxMax.z - vBoxMin.z) / numCells;\r\n\r\n let numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n let maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n let maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n\r\n // build voxel world (used to check triangle-to-atom tie and to calculate normals and colors)\r\n let probeRadForNormalsColors = rProbeRadius;\r\n if (this.excludeProbe) {\r\n probeRadForNormalsColors = 0.01;\r\n }\r\n this.voxelWorld = new IsosurfaceBuildNormals(\r\n atomsColored.length,\r\n atomsColored,\r\n vBoxMin,\r\n vBoxMax,\r\n probeRadForNormalsColors,\r\n );\r\n this.voxelWorld.createVoxels();\r\n\r\n ok = this.buildGeoFromCorners(marCubeResoultion, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n if (this.excludeProbe) {\r\n // using 3d mesh (geoOut) as a surface points\r\n // move probe sphere and try to minimuze corners values\r\n this.modifyExcludedFromGeo(side, rProbeRadius, vBoxMin, vBoxMax, this.geoOut, corners);\r\n\r\n // delete old builded geo\r\n this.geoOut._vertices = null;\r\n this.geoOut._colors = null;\r\n this.geoOut._indices = null;\r\n this.geoOut._normals = null;\r\n this.geoOut._numVertices = 0;\r\n this.geoOut._numTriangles = 0;\r\n this.geoOut = null;\r\n\r\n // estimage geo vertices budget again\r\n numIntersectedCellsEstim = this.getNumIntersectedCells(side, numCells, corners, cube);\r\n maxNumVertices = Math.floor(numIntersectedCellsEstim * expandFactor);\r\n maxNumTriangles = Math.floor(numIntersectedCellsEstim * expandFactor * 2);\r\n\r\n // creates empty new geometry\r\n this.geoOut = new IsoSurfaceGeo(maxNumVertices, maxNumTriangles, this.useVertexColors);\r\n ok = this.createVertexHash(maxNumVertices, maxNumTriangles);\r\n if (ok < 0) {\r\n return ok;\r\n }\r\n // build vertices and triangles from corners values\r\n ok = this.buildGeoFromCorners(side, vBoxMin, vBoxMax, corners, vCellStep, cube);\r\n }\r\n\r\n // build vertex normals\r\n this.voxelWorld.buildNormals(this.geoOut._vertices.length, this.geoOut._vertices, this.geoOut._normals);\r\n // More value : more smooth color mixing\r\n // value about 0.7: very rough colors borders\r\n let radiusColorSmoothness = 6.5;\r\n if (this.excludeProbe) {\r\n radiusColorSmoothness -= 1.5;\r\n }\r\n if (this.useVertexColors) {\r\n this.voxelWorld.buildColors(\r\n this.geoOut._vertices.length,\r\n this.geoOut._vertices,\r\n this.geoOut._colors,\r\n radiusColorSmoothness,\r\n );\r\n }\r\n this.voxelWorld.destroyVoxels();\r\n this.voxelWorld = null;\r\n\r\n // remove objects\r\n cube.destroy();\r\n\r\n return ok;\r\n }\r\n}\r\n\r\n// All code below must be erased from every device and each developer's memory\r\n\r\nexport default SSIsosurfaceGeometry;\r\n","import * as THREE from 'three';\r\nimport EventDispatcher from '../../utils/EventDispatcher';\r\n\r\nfunction createLabel(fieldTxt, className) {\r\n const text = document.createElement('div');\r\n text.className = className;\r\n\r\n if (typeof fieldTxt === 'string') {\r\n const spanText = document.createElement('span');\r\n spanText.style.fontSize = '150%';\r\n const strings = fieldTxt.split('\\n');\r\n\r\n for (let i = 0, n = strings.length; i < n; ++i) {\r\n const spanNodeP = document.createElement('span');\r\n const spanNodeText = document.createTextNode(strings[i]);\r\n spanNodeP.appendChild(spanNodeText);\r\n spanText.appendChild(spanNodeP);\r\n if (i < n - 1) {\r\n spanText.appendChild(document.createElement('br'));\r\n }\r\n }\r\n\r\n text.appendChild(spanText);\r\n } else {\r\n text.appendChild(fieldTxt);\r\n }\r\n text.worldPos = new THREE.Vector3();\r\n return text;\r\n}\r\nclass LabelsGeometry extends EventDispatcher {\r\n constructor(instanceCount, opts) {\r\n super();\r\n this._opts = opts;\r\n this.items = [];\r\n this.needsUpdate = false;\r\n\r\n let xTranslation = -50;\r\n let yTranslation = -50;\r\n switch (opts.horizontalAlign) {\r\n case 'left':\r\n xTranslation = 0;\r\n break;\r\n case 'right':\r\n xTranslation = -100;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n switch (opts.verticalAlign) {\r\n case 'top':\r\n yTranslation = -100;\r\n break;\r\n case 'bottom':\r\n yTranslation = 0;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n const deltaPos = new THREE.Vector3(opts.dx || 0, opts.dy || 0, opts.dz || 0);\r\n this.userData = {\r\n translation: `translate(${xTranslation}%, ${yTranslation}%)`,\r\n offset: deltaPos,\r\n };\r\n }\r\n\r\n setItem(itemIdx, itemPos, fieldTxt) {\r\n const opts = this._opts;\r\n const text = this.items[itemIdx] || createLabel(fieldTxt, 'label');\r\n\r\n text.worldPos.copy(itemPos);\r\n text.style.textAlign = opts.horizontalAlign;\r\n text.style.verticalAlign = opts.verticalAlign;\r\n this.items[itemIdx] = text;\r\n }\r\n\r\n setColor(itemIdx, fColor, bColor) {\r\n const text = this.items[itemIdx];\r\n text.opts = {\r\n color: fColor,\r\n background: bColor,\r\n };\r\n }\r\n\r\n startUpdate() {\r\n return true;\r\n }\r\n\r\n finishUpdate() {\r\n this.needsUpdate = true;\r\n this.dispatchEvent({ type: 'update' });\r\n }\r\n\r\n finalize() {\r\n this.finishUpdate();\r\n }\r\n\r\n // unimplemented functions\r\n raycast() {\r\n }\r\n\r\n setOpacity() {\r\n\r\n }\r\n\r\n getSubset() {\r\n return [];\r\n }\r\n}\r\n\r\nexport default LabelsGeometry;\r\n","import InstancedSpheresGeometry from './InstancedSpheresGeometry';\r\nimport SimpleSpheresGeometry from './SimpleSpheresGeometry';\r\nimport Simple2CCylindersGeometry from './Simple2CCylindersGeometry';\r\nimport Instanced2CCylindersGeometry from './Instanced2CCylindersGeometry';\r\nimport ExtrudedObjectsGeometry from './ExtrudedObjectsGeometry';\r\nimport ChunkedLinesGeometry from './ChunkedLinesGeometry';\r\nimport TwoColorLinesGeometry from './TwoColorLinesGeometry';\r\nimport CrossGeometry from './CrossGeometry';\r\nimport QuickSurfGeometry from './QuickSurfGeometry';\r\nimport ContactSurfaceGeometry from './ContactSurfaceGeometry';\r\nimport SSIsosurfaceGeometry from './SSIsosurfaceGeometry';\r\nimport LabelsGeometry from './LabelsGeometry';\r\n\r\nexport default {\r\n InstancedSpheresGeometry,\r\n SimpleSpheresGeometry,\r\n Simple2CCylindersGeometry,\r\n Instanced2CCylindersGeometry,\r\n ExtrudedObjectsGeometry,\r\n ChunkedLinesGeometry,\r\n TwoColorLinesGeometry,\r\n CrossGeometry,\r\n QuickSurfGeometry,\r\n ContactSurfaceGeometry,\r\n SSIsosurfaceGeometry,\r\n LabelsGeometry,\r\n};\r\n","export default {\r\n\r\n precision: 'mediump',\r\n\r\n /**\r\n *\r\n * @param {THREE.WebGLRenderer} renderer\r\n */\r\n init(renderer) {\r\n this.precision = renderer.capabilities.getMaxPrecision('highp');\r\n },\r\n};\r\n","import * as THREE from 'three';\r\n\r\nconst noiseWidth = 4;\r\nconst noiseHeight = 4;\r\nconst _noiseData = new Uint8Array([\r\n 24, 52, 0, 255, 254, 145, 0, 255, 122, 0, 0, 255, 7, 170, 0, 255,\r\n 34, 214, 0, 255, 173, 8, 0, 255, 86, 249, 0, 255, 160, 4, 0, 255,\r\n 226, 46, 0, 255, 224, 211, 0, 255, 3, 157, 0, 255, 174, 247, 0, 255,\r\n 12, 182, 0, 255, 220, 216, 0, 255, 1, 109, 0, 255, 253, 154, 0, 255,\r\n]);\r\nconst _noiseWrapS = THREE.RepeatWrapping;\r\nconst _noiseWrapT = THREE.RepeatWrapping;\r\nconst _noiseMinFilter = THREE.NearestFilter;\r\nconst _noiseMagFilter = THREE.NearestFilter;\r\nconst _noiseMapping = THREE.UVMapping;\r\nconst noiseTexture = new THREE.DataTexture(\r\n _noiseData,\r\n noiseWidth,\r\n noiseHeight,\r\n THREE.RGBAFormat,\r\n THREE.UnsignedByteType,\r\n _noiseMapping,\r\n _noiseWrapS,\r\n _noiseWrapT,\r\n _noiseMagFilter,\r\n _noiseMinFilter,\r\n 1,\r\n);\r\nnoiseTexture.needsUpdate = true;\r\n\r\nexport default {\r\n noiseWidth,\r\n noiseHeight,\r\n noiseTexture,\r\n};\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './Uber.vert';\r\nimport fragmentShader from './Uber.frag';\r\nimport capabilities from '../capabilities';\r\nimport noise from '../noiseTexture';\r\n\r\n// Length of _samplesKernel is used in Uber.frag\r\n// If you want to change length of _samplesKernel, please, remember change it in Uber.frag too.\r\n// You can easy find places for replace using word:_samplesKernel\r\nconst _samplesKernel = [\r\n new THREE.Vector2(-0.541978, 0.840393),\r\n new THREE.Vector2(0.125533, -0.992089),\r\n new THREE.Vector2(0.374329, 0.927296),\r\n new THREE.Vector2(-0.105475, 0.994422),\r\n];\r\n\r\nconst defaultUniforms = THREE.UniformsUtils.merge([\r\n\r\n THREE.UniformsLib.fog,\r\n THREE.UniformsLib.lights,\r\n\r\n {\r\n // are updated automatically by three.js (see THREE.ShaderLib.common)\r\n diffuse: { value: new THREE.Color(0xeeeeee) },\r\n opacity: { value: 1.0 },\r\n\r\n specular: { type: 'c', value: new THREE.Color(0x111111) },\r\n shininess: { type: 'f', value: 30 },\r\n fixedColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n zOffset: { type: 'f', value: 0.0 },\r\n zClipValue: { type: 'f', value: 0.0 },\r\n clipPlaneValue: { type: 'f', value: 0.0 },\r\n nearPlaneValue: { type: 'f', value: -0.5 },\r\n invModelViewMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n world2colorMatrix: { type: '4fv', value: new THREE.Matrix4() },\r\n dashedLineSize: { type: 'f', value: 0.1 },\r\n dashedLinePeriod: { type: 'f', value: 0.2 },\r\n projMatrixInv: { type: '4fv', value: new THREE.Matrix4() },\r\n viewport: { type: 'v2', value: new THREE.Vector2() },\r\n lineWidth: { type: 'f', value: 2.0 },\r\n // default value must be the same as settings\r\n fogAlpha: { type: 'f', value: 1.0 },\r\n samplesKernel: { type: 'v2v', value: null },\r\n noiseTex: { type: 't', value: null },\r\n noiseTexelSize: { type: 'v2', value: null },\r\n srcTexelSize: { type: 'v2', value: null },\r\n },\r\n\r\n]);\r\n\r\nconst uberOptionNames = [\r\n 'shininess',\r\n 'opacity',\r\n 'zOffset',\r\n 'diffuse',\r\n 'specular',\r\n 'fixedColor',\r\n 'zClipCoef',\r\n 'zClipValue',\r\n 'clipPlaneValue',\r\n 'world2colorMatrix',\r\n 'dashedLineSize',\r\n 'dashedLinePeriod',\r\n 'projMatrixInv',\r\n 'viewport',\r\n 'lineWidth',\r\n 'fogAlpha',\r\n 'samplesKernel',\r\n 'noiseTex',\r\n 'noiseTexelSize',\r\n 'srcTexelSize',\r\n];\r\n\r\n// properties that convert to uniforms\r\nconst uberOptions = {\r\n diffuse: new THREE.Color(0xffffff), // used in phong lighting\r\n specular: new THREE.Color(0x111111), // used in phong lighting\r\n shininess: 30, // used in phong lighting\r\n opacity: 1, // set mesh opacity\r\n fixedColor: new THREE.Color(0xffffff), // color to override (see OVERRIDE_COLOR)\r\n zOffset: 0.0, // used fo zsprites (see SPHERE_SPRITE CYLINDER_SPRITE)\r\n zClipCoef: 2.0, // use for Surfs clipping (mesh param, isn't used in shader) FIXME move to representation param\r\n zClipValue: 0.0, // value to clip Surfs in shader (see ZCLIP)\r\n clipPlaneValue: 0.0, // value to clip scene globally (see CLIPPLANE)\r\n world2colorMatrix: new THREE.Matrix4(),\r\n dashedLineSize: 0.1,\r\n dashedLinePeriod: 0.3,\r\n projMatrixInv: new THREE.Matrix4(),\r\n viewport: new THREE.Vector2(800, 600),\r\n lineWidth: 2.0,\r\n fogAlpha: 1.0,\r\n samplesKernel: _samplesKernel,\r\n noiseTex: noise.noiseTexture,\r\n noiseTexelSize: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight),\r\n srcTexelSize: new THREE.Vector2(1.0 / 800.0, 1.0 / 600.0),\r\n copy(source) {\r\n this.diffuse.copy(source.diffuse);\r\n this.specular.copy(source.specular);\r\n this.shininess = source.shininess;\r\n this.opacity = source.opacity;\r\n this.fixedColor.copy(source.fixedColor);\r\n this.zOffset = source.zOffset;\r\n this.zClipCoef = source.zClipCoef;\r\n this.zClipValue = source.zClipValue;\r\n this.clipPlaneValue = source.clipPlaneValue;\r\n this.world2colorMatrix.copy(source.world2colorMatrix);\r\n this.dashedLineSize = source.dashedLineSize;\r\n this.dashedLinePeriod = source.dashedLinePeriod;\r\n this.projMatrixInv = source.projMatrixInv;\r\n this.viewport = source.viewport;\r\n this.lineWidth = source.lineWidth; // used for thick lines only\r\n this.toonShading = source.toonShading;\r\n this.fogAlpha = source.fogAlpha;\r\n this.samplesKernel = source.samplesKernel;\r\n this.noiseTex = source.noiseTex;\r\n this.noiseTexelSize = source.noiseTexelSize;\r\n this.srcTexelSize = source.srcTexelSize;\r\n },\r\n};\r\n\r\nclass UberMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // add fog\r\n this.fog = true;\r\n // used for instanced geometry\r\n this.instancedPos = false;\r\n this.instancedMatrix = false;\r\n // atoms and links color\r\n this.attrColor = false;\r\n // second link color for cylinders\r\n this.attrColor2 = false;\r\n //\r\n this.attrAlphaColor = false;\r\n // overrides color for all vertices (used in selection)\r\n this.overrideColor = false;\r\n // zsrpites\r\n this.sphereSprite = false;\r\n this.cylinderSprite = false;\r\n // clip Surfs individually\r\n this.zClip = false;\r\n // clip scene with global clip plane\r\n this.clipPlane = false;\r\n // enable fake (chess-like) opacity\r\n this.fakeOpacity = false;\r\n // render only depth, don't take care about the pixel color (used for transparency depth prepass)\r\n this.prepassTransparancy = false;\r\n // used to render pixel positions\r\n this.colorFromPos = false;\r\n // used to render shadowmap\r\n this.shadowmap = false;\r\n // used to describe shadowmap type\r\n this.shadowmapType = 'random';\r\n // used to render pixel view deph\r\n this.colorFromDepth = false;\r\n // mark that rendering is for orthographic camera\r\n this.orthoCam = false;\r\n // used to render dashed line\r\n this.dashedLine = false;\r\n // mark as transparent\r\n this.transparent = true;\r\n // mark as thick lines\r\n this.thickLine = false;\r\n // makes fog begin transparency (required for transparent background)\r\n this.fogTransparent = false;\r\n // used to render surface normals to G buffer for ssao effect\r\n this.normalsToGBuffer = false;\r\n // used for toon material\r\n this.toonShading = false;\r\n\r\n // uber options of \"root\" materials are inherited from single uber-options object that resides in prototype\r\n this.uberOptions = Object.create(UberMaterial.prototype.uberOptions);\r\n\r\n // set default values\r\n super.setValues({\r\n uniforms: THREE.UniformsUtils.clone(defaultUniforms),\r\n vertexShader: this.precisionString() + vertexShader,\r\n fragmentShader: this.precisionString() + fragmentShader,\r\n lights: true,\r\n fog: true,\r\n side: THREE.DoubleSide,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n precisionString() {\r\n const { precision } = capabilities;\r\n const str = `precision ${precision} float;\\n`\r\n + `precision ${precision} int;\\n\\n`;\r\n return str;\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n\r\n this.fragmentShader = source.fragmentShader;\r\n this.vertexShader = source.vertexShader;\r\n\r\n this.uniforms = THREE.UniformsUtils.clone(source.uniforms);\r\n this.defines = { ...source.defines };\r\n this.extensions = source.extensions;\r\n\r\n this.fog = source.fog;\r\n this.instancedPos = source.instancedPos;\r\n this.instancedMatrix = source.instancedMatrix;\r\n this.attrColor = source.attrColor;\r\n this.attrColor2 = source.attrColor2;\r\n this.attrAlphaColor = source.attrAlphaColor;\r\n this.overrideColor = source.overrideColor;\r\n this.sphereSprite = source.sphereSprite;\r\n this.cylinderSprite = source.cylinderSprite;\r\n this.zClip = source.zClip;\r\n this.clipPlane = source.clipPlane;\r\n this.fakeOpacity = source.fakeOpacity;\r\n this.colorFromPos = source.colorFromPos;\r\n this.shadowmap = source.shadowmap;\r\n this.shadowmapType = source.shadowmapType;\r\n this.colorFromDepth = source.colorFromDepth;\r\n this.orthoCam = source.orthoCam;\r\n this.prepassTransparancy = source.prepassTransparancy;\r\n this.dashedLine = source.dashedLine;\r\n this.thickLine = source.thickLine;\r\n this.fogTransparent = source.fogTransparent;\r\n this.normalsToGBuffer = source.normalsToGBuffer;\r\n this.toonShading = source.toonShading;\r\n\r\n this.uberOptions.copy(source.uberOptions);\r\n\r\n return this;\r\n }\r\n\r\n // create copy of this material\r\n // its options are prototyped after this material's options\r\n createInstance() {\r\n const inst = new UberMaterial();\r\n inst.copy(this);\r\n inst.uberOptions = Object.create(this.uberOptions);\r\n return inst;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n const extensions = {};\r\n\r\n if (this.fog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.instancedPos) {\r\n defines.INSTANCED_POS = 1;\r\n }\r\n if (this.instancedMatrix) {\r\n defines.INSTANCED_MATRIX = 1;\r\n }\r\n if (this.attrColor) {\r\n defines.ATTR_COLOR = 1;\r\n }\r\n if (this.attrColor2) {\r\n defines.ATTR_COLOR2 = 1;\r\n }\r\n if (this.attrAlphaColor) {\r\n defines.ATTR_ALPHA_COLOR = 1;\r\n }\r\n if (this.overrideColor) {\r\n defines.OVERRIDE_COLOR = 1;\r\n }\r\n if (this.sphereSprite) {\r\n defines.SPHERE_SPRITE = 1;\r\n extensions.fragDepth = true;\r\n }\r\n if (this.cylinderSprite) {\r\n defines.CYLINDER_SPRITE = 1;\r\n extensions.fragDepth = true;\r\n }\r\n if (this.zClip) {\r\n defines.ZCLIP = 1;\r\n }\r\n if (this.clipPlane) {\r\n defines.CLIP_PLANE = 1;\r\n }\r\n if (this.fakeOpacity) {\r\n defines.FAKE_OPACITY = 1;\r\n }\r\n if (this.lights) {\r\n defines.USE_LIGHTS = 1;\r\n }\r\n if (this.colorFromPos) {\r\n defines.COLOR_FROM_POS = 1;\r\n }\r\n if (this.shadowmap) {\r\n defines.SHADOWMAP = 1;\r\n if (this.shadowmapType === 'pcf') {\r\n defines.SHADOWMAP_PCF_SHARP = 1;\r\n } else if (this.shadowmapType === 'random') {\r\n defines.SHADOWMAP_PCF_RAND = 1;\r\n } else {\r\n defines.SHADOWMAP_BASIC = 1;\r\n }\r\n }\r\n if (this.colorFromDepth) {\r\n defines.COLOR_FROM_DEPTH = 1;\r\n }\r\n if (this.orthoCam) {\r\n defines.ORTHOGRAPHIC_CAMERA = 1;\r\n }\r\n if (this.prepassTransparancy) {\r\n defines.PREPASS_TRANSP = 1;\r\n }\r\n if (this.dashedLine) {\r\n defines.DASHED_LINE = 1;\r\n }\r\n if (this.thickLine) {\r\n defines.THICK_LINE = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n if (this.normalsToGBuffer) {\r\n extensions.drawBuffers = true;\r\n defines.NORMALS_TO_G_BUFFER = 1;\r\n }\r\n if (this.toonShading) {\r\n defines.TOON_SHADING = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n this.extensions = extensions;\r\n }\r\n\r\n setUberOptions(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n for (const key in values) {\r\n if (!values.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n\r\n if (this.uberOptions[key] instanceof THREE.Color) {\r\n this.uberOptions[key] = values[key].clone();\r\n } else {\r\n this.uberOptions[key] = values[key];\r\n }\r\n }\r\n }\r\n\r\n clone(shallow) {\r\n if (!shallow) {\r\n return super.clone();\r\n }\r\n return this.createInstance();\r\n }\r\n\r\n updateUniforms() {\r\n const self = this;\r\n\r\n uberOptionNames.forEach((p) => {\r\n if (self.uniforms.hasOwnProperty(p)) {\r\n if (self.uberOptions[p] instanceof THREE.Color\r\n || self.uberOptions[p] instanceof THREE.Matrix4) {\r\n self.uniforms[p].value = self.uberOptions[p].clone();\r\n } else {\r\n self.uniforms[p].value = self.uberOptions[p];\r\n }\r\n }\r\n });\r\n }\r\n}\r\n\r\nUberMaterial.prototype.uberOptions = uberOptions;\r\n\r\nexport default UberMaterial;\r\n","import UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default function (SuperClass) {\r\n class NewObjectType extends SuperClass {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.onBeforeRender = NewObjectType.prototype.onBeforeRender;\r\n }\r\n\r\n onBeforeRender(renderer, scene, camera, geometry, material, group) {\r\n this._onBeforeRender(renderer, scene, camera, geometry, material, group);\r\n this._update();\r\n }\r\n\r\n _onBeforeRender() {\r\n }\r\n\r\n _update() {\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material instanceof UberMaterial) {\r\n material.updateUniforms();\r\n }\r\n }\r\n }\r\n\r\n return NewObjectType;\r\n}\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZSpriteMesh extends Mesh {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n const { material } = this;\r\n if (!material) {\r\n return;\r\n }\r\n\r\n if (material.uniforms.invModelViewMatrix) {\r\n // NOTE: update of modelViewMatrix inside threejs is done after onBeforeRender call,\r\n // so we have to do it manually in that place\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n // get inverse matrix\r\n material.uniforms.invModelViewMatrix.value.copy(this.modelViewMatrix).invert();\r\n material.uniforms.nearPlaneValue.value = camera.near;\r\n material.uniformsNeedUpdate = true;\r\n }\r\n }\r\n}\r\n\r\nexport default ZSpriteMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass ZClippedMesh extends Mesh {\r\n constructor(geometry, material) {\r\n super(geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n\r\n static _mvLength = new THREE.Vector3();\r\n\r\n static _center = new THREE.Vector3();\r\n\r\n static _modelView = new THREE.Matrix4();\r\n\r\n _onBeforeRender(renderer, scene, camera) {\r\n Mesh.prototype._onBeforeRender.call(this, renderer, scene, camera);\r\n\r\n const geo = this.geometry;\r\n const { material } = this;\r\n if (!geo.zClip || !material.uberOptions) {\r\n return;\r\n }\r\n\r\n const zClipCoef = 0.5;\r\n\r\n const modelView = ZClippedMesh._modelView;\r\n const mvLength = ZClippedMesh._mvLength;\r\n const center = ZClippedMesh._center;\r\n\r\n modelView.multiplyMatrices(this.matrixWorld, camera.matrixWorldInverse);\r\n const s = mvLength.setFromMatrixColumn(modelView, 0).length();\r\n center.copy(geo.boundingSphere.center);\r\n\r\n this.localToWorld(center);\r\n material.uberOptions.zClipValue = camera.position.z - center.z\r\n - s * (zClipCoef * geo.boundingSphere.radius);\r\n }\r\n}\r\n\r\nexport default ZClippedMesh;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from '../CSS2DObject';\r\nimport utils from '../../utils';\r\n\r\nclass TextMesh extends THREE.Group {\r\n constructor(geometry, _material) {\r\n super();\r\n this.geometry = geometry;\r\n\r\n const self = this;\r\n self.initialized = false;\r\n this.geometry.addEventListener('update', () => {\r\n self.update();\r\n });\r\n }\r\n\r\n init() {\r\n const { children } = this;\r\n for (let i = children.length - 1; i >= 0; --i) {\r\n this.remove(children[i]);\r\n }\r\n\r\n const { items, userData } = this.geometry;\r\n for (let i = 0, n = items.length; i < n; ++i) {\r\n const srcItem = items[i];\r\n if (!srcItem) {\r\n continue;\r\n }\r\n const item = utils.shallowCloneNode(srcItem);\r\n const label = new CSS2DObject(item);\r\n label.userData = _.clone(userData);\r\n const el = label.getElement();\r\n el.style.visibility = 'visible';\r\n label.source = srcItem;\r\n this.add(label);\r\n }\r\n this.initialized = true;\r\n }\r\n\r\n update() {\r\n const geo = this.geometry;\r\n if (!geo.needsUpdate) {\r\n return;\r\n }\r\n const { children } = this;\r\n if (!this.initialized) {\r\n this.init();\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n const item = child.source;\r\n child.position.copy(item.worldPos);\r\n child.userData.color = item.opts.color;\r\n child.userData.background = item.opts.background;\r\n }\r\n }\r\n}\r\n\r\nexport default TextMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass SimpleMesh extends Mesh {\r\n constructor(geometry, material) {\r\n super(geometry, material);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n}\r\n\r\nexport default SimpleMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\nconst _viewport = new THREE.Vector2();\r\n\r\nclass ThickLineMesh extends Mesh {\r\n _onBeforeRender(renderer, scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!material.uberOptions) {\r\n return;\r\n }\r\n\r\n material.uberOptions.projMatrixInv.copy(camera.projectionMatrix).invert();\r\n renderer.getSize(_viewport);\r\n material.uberOptions.viewport.set(_viewport.width, _viewport.height);\r\n }\r\n}\r\n\r\nexport default ThickLineMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\n\r\nconst Mesh = UberObject(THREE.Mesh);\r\n\r\nclass InstancedMesh extends Mesh {\r\n constructor(...rest) {\r\n super(...rest);\r\n this.castShadow = true;\r\n this.receiveShadow = true;\r\n }\r\n}\r\n\r\nexport default InstancedMesh;\r\n","import * as THREE from 'three';\r\nimport UberObject from './UberObject';\r\nimport ZSpriteMesh from './ZSpriteMesh';\r\nimport ZClippedMesh from './ZClippedMesh';\r\nimport TextMesh from './TextMesh';\r\nimport SimpleMesh from './SimpleMesh';\r\nimport ThickLineMesh from './ThickLineMesh';\r\nimport InstancedMesh from './InstancedMesh';\r\n\r\nexport default {\r\n ZClipped: ZClippedMesh,\r\n ZSprite: ZSpriteMesh,\r\n Text: TextMesh,\r\n Line: UberObject(THREE.Line),\r\n LineSegments: UberObject(THREE.LineSegments),\r\n Mesh: SimpleMesh,\r\n ThickLineMesh,\r\n Instanced: InstancedMesh,\r\n};\r\n","import geometries from '../geometries/geometries';\r\nimport meshes from './meshes';\r\nimport ThickLinesGeometry from '../geometries/ThickLinesGeometry';\r\n\r\nfunction setMatParams(params, uniforms) {\r\n return function (material) {\r\n material.setValues(params);\r\n material.setUberOptions(uniforms);\r\n };\r\n}\r\n\r\nfunction _createInstancedCylinders(useZSprites, openEnded) {\r\n function Geometry(a, b) {\r\n return new geometries.Instanced2CCylindersGeometry(a, b, useZSprites, openEnded);\r\n }\r\n return {\r\n Geometry,\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedMatrix: true,\r\n attrColor: true,\r\n attrColor2: true,\r\n attrAlphaColor: true,\r\n cylinderSprite: useZSprites,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createLineSegmentsGeoTriplet(geo, renderParams) {\r\n const thickLines = geo.prototype instanceof ThickLinesGeometry;\r\n const lineWidth = renderParams.lineWidth || 0;\r\n return {\r\n Geometry: geo,\r\n Object: thickLines ? meshes.ThickLineMesh : meshes.LineSegments,\r\n initMaterial: setMatParams({\r\n lights: false,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n thickLine: thickLines,\r\n }, {\r\n lineWidth,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createSimpleGeoTriplet(geoClass) {\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.Mesh,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n }),\r\n };\r\n}\r\n\r\nfunction _createIsoSurfaceGeoTriplet(geoClass, caps, settings, renderParams) {\r\n const surfaceOpts = {\r\n wireframe: !!renderParams.wireframe,\r\n fakeOpacity: settings.now.isoSurfaceFakeOpacity,\r\n zClip: renderParams.zClip,\r\n };\r\n return {\r\n Geometry: geoClass,\r\n Object: meshes.ZClipped,\r\n initMaterial: setMatParams({\r\n attrColor: true,\r\n attrAlphaColor: false,\r\n wireframe: surfaceOpts.wireframe,\r\n fakeOpacity: surfaceOpts.fakeOpacity,\r\n zClip: surfaceOpts.zClip,\r\n }),\r\n };\r\n}\r\n\r\nclass MeshCreator {\r\n static createSpheres(caps, settings) {\r\n const useZSprites = settings.now.zSprites;\r\n function Geometry(a, b) {\r\n return new geometries.InstancedSpheresGeometry(a, b, useZSprites);\r\n }\r\n return {\r\n Geometry,\r\n Object: useZSprites ? meshes.ZSprite : meshes.Instanced,\r\n initMaterial: setMatParams({\r\n instancedPos: true,\r\n attrColor: true,\r\n attrAlphaColor: true,\r\n sphereSprite: useZSprites,\r\n }),\r\n };\r\n }\r\n\r\n static create2CClosedCylinders(_caps, _settings) {\r\n return _createInstancedCylinders(false, false);\r\n }\r\n\r\n static create2CCylinders(caps, settings) {\r\n return _createInstancedCylinders(settings.now.zSprites, true);\r\n }\r\n\r\n static create2CLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.TwoColorLinesGeometry, renderParams);\r\n }\r\n\r\n static createCrosses(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.CrossGeometry, renderParams);\r\n }\r\n\r\n static createExtrudedChains(_caps, _settings) {\r\n return _createSimpleGeoTriplet(geometries.ExtrudedObjectsGeometry);\r\n }\r\n\r\n static createChunkedLines(_caps, _settings, renderParams) {\r\n return _createLineSegmentsGeoTriplet(geometries.ChunkedLinesGeometry, renderParams);\r\n }\r\n\r\n static createQuickSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.QuickSurfGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createContactSurface(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.ContactSurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createSASSES(caps, settings, renderParams) {\r\n return _createIsoSurfaceGeoTriplet(geometries.SSIsosurfaceGeometry, caps, settings, renderParams);\r\n }\r\n\r\n static createLabels(_caps, _settings) {\r\n return {\r\n Geometry: geometries.LabelsGeometry,\r\n Object: meshes.Text,\r\n initMaterial() {\r\n },\r\n };\r\n }\r\n}\r\n\r\nexport default MeshCreator;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../gfxutils';\r\n\r\nclass TransformGroup extends THREE.Object3D {\r\n static _inverseMatrix = new THREE.Matrix4();\r\n\r\n static _ray = new THREE.Ray();\r\n\r\n constructor(geometry, geoParams, material, transforms) {\r\n super();\r\n this._geometry = geometry;\r\n this._geoParams = geoParams;\r\n const mat = material.createInstance();\r\n geoParams.initMaterial(mat);\r\n this._material = mat;\r\n this._transforms = transforms.length > 0 ? transforms : [new THREE.Matrix4()];\r\n const meshes = this._createMeshes(geometry);\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n this.add(meshes[i]);\r\n }\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const ray = TransformGroup._ray;\r\n const inverseMatrix = TransformGroup._inverseMatrix;\r\n const { children } = this;\r\n ray.copy(raycaster.ray);\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n\r\n if (!gfxutils.belongToSelectLayers(child)) {\r\n continue;\r\n }\r\n\r\n child.updateMatrixWorld();\r\n const mtx = child.matrixWorld;\r\n inverseMatrix.copy(mtx).invert();\r\n raycaster.ray.copy(ray).applyMatrix4(inverseMatrix);\r\n const childIntersects = [];\r\n this._geometry.raycast(raycaster, childIntersects);\r\n\r\n for (let j = 0, ciCount = childIntersects.length; j < ciCount; ++j) {\r\n const inters = childIntersects[j];\r\n if (inters.point) {\r\n inters.point.applyMatrix4(mtx);\r\n inters.distance = ray.origin.distanceTo(inters.point);\r\n }\r\n inters.object = child;\r\n intersects[intersects.length] = inters;\r\n }\r\n }\r\n raycaster.ray.copy(ray);\r\n }\r\n\r\n getSubset(chunkIndices) {\r\n const geos = this._geometry.getSubset(chunkIndices);\r\n const subset = [];\r\n let subIdx = 0;\r\n\r\n for (let i = 0, n = geos.length; i < n; ++i) {\r\n const meshes = this._createMeshes(geos[i]);\r\n for (let j = 0, meshCnt = meshes.length; j < meshCnt; ++j) {\r\n subset[subIdx++] = meshes[j];\r\n }\r\n }\r\n\r\n return subset;\r\n }\r\n\r\n _createMeshes(geometry) {\r\n const transforms = this._transforms;\r\n const Mesh = this._geoParams.Object;\r\n const material = this._material;\r\n const meshes = [];\r\n for (let i = 0, n = transforms.length; i < n; ++i) {\r\n const mesh = new Mesh(geometry, material);\r\n mesh.applyMatrix4(transforms[i]);\r\n meshes[i] = mesh;\r\n }\r\n\r\n return meshes;\r\n }\r\n}\r\n\r\nexport default TransformGroup;\r\n","import RCGroup from '../../RCGroup';\r\nimport TransformGroup from '../../meshes/TransformGroup';\r\n\r\nfunction wrapper(Name, args) {\r\n const params = [Name].concat(args);\r\n return Name.bind(...params);\r\n}\r\n\r\nclass ChemGroup extends RCGroup {\r\n constructor(geoParams, selection, colorer, mode, transforms, polyComplexity, material) {\r\n super();\r\n if (this.constructor === ChemGroup) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n this._selection = selection;\r\n this._mode = mode;\r\n this._colorer = colorer;\r\n this._chunksIdc = selection.chunks;\r\n this._polyComplexity = polyComplexity;\r\n this._geo = new (wrapper(geoParams.Geometry, this._makeGeoArgs()))();\r\n this._mesh = new TransformGroup(this._geo, geoParams, material, transforms);\r\n this.add(this._mesh);\r\n this._build();\r\n }\r\n\r\n _makeGeoArgs() {\r\n throw new Error('ChemGroup subclass must override _makeGeoArgs() method');\r\n }\r\n\r\n /**\r\n * Builds subset geometry by ATOMS index list\r\n *\r\n * @param {Number} mask - Representation mask\r\n * @param {Boolean} innerOnly - if true returns inner bonds only - without halves\r\n * @returns {Array} Subset geometry\r\n */\r\n getSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : false;\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return [];\r\n }\r\n return this._mesh.getSubset(chunksList);\r\n }\r\n\r\n _changeSubsetOpacity(mask, value, innerOnly) {\r\n const chunksList = this._calcChunksList(mask, innerOnly);\r\n if (chunksList.length === 0) {\r\n return;\r\n }\r\n this._geo.setOpacity(chunksList, value);\r\n }\r\n\r\n enableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 1.0, innerOnly);\r\n }\r\n\r\n disableSubset(mask, innerOnly) {\r\n innerOnly = innerOnly !== undefined ? innerOnly : true;\r\n this._changeSubsetOpacity(mask, 0.0, innerOnly);\r\n }\r\n}\r\n\r\nexport default ChemGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass AtomsGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { atoms } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const atomsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const atomIdx = atomsIdc[inters[i].chunkIdx];\r\n if (atomIdx < atoms.length) {\r\n inters[i].atom = atoms[atomIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { atoms } = this._selection;\r\n const atomsIdc = this._chunksIdc;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n if ((atom.mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default AtomsGroup;\r\n","import AtomsGroup from './AtomsGroup';\r\n\r\nclass AtomsSphereGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, atom.position, mode.calcAtomRadius(atom));\r\n geo.setColor(i, colorer.getAtomColor(atom, parent));\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), mode.calcAtomRadius(atom));\r\n if (updateColor) {\r\n geo.setColor(i, frameData.getAtomColor(colorer, atom));\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsSphereGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSurfaceGroup extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n return [n, opts];\r\n }\r\n}\r\nexport default AtomsSurfaceGroup;\r\n","/* This is a stub class keep it until SAS/SES is refactored */\r\n\r\nimport AtomsSphereGroup from './AtomsSphereGroup';\r\n\r\nclass AtomsSASSESGroupStub extends AtomsSphereGroup {\r\n _makeGeoArgs() {\r\n const selectedAtoms = [];\r\n const { atoms, chunks } = this._selection;\r\n const n = chunks.length;\r\n for (let i = 0; i < n; ++i) {\r\n selectedAtoms[i] = atoms[chunks[i]];\r\n }\r\n const opts = this._mode.getSurfaceOpts();\r\n opts.atoms = selectedAtoms;\r\n opts.selection = this._selection;\r\n opts.colorMode = this._colorer;\r\n return [n, opts];\r\n }\r\n}\r\n\r\nexport default AtomsSASSESGroupStub;\r\n","import AtomsGroup from './AtomsGroup';\r\nimport utils from '../../../utils';\r\n\r\nfunction adjustColor(color) {\r\n let r = (color >> 16) & 255;\r\n let g = (color >> 8) & 255;\r\n let b = color & 255;\r\n\r\n if (0.2126 * r + 0.7152 * g + 0.0722 * b > 127) {\r\n r = r * 3 / 10;\r\n g = g * 3 / 10;\r\n b = b * 3 / 10;\r\n } else {\r\n r = 255 - ((255 - r) * 3 / 10);\r\n g = 255 - ((255 - g) * 3 / 10);\r\n b = 255 - ((255 - b) * 3 / 10);\r\n }\r\n\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\nfunction inverseColor(color) {\r\n const r = (color >> 16) & 255;\r\n const g = (color >> 8) & 255;\r\n const b = color & 255;\r\n\r\n return ((255 - r) << 16) | ((255 - g) << 8) | (255 - b);\r\n}\r\n\r\nfunction getAtomText(atom) {\r\n if (atom.name.getNode() !== null) {\r\n return atom.name.getNode();\r\n }\r\n\r\n return atom.getVisualName();\r\n}\r\n\r\nconst colorMappings = {\r\n none(c) {\r\n return c;\r\n },\r\n adjust: adjustColor,\r\n inverse: inverseColor,\r\n};\r\n\r\nfunction propagateColor(color, rule) {\r\n let result;\r\n if (colorMappings.hasOwnProperty(rule)) {\r\n result = utils.hexColor(colorMappings[rule](color));\r\n } else {\r\n const val = parseInt(rule, 16);\r\n if (!Number.isNaN(val) && rule.toLowerCase().startsWith('0x')) {\r\n result = utils.hexColor(val);\r\n } else {\r\n result = '#000000';\r\n }\r\n }\r\n return result;\r\n}\r\n\r\nconst templateMappings = {\r\n serial(a) {\r\n return a.serial;\r\n },\r\n name(a) {\r\n return a.getVisualName();\r\n },\r\n elem(a) {\r\n return a.element.name;\r\n },\r\n residue(a) {\r\n return a.residue.getType().getName();\r\n },\r\n sequence(a) {\r\n return a.residue.getSequence();\r\n },\r\n chain(a) {\r\n return a.residue.getChain().getName();\r\n },\r\n hetatm(a) {\r\n return a.isHet();\r\n },\r\n water(a) {\r\n return a.residue.getType().getName() === 'HOH' || a.residue.getType().getName() === 'WAT';\r\n },\r\n};\r\n\r\nconst parseTemplate = function (atom, str) {\r\n return str.replace(/\\{\\{(\\s*\\w+\\s*)\\}\\}/g, (m) => {\r\n let key = m.replace(/\\s+/g, '');\r\n key = key.substring(2, key.length - 2).toLowerCase();\r\n\r\n if (templateMappings.hasOwnProperty(key)) {\r\n return templateMappings[key](atom);\r\n }\r\n return 'null';\r\n });\r\n};\r\n\r\nclass AtomsTextGroup extends AtomsGroup {\r\n _makeGeoArgs() {\r\n const opts = this._mode.getLabelOpts();\r\n return [this._selection.chunks.length, opts];\r\n }\r\n\r\n _build() {\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = colorer.getAtomColor(atom, parent);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, atom.position, text);\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const opts = this._mode.getLabelOpts();\r\n const atomsIdc = this._selection.chunks;\r\n const { atoms } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = atomsIdc.length; i < n; ++i) {\r\n const atom = atoms[atomsIdc[i]];\r\n const text = opts.template ? parseTemplate(atom, opts.template) : getAtomText(atom);\r\n if (!text) {\r\n continue;\r\n }\r\n const color = frameData.getAtomColor(colorer, atom);\r\n const fgColor = parseInt(propagateColor(color, opts.fg).substring(1), 16);\r\n const bgColor = opts.showBg ? parseInt(propagateColor(color, opts.bg).substring(1), 16) : 'transparent';\r\n geo.setItem(i, frameData.getAtomPos(atomsIdc[i]), text);\r\n if (updateColor) {\r\n geo.setColor(i, fgColor, bgColor);\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default AtomsTextGroup;\r\n","import * as THREE from 'three';\r\nimport AtomsGroup from './AtomsGroup';\r\n\r\nfunction _slerp(omega, v1, v2, t) {\r\n const oSin = Math.sin(omega);\r\n return v1.clone().multiplyScalar(Math.sin((1 - t) * omega) / oSin).addScaledVector(v2, Math.sin(t * omega) / oSin);\r\n}\r\n\r\nclass AromaticGroup extends AtomsGroup {\r\n _buildInner(radOffset, addChunk) {\r\n const chunksToIdx = this._selection.chunks;\r\n\r\n const prevVector = new THREE.Vector3();\r\n const currVector = new THREE.Vector3();\r\n const segmentsHeight = this._segmentsHeight;\r\n const leprStep = 1.0 / segmentsHeight;\r\n const colorer = this._colorer;\r\n\r\n const { cycles, parent } = this._selection;\r\n let chunkIdx = 0;\r\n let currAtomIdx = chunksToIdx[chunkIdx];\r\n\r\n for (let cIdx = 0, cCount = cycles.length; cIdx < cCount; ++cIdx) {\r\n const cycle = cycles[cIdx];\r\n const cycAtoms = cycle.atoms;\r\n const chunkPoints = [];\r\n const tmpDir = [];\r\n const { center } = cycle;\r\n const cycleRad = cycle.radius - radOffset;\r\n const n = cycAtoms.length;\r\n let i = 0;\r\n const prevPos = cycAtoms[n - 1].position;\r\n let currPos = cycAtoms[i].position;\r\n prevVector.subVectors(prevPos, center);\r\n currVector.subVectors(currPos, center);\r\n const upDir = currVector.clone().cross(prevVector).normalize();\r\n\r\n for (; i < n; ++i) {\r\n const omega = prevVector.angleTo(currVector);\r\n tmpDir[i] = _slerp(omega, prevVector, currVector, 0.5).normalize();\r\n currPos = cycAtoms[(i + 1) % n].position;\r\n prevVector.copy(currVector);\r\n currVector.subVectors(currPos, center);\r\n }\r\n\r\n for (i = 0; i < n; ++i) {\r\n if (cycAtoms[i].index !== currAtomIdx) {\r\n continue;\r\n }\r\n const start = tmpDir[i];\r\n const end = tmpDir[(i + 1) % n];\r\n const color = colorer.getAtomColor(cycAtoms[i], parent);\r\n const currAngle = start.angleTo(end);\r\n\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n chunkPoints[j] = _slerp(currAngle, start, end, j * leprStep).multiplyScalar(cycleRad).add(center);\r\n }\r\n\r\n addChunk(chunkIdx++, color, chunkPoints, center, upDir);\r\n currAtomIdx = chunksToIdx[chunkIdx];\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default AromaticGroup;\r\n","import * as THREE from 'three';\r\nimport gfxutils from '../../gfxutils';\r\nimport AromaticGroup from './AromaticGroup';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n for (let i = 0; i < parts; ++i) {\r\n const a = -2 * i / parts * Math.PI;\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\nconst { calcChunkMatrix } = gfxutils;\r\n\r\nclass AromaticTorusGroup extends AromaticGroup {\r\n _build() {\r\n const segmentsHeight = this._segmentsHeight;\r\n const torusRad = this._mode.getAromRadius();\r\n const radiusV = new THREE.Vector2(torusRad, torusRad);\r\n const radOffset = this._mode.calcStickRadius() + 2 * torusRad;\r\n const lookAtVector = new THREE.Vector3();\r\n const mtc = [];\r\n const geo = this._geo;\r\n this._buildInner(radOffset, (chunkIdx, color, points, center, upDir) => {\r\n for (let j = 0; j <= segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n const currDir = currPoint.clone().sub(center).cross(upDir);\r\n lookAtVector.addVectors(currPoint, currDir);\r\n mtc[j] = calcChunkMatrix(currPoint, lookAtVector, upDir, radiusV);\r\n }\r\n geo.setItem(chunkIdx, mtc);\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._polyComplexity;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length];\r\n }\r\n}\r\n\r\nexport default AromaticTorusGroup;\r\n","import AromaticGroup from './AromaticGroup';\r\n\r\nclass AromaticLinesGroup extends AromaticGroup {\r\n _build() {\r\n const geo = this._geo;\r\n const radOffset = this._mode.getAromaticOffset();\r\n this._buildInner(radOffset, (chunkIdx, color, points) => {\r\n let prevPt = points[0];// do not replace with start\r\n for (let j = 1; j <= this._segmentsHeight; ++j) {\r\n const currPoint = points[j];\r\n geo.setSegment(chunkIdx, j - 1, prevPt, currPoint);\r\n prevPt = currPoint;\r\n }\r\n geo.setColor(chunkIdx, color);\r\n });\r\n geo.finalize();\r\n }\r\n\r\n _makeGeoArgs() {\r\n this._segmentsHeight = this._mode.getAromaticArcChunks();\r\n return [this._selection.chunks.length, this._segmentsHeight, true];\r\n }\r\n}\r\n\r\nexport default AromaticLinesGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesGroup extends ChemGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[inters[i].chunkIdx];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList.push(i);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesGroup;\r\n","import ResiduesGroup from './ResiduesGroup';\r\n\r\nclass NucleicItemGroup extends ResiduesGroup {\r\n raycast(raycaster, intersects) {\r\n const { residues } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const resIdx = chunksIdc[Math.floor(inters[i].chunkIdx / 2)];\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finalize();\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n let chunkIdx = 0;\r\n const { residues } = this._selection;\r\n const resIdc = this._chunksIdc;\r\n\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n if ((res._mask & mask) !== 0) {\r\n chunksList[chunkIdx++] = 2 * i;\r\n chunksList[chunkIdx++] = 2 * i + 1;\r\n }\r\n }\r\n return chunksList;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const stickRad = this._mode.calcStickRadius();\r\n let chunkIdx = 0;\r\n\r\n const resIdc = this._selection.chunks;\r\n for (let i = 0, n = resIdc.length; i < n; ++i) {\r\n const res = residues[resIdc[i]];\r\n const color = colorer.getResidueColor(res, parent);\r\n this._processItem(chunkIdx++, res._cylinders[0], res._cylinders[1], stickRad, color);\r\n }\r\n geo.finishUpdate();\r\n }\r\n}\r\n\r\nexport default NucleicItemGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicCylindersGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n geo.setItem(chunkIdx, cyl1, cyl2, stickRad);\r\n geo.setColor(chunkIdx, color, color);\r\n }\r\n}\r\n\r\nexport default NucleicCylindersGroup;\r\n","import NucleicItemGroup from './NucleicItemGroup';\r\n\r\nclass NucleicSpheresGroup extends NucleicItemGroup {\r\n _makeGeoArgs() {\r\n return [this._selection.chunks.length * 2, this._polyComplexity];\r\n }\r\n\r\n _processItem(chunkIdx, cyl1, cyl2, stickRad, color) {\r\n const geo = this._geo;\r\n let idx = chunkIdx * 2;\r\n geo.setItem(idx, cyl1, stickRad);\r\n geo.setColor(idx, color);\r\n idx++;\r\n geo.setItem(idx, cyl2, stickRad);\r\n geo.setColor(idx, color);\r\n }\r\n}\r\n\r\nexport default NucleicSpheresGroup;\r\n","import * as THREE from 'three';\r\nimport { Smooth } from '../../../../vendor/js/Smooth';\r\nimport gfxutils from '../../gfxutils';\r\nimport chem from '../../../chem';\r\n\r\nconst { ResidueType } = chem;\r\n\r\nconst calcMatrix = gfxutils.calcChunkMatrix;\r\n\r\nfunction _buildStructureInterpolator(points, tension) {\r\n const path = Smooth(points, {\r\n method: Smooth.METHOD_CUBIC,\r\n clip: Smooth.CLIP_CLAMP,\r\n cubicTension: tension,\r\n scaleTo: 1,\r\n });\r\n\r\n return function (t, argTrans) {\r\n let transformT = argTrans;\r\n if (transformT === null) {\r\n // map our range to the [second .. last but one]\r\n transformT = function (tt) {\r\n return (tt * ((points.length - 1) - 2) + 1) / (points.length - 1);\r\n };\r\n }\r\n const newt = transformT(t);\r\n const ans = path(newt);\r\n return new THREE.Vector3(ans[0], ans[1], ans[2]);\r\n };\r\n}\r\n\r\nfunction _addPoints(centerPoints, topPoints, idx, residue) {\r\n if (!residue._isValid) {\r\n centerPoints[idx] = centerPoints[idx - 1];\r\n topPoints[idx] = topPoints[idx - 1];\r\n return;\r\n }\r\n const cp = residue._controlPoint;\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n const tp = cp.clone().add(residue._wingVector);\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n}\r\n\r\nfunction _addPointsForLoneResidue(centerPoints, topPoints, idx, residue) {\r\n const nucleic = (residue._type.flags & ResidueType.Flags.NUCLEIC) !== 0;\r\n const nameFrom = nucleic ? 'C5\\'' : 'N';\r\n const nameTo = nucleic ? 'C3\\'' : 'C';\r\n\r\n let posFrom;\r\n let posTo;\r\n residue.forEachAtom((atom) => {\r\n const name = atom.getVisualName();\r\n if (!posFrom && name === nameFrom) {\r\n posFrom = atom.position;\r\n } else if (!posTo && name === nameTo) {\r\n posTo = atom.position;\r\n }\r\n });\r\n\r\n // provide a fallback for unknown residues\r\n if (!(posFrom && posTo)) {\r\n posFrom = residue._firstAtom.position;\r\n posTo = residue._lastAtom.position;\r\n }\r\n\r\n if (posFrom && posTo) {\r\n const shift = posTo.clone().sub(posFrom);\r\n\r\n const wing = residue._wingVector;\r\n const cp = residue._controlPoint;\r\n const tp = cp.clone().add(wing);\r\n\r\n const cpPrev = cp.clone().sub(shift);\r\n const tpPrev = cpPrev.clone().add(wing);\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n centerPoints[idx] = [cpPrev.x, cpPrev.y, cpPrev.z];\r\n topPoints[idx] = [tpPrev.x, tpPrev.y, tpPrev.z];\r\n ++idx;\r\n\r\n centerPoints[idx] = [cp.x, cp.y, cp.z];\r\n topPoints[idx] = [tp.x, tp.y, tp.z];\r\n ++idx;\r\n\r\n const cpNext = cp.clone().add(shift);\r\n const tpNext = cpNext.clone().add(wing);\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n ++idx;\r\n centerPoints[idx] = [cpNext.x, cpNext.y, cpNext.z];\r\n topPoints[idx] = [tpNext.x, tpNext.y, tpNext.z];\r\n }\r\n}\r\n\r\nfunction _calcPoints(residues, firstIdx, lastIdx, boundaries) {\r\n const left = boundaries.start;\r\n const right = boundaries.end;\r\n function _prevIdx(idx) {\r\n return idx > left && residues[idx - 1]._isValid ? idx - 1 : idx;\r\n }\r\n function _nextIdx(idx) {\r\n return idx < right && residues[idx + 1]._isValid ? idx + 1 : idx;\r\n }\r\n\r\n const topPoints = [];\r\n const centerPoints = [];\r\n let arrIdx = 0;\r\n function _extrapolate2(currIdx, otherIdx) {\r\n const cp = residues[currIdx]._controlPoint.clone().lerp(residues[otherIdx]._controlPoint, -0.25);\r\n const tp = cp.clone().add(residues[currIdx]._wingVector);\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n centerPoints[arrIdx] = [cp.x, cp.y, cp.z];\r\n topPoints[arrIdx++] = [tp.x, tp.y, tp.z];\r\n }\r\n\r\n // a single disconnected residue\r\n const prevIdx = _prevIdx(firstIdx);\r\n const nextIdx = _nextIdx(lastIdx);\r\n if (prevIdx === nextIdx) {\r\n _addPointsForLoneResidue(centerPoints, topPoints, arrIdx, residues[firstIdx]);\r\n return { centerPoints, topPoints };\r\n }\r\n\r\n // Two points (prev-prev and next-next) are added to support edge conditions for cubic splines, they are ignored\r\n // Another two (prev and next) were added to support the outside of the sub chain\r\n\r\n // prev and prev-prev\r\n if (firstIdx === prevIdx) {\r\n // do the extrapolation\r\n _extrapolate2(firstIdx, _nextIdx(firstIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[_prevIdx(prevIdx)]);\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[prevIdx]);\r\n }\r\n\r\n // main loop\r\n for (let idx = firstIdx; idx <= lastIdx; ++idx) {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[idx]);\r\n }\r\n\r\n // next and next-next\r\n if (nextIdx === _nextIdx(nextIdx)) {\r\n // do the extrapolation\r\n _extrapolate2(lastIdx, _prevIdx(lastIdx));\r\n } else {\r\n _addPoints(centerPoints, topPoints, arrIdx++, residues[nextIdx]);\r\n _addPoints(centerPoints, topPoints, arrIdx, residues[_nextIdx(nextIdx)]);\r\n }\r\n return { centerPoints, topPoints };\r\n}\r\n\r\nclass CartoonHelper {\r\n constructor(residues, startIdx, endIdx, segmentsCount, tension, boundaries) {\r\n const pointsArrays = _calcPoints(residues, startIdx, endIdx, boundaries);\r\n this._topInterp = _buildStructureInterpolator(pointsArrays.topPoints, tension);\r\n this._centerInterp = _buildStructureInterpolator(pointsArrays.centerPoints, tension);\r\n\r\n this._shift = 0.5 / (endIdx - startIdx + 2);\r\n this._valueStep = (1.0 - 2 * this._shift) / (2 * (endIdx - startIdx + 1) * (segmentsCount - 1));\r\n this._segmentsCount = segmentsCount;\r\n }\r\n\r\n prepareMatrices(idx, firstRad, secondRad) {\r\n const mtcCount = this._segmentsCount;\r\n const outMtc = new Array(mtcCount);\r\n const currRad = new THREE.Vector2(0, 0);\r\n\r\n const topInterp = this._topInterp;\r\n const cenInterp = this._centerInterp;\r\n\r\n let currentValue = this._shift + this._valueStep * (mtcCount - 1) * idx;\r\n\r\n for (let mtxIdx = 0; mtxIdx < mtcCount; ++mtxIdx) {\r\n const lerpVal = Math.min(1.0, mtxIdx / (mtcCount - 1));\r\n currRad.lerpVectors(firstRad, secondRad, lerpVal);\r\n\r\n const currTop = topInterp(currentValue, null);\r\n const currCenter = cenInterp(currentValue, null);\r\n currentValue += this._valueStep;\r\n const nextCenter = cenInterp(currentValue, null);\r\n\r\n outMtc[mtxIdx] = calcMatrix(currCenter.clone(), nextCenter.clone(), currTop.clone().sub(currCenter), currRad);\r\n }\r\n\r\n return outMtc;\r\n }\r\n}\r\n\r\nexport default CartoonHelper;\r\n","import * as THREE from 'three';\r\nimport ResiduesGroup from './ResiduesGroup';\r\nimport CartoonHelper from './CartoonHelper';\r\n\r\nfunction _createShape(rad, parts) {\r\n const pts = [];\r\n\r\n for (let i = 0; i < parts; ++i) {\r\n // starts from pi/2 because it's important that points are lied on the angles of arrows (visual issues if not)\r\n const a = Math.PI / 2.0 - 2 * Math.PI * i / parts;\r\n\r\n pts.push(new THREE.Vector3(Math.cos(a) * rad, Math.sin(a) * rad, 0));\r\n }\r\n return pts;\r\n}\r\n\r\nfunction _loopThrough(subDiv, residues, segmentsHeight, tension, mode, callback) {\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n const { boundaries } = subDiv[subDivI];\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const idc = [subs[i].start, subs[i].end];\r\n const matrixHelper = new CartoonHelper(residues, idc[0], idc[1], segmentsHeight, tension, boundaries);\r\n let prevLast = null;\r\n const startIdx = subs[i].start * 2;\r\n const endIdx = subs[i].end * 2 + 1;\r\n let prevSecondRad = mode.getResidueRadius(residues[0], 0);\r\n for (let idx = startIdx; idx <= endIdx; ++idx) {\r\n const resIdx = (idx / 2 | 0);\r\n const currRes = residues[resIdx];\r\n const firstRad = mode.getResidueRadius(currRes, idx % 2);\r\n const secondRad = mode.getResidueRadius(currRes, 1 + (idx % 2));\r\n\r\n const mtc = matrixHelper.prepareMatrices(idx - idc[0] * 2, firstRad, secondRad);\r\n mtc.unshift(prevLast === null ? mtc[0] : prevLast);\r\n\r\n // Slope - radius is changed along this residue part\r\n const hasSlope = (firstRad.x !== secondRad.x) || (firstRad.y !== secondRad.y);\r\n // Cut - end radius of previous part not equal to start radius of this part. First section of this part lies in the orthogonal plane\r\n const hasCut = (firstRad.x !== prevSecondRad.x) || (firstRad.y !== prevSecondRad.y);\r\n\r\n callback(currRes, mtc, hasSlope, hasCut);\r\n\r\n prevLast = mtc[segmentsHeight];\r\n prevSecondRad = secondRad;\r\n }\r\n }\r\n }\r\n}\r\n\r\nclass ResiduesSubseqGroup extends ResiduesGroup {\r\n _makeGeoArgs() {\r\n const cmpMultiplier = this._mode.getHeightSegmentsRatio();\r\n this._segmentsHeight = this._polyComplexity * cmpMultiplier | 0;\r\n return [_createShape(1.0, this._polyComplexity), this._segmentsHeight + 1, this._selection.chunks.length * 2];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n _loopThrough(this._selection.subdivs, residues, this._segmentsHeight, tension, mode, (currRes, mtc, hasSlope = false, hasCut = false) => {\r\n const color = colorer.getResidueColor(currRes, parent);\r\n chunkIdc[chunkIdx] = currRes._index;\r\n geo.setItem(chunkIdx, mtc, hasSlope, hasCut);\r\n geo.setColor(chunkIdx++, color);\r\n });\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const tension = mode.getTension();\r\n const geo = this._geo;\r\n const frameRes = frameData.getResidues();\r\n let chunkIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n _loopThrough(this._selection.subdivs, frameRes, this._segmentsHeight, tension, mode, (currRes, mtc) => {\r\n geo.setItem(chunkIdx, mtc);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n });\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default ResiduesSubseqGroup;\r\n","import ChemGroup from './ChemGroup';\r\n\r\nclass ResiduesTraceGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const subDiv = this._selection.subdivs;\r\n let chunksCount = 0;\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n chunksCount += subs[i].end - subs[i].start;\r\n }\r\n }\r\n return [chunksCount, this._polyComplexity];\r\n }\r\n\r\n _build() {\r\n const { residues, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const chunkIdc = [];\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n chunkIdc[chunkIdx] = { first: prevRes._index, second: currRes._index };\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n this._chunksIdc = chunkIdc;\r\n geo.finalize();\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n\r\n const residues = frameData.getResidues();\r\n const { parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n let chunkIdx = 0;\r\n const subDiv = this._selection.subdivs;\r\n const stickRad = mode.calcStickRadius();\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n\r\n for (let subDivI = 0, subDivN = subDiv.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDiv[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n const startIdx = subs[i].start;\r\n const endIdx = subs[i].end;\r\n let prevRes = residues[startIdx];\r\n for (let idx = startIdx + 1; idx <= endIdx; ++idx) {\r\n const currRes = residues[idx];\r\n geo.setItem(chunkIdx, prevRes._controlPoint, currRes._controlPoint, stickRad);\r\n if (updateColor) {\r\n geo.setColor(chunkIdx, colorer.getResidueColor(prevRes, parent), colorer.getResidueColor(currRes, parent));\r\n }\r\n chunkIdx++;\r\n prevRes = currRes;\r\n }\r\n }\r\n }\r\n\r\n geo.finalize();\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const inters = [];\r\n const { residues } = this._selection;\r\n this._mesh.raycast(raycaster, inters);\r\n const chunksToIdx = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const chunk = chunksToIdx[Math.floor(chunkIdx / 2)];\r\n const resIdx = chunkIdx % 2 === 0 ? chunk.first : chunk.second;\r\n if (resIdx < residues.length) {\r\n inters[i].residue = residues[resIdx];\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask) {\r\n const chunksList = [];\r\n const chunksToIdx = this._chunksIdc;\r\n const { residues } = this._selection;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const chunk = chunksToIdx[i];\r\n if (residues[chunk.first]._mask & mask) {\r\n chunksList.push(i * 2);\r\n }\r\n if (residues[chunk.second]._mask & mask) {\r\n chunksList.push(i * 2 + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default ResiduesTraceGroup;\r\n","import ChemGroup from './ChemGroup';\r\nimport Bond from '../../../chem/Bond';\r\n\r\nfunction getCylinderCount(bondOrder) {\r\n return bondOrder < 2 ? 1 : bondOrder;\r\n}\r\n\r\nclass BondsGroup extends ChemGroup {\r\n _makeGeoArgs() {\r\n const drawMultiple = this._mode.drawMultiorderBonds();\r\n const showAromatic = this._mode.showAromaticLoops();\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n let bondsCount = 0;\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n bondsCount += this.getBondOrder(bonds[bondsIdc[i]], drawMultiple, showAromatic);\r\n }\r\n return [bondsCount, this._polyComplexity];\r\n }\r\n\r\n getBondOrder(bond, drawMultiple, showAromatic) {\r\n let bondOrder = 1;\r\n if (drawMultiple && (!showAromatic || bond._type !== Bond.BondType.AROMATIC)) {\r\n bondOrder = getCylinderCount(bond._order);\r\n }\r\n return bondOrder;\r\n }\r\n\r\n raycast(raycaster, intersects) {\r\n const { bonds } = this._selection;\r\n const inters = [];\r\n this._mesh.raycast(raycaster, inters);\r\n const bondsIdc = this._chunksIdc;\r\n // process inters array - arr object references\r\n for (let i = 0, n = inters.length; i < n; ++i) {\r\n if (!inters[i].hasOwnProperty('chunkIdx')) {\r\n continue;\r\n }\r\n const { chunkIdx } = inters[i];\r\n const bondIdx = bondsIdc[Math.floor(chunkIdx / 2)];\r\n if (bondIdx < bonds.length) {\r\n const bond = bonds[bondIdx];\r\n inters[i].atom = chunkIdx % 2 === 0 ? bond._left : bond._right;\r\n intersects.push(inters[i]);\r\n }\r\n }\r\n }\r\n\r\n _calcChunksList(mask, innerOnly) {\r\n const chunksList = [];\r\n const { bonds } = this._selection;\r\n const chunksToIdx = this._chunksIdc;\r\n for (let i = 0, n = chunksToIdx.length; i < n; ++i) {\r\n const bond = bonds[chunksToIdx[i]];\r\n if ((bond._left.mask & mask) && (!innerOnly || (bond._right.mask & mask))) {\r\n chunksList.push(2 * i);\r\n }\r\n if ((bond._right.mask & mask) && (!innerOnly || (bond._left.mask & mask))) {\r\n chunksList.push(2 * i + 1);\r\n }\r\n }\r\n return chunksList;\r\n }\r\n}\r\n\r\nexport default BondsGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nclass BondsCylinderGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const stickRad = mode.calcStickRadius();\r\n const emptyOffset = mode.calcSpaceFraction();\r\n let normDir;\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n normDir = bond.calcNormalDir();\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n const minRad = Math.min(mode.calcAtomRadius(atom1), mode.calcAtomRadius(atom2));\r\n const dist = 2 * minRad / order;\r\n const currStickRad = drawMultiple ? Math.min(stickRad, dist * 0.5 * (1.0 - emptyOffset)) : stickRad;\r\n\r\n for (let j = 0; j < order; ++j) {\r\n const scale = dist * (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n leftPos.copy(a1Pos);\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.copy(a2Pos);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos, currStickRad);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsCylinderGroup;\r\n","import * as THREE from 'three';\r\nimport BondsGroup from './BondsGroup';\r\n\r\nconst STEP_SIZE = 0.15;\r\n\r\nclass BondsLinesGroup extends BondsGroup {\r\n _build() {\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds, parent } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const chunksToIdx = [];\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = atom1.position;\r\n const a2Pos = atom2.position;\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n chunksToIdx[currBondIdx] = bond._index;\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n geo.setColor(currBondIdx++, colorer.getAtomColor(atom1, parent), colorer.getAtomColor(atom2, parent));\r\n }\r\n }\r\n geo.finalize();\r\n this._chunksIdc = chunksToIdx;\r\n }\r\n\r\n updateToFrame(frameData) {\r\n // This method looks like a copy paste. However, it\r\n // was decided to postpone animation refactoring until GFX is fixed.\r\n const bondsIdc = this._selection.chunks;\r\n const { bonds } = this._selection;\r\n const mode = this._mode;\r\n const colorer = this._colorer;\r\n const geo = this._geo;\r\n const drawMultiple = mode.drawMultiorderBonds();\r\n const showAromatic = mode.showAromaticLoops();\r\n\r\n const bondDir = new THREE.Vector3();\r\n\r\n const leftPos = new THREE.Vector3();\r\n const rightPos = new THREE.Vector3();\r\n let currBondIdx = 0;\r\n const updateColor = frameData.needsColorUpdate(colorer);\r\n for (let i = 0, n = bondsIdc.length; i < n; ++i) {\r\n const bond = bonds[bondsIdc[i]];\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n const a1Pos = frameData.getAtomPos(atom1.index).clone();\r\n const a2Pos = frameData.getAtomPos(atom2.index);\r\n const a1Hangs = atom1.bonds.length === 1;\r\n const a2Hangs = atom2.bonds.length === 1;\r\n bondDir.subVectors(a2Pos, a1Pos);\r\n const len = bondDir.length();\r\n const normDir = bond.calcNormalDir();\r\n\r\n const order = this.getBondOrder(bond, drawMultiple, showAromatic);\r\n\r\n for (let j = 0; j < order; ++j) {\r\n leftPos.copy(a1Pos);\r\n rightPos.copy(a2Pos);\r\n let scale = (order % 2 === 0\r\n ? (((j / 2) | 0) + 0.5) * (1 - 2 * (j % 2))\r\n : (((j + 1) / 2) | 0) * (-1 + 2 * (j % 2)));\r\n if (order === 2 && (!a1Hangs && !a2Hangs)) {\r\n scale -= 0.5;\r\n scale *= -1;\r\n }\r\n\r\n if (!a1Hangs && !a2Hangs && order > 1 && scale !== 0) {\r\n leftPos.lerpVectors(a1Pos, a2Pos, STEP_SIZE / (len));\r\n rightPos.lerpVectors(a1Pos, a2Pos, 1.0 - STEP_SIZE / (len));\r\n }\r\n\r\n scale *= STEP_SIZE;\r\n\r\n leftPos.addScaledVector(normDir, scale);\r\n rightPos.addScaledVector(normDir, scale);\r\n geo.setItem(currBondIdx, leftPos, rightPos);\r\n if (updateColor) {\r\n geo.setColor(currBondIdx, frameData.getAtomColor(colorer, atom1), frameData.getAtomColor(colorer, atom2));\r\n }\r\n currBondIdx++;\r\n }\r\n }\r\n geo.finalize();\r\n }\r\n}\r\n\r\nexport default BondsLinesGroup;\r\n","import AtomsSphereGroup from './AtomsSphereGroup';\r\nimport AtomsSurfaceGroup from './AtomsSurfaceGroup';\r\nimport AtomsSASSESGroupStub from './AtomsSASSESGroupStub';\r\nimport AtomsTextGroup from './AtomsTextGroup';\r\nimport AromaticTorusGroup from './AromaticTorusGroup';\r\nimport AromaticLinesGroup from './AromaticLinesGroup';\r\nimport NucleicCylindersGroup from './NucleicCylindersGroup';\r\nimport NucleicSpheresGroup from './NucleicSpheresGroup';\r\nimport ResiduesSubseqGroup from './ResiduesSubseqGroup';\r\nimport ResiduesTraceGroup from './ResiduesTraceGroup';\r\nimport BondsCylinderGroup from './BondsCylinderGroup';\r\nimport BondsLinesGroup from './BondsLinesGroup';\r\n\r\nexport default {\r\n AtomsSphereGroup,\r\n AtomsSurfaceGroup,\r\n AtomsSASSESGroupStub,\r\n AtomsTextGroup,\r\n AromaticTorusGroup,\r\n AromaticLinesGroup,\r\n NucleicCylindersGroup,\r\n NucleicSpheresGroup,\r\n ResiduesSubseqGroup,\r\n ResiduesTraceGroup,\r\n BondsCylinderGroup,\r\n BondsLinesGroup,\r\n};\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AtomsProcessor extends RCGroup {\r\n constructor(AtomsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n this._mode = mode;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let atomCount = 0;\r\n component.forEachAtom((atom) => {\r\n if (!self._checkAtom(atom, mask)) {\r\n return;\r\n }\r\n atomsIdc[atomCount++] = atom.index;\r\n });\r\n if (atomCount === 0) {\r\n return;\r\n }\r\n const atomsGroup = new AtomsGroup(geoParams, {\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n _checkAtom(atom, mask) {\r\n return atom.mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AtomsProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\n\r\nclass OrphanAtomsProcessor extends AtomsProcessor {\r\n _checkAtom(atom, mask) {\r\n if (!(atom.mask & mask)) {\r\n return false;\r\n }\r\n\r\n const { bonds } = atom;\r\n for (let i = 0, n = bonds.length; i < n; ++i) {\r\n if ((bonds[i]._left.mask & mask) && (bonds[i]._right.mask & mask)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n\r\nexport default OrphanAtomsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass ResiduesProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n component.forEachResidue((residue) => {\r\n if (self._checkResidue(residue, mask)) {\r\n resIdc[chunksCount++] = residue._index;\r\n }\r\n });\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n checkResidue(residue, mask) {\r\n return residue._mask & mask;\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default ResiduesProcessor;\r\n","import ResidueProcessor from './ResiduesProcessor';\r\n\r\nclass NucleicProcessor extends ResidueProcessor {\r\n _checkResidue(residue, mask) {\r\n return mask & residue._mask && residue._cylinders !== null;\r\n }\r\n}\r\nexport default NucleicProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass SubseqsProcessor extends RCGroup {\r\n constructor(ResidueGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const residues = complex.getResidues();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const subDivs = component.getMaskedSubdivSequences(mask);\r\n\r\n let chunksCount = 0;\r\n const resIdc = [];\r\n for (let subDivI = 0, subDivN = subDivs.length; subDivI < subDivN; ++subDivI) {\r\n const subs = subDivs[subDivI].arr;\r\n for (let i = 0, n = subs.length; i < n; ++i) {\r\n for (let j = subs[i].start, jEnd = subs[i].end; j <= jEnd; ++j) {\r\n resIdc[chunksCount++] = residues[j]._index;\r\n }\r\n }\r\n }\r\n\r\n if (chunksCount === 0) {\r\n return;\r\n }\r\n const residuesGroup = new ResidueGroup(geoParams, {\r\n residues,\r\n chunks: resIdc,\r\n subdivs: subDivs,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n residuesGroup._component = component;\r\n self.add(residuesGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default SubseqsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass BondsProcessor extends RCGroup {\r\n constructor(BondsGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const bonds = complex.getBonds();\r\n const transforms = complex.getTransforms();\r\n\r\n complex.forEachComponent((component) => {\r\n const bondsIdc = [];\r\n let bondsCount = 0;\r\n component.forEachBond((bond) => {\r\n const atom1 = bond._left;\r\n const atom2 = bond._right;\r\n if (!(atom1.mask & mask) || !(atom2.mask & mask)) {\r\n return;\r\n }\r\n bondsIdc[bondsCount++] = bond._index;\r\n });\r\n if (bondsCount === 0) {\r\n return;\r\n }\r\n const bondsGroup = new BondsGroup(geoParams, {\r\n bonds,\r\n chunks: bondsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n bondsGroup._component = component;\r\n self.add(bondsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default BondsProcessor;\r\n","import RCGroup from '../../RCGroup';\r\n\r\nclass AromaticProcessor extends RCGroup {\r\n constructor(AromaticGroup, geoParams, complex, colorer, mode, polyComplexity, mask, material) {\r\n super();\r\n const self = this;\r\n this._complex = complex;\r\n const atoms = complex.getAtoms();\r\n const transforms = complex.getTransforms();\r\n if (!mode.showAromaticLoops()) {\r\n return;\r\n }\r\n\r\n complex.forEachComponent((component) => {\r\n const atomsIdc = [];\r\n let chunksCount = 0;\r\n const cycles = [];\r\n let cycleIdx = 0;\r\n component.forEachCycle((cycle) => {\r\n const cycAtoms = cycle.atoms;\r\n let perCycle = 0;\r\n for (let i = 0, n = cycAtoms.length; i < n; ++i) {\r\n if ((cycAtoms[i].mask & mask) !== 0) {\r\n ++perCycle;\r\n atomsIdc[chunksCount++] = cycAtoms[i].index;\r\n }\r\n }\r\n if (perCycle > 0) {\r\n cycles[cycleIdx++] = cycle;\r\n }\r\n });\r\n\r\n const atomsGroup = new AromaticGroup(geoParams, {\r\n cycles,\r\n atoms,\r\n chunks: atomsIdc,\r\n parent: complex,\r\n }, colorer, mode, transforms, polyComplexity, material);\r\n atomsGroup._component = component;\r\n self.add(atomsGroup);\r\n });\r\n }\r\n\r\n getSubset(mask, innerOnly) {\r\n const totalSubset = [];\r\n const { children } = this;\r\n let meshIdx = 0;\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n if (children[i].getSubset) {\r\n const chSubset = children[i].getSubset(mask, innerOnly);\r\n for (let j = 0, m = chSubset.length; j < m; ++j) {\r\n const subsetEl = chSubset[j];\r\n subsetEl._component = children[i]._component;\r\n totalSubset[meshIdx++] = subsetEl;\r\n }\r\n }\r\n }\r\n return totalSubset;\r\n }\r\n}\r\n\r\nexport default AromaticProcessor;\r\n","import AtomsProcessor from './AtomsProcessor';\r\nimport OrphanAtomsProcessor from './OrphanAtomsProcessor';\r\nimport ResiduesProcessor from './ResiduesProcessor';\r\nimport NucleicProcessor from './NucleicProcessor';\r\nimport SubseqsProcessor from './SubseqsProcessor';\r\nimport BondsProcessor from './BondsProcessor';\r\nimport AromaticProcessor from './AromaticProcessor';\r\n\r\nexport default {\r\n Atoms: AtomsProcessor,\r\n OrphanAtoms: OrphanAtomsProcessor,\r\n Residues: ResiduesProcessor,\r\n Nucleic: NucleicProcessor,\r\n Subseqs: SubseqsProcessor,\r\n Bonds: BondsProcessor,\r\n Aromatic: AromaticProcessor,\r\n};\r\n","import MeshCreator from '../../meshes/MeshCreator';\r\nimport groups from './groups';\r\nimport processors from '../processors/processors';\r\n\r\nfunction _bakeGroup(triplet, Processor, Group) {\r\n return function (complex, colorer, mode, polyComplexity, mask, material) {\r\n return new Processor(Group, triplet, complex, colorer, mode, polyComplexity, mask, material);\r\n };\r\n}\r\n\r\nclass GroupsFactory {\r\n static AtomsSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static OrphanedAtomsCrosses(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createCrosses(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.OrphanAtoms, groups.AtomsSphereGroup);\r\n }\r\n\r\n static BondsCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsCylinderGroup);\r\n }\r\n\r\n static BondsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.create2CLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Bonds, groups.BondsLinesGroup);\r\n }\r\n\r\n static CartoonChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesSubseqGroup);\r\n }\r\n\r\n static TraceChains(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CClosedCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Subseqs, groups.ResiduesTraceGroup);\r\n }\r\n\r\n static NucleicSpheres(caps, settings) {\r\n const gfxTriplet = MeshCreator.createSpheres(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicSpheresGroup);\r\n }\r\n\r\n static NucleicCylinders(caps, settings) {\r\n const gfxTriplet = MeshCreator.create2CCylinders(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Nucleic, groups.NucleicCylindersGroup);\r\n }\r\n\r\n static ALoopsTorus(caps, settings) {\r\n const gfxTriplet = MeshCreator.createExtrudedChains(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticTorusGroup);\r\n }\r\n\r\n static ALoopsLines(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createChunkedLines(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Aromatic, groups.AromaticLinesGroup);\r\n }\r\n\r\n static QuickSurfGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createQuickSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static ContactSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createContactSurface(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSurfaceGroup);\r\n }\r\n\r\n static SASSESSurfaceGeo(caps, settings, renderParams) {\r\n const gfxTriplet = MeshCreator.createSASSES(caps, settings, renderParams);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsSASSESGroupStub);\r\n }\r\n\r\n static TextLabelsGeo(caps, settings) {\r\n const gfxTriplet = MeshCreator.createLabels(caps, settings);\r\n\r\n return _bakeGroup(gfxTriplet, processors.Atoms, groups.AtomsTextGroup);\r\n }\r\n}\r\n\r\nexport default GroupsFactory;\r\n","import _ from 'lodash';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\nimport factory from './groups/GroupsFactory';\r\n\r\n/**\r\n * Create new mode.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the mode after its creation.\r\n *\r\n * @exports Mode\r\n * @this Mode\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available modes used for building and displaying molecule geometry.\r\n */\r\nclass Mode {\r\n constructor(opts) {\r\n if (this.constructor === Mode) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Mode options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(this.settings.now.modes[this.id], true), opts);\r\n }\r\n\r\n /**\r\n * Get mode identification, probably with options.\r\n * @returns {string|Array} Mode identifier string ({@link Mode#id}) or two-element array containing both mode\r\n * identifier and options ({@link Mode#opts}).\r\n * Options are returned if they were changed during or after the mode creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, this.settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const polyComplexity = this.opts.polyComplexity ? this.opts.polyComplexity[this.settings.now.resolution] : 0;\r\n const groupList = this.depGroups;\r\n const groupCount = groupList.length;\r\n const group = new gfxutils.RCGroup();\r\n const self = this;\r\n for (let i = 0; i < groupCount; ++i) {\r\n let currGroup = groupList[i];\r\n let renderParams = {};\r\n if (_.isArray(currGroup)) {\r\n renderParams = currGroup[1].call(this);\r\n [currGroup] = currGroup;\r\n }\r\n const Group = factory[currGroup](null, this.settings, renderParams);\r\n const newGroup = new Group(complex, colorer, self, polyComplexity, mask, material);\r\n if (newGroup.children.length > 0) {\r\n group.add(newGroup);\r\n }\r\n }\r\n return group;\r\n }\r\n}\r\n\r\nmakeContextDependent(Mode.prototype);\r\n\r\n/**\r\n* Mode identifier.\r\n* @type {string}\r\n*/\r\nMode.prototype.id = '__';\r\n\r\n/**\r\n * Mode geo groups.\r\n * @type {Array}\r\n */\r\nMode.prototype.depGroups = [];\r\n\r\nexport default Mode;\r\n","import Mode from './Mode';\r\n\r\nfunction getRenderParams() {\r\n return {\r\n lineWidth: this.opts.lineWidth,\r\n };\r\n}\r\n\r\nclass LinesMode extends Mode {\r\n static id = 'LN';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const groups = this.depGroups;\r\n for (let i = 0, n = groups.length; i < n; ++i) {\r\n groups[i] = [groups[i], getRenderParams];\r\n }\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n\r\n calcAtomRadius() {\r\n return this.opts.atom;\r\n }\r\n\r\n getAromaticOffset() {\r\n return this.opts.offsarom;\r\n }\r\n\r\n getAromaticArcChunks() {\r\n return this.opts.chunkarom;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n}\r\n\r\nLinesMode.prototype.id = 'LN';\r\nLinesMode.prototype.name = 'Lines';\r\nLinesMode.prototype.shortName = 'Lines';\r\nLinesMode.prototype.depGroups = [\r\n 'ALoopsLines',\r\n 'BondsLines',\r\n 'OrphanedAtomsCrosses',\r\n];\r\n\r\nexport default LinesMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass LicoriceMode extends Mode {\r\n static id = 'LC';\r\n\r\n calcAtomRadius(_atom) {\r\n return this.opts.bond;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nLicoriceMode.prototype.id = 'LC';\r\nLicoriceMode.prototype.name = 'Licorice';\r\nLicoriceMode.prototype.shortName = 'Licorice';\r\nLicoriceMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default LicoriceMode;\r\n","/* eslint-disable no-magic-numbers */\r\nimport Mode from './Mode';\r\n\r\nclass BallsAndSticksMode extends Mode {\r\n static id = 'BS';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius * this.opts.atom;\r\n }\r\n\r\n calcStickRadius() {\r\n return this.opts.bond;\r\n }\r\n\r\n getAromRadius() {\r\n return this.opts.aromrad;\r\n }\r\n\r\n showAromaticLoops() {\r\n return this.opts.showarom;\r\n }\r\n\r\n calcSpaceFraction() {\r\n return this.opts.space;\r\n }\r\n\r\n drawMultiorderBonds() {\r\n return this.opts.multibond;\r\n }\r\n}\r\n\r\nBallsAndSticksMode.prototype.id = 'BS';\r\nBallsAndSticksMode.prototype.name = 'Balls and Sticks';\r\nBallsAndSticksMode.prototype.shortName = 'Balls';\r\nBallsAndSticksMode.prototype.depGroups = [\r\n 'AtomsSpheres',\r\n 'BondsCylinders',\r\n 'ALoopsTorus',\r\n];\r\n\r\nexport default BallsAndSticksMode;\r\n","import Mode from './Mode';\r\n\r\nclass VanDerWaalsMode extends Mode {\r\n static id = 'VW';\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n}\r\n\r\nVanDerWaalsMode.prototype.id = 'VW';\r\nVanDerWaalsMode.prototype.name = 'Van der Waals';\r\nVanDerWaalsMode.prototype.shortName = 'VDW';\r\nVanDerWaalsMode.prototype.depGroups = ['AtomsSpheres'];\r\n\r\nexport default VanDerWaalsMode;\r\n","import Mode from './Mode';\r\n\r\nclass TraceMode extends Mode {\r\n static id = 'TR';\r\n\r\n calcStickRadius() {\r\n return this.opts.radius;\r\n }\r\n}\r\n\r\nTraceMode.prototype.id = 'TR';\r\nTraceMode.prototype.name = 'Trace';\r\nTraceMode.prototype.shortName = 'Trace';\r\nTraceMode.prototype.depGroups = ['TraceChains'];\r\n\r\nexport default TraceMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass TubeMode extends Mode {\r\n static id = 'TU';\r\n\r\n getResidueRadius(_residue) {\r\n return this.TUBE_RADIUS;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const rad = this.opts.radius;\r\n this.TUBE_RADIUS = new THREE.Vector2(rad, rad);\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nTubeMode.prototype.id = 'TU';\r\nTubeMode.prototype.name = 'Tube';\r\nTubeMode.prototype.shortName = 'Tube';\r\nTubeMode.prototype.depGroups = ['CartoonChains'];\r\n\r\nexport default TubeMode;\r\n","import * as THREE from 'three';\r\nimport Mode from './Mode';\r\n\r\nclass CartoonMode extends Mode {\r\n static id = 'CA';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n // cache for secondary structure options\r\n this.secCache = {};\r\n }\r\n\r\n getResidueStartRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (!second || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return secOpts.start;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueEndRadius(residue) {\r\n const second = residue.getSecondary();\r\n if (second === null || !second.generic) {\r\n return this.TUBE_RADIUS;\r\n }\r\n const secOpts = this.secCache[second.generic];\r\n if (!secOpts) {\r\n return this.TUBE_RADIUS;\r\n }\r\n if (second.term === residue) {\r\n return this.ARROW_END;\r\n }\r\n return secOpts.center;\r\n }\r\n\r\n getResidueRadius(residue, val) {\r\n const startRad = this.getResidueStartRadius(residue);\r\n if (val === 0) {\r\n return startRad;\r\n }\r\n\r\n const endRad = this.getResidueEndRadius(residue);\r\n if (val === 2) {\r\n return endRad;\r\n }\r\n\r\n return startRad.clone().lerp(endRad, val / 2.0);\r\n }\r\n\r\n calcStickRadius(_res) {\r\n return this.opts.radius;\r\n }\r\n\r\n getHeightSegmentsRatio() {\r\n return this.opts.heightSegmentsRatio;\r\n }\r\n\r\n getTension() {\r\n return this.opts.tension;\r\n }\r\n\r\n buildGeometry(complex, colorer, mask, material) {\r\n const tubeRad = this.opts.radius;\r\n const secHeight = this.opts.depth;\r\n\r\n this.TUBE_RADIUS = new THREE.Vector2(tubeRad, tubeRad);\r\n this.ARROW_END = new THREE.Vector2(secHeight, tubeRad);\r\n const secCache = {};\r\n const secData = this.opts.ss;\r\n /* eslint-disable guard-for-in */\r\n for (const prop in secData) {\r\n secCache[prop] = {\r\n center: new THREE.Vector2(secHeight, secData[prop].width),\r\n start: new THREE.Vector2(secHeight, secData[prop].arrow),\r\n };\r\n }\r\n this.secCache = secCache;\r\n /* eslint-enable guard-for-in */\r\n\r\n return Mode.prototype.buildGeometry.call(this, complex, colorer, mask, material);\r\n }\r\n}\r\n\r\nCartoonMode.prototype.id = 'CA';\r\nCartoonMode.prototype.name = 'Cartoon';\r\nCartoonMode.prototype.shortName = 'Cartoon';\r\nCartoonMode.prototype.depGroups = [\r\n 'CartoonChains',\r\n 'NucleicSpheres',\r\n 'NucleicCylinders',\r\n];\r\n\r\nexport default CartoonMode;\r\n","import chem from '../../chem';\r\nimport Mode from './Mode';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction getRenderParams() {\r\n return {\r\n wireframe: this.opts.wireframe,\r\n zClip: this.opts.zClip,\r\n };\r\n}\r\n\r\nclass SurfaceMode extends Mode {\r\n constructor(opts) {\r\n super(opts);\r\n this.depGroups = this.depGroups.slice(0); // clone depGroups to prevent prototype edits\r\n const surfaces = this.surfaceNames;\r\n const groups = this.depGroups;\r\n for (let i = 0, n = surfaces.length; i < n; ++i) {\r\n groups[groups.length] = [surfaces[i], getRenderParams];\r\n }\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getVisibilitySelector() {\r\n let visibilitySelector = null;\r\n if (this.opts.subset !== '') {\r\n const res = selectors.parse(this.opts.subset);\r\n if (!res.error) {\r\n visibilitySelector = res.selector;\r\n }\r\n }\r\n return visibilitySelector;\r\n }\r\n}\r\n\r\nSurfaceMode.prototype.isSurface = true;\r\nSurfaceMode.prototype.surfaceNames = [];\r\n\r\nexport default SurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass QuickSurfaceMode extends SurfaceMode {\r\n static id = 'QS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n useBeads: false,\r\n isoValue: this.opts.isoValue,\r\n gaussLim: this.opts.gaussLim[this.settings.now.resolution],\r\n radScale: this.opts.scale,\r\n gridSpacing: this.opts.gridSpacing[this.settings.now.resolution],\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nQuickSurfaceMode.prototype.id = 'QS';\r\nQuickSurfaceMode.prototype.name = 'Quick Surface';\r\nQuickSurfaceMode.prototype.shortName = 'Quick Surf';\r\nQuickSurfaceMode.prototype.surfaceNames = ['QuickSurfGeo'];\r\n\r\nexport default QuickSurfaceMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass IsoSurfaceMode extends SurfaceMode {\r\n constructor(excludeProbe, opts) {\r\n super(opts);\r\n this._excludeProbe = excludeProbe;\r\n }\r\n\r\n calcAtomRadius(atom) {\r\n return atom.element.radius;\r\n }\r\n\r\n getSurfaceOpts() {\r\n return {\r\n gridSpacing: this.opts.polyComplexity[this.settings.now.resolution],\r\n radScale: this._radScale,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n probeRadius: this.opts.probeRadius,\r\n excludeProbe: this._excludeProbe,\r\n };\r\n }\r\n}\r\n\r\nIsoSurfaceMode.prototype.id = 'SU';\r\nIsoSurfaceMode.prototype.name = 'Surface';\r\nIsoSurfaceMode.prototype.shortName = 'Surface';\r\nIsoSurfaceMode.prototype.surfaceNames = ['SASSESSurfaceGeo'];\r\n\r\nIsoSurfaceMode.prototype._radScale = 1;\r\nIsoSurfaceMode.prototype._excludeProbe = false;\r\n\r\nexport default IsoSurfaceMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSASMode extends IsoSurfaceMode {\r\n static id = 'SA';\r\n\r\n constructor(opts) {\r\n super(false, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSASMode.prototype.id = 'SA';\r\nIsoSurfaceSASMode.prototype.name = 'Solvent Accessible Surface';\r\nIsoSurfaceSASMode.prototype.shortName = 'SAS';\r\n\r\nexport default IsoSurfaceSASMode;\r\n","import IsoSurfaceMode from './IsoSurfaceMode';\r\n\r\nclass IsoSurfaceSESMode extends IsoSurfaceMode {\r\n static id = 'SE';\r\n\r\n constructor(opts) {\r\n super(true, opts);\r\n }\r\n}\r\n\r\nIsoSurfaceSESMode.prototype.id = 'SE';\r\nIsoSurfaceSESMode.prototype.name = 'Solvent Excluded Surface';\r\nIsoSurfaceSESMode.prototype.shortName = 'SES';\r\n\r\nexport default IsoSurfaceSESMode;\r\n","import SurfaceMode from './SurfaceMode';\r\n\r\nclass ContactSurfaceMode extends SurfaceMode {\r\n static id = 'CS';\r\n\r\n getSurfaceOpts() {\r\n return {\r\n probeRadius: this.opts.probeRadius,\r\n radScale: this.opts.polyComplexity[this.settings.now.resolution],\r\n scaleFactor: this.opts.polyComplexity[this.settings.now.resolution],\r\n gridSpacing: 1.0 / this.opts.polyComplexity[this.settings.now.resolution],\r\n isoValue: this.opts.isoValue,\r\n probePositions: this.opts.probePositions,\r\n zClip: this.opts.zClip,\r\n visibilitySelector: this.getVisibilitySelector(),\r\n };\r\n }\r\n}\r\n\r\nContactSurfaceMode.prototype.id = 'CS';\r\nContactSurfaceMode.prototype.name = 'Contact Surface';\r\nContactSurfaceMode.prototype.shortName = 'Contact Surf';\r\nContactSurfaceMode.prototype.isSurface = true;\r\nContactSurfaceMode.prototype.surfaceNames = ['ContactSurfaceGeo'];\r\n\r\nexport default ContactSurfaceMode;\r\n","import _ from 'lodash';\r\nimport Mode from './Mode';\r\n\r\nclass TextMode extends Mode {\r\n static id = 'TX';\r\n\r\n getTemplateOptions() {\r\n return this.opts.template;\r\n }\r\n\r\n getLabelOpts() {\r\n return _.merge(this.opts, {\r\n colors: true,\r\n adjustColor: true,\r\n transparent: true,\r\n });\r\n }\r\n}\r\n\r\nTextMode.prototype.id = 'TX';\r\nTextMode.prototype.name = 'Text mode';\r\nTextMode.prototype.shortName = 'Text';\r\nTextMode.prototype.depGroups = ['TextLabelsGeo'];\r\n\r\nexport default TextMode;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport LinesMode from './modes/LinesMode';\r\nimport LicoriceMode from './modes/LicoriceMode';\r\nimport BallsAndSticksMode from './modes/BallsAndSticksMode';\r\nimport VanDerWaalsMode from './modes/VanDerWaalsMode';\r\nimport TraceMode from './modes/TraceMode';\r\nimport TubeMode from './modes/TubeMode';\r\nimport CartoonMode from './modes/CartoonMode';\r\nimport QuickSurfaceMode from './modes/QuickSurfaceMode';\r\nimport IsoSurfaceSASMode from './modes/IsoSurfaceSASMode';\r\nimport IsoSurfaceSESMode from './modes/IsoSurfaceSESMode';\r\nimport ContactSurfaceMode from './modes/ContactSurfaceMode';\r\nimport TextMode from './modes/TextMode';\r\n\r\nconst modes = new EntityList([\r\n LinesMode,\r\n LicoriceMode,\r\n BallsAndSticksMode,\r\n VanDerWaalsMode,\r\n TraceMode,\r\n TubeMode,\r\n CartoonMode,\r\n QuickSurfaceMode,\r\n IsoSurfaceSASMode,\r\n IsoSurfaceSESMode,\r\n ContactSurfaceMode,\r\n TextMode,\r\n]);\r\n\r\nexport default modes;\r\n","import _ from 'lodash';\r\n\r\nfunction clamp(x, a, b) {\r\n return x <= b ? x < 0 ? 0 : x : b;\r\n}\r\n\r\nfunction lerpColor(c1, c2, alpha) {\r\n const beta = 1 - alpha;\r\n const r1 = (c1 >> 16) & 0xff;\r\n const g1 = (c1 >> 8) & 0xff;\r\n const b1 = c1 & 0xff;\r\n const r2 = (c2 >> 16) & 0xff;\r\n const g2 = (c2 >> 8) & 0xff;\r\n const b2 = c2 & 0xff;\r\n const r = beta * r1 + alpha * r2;\r\n const g = beta * g1 + alpha * g2;\r\n const b = beta * b1 + alpha * b2;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\nclass Palette {\r\n constructor(name, id) {\r\n this.name = name || 'Custom';\r\n this.id = id || 'CP';\r\n }\r\n\r\n getElementColor(name, asIs = false) {\r\n const color = this.elementColors[name];\r\n return color === undefined && !asIs ? this.defaultElementColor : color;\r\n }\r\n\r\n getResidueColor(name, asIs = false) {\r\n const color = this.residueColors[name];\r\n return color === undefined && !asIs ? this.defaultResidueColor : color;\r\n }\r\n\r\n getChainColor(name) {\r\n let chain = name.charCodeAt(0);\r\n chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F)\r\n % this.chainColors.length;\r\n return this.chainColors[chain];\r\n }\r\n\r\n getSecondaryColor(type, asIs = false) {\r\n const color = this.secondaryColors[type];\r\n return color === undefined && !asIs ? this.defaultSecondaryColor : color;\r\n }\r\n\r\n getSequentialColor(index) {\r\n const { colors } = this;\r\n const len = colors.length;\r\n return index < 0 ? colors[(index % len) + len] : colors[index % len];\r\n }\r\n\r\n getGradientColor(value, gradientName) {\r\n const gradient = this.gradients[gradientName];\r\n if (!gradient) {\r\n return this.defaultNamedColor;\r\n }\r\n const count = gradient.length;\r\n const index = value * (count - 1);\r\n let left = Math.floor(index);\r\n const right = clamp(left + 1, 0, count - 1);\r\n left = clamp(left, 0, count - 1);\r\n return lerpColor(gradient[left], gradient[right], index - left);\r\n }\r\n\r\n getNamedColor(name, asIs = false) {\r\n const color = this.namedColors[name];\r\n return color === undefined && !asIs ? this.defaultNamedColor : color;\r\n }\r\n}\r\n\r\n_.assign(Palette.prototype, {\r\n colors: [0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0x808080],\r\n\r\n minRangeColor: 0x000000,\r\n midRangeColor: 0x7F7F7F,\r\n maxRangeColor: 0xFFFFFF,\r\n\r\n defaultElementColor: 0xFFFFFF,\r\n elementColors: {},\r\n\r\n defaultResidueColor: 0xFFFFFF,\r\n residueColors: {},\r\n\r\n chainColors: [0xFFFFFF],\r\n\r\n defaultSecondaryColor: 0xFFFFFF,\r\n secondaryColors: {},\r\n\r\n defaultGradientColor: 0x000000,\r\n\r\n defaultNamedColor: 0xFFFFFF,\r\n namedColorsArray: [\r\n /* eslint-disable no-multi-spaces */\r\n ['indianred', 0xcd5c5c],\r\n ['lightcoral', 0xf08080],\r\n ['salmon', 0xfa8072],\r\n ['darksalmon', 0xe9967a],\r\n ['lightsalmon', 0xffa07a],\r\n ['crimson', 0xdc143c],\r\n ['red', 0xff0000],\r\n ['firebrick', 0xb22222],\r\n ['darkred', 0x8b0000],\r\n ['pink', 0xffc0cb],\r\n ['lightpink', 0xffb6c1],\r\n ['hotpink', 0xff69b4],\r\n ['deeppink', 0xff1493],\r\n ['mediumvioletred', 0xc71585],\r\n ['palevioletred', 0xdb7093],\r\n ['coral', 0xff7f50],\r\n ['tomato', 0xff6347],\r\n ['orangered', 0xff4500],\r\n ['darkorange', 0xff8c00],\r\n ['orange', 0xffa500],\r\n ['gold', 0xffd700],\r\n ['yellow', 0xffff00],\r\n ['lightyellow', 0xffffe0],\r\n ['lemonchiffon', 0xfffacd],\r\n ['lightgoldenrodyellow', 0xfafad2],\r\n ['papayawhip', 0xffefd5],\r\n ['moccasin', 0xffe4b5],\r\n ['peachpuff', 0xffdab9],\r\n ['palegoldenrod', 0xeee8aa],\r\n ['khaki', 0xf0e68c],\r\n ['darkkhaki', 0xbdb76b],\r\n ['lavender', 0xe6e6fa],\r\n ['thistle', 0xd8bfd8],\r\n ['plum', 0xdda0dd],\r\n ['violet', 0xee82ee],\r\n ['orchid', 0xda70d6],\r\n ['fuchsia', 0xff00ff],\r\n ['magenta', 0xff00ff],\r\n ['mediumorchid', 0xba55d3],\r\n ['mediumpurple', 0x9370db],\r\n ['rebeccapurple', 0x663399],\r\n ['blueviolet', 0x8a2be2],\r\n ['darkviolet', 0x9400d3],\r\n ['darkorchid', 0x9932cc],\r\n ['darkmagenta', 0x8b008b],\r\n ['purple', 0x800080],\r\n ['indigo', 0x4b0082],\r\n ['slateblue', 0x6a5acd],\r\n ['mediumslateblue', 0x7b68ee],\r\n ['darkslateblue', 0x483d8b],\r\n ['greenyellow', 0xadff2f],\r\n ['chartreuse', 0x7fff00],\r\n ['lawngreen', 0x7cfc00],\r\n ['lime', 0x00ff00],\r\n ['limegreen', 0x32cd32],\r\n ['palegreen', 0x98fb98],\r\n ['lightgreen', 0x90ee90],\r\n ['mediumspringgreen', 0x00fa9a],\r\n ['springgreen', 0x00ff7f],\r\n ['mediumseagreen', 0x3cb371],\r\n ['seagreen', 0x2e8b57],\r\n ['forestgreen', 0x228b22],\r\n ['green', 0x008000],\r\n ['darkgreen', 0x006400],\r\n ['yellowgreen', 0x9acd32],\r\n ['olivedrab', 0x6b8e23],\r\n ['olive', 0x808000],\r\n ['darkolivegreen', 0x556b2f],\r\n ['mediumaquamarine', 0x66cdaa],\r\n ['darkseagreen', 0x8fbc8f],\r\n ['lightseagreen', 0x20b2aa],\r\n ['darkcyan', 0x008b8b],\r\n ['teal', 0x008080],\r\n ['aqua', 0x00ffff],\r\n ['cyan', 0x00ffff],\r\n ['lightcyan', 0xe0ffff],\r\n ['paleturquoise', 0xafeeee],\r\n ['aquamarine', 0x7fffd4],\r\n ['turquoise', 0x40e0d0],\r\n ['mediumturquoise', 0x48d1cc],\r\n ['darkturquoise', 0x00ced1],\r\n ['cadetblue', 0x5f9ea0],\r\n ['steelblue', 0x4682b4],\r\n ['lightsteelblue', 0xb0c4de],\r\n ['powderblue', 0xb0e0e6],\r\n ['lightblue', 0xadd8e6],\r\n ['skyblue', 0x87ceeb],\r\n ['lightskyblue', 0x87cefa],\r\n ['deepskyblue', 0x00bfff],\r\n ['dodgerblue', 0x1e90ff],\r\n ['cornflowerblue', 0x6495ed],\r\n ['royalblue', 0x4169e1],\r\n ['blue', 0x0000ff],\r\n ['mediumblue', 0x0000cd],\r\n ['darkblue', 0x00008b],\r\n ['navy', 0x000080],\r\n ['midnightblue', 0x191970],\r\n ['cornsilk', 0xfff8dc],\r\n ['blanchedalmond', 0xffebcd],\r\n ['bisque', 0xffe4c4],\r\n ['navajowhite', 0xffdead],\r\n ['wheat', 0xf5deb3],\r\n ['burlywood', 0xdeb887],\r\n ['tan', 0xd2b48c],\r\n ['rosybrown', 0xbc8f8f],\r\n ['sandybrown', 0xf4a460],\r\n ['goldenrod', 0xdaa520],\r\n ['darkgoldenrod', 0xb8860b],\r\n ['peru', 0xcd853f],\r\n ['chocolate', 0xd2691e],\r\n ['saddlebrown', 0x8b4513],\r\n ['sienna', 0xa0522d],\r\n ['brown', 0xa52a2a],\r\n ['maroon', 0x800000],\r\n ['white', 0xffffff],\r\n ['snow', 0xfffafa],\r\n ['honeydew', 0xf0fff0],\r\n ['mintcream', 0xf5fffa],\r\n ['azure', 0xf0ffff],\r\n ['aliceblue', 0xf0f8ff],\r\n ['ghostwhite', 0xf8f8ff],\r\n ['whitesmoke', 0xf5f5f5],\r\n ['seashell', 0xfff5ee],\r\n ['beige', 0xf5f5dc],\r\n ['oldlace', 0xfdf5e6],\r\n ['floralwhite', 0xfffaf0],\r\n ['ivory', 0xfffff0],\r\n ['antiquewhite', 0xfaebd7],\r\n ['linen', 0xfaf0e6],\r\n ['lavenderblush', 0xfff0f5],\r\n ['mistyrose', 0xffe4e1],\r\n ['gainsboro', 0xdcdcdc],\r\n ['lightgray', 0xd3d3d3],\r\n ['silver', 0xc0c0c0],\r\n ['darkgray', 0xa9a9a9],\r\n ['gray', 0x808080],\r\n ['dimgray', 0x696969],\r\n ['lightslategray', 0x778899],\r\n ['slategray', 0x708090],\r\n ['darkslategray', 0x2f4f4f],\r\n ['black', 0x000000],\r\n /* eslint-enable no-multi-spaces */\r\n ],\r\n\r\n namedColors: {},\r\n /* eslint-enable no-magic-numbers */\r\n\r\n gradients: {\r\n rainbow: [\r\n 0x0000ff, // blue\r\n 0x00ffff, // cyan\r\n 0x00ff00, // green\r\n 0xffff00, // yellow\r\n 0xff0000, // red\r\n ],\r\n temp: [\r\n 0x0000ff, // blue\r\n 0x007fff, // light-blue\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n hot: [\r\n 0xffffff, // white\r\n 0xff7f00, // orange\r\n 0xff0000, // red\r\n ],\r\n cold: [\r\n 0xffffff, // white\r\n 0x007fff, // light-blue\r\n 0x0000ff, // blue\r\n ],\r\n 'blue-red': [\r\n 0x0000ff, // blue\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n reds: [\r\n 0xffffff, // white\r\n 0xff0000, // red\r\n ],\r\n blues: [\r\n 0xffffff, // white\r\n 0x0000ff, // blue\r\n ],\r\n },\r\n});\r\n\r\nconst { namedColorsArray, namedColors } = Palette.prototype;\r\n\r\nfor (let i = 0, { length } = namedColorsArray; i < length; ++i) {\r\n const [name, value] = namedColorsArray[i];\r\n namedColors[name] = value;\r\n}\r\n\r\nexport default Palette;\r\n","import Palette from './Palette';\r\n\r\nconst palette = new Palette('CPK', 'CP');\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x202020,\r\n N: 0x2060FF,\r\n O: 0xEE2010,\r\n F: 0x00FF00,\r\n P: 0x8020FF,\r\n S: 0xFFFF00,\r\n CL: 0x00BB00,\r\n FE: 0xD0D0D0,\r\n CO: 0xD0D0D0,\r\n NI: 0xD0D0D0,\r\n CU: 0xD0D0D0,\r\n BR: 0x008800,\r\n I: 0x005500,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('Jmol', 'JM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0x0055FF, //\r\n 0x00ABFF, //\r\n 0x00FFFF, // cyan\r\n 0x00FFAB, //\r\n 0x00FF55, //\r\n 0x00FF00, // green\r\n 0x55FF00, //\r\n 0xABFF00, //\r\n 0xFFFF00, // yellow\r\n 0xFFAB00, //\r\n 0xFF5500, //\r\n 0xFF0000, // red\r\n 0xFF0055, //\r\n 0xFF00AB, //\r\n 0xFF00FF, // magenta\r\n 0xAB00FF, //\r\n 0x5500FF, //\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n D: 0xFFFFC0,\r\n T: 0xFFFFA0,\r\n HE: 0xD9FFFF,\r\n LI: 0xCC80FF,\r\n BE: 0xC2FF00,\r\n B: 0xFFB5B5,\r\n C: 0x909090,\r\n N: 0x3050F8,\r\n O: 0xFF0D0D,\r\n F: 0x90E050,\r\n NE: 0xB3E3F5,\r\n NA: 0xAB5CF2,\r\n MG: 0x8AFF00,\r\n AL: 0xBFA6A6,\r\n SI: 0xF0C8A0,\r\n P: 0xFF8000,\r\n S: 0xFFFF30,\r\n CL: 0x1FF01F,\r\n AR: 0x80D1E3,\r\n K: 0x8F40D4,\r\n CA: 0x3DFF00,\r\n SC: 0xE6E6E6,\r\n TI: 0xBFC2C7,\r\n V: 0xA6A6AB,\r\n CR: 0x8A99C7,\r\n MN: 0x9C7AC7,\r\n FE: 0xE06633,\r\n CO: 0xF090A0,\r\n NI: 0x50D050,\r\n CU: 0xC88033,\r\n ZN: 0x7D80B0,\r\n GA: 0xC28F8F,\r\n GE: 0x668F8F,\r\n AS: 0xBD80E3,\r\n SE: 0xFFA100,\r\n BR: 0xA62929,\r\n KR: 0x5CB8D1,\r\n RB: 0x702EB0,\r\n SR: 0x00FF00,\r\n Y: 0x94FFFF,\r\n ZR: 0x94E0E0,\r\n NB: 0x73C2C9,\r\n MO: 0x54B5B5,\r\n TC: 0x3B9E9E,\r\n RU: 0x248F8F,\r\n RH: 0x0A7D8C,\r\n PD: 0x006985,\r\n AG: 0xC0C0C0,\r\n CD: 0xFFD98F,\r\n IN: 0xA67573,\r\n SN: 0x668080,\r\n SB: 0x9E63B5,\r\n TE: 0xD47A00,\r\n I: 0x940094,\r\n XE: 0x429EB0,\r\n CS: 0x57178F,\r\n BA: 0x00C900,\r\n LA: 0x70D4FF,\r\n CE: 0xFFFFC7,\r\n PR: 0xD9FFC7,\r\n ND: 0xC7FFC7,\r\n PM: 0xA3FFC7,\r\n SM: 0x8FFFC7,\r\n EU: 0x61FFC7,\r\n GD: 0x45FFC7,\r\n TB: 0x30FFC7,\r\n DY: 0x1FFFC7,\r\n HO: 0x00FF9C,\r\n ER: 0x00E675,\r\n TM: 0x00D452,\r\n YB: 0x00BF38,\r\n LU: 0x00AB24,\r\n HF: 0x4DC2FF,\r\n TA: 0x4DA6FF,\r\n W: 0x2194D6,\r\n RE: 0x267DAB,\r\n OS: 0x266696,\r\n IR: 0x175487,\r\n PT: 0xD0D0E0,\r\n AU: 0xFFD123,\r\n HG: 0xB8B8D0,\r\n TL: 0xA6544D,\r\n PB: 0x575961,\r\n BI: 0x9E4FB5,\r\n PO: 0xAB5C00,\r\n AT: 0x754F45,\r\n RN: 0x428296,\r\n FR: 0x420066,\r\n RA: 0x007D00,\r\n AC: 0x70ABFA,\r\n TH: 0x00BAFF,\r\n PA: 0x00A1FF,\r\n U: 0x008FFF,\r\n NP: 0x0080FF,\r\n PU: 0x006BFF,\r\n AM: 0x545CF2,\r\n CM: 0x785CE3,\r\n BK: 0x8A4FE3,\r\n CF: 0xA136D4,\r\n ES: 0xB31FD4,\r\n FM: 0xB31FBA,\r\n MD: 0xB30DA6,\r\n NO: 0xBD0D87,\r\n LR: 0xC70066,\r\n RF: 0xCC0059,\r\n DB: 0xD1004F,\r\n SG: 0xD90045,\r\n BH: 0xE00038,\r\n HS: 0xE6002E,\r\n MT: 0xEB0026,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0xBEA06E;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0xC8C8C8,\r\n ARG: 0x145AFF,\r\n ASN: 0x00DCDC,\r\n ASP: 0xE60A0A,\r\n CYS: 0xE6E600,\r\n GLN: 0x00DCDC,\r\n GLU: 0xE60A0A,\r\n GLY: 0xEBEBEB,\r\n HIS: 0x8282D2,\r\n ILE: 0x0F820F,\r\n LEU: 0x0F820F,\r\n LYS: 0x145AFF,\r\n MET: 0xE6E600,\r\n PHE: 0x3232AA,\r\n PRO: 0xDC9682,\r\n SER: 0xFA9600,\r\n THR: 0xFA9600,\r\n TRP: 0xB45AB4,\r\n TYR: 0x3232AA,\r\n VAL: 0x0F820F,\r\n A: 0xA0A0FF,\r\n C: 0xFF8C4B,\r\n G: 0xFF7070,\r\n I: 0x80FFFF,\r\n T: 0xA0FFA0,\r\n U: 0xFF8080,\r\n DA: 0xA0A0FF,\r\n DC: 0xFF8C4B,\r\n DG: 0xFF7070,\r\n DI: 0x80FFFF,\r\n DT: 0xA0FFA0,\r\n DU: 0xFF8080,\r\n '+A': 0xA0A0FF,\r\n '+C': 0xFF8C4B,\r\n '+G': 0xFF7070,\r\n '+I': 0x80FFFF,\r\n '+T': 0xA0FFA0,\r\n '+U': 0xFF8080,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [\r\n // ' '->0 'A'->1, 'B'->2\r\n 0xFFffffff, // ' ' & '0' white\r\n //\r\n 0xFFC0D0FF, // skyblue\r\n 0xFFB0FFB0, // pastel green\r\n 0xFFFFC0C8, // pink\r\n 0xFFFFFF80, // pastel yellow\r\n 0xFFFFC0FF, // pastel magenta\r\n 0xFFB0F0F0, // pastel cyan\r\n 0xFFFFD070, // pastel gold\r\n 0xFFF08080, // lightcoral\r\n\r\n 0xFFF5DEB3, // wheat\r\n 0xFF00BFFF, // deepskyblue\r\n 0xFFCD5C5C, // indianred\r\n 0xFF66CDAA, // mediumaquamarine\r\n 0xFF9ACD32, // yellowgreen\r\n 0xFFEE82EE, // violet\r\n 0xFF00CED1, // darkturquoise\r\n 0xFF00FF7F, // springgreen\r\n 0xFF3CB371, // mediumseagreen\r\n\r\n 0xFF00008B, // darkblue\r\n 0xFFBDB76B, // darkkhaki\r\n 0xFF006400, // darkgreen\r\n 0xFF800000, // maroon\r\n 0xFF808000, // olive\r\n 0xFF800080, // purple\r\n 0xFF008080, // teal\r\n 0xFFB8860B, // darkgoldenrod\r\n 0xFFB22222, // firebrick\r\n];\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xFF0080,\r\n [StructuralElementType.HELIX_PI]: 0x600080,\r\n [StructuralElementType.HELIX_310]: 0xA00080,\r\n [StructuralElementType.STRAND]: 0xFFC800,\r\n [StructuralElementType.TURN]: 0x6080FF,\r\n dna: 0xAE00FE,\r\n rna: 0xFD0162,\r\n};\r\n\r\nexport default palette;\r\n","import Palette from './Palette';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst palette = new Palette('VMD', 'VM');\r\n\r\npalette.colors = [\r\n /* eslint-disable no-magic-numbers */\r\n 0x0000FF, // blue\r\n 0xFF0000, // red\r\n 0x606060, // gray\r\n 0xFF8000, // orange\r\n 0xFFFF00, // yellow\r\n 0x808033, // tan\r\n 0x999999, // silver\r\n 0x00FF00, // green\r\n 0xFFFFFF, // white\r\n 0xFF9999, // pink\r\n 0x40C0C0, // cyan\r\n 0xA600A6, // purple\r\n 0x80E666, // lime\r\n 0xE666B3, // mauve\r\n 0x804D00, // ochre\r\n 0x8080C0, // ice blue\r\n /* eslint-enable no-magic-numbers */\r\n];\r\n\r\npalette.defaultElementColor = 0x804D00;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from atom_types.csv by atom_types.py.\r\npalette.elementColors = {\r\n /* eslint-disable no-magic-numbers */\r\n H: 0xFFFFFF,\r\n C: 0x40BFBF,\r\n N: 0x0000FF,\r\n O: 0xFF0000,\r\n P: 0x808033,\r\n S: 0xFFFF00,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.defaultResidueColor = 0x40C0C0;\r\n\r\n// DO NOT EDIT MANUALLY! Autogenerated from residue_types.csv by residue_types.py.\r\npalette.residueColors = {\r\n /* eslint-disable no-magic-numbers */\r\n ALA: 0x0000FF,\r\n ARG: 0xFFFFFF,\r\n ASN: 0x808033,\r\n ASP: 0xFF0000,\r\n CYS: 0xFFFF00,\r\n GLN: 0xFF8000,\r\n GLU: 0xFF9999,\r\n GLY: 0xFFFFFF,\r\n HIS: 0x40C0C0,\r\n ILE: 0x00FF00,\r\n LEU: 0xFF9999,\r\n LYS: 0x40C0C0,\r\n MET: 0xFFFF00,\r\n PHE: 0xA600A6,\r\n PRO: 0x804C00,\r\n SER: 0xFFFF00,\r\n THR: 0xE666B3,\r\n TRP: 0x999999,\r\n TYR: 0x00FF00,\r\n VAL: 0x808033,\r\n A: 0x0000FF,\r\n C: 0xFF8000,\r\n G: 0xFFFF00,\r\n T: 0xA600A6,\r\n U: 0x00FF00,\r\n DA: 0x0000FF,\r\n DC: 0xFF8000,\r\n DG: 0xFFFF00,\r\n DT: 0xA600A6,\r\n DU: 0x00FF00,\r\n '+A': 0x0000FF,\r\n '+C': 0xFF8000,\r\n '+G': 0xFFFF00,\r\n '+T': 0xA600A6,\r\n '+U': 0x00FF00,\r\n WAT: 0x40C0C0,\r\n H2O: 0x40C0C0,\r\n HOH: 0x40C0C0,\r\n /* eslint-enable no-magic-numbers */\r\n};\r\n\r\npalette.chainColors = [0xFFFFFF].concat(palette.colors);\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\npalette.secondaryColors = {\r\n [StructuralElementType.HELIX_ALPHA]: 0xA600A6,\r\n [StructuralElementType.HELIX_310]: 0x0000FF,\r\n [StructuralElementType.HELIX_PI]: 0xFF0000,\r\n [StructuralElementType.STRAND]: 0xFFFF00,\r\n [StructuralElementType.BRIDGE]: 0x808033,\r\n [StructuralElementType.TURN]: 0x40C0C0,\r\n};\r\n\r\nexport default palette;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport cpkPalette from './palettes/cpkPalette';\r\nimport jmolPalette from './palettes/jmolPalette';\r\nimport vmdPalette from './palettes/vmdPalette';\r\n\r\nconst palettes = new EntityList([\r\n cpkPalette,\r\n jmolPalette,\r\n vmdPalette,\r\n]);\r\n\r\nexport default palettes;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport palettes from '../palettes';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports Colorer\r\n * @this Colorer\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all available coloring algorithms used for building and displaying molecule geometry.\r\n */\r\nclass Colorer {\r\n constructor(opts) {\r\n if (this.constructor === Colorer) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Colorer options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.opts = _.merge(utils.deriveDeep(settings.now.colorers[this.id], true), opts);\r\n /**\r\n * Palette in use.\r\n * @type {Palette}\r\n */\r\n this.palette = palettes.first;\r\n }\r\n\r\n /**\r\n * Get Colorer identification, probably with options.\r\n * @returns {string|Array} Colorer identifier string ({@link Colorer#id}) or two-element array containing both colorer\r\n * identifier and options ({@link Colorer#opts}).\r\n * Options are returned if they were changed during or after colorer creation.\r\n */\r\n identify() {\r\n const diff = utils.objectsDiff(this.opts, settings.now.colorers[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n return [this.id, diff];\r\n }\r\n return this.id;\r\n }\r\n}\r\n\r\n/**\r\n * Colorer identifier.\r\n * @type {string}\r\n */\r\n\r\nColorer.prototype.id = '__';\r\n\r\nexport default Colorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Element\r\n *\r\n * @exports ElementColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on chemical element.\r\n */\r\nclass ElementColorer extends Colorer {\r\n static id = 'EL';\r\n\r\n getAtomColor(atom, _complex) {\r\n const type = atom.element.name;\r\n if (type === 'C' && this.opts.carbon >= 0) {\r\n return this.opts.carbon;\r\n }\r\n return this.palette.getElementColor(type);\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nElementColorer.prototype.id = 'EL';\r\nElementColorer.prototype.name = 'Element';\r\nElementColorer.prototype.shortName = 'Element';\r\n\r\nexport default ElementColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Coloring algorithm based on residue type.\r\n *\r\n * @see ResidueType\r\n *\r\n * @exports ResidueTypeColorer\r\n * @constructor\r\n */\r\nclass ResidueTypeColorer extends Colorer {\r\n static id = 'RT';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getResidueColor(residue._type._name);\r\n }\r\n}\r\n\r\nResidueTypeColorer.prototype.id = 'RT';\r\nResidueTypeColorer.prototype.name = 'Residue Type';\r\nResidueTypeColorer.prototype.shortName = 'Residue';\r\n\r\nexport default ResidueTypeColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass SequenceColorer extends Colorer {\r\n static id = 'SQ';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const chain = residue._chain;\r\n if (chain.minSequence === Number.POSITIVE_INFINITY && chain.maxSequence === Number.NEGATIVE_INFINITY) {\r\n return this.palette.defaultNamedColor;\r\n }\r\n const min = chain.minSequence;\r\n const max = chain.maxSequence > min ? chain.maxSequence : min + 1;\r\n return this.palette.getGradientColor((residue._sequence - min) / (max - min), this.opts.gradient);\r\n }\r\n}\r\n\r\nSequenceColorer.prototype.id = 'SQ';\r\nSequenceColorer.prototype.name = 'Sequence';\r\nSequenceColorer.prototype.shortName = 'Sequence';\r\n\r\nexport default SequenceColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ChainColorer extends Colorer {\r\n static id = 'CH';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n return this.palette.getChainColor(residue.getChain()._name);\r\n }\r\n}\r\n\r\nChainColorer.prototype.id = 'CH';\r\nChainColorer.prototype.name = 'Chain';\r\nChainColorer.prototype.shortName = 'Chain';\r\n\r\nexport default ChainColorer;\r\n","import Colorer from './Colorer';\r\nimport ResidueType from '../../chem/ResidueType';\r\n\r\nclass SecondaryStructureColorer extends Colorer {\r\n static id = 'SS';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n if (residue._type.flags & ResidueType.Flags.DNA) {\r\n return this.palette.getSecondaryColor('dna');\r\n }\r\n if (residue._type.flags & ResidueType.Flags.RNA) {\r\n return this.palette.getSecondaryColor('rna');\r\n }\r\n const secondary = residue.getSecondary();\r\n if (secondary) {\r\n let color = this.palette.getSecondaryColor(secondary.type, true);\r\n if (color === undefined) {\r\n color = this.palette.getSecondaryColor(secondary.generic);\r\n }\r\n return color;\r\n }\r\n return this.palette.defaultSecondaryColor;\r\n }\r\n}\r\n\r\nSecondaryStructureColorer.prototype.id = 'SS';\r\nSecondaryStructureColorer.prototype.name = 'Secondary Structure';\r\nSecondaryStructureColorer.prototype.shortName = 'Structure';\r\n\r\nexport default SecondaryStructureColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass UniformColorer extends Colorer {\r\n static id = 'UN';\r\n\r\n getAtomColor(_atom, _complex) {\r\n return this.opts.color;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nUniformColorer.prototype.id = 'UN';\r\nUniformColorer.prototype.name = 'Uniform';\r\nUniformColorer.prototype.shortName = 'Uniform';\r\n\r\nexport default UniformColorer;\r\n","import Colorer from './Colorer';\r\nimport selectors from '../../chem/selectors';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports ConditionalColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on a selector string used as a condition.\r\n */\r\nclass ConditionalColorer extends Colorer {\r\n static id = 'CO';\r\n\r\n constructor(opts) {\r\n super(opts);\r\n const parsed = selectors.parse(this.opts.subset);\r\n this._subsetCached = parsed.error ? selectors.none() : parsed.selector;\r\n }\r\n\r\n getAtomColor(atom, _complex) {\r\n return this._subsetCached.includesAtom(atom) ? this.opts.color : this.opts.baseColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const subset = this._subsetCached;\r\n const atoms = residue._atoms;\r\n for (let i = 0, n = atoms.length; i < n; ++i) {\r\n if (!subset.includesAtom(atoms[i])) {\r\n return this.opts.baseColor;\r\n }\r\n }\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nConditionalColorer.prototype.id = 'CO';\r\nConditionalColorer.prototype.name = 'Conditional';\r\nConditionalColorer.prototype.shortName = 'Conditional';\r\n\r\nexport default ConditionalColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass ConformationColorer extends Colorer {\r\n static id = 'CF';\r\n\r\n getAtomColor(atom, _complex) {\r\n return this.palette.getChainColor(String.fromCharCode(atom.location));\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.palette.defaultResidueColor;\r\n }\r\n}\r\n\r\nConformationColorer.prototype.id = 'CF';\r\nConformationColorer.prototype.name = 'Conformation';\r\nConformationColorer.prototype.shortName = 'Conformation';\r\n\r\nexport default ConformationColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Temperature\r\n *\r\n * @exports TemperatureColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Coloring algorithm based on temperature of chemical element.\r\n */\r\nclass TemperatureColorer extends Colorer {\r\n static id = 'TM';\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n let factor = 1;\r\n if (atom.temperature && opts) {\r\n if (opts.min === opts.max) {\r\n factor = atom.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (atom.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n if (!opts) {\r\n return this.palette.defaultGradientColor;\r\n }\r\n if (residue.temperature) {\r\n let factor = 0;\r\n if (opts.min === opts.max) {\r\n factor = residue.temperature > opts.max ? 1 : 0;\r\n } else {\r\n factor = (residue.temperature - opts.min) / (opts.max - opts.min);\r\n }\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n}\r\n\r\nTemperatureColorer.prototype.id = 'TM'; // [T]e[M]perature\r\nTemperatureColorer.prototype.name = 'Temperature';\r\nTemperatureColorer.prototype.shortName = 'Temperature';\r\n\r\nexport default TemperatureColorer;\r\n","import Colorer from './Colorer';\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @see Occupancy\r\n *\r\n * @exports OccupancyColorer\r\n * @augments Occupancy\r\n * @constructor\r\n * @classdesc Coloring algorithm based on occupancy of chemical element.\r\n */\r\nclass OccupancyColorer extends Colorer {\r\n static id = 'OC';\r\n\r\n _getColorByOccupancy(occupancy, opts) {\r\n if (occupancy !== undefined) {\r\n const factor = 1 - occupancy;\r\n return this.palette.getGradientColor(factor, opts.gradient);\r\n }\r\n return this.palette.defaultGradientColor;\r\n }\r\n\r\n getAtomColor(atom, _complex) {\r\n const { opts } = this;\r\n return this._getColorByOccupancy(atom.occupancy, opts);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const { opts } = this;\r\n return this._getColorByOccupancy(residue.occupancy, opts);\r\n }\r\n}\r\n\r\nOccupancyColorer.prototype.id = 'OC'; // [OC]cupancy\r\nOccupancyColorer.prototype.name = 'Occupancy';\r\nOccupancyColorer.prototype.shortName = 'Occupancy';\r\n\r\nexport default OccupancyColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass HydrophobicityColorer extends Colorer {\r\n static id = 'HY';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n let color = this.palette.defaultResidueColor;\r\n if (residue._type.hydrophobicity !== undefined) {\r\n // Kyte Doolitle hydro [-4.5,4.5]->[0.1]\r\n const min = -4.5;\r\n const max = 4.5;\r\n color = this.palette.getGradientColor((residue._type.hydrophobicity - min) / (max - min), this.opts.gradient);\r\n }\r\n return color;\r\n }\r\n}\r\n\r\nHydrophobicityColorer.prototype.id = 'HY';\r\nHydrophobicityColorer.prototype.name = 'Hydrophobicity';\r\nHydrophobicityColorer.prototype.shortName = 'Hydrophobicity';\r\n\r\nexport default HydrophobicityColorer;\r\n","import Colorer from './Colorer';\r\n\r\nclass MoleculeColorer extends Colorer {\r\n static id = 'MO';\r\n\r\n getAtomColor(atom, complex) {\r\n return this.getResidueColor(atom.residue, complex);\r\n }\r\n\r\n getResidueColor(residue, _complex) {\r\n const molecule = residue._molecule;\r\n const count = _complex.getMoleculeCount();\r\n if (count > 1) {\r\n return this.palette.getGradientColor((molecule.index - 1) / (count - 1), this.opts.gradient);\r\n }\r\n return this.palette.getGradientColor(0, this.opts.gradient);\r\n }\r\n}\r\n\r\nMoleculeColorer.prototype.id = 'MO';\r\nMoleculeColorer.prototype.name = 'Molecule';\r\nMoleculeColorer.prototype.shortName = 'Molecule';\r\n\r\nexport default MoleculeColorer;\r\n","import Colorer from './Colorer';\r\nimport Atom from '../../chem/Atom';\r\n\r\nfunction scaleColor(c, factor) {\r\n const r1 = (c >> 16) & 0xff;\r\n const g1 = (c >> 8) & 0xff;\r\n const b1 = c & 0xff;\r\n const r = factor * r1;\r\n const g = factor * g1;\r\n const b = factor * b1;\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n\r\n/**\r\n * Create new colorer.\r\n *\r\n * @param {object=} opts - Options to override defaults with. See {@link Colorer}.\r\n *\r\n * @exports CarbonColorer\r\n * @augments Colorer\r\n * @constructor\r\n * @classdesc Bicolor coloring algorithm based on selection carbon atoms.\r\n */\r\nclass CarbonColorer extends Colorer {\r\n static id = 'CB';\r\n\r\n getAtomColor(atom, _complex) {\r\n const colorCarbon = this.opts.color;\r\n const colorNotCarbon = scaleColor(colorCarbon, this.opts.factor);\r\n return (atom.flags & Atom.Flags.CARBON) ? colorCarbon : colorNotCarbon;\r\n }\r\n\r\n getResidueColor(_residue, _complex) {\r\n return this.opts.color;\r\n }\r\n}\r\n\r\nCarbonColorer.prototype.id = 'CB';\r\nCarbonColorer.prototype.name = 'Carbon';\r\nCarbonColorer.prototype.shortName = 'Carbon';\r\n\r\nexport default CarbonColorer;\r\n","import EntityList from '../utils/EntityList';\r\n\r\nimport ElementColorer from './colorers/ElementColorer';\r\nimport ResidueTypeColorer from './colorers/ResidueTypeColorer';\r\nimport SequenceColorer from './colorers/SequenceColorer';\r\nimport ChainColorer from './colorers/ChainColorer';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\nimport UniformColorer from './colorers/UniformColorer';\r\nimport ConditionalColorer from './colorers/ConditionalColorer';\r\nimport ConformationColorer from './colorers/ConformationColorer';\r\nimport TemperatureColorer from './colorers/TemperatureColorer';\r\nimport OccupancyColorer from './colorers/OccupancyColorer';\r\nimport HydrophobicityColorer from './colorers/HydrophobicityColorer';\r\nimport MoleculeColorer from './colorers/MoleculeColorer';\r\nimport CarbonColorer from './colorers/CarbonColorer';\r\n\r\nconst colorers = new EntityList([\r\n ElementColorer,\r\n ResidueTypeColorer,\r\n SequenceColorer,\r\n ChainColorer,\r\n SecondaryStructureColorer,\r\n UniformColorer,\r\n ConditionalColorer,\r\n ConformationColorer,\r\n TemperatureColorer,\r\n OccupancyColorer,\r\n HydrophobicityColorer,\r\n MoleculeColorer,\r\n CarbonColorer,\r\n]);\r\n\r\nexport default colorers;\r\n","import * as THREE from 'three';\r\nimport EntityList from '../utils/EntityList';\r\n\r\nfunction neutralColor(intensity) {\r\n return new THREE.Color(intensity, intensity, intensity);\r\n}\r\n\r\nconst materialList = [\r\n {\r\n id: 'DF',\r\n name: 'Diffuse',\r\n shortName: 'Diffuse',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'SF',\r\n name: 'Soft Plastic',\r\n shortName: 'Soft',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.1),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'PL',\r\n name: 'Glossy Plastic',\r\n shortName: 'Glossy',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.28),\r\n shininess: 100,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'ME',\r\n name: 'Metal',\r\n shortName: 'Metal',\r\n uberOptions: {\r\n diffuse: neutralColor(0.56),\r\n specular: neutralColor(0.55),\r\n shininess: 30,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TR',\r\n name: 'Transparent',\r\n shortName: 'Transparent',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'GL',\r\n name: 'Glass',\r\n shortName: 'Glass',\r\n uberOptions: {\r\n diffuse: neutralColor(0.50),\r\n specular: neutralColor(0.65),\r\n shininess: 100,\r\n opacity: 0.5,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: true,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'BA',\r\n name: 'Backdrop',\r\n shortName: 'Backdrop',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: false,\r\n depthWrite: false,\r\n transparent: false,\r\n toonShading: false,\r\n },\r\n }, {\r\n id: 'TN',\r\n name: 'Toon',\r\n shortName: 'Toon',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 1,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: true,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n toonShading: true,\r\n },\r\n }, {\r\n id: 'FL',\r\n name: 'Flat',\r\n shortName: 'Flat',\r\n uberOptions: {\r\n diffuse: neutralColor(1.0),\r\n specular: neutralColor(0.0),\r\n shininess: 0,\r\n opacity: 1.0,\r\n },\r\n values: {\r\n lights: false,\r\n fog: true,\r\n depthWrite: true,\r\n transparent: false,\r\n },\r\n },\r\n];\r\n\r\nconst materials = new EntityList(materialList);\r\n\r\nexport default materials;\r\n","/**\r\n * Utils functions which is worked with meshes\r\n *\r\n * functions for doing something with all/specified meshes\r\n * functions for traversihg tree and create auxiliary meshes for transparency/shadowmaps...\r\n * functions for calculating data connected with meshes\r\n */\r\nimport * as THREE from 'three';\r\nimport UberMaterial from './shaders/UberMaterial';\r\nimport gfxutils from './gfxutils';\r\n\r\nfunction _gatherObjects(root, meshTypes) {\r\n const meshes = [];\r\n root.traverse((object) => {\r\n for (let i = 0; i < meshTypes.length; i++) {\r\n if (object instanceof meshTypes[i]) {\r\n meshes[meshes.length] = object;\r\n break;\r\n }\r\n }\r\n });\r\n return meshes;\r\n}\r\n\r\n// new mesh with the same geometry and specified material values and layer\r\nfunction createDerivativeMesh(mesh, values, layer) {\r\n const material = mesh.material.createInstance();\r\n material.setValues(values);\r\n\r\n const newMesh = new mesh.constructor(mesh.geometry, material);\r\n newMesh.material.needsUpdate = true;\r\n newMesh.applyMatrix4(mesh.matrix);\r\n newMesh.layers.set(layer);\r\n return newMesh;\r\n}\r\n\r\nfunction traverseMeshes(root, meshTypes, func) {\r\n const meshes = _gatherObjects(root, meshTypes);\r\n\r\n for (let i = 0, n = meshes.length; i < n; ++i) {\r\n const mesh = meshes[i];\r\n if (!mesh.parent) {\r\n continue;\r\n }\r\n func(mesh);\r\n }\r\n}\r\n\r\nfunction applyTransformsToMeshes(root, mtc) {\r\n const mtcCount = mtc.length;\r\n if (mtcCount < 1) {\r\n return;\r\n }\r\n\r\n const meshTypes = [THREE.Mesh, THREE.LineSegments, THREE.Line];\r\n traverseMeshes(root, meshTypes, (mesh) => {\r\n mesh.applyMatrix4(mtc[0]);\r\n for (let j = 1; j < mtcCount; ++j) {\r\n const newMesh = new mesh.constructor(mesh.geometry, mesh.material);\r\n mesh.parent.add(newMesh);\r\n newMesh.applyMatrix4(mtc[j]);\r\n }\r\n });\r\n}\r\n\r\nconst processTransparentMaterial = (function () {\r\n const matValues = {\r\n prepassTransparancy: true,\r\n fakeOpacity: false,\r\n transparent: false,\r\n colorFromDepth: false,\r\n lights: false,\r\n shadowmap: false,\r\n fog: false,\r\n };\r\n\r\n return function (root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n mesh.material.setValues({ prepassTransparancy: false, fakeOpacity: false });\r\n mesh.material.needsUpdate = true;\r\n mesh.layers.set(gfxutils.LAYERS.TRANSPARENT);\r\n\r\n const prepassTranspMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.PREPASS_TRANSPARENT);\r\n mesh.parent.add(prepassTranspMesh);\r\n });\r\n };\r\n}());\r\n\r\nconst processColFromPosMaterial = (function () {\r\n const matValues = {\r\n colorFromPos: true,\r\n transparent: false,\r\n colorFromDepth: false,\r\n lights: false,\r\n shadowmap: false,\r\n fog: false,\r\n overrideColor: false,\r\n fogTransparent: false,\r\n attrColor: false,\r\n attrColor2: false,\r\n attrAlphaColor: false,\r\n fakeOpacity: false,\r\n };\r\n\r\n return function (root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n const colFromPosMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.COLOR_FROM_POSITION);\r\n mesh.parent.add(colFromPosMesh);\r\n });\r\n };\r\n}());\r\n\r\nconst createShadowmapMaterial = (function () {\r\n const matValues = {\r\n colorFromDepth: true,\r\n orthoCam: true,\r\n lights: false,\r\n shadowmap: false,\r\n fog: false,\r\n };\r\n\r\n return function (root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n if (!mesh.receiveShadow && mesh.material.shadowmap) { // remove shadow from non-receivers\r\n mesh.material.setValues({ shadowmap: false });\r\n }\r\n if (!mesh.material.lights) { // skip creating shadowmap meshes for materials without lighting\r\n return;\r\n }\r\n if (!mesh.castShadow) { // skip creating shadowmap meshes for non-casters\r\n return;\r\n }\r\n if (!gfxutils.belongToSelectLayers(mesh)) { // skip creating shadowmap meshes for selection layer\r\n return;\r\n }\r\n\r\n const shadowmapMesh = createDerivativeMesh(mesh, matValues, gfxutils.LAYERS.SHADOWMAP);\r\n shadowmapMesh.isShadowmapMesh = true;\r\n mesh.parent.add(shadowmapMesh);\r\n });\r\n };\r\n}());\r\n\r\nfunction removeShadowmapMaterial(root, material) {\r\n if (!(material instanceof UberMaterial)) {\r\n return;\r\n }\r\n\r\n traverseMeshes(root, [THREE.Mesh, THREE.LineSegments], (mesh) => {\r\n if (mesh.isShadowmapMesh) {\r\n mesh.parent.remove(mesh);\r\n }\r\n });\r\n}\r\n\r\nfunction forEachMeshInGroup(group, process) {\r\n function processObj(object) {\r\n if (object instanceof THREE.Mesh) {\r\n process(object);\r\n }\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n processObj(object.children[i]);\r\n }\r\n }\r\n processObj(group);\r\n}\r\n\r\nfunction _countMeshTriangles(mesh) {\r\n const geom = mesh.geometry;\r\n if (geom instanceof THREE.InstancedBufferGeometry) {\r\n const attribs = geom.attributes;\r\n for (const property in attribs) {\r\n if (attribs.hasOwnProperty(property) && attribs[property] instanceof THREE.InstancedBufferAttribute) {\r\n const currAttr = attribs[property];\r\n const indexSize = geom.index ? geom.index.array.length / 3 : 0;\r\n return indexSize * currAttr.array.length / currAttr.itemSize;\r\n }\r\n }\r\n return 0;\r\n }\r\n if (geom instanceof THREE.BufferGeometry) {\r\n return geom.index ? geom.index.array.length / 3 : 0;\r\n }\r\n return geom.faces ? geom.faces.length : 0;\r\n}\r\n\r\nfunction countTriangles(group) {\r\n let totalCount = 0;\r\n forEachMeshInGroup(group, (mesh) => {\r\n totalCount += _countMeshTriangles(mesh);\r\n });\r\n return totalCount;\r\n}\r\n\r\nexport default {\r\n applyTransformsToMeshes,\r\n processTransparentMaterial,\r\n processColFromPosMaterial,\r\n createShadowmapMaterial,\r\n removeShadowmapMaterial,\r\n forEachMeshInGroup,\r\n countTriangles,\r\n};\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport UberMaterial from './shaders/UberMaterial';\r\nimport gfxutils from './gfxutils';\r\nimport meshutils from './meshutils';\r\nimport settings from '../settings';\r\nimport materials from './materials';\r\nimport chem from '../chem';\r\n\r\nconst { selectors } = chem;\r\n\r\nclass Representation {\r\n constructor(index, mode, colorer, selector) {\r\n const startMaterialValues = {\r\n clipPlane: settings.now.draft.clipPlane,\r\n fogTransparent: settings.now.bg.transparent,\r\n shadowmap: settings.now.shadow.on,\r\n shadowmapType: settings.now.shadow.type,\r\n };\r\n this.index = index;\r\n this.mode = mode;\r\n this.colorer = colorer;\r\n this.selector = selector;\r\n this.selectorString = '';\r\n this.count = 0;\r\n this.material = new UberMaterial();\r\n this.material.setValues(startMaterialValues);\r\n this.material.setUberOptions({ fogAlpha: settings.now.fogAlpha });\r\n this.materialPreset = materials.first;\r\n this.needsRebuild = true;\r\n this.visible = true;\r\n\r\n // apply mode params & preset\r\n this.setMode(mode);\r\n }\r\n\r\n markAtoms(complex) {\r\n this.count = complex.markAtoms(this.selector, 1 << this.index);\r\n this.needsRebuild = true;\r\n return this.count;\r\n }\r\n\r\n unmarkAtoms(complex) {\r\n complex.clearAtomBits(1 << this.index);\r\n this.count = 0;\r\n }\r\n\r\n setMode(mode) {\r\n this.mode = mode;\r\n }\r\n\r\n setMaterialPreset(preset) {\r\n this.materialPreset = preset;\r\n this.material.setUberOptions(preset.uberOptions);\r\n this.material.setValues(preset.values);\r\n }\r\n\r\n reset() {\r\n this.geo = null;\r\n this.selectionGeo = null;\r\n }\r\n\r\n buildGeometry(complex) {\r\n this.reset();\r\n this.needsRebuild = false;\r\n\r\n if (settings.now.ao) {\r\n this.material.setValues({ normalsToGBuffer: settings.now.ao });\r\n }\r\n\r\n this.geo = this.mode.buildGeometry(complex, this.colorer, 1 << this.index, this.material);\r\n\r\n if (this.material.uberOptions.opacity < 0.99 && settings.now.transparency === 'prepass') {\r\n meshutils.processTransparentMaterial(this.geo, this.material);\r\n }\r\n this.geo.visible = this.visible;\r\n\r\n gfxutils.processObjRenderOrder(this.geo, this.materialPreset.id);\r\n meshutils.processColFromPosMaterial(this.geo, this.material);\r\n\r\n if (settings.now.shadow.on) {\r\n meshutils.createShadowmapMaterial(this.geo, this.material);\r\n }\r\n\r\n return this.geo;\r\n }\r\n\r\n buildSelectionGeometry(mask) {\r\n let sg = null;\r\n\r\n if (this.geo && ('getSubset' in this.geo)) {\r\n const meshes = this.geo.getSubset(mask);\r\n if (meshes && meshes.length > 0) {\r\n sg = new THREE.Group();\r\n sg.matrixAutoUpdate = false;\r\n sg.matrix = this.geo.matrix;\r\n\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n sg.add(m);\r\n }\r\n }\r\n }\r\n\r\n if (sg) {\r\n sg.visible = this.visible;\r\n }\r\n\r\n this.selectionGeo = sg;\r\n return this.selectionGeo;\r\n }\r\n\r\n /**\r\n * Create object that represents difference between current and another rep\r\n * anotherRep could be undefined. In this case everything is reported.\r\n */\r\n compare(repSettings) {\r\n const diff = {};\r\n\r\n const selStr = String(this.selector);\r\n if (!repSettings || selStr.valueOf() !== String(repSettings.selector).valueOf()) {\r\n diff.selector = selStr;\r\n }\r\n\r\n const modeDiff = this.mode.identify();\r\n if (!repSettings || Array.isArray(modeDiff) || modeDiff !== repSettings.mode) {\r\n diff.mode = modeDiff;\r\n }\r\n\r\n const colorerDiff = this.colorer.identify();\r\n if (!repSettings || Array.isArray(colorerDiff) || colorerDiff !== repSettings.colorer) {\r\n diff.colorer = colorerDiff;\r\n }\r\n\r\n if (!repSettings || this.materialPreset.id !== repSettings.material) {\r\n diff.material = this.materialPreset.id;\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n /**\r\n * Change representation. Write fields what was changed into new object, return it.\r\n */\r\n change(repSettings, complex, mode, color) {\r\n const diff = {};\r\n\r\n // modify selector\r\n if (repSettings.selector) {\r\n const newSelectorObject = selectors.parse(repSettings.selector).selector;\r\n const newSelector = String(newSelectorObject);\r\n if (this.selectorString !== newSelector) {\r\n diff.selector = newSelector;\r\n this.selectorString = newSelector;\r\n this.selector = newSelectorObject;\r\n this.markAtoms(complex);\r\n }\r\n }\r\n\r\n // modify mode\r\n if (repSettings.mode) {\r\n const newMode = repSettings.mode;\r\n if (!_.isEqual(this.mode.identify(), newMode)) {\r\n diff.mode = newMode;\r\n this.setMode(mode);\r\n }\r\n }\r\n\r\n // modify colorer\r\n if (repSettings.colorer) {\r\n const newColorer = repSettings.colorer;\r\n if (!_.isEqual(this.colorer.identify(), newColorer)) {\r\n diff.colorer = newColorer;\r\n this.colorer = color;\r\n }\r\n }\r\n\r\n // modify material\r\n if (repSettings.material) {\r\n const newMaterial = repSettings.material;\r\n if (!_.isEqual(this.materialPreset.id, newMaterial)) {\r\n diff.material = newMaterial;\r\n this.setMaterialPreset(materials.get(repSettings.material));\r\n }\r\n }\r\n\r\n return diff;\r\n }\r\n\r\n show(visible) {\r\n this.visible = visible;\r\n if (this.geo) {\r\n this.geo.visible = visible;\r\n }\r\n if (this.selectionGeo) {\r\n this.selectionGeo.visible = visible;\r\n }\r\n }\r\n}\r\n\r\nexport default Representation;\r\n","import * as THREE from 'three';\r\nimport logger from './utils/logger';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport './gfx/modes';\r\n\r\nfunction _traverseComponentGroups(root, component, callback) {\r\n const { children } = root;\r\n if (!children) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = children.length; i < n; ++i) {\r\n const child = children[i];\r\n if (child._component === component) {\r\n callback(child);\r\n }\r\n if (child instanceof gfxutils.RCGroup) {\r\n _traverseComponentGroups(child, component, callback);\r\n }\r\n }\r\n}\r\n\r\nfunction ComplexEditor() {\r\n}\r\n\r\nclass ComplexComponentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n // init component matrices\r\n this._componentTransforms = [];\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n const component = complex._components[i];\r\n this._componentTransforms[component._index] = new THREE.Object3D();\r\n }\r\n\r\n this._inProgress = true;\r\n\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const complex = this._complexVisual.getComplex();\r\n\r\n for (let i = 0; i < complex._components.length; ++i) {\r\n this._bakeComponentTransform(complex._components[i]);\r\n }\r\n\r\n complex.onAtomPositionChanged();\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n this._resetComponentTransform();\r\n\r\n this._complexVisual.finalizeEdit();\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n const visual = this._complexVisual;\r\n const component = visual.getSelectedComponent();\r\n\r\n if (component === null) {\r\n return res;\r\n }\r\n\r\n const selection = this._complexVisual.getSelectionGeo();\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n // find all geo nodes for this component\r\n _traverseComponentGroups(visual, component, (child) => {\r\n res.objects.push(child);\r\n });\r\n\r\n // find all selection nodes for this component\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component') && geo._component === component) {\r\n res.objects.push(geo);\r\n }\r\n }\r\n }\r\n\r\n // add dummy object that stores component transformation\r\n res.objects.push(this._componentTransforms[component._index]);\r\n\r\n const bbmin = new THREE.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n const bbmax = new THREE.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (j = 0; j < atoms.length; ++j) {\r\n if (atoms[j].mask & selectionMask) {\r\n bbmin.min(atoms[j].position);\r\n bbmax.max(atoms[j].position);\r\n }\r\n }\r\n });\r\n\r\n res.pivot.lerpVectors(bbmin, bbmax, 0.5);\r\n return res;\r\n }\r\n\r\n _bakeComponentTransform(component) {\r\n const t = this._componentTransforms[component._index];\r\n if (t && (!(t.position.x === 0 && t.position.y === 0 && t.position.z === 0)\r\n || !(t.quaternion.x === 0 && t.quaternion.y === 0 && t.quaternion.z === 0 && t.quaternion.w === 1))) {\r\n t.updateMatrix();\r\n\r\n component.forEachResidue((residue) => {\r\n const atoms = residue._atoms;\r\n for (let j = 0; j < atoms.length; ++j) {\r\n atoms[j].position.applyMatrix4(t.matrix);\r\n }\r\n });\r\n }\r\n }\r\n\r\n _resetComponentTransform() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n let i;\r\n let j;\r\n let reprNode;\r\n let geo;\r\n\r\n for (i = 0; i < this._componentTransforms.length; ++i) {\r\n geo = this._componentTransforms[i];\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n\r\n // reset all geo nodes\r\n for (i = 0; i < visual.children.length; ++i) {\r\n reprNode = visual.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n // reset all selection nodes\r\n for (i = 0; i < selection.children.length; ++i) {\r\n reprNode = selection.children[i];\r\n for (j = 0; j < reprNode.children.length; ++j) {\r\n geo = reprNode.children[j];\r\n if (geo.hasOwnProperty('_component')) {\r\n geo.position.set(0, 0, 0);\r\n geo.quaternion.set(0, 0, 0, 1);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nclass ComplexFragmentEditor extends ComplexEditor {\r\n constructor(complexVisual) {\r\n super();\r\n this._complexVisual = complexVisual;\r\n this._inProgress = false;\r\n }\r\n\r\n begin() {\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n const atoms = this._getSelectionBorderAtoms();\r\n if (atoms.length < 1 || atoms.length > 2) {\r\n logger.error('Can only edit fragments with one or two bound atoms.');\r\n return false;\r\n }\r\n\r\n this._fragmentBoundAtoms = atoms;\r\n\r\n const selectionMask = 1 << visual.getSelectionBit();\r\n\r\n // hide selected fragment in main model\r\n visual.disableSubset(selectionMask, true);\r\n\r\n // hide selection geo in main model\r\n for (let k = 0; k < selection.children.length; ++k) {\r\n selection.children[k].visible = false;\r\n }\r\n\r\n // create visible fragment representation to rotate\r\n const pivotPos = atoms[0].position.clone();\r\n\r\n if (atoms.length === 2) {\r\n pivotPos.lerp(atoms[1].position, 0.5);\r\n }\r\n\r\n this._fragmentGeo = new THREE.Group();\r\n visual.add(this._fragmentGeo);\r\n this._fragmentGeo.position.copy(pivotPos);\r\n\r\n this._fragmentSelectionGeo = new THREE.Group();\r\n selection.add(this._fragmentSelectionGeo);\r\n this._fragmentSelectionGeo.position.copy(pivotPos);\r\n\r\n const offset = pivotPos.clone();\r\n offset.negate();\r\n\r\n for (let i = 0; i < visual.children.length; ++i) {\r\n const g = visual.children[i];\r\n if (!('getSubset' in g)) {\r\n continue;\r\n }\r\n\r\n const vg = new THREE.Group();\r\n this._fragmentGeo.add(vg);\r\n\r\n const sg = new THREE.Group();\r\n this._fragmentSelectionGeo.add(sg);\r\n\r\n const meshes = g.getSubset(selectionMask, true);\r\n for (let j = 0; j < meshes.length; j++) {\r\n const m = meshes[j];\r\n vg.add(m);\r\n m.position.copy(offset);\r\n }\r\n\r\n const smeshes = g.getSubset(selectionMask, true);\r\n for (let h = 0; h < smeshes.length; h++) {\r\n const sm = smeshes[h];\r\n sg.add(sm);\r\n sm.position.copy(offset);\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(this._fragmentSelectionGeo);\r\n\r\n this._inProgress = true;\r\n return true;\r\n }\r\n\r\n apply() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selectionBit = visual.getSelectionBit();\r\n\r\n const p = this._fragmentGeo.position;\r\n const m = this._fragmentGeo.matrix.clone();\r\n m.multiply(new THREE.Matrix4().makeTranslation(-p.x, -p.y, -p.z));\r\n\r\n this._bakeAtomTransform(m, 1 << selectionBit);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << selectionBit, true);\r\n\r\n visual.getComplex().onAtomPositionChanged();\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n discard() {\r\n if (!this._inProgress) {\r\n return;\r\n }\r\n\r\n const visual = this._complexVisual;\r\n const selection = this._complexVisual.getSelectionGeo();\r\n\r\n this._fragmentGeo.parent.remove(this._fragmentGeo);\r\n\r\n // show selected fragment in main model\r\n visual.enableSubset(1 << visual.getSelectionBit(), true);\r\n\r\n // show selection geo in main model (+ remove fragment selection geo)\r\n for (let i = 0; i < selection.children.length; ++i) {\r\n const node = selection.children[i];\r\n if (node.visible) {\r\n selection.remove(node);\r\n } else {\r\n node.visible = true;\r\n }\r\n }\r\n\r\n visual.finalizeEdit();\r\n }\r\n\r\n isFreeRotationAllowed() {\r\n return (this._fragmentBoundAtoms.length < 2);\r\n }\r\n\r\n getAltObj() {\r\n const res = {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n\r\n res.objects.push(this._fragmentGeo, this._fragmentSelectionGeo);\r\n\r\n const boundAtoms = this._fragmentBoundAtoms;\r\n if (boundAtoms.length === 1) {\r\n if (boundAtoms[0].bonds.length === 1) {\r\n // single external bond allows rotation about bond axis\r\n const bond = boundAtoms[0].bonds[0];\r\n res.axis = new THREE.Vector3().subVectors(bond._right.position, bond._left.position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n } else if (boundAtoms.length === 2) {\r\n // two bound atoms allow rotation only about axis running through their centers\r\n res.axis = new THREE.Vector3().subVectors(boundAtoms[1].position, boundAtoms[0].position);\r\n res.axis.normalize();\r\n res.axis.transformDirection(this._complexVisual.matrixWorld);\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _getSelectionBorderAtoms() {\r\n const complex = this._complexVisual.getComplex();\r\n\r\n const selectionMask = 1 << this._complexVisual.getSelectionBit();\r\n const atomHash = {};\r\n\r\n complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n atomHash[bond._left.index] = 1;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n atomHash[bond._right.index] = 1;\r\n }\r\n });\r\n\r\n const atoms = [];\r\n const keys = Object.keys(atomHash);\r\n for (let i = 0, n = keys.length; i < n; ++i) {\r\n const idx = keys[i];\r\n atoms.push(complex._atoms[idx]);\r\n }\r\n\r\n return atoms;\r\n }\r\n\r\n _bakeAtomTransform(matrix, mask) {\r\n this._complexVisual.getComplex().forEachAtom((atom) => {\r\n if (atom.mask & mask) {\r\n atom.position.applyMatrix4(matrix);\r\n }\r\n });\r\n }\r\n}\r\n\r\nexport default {\r\n ComponentEditor: ComplexComponentEditor,\r\n FragmentEditor: ComplexFragmentEditor,\r\n};\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport utils from './utils';\r\nimport logger from './utils/logger';\r\nimport chem from './chem';\r\nimport settings from './settings';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport Visual from './Visual';\r\nimport ComplexVisualEdit from './ComplexVisualEdit';\r\nimport meshutils from './gfx/meshutils';\r\n\r\nconst { selectors } = chem;\r\n\r\nfunction lookupAndCreate(entityList, specs) {\r\n if (!Array.isArray(specs)) {\r\n specs = [specs];\r\n }\r\n const [id, opts] = specs;\r\n const Entity = entityList.get(id) || entityList.first;\r\n return new Entity(opts);\r\n}\r\n\r\nclass ComplexVisual extends Visual {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this._complex = dataSource;\r\n\r\n /** @type {Representation[]} */\r\n this._reprList = [];\r\n /** @type {?Representation} */\r\n this._repr = null;\r\n this._reprListChanged = true;\r\n\r\n this._selectionBit = 0;\r\n this._reprUsedBits = 0;\r\n this._selectionCount = 0;\r\n\r\n this._selectionGeometry = new THREE.Group();\r\n }\r\n\r\n getBoundaries() {\r\n return this._complex.getBoundaries();\r\n }\r\n\r\n release() {\r\n if (this._selectionGeometry.parent) {\r\n this._selectionGeometry.remove(this._selectionGeometry);\r\n }\r\n Visual.prototype.release.call(this);\r\n }\r\n\r\n getComplex() {\r\n return this._complex;\r\n }\r\n\r\n getSelectionCount() {\r\n return this._selectionCount;\r\n }\r\n\r\n getSelectionGeo() {\r\n return this._selectionGeometry;\r\n }\r\n\r\n getSelectionBit() {\r\n return this._selectionBit;\r\n }\r\n\r\n getEditor() {\r\n return this._editor;\r\n }\r\n\r\n resetReps(reps) {\r\n // Create all necessary representations\r\n if (this._complex) {\r\n this._complex.clearAtomBits(~0);\r\n }\r\n this._reprListChanged = true;\r\n this._reprUsedBits = 0;\r\n this._reprList.length = reps.length;\r\n for (let i = 0, n = reps.length; i < n; ++i) {\r\n const rep = reps[i];\r\n\r\n let selector;\r\n let selectorString;\r\n if (typeof rep.selector === 'string') {\r\n selectorString = rep.selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else if (typeof rep.selector === 'undefined') {\r\n selectorString = settings.now.presets.default[0].selector;\r\n ({ selector } = selectors.parse(selectorString));\r\n } else {\r\n ({ selector } = rep);\r\n selectorString = selector.toString();\r\n }\r\n const mode = lookupAndCreate(modes, rep.mode);\r\n const colorer = lookupAndCreate(colorers, rep.colorer);\r\n const material = materials.get(rep.material) || materials.first;\r\n\r\n this._reprList[i] = new Representation(i, mode, colorer, selector);\r\n this._reprList[i].setMaterialPreset(material);\r\n this._reprList[i].selectorString = selectorString;\r\n\r\n if (this._complex) {\r\n this._complex.markAtoms(selector, 1 << i);\r\n }\r\n\r\n this._reprUsedBits |= 1 << i;\r\n }\r\n this._repr = reps.length > 0 ? this._reprList[0] : null;\r\n\r\n this._selectionBit = reps.length;\r\n this._reprUsedBits |= 1 << this._selectionBit; // selection uses one bit\r\n this._selectionCount = 0;\r\n\r\n if (this._complex) {\r\n this._complex.update();\r\n }\r\n }\r\n\r\n /**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\n repCount() {\r\n return this._reprList.length;\r\n }\r\n\r\n /**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\n repCurrent(index) {\r\n if (index >= 0 && index < this._reprList.length) {\r\n this._repr = this._reprList[index];\r\n } else {\r\n index = this._reprList.indexOf(this._repr);\r\n }\r\n return index;\r\n }\r\n\r\n /**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {Object} {desc, index, status} field desc contains rep description, index - index of correspondent rep,\r\n * status - one of three strings: 'created', 'changed', ''. 'created' means new rep was created during this function,\r\n * 'changed' - rep was changed during this function. '' - something else.\r\n */\r\n rep(index, rep) {\r\n // if index is missing then it is the current\r\n if (!rep && (index === undefined || index instanceof Object)) {\r\n rep = index;\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index > this._reprList.length) {\r\n logger.error(`Rep ${index} does not exist!`);\r\n return null;\r\n }\r\n\r\n // a special case of adding just after the end\r\n if (index === this._reprList.length) {\r\n const res = this.repAdd(rep);\r\n logger.warn(`Rep ${index} does not exist! New representation was created.`);\r\n return { desc: res.desc, index, status: 'created' };\r\n }\r\n\r\n // gather description\r\n const target = this._reprList[index];\r\n const desc = {\r\n selector: target.selectorString,\r\n mode: target.mode.identify(),\r\n colorer: target.colorer.identify(),\r\n material: target.materialPreset.id,\r\n };\r\n\r\n // modification is requested\r\n if (rep) {\r\n // modify\r\n const diff = target.change(\r\n rep,\r\n this._complex,\r\n lookupAndCreate(modes, rep.mode),\r\n lookupAndCreate(colorers, rep.colorer),\r\n );\r\n\r\n // something was changed\r\n if (!_.isEmpty(diff)) {\r\n target.needsRebuild = true;\r\n for (const key in diff) {\r\n if (diff.hasOwnProperty(key)) {\r\n desc[key] = diff[key];\r\n logger.debug(`rep[${index}].${key} changed to ${diff[key]}`);\r\n }\r\n }\r\n\r\n // safety trick: lower resolution for surface modes\r\n if (diff.mode && target.mode.isSurface\r\n && (settings.now.resolution === 'ultra' || settings.now.resolution === 'high')) {\r\n logger.report('Surface resolution was changed to \"medium\" to avoid hang-ups.');\r\n settings.set('resolution', 'medium');\r\n }\r\n return { desc, index, status: 'changed' };\r\n }\r\n }\r\n return { desc, index, status: '' };\r\n }\r\n\r\n /**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\n repGet(index) {\r\n // if index is missing then it is the current\r\n if (index === undefined || index instanceof Object) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return null;\r\n }\r\n\r\n return this._reprList[index];\r\n }\r\n\r\n _getFreeReprIdx() {\r\n let bits = this._reprUsedBits;\r\n for (let i = 0; i <= ComplexVisual.NUM_REPRESENTATION_BITS; ++i, bits >>= 1) {\r\n if ((bits & 1) === 0) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {Object} {desc, index} field desc contains added rep description, index - index of this rep.\r\n */\r\n repAdd(rep) {\r\n if (this._reprList.length >= ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n return null;\r\n }\r\n\r\n const newSelectionBit = this._getFreeReprIdx();\r\n if (newSelectionBit < 0) {\r\n return null; // no more slots for representations\r\n }\r\n\r\n const originalSelection = this.buildSelectorFromMask(1 << this._selectionBit);\r\n\r\n // Fill in default values\r\n const def = settings.now.presets.default[0];\r\n const desc = _.merge({\r\n selector: def.selector,\r\n mode: def.mode,\r\n colorer: def.colorer,\r\n material: def.material,\r\n }, rep);\r\n\r\n const selector = (typeof desc.selector === 'string') ? selectors.parse(desc.selector).selector : desc.selector;\r\n const target = new Representation(\r\n this._selectionBit,\r\n lookupAndCreate(modes, desc.mode),\r\n lookupAndCreate(colorers, desc.colorer),\r\n selector,\r\n );\r\n target.selectorString = selector.toString();\r\n target.setMaterialPreset(materials.get(desc.material));\r\n target.markAtoms(this._complex);\r\n this._reprList.push(target);\r\n\r\n // change selection bit\r\n this._selectionBit = newSelectionBit;\r\n this._reprUsedBits |= 1 << this._selectionBit;\r\n\r\n // restore selection using new selection bit\r\n this._complex.markAtoms(originalSelection, 1 << this._selectionBit);\r\n\r\n return { desc, index: this._reprList.length - 1 };\r\n }\r\n\r\n /**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\n repRemove(index) {\r\n if (index === undefined) {\r\n index = this.repCurrent();\r\n }\r\n\r\n // catch out of bounds case\r\n let count = this._reprList.length;\r\n if (index < 0 || index >= count || count <= 1) { // do not allow to remove the single rep\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.unmarkAtoms(this._complex);\r\n this._reprUsedBits &= ~(1 << target.index);\r\n\r\n this._reprList.splice(index, 1);\r\n\r\n // update current rep\r\n if (target === this._repr) {\r\n --count;\r\n index = index < count ? index : count - 1;\r\n this._repr = this._reprList[index];\r\n }\r\n this._reprListChanged = true;\r\n }\r\n\r\n /**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\n repHide(index, hide) {\r\n if (hide === undefined) {\r\n hide = true;\r\n }\r\n\r\n // fail if out of bounds\r\n if (index < 0 || index >= this._reprList.length) {\r\n return;\r\n }\r\n\r\n const target = this._reprList[index];\r\n target.show(!hide);\r\n }\r\n\r\n /**\r\n * Select atoms with selector\r\n * @param {Selector} selector - selector\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\n select(selector, append) {\r\n if (append) {\r\n this._selectionCount += this._complex.markAtomsAdditionally(selector, 1 << this._selectionBit);\r\n } else {\r\n this._selectionCount = this._complex.markAtoms(selector, 1 << this._selectionBit);\r\n }\r\n this._complex.updateStructuresMask();\r\n this.rebuildSelectionGeometry();\r\n }\r\n\r\n resetSelectionMask() {\r\n if (this._selectionCount !== 0) {\r\n this._selectionCount = 0;\r\n if (this._complex) {\r\n this._complex.clearAtomBits(1 << this._selectionBit);\r\n }\r\n }\r\n }\r\n\r\n updateSelectionMask(pickedObj) {\r\n const self = this;\r\n const { atom } = pickedObj;\r\n let { residue, chain, molecule } = pickedObj;\r\n const setMask = 1 << this._selectionBit;\r\n const clearMask = ~setMask;\r\n\r\n if (atom) {\r\n residue = atom.residue;\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (atom.mask & setMask) {\r\n atom.mask &= clearMask;\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n if (molecule) {\r\n molecule.mask &= clearMask;\r\n }\r\n this._selectionCount--;\r\n } else {\r\n atom.mask |= setMask;\r\n this._selectionCount++;\r\n\r\n // select residue if all atoms in it are selected\r\n residue.collectMask();\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (residue) {\r\n chain = residue._chain;\r\n molecule = residue._molecule;\r\n\r\n if (residue._mask & setMask) {\r\n residue._mask &= clearMask;\r\n chain._mask &= clearMask;\r\n residue.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n } else {\r\n residue._mask |= setMask;\r\n residue.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n\r\n // select chain and molecule if all residues in it are selected\r\n chain.collectMask();\r\n if (molecule) {\r\n molecule.collectMask();\r\n }\r\n }\r\n } else if (chain || molecule) {\r\n const obj = chain || molecule;\r\n if (obj._mask & setMask) {\r\n obj._mask &= clearMask;\r\n obj.forEachResidue((r) => {\r\n if (r._mask & setMask) {\r\n r._mask &= clearMask;\r\n r.forEachAtom((a) => {\r\n if (a.mask & setMask) {\r\n a.mask &= clearMask;\r\n self._selectionCount--;\r\n }\r\n });\r\n r._mask &= clearMask;\r\n }\r\n });\r\n } else {\r\n obj._mask |= setMask;\r\n obj.forEachResidue((r) => {\r\n if (!(r._mask & setMask)) {\r\n r._mask |= setMask;\r\n r.forEachAtom((a) => {\r\n if (!(a.mask & setMask)) {\r\n a.mask |= setMask;\r\n self._selectionCount++;\r\n }\r\n });\r\n const otherObj = chain ? r.getMolecule() : r.getChain();\r\n if (otherObj) {\r\n otherObj.collectMask();\r\n }\r\n }\r\n });\r\n }\r\n } else {\r\n this.resetSelectionMask();\r\n }\r\n }\r\n\r\n expandSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms to add\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // select marked atoms\r\n const deselectionMask = ~tmpMask;\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask = (atom.mask & deselectionMask) | selectionMask;\r\n ++self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n shrinkSelection() {\r\n const self = this;\r\n const selectionMask = 1 << this._selectionBit;\r\n const tmpMask = 1 << 31;\r\n\r\n // mark atoms neighbouring to unselected ones\r\n this._complex.forEachBond((bond) => {\r\n if (bond._left.mask & selectionMask) {\r\n if ((bond._right.mask & selectionMask) === 0) {\r\n bond._left.mask |= tmpMask;\r\n }\r\n } else if (bond._right.mask & selectionMask) {\r\n bond._right.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // mark hanging atoms\r\n this._complex.forEachAtom((atom) => {\r\n if ((atom.mask & selectionMask) && (atom.bonds.length === 1)) {\r\n atom.mask |= tmpMask;\r\n }\r\n });\r\n\r\n // deselect marked atoms\r\n const deselectionMask = ~(selectionMask | tmpMask);\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & tmpMask) {\r\n atom.mask &= deselectionMask;\r\n --self._selectionCount;\r\n }\r\n });\r\n\r\n this._complex.updateStructuresMask();\r\n }\r\n\r\n getSelectedComponent() {\r\n const selectionMask = 1 << this._selectionBit;\r\n\r\n let component = null;\r\n let multiple = false;\r\n\r\n // find which component is selected (exclusively)\r\n this._complex.forEachAtom((atom) => {\r\n if (atom.mask & selectionMask) {\r\n if (component === null) {\r\n component = atom.residue._component;\r\n } else if (component !== atom.residue._component) {\r\n multiple = true;\r\n }\r\n }\r\n });\r\n\r\n return multiple ? null : component;\r\n }\r\n\r\n getSelectionCenter(center, includesAtom, selRule) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._complex.forEachAtom((atom) => {\r\n if (includesAtom(atom, selRule)) {\r\n center.add(atom.position);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.applyMatrix4(this.matrix);\r\n return true;\r\n }\r\n\r\n needsRebuild() {\r\n if (this._reprListChanged) {\r\n return true;\r\n }\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n if (repr.needsRebuild) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Rebuild molecule geometry asynchronously.\r\n */\r\n rebuild() {\r\n const self = this;\r\n\r\n // Destroy current geometry\r\n gfxutils.clearTree(this);\r\n\r\n return new Promise(((resolve) => {\r\n // Nothing to do?\r\n const complex = self._complex;\r\n if (!complex) {\r\n resolve();\r\n return;\r\n }\r\n\r\n let errorOccured = false;\r\n setTimeout(() => {\r\n console.time('build');\r\n const reprList = self._reprList;\r\n const palette = palettes.get(settings.now.palette) || palettes.first;\r\n let hasGeometry = false;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n repr.colorer.palette = palette;\r\n\r\n if (repr.needsRebuild) {\r\n repr.reset();\r\n\r\n try {\r\n repr.buildGeometry(complex);\r\n } catch (e) {\r\n if (e instanceof utils.OutOfMemoryError) {\r\n repr.needsRebuild = false;\r\n repr.reset();\r\n logger.error(`Not enough memory to build geometry for representation ${repr.index + 1}`);\r\n errorOccured = true;\r\n } else {\r\n throw e;\r\n }\r\n }\r\n\r\n if (DEBUG && !errorOccured) {\r\n logger.debug(`Triangles count: ${meshutils.countTriangles(repr.geo)}`);\r\n }\r\n }\r\n\r\n hasGeometry = errorOccured || hasGeometry || gfxutils.groupHasGeometryToRender(repr.geo);\r\n\r\n if (repr.geo) {\r\n self.add(repr.geo);\r\n }\r\n }\r\n\r\n self._reprListChanged = false;\r\n\r\n console.timeEnd('build');\r\n resolve();\r\n }, 10);\r\n }));\r\n }\r\n\r\n setNeedsRebuild() {\r\n // invalidate all representations\r\n const reprList = this._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n reprList[i].needsRebuild = true;\r\n }\r\n }\r\n\r\n rebuildSelectionGeometry() {\r\n const mask = 1 << this._selectionBit;\r\n\r\n gfxutils.clearTree(this._selectionGeometry);\r\n\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const repr = this._reprList[i];\r\n const sg = repr.buildSelectionGeometry(mask);\r\n if (!sg) {\r\n continue;\r\n }\r\n\r\n this._selectionGeometry.add(sg);\r\n for (let j = 0; j < sg.children.length; j++) {\r\n const m = sg.children[j];\r\n\r\n // copy component transform (that's not applied yet)\r\n // TODO make this code obsolete, accessing editor is bad\r\n if (this._editor && this._editor._componentTransforms) {\r\n const t = this._editor._componentTransforms[m._component._index];\r\n if (t) {\r\n m.position.copy(t.position);\r\n m.quaternion.copy(t.quaternion);\r\n }\r\n }\r\n }\r\n\r\n gfxutils.applySelectionMaterial(sg);\r\n }\r\n }\r\n\r\n _buildSelectorFromSortedLists(atoms, residues, chains) {\r\n const complex = this._complex;\r\n\r\n function optimizeList(list) {\r\n const result = [];\r\n let k = 0;\r\n let first = NaN;\r\n let last = NaN;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n const value = list[i];\r\n if (value === last + 1) {\r\n last = value;\r\n } else {\r\n if (!Number.isNaN(first)) {\r\n result[k++] = new selectors.Range(first, last);\r\n }\r\n first = last = value;\r\n }\r\n }\r\n if (!Number.isNaN(first)) {\r\n result[k] = new selectors.Range(first, last);\r\n }\r\n return result;\r\n }\r\n\r\n let expression = null;\r\n if (chains.length === complex._chains.length) {\r\n expression = selectors.all();\r\n } else {\r\n let selector;\r\n if (chains.length > 0) {\r\n selector = selectors.chain(chains);\r\n expression = expression ? selectors.or(expression, selector) : selector;// NOSONAR\r\n }\r\n if (Object.keys(residues).length > 0) {\r\n for (const ch in residues) {\r\n if (residues.hasOwnProperty(ch)) {\r\n selector = selectors.and(\r\n selectors.chain(ch),\r\n selectors.residx(optimizeList(residues[ch])),\r\n );\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n }\r\n }\r\n if (atoms.length > 0) {\r\n selector = selectors.serial(optimizeList(atoms));\r\n expression = expression ? selectors.or(expression, selector) : selector;\r\n }\r\n\r\n if (!expression) {\r\n expression = selectors.none();\r\n }\r\n }\r\n\r\n return expression;\r\n }\r\n\r\n buildSelectorFromMask(mask) {\r\n const complex = this._complex;\r\n const chains = [];\r\n const residues = {};\r\n const atoms = [];\r\n\r\n complex.forEachChain((chain) => {\r\n if (chain._mask & mask) {\r\n chains.push(chain._name);\r\n }\r\n });\r\n\r\n complex.forEachResidue((residue) => {\r\n if (residue._mask & mask && !(residue._chain._mask & mask)) {\r\n const c = residue._chain._name;\r\n if (!(c in residues)) {\r\n residues[c] = [residue._index];\r\n } else {\r\n residues[c].push(residue._index);\r\n }\r\n }\r\n });\r\n\r\n complex.forEachAtom((atom) => {\r\n if (atom.mask & mask && !(atom.residue._mask & mask)) {\r\n atoms.push(atom.serial);\r\n }\r\n });\r\n\r\n return this._buildSelectorFromSortedLists(atoms, residues, chains);\r\n }\r\n\r\n forSelectedResidues(process) {\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.forEachResidue((residue) => {\r\n if (residue._mask & selectionMask) {\r\n process(residue);\r\n }\r\n });\r\n }\r\n\r\n beginComponentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.ComponentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n beginFragmentEdit() {\r\n if (this._editor) {\r\n return null;\r\n }\r\n\r\n const editor = new ComplexVisualEdit.FragmentEditor(this);\r\n if (!editor.begin()) {\r\n return null;\r\n }\r\n\r\n this._editor = editor;\r\n return editor;\r\n }\r\n\r\n // should only be called by editors\r\n finalizeEdit() {\r\n this._editor = null;\r\n }\r\n\r\n setMaterialValues(values, needTraverse = false, process = undefined) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setValues(values);\r\n if (needTraverse) {\r\n rep.geo.traverse((object) => {\r\n if (object instanceof THREE.Mesh) {\r\n object.material.setValues(values);\r\n\r\n if (process !== undefined) {\r\n process(object);\r\n }\r\n\r\n object.material.needsUpdate = true;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n setUberOptions(values) {\r\n for (let i = 0, n = this._reprList.length; i < n; ++i) {\r\n const rep = this._reprList[i];\r\n rep.material.setUberOptions(values);\r\n }\r\n }\r\n\r\n /**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\n within(selector, radius) {\r\n const vw = this._complex.getVoxelWorld();\r\n if (vw === null) {\r\n return false;\r\n }\r\n\r\n // mark atoms of the group as selected\r\n const selectionMask = 1 << this._selectionBit;\r\n this._complex.markAtoms(selector, selectionMask);\r\n\r\n // mark all atoms within distance as selected\r\n if (vw) {\r\n vw.forEachAtomWithinDistFromMasked(this._complex, selectionMask, Number(radius), (atom) => {\r\n atom.mask |= selectionMask;\r\n });\r\n }\r\n\r\n // update selection count\r\n this._selectionCount = this._complex.countAtomsByMask(selectionMask);\r\n\r\n // update secondary structure mask\r\n this._complex.updateStructuresMask();\r\n\r\n return this.buildSelectorFromMask(selectionMask);\r\n }\r\n}\r\n// 32 bits = 30 bits for reps + 1 for selection + 1 for selection expansion\r\nComplexVisual.NUM_REPRESENTATION_BITS = 30;\r\n\r\nexport default ComplexVisual;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexVolumeFaces from './VolumeFaces.vert';\r\nimport fragmentVolumeFaces from './VolumeFaces.frag';\r\nimport vertexVolume from './Volume.vert';\r\nimport fragmentVolume from './Volume.frag';\r\nimport vertexFarPlane from './VolumeFarPlane.vert';\r\nimport fragmentFarPlane from './VolumeFarPlane.frag';\r\nimport settings from '../../settings';\r\n\r\nconst volumeUniforms = THREE.UniformsUtils.merge([\r\n {\r\n volumeDim: { type: 'v3', value: new THREE.Vector3(512, 512, 512) },\r\n tileTex: { type: 't', value: null },\r\n tileTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n tileStride: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n\r\n boxAngles: { type: 'v3', value: new THREE.Vector3(1, 1, 1) },\r\n delta: { type: 'v3', value: new THREE.Vector3(0, 0, 0) },\r\n\r\n _isoLevel0: { type: 'v2', value: new THREE.Vector3(0.5, 0.75, 1.0) },\r\n _flipV: { type: 'f', value: 0.0 },\r\n _BFLeft: { type: 't', value: null },\r\n _BFRight: { type: 't', value: null },\r\n _FFLeft: { type: 't', value: null },\r\n _FFRight: { type: 't', value: null },\r\n _WFFLeft: { type: 't', value: null },\r\n _WFFRight: { type: 't', value: null },\r\n },\r\n]);\r\n\r\nfunction overrideUniforms(params, defUniforms) {\r\n const uniforms = THREE.UniformsUtils.clone(defUniforms);\r\n for (const p in params) {\r\n if (uniforms.hasOwnProperty(p)) {\r\n uniforms[p].value = params[p];\r\n }\r\n }\r\n return uniforms;\r\n}\r\n\r\nfunction facesPosMaterialParams(params, sideType) {\r\n return {\r\n uniforms: overrideUniforms(params, {}),\r\n vertexShader: vertexVolumeFaces,\r\n fragmentShader: fragmentVolumeFaces,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n side: sideType,\r\n };\r\n}\r\n\r\nclass BackFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const backFaceParams = facesPosMaterialParams(params, THREE.BackSide);\r\n super(backFaceParams);\r\n }\r\n}\r\n\r\nclass ShaderParams {\r\n constructor(params, uniforms, vertexShader, fragmentShader) {\r\n this.uniforms = overrideUniforms(params, uniforms);\r\n this.vertexShader = vertexShader;\r\n this.fragmentShader = fragmentShader;\r\n this.transparent = false;\r\n this.depthTest = false;\r\n this.depthWrite = false;\r\n this.side = THREE.FrontSide;\r\n }\r\n}\r\n\r\nclass BackFacePosMaterialFarPlane extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const matUniforms = THREE.UniformsUtils.merge([\r\n {\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n farZ: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n matWorld2Volume: { type: '4fv', value: new THREE.Matrix4() },\r\n },\r\n ]);\r\n\r\n const shaderParams = new ShaderParams(params, matUniforms, vertexFarPlane, fragmentFarPlane);\r\n super(shaderParams);\r\n }\r\n}\r\n\r\nclass FrontFacePosMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const frontFaceParams = facesPosMaterialParams(params, THREE.FrontSide);\r\n super(frontFaceParams);\r\n }\r\n}\r\n\r\nclass VolumeMaterial extends THREE.ShaderMaterial {\r\n constructor(params) {\r\n const shaderParams = new ShaderParams(params, volumeUniforms, vertexVolume, fragmentVolume);\r\n shaderParams.transparent = true;\r\n shaderParams.depthTest = true;\r\n\r\n super(shaderParams);\r\n this.updateDefines();\r\n }\r\n\r\n updateDefines() {\r\n this.defines = {\r\n ISO_MODE: settings.now.modes.VD.isoMode,\r\n STEPS_COUNT: settings.now.modes.VD.polyComplexity[settings.now.resolution] * 100,\r\n };\r\n this.needsUpdate = true;\r\n }\r\n}\r\n\r\nexport default {\r\n BackFacePosMaterial,\r\n BackFacePosMaterialFarPlane,\r\n FrontFacePosMaterial,\r\n VolumeMaterial,\r\n};\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport settings from '../settings';\r\n\r\nclass VolumeMesh extends THREE.Mesh {\r\n volumeInfo = {}; // data for noise filter\r\n\r\n constructor() {\r\n const geo = new THREE.BufferGeometry();\r\n super(geo);\r\n this.clipPlane = new THREE.Plane();\r\n const size = new THREE.Vector3(0.5, 0.5, 0.5);\r\n this.size = size;\r\n\r\n this.cullFlag = [\r\n true, true, true, true,\r\n true, true, true, true,\r\n false, false, false, false, false, false,\r\n ];\r\n\r\n this.faces = [\r\n { indices: [], norm: new THREE.Vector3(0, 0, -1) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 1) },\r\n { indices: [], norm: new THREE.Vector3(0, -1, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 1, 0) },\r\n { indices: [], norm: new THREE.Vector3(-1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(1, 0, 0) },\r\n { indices: [], norm: new THREE.Vector3(0, 0, 0) },\r\n ];\r\n\r\n this.vertices = [\r\n new THREE.Vector3(-size.x, -size.y, -size.z),\r\n new THREE.Vector3(-size.x, size.y, -size.z),\r\n new THREE.Vector3(size.x, -size.y, -size.z),\r\n new THREE.Vector3(size.x, size.y, -size.z),\r\n new THREE.Vector3(-size.x, -size.y, size.z),\r\n new THREE.Vector3(-size.x, size.y, size.z),\r\n new THREE.Vector3(size.x, -size.y, size.z),\r\n new THREE.Vector3(size.x, size.y, size.z),\r\n new THREE.Vector3(0.0, 0.0, 0.0), // Placeholder for section\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n new THREE.Vector3(0.0, 0.0, 0.0),\r\n ];\r\n\r\n geo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(this.vertices.length * 3), 3));\r\n\r\n this.name = 'VolumeMesh';\r\n }\r\n\r\n static _corners = [\r\n // x, y, z, edge1, edge2, edge3\r\n [-1, -1, -1, 0, 4, 8],\r\n [1, -1, -1, 0, 5, 9],\r\n [1, 1, -1, 1, 5, 10],\r\n [-1, 1, -1, 1, 4, 11],\r\n [-1, -1, 1, 2, 6, 8],\r\n [1, -1, 1, 2, 7, 9],\r\n [1, 1, 1, 3, 7, 10],\r\n [-1, 1, 1, 3, 6, 11],\r\n ];\r\n\r\n static _edges = [\r\n // corner1, corner2, center_x, center_y, center_z\r\n [0, 1, 0, -1, -1],\r\n [2, 3, 0, 1, -1],\r\n [4, 5, 0, -1, 1],\r\n [6, 7, 0, 1, 1],\r\n [0, 3, -1, 0, -1],\r\n [1, 2, 1, 0, -1],\r\n [4, 7, -1, 0, 1],\r\n [5, 6, 1, 0, 1],\r\n [0, 4, -1, -1, 0],\r\n [1, 5, 1, -1, 0],\r\n [2, 6, -1, 1, 0],\r\n [3, 7, 1, 1, 0],\r\n ];\r\n\r\n static _edgeIntersections = (function () {\r\n const edgeIntersections = [];\r\n for (let j = 0; j < 12; ++j) {\r\n edgeIntersections.push(new THREE.Vector3());\r\n }\r\n return edgeIntersections;\r\n }());\r\n\r\n _updateVertices() {\r\n // Algorithm:\r\n // 1. Get plane parameters\r\n // 2. Compute culling flags for all vertices\r\n // 3. If intersection occurs => compute from 3 to 6 intersection points\r\n const corners = VolumeMesh._corners;\r\n const edges = VolumeMesh._edges;\r\n const edgeIntersections = VolumeMesh._edgeIntersections;\r\n\r\n let i;\r\n\r\n const norm = this.clipPlane.normal;\r\n const D = this.clipPlane.constant;\r\n\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n const cornerMark = [0, 0, 0, 0, 0, 0, 0, 0];\r\n const edgeMark = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];\r\n\r\n const curEdge = new THREE.Vector3();\r\n let curEdgeInter = null;\r\n\r\n function CheckX() {\r\n if (norm.x === 0) return 0;\r\n const x = -(norm.dot(curEdge) + D) / norm.x;\r\n if (-size.x <= x && x <= size.x) {\r\n curEdgeInter.set(x, curEdge.y, curEdge.z);\r\n if (x === size.x) return 2;\r\n if (x === -size.x) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckY() {\r\n if (norm.y === 0) return 0;\r\n const y = -(norm.dot(curEdge) + D) / norm.y;\r\n if (-size.y <= y && y <= size.y) {\r\n curEdgeInter.set(curEdge.x, y, curEdge.z);\r\n if (y === size.y) return 2;\r\n if (y === -size.y) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n function CheckZ() {\r\n if (norm.z === 0) return 0;\r\n const z = -(norm.dot(curEdge) + D) / norm.z;\r\n if (-size.z <= z && z <= size.z) {\r\n curEdgeInter.set(curEdge.x, curEdge.y, z);\r\n if (z === size.z) return 2;\r\n if (z === -size.z) return -2;\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n // for each edge\r\n for (let curEdgeIdx = 0; curEdgeIdx < 12; ++curEdgeIdx) {\r\n const curEdgeSource = edges[curEdgeIdx];\r\n curEdgeInter = edgeIntersections[curEdgeIdx];\r\n\r\n curEdge.set(curEdgeSource[2], curEdgeSource[3], curEdgeSource[4]);\r\n curEdge.multiply(size);\r\n\r\n // calculate intersection point\r\n let flag = 0;\r\n if (curEdgeSource[2] === 0) flag = CheckX();\r\n if (curEdgeSource[3] === 0) flag = CheckY();\r\n if (curEdgeSource[4] === 0) flag = CheckZ();\r\n\r\n // mark corresponding corner (if plane cuts through one)\r\n if (flag === -2) {\r\n cornerMark[curEdgeSource[0]] = 1;\r\n } else if (flag === 2) {\r\n cornerMark[curEdgeSource[1]] = 1;\r\n } else if (flag === 0) {\r\n // edge is not intersected by the plane (doesn't produce a vertex)\r\n edgeMark[curEdgeIdx] = 0;\r\n }\r\n }\r\n\r\n const face = {\r\n indices: [],\r\n norm: norm.clone().negate(),\r\n };\r\n\r\n let nextVertex = 8;\r\n\r\n // for each marked corner\r\n for (i = 0; i < 8; ++i) {\r\n if (cornerMark[i] === 1) {\r\n // add corner as vertex to the face\r\n vert[nextVertex].set(corners[i][0], corners[i][1], corners[i][2]).multiply(size);\r\n face.indices.push(nextVertex++);\r\n // skip adjacent edges\r\n edgeMark[corners[i][3]] = 0;\r\n edgeMark[corners[i][4]] = 0;\r\n edgeMark[corners[i][5]] = 0;\r\n }\r\n }\r\n\r\n // for each edge that has internal intersection\r\n for (i = 0; i < 12; ++i) {\r\n if (edgeMark[i] === 1) {\r\n // add intersection point as vertex to the face\r\n vert[nextVertex].copy(edgeIntersections[i]);\r\n face.indices.push(nextVertex++);\r\n }\r\n }\r\n\r\n this.faces[6] = face;\r\n\r\n const diff = new THREE.Vector3();\r\n const coplanarPoint = new THREE.Vector3();\r\n this.clipPlane.coplanarPoint(coplanarPoint);\r\n for (i = 0; i < vert.length; ++i) {\r\n this.cullFlag[i] = false;\r\n if (i < 8) {\r\n // corners should be culled by clipping plane\r\n diff.subVectors(vert[i], coplanarPoint);\r\n this.cullFlag[i] = (norm.dot(diff) >= 0.0);\r\n } else if (i < 8 + face.indices.length) {\r\n // cross section vertices don't get culled\r\n this.cullFlag[i] = true;\r\n }\r\n }\r\n\r\n // write data to vertex buffer\r\n const positions = this.geometry.getAttribute('position');\r\n let idx = 0;\r\n for (i = 0; i < vert.length; ++i) {\r\n positions.array[idx++] = vert[i].x;\r\n positions.array[idx++] = vert[i].y;\r\n positions.array[idx++] = vert[i].z;\r\n }\r\n positions.needsUpdate = true;\r\n }\r\n\r\n _collectVertices(face, filter) {\r\n let i;\r\n const vert = this.vertices;\r\n face.indices = [];\r\n for (i = 0; i < vert.length; ++i) {\r\n if (this.cullFlag[i] && filter(vert[i])) {\r\n face.indices.push(i);\r\n }\r\n }\r\n }\r\n\r\n _sortIndices(face, right) {\r\n let i;\r\n let j;\r\n const vert = this.vertices;\r\n const angle = [];\r\n\r\n const dir = new THREE.Vector3();\r\n for (i = 1; i < face.indices.length; ++i) {\r\n dir.subVectors(vert[face.indices[i]], vert[face.indices[0]]);\r\n dir.normalize();\r\n dir.cross(right);\r\n dir.negate();\r\n angle[i] = face.norm.dot(dir);\r\n }\r\n\r\n // Exchange sort\r\n for (i = 1; i < face.indices.length - 1; ++i) {\r\n for (j = i + 1; j < face.indices.length; ++j) {\r\n if (angle[j] < angle[i]) {\r\n // swap\r\n let t = angle[i];\r\n angle[i] = angle[j];\r\n angle[j] = t;\r\n\r\n t = face.indices[i];\r\n face.indices[i] = face.indices[j];\r\n face.indices[j] = t;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _updateIndices() {\r\n // Algorithm:\r\n // 1. Get plane vertices (from 3 to 6 vertices)\r\n // 2. Get \"right\" vector in plane\r\n // 3. Sort vertices using Graham-like method\r\n // 4. Create indices\r\n\r\n let i;\r\n let faceIdx;\r\n let face;\r\n const vert = this.vertices;\r\n const { size } = this;\r\n\r\n this._collectVertices(this.faces[0], (vertex) => vertex.z === -size.z);\r\n this._collectVertices(this.faces[1], (vertex) => vertex.z === size.z);\r\n this._collectVertices(this.faces[2], (vertex) => vertex.y === -size.y);\r\n this._collectVertices(this.faces[3], (vertex) => vertex.y === size.y);\r\n this._collectVertices(this.faces[4], (vertex) => vertex.x === -size.x);\r\n this._collectVertices(this.faces[5], (vertex) => vertex.x === size.x);\r\n\r\n const vCenter = new THREE.Vector3();\r\n const vRight = new THREE.Vector3();\r\n const vDir = new THREE.Vector3();\r\n\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n\r\n if (face.indices.length === 0) continue;\r\n\r\n vCenter.set(0, 0, 0);\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vCenter.add(vert[face.indices[i]]);\r\n }\r\n vCenter.multiplyScalar(1.0 / face.indices.length);\r\n vRight.subVectors(vert[face.indices[0]], vCenter);\r\n vRight.normalize();\r\n\r\n const rightProj = [];\r\n for (i = 0; i < face.indices.length; ++i) {\r\n vDir.subVectors(vert[face.indices[i]], vCenter);\r\n rightProj[i] = vDir.dot(vRight);\r\n }\r\n for (i = 1; i < face.indices.length; ++i) {\r\n if (rightProj[i] < rightProj[0]) {\r\n // swap\r\n let t = rightProj[0];\r\n rightProj[0] = rightProj[i];\r\n rightProj[i] = t;\r\n\r\n [t] = face.indices;\r\n face.indices[0] = face.indices[i];\r\n face.indices[i] = t;\r\n }\r\n }\r\n\r\n this._sortIndices(face, vRight);\r\n }\r\n\r\n let numIndices = 0;\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n if (face.indices.length >= 3) {\r\n numIndices += 3 * (face.indices.length - 2);\r\n }\r\n }\r\n let offset = 0;\r\n const indices = new Uint16Array(numIndices);\r\n for (faceIdx = 0; faceIdx < this.faces.length; ++faceIdx) {\r\n face = this.faces[faceIdx];\r\n for (i = 0; i < face.indices.length - 2; ++i) {\r\n indices[offset] = face.indices[0]; // eslint-disable-line prefer-destructuring\r\n indices[offset + 1] = face.indices[i + 1];\r\n indices[offset + 2] = face.indices[i + 2];\r\n offset += 3;\r\n }\r\n }\r\n\r\n this.geometry.setIndex(new THREE.BufferAttribute(indices, 1));\r\n }\r\n\r\n setDataSource(dataSource) {\r\n const vm = new VolumeMaterial.VolumeMaterial();\r\n const dim = dataSource.getDimensions();\r\n const stride = dataSource.getTiledTextureStride();\r\n const texture = dataSource.buildTiledTexture();\r\n const bbox = dataSource.getBox();\r\n vm.uniforms.volumeDim.value.set(dim[0], dim[1], dim[2]);\r\n vm.uniforms.tileTex.value = texture;\r\n vm.uniforms.tileTexSize.value.set(texture.image.width, texture.image.height);\r\n vm.uniforms.tileStride.value.set(stride[0], stride[1]);\r\n Object.assign(this.volumeInfo, dataSource.getVolumeInfo());\r\n\r\n const volInfo = this.volumeInfo;\r\n vm.uniforms.delta.value.copy(volInfo.delta);\r\n vm.uniforms.boxAngles.value.set(volInfo.obtuseAngle[0], volInfo.obtuseAngle[1], volInfo.obtuseAngle[2]);\r\n\r\n this.material = vm;\r\n\r\n bbox.getSize(this.scale);\r\n bbox.getCenter(this.position);\r\n }\r\n\r\n _updateIsoLevel() {\r\n const { kSigma, kSigmaMed, kSigmaMax } = settings.now.modes.VD;\r\n const volInfo = this.volumeInfo;\r\n const mean = volInfo.dmean - volInfo.dmin;\r\n const span = volInfo.dmax - volInfo.dmin;\r\n const level = (k) => (mean + k * volInfo.sd) / span;\r\n this.material.uniforms._isoLevel0.value.set(level(kSigma), level(kSigmaMed), level(kSigmaMax));\r\n }\r\n\r\n static _nearClipPlaneOffset = 0.2;\r\n\r\n static _pos = new THREE.Vector3();\r\n\r\n static _norm = new THREE.Vector3();\r\n\r\n static _norm4D = new THREE.Vector4();\r\n\r\n static _matrixWorldToLocal = new THREE.Matrix4();\r\n\r\n static _clipPlane = new THREE.Plane();\r\n\r\n rebuild(camera) {\r\n const nearClipPlaneOffset = VolumeMesh._nearClipPlaneOffset;\r\n const pos = VolumeMesh._pos;\r\n const norm = VolumeMesh._norm;\r\n const norm4D = VolumeMesh._norm4D;\r\n const matrixWorldToLocal = VolumeMesh._matrixWorldToLocal;\r\n const clipPlane = VolumeMesh._clipPlane;\r\n\r\n this._updateIsoLevel();\r\n\r\n // get clip plane in local space\r\n camera.getWorldDirection(norm);\r\n camera.getWorldPosition(pos);\r\n pos.addScaledVector(norm, camera.near + nearClipPlaneOffset);\r\n\r\n // transform pos to local CS\r\n matrixWorldToLocal.copy(this.matrixWorld).invert();\r\n pos.applyMatrix4(matrixWorldToLocal);\r\n\r\n // transform norm to local CS\r\n norm4D.set(norm.x, norm.y, norm.z, 0.0); // NOTE: use homogeneous norm for proper transformation\r\n norm4D.applyMatrix4(matrixWorldToLocal);\r\n norm.copy(norm4D);\r\n norm.normalize();\r\n\r\n clipPlane.setFromNormalAndCoplanarPoint(norm, pos);\r\n\r\n if (!this.clipPlane.equals(clipPlane)) {\r\n this.clipPlane = clipPlane.clone();\r\n this._updateVertices();\r\n this._updateIndices();\r\n }\r\n }\r\n}\r\n\r\nexport default VolumeMesh;\r\n","import * as THREE from 'three';\r\nimport gfxutils from './gfxutils';\r\n\r\nfunction _flattenArray(input) {\r\n const n = input.length;\r\n const output = new Float32Array(n * 3);\r\n for (let i = 0; i < n; ++i) {\r\n const j = 3 * i;\r\n const v = input[i];\r\n output[j] = v.x;\r\n output[j + 1] = v.y;\r\n output[j + 2] = v.z;\r\n }\r\n return output;\r\n}\r\n\r\nclass VolumeBounds {\r\n static _projectionTable = { // corresponds between (origin axes and angles between them) and between saving vector coordinates\r\n XY: ['x', 2],\r\n XZ: ['y', 1],\r\n YZ: ['z', 0],\r\n };\r\n\r\n constructor(bBox, volInfo) {\r\n const { delta } = volInfo; // {x: XY, y : XZ, z: YZ}\r\n const { obtuseAngle } = volInfo; // 1 - obtuse, 0 - acute\r\n\r\n const bSize = new THREE.Vector3();\r\n bBox.getSize(bSize);\r\n bSize.multiplyScalar(0.5);\r\n\r\n const offsetVert = this._getBaseVertices(delta, obtuseAngle);\r\n\r\n const geometry = new THREE.BufferGeometry();\r\n const vertices = [];\r\n\r\n for (let i = 0; i < 4; i++) {\r\n vertices.push(offsetVert[i].clone().multiply(bSize));\r\n vertices.push(offsetVert[(i + 1) % 4].clone().multiply(bSize));\r\n }\r\n const translation = new THREE.Vector3(2 * bSize.x * (1 - delta.x - delta.y), 0, 0);\r\n for (let i = 0; i < 8; i++) {\r\n vertices.push(vertices[i].clone().add(translation));\r\n }\r\n for (let i = 0; i < 4; i++) {\r\n vertices.push(vertices[i * 2].clone());\r\n vertices.push(vertices[i * 2 + 8].clone());\r\n }\r\n const center = new THREE.Vector3();\r\n bBox.getCenter(center);\r\n vertices.forEach((vertex) => vertex.add(center)); // pivot shift\r\n\r\n const flatVertices = _flattenArray(vertices);\r\n geometry.setAttribute('position', new THREE.BufferAttribute(flatVertices, 3));\r\n\r\n this._lines = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ color: 0xFFFFFF }));\r\n this._lines.layers.set(gfxutils.LAYERS.VOLUME);\r\n }\r\n\r\n // Set one edge (4 points) of frame, from which with parallel transfer the rest of the frame points can be obtained\r\n _getBaseVertices(delta, obtuseAngle) {\r\n const projTable = VolumeBounds._projectionTable;\r\n\r\n const proj = ((index, inv) => { // tricky function to take account of projections: their position(related to box) and sign\r\n const currDelta = delta[projTable[index][0]];\r\n const angleValue = -0.5 * (inv - 1) + inv * obtuseAngle[projTable[index][1]];// inv = 1: alpha; inv = -1: 1 - alpha\r\n return angleValue * currDelta;\r\n });\r\n\r\n const offsetVert = [\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', 1)), -1 + 2 * proj('YZ', 1), -1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', 1)), -1 + 2 * proj('YZ', -1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', -1) + proj('XY', -1)), 1 - 2 * proj('YZ', 1), 1),\r\n new THREE.Vector3(-1 + 2 * (proj('XZ', 1) + proj('XY', -1)), 1 - 2 * proj('YZ', -1), -1),\r\n ];\r\n\r\n return offsetVert;\r\n }\r\n\r\n getMesh() {\r\n return this._lines;\r\n }\r\n}\r\n\r\nexport default VolumeBounds;\r\n","import * as THREE from 'three';\r\nimport VolumeMaterial from './shaders/VolumeMaterial';\r\nimport meshes from './meshes/meshes';\r\nimport gfxutils from './gfxutils';\r\n\r\n// Thes geometric far plane is required for correct filling in the BFTexture in case, when far plane cuts the volume\r\n// cube. In cut place of cube there is no correct data in BFTexture and volume rendering integral is calculated\r\n// with errors.\r\n// Far plane cuts the cube in case of large volume scale (zoom), because farplane doesn't change\r\nclass VolumeFarPlane {\r\n // create plane with unit corners coords (for future rescale in vshader according to camera properties)\r\n constructor(volume, width, height) {\r\n const planeGeo = this._initPlaneGeo(width, height);\r\n\r\n const mat = new VolumeMaterial.BackFacePosMaterialFarPlane();\r\n this._plane = new meshes.Mesh(planeGeo, mat);\r\n this._plane.frustumCulled = false;\r\n this._plane.doubleSided = true;\r\n const matWorldToVolume = new THREE.Matrix4();\r\n\r\n this._plane._onBeforeRender = function (_renderer, _scene, camera, _geometry, _material, _group) {\r\n const { material } = this;\r\n if (!volume || !material) {\r\n return;\r\n }\r\n\r\n // count point in world at farplane place\r\n const planeCamPos = new THREE.Vector4(0, 0, -(camera.far - 0.1), 1);\r\n planeCamPos.applyMatrix4(camera.matrixWorld);\r\n\r\n // recalc matrices to make plane be placed as farplane in the World relative to camera\r\n this.matrix.identity();\r\n this.matrix.makeTranslation(planeCamPos.x, planeCamPos.y, planeCamPos.z);\r\n this.matrixWorld.copy(this.matrix);\r\n this.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, this.matrixWorld);\r\n this.normalMatrix.getNormalMatrix(this.modelViewMatrix);\r\n\r\n // build worldToVolume matrix to transform plane into volumeCS (volumeCS coords are written to BackFaceTexture)\r\n const volumeMatrix = volume.matrixWorld;\r\n matWorldToVolume.copy(volumeMatrix).invert();\r\n\r\n // update material props\r\n material.uniforms.aspectRatio.value = camera.aspect;\r\n material.uniforms.farZ.value = camera.far;\r\n material.uniforms.tanHalfFOV.value = Math.tan(THREE.MathUtils.DEG2RAD * 0.5 * camera.fov);\r\n material.uniforms.matWorld2Volume.value = matWorldToVolume;\r\n };\r\n\r\n // set it to special layer to draw only into BFTexture\r\n this._plane.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n }\r\n\r\n _initPlaneGeo(width, height) {\r\n const planeGeo = new THREE.BufferGeometry();\r\n\r\n width = width || 1;\r\n height = height || 1;\r\n\r\n const vertices = new Float32Array([\r\n -0.5 * width, 0.5 * height, 0,\r\n 0.5 * width, 0.5 * height, 0,\r\n -0.5 * width, -0.5 * height, 0,\r\n 0.5 * width, -0.5 * height, 0,\r\n ]);\r\n\r\n planeGeo.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\r\n planeGeo.setIndex([0, 2, 1, 2, 3, 1]);\r\n\r\n return planeGeo;\r\n }\r\n\r\n getMesh() {\r\n return this._plane;\r\n }\r\n}\r\n\r\nexport default VolumeFarPlane;\r\n","import * as THREE from 'three';\r\nimport VolumeMesh from './gfx/VolumeMesh';\r\nimport VolumeBounds from './gfx/VolumeBounds';\r\nimport VolumeFarPlane from './gfx/VolumeFarPlane';\r\nimport Visual from './Visual';\r\nimport settings from './settings';\r\n\r\nclass VolumeVisual extends Visual {\r\n constructor(name, dataSource) {\r\n super(name, dataSource);\r\n this._mesh = new VolumeMesh();\r\n this._mesh.setDataSource(dataSource);\r\n this.add(this._mesh);\r\n\r\n this._frame = new VolumeBounds(this.getBoundaries().boundingBox, this._mesh.volumeInfo);\r\n this.add(this._frame.getMesh());\r\n this.showFrame(settings.now.modes.VD.frame);\r\n\r\n this._farPlane = new VolumeFarPlane(this._mesh, 2, 2);\r\n this.add(this._farPlane.getMesh());\r\n }\r\n\r\n getBoundaries() {\r\n const box = this._dataSource.getBox();\r\n const sphere = new THREE.Sphere();\r\n box.getBoundingSphere(sphere);\r\n\r\n return {\r\n boundingBox: box,\r\n boundingSphere: sphere,\r\n };\r\n }\r\n\r\n getMesh() {\r\n return this._mesh;\r\n }\r\n\r\n showFrame(needShow) {\r\n this._frame.getMesh().material.visible = needShow;\r\n }\r\n}\r\n\r\nexport default VolumeVisual;\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available loaders.\r\n * @extends EntityList\r\n */\r\nclass LoaderList extends EntityList {\r\n /**\r\n * Create a list of loaders.\r\n * The loaders are indexed by supported source types (`.types` property of a Loader\r\n * subclass).\r\n * The loaders can be retrieved later by matching against specs (see {@link LoaderList#find}).\r\n *\r\n * @param {!Array=} someLoaders A list of {@link Loader} subclasses to\r\n * automatically register at creation time.\r\n * @see LoaderList#register\r\n */\r\n constructor(someLoaders = []) {\r\n super(someLoaders, ['types']);\r\n }\r\n\r\n /**\r\n * Find a suitable loader for a source type.\r\n *\r\n * @param {Object} specs Loader specifications.\r\n * @param {string=} specs.type Supported source type.\r\n * @param {*=} specs.source Source to load from.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.type) {\r\n list = this._dict.types[specs.type.toLowerCase()] || [];\r\n } else if (specs.source) {\r\n return this._list.filter((SomeLoader) => SomeLoader.canProbablyLoad && SomeLoader.canProbablyLoad(specs.source));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default LoaderList;\r\n","import EventDispatcher from '../../utils/EventDispatcher';\r\nimport makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Loader extends EventDispatcher {\r\n constructor(source, options) {\r\n super();\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n this._agent = null;\r\n }\r\n\r\n load() {\r\n return Promise.reject(new Error('Loading from this source is not implemented'));\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n if (this._agent) {\r\n this._agent.abort();\r\n }\r\n }\r\n\r\n static extractName(_source) {\r\n return undefined;\r\n }\r\n}\r\n\r\nmakeContextDependent(Loader.prototype);\r\n","import Loader from './Loader';\r\n\r\nexport default class FileLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = options.binary === true;\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const blob = this._source;\r\n const reader = this._agent = new FileReader();\r\n\r\n reader.addEventListener('load', () => {\r\n resolve(reader.result);\r\n });\r\n reader.addEventListener('error', () => {\r\n reject(reader.error);\r\n });\r\n reader.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n reader.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n if (this._binary) {\r\n reader.readAsArrayBuffer(blob);\r\n } else {\r\n reader.readAsText(blob);\r\n }\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return (File && source instanceof File) || (Blob && source instanceof Blob);\r\n }\r\n\r\n static extractName(source) {\r\n return source && source.name;\r\n }\r\n}\r\n\r\nFileLoader.types = ['file', 'blob'];\r\n","import _ from 'lodash';\r\nimport Loader from './Loader';\r\n\r\n// we don't need to detect all kinds of URLs, just the evident ones\r\nconst urlStartRegexp = /^(https?|ftp):\\/\\//i;\r\n\r\nexport default class XHRLoader extends Loader {\r\n constructor(source, options) {\r\n super(source, options);\r\n\r\n options = this._options;\r\n this._binary = (options.binary === true);\r\n }\r\n\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n\r\n const url = this._source;\r\n const request = this._agent = new XMLHttpRequest();\r\n\r\n request.addEventListener('load', () => {\r\n if (request.status === 200) {\r\n resolve(request.response);\r\n } else {\r\n reject(new Error(`HTTP ${request.status} while fetching ${url}`));\r\n }\r\n });\r\n request.addEventListener('error', () => {\r\n reject(new Error('HTTP request failed'));\r\n });\r\n request.addEventListener('abort', () => {\r\n reject(new Error('Loading aborted'));\r\n });\r\n request.addEventListener('progress', (event) => {\r\n this.dispatchEvent(event);\r\n });\r\n\r\n request.open('GET', url);\r\n if (this._binary) {\r\n request.responseType = 'arraybuffer';\r\n } else {\r\n request.responseType = 'text';\r\n }\r\n request.send();\r\n });\r\n }\r\n\r\n static canProbablyLoad(source) {\r\n return _.isString(source) && urlStartRegexp.test(source);\r\n }\r\n\r\n static extractName(source) {\r\n if (source) {\r\n const last = (source.indexOf('?') + 1 || source.lastIndexOf('#') + 1 || source.length + 1) - 1;\r\n return source.slice(source.lastIndexOf('/', last) + 1, last);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nXHRLoader.types = ['url'];\r\n","import Loader from './Loader';\r\n\r\nexport default class ImmediateLoader extends Loader {\r\n load() {\r\n return new Promise((resolve) => {\r\n if (this._abort) {\r\n throw new Error('Loading aborted');\r\n }\r\n resolve(this._source);\r\n });\r\n }\r\n\r\n static canProbablyLoad(_source) {\r\n return false;\r\n }\r\n}\r\n\r\nImmediateLoader.types = ['immediate'];\r\n","import LoaderList from './loaders/LoaderList';\r\n\r\nimport FileLoader from './loaders/FileLoader';\r\nimport XHRLoader from './loaders/XHRLoader';\r\nimport ImmediateLoader from './loaders/ImmediateLoader';\r\n\r\nexport default new LoaderList([\r\n // note: order might be important\r\n FileLoader,\r\n XHRLoader,\r\n ImmediateLoader,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available parsers.\r\n * @extends EntityList\r\n */\r\nclass ParserList extends EntityList {\r\n /**\r\n * Create a list of parsers.\r\n * The parsers are indexed by supported data formats and file extensions (`.formats` and\r\n * `.extensions` properties of a Parser subclass).\r\n * The parsers can be retrieved later by matching against specs (see {@link ParsrerList#find}).\r\n *\r\n * @param {!Array=} someParsers A list of {@link Parser} subclasses to\r\n * automatically register at creation time.\r\n * @see ParserList#register\r\n */\r\n constructor(someParsers = []) {\r\n super(someParsers, ['formats', 'extensions']);\r\n }\r\n\r\n /**\r\n * Find a suitable parser for data.\r\n *\r\n * @param {Object} specs Parser specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {string=} specs.ext Supported filename extension.\r\n * @param {*=} specs.data Data to parse.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n } else if (specs.ext) {\r\n list = this._dict.extensions[specs.ext.toLowerCase()] || [];\r\n }\r\n // autodetect only if no format is forced\r\n if (list.length === 0 && !specs.format && specs.data) {\r\n return this._list.filter((SomeParser) => SomeParser.canProbablyParse && SomeParser.canProbablyParse(specs.data));\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ParserList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Parser {\r\n constructor(data, options) {\r\n this._data = data;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n parseSync() {\r\n throw new Error('Parsing this type of data is not implemented');\r\n }\r\n\r\n parse() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Parsing aborted'));\r\n }\r\n return resolve(this.parseSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n // only for volume Parsers\r\n getModel() {\r\n this.model._parseHeader(this._data);\r\n return this.model;\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Parser.prototype);\r\n","import * as THREE from 'three';\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 290\".\r\n *\r\n * @exports Remark290\r\n * @constructor\r\n */\r\nclass Remark290 {\r\n constructor() {\r\n /** @type {THREE.Matrix4[]} */\r\n this.matrices = [];\r\n\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (stream.readString(12, 18) === ' SMTRY') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === this.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n this.matrices[this.matrices.length] = matrix;\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n }\r\n }\r\n}\r\n\r\nRemark290.prototype.id = 290;\r\n\r\nexport default Remark290;\r\n","import * as THREE from 'three';\r\nimport chem from '../../../chem';\r\n\r\nconst { Assembly } = chem;\r\n\r\n/**\r\n * Parser helper for PDB tag \"REMARK 350\".\r\n *\r\n * @exports Remark350\r\n * @constructor\r\n */\r\nclass Remark350 {\r\n constructor(complex) {\r\n /** @type {Complex} */\r\n this._complex = complex;\r\n /** @type {Assembly[]} */\r\n this.assemblies = [];\r\n\r\n /** @type {?Assembly} */\r\n this._assembly = null;\r\n /** @type {?THREE.Matrix4} */\r\n this._matrix = null;\r\n /** @type {number} */\r\n this._matrixIndex = -1;\r\n }\r\n\r\n /**\r\n * Parse a single line of a stream.\r\n * @param {PDBStream} stream - stream to parse\r\n */\r\n\r\n parse(stream) {\r\n /** @type {?Assembly} */\r\n let assembly = this._assembly;\r\n /** @type {?THREE.Matrix4} */\r\n let matrix = this._matrix;\r\n\r\n if (assembly && stream.readString(12, 18) === ' BIOMT') {\r\n const matrixRow = stream.readCharCode(19) - 49; // convert '1', '2', or '3' -> 0, 1, or 2\r\n const matrixData = stream.readString(20, 80).trim().split(/\\s+/);\r\n const matrixIndex = parseInt(matrixData[0], 10);\r\n if (this._matrix === null || matrixIndex !== this._matrixIndex) {\r\n // TODO: assert(matrixIndex === assembly.matrices.length + 1);\r\n this._matrixIndex = matrixIndex;\r\n this._matrix = matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n }\r\n\r\n const { elements } = matrix;\r\n elements[matrixRow] = parseFloat(matrixData[1]);\r\n elements[matrixRow + 4] = parseFloat(matrixData[2]);\r\n elements[matrixRow + 8] = parseFloat(matrixData[3]);\r\n elements[matrixRow + 12] = parseFloat(matrixData[4]);\r\n } else if (assembly && stream.readString(35, 41) === 'CHAINS:') {\r\n const entries = stream.readString(42, 80).split(',');\r\n for (let i = 0, n = entries.length; i < n; ++i) {\r\n const chain = entries[i].trim();\r\n if (chain.length > 0) {\r\n assembly.addChain(chain);\r\n }\r\n }\r\n } else if (stream.readString(12, 23) === 'BIOMOLECULE:') {\r\n // assert molIndex === this.assemblies.length + 1\r\n this._matrix = null;\r\n this._matrixIndex = -1;\r\n this._assembly = assembly = new Assembly(this._complex);\r\n this.assemblies.push(assembly);\r\n }\r\n }\r\n}\r\n\r\nRemark350.prototype.id = 350;\r\n\r\nexport default Remark350;\r\n","/** Helper class for stream-like reading input files. */\r\nclass PDBStream {\r\n /**\r\n * Create a stream\r\n * @param {String} data Input data\r\n */\r\n constructor(data) {\r\n /** @type String */\r\n this._data = data; // Input file\r\n /** @type Number */\r\n this._start = 0; // Starting position of line\r\n /** @type Number */\r\n this._nextCR = -1; // Position of next CR (0x0D)\r\n /** @type Number */\r\n this._nextLF = -1; // Position of next LF (0x0A)\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n /** @type Number */\r\n this._end = data.length; // End of data\r\n\r\n this.next();\r\n }\r\n\r\n /**\r\n * Reading next line.\r\n * @returns {String} Next line in data (ending with LF or CR)\r\n */\r\n readLine() {\r\n return this._data.slice(this._start, this._next);\r\n }\r\n\r\n /**\r\n * Reading character from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {String} Character from position\r\n */\r\n readChar(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data[pos] : ' ';\r\n }\r\n\r\n /**\r\n * Reading character code from position.\r\n * @param {Number} pos - Position in current line.\r\n * @returns {Number} Character code from position\r\n */\r\n readCharCode(pos) {\r\n pos = this._start + pos - 1;\r\n return pos < this._next ? this._data.charCodeAt(pos) : 32;\r\n }\r\n\r\n /**\r\n * Reading string from begin to end points.\r\n * For a reason unknown, numbering assumed not to start from 0, but from 1.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {String} String from begin to end\r\n */\r\n readString(begin, end) {\r\n const from = this._start + begin - 1;\r\n const to = this._start + end;\r\n return this._data.slice(from, to < this._next ? to : this._next);\r\n }\r\n\r\n /**\r\n * Reading integer from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Integer from begin to end\r\n */\r\n readInt(begin, end) {\r\n return parseInt(this.readString(begin, end), 10);\r\n }\r\n\r\n /**\r\n * Reading float from begin to end points.\r\n * @param {Number} begin - Begin point in current line.\r\n * @param {Number} end - End point in current line.\r\n * @returns {Number} Float from begin to end\r\n */\r\n readFloat(begin, end) {\r\n return parseFloat(this.readString(begin, end));\r\n }\r\n\r\n /**\r\n * Checking for end of data.\r\n * @returns {boolean} True if data is ended, false otherwise\r\n */\r\n end() {\r\n return this._start >= this._end;\r\n }\r\n\r\n /**\r\n * Procedure to re-arrange current pointers in data.\r\n */\r\n next() {\r\n const start = this._next + 1;\r\n this._start = start < this._end ? start : this._end;\r\n\r\n // support CR, LF, CR+LF line endings\r\n // do not support LF+CR, CR+CR+LF, and other strange combinations\r\n\r\n if (this._start > this._nextCR) {\r\n this._nextCR = (this._data.indexOf('\\r', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n if (this._start > this._nextLF) {\r\n this._nextLF = (this._data.indexOf('\\n', this._start) + 1 || this._end + 1) - 1;\r\n }\r\n this._next = this._nextCR + 1 < this._nextLF ? this._nextCR : this._nextLF;\r\n }\r\n}\r\n\r\nexport default PDBStream;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport Remark290 from './pdb/Remark290';\r\nimport Remark350 from './pdb/Remark350';\r\nimport PDBStream from './PDBStream';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst TAG_LENGTH = 6;\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\n// the most frequently used beginnings; although HEADER is mandatory, it is often missing in handmade files\r\nconst pdbStartRegexp = /^(HEADER\\s|COMPND\\s|REMARK\\s|ATOM {2}|HETATM|MODEL )/i;\r\n\r\nconst remarkParsers = {\r\n // NOTE: please forget the idea to build the method name in runtime, it can be obfuscated.\r\n 290: Remark290,\r\n 350: Remark350,\r\n};\r\n\r\nclass PDBParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._sheet = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._compaundFound = false;\r\n this._biomoleculeFound = false;\r\n this._allowedChainsIDs = null;\r\n this._lastMolId = -1;\r\n\r\n this._remarks = {};\r\n this._remark = null;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n this._compndCurrToken = '';\r\n\r\n this._options.fileType = 'pdb';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && pdbStartRegexp.test(data);\r\n }\r\n\r\n _finalize() {\r\n this._fixBondsArray();\r\n this._fixChains();\r\n\r\n // keep crystallographic symmetry transformations\r\n const remark290 = this._remarks[290];\r\n this._complex.symmetry = _.isUndefined(remark290) ? [] : remark290.matrices;\r\n\r\n // add loaded biological assemblies\r\n const remark350 = this._remarks[350];\r\n this._complex.units = this._complex.units.concat(_.isUndefined(remark350) ? [] : remark350.assemblies);\r\n\r\n // add loaded macromolecules\r\n this._finalizeMolecules();\r\n\r\n // create secondary structure etc.\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _finalizeMolecules() {\r\n // get chains from complex\r\n const chainDict = {};\r\n let i;\r\n const chains = this._complex._chains;\r\n for (i = 0; i < chains.length; ++i) {\r\n const chainObj = chains[i];\r\n const chainName = chainObj._name;\r\n chainDict[chainName] = chainObj;\r\n }\r\n\r\n // aggregate residues from chains\r\n for (i = 0; i < this._molecules.length; i++) {\r\n const m = this._molecules[i];\r\n let residues = [];\r\n for (let j = 0; j < m._chains.length; j++) {\r\n const name = m._chains[j];\r\n const chain = chainDict[name];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, m._name, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _fixChains() {\r\n const idChainMap = {};\r\n const complex = this._complex;\r\n\r\n // prepare\r\n for (let i = 0; i < complex._chains.length; i++) {\r\n const chain = complex._chains[i];\r\n idChainMap[chain._name.charCodeAt(0)] = chain;\r\n }\r\n }\r\n\r\n // FIXME: This function is redundant, CONECT records always follow ATOM and HETATM. Build the map online.\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseATOM(stream) {\r\n if (this._modelId !== 1) {\r\n return;\r\n }\r\n\r\n /* eslint-disable no-magic-numbers */\r\n const het = stream.readCharCode(1) === 0x48;\r\n\r\n // field names according to wwPDB Format\r\n // NOTE: Chimera allows (nonstandard) use of columns 6-11 for the integer atom serial number in ATOM records.\r\n const serial = het ? stream.readInt(7, 11) : stream.readInt(6, 11);\r\n let name = stream.readString(13, 16);\r\n const altLoc = stream.readChar(17);\r\n const resName = stream.readString(18, 20).trim();\r\n const chainID = stream.readChar(22);\r\n const resSeq = stream.readInt(23, 26);\r\n const iCode = stream.readChar(27);\r\n const x = stream.readFloat(31, 38);\r\n const y = stream.readFloat(39, 46);\r\n const z = stream.readFloat(47, 54);\r\n const occupancy = stream.readFloat(55, 60);\r\n const tempFactor = stream.readFloat(61, 66);\r\n const element = stream.readString(77, 78).trim() || nameToElement(name);\r\n const charge = stream.readInt(79, 80) || 0;\r\n /* eslint-enable no-magic-numbers */\r\n // skip waters (there may be lots of them)\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n // PDB uses positional system for atom names. It helps derive element type from the name\r\n // but names may include extra spaces. From this point on we don't need those spaces anymore.\r\n name = name.trim();\r\n\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name]; // FIXME: Maybe should use type as additional index (\" CA \" vs. \"CA \")\r\n\r\n // NOTE: Residues of a particular chain are not required to be listed next to each other.\r\n // https://github.com/biasmv/pv/commit/7319b898b7473ba380c26699e3b028b2b1a7e1a1\r\n let chain = this._chain;\r\n if (!chain || chain.getName() !== chainID) {\r\n this._chain = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n _parseENDMDL() {\r\n this._modelId += 1;\r\n }\r\n\r\n _parseCONECT(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const serial0 = stream.readInt(7, 11);\r\n const serial1 = stream.readInt(12, 16);\r\n const serial2 = stream.readInt(17, 21);\r\n const serial3 = stream.readInt(22, 26);\r\n const serial4 = stream.readInt(27, 31);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n const complex = this._complex;\r\n\r\n // Keep bonds ordered by atom serial\r\n if (serial1 && serial1 > serial0) {\r\n complex.addBond(serial0, serial1, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial2 && serial2 > serial0) {\r\n complex.addBond(serial0, serial2, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial3 && serial3 > serial0) {\r\n complex.addBond(serial0, serial3, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n if (serial4 && serial4 > serial0) {\r\n complex.addBond(serial0, serial4, 0, Bond.BondType.UNKNOWN, true);\r\n }\r\n }\r\n\r\n _parseCOMPND(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const str = stream.readString(11, 80);\r\n const tokenIdx = str.indexOf(':');\r\n this._compndCurrToken = tokenIdx > 0 ? str.substring(0, tokenIdx).trim() : this._compndCurrToken;\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // start reading new molecule\r\n if (this._compndCurrToken === 'MOL_ID') {\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = parseInt(str.substring(tokenIdx + 1, str.indexOf(';')), 10);\r\n this._molecules.push(this._molecule);\r\n // parse molecule name\r\n } else if (this._compndCurrToken === 'MOLECULE' && this._molecule != null) {\r\n this._molecule._name = str.substring(tokenIdx + 1, str.indexOf(';')).trim();\r\n // parse molecule chains\r\n } else if (this._compndCurrToken === 'CHAIN' && this._molecule != null) {\r\n let chainStr = str.substring(tokenIdx + 1, 80).trim();\r\n const lastChar = chainStr[chainStr.length - 1];\r\n if (lastChar === ';' || lastChar === ',') {\r\n chainStr = chainStr.slice(0, -1);\r\n }\r\n chainStr = chainStr.replace(/\\s+/g, '');\r\n const chains = chainStr.split(',');\r\n this._molecule._chains = this._molecule._chains.concat(chains);\r\n }\r\n }\r\n\r\n _parseREMARK(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const remarkNum = stream.readInt(8, 10);\r\n /* eslint-enable no-magic-numbers */\r\n\r\n // create remark parser if needed\r\n let remark = this._remarks[remarkNum];\r\n if (_.isUndefined(remark)) {\r\n const RemarkParser = remarkParsers[remarkNum];\r\n if (_.isFunction(RemarkParser)) {\r\n this._remarks[remarkNum] = remark = new RemarkParser(this._complex);\r\n }\r\n }\r\n\r\n // delegate parsing\r\n if (!_.isUndefined(remark)) {\r\n remark.parse(stream);\r\n }\r\n }\r\n\r\n _parseHELIX(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [20, 22, 32, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addHelix(obj);\r\n this._complex.structures.push(obj);\r\n });\r\n }\r\n\r\n _parseSHEET(stream) {\r\n /* eslint-disable no-magic-numbers */\r\n const fields = [22, 23, 33, 34];\r\n /* eslint-enable no-magic-numbers */\r\n this._parseSTRUCTURE(stream, fields, (obj) => {\r\n this._complex.addSheet(obj);\r\n });\r\n }\r\n\r\n _parseSTRUCTURE(stream, pars, adder) {\r\n const startId = 0;\r\n const startIndex = 1;\r\n const endId = 2;\r\n const endIndex = 3;\r\n\r\n // identify fields: debugging and stuff\r\n /* eslint-disable no-magic-numbers */\r\n const codeOfS = 0x53;\r\n const serialNumber = stream.readInt(8, 10);\r\n const structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim()\r\n const comment = stream.readString(41, 70).trim();\r\n const helLength = stream.readInt(72, 76);\r\n const helixClass = stream.readInt(39, 40);\r\n const shWidth = stream.readInt(15, 16);\r\n const shCur = stream.readInt(42, 45);\r\n const shPrev = stream.readInt(57, 60);\r\n /* eslint-enable no-magic-numbers */\r\n // file fields\r\n const startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0);\r\n const endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0);\r\n const startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3);\r\n let iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4);\r\n let startICode = 0;\r\n\r\n if (iCodeStr.length > 0) {\r\n startICode = iCodeStr.charCodeAt(0);\r\n }\r\n const endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3);\r\n iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4);\r\n let endICode = 0;\r\n if (iCodeStr.length > 0) {\r\n endICode = iCodeStr.charCodeAt(0);\r\n }\r\n\r\n let obj;\r\n let cs = this._sheet;\r\n if (stream.readCharCode(1) === codeOfS) {\r\n if (cs !== null && cs.getName() !== structureName) {\r\n cs = null;\r\n this._sheet = null;\r\n }\r\n if (cs === null) {\r\n this._sheet = obj = new Sheet(structureName, shWidth);\r\n adder(obj);\r\n } else {\r\n obj = cs;\r\n }\r\n const strand = new Strand(\r\n obj,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n helixClass,\r\n shCur,\r\n shPrev,\r\n );\r\n obj.addStrand(strand);\r\n this._complex.structures.push(strand);\r\n } else {\r\n obj = new Helix(\r\n helixClass,\r\n this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),\r\n this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),\r\n serialNumber,\r\n structureName,\r\n comment,\r\n helLength,\r\n );\r\n adder(obj);\r\n }\r\n }\r\n\r\n _parseHEADER(stream) {\r\n const { metadata } = this._complex;\r\n metadata.classification = stream.readString(11, 50).trim();\r\n metadata.date = stream.readString(51, 59).trim();\r\n\r\n const id = stream.readString(63, 66).trim();\r\n metadata.id = id;\r\n if (id) {\r\n this._complex.name = id;\r\n }\r\n metadata.format = 'pdb';\r\n }\r\n\r\n _parseTITLE(stream) {\r\n const { metadata } = this._complex;\r\n metadata.title = metadata.title || [];\r\n\r\n const line = stream.readInt(9, 10) || 1;\r\n metadata.title[line - 1] = stream.readString(11, 80).trim();\r\n }\r\n\r\n static tagParsers = {\r\n HEADER: PDBParser.prototype._parseHEADER,\r\n 'TITLE ': PDBParser.prototype._parseTITLE,\r\n 'ATOM ': PDBParser.prototype._parseATOM,\r\n HETATM: PDBParser.prototype._parseATOM,\r\n ENDMDL: PDBParser.prototype._parseENDMDL,\r\n CONECT: PDBParser.prototype._parseCONECT,\r\n COMPND: PDBParser.prototype._parseCOMPND,\r\n REMARK: PDBParser.prototype._parseREMARK,\r\n // 'SOURCE': PDBParser.prototype._parseSOURCE,\r\n 'HELIX ': PDBParser.prototype._parseHELIX,\r\n 'SHEET ': PDBParser.prototype._parseSHEET,\r\n\r\n // nonstandard extension to allow range 100,000 - 999,999\r\n 'ATOM 1': PDBParser.prototype._parseATOM,\r\n 'ATOM 2': PDBParser.prototype._parseATOM,\r\n 'ATOM 3': PDBParser.prototype._parseATOM,\r\n 'ATOM 4': PDBParser.prototype._parseATOM,\r\n 'ATOM 5': PDBParser.prototype._parseATOM,\r\n 'ATOM 6': PDBParser.prototype._parseATOM,\r\n 'ATOM 7': PDBParser.prototype._parseATOM,\r\n 'ATOM 8': PDBParser.prototype._parseATOM,\r\n 'ATOM 9': PDBParser.prototype._parseATOM,\r\n };\r\n\r\n parseSync() {\r\n const stream = new PDBStream(this._data);\r\n const result = this._complex = new Complex();\r\n\r\n // parse PDB line by line\r\n while (!stream.end()) {\r\n const tag = stream.readString(1, TAG_LENGTH);\r\n const func = PDBParser.tagParsers[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, stream);\r\n }\r\n stream.next();\r\n }\r\n\r\n // Resolve indices and serials to objects\r\n this._finalize();\r\n\r\n // cleanup\r\n this._serialAtomMap = null;\r\n this._sheet = null;\r\n this._residue = null;\r\n this._chain = null;\r\n this._complex = null;\r\n\r\n if (result.getAtomCount() === 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\nPDBParser.formats = ['pdb'];\r\nPDBParser.extensions = ['.pdb', '.ent'];\r\n\r\nexport default PDBParser;\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n SGroup,\r\n Bond,\r\n} = chem;\r\n\r\nconst cOrderCharCodes = {\r\n A: 0,\r\n S: 1,\r\n D: 2,\r\n T: 3,\r\n};\r\n\r\nconst cmlStartRegexp = /\\s*<\\?xml\\b[^?>]*\\?>\\s*<(?:cml|molecule)\\b/i;\r\n\r\nclass CMLParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._complex = null;\r\n this._residue = null;\r\n this._serialAtomMap = null;\r\n this._modelId = 1;\r\n this._lastMolId = -1;\r\n this._readOnlyOneMolecule = false;\r\n this._options.fileType = 'cml';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && cmlStartRegexp.test(data);\r\n }\r\n\r\n _rebuidBondIndexes(atoms, bonds) {\r\n const count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n\r\n const countBonds = bonds.length;\r\n for (let j = 0; j < countBonds; j++) {\r\n const idxs = bonds[j].atomRefs2.split(' ');\r\n if (idxs[0] === atomId) {\r\n bonds[j].start = i;\r\n }\r\n\r\n if (idxs[1] === atomId) {\r\n bonds[j].end = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _createSGroup(molecule, moleculeArr) {\r\n const newGroup = new SGroup(\r\n molecule.id,\r\n molecule.fieldData,\r\n new THREE.Vector3(parseFloat(molecule.x), parseFloat(molecule.y), 0),\r\n molecule.atomRefs,\r\n molecule,\r\n );\r\n if (molecule.placement === 'Relative') {\r\n newGroup._center = new THREE.Vector3(0, 0, 0);\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_CHARGE') {\r\n newGroup._charge = parseInt(molecule.fieldData, 10) || 0;\r\n }\r\n if (molecule.fieldName === 'MDLBG_FRAGMENT_COEFFICIENT') {\r\n newGroup._repeat = parseInt(molecule.fieldData, 10) || 1;\r\n }\r\n moleculeArr.push(newGroup);\r\n }\r\n\r\n _extractSGroup(molecule, moleculeArr) {\r\n if (!Array.isArray(moleculeArr)) {\r\n moleculeArr = [];\r\n }\r\n\r\n if (molecule) {\r\n if (Array.isArray(molecule)) {\r\n const count = molecule.length;\r\n for (let i = 0; i < count; i++) {\r\n if (molecule[i].molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule[i].molecule));\r\n }\r\n this._createSGroup(molecule[i], moleculeArr);\r\n }\r\n } else {\r\n if (molecule.molecule) {\r\n if (molecule.molecule) {\r\n moleculeArr = moleculeArr.concat(this._extractSGroup(molecule.molecule));\r\n }\r\n }\r\n this._createSGroup(molecule, moleculeArr);\r\n }\r\n }\r\n\r\n return moleculeArr;\r\n }\r\n\r\n _extractSGroups(molecule, atoms) {\r\n const moleculeArr = this._extractSGroup(molecule);\r\n\r\n const count = atoms.length;\r\n let i;\r\n let j;\r\n\r\n for (i = 0; i < count; i++) {\r\n const atomId = atoms[i].id;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n const firstAtomRef = moleculeArr[j]._atoms.split(' ')[0];\r\n if (firstAtomRef === atomId) {\r\n if (!atoms[i].sgroupRef) {\r\n atoms[i].sgroupRef = [];\r\n }\r\n atoms[i].sgroupRef.push(moleculeArr[j]);\r\n }\r\n }\r\n }\r\n // build sGroups centers\r\n let atomMap = {}; // sgrpmap cache\r\n let mapEntry = null;\r\n const nLimon = 100000000;\r\n const bLow = new THREE.Vector3(nLimon, nLimon, nLimon);\r\n const bHight = new THREE.Vector3(-nLimon, -nLimon, -nLimon);\r\n\r\n function cycleFuncInner(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n moleculeArr[j]._atoms.push(mapEntry.a);\r\n }\r\n }\r\n\r\n function cycleFunc(e) {\r\n mapEntry = atomMap[e];\r\n if (mapEntry) {\r\n bLow.set(Math.min(bLow.x, mapEntry.x), Math.min(bLow.y, mapEntry.y), Math.min(bLow.z, mapEntry.z));\r\n bHight.set(Math.max(bHight.x, mapEntry.x), Math.max(bHight.y, mapEntry.y), Math.max(bHight.z, mapEntry.z));\r\n cycleFuncInner(e);\r\n }\r\n }\r\n\r\n for (i = 0; i < atoms.length; i++) {\r\n atomMap[atoms[i].id] = {};\r\n atomMap[atoms[i].id].x = atoms[i].x2;\r\n if (atoms[i].x3) {\r\n atomMap[atoms[i].id].x = atoms[i].x3;\r\n }\r\n atomMap[atoms[i].id].x = parseFloat(atomMap[atoms[i].id].x);\r\n atomMap[atoms[i].id].y = atoms[i].y2;\r\n if (atoms[i].y3) {\r\n atomMap[atoms[i].id].y = atoms[i].y3;\r\n }\r\n atomMap[atoms[i].id].y = parseFloat(atomMap[atoms[i].id].y);\r\n atomMap[atoms[i].id].z = '0.0';\r\n if (atoms[i].z3) {\r\n atomMap[atoms[i].id].z = atoms[i].z3;\r\n }\r\n atomMap[atoms[i].id].z = parseFloat(atomMap[atoms[i].id].z);\r\n atomMap[atoms[i].id].a = atoms[i];\r\n }\r\n\r\n let atomsRef;\r\n for (j = 0; j < moleculeArr.length; j++) {\r\n if (moleculeArr[j]._center !== null) {\r\n bLow.set(nLimon, nLimon, nLimon);\r\n bHight.set(-nLimon, -nLimon, -nLimon);\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFunc);\r\n\r\n moleculeArr[j]._center.addVectors(bLow, bHight);\r\n moleculeArr[j]._center.multiplyScalar(0.5);\r\n } else {\r\n atomsRef = moleculeArr[j]._atoms.split(' ');\r\n moleculeArr[j]._atoms = [];\r\n atomsRef.forEach(cycleFuncInner);\r\n }\r\n }\r\n atomMap = null;\r\n }\r\n\r\n _traverseData(dom) {\r\n function isArray(o) {\r\n return Object.prototype.toString.apply(o) === '[object Array]';\r\n }\r\n\r\n function parseNode(xmlNode, result) {\r\n if (xmlNode.nodeName === '#text' && xmlNode.nodeValue.trim() === '') {\r\n return;\r\n }\r\n\r\n const jsonNode = {};\r\n jsonNode.xmlNode = xmlNode;\r\n const existing = result[xmlNode.nodeName];\r\n if (existing) {\r\n if (!isArray(existing)) {\r\n result[xmlNode.nodeName] = [existing, jsonNode];\r\n } else {\r\n result[xmlNode.nodeName].push(jsonNode);\r\n }\r\n } else {\r\n result[xmlNode.nodeName] = jsonNode;\r\n }\r\n\r\n let length;\r\n let i;\r\n if (xmlNode.attributes) {\r\n ({ length } = xmlNode.attributes);\r\n for (i = 0; i < length; i++) {\r\n const attribute = xmlNode.attributes[i];\r\n jsonNode[attribute.nodeName] = attribute.nodeValue;\r\n }\r\n }\r\n\r\n ({ length } = xmlNode.childNodes);\r\n for (i = 0; i < length; i++) {\r\n parseNode(xmlNode.childNodes[i], jsonNode);\r\n }\r\n }\r\n\r\n const result = {};\r\n if (dom.childNodes.length) {\r\n parseNode(dom.childNodes[0], result);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n _findSuitableMolecule(data, molSet) {\r\n for (const key in data) {\r\n if (key === 'xmlNode') {\r\n continue;\r\n } else if (key === 'molecule') {\r\n if (data.molecule) {\r\n if (data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n molSet.push(data);\r\n }\r\n if (Array.isArray(data.molecule)) {\r\n for (let i = 0; i < data.molecule.length; i++) {\r\n if (data.molecule[i].atomArray && data.molecule[i].atomArray.atom) {\r\n molSet.push({ molecule: data.molecule[i] });\r\n }\r\n }\r\n }\r\n }\r\n } else if (data[key] && data[key] !== null && typeof (data[key]) === 'object') {\r\n this._findSuitableMolecule(data[key], molSet);\r\n }\r\n }\r\n }\r\n\r\n _selectComponents(text) {\r\n const parser = new DOMParser();\r\n const doc = parser.parseFromString(text, 'application/xml');\r\n const traversedData = this._traverseData(doc);\r\n let rawData;\r\n const self = this;\r\n\r\n function prepareComponentCompound(data) {\r\n let atoms = [];\r\n if (data.molecule && data.molecule.atomArray && data.molecule.atomArray.atom) {\r\n if (!Array.isArray(data.molecule.atomArray.atom)) {\r\n atoms.push(data.molecule.atomArray.atom);\r\n } else {\r\n atoms = data.molecule.atomArray.atom;\r\n }\r\n } else if (!data.molecule) {\r\n const ret = {};\r\n ret.atomLabels = null;\r\n ret.labelsCount = 1;\r\n return ret;\r\n }\r\n\r\n if (data.molecule.molecule) {\r\n self._extractSGroups(data.molecule.molecule, atoms);\r\n }\r\n\r\n let atom;\r\n let count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges = [];\r\n }\r\n\r\n let localBond = [];\r\n if (data.molecule.bondArray && data.molecule.bondArray.bond) {\r\n if (!Array.isArray(data.molecule.bondArray.bond)) {\r\n localBond.push(data.molecule.bondArray.bond);\r\n } else {\r\n localBond = data.molecule.bondArray.bond;\r\n }\r\n }\r\n let bond;\r\n count = localBond.length;\r\n self._rebuidBondIndexes(atoms, localBond);\r\n\r\n function addCurrBond(index) {\r\n bond = localBond[index];\r\n atom = atoms[bond.start];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.end);\r\n atom = atoms[bond.end];\r\n if (!atom) {\r\n return false;\r\n }\r\n atom.edges.push(bond.start);\r\n return true;\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n if (!addCurrBond(i)) {\r\n // ignore invalid bond\r\n continue;\r\n }\r\n const orderAttr = bond.xmlNode.getAttribute('order');\r\n const tc = parseInt(orderAttr, 10);\r\n // the default bond order is unknown\r\n localBond[i].order = 0;\r\n localBond[i].type = Bond.BondType.UNKNOWN;\r\n if (tc > 1) {\r\n localBond[i].order = tc;\r\n } else {\r\n // another option - bond order is a string\r\n const order = cOrderCharCodes[orderAttr];\r\n if (order !== undefined) {\r\n localBond[i].order = order;\r\n if (orderAttr === 'A') {\r\n localBond[i].type = Bond.BondType.AROMATIC;\r\n }\r\n }\r\n }\r\n }\r\n\r\n count = atoms.length;\r\n for (let i = 0; i < count; i++) {\r\n atom = atoms[i];\r\n atom.edges.sort();\r\n }\r\n\r\n const labels = self._breadWidthSearch(atoms, 0); // for now\r\n\r\n const retStruct = {};\r\n retStruct.atoms = atoms;\r\n retStruct.bonds = localBond;\r\n retStruct.labels = labels.atomLabels;\r\n retStruct.count = Math.min(1, labels.labelsCount); // for now\r\n retStruct.curr = -1;\r\n retStruct.originalCML = doc;\r\n\r\n return retStruct;\r\n }\r\n\r\n if (traversedData.cml) {\r\n rawData = traversedData.cml;\r\n } else {\r\n rawData = traversedData;\r\n }\r\n const retData = [];\r\n const filteredData = [];\r\n this._findSuitableMolecule(rawData, filteredData);\r\n if (this._readOnlyOneMolecule && filteredData.length > 1) {\r\n filteredData.splice(1, filteredData.length - 1);\r\n }\r\n filteredData.forEach((d) => {\r\n const rd = prepareComponentCompound(d);\r\n if (rd.atoms.length > 0) {\r\n retData.push(rd);\r\n }\r\n });\r\n return retData;\r\n }\r\n\r\n _packLabel(compId, molId) {\r\n const shift = 16;\r\n return (molId << shift) + compId;\r\n }\r\n\r\n _unpackLabel(l) {\r\n const shift = 16;\r\n const mask = (1 << shift) - 1;\r\n return { molId: l >>> shift, compId: l & mask };\r\n }\r\n\r\n _breadWidthSearch(atoms, molID) {\r\n const atomLabels = new Array(atoms.length);\r\n\r\n let id;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n atomLabels[id] = this._packLabel(0, molID);\r\n }\r\n\r\n const breadthQueue = [];\r\n let componentID = 0;\r\n let labeledAtoms = atoms.length;\r\n\r\n while (labeledAtoms > 0) {\r\n componentID++;\r\n\r\n let startID = -1;\r\n for (id = 0; id < atomLabels.length; id++) {\r\n if (this._unpackLabel(atomLabels[id]).compId === 0) {\r\n startID = id;\r\n break;\r\n }\r\n }\r\n\r\n if (startID < 0) {\r\n break;\r\n }\r\n\r\n // Bread first search\r\n breadthQueue.push(atoms[startID]);\r\n atomLabels[startID] = this._packLabel(componentID, molID);\r\n labeledAtoms--;\r\n\r\n while (breadthQueue.length > 0) {\r\n const curr = breadthQueue.shift();\r\n if (!curr) {\r\n continue;\r\n }\r\n\r\n for (let i = 0; i < curr.edges.length; i++) {\r\n if (atomLabels[curr.edges[i]] !== componentID) {\r\n breadthQueue.push(atoms[curr.edges[i]]);\r\n atomLabels[curr.edges[i]] = componentID;\r\n labeledAtoms--;\r\n }\r\n }\r\n }\r\n }\r\n const ret = {};\r\n ret.atomLabels = atomLabels;\r\n ret.labelsCount = componentID;\r\n return ret;\r\n }\r\n\r\n _parseBond(eAtom, mainAtom, order, type) {\r\n if (eAtom >= 0) {\r\n const h = [Math.min(eAtom, mainAtom), Math.max(eAtom, mainAtom)];\r\n this._complex.addBond(h[0], h[1], order, type, true);\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const complex = this._complex;\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, ni = atoms.length; i < ni; ++i) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n const bonds = complex._bonds;\r\n const { logger } = this;\r\n for (let j = 0, nj = bonds.length; j < nj; ++j) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n logger.debug('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _parseSet(varData) {\r\n const complex = this._complex = new Complex();\r\n const data = varData;\r\n const currentLabel = data.curr;\r\n const { atoms, labels } = data;\r\n let atom = null;\r\n let i;\r\n let j;\r\n const count = atoms.length;\r\n\r\n function addFunc(a) {\r\n a.xmlNodeRef = atom;\r\n if (atom.x2) {\r\n atom.x3 = atom.x2;\r\n delete atom.x2;\r\n }\r\n if (atom.y2) {\r\n atom.y3 = atom.y2;\r\n delete atom.y2;\r\n }\r\n if (!(atom.z3)) {\r\n atom.z3 = '0.0';\r\n }\r\n atom.complexAtom = a;\r\n }\r\n\r\n let chains = {};\r\n // parse atoms in label order\r\n const reorder = [];\r\n for (i = 0; i < count; i++) {\r\n reorder.push(i);\r\n }\r\n reorder.sort((a, b) => labels[a] - labels[b]);\r\n for (i = 0; i < count; i++) {\r\n const atomCharge = 0;\r\n const lLabel = labels[reorder[i]];\r\n if (this._unpackLabel(lLabel).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[reorder[i]];\r\n const atomFullNameStruct = atom.elementType;\r\n\r\n if (atom.sgroupRef) {\r\n const countRef = atom.sgroupRef.length;\r\n for (let k = 0; k < countRef; ++k) {\r\n complex._sgroups.push(atom.sgroupRef[k]);\r\n }\r\n }\r\n\r\n if (atom.x3 || atom.x2) {\r\n const currAtomComp = this._unpackLabel(lLabel).compId;\r\n // use ' ' by default instead of synthetic creation of chain names\r\n const chainID = ' '; //= String.fromCharCode('A'.charCodeAt(0) + currAtomComp);\r\n const resSeq = currAtomComp;\r\n const iCode = ' ';\r\n let strLabel = currAtomComp.toString();\r\n if (strLabel.length === 1) {\r\n strLabel = `0${strLabel}`;\r\n }\r\n const resName = `N${strLabel}`;\r\n let chain = chains[chainID];\r\n if (!chain || chain.getName() !== chainID) {\r\n chains[chainID] = chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = null;\r\n }\r\n\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n this._residue = residue = chain.addResidue(resName, resSeq, iCode);\r\n }\r\n\r\n // _x, _y, _z, mname, mindex, atomNameFull, atomName, chainID, serial, isHet, atlLocInd, atomNameToTypeF\r\n let xyz = null;\r\n if (atom.x3) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x3), parseFloat(atom.y3), parseFloat(atom.z3));\r\n } else if (atom.x2) {\r\n xyz = new THREE.Vector3(parseFloat(atom.x2), parseFloat(atom.y2), 0);\r\n }\r\n let element = Element.ByName[atom.elementType.toUpperCase()];\r\n if (!element) {\r\n element = (JSON.parse(JSON.stringify(Element.ByName[\r\n Object.keys(Element.ByName)[Object.keys(Element.ByName).length - 1]])));\r\n element.number += 1;\r\n element.name = atom.elementType.toUpperCase();\r\n element.fullName = 'Unknown';\r\n Element.ByName[atom.elementType.toUpperCase()] = element;\r\n }\r\n const atomSerial = parseInt(atom.id.replace(/[^0-9]/, ''), 10);\r\n const added = residue.addAtom(\r\n atomFullNameStruct,\r\n element,\r\n xyz,\r\n Element.Role.SG,\r\n true,\r\n atomSerial,\r\n ' ',\r\n 1.0,\r\n 0.0,\r\n atomCharge,\r\n );\r\n if (atom.hydrogenCount) {\r\n added.hydrogenCount = parseInt(atom.hydrogenCount, 10);\r\n }\r\n if (atom.mrvValence) {\r\n added.valence = parseInt(atom.mrvValence, 10);\r\n }\r\n addFunc(added);\r\n }\r\n }\r\n }\r\n chains = null;// NOSONAR\r\n for (i = 0; i < data.bonds.length; i++) {\r\n const cb = data.bonds[i];\r\n if (this._unpackLabel(labels[cb.start]).molId === this._unpackLabel(currentLabel).molId\r\n && this._unpackLabel(labels[cb.end]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[cb.start];\r\n if (!atom || !(atoms[cb.end])) {\r\n continue; // skip invalid\r\n }\r\n this._parseBond(\r\n parseInt(atom.id.replace(/[^0-9]/, ''), 10),\r\n parseInt(atoms[cb.end].id.replace(/[^0-9]/, ''), 10),\r\n cb.order,\r\n cb.type,\r\n );\r\n }\r\n }\r\n\r\n for (i = 0; i < this._complex.getSGroupCount(); i++) {\r\n const sGrp = this._complex.getSGroups()[i];\r\n for (j = 0; j < sGrp._atoms.length; j++) {\r\n sGrp._atoms[j] = sGrp._atoms[j].complexAtom;\r\n }\r\n }\r\n for (i = 0; i < count; i++) {\r\n if (this._unpackLabel(labels[i]).molId === this._unpackLabel(currentLabel).molId) {\r\n atom = atoms[i];\r\n atom.complexAtom = null;\r\n delete atom.complexAtom;\r\n }\r\n }\r\n this._complex.originalCML = data.originalCML;\r\n this._fixBondsArray();\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n this._serialAtomMap = null;\r\n this._complex = null;\r\n return complex;\r\n }\r\n\r\n parseSync() {\r\n const complexes = [];\r\n const self = this;\r\n const moleculaSet = this._selectComponents(this._data);\r\n moleculaSet.forEach((molSet) => {\r\n molSet.curr = 2;\r\n if (molSet.count === 0) {\r\n molSet.count = 1;\r\n }\r\n for (let i = 0; i < molSet.count; i++) {\r\n molSet.curr = (i + 1);\r\n complexes.push(self._parseSet(molSet, false));\r\n }\r\n });\r\n\r\n let totalAtomsParsed = 0;\r\n complexes.forEach((c) => {\r\n totalAtomsParsed += c.getAtomCount();\r\n });\r\n if (totalAtomsParsed <= 0) {\r\n throw new Error('The data does not contain valid atoms');\r\n }\r\n\r\n if (complexes.length > 1) {\r\n const joinedComplex = new Complex();\r\n joinedComplex.joinComplexes(complexes);\r\n joinedComplex.originalCML = complexes[0].originalCML;\r\n return joinedComplex;\r\n }\r\n if (complexes.length === 1) {\r\n return complexes[0];\r\n }\r\n return new Complex();\r\n }\r\n}\r\n\r\nCMLParser.formats = ['cml'];\r\nCMLParser.extensions = ['.cml'];\r\n\r\nexport default CMLParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport MMTF from '../../../vendor/js/mmtf';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\n\r\nconst {\r\n Complex,\r\n Chain,\r\n Atom,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Bond,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nclass ArrayComparator {\r\n constructor(original) {\r\n this._original = Array.from(original);\r\n this._original.sort();\r\n\r\n this._sum = 0;\r\n for (let i = 0; i < this._original.length; ++i) {\r\n this._sum += this._original[i];\r\n }\r\n }\r\n\r\n compare(candidate) {\r\n const len = candidate.length;\r\n if (len !== this._original.length) {\r\n return false;\r\n }\r\n\r\n let sum = 0;\r\n let i;\r\n for (i = 0; i < len; ++i) {\r\n sum += candidate[i];\r\n }\r\n\r\n if (sum !== this._sum) {\r\n return false;\r\n }\r\n\r\n const sorted = Array.from(candidate);\r\n sorted.sort();\r\n\r\n for (i = 0; i < len; ++i) {\r\n if (sorted[i] !== this._original[i]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\nArrayComparator.prototype.constructor = ArrayComparator;\r\n\r\nconst StructuralElementType = StructuralElement.Type;\r\n\r\n// see https://github.com/rcsb/mmtf-javascript/blob/master/src/mmtf-traverse.js\r\nconst secStructToType = [\r\n StructuralElementType.HELIX_PI, // 0\r\n StructuralElementType.BEND, // 1\r\n StructuralElementType.HELIX_ALPHA, // 2\r\n StructuralElementType.STRAND, // 3\r\n StructuralElementType.HELIX_310, // 4\r\n StructuralElementType.BRIDGE, // 5\r\n StructuralElementType.TURN, // 6\r\n StructuralElementType.COIL, // 7\r\n];\r\n\r\nfunction getFirstByte(buf) {\r\n const bytes = new Uint8Array(buf, 0, 1);\r\n return bytes[0];\r\n}\r\n\r\nclass MMTFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'mmtf';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n // check if it's binary MessagePack format containing a map (dictionary)\r\n // see https://github.com/msgpack/msgpack/blob/master/spec.md\r\n return _.isArrayBuffer(data) && ((getFirstByte(data) | 1) === 0xDF);\r\n }\r\n\r\n _onModel(_modelData) {\r\n }\r\n\r\n _onChain(chainData) {\r\n if (chainData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const chain = new Chain(this._complex, chainData.chainName);\r\n this._complex._chains[chainData.chainIndex] = chain;\r\n chain._index = chainData.chainIndex;\r\n }\r\n\r\n _onGroup(groupData) {\r\n if (groupData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n if (this.settings.now.nowater) {\r\n // skip water\r\n if (groupData.groupName === 'HOH' || groupData.groupName === 'WAT') {\r\n return;\r\n }\r\n }\r\n\r\n const chain = this._complex._chains[groupData.chainIndex];\r\n const icode = !groupData.insCode.charCodeAt(0) ? '' : groupData.insCode;\r\n const residue = chain.addResidue(groupData.groupName, groupData.groupId, icode);\r\n residue._index = groupData.groupIndex;\r\n\r\n this._updateSecStructure(this._complex, residue, groupData);\r\n }\r\n\r\n _onAtom(atomData) {\r\n if (atomData.modelIndex !== 0) {\r\n return;\r\n }\r\n\r\n const altLoc = !atomData.altLoc.charCodeAt(0) ? '' : atomData.altLoc;\r\n const atom = new Atom(\r\n atomData.groupIndex, // we store residue index here to replace it later with actual reference\r\n atomData.atomName,\r\n Element.getByName(atomData.element.toUpperCase()),\r\n new THREE.Vector3(atomData.xCoord, atomData.yCoord, atomData.zCoord),\r\n Element.Role[atomData.atomName],\r\n false, // hetero atoms will be marked later\r\n atomData.atomId,\r\n altLoc,\r\n atomData.occupancy,\r\n atomData.bFactor,\r\n atomData.formalCharge,\r\n );\r\n\r\n this._complex._atoms[atomData.atomIndex] = atom;\r\n atom.index = atomData.atomIndex;\r\n\r\n this._serialAtomMap[atomData.atomId] = atom;\r\n }\r\n\r\n _onBond(bondData) {\r\n const right = Math.max(bondData.atomIndex1, bondData.atomIndex2);\r\n if (right >= this._complex._atoms.length) {\r\n return;\r\n }\r\n const left = Math.min(bondData.atomIndex1, bondData.atomIndex2);\r\n this._complex.addBond(\r\n this._complex._atoms[left],\r\n this._complex._atoms[right],\r\n bondData.bondOrder,\r\n Bond.BondType.UNKNOWN,\r\n true,\r\n );\r\n }\r\n\r\n _updateSecStructure(complex, residue, groupData) {\r\n const helixClasses = [3, -1, 1, -1, 5];\r\n\r\n if (!_.isUndefined(groupData) && groupData.secStruct === this._ssType) {\r\n residue._secondary = this._ssStruct;\r\n if (this._ssStruct) {\r\n this._ssStruct.term = residue;\r\n }\r\n return;\r\n }\r\n\r\n if (!_.isUndefined(groupData)) {\r\n // start new secondary structure\r\n const type = secStructToType[groupData.secStruct];\r\n this._ssType = groupData.secStruct;\r\n this._ssStart = residue;\r\n\r\n let struct = null;\r\n switch (this._ssType) {\r\n case -1: // undefined\r\n case 7: // coil\r\n break;\r\n case 0: // pi helix\r\n case 2: // alpha helix\r\n case 4: // 3-10 helix\r\n struct = new Helix(helixClasses[this._ssType], residue, residue, 0, '', '', 0);\r\n complex._helices.push(struct);\r\n break;\r\n case 3: { // extended\r\n const sheet = new Sheet('', 0);\r\n complex._sheets.push(sheet);\r\n struct = new Strand(sheet, residue, residue, 0, null, null);\r\n break;\r\n }\r\n default:\r\n if (type !== undefined) {\r\n struct = new StructuralElement(type, residue, residue);\r\n }\r\n break;\r\n }\r\n\r\n this._ssStruct = struct;\r\n residue._secondary = struct;\r\n if (struct) {\r\n complex.structures.push(struct);\r\n }\r\n }\r\n }\r\n\r\n _updateMolecules(mmtfData) {\r\n const entities = mmtfData.entityList;\r\n if (!entities) {\r\n return;\r\n }\r\n\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < entities.length; i++) {\r\n const entity = entities[i];\r\n const chains = entity.chainIndexList;\r\n let residues = [];\r\n for (let j = 0; j < chains.length; j++) {\r\n const chainIndex = chains[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n residues = residues.concat(chain._residues.slice());\r\n }\r\n const molecule = new Molecule(this._complex, entity.description, i + 1);\r\n molecule.residues = residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n // populate complex with chains, residues and atoms\r\n _traverse(mmtfData) {\r\n const self = this;\r\n\r\n // get metadata\r\n const { metadata } = this._complex;\r\n metadata.id = mmtfData.structureId;\r\n metadata.title = [];\r\n metadata.title[0] = mmtfData.title;\r\n metadata.date = mmtfData.releaseDate;\r\n metadata.format = 'mmtf';\r\n\r\n // create event callback functions\r\n const eventCallbacks = {\r\n onModel(modelData) {\r\n self._onModel(modelData);\r\n },\r\n onChain(chainData) {\r\n self._onChain(chainData);\r\n },\r\n onGroup(groupData) {\r\n self._onGroup(groupData);\r\n },\r\n onAtom(atomData) {\r\n self._onAtom(atomData);\r\n },\r\n onBond(bondData) {\r\n self._onBond(bondData);\r\n },\r\n };\r\n\r\n // temporary variables used during traversal to track secondary structures\r\n this._ssType = -1;\r\n this._ssStruct = null;\r\n this._ssStart = null;\r\n\r\n // traverse the structure and listen to the events\r\n MMTF.traverse(mmtfData, eventCallbacks);\r\n\r\n this._updateSecStructure(this._complex);\r\n this._updateMolecules(mmtfData);\r\n }\r\n\r\n // During traversal atoms and residues don't come sequentially\r\n // so a residue for certain atom can be unavailable. Thus we\r\n // store residue index in atom.\r\n // This function being called after traversal replaces the index\r\n // with actual reference, and also populates atom lists in residues.\r\n _linkAtomsToResidues() {\r\n for (let i = 0; i < this._complex._atoms.length; ++i) {\r\n const atom = this._complex._atoms[i];\r\n const residue = this._complex._residues[atom.residue];\r\n atom.residue = residue;\r\n residue._atoms.push(atom);\r\n }\r\n }\r\n\r\n _findSynonymousChains() {\r\n const named = {};\r\n for (let i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!named.hasOwnProperty(name)) {\r\n named[name] = [];\r\n }\r\n\r\n named[name].push(chain._index);\r\n }\r\n\r\n return named;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _parseAssemblyInfo(mmtfData) {\r\n let i;\r\n let j;\r\n let k;\r\n const assemblies = [];\r\n const { logger } = this;\r\n\r\n for (i = 0; i < mmtfData.bioAssemblyList.length; ++i) {\r\n const baInfo = mmtfData.bioAssemblyList[i];\r\n if (baInfo.transformList.length === 0) {\r\n continue;\r\n }\r\n\r\n const chains = baInfo.transformList[0].chainIndexList;\r\n const chainListCheck = new ArrayComparator(chains);\r\n\r\n // build list of chain names\r\n const chainNames = {};\r\n for (j = 0; j < chains.length; ++j) {\r\n chainNames[this._complex._chains[chains[j]].getName()] = 1;\r\n }\r\n\r\n // all chains with the same name should belong to assembly if one of them belongs\r\n const allChains = [];\r\n let name;\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n // just concat arrays -- there should be no duplicates\r\n Array.prototype.push.apply(allChains, this._chainsByName[name]);\r\n }\r\n }\r\n if (!chainListCheck.compare(allChains)) {\r\n // assembly is missing some of the chains\r\n logger.debug('MMTF: Assembly is missing some of the synonymous chains. Skipping...');\r\n }\r\n\r\n const a = new Assembly(this._complex);\r\n\r\n // add chains to assembly\r\n for (name in chainNames) {\r\n if (chainNames.hasOwnProperty(name)) {\r\n a.addChain(name);\r\n }\r\n }\r\n\r\n // add unique matrices to assembly\r\n a.addMatrix(new THREE.Matrix4().fromArray(baInfo.transformList[0].matrix).transpose());\r\n for (j = 1; j < baInfo.transformList.length; ++j) {\r\n const transform = baInfo.transformList[j];\r\n\r\n if (!chainListCheck.compare(transform.chainIndexList)) {\r\n // list of chains for this transform doesn't match that for other transforms\r\n // this is illegal in our structure\r\n logger.debug('MMTF: Chain lists differ for different transforms in one assembly. Skipping...');\r\n continue;\r\n }\r\n\r\n const m = new THREE.Matrix4().fromArray(transform.matrix).transpose();\r\n\r\n // check if matrix is already in the list\r\n for (k = 0; k < a.matrices.length; ++k) {\r\n if (a.matrices[k].equals(m)) {\r\n break;\r\n }\r\n }\r\n\r\n if (k === a.matrices.length) {\r\n a.addMatrix(m);\r\n }\r\n }\r\n\r\n a.finalize();\r\n assemblies.push(a);\r\n }\r\n\r\n return assemblies;\r\n }\r\n\r\n // NOTE: This function relies on original chain indices, so it must be called before any magic happens to chains.\r\n _markHeteroAtoms(mmtfData) {\r\n const chainsInModel0 = mmtfData.chainsPerModel[0];\r\n for (let i = 0; i < mmtfData.entityList.length; ++i) {\r\n const entity = mmtfData.entityList[i];\r\n if (entity.type !== 'polymer') {\r\n for (let j = 0; j < entity.chainIndexList.length; ++j) {\r\n const chainIndex = entity.chainIndexList[j];\r\n // skip chains in models other than the first one\r\n if (chainIndex >= chainsInModel0) {\r\n continue;\r\n }\r\n const chain = this._complex._chains[chainIndex];\r\n for (let k = 0; k < chain._residues.length; ++k) {\r\n const res = chain._residues[k];\r\n for (let m = 0; m < res._atoms.length; ++m) {\r\n res._atoms[m].het = true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // joins chains with the same name into single chain\r\n _joinSynonymousChains() {\r\n let i;\r\n let j;\r\n\r\n const primaryChainsArray = [];\r\n const primaryChainsHash = {};\r\n\r\n // join chains\r\n for (i = 0; i < this._complex._chains.length; ++i) {\r\n const chain = this._complex._chains[i];\r\n const name = chain.getName();\r\n if (!primaryChainsHash.hasOwnProperty(name)) {\r\n // new name -- this is a primary chain\r\n primaryChainsHash[name] = chain;\r\n chain._index = primaryChainsArray.length; // update index as this array will later replace original chain list\r\n primaryChainsArray.push(chain);\r\n continue;\r\n }\r\n\r\n // this chain should be joined with the primary chain of the same name\r\n const primary = primaryChainsHash[name];\r\n for (j = 0; j < chain._residues.length; ++j) {\r\n const residue = chain._residues[j];\r\n primary._residues.push(residue);\r\n residue._chain = primary;\r\n }\r\n }\r\n\r\n // replace chains list with one containing only primary chains\r\n // dropping references to all chains but primary\r\n this._complex._chains = primaryChainsArray;\r\n }\r\n\r\n parseSync() {\r\n const mmtfData = MMTF.decode(this._data);\r\n\r\n this._complex = new Complex();\r\n this._serialAtomMap = {}; // filled during traversal\r\n\r\n this._traverse(mmtfData);\r\n this._linkAtomsToResidues();\r\n this._markHeteroAtoms(mmtfData);\r\n this._chainsByName = this._findSynonymousChains();\r\n Array.prototype.push.apply(this._complex.units, this._parseAssemblyInfo(mmtfData));\r\n this._joinSynonymousChains();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n return this._complex;\r\n }\r\n}\r\n\r\nMMTFParser.formats = ['mmtf'];\r\nMMTFParser.extensions = ['.mmtf'];\r\nMMTFParser.binary = true;\r\n\r\nexport default MMTFParser;\r\n","class ParsingError extends Error {\r\n constructor(message, line, column) {\r\n super(`data:${line}:${column}: ${message}`);\r\n\r\n if (Error.captureStackTrace) {\r\n Error.captureStackTrace(this, ParsingError);\r\n }\r\n\r\n this.name = 'ParsingError';\r\n this.parseLine = line;\r\n this.parseColumn = column;\r\n }\r\n}\r\n\r\nexport default ParsingError;\r\n","import _ from 'lodash';\r\nimport ParsingError from './ParsingError';\r\n\r\n// Implemented and being tested against: https://www.iucr.org/resources/cif/spec/version1.1/cifsyntax\r\n\r\nfunction _isWhitespace(ch) {\r\n return ch === 32 || ch === 10 || ch === 13 || ch === 9;\r\n}\r\n\r\nfunction _inlineIndexOf(ch0, str, idx) {\r\n const len = str.length;\r\n let ch = -1;\r\n while (idx < len) {\r\n ch = str.charCodeAt(idx);\r\n if (ch === ch0 || ch === 10) {\r\n break;\r\n }\r\n ++idx;\r\n }\r\n return ch === ch0 ? idx : -1;\r\n}\r\n\r\nexport default function readCIF(source) {\r\n let i = 0;\r\n let j = 0;\r\n const n = source.length;\r\n let code = NaN;\r\n let newline = true;\r\n let line = 1;\r\n let column = 1;\r\n let begin;\r\n let state = 0; // 0 - start, 1 - block, 2 - item, 3 - loop, 4 - values, 5 - value\r\n const result = {};\r\n let block = {};\r\n let keys = [];\r\n let keysCount = 0;\r\n let key = '';\r\n let values = [];\r\n let valuesCount = 0;\r\n let value;\r\n\r\n function _parseValue() {\r\n let val;\r\n if ((code === 46 || code === 63) && (i + 1 >= n || _isWhitespace(source.charCodeAt(i + 1)))) { // '.' or '?' .....\r\n // it's a missing value\r\n ++column;\r\n ++i;\r\n return undefined;\r\n }\r\n if (newline && code === 59) { // ';' ......................................................................\r\n // parse multi-line string\r\n j = i;\r\n let lines = 0;\r\n do {\r\n j = _inlineIndexOf(10, source, j + 1); // '\\n'\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated text block found', line, column);\r\n }\r\n ++lines;\r\n } while ((j + 1 < n && source.charCodeAt(j + 1) !== code) || j + 1 >= n);\r\n val = source.substring(i + 1, j).replace(/\\r/g, '');\r\n i = j + 2;\r\n line += lines;\r\n column = 1;\r\n newline = false;\r\n return val;\r\n }\r\n if (code === 39 || code === 34) { // ''' or '\"' ...........................................................\r\n // parse quoted string\r\n j = i;\r\n do {\r\n j = _inlineIndexOf(code, source, j + 1);\r\n if (j === -1) {\r\n throw new ParsingError('Unterminated quoted string found', line, column);\r\n }\r\n } while (j + 1 < n && !_isWhitespace(source.charCodeAt(j + 1)));\r\n val = source.substring(i + 1, j);\r\n column += j - i + 1;\r\n i = j + 1;\r\n return val;\r\n } // ......................................................................................................\r\n // parse until the first whitespace\r\n j = i;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n val = source.substring(i, j);\r\n column += j - i;\r\n i = j;\r\n // try to convert to a number\r\n const num = Number(val);\r\n if (!Number.isNaN(num)) {\r\n return num;\r\n }\r\n // or leave as an unquoted string\r\n return val;\r\n }\r\n\r\n function _storeKey(tag) {\r\n keys[keysCount++] = tag;\r\n }\r\n\r\n function _storeValue(val) {\r\n const keyIndex = valuesCount % keysCount;\r\n values[keyIndex].push(val);\r\n ++valuesCount;\r\n return val;\r\n }\r\n\r\n while (i <= n) {\r\n code = source.charCodeAt(i); // 'NaN' in place of ''\r\n if (code === 13) { // '\\r' .......................................................................................\r\n // just ignore\r\n } else if (code === 10) { // '\\n' ................................................................................\r\n // take note of new lines\r\n newline = true;\r\n ++line;\r\n column = 1;\r\n } else {\r\n // process inline characters\r\n if (code === 32 || code === 9) { // ' ' or '\\t' ................................................................\r\n // just ignore\r\n } else if (code === 35) { // '#' ...............................................................................\r\n // skip the comment until before the end of the line\r\n i = _inlineIndexOf(10, source, i + 1); // '\\n'\r\n if (i === -1) {\r\n break;\r\n } else {\r\n continue; // don't forget to process the new line\r\n }\r\n } else if (state === 0) { // start =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n j = i + 5;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new data block\r\n result[source.substring(begin, i)] = block = {};\r\n state = 1; // block\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Data block name missing', line, column);\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 1) { // block =============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n continue; // parse again in a different state\r\n } else if (code === 95) { // '_' .............................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // start new item\r\n key = source.substring(begin, i);\r\n state = 2; // item\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n i += 5;\r\n column += 5;\r\n if (i < n && !_isWhitespace(source.charCodeAt(i))) {\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n } else {\r\n // start new loop\r\n keys = [];\r\n keysCount = 0;\r\n values = [];\r\n valuesCount = 0;\r\n state = 3; // loop\r\n continue; // don't forget to process the whitespace\r\n }\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n break;\r\n } else { // ..................................................................................................\r\n throw new ParsingError(`Unexpected character in state ${state}`, line, column);\r\n }\r\n } else if (state === 2) { // item ==============================================================================\r\n if (Number.isNaN(code)) {\r\n break;\r\n }\r\n value = _parseValue();\r\n _.set(block, key, value);\r\n state = 1; // block\r\n continue;\r\n } else if (state === 3) { // loop ==============================================================================\r\n if (code === 95) { // '_' ....................................................................................\r\n j = i + 1;\r\n begin = j;\r\n while (j < n && !_isWhitespace(source.charCodeAt(j))) {\r\n ++j;\r\n }\r\n column += j - i;\r\n i = j;\r\n if (begin < i) {\r\n // add new key\r\n _storeKey(source.substring(begin, i));\r\n continue; // don't forget to process the whitespace\r\n } else {\r\n throw new ParsingError('Tag name missing', line, column);\r\n }\r\n } else { // ..................................................................................................\r\n if (keysCount > 0) {\r\n for (let keyIndex = 0; keyIndex < keysCount; ++keyIndex) {\r\n value = [];\r\n values[keyIndex] = value;\r\n _.set(block, keys[keyIndex], value);\r\n }\r\n state = 4;\r\n continue; // parse again in a different state\r\n }\r\n throw new ParsingError('Data tags are missing inside a loop', line, column);\r\n }\r\n } else if (state === 4) { // values ============================================================================\r\n if ((code === 68 || code === 100) && source.substr(i + 1, 4).toLowerCase() === 'ata_') { // 'data_' ..........\r\n state = 0; // start\r\n } else if (code === 95) { // '_' .............................................................................\r\n state = 1; // block\r\n } else if ((code === 76 || code === 108) && source.substr(i + 1, 4).toLowerCase() === 'oop_') { // 'loop_' ...\r\n state = 1; // block\r\n } else if (Number.isNaN(code)) { // ....................................................................\r\n state = 0;\r\n } else { // ..................................................................................................\r\n _storeValue(_parseValue());\r\n }\r\n continue; // parse again in a different state\r\n } else { // ====================================================================================================\r\n throw new ParsingError(`Unexpected internal state ${state}`, line, column);\r\n }\r\n\r\n newline = false;\r\n ++column;\r\n }\r\n ++i;\r\n }\r\n\r\n if (state === 2) { // item\r\n throw new ParsingError(`Unexpected end of file in state ${state}`, line, column);\r\n }\r\n\r\n return result;\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport StructuralElement from '../../chem/StructuralElement';\r\nimport readCIF from './readCIF';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Helix,\r\n Sheet,\r\n Strand,\r\n Assembly,\r\n Molecule,\r\n} = chem;\r\n\r\nconst cRequiredAtomFields = [\r\n 'auth_seq_id',\r\n 'Cartn_x',\r\n 'Cartn_y',\r\n 'Cartn_z',\r\n 'label_atom_id',\r\n];\r\n\r\nconst cSecondaryCoding = {\r\n helx: 'helix',\r\n turn: 'turn',\r\n strn: 'strand',\r\n};\r\n\r\nfunction getTypeFromId(string) {\r\n const typeId = /[A-Za-z]+/.exec(string);\r\n if (!typeId) {\r\n return null;\r\n }\r\n\r\n return cSecondaryCoding[typeId[0].toLowerCase()];\r\n}\r\n\r\n/**\r\n * Make valid object an array\r\n * @param arrayLikeObject\r\n * @return {array, object} array or object\r\n */\r\nfunction arrize(arrayLikeObject) {\r\n if (arrayLikeObject === null || arrayLikeObject === undefined || _.isArray(arrayLikeObject)) {\r\n return arrayLikeObject;\r\n }\r\n return [arrayLikeObject];\r\n}\r\n\r\nfunction nameToElement(name) {\r\n // http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM\r\n //\r\n // http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#note1\r\n //\r\n // Atom names start with element symbols right-justified in columns 13-14\r\n // as permitted by the length of the name. For example, the symbol FE for\r\n // iron appears in columns 13-14, whereas the symbol C for carbon appears\r\n // in column 14 (see Misaligned Atom Names). If an atom name has four\r\n // characters, however, it must start in column 13 even if the element\r\n // symbol is a single character (for example, see Hydrogen Atoms).\r\n\r\n const veryLong = name.trim().length === 4;\r\n return name.slice(0, veryLong ? 1 : 2).trim();\r\n}\r\n\r\nclass AtomDataError extends Error {\r\n constructor(message) {\r\n super();\r\n this.name = 'AtomDataError';\r\n this.message = message;\r\n }\r\n}\r\n\r\nfunction _getOperations(operList) {\r\n if (!operList) {\r\n return null;\r\n }\r\n const idc = arrize(operList.id);\r\n const { matrix, vector } = operList;\r\n if (!idc || !matrix || !vector) {\r\n return null;\r\n }\r\n\r\n const ops = [];\r\n for (let i = 0, n = idc.length; i < n; ++i) {\r\n const mtx = new THREE.Matrix4();\r\n const { elements } = mtx;\r\n\r\n for (let row = 0; row < 3; ++row) {\r\n const matrixData = matrix[row + 1];\r\n elements[row] = arrize(matrixData[1])[i];\r\n elements[row + 4] = arrize(matrixData[2])[i];\r\n elements[row + 8] = arrize(matrixData[3])[i];\r\n elements[row + 12] = arrize(vector[row + 1])[i];\r\n }\r\n ops[idc[i]] = mtx;\r\n }\r\n return ops;\r\n}\r\n\r\nfunction _extractOperations(assemblyGen, opsDict) {\r\n assemblyGen = _.isString(assemblyGen) ? assemblyGen : `${assemblyGen}`;\r\n const l = assemblyGen.replace(/\\)\\s*\\(/g, '!').replace(/[()']/g, '');\r\n const groupStr = l.split('!');\r\n const gps = [];\r\n\r\n for (let grIdx = 0, grCount = groupStr.length; grIdx < grCount; ++grIdx) {\r\n const gr = groupStr[grIdx].split(',');\r\n const gp = [];\r\n let idx = 0;\r\n for (let i = 0, n = gr.length; i < n; ++i) {\r\n const s = gr[i];\r\n if (s.includes('-')) {\r\n const es = s.split('-');\r\n let j = parseInt(es[0], 10);\r\n const m = parseInt(es[1], 10);\r\n for (; j <= m; ++j) {\r\n gp[idx++] = opsDict[j];\r\n }\r\n } else {\r\n gp[idx++] = opsDict[s];\r\n }\r\n }\r\n gps.push(gp);\r\n }\r\n\r\n // traverse all groups from the end of array and make all mults\r\n const matrices = [];\r\n let cnt = 0;\r\n function traverse(level, mtx) {\r\n for (let ii = 0, nn = gps[level].length; ii < nn; ++ii) {\r\n const newMtx = mtx ? mtx.clone() : new THREE.Matrix4();\r\n newMtx.multiplyMatrices(gps[level][ii], newMtx);\r\n if (level === 0) {\r\n matrices[cnt++] = newMtx;\r\n } else {\r\n traverse(level - 1, newMtx);\r\n }\r\n }\r\n }\r\n traverse(gps.length - 1);\r\n return matrices;\r\n}\r\n\r\nclass CIFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this.asymDict = {};\r\n this.molecules = [];\r\n this._options.fileType = 'cif';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*data_/i.test(data);\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing CIF file..');\r\n const data = readCIF(this._data);\r\n return this._toComplex(data);\r\n }\r\n\r\n /**\r\n * Convert intermediate structure into our valid Complex object\r\n * @param cifData intermediate CIF object\r\n * @returns {Complex} complex\r\n * @private\r\n */\r\n _toComplex(cifData) {\r\n const complex = new Complex();\r\n const complexData = cifData[Object.keys(cifData)[0]];\r\n this._extractAtoms(complex, complexData);\r\n this._extractSecondary(complex, complexData);\r\n this._extractAssemblies(complex, complexData);\r\n this._extractMolecules(complex, complexData);\r\n this._extractMetadata(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n\r\n return complex;\r\n }\r\n\r\n /**\r\n * Extract metadata\r\n * @param complex structure to fill\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n\r\n _extractMetadata(complex, complexData) {\r\n const { metadata } = complex;\r\n metadata.id = complexData.entry.id;\r\n metadata.classification = complexData.struct_keywords.pdbx_keywords;\r\n const databaserev = complexData.database_PDB_rev;\r\n metadata.date = (databaserev && databaserev.date_original) ? databaserev.date_original : '';\r\n metadata.format = 'cif';\r\n metadata.title = [];\r\n metadata.title[0] = complexData.struct.title;\r\n }\r\n\r\n /**\r\n * Extract molecules information from CIF structure (should be called strictly after _extractAtoms)\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractMolecules(complex, complexData) {\r\n const molData = complexData.entity;\r\n const names = arrize(molData.pdbx_description);\r\n const count = names.length;\r\n let i;\r\n\r\n // molecules names from cif\r\n for (i = 0; i < count; i++) {\r\n if (this.molecules[i]) { // molecule was created during atoms processing\r\n this.molecules[i].name = names[i];\r\n } else { // molecule wasn't created, because there is no atom which is contained\r\n this.molecules[i] = { name: names[i], residues: [] };\r\n }\r\n }\r\n\r\n // reorganize molecules for complex and check chains\r\n const molecules = complex.getMolecules();\r\n for (i = 0; i < count; i++) {\r\n const molecule = this.molecules[i];\r\n molecules[i] = new Molecule(complex, molecule.name, i + 1);\r\n molecules[i].residues = molecule.residues;\r\n }\r\n }\r\n\r\n /**\r\n * Extract atom information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAtoms(complex, complexData) {\r\n const atomData = complexData.atom_site;\r\n if (!atomData) {\r\n throw new AtomDataError('CIF parsing error: atom_site is not specified!');\r\n }\r\n\r\n for (let f = 0, n = cRequiredAtomFields.length; f < n; ++f) {\r\n if (!atomData[cRequiredAtomFields[f]]) {\r\n throw new AtomDataError(`CIF parsing error: requires field ${cRequiredAtomFields[f]} not found!`);\r\n }\r\n }\r\n\r\n const { asymDict } = this;\r\n // required fields\r\n const resIdc = arrize(atomData.auth_seq_id);\r\n const x = arrize(atomData.Cartn_x);\r\n const y = arrize(atomData.Cartn_y);\r\n const z = arrize(atomData.Cartn_z);\r\n const names = arrize(atomData.label_atom_id);\r\n const count = names.length;\r\n // optional fields\r\n const group = arrize(atomData.group_PDB) || [];\r\n const chainIdc = arrize(atomData.auth_asym_id) || [];\r\n const chainLabelIdc = arrize(atomData.label_asym_id) || [];\r\n const serials = arrize(atomData.id) || [];\r\n const iCodes = arrize(atomData.pdbx_PDB_ins_code) || [];\r\n const resNames = arrize(atomData.label_comp_id) || [];\r\n const elements = arrize(atomData.type_symbol) || [];\r\n const tempFactors = arrize(atomData.B_iso_or_equiv) || [];\r\n const occupancies = arrize(atomData.occupancy) || [];\r\n const charges = arrize(atomData.pdbx_formal_charge) || [];\r\n const altLocs = arrize(atomData.label_alt_id) || [];\r\n const models = arrize(atomData.pdbx_PDB_model_num) || [];\r\n const molecules = arrize(atomData.label_entity_id) || [];\r\n\r\n let chain = null;\r\n let residue = null;\r\n for (let i = 0; i < count; ++i) {\r\n const model = models[i] || 1;\r\n if (model !== 1) {\r\n continue;\r\n }\r\n const chainID = String(chainIdc[i] || ' ');\r\n\r\n if (!chain || chain.getName() !== chainID) {\r\n chain = complex.getChain(chainID) || complex.addChain(chainID);\r\n }\r\n asymDict[String(chainLabelIdc[i] || ' ')] = chainID;\r\n const resSeq = resIdc[i];\r\n const iCode = String(iCodes[i] || ' ');\r\n const resName = String(resNames[i] || '');\r\n if (!residue || residue.getSequence() !== resSeq || residue.getICode() !== iCode) {\r\n residue = chain.addResidue(resName, resSeq, iCode);\r\n\r\n // store residue in appropriate molecule\r\n const moleculeIdx = molecules[i] - 1;\r\n let entity = this.molecules[moleculeIdx];\r\n if (!entity) { // create new molecule if it hasn't been created\r\n this.molecules[moleculeIdx] = { name: '', residues: [] };\r\n entity = this.molecules[moleculeIdx];\r\n }\r\n entity.residues.push(residue);\r\n }\r\n\r\n const name = names[i];\r\n const element = elements[i] || nameToElement(name);\r\n const type = Element.getByName(element);\r\n const role = Element.Role[name.trim()];\r\n const xyz = new THREE.Vector3(x[i], y[i], z[i]);\r\n const het = group[i] === 'HETATM' || false;\r\n const serial = serials[i] || i;\r\n const tempFactor = tempFactors[i] || 0.0;\r\n const occupancy = occupancies[i] || 0.0;\r\n const altLoc = String(altLocs[i] || '');\r\n const charge = charges[i] || 0;\r\n\r\n residue.addAtom(\r\n name,\r\n type,\r\n xyz,\r\n role,\r\n het,\r\n serial,\r\n altLoc,\r\n occupancy,\r\n tempFactor,\r\n charge,\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Extracts secondary structure information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex - complex to fill\r\n * @param complexData - CIF complex data\r\n * @private\r\n */\r\n _extractSecondary(complex, complexData) {\r\n if (complexData.struct_conf) {\r\n this._extractConfs(complex, complexData.struct_conf);\r\n }\r\n if (complexData.struct_sheet_range) {\r\n this._extractSheets(complex, complexData.struct_sheet_range);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts sheets information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param sheetData\r\n * @private\r\n */\r\n _extractSheets(complex, sheetData) {\r\n const { asymDict } = this;\r\n if (!sheetData.sheet_id || !sheetData.id || !sheetData.beg_label_seq_id || !sheetData.end_label_seq_id\r\n || !sheetData.beg_label_asym_id) {\r\n return;\r\n }\r\n // Strand(sheet, start, end, sense, cur, prev)\r\n const sheets = complex._sheets;\r\n\r\n function getSheet(name) {\r\n const n = sheets.length;\r\n for (let i = 0; i < n; ++i) {\r\n if (sheets[i]._name === name) {\r\n return sheets[i];\r\n }\r\n }\r\n sheets[n] = new Sheet(name, 0);\r\n return sheets[n];\r\n }\r\n\r\n const sheetNames = arrize(sheetData.sheet_id);\r\n const strandNames = arrize(sheetData.id);\r\n const starts = arrize(sheetData.beg_auth_seq_id);\r\n const ends = arrize(sheetData.end_auth_seq_id);\r\n const chains = arrize(sheetData.beg_label_asym_id);\r\n const stICodes = arrize(sheetData.pdbx_beg_PDB_ins_code) || [];\r\n const endICodes = arrize(sheetData.pdbx_end_PDB_ins_code) || [];\r\n\r\n for (let i = 0, n = strandNames.length; i < n; ++i) {\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n const sheet = getSheet(sheetNames[i]);\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n\r\n const strand = new Strand(sheet, start[0], end[0], 0, null, null);\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = strand;\r\n }\r\n sheet.addStrand(strand);\r\n complex.structures.push(strand);\r\n }\r\n }\r\n\r\n /**\r\n * Extracts helix/turn/strand(?) information from CIF intermediate data\r\n * and adds it into complex\r\n * @param {Complex} complex\r\n * @param helicesData\r\n * @private\r\n */\r\n _extractConfs(complex, helicesData) {\r\n const { asymDict } = this;\r\n if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id\r\n || !helicesData.beg_label_asym_id) {\r\n return;\r\n }\r\n\r\n const types = arrize(helicesData.conf_type_id);\r\n const starts = arrize(helicesData.beg_auth_seq_id);\r\n const stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || [];\r\n const ends = arrize(helicesData.end_auth_seq_id);\r\n const endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || [];\r\n const comments = arrize(helicesData.details) || [];\r\n const lengths = arrize(helicesData.pdbx_PDB_helix_length) || [];\r\n const helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || [];\r\n const names = arrize(helicesData.id) || [];\r\n const chains = arrize(helicesData.beg_label_asym_id);\r\n\r\n for (let i = 0, n = types.length; i < n; ++i) {\r\n const type = getTypeFromId(types[i]);\r\n if (!type) {\r\n continue;\r\n }\r\n const name = names[i] || types[i];\r\n const chain = complex.getChain(asymDict[chains[i]]);\r\n\r\n const startIdx = starts[i];\r\n const endIdx = ends[i];\r\n const startICode = stICodes[i] || ' ';\r\n const endICode = endICodes[i] || ' ';\r\n\r\n const start = chain.findResidue(startIdx, startICode);\r\n const end = chain.findResidue(endIdx, endICode);\r\n\r\n // TODO think about last condition\r\n if (!start || !end) {\r\n continue;\r\n }\r\n const comment = comments[i] || '';\r\n const length = lengths[i] || 0;\r\n const helixClass = helixClasses[i] || ' ';\r\n let struct;\r\n if (type === 'helix') {\r\n const idx = complex._helices.length;\r\n struct = new Helix(helixClass, start[0], end[0], idx, name, comment, length);\r\n complex.addHelix(struct);\r\n complex.structures.push(struct);\r\n } else if (type === 'turn') {\r\n struct = new StructuralElement(StructuralElement.Type.TURN, start[0], end[0]);\r\n complex.structures.push(struct);\r\n } else {\r\n struct = null;\r\n }\r\n if (!struct) {\r\n continue;\r\n }\r\n const residues = chain.getResidues();\r\n for (let r = start[1]; r <= end[1]; ++r) {\r\n residues[r]._secondary = struct;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Extract biological assemblies information from CIF structure and fill complex\r\n * @param {Complex} complex\r\n * @param complexData complex data from CIF file\r\n * @private\r\n */\r\n _extractAssemblies(complex, complexData) {\r\n const { asymDict } = this;\r\n const asmGen = complexData.pdbx_struct_assembly_gen;\r\n if (!asmGen) {\r\n return;\r\n }\r\n\r\n const asmIdx = arrize(asmGen.assembly_id);\r\n const asmOper = arrize(asmGen.oper_expression);\r\n const asmList = arrize(asmGen.asym_id_list);\r\n if (!asmIdx || !asmOper || !asmList) {\r\n return;\r\n }\r\n\r\n const operList = _getOperations(complexData.pdbx_struct_oper_list);\r\n if (!operList) {\r\n return;\r\n }\r\n\r\n for (let i = 0, n = asmIdx.length; i < n; ++i) {\r\n const asm = new Assembly(complex);\r\n const assemblyOps = _extractOperations(asmOper[i], operList);\r\n const entries = asmList[i].split(',');\r\n for (let ii = 0, nn = entries.length; ii < nn; ++ii) {\r\n const chain = entries[ii].trim();\r\n if (chain.length > 0) {\r\n asm.addChain(asymDict[chain]);\r\n }\r\n }\r\n asm.matrices = assemblyOps;\r\n complex.units.push(asm);\r\n }\r\n }\r\n}\r\n\r\nCIFParser.formats = ['cif', 'mmcif'];\r\nCIFParser.extensions = ['.cif', '.mmcif'];\r\n\r\nexport default CIFParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Volume from '../../chem/Volume';\r\n\r\nexport const valueType = {\r\n singular: 0,\r\n vector: 1,\r\n array: 2,\r\n buffer: 3,\r\n};\r\n\r\nclass VolumeModel {\r\n _xyz2crs = [];\r\n\r\n _origin = new THREE.Vector3(0, 0, 0);\r\n\r\n constructor() {\r\n this._header = {};\r\n this._boxSize = new THREE.Vector3();\r\n this._boxStart = new THREE.Vector3();\r\n this._header.delta = {};\r\n this._header.extent = [];\r\n this._header.nstart = [];\r\n this._header.grid = [];\r\n this._header.crs2xyz = [];\r\n this._header.cellDims = new THREE.Vector3();\r\n this._header.angles = [];\r\n this._header.origin = new THREE.Vector3(0, 0, 0);\r\n this._header.dmin = 0;\r\n this._header.dmean = 0;\r\n this._header.dmax = 0;\r\n }\r\n\r\n _typedCheck() {\r\n if (_.isTypedArray(this._buff)) {\r\n this._buff = this._buff.buffer;\r\n } else if (!_.isArrayBuffer(this._buff)) {\r\n throw new TypeError('Expected ArrayBuffer or TypedArray');\r\n }\r\n }\r\n\r\n _fillHeader(headerFormat, arrays) {\r\n for (const key in headerFormat) {\r\n if (headerFormat.hasOwnProperty(key)) {\r\n switch (headerFormat[key][0]) {\r\n case valueType.singular:\r\n this._header[key] = arrays[headerFormat[key][1]][headerFormat[key][2]];\r\n break;\r\n\r\n case valueType.array:\r\n this._parseArray(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.vector:\r\n this._parseVector(this._header[key], arrays[headerFormat[key][1]], headerFormat[key][2]);\r\n break;\r\n\r\n case valueType.buffer:\r\n this._header[key] = new Uint8Array(\r\n arrays[headerFormat[key][1]],\r\n [headerFormat[key][2]] * 4,\r\n [headerFormat[key][3]] * 4,\r\n );\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _parseVector(vector, arr, pos) {\r\n [vector.x, vector.y, vector.z] = [arr[pos], arr[pos + 1], arr[pos + 2]];\r\n }\r\n\r\n _parseArray(vector, arr, pos) {\r\n vector[0] = arr[pos];\r\n vector[1] = arr[pos + 1];\r\n vector[2] = arr[pos + 2];\r\n }\r\n\r\n _parseHeader(_buffer) {}\r\n\r\n _setAxisIndices() {}\r\n\r\n _setOrigins() {}\r\n\r\n _getAxis() {\r\n const header = this._header;\r\n\r\n const xScale = header.cellDims.x / header.grid[0];\r\n const yScale = header.cellDims.y / header.grid[1];\r\n const zScale = header.cellDims.z / header.grid[2];\r\n\r\n const [alpha, beta, gamma] = header.angles;\r\n\r\n const z1 = Math.cos(beta);\r\n const z2 = (Math.cos(alpha) - Math.cos(beta)\r\n * Math.cos(gamma)) / Math.sin(gamma);\r\n const z3 = Math.sqrt(1.0 - z1 * z1 - z2 * z2);\r\n\r\n const xaxis = new THREE.Vector3(xScale, 0, 0);\r\n const yaxis = new THREE.Vector3(Math.cos(gamma) * yScale, Math.sin(gamma) * yScale, 0);\r\n const zaxis = new THREE.Vector3(z1 * zScale, z2 * zScale, z3 * zScale);\r\n\r\n return [xaxis, yaxis, zaxis];\r\n }\r\n\r\n _getXYZdim() {\r\n return [this._header.extent[this._xyz2crs[0]],\r\n this._header.extent[this._xyz2crs[1]],\r\n this._header.extent[this._xyz2crs[2]]];\r\n }\r\n\r\n _getVolumeInfo() {\r\n const volInfo = _.pick(this._header, ['dmean', 'dmin', 'dmax', 'sd', 'delta']);\r\n volInfo.obtuseAngle = this._header.angles.map((angle) => Number(angle >= (Math.PI / 2)));\r\n return volInfo;\r\n }\r\n\r\n _setBoxParams(xaxis, yaxis, zaxis) {\r\n // if axes are not orthogonal, the origins might not match with box coordinates - need to make shift\r\n let shiftX = 0;\r\n let shiftY = 0;\r\n const [alpha, beta, gamma] = this._header.angles;\r\n\r\n if (gamma >= Math.PI / 2) {\r\n shiftX += Math.abs(yaxis.x);\r\n }\r\n if (beta >= Math.PI / 2) {\r\n shiftX += Math.abs(zaxis.x);\r\n }\r\n if (alpha >= Math.PI / 2) {\r\n shiftY += Math.abs(zaxis.y);\r\n }\r\n\r\n this._boxStart = new THREE.Vector3(this._origin.x - shiftX, this._origin.y - shiftY, this._origin.z);\r\n this._boxSize = new THREE.Vector3(\r\n Math.abs(xaxis.x) + Math.abs(yaxis.x) + Math.abs(zaxis.x),\r\n Math.abs(yaxis.y) + Math.abs(zaxis.y),\r\n Math.abs(zaxis.z),\r\n );\r\n\r\n const delta = (axe, proj) => (Math.abs(axe[proj]) / this._boxSize[proj]);\r\n this._header.delta.x = delta(yaxis, 'x');\r\n this._header.delta.y = delta(zaxis, 'x');\r\n this._header.delta.z = delta(zaxis, 'y');\r\n }\r\n\r\n _getXYZbox() {\r\n return new THREE.Box3(this._boxStart.clone(), this._boxStart.clone().add(this._boxSize));\r\n }\r\n\r\n _toXYZData() {}\r\n\r\n parse(data) {\r\n this._parseHeader(data);\r\n this._setOrigins();\r\n return new Volume(Float32Array, this._getXYZdim(), this._getXYZbox(), 1, this._toXYZData(), this._getVolumeInfo());\r\n }\r\n}\r\n\r\nexport default VolumeModel;\r\n","import Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\nconst CCP4Header = {\r\n extent: [valueType.array, 'u32', 0],\r\n type: [valueType.singular, 'u32', 3],\r\n nstart: [valueType.array, 'i32', 4],\r\n grid: [valueType.array, 'u32', 7],\r\n cellDims: [valueType.vector, 'f32', 10],\r\n angles: [valueType.array, 'f32', 13],\r\n crs2xyz: [valueType.array, 'i32', 16],\r\n dmin: [valueType.singular, 'f32', 19],\r\n dmax: [valueType.singular, 'f32', 20],\r\n dmean: [valueType.singular, 'f32', 21],\r\n ispg: [valueType.singular, 'u32', 22],\r\n nsymbt: [valueType.singular, 'u32', 23],\r\n lksflg: [valueType.singular, 'u32', 24],\r\n customData: [valueType.buffer, 'buffer', 25, 9],\r\n origin: [valueType.vector, 'f32', 34],\r\n map: [valueType.buffer, 'buffer', 52, 1],\r\n machine: [valueType.singular, 'u32', 53],\r\n sd: [valueType.singular, 'f32', 54],\r\n nlabel: [valueType.singular, 'f32', 55],\r\n label: [valueType.buffer, 'buffer', 56, 200],\r\n};\r\n\r\nclass Ccp4Model extends VolumeModel {\r\n // read header (http://www.ccp4.ac.uk/html/maplib.html)\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n const arrays = {};\r\n arrays.u32 = new Uint32Array(this._buff, 0, 56);\r\n arrays.i32 = new Int32Array(this._buff, 0, 56);\r\n arrays.f32 = new Float32Array(this._buff, 0, 56);\r\n arrays.buffer = this._buff;\r\n const header = this._header;\r\n\r\n this._fillHeader(CCP4Header, arrays);\r\n\r\n // calculate non-orthogonal unit cell coordinates\r\n header.angles.forEach((angle, i, a) => { a[i] *= Math.PI / 180.0; });\r\n }\r\n\r\n _setAxisIndices() {\r\n const header = this._header;\r\n\r\n if (header.cellDims.x === 0.0 && header.cellDims.y === 0.0 && header.cellDims.z === 0.0) {\r\n header.cellDims.set(1.0, 1.0, 1.0);\r\n }\r\n // Apply header conversion\r\n // Mapping between CCP4 column, row, section and VMD x, y, z.\r\n const { crs2xyz } = this._header;\r\n if (crs2xyz[0] === 0 && crs2xyz[1] === 0 && crs2xyz[2] === 0) {\r\n crs2xyz[0] = 1;\r\n crs2xyz[1] = 2;\r\n crs2xyz[2] = 3;\r\n }\r\n\r\n const xyz2crs = this._xyz2crs;\r\n xyz2crs[crs2xyz[0] - 1] = 0; // column\r\n xyz2crs[crs2xyz[1] - 1] = 1; // row\r\n xyz2crs[crs2xyz[2] - 1] = 2; // section\r\n }\r\n\r\n _setOrigins() {\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n const header = this._header;\r\n const xyz2crs = this._xyz2crs;\r\n // Handle both MRC-2000 and older format maps\r\n if (header.origin.x === 0.0 && header.origin.y === 0.0 && header.origin.z === 0.0) {\r\n this._origin.addScaledVector(xaxis, header.nstart[xyz2crs[0]]);\r\n this._origin.addScaledVector(yaxis, header.nstart[xyz2crs[1]]);\r\n this._origin.addScaledVector(zaxis, header.nstart[xyz2crs[2]]);\r\n } else {\r\n this._origin = header.origin;\r\n // Use ORIGIN records rather than old n[xyz]start records\r\n // http://www2.mrc-lmb.cam.ac.uk/image2000.html\r\n // XXX the ORIGIN field is only used by the EM community, and\r\n // has undefined meaning for non-orthogonal maps and/or non-cubic voxels, etc.\r\n }\r\n xaxis.multiplyScalar(header.extent[xyz2crs[0]] - 1);\r\n yaxis.multiplyScalar(header.extent[xyz2crs[1]] - 1);\r\n zaxis.multiplyScalar(header.extent[xyz2crs[2]] - 1);\r\n\r\n if (header.type === 2) {\r\n this._data = new Float32Array(\r\n this._buff,\r\n 1024 + header.nsymbt,\r\n header.extent[0] * header.extent[1] * header.extent[2],\r\n );\r\n } else {\r\n throw new Error(`CCP4: Unsupported format ${header.type}`);\r\n }\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const data = this._data;\r\n const xyz2crs = this._xyz2crs;\r\n const xyzData = new Float32Array(data.length);\r\n\r\n const dim = this._getXYZdim();\r\n const xSize = dim[0];\r\n const ySize = dim[1];\r\n\r\n let crsIdx = 0;\r\n const coord = [];\r\n let x;\r\n let y;\r\n let z;\r\n for (coord[2] = 0; coord[2] < header.extent[2]; coord[2]++) { // Site\r\n for (coord[1] = 0; coord[1] < header.extent[1]; coord[1]++) { // Row\r\n for (coord[0] = 0; coord[0] < header.extent[0]; coord[0]++, crsIdx++) { // Column\r\n x = coord[xyz2crs[0]];\r\n y = coord[xyz2crs[1]];\r\n z = coord[xyz2crs[2]];\r\n xyzData[x + xSize * (y + ySize * z)] = data[crsIdx];\r\n }\r\n }\r\n }\r\n\r\n return xyzData;\r\n }\r\n}\r\n\r\nclass CCP4Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'ccp4';\r\n this.model = new Ccp4Model();\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false; // Autodetection is not implemented yet\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nCCP4Parser.formats = ['ccp4'];\r\nCCP4Parser.extensions = ['.ccp4', '.map', '.mrc'];\r\nCCP4Parser.binary = true;\r\n\r\nexport default CCP4Parser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element, Molecule } = chem;\r\n\r\nclass XYZParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n this._options.fileType = 'xyz';\r\n this._fileName = options.name;\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && /^\\s*\\d+ *\\n[^\\n]*\\n\\s*\\w{1,3}\\s+-?\\d/.test(data);\r\n }\r\n\r\n _parseToAtomsInf(source) {\r\n const endnAtoms = source.indexOf('\\n');\r\n const nAtoms = parseInt(source.substring(0, endnAtoms), 10);\r\n const endComment = source.indexOf('\\n', endnAtoms + 1);\r\n let comment = source.slice(endnAtoms + 1, endComment).trim();\r\n if (comment.length === 0) {\r\n comment = this._fileName;\r\n }\r\n\r\n const startAtomsInf = endComment + source.substring(endComment).search(/\\S/);\r\n this._atomsInf = source.substring(startAtomsInf).split(/[\\s,]*\\n[\\s,]*/);\r\n if (!Number.isNaN(nAtoms) && (this._atomsInf.length - 1 !== nAtoms)) {\r\n this._complex.error = {\r\n message: 'wrong number of atoms',\r\n };\r\n return;\r\n }\r\n\r\n this._complex.metadata.format = 'xyz';\r\n this._complex.name = comment;\r\n }\r\n\r\n _parseAtomsInf() {\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n\r\n const chain = this._complex.addChain('A');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0; i < this._atomsInf.length - 1; i++) {\r\n const words = this._atomsInf[i].split(/[\\s,]+/);\r\n\r\n if (words.length !== 4) {\r\n this._complex.error = {\r\n message: 'missed parameters',\r\n };\r\n break;\r\n }\r\n\r\n const serial = i + 1;\r\n const name = words[0];\r\n const xyz = new THREE.Vector3(parseFloat(words[1]), parseFloat(words[2]), parseFloat(words[3]));\r\n const type = Element.getByName(name);\r\n const role = undefined;\r\n\r\n residue.addAtom(name, type, xyz, role, het, serial, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n const molecule = new Molecule(this._complex, this._complex.name, 1);\r\n molecule.residues = residue;\r\n this._complex._molecules[0] = molecule;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n\r\n this._parseToAtomsInf(this._data);\r\n this._parseAtomsInf();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n\r\n this._complex = null;\r\n this._atomsInf = null;\r\n\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n return result;\r\n }\r\n\r\n static formats = ['xyz'];\r\n\r\n static extensions = ['.xyz'];\r\n}\r\n\r\nexport default XYZParser;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst { Complex, Element } = chem;\r\n\r\nclass PubChemParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'pubchem+json';\r\n }\r\n\r\n static canProbablyParse(data) {\r\n return _.isString(data) && data[0] === '{';\r\n }\r\n\r\n parseSync() {\r\n this.logger.info('Parsing PubChem JSON file...');\r\n return this._toComplex(JSON.parse(this._data));\r\n }\r\n\r\n _toComplex(jsonData) {\r\n const complex = new Complex();\r\n const complexData = jsonData.PC_Compounds && jsonData.PC_Compounds[0];\r\n if (complexData) {\r\n this._extractAtoms(complex, complexData);\r\n complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n });\r\n }\r\n return complex;\r\n }\r\n\r\n _extractAtoms(complex, complexData) {\r\n let aids = complexData.atoms && complexData.atoms.aid;\r\n let elements = aids && complexData.atoms.element;\r\n if (!elements || aids.length !== elements.length) {\r\n throw new Error('Unable to parse atom elements');\r\n }\r\n elements = _.fromPairs(_.zip(aids, elements));\r\n const atoms = {};\r\n\r\n const coords = complexData.coords && complexData.coords[0];\r\n const model = coords && coords.conformers && coords.conformers[0];\r\n const xs = model && model.x;\r\n const ys = model && model.y;\r\n const zs = (model && model.z) || [];\r\n aids = coords && coords.aid;\r\n if (!aids || !xs || !ys) {\r\n throw new Error('Coordinates are not found in the file');\r\n }\r\n\r\n const chain = complex.addChain(' ');\r\n const residue = chain.addResidue('UNK', 1, ' ');\r\n\r\n for (let i = 0, n = aids.length; i < n; ++i) {\r\n const aid = aids[i];\r\n const element = Element.ByAtomicNumber[elements[aid]];\r\n const xyz = new THREE.Vector3(xs[i], ys[i], zs[i] || 0.0);\r\n atoms[aid] = residue.addAtom(element.name, element, xyz, undefined, true, aid, ' ', 1.0, 0.0, 0);\r\n }\r\n\r\n const aids1 = complexData.bonds && complexData.bonds.aid1;\r\n const aids2 = complexData.bonds && complexData.bonds.aid2;\r\n const orders = (complexData.bonds && complexData.bonds.order) || [];\r\n if (!aids1 || !aids2 || aids1.length !== aids2.length) {\r\n return;\r\n }\r\n\r\n for (let j = 0, m = aids1.length; j < m; ++j) {\r\n complex.addBond(atoms[aids1[j]], atoms[aids2[j]], orders[j] || 1, 0, true);\r\n }\r\n }\r\n}\r\n\r\nPubChemParser.formats = ['pubchem', 'pubchem+json', 'pc'];\r\nPubChemParser.extensions = ['.json'];\r\n\r\nexport default PubChemParser;\r\n","import _ from 'lodash';\r\n\r\nexport default class SDFStream {\r\n constructor(data) {\r\n this._strings = data.split(/\\r?\\n|\\r/);\r\n this._currentStart = 0;\r\n this._currentStringIndx = 0;\r\n }\r\n\r\n setStart(start) {\r\n if (start >= this._strings.length) {\r\n this._currentStart = this._strings.length - 1;\r\n this._currentStringIndx = this._strings.length - 1;\r\n } else {\r\n this._currentStart = start;\r\n this._currentStringIndx = start;\r\n }\r\n }\r\n\r\n getNextString() {\r\n return this._strings[++this._currentStringIndx];\r\n }\r\n\r\n getCurrentString() {\r\n return this._strings[this._currentStringIndx];\r\n }\r\n\r\n getStringFromStart(numb) {\r\n this._currentStringIndx = this._currentStart + numb;\r\n return this._strings[this._currentStart + numb];\r\n }\r\n\r\n findNextDataItem() {\r\n let curStr = this.getNextString();\r\n let res = false;\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n if (curStr.match(/>\\s+<(.*)>/)) {\r\n res = true;\r\n break;\r\n }\r\n curStr = this.getNextString();\r\n }\r\n\r\n return res;\r\n }\r\n\r\n findNextCompoundStart() {\r\n let curStr = this.getCurrentString();\r\n while (!_.isUndefined(curStr) && curStr.trim() !== '$$$$') {\r\n curStr = this.getNextString();\r\n }\r\n this.setStart(++this._currentStringIndx);\r\n return this.probablyHaveDataToParse();\r\n }\r\n\r\n probablyHaveDataToParse() {\r\n return this._currentStringIndx < this._strings.length - 2;\r\n }\r\n}\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport SDFStream from './SDFStream';\r\nimport Assembly from '../../chem/Assembly';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst chargeMap = [0, 3, 2, 1, 0, -1, -2, -3];\r\nconst orderMap = [0, 1, 2, 3, 1, 1, 1, 2];\r\nconst typeMap = [\r\n Bond.BondType.UNKNOWN, // 0 - error\r\n Bond.BondType.COVALENT, // 1 - single\r\n Bond.BondType.COVALENT, // 2 - double\r\n Bond.BondType.COVALENT, // 3 - triple\r\n Bond.BondType.AROMATIC, // 4 - aromatic\r\n Bond.BondType.UNKNOWN, // 5 - single or double\r\n Bond.BondType.AROMATIC, // 6 - single or aromatic\r\n Bond.BondType.AROMATIC, // 7 - double or aromatic\r\n // 8 - any\r\n // 9 - coordination\r\n // 10 - hydrogen\r\n];\r\n\r\nconst sdfAndMolRegexp = /.*(M\\s\\sEND).*|.*(^$$$$).*|.*>\\s+<(.+)>.*/;\r\nconst sdfRegExp = /.*($$$$).*|.*>\\s+<(.+)>.*/;\r\n\r\nconst fileFormat = { SDF: 'sdf', MOL: 'mol' };\r\n\r\nconst possibleNameTags = ['PUBCHEM_IUPAC_TRADITIONAL_NAME', /PUBCHEM_(.+)_NAME/, /(.+)name/, /(.+)NAME/];\r\nconst possibleIDTags = ['PUBCHEM_COMPOUND_CID', 'id', 'ID', /.*CID/, /.*ID/, /.*id/];\r\nconst possibleTitleTags = ['msg', 'MSG', 'message', 'title', 'description', 'desc'];\r\nconst tagsNames = ['name', 'id', 'title'];\r\nconst tags = { name: possibleNameTags, id: possibleIDTags, title: possibleTitleTags };\r\n\r\nfunction buildChainID(index) {\r\n if (!index) {\r\n return 'A';\r\n }\r\n\r\n const codes = [];\r\n while (index) {\r\n codes.push(65 + (index % 26));\r\n index = Math.trunc(index / 26);\r\n }\r\n if (codes.length > 1) {\r\n codes.reverse();\r\n codes[0] -= 1;\r\n }\r\n\r\n return String.fromCharCode(...codes);\r\n}\r\n\r\nexport default class SDFParser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._format = 'sdf';\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._molecules = null;\r\n this._metadata = {};\r\n this._metadata.molecules = [];\r\n this._currentMolProps = {};\r\n this._compoundIndx = -1;\r\n this._assemblies = [];\r\n this._atomsParsed = 0;\r\n this._atomsIndexes = [];\r\n }\r\n\r\n canProbablyParse(data) {\r\n return _.isString(data) && sdfAndMolRegexp.test(data);\r\n }\r\n\r\n _parseHeader(stream) {\r\n const molecule = {};\r\n molecule.name = stream.getStringFromStart(0);\r\n const date = parseInt(stream.getStringFromStart(1).substr(10, 6).trim(), 10);\r\n molecule.date = date.toString() || '';\r\n molecule.title = stream.getStringFromStart(2);\r\n this._metadata.molecules.push(molecule);\r\n }\r\n\r\n _parseAtoms(stream, atomsNum) {\r\n let curStr;\r\n let serial = this._atomsParsed;\r\n\r\n // each molecule = chain\\residue\r\n const chainID = buildChainID(this._compoundIndx);\r\n const resName = 'UNK';\r\n const resSeq = 1;\r\n\r\n this._chain = this._complex.getChain(chainID) || this._complex.addChain(chainID);\r\n this._residue = this._chain.addResidue(resName, resSeq, ' ');\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n curStr = stream.getNextString();\r\n serial++;\r\n const x = parseFloat(curStr.substr(0, 10));\r\n const y = parseFloat(curStr.substr(10, 10));\r\n const z = parseFloat(curStr.substr(20, 10));\r\n const charge = chargeMap[parseInt(curStr.substr(36, 3), 10)];\r\n const xyz = new THREE.Vector3(x, y, z);\r\n let name = curStr.substr(31, 3).trim().toUpperCase();\r\n const type = Element.getByName(name);\r\n if (!this._atomsIndexes[name]) {\r\n this._atomsIndexes[name] = 0;\r\n }\r\n this._atomsIndexes[name] += 1;\r\n name += this._atomsIndexes[name]; // every atom need to have unique name.\r\n\r\n this._residue.addAtom(name, type, xyz, undefined, true, serial, ' ', 1.0, 0.0, charge);\r\n }\r\n }\r\n\r\n _parseBonds(stream, bondsNum) {\r\n let curStr;\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n curStr = stream.getNextString();\r\n let atom1 = parseInt(curStr.substr(0, 3), 10) + this._atomsParsed;\r\n let atom2 = parseInt(curStr.substr(3, 3), 10) + this._atomsParsed;\r\n const bondType = parseInt(curStr.substr(6, 3), 10);\r\n\r\n if (atom1 > atom2) {\r\n [atom1, atom2] = [atom2, atom1];\r\n }\r\n this._complex.addBond(\r\n atom1,\r\n atom2,\r\n orderMap[bondType] || 1,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true,\r\n );\r\n }\r\n }\r\n\r\n _parseMOL(stream) {\r\n this._compoundIndx++;\r\n\r\n this._parseHeader(stream);\r\n const countsLine = stream.getStringFromStart(3);\r\n const atomsNum = parseInt(countsLine.substr(0, 3), 10);\r\n const bondsNum = parseInt(countsLine.substr(3, 3), 10);\r\n this._parseAtoms(stream, atomsNum);\r\n this._parseBonds(stream, bondsNum);\r\n\r\n this._atomsParsed += atomsNum;\r\n\r\n this._metadata.molecules[this._compoundIndx]._residues = [];\r\n this._metadata.molecules[this._compoundIndx]._residues.push(this._residue);\r\n }\r\n\r\n _parseDataItem(stream) {\r\n const tag = stream.getCurrentString();\r\n\r\n let data = [];\r\n let curStr = stream.getNextString();\r\n\r\n // read data\r\n while (curStr.trim() !== '') {\r\n data.push(curStr);\r\n curStr = stream.getNextString();\r\n }\r\n if (data.length === 1) {\r\n [data] = data;\r\n }\r\n this._currentMolProps[tag.replace(/[<>]/g, '').trim()] = data;\r\n }\r\n\r\n _parseCompound(stream) {\r\n this._parseMOL(stream);\r\n\r\n // parse data items block\r\n if (this._format === fileFormat.SDF) {\r\n this._currentMolProps = {};\r\n while (stream.findNextDataItem()) {\r\n this._parseDataItem(stream);\r\n }\r\n if (Object.keys(this._currentMolProps).length !== 0) {\r\n const molecule = this._metadata.molecules[this._compoundIndx];\r\n molecule.props = this._currentMolProps;\r\n this._tryToUpdateMoleculeData(molecule);\r\n }\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n if (bond._right < bond._left) {\r\n console.log('_fixBondsArray: Logic error.');\r\n }\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _buildAssemblies() {\r\n const chains = this._complex._chains;\r\n\r\n if (chains.length === 1) {\r\n return this._assemblies;\r\n }\r\n\r\n for (let i = 0; i < chains.length; i++) {\r\n const assembly = new Assembly(this._complex);\r\n const matrix = new THREE.Matrix4();\r\n assembly.addMatrix(matrix);\r\n assembly.addChain(chains[i]._name);\r\n this._assemblies.push(assembly);\r\n }\r\n\r\n return this._assemblies;\r\n }\r\n\r\n _buildMolecules() {\r\n this._complex._molecules = [];\r\n const { molecules } = this._metadata;\r\n for (let i = 0; i < molecules.length; i++) {\r\n const molecule = new Molecule(this._complex, molecules[i].name, i + 1);\r\n molecule.residues = molecules[i]._residues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n\r\n return this._complex._molecules;\r\n }\r\n\r\n _searchTag(tag, props) {\r\n for (let i = 0; i < props.length; i++) {\r\n if ((tag instanceof RegExp && tag.test(props[i].tag)) || tag === props[i].tag) {\r\n return props[i].data;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToFind(tagsList, props) {\r\n for (let j = 0; j < tagsList.length; j++) {\r\n const res = this._searchTag(tagsList[j], props);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n _tryToUpdateMoleculeData(molecule) {\r\n let res = false;\r\n for (let i = 0; i < tagsNames.length; i++) {\r\n const tagPossibleNames = tags[tagsNames[i]];\r\n const data = this._tryToFind(tagPossibleNames, molecule.props);\r\n if (data) {\r\n molecule[tagsNames[i]] = data;\r\n res = true;\r\n }\r\n }\r\n\r\n molecule.name = molecule.name || molecule.id;\r\n if (molecule.name.match(/^\\d+$/)) {\r\n molecule.name = `CID: ${molecule.name}`;\r\n }\r\n\r\n return res;\r\n }\r\n\r\n _finalizeMetadata() {\r\n const { molecules } = this._metadata;\r\n const { metadata } = this._complex;\r\n const complex = this._complex;\r\n\r\n if (molecules.length === 1) {\r\n complex.name = molecules[0].name;\r\n metadata.title = molecules[0].title;\r\n metadata.date = molecules[0].date;\r\n metadata.properties = molecules[0].props;\r\n } else if (molecules.length > 1) {\r\n metadata.molecules = [];\r\n for (let i = 0; i < molecules.length; i++) {\r\n metadata.molecules.push({\r\n name: molecules[i].name, date: molecules[i].date, title: molecules[i].title, properties: molecules[i].props,\r\n });\r\n }\r\n }\r\n }\r\n\r\n _finalize() {\r\n const serialAtomMap = this._serialAtomMap = {};\r\n const atoms = this._complex._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n serialAtomMap[atom.serial] = atom;\r\n }\r\n\r\n this._complex._finalizeBonds();\r\n this._fixBondsArray();\r\n this._finalizeMetadata();\r\n this._buildAssemblies();\r\n this._complex.units = this._complex.units.concat(this._assemblies);\r\n this._buildMolecules();\r\n this._complex.finalize({\r\n needAutoBonding: false, detectAromaticLoops: false, enableEditing: false, serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n defineFormat(data) {\r\n let format;\r\n if (sdfRegExp.test(data)) {\r\n format = fileFormat.SDF;\r\n } else {\r\n format = fileFormat.MOL;\r\n }\r\n\r\n return format;\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const stream = new SDFStream(this._data);\r\n\r\n this._format = this.defineFormat(this._data);\r\n result.metadata.format = this._format;\r\n\r\n do {\r\n this._parseCompound(stream);\r\n } while (stream.findNextCompoundStart());\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nSDFParser.formats = ['mol', 'sdf'];\r\nSDFParser.extensions = ['.mol', '.sdf'];\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport VolumeModel, { valueType } from './VolumeModel';\r\n\r\n// http://www.uoxray.uoregon.edu/tnt/manual/node104.html\r\nconst DSN6Header = {\r\n nstart: [valueType.array, 'i16', 0],\r\n extent: [valueType.array, 'i16', 3],\r\n grid: [valueType.array, 'i16', 6],\r\n cellDims: [valueType.vector, 'i16', 9],\r\n angles: [valueType.array, 'i16', 12],\r\n div: [valueType.singular, 'i16', 15],\r\n adder: [valueType.singular, 'i16', 16],\r\n scaleFactor: [valueType.singular, 'i16', 17],\r\n};\r\n\r\nclass DSN6Model extends VolumeModel {\r\n _parseHeader(_buffer) {\r\n this._buff = _buffer;\r\n this._typedCheck();\r\n\r\n const arrays = {};\r\n arrays.i16 = new Int16Array(this._buff);\r\n\r\n // check and reverse if big endian\r\n if (arrays.i16[18] !== 100) {\r\n for (let i = 0, n = arrays.i16.length; i < n; ++i) {\r\n const val = arrays.i16[i];\r\n arrays.i16[i] = ((val & 0xff) << 8) | ((val >> 8) & 0xff);\r\n }\r\n }\r\n if (arrays.i16[18] !== 100) {\r\n throw new Error('DSN6: Incorrect format ');\r\n }\r\n\r\n const header = this._header;\r\n\r\n this._fillHeader(DSN6Header, arrays);\r\n header.cellDims.multiplyScalar(1.0 / header.scaleFactor);\r\n header.angles.forEach((angle, i, a) => { a[i] *= (Math.PI / 180.0) / header.scaleFactor; });\r\n header.div /= 100;\r\n }\r\n\r\n _setAxisIndices() {\r\n this._xyz2crs[0] = 0;\r\n this._xyz2crs[1] = 1;\r\n this._xyz2crs[2] = 2;\r\n }\r\n\r\n _setOrigins() {\r\n const header = this._header;\r\n const [xaxis, yaxis, zaxis] = this._getAxis();\r\n this._setAxisIndices();\r\n\r\n this._origin.addScaledVector(xaxis, header.nstart[0]);\r\n this._origin.addScaledVector(yaxis, header.nstart[1]);\r\n this._origin.addScaledVector(zaxis, header.nstart[2]);\r\n\r\n xaxis.multiplyScalar(header.extent[0]);\r\n yaxis.multiplyScalar(header.extent[1]);\r\n zaxis.multiplyScalar(header.extent[2]);\r\n\r\n this._setBoxParams(xaxis, yaxis, zaxis);\r\n }\r\n\r\n _pointCalculate(xyzData, byteBuffer, z, y, x, pos, i) {\r\n const header = this._header;\r\n\r\n if (x < header.extent[0] && y < header.extent[1] && z < header.extent[2]) {\r\n const idx = x + header.extent[0] * (y + header.extent[1] * z);\r\n xyzData[idx] = (byteBuffer[pos.counter] - header.adder) / header.div;\r\n ++pos.counter;\r\n } else {\r\n pos.counter += 8 - i;\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n _blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos) {\r\n for (let k = 0; k < 8; ++k) {\r\n const z = 8 * zBlock + k;\r\n for (let j = 0; j < 8; ++j) {\r\n const y = 8 * yBlock + j;\r\n let inRange = true;\r\n let i = 0;\r\n while (inRange && i < 8) {\r\n const x = 8 * xBlock + i;\r\n inRange = this._pointCalculate(xyzData, byteBuffer, z, y, x, pos, i);\r\n i++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n _toXYZData() {\r\n const header = this._header;\r\n const byteBuffer = new Uint8Array(this._buff);\r\n const xyzData = new Float32Array(header.extent[0] * header.extent[1] * header.extent[2]);\r\n\r\n const blocks = new THREE.Vector3(header.extent[0] / 8, header.extent[1] / 8, header.extent[2] / 8);\r\n\r\n const pos = {};\r\n pos.counter = 512;\r\n\r\n for (let zBlock = 0; zBlock < blocks.z; ++zBlock) {\r\n for (let yBlock = 0; yBlock < blocks.y; ++yBlock) {\r\n for (let xBlock = 0; xBlock < blocks.x; ++xBlock) {\r\n this._blockCalculate(xyzData, byteBuffer, zBlock, yBlock, xBlock, pos);\r\n }\r\n }\r\n }\r\n this._calculateInfoParams(xyzData);\r\n return xyzData;\r\n }\r\n\r\n _calculateInfoParams(xyzData) {\r\n this._header.dmean /= xyzData.length;\r\n let dispersion = 0;\r\n let minDensity = xyzData[0];\r\n let maxDensity = xyzData[0];\r\n for (let j = 0; j < xyzData.length; j++) {\r\n dispersion += (this._header.dmean - xyzData[j]) ** 2;\r\n\r\n if (xyzData[j] < minDensity) {\r\n minDensity = xyzData[j];\r\n }\r\n if (xyzData[j] > maxDensity) {\r\n maxDensity = xyzData[j];\r\n }\r\n }\r\n this._header.sd = Math.sqrt(dispersion / xyzData.length);\r\n this._header.dmax = maxDensity;\r\n this._header.dmin = minDensity;\r\n }\r\n}\r\n\r\nclass DSN6Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n this._options.fileType = 'dsn6';\r\n this.model = new DSN6Model();\r\n }\r\n\r\n static canParse(data, options) {\r\n if (!data) {\r\n return false;\r\n }\r\n return data instanceof ArrayBuffer && Parser.checkDataTypeOptions(options, 'dsn6');\r\n }\r\n\r\n static canProbablyParse(_data) {\r\n return false;\r\n }\r\n\r\n parseSync() {\r\n return this.model.parse(this._data);\r\n }\r\n}\r\n\r\nDSN6Parser.formats = ['dsn6'];\r\nDSN6Parser.extensions = ['.dsn6', '.omap'];\r\nDSN6Parser.binary = true;\r\n\r\nexport default DSN6Parser;\r\n","import PDBStream from './PDBStream';\r\n\r\n/**\r\n * Little helper class for GRO Parser usage.\r\n * @extends PDBStream\r\n */\r\nclass GROReader extends PDBStream {\r\n constructor(data) {\r\n super(data);\r\n /** @type Number */\r\n this._next = -1; // End position of line\r\n this.next();\r\n }\r\n\r\n /**\r\n * Getting end of string.\r\n * @returns {Number} Pointer to end of string\r\n */\r\n getNext() {\r\n return this._next;\r\n }\r\n}\r\n\r\nexport default GROReader;\r\n","import * as THREE from 'three';\r\nimport _ from 'lodash';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\nimport GROReader from './GROReader';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Molecule,\r\n} = chem;\r\n\r\n/**\r\n * Gromos87 file format parser.\r\n * @extends Parser\r\n */\r\nclass GROParser extends Parser {\r\n /**\r\n * Create parser for .gro file format\r\n *\r\n * @param {String} data Input file\r\n * @param {String} options Input options (optional field)\r\n */\r\n constructor(data, options) {\r\n super(data, options);\r\n /** @type Date */\r\n this._time = null; // Time in ps, optional field for animations\r\n /** @type Number */\r\n this._numAtoms = null; // Number of atoms in complex\r\n /** @type Number */\r\n this._residueNumber = null; // Number of exact residue\r\n /** @type String */\r\n this._residueName = ''; // Scientific name of exact residue\r\n /** @type String */\r\n this._atomName = ''; // Scientific name of exact atom\r\n /** @type Number */\r\n this._atomNumber = null; // Sorted number of exact atom\r\n /** @type Array */\r\n this._atomPosition = []; // Array which contains x, y, z position of exact atom\r\n /** @type Array */\r\n this._atomVelocity = []; // Array which contains x, y, z velocity of exact atom (optional)\r\n /** @type Complex */\r\n this._complex = null; // Complex structure for unified molecule representation\r\n /** @type Vector3 */\r\n this._molecules = []; // Molecules array\r\n /** @type Molecule */\r\n this._molecule = null; // Single molecule\r\n /** @type String */\r\n this._options.filetype = 'gro'; // Extension of data file.\r\n }\r\n\r\n /**\r\n * General check for possibility of parsing.\r\n * @param {String} data - Input file\r\n * @returns {boolean} true if this file is in ascii, false otherwise\r\n */\r\n canProbablyParse(data) {\r\n return _.isString(this._data) && /^\\s*[^\\n]*\\n\\s*\\d+ *\\n\\s*\\d+[^\\n\\d]{3}\\s*\\w+\\s*\\d+\\s*-?\\d/.test(data);\r\n }\r\n\r\n /**\r\n * Parsing title of molecule complex.\r\n * NOTE: that names are ESTIMATES, there is no strict rules in Gromos87 standard for first line in input file.\r\n * @param {GROReader} line - Line containing title and time.\r\n */\r\n _parseTitle(line) {\r\n const { metadata } = this._complex;\r\n metadata.id = line.readLine().trim();\r\n metadata.name = metadata.id.slice(metadata.id.lastIndexOf('\\\\') + 1, metadata.id.lastIndexOf('.'));\r\n metadata.format = 'gro';\r\n }\r\n\r\n /**\r\n * Parsing line containing number of atoms information.\r\n * @param {GROReader} line - Line containing number of atoms.\r\n */\r\n _parseNumberOfAtoms(line) {\r\n this._numAtoms = line.readInt(0, line.getNext());\r\n if (Number.isNaN(this._numAtoms)) {\r\n throw new Error('Line 2 is not representing atom number. Consider checking input file');\r\n }\r\n }\r\n\r\n /**\r\n * Parsing line containing information about residues, atoms etc. Also information about box vectors.\r\n * Format of atoms MUST (by Gromos87 standard) be this: (note that numbering starts not from 0, but from 1!)\r\n * ResidueNumber[1 - 5] ResidueName[6 - 10] AtomName[11 - 15] AtomNumber[16 - 20] Position[21 - 45] Velocity[46 - 69]\r\n * @param {GROReader} line - Line containing information about atom.\r\n */\r\n _parseAtom(line) {\r\n this._residueNumber = line.readInt(1, 5);\r\n this._residueName = line.readString(6, 10).trim();\r\n this._atomName = line.readString(11, 15).trim();\r\n this._atomNumber = line.readInt(16, 20);\r\n const positionX = line.readFloat(21, 28) * 10;\r\n const positionY = line.readFloat(29, 36) * 10;\r\n const positionZ = line.readFloat(37, 45) * 10;\r\n if (Number.isNaN(positionX) || Number.isNaN(positionY) || Number.isNaN(positionZ)) {\r\n this._complex.error = {\r\n message: `Atom position is invalid in \"${line.readLine()}\"`,\r\n };\r\n return;\r\n }\r\n /* const velocityX = line.readFloat(46, 53);\r\n const velocityY = line.readFloat(54, 61);\r\n const velocityZ = line.readFloat(62, 69); */\r\n /* Adding residue and atom to complex structure */\r\n const type = Element.getByName(this._atomName[0]); /* MAGIC 0. REASONS: This name is something like \"CA\", where\r\n C - is an element an A is something else. But what about Calcium? */\r\n if (type.fullName === 'Unknown') {\r\n this._complex.error = {\r\n message: `${this._atomName[0]} hasn't been recognised as an atom name.`,\r\n };\r\n return;\r\n }\r\n const role = Element.Role[this._atomName];\r\n /* Firstly, create a dummy chain */\r\n let chain = this._chain;\r\n if (!chain) {\r\n this._chain = chain = this._complex.addChain('A');\r\n }\r\n /* Secondly, add residue to that chain */\r\n let residue = this._residue;\r\n if (!residue || residue.getSequence() !== this._residueNumber) {\r\n this._residue = residue = chain.addResidue(this._residueName, this._residueNumber, ' ');\r\n }\r\n /* Lastly, add atom to that residue */\r\n this._atomPosition = new THREE.Vector3(positionX, positionY, positionZ);\r\n /* Adding default constants to correct atom addition process */\r\n const het = true;\r\n const altLoc = ' ';\r\n const occupancy = 1;\r\n const tempFactor = 1;\r\n const charge = 0;\r\n residue.addAtom(this._atomName, type, this._atomPosition, role, het, this._atomNumber, altLoc, occupancy, tempFactor, charge);\r\n }\r\n\r\n /**\r\n * Some finalizing procedures. In '.gro' file format there is only 1 chain and 1 molecule.\r\n */\r\n _finalize() {\r\n const molecule = new Molecule(this._complex, this._complex.metadata.name, 1);\r\n // aggregate residues from chain\r\n molecule.residues = this._chain._residues;\r\n molecule._chains = this._chain;\r\n this._complex._molecules[0] = molecule;\r\n this._molecules.push(molecule);\r\n this._complex.finalize({\r\n needAutoBonding: true,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n /**\r\n * Main parsing procedure.\r\n * @returns {Complex} Complex structure for visualizing.\r\n */\r\n parseSync() {\r\n /* Create \"Complex\" variable */\r\n const result = this._complex = new Complex();\r\n /* Parse input file line-by-line */\r\n const reader = new GROReader(this._data);\r\n let counter = 0; /* Simple counter regarding to format of .gro file */\r\n /* First two lines - technical information, other lines - Atoms */\r\n this._parseTitle(reader);\r\n reader.next();\r\n this._parseNumberOfAtoms(reader);\r\n reader.next();\r\n for (counter = 0; counter < this._numAtoms; ++counter) {\r\n if (!reader.end()) {\r\n this._parseAtom(reader);\r\n reader.next();\r\n } else break;\r\n }\r\n /* If number of atoms in second line is less then actual atoms in file */\r\n if (counter < this._numAtoms) {\r\n this._complex.error = {\r\n message: 'File ended unexpectedly.',\r\n };\r\n }\r\n /* Catch errors occurred in parsing process */\r\n if (result.error) {\r\n throw new Error(result.error.message);\r\n }\r\n\r\n /* Finalizing data */\r\n this._finalize();\r\n\r\n /* Cleaning up */\r\n this._atomPosition = null;\r\n this._complex = null;\r\n this._molecules = null;\r\n this._molecule = null;\r\n\r\n /* Return resulting Complex variable */\r\n return result;\r\n }\r\n}\r\n\r\nGROParser.formats = ['gro'];\r\nGROParser.extensions = ['.gro'];\r\n\r\nexport default GROParser;\r\n","import * as THREE from 'three';\r\nimport Parser from './Parser';\r\nimport chem from '../../chem';\r\n\r\nconst {\r\n Complex,\r\n Element,\r\n Bond,\r\n Molecule,\r\n} = chem;\r\n\r\nconst orderMap = {\r\n un: 0,\r\n 1: 1,\r\n 2: 2,\r\n 3: 3,\r\n ar: 1,\r\n am: 1,\r\n nc: 0,\r\n du: 1,\r\n};\r\nconst typeMap = {\r\n un: Bond.BondType.UNKNOWN, // unknown (cannot be determined from the parameter tables)\r\n 1: Bond.BondType.COVALENT, // single\r\n 2: Bond.BondType.COVALENT, // double\r\n 3: Bond.BondType.COVALENT, // triple\r\n ar: Bond.BondType.AROMATIC, // aromatic\r\n am: Bond.BondType.COVALENT, // amide\r\n nc: Bond.BondType.UNKNOWN, // not connected\r\n du: Bond.BondType.COVALENT, // dummy\r\n};\r\n\r\nconst resNumberRegex = /\\d+$/;\r\nconst spacesRegex = /\\s+/;\r\n\r\nfunction splitToFields(str) {\r\n return str.trim().split(spacesRegex);\r\n}\r\n/* There is no jsdoc documentation because of eslint corrections:\r\n * not all Parser methods are implemented\r\n */\r\n\r\nclass MOL2Parser extends Parser {\r\n constructor(data, options) {\r\n super(data, options);\r\n\r\n this._complex = null;\r\n this._chain = null;\r\n this._residue = null;\r\n this._compoundIndx = -1;\r\n\r\n this._molecules = [];\r\n this._molecule = null;\r\n\r\n this._currPosIdx = 0;\r\n this._currStartIdx = 0;\r\n\r\n this._serialAtomMap = {};\r\n\r\n this._options.fileType = 'mol2';\r\n }\r\n\r\n _parseRawStrings(data) {\r\n return data.split(/\\r?\\n|\\r/);\r\n }\r\n\r\n _toStringFromStart(numb, MOL2Data) {\r\n const newPosIdx = this._currStartIdx + numb;\r\n this._currPosIdx = (newPosIdx < MOL2Data.length) ? newPosIdx : this._currStartIdx;\r\n }\r\n\r\n _toHeaderString(header, MOL2Data) {\r\n this._toStringFromStart(0, MOL2Data);\r\n while (this._currPosIdx < MOL2Data.length) {\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`)) {\r\n return;\r\n }\r\n this._currPosIdx++;\r\n }\r\n this._toStringFromStart(0, MOL2Data);\r\n }\r\n\r\n _toStringFromHeader(header, numb, MOL2Data) {\r\n this._toHeaderString(header, MOL2Data);\r\n const newPosIdx = this._currPosIdx + numb;\r\n\r\n if (MOL2Data[this._currPosIdx].match(`@${header}`) && newPosIdx < MOL2Data.length) {\r\n this._currPosIdx = newPosIdx;\r\n }\r\n }\r\n\r\n _setStart(startPos, MOL2Data) {\r\n if (startPos >= MOL2Data.length) {\r\n this._currStartIdx = this._currPosIdx = MOL2Data.length - 1;\r\n } else {\r\n this._currStartIdx = this._currPosIdx = startPos;\r\n }\r\n }\r\n\r\n _probablyHaveDataToParse(MOL2Data) {\r\n return this._currPosIdx < MOL2Data.length - 2;\r\n }\r\n\r\n _findNextCompoundStart(MOL2Data) {\r\n while (this._currPosIdx < MOL2Data.length && MOL2Data[this._currPosIdx].trim() !== '@MOLECULE>') {\r\n this._currPosIdx++;\r\n }\r\n this._setStart(++this._currPosIdx, MOL2Data);\r\n return this._probablyHaveDataToParse(MOL2Data);\r\n }\r\n\r\n _parseMolecule(MOL2Data) {\r\n this._toHeaderString('MOLECULE', MOL2Data);\r\n\r\n const { metadata } = this._complex;\r\n metadata.name = MOL2Data[++this._currPosIdx];\r\n metadata.format = 'mol2';\r\n\r\n this._molecule = { _index: '', _chains: [] };\r\n this._molecule._index = this._compoundIndx + 1;\r\n this._molecules.push(this._molecule);\r\n }\r\n\r\n /* Atom format description:\r\n * atomId atomName x y z element [resSeq [resName [charge [statusBit]]]]\r\n * statusBits is the internal SYBYL status bits associated with the atom.\r\n * These should never be set by the user.\r\n * Source: http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf\r\n */\r\n _parseAtoms(atomsNum, MOL2Data) {\r\n this._toHeaderString('ATOM', MOL2Data);\r\n\r\n for (let i = 0; i < atomsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 6) {\r\n throw new Error('MOL2 parsing error: Not enough information to create atom!');\r\n }\r\n const atomId = parseInt(parsedStr[0], 10);\r\n const atomName = parsedStr[1];\r\n\r\n const x = parseFloat(parsedStr[2]);\r\n const y = parseFloat(parsedStr[3]);\r\n const z = parseFloat(parsedStr[4]);\r\n\r\n const element = parsedStr[5].split('.')[0].toUpperCase();\r\n\r\n let charge = 0;\r\n if (parsedStr.length >= 9) {\r\n charge = parseFloat(parsedStr[8]) || 0.0;\r\n }\r\n\r\n let chain = this._chain;\r\n if (!chain) {\r\n // .mol2 may contain information about multiple molecules, but they can't be visualized\r\n // at the same time now. There is no need to create different chain IDs then.\r\n this._chain = chain = this._complex.getChain('A') || this._complex.addChain('A');\r\n this._residue = null;\r\n }\r\n if (!this._setResidue(parsedStr)) {\r\n continue;\r\n }\r\n\r\n // These fields are not listed in mol2 format. Set them default.\r\n // Atoms and het atoms doesn't differ in .mol2,\r\n // but het atoms have special residues. It can be used in next updates\r\n const het = false;\r\n const altLoc = ' ';\r\n const occupancy = 1.0;\r\n const tempFactor = 0.0;\r\n const type = Element.getByName(element);\r\n const role = Element.Role[atomName];\r\n\r\n const xyz = new THREE.Vector3(x, y, z);\r\n this._residue.addAtom(atomName, type, xyz, role, het, atomId, altLoc, occupancy, tempFactor, charge);\r\n }\r\n }\r\n\r\n _setResidue(parsedStr) {\r\n let resSeq = 1;\r\n let resName = 'UNK'; // The same meaning has '<0>' in some mol2 files\r\n\r\n if (parsedStr.length >= 7) {\r\n resSeq = parseInt(parsedStr[6], 10);\r\n }\r\n if (parsedStr.length >= 8 && parsedStr[7] !== '<0>') {\r\n resName = parsedStr[7].replace(resNumberRegex, '');\r\n }\r\n if (this.settings.now.nowater) {\r\n if (resName === 'HOH' || resName === 'WAT') {\r\n return false;\r\n }\r\n }\r\n const residue = this._residue;\r\n const chain = this._chain;\r\n if (!residue || residue.getSequence() !== resSeq) {\r\n this._residue = chain.addResidue(resName, resSeq, 'A');\r\n }\r\n return true;\r\n }\r\n\r\n /* Bond format description\r\n * bondId originAtomId targetAtomId bondType [statusBits]\r\n */\r\n _parseBonds(bondsNum, MOL2Data) {\r\n this._toHeaderString('BOND', MOL2Data);\r\n\r\n for (let i = 0; i < bondsNum; i++) {\r\n const parsedStr = splitToFields(MOL2Data[++this._currPosIdx]);\r\n\r\n if (parsedStr.length < 3) {\r\n throw new Error('MOL2 parsing error: Missing information about bonds!');\r\n }\r\n\r\n let originAtomId = parseInt(parsedStr[1], 10);\r\n let targetAtomId = parseInt(parsedStr[2], 10);\r\n const bondType = parsedStr[3];\r\n\r\n if (originAtomId > targetAtomId) {\r\n [originAtomId, targetAtomId] = [targetAtomId, originAtomId];\r\n }\r\n this._complex.addBond(\r\n originAtomId,\r\n targetAtomId,\r\n orderMap[bondType] || 0,\r\n typeMap[bondType] || Bond.BondType.UNKNOWN,\r\n true,\r\n );\r\n }\r\n }\r\n\r\n _fixSerialAtoms() {\r\n const atoms = this._complex._atoms;\r\n for (let i = 0; i < atoms.length; i++) {\r\n const atom = atoms[i];\r\n this._serialAtomMap[atom.serial] = atom;\r\n }\r\n }\r\n\r\n _fixBondsArray() {\r\n const serialAtomMap = this._serialAtomMap;\r\n const complex = this._complex;\r\n\r\n if (Object.keys(serialAtomMap).length === 0) {\r\n throw new Error('MOL2 parsing error: Missing atom information!');\r\n }\r\n\r\n const bonds = complex._bonds;\r\n for (let j = 0; j < bonds.length; j++) {\r\n const bond = bonds[j];\r\n bond._left = serialAtomMap[bond._left] || null;\r\n bond._right = serialAtomMap[bond._right] || null;\r\n }\r\n }\r\n\r\n _finalizeMolecules() {\r\n // Get chain from complex\r\n const chain = this._complex._chains[0];\r\n this._complex._molecules = [];\r\n\r\n // Aggregate residues from chains\r\n // (to be precise from the chain 'A')\r\n for (let i = 0; i < this._molecules.length; i++) {\r\n const currMolecule = this._molecules[i];\r\n const molResidues = chain._residues;\r\n const molecule = new Molecule(this._complex, currMolecule._name, i + 1);\r\n molecule.residues = molResidues;\r\n this._complex._molecules[i] = molecule;\r\n }\r\n }\r\n\r\n _finalize() {\r\n this._complex._finalizeBonds();\r\n this._fixSerialAtoms();\r\n this._fixBondsArray();\r\n this._finalizeMolecules();\r\n\r\n this._complex.finalize({\r\n needAutoBonding: false,\r\n detectAromaticLoops: this.settings.now.aromatic,\r\n enableEditing: this.settings.now.editing,\r\n serialAtomMap: this._serialAtomMap,\r\n });\r\n }\r\n\r\n _parseCompound(MOL2Data) {\r\n this._compoundIndx++;\r\n this._parseMolecule(MOL2Data);\r\n\r\n // Ignoring comments and everything before @MOLECULE block\r\n this._toStringFromHeader('MOLECULE', 2, MOL2Data);\r\n\r\n const parsedStr = MOL2Data[this._currPosIdx].trim().split(spacesRegex);\r\n const atomsNum = parsedStr[0];\r\n const bondsNum = parsedStr[1];\r\n\r\n this._parseAtoms(atomsNum, MOL2Data);\r\n this._parseBonds(bondsNum, MOL2Data);\r\n }\r\n\r\n parseSync() {\r\n const result = this._complex = new Complex();\r\n const MOL2Data = this._parseRawStrings(this._data);\r\n do {\r\n this._parseCompound(MOL2Data);\r\n } while (this._findNextCompoundStart(MOL2Data));\r\n\r\n this._finalize();\r\n\r\n return result;\r\n }\r\n}\r\n\r\nMOL2Parser.formats = ['mol2'];\r\nMOL2Parser.extensions = ['.mol2', '.ml2', '.sy2'];\r\n\r\nexport default MOL2Parser;\r\n","import ParserList from './parsers/ParserList';\r\n\r\nimport PDBParser from './parsers/PDBParser';\r\nimport CMLParser from './parsers/CMLParser';\r\nimport MMTFParser from './parsers/MMTFParser';\r\nimport CIFParser from './parsers/CIFParser';\r\nimport CCP4Parser from './parsers/CCP4Parser';\r\nimport XYZParser from './parsers/XYZParser';\r\nimport PubChemParser from './parsers/PubChemParser';\r\nimport SDFParser from './parsers/SDFParser';\r\nimport DSN6Parser from './parsers/DSN6Parser';\r\nimport GROParser from './parsers/GROParser';\r\nimport MOL2Parser from './parsers/MOL2Parser';\r\n\r\nexport default new ParserList([\r\n // note: order might be important\r\n PDBParser,\r\n CIFParser,\r\n MMTFParser,\r\n XYZParser,\r\n CMLParser,\r\n PubChemParser,\r\n SDFParser,\r\n CCP4Parser,\r\n DSN6Parser,\r\n GROParser,\r\n MOL2Parser,\r\n]);\r\n","import EntityList from '../../utils/EntityList';\r\n\r\n/**\r\n * A list of available exporters.\r\n * @extends EntityList\r\n */\r\nclass ExporterList extends EntityList {\r\n /**\r\n * Create a list of exporters.\r\n * The exporters are indexed by supported data formats (`.formats` and\r\n * `.extensions` properties of a Exporter subclass).\r\n * The Exporters can be retrieved later by matching against specs (see {@link ExporterList#find}).\r\n *\r\n * @param {!Array=} someExporters A list of {@link Exporter} subclasses to\r\n * automatically register at creation time.\r\n * @see ExporterList#register\r\n */\r\n constructor(someExporters = []) {\r\n super(someExporters, ['formats']);\r\n }\r\n\r\n /**\r\n * Find a suitable exporter for data.\r\n *\r\n * @param {Object} specs Exporter specifications.\r\n * @param {string=} specs.format Supported data format.\r\n * @param {*=} specs.data Data to export.\r\n */\r\n find(specs) {\r\n let list = [];\r\n if (specs.format) {\r\n list = this._dict.formats[specs.format.toLowerCase()] || [];\r\n }\r\n return [...list];\r\n }\r\n}\r\n\r\nexport default ExporterList;\r\n","import makeContextDependent from '../../utils/makeContextDependent';\r\n\r\nexport default class Exporter {\r\n constructor(source, options) {\r\n this._source = source;\r\n this._options = options || {};\r\n this._abort = false;\r\n }\r\n\r\n exportSync() {\r\n throw new Error('Exporting to this source is not implemented');\r\n }\r\n\r\n export() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n try {\r\n if (this._abort) {\r\n return reject(new Error('Export aborted'));\r\n }\r\n return resolve(this.exportSync());\r\n } catch (error) {\r\n return reject(error);\r\n }\r\n });\r\n });\r\n }\r\n\r\n abort() {\r\n this._abort = true;\r\n }\r\n}\r\n\r\nmakeContextDependent(Exporter.prototype);\r\n","import _ from 'lodash';\r\nimport { Matrix4 } from 'three';\r\n\r\nexport default class PDBResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._currentStr = -1;\r\n this._tag = null;\r\n this._fixedNumeration = false;\r\n this._numeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n\r\n getResult() {\r\n this.writeString('\\n', 81, 81);\r\n return this._resultArray.join('');\r\n }\r\n\r\n _currentStrLength() {\r\n const curStr = this._resultArray[this._currentStr];\r\n return curStr ? curStr.length : 0;\r\n }\r\n\r\n // numeration can be number or boolean\r\n // if numeration is number then just put this number to 8-10 pos in string\r\n // if numeration is boolean then increase number for all new strings\r\n newTag(tag, numeration) {\r\n if (!tag) {\r\n this._tag = null;\r\n } else {\r\n this._tag = tag;\r\n }\r\n if (!_.isUndefined(numeration)) {\r\n if (_.isNumber(numeration)) {\r\n this._tagStrNum = numeration;\r\n this._numeration = true;\r\n this._fixedNumeration = true;\r\n } else if (_.isBoolean(numeration)) {\r\n this._tagStrNum = 0;\r\n this._numeration = numeration;\r\n this._fixedNumeration = false;\r\n }\r\n } else {\r\n this._numeration = false;\r\n this._fixedNumeration = false;\r\n this._tagStrNum = 0;\r\n }\r\n }\r\n\r\n newString(tag) {\r\n this.writeString('\\n', 81, 81);\r\n this._currentStr++;\r\n this._resultArray.push('');\r\n\r\n if (tag) {\r\n this.writeString(tag, 1, 6);\r\n } else if (this._tag) {\r\n this.writeString(this._tag, 1, 6);\r\n }\r\n\r\n if (this._numeration) {\r\n if (!this._fixedNumeration) {\r\n this._tagStrNum++;\r\n }\r\n if (this._tagStrNum !== 1) {\r\n this.writeString(this._tagStrNum.toString(), 10, 8);\r\n }\r\n }\r\n }\r\n\r\n writeEntireString(string, maxStrPos, concat) {\r\n if (!maxStrPos) {\r\n maxStrPos = 81;\r\n }\r\n for (let j = 0; j < string.length; j++) {\r\n if (this._currentStrLength() === maxStrPos && j !== string.length - 1) {\r\n this.newString();\r\n if (concat) { // pretty hardcoddy\r\n this.writeString(concat.tag, concat.begin, concat.end);\r\n }\r\n }\r\n if (string[j] === '\\n') {\r\n this.newString();\r\n } else {\r\n this.writeString(string[j]);\r\n }\r\n }\r\n }\r\n\r\n writeString(string, begin, end) {\r\n let curStr = this._resultArray[this._currentStr];\r\n let str;\r\n\r\n const curStrLength = curStr ? curStr.length : 0;\r\n\r\n if (_.isUndefined(string)) {\r\n return;\r\n }\r\n\r\n if (!_.isNumber(begin)) {\r\n begin = curStrLength + 1;\r\n }\r\n\r\n if (!_.isNumber(end)) {\r\n end = curStrLength + string.length;\r\n }\r\n\r\n if (!_.isString(string)) {\r\n str = string.toString();\r\n } else {\r\n str = string;\r\n }\r\n\r\n const finish = begin < end ? end : begin;\r\n const start = begin < end ? begin : end;\r\n\r\n if (str.length > Math.abs(begin - end) + 1) {\r\n str = str.substr(0, Math.abs(begin - end + 1));\r\n }\r\n\r\n // spaces before start of new data\r\n if (start > curStrLength + 1) {\r\n this._resultArray[this._currentStr] += ' '.repeat(start - curStrLength - 1);\r\n } else if (start <= curStrLength) {\r\n const cStr = this._resultArray[this._currentStr];\r\n this._resultArray[this._currentStr] = cStr.slice(0, start - 1);\r\n }\r\n\r\n // if reverse order\r\n // reverse order of end and begin means that user wants to align text right\r\n if (end < begin) {\r\n const len = begin - end + 1;\r\n str = ' '.repeat(len - str.length) + str;\r\n }\r\n\r\n // some hardcode fix for space between string numeration and data\r\n // (see pdb file format description)\r\n if (start === 11 && this._numeration && this._tagStrNum !== 1) {\r\n str = ` ${str}`;\r\n }\r\n\r\n // append new data to string\r\n this._resultArray[this._currentStr] += str;\r\n curStr = this._resultArray[this._currentStr];\r\n\r\n if (finish > curStr.length) {\r\n this._resultArray[this._currentStr] += ' '.repeat(finish - curStr.length);\r\n }\r\n }\r\n\r\n writeBondsArray(bonds, atom) {\r\n const bondsArrays = this._getSubArrays(bonds, 4);\r\n\r\n for (let k = 0; k < bondsArrays.length; k++) {\r\n this.newString();\r\n this.writeString(atom.serial, 11, 7);\r\n\r\n for (let j = 0; j < bondsArrays[k].length; j++) {\r\n const serial = (bondsArrays[k][j]._left.serial === atom.serial)\r\n ? bondsArrays[k][j]._right.serial : bondsArrays[k][j]._left.serial;\r\n\r\n this.writeString(serial, 16 + 5 * j, 12 + 5 * j);\r\n }\r\n }\r\n }\r\n\r\n _getSubArrays(arr, subArraySize) {\r\n const subArrays = [];\r\n for (let i = 0; i < arr.length; i += subArraySize) {\r\n subArrays.push(arr.slice(i, i + subArraySize));\r\n }\r\n return subArrays;\r\n }\r\n\r\n // function for writing matrix in Remark290 and Remark350 tags\r\n // (see pdb file description)\r\n writeMatrix(matrix, matrixIndx, tag) {\r\n for (let j = 0; j < 3; j++) {\r\n this.newString();\r\n this.writeString(tag, 14, 18);\r\n this.writeString((j + 1).toString(), 19, 19);\r\n this.writeString(matrixIndx.toString(), 23, 20);\r\n for (let k = 0; k < 3; k++) {\r\n const numb = parseFloat(matrix.elements[j * 4 + k]).toFixed(6);\r\n this.writeString(numb.toString(), 33 + k * 10, 24 + k * 10);\r\n }\r\n\r\n const numb = parseFloat(matrix.elements[j * 4 + 3]).toFixed(5);\r\n this.writeString(numb.toString(), 68, 55);\r\n }\r\n }\r\n\r\n writeMatrices(matrices, string) {\r\n if (!matrices) {\r\n return;\r\n }\r\n const matrix = new Matrix4();\r\n for (let j = 0; j < matrices.length; j++) {\r\n matrix.copy(matrices[j]).transpose();\r\n this.writeMatrix(matrix, j + 1, string);\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport Complex from '../../chem/Complex';\r\nimport Exporter from './Exporter';\r\nimport PDBResult from './PDBResult';\r\nimport Assembly from '../../chem/Assembly';\r\nimport { typeByPDBHelixClass } from '../../chem/Helix';\r\n\r\nexport default class PDBExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n this._tags = ['HEADER', 'TITLE', 'COMPND', 'REMARK', 'HELIX', 'SHEET', 'ATOM and HETATM', 'CONECT'];\r\n this._result = null;\r\n this._tagExtractors = {\r\n HEADER: this._extractHEADER,\r\n TITLE: this._extractTITLE,\r\n 'ATOM and HETATM': this._extractATOM,\r\n CONECT: this._extractCONECT,\r\n COMPND: this._extractCOMPND,\r\n REMARK: this._extractREMARK,\r\n HELIX: this._extractHELIX,\r\n SHEET: this._extractSHEET,\r\n };\r\n this._stringForRemark350 = 'COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN\\n'\r\n + 'BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE\\n'\r\n + 'MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS\\n'\r\n + 'GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND\\n'\r\n + 'CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.';\r\n\r\n this._stringForRemark290 = 'CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS\\n'\r\n + 'THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM\\n'\r\n + 'RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY\\n'\r\n + 'RELATED MOLECULES.';\r\n }\r\n\r\n exportSync() {\r\n const result = new PDBResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n for (let i = 0; i < this._tags.length; i++) {\r\n const tag = this._tags[i];\r\n const func = this._tagExtractors[tag];\r\n if (_.isFunction(func)) {\r\n func.call(this, result);\r\n }\r\n }\r\n\r\n this._result = result.getResult();\r\n\r\n return this._result;\r\n }\r\n\r\n _extractHEADER(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n result.newTag('HEADER');\r\n result.newString();\r\n if (metadata.classification) {\r\n result.writeString(metadata.classification, 11, 50);\r\n }\r\n if (metadata.date) {\r\n result.writeString(metadata.date, 51, 59);\r\n }\r\n if (metadata.id) {\r\n result.writeString(metadata.id, 63, 66);\r\n }\r\n }\r\n\r\n _extractTITLE(result) {\r\n if (!this._source.metadata) {\r\n return;\r\n }\r\n const { metadata } = this._source;\r\n if (!metadata.title) {\r\n return;\r\n }\r\n result.newTag('TITLE', true);\r\n for (let i = 0; i < metadata.title.length; i++) {\r\n result.newString();\r\n result.writeString(metadata.title[i], 11, 80);\r\n }\r\n }\r\n\r\n _extractCONECT(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n\r\n const atoms = this._source._atoms;\r\n result.newTag('CONECT');\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const fixedBonds = atoms[i].bonds.filter((bond) => bond._fixed);\r\n if (fixedBonds.length !== 0) {\r\n result.writeBondsArray(fixedBonds.reverse(), atoms[i]);\r\n }\r\n }\r\n }\r\n\r\n _extractSHEET(result) {\r\n if (!this._source._sheets) {\r\n return;\r\n }\r\n\r\n result.newTag('SHEET');\r\n\r\n const sheets = this._source._sheets;\r\n for (let i = 0; i < sheets.length; i++) {\r\n if (sheets[i]._strands) {\r\n const strands = sheets[i]._strands;\r\n for (let j = 0; j < strands.length; j++) {\r\n result.newString();\r\n result.writeString(j + 1, 10, 8);\r\n result.writeString(sheets[i]._name, 14, 12);\r\n result.writeString(strands.length, 16, 15);\r\n result.writeString(strands[j].init._type._name, 18, 20);\r\n result.writeString(strands[j].init._chain._name, 22, 22);\r\n result.writeString(strands[j].init._sequence, 26, 23);\r\n result.writeString(strands[j].init._icode, 27, 27);\r\n result.writeString(strands[j].term._type._name, 29, 31);\r\n result.writeString(strands[j].init._chain._name, 33, 33);\r\n result.writeString(strands[j].term._sequence, 37, 34);\r\n result.writeString(strands[j].term._icode, 38, 38);\r\n result.writeString(strands[j].sense, 40, 39);\r\n }\r\n }\r\n }\r\n }\r\n\r\n _extractHELIX(result) {\r\n if (!this._source._helices) {\r\n return;\r\n }\r\n\r\n result.newTag('HELIX');\r\n const helices = this._source._helices;\r\n for (let i = 0; i < helices.length; i++) {\r\n const helix = helices[i];\r\n const helixClass = _.invert(typeByPDBHelixClass);\r\n result.newString();\r\n result.writeString(helix.serial, 10, 8);\r\n result.writeString(helix.name, 14, 12);\r\n result.writeString(helix.init._type._name, 16, 18);\r\n result.writeString(helix.init._chain._name, 20, 20);\r\n result.writeString(helix.init._sequence, 25, 22);\r\n result.writeString(helix.init._icode, 26, 26);\r\n result.writeString(helix.term._type._name, 28, 30);\r\n result.writeString(helix.term._chain._name, 32, 32);\r\n result.writeString(helix.term._sequence, 37, 34);\r\n result.writeString(helix.term._icode, 38, 38);\r\n result.writeString(helixClass[helix.type], 40, 39);\r\n result.writeString(helix.comment, 41, 70);\r\n result.writeString(helix.length, 76, 72);\r\n }\r\n }\r\n\r\n _extractATOM(result) {\r\n if (!this._source._atoms) {\r\n return;\r\n }\r\n const atoms = this._source._atoms;\r\n\r\n for (let i = 0; i < atoms.length; i++) {\r\n const tag = atoms[i].het ? 'HETATM' : 'ATOM';\r\n result.newString(tag);\r\n const startIndx = (atoms[i].element.name.length > 1 || atoms[i].name.length > 3) ? 13 : 14;\r\n result.writeString(atoms[i].serial, 11, 7);\r\n result.writeString(atoms[i].name, startIndx, 16);\r\n result.writeString(String.fromCharCode(atoms[i].location), 17, 17);\r\n result.writeString(atoms[i].residue._type._name, 20, 18);\r\n result.writeString(atoms[i].residue._chain._name, 22, 22);\r\n result.writeString(atoms[i].residue._sequence, 26, 23);\r\n result.writeString(atoms[i].residue._icode, 27, 27);\r\n result.writeString(atoms[i].position.x.toFixed(3), 38, 31);\r\n result.writeString(atoms[i].position.y.toFixed(3), 46, 39);\r\n result.writeString(atoms[i].position.z.toFixed(3), 54, 47);\r\n result.writeString(atoms[i].occupancy.toFixed(2), 60, 55);\r\n result.writeString(atoms[i].temperature.toFixed(2), 66, 61);\r\n result.writeString(atoms[i].element.name, 78, 77);\r\n if (atoms[i].charge) {\r\n result.writeString(atoms[i].charge, 79, 80);\r\n }\r\n }\r\n }\r\n\r\n _extractCOMPND(result) {\r\n if (!this._source._molecules) {\r\n return;\r\n }\r\n const molecules = this._source._molecules;\r\n result.newTag('COMPND', true);\r\n\r\n for (let i = 0; i < molecules.length; i++) {\r\n const chains = this._getMoleculeChains(molecules[i]);\r\n result.newString();\r\n result.writeString(`MOL_ID: ${molecules[i].index};`, 11, 80);\r\n result.newString();\r\n result.writeString(`MOLECULE: ${molecules[i].name};`, 11, 80);\r\n result.newString();\r\n result.writeString('CHAIN: ', 11, 18);\r\n const chainsString = `${chains.join(', ')};`;\r\n result.writeEntireString(chainsString, 81);\r\n }\r\n }\r\n\r\n _extractREMARK(result) {\r\n this._Remark290(result);\r\n this._Remark350(result);\r\n }\r\n\r\n _Remark290(result) {\r\n if (!this._source.symmetry) {\r\n return;\r\n }\r\n\r\n if (this._source.symmetry.length !== 0) {\r\n const matrices = this._source.symmetry;\r\n result.newTag('REMARK', 290);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark290);\r\n result.writeMatrices(matrices, 'SMTRY');\r\n result.newString();\r\n result.newString();\r\n result.writeString('REMARK: NULL', 11, 80);\r\n }\r\n }\r\n\r\n _Remark350(result) {\r\n if (!this._source.units) {\r\n return;\r\n }\r\n const { units } = this._source;\r\n let biomolIndx = 0;\r\n\r\n result.newTag('REMARK', 350);\r\n result.newString();\r\n result.newString();\r\n result.writeEntireString(this._stringForRemark350);\r\n\r\n const assemblies = units.filter((unit) => unit instanceof Assembly);\r\n\r\n for (let i = 0; i < assemblies.length; i++) {\r\n result.newString();\r\n result.newString();\r\n biomolIndx++;\r\n result.writeString(`BIOMOLECULE: ${biomolIndx}`, 11, 80);\r\n const chains = assemblies[i].chains.join(', ');\r\n result.newString();\r\n result.writeString('APPLY THE FOLLOWING TO CHAINS: ');\r\n result.writeEntireString(chains, 69, { tag: 'AND CHAINS: ', begin: 31, end: 42 });\r\n\r\n const { matrices } = assemblies[i];\r\n result.writeMatrices(matrices, 'BIOMT');\r\n }\r\n }\r\n\r\n _getMoleculeChains(molecule) {\r\n function getChainName(residue) {\r\n return residue._chain._name;\r\n }\r\n const chainNames = molecule.residues.map(getChainName);\r\n return chainNames.filter((item, pos) => chainNames.indexOf(item) === pos);\r\n }\r\n}\r\n\r\nPDBExporter.formats = ['pdb'];\r\nPDBExporter.SourceClass = Complex;\r\n","import * as THREE from 'three';\r\n\r\nconst FBX_POS_SIZE = 3;\r\nconst FBX_NORM_SIZE = 3;\r\nconst FBX_COL_SIZE = 4;\r\n\r\nfunction copyFbxPoint3(src, srcIdx, dst, dstIdx) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n}\r\n\r\nfunction copyFbxPoint4(src, srcIdx, dst, dstIdx, value) {\r\n dst[dstIdx] = src[srcIdx];\r\n dst[dstIdx + 1] = src[srcIdx + 1];\r\n dst[dstIdx + 2] = src[srcIdx + 2];\r\n dst[dstIdx + 3] = value;\r\n}\r\n\r\nconst vector4 = new THREE.Vector4();\r\nfunction copyTransformedPoint3(src, srcIdx, dst, dstIdx, opts) {\r\n vector4.set(src[srcIdx], src[srcIdx + 1], src[srcIdx + 2], opts.w);\r\n vector4.applyMatrix4(opts.matrix);\r\n dst[dstIdx] = vector4.x;\r\n dst[dstIdx + 1] = vector4.y;\r\n dst[dstIdx + 2] = vector4.z;\r\n}\r\n\r\nfunction setSubArray(src, dst, count, copyFunctor, functorOpts) {\r\n if ((dst.array.length - dst.start) / dst.stride < count\r\n || (src.array.length - src.start) / src.stride < count) {\r\n return; // we've got no space\r\n }\r\n if (src.stride === dst.stride) { // stride is the same\r\n dst.array.set(src.array, dst.start);\r\n } else {\r\n let idx = dst.start;\r\n let arridx = src.start;\r\n for (let i = 0; i < count; ++i, idx += dst.stride, arridx += src.stride) {\r\n copyFunctor(src.array, arridx, dst.array, idx, functorOpts);\r\n }\r\n }\r\n}\r\n\r\nexport default class FBXModel {\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.lastPos = 0;\r\n this.lastNorm = 0;\r\n this.lastCol = 0;\r\n this.lastIdx = 0;\r\n }\r\n\r\n init(vertsCount, indsCount) {\r\n this.positions = new Float32Array(vertsCount * FBX_POS_SIZE);\r\n this.normals = new Float32Array(vertsCount * FBX_NORM_SIZE);\r\n this.colors = new Float32Array(vertsCount * FBX_COL_SIZE);\r\n this.indices = new Int32Array(indsCount);\r\n }\r\n\r\n setPositions(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.positions,\r\n start: this.lastPos,\r\n stride: FBX_POS_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setTransformedPositions(array, start, count, stride, matrix) {\r\n let idx = this.lastPos;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 1 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_POS_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.positions, idx, opts);\r\n }\r\n this.lastPos += count * FBX_POS_SIZE;\r\n }\r\n\r\n setNormals(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.normals,\r\n start: this.lastNorm,\r\n stride: FBX_NORM_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint3);\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setTransformedNormals(array, start, count, stride, matrix) {\r\n let idx = this.lastNorm;\r\n let arrIdx = start;\r\n const opts = { matrix, w: 0 };\r\n for (let i = 0; i < count; ++i, arrIdx += stride, idx += FBX_NORM_SIZE) {\r\n copyTransformedPoint3(array, arrIdx, this.normals, idx, opts);\r\n }\r\n this.lastNorm += count * FBX_NORM_SIZE;\r\n }\r\n\r\n setColors(array, start, count, stride) {\r\n const src = {\r\n array,\r\n start,\r\n stride,\r\n };\r\n const dst = {\r\n array: this.colors,\r\n start: this.lastCol,\r\n stride: FBX_COL_SIZE,\r\n };\r\n setSubArray(src, dst, count, copyFbxPoint4, 1);\r\n this.lastCol += count * FBX_COL_SIZE;\r\n }\r\n\r\n setIndices(array, start, count) {\r\n this.indices.set(array, this.lastIdx);\r\n this.lastIdx += count;\r\n }\r\n\r\n setShiftedIndices(array, count, shift) {\r\n const shifted = array.map((x) => x + shift);\r\n this.setIndices(shifted, 0, count);\r\n }\r\n\r\n getVerticesNumber() {\r\n return this.lastPos / FBX_POS_SIZE;\r\n }\r\n\r\n addInstance(matrix, geo) {\r\n // add indices at first to take old number of vertices for shift\r\n const currentCount = this.getVerticesNumber();\r\n this.setShiftedIndices(geo.indices, geo.indices.length, currentCount);\r\n // simply write vertices at empty space\r\n const size = geo.itemSize;\r\n this.setTransformedPositions(geo.positions, 0, geo.vertsCount, size.position, matrix);\r\n this.setTransformedNormals(geo.normals, 0, geo.vertsCount, size.normal, matrix);\r\n this.setColors(geo.colors, 0, geo.vertsCount, size.color);\r\n }\r\n}\r\n","/** Base class for fbx geometry contains simply organized attributes: positions+normals+colors, indices. */\r\nexport default class FBXGeometry {\r\n /**\r\n * Create a base geo with necessary members.\r\n */\r\n constructor() {\r\n this.positions = null;\r\n this.normals = null;\r\n this.colors = null;\r\n this.indices = null;\r\n this.vertsCount = 0;\r\n this.itemSize = null;\r\n }\r\n\r\n /**\r\n * Initialize base geo storing items info from attributes.\r\n * @param {Object} geo - THREE.BufferGeometry.\r\n */\r\n init(geo, _info) {\r\n const { attributes } = geo;\r\n // save item size\r\n this.itemSize = {\r\n position: attributes.position.itemSize,\r\n normal: attributes.normal.itemSize,\r\n color: attributes.color.itemSize,\r\n };\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes and creates colors filled with defined value.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX1CGeometry extends FBXGeometry {\r\n /**\r\n * Initialize geo storing positions, normals, indices and create colors.\r\n * @param {Object} geo - THREE.BufferGeometry.\r\n */\r\n init(geo, _info) {\r\n super.init(geo, _info);\r\n const {\r\n attributes: {\r\n position,\r\n normal,\r\n },\r\n index,\r\n } = geo;\r\n // copy vertices attributes\r\n this.vertsCount = position.count;\r\n this.positions = position.array;\r\n this.normals = normal.array;\r\n // create color array\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n // indices\r\n this.indices = index.array;\r\n }\r\n\r\n /**\r\n * Set defined color for all items in color attribute\r\n * @param {Object} color - THREE.Color.\r\n */\r\n setColors(color) {\r\n let offset = 0;\r\n for (let i = 0, l = this.colors.length, cl = this.itemSize.color; i < l; i += cl) {\r\n this.colors[offset++] = color.r;\r\n this.colors[offset++] = color.g;\r\n this.colors[offset++] = color.b;\r\n }\r\n }\r\n}\r\n","import FBXGeometry from './FBXGeometry';\r\n\r\n/**\r\n * Fbx geometry, that copies positions+normals, indexes from cylinder geometry and creates colors filled with two\r\n * defined values.\r\n * @extends FBXGeometry\r\n */\r\nexport default class FBX2CCylinder extends FBXGeometry {\r\n constructor() {\r\n super();\r\n this._cutRawStart = 0;\r\n this._cutRawEnd = 0;\r\n this._facesPerSlice = 0;\r\n }\r\n\r\n /**\r\n * Initialize geo by creating new attributes, because we extend number of vertices to make cylinder two-colored.\r\n * Indices remain the same. We process open- end close-ended cylinders and consider cylinders od 2 segments\r\n * in height ONLY.\r\n * NOTE: cylinder consists of 2 height segments and stores parts in the order: tube, topCap, bottomCap\r\n * @param {Object} geo - THREE.BufferGeometry.\r\n * @param {Object} info - information needed for geo extend\r\n */\r\n init(geo, info) {\r\n super.init(geo, info);\r\n const {\r\n attributes: {\r\n position,\r\n },\r\n index,\r\n } = geo;\r\n // extend vertices arrays\r\n this.vertsCount = position.count + info.addPerCylinder;\r\n this._facesPerSlice = info.addPerCylinder;\r\n this.positions = new Float32Array(this.vertsCount * position.itemSize);\r\n this.normals = new Float32Array(this.vertsCount * this.itemSize.normal);\r\n this.colors = new Float32Array(this.vertsCount * this.itemSize.color);\r\n this._extendVertices(geo, info);\r\n // number of indices stays the same\r\n this.indices = new Uint32Array(index.count);\r\n this._extendIndices(geo, info);\r\n }\r\n\r\n /** Extend vertex attributes to have one more slice to make sharp middle startColor-endColor line. */\r\n _extendVertices(geo, info) {\r\n const { position } = geo.attributes;\r\n const { normal } = geo.attributes;\r\n const geoParams = geo.getGeoParams();\r\n const cutRaw = 1; // we expect cylinders of 2 segments in height => so half segment = 1\r\n this._cutRawStart = cutRaw * geoParams.radialSegments;\r\n this._cutRawEnd = this._cutRawStart + info.addPerCylinder;\r\n { // write first half of cylinder\r\n let temp = position.array.slice(0, this._cutRawEnd * position.itemSize);\r\n this.positions.set(temp, 0);\r\n temp = normal.array.slice(0, this._cutRawEnd * normal.itemSize);\r\n this.normals.set(temp, 0);\r\n }\r\n { // write second part of cylinder\r\n let temp = position.array.slice(this._cutRawStart * position.itemSize, position.array.length);\r\n this.positions.set(temp, this._cutRawEnd * position.itemSize);\r\n temp = normal.array.slice(this._cutRawStart * normal.itemSize, normal.array.length);\r\n this.normals.set(temp, this._cutRawEnd * normal.itemSize);\r\n }\r\n }\r\n\r\n /** Shift values of second part (+caps) indices by newly added vertices count. Number of faces remains the same. */\r\n _extendIndices(geo, info) {\r\n const { index } = geo;\r\n const indicesPerQuad = 6; // quad = 2 triangles => 6 indices\r\n const startToShift = info.addPerCylinder * indicesPerQuad;\r\n const shift = info.addPerCylinder;\r\n let shifted = index.array.slice(startToShift, index.count);\r\n shifted = shifted.map((x) => x + shift); // shift only the endings\r\n this.indices.set(index.array, 0);\r\n this.indices.set(shifted, startToShift);\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {number} start - start color index\r\n * @param {number} end - start color index\r\n * @param {array} array - array of colors\r\n * @param {array} color - color value components\r\n */\r\n _setColorRange(start, end, array, color) {\r\n const colorSize = color.length;\r\n for (let i = start; i < end; i += colorSize) {\r\n array.set(color, i);\r\n }\r\n }\r\n\r\n /**\r\n * Set defined colors: (first part + bottom cap), (second part + top cap)\r\n * @param {Object} color1 - THREE.Color.\r\n * @param {Object} color2 - THREE.Color.\r\n */\r\n setColors(color1, color2) {\r\n const colorSize = this.itemSize.color;\r\n const part1End = this._cutRawEnd * colorSize;\r\n const part2End = part1End * 2;\r\n this._setColorRange(0, part1End, this.colors, color1.toArray());\r\n this._setColorRange(part1End, part2End, this.colors, color2.toArray());\r\n if (part2End < this.colors.length) { // cylinder has caps, lets paint them\r\n const capSize = (this._facesPerSlice + 1) * colorSize;\r\n const cap1End = part2End + capSize;\r\n this._setColorRange(part2End, cap1End, this.colors, color2.toArray());\r\n const cap2End = cap1End + capSize; // should be equal to this.colors.length;\r\n this._setColorRange(cap1End, cap2End, this.colors, color1.toArray());\r\n }\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport * as THREE from 'three';\r\n\r\nimport utils from '../../../utils';\r\nimport gfxutils from '../../../gfx/gfxutils';\r\nimport logger from '../../../utils/logger';\r\n\r\nimport FBXModel from './FBXModel';\r\nimport ThickLineMesh from '../../../gfx/meshes/ThickLineMesh';\r\nimport ZSpriteMesh from '../../../gfx/meshes/ZSpriteMesh';\r\nimport InstancedSpheresGeometry from '../../../gfx/geometries/InstancedSpheresGeometry';\r\nimport Instanced2CCylindersGeometry from '../../../gfx/geometries/Instanced2CCylindersGeometry';\r\nimport FBX1CGeometry from './FBX1CGeometry';\r\nimport FBX2CCylinder from './FBX2CCylinder';\r\n\r\nexport default class FBXInfoExtractor {\r\n constructor() {\r\n this._materials = [];\r\n this._models = [];\r\n }\r\n\r\n process(data) {\r\n this._extractModelsAndMaterials(data);\r\n const models = this._flattenModels();\r\n\r\n return {\r\n name: data.name,\r\n models,\r\n materials: this._materials,\r\n };\r\n }\r\n\r\n /**\r\n * Extract fbx object information from ComplexVisual\r\n * @param {object} data - complexVisual to get geometry info from\r\n */\r\n _extractModelsAndMaterials(data) {\r\n const layersOfInterest = new THREE.Layers();\r\n layersOfInterest.set(gfxutils.LAYERS.DEFAULT);\r\n layersOfInterest.enable(gfxutils.LAYERS.TRANSPARENT);\r\n data.traverse((object) => {\r\n if (object instanceof THREE.Mesh && object.layers.test(layersOfInterest) && this.checkExportAbility(object)) {\r\n if (object.geometry.type === 'InstancedBufferGeometry') {\r\n this._collectInstancedGeoInfo(object);\r\n } else {\r\n this._collectGeoInfo(object);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Reworking indices buffer, see https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/\r\n * basically, every triangle in Miew has been represented hat way (e.g.) : 0,1,7, but we must (for FBX) rework that\r\n * into: 0,1,-8.\r\n * @param {array} indices - belongs to [0, maxVertIndex]\r\n */\r\n _reworkIndices(indices) {\r\n const faceSize = 3;\r\n for (let i = faceSize - 1; i < indices.length; i += faceSize) {\r\n indices[i] *= -1;\r\n indices[i]--;\r\n }\r\n }\r\n\r\n /**\r\n * Combine geometry from several models having the same material into one Model and finally prepare indices\r\n * @returns {array} models, combined by material id\r\n */\r\n _flattenModels() {\r\n let overallVertsCount = 0;\r\n function shift(x) {\r\n return x + overallVertsCount;\r\n }\r\n const combined = [];\r\n // flatten models geometry\r\n for (let i = 0, n = this._models.length; i < n; i++) {\r\n const models = this._models[i];\r\n let indices = [];\r\n let positions = [];\r\n let normals = [];\r\n let colors = [];\r\n // reorganize every attributes as array of arrays\r\n overallVertsCount = 0;\r\n for (let j = 0; j < models.length; j++) {\r\n const m = models[j];\r\n indices.push(m.indices.map(shift));\r\n overallVertsCount += m.getVerticesNumber();\r\n positions.push(m.positions);\r\n normals.push(m.normals);\r\n colors.push(m.colors);\r\n }\r\n // join all subarrays into one\r\n indices = utils.mergeTypedArraysUnsafe(indices);\r\n this._reworkIndices(indices);\r\n positions = utils.mergeTypedArraysUnsafe(positions);\r\n normals = utils.mergeTypedArraysUnsafe(normals);\r\n colors = utils.mergeTypedArraysUnsafe(colors);\r\n combined.push({\r\n indices,\r\n positions,\r\n normals,\r\n colors,\r\n verticesCount: overallVertsCount,\r\n });\r\n }\r\n return combined;\r\n }\r\n\r\n /**\r\n * Check ability to export the kind of mesh.\r\n * @param {object} mesh - given mesh to check\r\n * @returns {boolean} result of check\r\n */\r\n checkExportAbility(mesh) {\r\n // check mesh on not being empty\r\n if (mesh.geometry.attributes.position.count === 0) {\r\n return false;\r\n }\r\n // check type of mesh\r\n // if (mesh.geometry.isInstancedBufferGeometry && settings.now.zSprites) {\r\n if (mesh instanceof ZSpriteMesh) {\r\n logger.warn('Currently we cannot export \\'sprites\\' modes, like BS, WV, LC. Please turn of settings \\'zSprites\\' and try again');\r\n return false;\r\n }\r\n if (mesh instanceof ThickLineMesh) {\r\n logger.warn('Currently we cannot export Lines mode');\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Save geometry info from common mesh, like Surface or Cartoon\r\n */\r\n _collectGeoInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n normal,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const vertCount = position.count;\r\n model.init(vertCount, index.count);\r\n if (matrix.isIdentity()) {\r\n model.setPositions(position.array, 0, vertCount, position.itemSize);\r\n model.setNormals(normal.array, 0, vertCount, normal.itemSize);\r\n } else {\r\n model.setTransformedPositions(position.array, 0, vertCount, position.itemSize, matrix);\r\n model.setTransformedNormals(normal.array, 0, vertCount, normal.itemSize, matrix);\r\n }\r\n model.setColors(color.array, 0, vertCount, color.itemSize);\r\n model.setIndices(index.array, 0, index.count);\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Collect instanced spheres geometry and materials.\r\n * @param {object} mesh - mesh with instanced spheres info\r\n */\r\n _collectSpheresInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.instanceCount;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount, instCount * indsCount);\r\n const geo = new FBX1CGeometry();\r\n geo.init(mesh.geometry);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const sphereColor = new THREE.Color();\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n sphereColor.fromArray(color.array, colorIdx);\r\n geo.setColors(sphereColor);\r\n // add instance to the model\r\n this._getSphereInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Getting all instanced cylinders from given mesh.\r\n * Divide cylinder (add additional vertexes) for prettiness therefore algorithm is a bit complicated\r\n * @param {object} mesh - given mesh with instanced cylinders\r\n */\r\n _collectCylindersInfo(mesh) {\r\n const {\r\n geometry: {\r\n attributes: {\r\n position,\r\n color,\r\n color2,\r\n },\r\n index,\r\n },\r\n matrix,\r\n } = mesh;\r\n\r\n const model = new FBXModel();\r\n const instCount = mesh.geometry.instanceCount;\r\n const oneCCylinder = new FBX1CGeometry();\r\n oneCCylinder.init(mesh.geometry);\r\n const splittingInfo = this._gatherCylindersColoringInfo(mesh.geometry);\r\n let twoCCylinder = null;\r\n if (splittingInfo.needToSplit > 0) {\r\n twoCCylinder = new FBX2CCylinder();\r\n twoCCylinder.init(mesh.geometry, splittingInfo);\r\n }\r\n const additionalVertsCount = splittingInfo.addPerCylinder * splittingInfo.needToSplit;\r\n const vertCount = position.count;\r\n const indsCount = index.count;\r\n model.init(instCount * vertCount + additionalVertsCount, instCount * indsCount);\r\n const instMatrix = new THREE.Matrix4();\r\n const objMatrix = new THREE.Matrix4();\r\n const colorStart = new THREE.Color();\r\n const colorEnd = new THREE.Color();\r\n let geo = {};\r\n for (let instanceIndex = 0; instanceIndex < instCount; ++instanceIndex) {\r\n // update colors in geometry\r\n const colorIdx = instanceIndex * color.itemSize;\r\n if (splittingInfo.is2Colored[instanceIndex]) {\r\n // .color2 contains starting color, and .color contains starting color (see uber.frag ATTR_COLOR2)\r\n colorStart.fromArray(color2.array, colorIdx);\r\n colorEnd.fromArray(color.array, colorIdx);\r\n if (twoCCylinder) {\r\n twoCCylinder.setColors(colorStart, colorEnd);\r\n geo = twoCCylinder;\r\n }\r\n } else {\r\n // has one color per cylinder\r\n colorStart.fromArray(color.array, colorIdx);\r\n oneCCylinder.setColors(colorStart);\r\n geo = oneCCylinder;\r\n }\r\n // add instance to the model\r\n this._getCylinderInstanceMatrix(mesh.geometry, instanceIndex, instMatrix);\r\n objMatrix.multiplyMatrices(matrix, instMatrix);\r\n model.addInstance(objMatrix, geo);\r\n }\r\n const material = this._collectMaterialInfo(mesh);\r\n this._addToPool(model, material);\r\n }\r\n\r\n /**\r\n * Adding model to pool of models or extend existing ones\r\n * @param {object} model - model to add\r\n * @param {object} material - material to add\r\n */\r\n _addToPool(model, material) {\r\n const materialIdx = this._checkExistingMaterial(material);\r\n if (materialIdx < 0) { // new model-material pair\r\n this._models.push([model]);\r\n this._materials.push(material);\r\n } else { // add model to existing model-material pair\r\n const models = this._models[materialIdx];\r\n models.push(model);\r\n }\r\n }\r\n\r\n /**\r\n * Checking if given material already was registered in materials pool (no need to create new one)\r\n * @param {object} material - given material\r\n * @returns {number} number of model-material pair\r\n */\r\n _checkExistingMaterial(material) {\r\n return _.findIndex(this._materials, (m) => _.isEqual(m, material));\r\n }\r\n\r\n _gatherCylindersColoringInfo(geo) {\r\n const instCount = geo.instanceCount;\r\n const color1 = geo.attributes.color.array;\r\n const color2 = geo.attributes.color2.array;\r\n const stride = geo.attributes.color.itemSize;\r\n const is2Colored = new Array(instCount);\r\n // analyze color instance attributes\r\n let needToSplit = 0;\r\n let colIdx = 0;\r\n for (let i = 0; i < instCount; i++, colIdx += stride) {\r\n const differs = (Math.abs(color1[colIdx] - color2[colIdx]) > 0.0000001) // compare ending colors\r\n || (Math.abs(color1[colIdx + 1] - color2[colIdx + 1]) > 0.0000001)\r\n || (Math.abs(color1[colIdx + 2] - color2[colIdx + 2]) > 0.0000001);\r\n is2Colored[i] = differs;\r\n needToSplit += differs; // count number of 2-colored cylinders\r\n }\r\n // calc number of vertices to add into 2-colored\r\n const geoParams = geo.getGeoParams();\r\n const addPerCylinder = geoParams.radialSegments;\r\n return { is2Colored, needToSplit, addPerCylinder };\r\n }\r\n\r\n /**\r\n * Collect instanced models and materials.\r\n * @param {object} mesh - given mesh with instanced something (spheres or cylinders)\r\n */\r\n _collectInstancedGeoInfo(mesh) {\r\n if (mesh.geometry instanceof InstancedSpheresGeometry) {\r\n this._collectSpheresInfo(mesh);\r\n } else if (mesh.geometry instanceof Instanced2CCylindersGeometry) {\r\n this._collectCylindersInfo(mesh);\r\n }\r\n }\r\n\r\n /**\r\n * Collect Material info from given mesh.\r\n * @param {object} mesh - given mesh with material info\r\n * @returns {object} material\r\n */\r\n _collectMaterialInfo(mesh) {\r\n const { uberOptions } = mesh.material;\r\n return ({\r\n diffuse: uberOptions.diffuse.toArray(),\r\n opacity: uberOptions.opacity,\r\n shininess: uberOptions.shininess,\r\n specular: uberOptions.specular.toArray(),\r\n });\r\n }\r\n\r\n _getCylinderInstanceMatrix(geo, instIdx, matrix) {\r\n const matVector1 = geo.attributes.matVector1.array;\r\n const matVector2 = geo.attributes.matVector2.array;\r\n const matVector3 = geo.attributes.matVector3.array;\r\n const idxOffset = instIdx * 4; // used 4 because offset arrays are stored in quads\r\n matrix.set(\r\n matVector1[idxOffset],\r\n matVector1[idxOffset + 1],\r\n matVector1[idxOffset + 2],\r\n matVector1[idxOffset + 3],\r\n matVector2[idxOffset],\r\n matVector2[idxOffset + 1],\r\n matVector2[idxOffset + 2],\r\n matVector2[idxOffset + 3],\r\n matVector3[idxOffset],\r\n matVector3[idxOffset + 1],\r\n matVector3[idxOffset + 2],\r\n matVector3[idxOffset + 3],\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n );\r\n }\r\n\r\n _getSphereInstanceMatrix(geo, instIdx, matrix) {\r\n const { offset } = geo.attributes;\r\n const idx = instIdx * offset.itemSize;\r\n const x = offset.array[idx];\r\n const y = offset.array[idx + 1];\r\n const z = offset.array[idx + 2];\r\n const scale = offset.array[idx + 3];\r\n matrix.set(\r\n scale,\r\n 0,\r\n 0,\r\n x,\r\n 0,\r\n scale,\r\n 0,\r\n y,\r\n 0,\r\n 0,\r\n scale,\r\n z,\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n );\r\n }\r\n}\r\n","// Forming default definitions block\r\nconst defaultDefinitions = `\r\nDefinitions: {\r\n Version: 100\r\n Count: 3\r\n ObjectType: \"Model\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Geometry\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Material\" {\r\n Count: 1\r\n }\r\n ObjectType: \"Pose\" {\r\n Count: 1\r\n }\r\n ObjectType: \"GlobalSettings\" {\r\n Count: 1\r\n }\r\n} `;\r\n\r\n// Default model properties\r\nconst defaultProperties = `Properties60: {\r\n Property: \"QuaternionInterpolate\", \"bool\", \"\",0\r\n Property: \"Visibility\", \"Visibility\", \"A\",1\r\n Property: \"Lcl Translation\", \"Lcl Translation\", \"A\",0.000000000000000,0.000000000000000,-1789.238037109375000\r\n Property: \"Lcl Rotation\", \"Lcl Rotation\", \"A\",0.000009334667643,-0.000000000000000,0.000000000000000\r\n Property: \"Lcl Scaling\", \"Lcl Scaling\", \"A\",1.000000000000000,1.000000000000000,1.000000000000000\r\n Property: \"RotationOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingOffset\", \"Vector3D\", \"\",0,0,0\r\n Property: \"ScalingPivot\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationActive\", \"bool\", \"\",0\r\n Property: \"TranslationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TranslationMinX\", \"bool\", \"\",0\r\n Property: \"TranslationMinY\", \"bool\", \"\",0\r\n Property: \"TranslationMinZ\", \"bool\", \"\",0\r\n Property: \"TranslationMaxX\", \"bool\", \"\",0\r\n Property: \"TranslationMaxY\", \"bool\", \"\",0\r\n Property: \"TranslationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationOrder\", \"enum\", \"\",0\r\n Property: \"RotationSpaceForLimitOnly\", \"bool\", \"\",0\r\n Property: \"AxisLen\", \"double\", \"\",10\r\n Property: \"PreRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"PostRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationActive\", \"bool\", \"\",0\r\n Property: \"RotationMin\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMax\", \"Vector3D\", \"\",0,0,0\r\n Property: \"RotationMinX\", \"bool\", \"\",0\r\n Property: \"RotationMinY\", \"bool\", \"\",0\r\n Property: \"RotationMinZ\", \"bool\", \"\",0\r\n Property: \"RotationMaxX\", \"bool\", \"\",0\r\n Property: \"RotationMaxY\", \"bool\", \"\",0\r\n Property: \"RotationMaxZ\", \"bool\", \"\",0\r\n Property: \"RotationStiffnessX\", \"double\", \"\",0\r\n Property: \"RotationStiffnessY\", \"double\", \"\",0\r\n Property: \"RotationStiffnessZ\", \"double\", \"\",0\r\n Property: \"MinDampRangeX\", \"double\", \"\",0\r\n Property: \"MinDampRangeY\", \"double\", \"\",0\r\n Property: \"MinDampRangeZ\", \"double\", \"\",0\r\n Property: \"MaxDampRangeX\", \"double\", \"\",0\r\n Property: \"MaxDampRangeY\", \"double\", \"\",0\r\n Property: \"MaxDampRangeZ\", \"double\", \"\",0\r\n Property: \"MinDampStrengthX\", \"double\", \"\",0\r\n Property: \"MinDampStrengthY\", \"double\", \"\",0\r\n Property: \"MinDampStrengthZ\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthX\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthY\", \"double\", \"\",0\r\n Property: \"MaxDampStrengthZ\", \"double\", \"\",0\r\n Property: \"PreferedAngleX\", \"double\", \"\",0\r\n Property: \"PreferedAngleY\", \"double\", \"\",0\r\n Property: \"PreferedAngleZ\", \"double\", \"\",0\r\n Property: \"InheritType\", \"enum\", \"\",0\r\n Property: \"ScalingActive\", \"bool\", \"\",0\r\n Property: \"ScalingMin\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMax\", \"Vector3D\", \"\",1,1,1\r\n Property: \"ScalingMinX\", \"bool\", \"\",0\r\n Property: \"ScalingMinY\", \"bool\", \"\",0\r\n Property: \"ScalingMinZ\", \"bool\", \"\",0\r\n Property: \"ScalingMaxX\", \"bool\", \"\",0\r\n Property: \"ScalingMaxY\", \"bool\", \"\",0\r\n Property: \"ScalingMaxZ\", \"bool\", \"\",0\r\n Property: \"GeometricTranslation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricRotation\", \"Vector3D\", \"\",0,0,0\r\n Property: \"GeometricScaling\", \"Vector3D\", \"\",1,1,1\r\n Property: \"LookAtProperty\", \"object\", \"\"\r\n Property: \"UpVectorProperty\", \"object\", \"\"\r\n Property: \"Show\", \"bool\", \"\",1\r\n Property: \"NegativePercentShapeSupport\", \"bool\", \"\",1\r\n Property: \"DefaultAttributeIndex\", \"int\", \"\",0\r\n Property: \"Color\", \"Color\", \"A+\",0,0,0\r\n Property: \"Size\", \"double\", \"\",100\r\n Property: \"Look\", \"enum\", \"\",1\r\n }`;\r\n\r\n// Default materials layer\r\nconst defaultMaterialLayer = `\r\n LayerElementMaterial: 0 {\r\n Version: 101\r\n Name: \"\"\r\n MappingInformationType: \"AllSame\"\r\n ReferenceInformationType: \"Direct\"\r\n Materials: 0\r\n }`;\r\n\r\n// Default layers block\r\nconst defaultLayerBlock = `\r\n Layer: 0 {\r\n Version: 100\r\n LayerElement: {\r\n Type: \"LayerElementNormal\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementColor\"\r\n TypedIndex: 0\r\n }\r\n LayerElement: {\r\n Type: \"LayerElementMaterial\"\r\n TypedIndex: 0\r\n }\r\n }`;\r\n\r\n/**\r\n * globalSettings info in output file.\r\n */\r\nconst globalSettings = `GlobalSettings: {\r\n Version: 1000\r\n Properties60: {\r\n Property: \"UpAxis\", \"int\", \"\",1\r\n Property: \"UpAxisSign\", \"int\", \"\",1\r\n Property: \"FrontAxis\", \"int\", \"\",2\r\n Property: \"FrontAxisSign\", \"int\", \"\",1\r\n Property: \"CoordAxis\", \"int\", \"\",0\r\n Property: \"CoordAxisSign\", \"int\", \"\",1\r\n Property: \"UnitScaleFactor\", \"double\", \"\",1\r\n }\r\n }`;\r\n\r\nexport default class FBXResult {\r\n constructor() {\r\n this._resultArray = [];\r\n this._info = null;\r\n }\r\n\r\n getResult(info) {\r\n this._info = info;\r\n this._resultArray.push(this._writeHeader());\r\n this._resultArray.push(this._writeDefinitions());\r\n this._resultArray.push(this._writeObjects(info.models, info.materials));\r\n this._resultArray.push(this._writeRelations());\r\n this._resultArray.push(this._writeConnections()); // connections between models and materials)\r\n this._info = null;\r\n return this._resultArray.join('');\r\n }\r\n\r\n /**\r\n * Add FBXHeader info to output file.\r\n * Some fields are really confusing, but it seems that all listed fields are very informative\r\n */\r\n _writeHeader() {\r\n const FBXHeaderVersion = 1003; // 1003 is some number which appears to present in many 6.1 ASCII files\r\n const FBXVersion = 6100; // Mandatory and only supported version\r\n const date = new Date();\r\n const timeStampVersion = 1000;\r\n const creator = `Miew FBX Exporter v${this._info.version}`; // Supposed to be an engine\r\n\r\n return `; FBX 6.1.0 project file\r\n; Created by ${creator} Copyright (c) 2015-2024 EPAM Systems, Inc.\r\n; For support please contact miew@epam.com\r\n; ----------------------------------------------------\r\n\r\nFBXHeaderExtension: {\r\n FBXHeaderVersion: ${FBXHeaderVersion}\r\n FBXVersion: ${FBXVersion}\r\n CreationTimeStamp: {\r\n Version: ${timeStampVersion}\r\n Year: ${date.getFullYear()}\r\n Month: ${date.getMonth() + 1}\r\n Day: ${date.getDate()}\r\n Hour: ${date.getHours()}\r\n Minute: ${date.getMinutes()}\r\n Second: ${date.getSeconds()}\r\n Millisecond: ${date.getMilliseconds()}\r\n }\r\n Creator: \"${creator}\"\r\n OtherFlags: {\r\n FlagPLE: 0\r\n }\r\n}\r\nCreationTime: \"${date}\"\r\nCreator: \"${creator}\"\r\n`;\r\n }\r\n\r\n /**\r\n * Add Definitions info to output file.\r\n * Not exactly sure if this section is template section (as it is in 7.4+) or it should every time be like this\r\n */\r\n _writeDefinitions() {\r\n return `\r\n; Object definitions\r\n;------------------------------------------------------------------\r\n\r\n${defaultDefinitions}\r\n`;\r\n }\r\n\r\n /**\r\n * Adding gathered information about Models to resulting string.\r\n * Reminder - there may be more then 1 model in scene, but we must place materials after ALL models.\r\n * @returns {string} string containing all models (vertices, indices, colors, normals etc)\r\n */\r\n _models() {\r\n const modelVersion = 232;\r\n let allModels = '';\r\n const { models } = this._info;\r\n for (let i = 0; i < models.length; ++i) {\r\n const model = models[i];\r\n const vertCount = model.verticesCount;\r\n allModels += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n Version: ${modelVersion}\r\n ${defaultProperties}\r\n ${this._verticesIndices(model.positions, model.indices)}\r\n ${this._normalLayer(model.normals)}\r\n ${this._colorLayer(model.colors, vertCount)}\r\n ${defaultMaterialLayer}\r\n ${defaultLayerBlock}\r\n }`;\r\n }\r\n return allModels;\r\n }\r\n\r\n /**\r\n * Add Material info to result\r\n */\r\n _materials() {\r\n const materialVersion = 102;\r\n let allMaterials = '';\r\n const { materials } = this._info;\r\n for (let i = 0; i < materials.length; ++i) {\r\n const material = materials[i];\r\n allMaterials += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n Version: ${materialVersion}\r\n ShadingModel: \"lambert\"\r\n MultiLayer: 0\r\n ${this._materialProperties(material)}\r\n }`;\r\n }\r\n return allMaterials;\r\n }\r\n\r\n /**\r\n * Add Objects info to output file.\r\n */\r\n _writeObjects() {\r\n return `\r\n; Object properties\r\n;------------------------------------------------------------------\r\n\r\nObjects: {\r\n ${this._models()}\r\n ${this._materials()}\r\n ${globalSettings}\r\n}\r\n`;\r\n }\r\n\r\n /**\r\n * Add Relations info to output file.\r\n */\r\n _writeRelations() {\r\n let modelsList = '';\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Model: \"Model::${this._info.name}_${i}\", \"Mesh\" {\r\n }`;\r\n }\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Material: \"Material::${this._info.name}_${i}_default\", \"\" {\r\n }`;\r\n }\r\n\r\n return `\r\n; Object relations\r\n;------------------------------------------------------------------\r\n\r\nRelations: {\r\n ${modelsList}\r\n Model: \"Model::Producer Perspective\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Top\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Bottom\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Front\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Back\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Right\", \"Camera\" {\r\n }\r\n Model: \"Model::Producer Left\", \"Camera\" {\r\n }\r\n Model: \"Model::Camera Switcher\", \"CameraSwitcher\" {\r\n }\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Add Connections info to output file.\r\n */\r\n _writeConnections() {\r\n let modelsList = '';\r\n const { name } = this._info;\r\n for (let i = 0; i < this._info.models.length; ++i) {\r\n modelsList += `\r\n Connect: \"OO\", \"Model::${name}_${i}\", \"Model::Scene\"`;\r\n }\r\n\r\n let materialList = '';\r\n for (let i = 0; i < this._info.materials.length; ++i) {\r\n materialList += `\r\n Connect: \"OO\", \"Material::${name}_${i}_default\", \"Model::${name}_${i}\"`;\r\n }\r\n\r\n return `\r\n; Object connections\r\n;------------------------------------------------------------------\r\n\r\nConnections: {\r\n ${modelsList}\r\n ${materialList}\r\n}`;\r\n }\r\n\r\n /**\r\n * Write float array to string with limited precision\r\n * @param {Float32Array} array - array to be fixed\r\n * @returns {String} String with fixed floats\r\n */\r\n _floatArrayToString(array) {\r\n const str = [];\r\n for (let i = 0; i < array.length; ++i) {\r\n str[i] = array[i].toFixed(6);\r\n }\r\n return str.join(',');\r\n }\r\n\r\n /**\r\n * Adding color layer to resulting file\r\n * @param {Float32Array} colorArray attribute\r\n * @param {number} vertCount - number of vertices in the model\r\n * @returns {string} color layer info\r\n */\r\n _colorLayer(colorArray, vertCount) {\r\n const layerElementColorNumber = 0;\r\n const layerElementColorVersion = 101;\r\n const layerElementColorName = '';\r\n const colorsStr = this._floatArrayToString(colorArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n // As said [..Array(...)] - fastest and easiest way to produce [0, 1, .....] array\r\n const colorIndices = [...Array(vertCount).keys()];\r\n return `\r\n LayerElementColor: ${layerElementColorNumber} {\r\n Version: ${layerElementColorVersion}\r\n Name: \"${layerElementColorName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\"\r\n Colors: ${colorsStr}\r\n ColorIndex: ${colorIndices}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding normal layer to resulting file\r\n * @param {Float32Array} normalArray attribute\r\n * @returns {string} normal layer info\r\n */\r\n _normalLayer(normalArray) {\r\n const layerElementNormalNumber = 0;\r\n const layerElementNormalVersion = 101;\r\n const layerElementNormalName = '';\r\n const normalsStr = this._floatArrayToString(normalArray);\r\n // Mapping Information type and Reference Information type are mandatory for our Miew! Must not be changed\r\n return `\r\n LayerElementNormal: ${layerElementNormalNumber} {\r\n Version: ${layerElementNormalVersion}\r\n Name: \"${layerElementNormalName}\"\r\n MappingInformationType: \"ByVertice\"\r\n ReferenceInformationType: \"Direct\"\r\n Normals: ${normalsStr}\r\n }`;\r\n }\r\n\r\n /**\r\n * Adding vertices and indices to resulting string\r\n * @return {string} resulting string in FBX notation\r\n */\r\n _verticesIndices(positions, indices) {\r\n const multiLayer = 0;\r\n const multiTake = 1;\r\n const shading = 'Y';\r\n const culling = 'CullingOff';\r\n const geometryVersion = 124;\r\n const vertStr = this._floatArrayToString(positions);\r\n /* About _correctArrayNotation: Float32Arrays will contains only Float32 numbers, which implies that it will be floating points with 17 numbers after point.\r\n * We cannot (and it's logically incorrect) save all this information, so we convert this Float32Array into Array-like object with numbers with only 6 numbers after point\r\n * Reminder - this is big memory loss (as we must save at one moment two arrays with similar information) */\r\n return `MultiLayer: ${multiLayer}\r\n MultiTake: ${multiTake}\r\n Shading: ${shading}\r\n Culling: \"${culling}\"\r\n Vertices: ${vertStr}\r\n PolygonVertexIndex: ${indices}\r\n GeometryVersion: ${geometryVersion}`;\r\n }\r\n\r\n /**\r\n * Forming material properties block.\r\n * @param {Object} material - given material of model\r\n * @returns {String} material properties string\r\n */\r\n _materialProperties(material) {\r\n return `Properties60: {\r\n Property: \"ShadingModel\", \"KString\", \"\", \"Lambert\"\r\n Property: \"MultiLayer\", \"bool\", \"\",0\r\n Property: \"EmissiveColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"EmissiveFactor\", \"double\", \"\",0.0000\r\n Property: \"AmbientColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"AmbientFactor\", \"double\", \"\",0.0000\r\n Property: \"DiffuseColor\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"DiffuseFactor\", \"double\", \"\",1.0000\r\n Property: \"Bump\", \"Vector3D\", \"\",0,0,0\r\n Property: \"TransparentColor\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"TransparencyFactor\", \"double\", \"\",0.0000\r\n Property: \"SpecularColor\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"SpecularFactor\", \"double\", \"\",1.0000\r\n Property: \"ShininessExponent\", \"double\", \"\",${material.shininess}\r\n Property: \"ReflectionColor\", \"ColorRGB\", \"\",0,0,0\r\n Property: \"ReflectionFactor\", \"double\", \"\",1\r\n Property: \"Ambient\", \"ColorRGB\", \"\",1,1,1\r\n Property: \"Diffuse\", \"ColorRGB\", \"\",${material.diffuse}\r\n Property: \"Specular\", \"ColorRGB\", \"\",${material.specular}\r\n Property: \"Shininess\", \"double\", \"\",${material.shininess}\r\n Property: \"Opacity\", \"double\", \"\",${material.opacity}\r\n Property: \"Reflectivity\", \"double\", \"\",0\r\n }`;\r\n }\r\n}\r\n","import Exporter from './Exporter';\r\nimport FBXInfoExtractor from './fbx/FBXInfoExtractor';\r\nimport FBXResult from './fbx/FBXResult';\r\nimport ComplexVisual from '../../ComplexVisual';\r\n\r\nexport default class FBXExporter extends Exporter {\r\n constructor(source, options) {\r\n super(source, options);\r\n // Data\r\n this._data = source;\r\n this._version = options.miewVersion || '0.0-UNSPECIFIED';\r\n this._extractor = new FBXInfoExtractor();\r\n }\r\n\r\n /**\r\n * Entry point to exporter.\r\n */\r\n exportSync() {\r\n // Creating mandatory blocks\r\n const result = new FBXResult();\r\n if (!this._source) {\r\n return this._result;\r\n }\r\n\r\n const info = this._extractor.process(this._data);\r\n info.version = this._version;\r\n this._result = result.getResult(info);\r\n return this._result;\r\n }\r\n}\r\n\r\nFBXExporter.formats = ['fbx'];\r\nFBXExporter.SourceClass = ComplexVisual;\r\n","import ExporterList from './exporters/ExporterList';\r\n\r\nimport PDBExporter from './exporters/PDBExporter';\r\nimport FBXExporter from './exporters/FBXExporter';\r\n\r\nexport default new ExporterList([\r\n PDBExporter,\r\n FBXExporter,\r\n]);\r\n","import loaders from './loaders';\r\nimport parsers from './parsers';\r\nimport exporters from './exporters';\r\n\r\nexport default {\r\n loaders,\r\n parsers,\r\n exporters,\r\n};\r\n","/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nimport * as THREE from 'three';\r\nimport CSS2DObject from './CSS2DObject';\r\n\r\nconst tempColor = new THREE.Color();\r\n\r\nclass CSS2DRenderer {\r\n constructor() {\r\n this._width = 0;\r\n this._height = 0;\r\n this._widthHalf = 0;\r\n this._heightHalf = 0;\r\n\r\n this._vector = new THREE.Vector3();\r\n this._viewMatrix = new THREE.Matrix4();\r\n this._projectionMatrix = new THREE.Matrix4();\r\n\r\n this._domElement = document.createElement('div');\r\n this._domElement.style.overflow = 'hidden';\r\n this._domElement.style.position = 'absolute';\r\n this._domElement.style.top = '0';\r\n this._domElement.style.zIndex = '0'; // start a new Stacking Context to enclose all z-ordered children\r\n this._domElement.style.pointerEvents = 'none';\r\n }\r\n\r\n getElement() {\r\n return this._domElement;\r\n }\r\n\r\n reset() {\r\n const myNode = this.getElement();\r\n while (myNode.firstChild) {\r\n myNode.removeChild(myNode.firstChild);\r\n }\r\n }\r\n\r\n setSize(width, height) {\r\n this._width = width;\r\n this._height = height;\r\n\r\n this._widthHalf = this._width / 2;\r\n this._heightHalf = this._height / 2;\r\n\r\n this._domElement.style.width = `${width}px`;\r\n this._domElement.style.height = `${height}px`;\r\n }\r\n\r\n _renderObject(object, camera, scene) {\r\n function lerpColorAsHex(a, b, t) {\r\n tempColor.setHex(a);\r\n tempColor.lerp(b, t);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n function colorAsHex(a) {\r\n tempColor.setHex(a);\r\n return `#${tempColor.getHexString()}`;\r\n }\r\n\r\n if (object instanceof CSS2DObject) {\r\n this._vector.setFromMatrixPosition(object.matrixWorld);\r\n\r\n if (object.userData !== undefined && object.userData.offset !== undefined) {\r\n const localOffset = new THREE.Vector3(object.userData.offset.x, object.userData.offset.y, 0);\r\n this._vector.add(localOffset.multiplyScalar(object.matrixWorld.getMaxScaleOnAxis()));\r\n }\r\n\r\n this._vector.applyMatrix4(this._viewMatrix);\r\n\r\n const visibility = this._vector.z > -camera.near ? 'hidden' : 'visible';\r\n const zIndex = 10000 * (camera.far - (-this._vector.z)) / (camera.far - camera.near);\r\n\r\n const element = object.getElement();\r\n if (typeof scene.fog === 'undefined') {\r\n element.style.color = colorAsHex(object.userData.color);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = colorAsHex(object.userData.background);\r\n }\r\n } else {\r\n const fogFactor = THREE.MathUtils.smoothstep(-this._vector.z, scene.fog.near, scene.fog.far);\r\n element.style.color = lerpColorAsHex(object.userData.color, scene.fog.color, fogFactor);\r\n if (object.userData.background !== 'transparent') {\r\n element.style.background = lerpColorAsHex(object.userData.background, scene.fog.color, fogFactor);\r\n }\r\n }\r\n\r\n this._vector.applyMatrix4(this._projectionMatrix);\r\n\r\n const style = `${object.userData !== {} ? object.userData.translation : 'translate(-50%, -50%) '\r\n }translate(${this._vector.x * this._widthHalf + this._widthHalf}px,${\r\n -this._vector.y * this._heightHalf + this._heightHalf}px)`;\r\n element.style.visibility = visibility;\r\n element.style.WebkitTransform = style;\r\n element.style.MozTransform = style;\r\n element.style.oTransform = style;\r\n element.style.transform = style;\r\n element.style.zIndex = Number(zIndex).toFixed(0);\r\n\r\n if (element.parentNode !== this._domElement) {\r\n this._domElement.appendChild(element);\r\n }\r\n }\r\n\r\n for (let i = 0, l = object.children.length; i < l; i++) {\r\n this._renderObject(object.children[i], camera, scene);\r\n }\r\n }\r\n\r\n render(scene, camera) {\r\n scene.updateMatrixWorld();\r\n\r\n if (camera.parent === null) {\r\n camera.updateMatrixWorld();\r\n }\r\n\r\n camera.matrixWorldInverse.copy(camera.matrixWorld).invert();\r\n\r\n this._viewMatrix.copy(camera.matrixWorldInverse);\r\n this._projectionMatrix.copy(camera.projectionMatrix);\r\n\r\n this._renderObject(scene, camera, scene);\r\n }\r\n}\r\nexport default CSS2DRenderer;\r\n","export default function getTopWindow() {\r\n // intercept the exception if we have cross-origin iframe\r\n try {\r\n if (window.top.location.href !== undefined) {\r\n return window.top;\r\n }\r\n } catch (e) {\r\n // provide fallback\r\n }\r\n return window;\r\n}\r\n","import * as THREE from 'three';\r\nimport Timer from '../Timer';\r\nimport settings from '../settings';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\nimport getTopWindow from '../utils/getTopWindow';\r\n\r\nconst VK_LEFT = 37;\r\nconst VK_UP = 38;\r\nconst VK_RIGHT = 39;\r\nconst VK_DOWN = 40;\r\n\r\nconst STATE = {\r\n NONE: -1, ROTATE: 0, TRANSLATE: 1, SCALE: 2, TRANSLATE_PIVOT: 3,\r\n};\r\n\r\n// pausing for this amount of time before releasing mouse button prevents inertial rotation (seconds)\r\nconst FULL_STOP_THRESHOLD = 0.1;\r\n\r\nconst quaternion = new THREE.Quaternion();\r\nconst matrix4 = new THREE.Matrix4();\r\n\r\n// pivot -- local offset of the rotation pivot point\r\nfunction ObjectHandler(objects, camera, pivot, options) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n this.camera = camera;\r\n this.pivot = pivot;\r\n this.axis = new THREE.Vector3(0, 0, 1);\r\n this.options = options;\r\n\r\n this.lastRotation = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n}\r\n\r\nObjectHandler.prototype._rotate = (function () {\r\n const p = new THREE.Vector3();\r\n const q = new THREE.Quaternion();\r\n const s = new THREE.Vector3();\r\n\r\n const m = new THREE.Matrix4();\r\n\r\n return function (quat) {\r\n const zeroPivot = (this.pivot.x === 0.0 && this.pivot.y === 0.0 && this.pivot.z === 0.0);\r\n\r\n m.copy(this.object.matrix);\r\n\r\n if (zeroPivot) {\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n } else {\r\n m.multiply(matrix4.makeTranslation(this.pivot.x, this.pivot.y, this.pivot.z));\r\n m.multiply(matrix4.makeRotationFromQuaternion(quat));\r\n m.multiply(matrix4.makeTranslation(-this.pivot.x, -this.pivot.y, -this.pivot.z));\r\n }\r\n\r\n m.decompose(p, q, s);\r\n\r\n // update objects\r\n if (!zeroPivot) {\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].position.copy(p);\r\n }\r\n }\r\n\r\n for (let j = 0; j < this.objects.length; ++j) {\r\n this.objects[j].quaternion.copy(q);\r\n this.objects[j].updateMatrix();\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.setObjects = function (objects) {\r\n this.objects = objects;\r\n [this.object] = objects;\r\n};\r\n\r\nObjectHandler.prototype.rotate = (function () {\r\n const rot = {\r\n axis: new THREE.Vector3(),\r\n angle: 0.0,\r\n };\r\n\r\n return function (quat, mousePrevPos, mouseCurPos, aboutAxis) {\r\n this.mouse2rotation(rot, mousePrevPos, mouseCurPos, aboutAxis);\r\n quat.setFromAxisAngle(rot.axis, rot.angle);\r\n\r\n if (rot.angle) {\r\n this._rotate(quat);\r\n }\r\n\r\n this.lastRotation = rot;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.translate = (function () {\r\n const dir = new THREE.Vector3();\r\n const pivot = new THREE.Vector3();\r\n\r\n return function (delta) {\r\n // reverse-project viewport movement to view coords (compensate for screen aspect ratio)\r\n dir.set(\r\n delta.x / this.camera.projectionMatrix.elements[0],\r\n delta.y / this.camera.projectionMatrix.elements[5],\r\n 0,\r\n );\r\n let dist = dir.length();\r\n dir.normalize();\r\n\r\n // transform movement direction to object local coords\r\n dir.transformDirection(matrix4.copy(this.object.matrixWorld).invert());\r\n\r\n // visible translate distance shouldn't depend on camera-to-object distance\r\n pivot.copy(this.pivot);\r\n this.object.localToWorld(pivot);\r\n dist *= Math.abs(pivot.z - this.camera.position.z);\r\n\r\n // visible translate distance shouldn't depend on object scale\r\n dist /= this.object.matrixWorld.getMaxScaleOnAxis();\r\n\r\n // all objects are translated similar to principal object\r\n // (we assume they all have identical pivot and scale)\r\n for (let i = 0; i < this.objects.length; ++i) {\r\n this.objects[i].translateOnAxis(dir, dist);\r\n }\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.update = (function () {\r\n const axis = new THREE.Vector3();\r\n\r\n return function (timeSinceLastUpdate, timeSinceMove) {\r\n if (settings.now.autoRotation !== 0.0) {\r\n // auto-rotation with constant speed\r\n\r\n // if rotation axis is fixed or hasn't been defined yet\r\n if (settings.now.autoRotationAxisFixed || this.lastRotation.axis.length() === 0.0) {\r\n // use Y-axis (transformed to local object coords)\r\n axis.set(0, 1, 0).transformDirection(matrix4.copy(this.object.matrixWorld).invert());\r\n } else {\r\n // use axis defined by last user rotation\r\n axis.copy(this.lastRotation.axis);\r\n }\r\n\r\n this._rotate(quaternion.setFromAxisAngle(axis, settings.now.autoRotation * timeSinceLastUpdate));\r\n return true;\r\n }\r\n\r\n if (this.options.intertia && this.lastRotation.angle) {\r\n // inertial object rotation\r\n const angle = this.lastRotation.angle * ((1.0 - this.options.dynamicDampingFactor) ** (40.0 * timeSinceMove));\r\n\r\n if (Math.abs(angle) <= this.options.intertiaThreshold) {\r\n this.lastRotation.angle = 0.0;\r\n } else {\r\n this._rotate(quaternion.setFromAxisAngle(this.lastRotation.axis, angle));\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n}());\r\n\r\nObjectHandler.prototype.stop = function () {\r\n this.lastRotation.angle = 0.0;\r\n};\r\n\r\n// calculate (axis, angle) pair from mouse/touch movement\r\nObjectHandler.prototype.mouse2rotation = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n const eye = new THREE.Vector3();\r\n const eyeDirection = new THREE.Vector3();\r\n\r\n const cameraUpDirection = new THREE.Vector3();\r\n const cameraSidewaysDirection = new THREE.Vector3();\r\n\r\n const moveDirection = new THREE.Vector3();\r\n\r\n const mouseDelta = new THREE.Vector2();\r\n\r\n return function (rot, mousePrev, mouseCur, aboutAxis) {\r\n if (aboutAxis) {\r\n rot.axis.copy(this.axis);\r\n rot.angle = this.options.axisRotateFactor * (mouseCur.y - mousePrev.y);\r\n\r\n /* cool method that allows rotation around Z axis to be \"tied\" to mouse cursor\r\n\r\n res.axis.copy(this.axis);\r\n\r\n var pivot = this.pivot.clone();\r\n this.object.localToWorld(pivot);\r\n pivot.project(this.camera);\r\n\r\n var v1 = new THREE.Vector3(mousePrev.x, mousePrev.y, this.camera.position.z);\r\n v1.sub(pivot);\r\n var v2 = new THREE.Vector3(mouseCur.x, mouseCur.y, this.camera.position.z);\r\n v2.sub(pivot);\r\n\r\n v1.sub(res.axis.clone().multiplyScalar(v1.dot(res.axis)));\r\n v2.sub(res.axis.clone().multiplyScalar(v2.dot(res.axis)));\r\n\r\n var abs = v1.length() * v2.length();\r\n if (abs > 0) {\r\n res.angle = res.axis.dot(v1.cross(v2)) / abs;\r\n }\r\n */\r\n } else {\r\n mouseDelta.subVectors(mouseCur, mousePrev);\r\n const angle = mouseDelta.length();\r\n if (angle === 0.0) {\r\n return;\r\n }\r\n\r\n center.copy(this.pivot);\r\n this.object.localToWorld(center);\r\n eye.subVectors(this.camera.position, center);\r\n eyeDirection.copy(eye).normalize();\r\n\r\n cameraUpDirection.copy(this.camera.up).normalize();\r\n cameraSidewaysDirection.crossVectors(cameraUpDirection, eyeDirection).normalize();\r\n\r\n cameraUpDirection.setLength(mouseDelta.y);\r\n cameraSidewaysDirection.setLength(mouseDelta.x);\r\n\r\n moveDirection.copy(cameraUpDirection.add(cameraSidewaysDirection));\r\n\r\n rot.axis.crossVectors(moveDirection, eye);\r\n\r\n rot.angle = -angle * this.options.rotateFactor;\r\n }\r\n\r\n rot.axis.transformDirection(matrix4.copy(this.object.matrixWorld).invert());\r\n\r\n // make sure angle is always positive (thus 'axis' defines both axis and direction of rotation)\r\n if (rot.angle < 0.0) {\r\n rot.axis.negate();\r\n rot.angle = -rot.angle;\r\n }\r\n };\r\n}());\r\n\r\nfunction ObjectControls(object, objectPivot, camera, domElement, getAltObj) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.object = object;\r\n this.objectPivot = objectPivot;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.getAltObj = getAltObj;\r\n\r\n // API\r\n\r\n this.enabled = true;\r\n this.hotkeysEnabled = true;\r\n\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n\r\n this.options = {\r\n rotateFactor: Math.PI, // full screen slide (along short side) would roughly mean 180 deg. rotation\r\n axisRotateFactor: 4 * Math.PI, // full screen slide (along short side) would roughly mean 720 deg. rotation\r\n intertia: true,\r\n dynamicDampingFactor: 0.1,\r\n intertiaThreshold: 1e-3,\r\n };\r\n\r\n // internals\r\n\r\n this._state = STATE.NONE;\r\n\r\n this._mousePrevPos = new THREE.Vector2();\r\n this._mouseCurPos = new THREE.Vector2();\r\n\r\n this._mainObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._altObj = new ObjectHandler([this.object], this.camera, new THREE.Vector3(0, 0, 0), this.options);\r\n this._affectedObj = this._mainObj;\r\n this._isAltObjFreeRotationAllowed = true;\r\n this._isTranslationAllowed = true;\r\n this._isKeysTranslatingObj = false;\r\n\r\n this._pressedKeys = [];\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n this._lastUpdateTime = this._clock.getElapsedTime();\r\n\r\n // events\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousewheel',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'DOMMouseScroll',\r\n handler(e) {\r\n self.mousewheel(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseout',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchstartend(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchmove',\r\n handler(e) {\r\n self.touchmove(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keydown',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: self.getKeyBindObject(),\r\n type: 'keyup',\r\n handler(e) {\r\n self.keydownup(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'blur',\r\n handler() {\r\n self.resetKeys();\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'contextmenu',\r\n handler(e) {\r\n self.contextmenu(e);\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n\r\n this.resetKeys();\r\n\r\n // force an update at start\r\n this.update();\r\n}\r\n\r\n// methods\r\n\r\nObjectControls.prototype = Object.create(EventDispatcher.prototype);\r\nObjectControls.prototype.constructor = ObjectControls;\r\n\r\nObjectControls.prototype.resetKeys = function () {\r\n this._pressedKeys[VK_LEFT] = false;\r\n this._pressedKeys[VK_UP] = false;\r\n this._pressedKeys[VK_RIGHT] = false;\r\n this._pressedKeys[VK_DOWN] = false;\r\n};\r\n\r\nObjectControls.prototype.contextmenu = function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n};\r\n\r\nObjectControls.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nObjectControls.prototype.enable = function (enable) {\r\n this.enabled = enable;\r\n};\r\n\r\nObjectControls.prototype.enableHotkeys = function (enable) {\r\n this.hotkeysEnabled = enable;\r\n};\r\n\r\nObjectControls.prototype.allowTranslation = function (allow) {\r\n this._isTranslationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.allowAltObjFreeRotation = function (allow) {\r\n this._isAltObjFreeRotationAllowed = allow;\r\n};\r\n\r\nObjectControls.prototype.keysTranslateObj = function (on) {\r\n this._isKeysTranslatingObj = on;\r\n};\r\n\r\nObjectControls.prototype.isEditingAltObj = function () {\r\n return ((this._state === STATE.ROTATE) || (this._state === STATE.TRANSLATE))\r\n && (this._affectedObj === this._altObj);\r\n};\r\n\r\n// convert page coords of mouse/touch to uniform coords with smaller side being [-0.5, 0.5]\r\n// (uniform coords keep direct proportion with screen distance travelled by mouse regardless of screen aspect ratio)\r\nObjectControls.prototype.convertMouseToOnCircle = function (coords, pageX, pageY) {\r\n const screenSize = Math.min(this.screen.width, this.screen.height);\r\n\r\n if (screenSize === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n ((pageX - this.screen.width * 0.5 - this.screen.left) / screenSize),\r\n ((0.5 * this.screen.height + this.screen.top - pageY) / screenSize),\r\n );\r\n};\r\n\r\n// convert page coords of mouse/touch to viewport coords with both sides being [-1, 1]\r\n// (those are non-uniform coords affected by screen aspect ratio)\r\nObjectControls.prototype.convertMouseToViewport = function (coords, pageX, pageY) {\r\n if (this.screen.width === 0 || this.screen.height === 0) {\r\n coords.set(0, 0);\r\n return;\r\n }\r\n\r\n coords.set(\r\n (2.0 * (pageX - this.screen.width * 0.5 - this.screen.left) / this.screen.width),\r\n (2.0 * (0.5 * this.screen.height + this.screen.top - pageY) / this.screen.height),\r\n );\r\n};\r\n\r\nObjectControls.prototype.stop = function () {\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n};\r\n\r\n// rotate object based on latest mouse/touch movement\r\nObjectControls.prototype.rotateByMouse = (function () {\r\n const quat = new THREE.Quaternion();\r\n\r\n return function (aboutZAxis) {\r\n this._affectedObj.rotate(quat, this._mousePrevPos, this._mouseCurPos, aboutZAxis);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n };\r\n}());\r\n\r\n// rotate object by specified quaternion\r\nObjectControls.prototype.rotate = function (quat) {\r\n this.object.quaternion.multiply(quat);\r\n this.dispatchEvent({ type: 'change', action: 'rotate', quaternion: quat });\r\n};\r\n\r\n// get object's orientation\r\nObjectControls.prototype.getOrientation = function () {\r\n return this.object.quaternion;\r\n};\r\n\r\n// set object's orientation\r\nObjectControls.prototype.setOrientation = function (quat) {\r\n this.object.quaternion.copy(quat);\r\n};\r\n\r\n// translate object based on latest mouse/touch movement\r\nObjectControls.prototype.translate = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this._affectedObj.translate(delta);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n };\r\n}());\r\n\r\n// get object scale\r\nObjectControls.prototype.getScale = function () {\r\n return this.object.scale.x;\r\n};\r\n\r\n// set uniform object scale\r\nObjectControls.prototype.setScale = function (scale) {\r\n this.object.scale.set(scale, scale, scale);\r\n};\r\n\r\n// scale object by factor (factor should be greater than zero)\r\nObjectControls.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n return;\r\n }\r\n this.setScale(this.object.scale.x * factor);\r\n this.dispatchEvent({ type: 'change', action: 'zoom', factor });\r\n};\r\n\r\nObjectControls.prototype.update = (function () {\r\n const shift = new THREE.Vector2();\r\n\r\n return function () {\r\n const curTime = this._clock.getElapsedTime();\r\n const timeSinceLastUpdate = curTime - this._lastUpdateTime;\r\n\r\n // update object handler\r\n if (this._state === STATE.NONE) {\r\n const timeSinceMove = curTime - this._lastMouseMoveTime;\r\n if (this._mainObj.update(timeSinceLastUpdate, timeSinceMove)\r\n || this._altObj.update(timeSinceLastUpdate, timeSinceMove)) {\r\n this.dispatchEvent({ type: 'change', action: 'auto' });\r\n }\r\n }\r\n\r\n // apply arrow keys\r\n if (this._isKeysTranslatingObj) {\r\n const speedX = Number(this._pressedKeys[VK_RIGHT]) - Number(this._pressedKeys[VK_LEFT]);\r\n const speedY = Number(this._pressedKeys[VK_UP]) - Number(this._pressedKeys[VK_DOWN]);\r\n if (speedX !== 0.0 || speedY !== 0.0) {\r\n const delta = timeSinceLastUpdate;\r\n\r\n // update object translation\r\n const altObj = this.getAltObj();\r\n if (altObj.objects.length > 0) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n\r\n shift.set(delta * speedX, delta * speedY);\r\n this._altObj.translate(shift);\r\n this.dispatchEvent({ type: 'change', action: 'translate' });\r\n }\r\n }\r\n }\r\n\r\n this._lastUpdateTime = curTime;\r\n };\r\n}());\r\n\r\nObjectControls.prototype.reset = function () {\r\n this._state = STATE.NONE;\r\n\r\n this.object.quaternion.copy(quaternion.set(0, 0, 0, 1));\r\n};\r\n\r\n// listeners\r\n\r\nObjectControls.prototype.mousedown = function (event) {\r\n if (this.enabled === false || this._state !== STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (this._state === STATE.NONE) {\r\n if (event.button === 0) {\r\n this._affectedObj.stop(); // can edit only one object at a time\r\n\r\n let workWithAltObj = false;\r\n\r\n if (event.altKey) {\r\n const altObj = this.getAltObj();\r\n workWithAltObj = (altObj.objects.length > 0);\r\n if (workWithAltObj) {\r\n this._altObj.setObjects(altObj.objects);\r\n this._altObj.pivot = altObj.pivot;\r\n\r\n if ('axis' in altObj) {\r\n this._altObj.axis = altObj.axis.clone();\r\n } else {\r\n this._altObj.axis.set(0, 0, 1);\r\n }\r\n }\r\n }\r\n\r\n this._affectedObj = workWithAltObj ? this._altObj : this._mainObj;\r\n\r\n this._state = (workWithAltObj && event.ctrlKey && this._isTranslationAllowed) ? STATE.TRANSLATE : STATE.ROTATE;\r\n } else if (event.button === 2) {\r\n this._state = STATE.TRANSLATE_PIVOT;\r\n }\r\n }\r\n\r\n if (this._state === STATE.ROTATE) {\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n\r\n if (this._state === STATE.TRANSLATE || this._state === STATE.TRANSLATE_PIVOT) {\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousemove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.pageX, event.pageY);\r\n this.rotateByMouse((event.altKey && !this._isAltObjFreeRotationAllowed) || event.shiftKey);\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.TRANSLATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translate();\r\n break;\r\n\r\n case STATE.TRANSLATE_PIVOT:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToViewport(this._mouseCurPos, event.pageX, event.pageY);\r\n this.translatePivotByMouse();\r\n break;\r\n\r\n default: break;\r\n }\r\n};\r\n\r\nObjectControls.prototype.mousewheel = function (event) {\r\n if (this.enabled === false || !settings.now.zooming || this._state !== STATE.NONE || event.shiftKey) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n let delta = 0;\r\n\r\n if (event.wheelDelta) {\r\n // WebKit / Opera / Explorer 9\r\n delta = event.wheelDelta / 40;\r\n } else if (event.detail) {\r\n // Firefox\r\n delta = -event.detail / 3;\r\n }\r\n\r\n let factor = 1.0 + delta * 0.05;\r\n factor = Math.max(factor, 0.01);\r\n this.scale(factor);\r\n};\r\n\r\nObjectControls.prototype.mouseup = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n this._state = STATE.NONE;\r\n\r\n if (this._clock.getElapsedTime() - this._lastMouseMoveTime > FULL_STOP_THRESHOLD) {\r\n this._affectedObj.stop();\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchstartend = function (event) {\r\n if (this.enabled === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (event.touches.length) {\r\n case 1:\r\n this._state = STATE.ROTATE;\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n break;\r\n\r\n case 2: {\r\n // prevent inertial rotation\r\n this._mainObj.stop();\r\n this._altObj.stop();\r\n\r\n this._state = STATE.SCALE;\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = this._touchDistanceStart = Math.sqrt(dx * dx + dy * dy);\r\n this._scaleStart = this.object.scale.x;\r\n break;\r\n }\r\n\r\n default:\r\n this._state = STATE.NONE;\r\n }\r\n};\r\n\r\nObjectControls.prototype.touchmove = function (event) {\r\n if (this.enabled === false || this._state === STATE.NONE) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n switch (this._state) {\r\n case STATE.ROTATE:\r\n this._mousePrevPos.copy(this._mouseCurPos);\r\n this.convertMouseToOnCircle(this._mouseCurPos, event.touches[0].pageX, event.touches[0].pageY);\r\n this.rotateByMouse(false);\r\n\r\n this._lastMouseMoveTime = this._clock.getElapsedTime();\r\n break;\r\n\r\n case STATE.SCALE:\r\n if (settings.now.zooming) {\r\n // update scale\r\n const dx = event.touches[0].pageX - event.touches[1].pageX;\r\n const dy = event.touches[0].pageY - event.touches[1].pageY;\r\n this._touchDistanceCur = Math.sqrt(dx * dx + dy * dy);\r\n const newScale = this._scaleStart * this._touchDistanceCur / this._touchDistanceStart;\r\n const factor = newScale / this.object.scale.x;\r\n this.scale(factor);\r\n }\r\n break;\r\n\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.keydownup = function (event) {\r\n if (this.enabled === false || this.hotkeysEnabled === false) {\r\n return;\r\n }\r\n\r\n switch (event.keyCode) {\r\n case VK_LEFT:\r\n case VK_UP:\r\n case VK_RIGHT:\r\n case VK_DOWN:\r\n this._pressedKeys[event.keyCode] = (event.type === 'keydown');\r\n event.preventDefault();\r\n event.stopPropagation();\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nObjectControls.prototype.getKeyBindObject = function () {\r\n return getTopWindow();\r\n};\r\n\r\nObjectControls.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nObjectControls.prototype.translatePivotByMouse = (function () {\r\n const delta = new THREE.Vector2();\r\n return function () {\r\n delta.subVectors(this._mouseCurPos, this._mousePrevPos);\r\n this.translatePivotInWorld(settings.now.translationSpeed * delta.x, settings.now.translationSpeed * delta.y, 0);\r\n };\r\n}());\r\n\r\n// Translate in WorldCS, translation is scaled with root scale matrix\r\nObjectControls.prototype.translatePivotInWorld = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.applyMatrix4(this.object.matrixWorld);\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n pos.applyMatrix4(matrix4.copy(this.object.matrixWorld).invert());\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Translate in ModelCS, x, y, z are Ang\r\nObjectControls.prototype.translatePivot = function (x, y, z) {\r\n const pos = this.objectPivot.position;\r\n pos.setX(pos.x + x);\r\n pos.setY(pos.y + y);\r\n pos.setZ(pos.z + z);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\n// Set pivot\r\nObjectControls.prototype.setPivot = function (newPivot) {\r\n this.objectPivot.position.copy(newPivot);\r\n\r\n this.dispatchEvent({ type: 'change', action: 'translatePivot' });\r\n};\r\n\r\nexport default ObjectControls;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\nimport Timer from '../Timer';\r\nimport EventDispatcher from '../utils/EventDispatcher';\r\n\r\nfunction Picker(gfxObj, camera, domElement) {\r\n EventDispatcher.call(this);\r\n const self = this;\r\n\r\n this.gfxObj = gfxObj;\r\n this.camera = camera;\r\n this.domElement = (typeof domElement !== 'undefined') ? domElement : document;\r\n this.screen = {\r\n left: 0, top: 0, width: 0, height: 0,\r\n };\r\n this._lastMousePos = new THREE.Vector2(0, 0);\r\n this._mouseTotalDist = 0.0;\r\n this._lastClickBeginTime = -1000.0;\r\n this._lastClickPos = new THREE.Vector2(0, 0);\r\n this._clickBeginTime = 0.0;\r\n\r\n this._clock = new Timer();\r\n this._clock.start();\r\n\r\n this._listeners = [\r\n {\r\n obj: self.domElement,\r\n type: 'mousedown',\r\n handler(e) {\r\n self.mousedown(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mouseup',\r\n handler(e) {\r\n self.mouseup(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'mousemove',\r\n handler(e) {\r\n self.mousemove(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchstart',\r\n handler(e) {\r\n self.touchstart(e);\r\n },\r\n },\r\n {\r\n obj: self.domElement,\r\n type: 'touchend',\r\n handler(e) {\r\n self.touchend(e);\r\n },\r\n },\r\n {\r\n obj: window,\r\n type: 'resize',\r\n handler() {\r\n self.handleResize();\r\n },\r\n }];\r\n\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.addEventListener(l.type, l.handler);\r\n }\r\n\r\n this.handleResize();\r\n}\r\n\r\nPicker.prototype = Object.create(EventDispatcher.prototype);\r\nPicker.prototype.constructor = Picker;\r\n\r\nPicker.prototype.reset = function () {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n};\r\n\r\nPicker.prototype.handleResize = function () {\r\n if (this.domElement === document) {\r\n this.screen.left = 0;\r\n this.screen.top = 0;\r\n this.screen.width = window.innerWidth;\r\n this.screen.height = window.innerHeight;\r\n } else {\r\n const box = this.domElement.getBoundingClientRect();\r\n // adjustments come from similar code in the jquery offset() function\r\n const d = this.domElement.ownerDocument.documentElement;\r\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\r\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\r\n this.screen.width = box.width;\r\n this.screen.height = box.height;\r\n }\r\n};\r\n\r\nPicker.prototype.pickObject = function (screenPos) {\r\n if (!this.gfxObj) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n const { gfxObj } = this;\r\n const rayCaster = new THREE.Raycaster();\r\n rayCaster.ray.origin.setFromMatrixPosition(this.camera.matrixWorld);\r\n rayCaster.ray.direction.set(screenPos.x, screenPos.y, 0.5).unproject(this.camera).sub(rayCaster.ray.origin).normalize();\r\n\r\n const clipPlane = (settings.now.draft.clipPlane && this.clipPlaneValue) ? this.clipPlaneValue : Infinity;\r\n const fogFarPlane = (settings.now.fog && this.fogFarValue) ? this.fogFarValue : Infinity;\r\n const point = rayCaster.intersectVisibleObject(gfxObj, this.camera, clipPlane, fogFarPlane);\r\n if (!point) {\r\n this.picked = {};\r\n this.dispatchEvent({ type: 'newpick', obj: {} });\r\n return;\r\n }\r\n\r\n let picked = {};\r\n if (point.residue || point.atom) {\r\n const residue = point.residue || point.atom.residue;\r\n if (settings.now.pick === 'chain') {\r\n picked = { chain: residue.getChain() };\r\n } else if (settings.now.pick === 'molecule') {\r\n picked = { molecule: residue.getMolecule() };\r\n } else if (point.residue || settings.now.pick === 'residue') {\r\n picked = { residue };\r\n } else if (point.atom) {\r\n picked = { atom: point.atom };\r\n }\r\n }\r\n this.picked = picked;\r\n this.dispatchEvent({ type: 'newpick', obj: picked });\r\n};\r\n\r\nPicker.prototype.getMouseInViewport = function (pageX, pageY) {\r\n return new THREE.Vector2(\r\n (pageX - this.screen.left) / this.screen.width * 2 - 1,\r\n -(pageY - this.screen.top) / this.screen.height * 2 + 1,\r\n );\r\n};\r\n\r\nPicker.prototype.mousedown = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n this._lastMousePos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist = 0.0;\r\n this._clickBeginTime = this._clock.getElapsedTime();\r\n }\r\n};\r\n\r\nPicker.prototype.mousemove = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n const pos = this.getMouseInViewport(event.pageX, event.pageY);\r\n this._mouseTotalDist += pos.sub(this._lastMousePos).length();\r\n};\r\n\r\nPicker.prototype.mouseup = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.button === 0) {\r\n if (this._mouseTotalDist < 0.01) {\r\n const curTime = this._clock.getElapsedTime();\r\n const curPos = this.getMouseInViewport(event.pageX, event.pageY);\r\n\r\n const timeSinceLastClickBegin = curTime - this._lastClickBeginTime;\r\n if (timeSinceLastClickBegin < 0.7) {\r\n const clickDist = new THREE.Vector2().subVectors(curPos, this._lastClickPos);\r\n if (clickDist.length() < 0.01) {\r\n // it's a double click\r\n this.dispatchEvent({ type: 'dblclick', obj: this.picked });\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = -1000; // this click cannot serve as first click in double-click\r\n return;\r\n }\r\n }\r\n\r\n setTimeout(() => {\r\n self.pickObject(curPos);\r\n }, 0);\r\n\r\n this._lastClickPos = curPos;\r\n this._lastClickBeginTime = this._clickBeginTime;\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.touchstart = function (event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 1) {\r\n this._lastTouchdownPos = this.getMouseInViewport(event.touches[0].pageX, event.touches[0].pageY);\r\n }\r\n};\r\n\r\nPicker.prototype.touchend = function (event) {\r\n const self = this;\r\n\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (event.touches.length === 0\r\n && event.changedTouches.length === 1) {\r\n const pos = this.getMouseInViewport(event.changedTouches[0].pageX, event.changedTouches[0].pageY);\r\n const dist = pos.sub(this._lastTouchdownPos).length();\r\n if (dist < 0.01) {\r\n setTimeout(() => {\r\n self.pickObject(self._lastTouchdownPos);\r\n }, 0);\r\n }\r\n }\r\n};\r\n\r\nPicker.prototype.dispose = function () {\r\n for (let i = 0; i < this._listeners.length; i++) {\r\n const l = this._listeners[i];\r\n l.obj.removeEventListener(l.type, l.handler);\r\n }\r\n};\r\n\r\nexport default Picker;\r\n","import * as THREE from 'three';\r\n\r\nclass Axes {\r\n constructor(target, targetCamera) {\r\n this._target = target;\r\n this._targetCamera = targetCamera;\r\n this._camera = new THREE.PerspectiveCamera(targetCamera.fov, targetCamera.aspect, 1, 100);\r\n this._object = new THREE.AxesHelper(1);\r\n this._scene = new THREE.Scene();\r\n this._scene.add(this._object);\r\n this._full = new THREE.Vector2();\r\n\r\n this._update();\r\n }\r\n\r\n _update() {\r\n const { fov } = this._targetCamera;\r\n const camera = this._camera;\r\n camera.aspect = this._targetCamera.aspect;\r\n camera.setMinimalFov(fov);\r\n camera.setDistanceToFit(1.0, fov);\r\n camera.updateProjectionMatrix();\r\n\r\n this._object.quaternion.copy(this._target.quaternion);\r\n }\r\n\r\n render(renderer) {\r\n this._update();\r\n\r\n renderer.getSize(this._full);\r\n const width = this._full.width * 0.25;\r\n const height = this._full.height * 0.25;\r\n\r\n const { autoClear } = renderer;\r\n renderer.autoClear = false;\r\n renderer.setViewport(0.0, 0.0, width, height);\r\n renderer.clear(false, true, false);\r\n renderer.render(this._scene, this._camera);\r\n renderer.setViewport(0, 0, this._full.width, this._full.height);\r\n renderer.autoClear = autoClear;\r\n }\r\n}\r\nexport default Axes;\r\n","import * as THREE from 'three';\r\nimport SecondaryStructureColorer from './colorers/SecondaryStructureColorer';\r\n\r\nconst cDataOffset = 12;\r\nconst cFirstMask = 0x0FFFFF00;\r\nconst cFirstShift = 8;\r\nconst cSecMask1 = 0x000000FF;\r\nconst cSecShift1 = 12;\r\nconst cSecMask2 = 0xFFF00000;\r\nconst cSecShift2 = 20;\r\nconst cThirdMask = 0x000FFFFF;\r\nconst cStrMask = 0xF0000000;\r\nconst cStrShift = 28;\r\nconst c219 = 1 << 19;\r\nconst c220 = 1 << 20;\r\n\r\nconst cHelixIdx = 1;\r\nconst cSheetIdx = 2;\r\nconst secTypes = ['helix', 'strand'];\r\nconst cSecNames = ['fs', 'ps', 'ns', 'us'];\r\n\r\nfunction _createSecondary(strArray, complex) {\r\n const residues = complex._residues;\r\n const nRes = residues.length;\r\n const resid = new Uint8Array(nRes);\r\n\r\n const atoms = complex._atoms;\r\n for (let i = 0, n = strArray.length; i < n; ++i) {\r\n const atom = atoms[i];\r\n resid[atom.residue._index] = strArray[i];\r\n }\r\n\r\n const secondary = [];\r\n let rIdx = 0;\r\n while (rIdx < nRes) {\r\n if (resid[rIdx] !== 0) {\r\n const start = rIdx;\r\n const val = resid[rIdx];\r\n while (rIdx < nRes - 1 && resid[rIdx + 1] === val\r\n && residues[rIdx].isConnected(residues[rIdx + 1])) {\r\n ++rIdx;\r\n }\r\n secondary.push({ start, end: rIdx, type: secTypes[val - 1] });\r\n }\r\n ++rIdx;\r\n }\r\n return secondary;\r\n}\r\n\r\nfunction fromUInt20ToInt20(uint20) {\r\n return uint20 >= c219 ? uint20 - c220 : uint20;\r\n}\r\n\r\nclass FrameInfo {\r\n constructor(complex, payload, callbacks) {\r\n this._complex = complex;\r\n this._secondary = null;\r\n this.isLoading = false;\r\n this._framesRange = {\r\n start: 0,\r\n end: -1,\r\n };\r\n this.frameIsReady = false;\r\n this._buffer = null;\r\n this._frameRequest = null;\r\n this._callbacks = callbacks;\r\n if (typeof payload === 'function') {\r\n this._framesRequestLength = 1;\r\n this._downloadDataFn = payload;\r\n } else {\r\n this.parseBinaryData(payload, true);\r\n }\r\n this.reset();\r\n this.setFrame(0);\r\n }\r\n\r\n _prepareBuffer(framesStart, framesEnd) {\r\n if (framesStart === undefined || framesStart === null) {\r\n framesStart = 0;\r\n }\r\n if (framesEnd === undefined || framesEnd === null) {\r\n framesEnd = framesStart + this._framesRequestLength;\r\n }\r\n if (this._framesCount !== undefined) {\r\n framesEnd = Math.min(this._framesCount - 1, framesEnd);\r\n }\r\n if (this._downloadDataFn) {\r\n const self = this;\r\n const onDone = function (data) {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n self._buffer = {\r\n data,\r\n state: 'ready',\r\n start: framesStart,\r\n end: framesEnd,\r\n };\r\n if (self._frameRequest !== null) {\r\n const idx = self._frameRequest;\r\n self._frameRequest = null;\r\n self.setFrame(idx);\r\n }\r\n };\r\n const onFail = function () {\r\n self.isLoading = false;\r\n if (self._callbacks && typeof self._callbacks.onError === 'function') {\r\n self._callbacks.onError('Streaming failed');\r\n }\r\n };\r\n if (!this._buffer) {\r\n this._buffer = {};\r\n }\r\n this._buffer.state = 'downloading';\r\n this.isLoading = true;\r\n if (self._callbacks && typeof self._callbacks.onLoadStatusChanged === 'function') {\r\n self._callbacks.onLoadStatusChanged();\r\n }\r\n this._downloadDataFn({ start: framesStart, end: framesEnd + 1 }, onDone, onFail);\r\n }\r\n }\r\n\r\n _parseBuffer() {\r\n if (this._buffer && this._buffer.state === 'ready') {\r\n this._framesRange = {\r\n start: this._buffer.start,\r\n end: this._buffer.end,\r\n };\r\n this.parseBinaryData(this._buffer.data, false);\r\n let _bufferRequestStart = (this._buffer.end + 1) % this._framesCount;\r\n if (_bufferRequestStart >= this._framesCount) {\r\n _bufferRequestStart = 0;\r\n }\r\n this._buffer = {\r\n state: 'none',\r\n };\r\n this._prepareBuffer(_bufferRequestStart, _bufferRequestStart + this._framesRequestLength);\r\n if (this._frameRequest !== null) {\r\n const idx = this._frameRequest;\r\n this._frameRequest = null;\r\n this.setFrame(idx);\r\n }\r\n }\r\n }\r\n\r\n parseBinaryData(arrayBuffer) {\r\n const dataView = new DataView(arrayBuffer);\r\n let offset = 0;\r\n const atomsCount = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const framesCount = dataView.getUint32(offset, true);\r\n this._framesCount = framesCount;\r\n this._framesRange.end = this._framesRange.end > 0\r\n ? Math.min(this._framesRange.end, framesCount - 1) : framesCount - 1;\r\n offset += 4;\r\n this._atomsCount = atomsCount;\r\n const maxSize = 1024 * 1024; // 1 MB\r\n this._framesRequestLength = Math.ceil(maxSize / (atomsCount * 8));\r\n const chunkedFramesCount = this._framesRange.end - this._framesRange.start + 1;\r\n if (atomsCount !== this._complex._atoms.length\r\n || arrayBuffer.byteLength !== cDataOffset + chunkedFramesCount * atomsCount * 8) {\r\n throw new Error();\r\n }\r\n const complex = this._complex;\r\n let timeStep = dataView.getUint32(offset, true);\r\n let iName = 0;\r\n while (timeStep > 1000 && iName < cSecNames.length - 1) {\r\n timeStep /= 1000;\r\n ++iName;\r\n }\r\n\r\n this._timeStep = `${timeStep.toString()} ${cSecNames[iName]}`;\r\n offset += 4;\r\n const secondary = [];\r\n const posData = new Float32Array(chunkedFramesCount * atomsCount * 3);\r\n let coordIdx = 0;\r\n const secondaryArr = new Int8Array(atomsCount);\r\n for (let j = 0; j < chunkedFramesCount; ++j) {\r\n for (let i = 0; i < atomsCount; ++i) {\r\n const hiWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const loWord = dataView.getUint32(offset, true);\r\n offset += 4;\r\n const str = (loWord & cStrMask) >>> cStrShift;\r\n const x = fromUInt20ToInt20(((loWord & cFirstMask) >>> cFirstShift) >> 0);\r\n const y = fromUInt20ToInt20((((loWord & cSecMask1) << cSecShift1)\r\n | ((hiWord & cSecMask2) >>> cSecShift2)) >> 0);\r\n const z = fromUInt20ToInt20((hiWord & cThirdMask) >> 0);\r\n secondaryArr[i] = 0;\r\n if (str > 0 && str < 4) {\r\n secondaryArr[i] = cHelixIdx;\r\n } else if (str === 4) {\r\n secondaryArr[i] = cSheetIdx;\r\n }\r\n posData[coordIdx++] = x / 100;\r\n posData[coordIdx++] = y / 100;\r\n posData[coordIdx++] = z / 100;\r\n }\r\n secondary.push(_createSecondary(secondaryArr, complex));\r\n }\r\n this._secondaryData = secondary;\r\n this._data = posData;\r\n }\r\n\r\n nextFrame() {\r\n this.setFrame((this._currFrame + 1) % this._framesCount);\r\n }\r\n\r\n needsColorUpdate(colorer) {\r\n return colorer instanceof SecondaryStructureColorer;\r\n }\r\n\r\n getAtomColor(colorer, atom) {\r\n return colorer.getResidueColor(this._residues[atom.residue._index], this._complex);\r\n }\r\n\r\n getResidueColor(colorer, residue) {\r\n return colorer.getResidueColor(this._residues[residue._index], this._complex);\r\n }\r\n\r\n _updateSecondary() {\r\n let i;\r\n const myResidues = this._residues;\r\n let n = myResidues.length;\r\n for (i = 0; i < n; ++i) {\r\n myResidues[i]._secondary = null;\r\n }\r\n const sec = this._secondaryData[this._currFrame - this._framesRange.start];\r\n for (i = 0, n = sec.length; i < n; ++i) {\r\n const oldSec = sec[i];\r\n const { start, end } = oldSec;\r\n const nSec = {\r\n _start: myResidues[start],\r\n _end: myResidues[end],\r\n type: oldSec.type,\r\n generic: oldSec.generic,\r\n };\r\n for (let j = start; j <= end; ++j) {\r\n myResidues[j]._secondary = nSec;\r\n }\r\n }\r\n }\r\n\r\n reset() {\r\n const compRes = this._complex._residues;\r\n const n = compRes.length;\r\n this._residues = new Array(n);\r\n const myResidues = this._residues;\r\n const getSec = function () {\r\n return this._secondary;\r\n };\r\n for (let i = 0; i < n; ++i) {\r\n myResidues[i] = {\r\n _type: compRes[i]._type,\r\n _isValid: compRes[i]._isValid,\r\n _controlPoint: null,\r\n _wingVector: null,\r\n _secondary: null,\r\n getSecondary: getSec,\r\n };\r\n }\r\n }\r\n\r\n setFrame(frameIdx) {\r\n this.frameIsReady = false;\r\n if (frameIdx >= this._framesRange.start && frameIdx <= this._framesRange.end) {\r\n this._currFrame = frameIdx;\r\n this._cachedResidues = false;\r\n this._updateSecondary();\r\n this.frameIsReady = true;\r\n } else {\r\n this._frameRequest = frameIdx;\r\n if (!this._buffer) {\r\n this._prepareBuffer(frameIdx);\r\n } else {\r\n const self = this;\r\n switch (this._buffer.state) {\r\n case 'none':\r\n this._prepareBuffer(frameIdx);\r\n break;\r\n case 'ready':\r\n self._parseBuffer();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n disableEvents() {\r\n this._callbacks = null;\r\n }\r\n\r\n /**\r\n * Returns link to atom pos vector, clone it if needed\r\n */\r\n\r\n static _vec = new THREE.Vector3();\r\n\r\n getAtomPos(atomIdx) {\r\n const vec = FrameInfo._vec;\r\n const self = this;\r\n const data = self._data;\r\n const idx = (self._atomsCount * (self._currFrame - self._framesRange.start) + atomIdx) * 3;\r\n vec.set(data[idx], data[idx + 1], data[idx + 2]);\r\n return vec;\r\n }\r\n\r\n getResidues() {\r\n if (this._cachedResidues) {\r\n return this._residues;\r\n }\r\n this._complex.updateToFrame(this);\r\n return this._residues;\r\n }\r\n}\r\nexport default FrameInfo;\r\n","import _ from 'lodash';\r\nimport settings from '../../settings';\r\nimport utils from '../../utils';\r\nimport gfxutils from '../gfxutils';\r\n\r\n/**\r\n * Create new scene object.\r\n *\r\n * @param {array=} params - Object required params.\r\n * @param {object=} opts - Options to override defaults with.\r\n *\r\n * These options are copied locally and not kept by reference, so the created instance will not reflect further\r\n * changes to the `opts` object. However, changes in defaults **will** affect the colorer after its creation.\r\n *\r\n * @exports SceneObject\r\n * @this SceneObject\r\n * @abstract\r\n * @constructor\r\n * @classdesc Basic class for all scene objects that are not reps.\r\n */\r\nclass SceneObject {\r\n constructor(params, opts) {\r\n if (this.constructor === SceneObject) {\r\n throw new Error('Can not instantiate abstract class!');\r\n }\r\n /**\r\n * Object's options inherited (prototyped) from defaults.\r\n * @type {object}\r\n */\r\n this.params = params;\r\n this.opts = _.merge(utils.deriveDeep(settings.now.objects[this.type], true), opts);\r\n this.needsRebuild = false;\r\n this._mesh = null;\r\n this.id = null;\r\n }\r\n\r\n /**\r\n * Get object identification, probably with options.\r\n * @returns {Object} field type contains type information, params - object's formal parameters,\r\n * opts - changed options\r\n * Options are returned if they were changed during or after object creation.\r\n */\r\n identify() {\r\n const result = {\r\n type: this.type,\r\n params: this.params,\r\n };\r\n const diff = utils.objectsDiff(this.opts, settings.now.modes[this.id]);\r\n if (!_.isEmpty(diff)) {\r\n result.opts = diff;\r\n }\r\n return result;\r\n }\r\n\r\n toString() {\r\n const paramsStr = `o=${this.type},${this.params.join(',')}`;\r\n const optsStr = utils.compareOptionsWithDefaults(this.opts, settings.defaults.objects[this.type]);\r\n return paramsStr + optsStr;\r\n }\r\n\r\n getGeometry() {\r\n return this._mesh;\r\n }\r\n\r\n destroy() {\r\n if (this._mesh) {\r\n gfxutils.destroyObject(this._mesh);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Scene object identifier.\r\n * @type {string}\r\n */\r\nSceneObject.prototype.type = '__';\r\n\r\nexport default SceneObject;\r\n","import * as THREE from 'three';\r\nimport SceneObject from './SceneObject';\r\nimport meshutils from '../meshutils';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\nimport meshes from '../meshes/meshes';\r\nimport settings from '../../settings';\r\n\r\nclass LinesObj extends SceneObject {\r\n constructor(params, opts) {\r\n super(params, opts);\r\n if (params.length < 2) {\r\n throw new Error('Wrong number of argumets on line object creation!');\r\n }\r\n [this._id1, this._id2] = params;\r\n }\r\n\r\n _getAtomFromName(complex, atomId) {\r\n const err = ' - Wrong atom format it must be \\'#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME\\' (e.g. \\'A.38.CO1\\')';\r\n const atom1 = complex.getAtomByFullname(atomId);\r\n if (!atom1) {\r\n throw new Error(atomId + err);\r\n }\r\n return atom1;\r\n }\r\n\r\n build(complex) {\r\n const geom = new THREE.BufferGeometry();\r\n this._atom1 = this._getAtomFromName(complex, this._id1);\r\n this._atom2 = this._getAtomFromName(complex, this._id2);\r\n\r\n const p1 = this._atom1.position;\r\n const p2 = this._atom2.position;\r\n const vertices = new Float32Array([\r\n p1.x, p1.y, p1.z,\r\n p2.x, p2.y, p2.z,\r\n ]);\r\n\r\n geom.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\r\n geom.computeBoundingBox();\r\n\r\n this._line = new meshes.Line(geom, new UberMaterial({\r\n lights: false,\r\n overrideColor: true,\r\n dashedLine: true,\r\n fogTransparent: settings.now.bg.transparent,\r\n }));\r\n this._line.computeLineDistances();\r\n this._line.material.setUberOptions({\r\n fixedColor: new THREE.Color(this.opts.color),\r\n dashedLineSize: this.opts.dashSize,\r\n dashedLinePeriod: this.opts.dashSize + this.opts.gapSize,\r\n });\r\n this._line.material.updateUniforms();\r\n\r\n this._line.raycast = function (_raycaster, _intersects) {};\r\n this._mesh = this._line;\r\n const transforms = complex.getTransforms();\r\n if (transforms.length > 0) {\r\n this._mesh = new THREE.Group();\r\n this._mesh.add(this._line);\r\n meshutils.applyTransformsToMeshes(this._mesh, transforms);\r\n }\r\n }\r\n\r\n updateToFrame(frameData) {\r\n if (!this._atom1 || !this._atom2 || !this._line) {\r\n return;\r\n }\r\n\r\n const geo = this._line.geometry;\r\n geo.vertices[0].copy(frameData.getAtomPos(this._atom1.index));\r\n geo.vertices[1].copy(frameData.getAtomPos(this._atom2.index));\r\n this._line.computeLineDistances();\r\n geo.computeBoundingSphere();\r\n\r\n geo.verticesNeedUpdate = true;\r\n }\r\n}\r\n\r\nLinesObj.prototype.constructor = LinesObj;\r\nLinesObj.prototype.type = 'line';\r\n\r\nexport default LinesObj;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Outline.frag';\r\n\r\nclass OutlineMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n // add depth outline\r\n super(params);\r\n\r\n const settings = {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcDepthTex: { type: 't', value: null },\r\n srcTexSize: { type: 'v2', value: new THREE.Vector2(512, 512) },\r\n color: { type: 'v3', value: null },\r\n threshold: { type: 'f', value: null },\r\n opacity: { type: 'f', value: 1.0 },\r\n thickness: { type: 'v2', value: new THREE.Vector2(1, 1) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: true,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n\r\n this.setValues(settings);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n const defines = {};\r\n\r\n if (this.depth) {\r\n defines.DEPTH_OUTLINE = 1;\r\n }\r\n\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nOutlineMaterial.prototype.depth = false;\r\n\r\nexport default OutlineMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './FXAA.frag';\r\n\r\nclass FXAAMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n bgColor: { type: 'c', value: new THREE.Color(0xffffff) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n copy(source) {\r\n super.copy(source);\r\n this.depth = source.depth;\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.bgTransparent) {\r\n defines.BG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nFXAAMaterial.prototype.bgTransparent = false;\r\n\r\nexport default FXAAMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AO.frag';\r\nimport noise from '../noiseTexture';\r\n\r\nconst _samplesKernel = [\r\n // hemisphere samples adopted to sphere\r\n new THREE.Vector3(0.295184, 0.077723, 0.068429),\r\n new THREE.Vector3(-0.271976, -0.365221, 0.838363),\r\n new THREE.Vector3(0.547713, 0.467576, 0.488515),\r\n new THREE.Vector3(0.662808, -0.031733, 0.584758),\r\n new THREE.Vector3(-0.025717, 0.218955, 0.657094),\r\n new THREE.Vector3(-0.310153, -0.365223, 0.370701),\r\n new THREE.Vector3(-0.101407, -0.006313, 0.747665),\r\n new THREE.Vector3(-0.769138, 0.360399, 0.086847),\r\n new THREE.Vector3(-0.271988, -0.275140, 0.905353),\r\n new THREE.Vector3(0.096740, -0.566901, 0.700151),\r\n new THREE.Vector3(0.562872, -0.735136, 0.094647),\r\n new THREE.Vector3(0.379877, 0.359278, 0.190061),\r\n new THREE.Vector3(0.519064, -0.023055, 0.405068),\r\n new THREE.Vector3(-0.301036, 0.114696, 0.088885),\r\n new THREE.Vector3(-0.282922, 0.598305, 0.487214),\r\n new THREE.Vector3(-0.181859, 0.251670, 0.679702),\r\n new THREE.Vector3(-0.191463, -0.635818, 0.512919),\r\n new THREE.Vector3(-0.293655, 0.427423, 0.078921),\r\n new THREE.Vector3(-0.267983, 0.680534, 0.132880),\r\n new THREE.Vector3(0.139611, 0.319637, 0.477439),\r\n new THREE.Vector3(-0.352086, 0.311040, 0.653913),\r\n new THREE.Vector3(0.321032, 0.805279, 0.487345),\r\n new THREE.Vector3(0.073516, 0.820734, 0.414183),\r\n new THREE.Vector3(-0.155324, 0.589983, 0.411460),\r\n new THREE.Vector3(0.335976, 0.170782, 0.527627),\r\n new THREE.Vector3(0.463460, -0.355658, 0.167689),\r\n new THREE.Vector3(0.222654, 0.596550, 0.769406),\r\n new THREE.Vector3(0.922138, -0.042070, 0.147555),\r\n new THREE.Vector3(-0.727050, -0.329192, 0.369826),\r\n new THREE.Vector3(-0.090731, 0.533820, 0.463767),\r\n new THREE.Vector3(-0.323457, -0.876559, 0.238524),\r\n new THREE.Vector3(-0.663277, -0.372384, 0.342856),\r\n];\r\n\r\nclass AOMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n noiseTexture: { type: 't', value: noise.noiseTexture },\r\n noiseTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / noise.noiseWidth, 1.0 / noise.noiseHeight) },\r\n diffuseTexture: { type: 't', value: null },\r\n normalTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n camNearFar: { type: 'v2', value: new THREE.Vector2(1.0, 10.0) },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n samplesKernel: { type: 'v3v', value: _samplesKernel },\r\n kernelRadius: { type: 'f', value: 1.0 },\r\n depthThreshold: { type: 'f', value: 1.0 },\r\n factor: { type: 'f', value: 1.0 },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOHorBlur.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOHorBlurMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n }\r\n}\r\n\r\nexport default AOHorBlurMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './AOVertBlurWithBlend.frag';\r\n\r\nconst _kernelOffsets = [-2.0, -1.0, 0.0, 1.0, 2.0];\r\n\r\nclass AOVertBlurWithBlendMaterial extends THREE.RawShaderMaterial {\r\n constructor(params) {\r\n super(params);\r\n\r\n // set default values\r\n this.setValues.call(this, {\r\n uniforms: {\r\n diffuseTexture: { type: 't', value: null },\r\n depthTexture: { type: 't', value: null },\r\n srcTexelSize: { type: 'v2', value: new THREE.Vector2(1.0 / 512.0, 1.0 / 512.0) },\r\n aoMap: { type: 't', value: null },\r\n samplesOffsets: { type: 'fv1', value: _kernelOffsets },\r\n projMatrix: { type: 'mat4', value: new THREE.Matrix4() },\r\n aspectRatio: { type: 'f', value: 0.0 },\r\n tanHalfFOV: { type: 'f', value: 0.0 },\r\n fogNearFar: { type: 'v2', value: new THREE.Vector2(100.0, 100.0) },\r\n fogColor: { type: 'v4', value: new THREE.Vector4(0.0, 0.5, 0.0, 1.0) },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n this.setValues(params);\r\n }\r\n\r\n setValues(values) {\r\n if (typeof values === 'undefined') {\r\n return;\r\n }\r\n\r\n // set direct values\r\n super.setValues(values);\r\n\r\n const defines = {};\r\n\r\n if (this.useFog) {\r\n defines.USE_FOG = 1;\r\n }\r\n if (this.fogTransparent) {\r\n defines.FOG_TRANSPARENT = 1;\r\n }\r\n // set dependent values\r\n this.defines = defines;\r\n }\r\n}\r\n\r\nAOVertBlurWithBlendMaterial.prototype.useFog = true;\r\nAOVertBlurWithBlendMaterial.prototype.fogTransparent = false;\r\n\r\nexport default AOVertBlurWithBlendMaterial;\r\n","/* eslint-disable no-magic-numbers */\r\n/* eslint-disable guard-for-in */\r\nimport * as THREE from 'three';\r\nimport vertexShader from './ScreenQuad.vert';\r\nimport fragmentShader from './Anaglyph.frag';\r\n\r\nclass AnaglyphMaterial extends THREE.RawShaderMaterial {\r\n constructor() {\r\n super();\r\n const settings = {\r\n uniforms: {\r\n srcL: { type: 't', value: null },\r\n srcR: { type: 't', value: null },\r\n },\r\n vertexShader,\r\n fragmentShader,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n };\r\n this.setValues(settings);\r\n }\r\n}\r\n\r\nexport default AnaglyphMaterial;\r\n","import * as THREE from 'three';\r\nimport settings from '../settings';\r\n\r\nclass View {\r\n constructor() {\r\n this.position = new THREE.Vector3(0, 0, 0);\r\n this.scale = 1;\r\n this.orientation = new THREE.Quaternion(0, 0, 0, 1);\r\n }\r\n\r\n set(position, scale, orientation) {\r\n this.position = position;\r\n this.scale = scale;\r\n this.orientation = orientation;\r\n }\r\n}\r\n\r\nconst _transitionTime = 1.5; // in seconds\r\n\r\nexport default class ViewInterpolator {\r\n setup(startView, endView) {\r\n this._startTime = undefined;\r\n this._endTime = undefined;\r\n this._isPaused = false;\r\n\r\n this._srcView = startView;\r\n this._dstView = endView;\r\n this._isMoving = false;\r\n }\r\n\r\n isMoving() {\r\n return this._isMoving;\r\n }\r\n\r\n wasStarted() {\r\n return typeof this._startTime !== 'undefined' && typeof this._endTime !== 'undefined';\r\n }\r\n\r\n start() {\r\n this._startTime = Date.now();\r\n const transTime = settings.now.interpolateViews ? _transitionTime * 1000 : 0;\r\n this._endTime = this._startTime + transTime;\r\n this._isMoving = true;\r\n }\r\n\r\n getCurrentView() {\r\n if (typeof this._srcView === 'undefined' || typeof this._dstView === 'undefined'\r\n || !this._isMoving || !this.wasStarted()) {\r\n return { success: false };\r\n }\r\n\r\n let view = this.createView();\r\n const time = Date.now();\r\n if (time > this._endTime) {\r\n view = this._dstView;\r\n this.reset();\r\n return { success: true, view };\r\n }\r\n\r\n const factor = (time - this._startTime) / (this._endTime - this._startTime);\r\n view.position.copy(this._srcView.position);\r\n view.position.lerp(this._dstView.position, factor);\r\n view.scale = (1 - factor) * this._srcView.scale + factor * this._dstView.scale;\r\n view.orientation.copy(this._srcView.orientation);\r\n view.orientation.slerp(this._dstView.orientation, factor);\r\n return { success: true, view };\r\n }\r\n\r\n reset() {\r\n this._startTime = this._endTime = 0;\r\n this._isMoving = false;\r\n }\r\n\r\n pause() {\r\n if (!this._isPaused) {\r\n this.setup(this.getCurrentView().view, this._dstView);\r\n this._isPaused = true;\r\n }\r\n }\r\n\r\n resume() {\r\n this._isPaused = false;\r\n }\r\n\r\n createView() {\r\n return new View();\r\n }\r\n}\r\n","import _ from 'lodash';\r\nimport makeContextDependent from './makeContextDependent';\r\n\r\nconst MAX_COOKIE_LEN = 4000;\r\nconst COUNT_SUFFIX = 'Cnt';\r\n\r\nfunction _chunkString(string, chunkLen) {\r\n const l = string.length;\r\n const chunks = [];\r\n for (let c = 0, lc = 0; lc < l; c++, lc += chunkLen) {\r\n chunks[c] = string.slice(lc, lc + chunkLen);\r\n }\r\n return chunks;\r\n}\r\n\r\n/**\r\n * Create new context dependent Cookie holder object.\r\n * @param context\r\n * @param {Object} opts - options\r\n * @param {string} opts.path - cookie path\r\n * @constructor\r\n */\r\nfunction Cookies(context, opts) {\r\n this.context = context;\r\n this._opts = _.merge({\r\n path: '/',\r\n }, opts);\r\n}\r\n\r\nmakeContextDependent(Cookies.prototype);\r\n\r\n/**\r\n * Remove cookie by the name.\r\n * @param key\r\n */\r\nCookies.prototype.removeCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n this._removeSimpleCookie(key);\r\n return;\r\n }\r\n this._removeSimpleCookie(cntKey);\r\n cntVal = parseInt(cntVal, 10);\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._removeSimpleCookie(key + i);\r\n }\r\n};\r\n\r\n/**\r\n * Set new cookie value. Automatically splits\r\n * values that are too large into multiple cookies.\r\n * @param key\r\n * @param value\r\n */\r\nCookies.prototype.setCookie = function (key, value) {\r\n this.removeCookie(key);\r\n value = encodeURIComponent(value);\r\n const values = _chunkString(value, MAX_COOKIE_LEN - key.length - 1);\r\n const cntVal = values.length;\r\n if (cntVal === 1) {\r\n this._setSimpleCookie(key, value);\r\n return;\r\n }\r\n const cntKey = this._toCount(key);\r\n this._setSimpleCookie(cntKey, cntVal.toString());\r\n for (let i = 0; i < cntVal; ++i) {\r\n this._setSimpleCookie(key + i, values[i]);\r\n }\r\n};\r\n\r\n/**\r\n * Obtain the value of a compound cookie.\r\n * @param key\r\n */\r\nCookies.prototype.getCookie = function (key) {\r\n const cntKey = this._toCount(key);\r\n let cntVal = this._getSimpleCookie(cntKey);\r\n if (!cntVal) {\r\n return this._getSimpleCookie(key);\r\n }\r\n cntVal = parseInt(cntVal, 10);\r\n const value = [];\r\n for (let i = 0; i < cntVal; ++i) {\r\n value[i] = this._getSimpleCookie(key + i);\r\n }\r\n return value.join('');\r\n};\r\n\r\nCookies.prototype._toCount = function (key) {\r\n return key + COUNT_SUFFIX;\r\n};\r\n\r\nCookies.prototype._removeSimpleCookie = function (key) {\r\n document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\r\n};\r\n\r\nCookies.prototype._getExpirationDate = function () {\r\n const today = new Date();\r\n const EXP_PERIOD_YEARS = 10;\r\n today.setFullYear(today.getFullYear() + EXP_PERIOD_YEARS);\r\n return today;\r\n};\r\n\r\nCookies.prototype._setSimpleCookie = function (key, value) {\r\n document.cookie = `${key}=${value\r\n };expires=${this._getExpirationDate().toUTCString()\r\n };path=${this._opts.path}`;\r\n};\r\n\r\nCookies.prototype._getSimpleCookie = function (key) {\r\n const matches = document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n return matches ? decodeURIComponent(matches[1]) : '';\r\n};\r\n\r\nCookies.prototype._exists = function (key) {\r\n return document.cookie.match(new RegExp(`(?:^|; )${key}=([^;]*)`));\r\n};\r\n\r\nexport default Cookies;\r\n","/*\r\n * Toggling WebVR is done through button.click because of limitations on calling requestPresent in webVR:\r\n * VRDisplay::requestPresent should be called from user gesture:\r\n * https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestPresent\r\n */\r\nexport default function (webVRPoC) {\r\n function showEnterVR(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'pointer';\r\n button.style.left = 'calc(50% - 50px)';\r\n button.style.width = '100px';\r\n\r\n button.textContent = 'ENTER VR';\r\n\r\n let currentSession = null;\r\n\r\n function onSessionEnded(/* event */) {\r\n currentSession.removeEventListener('end', onSessionEnded);\r\n button.textContent = 'ENTER VR';\r\n currentSession = null;\r\n }\r\n\r\n function onSessionStarted(session) {\r\n session.addEventListener('end', onSessionEnded);\r\n webVRPoC._gfx.renderer.xr.setReferenceSpaceType('local');\r\n webVRPoC._gfx.renderer.xr.setSession(session);\r\n button.textContent = 'EXIT VR';\r\n currentSession = session;\r\n }\r\n\r\n button.onmouseenter = function () { button.style.opacity = '1.0'; };\r\n button.onmouseleave = function () { button.style.opacity = '0.5'; };\r\n\r\n button.onclick = function () {\r\n if (currentSession === null) {\r\n // WebXR's requestReferenceSpace only works if the corresponding feature\r\n // was requested at session creation time. For simplicity, just ask for\r\n // the interesting ones as optional features, but be aware that the\r\n // requestReferenceSpace call will fail if it turns out to be unavailable.\r\n // ('local' is always available for immersive sessions and doesn't need to\r\n // be requested separately.)\r\n\r\n const sessionInit = { optionalFeatures: ['local-floor', 'bounded-floor'] };\r\n navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted);\r\n webVRPoC.moveSceneBehindHeadset();\r\n } else {\r\n currentSession.end();\r\n }\r\n };\r\n }\r\n\r\n function showWebXRNotFound(button) {\r\n button.style.display = '';\r\n button.style.cursor = 'auto';\r\n button.style.left = 'calc(50% - 75px)';\r\n button.style.width = '150px';\r\n button.textContent = 'VR NOT FOUND';\r\n button.onmouseenter = null;\r\n button.onmouseleave = null;\r\n button.onclick = null;\r\n }\r\n\r\n function stylizeElement(element) {\r\n element.style.position = 'absolute';\r\n element.style.bottom = '20px';\r\n element.style.padding = '12px 6px';\r\n element.style.border = '1px solid #fff';\r\n element.style.borderRadius = '4px';\r\n element.style.background = 'transparent';\r\n element.style.color = '#fff';\r\n element.style.font = 'normal 13px sans-serif';\r\n element.style.textAlign = 'center';\r\n element.style.opacity = '0.5';\r\n element.style.outline = 'none';\r\n element.style.zIndex = '999';\r\n }\r\n\r\n if ('xr' in navigator) {\r\n const button = document.createElement('button');\r\n button.style.display = 'none';\r\n stylizeElement(button);\r\n navigator.xr.isSessionSupported('immersive-vr').then((supported) => (\r\n supported ? showEnterVR(button) : showWebXRNotFound(button)\r\n ));\r\n return button;\r\n }\r\n const message = document.createElement('a');\r\n message.href = 'https://webvr.info';\r\n message.innerHTML = 'WEBXR NOT SUPPORTED';\r\n message.style.left = 'calc(50% - 90px)';\r\n message.style.width = '180px';\r\n message.style.textDecoration = 'none';\r\n stylizeElement(message);\r\n return message;\r\n}\r\n","import * as THREE from 'three';\r\nimport createWebVRButton from './createWebVRButton';\r\nimport gfxutils from '../gfxutils';\r\nimport logger from '../../utils/logger';\r\nimport settings from '../../settings';\r\nimport UberMaterial from '../shaders/UberMaterial';\r\n\r\nexport default class WebVRPoC {\r\n constructor(onToggle) {\r\n this._mainCamera = new THREE.PerspectiveCamera();\r\n this._button = null;\r\n this._onToggle = onToggle;\r\n\r\n this._molContainer = new gfxutils.RCGroup();\r\n this._user = new gfxutils.RCGroup();\r\n this._scalingPivot = new THREE.Object3D();\r\n this._user.add(this._scalingPivot);\r\n\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n this._pressedGripsCounter = 0;\r\n this._distance = 0;\r\n\r\n this._gfx = null;\r\n }\r\n\r\n startScalingByControllers() {\r\n // reset scale\r\n this._distance = this._controller1.position.distanceTo(this._controller2.position);\r\n gfxutils.getMiddlePoint(this._controller1.position, this._controller2.position, this._scalingPivot.position);\r\n this._scalingPivot.scale.set(1, 1, 1);\r\n this._scalingPivot.updateMatrix();\r\n this._scalingPivot.updateMatrixWorld();\r\n // link molecule to pivot\r\n this._scalingPivot.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n stopScalingByControllers() {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n\r\n handleGripsDown(event) {\r\n this._pressedGripsCounter++;\r\n if (this._pressedGripsCounter === 2) {\r\n this.startScalingByControllers();\r\n } else if (this._pressedGripsCounter === 1) {\r\n event.target.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n handleGripsUp(event) {\r\n this._pressedGripsCounter--;\r\n if (this._pressedGripsCounter === 1) {\r\n this.stopScalingByControllers();\r\n // reattach molecule to other controller\r\n const anotherController = event.target === this._controller1 ? this._controller2 : this._controller1;\r\n anotherController.addSavingWorldTransform(this._molContainer);\r\n } else if (this._pressedGripsCounter === 0) {\r\n this._gfx.scene.addSavingWorldTransform(this._molContainer);\r\n }\r\n }\r\n\r\n enable(gfx) {\r\n if (!gfx) {\r\n logger.warn('WebVR couldn\\'t be enabled, because gfx is not defined');\r\n return;\r\n }\r\n this._gfx = gfx;\r\n const { renderer, camera } = gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n if (!camera) {\r\n throw new Error('No camera is available to toggle WebVR');\r\n }\r\n\r\n // enable xr in renderer\r\n renderer.xr.enabled = true;\r\n // add button for turning vr mode\r\n if (!this._button) {\r\n this._button = createWebVRButton(this);\r\n document.body.appendChild(this._button);\r\n } else {\r\n this._button.style.display = 'block';\r\n }\r\n // store fog setting\r\n this._mainFog = settings.now.fog;\r\n settings.set('fog', false);\r\n\r\n this._plugVRNodesIntoScene(gfx, renderer);\r\n this._setControllersListeners();\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n _plugVRNodesIntoScene(gfx, renderer) {\r\n // store common scene camera\r\n this._mainCamera.copy(gfx.camera);\r\n // add hierarchical structure for webVR into scene\r\n gfx.scene.add(this._user);\r\n // turn on webvr transformation\r\n gfx.scene.add(this._molContainer);\r\n this._molContainer.add(gfx.root);\r\n\r\n this._controller1 = renderer.xr.getController(0);\r\n this._controller2 = renderer.xr.getController(1);\r\n const mesh = this._createControllerMesh();\r\n this._controller1.add(mesh);\r\n this._controller2.add(mesh.clone());\r\n this._user.add(this._controller1);\r\n this._user.add(this._controller2);\r\n }\r\n\r\n _setControllersListeners() {\r\n this._controller1.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('selectstart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('selectend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n\r\n this._controller1.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller1.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n this._controller2.addEventListener('squeezestart', (event) => {\r\n this.handleGripsDown(event);\r\n });\r\n this._controller2.addEventListener('squeezeend', (event) => {\r\n this.handleGripsUp(event);\r\n });\r\n }\r\n\r\n disable() {\r\n if (!this._gfx) {\r\n return;\r\n }\r\n const { renderer, camera } = this._gfx;\r\n if (!renderer) {\r\n throw new Error('No renderer is available to toggle WebVR');\r\n }\r\n\r\n // nullify webxr callback for animation frame\r\n renderer.setAnimationLoop(null);\r\n const session = renderer.xr.getSession();\r\n if (session) {\r\n session.end();\r\n }\r\n renderer.xr.enabled = false;\r\n // remove button of VR entering\r\n if (this._button) {\r\n this._button.style.display = 'none';\r\n }\r\n // restore fog param\r\n settings.set('fog', this._mainFog);\r\n\r\n this._unplugVRNodesFromScene(camera);\r\n\r\n // make some Miew job\r\n if (this._onToggle) {\r\n this._onToggle(false);\r\n }\r\n }\r\n\r\n _unplugVRNodesFromScene(camera) {\r\n // restore common camera\r\n if (this._mainCamera && camera) {\r\n camera.copy(this._mainCamera);\r\n }\r\n // turn off webvr transformation\r\n const root = this._molContainer.children[0];\r\n if (root) {\r\n this._gfx.scene.add(root);\r\n }\r\n this._molContainer.parent.remove(this._molContainer);\r\n if (this._user) {\r\n this._gfx.scene.remove(this._user);\r\n }\r\n // free scene nodes\r\n this._molContainer = null;\r\n this._user = null;\r\n this._scalingPivot = null;\r\n this._user = null;\r\n this._controller1 = null;\r\n this._controller2 = null;\r\n }\r\n\r\n _createControllerMesh() {\r\n // visualize controllers with cylinders\r\n const geometry = new THREE.CylinderGeometry(0.04, 0.04, 0.3);\r\n const material = new UberMaterial({ lights: false, overrideColor: true });\r\n material.setUberOptions({ fixedColor: new THREE.Color(0x4444ff) });\r\n material.updateUniforms();\r\n const cylinder = new THREE.Mesh(geometry, material);\r\n cylinder.rotateX(-Math.PI / 2);\r\n return cylinder;\r\n }\r\n\r\n updateMoleculeScale() {\r\n if (!this._controller1 || !this._controller2) {\r\n return;\r\n }\r\n\r\n const self = this;\r\n // update molecule scaling by controllers\r\n if (self._pressedGripsCounter === 2) {\r\n // recalc scaling pivot\r\n gfxutils.getMiddlePoint(self._controller1.position, self._controller2.position, self._scalingPivot.position);\r\n // recalc scaler\r\n const dist = self._controller1.position.distanceTo(self._controller2.position);\r\n const scaler = dist / self._distance;\r\n self._scalingPivot.scale.multiplyScalar(scaler);\r\n // save cur distance for next frame\r\n self._distance = dist;\r\n }\r\n }\r\n\r\n /**\r\n * Reposition molecule right before the camera.\r\n * @note The proper way is to initiate headset in the place of common Miew's camera.\r\n * But threejs limitations on setting new XRReferenceSpace enforce the molecule repositioning\r\n * Hope, something will change.\r\n */\r\n moveSceneBehindHeadset() {\r\n const gfx = this._gfx;\r\n const { camera } = gfx;\r\n\r\n // set container position in camera space\r\n const container = this._molContainer;\r\n container.matrix.identity();\r\n container.position.set(0, 0, -4.0);\r\n container.updateMatrix();\r\n\r\n // update container world matrix\r\n container.matrixWorld.multiplyMatrices(camera.matrixWorld, container.matrix);\r\n // readd to scene\r\n gfx.scene.addSavingWorldTransform(container);\r\n if (this._onToggle) {\r\n this._onToggle(true);\r\n }\r\n }\r\n\r\n getCanvas() {\r\n const gfx = this._gfx;\r\n return (gfx && gfx.renderer) ? gfx.renderer.domElement : null;\r\n }\r\n}\r\n","/* global PACKAGE_VERSION:false */\r\nimport _ from 'lodash';\r\nimport * as THREE from 'three';\r\nimport { Spinner } from 'spin.js';\r\nimport Stats from './gfx/Stats';\r\nimport utils from './utils';\r\nimport JobHandle from './utils/JobHandle';\r\nimport options from './options';\r\nimport settings from './settings';\r\nimport chem from './chem';\r\nimport Visual from './Visual';\r\nimport ComplexVisual from './ComplexVisual';\r\nimport Complex from './chem/Complex';\r\nimport VolumeVisual from './VolumeVisual';\r\nimport io from './io/io';\r\nimport modes from './gfx/modes';\r\nimport colorers from './gfx/colorers';\r\nimport palettes from './gfx/palettes';\r\nimport materials from './gfx/materials';\r\nimport Representation from './gfx/Representation';\r\nimport CSS2DRenderer from './gfx/CSS2DRenderer';\r\nimport ObjectControls from './ui/ObjectControls';\r\nimport Picker from './ui/Picker';\r\nimport Axes from './gfx/Axes';\r\nimport gfxutils from './gfx/gfxutils';\r\nimport meshutils from './gfx/meshutils';\r\nimport FrameInfo from './gfx/FrameInfo';\r\nimport meshes from './gfx/meshes/meshes';\r\nimport LinesObject from './gfx/objects/LinesObj';\r\nimport UberMaterial from './gfx/shaders/UberMaterial';\r\nimport OutlineMaterial from './gfx/shaders/OutlineMaterial';\r\nimport FXAAMaterial from './gfx/shaders/FXAAMaterial';\r\nimport AOMaterial from './gfx/shaders/AOMaterial';\r\nimport AOHorBlurMaterial from './gfx/shaders/AOHorBlurMaterial';\r\nimport AOVertBlurWithBlendMaterial from './gfx/shaders/AOVertBlurWithBlendMaterial';\r\nimport AnaglyphMaterial from './gfx/shaders/AnaglyphMaterial';\r\nimport VolumeMaterial from './gfx/shaders/VolumeMaterial';\r\nimport ViewInterpolator from './gfx/ViewInterpolator';\r\nimport EventDispatcher from './utils/EventDispatcher';\r\nimport logger from './utils/logger';\r\nimport Cookies from './utils/Cookies';\r\nimport capabilities from './gfx/capabilities';\r\nimport WebVRPoC from './gfx/vr/WebVRPoC';\r\nimport vertexScreenQuadShader from './gfx/shaders/ScreenQuad.vert';\r\nimport fragmentScreenQuadFromDistTex from './gfx/shaders/ScreenQuadFromDistortionTex.frag';\r\nimport getTopWindow from './utils/getTopWindow';\r\n\r\nconst {\r\n selectors,\r\n Atom,\r\n Residue,\r\n Chain,\r\n Molecule,\r\n} = chem;\r\n\r\nconst EDIT_MODE = { COMPLEX: 0, COMPONENT: 1, FRAGMENT: 2 };\r\n\r\nconst LOADER_NOT_FOUND = 'Could not find suitable loader for this source';\r\nconst PARSER_NOT_FOUND = 'Could not find suitable parser for this source';\r\n\r\n// Color management changed a lot in threejs 152+ version.\r\n// To keep miew colors we disable the new color management system\r\nTHREE.ColorManagement.enabled = false;\r\n\r\nconst { createElement } = utils;\r\n\r\nfunction updateFogRange(fog, center, radius) {\r\n fog.near = center - radius * settings.now.fogNearFactor;\r\n fog.far = center + radius * settings.now.fogFarFactor;\r\n}\r\n\r\nfunction removeExtension(fileName) {\r\n const dot = fileName.lastIndexOf('.');\r\n if (dot >= 0) {\r\n fileName = fileName.substr(0, dot);\r\n }\r\n return fileName;\r\n}\r\n\r\nfunction hasValidResidues(complex) {\r\n let hasValidRes = false;\r\n complex.forEachComponent((component) => {\r\n component.forEachResidue((residue) => {\r\n if (residue._isValid) {\r\n hasValidRes = true;\r\n }\r\n });\r\n });\r\n return hasValidRes;\r\n}\r\n\r\nfunction reportProgress(log, action, percent) {\r\n const TOTAL_PERCENT = 100;\r\n if (percent !== undefined) {\r\n log.debug(`${action}... ${Math.floor(percent * TOTAL_PERCENT)}%`);\r\n } else {\r\n log.debug(`${action}...`);\r\n }\r\n}\r\n\r\nfunction chooseFogColor() {\r\n return settings.now.fogColorEnable ? settings.now.fogColor : settings.now.bg.color;\r\n}\r\n\r\n// ////////////////////////////////////////////////////////////////////////////\r\n\r\n/**\r\n * Main 3D Molecular Viewer class.\r\n *\r\n * @param {object} opts - Viewer options.\r\n * @param {HTMLElement=} opts.container - DOM element that serves as a viewer container.\r\n * @param {object=} opts.settings - An object with properties to override default settings.\r\n * @param {string=} opts.settingsCookie='settings' - The name of the cookie to save current settings to.\r\n * @param {string=} opts.cookiePath='/' - The path option for cookies. Defaults to root.\r\n *\r\n * @exports Miew\r\n * @constructor\r\n */\r\nfunction Miew(opts) {\r\n EventDispatcher.call(this);\r\n this._opts = _.merge({\r\n settingsCookie: 'settings',\r\n cookiePath: '/',\r\n }, opts);\r\n /** @type {?object} */\r\n this._gfx = null;\r\n /** @type {ViewInterpolator} */\r\n this._interpolator = new ViewInterpolator();\r\n /** @type {HTMLElement} */\r\n this._container = (opts && opts.container)\r\n || document.getElementById('miew-container')\r\n || _.head(document.getElementsByClassName('miew-container'))\r\n || document.body;\r\n /** @type {HTMLElement} */\r\n this._containerRoot = this._container;\r\n\r\n /** @type {boolean} */\r\n this._running = false;\r\n /** @type {boolean} */\r\n this._halting = false;\r\n /** @type {boolean} */\r\n this._building = false;\r\n /** @type {boolean} */\r\n this._needRender = true;\r\n /** @type {boolean} */\r\n this._hotKeysEnabled = true;\r\n\r\n /** @type {Settings} */\r\n this.settings = settings;\r\n const log = logger;\r\n log.console = DEBUG;\r\n log.level = DEBUG ? 'debug' : 'info';\r\n /**\r\n * @type {Logger}\r\n * @example\r\n * miew.logger.addEventListener('message', function _onLogMessage(evt) {\r\n * console.log(evt.message);\r\n * });\r\n */\r\n this.logger = log;\r\n\r\n this._cookies = new Cookies(this);\r\n this.restoreSettings();\r\n if (opts && opts.settings) {\r\n this.settings.set(opts.settings);\r\n }\r\n\r\n /** @type {?Spinner} */\r\n this._spinner = null;\r\n /** @type {JobHandle[]} */\r\n this._loading = [];\r\n /** @type {?number}\r\n * @deprecated until Animation system refactoring\r\n */\r\n this._animInterval = null;\r\n\r\n /** @type {object} */\r\n this._visuals = {};\r\n /** @type {?string} */\r\n this._curVisualName = null;\r\n\r\n /** @type {array} */\r\n this._objects = [];\r\n\r\n /** @type {object} */\r\n this._sourceWindow = null;\r\n\r\n this.reset();\r\n\r\n if (this._repr) {\r\n log.debug(`Selected ${this._repr.mode.name} mode with ${this._repr.colorer.name} colorer.`);\r\n }\r\n\r\n const self = this;\r\n Miew.registeredPlugins.forEach((plugin) => {\r\n plugin.call(self);\r\n });\r\n\r\n this._initOnSettingsChanged();\r\n}\r\n\r\nMiew.prototype = Object.create(EventDispatcher.prototype);\r\nMiew.prototype.constructor = Miew;\r\n\r\nMiew.prototype.getMaxRepresentationCount = function () {\r\n return ComplexVisual.NUM_REPRESENTATION_BITS;\r\n};\r\n\r\n/**\r\n * Replace viewer container contents with a DOM element.\r\n * @param {HTMLElement} container - parent container.\r\n * @param {HTMLElement} element - DOM element to show.\r\n * @private\r\n */\r\nfunction _setContainerContents(container, element) {\r\n const parent = container;\r\n while (parent.firstChild) {\r\n parent.removeChild(parent.firstChild);\r\n }\r\n parent.appendChild(element);\r\n}\r\n\r\n/**\r\n * Update Shadow Camera target position and frustum.\r\n * @private\r\n */\r\nMiew.prototype._updateShadowCamera = (function () {\r\n const shadowMatrix = new THREE.Matrix4();\r\n const direction = new THREE.Vector3();\r\n const OBB = { center: new THREE.Vector3(), halfSize: new THREE.Vector3() };\r\n\r\n return function () {\r\n this._gfx.scene.updateMatrixWorld();\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = this._gfx.scene.children[i];\r\n shadowMatrix.copy(light.shadow.camera.matrixWorldInverse);\r\n this.getOBB(shadowMatrix, OBB);\r\n\r\n direction.subVectors(light.target.position, light.position);\r\n light.position.subVectors(OBB.center, direction);\r\n light.target.position.copy(OBB.center);\r\n\r\n light.shadow.bias = 0.09;\r\n light.shadow.camera.bottom = -OBB.halfSize.y;\r\n light.shadow.camera.top = OBB.halfSize.y;\r\n light.shadow.camera.right = OBB.halfSize.x;\r\n light.shadow.camera.left = -OBB.halfSize.x;\r\n light.shadow.camera.near = direction.length() - OBB.halfSize.z;\r\n light.shadow.camera.far = direction.length() + OBB.halfSize.z;\r\n\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Initialize the viewer.\r\n * @returns {boolean} true on success.\r\n * @throws Forwards exception raised during initialization.\r\n * @see Miew#term\r\n */\r\nMiew.prototype.init = function () {\r\n const container = this._container;\r\n const elem = utils.createElement('div', { class: 'miew-canvas' });\r\n _setContainerContents(container, elem);\r\n this._container = elem;\r\n\r\n const frag = document.createDocumentFragment();\r\n frag.appendChild(this._msgMode = createElement(\r\n 'div',\r\n { class: 'mode-message overlay' },\r\n createElement('p', {}, 'COMPONENT EDIT MODE'),\r\n ));\r\n frag.appendChild(this._msgAtomInfo = createElement(\r\n 'div',\r\n { class: 'atom-info overlay' },\r\n createElement('p', {}, ''),\r\n ));\r\n container.appendChild(frag);\r\n\r\n if (this._gfx !== null) { // block double init\r\n return true;\r\n }\r\n\r\n const self = this;\r\n this._showMessage('Viewer is being initialized...');\r\n try {\r\n this._initGfx();\r\n\r\n this._initListeners();\r\n this._spinner = new Spinner({\r\n lines: 13,\r\n length: 28,\r\n width: 14,\r\n radius: 42,\r\n color: '#fff',\r\n zIndex: 700,\r\n });\r\n\r\n const target = getTopWindow();\r\n target.addEventListener('keydown', (event) => {\r\n self._onKeyDown(event);\r\n });\r\n\r\n target.addEventListener('keyup', (event) => {\r\n self._onKeyUp(event);\r\n });\r\n\r\n this._objectControls = new ObjectControls(\r\n this._gfx.root,\r\n this._gfx.pivot,\r\n this._gfx.camera,\r\n this._gfx.renderer.domElement,\r\n () => self._getAltObj(),\r\n );\r\n this._objectControls.addEventListener('change', (e) => {\r\n if (settings.now.shadow.on) {\r\n self._updateShadowCamera();\r\n }\r\n // route rotate, zoom, translate and translatePivot events to the external API\r\n switch (e.action) {\r\n case 'rotate':\r\n self.dispatchEvent({ type: 'rotate', quaternion: e.quaternion });\r\n break;\r\n case 'zoom':\r\n self.dispatchEvent({ type: 'zoom', factor: e.factor });\r\n break;\r\n default:\r\n self.dispatchEvent({ type: e.action });\r\n }\r\n self.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n });\r\n\r\n const gfx = this._gfx;\r\n this._picker = new Picker(gfx.root, gfx.camera, gfx.renderer.domElement);\r\n this._picker.addEventListener('newpick', (event) => {\r\n self._onPick(event);\r\n });\r\n this._picker.addEventListener('dblclick', (event) => {\r\n self.center(event);\r\n });\r\n } catch (error) {\r\n if (error.name === 'TypeError' && error.message === 'Cannot read property \\'getExtension\\' of null') {\r\n this._showMessage('Could not create WebGL context.');\r\n } else if (error.message.search(/webgl/i) > 1) {\r\n this._showMessage(error.message);\r\n } else {\r\n this._showMessage('Viewer initialization failed.');\r\n throw error;\r\n }\r\n return false;\r\n }\r\n\r\n // automatically load default file\r\n const file = this._opts && this._opts.load;\r\n if (file) {\r\n const type = this._opts && this._opts.type;\r\n this.load(file, { fileType: type, keepRepsInfo: true });\r\n }\r\n\r\n return true;\r\n};\r\n\r\n/**\r\n * Terminate the viewer completely.\r\n * @see Miew#init\r\n */\r\nMiew.prototype.term = function () {\r\n this._showMessage('Viewer has been terminated.');\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n this.halt();\r\n this._gfx = null;\r\n};\r\n\r\n/**\r\n * Display message inside the viewer container, hiding WebGL canvas.\r\n * @param {string} msg - Message to show.\r\n * @private\r\n */\r\nMiew.prototype._showMessage = function (msg) {\r\n const element = document.createElement('div');\r\n element.setAttribute('class', 'miew-message');\r\n element.appendChild(document.createElement('p')).appendChild(document.createTextNode(msg));\r\n _setContainerContents(this._container, element);\r\n};\r\n\r\n/**\r\n * Display WebGL canvas inside the viewer container, hiding any message shown.\r\n * @private\r\n */\r\nMiew.prototype._showCanvas = function () {\r\n _setContainerContents(this._container, this._gfx.renderer.domElement);\r\n};\r\n\r\nMiew.prototype._requestAnimationFrame = function (callback) {\r\n const { xr } = this._gfx.renderer;\r\n if (xr && xr.enabled) {\r\n this._gfx.renderer.setAnimationLoop(callback);\r\n return;\r\n }\r\n requestAnimationFrame(callback);\r\n};\r\n\r\nfunction arezSpritesSupported(context) {\r\n return context.getExtension('EXT_frag_depth');\r\n}\r\n\r\nfunction isAOSupported(context) {\r\n return (context.getExtension('WEBGL_depth_texture')\r\n && context.getExtension('WEBGL_draw_buffers'));\r\n}\r\n\r\n/**\r\n * Initialize WebGL and set 3D scene up.\r\n * @private\r\n */\r\nMiew.prototype._initGfx = function () {\r\n const gfx = {\r\n width: this._container.clientWidth,\r\n height: this._container.clientHeight,\r\n };\r\n\r\n const webGLOptions = { preserveDrawingBuffer: true, alpha: true, premultipliedAlpha: false };\r\n if (settings.now.antialias) {\r\n webGLOptions.antialias = true;\r\n }\r\n\r\n gfx.renderer2d = new CSS2DRenderer();\r\n\r\n gfx.renderer = new THREE.WebGL1Renderer(webGLOptions);\r\n gfx.renderer.shadowMap.enabled = settings.now.shadow.on;\r\n gfx.renderer.shadowMap.autoUpdate = false;\r\n gfx.renderer.shadowMap.type = THREE.PCFShadowMap;\r\n capabilities.init(gfx.renderer);\r\n\r\n // z-sprites and ambient occlusion possibility\r\n if (!arezSpritesSupported(gfx.renderer.getContext())) {\r\n settings.set('zSprites', false);\r\n }\r\n if (!isAOSupported(gfx.renderer.getContext())) {\r\n settings.set('ao', false);\r\n }\r\n\r\n gfx.renderer.autoClear = false;\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n gfx.camera = new THREE.PerspectiveCamera(\r\n settings.now.camFov,\r\n gfx.width / gfx.height,\r\n settings.now.camNear,\r\n settings.now.camFar,\r\n );\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.position.z = settings.now.camDistance;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME);\r\n gfx.camera.layers.enable(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n\r\n gfx.stereoCam = new THREE.StereoCamera();\r\n\r\n gfx.scene = new THREE.Scene();\r\n\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color, settings.now.camNear, settings.now.camFar);\r\n\r\n gfx.root = new gfxutils.RCGroup();\r\n gfx.scene.add(gfx.root);\r\n\r\n gfx.pivot = new gfxutils.RCGroup();\r\n gfx.root.add(gfx.pivot);\r\n\r\n gfx.selectionScene = new THREE.Scene();\r\n gfx.selectionRoot = new THREE.Group();\r\n gfx.selectionRoot.matrixAutoUpdate = false;\r\n gfx.selectionScene.add(gfx.selectionRoot);\r\n\r\n gfx.selectionPivot = new THREE.Group();\r\n gfx.selectionPivot.matrixAutoUpdate = false;\r\n gfx.selectionRoot.add(gfx.selectionPivot);\r\n\r\n const light12 = new THREE.DirectionalLight(0xffffff, 0.45);\r\n light12.position.set(0, 0.414, 1);\r\n light12.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n light12.castShadow = true;\r\n light12.shadow.bias = 0.09;\r\n light12.shadow.radius = settings.now.shadow.radius;\r\n light12.shadow.camera.layers.set(gfxutils.LAYERS.SHADOWMAP);\r\n\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n const shadowMapSize = Math.max(gfx.width, gfx.height) * pixelRatio;\r\n light12.shadow.mapSize.width = shadowMapSize;\r\n light12.shadow.mapSize.height = shadowMapSize;\r\n light12.target.position.set(0.0, 0.0, 0.0);\r\n gfx.scene.add(light12);\r\n gfx.scene.add(light12.target);\r\n\r\n const light3 = new THREE.AmbientLight(0x666666);\r\n light3.layers.enable(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.scene.add(light3);\r\n\r\n // add axes\r\n gfx.axes = new Axes(gfx.root, gfx.camera);\r\n const deviceWidth = gfx.width * pixelRatio;\r\n const deviceHeight = gfx.height * pixelRatio;\r\n\r\n gfx.offscreenBuf = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat, depthBuffer: true,\r\n },\r\n );\r\n\r\n if (gfx.renderer.getContext().getExtension('WEBGL_depth_texture')) {\r\n gfx.offscreenBuf.depthTexture = new THREE.DepthTexture();\r\n gfx.offscreenBuf.depthTexture.type = THREE.UnsignedShortType;\r\n }\r\n\r\n gfx.offscreenBuf2 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf3 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf4 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf3;\r\n gfx.volFFTex = gfx.offscreenBuf4;\r\n gfx.volWFFTex = gfx.offscreenBuf;\r\n\r\n // use float textures for volume rendering if possible\r\n if (gfx.renderer.getContext().getExtension('OES_texture_float')) {\r\n gfx.offscreenBuf5 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf6 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.offscreenBuf7 = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter,\r\n magFilter: THREE.LinearFilter,\r\n format: THREE.RGBAFormat,\r\n type: THREE.FloatType,\r\n depthBuffer: true,\r\n },\r\n );\r\n\r\n gfx.volBFTex = gfx.offscreenBuf5;\r\n gfx.volFFTex = gfx.offscreenBuf6;\r\n gfx.volWFFTex = gfx.offscreenBuf7;\r\n } else {\r\n this.logger.warn('Device doesn\\'t support OES_texture_float extension');\r\n }\r\n\r\n gfx.stereoBufL = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n gfx.stereoBufR = new THREE.WebGLRenderTarget(\r\n deviceWidth,\r\n deviceHeight,\r\n {\r\n minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, depthBuffer: false,\r\n },\r\n );\r\n\r\n this._gfx = gfx;\r\n this._showCanvas();\r\n\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n\r\n this._container.appendChild(gfx.renderer2d.getElement());\r\n\r\n // add FPS counter\r\n const stats = new Stats();\r\n stats.domElement.style.position = 'absolute';\r\n stats.domElement.style.right = '0';\r\n stats.domElement.style.bottom = '0';\r\n this._container.appendChild(stats.domElement);\r\n this._fps = stats;\r\n this._fps.show(settings.now.fps);\r\n};\r\n\r\n/**\r\n * Setup event listeners.\r\n * @private\r\n */\r\nMiew.prototype._initListeners = function () {\r\n const self = this;\r\n window.addEventListener('resize', () => {\r\n self._onResize();\r\n });\r\n};\r\n\r\n/**\r\n * Try to add numbers to the base name to make it unique among visuals\r\n * @private\r\n */\r\nMiew.prototype._makeUniqueVisualName = function (baseName) {\r\n if (!baseName) {\r\n return Math.random().toString();\r\n }\r\n\r\n let name = baseName;\r\n let suffix = 1;\r\n while (this._visuals.hasOwnProperty(name)) {\r\n name = `${baseName} (${suffix.toString()})`;\r\n suffix++;\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Add visual to the viewer\r\n * @private\r\n */\r\nMiew.prototype._addVisual = function (visual) {\r\n if (!visual) {\r\n return null;\r\n }\r\n\r\n // change visual name in order to make it unique\r\n const name = this._makeUniqueVisualName(visual.name);\r\n visual.name = name;\r\n\r\n this._visuals[name] = visual;\r\n this._gfx.pivot.add(visual);\r\n if (visual.getSelectionGeo) {\r\n this._gfx.selectionPivot.add(visual.getSelectionGeo());\r\n }\r\n\r\n return name;\r\n};\r\n\r\n/**\r\n * Remove visual from the viewer\r\n * @private\r\n */\r\nMiew.prototype._removeVisual = function (visual) {\r\n let name = '';\r\n let obj = null;\r\n if (visual instanceof Visual) {\r\n ({ name } = visual);\r\n obj = visual;\r\n } else if (typeof visual === 'string') {\r\n name = visual;\r\n obj = this._visuals[name];\r\n }\r\n\r\n if (!obj || !this._visuals.hasOwnProperty(name) || this._visuals[name] !== obj) {\r\n return;\r\n }\r\n\r\n if (name === this._curVisualName) {\r\n this._curVisualName = undefined;\r\n }\r\n\r\n delete this._visuals[name];\r\n obj.release(); // removes nodes from scene\r\n\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Call specified function for each Visual\r\n * @private\r\n */\r\nMiew.prototype._forEachVisual = function (callback) {\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Release (destroy) all visuals in the scene\r\n * @private\r\n */\r\nMiew.prototype._releaseAllVisuals = function () {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)) {\r\n this._visuals[name].release();\r\n }\r\n }\r\n\r\n this._visuals = {};\r\n};\r\n\r\n/**\r\n * Call specified function for each ComplexVisual\r\n * @private\r\n */\r\nMiew.prototype._forEachComplexVisual = function (callback) {\r\n if (!this._gfx || !this._gfx.pivot) {\r\n return;\r\n }\r\n\r\n for (const name in this._visuals) {\r\n if (this._visuals.hasOwnProperty(name)\r\n && this._visuals[name] instanceof ComplexVisual) {\r\n callback(this._visuals[name]);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual with specified name, or current (if not found), or any, or null\r\n * @private\r\n */\r\nMiew.prototype._getComplexVisual = function (name) {\r\n name = name || this._curVisualName;\r\n let any = null;\r\n let named = null;\r\n this._forEachComplexVisual((visual) => {\r\n any = visual;\r\n if (visual.name === name) {\r\n named = visual;\r\n }\r\n });\r\n return named || any;\r\n};\r\n\r\n/**\r\n * Returns first found VolumeVisual (no more than one should be present actually)\r\n * @private\r\n */\r\nMiew.prototype._getVolumeVisual = function () {\r\n let any = null;\r\n this._forEachVisual((visual) => {\r\n if (visual instanceof VolumeVisual) {\r\n any = visual;\r\n }\r\n });\r\n return any;\r\n};\r\n\r\n/**\r\n * Returns ComplexVisual corresponding to specified complex\r\n * @private\r\n */\r\nMiew.prototype._getVisualForComplex = function (complex) {\r\n if (!complex) {\r\n return null;\r\n }\r\n\r\n let found = null;\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getComplex() === complex) {\r\n found = visual;\r\n }\r\n });\r\n return found;\r\n};\r\n\r\n/*\r\n * Get a list of names of visuals currently shown by the viewer\r\n */\r\nMiew.prototype.getVisuals = function () {\r\n return Object.keys(this._visuals);\r\n};\r\n\r\n/*\r\n * Get complex visuals count\r\n */\r\nMiew.prototype.getComplexVisualsCount = function () {\r\n let count = 0;\r\n this._forEachComplexVisual(() => count++);\r\n return count;\r\n};\r\n\r\n/*\r\n * Get current visual\r\n */\r\nMiew.prototype.getCurrentVisual = function () {\r\n return this._curVisualName;\r\n};\r\n\r\n/*\r\n * Set current visual.\r\n * All further operations will be performed on this visual (complex) if not stated otherwise.\r\n */\r\nMiew.prototype.setCurrentVisual = function (name) {\r\n if (!this._visuals[name]) {\r\n return;\r\n }\r\n\r\n this._curVisualName = name;\r\n};\r\n\r\n/**\r\n * Run the viewer, start processing update/render frames periodically.\r\n * Has no effect if already running.\r\n * @see Miew#halt\r\n */\r\nMiew.prototype.run = function () {\r\n if (!this._running) {\r\n this._running = true;\r\n if (this._halting) {\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._objectControls.enable(true);\r\n this._interpolator.resume();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to stop.\r\n * Will be processed during the next frame.\r\n * @see Miew#run\r\n */\r\nMiew.prototype.halt = function () {\r\n if (this._running) {\r\n this._discardComponentEdit();\r\n this._discardFragmentEdit();\r\n this._objectControls.enable(false);\r\n this._interpolator.pause();\r\n this._halting = true;\r\n }\r\n};\r\n\r\n/**\r\n * Request the viewer to start / stop responsing\r\n * on hot keys.\r\n * @param enabled - start (true) or stop (false) response on hot keys.\r\n */\r\nMiew.prototype.enableHotKeys = function (enabled) {\r\n this._hotKeysEnabled = enabled;\r\n this._objectControls.enableHotkeys(enabled);\r\n};\r\n\r\n/**\r\n * Callback which processes window resize.\r\n * @private\r\n */\r\nMiew.prototype._onResize = function () {\r\n const gfx = this._gfx;\r\n if (!gfx) {\r\n return;\r\n }\r\n\r\n this._needRender = true;\r\n\r\n gfx.width = this._container.clientWidth;\r\n gfx.height = this._container.clientHeight;\r\n\r\n gfx.camera.aspect = gfx.width / gfx.height;\r\n gfx.camera.setMinimalFov(settings.now.camFov);\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n gfx.renderer.setSize(gfx.width, gfx.height);\r\n gfx.renderer2d.setSize(gfx.width, gfx.height);\r\n\r\n this.dispatchEvent({ type: 'resize' });\r\n};\r\n\r\nMiew.prototype._resizeOffscreenBuffers = function (width, height, stereo) {\r\n const gfx = this._gfx;\r\n stereo = stereo || 'NONE';\r\n const isAnaglyph = (stereo === 'NONE' || stereo === 'ANAGLYPH');\r\n const multi = isAnaglyph ? 1 : 0.5;\r\n gfx.offscreenBuf.setSize(multi * width, height);\r\n gfx.offscreenBuf2.setSize(multi * width, height);\r\n gfx.offscreenBuf3.setSize(multi * width, height);\r\n gfx.offscreenBuf4.setSize(multi * width, height);\r\n if (gfx.offscreenBuf5) {\r\n gfx.offscreenBuf5.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf6) {\r\n gfx.offscreenBuf6.setSize(multi * width, height);\r\n }\r\n if (gfx.offscreenBuf7) {\r\n gfx.offscreenBuf7.setSize(multi * width, height);\r\n }\r\n if (isAnaglyph) {\r\n gfx.stereoBufL.setSize(width, height);\r\n gfx.stereoBufR.setSize(width, height);\r\n }\r\n};\r\n\r\n/**\r\n * Callback which processes update/render frames.\r\n * @private\r\n */\r\nMiew.prototype._onTick = function () {\r\n if (this._halting) {\r\n this._running = false;\r\n this._halting = false;\r\n return;\r\n }\r\n\r\n this._fps.update();\r\n\r\n this._requestAnimationFrame(() => this._onTick());\r\n\r\n this._onUpdate();\r\n if (this._needRender) {\r\n this._onRender();\r\n this._needRender = !settings.now.suspendRender || settings.now.stereo === 'WEBVR';\r\n }\r\n};\r\n\r\nMiew.prototype._getBSphereRadius = function () {\r\n // calculate radius that would include all visuals\r\n let radius = 0;\r\n this._forEachVisual((visual) => {\r\n radius = Math.max(radius, visual.getBoundaries().boundingSphere.radius);\r\n });\r\n return radius * this._objectControls.getScale();\r\n};\r\n\r\n/**\r\n * Calculate bounding box that would include all visuals and being axis aligned in world defined by\r\n * transformation matrix: matrix\r\n * @param {Matrix4} matrix - transformation matrix.\r\n * @param {object} OBB - calculating bounding box.\r\n * @param {Vector3} OBB.center - OBB center.\r\n * @param {Vector3} OBB.halfSize - half magnitude of OBB sizes.\r\n */\r\nMiew.prototype.getOBB = (function () {\r\n const _bSphereForOneVisual = new THREE.Sphere();\r\n const _bBoxForOneVisual = new THREE.Box3();\r\n const _bBox = new THREE.Box3();\r\n\r\n const _invMatrix = new THREE.Matrix4();\r\n\r\n const _points = [\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n new THREE.Vector3(),\r\n ];\r\n\r\n return function (matrix, OBB) {\r\n _bBox.makeEmpty();\r\n\r\n this._forEachVisual((visual) => {\r\n _bSphereForOneVisual.copy(visual.getBoundaries().boundingSphere);\r\n _bSphereForOneVisual.applyMatrix4(visual.matrixWorld).applyMatrix4(matrix);\r\n _bSphereForOneVisual.getBoundingBox(_bBoxForOneVisual);\r\n _bBox.union(_bBoxForOneVisual);\r\n });\r\n _bBox.getCenter(OBB.center);\r\n\r\n _invMatrix.copy(matrix).invert();\r\n OBB.center.applyMatrix4(_invMatrix);\r\n\r\n const { min } = _bBox;\r\n const { max } = _bBox;\r\n _points[0].set(min.x, min.y, min.z); // 000\r\n _points[1].set(max.x, min.y, min.z); // 100\r\n _points[2].set(min.x, max.y, min.z); // 010\r\n _points[3].set(min.x, min.y, max.z); // 001\r\n for (let i = 0, l = _points.length; i < l; i++) {\r\n _points[i].applyMatrix4(_invMatrix);\r\n }\r\n\r\n OBB.halfSize.set(\r\n Math.abs(_points[0].x - _points[1].x),\r\n Math.abs(_points[0].y - _points[2].y),\r\n Math.abs(_points[0].z - _points[3].z),\r\n ).multiplyScalar(0.5);\r\n };\r\n}());\r\n\r\nMiew.prototype._updateFog = function () {\r\n const gfx = this._gfx;\r\n\r\n if (settings.now.fog) {\r\n if (typeof gfx.scene.fog === 'undefined' || gfx.scene.fog === null) {\r\n const color = chooseFogColor();\r\n gfx.scene.fog = new THREE.Fog(color);\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n updateFogRange(gfx.scene.fog, gfx.camera.position.z, this._getBSphereRadius());\r\n } else if (gfx.scene.fog) {\r\n gfx.scene.fog = undefined;\r\n this._setUberMaterialValues({ fog: settings.now.fog });\r\n }\r\n};\r\n\r\nMiew.prototype._onUpdate = function () {\r\n if (this.isScriptingCommandAvailable !== undefined && this.isScriptingCommandAvailable() && !this._building) {\r\n this.callNextCmd();\r\n }\r\n\r\n this._objectControls.update();\r\n\r\n this._forEachComplexVisual((visual) => {\r\n visual.getComplex().update();\r\n });\r\n\r\n if (settings.now.autobuild && !this._loading.length && !this._building && this._needRebuild()) {\r\n this.rebuild();\r\n }\r\n\r\n if (!this._loading.length && !this._building && !this._needRebuild()) {\r\n this._updateView();\r\n }\r\n\r\n this._updateFog();\r\n\r\n if (this._gfx.renderer.xr.enabled) {\r\n this.webVR.updateMoleculeScale();\r\n }\r\n};\r\n\r\nMiew.prototype._onRender = function () {\r\n const gfx = this._gfx;\r\n\r\n // update all matrices\r\n gfx.scene.updateMatrixWorld();\r\n gfx.camera.updateMatrixWorld();\r\n\r\n this._clipPlaneUpdateValue(this._getBSphereRadius());\r\n this._fogFarUpdateValue();\r\n\r\n gfx.renderer.setRenderTarget(null);\r\n gfx.renderer.clear();\r\n\r\n this._renderFrame(settings.now.stereo);\r\n};\r\n\r\nMiew.prototype._renderFrame = (function () {\r\n const _anaglyphMat = new AnaglyphMaterial();\r\n const _size = new THREE.Vector2();\r\n\r\n return function (stereo) {\r\n const gfx = this._gfx;\r\n const { renderer } = gfx;\r\n\r\n renderer.getSize(_size);\r\n\r\n if (stereo !== 'NONE') {\r\n gfx.camera.focus = gfx.camera.position.z; // set focus to the center of the object\r\n gfx.stereoCam.aspect = 1.0;\r\n\r\n // in anaglyph mode we render full-size image for each eye\r\n // while in other stereo modes only half-size (two images on the screen)\r\n if (stereo === 'ANAGLYPH') {\r\n gfx.stereoCam.update(gfx.camera);\r\n } else {\r\n gfx.stereoCam.updateHalfSized(gfx.camera, settings.now.camFov);\r\n }\r\n }\r\n\r\n // resize offscreen buffers to match the target\r\n const pixelRatio = gfx.renderer.getPixelRatio();\r\n this._resizeOffscreenBuffers(_size.width * pixelRatio, _size.height * pixelRatio, stereo);\r\n\r\n this._renderShadowMap();\r\n\r\n switch (stereo) {\r\n case 'WEBVR':\r\n case 'NONE':\r\n this._renderScene(gfx.camera, false);\r\n break;\r\n case 'SIMPLE':\r\n case 'DISTORTED':\r\n renderer.setScissorTest(true);\r\n\r\n renderer.setScissor(0, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(0, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraL, stereo === 'DISTORTED');\r\n\r\n renderer.setScissor(_size.width / 2, 0, _size.width / 2, _size.height);\r\n renderer.setViewport(_size.width / 2, 0, _size.width / 2, _size.height);\r\n this._renderScene(this._gfx.stereoCam.cameraR, stereo === 'DISTORTED');\r\n\r\n renderer.setScissorTest(false);\r\n break;\r\n case 'ANAGLYPH':\r\n this._renderScene(this._gfx.stereoCam.cameraL, false, gfx.stereoBufL);\r\n this._renderScene(this._gfx.stereoCam.cameraR, false, gfx.stereoBufR);\r\n renderer.setRenderTarget(null);\r\n _anaglyphMat.uniforms.srcL.value = gfx.stereoBufL.texture;\r\n _anaglyphMat.uniforms.srcR.value = gfx.stereoBufR.texture;\r\n gfx.renderer.renderScreenQuad(_anaglyphMat);\r\n break;\r\n default:\r\n }\r\n\r\n gfx.renderer2d.render(gfx.scene, gfx.camera);\r\n\r\n if (settings.now.axes && gfx.axes && !gfx.renderer.xr.enabled) {\r\n gfx.axes.render(renderer);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._onBgColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx) {\r\n if (gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onFogColorChanged = function () {\r\n const gfx = this._gfx;\r\n const color = chooseFogColor();\r\n if (gfx && gfx.scene.fog) {\r\n gfx.scene.fog.color.set(color);\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._setUberMaterialValues = function (values) {\r\n this._gfx.root.traverse((obj) => {\r\n if ((obj instanceof THREE.Mesh || obj instanceof THREE.LineSegments || obj instanceof THREE.Line)\r\n && obj.material instanceof UberMaterial) {\r\n obj.material.setValues(values);\r\n obj.material.needsUpdate = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._enableMRT = function (on, renderBuffer, textureBuffer) {\r\n const gfx = this._gfx;\r\n const gl = gfx.renderer.getContext();\r\n const ext = gl.getExtension('WEBGL_draw_buffers');\r\n const { properties } = gfx.renderer;\r\n\r\n if (!on) {\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, null]);\r\n return;\r\n }\r\n\r\n // take extra texture from Texture Buffer\r\n gfx.renderer.setRenderTarget(textureBuffer);\r\n const tx8 = properties.get(textureBuffer.texture).__webglTexture;\r\n gl.bindTexture(gl.TEXTURE_2D, tx8);\r\n\r\n // take texture and framebuffer from renderbuffer\r\n gfx.renderer.setRenderTarget(renderBuffer);\r\n const fb = properties.get(renderBuffer).__webglFramebuffer;\r\n const tx = properties.get(renderBuffer.texture).__webglTexture;\r\n\r\n // set framebuffer\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n fb.width = renderBuffer.width;\r\n fb.height = renderBuffer.height;\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tx, 0);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, ext.COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, tx8, 0);\r\n\r\n // mapping textures\r\n ext.drawBuffersWEBGL([gl.COLOR_ATTACHMENT0, ext.COLOR_ATTACHMENT1_WEBGL]);\r\n};\r\n\r\nMiew.prototype._renderScene = (function () {\r\n return function (camera, distortion, target) {\r\n distortion = distortion || false;\r\n target = target || null;\r\n\r\n const gfx = this._gfx;\r\n\r\n // render to offscreen buffer\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.clear();\r\n if (gfx.renderer.xr.enabled) {\r\n gfx.renderer.render(gfx.scene, camera);\r\n return;\r\n }\r\n\r\n // clean buffer for normals texture\r\n gfx.renderer.setClearColor(0x000000, 0.0);\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf4);\r\n gfx.renderer.clearColor();\r\n\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.clear();\r\n\r\n const bHaveComplexes = (this._getComplexVisual() !== null);\r\n const volumeVisual = this._getVolumeVisual();\r\n const ssao = bHaveComplexes && settings.now.ao;\r\n\r\n if (ssao) {\r\n this._enableMRT(true, gfx.offscreenBuf, gfx.offscreenBuf4);\r\n }\r\n\r\n if (settings.now.transparency === 'prepass') {\r\n this._renderWithPrepassTransparency(camera, gfx.offscreenBuf);\r\n } else if (settings.now.transparency === 'standard') {\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n }\r\n\r\n if (ssao) {\r\n this._enableMRT(false, null, null);\r\n }\r\n\r\n // when fxaa we should get resulting image in temp off-screen buff2 for further postprocessing with fxaa filter\r\n // otherwise we render to canvas\r\n const outline = bHaveComplexes && settings.now.outline.on;\r\n const fxaa = bHaveComplexes && settings.now.fxaa;\r\n const volume = (volumeVisual !== null) && (volumeVisual.getMesh().material != null);\r\n let dstBuffer = (ssao || outline || volume || fxaa || distortion) ? gfx.offscreenBuf2 : target;\r\n let srcBuffer = gfx.offscreenBuf;\r\n\r\n if (ssao) {\r\n this._performAO(\r\n srcBuffer,\r\n gfx.offscreenBuf4,\r\n gfx.offscreenBuf.depthTexture,\r\n dstBuffer,\r\n gfx.offscreenBuf3,\r\n gfx.offscreenBuf2,\r\n );\r\n if (!fxaa && !distortion && !volume && !outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = target;\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n } else {\r\n // just copy color buffer to dst buffer\r\n gfx.renderer.setRenderTarget(dstBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 1.0);\r\n }\r\n\r\n // outline\r\n if (outline) {\r\n srcBuffer = dstBuffer;\r\n dstBuffer = (volume || fxaa || distortion) ? gfx.offscreenBuf3 : target;\r\n if (srcBuffer != null) {\r\n this._renderOutline(camera, gfx.offscreenBuf, srcBuffer, dstBuffer);\r\n }\r\n }\r\n\r\n // render selected part with outline material\r\n this._renderSelection(camera, gfx.offscreenBuf, dstBuffer);\r\n\r\n if (volume) {\r\n // copy current picture to the buffer that retains depth-data of the original molecule render\r\n // so that volume renderer could use depth-test\r\n gfx.renderer.setRenderTarget(gfx.offscreenBuf);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n dstBuffer = gfx.offscreenBuf;\r\n this._renderVolume(volumeVisual, camera, dstBuffer, gfx.volBFTex, gfx.volFFTex, gfx.volWFFTex);\r\n\r\n // if this is the last stage -- copy image to target\r\n if (!fxaa && !distortion) {\r\n gfx.renderer.setRenderTarget(target);\r\n gfx.renderer.renderScreenQuadFromTex(dstBuffer.texture, 1.0);\r\n }\r\n }\r\n\r\n srcBuffer = dstBuffer;\r\n\r\n if (fxaa) {\r\n dstBuffer = distortion ? gfx.offscreenBuf4 : target;\r\n this._performFXAA(srcBuffer, dstBuffer);\r\n srcBuffer = dstBuffer;\r\n }\r\n\r\n if (distortion) {\r\n dstBuffer = target;\r\n this._performDistortion(srcBuffer, dstBuffer, true);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._performDistortion = (function () {\r\n const _scene = new THREE.Scene();\r\n const _camera = new THREE.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, -500, 1000);\r\n\r\n const _material = new THREE.RawShaderMaterial({\r\n uniforms: {\r\n srcTex: { type: 't', value: null },\r\n aberration: { type: 'fv3', value: new THREE.Vector3(1.0) },\r\n },\r\n vertexShader: vertexScreenQuadShader,\r\n fragmentShader: fragmentScreenQuadFromDistTex,\r\n transparent: false,\r\n depthTest: false,\r\n depthWrite: false,\r\n });\r\n\r\n const _geo = gfxutils.buildDistorionMesh(10, 10, settings.now.debug.stereoBarrel);\r\n _scene.add(new meshes.Mesh(_geo, _material));\r\n\r\n return function (srcBuffer, targetBuffer, mesh) {\r\n this._gfx.renderer.setRenderTarget(targetBuffer);\r\n this._gfx.renderer.clear();\r\n\r\n if (mesh) {\r\n _material.uniforms.srcTex.value = srcBuffer.texture;\r\n _material.uniforms.aberration.value.set(0.995, 1.0, 1.01);\r\n this._gfx.renderer.render(_scene, _camera);\r\n } else {\r\n this._gfx.renderer.renderScreenQuadFromTexWithDistortion(srcBuffer, settings.now.debug.stereoBarrel);\r\n }\r\n };\r\n}());\r\n\r\nMiew.prototype._renderOutline = (function () {\r\n const _outlineMaterial = new OutlineMaterial({ depth: true });\r\n\r\n return function (camera, srcDepthBuffer, srcColorBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcColorBuffer.texture;\r\n _outlineMaterial.uniforms.srcDepthTex.value = srcDepthBuffer.depthTexture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcDepthBuffer.width, srcDepthBuffer.height);\r\n _outlineMaterial.uniforms.color.value = new THREE.Color(settings.now.outline.color);\r\n _outlineMaterial.uniforms.threshold.value = settings.now.outline.threshold;\r\n _outlineMaterial.uniforms.thickness.value = new THREE.Vector2(\r\n settings.now.outline.thickness,\r\n settings.now.outline.thickness,\r\n );\r\n\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._renderShadowMap = (function () {\r\n const pars = { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };\r\n\r\n return function () {\r\n if (!settings.now.shadow.on) {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n const currentRenderTarget = gfx.renderer.getRenderTarget();\r\n const activeCubeFace = gfx.renderer.getActiveCubeFace();\r\n const activeMipmapLevel = gfx.renderer.getActiveMipmapLevel();\r\n\r\n const _state = gfx.renderer.state;\r\n\r\n // Set GL state for depth map.\r\n _state.setBlending(THREE.NoBlending);\r\n _state.buffers.color.setClear(1, 1, 1, 1);\r\n _state.buffers.depth.setTest(true);\r\n _state.setScissorTest(false);\r\n\r\n for (let i = 0; i < gfx.scene.children.length; i++) {\r\n if (gfx.scene.children[i].type === 'DirectionalLight') {\r\n const light = gfx.scene.children[i];\r\n\r\n if (light.shadow.map == null) {\r\n light.shadow.map = new THREE.WebGLRenderTarget(light.shadow.mapSize.width, light.shadow.mapSize.height, pars);\r\n light.shadow.camera.updateProjectionMatrix();\r\n }\r\n light.shadow.updateMatrices(light);\r\n\r\n gfx.renderer.setRenderTarget(light.shadow.map);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.render(gfx.scene, light.shadow.camera);\r\n }\r\n }\r\n gfx.renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);\r\n };\r\n}());\r\n\r\n/**\r\n * Check if there is selection which must be rendered or not.\r\n * @private\r\n * @returns {boolean} true on existing selection to render\r\n */\r\nMiew.prototype._hasSelectionToRender = function () {\r\n const selPivot = this._gfx.selectionPivot;\r\n\r\n for (let i = 0; i < selPivot.children.length; i++) {\r\n const selPivotChild = selPivot.children[i];\r\n if (selPivotChild.children.length > 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n\r\nMiew.prototype._renderSelection = (function () {\r\n const _outlineMaterial = new OutlineMaterial();\r\n\r\n return function (camera, srcBuffer, targetBuffer) {\r\n const self = this;\r\n const gfx = self._gfx;\r\n\r\n // clear offscreen buffer (leave z-buffer intact)\r\n gfx.renderer.setClearColor('black', 0);\r\n\r\n // render selection to offscreen buffer\r\n gfx.renderer.setRenderTarget(srcBuffer);\r\n gfx.renderer.clear(true, false, false);\r\n if (self._hasSelectionToRender()) {\r\n gfx.selectionRoot.matrix = gfx.root.matrix;\r\n gfx.selectionPivot.matrix = gfx.pivot.matrix;\r\n gfx.renderer.render(gfx.selectionScene, camera);\r\n } else {\r\n // just render something to force \"target clear\" operation to finish\r\n gfx.renderer.renderDummyQuad();\r\n }\r\n\r\n // overlay to screen\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuadFromTex(srcBuffer.texture, 0.6);\r\n\r\n // apply Sobel filter -- draw outline\r\n _outlineMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _outlineMaterial.uniforms.srcTexSize.value.set(srcBuffer.width, srcBuffer.height);\r\n gfx.renderer.renderScreenQuad(_outlineMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._checkVolumeRenderingSupport = function (renderTarget) {\r\n if (!renderTarget) {\r\n return false;\r\n }\r\n const gfx = this._gfx;\r\n const oldRT = gfx.renderer.getRenderTarget();\r\n\r\n gfx.renderer.setRenderTarget(renderTarget);\r\n const context = gfx.renderer.getContext();\r\n const result = context.checkFramebufferStatus(context.FRAMEBUFFER);\r\n gfx.renderer.setRenderTarget(oldRT);\r\n if (result !== context.FRAMEBUFFER_COMPLETE) {\r\n // floatFrameBufferWarning = ;\r\n this.logger.warn('Device doesn\\'t support electron density rendering');\r\n return false;\r\n }\r\n return true;\r\n};\r\n\r\nMiew.prototype._renderVolume = (function () {\r\n const volumeBFMat = new VolumeMaterial.BackFacePosMaterial();\r\n const volumeFFMat = new VolumeMaterial.FrontFacePosMaterial();\r\n const cubeOffsetMat = new THREE.Matrix4().makeTranslation(0.5, 0.5, 0.5);\r\n const world2colorMat = new THREE.Matrix4();\r\n\r\n let volumeRenderingSupported;\r\n\r\n return function (volumeVisual, camera, dstBuf, tmpBuf1, tmpBuf2, tmpBuf3) {\r\n const gfx = this._gfx;\r\n\r\n if (typeof volumeRenderingSupported === 'undefined') {\r\n volumeRenderingSupported = this._checkVolumeRenderingSupport(tmpBuf1);\r\n }\r\n\r\n if (!volumeRenderingSupported) {\r\n return;\r\n }\r\n\r\n const mesh = volumeVisual.getMesh();\r\n\r\n mesh.rebuild(gfx.camera);\r\n\r\n // use main camera to prepare special textures to be used by volumetric rendering\r\n // these textures have the size of the window and are stored in offscreen buffers\r\n gfx.renderer.setClearColor('black', 0);\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n gfx.renderer.clear();\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.clear();\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf1);\r\n // draw plane with its own material, because it differs slightly from volumeBFMat\r\n camera.layers.set(gfxutils.LAYERS.VOLUME_BFPLANE);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeBFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.renderer.setRenderTarget(tmpBuf2);\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.scene.overrideMaterial = volumeFFMat;\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n gfx.scene.overrideMaterial = null;\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n\r\n // prepare texture that contains molecule positions\r\n world2colorMat.copy(mesh.matrixWorld).invert();\r\n UberMaterial.prototype.uberOptions.world2colorMatrix.multiplyMatrices(cubeOffsetMat, world2colorMat);\r\n camera.layers.set(gfxutils.LAYERS.COLOR_FROM_POSITION);\r\n gfx.renderer.setRenderTarget(tmpBuf3);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // render volume\r\n const vm = mesh.material;\r\n vm.uniforms._BFRight.value = tmpBuf1.texture;\r\n vm.uniforms._FFRight.value = tmpBuf2.texture;\r\n vm.uniforms._WFFRight.value = tmpBuf3.texture;\r\n camera.layers.set(gfxutils.LAYERS.VOLUME);\r\n gfx.renderer.setRenderTarget(dstBuf);\r\n gfx.renderer.render(gfx.scene, camera);\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\n/* Render scene with 'ZPrepass transparency Effect'\r\n * Idea: transparent objects are rendered in two passes. The first one writes result only into depth buffer.\r\n * The second pass reads depth buffer and writes only to color buffer. The method results in\r\n * correct image of front part of the semi-transparent objects, but we can see only front transparent objects\r\n * and opaque objects inside, there is no transparent objects inside.\r\n * Notes: 1. Opaque objects should be rendered strictly before semi-transparent ones.\r\n * 2. Realization doesn't use camera layers because scene traversing is used for material changes and\r\n * we can use it to select needed meshes and don't complicate meshes builders with layers\r\n */\r\nMiew.prototype._renderWithPrepassTransparency = (function () {\r\n return function (camera, targetBuffer) {\r\n const gfx = this._gfx;\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n\r\n // opaque objects\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // transparent objects z prepass\r\n camera.layers.set(gfxutils.LAYERS.PREPASS_TRANSPARENT);\r\n gfx.renderer.getContext().colorMask(false, false, false, false); // don't update color buffer\r\n gfx.renderer.render(gfx.scene, camera);\r\n gfx.renderer.getContext().colorMask(true, true, true, true); // update color buffer\r\n\r\n // transparent objects color pass\r\n camera.layers.set(gfxutils.LAYERS.TRANSPARENT);\r\n gfx.renderer.render(gfx.scene, camera);\r\n\r\n // restore default layer\r\n camera.layers.set(gfxutils.LAYERS.DEFAULT);\r\n };\r\n}());\r\n\r\nMiew.prototype._performFXAA = (function () {\r\n const _fxaaMaterial = new FXAAMaterial();\r\n\r\n return function (srcBuffer, targetBuffer) {\r\n if (typeof srcBuffer === 'undefined' || typeof targetBuffer === 'undefined') {\r\n return;\r\n }\r\n\r\n const gfx = this._gfx;\r\n\r\n // clear canvas\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.clear();\r\n\r\n // do fxaa processing of offscreen buff2\r\n _fxaaMaterial.uniforms.srcTex.value = srcBuffer.texture;\r\n _fxaaMaterial.uniforms.srcTexelSize.value.set(1.0 / srcBuffer.width, 1.0 / srcBuffer.height);\r\n _fxaaMaterial.uniforms.bgColor.value.set(settings.now.bg.color);\r\n\r\n if (_fxaaMaterial.bgTransparent !== settings.now.bg.transparent) {\r\n _fxaaMaterial.setValues({ bgTransparent: settings.now.bg.transparent });\r\n _fxaaMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.renderScreenQuad(_fxaaMaterial);\r\n };\r\n}());\r\n\r\nMiew.prototype._performAO = (function () {\r\n const _aoMaterial = new AOMaterial();\r\n const _horBlurMaterial = new AOHorBlurMaterial();\r\n const _vertBlurMaterial = new AOVertBlurWithBlendMaterial();\r\n\r\n const _scale = new THREE.Vector3();\r\n return function (srcColorBuffer, normalBuffer, srcDepthTexture, targetBuffer, tempBuffer, tempBuffer1) {\r\n if (!srcColorBuffer || !normalBuffer || !srcDepthTexture || !targetBuffer || !tempBuffer || !tempBuffer1) {\r\n return;\r\n }\r\n const gfx = this._gfx;\r\n const tanHalfFOV = Math.tan(THREE.MathUtils.DEG2RAD * 0.5 * gfx.camera.fov);\r\n\r\n _aoMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _aoMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _aoMaterial.uniforms.normalTexture.value = normalBuffer.texture;\r\n _aoMaterial.uniforms.srcTexelSize.value.set(1.0 / srcColorBuffer.width, 1.0 / srcColorBuffer.height);\r\n _aoMaterial.uniforms.camNearFar.value.set(gfx.camera.near, gfx.camera.far);\r\n _aoMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _aoMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _aoMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n gfx.root.matrix.extractScale(_scale);\r\n _aoMaterial.uniforms.kernelRadius.value = settings.now.debug.ssaoKernelRadius * _scale.x;\r\n _aoMaterial.uniforms.depthThreshold.value = 2.0 * this._getBSphereRadius(); // diameter\r\n _aoMaterial.uniforms.factor.value = settings.now.debug.ssaoFactor;\r\n // N: should be tempBuffer1 for proper use of buffers (see buffers using outside the function)\r\n gfx.renderer.setRenderTarget(tempBuffer1);\r\n gfx.renderer.renderScreenQuad(_aoMaterial);\r\n\r\n _horBlurMaterial.uniforms.aoMap.value = tempBuffer1.texture;\r\n _horBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer1.width, 1.0 / tempBuffer1.height);\r\n _horBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n gfx.renderer.setRenderTarget(tempBuffer);\r\n gfx.renderer.renderScreenQuad(_horBlurMaterial);\r\n\r\n _vertBlurMaterial.uniforms.aoMap.value = tempBuffer.texture;\r\n _vertBlurMaterial.uniforms.diffuseTexture.value = srcColorBuffer.texture;\r\n _vertBlurMaterial.uniforms.srcTexelSize.value.set(1.0 / tempBuffer.width, 1.0 / tempBuffer.height);\r\n _vertBlurMaterial.uniforms.depthTexture.value = srcDepthTexture;\r\n _vertBlurMaterial.uniforms.projMatrix.value = gfx.camera.projectionMatrix;\r\n _vertBlurMaterial.uniforms.aspectRatio.value = gfx.camera.aspect;\r\n _vertBlurMaterial.uniforms.tanHalfFOV.value = tanHalfFOV;\r\n const { fog } = gfx.scene;\r\n if (fog) {\r\n _vertBlurMaterial.uniforms.fogNearFar.value.set(fog.near, fog.far);\r\n _vertBlurMaterial.uniforms.fogColor.value.set(fog.color.r, fog.color.g, fog.color.b, settings.now.fogAlpha);\r\n }\r\n if ((_vertBlurMaterial.useFog !== settings.now.fog)\r\n || (_vertBlurMaterial.fogTransparent !== settings.now.bg.transparent)) {\r\n _vertBlurMaterial.setValues({ useFog: settings.now.fog, fogTransparent: settings.now.bg.transparent });\r\n _vertBlurMaterial.needsUpdate = true;\r\n }\r\n gfx.renderer.setRenderTarget(targetBuffer);\r\n gfx.renderer.renderScreenQuad(_vertBlurMaterial);\r\n };\r\n}());\r\n\r\n/**\r\n * Reset the viewer, unload molecules.\r\n * @param {boolean=} keepReps - Keep representations while resetting viewer state.\r\n */\r\nMiew.prototype.reset = function (/* keepReps */) {\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._lastPick = null;\r\n\r\n this._releaseAllVisuals();\r\n\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._resetObjects();\r\n\r\n if (this._gfx) {\r\n gfxutils.clearTree(this._gfx.pivot);\r\n this._gfx.renderer2d.reset();\r\n }\r\n\r\n this.setNeedRender();\r\n};\r\n\r\nMiew.prototype._resetScene = function () {\r\n this._objectControls.reset();\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n this.resetReps();\r\n this.resetPivot();\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype.resetView = function () {\r\n // reset controls\r\n if (this._picker) {\r\n this._picker.reset();\r\n }\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._resetScene();\r\n\r\n // reset selection\r\n this._forEachComplexVisual((visual) => {\r\n visual.updateSelectionMask({});\r\n visual.rebuildSelectionGeometry();\r\n });\r\n};\r\n\r\nMiew.prototype._export = function (format) {\r\n const TheExporter = _.head(io.exporters.find({ format }));\r\n if (!TheExporter) {\r\n this.logger.error('Could not find suitable exporter for this source');\r\n return Promise.reject(new Error('Could not find suitable exporter for this source'));\r\n }\r\n this.dispatchEvent({ type: 'exporting' });\r\n\r\n if (this._visuals[this._curVisualName] instanceof ComplexVisual) {\r\n let dataSource = null;\r\n if (TheExporter.SourceClass === ComplexVisual) {\r\n dataSource = this._visuals[this._curVisualName];\r\n } else if (TheExporter.SourceClass === Complex) {\r\n dataSource = this._visuals[this._curVisualName]._complex;\r\n }\r\n const exporter = new TheExporter(dataSource, { miewVersion: Miew.VERSION });\r\n return exporter.export().then((data) => data);\r\n }\r\n if (this._visuals[this._curVisualName] instanceof VolumeVisual) {\r\n return Promise.reject(new Error('Sorry, exporter for volume data not implemented yet'));\r\n }\r\n return Promise.reject(new Error('Unexpected format of data'));\r\n};\r\n\r\nconst rePdbId = /^(?:(pdb|cif|ccp4|dsn6):\\s*)?(\\d[a-z\\d]{3})$/i;\r\nconst rePubchem = /^(?:pc|pubchem):\\s*([a-z]+)$/i;\r\nconst reUrlScheme = /^([a-z][a-z\\d\\-+.]*):/i;\r\n\r\nfunction resolveSourceShortcut(source, opts) {\r\n if (!_.isString(source)) {\r\n return source;\r\n }\r\n\r\n // e.g. \"cif:1CRN\"\r\n const matchesPdbId = rePdbId.exec(source);\r\n if (matchesPdbId) {\r\n let [, format = 'pdb', id] = matchesPdbId;\r\n\r\n format = format.toLowerCase();\r\n id = id.toUpperCase();\r\n\r\n switch (format) {\r\n case 'pdb':\r\n source = `https://files.rcsb.org/download/${id}.pdb`;\r\n break;\r\n case 'cif':\r\n source = `https://files.rcsb.org/download/${id}.cif`;\r\n break;\r\n case 'ccp4':\r\n source = `https://www.ebi.ac.uk/pdbe/coordinates/files/${id.toLowerCase()}.ccp4`;\r\n break;\r\n case 'dsn6':\r\n source = `https://edmaps.rcsb.org/maps/${id.toLowerCase()}_2fofc.dsn6`;\r\n break;\r\n default:\r\n throw new Error('Unexpected data format shortcut');\r\n }\r\n\r\n opts.fileType = format;\r\n opts.fileName = `${id}.${format}`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // e.g. \"pc:aspirin\"\r\n const matchesPubchem = rePubchem.exec(source);\r\n if (matchesPubchem) {\r\n const compound = matchesPubchem[1].toLowerCase();\r\n source = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${compound}/JSON?record_type=3d`;\r\n opts.fileType = 'pubchem';\r\n opts.fileName = `${compound}.json`;\r\n opts.sourceType = 'url';\r\n return source;\r\n }\r\n\r\n // otherwise is should be an URL\r\n if (opts.sourceType === 'url' || opts.sourceType === undefined) {\r\n opts.sourceType = 'url';\r\n\r\n // e.g. \"./data/1CRN.pdb\"\r\n if (!reUrlScheme.test(source)) {\r\n source = utils.resolveURL(source);\r\n }\r\n }\r\n\r\n return source;\r\n}\r\n\r\nfunction updateBinaryMode(opts) {\r\n let { binary } = opts;\r\n\r\n // detect by format\r\n if (opts.fileType !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n } else {\r\n throw new Error('Could not find suitable parser for this format');\r\n }\r\n }\r\n\r\n // detect by file extension\r\n if (binary === undefined && opts.fileExt !== undefined) {\r\n const TheParser = _.head(io.parsers.find({ ext: opts.fileExt }));\r\n if (TheParser) {\r\n binary = TheParser.binary || false;\r\n }\r\n }\r\n\r\n // temporary workaround for animation\r\n if (opts.fileExt !== undefined && opts.fileExt.toLowerCase() === '.man') {\r\n opts.binary = true;\r\n opts.animation = true; // who cares?\r\n }\r\n\r\n // update if detected\r\n if (binary !== undefined) {\r\n if (opts.binary !== undefined && opts.binary !== binary) {\r\n opts.context.logger.warn('Overriding incorrect binary mode');\r\n }\r\n }\r\n\r\n opts.binary = binary || false;\r\n}\r\n\r\nfunction _fetchData(source, opts, job) {\r\n return new Promise(((resolve) => {\r\n if (job.shouldCancel()) {\r\n throw new Error('Operation cancelled');\r\n }\r\n job.notify({ type: 'fetching' });\r\n\r\n // allow for source shortcuts\r\n source = resolveSourceShortcut(source, opts);\r\n\r\n // detect a proper loader\r\n const TheLoader = _.head(io.loaders.find({ type: opts.sourceType, source }));\r\n if (!TheLoader) {\r\n throw new Error(LOADER_NOT_FOUND);\r\n }\r\n\r\n // split file name\r\n const fileName = opts.fileName || TheLoader.extractName(source);\r\n if (fileName) {\r\n const [name, fileExt] = utils.splitFileName(fileName);\r\n _.defaults(opts, { name, fileExt, fileName });\r\n }\r\n\r\n // should it be text or binary?\r\n updateBinaryMode(opts);\r\n\r\n // FIXME: All new settings retrieved from server are applied after the loading is complete. However, we need some\r\n // flags to alter the loading process itself. Here we apply them in advance. Dirty hack. Kill the server, remove\r\n // all hacks and everybody's happy.\r\n let newOptions = _.get(opts, 'preset.expression');\r\n if (!_.isUndefined(newOptions)) {\r\n newOptions = JSON.parse(newOptions);\r\n if (newOptions && newOptions.settings) {\r\n const keys = ['singleUnit'];\r\n for (let keyIndex = 0, keyCount = keys.length; keyIndex < keyCount; ++keyIndex) {\r\n const key = keys[keyIndex];\r\n const value = _.get(newOptions.settings, key);\r\n if (!_.isUndefined(value)) {\r\n settings.set(key, value);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // create a loader\r\n const loader = new TheLoader(source, opts);\r\n loader.context = opts.context;\r\n job.addEventListener('cancel', () => loader.abort());\r\n\r\n loader.addEventListener('progress', (event) => {\r\n if (event.lengthComputable && event.total > 0) {\r\n reportProgress(loader.logger, 'Fetching', event.loaded / event.total);\r\n } else {\r\n reportProgress(loader.logger, 'Fetching');\r\n }\r\n });\r\n\r\n console.time('fetch');\r\n const promise = loader.load()\r\n .then((data) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.info('Fetching finished');\r\n job.notify({ type: 'fetchingDone', data });\r\n return data;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('fetch');\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Fetching failed');\r\n job.notify({ type: 'fetchingDone', error });\r\n throw error;\r\n });\r\n resolve(promise);\r\n }));\r\n}\r\n\r\nfunction _parseData(data, opts, job) {\r\n if (job.shouldCancel()) {\r\n return Promise.reject(new Error('Operation cancelled'));\r\n }\r\n\r\n job.notify({ type: 'parsing' });\r\n\r\n const TheParser = _.head(io.parsers.find({ format: opts.fileType, ext: opts.fileExt, data }));\r\n if (!TheParser) {\r\n return Promise.reject(new Error('Could not find suitable parser'));\r\n }\r\n\r\n const parser = new TheParser(data, opts);\r\n parser.context = opts.context;\r\n job.addEventListener('cancel', () => parser.abort());\r\n\r\n console.time('parse');\r\n return parser.parse()\r\n .then((dataSet) => {\r\n console.timeEnd('parse');\r\n job.notify({ type: 'parsingDone', data: dataSet });\r\n return dataSet;\r\n })\r\n .catch((error) => {\r\n console.timeEnd('parse');\r\n opts.error = error;\r\n opts.context.logger.debug(error.message);\r\n if (error.stack) {\r\n opts.context.logger.debug(error.stack);\r\n }\r\n opts.context.logger.error('Parsing failed');\r\n job.notify({ type: 'parsingDone', error });\r\n throw error;\r\n });\r\n}\r\n\r\n/**\r\n * Load molecule asynchronously.\r\n * @param {string|File} source - Molecule source to load (e.g. PDB ID, URL or File object).\r\n * @param {object=} opts - Options.\r\n * @param {string=} opts.sourceType - Data source type (e.g. 'url', 'file').\r\n * @param {string=} opts.fileType - Data contents type (e.g. 'pdb', 'cml').\r\n * @param {string=} opts.mdFile - .nc file path.\r\n * @param {boolean=} opts.keepRepsInfo - prevent reset of object and reps information.\r\n * @returns {Promise} name of the visual that was added to the viewer\r\n */\r\nMiew.prototype.load = function (source, opts) {\r\n opts = _.merge({}, opts, {\r\n context: this,\r\n });\r\n\r\n // for a single-file scenario\r\n if (!this.settings.now.use.multiFile) {\r\n // abort all loaders in progress\r\n if (this._loading.length) {\r\n this._loading.forEach((job) => {\r\n job.cancel();\r\n });\r\n this._loading.length = 0;\r\n }\r\n\r\n // reset\r\n if (!opts.animation) { // FIXME: sometimes it is set AFTERWARDS!\r\n this.reset(true);\r\n }\r\n }\r\n\r\n this._interpolator.reset();\r\n\r\n this.dispatchEvent({ type: 'loading', options: opts, source });\r\n\r\n const job = new JobHandle();\r\n this._loading.push(job);\r\n job.addEventListener('notification', (e) => {\r\n this.dispatchEvent(e.slaveEvent);\r\n });\r\n\r\n this._spinner.spin(this._container);\r\n\r\n const onLoadEnd = (anything) => {\r\n const jobIndex = this._loading.indexOf(job);\r\n if (jobIndex !== -1) {\r\n this._loading.splice(jobIndex, 1);\r\n }\r\n this._spinner.stop();\r\n this._refreshTitle();\r\n job.notify({ type: 'loadingDone', anything });\r\n return anything;\r\n };\r\n\r\n return _fetchData(source, opts, job)\r\n .then((data) => _parseData(data, opts, job))\r\n .then((object) => {\r\n const name = this._onLoad(object, opts);\r\n return onLoadEnd(name);\r\n })\r\n .catch((err) => {\r\n this.logger.error('Could not load data');\r\n this.logger.debug(err);\r\n throw onLoadEnd(err);\r\n });\r\n};\r\n\r\n/**\r\n * Unload molecule (delete corresponding visual).\r\n * @param {string=} name - name of the visual\r\n */\r\nMiew.prototype.unload = function (name) {\r\n this._removeVisual(name || this.getCurrentVisual());\r\n this.resetPivot();\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n};\r\n\r\n/**\r\n * Start new animation. Now is broken.\r\n * @param fileData - new data to animate\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._startAnimation = function (fileData) {\r\n this._stopAnimation();\r\n const self = this;\r\n const visual = this._getComplexVisual();\r\n if (visual === null) {\r\n this.logger.error('Unable to start animation - no molecule is loaded.');\r\n return;\r\n }\r\n try {\r\n this._frameInfo = new FrameInfo(\r\n visual.getComplex(),\r\n fileData,\r\n {\r\n onLoadStatusChanged() {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo ? self._frameInfo.isLoading : true,\r\n },\r\n });\r\n },\r\n onError(message) {\r\n self._stopAnimation();\r\n self.logger.error(message);\r\n },\r\n },\r\n );\r\n } catch (e) {\r\n this.logger.error('Animation file does not fit to current complex!');\r\n return;\r\n }\r\n this._continueAnimation();\r\n};\r\n\r\n/**\r\n * Pause current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._pauseAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n this._isAnimating = false;\r\n clearInterval(this._animInterval);\r\n this._animInterval = null;\r\n if (this._frameInfo) {\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: this._isAnimating,\r\n isLoading: this._frameInfo.isLoading,\r\n },\r\n });\r\n }\r\n};\r\n\r\n/**\r\n * Continue current animation after pausing. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._continueAnimation = function () {\r\n this._isAnimating = true;\r\n let minFrameTime = 1000 / settings.now.maxfps;\r\n minFrameTime = Number.isNaN(minFrameTime) ? 0 : minFrameTime;\r\n const self = this;\r\n const { pivot } = self._gfx;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.resetSelectionMask();\r\n visual.rebuildSelectionGeometry();\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n }\r\n this._animInterval = setInterval(() => {\r\n self.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: {\r\n isPlaying: self._isAnimating,\r\n isLoading: self._frameInfo.isLoading,\r\n },\r\n });\r\n if (self._frameInfo.frameIsReady) {\r\n pivot.updateToFrame(self._frameInfo);\r\n self._updateObjsToFrame(self._frameInfo);\r\n self._refreshTitle(` Frame ${self._frameInfo._currFrame} of ${self._frameInfo._framesCount\r\n } time interval - ${self._frameInfo._timeStep}`);\r\n try {\r\n self._frameInfo.nextFrame();\r\n } catch (e) {\r\n self.logger.error('Error during animation');\r\n self._stopAnimation();\r\n return;\r\n }\r\n self._needRender = true;\r\n }\r\n }, minFrameTime);\r\n};\r\n\r\n/**\r\n * Stop current animation. Now is broken.\r\n * @private\r\n * @deprecated until animation system refactoring.\r\n */\r\nMiew.prototype._stopAnimation = function () {\r\n if (this._animInterval === null) {\r\n return;\r\n }\r\n clearInterval(this._animInterval);\r\n this._frameInfo.disableEvents();\r\n this._frameInfo = null;\r\n this._animInterval = null;\r\n this.dispatchEvent({\r\n type: 'mdPlayerStateChanged',\r\n state: null,\r\n });\r\n};\r\n\r\n/**\r\n * Invoked upon successful loading of some data source\r\n * @param {DataSource} dataSource - Data source for visualization (molecular complex or other)\r\n * @param {object} opts - Options.\r\n * @private\r\n */\r\nMiew.prototype._onLoad = function (dataSource, opts) {\r\n const gfx = this._gfx;\r\n let visualName = null;\r\n\r\n if (opts.animation) {\r\n this._refreshTitle();\r\n this._startAnimation(dataSource);\r\n return null;\r\n }\r\n this._stopAnimation();\r\n if (!opts || !opts.keepRepsInfo) {\r\n this._opts.reps = null;\r\n this._opts._objects = null;\r\n }\r\n\r\n if (dataSource.id === 'Complex') {\r\n const complex = dataSource;\r\n\r\n // update title\r\n if (opts.fileName) {\r\n complex.name = complex.name || removeExtension(opts.fileName).toUpperCase();\r\n } else if (opts.amberFileName) {\r\n complex.name = complex.name || removeExtension(opts.amberFileName).toUpperCase();\r\n } else {\r\n complex.name = `Dynamic ${opts.fileType} molecule`;\r\n }\r\n\r\n visualName = this._addVisual(new ComplexVisual(complex.name, complex));\r\n this._curVisualName = visualName;\r\n\r\n const desc = this.info();\r\n this.logger.info(`Parsed ${opts.fileName} (${\r\n desc.atoms} atoms, ${\r\n desc.bonds} bonds, ${\r\n desc.residues} residues, ${\r\n desc.chains} chains).`);\r\n\r\n if (_.isNumber(this._opts.unit)) {\r\n complex.setCurrentUnit(this._opts.unit);\r\n }\r\n\r\n if (opts.preset) {\r\n // ...removed server access...\r\n } else if (settings.now.autoPreset) {\r\n switch (opts.fileType) {\r\n case 'cml':\r\n this.resetReps('small');\r\n break;\r\n case 'pdb':\r\n case 'mmtf':\r\n case 'cif':\r\n if (hasValidResidues(complex)) {\r\n this.resetReps('macro');\r\n } else {\r\n this.resetReps('small');\r\n }\r\n break;\r\n default:\r\n this.resetReps('default');\r\n break;\r\n }\r\n } else {\r\n this.resetReps('default');\r\n }\r\n } else if (dataSource.id === 'Volume') {\r\n this.resetEd();\r\n visualName = this._onLoadEd(dataSource);\r\n }\r\n\r\n gfx.camera.updateProjectionMatrix();\r\n this._updateFog();\r\n\r\n // reset global transform\r\n gfx.root.resetTransform();\r\n this.resetPivot();\r\n\r\n // set scale to fit everything on the screen\r\n this._objectControls.setScale(settings.now.radiusToFit / this._getBSphereRadius());\r\n\r\n this._resetObjects();\r\n\r\n if (settings.now.autoResolution) {\r\n this._tweakResolution();\r\n }\r\n\r\n if (settings.now.shadow.on) {\r\n this._updateShadowCamera();\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n this._refreshTitle();\r\n\r\n return visualName;\r\n};\r\n\r\nMiew.prototype.resetEd = function () {\r\n if (this._edLoader) {\r\n this._edLoader.abort();\r\n this._edLoader = null;\r\n }\r\n\r\n // free all resources\r\n this._removeVisual(this._getVolumeVisual());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype.loadEd = function (source) {\r\n this.resetEd();\r\n\r\n const TheLoader = _.head(io.loaders.find({ source }));\r\n if (!TheLoader) {\r\n this.logger.error(LOADER_NOT_FOUND);\r\n return Promise.reject(new Error(LOADER_NOT_FOUND));\r\n }\r\n\r\n const loader = this._edLoader = new TheLoader(source, { binary: true });\r\n loader.context = this;\r\n return loader.load().then((data) => {\r\n const TheParser = _.head(io.parsers.find({ format: 'ccp4' }));\r\n if (!TheParser) {\r\n throw new Error(PARSER_NOT_FOUND);\r\n }\r\n const parser = new TheParser(data);\r\n parser.context = this;\r\n return parser.parse().then((dataSource) => {\r\n this._onLoadEd(dataSource);\r\n });\r\n }).catch((error) => {\r\n this.logger.error('Could not load ED data');\r\n this.logger.debug(error);\r\n });\r\n};\r\n\r\nMiew.prototype._onLoadEd = function (dataSource) {\r\n dataSource.normalize();\r\n\r\n const volumeVisual = new VolumeVisual('volume', dataSource);\r\n volumeVisual.getMesh().layers.set(gfxutils.LAYERS.VOLUME); // volume mesh is not visible to common render\r\n const visualName = this._addVisual(volumeVisual);\r\n\r\n this._needRender = true;\r\n return visualName;\r\n};\r\n\r\nMiew.prototype._needRebuild = function () {\r\n let needsRebuild = false;\r\n this._forEachComplexVisual((visual) => {\r\n needsRebuild = needsRebuild || visual.needsRebuild();\r\n });\r\n return needsRebuild;\r\n};\r\n\r\nMiew.prototype._rebuildObjects = function () {\r\n const self = this;\r\n const gfx = this._gfx;\r\n let i;\r\n let n;\r\n\r\n // remove old object geometry\r\n const toRemove = [];\r\n for (i = 0; i < gfx.pivot.children.length; ++i) {\r\n const child = gfx.pivot.children[i];\r\n if (!(child instanceof Visual)) {\r\n toRemove.push(child);\r\n }\r\n }\r\n for (i = 0; i < toRemove.length; ++i) {\r\n toRemove[i].parent.remove(toRemove[i]);\r\n }\r\n\r\n setTimeout(() => {\r\n const objList = self._objects;\r\n for (i = 0, n = objList.length; i < n; ++i) {\r\n const obj = objList[i];\r\n if (obj.needsRebuild) {\r\n obj.build();\r\n }\r\n if (obj.getGeometry()) {\r\n gfx.pivot.add(obj.getGeometry());\r\n }\r\n }\r\n }, 10);\r\n};\r\n\r\nMiew.prototype.changeUnit = function (unitIdx, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n throw new Error('There is no complex to change!');\r\n }\r\n\r\n function currentUnitInfo() {\r\n const unit = visual ? visual.getComplex().getCurrentUnit() : 0;\r\n const type = unit > 0 ? (`Bio molecule ${unit}`) : 'Asymmetric unit';\r\n return `Current unit: ${unit} (${type})`;\r\n }\r\n\r\n if (unitIdx === undefined) {\r\n return currentUnitInfo();\r\n }\r\n if (_.isString(unitIdx)) {\r\n unitIdx = Math.max(parseInt(unitIdx, 10), 0);\r\n }\r\n if (visual.getComplex().setCurrentUnit(unitIdx)) {\r\n this._resetScene();\r\n this._updateInfoPanel();\r\n }\r\n return currentUnitInfo();\r\n};\r\n\r\n/**\r\n * Start to rebuild geometry asynchronously.\r\n */\r\nMiew.prototype.rebuild = function () {\r\n if (this._building) {\r\n this.logger.warn('Miew.rebuild(): already building!');\r\n return;\r\n }\r\n this._building = true;\r\n\r\n this.dispatchEvent({ type: 'rebuilding' });\r\n\r\n this._rebuildObjects();\r\n\r\n this._gfx.renderer2d.reset();\r\n\r\n const rebuildActions = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.needsRebuild()) {\r\n rebuildActions.push(visual.rebuild().then(() => new Promise(((resolve) => {\r\n visual.rebuildSelectionGeometry();\r\n resolve();\r\n }))));\r\n }\r\n });\r\n\r\n // Start asynchronous rebuild\r\n const self = this;\r\n this._spinner.spin(this._container);\r\n Promise.all(rebuildActions).then(() => {\r\n self._spinner.stop();\r\n\r\n self._needRender = true;\r\n\r\n self._refreshTitle();\r\n this.dispatchEvent({ type: 'buildingDone' });\r\n self._building = false;\r\n });\r\n};\r\n\r\n/** Mark all representations for rebuilding */\r\nMiew.prototype.rebuildAll = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setNeedsRebuild();\r\n });\r\n};\r\n\r\nMiew.prototype._refreshTitle = function (appendix) {\r\n let title;\r\n appendix = appendix === undefined ? '' : appendix;\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n title = visual.getComplex().name;\r\n const rep = visual.repGet(visual.repCurrent());\r\n title += (rep ? ` – ${rep.mode.name} Mode` : '');\r\n } else {\r\n title = Object.keys(this._visuals).length > 0 ? 'Unknown' : 'No Data';\r\n }\r\n title += appendix;\r\n\r\n this.dispatchEvent({ type: 'titleChanged', data: title });\r\n};\r\n\r\nMiew.prototype.setNeedRender = function () {\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._extractRepresentation = function () {\r\n const changed = [];\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCount() === 0) {\r\n return;\r\n }\r\n\r\n const selector = visual.buildSelectorFromMask(1 << visual.getSelectionBit());\r\n const defPreset = settings.now.presets.default;\r\n const res = visual.repAdd({\r\n selector,\r\n mode: defPreset[0].mode.id,\r\n colorer: defPreset[0].colorer.id,\r\n material: defPreset[0].material.id,\r\n });\r\n if (!res) {\r\n if (visual.repCount() === ComplexVisual.NUM_REPRESENTATION_BITS) {\r\n this.logger.warn(`Number of representations is limited to ${ComplexVisual.NUM_REPRESENTATION_BITS}`);\r\n }\r\n return;\r\n }\r\n\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n visual.repCurrent(res.index);\r\n\r\n changed.push(visual.name);\r\n });\r\n\r\n if (changed.length > 0) {\r\n this.logger.report(`New representation from selection for complexes: ${changed.join(', ')}`);\r\n }\r\n};\r\n\r\n/**\r\n * Change current representation list.\r\n * @param {array} reps - Representation list.\r\n */\r\nMiew.prototype._setReps = function (reps) {\r\n reps = reps || (this._opts && this._opts.reps) || [];\r\n this._forEachComplexVisual((visual) => visual.resetReps(reps));\r\n};\r\n\r\n/**\r\n * Apply existing preset to current scene.\r\n * @param preset\r\n */\r\nMiew.prototype.applyPreset = function (preset) {\r\n const { presets } = settings.now;\r\n const presList = [\r\n preset || settings.defaults.preset,\r\n settings.defaults.preset,\r\n Object.keys(presets)[0],\r\n ];\r\n let reps = null;\r\n for (let i = 0; !reps && i < presList.length; ++i) {\r\n settings.set('preset', presList[i]);\r\n reps = presets[settings.now.preset];\r\n if (!reps) {\r\n this.logger.warn(`Unknown preset \"${settings.now.preset}\"`);\r\n }\r\n }\r\n this._setReps(reps);\r\n};\r\n\r\n/**\r\n * Reset current representation list to initial values.\r\n * @param {string} [preset] - The source preset in case of uninitialized representation list.\r\n */\r\nMiew.prototype.resetReps = function (preset) {\r\n const reps = this._opts && this._opts.reps;\r\n if (reps) {\r\n this._setReps(reps);\r\n } else {\r\n this.applyPreset(preset);\r\n }\r\n};\r\n\r\n/**\r\n * Get number of representations created so far.\r\n * @returns {number} Number of reps.\r\n */\r\nMiew.prototype.repCount = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repCount() : 0;\r\n};\r\n\r\n/**\r\n * Get or set the current representation index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount()}. Defaults to the current one.\r\n * @param {string=} [name] - Complex name. Defaults to the current one.\r\n * @returns {number} The current index.\r\n */\r\nMiew.prototype.repCurrent = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n const newIdx = visual ? visual.repCurrent(index) : -1;\r\n if (index && newIdx !== index) {\r\n this.logger.warn(`Representation ${index} was not found. Current rep remains unchanged.`);\r\n }\r\n return newIdx;\r\n};\r\n\r\n/**\r\n * Get or set representation by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @param {object=} rep - Optional representation description.\r\n * @param {string=} rep.selector - Selector string.\r\n * @param {string=} rep.mode - Mode id.\r\n * @param {string=} rep.colorer - Colorer id.\r\n * @param {string=} rep.material - Material id.\r\n * @returns {?object} Representation description.\r\n */\r\nMiew.prototype.rep = function (index, rep) {\r\n const visual = this._getComplexVisual('');\r\n if (!visual) {\r\n return null;\r\n }\r\n const res = visual.rep(index, rep);\r\n if (res.status === 'created') {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name: visual.name });\r\n } else if (res.status === 'changed') {\r\n this.dispatchEvent({ type: 'repChanged', index: res.index, name: visual.name });\r\n }\r\n return res.desc;\r\n};\r\n\r\n/**\r\n * Get representation (not just description) by index.\r\n * @param {number=} index - Zero-based index, up to {@link Miew#repCount}(). Defaults to the current one.\r\n * @returns {?object} Representation.\r\n */\r\nMiew.prototype.repGet = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repGet(index) : null;\r\n};\r\n\r\n/**\r\n * Add new representation.\r\n * @param {object=} rep - Representation description.\r\n * @returns {number} Index of the new representation.\r\n */\r\nMiew.prototype.repAdd = function (rep, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return -1;\r\n }\r\n\r\n const res = visual.repAdd(rep);\r\n if (res) {\r\n this.dispatchEvent({ type: 'repAdded', index: res.index, name });\r\n return res.index;\r\n }\r\n return -1;\r\n};\r\n\r\n/**\r\n * Remove representation.\r\n * @param {number=} index - Zero-based representation index.\r\n */\r\nMiew.prototype.repRemove = function (index, name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n visual.repRemove(index);\r\n this.dispatchEvent({ type: 'repRemoved', index, name });\r\n};\r\n\r\n/**\r\n * Hide representation.\r\n * @param {number} index - Zero-based representation index.\r\n * @param {boolean=} hide - Specify false to make rep visible, true to hide (by default).\r\n */\r\nMiew.prototype.repHide = function (index, hide, name) {\r\n this._needRender = true;\r\n const visual = this._getComplexVisual(name);\r\n return visual ? visual.repHide(index, hide) : null;\r\n};\r\n\r\nMiew.prototype._setEditMode = function (mode) {\r\n this._editMode = mode;\r\n\r\n const elem = this._msgMode;\r\n if (elem) {\r\n elem.style.opacity = (mode === EDIT_MODE.COMPLEX) ? 0.0 : 1.0;\r\n\r\n if (mode !== EDIT_MODE.COMPLEX) {\r\n const t = elem.getElementsByTagName('p')[0];\r\n t.innerHTML = (mode === EDIT_MODE.COMPONENT) ? 'COMPONENT EDIT MODE' : 'FRAGMENT EDIT MODE';\r\n }\r\n }\r\n\r\n this.dispatchEvent({ type: 'editModeChanged', data: mode === EDIT_MODE.COMPLEX });\r\n};\r\n\r\nMiew.prototype._enterComponentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const editors = [];\r\n this._forEachComplexVisual((visual) => {\r\n const editor = visual.beginComponentEdit();\r\n if (editor) {\r\n editors.push(editor);\r\n }\r\n });\r\n\r\n if (editors === []) {\r\n return;\r\n }\r\n\r\n this._editors = editors;\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- ON');\r\n this._setEditMode(EDIT_MODE.COMPONENT);\r\n this._objectControls.keysTranslateObj(true);\r\n};\r\n\r\nMiew.prototype._applyComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardComponentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.COMPONENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n this._objectControls.keysTranslateObj(false);\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('COMPONENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n\r\n this._needRender = true;\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._enterFragmentEditMode = function () {\r\n if (this._editMode !== EDIT_MODE.COMPLEX) {\r\n return;\r\n }\r\n\r\n const selectedVisuals = [];\r\n this._forEachComplexVisual((visual) => {\r\n if (visual instanceof ComplexVisual\r\n && visual.getSelectionCount() > 0) {\r\n selectedVisuals.push(visual);\r\n }\r\n });\r\n\r\n if (selectedVisuals.length !== 1) {\r\n // either we have no selection or\r\n // we have selected atoms in two or more visuals -- not supported\r\n return;\r\n }\r\n\r\n const editor = selectedVisuals[0].beginFragmentEdit();\r\n if (!editor) {\r\n return;\r\n }\r\n this._editors = [editor];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- ON (single bond)');\r\n this._setEditMode(EDIT_MODE.FRAGMENT);\r\n this._objectControls.allowTranslation(false);\r\n this._objectControls.allowAltObjFreeRotation(editor.isFreeRotationAllowed());\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._applyFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].apply();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (applied)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this.rebuildAll();\r\n};\r\n\r\nMiew.prototype._discardFragmentEdit = function () {\r\n if (this._editMode !== EDIT_MODE.FRAGMENT) {\r\n return;\r\n }\r\n\r\n this._objectControls.stop();\r\n\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n this._editors[i].discard();\r\n }\r\n this._editors = [];\r\n\r\n this.logger.info('FRAGMENT EDIT MODE -- OFF (discarded)');\r\n this._setEditMode(EDIT_MODE.COMPLEX);\r\n this._objectControls.allowTranslation(true);\r\n this._objectControls.allowAltObjFreeRotation(true);\r\n\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._onPick = function (event) {\r\n if (!settings.now.picking) {\r\n // picking is disabled\r\n return;\r\n }\r\n\r\n if (this._animInterval !== null) {\r\n // animation playback is on\r\n return;\r\n }\r\n\r\n if (this._editMode === EDIT_MODE.FRAGMENT) {\r\n // prevent picking in fragment edit mode\r\n return;\r\n }\r\n\r\n if (this._objectControls.isEditingAltObj()) {\r\n // prevent picking during component rotation\r\n return;\r\n }\r\n\r\n // update last pick & find complex\r\n let complex = null;\r\n if (event.obj.atom) {\r\n complex = event.obj.atom.residue.getChain().getComplex();\r\n this._lastPick = event.obj.atom;\r\n } else if (event.obj.residue) {\r\n complex = event.obj.residue.getChain().getComplex();\r\n this._lastPick = event.obj.residue;\r\n } else if (event.obj.chain) {\r\n complex = event.obj.chain.getComplex();\r\n this._lastPick = event.obj.chain;\r\n } else if (event.obj.molecule) {\r\n complex = event.obj.molecule.complex;\r\n this._lastPick = event.obj.molecule;\r\n } else {\r\n this._lastPick = null;\r\n }\r\n\r\n function _updateSelection(visual) {\r\n visual.updateSelectionMask(event.obj);\r\n visual.rebuildSelectionGeometry();\r\n }\r\n\r\n // update visual\r\n if (complex) {\r\n const visual = this._getVisualForComplex(complex);\r\n if (visual) {\r\n _updateSelection(visual);\r\n this._needRender = true;\r\n }\r\n } else {\r\n this._forEachComplexVisual(_updateSelection);\r\n this._needRender = true;\r\n }\r\n\r\n this._updateInfoPanel();\r\n this.dispatchEvent(event);\r\n};\r\n\r\nMiew.prototype._onKeyDown = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n // editing keys\r\n if (settings.now.editing) {\r\n switch (event.code) {\r\n case 'KeyC':\r\n this._enterComponentEditMode();\r\n break;\r\n case 'KeyF':\r\n this._enterFragmentEditMode();\r\n break;\r\n case 'KeyA':\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._applyComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._applyFragmentEdit();\r\n break;\r\n default:\r\n break;\r\n }\r\n break;\r\n case 'KeyD':\r\n switch (this._editMode) {\r\n case EDIT_MODE.COMPONENT:\r\n this._discardComponentEdit();\r\n break;\r\n case EDIT_MODE.FRAGMENT:\r\n this._discardFragmentEdit();\r\n break;\r\n default:\r\n break;\r\n }\r\n break;\r\n default:\r\n }\r\n }\r\n\r\n // other keys\r\n switch (event.code) {\r\n case 'NumpadAdd':\r\n if (event.altKey) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.expandSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n }\r\n break;\r\n case 'NumpadSubtract':\r\n if (event.altKey) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._forEachComplexVisual((visual) => {\r\n visual.shrinkSelection();\r\n visual.rebuildSelectionGeometry();\r\n });\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n }\r\n break;\r\n default:\r\n }\r\n};\r\n\r\nMiew.prototype._onKeyUp = function (event) {\r\n if (!this._running || !this._hotKeysEnabled) {\r\n return;\r\n }\r\n\r\n if (event.code === 'KeyX') {\r\n this._extractRepresentation();\r\n }\r\n};\r\n\r\nMiew.prototype._updateInfoPanel = function () {\r\n const info = this._msgAtomInfo.getElementsByTagName('p')[0];\r\n let atom;\r\n let residue;\r\n\r\n let count = 0;\r\n this._forEachComplexVisual((visual) => {\r\n count += visual.getSelectionCount();\r\n });\r\n\r\n while (info.firstChild) {\r\n info.removeChild(info.firstChild);\r\n }\r\n\r\n if (count === 0) {\r\n this._msgAtomInfo.style.opacity = 0.0;\r\n return;\r\n }\r\n\r\n let firstLine = `${String(count)} atom${count !== 1 ? 's' : ''} selected`;\r\n if (this._lastPick !== null) {\r\n firstLine += ', the last pick:';\r\n }\r\n let secondLine = '';\r\n let aName = '';\r\n let coordLine = '';\r\n\r\n if (this._lastPick instanceof Atom) {\r\n atom = this._lastPick;\r\n residue = atom.residue;\r\n\r\n aName = atom.name;\r\n const location = (atom.location !== 32) ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space\r\n secondLine = `${atom.element.fullName} #${atom.serial}${location}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}.`;\r\n secondLine += aName;\r\n\r\n coordLine = `Coord: (${atom.position.x.toFixed(2).toString()},\\\r\n ${atom.position.y.toFixed(2).toString()},\\\r\n ${atom.position.z.toFixed(2).toString()})`;\r\n } else if (this._lastPick instanceof Residue) {\r\n residue = this._lastPick;\r\n\r\n secondLine = `${residue._type._fullName}: \\\r\n ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}`;\r\n } else if (this._lastPick instanceof Chain) {\r\n secondLine = `chain ${this._lastPick._name}`;\r\n } else if (this._lastPick instanceof Molecule) {\r\n secondLine = `molecule ${this._lastPick._name}`;\r\n }\r\n\r\n info.appendChild(document.createTextNode(firstLine));\r\n\r\n if (secondLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(secondLine));\r\n }\r\n\r\n if (coordLine !== '') {\r\n info.appendChild(document.createElement('br'));\r\n info.appendChild(document.createTextNode(coordLine));\r\n }\r\n\r\n this._msgAtomInfo.style.opacity = 1.0;\r\n};\r\n\r\nMiew.prototype._getAltObj = function () {\r\n if (this._editors) {\r\n let altObj = null;\r\n for (let i = 0; i < this._editors.length; ++i) {\r\n const nextAltObj = this._editors[i].getAltObj();\r\n if (nextAltObj.objects.length > 0) {\r\n if (altObj) {\r\n // we have selected atoms in two or more visuals -- not supported\r\n altObj = null;\r\n break;\r\n }\r\n altObj = nextAltObj;\r\n }\r\n }\r\n if (altObj) {\r\n return altObj;\r\n }\r\n }\r\n\r\n return {\r\n objects: [],\r\n pivot: new THREE.Vector3(0, 0, 0),\r\n };\r\n};\r\n\r\nMiew.prototype.resetPivot = (function () {\r\n const boundingBox = new THREE.Box3();\r\n const center = new THREE.Vector3();\r\n\r\n return function () {\r\n boundingBox.makeEmpty();\r\n this._forEachVisual((visual) => {\r\n boundingBox.union(visual.getBoundaries().boundingBox);\r\n });\r\n\r\n boundingBox.getCenter(center);\r\n this._objectControls.setPivot(center.negate());\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotResidue = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (residue) {\r\n const visual = this._getVisualForComplex(residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n if (residue._controlPoint) {\r\n center.copy(residue._controlPoint);\r\n } else {\r\n let x = 0;\r\n let y = 0;\r\n let z = 0;\r\n const amount = residue._atoms.length;\r\n for (let i = 0; i < amount; ++i) {\r\n const p = residue._atoms[i].position;\r\n x += p.x / amount;\r\n y += p.y / amount;\r\n z += p.z / amount;\r\n }\r\n center.set(x, y, z);\r\n }\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotAtom = (function () {\r\n const center = new THREE.Vector3();\r\n\r\n return function (atom) {\r\n const visual = this._getVisualForComplex(atom.residue.getChain().getComplex());\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n center.copy(atom.position);\r\n center.applyMatrix4(visual.matrix).negate();\r\n this._objectControls.setPivot(center);\r\n this.dispatchEvent({ type: 'transform' });\r\n };\r\n}());\r\n\r\nMiew.prototype.getSelectionCenter = (function () {\r\n const _centerInVisual = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n return function (center, includesAtom, selector) {\r\n center.set(0.0, 0.0, 0.0);\r\n let count = 0;\r\n\r\n this._forEachComplexVisual((visual) => {\r\n if (visual.getSelectionCenter(_centerInVisual, includesAtom, selector || visual.getSelectionBit())) {\r\n center.add(_centerInVisual);\r\n count++;\r\n }\r\n });\r\n if (count === 0) {\r\n return false;\r\n }\r\n center.divideScalar(count);\r\n center.negate();\r\n return true;\r\n };\r\n}());\r\n\r\nMiew.prototype.setPivotSubset = (function () {\r\n const _center = new THREE.Vector3(0.0, 0.0, 0.0);\r\n\r\n function _includesInCurSelection(atom, selectionBit) {\r\n return atom.mask & (1 << selectionBit);\r\n }\r\n\r\n function _includesInSelector(atom, selector) {\r\n return selector.selector.includesAtom(atom);\r\n }\r\n\r\n return function (selector) {\r\n const includesAtom = (selector) ? _includesInSelector : _includesInCurSelection;\r\n\r\n if (this.getSelectionCenter(_center, includesAtom, selector)) {\r\n this._objectControls.setPivot(_center);\r\n this.dispatchEvent({ type: 'transform' });\r\n } else {\r\n this.logger.warn('selection is empty. Center operation not performed');\r\n }\r\n };\r\n}());\r\n\r\n/**\r\n * Makes a screenshot.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n * @returns {string} Data URL representing the image contents.\r\n */\r\nMiew.prototype.screenshot = function (width, height) {\r\n const gfx = this._gfx;\r\n const deviceWidth = gfx.renderer.domElement.width;\r\n const deviceHeight = gfx.renderer.domElement.height;\r\n\r\n function fov2Tan(fov) {\r\n return Math.tan(THREE.MathUtils.degToRad(0.5 * fov));\r\n }\r\n\r\n function tan2Fov(tan) {\r\n return THREE.MathUtils.radToDeg(Math.atan(tan)) * 2.0;\r\n }\r\n\r\n function getDataURL() {\r\n let dataURL;\r\n const currBrowser = utils.getBrowser();\r\n\r\n if (currBrowser === utils.browserType.SAFARI) {\r\n const canvas = document.createElement('canvas');\r\n const canvasContext = canvas.getContext('2d');\r\n\r\n canvas.width = width === undefined ? deviceWidth : width;\r\n canvas.height = height === undefined ? deviceHeight : height;\r\n\r\n canvasContext.drawImage(gfx.renderer.domElement, 0, 0, canvas.width, canvas.height);\r\n dataURL = canvas.toDataURL('image/png');\r\n } else {\r\n // Copy current canvas to screenshot\r\n dataURL = gfx.renderer.domElement.toDataURL('image/png');\r\n }\r\n return dataURL;\r\n }\r\n height = height || width;\r\n\r\n let screenshotURI;\r\n if ((width === undefined && height === undefined)\r\n || (width === deviceWidth && height === deviceHeight)) {\r\n // renderer.domElement.toDataURL('image/png') returns flipped image in Safari\r\n // It hasn't been resolved yet, but getScreenshotSafari()\r\n // fixes it using an extra canvas.\r\n screenshotURI = getDataURL();\r\n } else {\r\n const originalAspect = gfx.camera.aspect;\r\n const originalFov = gfx.camera.fov;\r\n const originalTanFov2 = fov2Tan(gfx.camera.fov);\r\n\r\n // screenshot should contain the principal area of interest (a centered square touching screen sides)\r\n const areaOfInterestSize = Math.min(gfx.width, gfx.height);\r\n const areaOfInterestTanFov2 = originalTanFov2 * areaOfInterestSize / gfx.height;\r\n\r\n // set appropriate camera aspect & FOV\r\n const shotAspect = width / height;\r\n gfx.renderer.setPixelRatio(1);\r\n gfx.camera.aspect = shotAspect;\r\n gfx.camera.fov = tan2Fov(areaOfInterestTanFov2 / Math.min(shotAspect, 1.0));\r\n gfx.camera.updateProjectionMatrix();\r\n\r\n // resize canvas to the required size of screenshot\r\n gfx.renderer.setDrawingBufferSize(width, height, 1);\r\n\r\n // make screenshot\r\n this._renderFrame(settings.now.stereo);\r\n screenshotURI = getDataURL();\r\n\r\n // restore original camera & canvas proportions\r\n gfx.renderer.setPixelRatio(window.devicePixelRatio);\r\n gfx.camera.aspect = originalAspect;\r\n gfx.camera.fov = originalFov;\r\n gfx.camera.updateProjectionMatrix();\r\n gfx.renderer.setDrawingBufferSize(gfx.width, gfx.height, window.devicePixelRatio);\r\n this._needRender = true;\r\n }\r\n\r\n return screenshotURI;\r\n};\r\n\r\n/**\r\n * Makes screenshot and initiates a download.\r\n * @param {string} [filename] - Name of a file. Default to a 'screenshot-XXXXX.png', where XXXXX is a current\r\n * date/time in seconds.\r\n * @param {number} [width] - Width of an image. Defaults to the canvas width.\r\n * @param {number} [height] - Height of an image. Defaults to the width (square) or canvas height,\r\n * if width is omitted too.\r\n */\r\nMiew.prototype.screenshotSave = function (filename, width, height) {\r\n const uri = this.screenshot(width, height);\r\n utils.shotDownload(uri, filename);\r\n};\r\n\r\nMiew.prototype.save = function (opts) {\r\n this._export(opts.fileType).then((dataString) => {\r\n const filename = this._visuals[this._curVisualName]._complex.name;\r\n utils.download(dataString, filename, opts.fileType);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone' });\r\n }).catch((error) => {\r\n this.logger.error('Could not export data');\r\n this.logger.debug(error);\r\n this._refreshTitle();\r\n this.dispatchEvent({ type: 'exportingDone', error });\r\n });\r\n};\r\n\r\nMiew.prototype._tweakResolution = function () {\r\n const maxPerf = [\r\n ['poor', 100],\r\n ['low', 500],\r\n ['medium', 1000],\r\n ['high', 5000],\r\n ['ultra', Number.MAX_VALUE],\r\n ];\r\n\r\n let atomCount = 0;\r\n this._forEachComplexVisual((visual) => {\r\n atomCount += visual.getComplex().getAtomCount();\r\n });\r\n\r\n if (atomCount > 0) {\r\n const performance = this._gfxScore * 10e5 / atomCount;\r\n // set resolution based on estimated performance\r\n for (let i = 0; i < maxPerf.length; ++i) {\r\n if (performance < maxPerf[i][1]) {\r\n this._autoChangeResolution(maxPerf[i][0]);\r\n break;\r\n }\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._autoChangeResolution = function (resolution) {\r\n if (resolution !== settings.now.resolution) {\r\n this.logger.report(`Your rendering resolution was changed to \"${resolution}\" for best performance.`);\r\n }\r\n settings.now.resolution = resolution;\r\n};\r\n\r\n/**\r\n * Save current settings to cookies.\r\n */\r\nMiew.prototype.saveSettings = function () {\r\n this._cookies.setCookie(this._opts.settingsCookie, JSON.stringify(this.settings.getDiffs(true)));\r\n};\r\n\r\n/**\r\n * Load settings from cookies.\r\n */\r\nMiew.prototype.restoreSettings = function () {\r\n try {\r\n const cookie = this._cookies.getCookie(this._opts.settingsCookie);\r\n const diffs = cookie ? JSON.parse(cookie) : {};\r\n this.settings.applyDiffs(diffs, true);\r\n } catch (e) {\r\n this.logger.error(`Cookies parse error: ${e.message}`);\r\n }\r\n};\r\n\r\n/**\r\n * Reset current settings to the defaults.\r\n */\r\nMiew.prototype.resetSettings = function () {\r\n this.settings.reset();\r\n};\r\n\r\n/*\r\n * DANGEROUS and TEMPORARY. The method should change or disappear in future versions.\r\n * @param {string|object} opts - See {@link Miew} constructor.\r\n * @see {@link Miew#set}, {@link Miew#repAdd}, {@link Miew#rep}.\r\n */\r\nMiew.prototype.setOptions = function (opts) {\r\n if (typeof opts === 'string') {\r\n opts = Miew.options.fromAttr(opts);\r\n }\r\n if (opts.reps) {\r\n this._opts.reps = null;\r\n }\r\n _.merge(this._opts, opts);\r\n if (opts.settings) {\r\n this.set(opts.settings);\r\n }\r\n\r\n this._opts._objects = opts._objects;\r\n this._resetObjects();\r\n\r\n if (opts.load) {\r\n this.load(opts.load, { fileType: opts.type });\r\n }\r\n\r\n if (opts.preset) {\r\n settings.now.preset = opts.preset;\r\n }\r\n\r\n if (opts.reps) {\r\n this.resetReps(opts.preset);\r\n }\r\n\r\n if (this._opts.view) {\r\n this.view(this._opts.view);\r\n delete this._opts.view;\r\n }\r\n\r\n const visual = this._getComplexVisual();\r\n if (visual) {\r\n visual.getComplex().resetCurrentUnit();\r\n if (_.isNumber(opts.unit)) {\r\n visual.getComplex().setCurrentUnit(opts.unit);\r\n }\r\n this.resetView();\r\n this.rebuildAll();\r\n }\r\n};\r\n\r\nMiew.prototype.info = function (name) {\r\n const visual = this._getComplexVisual(name);\r\n if (!visual) {\r\n return {};\r\n }\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n return {\r\n id: metadata.id || complex.name || 'UNKNOWN',\r\n title: (metadata.title && metadata.title.join(' ')) || 'UNKNOWN DATA',\r\n atoms: complex.getAtomCount(),\r\n bonds: complex.getBondCount(),\r\n residues: complex.getResidueCount(),\r\n chains: complex.getChainCount(),\r\n };\r\n};\r\n\r\n/*\r\n * OBJECTS SEGMENT\r\n */\r\n\r\nMiew.prototype.addObject = function (objData, bThrow) {\r\n let Ctor = null;\r\n\r\n if (objData.type === LinesObject.prototype.type) {\r\n Ctor = LinesObject;\r\n }\r\n\r\n if (Ctor === null) {\r\n throw new Error(`Unknown scene object type - ${objData.type}`);\r\n }\r\n\r\n try {\r\n const newObj = new Ctor(objData.params, objData.opts);\r\n this._addSceneObject(newObj);\r\n } catch (error) {\r\n if (!bThrow) {\r\n this.logger.debug(`Error during scene object creation: ${error.message}`);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n this._needRender = true;\r\n};\r\n\r\nMiew.prototype._addSceneObject = function (sceneObject) {\r\n const visual = this._getComplexVisual();\r\n if (sceneObject.build && visual) {\r\n sceneObject.build(visual.getComplex());\r\n this._gfx.pivot.add(sceneObject.getGeometry());\r\n }\r\n const objects = this._objects;\r\n objects[objects.length] = sceneObject;\r\n};\r\n\r\nMiew.prototype._updateObjsToFrame = function (frameData) {\r\n const objs = this._objects;\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n if (objs[i].updateToFrame) {\r\n objs[i].updateToFrame(frameData);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._resetObjects = function () {\r\n const objs = this._opts._objects;\r\n\r\n this._objects = [];\r\n if (objs) {\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n this.addObject(objs[i], false);\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype.removeObject = function (index) {\r\n const obj = this._objects[index];\r\n if (!obj) {\r\n throw new Error(`Scene object with index ${index} does not exist`);\r\n }\r\n obj.destroy();\r\n this._objects.splice(index, 1);\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Get a string with a URL to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {string} URL\r\n */\r\nMiew.prototype.getURL = function (opts) {\r\n return options.toURL(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n })));\r\n};\r\n\r\n/**\r\n * Get a string with a script to reproduce the current scene.\r\n *\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=true] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=true] - when this flag is true, a view information is included\r\n * @returns {string} script\r\n */\r\nMiew.prototype.getScript = function (opts) {\r\n return options.toScript(this.getState(_.defaults(opts, {\r\n compact: true,\r\n settings: true,\r\n view: true,\r\n })));\r\n};\r\n\r\n/*\r\n * Generates object that represents the current state of representations list\r\n * @param {boolean} compareWithDefaults - when this flag is true, reps list is compared (if possible)\r\n * to preset's defaults and only diffs are generated\r\n */\r\nMiew.prototype._compareReps = function (complexVisual, compareWithDefaults) {\r\n const ans = {};\r\n let repCount = 0;\r\n\r\n if (complexVisual) {\r\n repCount = complexVisual.repCount();\r\n }\r\n\r\n const currPreset = settings.defaults.presets[settings.now.preset];\r\n let compare = compareWithDefaults;\r\n if (currPreset === undefined || currPreset.length > repCount) {\r\n compare = false;\r\n ans.preset = 'empty';\r\n } else if (settings.now.preset !== settings.defaults.preset) {\r\n ans.preset = settings.now.preset;\r\n }\r\n\r\n const repsDiff = [];\r\n let emptyReps = true;\r\n for (let i = 0, n = repCount; i < n; ++i) {\r\n repsDiff[i] = complexVisual.repGet(i).compare(compare ? currPreset[i] : null);\r\n if (!_.isEmpty(repsDiff[i])) {\r\n emptyReps = false;\r\n }\r\n }\r\n if (!emptyReps) {\r\n ans.reps = repsDiff;\r\n }\r\n return ans;\r\n};\r\n\r\n/*\r\n * Obtain object that represents current state of miew (might be used as options in constructor).\r\n * @param {boolean} [opts.compact=true] - set this flag to false if you want to include full\r\n * preset information regardless of the differences with settings\r\n * @param {boolean} [opts.settings=false] - when this flag is true, changes in settings are included\r\n * @param {boolean} [opts.view=false] - when this flag is true, a view information is included\r\n * @returns {Object} State object.\r\n */\r\nMiew.prototype.getState = function (opts) {\r\n const state = {};\r\n\r\n opts = _.defaults(opts, {\r\n compact: true,\r\n settings: false,\r\n view: false,\r\n });\r\n\r\n // load\r\n const visual = this._getComplexVisual();\r\n if (visual !== null) {\r\n const complex = visual.getComplex();\r\n const { metadata } = complex;\r\n if (metadata.id) {\r\n const format = metadata.format ? `${metadata.format}:` : '';\r\n state.load = format + metadata.id;\r\n }\r\n const unit = complex.getCurrentUnit();\r\n if (unit !== 1) {\r\n state.unit = unit;\r\n }\r\n }\r\n\r\n // representations\r\n const repsInfo = this._compareReps(visual, opts.compact);\r\n if (repsInfo.preset) {\r\n state.preset = repsInfo.preset;\r\n }\r\n\r\n if (repsInfo.reps) {\r\n state.reps = repsInfo.reps;\r\n }\r\n\r\n // objects\r\n const objects = this._objects;\r\n const objectsState = [];\r\n for (let i = 0, n = objects.length; i < n; ++i) {\r\n objectsState[i] = objects[i].identify();\r\n }\r\n if (objects.length > 0) {\r\n state._objects = objectsState;\r\n }\r\n\r\n // view\r\n if (opts.view) {\r\n state.view = this.view();\r\n }\r\n\r\n // settings\r\n if (opts.settings) {\r\n const diff = this.settings.getDiffs(false);\r\n if (!_.isEmpty(diff)) {\r\n state.settings = diff;\r\n }\r\n }\r\n\r\n return state;\r\n};\r\n\r\n/**\r\n * Get parameter value.\r\n * @param {string} param - Parameter name or path (e.g. 'modes.BS.atom').\r\n * @param {*=} value - Default value.\r\n * @returns {*} Parameter value.\r\n */\r\nMiew.prototype.get = function (param, value) {\r\n return settings.get(param, value);\r\n};\r\n\r\nMiew.prototype._clipPlaneUpdateValue = function (radius) {\r\n const clipPlaneValue = Math.max(\r\n this._gfx.camera.position.z - radius * settings.now.draft.clipPlaneFactor,\r\n settings.now.camNear,\r\n );\r\n\r\n const opts = { clipPlaneValue };\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions(opts);\r\n });\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setUberOptions(opts);\r\n }\r\n }\r\n if (this._picker !== null) {\r\n this._picker.clipPlaneValue = clipPlaneValue;\r\n }\r\n};\r\n\r\nMiew.prototype._fogFarUpdateValue = function () {\r\n if (this._picker !== null) {\r\n if (this._gfx.scene.fog) {\r\n this._picker.fogFarValue = this._gfx.scene.fog.far;\r\n } else {\r\n this._picker.fogFarValue = undefined;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._updateShadowmapMeshes = function (process) {\r\n this._forEachComplexVisual((visual) => {\r\n const reprList = visual._reprList;\r\n for (let i = 0, n = reprList.length; i < n; ++i) {\r\n const repr = reprList[i];\r\n process(repr.geo, repr.material);\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype._updateMaterials = function (values, needTraverse = false, process = undefined) {\r\n this._forEachComplexVisual((visual) => visual.setMaterialValues(values, needTraverse, process));\r\n for (let i = 0, n = this._objects.length; i < n; ++i) {\r\n const obj = this._objects[i];\r\n if (obj._line) {\r\n obj._line.material.setValues(values);\r\n obj._line.material.needsUpdate = true;\r\n }\r\n }\r\n};\r\n\r\nMiew.prototype._fogAlphaChanged = function () {\r\n this._forEachComplexVisual((visual) => {\r\n visual.setUberOptions({\r\n fogAlpha: settings.now.fogAlpha,\r\n });\r\n });\r\n};\r\n\r\nMiew.prototype._embedWebXR = function () {\r\n // switch off\r\n if (settings.now.stereo !== 'WEBVR') {\r\n if (this.webVR) {\r\n this.webVR.disable();\r\n }\r\n this.webVR = null;\r\n return;\r\n }\r\n // switch on\r\n if (!this.webVR) {\r\n this.webVR = new WebVRPoC(() => {\r\n this._requestAnimationFrame(() => this._onTick());\r\n this._needRender = true;\r\n this._onResize();\r\n });\r\n }\r\n this.webVR.enable(this._gfx);\r\n};\r\n\r\nMiew.prototype._initOnSettingsChanged = function () {\r\n const on = (props, func) => {\r\n props = _.isArray(props) ? props : [props];\r\n props.forEach((prop) => {\r\n this.settings.addEventListener(`change:${prop}`, func);\r\n });\r\n };\r\n\r\n on('modes.VD.frame', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.showFrame(settings.now.modes.VD.frame);\r\n this._needRender = true;\r\n });\r\n\r\n on('modes.VD.isoMode', () => {\r\n const volume = this._getVolumeVisual();\r\n if (volume === null) return;\r\n\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n });\r\n\r\n on('bg.color', () => {\r\n this._onBgColorChanged();\r\n });\r\n\r\n on('ao', () => {\r\n if (settings.now.ao && !isAOSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support ao');\r\n settings.set('ao', false);\r\n } else {\r\n const values = { normalsToGBuffer: settings.now.ao };\r\n this._setUberMaterialValues(values);\r\n }\r\n });\r\n\r\n on('zSprites', () => {\r\n if (settings.now.zSprites && !arezSpritesSupported(this._gfx.renderer.getContext())) {\r\n this.logger.warn('Your device or browser does not support zSprites');\r\n settings.set('zSprites', false);\r\n }\r\n this.rebuildAll();\r\n });\r\n\r\n on('fogColor', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('fogColorEnable', () => {\r\n this._onFogColorChanged();\r\n });\r\n\r\n on('bg.transparent', (evt) => {\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.setClearColor(settings.now.bg.color, Number(!settings.now.bg.transparent));\r\n }\r\n // update materials\r\n this._updateMaterials({ fogTransparent: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('draft.clipPlane', (evt) => {\r\n // update materials\r\n this._updateMaterials({ clipPlane: evt.value });\r\n this.rebuildAll();\r\n });\r\n\r\n on('shadow.on', (evt) => {\r\n // update materials\r\n const values = { shadowmap: evt.value, shadowmapType: settings.now.shadow.type };\r\n const gfx = this._gfx;\r\n if (gfx) {\r\n gfx.renderer.shadowMap.enabled = Boolean(values.shadowmap);\r\n }\r\n this._updateMaterials(values, true);\r\n if (values.shadowmap) {\r\n this._updateShadowCamera();\r\n this._updateShadowmapMeshes(meshutils.createShadowmapMaterial);\r\n } else {\r\n this._updateShadowmapMeshes(meshutils.removeShadowmapMaterial);\r\n }\r\n this._needRender = true;\r\n });\r\n\r\n on('shadow.type', (evt) => {\r\n // update materials if shadowmap is enable\r\n if (settings.now.shadow.on) {\r\n this._updateMaterials({ shadowmapType: evt.value }, true);\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on('shadow.radius', (evt) => {\r\n for (let i = 0; i < this._gfx.scene.children.length; i++) {\r\n if (this._gfx.scene.children[i].shadow !== undefined) {\r\n const light = this._gfx.scene.children[i];\r\n light.shadow.radius = evt.value;\r\n this._needRender = true;\r\n }\r\n }\r\n });\r\n\r\n on('fps', () => {\r\n this._fps.show(settings.now.fps);\r\n });\r\n\r\n on(['fog', 'fogNearFactor', 'fogFarFactor'], () => {\r\n this._updateFog();\r\n this._needRender = true;\r\n });\r\n\r\n on('fogAlpha', () => {\r\n const { fogAlpha } = settings.now;\r\n if (fogAlpha < 0 || fogAlpha > 1) {\r\n this.logger.warn('fogAlpha must belong range [0,1]');\r\n }\r\n this._fogAlphaChanged();\r\n this._needRender = true;\r\n });\r\n\r\n on('autoResolution', (evt) => {\r\n if (evt.value && !this._gfxScore) {\r\n this.logger.warn('Benchmarks are missed, autoresolution will not work! '\r\n + 'Autoresolution should be set during miew startup.');\r\n }\r\n });\r\n\r\n on('stereo', () => {\r\n this._embedWebXR(settings.now.stereo === 'WEBVR');\r\n this._needRender = true;\r\n });\r\n\r\n on(['transparency', 'palette'], () => {\r\n this.rebuildAll();\r\n });\r\n\r\n on('resolution', () => {\r\n // update complex visuals\r\n this.rebuildAll();\r\n\r\n // update volume visual\r\n const volume = this._getVolumeVisual();\r\n if (volume) {\r\n volume.getMesh().material.updateDefines();\r\n this._needRender = true;\r\n }\r\n });\r\n\r\n on(['axes', 'fxaa', 'ao',\r\n 'outline.on', 'outline.color', 'outline.threshold', 'outline.thickness'], () => {\r\n this._needRender = true;\r\n });\r\n};\r\n\r\n/**\r\n * Set parameter value.\r\n * @param {string|object} params - Parameter name or path (e.g. 'modes.BS.atom') or even settings object.\r\n * @param {*=} value - Value.\r\n */\r\nMiew.prototype.set = function (params, value) {\r\n settings.set(params, value);\r\n};\r\n\r\n/**\r\n * Select atoms with selection string.\r\n * @param {string} expression - string expression of selection\r\n * @param {boolean=} append - true to append selection atoms to current selection, false to rewrite selection\r\n */\r\nMiew.prototype.select = function (expression, append) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return;\r\n }\r\n\r\n let sel = expression;\r\n if (_.isString(expression)) {\r\n sel = selectors.parse(expression).selector;\r\n }\r\n\r\n visual.select(sel, append);\r\n this._lastPick = null;\r\n\r\n this._updateInfoPanel();\r\n this._needRender = true;\r\n};\r\n\r\nconst VIEW_VERSION = '1';\r\n\r\n/**\r\n * Get or set view info packed into string.\r\n *\r\n * **Note:** view is stored for *left-handed* cs, euler angles are stored in radians and *ZXY-order*,\r\n *\r\n * @param {string=} expression - Optional string encoded the view\r\n */\r\nMiew.prototype.view = function (expression) {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n let transform = [];\r\n const eulerOrder = 'ZXY';\r\n\r\n function encode() {\r\n const pos = pivot.position;\r\n const scale = self._objectControls.getScale() / settings.now.radiusToFit;\r\n const euler = new THREE.Euler();\r\n euler.setFromQuaternion(self._objectControls.getOrientation(), eulerOrder);\r\n transform = [\r\n pos.x, pos.y, pos.z,\r\n scale,\r\n euler.x, euler.y, euler.z,\r\n ];\r\n return VIEW_VERSION + utils.arrayToBase64(transform, Float32Array);\r\n }\r\n\r\n function decode() {\r\n // backwards compatible: old non-versioned view is the 0th version\r\n if (expression.length === 40) {\r\n expression = `0${expression}`;\r\n }\r\n\r\n const version = expression[0];\r\n transform = utils.arrayFromBase64(expression.substr(1), Float32Array);\r\n\r\n // apply adapter for old versions\r\n if (version !== VIEW_VERSION) {\r\n if (version === '0') {\r\n // cancel radiusToFit included in old views\r\n transform[3] /= 8.0;\r\n } else {\r\n // do nothing\r\n self.logger.warn(`Encoded view version mismatch, stored as ${version} vs ${VIEW_VERSION} expected`);\r\n return;\r\n }\r\n }\r\n\r\n const interpolator = self._interpolator;\r\n const srcView = interpolator.createView();\r\n srcView.position.copy(pivot.position);\r\n srcView.scale = self._objectControls.getScale();\r\n srcView.orientation.copy(self._objectControls.getOrientation());\r\n\r\n const dstView = interpolator.createView();\r\n dstView.position.set(transform[0], transform[1], transform[2]);\r\n\r\n // hack to make preset views work after we moved centering offset to visual nodes\r\n // FIXME should only store main pivot offset in preset\r\n if (self._getComplexVisual()) {\r\n dstView.position.sub(self._getComplexVisual().position);\r\n }\r\n\r\n dstView.scale = transform[3]; // eslint-disable-line prefer-destructuring\r\n dstView.orientation.setFromEuler(new THREE.Euler(transform[4], transform[5], transform[6], eulerOrder));\r\n\r\n interpolator.setup(srcView, dstView);\r\n }\r\n\r\n if (typeof expression === 'undefined') {\r\n return encode();\r\n }\r\n decode();\r\n\r\n return expression;\r\n};\r\n\r\n/*\r\n * Update current view due to viewinterpolator state\r\n */\r\nMiew.prototype._updateView = function () {\r\n const self = this;\r\n const { pivot } = this._gfx;\r\n\r\n const interpolator = this._interpolator;\r\n if (!interpolator.wasStarted()) {\r\n interpolator.start();\r\n }\r\n\r\n if (!interpolator.isMoving()) {\r\n return;\r\n }\r\n\r\n const res = interpolator.getCurrentView();\r\n if (res.success) {\r\n const curr = res.view;\r\n pivot.position.copy(curr.position);\r\n self._objectControls.setScale(curr.scale * settings.now.radiusToFit);\r\n self._objectControls.setOrientation(curr.orientation);\r\n this.dispatchEvent({ type: 'transform' });\r\n self._needRender = true;\r\n }\r\n};\r\n\r\n/**\r\n * Translate object by vector\r\n * @param {number} x - translation value (Ang) along model's X axis\r\n * @param {number} y - translation value (Ang) along model's Y axis\r\n * @param {number} z - translation value (Ang) along model's Z axis\r\n */\r\nMiew.prototype.translate = function (x, y, z) {\r\n this._objectControls.translatePivot(x, y, z);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Rotate object by Euler angles\r\n * @param {number} x - rotation angle around X axis in radians\r\n * @param {number} y - rotation angle around Y axis in radians\r\n * @param {number} z - rotation angle around Z axis in radians\r\n */\r\nMiew.prototype.rotate = function (x, y, z) {\r\n this._objectControls.rotate(new THREE.Quaternion().setFromEuler(new THREE.Euler(x, y, z, 'XYZ')));\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Scale object by factor\r\n * @param {number} factor - scale multiplier, should greater than zero\r\n */\r\nMiew.prototype.scale = function (factor) {\r\n if (factor <= 0) {\r\n throw new RangeError('Scale should be greater than zero');\r\n }\r\n this._objectControls.scale(factor);\r\n this.dispatchEvent({ type: 'transform' });\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Center view on selection\r\n * @param {empty | subset | string} selector - defines part of molecule which must be centered (\r\n * empty - center on current selection;\r\n * subset - center on picked atom/residue/molecule;\r\n * string - center on atoms correspond to selection string)\r\n */\r\nMiew.prototype.center = function (selector) {\r\n // no arguments - center on current selection;\r\n if (selector === undefined) {\r\n this.setPivotSubset();\r\n this._needRender = true;\r\n return;\r\n }\r\n // subset with atom or residue - center on picked atom/residue;\r\n if (selector.obj !== undefined && ('atom' in selector.obj || 'residue' in selector.obj)) { // from event with selection\r\n if ('atom' in selector.obj) {\r\n this.setPivotAtom(selector.obj.atom);\r\n } else {\r\n this.setPivotResidue(selector.obj.residue);\r\n }\r\n this._needRender = true;\r\n return;\r\n }\r\n // string - center on atoms correspond to selection string\r\n if (selector.obj === undefined && selector !== '') {\r\n const sel = selectors.parse(selector);\r\n if (sel.error === undefined) {\r\n this.setPivotSubset(sel);\r\n this._needRender = true;\r\n return;\r\n }\r\n }\r\n // empty subset or incorrect/empty string - center on all molecule;\r\n this.resetPivot();\r\n this._needRender = true;\r\n};\r\n\r\n/**\r\n * Build selector that contains all atoms within given distance from group of atoms\r\n * @param {Selector} selector - selector describing source group of atoms\r\n * @param {number} radius - distance\r\n * @returns {Selector} selector describing result group of atoms\r\n */\r\nMiew.prototype.within = function (selector, radius) {\r\n const visual = this._getComplexVisual();\r\n if (!visual) {\r\n return selectors.None();\r\n }\r\n\r\n if (selector instanceof String) {\r\n selector = selectors.parse(selector);\r\n }\r\n\r\n const res = visual.within(selector, radius);\r\n if (res) {\r\n visual.rebuildSelectionGeometry();\r\n this._needRender = true;\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Get atom position in 2D canvas coords\r\n * @param {string} fullAtomName - full atom name, like A.38.CG\r\n * @returns {Object} {x, y} or false if atom not found\r\n */\r\nMiew.prototype.projected = function (fullAtomName, complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return false;\r\n }\r\n\r\n const atom = visual.getComplex().getAtomByFullname(fullAtomName);\r\n if (atom === null) {\r\n return false;\r\n }\r\n\r\n const pos = atom.position.clone();\r\n // we consider atom position to be affected only by common complex transform\r\n // ignoring any transformations that may add during editing\r\n this._gfx.pivot.updateMatrixWorldRecursive();\r\n this._gfx.camera.updateMatrixWorldRecursive();\r\n this._gfx.pivot.localToWorld(pos);\r\n pos.project(this._gfx.camera);\r\n\r\n return {\r\n x: (pos.x + 1.0) * 0.5 * this._gfx.width,\r\n y: (1.0 - pos.y) * 0.5 * this._gfx.height,\r\n };\r\n};\r\n\r\n/**\r\n * Replace secondary structure with calculated one.\r\n *\r\n * DSSP algorithm implementation is used.\r\n *\r\n * Kabsch W, Sander C. 1983. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and\r\n * geometrical features. Biopolymers. 22(12):2577-2637. doi:10.1002/bip.360221211.\r\n *\r\n * @param {string=} complexName - complex name\r\n */\r\nMiew.prototype.dssp = function (complexName) {\r\n const visual = this._getComplexVisual(complexName);\r\n if (!visual) {\r\n return;\r\n }\r\n visual.getComplex().dssp();\r\n\r\n // rebuild dependent representations (cartoon or ss-colored)\r\n visual._reprList.forEach((rep) => {\r\n if (rep.mode.id === 'CA' || rep.colorer.id === 'SS') {\r\n rep.needsRebuild = true;\r\n }\r\n });\r\n};\r\n\r\nMiew.prototype.exportCML = function () {\r\n const self = this;\r\n\r\n function extractRotation(m) {\r\n const xAxis = new THREE.Vector3();\r\n const yAxis = new THREE.Vector3();\r\n const zAxis = new THREE.Vector3();\r\n m.extractBasis(xAxis, yAxis, zAxis);\r\n xAxis.normalize();\r\n yAxis.normalize();\r\n zAxis.normalize();\r\n const retMat = new THREE.Matrix4();\r\n retMat.identity();\r\n retMat.makeBasis(xAxis, yAxis, zAxis);\r\n return retMat;\r\n }\r\n\r\n function updateCMLData(complex) {\r\n const { root } = self._gfx;\r\n const mat = extractRotation(root.matrixWorld);\r\n const v4 = new THREE.Vector4(0, 0, 0, 0);\r\n const vCenter = new THREE.Vector4(0, 0, 0, 0);\r\n let xml = null;\r\n let ap = null;\r\n\r\n // update atoms in cml\r\n complex.forEachAtom((atom) => {\r\n if (atom.xmlNodeRef && atom.xmlNodeRef.xmlNode) {\r\n xml = atom.xmlNodeRef.xmlNode;\r\n ap = atom.position;\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n v4.applyMatrix4(mat);\r\n xml.setAttribute('x3', v4.x.toString());\r\n xml.setAttribute('y3', v4.y.toString());\r\n xml.setAttribute('z3', v4.z.toString());\r\n xml.removeAttribute('x2');\r\n xml.removeAttribute('y2');\r\n }\r\n });\r\n // update stereo groups in cml\r\n complex.forEachSGroup((sGroup) => {\r\n if (sGroup.xmlNodeRef && sGroup.xmlNodeRef.xmlNode) {\r\n xml = sGroup.xmlNodeRef.xmlNode;\r\n ap = sGroup.getPosition();\r\n v4.set(ap.x, ap.y, ap.z, 1.0);\r\n const cp = sGroup.getCentralPoint();\r\n if (cp === null) {\r\n v4.applyMatrix4(mat);\r\n } else {\r\n vCenter.set(cp.x, cp.y, cp.z, 0.0);\r\n v4.add(vCenter);\r\n v4.applyMatrix4(mat); // pos in global space\r\n vCenter.set(cp.x, cp.y, cp.z, 1.0);\r\n vCenter.applyMatrix4(mat);\r\n v4.sub(vCenter);\r\n }\r\n xml.setAttribute('x', v4.x.toString());\r\n xml.setAttribute('y', v4.y.toString());\r\n xml.setAttribute('z', v4.z.toString());\r\n }\r\n });\r\n }\r\n\r\n const visual = self._getComplexVisual();\r\n const complex = visual ? visual.getComplex() : null;\r\n if (complex && complex.originalCML) {\r\n updateCMLData(complex);\r\n\r\n // serialize xml structure to string\r\n const oSerializer = new XMLSerializer();\r\n return oSerializer.serializeToString(complex.originalCML);\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Reproduce the RCSB PDB Molecule of the Month style by David S. Goodsell\r\n *\r\n * @see http://pdb101.rcsb.org/motm/motm-about\r\n */\r\nMiew.prototype.motm = function () {\r\n settings.set({\r\n fogColorEnable: true,\r\n fogColor: 0x000000,\r\n outline: { on: true, threshold: 0.01 },\r\n bg: { color: 0xffffff },\r\n });\r\n\r\n this._forEachComplexVisual((visual) => {\r\n const rep = [];\r\n const complex = visual.getComplex();\r\n const palette = palettes.get(settings.now.palette);\r\n for (let i = 0; i < complex.getChainCount(); i++) {\r\n const curChainName = complex._chains[i]._name;\r\n const curChainColor = palette.getChainColor(curChainName);\r\n rep[i] = {\r\n selector: `chain ${curChainName}`,\r\n mode: 'VW',\r\n colorer: ['CB', { color: curChainColor, factor: 0.9 }],\r\n material: 'FL',\r\n };\r\n }\r\n visual.resetReps(rep);\r\n });\r\n};\r\n\r\nMiew.prototype.VERSION = (typeof PACKAGE_VERSION !== 'undefined' && PACKAGE_VERSION) || '0.0.0-dev';\r\n\r\n// Uncomment this to get debug trace:\r\n// Miew.prototype.debugTracer = new utils.DebugTracer(Miew.prototype);\r\n\r\n_.assign(Miew, /** @lends Miew */ {\r\n VERSION: Miew.prototype.VERSION,\r\n\r\n registeredPlugins: [],\r\n\r\n // export namespaces // TODO: WIP: refactoring external interface\r\n chem,\r\n io,\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n utils,\r\n gfx: {\r\n Representation,\r\n },\r\n\r\n /**\r\n * Third-party libraries packaged together with Miew.\r\n *\r\n * @property {object} lodash - [Lodash](https://lodash.com/), a modern JavaScript utility library delivering\r\n * modularity, performance & extras.\r\n * @property {object} three - [three.js](https://threejs.org/), JavaScript 3D library.\r\n *\r\n * @example\r\n * var _ = Miew.thirdParty.lodash;\r\n * var opts = _.merge({ ... }, Miew.options.fromURL(window.location.search));\r\n * var miew = new Miew(opts);\r\n */\r\n thirdParty: {\r\n lodash: _,\r\n three: THREE,\r\n },\r\n});\r\n\r\nexport default Miew;\r\n","import palettes from '../gfx/palettes';\r\nimport settings from '../settings';\r\n\r\nconst modeIdDesc = {\r\n $help: [\r\n 'Rendering mode shortcut',\r\n ' BS - balls and sticks mode',\r\n ' LN - lines mode',\r\n ' LC - licorice mode',\r\n ' VW - van der waals mode',\r\n ' TR - trace mode',\r\n ' TU - tube mode',\r\n ' CA - cartoon mode',\r\n ' SA - isosurface mode',\r\n ' QS - quick surface mode',\r\n ' SE - solvent excluded mode',\r\n ' TX - text mode',\r\n ],\r\n BS: {\r\n $help: [\r\n ' Balls and sticks',\r\n ' aromrad = #aromatic radius',\r\n ' atom = #atom radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n CA: {\r\n $help: [\r\n ' Cartoon',\r\n ' arrow = #arrow size',\r\n ' depth = #depth of surface',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = #',\r\n ' width = #secondary width\\n',\r\n ],\r\n },\r\n LN: {\r\n $help: [\r\n ' Lines',\r\n ' atom = #atom radius',\r\n ' chunkarom = ',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' offsarom = \\n',\r\n ],\r\n },\r\n LC: {\r\n $help: [\r\n ' Licorice',\r\n ' aromrad = #aromatic radius',\r\n ' bond = #bond radius',\r\n ' multibond = #use multibond',\r\n ' showarom = #show aromatic',\r\n ' space = #space value\\n',\r\n ],\r\n },\r\n VW: {\r\n $help: [\r\n ' Van der Waals',\r\n ' nothing\\n',\r\n ],\r\n },\r\n TR: {\r\n $help: [\r\n ' Trace',\r\n ' radius = #tube radius\\n',\r\n ],\r\n },\r\n TU: {\r\n $help: [\r\n ' Tube',\r\n ' heightSegmentsRatio = ',\r\n ' radius = #tube radius',\r\n ' tension = \\n',\r\n ],\r\n },\r\n SA: {\r\n $help: [\r\n ' Surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n QS: {\r\n $help: [\r\n ' Quick surface',\r\n ' isoValue = ',\r\n ' scale = ',\r\n ' wireframe = ',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n SE: {\r\n $help: [\r\n ' Solvent excluded surface',\r\n ' zClip = #clip z plane\\n',\r\n ],\r\n },\r\n TX: {\r\n $help: [\r\n ' Text mode',\r\n ' template = string that can include \"{{ id }}\"',\r\n ' it will be replaced by value, id can be one of next:',\r\n ' serial, name, type, sequence, residue, chain, hetatm, water\\n',\r\n ' horizontalAlign = {\"left\", \"right\", \"center\"}',\r\n ' verticalAlign = {\"top\", \"bottom\", \"middle\"}',\r\n ' dx = #offset along x',\r\n ' dy = #offset along y',\r\n ' dz = #offset along z',\r\n ' fg = #text color modificator',\r\n ' could be keyword, named color or hex',\r\n ' fg = #back color modificator',\r\n ' could be keyword, named color or hex',\r\n ' showBg = #if set show background',\r\n ' plate under text',\r\n ],\r\n },\r\n};\r\n\r\nconst colorDesc = {\r\n $help: [\r\n 'Coloring mode shortcut',\r\n ' EL - color by element',\r\n ' CH - color by chain',\r\n ' SQ - color by sequence',\r\n ' RT - color by residue type',\r\n ' SS - color by secondary structure',\r\n ' UN - uniform',\r\n ],\r\n UN: {\r\n $help: [\r\n 'Parameters of coloring modes customization',\r\n ' Uniform',\r\n ' color = #RGB->HEX->dec\\n',\r\n ],\r\n color: {\r\n $help: Object.keys(palettes.get(settings.now.palette).namedColors).sort().join('\\n'),\r\n },\r\n },\r\n};\r\n\r\nconst materialDesc = {\r\n $help: [\r\n 'Material shortcut',\r\n ' DF - diffuse',\r\n ' TR - transparent',\r\n ' SF - soft plastic',\r\n ' PL - glossy plastic',\r\n ' ME - metal',\r\n ' GL - glass',\r\n ],\r\n};\r\n\r\nconst addRepDesc = {\r\n $help: [\r\n 'Short (packed) representation description as a set of variables',\r\n ' s=',\r\n ' selector property',\r\n ' m=[!:[,...]]',\r\n ' render mode property',\r\n ' c=[!:[,...]]',\r\n ' color mode property',\r\n ' mt=',\r\n ' material property',\r\n ],\r\n s: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n m: modeIdDesc,\r\n c: colorDesc,\r\n mt: materialDesc,\r\n};\r\n\r\nconst setGetParameterDesc = {\r\n $help: [\r\n 'Parameters of rendering modes customization: modes',\r\n 'Parameters of colorer customization: colorers',\r\n 'Autobuild: autobuild = (|)',\r\n ],\r\n modes: modeIdDesc,\r\n colorers: colorDesc,\r\n};\r\n\r\nconst help = {\r\n $help: [\r\n 'help (| )',\r\n 'You can get detailed information about command options',\r\n ' using \"help cmd.opt.opt.[...]\"\\n',\r\n ' you can use one line comments',\r\n ' everything started from (#|//) will be skipped',\r\n ' Example: >build //some comment\\n',\r\n 'List of available commands:',\r\n ],\r\n reset: {\r\n $help: [\r\n 'Reload current object, delete all representations',\r\n ' Nothing will work until load new object',\r\n ],\r\n },\r\n load: {\r\n $help: [\r\n 'load (||-f [<*.NC FILE URL STRING>])',\r\n ' Load new pdb object from selected source',\r\n ],\r\n PDBID: {\r\n $help: 'pdb id in remote molecule database',\r\n },\r\n URL: {\r\n $help: 'url to source file',\r\n },\r\n f: {\r\n $help: [\r\n 'open file system dialog to fetch local file',\r\n 'optionally you can determine trajectory file',\r\n 'via URL for *.top model',\r\n ],\r\n },\r\n },\r\n clear: {\r\n $help: 'No args. Clear terminal',\r\n },\r\n add: {\r\n $help: [\r\n 'add [] []',\r\n ' Add new item to representation set with',\r\n ' default or params',\r\n ],\r\n REP_NAME: {\r\n $help: 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n rep: {\r\n $help: [\r\n 'rep [|] []',\r\n ' set current representation by name or index',\r\n ' edit current representation by ',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n DESCRIPTION: addRepDesc,\r\n },\r\n remove: {\r\n $help: [\r\n 'remove (|)',\r\n 'Remove representation by name or index',\r\n ],\r\n REP_NAME: {\r\n $help: [\r\n 'Identifier string [_,a-z,A-Z,0-9] can not start from digit',\r\n 'Must be declared before',\r\n ],\r\n },\r\n REP_INDEX: {\r\n $help: 'Index of available representation',\r\n },\r\n },\r\n selector: {\r\n $help: [\r\n 'selector ',\r\n ' set selector from EXPRESSION to current representation',\r\n ],\r\n EXPRESSION: {\r\n $help: 'Selection expression string as it is in menu->representations->selection',\r\n },\r\n },\r\n mode: {\r\n $help: [\r\n 'mode [=...]',\r\n ' set rendering mode and apply parameters to current representation',\r\n ],\r\n MODE_ID: modeIdDesc,\r\n },\r\n color: {\r\n $help: [\r\n 'color [=...]',\r\n ' set colorer and apply parameters to current representation',\r\n ],\r\n COLORER_ID: colorDesc,\r\n },\r\n material: {\r\n $help: [\r\n 'material ',\r\n ' set material to current representation',\r\n ],\r\n MATERIAL_ID: materialDesc,\r\n },\r\n build: {\r\n $help: 'build help str',\r\n add: {\r\n $help: 'build.add',\r\n new: {\r\n $help: [\r\n 'add.new',\r\n 'add.new new line 1',\r\n 'add.new new line 2',\r\n 'add.new new line 3',\r\n ],\r\n },\r\n },\r\n del: {\r\n $help: 'build.del',\r\n },\r\n },\r\n list: {\r\n $help: [\r\n 'list [-e|-s||]',\r\n 'Print representations if no args print list of representations',\r\n ' -e expand list and show all representations',\r\n ' -s show all user-registered selectors',\r\n ' | show only current representation',\r\n ],\r\n },\r\n hide: {\r\n $help: [\r\n 'hide (|)',\r\n 'Hide representation referenced in args',\r\n ],\r\n },\r\n show: {\r\n $help: [\r\n 'show (|)',\r\n 'Show representation referenced in args',\r\n ],\r\n },\r\n get: {\r\n $help: [\r\n 'get ',\r\n 'Print value',\r\n ' - path to option use get.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set: {\r\n $help: [\r\n 'set ',\r\n 'Set with ',\r\n ' - path to option use set.PARAMETER to get more info',\r\n ],\r\n PARAMETER: setGetParameterDesc,\r\n },\r\n set_save: {\r\n $help: [\r\n 'set_save',\r\n 'Save current settings to cookie',\r\n ],\r\n },\r\n set_restore: {\r\n $help: [\r\n 'set_restore',\r\n 'Load and apply settings from cookie',\r\n ],\r\n },\r\n set_reset: {\r\n $help: [\r\n 'set_reset',\r\n 'Reset current settings to the defaults',\r\n ],\r\n },\r\n preset: {\r\n $help: [\r\n 'preset []',\r\n 'Reset current representation or set preset to ',\r\n ],\r\n PRESET: {\r\n $help: [\r\n 'default',\r\n 'wire',\r\n 'small',\r\n 'macro',\r\n ],\r\n },\r\n },\r\n unit: {\r\n $help: [\r\n 'unit []',\r\n 'Change current biological structure view. Zero value means asymmetric unit,',\r\n 'positive values set an assembly with corresponding number.',\r\n 'Being called with no parameters command prints current unit information.',\r\n ],\r\n },\r\n view: {\r\n $help: [\r\n 'view []',\r\n 'Get current encoded view or set if ENCODED_VIEW placed as argument',\r\n ],\r\n ENCODED_VIEW: {\r\n $help: [\r\n 'encoded view matrix string (binary code)',\r\n ],\r\n },\r\n },\r\n rotate: {\r\n $help: [\r\n 'rotate (x|y|z) [] [(x|y|z) []]...',\r\n 'Rotate scene',\r\n ],\r\n },\r\n scale: {\r\n $help: [\r\n 'scale ',\r\n 'Scale scene',\r\n ],\r\n },\r\n select: {\r\n $help: [\r\n 'select [as ]',\r\n 'Select atoms using selector defined in SELECTOR_STRING',\r\n ' and if SELECTOR_NAME is defined register it in viewer',\r\n ' you can use it later as a complex selector',\r\n ],\r\n },\r\n within: {\r\n $help: [\r\n 'within of as ',\r\n 'Build within named selector',\r\n ' DISTANCE ',\r\n ' SELECTOR_STRING ',\r\n ' SELECTOR_NAME ',\r\n ],\r\n },\r\n url: {\r\n $help: [\r\n 'url [-s] [-v]',\r\n 'Report URL encoded scene',\r\n ' if -s set that include settings in the URL',\r\n ' if -v set that include view in the URL',\r\n ],\r\n },\r\n screenshot: {\r\n $help: [\r\n 'screenshot [ []]',\r\n 'Make a screenshot of the scene',\r\n ' WIDTH in pixels',\r\n ' HEIGHT in pixels, equal to WIDTH by default',\r\n ],\r\n },\r\n line: {\r\n $help: [\r\n 'line [=]',\r\n 'Draw dashed line between two specified atoms',\r\n ],\r\n },\r\n removeobj: {\r\n $help: [\r\n 'removeobj ',\r\n 'Remove scene object by its index. Indices could be obtained by command',\r\n ],\r\n },\r\n listobj: {\r\n $help: [\r\n 'listobj',\r\n 'Display the list of all existing scene objects',\r\n ],\r\n },\r\n};\r\n\r\nexport default help;\r\n","import _ from 'lodash';\r\nimport Miew from './Miew';\r\nimport { parser as parsercli } from './utils/MiewCLIParser';\r\nimport clihelp from './utils/MiewCLIHelp';\r\nimport logger from './utils/logger';\r\nimport utils from './utils';\r\n\r\nconst {\r\n chem: { selectors },\r\n modes,\r\n colorers,\r\n materials,\r\n palettes,\r\n options,\r\n settings,\r\n} = Miew;\r\n\r\nfunction None() {\r\n}\r\n\r\nconst NULL = (function () {\r\n const obj = new None();\r\n return function () {\r\n return obj;\r\n };\r\n}());\r\n\r\nclass RepresentationMap {\r\n constructor() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n\r\n get(strId) {\r\n return this.representationMap[strId] || this.representationID[strId] || '';\r\n }\r\n\r\n add(strId, index) {\r\n if (strId === -1) {\r\n return 'Can not create representation: there is no data';\r\n }\r\n\r\n if (index !== undefined) {\r\n if (!this.representationMap.hasOwnProperty(strId)) {\r\n this.representationMap[strId.toString()] = index;\r\n this.representationID[index] = strId.toString();\r\n } else {\r\n return 'This name has already existed, registered without name';\r\n }\r\n }\r\n return `Representation ${strId} successfully added`;\r\n }\r\n\r\n remove(index) {\r\n if (index && this.representationID.hasOwnProperty(index)) {\r\n delete this.representationMap[this.representationID[index]];\r\n delete this.representationID[index];\r\n }\r\n\r\n const sortedKeys = Object.keys(this.representationID).sort();\r\n for (const i in sortedKeys) {\r\n if (sortedKeys.hasOwnProperty(i)) {\r\n const id = sortedKeys[i];\r\n if (id > index) {\r\n this.representationID[id - 1] = this.representationID[id];\r\n this.representationMap[this.representationID[id]] -= 1;\r\n delete this.representationID[id];\r\n }\r\n }\r\n }\r\n }\r\n\r\n clear() {\r\n this.representationMap = {};\r\n this.representationID = {};\r\n }\r\n}\r\n\r\nconst representationsStorage = new RepresentationMap();\r\n\r\nfunction keyRemap(key) {\r\n const keys = {\r\n s: 'selector',\r\n m: 'mode',\r\n c: 'colorer',\r\n mt: 'material',\r\n mode: 'modes',\r\n color: 'colorers',\r\n colorer: 'colorers',\r\n select: 'selector',\r\n material: 'materials',\r\n selector: 'selector',\r\n };\r\n const ans = keys[key];\r\n return ans === undefined ? key : ans;\r\n}\r\n\r\nclass CLIUtils {\r\n list(miew, repMap, key) {\r\n let ret = '';\r\n if (miew && repMap !== undefined) {\r\n if (key === undefined || key === '-e') {\r\n const count = miew.repCount();\r\n\r\n for (let i = 0; i < count; i++) {\r\n ret += this.listRep(miew, repMap, i, key);\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n\r\n listRep(miew, repMap, repIndex, key) {\r\n let ret = '';\r\n const rep = miew.repGet(repIndex);\r\n if (!rep) {\r\n logger.warn(`Rep ${repIndex} does not exist!`);\r\n return ret;\r\n }\r\n const index = repIndex;\r\n const repName = repMap.get(index);\r\n\r\n const { mode, colorer } = rep;\r\n const selectionStr = rep.selectorString;\r\n const material = rep.materialPreset;\r\n\r\n ret += `#${index} : ${mode.name}${repName === '' ? '' : `, ${repName}`}\\n`;\r\n\r\n if (key !== undefined) {\r\n ret += ` selection : \"${selectionStr}\"\\n`;\r\n ret += ` mode : (${mode.id}), ${mode.name}\\n`;\r\n ret += ` colorer : (${colorer.id}), ${colorer.name}\\n`;\r\n ret += ` material : (${material.id}), ${material.name}\\n`;\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listSelector(miew, context) {\r\n let ret = '';\r\n\r\n for (const k in context) {\r\n if (context.hasOwnProperty(k)) {\r\n ret += `${k} : \"${context[k]}\"\\n`;\r\n }\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n listObjs(miew) {\r\n const objs = miew._objects;\r\n\r\n if (!objs || !Array.isArray(objs) || objs.length === 0) {\r\n return 'There are no objects on the scene';\r\n }\r\n\r\n const strList = [];\r\n for (let i = 0, n = objs.length; i < n; ++i) {\r\n strList[i] = `${i}: ${objs[i].toString()}`;\r\n }\r\n\r\n return strList.join('\\n');\r\n }\r\n\r\n joinHelpStr(helpData) {\r\n if (helpData instanceof Array) {\r\n return helpData.join('\\n');\r\n }\r\n return helpData;\r\n }\r\n\r\n help(path) {\r\n if (_.isUndefined(path)) {\r\n return `${this.joinHelpStr(clihelp.$help)}\\n${_.slice(_.sortBy(_.keys(clihelp)), 1).join(', ')}\\n`;\r\n }\r\n\r\n const helpItem = _.get(clihelp, path);\r\n return _.isUndefined(helpItem) ? this.help() : `${this.joinHelpStr(helpItem.$help)}\\n`;\r\n }\r\n\r\n load(miew, arg) {\r\n if (miew === undefined || arg === undefined || arg === '-f') {\r\n return;\r\n }\r\n miew.awaitWhileCMDisInProcess();\r\n const finish = () => miew.finishAwaitingCMDInProcess();\r\n miew.load(arg).then(finish, finish);\r\n }\r\n\r\n checkArg(key, arg, modificate) {\r\n if (key !== undefined && arg !== undefined) {\r\n if (keyRemap(key) === 'selector') {\r\n const res = selectors.parse(arg);\r\n\r\n if (res.error !== undefined) {\r\n const selExc = { message: res.error };\r\n throw selExc;\r\n }\r\n\r\n if (modificate !== undefined && modificate) {\r\n return res.selector;\r\n }\r\n return arg;\r\n }\r\n\r\n const modificators = {\r\n colorers,\r\n modes,\r\n materials,\r\n };\r\n\r\n let modificator = key;\r\n let temp;\r\n while (modificator !== temp) {\r\n temp = modificator;\r\n modificator = keyRemap(temp);\r\n }\r\n\r\n if (modificators[modificator].get(arg) === undefined) {\r\n const exc = { message: `${arg} is not existed in ${modificator}` };\r\n throw exc;\r\n }\r\n return arg;\r\n }\r\n return NULL;\r\n }\r\n\r\n propagateProp(path, arg) {\r\n if (path !== undefined) {\r\n let argExc = {};\r\n const adapter = options.adapters[typeof _.get(settings.defaults, path)];\r\n if (adapter === undefined) {\r\n const pathExc = { message: `${path} is not existed` };\r\n throw pathExc;\r\n }\r\n\r\n if ((path.endsWith('.color') || path.endsWith('.baseColor')\r\n || path.endsWith('.EL.carbon')) && typeof arg !== 'number') {\r\n arg = palettes.get(settings.now.palette).getNamedColor(arg);\r\n }\r\n\r\n if (path.endsWith('.fg') || path.endsWith('.bg')) {\r\n if (typeof arg !== 'number') {\r\n const val = palettes.get(settings.now.palette).getNamedColor(arg, true);\r\n if (val !== undefined) {\r\n arg = `0x${val.toString(16)}`;\r\n }\r\n } else {\r\n arg = `0x${arg.toString(16)}`;\r\n }\r\n }\r\n\r\n if (path.endsWith('.template')) {\r\n arg = arg.replace(/\\\\n/g, '\\n');// NOSONAR\r\n }\r\n\r\n if (arg !== undefined && adapter(arg) !== arg && adapter(arg) !== (arg > 0)) {\r\n argExc = { message: `${path} must be a \"${typeof _.get(settings.defaults, path)}\"` };\r\n throw argExc;\r\n }\r\n }\r\n return arg;\r\n }\r\n\r\n unquoteString(value) {\r\n return utils.unquoteString(value);\r\n }\r\n}\r\n// repIndexOrRepMap could be RepresentationMap or index\r\n\r\nconst utilFunctions = new CLIUtils();\r\n\r\nfunction CreateObjectPair(a, b) {\r\n const obj = {};\r\n obj[a] = b;\r\n return obj;\r\n}\r\n\r\nfunction ArgList(arg) {\r\n if (arg instanceof this.constructor) {\r\n return arg;\r\n }\r\n if (arg instanceof Array) {\r\n this._values = arg.slice(0);\r\n } else if (arg) {\r\n this._values = [arg];\r\n } else {\r\n this._values = [];\r\n }\r\n}\r\n\r\nArgList.prototype.append = function (value) {\r\n const values = this._values;\r\n values[values.length] = value;\r\n return this;\r\n};\r\n\r\nArgList.prototype.remove = function (value) {\r\n const values = this._values;\r\n const index = values.indexOf(value);\r\n if (index >= 0) {\r\n values.splice(index, 1);\r\n }\r\n return this;\r\n};\r\n\r\nArgList.prototype.toJSO = function (cliUtils, cmd, arg) {\r\n const res = {};\r\n\r\n const list = this._values;\r\n for (let i = 0, n = list.length; i < n; ++i) {\r\n _.set(res, list[i].id, cliUtils.propagateProp(`${keyRemap(cmd)}.${arg}.${list[i].id}`, list[i].val));\r\n }\r\n\r\n return res;\r\n};\r\n\r\nfunction Arg(_id, _val) {\r\n this.id = _id;\r\n this.val = _val;\r\n}\r\n\r\nconst cliutils = Object.create({});\r\n\r\ncliutils.Arg = Arg;\r\ncliutils.ArgList = ArgList;\r\n\r\ncliutils.miew = null;\r\ncliutils.echo = null;\r\ncliutils.representations = representationsStorage;\r\ncliutils.utils = utilFunctions;\r\n\r\ncliutils._ = _;\r\ncliutils.CreateObjectPair = CreateObjectPair;\r\ncliutils.keyRemap = keyRemap;\r\ncliutils.Context = selectors.Context;\r\ncliutils.ClearContext = selectors.ClearContext;\r\n\r\ncliutils.NULL = NULL;\r\n\r\ncliutils.notimplemented = function () {\r\n return this.NULL;\r\n};\r\n\r\nMiew.prototype.script = function (script, _printCallback, _errorCallback) {\r\n parsercli.yy.miew = this;\r\n parsercli.yy.echo = _printCallback;\r\n parsercli.yy.error = _errorCallback;\r\n if (this.cmdQueue === undefined) {\r\n this.cmdQueue = [];\r\n }\r\n\r\n if (this.commandInAction === undefined) {\r\n this.commandInAction = false;\r\n }\r\n\r\n this.cmdQueue = this.cmdQueue.concat(script.split('\\n'));\r\n};\r\n\r\nMiew.prototype.awaitWhileCMDisInProcess = function () {\r\n this.commandInAction = true;\r\n};\r\n\r\nMiew.prototype.finishAwaitingCMDInProcess = function () {\r\n this.commandInAction = false;\r\n};\r\n\r\nMiew.prototype.isScriptingCommandAvailable = function () {\r\n return this.commandInAction !== undefined\r\n && !this.commandInAction\r\n && this.cmdQueue !== undefined\r\n && this.cmdQueue.length > 0;\r\n};\r\n\r\nMiew.prototype.callNextCmd = function () {\r\n if (this.isScriptingCommandAvailable()) {\r\n const cmd = this.cmdQueue.shift();\r\n\r\n const res = {};\r\n res.success = false;\r\n try {\r\n parsercli.parse(cmd);\r\n res.success = true;\r\n } catch (e) {\r\n res.error = e.message;\r\n parsercli.yy.error(res.error);\r\n this.finishAwaitingCMDInProcess();\r\n }\r\n return res;\r\n }\r\n return '';\r\n};\r\n\r\nparsercli.yy = cliutils;\r\n// workaround for incorrect JISON parser generator for AMD module\r\nparsercli.yy.parseError = parsercli.parseError;\r\n","import Miew from './Miew';\r\nimport './Miew-cli';\r\n\r\nexport default Miew;\r\n"],"names":["parser","o","k","v","l","length","$V0","$V1","$V2","$V3","$V4","$V5","$V6","$V7","$V8","$V9","$Va","$Vb","$Vc","$Vd","$Ve","$Vf","$Vg","$Vh","$Vi","$Vj","$Vk","$Vl","$Vm","$Vn","$Vo","$Vp","$Vq","$Vr","$Vs","$Vt","$Vu","$Vv","$Vw","$Vx","$Vy","$Vz","$VA","$VB","$VC","$VD","$VE","$VF","$VG","$VH","$VI","$VJ","$VK","$VL","$VM","$VN","$VO","$VP","$VQ","$VR","$VS","$VT","$VU","$VV","$VW","$VX","$VY","$VZ","$V_","$V$","$V01","$V11","$V21","$V31","$V41","$V51","$V61","trace","yy","symbols_","terminals_","productions_","performAction","anonymous","yytext","yyleng","yylineno","yystate","$$","_$","$0","$","miew","reset","ClearContext","resetReps","rebuild","rebuildAll","echo","utils","help","toString","motm","propagateProp","get","set","saveSettings","restoreSettings","resetSettings","applyPreset","repRemove","representations","remove","repHide","listRep","list","listSelector","Context","select","checkArg","toLowerCase","rep","repCurrent","selector","within","Number","material","toUpperCase","view","changeUnit","dssp","scale","i","n","rotate","Math","PI","translate","center","addObject","type","params","opts","toJSO","listObjs","removeObject","getURL","settings","screenshotSave","load","clear","add","repAdd","mode","Array","colorer","_","assign","CreateObjectPair","key","val","Object","create","keyRemap","concat","ArgList","append","Arg","parseInt","JSON","parse","String","table","defaultActions","parseError","str","hash","recoverable","error","Error","input","self","stack","tstack","vstack","lstack","recovering","TERROR","EOF","args","slice","call","arguments","lexer","sharedState","prototype","hasOwnProperty","setInput","yylloc","yyloc","push","ranges","options","getPrototypeOf","popStack","lex","token","pop","symbol","preErrorSymbol","state","action","a","r","yyval","p","len","newState","expected","errStr","showPosition","join","text","match","line","loc","first_line","last_line","first_column","last_column","range","apply","_input","_more","_backtrack","done","matched","conditionStack","offset","ch","lines","unput","split","substr","oldLines","more","reject","backtrack_lexer","less","pastInput","past","replace","upcomingInput","next","pre","c","test_match","indexed_rule","backup","matches","tempMatch","index","rules","_currentRules","flex","begin","condition","popState","conditions","topState","abs","pushState","stateStackSize","yy_","$avoiding_name_collisions","YY_START","YYSTATE","unquoteString","Parser","module","exports","keyword","GetSelector","RangeList","Range","ValueList","AbstractInterpolator","CubicInterpolator","Enum","LinearInterpolator","NearestInterpolator","SincFilterInterpolator","Smooth","clipClamp","clipMirror","clipPeriodic","defaultConfig","getColumn","getType","isValidNumber","makeLanczosWindow","makeScaledFunction","makeSincKernel","normalizeScaleTo","shallowCopy","sin","sinc","validateNumber","validateVector","__hasProp","__extends","child","parent","ctor","constructor","__super__","METHOD_NEAREST","METHOD_LINEAR","METHOD_CUBIC","METHOD_LANCZOS","METHOD_SINC","CLIP_CLAMP","CLIP_ZERO","CLIP_PERIODIC","CLIP_MIRROR","CUBIC_TENSION_DEFAULT","CUBIC_TENSION_CATMULL_ROM","method","cubicTension","clip","scaleTo","sincFilterSize","sincWindow","max","min","period","array","config","clipHelper","clamp","clipHelperClamp","zero","clipHelperZero","periodic","clipHelperPeriodic","mirror","clipHelperMirror","getClippedInput","interpolate","t","_super","round","floor","tangentFactor","getTangent","m","t2","t3","x","window","kernel","sum","_ref","_ref2","arr","row","_i","_len","_results","f","baseScale","scaleRange","scaleFactor","translation","isNaN","isFinite","dimension","s","invalidErr","obj","copy","baseDomainEnd","interpolator","interpolatorClass","interpolators","properties","smoothFunc","lanczosFilterSize","nearest","linear","cubic","lanczos","count","_j","_len2","deepValidation","_k","_len3","domain","sort","define","amd","MMTF","e","byteLength","charCodeAt","setUint8","u","setUint16","setUint32","Uint8Array","buffer","setFloat64","setInt8","setInt16","setInt32","isArray","d","keys","ArrayBuffer","DataView","byteOffset","Int8Array","Int32Array","Float32Array","Int16Array","g","L","h","setFloat32","getFloat32","y","U","b","I","w","C","ceil","A","M","F","S","E","N","O","T","getInt32","subarray","j","q","D","P","z","B","V","G","R","rr","forEach","bondAtomList","bondOrderList","xCoordList","yCoordList","zCoordList","bFactorList","atomIdList","altLocList","occupancyList","groupIdList","groupTypeList","secStructList","insCodeList","sequenceIndexList","chainIdList","chainNameList","H","fromCharCode","getInt8","getUint8","getUint16","getUint32","getFloat64","getInt16","W","X","ignoreFields","nr","indexOf","J","K","firstModelOnly","onModel","onChain","onGroup","onAtom","onBond","chainsPerModel","chainCount","modelIndex","groupsPerChain","groupCount","chainIndex","chainId","chainName","groupList","atomNameList","atomCount","groupIndex","groupId","groupType","groupName","singleLetterCode","chemCompType","secStruct","insCode","sequenceIndex","atomIndex","atomId","element","elementList","atomName","formalCharge","formalChargeList","xCoord","yCoord","zCoord","bFactor","altLoc","occupancy","atomIndex1","atomIndex2","bondOrder","Q","Y","Z","response","XMLHttpRequest","addEventListener","responseType","open","send","or","ar","tr","er","ir","encode","decode","traverse","fetch","fetchReduced","version","fetchUrl","fetchReducedUrl","encodeMsgpack","encodeMmtf","decodeMsgpack","decodeMmtf","__assign","defaults","width","radius","corners","color","fadeColor","animation","direction","speed","zIndex","className","top","left","shadow","position","Spinner","spin","target","stop","el","document","createElement","setAttribute","style","transform","insertBefore","firstChild","drawLines","parentNode","removeChild","undefined","getColor","idx","borderRadius","shadows","parseBoxShadow","degrees","backgroundLine","height","background","transformOrigin","delay","boxShadow","normalizeShadow","appendChild","regex","_a","xUnits","yUnits","prefix","end","normalized","shadows_1","xy","convertOffset","radians","cos","Timer","startTime","oldTime","elapsedTime","running","start","now","getElapsedTime","update","delta","newTime","performance","bind","Date","tag","id","css","cssText","Stats","domElement","_text","_startTime","_prevTime","_deltas","_index","_total","_count","time","ms","fps","textContent","toPrecision","show","on","display","isUndefOrEqual","param","value","EventDispatcher","_handlers","callback","context","handlers","_checkPar","par","find","removeEventListener","handler","ev","values","omitBy","dispatchEvent","event","priorities","debug","info","report","warn","Logger","console","_priority","instantiate","verify","number","isNumber","defineProperty","findKey","level","levels","message","priority","_message","output","log","logger","browserType","DEFAULT","SAFARI","encodeQueryComponent","excludeExp","code","encodeURIComponent","decodeQueryComponent","decodeURIComponent","getUrlParameters","url","location","search","query","substring","result","exec","getUrlParametersAsDict","resolveURL","URL","href","anchor","generateRegExp","symbolStr","symbolList","listStr","RegExp","attrs","content","createTextNode","HTMLElement","deriveClass","cls","base","members","statics","deriveDeep","needZeroOwnProperties","res","hexColor","hex","DebugTracer","namespace","enabled","enable","indent","methods","wrap","method_","name_","spaces","_key","name","Function","OutOfMemoryError","allocateTyped","TypedArrayName","size","RangeError","bytesToBase64","bytes","binary","btoa","bytesFromBase64","atob","arrayToBase64","TypedArrayClass","arrayFromBase64","compareOptionsWithDefaults","defOpts","optsStr","isAlmostPlainObject","isPlainObject","proto","objectsDiff","src","dst","diff","forIn","srcValue","dstValue","deepDiff","isEmpty","isEqual","forInRecursive","object","iterateThrough","newPref","enquoteString","isString","SyntaxError","getFileExtension","fileName","lastIndexOf","Infinity","splitFileName","ext","dataUrlToBlob","parts","partsCount","Blob","getBrowser","navigator","vendor","userAgent","shotOpen","write","shotDownload","dataUrl","filename","msSaveBlob","link","download","innerHTML","createObjectURL","body","click","data","blobData","copySubArrays","indices","itemSize","shallowCloneNode","node","newNode","cloneNode","worldPos","unquotedStringRE","enquoteHelper","correctSelectorIdentifier","test","concatTypedArraysUnsafe","first","second","mergeTypedArraysUnsafe","reduce","acc","cur","JobHandle","_shouldCancel","cancel","shouldCancel","notify","slaveEvent","VERSION","modes","BS","atom","bond","space","multibond","aromrad","showarom","polyComplexity","poor","low","medium","high","ultra","VW","LN","offsarom","chunkarom","lineWidth","LC","SA","zClip","probeRadius","subset","wireframe","SE","QS","isoValue","gaussLim","gridSpacing","CS","probePositions","TR","TU","heightSegmentsRatio","tension","CA","depth","ss","helix","arrow","strand","TX","template","horizontalAlign","verticalAlign","dx","dy","dz","fg","bg","showBg","VD","kSigma","kSigmaMed","kSigmaMax","frame","isoMode","colorers","EL","carbon","UN","CO","baseColor","CB","factor","SQ","gradient","TM","OC","HY","MO","antialias","camFov","camNear","camFar","camDistance","radiusToFit","fogNearFactor","fogFarFactor","fogAlpha","fogColor","fogColorEnable","palette","resolution","autoResolution","autoPreset","preset","presets","default","empty","wire","small","macro","objects","dashSize","gapSize","transparent","draft","clipPlane","clipPlaneFactor","clipPlaneSpeed","plugins","axes","fog","zSprites","isoSurfaceFakeOpacity","suspendRender","nowater","autobuild","fxaa","outline","threshold","thickness","ao","autoRotation","maxfps","fbxprec","autoRotationAxisFixed","zooming","picking","pick","editing","aromatic","singleUnit","stereo","interpolateViews","transparency","translationSpeed","example","good","ssaoKernelRadius","ssaoFactor","stereoBarrel","use","multiFile","Settings","old","_changed","path","oldValue","_notifyChange","merge","_notifyChanges","defaultValue","cloneDeep","checkpoint","deepValue","deepPath","changed","filter","applyDiffs","diffs","getDiffs","versioned","setPluginOpts","plugin","repIndex","asBoolean","adapters","string","boolean","cL1Ass","cOptsSep","cL2Ass","cLSep","cCommonIgnoreSymbols","getLevel1ExcludedExpr","cLevel1Ignores","getLevel2ExcludedExpr","cLevel2Ignores","cL1ExclExpr","encodeQueryComponentL1","cL2ExclExpr","encodeQueryComponentL2","ensureRepList","reps","ensureRepAssign","prop","_objects","newOpts","newObj","parseParams","sep","extractArgs","defaultsDict","bang","inputVal","arg","pair","adapter","actions","unit","menu","mt","materials","dup","_fromArray","entries","entry","isFunction","fromAttr","attr","fromURL","_processOptsForURL","_processArgsForURL","_processObjForURL","objOpts","toURL","stringList","checkAndAdd","addReps","repList","addObjects","objList","protocol","host","pathname","_processOptsForScript","_processArgsForScript","_processObjForScript","map","_processRepsForScript","repString","strIdx","localAdd","toScript","commandsList","command","saveQuotes","quote","trim","Atom","residue","role","het","serial","temperature","charge","mask","hydrogenCount","radicalCount","valence","bonds","flags","Flags","HYDROGEN","CARBON","isHet","isHydrogen","getVisualName","forEachBond","process","getFullName","_chain","getName","_sequence","NONPOLARH","Element","fullName","weight","radiusBonding","hValency","hydrogenValency","Constants","U1","Lead","U2","Wing","U18","Role","SG","ByAtomicNumber","ByName","byAtomicNumber","byName","getByName","cBondTypes","UNKNOWN","COVALENT","AROMATIC","getAtomPos","Bond","right","order","fixed","_left","_right","_fixed","_order","_type","getLeft","getRight","getOrder","calcLength","distanceTo","_forEachNeighbour","currAtom","forEachLevelOne","forEachLevelTwo","l2Atom","_fixDir","refPoint","currDir","posGetter","rightCount","leftCount","tmpVec","clone","checkDir","sub","dotProd","dot","checkCarbon","stages","stageId","multiplyScalar","calcNormalDir","third","maxNeibs","another","secondPos","firstV","secondV","crossVectors","lengthSq","normalize","BondType","THREE","cNucleicControlNames","cNucleicWing1Names","cNucleicWing2Names","cCylinderSource","cCylinderTarget","types","atoms","Residue","chain","sequence","icode","_component","_icode","_mask","_atoms","_secondary","_firstAtom","_leadAtom","_wingAtom","_lastAtom","_controlPoint","_midPoint","_wingVector","_cylinders","_isValid","_het","_molecule","getChain","getMolecule","getSequence","getSecondary","getICode","addAtom","xyz","tempFactor","complex","getComplex","getAtomCount","forEachAtom","_findAtomByName","_findFirstAtomInList","names","collectMask","getCylinderTargetList","_name","_detectLeadWing","getAtomPosition","leadAtom","wingStart","wingEnd","cylSource","targetList","cylTarget","calcWing","prevLeadPos","currLeadPos","prevWingPos","prevWing","vectorA","vectorB","needToNegate","angleTo","negate","_innerFinalize","prevRes","prev","nextRes","chainAsNucleic","bFirstInChain","lp","Vector3","lerp","_finalize2","asNucleic","isConnected","anotherResidue","_finalize","tempCount","occupCount","ResidueType","letterCode","_fullName","StandardTypes","ALA","ARG","ASN","ASP","CYS","GLN","GLU","GLY","HIS","ILE","LEU","LYS","MET","PHE","PRO","PYL","SEC","SER","THR","TRP","TYR","VAL","DA","DC","DG","DI","DT","DU","WAT","H2O","HOH","DOD","UNK","UNL","PROTEIN","BASIC","ACIDIC","POLAR","NONPOLAR","NUCLEIC","PURINE","PYRIMIDINE","DNA","RNA","WATER","_addFlag","flag","hydro","_addParam","ChainType","Chain","_complex","_residues","minSequence","POSITIVE_INFINITY","maxSequence","NEGATIVE_INFINITY","getResidues","_determineType","residues","findResidue","seqNum","iCode","curr","updateToFrame","frameData","prevData","frameRes","currData","addResidue","getResidueType","addResidueType","getResidueCount","forEachResidue","StructuralElement","init","term","generic","genericByType","serialAtomMap","residueHash","splitUnifiedSerial","serialId","hashCode","getUnifiedSerial","Type","STRAND","BRIDGE","HELIX_310","HELIX_ALPHA","HELIX_PI","HELIX","TURN_310","TURN_ALPHA","TURN_PI","TURN","BEND","COIL","Generic","LOOP","StructuralElementType","StructuralElementGeneric","typeByPDBHelixClass","Helix","helixClass","comment","Strand","sheet","sense","atomCur","atomPrev","as","Sheet","_width","_strands","getWidth","addStrand","addEmptyStrand","SGroup","saveNode","_id","_position","_charge","_repeat","_center","xmlNodeRef","getPosition","getCentralPoint","_rebuildSGroupOnAtomChange","nLimon","bLow","bHight","aPos","addVectors","includes","toJSON","List","_values","splice","valuesArray","upperOnly","_validate","Selector","ListSelector","RangeListSelector","ValueListSelector","caseSensitive","NoneSelector","includesAtom","_atom","AllSelector","none","PrefixOperator","rhs","InfixOperator","lhs","keywords","defineSelector","SelectorClass","factory","SerialSelector","NameSelector","AltLocSelector","ElemSelector","ResidueSelector","SequenceSelector","ICodeSelector","ResIdxSelector","ChainSelector","HetatmSelector","PolarHSelector","NonPolarHSelector","NULL_SELECTOR","defineOperator","OperatorClass","NotOperator","AndOperator","OrOperator","byResidueTypeFlag","selectors","exc","BiologicalUnit","_selector","_boundaries","boundingBox","Box3","boundingSphere","Sphere","computeBoundaries","makeEmpty","expandByPoint","bbc","getCenter","setFromCenterAndSize","radiusSquared","pos","lengthSquared","distanceToSquared","sqrt","getTransforms","getSelector","getBoundaries","finalize","Assembly","chains","matrices","oldCenter","oldRad","applyMatrix4","newRad","addScalar","subScalar","addChain","addMatrix","matrix","Component","_residueIndices","_cycles","_subDivs","_residueCount","resIdc","idIdc","idCount","last","setSubDivs","subDivs","resCnt","_bonds","forEachCycle","cycle","addCycle","cycles","markResidues","_forEachSubChain","subs","currRes","endRes","getMaskedSequences","_subIdx","getMaskedSubdivSequences","currIdx","lastSubIdx","subIdx","boundaries","cMaxPairsForHashCode","cHashTableSize","cNumbersPerPair","cMaxNeighbours","cInvalidVal","cBigPrime","AtomPairs","maxPairsEstimate","numPairs","numMaxPairs","intBuffer","hashBuffer","destroy","addPair","indexA","indexB","ia","ib","codeToAdd","apI","cProfileBondBuilder","cEstBondsMultiplier","cSpaceCode","cBondTolerance","cVMDTolerance","cBondRadInJMOL","cEpsilon","_getBondingRadius","_isAtomEligible","AutoBond","_maxRad","bBox","getDefaultBoundaries","_vBoxMin","_vBoxMax","_pairCollection","_addExistingPairs","getAtoms","numAtoms","aInd","collection","numBondsForAtom","bInd","indTo","_findPairs","vw","getVoxelWorld","atomsNum","rA","isHydrogenA","posA","locationA","atomA","processAtom","atomB","locationB","dist2","rB","maxAcceptable","forEachAtomWithinRadius","_addPairs","iA","iB","_addPair","bondsA","numBonds","newBond","addBond","build","_buildInner","timeEnd","_calcBoundingBox","nAtoms","maxRad","cCrossThresh","cAromaticType","cAromaticAtoms","_coDirVectors","v1Tmp","v2Tmp","cp","v1","v2","_insertAscending","_anotherAtom","_cosBetween","theta","MathUtils","_markAromatic","Cycle","atomsList","nA","nextAtom","checkBond","_isAromatic","_isPossibleAromatic","rightIdx","leftIdx","_checkCycleSimple","_checkCycleComplex","assert","AromaticLoopsMarker","bondsData","bondMarks","_bondsData","_bondMarks","_resetCycles","_currIdx","_haveSameCycle","bond1","bond2","arr1","arr2","n1","n2","i1","i2","_tryBond","prevBond","currRight","bondsOrder","currLeft","currVec","startAtomRef","_currStart","checkAromatic","_checkBond","anotherAtom","anotherVec","newDir","cross","dir","newRight","_startCycle","_findLoops","checkCycle","forEachComponent","component","newCycle","markCycles","detectCycles","_getSphereSliceRadiusRange","zMin","zMax","dzMin","dzMax","rzMin","rzMax","rMin","rMax","_getCircleSliceRadiusRange","yMin","yMax","dyMin","dyMax","ryMin","ryMax","VoxelWorld","box","vCellSizeHint","_box","getSize","divide","_last","_cellSize","_cellInnerR","_cellOuterR","numVoxels","_voxels","addAtoms","voxelIdx","_findVoxel","_zero","_voxel","point","voxel","_forEachAtomInVoxel","_xRange","Vector2","_yRange","_zRange","_forEachVoxelWithinRadius","xRange","yRange","zRange","_forEachVoxelWithinRadiusSimple","rRangeXY","rRangeX","xVal","yVal","zVal","isInsideX","isInsideY","isInsideZ","divideScalar","clampScalar","_vCenter","vCenter","distTouch2","distInside2","d2","r2","isInside","forEachAtomWithinDistFromMasked","dist","_forEachAtomWithinDistFromGroup","atomProc","forEachAtomWithinDistFromSelected","voxels","processIfWithin","PairCollection","MINIMAL_DISTANCE","MIN_HBOND_ENERGY","MAX_HBOND_ENERGY","COUPLING_CONSTANT","MAX_COUPLING_DISTANCE","MAX_RESIDUES_THRESHOLD","HBondInfo","_hbonds","_buildVW","_build","isBond","from","to","acc0","acc1","acceptor","energy","ri","preri","rj","prerj","_calcHBondEnergy","pairs","_residueGetCAlpha","_residueGetCO","_residueGetNH","predonor","donor","distanceHO","distanceHC","distanceNC","distanceNO","donorInfo","accInfo","BridgeType","freeze","NO_BRIDGE","PARALLEL","ANTI_PARALLEL","HelixFlag","START","MIDDLE","END","START_AND_END","StructureType","SecondaryStructureMap","_ss","_sheet","_betaPartners","_bend","_helixFlags","_chainLengths","_chains","_buildBetaSheets","_buildAlphaHelices","inResidues","chainLength","inPreferPiHelices","stride","kappa","_kappa","_isHelixStart","isTurn","_cosinusAngle","p1","p2","p3","p4","v12","v34","prevPrev","nextNext","curCA","ppCA","nnCA","ckap","skap","atan2","bridges","lenA","chainA","lenB","chainB","_testBridge","found","bridge","unshift","chainI","chainJ","ibi","iei","jbi","jei","ibj","iej","jbj","jej","_hasChainBreak","bulge","ladderset","Set","ladder","delete","sheetset","toMove","_areBridgesLinked","betai","betaj","parallel","ai","aj","has","VOXEL_SIZE","helixClassMap","loopMap","Complex","_components","_helices","_sheets","structures","_residueTypes","_sgroups","_molecules","_maskNeedsUpdate","metadata","symmetry","units","_currentUnit","addSheet","addHelix","getBonds","forEachChain","resName","rt","getSGroupCount","getSGroups","getAtomByFullname","resId","localeCompare","getChainCount","getMolecules","getMoleculeCount","forEachMolecule","molecules","forEachSGroup","groups","components","forEachVisibleComponent","getBondCount","maxSerial","chainShift","uniSerial","remnant","ser","_fillCmpEdit","addComp","comp","resCount","currStart","_fillCmpNoedit","currSubDivs","_fillComponents","enableEditing","getCurrentUnit","resetCurrentUnit","setCurrentUnit","newUnit","_computeBounds","onAtomPositionChanged","_finalizeBonds","updateStructuresMask","helices","sheets","needAutoBonding","autoConnector","other","marker","detectAromaticLoops","_finalizeMolecules","molecule","updater","structure","countAtomsByMask","getNumAtomsBySelector","resetAtomMask","markAtoms","setMask","clearMask","totalSelector","markAtomsAdditionally","clearAtomBits","reseter","getAtomNames","_atomNames","dict","getElements","_elements","getResidueNames","_residueNames","getChainNames","_chainNames","getAltLocNames","_altlocNames","_voxelWorld","addElement","srcArray","dstArray","functor","elem","joinComplexes","complexes","atomBias","bondBias","residueBias","chainBias","componentBias","bias","processBond","processResidue","processChain","processComponent","doNothing","ssMap","getSheet","item","lastCode","lastSheetIndex","lastHelixIndex","curStructure","curCode","curResidue","curSheetIndex","loopType","curSheet","pow2ceil","Volume","dimensions","vecSize","volumeInfo","_dimVec","_volumeInfo","_dimX","_dimY","_dimZ","_rowElements","_planeElements","_totalElements","_data","getValue","setValue","addValue","getDimensions","getBox","getVolumeInfo","getCellSize","boxSize","computeGradient","vl","vs","xSize","ySize","zSize","volMap","_voxelValue","zi","zm","zp","yi","ym","yp","xi","xm","xp","getTiledTextureStride","buildTiledTexture","tilesX","tilesY","tileRow","texture","DataTexture","LuminanceFormat","UnsignedByteType","UVMapping","ClampToEdgeWrapping","LinearFilter","needsUpdate","getData","getDirectIdx","getStrideX","getStrideY","getStrideZ","Molecule","CSS2DObject","Object3D","_element","getElement","setTransparency","transp","op","op100","opacity","RCGroup","Group","raycast","raycaster","intersects","visible","children","enableSubset","innerOnly","disableSubset","getSubset","totalSubset","vertexScreenQuadShader","fragmentScreenQuadFromTex","fragmentScreenQuadFromTexWithDistortion","LAYERS","VOLUME","TRANSPARENT","PREPASS_TRANSPARENT","VOLUME_BFPLANE","COLOR_FROM_POSITION","SHADOWMAP","SELECTION_LAYERS","resetTransform","quaternion","updateMatrixWorldRecursive","updateMatrixWorld","addSavingWorldTransform","_worldMatrixInverse","Matrix4","matrixWorld","invert","multiply","decompose","WebGLRenderer","renderDummyQuad","_material","MeshBasicMaterial","depthWrite","_scene","Scene","_quad","Mesh","PlaneGeometry","_camera","OrthographicCamera","render","renderScreenQuad","isIdentity","identity","equals","applyToPointsArray","elements","persp","ScreenQuadMaterial","RawShaderMaterial","uniforms","srcTex","vertexShader","depthTest","renderScreenQuadFromTex","fragmentShader","renderScreenQuadFromTexWithDistortion","coef","PerspectiveCamera","setMinimalFov","angle","aspect","fov","radToDeg","atan","tan","degToRad","StereoCamera","updateHalfSized","camera","originalAspect","originalFov","updateProjectionMatrix","setDistanceToFit","Raycaster","intersectVisibleObject","gfxObj","fogFarPlane","intersectObject","nearPlane","near","matrixWorldInverse","farPlane","far","extractScale","_v","te","det","determinant","_calcCylinderMatrix","posBegin","posEnd","posCenter","matScale","makeScale","matRotHalf","makeRotationX","matRotLook","vUp","lookAt","setPosition","_calcChunkMatrix","eye","up","rad","_groupHasGeometryToRender","group","hasGeoms","_buildDistorionMesh","widthSegments","heightSegements","calcInverseBarrel","epsilon","prevR2","curR2","dr","geo","getAttribute","setXY","BufferAttribute","copyAtList","attribute","indexList","fillArray","startIndex","endIndex","removeChildren","clearTree","LineSegments","Line","geometry","dispose","destroyObject","belongToSelectLayers","layers","processObjRenderOrder","root","idMaterial","renderOrder","isGroup","applySelectionMaterial","setValues","depthFunc","LessEqualDepth","overrideColor","lights","shadowmap","setUberOptions","fixedColor","Color","zOffset","getMiddlePoint","point1","point2","optionalTarget","addScaledVector","_oldInstancedBufferGeometryCopy","InstancedBufferGeometry","source","instanceCount","calcCylinderMatrix","calcChunkMatrix","groupHasGeometryToRender","buildDistorionMesh","gfxutils","_defaultBoundaries","Visual","dataSource","_dataSource","release","getDataSource","_ensureArray","EntityList","entities","_list","_dict","_indices","entity","register","registerInList","unregisterFromList","registerInDict","unregisterFromDict","unregister","all","makeContextDependent","defineProperties","CollisionSphere","_radius","_sphere","sphere","ray","intersectSphere","distance","origin","SphereCollisionGeo","setSphere","inters","chunkIdx","computeBoundingBox","computeBoundingSphere","tmpColor","OFFSET_SIZE","COLOR_SIZE","setArrayXYZ","setArrayXYZW","InstancedSpheresGeometry","spheresCount","sphereComplexity","useZSprites","_sphGeometry","SphereBufferGeometry","_init","setItem","itemIdx","itemPos","itemRad","_offsets","setColor","colorVal","_colors","startUpdate","finishUpdate","setOpacity","chunkIndices","alphaArr","_alpha","geom","sphereGeo","alpha","fill","InstancedBufferAttribute","MAX_IDC_16BIT","VEC_SIZE","ChunkedObjectsGeometry","BufferGeometry","chunkGeo","chunksCount","_chunkGeo","colors","chunkSize","_chunkSize","mesh","facesPerChunk","faceIndex","srcPos","_positions","srcNorm","_normals","srcColor","dstPos","dstNorm","dstColor","dstPtOffset","ptIdxBegin","ptIdxEnd","attributes","chunkIndex","chunkIndexSize","pointsCount","use32bitIndex","indexSize","Uint32Array","Uint16Array","posOffset","setIndex","SimpleSpheresGeometry","sphGeometry","normals","geoNormals","normal","_chunkPos","_tmpPositions","tmpPos","geoPos","centerPos","tmpVector","normMtx","Matrix3","Simple2CCylindersGeometry","cylGeometry","CylinderGeometry","_chunkNorms","_tmpVector","botPos","topPos","firstOffset","secondOffset","tmpArray","geoNorm","lerpVectors","mtx1","getNormalMatrix","fromArray","toArray","applyMatrix3","colorVal1","colorVal2","MAX_POINTS_COUNT_16BIT","PTS_PER_TRIANGLE","CylinderBufferGeometry","radiusTop","radiusBottom","radialSegments","heightSegments","openEnded","thetaStart","thetaLength","parameters","hasTop","hasBottom","vertexCount","facesCount","heightHalf","positions","Uint16BufferAttribute","uvs","currVtxIdx","currFaceIdx","tanTheta","v3","v4","setXYZ","vx","vy","vz","startTIdx","lastIdx","fTIdx","currSrcIdx","getX","getY","getZ","nextTVtx","startBIdx","lastBIdx","fBIdx","currSrcBIdx","nextBVtx","invMatrix","sortNumber","_prepareCylinderInfo","chunksIdx","cylinderInfo","even","newPar","_assignOpacity","color1","color2","Instanced2CCylindersGeometry","_useZSprites","_cylGeometry","_collisionGeo","me","mtxOffset","_matVector1","_matVector2","_matVector3","_invmatVector1","_invmatVector2","_invmatVector3","colorIdx","_color1","_color2","cylinderIndices","getGeoParams","cylinderGeo","TRI_SIZE","tmpPrev","tmpNext","tmpRes","simpleNormal","normalOnCut","nearRingPt","_createExtrudedChunkGeometry","shape","ringsCount","ptsCount","totalPts","ExtrudedObjectsGeometry","_ringsCount","tmpShape","_tmpShape","hasSlope","hasCut","chunkStartIdx","_setPoints","_setSlopeNormals","_setBaseNormals","_addCut","vtxIdx","mtx","nPtsInRing","_countNormalsInRing","isSlope","shiftToExtraPt","subVectors","VERTEX_PER_SEGMENT","POS_SIZE","DIR_SIZE","COL_SIZE","startSegmentIdx","segmentsCount","elemSize","ThickLinesGeometry","_initVertices","segmentIdx","setSegment","pos1","pos2","directions","_directions","dirIdx","startSegIdx","endSegIdx","getSubsetSegments","getSubsetColors","getSubsetOpacities","getNumVertexPerSegment","getPositionSize","setSegments","startPos","startDir","setColors","_buffersSize","indexOffset","pointOffset","BaseLinesGeometry","LinesGeometry","posSize","CylinderCollisionGeo","itemOffset","COLLISION_RAD","ChunkedLinesGeometry","enableCollision","collisionGeo","segCount","segIdx","TwoColorLinesGeometry","segmentIndices","_segCounts","vectors","vecCount","tempPos1","tempPos2","CrossGeometry","POS_RAD_SIZE","IsoSurfaceGeometry","_opts","_posRad","posRad","IsoSurfaceMarchCube","pointsValuesLinear","hasIntersection","bitsInside","numCellsPerSide","vx7000000","n3","striIndicesMarchCube","edgeTable","_voxelGradientFast","grad","GridCell","_arrSize","cubeIndex","Triangle","createArray","arrSize","IsoSurface","_numTriangles","_numVertices","_volumetricData","_xAxis","_yAxis","_zAxis","_xDir","_yDir","_zDir","_prepareAxesAndDirs","volData","cellSize","xAxis","yAxis","zAxis","xDir","yDir","zDir","tmp","notZero","axe","EPSILON","_vertexInterp","isoLevel","grid","ind1","ind2","vertex","valP1","valP2","isoDiffP1","diffValP2P1","mu","_triTable","_firstIndices","_secondIndices","_vertexList","_normalList","_polygonize","triangles","firstIndices","secondIndices","vertexList","normalList","triCount","triTblIdx","triTable","_doGridPosNorms","step","appendSimple","vol","dim","stepX","stepY","stepZ","gc","gcVal","gcValSize","additions","tmpTriCount","appendVertex","axis","triVertex","_origin","posMtx","globTriCount","_gradient","compute","_remapIndices","vertexMap","idcCount","newIndices","_remapVertices","vertices","newPositions","newNormals","norm","vertexFusion","faceVer","oldVerCount","vMap","newVer","matchedIndex","setColorVolTex","colorMap","atomMap","atomWeightMap","visibilitySelector","numVerts","xs","ys","zs","colorData","strideX","strideY","strideZ","atomWeightData","atomStrideX","atomStrideY","atomStrideZ","xInv","yInv","zInv","atomLookup","atomWeights","interp","idx1","idx2","collectWeight","coefX","coefY","coefZ","newVerCount","ind","mux","muy","muz","maxWeight","dominantIdx","atomIdx","c0","c1","c2","c3","cz0","cz1","numTriangles","newTriCount","i0","toMesh","VolumeSurfaceGeometry","_visibilitySelector","_calcSurface","_findMinMax","posRadArray","itemsCount","maxPosRad","minPosRad","tmpVal","_findNumVoxels","minMaxValues","minCoordRad","maxCoordRad","gridPadding","radScale","padRad","bbox","_makeSurface","surface","isoSurf","volTexMap","packedArrays","_computeSurface","chem","QuickSurfGeometry","_shiftByOrigin","gaussdensity","atomicNum","invIsoValue","invGridSpacing","maxVoxelX","maxVoxelY","maxVoxelZ","volTexData","texStrideX","scaledRad","atomicNumFactor","radInv","radLim","radLim2","xMin","xMax","dy2dz2","addr","texAddr","expVal","density","exp","colInd","originX","originY","originZ","AVHash","maxDistance","minX","minY","minZ","maxX","maxY","maxZ","hashFunc","minW","iDim","jDim","kDim","nCells","jkDim","cellID","preHash","cid","iIdx","cellOffsets","cellLengths","maxCellLength","subArray","cellLength","neighbourListLength","withinRadii","rExtra","out","outIdx","nearI","nearJ","nearK","loI","loJ","loK","hiI","hiJ","hiK","iOffset","jOffset","cellStart","cellEnd","dataIndex","baseIndex","rSum","ContactSurface","_indexList","maxRadius","lastClip","volTex","weights","weightsMap","gridx","gridy","gridz","sinTable","cosTable","neighbours","mid","ngTorus","uniformArray","TypeName","innI","fillGridDim","initializeGrid","gridSize","initializeAngleTables","initializeHash","rExt","singleAtomObscures","innX","innY","innZ","innCI","ra2","obscured","ni","projectPoints","sigma","sigma2Inv","ax","ay","az","ar2","ng","iax","iay","iaz","minx","miny","minz","maxx","maxy","maxz","colIdx","cr","cg","cb","iz","iy","dzy2","zyOffset","ix","cIdx","ap","spx","spy","spz","dd","normalToLine","projectTorus","aIdx","bIdx","xa","ya","za","r1","innR2","cosA","dmp","rInt","cost","sint","px","py","pz","current","projectTorii","innIdx","fixNegatives","innInnI","getVolume","ContactSurfaceGeometry","contactSurface","IsoSurfaceAtomColored","radiusAt","coord","colorX","colorY","colorZ","atomType","srcAtom","IsosurfaceBuildNormals","vBoxMin","vBoxMax","_numAtoms","_probeRadius","_atomsList","_voxelList","createVoxels","numAtomsRefs","ATOM_VOXEL_REF_SCALE","aveRad","numCells","_numCells","_aveRad","side","side2","side3","xScale","_xScale","yScale","_yScale","zScale","_zScale","maxAtomsRefs","xNumVoxMult","yNumVoxMult","zNumVoxMult","radAffect","diaAffect","numVoxX","numVoxY","numVoxZ","xIndMin","yIndMin","zIndMin","xIndMax","yIndMax","zIndMax","indVoxel","indexNext","destroyVoxels","_vertices","forEachRelatedAtom","xInd","yInd","zInd","ref","indexAtom","getClosestAtom","closest","minDist2","MAX_VALUE","buildNormals","numVertices","numCloseAtoms","vNormalX","vNormalY","vNormalZ","koef","r25","r01","maxRadAffect","maxRadAffect2","expScale","gatherNormals","maxClosedAtoms","buildColors","radiusColorSmoothness","KOEF_ADD","colorsClose","weightsSum","gatherColors","weightNormalized","IsoSurfaceGeo","maxNumVertices","maxNumTriangles","needVertexColors","_maxNumVertices","_maxNumTriangles","HASH_SIZE","SSIsosurfaceGeometry","_innerBuild","geoOut","getGeo","_fromGeo","numTri3","convertToAtomsColored","atomsColored","nm","hashLines","hashEntries","getBoundingBox","bigNum","probeRadius2","atomRadiusScale","radMax","num","getCornerCoord","numPoints","vOut","invNP","tx","ty","tz","buildEdgePoint","sign","cube","indexPointValue","cTwentyFour","xb","yb","zb","isTriangleVisible","v0","a0","voxelWorld","a1","a2","addTriangle","indInGeo0","addVertexToGeo","indInGeo1","indInGeo2","itr","buildGeoFromCorners","meshRes","vCellStep","cNumVerts","vaEdges","vCorner","indCell","indY","indZ","indPointValues","indValues","offs","numTri","indTri","getNumIntersectedCells","numIntersectedCells","cubeValuesIndex","indCorner","letter","atomT","calculateGridCorners","probeRad","vDif","aLot","fx","fy","fz","indXMin","indYMin","indZMin","indXMax","indYMax","indZMax","distToSphere","createVertexHash","numHashEtriesAllocated","numHashEntryIndex","getNewHashEntry","vAdd","oneHynberes","n815851","n37633","n2453543","r106","hashResolution","marCubeResoultion","iHash","hLineIndex","dot2","iVertAdd","entryFirst","modifyExcludedFromGeo","probeSphereRadius","distToBorder","r11","innerBlockWorkAround","probeSpRad2","sideInv","radEst","xCorner","yCorner","zCorner","ok","expandFactor","meshResolution","colorMode","useVertexColors","excludeProbe","rProbeRadius","numIntersectedCellsEstim","probeRadForNormalsColors","createLabel","fieldTxt","spanText","fontSize","strings","spanNodeP","spanNodeText","LabelsGeometry","items","xTranslation","yTranslation","deltaPos","userData","textAlign","fColor","bColor","precision","renderer","capabilities","getMaxPrecision","noiseWidth","noiseHeight","_noiseData","_noiseWrapS","RepeatWrapping","_noiseWrapT","_noiseMinFilter","NearestFilter","_noiseMagFilter","_noiseMapping","noiseTexture","RGBAFormat","noise","_samplesKernel","defaultUniforms","UniformsUtils","UniformsLib","diffuse","specular","shininess","zClipValue","clipPlaneValue","nearPlaneValue","invModelViewMatrix","world2colorMatrix","dashedLineSize","dashedLinePeriod","projMatrixInv","viewport","samplesKernel","noiseTex","noiseTexelSize","srcTexelSize","uberOptionNames","uberOptions","zClipCoef","toonShading","UberMaterial","instancedPos","instancedMatrix","attrColor","attrColor2","attrAlphaColor","sphereSprite","cylinderSprite","fakeOpacity","prepassTransparancy","colorFromPos","shadowmapType","colorFromDepth","orthoCam","dashedLine","thickLine","fogTransparent","normalsToGBuffer","precisionString","DoubleSide","defines","extensions","createInstance","inst","USE_FOG","INSTANCED_POS","INSTANCED_MATRIX","ATTR_COLOR","ATTR_COLOR2","ATTR_ALPHA_COLOR","OVERRIDE_COLOR","SPHERE_SPRITE","fragDepth","CYLINDER_SPRITE","ZCLIP","CLIP_PLANE","FAKE_OPACITY","USE_LIGHTS","COLOR_FROM_POS","SHADOWMAP_PCF_SHARP","SHADOWMAP_PCF_RAND","SHADOWMAP_BASIC","COLOR_FROM_DEPTH","ORTHOGRAPHIC_CAMERA","PREPASS_TRANSP","DASHED_LINE","THICK_LINE","FOG_TRANSPARENT","drawBuffers","NORMALS_TO_G_BUFFER","TOON_SHADING","shallow","updateUniforms","SuperClass","NewObjectType","onBeforeRender","scene","_onBeforeRender","_update","UberObject","ZSpriteMesh","castShadow","receiveShadow","_geometry","_group","modelViewMatrix","multiplyMatrices","uniformsNeedUpdate","ZClippedMesh","_mvLength","_modelView","modelView","mvLength","setFromMatrixColumn","localToWorld","TextMesh","initialized","srcItem","label","visibility","SimpleMesh","_viewport","ThickLineMesh","projectionMatrix","InstancedMesh","ZClipped","ZSprite","Text","Instanced","geometries","meshes","setMatParams","_createInstancedCylinders","Geometry","initMaterial","_createLineSegmentsGeoTriplet","renderParams","thickLines","_createSimpleGeoTriplet","geoClass","_createIsoSurfaceGeoTriplet","caps","surfaceOpts","MeshCreator","createSpheres","create2CClosedCylinders","_caps","_settings","create2CCylinders","create2CLines","createCrosses","createExtrudedChains","createChunkedLines","createQuickSurface","createContactSurface","createSASSES","createLabels","TransformGroup","_inverseMatrix","_ray","Ray","geoParams","transforms","_geoParams","mat","_transforms","_createMeshes","inverseMatrix","childIntersects","ciCount","geos","meshCnt","wrapper","Name","ChemGroup","selection","_selection","_mode","_colorer","_chunksIdc","chunks","_polyComplexity","_geo","_makeGeoArgs","_mesh","chunksList","_calcChunksList","_changeSubsetOpacity","AtomsGroup","atomsIdc","AtomsSphereGroup","calcAtomRadius","getAtomColor","updateColor","needsColorUpdate","AtomsSurfaceGroup","selectedAtoms","getSurfaceOpts","AtomsSASSESGroupStub","adjustColor","inverseColor","getAtomText","getNode","colorMappings","adjust","inverse","propagateColor","rule","startsWith","templateMappings","hetatm","water","parseTemplate","AtomsTextGroup","getLabelOpts","fgColor","bgColor","_slerp","omega","oSin","AromaticGroup","radOffset","addChunk","chunksToIdx","prevVector","currVector","segmentsHeight","_segmentsHeight","leprStep","currAtomIdx","cCount","cycAtoms","chunkPoints","tmpDir","cycleRad","prevPos","currPos","upDir","currAngle","_createShape","pts","AromaticTorusGroup","torusRad","getAromRadius","radiusV","calcStickRadius","lookAtVector","mtc","points","currPoint","AromaticLinesGroup","getAromaticOffset","prevPt","getAromaticArcChunks","ResiduesGroup","chunksIdc","resIdx","NucleicItemGroup","stickRad","getResidueColor","_processItem","NucleicCylindersGroup","cyl1","cyl2","NucleicSpheresGroup","calcMatrix","_buildStructureInterpolator","argTrans","transformT","tt","newt","ans","_addPoints","centerPoints","topPoints","tp","_addPointsForLoneResidue","nucleic","nameFrom","nameTo","posFrom","posTo","shift","wing","cpPrev","tpPrev","cpNext","tpNext","_calcPoints","firstIdx","_prevIdx","_nextIdx","arrIdx","_extrapolate2","otherIdx","prevIdx","nextIdx","CartoonHelper","startIdx","endIdx","pointsArrays","_topInterp","_centerInterp","_shift","_valueStep","_segmentsCount","prepareMatrices","firstRad","secondRad","mtcCount","outMtc","currRad","topInterp","cenInterp","currentValue","mtxIdx","lerpVal","currTop","currCenter","nextCenter","_loopThrough","subDiv","subDivI","subDivN","idc","matrixHelper","prevLast","prevSecondRad","getResidueRadius","ResiduesSubseqGroup","cmpMultiplier","getHeightSegmentsRatio","getTension","chunkIdc","subdivs","ResiduesTraceGroup","chunk","getCylinderCount","BondsGroup","drawMultiple","drawMultiorderBonds","showAromatic","showAromaticLoops","bondsIdc","bondsCount","getBondOrder","bondIdx","BondsCylinderGroup","emptyOffset","calcSpaceFraction","normDir","leftPos","rightPos","currBondIdx","atom1","atom2","a1Pos","a2Pos","minRad","currStickRad","STEP_SIZE","BondsLinesGroup","bondDir","a1Hangs","a2Hangs","AtomsProcessor","_checkAtom","atomsGroup","meshIdx","chSubset","subsetEl","OrphanAtomsProcessor","ResiduesProcessor","ResidueGroup","_checkResidue","residuesGroup","checkResidue","ResidueProcessor","NucleicProcessor","SubseqsProcessor","jEnd","BondsProcessor","bondsGroup","AromaticProcessor","cycleIdx","perCycle","Atoms","OrphanAtoms","Residues","Nucleic","Subseqs","Bonds","Aromatic","processors","_bakeGroup","triplet","Processor","GroupsFactory","AtomsSpheres","gfxTriplet","OrphanedAtomsCrosses","BondsCylinders","BondsLines","CartoonChains","TraceChains","NucleicSpheres","NucleicCylinders","ALoopsTorus","ALoopsLines","QuickSurfGeo","ContactSurfaceGeo","SASSESSurfaceGeo","TextLabelsGeo","Mode","identify","buildGeometry","depGroups","currGroup","newGroup","getRenderParams","LinesMode","shortName","LicoriceMode","BallsAndSticksMode","VanDerWaalsMode","TraceMode","TubeMode","_residue","TUBE_RADIUS","CartoonMode","secCache","getResidueStartRadius","secOpts","getResidueEndRadius","ARROW_END","startRad","endRad","_res","tubeRad","secHeight","secData","SurfaceMode","surfaces","surfaceNames","getVisibilitySelector","isSurface","QuickSurfaceMode","useBeads","IsoSurfaceMode","_excludeProbe","_radScale","IsoSurfaceSASMode","IsoSurfaceSESMode","ContactSurfaceMode","TextMode","getTemplateOptions","lerpColor","beta","g1","b1","g2","b2","Palette","getElementColor","asIs","elementColors","defaultElementColor","residueColors","defaultResidueColor","getChainColor","chainColors","getSecondaryColor","secondaryColors","defaultSecondaryColor","getSequentialColor","getGradientColor","gradientName","gradients","defaultNamedColor","getNamedColor","namedColors","minRangeColor","midRangeColor","maxRangeColor","defaultGradientColor","namedColorsArray","rainbow","temp","hot","cold","reds","blues","CL","FE","NI","CU","BR","HE","LI","BE","NE","NA","MG","AL","SI","AR","SC","TI","CR","MN","ZN","GA","GE","AS","KR","RB","SR","ZR","NB","TC","RU","RH","PD","AG","CD","IN","SN","SB","TE","XE","BA","LA","CE","PR","ND","PM","SM","EU","GD","TB","DY","HO","ER","YB","LU","HF","TA","RE","OS","IR","PT","AU","HG","TL","PB","BI","PO","AT","RN","FR","RA","AC","TH","PA","NP","PU","AM","CM","BK","CF","ES","FM","MD","NO","LR","RF","DB","BH","HS","MT","dna","rna","cpkPalette","jmolPalette","vmdPalette","palettes","Colorer","ElementColorer","ResidueTypeColorer","SequenceColorer","ChainColorer","SecondaryStructureColorer","secondary","UniformColorer","ConditionalColorer","parsed","_subsetCached","ConformationColorer","TemperatureColorer","OccupancyColorer","_getColorByOccupancy","HydrophobicityColorer","hydrophobicity","MoleculeColorer","scaleColor","CarbonColorer","colorCarbon","colorNotCarbon","neutralColor","intensity","materialList","_gatherObjects","meshTypes","createDerivativeMesh","layer","newMesh","traverseMeshes","func","applyTransformsToMeshes","processTransparentMaterial","matValues","prepassTranspMesh","processColFromPosMaterial","colFromPosMesh","createShadowmapMaterial","shadowmapMesh","isShadowmapMesh","removeShadowmapMaterial","forEachMeshInGroup","processObj","_countMeshTriangles","attribs","property","currAttr","faces","countTriangles","totalCount","meshutils","Representation","startMaterialValues","selectorString","materialPreset","needsRebuild","setMode","unmarkAtoms","setMaterialPreset","selectionGeo","buildSelectionGeometry","sg","matrixAutoUpdate","compare","repSettings","selStr","valueOf","modeDiff","colorerDiff","change","newSelectorObject","newSelector","newMode","newColorer","newMaterial","_traverseComponentGroups","ComplexEditor","ComplexComponentEditor","complexVisual","_complexVisual","_inProgress","_componentTransforms","_bakeComponentTransform","_resetComponentTransform","finalizeEdit","discard","getAltObj","pivot","visual","getSelectedComponent","getSelectionGeo","selectionMask","getSelectionBit","reprNode","bbmin","bbmax","updateMatrix","ComplexFragmentEditor","_getSelectionBorderAtoms","_fragmentBoundAtoms","pivotPos","_fragmentGeo","_fragmentSelectionGeo","vg","smeshes","sm","selectionBit","makeTranslation","_bakeAtomTransform","isFreeRotationAllowed","boundAtoms","transformDirection","atomHash","ComponentEditor","FragmentEditor","ComplexVisualEdit","lookupAndCreate","entityList","specs","Entity","ComplexVisual","_reprList","_repr","_reprListChanged","_selectionBit","_reprUsedBits","_selectionCount","_selectionGeometry","getSelectionCount","getEditor","_editor","repCount","desc","status","repGet","_getFreeReprIdx","bits","NUM_REPRESENTATION_BITS","newSelectionBit","originalSelection","buildSelectorFromMask","def","hide","rebuildSelectionGeometry","resetSelectionMask","updateSelectionMask","pickedObj","otherObj","expandSelection","tmpMask","deselectionMask","shrinkSelection","multiple","getSelectionCenter","selRule","reprList","repr","Promise","resolve","errorOccured","setTimeout","hasGeometry","DEBUG","setNeedsRebuild","_buildSelectorFromSortedLists","optimizeList","NaN","expression","and","residx","forSelectedResidues","beginComponentEdit","editor","beginFragmentEdit","setMaterialValues","needTraverse","vertexVolumeFaces","fragmentVolumeFaces","vertexVolume","fragmentVolume","vertexFarPlane","fragmentFarPlane","volumeUniforms","volumeDim","tileTex","tileTexSize","tileStride","boxAngles","_isoLevel0","_flipV","_BFLeft","_BFRight","_FFLeft","_FFRight","_WFFLeft","_WFFRight","overrideUniforms","defUniforms","facesPosMaterialParams","sideType","BackFacePosMaterial","ShaderMaterial","backFaceParams","BackSide","ShaderParams","FrontSide","BackFacePosMaterialFarPlane","matUniforms","aspectRatio","farZ","tanHalfFOV","matWorld2Volume","shaderParams","FrontFacePosMaterial","frontFaceParams","VolumeMaterial","updateDefines","ISO_MODE","STEPS_COUNT","VolumeMesh","Plane","cullFlag","_corners","_edges","_edgeIntersections","edgeIntersections","_updateVertices","edges","constant","vert","cornerMark","edgeMark","curEdge","curEdgeInter","CheckX","CheckY","CheckZ","curEdgeIdx","curEdgeSource","face","nextVertex","coplanarPoint","_collectVertices","_sortIndices","_updateIndices","faceIdx","vRight","vDir","rightProj","numIndices","setDataSource","vm","image","volInfo","obtuseAngle","_updateIsoLevel","mean","dmean","dmin","span","dmax","sd","_nearClipPlaneOffset","_pos","_norm","_norm4D","Vector4","_matrixWorldToLocal","_clipPlane","nearClipPlaneOffset","norm4D","matrixWorldToLocal","getWorldDirection","getWorldPosition","setFromNormalAndCoplanarPoint","_flattenArray","VolumeBounds","_projectionTable","XY","XZ","YZ","bSize","offsetVert","_getBaseVertices","flatVertices","_lines","LineBasicMaterial","projTable","proj","inv","currDelta","angleValue","getMesh","VolumeFarPlane","volume","planeGeo","_initPlaneGeo","_plane","frustumCulled","doubleSided","matWorldToVolume","_renderer","planeCamPos","normalMatrix","volumeMatrix","DEG2RAD","VolumeVisual","_frame","showFrame","_farPlane","getBoundingSphere","needShow","LoaderList","someLoaders","SomeLoader","canProbablyLoad","Loader","_source","_options","_abort","_agent","abort","extractName","FileLoader","_binary","blob","reader","FileReader","readAsArrayBuffer","readAsText","File","urlStartRegexp","XHRLoader","request","ImmediateLoader","ParserList","someParsers","format","formats","SomeParser","canProbablyParse","parseSync","getModel","model","_parseHeader","Remark290","_matrix","_matrixIndex","stream","readString","matrixRow","readCharCode","matrixData","matrixIndex","parseFloat","Remark350","assemblies","_assembly","assembly","PDBStream","_start","_nextCR","_nextLF","_next","_end","readLine","readChar","readInt","readFloat","TAG_LENGTH","nameToElement","veryLong","pdbStartRegexp","remarkParsers","PDBParser","_serialAtomMap","_modelId","_compaundFound","_biomoleculeFound","_allowedChainsIDs","_lastMolId","_remarks","_remark","_compndCurrToken","fileType","_fixBondsArray","_fixChains","remark290","isUndefined","remark350","chainDict","chainObj","idChainMap","nj","_parseATOM","chainID","resSeq","_parseENDMDL","_parseCONECT","serial0","serial1","serial2","serial3","serial4","_parseCOMPND","tokenIdx","chainStr","lastChar","_parseREMARK","remarkNum","remark","RemarkParser","_parseHELIX","fields","_parseSTRUCTURE","_parseSHEET","pars","adder","startId","endId","codeOfS","serialNumber","structureName","helLength","shWidth","shCur","shPrev","startChainID","endChainID","startSequenceNumber","iCodeStr","startICode","endSequenceNumber","endICode","cs","_parseHEADER","classification","date","_parseTITLE","title","tagParsers","HEADER","HETATM","ENDMDL","CONECT","COMPND","REMARK","cOrderCharCodes","cmlStartRegexp","CMLParser","_readOnlyOneMolecule","_rebuidBondIndexes","countBonds","idxs","atomRefs2","_createSGroup","moleculeArr","fieldData","atomRefs","placement","fieldName","_extractSGroup","_extractSGroups","firstAtomRef","sgroupRef","mapEntry","cycleFuncInner","cycleFunc","x2","x3","y2","y3","z3","atomsRef","_traverseData","dom","parseNode","xmlNode","nodeName","nodeValue","jsonNode","existing","childNodes","_findSuitableMolecule","molSet","atomArray","_selectComponents","DOMParser","doc","parseFromString","traversedData","rawData","prepareComponentCompound","ret","atomLabels","labelsCount","localBond","bondArray","addCurrBond","orderAttr","tc","labels","_breadWidthSearch","retStruct","originalCML","cml","retData","filteredData","rd","_packLabel","compId","molId","_unpackLabel","molID","breadthQueue","componentID","labeledAtoms","startID","_parseBond","eAtom","mainAtom","_parseSet","varData","currentLabel","addFunc","complexAtom","reorder","atomCharge","lLabel","atomFullNameStruct","elementType","countRef","currAtomComp","strLabel","stringify","atomSerial","added","mrvValence","sGrp","moleculaSet","totalAtomsParsed","joinedComplex","ArrayComparator","original","_original","_sum","candidate","sorted","secStructToType","getFirstByte","buf","MMTFParser","isArrayBuffer","_onModel","_modelData","_onChain","chainData","_onGroup","groupData","_updateSecStructure","_onAtom","atomData","_onBond","bondData","helixClasses","_ssType","_ssStruct","_ssStart","struct","_updateMolecules","mmtfData","chainsInModel0","chainIndexList","description","_traverse","structureId","releaseDate","eventCallbacks","modelData","_linkAtomsToResidues","_findSynonymousChains","named","_parseAssemblyInfo","bioAssemblyList","baInfo","transformList","chainListCheck","chainNames","allChains","_chainsByName","transpose","_markHeteroAtoms","_joinSynonymousChains","primaryChainsArray","primaryChainsHash","primary","ParsingError","column","captureStackTrace","parseLine","parseColumn","_isWhitespace","_inlineIndexOf","ch0","readCIF","newline","block","keysCount","valuesCount","_parseValue","_storeKey","_storeValue","keyIndex","cRequiredAtomFields","cSecondaryCoding","helx","turn","strn","getTypeFromId","typeId","arrize","arrayLikeObject","AtomDataError","_getOperations","operList","vector","ops","_extractOperations","assemblyGen","opsDict","groupStr","gps","grIdx","grCount","gr","gp","es","cnt","ii","nn","newMtx","CIFParser","asymDict","_toComplex","cifData","complexData","_extractAtoms","_extractSecondary","_extractAssemblies","_extractMolecules","_extractMetadata","struct_keywords","pdbx_keywords","databaserev","database_PDB_rev","date_original","molData","pdbx_description","atom_site","auth_seq_id","Cartn_x","Cartn_y","Cartn_z","label_atom_id","group_PDB","chainIdc","auth_asym_id","chainLabelIdc","label_asym_id","serials","iCodes","pdbx_PDB_ins_code","resNames","label_comp_id","type_symbol","tempFactors","B_iso_or_equiv","occupancies","charges","pdbx_formal_charge","altLocs","label_alt_id","models","pdbx_PDB_model_num","label_entity_id","moleculeIdx","struct_conf","_extractConfs","struct_sheet_range","_extractSheets","sheetData","sheet_id","beg_label_seq_id","end_label_seq_id","beg_label_asym_id","sheetNames","strandNames","starts","beg_auth_seq_id","ends","end_auth_seq_id","stICodes","pdbx_beg_PDB_ins_code","endICodes","pdbx_end_PDB_ins_code","helicesData","conf_type_id","comments","details","lengths","pdbx_PDB_helix_length","pdbx_PDB_helix_class","asmGen","pdbx_struct_assembly_gen","asmIdx","assembly_id","asmOper","oper_expression","asmList","asym_id_list","pdbx_struct_oper_list","asm","assemblyOps","valueType","singular","VolumeModel","_xyz2crs","_header","_boxSize","_boxStart","extent","nstart","crs2xyz","cellDims","angles","_typedCheck","isTypedArray","_buff","TypeError","_fillHeader","headerFormat","arrays","_parseArray","_parseVector","_buffer","_setAxisIndices","_setOrigins","_getAxis","header","gamma","z1","z2","xaxis","yaxis","zaxis","_getXYZdim","_getVolumeInfo","_setBoxParams","shiftX","shiftY","_getXYZbox","_toXYZData","CCP4Header","ispg","nsymbt","lksflg","customData","machine","nlabel","Ccp4Model","u32","i32","f32","xyz2crs","xyzData","crsIdx","CCP4Parser","XYZParser","_atomsInf","_fileName","_parseToAtomsInf","endnAtoms","endComment","startAtomsInf","_parseAtomsInf","words","PubChemParser","jsonData","PC_Compounds","aids","aid","fromPairs","zip","coords","conformers","aids1","aid1","aids2","aid2","orders","SDFStream","_strings","_currentStart","_currentStringIndx","setStart","getNextString","getCurrentString","getStringFromStart","numb","findNextDataItem","curStr","findNextCompoundStart","probablyHaveDataToParse","chargeMap","orderMap","typeMap","sdfAndMolRegexp","sdfRegExp","fileFormat","SDF","MOL","possibleNameTags","possibleIDTags","possibleTitleTags","tagsNames","tags","buildChainID","codes","trunc","reverse","SDFParser","_format","_metadata","_currentMolProps","_compoundIndx","_assemblies","_atomsParsed","_atomsIndexes","_parseAtoms","_parseBonds","bondsNum","bondType","_parseMOL","countsLine","_parseDataItem","_parseCompound","props","_tryToUpdateMoleculeData","_buildAssemblies","_buildMolecules","_searchTag","_tryToFind","tagsList","tagPossibleNames","_finalizeMetadata","defineFormat","DSN6Header","div","DSN6Model","i16","_pointCalculate","byteBuffer","counter","_blockCalculate","zBlock","yBlock","xBlock","inRange","blocks","_calculateInfoParams","dispersion","minDensity","maxDensity","DSN6Parser","canParse","checkDataTypeOptions","GROReader","getNext","GROParser","_time","_residueNumber","_residueName","_atomName","_atomNumber","_atomPosition","_atomVelocity","filetype","_parseTitle","_parseNumberOfAtoms","_parseAtom","positionX","positionY","positionZ","un","am","nc","du","resNumberRegex","spacesRegex","splitToFields","MOL2Parser","_currPosIdx","_currStartIdx","_parseRawStrings","_toStringFromStart","MOL2Data","newPosIdx","_toHeaderString","_toStringFromHeader","_setStart","_probablyHaveDataToParse","_findNextCompoundStart","_parseMolecule","parsedStr","_setResidue","originAtomId","targetAtomId","_fixSerialAtoms","currMolecule","molResidues","ExporterList","someExporters","Exporter","exportSync","export","PDBResult","_resultArray","_currentStr","_tag","_fixedNumeration","_numeration","_tagStrNum","getResult","writeString","_currentStrLength","newTag","numeration","isBoolean","newString","writeEntireString","maxStrPos","curStrLength","finish","repeat","cStr","writeBondsArray","bondsArrays","_getSubArrays","subArraySize","subArrays","writeMatrix","matrixIndx","toFixed","writeMatrices","PDBExporter","_tags","_result","_tagExtractors","_extractHEADER","TITLE","_extractTITLE","_extractATOM","_extractCONECT","_extractCOMPND","_extractREMARK","_extractHELIX","SHEET","_extractSHEET","_stringForRemark350","_stringForRemark290","fixedBonds","strands","startIndx","_getMoleculeChains","chainsString","_Remark290","_Remark350","biomolIndx","getChainName","SourceClass","FBX_POS_SIZE","FBX_NORM_SIZE","FBX_COL_SIZE","copyFbxPoint3","srcIdx","dstIdx","copyFbxPoint4","vector4","copyTransformedPoint3","setSubArray","copyFunctor","functorOpts","arridx","FBXModel","lastPos","lastNorm","lastCol","vertsCount","indsCount","setPositions","setTransformedPositions","setNormals","setTransformedNormals","setIndices","setShiftedIndices","shifted","getVerticesNumber","addInstance","currentCount","FBXGeometry","_info","FBX1CGeometry","cl","FBX2CCylinder","_cutRawStart","_cutRawEnd","_facesPerSlice","addPerCylinder","_extendVertices","_extendIndices","cutRaw","indicesPerQuad","startToShift","_setColorRange","colorSize","part1End","part2End","capSize","cap1End","cap2End","FBXInfoExtractor","_materials","_models","_extractModelsAndMaterials","_flattenModels","layersOfInterest","Layers","checkExportAbility","_collectInstancedGeoInfo","_collectGeoInfo","_reworkIndices","faceSize","overallVertsCount","combined","verticesCount","vertCount","_collectMaterialInfo","_addToPool","_collectSpheresInfo","instCount","instMatrix","objMatrix","sphereColor","instanceIndex","_getSphereInstanceMatrix","_collectCylindersInfo","oneCCylinder","splittingInfo","_gatherCylindersColoringInfo","twoCCylinder","needToSplit","additionalVertsCount","colorStart","colorEnd","is2Colored","_getCylinderInstanceMatrix","materialIdx","_checkExistingMaterial","findIndex","differs","instIdx","matVector1","matVector2","matVector3","idxOffset","defaultDefinitions","defaultProperties","defaultMaterialLayer","defaultLayerBlock","globalSettings","FBXResult","_writeHeader","_writeDefinitions","_writeObjects","_writeRelations","_writeConnections","FBXHeaderVersion","FBXVersion","timeStampVersion","creator","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","modelVersion","allModels","_verticesIndices","_normalLayer","_colorLayer","materialVersion","allMaterials","_materialProperties","modelsList","_floatArrayToString","colorArray","layerElementColorNumber","layerElementColorVersion","layerElementColorName","colorsStr","colorIndices","normalArray","layerElementNormalNumber","layerElementNormalVersion","layerElementNormalName","normalsStr","multiLayer","multiTake","shading","culling","geometryVersion","vertStr","FBXExporter","_version","miewVersion","_extractor","loaders","parsers","exporters","tempColor","CSS2DRenderer","_height","_widthHalf","_heightHalf","_vector","_viewMatrix","_projectionMatrix","_domElement","overflow","pointerEvents","myNode","setSize","_renderObject","lerpColorAsHex","setHex","getHexString","colorAsHex","setFromMatrixPosition","localOffset","getMaxScaleOnAxis","fogFactor","smoothstep","WebkitTransform","MozTransform","oTransform","getTopWindow","VK_LEFT","VK_UP","VK_RIGHT","VK_DOWN","STATE","NONE","ROTATE","TRANSLATE","SCALE","TRANSLATE_PIVOT","FULL_STOP_THRESHOLD","Quaternion","matrix4","ObjectHandler","lastRotation","_rotate","quat","zeroPivot","makeRotationFromQuaternion","setObjects","rot","mousePrevPos","mouseCurPos","aboutAxis","mouse2rotation","setFromAxisAngle","translateOnAxis","timeSinceLastUpdate","timeSinceMove","intertia","dynamicDampingFactor","intertiaThreshold","eyeDirection","cameraUpDirection","cameraSidewaysDirection","moveDirection","mouseDelta","mousePrev","mouseCur","axisRotateFactor","setLength","rotateFactor","ObjectControls","objectPivot","hotkeysEnabled","screen","_state","_mousePrevPos","_mouseCurPos","_mainObj","_altObj","_affectedObj","_isAltObjFreeRotationAllowed","_isTranslationAllowed","_isKeysTranslatingObj","_pressedKeys","_clock","_lastUpdateTime","_listeners","mousedown","mouseup","mousemove","mousewheel","touchstartend","touchmove","getKeyBindObject","keydownup","handleResize","resetKeys","contextmenu","stopPropagation","preventDefault","innerWidth","innerHeight","getBoundingClientRect","ownerDocument","documentElement","pageXOffset","clientLeft","pageYOffset","clientTop","enableHotkeys","allowTranslation","allow","allowAltObjFreeRotation","keysTranslateObj","isEditingAltObj","convertMouseToOnCircle","pageX","pageY","screenSize","convertMouseToViewport","rotateByMouse","aboutZAxis","getOrientation","setOrientation","getScale","setScale","curTime","_lastMouseMoveTime","speedX","speedY","altObj","button","workWithAltObj","altKey","ctrlKey","shiftKey","translatePivotByMouse","wheelDelta","detail","touches","_touchDistanceCur","_touchDistanceStart","_scaleStart","newScale","keyCode","translatePivotInWorld","setX","setY","setZ","translatePivot","setPivot","newPivot","Picker","_lastMousePos","_mouseTotalDist","_lastClickBeginTime","_lastClickPos","_clickBeginTime","touchstart","touchend","picked","pickObject","screenPos","rayCaster","unproject","fogFarValue","getMouseInViewport","curPos","timeSinceLastClickBegin","clickDist","_lastTouchdownPos","changedTouches","Axes","targetCamera","_target","_targetCamera","_object","AxesHelper","_full","autoClear","setViewport","cDataOffset","cFirstMask","cFirstShift","cSecMask1","cSecShift1","cSecMask2","cSecShift2","cThirdMask","cStrMask","cStrShift","c219","c220","cHelixIdx","cSheetIdx","secTypes","cSecNames","_createSecondary","strArray","nRes","resid","rIdx","fromUInt20ToInt20","uint20","FrameInfo","payload","callbacks","isLoading","_framesRange","frameIsReady","_frameRequest","_callbacks","_framesRequestLength","_downloadDataFn","parseBinaryData","setFrame","_prepareBuffer","framesStart","framesEnd","_framesCount","onDone","onLoadStatusChanged","onFail","onError","_parseBuffer","_bufferRequestStart","arrayBuffer","dataView","atomsCount","framesCount","_atomsCount","maxSize","chunkedFramesCount","timeStep","iName","_timeStep","posData","coordIdx","secondaryArr","hiWord","loWord","_secondaryData","nextFrame","_currFrame","_updateSecondary","myResidues","sec","oldSec","nSec","compRes","getSec","frameIdx","_cachedResidues","disableEvents","_vec","vec","SceneObject","paramsStr","getGeometry","LinesObj","_id1","_id2","_getAtomFromName","err","_atom1","_atom2","_line","computeLineDistances","_raycaster","_intersects","verticesNeedUpdate","OutlineMaterial","srcDepthTex","srcTexSize","DEPTH_OUTLINE","FXAAMaterial","bgTransparent","BG_TRANSPARENT","AOMaterial","diffuseTexture","normalTexture","depthTexture","camNearFar","projMatrix","kernelRadius","depthThreshold","_kernelOffsets","AOHorBlurMaterial","aoMap","samplesOffsets","AOVertBlurWithBlendMaterial","fogNearFar","useFog","AnaglyphMaterial","srcL","srcR","View","orientation","_transitionTime","ViewInterpolator","setup","startView","endView","_endTime","_isPaused","_srcView","_dstView","_isMoving","isMoving","wasStarted","transTime","getCurrentView","success","createView","slerp","pause","resume","MAX_COOKIE_LEN","COUNT_SUFFIX","_chunkString","chunkLen","lc","Cookies","removeCookie","cntKey","_toCount","cntVal","_getSimpleCookie","_removeSimpleCookie","setCookie","_setSimpleCookie","getCookie","cookie","_getExpirationDate","today","EXP_PERIOD_YEARS","setFullYear","toUTCString","_exists","webVRPoC","showEnterVR","cursor","currentSession","onSessionEnded","onSessionStarted","session","_gfx","xr","setReferenceSpaceType","setSession","onmouseenter","onmouseleave","onclick","sessionInit","optionalFeatures","requestSession","then","moveSceneBehindHeadset","showWebXRNotFound","stylizeElement","bottom","padding","border","font","isSessionSupported","supported","textDecoration","createWebVRButton","WebVRPoC","onToggle","_mainCamera","_button","_onToggle","_molContainer","_user","_scalingPivot","_controller1","_controller2","_pressedGripsCounter","_distance","startScalingByControllers","stopScalingByControllers","handleGripsDown","handleGripsUp","anotherController","gfx","_mainFog","_plugVRNodesIntoScene","_setControllersListeners","getController","_createControllerMesh","disable","setAnimationLoop","getSession","_unplugVRNodesFromScene","cylinder","rotateX","updateMoleculeScale","scaler","container","getCanvas","io","LinesObject","fragmentScreenQuadFromDistTex","EDIT_MODE","COMPLEX","COMPONENT","FRAGMENT","LOADER_NOT_FOUND","PARSER_NOT_FOUND","ColorManagement","updateFogRange","removeExtension","hasValidResidues","hasValidRes","reportProgress","percent","TOTAL_PERCENT","chooseFogColor","Miew","settingsCookie","cookiePath","_interpolator","_container","getElementById","head","getElementsByClassName","_containerRoot","_running","_halting","_building","_needRender","_hotKeysEnabled","_cookies","_spinner","_loading","_animInterval","_visuals","_curVisualName","_sourceWindow","registeredPlugins","_initOnSettingsChanged","getMaxRepresentationCount","_setContainerContents","_updateShadowCamera","shadowMatrix","OBB","halfSize","light","getOBB","class","frag","createDocumentFragment","_msgMode","_msgAtomInfo","_showMessage","_initGfx","_initListeners","_onKeyDown","_onKeyUp","_objectControls","_getAltObj","_picker","_onPick","file","keepRepsInfo","job","halt","msg","_showCanvas","_requestAnimationFrame","requestAnimationFrame","arezSpritesSupported","getExtension","isAOSupported","clientWidth","clientHeight","webGLOptions","preserveDrawingBuffer","premultipliedAlpha","renderer2d","WebGL1Renderer","shadowMap","autoUpdate","PCFShadowMap","getContext","setPixelRatio","devicePixelRatio","setClearColor","clearColor","stereoCam","Fog","selectionScene","selectionRoot","selectionPivot","light12","DirectionalLight","pixelRatio","getPixelRatio","shadowMapSize","mapSize","light3","AmbientLight","deviceWidth","deviceHeight","offscreenBuf","WebGLRenderTarget","minFilter","magFilter","depthBuffer","DepthTexture","UnsignedShortType","offscreenBuf2","offscreenBuf3","offscreenBuf4","volBFTex","volFFTex","volWFFTex","offscreenBuf5","FloatType","offscreenBuf6","offscreenBuf7","stereoBufL","stereoBufR","_embedWebXR","stats","_fps","_onResize","_makeUniqueVisualName","baseName","random","suffix","_addVisual","_removeVisual","_forEachVisual","_releaseAllVisuals","_forEachComplexVisual","_getComplexVisual","any","_getVolumeVisual","_getVisualForComplex","getVisuals","getComplexVisualsCount","getCurrentVisual","setCurrentVisual","run","_onTick","_discardComponentEdit","_discardFragmentEdit","enableHotKeys","_resizeOffscreenBuffers","isAnaglyph","multi","_onUpdate","_onRender","_getBSphereRadius","_bSphereForOneVisual","_bBoxForOneVisual","_bBox","_invMatrix","_points","union","_updateFog","_setUberMaterialValues","isScriptingCommandAvailable","callNextCmd","_needRebuild","_updateView","webVR","_clipPlaneUpdateValue","_fogFarUpdateValue","setRenderTarget","_renderFrame","_anaglyphMat","_size","focus","_renderShadowMap","_renderScene","setScissorTest","setScissor","cameraL","cameraR","_onBgColorChanged","_onFogColorChanged","_enableMRT","renderBuffer","textureBuffer","gl","drawBuffersWEBGL","COLOR_ATTACHMENT0","tx8","__webglTexture","bindTexture","TEXTURE_2D","fb","__webglFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT1_WEBGL","distortion","bHaveComplexes","volumeVisual","ssao","_renderWithPrepassTransparency","dstBuffer","srcBuffer","_performAO","_renderOutline","_renderSelection","_renderVolume","_performFXAA","_performDistortion","aberration","targetBuffer","_outlineMaterial","srcDepthBuffer","srcColorBuffer","currentRenderTarget","getRenderTarget","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","setBlending","NoBlending","buffers","setClear","setTest","updateMatrices","_hasSelectionToRender","selPivot","selPivotChild","_checkVolumeRenderingSupport","renderTarget","oldRT","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","volumeBFMat","volumeFFMat","cubeOffsetMat","world2colorMat","volumeRenderingSupported","dstBuf","tmpBuf1","tmpBuf2","tmpBuf3","overrideMaterial","colorMask","_fxaaMaterial","_aoMaterial","_horBlurMaterial","_vertBlurMaterial","_scale","normalBuffer","srcDepthTexture","tempBuffer","tempBuffer1","_lastPick","_setEditMode","_resetObjects","setNeedRender","_resetScene","resetPivot","resetView","_export","TheExporter","exporter","rePdbId","rePubchem","reUrlScheme","resolveSourceShortcut","matchesPdbId","sourceType","matchesPubchem","compound","updateBinaryMode","TheParser","fileExt","_fetchData","TheLoader","newOptions","keyCount","loader","lengthComputable","total","loaded","promise","catch","_parseData","dataSet","onLoadEnd","anything","jobIndex","_refreshTitle","_onLoad","unload","_startAnimation","fileData","_stopAnimation","_frameInfo","isPlaying","_isAnimating","_continueAnimation","_pauseAnimation","clearInterval","minFrameTime","setInterval","_updateObjsToFrame","visualName","amberFileName","resetEd","_onLoadEd","_tweakResolution","_edLoader","loadEd","_rebuildObjects","toRemove","unitIdx","currentUnitInfo","_updateInfoPanel","rebuildActions","appendix","_extractRepresentation","defPreset","_setReps","presList","newIdx","_editMode","getElementsByTagName","_enterComponentEditMode","editors","_editors","_applyComponentEdit","_enterFragmentEditMode","selectedVisuals","_applyFragmentEdit","_updateSelection","firstLine","secondLine","aName","coordLine","nextAltObj","setPivotResidue","amount","setPivotAtom","_centerInVisual","setPivotSubset","_includesInCurSelection","_includesInSelector","screenshot","fov2Tan","tan2Fov","getDataURL","dataURL","currBrowser","canvas","canvasContext","drawImage","toDataURL","screenshotURI","originalTanFov2","areaOfInterestSize","areaOfInterestTanFov2","shotAspect","setDrawingBufferSize","uri","save","dataString","maxPerf","_gfxScore","_autoChangeResolution","setOptions","objData","bThrow","Ctor","_addSceneObject","sceneObject","objs","getState","compact","getScript","_compareReps","compareWithDefaults","currPreset","repsDiff","emptyReps","repsInfo","objectsState","_updateShadowmapMeshes","_updateMaterials","_fogAlphaChanged","evt","Boolean","sel","VIEW_VERSION","eulerOrder","euler","Euler","setFromQuaternion","srcView","dstView","setFromEuler","None","projected","fullAtomName","complexName","project","exportCML","extractRotation","extractBasis","retMat","makeBasis","updateCMLData","xml","removeAttribute","sGroup","oSerializer","XMLSerializer","serializeToString","curChainName","curChainColor","PACKAGE_VERSION","thirdParty","lodash","three","modeIdDesc","$help","colorDesc","materialDesc","addRepDesc","setGetParameterDesc","PDBID","REP_NAME","DESCRIPTION","REP_INDEX","EXPRESSION","MODE_ID","COLORER_ID","MATERIAL_ID","new","del","PARAMETER","set_save","set_restore","set_reset","PRESET","ENCODED_VIEW","removeobj","listobj","parsercli","clihelp","NULL","RepresentationMap","representationMap","representationID","strId","sortedKeys","representationsStorage","CLIUtils","repMap","repName","selectionStr","strList","joinHelpStr","helpData","sortBy","helpItem","awaitWhileCMDisInProcess","finishAwaitingCMDInProcess","modificate","selExc","modificators","modificator","argExc","pathExc","endsWith","utilFunctions","cliUtils","cmd","_val","cliutils","notimplemented","script","_printCallback","_errorCallback","cmdQueue","commandInAction"],"sourceRoot":""} \ No newline at end of file diff --git a/packages/miew/package.json b/packages/miew/package.json index 3fb4df04f..c40f8c400 100644 --- a/packages/miew/package.json +++ b/packages/miew/package.json @@ -1,6 +1,6 @@ { "name": "miew", - "version": "0.9.0", + "version": "0.11.0-0", "description": "Miew - 3D Molecular Viewer", "author": "EPAM Systems, Inc.", "main": "dist/Miew.js", diff --git a/yarn.lock b/yarn.lock index 4cf206213..2d0454fce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10875,6 +10875,16 @@ __metadata: languageName: unknown linkType: soft +"miew-monorepo@workspace:.": + version: 0.0.0-use.local + resolution: "miew-monorepo@workspace:." + dependencies: + lcov-result-merger: ^5.0.1 + mkdirp: ^3.0.1 + rimraf: ^5.0.10 + languageName: unknown + linkType: soft + "miew-react@workspace:packages/miew-react": version: 0.0.0-use.local resolution: "miew-react@workspace:packages/miew-react" @@ -11294,16 +11304,6 @@ __metadata: languageName: node linkType: hard -"monorepo@workspace:.": - version: 0.0.0-use.local - resolution: "monorepo@workspace:." - dependencies: - lcov-result-merger: ^5.0.1 - mkdirp: ^3.0.1 - rimraf: ^5.0.10 - languageName: unknown - linkType: soft - "ms@npm:2.0.0": version: 2.0.0 resolution: "ms@npm:2.0.0"